From d64ac24aef7c6c4db29bcb70ff8add29ae3ea0b3 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Thu, 11 Aug 2022 14:01:54 +0530 Subject: [PATCH] rafactor(gui-v2): replace with reactive variable Signed-off-by: Pranav C --- packages/nc-gui-v2/components/smartsheet-header/Cell.vue | 2 +- packages/nc-gui-v2/components/smartsheet-header/VirtualCell.vue | 2 +- packages/nc-gui-v2/components/smartsheet/Gallery.vue | 2 +- packages/nc-gui-v2/components/smartsheet/Grid.vue | 2 +- .../nc-gui-v2/components/smartsheet/expanded-form/index.vue | 2 +- .../components/virtual-cell/components/ListChildItems.vue | 2 +- packages/nc-gui-v2/context/index.ts | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/nc-gui-v2/components/smartsheet-header/Cell.vue b/packages/nc-gui-v2/components/smartsheet-header/Cell.vue index 90fdef48a7..1d8fd71b52 100644 --- a/packages/nc-gui-v2/components/smartsheet-header/Cell.vue +++ b/packages/nc-gui-v2/components/smartsheet-header/Cell.vue @@ -11,7 +11,7 @@ const hideMenu = toRef(props, 'hideMenu') provide(ColumnInj, column) const meta = inject(MetaInj) -const isForm = inject(IsFormInj, false) +const isForm = inject(IsFormInj, ref(false)) // instantiate column update store useProvideColumnCreateStore(meta as Ref, column) diff --git a/packages/nc-gui-v2/components/smartsheet-header/VirtualCell.vue b/packages/nc-gui-v2/components/smartsheet-header/VirtualCell.vue index 0385b34647..edc6900de3 100644 --- a/packages/nc-gui-v2/components/smartsheet-header/VirtualCell.vue +++ b/packages/nc-gui-v2/components/smartsheet-header/VirtualCell.vue @@ -12,7 +12,7 @@ const hideMenu = toRef(props, 'hideMenu') provide(ColumnInj, column) const { metas } = useMetas() const meta = inject(MetaInj) -const isForm = inject(IsFormInj, false) +const isForm = inject(IsFormInj, ref(false)) const { isLookup, isBt, isRollup, isMm, isHm, isFormula } = useVirtualCell(column) diff --git a/packages/nc-gui-v2/components/smartsheet/Gallery.vue b/packages/nc-gui-v2/components/smartsheet/Gallery.vue index 21cd416d98..c4c4e7e002 100644 --- a/packages/nc-gui-v2/components/smartsheet/Gallery.vue +++ b/packages/nc-gui-v2/components/smartsheet/Gallery.vue @@ -13,7 +13,7 @@ const view = inject(ActiveViewInj) const { loadData, paginationData, formattedData: data, loadGalleryData, galleryData, changePage } = useViewData(meta, view as any) -provide(IsFormInj, false) +provide(IsFormInj, ref(false)) provide(IsGridInj, false) provide(PaginationDataInj, paginationData) provide(ChangePageInj, changePage) diff --git a/packages/nc-gui-v2/components/smartsheet/Grid.vue b/packages/nc-gui-v2/components/smartsheet/Grid.vue index 178530aab6..615fb1cefb 100644 --- a/packages/nc-gui-v2/components/smartsheet/Grid.vue +++ b/packages/nc-gui-v2/components/smartsheet/Grid.vue @@ -82,7 +82,7 @@ const { loadGridViewColumns, updateWidth, resizingColWidth, resizingCol } = useG onMounted(loadGridViewColumns) -provide(IsFormInj, false) +provide(IsFormInj, ref(false)) provide(IsGridInj, true) provide(PaginationDataInj, paginationData) provide(ChangePageInj, changePage) diff --git a/packages/nc-gui-v2/components/smartsheet/expanded-form/index.vue b/packages/nc-gui-v2/components/smartsheet/expanded-form/index.vue index 8fd52089f9..25550ddd1a 100644 --- a/packages/nc-gui-v2/components/smartsheet/expanded-form/index.vue +++ b/packages/nc-gui-v2/components/smartsheet/expanded-form/index.vue @@ -59,7 +59,7 @@ if (props.loadRow) { useProvideSmartsheetStore(ref({}) as any, meta) -provide(IsFormInj, true) +provide(IsFormInj, ref(true)) // accept as a prop // const row: Row = { row: {}, rowMeta: {}, oldRow: {} } diff --git a/packages/nc-gui-v2/components/virtual-cell/components/ListChildItems.vue b/packages/nc-gui-v2/components/virtual-cell/components/ListChildItems.vue index 4e4c940ca7..7aea43a9c5 100644 --- a/packages/nc-gui-v2/components/virtual-cell/components/ListChildItems.vue +++ b/packages/nc-gui-v2/components/virtual-cell/components/ListChildItems.vue @@ -8,7 +8,7 @@ const props = defineProps<{ modelValue?: boolean }>() const emit = defineEmits(['update:modelValue', 'attachRecord']) const vModel = useVModel(props, 'modelValue', emit) -const isForm = ref(inject(IsFormInj, false)) +const isForm = inject(IsFormInj, ref(false)) const column = inject(ColumnInj) const { diff --git a/packages/nc-gui-v2/context/index.ts b/packages/nc-gui-v2/context/index.ts index 2ef6c4a3cb..7dc6d976ed 100644 --- a/packages/nc-gui-v2/context/index.ts +++ b/packages/nc-gui-v2/context/index.ts @@ -14,7 +14,7 @@ export const TabMetaInj: InjectionKey> = Symbol('tab-meta-i export const PaginationDataInj: InjectionKey['paginationData']> = Symbol('pagination-data-injection') export const ChangePageInj: InjectionKey['changePage']> = Symbol('pagination-data-injection') -export const IsFormInj: InjectionKey = Symbol('is-form-injection') +export const IsFormInj: InjectionKey> = Symbol('is-form-injection') export const IsGridInj: InjectionKey = Symbol('is-grid-injection') export const IsLockedInj: InjectionKey = Symbol('is-locked-injection') export const CellValueInj: InjectionKey> = Symbol('cell-value-injection')