@affino/datagrid-vue-app 0.1.18 → 0.1.19

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