@affino/datagrid-vue-app 0.1.18 → 0.1.20

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