Skip to content

Commit

Permalink
Fixed #6513 - Tree: new header and footer slots
Browse files Browse the repository at this point in the history
  • Loading branch information
tugcekucukoglu committed Oct 2, 2024
1 parent 9d45883 commit da7b4fb
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
36 changes: 36 additions & 0 deletions packages/primevue/src/tree/Tree.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,42 @@ export interface TreeSlots {
*/
partialChecked: boolean;
}): VNode[];
/**
* Custom header
* @param {Object} scope - header slot's params.
*/
header(scope: {
/**
* Current value
*/
value: TreeNode[];
/**
* Current expanded key
*/
expandedKeys: TreeExpandedKeys;
/**
* Current selected keys
*/
selectionKeys: TreeSelectionKeys;
}): VNode[];
/**
* Custom footer
* @param {Object} scope - footer slot's params.
*/
footer(scope: {
/**
* Current value
*/
value: TreeNode[];
/**
* Current expanded key
*/
expandedKeys: TreeExpandedKeys;
/**
* Current selected keys
*/
selectionKeys: TreeSelectionKeys;
}): VNode[];
/**
* Optional slots.
* @todo
Expand Down
2 changes: 2 additions & 0 deletions packages/primevue/src/tree/Tree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
</InputIcon>
</IconField>
<div :class="cx('wrapper')" :style="{ maxHeight: scrollHeight }" v-bind="ptm('wrapper')">
<slot name="header" :value="value" :expandedKeys="expandedKeys" :selectionKeys="selectionKeys" />
<ul :class="cx('rootChildren')" role="tree" :aria-labelledby="ariaLabelledby" :aria-label="ariaLabel" v-bind="ptm('rootChildren')">
<TreeNode
v-for="(node, index) of valueToRender"
Expand All @@ -37,6 +38,7 @@
:pt="pt"
></TreeNode>
</ul>
<slot name="footer" :value="value" :expandedKeys="expandedKeys" :selectionKeys="selectionKeys" />
</div>
</div>
</template>
Expand Down

0 comments on commit da7b4fb

Please sign in to comment.