@affino/datagrid-vue-app 0.1.13 → 0.1.15

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