fix(iotdb): correct timestamp display and table editing
This commit is contained in:
16 files changed
+1031
-73
No files matched your search
@@ -16,6 +16,7 @@ function createResizeState(options: {
|
||||
compactColumnHeaderActions?: boolean;
|
||||
indexIndicatorColumnIndexes?: number[] | ReturnType<typeof ref<number[]>>;
|
||||
headerTextWidth?: number;
|
||||
displayValue?: (value: string | number | boolean | null, columnIndex: number) => string | number | boolean | null;
|
||||
}) {
|
||||
const compact = ref(options.compactColumnHeaderActions ?? true);
|
||||
const headerTextWidth = ref(options.headerTextWidth);
|
||||
@@ -34,6 +35,7 @@ function createResizeState(options: {
|
||||
columnStructureSignature: computed(() => createDataGridColumnStructureSignature(options.columns, options.columnTypes)),
|
||||
measureHeaderText: () => headerTextWidth.value,
|
||||
headerMeasurementKey,
|
||||
displayValue: options.displayValue,
|
||||
});
|
||||
return {
|
||||
...state,
|
||||
@@ -107,6 +109,23 @@ describe("useDataGridColumnResize", () => {
|
||||
expect(state.columnWidths.value[0]).toBeGreaterThan(60);
|
||||
});
|
||||
|
||||
it("measures formatted display values instead of raw source values", () => {
|
||||
const raw = createResizeState({
|
||||
columns: ["event_time"],
|
||||
rows: [[1786958306456]],
|
||||
});
|
||||
const formatted = createResizeState({
|
||||
columns: ["event_time"],
|
||||
rows: [[1786958306456]],
|
||||
displayValue: () => "2026-08-17T17:18:26.456+08:00",
|
||||
});
|
||||
|
||||
raw.initColumnWidths();
|
||||
formatted.initColumnWidths();
|
||||
|
||||
expect(formatted.columnWidths.value[0]).toBeGreaterThan(raw.columnWidths.value[0]);
|
||||
});
|
||||
|
||||
it("clamps manual column resizing to the minimum width", () => {
|
||||
expect(resizeDataGridColumnWidth(120, -200)).toBe(DATA_GRID_COL_MIN_WIDTH);
|
||||
expect(resizeDataGridColumnWidth(120, 30)).toBe(150);
|
||||
|
||||
@@ -42,6 +42,7 @@ export interface UseDataGridColumnResizeOptions {
|
||||
measureHeaderText?: (text: string) => number | undefined;
|
||||
headerMeasurementKey?: Ref<unknown>;
|
||||
rowNumberWidth?: Ref<number> | ComputedRef<number>;
|
||||
displayValue?: (value: CellValue, columnIndex: number) => CellValue;
|
||||
}
|
||||
|
||||
export function useDataGridColumnResize(options: UseDataGridColumnResizeOptions) {
|
||||
@@ -68,7 +69,8 @@ export function useDataGridColumnResize(options: UseDataGridColumnResizeOptions)
|
||||
const actualColIdx = columnIndexes.value[visibleColIdx];
|
||||
if (actualColIdx === undefined) return [];
|
||||
const preset = COLUMN_WIDTH_DENSITY_PRESETS[density.value];
|
||||
return sampleDataGridColumnValues(sourceRows.value, actualColIdx, preset.sampleRows);
|
||||
const values = sampleDataGridColumnValues(sourceRows.value, actualColIdx, preset.sampleRows);
|
||||
return options.displayValue ? values.map((value) => options.displayValue!(value, actualColIdx)) : values;
|
||||
}
|
||||
|
||||
function neededColumnWidth(colIdx: number): number {
|
||||
|
||||
Reference in new issue
Block a user