From d65ef25c7b8964b0176bd94d4578c9354345da0c Mon Sep 17 00:00:00 2001 From: Pranav C Date: Thu, 25 Aug 2022 19:32:14 +0530 Subject: [PATCH] fix(gui-v2): disable drag-n-drop for required column only if dragging to hidden list Signed-off-by: Pranav C --- packages/nc-gui-v2/components/smartsheet-header/Cell.vue | 2 +- .../nc-gui-v2/components/smartsheet-header/VirtualCell.vue | 2 +- packages/nc-gui-v2/components/smartsheet/Form.vue | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/nc-gui-v2/components/smartsheet-header/Cell.vue b/packages/nc-gui-v2/components/smartsheet-header/Cell.vue index 5199cb5474..7f4c8d46b9 100644 --- a/packages/nc-gui-v2/components/smartsheet-header/Cell.vue +++ b/packages/nc-gui-v2/components/smartsheet-header/Cell.vue @@ -2,7 +2,7 @@ import type { ColumnType } from 'nocodb-sdk' import { ColumnInj, IsFormInj, inject, provide, ref, toRef, useUIPermission } from '#imports' -const props = defineProps<{ column: ColumnType & { meta: any }; required?: boolean; hideMenu?: boolean }>() +const props = defineProps<{ column: ColumnType & { meta: any }; required?: boolean | number; hideMenu?: boolean }>() const hideMenu = toRef(props, 'hideMenu') diff --git a/packages/nc-gui-v2/components/smartsheet-header/VirtualCell.vue b/packages/nc-gui-v2/components/smartsheet-header/VirtualCell.vue index c1a5068775..2468179a16 100644 --- a/packages/nc-gui-v2/components/smartsheet-header/VirtualCell.vue +++ b/packages/nc-gui-v2/components/smartsheet-header/VirtualCell.vue @@ -15,7 +15,7 @@ import { useVirtualCell, } from '#imports' -const props = defineProps<{ column: ColumnType & { meta: any }; hideMenu?: boolean; required?: boolean }>() +const props = defineProps<{ column: ColumnType & { meta: any }; hideMenu?: boolean; required?: boolean | number }>() const column = toRef(props, 'column') diff --git a/packages/nc-gui-v2/components/smartsheet/Form.vue b/packages/nc-gui-v2/components/smartsheet/Form.vue index dac7ebb61b..cbd6866777 100644 --- a/packages/nc-gui-v2/components/smartsheet/Form.vue +++ b/packages/nc-gui-v2/components/smartsheet/Form.vue @@ -58,7 +58,7 @@ reloadEventHook.on(async () => { const { showAll, hideAll, saveOrUpdate } = useViewColumns(view, meta as any, async () => reloadEventHook.trigger()) -const { syncLTARRefs } = useProvideSmartsheetRowStore( +const { syncLTARRefs, row } = useProvideSmartsheetRowStore( meta, ref({ row: formState, @@ -150,7 +150,7 @@ function isDbRequired(column: Record) { } function onMoveCallback(event: any) { - if (shouldSkipColumn(event.draggedContext.element)) { + if (event.from !== event.to && shouldSkipColumn(event.draggedContext.element)) { return false } } @@ -630,6 +630,7 @@ onMounted(async () => { >