@affino/datagrid-vue-app 0.1.48 → 0.1.50

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