From 709704f71a75a68e81e352fa6d3a2a6ebcd8252d Mon Sep 17 00:00:00 2001 From: sreehari jayaraj Date: Sat, 30 Sep 2023 14:03:57 +0530 Subject: [PATCH] fix: input border --- packages/nc-gui/components/smartsheet/Cell.vue | 11 +++++++++-- .../components/smartsheet/column/DefaultValue.vue | 2 +- .../index/[typeOrId]/form/[viewId]/index/survey.vue | 9 ++------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/packages/nc-gui/components/smartsheet/Cell.vue b/packages/nc-gui/components/smartsheet/Cell.vue index dd3840469e..7cd3ac2e75 100644 --- a/packages/nc-gui/components/smartsheet/Cell.vue +++ b/packages/nc-gui/components/smartsheet/Cell.vue @@ -72,7 +72,9 @@ const readOnly = toRef(props, 'readOnly', false) provide(ColumnInj, column) -provide(EditModeInj, useVModel(props, 'editEnabled', emit)) +const editEnabled = useVModel(props, 'editEnabled', emit) + +provide(EditModeInj, editEnabled) provide(ActiveCellInj, active) @@ -187,6 +189,11 @@ onMounted(() => { intersectionObserver.value?.observe(elementToObserve.value!) }) +// remove border of element when clicked outside +onClickOutside(elementToObserve as any, () => { + editEnabled.value = false +}) + // disconnect the observer when the cell is unmounted onUnmounted(() => { intersectionObserver.value?.disconnect() @@ -205,7 +212,7 @@ onUnmounted(() => { 'h-10': isForm && !isSurveyForm && !isAttachment(column) && !props.virtual, 'nc-grid-numeric-cell-left': (isForm && isNumericField && isExpandedFormOpen) || isEditColumnMenu, '!min-h-40': isTextArea(column) && props.editEnabled, - '!border-2': props.editEnabled, + '!border-2': props.editEnabled && (isSurveyForm || isForm), }, ]" @keydown.enter.exact="navigate(NavigateDir.NEXT, $event)" diff --git a/packages/nc-gui/components/smartsheet/column/DefaultValue.vue b/packages/nc-gui/components/smartsheet/column/DefaultValue.vue index cc266a4063..b78a3e1842 100644 --- a/packages/nc-gui/components/smartsheet/column/DefaultValue.vue +++ b/packages/nc-gui/components/smartsheet/column/DefaultValue.vue @@ -49,7 +49,7 @@ useProvideSmartsheetRowStore(vModel, rowRef)
{{ $t('placeholder.defaultValue') }}
- + {

- +