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