@declarion/react 0.52.0 → 0.54.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/dist-lib/{DraggableChildrenTable-CJCjc_cd.js → DraggableChildrenTable-CPoUY99R.js} +35 -35
- package/dist-lib/{Grid-DUjbQg3r.js → Grid--QAEby8k.js} +28 -28
- package/dist-lib/{LayoutRenderer-DbdxC-Bq.js → LayoutRenderer-BxZ7Nd9b.js} +920 -922
- package/dist-lib/{ListCardsBody-C8ofksQb.js → ListCardsBody-BPV4GPrv.js} +14 -14
- package/dist-lib/{MarkdownRenderer-B9_5fwuE.js → MarkdownRenderer-CIKuh_0i.js} +10 -10
- package/dist-lib/{record-documents-key-8fdm7C10.js → RecordIdBadge-CGxPR-8q.js} +1 -4
- package/dist-lib/{RefreshControl-C-8UCyau.js → RefreshControl-DMLkZP3R.js} +120 -122
- package/dist-lib/{SmartDetailPage.impl-DWjNQ052.js → SmartDetailPage.impl-SnNu6Ug-.js} +376 -377
- package/dist-lib/{SmartListPage.impl-yKBK7a8b.js → SmartListPage.impl-C73pR7Iw.js} +1098 -1099
- package/dist-lib/{SmartRecordListPage.impl-DRpU_DOC.js → SmartRecordListPage.impl-rJjQZe1V.js} +183 -183
- package/dist-lib/{SortHeaderMenu-CbihbEGd.js → SortHeaderMenu-DQ_KrkWk.js} +1 -1
- package/dist-lib/{action-dispatch-C28UhXXA.js → action-dispatch-DsuUS7ae.js} +382 -382
- package/dist-lib/api/agents.d.ts +0 -1
- package/dist-lib/api/events.d.ts +27 -5
- package/dist-lib/{cardProjection-Bp_ZPLUE.js → cardProjection-BadzqyeQ.js} +146 -204
- package/dist-lib/components/actions/ObjectActionBar.d.ts +1 -1
- package/dist-lib/components/chrome/Breadcrumbs.d.ts +1 -1
- package/dist-lib/components/detail-layout/DetailAuditStrip.d.ts +1 -1
- package/dist-lib/components/detail-layout/DetailHighlights.d.ts +1 -1
- package/dist-lib/components/detail-layout/DraggableChildrenTable.d.ts +1 -1
- package/dist-lib/components/detail-layout/EditableChildrenTable.d.ts +1 -1
- package/dist-lib/components/detail-layout/LayoutRenderer.d.ts +1 -1
- package/dist-lib/components/file-widgets/host.d.ts +1 -1
- package/dist-lib/components/layout/Layout.d.ts +1 -1
- package/dist-lib/components/layout/TopBar.d.ts +1 -1
- package/dist-lib/components/list/InlineEditCell.d.ts +1 -1
- package/dist-lib/components/list/PeekFieldCell.d.ts +1 -1
- package/dist-lib/components/list/QuickPeek.d.ts +1 -1
- package/dist-lib/components/pages/DocumentsMenu.d.ts +1 -1
- package/dist-lib/components/pages/RecordDocumentsPanel.d.ts +2 -2
- package/dist-lib/components/pages/auth/AuthShell.d.ts +1 -1
- package/dist-lib/components/pages/list/ListCardRow.d.ts +1 -1
- package/dist-lib/components/pages/list/ListCardsBody.d.ts +1 -1
- package/dist-lib/components/pages/list/ListFloatbar.d.ts +1 -1
- package/dist-lib/components/pages/list/ListHeader.d.ts +1 -1
- package/dist-lib/components/pages/list/columns.d.ts +1 -1
- package/dist-lib/components/pages/list/filter-meta.d.ts +1 -1
- package/dist-lib/components/pages/list/use-filter-value-labels.d.ts +1 -1
- package/dist-lib/components/pages/list/useListQuery.d.ts +6 -1
- package/dist-lib/components/pages/list/useListRowInteraction.d.ts +1 -1
- package/dist-lib/components/pages/list/useListViews.d.ts +1 -1
- package/dist-lib/components/pages/list/useRowMenu.d.ts +1 -1
- package/dist-lib/components/shared/RefreshControl.d.ts +7 -1
- package/dist-lib/components/shared/useOwnRefresh.d.ts +9 -0
- package/dist-lib/{field-classification-CeYJlsNq.js → field-classification-sMkkAEg9.js} +301 -320
- package/dist-lib/{format-count-C3N-WxEy.js → format-count-B5SLlNOb.js} +245 -245
- package/dist-lib/hooks/useMutations.d.ts +1 -1
- package/dist-lib/hooks/useSSE.d.ts +24 -4
- package/dist-lib/index.js +1586 -1858
- package/dist-lib/lib/action-dispatch.d.ts +1 -1
- package/dist-lib/lib/document-templates.d.ts +1 -1
- package/dist-lib/lib/realtime-reconcile.d.ts +43 -0
- package/dist-lib/{peekDraftStore-D3sowXga.js → peekDraftStore-CbHFwz_F.js} +36 -36
- package/dist-lib/{registry-p6CejATt.js → registry-D0RhCnEL.js} +507 -507
- package/dist-lib/stores/realtime.d.ts +20 -0
- package/dist-lib/testing.js +35 -35
- package/dist-lib/types/api.d.ts +8 -4
- package/dist-lib/types/schema.d.ts +6 -0
- package/dist-lib/{useCurrentScreen-74x5yJNb.js → useCurrentScreen-DVTXCj_K.js} +2508 -1557
- package/dist-lib/{useListQuery-D75bgLLz.js → useListQuery-C2nq58YV.js} +13 -10
- package/dist-lib/{useProperties-C5fZp12D.js → useProperties-BcIz-MyO.js} +25 -25
- package/dist-lib/useTabSearchMirror-UYCsopxP.js +177 -0
- package/dist-lib/{value-DKekzcjz.js → value-CQzGOI0F.js} +25 -25
- package/package.json +14 -14
- package/dist-lib/useTabSearchMirror-D_wzoYRz.js +0 -406
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { s as e, t } from "./DynamicIcon-DW5krHuX.js";
|
|
2
|
-
import {
|
|
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-
|
|
2
|
+
import { Cr as n, Fr as r, H as i, I as a, Ir as o, Jn as s, L as c, Mr as l, Q as u, Zn as d, ct as f, dt as p, et as m, ft as h, gt as g, lt as _, ot as v, pt as y, rt as b, ut as x, wr as S } from "./useCurrentScreen-DVTXCj_K.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-CQzGOI0F.js";
|
|
4
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
5
|
import { Fragment as H, jsx as U, jsxs as W } from "react/jsx-runtime";
|
|
6
6
|
//#region src/components/file-widgets/registry.ts
|
|
@@ -36,57 +36,57 @@ function se(e) {
|
|
|
36
36
|
return t.length === 0 ? "?" : t.length === 1 ? t[0].slice(0, 2).toUpperCase() : (t[0][0] + t[1][0]).toUpperCase();
|
|
37
37
|
}
|
|
38
38
|
function ce(e) {
|
|
39
|
-
let { field: t, fieldName: n, value:
|
|
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), [m, g] = V("idle"), [y, b] = V(null), [x, S] = 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 } = v();
|
|
40
40
|
R(() => () => {
|
|
41
41
|
M.current && M.current.abort();
|
|
42
42
|
}, []);
|
|
43
|
-
let H = ne(() => E(
|
|
44
|
-
|
|
43
|
+
let H = ne(() => E(d, o, t.display?.placeholder || n), [
|
|
44
|
+
o,
|
|
45
45
|
t.display?.placeholder,
|
|
46
46
|
n,
|
|
47
|
-
|
|
48
|
-
]), G = (t.accepts ?? ["image/*"]).join(","), K = L(async (
|
|
49
|
-
let
|
|
50
|
-
if (
|
|
51
|
-
|
|
47
|
+
d
|
|
48
|
+
]), G = (t.accepts ?? ["image/*"]).join(","), K = L(async (r) => {
|
|
49
|
+
let a = h(r, t.accepts, t.max_size_bytes);
|
|
50
|
+
if (a) {
|
|
51
|
+
S(a), g("error");
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
|
-
let
|
|
54
|
+
let o = r;
|
|
55
55
|
if (t.display?.crop_on_upload) try {
|
|
56
56
|
let { blob: e, filename: n } = await Y()({
|
|
57
|
-
file:
|
|
57
|
+
file: r,
|
|
58
58
|
aspectRatio: fe(t.display.aspect_ratio)
|
|
59
59
|
});
|
|
60
|
-
|
|
60
|
+
o = new File([e], n, { type: e.type || r.type });
|
|
61
61
|
} catch (e) {
|
|
62
|
-
|
|
62
|
+
S({
|
|
63
63
|
code: "CROP_FAILED",
|
|
64
64
|
message: e instanceof Error ? e.message : "Crop failed"
|
|
65
|
-
}),
|
|
65
|
+
}), g("error");
|
|
66
66
|
return;
|
|
67
67
|
}
|
|
68
|
-
|
|
68
|
+
S(null), N.current = !1, g("uploading"), b({
|
|
69
69
|
loaded: 0,
|
|
70
|
-
total:
|
|
70
|
+
total: o.size,
|
|
71
71
|
pct: 0
|
|
72
72
|
});
|
|
73
|
-
let
|
|
74
|
-
M.current =
|
|
73
|
+
let s = new AbortController();
|
|
74
|
+
M.current = s;
|
|
75
75
|
try {
|
|
76
|
-
let r = await
|
|
77
|
-
file:
|
|
76
|
+
let r = await p({
|
|
77
|
+
file: o,
|
|
78
78
|
entityCode: e.entityCode,
|
|
79
|
-
fieldCode:
|
|
80
|
-
slotCode:
|
|
81
|
-
signal:
|
|
82
|
-
onProgress:
|
|
79
|
+
fieldCode: l ?? n,
|
|
80
|
+
slotCode: u,
|
|
81
|
+
signal: s.signal,
|
|
82
|
+
onProgress: b
|
|
83
83
|
});
|
|
84
84
|
if (N.current) {
|
|
85
|
-
|
|
85
|
+
_(r.id).catch(() => {}), I(r.id);
|
|
86
86
|
return;
|
|
87
87
|
}
|
|
88
|
-
|
|
89
|
-
let
|
|
88
|
+
d && z(d.id) && (_(d.id).catch(() => {}), I(d.id)), F(r.id, () => _(r.id)), w(r.id), g("idle"), b(null);
|
|
89
|
+
let a = {
|
|
90
90
|
id: r.id,
|
|
91
91
|
filename: r.filename,
|
|
92
92
|
content_type: r.content_type,
|
|
@@ -97,17 +97,17 @@ function ce(e) {
|
|
|
97
97
|
url: r.url,
|
|
98
98
|
metadata: r.metadata
|
|
99
99
|
};
|
|
100
|
-
|
|
100
|
+
i?.(t.mode === "array" ? [a] : a);
|
|
101
101
|
} catch (e) {
|
|
102
|
-
if (e instanceof
|
|
103
|
-
let t = e instanceof
|
|
102
|
+
if (e instanceof f && e.code === "ABORTED") return;
|
|
103
|
+
let t = e instanceof f ? {
|
|
104
104
|
code: e.code,
|
|
105
105
|
message: e.message
|
|
106
106
|
} : {
|
|
107
107
|
code: "UNKNOWN",
|
|
108
108
|
message: e instanceof Error ? e.message : "Upload failed"
|
|
109
109
|
};
|
|
110
|
-
|
|
110
|
+
S(t), g("error"), b(null);
|
|
111
111
|
}
|
|
112
112
|
}, [
|
|
113
113
|
t.accepts,
|
|
@@ -116,87 +116,87 @@ function ce(e) {
|
|
|
116
116
|
t.display?.aspect_ratio,
|
|
117
117
|
t.mode,
|
|
118
118
|
n,
|
|
119
|
-
|
|
119
|
+
i,
|
|
120
120
|
e.entityCode,
|
|
121
121
|
F,
|
|
122
122
|
z,
|
|
123
|
-
|
|
123
|
+
d,
|
|
124
124
|
I,
|
|
125
|
-
|
|
126
|
-
|
|
125
|
+
l,
|
|
126
|
+
u
|
|
127
127
|
]), q = L(() => {
|
|
128
|
-
|
|
128
|
+
m === "uploading" && M.current && (N.current = !0, M.current.abort(), M.current = null, g("idle"), b(null)), C && (_(C).catch(() => {}), I(C), w(null));
|
|
129
129
|
}, [
|
|
130
|
-
|
|
130
|
+
m,
|
|
131
131
|
C,
|
|
132
132
|
I
|
|
133
133
|
]), re = L(() => {
|
|
134
|
-
|
|
134
|
+
d && z(d.id) && (_(d.id).catch(() => {}), I(d.id), w(null)), i?.(t.mode === "array" ? [] : null);
|
|
135
135
|
}, [
|
|
136
|
-
|
|
136
|
+
d,
|
|
137
137
|
t.mode,
|
|
138
138
|
z,
|
|
139
|
-
|
|
139
|
+
i,
|
|
140
140
|
I
|
|
141
141
|
]), ie = L(() => {
|
|
142
|
-
|
|
142
|
+
S(null), g("idle"), P.current?.click();
|
|
143
143
|
}, []), J = L(() => {
|
|
144
|
-
|
|
145
|
-
}, [
|
|
146
|
-
|
|
147
|
-
}, [
|
|
148
|
-
|
|
149
|
-
}, [
|
|
150
|
-
if (
|
|
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
151
|
e.preventDefault();
|
|
152
152
|
let t = e.dataTransfer.files?.[0];
|
|
153
153
|
t && K(t);
|
|
154
|
-
}, [
|
|
154
|
+
}, [s, K]), he = L((e) => {
|
|
155
155
|
let t = e.target.files?.[0];
|
|
156
156
|
e.target.value = "", t && K(t);
|
|
157
|
-
}, [K]), ge =
|
|
157
|
+
}, [K]), ge = c.aspectRatio ?? de(c.shape, t.display?.aspect_ratio), X = T(d), _e = {
|
|
158
158
|
aspectRatio: ge,
|
|
159
|
-
width:
|
|
160
|
-
}, Z = !!
|
|
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
161
|
e.stopPropagation(), te((e) => !e);
|
|
162
162
|
}, []), Ce = L((e) => {
|
|
163
|
-
if (!
|
|
164
|
-
let n = e.currentTarget.getBoundingClientRect(), r = n.width > 0 ? (e.clientX - n.left) / n.width : .5,
|
|
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
165
|
x: Math.max(0, Math.min(1, r)),
|
|
166
|
-
y: Math.max(0, Math.min(1,
|
|
166
|
+
y: Math.max(0, Math.min(1, a))
|
|
167
167
|
});
|
|
168
|
-
|
|
168
|
+
i?.(t.mode === "array" ? [o] : o), te(!1);
|
|
169
169
|
}, [
|
|
170
170
|
t.mode,
|
|
171
|
-
|
|
171
|
+
d,
|
|
172
172
|
k,
|
|
173
|
-
|
|
173
|
+
i
|
|
174
174
|
]);
|
|
175
175
|
return xe ? /* @__PURE__ */ U("div", {
|
|
176
|
-
className: le(
|
|
176
|
+
className: le(c.shape, !1),
|
|
177
177
|
style: _e,
|
|
178
178
|
"aria-label": H,
|
|
179
179
|
children: Z && be ? /* @__PURE__ */ U("img", {
|
|
180
180
|
src: be,
|
|
181
181
|
alt: H,
|
|
182
|
-
className: ue(
|
|
182
|
+
className: ue(c.shape),
|
|
183
183
|
style: { objectPosition: j(X) },
|
|
184
184
|
loading: "lazy"
|
|
185
185
|
}) : /* @__PURE__ */ U(pe, {
|
|
186
|
-
shape:
|
|
186
|
+
shape: c.shape,
|
|
187
187
|
label: H,
|
|
188
188
|
placeholder: t.display?.placeholder
|
|
189
189
|
})
|
|
190
190
|
}) : /* @__PURE__ */ W("div", {
|
|
191
|
-
className: le(
|
|
191
|
+
className: le(c.shape, !s),
|
|
192
192
|
style: _e,
|
|
193
|
-
tabIndex:
|
|
193
|
+
tabIndex: s ? -1 : 0,
|
|
194
194
|
role: "button",
|
|
195
195
|
"aria-label": H,
|
|
196
|
-
"aria-disabled":
|
|
197
|
-
"aria-busy":
|
|
198
|
-
"aria-invalid":
|
|
199
|
-
onClick:
|
|
196
|
+
"aria-disabled": s || void 0,
|
|
197
|
+
"aria-busy": m === "uploading" || void 0,
|
|
198
|
+
"aria-invalid": m === "error" || void 0,
|
|
199
|
+
onClick: m === "idle" && !Z ? J : void 0,
|
|
200
200
|
onMouseDown: k ? Ce : void 0,
|
|
201
201
|
onKeyDown: ae,
|
|
202
202
|
onDragOver: se,
|
|
@@ -214,21 +214,21 @@ function ce(e) {
|
|
|
214
214
|
Z && be ? /* @__PURE__ */ U("img", {
|
|
215
215
|
src: be,
|
|
216
216
|
alt: H,
|
|
217
|
-
className: ue(
|
|
217
|
+
className: ue(c.shape),
|
|
218
218
|
style: { objectPosition: j(X) },
|
|
219
219
|
loading: "lazy"
|
|
220
|
-
}) :
|
|
221
|
-
shape:
|
|
220
|
+
}) : m === "uploading" ? null : /* @__PURE__ */ U(pe, {
|
|
221
|
+
shape: c.shape,
|
|
222
222
|
label: H,
|
|
223
223
|
placeholder: t.display?.placeholder
|
|
224
224
|
}),
|
|
225
|
-
|
|
225
|
+
m === "uploading" && /* @__PURE__ */ U(me, { pct: y?.pct ?? 0 }),
|
|
226
226
|
C && /* @__PURE__ */ U("span", {
|
|
227
227
|
className: "absolute right-1 top-1 h-2 w-2 rounded-full bg-warning",
|
|
228
228
|
"aria-hidden": "true",
|
|
229
229
|
"data-testid": "draft-indicator"
|
|
230
230
|
}),
|
|
231
|
-
Z &&
|
|
231
|
+
Z && m === "idle" && !s && /* @__PURE__ */ W("div", {
|
|
232
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
233
|
children: [
|
|
234
234
|
t.display?.focal_point && /* @__PURE__ */ U("button", {
|
|
@@ -264,7 +264,7 @@ function ce(e) {
|
|
|
264
264
|
},
|
|
265
265
|
"data-testid": "focal-point-marker"
|
|
266
266
|
}),
|
|
267
|
-
|
|
267
|
+
m === "uploading" && /* @__PURE__ */ U("button", {
|
|
268
268
|
type: "button",
|
|
269
269
|
className: "absolute bottom-1 right-1 rounded-sm border border-border bg-card px-2 py-0.5 text-xs",
|
|
270
270
|
onClick: (e) => {
|
|
@@ -273,13 +273,13 @@ function ce(e) {
|
|
|
273
273
|
"data-testid": "cancel-upload",
|
|
274
274
|
children: "Cancel"
|
|
275
275
|
}),
|
|
276
|
-
|
|
276
|
+
m === "error" && x && /* @__PURE__ */ W("div", {
|
|
277
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
278
|
role: "alert",
|
|
279
279
|
children: [/* @__PURE__ */ U("span", {
|
|
280
280
|
className: "truncate",
|
|
281
|
-
title:
|
|
282
|
-
children:
|
|
281
|
+
title: x.message,
|
|
282
|
+
children: x.message
|
|
283
283
|
}), /* @__PURE__ */ U("button", {
|
|
284
284
|
type: "button",
|
|
285
285
|
className: "underline",
|
|
@@ -396,7 +396,7 @@ function X(e) {
|
|
|
396
396
|
}
|
|
397
397
|
//#endregion
|
|
398
398
|
//#region src/components/file-widgets/GridLazy.tsx
|
|
399
|
-
var _e = I(() => import("./Grid
|
|
399
|
+
var _e = I(() => import("./Grid--QAEby8k.js").then((e) => ({ default: e.Grid })));
|
|
400
400
|
function Z() {
|
|
401
401
|
return /* @__PURE__ */ U("div", { className: "h-24 w-full rounded-md bg-muted animate-pulse" });
|
|
402
402
|
}
|
|
@@ -416,116 +416,116 @@ function ye({ contentType: e }) {
|
|
|
416
416
|
});
|
|
417
417
|
}
|
|
418
418
|
function be(e) {
|
|
419
|
-
let { field: t, fieldName: n, value:
|
|
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"), [m, g] = V(null), [y, b] = V(null), [S, w] = V(!1), [T, E] = V(l?.filename ?? ""), D = B(null), O = B(!1), A = B(null), { register: j, unregister: M, isDraft: P } = v(), { open: F } = te();
|
|
420
420
|
R(() => () => {
|
|
421
421
|
D.current && D.current.abort();
|
|
422
422
|
}, []), R(() => {
|
|
423
|
-
E(
|
|
424
|
-
}, [
|
|
425
|
-
let I = (t.accepts ?? []).join(","), z = L(async (
|
|
426
|
-
let
|
|
427
|
-
if (
|
|
428
|
-
b(
|
|
423
|
+
E(l?.filename ?? "");
|
|
424
|
+
}, [l?.filename]);
|
|
425
|
+
let I = (t.accepts ?? []).join(","), z = L(async (r) => {
|
|
426
|
+
let a = h(r, t.accepts, t.max_size_bytes);
|
|
427
|
+
if (a) {
|
|
428
|
+
b(a), d("error");
|
|
429
429
|
return;
|
|
430
430
|
}
|
|
431
|
-
b(null), O.current = !1,
|
|
431
|
+
b(null), O.current = !1, d("uploading"), g({
|
|
432
432
|
loaded: 0,
|
|
433
|
-
total:
|
|
433
|
+
total: r.size,
|
|
434
434
|
pct: 0
|
|
435
435
|
});
|
|
436
|
-
let
|
|
437
|
-
D.current =
|
|
436
|
+
let o = new AbortController();
|
|
437
|
+
D.current = o;
|
|
438
438
|
try {
|
|
439
|
-
let
|
|
440
|
-
file:
|
|
439
|
+
let a = await p({
|
|
440
|
+
file: r,
|
|
441
441
|
entityCode: e.entityCode,
|
|
442
|
-
fieldCode:
|
|
443
|
-
slotCode:
|
|
444
|
-
signal:
|
|
445
|
-
onProgress:
|
|
442
|
+
fieldCode: s ?? n,
|
|
443
|
+
slotCode: c,
|
|
444
|
+
signal: o.signal,
|
|
445
|
+
onProgress: g
|
|
446
446
|
});
|
|
447
447
|
if (O.current) {
|
|
448
|
-
|
|
448
|
+
_(a.id).catch(() => {}), M(a.id);
|
|
449
449
|
return;
|
|
450
450
|
}
|
|
451
|
-
|
|
452
|
-
let
|
|
453
|
-
id:
|
|
454
|
-
filename:
|
|
455
|
-
content_type:
|
|
456
|
-
size_bytes:
|
|
457
|
-
sha256:
|
|
458
|
-
width:
|
|
459
|
-
height:
|
|
460
|
-
url:
|
|
461
|
-
metadata:
|
|
451
|
+
l && P(l.id) && (_(l.id).catch(() => {}), M(l.id)), j(a.id, () => _(a.id)), d("idle"), g(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
462
|
};
|
|
463
|
-
|
|
463
|
+
i?.(t.mode === "array" ? [u] : u);
|
|
464
464
|
} catch (e) {
|
|
465
|
-
if (e instanceof
|
|
466
|
-
let t = e instanceof
|
|
465
|
+
if (e instanceof f && e.code === "ABORTED") return;
|
|
466
|
+
let t = e instanceof f ? {
|
|
467
467
|
code: e.code,
|
|
468
468
|
message: e.message
|
|
469
469
|
} : {
|
|
470
470
|
code: "UNKNOWN",
|
|
471
471
|
message: e instanceof Error ? e.message : "Upload failed"
|
|
472
472
|
};
|
|
473
|
-
b(t),
|
|
473
|
+
b(t), d("error"), g(null);
|
|
474
474
|
}
|
|
475
475
|
}, [
|
|
476
476
|
t.accepts,
|
|
477
477
|
t.max_size_bytes,
|
|
478
478
|
t.mode,
|
|
479
479
|
n,
|
|
480
|
-
|
|
480
|
+
l,
|
|
481
481
|
P,
|
|
482
|
-
|
|
482
|
+
i,
|
|
483
483
|
e.entityCode,
|
|
484
484
|
j,
|
|
485
485
|
M,
|
|
486
|
-
|
|
487
|
-
|
|
486
|
+
s,
|
|
487
|
+
c
|
|
488
488
|
]), ne = L(() => {
|
|
489
|
-
|
|
490
|
-
}, [
|
|
489
|
+
o || A.current?.click();
|
|
490
|
+
}, [o]), G = L((e) => {
|
|
491
491
|
let t = e.target.files?.[0];
|
|
492
492
|
e.target.value = "", t && z(t);
|
|
493
493
|
}, [z]), K = L(() => {
|
|
494
|
-
|
|
494
|
+
l && P(l.id) && (_(l.id).catch(() => {}), M(l.id)), i?.(t.mode === "array" ? [] : null);
|
|
495
495
|
}, [
|
|
496
|
-
|
|
496
|
+
l,
|
|
497
497
|
t.mode,
|
|
498
498
|
P,
|
|
499
|
-
|
|
499
|
+
i,
|
|
500
500
|
M
|
|
501
501
|
]), q = L(() => {
|
|
502
|
-
|
|
503
|
-
}, [
|
|
504
|
-
|
|
505
|
-
}, [
|
|
506
|
-
!
|
|
507
|
-
}, [
|
|
508
|
-
if (!
|
|
502
|
+
u === "uploading" && D.current && (O.current = !0, D.current.abort(), D.current = null, d("idle"), g(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
509
|
w(!1);
|
|
510
510
|
return;
|
|
511
511
|
}
|
|
512
512
|
let e = T.trim();
|
|
513
|
-
if (w(!1), !e || e ===
|
|
514
|
-
E(
|
|
513
|
+
if (w(!1), !e || e === l.filename) {
|
|
514
|
+
E(l.filename);
|
|
515
515
|
return;
|
|
516
516
|
}
|
|
517
517
|
let n = {
|
|
518
|
-
...
|
|
518
|
+
...l,
|
|
519
519
|
filename: e
|
|
520
520
|
};
|
|
521
|
-
|
|
521
|
+
i?.(t.mode === "array" ? [n] : n);
|
|
522
522
|
}, [
|
|
523
523
|
T,
|
|
524
|
-
|
|
525
|
-
|
|
524
|
+
l,
|
|
525
|
+
i,
|
|
526
526
|
t.mode
|
|
527
|
-
]), Y =
|
|
528
|
-
return !
|
|
527
|
+
]), Y = a === "display";
|
|
528
|
+
return !l && u !== "uploading" ? /* @__PURE__ */ W("div", {
|
|
529
529
|
"data-testid": `file-widget-${n}`,
|
|
530
530
|
className: "flex items-center gap-3 rounded-md border border-dashed border-border bg-surface p-3",
|
|
531
531
|
children: [
|
|
@@ -539,7 +539,7 @@ function be(e) {
|
|
|
539
539
|
type: "button",
|
|
540
540
|
className: "self-start rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
|
|
541
541
|
onClick: ne,
|
|
542
|
-
disabled:
|
|
542
|
+
disabled: o,
|
|
543
543
|
"data-testid": "upload",
|
|
544
544
|
children: "Upload"
|
|
545
545
|
})]
|
|
@@ -552,7 +552,7 @@ function be(e) {
|
|
|
552
552
|
style: { display: "none" },
|
|
553
553
|
"data-testid": `file-input-${n}`
|
|
554
554
|
}),
|
|
555
|
-
|
|
555
|
+
u === "error" && y && /* @__PURE__ */ U("div", {
|
|
556
556
|
className: "ml-auto text-xs text-destructive",
|
|
557
557
|
role: "alert",
|
|
558
558
|
children: y.message
|
|
@@ -561,14 +561,14 @@ function be(e) {
|
|
|
561
561
|
}) : /* @__PURE__ */ W("div", {
|
|
562
562
|
"data-testid": `file-widget-${n}`,
|
|
563
563
|
className: "flex items-center gap-3 rounded-md border border-border bg-surface p-3",
|
|
564
|
-
"aria-busy":
|
|
565
|
-
"aria-invalid":
|
|
564
|
+
"aria-busy": u === "uploading" || void 0,
|
|
565
|
+
"aria-invalid": u === "error" || void 0,
|
|
566
566
|
children: [
|
|
567
|
-
/* @__PURE__ */ U(ye, { contentType:
|
|
567
|
+
/* @__PURE__ */ U(ye, { contentType: l?.content_type }),
|
|
568
568
|
/* @__PURE__ */ W("div", {
|
|
569
569
|
className: "flex min-w-0 flex-1 flex-col gap-1",
|
|
570
570
|
children: [
|
|
571
|
-
|
|
571
|
+
S && l ? /* @__PURE__ */ U("input", {
|
|
572
572
|
type: "text",
|
|
573
573
|
className: "rounded-sm border border-border bg-card px-1 py-0.5 text-sm text-foreground",
|
|
574
574
|
value: T,
|
|
@@ -576,45 +576,45 @@ function be(e) {
|
|
|
576
576
|
onChange: (e) => E(e.target.value),
|
|
577
577
|
onBlur: ae,
|
|
578
578
|
onKeyDown: (e) => {
|
|
579
|
-
e.key === "Enter" ? ae() : e.key === "Escape" && (w(!1), E(
|
|
579
|
+
e.key === "Enter" ? ae() : e.key === "Escape" && (w(!1), E(l.filename));
|
|
580
580
|
},
|
|
581
581
|
"data-testid": "filename-input"
|
|
582
582
|
}) : /* @__PURE__ */ U("button", {
|
|
583
583
|
type: "button",
|
|
584
584
|
className: "truncate text-left text-sm font-medium text-foreground hover:underline",
|
|
585
|
-
onClick: () => !Y &&
|
|
586
|
-
disabled: Y ||
|
|
587
|
-
title:
|
|
585
|
+
onClick: () => !Y && l && w(!0),
|
|
586
|
+
disabled: Y || o || !l,
|
|
587
|
+
title: l?.filename,
|
|
588
588
|
"data-testid": "filename",
|
|
589
|
-
children:
|
|
589
|
+
children: l?.filename ?? "Uploading…"
|
|
590
590
|
}),
|
|
591
591
|
/* @__PURE__ */ W("div", {
|
|
592
592
|
className: "flex flex-wrap gap-2 text-xs text-muted-foreground",
|
|
593
593
|
children: [
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
594
|
+
l && /* @__PURE__ */ U("span", { children: x(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
599
|
"data-testid": "version-badge",
|
|
600
|
-
children: ["v",
|
|
600
|
+
children: ["v", l.version.number]
|
|
601
601
|
})
|
|
602
602
|
]
|
|
603
603
|
}),
|
|
604
|
-
|
|
604
|
+
u === "uploading" && /* @__PURE__ */ W("div", {
|
|
605
605
|
className: "text-xs text-muted-foreground",
|
|
606
606
|
role: "progressbar",
|
|
607
|
-
"aria-valuenow":
|
|
607
|
+
"aria-valuenow": m?.pct ?? 0,
|
|
608
608
|
"aria-valuemin": 0,
|
|
609
609
|
"aria-valuemax": 100,
|
|
610
610
|
"data-testid": "upload-progress",
|
|
611
611
|
children: [
|
|
612
612
|
"Uploading ",
|
|
613
|
-
|
|
613
|
+
m?.pct ?? 0,
|
|
614
614
|
"%"
|
|
615
615
|
]
|
|
616
616
|
}),
|
|
617
|
-
|
|
617
|
+
u === "error" && y && /* @__PURE__ */ U("div", {
|
|
618
618
|
className: "text-xs text-destructive",
|
|
619
619
|
role: "alert",
|
|
620
620
|
children: y.message
|
|
@@ -623,7 +623,7 @@ function be(e) {
|
|
|
623
623
|
}),
|
|
624
624
|
/* @__PURE__ */ W("div", {
|
|
625
625
|
className: "flex flex-none items-center gap-1",
|
|
626
|
-
children: [
|
|
626
|
+
children: [l && u !== "uploading" && /* @__PURE__ */ W(H, { children: [
|
|
627
627
|
/* @__PURE__ */ U("button", {
|
|
628
628
|
type: "button",
|
|
629
629
|
className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
|
|
@@ -644,18 +644,18 @@ function be(e) {
|
|
|
644
644
|
type: "button",
|
|
645
645
|
className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
|
|
646
646
|
onClick: ne,
|
|
647
|
-
disabled:
|
|
647
|
+
disabled: o,
|
|
648
648
|
"data-testid": "replace",
|
|
649
649
|
children: "Replace"
|
|
650
650
|
}), /* @__PURE__ */ U("button", {
|
|
651
651
|
type: "button",
|
|
652
652
|
className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-destructive hover:bg-surface-2",
|
|
653
653
|
onClick: K,
|
|
654
|
-
disabled:
|
|
654
|
+
disabled: o,
|
|
655
655
|
"data-testid": "remove",
|
|
656
656
|
children: "Remove"
|
|
657
657
|
})] })
|
|
658
|
-
] }),
|
|
658
|
+
] }), u === "uploading" && /* @__PURE__ */ U("button", {
|
|
659
659
|
type: "button",
|
|
660
660
|
className: "rounded-sm border border-border bg-card px-2 py-1 text-xs",
|
|
661
661
|
onClick: q,
|
|
@@ -684,54 +684,54 @@ function Se(e) {
|
|
|
684
684
|
return e ? (e.split("/")[1] ?? e).toUpperCase().slice(0, 6) : "";
|
|
685
685
|
}
|
|
686
686
|
function Ce(e) {
|
|
687
|
-
let { field: t, fieldName: n, value:
|
|
688
|
-
|
|
689
|
-
let y = B(null), b = B(/* @__PURE__ */ new Set()),
|
|
690
|
-
|
|
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: m } = v(), g = B(s);
|
|
688
|
+
g.current = s;
|
|
689
|
+
let y = B(null), b = B(/* @__PURE__ */ new Set()), S = B([]);
|
|
690
|
+
S.current = c;
|
|
691
691
|
let { open: C } = te();
|
|
692
692
|
R(() => () => {
|
|
693
|
-
|
|
693
|
+
S.current.forEach((e) => e.abort());
|
|
694
694
|
}, []);
|
|
695
|
-
let w = (t.accepts ?? []).join(","), T =
|
|
696
|
-
let
|
|
697
|
-
if (
|
|
698
|
-
|
|
699
|
-
localId:
|
|
700
|
-
filename:
|
|
695
|
+
let w = (t.accepts ?? []).join(","), T = a === "display", E = L(async (r) => {
|
|
696
|
+
let a = h(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
701
|
progress: null,
|
|
702
|
-
error:
|
|
702
|
+
error: a,
|
|
703
703
|
abort: () => {}
|
|
704
704
|
}]);
|
|
705
705
|
return;
|
|
706
706
|
}
|
|
707
|
-
|
|
708
|
-
localId:
|
|
709
|
-
filename:
|
|
707
|
+
l((e) => [...e, {
|
|
708
|
+
localId: o,
|
|
709
|
+
filename: r.name,
|
|
710
710
|
progress: {
|
|
711
711
|
loaded: 0,
|
|
712
|
-
total:
|
|
712
|
+
total: r.size,
|
|
713
713
|
pct: 0
|
|
714
714
|
},
|
|
715
715
|
error: null,
|
|
716
|
-
abort: () =>
|
|
716
|
+
abort: () => s.abort()
|
|
717
717
|
}]);
|
|
718
718
|
try {
|
|
719
|
-
let t = await
|
|
720
|
-
file:
|
|
719
|
+
let t = await p({
|
|
720
|
+
file: r,
|
|
721
721
|
entityCode: e.entityCode,
|
|
722
722
|
fieldCode: n,
|
|
723
|
-
signal:
|
|
724
|
-
onProgress: (e) =>
|
|
723
|
+
signal: s.signal,
|
|
724
|
+
onProgress: (e) => l((t) => t.map((t) => t.localId === o ? {
|
|
725
725
|
...t,
|
|
726
726
|
progress: e
|
|
727
727
|
} : t))
|
|
728
728
|
});
|
|
729
|
-
if (b.current.delete(
|
|
730
|
-
|
|
729
|
+
if (b.current.delete(o)) {
|
|
730
|
+
_(t.id).catch(() => {}), d(t.id);
|
|
731
731
|
return;
|
|
732
732
|
}
|
|
733
|
-
|
|
734
|
-
let
|
|
733
|
+
u(t.id, () => _(t.id));
|
|
734
|
+
let a = {
|
|
735
735
|
id: t.id,
|
|
736
736
|
filename: t.filename,
|
|
737
737
|
content_type: t.content_type,
|
|
@@ -741,21 +741,21 @@ function Ce(e) {
|
|
|
741
741
|
height: t.height,
|
|
742
742
|
url: t.url,
|
|
743
743
|
metadata: t.metadata
|
|
744
|
-
},
|
|
745
|
-
|
|
744
|
+
}, c = [...g.current, a];
|
|
745
|
+
g.current = c, i?.(c), l((e) => e.filter((e) => e.localId !== o));
|
|
746
746
|
} catch (e) {
|
|
747
|
-
if (e instanceof
|
|
748
|
-
|
|
747
|
+
if (e instanceof f && e.code === "ABORTED") {
|
|
748
|
+
l((e) => e.filter((e) => e.localId !== o));
|
|
749
749
|
return;
|
|
750
750
|
}
|
|
751
|
-
let t = e instanceof
|
|
751
|
+
let t = e instanceof f ? {
|
|
752
752
|
code: e.code,
|
|
753
753
|
message: e.message
|
|
754
754
|
} : {
|
|
755
755
|
code: "UNKNOWN",
|
|
756
756
|
message: e instanceof Error ? e.message : "Upload failed"
|
|
757
757
|
};
|
|
758
|
-
|
|
758
|
+
l((e) => e.map((e) => e.localId === o ? {
|
|
759
759
|
...e,
|
|
760
760
|
error: t,
|
|
761
761
|
progress: null,
|
|
@@ -766,24 +766,24 @@ function Ce(e) {
|
|
|
766
766
|
t.accepts,
|
|
767
767
|
t.max_size_bytes,
|
|
768
768
|
n,
|
|
769
|
-
|
|
769
|
+
i,
|
|
770
770
|
e.entityCode,
|
|
771
|
-
|
|
772
|
-
|
|
771
|
+
u,
|
|
772
|
+
d
|
|
773
773
|
]), D = L((e) => {
|
|
774
774
|
Array.from(e).forEach((e) => void E(e));
|
|
775
775
|
}, [E]), O = L(() => {
|
|
776
|
-
|
|
777
|
-
}, [
|
|
776
|
+
o || y.current?.click();
|
|
777
|
+
}, [o]), ee = L((e) => {
|
|
778
778
|
let t = e.target.files;
|
|
779
779
|
e.target.value = "", t && t.length > 0 && D(t);
|
|
780
780
|
}, [D]), A = L((e) => {
|
|
781
|
-
|
|
781
|
+
m(e) && (_(e).catch(() => {}), d(e)), i?.(s.filter((t) => t.id !== e));
|
|
782
782
|
}, [
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
783
|
+
m,
|
|
784
|
+
s,
|
|
785
|
+
i,
|
|
786
|
+
d
|
|
787
787
|
]), j = L((e) => {
|
|
788
788
|
C(e.id, "download", k(e));
|
|
789
789
|
}, [C]);
|
|
@@ -793,11 +793,11 @@ function Ce(e) {
|
|
|
793
793
|
children: [/* @__PURE__ */ W("ul", {
|
|
794
794
|
className: "flex flex-col divide-y divide-divider rounded-md border border-border bg-surface",
|
|
795
795
|
children: [
|
|
796
|
-
|
|
796
|
+
s.length === 0 && c.length === 0 && /* @__PURE__ */ U("li", {
|
|
797
797
|
className: "px-3 py-4 text-center text-sm text-muted-foreground",
|
|
798
798
|
children: t.display?.placeholder || "No files"
|
|
799
799
|
}),
|
|
800
|
-
|
|
800
|
+
s.map((e) => /* @__PURE__ */ W("li", {
|
|
801
801
|
className: "flex items-center gap-3 px-3 py-2",
|
|
802
802
|
"data-testid": `row-${e.id}`,
|
|
803
803
|
children: [
|
|
@@ -814,7 +814,7 @@ function Ce(e) {
|
|
|
814
814
|
}),
|
|
815
815
|
/* @__PURE__ */ U("span", {
|
|
816
816
|
className: "flex-none text-xs text-muted-foreground",
|
|
817
|
-
children:
|
|
817
|
+
children: x(e.size_bytes)
|
|
818
818
|
}),
|
|
819
819
|
/* @__PURE__ */ U("button", {
|
|
820
820
|
type: "button",
|
|
@@ -827,13 +827,13 @@ function Ce(e) {
|
|
|
827
827
|
type: "button",
|
|
828
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
829
|
onClick: () => A(e.id),
|
|
830
|
-
disabled:
|
|
830
|
+
disabled: o,
|
|
831
831
|
"data-testid": `remove-${e.id}`,
|
|
832
832
|
children: "Remove"
|
|
833
833
|
})
|
|
834
834
|
]
|
|
835
835
|
}, e.id)),
|
|
836
|
-
|
|
836
|
+
c.map((e) => /* @__PURE__ */ W("li", {
|
|
837
837
|
className: "flex items-center gap-3 px-3 py-2",
|
|
838
838
|
"data-testid": `pending-row-${e.localId}`,
|
|
839
839
|
"aria-busy": !e.error,
|
|
@@ -861,7 +861,7 @@ function Ce(e) {
|
|
|
861
861
|
type: "button",
|
|
862
862
|
className: "flex-none rounded-sm border border-border bg-card px-2 py-0.5 text-xs",
|
|
863
863
|
onClick: () => {
|
|
864
|
-
e.abort(), b.current.add(e.localId),
|
|
864
|
+
e.abort(), b.current.add(e.localId), l((t) => t.filter((t) => t.localId !== e.localId));
|
|
865
865
|
},
|
|
866
866
|
children: e.error ? "Dismiss" : "Cancel"
|
|
867
867
|
})
|
|
@@ -872,7 +872,7 @@ function Ce(e) {
|
|
|
872
872
|
type: "button",
|
|
873
873
|
className: "self-start rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
|
|
874
874
|
onClick: O,
|
|
875
|
-
disabled:
|
|
875
|
+
disabled: o,
|
|
876
876
|
"data-testid": "add-files",
|
|
877
877
|
children: "Add files"
|
|
878
878
|
}), /* @__PURE__ */ U("input", {
|
|
@@ -991,17 +991,17 @@ function Me(e, t) {
|
|
|
991
991
|
function Ne(e, t, n) {
|
|
992
992
|
if (je(e, n)) return Me(t, n);
|
|
993
993
|
let r = e.fields.get(n);
|
|
994
|
-
return r?.type === "rich_text" && r.files?.mode === "rich_text_inline" ?
|
|
994
|
+
return r?.type === "rich_text" && r.files?.mode === "rich_text_inline" ? y(t[n], Me(t, n)) : t[n];
|
|
995
995
|
}
|
|
996
996
|
function Pe(e, t, n) {
|
|
997
997
|
let r = e.fields.get(t);
|
|
998
|
-
return r?.type === "rich_text" && r.files?.mode === "rich_text_inline" ?
|
|
998
|
+
return r?.type === "rich_text" && r.files?.mode === "rich_text_inline" ? g(n) : n;
|
|
999
999
|
}
|
|
1000
1000
|
function Fe(e, t, n) {
|
|
1001
1001
|
let r = je(e, t);
|
|
1002
1002
|
if (r) return r.name || t;
|
|
1003
1003
|
let i = e.fields.get(t);
|
|
1004
|
-
return i ?
|
|
1004
|
+
return i ? s(i, t, n) : t;
|
|
1005
1005
|
}
|
|
1006
1006
|
function Ie(e) {
|
|
1007
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);
|
|
@@ -1021,12 +1021,12 @@ function Ie(e) {
|
|
|
1021
1021
|
children: e ? `Unknown file widget: ${e}` : "Missing file widget"
|
|
1022
1022
|
});
|
|
1023
1023
|
}
|
|
1024
|
-
let v = t.fields.get(r),
|
|
1024
|
+
let v = t.fields.get(r), y = h && a === "display" && v ? {
|
|
1025
1025
|
...v,
|
|
1026
1026
|
structure: h
|
|
1027
1027
|
} : v;
|
|
1028
|
-
return
|
|
1029
|
-
field:
|
|
1028
|
+
return y ? b({
|
|
1029
|
+
field: y,
|
|
1030
1030
|
entityCode: n,
|
|
1031
1031
|
fieldName: r,
|
|
1032
1032
|
value: Ne(t, i, r),
|
|
@@ -1053,7 +1053,7 @@ function Re(e) {
|
|
|
1053
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
1054
|
}
|
|
1055
1055
|
function ze(e, t, n, r, i) {
|
|
1056
|
-
let a = Re(t), o =
|
|
1056
|
+
let a = Re(t), o = m(n, r?.entity), s = r?.entityCode ?? "";
|
|
1057
1057
|
if (e === "__peek") return i?.({
|
|
1058
1058
|
code: e,
|
|
1059
1059
|
entity: s,
|
|
@@ -1122,7 +1122,7 @@ function Q(e, t, n) {
|
|
|
1122
1122
|
}
|
|
1123
1123
|
function Ue(e, t, n) {
|
|
1124
1124
|
let r = Q(e, t, n);
|
|
1125
|
-
return
|
|
1125
|
+
return d(r?.display?.name) || e;
|
|
1126
1126
|
}
|
|
1127
1127
|
function We(e, t, n) {
|
|
1128
1128
|
return Q(e, t, n)?.display?.icon || void 0;
|
|
@@ -1130,28 +1130,28 @@ function We(e, t, n) {
|
|
|
1130
1130
|
function Ge(e) {
|
|
1131
1131
|
return `action-tooltip-${e}`;
|
|
1132
1132
|
}
|
|
1133
|
-
function Ke({ leaf: e, entityActions: r, globalActions:
|
|
1134
|
-
let
|
|
1135
|
-
if (!(!
|
|
1136
|
-
|
|
1133
|
+
function Ke({ leaf: e, entityActions: r, globalActions: a, onRun: s, loading: c, onLoadingChange: l, measureRef: u, style: d, row: f, widgetContext: p, onActionClick: m, iconOnly: h = !1 }) {
|
|
1134
|
+
let g = Q(e.code, r, a), _ = Ue(e.code, r, a), v = We(e.code, r, a), 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 || c)) {
|
|
1136
|
+
l(!0);
|
|
1137
1137
|
try {
|
|
1138
|
-
ze(e.code,
|
|
1138
|
+
ze(e.code, g, f, p, m) || await Promise.resolve(s(e.code, g));
|
|
1139
1139
|
} finally {
|
|
1140
|
-
|
|
1140
|
+
l(!1);
|
|
1141
1141
|
}
|
|
1142
1142
|
}
|
|
1143
1143
|
}, [
|
|
1144
|
-
|
|
1144
|
+
g,
|
|
1145
1145
|
x,
|
|
1146
|
-
|
|
1147
|
-
a,
|
|
1148
|
-
e.code,
|
|
1146
|
+
c,
|
|
1149
1147
|
s,
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
f
|
|
1153
|
-
|
|
1154
|
-
|
|
1148
|
+
e.code,
|
|
1149
|
+
l,
|
|
1150
|
+
f,
|
|
1151
|
+
p,
|
|
1152
|
+
m
|
|
1153
|
+
]), w = c ? /* @__PURE__ */ U(n, { size: 12 }) : v ? /* @__PURE__ */ U(t, {
|
|
1154
|
+
name: v,
|
|
1155
1155
|
size: 12
|
|
1156
1156
|
}) : null;
|
|
1157
1157
|
return /* @__PURE__ */ W(H, { children: [S && e.reason && /* @__PURE__ */ U("span", {
|
|
@@ -1165,26 +1165,26 @@ function Ke({ leaf: e, entityActions: r, globalActions: i, onRun: a, loading: o,
|
|
|
1165
1165
|
clip: "rect(0,0,0,0)"
|
|
1166
1166
|
},
|
|
1167
1167
|
children: e.reason
|
|
1168
|
-
}), /* @__PURE__ */ U(
|
|
1169
|
-
ref:
|
|
1168
|
+
}), /* @__PURE__ */ U(o, {
|
|
1169
|
+
ref: u,
|
|
1170
1170
|
kind: b ? "primary" : "default",
|
|
1171
1171
|
danger: y,
|
|
1172
1172
|
icon: w,
|
|
1173
|
-
disabled: x ||
|
|
1173
|
+
disabled: x || c,
|
|
1174
1174
|
"aria-disabled": x ? "true" : void 0,
|
|
1175
1175
|
"aria-describedby": S,
|
|
1176
|
-
"aria-label":
|
|
1177
|
-
title:
|
|
1176
|
+
"aria-label": h ? _ : void 0,
|
|
1177
|
+
title: i(g, _, x, e.reason, h),
|
|
1178
1178
|
onClick: C,
|
|
1179
|
-
style:
|
|
1180
|
-
children:
|
|
1179
|
+
style: d,
|
|
1180
|
+
children: h ? null : _
|
|
1181
1181
|
})] });
|
|
1182
1182
|
}
|
|
1183
|
-
function qe({ group: r, entityActions:
|
|
1184
|
-
let
|
|
1185
|
-
|
|
1186
|
-
}, [
|
|
1187
|
-
return /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U(
|
|
1183
|
+
function qe({ group: r, entityActions: i, globalActions: a, onRun: s, loading: c, onLoadingChange: u, measureRef: f, style: p, row: m, widgetContext: h, onActionClick: g }) {
|
|
1184
|
+
let _ = B(null), [v, y] = V(!1), b = r.name ? d(r.name) : "Actions", x = L((e) => {
|
|
1185
|
+
_.current = e, f?.(e);
|
|
1186
|
+
}, [f]), S = L((e, t) => (y(!1), s(e, t)), [s]);
|
|
1187
|
+
return /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U(o, {
|
|
1188
1188
|
ref: x,
|
|
1189
1189
|
kind: "default",
|
|
1190
1190
|
icon: c == null ? r.icon ? /* @__PURE__ */ U(t, {
|
|
@@ -1196,11 +1196,11 @@ function qe({ group: r, entityActions: a, globalActions: o, onRun: s, loading: c
|
|
|
1196
1196
|
"aria-expanded": v ? "true" : "false",
|
|
1197
1197
|
title: b,
|
|
1198
1198
|
onClick: () => y((e) => !e),
|
|
1199
|
-
style:
|
|
1199
|
+
style: p,
|
|
1200
1200
|
children: b
|
|
1201
|
-
}), /* @__PURE__ */ U(
|
|
1201
|
+
}), /* @__PURE__ */ U(l, {
|
|
1202
1202
|
open: v,
|
|
1203
|
-
anchor:
|
|
1203
|
+
anchor: _.current,
|
|
1204
1204
|
onClose: () => y(!1),
|
|
1205
1205
|
align: "start",
|
|
1206
1206
|
width: 200,
|
|
@@ -1209,35 +1209,35 @@ function qe({ group: r, entityActions: a, globalActions: o, onRun: s, loading: c
|
|
|
1209
1209
|
"aria-label": b,
|
|
1210
1210
|
children: r.items.map((e) => e.kind === "action" ? /* @__PURE__ */ U(Je, {
|
|
1211
1211
|
leaf: e,
|
|
1212
|
-
entityActions:
|
|
1213
|
-
globalActions:
|
|
1212
|
+
entityActions: i,
|
|
1213
|
+
globalActions: a,
|
|
1214
1214
|
onRun: S,
|
|
1215
1215
|
loading: c === e.code,
|
|
1216
|
-
onLoadingChange: (t) =>
|
|
1217
|
-
row:
|
|
1218
|
-
widgetContext:
|
|
1219
|
-
onActionClick:
|
|
1216
|
+
onLoadingChange: (t) => u(t ? e.code : null),
|
|
1217
|
+
row: m,
|
|
1218
|
+
widgetContext: h,
|
|
1219
|
+
onActionClick: g
|
|
1220
1220
|
}, e.code) : /* @__PURE__ */ U(Ye, {
|
|
1221
1221
|
group: e,
|
|
1222
|
-
entityActions:
|
|
1223
|
-
globalActions:
|
|
1222
|
+
entityActions: i,
|
|
1223
|
+
globalActions: a,
|
|
1224
1224
|
onRun: S,
|
|
1225
1225
|
loading: c,
|
|
1226
|
-
onLoadingChange:
|
|
1227
|
-
row:
|
|
1228
|
-
widgetContext:
|
|
1229
|
-
onActionClick:
|
|
1226
|
+
onLoadingChange: u,
|
|
1227
|
+
row: m,
|
|
1228
|
+
widgetContext: h,
|
|
1229
|
+
onActionClick: g
|
|
1230
1230
|
}, e.items[0]?.kind === "action" ? e.items[0].code : e.icon ?? "group"))
|
|
1231
1231
|
})
|
|
1232
1232
|
})] });
|
|
1233
1233
|
}
|
|
1234
|
-
function Je({ leaf: e, entityActions: r, globalActions:
|
|
1235
|
-
let
|
|
1236
|
-
name:
|
|
1234
|
+
function Je({ leaf: e, entityActions: r, globalActions: a, onRun: o, loading: s, onLoadingChange: c, row: l, widgetContext: u, onActionClick: d }) {
|
|
1235
|
+
let f = Q(e.code, r, a), p = Ue(e.code, r, a), m = We(e.code, r, a), h = f?.destructive ?? !1, g = !e.enabled, _ = g ? Ge(e.code) : void 0, v = s ? /* @__PURE__ */ U(n, { size: 12 }) : m ? /* @__PURE__ */ U(t, {
|
|
1236
|
+
name: m,
|
|
1237
1237
|
size: 12
|
|
1238
1238
|
}) : null;
|
|
1239
|
-
return /* @__PURE__ */ W(H, { children: [
|
|
1240
|
-
id:
|
|
1239
|
+
return /* @__PURE__ */ W(H, { children: [_ && e.reason && /* @__PURE__ */ U("span", {
|
|
1240
|
+
id: _,
|
|
1241
1241
|
role: "tooltip",
|
|
1242
1242
|
style: {
|
|
1243
1243
|
position: "absolute",
|
|
@@ -1249,16 +1249,16 @@ function Je({ leaf: e, entityActions: r, globalActions: i, onRun: a, loading: o,
|
|
|
1249
1249
|
children: e.reason
|
|
1250
1250
|
}), /* @__PURE__ */ W("div", {
|
|
1251
1251
|
role: "menuitem",
|
|
1252
|
-
"aria-disabled":
|
|
1253
|
-
"aria-describedby":
|
|
1254
|
-
title:
|
|
1252
|
+
"aria-disabled": g ? "true" : void 0,
|
|
1253
|
+
"aria-describedby": _,
|
|
1254
|
+
title: i(f, p, g, e.reason),
|
|
1255
1255
|
onClick: async () => {
|
|
1256
|
-
if (!(!
|
|
1257
|
-
|
|
1256
|
+
if (!(!f || g || s)) {
|
|
1257
|
+
c(!0);
|
|
1258
1258
|
try {
|
|
1259
|
-
ze(e.code,
|
|
1259
|
+
ze(e.code, f, l, u, d) || await Promise.resolve(o(e.code, f));
|
|
1260
1260
|
} finally {
|
|
1261
|
-
|
|
1261
|
+
c(!1);
|
|
1262
1262
|
}
|
|
1263
1263
|
}
|
|
1264
1264
|
},
|
|
@@ -1269,31 +1269,31 @@ function Je({ leaf: e, entityActions: r, globalActions: i, onRun: a, loading: o,
|
|
|
1269
1269
|
padding: "6px 10px",
|
|
1270
1270
|
borderRadius: 5,
|
|
1271
1271
|
fontSize: 12.5,
|
|
1272
|
-
color:
|
|
1273
|
-
cursor:
|
|
1274
|
-
opacity:
|
|
1272
|
+
color: h ? "var(--danger)" : g ? "var(--text-3)" : "var(--text-2)",
|
|
1273
|
+
cursor: g ? "not-allowed" : "pointer",
|
|
1274
|
+
opacity: g ? .6 : 1
|
|
1275
1275
|
},
|
|
1276
1276
|
onMouseEnter: (e) => {
|
|
1277
|
-
|
|
1277
|
+
g || (e.currentTarget.style.background = "var(--surface-3)");
|
|
1278
1278
|
},
|
|
1279
1279
|
onMouseLeave: (e) => {
|
|
1280
1280
|
e.currentTarget.style.background = "transparent";
|
|
1281
1281
|
},
|
|
1282
|
-
children: [
|
|
1282
|
+
children: [v && /* @__PURE__ */ U("span", {
|
|
1283
1283
|
style: {
|
|
1284
|
-
color:
|
|
1284
|
+
color: h ? "var(--danger)" : "var(--text-3)",
|
|
1285
1285
|
display: "flex"
|
|
1286
1286
|
},
|
|
1287
|
-
children:
|
|
1287
|
+
children: v
|
|
1288
1288
|
}), /* @__PURE__ */ U("span", {
|
|
1289
1289
|
style: { flex: 1 },
|
|
1290
|
-
children:
|
|
1290
|
+
children: p
|
|
1291
1291
|
})]
|
|
1292
1292
|
})] });
|
|
1293
1293
|
}
|
|
1294
|
-
function Ye({ group: e, entityActions: t, globalActions: n, onRun: r, loading:
|
|
1295
|
-
let
|
|
1296
|
-
return /* @__PURE__ */ W(H, { children: [
|
|
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 ? d(e.name) : void 0;
|
|
1296
|
+
return /* @__PURE__ */ W(H, { children: [l && /* @__PURE__ */ U("div", {
|
|
1297
1297
|
style: {
|
|
1298
1298
|
padding: "4px 10px 2px",
|
|
1299
1299
|
fontSize: 10.5,
|
|
@@ -1302,71 +1302,71 @@ function Ye({ group: e, entityActions: t, globalActions: n, onRun: r, loading: a
|
|
|
1302
1302
|
textTransform: "uppercase",
|
|
1303
1303
|
letterSpacing: "0.05em"
|
|
1304
1304
|
},
|
|
1305
|
-
children:
|
|
1305
|
+
children: l
|
|
1306
1306
|
}), e.items.map((e) => e.kind === "action" ? /* @__PURE__ */ U(Je, {
|
|
1307
1307
|
leaf: e,
|
|
1308
1308
|
entityActions: t,
|
|
1309
1309
|
globalActions: n,
|
|
1310
1310
|
onRun: r,
|
|
1311
|
-
loading:
|
|
1312
|
-
onLoadingChange: (t) =>
|
|
1313
|
-
row:
|
|
1314
|
-
widgetContext:
|
|
1315
|
-
onActionClick:
|
|
1311
|
+
loading: i === e.code,
|
|
1312
|
+
onLoadingChange: (t) => a(t ? e.code : null),
|
|
1313
|
+
row: o,
|
|
1314
|
+
widgetContext: s,
|
|
1315
|
+
onActionClick: c
|
|
1316
1316
|
}, e.code) : /* @__PURE__ */ U(Ye, {
|
|
1317
1317
|
group: e,
|
|
1318
1318
|
entityActions: t,
|
|
1319
1319
|
globalActions: n,
|
|
1320
1320
|
onRun: r,
|
|
1321
|
-
loading:
|
|
1322
|
-
onLoadingChange:
|
|
1323
|
-
row:
|
|
1324
|
-
widgetContext:
|
|
1325
|
-
onActionClick:
|
|
1321
|
+
loading: i,
|
|
1322
|
+
onLoadingChange: a,
|
|
1323
|
+
row: o,
|
|
1324
|
+
widgetContext: s,
|
|
1325
|
+
onActionClick: c
|
|
1326
1326
|
}, e.icon ?? "nested"))] });
|
|
1327
1327
|
}
|
|
1328
|
-
function Xe({ layout: t, entityActions:
|
|
1329
|
-
let
|
|
1328
|
+
function Xe({ layout: t, entityActions: i, globalActions: a, onRun: o, row: s, widgetContext: c, onActionClick: u }) {
|
|
1329
|
+
let d = B(null), [f, p] = V(!1), [m, h] = V(null), g = L((e, t) => (p(!1), o(e, t)), [o]);
|
|
1330
1330
|
return Be(t) === 0 ? null : /* @__PURE__ */ W("div", {
|
|
1331
|
-
"data-open":
|
|
1331
|
+
"data-open": f ? "true" : void 0,
|
|
1332
1332
|
style: {
|
|
1333
1333
|
display: "inline-flex",
|
|
1334
1334
|
alignItems: "center"
|
|
1335
1335
|
},
|
|
1336
|
-
children: [/* @__PURE__ */ U(
|
|
1337
|
-
ref:
|
|
1338
|
-
icon: U(
|
|
1336
|
+
children: [/* @__PURE__ */ U(r, {
|
|
1337
|
+
ref: d,
|
|
1338
|
+
icon: U(m == null ? e.more : n, { size: 14 }),
|
|
1339
1339
|
title: "Actions",
|
|
1340
1340
|
size: 28,
|
|
1341
|
-
onClick: () =>
|
|
1342
|
-
}), /* @__PURE__ */ U(
|
|
1343
|
-
open:
|
|
1344
|
-
anchor:
|
|
1345
|
-
onClose: () =>
|
|
1341
|
+
onClick: () => p((e) => !e)
|
|
1342
|
+
}), /* @__PURE__ */ U(l, {
|
|
1343
|
+
open: f,
|
|
1344
|
+
anchor: d.current,
|
|
1345
|
+
onClose: () => p(!1),
|
|
1346
1346
|
align: "end",
|
|
1347
1347
|
width: 220,
|
|
1348
1348
|
children: /* @__PURE__ */ U(Qe, {
|
|
1349
1349
|
layout: t,
|
|
1350
|
-
entityActions:
|
|
1351
|
-
globalActions:
|
|
1350
|
+
entityActions: i,
|
|
1351
|
+
globalActions: a,
|
|
1352
1352
|
onRun: g,
|
|
1353
|
-
loading:
|
|
1354
|
-
onLoadingChange:
|
|
1355
|
-
row:
|
|
1356
|
-
widgetContext:
|
|
1357
|
-
onActionClick:
|
|
1353
|
+
loading: m,
|
|
1354
|
+
onLoadingChange: h,
|
|
1355
|
+
row: s,
|
|
1356
|
+
widgetContext: c,
|
|
1357
|
+
onActionClick: u
|
|
1358
1358
|
})
|
|
1359
1359
|
})]
|
|
1360
1360
|
});
|
|
1361
1361
|
}
|
|
1362
1362
|
function Ze(e) {
|
|
1363
1363
|
let t = 0;
|
|
1364
|
-
for (let n of e) if (n.kind === "action" &&
|
|
1364
|
+
for (let n of e) if (n.kind === "action" && u(n.code)) t++;
|
|
1365
1365
|
else break;
|
|
1366
1366
|
return t;
|
|
1367
1367
|
}
|
|
1368
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), h = d.length > 0,
|
|
1369
|
+
let { normal: u, destructive: d } = Ve(e, t, n), f = Ze(u), p = u.slice(0, f), m = u.slice(f), h = d.length > 0, g = m.length > 0, _ = (e) => /* @__PURE__ */ U(Je, {
|
|
1370
1370
|
leaf: e,
|
|
1371
1371
|
entityActions: t,
|
|
1372
1372
|
globalActions: n,
|
|
@@ -1381,9 +1381,9 @@ function Qe({ layout: e, entityActions: t, globalActions: n, onRun: r, loading:
|
|
|
1381
1381
|
role: "menu",
|
|
1382
1382
|
"aria-label": l,
|
|
1383
1383
|
children: [
|
|
1384
|
-
p.map((e) => e.kind === "action" ?
|
|
1385
|
-
p.length > 0 &&
|
|
1386
|
-
m.map((e) => e.kind === "action" ?
|
|
1384
|
+
p.map((e) => e.kind === "action" ? _(e) : null),
|
|
1385
|
+
p.length > 0 && g && /* @__PURE__ */ U(S, { divider: !0 }),
|
|
1386
|
+
m.map((e) => e.kind === "action" ? _(e) : /* @__PURE__ */ U(Ye, {
|
|
1387
1387
|
group: e,
|
|
1388
1388
|
entityActions: t,
|
|
1389
1389
|
globalActions: n,
|
|
@@ -1394,8 +1394,8 @@ function Qe({ layout: e, entityActions: t, globalActions: n, onRun: r, loading:
|
|
|
1394
1394
|
widgetContext: s,
|
|
1395
1395
|
onActionClick: c
|
|
1396
1396
|
}, e.icon ?? "group")),
|
|
1397
|
-
h && /* @__PURE__ */ U(
|
|
1398
|
-
d.map((e) =>
|
|
1397
|
+
h && /* @__PURE__ */ U(S, { divider: !0 }),
|
|
1398
|
+
d.map((e) => _(e))
|
|
1399
1399
|
]
|
|
1400
1400
|
});
|
|
1401
1401
|
}
|
|
@@ -1460,7 +1460,7 @@ function ft(e, t, n, r, i, a, o, s, c) {
|
|
|
1460
1460
|
};
|
|
1461
1461
|
}
|
|
1462
1462
|
function $(e) {
|
|
1463
|
-
return e.kind === "action" ? `action:${e.code}` : `group:${e.name ?
|
|
1463
|
+
return e.kind === "action" ? `action:${e.code}` : `group:${e.name ? d(e.name) : ""}`;
|
|
1464
1464
|
}
|
|
1465
1465
|
function pt(e) {
|
|
1466
1466
|
let t = e.parentElement;
|
|
@@ -1469,8 +1469,8 @@ function pt(e) {
|
|
|
1469
1469
|
let n = getComputedStyle(t);
|
|
1470
1470
|
return !(parseFloat(n.flexGrow) > 0 || n.display === "block" || n.display === "flow-root" || n.width !== "auto" || n.maxWidth !== "none");
|
|
1471
1471
|
}
|
|
1472
|
-
function mt({ layout: t, entityActions: n, globalActions: r, onRun: i, reservedRightWidth: a = 0, measurementOverride:
|
|
1473
|
-
let
|
|
1472
|
+
function mt({ layout: t, entityActions: n, globalActions: r, onRun: i, reservedRightWidth: a = 0, measurementOverride: s, ariaLabel: c = "Actions", align: u = "trailing", constrain: d = !0, row: f, widgetContext: p, onActionClick: m }) {
|
|
1473
|
+
let h = B(null), g = B(null), [_, v] = V(0), [y, b] = V(/* @__PURE__ */ new Map()), [x, C] = V(!1), [w, T] = V(null), [E, D] = V(() => typeof document < "u" && document.documentElement.dir === "rtl");
|
|
1474
1474
|
R(() => {
|
|
1475
1475
|
if (typeof MutationObserver > "u") return;
|
|
1476
1476
|
let e = new MutationObserver((e) => {
|
|
@@ -1481,17 +1481,17 @@ function mt({ layout: t, entityActions: n, globalActions: r, onRun: i, reservedR
|
|
|
1481
1481
|
attributeFilter: ["dir", "lang"]
|
|
1482
1482
|
}), () => e.disconnect();
|
|
1483
1483
|
}, []);
|
|
1484
|
-
let O = B(null), [ee, k] = V(!1), A = L((e, t) => (k(!1), i(e, t)), [i]), te = Be(t), j = !!
|
|
1485
|
-
if (j || !
|
|
1486
|
-
let e = Array.from(
|
|
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 || !g.current) return;
|
|
1486
|
+
let e = Array.from(g.current.children), t = /* @__PURE__ */ new Map();
|
|
1487
1487
|
e.forEach((e) => {
|
|
1488
1488
|
let n = e.dataset.nodeKey;
|
|
1489
1489
|
n && t.set(n, e.getBoundingClientRect().width || e.offsetWidth);
|
|
1490
|
-
}),
|
|
1490
|
+
}), b((e) => lt(e, t) ? e : t), C(!0);
|
|
1491
1491
|
}, [j]), N = ne(() => JSON.stringify(t.map((e) => $(e))), [t]);
|
|
1492
1492
|
R(() => {
|
|
1493
1493
|
if (j) return;
|
|
1494
|
-
let e =
|
|
1494
|
+
let e = g.current;
|
|
1495
1495
|
if (!e || typeof ResizeObserver > "u") return;
|
|
1496
1496
|
let t = new ResizeObserver(() => M());
|
|
1497
1497
|
t.observe(e);
|
|
@@ -1516,46 +1516,46 @@ function mt({ layout: t, entityActions: n, globalActions: r, onRun: i, reservedR
|
|
|
1516
1516
|
M,
|
|
1517
1517
|
j
|
|
1518
1518
|
]), R(() => {
|
|
1519
|
-
if (j ||
|
|
1519
|
+
if (j || x) return;
|
|
1520
1520
|
let e = setTimeout(() => {
|
|
1521
1521
|
M(), C(!0);
|
|
1522
1522
|
}, 16);
|
|
1523
1523
|
return () => clearTimeout(e);
|
|
1524
1524
|
}, [
|
|
1525
|
-
|
|
1525
|
+
x,
|
|
1526
1526
|
M,
|
|
1527
1527
|
j
|
|
1528
1528
|
]), R(() => {
|
|
1529
|
-
if (j || !
|
|
1530
|
-
let e =
|
|
1529
|
+
if (j || !d || !x || _ === 0) return;
|
|
1530
|
+
let e = h.current;
|
|
1531
1531
|
if (!e || !pt(e)) return;
|
|
1532
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(
|
|
1533
|
+
r > 0 && Math.abs(_ - r) < 1 && console.error(`[declarion] ResponsiveActionBar is measuring itself: its container is ${Math.round(_)}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
1534
|
}, [
|
|
1535
1535
|
j,
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1536
|
+
d,
|
|
1537
|
+
x,
|
|
1538
|
+
_,
|
|
1539
|
+
y
|
|
1540
1540
|
]), R(() => {
|
|
1541
1541
|
if (j) return;
|
|
1542
|
-
let e =
|
|
1542
|
+
let e = h.current;
|
|
1543
1543
|
if (!e) return;
|
|
1544
1544
|
if (typeof ResizeObserver > "u") {
|
|
1545
|
-
|
|
1545
|
+
v(e.getBoundingClientRect().width);
|
|
1546
1546
|
return;
|
|
1547
1547
|
}
|
|
1548
1548
|
let t = new ResizeObserver((e) => {
|
|
1549
1549
|
let t = e[0];
|
|
1550
|
-
t &&
|
|
1550
|
+
t && v(t.contentRect.width);
|
|
1551
1551
|
});
|
|
1552
|
-
return t.observe(e),
|
|
1552
|
+
return t.observe(e), v(e.getBoundingClientRect().width), () => t.disconnect();
|
|
1553
1553
|
}, [j]);
|
|
1554
1554
|
let F = B(void 0), I = B(void 0);
|
|
1555
1555
|
R(() => {
|
|
1556
1556
|
F.current = void 0, I.current = void 0;
|
|
1557
1557
|
}, [N]);
|
|
1558
|
-
let G = ne(() => j || !
|
|
1558
|
+
let G = ne(() => j || !d ? ft(t, 2 ** 53 - 1, a, y, n, r, s) : x ? _ === 0 ? ft(t, 2 ** 53 - 1, a, y, n, r, s) : ft(t, _, a, y, n, r, s, F.current, I.current) : {
|
|
1559
1559
|
primaryInline: [],
|
|
1560
1560
|
inline: [],
|
|
1561
1561
|
overflow: [],
|
|
@@ -1563,48 +1563,48 @@ function mt({ layout: t, entityActions: n, globalActions: r, onRun: i, reservedR
|
|
|
1563
1563
|
iconOnly: /* @__PURE__ */ new Set()
|
|
1564
1564
|
}, [
|
|
1565
1565
|
j,
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1566
|
+
d,
|
|
1567
|
+
x,
|
|
1568
|
+
_,
|
|
1569
1569
|
t,
|
|
1570
1570
|
a,
|
|
1571
|
-
|
|
1571
|
+
y,
|
|
1572
1572
|
n,
|
|
1573
1573
|
r,
|
|
1574
|
-
|
|
1574
|
+
s
|
|
1575
1575
|
]);
|
|
1576
1576
|
if (R(() => {
|
|
1577
|
-
!
|
|
1577
|
+
!x && !j || (F.current = new Set([
|
|
1578
1578
|
...G.primaryInline,
|
|
1579
1579
|
...G.inline,
|
|
1580
1580
|
...G.destructiveInline
|
|
1581
1581
|
].map($)), I.current = new Set(G.iconOnly));
|
|
1582
1582
|
}, [
|
|
1583
1583
|
G,
|
|
1584
|
-
|
|
1584
|
+
x,
|
|
1585
1585
|
j
|
|
1586
1586
|
]), te === 0) return null;
|
|
1587
1587
|
let K = G.overflow.length > 0, { normal: q, destructive: re } = Ve(G.overflow, n, r);
|
|
1588
1588
|
return /* @__PURE__ */ W("div", {
|
|
1589
|
-
ref:
|
|
1589
|
+
ref: h,
|
|
1590
1590
|
role: "toolbar",
|
|
1591
|
-
"aria-label":
|
|
1591
|
+
"aria-label": c,
|
|
1592
1592
|
style: {
|
|
1593
1593
|
display: "flex",
|
|
1594
1594
|
flexDirection: E ? "row-reverse" : "row",
|
|
1595
1595
|
alignItems: "center",
|
|
1596
1596
|
gap: tt,
|
|
1597
1597
|
flexWrap: "wrap",
|
|
1598
|
-
visibility:
|
|
1598
|
+
visibility: x || j ? "visible" : "hidden",
|
|
1599
1599
|
position: "relative",
|
|
1600
|
-
flex:
|
|
1601
|
-
justifyContent:
|
|
1600
|
+
flex: d ? "1 1 auto" : "0 1 auto",
|
|
1601
|
+
justifyContent: u === "trailing" ? "flex-end" : "flex-start",
|
|
1602
1602
|
minWidth: 0,
|
|
1603
1603
|
boxSizing: "border-box"
|
|
1604
1604
|
},
|
|
1605
1605
|
children: [
|
|
1606
1606
|
/* @__PURE__ */ W("div", {
|
|
1607
|
-
ref:
|
|
1607
|
+
ref: g,
|
|
1608
1608
|
"aria-hidden": "true",
|
|
1609
1609
|
inert: !0,
|
|
1610
1610
|
style: {
|
|
@@ -1618,7 +1618,7 @@ function mt({ layout: t, entityActions: n, globalActions: r, onRun: i, reservedR
|
|
|
1618
1618
|
width: "max-content",
|
|
1619
1619
|
flexWrap: "nowrap"
|
|
1620
1620
|
},
|
|
1621
|
-
children: [/* @__PURE__ */ U(
|
|
1621
|
+
children: [/* @__PURE__ */ U(o, {
|
|
1622
1622
|
"data-node-key": $e,
|
|
1623
1623
|
iconRight: /* @__PURE__ */ U(e.down, { size: 10 }),
|
|
1624
1624
|
tabIndex: -1,
|
|
@@ -1632,8 +1632,8 @@ function mt({ layout: t, entityActions: n, globalActions: r, onRun: i, reservedR
|
|
|
1632
1632
|
onRun: st,
|
|
1633
1633
|
loading: !1,
|
|
1634
1634
|
onLoadingChange: ot,
|
|
1635
|
-
row:
|
|
1636
|
-
widgetContext:
|
|
1635
|
+
row: f,
|
|
1636
|
+
widgetContext: p,
|
|
1637
1637
|
measureRef: ct(t)
|
|
1638
1638
|
}), We(e.code, n, r) && /* @__PURE__ */ U(Ke, {
|
|
1639
1639
|
leaf: e,
|
|
@@ -1642,8 +1642,8 @@ function mt({ layout: t, entityActions: n, globalActions: r, onRun: i, reservedR
|
|
|
1642
1642
|
onRun: st,
|
|
1643
1643
|
loading: !1,
|
|
1644
1644
|
onLoadingChange: ot,
|
|
1645
|
-
row:
|
|
1646
|
-
widgetContext:
|
|
1645
|
+
row: f,
|
|
1646
|
+
widgetContext: p,
|
|
1647
1647
|
iconOnly: !0,
|
|
1648
1648
|
measureRef: ct(rt(e))
|
|
1649
1649
|
})] }, t) : /* @__PURE__ */ U(qe, {
|
|
@@ -1653,9 +1653,9 @@ function mt({ layout: t, entityActions: n, globalActions: r, onRun: i, reservedR
|
|
|
1653
1653
|
onRun: st,
|
|
1654
1654
|
loading: null,
|
|
1655
1655
|
onLoadingChange: ot,
|
|
1656
|
-
row:
|
|
1657
|
-
widgetContext:
|
|
1658
|
-
onActionClick:
|
|
1656
|
+
row: f,
|
|
1657
|
+
widgetContext: p,
|
|
1658
|
+
onActionClick: m,
|
|
1659
1659
|
measureRef: ct(t)
|
|
1660
1660
|
}, t);
|
|
1661
1661
|
})]
|
|
@@ -1667,9 +1667,9 @@ function mt({ layout: t, entityActions: n, globalActions: r, onRun: i, reservedR
|
|
|
1667
1667
|
onRun: i,
|
|
1668
1668
|
loading: w === e.code,
|
|
1669
1669
|
onLoadingChange: (t) => T(t ? e.code : null),
|
|
1670
|
-
row:
|
|
1671
|
-
widgetContext:
|
|
1672
|
-
onActionClick:
|
|
1670
|
+
row: f,
|
|
1671
|
+
widgetContext: p,
|
|
1672
|
+
onActionClick: m,
|
|
1673
1673
|
iconOnly: G.iconOnly.has($(e))
|
|
1674
1674
|
}, $(e))),
|
|
1675
1675
|
G.inline.map((e) => {
|
|
@@ -1681,9 +1681,9 @@ function mt({ layout: t, entityActions: n, globalActions: r, onRun: i, reservedR
|
|
|
1681
1681
|
onRun: i,
|
|
1682
1682
|
loading: w === e.code,
|
|
1683
1683
|
onLoadingChange: (t) => T(t ? e.code : null),
|
|
1684
|
-
row:
|
|
1685
|
-
widgetContext:
|
|
1686
|
-
onActionClick:
|
|
1684
|
+
row: f,
|
|
1685
|
+
widgetContext: p,
|
|
1686
|
+
onActionClick: m,
|
|
1687
1687
|
iconOnly: G.iconOnly.has(t)
|
|
1688
1688
|
}, t) : /* @__PURE__ */ U(qe, {
|
|
1689
1689
|
group: e,
|
|
@@ -1692,12 +1692,12 @@ function mt({ layout: t, entityActions: n, globalActions: r, onRun: i, reservedR
|
|
|
1692
1692
|
onRun: i,
|
|
1693
1693
|
loading: w,
|
|
1694
1694
|
onLoadingChange: T,
|
|
1695
|
-
row:
|
|
1696
|
-
widgetContext:
|
|
1697
|
-
onActionClick:
|
|
1695
|
+
row: f,
|
|
1696
|
+
widgetContext: p,
|
|
1697
|
+
onActionClick: m
|
|
1698
1698
|
}, t);
|
|
1699
1699
|
}),
|
|
1700
|
-
K && /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U(
|
|
1700
|
+
K && /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U(o, {
|
|
1701
1701
|
ref: O,
|
|
1702
1702
|
kind: "default",
|
|
1703
1703
|
iconRight: /* @__PURE__ */ U(e.down, { size: 10 }),
|
|
@@ -1705,7 +1705,7 @@ function mt({ layout: t, entityActions: n, globalActions: r, onRun: i, reservedR
|
|
|
1705
1705
|
"aria-expanded": ee ? "true" : "false",
|
|
1706
1706
|
onClick: () => k((e) => !e),
|
|
1707
1707
|
children: "Actions"
|
|
1708
|
-
}), /* @__PURE__ */ U(
|
|
1708
|
+
}), /* @__PURE__ */ U(l, {
|
|
1709
1709
|
open: ee,
|
|
1710
1710
|
anchor: O.current,
|
|
1711
1711
|
onClose: () => k(!1),
|
|
@@ -1718,16 +1718,16 @@ function mt({ layout: t, entityActions: n, globalActions: r, onRun: i, reservedR
|
|
|
1718
1718
|
...q,
|
|
1719
1719
|
...re.length > 0 ? [null] : [],
|
|
1720
1720
|
...re
|
|
1721
|
-
].map((e, t) => e === null ? /* @__PURE__ */ U(
|
|
1721
|
+
].map((e, t) => e === null ? /* @__PURE__ */ U(S, { divider: !0 }, "destructive-divider") : e.kind === "action" ? /* @__PURE__ */ U(Je, {
|
|
1722
1722
|
leaf: e,
|
|
1723
1723
|
entityActions: n,
|
|
1724
1724
|
globalActions: r,
|
|
1725
1725
|
onRun: A,
|
|
1726
1726
|
loading: w === e.code,
|
|
1727
1727
|
onLoadingChange: (t) => T(t ? e.code : null),
|
|
1728
|
-
row:
|
|
1729
|
-
widgetContext:
|
|
1730
|
-
onActionClick:
|
|
1728
|
+
row: f,
|
|
1729
|
+
widgetContext: p,
|
|
1730
|
+
onActionClick: m
|
|
1731
1731
|
}, e.code) : /* @__PURE__ */ U(Ye, {
|
|
1732
1732
|
group: e,
|
|
1733
1733
|
entityActions: n,
|
|
@@ -1735,9 +1735,9 @@ function mt({ layout: t, entityActions: n, globalActions: r, onRun: i, reservedR
|
|
|
1735
1735
|
onRun: A,
|
|
1736
1736
|
loading: w,
|
|
1737
1737
|
onLoadingChange: T,
|
|
1738
|
-
row:
|
|
1739
|
-
widgetContext:
|
|
1740
|
-
onActionClick:
|
|
1738
|
+
row: f,
|
|
1739
|
+
widgetContext: p,
|
|
1740
|
+
onActionClick: m
|
|
1741
1741
|
}, `${$(e)}-${t}`))
|
|
1742
1742
|
})
|
|
1743
1743
|
})] }),
|
|
@@ -1748,9 +1748,9 @@ function mt({ layout: t, entityActions: n, globalActions: r, onRun: i, reservedR
|
|
|
1748
1748
|
onRun: i,
|
|
1749
1749
|
loading: w === e.code,
|
|
1750
1750
|
onLoadingChange: (t) => T(t ? e.code : null),
|
|
1751
|
-
row:
|
|
1752
|
-
widgetContext:
|
|
1753
|
-
onActionClick:
|
|
1751
|
+
row: f,
|
|
1752
|
+
widgetContext: p,
|
|
1753
|
+
onActionClick: m,
|
|
1754
1754
|
iconOnly: G.iconOnly.has($(e))
|
|
1755
1755
|
}, $(e)))
|
|
1756
1756
|
]
|
|
@@ -1979,7 +1979,7 @@ function Rt(e, t, n) {
|
|
|
1979
1979
|
//#endregion
|
|
1980
1980
|
//#region src/lib/action-dispatch.ts
|
|
1981
1981
|
function zt(e, t, n, r) {
|
|
1982
|
-
return
|
|
1982
|
+
return c(t) ? (a(t.ui_steps, n), null) : t.entity ? `${t.entity}.${e}` : r ? `${r}.${e}` : e;
|
|
1983
1983
|
}
|
|
1984
1984
|
//#endregion
|
|
1985
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 };
|