@affino/datagrid-vue-app 0.1.44 → 0.1.45

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