From 4a59b5247a0f008ff061d1cb6d5a02bf8687c4dc Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Sat, 13 Aug 2022 16:28:55 +0800 Subject: [PATCH] fix(gui-v2): editEnabled for virtual cells --- .../nc-gui-v2/components/virtual-cell/BelongsTo.vue | 6 ++++-- packages/nc-gui-v2/components/virtual-cell/HasMany.vue | 10 ++++++++-- .../nc-gui-v2/components/virtual-cell/ManyToMany.vue | 10 ++++++++-- .../components/virtual-cell/components/ItemChip.vue | 8 +++++--- .../virtual-cell/components/ListChildItems.vue | 10 +++++++--- 5 files changed, 32 insertions(+), 12 deletions(-) diff --git a/packages/nc-gui-v2/components/virtual-cell/BelongsTo.vue b/packages/nc-gui-v2/components/virtual-cell/BelongsTo.vue index 284fb9cad6..f863851a18 100644 --- a/packages/nc-gui-v2/components/virtual-cell/BelongsTo.vue +++ b/packages/nc-gui-v2/components/virtual-cell/BelongsTo.vue @@ -4,7 +4,7 @@ import type { Ref } from 'vue' import ItemChip from './components/ItemChip.vue' import ListItems from './components/ListItems.vue' import { inject, ref, useProvideLTARStore, useSmartsheetRowStoreOrThrow } from '#imports' -import { ActiveCellInj, CellValueInj, ColumnInj, ReloadViewDataHookInj, RowInj } from '~/context' +import { ActiveCellInj, CellValueInj, ColumnInj, ReadonlyInj, ReloadViewDataHookInj, RowInj } from '~/context' import MdiArrowExpand from '~icons/mdi/arrow-expand' import MdiPlus from '~icons/mdi/plus' @@ -18,6 +18,8 @@ const row = inject(RowInj) const active = inject(ActiveCellInj) +const editEnabled = inject(ReadonlyInj) + const listItemsDlg = ref(false) const { state, isNew, removeLTARRef } = useSmartsheetRowStoreOrThrow() @@ -57,7 +59,7 @@ const unlinkRef = async (rec: Record) => { -
+
) => { class="select-none transform text-sm nc-action-icon text-gray-500/50 hover:text-gray-500" @click="childListDlg = true" /> - +
diff --git a/packages/nc-gui-v2/components/virtual-cell/ManyToMany.vue b/packages/nc-gui-v2/components/virtual-cell/ManyToMany.vue index 5db431b837..62e6221623 100644 --- a/packages/nc-gui-v2/components/virtual-cell/ManyToMany.vue +++ b/packages/nc-gui-v2/components/virtual-cell/ManyToMany.vue @@ -5,7 +5,7 @@ import ItemChip from './components/ItemChip.vue' import ListChildItems from './components/ListChildItems.vue' import ListItems from './components/ListItems.vue' import { computed, inject, ref, useProvideLTARStore, useSmartsheetRowStoreOrThrow } from '#imports' -import { CellValueInj, ColumnInj, IsFormInj, ReloadViewDataHookInj, RowInj } from '~/context' +import { CellValueInj, ColumnInj, IsFormInj, ReadonlyInj, ReloadViewDataHookInj, RowInj } from '~/context' const column = inject(ColumnInj)! @@ -17,6 +17,8 @@ const reloadTrigger = inject(ReloadViewDataHookInj)! const isForm = inject(IsFormInj) +const editEnabled = inject(ReadonlyInj) + const listItemsDlg = ref(false) const childListDlg = ref(false) @@ -75,7 +77,11 @@ const unlinkRef = async (rec: Record) => {
- +
diff --git a/packages/nc-gui-v2/components/virtual-cell/components/ItemChip.vue b/packages/nc-gui-v2/components/virtual-cell/components/ItemChip.vue index e7f0a5a7f7..15a7090530 100644 --- a/packages/nc-gui-v2/components/virtual-cell/components/ItemChip.vue +++ b/packages/nc-gui-v2/components/virtual-cell/components/ItemChip.vue @@ -13,8 +13,10 @@ const emit = defineEmits(['unlink']) const { relatedTableMeta } = useLTARStoreOrThrow() -const readonly = inject(ReadonlyInj, false) +const editEnabled = inject(ReadonlyInj) + const active = inject(ActiveCellInj, ref(false)) + const isForm = inject(IsFormInj) const expandedFormDlg = ref(false) @@ -27,12 +29,12 @@ const expandedFormDlg = ref(false) @click="expandedFormDlg = true" > {{ value }} -
+
() const emit = defineEmits(['update:modelValue', 'attachRecord']) const vModel = useVModel(props, 'modelValue', emit) + const isForm = inject(IsFormInj, ref(false)) + const column = inject(ColumnInj) +const editEnabled = inject(ReadonlyInj) + const { childrenList, meta, @@ -64,7 +68,7 @@ const expandedFormRow = ref() - +
Link to '{{ meta.title }}' @@ -90,7 +94,7 @@ const expandedFormRow = ref() }}(Primary key : {{ getRelatedTableRowId(row) }})
-
+