@medyat/vue-data-table 0.0.0-stage → 1.0.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.
- package/CHANGELOG.md +32 -0
- package/LICENSE +21 -0
- package/README.md +179 -2
- package/dist/DateEditor-BTIZMwf1.js +224 -0
- package/dist/DateEditor-BTIZMwf1.js.map +1 -0
- package/dist/FiltersSheet-o2HaQuhq.js +285 -0
- package/dist/FiltersSheet-o2HaQuhq.js.map +1 -0
- package/dist/Layer-Di-tPd8b.js +106 -0
- package/dist/Layer-Di-tPd8b.js.map +1 -0
- package/dist/PhoneMoreSheet-gfkH96RR.js +227 -0
- package/dist/PhoneMoreSheet-gfkH96RR.js.map +1 -0
- package/dist/TextEditor-DPqiiRau.js +331 -0
- package/dist/TextEditor-DPqiiRau.js.map +1 -0
- package/dist/index.d.ts +711 -0
- package/dist/index.js +3331 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin-DhgcjEdi.js +813 -0
- package/dist/plugin-DhgcjEdi.js.map +1 -0
- package/dist/query-DQWMlX0m.js +2121 -0
- package/dist/query-DQWMlX0m.js.map +1 -0
- package/dist/shadcn-bridge-hsl.css +22 -0
- package/dist/shadcn-bridge.css +23 -0
- package/dist/sheet.d.ts +622 -0
- package/dist/sheet.js +3783 -0
- package/dist/sheet.js.map +1 -0
- package/dist/style.css +2 -0
- package/package.json +85 -3
package/dist/index.js
ADDED
|
@@ -0,0 +1,3331 @@
|
|
|
1
|
+
import { $ as e, A as t, D as n, E as r, F as i, G as a, I as o, J as s, K as c, L as l, M as u, N as d, O as f, P as p, Q as m, T as h, U as g, W as ee, Y as te, _, a as v, b as ne, c as re, d as y, f as ie, i as b, k as ae, l as oe, m as se, n as ce, q as le, r as ue, t as x, u as de, z as fe } from "./query-DQWMlX0m.js";
|
|
2
|
+
import { a as S, i as pe, n as me, r as C, t as w } from "./plugin-DhgcjEdi.js";
|
|
3
|
+
import { a as T, i as E, n as D, r as O, t as k } from "./TextEditor-DPqiiRau.js";
|
|
4
|
+
import { t as he } from "./Layer-Di-tPd8b.js";
|
|
5
|
+
import { Fragment as A, computed as j, createBlock as M, createCommentVNode as N, createElementBlock as P, createElementVNode as F, createSlots as ge, createTextVNode as I, createVNode as L, defineAsyncComponent as _e, defineComponent as R, getCurrentInstance as ve, mergeModels as ye, mergeProps as be, nextTick as xe, normalizeClass as z, normalizeStyle as Se, onBeforeUnmount as Ce, onMounted as we, openBlock as B, reactive as Te, ref as V, renderList as H, renderSlot as U, resolveDynamicComponent as W, shallowRef as Ee, toDisplayString as G, toHandlers as De, toRaw as Oe, toValue as ke, unref as K, useId as Ae, useModel as je, vModelCheckbox as Me, vModelText as Ne, vShow as Pe, watch as q, watchEffect as Fe, withCtx as J, withDirectives as Ie, withKeys as Le, withModifiers as Re } from "vue";
|
|
6
|
+
import { PhArrowClockwise as ze, PhArrowUp as Be, PhCaretDown as Ve, PhCaretLeft as He, PhCaretRight as Ue, PhCheck as We, PhCircleNotch as Ge, PhDotsThree as Ke, PhFunnel as qe, PhMagnifyingGlass as Je, PhPlus as Ye, PhPushPin as Xe, PhWarning as Ze, PhX as Qe } from "@phosphor-icons/vue";
|
|
7
|
+
import { columnFilteringFeature as Y, createFilteredRowModel as $e, createPaginatedRowModel as et, createSortedRowModel as tt, functionalUpdate as nt, globalFilteringFeature as rt, rowExpandingFeature as it, rowPaginationFeature as at, rowSelectionFeature as ot, rowSortingFeature as st, tableFeatures as ct, useTable as lt } from "@tanstack/vue-table";
|
|
8
|
+
import { DialogClose as ut, DialogContent as dt, DialogDescription as ft, DialogOverlay as pt, DialogPortal as mt, DialogRoot as X, DialogTitle as ht, DropdownMenuCheckboxItem as gt, DropdownMenuContent as _t, DropdownMenuItem as Z, DropdownMenuLabel as vt, DropdownMenuPortal as Q, DropdownMenuRoot as yt, DropdownMenuSeparator as $, DropdownMenuSub as bt, DropdownMenuSubContent as xt, DropdownMenuSubTrigger as St, DropdownMenuTrigger as Ct, ListboxContent as wt, ListboxFilter as Tt, ListboxGroup as Et, ListboxGroupLabel as Dt, ListboxItem as Ot, ListboxRoot as kt, PopoverContent as At, PopoverPortal as jt, PopoverRoot as Mt, PopoverTrigger as Nt } from "reka-ui";
|
|
9
|
+
import { useVirtualizer as Pt } from "@tanstack/vue-virtual";
|
|
10
|
+
//#region src/core/filters/ColumnPicker.vue?vue&type=script&setup=true&lang.ts
|
|
11
|
+
var Ft = { class: "dt-input has-icon dt-picker-search" }, It = { class: "dt-input-icon" }, Lt = { class: "dt-picker-name" }, Rt = { class: "dt-picker-hint" }, zt = { class: "dt-picker-name" }, Bt = { class: "dt-picker-hint" }, Vt = { class: "dt-picker-name" }, Ht = { class: "dt-picker-hint" }, Ut = {
|
|
12
|
+
key: 3,
|
|
13
|
+
class: "dt-options-empty"
|
|
14
|
+
}, Wt = /* @__PURE__ */ R({
|
|
15
|
+
__name: "ColumnPicker",
|
|
16
|
+
props: /*@__PURE__*/ ye({
|
|
17
|
+
columns: {},
|
|
18
|
+
chips: {}
|
|
19
|
+
}, {
|
|
20
|
+
open: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: !1
|
|
23
|
+
},
|
|
24
|
+
openModifiers: {}
|
|
25
|
+
}),
|
|
26
|
+
emits: /*@__PURE__*/ ye(["pick"], ["update:open"]),
|
|
27
|
+
setup(e, { emit: t }) {
|
|
28
|
+
let n = e, r = t, i = je(e, "open"), { i18n: o } = pe(), c = V("");
|
|
29
|
+
q(i, (e) => {
|
|
30
|
+
e || (c.value = "");
|
|
31
|
+
});
|
|
32
|
+
let l = j(() => n.columns.filter((e) => e.filterable ?? a[e.type].filterable)), u = (e) => !c.value || e.header.toLocaleLowerCase().includes(c.value.toLocaleLowerCase()), d = j(() => n.chips.map((e) => l.value.find((t) => t.id === e.column)).filter((e) => !!e && u(e))), f = j(() => new Set(n.chips.map((e) => e.column))), p = j(() => l.value.filter((e) => e.suggested && !f.value.has(e.id) && u(e)).slice(0, 4)), m = j(() => {
|
|
33
|
+
let e = /* @__PURE__ */ new Set([...f.value, ...p.value.map((e) => e.id)]);
|
|
34
|
+
return l.value.filter((t) => !e.has(t.id) && u(t));
|
|
35
|
+
}), h = j(() => !d.value.length && !p.value.length && !m.value.length), g = (e) => {
|
|
36
|
+
typeof e == "string" && (i.value = !1, r("pick", e));
|
|
37
|
+
};
|
|
38
|
+
return (e, t) => (B(), M(K(Mt), {
|
|
39
|
+
open: i.value,
|
|
40
|
+
"onUpdate:open": t[1] ||= (e) => i.value = e
|
|
41
|
+
}, {
|
|
42
|
+
default: J(() => [L(K(Nt), { "as-child": "" }, {
|
|
43
|
+
default: J(() => [U(e.$slots, "trigger")]),
|
|
44
|
+
_: 3
|
|
45
|
+
}), L(K(jt), null, {
|
|
46
|
+
default: J(() => [L(K(At), {
|
|
47
|
+
class: "dt-pop dt-picker",
|
|
48
|
+
align: "start",
|
|
49
|
+
"side-offset": 4
|
|
50
|
+
}, {
|
|
51
|
+
default: J(() => [L(K(kt), {
|
|
52
|
+
"model-value": void 0,
|
|
53
|
+
"selection-behavior": "replace",
|
|
54
|
+
"highlight-on-hover": "",
|
|
55
|
+
"onUpdate:modelValue": g
|
|
56
|
+
}, {
|
|
57
|
+
default: J(() => [F("label", Ft, [F("span", It, [L(K(Je), {
|
|
58
|
+
size: 14,
|
|
59
|
+
"aria-hidden": "true"
|
|
60
|
+
})]), L(K(Tt), {
|
|
61
|
+
modelValue: c.value,
|
|
62
|
+
"onUpdate:modelValue": t[0] ||= (e) => c.value = e,
|
|
63
|
+
"auto-focus": "",
|
|
64
|
+
placeholder: K(o).t("picker.search"),
|
|
65
|
+
"aria-label": K(o).t("picker.search")
|
|
66
|
+
}, null, 8, [
|
|
67
|
+
"modelValue",
|
|
68
|
+
"placeholder",
|
|
69
|
+
"aria-label"
|
|
70
|
+
])]), L(K(wt), {
|
|
71
|
+
class: "dt-picker-list",
|
|
72
|
+
"aria-label": K(o).t("display.columns")
|
|
73
|
+
}, {
|
|
74
|
+
default: J(() => [
|
|
75
|
+
d.value.length ? (B(), M(K(Et), { key: 0 }, {
|
|
76
|
+
default: J(() => [L(K(Dt), { class: "dt-pop-label" }, {
|
|
77
|
+
default: J(() => [I(G(K(o).t("picker.filtered")), 1)]),
|
|
78
|
+
_: 1
|
|
79
|
+
}), (B(!0), P(A, null, H(d.value, (e) => (B(), M(K(Ot), {
|
|
80
|
+
key: e.id,
|
|
81
|
+
value: e.id,
|
|
82
|
+
class: "dt-picker-item"
|
|
83
|
+
}, {
|
|
84
|
+
default: J(() => [
|
|
85
|
+
(B(), M(W(K(T)[e.type]), {
|
|
86
|
+
size: 14,
|
|
87
|
+
"aria-hidden": "true"
|
|
88
|
+
})),
|
|
89
|
+
F("span", Lt, G(e.header), 1),
|
|
90
|
+
F("span", Rt, G(K(o).t("picker.filteredHint")), 1)
|
|
91
|
+
]),
|
|
92
|
+
_: 2
|
|
93
|
+
}, 1032, ["value"]))), 128))]),
|
|
94
|
+
_: 1
|
|
95
|
+
})) : N("", !0),
|
|
96
|
+
p.value.length ? (B(), M(K(Et), { key: 1 }, {
|
|
97
|
+
default: J(() => [L(K(Dt), { class: "dt-pop-label" }, {
|
|
98
|
+
default: J(() => [I(G(K(o).t("picker.suggested")), 1)]),
|
|
99
|
+
_: 1
|
|
100
|
+
}), (B(!0), P(A, null, H(p.value, (e) => (B(), M(K(Ot), {
|
|
101
|
+
key: e.id,
|
|
102
|
+
value: e.id,
|
|
103
|
+
class: "dt-picker-item"
|
|
104
|
+
}, {
|
|
105
|
+
default: J(() => [
|
|
106
|
+
(B(), M(W(K(T)[e.type]), {
|
|
107
|
+
size: 14,
|
|
108
|
+
"aria-hidden": "true"
|
|
109
|
+
})),
|
|
110
|
+
F("span", zt, G(e.header), 1),
|
|
111
|
+
F("span", Bt, G(K(o).t(K(s)(e.type))), 1)
|
|
112
|
+
]),
|
|
113
|
+
_: 2
|
|
114
|
+
}, 1032, ["value"]))), 128))]),
|
|
115
|
+
_: 1
|
|
116
|
+
})) : N("", !0),
|
|
117
|
+
m.value.length ? (B(), M(K(Et), { key: 2 }, {
|
|
118
|
+
default: J(() => [L(K(Dt), { class: "dt-pop-label" }, {
|
|
119
|
+
default: J(() => [I(G(K(o).t("picker.allColumns")), 1)]),
|
|
120
|
+
_: 1
|
|
121
|
+
}), (B(!0), P(A, null, H(m.value, (e) => (B(), M(K(Ot), {
|
|
122
|
+
key: e.id,
|
|
123
|
+
value: e.id,
|
|
124
|
+
class: "dt-picker-item"
|
|
125
|
+
}, {
|
|
126
|
+
default: J(() => [
|
|
127
|
+
(B(), M(W(K(T)[e.type]), {
|
|
128
|
+
size: 14,
|
|
129
|
+
"aria-hidden": "true"
|
|
130
|
+
})),
|
|
131
|
+
F("span", Vt, G(e.header), 1),
|
|
132
|
+
F("span", Ht, G(K(o).t(K(s)(e.type))), 1)
|
|
133
|
+
]),
|
|
134
|
+
_: 2
|
|
135
|
+
}, 1032, ["value"]))), 128))]),
|
|
136
|
+
_: 1
|
|
137
|
+
})) : N("", !0),
|
|
138
|
+
h.value ? (B(), P("div", Ut, G(K(o).t("picker.noMatch")), 1)) : N("", !0)
|
|
139
|
+
]),
|
|
140
|
+
_: 1
|
|
141
|
+
}, 8, ["aria-label"])]),
|
|
142
|
+
_: 1
|
|
143
|
+
})]),
|
|
144
|
+
_: 1
|
|
145
|
+
})]),
|
|
146
|
+
_: 1
|
|
147
|
+
})]),
|
|
148
|
+
_: 3
|
|
149
|
+
}, 8, ["open"]));
|
|
150
|
+
}
|
|
151
|
+
}), Gt = ["data-col"], Kt = ["aria-label"], qt = { class: "dt-chip-field" }, Jt = { class: "dt-chip-value" }, Yt = ["aria-label"], Xt = { class: "dt-chip-field" }, Zt = { class: "dt-chip-op" }, Qt = ["data-dt-tip"], $t = {
|
|
152
|
+
key: 0,
|
|
153
|
+
class: "dt-chip-avatars"
|
|
154
|
+
}, en = { class: "dt-chip-pop-head" }, tn = { class: "dt-chip-pop-field" }, nn = {
|
|
155
|
+
type: "button",
|
|
156
|
+
class: "dt-op-btn"
|
|
157
|
+
}, rn = {
|
|
158
|
+
key: 0,
|
|
159
|
+
class: "dt-chip-pop-body"
|
|
160
|
+
}, an = { class: "dt-pop-foot" }, on = ["disabled"], sn = ["aria-label"], cn = { class: "dt-chip-field" }, ln = { class: "dt-chip-op" }, un = { class: "dt-chip-value" }, dn = ["aria-label"], fn = /* @__PURE__ */ R({
|
|
161
|
+
__name: "FilterChip",
|
|
162
|
+
props: {
|
|
163
|
+
chip: {},
|
|
164
|
+
column: {},
|
|
165
|
+
editing: { type: Boolean },
|
|
166
|
+
summary: {},
|
|
167
|
+
rows: {},
|
|
168
|
+
labels: {},
|
|
169
|
+
currencies: {},
|
|
170
|
+
phone: { type: Boolean }
|
|
171
|
+
},
|
|
172
|
+
emits: [
|
|
173
|
+
"update:chip",
|
|
174
|
+
"remove",
|
|
175
|
+
"update:editing",
|
|
176
|
+
"open"
|
|
177
|
+
],
|
|
178
|
+
setup(e, { emit: r }) {
|
|
179
|
+
let a = _e(() => import("./DateEditor-BTIZMwf1.js")), o = e, s = r, { i18n: c } = pe(), l = j(() => o.column.type), u = j(() => i(o.chip.op, l.value)), f = j(() => t(o.chip, l.value)), m = j(() => l.value === "boolean"), h = j(() => Array.isArray(o.chip.value) ? o.chip.value.length : 1), g = j(() => d(c, o.chip.op, l.value, h.value)), ee = j(() => p(o.column)), te = j(() => o.summary.people?.slice(0, 3) ?? []), _ = j(() => o.summary.full && o.summary.full !== o.summary.text ? o.summary.full : void 0), v = j(() => f.value ? c.t("filter.valueAria", {
|
|
180
|
+
column: o.column.header,
|
|
181
|
+
op: g.value,
|
|
182
|
+
value: o.summary.text
|
|
183
|
+
}) : c.t("filter.chooseValueAria", { column: o.column.header })), ne = j(() => ae(o.chip.op, l.value)), re = j(() => ne.value === "options" && h.value && Array.isArray(o.chip.value) && o.chip.value.length ? c.t("option.selected", { count: o.chip.value.length }) : u.value === "range" ? c.t("number.boundsIncluded") : u.value === "dateRange" ? c.t("date.presetsRelative") : ""), y = (e) => s("update:chip", {
|
|
184
|
+
...o.chip,
|
|
185
|
+
...e
|
|
186
|
+
}), ie = (e) => y({
|
|
187
|
+
value: e,
|
|
188
|
+
currency: l.value === "currency" ? o.chip.currency ?? o.currencies[0] : o.chip.currency
|
|
189
|
+
}), b = (e) => s("update:chip", n(o.chip, e, l.value)), oe = () => s("update:chip", {
|
|
190
|
+
...o.chip,
|
|
191
|
+
op: "in",
|
|
192
|
+
value: ["@me"]
|
|
193
|
+
}), se = () => o.chip.op === "is_empty" ? b("in") : b("is_empty"), ce = () => y({ value: void 0 }), le = () => s("update:editing", !1), ue = (e) => {
|
|
194
|
+
let t = e.detail.originalEvent.target;
|
|
195
|
+
t instanceof Element && t.closest(".dt-filter-trigger, .dt-head-menu, .dt-head-filtered") && e.preventDefault();
|
|
196
|
+
}, x = () => y({ value: o.chip.value !== !0 });
|
|
197
|
+
return (t, n) => (B(), P("span", {
|
|
198
|
+
class: z(["dt-chip", {
|
|
199
|
+
"is-editing": e.editing,
|
|
200
|
+
"is-incomplete": !f.value,
|
|
201
|
+
"is-phone": e.phone
|
|
202
|
+
}]),
|
|
203
|
+
"data-col": e.chip.column
|
|
204
|
+
}, [e.phone ? (B(), P("button", {
|
|
205
|
+
key: 0,
|
|
206
|
+
type: "button",
|
|
207
|
+
class: "dt-chip-body",
|
|
208
|
+
"aria-label": K(c).t("mobile.chipAria", { summary: `${e.column.header} ${g.value} ${e.summary.text}`.trim() }),
|
|
209
|
+
onClick: n[0] ||= (e) => s("open")
|
|
210
|
+
}, [
|
|
211
|
+
(B(), M(W(K(T)[l.value]), {
|
|
212
|
+
size: 14,
|
|
213
|
+
class: "dt-chip-icon",
|
|
214
|
+
"aria-hidden": "true"
|
|
215
|
+
})),
|
|
216
|
+
F("span", qt, G(e.column.header), 1),
|
|
217
|
+
F("span", Jt, G(e.summary.text), 1)
|
|
218
|
+
], 8, Kt)) : m.value ? (B(), P("button", {
|
|
219
|
+
key: 2,
|
|
220
|
+
type: "button",
|
|
221
|
+
class: "dt-chip-body",
|
|
222
|
+
"aria-label": v.value,
|
|
223
|
+
onClick: x
|
|
224
|
+
}, [
|
|
225
|
+
(B(), M(W(K(T)[l.value]), {
|
|
226
|
+
size: 14,
|
|
227
|
+
class: "dt-chip-icon",
|
|
228
|
+
"aria-hidden": "true"
|
|
229
|
+
})),
|
|
230
|
+
F("span", cn, G(e.column.header), 1),
|
|
231
|
+
F("span", ln, G(g.value), 1),
|
|
232
|
+
F("span", un, G(e.summary.text), 1)
|
|
233
|
+
], 8, sn)) : (B(), M(K(Mt), {
|
|
234
|
+
key: 1,
|
|
235
|
+
open: e.editing,
|
|
236
|
+
"onUpdate:open": n[2] ||= (e) => s("update:editing", e)
|
|
237
|
+
}, {
|
|
238
|
+
default: J(() => [L(K(Nt), { "as-child": "" }, {
|
|
239
|
+
default: J(() => [F("button", {
|
|
240
|
+
type: "button",
|
|
241
|
+
class: "dt-chip-body",
|
|
242
|
+
"aria-label": v.value
|
|
243
|
+
}, [
|
|
244
|
+
(B(), M(W(K(T)[l.value]), {
|
|
245
|
+
size: 14,
|
|
246
|
+
class: "dt-chip-icon",
|
|
247
|
+
"aria-hidden": "true"
|
|
248
|
+
})),
|
|
249
|
+
F("span", Xt, G(e.column.header), 1),
|
|
250
|
+
F("span", Zt, G(g.value), 1),
|
|
251
|
+
u.value === "none" ? N("", !0) : (B(), P("span", {
|
|
252
|
+
key: 0,
|
|
253
|
+
class: z(["dt-chip-value", { "is-placeholder": !f.value }]),
|
|
254
|
+
"data-dt-tip": _.value
|
|
255
|
+
}, [f.value && te.value.length ? (B(), P("span", $t, [(B(!0), P(A, null, H(te.value, (e) => (B(), M(W(() => K(fe)({
|
|
256
|
+
value: e.value,
|
|
257
|
+
label: e.label
|
|
258
|
+
})), { key: String(e.value) }))), 128))])) : N("", !0), I(" " + G(f.value ? e.summary.text : K(c).t("filter.selectValue")), 1)], 10, Qt))
|
|
259
|
+
], 8, Yt)]),
|
|
260
|
+
_: 1
|
|
261
|
+
}), L(K(jt), null, {
|
|
262
|
+
default: J(() => [L(K(At), {
|
|
263
|
+
class: z(["dt-pop dt-chip-pop", `is-${ne.value ?? "none"}`]),
|
|
264
|
+
align: "start",
|
|
265
|
+
"side-offset": 4,
|
|
266
|
+
onFocusOutside: ue
|
|
267
|
+
}, {
|
|
268
|
+
default: J(() => [
|
|
269
|
+
F("div", en, [F("span", tn, G(e.column.header), 1), L(K(yt), null, {
|
|
270
|
+
default: J(() => [L(K(Ct), { "as-child": "" }, {
|
|
271
|
+
default: J(() => [F("button", nn, [I(G(g.value) + " ", 1), L(K(Ve), {
|
|
272
|
+
size: 12,
|
|
273
|
+
"aria-hidden": "true"
|
|
274
|
+
})])]),
|
|
275
|
+
_: 1
|
|
276
|
+
}), L(K(Q), null, {
|
|
277
|
+
default: J(() => [L(K(_t), {
|
|
278
|
+
class: "dt-menu dt-op-menu",
|
|
279
|
+
align: "start",
|
|
280
|
+
"side-offset": 6
|
|
281
|
+
}, {
|
|
282
|
+
default: J(() => [l.value === "user" ? (B(), M(K(Z), {
|
|
283
|
+
key: 0,
|
|
284
|
+
class: "dt-menu-item",
|
|
285
|
+
onSelect: oe
|
|
286
|
+
}, {
|
|
287
|
+
default: J(() => [I(G(K(c).t("op.isMe")), 1)]),
|
|
288
|
+
_: 1
|
|
289
|
+
})) : N("", !0), (B(!0), P(A, null, H(ee.value, (t) => (B(), P(A, { key: t }, [t === "is_empty" ? (B(), M(K($), {
|
|
290
|
+
key: 0,
|
|
291
|
+
class: "dt-menu-sep"
|
|
292
|
+
})) : N("", !0), L(K(Z), {
|
|
293
|
+
class: z(["dt-menu-item", { "is-selected": t === e.chip.op }]),
|
|
294
|
+
onSelect: (e) => b(t)
|
|
295
|
+
}, {
|
|
296
|
+
default: J(() => [I(G(K(d)(K(c), t, l.value, h.value)) + " ", 1), t === e.chip.op ? (B(), M(K(We), {
|
|
297
|
+
key: 0,
|
|
298
|
+
size: 14,
|
|
299
|
+
class: "dt-pop-end",
|
|
300
|
+
"aria-hidden": "true"
|
|
301
|
+
})) : N("", !0)]),
|
|
302
|
+
_: 2
|
|
303
|
+
}, 1032, ["class", "onSelect"])], 64))), 128))]),
|
|
304
|
+
_: 1
|
|
305
|
+
})]),
|
|
306
|
+
_: 1
|
|
307
|
+
})]),
|
|
308
|
+
_: 1
|
|
309
|
+
})]),
|
|
310
|
+
ne.value ? (B(), P("div", rn, [ne.value === "options" ? (B(), M(O, {
|
|
311
|
+
key: 0,
|
|
312
|
+
column: e.column,
|
|
313
|
+
op: e.chip.op,
|
|
314
|
+
"model-value": Array.isArray(e.chip.value) ? e.chip.value : [],
|
|
315
|
+
rows: e.rows,
|
|
316
|
+
labels: e.labels,
|
|
317
|
+
"onUpdate:modelValue": ie,
|
|
318
|
+
onUnassigned: se
|
|
319
|
+
}, null, 8, [
|
|
320
|
+
"column",
|
|
321
|
+
"op",
|
|
322
|
+
"model-value",
|
|
323
|
+
"rows",
|
|
324
|
+
"labels"
|
|
325
|
+
])) : ne.value === "text" ? (B(), M(k, {
|
|
326
|
+
key: 1,
|
|
327
|
+
column: e.column,
|
|
328
|
+
op: e.chip.op,
|
|
329
|
+
"model-value": e.chip.value,
|
|
330
|
+
"onUpdate:modelValue": ie,
|
|
331
|
+
onDone: le
|
|
332
|
+
}, null, 8, [
|
|
333
|
+
"column",
|
|
334
|
+
"op",
|
|
335
|
+
"model-value"
|
|
336
|
+
])) : ne.value === "number" ? (B(), M(E, {
|
|
337
|
+
key: 2,
|
|
338
|
+
column: e.column,
|
|
339
|
+
op: e.chip.op,
|
|
340
|
+
"model-value": e.chip.value,
|
|
341
|
+
currency: e.chip.currency,
|
|
342
|
+
currencies: e.currencies,
|
|
343
|
+
"onUpdate:modelValue": ie,
|
|
344
|
+
"onUpdate:currency": n[1] ||= (e) => y({ currency: e }),
|
|
345
|
+
onDone: le
|
|
346
|
+
}, null, 8, [
|
|
347
|
+
"column",
|
|
348
|
+
"op",
|
|
349
|
+
"model-value",
|
|
350
|
+
"currency",
|
|
351
|
+
"currencies"
|
|
352
|
+
])) : ne.value === "star" ? (B(), M(D, {
|
|
353
|
+
key: 3,
|
|
354
|
+
column: e.column,
|
|
355
|
+
"model-value": e.chip.value,
|
|
356
|
+
"onUpdate:modelValue": ie,
|
|
357
|
+
onDone: le
|
|
358
|
+
}, null, 8, ["column", "model-value"])) : (B(), M(K(a), {
|
|
359
|
+
key: 4,
|
|
360
|
+
op: e.chip.op,
|
|
361
|
+
"model-value": e.chip.value,
|
|
362
|
+
"onUpdate:modelValue": ie,
|
|
363
|
+
onDone: le
|
|
364
|
+
}, null, 8, ["op", "model-value"]))])) : N("", !0),
|
|
365
|
+
F("div", an, [F("span", null, G(re.value), 1), F("button", {
|
|
366
|
+
type: "button",
|
|
367
|
+
class: "dt-pop-action",
|
|
368
|
+
disabled: e.chip.value === void 0,
|
|
369
|
+
onClick: ce
|
|
370
|
+
}, G(K(c).t("common.clear")), 9, on)])
|
|
371
|
+
]),
|
|
372
|
+
_: 1
|
|
373
|
+
}, 8, ["class"])]),
|
|
374
|
+
_: 1
|
|
375
|
+
})]),
|
|
376
|
+
_: 1
|
|
377
|
+
}, 8, ["open"])), e.phone ? N("", !0) : (B(), P("button", {
|
|
378
|
+
key: 3,
|
|
379
|
+
type: "button",
|
|
380
|
+
class: "dt-chip-remove",
|
|
381
|
+
"aria-label": K(c).t("filter.removeAria", { column: e.column.header }),
|
|
382
|
+
onClick: n[3] ||= (e) => s("remove")
|
|
383
|
+
}, [L(K(Qe), {
|
|
384
|
+
size: 12,
|
|
385
|
+
"aria-hidden": "true"
|
|
386
|
+
})], 8, dn))], 10, Gt));
|
|
387
|
+
}
|
|
388
|
+
}), pn = /* @__PURE__ */ R({
|
|
389
|
+
__name: "FilterBar",
|
|
390
|
+
props: {
|
|
391
|
+
chips: {},
|
|
392
|
+
defs: {},
|
|
393
|
+
editing: {},
|
|
394
|
+
rows: {},
|
|
395
|
+
labels: {},
|
|
396
|
+
summaryOf: { type: Function },
|
|
397
|
+
currenciesOf: { type: Function },
|
|
398
|
+
phone: { type: Boolean }
|
|
399
|
+
},
|
|
400
|
+
emits: [
|
|
401
|
+
"update:chip",
|
|
402
|
+
"remove",
|
|
403
|
+
"update:editing",
|
|
404
|
+
"clear-all",
|
|
405
|
+
"open"
|
|
406
|
+
],
|
|
407
|
+
setup(e, { emit: t }) {
|
|
408
|
+
let n = e, r = t, { i18n: i } = pe(), a = (e) => n.defs.get(e), o = (e) => e ? [...s.value?.querySelectorAll(".dt-chip") ?? []].find((t) => t.dataset.col === e) : void 0, s = V(null), c = V(!1), l = () => {
|
|
409
|
+
let e = s.value;
|
|
410
|
+
e && (c.value = e.scrollLeft + e.clientWidth < e.scrollWidth - 1);
|
|
411
|
+
}, u;
|
|
412
|
+
we(() => {
|
|
413
|
+
l(), typeof ResizeObserver < "u" && s.value && (u = new ResizeObserver(l), u.observe(s.value));
|
|
414
|
+
}), Ce(() => u?.disconnect()), q(() => [n.chips.length, n.editing], () => void xe(() => {
|
|
415
|
+
l();
|
|
416
|
+
let e = n.editing ?? n.chips.at(-1)?.column;
|
|
417
|
+
o(e)?.scrollIntoView?.({
|
|
418
|
+
inline: "nearest",
|
|
419
|
+
block: "nearest"
|
|
420
|
+
});
|
|
421
|
+
}));
|
|
422
|
+
let d = (e) => {
|
|
423
|
+
let t = n.chips.findIndex((t) => t.column === e), i = n.chips[t + 1]?.column;
|
|
424
|
+
r("remove", e), xe(() => {
|
|
425
|
+
(o(i)?.querySelector(".dt-chip-body") ?? s.value?.parentElement?.querySelector(".dt-filter-add"))?.focus();
|
|
426
|
+
});
|
|
427
|
+
};
|
|
428
|
+
return (t, n) => (B(), P("div", { class: z(["dt-filter-row", { "is-scrolled-end": c.value }]) }, [
|
|
429
|
+
F("div", {
|
|
430
|
+
ref_key: "row",
|
|
431
|
+
ref: s,
|
|
432
|
+
class: "dt-chips",
|
|
433
|
+
onScrollPassive: l
|
|
434
|
+
}, [(B(!0), P(A, null, H(e.chips, (t) => (B(), M(fn, {
|
|
435
|
+
key: t.column,
|
|
436
|
+
chip: t,
|
|
437
|
+
column: a(t.column),
|
|
438
|
+
editing: e.editing === t.column,
|
|
439
|
+
summary: e.summaryOf(t),
|
|
440
|
+
rows: e.rows,
|
|
441
|
+
labels: e.labels,
|
|
442
|
+
currencies: e.currenciesOf(a(t.column)),
|
|
443
|
+
phone: e.phone,
|
|
444
|
+
onOpen: (e) => r("open", t.column),
|
|
445
|
+
"onUpdate:chip": n[0] ||= (e) => r("update:chip", e),
|
|
446
|
+
"onUpdate:editing": (e) => r("update:editing", e ? t.column : null),
|
|
447
|
+
onRemove: (e) => d(t.column)
|
|
448
|
+
}, null, 8, [
|
|
449
|
+
"chip",
|
|
450
|
+
"column",
|
|
451
|
+
"editing",
|
|
452
|
+
"summary",
|
|
453
|
+
"rows",
|
|
454
|
+
"labels",
|
|
455
|
+
"currencies",
|
|
456
|
+
"phone",
|
|
457
|
+
"onOpen",
|
|
458
|
+
"onUpdate:editing",
|
|
459
|
+
"onRemove"
|
|
460
|
+
]))), 128))], 544),
|
|
461
|
+
e.phone ? N("", !0) : U(t.$slots, "add", {}, void 0, void 0, 0),
|
|
462
|
+
e.phone ? N("", !0) : (B(), P("button", {
|
|
463
|
+
key: 1,
|
|
464
|
+
type: "button",
|
|
465
|
+
class: "dt-btn dt-btn-ghost dt-filter-clear",
|
|
466
|
+
onClick: n[1] ||= (e) => r("clear-all")
|
|
467
|
+
}, G(K(i).t("filter.clearAll")), 1))
|
|
468
|
+
], 2));
|
|
469
|
+
}
|
|
470
|
+
}), mn = "a[href], button:not([disabled]):not(.dt-expand), input:not([disabled]):not(.dt-select-box), select:not([disabled]), textarea:not([disabled]), [tabindex=\"-1\"][role]";
|
|
471
|
+
function hn(e) {
|
|
472
|
+
let t = V(0), n = V(!1), i = (e) => [...e.querySelectorAll(mn)].filter((e) => e.offsetParent !== null || e.getClientRects().length > 0), a = (r) => {
|
|
473
|
+
let i = e.count();
|
|
474
|
+
if (i === 0) return;
|
|
475
|
+
let a = Math.max(0, Math.min(i - 1, r));
|
|
476
|
+
t.value = a, n.value = !0, e.scrollToIndex(a);
|
|
477
|
+
let o = (t) => {
|
|
478
|
+
let n = e.rowEl(a);
|
|
479
|
+
n ? n.focus({ preventScroll: !0 }) : t < 3 && requestAnimationFrame(() => o(t + 1));
|
|
480
|
+
};
|
|
481
|
+
o(0);
|
|
482
|
+
}, o = (t) => {
|
|
483
|
+
let o = t.target, s = o.closest("[role=\"row\"][data-index]");
|
|
484
|
+
if (!s) return;
|
|
485
|
+
let c = Number(s.dataset.index);
|
|
486
|
+
if (o !== s) {
|
|
487
|
+
if (t.key === "Escape") {
|
|
488
|
+
t.preventDefault(), n.value = !0, s.focus({ preventScroll: !0 });
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
if ((t.key === "ArrowRight" || t.key === "ArrowLeft") && !r(o)) {
|
|
492
|
+
let e = i(s), r = e.indexOf(o.closest(mn) ?? o), a = t.key === "ArrowRight" ? e[r + 1] : r > 0 ? e[r - 1] : s;
|
|
493
|
+
a && (t.preventDefault(), n.value = !0, a.focus({ preventScroll: !0 }));
|
|
494
|
+
}
|
|
495
|
+
} else switch (t.key) {
|
|
496
|
+
case "ArrowDown":
|
|
497
|
+
t.preventDefault(), a(c + 1);
|
|
498
|
+
break;
|
|
499
|
+
case "ArrowUp":
|
|
500
|
+
t.preventDefault(), c === 0 && e.onTop ? e.onTop() : a(c - 1);
|
|
501
|
+
break;
|
|
502
|
+
case "Home":
|
|
503
|
+
t.preventDefault(), a(0);
|
|
504
|
+
break;
|
|
505
|
+
case "End":
|
|
506
|
+
t.preventDefault(), a(e.count() - 1);
|
|
507
|
+
break;
|
|
508
|
+
case "PageDown":
|
|
509
|
+
t.preventDefault(), a(c + e.pageSize());
|
|
510
|
+
break;
|
|
511
|
+
case "PageUp":
|
|
512
|
+
t.preventDefault(), a(c - e.pageSize());
|
|
513
|
+
break;
|
|
514
|
+
case "ArrowRight": {
|
|
515
|
+
if (e.onRight?.(c)) {
|
|
516
|
+
t.preventDefault();
|
|
517
|
+
break;
|
|
518
|
+
}
|
|
519
|
+
let r = i(s)[0];
|
|
520
|
+
r && (t.preventDefault(), n.value = !0, r.focus({ preventScroll: !0 }));
|
|
521
|
+
break;
|
|
522
|
+
}
|
|
523
|
+
case "ArrowLeft":
|
|
524
|
+
e.onLeft?.(c) && t.preventDefault();
|
|
525
|
+
break;
|
|
526
|
+
case "Enter": e.onEnter && (t.preventDefault(), e.onEnter(c));
|
|
527
|
+
}
|
|
528
|
+
}, s = (e) => {
|
|
529
|
+
let r = e.target.closest("[role=\"row\"][data-index]");
|
|
530
|
+
r && (n.value = !1, t.value = Number(r.dataset.index));
|
|
531
|
+
}, c = (e) => {
|
|
532
|
+
let t = e.target.closest("[role=\"row\"][data-index]");
|
|
533
|
+
t && e.target === t && !n.value && !l && (n.value = !0);
|
|
534
|
+
}, l = !1;
|
|
535
|
+
return {
|
|
536
|
+
focusedIndex: t,
|
|
537
|
+
keyboard: n,
|
|
538
|
+
focusRow: a,
|
|
539
|
+
onKeydown: o,
|
|
540
|
+
onMousedown: s,
|
|
541
|
+
onFocusin: c,
|
|
542
|
+
onPointerdown: () => {
|
|
543
|
+
l = !0, setTimeout(() => l = !1, 0);
|
|
544
|
+
},
|
|
545
|
+
clamp: () => {
|
|
546
|
+
t.value = Math.max(0, Math.min(e.count() - 1, t.value));
|
|
547
|
+
}
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
//#endregion
|
|
551
|
+
//#region src/core/grid/HeaderCell.vue?vue&type=script&setup=true&lang.ts
|
|
552
|
+
var gn = ["aria-sort", "data-col"], _n = [
|
|
553
|
+
"aria-disabled",
|
|
554
|
+
"data-dt-tip",
|
|
555
|
+
"aria-describedby"
|
|
556
|
+
], vn = {
|
|
557
|
+
key: 0,
|
|
558
|
+
class: "dt-head-sort",
|
|
559
|
+
"aria-hidden": "true"
|
|
560
|
+
}, yn = {
|
|
561
|
+
key: 0,
|
|
562
|
+
class: "dt-head-sort-index"
|
|
563
|
+
}, bn = { class: "dt-head-text" }, xn = {
|
|
564
|
+
key: 1,
|
|
565
|
+
class: "dt-head-unit"
|
|
566
|
+
}, Sn = {
|
|
567
|
+
key: 2,
|
|
568
|
+
class: "dt-head-sort",
|
|
569
|
+
"aria-hidden": "true"
|
|
570
|
+
}, Cn = {
|
|
571
|
+
key: 0,
|
|
572
|
+
class: "dt-head-sort-index"
|
|
573
|
+
}, wn = ["id"], Tn = ["aria-label"], En = ["aria-label"], Dn = { class: "dt-kbd" }, On = { class: "dt-kbd" }, kn = {
|
|
574
|
+
key: 0,
|
|
575
|
+
class: "dt-resize-badge"
|
|
576
|
+
}, An = /* @__PURE__ */ R({
|
|
577
|
+
__name: "HeaderCell",
|
|
578
|
+
props: {
|
|
579
|
+
phone: { type: Boolean },
|
|
580
|
+
column: {},
|
|
581
|
+
sort: {},
|
|
582
|
+
sortIndex: {},
|
|
583
|
+
filtered: { type: Boolean },
|
|
584
|
+
resizing: {},
|
|
585
|
+
sortable: { type: Boolean }
|
|
586
|
+
},
|
|
587
|
+
emits: [
|
|
588
|
+
"sort",
|
|
589
|
+
"filter",
|
|
590
|
+
"action",
|
|
591
|
+
"nav",
|
|
592
|
+
"resize-by",
|
|
593
|
+
"resize-start"
|
|
594
|
+
],
|
|
595
|
+
setup(e, { emit: t }) {
|
|
596
|
+
let n = e, r = t, { i18n: i } = pe(), o = j(() => n.column.def), l = j(() => le(o.value.type)), u = j(() => c(o.value)), d = j(() => typeof o.value.unit == "string" ? o.value.unit : void 0), f = j(() => n.sortable ?? !1), p = j(() => o.value.filterable ?? a[o.value.type].filterable), m = Ae(), h = j(() => o.value.description ? `${o.value.header}\n${o.value.description}` : o.value.header), g = V(!1), ee = (e) => {
|
|
597
|
+
let t = e.currentTarget.parentElement;
|
|
598
|
+
r("resize-start", n.column, t.getBoundingClientRect().width), n.column.header.getResizeHandler()(e);
|
|
599
|
+
}, te = (e) => {
|
|
600
|
+
let t = e.key;
|
|
601
|
+
if (t === "Enter" || t === " ") f.value && (e.preventDefault(), r("sort", n.column, e.shiftKey));
|
|
602
|
+
else if (t === "F10" && e.shiftKey || t === "ContextMenu") e.preventDefault(), g.value = !0;
|
|
603
|
+
else if (t === "ArrowLeft" || t === "ArrowRight") {
|
|
604
|
+
e.preventDefault();
|
|
605
|
+
let i = t === "ArrowLeft";
|
|
606
|
+
e.altKey && e.shiftKey ? r("action", n.column, i ? "move-left" : "move-right") : e.shiftKey ? r("resize-by", n.column, i ? -16 : 16) : r("nav", n.column, i ? "left" : "right");
|
|
607
|
+
} else t === "ArrowDown" && (e.preventDefault(), r("nav", n.column, "down"));
|
|
608
|
+
}, v = (e) => r("action", n.column, e);
|
|
609
|
+
return (t, n) => (B(), P("div", {
|
|
610
|
+
class: z(["dt-head-cell", [`is-${u.value}`, {
|
|
611
|
+
"is-numeric": l.value,
|
|
612
|
+
"is-sorted": !!e.sort,
|
|
613
|
+
"is-pinned-start": e.column.pinned === "start",
|
|
614
|
+
"is-pinned-end": e.column.pinned === "end",
|
|
615
|
+
"is-pin-edge": e.column.pinEdge,
|
|
616
|
+
"is-resizing": e.resizing !== null && e.resizing !== void 0,
|
|
617
|
+
"is-menu-open": g.value
|
|
618
|
+
}]]),
|
|
619
|
+
style: Se(e.column.pinned === "start" ? { left: `var(${e.column.offsetVar})` } : e.column.pinned === "end" ? { right: `var(${e.column.offsetVar})` } : void 0),
|
|
620
|
+
role: "columnheader",
|
|
621
|
+
"aria-sort": e.sort === "asc" ? "ascending" : e.sort === "desc" ? "descending" : void 0,
|
|
622
|
+
"data-col": e.column.id,
|
|
623
|
+
onContextmenu: n[15] ||= Re((e) => g.value = !0, ["prevent"])
|
|
624
|
+
}, [
|
|
625
|
+
F("button", {
|
|
626
|
+
type: "button",
|
|
627
|
+
class: z(["dt-head-label", { "is-static": !f.value }]),
|
|
628
|
+
tabindex: "-1",
|
|
629
|
+
"aria-disabled": f.value ? void 0 : "true",
|
|
630
|
+
"data-dt-tip": h.value,
|
|
631
|
+
"aria-describedby": o.value.description ? K(m) : void 0,
|
|
632
|
+
onClick: n[0] ||= (t) => f.value && r("sort", e.column, t.shiftKey),
|
|
633
|
+
onKeydown: te
|
|
634
|
+
}, [
|
|
635
|
+
e.sort && l.value ? (B(), P("span", vn, [e.sortIndex ? (B(), P("span", yn, G(e.sortIndex), 1)) : N("", !0), L(K(Be), {
|
|
636
|
+
size: 12,
|
|
637
|
+
class: z({ "is-desc": e.sort === "desc" })
|
|
638
|
+
}, null, 8, ["class"])])) : N("", !0),
|
|
639
|
+
F("span", bn, G(e.phone && o.value.headerShort || o.value.header), 1),
|
|
640
|
+
d.value ? (B(), P("span", xn, G(d.value), 1)) : N("", !0),
|
|
641
|
+
e.sort && !l.value ? (B(), P("span", Sn, [L(K(Be), {
|
|
642
|
+
size: 12,
|
|
643
|
+
class: z({ "is-desc": e.sort === "desc" })
|
|
644
|
+
}, null, 8, ["class"]), e.sortIndex ? (B(), P("span", Cn, G(e.sortIndex), 1)) : N("", !0)])) : N("", !0),
|
|
645
|
+
e.column.pinned ? (B(), M(K(Xe), {
|
|
646
|
+
key: 3,
|
|
647
|
+
size: 12,
|
|
648
|
+
class: "dt-head-pin",
|
|
649
|
+
"aria-hidden": "true"
|
|
650
|
+
})) : N("", !0)
|
|
651
|
+
], 42, _n),
|
|
652
|
+
o.value.description ? (B(), P("span", {
|
|
653
|
+
key: 0,
|
|
654
|
+
id: K(m),
|
|
655
|
+
class: "dt-sr-only"
|
|
656
|
+
}, G(o.value.description), 9, wn)) : N("", !0),
|
|
657
|
+
e.filtered ? (B(), P("button", {
|
|
658
|
+
key: 1,
|
|
659
|
+
type: "button",
|
|
660
|
+
class: "dt-head-icon dt-head-filtered",
|
|
661
|
+
tabindex: "-1",
|
|
662
|
+
"aria-label": K(i).t("header.filterBy"),
|
|
663
|
+
onClick: n[1] ||= (t) => r("filter", e.column)
|
|
664
|
+
}, [L(K(qe), {
|
|
665
|
+
size: 14,
|
|
666
|
+
weight: "fill",
|
|
667
|
+
"aria-hidden": "true"
|
|
668
|
+
})], 8, Tn)) : N("", !0),
|
|
669
|
+
L(K(yt), {
|
|
670
|
+
open: g.value,
|
|
671
|
+
"onUpdate:open": n[13] ||= (e) => g.value = e
|
|
672
|
+
}, {
|
|
673
|
+
default: J(() => [L(K(Ct), { "as-child": "" }, {
|
|
674
|
+
default: J(() => [F("button", {
|
|
675
|
+
type: "button",
|
|
676
|
+
class: "dt-head-icon dt-head-menu",
|
|
677
|
+
tabindex: "-1",
|
|
678
|
+
"aria-label": K(i).t("header.optionsAria", { column: o.value.header })
|
|
679
|
+
}, [L(K(Ke), {
|
|
680
|
+
size: 16,
|
|
681
|
+
weight: "bold",
|
|
682
|
+
"aria-hidden": "true"
|
|
683
|
+
})], 8, En)]),
|
|
684
|
+
_: 1
|
|
685
|
+
}), L(K(Q), null, {
|
|
686
|
+
default: J(() => [L(K(_t), {
|
|
687
|
+
class: "dt-menu dt-col-menu",
|
|
688
|
+
align: "end",
|
|
689
|
+
"side-offset": 4
|
|
690
|
+
}, {
|
|
691
|
+
default: J(() => [
|
|
692
|
+
L(K(vt), { class: "dt-menu-label" }, {
|
|
693
|
+
default: J(() => [I(G(K(i).t(K(s)(o.value.type))), 1)]),
|
|
694
|
+
_: 1
|
|
695
|
+
}),
|
|
696
|
+
f.value ? (B(), P(A, { key: 0 }, [
|
|
697
|
+
L(K(Z), {
|
|
698
|
+
class: "dt-menu-item",
|
|
699
|
+
onSelect: n[2] ||= (e) => v("sort-asc")
|
|
700
|
+
}, {
|
|
701
|
+
default: J(() => [I(G(K(i).t("header.sortAsc")), 1)]),
|
|
702
|
+
_: 1
|
|
703
|
+
}),
|
|
704
|
+
L(K(Z), {
|
|
705
|
+
class: "dt-menu-item",
|
|
706
|
+
onSelect: n[3] ||= (e) => v("sort-desc")
|
|
707
|
+
}, {
|
|
708
|
+
default: J(() => [I(G(K(i).t("header.sortDesc")), 1)]),
|
|
709
|
+
_: 1
|
|
710
|
+
}),
|
|
711
|
+
L(K(Z), {
|
|
712
|
+
class: "dt-menu-item",
|
|
713
|
+
disabled: !e.sort,
|
|
714
|
+
onSelect: n[4] ||= (e) => v("sort-clear")
|
|
715
|
+
}, {
|
|
716
|
+
default: J(() => [I(G(K(i).t("header.clearSort")), 1)]),
|
|
717
|
+
_: 1
|
|
718
|
+
}, 8, ["disabled"]),
|
|
719
|
+
L(K($), { class: "dt-menu-sep" })
|
|
720
|
+
], 64)) : N("", !0),
|
|
721
|
+
p.value ? (B(), P(A, { key: 1 }, [L(K(Z), {
|
|
722
|
+
class: "dt-menu-item",
|
|
723
|
+
onSelect: n[5] ||= (e) => v("filter")
|
|
724
|
+
}, {
|
|
725
|
+
default: J(() => [I(G(K(i).t("header.filterBy")), 1)]),
|
|
726
|
+
_: 1
|
|
727
|
+
}), L(K($), { class: "dt-menu-sep" })], 64)) : N("", !0),
|
|
728
|
+
e.column.pinned ? (B(), M(K(Z), {
|
|
729
|
+
key: 2,
|
|
730
|
+
class: "dt-menu-item",
|
|
731
|
+
onSelect: n[6] ||= (e) => v("unpin")
|
|
732
|
+
}, {
|
|
733
|
+
default: J(() => [I(G(K(i).t("header.unpin")), 1)]),
|
|
734
|
+
_: 1
|
|
735
|
+
})) : (B(), P(A, { key: 3 }, [L(K(Z), {
|
|
736
|
+
class: "dt-menu-item",
|
|
737
|
+
onSelect: n[7] ||= (e) => v("pin-left")
|
|
738
|
+
}, {
|
|
739
|
+
default: J(() => [I(G(K(i).t("header.pinLeft")), 1)]),
|
|
740
|
+
_: 1
|
|
741
|
+
}), L(K(Z), {
|
|
742
|
+
class: "dt-menu-item",
|
|
743
|
+
onSelect: n[8] ||= (e) => v("pin-right")
|
|
744
|
+
}, {
|
|
745
|
+
default: J(() => [I(G(K(i).t("header.pinRight")), 1)]),
|
|
746
|
+
_: 1
|
|
747
|
+
})], 64)),
|
|
748
|
+
L(K(Z), {
|
|
749
|
+
class: "dt-menu-item",
|
|
750
|
+
onSelect: n[9] ||= (e) => v("fit")
|
|
751
|
+
}, {
|
|
752
|
+
default: J(() => [I(G(K(i).t("header.fit")), 1)]),
|
|
753
|
+
_: 1
|
|
754
|
+
}),
|
|
755
|
+
L(K(Z), {
|
|
756
|
+
class: "dt-menu-item",
|
|
757
|
+
onSelect: n[10] ||= (e) => v("move-left")
|
|
758
|
+
}, {
|
|
759
|
+
default: J(() => [I(G(K(i).t("header.moveLeft")) + " ", 1), F("kbd", Dn, G(K(_).left), 1)]),
|
|
760
|
+
_: 1
|
|
761
|
+
}),
|
|
762
|
+
L(K(Z), {
|
|
763
|
+
class: "dt-menu-item",
|
|
764
|
+
onSelect: n[11] ||= (e) => v("move-right")
|
|
765
|
+
}, {
|
|
766
|
+
default: J(() => [I(G(K(i).t("header.moveRight")) + " ", 1), F("kbd", On, G(K(_).right), 1)]),
|
|
767
|
+
_: 1
|
|
768
|
+
}),
|
|
769
|
+
L(K($), { class: "dt-menu-sep" }),
|
|
770
|
+
L(K(Z), {
|
|
771
|
+
class: "dt-menu-item",
|
|
772
|
+
disabled: !!e.column.pinned || !e.column.header.column.getCanHide(),
|
|
773
|
+
onSelect: n[12] ||= (e) => v("hide")
|
|
774
|
+
}, {
|
|
775
|
+
default: J(() => [I(G(K(i).t("header.hide")), 1)]),
|
|
776
|
+
_: 1
|
|
777
|
+
}, 8, ["disabled"])
|
|
778
|
+
]),
|
|
779
|
+
_: 1
|
|
780
|
+
})]),
|
|
781
|
+
_: 1
|
|
782
|
+
})]),
|
|
783
|
+
_: 1
|
|
784
|
+
}, 8, ["open"]),
|
|
785
|
+
n[16] ||= F("span", {
|
|
786
|
+
class: "dt-head-sep",
|
|
787
|
+
"aria-hidden": "true"
|
|
788
|
+
}, null, -1),
|
|
789
|
+
F("span", {
|
|
790
|
+
class: "dt-resize",
|
|
791
|
+
"aria-hidden": "true",
|
|
792
|
+
onMousedown: ee,
|
|
793
|
+
onTouchstartPassive: ee,
|
|
794
|
+
onDblclick: n[14] ||= (e) => v("fit")
|
|
795
|
+
}, [e.resizing !== null && e.resizing !== void 0 ? (B(), P("span", kn, G(Math.round(e.resizing)) + " px ", 1)) : N("", !0)], 32)
|
|
796
|
+
], 46, gn));
|
|
797
|
+
}
|
|
798
|
+
}), jn = [
|
|
799
|
+
"aria-label",
|
|
800
|
+
"aria-rowcount",
|
|
801
|
+
"aria-colcount",
|
|
802
|
+
"aria-busy",
|
|
803
|
+
"data-density"
|
|
804
|
+
], Mn = {
|
|
805
|
+
class: "dt-head",
|
|
806
|
+
role: "row",
|
|
807
|
+
"aria-rowindex": "1"
|
|
808
|
+
}, Nn = [
|
|
809
|
+
"checked",
|
|
810
|
+
"indeterminate",
|
|
811
|
+
"aria-label"
|
|
812
|
+
], Pn = ["inert"], Fn = ["data-index"], In = ["id", "aria-rowindex"], Ln = ["aria-colspan"], Rn = {
|
|
813
|
+
key: 0,
|
|
814
|
+
class: "dt-refresh-bar",
|
|
815
|
+
"aria-hidden": "true"
|
|
816
|
+
}, zn = {
|
|
817
|
+
key: 1,
|
|
818
|
+
class: "dt-notice",
|
|
819
|
+
role: "status"
|
|
820
|
+
}, Bn = {
|
|
821
|
+
key: 2,
|
|
822
|
+
class: "dt-body-state"
|
|
823
|
+
}, Vn = 40, Hn = 48, Un = 8, Wn = 28, Gn = 22, Kn = 36, qn = /* @__PURE__ */ R({
|
|
824
|
+
__name: "GridRoot",
|
|
825
|
+
props: {
|
|
826
|
+
layout: {},
|
|
827
|
+
rows: {},
|
|
828
|
+
density: { default: "standard" },
|
|
829
|
+
label: {},
|
|
830
|
+
loading: {
|
|
831
|
+
type: Boolean,
|
|
832
|
+
default: !1
|
|
833
|
+
},
|
|
834
|
+
skeleton: { type: Boolean },
|
|
835
|
+
dim: { type: Boolean },
|
|
836
|
+
refreshing: { type: Boolean },
|
|
837
|
+
verticalLines: { type: Boolean },
|
|
838
|
+
rowCount: { default: -1 },
|
|
839
|
+
rowIndexOffset: { default: 0 },
|
|
840
|
+
sort: {},
|
|
841
|
+
filteredColumns: {},
|
|
842
|
+
sortable: {
|
|
843
|
+
type: Boolean,
|
|
844
|
+
default: !1
|
|
845
|
+
},
|
|
846
|
+
labels: {},
|
|
847
|
+
selectable: { type: Boolean },
|
|
848
|
+
selection: {},
|
|
849
|
+
expandable: { type: Boolean },
|
|
850
|
+
expanded: {},
|
|
851
|
+
canExpand: {},
|
|
852
|
+
rowMenu: { type: Boolean },
|
|
853
|
+
rowActions: {},
|
|
854
|
+
rowError: {},
|
|
855
|
+
primaryHref: {},
|
|
856
|
+
primaryLabel: {},
|
|
857
|
+
primaryHeader: {},
|
|
858
|
+
phone: { type: Boolean }
|
|
859
|
+
},
|
|
860
|
+
emits: [
|
|
861
|
+
"row-click",
|
|
862
|
+
"row-open",
|
|
863
|
+
"select-rows",
|
|
864
|
+
"select-page",
|
|
865
|
+
"toggle-expand",
|
|
866
|
+
"copy-id",
|
|
867
|
+
"sort",
|
|
868
|
+
"sort-set",
|
|
869
|
+
"header-filter"
|
|
870
|
+
],
|
|
871
|
+
setup(t, { expose: n, emit: r }) {
|
|
872
|
+
let i = t, o = r, s = pe(), c = V(null), l = V(null), u = i.layout, d = typeof matchMedia == "function" && matchMedia("(pointer: coarse)").matches, f = j(() => d && i.density === "compact" ? "standard" : i.density), p = j(() => i.selectable ? i.phone ? Hn : Vn : 0), m = j(() => !!i.rowError && i.rows.some((e) => E(e).length > 0)), g = j(() => {
|
|
873
|
+
let e = i.rowActions ?? [];
|
|
874
|
+
return e.some((e) => e.inline) ? i.rows.reduce((t, n) => Math.max(t, se(e, n).length), 0) : 0;
|
|
875
|
+
}), ee = j(() => i.rowMenu ? Un + (m.value ? Gn : 0) + g.value * Kn + Wn + Un : 0);
|
|
876
|
+
Fe(() => {
|
|
877
|
+
let e = c.value;
|
|
878
|
+
if (!e) return;
|
|
879
|
+
let t = [
|
|
880
|
+
p.value ? `${p.value}px` : "",
|
|
881
|
+
u.colsVar.value,
|
|
882
|
+
ee.value ? `${ee.value}px` : ""
|
|
883
|
+
];
|
|
884
|
+
e.style.setProperty("--cols", t.filter(Boolean).join(" ")), e.style.setProperty("--dt-min-w", `${u.minWidth.value + p.value + ee.value}px`), e.style.setProperty("--dt-sel-w", `${p.value}px`), e.style.setProperty("--dt-menu-w", `${ee.value}px`);
|
|
885
|
+
let n = new Set(u.start.value.map((e) => e.offsetVar)), r = new Set(u.end.value.map((e) => e.offsetVar));
|
|
886
|
+
for (let [t, i] of Object.entries(u.offsetVars.value)) {
|
|
887
|
+
let a = n.has(t) ? p.value : r.has(t) ? ee.value : 0;
|
|
888
|
+
e.style.setProperty(t, a ? `${parseFloat(i) + a}px` : i);
|
|
889
|
+
}
|
|
890
|
+
}, { flush: "sync" });
|
|
891
|
+
let _ = V(40), v = V(36), ne = V(0), re = () => {
|
|
892
|
+
let e = l.value;
|
|
893
|
+
ne.value = e ? Math.max(0, e.offsetHeight - e.clientHeight) : 0;
|
|
894
|
+
}, b = () => {
|
|
895
|
+
let e = c.value ? parseFloat(getComputedStyle(c.value).getPropertyValue("--dt-row-h")) : NaN;
|
|
896
|
+
_.value = Number.isFinite(e) ? e : 40, v.value = c.value?.querySelector(".dt-head")?.offsetHeight ?? v.value, re();
|
|
897
|
+
};
|
|
898
|
+
we(b), q([f, () => i.phone], () => requestAnimationFrame(b));
|
|
899
|
+
let ae = j(() => ({
|
|
900
|
+
fmt: e(s.locale),
|
|
901
|
+
i18n: s.i18n,
|
|
902
|
+
today: /* @__PURE__ */ new Date(),
|
|
903
|
+
labels: oe,
|
|
904
|
+
density: f.value,
|
|
905
|
+
coarse: d
|
|
906
|
+
})), oe = i.labels ?? new te(), ce = () => [...c.value?.querySelectorAll(".dt-head-label") ?? []], le = (e) => [...c.value?.querySelectorAll("[data-col]") ?? []].filter((t) => t.dataset.col === e), ue = (e) => {
|
|
907
|
+
let t = ce();
|
|
908
|
+
t[Math.max(0, Math.min(t.length - 1, e))]?.focus();
|
|
909
|
+
}, x = (e) => u.rowId(i.rows[e]), de = (e) => !!i.selection?.[x(e)], fe = (e) => !!i.expanded?.[u.rowId(e)], S = (e) => !!i.expandable && (i.canExpand?.(e) ?? !0), me = (e) => i.primaryLabel?.(e) ?? u.rowId(e), C = Ae(), w = (e) => `${C}-sub-${u.rowId(e)}`, T = (e) => `${C}-r-${u.rowId(e)}`, E = (e) => {
|
|
910
|
+
let t = i.rowError?.(e);
|
|
911
|
+
return (Array.isArray(t) ? t : [t]).filter((e) => !!e);
|
|
912
|
+
}, D = (e) => c.value?.querySelector(`.dt-row[data-index="${e}"]`) ?? null, O = hn({
|
|
913
|
+
count: () => i.rows.length,
|
|
914
|
+
rowEl: D,
|
|
915
|
+
scrollToIndex: (e) => W.value.scrollToIndex(e, { align: "auto" }),
|
|
916
|
+
pageSize: () => Math.max(1, Math.floor((l.value?.clientHeight ?? 0) / (_.value + 1)) - 1),
|
|
917
|
+
onEnter: (e) => D(e)?.querySelector(".dt-cell.is-primary a.dt-link")?.click(),
|
|
918
|
+
onRight: (e) => {
|
|
919
|
+
let t = i.rows[e];
|
|
920
|
+
return !t || !S(t) || fe(t) ? !1 : (o("toggle-expand", u.rowId(t), !0), !0);
|
|
921
|
+
},
|
|
922
|
+
onLeft: (e) => {
|
|
923
|
+
let t = i.rows[e];
|
|
924
|
+
return !t || !fe(t) ? !1 : (o("toggle-expand", u.rowId(t), !1), !0);
|
|
925
|
+
},
|
|
926
|
+
onTop: () => ue(0)
|
|
927
|
+
}), k = -1, he = (e, t) => {
|
|
928
|
+
let [n, r] = e < t ? [e, t] : [t, e];
|
|
929
|
+
return i.rows.slice(n, r + 1).map((e) => u.rowId(e));
|
|
930
|
+
}, ge = V(-1), I = (e) => {
|
|
931
|
+
let t = e.target, n = t.closest("[role=\"row\"][data-index]");
|
|
932
|
+
if (n && t === n) {
|
|
933
|
+
let t = Number(n.dataset.index), r = e.metaKey || e.ctrlKey;
|
|
934
|
+
if (i.selectable) {
|
|
935
|
+
if ((e.key === "x" || e.key === "X") && !r && !e.altKey) {
|
|
936
|
+
e.preventDefault(), k = t, o("select-rows", [x(t)], !de(t));
|
|
937
|
+
return;
|
|
938
|
+
}
|
|
939
|
+
if ((e.key === "a" || e.key === "A") && r && !e.shiftKey) {
|
|
940
|
+
e.preventDefault(), o("select-page", !0);
|
|
941
|
+
return;
|
|
942
|
+
}
|
|
943
|
+
if (e.shiftKey && (e.key === "ArrowDown" || e.key === "ArrowUp")) {
|
|
944
|
+
e.preventDefault(), k < 0 && (k = t);
|
|
945
|
+
let n = Math.max(0, Math.min(i.rows.length - 1, e.key === "ArrowDown" ? t + 1 : t - 1));
|
|
946
|
+
o("select-rows", he(k, n), !0), O.focusRow(n);
|
|
947
|
+
return;
|
|
948
|
+
}
|
|
949
|
+
(e.key.startsWith("Arrow") || e.key === "Home" || e.key === "End") && (k = -1);
|
|
950
|
+
}
|
|
951
|
+
if (i.rowMenu && (e.key === "F10" && e.shiftKey || e.key === "ContextMenu")) {
|
|
952
|
+
e.preventDefault(), ge.value = t;
|
|
953
|
+
return;
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
O.onKeydown(e);
|
|
957
|
+
}, _e = (e, t, n) => {
|
|
958
|
+
o("select-rows", n && k >= 0 ? he(k, e) : [x(e)], t), k = e;
|
|
959
|
+
}, R = j(() => i.selectable ? i.rows.reduce((e, t) => e + +!!i.selection?.[u.rowId(t)], 0) : 0), ve = j(() => i.rows.length > 0 && R.value === i.rows.length), ye = j(() => R.value > 0 && !ve.value), be = j(() => !!i.skeleton), Te = j(() => be.value ? 12 : i.rows.length), W = Pt(j(() => ({
|
|
960
|
+
count: Te.value,
|
|
961
|
+
getScrollElement: () => l.value,
|
|
962
|
+
estimateSize: () => _.value + 1,
|
|
963
|
+
scrollMargin: v.value,
|
|
964
|
+
scrollPaddingStart: v.value,
|
|
965
|
+
scrollPaddingEnd: ne.value,
|
|
966
|
+
overscan: 10,
|
|
967
|
+
getItemKey: (e) => be.value ? `sk-${e}` : u.rowId(i.rows[e]),
|
|
968
|
+
rangeExtractor: (e) => {
|
|
969
|
+
let t = Math.max(0, e.startIndex - e.overscan), n = Math.min(e.count - 1, e.endIndex + e.overscan), r = [], i = O.focusedIndex.value;
|
|
970
|
+
!be.value && i >= 0 && i < t && i < e.count && r.push(i);
|
|
971
|
+
for (let e = t; e <= n; e++) r.push(e);
|
|
972
|
+
return !be.value && i > n && i < e.count && r.push(i), r;
|
|
973
|
+
}
|
|
974
|
+
}))), De = j(() => W.value.getVirtualItems()), ke = j(() => W.value.getTotalSize()), je = (e, t) => {
|
|
975
|
+
e && !be.value && fe(i.rows[t]) && W.value.measureElement(e);
|
|
976
|
+
};
|
|
977
|
+
q(() => new Set(Object.keys(i.expanded ?? {}).filter((e) => i.expanded[e])), (e, t) => {
|
|
978
|
+
for (let n of t ?? []) {
|
|
979
|
+
if (e.has(n)) continue;
|
|
980
|
+
let t = i.rows.findIndex((e) => u.rowId(e) === n);
|
|
981
|
+
t >= 0 && W.value.resizeItem(t, _.value + 1);
|
|
982
|
+
}
|
|
983
|
+
});
|
|
984
|
+
let Me = Ee(!1), Ne = Ee(!1), Pe = Ee(null), J, Ie = 0, Le = () => {
|
|
985
|
+
let e = l.value;
|
|
986
|
+
if (!e || (re(), Me.value = e.scrollLeft > 0, Ne.value = e.scrollLeft + e.clientWidth < e.scrollWidth - 1, e.scrollTop === Ie)) return;
|
|
987
|
+
Ie = e.scrollTop;
|
|
988
|
+
let t = W.value.range;
|
|
989
|
+
t && !be.value && (Pe.value = {
|
|
990
|
+
from: i.rowIndexOffset + t.startIndex + 1,
|
|
991
|
+
to: i.rowIndexOffset + t.endIndex + 1
|
|
992
|
+
}, clearTimeout(J), J = setTimeout(() => Pe.value = null, 900));
|
|
993
|
+
}, Re = j(() => Pe.value ? s.i18n.t("page.scrollPos", {
|
|
994
|
+
from: Pe.value.from,
|
|
995
|
+
to: Pe.value.to
|
|
996
|
+
}) : "");
|
|
997
|
+
we(() => {
|
|
998
|
+
Le(), l.value && typeof ResizeObserver < "u" && new ResizeObserver(Le).observe(l.value);
|
|
999
|
+
}), Ce(() => clearTimeout(J));
|
|
1000
|
+
let ze = null, Be = (e) => {
|
|
1001
|
+
ze = {
|
|
1002
|
+
x: e.clientX,
|
|
1003
|
+
y: e.clientY
|
|
1004
|
+
}, O.onMousedown(e);
|
|
1005
|
+
}, Ve = (e) => {
|
|
1006
|
+
let t = e.target, n = t.closest(".dt-row[data-index]");
|
|
1007
|
+
if (!n) return;
|
|
1008
|
+
let r = i.rows[Number(n.dataset.index)];
|
|
1009
|
+
if (!r) return;
|
|
1010
|
+
let a = t.closest("a.dt-link");
|
|
1011
|
+
a && a.closest(".dt-cell.is-primary") && n.contains(a) ? e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && !e.altKey && o("row-open", Oe(r), e) : h(e, n, ze) && o("row-click", Oe(r), e);
|
|
1012
|
+
}, He = (e) => i.sort?.get(e), Ue = (e) => i.sortable && (e.def.sortable ?? a[e.def.type].sortable), We = (e) => {
|
|
1013
|
+
let t = c.value;
|
|
1014
|
+
if (!t) return;
|
|
1015
|
+
let n = le(e.id).flatMap((e) => [...e.querySelectorAll(".dt-cell-content, .dt-head-text")]);
|
|
1016
|
+
for (let e of n) e.style.width = "max-content", e.style.maxWidth = "none", e.style.flex = "none";
|
|
1017
|
+
let r = n.reduce((e, t) => Math.max(e, t.getBoundingClientRect().width), 0);
|
|
1018
|
+
for (let e of n) e.style.width = "", e.style.maxWidth = "", e.style.flex = "";
|
|
1019
|
+
let i = parseFloat(getComputedStyle(t).getPropertyValue("--dt-cell-x")) || 12;
|
|
1020
|
+
u.setWidth(e.id, Math.ceil(r) + i * 2 + 24);
|
|
1021
|
+
}, Ge = (e, t) => {
|
|
1022
|
+
switch (t) {
|
|
1023
|
+
case "filter":
|
|
1024
|
+
o("header-filter", e.id);
|
|
1025
|
+
return;
|
|
1026
|
+
case "sort-asc":
|
|
1027
|
+
case "sort-desc":
|
|
1028
|
+
case "sort-clear":
|
|
1029
|
+
o("sort-set", e.id, t === "sort-clear" ? null : t === "sort-asc" ? "asc" : "desc");
|
|
1030
|
+
return;
|
|
1031
|
+
case "pin-left":
|
|
1032
|
+
u.pin(e.id, "start");
|
|
1033
|
+
return;
|
|
1034
|
+
case "pin-right":
|
|
1035
|
+
u.pin(e.id, "end");
|
|
1036
|
+
return;
|
|
1037
|
+
case "unpin":
|
|
1038
|
+
u.pin(e.id, null);
|
|
1039
|
+
return;
|
|
1040
|
+
case "fit":
|
|
1041
|
+
We(e);
|
|
1042
|
+
return;
|
|
1043
|
+
case "hide":
|
|
1044
|
+
u.setVisible(e.id, !1);
|
|
1045
|
+
return;
|
|
1046
|
+
case "move-left":
|
|
1047
|
+
case "move-right": {
|
|
1048
|
+
let n = document.activeElement?.closest(".dt-head-cell")?.dataset.col === e.id;
|
|
1049
|
+
u.move(e.id, t === "move-left" ? -1 : 1), n && xe(() => le(e.id)[0]?.querySelector(".dt-head-label")?.focus());
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
}, Ke = (e, t) => {
|
|
1053
|
+
if (t === "down") {
|
|
1054
|
+
O.focusRow(O.focusedIndex.value);
|
|
1055
|
+
return;
|
|
1056
|
+
}
|
|
1057
|
+
let n = u.columns.value.findIndex((t) => t.id === e.id);
|
|
1058
|
+
ue(t === "left" ? n - 1 : n + 1);
|
|
1059
|
+
}, qe = i.rows.map((e) => u.rowId(e));
|
|
1060
|
+
return q(() => i.rows.map((e) => u.rowId(e)).join("\0"), () => {
|
|
1061
|
+
let e = i.rows.map((e) => u.rowId(e)), t = !!c.value && c.value.contains(document.activeElement), n = qe[O.focusedIndex.value], r = n === void 0 ? -1 : e.indexOf(n);
|
|
1062
|
+
r >= 0 ? O.focusedIndex.value = r : O.clamp(), qe = e, k = -1, t && e.length && xe(() => O.focusRow(O.focusedIndex.value));
|
|
1063
|
+
}), q(_, () => W.value.measure()), n({
|
|
1064
|
+
focusRow: O.focusRow,
|
|
1065
|
+
scrollToIndex: (e) => W.value.scrollToIndex(e),
|
|
1066
|
+
scrollToTop: () => {
|
|
1067
|
+
l.value && (l.value.scrollTop = 0);
|
|
1068
|
+
},
|
|
1069
|
+
measure: () => W.value.measure(),
|
|
1070
|
+
rowEl: D
|
|
1071
|
+
}), (e, n) => (B(), P("div", {
|
|
1072
|
+
ref_key: "root",
|
|
1073
|
+
ref: c,
|
|
1074
|
+
class: z(["dt-grid", {
|
|
1075
|
+
"is-scrolled-start": Me.value,
|
|
1076
|
+
"is-scrolled-end": Ne.value,
|
|
1077
|
+
"is-keyboard": K(O).keyboard.value,
|
|
1078
|
+
"is-skeleton": be.value,
|
|
1079
|
+
"is-dim": t.dim,
|
|
1080
|
+
"has-vlines": t.verticalLines,
|
|
1081
|
+
"is-phone": t.phone
|
|
1082
|
+
}]),
|
|
1083
|
+
role: "grid",
|
|
1084
|
+
"aria-label": t.label,
|
|
1085
|
+
"aria-rowcount": t.rowCount,
|
|
1086
|
+
"aria-colcount": K(u).columns.value.length + +!!t.selectable + +!!t.rowMenu,
|
|
1087
|
+
"aria-busy": t.loading || t.dim ? "true" : void 0,
|
|
1088
|
+
"data-density": f.value,
|
|
1089
|
+
onKeydown: I,
|
|
1090
|
+
onMousedown: Be,
|
|
1091
|
+
onPointerdown: n[9] ||= (...e) => K(O).onPointerdown && K(O).onPointerdown(...e),
|
|
1092
|
+
onFocusin: n[10] ||= (...e) => K(O).onFocusin && K(O).onFocusin(...e),
|
|
1093
|
+
onClick: Ve
|
|
1094
|
+
}, [
|
|
1095
|
+
F("div", {
|
|
1096
|
+
ref_key: "scrollEl",
|
|
1097
|
+
ref: l,
|
|
1098
|
+
class: "dt-scroll",
|
|
1099
|
+
onScrollPassive: Le
|
|
1100
|
+
}, [F("div", Mn, [
|
|
1101
|
+
t.selectable ? (B(), P("div", {
|
|
1102
|
+
key: 0,
|
|
1103
|
+
class: z(["dt-head-cell dt-head-select is-pinned-start", { "is-pin-edge": !K(u).start.value.length }]),
|
|
1104
|
+
style: { left: "0px" },
|
|
1105
|
+
role: "columnheader"
|
|
1106
|
+
}, [F("input", {
|
|
1107
|
+
type: "checkbox",
|
|
1108
|
+
class: "dt-checkbox",
|
|
1109
|
+
checked: ve.value,
|
|
1110
|
+
indeterminate: ye.value,
|
|
1111
|
+
"aria-label": K(s).i18n.t("row.selectPageAria"),
|
|
1112
|
+
onClick: n[0] ||= (e) => o("select-page", !ve.value)
|
|
1113
|
+
}, null, 8, Nn)], 2)) : N("", !0),
|
|
1114
|
+
(B(!0), P(A, null, H([...K(u).start.value, ...K(u).center.value], (e) => (B(), M(An, {
|
|
1115
|
+
key: e.id,
|
|
1116
|
+
column: e,
|
|
1117
|
+
sort: He(e.id)?.dir ?? null,
|
|
1118
|
+
"sort-index": He(e.id)?.index ?? null,
|
|
1119
|
+
filtered: t.filteredColumns?.has(e.id) ?? !1,
|
|
1120
|
+
resizing: K(u).resizing.value?.id === e.id ? K(u).resizing.value.size : null,
|
|
1121
|
+
sortable: Ue(e),
|
|
1122
|
+
phone: t.phone,
|
|
1123
|
+
onSort: n[1] ||= (e, t) => o("sort", e.id, t),
|
|
1124
|
+
onFilter: n[2] ||= (e) => o("header-filter", e.id),
|
|
1125
|
+
onAction: Ge,
|
|
1126
|
+
onNav: Ke,
|
|
1127
|
+
onResizeBy: n[3] ||= (e, t) => K(u).setWidth(e.id, K(u).widthOf(e.id) + t),
|
|
1128
|
+
onResizeStart: n[4] ||= (e, t) => K(u).setWidth(e.id, t)
|
|
1129
|
+
}, null, 8, [
|
|
1130
|
+
"column",
|
|
1131
|
+
"sort",
|
|
1132
|
+
"sort-index",
|
|
1133
|
+
"filtered",
|
|
1134
|
+
"resizing",
|
|
1135
|
+
"sortable",
|
|
1136
|
+
"phone"
|
|
1137
|
+
]))), 128)),
|
|
1138
|
+
n[11] ||= F("div", {
|
|
1139
|
+
class: "dt-head-cell dt-cell-fill",
|
|
1140
|
+
role: "presentation",
|
|
1141
|
+
"aria-hidden": "true"
|
|
1142
|
+
}, null, -1),
|
|
1143
|
+
(B(!0), P(A, null, H(K(u).end.value, (e) => (B(), M(An, {
|
|
1144
|
+
key: e.id,
|
|
1145
|
+
column: e,
|
|
1146
|
+
sort: He(e.id)?.dir ?? null,
|
|
1147
|
+
"sort-index": He(e.id)?.index ?? null,
|
|
1148
|
+
filtered: t.filteredColumns?.has(e.id) ?? !1,
|
|
1149
|
+
resizing: K(u).resizing.value?.id === e.id ? K(u).resizing.value.size : null,
|
|
1150
|
+
sortable: Ue(e),
|
|
1151
|
+
phone: t.phone,
|
|
1152
|
+
onSort: n[5] ||= (e, t) => o("sort", e.id, t),
|
|
1153
|
+
onFilter: n[6] ||= (e) => o("header-filter", e.id),
|
|
1154
|
+
onAction: Ge,
|
|
1155
|
+
onNav: Ke,
|
|
1156
|
+
onResizeBy: n[7] ||= (e, t) => K(u).setWidth(e.id, K(u).widthOf(e.id) + t),
|
|
1157
|
+
onResizeStart: n[8] ||= (e, t) => K(u).setWidth(e.id, t)
|
|
1158
|
+
}, null, 8, [
|
|
1159
|
+
"column",
|
|
1160
|
+
"sort",
|
|
1161
|
+
"sort-index",
|
|
1162
|
+
"filtered",
|
|
1163
|
+
"resizing",
|
|
1164
|
+
"sortable",
|
|
1165
|
+
"phone"
|
|
1166
|
+
]))), 128)),
|
|
1167
|
+
t.rowMenu ? (B(), P("div", {
|
|
1168
|
+
key: 1,
|
|
1169
|
+
class: z(["dt-head-cell dt-head-menu-col is-pinned-end", { "is-pin-edge": !K(u).end.value.length }]),
|
|
1170
|
+
style: { right: "0px" },
|
|
1171
|
+
role: "columnheader"
|
|
1172
|
+
}, null, 2)) : N("", !0)
|
|
1173
|
+
]), F("div", {
|
|
1174
|
+
class: "dt-body",
|
|
1175
|
+
role: "presentation",
|
|
1176
|
+
inert: t.dim || void 0,
|
|
1177
|
+
style: Se({ height: `${ke.value}px` })
|
|
1178
|
+
}, [(B(!0), P(A, null, H(De.value, (n) => (B(), P("div", {
|
|
1179
|
+
key: String(n.key),
|
|
1180
|
+
ref_for: !0,
|
|
1181
|
+
ref: (e) => je(e, n.index),
|
|
1182
|
+
class: "dt-item",
|
|
1183
|
+
"data-index": n.index,
|
|
1184
|
+
style: Se({ transform: `translateY(${n.start - v.value}px)` })
|
|
1185
|
+
}, [be.value ? (B(), M(K(y), {
|
|
1186
|
+
key: 0,
|
|
1187
|
+
index: n.index,
|
|
1188
|
+
columns: K(u).columns.value
|
|
1189
|
+
}, null, 8, ["index", "columns"])) : (B(), P(A, { key: 1 }, [L(K(ie), {
|
|
1190
|
+
row: t.rows[n.index],
|
|
1191
|
+
index: n.index,
|
|
1192
|
+
"row-index": 2 + t.rowIndexOffset + n.index,
|
|
1193
|
+
columns: K(u).columns.value,
|
|
1194
|
+
env: ae.value,
|
|
1195
|
+
focused: K(O).focusedIndex.value === n.index,
|
|
1196
|
+
"keyboard-focus": K(O).keyboard.value,
|
|
1197
|
+
"secondary-visible": f.value === "comfortable",
|
|
1198
|
+
label: me(t.rows[n.index]),
|
|
1199
|
+
selectable: t.selectable,
|
|
1200
|
+
selected: de(n.index),
|
|
1201
|
+
"select-edge": !K(u).start.value.length,
|
|
1202
|
+
expandable: t.expandable,
|
|
1203
|
+
"can-expand": S(t.rows[n.index]),
|
|
1204
|
+
expanded: fe(t.rows[n.index]),
|
|
1205
|
+
"subrow-id": w(t.rows[n.index]),
|
|
1206
|
+
menu: t.rowMenu,
|
|
1207
|
+
"menu-open": ge.value === n.index,
|
|
1208
|
+
"menu-edge": !K(u).end.value.length,
|
|
1209
|
+
"row-actions": t.rowActions,
|
|
1210
|
+
error: E(t.rows[n.index]),
|
|
1211
|
+
uid: T(t.rows[n.index]),
|
|
1212
|
+
href: t.primaryHref?.(t.rows[n.index]),
|
|
1213
|
+
"primary-header": t.primaryHeader,
|
|
1214
|
+
onSelect: (e, t) => _e(n.index, e, t),
|
|
1215
|
+
onExpand: (e) => o("toggle-expand", x(n.index), !fe(t.rows[n.index])),
|
|
1216
|
+
onMenuOpen: (e) => ge.value = e ? n.index : -1,
|
|
1217
|
+
onOpen: (e) => o("row-open", Oe(t.rows[n.index]), e),
|
|
1218
|
+
onCopy: (e) => o("copy-id", Oe(t.rows[n.index]))
|
|
1219
|
+
}, null, 8, /* @__PURE__ */ "row.index.row-index.columns.env.focused.keyboard-focus.secondary-visible.label.selectable.selected.select-edge.expandable.can-expand.expanded.subrow-id.menu.menu-open.menu-edge.row-actions.error.uid.href.primary-header.onSelect.onExpand.onMenuOpen.onOpen.onCopy".split(".")), fe(t.rows[n.index]) ? (B(), P("div", {
|
|
1220
|
+
key: 0,
|
|
1221
|
+
id: w(t.rows[n.index]),
|
|
1222
|
+
class: "dt-subrow",
|
|
1223
|
+
role: "row",
|
|
1224
|
+
"aria-rowindex": 2 + t.rowIndexOffset + n.index
|
|
1225
|
+
}, [F("div", {
|
|
1226
|
+
role: "gridcell",
|
|
1227
|
+
"aria-colspan": K(u).columns.value.length
|
|
1228
|
+
}, [U(e.$slots, "expanded", {
|
|
1229
|
+
row: Oe(t.rows[n.index]),
|
|
1230
|
+
close: () => o("toggle-expand", x(n.index), !1)
|
|
1231
|
+
})], 8, Ln)], 8, In)) : N("", !0)], 64))], 12, Fn))), 128))], 12, Pn)], 544),
|
|
1232
|
+
t.refreshing ? (B(), P("div", Rn)) : N("", !0),
|
|
1233
|
+
e.$slots.notice ? (B(), P("div", zn, [U(e.$slots, "notice")])) : N("", !0),
|
|
1234
|
+
e.$slots.state && !be.value && t.rows.length === 0 ? (B(), P("div", Bn, [U(e.$slots, "state")])) : N("", !0),
|
|
1235
|
+
F("div", {
|
|
1236
|
+
class: z(["dt-scroll-pill", { "is-visible": Pe.value }]),
|
|
1237
|
+
"aria-hidden": "true"
|
|
1238
|
+
}, G(Re.value), 3)
|
|
1239
|
+
], 42, jn));
|
|
1240
|
+
}
|
|
1241
|
+
}), Jn = ["aria-label", "data-dt-tip"], Yn = ["data-state"], Xn = /* @__PURE__ */ R({
|
|
1242
|
+
__name: "MoreMenu",
|
|
1243
|
+
props: {
|
|
1244
|
+
refresh: { type: Boolean },
|
|
1245
|
+
export: { type: Boolean },
|
|
1246
|
+
import: { type: Boolean },
|
|
1247
|
+
print: { type: Boolean },
|
|
1248
|
+
autoRefresh: { type: Boolean },
|
|
1249
|
+
autoRefreshOn: { type: Boolean }
|
|
1250
|
+
},
|
|
1251
|
+
emits: [
|
|
1252
|
+
"refresh",
|
|
1253
|
+
"export",
|
|
1254
|
+
"import",
|
|
1255
|
+
"print",
|
|
1256
|
+
"update:autoRefreshOn"
|
|
1257
|
+
],
|
|
1258
|
+
setup(e, { emit: t }) {
|
|
1259
|
+
let n = e, r = t, { i18n: i } = pe(), a = () => n.export || n.import || n.print;
|
|
1260
|
+
return (t, n) => (B(), M(K(yt), null, {
|
|
1261
|
+
default: J(() => [L(K(Ct), { "as-child": "" }, {
|
|
1262
|
+
default: J(() => [F("button", {
|
|
1263
|
+
type: "button",
|
|
1264
|
+
class: "dt-btn dt-btn-icon",
|
|
1265
|
+
"aria-label": K(i).t("toolbar.more"),
|
|
1266
|
+
"data-dt-tip": K(i).t("toolbar.more")
|
|
1267
|
+
}, [L(K(Ke), {
|
|
1268
|
+
size: 16,
|
|
1269
|
+
weight: "bold",
|
|
1270
|
+
"aria-hidden": "true"
|
|
1271
|
+
})], 8, Jn)]),
|
|
1272
|
+
_: 1
|
|
1273
|
+
}), L(K(Q), null, {
|
|
1274
|
+
default: J(() => [L(K(_t), {
|
|
1275
|
+
class: "dt-menu dt-more",
|
|
1276
|
+
align: "end",
|
|
1277
|
+
"side-offset": 4
|
|
1278
|
+
}, {
|
|
1279
|
+
default: J(() => [
|
|
1280
|
+
t.$props.export ? (B(), M(K(bt), { key: 0 }, {
|
|
1281
|
+
default: J(() => [L(K(St), { class: "dt-menu-item" }, {
|
|
1282
|
+
default: J(() => [I(G(K(i).t("toolbar.export")), 1)]),
|
|
1283
|
+
_: 1
|
|
1284
|
+
}), L(K(Q), null, {
|
|
1285
|
+
default: J(() => [L(K(xt), {
|
|
1286
|
+
class: "dt-menu",
|
|
1287
|
+
"side-offset": 4
|
|
1288
|
+
}, {
|
|
1289
|
+
default: J(() => [L(K(Z), {
|
|
1290
|
+
class: "dt-menu-item",
|
|
1291
|
+
onSelect: n[0] ||= (e) => r("export", "csv")
|
|
1292
|
+
}, {
|
|
1293
|
+
default: J(() => [I(G(K(i).t("toolbar.csv")), 1)]),
|
|
1294
|
+
_: 1
|
|
1295
|
+
}), L(K(Z), {
|
|
1296
|
+
class: "dt-menu-item",
|
|
1297
|
+
onSelect: n[1] ||= (e) => r("export", "xlsx")
|
|
1298
|
+
}, {
|
|
1299
|
+
default: J(() => [I(G(K(i).t("toolbar.xlsx")), 1)]),
|
|
1300
|
+
_: 1
|
|
1301
|
+
})]),
|
|
1302
|
+
_: 1
|
|
1303
|
+
})]),
|
|
1304
|
+
_: 1
|
|
1305
|
+
})]),
|
|
1306
|
+
_: 1
|
|
1307
|
+
})) : N("", !0),
|
|
1308
|
+
t.$props.import ? (B(), M(K(Z), {
|
|
1309
|
+
key: 1,
|
|
1310
|
+
class: "dt-menu-item",
|
|
1311
|
+
onSelect: n[2] ||= (e) => r("import")
|
|
1312
|
+
}, {
|
|
1313
|
+
default: J(() => [I(G(K(i).t("toolbar.import")), 1)]),
|
|
1314
|
+
_: 1
|
|
1315
|
+
})) : N("", !0),
|
|
1316
|
+
e.print ? (B(), M(K(Z), {
|
|
1317
|
+
key: 2,
|
|
1318
|
+
class: "dt-menu-item",
|
|
1319
|
+
onSelect: n[3] ||= (e) => r("print")
|
|
1320
|
+
}, {
|
|
1321
|
+
default: J(() => [I(G(K(i).t("toolbar.print")), 1)]),
|
|
1322
|
+
_: 1
|
|
1323
|
+
})) : N("", !0),
|
|
1324
|
+
a() && (e.refresh || e.autoRefresh) ? (B(), M(K($), {
|
|
1325
|
+
key: 3,
|
|
1326
|
+
class: "dt-menu-sep"
|
|
1327
|
+
})) : N("", !0),
|
|
1328
|
+
e.refresh ? (B(), M(K(Z), {
|
|
1329
|
+
key: 4,
|
|
1330
|
+
class: "dt-menu-item",
|
|
1331
|
+
onSelect: n[4] ||= (e) => r("refresh")
|
|
1332
|
+
}, {
|
|
1333
|
+
default: J(() => [I(G(K(i).t("toolbar.refresh")) + " ", 1), n[6] ||= F("kbd", { class: "dt-kbd" }, "R", -1)]),
|
|
1334
|
+
_: 1
|
|
1335
|
+
})) : N("", !0),
|
|
1336
|
+
e.autoRefresh ? (B(), M(K(gt), {
|
|
1337
|
+
key: 5,
|
|
1338
|
+
class: "dt-menu-item",
|
|
1339
|
+
"model-value": e.autoRefreshOn,
|
|
1340
|
+
"onUpdate:modelValue": n[5] ||= (e) => r("update:autoRefreshOn", e === !0)
|
|
1341
|
+
}, {
|
|
1342
|
+
default: J(() => [I(G(K(i).t("toolbar.autoRefresh")) + " ", 1), F("span", {
|
|
1343
|
+
class: "dt-switch dt-pop-end",
|
|
1344
|
+
"data-state": e.autoRefreshOn ? "checked" : "unchecked",
|
|
1345
|
+
"aria-hidden": "true"
|
|
1346
|
+
}, [...n[7] ||= [F("span", { class: "dt-switch-thumb" }, null, -1)]], 8, Yn)]),
|
|
1347
|
+
_: 1
|
|
1348
|
+
}, 8, ["model-value"])) : N("", !0)
|
|
1349
|
+
]),
|
|
1350
|
+
_: 1
|
|
1351
|
+
})]),
|
|
1352
|
+
_: 1
|
|
1353
|
+
})]),
|
|
1354
|
+
_: 1
|
|
1355
|
+
}));
|
|
1356
|
+
}
|
|
1357
|
+
}), Zn = ["aria-label", "data-dt-tip"], Qn = { class: "dt-toolbar-end" }, $n = /* @__PURE__ */ R({
|
|
1358
|
+
__name: "Toolbar",
|
|
1359
|
+
props: {
|
|
1360
|
+
size: {},
|
|
1361
|
+
search: {},
|
|
1362
|
+
searchPlaceholder: {},
|
|
1363
|
+
hasFilter: { type: Boolean },
|
|
1364
|
+
hasDisplay: { type: Boolean },
|
|
1365
|
+
hasMore: { type: Boolean }
|
|
1366
|
+
},
|
|
1367
|
+
emits: ["update:search"],
|
|
1368
|
+
setup(e, { expose: t, emit: n }) {
|
|
1369
|
+
let r = e, i = n, { i18n: a } = pe(), o = V(!1), s = V(null), c = j(() => r.size === "phone"), l = j(() => c.value && (o.value || !!r.search)), u = () => {
|
|
1370
|
+
o.value = !0, requestAnimationFrame(() => s.value?.focus());
|
|
1371
|
+
}, d = () => {
|
|
1372
|
+
o.value = !1, i("update:search", "");
|
|
1373
|
+
};
|
|
1374
|
+
return t({ focusSearch: () => {
|
|
1375
|
+
r.size !== "full" && !o.value && !r.search ? u() : s.value?.focus();
|
|
1376
|
+
} }), (t, n) => (B(), P("div", {
|
|
1377
|
+
class: z(["dt-toolbar", `is-${e.size}`]),
|
|
1378
|
+
role: "toolbar"
|
|
1379
|
+
}, [l.value ? (B(), P(A, { key: 0 }, [L(b, {
|
|
1380
|
+
ref_key: "searchBox",
|
|
1381
|
+
ref: s,
|
|
1382
|
+
"model-value": e.search ?? "",
|
|
1383
|
+
placeholder: e.searchPlaceholder,
|
|
1384
|
+
phone: "",
|
|
1385
|
+
"onUpdate:modelValue": n[0] ||= (e) => i("update:search", e)
|
|
1386
|
+
}, null, 8, ["model-value", "placeholder"]), F("button", {
|
|
1387
|
+
type: "button",
|
|
1388
|
+
class: "dt-btn dt-btn-ghost dt-search-cancel",
|
|
1389
|
+
onClick: d
|
|
1390
|
+
}, G(K(a).t("common.cancel")), 1)], 64)) : (B(), P(A, { key: 1 }, [
|
|
1391
|
+
U(t.$slots, "view"),
|
|
1392
|
+
n[4] ||= F("span", { class: "dt-toolbar-spacer" }, null, -1),
|
|
1393
|
+
e.search === null ? N("", !0) : (B(), P(A, { key: 0 }, [e.size !== "full" && !o.value && !e.search ? (B(), P("button", {
|
|
1394
|
+
key: 0,
|
|
1395
|
+
type: "button",
|
|
1396
|
+
class: "dt-btn dt-btn-icon dt-search-open",
|
|
1397
|
+
"aria-label": e.searchPlaceholder,
|
|
1398
|
+
"data-dt-tip": e.searchPlaceholder,
|
|
1399
|
+
onClick: u
|
|
1400
|
+
}, [L(K(Je), {
|
|
1401
|
+
size: c.value ? 20 : 16,
|
|
1402
|
+
"aria-hidden": "true"
|
|
1403
|
+
}, null, 8, ["size"])], 8, Zn)) : (B(), M(b, {
|
|
1404
|
+
key: 1,
|
|
1405
|
+
ref_key: "searchBox",
|
|
1406
|
+
ref: s,
|
|
1407
|
+
"model-value": e.search,
|
|
1408
|
+
placeholder: e.searchPlaceholder,
|
|
1409
|
+
"onUpdate:modelValue": n[1] ||= (e) => i("update:search", e),
|
|
1410
|
+
onFocusout: n[2] ||= (e) => o.value = !1
|
|
1411
|
+
}, null, 8, ["model-value", "placeholder"]))], 64)),
|
|
1412
|
+
e.hasFilter ? U(t.$slots, "filter", {
|
|
1413
|
+
iconOnly: c.value,
|
|
1414
|
+
phone: c.value
|
|
1415
|
+
}, void 0, void 0, 1) : N("", !0),
|
|
1416
|
+
e.hasDisplay && !c.value ? U(t.$slots, "display", { iconOnly: e.size !== "full" }, void 0, void 0, 2) : N("", !0),
|
|
1417
|
+
e.hasMore || e.hasDisplay && c.value ? U(t.$slots, "more", { phone: c.value }, void 0, void 0, 3) : N("", !0),
|
|
1418
|
+
t.$slots.end ? (B(), P(A, { key: 4 }, [n[3] ||= F("span", {
|
|
1419
|
+
class: "dt-toolbar-sep",
|
|
1420
|
+
"aria-hidden": "true"
|
|
1421
|
+
}, null, -1), F("span", Qn, [U(t.$slots, "end", { compact: c.value })])], 64)) : N("", !0)
|
|
1422
|
+
], 64))], 2));
|
|
1423
|
+
}
|
|
1424
|
+
});
|
|
1425
|
+
//#endregion
|
|
1426
|
+
//#region src/core/views/model.ts
|
|
1427
|
+
function er(e, t) {
|
|
1428
|
+
return (t ? e.find((e) => e.id === t) : void 0) ?? e.find((e) => e.kind === "system" && e.default) ?? e.find((e) => e.kind === "system") ?? null;
|
|
1429
|
+
}
|
|
1430
|
+
var tr = (e) => {
|
|
1431
|
+
let t = "value" in e ? e.value : void 0;
|
|
1432
|
+
return {
|
|
1433
|
+
...e,
|
|
1434
|
+
value: Array.isArray(t) ? [...t].sort() : t
|
|
1435
|
+
};
|
|
1436
|
+
}, nr = (e) => JSON.stringify(e.map(tr).sort((e, t) => e.column.localeCompare(t.column))), rr = (e) => [...e].sort().join("\0");
|
|
1437
|
+
function ir(e, t) {
|
|
1438
|
+
if (nr(e.filters) !== nr(t.filters) || JSON.stringify(e.sort) !== JSON.stringify(t.sort)) return !1;
|
|
1439
|
+
let n = e.columns, r = t.columns;
|
|
1440
|
+
if (n.order.join("\0") !== r.order.join("\0") || rr(n.visible) !== rr(r.visible) || n.pinned.left.join("\0") !== r.pinned.left.join("\0") || n.pinned.right.join("\0") !== r.pinned.right.join("\0")) return !1;
|
|
1441
|
+
for (let e of /* @__PURE__ */ new Set([...Object.keys(n.widths), ...Object.keys(r.widths)])) {
|
|
1442
|
+
let t = n.widths[e], i = r.widths[e];
|
|
1443
|
+
if (t === void 0 || i === void 0 ? t !== i : Math.abs(t - i) > 2) return !1;
|
|
1444
|
+
}
|
|
1445
|
+
return !0;
|
|
1446
|
+
}
|
|
1447
|
+
function ar(e, t, n, r) {
|
|
1448
|
+
let i = e.trim();
|
|
1449
|
+
if (!i) return "required";
|
|
1450
|
+
if (i.length > 60) return "tooLong";
|
|
1451
|
+
let a = i.toLocaleLowerCase(n);
|
|
1452
|
+
return t.some((e) => e.kind === "personal" && e.id !== r && e.name.toLocaleLowerCase(n) === a) ? "taken" : null;
|
|
1453
|
+
}
|
|
1454
|
+
var or = (e, t) => [...e].sort((e, n) => t.compare(e.name, n.name));
|
|
1455
|
+
//#endregion
|
|
1456
|
+
//#region src/core/views/useViews.ts
|
|
1457
|
+
function sr(t) {
|
|
1458
|
+
let n = V([]), r = j(() => [...t.system(), ...n.value]), i = j(() => {
|
|
1459
|
+
let r = e(t.locale()).collator();
|
|
1460
|
+
return {
|
|
1461
|
+
system: t.system(),
|
|
1462
|
+
personal: or(n.value.filter((e) => e.kind === "personal"), r)
|
|
1463
|
+
};
|
|
1464
|
+
}), a = V(null), o = j(() => r.value.find((e) => e.id === a.value) ?? null), s = Ee(null), c = Te(/* @__PURE__ */ new Map()), l = j(() => !!o.value && !!s.value && !ir(t.current(), s.value)), u = !1, d = (e, n = !0) => {
|
|
1465
|
+
let i = r.value.find((t) => t.id === e);
|
|
1466
|
+
if (!i) return;
|
|
1467
|
+
let u = o.value;
|
|
1468
|
+
u && (n && l.value ? c.set(u.id, t.current()) : c.delete(u.id)), a.value = e, t.apply(i.state), s.value = t.current();
|
|
1469
|
+
let d = c.get(e);
|
|
1470
|
+
d && t.apply(d), t.onChange(i);
|
|
1471
|
+
}, f = er(r.value, t.defaultViewId());
|
|
1472
|
+
f && d(f.id);
|
|
1473
|
+
let p = t.adapter ? t.adapter.list(t.tableId()).then((e) => {
|
|
1474
|
+
n.value = e;
|
|
1475
|
+
}).catch(() => {}) : Promise.resolve();
|
|
1476
|
+
Promise.all([p, t.prefsReady]).then(() => {
|
|
1477
|
+
if (u || l.value) return;
|
|
1478
|
+
let e = er(r.value, t.defaultViewId());
|
|
1479
|
+
e && e.id !== a.value && d(e.id);
|
|
1480
|
+
});
|
|
1481
|
+
let m = (e) => n.value = n.value.map((t) => t.id === e.id ? e : t), h = (e) => !!e && !!t.adapter && e.kind !== "system";
|
|
1482
|
+
return {
|
|
1483
|
+
all: r,
|
|
1484
|
+
sections: i,
|
|
1485
|
+
active: o,
|
|
1486
|
+
edited: l,
|
|
1487
|
+
hasViews: j(() => r.value.length > 0),
|
|
1488
|
+
hasDraft: (e) => c.has(e),
|
|
1489
|
+
writable: h,
|
|
1490
|
+
select: (e) => {
|
|
1491
|
+
u = !0, d(e);
|
|
1492
|
+
},
|
|
1493
|
+
saveChanges: async () => {
|
|
1494
|
+
let e = o.value;
|
|
1495
|
+
h(e) && t.adapter && (m(await t.adapter.update(t.tableId(), e.id, { state: t.current() })), s.value = t.current(), c.delete(e.id));
|
|
1496
|
+
},
|
|
1497
|
+
discard: () => {
|
|
1498
|
+
let e = o.value;
|
|
1499
|
+
e && (t.apply(e.state), s.value = t.current(), c.delete(e.id));
|
|
1500
|
+
},
|
|
1501
|
+
create: async (e) => {
|
|
1502
|
+
if (!t.adapter) return;
|
|
1503
|
+
let r = await t.adapter.create(t.tableId(), {
|
|
1504
|
+
name: e.name,
|
|
1505
|
+
state: e.state
|
|
1506
|
+
});
|
|
1507
|
+
n.value = [...n.value, r], e.makeDefault && t.setDefaultViewId(r.id), u = !0, d(r.id, !e.fromCurrent);
|
|
1508
|
+
},
|
|
1509
|
+
rename: async (e, n) => {
|
|
1510
|
+
t.adapter && m(await t.adapter.update(t.tableId(), e, { name: n }));
|
|
1511
|
+
},
|
|
1512
|
+
remove: async (e) => {
|
|
1513
|
+
if (t.adapter && (await t.adapter.remove(t.tableId(), e), n.value = n.value.filter((t) => t.id !== e), c.delete(e), t.defaultViewId() === e && t.setDefaultViewId(null), a.value === e)) {
|
|
1514
|
+
a.value = null, s.value = null;
|
|
1515
|
+
let e = er(r.value, t.defaultViewId());
|
|
1516
|
+
e ? d(e.id) : t.apply({});
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
};
|
|
1520
|
+
}
|
|
1521
|
+
//#endregion
|
|
1522
|
+
//#region src/core/views/ViewDialog.vue?vue&type=script&setup=true&lang.ts
|
|
1523
|
+
var cr = { class: "dt-field" }, lr = { class: "dt-field-label" }, ur = { class: "dt-input" }, dr = ["aria-invalid"], fr = {
|
|
1524
|
+
key: 0,
|
|
1525
|
+
class: "dt-field-error",
|
|
1526
|
+
role: "alert"
|
|
1527
|
+
}, pr = {
|
|
1528
|
+
key: 1,
|
|
1529
|
+
class: "dt-view-summary"
|
|
1530
|
+
}, mr = {
|
|
1531
|
+
key: 2,
|
|
1532
|
+
class: "dt-check-row"
|
|
1533
|
+
}, hr = { class: "dt-dialog-actions" }, gr = {
|
|
1534
|
+
type: "button",
|
|
1535
|
+
class: "dt-btn"
|
|
1536
|
+
}, _r = {
|
|
1537
|
+
type: "submit",
|
|
1538
|
+
class: "dt-btn dt-btn-primary"
|
|
1539
|
+
}, vr = /* @__PURE__ */ R({
|
|
1540
|
+
__name: "ViewDialog",
|
|
1541
|
+
props: /*@__PURE__*/ ye({
|
|
1542
|
+
mode: {},
|
|
1543
|
+
name: {},
|
|
1544
|
+
summary: {},
|
|
1545
|
+
validate: { type: Function }
|
|
1546
|
+
}, {
|
|
1547
|
+
open: {
|
|
1548
|
+
type: Boolean,
|
|
1549
|
+
default: !1
|
|
1550
|
+
},
|
|
1551
|
+
openModifiers: {}
|
|
1552
|
+
}),
|
|
1553
|
+
emits: /*@__PURE__*/ ye(["save"], ["update:open"]),
|
|
1554
|
+
setup(e, { emit: t }) {
|
|
1555
|
+
let n = e, r = t, i = je(e, "open"), { i18n: a } = pe(), o = V(n.name), s = V(!1), c = V(null), l = V(null);
|
|
1556
|
+
q(i, (e) => {
|
|
1557
|
+
e && (o.value = n.name, s.value = !1, c.value = null);
|
|
1558
|
+
});
|
|
1559
|
+
let u = (e) => {
|
|
1560
|
+
e.preventDefault(), l.value?.focus(), l.value?.select();
|
|
1561
|
+
}, d = () => {
|
|
1562
|
+
c.value = n.validate(o.value), !c.value && (r("save", {
|
|
1563
|
+
name: o.value.trim(),
|
|
1564
|
+
makeDefault: s.value
|
|
1565
|
+
}), i.value = !1);
|
|
1566
|
+
};
|
|
1567
|
+
return (t, n) => (B(), M(K(X), {
|
|
1568
|
+
open: i.value,
|
|
1569
|
+
"onUpdate:open": n[2] ||= (e) => i.value = e
|
|
1570
|
+
}, {
|
|
1571
|
+
default: J(() => [L(K(mt), null, {
|
|
1572
|
+
default: J(() => [L(K(pt), { class: "dt-scrim" }), L(K(dt), {
|
|
1573
|
+
class: "dt-dialog dt-view-dialog",
|
|
1574
|
+
onOpenAutoFocus: u
|
|
1575
|
+
}, {
|
|
1576
|
+
default: J(() => [F("form", { onSubmit: Re(d, ["prevent"]) }, [
|
|
1577
|
+
L(K(ht), { class: "dt-dialog-title" }, {
|
|
1578
|
+
default: J(() => [I(G(K(a).t(e.mode === "rename" ? "views.rename" : "views.dialogTitle")), 1)]),
|
|
1579
|
+
_: 1
|
|
1580
|
+
}),
|
|
1581
|
+
e.mode === "create" ? (B(), M(K(ft), {
|
|
1582
|
+
key: 0,
|
|
1583
|
+
class: "dt-dialog-body"
|
|
1584
|
+
}, {
|
|
1585
|
+
default: J(() => [I(G(K(a).t("views.dialogBody")), 1)]),
|
|
1586
|
+
_: 1
|
|
1587
|
+
})) : N("", !0),
|
|
1588
|
+
F("label", cr, [
|
|
1589
|
+
F("span", lr, G(K(a).t("views.name")), 1),
|
|
1590
|
+
F("span", ur, [Ie(F("input", {
|
|
1591
|
+
ref_key: "input",
|
|
1592
|
+
ref: l,
|
|
1593
|
+
"onUpdate:modelValue": n[0] ||= (e) => o.value = e,
|
|
1594
|
+
type: "text",
|
|
1595
|
+
"aria-invalid": c.value ? "true" : void 0
|
|
1596
|
+
}, null, 8, dr), [[Ne, o.value]])]),
|
|
1597
|
+
c.value ? (B(), P("span", fr, G(K(a).t(`views.err.${c.value}`)), 1)) : N("", !0)
|
|
1598
|
+
]),
|
|
1599
|
+
e.summary ? (B(), P("div", pr, [
|
|
1600
|
+
F("span", null, G(K(a).t("views.filters")), 1),
|
|
1601
|
+
F("span", null, G(e.summary.filters), 1),
|
|
1602
|
+
F("span", null, G(K(a).t("views.sort")), 1),
|
|
1603
|
+
F("span", null, G(e.summary.sort), 1),
|
|
1604
|
+
F("span", null, G(K(a).t("views.columns")), 1),
|
|
1605
|
+
F("span", null, G(e.summary.columns), 1)
|
|
1606
|
+
])) : N("", !0),
|
|
1607
|
+
e.mode === "create" ? (B(), P("label", mr, [Ie(F("input", {
|
|
1608
|
+
"onUpdate:modelValue": n[1] ||= (e) => s.value = e,
|
|
1609
|
+
type: "checkbox",
|
|
1610
|
+
class: "dt-checkbox"
|
|
1611
|
+
}, null, 512), [[Me, s.value]]), I(" " + G(K(a).t("views.makeDefault")), 1)])) : N("", !0),
|
|
1612
|
+
F("div", hr, [L(K(ut), { "as-child": "" }, {
|
|
1613
|
+
default: J(() => [F("button", gr, G(K(a).t("common.cancel")), 1)]),
|
|
1614
|
+
_: 1
|
|
1615
|
+
}), F("button", _r, G(K(a).t(e.mode === "rename" ? "common.save" : "views.save")), 1)])
|
|
1616
|
+
], 32)]),
|
|
1617
|
+
_: 1
|
|
1618
|
+
})]),
|
|
1619
|
+
_: 1
|
|
1620
|
+
})]),
|
|
1621
|
+
_: 1
|
|
1622
|
+
}, 8, ["open"]));
|
|
1623
|
+
}
|
|
1624
|
+
}), yr = ["aria-label"], br = { class: "dt-view-name" }, xr = { class: "dt-view-edited" }, Sr = { class: "dt-pop-label" }, Cr = { class: "dt-view-action-main" }, wr = { class: "dt-kbd" }, Tr = { class: "dt-view-action-sub" }, Er = { class: "dt-view-action-main" }, Dr = { class: "dt-view-action-sub" }, Or = { class: "dt-view-action-main" }, kr = { class: "dt-kbd" }, Ar = { class: "dt-view-action-main" }, jr = { class: "dt-input has-icon dt-picker-search" }, Mr = { class: "dt-input-icon" }, Nr = { class: "dt-view-row-name" }, Pr = { class: "dt-view-edited" }, Fr = {
|
|
1625
|
+
key: 2,
|
|
1626
|
+
class: "dt-view-default"
|
|
1627
|
+
}, Ir = ["aria-label"], Lr = {
|
|
1628
|
+
key: 3,
|
|
1629
|
+
class: "dt-view-note"
|
|
1630
|
+
}, Rr = {
|
|
1631
|
+
key: 0,
|
|
1632
|
+
class: "dt-options-empty"
|
|
1633
|
+
}, zr = /* @__PURE__ */ R({
|
|
1634
|
+
__name: "ViewMenu",
|
|
1635
|
+
props: /*@__PURE__*/ ye({
|
|
1636
|
+
sections: {},
|
|
1637
|
+
active: {},
|
|
1638
|
+
edited: { type: Boolean },
|
|
1639
|
+
hasDraft: { type: Function },
|
|
1640
|
+
defaultId: {},
|
|
1641
|
+
canSave: { type: Boolean },
|
|
1642
|
+
canWrite: { type: Boolean },
|
|
1643
|
+
sheet: { type: Boolean }
|
|
1644
|
+
}, {
|
|
1645
|
+
open: {
|
|
1646
|
+
type: Boolean,
|
|
1647
|
+
default: !1
|
|
1648
|
+
},
|
|
1649
|
+
openModifiers: {}
|
|
1650
|
+
}),
|
|
1651
|
+
emits: /*@__PURE__*/ ye([
|
|
1652
|
+
"select",
|
|
1653
|
+
"save-changes",
|
|
1654
|
+
"save-as",
|
|
1655
|
+
"discard",
|
|
1656
|
+
"new",
|
|
1657
|
+
"rename",
|
|
1658
|
+
"duplicate",
|
|
1659
|
+
"set-default",
|
|
1660
|
+
"delete"
|
|
1661
|
+
], ["update:open"]),
|
|
1662
|
+
setup(e, { emit: t }) {
|
|
1663
|
+
let n = e, r = t, i = je(e, "open"), { i18n: a } = pe(), o = V("");
|
|
1664
|
+
q(i, (e) => {
|
|
1665
|
+
e || (o.value = "");
|
|
1666
|
+
});
|
|
1667
|
+
let s = j(() => {
|
|
1668
|
+
let e = n.active?.name ?? a.t("views.title");
|
|
1669
|
+
return a.t(n.edited ? "sr.viewEdited" : "sr.view", { name: e });
|
|
1670
|
+
}), c = (e) => !o.value || e.name.toLocaleLowerCase().includes(o.value.toLocaleLowerCase()), l = j(() => [[
|
|
1671
|
+
"system",
|
|
1672
|
+
"views.system",
|
|
1673
|
+
"views.builtIn"
|
|
1674
|
+
], [
|
|
1675
|
+
"personal",
|
|
1676
|
+
"views.mine",
|
|
1677
|
+
"views.onlyYou"
|
|
1678
|
+
]].map(([e, t, r]) => ({
|
|
1679
|
+
key: e,
|
|
1680
|
+
title: t,
|
|
1681
|
+
hint: r,
|
|
1682
|
+
views: n.sections[e].filter(c)
|
|
1683
|
+
})).filter((e) => e.views.length)), u = (e) => e.id === n.active?.id ? n.edited : n.hasDraft(e.id), d = (e) => n.canSave && e.kind !== "system", f = (e) => {
|
|
1684
|
+
i.value = !1, setTimeout(e, 0);
|
|
1685
|
+
}, p = (e) => {
|
|
1686
|
+
typeof e == "string" && (i.value = !1, r("select", e));
|
|
1687
|
+
};
|
|
1688
|
+
return (t, n) => (B(), M(he, {
|
|
1689
|
+
open: i.value,
|
|
1690
|
+
"onUpdate:open": n[7] ||= (e) => i.value = e,
|
|
1691
|
+
sheet: e.sheet,
|
|
1692
|
+
title: K(a).t("views.title"),
|
|
1693
|
+
"hide-title": "",
|
|
1694
|
+
"content-class": "dt-views",
|
|
1695
|
+
align: "start"
|
|
1696
|
+
}, {
|
|
1697
|
+
trigger: J(() => [F("button", {
|
|
1698
|
+
type: "button",
|
|
1699
|
+
class: "dt-btn dt-btn-ghost has-icon dt-view-trigger",
|
|
1700
|
+
"aria-label": s.value
|
|
1701
|
+
}, [
|
|
1702
|
+
F("span", br, G(e.active?.name ?? K(a).t("views.title")), 1),
|
|
1703
|
+
e.edited ? (B(), P(A, { key: 0 }, [n[8] ||= F("span", {
|
|
1704
|
+
class: "dt-view-dot",
|
|
1705
|
+
"aria-hidden": "true"
|
|
1706
|
+
}, null, -1), F("span", xr, G(K(a).t("views.edited")), 1)], 64)) : N("", !0),
|
|
1707
|
+
L(K(Ve), {
|
|
1708
|
+
size: 14,
|
|
1709
|
+
"aria-hidden": "true"
|
|
1710
|
+
})
|
|
1711
|
+
], 8, yr)]),
|
|
1712
|
+
default: J(() => [
|
|
1713
|
+
e.edited && e.active ? (B(), P(A, { key: 0 }, [
|
|
1714
|
+
F("div", Sr, G(K(a).t("views.editedName", { name: e.active.name })), 1),
|
|
1715
|
+
e.canWrite ? (B(), P(A, { key: 0 }, [F("button", {
|
|
1716
|
+
type: "button",
|
|
1717
|
+
class: "dt-pop-item dt-view-action",
|
|
1718
|
+
onClick: n[0] ||= (e) => f(() => r("save-changes"))
|
|
1719
|
+
}, [F("span", Cr, [I(G(K(a).t("views.saveChanges")) + " ", 1), F("kbd", wr, G(K(ne)), 1)]), F("span", Tr, G(K(a).t("views.updates", { name: e.active.name })), 1)]), F("button", {
|
|
1720
|
+
type: "button",
|
|
1721
|
+
class: "dt-pop-item dt-view-action",
|
|
1722
|
+
onClick: n[1] ||= (e) => f(() => r("save-as"))
|
|
1723
|
+
}, [F("span", Er, G(K(a).t("views.saveAsNew")), 1), F("span", Dr, G(K(a).t("views.keepsUnchanged", { name: e.active.name })), 1)])], 64)) : e.canSave ? (B(), P("button", {
|
|
1724
|
+
key: 1,
|
|
1725
|
+
type: "button",
|
|
1726
|
+
class: "dt-pop-item dt-view-action is-single",
|
|
1727
|
+
onClick: n[2] ||= (e) => f(() => r("save-as"))
|
|
1728
|
+
}, [F("span", Or, [I(G(K(a).t("views.saveAsMine")) + " ", 1), F("kbd", kr, G(K(ne)), 1)])])) : N("", !0),
|
|
1729
|
+
F("button", {
|
|
1730
|
+
type: "button",
|
|
1731
|
+
class: "dt-pop-item dt-view-action is-single",
|
|
1732
|
+
onClick: n[3] ||= (e) => f(() => r("discard"))
|
|
1733
|
+
}, [F("span", Ar, G(K(a).t("views.discard")), 1)]),
|
|
1734
|
+
n[9] ||= F("div", { class: "dt-pop-sep" }, null, -1)
|
|
1735
|
+
], 64)) : N("", !0),
|
|
1736
|
+
L(K(kt), {
|
|
1737
|
+
"model-value": e.active?.id,
|
|
1738
|
+
"selection-behavior": "replace",
|
|
1739
|
+
"highlight-on-hover": "",
|
|
1740
|
+
"onUpdate:modelValue": p
|
|
1741
|
+
}, {
|
|
1742
|
+
default: J(() => [F("label", jr, [F("span", Mr, [L(K(Je), {
|
|
1743
|
+
size: 14,
|
|
1744
|
+
"aria-hidden": "true"
|
|
1745
|
+
})]), L(K(Tt), {
|
|
1746
|
+
modelValue: o.value,
|
|
1747
|
+
"onUpdate:modelValue": n[4] ||= (e) => o.value = e,
|
|
1748
|
+
"auto-focus": "",
|
|
1749
|
+
placeholder: K(a).t("views.find"),
|
|
1750
|
+
"aria-label": K(a).t("views.find")
|
|
1751
|
+
}, null, 8, [
|
|
1752
|
+
"modelValue",
|
|
1753
|
+
"placeholder",
|
|
1754
|
+
"aria-label"
|
|
1755
|
+
])]), L(K(wt), { class: "dt-views-list" }, {
|
|
1756
|
+
default: J(() => [(B(!0), P(A, null, H(l.value, (t) => (B(), M(K(Et), { key: t.key }, {
|
|
1757
|
+
default: J(() => [L(K(Dt), { class: "dt-pop-label" }, {
|
|
1758
|
+
default: J(() => [I(G(K(a).t(t.title)) + " ", 1), F("span", null, G(K(a).t(t.hint)), 1)]),
|
|
1759
|
+
_: 2
|
|
1760
|
+
}, 1024), (B(!0), P(A, null, H(t.views, (t) => (B(), P("div", {
|
|
1761
|
+
key: t.id,
|
|
1762
|
+
class: z(["dt-view-row", { "is-active": t.id === e.active?.id }])
|
|
1763
|
+
}, [L(K(Ot), {
|
|
1764
|
+
value: t.id,
|
|
1765
|
+
class: "dt-view-item"
|
|
1766
|
+
}, {
|
|
1767
|
+
default: J(() => [
|
|
1768
|
+
e.sheet && t.id === e.active?.id ? (B(), M(K(We), {
|
|
1769
|
+
key: 0,
|
|
1770
|
+
size: 18,
|
|
1771
|
+
class: "dt-view-check",
|
|
1772
|
+
"aria-hidden": "true"
|
|
1773
|
+
})) : N("", !0),
|
|
1774
|
+
F("span", Nr, G(t.name), 1),
|
|
1775
|
+
u(t) ? (B(), P(A, { key: 1 }, [n[10] ||= F("span", {
|
|
1776
|
+
class: "dt-view-dot",
|
|
1777
|
+
"aria-hidden": "true"
|
|
1778
|
+
}, null, -1), F("span", Pr, G(K(a).t("views.edited")), 1)], 64)) : N("", !0),
|
|
1779
|
+
t.id === e.defaultId ? (B(), P("span", Fr, G(K(a).t("views.default")), 1)) : N("", !0)
|
|
1780
|
+
]),
|
|
1781
|
+
_: 2
|
|
1782
|
+
}, 1032, ["value"]), L(K(yt), null, {
|
|
1783
|
+
default: J(() => [L(K(Ct), { "as-child": "" }, {
|
|
1784
|
+
default: J(() => [F("button", {
|
|
1785
|
+
type: "button",
|
|
1786
|
+
class: "dt-icon-btn-sm dt-view-more",
|
|
1787
|
+
"aria-label": K(a).t("common.more"),
|
|
1788
|
+
onKeydown: n[5] ||= Le(Re(() => {}, ["stop"]), ["enter", "space"])
|
|
1789
|
+
}, [L(K(Ke), {
|
|
1790
|
+
size: 16,
|
|
1791
|
+
weight: "bold",
|
|
1792
|
+
"aria-hidden": "true"
|
|
1793
|
+
})], 40, Ir)]),
|
|
1794
|
+
_: 1
|
|
1795
|
+
}), L(K(Q), null, {
|
|
1796
|
+
default: J(() => [L(K(_t), {
|
|
1797
|
+
class: "dt-menu dt-view-row-menu",
|
|
1798
|
+
side: "right",
|
|
1799
|
+
align: "start",
|
|
1800
|
+
"side-offset": 8
|
|
1801
|
+
}, {
|
|
1802
|
+
default: J(() => [
|
|
1803
|
+
d(t) ? (B(), M(K(Z), {
|
|
1804
|
+
key: 0,
|
|
1805
|
+
class: "dt-menu-item",
|
|
1806
|
+
onSelect: (e) => f(() => r("rename", t))
|
|
1807
|
+
}, {
|
|
1808
|
+
default: J(() => [I(G(K(a).t("views.rename")), 1)]),
|
|
1809
|
+
_: 1
|
|
1810
|
+
}, 8, ["onSelect"])) : N("", !0),
|
|
1811
|
+
e.canSave ? (B(), M(K(Z), {
|
|
1812
|
+
key: 1,
|
|
1813
|
+
class: "dt-menu-item",
|
|
1814
|
+
onSelect: (e) => f(() => r("duplicate", t))
|
|
1815
|
+
}, {
|
|
1816
|
+
default: J(() => [I(G(K(a).t("views.duplicate")), 1)]),
|
|
1817
|
+
_: 1
|
|
1818
|
+
}, 8, ["onSelect"])) : N("", !0),
|
|
1819
|
+
L(K(Z), {
|
|
1820
|
+
class: "dt-menu-item",
|
|
1821
|
+
onSelect: (e) => r("set-default", t.id)
|
|
1822
|
+
}, {
|
|
1823
|
+
default: J(() => [I(G(K(a).t("views.setDefault")), 1)]),
|
|
1824
|
+
_: 1
|
|
1825
|
+
}, 8, ["onSelect"]),
|
|
1826
|
+
d(t) ? (B(), P(A, { key: 2 }, [L(K($), { class: "dt-menu-sep" }), L(K(Z), {
|
|
1827
|
+
class: "dt-menu-item is-destructive",
|
|
1828
|
+
onSelect: (e) => f(() => r("delete", t))
|
|
1829
|
+
}, {
|
|
1830
|
+
default: J(() => [I(G(K(a).t("views.delete")), 1)]),
|
|
1831
|
+
_: 1
|
|
1832
|
+
}, 8, ["onSelect"])], 64)) : N("", !0),
|
|
1833
|
+
t.kind === "system" ? (B(), P("div", Lr, G(K(a).t("views.systemNote")), 1)) : N("", !0)
|
|
1834
|
+
]),
|
|
1835
|
+
_: 2
|
|
1836
|
+
}, 1024)]),
|
|
1837
|
+
_: 2
|
|
1838
|
+
}, 1024)]),
|
|
1839
|
+
_: 2
|
|
1840
|
+
}, 1024)], 2))), 128))]),
|
|
1841
|
+
_: 2
|
|
1842
|
+
}, 1024))), 128)), l.value.length ? N("", !0) : (B(), P("div", Rr, G(K(a).t("views.noMatch")), 1))]),
|
|
1843
|
+
_: 1
|
|
1844
|
+
})]),
|
|
1845
|
+
_: 1
|
|
1846
|
+
}, 8, ["model-value"]),
|
|
1847
|
+
e.canSave ? (B(), P(A, { key: 1 }, [n[11] ||= F("div", { class: "dt-pop-sep" }, null, -1), F("button", {
|
|
1848
|
+
type: "button",
|
|
1849
|
+
class: "dt-pop-item dt-view-new",
|
|
1850
|
+
onClick: n[6] ||= (e) => f(() => r("new"))
|
|
1851
|
+
}, [L(K(Ye), {
|
|
1852
|
+
size: 14,
|
|
1853
|
+
"aria-hidden": "true"
|
|
1854
|
+
}), I(" " + G(K(a).t("views.new")), 1)])], 64)) : N("", !0)
|
|
1855
|
+
]),
|
|
1856
|
+
_: 1
|
|
1857
|
+
}, 8, [
|
|
1858
|
+
"open",
|
|
1859
|
+
"sheet",
|
|
1860
|
+
"title"
|
|
1861
|
+
]));
|
|
1862
|
+
}
|
|
1863
|
+
}), Br = ["aria-label"], Vr = ["aria-label", "data-dt-tip"], Hr = {
|
|
1864
|
+
class: "dt-bulk-count",
|
|
1865
|
+
role: "status"
|
|
1866
|
+
}, Ur = [
|
|
1867
|
+
"disabled",
|
|
1868
|
+
"data-dt-tip",
|
|
1869
|
+
"onClick"
|
|
1870
|
+
], Wr = ["aria-label"], Gr = { class: "dt-bsheet-label" }, Kr = {
|
|
1871
|
+
key: 0,
|
|
1872
|
+
class: "dt-bsheet-sep"
|
|
1873
|
+
}, qr = ["disabled", "onClick"], Jr = { class: "dt-menu-text" }, Yr = {
|
|
1874
|
+
key: 0,
|
|
1875
|
+
class: "dt-menu-sub"
|
|
1876
|
+
}, Xr = ["aria-label"], Zr = { class: "dt-menu-text" }, Qr = {
|
|
1877
|
+
key: 0,
|
|
1878
|
+
class: "dt-menu-sub"
|
|
1879
|
+
}, $r = ["aria-label", "data-dt-tip"], ei = /* @__PURE__ */ R({
|
|
1880
|
+
__name: "BulkBar",
|
|
1881
|
+
props: {
|
|
1882
|
+
rows: {},
|
|
1883
|
+
actions: {},
|
|
1884
|
+
variant: {},
|
|
1885
|
+
phone: { type: Boolean }
|
|
1886
|
+
},
|
|
1887
|
+
emits: ["clear"],
|
|
1888
|
+
setup(e, { emit: t }) {
|
|
1889
|
+
let n = e, r = t, { i18n: i } = pe(), a = j(() => n.actions.filter((e) => !e.when || e.when(n.rows))), o = j(() => a.value.filter((e) => e.inBar).slice(0, n.phone ? 2 : 3)), s = j(() => {
|
|
1890
|
+
let e = new Set(o.value), t = a.value.filter((t) => !e.has(t));
|
|
1891
|
+
return [...t.filter((e) => !e.destructive), ...t.filter((e) => e.destructive)];
|
|
1892
|
+
}), c = j(() => s.value.findIndex((e) => e.destructive)), l = (e) => e.disabled?.(n.rows) ?? !1, u = (e) => {
|
|
1893
|
+
let t = l(e);
|
|
1894
|
+
return typeof t == "string" ? t : e.description;
|
|
1895
|
+
}, d = V(!1), f = (e) => {
|
|
1896
|
+
l(e) || (d.value = !1, e.run(n.rows));
|
|
1897
|
+
}, p = j(() => n.variant === "toolbar" ? "dt-btn has-icon" : "dt-bulk-btn");
|
|
1898
|
+
return (t, n) => (B(), P("div", {
|
|
1899
|
+
class: z(["dt-bulk", [`is-${e.variant}`, { "is-phone": e.phone }]]),
|
|
1900
|
+
role: "toolbar",
|
|
1901
|
+
"aria-label": K(i).t("bulk.aria")
|
|
1902
|
+
}, [
|
|
1903
|
+
e.variant === "toolbar" ? (B(), P("button", {
|
|
1904
|
+
key: 0,
|
|
1905
|
+
type: "button",
|
|
1906
|
+
class: "dt-btn dt-btn-icon",
|
|
1907
|
+
"aria-label": K(i).t("selection.clear"),
|
|
1908
|
+
"data-dt-tip": K(i).t("selection.clear"),
|
|
1909
|
+
onClick: n[0] ||= (e) => r("clear")
|
|
1910
|
+
}, [L(K(Qe), {
|
|
1911
|
+
size: 16,
|
|
1912
|
+
"aria-hidden": "true"
|
|
1913
|
+
})], 8, Vr)) : N("", !0),
|
|
1914
|
+
F("span", Hr, G(K(i).t("selection.selected", { count: e.rows.length })), 1),
|
|
1915
|
+
n[4] ||= F("span", {
|
|
1916
|
+
class: "dt-bulk-sep",
|
|
1917
|
+
"aria-hidden": "true"
|
|
1918
|
+
}, null, -1),
|
|
1919
|
+
U(t.$slots, "default", {}, () => [(B(!0), P(A, null, H(o.value, (t) => (B(), P("button", {
|
|
1920
|
+
key: t.id,
|
|
1921
|
+
type: "button",
|
|
1922
|
+
class: z([p.value, { "is-destructive": t.destructive }]),
|
|
1923
|
+
disabled: !!l(t),
|
|
1924
|
+
"data-dt-tip": u(t),
|
|
1925
|
+
onClick: (e) => f(t)
|
|
1926
|
+
}, [t.icon ? (B(), M(W(t.icon), {
|
|
1927
|
+
key: 0,
|
|
1928
|
+
size: e.phone ? 18 : 16,
|
|
1929
|
+
"aria-hidden": "true"
|
|
1930
|
+
}, null, 8, ["size"])) : N("", !0), F("span", null, G(t.label), 1)], 10, Ur))), 128)), s.value.length && e.phone ? (B(), M(he, {
|
|
1931
|
+
key: 0,
|
|
1932
|
+
open: d.value,
|
|
1933
|
+
"onUpdate:open": n[1] ||= (e) => d.value = e,
|
|
1934
|
+
sheet: "",
|
|
1935
|
+
"hide-title": "",
|
|
1936
|
+
title: K(i).t("bulk.moreAria")
|
|
1937
|
+
}, {
|
|
1938
|
+
trigger: J(() => [F("button", {
|
|
1939
|
+
type: "button",
|
|
1940
|
+
class: "dt-bulk-btn dt-bulk-more",
|
|
1941
|
+
"aria-label": K(i).t("bulk.moreAria")
|
|
1942
|
+
}, [L(K(Ke), {
|
|
1943
|
+
size: 18,
|
|
1944
|
+
weight: "bold",
|
|
1945
|
+
"aria-hidden": "true"
|
|
1946
|
+
}), F("span", null, G(K(i).t("common.more")), 1)], 8, Wr)]),
|
|
1947
|
+
default: J(() => [F("div", Gr, G(K(i).t("selection.selected", { count: e.rows.length })), 1), (B(!0), P(A, null, H(s.value, (e, t) => (B(), P(A, { key: e.id }, [t === c.value ? (B(), P("div", Kr)) : N("", !0), F("button", {
|
|
1948
|
+
type: "button",
|
|
1949
|
+
class: z(["dt-bsheet-row", { "is-destructive": e.destructive }]),
|
|
1950
|
+
disabled: !!l(e),
|
|
1951
|
+
onClick: (t) => f(e)
|
|
1952
|
+
}, [F("span", Jr, [F("span", null, G(e.label), 1), u(e) ? (B(), P("span", Yr, G(u(e)), 1)) : N("", !0)])], 10, qr)], 64))), 128))]),
|
|
1953
|
+
_: 1
|
|
1954
|
+
}, 8, ["open", "title"])) : s.value.length ? (B(), M(K(yt), { key: 1 }, {
|
|
1955
|
+
default: J(() => [L(K(Ct), { "as-child": "" }, {
|
|
1956
|
+
default: J(() => [F("button", {
|
|
1957
|
+
type: "button",
|
|
1958
|
+
class: z([
|
|
1959
|
+
p.value,
|
|
1960
|
+
"dt-bulk-more",
|
|
1961
|
+
{ "dt-btn-icon": e.variant === "toolbar" }
|
|
1962
|
+
]),
|
|
1963
|
+
"aria-label": K(i).t("bulk.moreAria")
|
|
1964
|
+
}, [L(K(Ke), {
|
|
1965
|
+
size: 16,
|
|
1966
|
+
weight: "bold",
|
|
1967
|
+
"aria-hidden": "true"
|
|
1968
|
+
})], 10, Xr)]),
|
|
1969
|
+
_: 1
|
|
1970
|
+
}), L(K(Q), null, {
|
|
1971
|
+
default: J(() => [L(K(_t), {
|
|
1972
|
+
class: "dt-menu dt-bulk-menu",
|
|
1973
|
+
side: e.variant === "floating" ? "top" : "bottom",
|
|
1974
|
+
align: "start",
|
|
1975
|
+
"side-offset": e.variant === "floating" ? 12 : 4
|
|
1976
|
+
}, {
|
|
1977
|
+
default: J(() => [(B(!0), P(A, null, H(s.value, (e, t) => (B(), P(A, { key: e.id }, [t === c.value ? (B(), M(K($), {
|
|
1978
|
+
key: 0,
|
|
1979
|
+
class: "dt-menu-sep"
|
|
1980
|
+
})) : N("", !0), L(K(Z), {
|
|
1981
|
+
class: z(["dt-menu-item", {
|
|
1982
|
+
"is-destructive": e.destructive,
|
|
1983
|
+
"is-two-line": u(e)
|
|
1984
|
+
}]),
|
|
1985
|
+
disabled: !!l(e),
|
|
1986
|
+
onSelect: (t) => f(e)
|
|
1987
|
+
}, {
|
|
1988
|
+
default: J(() => [F("span", Zr, [F("span", null, G(e.label), 1), u(e) ? (B(), P("span", Qr, G(u(e)), 1)) : N("", !0)])]),
|
|
1989
|
+
_: 2
|
|
1990
|
+
}, 1032, [
|
|
1991
|
+
"class",
|
|
1992
|
+
"disabled",
|
|
1993
|
+
"onSelect"
|
|
1994
|
+
])], 64))), 128))]),
|
|
1995
|
+
_: 1
|
|
1996
|
+
}, 8, ["side", "side-offset"])]),
|
|
1997
|
+
_: 1
|
|
1998
|
+
})]),
|
|
1999
|
+
_: 1
|
|
2000
|
+
})) : N("", !0)]),
|
|
2001
|
+
e.variant === "floating" ? (B(), P(A, { key: 1 }, [n[3] ||= F("span", {
|
|
2002
|
+
class: "dt-bulk-sep",
|
|
2003
|
+
"aria-hidden": "true"
|
|
2004
|
+
}, null, -1), F("button", {
|
|
2005
|
+
type: "button",
|
|
2006
|
+
class: "dt-bulk-btn dt-bulk-icon",
|
|
2007
|
+
"aria-label": K(i).t("selection.clear"),
|
|
2008
|
+
"data-dt-tip": K(i).t("selection.clear"),
|
|
2009
|
+
onClick: n[2] ||= (e) => r("clear")
|
|
2010
|
+
}, [L(K(Qe), {
|
|
2011
|
+
size: 16,
|
|
2012
|
+
"aria-hidden": "true"
|
|
2013
|
+
})], 8, $r)], 64)) : N("", !0)
|
|
2014
|
+
], 10, Br));
|
|
2015
|
+
}
|
|
2016
|
+
}), ti = ["aria-label"], ni = { class: "dt-footer-left" }, ri = {
|
|
2017
|
+
key: 0,
|
|
2018
|
+
class: "dt-footer-muted"
|
|
2019
|
+
}, ii = {
|
|
2020
|
+
key: 1,
|
|
2021
|
+
class: "dt-footer-rows"
|
|
2022
|
+
}, ai = { class: "dt-footer-rows" }, oi = { class: "dt-footer-of" }, si = {
|
|
2023
|
+
key: 0,
|
|
2024
|
+
class: "dt-footer-muted"
|
|
2025
|
+
}, ci = {
|
|
2026
|
+
key: 1,
|
|
2027
|
+
class: "dt-footer-muted"
|
|
2028
|
+
}, li = {
|
|
2029
|
+
key: 2,
|
|
2030
|
+
class: "dt-footer-muted"
|
|
2031
|
+
}, ui = {
|
|
2032
|
+
key: 0,
|
|
2033
|
+
class: "dt-footer-live"
|
|
2034
|
+
}, di = {
|
|
2035
|
+
key: 1,
|
|
2036
|
+
class: "dt-footer-muted",
|
|
2037
|
+
role: "status"
|
|
2038
|
+
}, fi = ["aria-label", "data-dt-tip"], pi = { class: "dt-footer-right" }, mi = {
|
|
2039
|
+
key: 0,
|
|
2040
|
+
class: "dt-footer-size"
|
|
2041
|
+
}, hi = { class: "dt-footer-size-label" }, gi = { class: "dt-select" }, _i = ["value", "disabled"], vi = ["value"], yi = {
|
|
2042
|
+
key: 1,
|
|
2043
|
+
class: "dt-footer-vsep",
|
|
2044
|
+
"aria-hidden": "true"
|
|
2045
|
+
}, bi = ["aria-label", "disabled"], xi = ["aria-label", "disabled"], Si = /* @__PURE__ */ R({
|
|
2046
|
+
__name: "Footer",
|
|
2047
|
+
props: {
|
|
2048
|
+
rowCount: {},
|
|
2049
|
+
page: {},
|
|
2050
|
+
hasMore: { type: Boolean },
|
|
2051
|
+
total: {},
|
|
2052
|
+
countable: { type: Boolean },
|
|
2053
|
+
counting: { type: Boolean },
|
|
2054
|
+
countedAt: {},
|
|
2055
|
+
busy: { type: Boolean },
|
|
2056
|
+
firstLoad: { type: Boolean },
|
|
2057
|
+
empty: { type: Boolean },
|
|
2058
|
+
pageSizes: {},
|
|
2059
|
+
updatedAt: {},
|
|
2060
|
+
freshness: {},
|
|
2061
|
+
canRefresh: { type: Boolean },
|
|
2062
|
+
phone: { type: Boolean }
|
|
2063
|
+
},
|
|
2064
|
+
emits: [
|
|
2065
|
+
"count",
|
|
2066
|
+
"page",
|
|
2067
|
+
"page-size",
|
|
2068
|
+
"refresh"
|
|
2069
|
+
],
|
|
2070
|
+
setup(t, { emit: n }) {
|
|
2071
|
+
let r = t, i = n, { i18n: a, locale: o } = pe(), s = e(o), c = j(() => (r.page.number - 1) * r.page.size + 1), l = j(() => c.value + r.rowCount - 1), u = j(() => !r.hasMore), d = j(() => r.page.number === 1 && u.value), f = (e) => e.toLocaleTimeString(o, {
|
|
2072
|
+
hour: "2-digit",
|
|
2073
|
+
minute: "2-digit"
|
|
2074
|
+
}), p = j(() => r.page.number > 1 && !r.busy), m = j(() => r.hasMore && !r.busy), h = j(() => r.updatedAt ? Date.now() - r.updatedAt.getTime() < 6e4 ? a.t("toolbar.updatedJustNow") : a.t("toolbar.updatedAgo", { time: s.relative(r.updatedAt, /* @__PURE__ */ new Date(), "short") }) : "");
|
|
2075
|
+
return (e, n) => (B(), P("div", {
|
|
2076
|
+
class: "dt-footer",
|
|
2077
|
+
role: "navigation",
|
|
2078
|
+
"aria-label": K(a).t("page.nav")
|
|
2079
|
+
}, [F("div", ni, [t.firstLoad ? (B(), P("span", ri, G(K(a).t("common.loading")), 1)) : t.rowCount === 0 ? (B(), P("span", ii, G(K(a).t(t.empty ? "page.none" : "page.zero")), 1)) : (B(), P(A, { key: 2 }, [F("span", ai, G(K(a).t("page.rows", {
|
|
2080
|
+
from: K(s).int(c.value),
|
|
2081
|
+
to: K(s).int(l.value)
|
|
2082
|
+
})), 1), t.total !== void 0 && !d.value ? (B(), P(A, { key: 0 }, [F("span", oi, G(K(a).t("page.of", { total: K(s).int(t.total) })), 1), t.countedAt ? (B(), P("span", si, " · " + G(K(a).t("page.counted", { time: f(t.countedAt) })), 1)) : N("", !0)], 64)) : t.counting ? (B(), P("span", ci, [
|
|
2083
|
+
I(G(K(a).t("page.of", { total: "" })) + " ", 1),
|
|
2084
|
+
L(K(Ge), {
|
|
2085
|
+
size: 12,
|
|
2086
|
+
class: "dt-spin",
|
|
2087
|
+
"aria-hidden": "true"
|
|
2088
|
+
}),
|
|
2089
|
+
I(" " + G(K(a).t("page.counting")), 1)
|
|
2090
|
+
])) : u.value && !d.value ? (B(), P("span", li, "· " + G(K(a).t("page.end")), 1)) : t.countable && !d.value ? (B(), P("button", {
|
|
2091
|
+
key: 3,
|
|
2092
|
+
type: "button",
|
|
2093
|
+
class: "dt-btn dt-btn-ghost dt-btn-xs dt-footer-count",
|
|
2094
|
+
onClick: n[0] ||= (e) => i("count")
|
|
2095
|
+
}, " · " + G(K(a).t("page.countTotal")), 1)) : N("", !0)], 64)), !t.phone && (t.updatedAt || t.freshness !== "normal") ? (B(), P(A, { key: 3 }, [
|
|
2096
|
+
n[6] ||= F("span", {
|
|
2097
|
+
class: "dt-footer-vsep",
|
|
2098
|
+
"aria-hidden": "true"
|
|
2099
|
+
}, null, -1),
|
|
2100
|
+
t.freshness === "live" ? (B(), P("span", ui, [n[5] ||= F("span", {
|
|
2101
|
+
class: "dt-live-dot",
|
|
2102
|
+
"aria-hidden": "true"
|
|
2103
|
+
}, null, -1), I(" " + G(K(a).t("toolbar.live")), 1)])) : t.freshness === "refreshing" ? (B(), P("span", di, G(K(a).t("state.updating")), 1)) : t.updatedAt ? (B(), P("span", {
|
|
2104
|
+
key: 2,
|
|
2105
|
+
class: z(["dt-footer-updated", { "is-stale": t.freshness === "stale" }])
|
|
2106
|
+
}, G(h.value), 3)) : N("", !0),
|
|
2107
|
+
t.canRefresh ? (B(), P("button", {
|
|
2108
|
+
key: 3,
|
|
2109
|
+
type: "button",
|
|
2110
|
+
class: "dt-icon-btn-sm",
|
|
2111
|
+
"aria-label": K(a).t("toolbar.refresh"),
|
|
2112
|
+
"data-dt-tip": `${K(a).t("toolbar.refresh")} · R`,
|
|
2113
|
+
onClick: n[1] ||= (e) => i("refresh")
|
|
2114
|
+
}, [L(K(ze), {
|
|
2115
|
+
size: 14,
|
|
2116
|
+
class: z({ "dt-spin": t.freshness === "refreshing" }),
|
|
2117
|
+
"aria-hidden": "true"
|
|
2118
|
+
}, null, 8, ["class"])], 8, fi)) : N("", !0)
|
|
2119
|
+
], 64)) : N("", !0)]), F("div", pi, [
|
|
2120
|
+
t.phone ? N("", !0) : (B(), P("label", mi, [F("span", hi, G(K(a).t("page.perPage")), 1), F("span", gi, [F("select", {
|
|
2121
|
+
value: t.page.size,
|
|
2122
|
+
disabled: t.busy,
|
|
2123
|
+
onChange: n[2] ||= (e) => i("page-size", Number(e.target.value))
|
|
2124
|
+
}, [(B(!0), P(A, null, H(t.pageSizes, (e) => (B(), P("option", {
|
|
2125
|
+
key: e,
|
|
2126
|
+
value: e
|
|
2127
|
+
}, G(e), 9, vi))), 128))], 40, _i), L(K(Ve), {
|
|
2128
|
+
size: 12,
|
|
2129
|
+
"aria-hidden": "true"
|
|
2130
|
+
})])])),
|
|
2131
|
+
t.phone ? N("", !0) : (B(), P("span", yi)),
|
|
2132
|
+
F("button", {
|
|
2133
|
+
type: "button",
|
|
2134
|
+
class: "dt-btn dt-btn-sm has-icon dt-footer-prev",
|
|
2135
|
+
"aria-label": t.phone ? K(a).t("page.previous") : void 0,
|
|
2136
|
+
disabled: !p.value,
|
|
2137
|
+
onClick: n[3] ||= (e) => i("page", t.page.number - 1)
|
|
2138
|
+
}, [L(K(He), {
|
|
2139
|
+
size: t.phone ? 18 : 14,
|
|
2140
|
+
"aria-hidden": "true"
|
|
2141
|
+
}, null, 8, ["size"]), F("span", null, G(K(a).t("page.previous")), 1)], 8, bi),
|
|
2142
|
+
F("button", {
|
|
2143
|
+
type: "button",
|
|
2144
|
+
class: "dt-btn dt-btn-sm dt-footer-next",
|
|
2145
|
+
"aria-label": t.phone ? K(a).t("page.next") : void 0,
|
|
2146
|
+
disabled: !m.value,
|
|
2147
|
+
onClick: n[4] ||= (e) => i("page", t.page.number + 1)
|
|
2148
|
+
}, [F("span", null, G(K(a).t("page.next")), 1), L(K(Ue), {
|
|
2149
|
+
size: t.phone ? 18 : 14,
|
|
2150
|
+
"aria-hidden": "true"
|
|
2151
|
+
}, null, 8, ["size"])], 8, xi)
|
|
2152
|
+
])], 8, ti));
|
|
2153
|
+
}
|
|
2154
|
+
}), Ci = ct({
|
|
2155
|
+
rowSortingFeature: st,
|
|
2156
|
+
sortedRowModel: tt(),
|
|
2157
|
+
columnFilteringFeature: Y,
|
|
2158
|
+
globalFilteringFeature: rt,
|
|
2159
|
+
filteredRowModel: $e(),
|
|
2160
|
+
rowPaginationFeature: at,
|
|
2161
|
+
paginatedRowModel: et(),
|
|
2162
|
+
rowSelectionFeature: ot,
|
|
2163
|
+
rowExpandingFeature: it
|
|
2164
|
+
}), wi = (e) => e == null || e === "", Ti = (e) => e.searchable ?? a[e.type].searchable;
|
|
2165
|
+
function Ei(e) {
|
|
2166
|
+
let t = j(() => ke(e.columns)), n = j(() => ke(e.locale)), r = j(() => ke(e.mode) === "server"), i = j(() => t.value.map((e) => {
|
|
2167
|
+
let t = e.id, r = ce(e, n.value);
|
|
2168
|
+
return {
|
|
2169
|
+
id: t,
|
|
2170
|
+
accessorFn: e.accessor ?? ((e) => ee(e, t)),
|
|
2171
|
+
enableSorting: e.sortable ?? a[e.type].sortable,
|
|
2172
|
+
enableGlobalFilter: Ti(e),
|
|
2173
|
+
enableColumnFilter: e.filterable ?? a[e.type].filterable,
|
|
2174
|
+
filterFn: (e, t, r) => u(r, e.getValue(t), { locale: n.value }),
|
|
2175
|
+
sortFn: (e, t, n) => r(e.getValue(n), t.getValue(n)),
|
|
2176
|
+
sortUndefined: 1
|
|
2177
|
+
};
|
|
2178
|
+
})), o = j(() => e.search.value.trim().toLocaleLowerCase(n.value)), s = j(() => ({
|
|
2179
|
+
sorting: e.sort.value.map((e) => ({
|
|
2180
|
+
id: e.column,
|
|
2181
|
+
desc: e.dir === "desc"
|
|
2182
|
+
})),
|
|
2183
|
+
pagination: {
|
|
2184
|
+
pageIndex: e.page.value.number - 1,
|
|
2185
|
+
pageSize: e.page.value.size
|
|
2186
|
+
},
|
|
2187
|
+
globalFilter: o.value,
|
|
2188
|
+
columnFilters: (e.filters?.value ?? []).map((e) => ({
|
|
2189
|
+
id: e.column,
|
|
2190
|
+
value: e
|
|
2191
|
+
})),
|
|
2192
|
+
rowSelection: e.rowSelection?.value ?? {},
|
|
2193
|
+
expanded: e.expanded?.value ?? {}
|
|
2194
|
+
})), c = j(() => new Set(t.value.filter(Ti).map((e) => e.id))), l = lt({
|
|
2195
|
+
features: Ci,
|
|
2196
|
+
columns: i,
|
|
2197
|
+
data: j(() => ke(e.rows)),
|
|
2198
|
+
getRowId: (t) => String(ee(t, ke(e.rowKey))),
|
|
2199
|
+
state: s,
|
|
2200
|
+
manualSorting: r,
|
|
2201
|
+
manualFiltering: r,
|
|
2202
|
+
manualPagination: r,
|
|
2203
|
+
autoResetPageIndex: !1,
|
|
2204
|
+
enableSortingRemoval: !0,
|
|
2205
|
+
maxMultiSortColCount: 3,
|
|
2206
|
+
enableRowSelection: j(() => ke(e.selectable) ?? !1),
|
|
2207
|
+
enableExpanding: j(() => !!e.expanded),
|
|
2208
|
+
getRowCanExpand: (t) => ke(e.canExpand)?.(t.original) ?? !0,
|
|
2209
|
+
getColumnCanGlobalFilter: (e) => c.value.has(e.id),
|
|
2210
|
+
globalFilterFn: (e, t, r) => {
|
|
2211
|
+
let i = e.getValue(t);
|
|
2212
|
+
return !wi(i) && String(i).toLocaleLowerCase(n.value).includes(r);
|
|
2213
|
+
},
|
|
2214
|
+
onSortingChange: () => {},
|
|
2215
|
+
onPaginationChange: () => {},
|
|
2216
|
+
onGlobalFilterChange: () => {},
|
|
2217
|
+
onColumnFiltersChange: () => {},
|
|
2218
|
+
onRowSelectionChange: (t) => {
|
|
2219
|
+
e.rowSelection && (e.rowSelection.value = nt(t, e.rowSelection.value));
|
|
2220
|
+
},
|
|
2221
|
+
onExpandedChange: (t) => {
|
|
2222
|
+
if (!e.expanded) return;
|
|
2223
|
+
let n = nt(t, e.expanded.value);
|
|
2224
|
+
n !== !0 && (e.expanded.value = n);
|
|
2225
|
+
}
|
|
2226
|
+
}), d = j(() => r.value ? ke(e.rows) : l.getRowModel().rows.map((e) => e.original)), f = j(() => r.value ? void 0 : l.getPrePaginatedRowModel().rows.length), p = j(() => r.value ? ke(e.hasMore) ?? !1 : e.page.value.number * e.page.value.size < (f.value ?? 0)), m = j(() => e.page.value.number > 1), h = (t, n) => {
|
|
2227
|
+
let r = e.sort.value, i = r.findIndex((e) => e.column === t), a = i >= 0 ? r[i] : null, o = a ? a.dir === "asc" ? {
|
|
2228
|
+
column: t,
|
|
2229
|
+
dir: "desc"
|
|
2230
|
+
} : null : {
|
|
2231
|
+
column: t,
|
|
2232
|
+
dir: "asc"
|
|
2233
|
+
};
|
|
2234
|
+
if (!n) {
|
|
2235
|
+
e.sort.value = o ? [o] : [];
|
|
2236
|
+
return;
|
|
2237
|
+
}
|
|
2238
|
+
let s = r.filter((e) => e.column !== t);
|
|
2239
|
+
o ? i >= 0 ? e.sort.value = r.map((e) => e.column === t ? o : e) : e.sort.value = [...s, o].slice(-3) : e.sort.value = s;
|
|
2240
|
+
}, g = (t, n) => {
|
|
2241
|
+
e.sort.value = n ? [{
|
|
2242
|
+
column: t,
|
|
2243
|
+
dir: n
|
|
2244
|
+
}] : e.sort.value.filter((e) => e.column !== t);
|
|
2245
|
+
}, te = (t) => String(ee(t, ke(e.rowKey)));
|
|
2246
|
+
return {
|
|
2247
|
+
rows: d,
|
|
2248
|
+
total: f,
|
|
2249
|
+
canNext: p,
|
|
2250
|
+
canPrev: m,
|
|
2251
|
+
toggleSort: h,
|
|
2252
|
+
setSort: g,
|
|
2253
|
+
rowId: te,
|
|
2254
|
+
selectedRows: j(() => {
|
|
2255
|
+
let t = e.rowSelection?.value ?? {};
|
|
2256
|
+
return d.value.filter((e) => t[te(e)]);
|
|
2257
|
+
}),
|
|
2258
|
+
toggleAllPage: (e) => l.toggleAllPageRowsSelected(e)
|
|
2259
|
+
};
|
|
2260
|
+
}
|
|
2261
|
+
//#endregion
|
|
2262
|
+
//#region src/list/useRequest.ts
|
|
2263
|
+
var Di = 1e4, Oi = 400;
|
|
2264
|
+
function ki(e) {
|
|
2265
|
+
let t = V(!1), n = V(null), r = Ee(null), i = V(null), a = V(!1), o = null, s, c, l = /* @__PURE__ */ new Set(), u = () => {
|
|
2266
|
+
t.value = !1, a.value = !1, clearTimeout(s);
|
|
2267
|
+
}, d = (r) => {
|
|
2268
|
+
o?.abort(), o = new AbortController();
|
|
2269
|
+
let i = e.query();
|
|
2270
|
+
l = new Set(i.fields), n.value = r, t.value = !0, a.value = !1, clearTimeout(s), s = setTimeout(() => a.value = t.value, Di), e.emit({
|
|
2271
|
+
query: i,
|
|
2272
|
+
reason: r,
|
|
2273
|
+
signal: o.signal
|
|
2274
|
+
});
|
|
2275
|
+
}, f = () => e.mode() === "server", p = j(() => {
|
|
2276
|
+
let t = e.query();
|
|
2277
|
+
return JSON.stringify([
|
|
2278
|
+
t.search,
|
|
2279
|
+
t.filters,
|
|
2280
|
+
t.sort
|
|
2281
|
+
]);
|
|
2282
|
+
}), m = j(() => JSON.stringify(e.query().page)), h = j(() => e.query().fields.join("\0"));
|
|
2283
|
+
return q([p, m], ([e], [t]) => {
|
|
2284
|
+
f() && d(e === t ? "page" : "query");
|
|
2285
|
+
}), q(h, () => {
|
|
2286
|
+
f() && e.requestOnColumnChange() && (e.query().fields.every((e) => l.has(e)) || (clearTimeout(c), c = setTimeout(() => d("columns"), Oi)));
|
|
2287
|
+
}), q(e.rows, (t) => {
|
|
2288
|
+
r.value = {
|
|
2289
|
+
rows: t,
|
|
2290
|
+
hasMore: e.hasMore() ?? !1,
|
|
2291
|
+
page: e.query().page
|
|
2292
|
+
}, i.value = /* @__PURE__ */ new Date(), u();
|
|
2293
|
+
}), q(e.error, (e) => {
|
|
2294
|
+
e && u();
|
|
2295
|
+
}), q(e.loading, (e, t) => {
|
|
2296
|
+
t && !e && u();
|
|
2297
|
+
}), we(() => {
|
|
2298
|
+
f() ? d("initial") : (r.value = {
|
|
2299
|
+
rows: e.rows(),
|
|
2300
|
+
hasMore: !1,
|
|
2301
|
+
page: e.query().page
|
|
2302
|
+
}, i.value = /* @__PURE__ */ new Date());
|
|
2303
|
+
}), Ce(() => {
|
|
2304
|
+
o?.abort(), clearTimeout(s), clearTimeout(c);
|
|
2305
|
+
}), {
|
|
2306
|
+
pending: t,
|
|
2307
|
+
reason: n,
|
|
2308
|
+
snapshot: r,
|
|
2309
|
+
updatedAt: i,
|
|
2310
|
+
stillLoading: a,
|
|
2311
|
+
errorKind: j(() => {
|
|
2312
|
+
if (!e.error()) return null;
|
|
2313
|
+
let t = n.value;
|
|
2314
|
+
return (t === "refresh" || t === "columns" || t === null) && (r.value?.rows.length ?? 0) > 0 ? "stale" : "error";
|
|
2315
|
+
}),
|
|
2316
|
+
refresh: () => {
|
|
2317
|
+
e.hasListener && d("refresh");
|
|
2318
|
+
},
|
|
2319
|
+
retry: () => {
|
|
2320
|
+
e.hasListener && d(n.value ?? "refresh");
|
|
2321
|
+
}
|
|
2322
|
+
};
|
|
2323
|
+
}
|
|
2324
|
+
//#endregion
|
|
2325
|
+
//#region src/list/DataTable.vue?vue&type=script&setup=true&lang.ts
|
|
2326
|
+
var Ai = ["data-density"], ji = ["aria-label"], Mi = {
|
|
2327
|
+
key: 0,
|
|
2328
|
+
class: "dt-counter"
|
|
2329
|
+
}, Ni = ["aria-label"], Pi = { key: 0 }, Fi = {
|
|
2330
|
+
key: 1,
|
|
2331
|
+
class: "dt-counter"
|
|
2332
|
+
}, Ii = {
|
|
2333
|
+
type: "button",
|
|
2334
|
+
class: "dt-btn dt-btn-ghost dt-btn-sm has-icon dt-filter-add dt-filter-trigger"
|
|
2335
|
+
}, Li = {
|
|
2336
|
+
key: 4,
|
|
2337
|
+
class: "dt-strip",
|
|
2338
|
+
role: "status"
|
|
2339
|
+
}, Ri = ["disabled"], zi = ["disabled"], Bi = { class: "dt-state-id" }, Vi = { class: "dt-state-code" }, Hi = {
|
|
2340
|
+
class: "dt-sr-only",
|
|
2341
|
+
"aria-live": "polite"
|
|
2342
|
+
}, Ui = {
|
|
2343
|
+
class: "dt-sr-only",
|
|
2344
|
+
"aria-live": "assertive"
|
|
2345
|
+
}, Wi = /* @__PURE__ */ R({
|
|
2346
|
+
__name: "DataTable",
|
|
2347
|
+
props: {
|
|
2348
|
+
tableId: {},
|
|
2349
|
+
columns: {},
|
|
2350
|
+
rows: {},
|
|
2351
|
+
rowKey: { default: "id" },
|
|
2352
|
+
density: {},
|
|
2353
|
+
entityName: {},
|
|
2354
|
+
shortcuts: {
|
|
2355
|
+
type: Boolean,
|
|
2356
|
+
default: !0
|
|
2357
|
+
},
|
|
2358
|
+
mode: { default: "client" },
|
|
2359
|
+
loading: { type: Boolean },
|
|
2360
|
+
error: { type: [
|
|
2361
|
+
Boolean,
|
|
2362
|
+
String,
|
|
2363
|
+
Object
|
|
2364
|
+
] },
|
|
2365
|
+
hasMore: { type: Boolean },
|
|
2366
|
+
total: {},
|
|
2367
|
+
countable: {
|
|
2368
|
+
type: Boolean,
|
|
2369
|
+
default: !1
|
|
2370
|
+
},
|
|
2371
|
+
fields: {},
|
|
2372
|
+
requestOnColumnChange: {
|
|
2373
|
+
type: Boolean,
|
|
2374
|
+
default: !0
|
|
2375
|
+
},
|
|
2376
|
+
toolbar: {
|
|
2377
|
+
type: [String, Boolean],
|
|
2378
|
+
default: "auto"
|
|
2379
|
+
},
|
|
2380
|
+
searchPlaceholder: {},
|
|
2381
|
+
pageSize: { default: 100 },
|
|
2382
|
+
pageSizes: { default: () => [
|
|
2383
|
+
50,
|
|
2384
|
+
100,
|
|
2385
|
+
250,
|
|
2386
|
+
500
|
|
2387
|
+
] },
|
|
2388
|
+
autoRefresh: {},
|
|
2389
|
+
views: { default: () => [] },
|
|
2390
|
+
selectable: {
|
|
2391
|
+
type: Boolean,
|
|
2392
|
+
default: !1
|
|
2393
|
+
},
|
|
2394
|
+
selectionBar: { default: "floating" },
|
|
2395
|
+
bulkActions: {},
|
|
2396
|
+
rowActions: {},
|
|
2397
|
+
rowClick: { default: "none" },
|
|
2398
|
+
expand: {
|
|
2399
|
+
type: [Boolean, Object],
|
|
2400
|
+
default: !1
|
|
2401
|
+
},
|
|
2402
|
+
rowError: {}
|
|
2403
|
+
},
|
|
2404
|
+
emits: [
|
|
2405
|
+
"request",
|
|
2406
|
+
"count",
|
|
2407
|
+
"row-click",
|
|
2408
|
+
"row-open",
|
|
2409
|
+
"selection-change",
|
|
2410
|
+
"export",
|
|
2411
|
+
"import",
|
|
2412
|
+
"print",
|
|
2413
|
+
"view-change"
|
|
2414
|
+
],
|
|
2415
|
+
setup(n, { expose: i, emit: s }) {
|
|
2416
|
+
let c = _e(() => import("./FiltersSheet-o2HaQuhq.js")), u = _e(() => import("./PhoneMoreSheet-gfkH96RR.js")), d = n, p = s, h = pe(), { i18n: _ } = h, ne = ve()?.vnode.props ?? {}, y = (e) => e in ne, ie = j(() => d.mode === "server"), b = j(() => d.entityName ?? {
|
|
2417
|
+
one: d.tableId,
|
|
2418
|
+
other: d.tableId
|
|
2419
|
+
}), ae = j(() => b.value.other), se = V(null), ce = V(1440), le = j(() => ce.value >= 1024 ? "full" : ce.value >= 640 ? "narrow" : "phone"), x = j(() => le.value === "phone"), fe;
|
|
2420
|
+
we(() => {
|
|
2421
|
+
let e = () => ce.value = se.value?.clientWidth || 1440;
|
|
2422
|
+
e(), typeof ResizeObserver < "u" && se.value && (fe = new ResizeObserver(e), fe.observe(se.value));
|
|
2423
|
+
});
|
|
2424
|
+
let S = oe(() => d.tableId, h.preferences, {
|
|
2425
|
+
density: "standard",
|
|
2426
|
+
verticalLines: !1,
|
|
2427
|
+
pageSize: d.pageSize,
|
|
2428
|
+
defaultViewId: null
|
|
2429
|
+
}), me = j(() => d.density ?? S.prefs.density), C = g({
|
|
2430
|
+
columns: () => d.columns,
|
|
2431
|
+
rows: () => d.rows,
|
|
2432
|
+
rowKey: () => d.rowKey,
|
|
2433
|
+
phone: () => x.value
|
|
2434
|
+
}), w = V(""), T = V([]), E = V({
|
|
2435
|
+
number: 1,
|
|
2436
|
+
size: S.prefs.pageSize
|
|
2437
|
+
}), D = (e) => E.value = {
|
|
2438
|
+
...E.value,
|
|
2439
|
+
number: e
|
|
2440
|
+
}, O = (e) => {
|
|
2441
|
+
e !== w.value && (w.value = e, D(1));
|
|
2442
|
+
};
|
|
2443
|
+
q(() => S.prefs.pageSize, (e) => E.value = {
|
|
2444
|
+
number: 1,
|
|
2445
|
+
size: e
|
|
2446
|
+
});
|
|
2447
|
+
let k = V([]), he = V(null), A = V(!1), R = new te(), ye = e(h.locale), Te = j(() => new Map(d.columns.map((e) => [e.id, e]))), H = (e) => Te.value.get(e)?.type ?? "string", W = j(() => k.value.filter((e) => t(e, H(e.column))).map(l)), Ee = j(() => new Set(W.value.map((e) => e.column))), Oe = j(() => d.toolbar === "auto" && d.columns.some((e) => e.filterable ?? a[e.type].filterable)), ke = (e) => (t) => e.type === "select" || e.type === "multiselect" || e.type === "user" && e.options ? m(e.options, t) : (e.type === "user" || e.type === "ajax") && e.remote ? R.label(e.id, e.remote, t) : String(t), Ae = (e) => {
|
|
2448
|
+
let t = Te.value.get(e.column);
|
|
2449
|
+
return o(e, t, {
|
|
2450
|
+
i18n: _,
|
|
2451
|
+
fmt: ye,
|
|
2452
|
+
labelOf: ke(t)
|
|
2453
|
+
});
|
|
2454
|
+
}, je = (e) => e.type === "currency" ? typeof e.currency == "string" ? [e.currency] : [...new Set(d.rows.map((t) => e.currency(t)))] : [], Me = (e) => {
|
|
2455
|
+
let t = Te.value.get(e);
|
|
2456
|
+
if (t) {
|
|
2457
|
+
if (x.value) ze.value?.show(e);
|
|
2458
|
+
else {
|
|
2459
|
+
if (!k.value.some((t) => t.column === e)) {
|
|
2460
|
+
let n = f(t);
|
|
2461
|
+
if (k.value = [...k.value, t.type === "boolean" ? {
|
|
2462
|
+
column: e,
|
|
2463
|
+
op: n,
|
|
2464
|
+
value: !0
|
|
2465
|
+
} : {
|
|
2466
|
+
column: e,
|
|
2467
|
+
op: n
|
|
2468
|
+
}], t.type === "boolean") return;
|
|
2469
|
+
}
|
|
2470
|
+
he.value = e;
|
|
2471
|
+
}
|
|
2472
|
+
}
|
|
2473
|
+
}, Ne = (e) => k.value = k.value.map((t) => t.column === e.column ? e : t), Fe = (e) => {
|
|
2474
|
+
k.value = k.value.filter((t) => t.column !== e), he.value === e && (he.value = null);
|
|
2475
|
+
}, Le = (e) => {
|
|
2476
|
+
let n = he.value;
|
|
2477
|
+
if (he.value = e, n && n !== e) {
|
|
2478
|
+
let e = k.value.find((e) => e.column === n);
|
|
2479
|
+
e && !t(e, H(n)) && Fe(n);
|
|
2480
|
+
}
|
|
2481
|
+
}, Re = () => {
|
|
2482
|
+
k.value = [], he.value = null;
|
|
2483
|
+
}, ze = V(null), Be = (e, t) => {
|
|
2484
|
+
k.value = e, he.value = null, T.value = t, D(1);
|
|
2485
|
+
}, Ve = j(() => C.columns.value.map((e) => e.id)), He = j(() => {
|
|
2486
|
+
let e = /* @__PURE__ */ new Set([d.rowKey]);
|
|
2487
|
+
for (let t of C.columns.value) {
|
|
2488
|
+
t.def.accessor || e.add(t.id);
|
|
2489
|
+
for (let n of t.def.fields ?? []) e.add(n);
|
|
2490
|
+
}
|
|
2491
|
+
for (let t of d.fields ?? []) e.add(t);
|
|
2492
|
+
return [...e];
|
|
2493
|
+
}), Ue = j(() => ({
|
|
2494
|
+
search: w.value,
|
|
2495
|
+
filters: W.value,
|
|
2496
|
+
sort: T.value,
|
|
2497
|
+
page: E.value,
|
|
2498
|
+
columns: Ve.value,
|
|
2499
|
+
fields: He.value
|
|
2500
|
+
})), Ke = () => {
|
|
2501
|
+
let { search: e, filters: t, sort: n, columns: r, fields: i } = Ue.value;
|
|
2502
|
+
return {
|
|
2503
|
+
search: e,
|
|
2504
|
+
filters: t,
|
|
2505
|
+
sort: n,
|
|
2506
|
+
columns: r,
|
|
2507
|
+
fields: i
|
|
2508
|
+
};
|
|
2509
|
+
}, Je = V(""), Xe = V(""), Qe = () => ({
|
|
2510
|
+
filters: W.value,
|
|
2511
|
+
sort: T.value,
|
|
2512
|
+
columns: C.state.value
|
|
2513
|
+
}), Y = sr({
|
|
2514
|
+
tableId: () => d.tableId,
|
|
2515
|
+
system: () => d.views,
|
|
2516
|
+
adapter: h.viewsAdapter,
|
|
2517
|
+
locale: () => h.locale,
|
|
2518
|
+
defaultViewId: () => S.prefs.defaultViewId,
|
|
2519
|
+
setDefaultViewId: (e) => S.set({ defaultViewId: e }),
|
|
2520
|
+
prefsReady: S.ready,
|
|
2521
|
+
current: Qe,
|
|
2522
|
+
apply: (e) => {
|
|
2523
|
+
k.value = (e.filters ?? []).map((e) => ({ ...e })), he.value = null, T.value = e.sort ?? [], C.apply(e.columns), D(1);
|
|
2524
|
+
},
|
|
2525
|
+
onChange: (e) => {
|
|
2526
|
+
p("view-change", {
|
|
2527
|
+
id: e.id,
|
|
2528
|
+
kind: e.kind
|
|
2529
|
+
}), Je.value = _.t("sr.view", { name: e.name });
|
|
2530
|
+
}
|
|
2531
|
+
}), $e = V(!1), et = (e) => {
|
|
2532
|
+
let t = e.sort[0], n = e.sort.length > 1 ? ` +${e.sort.length - 1}` : "", r = [...e.columns.pinned.left, ...e.columns.pinned.right].map(Z).join(", ");
|
|
2533
|
+
return {
|
|
2534
|
+
filters: e.filters.map((e) => Z(e.column)).join(" · ") || _.t("common.empty"),
|
|
2535
|
+
sort: t ? `${Z(t.column)} ${t.dir === "asc" ? "↑" : "↓"}${n}` : _.t("common.empty"),
|
|
2536
|
+
columns: [_.t("views.columnsSummary", {
|
|
2537
|
+
shown: e.columns.visible.length,
|
|
2538
|
+
total: d.columns.length
|
|
2539
|
+
}), ...r ? [_.t("views.pinnedSummary", { name: r })] : []].join(" · ")
|
|
2540
|
+
};
|
|
2541
|
+
}, tt = (e) => ({
|
|
2542
|
+
filters: e.state.filters ?? [],
|
|
2543
|
+
sort: e.state.sort ?? [],
|
|
2544
|
+
columns: C.resolve(e.state.columns)
|
|
2545
|
+
}), nt = V(null), rt = j({
|
|
2546
|
+
get: () => !!nt.value,
|
|
2547
|
+
set: (e) => {
|
|
2548
|
+
e || (nt.value = null);
|
|
2549
|
+
}
|
|
2550
|
+
}), it = V(null), at = (e) => {
|
|
2551
|
+
let t = e ? tt(e) : Qe();
|
|
2552
|
+
nt.value = {
|
|
2553
|
+
mode: "create",
|
|
2554
|
+
name: e ? _.t("views.copyName", { name: e.name }) : "",
|
|
2555
|
+
state: t,
|
|
2556
|
+
summary: et(t),
|
|
2557
|
+
view: e,
|
|
2558
|
+
fromCurrent: !e
|
|
2559
|
+
};
|
|
2560
|
+
}, ot = (e) => nt.value = {
|
|
2561
|
+
mode: "rename",
|
|
2562
|
+
name: e.name,
|
|
2563
|
+
state: Qe(),
|
|
2564
|
+
summary: null,
|
|
2565
|
+
view: e,
|
|
2566
|
+
fromCurrent: !1
|
|
2567
|
+
}, st = (e) => {
|
|
2568
|
+
let t = nt.value;
|
|
2569
|
+
return ar(e, Y.all.value, h.locale, t?.mode === "rename" ? t.view?.id : void 0);
|
|
2570
|
+
}, ct = (e) => {
|
|
2571
|
+
let t = nt.value;
|
|
2572
|
+
t && (t.mode === "rename" && t.view ? Y.rename(t.view.id, e.name) : Y.create({
|
|
2573
|
+
name: e.name,
|
|
2574
|
+
state: t.state,
|
|
2575
|
+
makeDefault: e.makeDefault,
|
|
2576
|
+
fromCurrent: t.fromCurrent
|
|
2577
|
+
}));
|
|
2578
|
+
}, lt = () => {
|
|
2579
|
+
let e = it.value;
|
|
2580
|
+
e && Y.remove(e.id);
|
|
2581
|
+
}, ut = V({}), dt = V({}), ft = j(() => !!d.expand), pt = j(() => typeof d.expand == "object" ? d.expand.canExpand : void 0), mt = Ei({
|
|
2582
|
+
columns: () => d.columns,
|
|
2583
|
+
rows: () => d.rows,
|
|
2584
|
+
rowKey: () => d.rowKey,
|
|
2585
|
+
mode: () => d.mode,
|
|
2586
|
+
locale: h.locale,
|
|
2587
|
+
sort: T,
|
|
2588
|
+
filters: W,
|
|
2589
|
+
page: E,
|
|
2590
|
+
search: w,
|
|
2591
|
+
hasMore: () => d.hasMore,
|
|
2592
|
+
selectable: () => d.selectable,
|
|
2593
|
+
rowSelection: ut,
|
|
2594
|
+
expanded: dt,
|
|
2595
|
+
canExpand: () => pt.value
|
|
2596
|
+
}), X = ki({
|
|
2597
|
+
mode: () => d.mode,
|
|
2598
|
+
hasListener: y("onRequest"),
|
|
2599
|
+
query: () => Ue.value,
|
|
2600
|
+
rows: () => d.rows,
|
|
2601
|
+
hasMore: () => d.hasMore,
|
|
2602
|
+
loading: () => d.loading,
|
|
2603
|
+
error: () => d.error,
|
|
2604
|
+
requestOnColumnChange: () => d.requestOnColumnChange,
|
|
2605
|
+
emit: (e) => p("request", e)
|
|
2606
|
+
}), ht = (e, t) => {
|
|
2607
|
+
mt.toggleSort(e, t), D(1);
|
|
2608
|
+
}, gt = (e, t) => {
|
|
2609
|
+
mt.setSort(e, t), D(1);
|
|
2610
|
+
}, _t = j(() => new Map(T.value.map((e, t) => [e.column, {
|
|
2611
|
+
dir: e.dir,
|
|
2612
|
+
index: T.value.length > 1 ? t + 1 : null
|
|
2613
|
+
}]))), Z = (e) => d.columns.find((t) => t.id === e)?.header ?? e, vt = X.reason, Q = X.pending, yt = j(() => X.errorKind.value === "error" ? [] : mt.rows.value), $ = j(() => yt.value.length > 0), bt = j(() => Q.value && (vt.value === "query" || vt.value === "page")), xt = j(() => bt.value && $.value), St = V(!1), Ct;
|
|
2614
|
+
q(xt, (e) => {
|
|
2615
|
+
clearTimeout(Ct), St.value = !1, e && (Ct = setTimeout(() => St.value = !0, 400));
|
|
2616
|
+
});
|
|
2617
|
+
let wt = j(() => Q.value && !$.value || !!d.loading && !$.value && !d.error || St.value), Tt = j(() => Q.value && (vt.value === "refresh" || vt.value === "columns") || !!d.loading && $.value && !bt.value), Et = V(!1), Dt;
|
|
2618
|
+
q(Tt, (e) => {
|
|
2619
|
+
clearTimeout(Dt), Et.value = !1, e && (Dt = setTimeout(() => Et.value = !0, 150));
|
|
2620
|
+
});
|
|
2621
|
+
let Ot = j(() => bt.value || wt.value && !$.value), kt = j(() => wt.value || $.value || Q.value ? null : X.errorKind.value === "error" ? "error" : w.value || W.value.length ? "noResults" : E.value.number > 1 ? "noRowsOnPage" : "empty"), At = j(() => {
|
|
2622
|
+
let e = d.error;
|
|
2623
|
+
return typeof e == "object" && e ? e : typeof e == "string" ? { message: e } : {};
|
|
2624
|
+
}), jt = j(() => {
|
|
2625
|
+
let e = W.value.length, t = {
|
|
2626
|
+
entity: b.value,
|
|
2627
|
+
q: w.value,
|
|
2628
|
+
count: e
|
|
2629
|
+
};
|
|
2630
|
+
return w.value && e ? _.t("state.noResultsBoth", t) : w.value ? _.t("state.noResultsSearch", t) : _.t("state.noResults", t);
|
|
2631
|
+
}), Mt = (e) => e.toLocaleTimeString(h.locale, {
|
|
2632
|
+
hour: "2-digit",
|
|
2633
|
+
minute: "2-digit"
|
|
2634
|
+
}), Nt = X.snapshot, Pt = j(() => X.errorKind.value === "error" ? 0 : ie.value ? Nt.value?.rows.length ?? 0 : mt.rows.value.length), Ft = j(() => ie.value ? Nt.value?.page ?? E.value : E.value), It = j(() => ie.value ? Nt.value?.hasMore ?? !1 : mt.canNext.value), Lt = j(() => ie.value ? d.total : mt.total.value), Rt = null, zt = V(!1), Bt = V(null), Vt = () => {
|
|
2635
|
+
Rt?.abort(), Rt = new AbortController(), zt.value = !0, p("count", {
|
|
2636
|
+
query: Ke(),
|
|
2637
|
+
signal: Rt.signal
|
|
2638
|
+
});
|
|
2639
|
+
};
|
|
2640
|
+
q(() => d.total, (e) => {
|
|
2641
|
+
e !== void 0 && (zt.value = !1, Bt.value = ie.value ? /* @__PURE__ */ new Date() : null, Je.value = _.t("sr.total", {
|
|
2642
|
+
count: ye.int(e),
|
|
2643
|
+
entity: b.value
|
|
2644
|
+
}));
|
|
2645
|
+
}), q(() => JSON.stringify([
|
|
2646
|
+
w.value,
|
|
2647
|
+
T.value,
|
|
2648
|
+
W.value
|
|
2649
|
+
]), () => {
|
|
2650
|
+
Rt?.abort(), zt.value = !1, Bt.value = null;
|
|
2651
|
+
});
|
|
2652
|
+
let Ht = V(null);
|
|
2653
|
+
q(() => E.value.number, () => Ht.value?.scrollToTop());
|
|
2654
|
+
let Ut = (e) => S.set({ pageSize: e });
|
|
2655
|
+
q(() => JSON.stringify(W.value), (e, t) => {
|
|
2656
|
+
D(1), Ht.value?.scrollToTop();
|
|
2657
|
+
let n = new Map(JSON.parse(t).map((e) => [e.column, JSON.stringify(e)])), r = new Map(JSON.parse(e).map((e) => [e.column, JSON.stringify(e)]));
|
|
2658
|
+
for (let [e, t] of r) if (n.get(e) !== t) {
|
|
2659
|
+
let t = k.value.find((t) => t.column === e);
|
|
2660
|
+
if (t) {
|
|
2661
|
+
let n = Ae(t);
|
|
2662
|
+
Je.value = _.t("sr.filterAdded", { summary: `${Z(e)} ${n.text}`.trim() });
|
|
2663
|
+
}
|
|
2664
|
+
}
|
|
2665
|
+
for (let e of n.keys()) r.has(e) || (Je.value = _.t("sr.filterRemoved", { column: Z(e) }));
|
|
2666
|
+
});
|
|
2667
|
+
let Gt = V(!1), Kt;
|
|
2668
|
+
q(Gt, (e) => {
|
|
2669
|
+
clearInterval(Kt), e && d.autoRefresh && (Kt = setInterval(() => X.refresh(), d.autoRefresh * 1e3));
|
|
2670
|
+
});
|
|
2671
|
+
let qt = j(() => Gt.value ? "live" : Tt.value ? "refreshing" : X.errorKind.value === "stale" ? "stale" : "normal"), Jt = j(() => d.toolbar !== !1 && d.columns.some(Ti)), Yt = j(() => d.toolbar === "auto"), Xt = j(() => ({
|
|
2672
|
+
refresh: y("onRequest"),
|
|
2673
|
+
export: y("onExport"),
|
|
2674
|
+
import: y("onImport"),
|
|
2675
|
+
print: y("onPrint"),
|
|
2676
|
+
autoRefresh: d.autoRefresh !== void 0
|
|
2677
|
+
})), Zt = j(() => d.toolbar === "auto" && Object.values(Xt.value).some(Boolean)), Qt = j(() => d.searchPlaceholder ?? _.t("toolbar.search", { entity: b.value })), $t = V(null), en = j(() => ({
|
|
2678
|
+
density: me.value,
|
|
2679
|
+
verticalLines: S.prefs.verticalLines,
|
|
2680
|
+
columns: C.panel.value,
|
|
2681
|
+
counts: C.counts.value,
|
|
2682
|
+
sort: T.value,
|
|
2683
|
+
persistent: S.persistent
|
|
2684
|
+
})), tn = {
|
|
2685
|
+
"update:density": (e) => S.set({ density: e }),
|
|
2686
|
+
"column-visible": (e, t) => C.setVisible(e, t),
|
|
2687
|
+
"column-move": (e, t) => C.move(e, t),
|
|
2688
|
+
"columns-all": (e) => {
|
|
2689
|
+
for (let t of C.panel.value) !t.pinned && t.canHide && C.setVisible(t.id, e);
|
|
2690
|
+
},
|
|
2691
|
+
"columns-reset": () => C.reset(Y.active.value?.state.columns),
|
|
2692
|
+
"sort-dir": (e, t) => {
|
|
2693
|
+
T.value = T.value.map((n) => n.column === e ? {
|
|
2694
|
+
column: e,
|
|
2695
|
+
dir: t
|
|
2696
|
+
} : n), D(1);
|
|
2697
|
+
},
|
|
2698
|
+
"sort-remove": (e) => gt(e, null),
|
|
2699
|
+
"sort-clear": () => {
|
|
2700
|
+
T.value = [], D(1);
|
|
2701
|
+
},
|
|
2702
|
+
reset: () => S.reset()
|
|
2703
|
+
}, nn = (e) => p("export", {
|
|
2704
|
+
format: e,
|
|
2705
|
+
query: Ke(),
|
|
2706
|
+
selection: mt.selectedRows.value,
|
|
2707
|
+
visibleColumns: Ve.value
|
|
2708
|
+
}), rn = j(() => d.columns.find((e) => e.primary)), an = (e) => rn.value?.href?.(e), on = (e) => {
|
|
2709
|
+
let t = rn.value, n = t ? t.accessor ? t.accessor(e) : ee(e, t.id) : ee(e, d.rowKey);
|
|
2710
|
+
return n == null ? "" : String(n);
|
|
2711
|
+
}, sn = j(() => !!d.rowActions?.length || !!rn.value), cn = mt.selectedRows, ln = () => ut.value = {}, un = (e, t) => {
|
|
2712
|
+
let n = { ...ut.value };
|
|
2713
|
+
for (let r of e) t ? n[r] = !0 : delete n[r];
|
|
2714
|
+
ut.value = n;
|
|
2715
|
+
};
|
|
2716
|
+
q(() => JSON.stringify([
|
|
2717
|
+
w.value,
|
|
2718
|
+
W.value,
|
|
2719
|
+
T.value,
|
|
2720
|
+
E.value
|
|
2721
|
+
]), () => {
|
|
2722
|
+
ut.value = {}, dt.value = {}, Ht.value?.measure();
|
|
2723
|
+
}), q(() => d.rows, (e) => {
|
|
2724
|
+
let t = new Set(e.map(mt.rowId)), n = (e) => Object.fromEntries(Object.entries(e).filter(([e]) => t.has(e)));
|
|
2725
|
+
Object.keys(ut.value).some((e) => !t.has(e)) && (ut.value = n(ut.value)), Object.keys(dt.value).some((e) => !t.has(e)) && (dt.value = n(dt.value));
|
|
2726
|
+
}), q(cn, (e) => {
|
|
2727
|
+
p("selection-change", e), e.length && (Je.value = _.t("selection.selected", { count: e.length }));
|
|
2728
|
+
});
|
|
2729
|
+
let dn = (e, t) => {
|
|
2730
|
+
let n = { ...dt.value };
|
|
2731
|
+
t ? n[e] = !0 : delete n[e], dt.value = n, t && xe(() => {
|
|
2732
|
+
let t = d.rows.find((t) => mt.rowId(t) === e), n = [...(Ht.value?.$el)?.querySelectorAll(".dt-subrow") ?? []].find((t) => t.id.endsWith(`-sub-${e}`));
|
|
2733
|
+
t && (Je.value = _.t("sr.expanded", {
|
|
2734
|
+
label: on(t),
|
|
2735
|
+
count: n ? n.querySelectorAll("[role=\"row\"], tr").length : 0
|
|
2736
|
+
}));
|
|
2737
|
+
});
|
|
2738
|
+
}, fn = (e, t) => {
|
|
2739
|
+
if (p("row-click", {
|
|
2740
|
+
row: e,
|
|
2741
|
+
event: t
|
|
2742
|
+
}), d.rowClick === "open") t.target?.closest(".dt-row")?.querySelector(".dt-cell.is-primary a.dt-link")?.click();
|
|
2743
|
+
else if (d.rowClick === "expand" && ft.value && (pt.value?.(e) ?? !0)) {
|
|
2744
|
+
let t = mt.rowId(e);
|
|
2745
|
+
dn(t, !dt.value[t]);
|
|
2746
|
+
}
|
|
2747
|
+
}, mn = (e, t) => p("row-open", {
|
|
2748
|
+
row: e,
|
|
2749
|
+
href: an(e) ?? "",
|
|
2750
|
+
event: t
|
|
2751
|
+
}), hn = V(null), gn, _n = (e) => {
|
|
2752
|
+
navigator.clipboard?.writeText(on(e)), hn.value = _.t("cell.copied"), clearTimeout(gn), gn = setTimeout(() => hn.value = null, 2e3);
|
|
2753
|
+
}, vn = () => p("print", {
|
|
2754
|
+
query: Ke(),
|
|
2755
|
+
visibleColumns: Ve.value
|
|
2756
|
+
}), yn = () => void navigator.clipboard?.writeText(At.value.id ?? ""), bn = (e) => {
|
|
2757
|
+
if (e.defaultPrevented) return;
|
|
2758
|
+
let t = e.target instanceof Element ? e.target : null;
|
|
2759
|
+
if (e.key === "Escape") {
|
|
2760
|
+
let n = !!t?.closest("[role=\"menu\"], [role=\"dialog\"], [role=\"alertdialog\"], [role=\"listbox\"], .dt-pop");
|
|
2761
|
+
!e.defaultPrevented && !n && cn.value.length && !(t && r(t)) && ln();
|
|
2762
|
+
} else if (e.altKey && !e.ctrlKey && !e.metaKey && (e.key === "ArrowLeft" || e.key === "ArrowRight")) {
|
|
2763
|
+
if (Ot.value) return;
|
|
2764
|
+
let t = e.key === "ArrowLeft" ? E.value.number - 1 : E.value.number + 1;
|
|
2765
|
+
t >= 1 && (e.key === "ArrowLeft" || It.value) && (e.preventDefault(), D(t));
|
|
2766
|
+
} else if ((e.metaKey || e.ctrlKey) && !e.altKey && !e.shiftKey && (e.key === "s" || e.key === "S")) {
|
|
2767
|
+
if (!d.shortcuts || !Y.edited.value || !h.viewsAdapter || nt.value) return;
|
|
2768
|
+
e.preventDefault(), Y.writable(Y.active.value) ? Y.saveChanges() : at();
|
|
2769
|
+
} else !d.shortcuts || e.ctrlKey || e.metaKey || e.altKey || t && r(t) || (e.key === "/" && Jt.value ? (e.preventDefault(), $t.value?.focusSearch()) : (e.key === "f" || e.key === "F") && Oe.value ? (e.preventDefault(), x.value ? ze.value?.show() : A.value = !0) : (e.key === "r" || e.key === "R") && y("onRequest") ? (e.preventDefault(), X.refresh()) : (e.key === "v" || e.key === "V") && Y.hasViews.value && d.toolbar === "auto" && (e.preventDefault(), $e.value = !0));
|
|
2770
|
+
};
|
|
2771
|
+
we(() => window.addEventListener("keydown", bn)), Ce(() => {
|
|
2772
|
+
window.removeEventListener("keydown", bn), fe?.disconnect(), clearTimeout(Ct), clearTimeout(Dt), clearInterval(Kt), clearTimeout(gn), Rt?.abort();
|
|
2773
|
+
}), q(() => yt.value.length, (e) => {
|
|
2774
|
+
Q.value || (Je.value = _.t("sr.loaded", { count: e }));
|
|
2775
|
+
}), q(X.updatedAt, () => Je.value = _.t("sr.loaded", { count: yt.value.length })), q(T, (e) => {
|
|
2776
|
+
let t = e[0];
|
|
2777
|
+
t && (Je.value = _.t("sr.sorted", {
|
|
2778
|
+
column: Z(t.column),
|
|
2779
|
+
dir: _.t(t.dir === "asc" ? "sr.asc" : "sr.desc")
|
|
2780
|
+
}));
|
|
2781
|
+
}), q(X.errorKind, (e) => {
|
|
2782
|
+
e === "error" && (Xe.value = `${_.t("state.errorTitle", { entity: b.value })} ${_.t("state.tryAgain")}`);
|
|
2783
|
+
});
|
|
2784
|
+
let xn = de(se);
|
|
2785
|
+
return i({
|
|
2786
|
+
refresh: X.refresh,
|
|
2787
|
+
clearSelection: ln
|
|
2788
|
+
}), (e, t) => (B(), P("div", {
|
|
2789
|
+
ref_key: "rootEl",
|
|
2790
|
+
ref: se,
|
|
2791
|
+
class: z(["dt dt-list", { "is-phone": x.value }]),
|
|
2792
|
+
"data-density": me.value
|
|
2793
|
+
}, [
|
|
2794
|
+
n.selectionBar === "toolbar" && K(cn).length && n.toolbar !== !1 ? (B(), M(ei, {
|
|
2795
|
+
key: 0,
|
|
2796
|
+
variant: "toolbar",
|
|
2797
|
+
rows: K(cn),
|
|
2798
|
+
actions: n.bulkActions ?? [],
|
|
2799
|
+
onClear: ln
|
|
2800
|
+
}, {
|
|
2801
|
+
default: J(() => [e.$slots["selection-actions"] ? U(e.$slots, "selection-actions", {
|
|
2802
|
+
rows: K(cn),
|
|
2803
|
+
clear: ln
|
|
2804
|
+
}, void 0, void 0, 0) : N("", !0)]),
|
|
2805
|
+
_: 3
|
|
2806
|
+
}, 8, ["rows", "actions"])) : n.toolbar === !1 ? N("", !0) : (B(), M($n, {
|
|
2807
|
+
key: 1,
|
|
2808
|
+
ref_key: "toolbarRef",
|
|
2809
|
+
ref: $t,
|
|
2810
|
+
size: le.value,
|
|
2811
|
+
search: Jt.value ? w.value : null,
|
|
2812
|
+
"search-placeholder": Qt.value,
|
|
2813
|
+
"has-filter": Oe.value,
|
|
2814
|
+
"has-display": Yt.value,
|
|
2815
|
+
"has-more": Zt.value,
|
|
2816
|
+
"onUpdate:search": O
|
|
2817
|
+
}, ge({
|
|
2818
|
+
filter: J(({ iconOnly: e, phone: r }) => [r ? (B(), P("button", {
|
|
2819
|
+
key: 0,
|
|
2820
|
+
type: "button",
|
|
2821
|
+
class: z(["dt-btn dt-btn-icon dt-filter-trigger", { "is-active": W.value.length }]),
|
|
2822
|
+
"aria-label": K(_).t("toolbar.filter"),
|
|
2823
|
+
onClick: t[7] ||= (e) => ze.value?.show()
|
|
2824
|
+
}, [L(K(qe), {
|
|
2825
|
+
size: 20,
|
|
2826
|
+
"aria-hidden": "true"
|
|
2827
|
+
}), W.value.length ? (B(), P("span", Mi, G(W.value.length), 1)) : N("", !0)], 10, ji)) : (B(), M(Wt, {
|
|
2828
|
+
key: 1,
|
|
2829
|
+
open: A.value,
|
|
2830
|
+
"onUpdate:open": t[8] ||= (e) => A.value = e,
|
|
2831
|
+
columns: n.columns,
|
|
2832
|
+
chips: k.value,
|
|
2833
|
+
onPick: Me
|
|
2834
|
+
}, {
|
|
2835
|
+
trigger: J(() => [F("button", {
|
|
2836
|
+
type: "button",
|
|
2837
|
+
class: z(["dt-btn has-icon dt-filter-trigger", {
|
|
2838
|
+
"is-active": W.value.length,
|
|
2839
|
+
"dt-btn-icon": e && !W.value.length
|
|
2840
|
+
}]),
|
|
2841
|
+
"aria-label": e ? K(_).t("toolbar.filter") : void 0
|
|
2842
|
+
}, [
|
|
2843
|
+
L(K(qe), {
|
|
2844
|
+
size: 16,
|
|
2845
|
+
"aria-hidden": "true"
|
|
2846
|
+
}),
|
|
2847
|
+
e ? N("", !0) : (B(), P("span", Pi, G(K(_).t("toolbar.filter")), 1)),
|
|
2848
|
+
W.value.length ? (B(), P("span", Fi, G(W.value.length), 1)) : N("", !0)
|
|
2849
|
+
], 10, Ni)]),
|
|
2850
|
+
_: 2
|
|
2851
|
+
}, 1032, [
|
|
2852
|
+
"open",
|
|
2853
|
+
"columns",
|
|
2854
|
+
"chips"
|
|
2855
|
+
]))]),
|
|
2856
|
+
display: J(({ iconOnly: e }) => [L(v, be(en.value, { "icon-only": e }, De(tn), { "onUpdate:verticalLines": t[9] ||= (e) => K(S).set({ verticalLines: e }) }), null, 16, ["icon-only"])]),
|
|
2857
|
+
more: J(({ phone: e }) => [e ? (B(), M(K(u), be({ key: 0 }, Xt.value, {
|
|
2858
|
+
density: me.value,
|
|
2859
|
+
columns: K(C).panel.value,
|
|
2860
|
+
counts: K(C).counts.value,
|
|
2861
|
+
sort: T.value,
|
|
2862
|
+
persistent: K(S).persistent,
|
|
2863
|
+
"auto-refresh-on": Gt.value
|
|
2864
|
+
}, De(tn), {
|
|
2865
|
+
"onUpdate:autoRefreshOn": t[10] ||= (e) => Gt.value = e,
|
|
2866
|
+
onRefresh: t[11] ||= (e) => K(X).refresh(),
|
|
2867
|
+
onExport: nn,
|
|
2868
|
+
onImport: t[12] ||= (e) => p("import"),
|
|
2869
|
+
onPrint: vn
|
|
2870
|
+
}), null, 16, [
|
|
2871
|
+
"density",
|
|
2872
|
+
"columns",
|
|
2873
|
+
"counts",
|
|
2874
|
+
"sort",
|
|
2875
|
+
"persistent",
|
|
2876
|
+
"auto-refresh-on"
|
|
2877
|
+
])) : (B(), M(Xn, be({ key: 1 }, Xt.value, {
|
|
2878
|
+
"auto-refresh-on": Gt.value,
|
|
2879
|
+
"onUpdate:autoRefreshOn": t[13] ||= (e) => Gt.value = e,
|
|
2880
|
+
onRefresh: t[14] ||= (e) => K(X).refresh(),
|
|
2881
|
+
onExport: nn,
|
|
2882
|
+
onImport: t[15] ||= (e) => p("import"),
|
|
2883
|
+
onPrint: vn
|
|
2884
|
+
}), null, 16, ["auto-refresh-on"]))]),
|
|
2885
|
+
_: 2
|
|
2886
|
+
}, [K(Y).hasViews.value && n.toolbar === "auto" ? {
|
|
2887
|
+
name: "view",
|
|
2888
|
+
fn: J(() => [L(zr, {
|
|
2889
|
+
open: $e.value,
|
|
2890
|
+
"onUpdate:open": t[0] ||= (e) => $e.value = e,
|
|
2891
|
+
sections: K(Y).sections.value,
|
|
2892
|
+
active: K(Y).active.value,
|
|
2893
|
+
edited: K(Y).edited.value,
|
|
2894
|
+
"has-draft": K(Y).hasDraft,
|
|
2895
|
+
"default-id": K(S).prefs.defaultViewId,
|
|
2896
|
+
"can-save": !!K(h).viewsAdapter,
|
|
2897
|
+
"can-write": K(Y).writable(K(Y).active.value),
|
|
2898
|
+
sheet: x.value,
|
|
2899
|
+
onSelect: K(Y).select,
|
|
2900
|
+
onSaveChanges: t[1] ||= (e) => K(Y).saveChanges(),
|
|
2901
|
+
onSaveAs: t[2] ||= (e) => at(),
|
|
2902
|
+
onDiscard: t[3] ||= (e) => K(Y).discard(),
|
|
2903
|
+
onNew: t[4] ||= (e) => at(),
|
|
2904
|
+
onRename: ot,
|
|
2905
|
+
onDuplicate: at,
|
|
2906
|
+
onSetDefault: t[5] ||= (e) => K(S).set({ defaultViewId: e }),
|
|
2907
|
+
onDelete: t[6] ||= (e) => it.value = e
|
|
2908
|
+
}, null, 8, [
|
|
2909
|
+
"open",
|
|
2910
|
+
"sections",
|
|
2911
|
+
"active",
|
|
2912
|
+
"edited",
|
|
2913
|
+
"has-draft",
|
|
2914
|
+
"default-id",
|
|
2915
|
+
"can-save",
|
|
2916
|
+
"can-write",
|
|
2917
|
+
"sheet",
|
|
2918
|
+
"onSelect"
|
|
2919
|
+
])]),
|
|
2920
|
+
key: "0"
|
|
2921
|
+
} : void 0, e.$slots["toolbar-end"] ? {
|
|
2922
|
+
name: "end",
|
|
2923
|
+
fn: J(({ compact: t }) => [U(e.$slots, "toolbar-end", { compact: t })]),
|
|
2924
|
+
key: "1"
|
|
2925
|
+
} : void 0]), 1032, [
|
|
2926
|
+
"size",
|
|
2927
|
+
"search",
|
|
2928
|
+
"search-placeholder",
|
|
2929
|
+
"has-filter",
|
|
2930
|
+
"has-display",
|
|
2931
|
+
"has-more"
|
|
2932
|
+
])),
|
|
2933
|
+
k.value.length ? (B(), M(pn, {
|
|
2934
|
+
key: 2,
|
|
2935
|
+
chips: k.value,
|
|
2936
|
+
defs: Te.value,
|
|
2937
|
+
editing: he.value,
|
|
2938
|
+
rows: n.rows,
|
|
2939
|
+
labels: K(R),
|
|
2940
|
+
"summary-of": Ae,
|
|
2941
|
+
"currencies-of": je,
|
|
2942
|
+
phone: x.value,
|
|
2943
|
+
onOpen: t[16] ||= (e) => ze.value?.show(e),
|
|
2944
|
+
"onUpdate:chip": Ne,
|
|
2945
|
+
onRemove: Fe,
|
|
2946
|
+
"onUpdate:editing": Le,
|
|
2947
|
+
onClearAll: Re
|
|
2948
|
+
}, {
|
|
2949
|
+
add: J(() => [L(Wt, {
|
|
2950
|
+
columns: n.columns,
|
|
2951
|
+
chips: k.value,
|
|
2952
|
+
onPick: Me
|
|
2953
|
+
}, {
|
|
2954
|
+
trigger: J(() => [F("button", Ii, [L(K(Ye), {
|
|
2955
|
+
size: 14,
|
|
2956
|
+
"aria-hidden": "true"
|
|
2957
|
+
}), I(" " + G(K(_).t("filter.addFilter")), 1)])]),
|
|
2958
|
+
_: 1
|
|
2959
|
+
}, 8, ["columns", "chips"])]),
|
|
2960
|
+
_: 1
|
|
2961
|
+
}, 8, [
|
|
2962
|
+
"chips",
|
|
2963
|
+
"defs",
|
|
2964
|
+
"editing",
|
|
2965
|
+
"rows",
|
|
2966
|
+
"labels",
|
|
2967
|
+
"phone"
|
|
2968
|
+
])) : N("", !0),
|
|
2969
|
+
x.value && Oe.value ? (B(), M(K(c), {
|
|
2970
|
+
key: 3,
|
|
2971
|
+
ref_key: "filtersSheet",
|
|
2972
|
+
ref: ze,
|
|
2973
|
+
columns: n.columns,
|
|
2974
|
+
chips: k.value,
|
|
2975
|
+
sort: T.value,
|
|
2976
|
+
rows: n.rows,
|
|
2977
|
+
labels: K(R),
|
|
2978
|
+
"summary-of": Ae,
|
|
2979
|
+
"currencies-of": je,
|
|
2980
|
+
onApply: Be
|
|
2981
|
+
}, null, 8, [
|
|
2982
|
+
"columns",
|
|
2983
|
+
"chips",
|
|
2984
|
+
"sort",
|
|
2985
|
+
"rows",
|
|
2986
|
+
"labels"
|
|
2987
|
+
])) : N("", !0),
|
|
2988
|
+
K(X).errorKind.value === "stale" && K(X).updatedAt.value ? (B(), P("div", Li, [
|
|
2989
|
+
L(K(Ze), {
|
|
2990
|
+
size: 16,
|
|
2991
|
+
"aria-hidden": "true"
|
|
2992
|
+
}),
|
|
2993
|
+
F("span", null, G(K(_).t("state.stale", { time: Mt(K(X).updatedAt.value) })), 1),
|
|
2994
|
+
F("button", {
|
|
2995
|
+
type: "button",
|
|
2996
|
+
class: "dt-strip-action",
|
|
2997
|
+
disabled: K(Q),
|
|
2998
|
+
onClick: t[17] ||= (e) => K(X).retry()
|
|
2999
|
+
}, G(K(_).t("common.retry")), 9, Ri)
|
|
3000
|
+
])) : N("", !0),
|
|
3001
|
+
L(qn, {
|
|
3002
|
+
ref_key: "grid",
|
|
3003
|
+
ref: Ht,
|
|
3004
|
+
layout: K(C),
|
|
3005
|
+
rows: yt.value,
|
|
3006
|
+
density: me.value,
|
|
3007
|
+
label: ae.value,
|
|
3008
|
+
loading: K(Q) || !!n.loading,
|
|
3009
|
+
skeleton: wt.value,
|
|
3010
|
+
dim: xt.value,
|
|
3011
|
+
refreshing: Et.value,
|
|
3012
|
+
"vertical-lines": K(S).prefs.verticalLines,
|
|
3013
|
+
"row-count": Lt.value ?? -1,
|
|
3014
|
+
"row-index-offset": (Ft.value.number - 1) * Ft.value.size,
|
|
3015
|
+
sort: _t.value,
|
|
3016
|
+
"filtered-columns": Ee.value,
|
|
3017
|
+
labels: K(R),
|
|
3018
|
+
sortable: "",
|
|
3019
|
+
selectable: n.selectable,
|
|
3020
|
+
selection: ut.value,
|
|
3021
|
+
expandable: ft.value,
|
|
3022
|
+
expanded: dt.value,
|
|
3023
|
+
"can-expand": pt.value,
|
|
3024
|
+
"row-menu": sn.value,
|
|
3025
|
+
"row-actions": n.rowActions,
|
|
3026
|
+
"row-error": n.rowError,
|
|
3027
|
+
"primary-href": an,
|
|
3028
|
+
"primary-label": on,
|
|
3029
|
+
"primary-header": rn.value?.header,
|
|
3030
|
+
phone: x.value,
|
|
3031
|
+
onHeaderFilter: Me,
|
|
3032
|
+
onRowClick: t[22] ||= (e, t) => fn(e, t),
|
|
3033
|
+
onRowOpen: t[23] ||= (e, t) => mn(e, t),
|
|
3034
|
+
onSelectRows: un,
|
|
3035
|
+
onSelectPage: K(mt).toggleAllPage,
|
|
3036
|
+
onToggleExpand: dn,
|
|
3037
|
+
onCopyId: t[24] ||= (e) => _n(e),
|
|
3038
|
+
onSort: ht,
|
|
3039
|
+
onSortSet: gt
|
|
3040
|
+
}, ge({ _: 2 }, [
|
|
3041
|
+
K(X).stillLoading.value ? {
|
|
3042
|
+
name: "notice",
|
|
3043
|
+
fn: J(() => [L(K(Ge), {
|
|
3044
|
+
size: 14,
|
|
3045
|
+
class: "dt-spin",
|
|
3046
|
+
"aria-hidden": "true"
|
|
3047
|
+
}), I(" " + G(K(_).t("state.stillLoading")), 1)]),
|
|
3048
|
+
key: "0"
|
|
3049
|
+
} : void 0,
|
|
3050
|
+
kt.value ? {
|
|
3051
|
+
name: "state",
|
|
3052
|
+
fn: J(() => [kt.value === "error" ? (B(), M(re, {
|
|
3053
|
+
key: 0,
|
|
3054
|
+
kind: "error",
|
|
3055
|
+
title: K(_).t("state.errorTitle", { entity: b.value }),
|
|
3056
|
+
lines: [At.value.message, K(_).t("state.errorKept")].filter((e) => !!e)
|
|
3057
|
+
}, ge({
|
|
3058
|
+
default: J(() => [y("onRequest") ? (B(), P("button", {
|
|
3059
|
+
key: 0,
|
|
3060
|
+
type: "button",
|
|
3061
|
+
class: "dt-btn",
|
|
3062
|
+
disabled: K(Q),
|
|
3063
|
+
onClick: t[18] ||= (e) => K(X).retry()
|
|
3064
|
+
}, G(K(_).t("state.tryAgain")), 9, zi)) : N("", !0)]),
|
|
3065
|
+
_: 2
|
|
3066
|
+
}, [At.value.id ? {
|
|
3067
|
+
name: "after",
|
|
3068
|
+
fn: J(() => [F("div", Bi, [F("button", {
|
|
3069
|
+
type: "button",
|
|
3070
|
+
class: "dt-btn dt-btn-ghost dt-btn-xs",
|
|
3071
|
+
onClick: yn
|
|
3072
|
+
}, G(K(_).t("state.copyErrorId")), 1), F("code", Vi, G(At.value.id), 1)])]),
|
|
3073
|
+
key: "0"
|
|
3074
|
+
} : void 0]), 1032, ["title", "lines"])) : kt.value === "noResults" ? (B(), M(re, {
|
|
3075
|
+
key: 1,
|
|
3076
|
+
kind: w.value ? "noResultsSearch" : "noResults",
|
|
3077
|
+
title: jt.value
|
|
3078
|
+
}, {
|
|
3079
|
+
default: J(() => [W.value.length === 1 ? (B(), P("button", {
|
|
3080
|
+
key: 0,
|
|
3081
|
+
type: "button",
|
|
3082
|
+
class: "dt-btn",
|
|
3083
|
+
onClick: t[19] ||= (e) => Fe(W.value[0].column)
|
|
3084
|
+
}, G(K(_).t("state.removeFilter", { column: Z(W.value[0].column) })), 1)) : W.value.length ? (B(), P("button", {
|
|
3085
|
+
key: 1,
|
|
3086
|
+
type: "button",
|
|
3087
|
+
class: "dt-btn",
|
|
3088
|
+
onClick: Re
|
|
3089
|
+
}, G(K(_).t("state.clearAllFilters")), 1)) : N("", !0), w.value ? (B(), P("button", {
|
|
3090
|
+
key: 2,
|
|
3091
|
+
type: "button",
|
|
3092
|
+
class: "dt-btn",
|
|
3093
|
+
onClick: t[20] ||= (e) => O("")
|
|
3094
|
+
}, G(K(_).t("state.clearSearch")), 1)) : N("", !0)]),
|
|
3095
|
+
_: 1
|
|
3096
|
+
}, 8, ["kind", "title"])) : kt.value === "noRowsOnPage" ? (B(), M(re, {
|
|
3097
|
+
key: 2,
|
|
3098
|
+
kind: "noRowsOnPage",
|
|
3099
|
+
title: K(_).t("page.noneOnPage")
|
|
3100
|
+
}, {
|
|
3101
|
+
default: J(() => [F("button", {
|
|
3102
|
+
type: "button",
|
|
3103
|
+
class: "dt-btn",
|
|
3104
|
+
onClick: t[21] ||= (e) => D(E.value.number - 1)
|
|
3105
|
+
}, G(K(_).t("page.previousPage")), 1)]),
|
|
3106
|
+
_: 1
|
|
3107
|
+
}, 8, ["title"])) : U(e.$slots, "empty", {}, () => [L(re, {
|
|
3108
|
+
kind: "empty",
|
|
3109
|
+
title: K(_).t("state.emptyTitle", { entity: b.value })
|
|
3110
|
+
}, null, 8, ["title"])], void 0, 3)]),
|
|
3111
|
+
key: "1"
|
|
3112
|
+
} : void 0,
|
|
3113
|
+
e.$slots.expanded ? {
|
|
3114
|
+
name: "expanded",
|
|
3115
|
+
fn: J(({ row: t, close: n }) => [U(e.$slots, "expanded", {
|
|
3116
|
+
row: t,
|
|
3117
|
+
close: n
|
|
3118
|
+
})]),
|
|
3119
|
+
key: "2"
|
|
3120
|
+
} : void 0
|
|
3121
|
+
]), 1032, [
|
|
3122
|
+
"layout",
|
|
3123
|
+
"rows",
|
|
3124
|
+
"density",
|
|
3125
|
+
"label",
|
|
3126
|
+
"loading",
|
|
3127
|
+
"skeleton",
|
|
3128
|
+
"dim",
|
|
3129
|
+
"refreshing",
|
|
3130
|
+
"vertical-lines",
|
|
3131
|
+
"row-count",
|
|
3132
|
+
"row-index-offset",
|
|
3133
|
+
"sort",
|
|
3134
|
+
"filtered-columns",
|
|
3135
|
+
"labels",
|
|
3136
|
+
"selectable",
|
|
3137
|
+
"selection",
|
|
3138
|
+
"expandable",
|
|
3139
|
+
"expanded",
|
|
3140
|
+
"can-expand",
|
|
3141
|
+
"row-menu",
|
|
3142
|
+
"row-actions",
|
|
3143
|
+
"row-error",
|
|
3144
|
+
"primary-header",
|
|
3145
|
+
"phone",
|
|
3146
|
+
"onSelectPage"
|
|
3147
|
+
]),
|
|
3148
|
+
n.selectionBar === "floating" && K(cn).length ? (B(), M(ei, {
|
|
3149
|
+
key: 5,
|
|
3150
|
+
variant: "floating",
|
|
3151
|
+
phone: x.value,
|
|
3152
|
+
rows: K(cn),
|
|
3153
|
+
actions: n.bulkActions ?? [],
|
|
3154
|
+
onClear: ln
|
|
3155
|
+
}, {
|
|
3156
|
+
default: J(() => [e.$slots["selection-actions"] ? U(e.$slots, "selection-actions", {
|
|
3157
|
+
rows: K(cn),
|
|
3158
|
+
clear: ln
|
|
3159
|
+
}, void 0, void 0, 0) : N("", !0)]),
|
|
3160
|
+
_: 3
|
|
3161
|
+
}, 8, [
|
|
3162
|
+
"phone",
|
|
3163
|
+
"rows",
|
|
3164
|
+
"actions"
|
|
3165
|
+
])) : N("", !0),
|
|
3166
|
+
hn.value ? (B(), P("div", {
|
|
3167
|
+
key: 6,
|
|
3168
|
+
class: z(["dt-toast", { "is-raised": n.selectionBar === "floating" && K(cn).length }]),
|
|
3169
|
+
role: "status"
|
|
3170
|
+
}, [L(K(We), {
|
|
3171
|
+
size: 16,
|
|
3172
|
+
"aria-hidden": "true"
|
|
3173
|
+
}), I(" " + G(hn.value), 1)], 2)) : N("", !0),
|
|
3174
|
+
L(Si, {
|
|
3175
|
+
"row-count": Pt.value,
|
|
3176
|
+
page: Ft.value,
|
|
3177
|
+
"has-more": It.value,
|
|
3178
|
+
total: Lt.value,
|
|
3179
|
+
countable: ie.value && n.countable && y("onCount"),
|
|
3180
|
+
counting: zt.value,
|
|
3181
|
+
"counted-at": Bt.value,
|
|
3182
|
+
busy: Ot.value,
|
|
3183
|
+
"first-load": wt.value && !$.value,
|
|
3184
|
+
empty: kt.value === "empty",
|
|
3185
|
+
"page-sizes": n.pageSizes,
|
|
3186
|
+
"updated-at": y("onRequest") ? K(X).updatedAt.value : null,
|
|
3187
|
+
freshness: qt.value,
|
|
3188
|
+
"can-refresh": y("onRequest"),
|
|
3189
|
+
phone: x.value,
|
|
3190
|
+
onCount: Vt,
|
|
3191
|
+
onPage: D,
|
|
3192
|
+
onPageSize: Ut,
|
|
3193
|
+
onRefresh: t[25] ||= (e) => K(X).refresh()
|
|
3194
|
+
}, null, 8, [
|
|
3195
|
+
"row-count",
|
|
3196
|
+
"page",
|
|
3197
|
+
"has-more",
|
|
3198
|
+
"total",
|
|
3199
|
+
"countable",
|
|
3200
|
+
"counting",
|
|
3201
|
+
"counted-at",
|
|
3202
|
+
"busy",
|
|
3203
|
+
"first-load",
|
|
3204
|
+
"empty",
|
|
3205
|
+
"page-sizes",
|
|
3206
|
+
"updated-at",
|
|
3207
|
+
"freshness",
|
|
3208
|
+
"can-refresh",
|
|
3209
|
+
"phone"
|
|
3210
|
+
]),
|
|
3211
|
+
F("span", Hi, G(Je.value), 1),
|
|
3212
|
+
F("span", Ui, G(Xe.value), 1),
|
|
3213
|
+
Ie(F("div", {
|
|
3214
|
+
class: z(["dt-tip", { "is-multi": K(xn).text.value.includes("\n") }]),
|
|
3215
|
+
role: "tooltip",
|
|
3216
|
+
style: Se(K(xn).style.value)
|
|
3217
|
+
}, G(K(xn).text.value), 7), [[Pe, K(xn).open.value]]),
|
|
3218
|
+
nt.value ? (B(), M(vr, {
|
|
3219
|
+
key: 7,
|
|
3220
|
+
open: rt.value,
|
|
3221
|
+
"onUpdate:open": t[26] ||= (e) => rt.value = e,
|
|
3222
|
+
mode: nt.value.mode,
|
|
3223
|
+
name: nt.value.name,
|
|
3224
|
+
summary: nt.value.summary,
|
|
3225
|
+
validate: st,
|
|
3226
|
+
onSave: ct
|
|
3227
|
+
}, null, 8, [
|
|
3228
|
+
"open",
|
|
3229
|
+
"mode",
|
|
3230
|
+
"name",
|
|
3231
|
+
"summary"
|
|
3232
|
+
])) : N("", !0),
|
|
3233
|
+
L(ue, {
|
|
3234
|
+
open: !!it.value,
|
|
3235
|
+
title: K(_).t("views.delete.title", { name: it.value?.name ?? "" }),
|
|
3236
|
+
body: K(_).t("views.delete.body"),
|
|
3237
|
+
"confirm-label": K(_).t("views.delete"),
|
|
3238
|
+
danger: "",
|
|
3239
|
+
"onUpdate:open": t[27] ||= (e) => !e && (it.value = null),
|
|
3240
|
+
onConfirm: lt
|
|
3241
|
+
}, null, 8, [
|
|
3242
|
+
"open",
|
|
3243
|
+
"title",
|
|
3244
|
+
"body",
|
|
3245
|
+
"confirm-label"
|
|
3246
|
+
])
|
|
3247
|
+
], 10, Ai));
|
|
3248
|
+
}
|
|
3249
|
+
});
|
|
3250
|
+
//#endregion
|
|
3251
|
+
//#region src/core/adapters/localStorage.ts
|
|
3252
|
+
function Gi() {
|
|
3253
|
+
try {
|
|
3254
|
+
let e = globalThis.localStorage, t = "__dt_probe__";
|
|
3255
|
+
return e.setItem(t, "1"), e.removeItem(t), {
|
|
3256
|
+
get: (t) => e.getItem(t),
|
|
3257
|
+
set: (t, n) => e.setItem(t, n)
|
|
3258
|
+
};
|
|
3259
|
+
} catch {
|
|
3260
|
+
let e = /* @__PURE__ */ new Map();
|
|
3261
|
+
return {
|
|
3262
|
+
get: (t) => e.get(t) ?? null,
|
|
3263
|
+
set: (t, n) => {
|
|
3264
|
+
e.set(t, n);
|
|
3265
|
+
}
|
|
3266
|
+
};
|
|
3267
|
+
}
|
|
3268
|
+
}
|
|
3269
|
+
function Ki(e, t, n) {
|
|
3270
|
+
let r = e.get(t);
|
|
3271
|
+
if (r === null) return n;
|
|
3272
|
+
try {
|
|
3273
|
+
return JSON.parse(r);
|
|
3274
|
+
} catch {
|
|
3275
|
+
return n;
|
|
3276
|
+
}
|
|
3277
|
+
}
|
|
3278
|
+
var qi = (e, t) => {
|
|
3279
|
+
if (typeof e != "string" || e === "") throw TypeError(`${t}: 'scope' zorunlu (uygulama/kiracı anahtarı)`);
|
|
3280
|
+
return e;
|
|
3281
|
+
}, Ji = () => globalThis.crypto?.randomUUID?.() ?? Math.random().toString(36).slice(2), Yi = () => (/* @__PURE__ */ new Date()).toISOString();
|
|
3282
|
+
function Xi(e) {
|
|
3283
|
+
let t = qi(e?.scope, "createLocalStorageViews"), n = Gi(), r = (e) => `dt:${t}:views:${e}`, i = (e) => Ki(n, r(e), []), a = (e, t) => n.set(r(e), JSON.stringify(t));
|
|
3284
|
+
return {
|
|
3285
|
+
async list(e) {
|
|
3286
|
+
return i(e);
|
|
3287
|
+
},
|
|
3288
|
+
async create(e, t) {
|
|
3289
|
+
let n = {
|
|
3290
|
+
id: Ji(),
|
|
3291
|
+
name: t.name,
|
|
3292
|
+
kind: "personal",
|
|
3293
|
+
state: t.state,
|
|
3294
|
+
updatedAt: Yi()
|
|
3295
|
+
};
|
|
3296
|
+
return a(e, [...i(e), n]), n;
|
|
3297
|
+
},
|
|
3298
|
+
async update(e, t, n) {
|
|
3299
|
+
let r = i(e), o = r.findIndex((e) => e.id === t);
|
|
3300
|
+
if (o < 0) throw Error(`createLocalStorageViews: görünüm yok: ${t}`);
|
|
3301
|
+
let s = {
|
|
3302
|
+
...r[o],
|
|
3303
|
+
...n.name !== void 0 && { name: n.name },
|
|
3304
|
+
...n.state !== void 0 && { state: n.state },
|
|
3305
|
+
updatedAt: Yi()
|
|
3306
|
+
};
|
|
3307
|
+
return r[o] = s, a(e, r), s;
|
|
3308
|
+
},
|
|
3309
|
+
async remove(e, t) {
|
|
3310
|
+
a(e, i(e).filter((e) => e.id !== t));
|
|
3311
|
+
}
|
|
3312
|
+
};
|
|
3313
|
+
}
|
|
3314
|
+
function Zi(e) {
|
|
3315
|
+
let t = qi(e?.scope, "createLocalStoragePreferences"), n = Gi(), r = (e) => `dt:${t}:prefs:${e}`;
|
|
3316
|
+
return {
|
|
3317
|
+
get(e) {
|
|
3318
|
+
return Ki(n, r(e), {});
|
|
3319
|
+
},
|
|
3320
|
+
set(e, t) {
|
|
3321
|
+
n.set(r(e), JSON.stringify({
|
|
3322
|
+
...Ki(n, r(e), {}),
|
|
3323
|
+
...t
|
|
3324
|
+
}));
|
|
3325
|
+
}
|
|
3326
|
+
};
|
|
3327
|
+
}
|
|
3328
|
+
//#endregion
|
|
3329
|
+
export { w as DATA_TABLE_KEY, Wi as DataTable, x as ME, me as createContext, C as createDataTable, S as createI18n, Zi as createLocalStoragePreferences, Xi as createLocalStorageViews, pe as useDataTableContext };
|
|
3330
|
+
|
|
3331
|
+
//# sourceMappingURL=index.js.map
|