@wssto2/vue-core 0.1.0 → 0.2.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/README.md +20 -9
- package/dist/{AdaptivePageShell.vue_vue_type_script_setup_true_lang-CKghARkW.js → AdaptivePageShell.vue_vue_type_script_setup_true_lang-CeKK8_g5.js} +2 -2
- package/dist/{AlertDialog.vue_vue_type_script_setup_true_lang-BZb4qKXo.js → AlertDialog.vue_vue_type_script_setup_true_lang-e4hzkzg3.js} +1 -1
- package/dist/{AsyncSection.vue_vue_type_script_setup_true_lang-B82bl36A.js → AsyncSection.vue_vue_type_script_setup_true_lang-CWLB3xsR.js} +1 -1
- package/dist/Badge.vue_vue_type_script_setup_true_lang-DJyZc0C7.js +51 -0
- package/dist/Button.vue_vue_type_script_setup_true_lang-B1eZgLae.js +182 -0
- package/dist/CountryFlag.vue_vue_type_script_setup_true_lang-Kry_vPPZ.js +299 -0
- package/dist/{DiscardChangesModal.vue_vue_type_script_setup_true_lang-Bx5O1RZJ.js → DiscardChangesModal.vue_vue_type_script_setup_true_lang-DyhYHRyz.js} +1 -1
- package/dist/{LeaveGuardRoot.vue_vue_type_script_setup_true_lang-DH6EB8br.js → LeaveGuardRoot.vue_vue_type_script_setup_true_lang-CvwoT1JF.js} +1 -1
- package/dist/{Menu.vue_vue_type_script_setup_true_lang-D44EHXQZ.js → Menu.vue_vue_type_script_setup_true_lang-CrMj6KPD.js} +1 -1
- package/dist/{Modal.vue_vue_type_script_setup_true_lang-DYQgaUtj.js → Modal.vue_vue_type_script_setup_true_lang-BQZM49gC.js} +138 -128
- package/dist/{PhotoViewer.vue_vue_type_script_setup_true_lang-DDVQXJRB.js → PhotoViewer.vue_vue_type_script_setup_true_lang-ElDizaW2.js} +1 -1
- package/dist/{SectionList.vue_vue_type_script_setup_true_lang-DGcKX_OJ.js → SectionList.vue_vue_type_script_setup_true_lang-L9ita_Kx.js} +2 -2
- package/dist/SelectField.vue_vue_type_script_setup_true_lang-DZTrU8NJ.js +661 -0
- package/dist/{Sheet.vue_vue_type_script_setup_true_lang-BLBD5ps8.js → Sheet.vue_vue_type_script_setup_true_lang-CtkJ-4e3.js} +1 -1
- package/dist/{Tooltip.vue_vue_type_script_setup_true_lang-BJWPVyfT.js → Tooltip.vue_vue_type_script_setup_true_lang-OOD_XNWx.js} +1 -1
- package/dist/app/application.d.ts +5 -0
- package/dist/app/environment.d.ts +2 -0
- package/dist/app/index.js +75 -72
- package/dist/button/index.d.ts +1 -1
- package/dist/button/index.js +5 -3
- package/dist/button/shortcut.d.ts +28 -2
- package/dist/collection/CollectionPage.vue.d.ts +1 -0
- package/dist/collection/CollectionRows.vue.d.ts +59 -0
- package/dist/collection/CollectionTable.vue.d.ts +1 -1
- package/dist/collection/DataTable.vue.d.ts +47 -0
- package/dist/collection/RowActions.vue.d.ts +19 -0
- package/dist/collection/columns.d.ts +2 -0
- package/dist/collection/index.d.ts +4 -2
- package/dist/collection/index.js +1752 -1610
- package/dist/collection/rowLayout.d.ts +10 -0
- package/dist/collection/slots.d.ts +6 -3
- package/dist/describeError-l5T9b8Uv.js +41 -0
- package/dist/dialogStack-DZZg55w0.js +31 -0
- package/dist/form/CommandDialog.vue.d.ts +12 -1
- package/dist/form/FormGroup.vue.d.ts +1 -1
- package/dist/form/MultiSelectField.vue.d.ts +4 -1
- package/dist/form/NumberField.vue.d.ts +6 -0
- package/dist/form/OptionList.vue.d.ts +6 -2
- package/dist/form/SelectField.vue.d.ts +4 -1
- package/dist/form/index.d.ts +2 -0
- package/dist/form/index.js +1940 -2008
- package/dist/form/suggestions.d.ts +11 -0
- package/dist/form/useOptions.d.ts +60 -0
- package/dist/i18n/describeError.d.ts +31 -0
- package/dist/i18n/index.d.ts +26 -0
- package/dist/i18n/index.js +22 -20
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/CountryFlag.vue.d.ts +10 -0
- package/dist/modal/Modal.vue.d.ts +4 -0
- package/dist/modal/ShortcutHelp.vue.d.ts +2 -0
- package/dist/modal/index.d.ts +2 -0
- package/dist/modal/index.js +64 -6
- package/dist/modal/placement.d.ts +22 -0
- package/dist/{options-CjSz2dQK.js → options-DAkBtYkI.js} +3 -3
- package/dist/overlay/Popover.vue.d.ts +3 -0
- package/dist/overlay/dialogStack.d.ts +9 -0
- package/dist/overlay/index.d.ts +1 -1
- package/dist/overlay/index.js +18 -17
- package/dist/page/index.js +4 -4
- package/dist/phone/index.js +247 -540
- package/dist/platform/AccessGate.vue.d.ts +50 -0
- package/dist/platform/index.d.ts +2 -0
- package/dist/platform/index.js +86 -66
- package/dist/resource/index.js +42 -42
- package/dist/shell/AccountMenuItem.vue.d.ts +3 -0
- package/dist/shell/NavigationList.vue.d.ts +1 -1
- package/dist/shell/index.js +406 -394
- package/dist/state/Badge.vue.d.ts +17 -10
- package/dist/state/hue.d.ts +8 -0
- package/dist/state/index.d.ts +2 -0
- package/dist/state/index.js +92 -56
- package/dist/state/useLoad.d.ts +41 -0
- package/dist/styles.css +1 -1
- package/dist/testing/app.d.ts +61 -0
- package/dist/testing/async.d.ts +12 -0
- package/dist/testing/collection.d.ts +18 -0
- package/dist/testing/format.d.ts +9 -0
- package/dist/testing/i18n.d.ts +16 -0
- package/dist/testing/index.d.ts +14 -0
- package/dist/testing/index.js +178 -0
- package/dist/testing/media.d.ts +23 -0
- package/dist/testing/platform.d.ts +40 -0
- package/dist/testing/transport.d.ts +40 -0
- package/dist/{toast-BTeX0r66.js → toast-DvrHQ6Ag.js} +45 -43
- package/dist/{useDialog-wmyNx2j_.js → useDialog-CXR3hN0G.js} +1 -1
- package/package.json +5 -1
- package/src/styles/theme.css +60 -0
- package/dist/Badge.vue_vue_type_script_setup_true_lang-DKc6ugmr.js +0 -31
- package/dist/Button.vue_vue_type_script_setup_true_lang-3f0emVNU.js +0 -141
- package/dist/SelectField.vue_vue_type_script_setup_true_lang-SyFWE33A.js +0 -422
- package/dist/dialogStack-DiTG1rZc.js +0 -26
- package/dist/phone/CountryFlag.vue.d.ts +0 -10
- /package/dist/{phone → internal}/flagLoaders.d.ts +0 -0
package/dist/collection/index.js
CHANGED
|
@@ -1,806 +1,682 @@
|
|
|
1
|
-
import { hasInjectionContext as
|
|
2
|
-
import { routerKey as
|
|
3
|
-
import { a as
|
|
4
|
-
import { f as
|
|
5
|
-
import { a as
|
|
6
|
-
import { useI18n as
|
|
7
|
-
import { _ as
|
|
8
|
-
import {
|
|
9
|
-
import { u as
|
|
10
|
-
import { _ as
|
|
11
|
-
import {
|
|
12
|
-
import { _ as
|
|
13
|
-
import { _ as
|
|
14
|
-
import { _ as
|
|
15
|
-
import { _ as
|
|
16
|
-
import { _ as
|
|
17
|
-
import { _ as
|
|
18
|
-
import { _ as
|
|
19
|
-
import {
|
|
20
|
-
import { _ as
|
|
21
|
-
const
|
|
22
|
-
function
|
|
23
|
-
const e = `defineCollection("${
|
|
24
|
-
if (typeof
|
|
25
|
-
if (!Number.isInteger(
|
|
26
|
-
if (typeof
|
|
27
|
-
if (typeof
|
|
28
|
-
const
|
|
29
|
-
sorts:
|
|
30
|
-
filters:
|
|
31
|
-
views:
|
|
32
|
-
sensitive: [...
|
|
33
|
-
pageSizes: [...
|
|
1
|
+
import { hasInjectionContext as at, inject as rt, watch as Se, shallowRef as we, computed as h, toValue as Re, ref as ae, getCurrentScope as Ie, onScopeDispose as qe, defineComponent as ue, openBlock as c, createElementBlock as d, createVNode as P, unref as s, createElementVNode as v, toDisplayString as y, Fragment as V, renderList as X, createCommentVNode as j, createBlock as Y, mergeProps as _e, withCtx as q, createTextVNode as le, normalizeClass as W, renderSlot as oe, nextTick as it, useSlots as ke, useTemplateRef as ge, normalizeStyle as ve, withModifiers as Ee, createSlots as je, withDirectives as De, vModelText as Be, onBeforeUnmount as kt, onMounted as xt, normalizeProps as Ue, guardReactiveProps as He } from "vue";
|
|
2
|
+
import { routerKey as $t, useRoute as St, RouterLink as ct, useRouter as Ct } from "vue-router";
|
|
3
|
+
import { a as Oe, i as zt } from "../error-Bb_dr_Ay.js";
|
|
4
|
+
import { f as At } from "../platform-jqlKVJ2e.js";
|
|
5
|
+
import { a as Pt } from "../AdaptivePageShell.vue_vue_type_script_setup_true_lang-CeKK8_g5.js";
|
|
6
|
+
import { useI18n as he } from "vue-i18n";
|
|
7
|
+
import { _ as be, u as Xe } from "../Button.vue_vue_type_script_setup_true_lang-B1eZgLae.js";
|
|
8
|
+
import { _ as Et, a as ut } from "../SwipeActions.vue_vue_type_script_setup_true_lang-CGTuEnTv.js";
|
|
9
|
+
import { u as Le } from "../format-B8mJm946.js";
|
|
10
|
+
import { _ as H } from "../Icon.vue_vue_type_script_lang-DtC4_mkz.js";
|
|
11
|
+
import { _ as Ge } from "../Banner.vue_vue_type_script_setup_true_lang-n_wGPIIu.js";
|
|
12
|
+
import { _ as Fe } from "../EmptyState.vue_vue_type_script_setup_true_lang-BeGpHMUP.js";
|
|
13
|
+
import { _ as Ke } from "../Menu.vue_vue_type_script_setup_true_lang-CrMj6KPD.js";
|
|
14
|
+
import { _ as dt } from "../Tooltip.vue_vue_type_script_setup_true_lang-OOD_XNWx.js";
|
|
15
|
+
import { _ as Ot } from "../Badge.vue_vue_type_script_setup_true_lang-DJyZc0C7.js";
|
|
16
|
+
import { _ as jt } from "../Timestamp.vue_vue_type_script_setup_true_lang-CSY_mMm1.js";
|
|
17
|
+
import { _ as ft, t as Ce } from "../toast-DvrHQ6Ag.js";
|
|
18
|
+
import { _ as Lt, a as Rt } from "../SelectField.vue_vue_type_script_setup_true_lang-DZTrU8NJ.js";
|
|
19
|
+
import { a as pt } from "../mediaQuery-CygcXmFW.js";
|
|
20
|
+
import { _ as Tt } from "../Sheet.vue_vue_type_script_setup_true_lang-CtkJ-4e3.js";
|
|
21
|
+
const Vt = [5, 8, 10, 15, 25, 50, 100], Je = 25;
|
|
22
|
+
function as(l) {
|
|
23
|
+
const e = `defineCollection("${l.id}")`;
|
|
24
|
+
if (typeof l.id != "string" || l.id.trim() === "") throw new Error("defineCollection: `id` must be a non-empty string.");
|
|
25
|
+
if (!Number.isInteger(l.stateVersion) || l.stateVersion < 1) throw new Error(`${e}: \`stateVersion\` must be a positive integer.`);
|
|
26
|
+
if (typeof l.load != "function") throw new Error(`${e}: \`load\` must be a function.`);
|
|
27
|
+
if (typeof l.key != "function") throw new Error(`${e}: \`key\` must be a function.`);
|
|
28
|
+
const t = {
|
|
29
|
+
sorts: l.query?.sorts ? [...l.query.sorts] : null,
|
|
30
|
+
filters: l.query?.filters ? [...l.query.filters] : null,
|
|
31
|
+
views: l.query?.views ? [...l.query.views] : null,
|
|
32
|
+
sensitive: [...l.query?.sensitive ?? []],
|
|
33
|
+
pageSizes: [...l.query?.pageSizes ?? Vt]
|
|
34
34
|
};
|
|
35
|
-
if (
|
|
35
|
+
if (t.pageSizes.length === 0 || t.pageSizes.some(($) => !Number.isInteger($) || $ < 1))
|
|
36
36
|
throw new Error(`${e}: \`query.pageSizes\` must list positive integers.`);
|
|
37
|
-
for (const
|
|
38
|
-
if (
|
|
39
|
-
const
|
|
40
|
-
if (!
|
|
41
|
-
const
|
|
42
|
-
if (
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
45
|
-
const
|
|
46
|
-
for (const
|
|
47
|
-
if (
|
|
48
|
-
const
|
|
49
|
-
if (!Number.isInteger(
|
|
50
|
-
const
|
|
51
|
-
if (
|
|
37
|
+
for (const $ of t.sensitive)
|
|
38
|
+
if (t.filters && !t.filters.includes($)) throw new Error(`${e}: sensitive filter "${$}" is not in \`query.filters\`.`);
|
|
39
|
+
const i = l.defaults ?? {}, a = i.pageSize ?? (t.pageSizes.includes(Je) ? Je : t.pageSizes[0]);
|
|
40
|
+
if (!t.pageSizes.includes(a)) throw new Error(`${e}: default page size ${a} is not one of ${t.pageSizes.join(", ")}.`);
|
|
41
|
+
const n = i.sort ?? null;
|
|
42
|
+
if (n !== null && t.sorts && !t.sorts.includes(n)) throw new Error(`${e}: default sort "${n}" is not in \`query.sorts\`.`);
|
|
43
|
+
const u = i.view ?? null;
|
|
44
|
+
if (u !== null && t.views && !t.views.includes(u)) throw new Error(`${e}: default view "${u}" is not in \`query.views\`.`);
|
|
45
|
+
const p = Object.fromEntries(Object.entries(i.filters ?? {}).filter(([, $]) => $ !== void 0 && $ !== ""));
|
|
46
|
+
for (const $ of Object.keys(p))
|
|
47
|
+
if (t.filters && !t.filters.includes($)) throw new Error(`${e}: default filter "${$}" is not in \`query.filters\`.`);
|
|
48
|
+
const g = i.page ?? 1;
|
|
49
|
+
if (!Number.isInteger(g) || g < 1) throw new Error(`${e}: default page must be a positive integer.`);
|
|
50
|
+
const m = i.direction ?? "asc";
|
|
51
|
+
if (m !== "asc" && m !== "desc") throw new Error(`${e}: default direction must be "asc" or "desc".`);
|
|
52
52
|
return Object.freeze({
|
|
53
|
-
id:
|
|
54
|
-
stateVersion:
|
|
55
|
-
load:
|
|
56
|
-
key:
|
|
53
|
+
id: l.id,
|
|
54
|
+
stateVersion: l.stateVersion,
|
|
55
|
+
load: l.load,
|
|
56
|
+
key: l.key,
|
|
57
57
|
defaults: Object.freeze({
|
|
58
|
-
page:
|
|
59
|
-
pageSize:
|
|
60
|
-
sort:
|
|
61
|
-
direction:
|
|
62
|
-
search:
|
|
63
|
-
view:
|
|
64
|
-
filters: Object.freeze(
|
|
58
|
+
page: g,
|
|
59
|
+
pageSize: a,
|
|
60
|
+
sort: n,
|
|
61
|
+
direction: m,
|
|
62
|
+
search: i.search ?? "",
|
|
63
|
+
view: u,
|
|
64
|
+
filters: Object.freeze(p)
|
|
65
65
|
}),
|
|
66
|
-
contract: Object.freeze(
|
|
67
|
-
migrate:
|
|
66
|
+
contract: Object.freeze(t),
|
|
67
|
+
migrate: l.migrate
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
|
-
const
|
|
71
|
-
function
|
|
72
|
-
if (!
|
|
73
|
-
const [e = "",
|
|
74
|
-
return [e.trim() || null,
|
|
70
|
+
const me = (l) => l == null || l === "";
|
|
71
|
+
function vt(l) {
|
|
72
|
+
if (!l) return [null, null];
|
|
73
|
+
const [e = "", t = ""] = String(l).split(",");
|
|
74
|
+
return [e.trim() || null, t.trim() || null];
|
|
75
75
|
}
|
|
76
|
-
function
|
|
77
|
-
const
|
|
78
|
-
return
|
|
76
|
+
function Ft(l, e) {
|
|
77
|
+
const t = me(l) ? "" : String(l), i = me(e) ? "" : String(e);
|
|
78
|
+
return t === "" && i === "" ? null : `${t},${i}`;
|
|
79
79
|
}
|
|
80
|
-
function
|
|
81
|
-
const
|
|
82
|
-
(
|
|
83
|
-
),
|
|
84
|
-
for (const
|
|
85
|
-
const
|
|
86
|
-
|
|
80
|
+
function Mt(l, e) {
|
|
81
|
+
const t = me(e) ? null : new Set(String(e).split(",")), i = (l.options ?? []).filter(
|
|
82
|
+
(n) => !l.dependsOn || !t || n.parentValue !== void 0 && t.has(String(n.parentValue))
|
|
83
|
+
), a = /* @__PURE__ */ new Map();
|
|
84
|
+
for (const n of i) {
|
|
85
|
+
const u = a.get(n.label) ?? [], p = String(n.value);
|
|
86
|
+
u.includes(p) || u.push(p), a.set(n.label, u);
|
|
87
87
|
}
|
|
88
|
-
return [...
|
|
88
|
+
return [...a.entries()].map(([n, u]) => ({ label: n, value: u.join(",") }));
|
|
89
89
|
}
|
|
90
|
-
function
|
|
91
|
-
if (
|
|
92
|
-
if (
|
|
93
|
-
const [
|
|
94
|
-
return
|
|
90
|
+
function Nt(l, e, t) {
|
|
91
|
+
if (me(e)) return null;
|
|
92
|
+
if (l.type === "range") {
|
|
93
|
+
const [a, n] = vt(String(e)), u = l.unit ? ` ${l.unit}` : "", p = (g) => `${l.unit ? t.formatNumber(Number(g)) : g}${u}`;
|
|
94
|
+
return a !== null && n !== null ? `${p(a)} – ${p(n)}` : a !== null ? `${t.from.toLowerCase()} ${p(a)}` : n !== null ? `${t.until.toLowerCase()} ${p(n)}` : null;
|
|
95
95
|
}
|
|
96
|
-
const
|
|
97
|
-
return (
|
|
96
|
+
const i = new Set(String(e).split(","));
|
|
97
|
+
return (l.options ?? []).find((a) => i.has(String(a.value)))?.label ?? String(e);
|
|
98
98
|
}
|
|
99
|
-
function
|
|
100
|
-
const
|
|
101
|
-
for (const
|
|
102
|
-
const
|
|
103
|
-
for (let
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
key:
|
|
107
|
-
label:
|
|
108
|
-
values:
|
|
109
|
-
clears:
|
|
99
|
+
function mt(l, e, t) {
|
|
100
|
+
const i = new Set(l.map((u) => u.key)), a = (u) => l.find((p) => p.dependsOn === u), n = [];
|
|
101
|
+
for (const u of l.filter((p) => !p.dependsOn || !i.has(p.dependsOn))) {
|
|
102
|
+
const p = [];
|
|
103
|
+
for (let m = u; m && !p.includes(m); m = a(m.key)) p.push(m);
|
|
104
|
+
const g = p.map((m) => ({ filter: m, value: Nt(m, e[m.key], t) })).filter((m) => m.value !== null);
|
|
105
|
+
g.length !== 0 && n.push({
|
|
106
|
+
key: u.key,
|
|
107
|
+
label: g.length === 1 ? g[0].filter.label : null,
|
|
108
|
+
values: g.map((m) => m.value),
|
|
109
|
+
clears: p.map((m) => m.key)
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
|
-
return
|
|
112
|
+
return n;
|
|
113
113
|
}
|
|
114
|
-
function
|
|
115
|
-
return
|
|
114
|
+
function It(l, e) {
|
|
115
|
+
return l.filter((t) => !me(e[t.key])).length;
|
|
116
116
|
}
|
|
117
|
-
const
|
|
118
|
-
function
|
|
119
|
-
if (typeof
|
|
120
|
-
const
|
|
121
|
-
return `${
|
|
117
|
+
const xe = "from";
|
|
118
|
+
function qt(l, e) {
|
|
119
|
+
if (typeof l == "string") {
|
|
120
|
+
const t = new URLSearchParams(e).toString(), i = l.indexOf("#"), a = i === -1 ? l : l.slice(0, i);
|
|
121
|
+
return `${a}${a.includes("?") ? "&" : "?"}${t}${i === -1 ? "" : l.slice(i)}`;
|
|
122
122
|
}
|
|
123
|
-
return { ...
|
|
123
|
+
return { ...l, query: { ...l.query, ...e } };
|
|
124
124
|
}
|
|
125
|
-
function
|
|
126
|
-
if (!
|
|
127
|
-
const e =
|
|
128
|
-
e &&
|
|
125
|
+
function bt(l) {
|
|
126
|
+
if (!at()) return;
|
|
127
|
+
const e = rt(At, null);
|
|
128
|
+
e && Se(
|
|
129
129
|
() => {
|
|
130
|
-
const
|
|
131
|
-
return
|
|
130
|
+
const t = e.session.state.value;
|
|
131
|
+
return t.status === "authenticated" ? t.user.id : null;
|
|
132
132
|
},
|
|
133
|
-
|
|
133
|
+
l,
|
|
134
134
|
{ flush: "sync" }
|
|
135
135
|
);
|
|
136
136
|
}
|
|
137
|
-
const
|
|
138
|
-
function
|
|
137
|
+
const Dt = 4096, Bt = 200, Ut = 32, Ht = 1e6, Te = /^[A-Za-z0-9_.-]{1,64}$/;
|
|
138
|
+
function Kt(l) {
|
|
139
139
|
let e = "";
|
|
140
|
-
for (const
|
|
140
|
+
for (const t of new TextEncoder().encode(l)) e += String.fromCharCode(t);
|
|
141
141
|
return btoa(e).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
142
142
|
}
|
|
143
|
-
function
|
|
144
|
-
const e =
|
|
145
|
-
return new TextDecoder("utf-8", { fatal: !0 }).decode(Uint8Array.from(
|
|
143
|
+
function Xt(l) {
|
|
144
|
+
const e = l.replace(/-/g, "+").replace(/_/g, "/"), t = atob(e.padEnd(Math.ceil(e.length / 4) * 4, "="));
|
|
145
|
+
return new TextDecoder("utf-8", { fatal: !0 }).decode(Uint8Array.from(t, (i) => i.charCodeAt(0)));
|
|
146
146
|
}
|
|
147
|
-
const
|
|
148
|
-
function
|
|
149
|
-
return typeof
|
|
147
|
+
const Me = (l) => typeof l == "object" && l !== null && !Array.isArray(l);
|
|
148
|
+
function ze(l, e = Bt) {
|
|
149
|
+
return typeof l == "string" && l.length <= e ? l : null;
|
|
150
150
|
}
|
|
151
|
-
function
|
|
152
|
-
const { defaults:
|
|
153
|
-
let
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
const
|
|
157
|
-
let
|
|
158
|
-
const S =
|
|
159
|
-
S !== null && (
|
|
160
|
-
const
|
|
161
|
-
if (
|
|
162
|
-
let
|
|
163
|
-
for (const [
|
|
164
|
-
if (++
|
|
165
|
-
if (!(
|
|
166
|
-
const
|
|
167
|
-
|
|
151
|
+
function We(l, e) {
|
|
152
|
+
const { defaults: t, contract: i } = l, a = typeof e.p == "number" && Number.isInteger(e.p) && e.p >= 1 && e.p <= Ht ? e.p : t.page, n = typeof e.l == "number" && i.pageSizes.includes(e.l) ? e.l : t.pageSize;
|
|
153
|
+
let u = t.sort;
|
|
154
|
+
const p = ze(e.c, 64);
|
|
155
|
+
p !== null && (i.sorts ? i.sorts.includes(p) : Te.test(p)) && (u = p);
|
|
156
|
+
const g = e.d === "asc" || e.d === "desc" ? e.d : t.direction, m = ze(e.s) ?? t.search;
|
|
157
|
+
let $ = t.view;
|
|
158
|
+
const S = ze(e.w, 64);
|
|
159
|
+
S !== null && (i.views ? i.views.includes(S) : Te.test(S)) && ($ = S);
|
|
160
|
+
const N = Me(e.f) ? {} : { ...t.filters };
|
|
161
|
+
if (Me(e.f)) {
|
|
162
|
+
let k = 0;
|
|
163
|
+
for (const [L, z] of Object.entries(e.f)) {
|
|
164
|
+
if (++k > Ut) break;
|
|
165
|
+
if (!(i.filters ? i.filters.includes(L) : Te.test(L)) || i.sensitive.includes(L)) continue;
|
|
166
|
+
const x = typeof z == "number" || typeof z == "boolean" ? String(z) : ze(z);
|
|
167
|
+
x !== null && x !== "" && (N[L] = x);
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
|
-
return { page:
|
|
170
|
+
return { page: a, pageSize: n, sort: u, direction: g, search: m, view: $, filters: N };
|
|
171
171
|
}
|
|
172
|
-
function
|
|
173
|
-
const
|
|
174
|
-
e.sort && (
|
|
175
|
-
const
|
|
176
|
-
Object.entries(e.filters).filter(([
|
|
172
|
+
function $e(l, e) {
|
|
173
|
+
const t = { v: l.stateVersion, p: e.page, l: e.pageSize };
|
|
174
|
+
e.sort && (t.c = e.sort), t.d = e.direction, e.search && (t.s = e.search), e.view && (t.w = e.view);
|
|
175
|
+
const i = Object.fromEntries(
|
|
176
|
+
Object.entries(e.filters).filter(([a, n]) => n !== void 0 && n !== "" && !l.contract.sensitive.includes(a))
|
|
177
177
|
);
|
|
178
|
-
return (Object.keys(
|
|
178
|
+
return (Object.keys(i).length > 0 || Object.keys(l.defaults.filters).length > 0) && (t.f = i), Kt(JSON.stringify(t));
|
|
179
179
|
}
|
|
180
|
-
function
|
|
181
|
-
const
|
|
182
|
-
if (typeof
|
|
183
|
-
if (
|
|
184
|
-
const
|
|
185
|
-
return
|
|
180
|
+
function gt(l, e) {
|
|
181
|
+
const t = e.v === void 0 ? l.stateVersion : e.v;
|
|
182
|
+
if (typeof t != "number" || !Number.isInteger(t)) return null;
|
|
183
|
+
if (t === l.stateVersion) return We(l, e);
|
|
184
|
+
const i = l.migrate?.(e, t);
|
|
185
|
+
return i ? We(l, i) : null;
|
|
186
186
|
}
|
|
187
|
-
function
|
|
188
|
-
if (typeof e != "string" || e === "" || e.length >
|
|
189
|
-
let
|
|
187
|
+
function Ne(l, e) {
|
|
188
|
+
if (typeof e != "string" || e === "" || e.length > Dt) return null;
|
|
189
|
+
let t;
|
|
190
190
|
try {
|
|
191
|
-
|
|
191
|
+
t = JSON.parse(Xt(e));
|
|
192
192
|
} catch {
|
|
193
193
|
return null;
|
|
194
194
|
}
|
|
195
|
-
return
|
|
195
|
+
return Me(t) ? gt(l, t) : null;
|
|
196
196
|
}
|
|
197
|
-
function
|
|
197
|
+
function Gt(l) {
|
|
198
198
|
return JSON.stringify([
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
Object.entries(
|
|
199
|
+
l.page,
|
|
200
|
+
l.pageSize,
|
|
201
|
+
l.sort,
|
|
202
|
+
l.direction,
|
|
203
|
+
l.search,
|
|
204
|
+
l.view,
|
|
205
|
+
Object.entries(l.filters).sort(([e], [t]) => e.localeCompare(t))
|
|
206
206
|
]);
|
|
207
207
|
}
|
|
208
|
-
const
|
|
209
|
-
function
|
|
210
|
-
let
|
|
211
|
-
|
|
212
|
-
const
|
|
213
|
-
if (
|
|
208
|
+
const Ye = /* @__PURE__ */ new WeakMap();
|
|
209
|
+
function Jt(l, e, t, i) {
|
|
210
|
+
let a = Ye.get(l);
|
|
211
|
+
a || Ye.set(l, a = /* @__PURE__ */ new Map());
|
|
212
|
+
const n = `${t}\0${i}`, u = a.get(n);
|
|
213
|
+
if (u && u.id !== e)
|
|
214
214
|
throw new Error(
|
|
215
|
-
`useCollection("${e}"): the URL state key "${
|
|
215
|
+
`useCollection("${e}"): the URL state key "${i}" is already used by the list "${u.id}" on this page. Two lists on one page each need their own \`state: { kind: "url", key }\`, or they overwrite each other's state.`
|
|
216
216
|
);
|
|
217
|
-
const
|
|
218
|
-
return
|
|
219
|
-
--
|
|
217
|
+
const p = u ?? { id: e, count: 0 };
|
|
218
|
+
return p.count++, a.set(n, p), () => {
|
|
219
|
+
--p.count <= 0 && a.delete(n);
|
|
220
220
|
};
|
|
221
221
|
}
|
|
222
|
-
const
|
|
223
|
-
function
|
|
224
|
-
const
|
|
225
|
-
let
|
|
222
|
+
const Ve = (l) => l.status === "loaded" || l.status === "refreshing" || l.status === "stale", Qe = (l) => l instanceof Error && l.message !== "" ? l.message : String(l);
|
|
223
|
+
function rs(l, e) {
|
|
224
|
+
const t = `useCollection("${l.id}")`, i = e.state;
|
|
225
|
+
let a = null, n = "", u = "", p = () => {
|
|
226
226
|
};
|
|
227
|
-
if (
|
|
228
|
-
if (
|
|
229
|
-
if (!
|
|
230
|
-
|
|
227
|
+
if (i.kind === "url") {
|
|
228
|
+
if (a = at() ? rt($t, null) : null, !a) throw new Error(`${t}: a URL state needs the application's router. Call it while a component is being set up, with the router installed, or use \`state: { kind: "memory" }\`.`);
|
|
229
|
+
if (!i.key) throw new Error(`${t}: \`state.key\` must not be empty.`);
|
|
230
|
+
u = i.key, n = a.currentRoute.value.path, p = Jt(a, l.id, n, u);
|
|
231
231
|
}
|
|
232
|
-
const
|
|
233
|
-
if (!
|
|
234
|
-
const o =
|
|
235
|
-
return
|
|
236
|
-
})(),
|
|
237
|
-
let
|
|
232
|
+
const g = (() => {
|
|
233
|
+
if (!a) return l.defaults;
|
|
234
|
+
const o = a.currentRoute.value.query[u];
|
|
235
|
+
return Ne(l, Array.isArray(o) ? o[0] : o) ?? l.defaults;
|
|
236
|
+
})(), m = we(g), $ = we({ status: "loading" }), S = we(null), N = we(null), k = h(() => Ve($.value) ? $.value.value : N.value);
|
|
237
|
+
let L = !1, z = null, D = 0, x = !1;
|
|
238
238
|
const R = [];
|
|
239
|
-
|
|
240
|
-
function
|
|
241
|
-
let
|
|
242
|
-
const
|
|
243
|
-
const
|
|
244
|
-
return typeof
|
|
239
|
+
a && e.linked && B(a.currentRoute.value.query, e.linked);
|
|
240
|
+
function B(o, f) {
|
|
241
|
+
let F = m.value;
|
|
242
|
+
const G = (te) => {
|
|
243
|
+
const J = o[te], pe = Array.isArray(J) ? J[0] : J;
|
|
244
|
+
return typeof pe == "string" && pe !== "" ? pe : null;
|
|
245
245
|
};
|
|
246
|
-
if (
|
|
247
|
-
const
|
|
248
|
-
|
|
246
|
+
if (f.view) {
|
|
247
|
+
const te = G(f.view), J = te !== null && (l.contract.views ? l.contract.views.includes(te) : !0);
|
|
248
|
+
te !== null && J && (F = { ...F, view: te, page: 1 }, R.push(f.view));
|
|
249
249
|
}
|
|
250
|
-
for (const [
|
|
251
|
-
const
|
|
252
|
-
if (
|
|
253
|
-
const
|
|
254
|
-
|
|
250
|
+
for (const [te, J] of Object.entries(f.params ?? {})) {
|
|
251
|
+
const pe = G(te);
|
|
252
|
+
if (pe === null) continue;
|
|
253
|
+
const Q = typeof J == "string" ? J : J.filter, Z = typeof J == "string" ? pe : J.value(pe), se = { ...F.filters };
|
|
254
|
+
Z === null || Z === "any" || Z === "" ? delete se[Q] : se[Q] = String(Z), F = { ...F, filters: se, page: 1 }, R.push(te);
|
|
255
255
|
}
|
|
256
256
|
if (R.length > 0) {
|
|
257
|
-
for (const
|
|
258
|
-
|
|
257
|
+
for (const te of f.consume ?? []) te in o && R.push(te);
|
|
258
|
+
m.value = F;
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
|
-
async function
|
|
262
|
-
if (
|
|
263
|
-
|
|
264
|
-
const
|
|
265
|
-
|
|
261
|
+
async function K(o) {
|
|
262
|
+
if (L) return;
|
|
263
|
+
z?.abort();
|
|
264
|
+
const f = ++D, F = z = new AbortController(), G = $.value, te = m.value;
|
|
265
|
+
$.value = o && Ve(G) ? { status: "refreshing", value: G.value } : { status: "loading" };
|
|
266
266
|
try {
|
|
267
|
-
const
|
|
268
|
-
if (
|
|
269
|
-
if (
|
|
270
|
-
|
|
267
|
+
const J = await l.load(te, { signal: F.signal });
|
|
268
|
+
if (f !== D) return;
|
|
269
|
+
if (J.lastPage >= 1 && te.page > J.lastPage) {
|
|
270
|
+
m.value = { ...te, page: J.lastPage }, T(), K(!1);
|
|
271
271
|
return;
|
|
272
272
|
}
|
|
273
|
-
S.value = null,
|
|
274
|
-
} catch (
|
|
275
|
-
if (
|
|
276
|
-
S.value =
|
|
273
|
+
S.value = null, N.value = J, $.value = { status: "loaded", value: J };
|
|
274
|
+
} catch (J) {
|
|
275
|
+
if (f !== D || F.signal.aborted || Oe(J)) return;
|
|
276
|
+
S.value = J, $.value = o && Ve(G) ? { status: "stale", value: G.value, error: Qe(J) } : { status: "failed", error: Qe(J) };
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
|
-
function
|
|
280
|
-
|
|
281
|
-
|
|
279
|
+
function M() {
|
|
280
|
+
T(), !(x || L) && (x = !0, queueMicrotask(() => {
|
|
281
|
+
x && (x = !1, K(!1));
|
|
282
282
|
}));
|
|
283
283
|
}
|
|
284
|
-
function
|
|
285
|
-
return
|
|
284
|
+
function ee() {
|
|
285
|
+
return x = !1, K(!0);
|
|
286
286
|
}
|
|
287
|
-
let
|
|
288
|
-
function
|
|
289
|
-
!
|
|
290
|
-
|
|
287
|
+
let O = !1, A = !1, I = !1;
|
|
288
|
+
function T() {
|
|
289
|
+
!a || O || L || (O = !0, queueMicrotask(() => {
|
|
290
|
+
O = !1, b();
|
|
291
291
|
}));
|
|
292
292
|
}
|
|
293
|
-
async function
|
|
294
|
-
if (
|
|
295
|
-
if (
|
|
296
|
-
|
|
293
|
+
async function b() {
|
|
294
|
+
if (a) {
|
|
295
|
+
if (A) {
|
|
296
|
+
I = !0;
|
|
297
297
|
return;
|
|
298
298
|
}
|
|
299
|
-
|
|
299
|
+
A = !0;
|
|
300
300
|
try {
|
|
301
301
|
do {
|
|
302
|
-
|
|
303
|
-
const o =
|
|
304
|
-
if (
|
|
305
|
-
const
|
|
306
|
-
for (const
|
|
307
|
-
o.query[
|
|
308
|
-
} while (
|
|
302
|
+
I = !1;
|
|
303
|
+
const o = a.currentRoute.value;
|
|
304
|
+
if (L || o.path !== n) return;
|
|
305
|
+
const f = $e(l, m.value), F = { ...o.query };
|
|
306
|
+
for (const G of R.splice(0)) delete F[G];
|
|
307
|
+
o.query[u] === f && Object.keys(F).length === Object.keys(o.query).length || await a.replace({ query: { ...F, [u]: f }, hash: o.hash });
|
|
308
|
+
} while (I);
|
|
309
309
|
} catch {
|
|
310
310
|
} finally {
|
|
311
|
-
|
|
311
|
+
A = !1;
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
|
-
const
|
|
316
|
-
() =>
|
|
315
|
+
const C = a ? Se(
|
|
316
|
+
() => a.currentRoute.value.query[u],
|
|
317
317
|
(o) => {
|
|
318
|
-
const
|
|
319
|
-
if (
|
|
320
|
-
const
|
|
321
|
-
JSON.stringify(
|
|
318
|
+
const f = a.currentRoute.value;
|
|
319
|
+
if (L || A || f.path !== n) return;
|
|
320
|
+
const F = Array.isArray(o) ? o[0] : o, G = Ne(l, F) ?? l.defaults;
|
|
321
|
+
JSON.stringify(G) !== JSON.stringify(m.value) ? (m.value = G, M()) : T();
|
|
322
322
|
}
|
|
323
323
|
) : () => {
|
|
324
|
-
},
|
|
325
|
-
|
|
326
|
-
},
|
|
327
|
-
const
|
|
328
|
-
for (const [
|
|
329
|
-
|
|
330
|
-
return
|
|
331
|
-
},
|
|
332
|
-
const o =
|
|
333
|
-
return o.status === "loading" ? "loading" : o.status === "failed" ? "failed" : o.value.rows.length > 0 ? "rows" :
|
|
334
|
-
}),
|
|
335
|
-
const o = new Map((
|
|
336
|
-
return (
|
|
324
|
+
}, E = (o, f = !1) => {
|
|
325
|
+
m.value = { ...m.value, ...o, ...f ? { page: 1 } : {} }, M();
|
|
326
|
+
}, ie = (o) => {
|
|
327
|
+
const f = { ...m.value.filters };
|
|
328
|
+
for (const [F, G] of Object.entries(o))
|
|
329
|
+
G == null || me(G) ? delete f[F] : f[F] = String(G);
|
|
330
|
+
return f;
|
|
331
|
+
}, de = h(() => m.value.search !== "" || Object.values(m.value.filters).some((o) => !me(o))), ce = h(() => k.value?.rows ?? []), re = h(() => {
|
|
332
|
+
const o = $.value;
|
|
333
|
+
return o.status === "loading" ? "loading" : o.status === "failed" ? "failed" : o.value.rows.length > 0 ? "rows" : de.value ? "no-matches" : "empty";
|
|
334
|
+
}), fe = h(() => {
|
|
335
|
+
const o = new Map((k.value?.views ?? []).map((f) => [f.key, f.count]));
|
|
336
|
+
return (Re(e.views) ?? []).map((f) => o.has(f.key) ? { ...f, count: o.get(f.key) } : f);
|
|
337
337
|
});
|
|
338
|
-
let
|
|
338
|
+
let ne = () => {
|
|
339
339
|
};
|
|
340
|
-
const
|
|
341
|
-
function
|
|
342
|
-
const
|
|
343
|
-
return
|
|
340
|
+
const w = e.savedViews ? r(e.savedViews) : null;
|
|
341
|
+
function U(o) {
|
|
342
|
+
const f = { v: o.state.version, f: o.state.filters, s: o.state.search, w: o.state.view ?? void 0 };
|
|
343
|
+
return gt(l, f);
|
|
344
344
|
}
|
|
345
|
-
function
|
|
346
|
-
const
|
|
347
|
-
let
|
|
348
|
-
const
|
|
349
|
-
|
|
350
|
-
|
|
345
|
+
function r(o) {
|
|
346
|
+
const f = ae([]), F = ae("idle");
|
|
347
|
+
let G = null;
|
|
348
|
+
const te = (Q, Z) => Q.name.localeCompare(Z.name), J = h(() => f.value.filter((Q) => U(Q) !== null));
|
|
349
|
+
ne = () => {
|
|
350
|
+
G?.abort(), f.value = [], F.value = "idle";
|
|
351
351
|
};
|
|
352
|
-
const
|
|
353
|
-
version:
|
|
354
|
-
filters: Object.fromEntries(Object.entries(
|
|
355
|
-
search:
|
|
356
|
-
view:
|
|
352
|
+
const pe = () => ({
|
|
353
|
+
version: l.stateVersion,
|
|
354
|
+
filters: Object.fromEntries(Object.entries(m.value.filters).filter(([Q, Z]) => Z !== void 0 && !l.contract.sensitive.includes(Q))),
|
|
355
|
+
search: m.value.search,
|
|
356
|
+
view: m.value.view
|
|
357
357
|
});
|
|
358
358
|
return {
|
|
359
|
-
items:
|
|
360
|
-
status:
|
|
359
|
+
items: J,
|
|
360
|
+
status: F,
|
|
361
361
|
async load() {
|
|
362
|
-
|
|
363
|
-
const
|
|
364
|
-
|
|
362
|
+
G?.abort();
|
|
363
|
+
const Q = G = new AbortController();
|
|
364
|
+
F.value = "loading";
|
|
365
365
|
try {
|
|
366
|
-
const
|
|
367
|
-
if (
|
|
368
|
-
|
|
369
|
-
} catch (
|
|
370
|
-
if (
|
|
371
|
-
|
|
366
|
+
const Z = await o.list(l.id, { signal: Q.signal });
|
|
367
|
+
if (Q.signal.aborted) return;
|
|
368
|
+
f.value = [...Z].sort(te), F.value = "ready";
|
|
369
|
+
} catch (Z) {
|
|
370
|
+
if (Q.signal.aborted || Oe(Z)) return;
|
|
371
|
+
F.value = "failed";
|
|
372
372
|
}
|
|
373
373
|
},
|
|
374
|
-
current:
|
|
375
|
-
async save(
|
|
376
|
-
const se = await o.save(
|
|
377
|
-
return
|
|
374
|
+
current: pe,
|
|
375
|
+
async save(Q, Z) {
|
|
376
|
+
const se = await o.save(l.id, Q, { ...pe(), ...Z });
|
|
377
|
+
return f.value = [...f.value.filter((_t) => _t.id !== se.id), se].sort(te), se;
|
|
378
378
|
},
|
|
379
|
-
apply(
|
|
380
|
-
const
|
|
381
|
-
|
|
379
|
+
apply(Q) {
|
|
380
|
+
const Z = U(Q);
|
|
381
|
+
Z && E({ filters: Z.filters, search: Z.search, view: Q.state.view ? Z.view : m.value.view }, !0);
|
|
382
382
|
},
|
|
383
|
-
stageRemoval(
|
|
384
|
-
const
|
|
385
|
-
return
|
|
383
|
+
stageRemoval(Q) {
|
|
384
|
+
const Z = f.value.find((se) => se.id === Q) ?? null;
|
|
385
|
+
return f.value = f.value.filter((se) => se.id !== Q), {
|
|
386
386
|
revert() {
|
|
387
|
-
|
|
387
|
+
Z && !f.value.some((se) => se.id === Q) && (f.value = [...f.value, Z].sort(te));
|
|
388
388
|
},
|
|
389
389
|
// Saved again under the same name while the toast was up: the server replaced that very row, it must not be deleted now.
|
|
390
390
|
async commit() {
|
|
391
|
-
|
|
391
|
+
f.value.some((se) => se.id === Q) || await o.remove(l.id, Q);
|
|
392
392
|
}
|
|
393
393
|
};
|
|
394
394
|
}
|
|
395
395
|
};
|
|
396
396
|
}
|
|
397
|
-
function
|
|
398
|
-
|
|
397
|
+
function _() {
|
|
398
|
+
L || (L = !0, z?.abort(), D++, C(), p());
|
|
399
399
|
}
|
|
400
|
-
return
|
|
401
|
-
|
|
402
|
-
}),
|
|
403
|
-
id:
|
|
404
|
-
pageSizes:
|
|
405
|
-
rowKey: (o) =>
|
|
406
|
-
state:
|
|
407
|
-
query:
|
|
408
|
-
page:
|
|
409
|
-
rows:
|
|
410
|
-
total:
|
|
411
|
-
display:
|
|
412
|
-
isFiltered:
|
|
400
|
+
return Ie() && qe(_), bt((o) => {
|
|
401
|
+
z?.abort(), D++, $.value = { status: "loading" }, N.value = null, S.value = null, ne(), o !== null && M();
|
|
402
|
+
}), M(), {
|
|
403
|
+
id: l.id,
|
|
404
|
+
pageSizes: l.contract.pageSizes,
|
|
405
|
+
rowKey: (o) => l.key(o),
|
|
406
|
+
state: $,
|
|
407
|
+
query: m,
|
|
408
|
+
page: k,
|
|
409
|
+
rows: ce,
|
|
410
|
+
total: h(() => k.value?.total ?? 0),
|
|
411
|
+
display: re,
|
|
412
|
+
isFiltered: de,
|
|
413
413
|
error: S,
|
|
414
|
-
columns:
|
|
415
|
-
const o =
|
|
416
|
-
if (
|
|
417
|
-
for (const
|
|
414
|
+
columns: h(() => {
|
|
415
|
+
const o = Re(e.columns) ?? [], f = l.contract.sorts;
|
|
416
|
+
if (f) {
|
|
417
|
+
for (const F of o) if (F.sort !== void 0 && !f.includes(F.sort)) throw new Error(`${t}: column "${F.key}" sorts by "${F.sort}", which is not in the query contract's sorts (${f.join(", ")}).`);
|
|
418
418
|
}
|
|
419
419
|
return o;
|
|
420
420
|
}),
|
|
421
|
-
filters:
|
|
422
|
-
views:
|
|
423
|
-
savedViews:
|
|
424
|
-
refresh:
|
|
421
|
+
filters: h(() => Re(e.filters) ?? []),
|
|
422
|
+
views: fe,
|
|
423
|
+
savedViews: w,
|
|
424
|
+
refresh: ee,
|
|
425
425
|
goToPage: (o) => {
|
|
426
|
-
Number.isInteger(o) && o >= 1 && o !==
|
|
426
|
+
Number.isInteger(o) && o >= 1 && o !== m.value.page && E({ page: o });
|
|
427
427
|
},
|
|
428
428
|
nextPage: () => {
|
|
429
|
-
const o =
|
|
430
|
-
|
|
429
|
+
const o = k.value?.lastPage ?? 0;
|
|
430
|
+
m.value.page < o && E({ page: m.value.page + 1 });
|
|
431
431
|
},
|
|
432
432
|
previousPage: () => {
|
|
433
|
-
|
|
433
|
+
m.value.page > 1 && E({ page: m.value.page - 1 });
|
|
434
434
|
},
|
|
435
435
|
setPageSize: (o) => {
|
|
436
|
-
|
|
436
|
+
l.contract.pageSizes.includes(o) && o !== m.value.pageSize && E({ pageSize: o }, !0);
|
|
437
437
|
},
|
|
438
|
-
sortBy: (o,
|
|
439
|
-
if (
|
|
440
|
-
|
|
438
|
+
sortBy: (o, f = "asc") => {
|
|
439
|
+
if (l.contract.sorts && !l.contract.sorts.includes(o)) throw new Error(`${t}: "${o}" is not in the query contract's sorts.`);
|
|
440
|
+
E({ sort: o, direction: f });
|
|
441
441
|
},
|
|
442
442
|
toggleSort: (o) => {
|
|
443
|
-
const
|
|
444
|
-
|
|
443
|
+
const f = m.value;
|
|
444
|
+
E({ sort: o, direction: f.sort === o && f.direction === "asc" ? "desc" : "asc" });
|
|
445
445
|
},
|
|
446
|
-
search: (o) =>
|
|
447
|
-
setFilter: (o,
|
|
448
|
-
setFilters: (o) =>
|
|
449
|
-
clearFilters: () =>
|
|
450
|
-
setView: (o) =>
|
|
446
|
+
search: (o) => E({ search: o }, !0),
|
|
447
|
+
setFilter: (o, f) => E({ filters: ie({ [o]: f }) }, !0),
|
|
448
|
+
setFilters: (o) => E({ filters: ie(o) }, !0),
|
|
449
|
+
clearFilters: () => E({ filters: {}, search: "" }, !0),
|
|
450
|
+
setView: (o) => E({ view: o }, !0),
|
|
451
451
|
reset: () => {
|
|
452
|
-
|
|
452
|
+
m.value = l.defaults, M();
|
|
453
453
|
},
|
|
454
454
|
recordLocation: (o) => {
|
|
455
|
-
const
|
|
456
|
-
return
|
|
455
|
+
const f = e.recordRoute?.(o);
|
|
456
|
+
return f ? a ? qt(f, { [xe]: $e(l, m.value) }) : f : null;
|
|
457
457
|
},
|
|
458
|
-
linkContext: () =>
|
|
458
|
+
linkContext: () => a ? { [xe]: $e(l, m.value) } : {}
|
|
459
459
|
};
|
|
460
460
|
}
|
|
461
|
-
const
|
|
462
|
-
for (const e of
|
|
461
|
+
const Ae = (l) => typeof l == "object" && l !== null && !Array.isArray(l), ye = (...l) => {
|
|
462
|
+
for (const e of l) if (typeof e == "number" && Number.isFinite(e)) return e;
|
|
463
463
|
return null;
|
|
464
464
|
};
|
|
465
|
-
function
|
|
465
|
+
function Wt(l) {
|
|
466
466
|
return {
|
|
467
467
|
// Filters first: the reserved names below always win, a filter called "page" cannot break paging.
|
|
468
|
-
...
|
|
469
|
-
page:
|
|
470
|
-
per_page:
|
|
471
|
-
order_col:
|
|
472
|
-
order_dir:
|
|
473
|
-
search:
|
|
474
|
-
view:
|
|
468
|
+
...l.filters,
|
|
469
|
+
page: l.page,
|
|
470
|
+
per_page: l.pageSize,
|
|
471
|
+
order_col: l.sort,
|
|
472
|
+
order_dir: l.sort ? l.direction : null,
|
|
473
|
+
search: l.search,
|
|
474
|
+
view: l.view
|
|
475
475
|
};
|
|
476
476
|
}
|
|
477
|
-
function
|
|
478
|
-
const
|
|
477
|
+
function Yt(l, e) {
|
|
478
|
+
const t = l.data, i = Ae(t) && Array.isArray(t.data), a = Array.isArray(t) ? t : i ? t.data : [], n = i ? t : {}, u = Ae(l.meta) ? l.meta : Ae(n.meta) ? n.meta : {}, p = ye(n.per_page, u.per_page) ?? e.pageSize, g = ye(n.total, u.total) ?? a.length, m = ye(n.current_page, u.page, u.current_page) ?? e.page, $ = ye(n.last_page, u.last_page) ?? (g === 0 ? 0 : Math.ceil(g / Math.max(1, p))), S = ye(n.from, u.from) ?? (a.length === 0 ? 0 : (m - 1) * p + 1), N = ye(n.to, u.to) ?? (a.length === 0 ? 0 : S + a.length - 1), k = Array.isArray(u.views) ? u.views : Array.isArray(n.views) ? n.views : void 0;
|
|
479
479
|
return {
|
|
480
|
-
rows:
|
|
481
|
-
total:
|
|
482
|
-
page:
|
|
483
|
-
pageSize:
|
|
484
|
-
lastPage:
|
|
480
|
+
rows: a,
|
|
481
|
+
total: g,
|
|
482
|
+
page: m,
|
|
483
|
+
pageSize: p,
|
|
484
|
+
lastPage: $,
|
|
485
485
|
from: S,
|
|
486
|
-
to:
|
|
487
|
-
views:
|
|
488
|
-
meta:
|
|
489
|
-
requestId:
|
|
486
|
+
to: N,
|
|
487
|
+
views: k?.filter(Ae).flatMap((L) => typeof L.key == "string" ? [{ key: L.key, count: ye(L.count) ?? void 0 }] : []),
|
|
488
|
+
meta: u,
|
|
489
|
+
requestId: l.requestId
|
|
490
490
|
};
|
|
491
491
|
}
|
|
492
|
-
function
|
|
493
|
-
return async (
|
|
494
|
-
const
|
|
495
|
-
return
|
|
492
|
+
function is(l, e, t = {}) {
|
|
493
|
+
return async (i, { signal: a }) => {
|
|
494
|
+
const n = await l.get(e, { query: t.params ? t.params(i) : Wt(i), signal: a });
|
|
495
|
+
return Yt(n, i);
|
|
496
496
|
};
|
|
497
497
|
}
|
|
498
|
-
const
|
|
499
|
-
function
|
|
500
|
-
const
|
|
501
|
-
let
|
|
502
|
-
function
|
|
503
|
-
const
|
|
504
|
-
let
|
|
505
|
-
for (
|
|
506
|
-
S.get(
|
|
507
|
-
})), S.set(
|
|
508
|
-
return
|
|
509
|
-
if (
|
|
498
|
+
const Qt = 8;
|
|
499
|
+
function cs(l, e) {
|
|
500
|
+
const t = St(), i = e.from ?? (() => typeof t.query[xe] == "string" ? t.query[xe] : null), a = e.stateKey ?? "query", n = ae(null), u = ae(0), p = we(null), g = we(null), m = ae(!1), $ = we(null), S = /* @__PURE__ */ new Map();
|
|
501
|
+
let N = 0, k = new AbortController(), L = !1;
|
|
502
|
+
function z(M, ee, O) {
|
|
503
|
+
const A = { ...M, page: ee }, I = Gt(A);
|
|
504
|
+
let T = S.get(I);
|
|
505
|
+
for (T ? S.delete(I) : (T = (async () => l.load(A, { signal: O }))(), T.catch(() => {
|
|
506
|
+
S.get(I) === T && S.delete(I);
|
|
507
|
+
})), S.set(I, T); S.size > Qt; ) S.delete(S.keys().next().value);
|
|
508
|
+
return T.catch((b) => {
|
|
509
|
+
if (Oe(b)) throw b;
|
|
510
510
|
return null;
|
|
511
511
|
});
|
|
512
512
|
}
|
|
513
|
-
function
|
|
514
|
-
|
|
513
|
+
function D() {
|
|
514
|
+
n.value = null, p.value = null, g.value = null, u.value = 0, $.value = null;
|
|
515
515
|
}
|
|
516
|
-
async function
|
|
517
|
-
const
|
|
518
|
-
if (!
|
|
519
|
-
|
|
516
|
+
async function x() {
|
|
517
|
+
const M = ++N, ee = k.signal, O = Ne(l, i()), A = e.current();
|
|
518
|
+
if (!O || A === null || A === void 0 || A === "") {
|
|
519
|
+
D(), m.value = !1;
|
|
520
520
|
return;
|
|
521
521
|
}
|
|
522
|
-
|
|
523
|
-
const
|
|
524
|
-
const
|
|
525
|
-
return { key:
|
|
522
|
+
m.value = !0, p.value = null, g.value = null;
|
|
523
|
+
const I = (b) => b ? b.rows.findIndex((C) => String(l.key(C)) === String(A)) : -1, T = (b, C) => {
|
|
524
|
+
const E = $e(l, { ...O, page: b });
|
|
525
|
+
return { key: C, to: { name: t.name ?? void 0, params: { ...t.params, [e.param]: String(C) }, query: { ...t.query, [xe]: E }, hash: t.hash } };
|
|
526
526
|
};
|
|
527
527
|
try {
|
|
528
|
-
let
|
|
529
|
-
for (const
|
|
530
|
-
if (
|
|
531
|
-
const
|
|
532
|
-
|
|
528
|
+
let b = O.page, C = await z(O, b, ee), E = I(C);
|
|
529
|
+
for (const ne of [b - 1, b + 1]) {
|
|
530
|
+
if (E !== -1 || !C || ne < 1 || ne > C.lastPage) continue;
|
|
531
|
+
const w = await z(O, ne, ee), U = I(w);
|
|
532
|
+
w && U !== -1 && (b = ne, C = w, E = U);
|
|
533
533
|
}
|
|
534
|
-
if (
|
|
535
|
-
if (!
|
|
536
|
-
|
|
534
|
+
if (M !== N) return;
|
|
535
|
+
if (!C || E === -1) {
|
|
536
|
+
D();
|
|
537
537
|
return;
|
|
538
538
|
}
|
|
539
|
-
const
|
|
540
|
-
let
|
|
541
|
-
if (
|
|
542
|
-
else if (
|
|
543
|
-
const
|
|
544
|
-
|
|
539
|
+
const ie = C.pageSize || O.pageSize, de = C.rows;
|
|
540
|
+
let ce = null;
|
|
541
|
+
if (E > 0) ce = T(b, l.key(de[E - 1]));
|
|
542
|
+
else if (b > 1) {
|
|
543
|
+
const ne = await z(O, b - 1, ee), w = ne?.rows[ne.rows.length - 1];
|
|
544
|
+
w !== void 0 && (ce = T(b - 1, l.key(w)));
|
|
545
545
|
}
|
|
546
|
-
let
|
|
547
|
-
if (
|
|
548
|
-
else if (
|
|
549
|
-
const
|
|
550
|
-
|
|
546
|
+
let re = null;
|
|
547
|
+
if (E < de.length - 1) re = T(b, l.key(de[E + 1]));
|
|
548
|
+
else if (b < C.lastPage) {
|
|
549
|
+
const w = (await z(O, b + 1, ee))?.rows[0];
|
|
550
|
+
w !== void 0 && (re = T(b + 1, l.key(w)));
|
|
551
551
|
}
|
|
552
|
-
if (
|
|
553
|
-
|
|
554
|
-
const
|
|
555
|
-
|
|
556
|
-
} catch (
|
|
557
|
-
if (!
|
|
552
|
+
if (M !== N) return;
|
|
553
|
+
u.value = C.total, n.value = (b - 1) * ie + E + 1, p.value = ce, g.value = re;
|
|
554
|
+
const fe = e.list;
|
|
555
|
+
$.value = typeof fe == "string" ? fe : { ...fe, query: { ...fe.query, [a]: $e(l, { ...O, page: b }) } };
|
|
556
|
+
} catch (b) {
|
|
557
|
+
if (!Oe(b)) throw b;
|
|
558
558
|
} finally {
|
|
559
|
-
|
|
559
|
+
M === N && (m.value = !1);
|
|
560
560
|
}
|
|
561
561
|
}
|
|
562
|
-
const R =
|
|
563
|
-
function
|
|
564
|
-
|
|
562
|
+
const R = Se([i, e.current], x, { immediate: !0 });
|
|
563
|
+
function B() {
|
|
564
|
+
L || (L = !0, N++, k.abort(), R(), S.clear());
|
|
565
565
|
}
|
|
566
|
-
return
|
|
567
|
-
|
|
568
|
-
}), { position:
|
|
566
|
+
return Ie() && qe(B), bt(() => {
|
|
567
|
+
k.abort(), k = new AbortController(), S.clear(), x();
|
|
568
|
+
}), { position: n, total: u, previous: p, next: g, loading: m, listRoute: $, context: {
|
|
569
569
|
get back() {
|
|
570
|
-
return { label: typeof e.backLabel == "function" ? e.backLabel() : e.backLabel, to:
|
|
570
|
+
return { label: typeof e.backLabel == "function" ? e.backLabel() : e.backLabel, to: $.value ?? e.list };
|
|
571
571
|
},
|
|
572
572
|
get neighbors() {
|
|
573
|
-
return
|
|
573
|
+
return n.value === null ? null : { position: n.value, total: u.value, previous: p.value?.to ?? null, next: g.value?.to ?? null };
|
|
574
574
|
}
|
|
575
575
|
} };
|
|
576
576
|
}
|
|
577
|
-
function
|
|
578
|
-
const e = new Map(Object.entries(
|
|
579
|
-
let
|
|
580
|
-
const
|
|
581
|
-
let
|
|
582
|
-
return
|
|
577
|
+
function us(l = {}) {
|
|
578
|
+
const e = new Map(Object.entries(l).map(([a, n]) => [a, [...n]]));
|
|
579
|
+
let t = 1;
|
|
580
|
+
const i = (a) => {
|
|
581
|
+
let n = e.get(a);
|
|
582
|
+
return n || e.set(a, n = []), n;
|
|
583
583
|
};
|
|
584
584
|
return {
|
|
585
|
-
async list(
|
|
586
|
-
return [...
|
|
585
|
+
async list(a) {
|
|
586
|
+
return [...i(a)];
|
|
587
587
|
},
|
|
588
|
-
async save(
|
|
589
|
-
const
|
|
590
|
-
return
|
|
588
|
+
async save(a, n, u) {
|
|
589
|
+
const p = i(a), g = p.findIndex(($) => $.name === n), m = { id: g === -1 ? `view-${t++}` : p[g].id, name: n, state: u };
|
|
590
|
+
return g === -1 ? p.push(m) : p[g] = m, m;
|
|
591
591
|
},
|
|
592
|
-
async remove(
|
|
593
|
-
const
|
|
594
|
-
|
|
592
|
+
async remove(a, n) {
|
|
593
|
+
const u = i(a), p = u.findIndex((g) => g.id === n);
|
|
594
|
+
p !== -1 && u.splice(p, 1);
|
|
595
595
|
}
|
|
596
596
|
};
|
|
597
597
|
}
|
|
598
|
-
|
|
599
|
-
const l = (e ?? "").split(/\s+/).filter((r) => r !== "");
|
|
600
|
-
if (l.length === 0 || t === "") return [{ text: t, match: !1 }];
|
|
601
|
-
const s = new RegExp(`(${l.sort((r, a) => a.length - r.length).map((r) => r.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})`, "giu");
|
|
602
|
-
return t.split(s).flatMap((r, a) => r === "" ? [] : [{ text: r, match: a % 2 === 1 }]);
|
|
603
|
-
}
|
|
604
|
-
const rl = { class: "flex min-w-0 flex-col" }, il = {
|
|
605
|
-
key: 1,
|
|
606
|
-
class: "truncate text-row-title"
|
|
607
|
-
}, cl = ["data-row-click-ignore"], nt = "rounded-sm bg-status-warning-surface text-status-warning-content", st = /* @__PURE__ */ we({
|
|
608
|
-
__name: "RecordIdentity",
|
|
609
|
-
props: {
|
|
610
|
-
title: {},
|
|
611
|
-
subtitle: { default: null },
|
|
612
|
-
to: { default: null },
|
|
613
|
-
subtitleSelectable: { type: Boolean, default: !1 },
|
|
614
|
-
highlight: { default: null }
|
|
615
|
-
},
|
|
616
|
-
setup(t) {
|
|
617
|
-
const e = t, l = _(() => al(e.title, e.highlight));
|
|
618
|
-
return (s, r) => (i(), d("div", rl, [
|
|
619
|
-
e.to ? (i(), W(n(mt), {
|
|
620
|
-
key: 0,
|
|
621
|
-
to: e.to,
|
|
622
|
-
class: "block truncate rounded-sm text-row-title focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus"
|
|
623
|
-
}, {
|
|
624
|
-
default: B(() => [
|
|
625
|
-
(i(!0), d(I, null, Z(l.value, (a, c) => (i(), d(I, { key: c }, [
|
|
626
|
-
a.match ? (i(), d("mark", {
|
|
627
|
-
key: 0,
|
|
628
|
-
class: le(nt)
|
|
629
|
-
}, y(a.text), 1)) : (i(), d(I, { key: 1 }, [
|
|
630
|
-
ne(y(a.text), 1)
|
|
631
|
-
], 64))
|
|
632
|
-
], 64))), 128))
|
|
633
|
-
]),
|
|
634
|
-
_: 1
|
|
635
|
-
}, 8, ["to"])) : (i(), d("span", il, [
|
|
636
|
-
(i(!0), d(I, null, Z(l.value, (a, c) => (i(), d(I, { key: c }, [
|
|
637
|
-
a.match ? (i(), d("mark", {
|
|
638
|
-
key: 0,
|
|
639
|
-
class: le(nt)
|
|
640
|
-
}, y(a.text), 1)) : (i(), d(I, { key: 1 }, [
|
|
641
|
-
ne(y(a.text), 1)
|
|
642
|
-
], 64))
|
|
643
|
-
], 64))), 128))
|
|
644
|
-
])),
|
|
645
|
-
e.subtitle ? (i(), d("span", {
|
|
646
|
-
key: 2,
|
|
647
|
-
"data-row-click-ignore": e.subtitleSelectable ? "" : void 0,
|
|
648
|
-
class: le(["truncate text-row-subtitle", { "w-fit cursor-text select-text": e.subtitleSelectable }])
|
|
649
|
-
}, y(e.subtitle), 11, cl)) : L("", !0)
|
|
650
|
-
]));
|
|
651
|
-
}
|
|
652
|
-
});
|
|
653
|
-
function xt(t, e) {
|
|
654
|
-
let l = t;
|
|
655
|
-
for (const s of String(e).split(".")) {
|
|
656
|
-
if (typeof l != "object" || l === null) return;
|
|
657
|
-
l = l[s];
|
|
658
|
-
}
|
|
659
|
-
return l;
|
|
660
|
-
}
|
|
661
|
-
const ul = {
|
|
662
|
-
key: 0,
|
|
663
|
-
class: "flex items-center gap-3"
|
|
664
|
-
}, dl = ["datetime"], fl = {
|
|
665
|
-
key: 2,
|
|
666
|
-
class: "tabular-nums"
|
|
667
|
-
}, pl = {
|
|
668
|
-
key: 3,
|
|
669
|
-
class: "tabular-nums"
|
|
670
|
-
}, Te = /* @__PURE__ */ we({
|
|
671
|
-
__name: "CollectionCell",
|
|
672
|
-
props: {
|
|
673
|
-
column: {},
|
|
674
|
-
item: {},
|
|
675
|
-
compact: { type: Boolean },
|
|
676
|
-
to: {},
|
|
677
|
-
search: {}
|
|
678
|
-
},
|
|
679
|
-
setup(t) {
|
|
680
|
-
const e = t, l = Ve(), s = _(() => xt(e.item, e.column.key)), r = _(() => s.value), a = _(() => s.value === null || s.value === void 0 ? "" : String(s.value)), c = _(() => typeof s.value == "number" ? s.value : typeof s.value == "string" && s.value.trim() !== "" ? Number(s.value) : null);
|
|
681
|
-
return (f, b) => e.column.kind === "identity" ? (i(), d(I, { key: 0 }, [
|
|
682
|
-
!e.compact && f.$slots.leading ? (i(), d("div", ul, [
|
|
683
|
-
pe(f.$slots, "leading"),
|
|
684
|
-
O(st, {
|
|
685
|
-
to: e.to,
|
|
686
|
-
title: e.column.title?.(e.item) ?? a.value,
|
|
687
|
-
subtitle: e.column.subtitle?.(e.item),
|
|
688
|
-
highlight: e.search,
|
|
689
|
-
"subtitle-selectable": ""
|
|
690
|
-
}, null, 8, ["to", "title", "subtitle", "highlight"])
|
|
691
|
-
])) : (i(), W(st, {
|
|
692
|
-
key: 1,
|
|
693
|
-
to: e.to,
|
|
694
|
-
title: e.column.title?.(e.item) ?? a.value,
|
|
695
|
-
subtitle: e.column.subtitle?.(e.item),
|
|
696
|
-
highlight: e.search,
|
|
697
|
-
"subtitle-selectable": ""
|
|
698
|
-
}, null, 8, ["to", "title", "subtitle", "highlight"]))
|
|
699
|
-
], 64)) : e.column.kind === "timestamp" ? (i(), d(I, { key: 1 }, [
|
|
700
|
-
e.compact && r.value ? (i(), d("time", {
|
|
701
|
-
key: 0,
|
|
702
|
-
class: "tabular-nums",
|
|
703
|
-
datetime: String(s.value)
|
|
704
|
-
}, y(e.column.precision === "date" ? n(l).date(r.value) : n(l).dateTime(r.value)), 9, dl)) : e.compact ? L("", !0) : (i(), W(n(It), {
|
|
705
|
-
key: 1,
|
|
706
|
-
value: r.value,
|
|
707
|
-
precision: e.column.precision ?? "dateTime"
|
|
708
|
-
}, null, 8, ["value", "precision"]))
|
|
709
|
-
], 64)) : e.column.kind === "number" ? (i(), d("span", fl, y(n(l).number(c.value, e.column.format)), 1)) : e.column.kind === "money" ? (i(), d("span", pl, y(n(l).money(c.value, typeof e.column.currency == "function" ? e.column.currency(e.item) : e.column.currency)), 1)) : e.column.kind === "badge" ? (i(), W(n(Nt), {
|
|
710
|
-
key: 4,
|
|
711
|
-
tone: e.column.tone(e.item),
|
|
712
|
-
dot: ""
|
|
713
|
-
}, {
|
|
714
|
-
default: B(() => [
|
|
715
|
-
ne(y(e.column.text?.(e.item) ?? a.value), 1)
|
|
716
|
-
]),
|
|
717
|
-
_: 1
|
|
718
|
-
}, 8, ["tone"])) : (i(), d(I, { key: 5 }, [
|
|
719
|
-
ne(y(a.value), 1)
|
|
720
|
-
], 64));
|
|
721
|
-
}
|
|
722
|
-
}), vl = {
|
|
598
|
+
const Zt = {
|
|
723
599
|
class: "mx-auto max-w-xl py-8 text-center",
|
|
724
600
|
"data-test": "collection-empty-filtered"
|
|
725
|
-
},
|
|
601
|
+
}, eo = { class: "mt-3 mb-1 text-headline font-semibold text-content-strong" }, to = { class: "text-sm text-content-muted" }, oo = { class: "mt-4 flex flex-wrap justify-center gap-2" }, lo = {
|
|
726
602
|
key: 0,
|
|
727
603
|
class: "shrink-0 text-content-muted"
|
|
728
|
-
},
|
|
604
|
+
}, no = ["title"], so = ["aria-label", "onClick"], ao = { class: "mt-5 flex flex-wrap justify-center gap-2" }, ro = /* @__PURE__ */ ue({
|
|
729
605
|
__name: "CollectionEmptyResult",
|
|
730
606
|
props: {
|
|
731
607
|
chips: {},
|
|
732
608
|
lastChip: {}
|
|
733
609
|
},
|
|
734
610
|
emits: ["remove", "clearAll"],
|
|
735
|
-
setup(
|
|
736
|
-
const
|
|
737
|
-
return (
|
|
738
|
-
|
|
611
|
+
setup(l, { emit: e }) {
|
|
612
|
+
const t = l, i = e, { t: a } = he();
|
|
613
|
+
return (n, u) => (c(), d("div", Zt, [
|
|
614
|
+
P(s(H), {
|
|
739
615
|
name: "filter3",
|
|
740
616
|
size: 32,
|
|
741
617
|
class: "mx-auto text-content-disabled"
|
|
742
618
|
}),
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
(
|
|
747
|
-
key:
|
|
619
|
+
v("h3", eo, y(s(a)("core.collection.empty.title")), 1),
|
|
620
|
+
v("p", to, y(s(a)("core.collection.empty.description")), 1),
|
|
621
|
+
v("ul", oo, [
|
|
622
|
+
(c(!0), d(V, null, X(t.chips, (p) => (c(), d("li", {
|
|
623
|
+
key: p.key,
|
|
748
624
|
class: "inline-flex h-7 max-w-full min-w-0 items-center gap-1.5 rounded-control bg-surface-cell pr-0.5 pl-2.5 text-sm shadow-group ring-1 ring-inset ring-border-separator"
|
|
749
625
|
}, [
|
|
750
|
-
|
|
751
|
-
|
|
626
|
+
p.label ? (c(), d("span", lo, y(p.label), 1)) : j("", !0),
|
|
627
|
+
v("span", {
|
|
752
628
|
class: "min-w-0 truncate font-medium text-content-strong",
|
|
753
|
-
title:
|
|
754
|
-
}, y(
|
|
755
|
-
|
|
629
|
+
title: p.values.join(" › ")
|
|
630
|
+
}, y(p.values.join(" › ")), 9, no),
|
|
631
|
+
v("button", {
|
|
756
632
|
type: "button",
|
|
757
633
|
class: "shrink-0 cursor-pointer rounded p-1 text-content-disabled hover:bg-fill hover:text-content-strong",
|
|
758
|
-
"aria-label": `${
|
|
759
|
-
onClick: (
|
|
634
|
+
"aria-label": `${s(a)("core.collection.clear")}: ${p.label ?? p.values.join(" › ")}`,
|
|
635
|
+
onClick: (g) => i("remove", p)
|
|
760
636
|
}, [
|
|
761
|
-
|
|
637
|
+
P(s(H), {
|
|
762
638
|
name: "close",
|
|
763
639
|
size: 12
|
|
764
640
|
})
|
|
765
|
-
], 8,
|
|
641
|
+
], 8, so)
|
|
766
642
|
]))), 128))
|
|
767
643
|
]),
|
|
768
|
-
|
|
769
|
-
|
|
644
|
+
v("div", ao, [
|
|
645
|
+
t.lastChip ? (c(), Y(be, _e({ key: 0 }, { "data-test": "collection-empty-remove-last" }, {
|
|
770
646
|
prominence: "secondary",
|
|
771
647
|
size: "sm",
|
|
772
|
-
onClick:
|
|
648
|
+
onClick: u[0] || (u[0] = (p) => i("remove", t.lastChip))
|
|
773
649
|
}), {
|
|
774
|
-
default:
|
|
775
|
-
|
|
650
|
+
default: q(() => [
|
|
651
|
+
le(y(s(a)("core.collection.empty.remove_last", { filter: t.lastChip.values.join(" › ") })), 1)
|
|
776
652
|
]),
|
|
777
653
|
_: 1
|
|
778
|
-
}, 16)) :
|
|
779
|
-
|
|
654
|
+
}, 16)) : j("", !0),
|
|
655
|
+
P(be, _e({ "data-test": "collection-empty-clear-all" }, {
|
|
780
656
|
size: "sm",
|
|
781
|
-
onClick:
|
|
657
|
+
onClick: u[1] || (u[1] = (p) => i("clearAll"))
|
|
782
658
|
}), {
|
|
783
|
-
default:
|
|
784
|
-
|
|
659
|
+
default: q(() => [
|
|
660
|
+
le(y(s(a)("core.collection.empty.clear_all")), 1)
|
|
785
661
|
]),
|
|
786
662
|
_: 1
|
|
787
663
|
}, 16)
|
|
788
664
|
])
|
|
789
665
|
]));
|
|
790
666
|
}
|
|
791
|
-
}),
|
|
667
|
+
}), io = ["aria-label"], co = ["disabled"], uo = { class: "sr-only" }, fo = {
|
|
792
668
|
class: "text-subheadline tabular-nums text-content-muted",
|
|
793
669
|
"aria-live": "polite"
|
|
794
|
-
},
|
|
670
|
+
}, po = ["disabled"], vo = { class: "sr-only" }, mo = {
|
|
795
671
|
key: 1,
|
|
796
672
|
class: "flex select-none flex-col items-center justify-between gap-3 border-t border-border-separator px-4 py-2.5 md:flex-row"
|
|
797
|
-
},
|
|
673
|
+
}, bo = { class: "flex flex-col items-center gap-x-4 text-footnote tabular-nums text-content-muted md:flex-row" }, go = {
|
|
798
674
|
key: 0,
|
|
799
675
|
"aria-live": "polite"
|
|
800
|
-
},
|
|
676
|
+
}, ho = { class: "flex items-center" }, yo = { class: "mr-2" }, wo = ["value"], _o = ["value"], ko = ["aria-label"], xo = ["disabled"], $o = { class: "sr-only" }, So = {
|
|
801
677
|
key: 0,
|
|
802
678
|
class: "px-1.5 text-content-disabled"
|
|
803
|
-
},
|
|
679
|
+
}, Co = ["aria-current", "onClick"], zo = ["disabled"], Ao = { class: "sr-only" }, Po = /* @__PURE__ */ ue({
|
|
804
680
|
__name: "CollectionPager",
|
|
805
681
|
props: {
|
|
806
682
|
collection: {},
|
|
@@ -808,448 +684,1029 @@ const ul = {
|
|
|
808
684
|
flat: { type: Boolean }
|
|
809
685
|
},
|
|
810
686
|
emits: ["turned"],
|
|
811
|
-
setup(
|
|
812
|
-
const
|
|
813
|
-
if (
|
|
814
|
-
const
|
|
815
|
-
|
|
816
|
-
for (let
|
|
817
|
-
return
|
|
687
|
+
setup(l, { emit: e }) {
|
|
688
|
+
const t = l, i = e, { t: a } = he(), n = Le(), u = h(() => t.collection.query.value.page), p = h(() => t.collection.page.value?.lastPage ?? 0), g = h(() => t.collection.page.value), m = h(() => {
|
|
689
|
+
if (p.value <= 1) return p.value === 1 ? [1] : [];
|
|
690
|
+
const k = [1], L = Math.max(2, u.value - 2), z = Math.min(p.value - 1, u.value + 2);
|
|
691
|
+
L > 2 && k.push(null);
|
|
692
|
+
for (let D = L; D <= z; D++) k.push(D);
|
|
693
|
+
return z < p.value - 1 && k.push(null), k.push(p.value), k;
|
|
818
694
|
});
|
|
819
|
-
function
|
|
820
|
-
|
|
695
|
+
function $(k) {
|
|
696
|
+
k === 1 ? t.collection.nextPage() : t.collection.previousPage(), i("turned");
|
|
821
697
|
}
|
|
822
|
-
const S = (
|
|
698
|
+
const S = (k) => [
|
|
823
699
|
"hit-target inline-flex h-7 min-w-7 cursor-pointer items-center justify-center rounded-button px-2 transition-colors duration-motion-fast disabled:cursor-not-allowed disabled:opacity-40",
|
|
824
|
-
|
|
700
|
+
k ? "bg-tint font-semibold text-content-on-tint" : "text-content-strong hover:bg-fill disabled:hover:bg-transparent"
|
|
825
701
|
].join(" ");
|
|
826
|
-
function
|
|
827
|
-
|
|
702
|
+
function N(k) {
|
|
703
|
+
t.collection.setPageSize(Number(k.target.value));
|
|
828
704
|
}
|
|
829
|
-
return (
|
|
705
|
+
return (k, L) => t.compact && p.value > 1 ? (c(), d("nav", {
|
|
830
706
|
key: 0,
|
|
831
|
-
"aria-label":
|
|
832
|
-
class:
|
|
707
|
+
"aria-label": s(a)("core.collection.page.label"),
|
|
708
|
+
class: W(["flex select-none items-center justify-between gap-3 px-1 py-2", t.flat ? "mt-1" : "border-t border-border-separator"]),
|
|
833
709
|
"data-test": "collection-pager-compact"
|
|
834
710
|
}, [
|
|
835
|
-
|
|
711
|
+
v("button", {
|
|
836
712
|
type: "button",
|
|
837
713
|
class: "inline-flex size-11 cursor-pointer items-center justify-center rounded-full text-content-link active:bg-fill disabled:cursor-not-allowed disabled:text-content-disabled",
|
|
838
|
-
disabled:
|
|
839
|
-
onClick:
|
|
714
|
+
disabled: u.value <= 1,
|
|
715
|
+
onClick: L[0] || (L[0] = (z) => $(-1))
|
|
840
716
|
}, [
|
|
841
|
-
|
|
717
|
+
P(s(H), {
|
|
842
718
|
name: "arrowLeftSLine",
|
|
843
719
|
size: 20
|
|
844
720
|
}),
|
|
845
|
-
|
|
846
|
-
], 8,
|
|
847
|
-
|
|
848
|
-
|
|
721
|
+
v("span", uo, y(s(a)("core.collection.page.previous")), 1)
|
|
722
|
+
], 8, co),
|
|
723
|
+
v("span", fo, y(s(a)("core.collection.page.page_of", { current: s(n).number(u.value), total: s(n).number(p.value) })), 1),
|
|
724
|
+
v("button", {
|
|
849
725
|
type: "button",
|
|
850
726
|
class: "inline-flex size-11 cursor-pointer items-center justify-center rounded-full text-content-link active:bg-fill disabled:cursor-not-allowed disabled:text-content-disabled",
|
|
851
|
-
disabled:
|
|
852
|
-
onClick:
|
|
727
|
+
disabled: u.value >= p.value,
|
|
728
|
+
onClick: L[1] || (L[1] = (z) => $(1))
|
|
853
729
|
}, [
|
|
854
|
-
|
|
730
|
+
P(s(H), {
|
|
855
731
|
name: "arrowRightSLine",
|
|
856
732
|
size: 20
|
|
857
733
|
}),
|
|
858
|
-
|
|
859
|
-
], 8,
|
|
860
|
-
], 10,
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
value:
|
|
734
|
+
v("span", vo, y(s(a)("core.collection.page.next")), 1)
|
|
735
|
+
], 8, po)
|
|
736
|
+
], 10, io)) : t.compact ? j("", !0) : (c(), d("div", mo, [
|
|
737
|
+
v("div", bo, [
|
|
738
|
+
g.value ? (c(), d("span", go, y(s(a)("core.collection.page.total", { from: s(n).number(g.value.from), to: s(n).number(g.value.to), total: s(n).number(g.value.total) })), 1)) : j("", !0),
|
|
739
|
+
v("label", ho, [
|
|
740
|
+
v("span", yo, y(s(a)("core.collection.page.per_page")) + ":", 1),
|
|
741
|
+
v("select", {
|
|
742
|
+
value: t.collection.query.value.pageSize,
|
|
867
743
|
class: "cursor-pointer rounded-control bg-transparent py-0.5 pr-1 font-semibold text-content-strong hover:bg-fill",
|
|
868
|
-
onChange:
|
|
744
|
+
onChange: N
|
|
869
745
|
}, [
|
|
870
|
-
(
|
|
871
|
-
key:
|
|
872
|
-
value:
|
|
873
|
-
}, y(
|
|
874
|
-
], 40,
|
|
746
|
+
(c(!0), d(V, null, X(t.collection.pageSizes, (z) => (c(), d("option", {
|
|
747
|
+
key: z,
|
|
748
|
+
value: z
|
|
749
|
+
}, y(z), 9, _o))), 128))
|
|
750
|
+
], 40, wo)
|
|
875
751
|
])
|
|
876
752
|
]),
|
|
877
|
-
|
|
878
|
-
"aria-label":
|
|
753
|
+
v("nav", {
|
|
754
|
+
"aria-label": s(a)("core.collection.page.label"),
|
|
879
755
|
class: "flex items-center gap-0.5 text-subheadline tabular-nums"
|
|
880
756
|
}, [
|
|
881
|
-
|
|
757
|
+
v("button", {
|
|
882
758
|
type: "button",
|
|
883
|
-
class:
|
|
884
|
-
disabled:
|
|
885
|
-
onClick:
|
|
759
|
+
class: W(S(!1)),
|
|
760
|
+
disabled: u.value <= 1,
|
|
761
|
+
onClick: L[2] || (L[2] = (z) => $(-1))
|
|
886
762
|
}, [
|
|
887
|
-
|
|
763
|
+
P(s(H), {
|
|
888
764
|
name: "arrowLeftSLine",
|
|
889
765
|
size: 16
|
|
890
766
|
}),
|
|
891
|
-
|
|
892
|
-
], 10,
|
|
893
|
-
(
|
|
894
|
-
|
|
767
|
+
v("span", $o, y(s(a)("core.collection.page.previous")), 1)
|
|
768
|
+
], 10, xo),
|
|
769
|
+
(c(!0), d(V, null, X(m.value, (z, D) => (c(), d(V, { key: D }, [
|
|
770
|
+
z === null ? (c(), d("span", So, "…")) : (c(), d("button", {
|
|
895
771
|
key: 1,
|
|
896
772
|
type: "button",
|
|
897
|
-
class:
|
|
898
|
-
"aria-current":
|
|
899
|
-
onClick: (
|
|
900
|
-
}, y(n
|
|
773
|
+
class: W(S(z === u.value)),
|
|
774
|
+
"aria-current": z === u.value ? "page" : void 0,
|
|
775
|
+
onClick: (x) => t.collection.goToPage(z)
|
|
776
|
+
}, y(s(n).number(z)), 11, Co))
|
|
901
777
|
], 64))), 128)),
|
|
902
|
-
|
|
778
|
+
v("button", {
|
|
903
779
|
type: "button",
|
|
904
|
-
class:
|
|
905
|
-
disabled:
|
|
906
|
-
onClick:
|
|
780
|
+
class: W(S(!1)),
|
|
781
|
+
disabled: u.value >= p.value,
|
|
782
|
+
onClick: L[3] || (L[3] = (z) => $(1))
|
|
907
783
|
}, [
|
|
908
|
-
|
|
784
|
+
P(s(H), {
|
|
909
785
|
name: "arrowRightSLine",
|
|
910
786
|
size: 16
|
|
911
787
|
}),
|
|
912
|
-
|
|
913
|
-
], 10,
|
|
914
|
-
], 8,
|
|
788
|
+
v("span", Ao, y(s(a)("core.collection.page.next")), 1)
|
|
789
|
+
], 10, zo)
|
|
790
|
+
], 8, ko)
|
|
791
|
+
]));
|
|
792
|
+
}
|
|
793
|
+
});
|
|
794
|
+
function Eo(l, e) {
|
|
795
|
+
const t = (e ?? "").split(/\s+/).filter((a) => a !== "");
|
|
796
|
+
if (t.length === 0 || l === "") return [{ text: l, match: !1 }];
|
|
797
|
+
const i = new RegExp(`(${t.sort((a, n) => n.length - a.length).map((a) => a.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})`, "giu");
|
|
798
|
+
return l.split(i).flatMap((a, n) => a === "" ? [] : [{ text: a, match: n % 2 === 1 }]);
|
|
799
|
+
}
|
|
800
|
+
const Oo = { class: "flex min-w-0 flex-col" }, jo = {
|
|
801
|
+
key: 1,
|
|
802
|
+
class: "truncate text-row-title"
|
|
803
|
+
}, Lo = ["data-row-click-ignore"], Ze = "rounded-sm bg-status-warning-surface text-status-warning-content", et = /* @__PURE__ */ ue({
|
|
804
|
+
__name: "RecordIdentity",
|
|
805
|
+
props: {
|
|
806
|
+
title: {},
|
|
807
|
+
subtitle: { default: null },
|
|
808
|
+
to: { default: null },
|
|
809
|
+
subtitleSelectable: { type: Boolean, default: !1 },
|
|
810
|
+
highlight: { default: null }
|
|
811
|
+
},
|
|
812
|
+
setup(l) {
|
|
813
|
+
const e = l, t = h(() => Eo(e.title, e.highlight));
|
|
814
|
+
return (i, a) => (c(), d("div", Oo, [
|
|
815
|
+
e.to ? (c(), Y(s(ct), {
|
|
816
|
+
key: 0,
|
|
817
|
+
to: e.to,
|
|
818
|
+
class: "block truncate rounded-sm text-row-title focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus"
|
|
819
|
+
}, {
|
|
820
|
+
default: q(() => [
|
|
821
|
+
(c(!0), d(V, null, X(t.value, (n, u) => (c(), d(V, { key: u }, [
|
|
822
|
+
n.match ? (c(), d("mark", {
|
|
823
|
+
key: 0,
|
|
824
|
+
class: W(Ze)
|
|
825
|
+
}, y(n.text), 1)) : (c(), d(V, { key: 1 }, [
|
|
826
|
+
le(y(n.text), 1)
|
|
827
|
+
], 64))
|
|
828
|
+
], 64))), 128))
|
|
829
|
+
]),
|
|
830
|
+
_: 1
|
|
831
|
+
}, 8, ["to"])) : (c(), d("span", jo, [
|
|
832
|
+
(c(!0), d(V, null, X(t.value, (n, u) => (c(), d(V, { key: u }, [
|
|
833
|
+
n.match ? (c(), d("mark", {
|
|
834
|
+
key: 0,
|
|
835
|
+
class: W(Ze)
|
|
836
|
+
}, y(n.text), 1)) : (c(), d(V, { key: 1 }, [
|
|
837
|
+
le(y(n.text), 1)
|
|
838
|
+
], 64))
|
|
839
|
+
], 64))), 128))
|
|
840
|
+
])),
|
|
841
|
+
e.subtitle ? (c(), d("span", {
|
|
842
|
+
key: 2,
|
|
843
|
+
"data-row-click-ignore": e.subtitleSelectable ? "" : void 0,
|
|
844
|
+
class: W(["truncate text-row-subtitle", { "w-fit cursor-text select-text": e.subtitleSelectable }])
|
|
845
|
+
}, y(e.subtitle), 11, Lo)) : j("", !0)
|
|
915
846
|
]));
|
|
916
847
|
}
|
|
917
|
-
})
|
|
848
|
+
});
|
|
849
|
+
function ht(l, e) {
|
|
850
|
+
let t = l;
|
|
851
|
+
for (const i of String(e).split(".")) {
|
|
852
|
+
if (typeof t != "object" || t === null) return;
|
|
853
|
+
t = t[i];
|
|
854
|
+
}
|
|
855
|
+
return t;
|
|
856
|
+
}
|
|
857
|
+
const Ro = {
|
|
858
|
+
key: 0,
|
|
859
|
+
class: "flex items-center gap-3"
|
|
860
|
+
}, To = ["datetime"], Vo = {
|
|
861
|
+
key: 2,
|
|
862
|
+
class: "tabular-nums"
|
|
863
|
+
}, Fo = {
|
|
864
|
+
key: 3,
|
|
865
|
+
class: "tabular-nums"
|
|
866
|
+
}, Pe = /* @__PURE__ */ ue({
|
|
867
|
+
__name: "CollectionCell",
|
|
868
|
+
props: {
|
|
869
|
+
column: {},
|
|
870
|
+
item: {},
|
|
871
|
+
compact: { type: Boolean },
|
|
872
|
+
to: {},
|
|
873
|
+
search: {}
|
|
874
|
+
},
|
|
875
|
+
setup(l) {
|
|
876
|
+
const e = l, t = Le(), i = h(() => ht(e.item, e.column.key)), a = h(() => i.value), n = h(() => i.value === null || i.value === void 0 ? "" : String(i.value)), u = h(() => typeof i.value == "number" ? i.value : typeof i.value == "string" && i.value.trim() !== "" ? Number(i.value) : null);
|
|
877
|
+
return (p, g) => e.column.kind === "identity" ? (c(), d(V, { key: 0 }, [
|
|
878
|
+
!e.compact && p.$slots.leading ? (c(), d("div", Ro, [
|
|
879
|
+
oe(p.$slots, "leading"),
|
|
880
|
+
P(et, {
|
|
881
|
+
to: e.to,
|
|
882
|
+
title: e.column.title?.(e.item) ?? n.value,
|
|
883
|
+
subtitle: e.column.subtitle?.(e.item),
|
|
884
|
+
highlight: e.search,
|
|
885
|
+
"subtitle-selectable": ""
|
|
886
|
+
}, null, 8, ["to", "title", "subtitle", "highlight"])
|
|
887
|
+
])) : (c(), Y(et, {
|
|
888
|
+
key: 1,
|
|
889
|
+
to: e.to,
|
|
890
|
+
title: e.column.title?.(e.item) ?? n.value,
|
|
891
|
+
subtitle: e.column.subtitle?.(e.item),
|
|
892
|
+
highlight: e.search,
|
|
893
|
+
"subtitle-selectable": ""
|
|
894
|
+
}, null, 8, ["to", "title", "subtitle", "highlight"]))
|
|
895
|
+
], 64)) : e.column.kind === "timestamp" ? (c(), d(V, { key: 1 }, [
|
|
896
|
+
e.compact && a.value ? (c(), d("time", {
|
|
897
|
+
key: 0,
|
|
898
|
+
class: "tabular-nums",
|
|
899
|
+
datetime: String(i.value)
|
|
900
|
+
}, y(e.column.precision === "date" ? s(t).date(a.value) : s(t).dateTime(a.value)), 9, To)) : e.compact ? j("", !0) : (c(), Y(s(jt), {
|
|
901
|
+
key: 1,
|
|
902
|
+
value: a.value,
|
|
903
|
+
precision: e.column.precision ?? "dateTime"
|
|
904
|
+
}, null, 8, ["value", "precision"]))
|
|
905
|
+
], 64)) : e.column.kind === "number" ? (c(), d("span", Vo, y(s(t).number(u.value, e.column.format)), 1)) : e.column.kind === "money" ? (c(), d("span", Fo, y(s(t).money(u.value, typeof e.column.currency == "function" ? e.column.currency(e.item) : e.column.currency)), 1)) : e.column.kind === "badge" ? (c(), Y(s(Ot), {
|
|
906
|
+
key: 4,
|
|
907
|
+
tone: e.column.tone(e.item),
|
|
908
|
+
dot: ""
|
|
909
|
+
}, {
|
|
910
|
+
default: q(() => [
|
|
911
|
+
le(y(e.column.text?.(e.item) ?? n.value), 1)
|
|
912
|
+
]),
|
|
913
|
+
_: 1
|
|
914
|
+
}, 8, ["tone"])) : (c(), d(V, { key: 5 }, [
|
|
915
|
+
le(y(n.value), 1)
|
|
916
|
+
], 64));
|
|
917
|
+
}
|
|
918
|
+
}), Mo = 'a, button, input, select, textarea, label, [role="button"], [data-row-click-ignore]', No = 500, Io = 8;
|
|
919
|
+
function qo(l) {
|
|
920
|
+
const e = Ct(), t = ae([]), i = ae("");
|
|
921
|
+
let a = !1, n = null, u = { x: 0, y: 0 };
|
|
922
|
+
const p = (x) => l.actions()?.(x) ?? [];
|
|
923
|
+
function g(x) {
|
|
924
|
+
return p(x).filter((R) => R.href).map((R) => ({ key: R.key, label: R.label, icon: R.icon, href: R.href, tone: R.tone ?? "neutral", external: R.external }));
|
|
925
|
+
}
|
|
926
|
+
function m(x, R, B) {
|
|
927
|
+
const K = p(x);
|
|
928
|
+
return K.length === 0 ? !1 : (i.value = l.label()?.(x) ?? l.moreLabel(), t.value = K.map((M) => ({
|
|
929
|
+
id: M.key,
|
|
930
|
+
label: M.label,
|
|
931
|
+
icon: M.icon,
|
|
932
|
+
section: M.section,
|
|
933
|
+
tone: M.tone === "critical" ? "critical" : void 0,
|
|
934
|
+
onSelect: () => {
|
|
935
|
+
M.onSelect ? M.onSelect() : M.href && (M.external ? window.open(M.href, "_blank", "noopener") : window.location.assign(M.href));
|
|
936
|
+
}
|
|
937
|
+
})), it(() => l.presentMenu(R, B)), !0);
|
|
938
|
+
}
|
|
939
|
+
function $(x, R) {
|
|
940
|
+
const B = x.currentTarget.getBoundingClientRect();
|
|
941
|
+
m(R, B.left, B.bottom);
|
|
942
|
+
}
|
|
943
|
+
function S(x, R) {
|
|
944
|
+
!l.actions() || x.target.closest("a") || m(R, x.clientX, x.clientY) && (x.preventDefault(), a = !0);
|
|
945
|
+
}
|
|
946
|
+
function N() {
|
|
947
|
+
n && clearTimeout(n), n = null;
|
|
948
|
+
}
|
|
949
|
+
function k(x, R) {
|
|
950
|
+
a = !1, !(x.pointerType !== "touch" || !l.actions()) && (u = { x: x.clientX, y: x.clientY }, N(), n = setTimeout(() => {
|
|
951
|
+
n = null, m(R, u.x, u.y) && (a = !0, navigator.vibrate?.(10));
|
|
952
|
+
}, No));
|
|
953
|
+
}
|
|
954
|
+
function L(x) {
|
|
955
|
+
n && Math.hypot(x.clientX - u.x, x.clientY - u.y) > Io && N();
|
|
956
|
+
}
|
|
957
|
+
function z(x) {
|
|
958
|
+
a && (a = !1, x.preventDefault(), x.stopPropagation());
|
|
959
|
+
}
|
|
960
|
+
function D(x, R) {
|
|
961
|
+
const B = l.target(R);
|
|
962
|
+
if (!(!B || x.target.closest(Mo)) && !window.getSelection()?.toString()) {
|
|
963
|
+
if (x.metaKey || x.ctrlKey) {
|
|
964
|
+
window.open(e.resolve(B).href, "_blank");
|
|
965
|
+
return;
|
|
966
|
+
}
|
|
967
|
+
e.push(B);
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
return Ie() && qe(N), { menuItems: t, menuLabel: i, swipeActions: g, openMenuFrom: $, onContextMenu: S, onPointerDown: k, onPointerMove: L, cancelPress: N, onClickCapture: z, onClick: D, actionsOf: p };
|
|
971
|
+
}
|
|
972
|
+
const Do = {
|
|
973
|
+
key: 0,
|
|
974
|
+
class: "overflow-hidden rounded-group bg-surface-cell shadow-group",
|
|
975
|
+
"data-test": "collection-mobile-rows"
|
|
976
|
+
}, Bo = { class: "flex flex-1 flex-col gap-2 pt-1" }, Uo = ["onClick", "onContextmenu", "onPointerdown"], Ho = { class: "flex items-start gap-3" }, Ko = {
|
|
977
|
+
key: 0,
|
|
978
|
+
class: "shrink-0 pt-0.5"
|
|
979
|
+
}, Xo = { class: "flex min-w-0 flex-1 flex-col gap-1" }, Go = { class: "flex min-w-0 items-start gap-3" }, Jo = { class: "min-w-0 flex-1" }, Wo = {
|
|
980
|
+
key: 1,
|
|
981
|
+
class: "block truncate text-row-title"
|
|
982
|
+
}, Yo = {
|
|
983
|
+
key: 0,
|
|
984
|
+
class: "flex shrink-0 items-center gap-2 pt-0.5"
|
|
985
|
+
}, Qo = ["aria-label", "onClick"], Zo = {
|
|
986
|
+
key: 0,
|
|
987
|
+
class: "flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 text-row-meta"
|
|
988
|
+
}, el = {
|
|
989
|
+
key: 1,
|
|
990
|
+
class: "truncate"
|
|
991
|
+
}, tl = {
|
|
992
|
+
key: 2,
|
|
993
|
+
class: "px-4 py-6",
|
|
994
|
+
"data-test": "collection-failed"
|
|
995
|
+
}, ol = {
|
|
996
|
+
key: 3,
|
|
997
|
+
class: "px-4 py-2 text-center",
|
|
998
|
+
"data-test": "collection-empty"
|
|
999
|
+
}, ll = {
|
|
1000
|
+
key: 1,
|
|
1001
|
+
class: "inline-block w-full align-middle"
|
|
1002
|
+
}, nl = { class: "border-b border-border-separator" }, sl = ["aria-sort"], al = ["onClick"], rl = { key: 1 }, il = {
|
|
1003
|
+
key: 0,
|
|
1004
|
+
class: "px-4 pt-2.5 pb-2",
|
|
1005
|
+
style: { width: "20px" }
|
|
1006
|
+
}, cl = { class: "sr-only" }, ul = {
|
|
1007
|
+
key: 0,
|
|
1008
|
+
class: "size-8 shrink-0 rounded-full bg-fill"
|
|
1009
|
+
}, dl = { class: "flex flex-1 flex-col gap-1.5" }, fl = { key: 0 }, pl = ["onClick", "onContextmenu", "onPointerdown"], vl = { key: 0 }, ml = { class: "flex items-center justify-center gap-1" }, bl = ["aria-label", "onClick"], gl = {
|
|
1010
|
+
key: 2,
|
|
1011
|
+
"data-test": "collection-failed"
|
|
1012
|
+
}, hl = ["colspan"], yl = {
|
|
1013
|
+
key: 3,
|
|
1014
|
+
"data-test": "collection-empty"
|
|
1015
|
+
}, wl = ["colspan"], _l = 37, yt = /* @__PURE__ */ ue({
|
|
1016
|
+
__name: "CollectionRows",
|
|
1017
|
+
props: {
|
|
1018
|
+
columns: {},
|
|
1019
|
+
rows: {},
|
|
1020
|
+
rowKey: {},
|
|
1021
|
+
display: {},
|
|
1022
|
+
phone: { type: Boolean },
|
|
1023
|
+
link: {},
|
|
1024
|
+
search: { default: void 0 },
|
|
1025
|
+
sorted: { default: null },
|
|
1026
|
+
rowActions: { type: Function, default: void 0 },
|
|
1027
|
+
rowLabel: { type: Function, default: void 0 },
|
|
1028
|
+
rowHeight: { default: void 0 },
|
|
1029
|
+
density: { default: "regular" },
|
|
1030
|
+
actionsVisible: { type: Boolean, default: !1 },
|
|
1031
|
+
skeletonRows: {},
|
|
1032
|
+
reserveRows: { default: void 0 },
|
|
1033
|
+
rowClass: { type: Function, default: void 0 }
|
|
1034
|
+
},
|
|
1035
|
+
emits: ["sort"],
|
|
1036
|
+
setup(l, { emit: e }) {
|
|
1037
|
+
const t = l, i = e, a = ke(), { t: n } = he(), u = ke(), p = (w) => t.columns.filter((U) => U.mobile === w), g = h(() => p("primary")), m = h(() => p("accessory")), $ = h(() => p("meta")), S = (w) => `cell-${String(w.key).replace(/\./g, "_")}`, N = (w) => !!u[S(w)], k = (w, U) => ht(w, U.key), L = (w) => w == null || w === "", z = { md: "hidden md:table-cell", xl: "hidden xl:table-cell", "2xl": "hidden 2xl:table-cell" }, D = (w) => w.hideBelow ? [z[w.hideBelow]] : [], x = (w) => ["text-nowrap px-4 pt-2.5 pb-2 text-footnote font-normal text-content-muted", ...D(w)], R = { start: "text-left", center: "text-center", end: "text-right" }, B = (w) => [...D(w), R[w.align ?? "start"]], K = { start: "justify-start", center: "justify-center", end: "justify-end" }, M = h(() => t.rows.length > 0 && t.link(t.rows[0]) !== null), ee = ge("rowMenu"), O = qo({
|
|
1038
|
+
actions: () => t.rowActions,
|
|
1039
|
+
label: () => t.rowLabel,
|
|
1040
|
+
target: (w) => t.link(w),
|
|
1041
|
+
presentMenu: (w, U) => ee.value?.presentAt(w, U),
|
|
1042
|
+
moreLabel: () => n("core.page.more_actions")
|
|
1043
|
+
}), A = h(() => !!t.rowActions && (t.actionsVisible || !a.actions && !M.value)), I = h(() => !!a.actions || M.value || A.value), T = (w) => t.rowLabel ? `${n("core.page.more_actions")}: ${t.rowLabel(w)}` : n("core.page.more_actions"), b = (w) => O.actionsOf(w).length > 0, C = h(() => t.columns.length + (I.value ? 1 : 0)), E = (w) => w.sort !== void 0 && t.sorted?.key === w.sort, ie = (w) => w.sort === void 0 ? void 0 : E(w) ? t.sorted?.direction === "asc" ? "ascending" : "descending" : "none", de = (w) => E(w) ? t.sorted?.direction === "asc" ? "arrowUpSLine" : "arrowDownSLine" : "expandUpDownLine", ce = (w) => ({ animationDelay: `${Math.min(w, 8) * 30}ms` }), re = h(() => t.display === "loading"), fe = h(() => re.value && t.reserveRows !== void 0 ? `${t.reserveRows * (t.rowHeight ?? 40) + _l}px` : void 0), ne = h(() => t.display === "empty" || t.display === "no-matches");
|
|
1044
|
+
return (w, U) => (c(), d(V, null, [
|
|
1045
|
+
t.phone ? (c(), d("ul", Do, [
|
|
1046
|
+
re.value ? (c(!0), d(V, { key: 0 }, X(t.skeletonRows, (r) => (c(), d("li", {
|
|
1047
|
+
key: `skeleton-${r}`,
|
|
1048
|
+
"aria-hidden": "true",
|
|
1049
|
+
class: "relative flex animate-pulse items-start gap-3 px-row-inset py-3 motion-reduce:animate-none not-first:before:absolute not-first:before:top-0 not-first:before:right-0 not-first:before:left-row-inset not-first:before:h-px not-first:before:bg-border-separator",
|
|
1050
|
+
style: ve({ animationDelay: `${r * 60}ms` })
|
|
1051
|
+
}, [
|
|
1052
|
+
U[5] || (U[5] = v("span", { class: "size-9 shrink-0 rounded-full bg-fill" }, null, -1)),
|
|
1053
|
+
v("span", Bo, [
|
|
1054
|
+
v("span", {
|
|
1055
|
+
class: "h-2.5 rounded-full bg-fill-strong",
|
|
1056
|
+
style: ve({ width: `${45 + r * 13 % 30}%` })
|
|
1057
|
+
}, null, 4),
|
|
1058
|
+
v("span", {
|
|
1059
|
+
class: "h-2 rounded-full bg-fill",
|
|
1060
|
+
style: ve({ width: `${60 + r * 7 % 25}%` })
|
|
1061
|
+
}, null, 4)
|
|
1062
|
+
])
|
|
1063
|
+
], 4))), 128)) : j("", !0),
|
|
1064
|
+
t.display === "rows" ? (c(!0), d(V, { key: 1 }, X(t.rows, (r, _) => (c(), d("li", {
|
|
1065
|
+
key: t.rowKey(r),
|
|
1066
|
+
style: ve(ce(_)),
|
|
1067
|
+
"data-test": "collection-row",
|
|
1068
|
+
class: W(["relative animate-row-in transition-colors duration-motion-fast active:bg-fill not-first:before:absolute not-first:before:top-0 not-first:before:right-0 not-first:before:left-row-inset not-first:before:z-10 not-first:before:h-px not-first:before:bg-border-separator", [t.link(r) ? "cursor-pointer" : void 0, t.rowClass?.(r)]]),
|
|
1069
|
+
onClickCapture: U[0] || (U[0] = //@ts-ignore
|
|
1070
|
+
(...o) => s(O).onClickCapture && s(O).onClickCapture(...o)),
|
|
1071
|
+
onClick: (o) => s(O).onClick(o, r),
|
|
1072
|
+
onContextmenu: (o) => s(O).onContextMenu(o, r),
|
|
1073
|
+
onPointerdown: (o) => s(O).onPointerDown(o, r),
|
|
1074
|
+
onPointermove: U[1] || (U[1] = //@ts-ignore
|
|
1075
|
+
(...o) => s(O).onPointerMove && s(O).onPointerMove(...o)),
|
|
1076
|
+
onPointerup: U[2] || (U[2] = //@ts-ignore
|
|
1077
|
+
(...o) => s(O).cancelPress && s(O).cancelPress(...o)),
|
|
1078
|
+
onPointercancel: U[3] || (U[3] = //@ts-ignore
|
|
1079
|
+
(...o) => s(O).cancelPress && s(O).cancelPress(...o))
|
|
1080
|
+
}, [
|
|
1081
|
+
P(s(Et), {
|
|
1082
|
+
actions: s(O).swipeActions(r),
|
|
1083
|
+
"content-class": "px-row-inset py-2.5"
|
|
1084
|
+
}, {
|
|
1085
|
+
default: q(() => [
|
|
1086
|
+
v("div", Ho, [
|
|
1087
|
+
a.leading ? (c(), d("div", Ko, [
|
|
1088
|
+
oe(w.$slots, "leading", {
|
|
1089
|
+
item: r,
|
|
1090
|
+
compact: !0
|
|
1091
|
+
})
|
|
1092
|
+
])) : j("", !0),
|
|
1093
|
+
v("div", Xo, [
|
|
1094
|
+
v("div", Go, [
|
|
1095
|
+
v("div", Jo, [
|
|
1096
|
+
(c(!0), d(V, null, X(g.value, (o) => (c(), d(V, {
|
|
1097
|
+
key: String(o.key)
|
|
1098
|
+
}, [
|
|
1099
|
+
N(o) ? oe(w.$slots, S(o), {
|
|
1100
|
+
item: r,
|
|
1101
|
+
value: k(r, o),
|
|
1102
|
+
compact: !0,
|
|
1103
|
+
to: t.link(r),
|
|
1104
|
+
search: t.search
|
|
1105
|
+
}, void 0, void 0, 0) : (c(), d("span", Wo, [
|
|
1106
|
+
P(Pe, {
|
|
1107
|
+
column: o,
|
|
1108
|
+
item: r,
|
|
1109
|
+
compact: !0,
|
|
1110
|
+
to: t.link(r),
|
|
1111
|
+
search: t.search
|
|
1112
|
+
}, null, 8, ["column", "item", "to", "search"])
|
|
1113
|
+
]))
|
|
1114
|
+
], 64))), 128))
|
|
1115
|
+
]),
|
|
1116
|
+
m.value.length || A.value && b(r) ? (c(), d("div", Yo, [
|
|
1117
|
+
(c(!0), d(V, null, X(m.value, (o) => (c(), d(V, {
|
|
1118
|
+
key: String(o.key)
|
|
1119
|
+
}, [
|
|
1120
|
+
N(o) ? oe(w.$slots, S(o), {
|
|
1121
|
+
item: r,
|
|
1122
|
+
value: k(r, o),
|
|
1123
|
+
compact: !0,
|
|
1124
|
+
to: t.link(r),
|
|
1125
|
+
search: t.search
|
|
1126
|
+
}, void 0, void 0, 0) : (c(), Y(Pe, {
|
|
1127
|
+
key: 1,
|
|
1128
|
+
column: o,
|
|
1129
|
+
item: r,
|
|
1130
|
+
compact: !0,
|
|
1131
|
+
to: t.link(r),
|
|
1132
|
+
search: t.search
|
|
1133
|
+
}, null, 8, ["column", "item", "to", "search"]))
|
|
1134
|
+
], 64))), 128)),
|
|
1135
|
+
A.value && b(r) ? (c(), d("button", {
|
|
1136
|
+
key: 0,
|
|
1137
|
+
type: "button",
|
|
1138
|
+
"data-test": "collection-row-more",
|
|
1139
|
+
"aria-label": T(r),
|
|
1140
|
+
class: "hit-target -my-1 -mr-1 flex size-8 cursor-pointer items-center justify-center rounded-full text-content-muted active:bg-fill",
|
|
1141
|
+
onClick: Ee((o) => s(O).openMenuFrom(o, r), ["stop"])
|
|
1142
|
+
}, [
|
|
1143
|
+
P(s(H), {
|
|
1144
|
+
name: "moreLine",
|
|
1145
|
+
size: 20
|
|
1146
|
+
})
|
|
1147
|
+
], 8, Qo)) : j("", !0)
|
|
1148
|
+
])) : j("", !0)
|
|
1149
|
+
]),
|
|
1150
|
+
$.value.length ? (c(), d("div", Zo, [
|
|
1151
|
+
(c(!0), d(V, null, X($.value, (o) => (c(), d(V, {
|
|
1152
|
+
key: String(o.key)
|
|
1153
|
+
}, [
|
|
1154
|
+
N(o) ? oe(w.$slots, S(o), {
|
|
1155
|
+
item: r,
|
|
1156
|
+
value: k(r, o),
|
|
1157
|
+
compact: !0,
|
|
1158
|
+
to: t.link(r),
|
|
1159
|
+
search: t.search
|
|
1160
|
+
}, void 0, void 0, 0) : L(k(r, o)) ? j("", !0) : (c(), d("span", el, [
|
|
1161
|
+
P(Pe, {
|
|
1162
|
+
column: o,
|
|
1163
|
+
item: r,
|
|
1164
|
+
compact: !0,
|
|
1165
|
+
to: t.link(r),
|
|
1166
|
+
search: t.search
|
|
1167
|
+
}, null, 8, ["column", "item", "to", "search"])
|
|
1168
|
+
]))
|
|
1169
|
+
], 64))), 128))
|
|
1170
|
+
])) : j("", !0)
|
|
1171
|
+
])
|
|
1172
|
+
])
|
|
1173
|
+
]),
|
|
1174
|
+
_: 2
|
|
1175
|
+
}, 1032, ["actions"])
|
|
1176
|
+
], 46, Uo))), 128)) : j("", !0),
|
|
1177
|
+
t.display === "failed" ? (c(), d("li", tl, [
|
|
1178
|
+
oe(w.$slots, "failed")
|
|
1179
|
+
])) : j("", !0),
|
|
1180
|
+
ne.value ? (c(), d("li", ol, [
|
|
1181
|
+
oe(w.$slots, "empty", {}, () => [
|
|
1182
|
+
P(s(Fe), {
|
|
1183
|
+
title: s(n)("core.collection.no_data")
|
|
1184
|
+
}, null, 8, ["title"])
|
|
1185
|
+
])
|
|
1186
|
+
])) : j("", !0)
|
|
1187
|
+
])) : (c(), d("div", ll, [
|
|
1188
|
+
v("div", {
|
|
1189
|
+
class: "overflow-x-auto",
|
|
1190
|
+
style: ve({ minHeight: fe.value })
|
|
1191
|
+
}, [
|
|
1192
|
+
v("table", {
|
|
1193
|
+
class: W(["collection-grid w-full", { condensed: t.density === "condensed" }])
|
|
1194
|
+
}, [
|
|
1195
|
+
v("thead", nl, [
|
|
1196
|
+
v("tr", null, [
|
|
1197
|
+
(c(!0), d(V, null, X(t.columns, (r) => (c(), d("th", {
|
|
1198
|
+
key: String(r.key),
|
|
1199
|
+
scope: "col",
|
|
1200
|
+
class: W(x(r)),
|
|
1201
|
+
style: ve({ width: r.width ? `${r.width}px` : void 0, textAlign: r.align ?? "start" }),
|
|
1202
|
+
"aria-sort": ie(r)
|
|
1203
|
+
}, [
|
|
1204
|
+
v("div", {
|
|
1205
|
+
class: W(["flex", K[r.align ?? "start"]])
|
|
1206
|
+
}, [
|
|
1207
|
+
r.sort !== void 0 ? (c(), d("button", {
|
|
1208
|
+
key: 0,
|
|
1209
|
+
type: "button",
|
|
1210
|
+
class: W(["group inline-flex cursor-pointer items-center gap-1 rounded-sm transition-colors hover:text-content-strong focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus", [E(r) ? "font-semibold text-content-strong" : "", r.align === "end" ? "flex-row-reverse" : ""]]),
|
|
1211
|
+
onClick: (_) => i("sort", r.sort)
|
|
1212
|
+
}, [
|
|
1213
|
+
v("span", null, y(r.label), 1),
|
|
1214
|
+
P(s(H), {
|
|
1215
|
+
name: de(r),
|
|
1216
|
+
size: 14,
|
|
1217
|
+
class: W(E(r) ? "text-content-muted" : "text-content-disabled opacity-0 transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100")
|
|
1218
|
+
}, null, 8, ["name", "class"])
|
|
1219
|
+
], 10, al)) : (c(), d("span", rl, y(r.label), 1))
|
|
1220
|
+
], 2)
|
|
1221
|
+
], 14, sl))), 128)),
|
|
1222
|
+
I.value ? (c(), d("th", il, [
|
|
1223
|
+
v("span", cl, y(s(n)("core.actions.more")), 1)
|
|
1224
|
+
])) : j("", !0)
|
|
1225
|
+
])
|
|
1226
|
+
]),
|
|
1227
|
+
v("tbody", null, [
|
|
1228
|
+
re.value ? (c(!0), d(V, { key: 0 }, X(t.skeletonRows, (r) => (c(), d("tr", {
|
|
1229
|
+
key: `skeleton-${r}`,
|
|
1230
|
+
"aria-hidden": "true",
|
|
1231
|
+
style: ve(t.rowHeight ? { height: `${t.rowHeight}px` } : void 0)
|
|
1232
|
+
}, [
|
|
1233
|
+
(c(!0), d(V, null, X(t.columns, (_, o) => (c(), d("td", {
|
|
1234
|
+
key: String(_.key),
|
|
1235
|
+
class: W(D(_))
|
|
1236
|
+
}, [
|
|
1237
|
+
v("div", {
|
|
1238
|
+
class: "flex animate-pulse items-center gap-3 motion-reduce:animate-none",
|
|
1239
|
+
style: ve({ animationDelay: `${r * 60}ms` })
|
|
1240
|
+
}, [
|
|
1241
|
+
o === 0 ? (c(), d("span", ul)) : j("", !0),
|
|
1242
|
+
v("span", dl, [
|
|
1243
|
+
v("span", {
|
|
1244
|
+
class: "h-2.5 rounded-full bg-fill-strong",
|
|
1245
|
+
style: ve({ width: `${55 + (r * 7 + o * 13) % 35}%` })
|
|
1246
|
+
}, null, 4),
|
|
1247
|
+
v("span", {
|
|
1248
|
+
class: "h-2 rounded-full bg-fill",
|
|
1249
|
+
style: ve({ width: `${30 + (r * 11 + o * 5) % 30}%` })
|
|
1250
|
+
}, null, 4)
|
|
1251
|
+
])
|
|
1252
|
+
], 4)
|
|
1253
|
+
], 2))), 128)),
|
|
1254
|
+
I.value ? (c(), d("td", fl, [...U[6] || (U[6] = [
|
|
1255
|
+
v("div", { class: "mx-auto h-6 w-6 animate-pulse rounded-full bg-fill motion-reduce:animate-none" }, null, -1)
|
|
1256
|
+
])])) : j("", !0)
|
|
1257
|
+
], 4))), 128)) : j("", !0),
|
|
1258
|
+
t.display === "rows" ? (c(!0), d(V, { key: 1 }, X(t.rows, (r, _) => (c(), d("tr", {
|
|
1259
|
+
key: t.rowKey(r),
|
|
1260
|
+
class: W(["animate-row-in", [t.link(r) ? "cursor-pointer" : void 0, t.rowClass?.(r)]]),
|
|
1261
|
+
"data-test": "collection-row",
|
|
1262
|
+
style: ve([t.rowHeight ? { height: `${t.rowHeight}px` } : {}, ce(_)]),
|
|
1263
|
+
onClickCapture: U[4] || (U[4] = //@ts-ignore
|
|
1264
|
+
(...o) => s(O).onClickCapture && s(O).onClickCapture(...o)),
|
|
1265
|
+
onClick: (o) => s(O).onClick(o, r),
|
|
1266
|
+
onContextmenu: (o) => s(O).onContextMenu(o, r),
|
|
1267
|
+
onPointerdown: (o) => s(O).onPointerDown(o, r)
|
|
1268
|
+
}, [
|
|
1269
|
+
(c(!0), d(V, null, X(t.columns, (o, f) => (c(), d("td", {
|
|
1270
|
+
key: String(o.key),
|
|
1271
|
+
class: W(B(o))
|
|
1272
|
+
}, [
|
|
1273
|
+
oe(w.$slots, S(o), {
|
|
1274
|
+
item: r,
|
|
1275
|
+
value: k(r, o),
|
|
1276
|
+
compact: !1,
|
|
1277
|
+
to: t.link(r)
|
|
1278
|
+
}, () => [
|
|
1279
|
+
P(Pe, {
|
|
1280
|
+
column: o,
|
|
1281
|
+
item: r,
|
|
1282
|
+
compact: !1,
|
|
1283
|
+
to: t.link(r),
|
|
1284
|
+
search: t.search
|
|
1285
|
+
}, je({ _: 2 }, [
|
|
1286
|
+
a.leading && f === 0 ? {
|
|
1287
|
+
name: "leading",
|
|
1288
|
+
fn: q(() => [
|
|
1289
|
+
oe(w.$slots, "leading", {
|
|
1290
|
+
item: r,
|
|
1291
|
+
compact: !1
|
|
1292
|
+
})
|
|
1293
|
+
]),
|
|
1294
|
+
key: "0"
|
|
1295
|
+
} : void 0
|
|
1296
|
+
]), 1032, ["column", "item", "to", "search"])
|
|
1297
|
+
])
|
|
1298
|
+
], 2))), 128)),
|
|
1299
|
+
I.value ? (c(), d("td", vl, [
|
|
1300
|
+
oe(w.$slots, "actions", { item: r }, () => [
|
|
1301
|
+
v("div", ml, [
|
|
1302
|
+
t.link(r) ? (c(), Y(s(dt), {
|
|
1303
|
+
key: 0,
|
|
1304
|
+
text: s(n)("core.collection.open_record"),
|
|
1305
|
+
side: "left"
|
|
1306
|
+
}, {
|
|
1307
|
+
default: q(() => [
|
|
1308
|
+
P(s(ct), {
|
|
1309
|
+
to: t.link(r),
|
|
1310
|
+
"aria-label": `${s(n)("core.collection.open_record")}${t.rowLabel ? `: ${t.rowLabel(r)}` : ""}`,
|
|
1311
|
+
class: "inline-flex rounded-md p-1.5 text-content-link transition-colors hover:bg-tint-soft focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus"
|
|
1312
|
+
}, {
|
|
1313
|
+
default: q(() => [
|
|
1314
|
+
P(s(H), {
|
|
1315
|
+
name: "eye",
|
|
1316
|
+
size: 18
|
|
1317
|
+
})
|
|
1318
|
+
]),
|
|
1319
|
+
_: 1
|
|
1320
|
+
}, 8, ["to", "aria-label"])
|
|
1321
|
+
]),
|
|
1322
|
+
_: 2
|
|
1323
|
+
}, 1032, ["text"])) : j("", !0),
|
|
1324
|
+
A.value && b(r) ? (c(), d("button", {
|
|
1325
|
+
key: 1,
|
|
1326
|
+
type: "button",
|
|
1327
|
+
"data-test": "collection-row-more",
|
|
1328
|
+
"aria-label": T(r),
|
|
1329
|
+
class: "hit-target flex size-8 cursor-pointer items-center justify-center rounded-full bg-fill text-content-strong transition-colors duration-motion-fast hover:bg-fill-strong focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus",
|
|
1330
|
+
onClick: Ee((o) => s(O).openMenuFrom(o, r), ["stop"])
|
|
1331
|
+
}, [
|
|
1332
|
+
P(s(H), {
|
|
1333
|
+
name: "moreLine",
|
|
1334
|
+
size: 18
|
|
1335
|
+
})
|
|
1336
|
+
], 8, bl)) : j("", !0)
|
|
1337
|
+
])
|
|
1338
|
+
])
|
|
1339
|
+
])) : j("", !0)
|
|
1340
|
+
], 46, pl))), 128)) : j("", !0),
|
|
1341
|
+
t.display === "failed" ? (c(), d("tr", gl, [
|
|
1342
|
+
v("td", {
|
|
1343
|
+
colspan: C.value,
|
|
1344
|
+
class: "!whitespace-normal py-6"
|
|
1345
|
+
}, [
|
|
1346
|
+
oe(w.$slots, "failed")
|
|
1347
|
+
], 8, hl)
|
|
1348
|
+
])) : j("", !0),
|
|
1349
|
+
ne.value ? (c(), d("tr", yl, [
|
|
1350
|
+
v("td", {
|
|
1351
|
+
colspan: C.value,
|
|
1352
|
+
class: "!whitespace-normal py-6 text-center"
|
|
1353
|
+
}, [
|
|
1354
|
+
oe(w.$slots, "empty", {}, () => [
|
|
1355
|
+
P(s(Fe), {
|
|
1356
|
+
title: s(n)("core.collection.no_data")
|
|
1357
|
+
}, null, 8, ["title"])
|
|
1358
|
+
])
|
|
1359
|
+
], 8, wl)
|
|
1360
|
+
])) : j("", !0)
|
|
1361
|
+
])
|
|
1362
|
+
], 2)
|
|
1363
|
+
], 4)
|
|
1364
|
+
])),
|
|
1365
|
+
t.rowActions ? (c(), Y(s(Ke), {
|
|
1366
|
+
key: 2,
|
|
1367
|
+
ref_key: "rowMenu",
|
|
1368
|
+
ref: ee,
|
|
1369
|
+
items: s(O).menuItems.value,
|
|
1370
|
+
label: s(O).menuLabel.value
|
|
1371
|
+
}, null, 8, ["items", "label"])) : j("", !0)
|
|
1372
|
+
], 64));
|
|
1373
|
+
}
|
|
1374
|
+
}), kl = ["onClick"], xl = { class: "max-w-56 truncate" }, $l = { class: "flex flex-col gap-1.5 text-footnote font-medium text-content-muted" }, Sl = ["placeholder"], Cl = { class: "flex items-center justify-between gap-2" }, zl = {
|
|
918
1375
|
type: "submit",
|
|
919
1376
|
class: "cursor-pointer rounded-control bg-tint px-3 py-1.5 text-footnote font-semibold text-content-on-tint"
|
|
920
|
-
},
|
|
1377
|
+
}, Al = ["onClick"], Pl = { class: "max-w-56 truncate" }, tt = "inline-flex shrink-0 cursor-pointer items-center gap-x-2 rounded-button px-3 py-1.5 text-subheadline transition-colors duration-motion-fast focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus", El = /* @__PURE__ */ ue({
|
|
921
1378
|
__name: "CollectionFilterMenu",
|
|
922
1379
|
props: {
|
|
923
1380
|
filter: {},
|
|
924
1381
|
value: {}
|
|
925
1382
|
},
|
|
926
1383
|
emits: ["update"],
|
|
927
|
-
setup(
|
|
928
|
-
const
|
|
929
|
-
...
|
|
930
|
-
...(
|
|
1384
|
+
setup(l, { emit: e }) {
|
|
1385
|
+
const t = l, i = e, { t: a } = he(), n = h(() => me(t.value) ? null : String(t.value)), u = h(() => t.filter.options?.find((x) => String(x.value) === n.value) ?? null), p = h(() => [
|
|
1386
|
+
...t.filter.withoutDefaultOption ? [] : [{ id: "__all", label: t.filter.defaultOptionTitle ?? a("core.collection.filters.show_all"), checked: n.value === null, onSelect: () => i("update", null) }],
|
|
1387
|
+
...(t.filter.options ?? []).map((R) => ({
|
|
931
1388
|
id: `option-${String(R.value)}`,
|
|
932
1389
|
label: R.label,
|
|
933
1390
|
icon: R.icon,
|
|
934
|
-
checked:
|
|
935
|
-
onSelect: () =>
|
|
1391
|
+
checked: n.value === String(R.value),
|
|
1392
|
+
onSelect: () => i("update", String(R.value))
|
|
936
1393
|
}))
|
|
937
|
-
]),
|
|
938
|
-
() =>
|
|
939
|
-
), S =
|
|
940
|
-
|
|
941
|
-
function
|
|
942
|
-
const
|
|
943
|
-
|
|
1394
|
+
]), g = h(() => t.filter.type === "text" && n.value ? `${t.filter.label}: ${n.value}` : u.value?.label ?? t.filter.label), m = h(() => n.value !== null), $ = h(
|
|
1395
|
+
() => m.value ? "bg-tint-soft font-semibold text-content-link" : "bg-surface-cell font-medium text-content-strong ring-1 ring-inset ring-border-separator hover:bg-fill"
|
|
1396
|
+
), S = ae(""), N = ge("popover");
|
|
1397
|
+
Se(n, (x) => S.value = x ?? "", { immediate: !0 });
|
|
1398
|
+
function k() {
|
|
1399
|
+
const x = S.value.trim();
|
|
1400
|
+
i("update", x === "" ? null : x), N.value?.dismiss();
|
|
944
1401
|
}
|
|
945
|
-
function
|
|
946
|
-
S.value = "",
|
|
1402
|
+
function L() {
|
|
1403
|
+
S.value = "", i("update", null), N.value?.dismiss();
|
|
947
1404
|
}
|
|
948
|
-
const
|
|
949
|
-
async function
|
|
950
|
-
await
|
|
1405
|
+
const z = ge("field");
|
|
1406
|
+
async function D() {
|
|
1407
|
+
await it(), z.value?.focus();
|
|
951
1408
|
}
|
|
952
|
-
return (
|
|
1409
|
+
return (x, R) => t.filter.type === "text" ? (c(), Y(s(ft), {
|
|
953
1410
|
key: 0,
|
|
954
1411
|
ref_key: "popover",
|
|
955
|
-
ref:
|
|
956
|
-
label:
|
|
1412
|
+
ref: N,
|
|
1413
|
+
label: t.filter.label,
|
|
957
1414
|
width: "md",
|
|
958
1415
|
placement: "bottom-start",
|
|
959
|
-
onPresented:
|
|
1416
|
+
onPresented: D
|
|
960
1417
|
}, {
|
|
961
|
-
trigger:
|
|
962
|
-
|
|
1418
|
+
trigger: q(({ toggle: B, attrs: K }) => [
|
|
1419
|
+
v("button", _e(K, {
|
|
963
1420
|
type: "button",
|
|
964
|
-
class: [
|
|
965
|
-
onClick:
|
|
1421
|
+
class: [tt, $.value],
|
|
1422
|
+
onClick: B
|
|
966
1423
|
}), [
|
|
967
|
-
|
|
1424
|
+
t.filter.icon ? (c(), Y(s(H), {
|
|
968
1425
|
key: 0,
|
|
969
|
-
name:
|
|
1426
|
+
name: t.filter.icon,
|
|
970
1427
|
size: 16
|
|
971
|
-
}, null, 8, ["name"])) :
|
|
972
|
-
|
|
973
|
-
|
|
1428
|
+
}, null, 8, ["name"])) : j("", !0),
|
|
1429
|
+
v("span", xl, y(g.value), 1),
|
|
1430
|
+
P(s(H), {
|
|
974
1431
|
name: "arrowDownSLine",
|
|
975
1432
|
size: 16,
|
|
976
1433
|
class: "text-content-muted"
|
|
977
1434
|
})
|
|
978
|
-
], 16,
|
|
1435
|
+
], 16, kl)
|
|
979
1436
|
]),
|
|
980
|
-
default:
|
|
981
|
-
|
|
1437
|
+
default: q(() => [
|
|
1438
|
+
v("form", {
|
|
982
1439
|
class: "flex flex-col gap-3",
|
|
983
|
-
onSubmit:
|
|
1440
|
+
onSubmit: Ee(k, ["prevent"])
|
|
984
1441
|
}, [
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
1442
|
+
v("label", $l, [
|
|
1443
|
+
le(y(t.filter.label) + " ", 1),
|
|
1444
|
+
De(v("input", {
|
|
988
1445
|
ref_key: "field",
|
|
989
|
-
ref:
|
|
990
|
-
"onUpdate:modelValue": R[0] || (R[0] = (
|
|
1446
|
+
ref: z,
|
|
1447
|
+
"onUpdate:modelValue": R[0] || (R[0] = (B) => S.value = B),
|
|
991
1448
|
type: "text",
|
|
992
1449
|
autocomplete: "off",
|
|
993
|
-
placeholder:
|
|
1450
|
+
placeholder: s(a)("core.collection.filters.type_to_filter"),
|
|
994
1451
|
class: "rounded-control bg-fill px-2.5 py-1.5 text-body text-content-strong outline-none placeholder:text-content-disabled focus:bg-surface-cell focus:ring-[1.5px] focus:ring-inset focus:ring-border-focus"
|
|
995
|
-
}, null, 8,
|
|
996
|
-
[
|
|
1452
|
+
}, null, 8, Sl), [
|
|
1453
|
+
[Be, S.value]
|
|
997
1454
|
])
|
|
998
1455
|
]),
|
|
999
|
-
|
|
1000
|
-
|
|
1456
|
+
v("div", Cl, [
|
|
1457
|
+
v("button", {
|
|
1001
1458
|
type: "button",
|
|
1002
1459
|
class: "cursor-pointer rounded-control px-2 py-1 text-footnote text-content-muted hover:text-content-strong",
|
|
1003
|
-
onClick:
|
|
1004
|
-
}, y(
|
|
1005
|
-
|
|
1460
|
+
onClick: L
|
|
1461
|
+
}, y(s(a)("core.collection.filters.clear")), 1),
|
|
1462
|
+
v("button", zl, y(s(a)("core.collection.filters.apply")), 1)
|
|
1006
1463
|
])
|
|
1007
1464
|
], 32)
|
|
1008
1465
|
]),
|
|
1009
1466
|
_: 1
|
|
1010
|
-
}, 8, ["label"])) : (
|
|
1467
|
+
}, 8, ["label"])) : (c(), Y(s(Ke), {
|
|
1011
1468
|
key: 1,
|
|
1012
|
-
items:
|
|
1013
|
-
label:
|
|
1469
|
+
items: p.value,
|
|
1470
|
+
label: t.filter.label,
|
|
1014
1471
|
placement: "bottom-start"
|
|
1015
1472
|
}, {
|
|
1016
|
-
trigger:
|
|
1017
|
-
|
|
1473
|
+
trigger: q(({ toggle: B, attrs: K }) => [
|
|
1474
|
+
v("button", _e(K, {
|
|
1018
1475
|
type: "button",
|
|
1019
|
-
class: [
|
|
1020
|
-
onClick:
|
|
1476
|
+
class: [tt, $.value],
|
|
1477
|
+
onClick: B
|
|
1021
1478
|
}), [
|
|
1022
|
-
|
|
1479
|
+
t.filter.icon ? (c(), Y(s(H), {
|
|
1023
1480
|
key: 0,
|
|
1024
|
-
name:
|
|
1481
|
+
name: t.filter.icon,
|
|
1025
1482
|
size: 16
|
|
1026
|
-
}, null, 8, ["name"])) :
|
|
1027
|
-
|
|
1028
|
-
|
|
1483
|
+
}, null, 8, ["name"])) : j("", !0),
|
|
1484
|
+
v("span", Pl, y(g.value), 1),
|
|
1485
|
+
P(s(H), {
|
|
1029
1486
|
name: "arrowDownSLine",
|
|
1030
1487
|
size: 16,
|
|
1031
1488
|
class: "text-content-muted"
|
|
1032
1489
|
})
|
|
1033
|
-
], 16,
|
|
1490
|
+
], 16, Al)
|
|
1034
1491
|
]),
|
|
1035
1492
|
_: 1
|
|
1036
1493
|
}, 8, ["items", "label"]));
|
|
1037
1494
|
}
|
|
1038
|
-
}),
|
|
1495
|
+
}), Ol = {
|
|
1039
1496
|
key: 0,
|
|
1040
1497
|
"data-test": "filter-drilldown"
|
|
1041
|
-
},
|
|
1498
|
+
}, jl = { class: "mb-3 text-headline font-semibold" }, Ll = ["aria-label"], Rl = ["aria-selected", "onClick"], Tl = { class: "min-w-0 truncate" }, Vl = {
|
|
1042
1499
|
key: 0,
|
|
1043
1500
|
class: "mb-5 border-b border-border-separator pb-5",
|
|
1044
1501
|
"data-test": "saved-filters"
|
|
1045
|
-
},
|
|
1502
|
+
}, Fl = { class: "mb-2 text-footnote font-medium text-content-muted" }, Ml = { class: "flex flex-wrap gap-2" }, Nl = ["onClick"], Il = ["aria-label", "title", "onClick"], ql = { class: "space-y-5" }, Dl = { key: 0 }, Bl = { class: "mb-1.5 text-footnote font-medium text-content-muted" }, Ul = ["aria-label"], Hl = { class: "mb-1.5 text-footnote font-medium text-content-muted" }, Kl = {
|
|
1046
1503
|
key: 0,
|
|
1047
1504
|
class: "grid grid-cols-2 gap-3"
|
|
1048
|
-
},
|
|
1505
|
+
}, Xl = ["aria-label"], Gl = { class: "mb-2 text-footnote font-medium text-content-muted" }, Jl = { class: "flex flex-wrap gap-2" }, Wl = ["aria-pressed", "onClick"], Yl = ["disabled", "onClick"], Ql = { class: "shrink-0 text-subheadline font-medium" }, Zl = { class: "flex items-center justify-between gap-2" }, en = { class: "flex items-center gap-2" }, tn = ["title"], on = { class: "sm:hidden" }, ln = { class: "hidden sm:inline" }, nn = { class: "flex flex-col gap-1.5 text-footnote font-medium text-content-muted" }, sn = ["placeholder"], an = {
|
|
1049
1506
|
key: 0,
|
|
1050
1507
|
class: "text-footnote text-status-warning-content",
|
|
1051
1508
|
"data-test": "saved-filter-replace-hint"
|
|
1052
|
-
},
|
|
1509
|
+
}, rn = { class: "flex justify-end gap-2" }, cn = 8, un = 18, ot = 6e3, dn = /* @__PURE__ */ ue({
|
|
1053
1510
|
__name: "CollectionFilterPanel",
|
|
1054
1511
|
props: {
|
|
1055
1512
|
collection: {},
|
|
1056
1513
|
filters: {}
|
|
1057
1514
|
},
|
|
1058
1515
|
emits: ["touched"],
|
|
1059
|
-
setup(
|
|
1060
|
-
const
|
|
1061
|
-
function
|
|
1062
|
-
const
|
|
1063
|
-
for (const o of
|
|
1064
|
-
const
|
|
1065
|
-
if (
|
|
1066
|
-
const [
|
|
1067
|
-
|
|
1516
|
+
setup(l, { expose: e, emit: t }) {
|
|
1517
|
+
const i = l, a = t, { t: n } = he(), u = ge("sheet"), p = pt("(max-width: 1023px), (pointer: coarse)"), g = ae({}), m = ae({}), $ = ae(null), S = h(() => i.filters.find((r) => r.key === $.value) ?? null);
|
|
1518
|
+
function N() {
|
|
1519
|
+
const r = {}, _ = {};
|
|
1520
|
+
for (const o of i.filters) {
|
|
1521
|
+
const f = i.collection.query.value.filters[o.key];
|
|
1522
|
+
if (r[o.key] = me(f) ? null : String(f), o.type === "range") {
|
|
1523
|
+
const [F, G] = vt(r[o.key]);
|
|
1524
|
+
_[o.key] = { min: F ?? "", max: G ?? "" };
|
|
1068
1525
|
}
|
|
1069
1526
|
}
|
|
1070
|
-
|
|
1527
|
+
g.value = r, m.value = _, $.value = null, u.value?.present();
|
|
1071
1528
|
}
|
|
1072
|
-
function
|
|
1073
|
-
const o =
|
|
1074
|
-
if (
|
|
1075
|
-
|
|
1076
|
-
for (const
|
|
1529
|
+
function k(r, _) {
|
|
1530
|
+
const o = me(_) ? null : String(_);
|
|
1531
|
+
if (g.value[r] !== o) {
|
|
1532
|
+
g.value = { ...g.value, [r]: o };
|
|
1533
|
+
for (const f of i.filters.filter((F) => F.dependsOn === r)) k(f.key, null);
|
|
1077
1534
|
}
|
|
1078
1535
|
}
|
|
1079
|
-
function
|
|
1080
|
-
for (const
|
|
1081
|
-
|
|
1536
|
+
function L() {
|
|
1537
|
+
for (const r of i.filters)
|
|
1538
|
+
g.value[r.key] = null, r.type === "range" && (m.value[r.key] = { min: "", max: "" });
|
|
1082
1539
|
}
|
|
1083
|
-
const
|
|
1084
|
-
const o =
|
|
1085
|
-
return Number.isNaN(
|
|
1540
|
+
const z = (r) => r.replace(/[^\d.,-]/g, "").replace(",", "."), D = (r, _) => {
|
|
1541
|
+
const o = m.value[r]?.[_] ?? "", f = o === "" ? Number.NaN : Number(z(o));
|
|
1542
|
+
return Number.isNaN(f) ? null : f;
|
|
1086
1543
|
};
|
|
1087
|
-
function
|
|
1088
|
-
const
|
|
1089
|
-
|
|
1544
|
+
function x(r, _, o) {
|
|
1545
|
+
const f = m.value[r];
|
|
1546
|
+
f && (f[_] = o === null ? "" : String(o));
|
|
1090
1547
|
}
|
|
1091
1548
|
function R() {
|
|
1092
|
-
const
|
|
1093
|
-
for (const
|
|
1094
|
-
const o =
|
|
1095
|
-
|
|
1549
|
+
const r = {};
|
|
1550
|
+
for (const _ of i.filters) {
|
|
1551
|
+
const o = m.value[_.key];
|
|
1552
|
+
r[_.key] = _.type === "range" ? Ft(o ? z(o.min) : null, o ? z(o.max) : null) : g.value[_.key] ?? null;
|
|
1096
1553
|
}
|
|
1097
|
-
return
|
|
1554
|
+
return r;
|
|
1098
1555
|
}
|
|
1099
|
-
function
|
|
1100
|
-
const
|
|
1101
|
-
|
|
1556
|
+
function B() {
|
|
1557
|
+
const r = R(), _ = Object.keys(r).filter((o) => (i.collection.query.value.filters[o] ?? null) !== r[o]);
|
|
1558
|
+
a("touched", _), i.collection.setFilters(r), u.value?.dismiss();
|
|
1102
1559
|
}
|
|
1103
|
-
const
|
|
1104
|
-
function
|
|
1105
|
-
const
|
|
1106
|
-
return
|
|
1560
|
+
const K = (r) => Mt(r, r.dependsOn ? g.value[r.dependsOn] : null), M = (r) => r.defaultOptionTitle ?? n("core.collection.filters.show_all");
|
|
1561
|
+
function ee(r) {
|
|
1562
|
+
const _ = g.value[r.key];
|
|
1563
|
+
return _ == null ? M(r) : K(r).find((o) => o.value === _)?.label ?? _;
|
|
1107
1564
|
}
|
|
1108
|
-
const
|
|
1109
|
-
{ value: "", label:
|
|
1110
|
-
...
|
|
1111
|
-
],
|
|
1112
|
-
{ value: "", label:
|
|
1113
|
-
...(
|
|
1565
|
+
const O = (r) => [
|
|
1566
|
+
{ value: "", label: M(r) },
|
|
1567
|
+
...K(r).map((_) => ({ value: String(_.value), label: _.label }))
|
|
1568
|
+
], A = (r) => [
|
|
1569
|
+
{ value: "", label: M(r) },
|
|
1570
|
+
...(r.options ?? []).map((_) => ({ value: String(_.value), label: _.label }))
|
|
1114
1571
|
];
|
|
1115
|
-
function
|
|
1116
|
-
const
|
|
1117
|
-
return !
|
|
1572
|
+
function I(r) {
|
|
1573
|
+
const _ = K(r);
|
|
1574
|
+
return !r.dependsOn && _.length > 0 && _.length <= cn && _.every((o) => o.label.length <= un);
|
|
1118
1575
|
}
|
|
1119
|
-
const
|
|
1120
|
-
function
|
|
1121
|
-
const
|
|
1122
|
-
for (const [o,
|
|
1123
|
-
!
|
|
1124
|
-
for (const [o,
|
|
1125
|
-
return { filters:
|
|
1576
|
+
const T = h(() => p.value && S.value !== null), b = h(() => i.collection.savedViews), C = ae(""), E = ae(!1), ie = ge("savePopover");
|
|
1577
|
+
function de() {
|
|
1578
|
+
const r = new Set(i.filters.map((o) => o.key)), _ = {};
|
|
1579
|
+
for (const [o, f] of Object.entries(i.collection.query.value.filters))
|
|
1580
|
+
!r.has(o) && f !== void 0 && f !== "" && (_[o] = String(f));
|
|
1581
|
+
for (const [o, f] of Object.entries(R())) f !== null && (_[o] = f);
|
|
1582
|
+
return { filters: _, search: i.collection.query.value.search };
|
|
1126
1583
|
}
|
|
1127
|
-
const
|
|
1128
|
-
const
|
|
1129
|
-
return Object.keys(
|
|
1130
|
-
}),
|
|
1131
|
-
const
|
|
1132
|
-
return
|
|
1133
|
-
}),
|
|
1134
|
-
async function
|
|
1135
|
-
const
|
|
1136
|
-
if (!(!
|
|
1137
|
-
|
|
1584
|
+
const ce = h(() => {
|
|
1585
|
+
const r = de();
|
|
1586
|
+
return Object.keys(r.filters).length > 0 || r.search.trim() !== "";
|
|
1587
|
+
}), re = h(() => {
|
|
1588
|
+
const r = C.value.trim();
|
|
1589
|
+
return r ? b.value?.items.value.find((_) => _.name === r) ?? null : null;
|
|
1590
|
+
}), fe = (r, _) => zt(r) && r.message ? r.message : _;
|
|
1591
|
+
async function ne() {
|
|
1592
|
+
const r = C.value.trim(), _ = b.value;
|
|
1593
|
+
if (!(!_ || !r || E.value || !ce.value)) {
|
|
1594
|
+
E.value = !0;
|
|
1138
1595
|
try {
|
|
1139
|
-
const o = await
|
|
1140
|
-
|
|
1596
|
+
const o = await _.save(r, de());
|
|
1597
|
+
C.value = "", ie.value?.dismiss(), Ce.success(n("core.collection.saved.saved_toast", { name: o.name })), _.apply(o), a("touched", []), u.value?.dismiss();
|
|
1141
1598
|
} catch (o) {
|
|
1142
|
-
|
|
1599
|
+
Ce.error(fe(o, n("core.collection.saved.save_failed")));
|
|
1143
1600
|
} finally {
|
|
1144
|
-
|
|
1601
|
+
E.value = !1;
|
|
1145
1602
|
}
|
|
1146
1603
|
}
|
|
1147
1604
|
}
|
|
1148
|
-
function
|
|
1149
|
-
|
|
1605
|
+
function w(r) {
|
|
1606
|
+
b.value?.apply(r), a("touched", []), u.value?.dismiss();
|
|
1150
1607
|
}
|
|
1151
|
-
function
|
|
1152
|
-
const
|
|
1153
|
-
if (!
|
|
1154
|
-
const { revert: o, commit:
|
|
1155
|
-
|
|
1156
|
-
o(),
|
|
1608
|
+
function U(r) {
|
|
1609
|
+
const _ = b.value;
|
|
1610
|
+
if (!_) return;
|
|
1611
|
+
const { revert: o, commit: f } = _.stageRemoval(r.id), F = setTimeout(() => {
|
|
1612
|
+
f().catch((G) => {
|
|
1613
|
+
o(), Ce.error(fe(G, n("core.collection.saved.delete_failed")));
|
|
1157
1614
|
});
|
|
1158
|
-
},
|
|
1159
|
-
|
|
1160
|
-
duration:
|
|
1615
|
+
}, ot);
|
|
1616
|
+
Ce.success(n("core.collection.saved.deleted_toast", { name: r.name }), {
|
|
1617
|
+
duration: ot,
|
|
1161
1618
|
action: {
|
|
1162
|
-
label:
|
|
1619
|
+
label: n("core.collection.saved.undo"),
|
|
1163
1620
|
onClick: () => {
|
|
1164
|
-
clearTimeout(
|
|
1621
|
+
clearTimeout(F), o();
|
|
1165
1622
|
}
|
|
1166
1623
|
}
|
|
1167
1624
|
});
|
|
1168
1625
|
}
|
|
1169
|
-
return e({ present:
|
|
1626
|
+
return e({ present: N }), (r, _) => (c(), Y(s(Tt), {
|
|
1170
1627
|
ref_key: "sheet",
|
|
1171
|
-
ref:
|
|
1172
|
-
title: n
|
|
1173
|
-
grouped:
|
|
1628
|
+
ref: u,
|
|
1629
|
+
title: s(n)("core.collection.filters.panel_title"),
|
|
1630
|
+
grouped: T.value
|
|
1174
1631
|
}, {
|
|
1175
|
-
footer:
|
|
1176
|
-
|
|
1177
|
-
|
|
1632
|
+
footer: q(() => [
|
|
1633
|
+
v("div", Zl, [
|
|
1634
|
+
P(be, {
|
|
1178
1635
|
prominence: "standard",
|
|
1179
1636
|
class: "whitespace-nowrap",
|
|
1180
|
-
onClick:
|
|
1637
|
+
onClick: L
|
|
1181
1638
|
}, {
|
|
1182
|
-
default:
|
|
1183
|
-
|
|
1639
|
+
default: q(() => [
|
|
1640
|
+
le(y(s(n)("core.collection.filters.reset_all")), 1)
|
|
1184
1641
|
]),
|
|
1185
1642
|
_: 1
|
|
1186
1643
|
}),
|
|
1187
|
-
|
|
1188
|
-
|
|
1644
|
+
v("div", en, [
|
|
1645
|
+
b.value ? (c(), Y(s(ft), {
|
|
1189
1646
|
key: 0,
|
|
1190
1647
|
ref_key: "savePopover",
|
|
1191
|
-
ref:
|
|
1648
|
+
ref: ie,
|
|
1192
1649
|
placement: "top-end",
|
|
1193
|
-
label: n
|
|
1650
|
+
label: s(n)("core.collection.saved.save_button")
|
|
1194
1651
|
}, {
|
|
1195
|
-
trigger:
|
|
1196
|
-
|
|
1197
|
-
title:
|
|
1652
|
+
trigger: q(({ toggle: o, attrs: f }) => [
|
|
1653
|
+
v("span", {
|
|
1654
|
+
title: ce.value ? void 0 : s(n)("core.collection.saved.nothing_to_save")
|
|
1198
1655
|
}, [
|
|
1199
|
-
|
|
1656
|
+
P(be, _e({ ...f, "data-test": "saved-filter-open" }, {
|
|
1200
1657
|
prominence: "standard",
|
|
1201
1658
|
icon: "save",
|
|
1202
1659
|
class: "whitespace-nowrap",
|
|
1203
|
-
disabled: !
|
|
1660
|
+
disabled: !ce.value,
|
|
1204
1661
|
onClick: o
|
|
1205
1662
|
}), {
|
|
1206
|
-
default:
|
|
1207
|
-
|
|
1208
|
-
|
|
1663
|
+
default: q(() => [
|
|
1664
|
+
v("span", on, y(s(n)("core.collection.saved.save")), 1),
|
|
1665
|
+
v("span", ln, y(s(n)("core.collection.saved.save_button")), 1)
|
|
1209
1666
|
]),
|
|
1210
1667
|
_: 1
|
|
1211
1668
|
}, 16, ["disabled", "onClick"])
|
|
1212
|
-
], 8,
|
|
1669
|
+
], 8, tn)
|
|
1213
1670
|
]),
|
|
1214
|
-
default:
|
|
1215
|
-
|
|
1671
|
+
default: q(() => [
|
|
1672
|
+
v("form", {
|
|
1216
1673
|
class: "flex flex-col gap-3",
|
|
1217
1674
|
"data-test": "saved-filter-form",
|
|
1218
|
-
onSubmit:
|
|
1675
|
+
onSubmit: Ee(ne, ["prevent"])
|
|
1219
1676
|
}, [
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
"onUpdate:modelValue":
|
|
1677
|
+
v("label", nn, [
|
|
1678
|
+
le(y(s(n)("core.collection.saved.name_label")) + " ", 1),
|
|
1679
|
+
De(v("input", {
|
|
1680
|
+
"onUpdate:modelValue": _[1] || (_[1] = (o) => C.value = o),
|
|
1224
1681
|
type: "text",
|
|
1225
1682
|
maxlength: "60",
|
|
1226
1683
|
autocomplete: "off",
|
|
1227
|
-
placeholder: n
|
|
1684
|
+
placeholder: s(n)("core.collection.saved.name_placeholder"),
|
|
1228
1685
|
class: "rounded-control bg-fill px-2.5 py-1.5 text-body text-content-strong outline-none placeholder:text-content-disabled focus:bg-surface-cell focus:ring-[1.5px] focus:ring-inset focus:ring-border-focus"
|
|
1229
|
-
}, null, 8,
|
|
1230
|
-
[
|
|
1686
|
+
}, null, 8, sn), [
|
|
1687
|
+
[Be, C.value]
|
|
1231
1688
|
])
|
|
1232
1689
|
]),
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1690
|
+
re.value ? (c(), d("p", an, y(s(n)("core.collection.saved.replace_hint", { name: re.value.name })), 1)) : j("", !0),
|
|
1691
|
+
v("div", rn, [
|
|
1692
|
+
P(be, {
|
|
1236
1693
|
size: "sm",
|
|
1237
|
-
onClick:
|
|
1694
|
+
onClick: _[2] || (_[2] = (o) => ie.value?.dismiss())
|
|
1238
1695
|
}, {
|
|
1239
|
-
default:
|
|
1240
|
-
|
|
1696
|
+
default: q(() => [
|
|
1697
|
+
le(y(s(n)("core.actions.cancel")), 1)
|
|
1241
1698
|
]),
|
|
1242
1699
|
_: 1
|
|
1243
1700
|
}),
|
|
1244
|
-
|
|
1701
|
+
P(be, _e({ "data-test": "saved-filter-save" }, {
|
|
1245
1702
|
type: "submit",
|
|
1246
1703
|
prominence: "primary",
|
|
1247
1704
|
size: "sm",
|
|
1248
|
-
processing:
|
|
1249
|
-
disabled: !
|
|
1705
|
+
processing: E.value,
|
|
1706
|
+
disabled: !C.value.trim()
|
|
1250
1707
|
}), {
|
|
1251
|
-
default:
|
|
1252
|
-
|
|
1708
|
+
default: q(() => [
|
|
1709
|
+
le(y(re.value ? s(n)("core.collection.saved.replace") : s(n)("core.collection.saved.save")), 1)
|
|
1253
1710
|
]),
|
|
1254
1711
|
_: 1
|
|
1255
1712
|
}, 16, ["processing", "disabled"])
|
|
@@ -1257,172 +1714,172 @@ const ul = {
|
|
|
1257
1714
|
], 32)
|
|
1258
1715
|
]),
|
|
1259
1716
|
_: 1
|
|
1260
|
-
}, 8, ["label"])) :
|
|
1261
|
-
|
|
1717
|
+
}, 8, ["label"])) : j("", !0),
|
|
1718
|
+
P(be, {
|
|
1262
1719
|
prominence: "primary",
|
|
1263
1720
|
icon: "filter3",
|
|
1264
1721
|
class: "whitespace-nowrap",
|
|
1265
|
-
onClick:
|
|
1722
|
+
onClick: B
|
|
1266
1723
|
}, {
|
|
1267
|
-
default:
|
|
1268
|
-
|
|
1724
|
+
default: q(() => [
|
|
1725
|
+
le(y(s(n)("core.collection.filters.apply")), 1)
|
|
1269
1726
|
]),
|
|
1270
1727
|
_: 1
|
|
1271
1728
|
})
|
|
1272
1729
|
])
|
|
1273
1730
|
])
|
|
1274
1731
|
]),
|
|
1275
|
-
default:
|
|
1276
|
-
|
|
1277
|
-
|
|
1732
|
+
default: q(() => [
|
|
1733
|
+
s(p) && S.value ? (c(), d("div", Ol, [
|
|
1734
|
+
v("button", {
|
|
1278
1735
|
type: "button",
|
|
1279
1736
|
"data-test": "filter-drilldown-back",
|
|
1280
1737
|
class: "-mx-2 -mt-2 mb-1 inline-flex h-10 cursor-pointer items-center gap-0.5 rounded-control px-2 text-body font-medium text-content-link active:bg-tint-soft",
|
|
1281
|
-
onClick:
|
|
1738
|
+
onClick: _[0] || (_[0] = (o) => $.value = null)
|
|
1282
1739
|
}, [
|
|
1283
|
-
|
|
1740
|
+
P(s(H), {
|
|
1284
1741
|
name: "arrowLeftSLine",
|
|
1285
1742
|
size: 20
|
|
1286
1743
|
}),
|
|
1287
|
-
|
|
1744
|
+
le(" " + y(s(n)("core.collection.filters.panel_title")), 1)
|
|
1288
1745
|
]),
|
|
1289
|
-
|
|
1290
|
-
|
|
1746
|
+
v("p", jl, y(S.value.label), 1),
|
|
1747
|
+
v("ul", {
|
|
1291
1748
|
class: "overflow-hidden rounded-group bg-surface-cell shadow-group",
|
|
1292
1749
|
role: "listbox",
|
|
1293
1750
|
"aria-label": S.value.label
|
|
1294
1751
|
}, [
|
|
1295
|
-
(
|
|
1752
|
+
(c(!0), d(V, null, X([{ value: null, label: M(S.value) }, ...K(S.value)], (o) => (c(), d("li", {
|
|
1296
1753
|
key: String(o.value),
|
|
1297
1754
|
role: "presentation"
|
|
1298
1755
|
}, [
|
|
1299
|
-
|
|
1756
|
+
v("button", {
|
|
1300
1757
|
type: "button",
|
|
1301
1758
|
role: "option",
|
|
1302
|
-
"aria-selected": (
|
|
1759
|
+
"aria-selected": (g.value[S.value.key] ?? null) === o.value,
|
|
1303
1760
|
class: "flex min-h-11 w-full cursor-pointer items-center justify-between gap-3 px-row-inset text-left text-body active:bg-fill",
|
|
1304
|
-
onClick: (
|
|
1305
|
-
|
|
1761
|
+
onClick: (f) => {
|
|
1762
|
+
k(S.value.key, o.value), $.value = null;
|
|
1306
1763
|
}
|
|
1307
1764
|
}, [
|
|
1308
|
-
|
|
1309
|
-
(
|
|
1765
|
+
v("span", Tl, y(o.label), 1),
|
|
1766
|
+
(g.value[S.value.key] ?? null) === o.value ? (c(), Y(s(H), {
|
|
1310
1767
|
key: 0,
|
|
1311
1768
|
name: "checkboxCircleFill",
|
|
1312
1769
|
size: 18,
|
|
1313
1770
|
class: "shrink-0 text-content-link"
|
|
1314
|
-
})) :
|
|
1315
|
-
], 8,
|
|
1771
|
+
})) : j("", !0)
|
|
1772
|
+
], 8, Rl)
|
|
1316
1773
|
]))), 128))
|
|
1317
|
-
], 8,
|
|
1318
|
-
])) : (
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
(
|
|
1774
|
+
], 8, Ll)
|
|
1775
|
+
])) : (c(), d(V, { key: 1 }, [
|
|
1776
|
+
b.value && b.value.items.value.length > 0 ? (c(), d("section", Vl, [
|
|
1777
|
+
v("p", Fl, y(s(n)("core.collection.saved.title")), 1),
|
|
1778
|
+
v("div", Ml, [
|
|
1779
|
+
(c(!0), d(V, null, X(b.value.items.value, (o) => (c(), d("span", {
|
|
1323
1780
|
key: o.id,
|
|
1324
1781
|
class: "inline-flex h-8 items-center rounded-control bg-surface-cell text-subheadline shadow-group ring-1 ring-inset ring-border-separator"
|
|
1325
1782
|
}, [
|
|
1326
|
-
|
|
1783
|
+
v("button", {
|
|
1327
1784
|
type: "button",
|
|
1328
1785
|
"data-test": "saved-filter-apply",
|
|
1329
1786
|
class: "inline-flex h-full cursor-pointer items-center gap-1.5 rounded-l-control pr-1.5 pl-2.5 font-medium text-content-strong hover:bg-fill",
|
|
1330
|
-
onClick: (
|
|
1787
|
+
onClick: (f) => w(o)
|
|
1331
1788
|
}, [
|
|
1332
|
-
|
|
1789
|
+
P(s(H), {
|
|
1333
1790
|
name: "starFill",
|
|
1334
1791
|
size: 12,
|
|
1335
1792
|
class: "text-status-warning-content"
|
|
1336
1793
|
}),
|
|
1337
|
-
|
|
1338
|
-
], 8,
|
|
1339
|
-
|
|
1794
|
+
le(" " + y(o.name), 1)
|
|
1795
|
+
], 8, Nl),
|
|
1796
|
+
v("button", {
|
|
1340
1797
|
type: "button",
|
|
1341
1798
|
"data-test": "saved-filter-delete",
|
|
1342
|
-
"aria-label": n
|
|
1343
|
-
title: n
|
|
1799
|
+
"aria-label": s(n)("core.collection.saved.delete", { name: o.name }),
|
|
1800
|
+
title: s(n)("core.collection.saved.delete", { name: o.name }),
|
|
1344
1801
|
class: "h-full cursor-pointer rounded-r-control px-1.5 text-content-muted hover:bg-fill hover:text-content-destructive",
|
|
1345
|
-
onClick: (
|
|
1802
|
+
onClick: (f) => U(o)
|
|
1346
1803
|
}, [
|
|
1347
|
-
|
|
1804
|
+
P(s(H), {
|
|
1348
1805
|
name: "close",
|
|
1349
1806
|
size: 12
|
|
1350
1807
|
})
|
|
1351
|
-
], 8,
|
|
1808
|
+
], 8, Il)
|
|
1352
1809
|
]))), 128))
|
|
1353
1810
|
])
|
|
1354
|
-
])) :
|
|
1355
|
-
|
|
1356
|
-
(
|
|
1811
|
+
])) : j("", !0),
|
|
1812
|
+
v("div", ql, [
|
|
1813
|
+
(c(!0), d(V, null, X(i.filters, (o) => (c(), d(V, {
|
|
1357
1814
|
key: o.key
|
|
1358
1815
|
}, [
|
|
1359
|
-
o.type === "segmented" ? (
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
"model-value":
|
|
1363
|
-
tabs:
|
|
1816
|
+
o.type === "segmented" ? (c(), d("div", Dl, [
|
|
1817
|
+
v("p", Bl, y(o.label), 1),
|
|
1818
|
+
P(s(ut), {
|
|
1819
|
+
"model-value": g.value[o.key] ?? "",
|
|
1820
|
+
tabs: A(o),
|
|
1364
1821
|
label: o.label,
|
|
1365
1822
|
stretch: "",
|
|
1366
|
-
"onUpdate:modelValue": (
|
|
1823
|
+
"onUpdate:modelValue": (f) => k(o.key, f === null ? null : String(f))
|
|
1367
1824
|
}, null, 8, ["model-value", "tabs", "label", "onUpdate:modelValue"])
|
|
1368
|
-
])) : o.type === "range" ? (
|
|
1825
|
+
])) : o.type === "range" ? (c(), d("div", {
|
|
1369
1826
|
key: 1,
|
|
1370
1827
|
role: "group",
|
|
1371
1828
|
"aria-label": o.label
|
|
1372
1829
|
}, [
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
(
|
|
1376
|
-
key:
|
|
1377
|
-
"model-value":
|
|
1378
|
-
name: `${o.key}_${
|
|
1830
|
+
v("p", Hl, y(o.label), 1),
|
|
1831
|
+
m.value[o.key] ? (c(), d("div", Kl, [
|
|
1832
|
+
(c(), d(V, null, X(["min", "max"], (f) => P(Lt, {
|
|
1833
|
+
key: f,
|
|
1834
|
+
"model-value": D(o.key, f),
|
|
1835
|
+
name: `${o.key}_${f}`,
|
|
1379
1836
|
width: "full",
|
|
1380
1837
|
decimals: o.decimals ?? 0,
|
|
1381
1838
|
suffix: o.unit,
|
|
1382
|
-
label: n
|
|
1383
|
-
"onUpdate:modelValue": (
|
|
1839
|
+
label: s(n)(f === "min" ? "core.collection.filters.range_from" : "core.collection.filters.range_until"),
|
|
1840
|
+
"onUpdate:modelValue": (F) => x(o.key, f, F)
|
|
1384
1841
|
}, null, 8, ["model-value", "name", "decimals", "suffix", "label", "onUpdate:modelValue"])), 64))
|
|
1385
|
-
])) :
|
|
1386
|
-
], 8,
|
|
1842
|
+
])) : j("", !0)
|
|
1843
|
+
], 8, Ul)) : s(p) && I(o) ? (c(), d("div", {
|
|
1387
1844
|
key: 2,
|
|
1388
1845
|
role: "group",
|
|
1389
1846
|
"aria-label": o.label,
|
|
1390
1847
|
"data-test": "filter-chips"
|
|
1391
1848
|
}, [
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
(
|
|
1395
|
-
key: String(
|
|
1849
|
+
v("p", Gl, y(o.label), 1),
|
|
1850
|
+
v("div", Jl, [
|
|
1851
|
+
(c(!0), d(V, null, X([{ value: null, label: M(o) }, ...K(o)], (f) => (c(), d("button", {
|
|
1852
|
+
key: String(f.value),
|
|
1396
1853
|
type: "button",
|
|
1397
|
-
"aria-pressed": (
|
|
1398
|
-
class:
|
|
1399
|
-
onClick: (
|
|
1400
|
-
}, y(
|
|
1854
|
+
"aria-pressed": (g.value[o.key] ?? null) === f.value,
|
|
1855
|
+
class: W(["min-h-9 cursor-pointer rounded-full px-3.5 text-subheadline ring-1 ring-inset transition-colors", (g.value[o.key] ?? null) === f.value ? "bg-tint-soft font-semibold text-content-link ring-border-selected" : "bg-surface-cell text-content ring-border-separator active:bg-fill"]),
|
|
1856
|
+
onClick: (F) => k(o.key, f.value)
|
|
1857
|
+
}, y(f.label), 11, Wl))), 128))
|
|
1401
1858
|
])
|
|
1402
|
-
], 8,
|
|
1859
|
+
], 8, Xl)) : s(p) ? (c(), d("button", {
|
|
1403
1860
|
key: 3,
|
|
1404
1861
|
type: "button",
|
|
1405
1862
|
"data-test": "filter-row",
|
|
1406
|
-
disabled: !!o.dependsOn &&
|
|
1863
|
+
disabled: !!o.dependsOn && K(o).length === 0,
|
|
1407
1864
|
class: "flex min-h-12 w-full cursor-pointer items-center gap-3 rounded-group bg-surface-cell px-3 text-left ring-1 ring-inset ring-border-separator active:bg-fill disabled:cursor-not-allowed disabled:opacity-50",
|
|
1408
|
-
onClick: (
|
|
1865
|
+
onClick: (f) => $.value = o.key
|
|
1409
1866
|
}, [
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
class:
|
|
1413
|
-
}, y(
|
|
1414
|
-
|
|
1867
|
+
v("span", Ql, y(o.label), 1),
|
|
1868
|
+
v("span", {
|
|
1869
|
+
class: W(["min-w-0 flex-1 truncate text-right text-subheadline", g.value[o.key] == null ? "text-content-disabled" : "font-medium text-content-link"])
|
|
1870
|
+
}, y(ee(o)), 3),
|
|
1871
|
+
P(s(H), {
|
|
1415
1872
|
name: "arrowRightSLine",
|
|
1416
1873
|
size: 18,
|
|
1417
1874
|
class: "shrink-0 text-content-muted"
|
|
1418
1875
|
})
|
|
1419
|
-
], 8,
|
|
1876
|
+
], 8, Yl)) : (c(), Y(Rt, {
|
|
1420
1877
|
key: 4,
|
|
1421
|
-
"model-value":
|
|
1878
|
+
"model-value": g.value[o.key] ?? "",
|
|
1422
1879
|
label: o.label,
|
|
1423
|
-
options:
|
|
1424
|
-
disabled: !!o.dependsOn &&
|
|
1425
|
-
"onUpdate:modelValue": (
|
|
1880
|
+
options: O(o),
|
|
1881
|
+
disabled: !!o.dependsOn && K(o).length === 0,
|
|
1882
|
+
"onUpdate:modelValue": (f) => k(o.key, f === "" ? null : f)
|
|
1426
1883
|
}, null, 8, ["model-value", "label", "options", "disabled", "onUpdate:modelValue"]))
|
|
1427
1884
|
], 64))), 128))
|
|
1428
1885
|
])
|
|
@@ -1431,17 +1888,17 @@ const ul = {
|
|
|
1431
1888
|
_: 1
|
|
1432
1889
|
}, 8, ["title", "grouped"]));
|
|
1433
1890
|
}
|
|
1434
|
-
}),
|
|
1891
|
+
}), fn = { class: "flex flex-col items-start gap-2 lg:flex-row" }, pn = { class: "flex h-9 w-full items-center rounded-control bg-fill px-2.5 text-content-muted transition-colors duration-motion-fast focus-within:outline-2 focus-within:outline-offset-1 focus-within:outline-border-focus lg:w-72 compact:h-10" }, vn = ["placeholder", "aria-label"], mn = ["aria-label"], bn = ["title"], gn = {
|
|
1435
1892
|
key: 0,
|
|
1436
1893
|
class: "min-w-4.5 rounded-full bg-tint px-1 text-center text-caption font-semibold leading-4.5 text-content-on-tint"
|
|
1437
|
-
},
|
|
1894
|
+
}, hn = ["onClick"], yn = {
|
|
1438
1895
|
key: 0,
|
|
1439
1896
|
class: "mt-2.5 flex flex-wrap items-center gap-2",
|
|
1440
1897
|
"data-test": "collection-filter-chips"
|
|
1441
|
-
},
|
|
1898
|
+
}, wn = {
|
|
1442
1899
|
key: 0,
|
|
1443
1900
|
class: "shrink-0 opacity-80"
|
|
1444
|
-
},
|
|
1901
|
+
}, _n = { class: "flex min-w-0 flex-wrap items-center gap-1 font-semibold" }, kn = { class: "break-words" }, xn = ["aria-label", "onClick"], lt = "__search", $n = 3, Sn = 300, Cn = /* @__PURE__ */ ue({
|
|
1445
1902
|
__name: "CollectionToolbar",
|
|
1446
1903
|
props: {
|
|
1447
1904
|
collection: {},
|
|
@@ -1449,305 +1906,213 @@ const ul = {
|
|
|
1449
1906
|
flat: { type: Boolean }
|
|
1450
1907
|
},
|
|
1451
1908
|
emits: ["touched"],
|
|
1452
|
-
setup(
|
|
1453
|
-
const
|
|
1454
|
-
let
|
|
1455
|
-
|
|
1456
|
-
|
|
1909
|
+
setup(l, { emit: e }) {
|
|
1910
|
+
const t = l, i = e, { t: a } = he(), n = Le(), u = ae(t.collection.query.value.search), p = ge("field");
|
|
1911
|
+
let g = null;
|
|
1912
|
+
Se(() => t.collection.query.value.search, (A) => {
|
|
1913
|
+
A !== u.value.trim() && (u.value = A);
|
|
1457
1914
|
});
|
|
1458
|
-
function
|
|
1459
|
-
|
|
1460
|
-
const
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
},
|
|
1915
|
+
function m() {
|
|
1916
|
+
g && clearTimeout(g);
|
|
1917
|
+
const A = u.value;
|
|
1918
|
+
A.length > 0 && A.length < $n || (g = setTimeout(() => {
|
|
1919
|
+
g = null, A !== t.collection.query.value.search && (i("touched", [lt]), t.collection.search(A));
|
|
1920
|
+
}, Sn));
|
|
1464
1921
|
}
|
|
1465
|
-
function
|
|
1466
|
-
|
|
1922
|
+
function $() {
|
|
1923
|
+
g && clearTimeout(g), u.value = "", i("touched", [lt]), t.collection.search(""), p.value?.focus();
|
|
1467
1924
|
}
|
|
1468
|
-
|
|
1469
|
-
const S = (
|
|
1470
|
-
() =>
|
|
1471
|
-
formatNumber: (
|
|
1472
|
-
from:
|
|
1473
|
-
until:
|
|
1925
|
+
kt(() => g && clearTimeout(g));
|
|
1926
|
+
const S = (A) => A.placement === "panel" || t.narrow && A.type !== "text", N = h(() => t.collection.filters.value.filter((A) => !S(A))), k = h(() => t.collection.filters.value.filter(S)), L = h(() => t.collection.query.value.filters), z = h(
|
|
1927
|
+
() => mt(k.value, L.value, {
|
|
1928
|
+
formatNumber: (A) => n.number(A),
|
|
1929
|
+
from: a("core.collection.filters.range_from"),
|
|
1930
|
+
until: a("core.collection.filters.range_until")
|
|
1474
1931
|
})
|
|
1475
|
-
),
|
|
1476
|
-
function
|
|
1477
|
-
|
|
1932
|
+
), D = h(() => It(k.value, L.value));
|
|
1933
|
+
function x(A, I) {
|
|
1934
|
+
i("touched", [A]), t.collection.setFilter(A, I);
|
|
1478
1935
|
}
|
|
1479
|
-
function R(
|
|
1480
|
-
|
|
1936
|
+
function R(A) {
|
|
1937
|
+
t.collection.setFilters(Object.fromEntries(A.map((I) => [I, null])));
|
|
1481
1938
|
}
|
|
1482
|
-
const
|
|
1483
|
-
|
|
1484
|
-
if (!
|
|
1485
|
-
|
|
1486
|
-
}),
|
|
1487
|
-
if (
|
|
1488
|
-
|
|
1939
|
+
const B = ge("panel"), K = ge("panelButton"), M = (A) => !!A && (typeof A.checkVisibility != "function" || A.checkVisibility());
|
|
1940
|
+
Xe({ key: "/", group: "list", label: () => a("core.shortcuts.focus_search") }, () => {
|
|
1941
|
+
if (!M(p.value)) return !1;
|
|
1942
|
+
p.value?.focus(), p.value?.select();
|
|
1943
|
+
}), Xe({ key: "f", group: "list", label: () => k.value.length > 0 ? a("core.shortcuts.open_filters") : "" }, () => {
|
|
1944
|
+
if (k.value.length === 0 || !M(K.value)) return !1;
|
|
1945
|
+
B.value?.present();
|
|
1489
1946
|
});
|
|
1490
|
-
const
|
|
1491
|
-
|
|
1492
|
-
const
|
|
1493
|
-
() => (
|
|
1494
|
-
id: `saved-${
|
|
1495
|
-
label:
|
|
1947
|
+
const ee = h(() => t.collection.savedViews);
|
|
1948
|
+
xt(() => void ee.value?.load());
|
|
1949
|
+
const O = h(
|
|
1950
|
+
() => (ee.value?.items.value ?? []).map((A) => ({
|
|
1951
|
+
id: `saved-${A.id}`,
|
|
1952
|
+
label: A.name,
|
|
1496
1953
|
icon: "starFill",
|
|
1497
1954
|
onSelect: () => {
|
|
1498
|
-
|
|
1955
|
+
i("touched", []), ee.value?.apply(A);
|
|
1499
1956
|
}
|
|
1500
1957
|
}))
|
|
1501
1958
|
);
|
|
1502
|
-
return (
|
|
1503
|
-
class:
|
|
1959
|
+
return (A, I) => (c(), d("div", {
|
|
1960
|
+
class: W([t.flat ? "pb-3" : "border-b border-border-separator px-3 py-2.5", "select-none"]),
|
|
1504
1961
|
"data-test": "collection-toolbar"
|
|
1505
1962
|
}, [
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1963
|
+
v("div", fn, [
|
|
1964
|
+
v("div", pn, [
|
|
1965
|
+
P(s(H), {
|
|
1509
1966
|
name: "search",
|
|
1510
1967
|
size: 16
|
|
1511
1968
|
}),
|
|
1512
|
-
|
|
1969
|
+
De(v("input", {
|
|
1513
1970
|
ref_key: "field",
|
|
1514
|
-
ref:
|
|
1515
|
-
"onUpdate:modelValue":
|
|
1971
|
+
ref: p,
|
|
1972
|
+
"onUpdate:modelValue": I[0] || (I[0] = (T) => u.value = T),
|
|
1516
1973
|
type: "text",
|
|
1517
1974
|
name: "collection-search",
|
|
1518
1975
|
autocomplete: "off",
|
|
1519
|
-
placeholder:
|
|
1520
|
-
"aria-label":
|
|
1976
|
+
placeholder: s(a)("core.collection.search.placeholder"),
|
|
1977
|
+
"aria-label": s(a)("core.collection.search.label"),
|
|
1521
1978
|
class: "peer block min-w-0 flex-1 bg-transparent px-2 py-1.5 text-body text-content-strong outline-0 placeholder:text-content-disabled",
|
|
1522
|
-
onInput:
|
|
1523
|
-
}, null, 40,
|
|
1524
|
-
[
|
|
1979
|
+
onInput: m
|
|
1980
|
+
}, null, 40, vn), [
|
|
1981
|
+
[Be, u.value]
|
|
1525
1982
|
]),
|
|
1526
|
-
|
|
1983
|
+
I[4] || (I[4] = v("kbd", {
|
|
1527
1984
|
"aria-hidden": "true",
|
|
1528
1985
|
class: "rounded border border-border-separator px-1.5 font-mono text-2xs leading-5 text-content-disabled peer-focus:hidden peer-[:not(:placeholder-shown)]:hidden [@media(pointer:coarse)]:hidden"
|
|
1529
1986
|
}, "/", -1)),
|
|
1530
|
-
|
|
1987
|
+
u.value !== "" ? (c(), d("button", {
|
|
1531
1988
|
key: 0,
|
|
1532
1989
|
type: "button",
|
|
1533
|
-
"aria-label":
|
|
1990
|
+
"aria-label": s(a)("core.collection.clear"),
|
|
1534
1991
|
class: "cursor-pointer rounded-full text-content-disabled hover:text-content-muted",
|
|
1535
|
-
onClick:
|
|
1992
|
+
onClick: $
|
|
1536
1993
|
}, [
|
|
1537
|
-
|
|
1994
|
+
P(s(H), {
|
|
1538
1995
|
name: "close",
|
|
1539
1996
|
size: 16
|
|
1540
1997
|
})
|
|
1541
|
-
], 8,
|
|
1998
|
+
], 8, mn)) : j("", !0)
|
|
1542
1999
|
]),
|
|
1543
|
-
|
|
1544
|
-
class:
|
|
2000
|
+
v("div", {
|
|
2001
|
+
class: W(["flex min-w-0 flex-1 items-center gap-2", t.narrow ? "w-full flex-nowrap overflow-x-auto [scrollbar-width:none]" : "flex-wrap"])
|
|
1545
2002
|
}, [
|
|
1546
|
-
|
|
2003
|
+
k.value.length > 0 ? (c(), d("button", {
|
|
1547
2004
|
key: 0,
|
|
1548
2005
|
ref_key: "panelButton",
|
|
1549
|
-
ref:
|
|
2006
|
+
ref: K,
|
|
1550
2007
|
type: "button",
|
|
1551
2008
|
"data-test": "collection-filter-panel-button",
|
|
1552
|
-
title: `${
|
|
1553
|
-
class:
|
|
1554
|
-
onClick:
|
|
2009
|
+
title: `${s(a)("core.collection.filters.panel_button")} (F)`,
|
|
2010
|
+
class: W(["hit-target inline-flex h-8 shrink-0 cursor-pointer items-center gap-x-1.5 rounded-button px-3 text-subheadline font-semibold transition-colors duration-motion-fast compact:h-9", D.value > 0 ? "bg-tint-soft text-content-link" : "bg-surface-cell text-content-strong shadow-group ring-1 ring-inset ring-border-separator hover:bg-fill"]),
|
|
2011
|
+
onClick: I[1] || (I[1] = (T) => B.value?.present())
|
|
1555
2012
|
}, [
|
|
1556
|
-
|
|
2013
|
+
P(s(H), {
|
|
1557
2014
|
name: "filter3",
|
|
1558
2015
|
size: 16
|
|
1559
2016
|
}),
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
], 10,
|
|
1563
|
-
|
|
2017
|
+
le(" " + y(s(a)("core.collection.filters.panel_button")) + " ", 1),
|
|
2018
|
+
D.value > 0 ? (c(), d("span", gn, y(D.value), 1)) : j("", !0)
|
|
2019
|
+
], 10, bn)) : j("", !0),
|
|
2020
|
+
O.value.length > 0 ? (c(), Y(s(Ke), {
|
|
1564
2021
|
key: 1,
|
|
1565
|
-
items:
|
|
1566
|
-
label:
|
|
2022
|
+
items: O.value,
|
|
2023
|
+
label: s(a)("core.collection.saved.menu"),
|
|
1567
2024
|
placement: "bottom-start"
|
|
1568
2025
|
}, {
|
|
1569
|
-
trigger:
|
|
1570
|
-
|
|
2026
|
+
trigger: q(({ toggle: T, attrs: b }) => [
|
|
2027
|
+
v("button", _e(b, {
|
|
1571
2028
|
type: "button",
|
|
1572
2029
|
"data-test": "saved-filters-menu",
|
|
1573
2030
|
class: "inline-flex shrink-0 cursor-pointer items-center gap-1.5 rounded-button bg-surface-cell px-3 py-1.5 text-subheadline font-semibold text-content-strong shadow-group ring-1 ring-inset ring-border-separator transition-colors hover:bg-fill",
|
|
1574
|
-
onClick:
|
|
2031
|
+
onClick: T
|
|
1575
2032
|
}), [
|
|
1576
|
-
|
|
2033
|
+
P(s(H), {
|
|
1577
2034
|
name: "starFill",
|
|
1578
2035
|
size: 14,
|
|
1579
2036
|
class: "text-status-warning-content"
|
|
1580
2037
|
}),
|
|
1581
|
-
|
|
1582
|
-
], 16,
|
|
2038
|
+
le(" " + y(s(a)("core.collection.saved.menu")), 1)
|
|
2039
|
+
], 16, hn)
|
|
1583
2040
|
]),
|
|
1584
2041
|
_: 1
|
|
1585
|
-
}, 8, ["items", "label"])) :
|
|
1586
|
-
(
|
|
1587
|
-
key:
|
|
1588
|
-
filter:
|
|
1589
|
-
value:
|
|
1590
|
-
onUpdate: (
|
|
2042
|
+
}, 8, ["items", "label"])) : j("", !0),
|
|
2043
|
+
(c(!0), d(V, null, X(N.value, (T) => (c(), Y(El, {
|
|
2044
|
+
key: T.key,
|
|
2045
|
+
filter: T,
|
|
2046
|
+
value: L.value[T.key],
|
|
2047
|
+
onUpdate: (b) => x(T.key, b)
|
|
1591
2048
|
}, null, 8, ["filter", "value", "onUpdate"]))), 128))
|
|
1592
2049
|
], 2),
|
|
1593
|
-
|
|
2050
|
+
oe(A.$slots, "default")
|
|
1594
2051
|
]),
|
|
1595
|
-
|
|
1596
|
-
(
|
|
1597
|
-
key:
|
|
2052
|
+
z.value.length > 0 ? (c(), d("div", yn, [
|
|
2053
|
+
(c(!0), d(V, null, X(z.value, (T) => (c(), d("span", {
|
|
2054
|
+
key: T.key,
|
|
1598
2055
|
class: "inline-flex min-h-7 max-w-full items-center gap-1.5 rounded-control bg-tint-soft py-0.5 pr-0.5 pl-2.5 text-subheadline text-content-link"
|
|
1599
2056
|
}, [
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
(
|
|
1603
|
-
|
|
2057
|
+
T.label ? (c(), d("span", wn, y(T.label), 1)) : j("", !0),
|
|
2058
|
+
v("span", _n, [
|
|
2059
|
+
(c(!0), d(V, null, X(T.values, (b, C) => (c(), d(V, { key: C }, [
|
|
2060
|
+
C > 0 ? (c(), Y(s(H), {
|
|
1604
2061
|
key: 0,
|
|
1605
2062
|
name: "arrowRightSLine",
|
|
1606
2063
|
size: 12,
|
|
1607
2064
|
class: "opacity-60"
|
|
1608
|
-
})) :
|
|
1609
|
-
|
|
2065
|
+
})) : j("", !0),
|
|
2066
|
+
v("span", kn, y(b), 1)
|
|
1610
2067
|
], 64))), 128))
|
|
1611
2068
|
]),
|
|
1612
|
-
|
|
2069
|
+
v("button", {
|
|
1613
2070
|
type: "button",
|
|
1614
2071
|
class: "hit-target flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-full hover:bg-tint/15",
|
|
1615
|
-
"aria-label":
|
|
1616
|
-
onClick: (
|
|
2072
|
+
"aria-label": s(a)("core.collection.clear"),
|
|
2073
|
+
onClick: (b) => R(T.clears)
|
|
1617
2074
|
}, [
|
|
1618
|
-
|
|
2075
|
+
P(s(H), {
|
|
1619
2076
|
name: "close",
|
|
1620
2077
|
size: 12
|
|
1621
2078
|
})
|
|
1622
|
-
], 8,
|
|
2079
|
+
], 8, xn)
|
|
1623
2080
|
]))), 128)),
|
|
1624
|
-
|
|
2081
|
+
z.value.length > 1 ? (c(), d("button", {
|
|
1625
2082
|
key: 0,
|
|
1626
2083
|
type: "button",
|
|
1627
2084
|
class: "cursor-pointer px-2 text-subheadline text-content-muted hover:text-content-strong hover:underline",
|
|
1628
|
-
onClick:
|
|
1629
|
-
}, y(
|
|
1630
|
-
])) :
|
|
1631
|
-
|
|
2085
|
+
onClick: I[2] || (I[2] = (T) => R(k.value.map((b) => b.key)))
|
|
2086
|
+
}, y(s(a)("core.collection.filters.reset_all")), 1)) : j("", !0)
|
|
2087
|
+
])) : j("", !0),
|
|
2088
|
+
k.value.length > 0 ? (c(), Y(dn, {
|
|
1632
2089
|
key: 1,
|
|
1633
2090
|
ref_key: "panel",
|
|
1634
|
-
ref:
|
|
1635
|
-
collection:
|
|
1636
|
-
filters:
|
|
1637
|
-
onTouched:
|
|
1638
|
-
}, null, 8, ["collection", "filters"])) :
|
|
2091
|
+
ref: B,
|
|
2092
|
+
collection: t.collection,
|
|
2093
|
+
filters: k.value,
|
|
2094
|
+
onTouched: I[3] || (I[3] = (T) => i("touched", T))
|
|
2095
|
+
}, null, 8, ["collection", "filters"])) : j("", !0)
|
|
1639
2096
|
], 2));
|
|
1640
2097
|
}
|
|
1641
|
-
})
|
|
1642
|
-
function
|
|
1643
|
-
const e =
|
|
1644
|
-
|
|
1645
|
-
const f = (k) => t.actions()?.(k) ?? [];
|
|
1646
|
-
function b(k) {
|
|
1647
|
-
return f(k).filter((R) => R.href).map((R) => ({ key: R.key, label: R.label, icon: R.icon, href: R.href, tone: R.tone ?? "neutral", external: R.external }));
|
|
1648
|
-
}
|
|
1649
|
-
function v(k, R, H) {
|
|
1650
|
-
const Y = f(k);
|
|
1651
|
-
return Y.length === 0 ? !1 : (s.value = t.label()?.(k) ?? t.moreLabel(), l.value = Y.map((F) => ({
|
|
1652
|
-
id: F.key,
|
|
1653
|
-
label: F.label,
|
|
1654
|
-
icon: F.icon,
|
|
1655
|
-
section: F.section,
|
|
1656
|
-
tone: F.tone === "critical" ? "critical" : void 0,
|
|
1657
|
-
onSelect: () => {
|
|
1658
|
-
F.onSelect ? F.onSelect() : F.href && (F.external ? window.open(F.href, "_blank", "noopener") : window.location.assign(F.href));
|
|
1659
|
-
}
|
|
1660
|
-
})), pt(() => t.presentMenu(R, H)), !0);
|
|
1661
|
-
}
|
|
1662
|
-
function x(k, R) {
|
|
1663
|
-
const H = k.currentTarget.getBoundingClientRect();
|
|
1664
|
-
v(R, H.left, H.bottom);
|
|
1665
|
-
}
|
|
1666
|
-
function S(k, R) {
|
|
1667
|
-
!t.actions() || k.target.closest("a") || v(R, k.clientX, k.clientY) && (k.preventDefault(), r = !0);
|
|
1668
|
-
}
|
|
1669
|
-
function D() {
|
|
1670
|
-
a && clearTimeout(a), a = null;
|
|
1671
|
-
}
|
|
1672
|
-
function P(k, R) {
|
|
1673
|
-
r = !1, !(k.pointerType !== "touch" || !t.actions()) && (c = { x: k.clientX, y: k.clientY }, D(), a = setTimeout(() => {
|
|
1674
|
-
a = null, v(R, c.x, c.y) && (r = !0, navigator.vibrate?.(10));
|
|
1675
|
-
}, Jo));
|
|
1676
|
-
}
|
|
1677
|
-
function j(k) {
|
|
1678
|
-
a && Math.hypot(k.clientX - c.x, k.clientY - c.y) > Wo && D();
|
|
1679
|
-
}
|
|
1680
|
-
function A(k) {
|
|
1681
|
-
r && (r = !1, k.preventDefault(), k.stopPropagation());
|
|
1682
|
-
}
|
|
1683
|
-
function U(k, R) {
|
|
1684
|
-
const H = t.target(R);
|
|
1685
|
-
if (!(!H || k.target.closest(Go)) && !window.getSelection()?.toString()) {
|
|
1686
|
-
if (k.metaKey || k.ctrlKey) {
|
|
1687
|
-
window.open(e.resolve(H).href, "_blank");
|
|
1688
|
-
return;
|
|
1689
|
-
}
|
|
1690
|
-
e.push(H);
|
|
1691
|
-
}
|
|
1692
|
-
}
|
|
1693
|
-
return Ke() && Xe(D), { menuItems: l, menuLabel: s, swipeActions: b, openMenuFrom: x, onContextMenu: S, onPointerDown: P, onPointerMove: j, cancelPress: D, onClickCapture: A, onClick: U, actionsOf: f };
|
|
2098
|
+
});
|
|
2099
|
+
function wt(l) {
|
|
2100
|
+
const e = pt("(max-width: 1023px)"), t = h(() => l().some((i) => i.mobile && i.mobile !== "hidden"));
|
|
2101
|
+
return { narrow: h(() => e.value), phone: h(() => e.value && t.value) };
|
|
1694
2102
|
}
|
|
1695
|
-
const
|
|
2103
|
+
const zn = ["aria-busy"], An = {
|
|
1696
2104
|
key: 0,
|
|
1697
2105
|
class: "mb-3 select-none"
|
|
1698
|
-
},
|
|
2106
|
+
}, Pn = {
|
|
1699
2107
|
key: 0,
|
|
1700
2108
|
role: "status",
|
|
1701
2109
|
"data-test": "collection-refreshing",
|
|
1702
2110
|
class: "m-2 flex w-fit max-w-full items-center gap-2 rounded-group bg-fill py-1 pr-3 pl-3 text-footnote text-content-muted"
|
|
1703
|
-
},
|
|
2111
|
+
}, En = {
|
|
1704
2112
|
key: 1,
|
|
1705
2113
|
class: "m-2",
|
|
1706
2114
|
"data-test": "collection-stale"
|
|
1707
|
-
},
|
|
1708
|
-
key: 2,
|
|
1709
|
-
class: "overflow-hidden rounded-group bg-surface-cell shadow-group",
|
|
1710
|
-
"data-test": "collection-mobile-rows"
|
|
1711
|
-
}, nn = { class: "flex flex-1 flex-col gap-2 pt-1" }, sn = ["onClick", "onContextmenu", "onPointerdown"], an = { class: "flex items-start gap-3" }, rn = {
|
|
1712
|
-
key: 0,
|
|
1713
|
-
class: "shrink-0 pt-0.5"
|
|
1714
|
-
}, cn = { class: "flex min-w-0 flex-1 flex-col gap-1" }, un = { class: "flex min-w-0 items-start gap-3" }, dn = { class: "min-w-0 flex-1" }, fn = {
|
|
1715
|
-
key: 1,
|
|
1716
|
-
class: "block truncate text-row-title"
|
|
1717
|
-
}, pn = {
|
|
1718
|
-
key: 0,
|
|
1719
|
-
class: "flex shrink-0 items-center gap-2 pt-0.5"
|
|
1720
|
-
}, vn = ["aria-label", "onClick"], mn = {
|
|
1721
|
-
key: 0,
|
|
1722
|
-
class: "flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 text-row-meta"
|
|
1723
|
-
}, gn = {
|
|
1724
|
-
key: 1,
|
|
1725
|
-
class: "truncate"
|
|
1726
|
-
}, bn = {
|
|
1727
|
-
key: 2,
|
|
1728
|
-
class: "px-4 py-6",
|
|
1729
|
-
"data-test": "collection-failed"
|
|
1730
|
-
}, hn = { class: "flex flex-wrap items-center justify-between gap-3" }, yn = { class: "font-semibold" }, _n = {
|
|
1731
|
-
key: 3,
|
|
1732
|
-
class: "px-4 py-2 text-center",
|
|
1733
|
-
"data-test": "collection-empty"
|
|
1734
|
-
}, wn = {
|
|
1735
|
-
key: 3,
|
|
1736
|
-
class: "inline-block w-full align-middle"
|
|
1737
|
-
}, kn = { class: "border-b border-border-separator" }, xn = ["aria-sort"], $n = ["onClick"], Sn = { key: 1 }, Cn = {
|
|
1738
|
-
key: 0,
|
|
1739
|
-
class: "px-4 pt-2.5 pb-2",
|
|
1740
|
-
style: { width: "20px" }
|
|
1741
|
-
}, zn = { class: "sr-only" }, Pn = {
|
|
1742
|
-
key: 0,
|
|
1743
|
-
class: "size-8 shrink-0 rounded-full bg-fill"
|
|
1744
|
-
}, An = { class: "flex flex-1 flex-col gap-1.5" }, En = { key: 0 }, jn = ["onClick", "onContextmenu", "onPointerdown"], On = { key: 0 }, Ln = { class: "flex items-center justify-center gap-1" }, Tn = ["aria-label", "onClick"], Rn = {
|
|
1745
|
-
key: 2,
|
|
1746
|
-
"data-test": "collection-failed"
|
|
1747
|
-
}, Mn = ["colspan"], Vn = { class: "flex flex-wrap items-center justify-between gap-3" }, Nn = { class: "font-semibold" }, In = {
|
|
1748
|
-
key: 3,
|
|
1749
|
-
"data-test": "collection-empty"
|
|
1750
|
-
}, Fn = ["colspan"], ut = "__search", qn = 37, Dn = /* @__PURE__ */ we({
|
|
2115
|
+
}, On = { class: "flex flex-wrap items-center justify-between gap-3" }, jn = { class: "flex flex-wrap items-center justify-between gap-3" }, Ln = { class: "font-semibold" }, nt = "__search", Rn = /* @__PURE__ */ ue({
|
|
1751
2116
|
__name: "CollectionTable",
|
|
1752
2117
|
props: {
|
|
1753
2118
|
collection: {},
|
|
@@ -1758,93 +2123,90 @@ const Qo = ["aria-busy"], Zo = {
|
|
|
1758
2123
|
viewsPresentation: { default: "segmented" },
|
|
1759
2124
|
actionsVisible: { type: Boolean, default: !1 }
|
|
1760
2125
|
},
|
|
1761
|
-
setup(
|
|
1762
|
-
const e =
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
}), M = e.collection.query.value.search;
|
|
1774
|
-
return M && g.push({ key: ut, label: s("core.collection.empty.search"), values: [M], clears: [] }), g;
|
|
1775
|
-
}), h = _(() => {
|
|
1776
|
-
for (const g of [...oe.value].reverse()) {
|
|
1777
|
-
const M = ce.value.find((m) => m.key === g || m.clears.includes(g));
|
|
1778
|
-
if (M) return M;
|
|
2126
|
+
setup(l) {
|
|
2127
|
+
const e = l, t = ke(), { t: i } = he(), a = Le(), n = h(() => Object.keys(ke()).filter((b) => b !== "toolbar" && b !== "empty")), u = h(() => e.collection.columns.value), { narrow: p, phone: g } = wt(() => u.value), m = h(() => e.collection.rows.value), $ = (b) => e.collection.recordLocation(b), S = h(() => e.collection.query.value.search), N = h(() => e.collection.views.value.map((b) => ({ value: b.key, label: b.label, icon: b.icon, badge: b.count }))), k = ae([]), L = (b) => k.value = [...k.value.filter((C) => !b.includes(C)), ...b], z = h(() => {
|
|
2128
|
+
const b = mt(e.collection.filters.value, e.collection.query.value.filters, {
|
|
2129
|
+
formatNumber: (E) => a.number(E),
|
|
2130
|
+
from: i("core.collection.filters.range_from"),
|
|
2131
|
+
until: i("core.collection.filters.range_until")
|
|
2132
|
+
}), C = e.collection.query.value.search;
|
|
2133
|
+
return C && b.push({ key: nt, label: i("core.collection.empty.search"), values: [C], clears: [] }), b;
|
|
2134
|
+
}), D = h(() => {
|
|
2135
|
+
for (const b of [...k.value].reverse()) {
|
|
2136
|
+
const C = z.value.find((E) => E.key === b || E.clears.includes(b));
|
|
2137
|
+
if (C) return C;
|
|
1779
2138
|
}
|
|
1780
|
-
return
|
|
2139
|
+
return z.value[z.value.length - 1] ?? null;
|
|
1781
2140
|
});
|
|
1782
|
-
function
|
|
1783
|
-
|
|
2141
|
+
function x(b) {
|
|
2142
|
+
k.value = k.value.filter((C) => C !== b.key && !b.clears.includes(C)), b.key === nt ? e.collection.search("") : e.collection.setFilters(Object.fromEntries(b.clears.map((C) => [C, null])));
|
|
1784
2143
|
}
|
|
1785
|
-
function
|
|
1786
|
-
|
|
2144
|
+
function R() {
|
|
2145
|
+
k.value = [], e.collection.clearFilters();
|
|
1787
2146
|
}
|
|
1788
|
-
const
|
|
1789
|
-
const
|
|
1790
|
-
return
|
|
2147
|
+
const B = h(() => {
|
|
2148
|
+
const { sort: b, direction: C } = e.collection.query.value;
|
|
2149
|
+
return b === null ? null : { key: b, direction: C };
|
|
2150
|
+
}), K = ge("card"), M = () => K.value?.scrollIntoView?.({ block: "start", behavior: "smooth" }), ee = h(() => e.collection.display.value === "loading"), O = h(() => e.collection.query.value.pageSize), A = h(() => e.collection.state.value.status === "refreshing"), I = h(() => e.collection.state.value.status === "stale"), T = h(() => {
|
|
2151
|
+
const b = e.collection.state.value;
|
|
2152
|
+
return b.status === "failed" || b.status === "stale" ? b.error ?? "" : "";
|
|
1791
2153
|
});
|
|
1792
|
-
return (
|
|
2154
|
+
return (b, C) => (c(), d("div", {
|
|
1793
2155
|
class: "collection",
|
|
1794
|
-
"aria-busy":
|
|
2156
|
+
"aria-busy": ee.value || A.value || void 0,
|
|
1795
2157
|
"data-test": "collection"
|
|
1796
2158
|
}, [
|
|
1797
|
-
|
|
1798
|
-
|
|
2159
|
+
N.value.length > 0 ? (c(), d("div", An, [
|
|
2160
|
+
P(s(ut), {
|
|
1799
2161
|
"model-value": e.collection.query.value.view,
|
|
1800
|
-
tabs:
|
|
2162
|
+
tabs: N.value,
|
|
1801
2163
|
presentation: e.viewsPresentation,
|
|
1802
|
-
label:
|
|
1803
|
-
"onUpdate:modelValue":
|
|
2164
|
+
label: s(i)("core.collection.views_label"),
|
|
2165
|
+
"onUpdate:modelValue": C[0] || (C[0] = (E) => e.collection.setView(E === null ? null : String(E)))
|
|
1804
2166
|
}, null, 8, ["model-value", "tabs", "presentation", "label"])
|
|
1805
|
-
])) :
|
|
1806
|
-
|
|
2167
|
+
])) : j("", !0),
|
|
2168
|
+
v("div", {
|
|
1807
2169
|
ref_key: "card",
|
|
1808
|
-
ref:
|
|
1809
|
-
class:
|
|
2170
|
+
ref: K,
|
|
2171
|
+
class: W(["scroll-mt-16", s(g) ? "" : "rounded-group bg-surface-cell shadow-group"])
|
|
1810
2172
|
}, [
|
|
1811
|
-
|
|
2173
|
+
P(Cn, {
|
|
1812
2174
|
collection: e.collection,
|
|
1813
|
-
narrow:
|
|
1814
|
-
flat:
|
|
1815
|
-
onTouched:
|
|
2175
|
+
narrow: s(p),
|
|
2176
|
+
flat: s(g),
|
|
2177
|
+
onTouched: L
|
|
1816
2178
|
}, {
|
|
1817
|
-
default:
|
|
1818
|
-
|
|
2179
|
+
default: q(() => [
|
|
2180
|
+
oe(b.$slots, "toolbar")
|
|
1819
2181
|
]),
|
|
1820
2182
|
_: 3
|
|
1821
2183
|
}, 8, ["collection", "narrow", "flat"]),
|
|
1822
|
-
|
|
1823
|
-
|
|
2184
|
+
A.value ? (c(), d("div", Pn, [
|
|
2185
|
+
P(s(H), {
|
|
1824
2186
|
name: "loader4Line",
|
|
1825
2187
|
size: 14,
|
|
1826
2188
|
class: "animate-spin motion-reduce:animate-none"
|
|
1827
2189
|
}),
|
|
1828
|
-
|
|
1829
|
-
])) :
|
|
1830
|
-
|
|
1831
|
-
|
|
2190
|
+
le(" " + y(s(i)("core.state.refreshing")), 1)
|
|
2191
|
+
])) : j("", !0),
|
|
2192
|
+
I.value ? (c(), d("div", En, [
|
|
2193
|
+
P(s(Ge), {
|
|
1832
2194
|
tone: "warning",
|
|
1833
2195
|
role: "alert"
|
|
1834
2196
|
}, {
|
|
1835
|
-
default:
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
2197
|
+
default: q(() => [
|
|
2198
|
+
v("div", On, [
|
|
2199
|
+
v("div", null, [
|
|
2200
|
+
v("p", null, y(T.value), 1),
|
|
2201
|
+
v("p", null, y(s(i)("core.state.stale")), 1)
|
|
1840
2202
|
]),
|
|
1841
|
-
|
|
2203
|
+
P(be, {
|
|
1842
2204
|
prominence: "secondary",
|
|
1843
2205
|
size: "sm",
|
|
1844
|
-
onClick:
|
|
2206
|
+
onClick: C[1] || (C[1] = (E) => e.collection.refresh())
|
|
1845
2207
|
}, {
|
|
1846
|
-
default:
|
|
1847
|
-
|
|
2208
|
+
default: q(() => [
|
|
2209
|
+
le(y(s(i)("core.actions.retry")), 1)
|
|
1848
2210
|
]),
|
|
1849
2211
|
_: 1
|
|
1850
2212
|
})
|
|
@@ -1852,157 +2214,43 @@ const Qo = ["aria-busy"], Zo = {
|
|
|
1852
2214
|
]),
|
|
1853
2215
|
_: 1
|
|
1854
2216
|
})
|
|
1855
|
-
])) :
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
key: e.collection.rowKey(m),
|
|
1877
|
-
style: be(fe(ke)),
|
|
1878
|
-
"data-test": "collection-row",
|
|
1879
|
-
class: le(["relative animate-row-in transition-colors duration-motion-fast active:bg-fill not-first:before:absolute not-first:before:top-0 not-first:before:right-0 not-first:before:left-row-inset not-first:before:z-10 not-first:before:h-px not-first:before:bg-border-separator", T(m) ? "cursor-pointer" : void 0]),
|
|
1880
|
-
onClickCapture: M[2] || (M[2] = //@ts-ignore
|
|
1881
|
-
(...$) => n(z).onClickCapture && n(z).onClickCapture(...$)),
|
|
1882
|
-
onClick: ($) => n(z).onClick($, m),
|
|
1883
|
-
onContextmenu: ($) => n(z).onContextMenu($, m),
|
|
1884
|
-
onPointerdown: ($) => n(z).onPointerDown($, m),
|
|
1885
|
-
onPointermove: M[3] || (M[3] = //@ts-ignore
|
|
1886
|
-
(...$) => n(z).onPointerMove && n(z).onPointerMove(...$)),
|
|
1887
|
-
onPointerup: M[4] || (M[4] = //@ts-ignore
|
|
1888
|
-
(...$) => n(z).cancelPress && n(z).cancelPress(...$)),
|
|
1889
|
-
onPointercancel: M[5] || (M[5] = //@ts-ignore
|
|
1890
|
-
(...$) => n(z).cancelPress && n(z).cancelPress(...$))
|
|
1891
|
-
}, [
|
|
1892
|
-
O(n(Mt), {
|
|
1893
|
-
actions: n(z).swipeActions(m),
|
|
1894
|
-
"content-class": "px-row-inset py-2.5"
|
|
1895
|
-
}, {
|
|
1896
|
-
default: B(() => [
|
|
1897
|
-
p("div", an, [
|
|
1898
|
-
l.leading ? (i(), d("div", rn, [
|
|
1899
|
-
pe(g.$slots, "leading", {
|
|
1900
|
-
item: m,
|
|
1901
|
-
compact: !0
|
|
1902
|
-
})
|
|
1903
|
-
])) : L("", !0),
|
|
1904
|
-
p("div", cn, [
|
|
1905
|
-
p("div", un, [
|
|
1906
|
-
p("div", dn, [
|
|
1907
|
-
(i(!0), d(I, null, Z(S.value, ($) => (i(), d(I, {
|
|
1908
|
-
key: String($.key)
|
|
1909
|
-
}, [
|
|
1910
|
-
A($) ? pe(g.$slots, j($), {
|
|
1911
|
-
item: m,
|
|
1912
|
-
value: U(m, $),
|
|
1913
|
-
compact: !0,
|
|
1914
|
-
to: T(m),
|
|
1915
|
-
search: ae.value
|
|
1916
|
-
}, void 0, void 0, 0) : (i(), d("span", fn, [
|
|
1917
|
-
O(Te, {
|
|
1918
|
-
column: $,
|
|
1919
|
-
item: m,
|
|
1920
|
-
compact: !0,
|
|
1921
|
-
to: T(m),
|
|
1922
|
-
search: ae.value
|
|
1923
|
-
}, null, 8, ["column", "item", "to", "search"])
|
|
1924
|
-
]))
|
|
1925
|
-
], 64))), 128))
|
|
1926
|
-
]),
|
|
1927
|
-
D.value.length || q.value && ve(m) ? (i(), d("div", pn, [
|
|
1928
|
-
(i(!0), d(I, null, Z(D.value, ($) => (i(), d(I, {
|
|
1929
|
-
key: String($.key)
|
|
1930
|
-
}, [
|
|
1931
|
-
A($) ? pe(g.$slots, j($), {
|
|
1932
|
-
item: m,
|
|
1933
|
-
value: U(m, $),
|
|
1934
|
-
compact: !0,
|
|
1935
|
-
to: T(m),
|
|
1936
|
-
search: ae.value
|
|
1937
|
-
}, void 0, void 0, 0) : (i(), W(Te, {
|
|
1938
|
-
key: 1,
|
|
1939
|
-
column: $,
|
|
1940
|
-
item: m,
|
|
1941
|
-
compact: !0,
|
|
1942
|
-
to: T(m),
|
|
1943
|
-
search: ae.value
|
|
1944
|
-
}, null, 8, ["column", "item", "to", "search"]))
|
|
1945
|
-
], 64))), 128)),
|
|
1946
|
-
q.value && ve(m) ? (i(), d("button", {
|
|
1947
|
-
key: 0,
|
|
1948
|
-
type: "button",
|
|
1949
|
-
"data-test": "collection-row-more",
|
|
1950
|
-
"aria-label": me(m),
|
|
1951
|
-
class: "hit-target -my-1 -mr-1 flex size-8 cursor-pointer items-center justify-center rounded-full text-content-muted active:bg-fill",
|
|
1952
|
-
onClick: Re(($) => n(z).openMenuFrom($, m), ["stop"])
|
|
1953
|
-
}, [
|
|
1954
|
-
O(n(J), {
|
|
1955
|
-
name: "moreLine",
|
|
1956
|
-
size: 20
|
|
1957
|
-
})
|
|
1958
|
-
], 8, vn)) : L("", !0)
|
|
1959
|
-
])) : L("", !0)
|
|
1960
|
-
]),
|
|
1961
|
-
P.value.length ? (i(), d("div", mn, [
|
|
1962
|
-
(i(!0), d(I, null, Z(P.value, ($) => (i(), d(I, {
|
|
1963
|
-
key: String($.key)
|
|
1964
|
-
}, [
|
|
1965
|
-
A($) ? pe(g.$slots, j($), {
|
|
1966
|
-
item: m,
|
|
1967
|
-
value: U(m, $),
|
|
1968
|
-
compact: !0,
|
|
1969
|
-
to: T(m),
|
|
1970
|
-
search: ae.value
|
|
1971
|
-
}, void 0, void 0, 0) : k(U(m, $)) ? L("", !0) : (i(), d("span", gn, [
|
|
1972
|
-
O(Te, {
|
|
1973
|
-
column: $,
|
|
1974
|
-
item: m,
|
|
1975
|
-
compact: !0,
|
|
1976
|
-
to: T(m),
|
|
1977
|
-
search: ae.value
|
|
1978
|
-
}, null, 8, ["column", "item", "to", "search"])
|
|
1979
|
-
]))
|
|
1980
|
-
], 64))), 128))
|
|
1981
|
-
])) : L("", !0)
|
|
1982
|
-
])
|
|
1983
|
-
])
|
|
1984
|
-
]),
|
|
1985
|
-
_: 2
|
|
1986
|
-
}, 1032, ["actions"])
|
|
1987
|
-
], 46, sn))), 128)) : L("", !0),
|
|
1988
|
-
Ye.value ? (i(), d("li", bn, [
|
|
1989
|
-
O(n(Fe), {
|
|
2217
|
+
])) : j("", !0),
|
|
2218
|
+
P(yt, {
|
|
2219
|
+
columns: u.value,
|
|
2220
|
+
rows: m.value,
|
|
2221
|
+
"row-key": e.collection.rowKey,
|
|
2222
|
+
display: e.collection.display.value,
|
|
2223
|
+
phone: s(g),
|
|
2224
|
+
link: $,
|
|
2225
|
+
search: S.value,
|
|
2226
|
+
sorted: B.value,
|
|
2227
|
+
"row-actions": e.rowActions,
|
|
2228
|
+
"row-label": e.rowLabel,
|
|
2229
|
+
"row-height": e.rowHeight,
|
|
2230
|
+
density: e.density,
|
|
2231
|
+
"actions-visible": e.actionsVisible,
|
|
2232
|
+
"skeleton-rows": O.value,
|
|
2233
|
+
"reserve-rows": ee.value ? O.value : void 0,
|
|
2234
|
+
onSort: C[3] || (C[3] = (E) => e.collection.toggleSort(E))
|
|
2235
|
+
}, je({
|
|
2236
|
+
failed: q(() => [
|
|
2237
|
+
P(s(Ge), {
|
|
1990
2238
|
tone: "warning",
|
|
1991
2239
|
role: "alert"
|
|
1992
2240
|
}, {
|
|
1993
|
-
default:
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
2241
|
+
default: q(() => [
|
|
2242
|
+
v("div", jn, [
|
|
2243
|
+
v("div", null, [
|
|
2244
|
+
v("p", Ln, y(s(i)("core.collection.failed.title")), 1),
|
|
2245
|
+
v("p", null, y(T.value), 1)
|
|
1998
2246
|
]),
|
|
1999
|
-
|
|
2247
|
+
P(be, {
|
|
2000
2248
|
prominence: "secondary",
|
|
2001
2249
|
size: "sm",
|
|
2002
|
-
onClick:
|
|
2250
|
+
onClick: C[2] || (C[2] = (E) => e.collection.refresh())
|
|
2003
2251
|
}, {
|
|
2004
|
-
default:
|
|
2005
|
-
|
|
2252
|
+
default: q(() => [
|
|
2253
|
+
le(y(s(i)("core.actions.retry")), 1)
|
|
2006
2254
|
]),
|
|
2007
2255
|
_: 1
|
|
2008
2256
|
})
|
|
@@ -2010,244 +2258,39 @@ const Qo = ["aria-busy"], Zo = {
|
|
|
2010
2258
|
]),
|
|
2011
2259
|
_: 1
|
|
2012
2260
|
})
|
|
2013
|
-
])
|
|
2014
|
-
|
|
2015
|
-
e.collection.display.value === "empty" &&
|
|
2261
|
+
]),
|
|
2262
|
+
empty: q(() => [
|
|
2263
|
+
e.collection.display.value === "empty" && t.empty ? oe(b.$slots, "empty", {}, void 0, void 0, 0) : z.value.length > 0 ? (c(), Y(ro, {
|
|
2016
2264
|
key: 1,
|
|
2017
|
-
chips:
|
|
2018
|
-
"last-chip":
|
|
2019
|
-
onRemove:
|
|
2020
|
-
onClearAll:
|
|
2021
|
-
}, null, 8, ["chips", "last-chip"])) : (
|
|
2265
|
+
chips: z.value,
|
|
2266
|
+
"last-chip": D.value,
|
|
2267
|
+
onRemove: x,
|
|
2268
|
+
onClearAll: R
|
|
2269
|
+
}, null, 8, ["chips", "last-chip"])) : (c(), Y(s(Fe), {
|
|
2022
2270
|
key: 2,
|
|
2023
|
-
title:
|
|
2024
|
-
description:
|
|
2271
|
+
title: s(i)("core.collection.no_data"),
|
|
2272
|
+
description: s(i)("core.collection.no_results")
|
|
2025
2273
|
}, null, 8, ["title", "description"]))
|
|
2026
|
-
])
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
(i(!0), d(I, null, Z(f.value, (m) => (i(), d("th", {
|
|
2038
|
-
key: String(m.key),
|
|
2039
|
-
scope: "col",
|
|
2040
|
-
class: le(Y(m)),
|
|
2041
|
-
style: be({ width: m.width ? `${m.width}px` : void 0, textAlign: m.align ?? "start" }),
|
|
2042
|
-
"aria-sort": V(m)
|
|
2043
|
-
}, [
|
|
2044
|
-
p("div", {
|
|
2045
|
-
class: le(["flex", te[m.align ?? "start"]])
|
|
2046
|
-
}, [
|
|
2047
|
-
m.sort !== void 0 ? (i(), d("button", {
|
|
2048
|
-
key: 0,
|
|
2049
|
-
type: "button",
|
|
2050
|
-
class: le(["group inline-flex cursor-pointer items-center gap-1 rounded-sm transition-colors hover:text-content-strong focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus", [u(m) ? "font-semibold text-content-strong" : "", m.align === "end" ? "flex-row-reverse" : ""]]),
|
|
2051
|
-
onClick: (ke) => e.collection.toggleSort(m.sort)
|
|
2052
|
-
}, [
|
|
2053
|
-
p("span", null, y(m.label), 1),
|
|
2054
|
-
O(n(J), {
|
|
2055
|
-
name: X(m),
|
|
2056
|
-
size: 14,
|
|
2057
|
-
class: le(u(m) ? "text-content-muted" : "text-content-disabled opacity-0 transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100")
|
|
2058
|
-
}, null, 8, ["name", "class"])
|
|
2059
|
-
], 10, $n)) : (i(), d("span", Sn, y(m.label), 1))
|
|
2060
|
-
], 2)
|
|
2061
|
-
], 14, xn))), 128)),
|
|
2062
|
-
de.value ? (i(), d("th", Cn, [
|
|
2063
|
-
p("span", zn, y(n(s)("core.actions.more")), 1)
|
|
2064
|
-
])) : L("", !0)
|
|
2065
|
-
])
|
|
2066
|
-
]),
|
|
2067
|
-
p("tbody", null, [
|
|
2068
|
-
K.value ? (i(!0), d(I, { key: 0 }, Z(se.value, (m) => (i(), d("tr", {
|
|
2069
|
-
key: `skeleton-${m}`,
|
|
2070
|
-
"aria-hidden": "true",
|
|
2071
|
-
style: be(e.rowHeight ? { height: `${e.rowHeight}px` } : void 0)
|
|
2072
|
-
}, [
|
|
2073
|
-
(i(!0), d(I, null, Z(f.value, (ke, $) => (i(), d("td", {
|
|
2074
|
-
key: String(ke.key),
|
|
2075
|
-
class: le(H(ke))
|
|
2076
|
-
}, [
|
|
2077
|
-
p("div", {
|
|
2078
|
-
class: "flex animate-pulse items-center gap-3 motion-reduce:animate-none",
|
|
2079
|
-
style: be({ animationDelay: `${m * 60}ms` })
|
|
2080
|
-
}, [
|
|
2081
|
-
$ === 0 ? (i(), d("span", Pn)) : L("", !0),
|
|
2082
|
-
p("span", An, [
|
|
2083
|
-
p("span", {
|
|
2084
|
-
class: "h-2.5 rounded-full bg-fill-strong",
|
|
2085
|
-
style: be({ width: `${55 + (m * 7 + $ * 13) % 35}%` })
|
|
2086
|
-
}, null, 4),
|
|
2087
|
-
p("span", {
|
|
2088
|
-
class: "h-2 rounded-full bg-fill",
|
|
2089
|
-
style: be({ width: `${30 + (m * 11 + $ * 5) % 30}%` })
|
|
2090
|
-
}, null, 4)
|
|
2091
|
-
])
|
|
2092
|
-
], 4)
|
|
2093
|
-
], 2))), 128)),
|
|
2094
|
-
de.value ? (i(), d("td", En, [...M[10] || (M[10] = [
|
|
2095
|
-
p("div", { class: "mx-auto h-6 w-6 animate-pulse rounded-full bg-fill motion-reduce:animate-none" }, null, -1)
|
|
2096
|
-
])])) : L("", !0)
|
|
2097
|
-
], 4))), 128)) : L("", !0),
|
|
2098
|
-
e.collection.display.value === "rows" ? (i(!0), d(I, { key: 1 }, Z(C.value, (m, ke) => (i(), d("tr", {
|
|
2099
|
-
key: e.collection.rowKey(m),
|
|
2100
|
-
class: le(["animate-row-in", T(m) ? "cursor-pointer" : void 0]),
|
|
2101
|
-
"data-test": "collection-row",
|
|
2102
|
-
style: be([e.rowHeight ? { height: `${e.rowHeight}px` } : {}, fe(ke)]),
|
|
2103
|
-
onClickCapture: M[7] || (M[7] = //@ts-ignore
|
|
2104
|
-
(...$) => n(z).onClickCapture && n(z).onClickCapture(...$)),
|
|
2105
|
-
onClick: ($) => n(z).onClick($, m),
|
|
2106
|
-
onContextmenu: ($) => n(z).onContextMenu($, m),
|
|
2107
|
-
onPointerdown: ($) => n(z).onPointerDown($, m)
|
|
2108
|
-
}, [
|
|
2109
|
-
(i(!0), d(I, null, Z(f.value, ($, St) => (i(), d("td", {
|
|
2110
|
-
key: String($.key),
|
|
2111
|
-
class: le(re($))
|
|
2112
|
-
}, [
|
|
2113
|
-
pe(g.$slots, j($), {
|
|
2114
|
-
item: m,
|
|
2115
|
-
value: U(m, $),
|
|
2116
|
-
compact: !1,
|
|
2117
|
-
to: T(m)
|
|
2118
|
-
}, () => [
|
|
2119
|
-
O(Te, {
|
|
2120
|
-
column: $,
|
|
2121
|
-
item: m,
|
|
2122
|
-
compact: !1,
|
|
2123
|
-
to: T(m),
|
|
2124
|
-
search: ae.value
|
|
2125
|
-
}, vt({ _: 2 }, [
|
|
2126
|
-
l.leading && St === 0 ? {
|
|
2127
|
-
name: "leading",
|
|
2128
|
-
fn: B(() => [
|
|
2129
|
-
pe(g.$slots, "leading", {
|
|
2130
|
-
item: m,
|
|
2131
|
-
compact: !1
|
|
2132
|
-
})
|
|
2133
|
-
]),
|
|
2134
|
-
key: "0"
|
|
2135
|
-
} : void 0
|
|
2136
|
-
]), 1032, ["column", "item", "to", "search"])
|
|
2137
|
-
])
|
|
2138
|
-
], 2))), 128)),
|
|
2139
|
-
de.value ? (i(), d("td", On, [
|
|
2140
|
-
pe(g.$slots, "actions", { item: m }, () => [
|
|
2141
|
-
p("div", Ln, [
|
|
2142
|
-
T(m) ? (i(), W(n(Vt), {
|
|
2143
|
-
key: 0,
|
|
2144
|
-
text: n(s)("core.collection.open_record"),
|
|
2145
|
-
side: "left"
|
|
2146
|
-
}, {
|
|
2147
|
-
default: B(() => [
|
|
2148
|
-
O(n(mt), {
|
|
2149
|
-
to: T(m),
|
|
2150
|
-
"aria-label": `${n(s)("core.collection.open_record")}${e.rowLabel ? `: ${e.rowLabel(m)}` : ""}`,
|
|
2151
|
-
class: "inline-flex rounded-md p-1.5 text-content-link transition-colors hover:bg-tint-soft focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus"
|
|
2152
|
-
}, {
|
|
2153
|
-
default: B(() => [
|
|
2154
|
-
O(n(J), {
|
|
2155
|
-
name: "eye",
|
|
2156
|
-
size: 18
|
|
2157
|
-
})
|
|
2158
|
-
]),
|
|
2159
|
-
_: 1
|
|
2160
|
-
}, 8, ["to", "aria-label"])
|
|
2161
|
-
]),
|
|
2162
|
-
_: 2
|
|
2163
|
-
}, 1032, ["text"])) : L("", !0),
|
|
2164
|
-
q.value && ve(m) ? (i(), d("button", {
|
|
2165
|
-
key: 1,
|
|
2166
|
-
type: "button",
|
|
2167
|
-
"data-test": "collection-row-more",
|
|
2168
|
-
"aria-label": me(m),
|
|
2169
|
-
class: "hit-target flex size-8 cursor-pointer items-center justify-center rounded-full bg-fill text-content-strong transition-colors duration-motion-fast hover:bg-fill-strong focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus",
|
|
2170
|
-
onClick: Re(($) => n(z).openMenuFrom($, m), ["stop"])
|
|
2171
|
-
}, [
|
|
2172
|
-
O(n(J), {
|
|
2173
|
-
name: "moreLine",
|
|
2174
|
-
size: 18
|
|
2175
|
-
})
|
|
2176
|
-
], 8, Tn)) : L("", !0)
|
|
2177
|
-
])
|
|
2178
|
-
])
|
|
2179
|
-
])) : L("", !0)
|
|
2180
|
-
], 46, jn))), 128)) : L("", !0),
|
|
2181
|
-
Ye.value ? (i(), d("tr", Rn, [
|
|
2182
|
-
p("td", {
|
|
2183
|
-
colspan: f.value.length + (de.value ? 1 : 0),
|
|
2184
|
-
class: "!whitespace-normal py-6"
|
|
2185
|
-
}, [
|
|
2186
|
-
O(n(Fe), {
|
|
2187
|
-
tone: "warning",
|
|
2188
|
-
role: "alert"
|
|
2189
|
-
}, {
|
|
2190
|
-
default: B(() => [
|
|
2191
|
-
p("div", Vn, [
|
|
2192
|
-
p("div", null, [
|
|
2193
|
-
p("p", Nn, y(n(s)("core.collection.failed.title")), 1),
|
|
2194
|
-
p("p", null, y(Ne.value), 1)
|
|
2195
|
-
]),
|
|
2196
|
-
O(he, {
|
|
2197
|
-
prominence: "secondary",
|
|
2198
|
-
size: "sm",
|
|
2199
|
-
onClick: M[8] || (M[8] = (m) => e.collection.refresh())
|
|
2200
|
-
}, {
|
|
2201
|
-
default: B(() => [
|
|
2202
|
-
ne(y(n(s)("core.actions.retry")), 1)
|
|
2203
|
-
]),
|
|
2204
|
-
_: 1
|
|
2205
|
-
})
|
|
2206
|
-
])
|
|
2207
|
-
]),
|
|
2208
|
-
_: 1
|
|
2209
|
-
})
|
|
2210
|
-
], 8, Mn)
|
|
2211
|
-
])) : L("", !0),
|
|
2212
|
-
e.collection.display.value === "empty" || e.collection.display.value === "no-matches" ? (i(), d("tr", In, [
|
|
2213
|
-
p("td", {
|
|
2214
|
-
colspan: f.value.length + (de.value ? 1 : 0),
|
|
2215
|
-
class: "!whitespace-normal py-6 text-center"
|
|
2216
|
-
}, [
|
|
2217
|
-
e.collection.display.value === "empty" && l.empty ? pe(g.$slots, "empty", {}, void 0, void 0, 0) : ce.value.length > 0 ? (i(), W(at, {
|
|
2218
|
-
key: 1,
|
|
2219
|
-
chips: ce.value,
|
|
2220
|
-
"last-chip": h.value,
|
|
2221
|
-
onRemove: w,
|
|
2222
|
-
onClearAll: o
|
|
2223
|
-
}, null, 8, ["chips", "last-chip"])) : (i(), W(n(Ze), {
|
|
2224
|
-
key: 2,
|
|
2225
|
-
title: n(s)("core.collection.no_data"),
|
|
2226
|
-
description: n(s)("core.collection.no_results")
|
|
2227
|
-
}, null, 8, ["title", "description"]))
|
|
2228
|
-
], 8, Fn)
|
|
2229
|
-
])) : L("", !0)
|
|
2230
|
-
])
|
|
2231
|
-
], 2)
|
|
2232
|
-
], 4)
|
|
2233
|
-
])),
|
|
2234
|
-
O(Dl, {
|
|
2274
|
+
]),
|
|
2275
|
+
_: 2
|
|
2276
|
+
}, [
|
|
2277
|
+
X(n.value, (E) => ({
|
|
2278
|
+
name: E,
|
|
2279
|
+
fn: q((ie) => [
|
|
2280
|
+
oe(b.$slots, E, Ue(He(ie ?? {})))
|
|
2281
|
+
])
|
|
2282
|
+
}))
|
|
2283
|
+
]), 1032, ["columns", "rows", "row-key", "display", "phone", "search", "sorted", "row-actions", "row-label", "row-height", "density", "actions-visible", "skeleton-rows", "reserve-rows"]),
|
|
2284
|
+
P(Po, {
|
|
2235
2285
|
collection: e.collection,
|
|
2236
|
-
compact:
|
|
2237
|
-
flat:
|
|
2238
|
-
onTurned:
|
|
2286
|
+
compact: s(p),
|
|
2287
|
+
flat: s(g),
|
|
2288
|
+
onTurned: M
|
|
2239
2289
|
}, null, 8, ["collection", "compact", "flat"])
|
|
2240
|
-
], 2)
|
|
2241
|
-
|
|
2242
|
-
key: 1,
|
|
2243
|
-
ref_key: "rowMenu",
|
|
2244
|
-
ref: E,
|
|
2245
|
-
items: n(z).menuItems.value,
|
|
2246
|
-
label: n(z).menuLabel.value
|
|
2247
|
-
}, null, 8, ["items", "label"])) : L("", !0)
|
|
2248
|
-
], 8, Qo));
|
|
2290
|
+
], 2)
|
|
2291
|
+
], 8, zn));
|
|
2249
2292
|
}
|
|
2250
|
-
}),
|
|
2293
|
+
}), ds = /* @__PURE__ */ ue({
|
|
2251
2294
|
__name: "CollectionPage",
|
|
2252
2295
|
props: {
|
|
2253
2296
|
collection: {},
|
|
@@ -2262,17 +2305,17 @@ const Qo = ["aria-busy"], Zo = {
|
|
|
2262
2305
|
viewsPresentation: { default: "segmented" },
|
|
2263
2306
|
actionsVisible: { type: Boolean, default: !1 }
|
|
2264
2307
|
},
|
|
2265
|
-
setup(
|
|
2266
|
-
const e =
|
|
2267
|
-
return (
|
|
2308
|
+
setup(l) {
|
|
2309
|
+
const e = l, t = h(() => Object.keys(ke()).filter((a) => a !== "default")), i = h(() => e.collection.total.value || null);
|
|
2310
|
+
return (a, n) => (c(), Y(s(Pt), {
|
|
2268
2311
|
title: e.title,
|
|
2269
2312
|
description: e.description,
|
|
2270
2313
|
icon: e.icon,
|
|
2271
|
-
count:
|
|
2314
|
+
count: i.value,
|
|
2272
2315
|
actions: e.actions
|
|
2273
2316
|
}, {
|
|
2274
|
-
default:
|
|
2275
|
-
|
|
2317
|
+
default: q(() => [
|
|
2318
|
+
P(Rn, {
|
|
2276
2319
|
collection: e.collection,
|
|
2277
2320
|
"row-actions": e.rowActions,
|
|
2278
2321
|
"row-label": e.rowLabel,
|
|
@@ -2280,44 +2323,143 @@ const Qo = ["aria-busy"], Zo = {
|
|
|
2280
2323
|
density: e.density,
|
|
2281
2324
|
"views-presentation": e.viewsPresentation,
|
|
2282
2325
|
"actions-visible": e.actionsVisible
|
|
2283
|
-
},
|
|
2284
|
-
|
|
2285
|
-
name:
|
|
2286
|
-
fn:
|
|
2287
|
-
|
|
2326
|
+
}, je({ _: 2 }, [
|
|
2327
|
+
X(t.value, (u) => ({
|
|
2328
|
+
name: u,
|
|
2329
|
+
fn: q((p) => [
|
|
2330
|
+
oe(a.$slots, u, Ue(He(p ?? {})))
|
|
2288
2331
|
])
|
|
2289
2332
|
}))
|
|
2290
2333
|
]), 1032, ["collection", "row-actions", "row-label", "row-height", "density", "views-presentation", "actions-visible"]),
|
|
2291
|
-
|
|
2334
|
+
oe(a.$slots, "default")
|
|
2292
2335
|
]),
|
|
2293
2336
|
_: 3
|
|
2294
2337
|
}, 8, ["title", "description", "icon", "count", "actions"]));
|
|
2295
2338
|
}
|
|
2296
|
-
}),
|
|
2297
|
-
|
|
2298
|
-
|
|
2339
|
+
}), Tn = ["aria-busy"], fs = /* @__PURE__ */ ue({
|
|
2340
|
+
__name: "DataTable",
|
|
2341
|
+
props: {
|
|
2342
|
+
rows: {},
|
|
2343
|
+
columns: {},
|
|
2344
|
+
rowKey: {},
|
|
2345
|
+
loading: { type: Boolean, default: !1 },
|
|
2346
|
+
skeletonRows: { default: 3 },
|
|
2347
|
+
recordRoute: { type: Function, default: void 0 },
|
|
2348
|
+
rowActions: { type: Function, default: void 0 },
|
|
2349
|
+
rowLabel: { type: Function, default: void 0 },
|
|
2350
|
+
rowHeight: { default: void 0 },
|
|
2351
|
+
density: { default: "regular" },
|
|
2352
|
+
actionsVisible: { type: Boolean, default: !1 },
|
|
2353
|
+
rowClass: { type: Function, default: void 0 }
|
|
2354
|
+
},
|
|
2355
|
+
setup(l) {
|
|
2356
|
+
const e = l, { phone: t } = wt(() => e.columns), i = h(() => e.loading ? "loading" : e.rows.length === 0 ? "empty" : "rows"), a = (u) => e.recordRoute ? e.recordRoute(u) : null, n = h(() => Object.keys(ke()));
|
|
2357
|
+
return (u, p) => (c(), d("div", {
|
|
2358
|
+
"aria-busy": e.loading || void 0,
|
|
2359
|
+
"data-test": "data-table"
|
|
2360
|
+
}, [
|
|
2361
|
+
P(yt, {
|
|
2362
|
+
columns: e.columns,
|
|
2363
|
+
rows: e.rows,
|
|
2364
|
+
"row-key": e.rowKey,
|
|
2365
|
+
display: i.value,
|
|
2366
|
+
phone: s(t),
|
|
2367
|
+
link: a,
|
|
2368
|
+
"row-actions": e.rowActions,
|
|
2369
|
+
"row-label": e.rowLabel,
|
|
2370
|
+
"row-height": e.rowHeight,
|
|
2371
|
+
density: e.density,
|
|
2372
|
+
"actions-visible": e.actionsVisible,
|
|
2373
|
+
"skeleton-rows": e.skeletonRows,
|
|
2374
|
+
"row-class": e.rowClass
|
|
2375
|
+
}, je({ _: 2 }, [
|
|
2376
|
+
X(n.value, (g) => ({
|
|
2377
|
+
name: g,
|
|
2378
|
+
fn: q((m) => [
|
|
2379
|
+
oe(u.$slots, g, Ue(He(m ?? {})))
|
|
2380
|
+
])
|
|
2381
|
+
}))
|
|
2382
|
+
]), 1032, ["columns", "rows", "row-key", "display", "phone", "row-actions", "row-label", "row-height", "density", "actions-visible", "skeleton-rows", "row-class"])
|
|
2383
|
+
], 8, Tn));
|
|
2384
|
+
}
|
|
2385
|
+
}), Vn = {
|
|
2386
|
+
key: 0,
|
|
2387
|
+
class: "flex items-center justify-center gap-1",
|
|
2388
|
+
"data-test": "row-actions"
|
|
2389
|
+
}, Fn = ["href", "target", "rel", "aria-label", "data-action"], Mn = ["aria-label", "data-action", "disabled", "onClick"], st = "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus", ps = /* @__PURE__ */ ue({
|
|
2390
|
+
__name: "RowActions",
|
|
2391
|
+
props: {
|
|
2392
|
+
actions: {},
|
|
2393
|
+
disabled: { type: Boolean, default: !1 }
|
|
2394
|
+
},
|
|
2395
|
+
setup(l) {
|
|
2396
|
+
const e = l, t = (i) => i.tone === "critical" ? "text-status-danger-content hover:bg-status-danger-surface" : "text-content-link hover:bg-tint-soft";
|
|
2397
|
+
return (i, a) => e.actions.length > 0 ? (c(), d("div", Vn, [
|
|
2398
|
+
(c(!0), d(V, null, X(e.actions, (n) => (c(), Y(s(dt), {
|
|
2399
|
+
key: n.key,
|
|
2400
|
+
text: n.label,
|
|
2401
|
+
side: "left"
|
|
2402
|
+
}, {
|
|
2403
|
+
default: q(() => [
|
|
2404
|
+
n.href && !e.disabled ? (c(), d("a", {
|
|
2405
|
+
key: 0,
|
|
2406
|
+
href: n.href,
|
|
2407
|
+
target: n.external ? "_blank" : void 0,
|
|
2408
|
+
rel: n.external ? "noopener" : void 0,
|
|
2409
|
+
"aria-label": n.label,
|
|
2410
|
+
"data-action": n.key,
|
|
2411
|
+
class: W(["inline-flex rounded-md p-1.5 transition-colors", [t(n), st]])
|
|
2412
|
+
}, [
|
|
2413
|
+
P(s(H), {
|
|
2414
|
+
name: n.icon,
|
|
2415
|
+
size: 18
|
|
2416
|
+
}, null, 8, ["name"])
|
|
2417
|
+
], 10, Fn)) : (c(), d("button", {
|
|
2418
|
+
key: 1,
|
|
2419
|
+
type: "button",
|
|
2420
|
+
"aria-label": n.label,
|
|
2421
|
+
"data-action": n.key,
|
|
2422
|
+
disabled: e.disabled,
|
|
2423
|
+
class: W(["inline-flex cursor-pointer rounded-md p-1.5 transition-colors disabled:pointer-events-none disabled:opacity-40", [t(n), st]]),
|
|
2424
|
+
onClick: (u) => n.onSelect?.()
|
|
2425
|
+
}, [
|
|
2426
|
+
P(s(H), {
|
|
2427
|
+
name: n.icon,
|
|
2428
|
+
size: 18
|
|
2429
|
+
}, null, 8, ["name"])
|
|
2430
|
+
], 10, Mn))
|
|
2431
|
+
]),
|
|
2432
|
+
_: 2
|
|
2433
|
+
}, 1032, ["text"]))), 128))
|
|
2434
|
+
])) : j("", !0);
|
|
2435
|
+
}
|
|
2436
|
+
}), Nn = ["today", "yesterday", "this_week", "last_week", "this_month", "last_month", "this_year", "last_year"];
|
|
2437
|
+
function vs(l, e) {
|
|
2438
|
+
const { t } = he();
|
|
2299
2439
|
return {
|
|
2300
|
-
key:
|
|
2440
|
+
key: l,
|
|
2301
2441
|
icon: "calendarEventFill",
|
|
2302
|
-
label: e ??
|
|
2442
|
+
label: e ?? t("core.collection.date_presets.label"),
|
|
2303
2443
|
type: "select",
|
|
2304
|
-
options:
|
|
2444
|
+
options: Nn.map((i) => ({ value: i, label: t(`core.collection.date_presets.options.${i}`) }))
|
|
2305
2445
|
};
|
|
2306
2446
|
}
|
|
2307
2447
|
export {
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2448
|
+
Pe as CollectionCell,
|
|
2449
|
+
ds as CollectionPage,
|
|
2450
|
+
Rn as CollectionTable,
|
|
2451
|
+
Nn as DATE_PRESETS,
|
|
2452
|
+
Vt as DEFAULT_PAGE_SIZES,
|
|
2453
|
+
fs as DataTable,
|
|
2454
|
+
xe as LIST_CONTEXT_PARAM,
|
|
2455
|
+
et as RecordIdentity,
|
|
2456
|
+
ps as RowActions,
|
|
2457
|
+
us as createMemorySavedViews,
|
|
2458
|
+
as as defineCollection,
|
|
2459
|
+
is as httpList,
|
|
2460
|
+
Wt as listParams,
|
|
2461
|
+
Yt as readListPage,
|
|
2462
|
+
rs as useCollection,
|
|
2463
|
+
cs as useCollectionNeighbors,
|
|
2464
|
+
vs as useDatePresetFilter
|
|
2323
2465
|
};
|