@affino/datagrid-vue-app 0.1.18 → 0.1.20

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 (38) hide show
  1. package/README.md +40 -0
  2. package/dist/DataGrid.d.ts +20 -0
  3. package/dist/DataGridTableStage.vue.d.ts +9 -0
  4. package/dist/advanced-filter.js +1 -1
  5. package/dist/advancedFilterDraftClauses.d.ts +6 -0
  6. package/dist/chunks/{DataGridAdvancedFilterPopover-CabJ-Ztk.js → DataGridAdvancedFilterPopover-CRd9hbEZ.js} +1 -1
  7. package/dist/chunks/{DataGridAdvancedFilterPopover.vue_vue_type_script_setup_true_lang-x-cfVm5j.js → DataGridAdvancedFilterPopover.vue_vue_type_script_setup_true_lang-DhdOikY0.js} +10 -8
  8. package/dist/chunks/{DataGridAggregationsPopover-DfQ3-UV4.js → DataGridAggregationsPopover-Bu7nZX7u.js} +6 -4
  9. package/dist/chunks/DataGridFilterableCombobox.vue_vue_type_script_setup_true_lang-BPU8WkWd.js +373 -0
  10. package/dist/chunks/DataGridFindReplacePopover-DCuFy-bD.js +4 -0
  11. package/dist/chunks/DataGridFindReplacePopover.vue_vue_type_script_setup_true_lang-DfHFHhUf.js +171 -0
  12. package/dist/chunks/DataGridGanttStageEntry-BbSAXYrL.js +8404 -0
  13. package/dist/chunks/dataGridOverlayThemeVars-vzY74EIz.js +33 -0
  14. package/dist/chunks/useDataGridAppRowModel-Cq1nWBYl.js +3498 -0
  15. package/dist/config/dataGridFindReplace.d.ts +9 -0
  16. package/dist/config/dataGridGridLines.d.ts +16 -0
  17. package/dist/dataGridGridLines.d.ts +1 -0
  18. package/dist/find-replace.d.ts +2 -0
  19. package/dist/find-replace.js +4 -0
  20. package/dist/gantt.js +1 -1
  21. package/dist/gestures/dataGridTouchPanGuard.d.ts +13 -0
  22. package/dist/host/DataGridDefaultRenderer.d.ts +29 -1
  23. package/dist/index.d.ts +2 -0
  24. package/dist/index.js +437 -366
  25. package/dist/internal.d.ts +1 -0
  26. package/dist/internal.js +19 -17
  27. package/dist/overlays/DataGridFindReplacePopover.vue.d.ts +74 -0
  28. package/dist/stage/DataGridTableStage.vue.d.ts +9 -0
  29. package/dist/stage/dataGridTableStage.types.d.ts +3 -0
  30. package/dist/stage/useDataGridTableStageCellIo.d.ts +1 -0
  31. package/dist/stage/useDataGridTableStageHistory.d.ts +3 -1
  32. package/dist/stage/useDataGridTableStageRuntime.d.ts +17 -2
  33. package/dist/stage/useDataGridTableStageScrollSync.d.ts +1 -1
  34. package/dist/useDataGridAppFindReplace.d.ts +54 -0
  35. package/package.json +7 -3
  36. package/dist/chunks/DataGridFilterableCombobox.vue_vue_type_script_setup_true_lang-_1TDQseN.js +0 -399
  37. package/dist/chunks/DataGridGanttStageEntry-CS2wpBnj.js +0 -7815
  38. package/dist/chunks/useDataGridAppRowModel-RrE_k6tK.js +0 -3008
package/README.md CHANGED
@@ -640,6 +640,7 @@ Affino DataGrid works well for:
640
640
  - `aggregations`
641
641
  - `row-hover`
642
642
  - `striped-rows`
643
+ - `grid-lines`
643
644
  - `row-height-mode`
644
645
  - `base-row-height`
645
646
 
@@ -773,6 +774,45 @@ Full override:
773
774
  />
774
775
  ```
775
776
 
777
+ ### Grid lines
778
+
779
+ `DataGrid` uses full spreadsheet-style grid lines by default.
780
+
781
+ Preset form:
782
+
783
+ ```vue
784
+ <DataGrid
785
+ :rows="rows"
786
+ :columns="columns"
787
+ grid-lines="rows"
788
+ />
789
+ ```
790
+
791
+ Supported presets:
792
+
793
+ - `all`
794
+ - `rows`
795
+ - `columns`
796
+ - `none`
797
+
798
+ Object form:
799
+
800
+ ```vue
801
+ <DataGrid
802
+ :rows="rows"
803
+ :columns="columns"
804
+ :grid-lines="{
805
+ body: 'rows',
806
+ header: 'columns',
807
+ pinnedSeparators: true,
808
+ }"
809
+ />
810
+ ```
811
+
812
+ `body` controls body row and column dividers, `header` controls header vertical dividers, and `pinnedSeparators` controls the stronger seam between left / center / right panes.
813
+
814
+ In this monorepo, `/vue/shell/base-grid` exposes the same options as live checkboxes so you can compare the visual modes before wiring them into a product surface.
815
+
776
816
  ### Grouping and aggregation
777
817
 
778
818
  Simple `group-by` sugar:
@@ -5,6 +5,8 @@ import { type DataGridAppClientRowModelOptions, type DataGridAppColumnInput } fr
5
5
  import { type DataGridThemeProp } from "./theme/dataGridTheme";
6
6
  import { type DataGridGroupByProp, type DataGridPaginationProp } from "./config/dataGridPublicProps";
7
7
  import { type DataGridAdvancedFilterProp } from "./config/dataGridAdvancedFilter";
8
+ import { type DataGridFindReplaceProp } from "./config/dataGridFindReplace";
9
+ import { type DataGridGridLinesProp } from "./config/dataGridGridLines";
8
10
  import { type DataGridLayoutMode } from "./config/dataGridLayout";
9
11
  import { type DataGridColumnLayoutProp } from "./config/dataGridColumnLayout";
10
12
  import { type DataGridAggregationsProp } from "./config/dataGridAggregations";
@@ -89,6 +91,14 @@ declare const _default: import("vue").DefineComponent<{
89
91
  type: PropType<DataGridAdvancedFilterProp | undefined>;
90
92
  default: undefined;
91
93
  };
94
+ findReplace: {
95
+ type: PropType<DataGridFindReplaceProp | undefined>;
96
+ default: undefined;
97
+ };
98
+ gridLines: {
99
+ type: PropType<DataGridGridLinesProp | undefined>;
100
+ default: undefined;
101
+ };
92
102
  showRowIndex: {
93
103
  type: BooleanConstructor;
94
104
  default: boolean;
@@ -312,6 +322,14 @@ declare const _default: import("vue").DefineComponent<{
312
322
  type: PropType<DataGridAdvancedFilterProp | undefined>;
313
323
  default: undefined;
314
324
  };
325
+ findReplace: {
326
+ type: PropType<DataGridFindReplaceProp | undefined>;
327
+ default: undefined;
328
+ };
329
+ gridLines: {
330
+ type: PropType<DataGridGridLinesProp | undefined>;
331
+ default: undefined;
332
+ };
315
333
  showRowIndex: {
316
334
  type: BooleanConstructor;
317
335
  default: boolean;
@@ -490,6 +508,8 @@ declare const _default: import("vue").DefineComponent<{
490
508
  rowIndexMenu: DataGridRowIndexMenuProp | undefined;
491
509
  columnLayout: DataGridColumnLayoutProp | undefined;
492
510
  advancedFilter: DataGridAdvancedFilterProp | undefined;
511
+ findReplace: DataGridFindReplaceProp | undefined;
512
+ gridLines: DataGridGridLinesProp | undefined;
493
513
  minRows: number | undefined;
494
514
  maxRows: number | undefined;
495
515
  fillHandle: boolean;
@@ -13,6 +13,10 @@ declare const __VLS_export: import("vue").DefineComponent<{
13
13
  type: import("vue").PropType<import("./dataGridTableStage.types.js").DataGridTableStageProps<Record<string, unknown>>["layoutMode"]>;
14
14
  required: true;
15
15
  };
16
+ chromeSignature: {
17
+ type: import("vue").PropType<import("./dataGridTableStage.types.js").DataGridTableStageProps<Record<string, unknown>>["chromeSignature"]>;
18
+ default: string;
19
+ };
16
20
  layout: {
17
21
  type: import("vue").PropType<import("./dataGridTableStage.types.js").DataGridTableStageProps<Record<string, unknown>>["layout"]>;
18
22
  required: true;
@@ -74,6 +78,10 @@ declare const __VLS_export: import("vue").DefineComponent<{
74
78
  type: import("vue").PropType<import("./dataGridTableStage.types.js").DataGridTableStageProps<Record<string, unknown>>["layoutMode"]>;
75
79
  required: true;
76
80
  };
81
+ chromeSignature: {
82
+ type: import("vue").PropType<import("./dataGridTableStage.types.js").DataGridTableStageProps<Record<string, unknown>>["chromeSignature"]>;
83
+ default: string;
84
+ };
77
85
  layout: {
78
86
  type: import("vue").PropType<import("./dataGridTableStage.types.js").DataGridTableStageProps<Record<string, unknown>>["layout"]>;
79
87
  required: true;
@@ -115,6 +123,7 @@ declare const __VLS_export: import("vue").DefineComponent<{
115
123
  default: undefined;
116
124
  };
117
125
  }>>, {
126
+ chromeSignature: string | undefined;
118
127
  onViewportContextMenu: (event: MouseEvent) => void;
119
128
  stageContext: import("./dataGridTableStageContext.js").DataGridTableStageContext<Record<string, unknown>>;
120
129
  }, {}>;
@@ -1,4 +1,4 @@
1
- import { _ as e } from "./chunks/DataGridAdvancedFilterPopover.vue_vue_type_script_setup_true_lang-x-cfVm5j.js";
1
+ import { _ as e } from "./chunks/DataGridAdvancedFilterPopover.vue_vue_type_script_setup_true_lang-DhdOikY0.js";
2
2
  export {
3
3
  e as DataGridAdvancedFilterPopover
4
4
  };
@@ -0,0 +1,6 @@
1
+ import { type DataGridFilterSnapshot } from "@affino/datagrid-vue";
2
+ import type { DataGridAppAdvancedFilterClauseDraft } from "@affino/datagrid-vue/app";
3
+ type DataGridAdvancedExpressionEntry = NonNullable<DataGridFilterSnapshot["advancedExpression"]>;
4
+ export declare function resolveAdvancedFilterDraftClausesFromExpression(expression: DataGridAdvancedExpressionEntry | null | undefined): DataGridAppAdvancedFilterClauseDraft[];
5
+ export declare function resolveAdvancedFilterDraftClausesFromFilterModel(filterModel: DataGridFilterSnapshot | null | undefined): DataGridAppAdvancedFilterClauseDraft[];
6
+ export {};
@@ -1,4 +1,4 @@
1
- import { _ as f } from "./DataGridAdvancedFilterPopover.vue_vue_type_script_setup_true_lang-x-cfVm5j.js";
1
+ import { _ as f } from "./DataGridAdvancedFilterPopover.vue_vue_type_script_setup_true_lang-DhdOikY0.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,6 +1,7 @@
1
- import { defineComponent as q, inject as D, ref as k, computed as c, watch as m, nextTick as w, openBlock as d, createElementBlock as i, Fragment as b, createElementVNode as e, mergeProps as A, unref as _, createCommentVNode as P, createTextVNode as L, toDisplayString as y, createBlock as z, Teleport as G, renderList as I, createVNode as h } from "vue";
1
+ import { defineComponent as q, inject as D, ref as k, computed as c, watch as m, nextTick as w, openBlock as d, createElementBlock as i, Fragment as b, createElementVNode as e, mergeProps as A, unref as _, createCommentVNode as I, createTextVNode as L, toDisplayString as y, createBlock as z, Teleport as G, renderList as P, createVNode as h } from "vue";
2
2
  import { usePopoverController as J, useFloatingPopover as K } from "@affino/popover-vue";
3
- import { d as M, r as Z, _ as C } from "./DataGridFilterableCombobox.vue_vue_type_script_setup_true_lang-_1TDQseN.js";
3
+ import { _ as C } from "./DataGridFilterableCombobox.vue_vue_type_script_setup_true_lang-BPU8WkWd.js";
4
+ import { d as M, r as Z } from "./dataGridOverlayThemeVars-vzY74EIz.js";
4
5
  const H = ["data-datagrid-advanced-filter-active"], Q = {
5
6
  key: 0,
6
7
  class: "datagrid-app-toolbar__button-icon datagrid-app-toolbar__button-icon--advanced-filter",
@@ -28,7 +29,7 @@ const H = ["data-datagrid-advanced-filter-active"], Q = {
28
29
  }, oe = {
29
30
  key: 1,
30
31
  class: "datagrid-advanced-filter__applied-empty"
31
- }, de = { class: "datagrid-advanced-filter__rows" }, ne = { class: "datagrid-advanced-filter__field datagrid-advanced-filter__field--join" }, ie = /* @__PURE__ */ e("span", { class: "datagrid-advanced-filter__label" }, "Join", -1), re = { class: "datagrid-advanced-filter__field" }, se = /* @__PURE__ */ e("span", { class: "datagrid-advanced-filter__label" }, "Column", -1), ce = { class: "datagrid-advanced-filter__field" }, ue = /* @__PURE__ */ e("span", { class: "datagrid-advanced-filter__label" }, "Operator", -1), pe = { class: "datagrid-advanced-filter__field datagrid-advanced-filter__field--value" }, ve = /* @__PURE__ */ e("span", { class: "datagrid-advanced-filter__label" }, "Value", -1), _e = ["value", "onInput"], fe = { class: "datagrid-advanced-filter__row-actions" }, ge = ["onClick"], me = { class: "datagrid-advanced-filter__footer" }, be = { class: "datagrid-advanced-filter__footer-actions" }, Oe = /* @__PURE__ */ q({
32
+ }, de = { class: "datagrid-advanced-filter__rows" }, ne = { class: "datagrid-advanced-filter__field datagrid-advanced-filter__field--join" }, ie = /* @__PURE__ */ e("span", { class: "datagrid-advanced-filter__label" }, "Join", -1), re = { class: "datagrid-advanced-filter__field" }, se = /* @__PURE__ */ e("span", { class: "datagrid-advanced-filter__label" }, "Column", -1), ce = { class: "datagrid-advanced-filter__field" }, ue = /* @__PURE__ */ e("span", { class: "datagrid-advanced-filter__label" }, "Operator", -1), pe = { class: "datagrid-advanced-filter__field datagrid-advanced-filter__field--value" }, ve = /* @__PURE__ */ e("span", { class: "datagrid-advanced-filter__label" }, "Value", -1), _e = ["value", "onInput"], fe = { class: "datagrid-advanced-filter__row-actions" }, ge = ["onClick"], me = { class: "datagrid-advanced-filter__footer" }, be = { class: "datagrid-advanced-filter__footer-actions" }, ke = /* @__PURE__ */ q({
32
33
  __name: "DataGridAdvancedFilterPopover",
33
34
  props: {
34
35
  isOpen: { type: Boolean },
@@ -47,6 +48,7 @@ const H = ["data-datagrid-advanced-filter-active"], Q = {
47
48
  { value: "or", label: "OR" }
48
49
  ]), N = Object.freeze([
49
50
  { value: "contains", label: "Contains" },
51
+ { value: "in", label: "In" },
50
52
  { value: "equals", label: "Equals" },
51
53
  { value: "not-equals", label: "Not equals" },
52
54
  { value: "starts-with", label: "Starts with" },
@@ -115,7 +117,7 @@ const H = ["data-datagrid-advanced-filter-active"], Q = {
115
117
  "data-datagrid-advanced-filter-active": t.showActiveIcon ? "true" : "false",
116
118
  style: f.value
117
119
  }, R.value), [
118
- t.showActiveIcon ? (d(), i("span", Q, W)) : P("", !0),
120
+ t.showActiveIcon ? (d(), i("span", Q, W)) : I("", !0),
119
121
  L(" " + y(t.buttonLabel), 1)
120
122
  ], 16, H),
121
123
  (d(), z(G, { to: $.value }, [
@@ -146,14 +148,14 @@ const H = ["data-datagrid-advanced-filter-active"], Q = {
146
148
  }, " Reset all filters ", 8, te)
147
149
  ]),
148
150
  t.appliedFilterSummaryItems.length > 0 ? (d(), i("div", le, [
149
- (d(!0), i(b, null, I(t.appliedFilterSummaryItems, (a, v) => (d(), i("span", {
151
+ (d(!0), i(b, null, P(t.appliedFilterSummaryItems, (a, v) => (d(), i("span", {
150
152
  key: `applied-filter-${v}`,
151
153
  class: "datagrid-advanced-filter__applied-chip"
152
154
  }, y(a), 1))), 128))
153
155
  ])) : (d(), i("div", oe, " No filters applied "))
154
156
  ]),
155
157
  e("div", de, [
156
- (d(!0), i(b, null, I(t.clauses, (a, v) => (d(), i("div", {
158
+ (d(!0), i(b, null, P(t.clauses, (a, v) => (d(), i("div", {
157
159
  key: a.id,
158
160
  class: "datagrid-advanced-filter__row"
159
161
  }, [
@@ -236,11 +238,11 @@ const H = ["data-datagrid-advanced-filter-active"], Q = {
236
238
  }, " Apply ")
237
239
  ])
238
240
  ])
239
- ], 16)) : P("", !0)
241
+ ], 16)) : I("", !0)
240
242
  ], 8, ["to"]))
241
243
  ], 64));
242
244
  }
243
245
  });
244
246
  export {
245
- Oe as _
247
+ ke as _
246
248
  };
@@ -1,6 +1,7 @@
1
1
  import { defineComponent as V, inject as E, ref as b, computed as d, watch as _, nextTick as m, openBlock as l, createElementBlock as i, Fragment as y, createElementVNode as e, mergeProps as h, unref as f, toDisplayString as k, createBlock as G, Teleport as D, createVNode as C, renderList as I, createCommentVNode as L } from "vue";
2
2
  import { usePopoverController as j, useFloatingPopover as z } from "@affino/popover-vue";
3
- import { d as q, r as K, _ as O } from "./DataGridFilterableCombobox.vue_vue_type_script_setup_true_lang-_1TDQseN.js";
3
+ import { _ as O } from "./DataGridFilterableCombobox.vue_vue_type_script_setup_true_lang-BPU8WkWd.js";
4
+ import { d as q, r as K } from "./dataGridOverlayThemeVars-vzY74EIz.js";
4
5
  const U = ["disabled", "title"], H = { class: "datagrid-aggregations__header" }, J = /* @__PURE__ */ e("div", null, [
5
6
  /* @__PURE__ */ e("div", { class: "datagrid-aggregations__eyebrow" }, "Aggregations"),
6
7
  /* @__PURE__ */ e("h3", { class: "datagrid-aggregations__title" }, "Group aggregate model")
@@ -10,7 +11,7 @@ const U = ["disabled", "title"], H = { class: "datagrid-aggregations__header" },
10
11
  }, X = { class: "datagrid-aggregations__toggle" }, Y = ["checked", "onChange"], Z = { class: "datagrid-aggregations__row-label" }, x = {
11
12
  key: 1,
12
13
  class: "datagrid-aggregations__empty"
13
- }, ee = { class: "datagrid-aggregations__footer" }, te = { class: "datagrid-aggregations__footer-actions" }, ne = /* @__PURE__ */ V({
14
+ }, ee = { class: "datagrid-aggregations__footer" }, te = { class: "datagrid-aggregations__footer-actions" }, re = /* @__PURE__ */ V({
14
15
  __name: "DataGridAggregationsPopover",
15
16
  props: {
16
17
  isOpen: { type: Boolean },
@@ -84,7 +85,8 @@ const U = ["disabled", "title"], H = { class: "datagrid-aggregations__header" },
84
85
  e("button", h({
85
86
  ref: f(r).triggerRef,
86
87
  type: "button",
87
- class: ["datagrid-app-toolbar__button", { "datagrid-app-toolbar__button--active": t.active }]
88
+ class: ["datagrid-app-toolbar__button", { "datagrid-app-toolbar__button--active": t.active }],
89
+ "data-datagrid-toolbar-action": "aggregations"
88
90
  }, A.value, {
89
91
  style: c.value,
90
92
  disabled: t.disabled,
@@ -169,5 +171,5 @@ const U = ["disabled", "title"], H = { class: "datagrid-aggregations__header" },
169
171
  }
170
172
  });
171
173
  export {
172
- ne as default
174
+ re as default
173
175
  };
@@ -0,0 +1,373 @@
1
+ import { defineComponent as ge, inject as we, ref as c, useAttrs as Ee, computed as d, watch as S, nextTick as p, onMounted as Ie, onBeforeUnmount as Oe, openBlock as m, createElementBlock as h, createElementVNode as ne, mergeProps as Ce, withModifiers as M, createBlock as ke, Teleport as Le, normalizeStyle as Ae, normalizeClass as oe, Fragment as le, renderList as Re, toDisplayString as Fe, createCommentVNode as K } from "vue";
2
+ import { d as Se, r as Me } from "./dataGridOverlayThemeVars-vzY74EIz.js";
3
+ function Be(n = {}) {
4
+ return {
5
+ open: n.open ?? !1,
6
+ filter: n.filter ?? "",
7
+ activeIndex: n.activeIndex ?? -1
8
+ };
9
+ }
10
+ function O(n, o) {
11
+ return n.open === o ? n : {
12
+ ...n,
13
+ open: o
14
+ };
15
+ }
16
+ function U(n, o) {
17
+ return n.filter === o ? n : {
18
+ ...n,
19
+ filter: o
20
+ };
21
+ }
22
+ function C(n, o, t) {
23
+ const r = De(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 C(n, o > 0 ? 0 : t - 1, t);
34
+ const u = n.activeIndex + Math.trunc(o);
35
+ return r ? C(n, Te(u, t), t) : C(n, u, t);
36
+ }
37
+ function De(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 Te(n, o) {
46
+ return (n % o + o) % o;
47
+ }
48
+ const Ve = 0, Pe = 1, Ne = 2, $e = 3, Ge = 4, He = 5, We = 6, Ke = 7, re = 100;
49
+ function Ue(n, o) {
50
+ const t = X(o);
51
+ if (t.length === 0)
52
+ return [...n];
53
+ const r = n.map((u, v) => ({
54
+ option: u,
55
+ score: Xe(u, t),
56
+ originalIndex: v
57
+ })).filter((u) => u.score < re);
58
+ return r.sort((u, v) => {
59
+ if (u.score !== v.score)
60
+ return u.score - v.score;
61
+ const w = u.option.label.length, s = v.option.label.length;
62
+ return w !== s ? w - s : u.originalIndex - v.originalIndex;
63
+ }), r.map((u) => u.option);
64
+ }
65
+ function Xe(n, o) {
66
+ const t = X(n.label), r = X(n.value);
67
+ return t === o ? Ve : r === o ? Pe : t.startsWith(o) ? Ne : r.startsWith(o) ? $e : ie(t, o) ? Ge : ie(r, o) ? He : t.includes(o) ? We : r.includes(o) ? Ke : 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 X(n) {
73
+ return n.trim().toLocaleLowerCase();
74
+ }
75
+ const ze = ["value", "placeholder", "disabled", "aria-expanded", "aria-activedescendant"], qe = ["data-affino-popover-sticky"], je = {
76
+ key: 0,
77
+ class: "datagrid-cell-combobox__empty"
78
+ }, Je = ["id", "aria-selected", "data-option-index", "onMousemove", "onClick"], Ye = { class: "datagrid-cell-combobox__option-label" }, Ze = {
79
+ key: 0,
80
+ class: "datagrid-cell-combobox__option-state",
81
+ "aria-hidden": "true"
82
+ }, Qe = {
83
+ key: 0,
84
+ class: "datagrid-cell-combobox__empty"
85
+ }, et = {
86
+ inheritAttrs: !1
87
+ }, rt = /* @__PURE__ */ ge({
88
+ ...et,
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 = we(Se, c(null)), v = Ee(), w = c(null), s = c(null), E = c(null), z = c({}), B = c({}), k = c("below"), L = c(""), D = c(!1), T = c([]), l = c(Be({ open: !1 })), V = `datagrid-filterable-combobox-${Math.random().toString(36).slice(2, 10)}`;
105
+ let A = 0;
106
+ const ue = d(() => {
107
+ const {
108
+ class: e,
109
+ style: a,
110
+ type: i,
111
+ value: f,
112
+ placeholder: y,
113
+ disabled: ee,
114
+ onInput: te,
115
+ onFocus: tt,
116
+ onBlur: nt,
117
+ onKeydown: ot,
118
+ onClick: lt,
119
+ ...ye
120
+ } = v;
121
+ return ye;
122
+ }), se = d(() => [
123
+ "cell-editor-control",
124
+ "datagrid-cell-combobox__input",
125
+ v.class
126
+ ]), ce = d(() => v.style), de = d(() => {
127
+ if (!t.inlinePanel)
128
+ return "body";
129
+ }), P = d(() => q.value.find((e) => e.value === t.value) ?? null), q = d(() => t.loadOptions && T.value.length > 0 ? T.value : t.options), b = d(() => Ue(q.value, l.value.filter)), _ = d(() => l.value.activeIndex), j = d(() => _.value >= 0 ? b.value[_.value] ?? null : null), ve = d(() => _.value >= 0 ? J(_.value) : void 0), N = d(() => l.value.open);
130
+ function J(e) {
131
+ return `${V}-option-${e}`;
132
+ }
133
+ function fe() {
134
+ z.value = Me(u.value);
135
+ }
136
+ function $() {
137
+ L.value = P.value?.label ?? t.value;
138
+ }
139
+ function Y() {
140
+ L.value = t.initialFilter;
141
+ }
142
+ function I(e) {
143
+ const a = b.value;
144
+ if (a.length === 0) {
145
+ l.value = {
146
+ ...l.value,
147
+ activeIndex: -1
148
+ };
149
+ return;
150
+ }
151
+ let i = 0;
152
+ if (e && P.value) {
153
+ const f = a.findIndex((y) => y.value === P.value?.value);
154
+ f >= 0 && (i = f);
155
+ }
156
+ l.value = C(l.value, i, a.length);
157
+ }
158
+ async function G(e) {
159
+ if (!t.loadOptions)
160
+ return;
161
+ const a = A + 1;
162
+ A = a, D.value = !0;
163
+ try {
164
+ const i = await t.loadOptions(e);
165
+ if (a !== A)
166
+ return;
167
+ T.value = i, r("optionsResolved", i), I(!0), p(() => {
168
+ g(), x();
169
+ });
170
+ } finally {
171
+ a === A && (D.value = !1);
172
+ }
173
+ }
174
+ function g() {
175
+ if (t.inlinePanel) {
176
+ k.value = "below", B.value = {
177
+ position: "absolute",
178
+ top: "calc(100% - 1px)",
179
+ left: "0px",
180
+ width: "100%",
181
+ maxHeight: "260px",
182
+ zIndex: "4"
183
+ };
184
+ return;
185
+ }
186
+ if (typeof window > "u" || !s.value)
187
+ return;
188
+ const e = s.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;
189
+ k.value = y ? "above" : "below";
190
+ const ee = y ? Math.max(8, e.top - i + 1) : Math.min(window.innerHeight - i - 8, e.bottom - 1), te = Math.min(
191
+ Math.max(8, e.left),
192
+ Math.max(8, window.innerWidth - a - 8)
193
+ );
194
+ B.value = {
195
+ position: "fixed",
196
+ top: `${ee}px`,
197
+ left: `${te}px`,
198
+ width: `${a}px`,
199
+ maxHeight: "260px",
200
+ zIndex: "240"
201
+ };
202
+ }
203
+ function x() {
204
+ if (!E.value || _.value < 0)
205
+ return;
206
+ E.value.querySelector(`[data-option-index="${_.value}"]`)?.scrollIntoView({ block: "nearest" });
207
+ }
208
+ function H() {
209
+ t.disabled || (l.value = O(l.value, !0), I(!0), p(() => {
210
+ if (g(), x(), s.value?.focus({ preventScroll: !0 }), !!s.value) {
211
+ if (l.value.filter.length > 0) {
212
+ const e = s.value.value.length;
213
+ s.value.setSelectionRange(e, e);
214
+ return;
215
+ }
216
+ s.value.select();
217
+ }
218
+ }), t.loadOptions && G(l.value.filter));
219
+ }
220
+ function R() {
221
+ l.value = O(l.value, !1);
222
+ }
223
+ function pe(e) {
224
+ return e instanceof Node && (w.value?.contains(e) === !0 || E.value?.contains(e) === !0);
225
+ }
226
+ function Z(e = "stay") {
227
+ R(), r("commit", t.value, e);
228
+ }
229
+ function Q(e, a = "stay") {
230
+ R(), r("commit", e, a);
231
+ }
232
+ function W(e) {
233
+ l.value = C(l.value, e, b.value.length), p(x);
234
+ }
235
+ function me() {
236
+ t.openOnFocus && H();
237
+ }
238
+ function be() {
239
+ H();
240
+ }
241
+ function he(e) {
242
+ if (t.disabled)
243
+ return;
244
+ const a = e.target.value;
245
+ L.value = a, l.value = U(l.value, a), l.value = O(l.value, !0), I(!1), p(() => {
246
+ g(), x();
247
+ }), t.loadOptions && G(a);
248
+ }
249
+ function _e() {
250
+ p(() => {
251
+ pe(document.activeElement) || Z("stay");
252
+ });
253
+ }
254
+ function xe(e) {
255
+ if (!t.disabled) {
256
+ if (e.key === "ArrowDown") {
257
+ e.preventDefault(), l.value = O(l.value, !0), l.value = ae(l.value, 1, b.value.length, !0), p(x);
258
+ return;
259
+ }
260
+ if (e.key === "ArrowUp") {
261
+ e.preventDefault(), l.value = O(l.value, !0), l.value = ae(l.value, -1, b.value.length, !0), p(x);
262
+ return;
263
+ }
264
+ if (e.key === "Home") {
265
+ e.preventDefault(), W(0);
266
+ return;
267
+ }
268
+ if (e.key === "End") {
269
+ e.preventDefault(), W(Math.max(0, b.value.length - 1));
270
+ return;
271
+ }
272
+ if (e.key === "Enter" || e.key === "Tab") {
273
+ if (e.preventDefault(), j.value) {
274
+ Q(j.value.value, e.shiftKey ? "previous" : "next");
275
+ return;
276
+ }
277
+ Z(e.shiftKey ? "previous" : "next");
278
+ return;
279
+ }
280
+ e.key === "Escape" && (e.preventDefault(), R(), r("cancel"));
281
+ }
282
+ }
283
+ function F() {
284
+ N.value && g();
285
+ }
286
+ return S(() => t.options, () => {
287
+ t.loadOptions || (I(!0), p(g));
288
+ }, { immediate: !0 }), S(() => t.value, () => {
289
+ $();
290
+ }), S(() => t.initialFilter, (e) => {
291
+ document.activeElement !== s.value && (l.value = U(l.value, e), e.length > 0 ? (Y(), G(e)) : $(), I(!0), p(() => {
292
+ g(), x();
293
+ }));
294
+ }), S(() => t.disabled, (e) => {
295
+ e && R();
296
+ }), Ie(() => {
297
+ fe(), t.initialFilter.length > 0 ? (l.value = U(l.value, t.initialFilter), Y()) : $(), t.openOnMount && H(), typeof window < "u" && (window.addEventListener("resize", F), window.addEventListener("scroll", F, !0));
298
+ }), Oe(() => {
299
+ typeof window < "u" && (window.removeEventListener("resize", F), window.removeEventListener("scroll", F, !0));
300
+ }), (e, a) => (m(), h("div", {
301
+ ref_key: "rootEl",
302
+ ref: w,
303
+ class: "datagrid-cell-combobox"
304
+ }, [
305
+ ne("input", Ce({
306
+ ref_key: "inputEl",
307
+ ref: s
308
+ }, ue.value, {
309
+ class: se.value,
310
+ style: ce.value,
311
+ type: "text",
312
+ role: "combobox",
313
+ value: L.value,
314
+ placeholder: e.placeholder,
315
+ disabled: e.disabled,
316
+ "aria-expanded": N.value ? "true" : "false",
317
+ "aria-controls": V,
318
+ "aria-autocomplete": "list",
319
+ "aria-activedescendant": ve.value,
320
+ onFocus: me,
321
+ onClick: M(be, ["stop"]),
322
+ onInput: he,
323
+ onKeydown: M(xe, ["stop"]),
324
+ onBlur: _e
325
+ }), null, 16, ze),
326
+ (m(), ke(Le, {
327
+ to: de.value,
328
+ disabled: e.inlinePanel
329
+ }, [
330
+ N.value ? (m(), h("div", {
331
+ key: 0,
332
+ id: V,
333
+ ref_key: "panelEl",
334
+ ref: E,
335
+ class: oe(["datagrid-cell-combobox__panel", {
336
+ "datagrid-cell-combobox__panel--inline": e.inlinePanel,
337
+ "datagrid-cell-combobox__panel--attached-below": k.value === "below",
338
+ "datagrid-cell-combobox__panel--attached-above": k.value === "above"
339
+ }]),
340
+ "data-affino-popover-sticky": e.stickyPopoverId || void 0,
341
+ style: Ae([z.value, B.value]),
342
+ role: "listbox",
343
+ onMousedown: a[0] || (a[0] = M(() => {
344
+ }, ["prevent"]))
345
+ }, [
346
+ D.value ? (m(), h("div", je, "Loading options...")) : (m(), h(le, { key: 1 }, [
347
+ (m(!0), h(le, null, Re(b.value, (i, f) => (m(), h("button", {
348
+ id: J(f),
349
+ key: `${i.value}-${f}`,
350
+ type: "button",
351
+ class: oe(["datagrid-cell-combobox__option", {
352
+ "datagrid-cell-combobox__option--active": f === _.value,
353
+ "datagrid-cell-combobox__option--selected": i.value === e.value
354
+ }]),
355
+ role: "option",
356
+ "aria-selected": i.value === e.value ? "true" : "false",
357
+ "data-option-index": f,
358
+ onMousemove: (y) => W(f),
359
+ onClick: M((y) => Q(i.value), ["stop"])
360
+ }, [
361
+ ne("span", Ye, Fe(i.label), 1),
362
+ i.value === e.value ? (m(), h("span", Ze)) : K("", !0)
363
+ ], 42, Je))), 128)),
364
+ b.value.length === 0 ? (m(), h("div", Qe, " No matching options ")) : K("", !0)
365
+ ], 64))
366
+ ], 46, qe)) : K("", !0)
367
+ ], 8, ["to", "disabled"]))
368
+ ], 512));
369
+ }
370
+ });
371
+ export {
372
+ rt as _
373
+ };
@@ -0,0 +1,4 @@
1
+ import { _ as f } from "./DataGridFindReplacePopover.vue_vue_type_script_setup_true_lang-DfHFHhUf.js";
2
+ export {
3
+ f as default
4
+ };