@affino/datagrid-vue-app 0.1.63 → 0.4.0

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.
Files changed (40) hide show
  1. package/README.md +25 -7
  2. package/dist/DataGrid.d.ts +1 -3
  3. package/dist/advanced-filter.js +1 -1
  4. package/dist/aggregations.js +1 -1
  5. package/dist/chunks/{DataGridAdvancedFilterPopover-BmEL_QzN.js → DataGridAdvancedFilterPopover-p_hnZLCA.js} +1 -1
  6. package/dist/chunks/{DataGridAdvancedFilterPopover.vue_vue_type_script_setup_true_lang-BkrpyjJb.js → DataGridAdvancedFilterPopover.vue_vue_type_script_setup_true_lang-AVmOe3Bv.js} +1 -1
  7. package/dist/chunks/{DataGridAggregationsPopover-D-HP10PE.js → DataGridAggregationsPopover-Bzbn6Nuy.js} +1 -1
  8. package/dist/chunks/{DataGridAggregationsPopover.vue_vue_type_script_setup_true_lang-VYIMuuIQ.js → DataGridAggregationsPopover.vue_vue_type_script_setup_true_lang-TgxL5evy.js} +1 -1
  9. package/dist/chunks/DataGridFilterableCombobox.vue_vue_type_script_setup_true_lang-CpC_nuMk.js +419 -0
  10. package/dist/chunks/DataGridGanttStageEntry-Cypf1c3l.js +12522 -0
  11. package/dist/chunks/useDataGridAppRowModel-b5bfkfo3.js +5574 -0
  12. package/dist/gantt.js +1 -1
  13. package/dist/host/DataGridDefaultRenderer.d.ts +1 -1
  14. package/dist/index.js +694 -674
  15. package/dist/internal.js +3 -3
  16. package/dist/overlays/DataGridCellComboboxEditor.vue.d.ts +1 -0
  17. package/dist/perf/dataGridPerfTrace.d.ts +7 -0
  18. package/dist/stage/DataGridTableStageCenterPane.vue.d.ts +18 -0
  19. package/dist/stage/DataGridTableStagePinnedPane.vue.d.ts +10 -1
  20. package/dist/stage/dataGridMouseEventGuards.d.ts +8 -0
  21. package/dist/stage/dataGridTableStage.types.d.ts +5 -1
  22. package/dist/stage/dataGridTableStageA11y.d.ts +4 -0
  23. package/dist/stage/dataGridTableStageBody.types.d.ts +6 -0
  24. package/dist/stage/useDataGridStageCellRendering.d.ts +1 -1
  25. package/dist/stage/useDataGridStageCellState.d.ts +2 -0
  26. package/dist/stage/useDataGridStageChromeCanvas.d.ts +1 -0
  27. package/dist/stage/useDataGridStageFocusRuntime.d.ts +1 -0
  28. package/dist/stage/useDataGridStageOverlays.d.ts +1 -0
  29. package/dist/stage/useDataGridStagePanes.grouped.d.ts +6 -0
  30. package/dist/stage/useDataGridStageRenderApis.d.ts +6 -0
  31. package/dist/stage/useDataGridStageRenderApis.grouped.d.ts +6 -0
  32. package/dist/stage/useDataGridStageRowIndex.d.ts +1 -0
  33. package/dist/stage/useDataGridStageViewportRuntime.d.ts +4 -0
  34. package/dist/stage/useDataGridTableStageHistory.d.ts +3 -0
  35. package/dist/stage/useDataGridTableStageRuntime.d.ts +3 -0
  36. package/dist/stage/useDataGridTableStageScrollSync.d.ts +8 -0
  37. package/package.json +7 -7
  38. package/dist/chunks/DataGridFilterableCombobox.vue_vue_type_script_setup_true_lang-Dt_KqrSU.js +0 -405
  39. package/dist/chunks/DataGridGanttStageEntry-D6OYD0Gx.js +0 -11781
  40. package/dist/chunks/useDataGridAppRowModel-9ZIepsHi.js +0 -5281
@@ -1,405 +0,0 @@
1
- import { defineComponent as Fe, inject as Ae, ref as v, useAttrs as Se, computed as s, watch as D, nextTick as m, onMounted as Re, onBeforeUnmount as Me, openBlock as b, createElementBlock as h, createElementVNode as le, mergeProps as Pe, withModifiers as I, createBlock as Be, Teleport as Ve, normalizeStyle as De, normalizeClass as ae, Fragment as ie, renderList as Te, toDisplayString as Ne, createCommentVNode as X } from "vue";
2
- import { d as $e, r as Ge } from "./dataGridOverlayThemeVars-vzY74EIz.js";
3
- function He(n = {}) {
4
- return {
5
- open: n.open ?? !1,
6
- filter: n.filter ?? "",
7
- activeIndex: n.activeIndex ?? -1
8
- };
9
- }
10
- function F(n, o) {
11
- return n.open === o ? n : {
12
- ...n,
13
- open: o
14
- };
15
- }
16
- function z(n, o) {
17
- return n.filter === o ? n : {
18
- ...n,
19
- filter: o
20
- };
21
- }
22
- function A(n, o, t) {
23
- const r = Ue(o, t);
24
- return r === n.activeIndex ? n : {
25
- ...n,
26
- activeIndex: r
27
- };
28
- }
29
- function re(n, o, t, r = !0) {
30
- if (t <= 0 || o === 0)
31
- return n;
32
- if (n.activeIndex < 0)
33
- return A(n, o > 0 ? 0 : t - 1, t);
34
- const u = n.activeIndex + Math.trunc(o);
35
- return r ? A(n, We(u, t), t) : A(n, u, t);
36
- }
37
- function Ue(n, o) {
38
- if (o <= 0)
39
- return -1;
40
- if (!Number.isFinite(n))
41
- return 0;
42
- const t = Math.trunc(n);
43
- return t < 0 ? 0 : t >= o ? o - 1 : t;
44
- }
45
- function We(n, o) {
46
- return (n % o + o) % o;
47
- }
48
- const Ke = 0, Xe = 1, ze = 2, qe = 3, je = 4, Je = 5, Ye = 6, Ze = 7, se = 100;
49
- function Qe(n, o) {
50
- const t = q(o);
51
- if (t.length === 0)
52
- return [...n];
53
- const r = n.map((u, c) => ({
54
- option: u,
55
- score: et(u, t),
56
- originalIndex: c
57
- })).filter((u) => u.score < se);
58
- return r.sort((u, c) => {
59
- if (u.score !== c.score)
60
- return u.score - c.score;
61
- const E = u.option.label.length, d = c.option.label.length;
62
- return E !== d ? E - d : u.originalIndex - c.originalIndex;
63
- }), r.map((u) => u.option);
64
- }
65
- function et(n, o) {
66
- const t = q(n.label), r = q(n.value);
67
- return t === o ? Ke : r === o ? Xe : t.startsWith(o) ? ze : r.startsWith(o) ? qe : ue(t, o) ? je : ue(r, o) ? Je : t.includes(o) ? Ye : r.includes(o) ? Ze : se;
68
- }
69
- function ue(n, o) {
70
- return n.length === 0 || o.length === 0 ? !1 : n.split(/[^a-z0-9]+/i).some((t) => t.length > 0 && t.startsWith(o));
71
- }
72
- function q(n) {
73
- return n.trim().toLocaleLowerCase();
74
- }
75
- const tt = ["id", "name", "value", "placeholder", "disabled", "aria-expanded", "aria-activedescendant"], nt = ["data-affino-popover-sticky"], ot = {
76
- key: 0,
77
- class: "datagrid-cell-combobox__empty"
78
- }, lt = ["id", "aria-selected", "data-option-index", "onMousemove", "onClick"], at = { class: "datagrid-cell-combobox__option-label" }, it = {
79
- key: 0,
80
- class: "datagrid-cell-combobox__option-state",
81
- "aria-hidden": "true"
82
- }, rt = {
83
- key: 0,
84
- class: "datagrid-cell-combobox__empty"
85
- }, ut = {
86
- inheritAttrs: !1
87
- }, ht = /* @__PURE__ */ Fe({
88
- ...ut,
89
- __name: "DataGridFilterableCombobox",
90
- props: {
91
- value: {},
92
- options: { default: () => [] },
93
- loadOptions: {},
94
- placeholder: { default: "Type to filter" },
95
- disabled: { type: Boolean, default: !1 },
96
- openOnMount: { type: Boolean, default: !0 },
97
- initialFilter: { default: "" },
98
- openOnFocus: { type: Boolean, default: !0 },
99
- inlinePanel: { type: Boolean, default: !1 },
100
- stickyPopoverId: {}
101
- },
102
- emits: ["commit", "cancel", "optionsResolved"],
103
- setup(n, { emit: o }) {
104
- const t = n, r = o, u = Ae($e, v(null)), c = Se(), E = v(null), d = v(null), C = v(null), j = v({}), T = v({}), S = v("below"), O = v(""), N = v(!1), $ = v([]), l = v(He({ open: !1 })), k = `datagrid-filterable-combobox-${Math.random().toString(36).slice(2, 10)}`, ce = `${k}-input`, de = `${k}-field`;
105
- let R = 0, _ = null;
106
- const ve = s(() => {
107
- const {
108
- class: e,
109
- id: a,
110
- name: i,
111
- style: f,
112
- type: g,
113
- value: ne,
114
- placeholder: oe,
115
- disabled: st,
116
- onInput: ct,
117
- onFocus: dt,
118
- onBlur: vt,
119
- onKeydown: ft,
120
- onClick: pt,
121
- ...Le
122
- } = c;
123
- return Le;
124
- }), fe = s(() => String(c.id ?? ce)), pe = s(() => String(c.name ?? de)), me = s(() => [
125
- "cell-editor-control",
126
- "datagrid-cell-combobox__input",
127
- c.class
128
- ]), be = s(() => c.style), he = s(() => {
129
- if (!t.inlinePanel)
130
- return "body";
131
- }), G = s(() => J.value.find((e) => e.value === t.value) ?? null), J = s(() => t.loadOptions && $.value.length > 0 ? $.value : t.options), p = s(() => Qe(J.value, l.value.filter)), x = s(() => l.value.activeIndex), M = s(() => x.value >= 0 ? p.value[x.value] ?? null : null), _e = s(() => x.value >= 0 ? Y(x.value) : void 0), P = s(() => l.value.open);
132
- function Y(e) {
133
- return `${k}-option-${e}`;
134
- }
135
- function xe() {
136
- j.value = Ge(u.value);
137
- }
138
- function H() {
139
- O.value = G.value?.label ?? t.value;
140
- }
141
- function Z() {
142
- O.value = t.initialFilter;
143
- }
144
- function L(e) {
145
- const a = p.value;
146
- if (a.length === 0) {
147
- l.value = {
148
- ...l.value,
149
- activeIndex: -1
150
- };
151
- return;
152
- }
153
- let i = 0;
154
- if (e && G.value) {
155
- const f = a.findIndex((g) => g.value === G.value?.value);
156
- f >= 0 && (i = f);
157
- }
158
- l.value = A(l.value, i, a.length);
159
- }
160
- async function U(e) {
161
- if (!t.loadOptions)
162
- return;
163
- const a = R + 1;
164
- R = a, N.value = !0;
165
- try {
166
- const i = await t.loadOptions(e);
167
- if (a !== R)
168
- return;
169
- $.value = i, r("optionsResolved", i), L(!0), m(() => {
170
- y(), w();
171
- });
172
- } finally {
173
- a === R && (N.value = !1);
174
- }
175
- }
176
- function y() {
177
- if (t.inlinePanel) {
178
- S.value = "below", T.value = {
179
- position: "absolute",
180
- top: "calc(100% - 1px)",
181
- left: "0px",
182
- width: "100%",
183
- maxHeight: "260px",
184
- zIndex: "4"
185
- };
186
- return;
187
- }
188
- if (typeof window > "u" || !d.value)
189
- return;
190
- const e = d.value.getBoundingClientRect(), a = Math.max(e.width, 160), i = Math.min(C.value?.offsetHeight ?? 220, 260), g = window.innerHeight - e.bottom - 8 < Math.min(180, i) && e.top > i + 12;
191
- S.value = g ? "above" : "below";
192
- const ne = g ? Math.max(8, e.top - i + 1) : Math.min(window.innerHeight - i - 8, e.bottom - 1), oe = Math.min(
193
- Math.max(8, e.left),
194
- Math.max(8, window.innerWidth - a - 8)
195
- );
196
- T.value = {
197
- position: "fixed",
198
- top: `${ne}px`,
199
- left: `${oe}px`,
200
- width: `${a}px`,
201
- maxHeight: "260px",
202
- zIndex: "240"
203
- };
204
- }
205
- function Q() {
206
- if (_ == null || typeof window > "u") {
207
- _ = null;
208
- return;
209
- }
210
- window.cancelAnimationFrame(_), _ = null;
211
- }
212
- function ye() {
213
- if (typeof window > "u") {
214
- y();
215
- return;
216
- }
217
- _ == null && (_ = window.requestAnimationFrame(() => {
218
- _ = null, P.value && y();
219
- }));
220
- }
221
- function w() {
222
- if (!C.value || x.value < 0)
223
- return;
224
- C.value.querySelector(`[data-option-index="${x.value}"]`)?.scrollIntoView({ block: "nearest" });
225
- }
226
- function W() {
227
- t.disabled || (l.value = F(l.value, !0), L(!0), m(() => {
228
- if (y(), w(), d.value?.focus({ preventScroll: !0 }), !!d.value) {
229
- if (l.value.filter.length > 0) {
230
- const e = d.value.value.length;
231
- d.value.setSelectionRange(e, e);
232
- return;
233
- }
234
- d.value.select();
235
- }
236
- }), t.loadOptions && U(l.value.filter));
237
- }
238
- function B() {
239
- Q(), l.value = F(l.value, !1);
240
- }
241
- function we(e) {
242
- return e instanceof Node && (E.value?.contains(e) === !0 || C.value?.contains(e) === !0);
243
- }
244
- function ge() {
245
- if (l.value.filter.trim().length === 0)
246
- return t.value;
247
- if (M.value)
248
- return M.value.value;
249
- const e = O.value.trim().toLocaleLowerCase();
250
- return e.length === 0 ? t.value : p.value.find((i) => i.label.trim().toLocaleLowerCase() === e || i.value.trim().toLocaleLowerCase() === e)?.value ?? t.value;
251
- }
252
- function ee(e = "stay") {
253
- B(), r("commit", ge(), e);
254
- }
255
- function te(e, a = "stay") {
256
- B(), r("commit", e, a);
257
- }
258
- function K(e) {
259
- l.value = A(l.value, e, p.value.length), m(w);
260
- }
261
- function Ie() {
262
- t.openOnFocus && W();
263
- }
264
- function Ee() {
265
- W();
266
- }
267
- function Ce(e) {
268
- if (t.disabled)
269
- return;
270
- const a = e.target.value;
271
- O.value = a, l.value = z(l.value, a), l.value = F(l.value, !0), L(!1), m(() => {
272
- y(), w();
273
- }), t.loadOptions && U(a);
274
- }
275
- function Oe() {
276
- m(() => {
277
- we(document.activeElement) || ee("stay");
278
- });
279
- }
280
- function ke(e) {
281
- if (!t.disabled) {
282
- if (e.key === "ArrowDown") {
283
- e.preventDefault(), l.value = F(l.value, !0), l.value = re(l.value, 1, p.value.length, !0), m(w);
284
- return;
285
- }
286
- if (e.key === "ArrowUp") {
287
- e.preventDefault(), l.value = F(l.value, !0), l.value = re(l.value, -1, p.value.length, !0), m(w);
288
- return;
289
- }
290
- if (e.key === "Home") {
291
- e.preventDefault(), K(0);
292
- return;
293
- }
294
- if (e.key === "End") {
295
- e.preventDefault(), K(Math.max(0, p.value.length - 1));
296
- return;
297
- }
298
- if (e.key === "Enter" || e.key === "Tab") {
299
- if (e.preventDefault(), M.value) {
300
- te(M.value.value, e.shiftKey ? "previous" : "next");
301
- return;
302
- }
303
- ee(e.shiftKey ? "previous" : "next");
304
- return;
305
- }
306
- e.key === "Escape" && (e.preventDefault(), B(), r("cancel"));
307
- }
308
- }
309
- function V() {
310
- P.value && ye();
311
- }
312
- return D(() => t.options, () => {
313
- t.loadOptions || (L(!0), m(y));
314
- }, { immediate: !0 }), D(() => t.value, () => {
315
- H();
316
- }), D(() => t.initialFilter, (e) => {
317
- document.activeElement !== d.value && (l.value = z(l.value, e), e.length > 0 ? (Z(), U(e)) : H(), L(!0), m(() => {
318
- y(), w();
319
- }));
320
- }), D(() => t.disabled, (e) => {
321
- e && B();
322
- }), Re(() => {
323
- xe(), t.initialFilter.length > 0 ? (l.value = z(l.value, t.initialFilter), Z()) : H(), t.openOnMount && W(), typeof window < "u" && (window.addEventListener("resize", V), window.addEventListener("scroll", V, { capture: !0, passive: !0 }));
324
- }), Me(() => {
325
- Q(), typeof window < "u" && (window.removeEventListener("resize", V), window.removeEventListener("scroll", V, { capture: !0 }));
326
- }), (e, a) => (b(), h("div", {
327
- ref_key: "rootEl",
328
- ref: E,
329
- class: "datagrid-cell-combobox"
330
- }, [
331
- le("input", Pe({
332
- ref_key: "inputEl",
333
- ref: d
334
- }, ve.value, {
335
- id: fe.value,
336
- name: pe.value,
337
- class: me.value,
338
- style: be.value,
339
- type: "text",
340
- role: "combobox",
341
- value: O.value,
342
- placeholder: e.placeholder,
343
- disabled: e.disabled,
344
- "aria-expanded": P.value ? "true" : "false",
345
- "aria-controls": k,
346
- "aria-autocomplete": "list",
347
- "aria-activedescendant": _e.value,
348
- onFocus: Ie,
349
- onMousedown: a[0] || (a[0] = I(() => {
350
- }, ["stop"])),
351
- onContextmenu: a[1] || (a[1] = I(() => {
352
- }, ["stop"])),
353
- onClick: I(Ee, ["stop"]),
354
- onInput: Ce,
355
- onKeydown: I(ke, ["stop"]),
356
- onBlur: Oe
357
- }), null, 16, tt),
358
- (b(), Be(Ve, {
359
- to: he.value,
360
- disabled: e.inlinePanel
361
- }, [
362
- P.value ? (b(), h("div", {
363
- key: 0,
364
- id: k,
365
- ref_key: "panelEl",
366
- ref: C,
367
- class: ae(["datagrid-cell-combobox__panel", {
368
- "datagrid-cell-combobox__panel--inline": e.inlinePanel,
369
- "datagrid-cell-combobox__panel--attached-below": S.value === "below",
370
- "datagrid-cell-combobox__panel--attached-above": S.value === "above"
371
- }]),
372
- "data-affino-popover-sticky": e.stickyPopoverId || void 0,
373
- style: De([j.value, T.value]),
374
- role: "listbox",
375
- onMousedown: a[2] || (a[2] = I(() => {
376
- }, ["prevent"]))
377
- }, [
378
- N.value ? (b(), h("div", ot, "Loading options...")) : (b(), h(ie, { key: 1 }, [
379
- (b(!0), h(ie, null, Te(p.value, (i, f) => (b(), h("button", {
380
- id: Y(f),
381
- key: `${i.value}-${f}`,
382
- type: "button",
383
- class: ae(["datagrid-cell-combobox__option", {
384
- "datagrid-cell-combobox__option--active": f === x.value,
385
- "datagrid-cell-combobox__option--selected": i.value === e.value
386
- }]),
387
- role: "option",
388
- "aria-selected": i.value === e.value ? "true" : "false",
389
- "data-option-index": f,
390
- onMousemove: (g) => K(f),
391
- onClick: I((g) => te(i.value), ["stop"])
392
- }, [
393
- le("span", at, Ne(i.label), 1),
394
- i.value === e.value ? (b(), h("span", it)) : X("", !0)
395
- ], 42, lt))), 128)),
396
- p.value.length === 0 ? (b(), h("div", rt, " No matching options ")) : X("", !0)
397
- ], 64))
398
- ], 46, nt)) : X("", !0)
399
- ], 8, ["to", "disabled"]))
400
- ], 512));
401
- }
402
- });
403
- export {
404
- ht as _
405
- };