Refactor #3965 - context added Tree & CascadeSelect

pull/4004/head
Tuğçe Küçükoğlu 2023-05-29 12:22:01 +03:00
parent 34a3b7ead0
commit 6746570c97
4 changed files with 19 additions and 19 deletions

View File

@ -122,13 +122,13 @@ const classes = {
wrapper: 'p-cascadeselect-items-wrapper', wrapper: 'p-cascadeselect-items-wrapper',
hiddenSelectedMessage: 'p-hidden-accessible', hiddenSelectedMessage: 'p-hidden-accessible',
list: 'p-cascadeselect-panel p-cascadeselect-items', list: 'p-cascadeselect-panel p-cascadeselect-items',
item: ({ cascadesub, processedOption }) => [ item: ({ context, processedOption }) => [
'p-cascadeselect-item', 'p-cascadeselect-item',
{ {
'p-cascadeselect-item-group': cascadesub.isOptionGroup(processedOption), 'p-cascadeselect-item-group': context.isOptionGroup(processedOption),
'p-cascadeselect-item-active p-highlight': cascadesub.isOptionActive(processedOption), 'p-cascadeselect-item-active p-highlight': context.isOptionActive(processedOption),
'p-focus': cascadesub.isOptionFocused(processedOption), 'p-focus': context.isOptionFocused(processedOption),
'p-disabled': cascadesub.isOptionDisabled(processedOption) 'p-disabled': context.isOptionDisabled(processedOption)
} }
], ],
content: 'p-cascadeselect-item-content', content: 'p-cascadeselect-item-content',

View File

@ -133,7 +133,7 @@ export default {
getCXOptions(key, params) { getCXOptions(key, params) {
return this.cx(key, { return this.cx(key, {
...params, ...params,
cascadesub: this context: this
}); });
} }
}, },

View File

@ -102,29 +102,29 @@ const classes = {
searchIcon: 'p-tree-filter-icon', searchIcon: 'p-tree-filter-icon',
wrapper: 'p-tree-wrapper', wrapper: 'p-tree-wrapper',
container: 'p-tree-container', container: 'p-tree-container',
node: ({ treenode }) => ['p-treenode', { 'p-treenode-leaf': treenode.leaf }], node: ({ context }) => ['p-context', { 'p-context-leaf': context.leaf }],
content: ({ treenode }) => [ content: ({ context }) => [
'p-treenode-content', 'p-context-content',
treenode.node.styleClass, context.node.styleClass,
{ {
'p-treenode-selectable': treenode.selectable, 'p-context-selectable': context.selectable,
'p-highlight': treenode.checkboxMode ? treenode.checked : treenode.selected 'p-highlight': context.checkboxMode ? context.checked : context.selected
} }
], ],
toggler: 'p-tree-toggler p-link', toggler: 'p-tree-toggler p-link',
togglerIcon: 'p-tree-toggler-icon', togglerIcon: 'p-tree-toggler-icon',
checkboxContainer: 'p-checkbox p-component', checkboxContainer: 'p-checkbox p-component',
checkbox: ({ treenode }) => [ checkbox: ({ context }) => [
'p-checkbox-box', 'p-checkbox-box',
{ {
'p-highlight': treenode.checked, 'p-highlight': context.checked,
'p-indeterminate': treenode.partialChecked 'p-indeterminate': context.partialChecked
} }
], ],
checkboxIcon: 'p-checkbox-icon', checkboxIcon: 'p-checkbox-icon',
nodeIcon: ({ treenode }) => ['p-treenode-icon', treenode.node.icon], nodeIcon: ({ context }) => ['p-context-icon', context.node.icon],
label: 'p-treenode-label', label: 'p-context-label',
subgroup: 'p-treenode-children' subgroup: 'p-context-children'
}; };
const { load: loadStyle, unload: unloadStyle } = useStyle(styles, { id: 'primevue_tree_style', manual: true }); const { load: loadStyle, unload: unloadStyle } = useStyle(styles, { id: 'primevue_tree_style', manual: true });

View File

@ -122,7 +122,7 @@ export default {
}, },
getCXOptions(key) { getCXOptions(key) {
return this.cx(key, { return this.cx(key, {
treenode: this context: this
}); });
}, },
onClick(event) { onClick(event) {