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