Skip to content

Commit

Permalink
fixup! fix(NcAppNavigationItem): use $scopedSlots instead of $slots
Browse files Browse the repository at this point in the history
  • Loading branch information
st3iny committed Oct 29, 2024
1 parent 5cde9ca commit ff8ebf2
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions src/components/NcAppNavigationItem/NcAppNavigationItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ Just set the `pinned` prop.
:class="{
'app-navigation-entry--opened': opened,
'app-navigation-entry--pinned': pinned,
'app-navigation-entry--collapsible': collapsible,
'app-navigation-entry--collapsible': isCollapsible(),
}"
class="app-navigation-entry-wrapper">
<component :is="isRouterLink ? 'router-link' : 'NcVNodes'"
Expand All @@ -275,7 +275,7 @@ Just set the `pinned` prop.
class="app-navigation-entry-link"
:aria-current="active || (isActive && to) ? 'page' : undefined"
:aria-description="ariaDescription"
:aria-expanded="hasChildren ? opened.toString() : undefined"
:aria-expanded="$scopedSlots.default ? opened.toString() : undefined"
:href="href || routerLinkHref || '#'"
:target="isExternal(href) ? '_blank' : undefined"
:title="title || name"
Expand Down Expand Up @@ -356,14 +356,14 @@ Just set the `pinned` prop.
<slot name="actions" />
</NcActions>
</div>
<NcAppNavigationIconCollapsible v-if="collapsible" :open="opened" @click.prevent.stop="toggleCollapse" />
<NcAppNavigationIconCollapsible v-if="isCollapsible()" :open="opened" @click.prevent.stop="toggleCollapse" />

<!-- @slot Slot for anything (virtual) that should be mounted in the component, like a related modal -->
<slot name="extra" />
</div>
</component>
<!-- Children elements -->
<ul v-if="canHaveChildren && hasChildren" class="app-navigation-entry__children">
<ul v-if="canHaveChildren && $scopedSlots.default" class="app-navigation-entry__children">
<!-- @slot Slot for children -->
<slot />
</ul>
Expand Down Expand Up @@ -614,13 +614,11 @@ export default {
editingValue: '',
opened: this.open, // Collapsible state
editingActive: false,
hasChildren: false,
/**
* Tracks the open state of the actions menu
*/
menuOpenLocalValue: false,
focused: false,
collapsible: false,
actionsBoundariesElement: undefined,
}
},
Expand Down Expand Up @@ -666,14 +664,6 @@ export default {
this.actionsBoundariesElement = document.querySelector('#content-vue') || undefined
},
created() {
this.updateSlotInfo()
},
beforeUpdate() {
this.updateSlotInfo()
},
methods: {
// sync opened menu state with prop
onMenuToggle(state) {
Expand Down Expand Up @@ -730,9 +720,13 @@ export default {
this.$emit('undo')
},
updateSlotInfo() {
this.hasChildren = !!this.$scopedSlots.default
this.collapsible = this.allowCollapse && !!this.$scopedSlots.default
/**
* Does this item have children and is collapsing allowed via the prop?
*
* @return {boolean} True, if the item can be collapsed
*/
isCollapsible() {
return this.allowCollapse && !!this.$scopedSlots.default
},
/**
Expand Down

0 comments on commit ff8ebf2

Please sign in to comment.