@declarion/react 0.81.0 → 0.82.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.
Files changed (28) hide show
  1. package/dist-lib/components/actions/ObjectActionBar.js +56 -54
  2. package/dist-lib/components/actions/PropertyGridEditor.js +56 -53
  3. package/dist-lib/components/actions/RowActionsKebab.js +51 -49
  4. package/dist-lib/components/detail-layout/AssociatedBlock.js +385 -383
  5. package/dist-lib/components/list/QuickPeek.js +77 -75
  6. package/dist-lib/components/pages/SmartDetailPage.impl.js +484 -458
  7. package/dist-lib/components/pages/SmartRecordListPage.impl.js +207 -206
  8. package/dist-lib/components/pages/list/DataCell.js +15 -15
  9. package/dist-lib/components/pages/list/ListFloatbar.js +55 -53
  10. package/dist-lib/components/pages/list/ListHeader.js +54 -52
  11. package/dist-lib/components/pages/list/ListTable.js +64 -64
  12. package/dist-lib/components/pages/list/cardProjection.js +85 -80
  13. package/dist-lib/components/pages/list/column-sizing.js +11 -1
  14. package/dist-lib/components/pages/list/use-filter-value-labels.js +29 -78
  15. package/dist-lib/components/pages/list/useListRowInteraction.js +78 -76
  16. package/dist-lib/components/pages/list/useRowMenu.js +60 -58
  17. package/dist-lib/components/pages/tenant-params/TenantParamsPage.impl.js +341 -262
  18. package/dist-lib/components/params/ParamsBlock.js +59 -59
  19. package/dist-lib/components/params/param-editors.js +114 -99
  20. package/dist-lib/components/shared/ConfirmDialog.js +33 -66
  21. package/dist-lib/components/shared/ModalFrame.js +53 -0
  22. package/dist-lib/hooks/useRefRecords.js +73 -0
  23. package/dist-lib/hooks/useRowTenant.js +12 -0
  24. package/dist-lib/index.d.ts +4 -3
  25. package/dist-lib/lib/actions.js +105 -89
  26. package/dist-lib/lib/mass-edit.js +13 -13
  27. package/dist-lib/types/schema.js +29 -22
  28. package/package.json +1 -1
@@ -9,51 +9,53 @@ import { applyRowState as s, defaultFlatForSlot as c, filterLayoutForSlot as l }
9
9
  import { useActionRunner as u } from "../actions/ActionRunner.js";
10
10
  import { renderSchemaField as d } from "../file-widgets/host.js";
11
11
  import { ResponsiveActionBar as f } from "../actions/ResponsiveActionBar.js";
12
- import { effectiveScreenForRecord as p, variantActionCodesForRecord as m } from "../../lib/variants.js";
13
- import { PeekFieldCell as h } from "./PeekFieldCell.js";
14
- import { useUnsavedInput as g } from "../../hooks/useUnsavedInput.js";
15
- import { useEffect as _, useMemo as v, useRef as y, useState as b } from "react";
16
- import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
12
+ import { useRowTenant as p } from "../../hooks/useRowTenant.js";
13
+ import { effectiveScreenForRecord as m, variantActionCodesForRecord as h } from "../../lib/variants.js";
14
+ import { PeekFieldCell as g } from "./PeekFieldCell.js";
15
+ import { useUnsavedInput as _ } from "../../hooks/useUnsavedInput.js";
16
+ import { useEffect as v, useMemo as y, useRef as b, useState as x } from "react";
17
+ import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
17
18
  //#region src/components/list/QuickPeek.tsx
18
- var w = {
19
+ var T = {
19
20
  tab: "Tab",
20
21
  esc: "Esc"
21
22
  };
22
- function T({ entity: T, entityCode: D, record: O, title: k, recordId: A, avatarName: j, fields: M, refs: N, screen: P, actions: F, screenActionLayout: I, entityActionLayout: L, executeAction: R, onClose: z, onOpen: B, onSave: V }) {
23
- let H = o(), [U, W] = b({ ...O }), [G, K] = b(!1);
24
- g(G);
25
- let q = y(null), { run: J } = u(), Y = p(T, P, U);
26
- _(() => {
27
- W({ ...O }), K(!1);
28
- }, [O]), _(() => {
29
- q.current?.focus();
23
+ function E({ entity: E, entityCode: O, record: k, title: A, recordId: j, avatarName: ee, fields: M, refs: N, screen: P, actions: F, screenActionLayout: I, entityActionLayout: L, executeAction: R, onClose: z, onOpen: B, onSave: V }) {
24
+ let H = o(), U = p(E), [W, G] = x({ ...k }), [K, q] = x(!1);
25
+ _(K);
26
+ let J = b(null), { run: Y } = u(), X = m(E, P, W);
27
+ v(() => {
28
+ G({ ...k }), q(!1);
29
+ }, [k]), v(() => {
30
+ J.current?.focus();
30
31
  }, []);
31
- let X = v(() => {
32
- let e = Y?.action_layout ?? I ?? L ?? c(F, "quick_peek"), t = l(e, F, void 0, "quick_peek");
33
- return s(H, t, F, void 0, U, [], m(T, U));
32
+ let Z = y(() => {
33
+ let e = X?.action_layout ?? I ?? L ?? c(F, "quick_peek"), t = l(e, F, void 0, "quick_peek");
34
+ return s(H, t, F, void 0, W, [], U, h(E, W));
34
35
  }, [
35
36
  H,
36
- Y?.action_layout,
37
+ X?.action_layout,
37
38
  I,
38
39
  L,
39
40
  F,
40
- U,
41
- T
42
- ]), Z = ({ code: e, action: t }) => {
43
- J({
41
+ W,
42
+ E,
43
+ U
44
+ ]), Q = ({ code: e, action: t }) => {
45
+ Y({
44
46
  action: t,
45
47
  title: H(t.display?.name) || e,
46
- row: U,
48
+ row: W,
47
49
  execute: (n) => R(e, t, n)
48
50
  });
49
- }, Q = (e, t) => {
51
+ }, $ = (e, t) => {
50
52
  let n = {
51
- ...U,
53
+ ...W,
52
54
  [e]: t
53
55
  };
54
- W(n), K(!0), V?.(n);
55
- }, $ = Y?.quick_peek?.width ?? 480;
56
- return /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ S("div", {
56
+ G(n), q(!0), V?.(n);
57
+ }, te = X?.quick_peek?.width ?? 480;
58
+ return /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C("div", {
57
59
  onClick: z,
58
60
  style: {
59
61
  position: "fixed",
@@ -61,8 +63,8 @@ function T({ entity: T, entityCode: D, record: O, title: k, recordId: A, avatarN
61
63
  background: "var(--scrim-lite)",
62
64
  zIndex: 40
63
65
  }
64
- }), /* @__PURE__ */ C("aside", {
65
- ref: q,
66
+ }), /* @__PURE__ */ w("aside", {
67
+ ref: J,
66
68
  role: "dialog",
67
69
  "aria-label": H("list.peek.dialog", "Quick peek"),
68
70
  tabIndex: -1,
@@ -74,7 +76,7 @@ function T({ entity: T, entityCode: D, record: O, title: k, recordId: A, avatarN
74
76
  top: "var(--topbar-h)",
75
77
  right: 0,
76
78
  bottom: "var(--tabbar-h)",
77
- width: $,
79
+ width: te,
78
80
  background: "var(--surface)",
79
81
  borderLeft: "1px solid var(--border)",
80
82
  zIndex: 41,
@@ -83,7 +85,7 @@ function T({ entity: T, entityCode: D, record: O, title: k, recordId: A, avatarN
83
85
  boxShadow: "var(--shadow-lg)"
84
86
  },
85
87
  children: [
86
- /* @__PURE__ */ C("div", {
88
+ /* @__PURE__ */ w("div", {
87
89
  style: {
88
90
  display: "flex",
89
91
  alignItems: "center",
@@ -92,16 +94,16 @@ function T({ entity: T, entityCode: D, record: O, title: k, recordId: A, avatarN
92
94
  gap: 10
93
95
  },
94
96
  children: [
95
- /* @__PURE__ */ S(a, {
96
- name: j || k,
97
+ /* @__PURE__ */ C(a, {
98
+ name: ee || A,
97
99
  size: 28
98
100
  }),
99
- /* @__PURE__ */ C("div", {
101
+ /* @__PURE__ */ w("div", {
100
102
  style: {
101
103
  flex: 1,
102
104
  minWidth: 0
103
105
  },
104
- children: [/* @__PURE__ */ S("div", {
106
+ children: [/* @__PURE__ */ C("div", {
105
107
  style: {
106
108
  fontSize: 14,
107
109
  fontWeight: 600,
@@ -110,29 +112,29 @@ function T({ entity: T, entityCode: D, record: O, title: k, recordId: A, avatarN
110
112
  textOverflow: "ellipsis",
111
113
  whiteSpace: "nowrap"
112
114
  },
113
- children: k
114
- }), A && /* @__PURE__ */ S("div", {
115
+ children: A
116
+ }), j && /* @__PURE__ */ C("div", {
115
117
  className: "mono",
116
118
  style: {
117
119
  fontSize: 11,
118
120
  color: "var(--text-4)"
119
121
  },
120
- children: A
122
+ children: j
121
123
  })]
122
124
  }),
123
- /* @__PURE__ */ S(r, {
124
- icon: /* @__PURE__ */ S(t.external, { size: 13 }),
125
- title: G ? H("list.peek.open_in_tab_dirty", "Open in tab (keeps unsaved changes)") : H("list.peek.open_in_tab", "Open in tab"),
126
- onClick: () => B(G ? U : null)
125
+ /* @__PURE__ */ C(r, {
126
+ icon: /* @__PURE__ */ C(t.external, { size: 13 }),
127
+ title: K ? H("list.peek.open_in_tab_dirty", "Open in tab (keeps unsaved changes)") : H("list.peek.open_in_tab", "Open in tab"),
128
+ onClick: () => B(K ? W : null)
127
129
  }),
128
- /* @__PURE__ */ S(r, {
129
- icon: /* @__PURE__ */ S(t.x, { size: 14 }),
130
+ /* @__PURE__ */ C(r, {
131
+ icon: /* @__PURE__ */ C(t.x, { size: 14 }),
130
132
  title: H("list.peek.close", "Close"),
131
133
  onClick: z
132
134
  })
133
135
  ]
134
136
  }),
135
- /* @__PURE__ */ C("div", {
137
+ /* @__PURE__ */ w("div", {
136
138
  style: {
137
139
  flex: 1,
138
140
  overflowY: "auto",
@@ -141,7 +143,7 @@ function T({ entity: T, entityCode: D, record: O, title: k, recordId: A, avatarN
141
143
  flexDirection: "column",
142
144
  gap: 10
143
145
  },
144
- children: [/* @__PURE__ */ C("div", {
146
+ children: [/* @__PURE__ */ w("div", {
145
147
  style: {
146
148
  padding: "8px 10px",
147
149
  background: "var(--accent-soft)",
@@ -153,39 +155,39 @@ function T({ entity: T, entityCode: D, record: O, title: k, recordId: A, avatarN
153
155
  gap: 6
154
156
  },
155
157
  children: [
156
- /* @__PURE__ */ S(t.sparkle, { size: 12 }),
158
+ /* @__PURE__ */ C(t.sparkle, { size: 12 }),
157
159
  " ",
158
160
  H("list.peek.hint", "Inline quick-edit — click any field to change."),
159
161
  e(H("list.peek.keys_hint", "{tab} to move, {esc} to close."), {
160
- tab: /* @__PURE__ */ S(i, { children: w.tab }),
161
- esc: /* @__PURE__ */ S(i, { children: w.esc })
162
+ tab: /* @__PURE__ */ C(i, { children: T.tab }),
163
+ esc: /* @__PURE__ */ C(i, { children: T.esc })
162
164
  })
163
165
  ]
164
- }), M.map((e) => /* @__PURE__ */ S(E, {
166
+ }), M.map((e) => /* @__PURE__ */ C(D, {
165
167
  label: e.label,
166
168
  children: e.kind === "file" ? d({
167
- entity: T,
168
- entityCode: D,
169
+ entity: E,
170
+ entityCode: O,
169
171
  fieldName: e.key,
170
- record: U,
172
+ record: W,
171
173
  mode: e.readOnly ? "display" : "edit",
172
- onChange: (t) => Q(e.key, t),
174
+ onChange: (t) => $(e.key, t),
173
175
  refs: N,
174
176
  disabled: e.readOnly,
175
177
  t: H
176
- }) : /* @__PURE__ */ S(h, {
178
+ }) : /* @__PURE__ */ C(g, {
177
179
  field: e.field,
178
180
  fieldName: e.key,
179
181
  label: e.label,
180
- value: U[e.key],
181
- record: U,
182
+ value: W[e.key],
183
+ record: W,
182
184
  refs: N,
183
185
  readOnly: e.readOnly,
184
- onCommit: (t) => Q(e.key, t)
186
+ onCommit: (t) => $(e.key, t)
185
187
  })
186
188
  }, e.key))]
187
189
  }),
188
- /* @__PURE__ */ C("div", {
190
+ /* @__PURE__ */ w("div", {
189
191
  style: {
190
192
  display: "flex",
191
193
  padding: "10px 14px",
@@ -194,7 +196,7 @@ function T({ entity: T, entityCode: D, record: O, title: k, recordId: A, avatarN
194
196
  alignItems: "center"
195
197
  },
196
198
  children: [
197
- G && /* @__PURE__ */ C("span", {
199
+ K && /* @__PURE__ */ w("span", {
198
200
  style: {
199
201
  fontSize: 11,
200
202
  color: "var(--warn)",
@@ -202,24 +204,24 @@ function T({ entity: T, entityCode: D, record: O, title: k, recordId: A, avatarN
202
204
  alignItems: "center",
203
205
  gap: 4
204
206
  },
205
- children: [/* @__PURE__ */ S("span", { style: {
207
+ children: [/* @__PURE__ */ C("span", { style: {
206
208
  width: 6,
207
209
  height: 6,
208
210
  borderRadius: 999,
209
211
  background: "var(--warn)"
210
212
  } }), H("list.peek.unsaved", "Unsaved")]
211
213
  }),
212
- /* @__PURE__ */ S("div", {
214
+ /* @__PURE__ */ C("div", {
213
215
  style: {
214
216
  flex: 1,
215
217
  minWidth: 0,
216
218
  display: "flex",
217
219
  justifyContent: "flex-end"
218
220
  },
219
- children: X.length > 0 && /* @__PURE__ */ S(f, {
220
- layout: X,
221
- row: U,
222
- onRun: (e, t) => Z({
221
+ children: Z.length > 0 && /* @__PURE__ */ C(f, {
222
+ layout: Z,
223
+ row: W,
224
+ onRun: (e, t) => Q({
223
225
  code: e,
224
226
  action: t
225
227
  }),
@@ -229,10 +231,10 @@ function T({ entity: T, entityCode: D, record: O, title: k, recordId: A, avatarN
229
231
  ariaLabel: H("list.peek.actions", "Quick peek actions")
230
232
  })
231
233
  }),
232
- /* @__PURE__ */ S(n, {
234
+ /* @__PURE__ */ C(n, {
233
235
  kind: "primary",
234
- icon: /* @__PURE__ */ S(t.edit, { size: 13 }),
235
- onClick: () => B(G ? U : null),
236
+ icon: /* @__PURE__ */ C(t.edit, { size: 13 }),
237
+ onClick: () => B(K ? W : null),
236
238
  children: H("list.peek.open_full", "Open full")
237
239
  })
238
240
  ]
@@ -240,8 +242,8 @@ function T({ entity: T, entityCode: D, record: O, title: k, recordId: A, avatarN
240
242
  ]
241
243
  })] });
242
244
  }
243
- function E({ label: e, children: t }) {
244
- return /* @__PURE__ */ C("div", {
245
+ function D({ label: e, children: t }) {
246
+ return /* @__PURE__ */ w("div", {
245
247
  style: {
246
248
  display: "grid",
247
249
  gridTemplateColumns: "120px 1fr",
@@ -249,15 +251,15 @@ function E({ label: e, children: t }) {
249
251
  padding: "4px 0",
250
252
  borderBottom: "1px solid var(--divider)"
251
253
  },
252
- children: [/* @__PURE__ */ S("div", {
254
+ children: [/* @__PURE__ */ C("div", {
253
255
  style: {
254
256
  fontSize: 11.5,
255
257
  color: "var(--text-3)",
256
258
  fontWeight: 500
257
259
  },
258
260
  children: e
259
- }), /* @__PURE__ */ S("div", { children: t })]
261
+ }), /* @__PURE__ */ C("div", { children: t })]
260
262
  });
261
263
  }
262
264
  //#endregion
263
- export { E as QEField, T as QuickPeek };
265
+ export { D as QEField, E as QuickPeek };