mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-09 17:02:38 +00:00
Refactor #3965 - Rename BaseComponent methods
This commit is contained in:
parent
4e42aab642
commit
ae532e78ec
1 changed files with 12 additions and 12 deletions
|
@ -28,20 +28,20 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getOptionValue(options, key = '', params = {}) {
|
_getOptionValue(options, key = '', params = {}) {
|
||||||
const fKeys = ObjectUtils.convertToFlatCase(key).split('.');
|
const fKeys = ObjectUtils.convertToFlatCase(key).split('.');
|
||||||
const fKey = fKeys.shift();
|
const fKey = fKeys.shift();
|
||||||
|
|
||||||
return fKey
|
return fKey
|
||||||
? ObjectUtils.isObject(options)
|
? ObjectUtils.isObject(options)
|
||||||
? this.getOptionValue(ObjectUtils.getItemValue(options[Object.keys(options).find((k) => ObjectUtils.convertToFlatCase(k) === fKey) || ''], params), fKeys.join('.'), params)
|
? this._getOptionValue(ObjectUtils.getItemValue(options[Object.keys(options).find((k) => ObjectUtils.convertToFlatCase(k) === fKey) || ''], params), fKeys.join('.'), params)
|
||||||
: undefined
|
: undefined
|
||||||
: ObjectUtils.getItemValue(options, params);
|
: ObjectUtils.getItemValue(options, params);
|
||||||
},
|
},
|
||||||
getPTValue(obj = {}, key = '', params = {}) {
|
_getPTValue(obj = {}, key = '', params = {}) {
|
||||||
const datasetPrefix = 'data-pc-';
|
const datasetPrefix = 'data-pc-';
|
||||||
const self = this.getOptionValue(obj, key, params);
|
const self = this._getOptionValue(obj, key, params);
|
||||||
const globalPT = this.getOptionValue(this.defaultPT, key, params);
|
const globalPT = this._getOptionValue(this.defaultPT, key, params);
|
||||||
const merged = mergeProps(self, globalPT, {
|
const merged = mergeProps(self, globalPT, {
|
||||||
...(key === 'root' && { [`${datasetPrefix}name`]: ObjectUtils.convertToFlatCase(this.$.type.name) }),
|
...(key === 'root' && { [`${datasetPrefix}name`]: ObjectUtils.convertToFlatCase(this.$.type.name) }),
|
||||||
[`${datasetPrefix}section`]: ObjectUtils.convertToFlatCase(key)
|
[`${datasetPrefix}section`]: ObjectUtils.convertToFlatCase(key)
|
||||||
|
@ -55,22 +55,22 @@ export default {
|
||||||
*/
|
*/
|
||||||
},
|
},
|
||||||
ptm(key = '', params = {}) {
|
ptm(key = '', params = {}) {
|
||||||
return this.getPTValue(this.pt, key, { props: this.$props, state: this.$data, ...params });
|
return this._getPTValue(this.pt, key, { props: this.$props, state: this.$data, ...params });
|
||||||
},
|
},
|
||||||
ptmo(obj = {}, key = '', params = {}) {
|
ptmo(obj = {}, key = '', params = {}) {
|
||||||
return this.getPTValue(obj, key, params);
|
return this._getPTValue(obj, key, params);
|
||||||
},
|
},
|
||||||
cx(key = '', params = {}) {
|
cx(key = '', params = {}) {
|
||||||
return !this.isUnstyled ? this.getOptionValue(this.$options.css && this.$options.css.classes, key, { instance: this, props: this.$props, state: this.$data, ...params }) : undefined;
|
return !this.isUnstyled ? this._getOptionValue(this.$options.css && this.$options.css.classes, key, { instance: this, props: this.$props, state: this.$data, ...params }) : undefined;
|
||||||
},
|
},
|
||||||
cxo(obj = {}, key = '', params = {}) {
|
cxo(obj = {}, key = '', params = {}) {
|
||||||
// @todo
|
// @todo
|
||||||
return !this.isUnstyled ? this.getOptionValue(obj.css && obj.css.classes, key, { instance: obj, props: obj && obj.props, state: obj && obj.data, ...params }) : undefined;
|
return !this.isUnstyled ? this._getOptionValue(obj.css && obj.css.classes, key, { instance: obj, props: obj && obj.props, state: obj && obj.data, ...params }) : undefined;
|
||||||
},
|
},
|
||||||
sx(key = '', when = true, params = {}) {
|
sx(key = '', when = true, params = {}) {
|
||||||
if (when) {
|
if (when) {
|
||||||
const self = this.getOptionValue(this.$options.css && this.$options.css.inlineStyles, key, { instance: this, props: this.$props, state: this.$data, ...params });
|
const self = this._getOptionValue(this.$options.css && this.$options.css.inlineStyles, key, { instance: this, props: this.$props, state: this.$data, ...params });
|
||||||
const base = this.getOptionValue(inlineStyles, key, { instance: this, props: this.$props, state: this.$data, ...params });
|
const base = this._getOptionValue(inlineStyles, key, { instance: this, props: this.$props, state: this.$data, ...params });
|
||||||
|
|
||||||
return [base, self];
|
return [base, self];
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ export default {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
defaultPT() {
|
defaultPT() {
|
||||||
return this.getOptionValue(this.$primevue.config.pt, this.$.type.name, this.defaultsParams);
|
return this._getOptionValue(this.$primevue.config.pt, this.$.type.name, this.defaultsParams);
|
||||||
},
|
},
|
||||||
defaultsParams() {
|
defaultsParams() {
|
||||||
return { instance: this };
|
return { instance: this };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue