@affino/datagrid-vue-app 0.1.21 → 0.1.23

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