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