Skip to content

refactor(NcVNodes): migrate component to Typescript #6822

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
12 changes: 6 additions & 6 deletions src/components/NcAppNavigationItem/NcAppNavigationItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -391,18 +391,18 @@ Just set the `pinned` prop.
</template>

<script>
import NcActions from '../NcActions/index.js'
import NcActionButton from '../NcActionButton/index.js'
import NcLoadingIcon from '../NcLoadingIcon/index.js'
import NcVNodes from '../NcVNodes/index.js'
import NcAppNavigationIconCollapsible from './NcAppNavigationIconCollapsible.vue'
import NcInputConfirmCancel from './NcInputConfirmCancel.vue'
import { useIsMobile } from '../../composables/useIsMobile/index.js'
import { createElementId } from '../../utils/createElementId.ts'
import { t } from '../../l10n.js'

import Pencil from 'vue-material-design-icons/Pencil.vue'
import Undo from 'vue-material-design-icons/Undo.vue'
import NcActions from '../NcActions/index.js'
import NcActionButton from '../NcActionButton/index.js'
import NcAppNavigationIconCollapsible from './NcAppNavigationIconCollapsible.vue'
import NcInputConfirmCancel from './NcInputConfirmCancel.vue'
import NcLoadingIcon from '../NcLoadingIcon/index.js'
import NcVNodes from '../NcVNodes/index.ts'

export default {
name: 'NcAppNavigationItem',
Expand Down
8 changes: 4 additions & 4 deletions src/components/NcAppSettingsDialog/NcAppSettingsDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,13 @@ export default {
</template>

<script>
import NcDialog from '../NcDialog/index.js'
import NcVNodes from '../NcVNodes/index.js'
import debounce from 'debounce'
import { warn } from 'vue'
import { useIsMobile } from '../../composables/useIsMobile/index.js'
import { t } from '../../l10n.js'

import debounce from 'debounce'
import { warn } from 'vue'
import NcDialog from '../NcDialog/index.js'
import NcVNodes from '../NcVNodes/index.ts'

export default {

Expand Down
2 changes: 1 addition & 1 deletion src/components/NcAppSidebar/NcAppSidebarTabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
</template>

<script>
import NcVNodes from '../NcVNodes/index.js'
import NcCheckboxRadioSwitch from '../NcCheckboxRadioSwitch/index.js'
import NcVNodes from '../NcVNodes/index.ts'

export default {
name: 'NcAppSidebarTabs',
Expand Down
2 changes: 1 addition & 1 deletion src/components/NcListItem/NcListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ The `actions-icon` slot can be used to pass icon to the inner NcActions componen
<script>
import NcActions from '../NcActions/index.js'
import NcCounterBubble from '../NcCounterBubble/index.js'
import NcVNodes from '../NcVNodes/index.js'
import NcVNodes from '../NcVNodes/index.ts'

export default {
name: 'NcListItem',
Expand Down
15 changes: 9 additions & 6 deletions src/components/NcVNodes/NcVNodes.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,25 +52,28 @@ export default {
```
</docs>

<script>
export default {
<script lang="ts">
import type { PropType, VNode } from 'vue'
import { defineComponent } from 'vue'

export default defineComponent({
name: 'NcVNodes',

props: {
/**
* The vnodes to render
*/
vnodes: {
type: [Array, Object],
type: [Array, Object] as PropType<VNode | VNode[]>,
default: null,
},
},

/**
* The render function to display the component
*
* @return {object} The created VNode
*/
render() {
return this.vnodes || this.$slots?.default?.({})
},
}
})
</script>
File renamed without changes.
2 changes: 1 addition & 1 deletion src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ 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'
export { default as NcVNodes } from './NcVNodes/index.js'
export { default as NcNoteCard } from './NcNoteCard/index.js'
export { default as NcPasswordField } from './NcPasswordField/index.js'
export { default as NcPopover } from './NcPopover/index.js'
Expand All @@ -82,3 +81,4 @@ export { default as NcTextField } from './NcTextField/index.js'
export { default as NcTimezonePicker } from './NcTimezonePicker/index.js'
export { default as NcUserBubble } from './NcUserBubble/index.js'
export { default as NcUserStatusIcon } from './NcUserStatusIcon/index.js'
export { default as NcVNodes } from './NcVNodes/index.ts'
Loading