@affino/datagrid-vue-app 0.1.39 → 0.1.41

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