From be76ec4998c0e16b297566c684fa8e18109c2628 Mon Sep 17 00:00:00 2001 From: braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Sat, 30 Jul 2022 00:05:08 +0200 Subject: [PATCH] chore(gui-v2): type cleanups --- packages/nc-gui-v2/components/cell/Rating.vue | 40 +++++-------------- .../nc-gui-v2/components/dlg/TableCreate.vue | 3 +- .../nc-gui-v2/components/dlg/ViewDelete.vue | 4 +- .../nc-gui-v2/components/general/Share.vue | 2 +- .../components/smartsheet/Pagination.vue | 2 +- .../nc-gui-v2/components/tabs/Smartsheet.vue | 2 +- .../components/virtual-cell/Rollup.vue | 2 +- .../virtual-cell/components/ItemChip.vue | 10 +---- .../components/ListChildItems.vue | 2 +- .../virtual-cell/components/ListItems.vue | 2 +- packages/nc-gui-v2/pages/signin.vue | 5 ++- 11 files changed, 26 insertions(+), 48 deletions(-) diff --git a/packages/nc-gui-v2/components/cell/Rating.vue b/packages/nc-gui-v2/components/cell/Rating.vue index 0893d50bff..9230284228 100644 --- a/packages/nc-gui-v2/components/cell/Rating.vue +++ b/packages/nc-gui-v2/components/cell/Rating.vue @@ -5,47 +5,27 @@ import MdiStarIcon from '~icons/mdi/star' import MdiStarOutlineIcon from '~icons/mdi/star-outline' interface Props { - modelValue?: string | number + modelValue?: number readOnly?: boolean } -const { modelValue: value, readOnly } = defineProps() +const props = defineProps() + const emit = defineEmits(['update:modelValue']) + +const vModel = useVModel(props, 'modelValue', emit) + const column = inject(ColumnInj) const isForm = inject(IsFormInj) - -const ratingMeta = computed(() => { - return { - icon: { - full: 'mdi-star', - empty: 'mdi-star-outline', - }, - color: '#fcb401', - max: 5, - // ...(column?.meta || {}) - } -}) -const localState = computed({ - get: () => value, - set: (val) => emit('update:modelValue', val), -}) - - diff --git a/packages/nc-gui-v2/components/dlg/TableCreate.vue b/packages/nc-gui-v2/components/dlg/TableCreate.vue index 9466bd41f4..7aaf775c5c 100644 --- a/packages/nc-gui-v2/components/dlg/TableCreate.vue +++ b/packages/nc-gui-v2/components/dlg/TableCreate.vue @@ -4,6 +4,7 @@ import { Form } from 'ant-design-vue' import { useToast } from 'vue-toastification' import { onMounted, useProject, useTableCreate, useTabs } from '#imports' import { validateTableName } from '~/utils/validation' +import { TabType } from '~/composables' interface Props { modelValue?: boolean @@ -34,7 +35,7 @@ const { table, createTable, generateUniqueTitle, tables, project } = useTableCre addTab({ id: table.id as string, title: table.title, - type: 'table', + type: TabType.TABLE, }) dialogShow.value = false }) diff --git a/packages/nc-gui-v2/components/dlg/ViewDelete.vue b/packages/nc-gui-v2/components/dlg/ViewDelete.vue index df745c82b8..1aefbaabc7 100644 --- a/packages/nc-gui-v2/components/dlg/ViewDelete.vue +++ b/packages/nc-gui-v2/components/dlg/ViewDelete.vue @@ -60,7 +60,9 @@ async function onDelete() { diff --git a/packages/nc-gui-v2/components/general/Share.vue b/packages/nc-gui-v2/components/general/Share.vue index a48cd29a38..dfb908e93f 100644 --- a/packages/nc-gui-v2/components/general/Share.vue +++ b/packages/nc-gui-v2/components/general/Share.vue @@ -3,7 +3,7 @@ interface Props { url: string socialMedias: string[] title?: string - summary: string + summary?: string hashTags?: string css?: string iconClass?: string diff --git a/packages/nc-gui-v2/components/smartsheet/Pagination.vue b/packages/nc-gui-v2/components/smartsheet/Pagination.vue index aed95f8c7a..8fecc8d81e 100644 --- a/packages/nc-gui-v2/components/smartsheet/Pagination.vue +++ b/packages/nc-gui-v2/components/smartsheet/Pagination.vue @@ -73,7 +73,7 @@ export default { @keydown.enter="changePage(page)" > diff --git a/packages/nc-gui-v2/components/tabs/Smartsheet.vue b/packages/nc-gui-v2/components/tabs/Smartsheet.vue index e633514fcd..decbf18c6a 100644 --- a/packages/nc-gui-v2/components/tabs/Smartsheet.vue +++ b/packages/nc-gui-v2/components/tabs/Smartsheet.vue @@ -29,7 +29,7 @@ provide(FieldsInj, fields) provide('navDrawerOpen', ref(true)) watch( - () => tabMeta && tabMeta?.id, + () => tabMeta && tabMeta.value.id, async (newVal, oldVal) => { if (newVal !== oldVal) await getMeta(newVal) }, diff --git a/packages/nc-gui-v2/components/virtual-cell/Rollup.vue b/packages/nc-gui-v2/components/virtual-cell/Rollup.vue index a5c8aa2aed..2354a64d65 100644 --- a/packages/nc-gui-v2/components/virtual-cell/Rollup.vue +++ b/packages/nc-gui-v2/components/virtual-cell/Rollup.vue @@ -1,5 +1,5 @@