@medyat/vue-data-table 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/LICENSE +21 -0
- package/README.md +179 -2
- package/dist/DateEditor-BTIZMwf1.js +224 -0
- package/dist/DateEditor-BTIZMwf1.js.map +1 -0
- package/dist/FiltersSheet-o2HaQuhq.js +285 -0
- package/dist/FiltersSheet-o2HaQuhq.js.map +1 -0
- package/dist/Layer-Di-tPd8b.js +106 -0
- package/dist/Layer-Di-tPd8b.js.map +1 -0
- package/dist/PhoneMoreSheet-gfkH96RR.js +227 -0
- package/dist/PhoneMoreSheet-gfkH96RR.js.map +1 -0
- package/dist/TextEditor-DPqiiRau.js +331 -0
- package/dist/TextEditor-DPqiiRau.js.map +1 -0
- package/dist/index.d.ts +711 -0
- package/dist/index.js +3331 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin-DhgcjEdi.js +813 -0
- package/dist/plugin-DhgcjEdi.js.map +1 -0
- package/dist/query-DQWMlX0m.js +2121 -0
- package/dist/query-DQWMlX0m.js.map +1 -0
- package/dist/shadcn-bridge-hsl.css +22 -0
- package/dist/shadcn-bridge.css +23 -0
- package/dist/sheet.d.ts +622 -0
- package/dist/sheet.js +3783 -0
- package/dist/sheet.js.map +1 -0
- package/dist/style.css +2 -0
- package/package.json +85 -3
|
@@ -0,0 +1,2121 @@
|
|
|
1
|
+
import { i as e } from "./plugin-DhgcjEdi.js";
|
|
2
|
+
import { Fragment as t, computed as n, createBlock as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createTextVNode as s, createVNode as c, defineComponent as l, h as u, mergeModels as d, normalizeClass as f, onBeforeUnmount as p, onMounted as m, onUpdated as h, openBlock as g, reactive as _, ref as v, renderList as y, renderSlot as b, resolveDynamicComponent as x, shallowRef as S, toDisplayString as C, toRaw as w, toValue as T, unref as E, useModel as D, vModelText as ee, watch as O, withCtx as k, withDirectives as te, withKeys as ne, withModifiers as re } from "vue";
|
|
3
|
+
import { PhArrowDown as ie, PhArrowUp as ae, PhArrowUpRight as oe, PhArrowsOutSimple as se, PhCaretLeft as ce, PhCaretRight as le, PhCheck as ue, PhDotsThree as de, PhEye as fe, PhEyeSlash as pe, PhFile as me, PhFunnel as he, PhLock as ge, PhMagnifyingGlass as _e, PhMinus as ve, PhPackage as ye, PhSlidersHorizontal as be, PhStar as xe, PhWarningCircle as Se, PhX as Ce, PhXCircle as we } from "@phosphor-icons/vue";
|
|
4
|
+
import { columnOrderingFeature as Te, columnPinningFeature as Ee, columnResizingFeature as De, columnSizingFeature as Oe, columnVisibilityFeature as ke, tableFeatures as Ae, useTable as je } from "@tanstack/vue-table";
|
|
5
|
+
import { AlertDialogCancel as Me, AlertDialogContent as Ne, AlertDialogDescription as Pe, AlertDialogOverlay as Fe, AlertDialogPortal as Ie, AlertDialogRoot as Le, AlertDialogTitle as Re, DropdownMenuContent as A, DropdownMenuItem as j, DropdownMenuPortal as ze, DropdownMenuRoot as Be, DropdownMenuSeparator as Ve, DropdownMenuTrigger as He, PopoverContent as Ue, PopoverPortal as We, PopoverRoot as Ge, PopoverTrigger as Ke, SwitchRoot as qe, SwitchThumb as Je, ToggleGroupItem as Ye, ToggleGroupRoot as Xe } from "reka-ui";
|
|
6
|
+
var Ze = /* @__PURE__ */ new Map();
|
|
7
|
+
function M(e, t, n, r) {
|
|
8
|
+
let i = `${e}|${t}|${n ? JSON.stringify(n) : ""}`, a = Ze.get(i);
|
|
9
|
+
return a === void 0 && (a = r(), Ze.set(i, a)), a;
|
|
10
|
+
}
|
|
11
|
+
var Qe = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
12
|
+
function N(e) {
|
|
13
|
+
if (e instanceof Date) return e;
|
|
14
|
+
let t = Qe.exec(e);
|
|
15
|
+
return t ? new Date(+t[1], t[2] - 1, +t[3]) : new Date(e);
|
|
16
|
+
}
|
|
17
|
+
var P = 864e5, $e = (e) => new Date(e.getFullYear(), e.getMonth(), e.getDate()).getTime();
|
|
18
|
+
function et(e) {
|
|
19
|
+
let t = (t) => M("n", e, t, () => new Intl.NumberFormat(e, t)), n = (t) => M("d", e, t, () => new Intl.DateTimeFormat(e, t)), r = (e) => e.includes("-") ? e.replace(/-/g, "−") : e, i = t({ maximumFractionDigits: 0 }), a = (e) => {
|
|
20
|
+
let t = /* @__PURE__ */ new Map();
|
|
21
|
+
return (n) => {
|
|
22
|
+
let r = t.get(n);
|
|
23
|
+
return r || t.set(n, r = e(n)), r;
|
|
24
|
+
};
|
|
25
|
+
}, o = a((e) => t({
|
|
26
|
+
minimumFractionDigits: e,
|
|
27
|
+
maximumFractionDigits: e
|
|
28
|
+
})), s = a((e) => t({
|
|
29
|
+
style: "percent",
|
|
30
|
+
minimumFractionDigits: e,
|
|
31
|
+
maximumFractionDigits: e
|
|
32
|
+
})), c = (t) => M("r", e, { style: t }, () => new Intl.RelativeTimeFormat(e, {
|
|
33
|
+
numeric: "auto",
|
|
34
|
+
style: t
|
|
35
|
+
}));
|
|
36
|
+
return {
|
|
37
|
+
locale: e,
|
|
38
|
+
int: (e) => r(i.format(e)),
|
|
39
|
+
decimal: (e, t = 2) => r(o(t).format(e)),
|
|
40
|
+
percent: (e, t = 0) => r(s(t).format(e / 100)),
|
|
41
|
+
compact: (e) => r(t({
|
|
42
|
+
notation: "compact",
|
|
43
|
+
maximumFractionDigits: 0
|
|
44
|
+
}).format(e)),
|
|
45
|
+
date: (e, t = /* @__PURE__ */ new Date()) => {
|
|
46
|
+
let r = N(e), i = r.getFullYear() === t.getFullYear();
|
|
47
|
+
return n(i ? {
|
|
48
|
+
month: "short",
|
|
49
|
+
day: "numeric"
|
|
50
|
+
} : {
|
|
51
|
+
month: "short",
|
|
52
|
+
day: "numeric",
|
|
53
|
+
year: "numeric"
|
|
54
|
+
}).format(r);
|
|
55
|
+
},
|
|
56
|
+
dateTime: (e, t = /* @__PURE__ */ new Date()) => {
|
|
57
|
+
let r = N(e), i = r.getFullYear() === t.getFullYear();
|
|
58
|
+
return n({
|
|
59
|
+
month: "short",
|
|
60
|
+
day: "numeric",
|
|
61
|
+
...i ? {} : { year: "numeric" },
|
|
62
|
+
hour: "2-digit",
|
|
63
|
+
minute: "2-digit"
|
|
64
|
+
}).format(r);
|
|
65
|
+
},
|
|
66
|
+
dateTimeFull: (e) => n({
|
|
67
|
+
dateStyle: "medium",
|
|
68
|
+
timeStyle: "long"
|
|
69
|
+
}).format(N(e)),
|
|
70
|
+
relative: (e, t = /* @__PURE__ */ new Date(), n = "long") => {
|
|
71
|
+
let r = N(e).getTime() - t.getTime(), i = Math.abs(r), a = c(n);
|
|
72
|
+
return i < 6e4 ? a.format(0, "second") : i < 36e5 ? a.format(Math.round(r / 6e4), "minute") : i < P ? a.format(Math.round(r / 36e5), "hour") : i < 30 * P ? a.format(Math.round(r / P), "day") : i < 365 * P ? a.format(Math.round(r / (30 * P)), "month") : a.format(Math.round(r / (365 * P)), "year");
|
|
73
|
+
},
|
|
74
|
+
daysLate: (e, t = /* @__PURE__ */ new Date()) => Math.max(0, Math.floor(($e(t) - $e(N(e))) / P)),
|
|
75
|
+
list: (t) => M("l", e, void 0, () => new Intl.ListFormat(e, { type: "unit" })).format(t),
|
|
76
|
+
collator: () => M("c", e, void 0, () => new Intl.Collator(e, {
|
|
77
|
+
numeric: !0,
|
|
78
|
+
sensitivity: "base"
|
|
79
|
+
})),
|
|
80
|
+
plural: () => M("p", e, void 0, () => new Intl.PluralRules(e))
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
var tt = /* @__PURE__ */ new Map();
|
|
84
|
+
function nt(e) {
|
|
85
|
+
let t = tt.get(e);
|
|
86
|
+
return t || (t = et(e), tt.set(e, t)), t;
|
|
87
|
+
}
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region src/core/cells/format.ts
|
|
90
|
+
var rt = (e) => e == null || e === "" || Array.isArray(e) && e.length === 0, F = (e, t) => e?.find((e) => e.value === t)?.label ?? String(t);
|
|
91
|
+
function it(e) {
|
|
92
|
+
try {
|
|
93
|
+
return new URL(e).host;
|
|
94
|
+
} catch {
|
|
95
|
+
return e;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function at(e, t) {
|
|
99
|
+
return typeof e.currency == "function" ? e.currency(t) : e.currency;
|
|
100
|
+
}
|
|
101
|
+
function ot(e, t, n, r) {
|
|
102
|
+
if (rt(n)) return e.emptyText ?? "—";
|
|
103
|
+
let { fmt: i, i18n: a } = r;
|
|
104
|
+
switch (e.type) {
|
|
105
|
+
case "int": return i.int(Number(n));
|
|
106
|
+
case "float": return i.decimal(Number(n), e.decimalPlaces ?? 2);
|
|
107
|
+
case "percentage": return i.percent(Number(n), e.decimalPlaces ?? 0);
|
|
108
|
+
case "star": return a.t("cell.rating", {
|
|
109
|
+
value: Number(n),
|
|
110
|
+
max: e.max ?? 5
|
|
111
|
+
});
|
|
112
|
+
case "currency": return `${i.decimal(Number(n), e.decimalPlaces ?? 2)} ${at(e, t)}`;
|
|
113
|
+
case "url": return it(String(n));
|
|
114
|
+
case "boolean": return a.t(n ? "common.yes" : "common.no");
|
|
115
|
+
case "select": return F(e.options, n);
|
|
116
|
+
case "multiselect": return i.list(n.map((t) => F(e.options, t)));
|
|
117
|
+
case "ajax": return r.labels.label(e.id, e.remote, n);
|
|
118
|
+
case "user": {
|
|
119
|
+
let t = Array.isArray(n) ? n : [n];
|
|
120
|
+
return i.list(t.map((t) => e.options?.find((e) => e.value === t)?.label ?? r.labels.label(e.id, e.remote, t)));
|
|
121
|
+
}
|
|
122
|
+
case "date": return Number.isNaN(N(n).getTime()) ? String(n) : i.date(n, r.today);
|
|
123
|
+
case "datetime": return Number.isNaN(N(n).getTime()) ? String(n) : e.relative ? i.relative(n, r.today) : i.dateTime(n, r.today);
|
|
124
|
+
case "object": return e.summary ? e.summary(n, t) : a.t("cell.fields", { count: typeof n == "object" && n ? Object.keys(n).length : 0 });
|
|
125
|
+
case "array": return i.list(n.map((t) => st(e.itemType, t, i)));
|
|
126
|
+
default: return String(n);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
function st(e, t, n) {
|
|
130
|
+
return e === "int" ? n.int(Number(t)) : e === "float" ? n.decimal(Number(t)) : String(t);
|
|
131
|
+
}
|
|
132
|
+
//#endregion
|
|
133
|
+
//#region src/core/cells/remoteLabels.ts
|
|
134
|
+
var ct = class {
|
|
135
|
+
cache = /* @__PURE__ */ new Map();
|
|
136
|
+
pending = /* @__PURE__ */ new Map();
|
|
137
|
+
inFlight = /* @__PURE__ */ new Map();
|
|
138
|
+
scheduled = !1;
|
|
139
|
+
version = S(0);
|
|
140
|
+
option(e, t, n) {
|
|
141
|
+
this.version.value;
|
|
142
|
+
let r = this.cache.get(e)?.get(n);
|
|
143
|
+
if (r || !t) return r;
|
|
144
|
+
if (!this.inFlight.get(e)?.has(n)) {
|
|
145
|
+
let r = this.pending.get(e);
|
|
146
|
+
r || this.pending.set(e, r = {
|
|
147
|
+
remote: t,
|
|
148
|
+
ids: /* @__PURE__ */ new Set()
|
|
149
|
+
}), r.ids.add(n), this.schedule();
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
label(e, t, n) {
|
|
153
|
+
return this.option(e, t, n)?.label ?? String(n);
|
|
154
|
+
}
|
|
155
|
+
seed(e, t) {
|
|
156
|
+
let n = this.cache.get(e);
|
|
157
|
+
n || this.cache.set(e, n = /* @__PURE__ */ new Map());
|
|
158
|
+
for (let e of t) n.set(e.value, e);
|
|
159
|
+
this.version.value++;
|
|
160
|
+
}
|
|
161
|
+
schedule() {
|
|
162
|
+
this.scheduled || (this.scheduled = !0, queueMicrotask(() => {
|
|
163
|
+
this.scheduled = !1;
|
|
164
|
+
for (let [e, { remote: t, ids: n }] of this.pending) {
|
|
165
|
+
this.pending.delete(e);
|
|
166
|
+
let r = [...n], i = this.inFlight.get(e);
|
|
167
|
+
i || this.inFlight.set(e, i = /* @__PURE__ */ new Set()), r.forEach((e) => i.add(e)), t.resolve(r, { signal: new AbortController().signal }).then((t) => this.seed(e, t)).catch(() => {}).finally(() => r.forEach((e) => i.delete(e)));
|
|
168
|
+
}
|
|
169
|
+
}));
|
|
170
|
+
}
|
|
171
|
+
}, I = (e) => ({
|
|
172
|
+
align: "right",
|
|
173
|
+
width: e,
|
|
174
|
+
skeleton: "number",
|
|
175
|
+
sortable: !0,
|
|
176
|
+
filterable: !0,
|
|
177
|
+
searchable: !1,
|
|
178
|
+
numeric: !0
|
|
179
|
+
}), L = (e, t = !0) => ({
|
|
180
|
+
align: "left",
|
|
181
|
+
width: e,
|
|
182
|
+
skeleton: "text",
|
|
183
|
+
sortable: !0,
|
|
184
|
+
filterable: !0,
|
|
185
|
+
searchable: t,
|
|
186
|
+
numeric: !1
|
|
187
|
+
}), R = (e) => ({
|
|
188
|
+
align: "left",
|
|
189
|
+
width: e,
|
|
190
|
+
skeleton: "badge",
|
|
191
|
+
sortable: !0,
|
|
192
|
+
filterable: !0,
|
|
193
|
+
searchable: !1,
|
|
194
|
+
numeric: !1
|
|
195
|
+
}), z = {
|
|
196
|
+
int: I(112),
|
|
197
|
+
float: I(112),
|
|
198
|
+
percentage: I(112),
|
|
199
|
+
star: {
|
|
200
|
+
...L(112, !1),
|
|
201
|
+
skeleton: "text"
|
|
202
|
+
},
|
|
203
|
+
currency: I(148),
|
|
204
|
+
string: L({
|
|
205
|
+
min: 160,
|
|
206
|
+
fr: 1.2
|
|
207
|
+
}),
|
|
208
|
+
text: L({
|
|
209
|
+
min: 160,
|
|
210
|
+
fr: 1.2
|
|
211
|
+
}),
|
|
212
|
+
uppercase: L({
|
|
213
|
+
min: 160,
|
|
214
|
+
fr: 1.2
|
|
215
|
+
}),
|
|
216
|
+
lowercase: L({
|
|
217
|
+
min: 160,
|
|
218
|
+
fr: 1.2
|
|
219
|
+
}),
|
|
220
|
+
phone: L(156),
|
|
221
|
+
color: { ...L(132, !1) },
|
|
222
|
+
email: L(200),
|
|
223
|
+
url: { ...L(180, !1) },
|
|
224
|
+
id: L(128),
|
|
225
|
+
boolean: R(96),
|
|
226
|
+
select: R(140),
|
|
227
|
+
multiselect: {
|
|
228
|
+
...R(180),
|
|
229
|
+
sortable: !1
|
|
230
|
+
},
|
|
231
|
+
ajax: R(180),
|
|
232
|
+
user: {
|
|
233
|
+
...R(156),
|
|
234
|
+
skeleton: "person"
|
|
235
|
+
},
|
|
236
|
+
date: L(132, !1),
|
|
237
|
+
datetime: L(156, !1),
|
|
238
|
+
object: {
|
|
239
|
+
...L(180, !1),
|
|
240
|
+
sortable: !1,
|
|
241
|
+
filterable: !1
|
|
242
|
+
},
|
|
243
|
+
array: {
|
|
244
|
+
...L(160, !1),
|
|
245
|
+
sortable: !1
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
function lt(e) {
|
|
249
|
+
return e.width === void 0 ? e.type === "percentage" && e.display === "bar" ? 156 : e.primary ? e.type === "id" ? 136 : {
|
|
250
|
+
min: 200,
|
|
251
|
+
fr: 1.6
|
|
252
|
+
} : z[e.type].width : e.width;
|
|
253
|
+
}
|
|
254
|
+
var ut = (e) => z[e].numeric;
|
|
255
|
+
function dt(e) {
|
|
256
|
+
return e.align ?? z[e.type].align;
|
|
257
|
+
}
|
|
258
|
+
var ft = {
|
|
259
|
+
int: "number",
|
|
260
|
+
float: "number",
|
|
261
|
+
percentage: "percentage",
|
|
262
|
+
star: "rating",
|
|
263
|
+
currency: "currency",
|
|
264
|
+
string: "text",
|
|
265
|
+
text: "longText",
|
|
266
|
+
uppercase: "text",
|
|
267
|
+
lowercase: "text",
|
|
268
|
+
phone: "phone",
|
|
269
|
+
color: "colour",
|
|
270
|
+
email: "email",
|
|
271
|
+
url: "link",
|
|
272
|
+
id: "id",
|
|
273
|
+
boolean: "boolean",
|
|
274
|
+
select: "option",
|
|
275
|
+
multiselect: "options",
|
|
276
|
+
ajax: "relation",
|
|
277
|
+
user: "person",
|
|
278
|
+
date: "date",
|
|
279
|
+
datetime: "datetime",
|
|
280
|
+
object: "object",
|
|
281
|
+
array: "list"
|
|
282
|
+
}, pt = (e) => `type.${ft[e]}`;
|
|
283
|
+
//#endregion
|
|
284
|
+
//#region src/core/columns/readPath.ts
|
|
285
|
+
function B(e, t) {
|
|
286
|
+
let n = e;
|
|
287
|
+
for (let e of t.split(".")) {
|
|
288
|
+
if (n == null) return;
|
|
289
|
+
n = n[e];
|
|
290
|
+
}
|
|
291
|
+
return n;
|
|
292
|
+
}
|
|
293
|
+
var mt = Ae({
|
|
294
|
+
columnSizingFeature: Oe,
|
|
295
|
+
columnResizingFeature: De,
|
|
296
|
+
columnOrderingFeature: Te,
|
|
297
|
+
columnPinningFeature: Ee,
|
|
298
|
+
columnVisibilityFeature: ke
|
|
299
|
+
}), ht = (e) => typeof e == "number" ? `${e}px` : `minmax(${e.min}px, ${e.fr}fr)`, gt = (e) => typeof e == "number" ? e : e.min, _t = (e) => `--dt-off-${e.replace(/[^a-zA-Z0-9_-]/g, "_")}`;
|
|
300
|
+
function vt(e) {
|
|
301
|
+
let t = n(() => T(e.columns)), r = n(() => new Map(t.value.map((e) => [e.id, e]))), i = n(() => T(e.rowKey) ?? "id"), a = n(() => T(e.layout)), o = (e) => Math.min(e.minWidth ?? 80, gt(lt(e))), s = n(() => t.value.map((e) => {
|
|
302
|
+
let t = e.id;
|
|
303
|
+
return {
|
|
304
|
+
id: t,
|
|
305
|
+
accessorFn: e.accessor ?? ((e) => B(e, t)),
|
|
306
|
+
size: gt(lt(e)),
|
|
307
|
+
minSize: o(e),
|
|
308
|
+
maxSize: e.maxWidth,
|
|
309
|
+
enableHiding: !(e.alwaysVisible || e.primary)
|
|
310
|
+
};
|
|
311
|
+
})), c = (e) => e?.filter((e) => r.value.has(e)), l = (e) => {
|
|
312
|
+
let n = c(e?.pinned?.left) ?? t.value.filter((e) => e.pinned === "left").map((e) => e.id), i = c(e?.pinned?.right) ?? t.value.filter((e) => e.pinned === "right").map((e) => e.id), a = {};
|
|
313
|
+
for (let n of t.value) {
|
|
314
|
+
let t = n.id;
|
|
315
|
+
a[t] = n.alwaysVisible || n.primary || (e?.visible ? e.visible.includes(t) : !n.hidden);
|
|
316
|
+
}
|
|
317
|
+
let o = {};
|
|
318
|
+
for (let [t, n] of Object.entries(e?.widths ?? {})) r.value.has(t) && (o[t] = n);
|
|
319
|
+
return {
|
|
320
|
+
columnPinning: {
|
|
321
|
+
start: n,
|
|
322
|
+
end: i
|
|
323
|
+
},
|
|
324
|
+
columnVisibility: a,
|
|
325
|
+
columnOrder: c(e?.order) ?? [],
|
|
326
|
+
columnSizing: o
|
|
327
|
+
};
|
|
328
|
+
}, u = n(() => l(a.value)), d = je({
|
|
329
|
+
features: mt,
|
|
330
|
+
columns: s,
|
|
331
|
+
data: n(() => T(e.rows)),
|
|
332
|
+
getRowId: (e) => String(B(e, i.value)),
|
|
333
|
+
initialState: u.value,
|
|
334
|
+
columnResizeMode: "onChange"
|
|
335
|
+
}), f = n(() => new Map(d.getFlatHeaders().map((e) => [e.column.id, e]))), p = (e, t, n) => ({
|
|
336
|
+
id: e.id,
|
|
337
|
+
def: r.value.get(e.id),
|
|
338
|
+
pinned: t,
|
|
339
|
+
pinEdge: n,
|
|
340
|
+
offsetVar: _t(e.id),
|
|
341
|
+
header: f.value.get(e.id)
|
|
342
|
+
}), m = n(() => !!T(e.phone)), h = (e) => !!r.value.get(e.id)?.primary, g = n(() => m.value ? d.getVisibleLeafColumns().filter(h) : d.getStartVisibleLeafColumns()), _ = n(() => m.value ? d.getVisibleLeafColumns().filter((e) => !h(e)) : d.getCenterVisibleLeafColumns()), v = n(() => m.value ? [] : d.getEndVisibleLeafColumns()), y = (e) => m.value ? h(e) : e.getIsPinned() !== !1, b = n(() => g.value.map((e, t, n) => p(e, "start", t === n.length - 1))), x = n(() => _.value.map((e) => p(e, null, !1))), S = n(() => v.value.map((e, t) => p(e, "end", t === 0))), C = n(() => [
|
|
343
|
+
...b.value,
|
|
344
|
+
...x.value,
|
|
345
|
+
...S.value
|
|
346
|
+
]), w = (e, t) => {
|
|
347
|
+
let n = d.atoms.columnSizing.get()[e.id];
|
|
348
|
+
return t ? e.getSize() : n === void 0 ? lt(r.value.get(e.id)) : n;
|
|
349
|
+
}, E = n(() => [
|
|
350
|
+
...g.value.map((t, n, r) => ht(w(t, !(e.flexLastStart && n === r.length - 1)))),
|
|
351
|
+
..._.value.map((e) => ht(w(e, !1))),
|
|
352
|
+
"auto",
|
|
353
|
+
...v.value.map((e) => ht(w(e, !0)))
|
|
354
|
+
].join(" ")), D = n(() => {
|
|
355
|
+
let e = {}, t = 0;
|
|
356
|
+
for (let n of g.value) e[_t(n.id)] = `${t}px`, t += n.getSize();
|
|
357
|
+
for (let t of v.value) e[_t(t.id)] = `${t.getAfter("end")}px`;
|
|
358
|
+
return e;
|
|
359
|
+
}), ee = n(() => d.getVisibleLeafColumns().reduce((e, t) => e + gt(w(t, y(t))), 0)), O = n(() => d.getOrderColumnsFn()(d.getAllLeafColumns()).map((e) => {
|
|
360
|
+
let t = r.value.get(e.id), n = e.getIsPinned();
|
|
361
|
+
return {
|
|
362
|
+
id: e.id,
|
|
363
|
+
def: t,
|
|
364
|
+
visible: e.getIsVisible(),
|
|
365
|
+
pinned: n === !1 ? null : n,
|
|
366
|
+
canHide: e.getCanHide()
|
|
367
|
+
};
|
|
368
|
+
})), k = n(() => ({
|
|
369
|
+
shown: d.getVisibleLeafColumns().length,
|
|
370
|
+
total: d.getAllLeafColumns().length
|
|
371
|
+
})), te = (e, t) => {
|
|
372
|
+
let n = d.getOrderColumnsFn()(d.getAllLeafColumns()), r = n.findIndex((t) => t.id === e), i = n[r];
|
|
373
|
+
if (!i) return;
|
|
374
|
+
let a = i.getIsPinned(), o = r + t;
|
|
375
|
+
for (; o >= 0 && o < n.length && !(n[o].getIsVisible() && n[o].getIsPinned() === a);) o += t;
|
|
376
|
+
let s = n[o];
|
|
377
|
+
if (!s) return;
|
|
378
|
+
let c = n.map((e) => e.id);
|
|
379
|
+
c[r] = s.id, c[o] = i.id, d.setColumnOrder(c);
|
|
380
|
+
}, ne = (e) => {
|
|
381
|
+
let t = l(e);
|
|
382
|
+
d.setColumnOrder(t.columnOrder), d.setColumnVisibility(t.columnVisibility), d.setColumnPinning(t.columnPinning), d.setColumnSizing(t.columnSizing);
|
|
383
|
+
};
|
|
384
|
+
return {
|
|
385
|
+
columns: C,
|
|
386
|
+
start: b,
|
|
387
|
+
center: x,
|
|
388
|
+
end: S,
|
|
389
|
+
panel: O,
|
|
390
|
+
counts: k,
|
|
391
|
+
move: te,
|
|
392
|
+
reset: (e = a.value) => ne(e),
|
|
393
|
+
apply: ne,
|
|
394
|
+
state: n(() => {
|
|
395
|
+
let e = d.atoms.columnPinning.get();
|
|
396
|
+
return {
|
|
397
|
+
order: d.getOrderColumnsFn()(d.getAllLeafColumns()).map((e) => e.id),
|
|
398
|
+
visible: d.getVisibleLeafColumns().map((e) => e.id),
|
|
399
|
+
widths: { ...d.atoms.columnSizing.get() },
|
|
400
|
+
pinned: {
|
|
401
|
+
left: [...e.start],
|
|
402
|
+
right: [...e.end]
|
|
403
|
+
}
|
|
404
|
+
};
|
|
405
|
+
}),
|
|
406
|
+
resolve: (e) => {
|
|
407
|
+
let n = l(e), r = t.value.map((e) => e.id);
|
|
408
|
+
return {
|
|
409
|
+
order: [...n.columnOrder, ...r.filter((e) => !n.columnOrder.includes(e))],
|
|
410
|
+
visible: r.filter((e) => n.columnVisibility[e]),
|
|
411
|
+
widths: n.columnSizing,
|
|
412
|
+
pinned: {
|
|
413
|
+
left: n.columnPinning.start,
|
|
414
|
+
right: n.columnPinning.end
|
|
415
|
+
}
|
|
416
|
+
};
|
|
417
|
+
},
|
|
418
|
+
colsVar: E,
|
|
419
|
+
offsetVars: D,
|
|
420
|
+
minWidth: ee,
|
|
421
|
+
resizing: n(() => {
|
|
422
|
+
let e = d.atoms.columnResizing.get().isResizingColumn;
|
|
423
|
+
return e ? {
|
|
424
|
+
id: e,
|
|
425
|
+
size: d.getColumn(e)?.getSize() ?? 0
|
|
426
|
+
} : null;
|
|
427
|
+
}),
|
|
428
|
+
rowId: (e) => String(B(e, i.value)),
|
|
429
|
+
widthOf: (e) => d.getColumn(e)?.getSize() ?? 0,
|
|
430
|
+
setWidth: (e, t) => {
|
|
431
|
+
let n = r.value.get(e), i = n ? o(n) : 80, a = Math.min(n?.maxWidth ?? Infinity, Math.max(i, Math.round(t)));
|
|
432
|
+
d.setColumnSizing((t) => ({
|
|
433
|
+
...t,
|
|
434
|
+
[e]: a
|
|
435
|
+
}));
|
|
436
|
+
},
|
|
437
|
+
resetWidth: (e) => d.getColumn(e)?.resetSize(),
|
|
438
|
+
pin: (e, t) => d.getColumn(e)?.pin(t ?? !1),
|
|
439
|
+
setVisible: (e, t) => d.getColumn(e)?.toggleVisibility(t),
|
|
440
|
+
setOrder: (e) => d.setColumnOrder(e)
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
//#endregion
|
|
444
|
+
//#region src/core/cells/renderCell.ts
|
|
445
|
+
var yt = (e) => typeof e == "object" ? "dt-tone-custom" : `dt-tone-${e ?? "gray"}`, bt = (e) => typeof e == "object" ? {
|
|
446
|
+
"--dt-tone-light": e.light,
|
|
447
|
+
"--dt-tone-dark": e.dark
|
|
448
|
+
} : void 0, xt = [
|
|
449
|
+
"blue",
|
|
450
|
+
"green",
|
|
451
|
+
"amber",
|
|
452
|
+
"violet",
|
|
453
|
+
"pink",
|
|
454
|
+
"teal"
|
|
455
|
+
];
|
|
456
|
+
function St(e) {
|
|
457
|
+
let t = 0;
|
|
458
|
+
for (let n of String(e)) t = t * 31 + n.charCodeAt(0) >>> 0;
|
|
459
|
+
return xt[t % xt.length];
|
|
460
|
+
}
|
|
461
|
+
var Ct = (e) => e.split(/\s+/).filter(Boolean).slice(0, 2).map((e) => e[0].toLocaleUpperCase()).join("");
|
|
462
|
+
function V(e, t, n) {
|
|
463
|
+
return u("span", {
|
|
464
|
+
class: ["dt-badge", yt(e)],
|
|
465
|
+
style: bt(e)
|
|
466
|
+
}, [n ? u(n, {
|
|
467
|
+
class: "dt-badge-icon",
|
|
468
|
+
size: 11,
|
|
469
|
+
weight: "bold",
|
|
470
|
+
"aria-hidden": "true"
|
|
471
|
+
}) : u("span", {
|
|
472
|
+
class: "dt-badge-dot",
|
|
473
|
+
"aria-hidden": "true"
|
|
474
|
+
}), u("span", { class: "dt-badge-label" }, t)]);
|
|
475
|
+
}
|
|
476
|
+
var H = (e, t, n = "dt-more") => u("span", {
|
|
477
|
+
class: n,
|
|
478
|
+
"data-dt-tip": t
|
|
479
|
+
}, `+${e}`), U = (e) => u("span", { class: "dt-mono" }, e);
|
|
480
|
+
function wt(e) {
|
|
481
|
+
return u("span", {
|
|
482
|
+
class: ["dt-avatar", `dt-tone-${St(e.value)}`],
|
|
483
|
+
style: e.avatarUrl ? { backgroundImage: `url("${e.avatarUrl}")` } : void 0,
|
|
484
|
+
"aria-hidden": "true"
|
|
485
|
+
}, e.avatarUrl ? "" : e.initials ?? Ct(e.label));
|
|
486
|
+
}
|
|
487
|
+
function Tt(e, t, n) {
|
|
488
|
+
return u("span", {
|
|
489
|
+
class: "dt-stars",
|
|
490
|
+
role: "img",
|
|
491
|
+
"aria-label": n,
|
|
492
|
+
"data-dt-tip": n
|
|
493
|
+
}, Array.from({ length: t }, (t, n) => u(xe, {
|
|
494
|
+
size: 14,
|
|
495
|
+
weight: n < e ? "fill" : "regular",
|
|
496
|
+
class: n < e ? "is-on" : void 0
|
|
497
|
+
})));
|
|
498
|
+
}
|
|
499
|
+
function Et(e, t) {
|
|
500
|
+
return u("span", { class: "dt-bar" }, [u("span", {
|
|
501
|
+
class: "dt-bar-track",
|
|
502
|
+
"aria-hidden": "true"
|
|
503
|
+
}, [u("span", {
|
|
504
|
+
class: "dt-bar-fill",
|
|
505
|
+
style: { width: `${Math.max(0, Math.min(100, e))}%` }
|
|
506
|
+
})]), u("span", { class: "dt-bar-label" }, t)]);
|
|
507
|
+
}
|
|
508
|
+
var W = (e, t, n = !1) => u("a", {
|
|
509
|
+
class: "dt-link",
|
|
510
|
+
href: e,
|
|
511
|
+
tabindex: -1,
|
|
512
|
+
...n && {
|
|
513
|
+
target: "_blank",
|
|
514
|
+
rel: "noopener"
|
|
515
|
+
}
|
|
516
|
+
}, [t]);
|
|
517
|
+
function Dt(e, t) {
|
|
518
|
+
if (e.type !== "color" || e.display !== "fill" || typeof t != "string") return;
|
|
519
|
+
let n = /^#?([0-9a-f]{6})$/i.exec(t);
|
|
520
|
+
if (!n) return { background: t };
|
|
521
|
+
let r = parseInt(n[1], 16);
|
|
522
|
+
return {
|
|
523
|
+
background: t,
|
|
524
|
+
color: (.2126 * (r >> 16 & 255) + .7152 * (r >> 8 & 255) + .0722 * (r & 255)) / 255 > .55 ? "var(--dt-fill-text-dark)" : "var(--dt-fill-text-light)"
|
|
525
|
+
};
|
|
526
|
+
}
|
|
527
|
+
function Ot(e, t, n) {
|
|
528
|
+
return t.map((t) => e.options?.find((e) => e.value === t) ?? n.labels.option(e.id, e.remote, t) ?? {
|
|
529
|
+
value: t,
|
|
530
|
+
label: String(t)
|
|
531
|
+
});
|
|
532
|
+
}
|
|
533
|
+
function kt(e, t, n, r) {
|
|
534
|
+
let i = ot(e, t, n, r);
|
|
535
|
+
if (e.cell) return e.cell({
|
|
536
|
+
row: t,
|
|
537
|
+
value: n,
|
|
538
|
+
formatted: i,
|
|
539
|
+
column: {
|
|
540
|
+
id: e.id,
|
|
541
|
+
type: e.type
|
|
542
|
+
},
|
|
543
|
+
density: r.density
|
|
544
|
+
});
|
|
545
|
+
if (rt(n)) return e.type === "user" ? u("span", { class: "dt-user is-empty" }, [u("span", {
|
|
546
|
+
class: "dt-avatar is-empty",
|
|
547
|
+
"aria-hidden": "true"
|
|
548
|
+
}), r.i18n.t("common.unassigned")]) : u("span", { class: "dt-empty" }, i);
|
|
549
|
+
let { fmt: a, i18n: o } = r;
|
|
550
|
+
switch (e.type) {
|
|
551
|
+
case "int":
|
|
552
|
+
case "float": return i;
|
|
553
|
+
case "percentage": return e.display === "bar" ? Et(Number(n), i) : i;
|
|
554
|
+
case "star": return Tt(Number(n), e.max ?? 5, i);
|
|
555
|
+
case "currency": return [a.decimal(Number(n), e.decimalPlaces ?? 2), u("span", { class: "dt-ccy" }, at(e, t))];
|
|
556
|
+
case "string":
|
|
557
|
+
case "uppercase":
|
|
558
|
+
case "lowercase":
|
|
559
|
+
case "email": return i;
|
|
560
|
+
case "phone": return r.coarse ? W(`tel:${i}`, i) : i;
|
|
561
|
+
case "text": {
|
|
562
|
+
let e = i.split("\n")[0];
|
|
563
|
+
return u("span", { class: "dt-text" }, [u("span", { class: "dt-text-first" }, e), u("button", {
|
|
564
|
+
type: "button",
|
|
565
|
+
class: "dt-text-expand",
|
|
566
|
+
tabindex: -1,
|
|
567
|
+
"aria-label": o.t("cell.expandText"),
|
|
568
|
+
"data-dt-tip": i
|
|
569
|
+
}, [u(se, {
|
|
570
|
+
size: 14,
|
|
571
|
+
"aria-hidden": "true"
|
|
572
|
+
})])]);
|
|
573
|
+
}
|
|
574
|
+
case "color": return e.display === "fill" ? U(i) : [u("span", {
|
|
575
|
+
class: "dt-swatch",
|
|
576
|
+
style: { background: i },
|
|
577
|
+
"aria-hidden": "true"
|
|
578
|
+
}), U(i)];
|
|
579
|
+
case "url": return W(String(n), [it(String(n)), u(oe, {
|
|
580
|
+
size: 12,
|
|
581
|
+
class: "dt-link-icon",
|
|
582
|
+
"aria-hidden": "true"
|
|
583
|
+
})], !0);
|
|
584
|
+
case "id": {
|
|
585
|
+
let n = e.href?.(t);
|
|
586
|
+
return n ? W(n, U(i)) : U(i);
|
|
587
|
+
}
|
|
588
|
+
case "boolean": return n ? V("green", i, ue) : V(e.falseTone === "destructive" ? "red" : "gray", i, e.falseTone === "destructive" ? Ce : ve);
|
|
589
|
+
case "select": {
|
|
590
|
+
let t = e.options.find((e) => e.value === n);
|
|
591
|
+
return t ? V(t.tone, t.label) : V("gray", String(n));
|
|
592
|
+
}
|
|
593
|
+
case "multiselect": {
|
|
594
|
+
let t = n, r = t.slice(0, 2).map((t) => {
|
|
595
|
+
let n = e.options.find((e) => e.value === t);
|
|
596
|
+
return n ? V(n.tone, n.label) : V("gray", String(t));
|
|
597
|
+
});
|
|
598
|
+
return u("span", { class: "dt-badges" }, [...r, t.length > 2 ? H(t.length - 2, a.list(t.slice(2).map((t) => F(e.options, t)))) : null]);
|
|
599
|
+
}
|
|
600
|
+
case "ajax": {
|
|
601
|
+
let n = e.href?.(t);
|
|
602
|
+
return n ? W(n, i) : i;
|
|
603
|
+
}
|
|
604
|
+
case "user": {
|
|
605
|
+
let t = Ot(e, Array.isArray(n) ? n : [n], r);
|
|
606
|
+
return t.length === 1 ? u("span", { class: "dt-user" }, [wt(t[0]), u("span", { class: "dt-user-name" }, t[0].label)]) : u("span", { class: "dt-user dt-avatars" }, [...t.slice(0, 3).map(wt), t.length > 3 ? H(t.length - 3, a.list(t.slice(3).map((e) => e.label)), "dt-more dt-more-pill") : null]);
|
|
607
|
+
}
|
|
608
|
+
case "date":
|
|
609
|
+
case "datetime": {
|
|
610
|
+
let s = (typeof e.overdue == "function" ? e.overdue(t) : e.overdue) ? a.daysLate(n, r.today) : 0, c = e.type === "datetime" ? a.dateTimeFull(n) : void 0;
|
|
611
|
+
return s > 0 ? u("span", {
|
|
612
|
+
class: "dt-late",
|
|
613
|
+
"data-dt-tip": c
|
|
614
|
+
}, `${i} · ${o.t("cell.late", { count: s })}`) : c ? u("span", { "data-dt-tip": c }, i) : i;
|
|
615
|
+
}
|
|
616
|
+
case "object": return [u("span", {
|
|
617
|
+
class: "dt-struct",
|
|
618
|
+
"aria-hidden": "true"
|
|
619
|
+
}, "{ }"), i];
|
|
620
|
+
case "array": {
|
|
621
|
+
let t = n, r = t.slice(0, 3).map((t) => st(e.itemType, t, a));
|
|
622
|
+
return [
|
|
623
|
+
u("span", {
|
|
624
|
+
class: "dt-struct",
|
|
625
|
+
"aria-hidden": "true"
|
|
626
|
+
}, "[ ]"),
|
|
627
|
+
r.join(", "),
|
|
628
|
+
t.length > 3 ? [" ", H(t.length - 3, i)] : null
|
|
629
|
+
];
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
//#endregion
|
|
634
|
+
//#region src/core/format/parse.ts
|
|
635
|
+
var At = /* @__PURE__ */ new Map();
|
|
636
|
+
function jt(e) {
|
|
637
|
+
let t = At.get(e);
|
|
638
|
+
if (!t) {
|
|
639
|
+
let n = new Intl.NumberFormat(e).formatToParts(12345.6);
|
|
640
|
+
t = {
|
|
641
|
+
group: n.find((e) => e.type === "group")?.value ?? ",",
|
|
642
|
+
decimal: n.find((e) => e.type === "decimal")?.value ?? "."
|
|
643
|
+
}, At.set(e, t);
|
|
644
|
+
}
|
|
645
|
+
return t;
|
|
646
|
+
}
|
|
647
|
+
function Mt(e, t) {
|
|
648
|
+
let n = t.replace(/[\s%\u00a0A-Za-z₺€$£]/g, "").replace("−", "-");
|
|
649
|
+
if (n === "" || n === "-") return null;
|
|
650
|
+
let r = n.lastIndexOf(","), i = n.lastIndexOf("."), a = r >= 0 && i >= 0 ? r > i ? "," : "." : jt(e).decimal;
|
|
651
|
+
n = n.split(a === "," ? "." : ",").join(""), a === "," && (n = n.replace(",", "."));
|
|
652
|
+
let o = Number(n);
|
|
653
|
+
return Number.isFinite(o) ? o : null;
|
|
654
|
+
}
|
|
655
|
+
//#endregion
|
|
656
|
+
//#region src/core/filters/model.ts
|
|
657
|
+
var G = ["is_empty", "is_not_empty"], Nt = [
|
|
658
|
+
"eq",
|
|
659
|
+
"neq",
|
|
660
|
+
"gt",
|
|
661
|
+
"gte",
|
|
662
|
+
"lt",
|
|
663
|
+
"lte",
|
|
664
|
+
"between",
|
|
665
|
+
...G
|
|
666
|
+
], Pt = [
|
|
667
|
+
"contains",
|
|
668
|
+
"not_contains",
|
|
669
|
+
"eq",
|
|
670
|
+
"neq",
|
|
671
|
+
"starts_with",
|
|
672
|
+
"ends_with",
|
|
673
|
+
...G
|
|
674
|
+
], K = [
|
|
675
|
+
"in",
|
|
676
|
+
"not_in",
|
|
677
|
+
...G
|
|
678
|
+
], Ft = [
|
|
679
|
+
"within",
|
|
680
|
+
"eq",
|
|
681
|
+
"before",
|
|
682
|
+
"after",
|
|
683
|
+
...G
|
|
684
|
+
], It = [
|
|
685
|
+
"contains",
|
|
686
|
+
"eq",
|
|
687
|
+
"neq",
|
|
688
|
+
"starts_with",
|
|
689
|
+
...G
|
|
690
|
+
], Lt = {
|
|
691
|
+
int: Nt,
|
|
692
|
+
float: Nt,
|
|
693
|
+
percentage: [
|
|
694
|
+
"eq",
|
|
695
|
+
"gt",
|
|
696
|
+
"gte",
|
|
697
|
+
"lt",
|
|
698
|
+
"lte",
|
|
699
|
+
"between",
|
|
700
|
+
...G
|
|
701
|
+
],
|
|
702
|
+
star: [
|
|
703
|
+
"gte",
|
|
704
|
+
"lte",
|
|
705
|
+
"eq",
|
|
706
|
+
...G
|
|
707
|
+
],
|
|
708
|
+
currency: Nt,
|
|
709
|
+
string: Pt,
|
|
710
|
+
text: [
|
|
711
|
+
"contains",
|
|
712
|
+
"not_contains",
|
|
713
|
+
...G
|
|
714
|
+
],
|
|
715
|
+
uppercase: It,
|
|
716
|
+
lowercase: It,
|
|
717
|
+
phone: [
|
|
718
|
+
"contains",
|
|
719
|
+
"starts_with",
|
|
720
|
+
...G
|
|
721
|
+
],
|
|
722
|
+
color: K,
|
|
723
|
+
email: [
|
|
724
|
+
"contains",
|
|
725
|
+
"eq",
|
|
726
|
+
"ends_with",
|
|
727
|
+
...G
|
|
728
|
+
],
|
|
729
|
+
url: ["contains", ...G],
|
|
730
|
+
id: [
|
|
731
|
+
"in",
|
|
732
|
+
"contains",
|
|
733
|
+
...G
|
|
734
|
+
],
|
|
735
|
+
boolean: ["eq", ...G],
|
|
736
|
+
select: K,
|
|
737
|
+
multiselect: K,
|
|
738
|
+
ajax: K,
|
|
739
|
+
user: K,
|
|
740
|
+
date: Ft,
|
|
741
|
+
datetime: Ft,
|
|
742
|
+
object: [],
|
|
743
|
+
array: ["contains", ...G]
|
|
744
|
+
}, Rt = {
|
|
745
|
+
int: "between",
|
|
746
|
+
float: "between",
|
|
747
|
+
percentage: "between",
|
|
748
|
+
currency: "between",
|
|
749
|
+
star: "gte",
|
|
750
|
+
id: "in",
|
|
751
|
+
boolean: "eq",
|
|
752
|
+
date: "within",
|
|
753
|
+
datetime: "within"
|
|
754
|
+
}, zt = (e) => e.filter?.operators ?? Lt[e.type], Bt = (e) => e.filter?.defaultOperator ?? Rt[e.type] ?? zt(e)[0] ?? "is_empty";
|
|
755
|
+
function q(e, t) {
|
|
756
|
+
return e === "is_empty" || e === "is_not_empty" ? "none" : e === "in" || e === "not_in" ? "list" : e === "between" ? "range" : e === "within" ? "dateRange" : e === "before" || e === "after" || t === "date" || t === "datetime" ? "date" : t === "boolean" ? "boolean" : e === "gt" || e === "gte" || e === "lt" || e === "lte" || t === "int" || t === "float" || t === "percentage" || t === "currency" || t === "star" ? "number" : "text";
|
|
757
|
+
}
|
|
758
|
+
function Vt(e, t) {
|
|
759
|
+
let n = q(e, t);
|
|
760
|
+
return n === "none" || n === "boolean" ? null : n === "list" ? t === "id" ? "text" : "options" : n === "text" ? "text" : n === "date" || n === "dateRange" ? "date" : t === "star" ? "star" : "number";
|
|
761
|
+
}
|
|
762
|
+
var J = (e) => !!e && typeof e == "object";
|
|
763
|
+
function Ht(e, t) {
|
|
764
|
+
let n = e.value;
|
|
765
|
+
switch (q(e.op, t)) {
|
|
766
|
+
case "none": return !0;
|
|
767
|
+
case "list": return Array.isArray(n) && n.length > 0;
|
|
768
|
+
case "range": return Array.isArray(n) && (n[0] !== null && n[0] !== void 0 || n[1] !== null && n[1] !== void 0);
|
|
769
|
+
case "text": return typeof n == "string" && n !== "";
|
|
770
|
+
case "number": return typeof n == "number" && Number.isFinite(n);
|
|
771
|
+
case "boolean": return typeof n == "boolean";
|
|
772
|
+
case "date": return typeof n == "string" && n !== "" || J(n) && n.preset === "today";
|
|
773
|
+
case "dateRange": return J(n) && (typeof n.preset == "string" || typeof n.from == "string" && typeof n.to == "string");
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
function Ut(e) {
|
|
777
|
+
let t = {
|
|
778
|
+
column: e.column,
|
|
779
|
+
op: e.op
|
|
780
|
+
};
|
|
781
|
+
return e.value !== void 0 && q(e.op, "string") !== "none" && (t.value = e.value), e.currency && (t.currency = e.currency), t;
|
|
782
|
+
}
|
|
783
|
+
function Wt(e, t, n) {
|
|
784
|
+
let r = q(t, n), i = r !== "none" && r === q(e.op, n);
|
|
785
|
+
return {
|
|
786
|
+
...e,
|
|
787
|
+
op: t,
|
|
788
|
+
value: i ? e.value : void 0
|
|
789
|
+
};
|
|
790
|
+
}
|
|
791
|
+
function Gt(e, t, n, r = 1) {
|
|
792
|
+
return t === "in" || t === "not_in" ? e.t(`op.${t}`, { count: Math.max(1, r) }) : n === "star" && (t === "gte" || t === "lte") ? e.t(`op.star.${t}`) : e.t(`op.${t}`);
|
|
793
|
+
}
|
|
794
|
+
var Y = (e) => `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}`, X = (e, t) => new Date(e.getFullYear(), e.getMonth(), e.getDate() + t), Kt = (e) => {
|
|
795
|
+
try {
|
|
796
|
+
let t = new Intl.Locale(e);
|
|
797
|
+
return t.getWeekInfo?.().firstDay ?? t.weekInfo?.firstDay ?? 1;
|
|
798
|
+
} catch {
|
|
799
|
+
return 1;
|
|
800
|
+
}
|
|
801
|
+
};
|
|
802
|
+
function qt(e, t, n = /* @__PURE__ */ new Date()) {
|
|
803
|
+
let r = new Date(n.getFullYear(), n.getMonth(), n.getDate());
|
|
804
|
+
switch (e) {
|
|
805
|
+
case "today": return {
|
|
806
|
+
from: Y(r),
|
|
807
|
+
to: Y(r)
|
|
808
|
+
};
|
|
809
|
+
case "this_week": {
|
|
810
|
+
let e = X(r, -((r.getDay() - Kt(t) % 7 + 7) % 7));
|
|
811
|
+
return {
|
|
812
|
+
from: Y(e),
|
|
813
|
+
to: Y(X(e, 6))
|
|
814
|
+
};
|
|
815
|
+
}
|
|
816
|
+
case "next_7_days": return {
|
|
817
|
+
from: Y(r),
|
|
818
|
+
to: Y(X(r, 7))
|
|
819
|
+
};
|
|
820
|
+
case "this_month": return {
|
|
821
|
+
from: Y(new Date(r.getFullYear(), r.getMonth(), 1)),
|
|
822
|
+
to: Y(new Date(r.getFullYear(), r.getMonth() + 1, 0))
|
|
823
|
+
};
|
|
824
|
+
case "last_30_days": return {
|
|
825
|
+
from: Y(X(r, -30)),
|
|
826
|
+
to: Y(r)
|
|
827
|
+
};
|
|
828
|
+
case "this_quarter": {
|
|
829
|
+
let e = Math.floor(r.getMonth() / 3) * 3;
|
|
830
|
+
return {
|
|
831
|
+
from: Y(new Date(r.getFullYear(), e, 1)),
|
|
832
|
+
to: Y(new Date(r.getFullYear(), e + 3, 0))
|
|
833
|
+
};
|
|
834
|
+
}
|
|
835
|
+
case "overdue": return {
|
|
836
|
+
from: null,
|
|
837
|
+
to: Y(X(r, -1))
|
|
838
|
+
};
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
var Z = (e) => e instanceof Date ? Y(e) : typeof e == "string" && e.length >= 10 ? e.slice(0, 10) : null, Jt = (e, t) => typeof e == "string" ? e.slice(0, 10) : Y(t), Yt = (e) => e == null || e === "" || Array.isArray(e) && e.length === 0, Q = (e, t) => String(e).toLocaleLowerCase(t);
|
|
842
|
+
function Xt(e, t, n) {
|
|
843
|
+
let r = n.now ?? /* @__PURE__ */ new Date();
|
|
844
|
+
switch (e.op) {
|
|
845
|
+
case "is_empty": return Yt(t);
|
|
846
|
+
case "is_not_empty": return !Yt(t);
|
|
847
|
+
}
|
|
848
|
+
if (Yt(t)) return !1;
|
|
849
|
+
switch (e.op) {
|
|
850
|
+
case "eq":
|
|
851
|
+
case "neq": {
|
|
852
|
+
let r = Z(t), i = typeof e.value == "string" && r && /^\d{4}-\d{2}-\d{2}/.test(e.value) ? r === e.value.slice(0, 10) : typeof t == "string" && typeof e.value == "string" ? Q(t, n.locale) === Q(e.value, n.locale) : t === e.value || String(t) === String(e.value);
|
|
853
|
+
return e.op === "eq" ? i : !i;
|
|
854
|
+
}
|
|
855
|
+
case "gt": return Number(t) > e.value;
|
|
856
|
+
case "gte": return Number(t) >= e.value;
|
|
857
|
+
case "lt": return Number(t) < e.value;
|
|
858
|
+
case "lte": return Number(t) <= e.value;
|
|
859
|
+
case "between": {
|
|
860
|
+
let n = Number(t), [r, i] = e.value;
|
|
861
|
+
return (r === null || n >= r) && (i === null || n <= i);
|
|
862
|
+
}
|
|
863
|
+
case "contains":
|
|
864
|
+
case "not_contains":
|
|
865
|
+
case "starts_with":
|
|
866
|
+
case "ends_with": {
|
|
867
|
+
let r = Q(e.value, n.locale), i = (Array.isArray(t) ? t : [t]).some((t) => {
|
|
868
|
+
let i = Q(t, n.locale);
|
|
869
|
+
return e.op === "starts_with" ? i.startsWith(r) : e.op === "ends_with" ? i.endsWith(r) : i.includes(r);
|
|
870
|
+
});
|
|
871
|
+
return e.op === "not_contains" ? !i : i;
|
|
872
|
+
}
|
|
873
|
+
case "in":
|
|
874
|
+
case "not_in": {
|
|
875
|
+
let n = new Set(e.value.map(String)), r = (Array.isArray(t) ? t : [t]).some((e) => n.has(String(e)));
|
|
876
|
+
return e.op === "in" ? r : !r;
|
|
877
|
+
}
|
|
878
|
+
case "before": return (Z(t) ?? "") < Jt(e.value, r);
|
|
879
|
+
case "after": return (Z(t) ?? "") > Jt(e.value, r);
|
|
880
|
+
case "within": {
|
|
881
|
+
let i = Z(t);
|
|
882
|
+
if (!i) return !1;
|
|
883
|
+
let a = "preset" in e.value ? qt(e.value.preset, n.locale, r) : e.value;
|
|
884
|
+
return (a.from === null || i >= a.from) && (a.to === null || i <= a.to);
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
var Zt = (e, t) => Math.abs(t) >= 1e3 ? e.compact(t) : e.decimal(t, Number.isInteger(t) ? 0 : 2);
|
|
889
|
+
function Qt(e, t, n) {
|
|
890
|
+
let { i18n: r, fmt: i } = n, a = t.type, o = e.value, s = a === "percentage" ? "%" : e.currency ? ` ${e.currency}` : "", c = (e) => `${Zt(i, e)}${s}`;
|
|
891
|
+
switch (q(e.op, a)) {
|
|
892
|
+
case "none": return { text: "" };
|
|
893
|
+
case "boolean": return { text: r.t(o ? "common.yes" : "common.no") };
|
|
894
|
+
case "number": return { text: typeof o == "number" ? c(o) : "" };
|
|
895
|
+
case "text": return typeof o == "string" && o ? {
|
|
896
|
+
text: `“${o}”`,
|
|
897
|
+
full: o
|
|
898
|
+
} : { text: "" };
|
|
899
|
+
case "range": {
|
|
900
|
+
if (!Array.isArray(o)) return { text: "" };
|
|
901
|
+
let [e, t] = o;
|
|
902
|
+
return e != null && t != null ? { text: `${Zt(i, e)} – ${c(t)}` } : e == null ? t == null ? { text: "" } : { text: `≤ ${c(t)}` } : { text: `≥ ${c(e)}` };
|
|
903
|
+
}
|
|
904
|
+
case "date": return typeof o == "string" && o ? { text: i.date(o, n.today) } : J(o) && o.preset === "today" ? { text: r.t("date.today") } : { text: "" };
|
|
905
|
+
case "dateRange": {
|
|
906
|
+
if (!J(o)) return { text: "" };
|
|
907
|
+
if (typeof o.preset == "string") return { text: r.t(`date.${o.preset}`) };
|
|
908
|
+
let e = String(o.from), t = String(o.to), a = e.slice(0, 7) === t.slice(0, 7) ? String(Number(t.slice(8, 10))) : i.date(t, n.today);
|
|
909
|
+
return { text: `${i.date(e, n.today)} – ${a}` };
|
|
910
|
+
}
|
|
911
|
+
case "list": {
|
|
912
|
+
let e = Array.isArray(o) ? o : [];
|
|
913
|
+
if (e.length === 0) return { text: "" };
|
|
914
|
+
let i = e.map((e) => e === "@me" ? r.t("common.me") : n.labelOf(e));
|
|
915
|
+
if (a === "user") {
|
|
916
|
+
let t = e.map((e, t) => ({
|
|
917
|
+
value: e,
|
|
918
|
+
label: i[t]
|
|
919
|
+
}));
|
|
920
|
+
return {
|
|
921
|
+
text: e.length === 1 ? i[0] : r.t("chip.people", { count: e.length }),
|
|
922
|
+
full: i.join(", "),
|
|
923
|
+
people: t
|
|
924
|
+
};
|
|
925
|
+
}
|
|
926
|
+
if (e.length <= 2) return {
|
|
927
|
+
text: i.join(", "),
|
|
928
|
+
full: i.join(", ")
|
|
929
|
+
};
|
|
930
|
+
let s = t.filterNoun;
|
|
931
|
+
return {
|
|
932
|
+
text: s ? r.t("chip.noun", {
|
|
933
|
+
count: e.length,
|
|
934
|
+
noun: s
|
|
935
|
+
}) : r.t("chip.values", { count: e.length }),
|
|
936
|
+
full: i.join(", ")
|
|
937
|
+
};
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
//#endregion
|
|
942
|
+
//#region src/core/interaction/isInteractive.ts
|
|
943
|
+
var $t = "a[href], button, input, select, textarea, summary, label, [role=\"button\"], [role=\"menuitem\"], [role=\"checkbox\"], [role=\"combobox\"], [role=\"switch\"], [contenteditable=\"true\"]";
|
|
944
|
+
function en(e, t) {
|
|
945
|
+
if (!(e instanceof Element)) return !1;
|
|
946
|
+
let n = e.closest($t);
|
|
947
|
+
return n !== null && n !== t && t.contains(n);
|
|
948
|
+
}
|
|
949
|
+
var tn = (e) => e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement || e?.getAttribute("role") === "combobox" || e?.isContentEditable === !0, nn = () => (globalThis.getSelection?.()?.toString().length ?? 0) > 0;
|
|
950
|
+
function rn(e, t, n) {
|
|
951
|
+
return !(e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || en(e.target, t) || nn() || n && Math.hypot(e.clientX - n.x, e.clientY - n.y) > 4);
|
|
952
|
+
}
|
|
953
|
+
//#endregion
|
|
954
|
+
//#region src/core/interaction/kbd.ts
|
|
955
|
+
var $ = typeof navigator < "u" && /Mac|iPhone|iPad/.test(navigator.platform), an = {
|
|
956
|
+
left: $ ? "⌥⇧←" : "Alt+Shift+←",
|
|
957
|
+
right: $ ? "⌥⇧→" : "Alt+Shift+→"
|
|
958
|
+
}, on = $ ? "⌘S" : "Ctrl+S", sn = $ ? "⌘Z" : "Ctrl+Z", cn = $ ? "⌘⇧Z" : "Ctrl+Y", ln = $ ? "⌘F" : "Ctrl+F", un = $ ? "⌘D" : "Ctrl+D", dn = $ ? "⌘−" : "Ctrl+−", fn = (e, t) => e.filter((e) => e.inline && e.icon && (!e.when || e.when(t))).slice(0, 2), pn = ["aria-label", "data-dt-tip"], mn = [
|
|
959
|
+
"aria-label",
|
|
960
|
+
"aria-disabled",
|
|
961
|
+
"data-dt-tip",
|
|
962
|
+
"onClick"
|
|
963
|
+
], hn = ["aria-label", "data-dt-tip"], gn = /* @__PURE__ */ l({
|
|
964
|
+
__name: "CellActions",
|
|
965
|
+
props: {
|
|
966
|
+
actions: {},
|
|
967
|
+
row: {}
|
|
968
|
+
},
|
|
969
|
+
setup(l) {
|
|
970
|
+
let u = l, { i18n: d } = e(), p = n(() => u.actions.filter((e) => e.when?.(u.row) ?? !0)), m = n(() => p.value.some((e) => e.reveal === "always")), h = n(() => p.value.length > 2 ? p.value.slice(0, 1) : p.value), _ = n(() => p.value.length > 2 ? p.value.slice(1) : []), v = (e) => e.disabled?.(u.row) ?? !1, b = (e) => {
|
|
971
|
+
let t = v(e);
|
|
972
|
+
return typeof t == "string" ? `${e.label} — ${t}` : e.label;
|
|
973
|
+
}, S = (e) => {
|
|
974
|
+
v(e) || e.run?.(w(u.row));
|
|
975
|
+
};
|
|
976
|
+
return (e, n) => p.value.length ? (g(), a("span", {
|
|
977
|
+
key: 0,
|
|
978
|
+
class: f(["dt-cell-actions", { "is-always": m.value }])
|
|
979
|
+
}, [(g(!0), a(t, null, y(h.value, (e) => (g(), a(t, { key: e.id }, [e.menu?.length ? (g(), r(E(Be), { key: 0 }, {
|
|
980
|
+
default: k(() => [c(E(He), { "as-child": "" }, {
|
|
981
|
+
default: k(() => [o("button", {
|
|
982
|
+
type: "button",
|
|
983
|
+
class: f(["dt-cell-action", { "is-destructive": e.destructive }]),
|
|
984
|
+
tabindex: "-1",
|
|
985
|
+
"aria-label": e.label,
|
|
986
|
+
"data-dt-tip": e.label
|
|
987
|
+
}, [(g(), r(x(e.icon), {
|
|
988
|
+
size: 14,
|
|
989
|
+
"aria-hidden": "true"
|
|
990
|
+
}))], 10, pn)]),
|
|
991
|
+
_: 2
|
|
992
|
+
}, 1024), c(E(ze), null, {
|
|
993
|
+
default: k(() => [c(E(A), {
|
|
994
|
+
class: "dt-menu dt-menu-cell",
|
|
995
|
+
align: "end",
|
|
996
|
+
"side-offset": 4
|
|
997
|
+
}, {
|
|
998
|
+
default: k(() => [(g(!0), a(t, null, y(e.menu, (e) => (g(), r(E(j), {
|
|
999
|
+
key: e.id,
|
|
1000
|
+
class: f(["dt-menu-item", { "is-destructive": e.destructive }]),
|
|
1001
|
+
disabled: !!v(e),
|
|
1002
|
+
onSelect: (t) => S(e)
|
|
1003
|
+
}, {
|
|
1004
|
+
default: k(() => [(g(), r(x(e.icon), {
|
|
1005
|
+
size: 16,
|
|
1006
|
+
"aria-hidden": "true"
|
|
1007
|
+
})), s(" " + C(e.label), 1)]),
|
|
1008
|
+
_: 2
|
|
1009
|
+
}, 1032, [
|
|
1010
|
+
"class",
|
|
1011
|
+
"disabled",
|
|
1012
|
+
"onSelect"
|
|
1013
|
+
]))), 128))]),
|
|
1014
|
+
_: 2
|
|
1015
|
+
}, 1024)]),
|
|
1016
|
+
_: 2
|
|
1017
|
+
}, 1024)]),
|
|
1018
|
+
_: 2
|
|
1019
|
+
}, 1024)) : (g(), a("button", {
|
|
1020
|
+
key: 1,
|
|
1021
|
+
type: "button",
|
|
1022
|
+
class: f(["dt-cell-action", { "is-destructive": e.destructive }]),
|
|
1023
|
+
tabindex: "-1",
|
|
1024
|
+
"aria-label": e.label,
|
|
1025
|
+
"aria-disabled": v(e) ? "true" : void 0,
|
|
1026
|
+
"data-dt-tip": b(e),
|
|
1027
|
+
onClick: (t) => S(e)
|
|
1028
|
+
}, [(g(), r(x(e.icon), {
|
|
1029
|
+
size: 14,
|
|
1030
|
+
"aria-hidden": "true"
|
|
1031
|
+
}))], 10, mn))], 64))), 128)), _.value.length ? (g(), r(E(Be), { key: 0 }, {
|
|
1032
|
+
default: k(() => [c(E(He), { "as-child": "" }, {
|
|
1033
|
+
default: k(() => [o("button", {
|
|
1034
|
+
type: "button",
|
|
1035
|
+
class: "dt-cell-action",
|
|
1036
|
+
tabindex: "-1",
|
|
1037
|
+
"aria-label": E(d).t("common.more"),
|
|
1038
|
+
"data-dt-tip": E(d).t("common.more")
|
|
1039
|
+
}, [c(E(de), {
|
|
1040
|
+
size: 14,
|
|
1041
|
+
weight: "bold",
|
|
1042
|
+
"aria-hidden": "true"
|
|
1043
|
+
})], 8, hn)]),
|
|
1044
|
+
_: 1
|
|
1045
|
+
}), c(E(ze), null, {
|
|
1046
|
+
default: k(() => [c(E(A), {
|
|
1047
|
+
class: "dt-menu dt-menu-cell",
|
|
1048
|
+
align: "end",
|
|
1049
|
+
"side-offset": 4
|
|
1050
|
+
}, {
|
|
1051
|
+
default: k(() => [(g(!0), a(t, null, y(_.value, (e) => (g(), r(E(j), {
|
|
1052
|
+
key: e.id,
|
|
1053
|
+
class: f(["dt-menu-item", { "is-destructive": e.destructive }]),
|
|
1054
|
+
disabled: !!v(e),
|
|
1055
|
+
onSelect: (t) => S(e)
|
|
1056
|
+
}, {
|
|
1057
|
+
default: k(() => [(g(), r(x(e.icon), {
|
|
1058
|
+
size: 16,
|
|
1059
|
+
"aria-hidden": "true"
|
|
1060
|
+
})), s(" " + C(e.label), 1)]),
|
|
1061
|
+
_: 2
|
|
1062
|
+
}, 1032, [
|
|
1063
|
+
"class",
|
|
1064
|
+
"disabled",
|
|
1065
|
+
"onSelect"
|
|
1066
|
+
]))), 128))]),
|
|
1067
|
+
_: 1
|
|
1068
|
+
})]),
|
|
1069
|
+
_: 1
|
|
1070
|
+
})]),
|
|
1071
|
+
_: 1
|
|
1072
|
+
})) : i("", !0)], 2)) : i("", !0);
|
|
1073
|
+
}
|
|
1074
|
+
}), _n = {
|
|
1075
|
+
key: 0,
|
|
1076
|
+
class: "dt-row-more-space",
|
|
1077
|
+
"aria-hidden": "true"
|
|
1078
|
+
}, vn = ["aria-label"], yn = ["href"], bn = ["href"], xn = { class: "dt-menu-text" }, Sn = {
|
|
1079
|
+
key: 0,
|
|
1080
|
+
class: "dt-menu-sub"
|
|
1081
|
+
}, Cn = {
|
|
1082
|
+
key: 1,
|
|
1083
|
+
class: "dt-kbd"
|
|
1084
|
+
}, wn = /* @__PURE__ */ l({
|
|
1085
|
+
__name: "RowMenu",
|
|
1086
|
+
props: {
|
|
1087
|
+
row: {},
|
|
1088
|
+
label: {},
|
|
1089
|
+
primaryHeader: {},
|
|
1090
|
+
href: {},
|
|
1091
|
+
actions: {},
|
|
1092
|
+
open: { type: Boolean }
|
|
1093
|
+
},
|
|
1094
|
+
emits: [
|
|
1095
|
+
"update:open",
|
|
1096
|
+
"open",
|
|
1097
|
+
"copy"
|
|
1098
|
+
],
|
|
1099
|
+
setup(l, { emit: u }) {
|
|
1100
|
+
let d = l, p = u, { i18n: m } = e(), h = n(() => {
|
|
1101
|
+
let e = new Set(fn(d.actions, d.row)), t = d.actions.filter((t) => !e.has(t) && (!t.when || t.when(d.row)));
|
|
1102
|
+
return [...t.filter((e) => !e.destructive), ...t.filter((e) => e.destructive)];
|
|
1103
|
+
}), _ = n(() => !!d.href || !!d.primaryHeader || h.value.length > 0), v = n(() => h.value.findIndex((e) => e.destructive)), b = (e) => {
|
|
1104
|
+
let t = e.disabled?.(d.row);
|
|
1105
|
+
return typeof t == "string" ? t : e.description ?? null;
|
|
1106
|
+
}, S = (e) => !!e.disabled?.(d.row), T = (e) => {
|
|
1107
|
+
S(e) || e.run(w(d.row));
|
|
1108
|
+
}, D = (e) => {
|
|
1109
|
+
e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && !e.altKey && p("open", e);
|
|
1110
|
+
};
|
|
1111
|
+
return (e, n) => _.value ? (g(), r(E(Be), {
|
|
1112
|
+
key: 1,
|
|
1113
|
+
open: l.open,
|
|
1114
|
+
"onUpdate:open": n[2] ||= (e) => p("update:open", e)
|
|
1115
|
+
}, {
|
|
1116
|
+
default: k(() => [c(E(He), { "as-child": "" }, {
|
|
1117
|
+
default: k(() => [o("button", {
|
|
1118
|
+
type: "button",
|
|
1119
|
+
class: "dt-row-more",
|
|
1120
|
+
tabindex: "-1",
|
|
1121
|
+
"aria-label": E(m).t("row.actionsAria", { id: l.label }),
|
|
1122
|
+
onKeydown: n[0] ||= ne(re(() => {}, ["stop"]), ["enter", "space"])
|
|
1123
|
+
}, [c(E(de), {
|
|
1124
|
+
size: 16,
|
|
1125
|
+
weight: "bold",
|
|
1126
|
+
"aria-hidden": "true"
|
|
1127
|
+
})], 40, vn)]),
|
|
1128
|
+
_: 1
|
|
1129
|
+
}), c(E(ze), null, {
|
|
1130
|
+
default: k(() => [c(E(A), {
|
|
1131
|
+
class: "dt-menu dt-row-menu",
|
|
1132
|
+
align: "end",
|
|
1133
|
+
"side-offset": 4
|
|
1134
|
+
}, {
|
|
1135
|
+
default: k(() => [
|
|
1136
|
+
l.href ? (g(), a(t, { key: 0 }, [c(E(j), {
|
|
1137
|
+
"as-child": "",
|
|
1138
|
+
class: "dt-menu-item"
|
|
1139
|
+
}, {
|
|
1140
|
+
default: k(() => [o("a", {
|
|
1141
|
+
href: l.href,
|
|
1142
|
+
onClick: D
|
|
1143
|
+
}, [s(C(E(m).t("row.open")) + " ", 1), n[3] ||= o("kbd", { class: "dt-kbd" }, "↵", -1)], 8, yn)]),
|
|
1144
|
+
_: 1
|
|
1145
|
+
}), c(E(j), {
|
|
1146
|
+
"as-child": "",
|
|
1147
|
+
class: "dt-menu-item"
|
|
1148
|
+
}, {
|
|
1149
|
+
default: k(() => [o("a", {
|
|
1150
|
+
href: l.href,
|
|
1151
|
+
target: "_blank",
|
|
1152
|
+
rel: "noopener"
|
|
1153
|
+
}, C(E(m).t("row.openNewTab")), 9, bn)]),
|
|
1154
|
+
_: 1
|
|
1155
|
+
})], 64)) : i("", !0),
|
|
1156
|
+
l.primaryHeader ? (g(), r(E(j), {
|
|
1157
|
+
key: 1,
|
|
1158
|
+
class: "dt-menu-item",
|
|
1159
|
+
onSelect: n[1] ||= (e) => p("copy")
|
|
1160
|
+
}, {
|
|
1161
|
+
default: k(() => [s(C(E(m).t("row.copyId", { column: l.primaryHeader })), 1)]),
|
|
1162
|
+
_: 1
|
|
1163
|
+
})) : i("", !0),
|
|
1164
|
+
(l.href || l.primaryHeader) && h.value.length ? (g(), r(E(Ve), {
|
|
1165
|
+
key: 2,
|
|
1166
|
+
class: "dt-menu-sep"
|
|
1167
|
+
})) : i("", !0),
|
|
1168
|
+
(g(!0), a(t, null, y(h.value, (e, n) => (g(), a(t, { key: e.id }, [e.separatorBefore || n === v.value ? (g(), r(E(Ve), {
|
|
1169
|
+
key: 0,
|
|
1170
|
+
class: "dt-menu-sep"
|
|
1171
|
+
})) : i("", !0), c(E(j), {
|
|
1172
|
+
class: f(["dt-menu-item", {
|
|
1173
|
+
"is-destructive": e.destructive,
|
|
1174
|
+
"is-two-line": b(e)
|
|
1175
|
+
}]),
|
|
1176
|
+
disabled: S(e),
|
|
1177
|
+
onSelect: (t) => T(e)
|
|
1178
|
+
}, {
|
|
1179
|
+
default: k(() => [
|
|
1180
|
+
e.icon ? (g(), r(x(e.icon), {
|
|
1181
|
+
key: 0,
|
|
1182
|
+
size: 16,
|
|
1183
|
+
"aria-hidden": "true"
|
|
1184
|
+
})) : i("", !0),
|
|
1185
|
+
o("span", xn, [o("span", null, C(e.label), 1), b(e) ? (g(), a("span", Sn, C(b(e)), 1)) : i("", !0)]),
|
|
1186
|
+
e.shortcut ? (g(), a("kbd", Cn, C(e.shortcut), 1)) : i("", !0)
|
|
1187
|
+
]),
|
|
1188
|
+
_: 2
|
|
1189
|
+
}, 1032, [
|
|
1190
|
+
"class",
|
|
1191
|
+
"disabled",
|
|
1192
|
+
"onSelect"
|
|
1193
|
+
])], 64))), 128))
|
|
1194
|
+
]),
|
|
1195
|
+
_: 1
|
|
1196
|
+
})]),
|
|
1197
|
+
_: 1
|
|
1198
|
+
})]),
|
|
1199
|
+
_: 1
|
|
1200
|
+
}, 8, ["open"])) : (g(), a("span", _n));
|
|
1201
|
+
}
|
|
1202
|
+
}), Tn = l({
|
|
1203
|
+
name: "DtRow",
|
|
1204
|
+
props: {
|
|
1205
|
+
row: {
|
|
1206
|
+
type: Object,
|
|
1207
|
+
required: !0
|
|
1208
|
+
},
|
|
1209
|
+
index: {
|
|
1210
|
+
type: Number,
|
|
1211
|
+
required: !0
|
|
1212
|
+
},
|
|
1213
|
+
rowIndex: {
|
|
1214
|
+
type: Number,
|
|
1215
|
+
required: !0
|
|
1216
|
+
},
|
|
1217
|
+
columns: {
|
|
1218
|
+
type: Array,
|
|
1219
|
+
required: !0
|
|
1220
|
+
},
|
|
1221
|
+
env: {
|
|
1222
|
+
type: Object,
|
|
1223
|
+
required: !0
|
|
1224
|
+
},
|
|
1225
|
+
focused: {
|
|
1226
|
+
type: Boolean,
|
|
1227
|
+
default: !1
|
|
1228
|
+
},
|
|
1229
|
+
keyboardFocus: {
|
|
1230
|
+
type: Boolean,
|
|
1231
|
+
default: !1
|
|
1232
|
+
},
|
|
1233
|
+
secondaryVisible: {
|
|
1234
|
+
type: Boolean,
|
|
1235
|
+
default: !1
|
|
1236
|
+
},
|
|
1237
|
+
label: {
|
|
1238
|
+
type: String,
|
|
1239
|
+
default: ""
|
|
1240
|
+
},
|
|
1241
|
+
selectable: {
|
|
1242
|
+
type: Boolean,
|
|
1243
|
+
default: !1
|
|
1244
|
+
},
|
|
1245
|
+
selected: {
|
|
1246
|
+
type: Boolean,
|
|
1247
|
+
default: !1
|
|
1248
|
+
},
|
|
1249
|
+
selectEdge: {
|
|
1250
|
+
type: Boolean,
|
|
1251
|
+
default: !1
|
|
1252
|
+
},
|
|
1253
|
+
expandable: {
|
|
1254
|
+
type: Boolean,
|
|
1255
|
+
default: !1
|
|
1256
|
+
},
|
|
1257
|
+
canExpand: {
|
|
1258
|
+
type: Boolean,
|
|
1259
|
+
default: !1
|
|
1260
|
+
},
|
|
1261
|
+
expanded: {
|
|
1262
|
+
type: Boolean,
|
|
1263
|
+
default: !1
|
|
1264
|
+
},
|
|
1265
|
+
subrowId: {
|
|
1266
|
+
type: String,
|
|
1267
|
+
default: void 0
|
|
1268
|
+
},
|
|
1269
|
+
menu: {
|
|
1270
|
+
type: Boolean,
|
|
1271
|
+
default: !1
|
|
1272
|
+
},
|
|
1273
|
+
menuOpen: {
|
|
1274
|
+
type: Boolean,
|
|
1275
|
+
default: !1
|
|
1276
|
+
},
|
|
1277
|
+
menuEdge: {
|
|
1278
|
+
type: Boolean,
|
|
1279
|
+
default: !1
|
|
1280
|
+
},
|
|
1281
|
+
rowActions: {
|
|
1282
|
+
type: Array,
|
|
1283
|
+
default: () => []
|
|
1284
|
+
},
|
|
1285
|
+
error: {
|
|
1286
|
+
type: Array,
|
|
1287
|
+
default: () => []
|
|
1288
|
+
},
|
|
1289
|
+
uid: {
|
|
1290
|
+
type: String,
|
|
1291
|
+
default: ""
|
|
1292
|
+
},
|
|
1293
|
+
href: {
|
|
1294
|
+
type: String,
|
|
1295
|
+
default: void 0
|
|
1296
|
+
},
|
|
1297
|
+
primaryHeader: {
|
|
1298
|
+
type: String,
|
|
1299
|
+
default: void 0
|
|
1300
|
+
},
|
|
1301
|
+
style: {
|
|
1302
|
+
type: Object,
|
|
1303
|
+
default: void 0
|
|
1304
|
+
}
|
|
1305
|
+
},
|
|
1306
|
+
emits: [
|
|
1307
|
+
"select",
|
|
1308
|
+
"expand",
|
|
1309
|
+
"menu-open",
|
|
1310
|
+
"open",
|
|
1311
|
+
"copy"
|
|
1312
|
+
],
|
|
1313
|
+
setup(e, { emit: t }) {
|
|
1314
|
+
let n = null, r = () => {
|
|
1315
|
+
if (n) for (let e of n.querySelectorAll($t)) e.tabIndex !== -1 && (e.tabIndex = -1);
|
|
1316
|
+
};
|
|
1317
|
+
m(r), h(r);
|
|
1318
|
+
let i = (t, n) => e.env.i18n.t(t, n), a = () => e.error.join("\n"), o = () => `${e.uid}-err`, s = () => u("span", {
|
|
1319
|
+
id: o(),
|
|
1320
|
+
class: "dt-row-error",
|
|
1321
|
+
role: "img",
|
|
1322
|
+
"aria-label": a(),
|
|
1323
|
+
"data-dt-tip": a()
|
|
1324
|
+
}, [u(Se, {
|
|
1325
|
+
size: 14,
|
|
1326
|
+
weight: "fill",
|
|
1327
|
+
"aria-hidden": "true"
|
|
1328
|
+
})]), c = (t) => {
|
|
1329
|
+
let n = t.disabled?.(e.row), r = typeof n == "string" ? n : null, i = t.description ? `${e.uid}-${t.id}` : void 0;
|
|
1330
|
+
return u("span", { class: "dt-row-inline-wrap" }, [u("button", {
|
|
1331
|
+
type: "button",
|
|
1332
|
+
class: "dt-row-inline",
|
|
1333
|
+
tabindex: -1,
|
|
1334
|
+
disabled: !!n,
|
|
1335
|
+
"aria-label": t.label,
|
|
1336
|
+
"aria-describedby": i,
|
|
1337
|
+
"data-dt-tip": r ?? (t.description ? `${t.label} — ${t.description}` : t.label),
|
|
1338
|
+
onClick: () => void t.run(w(e.row)),
|
|
1339
|
+
onKeydown: (e) => {
|
|
1340
|
+
(e.key === "Enter" || e.key === " ") && e.stopPropagation();
|
|
1341
|
+
}
|
|
1342
|
+
}, [u(t.icon, {
|
|
1343
|
+
size: 16,
|
|
1344
|
+
"aria-hidden": "true"
|
|
1345
|
+
})]), i ? u("span", {
|
|
1346
|
+
id: i,
|
|
1347
|
+
class: "dt-sr-only"
|
|
1348
|
+
}, t.description) : null]);
|
|
1349
|
+
}, l = (n) => {
|
|
1350
|
+
let r = n.def, a = r.accessor ? r.accessor(e.row) : On(e.row, n.id), o = dt(r), c = kt(r, e.row, a, e.env), l = r.primary && r.type !== "id" && r.type !== "ajax" ? r.href?.(e.row) : void 0;
|
|
1351
|
+
l && (c = u("a", {
|
|
1352
|
+
class: "dt-link dt-primary-link",
|
|
1353
|
+
href: l,
|
|
1354
|
+
tabindex: -1
|
|
1355
|
+
}, [c]));
|
|
1356
|
+
let d = r.actions, f = u("span", { class: "dt-cell-content" }, [c]), p = e.secondaryVisible && r.secondary ? u("span", { class: "dt-secondary" }, r.secondary(e.row) ?? "") : null, m = d?.length ? u(gn, {
|
|
1357
|
+
actions: d,
|
|
1358
|
+
row: e.row
|
|
1359
|
+
}) : null, h = r.primary && e.expandable, g = e.error.length && !e.menu && n.id === e.columns[0]?.id ? s() : null, _ = h ? [
|
|
1360
|
+
e.canExpand ? u("button", {
|
|
1361
|
+
type: "button",
|
|
1362
|
+
class: ["dt-expand", { "is-open": e.expanded }],
|
|
1363
|
+
tabindex: -1,
|
|
1364
|
+
"aria-expanded": e.expanded ? "true" : "false",
|
|
1365
|
+
"aria-controls": e.subrowId,
|
|
1366
|
+
"aria-label": i("expand.showAria", { id: e.label }),
|
|
1367
|
+
onClick: () => t("expand")
|
|
1368
|
+
}, [u(le, {
|
|
1369
|
+
size: 14,
|
|
1370
|
+
"aria-hidden": "true"
|
|
1371
|
+
})]) : u("span", {
|
|
1372
|
+
class: "dt-expand-space",
|
|
1373
|
+
"aria-hidden": "true"
|
|
1374
|
+
}),
|
|
1375
|
+
g,
|
|
1376
|
+
u("span", { class: "dt-cell-main" }, [f, p]),
|
|
1377
|
+
m
|
|
1378
|
+
] : g ? [
|
|
1379
|
+
g,
|
|
1380
|
+
u("span", { class: "dt-cell-main" }, [f, p]),
|
|
1381
|
+
m
|
|
1382
|
+
] : [
|
|
1383
|
+
f,
|
|
1384
|
+
p,
|
|
1385
|
+
m
|
|
1386
|
+
];
|
|
1387
|
+
return u("div", {
|
|
1388
|
+
class: [
|
|
1389
|
+
"dt-cell",
|
|
1390
|
+
`is-${o}`,
|
|
1391
|
+
{
|
|
1392
|
+
"is-numeric": ut(r.type),
|
|
1393
|
+
"is-primary": r.primary,
|
|
1394
|
+
"has-expand": h || !!g,
|
|
1395
|
+
"is-pinned-start": n.pinned === "start",
|
|
1396
|
+
"is-pinned-end": n.pinned === "end",
|
|
1397
|
+
"is-pin-edge": n.pinEdge
|
|
1398
|
+
}
|
|
1399
|
+
],
|
|
1400
|
+
style: {
|
|
1401
|
+
...n.pinned === "start" ? { left: `var(${n.offsetVar})` } : n.pinned === "end" ? { right: `var(${n.offsetVar})` } : null,
|
|
1402
|
+
...Dt(r, a)
|
|
1403
|
+
},
|
|
1404
|
+
role: "gridcell",
|
|
1405
|
+
"data-col": n.id
|
|
1406
|
+
}, _);
|
|
1407
|
+
}, d = () => u("label", {
|
|
1408
|
+
class: [
|
|
1409
|
+
"dt-cell",
|
|
1410
|
+
"dt-cell-select",
|
|
1411
|
+
"is-pinned-start",
|
|
1412
|
+
{ "is-pin-edge": e.selectEdge }
|
|
1413
|
+
],
|
|
1414
|
+
style: { left: "0px" },
|
|
1415
|
+
role: "gridcell"
|
|
1416
|
+
}, [u("input", {
|
|
1417
|
+
type: "checkbox",
|
|
1418
|
+
class: "dt-checkbox dt-select-box",
|
|
1419
|
+
checked: e.selected,
|
|
1420
|
+
tabindex: -1,
|
|
1421
|
+
"aria-label": i("row.selectAria", { id: e.label }),
|
|
1422
|
+
onClick: (n) => t("select", !e.selected, n.shiftKey)
|
|
1423
|
+
})]), f = () => u("div", {
|
|
1424
|
+
class: [
|
|
1425
|
+
"dt-cell",
|
|
1426
|
+
"dt-cell-menu",
|
|
1427
|
+
"is-pinned-end",
|
|
1428
|
+
{ "is-pin-edge": e.menuEdge }
|
|
1429
|
+
],
|
|
1430
|
+
style: { right: "0px" },
|
|
1431
|
+
role: "gridcell"
|
|
1432
|
+
}, [
|
|
1433
|
+
e.error.length ? s() : null,
|
|
1434
|
+
...fn(e.rowActions, e.row).map(c),
|
|
1435
|
+
u(wn, {
|
|
1436
|
+
row: e.row,
|
|
1437
|
+
label: e.label,
|
|
1438
|
+
primaryHeader: e.primaryHeader,
|
|
1439
|
+
href: e.href,
|
|
1440
|
+
actions: e.rowActions,
|
|
1441
|
+
open: e.menuOpen,
|
|
1442
|
+
"onUpdate:open": (e) => t("menu-open", e),
|
|
1443
|
+
onOpen: (e) => t("open", e),
|
|
1444
|
+
onCopy: () => t("copy")
|
|
1445
|
+
})
|
|
1446
|
+
]), p = (e) => {
|
|
1447
|
+
n && !en(e.target, n) && (e.preventDefault(), t("menu-open", !0));
|
|
1448
|
+
};
|
|
1449
|
+
return () => u("div", {
|
|
1450
|
+
ref: (e) => n = e,
|
|
1451
|
+
class: ["dt-row", {
|
|
1452
|
+
"is-focus": e.focused && e.keyboardFocus,
|
|
1453
|
+
"is-selected": e.selected,
|
|
1454
|
+
"is-expanded": e.expanded,
|
|
1455
|
+
"is-error": e.error.length > 0
|
|
1456
|
+
}],
|
|
1457
|
+
role: "row",
|
|
1458
|
+
"aria-rowindex": e.rowIndex,
|
|
1459
|
+
"aria-describedby": e.error.length ? o() : void 0,
|
|
1460
|
+
"data-dt-tip": e.error.length ? a() : void 0,
|
|
1461
|
+
"aria-selected": e.selectable ? e.selected ? "true" : "false" : void 0,
|
|
1462
|
+
tabindex: e.focused ? 0 : -1,
|
|
1463
|
+
"data-index": e.index,
|
|
1464
|
+
style: e.style,
|
|
1465
|
+
onContextmenu: e.menu ? p : void 0
|
|
1466
|
+
}, [
|
|
1467
|
+
e.selectable ? d() : null,
|
|
1468
|
+
...Dn(e.columns, l),
|
|
1469
|
+
e.menu ? f() : null
|
|
1470
|
+
]);
|
|
1471
|
+
}
|
|
1472
|
+
}), En = () => u("div", {
|
|
1473
|
+
class: "dt-cell dt-cell-fill",
|
|
1474
|
+
role: "presentation",
|
|
1475
|
+
"aria-hidden": "true"
|
|
1476
|
+
});
|
|
1477
|
+
function Dn(e, t) {
|
|
1478
|
+
let n = e.findIndex((e) => e.pinned === "end"), r = n < 0 ? e.length : n;
|
|
1479
|
+
return [
|
|
1480
|
+
...e.slice(0, r).map(t),
|
|
1481
|
+
En(),
|
|
1482
|
+
...e.slice(r).map(t)
|
|
1483
|
+
];
|
|
1484
|
+
}
|
|
1485
|
+
function On(e, t) {
|
|
1486
|
+
let n = e;
|
|
1487
|
+
for (let e of t.split(".")) {
|
|
1488
|
+
if (n == null) return;
|
|
1489
|
+
n = n[e];
|
|
1490
|
+
}
|
|
1491
|
+
return n;
|
|
1492
|
+
}
|
|
1493
|
+
//#endregion
|
|
1494
|
+
//#region src/core/grid/SkeletonRow.ts
|
|
1495
|
+
var kn = [
|
|
1496
|
+
72,
|
|
1497
|
+
58,
|
|
1498
|
+
80,
|
|
1499
|
+
64,
|
|
1500
|
+
55,
|
|
1501
|
+
76,
|
|
1502
|
+
61,
|
|
1503
|
+
69
|
|
1504
|
+
], An = l({
|
|
1505
|
+
name: "DtSkeletonRow",
|
|
1506
|
+
props: {
|
|
1507
|
+
index: {
|
|
1508
|
+
type: Number,
|
|
1509
|
+
required: !0
|
|
1510
|
+
},
|
|
1511
|
+
columns: {
|
|
1512
|
+
type: Array,
|
|
1513
|
+
required: !0
|
|
1514
|
+
},
|
|
1515
|
+
style: {
|
|
1516
|
+
type: Object,
|
|
1517
|
+
default: void 0
|
|
1518
|
+
},
|
|
1519
|
+
gutter: {
|
|
1520
|
+
type: Boolean,
|
|
1521
|
+
default: !1
|
|
1522
|
+
}
|
|
1523
|
+
},
|
|
1524
|
+
setup(e) {
|
|
1525
|
+
let t = () => u("div", {
|
|
1526
|
+
class: "dt-cell dt-gutter is-pinned-start",
|
|
1527
|
+
style: { left: "0px" },
|
|
1528
|
+
role: "rowheader"
|
|
1529
|
+
}, [u("span", {
|
|
1530
|
+
class: "dt-sk dt-sk-bar",
|
|
1531
|
+
style: { width: "24px" }
|
|
1532
|
+
})]);
|
|
1533
|
+
return () => u("div", {
|
|
1534
|
+
class: "dt-row dt-row-skeleton",
|
|
1535
|
+
role: "row",
|
|
1536
|
+
"aria-hidden": "true",
|
|
1537
|
+
style: e.style
|
|
1538
|
+
}, [e.gutter ? t() : null, ...Dn(e.columns, (t) => {
|
|
1539
|
+
let n = e.columns.indexOf(t), r = z[t.def.type].skeleton, i = `${kn[(e.index + n) % kn.length]}%`;
|
|
1540
|
+
return u("div", {
|
|
1541
|
+
class: [
|
|
1542
|
+
"dt-cell",
|
|
1543
|
+
`is-${dt(t.def)}`,
|
|
1544
|
+
{
|
|
1545
|
+
"is-pinned-start": t.pinned === "start",
|
|
1546
|
+
"is-pinned-end": t.pinned === "end",
|
|
1547
|
+
"is-pin-edge": t.pinEdge
|
|
1548
|
+
}
|
|
1549
|
+
],
|
|
1550
|
+
style: t.pinned === "start" ? { left: `var(${t.offsetVar})` } : t.pinned === "end" ? { right: `var(${t.offsetVar})` } : void 0,
|
|
1551
|
+
role: "gridcell"
|
|
1552
|
+
}, r === "person" ? [u("span", { class: "dt-sk dt-sk-circle" }), u("span", {
|
|
1553
|
+
class: "dt-sk dt-sk-bar",
|
|
1554
|
+
style: { width: i }
|
|
1555
|
+
})] : r === "badge" ? u("span", { class: "dt-sk dt-sk-pill" }) : r === "number" ? u("span", { class: "dt-sk dt-sk-bar dt-sk-num" }) : u("span", {
|
|
1556
|
+
class: "dt-sk dt-sk-bar",
|
|
1557
|
+
style: { width: i }
|
|
1558
|
+
}));
|
|
1559
|
+
})]);
|
|
1560
|
+
}
|
|
1561
|
+
}), jn = 400;
|
|
1562
|
+
function Mn(e) {
|
|
1563
|
+
let t = v(""), n = v({}), r = v(!1), i, a = null, o = (e) => {
|
|
1564
|
+
let t = e?.closest("[data-dt-tip]");
|
|
1565
|
+
if (t && t.dataset.dtTip) return {
|
|
1566
|
+
el: t,
|
|
1567
|
+
text: t.dataset.dtTip
|
|
1568
|
+
};
|
|
1569
|
+
let n = e?.closest(".dt-cell-content, .dt-head-label");
|
|
1570
|
+
return n && n.scrollWidth > n.clientWidth + 1 ? {
|
|
1571
|
+
el: n,
|
|
1572
|
+
text: n.textContent?.trim() ?? ""
|
|
1573
|
+
} : null;
|
|
1574
|
+
}, s = () => {
|
|
1575
|
+
clearTimeout(i), i = void 0, a = null, r.value = !1;
|
|
1576
|
+
}, c = (e, i, a) => {
|
|
1577
|
+
let o = e.getBoundingClientRect();
|
|
1578
|
+
t.value = i;
|
|
1579
|
+
let s = a !== void 0 && o.width > 320 ? a : o.left + o.width / 2;
|
|
1580
|
+
n.value = {
|
|
1581
|
+
left: `${Math.round(s)}px`,
|
|
1582
|
+
top: `${Math.round(o.bottom + 6)}px`
|
|
1583
|
+
}, r.value = !0;
|
|
1584
|
+
}, l = (e) => {
|
|
1585
|
+
let t = o(e.target);
|
|
1586
|
+
if (!t || t.el === a) return;
|
|
1587
|
+
s(), a = t.el;
|
|
1588
|
+
let n = e.clientX;
|
|
1589
|
+
i = setTimeout(() => c(t.el, t.text, n), jn);
|
|
1590
|
+
}, u = (e) => {
|
|
1591
|
+
a && !a.contains(e.relatedTarget) && s();
|
|
1592
|
+
}, d = (e) => {
|
|
1593
|
+
let t = o(e.target);
|
|
1594
|
+
t && (s(), a = t.el, c(t.el, t.text));
|
|
1595
|
+
};
|
|
1596
|
+
return m(() => {
|
|
1597
|
+
let t = e.value;
|
|
1598
|
+
t && (t.addEventListener("mouseover", l), t.addEventListener("mouseout", u), t.addEventListener("focusin", d), t.addEventListener("focusout", s), t.addEventListener("scroll", s, !0), t.addEventListener("mousedown", s));
|
|
1599
|
+
}), p(() => {
|
|
1600
|
+
let t = e.value;
|
|
1601
|
+
s(), t?.removeEventListener("mouseover", l), t?.removeEventListener("mouseout", u), t?.removeEventListener("focusin", d), t?.removeEventListener("focusout", s), t?.removeEventListener("scroll", s, !0), t?.removeEventListener("mousedown", s);
|
|
1602
|
+
}), {
|
|
1603
|
+
open: r,
|
|
1604
|
+
text: t,
|
|
1605
|
+
style: n,
|
|
1606
|
+
hide: s
|
|
1607
|
+
};
|
|
1608
|
+
}
|
|
1609
|
+
//#endregion
|
|
1610
|
+
//#region src/core/preferences/usePreferences.ts
|
|
1611
|
+
function Nn(e, t, n) {
|
|
1612
|
+
let r = _({ ...n }), i = () => T(e), a = (e) => {
|
|
1613
|
+
e && (e.density && (r.density = e.density), typeof e.verticalLines == "boolean" && (r.verticalLines = e.verticalLines), typeof e.pageSize == "number" && (r.pageSize = e.pageSize), "defaultViewId" in e && (r.defaultViewId = e.defaultViewId ?? null));
|
|
1614
|
+
}, o = Promise.resolve();
|
|
1615
|
+
if (t) {
|
|
1616
|
+
let e = t.get(i());
|
|
1617
|
+
e instanceof Promise ? o = e.then(a).catch(() => {}) : a(e);
|
|
1618
|
+
}
|
|
1619
|
+
let s = (e) => {
|
|
1620
|
+
Object.assign(r, e), t && Promise.resolve(t.set(i(), e)).catch(() => {});
|
|
1621
|
+
};
|
|
1622
|
+
return {
|
|
1623
|
+
prefs: r,
|
|
1624
|
+
set: s,
|
|
1625
|
+
reset: () => s({
|
|
1626
|
+
density: n.density,
|
|
1627
|
+
verticalLines: n.verticalLines,
|
|
1628
|
+
pageSize: n.pageSize
|
|
1629
|
+
}),
|
|
1630
|
+
ready: o,
|
|
1631
|
+
persistent: t !== null
|
|
1632
|
+
};
|
|
1633
|
+
}
|
|
1634
|
+
//#endregion
|
|
1635
|
+
//#region src/core/states/StateMessage.vue?vue&type=script&setup=true&lang.ts
|
|
1636
|
+
var Pn = ["role"], Fn = {
|
|
1637
|
+
class: "dt-state-icon",
|
|
1638
|
+
"aria-hidden": "true"
|
|
1639
|
+
}, In = { class: "dt-state-title" }, Ln = {
|
|
1640
|
+
key: 0,
|
|
1641
|
+
class: "dt-state-actions"
|
|
1642
|
+
}, Rn = /* @__PURE__ */ l({
|
|
1643
|
+
__name: "StateMessage",
|
|
1644
|
+
props: {
|
|
1645
|
+
kind: {},
|
|
1646
|
+
title: {},
|
|
1647
|
+
lines: {}
|
|
1648
|
+
},
|
|
1649
|
+
setup(e) {
|
|
1650
|
+
let n = {
|
|
1651
|
+
empty: ye,
|
|
1652
|
+
noResults: he,
|
|
1653
|
+
noResultsSearch: _e,
|
|
1654
|
+
error: Se,
|
|
1655
|
+
noRowsOnPage: me
|
|
1656
|
+
}[e.kind];
|
|
1657
|
+
return (s, c) => (g(), a("div", {
|
|
1658
|
+
class: f(["dt-state", `is-${e.kind}`]),
|
|
1659
|
+
role: e.kind === "error" ? "alert" : "status"
|
|
1660
|
+
}, [
|
|
1661
|
+
o("span", Fn, [(g(), r(x(E(n)), { size: 20 }))]),
|
|
1662
|
+
o("strong", In, C(e.title), 1),
|
|
1663
|
+
(g(!0), a(t, null, y(e.lines ?? [], (e) => (g(), a("p", {
|
|
1664
|
+
key: e,
|
|
1665
|
+
class: "dt-state-line"
|
|
1666
|
+
}, C(e), 1))), 128)),
|
|
1667
|
+
s.$slots.default ? (g(), a("div", Ln, [b(s.$slots, "default")])) : i("", !0),
|
|
1668
|
+
b(s.$slots, "after")
|
|
1669
|
+
], 10, Pn));
|
|
1670
|
+
}
|
|
1671
|
+
}), zn = { class: "dt-input has-icon dt-pop-find" }, Bn = { class: "dt-input-icon" }, Vn = ["placeholder", "aria-label"], Hn = { class: "dt-pop-label" }, Un = { class: "dt-col-name" }, Wn = {
|
|
1672
|
+
key: 0,
|
|
1673
|
+
class: "dt-col-desc"
|
|
1674
|
+
}, Gn = { class: "dt-pop-label" }, Kn = { class: "dt-col-name" }, qn = {
|
|
1675
|
+
key: 0,
|
|
1676
|
+
class: "dt-col-desc"
|
|
1677
|
+
}, Jn = [
|
|
1678
|
+
"disabled",
|
|
1679
|
+
"aria-label",
|
|
1680
|
+
"onClick"
|
|
1681
|
+
], Yn = [
|
|
1682
|
+
"disabled",
|
|
1683
|
+
"aria-label",
|
|
1684
|
+
"onClick"
|
|
1685
|
+
], Xn = [
|
|
1686
|
+
"disabled",
|
|
1687
|
+
"aria-label",
|
|
1688
|
+
"onClick"
|
|
1689
|
+
], Zn = { class: "dt-pop-label" }, Qn = { class: "dt-col-name" }, $n = {
|
|
1690
|
+
key: 0,
|
|
1691
|
+
class: "dt-col-desc"
|
|
1692
|
+
}, er = ["aria-label", "onClick"], tr = { class: "dt-pop-foot" }, nr = /* @__PURE__ */ l({
|
|
1693
|
+
__name: "ColumnsPanel",
|
|
1694
|
+
props: { columns: {} },
|
|
1695
|
+
emits: [
|
|
1696
|
+
"column-visible",
|
|
1697
|
+
"column-move",
|
|
1698
|
+
"columns-all",
|
|
1699
|
+
"columns-reset"
|
|
1700
|
+
],
|
|
1701
|
+
setup(r, { emit: l }) {
|
|
1702
|
+
let u = r, d = l, { i18n: f } = e(), p = v(""), m = (e) => !p.value || e.def.header.toLocaleLowerCase().includes(p.value.toLocaleLowerCase()), h = n(() => u.columns.filter((e) => e.pinned && e.visible && m(e))), _ = n(() => u.columns.filter((e) => !e.pinned && e.visible && m(e))), b = n(() => u.columns.filter((e) => !e.visible && m(e)));
|
|
1703
|
+
return (e, n) => (g(), a(t, null, [
|
|
1704
|
+
o("label", zn, [o("span", Bn, [c(E(_e), {
|
|
1705
|
+
size: 14,
|
|
1706
|
+
"aria-hidden": "true"
|
|
1707
|
+
})]), te(o("input", {
|
|
1708
|
+
"onUpdate:modelValue": n[0] ||= (e) => p.value = e,
|
|
1709
|
+
type: "search",
|
|
1710
|
+
placeholder: E(f).t("columns.find"),
|
|
1711
|
+
"aria-label": E(f).t("columns.find")
|
|
1712
|
+
}, null, 8, Vn), [[ee, p.value]])]),
|
|
1713
|
+
h.value.length ? (g(), a(t, { key: 0 }, [o("div", Hn, [s(C(E(f).t("columns.pinned")) + " ", 1), o("span", null, C(E(f).t("columns.alwaysShown")), 1)]), (g(!0), a(t, null, y(h.value, (e) => (g(), a("div", {
|
|
1714
|
+
key: e.id,
|
|
1715
|
+
class: "dt-col-row"
|
|
1716
|
+
}, [o("span", Un, [o("span", null, C(e.def.header), 1), e.def.description ? (g(), a("span", Wn, C(e.def.description), 1)) : i("", !0)]), c(E(ge), {
|
|
1717
|
+
size: 14,
|
|
1718
|
+
class: "dt-col-lock",
|
|
1719
|
+
"aria-hidden": "true"
|
|
1720
|
+
})]))), 128))], 64)) : i("", !0),
|
|
1721
|
+
o("div", Gn, [s(C(E(f).t("columns.shown")) + " ", 1), o("button", {
|
|
1722
|
+
type: "button",
|
|
1723
|
+
class: "dt-pop-action",
|
|
1724
|
+
onClick: n[1] ||= (e) => d("columns-all", !1)
|
|
1725
|
+
}, C(E(f).t("columns.hideAll")), 1)]),
|
|
1726
|
+
(g(!0), a(t, null, y(_.value, (e, t) => (g(), a("div", {
|
|
1727
|
+
key: e.id,
|
|
1728
|
+
class: "dt-col-row"
|
|
1729
|
+
}, [
|
|
1730
|
+
o("span", Kn, [o("span", null, C(e.def.header), 1), e.def.description ? (g(), a("span", qn, C(e.def.description), 1)) : i("", !0)]),
|
|
1731
|
+
o("button", {
|
|
1732
|
+
type: "button",
|
|
1733
|
+
class: "dt-icon-btn-xs",
|
|
1734
|
+
disabled: t === 0,
|
|
1735
|
+
"aria-label": E(f).t("columns.moveUp"),
|
|
1736
|
+
onClick: (t) => d("column-move", e.id, -1)
|
|
1737
|
+
}, [c(E(ae), {
|
|
1738
|
+
size: 14,
|
|
1739
|
+
"aria-hidden": "true"
|
|
1740
|
+
})], 8, Jn),
|
|
1741
|
+
o("button", {
|
|
1742
|
+
type: "button",
|
|
1743
|
+
class: "dt-icon-btn-xs",
|
|
1744
|
+
disabled: t === _.value.length - 1,
|
|
1745
|
+
"aria-label": E(f).t("columns.moveDown"),
|
|
1746
|
+
onClick: (t) => d("column-move", e.id, 1)
|
|
1747
|
+
}, [c(E(ie), {
|
|
1748
|
+
size: 14,
|
|
1749
|
+
"aria-hidden": "true"
|
|
1750
|
+
})], 8, Yn),
|
|
1751
|
+
o("button", {
|
|
1752
|
+
type: "button",
|
|
1753
|
+
class: "dt-icon-btn-sm",
|
|
1754
|
+
disabled: !e.canHide,
|
|
1755
|
+
"aria-label": E(f).t("header.hide"),
|
|
1756
|
+
onClick: (t) => d("column-visible", e.id, !1)
|
|
1757
|
+
}, [c(E(fe), {
|
|
1758
|
+
size: 16,
|
|
1759
|
+
"aria-hidden": "true"
|
|
1760
|
+
})], 8, Xn)
|
|
1761
|
+
]))), 128)),
|
|
1762
|
+
o("div", Zn, [s(C(E(f).t("columns.hidden")) + " ", 1), o("button", {
|
|
1763
|
+
type: "button",
|
|
1764
|
+
class: "dt-pop-action",
|
|
1765
|
+
onClick: n[2] ||= (e) => d("columns-all", !0)
|
|
1766
|
+
}, C(E(f).t("columns.showAll")), 1)]),
|
|
1767
|
+
(g(!0), a(t, null, y(b.value, (e) => (g(), a("div", {
|
|
1768
|
+
key: e.id,
|
|
1769
|
+
class: "dt-col-row is-hidden"
|
|
1770
|
+
}, [o("span", Qn, [o("span", null, C(e.def.header), 1), e.def.description ? (g(), a("span", $n, C(e.def.description), 1)) : i("", !0)]), o("button", {
|
|
1771
|
+
type: "button",
|
|
1772
|
+
class: "dt-icon-btn-sm",
|
|
1773
|
+
"aria-label": E(f).t("columns.shown"),
|
|
1774
|
+
onClick: (t) => d("column-visible", e.id, !0)
|
|
1775
|
+
}, [c(E(pe), {
|
|
1776
|
+
size: 16,
|
|
1777
|
+
"aria-hidden": "true"
|
|
1778
|
+
})], 8, er)]))), 128)),
|
|
1779
|
+
o("div", tr, [n[4] ||= o("span", null, null, -1), o("button", {
|
|
1780
|
+
type: "button",
|
|
1781
|
+
class: "dt-pop-action",
|
|
1782
|
+
onClick: n[3] ||= (e) => d("columns-reset")
|
|
1783
|
+
}, C(E(f).t("common.reset")), 1)])
|
|
1784
|
+
], 64));
|
|
1785
|
+
}
|
|
1786
|
+
}), rr = { class: "dt-head-sort-index" }, ir = { class: "dt-col-name" }, ar = ["onClick"], or = ["aria-label", "onClick"], sr = { class: "dt-pop-foot" }, cr = ["disabled"], lr = /* @__PURE__ */ l({
|
|
1787
|
+
__name: "SortPanel",
|
|
1788
|
+
props: {
|
|
1789
|
+
sort: {},
|
|
1790
|
+
headerOf: { type: Function }
|
|
1791
|
+
},
|
|
1792
|
+
emits: [
|
|
1793
|
+
"sort-dir",
|
|
1794
|
+
"sort-remove",
|
|
1795
|
+
"sort-clear"
|
|
1796
|
+
],
|
|
1797
|
+
setup(n, { emit: i }) {
|
|
1798
|
+
let l = i, { i18n: u } = e();
|
|
1799
|
+
return (e, i) => (g(), a(t, null, [(g(!0), a(t, null, y(n.sort, (e, t) => (g(), a("div", {
|
|
1800
|
+
key: e.column,
|
|
1801
|
+
class: "dt-col-row dt-sort-row"
|
|
1802
|
+
}, [
|
|
1803
|
+
o("span", rr, C(t + 1), 1),
|
|
1804
|
+
o("span", ir, C(n.headerOf(e.column)), 1),
|
|
1805
|
+
o("button", {
|
|
1806
|
+
type: "button",
|
|
1807
|
+
class: "dt-btn dt-btn-xs has-icon",
|
|
1808
|
+
onClick: (t) => l("sort-dir", e.column, e.dir === "asc" ? "desc" : "asc")
|
|
1809
|
+
}, [(g(), r(x(e.dir === "asc" ? E(ae) : E(ie)), {
|
|
1810
|
+
size: 12,
|
|
1811
|
+
"aria-hidden": "true"
|
|
1812
|
+
})), s(" " + C(E(u).t(e.dir === "asc" ? "sr.asc" : "sr.desc")), 1)], 8, ar),
|
|
1813
|
+
o("button", {
|
|
1814
|
+
type: "button",
|
|
1815
|
+
class: "dt-icon-btn-sm",
|
|
1816
|
+
"aria-label": E(u).t("header.clearSort"),
|
|
1817
|
+
onClick: (t) => l("sort-remove", e.column)
|
|
1818
|
+
}, [c(E(Ce), {
|
|
1819
|
+
size: 14,
|
|
1820
|
+
"aria-hidden": "true"
|
|
1821
|
+
})], 8, or)
|
|
1822
|
+
]))), 128)), o("div", sr, [o("span", null, C(E(u).t("sort.addHint")), 1), o("button", {
|
|
1823
|
+
type: "button",
|
|
1824
|
+
class: "dt-pop-action",
|
|
1825
|
+
disabled: !n.sort.length,
|
|
1826
|
+
onClick: i[0] ||= (e) => l("sort-clear")
|
|
1827
|
+
}, C(E(u).t("header.clearSort")), 9, cr)])], 64));
|
|
1828
|
+
}
|
|
1829
|
+
}), ur = ["aria-label", "data-dt-tip"], dr = { key: 0 }, fr = { class: "dt-pop-label" }, pr = { class: "dt-pop-value" }, mr = { class: "dt-pop-value" }, hr = { class: "dt-pop-item" }, gr = { class: "dt-pop-foot" }, _r = { class: "dt-pop-head" }, vr = ["aria-label"], yr = {
|
|
1830
|
+
key: 0,
|
|
1831
|
+
class: "dt-pop-value"
|
|
1832
|
+
}, br = /* @__PURE__ */ l({
|
|
1833
|
+
__name: "DisplayPopover",
|
|
1834
|
+
props: /*@__PURE__*/ d({
|
|
1835
|
+
density: {},
|
|
1836
|
+
verticalLines: { type: Boolean },
|
|
1837
|
+
columns: {},
|
|
1838
|
+
counts: {},
|
|
1839
|
+
sort: {},
|
|
1840
|
+
persistent: { type: Boolean },
|
|
1841
|
+
iconOnly: { type: Boolean }
|
|
1842
|
+
}, {
|
|
1843
|
+
open: {
|
|
1844
|
+
type: Boolean,
|
|
1845
|
+
default: !1
|
|
1846
|
+
},
|
|
1847
|
+
openModifiers: {}
|
|
1848
|
+
}),
|
|
1849
|
+
emits: /*@__PURE__*/ d([
|
|
1850
|
+
"update:density",
|
|
1851
|
+
"update:verticalLines",
|
|
1852
|
+
"column-visible",
|
|
1853
|
+
"column-move",
|
|
1854
|
+
"columns-all",
|
|
1855
|
+
"columns-reset",
|
|
1856
|
+
"sort-dir",
|
|
1857
|
+
"sort-remove",
|
|
1858
|
+
"sort-clear",
|
|
1859
|
+
"reset"
|
|
1860
|
+
], ["update:open"]),
|
|
1861
|
+
setup(l, { emit: u }) {
|
|
1862
|
+
let d = l, p = u, m = D(l, "open"), { i18n: h } = e(), _ = [
|
|
1863
|
+
"comfortable",
|
|
1864
|
+
"standard",
|
|
1865
|
+
"compact"
|
|
1866
|
+
], b = v("main");
|
|
1867
|
+
O(m, (e) => {
|
|
1868
|
+
e || (b.value = "main");
|
|
1869
|
+
});
|
|
1870
|
+
let x = (e) => d.columns.find((t) => t.id === e)?.def.header ?? e, S = n(() => {
|
|
1871
|
+
let e = d.sort?.[0];
|
|
1872
|
+
if (!e) return "—";
|
|
1873
|
+
let t = d.sort.length > 1 ? ` +${d.sort.length - 1}` : "";
|
|
1874
|
+
return `${x(e.column)} ${e.dir === "asc" ? "↑" : "↓"}${t}`;
|
|
1875
|
+
});
|
|
1876
|
+
return (e, n) => (g(), r(E(Ge), {
|
|
1877
|
+
open: m.value,
|
|
1878
|
+
"onUpdate:open": n[13] ||= (e) => m.value = e
|
|
1879
|
+
}, {
|
|
1880
|
+
default: k(() => [c(E(Ke), { "as-child": "" }, {
|
|
1881
|
+
default: k(() => [o("button", {
|
|
1882
|
+
type: "button",
|
|
1883
|
+
class: f(["dt-btn has-icon", { "dt-btn-icon": l.iconOnly }]),
|
|
1884
|
+
"aria-label": l.iconOnly ? E(h).t("toolbar.display") : void 0,
|
|
1885
|
+
"data-dt-tip": l.iconOnly ? E(h).t("toolbar.display") : void 0
|
|
1886
|
+
}, [c(E(be), {
|
|
1887
|
+
size: 16,
|
|
1888
|
+
"aria-hidden": "true"
|
|
1889
|
+
}), l.iconOnly ? i("", !0) : (g(), a("span", dr, C(E(h).t("toolbar.display")), 1))], 10, ur)]),
|
|
1890
|
+
_: 1
|
|
1891
|
+
}), c(E(We), null, {
|
|
1892
|
+
default: k(() => [c(E(Ue), {
|
|
1893
|
+
class: f(["dt-pop dt-display", `is-${b.value}`]),
|
|
1894
|
+
align: "end",
|
|
1895
|
+
"side-offset": 4
|
|
1896
|
+
}, {
|
|
1897
|
+
default: k(() => [b.value === "main" ? (g(), a(t, { key: 0 }, [
|
|
1898
|
+
o("div", fr, C(E(h).t("display.density")), 1),
|
|
1899
|
+
c(E(Xe), {
|
|
1900
|
+
class: "dt-seg dt-seg-sm dt-display-density",
|
|
1901
|
+
type: "single",
|
|
1902
|
+
"model-value": l.density,
|
|
1903
|
+
"onUpdate:modelValue": n[0] ||= (e) => e && p("update:density", e)
|
|
1904
|
+
}, {
|
|
1905
|
+
default: k(() => [(g(), a(t, null, y(_, (e) => c(E(Ye), {
|
|
1906
|
+
key: e,
|
|
1907
|
+
class: "dt-seg-item",
|
|
1908
|
+
value: e
|
|
1909
|
+
}, {
|
|
1910
|
+
default: k(() => [s(C(E(h).t(`display.${e}`)), 1)]),
|
|
1911
|
+
_: 2
|
|
1912
|
+
}, 1032, ["value"])), 64))]),
|
|
1913
|
+
_: 1
|
|
1914
|
+
}, 8, ["model-value"]),
|
|
1915
|
+
n[14] ||= o("div", { class: "dt-pop-sep" }, null, -1),
|
|
1916
|
+
o("button", {
|
|
1917
|
+
type: "button",
|
|
1918
|
+
class: "dt-pop-item",
|
|
1919
|
+
onClick: n[1] ||= (e) => b.value = "columns"
|
|
1920
|
+
}, [
|
|
1921
|
+
s(C(E(h).t("display.columns")) + " ", 1),
|
|
1922
|
+
o("span", pr, C(E(h).t("columns.shownOf", l.counts)), 1),
|
|
1923
|
+
c(E(le), {
|
|
1924
|
+
size: 14,
|
|
1925
|
+
"aria-hidden": "true"
|
|
1926
|
+
})
|
|
1927
|
+
]),
|
|
1928
|
+
l.sort ? (g(), a("button", {
|
|
1929
|
+
key: 0,
|
|
1930
|
+
type: "button",
|
|
1931
|
+
class: "dt-pop-item",
|
|
1932
|
+
onClick: n[2] ||= (e) => b.value = "sort"
|
|
1933
|
+
}, [
|
|
1934
|
+
s(C(E(h).t("display.sort")) + " ", 1),
|
|
1935
|
+
o("span", mr, C(S.value), 1),
|
|
1936
|
+
c(E(le), {
|
|
1937
|
+
size: 14,
|
|
1938
|
+
"aria-hidden": "true"
|
|
1939
|
+
})
|
|
1940
|
+
])) : i("", !0),
|
|
1941
|
+
o("label", hr, [s(C(E(h).t("display.verticalLines")) + " ", 1), c(E(qe), {
|
|
1942
|
+
class: "dt-switch dt-pop-end",
|
|
1943
|
+
"model-value": l.verticalLines,
|
|
1944
|
+
"onUpdate:modelValue": n[3] ||= (e) => p("update:verticalLines", e)
|
|
1945
|
+
}, {
|
|
1946
|
+
default: k(() => [c(E(Je), { class: "dt-switch-thumb" })]),
|
|
1947
|
+
_: 1
|
|
1948
|
+
}, 8, ["model-value"])]),
|
|
1949
|
+
o("div", gr, [o("span", null, C(l.persistent ? E(h).t("display.savedForYou") : ""), 1), o("button", {
|
|
1950
|
+
type: "button",
|
|
1951
|
+
class: "dt-pop-action",
|
|
1952
|
+
onClick: n[4] ||= (e) => p("reset")
|
|
1953
|
+
}, C(E(h).t("common.reset")), 1)])
|
|
1954
|
+
], 64)) : (g(), a(t, { key: 1 }, [o("div", _r, [
|
|
1955
|
+
o("button", {
|
|
1956
|
+
type: "button",
|
|
1957
|
+
class: "dt-icon-btn-sm",
|
|
1958
|
+
"aria-label": E(h).t("common.back"),
|
|
1959
|
+
onClick: n[5] ||= (e) => b.value = "main"
|
|
1960
|
+
}, [c(E(ce), {
|
|
1961
|
+
size: 16,
|
|
1962
|
+
"aria-hidden": "true"
|
|
1963
|
+
})], 8, vr),
|
|
1964
|
+
o("strong", null, C(E(h).t(b.value === "columns" ? "display.columns" : "display.sort")), 1),
|
|
1965
|
+
b.value === "columns" ? (g(), a("span", yr, C(E(h).t("columns.shownOf", l.counts)), 1)) : i("", !0)
|
|
1966
|
+
]), b.value === "columns" ? (g(), r(nr, {
|
|
1967
|
+
key: 0,
|
|
1968
|
+
columns: l.columns,
|
|
1969
|
+
onColumnVisible: n[6] ||= (e, t) => p("column-visible", e, t),
|
|
1970
|
+
onColumnMove: n[7] ||= (e, t) => p("column-move", e, t),
|
|
1971
|
+
onColumnsAll: n[8] ||= (e) => p("columns-all", e),
|
|
1972
|
+
onColumnsReset: n[9] ||= (e) => p("columns-reset")
|
|
1973
|
+
}, null, 8, ["columns"])) : (g(), r(lr, {
|
|
1974
|
+
key: 1,
|
|
1975
|
+
sort: l.sort ?? [],
|
|
1976
|
+
"header-of": x,
|
|
1977
|
+
onSortDir: n[10] ||= (e, t) => p("sort-dir", e, t),
|
|
1978
|
+
onSortRemove: n[11] ||= (e) => p("sort-remove", e),
|
|
1979
|
+
onSortClear: n[12] ||= (e) => p("sort-clear")
|
|
1980
|
+
}, null, 8, ["sort"]))], 64))]),
|
|
1981
|
+
_: 1
|
|
1982
|
+
}, 8, ["class"])]),
|
|
1983
|
+
_: 1
|
|
1984
|
+
})]),
|
|
1985
|
+
_: 1
|
|
1986
|
+
}, 8, ["open"]));
|
|
1987
|
+
}
|
|
1988
|
+
}), xr = { class: "dt-input-icon" }, Sr = [
|
|
1989
|
+
"value",
|
|
1990
|
+
"placeholder",
|
|
1991
|
+
"aria-label"
|
|
1992
|
+
], Cr = { class: "dt-input-end" }, wr = ["aria-label"], Tr = {
|
|
1993
|
+
key: 1,
|
|
1994
|
+
class: "dt-kbd",
|
|
1995
|
+
"aria-hidden": "true"
|
|
1996
|
+
}, Er = /* @__PURE__ */ l({
|
|
1997
|
+
__name: "SearchBox",
|
|
1998
|
+
props: {
|
|
1999
|
+
modelValue: {},
|
|
2000
|
+
placeholder: {},
|
|
2001
|
+
collapsed: { type: Boolean },
|
|
2002
|
+
kbd: {},
|
|
2003
|
+
phone: { type: Boolean }
|
|
2004
|
+
},
|
|
2005
|
+
emits: ["update:modelValue"],
|
|
2006
|
+
setup(t, { expose: n, emit: s }) {
|
|
2007
|
+
let l = t, u = s, { i18n: d } = e(), m = v(null), h = v(l.modelValue), _;
|
|
2008
|
+
O(() => l.modelValue, (e) => h.value = e);
|
|
2009
|
+
let y = (e, t = !1) => {
|
|
2010
|
+
h.value = e, clearTimeout(_), t ? u("update:modelValue", e) : _ = setTimeout(() => u("update:modelValue", e), 250);
|
|
2011
|
+
};
|
|
2012
|
+
p(() => clearTimeout(_));
|
|
2013
|
+
let b = (e) => {
|
|
2014
|
+
e.key === "Escape" && (e.preventDefault(), h.value ? y("", !0) : m.value?.blur());
|
|
2015
|
+
};
|
|
2016
|
+
return n({ focus: () => m.value?.focus() }), (e, n) => (g(), a("label", { class: f(["dt-input dt-search has-icon", { "is-collapsed": t.collapsed && !h.value }]) }, [
|
|
2017
|
+
o("span", xr, [c(E(_e), {
|
|
2018
|
+
size: t.phone ? 18 : 16,
|
|
2019
|
+
"aria-hidden": "true"
|
|
2020
|
+
}, null, 8, ["size"])]),
|
|
2021
|
+
o("input", {
|
|
2022
|
+
ref_key: "input",
|
|
2023
|
+
ref: m,
|
|
2024
|
+
type: "search",
|
|
2025
|
+
value: h.value,
|
|
2026
|
+
placeholder: t.placeholder,
|
|
2027
|
+
"aria-label": t.placeholder,
|
|
2028
|
+
autocomplete: "off",
|
|
2029
|
+
onInput: n[0] ||= (e) => y(e.target.value),
|
|
2030
|
+
onKeydown: b
|
|
2031
|
+
}, null, 40, Sr),
|
|
2032
|
+
o("span", Cr, [h.value ? (g(), a("button", {
|
|
2033
|
+
key: 0,
|
|
2034
|
+
type: "button",
|
|
2035
|
+
class: "dt-input-clear",
|
|
2036
|
+
"aria-label": E(d).t("common.clear"),
|
|
2037
|
+
onClick: n[1] ||= (e) => y("", !0)
|
|
2038
|
+
}, [t.phone ? (g(), r(E(we), {
|
|
2039
|
+
key: 0,
|
|
2040
|
+
size: 20,
|
|
2041
|
+
weight: "fill",
|
|
2042
|
+
"aria-hidden": "true"
|
|
2043
|
+
})) : (g(), r(E(Ce), {
|
|
2044
|
+
key: 1,
|
|
2045
|
+
size: 14,
|
|
2046
|
+
"aria-hidden": "true"
|
|
2047
|
+
}))], 8, wr)) : t.phone ? i("", !0) : (g(), a("kbd", Tr, C(t.kbd ?? "/"), 1))])
|
|
2048
|
+
], 2));
|
|
2049
|
+
}
|
|
2050
|
+
}), Dr = { class: "dt-dialog-actions" }, Or = /* @__PURE__ */ l({
|
|
2051
|
+
__name: "ConfirmDialog",
|
|
2052
|
+
props: /*@__PURE__*/ d({
|
|
2053
|
+
title: {},
|
|
2054
|
+
body: {},
|
|
2055
|
+
confirmLabel: {},
|
|
2056
|
+
cancelLabel: {},
|
|
2057
|
+
danger: { type: Boolean }
|
|
2058
|
+
}, {
|
|
2059
|
+
open: {
|
|
2060
|
+
type: Boolean,
|
|
2061
|
+
default: !1
|
|
2062
|
+
},
|
|
2063
|
+
openModifiers: {}
|
|
2064
|
+
}),
|
|
2065
|
+
emits: /*@__PURE__*/ d(["confirm"], ["update:open"]),
|
|
2066
|
+
setup(t, { emit: n }) {
|
|
2067
|
+
let a = n, l = D(t, "open"), { i18n: u } = e(), d = () => {
|
|
2068
|
+
a("confirm"), l.value = !1;
|
|
2069
|
+
};
|
|
2070
|
+
return (e, n) => (g(), r(E(Le), {
|
|
2071
|
+
open: l.value,
|
|
2072
|
+
"onUpdate:open": n[0] ||= (e) => l.value = e
|
|
2073
|
+
}, {
|
|
2074
|
+
default: k(() => [c(E(Ie), null, {
|
|
2075
|
+
default: k(() => [c(E(Fe), { class: "dt-scrim" }), c(E(Ne), { class: "dt-dialog dt-dialog-confirm" }, {
|
|
2076
|
+
default: k(() => [
|
|
2077
|
+
c(E(Re), { class: "dt-dialog-title" }, {
|
|
2078
|
+
default: k(() => [s(C(t.title), 1)]),
|
|
2079
|
+
_: 1
|
|
2080
|
+
}),
|
|
2081
|
+
t.body ? (g(), r(E(Pe), {
|
|
2082
|
+
key: 0,
|
|
2083
|
+
class: "dt-dialog-body"
|
|
2084
|
+
}, {
|
|
2085
|
+
default: k(() => [s(C(t.body), 1)]),
|
|
2086
|
+
_: 1
|
|
2087
|
+
})) : i("", !0),
|
|
2088
|
+
o("div", Dr, [c(E(Me), { class: "dt-btn" }, {
|
|
2089
|
+
default: k(() => [s(C(t.cancelLabel ?? E(u).t("common.cancel")), 1)]),
|
|
2090
|
+
_: 1
|
|
2091
|
+
}), o("button", {
|
|
2092
|
+
type: "button",
|
|
2093
|
+
class: f(["dt-btn", t.danger ? "dt-btn-danger" : "dt-btn-primary"]),
|
|
2094
|
+
onClick: d
|
|
2095
|
+
}, C(t.confirmLabel), 3)])
|
|
2096
|
+
]),
|
|
2097
|
+
_: 1
|
|
2098
|
+
})]),
|
|
2099
|
+
_: 1
|
|
2100
|
+
})]),
|
|
2101
|
+
_: 1
|
|
2102
|
+
}, 8, ["open"]));
|
|
2103
|
+
}
|
|
2104
|
+
}), kr = (e) => e == null || e === "";
|
|
2105
|
+
function Ar(e, t) {
|
|
2106
|
+
let n = (e, t) => {
|
|
2107
|
+
let n = kr(e), r = kr(t);
|
|
2108
|
+
return n && r ? 0 : n ? 1 : r ? -1 : null;
|
|
2109
|
+
};
|
|
2110
|
+
if (z[e.type].numeric || e.type === "boolean" || e.type === "star") return (e, t) => n(e, t) ?? Number(e) - Number(t);
|
|
2111
|
+
if (e.type === "date" || e.type === "datetime") return (e, t) => n(e, t) ?? new Date(e).getTime() - new Date(t).getTime();
|
|
2112
|
+
let r = nt(t).collator();
|
|
2113
|
+
return (e, t) => n(e, t) ?? r.compare(String(e), String(t));
|
|
2114
|
+
}
|
|
2115
|
+
//#endregion
|
|
2116
|
+
//#region src/types/query.ts
|
|
2117
|
+
var jr = "@me";
|
|
2118
|
+
//#endregion
|
|
2119
|
+
export { nt as $, Ht as A, V as B, $t as C, Wt as D, tn as E, q as F, z as G, kt as H, Qt as I, pt as J, dt as K, Ut as L, Xt as M, Gt as N, Bt as O, zt as P, F as Q, Mt as R, $ as S, rn as T, vt as U, Dt as V, B as W, ot as X, ct as Y, rt as Z, an as _, br as a, on as b, Rn as c, An as d, N as et, Tn as f, ln as g, un as h, Er as i, Y as j, Vt as k, Nn as l, fn as m, Ar as n, lr as o, Dn as p, ut as q, Or as r, nr as s, jr as t, Mn as u, cn as v, en as w, sn as x, dn as y, wt as z };
|
|
2120
|
+
|
|
2121
|
+
//# sourceMappingURL=query-DQWMlX0m.js.map
|