Fixed #4400 - The `ptOptions` property is not working with nested components

pull/4409/head
mertsincan 2023-09-07 10:48:40 +01:00
parent 78ce9d1f10
commit 6b1b47939f
1 changed files with 4 additions and 1 deletions

View File

@ -455,6 +455,9 @@ export default {
_getHostInstance(instance) { _getHostInstance(instance) {
return instance ? (this.$options.hostName ? (instance.$.type.name === this.$options.hostName ? instance : this._getHostInstance(instance.$parentInstance)) : instance.$parentInstance) : undefined; return instance ? (this.$options.hostName ? (instance.$.type.name === this.$options.hostName ? instance : this._getHostInstance(instance.$parentInstance)) : instance.$parentInstance) : undefined;
}, },
_getPropValue(name) {
return this[name] || this._getHostInstance(this)?.[name];
},
_getOptionValue(options, key = '', params = {}) { _getOptionValue(options, key = '', params = {}) {
const fKeys = ObjectUtils.toFlatCase(key).split('.'); const fKeys = ObjectUtils.toFlatCase(key).split('.');
const fKey = fKeys.shift(); const fKey = fKeys.shift();
@ -468,7 +471,7 @@ export default {
_getPTValue(obj = {}, key = '', params = {}, searchInDefaultPT = true) { _getPTValue(obj = {}, key = '', params = {}, searchInDefaultPT = true) {
const datasetPrefix = 'data-pc-'; const datasetPrefix = 'data-pc-';
const searchOut = /./g.test(key) && !!params[key.split('.')[0]]; const searchOut = /./g.test(key) && !!params[key.split('.')[0]];
const { mergeSections = true, mergeProps: useMergeProps = false } = this.ptOptions || {}; const { mergeSections = true, mergeProps: useMergeProps = false } = this._getPropValue('ptOptions') || {};
const global = searchInDefaultPT ? (searchOut ? this._useGlobalPT(this._getPTClassValue, key, params) : this._useDefaultPT(this._getPTClassValue, key, params)) : undefined; const global = searchInDefaultPT ? (searchOut ? this._useGlobalPT(this._getPTClassValue, key, params) : this._useDefaultPT(this._getPTClassValue, key, params)) : undefined;
const self = searchOut ? undefined : this._usePT(this._getPT(obj, this.$name), this._getPTClassValue, key, { ...params, global: global || {} }); const self = searchOut ? undefined : this._usePT(this._getPT(obj, this.$name), this._getPTClassValue, key, { ...params, global: global || {} });
const datasets = key !== 'transition' && { const datasets = key !== 'transition' && {