Browse Source

fix: To close column type dropdown on escape and close modal only when the type popup is close

pull/7281/head
Muhammed Mustafa 11 months ago
parent
commit
c938d64460
  1. 17
      packages/nc-gui/components/smartsheet/column/EditOrAdd.vue

17
packages/nc-gui/components/smartsheet/column/EditOrAdd.vue

@ -81,6 +81,10 @@ const columnToValidate = [UITypes.Email, UITypes.URL, UITypes.PhoneNumber]
const onlyNameUpdateOnEditColumns = [UITypes.LinkToAnotherRecord, UITypes.Lookup, UITypes.Rollup, UITypes.Links] const onlyNameUpdateOnEditColumns = [UITypes.LinkToAnotherRecord, UITypes.Lookup, UITypes.Rollup, UITypes.Links]
// To close column type dropdown on escape and
// close modal only when the type popup is close
const isColumnTypeOpen = ref(false)
const geoDataToggleCondition = (t: { name: UITypes }) => { const geoDataToggleCondition = (t: { name: UITypes }) => {
if (!appInfo.value.ee) return true if (!appInfo.value.ee) return true
@ -199,6 +203,8 @@ onMounted(() => {
}) })
const handleEscape = (event: KeyboardEvent): void => { const handleEscape = (event: KeyboardEvent): void => {
if (isColumnTypeOpen.value) return
if (event.key === 'Escape') emit('cancel') if (event.key === 'Escape') emit('cancel')
} }
@ -206,6 +212,16 @@ const isFieldsTab = computed(() => {
return openedViewsTab.value === 'field' return openedViewsTab.value === 'field'
}) })
const onDropdownChange = (value: boolean) => {
if (value) {
isColumnTypeOpen.value = value
} else {
setTimeout(() => {
isColumnTypeOpen.value = value
}, 300)
}
}
if (props.fromTableExplorer) { if (props.fromTableExplorer) {
watch( watch(
formState, formState,
@ -275,6 +291,7 @@ if (props.fromTableExplorer) {
class="nc-column-type-input !rounded" class="nc-column-type-input !rounded"
:disabled="isKanban || readOnly" :disabled="isKanban || readOnly"
dropdown-class-name="nc-dropdown-column-type border-1 !rounded-md border-gray-200" dropdown-class-name="nc-dropdown-column-type border-1 !rounded-md border-gray-200"
@dropdown-visible-change="onDropdownChange"
@change="onUidtOrIdTypeChange" @change="onUidtOrIdTypeChange"
@dblclick="showDeprecated = !showDeprecated" @dblclick="showDeprecated = !showDeprecated"
> >

Loading…
Cancel
Save