@affino/datagrid-vue-app 0.1.2 → 0.1.3

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 (26) hide show
  1. package/dist/DataGrid.d.ts +4 -4
  2. package/dist/advanced-filter.d.ts +2 -0
  3. package/dist/advanced-filter.js +4 -0
  4. package/dist/chunks/DataGridAdvancedFilterPopover-Bak_CkaO.js +4 -0
  5. package/dist/chunks/DataGridAdvancedFilterPopover.vue_vue_type_script_setup_true_lang-DixN56Qv.js +226 -0
  6. package/dist/chunks/DataGridAggregationsPopover-DfQ3-UV4.js +173 -0
  7. package/dist/chunks/DataGridColumnLayoutPopover-Qt56b3CA.js +136 -0
  8. package/dist/chunks/DataGridFilterableCombobox.vue_vue_type_script_setup_true_lang-_1TDQseN.js +399 -0
  9. package/dist/chunks/DataGridGanttStage.vue_vue_type_script_setup_true_lang-CYwB5Dpa.js +916 -0
  10. package/dist/chunks/DataGridGanttStageEntry-B9YlOHt1.js +40 -0
  11. package/dist/chunks/DataGridTableStage.vue_vue_type_script_setup_true_lang-BJJoBCsA.js +6681 -0
  12. package/dist/chunks/useDataGridAppRowModel-Di-Zatjs.js +2761 -0
  13. package/dist/gantt/DataGridGanttStageEntry.d.ts +52 -0
  14. package/dist/gantt.d.ts +3 -0
  15. package/dist/gantt.js +8 -0
  16. package/dist/host/DataGridRuntimeHost.d.ts +2 -2
  17. package/dist/index.js +32 -30
  18. package/dist/internal.js +39 -35
  19. package/dist/overlays/DataGridAdvancedFilterPopover.vue.d.ts +5 -5
  20. package/dist/overlays/DataGridAggregationsPopover.vue.d.ts +4 -4
  21. package/dist/overlays/DataGridColumnLayoutPopover.vue.d.ts +4 -4
  22. package/dist/overlays/DataGridColumnMenu.vue.d.ts +2 -2
  23. package/dist/overlays/DataGridFilterableCombobox.vue.d.ts +2 -2
  24. package/dist/stage/DataGridTableStageCenterPane.vue.d.ts +1 -1
  25. package/package.json +12 -4
  26. package/dist/chunks/useDataGridAppRowModel-CcTL-h8L.js +0 -11251
@@ -382,21 +382,21 @@ declare const _default: import("vue").DefineComponent<{
382
382
  "onUpdate:state"?: ((...args: any[]) => any) | undefined;
383
383
  onReady?: ((...args: any[]) => any) | undefined;
384
384
  }, {
385
- columns: readonly DataGridAppColumnInput[];
386
- aggregations: DataGridAggregationsProp | undefined;
387
385
  rows: readonly unknown[];
388
386
  rowHeightMode: "fixed" | "auto";
389
387
  showRowIndex: boolean;
390
388
  rowHover: boolean;
391
389
  stripedRows: boolean;
392
390
  isCellEditable: DataGridCellEditablePredicate<Record<string, unknown>> | undefined;
391
+ columns: readonly DataGridAppColumnInput[];
393
392
  rowSelection: boolean;
394
393
  gantt: DataGridGanttProp | undefined;
394
+ virtualization: DataGridVirtualizationProp | undefined;
395
+ pagination: DataGridPaginationProp | undefined;
395
396
  rowModel: DataGridRowModel<unknown> | undefined;
397
+ aggregations: DataGridAggregationsProp | undefined;
396
398
  baseRowHeight: number;
397
399
  state: DataGridUnifiedState<Record<string, unknown>> | null | undefined;
398
- virtualization: DataGridVirtualizationProp | undefined;
399
- pagination: DataGridPaginationProp | undefined;
400
400
  sortModel: readonly DataGridSortState[] | undefined;
401
401
  filterModel: DataGridFilterSnapshot | null | undefined;
402
402
  groupBy: DataGridGroupByProp | undefined;
@@ -0,0 +1,2 @@
1
+ export { default as DataGridAdvancedFilterPopover } from "./overlays/DataGridAdvancedFilterPopover.vue";
2
+ export type { DataGridAdvancedFilterOptions, DataGridAdvancedFilterProp, } from "./config/dataGridAdvancedFilter";
@@ -0,0 +1,4 @@
1
+ import { _ as e } from "./chunks/DataGridAdvancedFilterPopover.vue_vue_type_script_setup_true_lang-DixN56Qv.js";
2
+ export {
3
+ e as DataGridAdvancedFilterPopover
4
+ };
@@ -0,0 +1,4 @@
1
+ import { _ as f } from "./DataGridAdvancedFilterPopover.vue_vue_type_script_setup_true_lang-DixN56Qv.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,226 @@
1
+ import { defineComponent as j, inject as q, ref as O, computed as c, watch as m, nextTick as k, openBlock as n, createElementBlock as s, Fragment as b, createElementVNode as e, mergeProps as w, unref as _, toDisplayString as P, createBlock as D, Teleport as z, renderList as S, createVNode as y, createCommentVNode as G } from "vue";
2
+ import { usePopoverController as J, useFloatingPopover as K } from "@affino/popover-vue";
3
+ import { d as L, r as H, _ as h } from "./DataGridFilterableCombobox.vue_vue_type_script_setup_true_lang-_1TDQseN.js";
4
+ const M = { class: "datagrid-advanced-filter__header" }, Q = /* @__PURE__ */ e("div", null, [
5
+ /* @__PURE__ */ e("div", { class: "datagrid-advanced-filter__eyebrow" }, "Advanced filter"),
6
+ /* @__PURE__ */ e("h3", { class: "datagrid-advanced-filter__title" }, "Build clause-based filter")
7
+ ], -1), U = { class: "datagrid-advanced-filter__applied" }, W = { class: "datagrid-advanced-filter__applied-head" }, X = /* @__PURE__ */ e("div", null, [
8
+ /* @__PURE__ */ e("div", { class: "datagrid-advanced-filter__eyebrow" }, "Applied on table"),
9
+ /* @__PURE__ */ e("div", { class: "datagrid-advanced-filter__applied-title" }, "Current filters")
10
+ ], -1), Y = ["disabled"], Z = {
11
+ key: 0,
12
+ class: "datagrid-advanced-filter__applied-list"
13
+ }, x = {
14
+ key: 1,
15
+ class: "datagrid-advanced-filter__applied-empty"
16
+ }, ee = { class: "datagrid-advanced-filter__rows" }, ae = { class: "datagrid-advanced-filter__field datagrid-advanced-filter__field--join" }, te = /* @__PURE__ */ e("span", { class: "datagrid-advanced-filter__label" }, "Join", -1), le = { class: "datagrid-advanced-filter__field" }, oe = /* @__PURE__ */ e("span", { class: "datagrid-advanced-filter__label" }, "Column", -1), de = { class: "datagrid-advanced-filter__field" }, ne = /* @__PURE__ */ e("span", { class: "datagrid-advanced-filter__label" }, "Operator", -1), ie = { class: "datagrid-advanced-filter__field datagrid-advanced-filter__field--value" }, se = /* @__PURE__ */ e("span", { class: "datagrid-advanced-filter__label" }, "Value", -1), re = ["value", "onInput"], ce = { class: "datagrid-advanced-filter__row-actions" }, ue = ["disabled", "onClick"], pe = { class: "datagrid-advanced-filter__footer" }, ve = { class: "datagrid-advanced-filter__footer-actions" }, me = /* @__PURE__ */ j({
17
+ __name: "DataGridAdvancedFilterPopover",
18
+ props: {
19
+ isOpen: { type: Boolean },
20
+ clauses: {},
21
+ columns: {},
22
+ appliedFilterSummaryItems: { default: () => [] },
23
+ hasAnyFilters: { type: Boolean, default: !1 },
24
+ buttonLabel: { default: "Advanced filter" },
25
+ active: { type: Boolean, default: !1 }
26
+ },
27
+ emits: ["open", "add", "remove", "apply", "cancel", "reset-all", "update-clause"],
28
+ setup(T, { emit: A }) {
29
+ const F = Object.freeze([
30
+ { value: "and", label: "AND" },
31
+ { value: "or", label: "OR" }
32
+ ]), I = Object.freeze([
33
+ { value: "contains", label: "Contains" },
34
+ { value: "equals", label: "Equals" },
35
+ { value: "not-equals", label: "Not equals" },
36
+ { value: "starts-with", label: "Starts with" },
37
+ { value: "ends-with", label: "Ends with" },
38
+ { value: "gt", label: ">" },
39
+ { value: "gte", label: ">=" },
40
+ { value: "lt", label: "<" },
41
+ { value: "lte", label: "<=" }
42
+ ]), u = T, d = A, C = q(L, O(null)), f = O({}), o = J(
43
+ {
44
+ id: "advanced-filter",
45
+ role: "dialog",
46
+ closeOnEscape: !0,
47
+ closeOnInteractOutside: !0
48
+ },
49
+ {
50
+ onOpen: () => {
51
+ u.isOpen || d("open"), g();
52
+ },
53
+ onClose: () => {
54
+ u.isOpen && d("cancel");
55
+ }
56
+ }
57
+ ), r = K(o, {
58
+ placement: "bottom",
59
+ align: "start",
60
+ gutter: 10,
61
+ viewportPadding: 12,
62
+ zIndex: 180,
63
+ lockScroll: !1,
64
+ returnFocus: !0
65
+ }), R = c(() => o.getTriggerProps({ role: "dialog" })), N = c(() => o.getContentProps({ role: "dialog", tabIndex: -1 })), E = c(() => o.state.value.open), V = c(() => r.contentStyle.value), $ = c(() => r.teleportTarget.value), B = c(() => u.columns.map((t) => ({
66
+ value: t.key,
67
+ label: t.label
68
+ })));
69
+ m(
70
+ () => u.isOpen,
71
+ async (t) => {
72
+ if (t) {
73
+ g(), o.state.value.open || o.open("programmatic"), await k(), r.contentRef.value?.querySelector('[data-advanced-filter-autofocus="true"]')?.focus({ preventScroll: !0 }), await r.updatePosition();
74
+ return;
75
+ }
76
+ o.state.value.open && o.close("programmatic");
77
+ },
78
+ { immediate: !0 }
79
+ ), m(C, () => {
80
+ o.state.value.open && g();
81
+ }), m(
82
+ () => u.clauses.length,
83
+ async () => {
84
+ o.state.value.open && (await k(), await r.updatePosition());
85
+ }
86
+ );
87
+ function g() {
88
+ f.value = H(C.value);
89
+ }
90
+ function p(t, l, a) {
91
+ d("update-clause", { clauseId: t, field: l, value: a });
92
+ }
93
+ return (t, l) => (n(), s(b, null, [
94
+ e("button", w({
95
+ ref: _(r).triggerRef,
96
+ type: "button",
97
+ class: ["datagrid-app-toolbar__button", { "datagrid-app-toolbar__button--active": t.active }],
98
+ style: f.value
99
+ }, R.value), P(t.buttonLabel), 17),
100
+ (n(), D(z, { to: $.value }, [
101
+ E.value ? (n(), s("section", w({
102
+ key: 0,
103
+ ref: _(r).contentRef,
104
+ class: "datagrid-advanced-filter",
105
+ "data-datagrid-overlay-surface": "true",
106
+ style: [V.value, f.value]
107
+ }, N.value), [
108
+ e("header", M, [
109
+ Q,
110
+ e("button", {
111
+ type: "button",
112
+ class: "datagrid-advanced-filter__ghost",
113
+ onClick: l[0] || (l[0] = (a) => d("cancel"))
114
+ }, " Close ")
115
+ ]),
116
+ e("section", U, [
117
+ e("div", W, [
118
+ X,
119
+ e("button", {
120
+ type: "button",
121
+ class: "datagrid-advanced-filter__ghost",
122
+ disabled: !t.hasAnyFilters,
123
+ "data-datagrid-advanced-filter-action": "reset-all",
124
+ onClick: l[1] || (l[1] = (a) => d("reset-all"))
125
+ }, " Reset all filters ", 8, Y)
126
+ ]),
127
+ t.appliedFilterSummaryItems.length > 0 ? (n(), s("div", Z, [
128
+ (n(!0), s(b, null, S(t.appliedFilterSummaryItems, (a, v) => (n(), s("span", {
129
+ key: `applied-filter-${v}`,
130
+ class: "datagrid-advanced-filter__applied-chip"
131
+ }, P(a), 1))), 128))
132
+ ])) : (n(), s("div", x, " No filters applied "))
133
+ ]),
134
+ e("div", ee, [
135
+ (n(!0), s(b, null, S(t.clauses, (a, v) => (n(), s("div", {
136
+ key: a.id,
137
+ class: "datagrid-advanced-filter__row"
138
+ }, [
139
+ e("label", ae, [
140
+ te,
141
+ y(h, {
142
+ class: "datagrid-advanced-filter__select",
143
+ value: a.join,
144
+ options: _(F),
145
+ "open-on-mount": !1,
146
+ "open-on-focus": !1,
147
+ "sticky-popover-id": "advanced-filter",
148
+ disabled: v === 0,
149
+ "aria-label": "Join operator",
150
+ onCommit: (i) => p(a.id, "join", i)
151
+ }, null, 8, ["value", "options", "disabled", "onCommit"])
152
+ ]),
153
+ e("label", le, [
154
+ oe,
155
+ y(h, {
156
+ class: "datagrid-advanced-filter__select",
157
+ value: a.columnKey,
158
+ options: B.value,
159
+ "open-on-mount": !1,
160
+ "open-on-focus": !1,
161
+ "sticky-popover-id": "advanced-filter",
162
+ "data-advanced-filter-autofocus": v === 0 ? "true" : null,
163
+ "aria-label": "Column",
164
+ onCommit: (i) => p(a.id, "columnKey", i)
165
+ }, null, 8, ["value", "options", "data-advanced-filter-autofocus", "onCommit"])
166
+ ]),
167
+ e("label", de, [
168
+ ne,
169
+ y(h, {
170
+ class: "datagrid-advanced-filter__select",
171
+ value: a.operator,
172
+ options: _(I),
173
+ "open-on-mount": !1,
174
+ "open-on-focus": !1,
175
+ "sticky-popover-id": "advanced-filter",
176
+ "aria-label": "Condition operator",
177
+ onCommit: (i) => p(a.id, "operator", i)
178
+ }, null, 8, ["value", "options", "onCommit"])
179
+ ]),
180
+ e("label", ie, [
181
+ se,
182
+ e("input", {
183
+ value: a.value,
184
+ type: "text",
185
+ placeholder: "Value",
186
+ "aria-label": "Condition value",
187
+ onInput: (i) => p(a.id, "value", i.target.value)
188
+ }, null, 40, re)
189
+ ]),
190
+ e("div", ce, [
191
+ e("button", {
192
+ type: "button",
193
+ class: "datagrid-advanced-filter__ghost datagrid-advanced-filter__ghost--danger",
194
+ disabled: t.clauses.length <= 1,
195
+ onClick: (i) => d("remove", a.id)
196
+ }, " Remove ", 8, ue)
197
+ ])
198
+ ]))), 128))
199
+ ]),
200
+ e("footer", pe, [
201
+ e("button", {
202
+ type: "button",
203
+ class: "datagrid-advanced-filter__secondary",
204
+ onClick: l[2] || (l[2] = (a) => d("add"))
205
+ }, " Add clause "),
206
+ e("div", ve, [
207
+ e("button", {
208
+ type: "button",
209
+ class: "datagrid-advanced-filter__secondary",
210
+ onClick: l[3] || (l[3] = (a) => d("cancel"))
211
+ }, " Cancel "),
212
+ e("button", {
213
+ type: "button",
214
+ class: "datagrid-advanced-filter__primary",
215
+ onClick: l[4] || (l[4] = (a) => d("apply"))
216
+ }, " Apply ")
217
+ ])
218
+ ])
219
+ ], 16)) : G("", !0)
220
+ ], 8, ["to"]))
221
+ ], 64));
222
+ }
223
+ });
224
+ export {
225
+ me as _
226
+ };
@@ -0,0 +1,173 @@
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
+ 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";
4
+ const U = ["disabled", "title"], H = { class: "datagrid-aggregations__header" }, J = /* @__PURE__ */ e("div", null, [
5
+ /* @__PURE__ */ e("div", { class: "datagrid-aggregations__eyebrow" }, "Aggregations"),
6
+ /* @__PURE__ */ e("h3", { class: "datagrid-aggregations__title" }, "Group aggregate model")
7
+ ], -1), M = { class: "datagrid-aggregations__basis" }, Q = /* @__PURE__ */ e("span", { class: "datagrid-aggregations__label" }, "Basis", -1), W = {
8
+ key: 0,
9
+ class: "datagrid-aggregations__list"
10
+ }, X = { class: "datagrid-aggregations__toggle" }, Y = ["checked", "onChange"], Z = { class: "datagrid-aggregations__row-label" }, x = {
11
+ key: 1,
12
+ class: "datagrid-aggregations__empty"
13
+ }, ee = { class: "datagrid-aggregations__footer" }, te = { class: "datagrid-aggregations__footer-actions" }, ne = /* @__PURE__ */ V({
14
+ __name: "DataGridAggregationsPopover",
15
+ props: {
16
+ isOpen: { type: Boolean },
17
+ basis: {},
18
+ items: {},
19
+ buttonLabel: { default: "Aggregations" },
20
+ active: { type: Boolean, default: !1 },
21
+ disabled: { type: Boolean, default: !1 },
22
+ disabledReason: { default: "" }
23
+ },
24
+ emits: ["open", "apply", "clear", "cancel", "update-basis", "toggle-column", "update-op"],
25
+ setup(w, { emit: P }) {
26
+ const T = Object.freeze([
27
+ { value: "filtered", label: "Filtered rows" },
28
+ { value: "source", label: "Source rows" }
29
+ ]), g = w, n = P, v = E(q, b(null)), c = b({}), s = j(
30
+ {
31
+ id: "aggregations",
32
+ role: "dialog",
33
+ closeOnEscape: !0,
34
+ closeOnInteractOutside: !0
35
+ },
36
+ {
37
+ onOpen: () => {
38
+ g.isOpen || n("open"), u();
39
+ },
40
+ onClose: () => {
41
+ g.isOpen && n("cancel");
42
+ }
43
+ }
44
+ ), r = z(s, {
45
+ placement: "bottom",
46
+ align: "start",
47
+ gutter: 10,
48
+ viewportPadding: 12,
49
+ zIndex: 180,
50
+ lockScroll: !1,
51
+ returnFocus: !0
52
+ }), A = d(() => s.getTriggerProps({ role: "dialog" })), B = d(() => s.getContentProps({ role: "dialog", tabIndex: -1 })), R = d(() => s.state.value.open), S = d(() => r.contentStyle.value), $ = d(() => r.teleportTarget.value);
53
+ _(
54
+ () => g.isOpen,
55
+ async (t) => {
56
+ if (t) {
57
+ u(), s.state.value.open || s.open("programmatic"), await m(), r.contentRef.value?.querySelector('[data-aggregations-autofocus="true"]')?.focus({ preventScroll: !0 }), await r.updatePosition();
58
+ return;
59
+ }
60
+ s.state.value.open && s.close("programmatic");
61
+ },
62
+ { immediate: !0 }
63
+ ), _(v, () => {
64
+ s.state.value.open && u();
65
+ }), _(
66
+ () => `${g.basis}:${g.items.length}`,
67
+ async () => {
68
+ s.state.value.open && (await m(), await r.updatePosition());
69
+ }
70
+ );
71
+ function u() {
72
+ c.value = K(v.value);
73
+ }
74
+ function F(t) {
75
+ return t === "countNonNull" ? "Count non-null" : t.charAt(0).toUpperCase() + t.slice(1);
76
+ }
77
+ function N(t) {
78
+ return t.map((a) => ({
79
+ value: a,
80
+ label: F(a)
81
+ }));
82
+ }
83
+ return (t, a) => (l(), i(y, null, [
84
+ e("button", h({
85
+ ref: f(r).triggerRef,
86
+ type: "button",
87
+ class: ["datagrid-app-toolbar__button", { "datagrid-app-toolbar__button--active": t.active }]
88
+ }, A.value, {
89
+ style: c.value,
90
+ disabled: t.disabled,
91
+ title: t.disabledReason || void 0
92
+ }), k(t.buttonLabel), 17, U),
93
+ (l(), G(D, { to: $.value }, [
94
+ R.value ? (l(), i("section", h({
95
+ key: 0,
96
+ ref: f(r).contentRef,
97
+ class: "datagrid-aggregations",
98
+ "data-datagrid-overlay-surface": "true",
99
+ style: [S.value, c.value]
100
+ }, B.value), [
101
+ e("header", H, [
102
+ J,
103
+ e("button", {
104
+ type: "button",
105
+ class: "datagrid-aggregations__ghost",
106
+ onClick: a[0] || (a[0] = (o) => n("cancel"))
107
+ }, " Close ")
108
+ ]),
109
+ e("label", M, [
110
+ Q,
111
+ C(O, {
112
+ class: "datagrid-aggregations__select",
113
+ value: t.basis,
114
+ options: f(T),
115
+ "open-on-mount": !1,
116
+ "open-on-focus": !1,
117
+ "sticky-popover-id": "aggregations",
118
+ "data-aggregations-autofocus": "true",
119
+ onCommit: a[1] || (a[1] = (o) => n("update-basis", o))
120
+ }, null, 8, ["value", "options"])
121
+ ]),
122
+ t.items.length > 0 ? (l(), i("div", W, [
123
+ (l(!0), i(y, null, I(t.items, (o) => (l(), i("div", {
124
+ key: o.key,
125
+ class: "datagrid-aggregations__row"
126
+ }, [
127
+ e("label", X, [
128
+ e("input", {
129
+ type: "checkbox",
130
+ checked: o.enabled,
131
+ onChange: (p) => n("toggle-column", o.key, p.target.checked)
132
+ }, null, 40, Y),
133
+ e("span", Z, k(o.label), 1)
134
+ ]),
135
+ C(O, {
136
+ class: "datagrid-aggregations__op",
137
+ value: o.op,
138
+ options: N(o.allowedOps),
139
+ "open-on-mount": !1,
140
+ "open-on-focus": !1,
141
+ "sticky-popover-id": "aggregations",
142
+ disabled: !o.enabled,
143
+ onCommit: (p) => n("update-op", o.key, p)
144
+ }, null, 8, ["value", "options", "disabled", "onCommit"])
145
+ ]))), 128))
146
+ ])) : (l(), i("div", x, " No aggregatable columns in the current grid schema. ")),
147
+ e("footer", ee, [
148
+ e("button", {
149
+ type: "button",
150
+ class: "datagrid-aggregations__secondary",
151
+ onClick: a[2] || (a[2] = (o) => n("clear"))
152
+ }, " Clear "),
153
+ e("div", te, [
154
+ e("button", {
155
+ type: "button",
156
+ class: "datagrid-aggregations__secondary",
157
+ onClick: a[3] || (a[3] = (o) => n("cancel"))
158
+ }, " Cancel "),
159
+ e("button", {
160
+ type: "button",
161
+ class: "datagrid-aggregations__primary",
162
+ onClick: a[4] || (a[4] = (o) => n("apply"))
163
+ }, " Apply ")
164
+ ])
165
+ ])
166
+ ], 16)) : L("", !0)
167
+ ], 8, ["to"]))
168
+ ], 64));
169
+ }
170
+ });
171
+ export {
172
+ ne as default
173
+ };
@@ -0,0 +1,136 @@
1
+ import { defineComponent as E, inject as F, ref as g, computed as i, watch as m, nextTick as _, openBlock as r, createElementBlock as u, Fragment as b, createElementVNode as t, mergeProps as f, unref as k, toDisplayString as h, createBlock as R, Teleport as $, renderList as x, createCommentVNode as D } from "vue";
2
+ import { usePopoverController as L, useFloatingPopover as G } from "@affino/popover-vue";
3
+ import { d as I, r as A } from "./DataGridFilterableCombobox.vue_vue_type_script_setup_true_lang-_1TDQseN.js";
4
+ const M = { class: "datagrid-column-layout__header" }, N = /* @__PURE__ */ t("div", null, [
5
+ /* @__PURE__ */ t("div", { class: "datagrid-column-layout__eyebrow" }, "Column layout"),
6
+ /* @__PURE__ */ t("h3", { class: "datagrid-column-layout__title" }, "Order and visibility")
7
+ ], -1), j = { class: "datagrid-column-layout__list" }, q = { class: "datagrid-column-layout__visibility" }, z = ["checked", "onChange"], K = { class: "datagrid-column-layout__label" }, U = { class: "datagrid-column-layout__move-actions" }, H = ["disabled", "onClick"], J = ["disabled", "onClick"], Q = { class: "datagrid-column-layout__footer" }, Z = /* @__PURE__ */ E({
8
+ __name: "DataGridColumnLayoutPopover",
9
+ props: {
10
+ isOpen: { type: Boolean },
11
+ items: {},
12
+ buttonLabel: { default: "Columns" },
13
+ active: { type: Boolean, default: !1 }
14
+ },
15
+ emits: ["open", "toggle-visibility", "move-up", "move-down", "apply", "cancel"],
16
+ setup(C, { emit: O }) {
17
+ const c = C, n = O, v = F(I, g(null)), d = g({}), o = L(
18
+ {
19
+ id: "column-layout",
20
+ role: "dialog",
21
+ closeOnEscape: !0,
22
+ closeOnInteractOutside: !0
23
+ },
24
+ {
25
+ onOpen: () => {
26
+ c.isOpen || n("open"), p();
27
+ },
28
+ onClose: () => {
29
+ c.isOpen && n("cancel");
30
+ }
31
+ }
32
+ ), l = G(o, {
33
+ placement: "bottom",
34
+ align: "start",
35
+ gutter: 10,
36
+ viewportPadding: 12,
37
+ zIndex: 180,
38
+ lockScroll: !1,
39
+ returnFocus: !0
40
+ }), w = i(() => o.getTriggerProps({ role: "dialog" })), P = i(() => o.getContentProps({ role: "dialog", tabIndex: -1 })), T = i(() => o.state.value.open), S = i(() => l.contentStyle.value), V = i(() => l.teleportTarget.value);
41
+ m(
42
+ () => c.isOpen,
43
+ async (s) => {
44
+ if (s) {
45
+ p(), o.state.value.open || o.open("programmatic"), await _(), l.contentRef.value?.querySelector('input[type="checkbox"]')?.focus({ preventScroll: !0 }), await l.updatePosition();
46
+ return;
47
+ }
48
+ o.state.value.open && o.close("programmatic");
49
+ },
50
+ { immediate: !0 }
51
+ ), m(v, () => {
52
+ o.state.value.open && p();
53
+ }), m(
54
+ () => c.items.length,
55
+ async () => {
56
+ o.state.value.open && (await _(), await l.updatePosition());
57
+ }
58
+ );
59
+ function p() {
60
+ d.value = A(v.value);
61
+ }
62
+ function B(s, a) {
63
+ n("toggle-visibility", { key: s, visible: a });
64
+ }
65
+ return (s, a) => (r(), u(b, null, [
66
+ t("button", f({
67
+ ref: k(l).triggerRef,
68
+ type: "button",
69
+ class: ["datagrid-app-toolbar__button", { "datagrid-app-toolbar__button--active": s.active }],
70
+ style: d.value
71
+ }, w.value), h(s.buttonLabel), 17),
72
+ (r(), R($, { to: V.value }, [
73
+ T.value ? (r(), u("section", f({
74
+ key: 0,
75
+ ref: k(l).contentRef,
76
+ class: "datagrid-column-layout",
77
+ "data-datagrid-overlay-surface": "true",
78
+ style: [S.value, d.value]
79
+ }, P.value), [
80
+ t("header", M, [
81
+ N,
82
+ t("button", {
83
+ type: "button",
84
+ class: "datagrid-column-layout__ghost",
85
+ onClick: a[0] || (a[0] = (e) => n("cancel"))
86
+ }, " Close ")
87
+ ]),
88
+ t("div", j, [
89
+ (r(!0), u(b, null, x(s.items, (e) => (r(), u("div", {
90
+ key: e.key,
91
+ class: "datagrid-column-layout__row"
92
+ }, [
93
+ t("label", q, [
94
+ t("input", {
95
+ type: "checkbox",
96
+ checked: e.visible,
97
+ onChange: (y) => B(e.key, y.target.checked)
98
+ }, null, 40, z),
99
+ t("span", K, h(e.label), 1)
100
+ ]),
101
+ t("div", U, [
102
+ t("button", {
103
+ type: "button",
104
+ class: "datagrid-column-layout__icon-button",
105
+ disabled: !e.canMoveUp,
106
+ onClick: (y) => n("move-up", e.key)
107
+ }, " ↑ ", 8, H),
108
+ t("button", {
109
+ type: "button",
110
+ class: "datagrid-column-layout__icon-button",
111
+ disabled: !e.canMoveDown,
112
+ onClick: (y) => n("move-down", e.key)
113
+ }, " ↓ ", 8, J)
114
+ ])
115
+ ]))), 128))
116
+ ]),
117
+ t("footer", Q, [
118
+ t("button", {
119
+ type: "button",
120
+ class: "datagrid-column-layout__secondary",
121
+ onClick: a[1] || (a[1] = (e) => n("cancel"))
122
+ }, " Cancel "),
123
+ t("button", {
124
+ type: "button",
125
+ class: "datagrid-column-layout__primary",
126
+ onClick: a[2] || (a[2] = (e) => n("apply"))
127
+ }, " Apply ")
128
+ ])
129
+ ], 16)) : D("", !0)
130
+ ], 8, ["to"]))
131
+ ], 64));
132
+ }
133
+ });
134
+ export {
135
+ Z as default
136
+ };