@affino/datagrid-vue-app 0.1.2 → 0.1.3

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 (26) hide show
  1. package/dist/DataGrid.d.ts +4 -4
  2. package/dist/advanced-filter.d.ts +2 -0
  3. package/dist/advanced-filter.js +4 -0
  4. package/dist/chunks/DataGridAdvancedFilterPopover-Bak_CkaO.js +4 -0
  5. package/dist/chunks/DataGridAdvancedFilterPopover.vue_vue_type_script_setup_true_lang-DixN56Qv.js +226 -0
  6. package/dist/chunks/DataGridAggregationsPopover-DfQ3-UV4.js +173 -0
  7. package/dist/chunks/DataGridColumnLayoutPopover-Qt56b3CA.js +136 -0
  8. package/dist/chunks/DataGridFilterableCombobox.vue_vue_type_script_setup_true_lang-_1TDQseN.js +399 -0
  9. package/dist/chunks/DataGridGanttStage.vue_vue_type_script_setup_true_lang-CYwB5Dpa.js +916 -0
  10. package/dist/chunks/DataGridGanttStageEntry-B9YlOHt1.js +40 -0
  11. package/dist/chunks/DataGridTableStage.vue_vue_type_script_setup_true_lang-BJJoBCsA.js +6681 -0
  12. package/dist/chunks/useDataGridAppRowModel-Di-Zatjs.js +2761 -0
  13. package/dist/gantt/DataGridGanttStageEntry.d.ts +52 -0
  14. package/dist/gantt.d.ts +3 -0
  15. package/dist/gantt.js +8 -0
  16. package/dist/host/DataGridRuntimeHost.d.ts +2 -2
  17. package/dist/index.js +32 -30
  18. package/dist/internal.js +39 -35
  19. package/dist/overlays/DataGridAdvancedFilterPopover.vue.d.ts +5 -5
  20. package/dist/overlays/DataGridAggregationsPopover.vue.d.ts +4 -4
  21. package/dist/overlays/DataGridColumnLayoutPopover.vue.d.ts +4 -4
  22. package/dist/overlays/DataGridColumnMenu.vue.d.ts +2 -2
  23. package/dist/overlays/DataGridFilterableCombobox.vue.d.ts +2 -2
  24. package/dist/stage/DataGridTableStageCenterPane.vue.d.ts +1 -1
  25. package/package.json +12 -4
  26. package/dist/chunks/useDataGridAppRowModel-CcTL-h8L.js +0 -11251
@@ -0,0 +1,2761 @@
1
+ import { defineComponent as Fn, h as k, computed as m, unref as c, ref as W, nextTick as Dn, onBeforeUnmount as En, watch as K, defineAsyncComponent as yt, shallowRef as _n } from "vue";
2
+ import { resolveDataGridCellClickAction as Gn, toggleDataGridCellValue as Pn, buildDataGridCellRenderModel as Ln, useDataGridContextMenu as Wn, cloneDataGridFilterSnapshot as Kn, createClientRowModel as un } from "@affino/datagrid-vue";
3
+ import { useDataGridAppIntentHistory as Nn, createDataGridAppRowHeightMetrics as $n, useDataGridAppViewport as Un, useDataGridAppRowSizing as qn, useDataGridAppCellSelection as Xn, useDataGridAppRowPresentation as Yn, useDataGridAppClipboard as Jn, useDataGridAppActiveCellViewport as Zn, useDataGridAppInlineEditing as Qn, useDataGridAppInteractionController as el, useDataGridAppHeaderResize as tl, useDataGridAppRuntimeSync as nl, useDataGridAppViewportLifecycle as ll, useDataGridAppColumnLayoutPanel as ol, useDataGridAppAdvancedFilterBuilder as rl } from "@affino/datagrid-vue/app";
4
+ import { useDataGridViewportContextMenuRouter as il, useDataGridContextMenuAnchor as al, useDataGridContextMenuActionRouter as sl } from "@affino/datagrid-vue/advanced";
5
+ import { c as ul, _ as cl } from "./DataGridTableStage.vue_vue_type_script_setup_true_lang-BJJoBCsA.js";
6
+ const dl = Fn({
7
+ name: "DataGridModuleHost",
8
+ props: {
9
+ modules: {
10
+ type: Array,
11
+ default: () => []
12
+ }
13
+ },
14
+ setup(e) {
15
+ return () => e.modules.length === 0 ? null : k("div", { class: "datagrid-app-toolbar" }, [
16
+ k("div", { class: "datagrid-app-toolbar__group" }, e.modules.map((o) => k(o.component, {
17
+ key: o.key,
18
+ ...o.props ?? {}
19
+ })))
20
+ ]);
21
+ }
22
+ }), Z = ["sort", "group", "pin", "filter"], kn = [
23
+ "sortAsc",
24
+ "sortDesc",
25
+ "clearSort",
26
+ "toggleGroup",
27
+ "pinMenu",
28
+ "pinLeft",
29
+ "pinRight",
30
+ "unpin",
31
+ "clearFilter",
32
+ "addCurrentSelectionToFilter",
33
+ "selectAllValues",
34
+ "clearAllValues",
35
+ "applyFilter",
36
+ "cancelFilter"
37
+ ], cn = 120;
38
+ function hn(e) {
39
+ const o = new Set(Z), r = Array.isArray(e) ? e : Z, l = [];
40
+ for (const s of r)
41
+ !o.has(s) || l.includes(s) || l.push(s);
42
+ return l.length > 0 ? l : [...Z];
43
+ }
44
+ function fn(e) {
45
+ if (!Array.isArray(e))
46
+ return [];
47
+ const o = new Set(Z), r = [];
48
+ for (const l of e)
49
+ !o.has(l) || r.includes(l) || r.push(l);
50
+ return r;
51
+ }
52
+ function Hn(e) {
53
+ if (!e)
54
+ return Object.freeze({});
55
+ const o = Object.entries(e).filter(([r, l]) => Z.includes(r) && typeof l == "string").map(([r, l]) => [r, l.trim()]).filter(([, r]) => r.length > 0);
56
+ return Object.freeze(Object.fromEntries(o));
57
+ }
58
+ function Vn(e) {
59
+ if (!e)
60
+ return Object.freeze({});
61
+ const o = Object.entries(e).filter(([r, l]) => Z.includes(r) && typeof l == "string").map(([r, l]) => [r, l.trim()]).filter(([, r]) => r.length > 0);
62
+ return Object.freeze(Object.fromEntries(o));
63
+ }
64
+ function zn(e) {
65
+ if (!e)
66
+ return Object.freeze({});
67
+ const o = Object.entries(e).filter(([r, l]) => kn.includes(r) && !!l).map(([r, l]) => {
68
+ const s = l, i = {
69
+ ...s.hidden === !0 ? { hidden: !0 } : {},
70
+ ...s.disabled === !0 ? { disabled: !0 } : {},
71
+ ...typeof s.disabledReason == "string" && s.disabledReason.trim().length > 0 ? { disabledReason: s.disabledReason.trim() } : {},
72
+ ...typeof s.label == "string" && s.label.trim().length > 0 ? { label: s.label.trim() } : {}
73
+ };
74
+ return [r, Object.freeze(i)];
75
+ }).filter(([, r]) => Object.keys(r).length > 0);
76
+ return Object.freeze(Object.fromEntries(o));
77
+ }
78
+ function ml(e) {
79
+ if (!e)
80
+ return {};
81
+ const o = Object.entries(e).filter(([r]) => r.trim().length > 0).map(([r, l]) => {
82
+ const s = l?.items ? hn(l.items) : void 0, i = fn(l?.hide), w = fn(l?.disabled), C = Vn(l?.disabledReasons), b = Hn(l?.labels), A = zn(l?.actions);
83
+ return [
84
+ r,
85
+ {
86
+ ...s ? { items: s } : {},
87
+ ...i.length > 0 ? { hide: i } : {},
88
+ ...w.length > 0 ? { disabled: w } : {},
89
+ ...Object.keys(C).length > 0 ? { disabledReasons: C } : {},
90
+ ...Object.keys(b).length > 0 ? { labels: b } : {},
91
+ ...Object.keys(A).length > 0 ? { actions: A } : {}
92
+ }
93
+ ];
94
+ });
95
+ return Object.fromEntries(o);
96
+ }
97
+ function ho(e) {
98
+ return typeof e == "boolean" ? {
99
+ enabled: e,
100
+ maxFilterValues: cn,
101
+ items: [...Z],
102
+ disabled: [],
103
+ disabledReasons: Object.freeze({}),
104
+ labels: Object.freeze({}),
105
+ actions: Object.freeze({}),
106
+ columns: {}
107
+ } : e ? {
108
+ enabled: e.enabled ?? !0,
109
+ maxFilterValues: Number.isFinite(e.maxFilterValues) ? Math.max(20, Math.trunc(e.maxFilterValues)) : cn,
110
+ items: hn(e.items),
111
+ disabled: fn(e.disabled),
112
+ disabledReasons: Vn(e.disabledReasons),
113
+ labels: Hn(e.labels),
114
+ actions: zn(e.actions),
115
+ columns: ml(e.columns)
116
+ } : {
117
+ enabled: !1,
118
+ maxFilterValues: cn,
119
+ items: [...Z],
120
+ disabled: [],
121
+ disabledReasons: Object.freeze({}),
122
+ labels: Object.freeze({}),
123
+ actions: Object.freeze({}),
124
+ columns: {}
125
+ };
126
+ }
127
+ function Tn(e, o) {
128
+ const r = e.columns[o], l = r?.items ? hn(r.items) : e.items, s = new Set(r?.hide ?? []), i = l.filter((w) => !s.has(w));
129
+ return i.length > 0 ? i : [];
130
+ }
131
+ function wl(e, o) {
132
+ const r = Tn(e, o), l = new Set(e.columns[o]?.disabled ?? []), s = new Set(e.disabled);
133
+ return r.filter((i) => s.has(i) || l.has(i));
134
+ }
135
+ function fl(e, o) {
136
+ return Object.freeze({
137
+ ...e.labels,
138
+ ...e.columns[o]?.labels ?? {}
139
+ });
140
+ }
141
+ function Cl(e, o) {
142
+ return Object.freeze({
143
+ ...e.disabledReasons,
144
+ ...e.columns[o]?.disabledReasons ?? {}
145
+ });
146
+ }
147
+ function gl(e, o) {
148
+ const r = e.columns[o]?.actions ?? {}, l = kn.map((s) => {
149
+ const i = {
150
+ ...e.actions[s] ?? {},
151
+ ...r[s] ?? {}
152
+ };
153
+ return [s, Object.freeze(i)];
154
+ }).filter(([, s]) => Object.keys(s).length > 0);
155
+ return Object.freeze(Object.fromEntries(l));
156
+ }
157
+ const _ = ["clipboard", "edit"], Rn = ["cut", "copy", "paste", "clear"], ve = ["insert", "clipboard", "selection"], jn = [
158
+ "insertAbove",
159
+ "insertBelow",
160
+ "cut",
161
+ "copy",
162
+ "paste",
163
+ "deleteSelected"
164
+ ];
165
+ function St(e, o) {
166
+ const r = new Set(o), l = Array.isArray(e) ? e : o, s = [];
167
+ for (const i of l)
168
+ !r.has(i) || s.includes(i) || s.push(i);
169
+ return s.length > 0 ? s : [...o];
170
+ }
171
+ function Rt(e, o) {
172
+ if (!Array.isArray(e))
173
+ return [];
174
+ const r = new Set(o), l = [];
175
+ for (const s of e)
176
+ !r.has(s) || l.includes(s) || l.push(s);
177
+ return l;
178
+ }
179
+ function be(e, o) {
180
+ if (!e)
181
+ return Object.freeze({});
182
+ const r = Object.entries(e).filter((l) => o.includes(l[0]) && typeof l[1] == "string").map(([l, s]) => [l, s.trim()]).filter(([, l]) => l.length > 0);
183
+ return Object.freeze(Object.fromEntries(r));
184
+ }
185
+ function yn(e, o) {
186
+ if (!e)
187
+ return Object.freeze({});
188
+ const r = Object.entries(e).filter(([l, s]) => o.includes(l) && !!s).map(([l, s]) => {
189
+ const i = s, w = {
190
+ ...i.hidden === !0 ? { hidden: !0 } : {},
191
+ ...i.disabled === !0 ? { disabled: !0 } : {},
192
+ ...typeof i.disabledReason == "string" && i.disabledReason.trim().length > 0 ? { disabledReason: i.disabledReason.trim() } : {},
193
+ ...typeof i.label == "string" && i.label.trim().length > 0 ? { label: i.label.trim() } : {}
194
+ };
195
+ return [l, Object.freeze(w)];
196
+ }).filter(([, l]) => Object.keys(l).length > 0);
197
+ return Object.freeze(Object.fromEntries(r));
198
+ }
199
+ function vl(e) {
200
+ if (!e)
201
+ return {};
202
+ const o = Object.entries(e).filter(([r]) => r.trim().length > 0).map(([r, l]) => {
203
+ const s = l?.items ? St(l.items, _) : void 0, i = Rt(l?.hide, _), w = Rt(l?.disabled, _), C = be(l?.disabledReasons, _), b = be(l?.labels, _), A = yn(l?.actions, Rn);
204
+ return [
205
+ r,
206
+ {
207
+ ...s ? { items: s } : {},
208
+ ...i.length > 0 ? { hide: i } : {},
209
+ ...w.length > 0 ? { disabled: w } : {},
210
+ ...Object.keys(C).length > 0 ? { disabledReasons: C } : {},
211
+ ...Object.keys(b).length > 0 ? { labels: b } : {},
212
+ ...Object.keys(A).length > 0 ? { actions: A } : {}
213
+ }
214
+ ];
215
+ });
216
+ return Object.freeze(Object.fromEntries(o));
217
+ }
218
+ function Ro(e) {
219
+ return typeof e == "boolean" ? {
220
+ enabled: e,
221
+ items: [..._],
222
+ disabled: [],
223
+ disabledReasons: Object.freeze({}),
224
+ labels: Object.freeze({}),
225
+ actions: Object.freeze({}),
226
+ columns: {}
227
+ } : e ? {
228
+ enabled: e.enabled ?? !0,
229
+ items: St(e.items, _),
230
+ disabled: Rt(e.disabled, _),
231
+ disabledReasons: be(e.disabledReasons, _),
232
+ labels: be(e.labels, _),
233
+ actions: yn(e.actions, Rn),
234
+ columns: vl(e.columns)
235
+ } : {
236
+ enabled: !1,
237
+ items: [..._],
238
+ disabled: [],
239
+ disabledReasons: Object.freeze({}),
240
+ labels: Object.freeze({}),
241
+ actions: Object.freeze({}),
242
+ columns: {}
243
+ };
244
+ }
245
+ function ht(e, o) {
246
+ const r = e.columns[o], l = r?.items ? St(r.items, _) : e.items, s = new Set(r?.hide ?? []), i = l.filter((w) => !s.has(w));
247
+ return i.length > 0 ? i : [];
248
+ }
249
+ function bl(e, o) {
250
+ const r = ht(e, o), l = new Set(e.columns[o]?.disabled ?? []), s = new Set(e.disabled);
251
+ return r.filter((i) => s.has(i) || l.has(i));
252
+ }
253
+ function hl(e, o) {
254
+ return Object.freeze({
255
+ ...e.disabledReasons,
256
+ ...e.columns[o]?.disabledReasons ?? {}
257
+ });
258
+ }
259
+ function Rl(e, o) {
260
+ const r = e.columns[o]?.actions ?? {}, l = Rn.map((s) => {
261
+ const i = {
262
+ ...e.actions[s] ?? {},
263
+ ...r[s] ?? {}
264
+ };
265
+ return [s, Object.freeze(i)];
266
+ }).filter(([, s]) => Object.keys(s).length > 0);
267
+ return Object.freeze(Object.fromEntries(l));
268
+ }
269
+ function yo(e) {
270
+ return typeof e == "boolean" ? {
271
+ enabled: e,
272
+ items: [...ve],
273
+ disabled: [],
274
+ disabledReasons: Object.freeze({}),
275
+ labels: Object.freeze({}),
276
+ actions: Object.freeze({})
277
+ } : e ? {
278
+ enabled: e.enabled ?? !0,
279
+ items: St(e.items, ve),
280
+ disabled: Rt(e.disabled, ve),
281
+ disabledReasons: be(e.disabledReasons, ve),
282
+ labels: be(e.labels, ve),
283
+ actions: yn(e.actions, jn)
284
+ } : {
285
+ enabled: !1,
286
+ items: [...ve],
287
+ disabled: [],
288
+ disabledReasons: Object.freeze({}),
289
+ labels: Object.freeze({}),
290
+ actions: Object.freeze({})
291
+ };
292
+ }
293
+ function yl(e) {
294
+ return e.items;
295
+ }
296
+ function Sl(e) {
297
+ return e.disabled;
298
+ }
299
+ function pl(e) {
300
+ return e.disabledReasons;
301
+ }
302
+ function Ml(e) {
303
+ const o = jn.map((r) => [r, Object.freeze({ ...e.actions[r] ?? {} })]).filter(([, r]) => Object.keys(r).length > 0);
304
+ return Object.freeze(Object.fromEntries(o));
305
+ }
306
+ function Sn(e) {
307
+ return (o) => {
308
+ e.value = o instanceof HTMLElement ? o : null;
309
+ };
310
+ }
311
+ function Il(e) {
312
+ const o = Sn(e.headerViewportRef), r = Sn(e.bodyViewportRef), l = (f) => {
313
+ e.editingCellValueRef.value = f;
314
+ }, s = m(() => ({
315
+ gridContentStyle: c(e.gridContentStyle),
316
+ mainTrackStyle: c(e.mainTrackStyle),
317
+ indexColumnStyle: c(e.indexColumnStyle),
318
+ columnStyle: c(e.columnStyle)
319
+ })), i = m(() => ({
320
+ topSpacerHeight: c(e.topSpacerHeight),
321
+ bottomSpacerHeight: c(e.bottomSpacerHeight),
322
+ viewportRowStart: c(e.viewportRowStart),
323
+ columnWindowStart: c(e.columnWindowStart),
324
+ leftColumnSpacerWidth: c(e.leftColumnSpacerWidth),
325
+ rightColumnSpacerWidth: c(e.rightColumnSpacerWidth),
326
+ headerViewportRef: o,
327
+ bodyViewportRef: r,
328
+ handleHeaderWheel: c(e.handleHeaderWheel),
329
+ handleHeaderScroll: c(e.handleHeaderScroll),
330
+ handleViewportScroll: c(e.handleViewportScroll),
331
+ handleViewportKeydown: c(e.handleViewportKeydown)
332
+ })), w = m(() => ({
333
+ visibleColumns: c(e.visibleColumns),
334
+ renderedColumns: c(e.renderedColumns),
335
+ columnFilterTextByKey: c(e.columnFilterTextByKey),
336
+ toggleSortForColumn: c(e.toggleSortForColumn),
337
+ sortIndicator: c(e.sortIndicator),
338
+ setColumnFilterText: c(e.setColumnFilterText),
339
+ columnMenuEnabled: c(e.columnMenuEnabled),
340
+ columnMenuValueFilterEnabled: c(e.columnMenuValueFilterEnabled),
341
+ columnMenuValueFilterRowLimit: c(e.columnMenuValueFilterRowLimit),
342
+ columnMenuMaxFilterValues: c(e.columnMenuMaxFilterValues),
343
+ resolveColumnMenuItems: c(e.resolveColumnMenuItems),
344
+ resolveColumnMenuDisabledItems: c(e.resolveColumnMenuDisabledItems),
345
+ resolveColumnMenuDisabledReasons: c(e.resolveColumnMenuDisabledReasons),
346
+ resolveColumnMenuLabels: c(e.resolveColumnMenuLabels),
347
+ resolveColumnMenuActionOptions: c(e.resolveColumnMenuActionOptions),
348
+ isColumnFilterActive: c(e.isColumnFilterActive),
349
+ isColumnGrouped: c(e.isColumnGrouped),
350
+ resolveColumnGroupOrder: c(e.resolveColumnGroupOrder),
351
+ resolveColumnMenuSortDirection: c(e.resolveColumnMenuSortDirection),
352
+ resolveColumnMenuSelectedTokens: c(e.resolveColumnMenuSelectedTokens),
353
+ applyColumnMenuSort: c(e.applyColumnMenuSort),
354
+ applyColumnMenuPin: c(e.applyColumnMenuPin),
355
+ applyColumnMenuGroupBy: c(e.applyColumnMenuGroupBy),
356
+ applyColumnMenuFilter: c(e.applyColumnMenuFilter),
357
+ clearColumnMenuFilter: c(e.clearColumnMenuFilter),
358
+ startResize: c(e.startResize),
359
+ handleResizeDoubleClick: c(e.handleResizeDoubleClick)
360
+ })), C = m(() => ({
361
+ displayRows: c(e.displayRows),
362
+ pinnedBottomRows: c(e.pinnedBottomRows),
363
+ sourceRows: c(e.sourceRows),
364
+ showRowIndex: c(e.showRowIndex),
365
+ rowHover: c(e.rowHover),
366
+ stripedRows: c(e.stripedRows),
367
+ rowClass: c(e.rowClass),
368
+ isRowAutosizeProbe: c(e.isRowAutosizeProbe),
369
+ rowStyle: c(e.rowStyle),
370
+ isRowInPendingClipboardCut: c(e.isRowInPendingClipboardCut),
371
+ isRowFocused: c(e.isRowFocused),
372
+ isRowCheckboxSelected: c(e.isRowCheckboxSelected),
373
+ allVisibleRowsSelected: c(e.allVisibleRowsSelected),
374
+ someVisibleRowsSelected: c(e.someVisibleRowsSelected),
375
+ handleRowClick: c(e.handleRowClick),
376
+ handleRowIndexClick: c(e.handleRowIndexClick),
377
+ handleRowIndexKeydown: c(e.handleRowIndexKeydown),
378
+ handleToggleAllVisibleRows: c(e.handleToggleAllVisibleRows),
379
+ toggleGroupRow: c(e.toggleGroupRow),
380
+ rowIndexLabel: c(e.rowIndexLabel),
381
+ startRowResize: c(e.startRowResize),
382
+ autosizeRow: c(e.autosizeRow)
383
+ })), b = m(() => ({
384
+ selectionRange: c(e.selectionRange),
385
+ selectionAnchorCell: c(e.selectionAnchorCell),
386
+ fillPreviewRange: c(e.fillPreviewRange),
387
+ rangeMovePreviewRange: c(e.rangeMovePreviewRange),
388
+ isFillDragging: c(e.isFillDragging),
389
+ isRangeMoving: c(e.isRangeMoving),
390
+ fillActionAnchorCell: c(e.fillActionAnchorCell),
391
+ fillActionBehavior: c(e.fillActionBehavior),
392
+ applyFillActionBehavior: c(e.applyFillActionBehavior),
393
+ isFillHandleCell: c(e.isFillHandleCell),
394
+ startFillHandleDrag: c(e.startFillHandleDrag),
395
+ startFillHandleDoubleClick: c(e.startFillHandleDoubleClick)
396
+ })), A = m(() => ({
397
+ editingCellValue: e.editingCellValueRef.value,
398
+ editingCellInitialFilter: c(e.editingCellInitialFilter),
399
+ editingCellOpenOnMount: c(e.editingCellOpenOnMount),
400
+ isEditingCell: c(e.isEditingCell),
401
+ startInlineEdit: c(e.startInlineEdit),
402
+ updateEditingCellValue: l,
403
+ handleEditorKeydown: c(e.handleEditorKeydown),
404
+ commitInlineEdit: c(e.commitInlineEdit),
405
+ cancelInlineEdit: c(e.cancelInlineEdit)
406
+ })), v = m(() => ({
407
+ cellClass: c(e.cellClass),
408
+ cellStyle: c(e.cellStyle),
409
+ isCellSelected: c(e.isCellSelected),
410
+ isSelectionAnchorCell: c(e.isSelectionAnchorCell),
411
+ shouldHighlightSelectedCell: c(e.shouldHighlightSelectedCell),
412
+ isCellOnSelectionEdge: c(e.isCellOnSelectionEdge),
413
+ isCellInFillPreview: c(e.isCellInFillPreview),
414
+ isCellInPendingClipboardRange: c(e.isCellInPendingClipboardRange),
415
+ isCellOnPendingClipboardEdge: c(e.isCellOnPendingClipboardEdge),
416
+ isCellEditable: c(e.isCellEditable),
417
+ readCell: c(e.readCell),
418
+ readDisplayCell: c(e.readDisplayCell)
419
+ })), R = m(() => ({
420
+ handleCellMouseDown: c(e.handleCellMouseDown),
421
+ handleCellClick: c(e.handleCellClick),
422
+ handleCellKeydown: c(e.handleCellKeydown)
423
+ })), y = m(() => ({
424
+ mode: c(e.mode),
425
+ rowHeightMode: c(e.rowHeightMode),
426
+ layout: s.value,
427
+ viewport: i.value,
428
+ columns: w.value,
429
+ rows: C.value,
430
+ selection: b.value,
431
+ editing: A.value,
432
+ cells: v.value,
433
+ interaction: R.value
434
+ })), g = ul({
435
+ mode: m(() => c(e.mode)),
436
+ rowHeightMode: m(() => c(e.rowHeightMode)),
437
+ layout: s,
438
+ viewport: i,
439
+ columns: w,
440
+ rows: C,
441
+ selection: b,
442
+ editing: A,
443
+ cells: v,
444
+ interaction: R
445
+ });
446
+ return {
447
+ tableStageProps: y,
448
+ tableStageContext: g,
449
+ captureHeaderViewportRef: o,
450
+ captureBodyViewportRef: r,
451
+ updateEditingCellValue: l
452
+ };
453
+ }
454
+ function xl(e) {
455
+ return {
456
+ readStageCell: (s, i) => e.isRowSelectionColumnKey(i) ? e.readRowSelectionCell(s) : e.readCell(s, i),
457
+ readStageDisplayCell: (s, i) => e.isRowSelectionColumnKey(i) ? e.readRowSelectionDisplayCell(s) : e.readDisplayCell(s, i),
458
+ handleCellClick: (s, i, w, C) => {
459
+ if (e.isRowSelectionColumn(w)) {
460
+ e.toggleRowCheckboxSelected(s);
461
+ return;
462
+ }
463
+ const b = e.viewportRowStart.value + i, A = e.isCellEditableByKey(s, b, w.key, C);
464
+ if (Gn({
465
+ column: w.column,
466
+ row: s.kind !== "group" ? s.data : void 0,
467
+ editable: A
468
+ }) !== "toggle" || s.kind === "group" || s.rowId == null)
469
+ return;
470
+ const R = e.captureHistorySnapshot();
471
+ e.runtime.api.rows.applyEdits([
472
+ {
473
+ rowId: s.rowId,
474
+ data: {
475
+ [w.key]: Pn({
476
+ column: w.column,
477
+ row: s.data
478
+ })
479
+ }
480
+ }
481
+ ]), e.recordHistoryIntentTransaction({
482
+ intent: "edit",
483
+ label: `Toggle ${w.key}`,
484
+ affectedRange: {
485
+ startRow: b,
486
+ endRow: b,
487
+ startColumn: C,
488
+ endColumn: C
489
+ }
490
+ }, R), e.syncViewport();
491
+ }
492
+ };
493
+ }
494
+ const pn = 140, bt = 108, dn = "__datagrid_row_selection__";
495
+ function Al(e) {
496
+ const o = m(() => (e.showRowSelection?.value ?? !0) && e.runtime.api.rowSelection.hasSupport()), r = m(() => o.value ? {
497
+ key: dn,
498
+ state: {
499
+ visible: !0,
500
+ pin: "left",
501
+ width: bt
502
+ },
503
+ visible: !0,
504
+ pin: "left",
505
+ width: bt,
506
+ column: {
507
+ key: dn,
508
+ label: "",
509
+ cellType: "checkbox",
510
+ minWidth: bt,
511
+ maxWidth: bt,
512
+ capabilities: {
513
+ editable: !0,
514
+ sortable: !1,
515
+ filterable: !1,
516
+ groupable: !1,
517
+ pivotable: !1,
518
+ aggregatable: !1
519
+ },
520
+ presentation: {
521
+ align: "center",
522
+ headerAlign: "center"
523
+ },
524
+ meta: {
525
+ isSystem: !0,
526
+ rowSelection: !0
527
+ }
528
+ }
529
+ } : null), l = (g) => g === dn, s = (g) => l(g.key), i = m(() => {
530
+ const g = r.value, f = e.visibleColumns.value.filter((x) => x.pin === "left"), M = e.visibleColumns.value.filter((x) => x.pin !== "left" && x.pin !== "right"), I = e.visibleColumns.value.filter((x) => x.pin === "right");
531
+ return g ? [g, ...f, ...M, ...I] : [...f, ...M, ...I];
532
+ }), w = m(() => i.value.filter((g) => g.pin !== "left" && g.pin !== "right")), C = (g) => g.width ?? pn, b = (g) => {
533
+ const f = i.value.find((x) => x.key === g), I = `${f ? C(f) : pn}px`;
534
+ return {
535
+ width: I,
536
+ minWidth: I,
537
+ maxWidth: I
538
+ };
539
+ }, A = (g) => g.column.capabilities?.editable !== !1, v = (g, f, M) => s(M) ? g.kind !== "group" && g.rowId != null : g.kind === "group" || g.rowId == null || !A(M) ? !1 : e.isCellEditable ? e.isCellEditable({
540
+ row: g.data,
541
+ rowId: g.rowId,
542
+ rowIndex: f,
543
+ column: M.column,
544
+ columnKey: M.key
545
+ }) : !0, R = (g, f) => {
546
+ const M = i.value[f];
547
+ if (M?.key === g)
548
+ return { column: M, columnIndex: f };
549
+ const I = i.value.findIndex((x) => x.key === g);
550
+ return I < 0 ? null : {
551
+ column: i.value[I],
552
+ columnIndex: I
553
+ };
554
+ };
555
+ return {
556
+ orderedVisibleColumns: i,
557
+ centerColumns: w,
558
+ resolveColumnWidth: C,
559
+ stageColumnStyle: b,
560
+ isRowSelectionColumnKey: l,
561
+ isRowSelectionColumn: s,
562
+ isCellEditable: v,
563
+ isCellEditableByKey: (g, f, M, I) => {
564
+ const x = R(M, I);
565
+ return x ? v(g, f, x.column) : !1;
566
+ },
567
+ rowSelectionColumn: r
568
+ };
569
+ }
570
+ function Ol(e) {
571
+ const o = m(() => {
572
+ const l = e.lastAppliedFill.value, s = e.selectionRange.value;
573
+ return !l || !s || e.isFillDragging.value || l.allowBehaviorToggle === !1 || l.previewRange.startRow !== s.startRow || l.previewRange.endRow !== s.endRow || l.previewRange.startColumn !== s.startColumn || l.previewRange.endColumn !== s.endColumn ? null : {
574
+ rowIndex: l.previewRange.endRow,
575
+ columnIndex: l.previewRange.endColumn
576
+ };
577
+ }), r = m(() => e.lastAppliedFill.value?.behavior ?? null);
578
+ return {
579
+ fillActionAnchorCell: o,
580
+ fillActionBehavior: r
581
+ };
582
+ }
583
+ function Fl(e) {
584
+ const o = e.history ? null : Nn({
585
+ runtime: e.runtime,
586
+ cloneRowData: e.cloneRowData,
587
+ syncViewport: e.syncViewport
588
+ });
589
+ return {
590
+ captureHistorySnapshot: () => e.history ? e.history.captureSnapshot() : o?.captureRowsSnapshot() ?? null,
591
+ recordHistoryIntentTransaction: (b, A) => {
592
+ if (e.history) {
593
+ e.history.recordIntentTransaction(b, A);
594
+ return;
595
+ }
596
+ o?.recordIntentTransaction(
597
+ b,
598
+ A
599
+ );
600
+ },
601
+ canUndoHistory: () => e.history ? e.history.canUndo() : o?.canUndo.value ?? !1,
602
+ canRedoHistory: () => e.history ? e.history.canRedo() : o?.canRedo.value ?? !1,
603
+ runHistoryAction: (b) => e.history ? e.history.runHistoryAction(b) : o?.runHistoryAction(b) ?? Promise.resolve(null),
604
+ disposeIntentHistory: () => {
605
+ o?.dispose();
606
+ }
607
+ };
608
+ }
609
+ function Dl(e) {
610
+ const o = m(() => new Set(e.rowSelectionSnapshot.value?.selectedRows ?? [])), r = (f) => f.rowId != null && e.rowSelectionSnapshot.value?.focusedRow === f.rowId, l = (f) => f.kind !== "group" && f.rowId != null && o.value.has(f.rowId), s = (f) => l(f), i = (f) => s(f) ? "true" : "false", w = (f) => {
611
+ const M = e.rowSelectionColumn.value?.column;
612
+ return !M || f.kind === "group" ? "" : Ln({
613
+ column: M,
614
+ value: s(f)
615
+ }).displayValue;
616
+ }, C = m(() => {
617
+ const f = e.runtime.api.rows.getCount(), M = [];
618
+ for (let I = 0; I < f; I += 1) {
619
+ const x = e.runtime.api.rows.get(I);
620
+ !x || x.kind === "group" || x.rowId == null || M.push(x.rowId);
621
+ }
622
+ return M;
623
+ }), b = m(() => {
624
+ const f = C.value;
625
+ return f.length > 0 && f.every((M) => o.value.has(M));
626
+ }), A = m(() => C.value.some((M) => o.value.has(M))), v = (f) => {
627
+ f.rowId == null || !e.runtime.api.rowSelection.hasSupport() || e.runtime.api.rowSelection.setFocusedRow(f.rowId);
628
+ };
629
+ return {
630
+ rowSelectionSet: o,
631
+ isRowFocused: r,
632
+ isRowCheckboxSelected: l,
633
+ readRowSelectionCell: i,
634
+ readRowSelectionDisplayCell: w,
635
+ areAllVisibleRowsSelected: b,
636
+ areSomeVisibleRowsSelected: A,
637
+ focusRow: v,
638
+ toggleRowCheckboxSelected: (f) => {
639
+ f.kind === "group" || f.rowId == null || !e.runtime.api.rowSelection.hasSupport() || e.runtime.api.rowSelection.setSelected(f.rowId, !o.value.has(f.rowId));
640
+ },
641
+ toggleVisibleRowsSelected: () => {
642
+ if (!e.runtime.api.rowSelection.hasSupport())
643
+ return;
644
+ const f = C.value;
645
+ if (!b.value) {
646
+ e.runtime.api.rowSelection.selectRows(f);
647
+ return;
648
+ }
649
+ e.runtime.api.rowSelection.deselectRows(f);
650
+ },
651
+ selectRowRange: (f, M, I) => {
652
+ v(f);
653
+ const x = e.orderedVisibleColumns.value.length - 1;
654
+ if (x < 0)
655
+ return;
656
+ const N = e.viewportRowStart.value + M;
657
+ if (!I) {
658
+ e.applySelectionRange({
659
+ startRow: N,
660
+ endRow: N,
661
+ startColumn: 0,
662
+ endColumn: x
663
+ });
664
+ return;
665
+ }
666
+ const j = e.selectionAnchorCell.value?.rowIndex ?? N;
667
+ e.applySelectionRange({
668
+ startRow: Math.min(j, N),
669
+ endRow: Math.max(j, N),
670
+ startColumn: 0,
671
+ endColumn: x
672
+ });
673
+ }
674
+ };
675
+ }
676
+ function El(e) {
677
+ return {
678
+ handleWindowMouseMove: (i) => {
679
+ if (e.isColumnResizing.value) {
680
+ e.applyColumnResizeFromPointer(i.clientX);
681
+ return;
682
+ }
683
+ e.handleInteractionWindowMouseMove(i);
684
+ },
685
+ handleHeaderWheel: (i) => {
686
+ const w = e.bodyViewportRef.value;
687
+ if (!w)
688
+ return;
689
+ const C = Math.abs(i.deltaX) > 0 ? i.deltaX : i.shiftKey ? i.deltaY : 0, b = C === 0 ? i.deltaY : 0;
690
+ C === 0 && b === 0 || (i.preventDefault(), C !== 0 && (w.scrollLeft += C), b !== 0 && (w.scrollTop += b), e.syncViewport());
691
+ },
692
+ handleHeaderScroll: (i) => {
693
+ const w = i.target, C = e.bodyViewportRef.value;
694
+ !w || !C || (C.scrollLeft !== w.scrollLeft && (C.scrollLeft = w.scrollLeft), e.syncViewport());
695
+ },
696
+ handleWindowMouseUp: () => {
697
+ e.stopColumnResize(), e.handleInteractionWindowMouseUp();
698
+ }
699
+ };
700
+ }
701
+ function kl(e) {
702
+ const o = (i) => i.ctrlKey || i.metaKey || i.altKey ? !1 : i.key.startsWith("Arrow") || i.key === "Home" || i.key === "End" || i.key === "PageUp" || i.key === "PageDown" || i.key === "Tab" || i.key === "Enter" || i.key === " " || i.key === "Spacebar" || i.key === "F2" || i.key === "Escape" || i.key.length === 1, r = (i) => (i.ctrlKey || i.metaKey) && !i.altKey && !i.shiftKey && i.key.toLowerCase() === "a", l = () => {
703
+ const i = e.totalRows.value - 1, w = e.orderedVisibleColumns.value.length - 1;
704
+ i < 0 || w < 0 || e.applySelectionRange({
705
+ startRow: 0,
706
+ endRow: i,
707
+ startColumn: 0,
708
+ endColumn: w
709
+ });
710
+ };
711
+ return {
712
+ handleViewportKeydown: (i) => {
713
+ (o(i) || r(i)) && i.preventDefault();
714
+ const w = e.selectionSnapshot.value?.activeCell;
715
+ if (!w) {
716
+ r(i) && l();
717
+ return;
718
+ }
719
+ const C = e.runtime.getBodyRowAtIndex(w.rowIndex);
720
+ C && e.handleCellKeydown(
721
+ i,
722
+ C,
723
+ w.rowIndex - e.viewportRowStart.value,
724
+ w.colIndex
725
+ );
726
+ }
727
+ };
728
+ }
729
+ function Hl(e) {
730
+ const o = m(() => e.interactionSelectionRange.value ?? e.resolveCommittedSelectionRange()), r = () => {
731
+ const v = o.value;
732
+ return v && v.startRow === v.endRow && v.startColumn === v.endColumn ? {
733
+ rowIndex: v.startRow,
734
+ columnIndex: v.startColumn
735
+ } : e.selectionAnchorCell.value;
736
+ }, l = () => o.value, s = () => e.mode.value === "base" && e.isFillDragging.value && !!e.fillPreviewRange.value, i = (v, R, y) => {
737
+ const g = e.viewportRowStart.value + R;
738
+ return g >= v.startRow && g <= v.endRow && y >= v.startColumn && y <= v.endColumn;
739
+ }, w = (v, R) => {
740
+ const y = r();
741
+ return y ? y.rowIndex === e.viewportRowStart.value + v && y.columnIndex === R : e.isCommittedSelectionAnchorCell(v, R);
742
+ };
743
+ return {
744
+ selectionRange: o,
745
+ isSelectionAnchorCell: w,
746
+ isCellSelected: (v, R) => {
747
+ if (!s())
748
+ return e.isCommittedCellSelected(v, R);
749
+ const y = l();
750
+ return y ? i(y, v, R) : !1;
751
+ },
752
+ shouldHighlightSelectedCell: (v, R) => {
753
+ if (!s())
754
+ return e.shouldHighlightCommittedSelectedCell(v, R);
755
+ const y = l();
756
+ return !y || !i(y, v, R) || y.startRow === y.endRow && y.startColumn === y.endColumn ? !1 : !w(v, R);
757
+ },
758
+ isCellOnSelectionEdge: (v, R, y) => {
759
+ if (!s())
760
+ return e.isCommittedCellOnSelectionEdge(v, R, y);
761
+ const g = l();
762
+ if (!g || !i(g, v, R))
763
+ return !1;
764
+ const f = e.viewportRowStart.value + v;
765
+ switch (y) {
766
+ case "top":
767
+ return f === g.startRow;
768
+ case "right":
769
+ return R === g.endColumn;
770
+ case "bottom":
771
+ return f === g.endRow;
772
+ case "left":
773
+ return R === g.startColumn;
774
+ }
775
+ }
776
+ };
777
+ }
778
+ const mn = 140, Vl = 72, zl = 80, Tl = 24, jl = 400;
779
+ function Bl(e) {
780
+ const o = e.syncRowSelectionSnapshotFromRuntime ?? (() => {
781
+ }), r = e.rowSelectionSnapshot ?? W(null), l = m(() => e.showRowIndex?.value !== !1), s = m(() => e.runtime.rowPartition.value.bodyRowCount), i = m(() => Math.max(0, e.totalRuntimeRows.value)), w = m(() => l.value ? Vl : 0), C = Al({
782
+ runtime: e.runtime,
783
+ visibleColumns: e.visibleColumns,
784
+ showRowSelection: e.showRowSelection,
785
+ isCellEditable: e.isCellEditable
786
+ }), {
787
+ orderedVisibleColumns: b,
788
+ centerColumns: A,
789
+ resolveColumnWidth: v,
790
+ isRowSelectionColumnKey: R,
791
+ isRowSelectionColumn: y,
792
+ isCellEditable: g,
793
+ isCellEditableByKey: f,
794
+ rowSelectionColumn: M
795
+ } = C, I = $n({
796
+ totalRows: () => s.value,
797
+ resolveBaseRowHeight: () => e.normalizedBaseRowHeight.value,
798
+ resolveRowHeightOverride: (t) => e.runtime.api.view.getRowHeightOverride(t),
799
+ resolveRowHeightVersion: () => e.runtime.api.view.getRowHeightVersion(),
800
+ hasRowHeightOverrides: () => e.runtime.api.view.getRowHeightVersion() > 0
801
+ });
802
+ let x = () => !1;
803
+ const {
804
+ headerViewportRef: N,
805
+ bodyViewportRef: j,
806
+ displayRows: ze,
807
+ pinnedBottomRows: pt,
808
+ renderedColumns: Mt,
809
+ viewportRowStart: H,
810
+ viewportColumnStart: It,
811
+ topSpacerHeight: xt,
812
+ bottomSpacerHeight: At,
813
+ leftColumnSpacerWidth: Ot,
814
+ rightColumnSpacerWidth: Ft,
815
+ gridContentStyle: Dt,
816
+ mainTrackStyle: he,
817
+ indexColumnStyle: Et,
818
+ columnStyle: kt,
819
+ handleViewportScroll: Ht,
820
+ syncViewportFromDom: V,
821
+ scheduleViewportSync: Vt,
822
+ cancelScheduledViewportSync: zt
823
+ } = Un({
824
+ runtime: e.runtime,
825
+ mode: e.mode,
826
+ rowRenderMode: e.rowRenderMode,
827
+ rowVirtualizationEnabled: m(() => e.virtualization.value.rows),
828
+ columnVirtualizationEnabled: m(() => e.virtualization.value.columns),
829
+ totalRows: s,
830
+ visibleColumns: A,
831
+ sizingColumns: b,
832
+ normalizedBaseRowHeight: e.normalizedBaseRowHeight,
833
+ resolveColumnWidth: v,
834
+ defaultColumnWidth: mn,
835
+ indexColumnWidth: 0,
836
+ flexFillOffsetWidth: w.value,
837
+ rowOverscan: m(() => e.virtualization.value.rowOverscan),
838
+ columnOverscan: m(() => e.virtualization.value.columnOverscan),
839
+ measureVisibleRowHeights: () => je(),
840
+ resolveRowHeight: I.resolveRowHeight,
841
+ resolveRowOffset: I.resolveRowOffset,
842
+ resolveRowIndexAtOffset: I.resolveRowIndexAtOffset,
843
+ resolveTotalRowHeight: I.resolveTotalHeight
844
+ }), Tt = (t) => kt(t), q = (t) => {
845
+ if (i.value <= 0)
846
+ return null;
847
+ const n = Math.max(0, Math.min(i.value - 1, Math.trunc(t)));
848
+ return e.runtime.api.rows.get(n) ?? null;
849
+ }, F = (t) => {
850
+ for (let n = 0; n < i.value; n += 1)
851
+ if (e.runtime.api.rows.get(n)?.rowId === t)
852
+ return n;
853
+ return e.runtime.resolveBodyRowIndexById(t);
854
+ }, L = {
855
+ ...e.runtime,
856
+ getBodyRowAtIndex: q,
857
+ resolveBodyRowIndexById: F
858
+ }, {
859
+ rowStyle: re,
860
+ isRowAutosizeProbe: Te,
861
+ measureVisibleRowHeights: je,
862
+ startRowResize: ie,
863
+ autosizeRow: Be,
864
+ dispose: _e
865
+ } = qn({
866
+ mode: e.mode,
867
+ rowHeightMode: e.rowHeightMode,
868
+ normalizedBaseRowHeight: e.normalizedBaseRowHeight,
869
+ viewportRowStart: H,
870
+ bodyViewportRef: j,
871
+ runtime: e.runtime,
872
+ minRowHeight: Tl,
873
+ syncViewport: () => V()
874
+ }), Q = Xn({
875
+ mode: e.mode,
876
+ runtime: L,
877
+ totalRows: i,
878
+ visibleColumns: b,
879
+ viewportRowStart: H,
880
+ selectionSnapshot: e.selectionSnapshot,
881
+ selectionAnchor: e.selectionAnchor,
882
+ isEditingCell: (t, n) => x(t, n)
883
+ }), {
884
+ normalizeRowId: Ge,
885
+ normalizeCellCoord: Pe,
886
+ resolveSelectionRange: ae,
887
+ resolveCurrentCellCoord: Le,
888
+ applySelectionRange: X,
889
+ applyCellSelectionByCoord: Re,
890
+ setCellSelection: G,
891
+ clearCellSelection: ye,
892
+ isCellSelected: Se
893
+ } = Q, We = Q.isSelectionAnchorCell ?? (() => !1), jt = Q.shouldHighlightSelectedCell ?? ((t, n) => Se(t, n)), Bt = Q.isCellOnSelectionEdge ?? (() => !1), pe = m(() => {
894
+ const t = e.selectionSnapshot.value;
895
+ if (!t || t.ranges.length === 0)
896
+ return null;
897
+ const n = t.activeRangeIndex ?? 0, a = t.ranges[n]?.anchor ?? t.ranges[0]?.anchor ?? null;
898
+ return !a || typeof a.rowIndex != "number" || typeof a.colIndex != "number" || !Number.isFinite(a.rowIndex) || !Number.isFinite(a.colIndex) ? null : {
899
+ rowIndex: Math.trunc(a.rowIndex),
900
+ columnIndex: Math.trunc(a.colIndex)
901
+ };
902
+ }), Ke = Dl({
903
+ runtime: e.runtime,
904
+ rowSelectionColumn: M,
905
+ orderedVisibleColumns: b,
906
+ displayRows: ze,
907
+ rowSelectionSnapshot: r,
908
+ viewportRowStart: H,
909
+ selectionAnchorCell: pe,
910
+ applySelectionRange: X
911
+ }), {
912
+ readRowSelectionCell: _t,
913
+ readRowSelectionDisplayCell: Gt,
914
+ toggleRowCheckboxSelected: Me
915
+ } = Ke, Pt = m(() => {
916
+ const t = `${w.value}px`;
917
+ return {
918
+ ...Et.value,
919
+ width: t,
920
+ minWidth: t,
921
+ maxWidth: t
922
+ };
923
+ }), Ne = Fl({
924
+ runtime: e.runtime,
925
+ cloneRowData: e.cloneRowData,
926
+ syncViewport: () => V(),
927
+ history: e.history
928
+ }), {
929
+ captureHistorySnapshot: ee,
930
+ recordHistoryIntentTransaction: te,
931
+ canUndoHistory: Lt,
932
+ canRedoHistory: $e,
933
+ runHistoryAction: Ue
934
+ } = Ne, {
935
+ rowIndexLabel: qe,
936
+ readCell: Xe,
937
+ readDisplayCell: Ye,
938
+ rowClass: Ie,
939
+ toggleGroupRow: ne
940
+ } = Yn({
941
+ mode: e.mode,
942
+ runtime: e.runtime,
943
+ viewportRowStart: H,
944
+ firstColumnKey: e.firstColumnKey
945
+ }), z = xl({
946
+ runtime: e.runtime,
947
+ viewportRowStart: H,
948
+ isRowSelectionColumnKey: R,
949
+ isRowSelectionColumn: y,
950
+ isCellEditableByKey: f,
951
+ readRowSelectionCell: _t,
952
+ readRowSelectionDisplayCell: Gt,
953
+ readCell: Xe,
954
+ readDisplayCell: Ye,
955
+ toggleRowCheckboxSelected: Me,
956
+ captureHistorySnapshot: ee,
957
+ recordHistoryIntentTransaction: te,
958
+ syncViewport: () => V()
959
+ }), {
960
+ readStageCell: se
961
+ } = z, xe = Jn({
962
+ mode: e.mode,
963
+ runtime: L,
964
+ totalRows: i,
965
+ visibleColumns: b,
966
+ viewportRowStart: H,
967
+ resolveSelectionRange: ae,
968
+ resolveCurrentCellCoord: Le,
969
+ applySelectionRange: X,
970
+ clearCellSelection: ye,
971
+ captureRowsSnapshot: ee,
972
+ recordEditTransaction: (t) => {
973
+ te({
974
+ intent: "edit",
975
+ label: "Cell edit"
976
+ }, t);
977
+ },
978
+ readCell: (t, n) => se(t, n),
979
+ readClipboardCell: e.readClipboardCell ? (t, n) => e.readClipboardCell?.(t, n) ?? "" : void 0,
980
+ isCellEditable: f,
981
+ syncViewport: () => V(),
982
+ applyClipboardEdits: e.applyClipboardEdits,
983
+ buildFillMatrixFromRange: e.buildFillMatrixFromRange
984
+ }), {
985
+ normalizeClipboardRange: Je,
986
+ applyClipboardEdits: Ze,
987
+ rangesEqual: Qe,
988
+ buildFillMatrixFromRange: Wt,
989
+ clearPendingClipboardOperation: et,
990
+ copySelectedCells: Ae,
991
+ pasteSelectedCells: tt,
992
+ cutSelectedCells: nt,
993
+ isCellInPendingClipboardRange: Kt,
994
+ isCellOnPendingClipboardEdge: lt
995
+ } = xe, {
996
+ ensureKeyboardActiveCellVisible: le
997
+ } = Zn({
998
+ bodyViewportRef: j,
999
+ visibleColumns: b,
1000
+ resolveColumnWidth: v,
1001
+ normalizedBaseRowHeight: e.normalizedBaseRowHeight,
1002
+ resolveRowHeight: I.resolveRowHeight,
1003
+ resolveRowOffset: I.resolveRowOffset,
1004
+ indexColumnWidth: w.value,
1005
+ defaultColumnWidth: mn,
1006
+ syncViewport: () => V()
1007
+ }), {
1008
+ editingCell: Oe,
1009
+ editingCellValue: ue,
1010
+ editingCellInitialFilter: ce,
1011
+ editingCellOpenOnMount: de,
1012
+ isEditingCell: me,
1013
+ startInlineEdit: ot,
1014
+ commitInlineEdit: rt,
1015
+ cancelInlineEdit: it,
1016
+ handleEditorKeydown: Nt
1017
+ } = Qn({
1018
+ mode: e.mode,
1019
+ bodyViewportRef: j,
1020
+ visibleColumns: b,
1021
+ totalRows: i,
1022
+ runtime: L,
1023
+ readCell: (t, n) => se(t, n),
1024
+ resolveRowIndexById: F,
1025
+ applyCellSelection: (t) => {
1026
+ Re(t, !1);
1027
+ },
1028
+ ensureActiveCellVisible: (t, n) => {
1029
+ le(t, n);
1030
+ },
1031
+ isCellEditable: f,
1032
+ captureRowsSnapshot: ee,
1033
+ recordEditTransaction: (t) => {
1034
+ te({
1035
+ intent: "edit",
1036
+ label: "Cell edit"
1037
+ }, t);
1038
+ }
1039
+ });
1040
+ x = me;
1041
+ const at = m(() => Oe.value), st = {
1042
+ mode: e.mode,
1043
+ runtime: L,
1044
+ totalRows: i,
1045
+ visibleColumns: b,
1046
+ viewportRowStart: H,
1047
+ selectionSnapshot: e.selectionSnapshot,
1048
+ bodyViewportRef: j,
1049
+ indexColumnWidth: w.value,
1050
+ resolveColumnWidth: v,
1051
+ resolveRowHeight: I.resolveRowHeight,
1052
+ resolveRowIndexAtOffset: I.resolveRowIndexAtOffset,
1053
+ normalizeRowId: Ge,
1054
+ normalizeCellCoord: Pe,
1055
+ resolveSelectionRange: ae,
1056
+ applySelectionRange: X,
1057
+ applyCellSelectionByCoord: Re,
1058
+ setCellSelection: G,
1059
+ clearCellSelection: ye,
1060
+ readCell: (t, n) => se(t, n),
1061
+ isCellEditable: f,
1062
+ cloneRowData: e.cloneRowData,
1063
+ resolveRowIndexById: F,
1064
+ captureRowsSnapshot: ee,
1065
+ recordIntentTransaction: (t, n) => {
1066
+ te(t, n);
1067
+ },
1068
+ clearPendingClipboardOperation: et,
1069
+ clearExternalPendingClipboardOperation: e.clearExternalPendingClipboardOperation,
1070
+ copySelectedCells: Ae,
1071
+ pasteSelectedCells: tt,
1072
+ cutSelectedCells: nt,
1073
+ normalizeClipboardRange: Je,
1074
+ applyClipboardEdits: Ze,
1075
+ rangesEqual: Qe,
1076
+ buildFillMatrixFromRange: Wt,
1077
+ applyRangeMove: e.applyRangeMove,
1078
+ syncViewport: () => V(),
1079
+ editingCell: at,
1080
+ startInlineEdit: ot,
1081
+ commitInlineEdit: rt,
1082
+ canUndo: Lt,
1083
+ canRedo: $e,
1084
+ runHistoryAction: Ue,
1085
+ ensureKeyboardActiveCellVisible: le,
1086
+ isContextMenuVisible: e.isContextMenuVisible,
1087
+ closeContextMenu: e.closeContextMenu,
1088
+ openContextMenuFromCurrentCell: e.openContextMenuFromCurrentCell,
1089
+ runRowIndexKeyboardAction: e.runRowIndexKeyboardAction,
1090
+ handleToggleCellAction: (t, n, a, u) => y(u) ? (Me(t), !0) : !1
1091
+ }, ut = el(st), {
1092
+ isPointerSelectingCells: $t,
1093
+ isFillDragging: we,
1094
+ fillPreviewRange: ct,
1095
+ lastAppliedFill: Ut,
1096
+ isRangeMoving: dt,
1097
+ selectionRange: mt,
1098
+ rangeMovePreviewRange: wt,
1099
+ stopPointerSelection: Fe,
1100
+ stopFillSelection: qt,
1101
+ startFillHandleDrag: De,
1102
+ startFillHandleDoubleClick: ft,
1103
+ applyLastFillBehavior: Xt,
1104
+ handleCellMouseDown: Yt,
1105
+ handleCellKeydown: Ct,
1106
+ handleRowIndexKeydown: Jt,
1107
+ handleWindowMouseMove: fe,
1108
+ handleWindowMouseUp: Zt,
1109
+ isCellInFillPreview: B,
1110
+ isFillHandleCell: gt,
1111
+ clearSelectedCells: Qt,
1112
+ dispose: Y
1113
+ } = ut, Ee = kl({
1114
+ runtime: L,
1115
+ selectionSnapshot: e.selectionSnapshot,
1116
+ totalRows: i,
1117
+ orderedVisibleColumns: b,
1118
+ viewportRowStart: H,
1119
+ applySelectionRange: X,
1120
+ handleCellKeydown: Ct
1121
+ }), {
1122
+ isColumnResizing: en,
1123
+ startResize: tn,
1124
+ handleResizeDoubleClick: nn,
1125
+ applyColumnResizeFromPointer: ln,
1126
+ stopColumnResize: Ce,
1127
+ dispose: on
1128
+ } = tl({
1129
+ visibleColumns: b,
1130
+ rows: e.rows,
1131
+ persistColumnWidth: (t, n) => {
1132
+ e.runtime.api.columns.setWidth(t, n);
1133
+ },
1134
+ defaultColumnWidth: mn,
1135
+ minColumnWidth: zl,
1136
+ autoSizeSampleLimit: jl,
1137
+ autoSizeCharWidth: 7.2,
1138
+ autoSizeHorizontalPadding: 42,
1139
+ autoSizeMaxWidth: 640,
1140
+ isFillDragging: () => we.value,
1141
+ stopFillSelection: () => {
1142
+ qt(!1);
1143
+ },
1144
+ isDragSelecting: () => $t.value,
1145
+ stopDragSelection: () => {
1146
+ Fe();
1147
+ },
1148
+ readCellText: (t, n) => {
1149
+ const a = t[n];
1150
+ return a == null ? "" : String(a);
1151
+ }
1152
+ }), ke = Hl({
1153
+ mode: e.mode,
1154
+ viewportRowStart: H,
1155
+ selectionAnchorCell: pe,
1156
+ fillPreviewRange: ct,
1157
+ isFillDragging: we,
1158
+ interactionSelectionRange: mt,
1159
+ resolveCommittedSelectionRange: ae,
1160
+ isCommittedSelectionAnchorCell: We,
1161
+ isCommittedCellSelected: Se,
1162
+ shouldHighlightCommittedSelectedCell: jt,
1163
+ isCommittedCellOnSelectionEdge: Bt
1164
+ }), { selectionRange: vt } = ke, ge = Ol({
1165
+ lastAppliedFill: Ut,
1166
+ selectionRange: vt,
1167
+ isFillDragging: we
1168
+ }), rn = El({
1169
+ bodyViewportRef: j,
1170
+ isColumnResizing: en,
1171
+ applyColumnResizeFromPointer: ln,
1172
+ stopColumnResize: Ce,
1173
+ handleInteractionWindowMouseMove: fe,
1174
+ handleInteractionWindowMouseUp: Zt,
1175
+ syncViewport: V
1176
+ }), O = {
1177
+ rowSelection: Ke,
1178
+ history: Ne,
1179
+ cellIo: z,
1180
+ viewportKeyboard: Ee,
1181
+ visualSelection: ke,
1182
+ fillAction: ge,
1183
+ scrollSync: rn
1184
+ }, {
1185
+ tableStageProps: an,
1186
+ tableStageContext: sn
1187
+ } = Il({
1188
+ mode: e.mode,
1189
+ rowHeightMode: e.rowHeightMode,
1190
+ visibleColumns: b,
1191
+ renderedColumns: Mt,
1192
+ displayRows: ze,
1193
+ pinnedBottomRows: pt,
1194
+ sourceRows: e.sourceRows ?? e.rows,
1195
+ showRowIndex: l,
1196
+ rowHover: m(() => e.rowHover?.value === !0),
1197
+ stripedRows: m(() => e.stripedRows?.value === !0),
1198
+ columnFilterTextByKey: e.columnFilterTextByKey,
1199
+ gridContentStyle: Dt,
1200
+ mainTrackStyle: he,
1201
+ indexColumnStyle: Pt,
1202
+ topSpacerHeight: xt,
1203
+ bottomSpacerHeight: At,
1204
+ viewportRowStart: H,
1205
+ columnWindowStart: It,
1206
+ leftColumnSpacerWidth: Ot,
1207
+ rightColumnSpacerWidth: Ft,
1208
+ editingCellValueRef: ue,
1209
+ editingCellInitialFilter: ce,
1210
+ editingCellOpenOnMount: de,
1211
+ selectionRange: vt,
1212
+ selectionAnchorCell: pe,
1213
+ fillPreviewRange: ct,
1214
+ rangeMovePreviewRange: wt,
1215
+ isFillDragging: we,
1216
+ isRangeMoving: dt,
1217
+ headerViewportRef: N,
1218
+ bodyViewportRef: j,
1219
+ columnStyle: Tt,
1220
+ toggleSortForColumn: e.toggleSortForColumn,
1221
+ sortIndicator: e.sortIndicator,
1222
+ setColumnFilterText: e.setColumnFilterText,
1223
+ columnMenuEnabled: e.columnMenuEnabled,
1224
+ columnMenuValueFilterEnabled: e.columnMenuValueFilterEnabled,
1225
+ columnMenuValueFilterRowLimit: e.columnMenuValueFilterRowLimit,
1226
+ columnMenuMaxFilterValues: e.columnMenuMaxFilterValues,
1227
+ resolveColumnMenuItems: e.resolveColumnMenuItems,
1228
+ resolveColumnMenuDisabledItems: e.resolveColumnMenuDisabledItems,
1229
+ resolveColumnMenuDisabledReasons: e.resolveColumnMenuDisabledReasons,
1230
+ resolveColumnMenuLabels: e.resolveColumnMenuLabels,
1231
+ resolveColumnMenuActionOptions: e.resolveColumnMenuActionOptions,
1232
+ isColumnFilterActive: e.isColumnFilterActive,
1233
+ isColumnGrouped: e.isColumnGrouped,
1234
+ resolveColumnGroupOrder: e.resolveColumnGroupOrder,
1235
+ resolveColumnMenuSortDirection: e.resolveColumnMenuSortDirection,
1236
+ resolveColumnMenuSelectedTokens: e.resolveColumnMenuSelectedTokens,
1237
+ applyColumnMenuSort: e.applyColumnMenuSort,
1238
+ applyColumnMenuPin: e.applyColumnMenuPin,
1239
+ applyColumnMenuGroupBy: e.applyColumnMenuGroupBy,
1240
+ applyColumnMenuFilter: e.applyColumnMenuFilter,
1241
+ clearColumnMenuFilter: e.clearColumnMenuFilter,
1242
+ handleHeaderWheel: O.scrollSync.handleHeaderWheel,
1243
+ handleHeaderScroll: O.scrollSync.handleHeaderScroll,
1244
+ handleViewportScroll: Ht,
1245
+ handleViewportKeydown: O.viewportKeyboard.handleViewportKeydown,
1246
+ rowClass: Ie,
1247
+ isRowAutosizeProbe: Te,
1248
+ rowStyle: re,
1249
+ isRowInPendingClipboardCut: e.isRowInPendingClipboardCut,
1250
+ isRowFocused: O.rowSelection.isRowFocused,
1251
+ isRowCheckboxSelected: O.rowSelection.isRowCheckboxSelected,
1252
+ allVisibleRowsSelected: O.rowSelection.areAllVisibleRowsSelected,
1253
+ someVisibleRowsSelected: O.rowSelection.areSomeVisibleRowsSelected,
1254
+ handleRowClick: O.rowSelection.focusRow,
1255
+ handleRowIndexClick: O.rowSelection.selectRowRange,
1256
+ handleRowIndexKeydown: Jt,
1257
+ handleToggleAllVisibleRows: O.rowSelection.toggleVisibleRowsSelected,
1258
+ toggleGroupRow: ne,
1259
+ rowIndexLabel: qe,
1260
+ startResize: tn,
1261
+ handleResizeDoubleClick: nn,
1262
+ startRowResize: ie,
1263
+ autosizeRow: Be,
1264
+ isCellSelected: O.visualSelection.isCellSelected,
1265
+ isSelectionAnchorCell: O.visualSelection.isSelectionAnchorCell,
1266
+ shouldHighlightSelectedCell: O.visualSelection.shouldHighlightSelectedCell,
1267
+ isCellOnSelectionEdge: O.visualSelection.isCellOnSelectionEdge,
1268
+ isCellInFillPreview: B,
1269
+ isCellInPendingClipboardRange: Kt,
1270
+ isCellOnPendingClipboardEdge: lt,
1271
+ isEditingCell: me,
1272
+ isCellEditable: (t, n, a, u) => g(t, H.value + n, a),
1273
+ handleCellMouseDown: Yt,
1274
+ handleCellClick: O.cellIo.handleCellClick,
1275
+ handleCellKeydown: Ct,
1276
+ startInlineEdit: ot,
1277
+ isFillHandleCell: gt,
1278
+ startFillHandleDrag: De,
1279
+ startFillHandleDoubleClick: ft,
1280
+ fillActionAnchorCell: O.fillAction.fillActionAnchorCell,
1281
+ fillActionBehavior: O.fillAction.fillActionBehavior,
1282
+ applyFillActionBehavior: Xt,
1283
+ handleEditorKeydown: Nt,
1284
+ commitInlineEdit: rt,
1285
+ cancelInlineEdit: it,
1286
+ readCell: O.cellIo.readStageCell,
1287
+ readDisplayCell: O.cellIo.readStageDisplayCell
1288
+ });
1289
+ return nl({
1290
+ mode: e.mode,
1291
+ rows: e.rows,
1292
+ runtime: e.runtime,
1293
+ totalRows: s,
1294
+ rowVersion: e.rowVersion,
1295
+ rowHeightMode: e.rowHeightMode,
1296
+ normalizedBaseRowHeight: e.normalizedBaseRowHeight,
1297
+ syncSelectionSnapshotFromRuntime: e.syncSelectionSnapshotFromRuntime,
1298
+ syncRowSelectionSnapshotFromRuntime: o,
1299
+ syncViewport: V,
1300
+ scheduleViewportSync: Vt,
1301
+ measureVisibleRowHeights: je,
1302
+ applyRowHeightSettings: e.applyRowHeightSettings
1303
+ }), ll({
1304
+ bodyViewportRef: j,
1305
+ syncViewport: V,
1306
+ handleWindowMouseMove: O.scrollSync.handleWindowMouseMove,
1307
+ handleWindowMouseUp: O.scrollSync.handleWindowMouseUp,
1308
+ cancelScheduledViewportSync: zt,
1309
+ onAfterMount: () => {
1310
+ e.syncSelectionSnapshotFromRuntime(), o(), Dn(() => {
1311
+ e.applyRowHeightSettings(), V();
1312
+ });
1313
+ },
1314
+ dispose: [
1315
+ _e,
1316
+ on,
1317
+ Y,
1318
+ O.history.disposeIntentHistory
1319
+ ]
1320
+ }), {
1321
+ tableStageProps: an,
1322
+ tableStageContext: sn,
1323
+ syncViewportFromDom: V,
1324
+ copySelectedCells: Ae,
1325
+ pasteSelectedCells: tt,
1326
+ cutSelectedCells: nt,
1327
+ clearSelectedCells: Qt,
1328
+ captureHistorySnapshot: ee,
1329
+ recordHistoryIntentTransaction: te
1330
+ };
1331
+ }
1332
+ const _l = yt(() => import("./DataGridColumnLayoutPopover-Qt56b3CA.js")), Gl = yt(() => import("./DataGridAdvancedFilterPopover-Bak_CkaO.js")), Pl = yt(() => import("./DataGridAggregationsPopover-DfQ3-UV4.js")), Ll = yt(() => import("./DataGridGanttStageEntry-B9YlOHt1.js"));
1333
+ function Wl(e) {
1334
+ return Number.isFinite(e) ? Math.max(24, Math.trunc(e)) : 31;
1335
+ }
1336
+ function Kl(e) {
1337
+ return typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e) : e.replace(/\\/g, "\\\\").replace(/\"/g, '\\"');
1338
+ }
1339
+ function Mn(e) {
1340
+ return (e ?? []).map((o) => ({
1341
+ key: o.key,
1342
+ direction: o.direction
1343
+ }));
1344
+ }
1345
+ function Cn() {
1346
+ return {
1347
+ columnFilters: {},
1348
+ advancedFilters: {},
1349
+ advancedExpression: null
1350
+ };
1351
+ }
1352
+ function He(e) {
1353
+ return Kn(e ?? Cn()) ?? Cn();
1354
+ }
1355
+ function gn(e) {
1356
+ return e.startsWith("string:") ? `string:${e.slice(7).toLowerCase()}` : e;
1357
+ }
1358
+ function Nl(e) {
1359
+ const o = {};
1360
+ for (const [s, i] of Object.entries(e.columnFilters ?? {})) {
1361
+ if (i.kind === "valueSet") {
1362
+ const w = Array.from(new Set(
1363
+ (i.tokens ?? []).map((C) => gn(String(C ?? ""))).filter((C) => C.length > 0)
1364
+ ));
1365
+ if (w.length === 0)
1366
+ continue;
1367
+ o[s] = {
1368
+ kind: "valueSet",
1369
+ tokens: w
1370
+ };
1371
+ continue;
1372
+ }
1373
+ o[s] = {
1374
+ kind: "predicate",
1375
+ operator: i.operator,
1376
+ value: i.value,
1377
+ value2: i.value2,
1378
+ caseSensitive: i.caseSensitive
1379
+ };
1380
+ }
1381
+ const r = { ...e.advancedFilters ?? {} }, l = e.advancedExpression ?? null;
1382
+ return Object.keys(o).length === 0 && Object.keys(r).length === 0 && !l ? null : {
1383
+ columnFilters: o,
1384
+ advancedFilters: r,
1385
+ advancedExpression: l
1386
+ };
1387
+ }
1388
+ function $l(e) {
1389
+ const o = {}, r = e?.columnFilters ?? {};
1390
+ for (const [l, s] of Object.entries(r))
1391
+ s?.kind === "predicate" && typeof s.value == "string" && (o[l] = s.value);
1392
+ return o;
1393
+ }
1394
+ function J(e) {
1395
+ if (typeof globalThis.structuredClone == "function")
1396
+ try {
1397
+ return globalThis.structuredClone(e);
1398
+ } catch {
1399
+ }
1400
+ return vn(e, /* @__PURE__ */ new WeakMap());
1401
+ }
1402
+ function vn(e, o) {
1403
+ if (e == null || typeof e != "object")
1404
+ return e;
1405
+ if (e instanceof Date)
1406
+ return new Date(e.getTime());
1407
+ if (Array.isArray(e)) {
1408
+ if (o.has(e))
1409
+ return o.get(e);
1410
+ const r = [];
1411
+ o.set(e, r);
1412
+ for (const l of e)
1413
+ r.push(vn(l, o));
1414
+ return r;
1415
+ }
1416
+ if (Bn(e)) {
1417
+ if (o.has(e))
1418
+ return o.get(e);
1419
+ const r = {};
1420
+ o.set(e, r);
1421
+ for (const [l, s] of Object.entries(e))
1422
+ r[l] = vn(s, o);
1423
+ return r;
1424
+ }
1425
+ return e && typeof e == "object" ? { ...e } : e;
1426
+ }
1427
+ function Bn(e) {
1428
+ if (!e || typeof e != "object")
1429
+ return !1;
1430
+ const o = Object.getPrototypeOf(e);
1431
+ return o === Object.prototype || o === null;
1432
+ }
1433
+ function Ul(e) {
1434
+ const o = /* @__PURE__ */ new WeakSet();
1435
+ try {
1436
+ return JSON.stringify(e, (r, l) => {
1437
+ if (l == null || typeof l != "object")
1438
+ return l;
1439
+ if (l instanceof Date)
1440
+ return l.toISOString();
1441
+ if (Array.isArray(l) || Bn(l))
1442
+ return o.has(l) ? void 0 : (o.add(l), l);
1443
+ });
1444
+ } catch {
1445
+ return null;
1446
+ }
1447
+ }
1448
+ function Ve(e) {
1449
+ return e ? {
1450
+ columns: e.columns.map((o) => ({ ...o })),
1451
+ basis: e.basis === "source" ? "source" : "filtered"
1452
+ } : null;
1453
+ }
1454
+ function ql(e) {
1455
+ return e ? {
1456
+ fields: [...e.fields],
1457
+ expandedByDefault: e.expandedByDefault
1458
+ } : null;
1459
+ }
1460
+ function U(e) {
1461
+ return e == null ? "blank" : e instanceof Date ? e.toISOString() : typeof e == "string" ? `"${e}"` : String(e);
1462
+ }
1463
+ function oe(e) {
1464
+ switch (e) {
1465
+ case "contains":
1466
+ return "contains";
1467
+ case "startsWith":
1468
+ case "starts-with":
1469
+ return "starts with";
1470
+ case "endsWith":
1471
+ case "ends-with":
1472
+ return "ends with";
1473
+ case "equals":
1474
+ return "=";
1475
+ case "notEquals":
1476
+ case "not-equals":
1477
+ return "!=";
1478
+ case "gt":
1479
+ return ">";
1480
+ case "gte":
1481
+ return ">=";
1482
+ case "lt":
1483
+ return "<";
1484
+ case "lte":
1485
+ return "<=";
1486
+ case "between":
1487
+ return "between";
1488
+ case "isEmpty":
1489
+ case "is-empty":
1490
+ return "is empty";
1491
+ case "notEmpty":
1492
+ case "not-empty":
1493
+ return "is not empty";
1494
+ case "isNull":
1495
+ case "is-null":
1496
+ return "is null";
1497
+ case "notNull":
1498
+ case "not-null":
1499
+ return "is not null";
1500
+ default:
1501
+ return e;
1502
+ }
1503
+ }
1504
+ function Xl(e) {
1505
+ const o = String(e ?? "");
1506
+ if (o === "null")
1507
+ return "(Blanks)";
1508
+ const r = o.indexOf(":");
1509
+ if (r < 0)
1510
+ return o;
1511
+ const l = o.slice(0, r), s = o.slice(r + 1);
1512
+ return l === "string" || l === "number" || l === "boolean" || l === "bigint" || l === "date" || l === "repr" || l === "json" ? s : o;
1513
+ }
1514
+ function Yl(e, o) {
1515
+ return o.kind === "valueSet" ? o.tokens.length === 1 ? `${e}: ${Xl(o.tokens[0] ?? "")}` : `${e}: ${o.tokens.length} values` : o.operator === "between" ? `${e} between ${U(o.value)} and ${U(o.value2)}` : o.operator === "isEmpty" || o.operator === "notEmpty" || o.operator === "isNull" || o.operator === "notNull" ? `${e} ${oe(o.operator)}` : `${e} ${oe(o.operator)} ${U(o.value)}`;
1516
+ }
1517
+ function Jl(e, o) {
1518
+ const r = o.clauses.map((l, s) => {
1519
+ const i = s === 0 ? "" : `${String(l.join ?? "and").toUpperCase()} `;
1520
+ return l.operator === "between" ? `${i}${oe(l.operator)} ${U(l.value)} and ${U(l.value2)}` : l.operator === "isEmpty" || l.operator === "notEmpty" || l.operator === "isNull" || l.operator === "notNull" ? `${i}${oe(l.operator)}` : `${i}${oe(l.operator)} ${U(l.value)}`;
1521
+ }).filter((l) => l.length > 0);
1522
+ return r.length === 0 ? `${e}: active` : `${e} ${r.join(" ")}`;
1523
+ }
1524
+ function bn(e, o) {
1525
+ if (e.kind === "condition") {
1526
+ const r = o(e.key);
1527
+ return e.operator === "between" ? `${r} between ${U(e.value)} and ${U(e.value2)}` : e.operator === "isEmpty" || e.operator === "notEmpty" || e.operator === "isNull" || e.operator === "notNull" ? `${r} ${oe(e.operator)}` : `${r} ${oe(e.operator)} ${U(e.value)}`;
1528
+ }
1529
+ return e.kind === "not" ? `NOT (${bn(e.child, o)})` : e.children.map((r) => bn(r, o)).filter((r) => r.length > 0).join(` ${e.operator.toUpperCase()} `);
1530
+ }
1531
+ const Zl = [
1532
+ "sum",
1533
+ "avg",
1534
+ "min",
1535
+ "max",
1536
+ "count",
1537
+ "countNonNull",
1538
+ "first",
1539
+ "last"
1540
+ ], Ql = [
1541
+ "min",
1542
+ "max",
1543
+ "count",
1544
+ "countNonNull",
1545
+ "first",
1546
+ "last"
1547
+ ], eo = [
1548
+ "count",
1549
+ "countNonNull",
1550
+ "first",
1551
+ "last"
1552
+ ];
1553
+ function to(e) {
1554
+ return e === "number" || e === "currency" || e === "percent" ? Zl : e === "date" || e === "datetime" ? Ql : eo;
1555
+ }
1556
+ const no = {
1557
+ clipboard: ["cut", "copy", "paste"],
1558
+ edit: ["clear"]
1559
+ }, lo = {
1560
+ insert: ["insert-row-above", "insert-row-below"],
1561
+ clipboard: ["cut-row", "copy-row", "paste-row"],
1562
+ selection: ["delete-selected-rows"]
1563
+ }, In = {
1564
+ cut: "Cut",
1565
+ copy: "Copy",
1566
+ paste: "Paste",
1567
+ clear: "Clear values",
1568
+ "insert-row-above": "Insert above",
1569
+ "insert-row-below": "Insert below",
1570
+ "copy-row": "Copy row",
1571
+ "paste-row": "Paste row",
1572
+ "cut-row": "Cut row",
1573
+ "delete-selected-rows": "Delete selected rows",
1574
+ "sort-asc": "Sort ascending",
1575
+ "sort-desc": "Sort descending",
1576
+ "sort-clear": "Clear sort",
1577
+ filter: "Filter column",
1578
+ "auto-size": "Auto size column"
1579
+ }, oo = {
1580
+ "insert-row-above": "Insert / Ctrl/Cmd+I",
1581
+ "copy-row": "Ctrl/Cmd+C",
1582
+ "paste-row": "Ctrl/Cmd+V",
1583
+ "cut-row": "Ctrl/Cmd+X"
1584
+ }, So = Fn({
1585
+ name: "DataGridDefaultRenderer",
1586
+ props: {
1587
+ mode: {
1588
+ type: String,
1589
+ required: !0
1590
+ },
1591
+ rows: {
1592
+ type: Array,
1593
+ default: () => []
1594
+ },
1595
+ runtime: {
1596
+ type: Object,
1597
+ required: !0
1598
+ },
1599
+ runtimeRowModel: {
1600
+ type: Object,
1601
+ required: !0
1602
+ },
1603
+ selectionSnapshot: {
1604
+ type: Object,
1605
+ required: !0
1606
+ },
1607
+ selectionAnchor: {
1608
+ type: Object,
1609
+ required: !0
1610
+ },
1611
+ rowSelectionSnapshot: {
1612
+ type: Object,
1613
+ required: !0
1614
+ },
1615
+ syncSelectionSnapshotFromRuntime: {
1616
+ type: Function,
1617
+ required: !0
1618
+ },
1619
+ syncRowSelectionSnapshotFromRuntime: {
1620
+ type: Function,
1621
+ default: () => {
1622
+ }
1623
+ },
1624
+ sortModel: {
1625
+ type: Array,
1626
+ default: void 0
1627
+ },
1628
+ filterModel: {
1629
+ type: Object,
1630
+ default: void 0
1631
+ },
1632
+ groupBy: {
1633
+ type: Object,
1634
+ default: void 0
1635
+ },
1636
+ pivotModel: {
1637
+ type: Object,
1638
+ default: void 0
1639
+ },
1640
+ renderMode: {
1641
+ type: String,
1642
+ default: "virtualization"
1643
+ },
1644
+ virtualization: {
1645
+ type: Object,
1646
+ required: !0
1647
+ },
1648
+ columnMenu: {
1649
+ type: Object,
1650
+ required: !0
1651
+ },
1652
+ cellMenu: {
1653
+ type: Object,
1654
+ required: !0
1655
+ },
1656
+ rowIndexMenu: {
1657
+ type: Object,
1658
+ required: !0
1659
+ },
1660
+ columnLayout: {
1661
+ type: Object,
1662
+ required: !0
1663
+ },
1664
+ aggregations: {
1665
+ type: Object,
1666
+ required: !0
1667
+ },
1668
+ advancedFilter: {
1669
+ type: Object,
1670
+ required: !0
1671
+ },
1672
+ rowHeightMode: {
1673
+ type: String,
1674
+ default: "fixed"
1675
+ },
1676
+ baseRowHeight: {
1677
+ type: Number,
1678
+ default: 31
1679
+ },
1680
+ rowHover: {
1681
+ type: Boolean,
1682
+ default: !1
1683
+ },
1684
+ stripedRows: {
1685
+ type: Boolean,
1686
+ default: !1
1687
+ },
1688
+ showRowIndex: {
1689
+ type: Boolean,
1690
+ default: !0
1691
+ },
1692
+ rowSelection: {
1693
+ type: Boolean,
1694
+ default: !0
1695
+ },
1696
+ isCellEditable: {
1697
+ type: Function,
1698
+ default: void 0
1699
+ },
1700
+ viewMode: {
1701
+ type: String,
1702
+ default: "table"
1703
+ },
1704
+ gantt: {
1705
+ type: [Boolean, Object],
1706
+ default: void 0
1707
+ },
1708
+ toolbarModules: {
1709
+ type: Array,
1710
+ default: () => []
1711
+ },
1712
+ inspectorPanel: {
1713
+ type: Object,
1714
+ default: null
1715
+ }
1716
+ },
1717
+ setup(e) {
1718
+ const o = W(0), r = W(Mn(e.sortModel)), l = W(He(e.filterModel)), s = m(() => $l(l.value));
1719
+ let i = "";
1720
+ const w = () => {
1721
+ const t = e.runtimeRowModel.getSnapshot();
1722
+ return [
1723
+ t.kind,
1724
+ t.revision ?? "",
1725
+ t.rowCount,
1726
+ t.loading ? 1 : 0,
1727
+ t.projection?.recomputeVersion ?? t.projection?.version ?? ""
1728
+ ].join("|");
1729
+ };
1730
+ i = w();
1731
+ const C = e.runtimeRowModel.subscribe(() => {
1732
+ const t = w();
1733
+ t !== i && (i = t, o.value += 1);
1734
+ });
1735
+ En(() => {
1736
+ C();
1737
+ }), K(
1738
+ () => e.sortModel,
1739
+ (t) => {
1740
+ r.value = Mn(t);
1741
+ },
1742
+ { deep: !0 }
1743
+ ), K(
1744
+ () => e.filterModel,
1745
+ (t) => {
1746
+ l.value = He(t);
1747
+ },
1748
+ { deep: !0 }
1749
+ );
1750
+ const b = m(() => e.mode), A = m(() => e.rows), v = m(() => (o.value, e.runtime.api.rows.getSnapshot().rowCount)), R = m(() => e.runtime.columnSnapshot.value.visibleColumns), y = m(() => e.runtime.columnSnapshot.value.columns ?? []), g = m(() => R.value.filter((t) => t.visible !== !1).map((t) => ({
1751
+ key: t.key,
1752
+ label: t.column.label ?? t.key
1753
+ }))), f = m(() => y.value.map((t) => ({
1754
+ key: t.key,
1755
+ label: t.column.label ?? t.key,
1756
+ visible: t.visible !== !1
1757
+ }))), M = m(() => y.value.filter((t) => t.column.capabilities?.aggregatable === !0).map((t) => ({
1758
+ key: t.key,
1759
+ label: t.column.label ?? t.key,
1760
+ allowedOps: to(t.column.dataType)
1761
+ }))), I = W(e.rowHeightMode), x = m(() => Wl(e.baseRowHeight)), N = m(() => R.value[0]?.key ?? "name"), j = m(() => {
1762
+ const t = /* @__PURE__ */ new Map();
1763
+ for (const n of y.value)
1764
+ t.set(n.key, n.column.label ?? n.key);
1765
+ return t;
1766
+ }), {
1767
+ isColumnLayoutPanelOpen: ze,
1768
+ columnLayoutPanelItems: pt,
1769
+ openColumnLayoutPanel: Mt,
1770
+ cancelColumnLayoutPanel: H,
1771
+ applyColumnLayoutPanel: It,
1772
+ moveColumnUp: xt,
1773
+ moveColumnDown: At,
1774
+ updateColumnVisibility: Ot
1775
+ } = ol({
1776
+ resolveColumns: () => f.value,
1777
+ applyColumnLayout: (t) => {
1778
+ e.runtime.api.columns.setOrder(t.order);
1779
+ for (const [n, a] of Object.entries(t.visibilityByKey))
1780
+ e.runtime.api.columns.setVisibility(n, a);
1781
+ }
1782
+ }), {
1783
+ isAdvancedFilterPanelOpen: Ft,
1784
+ advancedFilterDraftClauses: Dt,
1785
+ appliedAdvancedFilterExpression: he,
1786
+ openAdvancedFilterPanel: Et,
1787
+ addAdvancedFilterClause: kt,
1788
+ removeAdvancedFilterClause: Ht,
1789
+ updateAdvancedFilterClause: V,
1790
+ cancelAdvancedFilterPanel: Vt,
1791
+ applyAdvancedFilterPanel: zt,
1792
+ clearAdvancedFilterPanel: Tt
1793
+ } = rl({
1794
+ resolveColumns: () => g.value
1795
+ }), q = W(!1), F = W(null), L = m(() => !!e.groupBy?.fields?.length), re = m(() => (o.value, Ve(e.runtime.api.rows.getAggregationModel()))), Te = m(() => (o.value, ql(e.runtime.api.rows.getSnapshot().groupBy))), je = m(() => {
1796
+ const t = new Map(
1797
+ (F.value?.columns ?? []).map((n) => [n.key, n.op])
1798
+ );
1799
+ return M.value.map((n) => {
1800
+ const a = n.allowedOps[0] ?? "count", u = t.get(n.key), d = u && n.allowedOps.includes(u) ? u : a;
1801
+ return {
1802
+ key: n.key,
1803
+ label: n.label,
1804
+ enabled: t.has(n.key),
1805
+ op: d,
1806
+ allowedOps: n.allowedOps
1807
+ };
1808
+ });
1809
+ }), ie = m(() => F.value?.basis === "source" ? "source" : "filtered");
1810
+ K(
1811
+ re,
1812
+ (t) => {
1813
+ q.value || (F.value = Ve(t));
1814
+ },
1815
+ { immediate: !0, deep: !0 }
1816
+ ), K(
1817
+ () => e.rowHeightMode,
1818
+ (t) => {
1819
+ I.value = t;
1820
+ }
1821
+ );
1822
+ const Be = (t) => {
1823
+ const n = l.value.columnFilters?.[t];
1824
+ return n ? n.kind === "valueSet" ? n.tokens.length > 0 : !0 : !1;
1825
+ }, _e = (t) => {
1826
+ const n = l.value.columnFilters?.[t];
1827
+ return !n || n.kind !== "valueSet" ? [] : n.tokens.map((a) => gn(String(a ?? "")));
1828
+ }, Q = (t) => Tn(e.columnMenu, t), Ge = (t) => wl(e.columnMenu, t), Pe = (t) => Cl(e.columnMenu, t), ae = (t) => fl(e.columnMenu, t), Le = (t) => gl(e.columnMenu, t), X = (t) => {
1829
+ const n = Te.value?.fields.findIndex((a) => a === t) ?? -1;
1830
+ return n >= 0 ? n : null;
1831
+ }, Re = (t) => X(t) !== null, G = () => {
1832
+ const t = r.value.map((a) => ({
1833
+ key: a.key,
1834
+ direction: a.direction
1835
+ })), n = e.advancedFilter.enabled ? he.value : l.value.advancedExpression ?? null;
1836
+ e.runtime.api.rows.setSortAndFilterModel({
1837
+ sortModel: t,
1838
+ filterModel: Nl({
1839
+ ...l.value,
1840
+ advancedExpression: n
1841
+ })
1842
+ });
1843
+ }, ye = m(() => e.advancedFilter.enabled ? he.value ?? l.value.advancedExpression ?? null : l.value.advancedExpression ?? null), Se = m(() => {
1844
+ const t = (a) => j.value.get(a) ?? a, n = [];
1845
+ for (const [a, u] of Object.entries(l.value.columnFilters ?? {}))
1846
+ u && n.push(Yl(t(a), u));
1847
+ for (const [a, u] of Object.entries(l.value.advancedFilters ?? {}))
1848
+ u && n.push(`Advanced: ${Jl(t(a), u)}`);
1849
+ return ye.value && n.push(`Advanced: ${bn(ye.value, t)}`), Object.freeze(n);
1850
+ }), We = m(() => Se.value.length > 0), jt = () => {
1851
+ l.value = Cn(), Tt(), G();
1852
+ };
1853
+ K(
1854
+ he,
1855
+ () => {
1856
+ e.advancedFilter.enabled && G();
1857
+ },
1858
+ { deep: !0 }
1859
+ );
1860
+ const Bt = (t, n = !1) => {
1861
+ const a = r.value.findIndex((d) => d.key === t), u = a >= 0 ? r.value[a] : null;
1862
+ if (!u) {
1863
+ const d = { key: t, direction: "asc" };
1864
+ r.value = n ? [...r.value, d] : [d], G();
1865
+ return;
1866
+ }
1867
+ if (u.direction === "asc") {
1868
+ const d = { key: t, direction: "desc" };
1869
+ n ? r.value = r.value.map((h) => h.key === t ? d : h) : r.value = [d], G();
1870
+ return;
1871
+ }
1872
+ r.value = n ? r.value.filter((d) => d.key !== t) : [], G();
1873
+ }, pe = (t) => {
1874
+ const n = r.value.findIndex((d) => d.key === t);
1875
+ if (n < 0)
1876
+ return "";
1877
+ const a = r.value[n];
1878
+ if (!a)
1879
+ return "";
1880
+ const u = a.direction === "asc" ? "↑" : "↓";
1881
+ return r.value.length > 1 ? `${u}${n + 1}` : u;
1882
+ }, Ke = (t, n) => {
1883
+ const a = He(l.value), u = n.trim();
1884
+ u ? a.columnFilters[t] = {
1885
+ kind: "predicate",
1886
+ operator: "contains",
1887
+ value: u,
1888
+ caseSensitive: !1
1889
+ } : delete a.columnFilters[t], l.value = a, G();
1890
+ }, _t = () => {
1891
+ e.runtime.api.view.setRowHeightMode(I.value), e.runtime.api.view.setBaseRowHeight(x.value);
1892
+ }, Gt = () => {
1893
+ F.value = Ve(re.value), q.value = !0;
1894
+ }, Me = () => {
1895
+ F.value = Ve(re.value), q.value = !1;
1896
+ };
1897
+ K(
1898
+ L,
1899
+ (t) => {
1900
+ t || Me();
1901
+ },
1902
+ { immediate: !0 }
1903
+ );
1904
+ const Pt = () => {
1905
+ F.value = null;
1906
+ }, Ne = (t) => {
1907
+ F.value = {
1908
+ basis: t,
1909
+ columns: F.value?.columns ?? []
1910
+ };
1911
+ }, ee = (t, n) => {
1912
+ const a = M.value.find((S) => S.key === t);
1913
+ if (!a)
1914
+ return;
1915
+ const u = F.value?.columns ?? [];
1916
+ if (!n) {
1917
+ const S = u.filter((D) => D.key !== t);
1918
+ F.value = S.length > 0 ? { basis: ie.value, columns: S } : null;
1919
+ return;
1920
+ }
1921
+ const h = u.find((S) => S.key === t) ?? {
1922
+ key: t,
1923
+ op: a.allowedOps[0] ?? "count"
1924
+ };
1925
+ F.value = {
1926
+ basis: ie.value,
1927
+ columns: [
1928
+ ...u.filter((S) => S.key !== t),
1929
+ h
1930
+ ]
1931
+ };
1932
+ }, te = (t, n) => {
1933
+ const a = M.value.find((d) => d.key === t);
1934
+ if (!a || !a.allowedOps.includes(n))
1935
+ return;
1936
+ const u = (F.value?.columns ?? []).map((d) => d.key !== t ? d : {
1937
+ ...d,
1938
+ op: n
1939
+ });
1940
+ F.value = {
1941
+ basis: ie.value,
1942
+ columns: u
1943
+ };
1944
+ }, Lt = () => {
1945
+ const t = F.value && F.value.columns.length > 0 ? F.value : null;
1946
+ e.runtime.api.rows.setAggregationModel(t), F.value = Ve(t), q.value = !1;
1947
+ }, $e = (t) => r.value.find((n) => n.key === t)?.direction ?? null, Ue = (t, n) => {
1948
+ const a = R.value.find((u) => u.key === t);
1949
+ !a || a.column.capabilities?.sortable === !1 || (r.value = n === null ? r.value.filter((u) => u.key !== t) : [{ key: t, direction: n }], G());
1950
+ }, qe = (t, n) => {
1951
+ e.runtime.api.columns.setPin(t, n);
1952
+ }, Xe = (t, n) => {
1953
+ const a = Te.value, u = n ? Array.from(/* @__PURE__ */ new Set([...a?.fields ?? [], t])) : (a?.fields ?? []).filter((d) => d !== t);
1954
+ e.runtime.api.rows.setGroupBy(u.length > 0 ? {
1955
+ fields: u,
1956
+ expandedByDefault: a?.expandedByDefault ?? !0
1957
+ } : null);
1958
+ }, Ye = (t, n) => {
1959
+ const a = Array.from(new Set(
1960
+ n.map((d) => gn(String(d ?? ""))).filter((d) => d.length > 0)
1961
+ ));
1962
+ if (a.length === 0) {
1963
+ Ie(t);
1964
+ return;
1965
+ }
1966
+ const u = He(l.value);
1967
+ u.columnFilters[t] = {
1968
+ kind: "valueSet",
1969
+ tokens: a
1970
+ }, l.value = u, G();
1971
+ }, Ie = (t) => {
1972
+ const n = He(l.value);
1973
+ delete n.columnFilters[t], l.value = n, G();
1974
+ }, ne = W(null), z = W(null);
1975
+ let se = 0;
1976
+ const xe = () => {
1977
+ const t = e.selectionSnapshot.value, n = t?.ranges[t.activeRangeIndex] ?? null;
1978
+ return n ? {
1979
+ startRow: n.startRow,
1980
+ endRow: n.endRow,
1981
+ startColumn: n.startCol,
1982
+ endColumn: n.endCol
1983
+ } : null;
1984
+ }, Je = () => {
1985
+ const t = e.selectionSnapshot.value?.activeCell;
1986
+ return t ? {
1987
+ rowIndex: t.rowIndex,
1988
+ columnIndex: t.colIndex
1989
+ } : null;
1990
+ }, Ze = (t) => t ? t.startRow !== t.endRow || t.startColumn !== t.endColumn : !1, Qe = (t, n) => t.rowIndex >= Math.min(n.startRow, n.endRow) && t.rowIndex <= Math.max(n.startRow, n.endRow) && t.columnIndex >= Math.min(n.startColumn, n.endColumn) && t.columnIndex <= Math.max(n.startColumn, n.endColumn), Wt = (t, n) => {
1991
+ const a = e.runtime.resolveBodyRowIndexById(t), u = R.value.findIndex((d) => d.key === n);
1992
+ return a < 0 || u < 0 ? null : { rowIndex: a, columnIndex: u };
1993
+ }, et = (t) => ({
1994
+ ranges: [{
1995
+ startRow: t.rowIndex,
1996
+ endRow: t.rowIndex,
1997
+ startCol: t.columnIndex,
1998
+ endCol: t.columnIndex,
1999
+ anchor: {
2000
+ rowIndex: t.rowIndex,
2001
+ colIndex: t.columnIndex,
2002
+ rowId: e.runtime.getBodyRowAtIndex(t.rowIndex)?.rowId ?? null
2003
+ },
2004
+ focus: {
2005
+ rowIndex: t.rowIndex,
2006
+ colIndex: t.columnIndex,
2007
+ rowId: e.runtime.getBodyRowAtIndex(t.rowIndex)?.rowId ?? null
2008
+ },
2009
+ startRowId: e.runtime.getBodyRowAtIndex(t.rowIndex)?.rowId ?? null,
2010
+ endRowId: e.runtime.getBodyRowAtIndex(t.rowIndex)?.rowId ?? null
2011
+ }],
2012
+ activeRangeIndex: 0,
2013
+ activeCell: {
2014
+ rowIndex: t.rowIndex,
2015
+ colIndex: t.columnIndex,
2016
+ rowId: e.runtime.getBodyRowAtIndex(t.rowIndex)?.rowId ?? null
2017
+ }
2018
+ }), Ae = (t) => {
2019
+ const n = e.runtime.api.rows.getCount();
2020
+ for (let a = 0; a < n; a += 1) {
2021
+ const u = e.runtime.api.rows.get(a);
2022
+ if (u && String(u.rowId) === t)
2023
+ return u;
2024
+ }
2025
+ return null;
2026
+ }, tt = async (t) => {
2027
+ try {
2028
+ return globalThis.navigator?.clipboard?.writeText ? (await globalThis.navigator.clipboard.writeText(t), !0) : !1;
2029
+ } catch {
2030
+ return !1;
2031
+ }
2032
+ }, nt = async () => {
2033
+ try {
2034
+ return globalThis.navigator?.clipboard?.readText ? await globalThis.navigator.clipboard.readText() : "";
2035
+ } catch {
2036
+ return "";
2037
+ }
2038
+ }, Kt = async () => {
2039
+ if (z.value?.rows.length)
2040
+ return z.value.rows.map((n) => J(n));
2041
+ const t = (await nt()).trim();
2042
+ if (!t)
2043
+ return null;
2044
+ try {
2045
+ const n = JSON.parse(t);
2046
+ if (Array.isArray(n))
2047
+ return n.filter((a) => !!a && typeof a == "object").map((a) => J(a));
2048
+ if (n && typeof n == "object")
2049
+ return [J(n)];
2050
+ } catch {
2051
+ return null;
2052
+ }
2053
+ return null;
2054
+ }, lt = async (t, n, a = []) => {
2055
+ const u = t.map((h) => J(h));
2056
+ z.value = {
2057
+ rows: u,
2058
+ operation: n,
2059
+ sourceRowIds: a.map((h) => String(h))
2060
+ };
2061
+ const d = Ul(u);
2062
+ return d && await tt(d), !0;
2063
+ }, le = () => e.runtime.api.rows.hasInsertSupport(), Oe = () => e.runtime.api.rows.hasDataMutationSupport(), ue = (t) => !t || typeof t != "object" ? !1 : "data" in t || "row" in t || "kind" in t || "state" in t || "sourceIndex" in t || "originalIndex" in t || "displayIndex" in t, ce = (t) => {
2064
+ const n = t;
2065
+ return n.rowId != null ? String(n.rowId) : n.id != null ? String(n.id) : null;
2066
+ }, de = (t) => {
2067
+ for (const n of e.rows) {
2068
+ if (!n || typeof n != "object")
2069
+ continue;
2070
+ const a = n;
2071
+ if ((a.rowId != null ? String(a.rowId) : a.rowKey != null ? String(a.rowKey) : null) === t && ue(a))
2072
+ return a;
2073
+ }
2074
+ for (const n of e.rows) {
2075
+ if (!n || typeof n != "object")
2076
+ continue;
2077
+ const a = n;
2078
+ if (ue(a))
2079
+ return a;
2080
+ }
2081
+ return null;
2082
+ }, me = () => (se += 1, `datagrid-row-${Date.now()}-${se}`), ot = (t) => {
2083
+ const n = J(t), a = me();
2084
+ let u = !1;
2085
+ return "id" in n && (n.id = a, u = !0), "rowId" in n && (n.rowId = a, u = !0), u || (n.id = a), n;
2086
+ }, rt = (t) => {
2087
+ const n = me(), a = {};
2088
+ for (const [u, d] of Object.entries(t)) {
2089
+ if (u === "id" || u === "rowId") {
2090
+ a[u] = n;
2091
+ continue;
2092
+ }
2093
+ a[u] = typeof d == "number" ? null : "";
2094
+ }
2095
+ return !("id" in a) && !("rowId" in a) && (a.id = n), a;
2096
+ }, it = (t, n, a) => {
2097
+ const u = me(), d = a === "clone" ? J(t) : Object.entries(t).reduce((S, [D, p]) => (S[D] = typeof p == "number" ? null : "", S), {});
2098
+ ("id" in d || !("rowId" in d) && !("id" in d)) && (d.id = u), "rowId" in d && (d.rowId = u), "rowKey" in d && (d.rowKey = u);
2099
+ const h = typeof n.state == "object" && n.state != null ? n.state : null;
2100
+ return {
2101
+ kind: n.kind === "group" ? "leaf" : n.kind ?? "leaf",
2102
+ rowId: u,
2103
+ rowKey: u,
2104
+ state: {
2105
+ ...h ?? {},
2106
+ selected: !1,
2107
+ group: !1,
2108
+ pinned: "none",
2109
+ expanded: !1
2110
+ },
2111
+ data: d,
2112
+ row: J(d)
2113
+ };
2114
+ }, Nt = (t, n = null) => n && ue(n) ? it(t, n, "clone") : ot(t), at = (t, n = null) => n && ue(n) ? it(t, n, "blank") : rt(t), st = (t) => {
2115
+ const a = (e.rowSelectionSnapshot.value?.selectedRows ?? []).map((h) => String(h)).filter((h) => h.length > 0 && Ae(h)?.kind !== "group");
2116
+ if (a.length > 0)
2117
+ return a;
2118
+ const u = xe(), d = R.value.length - 1;
2119
+ if (u && d >= 0) {
2120
+ const h = Math.min(u.startColumn, u.endColumn), S = Math.max(u.startColumn, u.endColumn), D = Math.min(u.startRow, u.endRow), p = Math.max(u.startRow, u.endRow), P = t.length > 0 ? e.runtime.resolveBodyRowIndexById(t) : -1;
2121
+ if (h === 0 && S === d && (P < 0 || P >= D && P <= p)) {
2122
+ const $ = [];
2123
+ for (let T = D; T <= p; T += 1) {
2124
+ const E = e.runtime.getBodyRowAtIndex(T);
2125
+ !E || E.kind === "group" || E.rowId == null || $.push(String(E.rowId));
2126
+ }
2127
+ if ($.length > 0)
2128
+ return $;
2129
+ }
2130
+ }
2131
+ return t.length > 0 ? [t] : [];
2132
+ }, ut = () => {
2133
+ const t = [], n = e.runtime.api.rows.getCount();
2134
+ for (let a = 0; a < n; a += 1) {
2135
+ const u = e.runtime.api.rows.get(a);
2136
+ !u || u.kind === "group" || t.push(u.data);
2137
+ }
2138
+ return t;
2139
+ }, $t = (t) => {
2140
+ if (!Oe() || t.length === 0)
2141
+ return !1;
2142
+ const n = new Set(t), a = ut().filter((u) => {
2143
+ const d = ce(u);
2144
+ return d == null || !n.has(d);
2145
+ });
2146
+ return a.length === e.runtime.api.rows.getCount() ? !1 : (e.runtime.api.rows.replaceData(a), e.runtime.api.rowSelection.hasSupport() && (e.runtime.api.rowSelection.clearSelectedRows(), e.syncRowSelectionSnapshotFromRuntime?.()), !0);
2147
+ }, we = (t, n) => {
2148
+ if (!Oe() || t.length === 0 || !n)
2149
+ return !1;
2150
+ const a = ut(), u = new Set(t.map((D) => String(D)));
2151
+ if (u.has(String(n)))
2152
+ return !1;
2153
+ const d = a.filter((D) => {
2154
+ const p = ce(D);
2155
+ return p != null && u.has(p);
2156
+ });
2157
+ if (d.length === 0)
2158
+ return !1;
2159
+ const h = a.filter((D) => {
2160
+ const p = ce(D);
2161
+ return p == null || !u.has(p);
2162
+ }), S = h.findIndex((D) => ce(D) === n);
2163
+ return S < 0 ? !1 : (e.runtime.api.rows.replaceData([
2164
+ ...h.slice(0, S + 1),
2165
+ ...d,
2166
+ ...h.slice(S + 1)
2167
+ ]), e.runtime.api.rowSelection.hasSupport() && (e.runtime.api.rowSelection.selectRows(t), e.syncRowSelectionSnapshotFromRuntime?.()), !0);
2168
+ }, ct = () => z.value ? (z.value = null, !0) : !1, Ut = (t) => {
2169
+ if (t.kind === "group")
2170
+ return !1;
2171
+ const n = z.value;
2172
+ return n ? n.sourceRowIds.includes(String(t.rowId)) : !1;
2173
+ };
2174
+ let dt = () => !1, mt = () => {
2175
+ }, wt = () => {
2176
+ }, Fe = async (t, n) => !1;
2177
+ const qt = (t, n) => {
2178
+ if (n)
2179
+ return n;
2180
+ const a = In[t], u = oo[t];
2181
+ return u ? `${a} (${u})` : a;
2182
+ }, {
2183
+ tableStageProps: De,
2184
+ tableStageContext: ft,
2185
+ copySelectedCells: Xt,
2186
+ pasteSelectedCells: Yt,
2187
+ cutSelectedCells: Ct,
2188
+ clearSelectedCells: Jt,
2189
+ captureHistorySnapshot: fe,
2190
+ recordHistoryIntentTransaction: Zt
2191
+ } = Bl({
2192
+ mode: b,
2193
+ rows: A,
2194
+ sourceRows: A,
2195
+ runtime: e.runtime,
2196
+ rowVersion: o,
2197
+ totalRuntimeRows: v,
2198
+ visibleColumns: R,
2199
+ rowRenderMode: m(() => e.renderMode),
2200
+ rowHeightMode: I,
2201
+ normalizedBaseRowHeight: x,
2202
+ selectionSnapshot: e.selectionSnapshot,
2203
+ selectionAnchor: e.selectionAnchor,
2204
+ rowSelectionSnapshot: e.rowSelectionSnapshot,
2205
+ rowHover: m(() => e.rowHover),
2206
+ stripedRows: m(() => e.stripedRows),
2207
+ showRowIndex: m(() => e.showRowIndex),
2208
+ showRowSelection: m(() => e.rowSelection),
2209
+ isRowInPendingClipboardCut: Ut,
2210
+ syncSelectionSnapshotFromRuntime: e.syncSelectionSnapshotFromRuntime,
2211
+ syncRowSelectionSnapshotFromRuntime: e.syncRowSelectionSnapshotFromRuntime,
2212
+ clearExternalPendingClipboardOperation: ct,
2213
+ firstColumnKey: N,
2214
+ columnFilterTextByKey: s,
2215
+ virtualization: m(() => e.virtualization),
2216
+ toggleSortForColumn: Bt,
2217
+ sortIndicator: pe,
2218
+ setColumnFilterText: Ke,
2219
+ columnMenuEnabled: m(() => e.columnMenu.enabled),
2220
+ columnMenuMaxFilterValues: m(() => e.columnMenu.maxFilterValues),
2221
+ resolveColumnMenuItems: Q,
2222
+ resolveColumnMenuDisabledItems: Ge,
2223
+ resolveColumnMenuDisabledReasons: Pe,
2224
+ resolveColumnMenuLabels: ae,
2225
+ resolveColumnMenuActionOptions: Le,
2226
+ isColumnFilterActive: Be,
2227
+ isColumnGrouped: Re,
2228
+ resolveColumnGroupOrder: X,
2229
+ resolveColumnMenuSortDirection: $e,
2230
+ resolveColumnMenuSelectedTokens: _e,
2231
+ applyColumnMenuSort: Ue,
2232
+ applyColumnMenuPin: qe,
2233
+ applyColumnMenuGroupBy: Xe,
2234
+ applyColumnMenuFilter: Ye,
2235
+ clearColumnMenuFilter: Ie,
2236
+ applyRowHeightSettings: _t,
2237
+ cloneRowData: J,
2238
+ isCellEditable: e.isCellEditable,
2239
+ isContextMenuVisible: () => dt(),
2240
+ closeContextMenu: () => mt(),
2241
+ openContextMenuFromCurrentCell: () => {
2242
+ wt();
2243
+ },
2244
+ runRowIndexKeyboardAction: (t, n) => Fe(t, n)
2245
+ }), {
2246
+ contextMenu: B,
2247
+ contextMenuRef: gt,
2248
+ contextMenuStyle: Qt,
2249
+ closeContextMenu: Y,
2250
+ openContextMenu: Ee,
2251
+ onContextMenuKeyDown: en
2252
+ } = Wn();
2253
+ dt = () => B.value.visible, mt = Y;
2254
+ const tn = il({
2255
+ isInteractionBlocked: () => !1,
2256
+ isRangeMoveModifierActive: () => !1,
2257
+ resolveSelectionRange: xe,
2258
+ resolveCellCoordFromDataset: Wt,
2259
+ applyCellSelection: (t) => {
2260
+ e.runtime.api.selection.setSnapshot(et(t)), e.syncSelectionSnapshotFromRuntime();
2261
+ },
2262
+ resolveActiveCellCoord: Je,
2263
+ setActiveCellCoord: (t) => {
2264
+ e.runtime.api.selection.setSnapshot(et(t)), e.syncSelectionSnapshotFromRuntime();
2265
+ },
2266
+ cellCoordsEqual: (t, n) => t?.rowIndex === n?.rowIndex && t?.columnIndex === n?.columnIndex,
2267
+ isMultiCellSelection: Ze,
2268
+ isCoordInsideRange: Qe,
2269
+ openContextMenu: Ee,
2270
+ closeContextMenu: Y,
2271
+ isColumnContextEnabled: (t) => e.cellMenu.enabled ? ht(e.cellMenu, t).length > 0 : !1,
2272
+ isRowIndexContextEnabled: () => e.rowIndexMenu.enabled && e.showRowIndex
2273
+ }), nn = al({
2274
+ resolveCurrentCellCoord: Je,
2275
+ resolveViewportElement: () => ne.value,
2276
+ resolveRowAtIndex: (t) => e.runtime.getBodyRowAtIndex(t) ?? void 0,
2277
+ resolveColumnAtIndex: (t) => R.value[t] ?? void 0,
2278
+ resolveSelectionRange: xe,
2279
+ isMultiCellSelection: (t) => Ze(t),
2280
+ isCoordInsideRange: Qe,
2281
+ openContextMenu: Ee,
2282
+ isColumnContextEnabled: (t) => e.cellMenu.enabled && ht(e.cellMenu, t.key).length > 0
2283
+ });
2284
+ wt = () => {
2285
+ nn.openContextMenuFromCurrentCell();
2286
+ };
2287
+ const ln = (t) => {
2288
+ if (!e.rowIndexMenu.enabled || !e.showRowIndex || !ne.value)
2289
+ return !1;
2290
+ const n = String(t), a = `.datagrid-stage__row-index-cell[data-row-id="${Kl(n)}"]`, u = ne.value.querySelector(a);
2291
+ if (!u)
2292
+ return !1;
2293
+ const d = u.getBoundingClientRect();
2294
+ return Ee(
2295
+ d.left + Math.max(10, Math.min(d.width / 2, Math.max(10, d.width - 10))),
2296
+ d.bottom - 4,
2297
+ {
2298
+ zone: "row-index",
2299
+ rowId: n
2300
+ }
2301
+ ), !0;
2302
+ }, Ce = (t, n) => {
2303
+ Zt({
2304
+ intent: "edit",
2305
+ label: n
2306
+ }, t);
2307
+ };
2308
+ Fe = async (t, n) => {
2309
+ const a = String(n);
2310
+ if (t === "open-row-menu")
2311
+ return ln(a);
2312
+ const u = Ae(a);
2313
+ if (!u || u.kind === "group")
2314
+ return !1;
2315
+ if (t === "insert-row-above") {
2316
+ if (!le())
2317
+ return !1;
2318
+ const d = fe(), h = e.runtime.api.rows.insertDataBefore(
2319
+ n,
2320
+ [at(u.data, de(a))]
2321
+ );
2322
+ return h && Ce(d, "Insert row above"), h;
2323
+ }
2324
+ if (t === "insert-row-below") {
2325
+ if (!le())
2326
+ return !1;
2327
+ const d = fe(), h = e.runtime.api.rows.insertDataAfter(
2328
+ n,
2329
+ [at(u.data, de(a))]
2330
+ );
2331
+ return h && Ce(d, "Insert row below"), h;
2332
+ }
2333
+ if (t === "copy-row")
2334
+ return lt([u.data], "copy", [a]);
2335
+ if (t === "cut-row")
2336
+ return lt([u.data], "cut", [a]);
2337
+ if (t === "paste-row") {
2338
+ if (!le())
2339
+ return !1;
2340
+ const d = await Kt();
2341
+ if (!d || d.length === 0)
2342
+ return !1;
2343
+ const h = fe(), S = z.value?.operation === "cut" ? z.value.sourceRowIds : [], D = de(
2344
+ S[0] ?? a
2345
+ ) ?? de(a), p = S.length > 0 ? we(S, a) : e.runtime.api.rows.insertDataAfter(
2346
+ n,
2347
+ d.map((P) => Nt(P, D))
2348
+ );
2349
+ return p && z.value?.operation === "cut" && (z.value = null), p && Ce(
2350
+ h,
2351
+ S.length > 0 ? S.length > 1 ? `Move ${S.length} rows` : "Move row" : d.length > 1 ? `Paste ${d.length} rows` : "Paste row"
2352
+ ), p;
2353
+ }
2354
+ if (t === "delete-selected-rows") {
2355
+ const d = st(a);
2356
+ if (d.length === 0)
2357
+ return !1;
2358
+ const h = fe(), S = $t(d);
2359
+ return S && Ce(h, d.length > 1 ? `Delete ${d.length} rows` : "Delete row"), S;
2360
+ }
2361
+ return !1;
2362
+ };
2363
+ const on = sl({
2364
+ resolveContextMenuState: () => ({
2365
+ zone: B.value.zone,
2366
+ columnKey: B.value.columnKey,
2367
+ rowId: B.value.rowId
2368
+ }),
2369
+ runHeaderContextAction: () => !1,
2370
+ runRowIndexContextAction: Fe,
2371
+ copySelection: Xt,
2372
+ pasteSelection: Yt,
2373
+ cutSelection: Ct,
2374
+ clearCurrentSelection: Jt,
2375
+ closeContextMenu: Y
2376
+ }), ke = m(() => {
2377
+ if (!B.value.visible)
2378
+ return [];
2379
+ const t = B.value.zone;
2380
+ if (t === "cell" || t === "range") {
2381
+ const n = B.value.columnKey ?? "";
2382
+ if (!e.cellMenu.enabled || !n)
2383
+ return [];
2384
+ const a = ht(e.cellMenu, n), u = new Set(bl(e.cellMenu, n)), d = hl(e.cellMenu, n), h = Rl(e.cellMenu, n);
2385
+ return a.flatMap((S, D) => {
2386
+ const p = no[S] ?? [];
2387
+ return p.flatMap((P) => {
2388
+ const T = h[P];
2389
+ if (T?.hidden)
2390
+ return [];
2391
+ const E = u.has(S) || T?.disabled === !0;
2392
+ return [{
2393
+ id: P,
2394
+ label: T?.label ?? In[P],
2395
+ disabled: E,
2396
+ title: T?.disabledReason ?? d[S],
2397
+ separatorBefore: D > 0 && P === p[0]
2398
+ }];
2399
+ });
2400
+ });
2401
+ }
2402
+ if (t === "row-index") {
2403
+ if (!e.rowIndexMenu.enabled)
2404
+ return [];
2405
+ const n = yl(e.rowIndexMenu), a = new Set(Sl(e.rowIndexMenu)), u = pl(e.rowIndexMenu), d = Ml(e.rowIndexMenu);
2406
+ return n.flatMap((h, S) => {
2407
+ const D = lo[h] ?? [];
2408
+ return D.flatMap((p) => {
2409
+ const $ = d[p === "insert-row-above" ? "insertAbove" : p === "insert-row-below" ? "insertBelow" : p === "copy-row" ? "copy" : p === "paste-row" ? "paste" : p === "delete-selected-rows" ? "deleteSelected" : "cut"];
2410
+ if ($?.hidden)
2411
+ return [];
2412
+ let T = a.has(h) || $?.disabled === !0, E = $?.disabledReason ?? u[h];
2413
+ return (p === "insert-row-above" || p === "insert-row-below" || p === "paste-row") && !le() && (T = !0, E = E ?? "Row insertion is not supported by the current row model"), (p === "cut-row" || p === "delete-selected-rows") && !Oe() && (T = !0, E = E ?? "Row deletion is not supported by the current row model"), p === "delete-selected-rows" && st(B.value.rowId ?? "").length === 0 && (T = !0, E = E ?? "No deletable rows are selected"), [{
2414
+ id: p,
2415
+ label: qt(p, $?.label),
2416
+ disabled: T,
2417
+ title: E,
2418
+ separatorBefore: S > 0 && p === D[0]
2419
+ }];
2420
+ });
2421
+ });
2422
+ }
2423
+ return [];
2424
+ }), vt = (t) => {
2425
+ tn.dispatchViewportContextMenu(t);
2426
+ }, ge = () => {
2427
+ ne.value?.querySelector(".grid-body-viewport")?.focus({ preventScroll: !0 });
2428
+ }, rn = () => {
2429
+ Dn(() => {
2430
+ if (typeof window < "u") {
2431
+ window.requestAnimationFrame(() => {
2432
+ ge();
2433
+ });
2434
+ return;
2435
+ }
2436
+ ge();
2437
+ });
2438
+ }, O = async (t) => {
2439
+ await on.runContextMenuAction(t) && (ge(), Y(), rn());
2440
+ };
2441
+ K(
2442
+ () => B.value.visible,
2443
+ (t, n, a) => {
2444
+ if (!t || typeof window > "u")
2445
+ return;
2446
+ const u = (h) => {
2447
+ const S = h.target;
2448
+ S && gt.value?.contains(S) || Y();
2449
+ }, d = () => {
2450
+ Y();
2451
+ };
2452
+ window.addEventListener("mousedown", u, !0), window.addEventListener("blur", d), a(() => {
2453
+ window.removeEventListener("mousedown", u, !0), window.removeEventListener("blur", d);
2454
+ });
2455
+ }
2456
+ );
2457
+ const an = m(() => ({
2458
+ ...De.value,
2459
+ columns: {
2460
+ ...De.value.columns,
2461
+ columnMenuEnabled: e.columnMenu.enabled,
2462
+ columnMenuMaxFilterValues: e.columnMenu.maxFilterValues,
2463
+ resolveColumnMenuItems: Q,
2464
+ resolveColumnMenuDisabledItems: Ge,
2465
+ resolveColumnMenuDisabledReasons: Pe,
2466
+ resolveColumnMenuLabels: ae,
2467
+ resolveColumnMenuActionOptions: Le,
2468
+ isColumnFilterActive: Be,
2469
+ isColumnGrouped: Re,
2470
+ resolveColumnGroupOrder: X,
2471
+ resolveColumnMenuSortDirection: $e,
2472
+ resolveColumnMenuSelectedTokens: _e,
2473
+ applyColumnMenuSort: Ue,
2474
+ applyColumnMenuPin: qe,
2475
+ applyColumnMenuGroupBy: Xe,
2476
+ applyColumnMenuFilter: Ye,
2477
+ clearColumnMenuFilter: Ie
2478
+ },
2479
+ rows: {
2480
+ ...De.value.rows,
2481
+ sourceRows: e.rows,
2482
+ rowHover: e.rowHover,
2483
+ stripedRows: e.stripedRows
2484
+ }
2485
+ })), sn = m(() => {
2486
+ const t = [];
2487
+ return e.columnLayout.enabled && t.push({
2488
+ key: "column-layout",
2489
+ component: _l,
2490
+ props: {
2491
+ isOpen: ze.value,
2492
+ items: pt.value,
2493
+ buttonLabel: e.columnLayout.buttonLabel,
2494
+ active: !1,
2495
+ onOpen: Mt,
2496
+ onToggleVisibility: Ot,
2497
+ onMoveUp: xt,
2498
+ onMoveDown: At,
2499
+ onApply: It,
2500
+ onCancel: H
2501
+ }
2502
+ }), e.advancedFilter.enabled && t.push({
2503
+ key: "advanced-filter",
2504
+ component: Gl,
2505
+ props: {
2506
+ isOpen: Ft.value,
2507
+ clauses: Dt.value,
2508
+ columns: g.value,
2509
+ appliedFilterSummaryItems: Se.value,
2510
+ hasAnyFilters: We.value,
2511
+ buttonLabel: e.advancedFilter.buttonLabel,
2512
+ active: We.value,
2513
+ onOpen: Et,
2514
+ onAdd: kt,
2515
+ onRemove: Ht,
2516
+ onUpdateClause: V,
2517
+ onApply: zt,
2518
+ onCancel: Vt,
2519
+ onResetAll: jt
2520
+ }
2521
+ }), e.aggregations.enabled && e.mode !== "pivot" && t.push({
2522
+ key: "aggregations",
2523
+ component: Pl,
2524
+ props: {
2525
+ isOpen: q.value,
2526
+ basis: ie.value,
2527
+ items: je.value,
2528
+ buttonLabel: e.aggregations.buttonLabel,
2529
+ active: L.value && (q.value || !!re.value?.columns.length),
2530
+ disabled: !L.value,
2531
+ disabledReason: L.value ? "" : "Aggregations require an active group-by model.",
2532
+ onOpen: Gt,
2533
+ onUpdateBasis: Ne,
2534
+ onToggleColumn: ee,
2535
+ onUpdateOp: te,
2536
+ onClear: Pt,
2537
+ onApply: Lt,
2538
+ onCancel: Me
2539
+ }
2540
+ }), [...t, ...e.toolbarModules];
2541
+ });
2542
+ return () => k("div", {
2543
+ class: "datagrid-app-layout"
2544
+ }, [
2545
+ k(dl, {
2546
+ modules: sn.value
2547
+ }),
2548
+ k("div", {
2549
+ class: "datagrid-app-workspace"
2550
+ }, [
2551
+ k("div", {
2552
+ class: "datagrid-app-stage",
2553
+ ref: ne
2554
+ }, [
2555
+ e.viewMode === "gantt" ? k(Ll, {
2556
+ stageContext: ft,
2557
+ runtime: e.runtime,
2558
+ gantt: e.gantt,
2559
+ baseRowHeight: x.value,
2560
+ rowVersion: o.value
2561
+ }) : k(cl, {
2562
+ ...an.value,
2563
+ stageContext: ft,
2564
+ onViewportContextMenu: vt
2565
+ }),
2566
+ B.value.visible && ke.value.length > 0 ? k("div", {
2567
+ ref: gt,
2568
+ class: "datagrid-context-menu",
2569
+ style: Qt.value,
2570
+ role: "menu",
2571
+ tabindex: -1,
2572
+ onKeydown: (t) => {
2573
+ en(t, {
2574
+ onEscape: () => {
2575
+ ge();
2576
+ }
2577
+ });
2578
+ }
2579
+ }, ke.value.flatMap((t) => {
2580
+ const n = [];
2581
+ return t.separatorBefore && n.push(k("div", {
2582
+ class: "datagrid-context-menu__separator",
2583
+ "aria-hidden": "true"
2584
+ })), n.push(k("button", {
2585
+ type: "button",
2586
+ class: "datagrid-context-menu__item",
2587
+ "data-datagrid-menu-action": t.id,
2588
+ disabled: t.disabled,
2589
+ title: t.title,
2590
+ onClick: () => {
2591
+ O(t.id);
2592
+ }
2593
+ }, t.label)), n;
2594
+ })) : null
2595
+ ]),
2596
+ e.inspectorPanel ? k("aside", {
2597
+ class: "datagrid-app-inspector-shell"
2598
+ }, [
2599
+ k(e.inspectorPanel.component, {
2600
+ ...e.inspectorPanel.props ?? {}
2601
+ })
2602
+ ]) : null
2603
+ ])
2604
+ ]);
2605
+ }
2606
+ }), wn = /* @__PURE__ */ new WeakMap(), xn = /* @__PURE__ */ new WeakMap();
2607
+ function ro(e) {
2608
+ if (!e)
2609
+ return;
2610
+ const o = wn.get(e);
2611
+ if (o)
2612
+ return o;
2613
+ const r = e.initialTreeData?.expandedByDefault ?? !1;
2614
+ if (e.initialTreeData?.expandedByDefault === r)
2615
+ return wn.set(e, e), e;
2616
+ const l = {
2617
+ ...e
2618
+ };
2619
+ return e.initialTreeData && (l.initialTreeData = {
2620
+ ...e.initialTreeData,
2621
+ expandedByDefault: r
2622
+ }), wn.set(e, l), l;
2623
+ }
2624
+ function io(e) {
2625
+ return !e || e.length === 0 ? [] : e.map((o) => ({ ...o }));
2626
+ }
2627
+ function ao(e) {
2628
+ return !e || e.length === 0 ? [] : e.map((o) => ({ ...o }));
2629
+ }
2630
+ function so(e) {
2631
+ return !e || e.length === 0 ? [] : e.map(({ formula: o, ...r }) => ({ ...r }));
2632
+ }
2633
+ function uo(e) {
2634
+ return !e || e.length === 0 ? [] : e.flatMap((o) => {
2635
+ const r = typeof o.formula == "string" ? o.formula.trim() : "";
2636
+ return r ? [{
2637
+ name: o.key,
2638
+ formula: r
2639
+ }] : [];
2640
+ });
2641
+ }
2642
+ function co(e, o) {
2643
+ const r = /* @__PURE__ */ new Map();
2644
+ for (const l of e)
2645
+ r.set(l.name, { ...l });
2646
+ for (const l of io(o))
2647
+ r.set(l.name, l);
2648
+ return Array.from(r.values());
2649
+ }
2650
+ function po(e) {
2651
+ return so(e);
2652
+ }
2653
+ function Mo(e) {
2654
+ const o = ro(e.clientRowModelOptions), r = e.enterpriseClientRowModelOptions, l = uo(e.columns), s = e.formulas !== void 0, i = e.computedFields !== void 0, w = e.formulaFunctions !== void 0, C = l.length > 0, b = s || C ? co(l, e.formulas) : void 0, A = i ? ao(e.computedFields) : void 0, v = w ? e.formulaFunctions ?? {} : void 0, R = !!(C || s || i || w);
2655
+ if (!o && !R)
2656
+ return r ? {
2657
+ ...r
2658
+ } : void 0;
2659
+ if (!R) {
2660
+ if (o && !r)
2661
+ return o;
2662
+ if (!o && r)
2663
+ return r;
2664
+ if (o && r) {
2665
+ let y = xn.get(o);
2666
+ y || (y = /* @__PURE__ */ new WeakMap(), xn.set(o, y));
2667
+ const g = y.get(r);
2668
+ if (g)
2669
+ return g;
2670
+ const f = {
2671
+ ...o,
2672
+ ...r
2673
+ };
2674
+ return y.set(
2675
+ r,
2676
+ f
2677
+ ), f;
2678
+ }
2679
+ }
2680
+ return {
2681
+ ...o ?? {},
2682
+ ...i ? { initialComputedFields: A } : {},
2683
+ ...s || C ? { initialFormulaFields: b } : {},
2684
+ ...w ? { initialFormulaFunctionRegistry: v } : {},
2685
+ ...r?.computeMode ? { computeMode: r.computeMode } : {},
2686
+ ...r?.workerPatchDispatchThreshold !== void 0 ? { workerPatchDispatchThreshold: r.workerPatchDispatchThreshold } : {},
2687
+ ...r?.formulaColumnCacheMaxColumns !== void 0 ? { formulaColumnCacheMaxColumns: r.formulaColumnCacheMaxColumns } : {}
2688
+ };
2689
+ }
2690
+ function An() {
2691
+ const e = globalThis.performance;
2692
+ return e && typeof e.now == "function" ? e.now() : Date.now();
2693
+ }
2694
+ const mo = (e, o) => {
2695
+ const r = An();
2696
+ return {
2697
+ result: o(),
2698
+ duration: Math.max(0, An() - r)
2699
+ };
2700
+ };
2701
+ function On(e) {
2702
+ return {
2703
+ projectionStageTimer: mo,
2704
+ ...e ?? {}
2705
+ };
2706
+ }
2707
+ function Io(e) {
2708
+ const o = W(0), r = un(), l = _n(
2709
+ e.rowModel.value ? null : un({
2710
+ rows: e.rows.value,
2711
+ ...On(e.clientRowModelOptions.value)
2712
+ })
2713
+ ), s = (C) => {
2714
+ !C || C === e.rowModel.value || "dispose" in C && typeof C.dispose == "function" && C.dispose();
2715
+ }, i = () => {
2716
+ e.rowModel.value || (s(l.value), l.value = un({
2717
+ rows: e.rows.value,
2718
+ ...On(e.clientRowModelOptions.value)
2719
+ }), o.value += 1, e.onOwnedRowModelRecreated?.());
2720
+ }, w = m(() => e.rowModel.value ?? l.value ?? r);
2721
+ return K(
2722
+ e.rows,
2723
+ (C) => {
2724
+ l.value && l.value.setRows(C);
2725
+ },
2726
+ { deep: !1 }
2727
+ ), K(
2728
+ e.clientRowModelOptions,
2729
+ () => {
2730
+ i();
2731
+ },
2732
+ { deep: !0 }
2733
+ ), K(
2734
+ e.rowModel,
2735
+ (C) => {
2736
+ if (C) {
2737
+ s(l.value), l.value = null, o.value += 1;
2738
+ return;
2739
+ }
2740
+ l.value || i();
2741
+ }
2742
+ ), En(() => {
2743
+ s(l.value), s(r);
2744
+ }), {
2745
+ dataGridInstanceKey: o,
2746
+ resolvedRowModel: w,
2747
+ disposeOwnedRowModel: s
2748
+ };
2749
+ }
2750
+ export {
2751
+ So as D,
2752
+ dl as a,
2753
+ Il as b,
2754
+ Bl as c,
2755
+ ho as d,
2756
+ Ro as e,
2757
+ yo as f,
2758
+ po as g,
2759
+ Mo as r,
2760
+ Io as u
2761
+ };