Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[next] feat(NcListItem): migrate to vue 3 #4726

Merged
merged 1 commit into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 5 additions & 13 deletions src/components/NcListItem/NcListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,10 @@
<!-- This wrapper can be either a router link or a `<li>` -->
<component :is="to ? 'router-link' : 'NcVNodes'"
v-slot="{ href: routerLinkHref, navigate, isActive }"
:custom="to ? true : null"
:to="to"
:exact="to ? exact : null">
v-bind="{ ...to && { custom: true, to } }">
<li class="list-item__wrapper"
:class="{ 'list-item__wrapper--active' : isActive || active }">
:class="{ 'list-item__wrapper--active' : isActive || active }"
v-bind="$attrs">
<a :id="anchorId"
ref="list-item"
:href="routerLinkHref || href"
Expand Down Expand Up @@ -323,6 +322,8 @@ export default {
NcVNodes,
},

inheritAttrs: false,

props: {
/**
* The details text displayed in the upper right part of the component
Expand All @@ -340,15 +341,6 @@ export default {
required: true,
},

/**
* Pass in `true` if you want the matching behavior to
* be non-inclusive: https://router.vuejs.org/api/#exact
*/
exact: {
type: Boolean,
default: false,
},

/**
* The route for the router link.
*/
Expand Down
5 changes: 2 additions & 3 deletions src/components/NcVNodes/NcVNodes.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,10 @@ export default {
/**
* The render function to display the component
*
* @param {Function} h The function to create VNodes
* @return {object} The created VNode
*/
render(h) {
return this.vnodes || this.$slots?.default || this.$scopedSlots?.default?.()
render() {
return this.vnodes || this.$slots?.default?.({})
},
}
</script>
3 changes: 1 addition & 2 deletions src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ export { default as NcIconSvgWrapper } from './NcIconSvgWrapper/index.js'
// Not exported on purpose as it is only meant as a base component
// export { default as NcInputField } from './NcInputField/index.js'

// Not yet adjusted for vue3
// export { default as NcListItem } from './NcListItem/index.js'
export { default as NcListItem } from './NcListItem/index.js'
export { default as NcListItemIcon } from './NcListItemIcon/index.js'
export { default as NcLoadingIcon } from './NcLoadingIcon/index.js'
// export { default as NcModal } from './NcModal/index.js'
Expand Down
3 changes: 1 addition & 2 deletions styleguide.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,7 @@ module.exports = async () => {
{
name: 'NcListItems',
components: [
//'src/components/NcListItem*/*.vue',
'src/components/NcListItemIcon/*.vue',
'src/components/NcListItem*/*.vue',
],
},
{
Expand Down
Loading