@declarion/react 0.54.0 → 0.54.1

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.
Files changed (35) hide show
  1. package/dist-lib/{DraggableChildrenTable-CPoUY99R.js → DraggableChildrenTable-Djc7QDzR.js} +32 -32
  2. package/dist-lib/{Grid--QAEby8k.js → Grid-Bd2r0_4J.js} +45 -45
  3. package/dist-lib/{LayoutRenderer-BxZ7Nd9b.js → LayoutRenderer-V6nf9aa_.js} +716 -714
  4. package/dist-lib/{ListCardsBody-BPV4GPrv.js → ListCardsBody-Cdsvu0Vs.js} +29 -29
  5. package/dist-lib/{MarkdownRenderer-CIKuh_0i.js → MarkdownRenderer-CZo5ZgM7.js} +1 -1
  6. package/dist-lib/{RefreshControl-DMLkZP3R.js → RefreshControl-CJm3vz9p.js} +40 -40
  7. package/dist-lib/{SmartDetailPage.impl-SnNu6Ug-.js → SmartDetailPage.impl-DoIjCzjQ.js} +492 -492
  8. package/dist-lib/{SmartListPage.impl-C73pR7Iw.js → SmartListPage.impl-DnM8e14t.js} +743 -742
  9. package/dist-lib/{SmartRecordListPage.impl-rJjQZe1V.js → SmartRecordListPage.impl-BmHGYbD9.js} +128 -128
  10. package/dist-lib/{SortHeaderMenu-DQ_KrkWk.js → SortHeaderMenu-CA53NerB.js} +1 -1
  11. package/dist-lib/{action-dispatch-DsuUS7ae.js → action-dispatch-JcUrLFaW.js} +177 -177
  12. package/dist-lib/api/events.d.ts +13 -4
  13. package/dist-lib/{cardProjection-BadzqyeQ.js → cardProjection-Q2kwqv8V.js} +19 -19
  14. package/dist-lib/components/pages/list/ListToolbar.d.ts +5 -3
  15. package/dist-lib/components/pages/list/useListQuery.d.ts +1 -5
  16. package/dist-lib/{field-classification-sMkkAEg9.js → field-classification-ssZvtr8J.js} +268 -397
  17. package/dist-lib/{format-count-B5SLlNOb.js → format-count-DHuivNT7.js} +236 -236
  18. package/dist-lib/hooks/useEntityData.d.ts +7 -0
  19. package/dist-lib/hooks/useRealtimeThresholds.d.ts +1 -0
  20. package/dist-lib/hooks/useSSE.d.ts +0 -1
  21. package/dist-lib/index.js +806 -806
  22. package/dist-lib/lib/realtime-query-keys.d.ts +22 -0
  23. package/dist-lib/lib/realtime-reconcile.d.ts +0 -9
  24. package/dist-lib/lib/realtime-resync.d.ts +23 -0
  25. package/dist-lib/{peekDraftStore-CbHFwz_F.js → peekDraftStore-lm9ViVLA.js} +17 -17
  26. package/dist-lib/{registry-D0RhCnEL.js → registry-DsQFhEAD.js} +511 -511
  27. package/dist-lib/stores/realtime.d.ts +86 -19
  28. package/dist-lib/testing.js +40 -40
  29. package/dist-lib/{useCurrentScreen-DVTXCj_K.js → useCurrentScreen-aHx9HH1m.js} +2472 -1963
  30. package/dist-lib/useListQuery-DZn2BAxY.js +96 -0
  31. package/dist-lib/{useProperties-BcIz-MyO.js → useProperties-CAqKmUKg.js} +25 -25
  32. package/dist-lib/{useTabSearchMirror-UYCsopxP.js → useTabSearchMirror-DYW9WoK7.js} +10 -10
  33. package/dist-lib/{value-CQzGOI0F.js → value-CzKQPJOp.js} +4 -4
  34. package/package.json +4 -4
  35. package/dist-lib/useListQuery-C2nq58YV.js +0 -90
@@ -1,5 +1,5 @@
1
1
  import { s as e } from "./DynamicIcon-DW5krHuX.js";
2
- import { Fr as t, Ir as n, Jn as r, lr as i, nt as a, rt as o } from "./useCurrentScreen-DVTXCj_K.js";
2
+ import { $n as t, Br as n, Vr as r, et as i, mr as a, tt as o } from "./useCurrentScreen-aHx9HH1m.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,8 +7,8 @@ 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: i, schema: a, rows: o, onChange: l, validationErrors: x, refs: C }) {
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) => {
10
+ function w({ config: n, childEntity: i, schema: a, rows: o, onChange: l, validationErrors: x, refs: C }) {
11
+ let w = f(null), E = n.position_field, D = n.columns, O = y(v(g, { activationConstraint: { distance: 5 } })), k = new Set(Array.isArray(n.foreign_key) ? n.foreign_key : [n.foreign_key]), A = D.filter((e) => {
12
12
  if (k.has(e) || e === E) return !1;
13
13
  let t = i.fields.get(e);
14
14
  return !(!t || t.auto || t.primary || t.source);
@@ -26,22 +26,22 @@ function w({ config: t, childEntity: i, schema: a, 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), n = {
29
+ }, -1), t = {
30
30
  _key: crypto.randomUUID(),
31
31
  _dirty: !0,
32
32
  [E]: e + 1
33
- }, r = t.quick_add?.defaults ?? {};
33
+ }, r = n.quick_add?.defaults ?? {};
34
34
  for (let e of A) {
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]);
35
+ let n = i.fields.get(e);
36
+ n && (r[e] === void 0 ? n.default === void 0 ? n.type === "bool" && (t[e] = !1) : t[e] = n.default : t[e] = r[e]);
37
37
  }
38
- l([...o, n]);
38
+ l([...o, t]);
39
39
  }, [
40
40
  o,
41
41
  l,
42
42
  A,
43
43
  i,
44
- t.quick_add?.defaults,
44
+ n.quick_add?.defaults,
45
45
  E
46
46
  ]), I = u((e) => {
47
47
  l(o.map((t) => t._key === 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 = i.fields.get(e);
121
+ let n = i.fields.get(e);
122
122
  return /* @__PURE__ */ p("th", {
123
123
  style: B,
124
- children: t ? r(t, e, a.entities) : e
124
+ children: n ? t(n, e, a.entities) : e
125
125
  }, e);
126
126
  }),
127
127
  /* @__PURE__ */ p("th", { style: {
@@ -148,7 +148,7 @@ function w({ config: t, childEntity: i, schema: a, rows: o, onChange: l, validat
148
148
  })
149
149
  }), /* @__PURE__ */ p("div", {
150
150
  style: { marginTop: 8 },
151
- children: /* @__PURE__ */ p(n, {
151
+ children: /* @__PURE__ */ p(r, {
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: i, schema: a, rows: o, onChange: l, validat
157
157
  })
158
158
  })] });
159
159
  }
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,
160
+ function T({ row: t, columns: r, editableColumns: s, displayOnlyColumns: c, childEntity: u, validationErrors: d, refs: f, onCellChange: h, onDelete: g, onUndoDelete: _ }) {
161
+ let v = i(), y = !!t._deleted, b = d?.[t._key], { attributes: S, listeners: w, setNodeRef: T, transform: E, transition: D, isDragging: O } = x({
162
+ id: t._key,
163
163
  disabled: y
164
164
  }), k = {
165
165
  transform: C.Translate.toString(E),
@@ -201,21 +201,21 @@ function T({ row: n, columns: r, editableColumns: s, displayOnlyColumns: c, chil
201
201
  })
202
202
  }),
203
203
  r.map((e) => {
204
- let t = u.fields.get(e), r = b?.includes(e), a = c.has(e), l = s.includes(e);
205
- return y || a || !l ? /* @__PURE__ */ p("td", {
204
+ let n = u.fields.get(e), r = b?.includes(e), i = c.has(e), l = s.includes(e);
205
+ return y || i || !l ? /* @__PURE__ */ p("td", {
206
206
  style: {
207
207
  ...A,
208
208
  textDecoration: y ? "line-through" : "none"
209
209
  },
210
- children: t ? o({
211
- field: t,
210
+ children: n ? o({
211
+ field: n,
212
212
  fieldName: e,
213
- value: n[e],
213
+ value: t[e],
214
214
  mode: "display",
215
- record: n,
215
+ record: t,
216
216
  refs: f,
217
217
  locale: v
218
- }) : i(n[e])
218
+ }) : a(t[e])
219
219
  }, e) : /* @__PURE__ */ p("td", {
220
220
  style: {
221
221
  ...j,
@@ -224,16 +224,16 @@ function T({ row: n, columns: r, editableColumns: s, displayOnlyColumns: c, chil
224
224
  borderRadius: r ? 4 : 0
225
225
  },
226
226
  title: r ? `${e} is required` : void 0,
227
- children: t ? o({
228
- field: t,
227
+ children: n ? o({
228
+ field: n,
229
229
  fieldName: e,
230
- value: n[e],
230
+ value: t[e],
231
231
  mode: "edit",
232
- onChange: (t) => h(n._key, e, t),
233
- record: n,
232
+ onChange: (n) => h(t._key, e, n),
233
+ record: t,
234
234
  refs: f,
235
235
  locale: v
236
- }) : i(n[e])
236
+ }) : a(t[e])
237
237
  }, e);
238
238
  }),
239
239
  /* @__PURE__ */ p("td", {
@@ -242,15 +242,15 @@ function T({ row: n, columns: r, editableColumns: s, displayOnlyColumns: c, chil
242
242
  borderBottom: "1px solid var(--divider)",
243
243
  verticalAlign: "middle"
244
244
  },
245
- children: y ? /* @__PURE__ */ p(t, {
245
+ children: y ? /* @__PURE__ */ p(n, {
246
246
  size: 24,
247
247
  icon: /* @__PURE__ */ p(e.refresh, { size: 12 }),
248
- onClick: () => _(n._key),
248
+ onClick: () => _(t._key),
249
249
  title: "Undo delete"
250
- }) : /* @__PURE__ */ p(t, {
250
+ }) : /* @__PURE__ */ p(n, {
251
251
  size: 24,
252
252
  icon: /* @__PURE__ */ p(e.trash, { size: 12 }),
253
- onClick: () => g(n._key),
253
+ onClick: () => g(t._key),
254
254
  title: "Delete row"
255
255
  })
256
256
  })
@@ -1,5 +1,5 @@
1
- import { ct as e, dt as t, ft as n, lt as r, ot as i, ut as a } from "./useCurrentScreen-DVTXCj_K.js";
2
- import { c as o, i as s, l as c, t as l } from "./value-CQzGOI0F.js";
1
+ import { ct as e, it as t, lt as n, ot as r, st as i, ut as a } from "./useCurrentScreen-aHx9HH1m.js";
2
+ import { c as o, i as s, l as c, t as l } from "./value-CzKQPJOp.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(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([]);
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 } = t(), 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 (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();
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 (t) => {
20
+ let c = a(t, 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: i.name,
24
+ filename: t.name,
25
25
  progress: null,
26
26
  error: c,
27
27
  abort: () => {}
@@ -30,19 +30,19 @@ function T(a) {
30
30
  }
31
31
  k((e) => [...e, {
32
32
  localId: l,
33
- filename: i.name,
33
+ filename: t.name,
34
34
  progress: {
35
35
  loaded: 0,
36
- total: i.size,
36
+ total: t.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 t({
44
- file: i,
45
- entityCode: a.entityCode,
43
+ let r = await n({
44
+ file: t,
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,37 +51,37 @@ function T(a) {
51
51
  } : t))
52
52
  });
53
53
  if (L.current.delete(l)) {
54
- r(e.id).catch(() => {}), F(e.id);
54
+ i(r.id).catch(() => {}), F(r.id);
55
55
  return;
56
56
  }
57
- P(e.id, () => r(e.id));
58
- let n = {
59
- id: e.id,
60
- filename: e.filename,
61
- content_type: e.content_type,
62
- size_bytes: e.size_bytes,
63
- sha256: e.sha256,
64
- width: e.width,
65
- height: e.height,
66
- url: e.url,
67
- metadata: e.metadata
68
- }, o = [...z.current, n];
57
+ P(r.id, () => i(r.id));
58
+ let a = {
59
+ id: r.id,
60
+ filename: r.filename,
61
+ content_type: r.content_type,
62
+ size_bytes: r.size_bytes,
63
+ sha256: r.sha256,
64
+ width: r.width,
65
+ height: r.height,
66
+ url: r.url,
67
+ metadata: r.metadata
68
+ }, o = [...z.current, a];
69
69
  z.current = o, h?.(o), k((e) => e.filter((e) => e.localId !== l));
70
- } catch (t) {
71
- if (t instanceof e && t.code === "ABORTED") {
70
+ } catch (e) {
71
+ if (e instanceof r && e.code === "ABORTED") {
72
72
  k((e) => e.filter((e) => e.localId !== l));
73
73
  return;
74
74
  }
75
- let n = t instanceof e ? {
76
- code: t.code,
77
- message: t.message
75
+ let t = e instanceof r ? {
76
+ code: e.code,
77
+ message: e.message
78
78
  } : {
79
79
  code: "UNKNOWN",
80
- message: t instanceof Error ? t.message : "Upload failed"
80
+ message: e instanceof Error ? e.message : "Upload failed"
81
81
  };
82
82
  k((e) => e.map((e) => e.localId === l ? {
83
83
  ...e,
84
- error: n,
84
+ error: t,
85
85
  progress: null,
86
86
  abort: () => {}
87
87
  } : e));
@@ -91,7 +91,7 @@ function T(a) {
91
91
  o.max_size_bytes,
92
92
  s,
93
93
  h,
94
- a.entityCode,
94
+ e.entityCode,
95
95
  P,
96
96
  F
97
97
  ]), K = u((e) => {
@@ -109,7 +109,7 @@ function T(a) {
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) && (r(e).catch(() => {}), F(e));
112
+ I(e) && (i(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(a) {
122
122
  F
123
123
  ]), ce = u(() => {
124
124
  A.size !== 0 && (Array.from(A).forEach((e) => {
125
- I(e) && (r(e).catch(() => {}), F(e));
125
+ I(e) && (i(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: e, hasPrev: t, hasNext: n, onPrev: r, onNext: i, onClose: o }) {
350
- let c = s(e.id, "preview", e.presigned_url ?? e.url ?? w(e));
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": e.filename,
355
+ "aria-label": t.filename,
356
356
  "data-testid": "lightbox",
357
357
  onClick: o,
358
358
  children: [
@@ -365,35 +365,35 @@ function O({ file: e, hasPrev: t, hasNext: n, onPrev: r, onNext: i, onClose: o }
365
365
  "data-testid": "lightbox-close",
366
366
  children: "Close"
367
367
  }),
368
- t && /* @__PURE__ */ g("button", {
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(), r();
372
+ e.stopPropagation(), i();
373
373
  },
374
374
  "data-testid": "lightbox-prev",
375
375
  children: "‹"
376
376
  }),
377
- n && /* @__PURE__ */ g("button", {
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) => {
381
- e.stopPropagation(), i();
381
+ e.stopPropagation(), a();
382
382
  },
383
383
  "data-testid": "lightbox-next",
384
384
  children: "›"
385
385
  }),
386
386
  c ? /* @__PURE__ */ g("img", {
387
387
  src: c,
388
- alt: e.filename,
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
- e.filename,
394
+ t.filename,
395
395
  " (",
396
- a(e.size_bytes),
396
+ e(t.size_bytes),
397
397
  ")"
398
398
  ]
399
399
  })