From 4123ff0d12d2412b42a7ae89b51f3095e21231e8 Mon Sep 17 00:00:00 2001 From: Muhammed Mustafa Date: Sat, 25 Nov 2023 04:19:43 +0000 Subject: [PATCH] fix: Added readonly mode to expanded form cells --- packages/nc-gui/components/smartsheet/VirtualCell.vue | 7 ++++++- .../nc-gui/components/smartsheet/expanded-form/index.vue | 8 ++++++-- packages/nc-gui/components/virtual-cell/Links.vue | 3 +-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/packages/nc-gui/components/smartsheet/VirtualCell.vue b/packages/nc-gui/components/smartsheet/VirtualCell.vue index 9b11cc2af7..a9b78586be 100644 --- a/packages/nc-gui/components/smartsheet/VirtualCell.vue +++ b/packages/nc-gui/components/smartsheet/VirtualCell.vue @@ -31,6 +31,7 @@ const props = defineProps<{ modelValue: any row?: Row active?: boolean + readOnly?: boolean }>() const emit = defineEmits(['update:modelValue', 'navigate', 'save']) @@ -38,12 +39,14 @@ const emit = defineEmits(['update:modelValue', 'navigate', 'save']) const column = toRef(props, 'column') const active = toRef(props, 'active', false) const row = toRef(props, 'row') +const readOnly = toRef(props, 'readOnly', false) provide(ColumnInj, column) provide(ActiveCellInj, active) provide(RowInj, row) provide(CellValueInj, toRef(props, 'modelValue')) provide(SaveRowInj, () => emit('save')) +provide(ReadonlyInj, readOnly) const isGrid = inject(IsGridInj, ref(false)) @@ -94,7 +97,9 @@ onUnmounted(() => {
diff --git a/packages/nc-gui/components/smartsheet/expanded-form/index.vue b/packages/nc-gui/components/smartsheet/expanded-form/index.vue index 0d871effbf..4695736513 100644 --- a/packages/nc-gui/components/smartsheet/expanded-form/index.vue +++ b/packages/nc-gui/components/smartsheet/expanded-form/index.vue @@ -88,6 +88,8 @@ const isRecordLinkCopied = ref(false) const { isUIAllowed } = useRoles() +const readOnly = computed(() => !isUIAllowed('dataEdit') || isPublic.value) + const reloadTrigger = inject(ReloadRowDataHookInj, createEventHook()) const { addOrEditStackRow } = useKanbanViewStoreOrThrow() @@ -669,6 +671,7 @@ export default { :class="{ 'px-1': isReadOnlyVirtualCell(col), }" + :read-only="readOnly" /> @@ -737,6 +740,7 @@ export default { v-model="_row.row[col.title]" :row="_row" :column="col" + :read-only="readOnly" /> diff --git a/packages/nc-gui/components/virtual-cell/Links.vue b/packages/nc-gui/components/virtual-cell/Links.vue index ba1565d1ac..449b24c565 100644 --- a/packages/nc-gui/components/virtual-cell/Links.vue +++ b/packages/nc-gui/components/virtual-cell/Links.vue @@ -112,7 +112,7 @@ const openListDlg = () => { v-e="['c:cell:links:modal:open']" :title="textVal" class="text-center nc-datatype-link underline-transparent" - :class="{ '!text-gray-300': !textVal }" + :class="{ '!text-gray-300': !textVal, 'pointer-events-none': readOnly }" @click.stop.prevent="openChildList" > {{ textVal }} @@ -127,7 +127,6 @@ const openListDlg = () => { @click.stop="openListDlg" />
-