@declarion/react 0.36.3 → 0.36.5
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-ChUh120M.js → DraggableChildrenTable-BfErdVdt.js} +35 -35
- package/dist-lib/{Grid-DT9wV-D7.js → Grid-D0ckegd1.js} +41 -41
- package/dist-lib/{LayoutRenderer-0UKE3pp6.js → LayoutRenderer-BGeN0rwC.js} +465 -465
- package/dist-lib/{MarkdownRenderer-CvURrJCu.js → MarkdownRenderer-14LG1clY.js} +1 -1
- package/dist-lib/{RefreshControl-CX_D6PcA.js → RefreshControl-Bpd9kw0G.js} +45 -45
- package/dist-lib/{SmartDetailPage.impl-Ccz4TqfJ.js → SmartDetailPage.impl-BaXAi7OH.js} +234 -234
- package/dist-lib/{SmartRecordListPage.impl-Y0w4oIe3.js → SmartRecordListPage.impl-CgiZWbF3.js} +189 -189
- package/dist-lib/index.d.ts +1 -1
- package/dist-lib/index.js +1510 -1526
- package/dist-lib/{registry-D_zbJrLC.js → registry-KMbQkTF6.js} +1036 -1034
- package/dist-lib/testing.d.ts +8 -0
- package/dist-lib/testing.js +63 -60
- package/dist-lib/{ActionRunner-BrXXs8ga.js → useCurrentScreen-Bgp6_vne.js} +18 -2
- package/dist-lib/{useProperties-C_1KM72K.js → useProperties-DMT162ot.js} +68 -68
- package/dist-lib/{value-BBnVc95O.js → value-CUVtVjKI.js} +22 -22
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { s as e } from "./DynamicIcon-BWO6QtNF.js";
|
|
2
|
-
import {
|
|
2
|
+
import { Gn as t, Kn as n, bn as r, g as i, h as a, sn as o } from "./useCurrentScreen-Bgp6_vne.js";
|
|
3
3
|
import { n as s, r as c, t as l } from "./dataTableStyles-vwD1mVOP.js";
|
|
4
4
|
import { useCallback as u, useMemo as d, useRef as f } from "react";
|
|
5
5
|
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
@@ -7,65 +7,65 @@ import { DndContext as h, PointerSensor as g, closestCenter as _, useSensor as v
|
|
|
7
7
|
import { SortableContext as b, useSortable as x, verticalListSortingStrategy as S } from "@dnd-kit/sortable";
|
|
8
8
|
import { CSS as C } from "@dnd-kit/utilities";
|
|
9
9
|
//#region src/components/detail-layout/DraggableChildrenTable.tsx
|
|
10
|
-
function w({ config: t, childEntity:
|
|
10
|
+
function w({ config: t, childEntity: r, schema: i, rows: a, onChange: l, validationErrors: x, refs: C }) {
|
|
11
11
|
let w = f(null), E = t.position_field, D = t.columns, O = y(v(g, { activationConstraint: { distance: 5 } })), k = new Set(Array.isArray(t.foreign_key) ? t.foreign_key : [t.foreign_key]), A = D.filter((e) => {
|
|
12
12
|
if (k.has(e) || e === E) return !1;
|
|
13
|
-
let t =
|
|
13
|
+
let t = r.fields.get(e);
|
|
14
14
|
return !(!t || t.auto || t.primary || t.source);
|
|
15
15
|
}), j = new Set(D.filter((e) => {
|
|
16
16
|
if (e === E) return !0;
|
|
17
|
-
let t =
|
|
17
|
+
let t = r.fields.get(e);
|
|
18
18
|
return t && (t.auto || t.primary || t.source);
|
|
19
|
-
})), M = D.filter((e) => e !== E), N = d(() =>
|
|
20
|
-
l(
|
|
19
|
+
})), M = D.filter((e) => e !== E), N = d(() => a.filter((e) => !e._deleted).map((e) => e._key), [a]), P = u((e, t, n) => {
|
|
20
|
+
l(a.map((r) => r._key === e ? {
|
|
21
21
|
...r,
|
|
22
22
|
[t]: n,
|
|
23
23
|
_dirty: !0
|
|
24
24
|
} : r));
|
|
25
|
-
}, [
|
|
26
|
-
let e =
|
|
25
|
+
}, [a, l]), F = u(() => {
|
|
26
|
+
let e = a.filter((e) => !e._deleted).reduce((e, t) => {
|
|
27
27
|
let n = typeof t[E] == "number" ? t[E] : -1;
|
|
28
28
|
return Math.max(e, n);
|
|
29
29
|
}, -1), n = {
|
|
30
30
|
_key: crypto.randomUUID(),
|
|
31
31
|
_dirty: !0,
|
|
32
32
|
[E]: e + 1
|
|
33
|
-
},
|
|
33
|
+
}, i = t.quick_add?.defaults ?? {};
|
|
34
34
|
for (let e of A) {
|
|
35
|
-
let t =
|
|
36
|
-
t && (
|
|
35
|
+
let t = r.fields.get(e);
|
|
36
|
+
t && (i[e] === void 0 ? t.default === void 0 ? t.type === "bool" && (n[e] = !1) : n[e] = t.default : n[e] = i[e]);
|
|
37
37
|
}
|
|
38
|
-
l([...
|
|
38
|
+
l([...a, n]);
|
|
39
39
|
}, [
|
|
40
|
-
|
|
40
|
+
a,
|
|
41
41
|
l,
|
|
42
42
|
A,
|
|
43
|
-
|
|
43
|
+
r,
|
|
44
44
|
t.quick_add?.defaults,
|
|
45
45
|
E
|
|
46
46
|
]), I = u((e) => {
|
|
47
|
-
l(
|
|
47
|
+
l(a.map((t) => t._key === e ? {
|
|
48
48
|
...t,
|
|
49
49
|
_deleted: !0
|
|
50
50
|
} : t));
|
|
51
|
-
}, [
|
|
52
|
-
l(
|
|
51
|
+
}, [a, l]), L = u((e) => {
|
|
52
|
+
l(a.map((t) => t._key === e ? {
|
|
53
53
|
...t,
|
|
54
54
|
_deleted: !1
|
|
55
55
|
} : t));
|
|
56
|
-
}, [
|
|
56
|
+
}, [a, l]), R = u((e) => {
|
|
57
57
|
let { active: t, over: n } = e;
|
|
58
58
|
if (!n || t.id === n.id) return;
|
|
59
|
-
let r =
|
|
60
|
-
if (
|
|
61
|
-
let c = [...r], [u] = c.splice(
|
|
59
|
+
let r = a.filter((e) => !e._deleted), i = a.filter((e) => e._deleted), o = r.findIndex((e) => e._key === String(t.id)), s = r.findIndex((e) => e._key === String(n.id));
|
|
60
|
+
if (o === -1 || s === -1) return;
|
|
61
|
+
let c = [...r], [u] = c.splice(o, 1);
|
|
62
62
|
c.splice(s, 0, u), l([...c.map((e, t) => ({
|
|
63
63
|
...e,
|
|
64
64
|
[E]: t,
|
|
65
65
|
_dirty: e[E] === t ? e._dirty : !0
|
|
66
66
|
})), ...i]);
|
|
67
67
|
}, [
|
|
68
|
-
|
|
68
|
+
a,
|
|
69
69
|
l,
|
|
70
70
|
E
|
|
71
71
|
]), z = u((e) => {
|
|
@@ -118,10 +118,10 @@ function w({ config: t, childEntity: i, schema: a, rows: o, onChange: l, validat
|
|
|
118
118
|
padding: "0 4px"
|
|
119
119
|
} }),
|
|
120
120
|
M.map((e) => {
|
|
121
|
-
let t =
|
|
121
|
+
let t = r.fields.get(e);
|
|
122
122
|
return /* @__PURE__ */ p("th", {
|
|
123
123
|
style: B,
|
|
124
|
-
children: t ?
|
|
124
|
+
children: t ? o(t, e, i.entities) : e
|
|
125
125
|
}, e);
|
|
126
126
|
}),
|
|
127
127
|
/* @__PURE__ */ p("th", { style: {
|
|
@@ -131,12 +131,12 @@ function w({ config: t, childEntity: i, schema: a, rows: o, onChange: l, validat
|
|
|
131
131
|
] }) }), /* @__PURE__ */ p(b, {
|
|
132
132
|
items: N,
|
|
133
133
|
strategy: S,
|
|
134
|
-
children: /* @__PURE__ */ p("tbody", { children:
|
|
134
|
+
children: /* @__PURE__ */ p("tbody", { children: a.map((e) => /* @__PURE__ */ p(T, {
|
|
135
135
|
row: e,
|
|
136
136
|
columns: M,
|
|
137
137
|
editableColumns: A,
|
|
138
138
|
displayOnlyColumns: j,
|
|
139
|
-
childEntity:
|
|
139
|
+
childEntity: r,
|
|
140
140
|
validationErrors: x,
|
|
141
141
|
refs: C,
|
|
142
142
|
onCellChange: P,
|
|
@@ -157,7 +157,7 @@ function w({ config: t, childEntity: i, schema: a, rows: o, onChange: l, validat
|
|
|
157
157
|
})
|
|
158
158
|
})] });
|
|
159
159
|
}
|
|
160
|
-
function T({ row: n, columns:
|
|
160
|
+
function T({ row: n, columns: o, editableColumns: s, displayOnlyColumns: c, childEntity: u, validationErrors: d, refs: f, onCellChange: h, onDelete: g, onUndoDelete: _ }) {
|
|
161
161
|
let v = a(), y = !!n._deleted, b = d?.[n._key], { attributes: S, listeners: w, setNodeRef: T, transform: E, transition: D, isDragging: O } = x({
|
|
162
162
|
id: n._key,
|
|
163
163
|
disabled: y
|
|
@@ -200,9 +200,9 @@ function T({ row: n, columns: r, editableColumns: s, displayOnlyColumns: c, chil
|
|
|
200
200
|
children: /* @__PURE__ */ p(e.grid, { size: 14 })
|
|
201
201
|
})
|
|
202
202
|
}),
|
|
203
|
-
|
|
204
|
-
let t = u.fields.get(e),
|
|
205
|
-
return y ||
|
|
203
|
+
o.map((e) => {
|
|
204
|
+
let t = u.fields.get(e), a = b?.includes(e), o = c.has(e), l = s.includes(e);
|
|
205
|
+
return y || o || !l ? /* @__PURE__ */ p("td", {
|
|
206
206
|
style: {
|
|
207
207
|
...A,
|
|
208
208
|
textDecoration: y ? "line-through" : "none"
|
|
@@ -215,15 +215,15 @@ function T({ row: n, columns: r, editableColumns: s, displayOnlyColumns: c, chil
|
|
|
215
215
|
record: n,
|
|
216
216
|
refs: f,
|
|
217
217
|
locale: v
|
|
218
|
-
}) :
|
|
218
|
+
}) : r(n[e])
|
|
219
219
|
}, e) : /* @__PURE__ */ p("td", {
|
|
220
220
|
style: {
|
|
221
221
|
...j,
|
|
222
|
-
outline:
|
|
222
|
+
outline: a ? "1px solid var(--danger)" : "none",
|
|
223
223
|
outlineOffset: -1,
|
|
224
|
-
borderRadius:
|
|
224
|
+
borderRadius: a ? 4 : 0
|
|
225
225
|
},
|
|
226
|
-
title:
|
|
226
|
+
title: a ? `${e} is required` : void 0,
|
|
227
227
|
children: t ? i({
|
|
228
228
|
field: t,
|
|
229
229
|
fieldName: e,
|
|
@@ -233,7 +233,7 @@ function T({ row: n, columns: r, editableColumns: s, displayOnlyColumns: c, chil
|
|
|
233
233
|
record: n,
|
|
234
234
|
refs: f,
|
|
235
235
|
locale: v
|
|
236
|
-
}) :
|
|
236
|
+
}) : r(n[e])
|
|
237
237
|
}, e);
|
|
238
238
|
}),
|
|
239
239
|
/* @__PURE__ */ p("td", {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as e, S as t,
|
|
2
|
-
import { c as o, i as s, l as c, t as l } from "./value-
|
|
1
|
+
import { C as e, S as t, T as n, w as r, x as i, y as a } from "./useCurrentScreen-Bgp6_vne.js";
|
|
2
|
+
import { c as o, i as s, l as c, t as l } from "./value-CUVtVjKI.js";
|
|
3
3
|
import { useCallback as u, useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
|
|
4
4
|
import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
5
5
|
import { DndContext as v, PointerSensor as y, closestCenter as b, useSensor as x, useSensors as ee } from "@dnd-kit/core";
|
|
@@ -9,19 +9,19 @@ import { CSS as C } from "@dnd-kit/utilities";
|
|
|
9
9
|
function w(e, t) {
|
|
10
10
|
return o(e, t);
|
|
11
11
|
}
|
|
12
|
-
function T(
|
|
13
|
-
let { field: o, fieldName: s, value: c, onChange: h, mode: S, disabled: C } =
|
|
12
|
+
function T(e) {
|
|
13
|
+
let { field: o, fieldName: s, value: c, onChange: h, mode: S, disabled: C } = e, w = l(c), [T, k] = m([]), [A, j] = m(/* @__PURE__ */ new Set()), [M, N] = m(null), { register: P, unregister: F, isDraft: I } = a(), L = p(/* @__PURE__ */ new Set()), R = p([]);
|
|
14
14
|
R.current = T;
|
|
15
15
|
let z = p(w);
|
|
16
16
|
z.current = w, d(() => () => {
|
|
17
17
|
R.current.forEach((e) => e.abort());
|
|
18
18
|
}, []);
|
|
19
|
-
let B = ee(x(y, { activationConstraint: { distance: 5 } })), V = o.display?.placeholder || s, H = (o.accepts ?? ["image/*"]).join(","), U = o.display?.reorderable !== !1, W = o.display?.listable_thumbnail, G = u(async (
|
|
20
|
-
let c =
|
|
19
|
+
let B = ee(x(y, { activationConstraint: { distance: 5 } })), V = o.display?.placeholder || s, H = (o.accepts ?? ["image/*"]).join(","), U = o.display?.reorderable !== !1, W = o.display?.listable_thumbnail, G = u(async (a) => {
|
|
20
|
+
let c = n(a, o.accepts, o.max_size_bytes), l = `tile-${Math.random().toString(36).slice(2)}-${Date.now()}`, u = new AbortController();
|
|
21
21
|
if (c) {
|
|
22
22
|
k((e) => [...e, {
|
|
23
23
|
localId: l,
|
|
24
|
-
filename:
|
|
24
|
+
filename: a.name,
|
|
25
25
|
progress: null,
|
|
26
26
|
error: c,
|
|
27
27
|
abort: () => {}
|
|
@@ -30,19 +30,19 @@ function T(i) {
|
|
|
30
30
|
}
|
|
31
31
|
k((e) => [...e, {
|
|
32
32
|
localId: l,
|
|
33
|
-
filename:
|
|
33
|
+
filename: a.name,
|
|
34
34
|
progress: {
|
|
35
35
|
loaded: 0,
|
|
36
|
-
total:
|
|
36
|
+
total: a.size,
|
|
37
37
|
pct: 0
|
|
38
38
|
},
|
|
39
39
|
error: null,
|
|
40
40
|
abort: () => u.abort()
|
|
41
41
|
}]);
|
|
42
42
|
try {
|
|
43
|
-
let
|
|
44
|
-
file:
|
|
45
|
-
entityCode:
|
|
43
|
+
let n = await r({
|
|
44
|
+
file: a,
|
|
45
|
+
entityCode: e.entityCode,
|
|
46
46
|
fieldCode: s,
|
|
47
47
|
signal: u.signal,
|
|
48
48
|
onProgress: (e) => k((t) => t.map((t) => t.localId === l ? {
|
|
@@ -51,28 +51,28 @@ function T(i) {
|
|
|
51
51
|
} : t))
|
|
52
52
|
});
|
|
53
53
|
if (L.current.delete(l)) {
|
|
54
|
-
|
|
54
|
+
t(n.id).catch(() => {}), F(n.id);
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
|
-
P(
|
|
58
|
-
let
|
|
59
|
-
id:
|
|
60
|
-
filename:
|
|
61
|
-
content_type:
|
|
62
|
-
size_bytes:
|
|
63
|
-
sha256:
|
|
64
|
-
width:
|
|
65
|
-
height:
|
|
66
|
-
url:
|
|
67
|
-
metadata:
|
|
68
|
-
}, o = [...z.current,
|
|
57
|
+
P(n.id, () => t(n.id));
|
|
58
|
+
let i = {
|
|
59
|
+
id: n.id,
|
|
60
|
+
filename: n.filename,
|
|
61
|
+
content_type: n.content_type,
|
|
62
|
+
size_bytes: n.size_bytes,
|
|
63
|
+
sha256: n.sha256,
|
|
64
|
+
width: n.width,
|
|
65
|
+
height: n.height,
|
|
66
|
+
url: n.url,
|
|
67
|
+
metadata: n.metadata
|
|
68
|
+
}, o = [...z.current, i];
|
|
69
69
|
z.current = o, h?.(o), k((e) => e.filter((e) => e.localId !== l));
|
|
70
70
|
} catch (e) {
|
|
71
|
-
if (e instanceof
|
|
71
|
+
if (e instanceof i && e.code === "ABORTED") {
|
|
72
72
|
k((e) => e.filter((e) => e.localId !== l));
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
75
|
-
let t = e instanceof
|
|
75
|
+
let t = e instanceof i ? {
|
|
76
76
|
code: e.code,
|
|
77
77
|
message: e.message
|
|
78
78
|
} : {
|
|
@@ -91,7 +91,7 @@ function T(i) {
|
|
|
91
91
|
o.max_size_bytes,
|
|
92
92
|
s,
|
|
93
93
|
h,
|
|
94
|
-
|
|
94
|
+
e.entityCode,
|
|
95
95
|
P,
|
|
96
96
|
F
|
|
97
97
|
]), K = u((e) => {
|
|
@@ -109,9 +109,9 @@ function T(i) {
|
|
|
109
109
|
let t = e.target.files;
|
|
110
110
|
e.target.value = "", t && t.length > 0 && K(t);
|
|
111
111
|
}, [K]), se = u((e) => {
|
|
112
|
-
I(e) && (
|
|
113
|
-
let
|
|
114
|
-
h?.(
|
|
112
|
+
I(e) && (t(e).catch(() => {}), F(e));
|
|
113
|
+
let n = w.filter((t) => t.id !== e);
|
|
114
|
+
h?.(n), j((t) => {
|
|
115
115
|
let n = new Set(t);
|
|
116
116
|
return n.delete(e), n;
|
|
117
117
|
});
|
|
@@ -122,7 +122,7 @@ function T(i) {
|
|
|
122
122
|
F
|
|
123
123
|
]), ce = u(() => {
|
|
124
124
|
A.size !== 0 && (Array.from(A).forEach((e) => {
|
|
125
|
-
I(e) && (
|
|
125
|
+
I(e) && (t(e).catch(() => {}), F(e));
|
|
126
126
|
}), h?.(w.filter((e) => !A.has(e.id))), j(/* @__PURE__ */ new Set()));
|
|
127
127
|
}, [
|
|
128
128
|
I,
|
|
@@ -346,13 +346,13 @@ function D({ tile: e, onCancel: t, onDismiss: n }) {
|
|
|
346
346
|
]
|
|
347
347
|
});
|
|
348
348
|
}
|
|
349
|
-
function O({ file:
|
|
350
|
-
let c = s(
|
|
349
|
+
function O({ file: t, hasPrev: n, hasNext: r, onPrev: i, onNext: a, onClose: o }) {
|
|
350
|
+
let c = s(t.id, "preview", t.presigned_url ?? t.url ?? w(t));
|
|
351
351
|
return /* @__PURE__ */ _("div", {
|
|
352
352
|
className: "fixed inset-0 z-50 flex items-center justify-center bg-black/80",
|
|
353
353
|
role: "dialog",
|
|
354
354
|
"aria-modal": "true",
|
|
355
|
-
"aria-label":
|
|
355
|
+
"aria-label": t.filename,
|
|
356
356
|
"data-testid": "lightbox",
|
|
357
357
|
onClick: o,
|
|
358
358
|
children: [
|
|
@@ -365,16 +365,16 @@ function O({ file: e, hasPrev: t, hasNext: n, onPrev: r, onNext: a, onClose: o }
|
|
|
365
365
|
"data-testid": "lightbox-close",
|
|
366
366
|
children: "Close"
|
|
367
367
|
}),
|
|
368
|
-
|
|
368
|
+
n && /* @__PURE__ */ g("button", {
|
|
369
369
|
type: "button",
|
|
370
370
|
className: "absolute left-4 rounded-sm border border-border bg-card px-3 py-2 text-foreground",
|
|
371
371
|
onClick: (e) => {
|
|
372
|
-
e.stopPropagation(),
|
|
372
|
+
e.stopPropagation(), i();
|
|
373
373
|
},
|
|
374
374
|
"data-testid": "lightbox-prev",
|
|
375
375
|
children: "‹"
|
|
376
376
|
}),
|
|
377
|
-
|
|
377
|
+
r && /* @__PURE__ */ g("button", {
|
|
378
378
|
type: "button",
|
|
379
379
|
className: "absolute right-4 bottom-4 rounded-sm border border-border bg-card px-3 py-2 text-foreground",
|
|
380
380
|
onClick: (e) => {
|
|
@@ -385,15 +385,15 @@ function O({ file: e, hasPrev: t, hasNext: n, onPrev: r, onNext: a, onClose: o }
|
|
|
385
385
|
}),
|
|
386
386
|
c ? /* @__PURE__ */ g("img", {
|
|
387
387
|
src: c,
|
|
388
|
-
alt:
|
|
388
|
+
alt: t.filename,
|
|
389
389
|
className: "max-h-[90vh] max-w-[90vw] object-contain",
|
|
390
390
|
onClick: (e) => e.stopPropagation()
|
|
391
391
|
}) : /* @__PURE__ */ _("div", {
|
|
392
392
|
className: "rounded-md bg-card p-4 text-foreground",
|
|
393
393
|
children: [
|
|
394
|
-
|
|
394
|
+
t.filename,
|
|
395
395
|
" (",
|
|
396
|
-
|
|
396
|
+
e(t.size_bytes),
|
|
397
397
|
")"
|
|
398
398
|
]
|
|
399
399
|
})
|