@wssto2/vue-core 0.4.6 → 0.4.8
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 +2 -1
- package/dist/{Activity-BVk8iG3X.js → Activity-BqmMjwAS.js} +1 -1
- package/dist/{Changes-CaiZpcyW.js → Changes-CoDcwt3C.js} +1 -1
- package/dist/CollectionPage.vue_vue_type_script_setup_true_lang-C35PsfKK.js +1569 -0
- package/dist/{DataTable.vue_vue_type_script_setup_true_lang-KPm5NrDE.js → DataTable.vue_vue_type_script_setup_true_lang-4CL_kEKf.js} +21 -17
- package/dist/{DeadLetters-BOMgmmOg.js → DeadLetters-DaWaCeYJ.js} +2 -2
- package/dist/{General-BaW63VQg.js → General-sP35jv3T.js} +1 -1
- package/dist/{ProfilePage-Bbv5KH3L.js → ProfilePage-CMtis35I.js} +2 -2
- package/dist/{Sessions-r9WHf0nU.js → Sessions-CWqbbgzF.js} +1 -1
- package/dist/{SettingsPage-Dcib_TK0.js → SettingsPage-BYwmti4E.js} +1 -1
- package/dist/{SignIn-DJ-ai_ap.js → SignIn-BGs0x7Cg.js} +1 -1
- package/dist/{SignInPage-CJAsxvc6.js → SignInPage-Djhf9T9M.js} +1 -1
- package/dist/{SignInTable.vue_vue_type_script_setup_true_lang-ALAuc0sI.js → SignInTable.vue_vue_type_script_setup_true_lang-BxqBA5pD.js} +1 -1
- package/dist/{SignIns-NnIqezxn.js → SignIns-DkR9TvZT.js} +2 -2
- package/dist/{UserRecord-JZFQ40hK.js → UserRecord-C2jOiPcF.js} +2 -2
- package/dist/{UsersList-cfhb1GE7.js → UsersList-CFDuDIu_.js} +3 -3
- package/dist/collection/CollectionPage.vue.d.ts +2 -0
- package/dist/collection/CollectionRows.vue.d.ts +6 -1
- package/dist/collection/CollectionTable.vue.d.ts +9 -0
- package/dist/collection/CollectionToolbar.vue.d.ts +3 -2
- package/dist/collection/DataTable.vue.d.ts +3 -0
- package/dist/collection/index.js +3 -3
- package/dist/collection/rowInteractions.d.ts +3 -1
- package/dist/collection/useCollection.d.ts +4 -0
- package/dist/i18n/index.js +8 -8
- package/dist/identity/index.js +1 -1
- package/dist/{index-By5B18A3.js → index-0QeMiN0l.js} +10 -10
- package/dist/{index-7QcMXQZq.js → index-DtPd4laZ.js} +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/notifications/index.js +1 -1
- package/dist/rowLayout-D1cYQghV.js +663 -0
- package/dist/{status-Ct8ixCoS.js → status-7L8lC-_q.js} +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/CollectionPage.vue_vue_type_script_setup_true_lang-kBBHIJTB.js +0 -1520
- package/dist/rowLayout-BkQWulan.js +0 -621
|
@@ -0,0 +1,1569 @@
|
|
|
1
|
+
import { hasInjectionContext as lt, inject as ot, shallowRef as xe, computed as _, watch as Le, toValue as Se, ref as ie, getCurrentScope as nt, onScopeDispose as st, defineComponent as be, openBlock as u, createElementBlock as y, createVNode as O, unref as t, createElementVNode as r, toDisplayString as g, Fragment as ee, renderList as le, createCommentVNode as F, createBlock as W, mergeProps as ve, withCtx as q, createTextVNode as G, normalizeClass as ue, useTemplateRef as fe, withModifiers as We, withDirectives as Fe, vModelText as Pe, nextTick as at, onBeforeUnmount as rt, onMounted as it, renderSlot as ge, useSlots as ze, createSlots as Qe, normalizeProps as Xe, guardReactiveProps as Je } from "vue";
|
|
2
|
+
import { routerKey as ct } from "vue-router";
|
|
3
|
+
import { i as Re, a as ut } from "./error-CD7x0Jrz.js";
|
|
4
|
+
import { a as dt, d as Te, o as ft, L as Ne, e as je, w as pt, b as vt } from "./http-D_D9YbLH.js";
|
|
5
|
+
import { a as mt } from "./AdaptivePageShell.vue_vue_type_script_setup_true_lang-B7qSUiee.js";
|
|
6
|
+
import { useI18n as he } from "vue-i18n";
|
|
7
|
+
import { _ as ce, u as Ae } from "./Button.vue_vue_type_script_setup_true_lang-CL9Qh5yq.js";
|
|
8
|
+
import { _ as Ge } from "./Tabs.vue_vue_type_script_setup_true_lang-CcMcE38r.js";
|
|
9
|
+
import { u as qe } from "./format-B8mJm946.js";
|
|
10
|
+
import { _ as I } from "./Icon.vue_vue_type_script_lang-D7oC-d-S.js";
|
|
11
|
+
import { _ as Ee } from "./Banner.vue_vue_type_script_setup_true_lang-DSStj_5z.js";
|
|
12
|
+
import { _ as Ue } from "./EmptyState.vue_vue_type_script_setup_true_lang-50p-Mp8I.js";
|
|
13
|
+
import { u as bt, _ as gt } from "./rowLayout-D1cYQghV.js";
|
|
14
|
+
import { _ as Ye } from "./Menu.vue_vue_type_script_setup_true_lang-uPmxWvds.js";
|
|
15
|
+
import { _ as Ze } from "./Popover.vue_vue_type_script_setup_true_lang-Dx-tDhNE.js";
|
|
16
|
+
import { _ as we } from "./ToneDot.vue_vue_type_script_setup_true_lang-99rNn-L5.js";
|
|
17
|
+
import { _ as ht } from "./NumberField.vue_vue_type_script_setup_true_lang-C7N5nq0P.js";
|
|
18
|
+
import { _ as yt } from "./SelectField.vue_vue_type_script_setup_true_lang-BJoAkBo2.js";
|
|
19
|
+
import { a as _t } from "./mediaQuery-CygcXmFW.js";
|
|
20
|
+
import { _ as xt } from "./Sheet.vue_vue_type_script_setup_true_lang-DgOFV4fa.js";
|
|
21
|
+
import { t as ke } from "./toast-CqSDTWRX.js";
|
|
22
|
+
const re = (n) => n == null || n === "";
|
|
23
|
+
function et(n) {
|
|
24
|
+
if (!n) return [null, null];
|
|
25
|
+
const [e = "", s = ""] = String(n).split(",");
|
|
26
|
+
return [e.trim() || null, s.trim() || null];
|
|
27
|
+
}
|
|
28
|
+
function kt(n, e) {
|
|
29
|
+
const s = re(n) ? "" : String(n), p = re(e) ? "" : String(e);
|
|
30
|
+
return s === "" && p === "" ? null : `${s},${p}`;
|
|
31
|
+
}
|
|
32
|
+
function wt(n, e) {
|
|
33
|
+
const s = re(e) ? null : new Set(String(e).split(",")), p = (n.options ?? []).filter(
|
|
34
|
+
(c) => !n.dependsOn || !s || c.parentValue !== void 0 && s.has(String(c.parentValue))
|
|
35
|
+
), a = /* @__PURE__ */ new Map();
|
|
36
|
+
for (const c of p) {
|
|
37
|
+
const d = a.get(c.label) ?? { values: [], dot: c.dot }, f = String(c.value);
|
|
38
|
+
d.values.includes(f) || d.values.push(f), a.set(c.label, d);
|
|
39
|
+
}
|
|
40
|
+
return [...a.entries()].map(([c, { values: d, dot: f }]) => ({ label: c, value: d.join(","), ...f ? { dot: f } : {} }));
|
|
41
|
+
}
|
|
42
|
+
function $t(n, e, s) {
|
|
43
|
+
if (re(e)) return null;
|
|
44
|
+
if (n.type === "range") {
|
|
45
|
+
const [a, c] = et(String(e)), d = n.unit ? ` ${n.unit}` : "", f = (b) => `${n.unit ? s.formatNumber(Number(b)) : b}${d}`;
|
|
46
|
+
return a !== null && c !== null ? `${f(a)} – ${f(c)}` : a !== null ? `${s.from.toLowerCase()} ${f(a)}` : c !== null ? `${s.until.toLowerCase()} ${f(c)}` : null;
|
|
47
|
+
}
|
|
48
|
+
const p = new Set(String(e).split(","));
|
|
49
|
+
return (n.options ?? []).find((a) => p.has(String(a.value)))?.label ?? String(e);
|
|
50
|
+
}
|
|
51
|
+
function Ve(n, e, s) {
|
|
52
|
+
const p = new Set(n.map((d) => d.key)), a = (d) => n.find((f) => f.dependsOn === d), c = [];
|
|
53
|
+
for (const d of n.filter((f) => !f.dependsOn || !p.has(f.dependsOn))) {
|
|
54
|
+
const f = [];
|
|
55
|
+
for (let S = d; S && !f.includes(S); S = a(S.key)) f.push(S);
|
|
56
|
+
const b = f.map((S) => ({ filter: S, value: $t(S, e[S.key], s) })).filter((S) => S.value !== null);
|
|
57
|
+
b.length !== 0 && c.push({
|
|
58
|
+
key: d.key,
|
|
59
|
+
label: b.length === 1 ? b[0].filter.label : null,
|
|
60
|
+
values: b.map((S) => S.value),
|
|
61
|
+
clears: f.map((S) => S.key)
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
return c;
|
|
65
|
+
}
|
|
66
|
+
function Ct(n, e) {
|
|
67
|
+
return n.filter((s) => !re(e[s.key])).length;
|
|
68
|
+
}
|
|
69
|
+
const Me = /* @__PURE__ */ new WeakMap();
|
|
70
|
+
function St(n, e, s, p) {
|
|
71
|
+
let a = Me.get(n);
|
|
72
|
+
a || Me.set(n, a = /* @__PURE__ */ new Map());
|
|
73
|
+
const c = `${s}\0${p}`, d = a.get(c);
|
|
74
|
+
if (d && d.id !== e)
|
|
75
|
+
throw new Error(
|
|
76
|
+
`useCollection("${e}"): the URL state key "${p}" is already used by the list "${d.id}" on this page. Two lists on one page each need their own \`state: { kind: "url", key }\`, or they overwrite each other's state.`
|
|
77
|
+
);
|
|
78
|
+
const f = d ?? { id: e, count: 0 };
|
|
79
|
+
return f.count++, a.set(c, f), () => {
|
|
80
|
+
--f.count <= 0 && a.delete(c);
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
const Oe = (n) => n.status === "loaded" || n.status === "refreshing" || n.status === "stale", Be = (n) => n instanceof Error && n.message !== "" ? n.message : String(n);
|
|
84
|
+
function Uo(n, e) {
|
|
85
|
+
const s = `useCollection("${n.id}")`, p = e.state;
|
|
86
|
+
let a = null, c = "", d = "", f = () => {
|
|
87
|
+
};
|
|
88
|
+
if (p.kind === "url") {
|
|
89
|
+
if (a = lt() ? ot(ct, null) : null, !a) throw new Error(`${s}: 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" }\`.`);
|
|
90
|
+
if (!p.key) throw new Error(`${s}: \`state.key\` must not be empty.`);
|
|
91
|
+
d = p.key, c = a.currentRoute.value.path, f = St(a, n.id, c, d);
|
|
92
|
+
}
|
|
93
|
+
const b = e.defaults ? dt({
|
|
94
|
+
...n,
|
|
95
|
+
query: { ...n.contract, sorts: n.contract.sorts ?? void 0, filters: n.contract.filters ?? void 0, views: n.contract.views ?? void 0 },
|
|
96
|
+
defaults: { ...n.defaults, ...e.defaults }
|
|
97
|
+
}).defaults : n.defaults, S = { search: e.defaults?.search ?? "", filters: e.defaults?.filters ?? {} }, N = e.defaults ? b : void 0, R = (() => {
|
|
98
|
+
if (!a) return b;
|
|
99
|
+
const o = a.currentRoute.value.query[d];
|
|
100
|
+
return Te(n, Array.isArray(o) ? o[0] : o, N) ?? b;
|
|
101
|
+
})(), w = xe(R), $ = xe({ status: "loading" }), P = xe(null), j = xe(null), H = _(() => Oe($.value) ? $.value.value : j.value);
|
|
102
|
+
let A = !1, T = null, Q = 0, M = !1;
|
|
103
|
+
const Y = [];
|
|
104
|
+
a && e.linked && de(a.currentRoute.value.query, e.linked);
|
|
105
|
+
function de(o, v) {
|
|
106
|
+
let L = w.value;
|
|
107
|
+
const K = (X) => {
|
|
108
|
+
const E = o[X], ae = Array.isArray(E) ? E[0] : E;
|
|
109
|
+
return typeof ae == "string" && ae !== "" ? ae : null;
|
|
110
|
+
};
|
|
111
|
+
if (v.view) {
|
|
112
|
+
const X = K(v.view), E = X !== null && (n.contract.views ? n.contract.views.includes(X) : !0);
|
|
113
|
+
X !== null && E && (L = { ...L, view: X, page: 1 }, Y.push(v.view));
|
|
114
|
+
}
|
|
115
|
+
for (const [X, E] of Object.entries(v.params ?? {})) {
|
|
116
|
+
const ae = K(X);
|
|
117
|
+
if (ae === null) continue;
|
|
118
|
+
const U = typeof E == "string" ? E : E.filter, D = typeof E == "string" ? ae : E.value(ae), Z = { ...L.filters };
|
|
119
|
+
D === null || D === "any" || D === "" ? delete Z[U] : Z[U] = String(D), L = { ...L, filters: Z, page: 1 }, Y.push(X);
|
|
120
|
+
}
|
|
121
|
+
if (Y.length > 0) {
|
|
122
|
+
for (const X of v.consume ?? []) X in o && Y.push(X);
|
|
123
|
+
w.value = L;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
async function oe(o) {
|
|
127
|
+
if (A) return;
|
|
128
|
+
T?.abort();
|
|
129
|
+
const v = ++Q, L = T = new AbortController(), K = $.value, X = w.value;
|
|
130
|
+
$.value = o && Oe(K) ? { status: "refreshing", value: K.value } : { status: "loading" };
|
|
131
|
+
try {
|
|
132
|
+
const E = await n.load(X, { signal: L.signal });
|
|
133
|
+
if (v !== Q) return;
|
|
134
|
+
if (E.lastPage >= 1 && X.page > E.lastPage) {
|
|
135
|
+
w.value = { ...X, page: E.lastPage }, te(), oe(!1);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
P.value = null, j.value = E, $.value = { status: "loaded", value: E };
|
|
139
|
+
} catch (E) {
|
|
140
|
+
if (v !== Q || L.signal.aborted || Re(E)) return;
|
|
141
|
+
P.value = E, $.value = o && Oe(K) ? { status: "stale", value: K.value, error: Be(E) } : { status: "failed", error: Be(E) };
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
function C() {
|
|
145
|
+
te(), !(M || A) && (M = !0, queueMicrotask(() => {
|
|
146
|
+
M && (M = !1, oe(!1));
|
|
147
|
+
}));
|
|
148
|
+
}
|
|
149
|
+
function B() {
|
|
150
|
+
return M = !1, oe(!0);
|
|
151
|
+
}
|
|
152
|
+
let V = !1, J = !1, ne = !1;
|
|
153
|
+
function te() {
|
|
154
|
+
!a || V || A || (V = !0, queueMicrotask(() => {
|
|
155
|
+
V = !1, se();
|
|
156
|
+
}));
|
|
157
|
+
}
|
|
158
|
+
async function se() {
|
|
159
|
+
if (a) {
|
|
160
|
+
if (J) {
|
|
161
|
+
ne = !0;
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
J = !0;
|
|
165
|
+
try {
|
|
166
|
+
do {
|
|
167
|
+
ne = !1;
|
|
168
|
+
const o = a.currentRoute.value;
|
|
169
|
+
if (A || o.path !== c) return;
|
|
170
|
+
const v = je(n, w.value, N), L = { ...o.query };
|
|
171
|
+
for (const K of Y.splice(0)) delete L[K];
|
|
172
|
+
o.query[d] === v && Object.keys(L).length === Object.keys(o.query).length || await a.replace({ query: { ...L, [d]: v }, hash: o.hash });
|
|
173
|
+
} while (ne);
|
|
174
|
+
} catch {
|
|
175
|
+
} finally {
|
|
176
|
+
J = !1;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
const h = a ? Le(
|
|
181
|
+
() => a.currentRoute.value.query[d],
|
|
182
|
+
(o) => {
|
|
183
|
+
const v = a.currentRoute.value;
|
|
184
|
+
if (A || J || v.path !== c) return;
|
|
185
|
+
const L = Array.isArray(o) ? o[0] : o, K = Te(n, L, N) ?? b;
|
|
186
|
+
JSON.stringify(K) !== JSON.stringify(w.value) ? (w.value = K, C()) : te();
|
|
187
|
+
}
|
|
188
|
+
) : () => {
|
|
189
|
+
}, x = (o, v = !1) => {
|
|
190
|
+
w.value = { ...w.value, ...o, ...v ? { page: 1 } : {} }, C();
|
|
191
|
+
}, z = (o) => {
|
|
192
|
+
const v = { ...w.value.filters };
|
|
193
|
+
for (const [L, K] of Object.entries(o))
|
|
194
|
+
K == null || re(K) ? delete v[L] : v[L] = String(K);
|
|
195
|
+
return v;
|
|
196
|
+
}, pe = _(
|
|
197
|
+
() => w.value.search !== "" && w.value.search !== S.search || Object.entries(w.value.filters).some(([o, v]) => !re(v) && v !== S.filters[o])
|
|
198
|
+
), me = _(() => Object.keys(S.filters).filter((o) => !re(S.filters[o]) && w.value.filters[o] === S.filters[o])), ye = _(() => H.value?.rows ?? []), $e = _(() => {
|
|
199
|
+
const o = $.value;
|
|
200
|
+
return o.status === "loading" ? "loading" : o.status === "failed" ? "failed" : o.value.rows.length > 0 ? "rows" : pe.value ? "no-matches" : "empty";
|
|
201
|
+
}), Ce = _(() => {
|
|
202
|
+
const o = new Map((H.value?.views ?? []).map((v) => [v.key, v.count]));
|
|
203
|
+
return (Se(e.views) ?? []).map((v) => o.has(v.key) ? { ...v, count: o.get(v.key) } : v);
|
|
204
|
+
});
|
|
205
|
+
let _e = () => {
|
|
206
|
+
};
|
|
207
|
+
const i = e.savedViews ? l(e.savedViews) : null;
|
|
208
|
+
function m(o) {
|
|
209
|
+
const v = { v: o.state.version, f: o.state.filters, s: o.state.search, w: o.state.view ?? void 0 };
|
|
210
|
+
return vt(n, v, N);
|
|
211
|
+
}
|
|
212
|
+
function l(o) {
|
|
213
|
+
const v = ie([]), L = ie("idle");
|
|
214
|
+
let K = null;
|
|
215
|
+
const X = (U, D) => U.name.localeCompare(D.name), E = _(() => v.value.filter((U) => m(U) !== null));
|
|
216
|
+
_e = () => {
|
|
217
|
+
K?.abort(), v.value = [], L.value = "idle";
|
|
218
|
+
};
|
|
219
|
+
const ae = () => ({
|
|
220
|
+
version: n.stateVersion,
|
|
221
|
+
filters: Object.fromEntries(Object.entries(w.value.filters).filter(([U, D]) => D !== void 0 && !n.contract.sensitive.includes(U))),
|
|
222
|
+
search: w.value.search,
|
|
223
|
+
view: w.value.view
|
|
224
|
+
});
|
|
225
|
+
return {
|
|
226
|
+
items: E,
|
|
227
|
+
status: L,
|
|
228
|
+
async load() {
|
|
229
|
+
K?.abort();
|
|
230
|
+
const U = K = new AbortController();
|
|
231
|
+
L.value = "loading";
|
|
232
|
+
try {
|
|
233
|
+
const D = await o.list(n.id, { signal: U.signal });
|
|
234
|
+
if (U.signal.aborted) return;
|
|
235
|
+
v.value = [...D].sort(X), L.value = "ready";
|
|
236
|
+
} catch (D) {
|
|
237
|
+
if (U.signal.aborted || Re(D)) return;
|
|
238
|
+
L.value = "failed";
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
current: ae,
|
|
242
|
+
async save(U, D) {
|
|
243
|
+
const Z = await o.save(n.id, U, { ...ae(), ...D });
|
|
244
|
+
return v.value = [...v.value.filter((tt) => tt.id !== Z.id), Z].sort(X), Z;
|
|
245
|
+
},
|
|
246
|
+
apply(U) {
|
|
247
|
+
const D = m(U);
|
|
248
|
+
D && x({ filters: D.filters, search: D.search, view: U.state.view ? D.view : w.value.view }, !0);
|
|
249
|
+
},
|
|
250
|
+
stageRemoval(U) {
|
|
251
|
+
const D = v.value.find((Z) => Z.id === U) ?? null;
|
|
252
|
+
return v.value = v.value.filter((Z) => Z.id !== U), {
|
|
253
|
+
revert() {
|
|
254
|
+
D && !v.value.some((Z) => Z.id === U) && (v.value = [...v.value, D].sort(X));
|
|
255
|
+
},
|
|
256
|
+
// Saved again under the same name while the toast was up: the server replaced that very row, it must not be deleted now.
|
|
257
|
+
async commit() {
|
|
258
|
+
v.value.some((Z) => Z.id === U) || await o.remove(n.id, U);
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
function k() {
|
|
265
|
+
A || (A = !0, T?.abort(), Q++, h(), f());
|
|
266
|
+
}
|
|
267
|
+
return nt() && st(k), ft((o) => {
|
|
268
|
+
T?.abort(), Q++, $.value = { status: "loading" }, j.value = null, P.value = null, _e(), o !== null && C();
|
|
269
|
+
}), C(), {
|
|
270
|
+
id: n.id,
|
|
271
|
+
pageSizes: n.contract.pageSizes,
|
|
272
|
+
searchable: n.contract.search,
|
|
273
|
+
rowKey: (o) => n.key(o),
|
|
274
|
+
state: $,
|
|
275
|
+
query: w,
|
|
276
|
+
page: H,
|
|
277
|
+
rows: ye,
|
|
278
|
+
total: _(() => H.value?.total ?? 0),
|
|
279
|
+
display: $e,
|
|
280
|
+
isFiltered: pe,
|
|
281
|
+
startFilters: me,
|
|
282
|
+
error: P,
|
|
283
|
+
columns: _(() => {
|
|
284
|
+
const o = Se(e.columns) ?? [], v = n.contract.sorts;
|
|
285
|
+
if (v) {
|
|
286
|
+
for (const L of o) if (L.sort !== void 0 && !v.includes(L.sort)) throw new Error(`${s}: column "${L.key}" sorts by "${L.sort}", which is not in the query contract's sorts (${v.join(", ")}).`);
|
|
287
|
+
}
|
|
288
|
+
return o;
|
|
289
|
+
}),
|
|
290
|
+
filters: _(() => Se(e.filters) ?? []),
|
|
291
|
+
views: Ce,
|
|
292
|
+
savedViews: i,
|
|
293
|
+
refresh: B,
|
|
294
|
+
goToPage: (o) => {
|
|
295
|
+
Number.isInteger(o) && o >= 1 && o !== w.value.page && x({ page: o });
|
|
296
|
+
},
|
|
297
|
+
nextPage: () => {
|
|
298
|
+
const o = H.value?.lastPage ?? 0;
|
|
299
|
+
w.value.page < o && x({ page: w.value.page + 1 });
|
|
300
|
+
},
|
|
301
|
+
previousPage: () => {
|
|
302
|
+
w.value.page > 1 && x({ page: w.value.page - 1 });
|
|
303
|
+
},
|
|
304
|
+
setPageSize: (o) => {
|
|
305
|
+
n.contract.pageSizes.includes(o) && o !== w.value.pageSize && x({ pageSize: o }, !0);
|
|
306
|
+
},
|
|
307
|
+
sortBy: (o, v = "asc") => {
|
|
308
|
+
if (n.contract.sorts && !n.contract.sorts.includes(o)) throw new Error(`${s}: "${o}" is not in the query contract's sorts.`);
|
|
309
|
+
x({ sort: o, direction: v });
|
|
310
|
+
},
|
|
311
|
+
toggleSort: (o) => {
|
|
312
|
+
const v = w.value;
|
|
313
|
+
x({ sort: o, direction: v.sort === o && v.direction === "asc" ? "desc" : "asc" });
|
|
314
|
+
},
|
|
315
|
+
search: (o) => x({ search: o }, !0),
|
|
316
|
+
setFilter: (o, v) => x({ filters: z({ [o]: v }) }, !0),
|
|
317
|
+
setFilters: (o) => x({ filters: z(o) }, !0),
|
|
318
|
+
clearFilters: () => x({ filters: {}, search: "" }, !0),
|
|
319
|
+
clearStart: () => {
|
|
320
|
+
me.value.length > 0 && x({ filters: z(Object.fromEntries(me.value.map((o) => [o, null]))) }, !0);
|
|
321
|
+
},
|
|
322
|
+
setView: (o) => x({ view: o }, !0),
|
|
323
|
+
reset: () => {
|
|
324
|
+
w.value = b, C();
|
|
325
|
+
},
|
|
326
|
+
recordLocation: (o) => {
|
|
327
|
+
const v = e.recordRoute?.(o);
|
|
328
|
+
return v ? a ? pt(v, { [Ne]: je(n, w.value, N) }) : v : null;
|
|
329
|
+
},
|
|
330
|
+
linkContext: () => a ? { [Ne]: je(n, w.value, N) } : {}
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
const jt = {
|
|
334
|
+
class: "mx-auto max-w-xl py-8 text-center",
|
|
335
|
+
"data-test": "collection-empty-filtered"
|
|
336
|
+
}, Ot = { class: "mt-3 mb-1 text-headline font-semibold text-content-strong" }, zt = { class: "text-sm text-content-muted" }, Vt = { class: "mt-4 flex flex-wrap justify-center gap-2" }, Lt = {
|
|
337
|
+
key: 0,
|
|
338
|
+
class: "shrink-0 text-content-muted"
|
|
339
|
+
}, Ft = ["title"], Pt = ["aria-label", "onClick"], qt = { class: "mt-5 flex flex-wrap justify-center gap-2" }, Rt = /* @__PURE__ */ be({
|
|
340
|
+
__name: "CollectionEmptyResult",
|
|
341
|
+
props: {
|
|
342
|
+
chips: {},
|
|
343
|
+
lastChip: {}
|
|
344
|
+
},
|
|
345
|
+
emits: ["remove", "clearAll"],
|
|
346
|
+
setup(n, { emit: e }) {
|
|
347
|
+
const s = n, p = e, { t: a } = he();
|
|
348
|
+
return (c, d) => (u(), y("div", jt, [
|
|
349
|
+
O(t(I), {
|
|
350
|
+
name: "filter3",
|
|
351
|
+
size: 32,
|
|
352
|
+
class: "mx-auto text-content-disabled"
|
|
353
|
+
}),
|
|
354
|
+
r("h3", Ot, g(t(a)("core.collection.empty.title")), 1),
|
|
355
|
+
r("p", zt, g(t(a)("core.collection.empty.description")), 1),
|
|
356
|
+
r("ul", Vt, [
|
|
357
|
+
(u(!0), y(ee, null, le(s.chips, (f) => (u(), y("li", {
|
|
358
|
+
key: f.key,
|
|
359
|
+
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"
|
|
360
|
+
}, [
|
|
361
|
+
f.label ? (u(), y("span", Lt, g(f.label), 1)) : F("", !0),
|
|
362
|
+
r("span", {
|
|
363
|
+
class: "min-w-0 truncate font-medium text-content-strong",
|
|
364
|
+
title: f.values.join(" › ")
|
|
365
|
+
}, g(f.values.join(" › ")), 9, Ft),
|
|
366
|
+
r("button", {
|
|
367
|
+
type: "button",
|
|
368
|
+
class: "shrink-0 cursor-pointer rounded p-1 text-content-disabled hover:bg-fill hover:text-content-strong",
|
|
369
|
+
"aria-label": `${t(a)("core.collection.clear")}: ${f.label ?? f.values.join(" › ")}`,
|
|
370
|
+
onClick: (b) => p("remove", f)
|
|
371
|
+
}, [
|
|
372
|
+
O(t(I), {
|
|
373
|
+
name: "close",
|
|
374
|
+
size: 12
|
|
375
|
+
})
|
|
376
|
+
], 8, Pt)
|
|
377
|
+
]))), 128))
|
|
378
|
+
]),
|
|
379
|
+
r("div", qt, [
|
|
380
|
+
s.lastChip ? (u(), W(ce, ve({ key: 0 }, { "data-test": "collection-empty-remove-last" }, {
|
|
381
|
+
prominence: "secondary",
|
|
382
|
+
size: "sm",
|
|
383
|
+
onClick: d[0] || (d[0] = (f) => p("remove", s.lastChip))
|
|
384
|
+
}), {
|
|
385
|
+
default: q(() => [
|
|
386
|
+
G(g(t(a)("core.collection.empty.remove_last", { filter: s.lastChip.values.join(" › ") })), 1)
|
|
387
|
+
]),
|
|
388
|
+
_: 1
|
|
389
|
+
}, 16)) : F("", !0),
|
|
390
|
+
O(ce, ve({ "data-test": "collection-empty-clear-all" }, {
|
|
391
|
+
size: "sm",
|
|
392
|
+
onClick: d[1] || (d[1] = (f) => p("clearAll"))
|
|
393
|
+
}), {
|
|
394
|
+
default: q(() => [
|
|
395
|
+
G(g(t(a)("core.collection.empty.clear_all")), 1)
|
|
396
|
+
]),
|
|
397
|
+
_: 1
|
|
398
|
+
}, 16)
|
|
399
|
+
])
|
|
400
|
+
]));
|
|
401
|
+
}
|
|
402
|
+
}), Tt = ["aria-label"], Nt = ["disabled"], At = { class: "sr-only" }, Et = {
|
|
403
|
+
class: "text-subheadline tabular-nums text-content-muted",
|
|
404
|
+
"aria-live": "polite"
|
|
405
|
+
}, Ut = ["disabled"], Mt = { class: "sr-only" }, Bt = {
|
|
406
|
+
key: 1,
|
|
407
|
+
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"
|
|
408
|
+
}, Dt = { class: "flex flex-col items-center gap-x-4 text-footnote tabular-nums text-content-muted md:flex-row" }, It = {
|
|
409
|
+
key: 0,
|
|
410
|
+
"aria-live": "polite"
|
|
411
|
+
}, Ht = { class: "flex items-center" }, Kt = { class: "mr-2" }, Wt = ["value"], Qt = ["value"], Xt = ["aria-label"], Jt = ["disabled"], Gt = { class: "sr-only" }, Yt = {
|
|
412
|
+
key: 0,
|
|
413
|
+
class: "px-1.5 text-content-disabled"
|
|
414
|
+
}, Zt = ["aria-current", "onClick"], el = ["disabled"], tl = { class: "sr-only" }, ll = /* @__PURE__ */ be({
|
|
415
|
+
__name: "CollectionPager",
|
|
416
|
+
props: {
|
|
417
|
+
collection: {},
|
|
418
|
+
compact: { type: Boolean },
|
|
419
|
+
flat: { type: Boolean }
|
|
420
|
+
},
|
|
421
|
+
emits: ["turned"],
|
|
422
|
+
setup(n, { emit: e }) {
|
|
423
|
+
const s = n, p = e, { t: a } = he(), c = qe(), d = _(() => s.collection.query.value.page), f = _(() => s.collection.page.value?.lastPage ?? 0), b = _(() => s.collection.page.value), S = _(() => {
|
|
424
|
+
if (f.value <= 1) return f.value === 1 ? [1] : [];
|
|
425
|
+
const $ = [1], P = Math.max(2, d.value - 2), j = Math.min(f.value - 1, d.value + 2);
|
|
426
|
+
P > 2 && $.push(null);
|
|
427
|
+
for (let H = P; H <= j; H++) $.push(H);
|
|
428
|
+
return j < f.value - 1 && $.push(null), $.push(f.value), $;
|
|
429
|
+
});
|
|
430
|
+
function N($) {
|
|
431
|
+
$ === 1 ? s.collection.nextPage() : s.collection.previousPage(), p("turned");
|
|
432
|
+
}
|
|
433
|
+
const R = ($) => [
|
|
434
|
+
"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",
|
|
435
|
+
$ ? "bg-tint font-semibold text-content-on-tint" : "text-content-strong hover:bg-fill disabled:hover:bg-transparent"
|
|
436
|
+
].join(" ");
|
|
437
|
+
function w($) {
|
|
438
|
+
s.collection.setPageSize(Number($.target.value));
|
|
439
|
+
}
|
|
440
|
+
return ($, P) => s.compact && f.value > 1 ? (u(), y("nav", {
|
|
441
|
+
key: 0,
|
|
442
|
+
"aria-label": t(a)("core.collection.page.label"),
|
|
443
|
+
class: ue(["flex select-none items-center justify-between gap-3 px-1 py-2", s.flat ? "mt-1" : "border-t border-border-separator"]),
|
|
444
|
+
"data-test": "collection-pager-compact"
|
|
445
|
+
}, [
|
|
446
|
+
r("button", {
|
|
447
|
+
type: "button",
|
|
448
|
+
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",
|
|
449
|
+
disabled: d.value <= 1,
|
|
450
|
+
onClick: P[0] || (P[0] = (j) => N(-1))
|
|
451
|
+
}, [
|
|
452
|
+
O(t(I), {
|
|
453
|
+
name: "arrowLeftSLine",
|
|
454
|
+
size: 20
|
|
455
|
+
}),
|
|
456
|
+
r("span", At, g(t(a)("core.collection.page.previous")), 1)
|
|
457
|
+
], 8, Nt),
|
|
458
|
+
r("span", Et, g(t(a)("core.collection.page.page_of", { current: t(c).number(d.value), total: t(c).number(f.value) })), 1),
|
|
459
|
+
r("button", {
|
|
460
|
+
type: "button",
|
|
461
|
+
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",
|
|
462
|
+
disabled: d.value >= f.value,
|
|
463
|
+
onClick: P[1] || (P[1] = (j) => N(1))
|
|
464
|
+
}, [
|
|
465
|
+
O(t(I), {
|
|
466
|
+
name: "arrowRightSLine",
|
|
467
|
+
size: 20
|
|
468
|
+
}),
|
|
469
|
+
r("span", Mt, g(t(a)("core.collection.page.next")), 1)
|
|
470
|
+
], 8, Ut)
|
|
471
|
+
], 10, Tt)) : s.compact ? F("", !0) : (u(), y("div", Bt, [
|
|
472
|
+
r("div", Dt, [
|
|
473
|
+
b.value ? (u(), y("span", It, g(t(a)("core.collection.page.total", { from: t(c).number(b.value.from), to: t(c).number(b.value.to), total: t(c).number(b.value.total) })), 1)) : F("", !0),
|
|
474
|
+
r("label", Ht, [
|
|
475
|
+
r("span", Kt, g(t(a)("core.collection.page.per_page")) + ":", 1),
|
|
476
|
+
r("select", {
|
|
477
|
+
value: s.collection.query.value.pageSize,
|
|
478
|
+
class: "cursor-pointer rounded-control bg-transparent py-0.5 pr-1 font-semibold text-content-strong hover:bg-fill",
|
|
479
|
+
onChange: w
|
|
480
|
+
}, [
|
|
481
|
+
(u(!0), y(ee, null, le(s.collection.pageSizes, (j) => (u(), y("option", {
|
|
482
|
+
key: j,
|
|
483
|
+
value: j
|
|
484
|
+
}, g(j), 9, Qt))), 128))
|
|
485
|
+
], 40, Wt)
|
|
486
|
+
])
|
|
487
|
+
]),
|
|
488
|
+
r("nav", {
|
|
489
|
+
"aria-label": t(a)("core.collection.page.label"),
|
|
490
|
+
class: "flex items-center gap-0.5 text-subheadline tabular-nums"
|
|
491
|
+
}, [
|
|
492
|
+
r("button", {
|
|
493
|
+
type: "button",
|
|
494
|
+
class: ue(R(!1)),
|
|
495
|
+
disabled: d.value <= 1,
|
|
496
|
+
onClick: P[2] || (P[2] = (j) => N(-1))
|
|
497
|
+
}, [
|
|
498
|
+
O(t(I), {
|
|
499
|
+
name: "arrowLeftSLine",
|
|
500
|
+
size: 16
|
|
501
|
+
}),
|
|
502
|
+
r("span", Gt, g(t(a)("core.collection.page.previous")), 1)
|
|
503
|
+
], 10, Jt),
|
|
504
|
+
(u(!0), y(ee, null, le(S.value, (j, H) => (u(), y(ee, { key: H }, [
|
|
505
|
+
j === null ? (u(), y("span", Yt, "…")) : (u(), y("button", {
|
|
506
|
+
key: 1,
|
|
507
|
+
type: "button",
|
|
508
|
+
class: ue(R(j === d.value)),
|
|
509
|
+
"aria-current": j === d.value ? "page" : void 0,
|
|
510
|
+
onClick: (A) => s.collection.goToPage(j)
|
|
511
|
+
}, g(t(c).number(j)), 11, Zt))
|
|
512
|
+
], 64))), 128)),
|
|
513
|
+
r("button", {
|
|
514
|
+
type: "button",
|
|
515
|
+
class: ue(R(!1)),
|
|
516
|
+
disabled: d.value >= f.value,
|
|
517
|
+
onClick: P[3] || (P[3] = (j) => N(1))
|
|
518
|
+
}, [
|
|
519
|
+
O(t(I), {
|
|
520
|
+
name: "arrowRightSLine",
|
|
521
|
+
size: 16
|
|
522
|
+
}),
|
|
523
|
+
r("span", tl, g(t(a)("core.collection.page.next")), 1)
|
|
524
|
+
], 10, el)
|
|
525
|
+
], 8, Xt)
|
|
526
|
+
]));
|
|
527
|
+
}
|
|
528
|
+
}), ol = ["onClick"], nl = { class: "max-w-56 truncate" }, sl = { class: "flex flex-col gap-1.5 text-footnote font-medium text-content-muted" }, al = ["placeholder"], rl = { class: "flex items-center justify-between gap-2" }, il = {
|
|
529
|
+
type: "submit",
|
|
530
|
+
class: "cursor-pointer rounded-control bg-tint px-3 py-1.5 text-footnote font-semibold text-content-on-tint"
|
|
531
|
+
}, cl = ["onClick"], ul = { class: "max-w-56 truncate" }, De = "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", dl = /* @__PURE__ */ be({
|
|
532
|
+
__name: "CollectionFilterMenu",
|
|
533
|
+
props: {
|
|
534
|
+
filter: {},
|
|
535
|
+
value: {}
|
|
536
|
+
},
|
|
537
|
+
emits: ["update"],
|
|
538
|
+
setup(n, { emit: e }) {
|
|
539
|
+
const s = n, p = e, { t: a } = he(), c = _(() => re(s.value) ? null : String(s.value)), d = _(() => s.filter.options?.find((A) => String(A.value) === c.value) ?? null), f = _(() => [
|
|
540
|
+
...s.filter.withoutDefaultOption ? [] : [{ id: "__all", label: s.filter.defaultOptionTitle ?? a("core.collection.filters.show_all"), checked: c.value === null, onSelect: () => p("update", null) }],
|
|
541
|
+
...(s.filter.options ?? []).map((T) => ({
|
|
542
|
+
id: `option-${String(T.value)}`,
|
|
543
|
+
label: T.label,
|
|
544
|
+
icon: T.icon,
|
|
545
|
+
dot: T.dot,
|
|
546
|
+
checked: c.value === String(T.value),
|
|
547
|
+
onSelect: () => p("update", String(T.value))
|
|
548
|
+
}))
|
|
549
|
+
]), b = _(() => s.filter.type === "text" && c.value ? `${s.filter.label}: ${c.value}` : d.value?.label ?? s.filter.label), S = _(() => c.value !== null), N = _(
|
|
550
|
+
() => S.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"
|
|
551
|
+
), R = ie(""), w = fe("popover");
|
|
552
|
+
Le(c, (A) => R.value = A ?? "", { immediate: !0 });
|
|
553
|
+
function $() {
|
|
554
|
+
const A = R.value.trim();
|
|
555
|
+
p("update", A === "" ? null : A), w.value?.dismiss();
|
|
556
|
+
}
|
|
557
|
+
function P() {
|
|
558
|
+
R.value = "", p("update", null), w.value?.dismiss();
|
|
559
|
+
}
|
|
560
|
+
const j = fe("field");
|
|
561
|
+
async function H() {
|
|
562
|
+
await at(), j.value?.focus();
|
|
563
|
+
}
|
|
564
|
+
return (A, T) => s.filter.type === "text" ? (u(), W(t(Ze), {
|
|
565
|
+
key: 0,
|
|
566
|
+
ref_key: "popover",
|
|
567
|
+
ref: w,
|
|
568
|
+
label: s.filter.label,
|
|
569
|
+
width: "md",
|
|
570
|
+
placement: "bottom-start",
|
|
571
|
+
onPresented: H
|
|
572
|
+
}, {
|
|
573
|
+
trigger: q(({ toggle: Q, attrs: M }) => [
|
|
574
|
+
r("button", ve(M, {
|
|
575
|
+
type: "button",
|
|
576
|
+
class: [De, N.value],
|
|
577
|
+
onClick: Q
|
|
578
|
+
}), [
|
|
579
|
+
s.filter.icon ? (u(), W(t(I), {
|
|
580
|
+
key: 0,
|
|
581
|
+
name: s.filter.icon,
|
|
582
|
+
size: 16
|
|
583
|
+
}, null, 8, ["name"])) : F("", !0),
|
|
584
|
+
r("span", nl, g(b.value), 1),
|
|
585
|
+
O(t(I), {
|
|
586
|
+
name: "arrowDownSLine",
|
|
587
|
+
size: 16,
|
|
588
|
+
class: "text-content-muted"
|
|
589
|
+
})
|
|
590
|
+
], 16, ol)
|
|
591
|
+
]),
|
|
592
|
+
default: q(() => [
|
|
593
|
+
r("form", {
|
|
594
|
+
class: "flex flex-col gap-3",
|
|
595
|
+
onSubmit: We($, ["prevent"])
|
|
596
|
+
}, [
|
|
597
|
+
r("label", sl, [
|
|
598
|
+
G(g(s.filter.label) + " ", 1),
|
|
599
|
+
Fe(r("input", {
|
|
600
|
+
ref_key: "field",
|
|
601
|
+
ref: j,
|
|
602
|
+
"onUpdate:modelValue": T[0] || (T[0] = (Q) => R.value = Q),
|
|
603
|
+
type: "text",
|
|
604
|
+
autocomplete: "off",
|
|
605
|
+
placeholder: t(a)("core.collection.filters.type_to_filter"),
|
|
606
|
+
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"
|
|
607
|
+
}, null, 8, al), [
|
|
608
|
+
[Pe, R.value]
|
|
609
|
+
])
|
|
610
|
+
]),
|
|
611
|
+
r("div", rl, [
|
|
612
|
+
r("button", {
|
|
613
|
+
type: "button",
|
|
614
|
+
class: "cursor-pointer rounded-control px-2 py-1 text-footnote text-content-muted hover:text-content-strong",
|
|
615
|
+
onClick: P
|
|
616
|
+
}, g(t(a)("core.collection.filters.clear")), 1),
|
|
617
|
+
r("button", il, g(t(a)("core.collection.filters.apply")), 1)
|
|
618
|
+
])
|
|
619
|
+
], 32)
|
|
620
|
+
]),
|
|
621
|
+
_: 1
|
|
622
|
+
}, 8, ["label"])) : (u(), W(t(Ye), {
|
|
623
|
+
key: 1,
|
|
624
|
+
items: f.value,
|
|
625
|
+
label: s.filter.label,
|
|
626
|
+
placement: "bottom-start"
|
|
627
|
+
}, {
|
|
628
|
+
trigger: q(({ toggle: Q, attrs: M }) => [
|
|
629
|
+
r("button", ve(M, {
|
|
630
|
+
type: "button",
|
|
631
|
+
class: [De, N.value],
|
|
632
|
+
onClick: Q
|
|
633
|
+
}), [
|
|
634
|
+
s.filter.icon ? (u(), W(t(I), {
|
|
635
|
+
key: 0,
|
|
636
|
+
name: s.filter.icon,
|
|
637
|
+
size: 16
|
|
638
|
+
}, null, 8, ["name"])) : F("", !0),
|
|
639
|
+
d.value?.dot ? (u(), W(we, {
|
|
640
|
+
key: 1,
|
|
641
|
+
tone: d.value.dot
|
|
642
|
+
}, null, 8, ["tone"])) : F("", !0),
|
|
643
|
+
r("span", ul, g(b.value), 1),
|
|
644
|
+
O(t(I), {
|
|
645
|
+
name: "arrowDownSLine",
|
|
646
|
+
size: 16,
|
|
647
|
+
class: "text-content-muted"
|
|
648
|
+
})
|
|
649
|
+
], 16, cl)
|
|
650
|
+
]),
|
|
651
|
+
_: 1
|
|
652
|
+
}, 8, ["items", "label"]));
|
|
653
|
+
}
|
|
654
|
+
}), fl = {
|
|
655
|
+
key: 0,
|
|
656
|
+
"data-test": "filter-drilldown"
|
|
657
|
+
}, pl = { class: "mb-3 text-headline font-semibold" }, vl = ["aria-label"], ml = ["aria-selected", "onClick"], bl = { class: "flex min-w-0 items-center gap-2" }, gl = { class: "min-w-0 truncate" }, hl = {
|
|
658
|
+
key: 0,
|
|
659
|
+
class: "mb-5 border-b border-border-separator pb-5",
|
|
660
|
+
"data-test": "saved-filters"
|
|
661
|
+
}, yl = { class: "mb-2 text-footnote font-medium text-content-muted" }, _l = { class: "flex flex-wrap gap-2" }, xl = ["onClick"], kl = ["aria-label", "title", "onClick"], wl = { class: "space-y-5" }, $l = { key: 0 }, Cl = { class: "mb-1.5 text-footnote font-medium text-content-muted" }, Sl = ["aria-label"], jl = { class: "mb-1.5 text-footnote font-medium text-content-muted" }, Ol = {
|
|
662
|
+
key: 0,
|
|
663
|
+
class: "grid grid-cols-2 gap-3"
|
|
664
|
+
}, zl = ["aria-label"], Vl = { class: "mb-2 text-footnote font-medium text-content-muted" }, Ll = { class: "flex flex-wrap gap-2" }, Fl = ["aria-pressed", "onClick"], Pl = { class: "inline-flex items-center gap-2" }, ql = ["disabled", "onClick"], Rl = { class: "shrink-0 text-subheadline font-medium" }, Tl = { class: "truncate" }, Nl = { class: "flex items-center justify-between gap-2" }, Al = { class: "flex items-center gap-2" }, El = ["title"], Ul = { class: "sm:hidden" }, Ml = { class: "hidden sm:inline" }, Bl = { class: "flex flex-col gap-1.5 text-footnote font-medium text-content-muted" }, Dl = ["placeholder"], Il = {
|
|
665
|
+
key: 0,
|
|
666
|
+
class: "text-footnote text-status-warning-content",
|
|
667
|
+
"data-test": "saved-filter-replace-hint"
|
|
668
|
+
}, Hl = { class: "flex justify-end gap-2" }, Kl = 8, Wl = 18, Ie = 6e3, Ql = /* @__PURE__ */ be({
|
|
669
|
+
__name: "CollectionFilterPanel",
|
|
670
|
+
props: {
|
|
671
|
+
collection: {},
|
|
672
|
+
filters: {}
|
|
673
|
+
},
|
|
674
|
+
emits: ["touched"],
|
|
675
|
+
setup(n, { expose: e, emit: s }) {
|
|
676
|
+
const p = n, a = s, { t: c } = he(), d = fe("sheet"), f = _t("(max-width: 1023px), (pointer: coarse)"), b = ie({}), S = ie({}), N = ie(null), R = _(() => p.filters.find((i) => i.key === N.value) ?? null);
|
|
677
|
+
function w() {
|
|
678
|
+
const i = {}, m = {};
|
|
679
|
+
for (const l of p.filters) {
|
|
680
|
+
const k = p.collection.query.value.filters[l.key];
|
|
681
|
+
if (i[l.key] = re(k) ? null : String(k), l.type === "range") {
|
|
682
|
+
const [o, v] = et(i[l.key]);
|
|
683
|
+
m[l.key] = { min: o ?? "", max: v ?? "" };
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
b.value = i, S.value = m, N.value = null, d.value?.present();
|
|
687
|
+
}
|
|
688
|
+
function $(i, m) {
|
|
689
|
+
const l = re(m) ? null : String(m);
|
|
690
|
+
if (b.value[i] !== l) {
|
|
691
|
+
b.value = { ...b.value, [i]: l };
|
|
692
|
+
for (const k of p.filters.filter((o) => o.dependsOn === i)) $(k.key, null);
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
function P() {
|
|
696
|
+
for (const i of p.filters)
|
|
697
|
+
b.value[i.key] = null, i.type === "range" && (S.value[i.key] = { min: "", max: "" });
|
|
698
|
+
}
|
|
699
|
+
const j = (i) => i.replace(/[^\d.,-]/g, "").replace(",", "."), H = (i, m) => {
|
|
700
|
+
const l = S.value[i]?.[m] ?? "", k = l === "" ? Number.NaN : Number(j(l));
|
|
701
|
+
return Number.isNaN(k) ? null : k;
|
|
702
|
+
};
|
|
703
|
+
function A(i, m, l) {
|
|
704
|
+
const k = S.value[i];
|
|
705
|
+
k && (k[m] = l === null ? "" : String(l));
|
|
706
|
+
}
|
|
707
|
+
function T() {
|
|
708
|
+
const i = {};
|
|
709
|
+
for (const m of p.filters) {
|
|
710
|
+
const l = S.value[m.key];
|
|
711
|
+
i[m.key] = m.type === "range" ? kt(l ? j(l.min) : null, l ? j(l.max) : null) : b.value[m.key] ?? null;
|
|
712
|
+
}
|
|
713
|
+
return i;
|
|
714
|
+
}
|
|
715
|
+
function Q() {
|
|
716
|
+
const i = T(), m = Object.keys(i).filter((l) => (p.collection.query.value.filters[l] ?? null) !== i[l]);
|
|
717
|
+
a("touched", m), p.collection.setFilters(i), d.value?.dismiss();
|
|
718
|
+
}
|
|
719
|
+
const M = (i) => wt(i, i.dependsOn ? b.value[i.dependsOn] : null), Y = (i) => i.defaultOptionTitle ?? c("core.collection.filters.show_all");
|
|
720
|
+
function de(i) {
|
|
721
|
+
const m = b.value[i.key];
|
|
722
|
+
return m == null ? Y(i) : M(i).find((l) => l.value === m)?.label ?? m;
|
|
723
|
+
}
|
|
724
|
+
const oe = (i) => [{ value: null, label: Y(i) }, ...M(i)], C = (i) => {
|
|
725
|
+
const m = b.value[i.key];
|
|
726
|
+
return m == null ? void 0 : M(i).find((l) => l.value === m)?.dot;
|
|
727
|
+
}, B = (i) => [
|
|
728
|
+
{ value: "", label: Y(i) },
|
|
729
|
+
...M(i).map((m) => ({ value: String(m.value), label: m.label, dot: m.dot }))
|
|
730
|
+
], V = (i) => [
|
|
731
|
+
{ value: "", label: Y(i) },
|
|
732
|
+
...(i.options ?? []).map((m) => ({ value: String(m.value), label: m.label }))
|
|
733
|
+
];
|
|
734
|
+
function J(i) {
|
|
735
|
+
const m = M(i);
|
|
736
|
+
return !i.dependsOn && m.length > 0 && m.length <= Kl && m.every((l) => l.label.length <= Wl);
|
|
737
|
+
}
|
|
738
|
+
const ne = _(() => f.value && R.value !== null), te = _(() => p.collection.savedViews), se = ie(""), h = ie(!1), x = fe("savePopover");
|
|
739
|
+
function z() {
|
|
740
|
+
const i = new Set(p.filters.map((l) => l.key)), m = {};
|
|
741
|
+
for (const [l, k] of Object.entries(p.collection.query.value.filters))
|
|
742
|
+
!i.has(l) && k !== void 0 && k !== "" && (m[l] = String(k));
|
|
743
|
+
for (const [l, k] of Object.entries(T())) k !== null && (m[l] = k);
|
|
744
|
+
return { filters: m, search: p.collection.query.value.search };
|
|
745
|
+
}
|
|
746
|
+
const pe = _(() => {
|
|
747
|
+
const i = z();
|
|
748
|
+
return Object.keys(i.filters).length > 0 || i.search.trim() !== "";
|
|
749
|
+
}), me = _(() => {
|
|
750
|
+
const i = se.value.trim();
|
|
751
|
+
return i ? te.value?.items.value.find((m) => m.name === i) ?? null : null;
|
|
752
|
+
}), ye = (i, m) => ut(i) && i.message ? i.message : m;
|
|
753
|
+
async function $e() {
|
|
754
|
+
const i = se.value.trim(), m = te.value;
|
|
755
|
+
if (!(!m || !i || h.value || !pe.value)) {
|
|
756
|
+
h.value = !0;
|
|
757
|
+
try {
|
|
758
|
+
const l = await m.save(i, z());
|
|
759
|
+
se.value = "", x.value?.dismiss(), ke.success(c("core.collection.saved.saved_toast", { name: l.name })), m.apply(l), a("touched", []), d.value?.dismiss();
|
|
760
|
+
} catch (l) {
|
|
761
|
+
ke.error(ye(l, c("core.collection.saved.save_failed")));
|
|
762
|
+
} finally {
|
|
763
|
+
h.value = !1;
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
function Ce(i) {
|
|
768
|
+
te.value?.apply(i), a("touched", []), d.value?.dismiss();
|
|
769
|
+
}
|
|
770
|
+
function _e(i) {
|
|
771
|
+
const m = te.value;
|
|
772
|
+
if (!m) return;
|
|
773
|
+
const { revert: l, commit: k } = m.stageRemoval(i.id), o = setTimeout(() => {
|
|
774
|
+
k().catch((v) => {
|
|
775
|
+
l(), ke.error(ye(v, c("core.collection.saved.delete_failed")));
|
|
776
|
+
});
|
|
777
|
+
}, Ie);
|
|
778
|
+
ke.success(c("core.collection.saved.deleted_toast", { name: i.name }), {
|
|
779
|
+
duration: Ie,
|
|
780
|
+
action: {
|
|
781
|
+
label: c("core.collection.saved.undo"),
|
|
782
|
+
onClick: () => {
|
|
783
|
+
clearTimeout(o), l();
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
return e({ present: w }), (i, m) => (u(), W(t(xt), {
|
|
789
|
+
ref_key: "sheet",
|
|
790
|
+
ref: d,
|
|
791
|
+
title: t(c)("core.collection.filters.panel_title"),
|
|
792
|
+
grouped: ne.value
|
|
793
|
+
}, {
|
|
794
|
+
footer: q(() => [
|
|
795
|
+
r("div", Nl, [
|
|
796
|
+
O(ce, {
|
|
797
|
+
prominence: "standard",
|
|
798
|
+
class: "whitespace-nowrap",
|
|
799
|
+
onClick: P
|
|
800
|
+
}, {
|
|
801
|
+
default: q(() => [
|
|
802
|
+
G(g(t(c)("core.collection.filters.reset_all")), 1)
|
|
803
|
+
]),
|
|
804
|
+
_: 1
|
|
805
|
+
}),
|
|
806
|
+
r("div", Al, [
|
|
807
|
+
te.value ? (u(), W(t(Ze), {
|
|
808
|
+
key: 0,
|
|
809
|
+
ref_key: "savePopover",
|
|
810
|
+
ref: x,
|
|
811
|
+
placement: "top-end",
|
|
812
|
+
label: t(c)("core.collection.saved.save_button")
|
|
813
|
+
}, {
|
|
814
|
+
trigger: q(({ toggle: l, attrs: k }) => [
|
|
815
|
+
r("span", {
|
|
816
|
+
title: pe.value ? void 0 : t(c)("core.collection.saved.nothing_to_save")
|
|
817
|
+
}, [
|
|
818
|
+
O(ce, ve({ ...k, "data-test": "saved-filter-open" }, {
|
|
819
|
+
prominence: "standard",
|
|
820
|
+
icon: "save",
|
|
821
|
+
class: "whitespace-nowrap",
|
|
822
|
+
disabled: !pe.value,
|
|
823
|
+
onClick: l
|
|
824
|
+
}), {
|
|
825
|
+
default: q(() => [
|
|
826
|
+
r("span", Ul, g(t(c)("core.collection.saved.save")), 1),
|
|
827
|
+
r("span", Ml, g(t(c)("core.collection.saved.save_button")), 1)
|
|
828
|
+
]),
|
|
829
|
+
_: 1
|
|
830
|
+
}, 16, ["disabled", "onClick"])
|
|
831
|
+
], 8, El)
|
|
832
|
+
]),
|
|
833
|
+
default: q(() => [
|
|
834
|
+
r("form", {
|
|
835
|
+
class: "flex flex-col gap-3",
|
|
836
|
+
"data-test": "saved-filter-form",
|
|
837
|
+
onSubmit: We($e, ["prevent"])
|
|
838
|
+
}, [
|
|
839
|
+
r("label", Bl, [
|
|
840
|
+
G(g(t(c)("core.collection.saved.name_label")) + " ", 1),
|
|
841
|
+
Fe(r("input", {
|
|
842
|
+
"onUpdate:modelValue": m[1] || (m[1] = (l) => se.value = l),
|
|
843
|
+
type: "text",
|
|
844
|
+
maxlength: "60",
|
|
845
|
+
autocomplete: "off",
|
|
846
|
+
placeholder: t(c)("core.collection.saved.name_placeholder"),
|
|
847
|
+
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"
|
|
848
|
+
}, null, 8, Dl), [
|
|
849
|
+
[Pe, se.value]
|
|
850
|
+
])
|
|
851
|
+
]),
|
|
852
|
+
me.value ? (u(), y("p", Il, g(t(c)("core.collection.saved.replace_hint", { name: me.value.name })), 1)) : F("", !0),
|
|
853
|
+
r("div", Hl, [
|
|
854
|
+
O(ce, {
|
|
855
|
+
size: "sm",
|
|
856
|
+
onClick: m[2] || (m[2] = (l) => x.value?.dismiss())
|
|
857
|
+
}, {
|
|
858
|
+
default: q(() => [
|
|
859
|
+
G(g(t(c)("core.actions.cancel")), 1)
|
|
860
|
+
]),
|
|
861
|
+
_: 1
|
|
862
|
+
}),
|
|
863
|
+
O(ce, ve({ "data-test": "saved-filter-save" }, {
|
|
864
|
+
type: "submit",
|
|
865
|
+
prominence: "primary",
|
|
866
|
+
size: "sm",
|
|
867
|
+
processing: h.value,
|
|
868
|
+
disabled: !se.value.trim()
|
|
869
|
+
}), {
|
|
870
|
+
default: q(() => [
|
|
871
|
+
G(g(me.value ? t(c)("core.collection.saved.replace") : t(c)("core.collection.saved.save")), 1)
|
|
872
|
+
]),
|
|
873
|
+
_: 1
|
|
874
|
+
}, 16, ["processing", "disabled"])
|
|
875
|
+
])
|
|
876
|
+
], 32)
|
|
877
|
+
]),
|
|
878
|
+
_: 1
|
|
879
|
+
}, 8, ["label"])) : F("", !0),
|
|
880
|
+
O(ce, {
|
|
881
|
+
prominence: "primary",
|
|
882
|
+
icon: "filter3",
|
|
883
|
+
class: "whitespace-nowrap",
|
|
884
|
+
onClick: Q
|
|
885
|
+
}, {
|
|
886
|
+
default: q(() => [
|
|
887
|
+
G(g(t(c)("core.collection.filters.apply")), 1)
|
|
888
|
+
]),
|
|
889
|
+
_: 1
|
|
890
|
+
})
|
|
891
|
+
])
|
|
892
|
+
])
|
|
893
|
+
]),
|
|
894
|
+
default: q(() => [
|
|
895
|
+
t(f) && R.value ? (u(), y("div", fl, [
|
|
896
|
+
r("button", {
|
|
897
|
+
type: "button",
|
|
898
|
+
"data-test": "filter-drilldown-back",
|
|
899
|
+
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",
|
|
900
|
+
onClick: m[0] || (m[0] = (l) => N.value = null)
|
|
901
|
+
}, [
|
|
902
|
+
O(t(I), {
|
|
903
|
+
name: "arrowLeftSLine",
|
|
904
|
+
size: 20
|
|
905
|
+
}),
|
|
906
|
+
G(" " + g(t(c)("core.collection.filters.panel_title")), 1)
|
|
907
|
+
]),
|
|
908
|
+
r("p", pl, g(R.value.label), 1),
|
|
909
|
+
r("ul", {
|
|
910
|
+
class: "overflow-hidden rounded-group bg-surface-cell shadow-group",
|
|
911
|
+
role: "listbox",
|
|
912
|
+
"aria-label": R.value.label
|
|
913
|
+
}, [
|
|
914
|
+
(u(!0), y(ee, null, le(oe(R.value), (l) => (u(), y("li", {
|
|
915
|
+
key: String(l.value),
|
|
916
|
+
role: "presentation"
|
|
917
|
+
}, [
|
|
918
|
+
r("button", {
|
|
919
|
+
type: "button",
|
|
920
|
+
role: "option",
|
|
921
|
+
"aria-selected": (b.value[R.value.key] ?? null) === l.value,
|
|
922
|
+
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",
|
|
923
|
+
onClick: (k) => {
|
|
924
|
+
$(R.value.key, l.value), N.value = null;
|
|
925
|
+
}
|
|
926
|
+
}, [
|
|
927
|
+
r("span", bl, [
|
|
928
|
+
l.dot ? (u(), W(we, {
|
|
929
|
+
key: 0,
|
|
930
|
+
tone: l.dot
|
|
931
|
+
}, null, 8, ["tone"])) : F("", !0),
|
|
932
|
+
r("span", gl, g(l.label), 1)
|
|
933
|
+
]),
|
|
934
|
+
(b.value[R.value.key] ?? null) === l.value ? (u(), W(t(I), {
|
|
935
|
+
key: 0,
|
|
936
|
+
name: "checkboxCircleFill",
|
|
937
|
+
size: 18,
|
|
938
|
+
class: "shrink-0 text-content-link"
|
|
939
|
+
})) : F("", !0)
|
|
940
|
+
], 8, ml)
|
|
941
|
+
]))), 128))
|
|
942
|
+
], 8, vl)
|
|
943
|
+
])) : (u(), y(ee, { key: 1 }, [
|
|
944
|
+
te.value && te.value.items.value.length > 0 ? (u(), y("section", hl, [
|
|
945
|
+
r("p", yl, g(t(c)("core.collection.saved.title")), 1),
|
|
946
|
+
r("div", _l, [
|
|
947
|
+
(u(!0), y(ee, null, le(te.value.items.value, (l) => (u(), y("span", {
|
|
948
|
+
key: l.id,
|
|
949
|
+
class: "inline-flex h-8 items-center rounded-control bg-surface-cell text-subheadline shadow-group ring-1 ring-inset ring-border-separator"
|
|
950
|
+
}, [
|
|
951
|
+
r("button", {
|
|
952
|
+
type: "button",
|
|
953
|
+
"data-test": "saved-filter-apply",
|
|
954
|
+
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",
|
|
955
|
+
onClick: (k) => Ce(l)
|
|
956
|
+
}, [
|
|
957
|
+
O(t(I), {
|
|
958
|
+
name: "starFill",
|
|
959
|
+
size: 12,
|
|
960
|
+
class: "text-status-warning-content"
|
|
961
|
+
}),
|
|
962
|
+
G(" " + g(l.name), 1)
|
|
963
|
+
], 8, xl),
|
|
964
|
+
r("button", {
|
|
965
|
+
type: "button",
|
|
966
|
+
"data-test": "saved-filter-delete",
|
|
967
|
+
"aria-label": t(c)("core.collection.saved.delete", { name: l.name }),
|
|
968
|
+
title: t(c)("core.collection.saved.delete", { name: l.name }),
|
|
969
|
+
class: "h-full cursor-pointer rounded-r-control px-1.5 text-content-muted hover:bg-fill hover:text-content-destructive",
|
|
970
|
+
onClick: (k) => _e(l)
|
|
971
|
+
}, [
|
|
972
|
+
O(t(I), {
|
|
973
|
+
name: "close",
|
|
974
|
+
size: 12
|
|
975
|
+
})
|
|
976
|
+
], 8, kl)
|
|
977
|
+
]))), 128))
|
|
978
|
+
])
|
|
979
|
+
])) : F("", !0),
|
|
980
|
+
r("div", wl, [
|
|
981
|
+
(u(!0), y(ee, null, le(p.filters, (l) => (u(), y(ee, {
|
|
982
|
+
key: l.key
|
|
983
|
+
}, [
|
|
984
|
+
l.type === "segmented" ? (u(), y("div", $l, [
|
|
985
|
+
r("p", Cl, g(l.label), 1),
|
|
986
|
+
O(t(Ge), {
|
|
987
|
+
"model-value": b.value[l.key] ?? "",
|
|
988
|
+
tabs: V(l),
|
|
989
|
+
label: l.label,
|
|
990
|
+
stretch: "",
|
|
991
|
+
"onUpdate:modelValue": (k) => $(l.key, k === null ? null : String(k))
|
|
992
|
+
}, null, 8, ["model-value", "tabs", "label", "onUpdate:modelValue"])
|
|
993
|
+
])) : l.type === "range" ? (u(), y("div", {
|
|
994
|
+
key: 1,
|
|
995
|
+
role: "group",
|
|
996
|
+
"aria-label": l.label
|
|
997
|
+
}, [
|
|
998
|
+
r("p", jl, g(l.label), 1),
|
|
999
|
+
S.value[l.key] ? (u(), y("div", Ol, [
|
|
1000
|
+
(u(), y(ee, null, le(["min", "max"], (k) => O(ht, {
|
|
1001
|
+
key: k,
|
|
1002
|
+
"model-value": H(l.key, k),
|
|
1003
|
+
name: `${l.key}_${k}`,
|
|
1004
|
+
width: "full",
|
|
1005
|
+
decimals: l.decimals ?? 0,
|
|
1006
|
+
suffix: l.unit,
|
|
1007
|
+
label: t(c)(k === "min" ? "core.collection.filters.range_from" : "core.collection.filters.range_until"),
|
|
1008
|
+
"onUpdate:modelValue": (o) => A(l.key, k, o)
|
|
1009
|
+
}, null, 8, ["model-value", "name", "decimals", "suffix", "label", "onUpdate:modelValue"])), 64))
|
|
1010
|
+
])) : F("", !0)
|
|
1011
|
+
], 8, Sl)) : t(f) && J(l) ? (u(), y("div", {
|
|
1012
|
+
key: 2,
|
|
1013
|
+
role: "group",
|
|
1014
|
+
"aria-label": l.label,
|
|
1015
|
+
"data-test": "filter-chips"
|
|
1016
|
+
}, [
|
|
1017
|
+
r("p", Vl, g(l.label), 1),
|
|
1018
|
+
r("div", Ll, [
|
|
1019
|
+
(u(!0), y(ee, null, le(oe(l), (k) => (u(), y("button", {
|
|
1020
|
+
key: String(k.value),
|
|
1021
|
+
type: "button",
|
|
1022
|
+
"aria-pressed": (b.value[l.key] ?? null) === k.value,
|
|
1023
|
+
class: ue(["min-h-9 cursor-pointer rounded-full px-3.5 text-subheadline ring-1 ring-inset transition-colors", (b.value[l.key] ?? null) === k.value ? "bg-tint-soft font-semibold text-content-link ring-border-selected" : "bg-surface-cell text-content ring-border-separator active:bg-fill"]),
|
|
1024
|
+
onClick: (o) => $(l.key, k.value)
|
|
1025
|
+
}, [
|
|
1026
|
+
r("span", Pl, [
|
|
1027
|
+
k.dot ? (u(), W(we, {
|
|
1028
|
+
key: 0,
|
|
1029
|
+
tone: k.dot
|
|
1030
|
+
}, null, 8, ["tone"])) : F("", !0),
|
|
1031
|
+
G(g(k.label), 1)
|
|
1032
|
+
])
|
|
1033
|
+
], 10, Fl))), 128))
|
|
1034
|
+
])
|
|
1035
|
+
], 8, zl)) : t(f) ? (u(), y("button", {
|
|
1036
|
+
key: 3,
|
|
1037
|
+
type: "button",
|
|
1038
|
+
"data-test": "filter-row",
|
|
1039
|
+
disabled: !!l.dependsOn && M(l).length === 0,
|
|
1040
|
+
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",
|
|
1041
|
+
onClick: (k) => N.value = l.key
|
|
1042
|
+
}, [
|
|
1043
|
+
r("span", Rl, g(l.label), 1),
|
|
1044
|
+
r("span", {
|
|
1045
|
+
class: ue(["flex min-w-0 flex-1 items-center justify-end gap-2 text-subheadline", b.value[l.key] == null ? "text-content-disabled" : "font-medium text-content-link"])
|
|
1046
|
+
}, [
|
|
1047
|
+
C(l) ? (u(), W(we, {
|
|
1048
|
+
key: 0,
|
|
1049
|
+
tone: C(l)
|
|
1050
|
+
}, null, 8, ["tone"])) : F("", !0),
|
|
1051
|
+
r("span", Tl, g(de(l)), 1)
|
|
1052
|
+
], 2),
|
|
1053
|
+
O(t(I), {
|
|
1054
|
+
name: "arrowRightSLine",
|
|
1055
|
+
size: 18,
|
|
1056
|
+
class: "shrink-0 text-content-muted"
|
|
1057
|
+
})
|
|
1058
|
+
], 8, ql)) : (u(), W(yt, {
|
|
1059
|
+
key: 4,
|
|
1060
|
+
"model-value": b.value[l.key] ?? "",
|
|
1061
|
+
label: l.label,
|
|
1062
|
+
options: B(l),
|
|
1063
|
+
disabled: !!l.dependsOn && M(l).length === 0,
|
|
1064
|
+
"onUpdate:modelValue": (k) => $(l.key, k === "" ? null : k)
|
|
1065
|
+
}, null, 8, ["model-value", "label", "options", "disabled", "onUpdate:modelValue"]))
|
|
1066
|
+
], 64))), 128))
|
|
1067
|
+
])
|
|
1068
|
+
], 64))
|
|
1069
|
+
]),
|
|
1070
|
+
_: 1
|
|
1071
|
+
}, 8, ["title", "grouped"]));
|
|
1072
|
+
}
|
|
1073
|
+
}), Xl = { class: "flex flex-col items-start gap-2 lg:flex-row" }, Jl = {
|
|
1074
|
+
key: 0,
|
|
1075
|
+
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"
|
|
1076
|
+
}, Gl = ["placeholder", "aria-label"], Yl = ["aria-label"], Zl = ["title"], eo = {
|
|
1077
|
+
key: 0,
|
|
1078
|
+
class: "min-w-4.5 rounded-full bg-tint px-1 text-center text-caption font-semibold leading-4.5 text-content-on-tint"
|
|
1079
|
+
}, to = ["onClick"], lo = {
|
|
1080
|
+
key: 0,
|
|
1081
|
+
class: "mt-2.5 flex flex-wrap items-center gap-2",
|
|
1082
|
+
"data-test": "collection-filter-chips"
|
|
1083
|
+
}, oo = {
|
|
1084
|
+
key: 0,
|
|
1085
|
+
class: "shrink-0 opacity-80"
|
|
1086
|
+
}, no = { class: "flex min-w-0 flex-wrap items-center gap-1 font-semibold" }, so = { class: "break-words" }, ao = ["aria-label", "onClick"], He = "__search", ro = 3, io = 300, co = /* @__PURE__ */ be({
|
|
1087
|
+
__name: "CollectionToolbar",
|
|
1088
|
+
props: {
|
|
1089
|
+
collection: {},
|
|
1090
|
+
narrow: { type: Boolean },
|
|
1091
|
+
flat: { type: Boolean }
|
|
1092
|
+
},
|
|
1093
|
+
emits: ["touched", "searchKey"],
|
|
1094
|
+
setup(n, { emit: e }) {
|
|
1095
|
+
const s = n, p = e, { t: a } = he(), c = qe(), d = ie(s.collection.query.value.search), f = fe("field");
|
|
1096
|
+
let b = null;
|
|
1097
|
+
Le(() => s.collection.query.value.search, (C) => {
|
|
1098
|
+
C !== d.value.trim() && (d.value = C);
|
|
1099
|
+
});
|
|
1100
|
+
function S() {
|
|
1101
|
+
b && clearTimeout(b);
|
|
1102
|
+
const C = d.value;
|
|
1103
|
+
C.length > 0 && C.length < ro || (b = setTimeout(() => {
|
|
1104
|
+
b = null, C !== s.collection.query.value.search && (p("touched", [He]), s.collection.search(C));
|
|
1105
|
+
}, io));
|
|
1106
|
+
}
|
|
1107
|
+
function N() {
|
|
1108
|
+
b && clearTimeout(b), d.value = "", p("touched", [He]), s.collection.search(""), f.value?.focus();
|
|
1109
|
+
}
|
|
1110
|
+
rt(() => b && clearTimeout(b));
|
|
1111
|
+
const R = (C) => C.placement === "panel" || s.narrow && C.type !== "text", w = _(() => s.collection.filters.value.filter((C) => !R(C))), $ = _(() => s.collection.filters.value.filter(R)), P = _(() => s.collection.query.value.filters), j = _(
|
|
1112
|
+
() => Ve($.value, P.value, {
|
|
1113
|
+
formatNumber: (C) => c.number(C),
|
|
1114
|
+
from: a("core.collection.filters.range_from"),
|
|
1115
|
+
until: a("core.collection.filters.range_until")
|
|
1116
|
+
})
|
|
1117
|
+
), H = _(() => Ct($.value, P.value));
|
|
1118
|
+
function A(C, B) {
|
|
1119
|
+
p("touched", [C]), s.collection.setFilter(C, B);
|
|
1120
|
+
}
|
|
1121
|
+
function T(C) {
|
|
1122
|
+
s.collection.setFilters(Object.fromEntries(C.map((B) => [B, null])));
|
|
1123
|
+
}
|
|
1124
|
+
const Q = fe("panel"), M = fe("panelButton"), Y = (C) => !!C && (typeof C.checkVisibility != "function" || C.checkVisibility());
|
|
1125
|
+
Ae({ key: "/", group: "list", label: () => a("core.shortcuts.focus_search") }, () => {
|
|
1126
|
+
if (!Y(f.value)) return !1;
|
|
1127
|
+
f.value?.focus(), f.value?.select();
|
|
1128
|
+
}), Ae({ key: "f", group: "list", label: () => $.value.length > 0 ? a("core.shortcuts.open_filters") : "" }, () => {
|
|
1129
|
+
if ($.value.length === 0 || !Y(M.value)) return !1;
|
|
1130
|
+
Q.value?.present();
|
|
1131
|
+
});
|
|
1132
|
+
const de = _(() => s.collection.savedViews);
|
|
1133
|
+
it(() => void de.value?.load());
|
|
1134
|
+
const oe = _(
|
|
1135
|
+
() => (de.value?.items.value ?? []).map((C) => ({
|
|
1136
|
+
id: `saved-${C.id}`,
|
|
1137
|
+
label: C.name,
|
|
1138
|
+
icon: "starFill",
|
|
1139
|
+
onSelect: () => {
|
|
1140
|
+
p("touched", []), de.value?.apply(C);
|
|
1141
|
+
}
|
|
1142
|
+
}))
|
|
1143
|
+
);
|
|
1144
|
+
return (C, B) => (u(), y("div", {
|
|
1145
|
+
class: ue([s.flat ? "pb-3" : "border-b border-border-separator px-3 py-2.5", "select-none"]),
|
|
1146
|
+
"data-test": "collection-toolbar"
|
|
1147
|
+
}, [
|
|
1148
|
+
r("div", Xl, [
|
|
1149
|
+
s.collection.searchable ? (u(), y("div", Jl, [
|
|
1150
|
+
O(t(I), {
|
|
1151
|
+
name: "search",
|
|
1152
|
+
size: 16
|
|
1153
|
+
}),
|
|
1154
|
+
Fe(r("input", {
|
|
1155
|
+
ref_key: "field",
|
|
1156
|
+
ref: f,
|
|
1157
|
+
"onUpdate:modelValue": B[0] || (B[0] = (V) => d.value = V),
|
|
1158
|
+
type: "text",
|
|
1159
|
+
name: "collection-search",
|
|
1160
|
+
autocomplete: "off",
|
|
1161
|
+
placeholder: t(a)("core.collection.search.placeholder"),
|
|
1162
|
+
"aria-label": t(a)("core.collection.search.label"),
|
|
1163
|
+
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",
|
|
1164
|
+
onInput: S,
|
|
1165
|
+
onKeydown: B[1] || (B[1] = (V) => p("searchKey", V, t(b) === null && d.value.trim() === s.collection.query.value.search))
|
|
1166
|
+
}, null, 40, Gl), [
|
|
1167
|
+
[Pe, d.value]
|
|
1168
|
+
]),
|
|
1169
|
+
B[5] || (B[5] = r("kbd", {
|
|
1170
|
+
"aria-hidden": "true",
|
|
1171
|
+
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"
|
|
1172
|
+
}, "/", -1)),
|
|
1173
|
+
d.value !== "" ? (u(), y("button", {
|
|
1174
|
+
key: 0,
|
|
1175
|
+
type: "button",
|
|
1176
|
+
"aria-label": t(a)("core.collection.clear"),
|
|
1177
|
+
class: "cursor-pointer rounded-full text-content-disabled hover:text-content-muted",
|
|
1178
|
+
onClick: N
|
|
1179
|
+
}, [
|
|
1180
|
+
O(t(I), {
|
|
1181
|
+
name: "close",
|
|
1182
|
+
size: 16
|
|
1183
|
+
})
|
|
1184
|
+
], 8, Yl)) : F("", !0)
|
|
1185
|
+
])) : F("", !0),
|
|
1186
|
+
r("div", {
|
|
1187
|
+
class: ue(["flex min-w-0 flex-1 items-center gap-2", s.narrow ? "w-full flex-nowrap overflow-x-auto [scrollbar-width:none]" : "flex-wrap"])
|
|
1188
|
+
}, [
|
|
1189
|
+
$.value.length > 0 ? (u(), y("button", {
|
|
1190
|
+
key: 0,
|
|
1191
|
+
ref_key: "panelButton",
|
|
1192
|
+
ref: M,
|
|
1193
|
+
type: "button",
|
|
1194
|
+
"data-test": "collection-filter-panel-button",
|
|
1195
|
+
title: `${t(a)("core.collection.filters.panel_button")} (F)`,
|
|
1196
|
+
class: ue(["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", H.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"]),
|
|
1197
|
+
onClick: B[2] || (B[2] = (V) => Q.value?.present())
|
|
1198
|
+
}, [
|
|
1199
|
+
O(t(I), {
|
|
1200
|
+
name: "filter3",
|
|
1201
|
+
size: 16
|
|
1202
|
+
}),
|
|
1203
|
+
G(" " + g(t(a)("core.collection.filters.panel_button")) + " ", 1),
|
|
1204
|
+
H.value > 0 ? (u(), y("span", eo, g(H.value), 1)) : F("", !0)
|
|
1205
|
+
], 10, Zl)) : F("", !0),
|
|
1206
|
+
oe.value.length > 0 ? (u(), W(t(Ye), {
|
|
1207
|
+
key: 1,
|
|
1208
|
+
items: oe.value,
|
|
1209
|
+
label: t(a)("core.collection.saved.menu"),
|
|
1210
|
+
placement: "bottom-start"
|
|
1211
|
+
}, {
|
|
1212
|
+
trigger: q(({ toggle: V, attrs: J }) => [
|
|
1213
|
+
r("button", ve(J, {
|
|
1214
|
+
type: "button",
|
|
1215
|
+
"data-test": "saved-filters-menu",
|
|
1216
|
+
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",
|
|
1217
|
+
onClick: V
|
|
1218
|
+
}), [
|
|
1219
|
+
O(t(I), {
|
|
1220
|
+
name: "starFill",
|
|
1221
|
+
size: 14,
|
|
1222
|
+
class: "text-status-warning-content"
|
|
1223
|
+
}),
|
|
1224
|
+
G(" " + g(t(a)("core.collection.saved.menu")), 1)
|
|
1225
|
+
], 16, to)
|
|
1226
|
+
]),
|
|
1227
|
+
_: 1
|
|
1228
|
+
}, 8, ["items", "label"])) : F("", !0),
|
|
1229
|
+
(u(!0), y(ee, null, le(w.value, (V) => (u(), W(dl, {
|
|
1230
|
+
key: V.key,
|
|
1231
|
+
filter: V,
|
|
1232
|
+
value: P.value[V.key],
|
|
1233
|
+
onUpdate: (J) => A(V.key, J)
|
|
1234
|
+
}, null, 8, ["filter", "value", "onUpdate"]))), 128))
|
|
1235
|
+
], 2),
|
|
1236
|
+
ge(C.$slots, "default")
|
|
1237
|
+
]),
|
|
1238
|
+
j.value.length > 0 ? (u(), y("div", lo, [
|
|
1239
|
+
(u(!0), y(ee, null, le(j.value, (V) => (u(), y("span", {
|
|
1240
|
+
key: V.key,
|
|
1241
|
+
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"
|
|
1242
|
+
}, [
|
|
1243
|
+
V.label ? (u(), y("span", oo, g(V.label), 1)) : F("", !0),
|
|
1244
|
+
r("span", no, [
|
|
1245
|
+
(u(!0), y(ee, null, le(V.values, (J, ne) => (u(), y(ee, { key: ne }, [
|
|
1246
|
+
ne > 0 ? (u(), W(t(I), {
|
|
1247
|
+
key: 0,
|
|
1248
|
+
name: "arrowRightSLine",
|
|
1249
|
+
size: 12,
|
|
1250
|
+
class: "opacity-60"
|
|
1251
|
+
})) : F("", !0),
|
|
1252
|
+
r("span", so, g(J), 1)
|
|
1253
|
+
], 64))), 128))
|
|
1254
|
+
]),
|
|
1255
|
+
r("button", {
|
|
1256
|
+
type: "button",
|
|
1257
|
+
class: "hit-target flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-full hover:bg-tint/15",
|
|
1258
|
+
"aria-label": t(a)("core.collection.clear"),
|
|
1259
|
+
onClick: (J) => T(V.clears)
|
|
1260
|
+
}, [
|
|
1261
|
+
O(t(I), {
|
|
1262
|
+
name: "close",
|
|
1263
|
+
size: 12
|
|
1264
|
+
})
|
|
1265
|
+
], 8, ao)
|
|
1266
|
+
]))), 128)),
|
|
1267
|
+
j.value.length > 1 ? (u(), y("button", {
|
|
1268
|
+
key: 0,
|
|
1269
|
+
type: "button",
|
|
1270
|
+
class: "cursor-pointer px-2 text-subheadline text-content-muted hover:text-content-strong hover:underline",
|
|
1271
|
+
onClick: B[3] || (B[3] = (V) => T($.value.map((J) => J.key)))
|
|
1272
|
+
}, g(t(a)("core.collection.filters.reset_all")), 1)) : F("", !0)
|
|
1273
|
+
])) : F("", !0),
|
|
1274
|
+
$.value.length > 0 ? (u(), W(Ql, {
|
|
1275
|
+
key: 1,
|
|
1276
|
+
ref_key: "panel",
|
|
1277
|
+
ref: Q,
|
|
1278
|
+
collection: s.collection,
|
|
1279
|
+
filters: $.value,
|
|
1280
|
+
onTouched: B[4] || (B[4] = (V) => p("touched", V))
|
|
1281
|
+
}, null, 8, ["collection", "filters"])) : F("", !0)
|
|
1282
|
+
], 2));
|
|
1283
|
+
}
|
|
1284
|
+
}), uo = ["aria-busy"], fo = {
|
|
1285
|
+
key: 0,
|
|
1286
|
+
class: "mb-3 select-none"
|
|
1287
|
+
}, po = {
|
|
1288
|
+
key: 0,
|
|
1289
|
+
role: "status",
|
|
1290
|
+
"data-test": "collection-refreshing",
|
|
1291
|
+
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"
|
|
1292
|
+
}, vo = {
|
|
1293
|
+
key: 1,
|
|
1294
|
+
class: "m-2",
|
|
1295
|
+
"data-test": "collection-stale"
|
|
1296
|
+
}, mo = { class: "flex flex-wrap items-center justify-between gap-3" }, bo = { class: "flex flex-wrap items-center justify-between gap-3" }, go = { class: "font-semibold" }, Ke = "__search", ho = /* @__PURE__ */ be({
|
|
1297
|
+
__name: "CollectionTable",
|
|
1298
|
+
props: {
|
|
1299
|
+
collection: {},
|
|
1300
|
+
rowActions: { type: Function, default: void 0 },
|
|
1301
|
+
rowLabel: { type: Function, default: void 0 },
|
|
1302
|
+
rowHeight: { default: void 0 },
|
|
1303
|
+
density: { default: "regular" },
|
|
1304
|
+
viewsPresentation: { default: "segmented" },
|
|
1305
|
+
actionsVisible: { type: Boolean, default: !1 },
|
|
1306
|
+
pick: { type: Function, default: void 0 },
|
|
1307
|
+
pickLabel: { default: void 0 }
|
|
1308
|
+
},
|
|
1309
|
+
setup(n) {
|
|
1310
|
+
const e = n, s = ze(), { t: p } = he(), a = qe(), c = _(() => Object.keys(ze()).filter((h) => h !== "toolbar" && h !== "empty")), d = _(() => e.collection.columns.value), { narrow: f, phone: b } = bt(() => d.value), S = _(() => e.collection.rows.value), N = (h) => e.pick ? null : e.collection.recordLocation(h), R = fe("rowsView");
|
|
1311
|
+
function w(h, x) {
|
|
1312
|
+
if (!e.pick || h.isComposing) return;
|
|
1313
|
+
if (h.key === "ArrowDown") {
|
|
1314
|
+
R.value?.focusRows() && h.preventDefault();
|
|
1315
|
+
return;
|
|
1316
|
+
}
|
|
1317
|
+
if (h.key !== "Enter") return;
|
|
1318
|
+
const z = S.value[0];
|
|
1319
|
+
x && z !== void 0 && S.value.length === 1 && e.collection.total.value <= 1 && e.collection.state.value.status === "loaded" && (h.preventDefault(), e.pick(z));
|
|
1320
|
+
}
|
|
1321
|
+
const $ = _(() => e.collection.query.value.search), P = _(() => e.collection.views.value.map((h) => ({ value: h.key, label: h.label, icon: h.icon, badge: h.count }))), j = ie([]), H = (h) => j.value = [...j.value.filter((x) => !h.includes(x)), ...h], A = () => ({
|
|
1322
|
+
formatNumber: (h) => a.number(h),
|
|
1323
|
+
from: p("core.collection.filters.range_from"),
|
|
1324
|
+
until: p("core.collection.filters.range_until")
|
|
1325
|
+
}), T = _(() => {
|
|
1326
|
+
const h = Ve(e.collection.filters.value, e.collection.query.value.filters, A()), x = e.collection.query.value.search;
|
|
1327
|
+
return x && h.push({ key: Ke, label: p("core.collection.empty.search"), values: [x], clears: [] }), h;
|
|
1328
|
+
}), Q = _(() => {
|
|
1329
|
+
const h = e.collection.startFilters.value, x = Object.fromEntries(h.map((z) => [z, e.collection.query.value.filters[z]]));
|
|
1330
|
+
return Ve(e.collection.filters.value, x, A()).map((z) => z.label ? `${z.label}: ${z.values.join(" › ")}` : z.values.join(" › "));
|
|
1331
|
+
}), M = _(() => {
|
|
1332
|
+
for (const h of [...j.value].reverse()) {
|
|
1333
|
+
const x = T.value.find((z) => z.key === h || z.clears.includes(h));
|
|
1334
|
+
if (x) return x;
|
|
1335
|
+
}
|
|
1336
|
+
return T.value[T.value.length - 1] ?? null;
|
|
1337
|
+
});
|
|
1338
|
+
function Y(h) {
|
|
1339
|
+
j.value = j.value.filter((x) => x !== h.key && !h.clears.includes(x)), h.key === Ke ? e.collection.search("") : e.collection.setFilters(Object.fromEntries(h.clears.map((x) => [x, null])));
|
|
1340
|
+
}
|
|
1341
|
+
function de() {
|
|
1342
|
+
j.value = [], e.collection.clearFilters();
|
|
1343
|
+
}
|
|
1344
|
+
const oe = _(() => {
|
|
1345
|
+
const { sort: h, direction: x } = e.collection.query.value;
|
|
1346
|
+
return h === null ? null : { key: h, direction: x };
|
|
1347
|
+
}), C = fe("card"), B = () => C.value?.scrollIntoView?.({ block: "start", behavior: "smooth" }), V = _(() => e.collection.display.value === "loading"), J = _(() => e.collection.query.value.pageSize), ne = _(() => e.collection.state.value.status === "refreshing"), te = _(() => e.collection.state.value.status === "stale"), se = _(() => {
|
|
1348
|
+
const h = e.collection.state.value;
|
|
1349
|
+
return h.status === "failed" || h.status === "stale" ? h.error ?? "" : "";
|
|
1350
|
+
});
|
|
1351
|
+
return (h, x) => (u(), y("div", {
|
|
1352
|
+
class: "collection",
|
|
1353
|
+
"aria-busy": V.value || ne.value || void 0,
|
|
1354
|
+
"data-test": "collection"
|
|
1355
|
+
}, [
|
|
1356
|
+
P.value.length > 0 ? (u(), y("div", fo, [
|
|
1357
|
+
O(t(Ge), {
|
|
1358
|
+
"model-value": e.collection.query.value.view,
|
|
1359
|
+
tabs: P.value,
|
|
1360
|
+
presentation: e.viewsPresentation,
|
|
1361
|
+
label: t(p)("core.collection.views_label"),
|
|
1362
|
+
"onUpdate:modelValue": x[0] || (x[0] = (z) => e.collection.setView(z === null ? null : String(z)))
|
|
1363
|
+
}, null, 8, ["model-value", "tabs", "presentation", "label"])
|
|
1364
|
+
])) : F("", !0),
|
|
1365
|
+
r("div", {
|
|
1366
|
+
ref_key: "card",
|
|
1367
|
+
ref: C,
|
|
1368
|
+
class: ue(["scroll-mt-16", t(b) ? "" : "rounded-group bg-surface-cell shadow-group"])
|
|
1369
|
+
}, [
|
|
1370
|
+
O(co, {
|
|
1371
|
+
collection: e.collection,
|
|
1372
|
+
narrow: t(f),
|
|
1373
|
+
flat: t(b),
|
|
1374
|
+
onTouched: H,
|
|
1375
|
+
onSearchKey: w
|
|
1376
|
+
}, {
|
|
1377
|
+
default: q(() => [
|
|
1378
|
+
ge(h.$slots, "toolbar")
|
|
1379
|
+
]),
|
|
1380
|
+
_: 3
|
|
1381
|
+
}, 8, ["collection", "narrow", "flat"]),
|
|
1382
|
+
ne.value ? (u(), y("div", po, [
|
|
1383
|
+
O(t(I), {
|
|
1384
|
+
name: "loader4Line",
|
|
1385
|
+
size: 14,
|
|
1386
|
+
class: "animate-spin motion-reduce:animate-none"
|
|
1387
|
+
}),
|
|
1388
|
+
G(" " + g(t(p)("core.state.refreshing")), 1)
|
|
1389
|
+
])) : F("", !0),
|
|
1390
|
+
te.value ? (u(), y("div", vo, [
|
|
1391
|
+
O(t(Ee), {
|
|
1392
|
+
tone: "warning",
|
|
1393
|
+
role: "alert"
|
|
1394
|
+
}, {
|
|
1395
|
+
default: q(() => [
|
|
1396
|
+
r("div", mo, [
|
|
1397
|
+
r("div", null, [
|
|
1398
|
+
r("p", null, g(se.value), 1),
|
|
1399
|
+
r("p", null, g(t(p)("core.state.stale")), 1)
|
|
1400
|
+
]),
|
|
1401
|
+
O(ce, {
|
|
1402
|
+
prominence: "secondary",
|
|
1403
|
+
size: "sm",
|
|
1404
|
+
onClick: x[1] || (x[1] = (z) => e.collection.refresh())
|
|
1405
|
+
}, {
|
|
1406
|
+
default: q(() => [
|
|
1407
|
+
G(g(t(p)("core.actions.retry")), 1)
|
|
1408
|
+
]),
|
|
1409
|
+
_: 1
|
|
1410
|
+
})
|
|
1411
|
+
])
|
|
1412
|
+
]),
|
|
1413
|
+
_: 1
|
|
1414
|
+
})
|
|
1415
|
+
])) : F("", !0),
|
|
1416
|
+
O(gt, {
|
|
1417
|
+
ref_key: "rowsView",
|
|
1418
|
+
ref: R,
|
|
1419
|
+
pick: e.pick,
|
|
1420
|
+
"pick-label": e.pickLabel,
|
|
1421
|
+
columns: d.value,
|
|
1422
|
+
rows: S.value,
|
|
1423
|
+
"row-key": e.collection.rowKey,
|
|
1424
|
+
display: e.collection.display.value,
|
|
1425
|
+
phone: t(b),
|
|
1426
|
+
link: N,
|
|
1427
|
+
search: $.value,
|
|
1428
|
+
sorted: oe.value,
|
|
1429
|
+
"row-actions": e.rowActions,
|
|
1430
|
+
"row-label": e.rowLabel,
|
|
1431
|
+
"row-height": e.rowHeight,
|
|
1432
|
+
density: e.density,
|
|
1433
|
+
"actions-visible": e.actionsVisible,
|
|
1434
|
+
"skeleton-rows": J.value,
|
|
1435
|
+
"reserve-rows": V.value ? J.value : void 0,
|
|
1436
|
+
onSort: x[4] || (x[4] = (z) => e.collection.toggleSort(z))
|
|
1437
|
+
}, Qe({
|
|
1438
|
+
failed: q(() => [
|
|
1439
|
+
O(t(Ee), {
|
|
1440
|
+
tone: "warning",
|
|
1441
|
+
role: "alert"
|
|
1442
|
+
}, {
|
|
1443
|
+
default: q(() => [
|
|
1444
|
+
r("div", bo, [
|
|
1445
|
+
r("div", null, [
|
|
1446
|
+
r("p", go, g(t(p)("core.collection.failed.title")), 1),
|
|
1447
|
+
r("p", null, g(se.value), 1)
|
|
1448
|
+
]),
|
|
1449
|
+
O(ce, {
|
|
1450
|
+
prominence: "secondary",
|
|
1451
|
+
size: "sm",
|
|
1452
|
+
onClick: x[2] || (x[2] = (z) => e.collection.refresh())
|
|
1453
|
+
}, {
|
|
1454
|
+
default: q(() => [
|
|
1455
|
+
G(g(t(p)("core.actions.retry")), 1)
|
|
1456
|
+
]),
|
|
1457
|
+
_: 1
|
|
1458
|
+
})
|
|
1459
|
+
])
|
|
1460
|
+
]),
|
|
1461
|
+
_: 1
|
|
1462
|
+
})
|
|
1463
|
+
]),
|
|
1464
|
+
empty: q(() => [
|
|
1465
|
+
e.collection.display.value === "empty" && s.empty ? ge(h.$slots, "empty", {}, void 0, void 0, 0) : e.collection.display.value === "empty" && Q.value.length > 0 ? (u(), W(t(Ue), {
|
|
1466
|
+
key: 1,
|
|
1467
|
+
"data-test": "collection-empty-start",
|
|
1468
|
+
title: t(p)("core.collection.no_data"),
|
|
1469
|
+
description: t(p)("core.collection.empty.start_description", { filters: Q.value.join(", ") }),
|
|
1470
|
+
icon: "filter3"
|
|
1471
|
+
}, {
|
|
1472
|
+
actions: q(() => [
|
|
1473
|
+
O(ce, ve({ "data-test": "collection-empty-show-all" }, {
|
|
1474
|
+
size: "sm",
|
|
1475
|
+
onClick: x[3] || (x[3] = (z) => e.collection.clearStart())
|
|
1476
|
+
}), {
|
|
1477
|
+
default: q(() => [
|
|
1478
|
+
G(g(t(p)("core.collection.empty.show_all")), 1)
|
|
1479
|
+
]),
|
|
1480
|
+
_: 1
|
|
1481
|
+
}, 16)
|
|
1482
|
+
]),
|
|
1483
|
+
_: 1
|
|
1484
|
+
}, 8, ["title", "description"])) : e.collection.display.value !== "empty" && T.value.length > 0 ? (u(), W(Rt, {
|
|
1485
|
+
key: 2,
|
|
1486
|
+
chips: T.value,
|
|
1487
|
+
"last-chip": M.value,
|
|
1488
|
+
onRemove: Y,
|
|
1489
|
+
onClearAll: de
|
|
1490
|
+
}, null, 8, ["chips", "last-chip"])) : (u(), W(t(Ue), {
|
|
1491
|
+
key: 3,
|
|
1492
|
+
title: t(p)("core.collection.no_data"),
|
|
1493
|
+
description: t(p)("core.collection.no_results")
|
|
1494
|
+
}, null, 8, ["title", "description"]))
|
|
1495
|
+
]),
|
|
1496
|
+
_: 2
|
|
1497
|
+
}, [
|
|
1498
|
+
le(c.value, (z) => ({
|
|
1499
|
+
name: z,
|
|
1500
|
+
fn: q((pe) => [
|
|
1501
|
+
ge(h.$slots, z, Xe(Je(pe ?? {})))
|
|
1502
|
+
])
|
|
1503
|
+
}))
|
|
1504
|
+
]), 1032, ["pick", "pick-label", "columns", "rows", "row-key", "display", "phone", "search", "sorted", "row-actions", "row-label", "row-height", "density", "actions-visible", "skeleton-rows", "reserve-rows"]),
|
|
1505
|
+
O(ll, {
|
|
1506
|
+
collection: e.collection,
|
|
1507
|
+
compact: t(f),
|
|
1508
|
+
flat: t(b),
|
|
1509
|
+
onTurned: B
|
|
1510
|
+
}, null, 8, ["collection", "compact", "flat"])
|
|
1511
|
+
], 2)
|
|
1512
|
+
], 8, uo));
|
|
1513
|
+
}
|
|
1514
|
+
}), Mo = /* @__PURE__ */ be({
|
|
1515
|
+
__name: "CollectionPage",
|
|
1516
|
+
props: {
|
|
1517
|
+
collection: {},
|
|
1518
|
+
title: {},
|
|
1519
|
+
description: { default: void 0 },
|
|
1520
|
+
icon: { default: void 0 },
|
|
1521
|
+
actions: { default: () => [] },
|
|
1522
|
+
rowActions: { type: Function, default: void 0 },
|
|
1523
|
+
rowLabel: { type: Function, default: void 0 },
|
|
1524
|
+
rowHeight: { default: void 0 },
|
|
1525
|
+
density: { default: "regular" },
|
|
1526
|
+
viewsPresentation: { default: "segmented" },
|
|
1527
|
+
actionsVisible: { type: Boolean, default: !1 },
|
|
1528
|
+
pick: { type: Function, default: void 0 },
|
|
1529
|
+
pickLabel: { default: void 0 }
|
|
1530
|
+
},
|
|
1531
|
+
setup(n) {
|
|
1532
|
+
const e = n, s = _(() => Object.keys(ze()).filter((a) => a !== "default")), p = _(() => e.collection.total.value || null);
|
|
1533
|
+
return (a, c) => (u(), W(t(mt), {
|
|
1534
|
+
title: e.title,
|
|
1535
|
+
description: e.description,
|
|
1536
|
+
icon: e.icon,
|
|
1537
|
+
count: p.value,
|
|
1538
|
+
actions: e.actions
|
|
1539
|
+
}, {
|
|
1540
|
+
default: q(() => [
|
|
1541
|
+
O(ho, {
|
|
1542
|
+
collection: e.collection,
|
|
1543
|
+
"row-actions": e.rowActions,
|
|
1544
|
+
"row-label": e.rowLabel,
|
|
1545
|
+
"row-height": e.rowHeight,
|
|
1546
|
+
density: e.density,
|
|
1547
|
+
"views-presentation": e.viewsPresentation,
|
|
1548
|
+
"actions-visible": e.actionsVisible,
|
|
1549
|
+
pick: e.pick,
|
|
1550
|
+
"pick-label": e.pickLabel
|
|
1551
|
+
}, Qe({ _: 2 }, [
|
|
1552
|
+
le(s.value, (d) => ({
|
|
1553
|
+
name: d,
|
|
1554
|
+
fn: q((f) => [
|
|
1555
|
+
ge(a.$slots, d, Xe(Je(f ?? {})))
|
|
1556
|
+
])
|
|
1557
|
+
}))
|
|
1558
|
+
]), 1032, ["collection", "row-actions", "row-label", "row-height", "density", "views-presentation", "actions-visible", "pick", "pick-label"]),
|
|
1559
|
+
ge(a.$slots, "default")
|
|
1560
|
+
]),
|
|
1561
|
+
_: 3
|
|
1562
|
+
}, 8, ["title", "description", "icon", "count", "actions"]));
|
|
1563
|
+
}
|
|
1564
|
+
});
|
|
1565
|
+
export {
|
|
1566
|
+
Mo as _,
|
|
1567
|
+
ho as a,
|
|
1568
|
+
Uo as u
|
|
1569
|
+
};
|