@wssto2/vue-core 0.4.5 → 0.4.6

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