@svgrid/grid 1.0.2 → 1.1.0

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 (143) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +137 -39
  3. package/dist/GridFooter.svelte +164 -0
  4. package/dist/GridFooter.svelte.d.ts +29 -0
  5. package/dist/GridMenus.svelte +570 -0
  6. package/dist/GridMenus.svelte.d.ts +31 -0
  7. package/dist/SvGrid.controller.svelte.d.ts +429 -0
  8. package/dist/SvGrid.controller.svelte.js +1732 -0
  9. package/dist/SvGrid.css +1709 -0
  10. package/dist/SvGrid.helpers.d.ts +35 -0
  11. package/dist/SvGrid.helpers.js +160 -0
  12. package/dist/SvGrid.svelte +344 -7043
  13. package/dist/SvGrid.svelte.d.ts +4 -357
  14. package/dist/SvGrid.types.d.ts +436 -0
  15. package/dist/SvGrid.types.js +1 -0
  16. package/dist/SvGridChart.svelte +1060 -23
  17. package/dist/SvGridChart.svelte.d.ts +17 -0
  18. package/dist/build-api.d.ts +5 -0
  19. package/dist/build-api.js +527 -0
  20. package/dist/cell-render.d.ts +15 -0
  21. package/dist/cell-render.js +246 -0
  22. package/dist/cell-values.d.ts +28 -0
  23. package/dist/cell-values.js +89 -0
  24. package/dist/chart.d.ts +370 -3
  25. package/dist/chart.js +1135 -42
  26. package/dist/clipboard.d.ts +15 -0
  27. package/dist/clipboard.js +356 -0
  28. package/dist/columns.d.ts +30 -0
  29. package/dist/columns.js +277 -0
  30. package/dist/core.d.ts +1 -1
  31. package/dist/css.d.ts +3 -0
  32. package/dist/editing.d.ts +24 -0
  33. package/dist/editing.js +343 -0
  34. package/dist/editors/cell-editors.d.ts +1 -1
  35. package/dist/facet-buckets.d.ts +13 -0
  36. package/dist/facet-buckets.js +54 -0
  37. package/dist/features.d.ts +5 -0
  38. package/dist/features.js +30 -0
  39. package/dist/filter-operators.d.ts +16 -0
  40. package/dist/filter-operators.js +69 -0
  41. package/dist/hyperformula-adapter.d.ts +82 -0
  42. package/dist/hyperformula-adapter.js +73 -0
  43. package/dist/index.d.ts +5 -2
  44. package/dist/index.js +5 -2
  45. package/dist/keyboard-handlers.d.ts +7 -0
  46. package/dist/keyboard-handlers.js +197 -0
  47. package/dist/menus.d.ts +40 -0
  48. package/dist/menus.js +389 -0
  49. package/dist/named-views.d.ts +27 -0
  50. package/dist/named-views.js +39 -0
  51. package/dist/row-resize.d.ts +43 -0
  52. package/dist/row-resize.js +158 -0
  53. package/dist/scroll-sync.d.ts +9 -0
  54. package/dist/scroll-sync.js +86 -0
  55. package/dist/selection.d.ts +26 -0
  56. package/dist/selection.js +387 -0
  57. package/dist/spreadsheet.d.ts +80 -0
  58. package/dist/spreadsheet.js +194 -0
  59. package/dist/summaries.d.ts +12 -0
  60. package/dist/summaries.js +65 -0
  61. package/dist/svgrid-wrapper.types.d.ts +12 -1
  62. package/dist/svgrid.comments-autocomplete.test.d.ts +1 -0
  63. package/dist/svgrid.comments-autocomplete.test.js +96 -0
  64. package/dist/svgrid.context-menu.test.d.ts +1 -0
  65. package/dist/svgrid.context-menu.test.js +102 -0
  66. package/dist/svgrid.new-features.wrapper.test.js +30 -4
  67. package/dist/svgrid.wrapper.test.js +27 -1
  68. package/dist/virtualization/column-virtualizer.d.ts +2 -0
  69. package/dist/virtualization/scroll-scaling.d.ts +28 -0
  70. package/dist/virtualization/scroll-scaling.js +64 -0
  71. package/dist/virtualization/scroll-scaling.test.d.ts +1 -0
  72. package/dist/virtualization/scroll-scaling.test.js +86 -0
  73. package/dist/virtualization/svelte-virtualizer.svelte.d.ts +2 -0
  74. package/dist/virtualization/svelte-virtualizer.svelte.js +2 -0
  75. package/dist/virtualization/virtualizer.d.ts +7 -0
  76. package/dist/virtualization/virtualizer.js +30 -0
  77. package/package.json +1 -1
  78. package/src/GridFooter.svelte +164 -0
  79. package/src/GridMenus.svelte +570 -0
  80. package/src/SvGrid.controller.svelte.ts +2195 -0
  81. package/src/SvGrid.css +1747 -0
  82. package/src/SvGrid.helpers.test.ts +415 -0
  83. package/src/SvGrid.helpers.ts +185 -0
  84. package/src/SvGrid.svelte +348 -7043
  85. package/src/SvGrid.types.ts +456 -0
  86. package/src/SvGridChart.svelte +1060 -23
  87. package/src/build-api.coverage.test.ts +532 -0
  88. package/src/build-api.ts +663 -0
  89. package/src/cell-render.test.ts +451 -0
  90. package/src/cell-render.ts +426 -0
  91. package/src/cell-values.ts +114 -0
  92. package/src/chart-export.test.ts +370 -0
  93. package/src/chart.coverage.test.ts +814 -0
  94. package/src/chart.ts +1352 -47
  95. package/src/clipboard.test.ts +731 -0
  96. package/src/clipboard.ts +524 -0
  97. package/src/collaboration.coverage.test.ts +220 -0
  98. package/src/columns.test.ts +702 -0
  99. package/src/columns.ts +419 -0
  100. package/src/core.ts +8 -0
  101. package/src/css.d.ts +3 -0
  102. package/src/editing.test.ts +837 -0
  103. package/src/editing.ts +513 -0
  104. package/src/editors/cell-editors.coverage.test.ts +156 -0
  105. package/src/editors/cell-editors.ts +1 -0
  106. package/src/facet-buckets.test.ts +353 -0
  107. package/src/facet-buckets.ts +67 -0
  108. package/src/features.ts +128 -0
  109. package/src/filter-operators.test.ts +174 -0
  110. package/src/filter-operators.ts +87 -0
  111. package/src/hyperformula-adapter.test.ts +256 -0
  112. package/src/hyperformula-adapter.ts +124 -0
  113. package/src/index.ts +37 -0
  114. package/src/keyboard-handlers.coverage.test.ts +560 -0
  115. package/src/keyboard-handlers.ts +353 -0
  116. package/src/keyboard.ts +97 -97
  117. package/src/menus.test.ts +620 -0
  118. package/src/menus.ts +554 -0
  119. package/src/named-views.coverage.test.ts +210 -0
  120. package/src/named-views.ts +48 -0
  121. package/src/row-resize.test.ts +369 -0
  122. package/src/row-resize.ts +171 -0
  123. package/src/scroll-sync.test.ts +330 -0
  124. package/src/scroll-sync.ts +216 -0
  125. package/src/selection.test.ts +722 -0
  126. package/src/selection.ts +545 -0
  127. package/src/server-data-source.coverage.test.ts +180 -0
  128. package/src/spreadsheet.test.ts +445 -0
  129. package/src/spreadsheet.ts +246 -0
  130. package/src/summaries.ts +204 -0
  131. package/src/sv-grid-scrollbar.ts +13 -1
  132. package/src/svgrid-wrapper.types.ts +12 -1
  133. package/src/svgrid.behavior.test.ts +22 -0
  134. package/src/svgrid.comments-autocomplete.test.ts +112 -0
  135. package/src/svgrid.context-menu.test.ts +126 -0
  136. package/src/svgrid.interaction.test.ts +30 -0
  137. package/src/svgrid.new-features.wrapper.test.ts +65 -4
  138. package/src/svgrid.wrapper.test.ts +27 -1
  139. package/src/test-setup.ts +9 -6
  140. package/src/virtualization/scroll-scaling.test.ts +148 -0
  141. package/src/virtualization/scroll-scaling.ts +121 -0
  142. package/src/virtualization/svelte-virtualizer.svelte.ts +2 -0
  143. package/src/virtualization/virtualizer.ts +26 -0
@@ -0,0 +1,1732 @@
1
+ import { applyExcelFilter, normalizeForFilter, createColumnVirtualizer, createCoreRowModel, createExpandedRowModel, createFilteredRowModel, createGroupedRowModel, createSvelteVirtualizer, createSortedRowModel, createSvGrid, getGridCellDomId, sortFns, } from "./index";
2
+ import { createRowScrollScaling } from "./virtualization/scroll-scaling";
3
+ import "./sv-grid-scrollbar";
4
+ import { computeColumnStat, formatsNeedingStats, } from "./conditional-formatting";
5
+ import { rawToNumber, } from "./SvGrid.helpers";
6
+ import { createFeatures } from "./features";
7
+ import { createScrollSync, } from "./scroll-sync";
8
+ import { createKeyboard, } from "./keyboard-handlers";
9
+ import { createSummaries, } from "./summaries";
10
+ import { createMenus, } from "./menus";
11
+ import { createCellRender, } from "./cell-render";
12
+ import { createEditing, } from "./editing";
13
+ import { createSelection, } from "./selection";
14
+ import { createColumns, } from "./columns";
15
+ import { createGridApi, } from "./build-api";
16
+ import { createClipboard, } from "./clipboard";
17
+ import { filterOperatorOptions, fallbackOperatorOption, TEXT_OPERATORS, NUMBER_OPERATORS, DATE_OPERATORS, CHECKBOX_OPERATORS, operatorOption, operatorsForColumn, defaultOperatorFor, operatorLabelFor, } from "./filter-operators";
18
+ import { isBucketableColumn, buildBuckets, isInBucket, } from "./facet-buckets";
19
+ import { getColumnBaseValue, isGroupRow, toolPanelHeaderLabel, formatSummaryNumeric, getColumnAlign, getPinnedCellValue, getColumnAccessorValue, columnDefMatchesId, } from "./cell-values";
20
+ /**
21
+ * Conservative fallback for the browser's max element height, used during SSR
22
+ * or if runtime detection fails. 8M is below every known engine cap (Firefox
23
+ * ~17.9M, Chrome/Safari ~33.5M) so it is always safe, if coarser than needed.
24
+ */
25
+ const MAX_DOM_SCROLL_HEIGHT_FALLBACK = 8000000;
26
+ /**
27
+ * The browser's actual maximum element height in CSS px. Browsers clamp how
28
+ * tall a single element may be (and mobile / high-DPR caps differ), so we
29
+ * measure it once by reading the clamped `offsetHeight` of an absurdly tall
30
+ * probe kept inside a 1x1 `overflow:hidden` wrapper (so it never affects page
31
+ * layout or scroll). Cached for the page lifetime; constant per browser.
32
+ */
33
+ let detectedMaxDomHeight = null;
34
+ function getMaxDomScrollHeight() {
35
+ if (detectedMaxDomHeight != null)
36
+ return detectedMaxDomHeight;
37
+ if (typeof document === "undefined" || !document.body) {
38
+ return MAX_DOM_SCROLL_HEIGHT_FALLBACK;
39
+ }
40
+ try {
41
+ const wrap = document.createElement("div");
42
+ wrap.style.cssText =
43
+ "position:fixed;top:0;left:-9999px;width:1px;height:1px;overflow:hidden;visibility:hidden;pointer-events:none;";
44
+ const probe = document.createElement("div");
45
+ probe.style.cssText = "width:1px;height:1000000000px;";
46
+ wrap.appendChild(probe);
47
+ document.body.appendChild(wrap);
48
+ const measured = probe.offsetHeight;
49
+ document.body.removeChild(wrap);
50
+ // A clamped read is a large finite number well under the 1e9 we asked for.
51
+ // If the browser did not clamp (returned ~1e9) or returned junk, fall back.
52
+ detectedMaxDomHeight =
53
+ measured > 100000 && measured < 900000000
54
+ ? measured
55
+ : MAX_DOM_SCROLL_HEIGHT_FALLBACK;
56
+ }
57
+ catch {
58
+ detectedMaxDomHeight = MAX_DOM_SCROLL_HEIGHT_FALLBACK;
59
+ }
60
+ return detectedMaxDomHeight;
61
+ }
62
+ export function createSvGridController(props) {
63
+ // Resolved capability gates. Capabilities are OFF by default - a bare
64
+ // grid is a plain read-only table, and each power feature is opted into
65
+ // via its shortcut (`editable` / `pageable` / `groupable`) or the matching
66
+ // fine-grained prop (`enableInlineEditing` / `showPagination` /
67
+ // `showGroupingControls`). The shortcut wins when set; otherwise the
68
+ // fine-grained prop wins; otherwise the capability is off. (Sorting and
69
+ // filtering follow the same opt-in model already - they require their
70
+ // feature, injected by `sortable` / `filterable`.)
71
+ const editingEnabled = $derived(props.editable ?? props.enableInlineEditing ?? false);
72
+ const paginationEnabled = $derived(props.pageable ?? props.showPagination ?? false);
73
+ const groupingControlsEnabled = $derived(props.groupable ?? props.showGroupingControls ?? false);
74
+ let globalFilter = $state("");
75
+ let scrollContainer = $state(null);
76
+ let gridRootEl = $state(null);
77
+ let filterRowValues = $state({});
78
+ let filterMenuValues = $state({});
79
+ let verticalScrollbarEl = $state(null);
80
+ let horizontalScrollbarEl = $state(null);
81
+ let scrollVersion = $state(0);
82
+ /**
83
+ * Separate state from `scrollVersion`: only bumped by the ResizeObserver
84
+ * when the shell's CSS size changes. The virtualizer effects below depend
85
+ * on this instead of `scrollVersion` so they DON'T re-run on every scroll
86
+ * event - `scrollVersion` fires constantly during a drag.
87
+ */
88
+ let viewportVersion = $state(0);
89
+ let lastResetSignature = "";
90
+ let pendingScrollTop = 0;
91
+ let pendingScrollLeft = 0;
92
+ let scrollSyncRaf = null;
93
+ let selectionRange = $state({ anchor: null, focus: null });
94
+ let isDraggingSelection = $state(false);
95
+ /** Excel-style fill handle drag state. While non-null we paint a "fill
96
+ * preview" overlay on cells between the source range and the pointer
97
+ * cell; on pointerup we extrapolate the source pattern into them. */
98
+ let fillDrag = $state(null);
99
+ let activeAtPointerDown = null;
100
+ let editingCell = $state(null);
101
+ let editedCellValues = $state({});
102
+ const UNDO_LIMIT = 200;
103
+ let history = $state([]);
104
+ /** Index in `history` of the LAST applied step. -1 means "nothing applied".
105
+ * undo() decrements; redo() increments. New edits truncate everything
106
+ * past the pointer (the classic "you can't redo after editing" rule). */
107
+ let historyPtr = $state(-1);
108
+ /** Bumps on every undo / redo / record so $derived consumers can
109
+ * observe via the api without subscribing to history directly. */
110
+ let historyVersion = $state(0);
111
+ let tooltip = $state(null);
112
+ let tooltipTimer = null;
113
+ // ---- Find-in-grid ----------------------------------------------------
114
+ let findOpen = $state(false);
115
+ let findQuery = $state('');
116
+ let findHitIndex = $state(0);
117
+ const findHits = $derived.by(() => {
118
+ const q = findQuery.trim().toLowerCase();
119
+ if (!q || !findOpen)
120
+ return [];
121
+ const out = [];
122
+ for (let r = 0; r < allRows.length; r += 1) {
123
+ const row = allRows[r];
124
+ if (!row)
125
+ continue;
126
+ for (let c = 0; c < allColumns.length; c += 1) {
127
+ const col = allColumns[c];
128
+ if (!col)
129
+ continue;
130
+ const v = row.getCellValueByColumnId(col.id);
131
+ if (v == null)
132
+ continue;
133
+ const s = String(v).toLowerCase();
134
+ if (s.includes(q))
135
+ out.push({ rowIndex: r, colIndex: c, columnId: col.id });
136
+ }
137
+ }
138
+ return out;
139
+ });
140
+ let theadEl = $state(null);
141
+ let headerHeight = $state(0);
142
+ /** When an edit starts: true selects all text, false places the caret at the end. */
143
+ let editorSelectAll = true;
144
+ /** Per-column width overrides set by the resize handles. */
145
+ let columnWidths = $state({});
146
+ let resizingColumnId = $state(null);
147
+ let resizeStartX = 0;
148
+ let resizeStartWidth = 0;
149
+ const MIN_COLUMN_WIDTH = 40;
150
+ /** Columns pinned to the left or right edge of the grid (sticky positioning).
151
+ * Seeded from `props.initialColumnPinning` so demos / tests can show the
152
+ * feature on first render without driving the column menu in JS. */
153
+ let columnPinning = $state({
154
+ left: [...(props.initialColumnPinning?.left ?? [])],
155
+ right: [...(props.initialColumnPinning?.right ?? [])],
156
+ });
157
+ let columnVirtualizerVersion = $state(0);
158
+ let gridStateVersion = $state(0);
159
+ const selectionColumnWidth = 44;
160
+ const rowNumberColumnWidth = $derived(props.rowNumberWidth ?? 56);
161
+ const showRowNumbersEffective = $derived(props.showRowNumbers ?? false);
162
+ let columnMenuFor = $state(null);
163
+ let columnMenuPos = $state({ x: 0, y: 0 });
164
+ let columnMenuSearch = $state("");
165
+ let filterMenuFor = $state(null);
166
+ let filterMenuPos = $state({ x: 0, y: 0 });
167
+ let operatorMenuFor = $state(null);
168
+ let operatorMenuPos = $state({ x: 0, y: 0 });
169
+ let chooseColumnsPos = $state(null);
170
+ let contextMenuFor = $state(null);
171
+ let contextMenuPos = $state({ x: 0, y: 0 });
172
+ // Editable comments: internal overlay (rowId -> columnId -> note) merged on
173
+ // top of props.notes for immediate feedback, plus the open-editor state.
174
+ let noteOverrides = $state({});
175
+ let commentEditFor = $state(null);
176
+ let commentDraft = $state("");
177
+ let valueFilters = $state({});
178
+ const viewportWidth = $derived.by(() => {
179
+ viewportVersion;
180
+ return scrollContainer ? scrollContainer.clientWidth : 0;
181
+ });
182
+ const viewportHeight = $derived.by(() => {
183
+ viewportVersion;
184
+ return scrollContainer ? scrollContainer.clientHeight : 0;
185
+ });
186
+ const scrollMetrics = $derived.by(() => {
187
+ scrollVersion;
188
+ viewportVersion;
189
+ // Track the virtualizers' versions too so when data loads or row /
190
+ // column counts change, scrollMetrics re-reads the DOM's grown
191
+ // scrollHeight / scrollWidth. Without these deps the scrollbar
192
+ // receives a stale `content-size` ≈ 0, its hidden-check trips, it
193
+ // sets `pointer-events: none`, and the user can't drag it. The
194
+ // identifiers below are declared further down - derived callbacks
195
+ // run lazily, so by the time this fires they're in scope.
196
+ virtualizer.version;
197
+ columnVirtualizerVersion;
198
+ return {
199
+ scrollTop: scrollContainer?.scrollTop ?? 0,
200
+ scrollLeft: scrollContainer?.scrollLeft ?? 0,
201
+ clientHeight: scrollContainer?.clientHeight ?? 0,
202
+ clientWidth: scrollContainer?.clientWidth ?? 0,
203
+ scrollHeight: scrollContainer?.scrollHeight ?? 0,
204
+ scrollWidth: scrollContainer?.scrollWidth ?? 0,
205
+ };
206
+ });
207
+ /** Vertical overflow from the virtualizer's authoritative total size,
208
+ * NOT from `scrollMetrics.scrollHeight`. Reading DOM dimensions
209
+ * during a Svelte derived runs BEFORE the browser paints - the table
210
+ * hasn't laid out the new rows yet, so `scrollHeight` is briefly 0
211
+ * even after data loads. That made the overflow flag return false,
212
+ * hid the scrollbar, and broke dragging. */
213
+ const hasVerticalOverflow = $derived.by(() => {
214
+ virtualizer.version;
215
+ return virtualizer.getTotalSize() > viewportHeight + 1;
216
+ });
217
+ // Effective filter-UI flags. Each show* prop wins when explicitly set;
218
+ // otherwise the `filterMode` prop (default 'menu') picks exactly one surface.
219
+ const showGlobalFilterEffective = $derived(props.showGlobalFilter ?? (props.filterMode ?? "menu") === "global");
220
+ const showFilterRowEffective = $derived(props.showFilterRow ?? (props.filterMode ?? "menu") === "row");
221
+ const showColumnFiltersEffective = $derived(props.showColumnFilters ?? (props.filterMode ?? "menu") === "menu");
222
+ // The inline "floating filter" input under each header duplicates the
223
+ // column menu's funnel popover when both are active, so it requires an
224
+ // explicit opt-in via the `showColumnFilters` prop.
225
+ const showInlineColumnFilterEffective = $derived(props.showColumnFilters === true);
226
+ // Effective selection-surface flags. `selectionMode` defaults to 'both' so
227
+ // existing consumers keep their current behaviour.
228
+ const showRowSelectionEffective = $derived(props.showRowSelection ??
229
+ ((props.selectionMode ?? "both") === "row" ||
230
+ (props.selectionMode ?? "both") === "both"));
231
+ const enableCellSelectionEffective = $derived(props.enableCellSelection ??
232
+ ((props.selectionMode ?? "both") === "cell" ||
233
+ (props.selectionMode ?? "both") === "both"));
234
+ // Internal source-of-truth for data and column defs. Seeded from props and
235
+ // re-synced whenever the parent passes a new array; the imperative API
236
+ // mutates these so add/remove operations don't need a callback round-trip.
237
+ // svelte-ignore state_referenced_locally
238
+ let internalData = $state.raw(props.data);
239
+ // svelte-ignore state_referenced_locally
240
+ let internalColumns = $state.raw(props.columns);
241
+ let hiddenColumns = $state({});
242
+ $effect(() => {
243
+ // When the consumer replaces `data` (e.g. a "Reset" button), drop any
244
+ // accumulated cell-edit overrides - otherwise `getCellDisplayValue`
245
+ // would keep returning the old edited values from `editedCellValues`
246
+ // even though the underlying data has been replaced.
247
+ internalData = props.data;
248
+ editedCellValues = {};
249
+ });
250
+ $effect(() => {
251
+ internalColumns = props.columns;
252
+ });
253
+ // Captured ONCE at mount: `externalSort` is a structural choice (tree vs
254
+ // flat data) so toggling it after mount is not supported. Reading it here
255
+ // - outside the getter below - guarantees the pass-through sort is wired
256
+ // in before `createSvGrid` first reads `_rowModels`.
257
+ // svelte-ignore state_referenced_locally
258
+ const externalSortEnabled = props.externalSort === true;
259
+ // Same one-shot capture for external filtering. Server-side mode means
260
+ // the wrapper records filter state but does not actually filter rows.
261
+ // svelte-ignore state_referenced_locally
262
+ const externalFilterEnabled = props.externalFilter === true;
263
+ const passthroughSortedRowModel = ({ rows }) => rows;
264
+ const grid = createSvGrid({
265
+ get _features() {
266
+ return resolveEffectiveFeatures();
267
+ },
268
+ get _rowModels() {
269
+ // Pagination is intentionally NOT in the grid's row-model pipeline.
270
+ // The wrapper applies its own filters (filterMenuValues, globalFilter,
271
+ // valueFilters) on top of `grid.getRowModel().rows`. If pagination
272
+ // ran first, those filters would only see the visible page. Instead
273
+ // the wrapper paginates last - see `allRows` below.
274
+ return {
275
+ coreRowModel: createCoreRowModel(),
276
+ filteredRowModel: createFilteredRowModel(),
277
+ // External-sort mode: pass the rows through untouched so the consumer
278
+ // controls ordering (e.g. tree data that must preserve hierarchy).
279
+ sortedRowModel: externalSortEnabled
280
+ ? passthroughSortedRowModel
281
+ : createSortedRowModel(sortFns),
282
+ groupedRowModel: createGroupedRowModel(),
283
+ expandedRowModel: createExpandedRowModel(),
284
+ };
285
+ },
286
+ get columns() {
287
+ return internalColumns;
288
+ },
289
+ get data() {
290
+ return internalData;
291
+ },
292
+ get getRowId() {
293
+ return props.getRowId;
294
+ },
295
+ state: {
296
+ columnFilters: [],
297
+ grouping: [],
298
+ sorting: [],
299
+ // svelte-ignore state_referenced_locally
300
+ pagination: { pageIndex: 0, pageSize: props.pageSize ?? 10 },
301
+ rowSelection: {},
302
+ expanded: {},
303
+ activeCell: { rowIndex: 0, colIndex: 0, cellId: null },
304
+ },
305
+ });
306
+ $effect(() => {
307
+ const unsubscribe = grid.store.subscribe(() => {
308
+ gridStateVersion += 1;
309
+ });
310
+ return unsubscribe;
311
+ });
312
+ /**
313
+ * The grid's columns reordered so left-pinned columns come first and
314
+ * right-pinned columns come last. All other code (rendering, keyboard nav,
315
+ * active cell) operates on this ordered view.
316
+ */
317
+ /**
318
+ * User-driven column order (drag-to-reorder OR `api.setColumnOrder`).
319
+ * Stored as a flat list of column ids. Empty = use the natural order
320
+ * from the columns prop. The pin grouping is applied on top of this.
321
+ */
322
+ let userColumnOrder = $state([...(props.columnOrder ?? [])]);
323
+ // Re-seed on prop change so consumers can drive order from outside.
324
+ let lastSeededOrder = "";
325
+ $effect(() => {
326
+ const incoming = props.columnOrder
327
+ ? [...props.columnOrder].join("|")
328
+ : "";
329
+ if (incoming === lastSeededOrder)
330
+ return;
331
+ lastSeededOrder = incoming;
332
+ userColumnOrder = props.columnOrder ? [...props.columnOrder] : [];
333
+ });
334
+ const allColumns = $derived.by(() => {
335
+ let raw = grid
336
+ .getAllColumns()
337
+ .filter((column) => !hiddenColumns[column.id]);
338
+ // Apply user reorder (if any). Unknown ids in userColumnOrder are
339
+ // skipped; columns not in userColumnOrder keep their original
340
+ // relative order after the user-ordered ones.
341
+ if (userColumnOrder.length > 0) {
342
+ const byId = new Map(raw.map((c) => [c.id, c]));
343
+ const seen = new Set();
344
+ const ordered = [];
345
+ for (const id of userColumnOrder) {
346
+ const c = byId.get(id);
347
+ if (c && !seen.has(id)) {
348
+ ordered.push(c);
349
+ seen.add(id);
350
+ }
351
+ }
352
+ for (const c of raw) {
353
+ if (!seen.has(c.id))
354
+ ordered.push(c);
355
+ }
356
+ raw = ordered;
357
+ }
358
+ const leftIds = columnPinning.left;
359
+ const rightIds = columnPinning.right;
360
+ if (!leftIds.length && !rightIds.length)
361
+ return raw;
362
+ const pinned = new Set([...leftIds, ...rightIds]);
363
+ const findById = (id) => raw.find((column) => column.id === id);
364
+ const left = leftIds
365
+ .map(findById)
366
+ .filter((c) => Boolean(c));
367
+ const right = rightIds
368
+ .map(findById)
369
+ .filter((c) => Boolean(c));
370
+ const unpinned = raw.filter((column) => !pinned.has(column.id));
371
+ return [...left, ...unpinned, ...right];
372
+ });
373
+ /** Header groups reordered to match {@link allColumns}. */
374
+ const headerGroups = $derived.by(() => {
375
+ const base = grid.getHeaderGroups();
376
+ if (!base.length)
377
+ return base;
378
+ const byId = new Map(base[0].headers.map((header) => [header.column.id, header]));
379
+ const headers = [];
380
+ for (const column of allColumns) {
381
+ const header = byId.get(column.id);
382
+ if (header)
383
+ headers.push(header);
384
+ }
385
+ return [{ id: base[0].id, headers }];
386
+ });
387
+ const groupHeaderRows = $derived.by(() => {
388
+ const userCols = props.columns ?? [];
389
+ // 1. Find max depth in the user-provided column tree.
390
+ function maxDepth(defs) {
391
+ let m = 0;
392
+ for (const d of defs) {
393
+ if (d.columns?.length) {
394
+ m = Math.max(m, 1 + maxDepth(d.columns));
395
+ }
396
+ }
397
+ return m;
398
+ }
399
+ const depth = maxDepth(userCols);
400
+ if (depth === 0)
401
+ return [];
402
+ const leafEntries = [];
403
+ function buildId(def, parentId, fallbackIx) {
404
+ return def.id ?? def.field ?? `${parentId ?? 'col'}_d_${fallbackIx}`;
405
+ }
406
+ function collectLeaves(defs, parentId, depthHere) {
407
+ defs.forEach((def, ix) => {
408
+ const id = buildId(def, parentId, ix);
409
+ if (def.columns?.length) {
410
+ collectLeaves(def.columns, id, depthHere + 1);
411
+ }
412
+ else {
413
+ leafEntries.push({ id, widthPx: getColumnWidth(id) });
414
+ }
415
+ });
416
+ }
417
+ collectLeaves(userCols, undefined, 0);
418
+ function indexTree(defs, parentId, cursor) {
419
+ const nodes = [];
420
+ for (const def of defs) {
421
+ const id = buildId(def, parentId, nodes.length);
422
+ const leafStart = cursor.leaf;
423
+ if (def.columns?.length) {
424
+ indexTree(def.columns, id, cursor);
425
+ }
426
+ else {
427
+ cursor.leaf += 1;
428
+ }
429
+ const leafEnd = cursor.leaf;
430
+ nodes.push({ def, id, leafStart, leafEnd });
431
+ }
432
+ return nodes;
433
+ }
434
+ const cursor = { leaf: 0 };
435
+ const topNodes = indexTree(userCols, undefined, cursor);
436
+ function nodesAtDepth(nodes, currentDepth, targetDepth) {
437
+ if (currentDepth === targetDepth)
438
+ return nodes;
439
+ const out = [];
440
+ for (const n of nodes) {
441
+ if (n.def.columns?.length) {
442
+ const childCursor = { leaf: n.leafStart };
443
+ const children = indexTree(n.def.columns, n.id, childCursor);
444
+ out.push(...nodesAtDepth(children, currentDepth + 1, targetDepth));
445
+ }
446
+ else {
447
+ // Leaf reached early - emit a placeholder at this row so the
448
+ // column above it stays empty (the leaf itself renders in the
449
+ // bottom leaf-header row, not here).
450
+ out.push(n);
451
+ }
452
+ }
453
+ return out;
454
+ }
455
+ function sumLeafWidths(from, to) {
456
+ let sum = 0;
457
+ for (let i = from; i < to; i += 1)
458
+ sum += leafEntries[i]?.widthPx ?? 0;
459
+ return sum;
460
+ }
461
+ const rows = [];
462
+ for (let d = 0; d < depth; d += 1) {
463
+ const at = nodesAtDepth(topNodes, 0, d);
464
+ const cells = at.map((n) => {
465
+ const isLeafEarly = !n.def.columns?.length;
466
+ const headerText = typeof n.def.header === 'string' ? n.def.header : '';
467
+ return {
468
+ key: `${n.id}_d${d}`,
469
+ label: isLeafEarly ? '' : headerText,
470
+ colSpan: Math.max(1, n.leafEnd - n.leafStart),
471
+ widthPx: sumLeafWidths(n.leafStart, n.leafEnd),
472
+ firstLeafIndex: n.leafStart,
473
+ isPlaceholder: isLeafEarly,
474
+ };
475
+ });
476
+ rows.push({ id: `gh_${d}`, cells });
477
+ }
478
+ return rows;
479
+ });
480
+ /** Cumulative pixel offsets for left- and right-pinned columns. */
481
+ const pinnedOffsets = $derived.by(() => {
482
+ const rowNumberWidth = showRowNumbersEffective ? rowNumberColumnWidth : 0;
483
+ const selectionWidth = showRowSelectionEffective ? selectionColumnWidth : 0;
484
+ const left = {};
485
+ let leftAcc = rowNumberWidth + selectionWidth;
486
+ for (const id of columnPinning.left) {
487
+ left[id] = leftAcc;
488
+ leftAcc += getColumnWidth(id);
489
+ }
490
+ const right = {};
491
+ let rightAcc = 0;
492
+ for (let i = columnPinning.right.length - 1; i >= 0; i -= 1) {
493
+ const id = columnPinning.right[i];
494
+ if (!id)
495
+ continue;
496
+ right[id] = rightAcc;
497
+ rightAcc += getColumnWidth(id);
498
+ }
499
+ return { left, right };
500
+ });
501
+ // ---- Column reorder (drag headers) ----------------------------------
502
+ // Live drag state for the built-in header drag-to-reorder. Only set
503
+ // when `props.enableColumnReorder` is true.
504
+ let colDragId = $state(null);
505
+ let colDropOnId = $state(null);
506
+ let colDropSide = $state(null);
507
+ // ---- Conditional formatting --------------------------------------------
508
+ // True when the feature is in use; gates the per-cell positioning context
509
+ // (cells are otherwise non-relative for scroll performance).
510
+ const hasConditionalFormats = $derived((props.conditionalFormats?.length ?? 0) > 0);
511
+ // Per-column numeric min/max, needed only by colorScale / dataBar formats.
512
+ // Lazy: this derived never runs unless `conditionalFormats` is set.
513
+ const conditionalColumnStats = $derived.by(() => {
514
+ const map = new Map();
515
+ const formats = props.conditionalFormats;
516
+ if (!formats?.length || !formatsNeedingStats(formats))
517
+ return map;
518
+ for (const column of allColumns) {
519
+ const needs = formats.some((f) => (f.type === "colorScale" || f.type === "dataBar") &&
520
+ (!f.columns || f.columns.includes(column.id)));
521
+ if (!needs)
522
+ continue;
523
+ const def = column.columnDef;
524
+ const accessorFn = def.accessorFn;
525
+ const field = def.field;
526
+ const stat = computeColumnStat((function* () {
527
+ for (const row of allRows) {
528
+ yield accessorFn
529
+ ? accessorFn(row.original)
530
+ : field
531
+ ? row.original[field]
532
+ : row.getCellValueByColumnId(column.id);
533
+ }
534
+ })());
535
+ if (stat)
536
+ map.set(column.id, stat);
537
+ }
538
+ return map;
539
+ });
540
+ const sortDirectionByColumn = $derived.by(() => {
541
+ gridStateVersion;
542
+ const directions = {};
543
+ for (const column of allColumns)
544
+ directions[column.id] = column.getIsSorted();
545
+ return directions;
546
+ });
547
+ const groupingColumns = $derived.by(() => {
548
+ gridStateVersion;
549
+ return grid.getState().grouping ?? [];
550
+ });
551
+ const paginationState = $derived.by(() => {
552
+ gridStateVersion;
553
+ return grid.getState().pagination ?? { pageIndex: 0, pageSize: 10 };
554
+ });
555
+ /**
556
+ * Rows AFTER all filtering but BEFORE pagination. Used by the pager to
557
+ * compute the correct "X to Y of Z" range and total page count when
558
+ * filters reduce the dataset.
559
+ */
560
+ const allRowsBeforePagination = $derived.by(() => {
561
+ gridStateVersion;
562
+ // Touch internalData + internalColumns so the row model re-derives when
563
+ // the consumer replaces the data array (e.g. via a "Reset" button).
564
+ void internalData;
565
+ void internalColumns;
566
+ const rawRows = grid.getRowModel().rows;
567
+ // External-filter mode: the consumer fetched / pre-filtered the rows
568
+ // themselves (server-side data sources). Skip every local filter pass
569
+ // so the data isn't double-filtered against the visible page.
570
+ if (externalFilterEnabled)
571
+ return rawRows;
572
+ let rows = rawRows;
573
+ if (globalFilter.trim()) {
574
+ const needle = normalizeForFilter(globalFilter, props.filterLocale);
575
+ rows = rows.filter((row) => row
576
+ .getAllCells()
577
+ .some((cell) => normalizeForFilter(String(cell.getValue() ?? ""), props.filterLocale)
578
+ .includes(needle)));
579
+ }
580
+ const menuFilters = Object.entries(filterMenuValues).filter(([_, filter]) => {
581
+ if (filter.operator === "isBlank")
582
+ return true;
583
+ // `between` needs both endpoints; otherwise treat as inactive.
584
+ if (filter.operator === "between") {
585
+ return (filter.value.trim().length > 0 &&
586
+ (filter.valueTo ?? "").trim().length > 0);
587
+ }
588
+ return filter.value.trim().length > 0;
589
+ });
590
+ if (menuFilters.length) {
591
+ rows = rows.filter((row) => menuFilters.every(([columnId, filter]) => applyExcelFilter(getRowColumnValue(row, columnId), {
592
+ id: columnId,
593
+ operator: filter.operator,
594
+ value: filter.value,
595
+ valueTo: filter.operator === "between" ? filter.valueTo : undefined,
596
+ }, { locale: props.filterLocale })));
597
+ }
598
+ const valueFilterEntries = Object.entries(valueFilters);
599
+ if (valueFilterEntries.length) {
600
+ // Resolve bucket defs up front so we don't re-hit the derived map
601
+ // for every row × column combination. Columns without bucketing
602
+ // map to `null` here and fall through to exact-value matching.
603
+ const bucketEntries = valueFilterEntries.map(([columnId, allowed]) => ({
604
+ columnId,
605
+ allowed,
606
+ buckets: facetBucketsByColumn.get(columnId) ?? null,
607
+ }));
608
+ rows = rows.filter((row) => bucketEntries.every(({ columnId, allowed, buckets }) => {
609
+ const raw = getRowColumnValue(row, columnId);
610
+ if (buckets) {
611
+ // Range-bucketed filter: find which bucket this row's value
612
+ // falls into and check whether that bucket's label is allowed.
613
+ const isDate = buckets[0].isDate;
614
+ const num = rawToNumber(raw, isDate);
615
+ if (!Number.isFinite(num))
616
+ return false;
617
+ for (const bucket of buckets) {
618
+ if (isInBucket(num, bucket))
619
+ return allowed.has(bucket.label);
620
+ }
621
+ return false;
622
+ }
623
+ return allowed.has(String(raw ?? ""));
624
+ }));
625
+ }
626
+ return rows;
627
+ });
628
+ /**
629
+ * Visible rows for the current page. Applied last so filters operate on
630
+ * the full dataset rather than the current page (see the comment above
631
+ * `_rowModels`).
632
+ */
633
+ const allRows = $derived.by(() => {
634
+ const rows = allRowsBeforePagination;
635
+ if (!paginationEnabled)
636
+ return rows;
637
+ const { pageIndex, pageSize } = paginationState;
638
+ const start = pageIndex * pageSize;
639
+ return rows.slice(start, start + pageSize);
640
+ });
641
+ const rowSelectionState = $derived.by(() => {
642
+ gridStateVersion;
643
+ return grid.getState().rowSelection ?? {};
644
+ });
645
+ // Forward selection changes to the consumer. Skips the very first invocation
646
+ // (the initial empty state) so consumers don't get a spurious callback on mount.
647
+ let lastSelectionSerialized = "";
648
+ $effect(() => {
649
+ const serialized = JSON.stringify(rowSelectionState);
650
+ if (serialized === lastSelectionSerialized)
651
+ return;
652
+ lastSelectionSerialized = serialized;
653
+ const callback = props.onRowSelectionChange;
654
+ if (!callback)
655
+ return;
656
+ const data = internalData;
657
+ const selectedRows = [];
658
+ for (let i = 0; i < data.length; i++) {
659
+ if (rowSelectionState[String(i)])
660
+ selectedRows.push(data[i]);
661
+ }
662
+ callback(rowSelectionState, selectedRows);
663
+ });
664
+ // Forward cell-selection rectangle changes to the consumer. Same
665
+ // dedupe pattern - fires only when the serialized rectangle changes
666
+ // so consumers don't see spurious callbacks during re-renders.
667
+ let lastCellRangeSerialized = "";
668
+ $effect(() => {
669
+ const a = selectionRange.anchor;
670
+ const f = selectionRange.focus;
671
+ const ranges = a && f
672
+ ? [[
673
+ Math.min(a.rowIndex, f.rowIndex),
674
+ Math.min(a.colIndex, f.colIndex),
675
+ Math.max(a.rowIndex, f.rowIndex),
676
+ Math.max(a.colIndex, f.colIndex),
677
+ ]]
678
+ : [];
679
+ const serialized = JSON.stringify(ranges);
680
+ if (serialized === lastCellRangeSerialized)
681
+ return;
682
+ lastCellRangeSerialized = serialized;
683
+ props.onCellSelectionChange?.(ranges);
684
+ });
685
+ // ---- Status bar: live aggregates of the selected cell range -----------
686
+ const statusBarEnabled = $derived(props.statusBar != null && props.statusBar !== false);
687
+ const statusBarAggregates = $derived(typeof props.statusBar === "object" && props.statusBar.aggregates
688
+ ? props.statusBar.aggregates
689
+ : ["count", "sum", "avg", "min", "max"]);
690
+ const statusBarStats = $derived.by(() => {
691
+ if (!statusBarEnabled)
692
+ return null;
693
+ const a = selectionRange.anchor;
694
+ const f = selectionRange.focus;
695
+ if (!a || !f)
696
+ return null;
697
+ const minR = Math.min(a.rowIndex, f.rowIndex);
698
+ const maxR = Math.max(a.rowIndex, f.rowIndex);
699
+ const minC = Math.min(a.colIndex, f.colIndex);
700
+ const maxC = Math.max(a.colIndex, f.colIndex);
701
+ let count = 0;
702
+ let numericCount = 0;
703
+ let sum = 0;
704
+ let min = Number.POSITIVE_INFINITY;
705
+ let max = Number.NEGATIVE_INFINITY;
706
+ for (let r = minR; r <= maxR; r += 1) {
707
+ const row = allRows[r];
708
+ if (!row || isGroupRow(row))
709
+ continue;
710
+ for (let c = minC; c <= maxC; c += 1) {
711
+ const col = allColumns[c];
712
+ if (!col)
713
+ continue;
714
+ count += 1;
715
+ const base = getColumnBaseValue(row, col);
716
+ const v = getCellDisplayValue(row.id, col.id, base);
717
+ if (v == null || v === "")
718
+ continue;
719
+ const n = Number(v);
720
+ if (!Number.isFinite(n))
721
+ continue;
722
+ numericCount += 1;
723
+ sum += n;
724
+ if (n < min)
725
+ min = n;
726
+ if (n > max)
727
+ max = n;
728
+ }
729
+ }
730
+ if (count <= 1)
731
+ return null;
732
+ return {
733
+ count,
734
+ numericCount,
735
+ sum,
736
+ avg: numericCount ? sum / numericCount : 0,
737
+ min: numericCount ? min : 0,
738
+ max: numericCount ? max : 0,
739
+ };
740
+ });
741
+ // ---- Tool panel (docked columns sidebar) -------------------------------
742
+ let toolPanelOpen = $state(false);
743
+ const toolPanelEnabled = $derived(props.toolPanel === true);
744
+ // Every column (including hidden ones) in the user's current order, so the
745
+ // panel can toggle/reorder anything. Group columns are flagged live.
746
+ const toolPanelColumns = $derived.by(() => {
747
+ gridStateVersion;
748
+ const all = grid.getAllColumns();
749
+ if (!userColumnOrder.length)
750
+ return all;
751
+ const byId = new Map(all.map((c) => [c.id, c]));
752
+ const ordered = [];
753
+ const seen = new Set();
754
+ for (const id of userColumnOrder) {
755
+ const c = byId.get(id);
756
+ if (c && !seen.has(id)) {
757
+ ordered.push(c);
758
+ seen.add(id);
759
+ }
760
+ }
761
+ for (const c of all)
762
+ if (!seen.has(c.id))
763
+ ordered.push(c);
764
+ return ordered;
765
+ });
766
+ // Forward sort-clause changes to the consumer. Same dedupe pattern as the
767
+ // selection callback above - fires only when the serialized clauses change.
768
+ let lastSortingSerialized = "";
769
+ $effect(() => {
770
+ gridStateVersion;
771
+ const sorting = (grid.getState().sorting ?? []);
772
+ const serialized = JSON.stringify(sorting);
773
+ if (serialized === lastSortingSerialized)
774
+ return;
775
+ lastSortingSerialized = serialized;
776
+ props.onSortingChange?.(sorting);
777
+ });
778
+ // Forward filter-state changes to the consumer. Consolidates the three
779
+ // wrapper-managed filter stores (global text, per-column operator filters,
780
+ // facet checklists) into one shape so server-side consumers can build a
781
+ // single query. Skipped entirely when no callback is registered to avoid
782
+ // serializing on every keystroke.
783
+ let lastFiltersSerialized = "";
784
+ $effect(() => {
785
+ if (!props.onFiltersChange)
786
+ return;
787
+ const menuEntries = Object.entries(filterMenuValues)
788
+ .filter(([, f]) => {
789
+ if (f.operator === "isBlank")
790
+ return true;
791
+ if (f.operator === "between") {
792
+ return f.value.trim().length > 0 && (f.valueTo ?? "").trim().length > 0;
793
+ }
794
+ return f.value.trim().length > 0;
795
+ })
796
+ .map(([id, f]) => ({
797
+ id,
798
+ operator: f.operator,
799
+ value: f.value,
800
+ ...(f.operator === "between" && f.valueTo
801
+ ? { valueTo: f.valueTo }
802
+ : {}),
803
+ }));
804
+ const valueEntries = Object.entries(valueFilters).map(([id, allowed]) => ({
805
+ id,
806
+ operator: "equals",
807
+ value: "",
808
+ selectedValues: Array.from(allowed).sort(),
809
+ }));
810
+ const merged = new Map();
811
+ for (const entry of menuEntries)
812
+ merged.set(entry.id, entry);
813
+ for (const entry of valueEntries) {
814
+ const existing = merged.get(entry.id);
815
+ merged.set(entry.id, existing
816
+ ? { ...existing, selectedValues: entry.selectedValues }
817
+ : entry);
818
+ }
819
+ const payload = {
820
+ global: globalFilter,
821
+ columns: Array.from(merged.values()),
822
+ };
823
+ const serialized = JSON.stringify(payload);
824
+ if (serialized === lastFiltersSerialized)
825
+ return;
826
+ lastFiltersSerialized = serialized;
827
+ props.onFiltersChange(payload);
828
+ });
829
+ const virtualizer = createSvelteVirtualizer({
830
+ count: 0,
831
+ estimateSize: 36,
832
+ overscan: 8,
833
+ viewportHeight: 520,
834
+ scrollOffset: 0,
835
+ });
836
+ const columnVirtualizer = createColumnVirtualizer({
837
+ count: 0,
838
+ viewportWidth: 0,
839
+ overscan: 3,
840
+ estimateSize: () => 140,
841
+ });
842
+ columnVirtualizer.subscribe(() => {
843
+ columnVirtualizerVersion += 1;
844
+ });
845
+ const rowVirtualizationEnabled = $derived((props.virtualization ?? true) && allRows.length > 0);
846
+ const columnVirtualizationEnabled = $derived((props.columnVirtualization ?? true) && allColumns.length > 0);
847
+ const virtualRows = $derived.by(() => {
848
+ virtualizer.version;
849
+ return virtualizer.getVirtualItems();
850
+ });
851
+ const virtualRowTotalSize = $derived.by(() => {
852
+ virtualizer.version;
853
+ return virtualizer.getTotalSize();
854
+ });
855
+ const virtualRowStart = $derived.by(() => virtualRows[0]?.start ?? 0);
856
+ const virtualRowEnd = $derived.by(() => virtualRows[virtualRows.length - 1]?.end ?? 0);
857
+ const virtualRowBottomSpacer = $derived.by(() => Math.max(virtualRowTotalSize - virtualRowEnd, 0));
858
+ // --- Huge-list scroll scaling -----------------------------------------
859
+ // Browsers cap how tall a single element may be, and mobile caps sit well
860
+ // below desktop. Past a few hundred thousand rows the true content height
861
+ // (count * rowHeight) exceeds that cap, the scroll container silently
862
+ // clamps its scrollHeight, and the last rows become unreachable - e.g. a
863
+ // 1,000,000-row grid that only scrolls to ~994,000 on a phone.
864
+ //
865
+ // When the true height exceeds the browser's max element height we cap the
866
+ // DOM scroll height and map between the limited DOM scroll range and the
867
+ // full logical range (the "scaling" technique from react-virtualized): the
868
+ // spacers are sized in the capped DOM space, while the virtualizer keeps
869
+ // working in true logical pixels. We detect the real per-browser cap at
870
+ // runtime (Chrome ~33.5M, Firefox ~17.9M, mobile lower) rather than guess a
871
+ // constant, so scaling activates only when genuinely needed and stays as
872
+ // fine-grained as the browser allows. For normal-sized grids scaling is
873
+ // inert and every value below reduces to the original behavior.
874
+ // Build the scaling mapping from the current true height + detected browser
875
+ // cap + viewport. The pure, unit-tested math lives in
876
+ // ./virtualization/scroll-scaling; here we only feed it reactive inputs.
877
+ // Inert (identity) for normal-sized grids.
878
+ const rowScrollScaling = $derived(createRowScrollScaling(virtualRowTotalSize, getMaxDomScrollHeight(), viewportHeight));
879
+ const rowDomTotalSize = $derived(rowScrollScaling.domTotal);
880
+ const rowScrollScalingActive = $derived(rowScrollScaling.active);
881
+ // Map a DOM scrollTop to the virtualizer's logical scroll offset, and back.
882
+ function domToLogicalRowOffset(domTop) {
883
+ return rowScrollScaling.domToLogical(domTop);
884
+ }
885
+ function logicalToDomRowOffset(logical) {
886
+ return rowScrollScaling.logicalToDom(logical);
887
+ }
888
+ // px the logical row positions must shift to land inside the capped DOM
889
+ // coordinate space (0 when not scaling). Derived from the virtualizer's
890
+ // OWN committed scroll offset - not the live DOM scrollTop - so the spacer
891
+ // shift and the rendered window are always computed from the same state and
892
+ // can never skew by a frame (which would jitter at extreme scale).
893
+ const rowOffsetAdjustment = $derived.by(() => {
894
+ if (!rowScrollScalingActive)
895
+ return 0;
896
+ virtualizer.version;
897
+ const logical = virtualizer.getState().scrollOffset;
898
+ return logical - rowScrollScaling.logicalToDom(logical);
899
+ });
900
+ // Spacer heights in DOM space. With scaling inert these equal the original
901
+ // virtualRowStart / virtualRowBottomSpacer.
902
+ const rowTopSpacer = $derived(Math.max(virtualRowStart - rowOffsetAdjustment, 0));
903
+ const rowBottomSpacer = $derived(Math.max(rowDomTotalSize - (virtualRowEnd - rowOffsetAdjustment), 0));
904
+ const virtualColumns = $derived.by(() => {
905
+ columnVirtualizerVersion;
906
+ return columnVirtualizer.getVirtualItems();
907
+ });
908
+ const virtualColumnTotalSize = $derived.by(() => {
909
+ columnVirtualizerVersion;
910
+ return columnVirtualizer.getTotalSize();
911
+ });
912
+ const renderedColumnItems = $derived.by(() => {
913
+ if (columnVirtualizationEnabled)
914
+ return virtualColumns;
915
+ let start = 0;
916
+ return allColumns.map((column, index) => {
917
+ const size = getColumnWidth(column.id);
918
+ const item = { index, key: index, size, start, end: start + size };
919
+ start += size;
920
+ return item;
921
+ });
922
+ });
923
+ const renderedColumns = $derived.by(() => renderedColumnItems
924
+ .map((item) => ({ item, column: allColumns[item.index] }))
925
+ .filter(hasRenderedColumn));
926
+ const totalColumnWidth = $derived.by(() => {
927
+ if (columnVirtualizationEnabled)
928
+ return virtualColumnTotalSize;
929
+ let total = 0;
930
+ for (const column of allColumns)
931
+ total += getColumnWidth(column.id);
932
+ return total;
933
+ });
934
+ /** Horizontal overflow derived from the SOURCE OF TRUTH (column widths
935
+ * + leading sticky columns) compared to the viewport. We can't use
936
+ * `totalColumnWidth` here when column virtualization is on - that
937
+ * returns the column virtualizer's cached total, which only updates
938
+ * on `setOptions()` / scroll, NOT when `fittedColumnWidths` finishes
939
+ * scaling on first measure. Reading `getColumnWidth(c.id)` for every
940
+ * column instead is reactive to both `columnWidths` and
941
+ * `fittedColumnWidths`, so the overflow decision settles in the same
942
+ * render where fit-scaling lands - no race, no scrollbar flash. */
943
+ const hasHorizontalOverflow = $derived.by(() => {
944
+ const fixedCols = (showRowNumbersEffective ? rowNumberColumnWidth : 0) +
945
+ (showRowSelectionEffective ? selectionColumnWidth : 0);
946
+ let total = fixedCols;
947
+ for (const column of allColumns)
948
+ total += getColumnWidth(column.id);
949
+ // +1 to tolerate sub-pixel rounding residue from `fitColumns`.
950
+ return total > viewportWidth + 1;
951
+ });
952
+ const columnWindowStart = $derived.by(() => renderedColumnItems[0]?.start ?? 0);
953
+ const columnWindowEnd = $derived.by(() => renderedColumnItems[renderedColumnItems.length - 1]?.end ?? 0);
954
+ const columnWindowRightSpacer = $derived.by(() => Math.max(totalColumnWidth - columnWindowEnd, 0));
955
+ const activeCell = $derived.by(() => {
956
+ gridStateVersion;
957
+ return (grid.getState().activeCell ?? { rowIndex: 0, colIndex: 0, cellId: null });
958
+ });
959
+ const activeDescendantId = $derived.by(() => {
960
+ const active = activeCell;
961
+ const inRows = active.rowIndex >= 0 && active.rowIndex < allRows.length;
962
+ const inCols = active.colIndex >= 0 && active.colIndex < allColumns.length;
963
+ if (!inRows || !inCols)
964
+ return null;
965
+ return getGridCellDomId("svgrid", active.rowIndex, active.colIndex);
966
+ });
967
+ // Above this many cells (rows x columns) the summary aggregation is
968
+ // deferred one animation frame so it never blocks first paint - a
969
+ // 100k x 50 grid would otherwise spend seconds summing reactive cells
970
+ // before the grid ever appears. Smaller grids compute inline so the
971
+ // footer is correct on the first frame (no flicker).
972
+ const SUMMARY_DEFER_CELL_LIMIT = 50000;
973
+ let summaryByColumn = $state({});
974
+ $effect(() => {
975
+ // Re-aggregate whenever the visible data, columns, edits, or any
976
+ // state that reorders/filters rows changes.
977
+ gridStateVersion;
978
+ void editedCellValues;
979
+ const rows = allRows;
980
+ const columns = allColumns;
981
+ if (!(props.enableRowSummaries ?? true)) {
982
+ summaryByColumn = {};
983
+ return;
984
+ }
985
+ if (rows.length * columns.length <= SUMMARY_DEFER_CELL_LIMIT ||
986
+ typeof requestAnimationFrame === "undefined") {
987
+ summaryByColumn = computeSummaries(rows, columns);
988
+ return;
989
+ }
990
+ // Large grid: paint first, total a frame later.
991
+ let cancelled = false;
992
+ const handle = requestAnimationFrame(() => {
993
+ if (!cancelled)
994
+ summaryByColumn = computeSummaries(rows, columns);
995
+ });
996
+ return () => {
997
+ cancelled = true;
998
+ cancelAnimationFrame(handle);
999
+ };
1000
+ });
1001
+ $effect(() => {
1002
+ if (!theadEl)
1003
+ return;
1004
+ headerHeight = theadEl.offsetHeight;
1005
+ const observer = new ResizeObserver(() => {
1006
+ headerHeight = theadEl?.offsetHeight ?? 0;
1007
+ });
1008
+ observer.observe(theadEl);
1009
+ return () => observer.disconnect();
1010
+ });
1011
+ // Bump scrollVersion when the table's layout size changes so scrollbar
1012
+ // visibility (and the thumb math that depends on scroll metrics) updates
1013
+ // after column resize / show-hide / add-remove.
1014
+ $effect(() => {
1015
+ if (!gridRootEl)
1016
+ return;
1017
+ const observer = new ResizeObserver(() => {
1018
+ scrollVersion += 1;
1019
+ });
1020
+ observer.observe(gridRootEl);
1021
+ return () => observer.disconnect();
1022
+ });
1023
+ $effect(() => {
1024
+ if (!allRows.length || !allColumns.length)
1025
+ return;
1026
+ const active = grid.getState().activeCell;
1027
+ if (active?.cellId)
1028
+ return;
1029
+ grid.setActiveCell({
1030
+ rowIndex: 0,
1031
+ colIndex: 0,
1032
+ cellId: getGridCellDomId("svgrid", 0, 0),
1033
+ });
1034
+ });
1035
+ $effect(() => {
1036
+ // Only reset scroll + selection + editing when the COLUMN SCHEMA
1037
+ // changes. Data length is too weak a signal:
1038
+ // - Streaming inserts grow the length and shouldn't move scroll.
1039
+ // - Filter / delete events shrink the length and shouldn't either
1040
+ // (the user's spot in the data is what they care about).
1041
+ // - Sort changes preserve length but mean "start from the top",
1042
+ // so callers who want that should drive it explicitly via
1043
+ // api.scrollToTop() (or the equivalent).
1044
+ // The columns ARE a schema change: existing scroll/selection
1045
+ // coordinates are no longer meaningful when the grid's column set
1046
+ // is replaced, so we still reset there.
1047
+ const colCount = props.columns.length;
1048
+ const nextSignature = `cols:${colCount}`;
1049
+ if (nextSignature === lastResetSignature)
1050
+ return;
1051
+ const isFirstRender = lastResetSignature === "";
1052
+ lastResetSignature = nextSignature;
1053
+ if (isFirstRender)
1054
+ return;
1055
+ selectionRange = { anchor: null, focus: null };
1056
+ editingCell = null;
1057
+ if (scrollContainer) {
1058
+ scrollContainer.scrollTop = 0;
1059
+ scrollContainer.scrollLeft = 0;
1060
+ scrollVersion += 1;
1061
+ }
1062
+ virtualizer.setScrollOffset(0);
1063
+ columnVirtualizer.setHorizontalOffset(0);
1064
+ });
1065
+ // Wire scroll-change listeners SEPARATELY for each scrollbar - bundling
1066
+ // them in one effect with `if (!vertical || !horizontal) return` was
1067
+ // the bug behind "vertical scrollbar can't be dragged": with overflow
1068
+ // gating, demos without horizontal overflow never mount the horizontal
1069
+ // scrollbar, the combined guard tripped, and the vertical listener
1070
+ // never got attached either. Each scrollbar is now independent.
1071
+ $effect(() => {
1072
+ if (!scrollContainer || !verticalScrollbarEl)
1073
+ return;
1074
+ const el = verticalScrollbarEl;
1075
+ const onVertical = (event) => {
1076
+ const container = scrollContainer;
1077
+ if (!container)
1078
+ return;
1079
+ const customEvent = event;
1080
+ container.scrollTop = customEvent.detail.value;
1081
+ scheduleScrollSync(container.scrollTop, container.scrollLeft);
1082
+ };
1083
+ el.addEventListener("scroll-change", onVertical);
1084
+ return () => el.removeEventListener("scroll-change", onVertical);
1085
+ });
1086
+ $effect(() => {
1087
+ if (!scrollContainer || !horizontalScrollbarEl)
1088
+ return;
1089
+ const el = horizontalScrollbarEl;
1090
+ const onHorizontal = (event) => {
1091
+ const container = scrollContainer;
1092
+ if (!container)
1093
+ return;
1094
+ const customEvent = event;
1095
+ container.scrollLeft = customEvent.detail.value;
1096
+ scheduleScrollSync(container.scrollTop, container.scrollLeft);
1097
+ };
1098
+ el.addEventListener("scroll-change", onHorizontal);
1099
+ return () => el.removeEventListener("scroll-change", onHorizontal);
1100
+ });
1101
+ $effect(() => {
1102
+ // When containerHeight is a string (e.g. "100%") the actual pixel height
1103
+ // depends on the parent layout - read it from the live scroll container.
1104
+ // We track `viewportVersion` (only bumped by the ResizeObserver below)
1105
+ // instead of `scrollVersion` so this effect does NOT re-run on every
1106
+ // scroll event - which would otherwise re-call setOptions hundreds of
1107
+ // times during a drag.
1108
+ viewportVersion;
1109
+ const viewportHeight = typeof props.containerHeight === "string"
1110
+ ? (scrollContainer?.clientHeight ?? 520)
1111
+ : (props.containerHeight ?? 520);
1112
+ const rh = props.rowHeight;
1113
+ virtualizer.setOptions({
1114
+ count: allRows.length,
1115
+ estimateSize: typeof rh === "function" ? rh : (rh ?? 30),
1116
+ overscan: props.overscan ?? 8,
1117
+ viewportHeight,
1118
+ });
1119
+ });
1120
+ // Track size changes of the shell so the virtualizer's viewport, the
1121
+ // fit-columns scale, and anything else that depends on the container
1122
+ // width/height stays in sync. Always attached (window resize / parent
1123
+ // layout shift / sidebar collapse can change the size whether the
1124
+ // consumer passed a numeric or "100%" containerHeight).
1125
+ /** True after the first ResizeObserver tick - i.e. once the grid has
1126
+ * measured its real container size and `fitColumns` has had a chance
1127
+ * to scale the columns to that width. Used to gate the scrollbar
1128
+ * visibility: rendering it before this flips paints a horizontal
1129
+ * scrollbar for ONE frame (based on the base column widths summing
1130
+ * larger than the viewport), then immediately hides it once fit
1131
+ * scaling kicks in - visible as a "flashing horizontal scrollbar"
1132
+ * every time a demo first loads. */
1133
+ let hasMeasured = $state(false);
1134
+ $effect(() => {
1135
+ if (!scrollContainer)
1136
+ return;
1137
+ const observer = new ResizeObserver(() => {
1138
+ viewportVersion += 1;
1139
+ if (!hasMeasured)
1140
+ hasMeasured = true;
1141
+ });
1142
+ observer.observe(scrollContainer);
1143
+ return () => observer.disconnect();
1144
+ });
1145
+ $effect(() => {
1146
+ // Reading columnWidths here registers it as a reactive dependency so
1147
+ // the effect re-runs when the user resizes a column. We pass a fresh
1148
+ // closure each run; the virtualizer sees a new function reference and
1149
+ // re-derives its layout from the current per-column widths.
1150
+ columnWidths;
1151
+ columnVirtualizer.setOptions({
1152
+ count: allColumns.length,
1153
+ estimateSize: (index) => {
1154
+ const column = allColumns[index];
1155
+ return column ? getColumnWidth(column.id) : (props.columnWidth ?? 140);
1156
+ },
1157
+ overscan: props.columnOverscan ?? 3,
1158
+ viewportHeight: viewportWidth,
1159
+ });
1160
+ });
1161
+ $effect(() => {
1162
+ if (!scrollContainer)
1163
+ return;
1164
+ if (rowVirtualizationEnabled)
1165
+ virtualizer.setScrollOffset(domToLogicalRowOffset(scrollContainer.scrollTop));
1166
+ if (columnVirtualizationEnabled)
1167
+ columnVirtualizer.setHorizontalOffset(scrollContainer.scrollLeft);
1168
+ });
1169
+ // Re-arms once the user scrolls away from the bottom, so a long lazy-load
1170
+ // run only fires `onScrollBottomReached` once per arrival at the end.
1171
+ let scrollBottomArmed = true;
1172
+ /** Cached normalized options keyed by columnId - only used when the column
1173
+ * has a static (non-function) `editorOptions`. Dynamic (per-row) options
1174
+ * are resolved on every call because they can change as other cells in
1175
+ * the same row change (the whole point of cascading editors). */
1176
+ const editorOptionsCache = {};
1177
+ const headerSelectionState = $derived.by(() => {
1178
+ gridStateVersion;
1179
+ const selectable = allRows.filter((row) => !isGroupRow(row));
1180
+ if (!selectable.length)
1181
+ return "none";
1182
+ let selected = 0;
1183
+ for (const row of selectable)
1184
+ if (rowSelectionState[row.id])
1185
+ selected += 1;
1186
+ if (selected === 0)
1187
+ return "none";
1188
+ return selected === selectable.length ? "all" : "some";
1189
+ });
1190
+ /** True once a real interaction (click, keyboard nav, or a public-API
1191
+ * call) has activated a cell. Distinct from `activeCell.cellId`, which
1192
+ * the on-mount seed effect populates straight on the grid state without
1193
+ * going through `setActiveCell` - so it can't tell a seeded (0,0) apart
1194
+ * from a user-focused (0,0). The fill handle keys off this flag so it
1195
+ * stays hidden until the user actually selects something. */
1196
+ let userHasActivatedCell = $state(false);
1197
+ /**
1198
+ * Per-column fitted widths when `fitColumns` is on. Computed in one pass
1199
+ * so the LAST auto-sized column can absorb the rounding residue and make
1200
+ * the total match the target viewport width exactly. Without this the
1201
+ * per-column `Math.round` calls leave a 2-6 px residue and the user sees
1202
+ * a small horizontal scrollbar even though every column is "fitted".
1203
+ *
1204
+ * User-resized columns (entries in `columnWidths`) are taken at face
1205
+ * value and only the auto-sized columns share the scale + residue.
1206
+ *
1207
+ * Returns `null` when fit scaling is not in effect (off, no room, total
1208
+ * already >= target). Callers then fall back to the base width.
1209
+ */
1210
+ const fittedColumnWidths = $derived.by(() => {
1211
+ // Track viewport size (not scrollVersion) so we don't recompute on
1212
+ // every scroll - only when the container actually resizes.
1213
+ viewportVersion;
1214
+ if (!props.fitColumns)
1215
+ return null;
1216
+ const cols = grid.getAllColumns().filter((c) => !hiddenColumns[c.id]);
1217
+ if (!cols.length)
1218
+ return null;
1219
+ const rowNumberWidth = showRowNumbersEffective ? rowNumberColumnWidth : 0;
1220
+ const selectionWidth = showRowSelectionEffective ? selectionColumnWidth : 0;
1221
+ const target = (scrollContainer?.clientWidth ?? 0) - rowNumberWidth - selectionWidth;
1222
+ if (target <= 0)
1223
+ return null;
1224
+ // Split base widths into pinned (user-resized) and scalable.
1225
+ let pinnedTotal = 0;
1226
+ let scalableBase = 0;
1227
+ const scalableIds = [];
1228
+ for (const c of cols) {
1229
+ const w = getColumnBaseWidth(c.id);
1230
+ if (columnWidths[c.id] !== undefined)
1231
+ pinnedTotal += w;
1232
+ else {
1233
+ scalableBase += w;
1234
+ scalableIds.push(c.id);
1235
+ }
1236
+ }
1237
+ const scalableTarget = target - pinnedTotal;
1238
+ if (scalableTarget <= 0 || scalableBase <= 0)
1239
+ return null;
1240
+ // Within 1px of target - no scaling needed.
1241
+ if (Math.abs(scalableBase - scalableTarget) <= 1)
1242
+ return null;
1243
+ // Shrink only by a modest amount (≥85% of natural). Beyond that, leave
1244
+ // natural widths and let the user scroll - squashing every column
1245
+ // tighter would hide content.
1246
+ const scale = scalableTarget / scalableBase;
1247
+ if (scale < 0.85)
1248
+ return null;
1249
+ const widths = {};
1250
+ let runningSum = 0;
1251
+ for (let i = 0; i < scalableIds.length - 1; i += 1) {
1252
+ const id = scalableIds[i];
1253
+ const w = Math.max(MIN_COLUMN_WIDTH, Math.round(getColumnBaseWidth(id) * scale));
1254
+ widths[id] = w;
1255
+ runningSum += w;
1256
+ }
1257
+ // The last scalable column absorbs whatever the previous rounding left
1258
+ // behind, so `sum(widths) === scalableTarget` exactly.
1259
+ const lastId = scalableIds[scalableIds.length - 1];
1260
+ widths[lastId] = Math.max(MIN_COLUMN_WIDTH, scalableTarget - runningSum);
1261
+ return widths;
1262
+ });
1263
+ let resizePendingWidth = 0;
1264
+ let resizeRaf = null;
1265
+ /** Where the fill handle should render: the bottom-right cell of the
1266
+ * selection range (or the active cell if there's no range). Returns
1267
+ * null when cell selection is off or there is no anchored selection. */
1268
+ const fillHandleCell = $derived.by(() => {
1269
+ if (!(props.enableCellSelection ?? false))
1270
+ return null;
1271
+ const anchor = selectionRange.anchor;
1272
+ const focus = selectionRange.focus;
1273
+ if (anchor && focus) {
1274
+ return {
1275
+ rowIndex: Math.max(anchor.rowIndex, focus.rowIndex),
1276
+ colIndex: Math.max(anchor.colIndex, focus.colIndex),
1277
+ };
1278
+ }
1279
+ const a = activeCell;
1280
+ // Only show the handle once the user (or the public API) has actually
1281
+ // activated a cell. The on-mount seed writes activeCell (0,0) directly
1282
+ // to the grid state, so `cellId` alone can't gate this - see
1283
+ // `userHasActivatedCell`.
1284
+ if (!userHasActivatedCell || !a)
1285
+ return null;
1286
+ return { rowIndex: a.rowIndex, colIndex: a.colIndex };
1287
+ });
1288
+ /**
1289
+ * Lazily-created canvas used to measure text width via the 2D context.
1290
+ * Canvas measurement bypasses the cell's `overflow: hidden; white-space:
1291
+ * nowrap` constraint, which makes the body's `scrollWidth` useless here.
1292
+ */
1293
+ let measureCanvas = null;
1294
+ /**
1295
+ * Range buckets for the value-facet list.
1296
+ *
1297
+ * Numeric and date columns with many distinct values would otherwise
1298
+ * paint thousands of single-value checkboxes in the filter menu -
1299
+ * unusable. When a column's `editorType` is `'number' | 'date' |
1300
+ * 'datetime'` AND it has more than BUCKET_THRESHOLD distinct values,
1301
+ * we collapse the facet list into BUCKET_COUNT equal-width ranges
1302
+ * (e.g. "1,000 - 1,500") and let the user check those.
1303
+ *
1304
+ * The bucket structure carries the numeric bounds so the row filter
1305
+ * can re-test each row's value against the selected ranges without
1306
+ * re-doing the bucket math.
1307
+ */
1308
+ /** Buckets for every column that should be bucketed, computed once and
1309
+ * reused by both the facet UI and the row filter. Computing them lazily
1310
+ * in a $derived means columns with no filter menu open and no active
1311
+ * filter never pay the iteration cost. */
1312
+ const facetBucketsByColumn = $derived.by(() => {
1313
+ const map = new Map();
1314
+ for (const column of allColumns) {
1315
+ const meta = isBucketableColumn(column);
1316
+ if (!meta)
1317
+ continue;
1318
+ const buckets = buildBuckets(column, meta.isDate, props.data, getColumnAccessorValue);
1319
+ if (buckets)
1320
+ map.set(column.id, buckets);
1321
+ }
1322
+ return map;
1323
+ });
1324
+ const columnMenuFacetValues = $derived.by(() => {
1325
+ const columnId = filterMenuFor;
1326
+ if (!columnId)
1327
+ return [];
1328
+ const column = allColumns.find((entry) => entry.id === columnId);
1329
+ if (!column)
1330
+ return [];
1331
+ // Range-bucketed facets for numeric / date columns with many values.
1332
+ const buckets = facetBucketsByColumn.get(columnId);
1333
+ if (buckets)
1334
+ return buckets.map((b) => b.label);
1335
+ // Default: distinct-value facets.
1336
+ const seen = new Set();
1337
+ for (const rowData of props.data) {
1338
+ seen.add(String(getColumnAccessorValue(rowData, column) ?? ""));
1339
+ }
1340
+ return Array.from(seen).sort((a, b) => a.localeCompare(b, undefined, { numeric: true }));
1341
+ });
1342
+ const columnMenuVisibleFacets = $derived.by(() => {
1343
+ const query = columnMenuSearch.trim().toLowerCase();
1344
+ if (!query)
1345
+ return columnMenuFacetValues;
1346
+ return columnMenuFacetValues.filter((value) => value.toLowerCase().includes(query));
1347
+ });
1348
+ // Fire onApiReady exactly once when the grid is first ready. Wrapping in
1349
+ // an effect that tracks `props.onApiReady` was racy - every parent render
1350
+ // creates a new inline arrow, the effect re-fired, and any synchronous
1351
+ // state mutation inside the callback (e.g. `api.setGroupBy(...)`) created
1352
+ // an infinite update loop. Now it's a true mount-once notification.
1353
+ let apiNotified = false;
1354
+ $effect(() => {
1355
+ if (apiNotified)
1356
+ return;
1357
+ const cb = props.onApiReady;
1358
+ if (!cb)
1359
+ return;
1360
+ apiNotified = true;
1361
+ cb(buildApi());
1362
+ });
1363
+ const ctx = {
1364
+ get props() { return props; },
1365
+ get editingEnabled() { return editingEnabled; },
1366
+ get paginationEnabled() { return paginationEnabled; },
1367
+ get groupingControlsEnabled() { return groupingControlsEnabled; },
1368
+ get globalFilter() { return globalFilter; },
1369
+ set globalFilter(v) { globalFilter = v; },
1370
+ get scrollContainer() { return scrollContainer; },
1371
+ set scrollContainer(v) { scrollContainer = v; },
1372
+ get gridRootEl() { return gridRootEl; },
1373
+ set gridRootEl(v) { gridRootEl = v; },
1374
+ get filterRowValues() { return filterRowValues; },
1375
+ set filterRowValues(v) { filterRowValues = v; },
1376
+ get filterMenuValues() { return filterMenuValues; },
1377
+ set filterMenuValues(v) { filterMenuValues = v; },
1378
+ get verticalScrollbarEl() { return verticalScrollbarEl; },
1379
+ set verticalScrollbarEl(v) { verticalScrollbarEl = v; },
1380
+ get horizontalScrollbarEl() { return horizontalScrollbarEl; },
1381
+ set horizontalScrollbarEl(v) { horizontalScrollbarEl = v; },
1382
+ get scrollVersion() { return scrollVersion; },
1383
+ set scrollVersion(v) { scrollVersion = v; },
1384
+ get viewportVersion() { return viewportVersion; },
1385
+ set viewportVersion(v) { viewportVersion = v; },
1386
+ get lastResetSignature() { return lastResetSignature; },
1387
+ set lastResetSignature(v) { lastResetSignature = v; },
1388
+ get pendingScrollTop() { return pendingScrollTop; },
1389
+ set pendingScrollTop(v) { pendingScrollTop = v; },
1390
+ get pendingScrollLeft() { return pendingScrollLeft; },
1391
+ set pendingScrollLeft(v) { pendingScrollLeft = v; },
1392
+ get scrollSyncRaf() { return scrollSyncRaf; },
1393
+ set scrollSyncRaf(v) { scrollSyncRaf = v; },
1394
+ get selectionRange() { return selectionRange; },
1395
+ set selectionRange(v) { selectionRange = v; },
1396
+ get isDraggingSelection() { return isDraggingSelection; },
1397
+ set isDraggingSelection(v) { isDraggingSelection = v; },
1398
+ get fillDrag() { return fillDrag; },
1399
+ set fillDrag(v) { fillDrag = v; },
1400
+ get activeAtPointerDown() { return activeAtPointerDown; },
1401
+ set activeAtPointerDown(v) { activeAtPointerDown = v; },
1402
+ get editingCell() { return editingCell; },
1403
+ set editingCell(v) { editingCell = v; },
1404
+ get editedCellValues() { return editedCellValues; },
1405
+ set editedCellValues(v) { editedCellValues = v; },
1406
+ get UNDO_LIMIT() { return UNDO_LIMIT; },
1407
+ get history() { return history; },
1408
+ set history(v) { history = v; },
1409
+ get historyPtr() { return historyPtr; },
1410
+ set historyPtr(v) { historyPtr = v; },
1411
+ get historyVersion() { return historyVersion; },
1412
+ set historyVersion(v) { historyVersion = v; },
1413
+ get tooltip() { return tooltip; },
1414
+ set tooltip(v) { tooltip = v; },
1415
+ get tooltipTimer() { return tooltipTimer; },
1416
+ set tooltipTimer(v) { tooltipTimer = v; },
1417
+ get showTooltipFor() { return showTooltipFor; },
1418
+ get hideTooltip() { return hideTooltip; },
1419
+ get findOpen() { return findOpen; },
1420
+ set findOpen(v) { findOpen = v; },
1421
+ get findQuery() { return findQuery; },
1422
+ set findQuery(v) { findQuery = v; },
1423
+ get findHitIndex() { return findHitIndex; },
1424
+ set findHitIndex(v) { findHitIndex = v; },
1425
+ get findHits() { return findHits; },
1426
+ get theadEl() { return theadEl; },
1427
+ set theadEl(v) { theadEl = v; },
1428
+ get headerHeight() { return headerHeight; },
1429
+ set headerHeight(v) { headerHeight = v; },
1430
+ get editorSelectAll() { return editorSelectAll; },
1431
+ set editorSelectAll(v) { editorSelectAll = v; },
1432
+ get columnWidths() { return columnWidths; },
1433
+ set columnWidths(v) { columnWidths = v; },
1434
+ get resizingColumnId() { return resizingColumnId; },
1435
+ set resizingColumnId(v) { resizingColumnId = v; },
1436
+ get resizeStartX() { return resizeStartX; },
1437
+ set resizeStartX(v) { resizeStartX = v; },
1438
+ get resizeStartWidth() { return resizeStartWidth; },
1439
+ set resizeStartWidth(v) { resizeStartWidth = v; },
1440
+ get MIN_COLUMN_WIDTH() { return MIN_COLUMN_WIDTH; },
1441
+ get columnPinning() { return columnPinning; },
1442
+ set columnPinning(v) { columnPinning = v; },
1443
+ get columnVirtualizerVersion() { return columnVirtualizerVersion; },
1444
+ set columnVirtualizerVersion(v) { columnVirtualizerVersion = v; },
1445
+ get gridStateVersion() { return gridStateVersion; },
1446
+ set gridStateVersion(v) { gridStateVersion = v; },
1447
+ get selectionColumnWidth() { return selectionColumnWidth; },
1448
+ get rowNumberColumnWidth() { return rowNumberColumnWidth; },
1449
+ get showRowNumbersEffective() { return showRowNumbersEffective; },
1450
+ get filterOperatorOptions() { return filterOperatorOptions; },
1451
+ get TEXT_OPERATORS() { return TEXT_OPERATORS; },
1452
+ get NUMBER_OPERATORS() { return NUMBER_OPERATORS; },
1453
+ get DATE_OPERATORS() { return DATE_OPERATORS; },
1454
+ get CHECKBOX_OPERATORS() { return CHECKBOX_OPERATORS; },
1455
+ get columnMenuFor() { return columnMenuFor; },
1456
+ set columnMenuFor(v) { columnMenuFor = v; },
1457
+ get columnMenuPos() { return columnMenuPos; },
1458
+ set columnMenuPos(v) { columnMenuPos = v; },
1459
+ get columnMenuSearch() { return columnMenuSearch; },
1460
+ set columnMenuSearch(v) { columnMenuSearch = v; },
1461
+ get filterMenuFor() { return filterMenuFor; },
1462
+ set filterMenuFor(v) { filterMenuFor = v; },
1463
+ get filterMenuPos() { return filterMenuPos; },
1464
+ set filterMenuPos(v) { filterMenuPos = v; },
1465
+ get operatorMenuFor() { return operatorMenuFor; },
1466
+ set operatorMenuFor(v) { operatorMenuFor = v; },
1467
+ get operatorMenuPos() { return operatorMenuPos; },
1468
+ set operatorMenuPos(v) { operatorMenuPos = v; },
1469
+ get chooseColumnsPos() { return chooseColumnsPos; },
1470
+ set chooseColumnsPos(v) { chooseColumnsPos = v; },
1471
+ get contextMenuFor() { return contextMenuFor; },
1472
+ set contextMenuFor(v) { contextMenuFor = v; },
1473
+ get contextMenuPos() { return contextMenuPos; },
1474
+ set contextMenuPos(v) { contextMenuPos = v; },
1475
+ get noteOverrides() { return noteOverrides; },
1476
+ set noteOverrides(v) { noteOverrides = v; },
1477
+ get commentEditFor() { return commentEditFor; },
1478
+ set commentEditFor(v) { commentEditFor = v; },
1479
+ get commentDraft() { return commentDraft; },
1480
+ set commentDraft(v) { commentDraft = v; },
1481
+ get valueFilters() { return valueFilters; },
1482
+ set valueFilters(v) { valueFilters = v; },
1483
+ get viewportWidth() { return viewportWidth; },
1484
+ get viewportHeight() { return viewportHeight; },
1485
+ get scrollMetrics() { return scrollMetrics; },
1486
+ get hasVerticalOverflow() { return hasVerticalOverflow; },
1487
+ get showGlobalFilterEffective() { return showGlobalFilterEffective; },
1488
+ get showFilterRowEffective() { return showFilterRowEffective; },
1489
+ get showColumnFiltersEffective() { return showColumnFiltersEffective; },
1490
+ get showInlineColumnFilterEffective() { return showInlineColumnFilterEffective; },
1491
+ get showRowSelectionEffective() { return showRowSelectionEffective; },
1492
+ get enableCellSelectionEffective() { return enableCellSelectionEffective; },
1493
+ get flushScheduledScrollSync() { return flushScheduledScrollSync; },
1494
+ get scheduleScrollSync() { return scheduleScrollSync; },
1495
+ get internalData() { return internalData; },
1496
+ set internalData(v) { internalData = v; },
1497
+ get internalColumns() { return internalColumns; },
1498
+ set internalColumns(v) { internalColumns = v; },
1499
+ get hiddenColumns() { return hiddenColumns; },
1500
+ set hiddenColumns(v) { hiddenColumns = v; },
1501
+ get externalSortEnabled() { return externalSortEnabled; },
1502
+ get externalFilterEnabled() { return externalFilterEnabled; },
1503
+ get passthroughSortedRowModel() { return passthroughSortedRowModel; },
1504
+ get resolveEffectiveFeatures() { return resolveEffectiveFeatures; },
1505
+ get grid() { return grid; },
1506
+ get userColumnOrder() { return userColumnOrder; },
1507
+ set userColumnOrder(v) { userColumnOrder = v; },
1508
+ get lastSeededOrder() { return lastSeededOrder; },
1509
+ set lastSeededOrder(v) { lastSeededOrder = v; },
1510
+ get allColumns() { return allColumns; },
1511
+ get headerGroups() { return headerGroups; },
1512
+ get groupHeaderRows() { return groupHeaderRows; },
1513
+ get pinnedOffsets() { return pinnedOffsets; },
1514
+ get cellPinStyle() { return cellPinStyle; },
1515
+ get isColumnPinned() { return isColumnPinned; },
1516
+ get colDragId() { return colDragId; },
1517
+ set colDragId(v) { colDragId = v; },
1518
+ get colDropOnId() { return colDropOnId; },
1519
+ set colDropOnId(v) { colDropOnId = v; },
1520
+ get colDropSide() { return colDropSide; },
1521
+ set colDropSide(v) { colDropSide = v; },
1522
+ get getCurrentColumnOrder() { return getCurrentColumnOrder; },
1523
+ get emitColumnOrder() { return emitColumnOrder; },
1524
+ get setColumnOrderInternal() { return setColumnOrderInternal; },
1525
+ get applyColumnDrop() { return applyColumnDrop; },
1526
+ get onColumnHeaderDragStart() { return onColumnHeaderDragStart; },
1527
+ get onColumnHeaderDragOver() { return onColumnHeaderDragOver; },
1528
+ get onColumnHeaderDragLeave() { return onColumnHeaderDragLeave; },
1529
+ get onColumnHeaderDrop() { return onColumnHeaderDrop; },
1530
+ get onColumnHeaderDragEnd() { return onColumnHeaderDragEnd; },
1531
+ get pinColumnLeft() { return pinColumnLeft; },
1532
+ get pinColumnRight() { return pinColumnRight; },
1533
+ get unpinColumn() { return unpinColumn; },
1534
+ get getColumnBaseValue() { return getColumnBaseValue; },
1535
+ get hasConditionalFormats() { return hasConditionalFormats; },
1536
+ get conditionalColumnStats() { return conditionalColumnStats; },
1537
+ get cellConditionalFormat() { return cellConditionalFormat; },
1538
+ get isGroupRow() { return isGroupRow; },
1539
+ get isCellEditable() { return isCellEditable; },
1540
+ get isCellEditableAt() { return isCellEditableAt; },
1541
+ get sortDirectionByColumn() { return sortDirectionByColumn; },
1542
+ get groupingColumns() { return groupingColumns; },
1543
+ get paginationState() { return paginationState; },
1544
+ get getRowColumnValue() { return getRowColumnValue; },
1545
+ get allRowsBeforePagination() { return allRowsBeforePagination; },
1546
+ get allRows() { return allRows; },
1547
+ get rowSelectionState() { return rowSelectionState; },
1548
+ get lastSelectionSerialized() { return lastSelectionSerialized; },
1549
+ set lastSelectionSerialized(v) { lastSelectionSerialized = v; },
1550
+ get lastCellRangeSerialized() { return lastCellRangeSerialized; },
1551
+ set lastCellRangeSerialized(v) { lastCellRangeSerialized = v; },
1552
+ get statusBarEnabled() { return statusBarEnabled; },
1553
+ get statusBarAggregates() { return statusBarAggregates; },
1554
+ get statusBarStats() { return statusBarStats; },
1555
+ get toolPanelOpen() { return toolPanelOpen; },
1556
+ set toolPanelOpen(v) { toolPanelOpen = v; },
1557
+ get toolPanelEnabled() { return toolPanelEnabled; },
1558
+ get toolPanelColumns() { return toolPanelColumns; },
1559
+ get toolPanelHeaderLabel() { return toolPanelHeaderLabel; },
1560
+ get toggleColumnVisibleInPanel() { return toggleColumnVisibleInPanel; },
1561
+ get moveColumnInPanel() { return moveColumnInPanel; },
1562
+ get toggleGroupInPanel() { return toggleGroupInPanel; },
1563
+ get lastSortingSerialized() { return lastSortingSerialized; },
1564
+ set lastSortingSerialized(v) { lastSortingSerialized = v; },
1565
+ get lastFiltersSerialized() { return lastFiltersSerialized; },
1566
+ set lastFiltersSerialized(v) { lastFiltersSerialized = v; },
1567
+ get virtualizer() { return virtualizer; },
1568
+ get columnVirtualizer() { return columnVirtualizer; },
1569
+ get rowVirtualizationEnabled() { return rowVirtualizationEnabled; },
1570
+ get columnVirtualizationEnabled() { return columnVirtualizationEnabled; },
1571
+ get virtualRows() { return virtualRows; },
1572
+ get virtualRowTotalSize() { return virtualRowTotalSize; },
1573
+ get virtualRowStart() { return virtualRowStart; },
1574
+ get virtualRowEnd() { return virtualRowEnd; },
1575
+ get virtualRowBottomSpacer() { return virtualRowBottomSpacer; },
1576
+ get rowDomTotalSize() { return rowDomTotalSize; },
1577
+ get rowScrollScalingActive() { return rowScrollScalingActive; },
1578
+ get rowTopSpacer() { return rowTopSpacer; },
1579
+ get rowBottomSpacer() { return rowBottomSpacer; },
1580
+ get domToLogicalRowOffset() { return domToLogicalRowOffset; },
1581
+ get logicalToDomRowOffset() { return logicalToDomRowOffset; },
1582
+ get virtualColumns() { return virtualColumns; },
1583
+ get virtualColumnTotalSize() { return virtualColumnTotalSize; },
1584
+ get renderedColumnItems() { return renderedColumnItems; },
1585
+ get hasRenderedColumn() { return hasRenderedColumn; },
1586
+ get renderedColumns() { return renderedColumns; },
1587
+ get totalColumnWidth() { return totalColumnWidth; },
1588
+ get hasHorizontalOverflow() { return hasHorizontalOverflow; },
1589
+ get columnWindowStart() { return columnWindowStart; },
1590
+ get columnWindowEnd() { return columnWindowEnd; },
1591
+ get columnWindowRightSpacer() { return columnWindowRightSpacer; },
1592
+ get activeCell() { return activeCell; },
1593
+ get activeDescendantId() { return activeDescendantId; },
1594
+ get formatSummaryNumeric() { return formatSummaryNumeric; },
1595
+ get computeSummaries() { return computeSummaries; },
1596
+ get SUMMARY_DEFER_CELL_LIMIT() { return SUMMARY_DEFER_CELL_LIMIT; },
1597
+ get summaryByColumn() { return summaryByColumn; },
1598
+ set summaryByColumn(v) { summaryByColumn = v; },
1599
+ get hasMeasured() { return hasMeasured; },
1600
+ set hasMeasured(v) { hasMeasured = v; },
1601
+ get scrollBottomArmed() { return scrollBottomArmed; },
1602
+ set scrollBottomArmed(v) { scrollBottomArmed = v; },
1603
+ get onBodyScroll() { return onBodyScroll; },
1604
+ get computeRowClass() { return computeRowClass; },
1605
+ get computeCellClass() { return computeCellClass; },
1606
+ get computeCellTooltip() { return computeCellTooltip; },
1607
+ get computeCellNote() { return computeCellNote; },
1608
+ get getCellDisplayValue() { return getCellDisplayValue; },
1609
+ get getColumnAlign() { return getColumnAlign; },
1610
+ get editorOptionsCache() { return editorOptionsCache; },
1611
+ get getColumnEditorOptions() { return getColumnEditorOptions; },
1612
+ get formatListCellValue() { return formatListCellValue; },
1613
+ get formatCellValue() { return formatCellValue; },
1614
+ get getPinnedCellValue() { return getPinnedCellValue; },
1615
+ get formatPinnedValue() { return formatPinnedValue; },
1616
+ get computePinnedCellClass() { return computePinnedCellClass; },
1617
+ get isRowSelected() { return isRowSelected; },
1618
+ get toggleRowSelectionById() { return toggleRowSelectionById; },
1619
+ get headerSelectionState() { return headerSelectionState; },
1620
+ get toggleSelectAllRows() { return toggleSelectAllRows; },
1621
+ get userHasActivatedCell() { return userHasActivatedCell; },
1622
+ set userHasActivatedCell(v) { userHasActivatedCell = v; },
1623
+ get setActiveCell() { return setActiveCell; },
1624
+ get scrollActiveCellIntoView() { return scrollActiveCellIntoView; },
1625
+ get getColumnBaseWidth() { return getColumnBaseWidth; },
1626
+ get fittedColumnWidths() { return fittedColumnWidths; },
1627
+ get getColumnWidth() { return getColumnWidth; },
1628
+ get resizePendingWidth() { return resizePendingWidth; },
1629
+ set resizePendingWidth(v) { resizePendingWidth = v; },
1630
+ get resizeRaf() { return resizeRaf; },
1631
+ set resizeRaf(v) { resizeRaf = v; },
1632
+ get startColumnResize() { return startColumnResize; },
1633
+ get onColumnResizeMove() { return onColumnResizeMove; },
1634
+ get endColumnResize() { return endColumnResize; },
1635
+ get setSelection() { return setSelection; },
1636
+ get extendSelection() { return extendSelection; },
1637
+ get isCellInSelectedRange() { return isCellInSelectedRange; },
1638
+ get getCellRangeEdges() { return getCellRangeEdges; },
1639
+ get fillHandleCell() { return fillHandleCell; },
1640
+ get isInFillPreview() { return isInFillPreview; },
1641
+ get findColumnById() { return findColumnById; },
1642
+ get readCellRaw() { return readCellRaw; },
1643
+ get writeCellRaw() { return writeCellRaw; },
1644
+ get applyFillPattern() { return applyFillPattern; },
1645
+ get clearSelectedCellValues() { return clearSelectedCellValues; },
1646
+ get startFillDrag() { return startFillDrag; },
1647
+ get onFillPointerMove() { return onFillPointerMove; },
1648
+ get onFillPointerUp() { return onFillPointerUp; },
1649
+ get toggleBooleanCell() { return toggleBooleanCell; },
1650
+ get onCellPointerDown() { return onCellPointerDown; },
1651
+ get onCellPointerEnter() { return onCellPointerEnter; },
1652
+ get endDragSelection() { return endDragSelection; },
1653
+ get onWindowPointerMove() { return onWindowPointerMove; },
1654
+ get onCellClick() { return onCellClick; },
1655
+ get emitCellDoubleClick() { return emitCellDoubleClick; },
1656
+ get copySelectionToClipboard() { return copySelectionToClipboard; },
1657
+ get clearSelectedCells() { return clearSelectedCells; },
1658
+ get onCellDoubleClick() { return onCellDoubleClick; },
1659
+ get startEditingWithChar() { return startEditingWithChar; },
1660
+ get saveEditingCell() { return saveEditingCell; },
1661
+ get applyHistoryStep() { return applyHistoryStep; },
1662
+ get updateEditingCellValue() { return updateEditingCellValue; },
1663
+ get onEditorKeyDown() { return onEditorKeyDown; },
1664
+ get focusOnMount() { return focusOnMount; },
1665
+ get onHeaderSortClick() { return onHeaderSortClick; },
1666
+ get onGridKeyDown() { return onGridKeyDown; },
1667
+ get changePage() { return changePage; },
1668
+ get goToPage() { return goToPage; },
1669
+ get setPageSize() { return setPageSize; },
1670
+ get openContextMenu() { return openContextMenu; },
1671
+ get closeContextMenu() { return closeContextMenu; },
1672
+ get contextMenuItems() { return contextMenuItems; },
1673
+ get saveComment() { return saveComment; },
1674
+ get removeComment() { return removeComment; },
1675
+ get closeCommentEditor() { return closeCommentEditor; },
1676
+ get updateFilterRow() { return updateFilterRow; },
1677
+ get updateFilterOperator() { return updateFilterOperator; },
1678
+ get updateFilterMenuValue() { return updateFilterMenuValue; },
1679
+ get updateFilterMenuValueTo() { return updateFilterMenuValueTo; },
1680
+ get toggleCheckboxWithKeyboard() { return toggleCheckboxWithKeyboard; },
1681
+ get getColumnAccessorValue() { return getColumnAccessorValue; },
1682
+ get fallbackOperatorOption() { return fallbackOperatorOption; },
1683
+ get operatorOption() { return operatorOption; },
1684
+ get operatorsForColumn() { return operatorsForColumn; },
1685
+ get defaultOperatorFor() { return defaultOperatorFor; },
1686
+ get operatorLabelFor() { return operatorLabelFor; },
1687
+ get isColumnFiltered() { return isColumnFiltered; },
1688
+ get closeMenus() { return closeMenus; },
1689
+ get measureCanvas() { return measureCanvas; },
1690
+ set measureCanvas(v) { measureCanvas = v; },
1691
+ get measureText() { return measureText; },
1692
+ get autosizeColumn() { return autosizeColumn; },
1693
+ get autosizeAllColumns() { return autosizeAllColumns; },
1694
+ get resetColumns() { return resetColumns; },
1695
+ get openChooseColumns() { return openChooseColumns; },
1696
+ get openColumnMenu() { return openColumnMenu; },
1697
+ get openFilterMenu() { return openFilterMenu; },
1698
+ get openOperatorMenu() { return openOperatorMenu; },
1699
+ get sortColumnFromMenu() { return sortColumnFromMenu; },
1700
+ get clearColumnSort() { return clearColumnSort; },
1701
+ get groupByColumnFromMenu() { return groupByColumnFromMenu; },
1702
+ get clearGroupingFromMenu() { return clearGroupingFromMenu; },
1703
+ get isBucketableColumn() { return isBucketableColumn; },
1704
+ get buildBuckets() { return buildBuckets; },
1705
+ get isInBucket() { return isInBucket; },
1706
+ get facetBucketsByColumn() { return facetBucketsByColumn; },
1707
+ get columnMenuFacetValues() { return columnMenuFacetValues; },
1708
+ get columnMenuVisibleFacets() { return columnMenuVisibleFacets; },
1709
+ get isFacetChecked() { return isFacetChecked; },
1710
+ get toggleFacetValue() { return toggleFacetValue; },
1711
+ get isAllFacetsChecked() { return isAllFacetsChecked; },
1712
+ get toggleAllFacets() { return toggleAllFacets; },
1713
+ get clearColumnFilter() { return clearColumnFilter; },
1714
+ get onWindowKeydown() { return onWindowKeydown; },
1715
+ get columnDefMatchesId() { return columnDefMatchesId; },
1716
+ get buildApi() { return buildApi; },
1717
+ get apiNotified() { return apiNotified; },
1718
+ set apiNotified(v) { apiNotified = v; },
1719
+ };
1720
+ const { resolveEffectiveFeatures } = createFeatures(ctx);
1721
+ const { showTooltipFor, hideTooltip, flushScheduledScrollSync, scheduleScrollSync, onBodyScroll } = createScrollSync(ctx);
1722
+ const { onGridKeyDown, onWindowKeydown, onHeaderSortClick } = createKeyboard(ctx);
1723
+ const { computeSummaries, hasRenderedColumn } = createSummaries(ctx);
1724
+ const { updateFilterRow, updateFilterOperator, updateFilterMenuValue, updateFilterMenuValueTo, toggleCheckboxWithKeyboard, isColumnFiltered, closeMenus, openChooseColumns, openColumnMenu, openFilterMenu, openOperatorMenu, sortColumnFromMenu, clearColumnSort, groupByColumnFromMenu, clearGroupingFromMenu, isFacetChecked, toggleFacetValue, isAllFacetsChecked, toggleAllFacets, clearColumnFilter, changePage, goToPage, setPageSize, openContextMenu, closeContextMenu, contextMenuItems, saveComment, removeComment, closeCommentEditor } = createMenus(ctx);
1725
+ const { cellConditionalFormat, computeRowClass, computeCellClass, computeCellTooltip, computeCellNote, getColumnEditorOptions, formatListCellValue, formatCellValue, formatPinnedValue, computePinnedCellClass } = createCellRender(ctx);
1726
+ const { isCellEditable, isCellEditableAt, getRowColumnValue, getCellDisplayValue, startEditingWithChar, saveEditingCell, applyHistoryStep, updateEditingCellValue, onEditorKeyDown, focusOnMount, onCellDoubleClick, pasteFromClipboard } = createEditing(ctx);
1727
+ const { isRowSelected, toggleRowSelectionById, toggleSelectAllRows, setActiveCell, scrollActiveCellIntoView, setSelection, extendSelection, isCellInSelectedRange, getCellRangeEdges, isInFillPreview, findColumnById, onCellPointerDown, onCellPointerEnter, endDragSelection, onWindowPointerMove, onCellClick, emitCellDoubleClick } = createSelection(ctx);
1728
+ const { cellPinStyle, isColumnPinned, getCurrentColumnOrder, emitColumnOrder, setColumnOrderInternal, applyColumnDrop, onColumnHeaderDragStart, onColumnHeaderDragOver, onColumnHeaderDragLeave, onColumnHeaderDrop, onColumnHeaderDragEnd, pinColumnLeft, pinColumnRight, unpinColumn, toggleColumnVisibleInPanel, moveColumnInPanel, toggleGroupInPanel, getColumnBaseWidth, getColumnWidth, startColumnResize, onColumnResizeMove, endColumnResize, measureText, autosizeColumn, autosizeAllColumns, resetColumns } = createColumns(ctx);
1729
+ const { buildApi } = createGridApi(ctx);
1730
+ const { readCellRaw, writeCellRaw, applyFillPattern, clearSelectedCellValues, startFillDrag, onFillPointerMove, onFillPointerUp, toggleBooleanCell, copySelectionToClipboard, clearSelectedCells, cutSelectionToClipboard } = createClipboard(ctx);
1731
+ return ctx;
1732
+ }