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