Merge pull request #5453 from ig-onoffice-de/pass-class-to-nodeicon-slot

(fix)Tree: Pass class to TreeNodes nodeIcon slot
pull/5467/head
Tuğçe Küçükoğlu 2024-03-22 12:13:21 +03:00 committed by GitHub
commit bca0dd6b5a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 2 deletions

View File

@ -361,6 +361,10 @@ export interface TreeSlots {
* Tree node instance
*/
node: TreeNode;
/**
* Style class of the icon.
*/
class: string;
}): VNode[];
/**
* Custom checkbox icon

View File

@ -63,7 +63,7 @@ describe('Tree.vue', () => {
it('should render icon slot', ({ expect }) => {
let wrapper = mount(Tree, {
slots: {
nodeIcon: `<i data-node-icon/>`
nodeicon: `<i data-node-icon/>`
},
props: {
value: [

View File

@ -32,7 +32,7 @@
<component v-else :is="checked ? 'CheckIcon' : partialChecked ? 'MinusIcon' : null" :class="slotProps.class" v-bind="getPTOptions('nodeCheckbox.icon')" />
</template>
</Checkbox>
<component v-if="templates['nodeicon']" :is="templates['nodeicon']" :node="node"></component>
<component v-if="templates['nodeicon']" :is="templates['nodeicon']" :node="node" :class="[cx('nodeIcon')]"></component>
<span v-else :class="[cx('nodeIcon'), node.icon]" v-bind="getPTOptions('nodeIcon')"></span>
<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" />