@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.
- package/dist-lib/api/agents.js +8 -7
- package/dist-lib/api/client.js +48 -49
- package/dist-lib/components/agents/AgentChatPanel.impl.js +362 -301
- package/dist-lib/components/agents/ChatAttachments.js +144 -0
- package/dist-lib/components/agents/transcript-runs.js +1 -1
- package/dist-lib/components/chrome/AssociationTabs.js +89 -75
- package/dist-lib/components/detail-layout/AssociatedBlock.js +243 -235
- package/dist-lib/components/detail-layout/ChildrenCards.js +57 -55
- package/dist-lib/components/detail-layout/ChildrenList.js +45 -43
- package/dist-lib/components/detail-layout/ChildrenTable.js +93 -91
- package/dist-lib/components/detail-layout/ChildrenTimeline.js +160 -155
- package/dist-lib/components/detail-layout/widgets/EntityScorecardWidget.js +127 -121
- package/dist-lib/components/fields/RefCombobox.js +53 -48
- package/dist-lib/components/fields/index.js +1 -0
- package/dist-lib/components/file-widgets/useFileSelection.js +152 -0
- package/dist-lib/components/pages/SmartDetailPage.impl.js +506 -482
- package/dist-lib/components/pages/SmartRecordListPage.impl.js +335 -300
- package/dist-lib/components/pages/tenant-params/TenantParamsPage.impl.js +112 -109
- package/dist-lib/components/params/ParamsBlock.js +18 -15
- package/dist-lib/components/params/param-editors.js +60 -54
- package/dist-lib/components/primitives/RetryButton.js +14 -0
- package/dist-lib/components/primitives/StatTile.js +42 -34
- package/dist-lib/hooks/useAgentConversation.js +18 -13
- package/dist-lib/hooks/useParams.js +54 -52
- package/dist-lib/hooks/useSchema.js +5 -2
- package/dist-lib/hooks/useTimelineData.js +26 -24
- package/dist-lib/index.d.ts +89 -5
- package/dist-lib/index.js +95 -93
- package/dist-lib/lib/read-display-state.js +19 -0
- package/dist-lib/stores/auth.js +1 -0
- package/dist-lib/testing.d.ts +1 -1
- package/dist-lib/types/fieldType.js +1 -1
- package/dist-lib/{useResponsiveMode-ECv1AEhv.d.ts → useResponsiveMode-DODbtSrY.d.ts} +3 -0
- 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 {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
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
|
|
11
|
-
let
|
|
12
|
-
if (!
|
|
13
|
-
let
|
|
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(${
|
|
17
|
+
gridTemplateColumns: `repeat(auto-fill, minmax(${D >= 4 ? 180 : 240}px, 1fr))`,
|
|
16
18
|
gap: 12
|
|
17
|
-
},
|
|
18
|
-
config:
|
|
19
|
-
parentEntity:
|
|
20
|
-
parentId:
|
|
21
|
-
schema:
|
|
19
|
+
}, k = /* @__PURE__ */ l(c, {
|
|
20
|
+
config: d,
|
|
21
|
+
parentEntity: f,
|
|
22
|
+
parentId: p,
|
|
23
|
+
schema: m
|
|
22
24
|
});
|
|
23
|
-
if (
|
|
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
|
-
|
|
32
|
+
_("record.related_rows_unreadable", "The related records could not be loaded."),
|
|
31
33
|
" ",
|
|
32
|
-
|
|
34
|
+
/* @__PURE__ */ l(i, { onRetry: b.retry })
|
|
33
35
|
]
|
|
34
36
|
})] });
|
|
35
|
-
if (
|
|
36
|
-
style:
|
|
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__ */
|
|
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 (
|
|
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:
|
|
55
|
+
children: g("record.related.empty", "No records yet.")
|
|
54
56
|
})] });
|
|
55
|
-
let
|
|
56
|
-
return /* @__PURE__ */
|
|
57
|
-
style:
|
|
58
|
-
children:
|
|
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__ */
|
|
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:
|
|
74
|
+
borderBottom: A.length > 0 ? "1px solid var(--divider)" : "none"
|
|
73
75
|
},
|
|
74
|
-
children: [/* @__PURE__ */
|
|
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:
|
|
83
|
-
field:
|
|
84
|
-
fieldName:
|
|
85
|
-
value: r[
|
|
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:
|
|
89
|
-
t:
|
|
90
|
-
}) :
|
|
91
|
-
}),
|
|
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:
|
|
95
|
-
field:
|
|
96
|
-
fieldName:
|
|
97
|
-
value: r[
|
|
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:
|
|
101
|
-
t:
|
|
102
|
-
}) : e(r[
|
|
102
|
+
refs: S,
|
|
103
|
+
t: g
|
|
104
|
+
}) : e(r[E])
|
|
103
105
|
})]
|
|
104
|
-
}),
|
|
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:
|
|
112
|
-
let n =
|
|
113
|
-
return n ? /* @__PURE__ */
|
|
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__ */
|
|
122
|
+
children: [/* @__PURE__ */ u("span", {
|
|
121
123
|
style: {
|
|
122
124
|
color: "var(--text-3)",
|
|
123
125
|
flexShrink: 0
|
|
124
126
|
},
|
|
125
|
-
children: [t(
|
|
126
|
-
}), /* @__PURE__ */
|
|
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:
|
|
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:
|
|
139
|
-
t:
|
|
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 {
|
|
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 {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
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
|
|
10
|
-
let
|
|
11
|
-
if (!
|
|
12
|
-
let
|
|
13
|
-
config:
|
|
14
|
-
parentEntity:
|
|
15
|
-
parentId:
|
|
16
|
-
schema:
|
|
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 (
|
|
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
|
-
|
|
27
|
+
g("record.related_rows_unreadable", "The related records could not be loaded."),
|
|
26
28
|
" ",
|
|
27
|
-
|
|
29
|
+
/* @__PURE__ */ c(r, { onRetry: y.retry })
|
|
28
30
|
]
|
|
29
31
|
})] });
|
|
30
|
-
if (
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
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 (
|
|
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:
|
|
64
|
+
children: h("record.related.empty", "No records yet.")
|
|
63
65
|
})] });
|
|
64
|
-
let
|
|
65
|
-
return /* @__PURE__ */
|
|
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:
|
|
71
|
-
let
|
|
72
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
82
|
+
children: /* @__PURE__ */ l("div", {
|
|
81
83
|
style: {
|
|
82
84
|
flex: 1,
|
|
83
85
|
minWidth: 0
|
|
84
86
|
},
|
|
85
|
-
children: [/* @__PURE__ */
|
|
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:
|
|
93
|
-
field:
|
|
94
|
-
fieldName:
|
|
95
|
-
value: n[
|
|
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:
|
|
99
|
-
t:
|
|
100
|
-
}) :
|
|
101
|
-
}),
|
|
102
|
-
let e =
|
|
103
|
-
return e.length === 0 ? null : /* @__PURE__ */
|
|
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__ */
|
|
112
|
-
field:
|
|
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:
|
|
118
|
-
t:
|
|
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 {
|
|
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 {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
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
|
|
20
|
-
let
|
|
21
|
-
|
|
22
|
-
let
|
|
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 (!
|
|
25
|
-
for (let t of
|
|
26
|
-
let n =
|
|
27
|
-
n && e.set(t,
|
|
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:
|
|
32
|
-
entityCode:
|
|
33
|
-
entities:
|
|
34
|
-
screens:
|
|
35
|
-
refs: () =>
|
|
36
|
-
t:
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
M,
|
|
44
|
+
E.entity,
|
|
45
|
+
W,
|
|
46
|
+
k.entities,
|
|
47
|
+
k.screens,
|
|
48
|
+
A
|
|
47
49
|
]);
|
|
48
|
-
if (!
|
|
49
|
-
let
|
|
50
|
-
config:
|
|
51
|
-
parentEntity:
|
|
52
|
-
parentId:
|
|
53
|
-
schema:
|
|
54
|
-
}),
|
|
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
|
-
|
|
64
|
-
icon: /* @__PURE__ */
|
|
65
|
-
title:
|
|
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:
|
|
69
|
+
onClick: P.resetWidths
|
|
68
70
|
}),
|
|
69
|
-
|
|
71
|
+
M.realtime === !0 && /* @__PURE__ */ w("span", {
|
|
70
72
|
"data-testid": "children-live-indicator",
|
|
71
73
|
role: "status",
|
|
72
|
-
"aria-label":
|
|
73
|
-
title:
|
|
74
|
-
children: /* @__PURE__ */
|
|
75
|
-
tone:
|
|
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:
|
|
80
|
+
children: Z
|
|
79
81
|
})
|
|
80
82
|
}),
|
|
81
|
-
/* @__PURE__ */
|
|
82
|
-
icon:
|
|
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__ */
|
|
86
|
-
}) : /* @__PURE__ */
|
|
87
|
-
title:
|
|
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:
|
|
90
|
-
onClick:
|
|
91
|
+
disabled: z,
|
|
92
|
+
onClick: B
|
|
91
93
|
})
|
|
92
94
|
]
|
|
93
95
|
});
|
|
94
|
-
return
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
/* @__PURE__ */
|
|
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
|
-
|
|
106
|
+
j("record.related_rows_unreadable", "The related records could not be loaded."),
|
|
105
107
|
" ",
|
|
106
|
-
|
|
108
|
+
/* @__PURE__ */ w(s, { onRetry: R.retry })
|
|
107
109
|
]
|
|
108
110
|
})
|
|
109
|
-
] }) :
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
/* @__PURE__ */
|
|
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__ */
|
|
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
|
-
] }) :
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
/* @__PURE__ */
|
|
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:
|
|
140
|
+
children: A("record.related.empty", "No records yet.")
|
|
139
141
|
})
|
|
140
|
-
] }) : /* @__PURE__ */
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
/* @__PURE__ */
|
|
142
|
+
] }) : /* @__PURE__ */ T("div", { children: [
|
|
143
|
+
X,
|
|
144
|
+
Q,
|
|
145
|
+
/* @__PURE__ */ w("div", {
|
|
144
146
|
style: { overflowX: "auto" },
|
|
145
|
-
children: /* @__PURE__ */
|
|
146
|
-
style:
|
|
147
|
-
children: [/* @__PURE__ */
|
|
148
|
-
let n =
|
|
149
|
-
return /* @__PURE__ */
|
|
150
|
-
style:
|
|
151
|
-
children: [n ? t(
|
|
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:
|
|
155
|
+
onMouseDown: P.onHandleMouseDown
|
|
154
156
|
})]
|
|
155
157
|
}, e);
|
|
156
|
-
}) }) }), /* @__PURE__ */
|
|
157
|
-
let r =
|
|
158
|
-
return /* @__PURE__ */
|
|
159
|
-
let r = n ===
|
|
160
|
-
return /* @__PURE__ */
|
|
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:
|
|
163
|
-
children: r && i ? /* @__PURE__ */
|
|
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 {
|
|
184
|
+
export { E as ChildrenTable };
|