diff --git a/apps/desktop/src/components/grid/DataGrid.vue b/apps/desktop/src/components/grid/DataGrid.vue index f2cf7caf15..5f2d0e3511 100644 --- a/apps/desktop/src/components/grid/DataGrid.vue +++ b/apps/desktop/src/components/grid/DataGrid.vue @@ -90,7 +90,7 @@ import { createColumnDrafts } from "@/lib/table/tableStructureEditorState"; import type { BuildSingleColumnAlterSqlOptions } from "@/lib/table/tableStructureEditorSql"; import { buildTableSelectSql, quoteTableIdentifier } from "@/lib/table/tableSelectSql"; import { uuid } from "@/lib/common/utils"; -import { resolveHeaderColumnType } from "@/lib/dataGrid/dataGridColumnType"; +import { compactHeaderColumnType, resolveHeaderColumnType } from "@/lib/dataGrid/dataGridColumnType"; import { canEditExistingTableRows, canInsertTableRows, canUseKeylessRowPredicate, hiveTablePropertiesIndicateTransactional, isClickHouseExistingRowReadonlyColumn, isHiddenGridColumn, isTdengineExistingRowReadonlyColumn, usesSyntheticRowIdKey } from "@/lib/table/tableEditing"; import { buildDataGridColumnDistinctValuesSql, buildDataGridContextFilterCondition, buildDataGridCountSql, buildHiveTablePropertiesSql, type DataGridContextFilterMode } from "@/lib/dataGrid/dataGridSql"; import { @@ -379,7 +379,7 @@ function headerColumnType(column: string, actualColIdx: number): string { resultColumnTypes: props.result.column_types, actualColIdx, }); - return resolved ? shortTypeName(resolved) : ""; + return resolved ? shortTypeName(compactHeaderColumnType(resolved)) : ""; } function shortTypeName(t: string): string { @@ -4124,6 +4124,11 @@ function isEnumGridColumnNullable(columnIndex: number): boolean { return tableColumnForGridColumn(columnIndex)?.is_nullable ?? false; } +function isEnumEditorInitialNull(rowId: number | undefined, columnIndex: number): boolean { + if (rowId === undefined) return false; + return getRowItem(rowId)?.data[columnIndex] === null; +} + function cellEditInputModeForColumn(columnIndex: number): "decimal" | "numeric" | undefined { const dataType = normalizedColumnDataType(tableColumnForGridColumn(columnIndex)); if (isIntegerColumnType(dataType)) return "numeric"; @@ -6752,8 +6757,8 @@ function deleteCurrentRow(): boolean { return true; } -function commitGridEdit() { - void commitEditAndMaybeAutoSave().finally(() => nextTick(() => gridRef.value?.focus({ preventScroll: true }))); +function commitGridEdit(value?: string | null) { + void commitEditAndMaybeAutoSave(value === undefined ? undefined : { explicitValue: value }).finally(() => nextTick(() => gridRef.value?.focus({ preventScroll: true }))); } async function commitEditFromCellBlur() { @@ -9257,7 +9262,16 @@ const gridContextMenuItems = computed(() => { @cancel="cancelEdit" @commit="commitGridEdit" /> - +