@declarion/react 0.52.0 → 0.53.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-BQZTvZaU.js} +35 -35
- package/dist-lib/{Grid-DUjbQg3r.js → Grid-B9Tiytbd.js} +28 -28
- package/dist-lib/{LayoutRenderer-DbdxC-Bq.js → LayoutRenderer-D_v9OD_A.js} +920 -922
- package/dist-lib/{ListCardsBody-C8ofksQb.js → ListCardsBody-dRnXsQ7A.js} +14 -14
- package/dist-lib/{MarkdownRenderer-B9_5fwuE.js → MarkdownRenderer-BCyrsLrd.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-CV8nGACW.js} +120 -122
- package/dist-lib/{SmartDetailPage.impl-DWjNQ052.js → SmartDetailPage.impl-DWprVNMb.js} +376 -377
- package/dist-lib/{SmartListPage.impl-yKBK7a8b.js → SmartListPage.impl-BwWURGwa.js} +1098 -1099
- package/dist-lib/{SmartRecordListPage.impl-DRpU_DOC.js → SmartRecordListPage.impl-BKKBShAg.js} +183 -183
- package/dist-lib/{SortHeaderMenu-CbihbEGd.js → SortHeaderMenu-pgi4sxMs.js} +1 -1
- package/dist-lib/{action-dispatch-C28UhXXA.js → action-dispatch-DlHTYag7.js} +382 -382
- package/dist-lib/api/events.d.ts +27 -5
- package/dist-lib/{cardProjection-Bp_ZPLUE.js → cardProjection-C7Orz841.js} +146 -204
- 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/list/useListQuery.d.ts +6 -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-EY8CFF3P.js} +301 -320
- package/dist-lib/{format-count-C3N-WxEy.js → format-count-BHkaDr9V.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 +1541 -1832
- 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-1pIajluX.js} +36 -36
- package/dist-lib/{registry-p6CejATt.js → registry-C5ug25M8.js} +507 -507
- package/dist-lib/stores/realtime.d.ts +20 -0
- package/dist-lib/testing.js +35 -35
- package/dist-lib/{useCurrentScreen-74x5yJNb.js → useCurrentScreen-BdnZq8vZ.js} +2504 -1557
- package/dist-lib/{useListQuery-D75bgLLz.js → useListQuery-BxgrPZIB.js} +13 -10
- package/dist-lib/{useProperties-C5fZp12D.js → useProperties-Bhi9Wn5O.js} +25 -25
- package/dist-lib/useTabSearchMirror-Dl5x0xKu.js +177 -0
- package/dist-lib/{value-DKekzcjz.js → value-Rp-5W3o8.js} +25 -25
- package/package.json +7 -7
- package/dist-lib/useTabSearchMirror-D_wzoYRz.js +0 -406
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { s as e } from "./DynamicIcon-DW5krHuX.js";
|
|
2
|
-
import {
|
|
2
|
+
import { Fr as t, Ir as n, Jn as r, lr as i, nt as a, rt as o } from "./useCurrentScreen-BdnZq8vZ.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,14 +7,14 @@ 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: i, schema: a, rows: o, 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 = i.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 = i.fields.get(e);
|
|
18
18
|
return t && (t.auto || t.primary || t.source);
|
|
19
19
|
})), M = D.filter((e) => e !== E), N = d(() => o.filter((e) => !e._deleted).map((e) => e._key), [o]), P = u((e, t, n) => {
|
|
20
20
|
l(o.map((r) => r._key === e ? {
|
|
@@ -26,21 +26,21 @@ function w({ config: t, childEntity: n, schema: i, rows: o, onChange: l, validat
|
|
|
26
26
|
let e = o.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
|
-
}, -1),
|
|
29
|
+
}, -1), n = {
|
|
30
30
|
_key: crypto.randomUUID(),
|
|
31
31
|
_dirty: !0,
|
|
32
32
|
[E]: e + 1
|
|
33
|
-
},
|
|
33
|
+
}, r = t.quick_add?.defaults ?? {};
|
|
34
34
|
for (let e of A) {
|
|
35
|
-
let t =
|
|
36
|
-
t && (
|
|
35
|
+
let t = i.fields.get(e);
|
|
36
|
+
t && (r[e] === void 0 ? t.default === void 0 ? t.type === "bool" && (n[e] = !1) : n[e] = t.default : n[e] = r[e]);
|
|
37
37
|
}
|
|
38
|
-
l([...o,
|
|
38
|
+
l([...o, n]);
|
|
39
39
|
}, [
|
|
40
40
|
o,
|
|
41
41
|
l,
|
|
42
42
|
A,
|
|
43
|
-
|
|
43
|
+
i,
|
|
44
44
|
t.quick_add?.defaults,
|
|
45
45
|
E
|
|
46
46
|
]), I = u((e) => {
|
|
@@ -118,10 +118,10 @@ function w({ config: t, childEntity: n, schema: i, rows: o, onChange: l, validat
|
|
|
118
118
|
padding: "0 4px"
|
|
119
119
|
} }),
|
|
120
120
|
M.map((e) => {
|
|
121
|
-
let t =
|
|
121
|
+
let t = i.fields.get(e);
|
|
122
122
|
return /* @__PURE__ */ p("th", {
|
|
123
123
|
style: B,
|
|
124
|
-
children: t ?
|
|
124
|
+
children: t ? r(t, e, a.entities) : e
|
|
125
125
|
}, e);
|
|
126
126
|
}),
|
|
127
127
|
/* @__PURE__ */ p("th", { style: {
|
|
@@ -136,7 +136,7 @@ function w({ config: t, childEntity: n, schema: i, rows: o, onChange: l, validat
|
|
|
136
136
|
columns: M,
|
|
137
137
|
editableColumns: A,
|
|
138
138
|
displayOnlyColumns: j,
|
|
139
|
-
childEntity:
|
|
139
|
+
childEntity: i,
|
|
140
140
|
validationErrors: x,
|
|
141
141
|
refs: C,
|
|
142
142
|
onCellChange: P,
|
|
@@ -148,7 +148,7 @@ function w({ config: t, childEntity: n, schema: i, rows: o, onChange: l, validat
|
|
|
148
148
|
})
|
|
149
149
|
}), /* @__PURE__ */ p("div", {
|
|
150
150
|
style: { marginTop: 8 },
|
|
151
|
-
children: /* @__PURE__ */ p(
|
|
151
|
+
children: /* @__PURE__ */ p(n, {
|
|
152
152
|
kind: "ghost",
|
|
153
153
|
size: "xs",
|
|
154
154
|
icon: /* @__PURE__ */ p(e.plus, { size: 12 }),
|
|
@@ -157,9 +157,9 @@ function w({ config: t, childEntity: n, schema: i, rows: o, onChange: l, validat
|
|
|
157
157
|
})
|
|
158
158
|
})] });
|
|
159
159
|
}
|
|
160
|
-
function T({ row:
|
|
161
|
-
let v =
|
|
162
|
-
id:
|
|
160
|
+
function T({ row: n, columns: r, editableColumns: s, displayOnlyColumns: c, childEntity: u, validationErrors: d, refs: f, onCellChange: h, onDelete: g, onUndoDelete: _ }) {
|
|
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
|
+
id: n._key,
|
|
163
163
|
disabled: y
|
|
164
164
|
}), k = {
|
|
165
165
|
transform: C.Translate.toString(E),
|
|
@@ -200,40 +200,40 @@ function T({ row: r, columns: a, 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),
|
|
203
|
+
r.map((e) => {
|
|
204
|
+
let t = u.fields.get(e), r = b?.includes(e), a = c.has(e), l = s.includes(e);
|
|
205
205
|
return y || a || !l ? /* @__PURE__ */ p("td", {
|
|
206
206
|
style: {
|
|
207
207
|
...A,
|
|
208
208
|
textDecoration: y ? "line-through" : "none"
|
|
209
209
|
},
|
|
210
|
-
children: t ?
|
|
210
|
+
children: t ? o({
|
|
211
211
|
field: t,
|
|
212
212
|
fieldName: e,
|
|
213
|
-
value:
|
|
213
|
+
value: n[e],
|
|
214
214
|
mode: "display",
|
|
215
|
-
record:
|
|
215
|
+
record: n,
|
|
216
216
|
refs: f,
|
|
217
217
|
locale: v
|
|
218
|
-
}) :
|
|
218
|
+
}) : i(n[e])
|
|
219
219
|
}, e) : /* @__PURE__ */ p("td", {
|
|
220
220
|
style: {
|
|
221
221
|
...j,
|
|
222
|
-
outline:
|
|
222
|
+
outline: r ? "1px solid var(--danger)" : "none",
|
|
223
223
|
outlineOffset: -1,
|
|
224
|
-
borderRadius:
|
|
224
|
+
borderRadius: r ? 4 : 0
|
|
225
225
|
},
|
|
226
|
-
title:
|
|
227
|
-
children: t ?
|
|
226
|
+
title: r ? `${e} is required` : void 0,
|
|
227
|
+
children: t ? o({
|
|
228
228
|
field: t,
|
|
229
229
|
fieldName: e,
|
|
230
|
-
value:
|
|
230
|
+
value: n[e],
|
|
231
231
|
mode: "edit",
|
|
232
|
-
onChange: (t) => h(
|
|
233
|
-
record:
|
|
232
|
+
onChange: (t) => h(n._key, e, t),
|
|
233
|
+
record: n,
|
|
234
234
|
refs: f,
|
|
235
235
|
locale: v
|
|
236
|
-
}) :
|
|
236
|
+
}) : i(n[e])
|
|
237
237
|
}, e);
|
|
238
238
|
}),
|
|
239
239
|
/* @__PURE__ */ p("td", {
|
|
@@ -242,15 +242,15 @@ function T({ row: r, columns: a, editableColumns: s, displayOnlyColumns: c, chil
|
|
|
242
242
|
borderBottom: "1px solid var(--divider)",
|
|
243
243
|
verticalAlign: "middle"
|
|
244
244
|
},
|
|
245
|
-
children: y ? /* @__PURE__ */ p(
|
|
245
|
+
children: y ? /* @__PURE__ */ p(t, {
|
|
246
246
|
size: 24,
|
|
247
247
|
icon: /* @__PURE__ */ p(e.refresh, { size: 12 }),
|
|
248
|
-
onClick: () => _(
|
|
248
|
+
onClick: () => _(n._key),
|
|
249
249
|
title: "Undo delete"
|
|
250
|
-
}) : /* @__PURE__ */ p(
|
|
250
|
+
}) : /* @__PURE__ */ p(t, {
|
|
251
251
|
size: 24,
|
|
252
252
|
icon: /* @__PURE__ */ p(e.trash, { size: 12 }),
|
|
253
|
-
onClick: () => g(
|
|
253
|
+
onClick: () => g(n._key),
|
|
254
254
|
title: "Delete row"
|
|
255
255
|
})
|
|
256
256
|
})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as o, i as s, l as c, t as l } from "./value-
|
|
1
|
+
import { ct as e, dt as t, ft as n, lt as r, ot as i, ut as a } from "./useCurrentScreen-BdnZq8vZ.js";
|
|
2
|
+
import { c as o, i as s, l as c, t as l } from "./value-Rp-5W3o8.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(a) {
|
|
13
|
+
let { field: o, fieldName: s, value: c, onChange: h, mode: S, disabled: C } = a, w = l(c), [T, k] = m([]), [A, j] = m(/* @__PURE__ */ new Set()), [M, N] = m(null), { register: P, unregister: F, isDraft: I } = i(), 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 (i) => {
|
|
20
|
+
let c = n(i, 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: i.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: i.name,
|
|
34
34
|
progress: {
|
|
35
35
|
loaded: 0,
|
|
36
|
-
total:
|
|
36
|
+
total: i.size,
|
|
37
37
|
pct: 0
|
|
38
38
|
},
|
|
39
39
|
error: null,
|
|
40
40
|
abort: () => u.abort()
|
|
41
41
|
}]);
|
|
42
42
|
try {
|
|
43
|
-
let e = await
|
|
44
|
-
file:
|
|
45
|
-
entityCode:
|
|
43
|
+
let e = await t({
|
|
44
|
+
file: i,
|
|
45
|
+
entityCode: a.entityCode,
|
|
46
46
|
fieldCode: s,
|
|
47
47
|
signal: u.signal,
|
|
48
48
|
onProgress: (e) => k((t) => t.map((t) => t.localId === l ? {
|
|
@@ -51,11 +51,11 @@ function T(i) {
|
|
|
51
51
|
} : t))
|
|
52
52
|
});
|
|
53
53
|
if (L.current.delete(l)) {
|
|
54
|
-
|
|
54
|
+
r(e.id).catch(() => {}), F(e.id);
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
|
-
P(e.id, () =>
|
|
58
|
-
let
|
|
57
|
+
P(e.id, () => r(e.id));
|
|
58
|
+
let n = {
|
|
59
59
|
id: e.id,
|
|
60
60
|
filename: e.filename,
|
|
61
61
|
content_type: e.content_type,
|
|
@@ -65,19 +65,19 @@ function T(i) {
|
|
|
65
65
|
height: e.height,
|
|
66
66
|
url: e.url,
|
|
67
67
|
metadata: e.metadata
|
|
68
|
-
}, o = [...z.current,
|
|
68
|
+
}, o = [...z.current, n];
|
|
69
69
|
z.current = o, h?.(o), k((e) => e.filter((e) => e.localId !== l));
|
|
70
|
-
} catch (
|
|
71
|
-
if (
|
|
70
|
+
} catch (t) {
|
|
71
|
+
if (t instanceof e && t.code === "ABORTED") {
|
|
72
72
|
k((e) => e.filter((e) => e.localId !== l));
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
75
|
-
let n =
|
|
76
|
-
code:
|
|
77
|
-
message:
|
|
75
|
+
let n = t instanceof e ? {
|
|
76
|
+
code: t.code,
|
|
77
|
+
message: t.message
|
|
78
78
|
} : {
|
|
79
79
|
code: "UNKNOWN",
|
|
80
|
-
message:
|
|
80
|
+
message: t instanceof Error ? t.message : "Upload failed"
|
|
81
81
|
};
|
|
82
82
|
k((e) => e.map((e) => e.localId === l ? {
|
|
83
83
|
...e,
|
|
@@ -91,7 +91,7 @@ function T(i) {
|
|
|
91
91
|
o.max_size_bytes,
|
|
92
92
|
s,
|
|
93
93
|
h,
|
|
94
|
-
|
|
94
|
+
a.entityCode,
|
|
95
95
|
P,
|
|
96
96
|
F
|
|
97
97
|
]), K = u((e) => {
|
|
@@ -109,7 +109,7 @@ 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) && (
|
|
112
|
+
I(e) && (r(e).catch(() => {}), F(e));
|
|
113
113
|
let t = w.filter((t) => t.id !== e);
|
|
114
114
|
h?.(t), j((t) => {
|
|
115
115
|
let n = new Set(t);
|
|
@@ -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) && (r(e).catch(() => {}), F(e));
|
|
126
126
|
}), h?.(w.filter((e) => !A.has(e.id))), j(/* @__PURE__ */ new Set()));
|
|
127
127
|
}, [
|
|
128
128
|
I,
|
|
@@ -346,7 +346,7 @@ function D({ tile: e, onCancel: t, onDismiss: n }) {
|
|
|
346
346
|
]
|
|
347
347
|
});
|
|
348
348
|
}
|
|
349
|
-
function O({ file: e, hasPrev: t, hasNext: n, onPrev: r, onNext:
|
|
349
|
+
function O({ file: e, hasPrev: t, hasNext: n, onPrev: r, onNext: i, onClose: o }) {
|
|
350
350
|
let c = s(e.id, "preview", e.presigned_url ?? e.url ?? w(e));
|
|
351
351
|
return /* @__PURE__ */ _("div", {
|
|
352
352
|
className: "fixed inset-0 z-50 flex items-center justify-center bg-black/80",
|
|
@@ -378,7 +378,7 @@ function O({ file: e, hasPrev: t, hasNext: n, onPrev: r, onNext: a, onClose: o }
|
|
|
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) => {
|
|
381
|
-
e.stopPropagation(),
|
|
381
|
+
e.stopPropagation(), i();
|
|
382
382
|
},
|
|
383
383
|
"data-testid": "lightbox-next",
|
|
384
384
|
children: "›"
|
|
@@ -393,7 +393,7 @@ function O({ file: e, hasPrev: t, hasNext: n, onPrev: r, onNext: a, onClose: o }
|
|
|
393
393
|
children: [
|
|
394
394
|
e.filename,
|
|
395
395
|
" (",
|
|
396
|
-
|
|
396
|
+
a(e.size_bytes),
|
|
397
397
|
")"
|
|
398
398
|
]
|
|
399
399
|
})
|