mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-09 00:42:36 +00:00
Refactor on directives
This commit is contained in:
parent
0f0c9b95b2
commit
9b9444b6b0
6 changed files with 14 additions and 10 deletions
|
@ -15,13 +15,12 @@ const BaseDirective = {
|
|||
: ObjectUtils.getItemValue(options, params);
|
||||
},
|
||||
_getPTValue: (instance = {}, obj = {}, key = '', params = {}, searchInDefaultPT = true) => {
|
||||
const name = ObjectUtils.convertToFlatCase(instance.$name);
|
||||
const datasetPrefix = name ? `data-pd-${name}` : '';
|
||||
const datasetPrefix = 'data-pc-';
|
||||
const self = BaseDirective._getOptionValue(obj, key, params);
|
||||
const globalPT = searchInDefaultPT ? BaseDirective._getOptionValue(instance.defaultPT, key, params) : undefined;
|
||||
const merged = mergeProps(self, globalPT, {
|
||||
...(key === 'root' && { [datasetPrefix]: true }),
|
||||
[`${datasetPrefix}-section`]: ObjectUtils.convertToFlatCase(key)
|
||||
...(key === 'root' && { [`${datasetPrefix}name`]: ObjectUtils.convertToFlatCase(instance.$name) }),
|
||||
[`${datasetPrefix}section`]: ObjectUtils.convertToFlatCase(key)
|
||||
});
|
||||
|
||||
return merged;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue