@affino/datagrid-vue-app 0.1.18 → 0.1.19

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