This commit is contained in:
mertsincan 2023-09-05 11:18:36 +01:00
parent e49179be34
commit 57ce4e0183
2 changed files with 9 additions and 8 deletions

View file

@ -470,7 +470,7 @@ export default {
const searchOut = /./g.test(key) && !!params[key.split('.')[0]];
const { mergeSections = true, mergeProps: useMergeProps = false } = this.ptOptions || {};
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 });
const self = searchOut ? undefined : this._usePT(this._getPT(obj, this.$name), this._getPTClassValue, key, { ...params, global: global || {} });
const datasets = key !== 'transition' && {
...(key === 'root' && { [`${datasetPrefix}name`]: ObjectUtils.toFlatCase(this.$.type.name) }),
[`${datasetPrefix}section`]: ObjectUtils.toFlatCase(key)
@ -486,12 +486,12 @@ export default {
_getPT(pt, key = '', callback) {
const _usept = pt?.['_usept'];
const getValue = (value) => {
const getValue = (value, checkSameKey = false) => {
const computedValue = callback ? callback(value) : value;
const _key = ObjectUtils.toFlatCase(key);
const _cKey = ObjectUtils.toFlatCase(this.$name);
return (_key !== _cKey ? computedValue?.[_key] : undefined) ?? computedValue;
return (checkSameKey ? (_key !== _cKey ? computedValue?.[_key] : undefined) : computedValue?.[_key]) ?? computedValue;
};
return ObjectUtils.isNotEmpty(_usept)
@ -500,13 +500,13 @@ export default {
originalValue: getValue(pt.originalValue),
value: getValue(pt.value)
}
: getValue(pt);
: getValue(pt, true);
},
_usePT(pt, callback, key, params) {
const fn = (value) => callback(value, key, params);
if (pt?.hasOwnProperty('_usept')) {
const { mergeSections = true, mergeProps: useMergeProps = false } = this.ptOptions || pt['_usept'] || {};
const { mergeSections = true, mergeProps: useMergeProps = false } = pt['_usept'] || {};
const originalValue = fn(pt.originalValue);
const value = fn(pt.value);