@declarion/react 0.57.0 → 0.59.0
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/README.md +0 -2
- package/dist-lib/AgentChatPanel.impl-DBH1Ff4G.js +1200 -0
- package/dist-lib/DetailAuditStrip-GNRA_eP5.js +289 -0
- package/dist-lib/{DraggableChildrenTable-BV5sb8Uo.js → DraggableChildrenTable-4RZC351U.js} +87 -86
- package/dist-lib/Grid-CQabaBLx.js +405 -0
- package/dist-lib/{LayoutRenderer-C9AH9cXf.js → LayoutRenderer-DGKWZKpW.js} +1000 -1114
- package/dist-lib/{ListCardsBody-DXcDg536.js → ListCardsBody-DfGmyNIu.js} +84 -84
- package/dist-lib/MarkdownRenderer-BDbzDv_y.js +87 -0
- package/dist-lib/{RefreshControl-CNtN8zSl.js → RefreshControl-Bhoib0ZA.js} +126 -155
- package/dist-lib/SmartDetailPage.impl-Ds2RGg6K.js +1565 -0
- package/dist-lib/SmartListPage.impl-BrZLE_Gb.js +3046 -0
- package/dist-lib/{SmartRecordListPage.impl-Bkl9aZJ8.js → SmartRecordListPage.impl-C1FJLr80.js} +281 -280
- package/dist-lib/SortHeaderMenu-Cijxk4cX.js +107 -0
- package/dist-lib/action-dispatch-DY0c8U81.js +1967 -0
- package/dist-lib/api/client.d.ts +5 -0
- package/dist-lib/api/data.d.ts +2 -4
- package/dist-lib/api/entities.d.ts +8 -15
- package/dist-lib/api/events.d.ts +3 -3
- package/dist-lib/cardProjection-Bkl2SSYz.js +499 -0
- package/dist-lib/components/actions/ResponsiveActionBar.d.ts +17 -16
- package/dist-lib/components/agents/AgentChatPanel.d.ts +3 -13
- package/dist-lib/components/agents/AgentChatPanel.impl.d.ts +14 -0
- package/dist-lib/components/agents/AgentPicker.d.ts +1 -2
- package/dist-lib/components/chrome/PageShell.d.ts +7 -0
- package/dist-lib/components/chrome/RecordHeader.d.ts +1 -2
- package/dist-lib/components/detail-layout/DetailAuditStrip.d.ts +1 -2
- package/dist-lib/components/detail-layout/DetailHighlights.d.ts +1 -2
- package/dist-lib/components/detail-layout/blockMeta.d.ts +2 -1
- package/dist-lib/components/fields/BoolField.d.ts +1 -1
- package/dist-lib/components/fields/EnumField.d.ts +1 -1
- package/dist-lib/components/fields/IntArrayField.d.ts +1 -1
- package/dist-lib/components/fields/MultilangArrayField.d.ts +2 -0
- package/dist-lib/components/fields/MultilangField.d.ts +1 -1
- package/dist-lib/components/fields/MultilangTextField.d.ts +1 -1
- package/dist-lib/components/fields/NumberField.d.ts +1 -1
- package/dist-lib/components/fields/PasswordField.d.ts +1 -1
- package/dist-lib/components/fields/RefCombobox.d.ts +1 -1
- package/dist-lib/components/fields/SecretField.d.ts +1 -1
- package/dist-lib/components/fields/StringArrayField.d.ts +1 -1
- package/dist-lib/components/fields/TimestampField.d.ts +1 -1
- package/dist-lib/components/fields/cells/registry.d.ts +2 -1
- package/dist-lib/components/fields/index.d.ts +2 -1
- package/dist-lib/components/fields/langMap.d.ts +2 -0
- package/dist-lib/components/fields/secretValue.d.ts +2 -0
- package/dist-lib/components/file-widgets/UnknownFileWidget.d.ts +3 -0
- package/dist-lib/components/file-widgets/UploadFailureText.d.ts +4 -0
- package/dist-lib/components/file-widgets/helpers.d.ts +1 -1
- package/dist-lib/components/file-widgets/host.d.ts +4 -3
- package/dist-lib/components/file-widgets/types.d.ts +1 -0
- package/dist-lib/components/file-widgets/upload.d.ts +18 -3
- package/dist-lib/components/filters/filter-op-label.d.ts +3 -0
- package/dist-lib/components/layout/ImpersonationBanner.d.ts +1 -1
- package/dist-lib/components/layout/ImpersonationFrame.d.ts +1 -1
- package/dist-lib/components/layout/Layout.d.ts +2 -1
- package/dist-lib/components/layout/Sidebar.d.ts +2 -1
- package/dist-lib/components/layout/TenantChip.d.ts +1 -1
- package/dist-lib/components/list/ViewSwitcher.d.ts +4 -2
- package/dist-lib/components/pages/DocumentsMenu.d.ts +1 -2
- package/dist-lib/components/pages/ExportMenu.d.ts +3 -5
- package/dist-lib/components/pages/RecordDocumentsPanel.d.ts +1 -2
- package/dist-lib/components/pages/auth/AuthShell.d.ts +4 -31
- package/dist-lib/components/pages/exportRequest.d.ts +4 -6
- package/dist-lib/components/pages/list/DeleteViewDialog.d.ts +8 -0
- package/dist-lib/components/pages/list/ListCardRow.d.ts +1 -2
- package/dist-lib/components/pages/list/ListCardsBody.d.ts +0 -1
- package/dist-lib/components/pages/list/ListFloatbar.d.ts +2 -2
- package/dist-lib/components/pages/list/ListHeader.d.ts +2 -2
- package/dist-lib/components/pages/list/ListNoRows.d.ts +4 -5
- package/dist-lib/components/pages/list/ListToolbar.d.ts +3 -2
- package/dist-lib/components/pages/list/ListUrlBanner.d.ts +10 -0
- package/dist-lib/components/pages/list/RowActionsCell.d.ts +2 -4
- package/dist-lib/components/pages/list/RowContextMenu.d.ts +1 -2
- package/dist-lib/components/pages/list/columns.d.ts +2 -1
- package/dist-lib/components/pages/list/filter-meta.d.ts +2 -1
- package/dist-lib/components/pages/list/useActiveView.d.ts +38 -0
- package/dist-lib/components/pages/list/useListColumnLayout.d.ts +6 -5
- package/dist-lib/components/pages/list/useListQuery.d.ts +4 -4
- package/dist-lib/components/pages/list/useListSort.d.ts +5 -4
- package/dist-lib/components/pages/list/useListViews.d.ts +18 -8
- package/dist-lib/components/pages/list/useRowMenu.d.ts +2 -3
- package/dist-lib/components/pages/profile/Profile.d.ts +3 -0
- package/dist-lib/components/params/ParamsBlock.d.ts +1 -13
- package/dist-lib/components/params/param-editors.d.ts +3 -11
- package/dist-lib/components/primitives/ClassifiedFieldLocked.d.ts +1 -2
- package/dist-lib/components/shared/DynamicIcon.d.ts +2 -2
- package/dist-lib/components/shared/LoadingSkeleton.d.ts +1 -0
- package/dist-lib/components/shared/LucideIcon.d.ts +1 -1
- package/dist-lib/components/shared/useOwnRefresh.d.ts +1 -1
- package/dist-lib/declarion-react.css +1 -1
- package/dist-lib/embed/theme.d.ts +1 -1
- package/dist-lib/embed/useEmbedNavigate.d.ts +1 -1
- package/dist-lib/failure-v-uGSpbX.js +158 -0
- package/dist-lib/{field-classification-D6xQYn-h.js → field-classification-C28XE-_P.js} +514 -307
- package/dist-lib/format-count-DA4wmmWR.js +1771 -0
- package/dist-lib/hooks/useEntityData.d.ts +1 -1
- package/dist-lib/hooks/useFilters.d.ts +7 -5
- package/dist-lib/hooks/useLanguage.d.ts +4 -0
- package/dist-lib/hooks/useParams.d.ts +4 -51
- package/dist-lib/hooks/useRegisterScreenTab.d.ts +1 -1
- package/dist-lib/hooks/useSSE.d.ts +3 -3
- package/dist-lib/hooks/useTabTitle.d.ts +2 -0
- package/dist-lib/hooks/useText.d.ts +3 -3
- package/dist-lib/hooks/useVersionWatcher.d.ts +1 -1
- package/dist-lib/hooks/useViews.d.ts +20 -0
- package/dist-lib/index.d.ts +8 -7
- package/dist-lib/index.js +2716 -5795
- package/dist-lib/lib/action-dispatch.d.ts +2 -1
- package/dist-lib/lib/actions.d.ts +30 -42
- package/dist-lib/lib/anchor.d.ts +3 -4
- package/dist-lib/lib/decimal-text.d.ts +1 -0
- package/dist-lib/lib/document-templates.d.ts +1 -2
- package/dist-lib/lib/download.d.ts +2 -1
- package/dist-lib/lib/evidence-verdict.d.ts +2 -1
- package/dist-lib/lib/failure.d.ts +2 -0
- package/dist-lib/lib/field-classification.d.ts +3 -3
- package/dist-lib/lib/filters.d.ts +18 -2
- package/dist-lib/lib/format-count.d.ts +8 -7
- package/dist-lib/lib/language.d.ts +19 -0
- package/dist-lib/lib/mass-edit.d.ts +2 -1
- package/dist-lib/lib/realtime-query-keys.d.ts +1 -1
- package/dist-lib/lib/realtime-reconcile.d.ts +3 -4
- package/dist-lib/lib/screen-back.d.ts +4 -6
- package/dist-lib/lib/sort.d.ts +9 -9
- package/dist-lib/lib/timestamp.d.ts +5 -7
- package/dist-lib/lib/ui-actions.d.ts +2 -1
- package/dist-lib/peekDraftStore-D-cTbiIr.js +199 -0
- package/dist-lib/registry-Cb3W-czW.js +1950 -0
- package/dist-lib/safe-url-oSJw5pzO.js +34 -0
- package/dist-lib/stores/icon-registry.d.ts +2 -2
- package/dist-lib/stores/list-layout.d.ts +3 -4
- package/dist-lib/stores/realtime.d.ts +1 -1
- package/dist-lib/stores/tabs.d.ts +3 -2
- package/dist-lib/testing.d.ts +6 -0
- package/dist-lib/testing.js +98 -76
- package/dist-lib/types/api.d.ts +7 -8
- package/dist-lib/types/fieldType.d.ts +1 -1
- package/dist-lib/types/files.d.ts +4 -4
- package/dist-lib/types/schema.d.ts +44 -50
- package/dist-lib/useAgentConversation-D97IqE-J.js +623 -0
- package/dist-lib/{useCurrentScreen-CzwzQpoW.js → useCurrentScreen-BL5NZFCw.js} +2777 -3768
- package/dist-lib/useListQuery-BG1GyKtJ.js +103 -0
- package/dist-lib/useProperties-4Lg3odrt.js +83 -0
- package/dist-lib/{useTabSearchMirror-C39U85cg.js → useTabSearchMirror-ZVLlINBX.js} +49 -51
- package/dist-lib/useText-BFDCTUSo.js +952 -0
- package/dist-lib/{value-Bo8C8WMU.js → value-By1-WJ8J.js} +74 -76
- package/dist-lib/vite/fingerprint-plugin.d.ts +2 -3
- package/package.json +9 -9
- package/dist-lib/Grid-DWgUPuZ3.js +0 -404
- package/dist-lib/MarkdownRenderer-CcSFc2N3.js +0 -85
- package/dist-lib/RecordIdBadge-CGxPR-8q.js +0 -24
- package/dist-lib/SmartDetailPage.impl-lskCd-WG.js +0 -1846
- package/dist-lib/SmartListPage.impl-CrGbdzyK.js +0 -2854
- package/dist-lib/SortHeaderMenu-SYSAaqQJ.js +0 -106
- package/dist-lib/action-dispatch-CR4ajBtT.js +0 -1985
- package/dist-lib/cardProjection-CW5RIMko.js +0 -699
- package/dist-lib/components/pages/home/HomeStub.d.ts +0 -6
- package/dist-lib/components/pages/jobs/Jobs.d.ts +0 -1
- package/dist-lib/components/pages/pipeline/Pipeline.d.ts +0 -1
- package/dist-lib/format-count-Dobmi-Ji.js +0 -1551
- package/dist-lib/hooks/useUserLocale.d.ts +0 -1
- package/dist-lib/lib/messages.d.ts +0 -12
- package/dist-lib/peekDraftStore-5wQ7lq_V.js +0 -194
- package/dist-lib/registry-CjgUaF7C.js +0 -1768
- package/dist-lib/useListQuery-D7Hr5WM1.js +0 -96
- package/dist-lib/useProperties-CqtCzFCr.js +0 -81
|
@@ -1,1985 +0,0 @@
|
|
|
1
|
-
import { s as e, t } from "./DynamicIcon-DW5krHuX.js";
|
|
2
|
-
import { $n as n, B as r, Br as i, F as a, Lr as o, Or as s, P as c, Q as l, Vr as u, X as d, ct as f, dt as p, it as m, kr as h, lt as g, mt as _, nr as v, ot as y, st as b, tt as x, ut as S } from "./useCurrentScreen-CzwzQpoW.js";
|
|
3
|
-
import { a as C, c as w, d as T, f as E, i as D, l as O, n as ee, o as k, p as A, r as te, s as j, t as M, u as N } from "./value-Bo8C8WMU.js";
|
|
4
|
-
import { Fragment as P, Suspense as F, lazy as I, useCallback as L, useEffect as R, useLayoutEffect as z, useMemo as ne, useRef as B, useState as V } from "react";
|
|
5
|
-
import { Fragment as H, jsx as U, jsxs as W } from "react/jsx-runtime";
|
|
6
|
-
//#region src/components/file-widgets/registry.ts
|
|
7
|
-
var G = /* @__PURE__ */ new Map();
|
|
8
|
-
function K(e, t) {
|
|
9
|
-
G.set(e, t);
|
|
10
|
-
}
|
|
11
|
-
function q(e) {
|
|
12
|
-
return G.get(e);
|
|
13
|
-
}
|
|
14
|
-
function re(e) {
|
|
15
|
-
return G.has(e);
|
|
16
|
-
}
|
|
17
|
-
//#endregion
|
|
18
|
-
//#region src/components/file-widgets/cropper.ts
|
|
19
|
-
var ie = ({ file: e }) => Promise.resolve({
|
|
20
|
-
blob: e,
|
|
21
|
-
filename: e.name
|
|
22
|
-
}), J = ie;
|
|
23
|
-
function ae(e) {
|
|
24
|
-
J = e ?? ie;
|
|
25
|
-
}
|
|
26
|
-
function Y() {
|
|
27
|
-
return J;
|
|
28
|
-
}
|
|
29
|
-
//#endregion
|
|
30
|
-
//#region src/components/file-widgets/ImageWidget.tsx
|
|
31
|
-
function oe(e, t) {
|
|
32
|
-
return w(e, t);
|
|
33
|
-
}
|
|
34
|
-
function se(e) {
|
|
35
|
-
let t = e.trim().split(/\s+/).filter(Boolean);
|
|
36
|
-
return t.length === 0 ? "?" : t.length === 1 ? t[0].slice(0, 2).toUpperCase() : (t[0][0] + t[1][0]).toUpperCase();
|
|
37
|
-
}
|
|
38
|
-
function ce(e) {
|
|
39
|
-
let { field: t, fieldName: n, value: r, onChange: i, mode: a, alt: o, disabled: s, visual: c, uploadFieldCode: l, uploadSlotCode: u } = e, d = ee(r), [f, p] = V("idle"), [h, _] = V(null), [v, x] = V(null), [C, w] = V(null), [k, te] = V(!1), M = B(null), N = B(!1), P = B(null), { register: F, unregister: I, isDraft: z } = m();
|
|
40
|
-
R(() => () => {
|
|
41
|
-
M.current && M.current.abort();
|
|
42
|
-
}, []);
|
|
43
|
-
let H = ne(() => E(d, o, t.display?.placeholder || n), [
|
|
44
|
-
o,
|
|
45
|
-
t.display?.placeholder,
|
|
46
|
-
n,
|
|
47
|
-
d
|
|
48
|
-
]), G = (t.accepts ?? ["image/*"]).join(","), K = L(async (r) => {
|
|
49
|
-
let a = S(r, t.accepts, t.max_size_bytes);
|
|
50
|
-
if (a) {
|
|
51
|
-
x(a), p("error");
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
let o = r;
|
|
55
|
-
if (t.display?.crop_on_upload) try {
|
|
56
|
-
let { blob: e, filename: n } = await Y()({
|
|
57
|
-
file: r,
|
|
58
|
-
aspectRatio: fe(t.display.aspect_ratio)
|
|
59
|
-
});
|
|
60
|
-
o = new File([e], n, { type: e.type || r.type });
|
|
61
|
-
} catch (e) {
|
|
62
|
-
x({
|
|
63
|
-
code: "CROP_FAILED",
|
|
64
|
-
message: e instanceof Error ? e.message : "Crop failed"
|
|
65
|
-
}), p("error");
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
x(null), N.current = !1, p("uploading"), _({
|
|
69
|
-
loaded: 0,
|
|
70
|
-
total: o.size,
|
|
71
|
-
pct: 0
|
|
72
|
-
});
|
|
73
|
-
let s = new AbortController();
|
|
74
|
-
M.current = s;
|
|
75
|
-
try {
|
|
76
|
-
let r = await g({
|
|
77
|
-
file: o,
|
|
78
|
-
entityCode: e.entityCode,
|
|
79
|
-
fieldCode: l ?? n,
|
|
80
|
-
slotCode: u,
|
|
81
|
-
signal: s.signal,
|
|
82
|
-
onProgress: _
|
|
83
|
-
});
|
|
84
|
-
if (N.current) {
|
|
85
|
-
b(r.id).catch(() => {}), I(r.id);
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
d && z(d.id) && (b(d.id).catch(() => {}), I(d.id)), F(r.id, () => b(r.id)), w(r.id), p("idle"), _(null);
|
|
89
|
-
let a = {
|
|
90
|
-
id: r.id,
|
|
91
|
-
filename: r.filename,
|
|
92
|
-
content_type: r.content_type,
|
|
93
|
-
size_bytes: r.size_bytes,
|
|
94
|
-
sha256: r.sha256,
|
|
95
|
-
width: r.width,
|
|
96
|
-
height: r.height,
|
|
97
|
-
url: r.url,
|
|
98
|
-
metadata: r.metadata
|
|
99
|
-
};
|
|
100
|
-
i?.(t.mode === "array" ? [a] : a);
|
|
101
|
-
} catch (e) {
|
|
102
|
-
if (e instanceof y && e.code === "ABORTED") return;
|
|
103
|
-
let t = e instanceof y ? {
|
|
104
|
-
code: e.code,
|
|
105
|
-
message: e.message
|
|
106
|
-
} : {
|
|
107
|
-
code: "UNKNOWN",
|
|
108
|
-
message: e instanceof Error ? e.message : "Upload failed"
|
|
109
|
-
};
|
|
110
|
-
x(t), p("error"), _(null);
|
|
111
|
-
}
|
|
112
|
-
}, [
|
|
113
|
-
t.accepts,
|
|
114
|
-
t.max_size_bytes,
|
|
115
|
-
t.display?.crop_on_upload,
|
|
116
|
-
t.display?.aspect_ratio,
|
|
117
|
-
t.mode,
|
|
118
|
-
n,
|
|
119
|
-
i,
|
|
120
|
-
e.entityCode,
|
|
121
|
-
F,
|
|
122
|
-
z,
|
|
123
|
-
d,
|
|
124
|
-
I,
|
|
125
|
-
l,
|
|
126
|
-
u
|
|
127
|
-
]), q = L(() => {
|
|
128
|
-
f === "uploading" && M.current && (N.current = !0, M.current.abort(), M.current = null, p("idle"), _(null)), C && (b(C).catch(() => {}), I(C), w(null));
|
|
129
|
-
}, [
|
|
130
|
-
f,
|
|
131
|
-
C,
|
|
132
|
-
I
|
|
133
|
-
]), re = L(() => {
|
|
134
|
-
d && z(d.id) && (b(d.id).catch(() => {}), I(d.id), w(null)), i?.(t.mode === "array" ? [] : null);
|
|
135
|
-
}, [
|
|
136
|
-
d,
|
|
137
|
-
t.mode,
|
|
138
|
-
z,
|
|
139
|
-
i,
|
|
140
|
-
I
|
|
141
|
-
]), ie = L(() => {
|
|
142
|
-
x(null), p("idle"), P.current?.click();
|
|
143
|
-
}, []), J = L(() => {
|
|
144
|
-
s || P.current?.click();
|
|
145
|
-
}, [s]), ae = L((e) => {
|
|
146
|
-
s || (e.key === "Enter" || e.key === " ") && (e.preventDefault(), J());
|
|
147
|
-
}, [s, J]), se = L((e) => {
|
|
148
|
-
s || (e.preventDefault(), e.dataTransfer.dropEffect = "copy");
|
|
149
|
-
}, [s]), ce = L((e) => {
|
|
150
|
-
if (s) return;
|
|
151
|
-
e.preventDefault();
|
|
152
|
-
let t = e.dataTransfer.files?.[0];
|
|
153
|
-
t && K(t);
|
|
154
|
-
}, [s, K]), he = L((e) => {
|
|
155
|
-
let t = e.target.files?.[0];
|
|
156
|
-
e.target.value = "", t && K(t);
|
|
157
|
-
}, [K]), ge = c.aspectRatio ?? de(c.shape, t.display?.aspect_ratio), X = T(d), _e = {
|
|
158
|
-
aspectRatio: ge,
|
|
159
|
-
width: c.width ?? (c.shape === "wide" ? "100%" : "120px")
|
|
160
|
-
}, Z = !!d, ve = oe(d, t.display?.listable_thumbnail), ye = O(d, t.display?.listable_thumbnail), be = D(d?.id, ye, ve), xe = a === "display", Se = L((e) => {
|
|
161
|
-
e.stopPropagation(), te((e) => !e);
|
|
162
|
-
}, []), Ce = L((e) => {
|
|
163
|
-
if (!d || !k) return;
|
|
164
|
-
let n = e.currentTarget.getBoundingClientRect(), r = n.width > 0 ? (e.clientX - n.left) / n.width : .5, a = n.height > 0 ? (e.clientY - n.top) / n.height : .5, o = A(d, {
|
|
165
|
-
x: Math.max(0, Math.min(1, r)),
|
|
166
|
-
y: Math.max(0, Math.min(1, a))
|
|
167
|
-
});
|
|
168
|
-
i?.(t.mode === "array" ? [o] : o), te(!1);
|
|
169
|
-
}, [
|
|
170
|
-
t.mode,
|
|
171
|
-
d,
|
|
172
|
-
k,
|
|
173
|
-
i
|
|
174
|
-
]);
|
|
175
|
-
return xe ? /* @__PURE__ */ U("div", {
|
|
176
|
-
className: le(c.shape, !1),
|
|
177
|
-
style: _e,
|
|
178
|
-
"aria-label": H,
|
|
179
|
-
children: Z && be ? /* @__PURE__ */ U("img", {
|
|
180
|
-
src: be,
|
|
181
|
-
alt: H,
|
|
182
|
-
className: ue(c.shape),
|
|
183
|
-
style: { objectPosition: j(X) },
|
|
184
|
-
loading: "lazy"
|
|
185
|
-
}) : /* @__PURE__ */ U(pe, {
|
|
186
|
-
shape: c.shape,
|
|
187
|
-
label: H,
|
|
188
|
-
placeholder: t.display?.placeholder
|
|
189
|
-
})
|
|
190
|
-
}) : /* @__PURE__ */ W("div", {
|
|
191
|
-
className: le(c.shape, !s),
|
|
192
|
-
style: _e,
|
|
193
|
-
tabIndex: s ? -1 : 0,
|
|
194
|
-
role: "button",
|
|
195
|
-
"aria-label": H,
|
|
196
|
-
"aria-disabled": s || void 0,
|
|
197
|
-
"aria-busy": f === "uploading" || void 0,
|
|
198
|
-
"aria-invalid": f === "error" || void 0,
|
|
199
|
-
onClick: f === "idle" && !Z ? J : void 0,
|
|
200
|
-
onMouseDown: k ? Ce : void 0,
|
|
201
|
-
onKeyDown: ae,
|
|
202
|
-
onDragOver: se,
|
|
203
|
-
onDrop: ce,
|
|
204
|
-
"data-testid": k ? "focal-point-target" : `file-widget-${n}`,
|
|
205
|
-
children: [
|
|
206
|
-
/* @__PURE__ */ U("input", {
|
|
207
|
-
ref: P,
|
|
208
|
-
type: "file",
|
|
209
|
-
accept: G,
|
|
210
|
-
onChange: he,
|
|
211
|
-
style: { display: "none" },
|
|
212
|
-
"data-testid": `file-input-${n}`
|
|
213
|
-
}),
|
|
214
|
-
Z && be ? /* @__PURE__ */ U("img", {
|
|
215
|
-
src: be,
|
|
216
|
-
alt: H,
|
|
217
|
-
className: ue(c.shape),
|
|
218
|
-
style: { objectPosition: j(X) },
|
|
219
|
-
loading: "lazy"
|
|
220
|
-
}) : f === "uploading" ? null : /* @__PURE__ */ U(pe, {
|
|
221
|
-
shape: c.shape,
|
|
222
|
-
label: H,
|
|
223
|
-
placeholder: t.display?.placeholder
|
|
224
|
-
}),
|
|
225
|
-
f === "uploading" && /* @__PURE__ */ U(me, { pct: h?.pct ?? 0 }),
|
|
226
|
-
C && /* @__PURE__ */ U("span", {
|
|
227
|
-
className: "absolute right-1 top-1 h-2 w-2 rounded-full bg-warning",
|
|
228
|
-
"aria-hidden": "true",
|
|
229
|
-
"data-testid": "draft-indicator"
|
|
230
|
-
}),
|
|
231
|
-
Z && f === "idle" && !s && /* @__PURE__ */ W("div", {
|
|
232
|
-
className: "absolute inset-0 flex items-center justify-center gap-2 bg-black/40 opacity-0 transition-opacity hover:opacity-100 focus-within:opacity-100",
|
|
233
|
-
children: [
|
|
234
|
-
t.display?.focal_point && /* @__PURE__ */ U("button", {
|
|
235
|
-
type: "button",
|
|
236
|
-
className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
|
|
237
|
-
onClick: Se,
|
|
238
|
-
"data-testid": "focal-point-toggle",
|
|
239
|
-
children: k ? "Cancel focus" : "Set focus"
|
|
240
|
-
}),
|
|
241
|
-
/* @__PURE__ */ U("button", {
|
|
242
|
-
type: "button",
|
|
243
|
-
className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
|
|
244
|
-
onClick: (e) => {
|
|
245
|
-
e.stopPropagation(), J();
|
|
246
|
-
},
|
|
247
|
-
children: "Change"
|
|
248
|
-
}),
|
|
249
|
-
/* @__PURE__ */ U("button", {
|
|
250
|
-
type: "button",
|
|
251
|
-
className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-destructive hover:bg-surface-2",
|
|
252
|
-
onClick: (e) => {
|
|
253
|
-
e.stopPropagation(), re();
|
|
254
|
-
},
|
|
255
|
-
children: "Remove"
|
|
256
|
-
})
|
|
257
|
-
]
|
|
258
|
-
}),
|
|
259
|
-
X && Z && /* @__PURE__ */ U("span", {
|
|
260
|
-
className: "absolute h-3 w-3 -translate-x-1/2 -translate-y-1/2 rounded-full border border-white bg-black/70",
|
|
261
|
-
style: {
|
|
262
|
-
left: `${X.x * 100}%`,
|
|
263
|
-
top: `${X.y * 100}%`
|
|
264
|
-
},
|
|
265
|
-
"data-testid": "focal-point-marker"
|
|
266
|
-
}),
|
|
267
|
-
f === "uploading" && /* @__PURE__ */ U("button", {
|
|
268
|
-
type: "button",
|
|
269
|
-
className: "absolute bottom-1 right-1 rounded-sm border border-border bg-card px-2 py-0.5 text-xs",
|
|
270
|
-
onClick: (e) => {
|
|
271
|
-
e.stopPropagation(), q();
|
|
272
|
-
},
|
|
273
|
-
"data-testid": "cancel-upload",
|
|
274
|
-
children: "Cancel"
|
|
275
|
-
}),
|
|
276
|
-
f === "error" && v && /* @__PURE__ */ W("div", {
|
|
277
|
-
className: "absolute inset-x-0 bottom-0 flex items-center justify-between gap-2 bg-destructive-soft px-2 py-1 text-xs text-destructive",
|
|
278
|
-
role: "alert",
|
|
279
|
-
children: [/* @__PURE__ */ U("span", {
|
|
280
|
-
className: "truncate",
|
|
281
|
-
title: v.message,
|
|
282
|
-
children: v.message
|
|
283
|
-
}), /* @__PURE__ */ U("button", {
|
|
284
|
-
type: "button",
|
|
285
|
-
className: "underline",
|
|
286
|
-
onClick: (e) => {
|
|
287
|
-
e.stopPropagation(), ie();
|
|
288
|
-
},
|
|
289
|
-
"data-testid": "retry-upload",
|
|
290
|
-
children: "Retry"
|
|
291
|
-
})]
|
|
292
|
-
})
|
|
293
|
-
]
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
function le(e, t) {
|
|
297
|
-
return [
|
|
298
|
-
"relative overflow-hidden border border-border bg-surface-2",
|
|
299
|
-
e === "circle" ? "rounded-full" : "rounded-md",
|
|
300
|
-
t ? "cursor-pointer focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent" : ""
|
|
301
|
-
].filter(Boolean).join(" ");
|
|
302
|
-
}
|
|
303
|
-
function ue(e) {
|
|
304
|
-
return "h-full w-full object-cover";
|
|
305
|
-
}
|
|
306
|
-
function de(e, t) {
|
|
307
|
-
return t ? t.replace(":", " / ") : e === "wide" ? "16 / 9" : "1 / 1";
|
|
308
|
-
}
|
|
309
|
-
function fe(e) {
|
|
310
|
-
if (!e) return;
|
|
311
|
-
let t = e.replace(/\s/g, "").match(/^(\d+(?:\.\d+)?)[:/](\d+(?:\.\d+)?)$/);
|
|
312
|
-
if (!t) return;
|
|
313
|
-
let n = Number(t[1]), r = Number(t[2]);
|
|
314
|
-
if (n && r) return n / r;
|
|
315
|
-
}
|
|
316
|
-
function pe({ shape: e, label: t, placeholder: n }) {
|
|
317
|
-
return n === "initials" ? /* @__PURE__ */ U("div", {
|
|
318
|
-
className: "flex h-full w-full items-center justify-center bg-surface-3 text-text-3",
|
|
319
|
-
children: /* @__PURE__ */ U("span", {
|
|
320
|
-
className: e === "circle" ? "text-lg font-medium" : "text-base font-medium",
|
|
321
|
-
children: se(t)
|
|
322
|
-
})
|
|
323
|
-
}) : /* @__PURE__ */ U("div", {
|
|
324
|
-
className: "flex h-full w-full items-center justify-center bg-surface-3 text-text-4",
|
|
325
|
-
children: /* @__PURE__ */ U("span", {
|
|
326
|
-
className: "text-xs",
|
|
327
|
-
children: e === "wide" ? "Drop image here" : "+"
|
|
328
|
-
})
|
|
329
|
-
});
|
|
330
|
-
}
|
|
331
|
-
function me({ pct: e }) {
|
|
332
|
-
let t = 2 * Math.PI * 18, n = t - Math.max(0, Math.min(100, e)) / 100 * t;
|
|
333
|
-
return /* @__PURE__ */ W("div", {
|
|
334
|
-
className: "absolute inset-0 flex items-center justify-center bg-black/30",
|
|
335
|
-
"data-testid": "upload-progress",
|
|
336
|
-
"aria-label": `Uploading ${Math.round(e)}%`,
|
|
337
|
-
role: "progressbar",
|
|
338
|
-
"aria-valuenow": Math.round(e),
|
|
339
|
-
"aria-valuemin": 0,
|
|
340
|
-
"aria-valuemax": 100,
|
|
341
|
-
children: [/* @__PURE__ */ W("svg", {
|
|
342
|
-
width: "48",
|
|
343
|
-
height: "48",
|
|
344
|
-
viewBox: "0 0 48 48",
|
|
345
|
-
children: [/* @__PURE__ */ U("circle", {
|
|
346
|
-
cx: "24",
|
|
347
|
-
cy: "24",
|
|
348
|
-
r: 18,
|
|
349
|
-
stroke: "currentColor",
|
|
350
|
-
strokeOpacity: "0.25",
|
|
351
|
-
strokeWidth: "4",
|
|
352
|
-
fill: "none",
|
|
353
|
-
className: "text-foreground"
|
|
354
|
-
}), /* @__PURE__ */ U("circle", {
|
|
355
|
-
cx: "24",
|
|
356
|
-
cy: "24",
|
|
357
|
-
r: 18,
|
|
358
|
-
stroke: "currentColor",
|
|
359
|
-
strokeWidth: "4",
|
|
360
|
-
fill: "none",
|
|
361
|
-
strokeDasharray: t,
|
|
362
|
-
strokeDashoffset: n,
|
|
363
|
-
strokeLinecap: "round",
|
|
364
|
-
className: "text-accent",
|
|
365
|
-
transform: "rotate(-90 24 24)"
|
|
366
|
-
})]
|
|
367
|
-
}), /* @__PURE__ */ W("span", {
|
|
368
|
-
className: "absolute text-xs text-foreground",
|
|
369
|
-
children: [Math.round(e), "%"]
|
|
370
|
-
})]
|
|
371
|
-
});
|
|
372
|
-
}
|
|
373
|
-
//#endregion
|
|
374
|
-
//#region src/components/file-widgets/SquareImage.tsx
|
|
375
|
-
function he(e) {
|
|
376
|
-
return /* @__PURE__ */ U(ce, {
|
|
377
|
-
...e,
|
|
378
|
-
visual: { shape: "square" }
|
|
379
|
-
});
|
|
380
|
-
}
|
|
381
|
-
//#endregion
|
|
382
|
-
//#region src/components/file-widgets/CircleImage.tsx
|
|
383
|
-
function ge(e) {
|
|
384
|
-
return /* @__PURE__ */ U(ce, {
|
|
385
|
-
...e,
|
|
386
|
-
visual: { shape: "circle" }
|
|
387
|
-
});
|
|
388
|
-
}
|
|
389
|
-
//#endregion
|
|
390
|
-
//#region src/components/file-widgets/WideBanner.tsx
|
|
391
|
-
function X(e) {
|
|
392
|
-
return /* @__PURE__ */ U(ce, {
|
|
393
|
-
...e,
|
|
394
|
-
visual: { shape: "wide" }
|
|
395
|
-
});
|
|
396
|
-
}
|
|
397
|
-
//#endregion
|
|
398
|
-
//#region src/components/file-widgets/GridLazy.tsx
|
|
399
|
-
var _e = I(() => import("./Grid-DWgUPuZ3.js").then((e) => ({ default: e.Grid })));
|
|
400
|
-
function Z() {
|
|
401
|
-
return /* @__PURE__ */ U("div", { className: "h-24 w-full rounded-md bg-muted animate-pulse" });
|
|
402
|
-
}
|
|
403
|
-
function ve(e) {
|
|
404
|
-
return /* @__PURE__ */ U(F, {
|
|
405
|
-
fallback: /* @__PURE__ */ U(Z, {}),
|
|
406
|
-
children: /* @__PURE__ */ U(_e, { ...e })
|
|
407
|
-
});
|
|
408
|
-
}
|
|
409
|
-
//#endregion
|
|
410
|
-
//#region src/components/file-widgets/DocumentCard.tsx
|
|
411
|
-
function ye({ contentType: e }) {
|
|
412
|
-
let t = e ? e.includes("pdf") ? "PDF" : e.includes("word") ? "DOC" : e.includes("sheet") || e.includes("excel") ? "XLS" : e.startsWith("image/") ? "IMG" : e.split("/")[1]?.slice(0, 4).toUpperCase() ?? "FILE" : "FILE";
|
|
413
|
-
return /* @__PURE__ */ U("div", {
|
|
414
|
-
className: "flex h-16 w-16 flex-none items-center justify-center rounded-md border border-border bg-surface-3 text-xs font-medium text-muted-foreground",
|
|
415
|
-
children: t
|
|
416
|
-
});
|
|
417
|
-
}
|
|
418
|
-
function be(e) {
|
|
419
|
-
let { field: t, fieldName: n, value: r, onChange: i, mode: a, disabled: o, uploadFieldCode: s, uploadSlotCode: c } = e, l = ee(r), [u, d] = V("idle"), [p, h] = V(null), [_, v] = V(null), [x, w] = V(!1), [T, E] = V(l?.filename ?? ""), D = B(null), O = B(!1), A = B(null), { register: j, unregister: M, isDraft: P } = m(), { open: F } = te();
|
|
420
|
-
R(() => () => {
|
|
421
|
-
D.current && D.current.abort();
|
|
422
|
-
}, []), R(() => {
|
|
423
|
-
E(l?.filename ?? "");
|
|
424
|
-
}, [l?.filename]);
|
|
425
|
-
let I = (t.accepts ?? []).join(","), z = L(async (r) => {
|
|
426
|
-
let a = S(r, t.accepts, t.max_size_bytes);
|
|
427
|
-
if (a) {
|
|
428
|
-
v(a), d("error");
|
|
429
|
-
return;
|
|
430
|
-
}
|
|
431
|
-
v(null), O.current = !1, d("uploading"), h({
|
|
432
|
-
loaded: 0,
|
|
433
|
-
total: r.size,
|
|
434
|
-
pct: 0
|
|
435
|
-
});
|
|
436
|
-
let o = new AbortController();
|
|
437
|
-
D.current = o;
|
|
438
|
-
try {
|
|
439
|
-
let a = await g({
|
|
440
|
-
file: r,
|
|
441
|
-
entityCode: e.entityCode,
|
|
442
|
-
fieldCode: s ?? n,
|
|
443
|
-
slotCode: c,
|
|
444
|
-
signal: o.signal,
|
|
445
|
-
onProgress: h
|
|
446
|
-
});
|
|
447
|
-
if (O.current) {
|
|
448
|
-
b(a.id).catch(() => {}), M(a.id);
|
|
449
|
-
return;
|
|
450
|
-
}
|
|
451
|
-
l && P(l.id) && (b(l.id).catch(() => {}), M(l.id)), j(a.id, () => b(a.id)), d("idle"), h(null);
|
|
452
|
-
let u = {
|
|
453
|
-
id: a.id,
|
|
454
|
-
filename: a.filename,
|
|
455
|
-
content_type: a.content_type,
|
|
456
|
-
size_bytes: a.size_bytes,
|
|
457
|
-
sha256: a.sha256,
|
|
458
|
-
width: a.width,
|
|
459
|
-
height: a.height,
|
|
460
|
-
url: a.url,
|
|
461
|
-
metadata: a.metadata
|
|
462
|
-
};
|
|
463
|
-
i?.(t.mode === "array" ? [u] : u);
|
|
464
|
-
} catch (e) {
|
|
465
|
-
if (e instanceof y && e.code === "ABORTED") return;
|
|
466
|
-
let t = e instanceof y ? {
|
|
467
|
-
code: e.code,
|
|
468
|
-
message: e.message
|
|
469
|
-
} : {
|
|
470
|
-
code: "UNKNOWN",
|
|
471
|
-
message: e instanceof Error ? e.message : "Upload failed"
|
|
472
|
-
};
|
|
473
|
-
v(t), d("error"), h(null);
|
|
474
|
-
}
|
|
475
|
-
}, [
|
|
476
|
-
t.accepts,
|
|
477
|
-
t.max_size_bytes,
|
|
478
|
-
t.mode,
|
|
479
|
-
n,
|
|
480
|
-
l,
|
|
481
|
-
P,
|
|
482
|
-
i,
|
|
483
|
-
e.entityCode,
|
|
484
|
-
j,
|
|
485
|
-
M,
|
|
486
|
-
s,
|
|
487
|
-
c
|
|
488
|
-
]), ne = L(() => {
|
|
489
|
-
o || A.current?.click();
|
|
490
|
-
}, [o]), G = L((e) => {
|
|
491
|
-
let t = e.target.files?.[0];
|
|
492
|
-
e.target.value = "", t && z(t);
|
|
493
|
-
}, [z]), K = L(() => {
|
|
494
|
-
l && P(l.id) && (b(l.id).catch(() => {}), M(l.id)), i?.(t.mode === "array" ? [] : null);
|
|
495
|
-
}, [
|
|
496
|
-
l,
|
|
497
|
-
t.mode,
|
|
498
|
-
P,
|
|
499
|
-
i,
|
|
500
|
-
M
|
|
501
|
-
]), q = L(() => {
|
|
502
|
-
u === "uploading" && D.current && (O.current = !0, D.current.abort(), D.current = null, d("idle"), h(null));
|
|
503
|
-
}, [u]), re = L(() => {
|
|
504
|
-
l && F(l.id, "download", k(l));
|
|
505
|
-
}, [l, F]), ie = l ? C(l) : !1, J = L(() => {
|
|
506
|
-
l && C(l) && F(l.id, "preview", N(l));
|
|
507
|
-
}, [l, F]), ae = L(() => {
|
|
508
|
-
if (!l) {
|
|
509
|
-
w(!1);
|
|
510
|
-
return;
|
|
511
|
-
}
|
|
512
|
-
let e = T.trim();
|
|
513
|
-
if (w(!1), !e || e === l.filename) {
|
|
514
|
-
E(l.filename);
|
|
515
|
-
return;
|
|
516
|
-
}
|
|
517
|
-
let n = {
|
|
518
|
-
...l,
|
|
519
|
-
filename: e
|
|
520
|
-
};
|
|
521
|
-
i?.(t.mode === "array" ? [n] : n);
|
|
522
|
-
}, [
|
|
523
|
-
T,
|
|
524
|
-
l,
|
|
525
|
-
i,
|
|
526
|
-
t.mode
|
|
527
|
-
]), Y = a === "display";
|
|
528
|
-
return !l && u !== "uploading" ? /* @__PURE__ */ W("div", {
|
|
529
|
-
"data-testid": `file-widget-${n}`,
|
|
530
|
-
className: "flex items-center gap-3 rounded-md border border-dashed border-border bg-surface p-3",
|
|
531
|
-
children: [
|
|
532
|
-
/* @__PURE__ */ U(ye, {}),
|
|
533
|
-
/* @__PURE__ */ W("div", {
|
|
534
|
-
className: "flex flex-col gap-1",
|
|
535
|
-
children: [/* @__PURE__ */ U("span", {
|
|
536
|
-
className: "text-sm text-foreground",
|
|
537
|
-
children: t.display?.placeholder || "No document attached"
|
|
538
|
-
}), !Y && /* @__PURE__ */ U("button", {
|
|
539
|
-
type: "button",
|
|
540
|
-
className: "self-start rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
|
|
541
|
-
onClick: ne,
|
|
542
|
-
disabled: o,
|
|
543
|
-
"data-testid": "upload",
|
|
544
|
-
children: "Upload"
|
|
545
|
-
})]
|
|
546
|
-
}),
|
|
547
|
-
!Y && /* @__PURE__ */ U("input", {
|
|
548
|
-
ref: A,
|
|
549
|
-
type: "file",
|
|
550
|
-
accept: I || void 0,
|
|
551
|
-
onChange: G,
|
|
552
|
-
style: { display: "none" },
|
|
553
|
-
"data-testid": `file-input-${n}`
|
|
554
|
-
}),
|
|
555
|
-
u === "error" && _ && /* @__PURE__ */ U("div", {
|
|
556
|
-
className: "ml-auto text-xs text-destructive",
|
|
557
|
-
role: "alert",
|
|
558
|
-
children: _.message
|
|
559
|
-
})
|
|
560
|
-
]
|
|
561
|
-
}) : /* @__PURE__ */ W("div", {
|
|
562
|
-
"data-testid": `file-widget-${n}`,
|
|
563
|
-
className: "flex items-center gap-3 rounded-md border border-border bg-surface p-3",
|
|
564
|
-
"aria-busy": u === "uploading" || void 0,
|
|
565
|
-
"aria-invalid": u === "error" || void 0,
|
|
566
|
-
children: [
|
|
567
|
-
/* @__PURE__ */ U(ye, { contentType: l?.content_type }),
|
|
568
|
-
/* @__PURE__ */ W("div", {
|
|
569
|
-
className: "flex min-w-0 flex-1 flex-col gap-1",
|
|
570
|
-
children: [
|
|
571
|
-
x && l ? /* @__PURE__ */ U("input", {
|
|
572
|
-
type: "text",
|
|
573
|
-
className: "rounded-sm border border-border bg-card px-1 py-0.5 text-sm text-foreground",
|
|
574
|
-
value: T,
|
|
575
|
-
autoFocus: !0,
|
|
576
|
-
onChange: (e) => E(e.target.value),
|
|
577
|
-
onBlur: ae,
|
|
578
|
-
onKeyDown: (e) => {
|
|
579
|
-
e.key === "Enter" ? ae() : e.key === "Escape" && (w(!1), E(l.filename));
|
|
580
|
-
},
|
|
581
|
-
"data-testid": "filename-input"
|
|
582
|
-
}) : /* @__PURE__ */ U("button", {
|
|
583
|
-
type: "button",
|
|
584
|
-
className: "truncate text-left text-sm font-medium text-foreground hover:underline",
|
|
585
|
-
onClick: () => !Y && l && w(!0),
|
|
586
|
-
disabled: Y || o || !l,
|
|
587
|
-
title: l?.filename,
|
|
588
|
-
"data-testid": "filename",
|
|
589
|
-
children: l?.filename ?? "Uploading…"
|
|
590
|
-
}),
|
|
591
|
-
/* @__PURE__ */ W("div", {
|
|
592
|
-
className: "flex flex-wrap gap-2 text-xs text-muted-foreground",
|
|
593
|
-
children: [
|
|
594
|
-
l && /* @__PURE__ */ U("span", { children: f(l.size_bytes) }),
|
|
595
|
-
l?.page_count != null && /* @__PURE__ */ W("span", { children: [l.page_count, " pages"] }),
|
|
596
|
-
l?.uploaded_at && /* @__PURE__ */ U("span", { children: xe(l.uploaded_at) }),
|
|
597
|
-
l?.uploaded_by && /* @__PURE__ */ W("span", { children: ["by ", l.uploaded_by] }),
|
|
598
|
-
l?.version?.number != null && /* @__PURE__ */ W("span", {
|
|
599
|
-
"data-testid": "version-badge",
|
|
600
|
-
children: ["v", l.version.number]
|
|
601
|
-
})
|
|
602
|
-
]
|
|
603
|
-
}),
|
|
604
|
-
u === "uploading" && /* @__PURE__ */ W("div", {
|
|
605
|
-
className: "text-xs text-muted-foreground",
|
|
606
|
-
role: "progressbar",
|
|
607
|
-
"aria-valuenow": p?.pct ?? 0,
|
|
608
|
-
"aria-valuemin": 0,
|
|
609
|
-
"aria-valuemax": 100,
|
|
610
|
-
"data-testid": "upload-progress",
|
|
611
|
-
children: [
|
|
612
|
-
"Uploading ",
|
|
613
|
-
p?.pct ?? 0,
|
|
614
|
-
"%"
|
|
615
|
-
]
|
|
616
|
-
}),
|
|
617
|
-
u === "error" && _ && /* @__PURE__ */ U("div", {
|
|
618
|
-
className: "text-xs text-destructive",
|
|
619
|
-
role: "alert",
|
|
620
|
-
children: _.message
|
|
621
|
-
})
|
|
622
|
-
]
|
|
623
|
-
}),
|
|
624
|
-
/* @__PURE__ */ W("div", {
|
|
625
|
-
className: "flex flex-none items-center gap-1",
|
|
626
|
-
children: [l && u !== "uploading" && /* @__PURE__ */ W(H, { children: [
|
|
627
|
-
/* @__PURE__ */ U("button", {
|
|
628
|
-
type: "button",
|
|
629
|
-
className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
|
|
630
|
-
onClick: re,
|
|
631
|
-
"data-testid": "download",
|
|
632
|
-
children: "Download"
|
|
633
|
-
}),
|
|
634
|
-
/* @__PURE__ */ U("button", {
|
|
635
|
-
type: "button",
|
|
636
|
-
className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
637
|
-
onClick: J,
|
|
638
|
-
disabled: !ie,
|
|
639
|
-
title: ie ? void 0 : "Preview is available only for images and PDFs",
|
|
640
|
-
"data-testid": "preview",
|
|
641
|
-
children: "Preview"
|
|
642
|
-
}),
|
|
643
|
-
!Y && /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U("button", {
|
|
644
|
-
type: "button",
|
|
645
|
-
className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
|
|
646
|
-
onClick: ne,
|
|
647
|
-
disabled: o,
|
|
648
|
-
"data-testid": "replace",
|
|
649
|
-
children: "Replace"
|
|
650
|
-
}), /* @__PURE__ */ U("button", {
|
|
651
|
-
type: "button",
|
|
652
|
-
className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-destructive hover:bg-surface-2",
|
|
653
|
-
onClick: K,
|
|
654
|
-
disabled: o,
|
|
655
|
-
"data-testid": "remove",
|
|
656
|
-
children: "Remove"
|
|
657
|
-
})] })
|
|
658
|
-
] }), u === "uploading" && /* @__PURE__ */ U("button", {
|
|
659
|
-
type: "button",
|
|
660
|
-
className: "rounded-sm border border-border bg-card px-2 py-1 text-xs",
|
|
661
|
-
onClick: q,
|
|
662
|
-
"data-testid": "cancel-upload",
|
|
663
|
-
children: "Cancel"
|
|
664
|
-
})]
|
|
665
|
-
}),
|
|
666
|
-
!Y && /* @__PURE__ */ U("input", {
|
|
667
|
-
ref: A,
|
|
668
|
-
type: "file",
|
|
669
|
-
accept: I || void 0,
|
|
670
|
-
onChange: G,
|
|
671
|
-
style: { display: "none" },
|
|
672
|
-
"data-testid": `file-input-${n}`
|
|
673
|
-
})
|
|
674
|
-
]
|
|
675
|
-
});
|
|
676
|
-
}
|
|
677
|
-
function xe(e) {
|
|
678
|
-
let t = new Date(e);
|
|
679
|
-
return isNaN(t.getTime()) ? e : t.toISOString().slice(0, 10);
|
|
680
|
-
}
|
|
681
|
-
//#endregion
|
|
682
|
-
//#region src/components/file-widgets/FileList.tsx
|
|
683
|
-
function Se(e) {
|
|
684
|
-
return e ? (e.split("/")[1] ?? e).toUpperCase().slice(0, 6) : "";
|
|
685
|
-
}
|
|
686
|
-
function Ce(e) {
|
|
687
|
-
let { field: t, fieldName: n, value: r, onChange: i, mode: a, disabled: o } = e, s = M(r), [c, l] = V([]), { register: u, unregister: d, isDraft: p } = m(), h = B(s);
|
|
688
|
-
h.current = s;
|
|
689
|
-
let _ = B(null), v = B(/* @__PURE__ */ new Set()), x = B([]);
|
|
690
|
-
x.current = c;
|
|
691
|
-
let { open: C } = te();
|
|
692
|
-
R(() => () => {
|
|
693
|
-
x.current.forEach((e) => e.abort());
|
|
694
|
-
}, []);
|
|
695
|
-
let w = (t.accepts ?? []).join(","), T = a === "display", E = L(async (r) => {
|
|
696
|
-
let a = S(r, t.accepts, t.max_size_bytes), o = `row-${Math.random().toString(36).slice(2)}-${Date.now()}`, s = new AbortController();
|
|
697
|
-
if (a) {
|
|
698
|
-
l((e) => [...e, {
|
|
699
|
-
localId: o,
|
|
700
|
-
filename: r.name,
|
|
701
|
-
progress: null,
|
|
702
|
-
error: a,
|
|
703
|
-
abort: () => {}
|
|
704
|
-
}]);
|
|
705
|
-
return;
|
|
706
|
-
}
|
|
707
|
-
l((e) => [...e, {
|
|
708
|
-
localId: o,
|
|
709
|
-
filename: r.name,
|
|
710
|
-
progress: {
|
|
711
|
-
loaded: 0,
|
|
712
|
-
total: r.size,
|
|
713
|
-
pct: 0
|
|
714
|
-
},
|
|
715
|
-
error: null,
|
|
716
|
-
abort: () => s.abort()
|
|
717
|
-
}]);
|
|
718
|
-
try {
|
|
719
|
-
let t = await g({
|
|
720
|
-
file: r,
|
|
721
|
-
entityCode: e.entityCode,
|
|
722
|
-
fieldCode: n,
|
|
723
|
-
signal: s.signal,
|
|
724
|
-
onProgress: (e) => l((t) => t.map((t) => t.localId === o ? {
|
|
725
|
-
...t,
|
|
726
|
-
progress: e
|
|
727
|
-
} : t))
|
|
728
|
-
});
|
|
729
|
-
if (v.current.delete(o)) {
|
|
730
|
-
b(t.id).catch(() => {}), d(t.id);
|
|
731
|
-
return;
|
|
732
|
-
}
|
|
733
|
-
u(t.id, () => b(t.id));
|
|
734
|
-
let a = {
|
|
735
|
-
id: t.id,
|
|
736
|
-
filename: t.filename,
|
|
737
|
-
content_type: t.content_type,
|
|
738
|
-
size_bytes: t.size_bytes,
|
|
739
|
-
sha256: t.sha256,
|
|
740
|
-
width: t.width,
|
|
741
|
-
height: t.height,
|
|
742
|
-
url: t.url,
|
|
743
|
-
metadata: t.metadata
|
|
744
|
-
}, c = [...h.current, a];
|
|
745
|
-
h.current = c, i?.(c), l((e) => e.filter((e) => e.localId !== o));
|
|
746
|
-
} catch (e) {
|
|
747
|
-
if (e instanceof y && e.code === "ABORTED") {
|
|
748
|
-
l((e) => e.filter((e) => e.localId !== o));
|
|
749
|
-
return;
|
|
750
|
-
}
|
|
751
|
-
let t = e instanceof y ? {
|
|
752
|
-
code: e.code,
|
|
753
|
-
message: e.message
|
|
754
|
-
} : {
|
|
755
|
-
code: "UNKNOWN",
|
|
756
|
-
message: e instanceof Error ? e.message : "Upload failed"
|
|
757
|
-
};
|
|
758
|
-
l((e) => e.map((e) => e.localId === o ? {
|
|
759
|
-
...e,
|
|
760
|
-
error: t,
|
|
761
|
-
progress: null,
|
|
762
|
-
abort: () => {}
|
|
763
|
-
} : e));
|
|
764
|
-
}
|
|
765
|
-
}, [
|
|
766
|
-
t.accepts,
|
|
767
|
-
t.max_size_bytes,
|
|
768
|
-
n,
|
|
769
|
-
i,
|
|
770
|
-
e.entityCode,
|
|
771
|
-
u,
|
|
772
|
-
d
|
|
773
|
-
]), D = L((e) => {
|
|
774
|
-
Array.from(e).forEach((e) => void E(e));
|
|
775
|
-
}, [E]), O = L(() => {
|
|
776
|
-
o || _.current?.click();
|
|
777
|
-
}, [o]), ee = L((e) => {
|
|
778
|
-
let t = e.target.files;
|
|
779
|
-
e.target.value = "", t && t.length > 0 && D(t);
|
|
780
|
-
}, [D]), A = L((e) => {
|
|
781
|
-
p(e) && (b(e).catch(() => {}), d(e)), i?.(s.filter((t) => t.id !== e));
|
|
782
|
-
}, [
|
|
783
|
-
p,
|
|
784
|
-
s,
|
|
785
|
-
i,
|
|
786
|
-
d
|
|
787
|
-
]), j = L((e) => {
|
|
788
|
-
C(e.id, "download", k(e));
|
|
789
|
-
}, [C]);
|
|
790
|
-
return /* @__PURE__ */ W("div", {
|
|
791
|
-
"data-testid": `file-widget-${n}`,
|
|
792
|
-
className: "flex flex-col gap-2",
|
|
793
|
-
children: [/* @__PURE__ */ W("ul", {
|
|
794
|
-
className: "flex flex-col divide-y divide-divider rounded-md border border-border bg-surface",
|
|
795
|
-
children: [
|
|
796
|
-
s.length === 0 && c.length === 0 && /* @__PURE__ */ U("li", {
|
|
797
|
-
className: "px-3 py-4 text-center text-sm text-muted-foreground",
|
|
798
|
-
children: t.display?.placeholder || "No files"
|
|
799
|
-
}),
|
|
800
|
-
s.map((e) => /* @__PURE__ */ W("li", {
|
|
801
|
-
className: "flex items-center gap-3 px-3 py-2",
|
|
802
|
-
"data-testid": `row-${e.id}`,
|
|
803
|
-
children: [
|
|
804
|
-
/* @__PURE__ */ U("span", {
|
|
805
|
-
className: "flex-none rounded-sm border border-border bg-surface-3 px-1.5 py-0.5 text-[10px] text-muted-foreground",
|
|
806
|
-
children: Se(e.content_type)
|
|
807
|
-
}),
|
|
808
|
-
/* @__PURE__ */ U("button", {
|
|
809
|
-
type: "button",
|
|
810
|
-
onClick: () => j(e),
|
|
811
|
-
className: "min-w-0 flex-1 truncate text-left text-sm text-foreground hover:underline",
|
|
812
|
-
title: e.filename,
|
|
813
|
-
children: e.filename
|
|
814
|
-
}),
|
|
815
|
-
/* @__PURE__ */ U("span", {
|
|
816
|
-
className: "flex-none text-xs text-muted-foreground",
|
|
817
|
-
children: f(e.size_bytes)
|
|
818
|
-
}),
|
|
819
|
-
/* @__PURE__ */ U("button", {
|
|
820
|
-
type: "button",
|
|
821
|
-
className: "flex-none rounded-sm border border-border bg-card px-2 py-0.5 text-xs text-foreground hover:bg-surface-2",
|
|
822
|
-
onClick: () => j(e),
|
|
823
|
-
"data-testid": `download-${e.id}`,
|
|
824
|
-
children: "Download"
|
|
825
|
-
}),
|
|
826
|
-
!T && /* @__PURE__ */ U("button", {
|
|
827
|
-
type: "button",
|
|
828
|
-
className: "flex-none rounded-sm border border-border bg-card px-2 py-0.5 text-xs text-destructive hover:bg-surface-2",
|
|
829
|
-
onClick: () => A(e.id),
|
|
830
|
-
disabled: o,
|
|
831
|
-
"data-testid": `remove-${e.id}`,
|
|
832
|
-
children: "Remove"
|
|
833
|
-
})
|
|
834
|
-
]
|
|
835
|
-
}, e.id)),
|
|
836
|
-
c.map((e) => /* @__PURE__ */ W("li", {
|
|
837
|
-
className: "flex items-center gap-3 px-3 py-2",
|
|
838
|
-
"data-testid": `pending-row-${e.localId}`,
|
|
839
|
-
"aria-busy": !e.error,
|
|
840
|
-
"aria-invalid": !!e.error || void 0,
|
|
841
|
-
children: [
|
|
842
|
-
/* @__PURE__ */ U("span", {
|
|
843
|
-
className: "flex-none truncate text-sm text-foreground",
|
|
844
|
-
title: e.filename,
|
|
845
|
-
children: e.filename
|
|
846
|
-
}),
|
|
847
|
-
/* @__PURE__ */ U("span", { className: "flex-1" }),
|
|
848
|
-
e.error ? /* @__PURE__ */ U("span", {
|
|
849
|
-
role: "alert",
|
|
850
|
-
className: "text-xs text-destructive",
|
|
851
|
-
children: e.error.message
|
|
852
|
-
}) : /* @__PURE__ */ W("span", {
|
|
853
|
-
className: "text-xs text-muted-foreground",
|
|
854
|
-
role: "progressbar",
|
|
855
|
-
"aria-valuenow": e.progress?.pct ?? 0,
|
|
856
|
-
"aria-valuemin": 0,
|
|
857
|
-
"aria-valuemax": 100,
|
|
858
|
-
children: [e.progress?.pct ?? 0, "%"]
|
|
859
|
-
}),
|
|
860
|
-
/* @__PURE__ */ U("button", {
|
|
861
|
-
type: "button",
|
|
862
|
-
className: "flex-none rounded-sm border border-border bg-card px-2 py-0.5 text-xs",
|
|
863
|
-
onClick: () => {
|
|
864
|
-
e.abort(), v.current.add(e.localId), l((t) => t.filter((t) => t.localId !== e.localId));
|
|
865
|
-
},
|
|
866
|
-
children: e.error ? "Dismiss" : "Cancel"
|
|
867
|
-
})
|
|
868
|
-
]
|
|
869
|
-
}, e.localId))
|
|
870
|
-
]
|
|
871
|
-
}), !T && /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U("button", {
|
|
872
|
-
type: "button",
|
|
873
|
-
className: "self-start rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
|
|
874
|
-
onClick: O,
|
|
875
|
-
disabled: o,
|
|
876
|
-
"data-testid": "add-files",
|
|
877
|
-
children: "Add files"
|
|
878
|
-
}), /* @__PURE__ */ U("input", {
|
|
879
|
-
ref: _,
|
|
880
|
-
type: "file",
|
|
881
|
-
accept: w || void 0,
|
|
882
|
-
multiple: !0,
|
|
883
|
-
onChange: ee,
|
|
884
|
-
style: { display: "none" },
|
|
885
|
-
"data-testid": `file-input-${n}`
|
|
886
|
-
})] })]
|
|
887
|
-
});
|
|
888
|
-
}
|
|
889
|
-
//#endregion
|
|
890
|
-
//#region src/components/file-widgets/LabeledSlots.tsx
|
|
891
|
-
function we(e) {
|
|
892
|
-
return !e || Array.isArray(e) || typeof e != "object" ? {} : e;
|
|
893
|
-
}
|
|
894
|
-
function Te(e) {
|
|
895
|
-
return e.split("_").filter(Boolean).map((e) => e.slice(0, 1).toUpperCase() + e.slice(1)).join(" ");
|
|
896
|
-
}
|
|
897
|
-
function Ee(e, t) {
|
|
898
|
-
return t?.content_type?.startsWith("image/") ? !0 : (e?.accepts ?? []).some((e) => e === "image/*" || e.startsWith("image/"));
|
|
899
|
-
}
|
|
900
|
-
function De(e, t, n, r) {
|
|
901
|
-
return {
|
|
902
|
-
...e,
|
|
903
|
-
name: `${e.name}.${t}`,
|
|
904
|
-
mode: "single",
|
|
905
|
-
accepts: n?.accepts ?? e.accepts,
|
|
906
|
-
max_size_bytes: n?.max_size_bytes ?? e.max_size_bytes,
|
|
907
|
-
slots: void 0,
|
|
908
|
-
display: {
|
|
909
|
-
...e.display ?? { widget: "document_card" },
|
|
910
|
-
widget: Ee(n, r) ? "square_image" : "document_card",
|
|
911
|
-
aspect_ratio: n?.aspect_ratio ?? e.display?.aspect_ratio,
|
|
912
|
-
placeholder: e.display?.placeholder ?? Te(t)
|
|
913
|
-
}
|
|
914
|
-
};
|
|
915
|
-
}
|
|
916
|
-
function Oe(e) {
|
|
917
|
-
let { field: t, fieldName: n, entityCode: r, value: i, onChange: a, mode: o, disabled: s } = e, c = Object.entries(t.slots ?? {}), l = we(i);
|
|
918
|
-
return c.length === 0 ? /* @__PURE__ */ U("span", {
|
|
919
|
-
className: "text-sm text-muted-foreground",
|
|
920
|
-
children: "No slots configured"
|
|
921
|
-
}) : /* @__PURE__ */ U("div", {
|
|
922
|
-
style: {
|
|
923
|
-
display: "grid",
|
|
924
|
-
gap: 12
|
|
925
|
-
},
|
|
926
|
-
children: c.map(([e, i]) => {
|
|
927
|
-
let c = l[e] ?? null, u = De(t, e, i, c), d = u.display?.widget ?? "document_card", f = q(d);
|
|
928
|
-
return f ? /* @__PURE__ */ W("div", {
|
|
929
|
-
style: {
|
|
930
|
-
display: "grid",
|
|
931
|
-
gap: 6
|
|
932
|
-
},
|
|
933
|
-
children: [/* @__PURE__ */ U("div", {
|
|
934
|
-
style: {
|
|
935
|
-
fontSize: 12,
|
|
936
|
-
fontWeight: 600,
|
|
937
|
-
color: "var(--text-2)"
|
|
938
|
-
},
|
|
939
|
-
children: Te(e)
|
|
940
|
-
}), /* @__PURE__ */ U(f, {
|
|
941
|
-
field: u,
|
|
942
|
-
fieldName: e,
|
|
943
|
-
entityCode: r,
|
|
944
|
-
value: c,
|
|
945
|
-
mode: o,
|
|
946
|
-
disabled: s,
|
|
947
|
-
uploadFieldCode: n,
|
|
948
|
-
uploadSlotCode: e,
|
|
949
|
-
onChange: (t) => {
|
|
950
|
-
a && a({
|
|
951
|
-
...l,
|
|
952
|
-
[e]: t ?? null
|
|
953
|
-
});
|
|
954
|
-
}
|
|
955
|
-
})]
|
|
956
|
-
}, e) : /* @__PURE__ */ W("div", {
|
|
957
|
-
style: {
|
|
958
|
-
display: "grid",
|
|
959
|
-
gap: 6
|
|
960
|
-
},
|
|
961
|
-
children: [/* @__PURE__ */ U("div", {
|
|
962
|
-
style: {
|
|
963
|
-
fontSize: 12,
|
|
964
|
-
fontWeight: 600,
|
|
965
|
-
color: "var(--text-2)"
|
|
966
|
-
},
|
|
967
|
-
children: Te(e)
|
|
968
|
-
}), /* @__PURE__ */ U("span", {
|
|
969
|
-
className: "text-sm text-muted-foreground",
|
|
970
|
-
children: `Unknown file widget: ${d}`
|
|
971
|
-
})]
|
|
972
|
-
}, e);
|
|
973
|
-
})
|
|
974
|
-
});
|
|
975
|
-
}
|
|
976
|
-
//#endregion
|
|
977
|
-
//#region src/components/file-widgets/builtins.ts
|
|
978
|
-
var ke = !1;
|
|
979
|
-
function Ae() {
|
|
980
|
-
ke ||= (K("square_image", he), K("circle_image", ge), K("wide_banner", X), K("grid", ve), K("document_card", be), K("file_list", Ce), K("labeled_slots", Oe), !0);
|
|
981
|
-
}
|
|
982
|
-
//#endregion
|
|
983
|
-
//#region src/components/file-widgets/host.tsx
|
|
984
|
-
Ae();
|
|
985
|
-
function je(e, t) {
|
|
986
|
-
return e.files?.get(t);
|
|
987
|
-
}
|
|
988
|
-
function Me(e, t) {
|
|
989
|
-
return Object.prototype.hasOwnProperty.call(e, t) ? e[t] ?? null : e.$files?.[t] ?? null;
|
|
990
|
-
}
|
|
991
|
-
function Ne(e, t, n) {
|
|
992
|
-
if (je(e, n)) return Me(t, n);
|
|
993
|
-
let r = e.fields.get(n);
|
|
994
|
-
return r?.type === "rich_text" && r.files?.mode === "rich_text_inline" ? p(t[n], Me(t, n)) : t[n];
|
|
995
|
-
}
|
|
996
|
-
function Pe(e, t, n) {
|
|
997
|
-
let r = e.fields.get(t);
|
|
998
|
-
return r?.type === "rich_text" && r.files?.mode === "rich_text_inline" ? _(n) : n;
|
|
999
|
-
}
|
|
1000
|
-
function Fe(e, t, r) {
|
|
1001
|
-
let i = je(e, t);
|
|
1002
|
-
if (i) return i.name || t;
|
|
1003
|
-
let a = e.fields.get(t);
|
|
1004
|
-
return a ? n(a, t, r) : t;
|
|
1005
|
-
}
|
|
1006
|
-
function Ie(e) {
|
|
1007
|
-
let { entity: t, entityCode: n, fieldName: r, record: i, mode: a, onChange: o, refs: s, disabled: c, surface: l, entities: u, screens: d, locale: f, fieldId: p, labelId: m, structure: h, detailScreen: g } = e, _ = je(t, r);
|
|
1008
|
-
if (_) {
|
|
1009
|
-
let e = _.display?.widget ?? "", t = q(e);
|
|
1010
|
-
return t ? /* @__PURE__ */ U(t, {
|
|
1011
|
-
field: _,
|
|
1012
|
-
fieldName: r,
|
|
1013
|
-
entityCode: n,
|
|
1014
|
-
value: Me(i, r),
|
|
1015
|
-
mode: a,
|
|
1016
|
-
onChange: o,
|
|
1017
|
-
disabled: c,
|
|
1018
|
-
fieldId: p
|
|
1019
|
-
}) : /* @__PURE__ */ U("span", {
|
|
1020
|
-
className: "text-sm text-muted-foreground",
|
|
1021
|
-
children: e ? `Unknown file widget: ${e}` : "Missing file widget"
|
|
1022
|
-
});
|
|
1023
|
-
}
|
|
1024
|
-
let v = t.fields.get(r), y = h && a === "display" && v ? {
|
|
1025
|
-
...v,
|
|
1026
|
-
structure: h
|
|
1027
|
-
} : v;
|
|
1028
|
-
return y ? x({
|
|
1029
|
-
field: y,
|
|
1030
|
-
entityCode: n,
|
|
1031
|
-
fieldName: r,
|
|
1032
|
-
value: Ne(t, i, r),
|
|
1033
|
-
mode: a,
|
|
1034
|
-
onChange: o,
|
|
1035
|
-
record: i,
|
|
1036
|
-
refs: s,
|
|
1037
|
-
surface: l,
|
|
1038
|
-
entity: n && u ? u[n] : void 0,
|
|
1039
|
-
entities: u,
|
|
1040
|
-
screens: d,
|
|
1041
|
-
locale: f,
|
|
1042
|
-
fieldId: p,
|
|
1043
|
-
labelId: m,
|
|
1044
|
-
detailScreen: g
|
|
1045
|
-
}) : null;
|
|
1046
|
-
}
|
|
1047
|
-
//#endregion
|
|
1048
|
-
//#region src/components/actions/ResponsiveActionBar.tsx
|
|
1049
|
-
function Le(e, t) {
|
|
1050
|
-
return e.replace(/\$\{([^}]+)\}/g, (e, n) => Object.prototype.hasOwnProperty.call(t, n) ? t[n] : e);
|
|
1051
|
-
}
|
|
1052
|
-
function Re(e) {
|
|
1053
|
-
return e.widget ? "widget" : e.href ? "href" : e.handler ? "handler" : e.association ? "association" : e.ui_steps && e.ui_steps.length > 0 ? "ui_steps" : "unknown";
|
|
1054
|
-
}
|
|
1055
|
-
function ze(e, t, n, r, i) {
|
|
1056
|
-
let a = Re(t), o = l(n, r?.entity), s = r?.entityCode ?? "";
|
|
1057
|
-
if (e === "__peek") return i?.({
|
|
1058
|
-
code: e,
|
|
1059
|
-
entity: s,
|
|
1060
|
-
mode: "peek",
|
|
1061
|
-
rowId: o
|
|
1062
|
-
}), r?.openPeek?.(n), !0;
|
|
1063
|
-
if (i?.({
|
|
1064
|
-
code: e,
|
|
1065
|
-
entity: s,
|
|
1066
|
-
mode: a,
|
|
1067
|
-
rowId: o
|
|
1068
|
-
}), a === "widget") return console.warn(`[ResponsiveActionBar] widget "${t.widget}" requested for action "${e}" but the widget registry ships in Phase 2; falling back to onRun.`), !1;
|
|
1069
|
-
if (a === "href" && r) {
|
|
1070
|
-
let e = Le(t.href ?? "", {
|
|
1071
|
-
entity: s,
|
|
1072
|
-
id: encodeURIComponent(o)
|
|
1073
|
-
}), n = e.indexOf("?");
|
|
1074
|
-
return n === -1 ? r.tabNavigate(e) : r.tabNavigate(e.slice(0, n), { search: e.slice(n + 1) }), !0;
|
|
1075
|
-
}
|
|
1076
|
-
return a === "handler" || a === "association" || a === "ui_steps" || a === "unknown" && console.warn(`[ResponsiveActionBar] no dispatch mode set on action "${e}" (none of handler/association/widget/href/ui_steps).`), !1;
|
|
1077
|
-
}
|
|
1078
|
-
function Be(e) {
|
|
1079
|
-
let t = 0;
|
|
1080
|
-
for (let n of e) n.kind === "action" ? t++ : t += Be(n.items);
|
|
1081
|
-
return t;
|
|
1082
|
-
}
|
|
1083
|
-
function Ve(e, t, n) {
|
|
1084
|
-
let r = [], i = [];
|
|
1085
|
-
for (let a of e) a.kind === "action" && Q(a.code, t, n)?.destructive ? i.push(a) : r.push(a);
|
|
1086
|
-
return {
|
|
1087
|
-
normal: r,
|
|
1088
|
-
destructive: i
|
|
1089
|
-
};
|
|
1090
|
-
}
|
|
1091
|
-
function He(e, t, n) {
|
|
1092
|
-
let r = [], i = [], a = [];
|
|
1093
|
-
for (let o of e) {
|
|
1094
|
-
if (o.kind !== "action") {
|
|
1095
|
-
i.push(o);
|
|
1096
|
-
continue;
|
|
1097
|
-
}
|
|
1098
|
-
let e = Q(o.code, t, n), s = e?.destructive === !0, c = e?.display?.primary === !0;
|
|
1099
|
-
if (s && c) {
|
|
1100
|
-
console.warn(`[ResponsiveActionBar] action "${o.code}" declares both primary and destructive; treating as destructive.`), a.push(o);
|
|
1101
|
-
continue;
|
|
1102
|
-
}
|
|
1103
|
-
if (s) {
|
|
1104
|
-
a.push(o);
|
|
1105
|
-
continue;
|
|
1106
|
-
}
|
|
1107
|
-
if (c) {
|
|
1108
|
-
r.push(o);
|
|
1109
|
-
continue;
|
|
1110
|
-
}
|
|
1111
|
-
i.push(o);
|
|
1112
|
-
}
|
|
1113
|
-
return {
|
|
1114
|
-
primary: r,
|
|
1115
|
-
regular: i,
|
|
1116
|
-
destructive: a
|
|
1117
|
-
};
|
|
1118
|
-
}
|
|
1119
|
-
function Q(e, t, n) {
|
|
1120
|
-
if (t && e in t) return t[e];
|
|
1121
|
-
if (n && e in n) return n[e];
|
|
1122
|
-
}
|
|
1123
|
-
function Ue(e, t, n) {
|
|
1124
|
-
let r = Q(e, t, n);
|
|
1125
|
-
return v(r?.display?.name) || e;
|
|
1126
|
-
}
|
|
1127
|
-
function We(e, t, n) {
|
|
1128
|
-
return Q(e, t, n)?.display?.icon || void 0;
|
|
1129
|
-
}
|
|
1130
|
-
function Ge(e) {
|
|
1131
|
-
return `action-tooltip-${e}`;
|
|
1132
|
-
}
|
|
1133
|
-
function Ke({ leaf: e, entityActions: n, globalActions: i, onRun: a, loading: o, onLoadingChange: c, measureRef: l, style: d, row: f, widgetContext: p, onActionClick: m, iconOnly: h = !1 }) {
|
|
1134
|
-
let g = Q(e.code, n, i), _ = Ue(e.code, n, i), v = We(e.code, n, i), y = g?.destructive ?? !1, b = !y && g?.display?.primary === !0, x = !e.enabled, S = x ? Ge(e.code) : void 0, C = L(async () => {
|
|
1135
|
-
if (!(!g || x || o)) {
|
|
1136
|
-
c(!0);
|
|
1137
|
-
try {
|
|
1138
|
-
ze(e.code, g, f, p, m) || await Promise.resolve(a(e.code, g));
|
|
1139
|
-
} finally {
|
|
1140
|
-
c(!1);
|
|
1141
|
-
}
|
|
1142
|
-
}
|
|
1143
|
-
}, [
|
|
1144
|
-
g,
|
|
1145
|
-
x,
|
|
1146
|
-
o,
|
|
1147
|
-
a,
|
|
1148
|
-
e.code,
|
|
1149
|
-
c,
|
|
1150
|
-
f,
|
|
1151
|
-
p,
|
|
1152
|
-
m
|
|
1153
|
-
]), w = o ? /* @__PURE__ */ U(s, { size: 12 }) : v ? /* @__PURE__ */ U(t, {
|
|
1154
|
-
name: v,
|
|
1155
|
-
size: 12
|
|
1156
|
-
}) : null;
|
|
1157
|
-
return /* @__PURE__ */ W(H, { children: [S && e.reason && /* @__PURE__ */ U("span", {
|
|
1158
|
-
id: S,
|
|
1159
|
-
role: "tooltip",
|
|
1160
|
-
style: {
|
|
1161
|
-
position: "absolute",
|
|
1162
|
-
width: 1,
|
|
1163
|
-
height: 1,
|
|
1164
|
-
overflow: "hidden",
|
|
1165
|
-
clip: "rect(0,0,0,0)"
|
|
1166
|
-
},
|
|
1167
|
-
children: e.reason
|
|
1168
|
-
}), /* @__PURE__ */ U(u, {
|
|
1169
|
-
ref: l,
|
|
1170
|
-
kind: b ? "primary" : "default",
|
|
1171
|
-
danger: y,
|
|
1172
|
-
icon: w,
|
|
1173
|
-
disabled: x || o,
|
|
1174
|
-
"aria-disabled": x ? "true" : void 0,
|
|
1175
|
-
"aria-describedby": S,
|
|
1176
|
-
"aria-label": h ? _ : void 0,
|
|
1177
|
-
title: r(g, _, x, e.reason, h),
|
|
1178
|
-
onClick: C,
|
|
1179
|
-
style: d,
|
|
1180
|
-
children: h ? null : _
|
|
1181
|
-
})] });
|
|
1182
|
-
}
|
|
1183
|
-
function qe({ group: n, entityActions: r, globalActions: i, onRun: a, loading: c, onLoadingChange: l, measureRef: d, style: f, row: p, widgetContext: m, onActionClick: h }) {
|
|
1184
|
-
let g = B(null), [_, y] = V(!1), b = n.name ? v(n.name) : "Actions", x = L((e) => {
|
|
1185
|
-
g.current = e, d?.(e);
|
|
1186
|
-
}, [d]), S = L((e, t) => (y(!1), a(e, t)), [a]);
|
|
1187
|
-
return /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U(u, {
|
|
1188
|
-
ref: x,
|
|
1189
|
-
kind: "default",
|
|
1190
|
-
icon: c == null ? n.icon ? /* @__PURE__ */ U(t, {
|
|
1191
|
-
name: n.icon,
|
|
1192
|
-
size: 12
|
|
1193
|
-
}) : void 0 : /* @__PURE__ */ U(s, { size: 12 }),
|
|
1194
|
-
iconRight: /* @__PURE__ */ U(e.down, { size: 10 }),
|
|
1195
|
-
"aria-haspopup": "menu",
|
|
1196
|
-
"aria-expanded": _ ? "true" : "false",
|
|
1197
|
-
title: b,
|
|
1198
|
-
onClick: () => y((e) => !e),
|
|
1199
|
-
style: f,
|
|
1200
|
-
children: b
|
|
1201
|
-
}), /* @__PURE__ */ U(o, {
|
|
1202
|
-
open: _,
|
|
1203
|
-
anchor: g.current,
|
|
1204
|
-
onClose: () => y(!1),
|
|
1205
|
-
align: "start",
|
|
1206
|
-
width: 200,
|
|
1207
|
-
children: /* @__PURE__ */ U("div", {
|
|
1208
|
-
role: "menu",
|
|
1209
|
-
"aria-label": b,
|
|
1210
|
-
children: n.items.map((e) => e.kind === "action" ? /* @__PURE__ */ U(Je, {
|
|
1211
|
-
leaf: e,
|
|
1212
|
-
entityActions: r,
|
|
1213
|
-
globalActions: i,
|
|
1214
|
-
onRun: S,
|
|
1215
|
-
loading: c === e.code,
|
|
1216
|
-
onLoadingChange: (t) => l(t ? e.code : null),
|
|
1217
|
-
row: p,
|
|
1218
|
-
widgetContext: m,
|
|
1219
|
-
onActionClick: h
|
|
1220
|
-
}, e.code) : /* @__PURE__ */ U(Ye, {
|
|
1221
|
-
group: e,
|
|
1222
|
-
entityActions: r,
|
|
1223
|
-
globalActions: i,
|
|
1224
|
-
onRun: S,
|
|
1225
|
-
loading: c,
|
|
1226
|
-
onLoadingChange: l,
|
|
1227
|
-
row: p,
|
|
1228
|
-
widgetContext: m,
|
|
1229
|
-
onActionClick: h
|
|
1230
|
-
}, e.items[0]?.kind === "action" ? e.items[0].code : e.icon ?? "group"))
|
|
1231
|
-
})
|
|
1232
|
-
})] });
|
|
1233
|
-
}
|
|
1234
|
-
function Je({ leaf: e, entityActions: n, globalActions: i, onRun: a, loading: o, onLoadingChange: c, row: l, widgetContext: u, onActionClick: d }) {
|
|
1235
|
-
let f = Q(e.code, n, i), p = Ue(e.code, n, i), m = We(e.code, n, i), h = f?.destructive ?? !1, g = !e.enabled, _ = g ? Ge(e.code) : void 0, v = o ? /* @__PURE__ */ U(s, { size: 12 }) : m ? /* @__PURE__ */ U(t, {
|
|
1236
|
-
name: m,
|
|
1237
|
-
size: 12
|
|
1238
|
-
}) : null;
|
|
1239
|
-
return /* @__PURE__ */ W(H, { children: [_ && e.reason && /* @__PURE__ */ U("span", {
|
|
1240
|
-
id: _,
|
|
1241
|
-
role: "tooltip",
|
|
1242
|
-
style: {
|
|
1243
|
-
position: "absolute",
|
|
1244
|
-
width: 1,
|
|
1245
|
-
height: 1,
|
|
1246
|
-
overflow: "hidden",
|
|
1247
|
-
clip: "rect(0,0,0,0)"
|
|
1248
|
-
},
|
|
1249
|
-
children: e.reason
|
|
1250
|
-
}), /* @__PURE__ */ W("div", {
|
|
1251
|
-
role: "menuitem",
|
|
1252
|
-
"aria-disabled": g ? "true" : void 0,
|
|
1253
|
-
"aria-describedby": _,
|
|
1254
|
-
title: r(f, p, g, e.reason),
|
|
1255
|
-
onClick: async () => {
|
|
1256
|
-
if (!(!f || g || o)) {
|
|
1257
|
-
c(!0);
|
|
1258
|
-
try {
|
|
1259
|
-
ze(e.code, f, l, u, d) || await Promise.resolve(a(e.code, f));
|
|
1260
|
-
} finally {
|
|
1261
|
-
c(!1);
|
|
1262
|
-
}
|
|
1263
|
-
}
|
|
1264
|
-
},
|
|
1265
|
-
style: {
|
|
1266
|
-
display: "flex",
|
|
1267
|
-
alignItems: "center",
|
|
1268
|
-
gap: 8,
|
|
1269
|
-
padding: "6px 10px",
|
|
1270
|
-
borderRadius: 5,
|
|
1271
|
-
fontSize: 12.5,
|
|
1272
|
-
color: h ? "var(--danger)" : g ? "var(--text-3)" : "var(--text-2)",
|
|
1273
|
-
cursor: g ? "not-allowed" : "pointer",
|
|
1274
|
-
opacity: g ? .6 : 1
|
|
1275
|
-
},
|
|
1276
|
-
onMouseEnter: (e) => {
|
|
1277
|
-
g || (e.currentTarget.style.background = "var(--surface-3)");
|
|
1278
|
-
},
|
|
1279
|
-
onMouseLeave: (e) => {
|
|
1280
|
-
e.currentTarget.style.background = "transparent";
|
|
1281
|
-
},
|
|
1282
|
-
children: [v && /* @__PURE__ */ U("span", {
|
|
1283
|
-
style: {
|
|
1284
|
-
color: h ? "var(--danger)" : "var(--text-3)",
|
|
1285
|
-
display: "flex"
|
|
1286
|
-
},
|
|
1287
|
-
children: v
|
|
1288
|
-
}), /* @__PURE__ */ U("span", {
|
|
1289
|
-
style: { flex: 1 },
|
|
1290
|
-
children: p
|
|
1291
|
-
})]
|
|
1292
|
-
})] });
|
|
1293
|
-
}
|
|
1294
|
-
function Ye({ group: e, entityActions: t, globalActions: n, onRun: r, loading: i, onLoadingChange: a, row: o, widgetContext: s, onActionClick: c }) {
|
|
1295
|
-
let l = e.name ? v(e.name) : void 0;
|
|
1296
|
-
return /* @__PURE__ */ W(H, { children: [l && /* @__PURE__ */ U("div", {
|
|
1297
|
-
style: {
|
|
1298
|
-
padding: "4px 10px 2px",
|
|
1299
|
-
fontSize: 10.5,
|
|
1300
|
-
fontWeight: 600,
|
|
1301
|
-
color: "var(--text-3)",
|
|
1302
|
-
textTransform: "uppercase",
|
|
1303
|
-
letterSpacing: "0.05em"
|
|
1304
|
-
},
|
|
1305
|
-
children: l
|
|
1306
|
-
}), e.items.map((e) => e.kind === "action" ? /* @__PURE__ */ U(Je, {
|
|
1307
|
-
leaf: e,
|
|
1308
|
-
entityActions: t,
|
|
1309
|
-
globalActions: n,
|
|
1310
|
-
onRun: r,
|
|
1311
|
-
loading: i === e.code,
|
|
1312
|
-
onLoadingChange: (t) => a(t ? e.code : null),
|
|
1313
|
-
row: o,
|
|
1314
|
-
widgetContext: s,
|
|
1315
|
-
onActionClick: c
|
|
1316
|
-
}, e.code) : /* @__PURE__ */ U(Ye, {
|
|
1317
|
-
group: e,
|
|
1318
|
-
entityActions: t,
|
|
1319
|
-
globalActions: n,
|
|
1320
|
-
onRun: r,
|
|
1321
|
-
loading: i,
|
|
1322
|
-
onLoadingChange: a,
|
|
1323
|
-
row: o,
|
|
1324
|
-
widgetContext: s,
|
|
1325
|
-
onActionClick: c
|
|
1326
|
-
}, e.icon ?? "nested"))] });
|
|
1327
|
-
}
|
|
1328
|
-
function Xe({ layout: t, entityActions: n, globalActions: r, onRun: a, row: c, widgetContext: l, onActionClick: u }) {
|
|
1329
|
-
let d = B(null), [f, p] = V(!1), [m, h] = V(null), g = L((e, t) => (p(!1), a(e, t)), [a]);
|
|
1330
|
-
return Be(t) === 0 ? null : /* @__PURE__ */ W("div", {
|
|
1331
|
-
"data-open": f ? "true" : void 0,
|
|
1332
|
-
style: {
|
|
1333
|
-
display: "inline-flex",
|
|
1334
|
-
alignItems: "center"
|
|
1335
|
-
},
|
|
1336
|
-
children: [/* @__PURE__ */ U(i, {
|
|
1337
|
-
ref: d,
|
|
1338
|
-
icon: U(m == null ? e.more : s, { size: 14 }),
|
|
1339
|
-
title: "Actions",
|
|
1340
|
-
size: 28,
|
|
1341
|
-
onClick: () => p((e) => !e)
|
|
1342
|
-
}), /* @__PURE__ */ U(o, {
|
|
1343
|
-
open: f,
|
|
1344
|
-
anchor: d.current,
|
|
1345
|
-
onClose: () => p(!1),
|
|
1346
|
-
align: "end",
|
|
1347
|
-
width: 220,
|
|
1348
|
-
children: /* @__PURE__ */ U(Qe, {
|
|
1349
|
-
layout: t,
|
|
1350
|
-
entityActions: n,
|
|
1351
|
-
globalActions: r,
|
|
1352
|
-
onRun: g,
|
|
1353
|
-
loading: m,
|
|
1354
|
-
onLoadingChange: h,
|
|
1355
|
-
row: c,
|
|
1356
|
-
widgetContext: l,
|
|
1357
|
-
onActionClick: u
|
|
1358
|
-
})
|
|
1359
|
-
})]
|
|
1360
|
-
});
|
|
1361
|
-
}
|
|
1362
|
-
function Ze(e) {
|
|
1363
|
-
let t = 0;
|
|
1364
|
-
for (let n of e) if (n.kind === "action" && d(n.code)) t++;
|
|
1365
|
-
else break;
|
|
1366
|
-
return t;
|
|
1367
|
-
}
|
|
1368
|
-
function Qe({ layout: e, entityActions: t, globalActions: n, onRun: r, loading: i, onLoadingChange: a, row: o, widgetContext: s, onActionClick: c, ariaLabel: l = "Row actions" }) {
|
|
1369
|
-
let { normal: u, destructive: d } = Ve(e, t, n), f = Ze(u), p = u.slice(0, f), m = u.slice(f), g = d.length > 0, _ = m.length > 0, v = (e) => /* @__PURE__ */ U(Je, {
|
|
1370
|
-
leaf: e,
|
|
1371
|
-
entityActions: t,
|
|
1372
|
-
globalActions: n,
|
|
1373
|
-
onRun: r,
|
|
1374
|
-
loading: i === e.code,
|
|
1375
|
-
onLoadingChange: (t) => a(t ? e.code : null),
|
|
1376
|
-
row: o,
|
|
1377
|
-
widgetContext: s,
|
|
1378
|
-
onActionClick: c
|
|
1379
|
-
}, e.code);
|
|
1380
|
-
return /* @__PURE__ */ W("div", {
|
|
1381
|
-
role: "menu",
|
|
1382
|
-
"aria-label": l,
|
|
1383
|
-
children: [
|
|
1384
|
-
p.map((e) => e.kind === "action" ? v(e) : null),
|
|
1385
|
-
p.length > 0 && _ && /* @__PURE__ */ U(h, { divider: !0 }),
|
|
1386
|
-
m.map((e) => e.kind === "action" ? v(e) : /* @__PURE__ */ U(Ye, {
|
|
1387
|
-
group: e,
|
|
1388
|
-
entityActions: t,
|
|
1389
|
-
globalActions: n,
|
|
1390
|
-
onRun: r,
|
|
1391
|
-
loading: i,
|
|
1392
|
-
onLoadingChange: a,
|
|
1393
|
-
row: o,
|
|
1394
|
-
widgetContext: s,
|
|
1395
|
-
onActionClick: c
|
|
1396
|
-
}, e.icon ?? "group")),
|
|
1397
|
-
g && /* @__PURE__ */ U(h, { divider: !0 }),
|
|
1398
|
-
d.map((e) => v(e))
|
|
1399
|
-
]
|
|
1400
|
-
});
|
|
1401
|
-
}
|
|
1402
|
-
var $e = "__overflow_trigger__", et = 90, tt = 4, nt = 8;
|
|
1403
|
-
function rt(e) {
|
|
1404
|
-
return `icon:${$(e)}`;
|
|
1405
|
-
}
|
|
1406
|
-
function it() {
|
|
1407
|
-
return nt;
|
|
1408
|
-
}
|
|
1409
|
-
function at(e, t, n) {
|
|
1410
|
-
return [
|
|
1411
|
-
...e,
|
|
1412
|
-
...t,
|
|
1413
|
-
...n
|
|
1414
|
-
];
|
|
1415
|
-
}
|
|
1416
|
-
var ot = () => {}, st = () => Promise.resolve();
|
|
1417
|
-
function ct(e) {
|
|
1418
|
-
return (t) => {
|
|
1419
|
-
t && (t.setAttribute("data-node-key", e), t.setAttribute("tabindex", "-1"));
|
|
1420
|
-
};
|
|
1421
|
-
}
|
|
1422
|
-
function lt(e, t) {
|
|
1423
|
-
if (e.size !== t.size) return !1;
|
|
1424
|
-
for (let [n, r] of t) if (e.get(n) !== r) return !1;
|
|
1425
|
-
return !0;
|
|
1426
|
-
}
|
|
1427
|
-
function ut(e, t) {
|
|
1428
|
-
return t.get($(e)) ?? 0;
|
|
1429
|
-
}
|
|
1430
|
-
function dt(e, t) {
|
|
1431
|
-
return t.get(rt(e));
|
|
1432
|
-
}
|
|
1433
|
-
function ft(e, t, n, r, i, a, o, s, c) {
|
|
1434
|
-
let { primary: l, regular: u, destructive: d } = He(e, i, a), f = tt, p = r.get($e) ?? et, m = t - n, h = at(l, u, d), g = /* @__PURE__ */ new Set(), _ = /* @__PURE__ */ new Set();
|
|
1435
|
-
if (o) for (let e of h) o(e) && g.add($(e));
|
|
1436
|
-
else {
|
|
1437
|
-
let e = (e, t) => t ? dt(e, r) ?? ut(e, r) : ut(e, r), t = (e) => s ? e.filter((e) => !s.has($(e))).length * it() : 0, n = (e, t) => c ? e.slice(0, t).filter((e) => c.has($(e))).length * it() : 0, i = (r, i) => {
|
|
1438
|
-
let a = r.length < h.length ? p + f : 0, o = r.length > 1 ? (r.length - 1) * f : 0;
|
|
1439
|
-
return r.reduce((t, n, r) => t + e(n, r >= i), 0) + o + a + t(r) + n(r, i) <= m;
|
|
1440
|
-
}, a = 0, o = !1;
|
|
1441
|
-
for (let e = h.length; e >= 1 && a === 0; e--) i(h.slice(0, e), 1) ? a = e : i(h.slice(0, e), 0) && (a = e, o = !0);
|
|
1442
|
-
let l = o ? 0 : Math.min(1, a), u = h.slice(0, a);
|
|
1443
|
-
for (; l < a && i(u, l + 1);) l++;
|
|
1444
|
-
u.forEach((e, t) => {
|
|
1445
|
-
let n = $(e);
|
|
1446
|
-
g.add(n), t >= l && _.add(n);
|
|
1447
|
-
});
|
|
1448
|
-
}
|
|
1449
|
-
let v = (e) => g.has($(e)), y = [
|
|
1450
|
-
...l,
|
|
1451
|
-
...u,
|
|
1452
|
-
...d
|
|
1453
|
-
].filter((e) => !v(e));
|
|
1454
|
-
return {
|
|
1455
|
-
primaryInline: l.filter(v),
|
|
1456
|
-
inline: u.filter(v),
|
|
1457
|
-
overflow: y,
|
|
1458
|
-
destructiveInline: d.filter(v),
|
|
1459
|
-
iconOnly: _
|
|
1460
|
-
};
|
|
1461
|
-
}
|
|
1462
|
-
function $(e) {
|
|
1463
|
-
return e.kind === "action" ? `action:${e.code}` : `group:${e.name ? v(e.name) : ""}`;
|
|
1464
|
-
}
|
|
1465
|
-
function pt(e) {
|
|
1466
|
-
let t = e.parentElement;
|
|
1467
|
-
for (; t && getComputedStyle(t).display === "contents";) t = t.parentElement;
|
|
1468
|
-
if (!t) return !1;
|
|
1469
|
-
let n = getComputedStyle(t);
|
|
1470
|
-
return !(parseFloat(n.flexGrow) > 0 || n.display === "block" || n.display === "flow-root" || n.width !== "auto" || n.maxWidth !== "none");
|
|
1471
|
-
}
|
|
1472
|
-
function mt({ layout: t, entityActions: n, globalActions: r, onRun: i, reservedRightWidth: a = 0, measurementOverride: s, ariaLabel: c = "Actions", align: l = "trailing", constrain: d = !0, row: f, widgetContext: p, onActionClick: m }) {
|
|
1473
|
-
let g = B(null), _ = B(null), [v, y] = V(0), [b, x] = V(/* @__PURE__ */ new Map()), [S, C] = V(!1), [w, T] = V(null), [E, D] = V(() => typeof document < "u" && document.documentElement.dir === "rtl");
|
|
1474
|
-
R(() => {
|
|
1475
|
-
if (typeof MutationObserver > "u") return;
|
|
1476
|
-
let e = new MutationObserver((e) => {
|
|
1477
|
-
for (let t of e) t.attributeName === "dir" && D(document.documentElement.dir === "rtl"), t.attributeName === "lang" && C(!1);
|
|
1478
|
-
});
|
|
1479
|
-
return e.observe(document.documentElement, {
|
|
1480
|
-
attributes: !0,
|
|
1481
|
-
attributeFilter: ["dir", "lang"]
|
|
1482
|
-
}), () => e.disconnect();
|
|
1483
|
-
}, []);
|
|
1484
|
-
let O = B(null), [ee, k] = V(!1), A = L((e, t) => (k(!1), i(e, t)), [i]), te = Be(t), j = !!s, M = L(() => {
|
|
1485
|
-
if (j || !_.current) return;
|
|
1486
|
-
let e = Array.from(_.current.children), t = /* @__PURE__ */ new Map();
|
|
1487
|
-
e.forEach((e) => {
|
|
1488
|
-
let n = e.dataset.nodeKey;
|
|
1489
|
-
n && t.set(n, e.getBoundingClientRect().width || e.offsetWidth);
|
|
1490
|
-
}), x((e) => lt(e, t) ? e : t), C(!0);
|
|
1491
|
-
}, [j]), N = ne(() => JSON.stringify(t.map((e) => $(e))), [t]);
|
|
1492
|
-
R(() => {
|
|
1493
|
-
if (j) return;
|
|
1494
|
-
let e = _.current;
|
|
1495
|
-
if (!e || typeof ResizeObserver > "u") return;
|
|
1496
|
-
let t = new ResizeObserver(() => M());
|
|
1497
|
-
t.observe(e);
|
|
1498
|
-
for (let n of Array.from(e.children)) t.observe(n);
|
|
1499
|
-
return () => t.disconnect();
|
|
1500
|
-
}, [
|
|
1501
|
-
M,
|
|
1502
|
-
j,
|
|
1503
|
-
N
|
|
1504
|
-
]), z(() => {
|
|
1505
|
-
if (j) {
|
|
1506
|
-
C(!0);
|
|
1507
|
-
return;
|
|
1508
|
-
}
|
|
1509
|
-
C(!1);
|
|
1510
|
-
let e = requestAnimationFrame(() => {
|
|
1511
|
-
M();
|
|
1512
|
-
});
|
|
1513
|
-
return () => cancelAnimationFrame(e);
|
|
1514
|
-
}, [
|
|
1515
|
-
N,
|
|
1516
|
-
M,
|
|
1517
|
-
j
|
|
1518
|
-
]), R(() => {
|
|
1519
|
-
if (j || S) return;
|
|
1520
|
-
let e = setTimeout(() => {
|
|
1521
|
-
M(), C(!0);
|
|
1522
|
-
}, 16);
|
|
1523
|
-
return () => clearTimeout(e);
|
|
1524
|
-
}, [
|
|
1525
|
-
S,
|
|
1526
|
-
M,
|
|
1527
|
-
j
|
|
1528
|
-
]), R(() => {
|
|
1529
|
-
if (j || !d || !S || v === 0) return;
|
|
1530
|
-
let e = g.current;
|
|
1531
|
-
if (!e || !pt(e)) return;
|
|
1532
|
-
let t = [...e.children].filter((e) => e.getAttribute("aria-hidden") !== "true"), n = t.length > 1 ? (t.length - 1) * 4 : 0, r = t.reduce((e, t) => e + t.getBoundingClientRect().width, 0) + n;
|
|
1533
|
-
r > 0 && Math.abs(v - r) < 1 && console.error(`[declarion] ResponsiveActionBar is measuring itself: its container is ${Math.round(v)}px, exactly the width of what it just rendered. The slot holding this bar is sized by its own content, so it cannot tell the bar how much room there is. Give that slot \`flex: 1 1 auto; min-width: 0\` (and justify its content to the edge the buttons sit on), or pass \`constrain={false}\` if it genuinely has no row to take space from.`);
|
|
1534
|
-
}, [
|
|
1535
|
-
j,
|
|
1536
|
-
d,
|
|
1537
|
-
S,
|
|
1538
|
-
v,
|
|
1539
|
-
b
|
|
1540
|
-
]), R(() => {
|
|
1541
|
-
if (j) return;
|
|
1542
|
-
let e = g.current;
|
|
1543
|
-
if (!e) return;
|
|
1544
|
-
if (typeof ResizeObserver > "u") {
|
|
1545
|
-
y(e.getBoundingClientRect().width);
|
|
1546
|
-
return;
|
|
1547
|
-
}
|
|
1548
|
-
let t = new ResizeObserver((e) => {
|
|
1549
|
-
let t = e[0];
|
|
1550
|
-
t && y(t.contentRect.width);
|
|
1551
|
-
});
|
|
1552
|
-
return t.observe(e), y(e.getBoundingClientRect().width), () => t.disconnect();
|
|
1553
|
-
}, [j]);
|
|
1554
|
-
let F = B(void 0), I = B(void 0);
|
|
1555
|
-
R(() => {
|
|
1556
|
-
F.current = void 0, I.current = void 0;
|
|
1557
|
-
}, [N]);
|
|
1558
|
-
let G = ne(() => j || !d ? ft(t, 2 ** 53 - 1, a, b, n, r, s) : S ? v === 0 ? ft(t, 2 ** 53 - 1, a, b, n, r, s) : ft(t, v, a, b, n, r, s, F.current, I.current) : {
|
|
1559
|
-
primaryInline: [],
|
|
1560
|
-
inline: [],
|
|
1561
|
-
overflow: [],
|
|
1562
|
-
destructiveInline: [],
|
|
1563
|
-
iconOnly: /* @__PURE__ */ new Set()
|
|
1564
|
-
}, [
|
|
1565
|
-
j,
|
|
1566
|
-
d,
|
|
1567
|
-
S,
|
|
1568
|
-
v,
|
|
1569
|
-
t,
|
|
1570
|
-
a,
|
|
1571
|
-
b,
|
|
1572
|
-
n,
|
|
1573
|
-
r,
|
|
1574
|
-
s
|
|
1575
|
-
]);
|
|
1576
|
-
if (R(() => {
|
|
1577
|
-
(S || j) && (F.current = new Set([
|
|
1578
|
-
...G.primaryInline,
|
|
1579
|
-
...G.inline,
|
|
1580
|
-
...G.destructiveInline
|
|
1581
|
-
].map($)), I.current = new Set(G.iconOnly));
|
|
1582
|
-
}, [
|
|
1583
|
-
G,
|
|
1584
|
-
S,
|
|
1585
|
-
j
|
|
1586
|
-
]), te === 0) return null;
|
|
1587
|
-
let K = G.overflow.length > 0, { normal: q, destructive: re } = Ve(G.overflow, n, r);
|
|
1588
|
-
return /* @__PURE__ */ W("div", {
|
|
1589
|
-
ref: g,
|
|
1590
|
-
role: "toolbar",
|
|
1591
|
-
"aria-label": c,
|
|
1592
|
-
style: {
|
|
1593
|
-
display: "flex",
|
|
1594
|
-
flexDirection: E ? "row-reverse" : "row",
|
|
1595
|
-
alignItems: "center",
|
|
1596
|
-
gap: tt,
|
|
1597
|
-
flexWrap: "wrap",
|
|
1598
|
-
visibility: S || j ? "visible" : "hidden",
|
|
1599
|
-
position: "relative",
|
|
1600
|
-
flex: d ? "1 1 auto" : "0 1 auto",
|
|
1601
|
-
justifyContent: l === "trailing" ? "flex-end" : "flex-start",
|
|
1602
|
-
minWidth: 0,
|
|
1603
|
-
boxSizing: "border-box"
|
|
1604
|
-
},
|
|
1605
|
-
children: [
|
|
1606
|
-
/* @__PURE__ */ W("div", {
|
|
1607
|
-
ref: _,
|
|
1608
|
-
"aria-hidden": "true",
|
|
1609
|
-
inert: !0,
|
|
1610
|
-
style: {
|
|
1611
|
-
position: "absolute",
|
|
1612
|
-
visibility: "hidden",
|
|
1613
|
-
pointerEvents: "none",
|
|
1614
|
-
display: "flex",
|
|
1615
|
-
gap: 4,
|
|
1616
|
-
top: 0,
|
|
1617
|
-
left: 0,
|
|
1618
|
-
width: "max-content",
|
|
1619
|
-
flexWrap: "nowrap"
|
|
1620
|
-
},
|
|
1621
|
-
children: [/* @__PURE__ */ U(u, {
|
|
1622
|
-
"data-node-key": $e,
|
|
1623
|
-
iconRight: /* @__PURE__ */ U(e.down, { size: 10 }),
|
|
1624
|
-
tabIndex: -1,
|
|
1625
|
-
children: "Actions"
|
|
1626
|
-
}, $e), t.map((e) => {
|
|
1627
|
-
let t = $(e);
|
|
1628
|
-
return e.kind === "action" ? /* @__PURE__ */ W(P, { children: [/* @__PURE__ */ U(Ke, {
|
|
1629
|
-
leaf: e,
|
|
1630
|
-
entityActions: n,
|
|
1631
|
-
globalActions: r,
|
|
1632
|
-
onRun: st,
|
|
1633
|
-
loading: !1,
|
|
1634
|
-
onLoadingChange: ot,
|
|
1635
|
-
row: f,
|
|
1636
|
-
widgetContext: p,
|
|
1637
|
-
measureRef: ct(t)
|
|
1638
|
-
}), We(e.code, n, r) && /* @__PURE__ */ U(Ke, {
|
|
1639
|
-
leaf: e,
|
|
1640
|
-
entityActions: n,
|
|
1641
|
-
globalActions: r,
|
|
1642
|
-
onRun: st,
|
|
1643
|
-
loading: !1,
|
|
1644
|
-
onLoadingChange: ot,
|
|
1645
|
-
row: f,
|
|
1646
|
-
widgetContext: p,
|
|
1647
|
-
iconOnly: !0,
|
|
1648
|
-
measureRef: ct(rt(e))
|
|
1649
|
-
})] }, t) : /* @__PURE__ */ U(qe, {
|
|
1650
|
-
group: e,
|
|
1651
|
-
entityActions: n,
|
|
1652
|
-
globalActions: r,
|
|
1653
|
-
onRun: st,
|
|
1654
|
-
loading: null,
|
|
1655
|
-
onLoadingChange: ot,
|
|
1656
|
-
row: f,
|
|
1657
|
-
widgetContext: p,
|
|
1658
|
-
onActionClick: m,
|
|
1659
|
-
measureRef: ct(t)
|
|
1660
|
-
}, t);
|
|
1661
|
-
})]
|
|
1662
|
-
}),
|
|
1663
|
-
G.primaryInline.map((e) => /* @__PURE__ */ U(Ke, {
|
|
1664
|
-
leaf: e,
|
|
1665
|
-
entityActions: n,
|
|
1666
|
-
globalActions: r,
|
|
1667
|
-
onRun: i,
|
|
1668
|
-
loading: w === e.code,
|
|
1669
|
-
onLoadingChange: (t) => T(t ? e.code : null),
|
|
1670
|
-
row: f,
|
|
1671
|
-
widgetContext: p,
|
|
1672
|
-
onActionClick: m,
|
|
1673
|
-
iconOnly: G.iconOnly.has($(e))
|
|
1674
|
-
}, $(e))),
|
|
1675
|
-
G.inline.map((e) => {
|
|
1676
|
-
let t = $(e);
|
|
1677
|
-
return e.kind === "action" ? /* @__PURE__ */ U(Ke, {
|
|
1678
|
-
leaf: e,
|
|
1679
|
-
entityActions: n,
|
|
1680
|
-
globalActions: r,
|
|
1681
|
-
onRun: i,
|
|
1682
|
-
loading: w === e.code,
|
|
1683
|
-
onLoadingChange: (t) => T(t ? e.code : null),
|
|
1684
|
-
row: f,
|
|
1685
|
-
widgetContext: p,
|
|
1686
|
-
onActionClick: m,
|
|
1687
|
-
iconOnly: G.iconOnly.has(t)
|
|
1688
|
-
}, t) : /* @__PURE__ */ U(qe, {
|
|
1689
|
-
group: e,
|
|
1690
|
-
entityActions: n,
|
|
1691
|
-
globalActions: r,
|
|
1692
|
-
onRun: i,
|
|
1693
|
-
loading: w,
|
|
1694
|
-
onLoadingChange: T,
|
|
1695
|
-
row: f,
|
|
1696
|
-
widgetContext: p,
|
|
1697
|
-
onActionClick: m
|
|
1698
|
-
}, t);
|
|
1699
|
-
}),
|
|
1700
|
-
K && /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U(u, {
|
|
1701
|
-
ref: O,
|
|
1702
|
-
kind: "default",
|
|
1703
|
-
iconRight: /* @__PURE__ */ U(e.down, { size: 10 }),
|
|
1704
|
-
"aria-haspopup": "menu",
|
|
1705
|
-
"aria-expanded": ee ? "true" : "false",
|
|
1706
|
-
onClick: () => k((e) => !e),
|
|
1707
|
-
children: "Actions"
|
|
1708
|
-
}), /* @__PURE__ */ U(o, {
|
|
1709
|
-
open: ee,
|
|
1710
|
-
anchor: O.current,
|
|
1711
|
-
onClose: () => k(!1),
|
|
1712
|
-
align: E ? "start" : "end",
|
|
1713
|
-
width: 220,
|
|
1714
|
-
children: /* @__PURE__ */ U("div", {
|
|
1715
|
-
role: "menu",
|
|
1716
|
-
"aria-label": "More actions",
|
|
1717
|
-
children: [
|
|
1718
|
-
...q,
|
|
1719
|
-
...re.length > 0 ? [null] : [],
|
|
1720
|
-
...re
|
|
1721
|
-
].map((e, t) => e === null ? /* @__PURE__ */ U(h, { divider: !0 }, "destructive-divider") : e.kind === "action" ? /* @__PURE__ */ U(Je, {
|
|
1722
|
-
leaf: e,
|
|
1723
|
-
entityActions: n,
|
|
1724
|
-
globalActions: r,
|
|
1725
|
-
onRun: A,
|
|
1726
|
-
loading: w === e.code,
|
|
1727
|
-
onLoadingChange: (t) => T(t ? e.code : null),
|
|
1728
|
-
row: f,
|
|
1729
|
-
widgetContext: p,
|
|
1730
|
-
onActionClick: m
|
|
1731
|
-
}, e.code) : /* @__PURE__ */ U(Ye, {
|
|
1732
|
-
group: e,
|
|
1733
|
-
entityActions: n,
|
|
1734
|
-
globalActions: r,
|
|
1735
|
-
onRun: A,
|
|
1736
|
-
loading: w,
|
|
1737
|
-
onLoadingChange: T,
|
|
1738
|
-
row: f,
|
|
1739
|
-
widgetContext: p,
|
|
1740
|
-
onActionClick: m
|
|
1741
|
-
}, `${$(e)}-${t}`))
|
|
1742
|
-
})
|
|
1743
|
-
})] }),
|
|
1744
|
-
G.destructiveInline.map((e) => /* @__PURE__ */ U(Ke, {
|
|
1745
|
-
leaf: e,
|
|
1746
|
-
entityActions: n,
|
|
1747
|
-
globalActions: r,
|
|
1748
|
-
onRun: i,
|
|
1749
|
-
loading: w === e.code,
|
|
1750
|
-
onLoadingChange: (t) => T(t ? e.code : null),
|
|
1751
|
-
row: f,
|
|
1752
|
-
widgetContext: p,
|
|
1753
|
-
onActionClick: m,
|
|
1754
|
-
iconOnly: G.iconOnly.has($(e))
|
|
1755
|
-
}, $(e)))
|
|
1756
|
-
]
|
|
1757
|
-
});
|
|
1758
|
-
}
|
|
1759
|
-
function ht({ layout: e, rowSelection: t = [], ...n }) {
|
|
1760
|
-
let r = t.length > 0;
|
|
1761
|
-
return /* @__PURE__ */ W("div", {
|
|
1762
|
-
style: {
|
|
1763
|
-
position: "relative",
|
|
1764
|
-
display: "flex",
|
|
1765
|
-
flex: "1 1 auto",
|
|
1766
|
-
minWidth: 0
|
|
1767
|
-
},
|
|
1768
|
-
children: [/* @__PURE__ */ U("div", {
|
|
1769
|
-
"aria-hidden": r ? "true" : void 0,
|
|
1770
|
-
style: {
|
|
1771
|
-
display: r ? "none" : "flex",
|
|
1772
|
-
flex: "1 1 auto",
|
|
1773
|
-
minWidth: 0
|
|
1774
|
-
},
|
|
1775
|
-
children: /* @__PURE__ */ U(mt, {
|
|
1776
|
-
layout: e,
|
|
1777
|
-
rowSelection: [],
|
|
1778
|
-
...n
|
|
1779
|
-
})
|
|
1780
|
-
}), /* @__PURE__ */ U("div", {
|
|
1781
|
-
"aria-hidden": r ? void 0 : "true",
|
|
1782
|
-
style: {
|
|
1783
|
-
display: r ? "flex" : "none",
|
|
1784
|
-
flex: "1 1 auto",
|
|
1785
|
-
minWidth: 0
|
|
1786
|
-
},
|
|
1787
|
-
children: /* @__PURE__ */ U(mt, {
|
|
1788
|
-
layout: e,
|
|
1789
|
-
rowSelection: t,
|
|
1790
|
-
...n
|
|
1791
|
-
})
|
|
1792
|
-
})]
|
|
1793
|
-
});
|
|
1794
|
-
}
|
|
1795
|
-
function gt({ layout: e, row: t, rowSelection: n, onRun: r, reservedRightWidth: i = 0, kind: a = "toolbar", align: o = "trailing", constrain: s = !0, measurementOverride: c, entityActions: l, globalActions: u, ariaLabel: d = "Actions", widgetContext: f, onActionClick: p }) {
|
|
1796
|
-
let m = Be(e);
|
|
1797
|
-
return a === "row" ? /* @__PURE__ */ U(Xe, {
|
|
1798
|
-
layout: e,
|
|
1799
|
-
entityActions: l,
|
|
1800
|
-
globalActions: u,
|
|
1801
|
-
onRun: r,
|
|
1802
|
-
row: t,
|
|
1803
|
-
widgetContext: f,
|
|
1804
|
-
onActionClick: p
|
|
1805
|
-
}) : m === 0 ? null : U(a === "toolbar" ? ht : mt, {
|
|
1806
|
-
layout: e,
|
|
1807
|
-
row: t,
|
|
1808
|
-
rowSelection: n,
|
|
1809
|
-
onRun: r,
|
|
1810
|
-
reservedRightWidth: i,
|
|
1811
|
-
measurementOverride: c,
|
|
1812
|
-
entityActions: l,
|
|
1813
|
-
globalActions: u,
|
|
1814
|
-
ariaLabel: d,
|
|
1815
|
-
align: o,
|
|
1816
|
-
constrain: s,
|
|
1817
|
-
widgetContext: f,
|
|
1818
|
-
onActionClick: p
|
|
1819
|
-
});
|
|
1820
|
-
}
|
|
1821
|
-
//#endregion
|
|
1822
|
-
//#region src/lib/filter-evaluator.ts
|
|
1823
|
-
var _t = /* @__PURE__ */ new Set([
|
|
1824
|
-
"string",
|
|
1825
|
-
"text",
|
|
1826
|
-
"rich_text",
|
|
1827
|
-
"email",
|
|
1828
|
-
"url",
|
|
1829
|
-
"phone"
|
|
1830
|
-
]), vt = /* @__PURE__ */ new Set([
|
|
1831
|
-
"int",
|
|
1832
|
-
"float",
|
|
1833
|
-
"decimal"
|
|
1834
|
-
]), yt = /* @__PURE__ */ new Set([
|
|
1835
|
-
"date",
|
|
1836
|
-
"timestamp",
|
|
1837
|
-
"time"
|
|
1838
|
-
]), bt = /^(?:eq|not_eq|contains|starts_with|is_empty|is_not_empty)$/, xt = /^(?:eq|not_eq|in|not_in|is_empty|is_not_empty)$/, St = /^(?:eq|not_eq|gt|gte|lt|lte|between|is_empty|is_not_empty)$/, Ct = {
|
|
1839
|
-
string: bt,
|
|
1840
|
-
text: bt,
|
|
1841
|
-
rich_text: bt,
|
|
1842
|
-
email: bt,
|
|
1843
|
-
url: bt,
|
|
1844
|
-
phone: bt,
|
|
1845
|
-
enum: xt,
|
|
1846
|
-
int: St,
|
|
1847
|
-
float: St,
|
|
1848
|
-
decimal: St,
|
|
1849
|
-
date: St,
|
|
1850
|
-
timestamp: St,
|
|
1851
|
-
time: St,
|
|
1852
|
-
bool: /^(?:eq|is_empty)$/,
|
|
1853
|
-
ref: /^(?:eq|not_eq|is_empty|is_not_empty)$/,
|
|
1854
|
-
uuid: /^(?:eq|not_eq|is_empty|is_not_empty)$/
|
|
1855
|
-
};
|
|
1856
|
-
function wt(e, t, n) {
|
|
1857
|
-
return e.every((e) => Tt(e, t, n));
|
|
1858
|
-
}
|
|
1859
|
-
function Tt(e, t, n) {
|
|
1860
|
-
if (e.and) return e.and.every((e) => Tt(e, t, n));
|
|
1861
|
-
if (e.or) return e.or.some((e) => Tt(e, t, n));
|
|
1862
|
-
if (!e.field || !e.op) return !1;
|
|
1863
|
-
let r = t[e.field];
|
|
1864
|
-
return !r || !Ct[r.type]?.test(e.op) ? !1 : Et(e, r.type, n[e.field]);
|
|
1865
|
-
}
|
|
1866
|
-
function Et(e, t, n) {
|
|
1867
|
-
let r = Dt(n);
|
|
1868
|
-
if (e.op === "is_empty") return r;
|
|
1869
|
-
if (e.op === "is_not_empty") return !r;
|
|
1870
|
-
if (r) return !1;
|
|
1871
|
-
let i = e.value;
|
|
1872
|
-
switch (e.op) {
|
|
1873
|
-
case "eq": return Ot(t, n, i);
|
|
1874
|
-
case "not_eq": return !Ot(t, n, i) && kt(t, n, i);
|
|
1875
|
-
case "in": return Array.isArray(i) && i.some((e) => Ot(t, n, e));
|
|
1876
|
-
case "not_in": return Array.isArray(i) && i.every((e) => kt(t, n, e) && !Ot(t, n, e));
|
|
1877
|
-
case "contains": return typeof n == "string" && typeof i == "string" && n.toLowerCase().includes(i.toLowerCase());
|
|
1878
|
-
case "starts_with": return typeof n == "string" && typeof i == "string" && n.toLowerCase().startsWith(i.toLowerCase());
|
|
1879
|
-
case "gt": return At(t, n, i, (e, t) => e > t);
|
|
1880
|
-
case "gte": return At(t, n, i, (e, t) => e >= t);
|
|
1881
|
-
case "lt": return At(t, n, i, (e, t) => e < t);
|
|
1882
|
-
case "lte": return At(t, n, i, (e, t) => e <= t);
|
|
1883
|
-
case "between": {
|
|
1884
|
-
if (!Array.isArray(i) || i.length !== 2) return !1;
|
|
1885
|
-
let e = jt(t, n, i[0]), r = jt(t, n, i[1]);
|
|
1886
|
-
return e === void 0 || r === void 0 ? !1 : e >= 0 && r <= 0;
|
|
1887
|
-
}
|
|
1888
|
-
default: return !1;
|
|
1889
|
-
}
|
|
1890
|
-
}
|
|
1891
|
-
function Dt(e) {
|
|
1892
|
-
return e == null || e === "" || Array.isArray(e) && e.length === 0;
|
|
1893
|
-
}
|
|
1894
|
-
function Ot(e, t, n) {
|
|
1895
|
-
return kt(e, t, n) ? yt.has(e) ? jt(e, t, n) === 0 : t === n : !1;
|
|
1896
|
-
}
|
|
1897
|
-
function kt(e, t, n) {
|
|
1898
|
-
return jt(e, t, n) !== void 0;
|
|
1899
|
-
}
|
|
1900
|
-
function At(e, t, n, r) {
|
|
1901
|
-
let i = jt(e, t, n);
|
|
1902
|
-
return i !== void 0 && r(i, 0);
|
|
1903
|
-
}
|
|
1904
|
-
function jt(e, t, n) {
|
|
1905
|
-
if (vt.has(e)) return typeof t != "number" || typeof n != "number" || !Number.isFinite(t) || !Number.isFinite(n) ? void 0 : t === n ? 0 : t < n ? -1 : 1;
|
|
1906
|
-
if (yt.has(e)) return typeof t != "string" || typeof n != "string" || !Mt(e, t) || !Mt(e, n) ? void 0 : t === n ? 0 : t < n ? -1 : 1;
|
|
1907
|
-
if (_t.has(e) || e === "enum" || e === "ref" || e === "uuid") return typeof t != "string" || typeof n != "string" ? void 0 : t === n ? 0 : t < n ? -1 : 1;
|
|
1908
|
-
if (e === "bool") return typeof t != "boolean" || typeof n != "boolean" ? void 0 : t === n ? 0 : t ? 1 : -1;
|
|
1909
|
-
}
|
|
1910
|
-
function Mt(e, t) {
|
|
1911
|
-
switch (e) {
|
|
1912
|
-
case "date": return /^\d{4}-\d{2}-\d{2}$/.test(t);
|
|
1913
|
-
case "time": return /^\d{2}:\d{2}:\d{2}(?:\.\d+)?$/.test(t);
|
|
1914
|
-
case "timestamp": return /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/.test(t);
|
|
1915
|
-
default: return !1;
|
|
1916
|
-
}
|
|
1917
|
-
}
|
|
1918
|
-
//#endregion
|
|
1919
|
-
//#region src/lib/variants.ts
|
|
1920
|
-
function Nt(e, t) {
|
|
1921
|
-
let n = e.variants;
|
|
1922
|
-
if (!n || n.length === 0) return;
|
|
1923
|
-
let r = {};
|
|
1924
|
-
for (let [t, n] of e.fields) r[t] = n;
|
|
1925
|
-
for (let [e, i] of n) if (e !== "default" && i.when && wt(i.when, r, t)) return e;
|
|
1926
|
-
return n.has("default") ? "default" : void 0;
|
|
1927
|
-
}
|
|
1928
|
-
function Pt(e, t) {
|
|
1929
|
-
let n = e?.variants;
|
|
1930
|
-
if (!n || !n.items().some((e) => e.actions !== void 0)) return;
|
|
1931
|
-
let r = Nt(e, t), i = n.get("default"), a = (r ? n.get(r)?.actions : void 0) ?? i?.actions ?? [];
|
|
1932
|
-
return new Set(a);
|
|
1933
|
-
}
|
|
1934
|
-
function Ft(e, t) {
|
|
1935
|
-
if (t.length === 0) return;
|
|
1936
|
-
let n = t.map((t) => Pt(e, t));
|
|
1937
|
-
if (n.every((e) => e === void 0)) return;
|
|
1938
|
-
let r = n[0] ?? /* @__PURE__ */ new Set(), i = new Set(r);
|
|
1939
|
-
for (let e of n.slice(1)) {
|
|
1940
|
-
if (!e) {
|
|
1941
|
-
i.clear();
|
|
1942
|
-
break;
|
|
1943
|
-
}
|
|
1944
|
-
for (let t of i) e.has(t) || i.delete(t);
|
|
1945
|
-
}
|
|
1946
|
-
return i;
|
|
1947
|
-
}
|
|
1948
|
-
function It(e, t, n) {
|
|
1949
|
-
if (!t.variants || t.variants.length === 0) return;
|
|
1950
|
-
if (e.variants) {
|
|
1951
|
-
let r = Nt(e, n) ?? "default";
|
|
1952
|
-
return t.variants.has(r) ? r : "default";
|
|
1953
|
-
}
|
|
1954
|
-
let r = {};
|
|
1955
|
-
for (let [t, n] of e.fields) r[t] = n;
|
|
1956
|
-
for (let [e, i] of t.variants) if (e !== "default" && i.when && wt(i.when, r, n)) return e;
|
|
1957
|
-
return "default";
|
|
1958
|
-
}
|
|
1959
|
-
var Lt = [
|
|
1960
|
-
"items",
|
|
1961
|
-
"sidebar",
|
|
1962
|
-
"sidebar_width",
|
|
1963
|
-
"highlights",
|
|
1964
|
-
"audit",
|
|
1965
|
-
"actions",
|
|
1966
|
-
"row_actions",
|
|
1967
|
-
"action_layout",
|
|
1968
|
-
"card",
|
|
1969
|
-
"quick_peek"
|
|
1970
|
-
];
|
|
1971
|
-
function Rt(e, t, n) {
|
|
1972
|
-
if (!e || !t?.variants) return t;
|
|
1973
|
-
let r = It(e, t, n), i = r ? t.variants.get(r) : void 0;
|
|
1974
|
-
if (!i) return t;
|
|
1975
|
-
let a = { ...t };
|
|
1976
|
-
for (let e of Lt) i[e] !== void 0 && (a[e] = i[e]);
|
|
1977
|
-
return a;
|
|
1978
|
-
}
|
|
1979
|
-
//#endregion
|
|
1980
|
-
//#region src/lib/action-dispatch.ts
|
|
1981
|
-
function zt(e, t, n, r) {
|
|
1982
|
-
return a(t) ? (c(t.ui_steps, n), null) : t.entity ? `${t.entity}.${e}` : r ? `${r}.${e}` : e;
|
|
1983
|
-
}
|
|
1984
|
-
//#endregion
|
|
1985
|
-
export { K as C, re as S, ge as _, It as a, ae as b, gt as c, Me as d, Ne as f, X as g, Pe as h, Nt as i, Qe as l, Fe as m, Ft as n, Pt as o, Ie as p, Rt as r, wt as s, zt as t, je as u, he as v, q as x, Y as y };
|