Fixed #6513 - Tree: new header and footer slots

pull/6537/head
tugcekucukoglu 2024-10-02 14:19:04 +03:00
parent 9d4588308d
commit da7b4fb3f6
2 changed files with 38 additions and 0 deletions

View File

@ -461,6 +461,42 @@ export interface TreeSlots {
*/ */
partialChecked: boolean; partialChecked: boolean;
}): VNode[]; }): 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. * Optional slots.
* @todo * @todo

View File

@ -18,6 +18,7 @@
</InputIcon> </InputIcon>
</IconField> </IconField>
<div :class="cx('wrapper')" :style="{ maxHeight: scrollHeight }" v-bind="ptm('wrapper')"> <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')"> <ul :class="cx('rootChildren')" role="tree" :aria-labelledby="ariaLabelledby" :aria-label="ariaLabel" v-bind="ptm('rootChildren')">
<TreeNode <TreeNode
v-for="(node, index) of valueToRender" v-for="(node, index) of valueToRender"
@ -37,6 +38,7 @@
:pt="pt" :pt="pt"
></TreeNode> ></TreeNode>
</ul> </ul>
<slot name="footer" :value="value" :expandedKeys="expandedKeys" :selectionKeys="selectionKeys" />
</div> </div>
</div> </div>
</template> </template>