Update API doc

pull/5414/head
GitHub Actions Bot 2024-03-13 13:10:35 +00:00
parent dc724ea2d3
commit 31dde8355a
3 changed files with 20 additions and 7 deletions

View File

@ -55,12 +55,12 @@ describe('Tree.vue', () => {
expect(wrapper.emitted('filter')).toBeTruthy(); expect(wrapper.emitted('filter')).toBeTruthy();
}); });
it('should render icon', ({expect})=>{ it('should render icon', ({ expect }) => {
expect(wrapper.find('span.pi-inbox').exists()).toBeTruthy(); expect(wrapper.find('span.pi-inbox').exists()).toBeTruthy();
expect(wrapper.find('span.pi-inbox').classes('p-treenode-icon')).toBeTruthy() expect(wrapper.find('span.pi-inbox').classes('p-treenode-icon')).toBeTruthy();
}) });
it('should render icon slot', ({expect})=>{ it('should render icon slot', ({ expect }) => {
let wrapper = mount(Tree, { let wrapper = mount(Tree, {
slots: { slots: {
nodeIcon: `<i data-node-icon/>` nodeIcon: `<i data-node-icon/>`
@ -80,5 +80,5 @@ describe('Tree.vue', () => {
const nodeIcon = wrapper.find('i[data-node-icon]'); const nodeIcon = wrapper.find('i[data-node-icon]');
expect(nodeIcon.exists()).toBeTruthy(); expect(nodeIcon.exists()).toBeTruthy();
}) });
}); });

View File

@ -33,10 +33,10 @@
</template> </template>
</Checkbox> </Checkbox>
<template v-if="templates['nodeIcon']"> <template v-if="templates['nodeIcon']">
<component :is="templates['nodeIcon']" v-bind="getPTOptions('nodeIcon')" :class="cx('nodeIcon')" :node="node"></component> <component :is="templates['nodeIcon']" v-bind="getPTOptions('nodeIcon')" :class="cx('nodeIcon')" :node="node"></component>
</template> </template>
<template v-else> <template v-else>
<span :class="[cx('nodeIcon'), node.icon]" v-bind="getPTOptions('nodeIcon')"></span> <span :class="[cx('nodeIcon'), node.icon]" v-bind="getPTOptions('nodeIcon')"></span>
</template> </template>
<span :class="cx('label')" v-bind="getPTOptions('label')" @keydown.stop> <span :class="cx('label')" v-bind="getPTOptions('label')" @keydown.stop>
<component v-if="templates[node.type] || templates['default']" :is="templates[node.type] || templates['default']" :node="node" /> <component v-if="templates[node.type] || templates['default']" :is="templates[node.type] || templates['default']" :node="node" />

View File

@ -57309,6 +57309,19 @@
"returnType": "VNode<RendererNode, RendererElement, Object>[]", "returnType": "VNode<RendererNode, RendererElement, Object>[]",
"description": "Custom toggler icon template." "description": "Custom toggler icon template."
}, },
{
"name": "nodeIcon",
"parameters": [
{
"name": "scope",
"optional": false,
"type": "{\n \t <span class=\"ml-3 doc-option-parameter-name\">node</span>: <span class=\"doc-option-parameter-type\">TreeNode</span>, <span class=\"doc-option-parameter-type\">// Tree node instance</span>\n }",
"description": "togglericon slot's params."
}
],
"returnType": "VNode<RendererNode, RendererElement, Object>[]",
"description": "Custom node icon template."
},
{ {
"name": "checkboxicon", "name": "checkboxicon",
"parameters": [ "parameters": [