@affino/datagrid-vue-app 0.1.62 → 0.1.64

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