@declarion/react 0.106.0 → 0.109.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 (34) hide show
  1. package/dist-lib/api/agents.js +8 -7
  2. package/dist-lib/api/client.js +48 -49
  3. package/dist-lib/components/agents/AgentChatPanel.impl.js +362 -301
  4. package/dist-lib/components/agents/ChatAttachments.js +144 -0
  5. package/dist-lib/components/agents/transcript-runs.js +1 -1
  6. package/dist-lib/components/chrome/AssociationTabs.js +89 -75
  7. package/dist-lib/components/detail-layout/AssociatedBlock.js +243 -235
  8. package/dist-lib/components/detail-layout/ChildrenCards.js +57 -55
  9. package/dist-lib/components/detail-layout/ChildrenList.js +45 -43
  10. package/dist-lib/components/detail-layout/ChildrenTable.js +93 -91
  11. package/dist-lib/components/detail-layout/ChildrenTimeline.js +160 -155
  12. package/dist-lib/components/detail-layout/widgets/EntityScorecardWidget.js +127 -121
  13. package/dist-lib/components/fields/RefCombobox.js +53 -48
  14. package/dist-lib/components/fields/index.js +1 -0
  15. package/dist-lib/components/file-widgets/useFileSelection.js +152 -0
  16. package/dist-lib/components/pages/SmartDetailPage.impl.js +506 -482
  17. package/dist-lib/components/pages/SmartRecordListPage.impl.js +335 -300
  18. package/dist-lib/components/pages/tenant-params/TenantParamsPage.impl.js +112 -109
  19. package/dist-lib/components/params/ParamsBlock.js +18 -15
  20. package/dist-lib/components/params/param-editors.js +60 -54
  21. package/dist-lib/components/primitives/RetryButton.js +14 -0
  22. package/dist-lib/components/primitives/StatTile.js +42 -34
  23. package/dist-lib/hooks/useAgentConversation.js +18 -13
  24. package/dist-lib/hooks/useParams.js +54 -52
  25. package/dist-lib/hooks/useSchema.js +5 -2
  26. package/dist-lib/hooks/useTimelineData.js +26 -24
  27. package/dist-lib/index.d.ts +89 -5
  28. package/dist-lib/index.js +95 -93
  29. package/dist-lib/lib/read-display-state.js +19 -0
  30. package/dist-lib/stores/auth.js +1 -0
  31. package/dist-lib/testing.d.ts +1 -1
  32. package/dist-lib/types/fieldType.js +1 -1
  33. package/dist-lib/{useResponsiveMode-ECv1AEhv.d.ts → useResponsiveMode-DODbtSrY.d.ts} +3 -0
  34. package/package.json +1 -1
@@ -2,76 +2,78 @@ import { coerceDisplayString as e } from "../../lib/display-value.js";
2
2
  import { fieldDisplayName as t } from "../../types/schema.js";
3
3
  import { Pill as n } from "../primitives/Pill.js";
4
4
  import { useText as r } from "../../hooks/useText.js";
5
- import { useChildrenData as i } from "../../hooks/useChildrenData.js";
6
- import { renderField as a } from "../fields/index.js";
7
- import { QuickAddForm as o } from "./QuickAddForm.js";
8
- import { jsx as s, jsxs as c } from "react/jsx-runtime";
5
+ import { RetryButton as i } from "../primitives/RetryButton.js";
6
+ import { readDisplayState as a } from "../../lib/read-display-state.js";
7
+ import { useChildrenData as o } from "../../hooks/useChildrenData.js";
8
+ import { renderField as s } from "../fields/index.js";
9
+ import { QuickAddForm as c } from "./QuickAddForm.js";
10
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
9
11
  //#region src/components/detail-layout/ChildrenCards.tsx
10
- function l({ config: l, parentEntity: u, parentId: d, schema: f }) {
11
- let p = f.entities[l.entity], m = r(), h = r("errors"), { data: g, isLoading: _, isError: v } = i(u, d, l.entity, l.foreign_key, l.sort, l.limit), y = g?.data ?? [], b = g?.$refs, x = l.columns, S = l.cards, C = S?.header_field ?? x[0], w = S?.badge_field, T = S?.columns_count ?? 3;
12
- if (!p) return null;
13
- let E = {
12
+ function d({ config: d, parentEntity: f, parentId: p, schema: m }) {
13
+ let h = m.entities[d.entity], g = r(), _ = r("errors"), v = o(f, p, d.entity, d.foreign_key, d.sort, d.limit), y = v.data, b = a(v), x = y?.data ?? [], S = y?.$refs, C = d.columns, w = d.cards, T = w?.header_field ?? C[0], E = w?.badge_field, D = w?.columns_count ?? 3;
14
+ if (!h) return null;
15
+ let O = {
14
16
  display: "grid",
15
- gridTemplateColumns: `repeat(auto-fill, minmax(${T >= 4 ? 180 : 240}px, 1fr))`,
17
+ gridTemplateColumns: `repeat(auto-fill, minmax(${D >= 4 ? 180 : 240}px, 1fr))`,
16
18
  gap: 12
17
- }, D = /* @__PURE__ */ s(o, {
18
- config: l,
19
- parentEntity: u,
20
- parentId: d,
21
- schema: f
19
+ }, k = /* @__PURE__ */ l(c, {
20
+ config: d,
21
+ parentEntity: f,
22
+ parentId: p,
23
+ schema: m
22
24
  });
23
- if (v) return /* @__PURE__ */ c("div", { children: [D, /* @__PURE__ */ c("div", {
25
+ if (b.error) return /* @__PURE__ */ u("div", { children: [k, /* @__PURE__ */ u("div", {
24
26
  style: {
25
27
  fontSize: 12.5,
26
28
  color: "var(--danger)",
27
29
  padding: "8px 0"
28
30
  },
29
31
  children: [
30
- h("record.related_rows_unreadable", "The related records could not be loaded."),
32
+ _("record.related_rows_unreadable", "The related records could not be loaded."),
31
33
  " ",
32
- m("record.related.try_again", "Try again.")
34
+ /* @__PURE__ */ l(i, { onRetry: b.retry })
33
35
  ]
34
36
  })] });
35
- if (_) return /* @__PURE__ */ c("div", { children: [D, /* @__PURE__ */ s("div", {
36
- style: E,
37
+ if (b.loading) return /* @__PURE__ */ u("div", { children: [k, /* @__PURE__ */ l("div", {
38
+ style: O,
37
39
  children: [
38
40
  0,
39
41
  1,
40
42
  2
41
- ].map((e) => /* @__PURE__ */ s("div", { style: {
43
+ ].map((e) => /* @__PURE__ */ l("div", { style: {
42
44
  height: 96,
43
45
  background: "var(--surface-3)",
44
46
  borderRadius: "var(--radius-lg)"
45
47
  } }, e))
46
48
  })] });
47
- if (y.length === 0) return /* @__PURE__ */ c("div", { children: [D, /* @__PURE__ */ s("div", {
49
+ if (x.length === 0) return /* @__PURE__ */ u("div", { children: [k, /* @__PURE__ */ l("div", {
48
50
  style: {
49
51
  fontSize: 12.5,
50
52
  color: "var(--text-3)",
51
53
  padding: "12px 0"
52
54
  },
53
- children: m("record.related.empty", "No records yet.")
55
+ children: g("record.related.empty", "No records yet.")
54
56
  })] });
55
- let O = x.filter((e) => e !== C && e !== w);
56
- return /* @__PURE__ */ c("div", { children: [D, /* @__PURE__ */ s("div", {
57
- style: E,
58
- children: y.map((r, i) => /* @__PURE__ */ c("div", {
57
+ let A = C.filter((e) => e !== T && e !== E);
58
+ return /* @__PURE__ */ u("div", { children: [k, /* @__PURE__ */ l("div", {
59
+ style: O,
60
+ children: x.map((r, i) => /* @__PURE__ */ u("div", {
59
61
  style: {
60
62
  background: "var(--surface)",
61
63
  border: "1px solid var(--border)",
62
64
  borderRadius: "var(--radius-lg)",
63
65
  overflow: "hidden"
64
66
  },
65
- children: [/* @__PURE__ */ c("div", {
67
+ children: [/* @__PURE__ */ u("div", {
66
68
  style: {
67
69
  padding: "10px 14px",
68
70
  display: "flex",
69
71
  alignItems: "center",
70
72
  justifyContent: "space-between",
71
73
  gap: 8,
72
- borderBottom: O.length > 0 ? "1px solid var(--divider)" : "none"
74
+ borderBottom: A.length > 0 ? "1px solid var(--divider)" : "none"
73
75
  },
74
- children: [/* @__PURE__ */ s("div", {
76
+ children: [/* @__PURE__ */ l("div", {
75
77
  style: {
76
78
  fontSize: 12.5,
77
79
  fontWeight: 600,
@@ -79,64 +81,64 @@ function l({ config: l, parentEntity: u, parentId: d, schema: f }) {
79
81
  textOverflow: "ellipsis",
80
82
  whiteSpace: "nowrap"
81
83
  },
82
- children: C && p.fields.get(C) ? a({
83
- field: p.fields.get(C),
84
- fieldName: C,
85
- value: r[C],
84
+ children: T && h.fields.get(T) ? s({
85
+ field: h.fields.get(T),
86
+ fieldName: T,
87
+ value: r[T],
86
88
  mode: "display",
87
89
  record: r,
88
- refs: b,
89
- t: m
90
- }) : m("record.related.card_title", "Record {number}", { number: i + 1 })
91
- }), w && r[w] != null && /* @__PURE__ */ s(n, {
90
+ refs: S,
91
+ t: g
92
+ }) : g("record.related.card_title", "Record {number}", { number: i + 1 })
93
+ }), E && r[E] != null && /* @__PURE__ */ l(n, {
92
94
  tone: "slate",
93
95
  size: "xs",
94
- children: p.fields.get(w) ? a({
95
- field: p.fields.get(w),
96
- fieldName: w,
97
- value: r[w],
96
+ children: h.fields.get(E) ? s({
97
+ field: h.fields.get(E),
98
+ fieldName: E,
99
+ value: r[E],
98
100
  mode: "display",
99
101
  record: r,
100
- refs: b,
101
- t: m
102
- }) : e(r[w])
102
+ refs: S,
103
+ t: g
104
+ }) : e(r[E])
103
105
  })]
104
- }), O.length > 0 && /* @__PURE__ */ s("div", {
106
+ }), A.length > 0 && /* @__PURE__ */ l("div", {
105
107
  style: {
106
108
  padding: "10px 14px",
107
109
  display: "flex",
108
110
  flexDirection: "column",
109
111
  gap: 4
110
112
  },
111
- children: O.slice(0, 4).map((e) => {
112
- let n = p.fields.get(e);
113
- return n ? /* @__PURE__ */ c("div", {
113
+ children: A.slice(0, 4).map((e) => {
114
+ let n = h.fields.get(e);
115
+ return n ? /* @__PURE__ */ u("div", {
114
116
  style: {
115
117
  display: "flex",
116
118
  alignItems: "baseline",
117
119
  gap: 8,
118
120
  fontSize: 11.5
119
121
  },
120
- children: [/* @__PURE__ */ c("span", {
122
+ children: [/* @__PURE__ */ u("span", {
121
123
  style: {
122
124
  color: "var(--text-3)",
123
125
  flexShrink: 0
124
126
  },
125
- children: [t(m, n, e, f.entities), ":"]
126
- }), /* @__PURE__ */ s("span", {
127
+ children: [t(g, n, e, m.entities), ":"]
128
+ }), /* @__PURE__ */ l("span", {
127
129
  style: {
128
130
  overflow: "hidden",
129
131
  textOverflow: "ellipsis",
130
132
  whiteSpace: "nowrap"
131
133
  },
132
- children: a({
134
+ children: s({
133
135
  field: n,
134
136
  fieldName: e,
135
137
  value: r[e],
136
138
  mode: "display",
137
139
  record: r,
138
- refs: b,
139
- t: m
140
+ refs: S,
141
+ t: g
140
142
  })
141
143
  })]
142
144
  }, e) : null;
@@ -146,4 +148,4 @@ function l({ config: l, parentEntity: u, parentId: d, schema: f }) {
146
148
  })] });
147
149
  }
148
150
  //#endregion
149
- export { l as ChildrenCards };
151
+ export { d as ChildrenCards };
@@ -1,33 +1,35 @@
1
1
  import { coerceDisplayString as e } from "../../lib/display-value.js";
2
2
  import { DISPLAY_KEY as t } from "../../types/schema.js";
3
3
  import { useText as n } from "../../hooks/useText.js";
4
- import { useChildrenData as r } from "../../hooks/useChildrenData.js";
5
- import { renderField as i } from "../fields/index.js";
6
- import { QuickAddForm as a } from "./QuickAddForm.js";
7
- import { jsx as o, jsxs as s } from "react/jsx-runtime";
4
+ import { RetryButton as r } from "../primitives/RetryButton.js";
5
+ import { readDisplayState as i } from "../../lib/read-display-state.js";
6
+ import { useChildrenData as a } from "../../hooks/useChildrenData.js";
7
+ import { renderField as o } from "../fields/index.js";
8
+ import { QuickAddForm as s } from "./QuickAddForm.js";
9
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
8
10
  //#region src/components/detail-layout/ChildrenList.tsx
9
- function c({ config: c, parentEntity: l, parentId: u, schema: d }) {
10
- let f = d.entities[c.entity], p = n(), m = n("errors"), { data: h, isLoading: g, isError: _ } = r(l, u, c.entity, c.foreign_key, c.sort, c.limit), v = h?.data ?? [], y = h?.$refs, b = c.columns;
11
- if (!f) return null;
12
- let x = /* @__PURE__ */ o(a, {
13
- config: c,
14
- parentEntity: l,
15
- parentId: u,
16
- schema: d
11
+ function u({ config: u, parentEntity: d, parentId: f, schema: p }) {
12
+ let m = p.entities[u.entity], h = n(), g = n("errors"), _ = a(d, f, u.entity, u.foreign_key, u.sort, u.limit), v = _.data, y = i(_), b = v?.data ?? [], x = v?.$refs, S = u.columns;
13
+ if (!m) return null;
14
+ let C = /* @__PURE__ */ c(s, {
15
+ config: u,
16
+ parentEntity: d,
17
+ parentId: f,
18
+ schema: p
17
19
  });
18
- if (_) return /* @__PURE__ */ s("div", { children: [x, /* @__PURE__ */ s("div", {
20
+ if (y.error) return /* @__PURE__ */ l("div", { children: [C, /* @__PURE__ */ l("div", {
19
21
  style: {
20
22
  fontSize: 12.5,
21
23
  color: "var(--danger)",
22
24
  padding: "8px 0"
23
25
  },
24
26
  children: [
25
- m("record.related_rows_unreadable", "The related records could not be loaded."),
27
+ g("record.related_rows_unreadable", "The related records could not be loaded."),
26
28
  " ",
27
- p("record.related.try_again", "Try again.")
29
+ /* @__PURE__ */ c(r, { onRetry: y.retry })
28
30
  ]
29
31
  })] });
30
- if (g) return /* @__PURE__ */ s("div", { children: [x, /* @__PURE__ */ s("div", {
32
+ if (y.loading) return /* @__PURE__ */ l("div", { children: [C, /* @__PURE__ */ l("div", {
31
33
  style: {
32
34
  display: "flex",
33
35
  flexDirection: "column",
@@ -35,17 +37,17 @@ function c({ config: c, parentEntity: l, parentId: u, schema: d }) {
35
37
  padding: "8px 0"
36
38
  },
37
39
  children: [
38
- /* @__PURE__ */ o("div", { style: {
40
+ /* @__PURE__ */ c("div", { style: {
39
41
  height: 22,
40
42
  background: "var(--surface-3)",
41
43
  borderRadius: "var(--radius-sm)"
42
44
  } }),
43
- /* @__PURE__ */ o("div", { style: {
45
+ /* @__PURE__ */ c("div", { style: {
44
46
  height: 22,
45
47
  background: "var(--surface-3)",
46
48
  borderRadius: "var(--radius-sm)"
47
49
  } }),
48
- /* @__PURE__ */ o("div", { style: {
50
+ /* @__PURE__ */ c("div", { style: {
49
51
  height: 22,
50
52
  background: "var(--surface-3)",
51
53
  borderRadius: "var(--radius-sm)",
@@ -53,23 +55,23 @@ function c({ config: c, parentEntity: l, parentId: u, schema: d }) {
53
55
  } })
54
56
  ]
55
57
  })] });
56
- if (v.length === 0) return /* @__PURE__ */ s("div", { children: [x, /* @__PURE__ */ o("div", {
58
+ if (b.length === 0) return /* @__PURE__ */ l("div", { children: [C, /* @__PURE__ */ c("div", {
57
59
  style: {
58
60
  fontSize: 12.5,
59
61
  color: "var(--text-3)",
60
62
  padding: "12px 0"
61
63
  },
62
- children: p("record.related.empty", "No records yet.")
64
+ children: h("record.related.empty", "No records yet.")
63
65
  })] });
64
- let S = b.length > 0 ? f.display.display_field ?? b[0] : f.display.display_field;
65
- return /* @__PURE__ */ s("div", { children: [x, /* @__PURE__ */ o("div", {
66
+ let w = S.length > 0 ? m.display.display_field ?? S[0] : m.display.display_field;
67
+ return /* @__PURE__ */ l("div", { children: [C, /* @__PURE__ */ c("div", {
66
68
  style: {
67
69
  display: "flex",
68
70
  flexDirection: "column"
69
71
  },
70
- children: v.map((n, r) => {
71
- let a = typeof n.$display == "string" ? n[t] : "";
72
- return /* @__PURE__ */ o("div", {
72
+ children: b.map((n, r) => {
73
+ let i = typeof n.$display == "string" ? n[t] : "";
74
+ return /* @__PURE__ */ c("div", {
73
75
  style: {
74
76
  display: "flex",
75
77
  alignItems: "center",
@@ -77,30 +79,30 @@ function c({ config: c, parentEntity: l, parentId: u, schema: d }) {
77
79
  padding: "8px 4px",
78
80
  borderBottom: "1px solid var(--divider)"
79
81
  },
80
- children: /* @__PURE__ */ s("div", {
82
+ children: /* @__PURE__ */ l("div", {
81
83
  style: {
82
84
  flex: 1,
83
85
  minWidth: 0
84
86
  },
85
- children: [/* @__PURE__ */ o("div", {
87
+ children: [/* @__PURE__ */ c("div", {
86
88
  style: {
87
89
  fontSize: 12.5,
88
90
  overflow: "hidden",
89
91
  textOverflow: "ellipsis",
90
92
  whiteSpace: "nowrap"
91
93
  },
92
- children: a || (S && f.fields.get(S) ? i({
93
- field: f.fields.get(S),
94
- fieldName: S,
95
- value: n[S],
94
+ children: i || (w && m.fields.get(w) ? o({
95
+ field: m.fields.get(w),
96
+ fieldName: w,
97
+ value: n[w],
96
98
  mode: "display",
97
99
  record: n,
98
- refs: y,
99
- t: p
100
- }) : S && n[S] != null ? e(n[S]) : null)
101
- }), b.length > 1 && (() => {
102
- let e = b.slice(1, 3).filter((e) => n[e] != null);
103
- return e.length === 0 ? null : /* @__PURE__ */ o("div", {
100
+ refs: x,
101
+ t: h
102
+ }) : w && n[w] != null ? e(n[w]) : null)
103
+ }), S.length > 1 && (() => {
104
+ let e = S.slice(1, 3).filter((e) => n[e] != null);
105
+ return e.length === 0 ? null : /* @__PURE__ */ c("div", {
104
106
  style: {
105
107
  fontSize: 11.5,
106
108
  color: "var(--text-3)",
@@ -108,14 +110,14 @@ function c({ config: c, parentEntity: l, parentId: u, schema: d }) {
108
110
  textOverflow: "ellipsis",
109
111
  whiteSpace: "nowrap"
110
112
  },
111
- children: e.map((e, t) => /* @__PURE__ */ s("span", { children: [t > 0 && " · ", f.fields.get(e) ? i({
112
- field: f.fields.get(e),
113
+ children: e.map((e, t) => /* @__PURE__ */ l("span", { children: [t > 0 && " · ", m.fields.get(e) ? o({
114
+ field: m.fields.get(e),
113
115
  fieldName: e,
114
116
  value: n[e],
115
117
  mode: "display",
116
118
  record: n,
117
- refs: y,
118
- t: p
119
+ refs: x,
120
+ t: h
119
121
  }) : String(n[e])] }, e))
120
122
  });
121
123
  })()]
@@ -125,4 +127,4 @@ function c({ config: c, parentEntity: l, parentId: u, schema: d }) {
125
127
  })] });
126
128
  }
127
129
  //#endregion
128
- export { c as ChildrenList };
130
+ export { u as ChildrenList };
@@ -4,54 +4,56 @@ import { Icon as r } from "../primitives/Icons.js";
4
4
  import { IconBtn as i } from "../primitives/IconBtn.js";
5
5
  import { Pill as a } from "../primitives/Pill.js";
6
6
  import { useText as o } from "../../hooks/useText.js";
7
- import { Spinner as s } from "../primitives/Spinner.js";
8
- import { useChildrenData as c } from "../../hooks/useChildrenData.js";
9
- import { useScreenIsLive as l } from "../../stores/realtime.js";
10
- import { resolveCellRenderer as u } from "../fields/cells/registry.js";
11
- import { useOwnRefresh as d } from "../shared/useOwnRefresh.js";
12
- import { dataTableCellStyle as f, dataTableHeadCellStyle as p, dataTableStyle as m } from "../primitives/dataTableStyles.js";
13
- import { findPrimaryKey as h } from "../../lib/child-config.js";
14
- import { QuickAddForm as g } from "./QuickAddForm.js";
15
- import { ManualResizeHandle as _, childLayoutKey as v, useManualColumnResize as y } from "./useManualColumnResize.js";
16
- import { useMemo as b, useRef as x } from "react";
17
- import { jsx as S, jsxs as C } from "react/jsx-runtime";
7
+ import { RetryButton as s } from "../primitives/RetryButton.js";
8
+ import { Spinner as c } from "../primitives/Spinner.js";
9
+ import { readDisplayState as l } from "../../lib/read-display-state.js";
10
+ import { useChildrenData as u } from "../../hooks/useChildrenData.js";
11
+ import { useScreenIsLive as d } from "../../stores/realtime.js";
12
+ import { resolveCellRenderer as f } from "../fields/cells/registry.js";
13
+ import { useOwnRefresh as p } from "../shared/useOwnRefresh.js";
14
+ import { dataTableCellStyle as m, dataTableHeadCellStyle as h, dataTableStyle as g } from "../primitives/dataTableStyles.js";
15
+ import { findPrimaryKey as _ } from "../../lib/child-config.js";
16
+ import { QuickAddForm as v } from "./QuickAddForm.js";
17
+ import { ManualResizeHandle as y, childLayoutKey as b, useManualColumnResize as x } from "./useManualColumnResize.js";
18
+ import { useMemo as S, useRef as C } from "react";
19
+ import { jsx as w, jsxs as T } from "react/jsx-runtime";
18
20
  //#region src/components/detail-layout/ChildrenTable.tsx
19
- function w({ config: w, parentEntity: T, parentId: E, schema: D }) {
20
- let O = o(), k = o("errors"), A = D.entities[w.entity], j = Array.isArray(w.foreign_key) ? w.foreign_key.join(",") : w.foreign_key, M = y(v(T, w.entity, j)), N = l(A?.realtime, w.entity), { data: P, isLoading: F, isError: I, refetch: L } = c(T, E, w.entity, w.foreign_key, w.sort, w.limit), { refreshing: R, refresh: z } = d(L), B = P?.data ?? [], V = P?.$refs, H = x(V);
21
- H.current = V;
22
- let U = w.columns, W = w.interaction === "navigate", G = U[0], K = W && A ? n(void 0, A, D.screens) : null, q = A ? h(A) : void 0, J = b(() => {
21
+ function E({ config: E, parentEntity: D, parentId: O, schema: k }) {
22
+ let A = o(), j = o("errors"), M = k.entities[E.entity], N = Array.isArray(E.foreign_key) ? E.foreign_key.join(",") : E.foreign_key, P = x(b(D, E.entity, N)), F = d(M?.realtime, E.entity), I = u(D, O, E.entity, E.foreign_key, E.sort, E.limit), L = I.data, R = l(I), { refreshing: z, refresh: B } = p(I.refetch), V = L?.data ?? [], H = L?.$refs, U = C(H);
23
+ U.current = H;
24
+ let W = E.columns, G = E.interaction === "navigate", K = W[0], q = G && M ? n(void 0, M, k.screens) : null, J = M ? _(M) : void 0, Y = S(() => {
23
25
  let e = /* @__PURE__ */ new Map();
24
- if (!A) return e;
25
- for (let t of U) {
26
- let n = A.fields.get(t);
27
- n && e.set(t, u({
26
+ if (!M) return e;
27
+ for (let t of W) {
28
+ let n = M.fields.get(t);
29
+ n && e.set(t, f({
28
30
  field: n,
29
31
  fieldName: t,
30
32
  surface: "list",
31
- entity: A,
32
- entityCode: w.entity,
33
- entities: D.entities,
34
- screens: D.screens,
35
- refs: () => H.current,
36
- t: O
33
+ entity: M,
34
+ entityCode: E.entity,
35
+ entities: k.entities,
36
+ screens: k.screens,
37
+ refs: () => U.current,
38
+ t: A
37
39
  }));
38
40
  }
39
41
  return e;
40
42
  }, [
41
- A,
42
- w.entity,
43
- U,
44
- D.entities,
45
- D.screens,
46
- O
43
+ M,
44
+ E.entity,
45
+ W,
46
+ k.entities,
47
+ k.screens,
48
+ A
47
49
  ]);
48
- if (!A) return null;
49
- let Y = /* @__PURE__ */ S(g, {
50
- config: w,
51
- parentEntity: T,
52
- parentId: E,
53
- schema: D
54
- }), X = N ? O("record.related.live", "Live") : O("record.related.paused", "Updates paused"), Z = /* @__PURE__ */ C("div", {
50
+ if (!M) return null;
51
+ let X = /* @__PURE__ */ w(v, {
52
+ config: E,
53
+ parentEntity: D,
54
+ parentId: O,
55
+ schema: k
56
+ }), Z = F ? A("record.related.live", "Live") : A("record.related.paused", "Updates paused"), Q = /* @__PURE__ */ T("div", {
55
57
  style: {
56
58
  display: "flex",
57
59
  alignItems: "center",
@@ -60,56 +62,56 @@ function w({ config: w, parentEntity: T, parentId: E, schema: D }) {
60
62
  justifyContent: "flex-end"
61
63
  },
62
64
  children: [
63
- M.hasWidths && /* @__PURE__ */ S(i, {
64
- icon: /* @__PURE__ */ S(r.columns, { size: 13 }),
65
- title: O("record.related.reset_widths", "Reset column widths (this device)"),
65
+ P.hasWidths && /* @__PURE__ */ w(i, {
66
+ icon: /* @__PURE__ */ w(r.columns, { size: 13 }),
67
+ title: A("record.related.reset_widths", "Reset column widths (this device)"),
66
68
  size: 24,
67
- onClick: M.resetWidths
69
+ onClick: P.resetWidths
68
70
  }),
69
- A.realtime === !0 && /* @__PURE__ */ S("span", {
71
+ M.realtime === !0 && /* @__PURE__ */ w("span", {
70
72
  "data-testid": "children-live-indicator",
71
73
  role: "status",
72
- "aria-label": X,
73
- title: N ? O("record.related.live_hint", "This table updates automatically in realtime.") : O("record.related.paused_hint", "Realtime updates are paused. Refresh manually to load the latest data."),
74
- children: /* @__PURE__ */ S(a, {
75
- tone: N ? "emerald" : "amber",
74
+ "aria-label": Z,
75
+ title: F ? A("record.related.live_hint", "This table updates automatically in realtime.") : A("record.related.paused_hint", "Realtime updates are paused. Refresh manually to load the latest data."),
76
+ children: /* @__PURE__ */ w(a, {
77
+ tone: F ? "emerald" : "amber",
76
78
  size: "xs",
77
79
  dot: !0,
78
- children: X
80
+ children: Z
79
81
  })
80
82
  }),
81
- /* @__PURE__ */ S(i, {
82
- icon: R ? /* @__PURE__ */ S("span", {
83
+ /* @__PURE__ */ w(i, {
84
+ icon: z ? /* @__PURE__ */ w("span", {
83
85
  "data-testid": "children-refresh-spinner",
84
86
  style: { display: "inline-flex" },
85
- children: /* @__PURE__ */ S(s, { size: 13 })
86
- }) : /* @__PURE__ */ S(r.refresh, { size: 13 }),
87
- title: O("record.related.refresh", "Refresh"),
87
+ children: /* @__PURE__ */ w(c, { size: 13 })
88
+ }) : /* @__PURE__ */ w(r.refresh, { size: 13 }),
89
+ title: A("record.related.refresh", "Refresh"),
88
90
  size: 24,
89
- disabled: R,
90
- onClick: z
91
+ disabled: z,
92
+ onClick: B
91
93
  })
92
94
  ]
93
95
  });
94
- return I ? /* @__PURE__ */ C("div", { children: [
95
- Y,
96
- Z,
97
- /* @__PURE__ */ C("div", {
96
+ return R.error ? /* @__PURE__ */ T("div", { children: [
97
+ X,
98
+ Q,
99
+ /* @__PURE__ */ T("div", {
98
100
  style: {
99
101
  fontSize: 12.5,
100
102
  color: "var(--danger)",
101
103
  padding: "8px 0"
102
104
  },
103
105
  children: [
104
- k("record.related_rows_unreadable", "The related records could not be loaded."),
106
+ j("record.related_rows_unreadable", "The related records could not be loaded."),
105
107
  " ",
106
- O("record.related.try_again", "Try again.")
108
+ /* @__PURE__ */ w(s, { onRetry: R.retry })
107
109
  ]
108
110
  })
109
- ] }) : F ? /* @__PURE__ */ C("div", { children: [
110
- Y,
111
- Z,
112
- /* @__PURE__ */ S("div", {
111
+ ] }) : R.loading ? /* @__PURE__ */ T("div", { children: [
112
+ X,
113
+ Q,
114
+ /* @__PURE__ */ w("div", {
113
115
  style: {
114
116
  display: "flex",
115
117
  flexDirection: "column",
@@ -120,47 +122,47 @@ function w({ config: w, parentEntity: T, parentId: E, schema: D }) {
120
122
  0,
121
123
  1,
122
124
  2
123
- ].map((e) => /* @__PURE__ */ S("div", { style: {
125
+ ].map((e) => /* @__PURE__ */ w("div", { style: {
124
126
  height: 32,
125
127
  background: "var(--surface-3)",
126
128
  borderRadius: "var(--radius-sm)"
127
129
  } }, e))
128
130
  })
129
- ] }) : B.length === 0 ? /* @__PURE__ */ C("div", { children: [
130
- Y,
131
- Z,
132
- /* @__PURE__ */ S("div", {
131
+ ] }) : V.length === 0 ? /* @__PURE__ */ T("div", { children: [
132
+ X,
133
+ Q,
134
+ /* @__PURE__ */ w("div", {
133
135
  style: {
134
136
  fontSize: 12.5,
135
137
  color: "var(--text-3)",
136
138
  padding: "12px 0"
137
139
  },
138
- children: O("record.related.empty", "No records yet.")
140
+ children: A("record.related.empty", "No records yet.")
139
141
  })
140
- ] }) : /* @__PURE__ */ C("div", { children: [
141
- Y,
142
- Z,
143
- /* @__PURE__ */ S("div", {
142
+ ] }) : /* @__PURE__ */ T("div", { children: [
143
+ X,
144
+ Q,
145
+ /* @__PURE__ */ w("div", {
144
146
  style: { overflowX: "auto" },
145
- children: /* @__PURE__ */ C("table", {
146
- style: m,
147
- children: [/* @__PURE__ */ S("thead", { children: /* @__PURE__ */ S("tr", { children: U.map((e) => {
148
- let n = A.fields.get(e);
149
- return /* @__PURE__ */ C("th", {
150
- style: M.headerStyle(e, p),
151
- children: [n ? t(O, n, e, D.entities) : e, /* @__PURE__ */ S(_, {
147
+ children: /* @__PURE__ */ T("table", {
148
+ style: g,
149
+ children: [/* @__PURE__ */ w("thead", { children: /* @__PURE__ */ w("tr", { children: W.map((e) => {
150
+ let n = M.fields.get(e);
151
+ return /* @__PURE__ */ T("th", {
152
+ style: P.headerStyle(e, h),
153
+ children: [n ? t(A, n, e, k.entities) : e, /* @__PURE__ */ w(y, {
152
154
  colId: e,
153
- onMouseDown: M.onHandleMouseDown
155
+ onMouseDown: P.onHandleMouseDown
154
156
  })]
155
157
  }, e);
156
- }) }) }), /* @__PURE__ */ S("tbody", { children: B.map((t, n) => {
157
- let r = q ? e(t[q]) : "", i = W && K && r ? K.replace(/:\w+/, r) : void 0;
158
- return /* @__PURE__ */ S("tr", { children: U.map((n) => {
159
- let r = n === G, a = J.get(n), o = a ? a(t[n], t) : e(t[n]);
160
- return /* @__PURE__ */ S("td", {
158
+ }) }) }), /* @__PURE__ */ w("tbody", { children: V.map((t, n) => {
159
+ let r = J ? e(t[J]) : "", i = G && q && r ? q.replace(/:\w+/, r) : void 0;
160
+ return /* @__PURE__ */ w("tr", { children: W.map((n) => {
161
+ let r = n === K, a = Y.get(n), o = a ? a(t[n], t) : e(t[n]);
162
+ return /* @__PURE__ */ w("td", {
161
163
  title: typeof o == "string" ? o : void 0,
162
- style: M.cellStyle(n, f),
163
- children: r && i ? /* @__PURE__ */ S("a", {
164
+ style: P.cellStyle(n, m),
165
+ children: r && i ? /* @__PURE__ */ w("a", {
164
166
  href: i,
165
167
  style: {
166
168
  color: "var(--accent-text)",
@@ -179,4 +181,4 @@ function w({ config: w, parentEntity: T, parentId: E, schema: D }) {
179
181
  ] });
180
182
  }
181
183
  //#endregion
182
- export { w as ChildrenTable };
184
+ export { E as ChildrenTable };