@oneclick.dev/cms-core-modules 0.0.122 → 0.0.123
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/{ContentEditor-CoJjsV-m.js → ContentEditor-C-Wm48ai.js} +63 -59
- package/dist/{ContentEditor-DIwqplfB.mjs → ContentEditor-MDGolnIP.mjs} +27596 -26138
- package/dist/{NewReservationDialog.vue_vue_type_script_setup_true_lang-bZidw6RT.mjs → NewReservationDialog.vue_vue_type_script_setup_true_lang-8I_Z9cD_.mjs} +530 -530
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-BVE_uURZ.js +1 -0
- package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-BdFa-xNf.mjs +3566 -0
- package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-DzPOadcU.js +925 -0
- package/dist/TableCalculationWidget-CkQPrVUd.js +59 -0
- package/dist/TableCalculationWidget-CrqcLGfU.mjs +254 -0
- package/dist/TableDataWidget-7qvC3Egd.js +1 -0
- package/dist/TableDataWidget-DMTSoGRO.mjs +121 -0
- package/dist/TableOverviewCard-AFq-puJs.js +1 -0
- package/dist/TableOverviewCard-Ci0d4o4w.mjs +391 -0
- package/dist/TableResultView.vue_vue_type_script_setup_true_lang-CBn-Oxl9.mjs +534 -0
- package/dist/TableResultView.vue_vue_type_script_setup_true_lang-C_Lv-SmJ.js +1 -0
- package/dist/TableRowActionCard-BhdnnPaq.mjs +266 -0
- package/dist/TableRowActionCard-IzB6tNN-.js +1 -0
- package/dist/TableView-BkwoKREo.js +4 -0
- package/dist/TableView-C4Zyp8d7.mjs +8228 -0
- package/dist/{agenda-BCKDYOeF.mjs → agenda-DWdbWUbb.mjs} +10 -9
- package/dist/agenda-r9Gl85GL.js +1 -0
- package/dist/dateRangePresets-B-l5b_wR.mjs +48 -0
- package/dist/dateRangePresets-CPWqst_x.js +1 -0
- package/dist/fuse-Deb-Iq39.mjs +1473 -0
- package/dist/fuse-_CGUd5Zq.js +1 -0
- package/dist/{index-DU3Ib10Z.mjs → index-B_qaX29C.mjs} +7 -6
- package/dist/{index-Bk3yLv_G.js → index-yHLT6gaZ.js} +3 -3
- package/dist/index.cjs.js +1 -1
- package/dist/index.mjs +419 -109
- package/dist/{orders-CElKNc1v.mjs → orders-BfTLIm7U.mjs} +10 -9
- package/dist/orders-DUa2PVoa.js +1 -0
- package/dist/reports-ChCsd1Gk.mjs +1107 -0
- package/dist/reports-DmJPm8uP.js +158 -0
- package/dist/row-item-C1dUyimV.mjs +204 -0
- package/dist/row-item-Cyo3m3MZ.js +1 -0
- package/dist/src/appointments/components/edit/EventDialog/BookingsList.vue.d.ts +9 -3
- package/dist/src/appointments/components/edit/EventDialog/OrderDetailDialog.vue.d.ts +2 -0
- package/dist/src/appointments/components/edit/EventDialog/ReservationDetailDialog.vue.d.ts +4 -2
- package/dist/src/appointments/components/edit/dashboard/BookingsList.vue.d.ts +9 -3
- package/dist/src/appointments/pages/edit/orders.vue.d.ts +9 -3
- package/dist/src/appointments/pages/edit/reports.vue.d.ts +229 -1
- package/dist/src/table/chat-components/TableCalculationWidget.vue.d.ts +15 -0
- package/dist/src/table/chat-components/TableDataWidget.vue.d.ts +15 -0
- package/dist/src/table/chat-components/TableOverviewCard.vue.d.ts +61 -0
- package/dist/src/table/chat-components/TableResultView.vue.d.ts +48 -0
- package/dist/src/table/chat-components/TableRowActionCard.vue.d.ts +15 -0
- package/dist/src/table/components/filters/DialogTableFilterOptionItem.vue.d.ts +16 -0
- package/dist/src/table/components/filters/NumberComparisonFilter.vue.d.ts +12 -0
- package/dist/src/table/components/filters/NumberComparisonFilterSettings.vue.d.ts +12 -0
- package/dist/src/table/components/filters/NumberRangeFilter.vue.d.ts +12 -0
- package/dist/src/table/components/filters/NumberRangeFilterSettings.vue.d.ts +12 -0
- package/dist/src/table/components/filters/filter-utils.d.ts +14 -0
- package/dist/src/table/composables/useTableAgentTools.d.ts +33 -0
- package/dist/src/table/index.d.ts +339 -0
- package/dist/src/table/tool-sandbox.d.ts +13 -0
- package/dist/src/table/tool-utils.d.ts +11 -0
- package/dist/src/table/tools.d.ts +333 -1
- package/dist/src/table/types.d.ts +79 -0
- package/dist/tool-sandbox-DdkMLkDK.mjs +182 -0
- package/dist/tool-sandbox-DoF1PsyS.js +115 -0
- package/dist/useTableAgentTools-D5mzGf3A.js +1 -0
- package/dist/useTableAgentTools-DcN3kYRL.mjs +131 -0
- package/package.json +17 -17
- package/src/table/tools.ts +304 -1
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-BdZbcubW.js +0 -1
- package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-BYSeUW_V.js +0 -925
- package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-DwAUYR8p.mjs +0 -5021
- package/dist/TableView-Ctnep-Qu.mjs +0 -6247
- package/dist/TableView-DJqyJL9L.js +0 -4
- package/dist/agenda-B54F8cEr.js +0 -1
- package/dist/orders-BMosTk6r.js +0 -1
- package/dist/reports-BQT_GZzU.js +0 -158
- package/dist/reports-DksZCTOw.mjs +0 -837
|
@@ -0,0 +1,534 @@
|
|
|
1
|
+
import { defineComponent as ie, computed as _, openBlock as u, createElementBlock as f, createElementVNode as L, createVNode as A, unref as w, toDisplayString as b, createCommentVNode as N, Fragment as j, renderList as O, createTextVNode as I, normalizeClass as P, createBlock as F, renderSlot as oe } from "vue";
|
|
2
|
+
import { Table2 as q, Columns3 as se, Image as Y, ExternalLink as Z, Check as X, X as G } from "lucide-vue-next";
|
|
3
|
+
const V = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
4
|
+
function $(t, e) {
|
|
5
|
+
if (!t || !e) return;
|
|
6
|
+
const i = e.split(".");
|
|
7
|
+
if (!i.some((s) => V.has(s)))
|
|
8
|
+
return Object.prototype.hasOwnProperty.call(t, e) ? t[e] : i.reduce((s, l) => s?.[l], t);
|
|
9
|
+
}
|
|
10
|
+
function Q(t) {
|
|
11
|
+
return t.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_.-]+/g, " ").replace(/\s+/g, " ").trim().replace(/\b\w/g, (e) => e.toUpperCase());
|
|
12
|
+
}
|
|
13
|
+
function ae(t, e) {
|
|
14
|
+
const i = t.toLowerCase().replace(/[_.-]/g, "");
|
|
15
|
+
if (/email$/.test(i)) return "email";
|
|
16
|
+
if (/(phone|mobile|telephone|tel)$/.test(i)) return "phone";
|
|
17
|
+
if (/(image|photo|avatar|thumbnail|logo|picture)$/.test(i)) return "image";
|
|
18
|
+
if (/(url|link|website|href)$/.test(i)) return "URL";
|
|
19
|
+
if (/(price|amount|cost|total|revenue|salary|fee)$/.test(i)) return "currency";
|
|
20
|
+
if (/(createdat|updatedat|timestamp)$/.test(i)) return "datetime";
|
|
21
|
+
if (/date$/.test(i)) return "date";
|
|
22
|
+
const s = e.filter((l) => l != null && l !== "");
|
|
23
|
+
return s.length ? s.every((l) => typeof l == "boolean") ? "boolean" : s.every((l) => typeof l == "number") ? "number" : s.every((l) => Array.isArray(l)) ? "array" : s.every((l) => typeof l == "string" && /^\d{4}-\d{2}-\d{2}(?:T|$)/.test(l)) ? s.some((l) => String(l).includes("T")) ? "datetime" : "date" : "text" : "text";
|
|
24
|
+
}
|
|
25
|
+
function Ke(t) {
|
|
26
|
+
if (t == null) return [];
|
|
27
|
+
const e = Array.isArray(t) ? t : Array.isArray(t?.data) ? t.data : Array.isArray(t?.items) ? t.items : Array.isArray(t?.rows) ? t.rows : null;
|
|
28
|
+
if (!e)
|
|
29
|
+
throw new Error("The Fetch items flow must return an array of rows.");
|
|
30
|
+
return e.map((i) => i && typeof i == "object" && !Array.isArray(i) ? i : { value: i });
|
|
31
|
+
}
|
|
32
|
+
function Pe(t) {
|
|
33
|
+
return Array.isArray(t) ? t.filter((e) => e && typeof e.property == "string" && e.property.trim()).map((e, i) => ({
|
|
34
|
+
...e,
|
|
35
|
+
id: typeof e.id == "string" ? e.id : `column-${i}`,
|
|
36
|
+
property: e.property.trim(),
|
|
37
|
+
label: typeof e.label == "string" && e.label.trim() ? e.label.trim() : Q(e.property),
|
|
38
|
+
type: typeof e.type == "string" && e.type ? e.type : "text",
|
|
39
|
+
visible: e.visible !== !1
|
|
40
|
+
})) : [];
|
|
41
|
+
}
|
|
42
|
+
function ee(t, e, i, s) {
|
|
43
|
+
if (!(!t || typeof t != "object" || Array.isArray(t) || s >= 2))
|
|
44
|
+
for (const [l, p] of Object.entries(t)) {
|
|
45
|
+
if (V.has(l)) continue;
|
|
46
|
+
const c = e ? `${e}.${l}` : l;
|
|
47
|
+
p && typeof p == "object" && !Array.isArray(p) && !(p instanceof Date) ? ee(p, c, i, s + 1) : i.add(c);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function le(t) {
|
|
51
|
+
const e = /* @__PURE__ */ new Set();
|
|
52
|
+
for (const i of t.slice(0, 10)) ee(i, "", e, 0);
|
|
53
|
+
return Array.from(e).slice(0, 40).map((i, s) => ({
|
|
54
|
+
id: `inferred-${s}`,
|
|
55
|
+
property: i,
|
|
56
|
+
label: Q(i),
|
|
57
|
+
type: ae(i, t.map((l) => $(l, i))),
|
|
58
|
+
visible: !0
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
function W(t, e) {
|
|
62
|
+
const i = String(t || "").trim().toLocaleLowerCase();
|
|
63
|
+
return i && (e.find((s) => s.property.toLocaleLowerCase() === i) || e.find((s) => String(s.label || "").trim().toLocaleLowerCase() === i) || e.find((s) => String(s.id || "").trim().toLocaleLowerCase() === i)) || null;
|
|
64
|
+
}
|
|
65
|
+
function S(t) {
|
|
66
|
+
return t == null || t === "" || Array.isArray(t) && t.length === 0;
|
|
67
|
+
}
|
|
68
|
+
function pe(t) {
|
|
69
|
+
return typeof t == "boolean" ? t : typeof t != "string" ? null : t.toLowerCase() === "true" ? !0 : t.toLowerCase() === "false" ? !1 : null;
|
|
70
|
+
}
|
|
71
|
+
function ue(t, e) {
|
|
72
|
+
if (typeof e == "number") {
|
|
73
|
+
const i = Number(t);
|
|
74
|
+
return Number.isFinite(i) ? i : t;
|
|
75
|
+
}
|
|
76
|
+
return typeof e == "boolean" ? pe(t) ?? t : t;
|
|
77
|
+
}
|
|
78
|
+
function E(t, e) {
|
|
79
|
+
const i = ue(e, t);
|
|
80
|
+
if (typeof t == "string" && typeof i == "string")
|
|
81
|
+
return t.toLocaleLowerCase() === i.toLocaleLowerCase();
|
|
82
|
+
if (t instanceof Date) {
|
|
83
|
+
const s = new Date(i);
|
|
84
|
+
return !Number.isNaN(s.getTime()) && t.getTime() === s.getTime();
|
|
85
|
+
}
|
|
86
|
+
return Object.is(t, i);
|
|
87
|
+
}
|
|
88
|
+
function C(t) {
|
|
89
|
+
if (t instanceof Date) return t.getTime();
|
|
90
|
+
if (typeof t == "number") return t;
|
|
91
|
+
if (typeof t == "boolean") return t ? 1 : 0;
|
|
92
|
+
if (typeof t == "string") {
|
|
93
|
+
const e = t.trim(), i = Number(e);
|
|
94
|
+
if (e && Number.isFinite(i)) return i;
|
|
95
|
+
if (/^\d{4}-\d{2}-\d{2}(?:T|$)/.test(e)) {
|
|
96
|
+
const s = new Date(e).getTime();
|
|
97
|
+
if (!Number.isNaN(s)) return s;
|
|
98
|
+
}
|
|
99
|
+
return e.toLocaleLowerCase();
|
|
100
|
+
}
|
|
101
|
+
return String(t ?? "").toLocaleLowerCase();
|
|
102
|
+
}
|
|
103
|
+
function ce(t, e, i) {
|
|
104
|
+
const l = W(e.property, i)?.property || e.property, p = $(t, l), c = e.operator || "==", a = Array.isArray(e.values) ? e.values : (c === "in" || c === "notIn") && typeof e.value == "string" ? e.value.split(",").map((m) => m.trim()) : [];
|
|
105
|
+
if ([">", ">=", "<", "<="].includes(c) && (S(p) || S(e.value)))
|
|
106
|
+
return !1;
|
|
107
|
+
switch (c) {
|
|
108
|
+
case "==":
|
|
109
|
+
case "equals":
|
|
110
|
+
return E(p, e.value);
|
|
111
|
+
case "!=":
|
|
112
|
+
case "not_equals":
|
|
113
|
+
return !E(p, e.value);
|
|
114
|
+
case ">":
|
|
115
|
+
return C(p) > C(e.value);
|
|
116
|
+
case ">=":
|
|
117
|
+
return C(p) >= C(e.value);
|
|
118
|
+
case "<":
|
|
119
|
+
return C(p) < C(e.value);
|
|
120
|
+
case "<=":
|
|
121
|
+
return C(p) <= C(e.value);
|
|
122
|
+
case "contains":
|
|
123
|
+
return Array.isArray(p) ? p.some((m) => E(m, e.value)) : String(p ?? "").toLocaleLowerCase().includes(String(e.value ?? "").toLocaleLowerCase());
|
|
124
|
+
case "startsWith":
|
|
125
|
+
return String(p ?? "").toLocaleLowerCase().startsWith(String(e.value ?? "").toLocaleLowerCase());
|
|
126
|
+
case "endsWith":
|
|
127
|
+
return String(p ?? "").toLocaleLowerCase().endsWith(String(e.value ?? "").toLocaleLowerCase());
|
|
128
|
+
case "in":
|
|
129
|
+
return a.some((m) => E(p, m));
|
|
130
|
+
case "notIn":
|
|
131
|
+
return !a.some((m) => E(p, m));
|
|
132
|
+
case "isEmpty":
|
|
133
|
+
return S(p);
|
|
134
|
+
case "isNotEmpty":
|
|
135
|
+
return !S(p);
|
|
136
|
+
default:
|
|
137
|
+
throw new Error(`Unsupported table filter operator "${c}".`);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
function qe(t, e, i = []) {
|
|
141
|
+
if (!Array.isArray(e) || !e.length) return [...t];
|
|
142
|
+
for (const s of e) {
|
|
143
|
+
if (!s || typeof s.property != "string" || !s.property.trim())
|
|
144
|
+
throw new Error("Every table filter needs a property.");
|
|
145
|
+
if (i.length && !W(s.property, i))
|
|
146
|
+
throw new Error(`Unknown table filter property "${s.property}". Use a property or label reported by inspectTable.`);
|
|
147
|
+
}
|
|
148
|
+
return t.filter((s) => e.every((l) => ce(s, l, i)));
|
|
149
|
+
}
|
|
150
|
+
function Ye(t, e, i = "asc", s = []) {
|
|
151
|
+
if (!e) return [...t];
|
|
152
|
+
const l = W(e, s);
|
|
153
|
+
if (s.length && !l)
|
|
154
|
+
throw new Error(`Unknown table sort property "${e}". Use a property or label reported by inspectTable.`);
|
|
155
|
+
const p = l?.property || e, c = i === "desc" ? -1 : 1;
|
|
156
|
+
return t.map((a, m) => ({ row: a, index: m })).sort((a, m) => {
|
|
157
|
+
const x = $(a.row, p), k = $(m.row, p);
|
|
158
|
+
if (S(x) && S(k)) return a.index - m.index;
|
|
159
|
+
if (S(x)) return 1;
|
|
160
|
+
if (S(k)) return -1;
|
|
161
|
+
const T = C(x), R = C(k);
|
|
162
|
+
return T < R ? -1 * c : T > R ? 1 * c : a.index - m.index;
|
|
163
|
+
}).map((a) => a.row);
|
|
164
|
+
}
|
|
165
|
+
function Ze(t, e, i, s) {
|
|
166
|
+
return t.filter((l) => {
|
|
167
|
+
const p = $(l, e);
|
|
168
|
+
if (p == null || p === "") return !1;
|
|
169
|
+
const a = (p instanceof Date ? p : typeof p == "string" && /^\d{4}-\d{2}-\d{2}$/.test(p) ? /* @__PURE__ */ new Date(`${p}T00:00:00.000`) : new Date(p)).getTime();
|
|
170
|
+
return !Number.isNaN(a) && a >= i.getTime() && a <= s.getTime();
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
function de(t) {
|
|
174
|
+
return t === null || ["string", "number", "boolean"].includes(typeof t);
|
|
175
|
+
}
|
|
176
|
+
function Xe(t, e, i = []) {
|
|
177
|
+
const s = ["id", "_id", "uuid", "key", "email", "slug"], l = i.length ? i : le(e), p = Array.from(/* @__PURE__ */ new Set([
|
|
178
|
+
...s,
|
|
179
|
+
...l.map((m) => m.property),
|
|
180
|
+
...Object.keys(t || {})
|
|
181
|
+
])).filter((m) => !V.has(m)), c = [];
|
|
182
|
+
let a = [...e];
|
|
183
|
+
for (const m of p) {
|
|
184
|
+
const x = $(t, m);
|
|
185
|
+
if (!de(x) || x === "") continue;
|
|
186
|
+
const k = a.filter((T) => E($(T, m), x));
|
|
187
|
+
if (k.length) {
|
|
188
|
+
if (a.length === 1) return [{ property: m, value: x }];
|
|
189
|
+
if (k.length !== a.length) {
|
|
190
|
+
if (c.push({ property: m, value: x }), a = k, a.length === 1) return c;
|
|
191
|
+
if (c.length >= 3) break;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return a.length === 1 && c.length ? c : null;
|
|
196
|
+
}
|
|
197
|
+
function Ge(t, e = 512 * 1024) {
|
|
198
|
+
const i = /* @__PURE__ */ new WeakSet(), s = JSON.stringify(t, (p, c) => {
|
|
199
|
+
if (!V.has(p)) {
|
|
200
|
+
if (typeof c == "bigint") return String(c);
|
|
201
|
+
if (c instanceof Date) return c.toISOString();
|
|
202
|
+
if (c && typeof c == "object") {
|
|
203
|
+
if (i.has(c)) return "[Circular]";
|
|
204
|
+
i.add(c);
|
|
205
|
+
}
|
|
206
|
+
return c;
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
if (s === void 0) throw new Error("The table result is not JSON serializable.");
|
|
210
|
+
const l = new TextEncoder().encode(s).byteLength;
|
|
211
|
+
if (l > e)
|
|
212
|
+
throw new Error(`The table result is too large to store (${Math.ceil(l / 1024)} KB). Narrow the query or lower the row limit.`);
|
|
213
|
+
return JSON.parse(s);
|
|
214
|
+
}
|
|
215
|
+
const fe = { class: "w-full min-w-0 overflow-hidden rounded-xl border bg-background" }, ye = {
|
|
216
|
+
key: 0,
|
|
217
|
+
class: "flex items-start gap-2.5 border-b bg-muted/30 px-3 py-2.5"
|
|
218
|
+
}, me = { class: "mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-lg bg-primary/10" }, ge = { class: "min-w-0 flex-1" }, be = {
|
|
219
|
+
key: 0,
|
|
220
|
+
class: "truncate text-xs font-semibold"
|
|
221
|
+
}, he = {
|
|
222
|
+
key: 1,
|
|
223
|
+
class: "mt-0.5 text-[11px] leading-relaxed text-muted-foreground"
|
|
224
|
+
}, xe = {
|
|
225
|
+
key: 0,
|
|
226
|
+
class: "shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10px] tabular-nums text-muted-foreground"
|
|
227
|
+
}, we = {
|
|
228
|
+
key: 1,
|
|
229
|
+
class: "flex flex-col items-center px-4 py-8 text-center"
|
|
230
|
+
}, ke = { class: "text-xs text-muted-foreground" }, ve = {
|
|
231
|
+
key: 2,
|
|
232
|
+
class: "flex flex-col items-center px-4 py-8 text-center"
|
|
233
|
+
}, _e = {
|
|
234
|
+
key: 3,
|
|
235
|
+
class: "grid gap-x-5 gap-y-3 p-3 sm:grid-cols-2"
|
|
236
|
+
}, Le = { class: "mb-1 text-[10px] font-medium uppercase tracking-wide text-muted-foreground" }, Ce = ["src", "alt"], Se = {
|
|
237
|
+
key: 1,
|
|
238
|
+
class: "flex size-16 items-center justify-center rounded-lg border bg-muted/30"
|
|
239
|
+
}, Ae = ["href"], Ne = ["href"], $e = ["href"], Te = ["title"], ze = {
|
|
240
|
+
key: 4,
|
|
241
|
+
class: "overflow-x-auto"
|
|
242
|
+
}, Ee = { class: "w-full min-w-max text-left text-xs" }, Re = { class: "border-b bg-muted/30" }, De = ["src", "alt"], Ue = {
|
|
243
|
+
key: 1,
|
|
244
|
+
class: "flex size-8 items-center justify-center rounded-md border bg-muted/30"
|
|
245
|
+
}, je = ["href"], Oe = { class: "truncate" }, Fe = ["href"], Ve = ["href"], Me = ["title"], Be = {
|
|
246
|
+
key: 5,
|
|
247
|
+
class: "flex flex-wrap items-center gap-x-3 gap-y-1 border-t bg-muted/20 px-3 py-2 text-[10px] text-muted-foreground"
|
|
248
|
+
}, Ie = { key: 0 }, We = { key: 1 }, Qe = /* @__PURE__ */ ie({
|
|
249
|
+
__name: "TableResultView",
|
|
250
|
+
props: {
|
|
251
|
+
rows: { default: () => [] },
|
|
252
|
+
columns: { default: () => [] },
|
|
253
|
+
title: { default: "" },
|
|
254
|
+
description: { default: "" },
|
|
255
|
+
totalCount: { default: void 0 },
|
|
256
|
+
emptyText: { default: "No matching rows found." },
|
|
257
|
+
maxRows: { default: 20 },
|
|
258
|
+
maxColumns: { default: 12 },
|
|
259
|
+
currency: { default: "EUR" },
|
|
260
|
+
view: { default: "auto" }
|
|
261
|
+
},
|
|
262
|
+
setup(t) {
|
|
263
|
+
const e = t, i = _(() => R(e.maxRows, 1, 100, 20)), s = _(() => R(e.maxColumns, 1, 20, 12)), l = _(
|
|
264
|
+
() => (Array.isArray(e.rows) ? e.rows : []).filter((r) => r != null).map((r) => typeof r == "object" && !Array.isArray(r) ? r : { value: r })
|
|
265
|
+
), p = _(() => {
|
|
266
|
+
const r = Array.isArray(e.columns) ? e.columns : [], y = r.filter((o) => o && o.visible !== !1 && (o.property || o.key)).map((o, g) => {
|
|
267
|
+
const D = String(o.property || o.key);
|
|
268
|
+
return {
|
|
269
|
+
id: String(o.id || D || g),
|
|
270
|
+
property: D,
|
|
271
|
+
label: o.label || J(D),
|
|
272
|
+
type: o.type || H(D, l.value.map((ne) => d(ne, D)))
|
|
273
|
+
};
|
|
274
|
+
});
|
|
275
|
+
if (r.length > 0) return te(y);
|
|
276
|
+
const n = [], h = /* @__PURE__ */ new Set();
|
|
277
|
+
for (const o of l.value.slice(0, 10))
|
|
278
|
+
for (const g of Object.keys(o))
|
|
279
|
+
h.has(g) || (h.add(g), n.push(g));
|
|
280
|
+
return n.map((o) => ({
|
|
281
|
+
id: o,
|
|
282
|
+
property: o,
|
|
283
|
+
label: J(o),
|
|
284
|
+
type: H(o, l.value.map((g) => d(g, o)))
|
|
285
|
+
}));
|
|
286
|
+
}), c = _(() => p.value.slice(0, s.value)), a = _(() => l.value.slice(0, i.value)), m = _(() => Math.max(p.value.length - c.value.length, 0)), x = _(() => {
|
|
287
|
+
const r = Number(e.totalCount);
|
|
288
|
+
return Number.isFinite(r) && r >= l.value.length ? r : l.value.length;
|
|
289
|
+
}), k = _(() => Math.max(x.value - a.value.length, 0)), T = _(() => a.value.length === 1 && (e.view === "card" || e.view === "metric" || e.view === "auto" && x.value === 1));
|
|
290
|
+
function R(r, y, n, h) {
|
|
291
|
+
const o = Number(r);
|
|
292
|
+
return Number.isFinite(o) ? Math.min(Math.max(Math.floor(o), y), n) : h;
|
|
293
|
+
}
|
|
294
|
+
function te(r) {
|
|
295
|
+
const y = /* @__PURE__ */ new Set();
|
|
296
|
+
return r.filter((n) => y.has(n.property) ? !1 : (y.add(n.property), !0));
|
|
297
|
+
}
|
|
298
|
+
function d(r, y) {
|
|
299
|
+
const n = y.split(".");
|
|
300
|
+
if (!n.some((h) => ["__proto__", "constructor", "prototype"].includes(h)))
|
|
301
|
+
return Object.prototype.hasOwnProperty.call(r, y) ? r[y] : n.reduce((h, o) => h?.[o], r);
|
|
302
|
+
}
|
|
303
|
+
function J(r) {
|
|
304
|
+
return r.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_.-]+/g, " ").replace(/\s+/g, " ").trim().replace(/\b\w/g, (y) => y.toUpperCase());
|
|
305
|
+
}
|
|
306
|
+
function H(r, y) {
|
|
307
|
+
const h = r.toLowerCase().replace(/[_.-]/g, "");
|
|
308
|
+
if (/(image|photo|avatar|thumbnail|logo|picture)$/.test(h)) return "image";
|
|
309
|
+
if (/(email)$/.test(h)) return "email";
|
|
310
|
+
if (/(phone|mobile|telephone|tel)$/.test(h)) return "phone";
|
|
311
|
+
if (/(url|link|website|href)$/.test(h)) return "URL";
|
|
312
|
+
if (/(price|amount|cost|total|revenue|salary|fee)$/.test(h)) return "currency";
|
|
313
|
+
if (/(date|createdat|updatedat|timestamp)$/.test(h)) return "datetime";
|
|
314
|
+
const o = y.filter((g) => g != null && g !== "");
|
|
315
|
+
return o.length === 0 ? "text" : o.every((g) => typeof g == "boolean") ? "boolean" : o.every((g) => Array.isArray(g)) ? "array" : o.every((g) => typeof g == "number") ? "number" : o.every((g) => typeof g == "string" && /^https?:\/\//i.test(g)) ? "URL" : o.every((g) => typeof g == "string" && /^\d{4}-\d{2}-\d{2}(?:T|$)/.test(g)) ? o.some((g) => String(g).includes("T")) ? "datetime" : "date" : "text";
|
|
316
|
+
}
|
|
317
|
+
function z(r) {
|
|
318
|
+
return r == null || r === "";
|
|
319
|
+
}
|
|
320
|
+
function M(r) {
|
|
321
|
+
if (typeof r != "string") return !1;
|
|
322
|
+
try {
|
|
323
|
+
const y = new URL(r, typeof window > "u" ? "https://localhost" : window.location.origin);
|
|
324
|
+
return y.protocol === "http:" || y.protocol === "https:";
|
|
325
|
+
} catch {
|
|
326
|
+
return !1;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
function K(r) {
|
|
330
|
+
return M(r) || typeof r == "string" && /^data:image\/(?:png|jpe?g|gif|webp|avif);base64,/i.test(r);
|
|
331
|
+
}
|
|
332
|
+
function v(r, y) {
|
|
333
|
+
if (z(r)) return "—";
|
|
334
|
+
switch (y.type) {
|
|
335
|
+
case "boolean":
|
|
336
|
+
return r ? "Yes" : "No";
|
|
337
|
+
case "number": {
|
|
338
|
+
const n = Number(r);
|
|
339
|
+
return Number.isFinite(n) ? n.toLocaleString(void 0, { maximumFractionDigits: 2 }) : String(r);
|
|
340
|
+
}
|
|
341
|
+
case "currency": {
|
|
342
|
+
const n = typeof r == "number" ? r : Number(String(r).replace(",", "."));
|
|
343
|
+
if (!Number.isFinite(n)) return String(r);
|
|
344
|
+
try {
|
|
345
|
+
return new Intl.NumberFormat(void 0, { style: "currency", currency: e.currency }).format(n);
|
|
346
|
+
} catch {
|
|
347
|
+
return `${n.toLocaleString(void 0, { maximumFractionDigits: 2 })} ${e.currency}`;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
case "date":
|
|
351
|
+
case "datetime": {
|
|
352
|
+
const n = new Date(r);
|
|
353
|
+
return Number.isNaN(n.getTime()) ? String(r) : y.type === "date" ? n.toLocaleDateString() : n.toLocaleString();
|
|
354
|
+
}
|
|
355
|
+
case "array-counter":
|
|
356
|
+
return Array.isArray(r) ? String(r.length) : "0";
|
|
357
|
+
case "array":
|
|
358
|
+
return Array.isArray(r) ? B(r.map(U).join(", "), 160) : String(r);
|
|
359
|
+
case "html":
|
|
360
|
+
return B(re(String(r)), 160);
|
|
361
|
+
default:
|
|
362
|
+
return B(U(r), 180);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
function U(r) {
|
|
366
|
+
if (z(r)) return "—";
|
|
367
|
+
if (r instanceof Date) return r.toLocaleString();
|
|
368
|
+
if (typeof r == "string") return r;
|
|
369
|
+
if (typeof r == "number" || typeof r == "boolean" || typeof r == "bigint") return String(r);
|
|
370
|
+
try {
|
|
371
|
+
return JSON.stringify(r);
|
|
372
|
+
} catch {
|
|
373
|
+
return String(r);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
function re(r) {
|
|
377
|
+
if (typeof document > "u") return r.replace(/<[^>]*>/g, " ");
|
|
378
|
+
const y = document.createElement("div");
|
|
379
|
+
return y.innerHTML = r, y.textContent || "";
|
|
380
|
+
}
|
|
381
|
+
function B(r, y) {
|
|
382
|
+
return r.length > y ? `${r.slice(0, y - 1)}…` : r;
|
|
383
|
+
}
|
|
384
|
+
return (r, y) => (u(), f("div", fe, [
|
|
385
|
+
t.title || t.description ? (u(), f("div", ye, [
|
|
386
|
+
L("div", me, [
|
|
387
|
+
A(w(q), { class: "size-3.5 text-primary" })
|
|
388
|
+
]),
|
|
389
|
+
L("div", ge, [
|
|
390
|
+
t.title ? (u(), f("p", be, b(t.title), 1)) : N("", !0),
|
|
391
|
+
t.description ? (u(), f("p", he, b(t.description), 1)) : N("", !0)
|
|
392
|
+
]),
|
|
393
|
+
x.value > 0 ? (u(), f("span", xe, b(x.value) + " " + b(x.value === 1 ? "row" : "rows"), 1)) : N("", !0)
|
|
394
|
+
])) : N("", !0),
|
|
395
|
+
a.value.length === 0 ? (u(), f("div", we, [
|
|
396
|
+
A(w(q), { class: "mb-2 size-7 text-muted-foreground/50" }),
|
|
397
|
+
L("p", ke, b(t.emptyText), 1)
|
|
398
|
+
])) : c.value.length === 0 ? (u(), f("div", ve, [
|
|
399
|
+
A(w(se), { class: "mb-2 size-7 text-muted-foreground/50" }),
|
|
400
|
+
y[0] || (y[0] = L("p", { class: "text-xs text-muted-foreground" }, "No visible columns are configured.", -1))
|
|
401
|
+
])) : T.value ? (u(), f("div", _e, [
|
|
402
|
+
(u(!0), f(j, null, O(c.value, (n) => (u(), f("div", {
|
|
403
|
+
key: n.id,
|
|
404
|
+
class: "min-w-0"
|
|
405
|
+
}, [
|
|
406
|
+
L("p", Le, b(n.label), 1),
|
|
407
|
+
n.type === "image" && K(d(a.value[0], n.property)) ? (u(), f("img", {
|
|
408
|
+
key: 0,
|
|
409
|
+
src: d(a.value[0], n.property),
|
|
410
|
+
alt: n.label,
|
|
411
|
+
class: "size-16 rounded-lg border object-cover"
|
|
412
|
+
}, null, 8, Ce)) : n.type === "image" ? (u(), f("div", Se, [
|
|
413
|
+
A(w(Y), { class: "size-5 text-muted-foreground/50" })
|
|
414
|
+
])) : n.type === "URL" && M(d(a.value[0], n.property)) ? (u(), f("a", {
|
|
415
|
+
key: 2,
|
|
416
|
+
href: d(a.value[0], n.property),
|
|
417
|
+
target: "_blank",
|
|
418
|
+
rel: "noopener noreferrer",
|
|
419
|
+
class: "inline-flex max-w-full items-center gap-1 break-all text-xs text-primary hover:underline"
|
|
420
|
+
}, [
|
|
421
|
+
I(b(v(d(a.value[0], n.property), n)) + " ", 1),
|
|
422
|
+
A(w(Z), { class: "size-3 shrink-0" })
|
|
423
|
+
], 8, Ae)) : n.type === "email" && !z(d(a.value[0], n.property)) ? (u(), f("a", {
|
|
424
|
+
key: 3,
|
|
425
|
+
href: `mailto:${d(a.value[0], n.property)}`,
|
|
426
|
+
class: "break-all text-xs text-primary hover:underline"
|
|
427
|
+
}, b(v(d(a.value[0], n.property), n)), 9, Ne)) : n.type === "phone" && !z(d(a.value[0], n.property)) ? (u(), f("a", {
|
|
428
|
+
key: 4,
|
|
429
|
+
href: `tel:${d(a.value[0], n.property)}`,
|
|
430
|
+
class: "text-xs text-primary hover:underline"
|
|
431
|
+
}, b(v(d(a.value[0], n.property), n)), 9, $e)) : n.type === "boolean" ? (u(), f("span", {
|
|
432
|
+
key: 5,
|
|
433
|
+
class: P(["inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-medium", d(a.value[0], n.property) ? "bg-emerald-500/10 text-emerald-700 dark:text-emerald-300" : "bg-muted text-muted-foreground"])
|
|
434
|
+
}, [
|
|
435
|
+
d(a.value[0], n.property) ? (u(), F(w(X), {
|
|
436
|
+
key: 0,
|
|
437
|
+
class: "size-3"
|
|
438
|
+
})) : (u(), F(w(G), {
|
|
439
|
+
key: 1,
|
|
440
|
+
class: "size-3"
|
|
441
|
+
})),
|
|
442
|
+
I(" " + b(v(d(a.value[0], n.property), n)), 1)
|
|
443
|
+
], 2)) : (u(), f("p", {
|
|
444
|
+
key: 6,
|
|
445
|
+
class: "break-words text-xs font-medium",
|
|
446
|
+
title: U(d(a.value[0], n.property))
|
|
447
|
+
}, b(v(d(a.value[0], n.property), n)), 9, Te))
|
|
448
|
+
]))), 128))
|
|
449
|
+
])) : (u(), f("div", ze, [
|
|
450
|
+
L("table", Ee, [
|
|
451
|
+
L("thead", null, [
|
|
452
|
+
L("tr", Re, [
|
|
453
|
+
(u(!0), f(j, null, O(c.value, (n) => (u(), f("th", {
|
|
454
|
+
key: n.id,
|
|
455
|
+
class: "whitespace-nowrap px-3 py-2 text-[10px] font-medium uppercase tracking-wide text-muted-foreground"
|
|
456
|
+
}, b(n.label), 1))), 128))
|
|
457
|
+
])
|
|
458
|
+
]),
|
|
459
|
+
L("tbody", null, [
|
|
460
|
+
(u(!0), f(j, null, O(a.value, (n, h) => (u(), f("tr", {
|
|
461
|
+
key: h,
|
|
462
|
+
class: "border-b last:border-b-0 hover:bg-muted/20"
|
|
463
|
+
}, [
|
|
464
|
+
(u(!0), f(j, null, O(c.value, (o) => (u(), f("td", {
|
|
465
|
+
key: o.id,
|
|
466
|
+
class: "max-w-56 px-3 py-2 align-middle"
|
|
467
|
+
}, [
|
|
468
|
+
o.type === "image" && K(d(n, o.property)) ? (u(), f("img", {
|
|
469
|
+
key: 0,
|
|
470
|
+
src: d(n, o.property),
|
|
471
|
+
alt: o.label,
|
|
472
|
+
class: "size-8 rounded-md border object-cover"
|
|
473
|
+
}, null, 8, De)) : o.type === "image" ? (u(), f("div", Ue, [
|
|
474
|
+
A(w(Y), { class: "size-3.5 text-muted-foreground/50" })
|
|
475
|
+
])) : o.type === "URL" && M(d(n, o.property)) ? (u(), f("a", {
|
|
476
|
+
key: 2,
|
|
477
|
+
href: d(n, o.property),
|
|
478
|
+
target: "_blank",
|
|
479
|
+
rel: "noopener noreferrer",
|
|
480
|
+
class: "inline-flex max-w-48 items-center gap-1 truncate text-primary hover:underline"
|
|
481
|
+
}, [
|
|
482
|
+
L("span", Oe, b(v(d(n, o.property), o)), 1),
|
|
483
|
+
A(w(Z), { class: "size-3 shrink-0" })
|
|
484
|
+
], 8, je)) : o.type === "email" && !z(d(n, o.property)) ? (u(), f("a", {
|
|
485
|
+
key: 3,
|
|
486
|
+
href: `mailto:${d(n, o.property)}`,
|
|
487
|
+
class: "block max-w-48 truncate text-primary hover:underline"
|
|
488
|
+
}, b(v(d(n, o.property), o)), 9, Fe)) : o.type === "phone" && !z(d(n, o.property)) ? (u(), f("a", {
|
|
489
|
+
key: 4,
|
|
490
|
+
href: `tel:${d(n, o.property)}`,
|
|
491
|
+
class: "whitespace-nowrap text-primary hover:underline"
|
|
492
|
+
}, b(v(d(n, o.property), o)), 9, Ve)) : o.type === "boolean" ? (u(), f("span", {
|
|
493
|
+
key: 5,
|
|
494
|
+
class: P(["inline-flex items-center gap-1 rounded-full px-1.5 py-0.5 text-[10px] font-medium", d(n, o.property) ? "bg-emerald-500/10 text-emerald-700 dark:text-emerald-300" : "bg-muted text-muted-foreground"])
|
|
495
|
+
}, [
|
|
496
|
+
d(n, o.property) ? (u(), F(w(X), {
|
|
497
|
+
key: 0,
|
|
498
|
+
class: "size-2.5"
|
|
499
|
+
})) : (u(), F(w(G), {
|
|
500
|
+
key: 1,
|
|
501
|
+
class: "size-2.5"
|
|
502
|
+
})),
|
|
503
|
+
I(" " + b(v(d(n, o.property), o)), 1)
|
|
504
|
+
], 2)) : (u(), f("span", {
|
|
505
|
+
key: 6,
|
|
506
|
+
class: "block max-w-56 truncate",
|
|
507
|
+
title: U(d(n, o.property))
|
|
508
|
+
}, b(v(d(n, o.property), o)), 9, Me))
|
|
509
|
+
]))), 128))
|
|
510
|
+
]))), 128))
|
|
511
|
+
])
|
|
512
|
+
])
|
|
513
|
+
])),
|
|
514
|
+
a.value.length > 0 && (r.$slots.footer || k.value > 0 || m.value > 0) ? (u(), f("div", Be, [
|
|
515
|
+
oe(r.$slots, "footer"),
|
|
516
|
+
!r.$slots.footer && k.value > 0 ? (u(), f("span", Ie, "Showing " + b(a.value.length) + " of " + b(x.value) + " rows", 1)) : N("", !0),
|
|
517
|
+
m.value > 0 ? (u(), f("span", We, b(m.value) + " more " + b(m.value === 1 ? "column" : "columns") + " hidden", 1)) : N("", !0)
|
|
518
|
+
])) : N("", !0)
|
|
519
|
+
]));
|
|
520
|
+
}
|
|
521
|
+
});
|
|
522
|
+
export {
|
|
523
|
+
Qe as _,
|
|
524
|
+
$ as a,
|
|
525
|
+
Xe as b,
|
|
526
|
+
Ze as c,
|
|
527
|
+
qe as d,
|
|
528
|
+
Ye as e,
|
|
529
|
+
Pe as f,
|
|
530
|
+
le as i,
|
|
531
|
+
Ke as n,
|
|
532
|
+
W as r,
|
|
533
|
+
Ge as s
|
|
534
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("vue"),h=require("lucide-vue-next"),T=new Set(["__proto__","constructor","prototype"]);function v(r,t){if(!r||!t)return;const a=t.split(".");if(!a.some(s=>T.has(s)))return Object.prototype.hasOwnProperty.call(r,t)?r[t]:a.reduce((s,c)=>s?.[c],r)}function F(r){return r.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_.-]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,t=>t.toUpperCase())}function W(r,t){const a=r.toLowerCase().replace(/[_.-]/g,"");if(/email$/.test(a))return"email";if(/(phone|mobile|telephone|tel)$/.test(a))return"phone";if(/(image|photo|avatar|thumbnail|logo|picture)$/.test(a))return"image";if(/(url|link|website|href)$/.test(a))return"URL";if(/(price|amount|cost|total|revenue|salary|fee)$/.test(a))return"currency";if(/(createdat|updatedat|timestamp)$/.test(a))return"datetime";if(/date$/.test(a))return"date";const s=t.filter(c=>c!=null&&c!=="");return s.length?s.every(c=>typeof c=="boolean")?"boolean":s.every(c=>typeof c=="number")?"number":s.every(c=>Array.isArray(c))?"array":s.every(c=>typeof c=="string"&&/^\d{4}-\d{2}-\d{2}(?:T|$)/.test(c))?s.some(c=>String(c).includes("T"))?"datetime":"date":"text":"text"}function q(r){if(r==null)return[];const t=Array.isArray(r)?r:Array.isArray(r?.data)?r.data:Array.isArray(r?.items)?r.items:Array.isArray(r?.rows)?r.rows:null;if(!t)throw new Error("The Fetch items flow must return an array of rows.");return t.map(a=>a&&typeof a=="object"&&!Array.isArray(a)?a:{value:a})}function J(r){return Array.isArray(r)?r.filter(t=>t&&typeof t.property=="string"&&t.property.trim()).map((t,a)=>({...t,id:typeof t.id=="string"?t.id:`column-${a}`,property:t.property.trim(),label:typeof t.label=="string"&&t.label.trim()?t.label.trim():F(t.property),type:typeof t.type=="string"&&t.type?t.type:"text",visible:t.visible!==!1})):[]}function U(r,t,a,s){if(!(!r||typeof r!="object"||Array.isArray(r)||s>=2))for(const[c,p]of Object.entries(r)){if(T.has(c))continue;const u=t?`${t}.${c}`:c;p&&typeof p=="object"&&!Array.isArray(p)&&!(p instanceof Date)?U(p,u,a,s+1):a.add(u)}}function j(r){const t=new Set;for(const a of r.slice(0,10))U(a,"",t,0);return Array.from(t).slice(0,40).map((a,s)=>({id:`inferred-${s}`,property:a,label:F(a),type:W(a,r.map(c=>v(c,a))),visible:!0}))}function A(r,t){const a=String(r||"").trim().toLocaleLowerCase();return a&&(t.find(s=>s.property.toLocaleLowerCase()===a)||t.find(s=>String(s.label||"").trim().toLocaleLowerCase()===a)||t.find(s=>String(s.id||"").trim().toLocaleLowerCase()===a))||null}function B(r){return r==null||r===""||Array.isArray(r)&&r.length===0}function P(r){return typeof r=="boolean"?r:typeof r!="string"?null:r.toLowerCase()==="true"?!0:r.toLowerCase()==="false"?!1:null}function H(r,t){if(typeof t=="number"){const a=Number(r);return Number.isFinite(a)?a:r}return typeof t=="boolean"?P(r)??r:r}function E(r,t){const a=H(t,r);if(typeof r=="string"&&typeof a=="string")return r.toLocaleLowerCase()===a.toLocaleLowerCase();if(r instanceof Date){const s=new Date(a);return!Number.isNaN(s.getTime())&&r.getTime()===s.getTime()}return Object.is(r,a)}function w(r){if(r instanceof Date)return r.getTime();if(typeof r=="number")return r;if(typeof r=="boolean")return r?1:0;if(typeof r=="string"){const t=r.trim(),a=Number(t);if(t&&Number.isFinite(a))return a;if(/^\d{4}-\d{2}-\d{2}(?:T|$)/.test(t)){const s=new Date(t).getTime();if(!Number.isNaN(s))return s}return t.toLocaleLowerCase()}return String(r??"").toLocaleLowerCase()}function K(r,t,a){const c=A(t.property,a)?.property||t.property,p=v(r,c),u=t.operator||"==",l=Array.isArray(t.values)?t.values:(u==="in"||u==="notIn")&&typeof t.value=="string"?t.value.split(",").map(y=>y.trim()):[];if([">",">=","<","<="].includes(u)&&(B(p)||B(t.value)))return!1;switch(u){case"==":case"equals":return E(p,t.value);case"!=":case"not_equals":return!E(p,t.value);case">":return w(p)>w(t.value);case">=":return w(p)>=w(t.value);case"<":return w(p)<w(t.value);case"<=":return w(p)<=w(t.value);case"contains":return Array.isArray(p)?p.some(y=>E(y,t.value)):String(p??"").toLocaleLowerCase().includes(String(t.value??"").toLocaleLowerCase());case"startsWith":return String(p??"").toLocaleLowerCase().startsWith(String(t.value??"").toLocaleLowerCase());case"endsWith":return String(p??"").toLocaleLowerCase().endsWith(String(t.value??"").toLocaleLowerCase());case"in":return l.some(y=>E(p,y));case"notIn":return!l.some(y=>E(p,y));case"isEmpty":return B(p);case"isNotEmpty":return!B(p);default:throw new Error(`Unsupported table filter operator "${u}".`)}}function X(r,t,a=[]){if(!Array.isArray(t)||!t.length)return[...r];for(const s of t){if(!s||typeof s.property!="string"||!s.property.trim())throw new Error("Every table filter needs a property.");if(a.length&&!A(s.property,a))throw new Error(`Unknown table filter property "${s.property}". Use a property or label reported by inspectTable.`)}return r.filter(s=>t.every(c=>K(s,c,a)))}function Y(r,t,a="asc",s=[]){if(!t)return[...r];const c=A(t,s);if(s.length&&!c)throw new Error(`Unknown table sort property "${t}". Use a property or label reported by inspectTable.`);const p=c?.property||t,u=a==="desc"?-1:1;return r.map((l,y)=>({row:l,index:y})).sort((l,y)=>{const b=v(l.row,p),k=v(y.row,p);if(B(b)&&B(k))return l.index-y.index;if(B(b))return 1;if(B(k))return-1;const S=w(b),N=w(k);return S<N?-1*u:S>N?1*u:l.index-y.index}).map(l=>l.row)}function Z(r,t,a,s){return r.filter(c=>{const p=v(c,t);if(p==null||p==="")return!1;const l=(p instanceof Date?p:typeof p=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(p)?new Date(`${p}T00:00:00.000`):new Date(p)).getTime();return!Number.isNaN(l)&&l>=a.getTime()&&l<=s.getTime()})}function G(r){return r===null||["string","number","boolean"].includes(typeof r)}function Q(r,t,a=[]){const s=["id","_id","uuid","key","email","slug"],c=a.length?a:j(t),p=Array.from(new Set([...s,...c.map(y=>y.property),...Object.keys(r||{})])).filter(y=>!T.has(y)),u=[];let l=[...t];for(const y of p){const b=v(r,y);if(!G(b)||b==="")continue;const k=l.filter(S=>E(v(S,y),b));if(k.length){if(l.length===1)return[{property:y,value:b}];if(k.length!==l.length){if(u.push({property:y,value:b}),l=k,l.length===1)return u;if(u.length>=3)break}}}return l.length===1&&u.length?u:null}function ee(r,t=512*1024){const a=new WeakSet,s=JSON.stringify(r,(p,u)=>{if(!T.has(p)){if(typeof u=="bigint")return String(u);if(u instanceof Date)return u.toISOString();if(u&&typeof u=="object"){if(a.has(u))return"[Circular]";a.add(u)}return u}});if(s===void 0)throw new Error("The table result is not JSON serializable.");const c=new TextEncoder().encode(s).byteLength;if(c>t)throw new Error(`The table result is too large to store (${Math.ceil(c/1024)} KB). Narrow the query or lower the row limit.`);return JSON.parse(s)}const te={class:"w-full min-w-0 overflow-hidden rounded-xl border bg-background"},re={key:0,class:"flex items-start gap-2.5 border-b bg-muted/30 px-3 py-2.5"},ne={class:"mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-lg bg-primary/10"},oe={class:"min-w-0 flex-1"},ae={key:0,class:"truncate text-xs font-semibold"},ie={key:1,class:"mt-0.5 text-[11px] leading-relaxed text-muted-foreground"},se={key:0,class:"shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10px] tabular-nums text-muted-foreground"},le={key:1,class:"flex flex-col items-center px-4 py-8 text-center"},ce={class:"text-xs text-muted-foreground"},pe={key:2,class:"flex flex-col items-center px-4 py-8 text-center"},ue={key:3,class:"grid gap-x-5 gap-y-3 p-3 sm:grid-cols-2"},de={class:"mb-1 text-[10px] font-medium uppercase tracking-wide text-muted-foreground"},fe=["src","alt"],ye={key:1,class:"flex size-16 items-center justify-center rounded-lg border bg-muted/30"},me=["href"],ge=["href"],be=["href"],he=["title"],ke={key:4,class:"overflow-x-auto"},xe={class:"w-full min-w-max text-left text-xs"},we={class:"border-b bg-muted/30"},Be=["src","alt"],ve={key:1,class:"flex size-8 items-center justify-center rounded-md border bg-muted/30"},Se=["href"],_e={class:"truncate"},Ee=["href"],Ne=["href"],Ce=["title"],Le={key:5,class:"flex flex-wrap items-center gap-x-3 gap-y-1 border-t bg-muted/20 px-3 py-2 text-[10px] text-muted-foreground"},Te={key:0},Ae={key:1},$e=e.defineComponent({__name:"TableResultView",props:{rows:{default:()=>[]},columns:{default:()=>[]},title:{default:""},description:{default:""},totalCount:{default:void 0},emptyText:{default:"No matching rows found."},maxRows:{default:20},maxColumns:{default:12},currency:{default:"EUR"},view:{default:"auto"}},setup(r){const t=r,a=e.computed(()=>N(t.maxRows,1,100,20)),s=e.computed(()=>N(t.maxColumns,1,20,12)),c=e.computed(()=>(Array.isArray(t.rows)?t.rows:[]).filter(n=>n!=null).map(n=>typeof n=="object"&&!Array.isArray(n)?n:{value:n})),p=e.computed(()=>{const n=Array.isArray(t.columns)?t.columns:[],f=n.filter(i=>i&&i.visible!==!1&&(i.property||i.key)).map((i,m)=>{const C=String(i.property||i.key);return{id:String(i.id||C||m),property:C,label:i.label||V(C),type:i.type||z(C,c.value.map(I=>d(I,C)))}});if(n.length>0)return O(f);const o=[],g=new Set;for(const i of c.value.slice(0,10))for(const m of Object.keys(i))g.has(m)||(g.add(m),o.push(m));return o.map(i=>({id:i,property:i,label:V(i),type:z(i,c.value.map(m=>d(m,i)))}))}),u=e.computed(()=>p.value.slice(0,s.value)),l=e.computed(()=>c.value.slice(0,a.value)),y=e.computed(()=>Math.max(p.value.length-u.value.length,0)),b=e.computed(()=>{const n=Number(t.totalCount);return Number.isFinite(n)&&n>=c.value.length?n:c.value.length}),k=e.computed(()=>Math.max(b.value-l.value.length,0)),S=e.computed(()=>l.value.length===1&&(t.view==="card"||t.view==="metric"||t.view==="auto"&&b.value===1));function N(n,f,o,g){const i=Number(n);return Number.isFinite(i)?Math.min(Math.max(Math.floor(i),f),o):g}function O(n){const f=new Set;return n.filter(o=>f.has(o.property)?!1:(f.add(o.property),!0))}function d(n,f){const o=f.split(".");if(!o.some(g=>["__proto__","constructor","prototype"].includes(g)))return Object.prototype.hasOwnProperty.call(n,f)?n[f]:o.reduce((g,i)=>g?.[i],n)}function V(n){return n.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_.-]+/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,f=>f.toUpperCase())}function z(n,f){const g=n.toLowerCase().replace(/[_.-]/g,"");if(/(image|photo|avatar|thumbnail|logo|picture)$/.test(g))return"image";if(/(email)$/.test(g))return"email";if(/(phone|mobile|telephone|tel)$/.test(g))return"phone";if(/(url|link|website|href)$/.test(g))return"URL";if(/(price|amount|cost|total|revenue|salary|fee)$/.test(g))return"currency";if(/(date|createdat|updatedat|timestamp)$/.test(g))return"datetime";const i=f.filter(m=>m!=null&&m!=="");return i.length===0?"text":i.every(m=>typeof m=="boolean")?"boolean":i.every(m=>Array.isArray(m))?"array":i.every(m=>typeof m=="number")?"number":i.every(m=>typeof m=="string"&&/^https?:\/\//i.test(m))?"URL":i.every(m=>typeof m=="string"&&/^\d{4}-\d{2}-\d{2}(?:T|$)/.test(m))?i.some(m=>String(m).includes("T"))?"datetime":"date":"text"}function _(n){return n==null||n===""}function $(n){if(typeof n!="string")return!1;try{const f=new URL(n,typeof window>"u"?"https://localhost":window.location.origin);return f.protocol==="http:"||f.protocol==="https:"}catch{return!1}}function R(n){return $(n)||typeof n=="string"&&/^data:image\/(?:png|jpe?g|gif|webp|avif);base64,/i.test(n)}function x(n,f){if(_(n))return"—";switch(f.type){case"boolean":return n?"Yes":"No";case"number":{const o=Number(n);return Number.isFinite(o)?o.toLocaleString(void 0,{maximumFractionDigits:2}):String(n)}case"currency":{const o=typeof n=="number"?n:Number(String(n).replace(",","."));if(!Number.isFinite(o))return String(n);try{return new Intl.NumberFormat(void 0,{style:"currency",currency:t.currency}).format(o)}catch{return`${o.toLocaleString(void 0,{maximumFractionDigits:2})} ${t.currency}`}}case"date":case"datetime":{const o=new Date(n);return Number.isNaN(o.getTime())?String(n):f.type==="date"?o.toLocaleDateString():o.toLocaleString()}case"array-counter":return Array.isArray(n)?String(n.length):"0";case"array":return Array.isArray(n)?D(n.map(L).join(", "),160):String(n);case"html":return D(M(String(n)),160);default:return D(L(n),180)}}function L(n){if(_(n))return"—";if(n instanceof Date)return n.toLocaleString();if(typeof n=="string")return n;if(typeof n=="number"||typeof n=="boolean"||typeof n=="bigint")return String(n);try{return JSON.stringify(n)}catch{return String(n)}}function M(n){if(typeof document>"u")return n.replace(/<[^>]*>/g," ");const f=document.createElement("div");return f.innerHTML=n,f.textContent||""}function D(n,f){return n.length>f?`${n.slice(0,f-1)}…`:n}return(n,f)=>(e.openBlock(),e.createElementBlock("div",te,[r.title||r.description?(e.openBlock(),e.createElementBlock("div",re,[e.createElementVNode("div",ne,[e.createVNode(e.unref(h.Table2),{class:"size-3.5 text-primary"})]),e.createElementVNode("div",oe,[r.title?(e.openBlock(),e.createElementBlock("p",ae,e.toDisplayString(r.title),1)):e.createCommentVNode("",!0),r.description?(e.openBlock(),e.createElementBlock("p",ie,e.toDisplayString(r.description),1)):e.createCommentVNode("",!0)]),b.value>0?(e.openBlock(),e.createElementBlock("span",se,e.toDisplayString(b.value)+" "+e.toDisplayString(b.value===1?"row":"rows"),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),l.value.length===0?(e.openBlock(),e.createElementBlock("div",le,[e.createVNode(e.unref(h.Table2),{class:"mb-2 size-7 text-muted-foreground/50"}),e.createElementVNode("p",ce,e.toDisplayString(r.emptyText),1)])):u.value.length===0?(e.openBlock(),e.createElementBlock("div",pe,[e.createVNode(e.unref(h.Columns3),{class:"mb-2 size-7 text-muted-foreground/50"}),f[0]||(f[0]=e.createElementVNode("p",{class:"text-xs text-muted-foreground"},"No visible columns are configured.",-1))])):S.value?(e.openBlock(),e.createElementBlock("div",ue,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,o=>(e.openBlock(),e.createElementBlock("div",{key:o.id,class:"min-w-0"},[e.createElementVNode("p",de,e.toDisplayString(o.label),1),o.type==="image"&&R(d(l.value[0],o.property))?(e.openBlock(),e.createElementBlock("img",{key:0,src:d(l.value[0],o.property),alt:o.label,class:"size-16 rounded-lg border object-cover"},null,8,fe)):o.type==="image"?(e.openBlock(),e.createElementBlock("div",ye,[e.createVNode(e.unref(h.Image),{class:"size-5 text-muted-foreground/50"})])):o.type==="URL"&&$(d(l.value[0],o.property))?(e.openBlock(),e.createElementBlock("a",{key:2,href:d(l.value[0],o.property),target:"_blank",rel:"noopener noreferrer",class:"inline-flex max-w-full items-center gap-1 break-all text-xs text-primary hover:underline"},[e.createTextVNode(e.toDisplayString(x(d(l.value[0],o.property),o))+" ",1),e.createVNode(e.unref(h.ExternalLink),{class:"size-3 shrink-0"})],8,me)):o.type==="email"&&!_(d(l.value[0],o.property))?(e.openBlock(),e.createElementBlock("a",{key:3,href:`mailto:${d(l.value[0],o.property)}`,class:"break-all text-xs text-primary hover:underline"},e.toDisplayString(x(d(l.value[0],o.property),o)),9,ge)):o.type==="phone"&&!_(d(l.value[0],o.property))?(e.openBlock(),e.createElementBlock("a",{key:4,href:`tel:${d(l.value[0],o.property)}`,class:"text-xs text-primary hover:underline"},e.toDisplayString(x(d(l.value[0],o.property),o)),9,be)):o.type==="boolean"?(e.openBlock(),e.createElementBlock("span",{key:5,class:e.normalizeClass(["inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-medium",d(l.value[0],o.property)?"bg-emerald-500/10 text-emerald-700 dark:text-emerald-300":"bg-muted text-muted-foreground"])},[d(l.value[0],o.property)?(e.openBlock(),e.createBlock(e.unref(h.Check),{key:0,class:"size-3"})):(e.openBlock(),e.createBlock(e.unref(h.X),{key:1,class:"size-3"})),e.createTextVNode(" "+e.toDisplayString(x(d(l.value[0],o.property),o)),1)],2)):(e.openBlock(),e.createElementBlock("p",{key:6,class:"break-words text-xs font-medium",title:L(d(l.value[0],o.property))},e.toDisplayString(x(d(l.value[0],o.property),o)),9,he))]))),128))])):(e.openBlock(),e.createElementBlock("div",ke,[e.createElementVNode("table",xe,[e.createElementVNode("thead",null,[e.createElementVNode("tr",we,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,o=>(e.openBlock(),e.createElementBlock("th",{key:o.id,class:"whitespace-nowrap px-3 py-2 text-[10px] font-medium uppercase tracking-wide text-muted-foreground"},e.toDisplayString(o.label),1))),128))])]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(o,g)=>(e.openBlock(),e.createElementBlock("tr",{key:g,class:"border-b last:border-b-0 hover:bg-muted/20"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,i=>(e.openBlock(),e.createElementBlock("td",{key:i.id,class:"max-w-56 px-3 py-2 align-middle"},[i.type==="image"&&R(d(o,i.property))?(e.openBlock(),e.createElementBlock("img",{key:0,src:d(o,i.property),alt:i.label,class:"size-8 rounded-md border object-cover"},null,8,Be)):i.type==="image"?(e.openBlock(),e.createElementBlock("div",ve,[e.createVNode(e.unref(h.Image),{class:"size-3.5 text-muted-foreground/50"})])):i.type==="URL"&&$(d(o,i.property))?(e.openBlock(),e.createElementBlock("a",{key:2,href:d(o,i.property),target:"_blank",rel:"noopener noreferrer",class:"inline-flex max-w-48 items-center gap-1 truncate text-primary hover:underline"},[e.createElementVNode("span",_e,e.toDisplayString(x(d(o,i.property),i)),1),e.createVNode(e.unref(h.ExternalLink),{class:"size-3 shrink-0"})],8,Se)):i.type==="email"&&!_(d(o,i.property))?(e.openBlock(),e.createElementBlock("a",{key:3,href:`mailto:${d(o,i.property)}`,class:"block max-w-48 truncate text-primary hover:underline"},e.toDisplayString(x(d(o,i.property),i)),9,Ee)):i.type==="phone"&&!_(d(o,i.property))?(e.openBlock(),e.createElementBlock("a",{key:4,href:`tel:${d(o,i.property)}`,class:"whitespace-nowrap text-primary hover:underline"},e.toDisplayString(x(d(o,i.property),i)),9,Ne)):i.type==="boolean"?(e.openBlock(),e.createElementBlock("span",{key:5,class:e.normalizeClass(["inline-flex items-center gap-1 rounded-full px-1.5 py-0.5 text-[10px] font-medium",d(o,i.property)?"bg-emerald-500/10 text-emerald-700 dark:text-emerald-300":"bg-muted text-muted-foreground"])},[d(o,i.property)?(e.openBlock(),e.createBlock(e.unref(h.Check),{key:0,class:"size-2.5"})):(e.openBlock(),e.createBlock(e.unref(h.X),{key:1,class:"size-2.5"})),e.createTextVNode(" "+e.toDisplayString(x(d(o,i.property),i)),1)],2)):(e.openBlock(),e.createElementBlock("span",{key:6,class:"block max-w-56 truncate",title:L(d(o,i.property))},e.toDisplayString(x(d(o,i.property),i)),9,Ce))]))),128))]))),128))])])])),l.value.length>0&&(n.$slots.footer||k.value>0||y.value>0)?(e.openBlock(),e.createElementBlock("div",Le,[e.renderSlot(n.$slots,"footer"),!n.$slots.footer&&k.value>0?(e.openBlock(),e.createElementBlock("span",Te,"Showing "+e.toDisplayString(l.value.length)+" of "+e.toDisplayString(b.value)+" rows",1)):e.createCommentVNode("",!0),y.value>0?(e.openBlock(),e.createElementBlock("span",Ae,e.toDisplayString(y.value)+" more "+e.toDisplayString(y.value===1?"column":"columns")+" hidden",1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]))}});exports._sfc_main=$e;exports.applyLocalDateRange=Z;exports.applyTableFilters=X;exports.applyTableSort=Y;exports.buildRowReference=Q;exports.inferTableColumns=j;exports.normalizeTableColumns=J;exports.normalizeTableRows=q;exports.resolveColumn=A;exports.resolveProperty=v;exports.serializeBounded=ee;
|