Skip to content

Commit

Permalink
Merge pull request #5453 from ig-onoffice-de/pass-class-to-nodeicon-slot
Browse files Browse the repository at this point in the history
(fix)Tree: Pass class to TreeNodes nodeIcon slot
  • Loading branch information
tugcekucukoglu authored Mar 22, 2024
2 parents 0d4f5f2 + f2a1d9f commit bca0dd6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions components/lib/tree/Tree.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,10 @@ export interface TreeSlots {
* Tree node instance
*/
node: TreeNode;
/**
* Style class of the icon.
*/
class: string;
}): VNode[];
/**
* Custom checkbox icon
Expand Down
2 changes: 1 addition & 1 deletion components/lib/tree/Tree.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down
2 changes: 1 addition & 1 deletion components/lib/tree/TreeNode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand Down

0 comments on commit bca0dd6

Please sign in to comment.