From 15f4d5f399eabbae050b683d5a8326b66da68474 Mon Sep 17 00:00:00 2001 From: Muhammed Mustafa Date: Thu, 23 Nov 2023 07:02:55 +0000 Subject: [PATCH] fix: Made fields editor integrated with locked mode --- .../smartsheet/column/EditOrAdd.vue | 114 ++++++++++-------- .../components/smartsheet/details/Fields.vue | 89 +++++++++----- 2 files changed, 124 insertions(+), 79 deletions(-) diff --git a/packages/nc-gui/components/smartsheet/column/EditOrAdd.vue b/packages/nc-gui/components/smartsheet/column/EditOrAdd.vue index 796373a6cc..9eb7a391a3 100644 --- a/packages/nc-gui/components/smartsheet/column/EditOrAdd.vue +++ b/packages/nc-gui/components/smartsheet/column/EditOrAdd.vue @@ -37,6 +37,7 @@ const props = defineProps<{ hideType?: boolean hideAdditionalOptions?: boolean fromTableExplorer?: boolean + readonly?: boolean }>() const emit = defineEmits(['submit', 'cancel', 'mounted', 'add', 'update']) @@ -66,6 +67,8 @@ const isForm = inject(IsFormInj, ref(false)) const isKanban = inject(IsKanbanInj, ref(false)) +const readOnly = computed(() => props.readonly) + const { isMysql, isMssql, isXcdbBase } = useBase() const reloadDataTrigger = inject(ReloadViewDataHookInj) @@ -114,6 +117,8 @@ const reloadMetaAndData = async () => { const saving = ref(false) async function onSubmit() { + if (readOnly.value) return + saving.value = true const saved = await addOrUpdate(reloadMetaAndData, props.columnPosition) saving.value = false @@ -134,7 +139,7 @@ async function onSubmit() { // focus and select the column name field const antInput = ref() watchEffect(() => { - if (antInput.value && formState.value) { + if (antInput.value && formState.value && !readOnly.value) { // todo: replace setTimeout setTimeout(() => { // focus and select input only if active element is not an input or textarea @@ -232,6 +237,7 @@ if (props.fromTableExplorer) { @@ -247,7 +253,7 @@ if (props.fromTableExplorer) { ref="antInput" v-model:value="formState.title" class="nc-column-name-input !rounded !mt-1" - :disabled="isKanban" + :disabled="isKanban || readOnly" @input="onAlter(8)" /> @@ -263,7 +269,7 @@ if (props.fromTableExplorer) { v-model:value="formState.uidt" show-search class="nc-column-type-input !rounded" - :disabled="isKanban" + :disabled="isKanban || readOnly" dropdown-class-name="nc-dropdown-column-type " @change="onUidtOrIdTypeChange" @dblclick="showDeprecated = !showDeprecated" @@ -285,28 +291,30 @@ if (props.fromTableExplorer) { --> - - - - - - - - - - - - - - - - + -
- - +
+ + -
- -
- {{ advancedOptions ? $t('general.hideAll') : $t('general.showMore') }} - -
- - -
- - -
-
+ +
+ {{ advancedOptions ? $t('general.hideAll') : $t('general.showMore') }} + +
+ + +
+ + + +
+
+
- + - +
New Field @@ -730,19 +746,22 @@ const onFieldOptionUpdate = () => { Reset - + Save changes @@ -752,7 +771,7 @@ const onFieldOptionUpdate = () => {
- + - - Duplicate - - - Insert above - - - Insert below - - - - - -
- - Delete -
-
+ @@ -927,7 +955,13 @@ const onFieldOptionUpdate = () => { @click="changeField(displayColumn, $event)" >
- + { :preload="fieldState(activeField)" :table-explorer-columns="fields" embed-mode + :readonly="isLocked" from-table-explorer @update="onFieldUpdate" @add="onFieldAdd"