@nu-grid/nuxt 0.2.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/runtime/cell-types/date/index.d.ts +1 -1
  3. package/dist/runtime/cell-types/date/index.js +15 -1
  4. package/dist/runtime/cell-types/index.d.ts +2 -1
  5. package/dist/runtime/cell-types/index.js +3 -0
  6. package/dist/runtime/cell-types/number/NumberFilter.vue +1 -1
  7. package/dist/runtime/cell-types/percentage/PercentageEditor.d.vue.ts +15 -0
  8. package/dist/runtime/cell-types/percentage/PercentageEditor.vue +56 -0
  9. package/dist/runtime/cell-types/percentage/PercentageEditor.vue.d.ts +15 -0
  10. package/dist/runtime/cell-types/percentage/PercentageFilter.d.vue.ts +7 -0
  11. package/dist/runtime/cell-types/percentage/PercentageFilter.vue +79 -0
  12. package/dist/runtime/cell-types/percentage/PercentageFilter.vue.d.ts +7 -0
  13. package/dist/runtime/cell-types/percentage/index.d.ts +10 -0
  14. package/dist/runtime/cell-types/percentage/index.js +38 -0
  15. package/dist/runtime/components/NuGrid.d.vue.ts +8 -5
  16. package/dist/runtime/components/NuGrid.vue +46 -10
  17. package/dist/runtime/components/NuGrid.vue.d.ts +8 -5
  18. package/dist/runtime/components/_internal/NuGridBase.vue +129 -83
  19. package/dist/runtime/components/_internal/NuGridCellContent.vue +21 -1
  20. package/dist/runtime/components/_internal/NuGridColumnMenu.vue +2 -2
  21. package/dist/runtime/components/_internal/NuGridGroup.vue +23 -16
  22. package/dist/runtime/components/_internal/NuGridGroupCheckbox.vue +1 -1
  23. package/dist/runtime/components/_internal/NuGridRow.vue +12 -4
  24. package/dist/runtime/components/_internal/NuGridSplitGroup.vue +23 -17
  25. package/dist/runtime/composables/_internal/column-flex-style.d.ts +22 -0
  26. package/dist/runtime/composables/_internal/column-flex-style.js +84 -0
  27. package/dist/runtime/composables/_internal/index.d.ts +1 -0
  28. package/dist/runtime/composables/_internal/index.js +1 -0
  29. package/dist/runtime/composables/_internal/useNuGridAddRow.js +5 -1
  30. package/dist/runtime/composables/_internal/useNuGridAutosize.d.ts +6 -3
  31. package/dist/runtime/composables/_internal/useNuGridAutosize.js +91 -9
  32. package/dist/runtime/composables/_internal/useNuGridCellEditing.js +3 -2
  33. package/dist/runtime/composables/_internal/useNuGridColumnResize.d.ts +17 -7
  34. package/dist/runtime/composables/_internal/useNuGridColumnResize.js +219 -8
  35. package/dist/runtime/composables/_internal/useNuGridCore.d.ts +1 -1
  36. package/dist/runtime/composables/_internal/useNuGridCore.js +16 -5
  37. package/dist/runtime/composables/_internal/useNuGridFocus.js +1 -1
  38. package/dist/runtime/composables/_internal/useNuGridRowSelection.js +1 -1
  39. package/dist/runtime/composables/_internal/useNuGridStatePersistence.d.ts +14 -1
  40. package/dist/runtime/composables/_internal/useNuGridStatePersistence.js +66 -3
  41. package/dist/runtime/composables/_internal/useNuGridUI.d.ts +147 -31
  42. package/dist/runtime/config/_internal/options-defaults.d.ts +2 -4
  43. package/dist/runtime/config/_internal/options-defaults.js +3 -4
  44. package/dist/runtime/config/_internal/prop-utils.d.ts +7 -1
  45. package/dist/runtime/config/_internal/prop-utils.js +20 -6
  46. package/dist/runtime/config/presets.js +2 -2
  47. package/dist/runtime/themes/nuGridTheme.d.ts +3 -1
  48. package/dist/runtime/themes/nuGridTheme.js +9 -5
  49. package/dist/runtime/themes/nuGridThemeCompact.d.ts +3 -1
  50. package/dist/runtime/themes/nuGridThemeCompact.js +8 -4
  51. package/dist/runtime/types/_internal/contexts/resize.d.ts +1 -0
  52. package/dist/runtime/types/_internal/contexts/ui-config.d.ts +4 -2
  53. package/dist/runtime/types/autosize.d.ts +4 -1
  54. package/dist/runtime/types/column.d.ts +41 -3
  55. package/dist/runtime/types/index.d.ts +2 -1
  56. package/dist/runtime/types/option-groups.d.ts +26 -8
  57. package/dist/runtime/types/props.d.ts +34 -9
  58. package/dist/runtime/types/resize.d.ts +2 -0
  59. package/dist/runtime/types/slots.d.ts +32 -0
  60. package/dist/runtime/types/slots.js +0 -0
  61. package/dist/runtime/types/tanstack-table.d.ts +3 -2
  62. package/dist/runtime/utils/index.d.ts +1 -0
  63. package/dist/runtime/utils/index.js +1 -0
  64. package/dist/runtime/utils/inferCellDataType.d.ts +27 -0
  65. package/dist/runtime/utils/inferCellDataType.js +91 -0
  66. package/package.json +5 -5
  67. package/dist/runtime/components/NuGridGroup.d.vue.ts +0 -20
  68. package/dist/runtime/components/NuGridGroup.vue +0 -650
  69. package/dist/runtime/components/NuGridGroup.vue.d.ts +0 -20
@@ -5,6 +5,7 @@ import { Primitive } from "reka-ui";
5
5
  import { upperFirst } from "scule";
6
6
  import { computed, h, inject, toValue } from "vue";
7
7
  import {
8
+ getFlexHeaderStyle,
8
9
  getHeaderEffectivePinning,
9
10
  getHeaderPinningStyle,
10
11
  resolveStyleObject,
@@ -18,12 +19,12 @@ import NuGridHeaderSortButton from "./NuGridHeaderSortButton.vue";
18
19
  import NuGridRow from "./NuGridRow.vue";
19
20
  defineOptions({ inheritAttrs: false });
20
21
  const props = defineProps({
21
- ui: { type: null, required: false },
22
+ ui: { type: Object, required: false },
22
23
  preset: { type: String, required: false },
23
24
  focus: { type: Object, required: false },
24
- editing: { type: Object, required: false },
25
+ editing: { type: [Boolean, Object], required: false },
25
26
  validation: { type: [Boolean, Object], required: false },
26
- selection: { type: [Boolean, String, Object], required: false },
27
+ rowSelection: { type: [Boolean, String, Object], required: false },
27
28
  actions: { type: [Boolean, Object], required: false },
28
29
  columnDefaults: { type: Object, required: false },
29
30
  layout: { type: Object, required: false },
@@ -35,7 +36,7 @@ const props = defineProps({
35
36
  theme: { type: [String, Object], required: false },
36
37
  virtualization: { type: [Boolean, Object], required: false },
37
38
  cellTypes: { type: Array, required: false },
38
- skipAutoSizeColumns: { type: Array, required: false },
39
+ dataTypeInference: { type: Boolean, required: false },
39
40
  rowDragOptions: { type: Object, required: false },
40
41
  rowId: { type: [String, Function], required: false },
41
42
  addNewRow: { type: [Boolean, Object], required: false },
@@ -96,7 +97,7 @@ if (!coreContext || !dragContext || !resizeContext || !virtualizationContext ||
96
97
  }
97
98
  const { tableRef, rootRef, tableApi, ui, hasFooter, propsUi } = coreContext;
98
99
  const { dragFns, rowDragOptions } = dragContext;
99
- const { handleGroupResizeStart, resizingGroupId, resizingColumnId } = resizeContext;
100
+ const { handleGroupResizeStart, resizingGroupId, resizingColumnId, manuallyResizedColumns } = resizeContext;
100
101
  const { stickyEnabled } = virtualizationContext;
101
102
  const { groupingFns } = groupingContext;
102
103
  const { headerGroupsLength } = performanceContext;
@@ -104,8 +105,17 @@ const {
104
105
  sortIcons: gridSortIcons,
105
106
  scrollbarClass,
106
107
  scrollbarThemeClass,
107
- scrollbarAttr
108
+ scrollbarAttr,
109
+ autoSizeMode
108
110
  } = uiConfigContext;
111
+ const flexStyleOptions = computed(() => ({
112
+ useCssFlexDistribution: autoSizeMode?.value === "fill",
113
+ manuallyResizedColumns: manuallyResizedColumns.value,
114
+ columnSizing: tableApi.getState().columnSizing
115
+ }));
116
+ function getHeaderStyle(header) {
117
+ return getFlexHeaderStyle(header, flexStyleOptions.value);
118
+ }
109
119
  const [DefineTableTemplate, ReuseNuGridTemplate] = createReusableTemplate({ inheritAttrs: false });
110
120
  const [DefineGroupHeaderTemplate, ReuseGroupHeaderTemplate] = createReusableTemplate({ inheritAttrs: false });
111
121
  const [DefineHeaderCellTemplate, ReuseHeaderCellTemplate] = createReusableTemplate({ inheritAttrs: false });
@@ -255,10 +265,7 @@ function measureElementRef(el) {
255
265
  ]"
256
266
  :style="{
257
267
  ...resolveStyleObject(header.column.columnDef.meta?.style?.th, header),
258
- // Use header.getSize() for all headers - it returns the sum of leaf column widths for group headers
259
- width: `${header.getSize()}px`,
260
- minWidth: `${header.getSize()}px`,
261
- maxWidth: `${header.getSize()}px`,
268
+ ...getHeaderStyle(header),
262
269
  ...getHeaderPinningStyle(header, { includeZIndex: isExpanded }),
263
270
  ...isExpanded && header.rowSpan > 1 ? { alignSelf: 'stretch' } : {}
264
271
  }"
@@ -350,9 +357,7 @@ function measureElementRef(el) {
350
357
  ui.td({ class: [propsUi?.td], pinned: !!header.column.getIsPinned() })
351
358
  ]"
352
359
  :style="{
353
- width: `${header.getSize()}px`,
354
- minWidth: `${header.getSize()}px`,
355
- maxWidth: `${header.getSize()}px`,
360
+ ...getHeaderStyle(header),
356
361
  ...header.column.getIsPinned() === 'left' ? { left: `${header.column.getStart('left')}px` } : {},
357
362
  ...header.column.getIsPinned() === 'right' ? { right: `${header.column.getAfter('right')}px` } : {}
358
363
  }"
@@ -379,7 +384,10 @@ function measureElementRef(el) {
379
384
  </DefineFooterCellTemplate>
380
385
 
381
386
  <DefineTableTemplate>
382
- <div ref="tableRef" :class="ui.base({ class: [propsUi?.base] })">
387
+ <div
388
+ ref="tableRef"
389
+ :class="ui.base({ class: [propsUi?.base, autoSizeMode === 'fill' && 'w-full'] })"
390
+ >
383
391
  <div v-if="caption || !!slots.caption" :class="ui.caption({ class: [propsUi?.caption] })">
384
392
  <slot name="caption">
385
393
  {{ caption }}
@@ -701,9 +709,7 @@ function measureElementRef(el) {
701
709
  ]"
702
710
  :style="{
703
711
  ...resolveStyleObject(header.column.columnDef.meta?.style?.th, header),
704
- width: `${header.getSize()}px`,
705
- minWidth: `${header.getSize()}px`,
706
- maxWidth: `${header.getSize()}px`,
712
+ ...getHeaderStyle(header),
707
713
  ...getHeaderPinningStyle(header),
708
714
  ...header.colSpan > 1 ? { flexGrow: header.colSpan } : {},
709
715
  ...header.rowSpan > 1 ? { alignSelf: 'stretch' } : {}
@@ -0,0 +1,22 @@
1
+ import type { Column, ColumnSizingState, Header } from '@tanstack/vue-table';
2
+ interface FlexStyleOptions {
3
+ /** Whether CSS flex distribution is enabled (autoSize === 'fill') */
4
+ useCssFlexDistribution: boolean;
5
+ /** Set of column IDs that have been manually resized */
6
+ manuallyResizedColumns: Set<string>;
7
+ /** Column sizing state from TanStack (for SSR - detects restored sizing) */
8
+ columnSizing?: ColumnSizingState;
9
+ }
10
+ /**
11
+ * Get style object for a header with flex distribution support.
12
+ * In fill mode, uses flex distribution instead of fixed widths.
13
+ * Respects column-level `grow` and `widthPercentage` properties.
14
+ * Once a column is manually resized, it switches to fixed width.
15
+ */
16
+ export declare function getFlexHeaderStyle<T>(header: Header<T, unknown>, options: FlexStyleOptions): Record<string, string | number>;
17
+ /**
18
+ * Get style object for a cell with flex distribution support.
19
+ * Mirrors the header style logic for consistent column widths.
20
+ */
21
+ export declare function getFlexCellStyle<T>(column: Column<T, unknown>, options: FlexStyleOptions): Record<string, string | number>;
22
+ export {};
@@ -0,0 +1,84 @@
1
+ export function getFlexHeaderStyle(header, options) {
2
+ const { useCssFlexDistribution, manuallyResizedColumns, columnSizing } = options;
3
+ const isPinned = header.column.getIsPinned();
4
+ const columnDef = header.column.columnDef;
5
+ const minSize = columnDef.minSize ?? 50;
6
+ const maxSize = columnDef.maxSize;
7
+ const grow = columnDef.grow;
8
+ const widthPercentage = columnDef.widthPercentage;
9
+ const fixedSize = columnDef.size ?? header.getSize();
10
+ const hasBeenResized = manuallyResizedColumns.has(header.column.id) || columnSizing !== void 0 && header.column.id in columnSizing;
11
+ if (isPinned) {
12
+ return {
13
+ width: `${header.getSize()}px`,
14
+ minWidth: `${header.getSize()}px`,
15
+ maxWidth: `${header.getSize()}px`
16
+ };
17
+ }
18
+ if (useCssFlexDistribution) {
19
+ if (grow === false || hasBeenResized) {
20
+ const size = hasBeenResized ? header.getSize() : fixedSize;
21
+ return {
22
+ width: `${size}px`,
23
+ minWidth: `${minSize}px`,
24
+ maxWidth: `${size}px`,
25
+ flexShrink: 0
26
+ };
27
+ }
28
+ const flexGrow = widthPercentage ?? 1;
29
+ return {
30
+ flexGrow,
31
+ flexShrink: 1,
32
+ flexBasis: 0,
33
+ minWidth: `${minSize}px`,
34
+ ...maxSize && maxSize < Number.MAX_SAFE_INTEGER ? { maxWidth: `${maxSize}px` } : {}
35
+ };
36
+ }
37
+ return {
38
+ width: `${header.getSize()}px`,
39
+ minWidth: `${header.getSize()}px`,
40
+ maxWidth: `${header.getSize()}px`
41
+ };
42
+ }
43
+ export function getFlexCellStyle(column, options) {
44
+ const { useCssFlexDistribution, manuallyResizedColumns, columnSizing } = options;
45
+ const isPinned = column.getIsPinned();
46
+ const columnDef = column.columnDef;
47
+ const minSize = columnDef.minSize ?? 50;
48
+ const maxSize = columnDef.maxSize;
49
+ const grow = columnDef.grow;
50
+ const widthPercentage = columnDef.widthPercentage;
51
+ const fixedSize = columnDef.size ?? column.getSize();
52
+ const hasBeenResized = manuallyResizedColumns.has(column.id) || columnSizing !== void 0 && column.id in columnSizing;
53
+ if (isPinned) {
54
+ return {
55
+ width: `${column.getSize()}px`,
56
+ minWidth: `${column.getSize()}px`,
57
+ maxWidth: `${column.getSize()}px`
58
+ };
59
+ }
60
+ if (useCssFlexDistribution) {
61
+ if (grow === false || hasBeenResized) {
62
+ const size = hasBeenResized ? column.getSize() : fixedSize;
63
+ return {
64
+ width: `${size}px`,
65
+ minWidth: `${minSize}px`,
66
+ maxWidth: `${size}px`,
67
+ flexShrink: 0
68
+ };
69
+ }
70
+ const flexGrow = widthPercentage ?? 1;
71
+ return {
72
+ flexGrow,
73
+ flexShrink: 1,
74
+ flexBasis: 0,
75
+ minWidth: `${minSize}px`,
76
+ ...maxSize && maxSize < Number.MAX_SAFE_INTEGER ? { maxWidth: `${maxSize}px` } : {}
77
+ };
78
+ }
79
+ return {
80
+ width: `${column.getSize()}px`,
81
+ minWidth: `${column.getSize()}px`,
82
+ maxWidth: `${column.getSize()}px`
83
+ };
84
+ }
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * @internal
3
3
  */
4
+ export * from './column-flex-style.js';
4
5
  export * from './keyboard-handlers/index.js';
5
6
  export * from './useNuGridActionMenu.js';
6
7
  export * from './useNuGridAddRow.js';
@@ -1,3 +1,4 @@
1
+ export * from "./column-flex-style.js";
1
2
  export * from "./keyboard-handlers/index.js";
2
3
  export * from "./useNuGridActionMenu.js";
3
4
  export * from "./useNuGridAddRow.js";
@@ -427,7 +427,11 @@ export function useNuGridAddRow(options) {
427
427
  );
428
428
  }
429
429
  function isCellEditable(row, cell) {
430
- if (options.props.editing?.enabled === false) {
430
+ const editingProp = options.props.editing;
431
+ if (editingProp === false) {
432
+ return false;
433
+ }
434
+ if (typeof editingProp === "object" && editingProp?.enabled === false) {
431
435
  return false;
432
436
  }
433
437
  const columnDef = cell.column.columnDef;
@@ -5,10 +5,13 @@ import type { NuGridProps } from '../../types/index.js';
5
5
  /**
6
6
  * Autosize functionality for tables similar to AG Grid
7
7
  * Supports two modes:
8
- * - fitCell: Auto-size columns to fit cell contents
9
- * - fitGrid: Auto-size columns to fit cell contents and scale up to fill grid width
8
+ * - content: Auto-size columns to fit cell contents
9
+ * - fill: Auto-size columns to fit cell contents and scale up to fill grid width
10
10
  */
11
11
  export declare function useNuGridAutosize<T extends TableData>(props: NuGridProps<T>, tableApi: Table<T>, tableRef: Ref<HTMLElement | null>): {
12
- autoSizeColumns: (mode?: "fitCell" | "fitGrid") => void;
12
+ autoSizeColumns: (mode?: "content" | "fill") => void;
13
13
  autoSizeColumn: (columnId: string) => void;
14
+ presetEqualColumnWidths: () => void;
15
+ autosizeReady: Ref<boolean, boolean>;
16
+ autoSizeMode: import("vue").ComputedRef<NonNullable<import("../../types/index.js").NuGridAutoSizeStrategy | undefined>>;
14
17
  };
@@ -1,5 +1,5 @@
1
1
  import { useDebounceFn } from "@vueuse/core";
2
- import { nextTick, watch } from "vue";
2
+ import { nextTick, ref, watch } from "vue";
3
3
  import { usePropWithDefault } from "../../config/_internal/index.js";
4
4
  export function useNuGridAutosize(props, tableApi, tableRef) {
5
5
  function measureSingleColumnWidth(columnId, measureDiv) {
@@ -71,16 +71,41 @@ export function useNuGridAutosize(props, tableApi, tableRef) {
71
71
  }
72
72
  }
73
73
  const autoSize = usePropWithDefault(props, "layout", "autoSize");
74
+ function presetEqualColumnWidths() {
75
+ if (!tableRef.value) return;
76
+ const containerWidth = tableRef.value.offsetWidth;
77
+ if (containerWidth <= 0) return;
78
+ const visibleColumns = tableApi.getVisibleLeafColumns();
79
+ const resizableColumns = visibleColumns.filter((col) => {
80
+ const columnDef = col.columnDef;
81
+ return columnDef.grow !== false;
82
+ });
83
+ if (resizableColumns.length === 0) return;
84
+ const equalWidth = containerWidth / resizableColumns.length;
85
+ const newSizing = {};
86
+ resizableColumns.forEach((column) => {
87
+ const minSize = column.columnDef.minSize ?? 20;
88
+ const maxSize = column.columnDef.maxSize ?? Number.MAX_SAFE_INTEGER;
89
+ newSizing[column.id] = Math.max(minSize, Math.min(equalWidth, maxSize));
90
+ });
91
+ tableApi.setColumnSizing((old) => ({
92
+ ...old,
93
+ ...newSizing
94
+ }));
95
+ }
74
96
  function autoSizeColumns(mode) {
75
97
  const effectiveMode = mode || autoSize.value;
76
98
  if (!effectiveMode || !tableRef.value) return;
77
99
  const visibleColumns = tableApi.getVisibleLeafColumns();
78
- const skipColumns = props.skipAutoSizeColumns || [];
79
100
  const newSizing = {};
80
- const columnsToMeasure = visibleColumns.filter((column) => !skipColumns.includes(column.id)).map((column) => column.id);
101
+ const columnsToMeasure = visibleColumns.filter((column) => {
102
+ const columnDef = column.columnDef;
103
+ return columnDef.grow !== false;
104
+ }).map((column) => column.id);
81
105
  const measuredWidths = measureAllColumnsContentWidth(columnsToMeasure);
82
106
  const columnWidths = visibleColumns.map((column) => {
83
- if (skipColumns.includes(column.id)) {
107
+ const columnDef = column.columnDef;
108
+ if (columnDef.grow === false) {
84
109
  return { id: column.id, width: column.getSize(), skip: true };
85
110
  }
86
111
  const minSize = column.columnDef.minSize ?? 20;
@@ -90,7 +115,7 @@ export function useNuGridAutosize(props, tableApi, tableRef) {
90
115
  return { id: column.id, width: constrainedWidth, skip: false };
91
116
  });
92
117
  const totalContentWidth = columnWidths.reduce((sum, col) => sum + col.width, 0);
93
- if (effectiveMode === "fitGrid" && tableRef.value) {
118
+ if (effectiveMode === "fill" && tableRef.value) {
94
119
  const containerWidth = tableRef.value.offsetWidth;
95
120
  if (totalContentWidth < containerWidth && totalContentWidth > 0) {
96
121
  const scaleFactor = containerWidth / totalContentWidth;
@@ -128,8 +153,8 @@ export function useNuGridAutosize(props, tableApi, tableRef) {
128
153
  function autoSizeColumn(columnId) {
129
154
  const column = tableApi.getColumn(columnId);
130
155
  if (!column) return;
131
- const skipColumns = props.skipAutoSizeColumns || [];
132
- if (skipColumns.includes(columnId)) return;
156
+ const columnDef = column.columnDef;
157
+ if (columnDef.grow === false) return;
133
158
  const visibleColumns = tableApi.getVisibleLeafColumns();
134
159
  const columnIndex = visibleColumns.findIndex((col) => col.id === columnId);
135
160
  if (columnIndex === -1) return;
@@ -145,17 +170,74 @@ export function useNuGridAutosize(props, tableApi, tableRef) {
145
170
  const debouncedAutosize = useDebounceFn(() => {
146
171
  autoSizeColumns();
147
172
  }, 100);
173
+ let initialAutosizeComplete = false;
174
+ const autosizeReady = ref(!autoSize.value || autoSize.value === "fill");
175
+ function syncFlexColumnWidths() {
176
+ if (!tableRef.value) return;
177
+ const visibleColumns = tableApi.getVisibleLeafColumns();
178
+ const columnSizing = tableApi.getState().columnSizing;
179
+ const newSizing = {};
180
+ const headerCells = tableRef.value.querySelectorAll("[data-column-id]");
181
+ const measuredWidths = /* @__PURE__ */ new Map();
182
+ headerCells.forEach((cell) => {
183
+ const columnId = cell.getAttribute("data-column-id");
184
+ if (columnId && !measuredWidths.has(columnId)) {
185
+ measuredWidths.set(columnId, cell.offsetWidth);
186
+ }
187
+ });
188
+ for (const column of visibleColumns) {
189
+ const columnDef = column.columnDef;
190
+ const isFlexColumn = columnDef.grow !== false && !columnSizing[column.id];
191
+ if (isFlexColumn) {
192
+ const measuredWidth = measuredWidths.get(column.id);
193
+ if (measuredWidth && measuredWidth > 0) {
194
+ newSizing[column.id] = measuredWidth;
195
+ }
196
+ }
197
+ }
198
+ if (Object.keys(newSizing).length > 0) {
199
+ tableApi.setColumnSizing((old) => ({
200
+ ...old,
201
+ ...newSizing
202
+ }));
203
+ }
204
+ }
148
205
  watch(
149
206
  [() => props.data, autoSize],
150
207
  () => {
151
208
  if (autoSize.value) {
152
- nextTick(debouncedAutosize);
209
+ if (autoSize.value === "fill") {
210
+ autosizeReady.value = true;
211
+ initialAutosizeComplete = true;
212
+ if (props.data && props.data.length > 0 && typeof requestAnimationFrame !== "undefined") {
213
+ nextTick(() => {
214
+ requestAnimationFrame(() => {
215
+ syncFlexColumnWidths();
216
+ });
217
+ });
218
+ }
219
+ return;
220
+ }
221
+ if (!initialAutosizeComplete && props.data && props.data.length > 0) {
222
+ nextTick(() => {
223
+ autoSizeColumns();
224
+ initialAutosizeComplete = true;
225
+ autosizeReady.value = true;
226
+ });
227
+ } else if (initialAutosizeComplete) {
228
+ nextTick(debouncedAutosize);
229
+ }
230
+ } else {
231
+ autosizeReady.value = true;
153
232
  }
154
233
  },
155
234
  { immediate: true, flush: "post" }
156
235
  );
157
236
  return {
158
237
  autoSizeColumns,
159
- autoSizeColumn
238
+ autoSizeColumn,
239
+ presetEqualColumnWidths,
240
+ autosizeReady,
241
+ autoSizeMode: autoSize
160
242
  };
161
243
  }
@@ -894,8 +894,9 @@ export function useNuGridCellEditing(props, tableApi, data, rows, tableRef, root
894
894
  }
895
895
  }
896
896
  }
897
- if (props.editing?.defaultEditors?.[cellDataType]) {
898
- const customEditor = props.editing.defaultEditors[cellDataType];
897
+ const editingConfig = typeof props.editing === "object" ? props.editing : void 0;
898
+ if (editingConfig?.defaultEditors?.[cellDataType]) {
899
+ const customEditor = editingConfig.defaultEditors[cellDataType];
899
900
  if (customEditor) {
900
901
  const context2 = createEditorContext(cell, row);
901
902
  return renderEditor(customEditor, context2);
@@ -1,22 +1,32 @@
1
1
  import type { TableData } from '@nuxt/ui';
2
2
  import type { Header, Table } from '@tanstack/vue-table';
3
+ import type { Ref } from 'vue';
3
4
  import type { NuGridProps } from '../../types/index.js';
4
5
  /**
5
6
  * Column resize functionality with cursor locking
6
7
  */
7
- export declare function useNuGridColumnResize<T extends TableData>(props: NuGridProps<T>, tableApi: Table<T>): {
8
+ export declare function useNuGridColumnResize<T extends TableData>(props: NuGridProps<T>, tableApi: Table<T>, tableRef: Ref<HTMLElement | null>): {
8
9
  handleResizeStart: (event: MouseEvent | TouchEvent, header: Header<T, any>) => void;
9
10
  handleGroupResizeStart: (event: MouseEvent | TouchEvent, header: Header<T, any>) => void;
10
11
  handleResizeEnd: () => void;
11
- resizingGroupId: import("vue").Ref<string | null, string | null>;
12
- resizingColumnId: import("vue").Ref<string | null, string | null>;
12
+ resizingGroupId: Ref<string | null, string | null>;
13
+ resizingColumnId: Ref<string | null, string | null>;
14
+ manuallyResizedColumns: Ref<Set<string> & Omit<Set<string>, keyof Set<any>>, Set<string> | (Set<string> & Omit<Set<string>, keyof Set<any>>)>;
15
+ getContainerWidth: () => number;
16
+ getSizingAsRatios: () => Record<string, number>;
17
+ applySizingFromRatios: (ratios: Record<string, number>) => void;
18
+ applyRestoredSizing: (sizing: Record<string, number>) => void;
13
19
  };
14
20
  /**
15
- * Custom resize handler that maintains table width by redistributing size changes
16
- * to following columns
21
+ * Shift resize handler - redistributes size changes to adjacent columns
22
+ * to maintain the total table width
17
23
  */
18
- export declare function createMaintainWidthResizeHandler<TData>(header: Header<TData, any>, table: Table<TData>): (event: MouseEvent | TouchEvent) => void;
24
+ export declare function createShiftResizeHandler<TData>(header: Header<TData, any>, table: Table<TData>, _manuallyResizedColumns?: {
25
+ value: Set<string>;
26
+ }): (event: MouseEvent | TouchEvent) => void;
19
27
  /**
20
28
  * Custom resize handler for column groups that resizes all leaf columns proportionately
21
29
  */
22
- export declare function createGroupResizeHandler<TData>(header: Header<TData, any>, table: Table<TData>): (event: MouseEvent | TouchEvent) => void;
30
+ export declare function createGroupResizeHandler<TData>(header: Header<TData, any>, table: Table<TData>, _manuallyResizedColumns?: {
31
+ value: Set<string>;
32
+ }): (event: MouseEvent | TouchEvent) => void;