@declarion/react 0.41.0 → 0.43.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-x_3rA4Rm.js → DraggableChildrenTable-G4Sw1XAD.js} +43 -43
- package/dist-lib/{Grid-CKvYZx69.js → Grid-CXn-IK3H.js} +2 -2
- package/dist-lib/{LayoutRenderer-Bxvllfdl.js → LayoutRenderer-DX8pFS5A.js} +906 -861
- package/dist-lib/MarkdownRenderer-CreI9x2m.js +85 -0
- package/dist-lib/{RefreshControl-Cxzbbj3F.js → RefreshControl-DFh0-gCb.js} +58 -60
- package/dist-lib/{SmartDetailPage.impl-RDaFEH3Y.js → SmartDetailPage.impl-K6Jj1-9z.js} +545 -545
- package/dist-lib/{SmartRecordListPage.impl-BDdULatb.js → SmartRecordListPage.impl-DQW_uVfL.js} +250 -250
- package/dist-lib/hooks/usePageStateTtl.d.ts +1 -1
- package/dist-lib/index.js +1216 -1216
- package/dist-lib/lib/brand-tokens.d.ts +1 -1
- package/dist-lib/lib/evidence-verdict.d.ts +0 -1
- package/dist-lib/lib/safe-url.d.ts +14 -0
- package/dist-lib/{registry-DsZmw4hy.js → registry-r4hiflwC.js} +501 -501
- package/dist-lib/testing.js +42 -42
- package/dist-lib/types/api.d.ts +1 -1
- package/dist-lib/{useCurrentScreen-D6LPBFOi.js → useCurrentScreen-CpQjVmrT.js} +1320 -1286
- package/dist-lib/{useProperties-DiwFyA4b.js → useProperties-CULxrNT4.js} +43 -43
- package/dist-lib/{value-BudY9GCn.js → value-fUHxMV4r.js} +20 -20
- package/package.json +12 -12
- package/dist-lib/MarkdownRenderer-BvWJ8pzN.js +0 -98
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { s as e } from "./DynamicIcon-DeRpAaXm.js";
|
|
2
|
-
import { A as t,
|
|
2
|
+
import { A as t, In as n, cr as r, j as i, lr as a, xn as o } from "./useCurrentScreen-CpQjVmrT.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,7 +7,7 @@ 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: n, schema:
|
|
10
|
+
function w({ config: t, childEntity: n, schema: r, rows: i, 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
13
|
let t = n.fields.get(e);
|
|
@@ -16,56 +16,56 @@ function w({ config: t, childEntity: n, schema: a, rows: o, onChange: l, validat
|
|
|
16
16
|
if (e === E) return !0;
|
|
17
17
|
let t = n.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(() => i.filter((e) => !e._deleted).map((e) => e._key), [i]), P = u((e, t, n) => {
|
|
20
|
+
l(i.map((r) => r._key === e ? {
|
|
21
21
|
...r,
|
|
22
22
|
[t]: n,
|
|
23
23
|
_dirty: !0
|
|
24
24
|
} : r));
|
|
25
|
-
}, [
|
|
26
|
-
let e =
|
|
25
|
+
}, [i, l]), F = u(() => {
|
|
26
|
+
let e = i.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), r = {
|
|
30
30
|
_key: crypto.randomUUID(),
|
|
31
31
|
_dirty: !0,
|
|
32
32
|
[E]: e + 1
|
|
33
|
-
},
|
|
33
|
+
}, a = t.quick_add?.defaults ?? {};
|
|
34
34
|
for (let e of A) {
|
|
35
35
|
let t = n.fields.get(e);
|
|
36
|
-
t && (
|
|
36
|
+
t && (a[e] === void 0 ? t.default === void 0 ? t.type === "bool" && (r[e] = !1) : r[e] = t.default : r[e] = a[e]);
|
|
37
37
|
}
|
|
38
|
-
l([...
|
|
38
|
+
l([...i, r]);
|
|
39
39
|
}, [
|
|
40
|
-
|
|
40
|
+
i,
|
|
41
41
|
l,
|
|
42
42
|
A,
|
|
43
43
|
n,
|
|
44
44
|
t.quick_add?.defaults,
|
|
45
45
|
E
|
|
46
46
|
]), I = u((e) => {
|
|
47
|
-
l(
|
|
47
|
+
l(i.map((t) => t._key === e ? {
|
|
48
48
|
...t,
|
|
49
49
|
_deleted: !0
|
|
50
50
|
} : t));
|
|
51
|
-
}, [
|
|
52
|
-
l(
|
|
51
|
+
}, [i, l]), L = u((e) => {
|
|
52
|
+
l(i.map((t) => t._key === e ? {
|
|
53
53
|
...t,
|
|
54
54
|
_deleted: !1
|
|
55
55
|
} : t));
|
|
56
|
-
}, [
|
|
56
|
+
}, [i, 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 = i.filter((e) => !e._deleted), a = i.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
|
|
66
|
-
})), ...
|
|
66
|
+
})), ...a]);
|
|
67
67
|
}, [
|
|
68
|
-
|
|
68
|
+
i,
|
|
69
69
|
l,
|
|
70
70
|
E
|
|
71
71
|
]), z = u((e) => {
|
|
@@ -121,7 +121,7 @@ function w({ config: t, childEntity: n, schema: a, rows: o, onChange: l, validat
|
|
|
121
121
|
let t = n.fields.get(e);
|
|
122
122
|
return /* @__PURE__ */ p("th", {
|
|
123
123
|
style: B,
|
|
124
|
-
children: t ?
|
|
124
|
+
children: t ? o(t, e, r.entities) : e
|
|
125
125
|
}, e);
|
|
126
126
|
}),
|
|
127
127
|
/* @__PURE__ */ p("th", { style: {
|
|
@@ -131,7 +131,7 @@ function w({ config: t, childEntity: n, 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: i.map((e) => /* @__PURE__ */ p(T, {
|
|
135
135
|
row: e,
|
|
136
136
|
columns: M,
|
|
137
137
|
editableColumns: A,
|
|
@@ -148,7 +148,7 @@ function w({ config: t, childEntity: n, schema: a, 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(a, {
|
|
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: a, rows: o, onChange: l, validat
|
|
|
157
157
|
})
|
|
158
158
|
})] });
|
|
159
159
|
}
|
|
160
|
-
function T({ row:
|
|
161
|
-
let v = t(), y = !!
|
|
162
|
-
id:
|
|
160
|
+
function T({ row: a, columns: o, editableColumns: s, displayOnlyColumns: c, childEntity: u, validationErrors: d, refs: f, onCellChange: h, onDelete: g, onUndoDelete: _ }) {
|
|
161
|
+
let v = t(), y = !!a._deleted, b = d?.[a._key], { attributes: S, listeners: w, setNodeRef: T, transform: E, transition: D, isDragging: O } = x({
|
|
162
|
+
id: a._key,
|
|
163
163
|
disabled: y
|
|
164
164
|
}), k = {
|
|
165
165
|
transform: C.Translate.toString(E),
|
|
@@ -200,40 +200,40 @@ function T({ row: r, columns: i, 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
|
+
o.map((e) => {
|
|
204
|
+
let t = u.fields.get(e), r = b?.includes(e), o = c.has(e), l = s.includes(e);
|
|
205
205
|
return y || o || !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 ? i({
|
|
211
211
|
field: t,
|
|
212
212
|
fieldName: e,
|
|
213
|
-
value:
|
|
213
|
+
value: a[e],
|
|
214
214
|
mode: "display",
|
|
215
|
-
record:
|
|
215
|
+
record: a,
|
|
216
216
|
refs: f,
|
|
217
217
|
locale: v
|
|
218
|
-
}) : n(
|
|
218
|
+
}) : n(a[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 ? i({
|
|
228
228
|
field: t,
|
|
229
229
|
fieldName: e,
|
|
230
|
-
value:
|
|
230
|
+
value: a[e],
|
|
231
231
|
mode: "edit",
|
|
232
|
-
onChange: (t) => h(
|
|
233
|
-
record:
|
|
232
|
+
onChange: (t) => h(a._key, e, t),
|
|
233
|
+
record: a,
|
|
234
234
|
refs: f,
|
|
235
235
|
locale: v
|
|
236
|
-
}) : n(
|
|
236
|
+
}) : n(a[e])
|
|
237
237
|
}, e);
|
|
238
238
|
}),
|
|
239
239
|
/* @__PURE__ */ p("td", {
|
|
@@ -242,15 +242,15 @@ function T({ row: r, columns: i, 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(r, {
|
|
246
246
|
size: 24,
|
|
247
247
|
icon: /* @__PURE__ */ p(e.refresh, { size: 12 }),
|
|
248
|
-
onClick: () => _(
|
|
248
|
+
onClick: () => _(a._key),
|
|
249
249
|
title: "Undo delete"
|
|
250
|
-
}) : /* @__PURE__ */ p(
|
|
250
|
+
}) : /* @__PURE__ */ p(r, {
|
|
251
251
|
size: 24,
|
|
252
252
|
icon: /* @__PURE__ */ p(e.trash, { size: 12 }),
|
|
253
|
-
onClick: () => g(
|
|
253
|
+
onClick: () => g(a._key),
|
|
254
254
|
title: "Delete row"
|
|
255
255
|
})
|
|
256
256
|
})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as e, I as t, L as n, P as r, R as i, z as a } from "./useCurrentScreen-
|
|
2
|
-
import { c as o, i as s, l as c, t as l } from "./value-
|
|
1
|
+
import { B as e, I as t, L as n, P as r, R as i, z as a } from "./useCurrentScreen-CpQjVmrT.js";
|
|
2
|
+
import { c as o, i as s, l as c, t as l } from "./value-fUHxMV4r.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";
|