@declarion/react 0.57.0 → 0.59.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/README.md +0 -2
- package/dist-lib/AgentChatPanel.impl-DBH1Ff4G.js +1200 -0
- package/dist-lib/DetailAuditStrip-GNRA_eP5.js +289 -0
- package/dist-lib/{DraggableChildrenTable-BV5sb8Uo.js → DraggableChildrenTable-4RZC351U.js} +87 -86
- package/dist-lib/Grid-CQabaBLx.js +405 -0
- package/dist-lib/{LayoutRenderer-C9AH9cXf.js → LayoutRenderer-DGKWZKpW.js} +1000 -1114
- package/dist-lib/{ListCardsBody-DXcDg536.js → ListCardsBody-DfGmyNIu.js} +84 -84
- package/dist-lib/MarkdownRenderer-BDbzDv_y.js +87 -0
- package/dist-lib/{RefreshControl-CNtN8zSl.js → RefreshControl-Bhoib0ZA.js} +126 -155
- package/dist-lib/SmartDetailPage.impl-Ds2RGg6K.js +1565 -0
- package/dist-lib/SmartListPage.impl-BrZLE_Gb.js +3046 -0
- package/dist-lib/{SmartRecordListPage.impl-Bkl9aZJ8.js → SmartRecordListPage.impl-C1FJLr80.js} +281 -280
- package/dist-lib/SortHeaderMenu-Cijxk4cX.js +107 -0
- package/dist-lib/action-dispatch-DY0c8U81.js +1967 -0
- package/dist-lib/api/client.d.ts +5 -0
- package/dist-lib/api/data.d.ts +2 -4
- package/dist-lib/api/entities.d.ts +8 -15
- package/dist-lib/api/events.d.ts +3 -3
- package/dist-lib/cardProjection-Bkl2SSYz.js +499 -0
- package/dist-lib/components/actions/ResponsiveActionBar.d.ts +17 -16
- package/dist-lib/components/agents/AgentChatPanel.d.ts +3 -13
- package/dist-lib/components/agents/AgentChatPanel.impl.d.ts +14 -0
- package/dist-lib/components/agents/AgentPicker.d.ts +1 -2
- package/dist-lib/components/chrome/PageShell.d.ts +7 -0
- package/dist-lib/components/chrome/RecordHeader.d.ts +1 -2
- package/dist-lib/components/detail-layout/DetailAuditStrip.d.ts +1 -2
- package/dist-lib/components/detail-layout/DetailHighlights.d.ts +1 -2
- package/dist-lib/components/detail-layout/blockMeta.d.ts +2 -1
- package/dist-lib/components/fields/BoolField.d.ts +1 -1
- package/dist-lib/components/fields/EnumField.d.ts +1 -1
- package/dist-lib/components/fields/IntArrayField.d.ts +1 -1
- package/dist-lib/components/fields/MultilangArrayField.d.ts +2 -0
- package/dist-lib/components/fields/MultilangField.d.ts +1 -1
- package/dist-lib/components/fields/MultilangTextField.d.ts +1 -1
- package/dist-lib/components/fields/NumberField.d.ts +1 -1
- package/dist-lib/components/fields/PasswordField.d.ts +1 -1
- package/dist-lib/components/fields/RefCombobox.d.ts +1 -1
- package/dist-lib/components/fields/SecretField.d.ts +1 -1
- package/dist-lib/components/fields/StringArrayField.d.ts +1 -1
- package/dist-lib/components/fields/TimestampField.d.ts +1 -1
- package/dist-lib/components/fields/cells/registry.d.ts +2 -1
- package/dist-lib/components/fields/index.d.ts +2 -1
- package/dist-lib/components/fields/langMap.d.ts +2 -0
- package/dist-lib/components/fields/secretValue.d.ts +2 -0
- package/dist-lib/components/file-widgets/UnknownFileWidget.d.ts +3 -0
- package/dist-lib/components/file-widgets/UploadFailureText.d.ts +4 -0
- package/dist-lib/components/file-widgets/helpers.d.ts +1 -1
- package/dist-lib/components/file-widgets/host.d.ts +4 -3
- package/dist-lib/components/file-widgets/types.d.ts +1 -0
- package/dist-lib/components/file-widgets/upload.d.ts +18 -3
- package/dist-lib/components/filters/filter-op-label.d.ts +3 -0
- package/dist-lib/components/layout/ImpersonationBanner.d.ts +1 -1
- package/dist-lib/components/layout/ImpersonationFrame.d.ts +1 -1
- package/dist-lib/components/layout/Layout.d.ts +2 -1
- package/dist-lib/components/layout/Sidebar.d.ts +2 -1
- package/dist-lib/components/layout/TenantChip.d.ts +1 -1
- package/dist-lib/components/list/ViewSwitcher.d.ts +4 -2
- package/dist-lib/components/pages/DocumentsMenu.d.ts +1 -2
- package/dist-lib/components/pages/ExportMenu.d.ts +3 -5
- package/dist-lib/components/pages/RecordDocumentsPanel.d.ts +1 -2
- package/dist-lib/components/pages/auth/AuthShell.d.ts +4 -31
- package/dist-lib/components/pages/exportRequest.d.ts +4 -6
- package/dist-lib/components/pages/list/DeleteViewDialog.d.ts +8 -0
- package/dist-lib/components/pages/list/ListCardRow.d.ts +1 -2
- package/dist-lib/components/pages/list/ListCardsBody.d.ts +0 -1
- package/dist-lib/components/pages/list/ListFloatbar.d.ts +2 -2
- package/dist-lib/components/pages/list/ListHeader.d.ts +2 -2
- package/dist-lib/components/pages/list/ListNoRows.d.ts +4 -5
- package/dist-lib/components/pages/list/ListToolbar.d.ts +3 -2
- package/dist-lib/components/pages/list/ListUrlBanner.d.ts +10 -0
- package/dist-lib/components/pages/list/RowActionsCell.d.ts +2 -4
- package/dist-lib/components/pages/list/RowContextMenu.d.ts +1 -2
- package/dist-lib/components/pages/list/columns.d.ts +2 -1
- package/dist-lib/components/pages/list/filter-meta.d.ts +2 -1
- package/dist-lib/components/pages/list/useActiveView.d.ts +38 -0
- package/dist-lib/components/pages/list/useListColumnLayout.d.ts +6 -5
- package/dist-lib/components/pages/list/useListQuery.d.ts +4 -4
- package/dist-lib/components/pages/list/useListSort.d.ts +5 -4
- package/dist-lib/components/pages/list/useListViews.d.ts +18 -8
- package/dist-lib/components/pages/list/useRowMenu.d.ts +2 -3
- package/dist-lib/components/pages/profile/Profile.d.ts +3 -0
- package/dist-lib/components/params/ParamsBlock.d.ts +1 -13
- package/dist-lib/components/params/param-editors.d.ts +3 -11
- package/dist-lib/components/primitives/ClassifiedFieldLocked.d.ts +1 -2
- package/dist-lib/components/shared/DynamicIcon.d.ts +2 -2
- package/dist-lib/components/shared/LoadingSkeleton.d.ts +1 -0
- package/dist-lib/components/shared/LucideIcon.d.ts +1 -1
- package/dist-lib/components/shared/useOwnRefresh.d.ts +1 -1
- package/dist-lib/declarion-react.css +1 -1
- package/dist-lib/embed/theme.d.ts +1 -1
- package/dist-lib/embed/useEmbedNavigate.d.ts +1 -1
- package/dist-lib/failure-v-uGSpbX.js +158 -0
- package/dist-lib/{field-classification-D6xQYn-h.js → field-classification-C28XE-_P.js} +514 -307
- package/dist-lib/format-count-DA4wmmWR.js +1771 -0
- package/dist-lib/hooks/useEntityData.d.ts +1 -1
- package/dist-lib/hooks/useFilters.d.ts +7 -5
- package/dist-lib/hooks/useLanguage.d.ts +4 -0
- package/dist-lib/hooks/useParams.d.ts +4 -51
- package/dist-lib/hooks/useRegisterScreenTab.d.ts +1 -1
- package/dist-lib/hooks/useSSE.d.ts +3 -3
- package/dist-lib/hooks/useTabTitle.d.ts +2 -0
- package/dist-lib/hooks/useText.d.ts +3 -3
- package/dist-lib/hooks/useVersionWatcher.d.ts +1 -1
- package/dist-lib/hooks/useViews.d.ts +20 -0
- package/dist-lib/index.d.ts +8 -7
- package/dist-lib/index.js +2716 -5795
- package/dist-lib/lib/action-dispatch.d.ts +2 -1
- package/dist-lib/lib/actions.d.ts +30 -42
- package/dist-lib/lib/anchor.d.ts +3 -4
- package/dist-lib/lib/decimal-text.d.ts +1 -0
- package/dist-lib/lib/document-templates.d.ts +1 -2
- package/dist-lib/lib/download.d.ts +2 -1
- package/dist-lib/lib/evidence-verdict.d.ts +2 -1
- package/dist-lib/lib/failure.d.ts +2 -0
- package/dist-lib/lib/field-classification.d.ts +3 -3
- package/dist-lib/lib/filters.d.ts +18 -2
- package/dist-lib/lib/format-count.d.ts +8 -7
- package/dist-lib/lib/language.d.ts +19 -0
- package/dist-lib/lib/mass-edit.d.ts +2 -1
- package/dist-lib/lib/realtime-query-keys.d.ts +1 -1
- package/dist-lib/lib/realtime-reconcile.d.ts +3 -4
- package/dist-lib/lib/screen-back.d.ts +4 -6
- package/dist-lib/lib/sort.d.ts +9 -9
- package/dist-lib/lib/timestamp.d.ts +5 -7
- package/dist-lib/lib/ui-actions.d.ts +2 -1
- package/dist-lib/peekDraftStore-D-cTbiIr.js +199 -0
- package/dist-lib/registry-Cb3W-czW.js +1950 -0
- package/dist-lib/safe-url-oSJw5pzO.js +34 -0
- package/dist-lib/stores/icon-registry.d.ts +2 -2
- package/dist-lib/stores/list-layout.d.ts +3 -4
- package/dist-lib/stores/realtime.d.ts +1 -1
- package/dist-lib/stores/tabs.d.ts +3 -2
- package/dist-lib/testing.d.ts +6 -0
- package/dist-lib/testing.js +98 -76
- package/dist-lib/types/api.d.ts +7 -8
- package/dist-lib/types/fieldType.d.ts +1 -1
- package/dist-lib/types/files.d.ts +4 -4
- package/dist-lib/types/schema.d.ts +44 -50
- package/dist-lib/useAgentConversation-D97IqE-J.js +623 -0
- package/dist-lib/{useCurrentScreen-CzwzQpoW.js → useCurrentScreen-BL5NZFCw.js} +2777 -3768
- package/dist-lib/useListQuery-BG1GyKtJ.js +103 -0
- package/dist-lib/useProperties-4Lg3odrt.js +83 -0
- package/dist-lib/{useTabSearchMirror-C39U85cg.js → useTabSearchMirror-ZVLlINBX.js} +49 -51
- package/dist-lib/useText-BFDCTUSo.js +952 -0
- package/dist-lib/{value-Bo8C8WMU.js → value-By1-WJ8J.js} +74 -76
- package/dist-lib/vite/fingerprint-plugin.d.ts +2 -3
- package/package.json +9 -9
- package/dist-lib/Grid-DWgUPuZ3.js +0 -404
- package/dist-lib/MarkdownRenderer-CcSFc2N3.js +0 -85
- package/dist-lib/RecordIdBadge-CGxPR-8q.js +0 -24
- package/dist-lib/SmartDetailPage.impl-lskCd-WG.js +0 -1846
- package/dist-lib/SmartListPage.impl-CrGbdzyK.js +0 -2854
- package/dist-lib/SortHeaderMenu-SYSAaqQJ.js +0 -106
- package/dist-lib/action-dispatch-CR4ajBtT.js +0 -1985
- package/dist-lib/cardProjection-CW5RIMko.js +0 -699
- package/dist-lib/components/pages/home/HomeStub.d.ts +0 -6
- package/dist-lib/components/pages/jobs/Jobs.d.ts +0 -1
- package/dist-lib/components/pages/pipeline/Pipeline.d.ts +0 -1
- package/dist-lib/format-count-Dobmi-Ji.js +0 -1551
- package/dist-lib/hooks/useUserLocale.d.ts +0 -1
- package/dist-lib/lib/messages.d.ts +0 -12
- package/dist-lib/peekDraftStore-5wQ7lq_V.js +0 -194
- package/dist-lib/registry-CjgUaF7C.js +0 -1768
- package/dist-lib/useListQuery-D7Hr5WM1.js +0 -96
- package/dist-lib/useProperties-CqtCzFCr.js +0 -81
|
@@ -0,0 +1,1950 @@
|
|
|
1
|
+
import { s as e, t } from "./DynamicIcon-DW5krHuX.js";
|
|
2
|
+
import { $ as n, D as r, Et as i, G as a, In as o, L as s, Ln as c, O as l, Ot as u, Pn as d, Q as f, R as p, Rn as m, Tn as h, W as g, X as _, Zt as v, _n as y, en as b, gn as x, hn as S, i as C, jn as w, kt as T, ln as E, nn as D, on as O, q as k, rn as A, rt as j, tt as M, xt as N, yn as P } from "./useCurrentScreen-BL5NZFCw.js";
|
|
3
|
+
import { A as F, M as I, f as L, s as R, t as z } from "./useText-BFDCTUSo.js";
|
|
4
|
+
import { a as B, c as V, f as H, m as U, o as ee, s as te, t as ne, u as W, y as re } from "./failure-v-uGSpbX.js";
|
|
5
|
+
import { N as G } from "./field-classification-C28XE-_P.js";
|
|
6
|
+
import { c as ie, l as ae, o as oe, t as se } from "./action-dispatch-DY0c8U81.js";
|
|
7
|
+
import { n as ce, r as le, t as ue } from "./dataTableStyles-vwD1mVOP.js";
|
|
8
|
+
import { Component as K, createContext as de, useCallback as q, useContext as fe, useEffect as pe, useId as me, useMemo as J, useRef as Y, useState as X } from "react";
|
|
9
|
+
import { QueryClientContext as he, useInfiniteQuery as ge, useQuery as _e, useQueryClient as Z } from "@tanstack/react-query";
|
|
10
|
+
import { Fragment as ve, jsx as Q, jsxs as $ } from "react/jsx-runtime";
|
|
11
|
+
import { clsx as ye } from "clsx";
|
|
12
|
+
import { twMerge as be } from "tailwind-merge";
|
|
13
|
+
//#region src/components/primitives/SectionCard.tsx
|
|
14
|
+
var xe = {
|
|
15
|
+
primary: {
|
|
16
|
+
surface: "var(--surface)",
|
|
17
|
+
shadow: "var(--shadow-xs)"
|
|
18
|
+
},
|
|
19
|
+
secondary: {
|
|
20
|
+
surface: "var(--surface-2)",
|
|
21
|
+
shadow: "none"
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
function Se({ title: t, subtitle: n, right: r, badge: i, count: a, children: s, footer: l, collapsible: u = !0, defaultOpen: d = !0, icon: f, emphasis: p = "primary", headingLevel: m = 2, padding: h = "16px" }) {
|
|
25
|
+
let g = z(), [_, v] = X(d), y = xe[p] ?? xe.primary;
|
|
26
|
+
return /* @__PURE__ */ $("div", {
|
|
27
|
+
"data-emphasis": p,
|
|
28
|
+
style: {
|
|
29
|
+
background: y.surface,
|
|
30
|
+
border: "1px solid var(--border)",
|
|
31
|
+
borderRadius: 10,
|
|
32
|
+
overflow: "hidden",
|
|
33
|
+
boxShadow: y.shadow,
|
|
34
|
+
flexShrink: 0
|
|
35
|
+
},
|
|
36
|
+
children: [
|
|
37
|
+
/* @__PURE__ */ $("div", {
|
|
38
|
+
style: {
|
|
39
|
+
display: "flex",
|
|
40
|
+
alignItems: "center",
|
|
41
|
+
gap: 10,
|
|
42
|
+
padding: "10px 14px",
|
|
43
|
+
borderBottom: _ ? "1px solid var(--divider)" : "none",
|
|
44
|
+
minHeight: 40
|
|
45
|
+
},
|
|
46
|
+
children: [
|
|
47
|
+
/* @__PURE__ */ Q("div", {
|
|
48
|
+
role: "heading",
|
|
49
|
+
"aria-level": m,
|
|
50
|
+
style: {
|
|
51
|
+
display: "flex",
|
|
52
|
+
flex: 1,
|
|
53
|
+
minWidth: 0
|
|
54
|
+
},
|
|
55
|
+
children: /* @__PURE__ */ $("div", {
|
|
56
|
+
role: u ? "button" : void 0,
|
|
57
|
+
tabIndex: u ? 0 : void 0,
|
|
58
|
+
"aria-expanded": u ? _ : void 0,
|
|
59
|
+
onClick: u ? () => v((e) => !e) : void 0,
|
|
60
|
+
onKeyDown: u ? (e) => {
|
|
61
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), v((e) => !e));
|
|
62
|
+
} : void 0,
|
|
63
|
+
style: {
|
|
64
|
+
display: "flex",
|
|
65
|
+
alignItems: "center",
|
|
66
|
+
gap: 8,
|
|
67
|
+
flex: 1,
|
|
68
|
+
minWidth: 0,
|
|
69
|
+
cursor: u ? "pointer" : "default",
|
|
70
|
+
userSelect: "none"
|
|
71
|
+
},
|
|
72
|
+
children: [
|
|
73
|
+
f && /* @__PURE__ */ Q("span", {
|
|
74
|
+
style: {
|
|
75
|
+
color: "var(--text-3)",
|
|
76
|
+
display: "flex",
|
|
77
|
+
flexShrink: 0
|
|
78
|
+
},
|
|
79
|
+
children: f
|
|
80
|
+
}),
|
|
81
|
+
/* @__PURE__ */ Q("div", {
|
|
82
|
+
style: {
|
|
83
|
+
fontSize: 12.5,
|
|
84
|
+
fontWeight: 600,
|
|
85
|
+
color: "var(--text)",
|
|
86
|
+
letterSpacing: "-0.005em",
|
|
87
|
+
overflow: "hidden",
|
|
88
|
+
textOverflow: "ellipsis",
|
|
89
|
+
whiteSpace: "nowrap",
|
|
90
|
+
minWidth: 0
|
|
91
|
+
},
|
|
92
|
+
children: t
|
|
93
|
+
}),
|
|
94
|
+
a !== void 0 && /* @__PURE__ */ Q("span", {
|
|
95
|
+
className: "num",
|
|
96
|
+
style: {
|
|
97
|
+
fontSize: 11,
|
|
98
|
+
fontWeight: 600,
|
|
99
|
+
color: "var(--text-3)",
|
|
100
|
+
background: "var(--surface-3)",
|
|
101
|
+
borderRadius: 999,
|
|
102
|
+
padding: "1px 7px",
|
|
103
|
+
minWidth: 20,
|
|
104
|
+
textAlign: "center",
|
|
105
|
+
flexShrink: 0
|
|
106
|
+
},
|
|
107
|
+
children: a
|
|
108
|
+
}),
|
|
109
|
+
n && /* @__PURE__ */ Q("div", {
|
|
110
|
+
style: {
|
|
111
|
+
fontSize: 11.5,
|
|
112
|
+
color: "var(--text-3)",
|
|
113
|
+
flexShrink: 0,
|
|
114
|
+
borderLeft: "1px solid var(--divider)",
|
|
115
|
+
paddingLeft: 8,
|
|
116
|
+
marginLeft: 2
|
|
117
|
+
},
|
|
118
|
+
children: n
|
|
119
|
+
})
|
|
120
|
+
]
|
|
121
|
+
})
|
|
122
|
+
}),
|
|
123
|
+
i && /* @__PURE__ */ Q(o, {
|
|
124
|
+
tone: i.tone ?? "violet",
|
|
125
|
+
size: "xs",
|
|
126
|
+
dot: i.dot,
|
|
127
|
+
children: i.text
|
|
128
|
+
}),
|
|
129
|
+
r,
|
|
130
|
+
u && /* @__PURE__ */ Q(c, {
|
|
131
|
+
size: 24,
|
|
132
|
+
icon: Q(_ ? e.up : e.down, { size: 14 }),
|
|
133
|
+
onClick: () => v((e) => !e),
|
|
134
|
+
title: _ ? g("control.collapse", "Collapse") : g("control.expand", "Expand")
|
|
135
|
+
})
|
|
136
|
+
]
|
|
137
|
+
}),
|
|
138
|
+
_ && /* @__PURE__ */ Q("div", {
|
|
139
|
+
style: { padding: h },
|
|
140
|
+
children: s
|
|
141
|
+
}),
|
|
142
|
+
l && _ && /* @__PURE__ */ Q("div", {
|
|
143
|
+
style: {
|
|
144
|
+
padding: "8px 14px",
|
|
145
|
+
borderTop: "1px solid var(--divider)",
|
|
146
|
+
background: "var(--surface-2)",
|
|
147
|
+
fontSize: 11.5,
|
|
148
|
+
color: "var(--text-3)"
|
|
149
|
+
},
|
|
150
|
+
children: l
|
|
151
|
+
})
|
|
152
|
+
]
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
//#endregion
|
|
156
|
+
//#region src/components/primitives/ClassifiedFieldLocked.tsx
|
|
157
|
+
function Ce({ tier: t, tierDef: n, requiredPermission: r, variant: i = "value" }) {
|
|
158
|
+
let a = z(), o = a(n?.name) || t, s = r ? a("control.locked.permission_hint", "Locked: requires permission \"{permission}\". Ask your administrator to grant it to your role.", { permission: r }) : a("control.locked.classification_hint", "Locked: {classification} classification — requires explicit grant.", { classification: o });
|
|
159
|
+
return /* @__PURE__ */ $("span", {
|
|
160
|
+
title: s,
|
|
161
|
+
"aria-label": s,
|
|
162
|
+
className: `inline-flex items-center gap-1 text-muted-foreground italic select-none ${i === "input" ? "border border-divider rounded-md px-2 py-1 bg-surface" : ""}`,
|
|
163
|
+
children: [/* @__PURE__ */ Q(e.lock, { size: 12 }), /* @__PURE__ */ Q("span", { children: o })]
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
//#endregion
|
|
167
|
+
//#region src/lib/utils.ts
|
|
168
|
+
function we(...e) {
|
|
169
|
+
return be(ye(e));
|
|
170
|
+
}
|
|
171
|
+
function Te(e) {
|
|
172
|
+
return e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || e.button !== 0;
|
|
173
|
+
}
|
|
174
|
+
//#endregion
|
|
175
|
+
//#region src/components/detail-layout/FieldRow.tsx
|
|
176
|
+
var Ee = 150, De = 560, Oe = 270, ke = "20px", Ae = 4, je = /* @__PURE__ */ new Set([
|
|
177
|
+
"text",
|
|
178
|
+
"rich_text",
|
|
179
|
+
"json",
|
|
180
|
+
"structure",
|
|
181
|
+
"multilang_text",
|
|
182
|
+
"multilang_array"
|
|
183
|
+
]), Me = de({
|
|
184
|
+
columns: 2,
|
|
185
|
+
stackPairs: !1
|
|
186
|
+
});
|
|
187
|
+
function Ne({ columns: e = 2, children: t }) {
|
|
188
|
+
let n = Y(null), [r, i] = X(null);
|
|
189
|
+
pe(() => {
|
|
190
|
+
let e = n.current;
|
|
191
|
+
if (!e || typeof ResizeObserver > "u") return;
|
|
192
|
+
let t = new ResizeObserver(([e]) => {
|
|
193
|
+
i(e.contentRect.width);
|
|
194
|
+
});
|
|
195
|
+
return t.observe(e), () => t.disconnect();
|
|
196
|
+
}, []);
|
|
197
|
+
let a = e === 1 || r !== null && r < De ? 1 : e, o = r === null ? null : (r - (a - 1) * 24) / a, s = o !== null && o < Oe;
|
|
198
|
+
return /* @__PURE__ */ Q(Me.Provider, {
|
|
199
|
+
value: {
|
|
200
|
+
columns: a,
|
|
201
|
+
stackPairs: s
|
|
202
|
+
},
|
|
203
|
+
children: /* @__PURE__ */ Q("div", {
|
|
204
|
+
ref: n,
|
|
205
|
+
style: {
|
|
206
|
+
display: "grid",
|
|
207
|
+
gridTemplateColumns: `repeat(${a}, minmax(0, 1fr))`,
|
|
208
|
+
columnGap: 24,
|
|
209
|
+
rowGap: 2
|
|
210
|
+
},
|
|
211
|
+
children: t
|
|
212
|
+
})
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
function Pe({ label: t, children: n, span: r = !1, required: i, error: a, hint: o, actions: s, copyValue: c, mode: l = "display", htmlFor: d, labelId: f, labelTitle: p, "data-testid": m }) {
|
|
216
|
+
let h = z(), g = fe(Me), _ = r || g.stackPairs, v = !!a;
|
|
217
|
+
return /* @__PURE__ */ $("div", {
|
|
218
|
+
className: "detail-row",
|
|
219
|
+
"data-error": v || void 0,
|
|
220
|
+
"data-testid": m,
|
|
221
|
+
style: {
|
|
222
|
+
display: "flex",
|
|
223
|
+
flexDirection: _ ? "column" : "row",
|
|
224
|
+
gap: _ ? 4 : 16,
|
|
225
|
+
alignItems: _ ? "stretch" : "flex-start",
|
|
226
|
+
padding: "6px 0",
|
|
227
|
+
...r ? { gridColumn: "1 / -1" } : null
|
|
228
|
+
},
|
|
229
|
+
children: [/* @__PURE__ */ $("div", {
|
|
230
|
+
style: {
|
|
231
|
+
width: _ ? "auto" : Ee,
|
|
232
|
+
flexShrink: 0,
|
|
233
|
+
paddingTop: _ ? 0 : Ae,
|
|
234
|
+
fontSize: 12,
|
|
235
|
+
lineHeight: ke,
|
|
236
|
+
fontWeight: 500,
|
|
237
|
+
color: "var(--text-3)",
|
|
238
|
+
display: "flex",
|
|
239
|
+
alignItems: "flex-start",
|
|
240
|
+
gap: 2
|
|
241
|
+
},
|
|
242
|
+
children: [d ? /* @__PURE__ */ Q("label", {
|
|
243
|
+
id: f,
|
|
244
|
+
htmlFor: d,
|
|
245
|
+
title: p || void 0,
|
|
246
|
+
children: t
|
|
247
|
+
}) : /* @__PURE__ */ Q("span", {
|
|
248
|
+
id: f,
|
|
249
|
+
title: p || void 0,
|
|
250
|
+
children: t
|
|
251
|
+
}), i && l === "edit" && /* @__PURE__ */ Q("span", {
|
|
252
|
+
"aria-hidden": "true",
|
|
253
|
+
style: {
|
|
254
|
+
color: "var(--danger)",
|
|
255
|
+
marginLeft: 2
|
|
256
|
+
},
|
|
257
|
+
children: "*"
|
|
258
|
+
})]
|
|
259
|
+
}), /* @__PURE__ */ $("div", {
|
|
260
|
+
style: {
|
|
261
|
+
flex: 1,
|
|
262
|
+
minWidth: 0,
|
|
263
|
+
display: "flex",
|
|
264
|
+
flexDirection: "column",
|
|
265
|
+
gap: 3
|
|
266
|
+
},
|
|
267
|
+
children: [/* @__PURE__ */ $("div", {
|
|
268
|
+
style: {
|
|
269
|
+
display: "flex",
|
|
270
|
+
alignItems: "flex-start",
|
|
271
|
+
gap: 6,
|
|
272
|
+
minHeight: 24
|
|
273
|
+
},
|
|
274
|
+
children: [/* @__PURE__ */ Q("div", {
|
|
275
|
+
style: {
|
|
276
|
+
flex: 1,
|
|
277
|
+
minWidth: 0,
|
|
278
|
+
fontSize: 13,
|
|
279
|
+
lineHeight: ke,
|
|
280
|
+
color: "var(--text)",
|
|
281
|
+
overflowWrap: "anywhere",
|
|
282
|
+
paddingTop: l === "display" && !_ ? Ae : 0
|
|
283
|
+
},
|
|
284
|
+
children: v && l === "edit" ? /* @__PURE__ */ Q("div", {
|
|
285
|
+
style: {
|
|
286
|
+
borderRadius: 6,
|
|
287
|
+
boxShadow: "0 0 0 1.5px var(--danger)"
|
|
288
|
+
},
|
|
289
|
+
children: n
|
|
290
|
+
}) : n
|
|
291
|
+
}), (c || s) && /* @__PURE__ */ $("div", {
|
|
292
|
+
className: "detail-row-action",
|
|
293
|
+
style: {
|
|
294
|
+
display: "flex",
|
|
295
|
+
gap: 2,
|
|
296
|
+
flexShrink: 0,
|
|
297
|
+
marginTop: -2
|
|
298
|
+
},
|
|
299
|
+
children: [c && /* @__PURE__ */ Q(u, {
|
|
300
|
+
value: c,
|
|
301
|
+
size: "sm",
|
|
302
|
+
title: h("record.field.copy_value", "Copy value")
|
|
303
|
+
}), s]
|
|
304
|
+
})]
|
|
305
|
+
}), (v || o != null) && /* @__PURE__ */ $("div", {
|
|
306
|
+
style: {
|
|
307
|
+
fontSize: 11.5,
|
|
308
|
+
lineHeight: 1.4,
|
|
309
|
+
color: v ? "var(--danger)" : "var(--text-3)",
|
|
310
|
+
display: "flex",
|
|
311
|
+
alignItems: "center",
|
|
312
|
+
gap: 4
|
|
313
|
+
},
|
|
314
|
+
children: [v && /* @__PURE__ */ Q(e.warning, { size: 11 }), /* @__PURE__ */ Q("span", { children: v ? a : o })]
|
|
315
|
+
})]
|
|
316
|
+
})]
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
//#endregion
|
|
320
|
+
//#region src/hooks/useObject.ts
|
|
321
|
+
function Fe(e, t) {
|
|
322
|
+
return [
|
|
323
|
+
"entity-item",
|
|
324
|
+
e,
|
|
325
|
+
t === void 0 || t === "new" ? void 0 : typeof t == "string" ? t : Object.keys(t).sort().map((e) => [e, t[e]])
|
|
326
|
+
];
|
|
327
|
+
}
|
|
328
|
+
function Ie(e, t) {
|
|
329
|
+
let n = Fe(e, t), r = n[2];
|
|
330
|
+
return _e({
|
|
331
|
+
queryKey: n,
|
|
332
|
+
queryFn: () => H(e, t),
|
|
333
|
+
enabled: !!e && !!t && t !== "new" && r !== void 0
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
//#endregion
|
|
337
|
+
//#region src/hooks/useAssociatedData.ts
|
|
338
|
+
function Le(e, t, n, i, a, o, s, c) {
|
|
339
|
+
let l = c ? JSON.stringify(Object.entries(c).sort()) : void 0;
|
|
340
|
+
return ge({
|
|
341
|
+
queryKey: [
|
|
342
|
+
r,
|
|
343
|
+
e,
|
|
344
|
+
t,
|
|
345
|
+
n,
|
|
346
|
+
a,
|
|
347
|
+
o,
|
|
348
|
+
s,
|
|
349
|
+
l
|
|
350
|
+
],
|
|
351
|
+
queryFn: ({ pageParam: e }) => {
|
|
352
|
+
let r = new URLSearchParams(), l = [{
|
|
353
|
+
field: i,
|
|
354
|
+
op: "eq",
|
|
355
|
+
value: t
|
|
356
|
+
}];
|
|
357
|
+
if (c) for (let [e, t] of Object.entries(c)) t && t !== "__all__" && l.push({
|
|
358
|
+
field: e,
|
|
359
|
+
op: "eq",
|
|
360
|
+
value: t
|
|
361
|
+
});
|
|
362
|
+
return r.set("filters", JSON.stringify(l)), a && r.set("sort", a), o && r.set("limit", String(o)), s && r.set("search", s), e && r.set("after", e), I(`/api/data/${n}?${r.toString()}`);
|
|
363
|
+
},
|
|
364
|
+
getNextPageParam: (e) => e.meta?.has_more ? e.meta.cursor : void 0,
|
|
365
|
+
initialPageParam: void 0,
|
|
366
|
+
enabled: !!e && !!t && !!n && !!i
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
//#endregion
|
|
370
|
+
//#region src/components/actions/ActionButton.tsx
|
|
371
|
+
function Re({ actionCode: n, action: r, entityCode: i, objectIds: a = [], row: o, variant: l = "outline", size: u = "default", onSuccess: d }) {
|
|
372
|
+
let h = z(), g = z("errors"), [v, y] = X(!1), [b, x] = X(!1), { data: S } = L(), w = G(), { run: E } = C(), D = f(r), O = !o || k(r.conditions, o), A = q(async () => {
|
|
373
|
+
if (r.association && a.length !== 0) {
|
|
374
|
+
y(!0);
|
|
375
|
+
try {
|
|
376
|
+
let e = i ? `${i}.${r.association}` : r.association, t = await U(e, a), n = _(S, t.target_entity);
|
|
377
|
+
if (!n) {
|
|
378
|
+
T.error(g("action.list_screen_missing", "No list screen is declared for this entity."), t.target_entity);
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
let o = S?.entities[t.target_entity], s = h(r.display?.name) || t.target_entity;
|
|
382
|
+
if (t.ids.length === 0) {
|
|
383
|
+
T.info(h("action.association.none_related", "No related {name} found", { name: s }));
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
let c = o?.fields.names().find((e) => o.fields.get(e)?.primary) ?? "id", l = new URLSearchParams();
|
|
387
|
+
l.set(`filter_${c}`, t.ids.join(",")), w(n.route, {
|
|
388
|
+
title: s,
|
|
389
|
+
icon: r.display?.icon || n.icon,
|
|
390
|
+
search: l.toString()
|
|
391
|
+
}), d?.();
|
|
392
|
+
} catch (e) {
|
|
393
|
+
T.error(ne(g, e));
|
|
394
|
+
} finally {
|
|
395
|
+
y(!1);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}, [
|
|
399
|
+
h,
|
|
400
|
+
g,
|
|
401
|
+
r,
|
|
402
|
+
i,
|
|
403
|
+
a,
|
|
404
|
+
S,
|
|
405
|
+
w,
|
|
406
|
+
d
|
|
407
|
+
]), j = r.entity ? `${r.entity}.${n}` : n, N = a.length > 0 ? a : void 0, P = q(() => {
|
|
408
|
+
x(!0), E({
|
|
409
|
+
action: r,
|
|
410
|
+
title: h(r.display?.name) || n,
|
|
411
|
+
row: o,
|
|
412
|
+
entity: i,
|
|
413
|
+
execute: (e) => W(j, B(e, N)),
|
|
414
|
+
onSuccess: () => d?.()
|
|
415
|
+
}).finally(() => x(!1));
|
|
416
|
+
}, [
|
|
417
|
+
h,
|
|
418
|
+
E,
|
|
419
|
+
r,
|
|
420
|
+
n,
|
|
421
|
+
o,
|
|
422
|
+
i,
|
|
423
|
+
j,
|
|
424
|
+
N,
|
|
425
|
+
d
|
|
426
|
+
]), F = q(() => {
|
|
427
|
+
if (p(r)) {
|
|
428
|
+
s(g, r.ui_steps, { row: o }).then(() => d?.());
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
if (D) {
|
|
432
|
+
A();
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
435
|
+
if (r.href && !r.handler && !r.association) {
|
|
436
|
+
let e = i ? S?.entities[i] : void 0, t = M(o, e), a = r.href;
|
|
437
|
+
i && (a = a.replaceAll("${entity}", i)), t && (a = a.replaceAll("${id}", encodeURIComponent(t))), w(a, {
|
|
438
|
+
title: h(r.display?.name) || n,
|
|
439
|
+
icon: r.display?.icon
|
|
440
|
+
}), d?.();
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
P();
|
|
444
|
+
}, [
|
|
445
|
+
h,
|
|
446
|
+
g,
|
|
447
|
+
r,
|
|
448
|
+
o,
|
|
449
|
+
i,
|
|
450
|
+
S?.entities,
|
|
451
|
+
n,
|
|
452
|
+
w,
|
|
453
|
+
D,
|
|
454
|
+
A,
|
|
455
|
+
P,
|
|
456
|
+
d
|
|
457
|
+
]), I = h(r.display?.name), R = r.display?.icon, V = R && e[R], H = V ? /* @__PURE__ */ Q(V, { size: 13 }) : R ? /* @__PURE__ */ Q(t, {
|
|
458
|
+
name: R,
|
|
459
|
+
size: 13
|
|
460
|
+
}) : null, ee = !O || b || v;
|
|
461
|
+
return u === "icon" ? /* @__PURE__ */ Q(c, {
|
|
462
|
+
icon: H ?? /* @__PURE__ */ Q(e.bolt, { size: 13 }),
|
|
463
|
+
onClick: F,
|
|
464
|
+
title: I
|
|
465
|
+
}) : /* @__PURE__ */ Q(m, {
|
|
466
|
+
kind: l === "default" ? "primary" : l === "ghost" ? "ghost" : "default",
|
|
467
|
+
size: "sm",
|
|
468
|
+
icon: H,
|
|
469
|
+
danger: r.destructive,
|
|
470
|
+
onClick: F,
|
|
471
|
+
disabled: ee,
|
|
472
|
+
title: I,
|
|
473
|
+
"aria-label": I,
|
|
474
|
+
children: I
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
//#endregion
|
|
478
|
+
//#region src/components/actions/RowActionsKebab.tsx
|
|
479
|
+
function ze({ actions: t, objectIds: n, row: r, entity: i, onSuccess: a, preMenu: o, divider: s, size: l = 22, align: u = "end" }) {
|
|
480
|
+
let f = z(), p = Y(null), [m, h] = X(!1), [_, v] = X(null), { run: y } = C(), b = J(() => {
|
|
481
|
+
let e = {};
|
|
482
|
+
for (let { code: n, action: r } of t) e[n] = r;
|
|
483
|
+
return e;
|
|
484
|
+
}, [t]), x = J(() => {
|
|
485
|
+
let e = t.map(({ code: e }) => ({
|
|
486
|
+
kind: "action",
|
|
487
|
+
code: e,
|
|
488
|
+
enabled: !0,
|
|
489
|
+
reason: null
|
|
490
|
+
}));
|
|
491
|
+
return r ? g(f, e, b, void 0, r, [], oe(i, r)) : e;
|
|
492
|
+
}, [
|
|
493
|
+
f,
|
|
494
|
+
t,
|
|
495
|
+
b,
|
|
496
|
+
r,
|
|
497
|
+
i
|
|
498
|
+
]), S = q((e, t) => {
|
|
499
|
+
h(!1);
|
|
500
|
+
let i = t.entity ? `${t.entity}.${e}` : e;
|
|
501
|
+
return y({
|
|
502
|
+
action: t,
|
|
503
|
+
title: f(t.display?.name) || e,
|
|
504
|
+
row: r,
|
|
505
|
+
execute: async (e) => {
|
|
506
|
+
let t = await W(i, B(e, n));
|
|
507
|
+
return a?.(), t;
|
|
508
|
+
}
|
|
509
|
+
});
|
|
510
|
+
}, [
|
|
511
|
+
f,
|
|
512
|
+
y,
|
|
513
|
+
r,
|
|
514
|
+
n,
|
|
515
|
+
a
|
|
516
|
+
]);
|
|
517
|
+
return !o && x.length === 0 ? null : /* @__PURE__ */ $("div", {
|
|
518
|
+
className: "sl-row-actions",
|
|
519
|
+
"data-open": m ? "true" : void 0,
|
|
520
|
+
style: {
|
|
521
|
+
display: "flex",
|
|
522
|
+
alignItems: "center",
|
|
523
|
+
justifyContent: "flex-end"
|
|
524
|
+
},
|
|
525
|
+
children: [/* @__PURE__ */ Q(c, {
|
|
526
|
+
ref: p,
|
|
527
|
+
size: l,
|
|
528
|
+
icon: /* @__PURE__ */ Q(e.more, { size: Math.round(l * .55) }),
|
|
529
|
+
onClick: () => h((e) => !e),
|
|
530
|
+
title: f("action.menu.title", "Actions")
|
|
531
|
+
}), /* @__PURE__ */ $(d, {
|
|
532
|
+
open: m,
|
|
533
|
+
anchor: p.current,
|
|
534
|
+
onClose: () => h(!1),
|
|
535
|
+
width: 200,
|
|
536
|
+
align: u,
|
|
537
|
+
children: [
|
|
538
|
+
o,
|
|
539
|
+
o && s && x.length > 0 && /* @__PURE__ */ Q(A, { divider: !0 }),
|
|
540
|
+
/* @__PURE__ */ Q(ae, {
|
|
541
|
+
layout: x,
|
|
542
|
+
entityActions: b,
|
|
543
|
+
onRun: S,
|
|
544
|
+
loading: _,
|
|
545
|
+
onLoadingChange: v,
|
|
546
|
+
row: r
|
|
547
|
+
})
|
|
548
|
+
]
|
|
549
|
+
})]
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
//#endregion
|
|
553
|
+
//#region src/components/detail-layout/AssociatedToolbar.tsx
|
|
554
|
+
function Be({ entity: t, searchable: n, filterFields: r, searchValue: i, onSearchChange: a, filters: o, onFilterChange: s, allEntities: c }) {
|
|
555
|
+
let l = z(), u = n === !0, d = r && r.length > 0;
|
|
556
|
+
return !u && !d ? null : /* @__PURE__ */ $("div", {
|
|
557
|
+
style: {
|
|
558
|
+
display: "flex",
|
|
559
|
+
alignItems: "center",
|
|
560
|
+
gap: 6,
|
|
561
|
+
marginBottom: 8
|
|
562
|
+
},
|
|
563
|
+
children: [u && /* @__PURE__ */ Q("div", {
|
|
564
|
+
style: {
|
|
565
|
+
flex: 1,
|
|
566
|
+
maxWidth: 220
|
|
567
|
+
},
|
|
568
|
+
children: /* @__PURE__ */ Q(b, {
|
|
569
|
+
value: i,
|
|
570
|
+
onChange: a,
|
|
571
|
+
placeholder: l("record.associated.search", "Search…"),
|
|
572
|
+
prefix: /* @__PURE__ */ Q(e.search, { size: 12 })
|
|
573
|
+
})
|
|
574
|
+
}), d && r.map((e) => {
|
|
575
|
+
let n = t.fields.get(e);
|
|
576
|
+
if (!n) return null;
|
|
577
|
+
let r = o[e] ?? "__all__", i = y(l, n, e, c);
|
|
578
|
+
if (n.type === "ref" && n.ref?.entity) return /* @__PURE__ */ Q(Ve, {
|
|
579
|
+
field: n,
|
|
580
|
+
label: i,
|
|
581
|
+
value: r,
|
|
582
|
+
onChange: (t) => s(e, t)
|
|
583
|
+
}, e);
|
|
584
|
+
if (!n.values) return null;
|
|
585
|
+
let a = [{
|
|
586
|
+
value: "__all__",
|
|
587
|
+
label: l("record.associated.filter_all", "All {name}", { name: i })
|
|
588
|
+
}, ...n.values.map((e) => ({
|
|
589
|
+
value: e.code,
|
|
590
|
+
label: l(e.name) || e.code
|
|
591
|
+
}))];
|
|
592
|
+
return /* @__PURE__ */ Q("div", {
|
|
593
|
+
style: { width: 160 },
|
|
594
|
+
children: /* @__PURE__ */ Q(v, {
|
|
595
|
+
value: r,
|
|
596
|
+
options: a,
|
|
597
|
+
onChange: (t) => s(e, t),
|
|
598
|
+
placeholder: i
|
|
599
|
+
})
|
|
600
|
+
}, e);
|
|
601
|
+
})]
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
function Ve({ field: e, label: t, value: n, onChange: r }) {
|
|
605
|
+
let a = z(), o = N(e.ref?.entity), s = e.display?.ref_display_field ?? o?.display?.display_field, c = J(() => o ? [...o.fields].find(([, e]) => e.primary)?.[0] ?? "id" : "id", [o]), { data: l } = i(e.ref?.entity, {
|
|
606
|
+
per_page: 200,
|
|
607
|
+
sort: s ? `${s}:asc` : void 0
|
|
608
|
+
}), u = l?.data ?? [], d = (e) => e == null ? "—" : typeof e == "object" && !Array.isArray(e) ? a(e) || "—" : w(e), f = [{
|
|
609
|
+
value: "__all__",
|
|
610
|
+
label: a("record.associated.filter_all", "All {name}", { name: t })
|
|
611
|
+
}, ...u.map((e) => {
|
|
612
|
+
let t = String(e[c]), n = e[E];
|
|
613
|
+
return {
|
|
614
|
+
value: t,
|
|
615
|
+
label: typeof n == "string" && n !== "" ? n : s ? d(e[s] ?? t) : t
|
|
616
|
+
};
|
|
617
|
+
})];
|
|
618
|
+
return /* @__PURE__ */ Q("div", {
|
|
619
|
+
style: { width: 160 },
|
|
620
|
+
children: /* @__PURE__ */ Q(v, {
|
|
621
|
+
value: n,
|
|
622
|
+
options: f,
|
|
623
|
+
onChange: r,
|
|
624
|
+
placeholder: t
|
|
625
|
+
})
|
|
626
|
+
});
|
|
627
|
+
}
|
|
628
|
+
//#endregion
|
|
629
|
+
//#region src/components/detail-layout/AssociatedBlock.tsx
|
|
630
|
+
function He(e) {
|
|
631
|
+
if (!e) return [];
|
|
632
|
+
let t = [];
|
|
633
|
+
for (let [r, i] of Object.entries(e)) (i.visibility ?? []).includes("list_row") && (i.association || n(r) || t.push({
|
|
634
|
+
code: r,
|
|
635
|
+
action: i
|
|
636
|
+
}));
|
|
637
|
+
return t;
|
|
638
|
+
}
|
|
639
|
+
function Ue(e, t, n) {
|
|
640
|
+
if (!e) return [];
|
|
641
|
+
let r = [];
|
|
642
|
+
for (let [i, a] of Object.entries(e)) {
|
|
643
|
+
if (!(a.visibility ?? []).includes("list_toolbar") || a.association || i.startsWith("__")) continue;
|
|
644
|
+
let e = {
|
|
645
|
+
...a,
|
|
646
|
+
resolved_hidden_defaults: {
|
|
647
|
+
...a.resolved_hidden_defaults ?? {},
|
|
648
|
+
[t]: n
|
|
649
|
+
}
|
|
650
|
+
};
|
|
651
|
+
if (a.resolved_params?.has(t)) {
|
|
652
|
+
let n = a.resolved_params.items().filter((e) => e.name !== t);
|
|
653
|
+
e = {
|
|
654
|
+
...e,
|
|
655
|
+
resolved_params: new F(n)
|
|
656
|
+
};
|
|
657
|
+
}
|
|
658
|
+
r.push({
|
|
659
|
+
code: i,
|
|
660
|
+
action: e
|
|
661
|
+
});
|
|
662
|
+
}
|
|
663
|
+
return r;
|
|
664
|
+
}
|
|
665
|
+
function We(e, t, n) {
|
|
666
|
+
let r = e[n];
|
|
667
|
+
if (!r) return null;
|
|
668
|
+
let i = e[t], a = i?.children?.find((e) => e.entity === n);
|
|
669
|
+
if (a) {
|
|
670
|
+
let e = a.foreign_key;
|
|
671
|
+
if (typeof e == "string") return e;
|
|
672
|
+
if (Array.isArray(e) && e.length === 1) return e[0];
|
|
673
|
+
}
|
|
674
|
+
let o = i?.table;
|
|
675
|
+
for (let [n, i] of r.fields) {
|
|
676
|
+
let r = i.ref?.entity;
|
|
677
|
+
if (r) {
|
|
678
|
+
if (r === t) return n;
|
|
679
|
+
if (o) {
|
|
680
|
+
let t = e[r]?.table;
|
|
681
|
+
if (t && t === o) return n;
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
return null;
|
|
686
|
+
}
|
|
687
|
+
function Ge(e, t, n) {
|
|
688
|
+
let r = new Set(P(e));
|
|
689
|
+
return new Set(t.filter((t) => {
|
|
690
|
+
if (t === n || r.has(t)) return !1;
|
|
691
|
+
let i = e.fields.get(t);
|
|
692
|
+
return !(!i || i.auto || i.primary || i.source);
|
|
693
|
+
}));
|
|
694
|
+
}
|
|
695
|
+
function Ke(e, t, n) {
|
|
696
|
+
return new Set(t.filter((t) => {
|
|
697
|
+
if (t === n) return !1;
|
|
698
|
+
let r = e.fields.get(t);
|
|
699
|
+
return !(!r || r.auto);
|
|
700
|
+
}));
|
|
701
|
+
}
|
|
702
|
+
function qe(e, t, n, r) {
|
|
703
|
+
let i = [];
|
|
704
|
+
for (let a of t) {
|
|
705
|
+
let t = n.fields.get(a);
|
|
706
|
+
if (!t || !t.required || t.auto || t.primary || a === r || n.tenant_key && a === n.tenant_key) continue;
|
|
707
|
+
let o = e[a];
|
|
708
|
+
(o == null || o === "") && i.push(a);
|
|
709
|
+
}
|
|
710
|
+
return i;
|
|
711
|
+
}
|
|
712
|
+
function Je({ node: e, ctx: t }) {
|
|
713
|
+
let n = z("errors"), r = e.associated;
|
|
714
|
+
if (!r || t.isNew) return null;
|
|
715
|
+
let i = t.schema.entities[r];
|
|
716
|
+
if (!i) return /* @__PURE__ */ $("div", {
|
|
717
|
+
style: {
|
|
718
|
+
fontSize: 12.5,
|
|
719
|
+
color: "var(--text-3)",
|
|
720
|
+
padding: "8px 0"
|
|
721
|
+
},
|
|
722
|
+
children: [
|
|
723
|
+
n("record.related_entity_not_found", "The related record type is not declared in this deployment."),
|
|
724
|
+
" ",
|
|
725
|
+
/* @__PURE__ */ Q("code", { children: r })
|
|
726
|
+
]
|
|
727
|
+
});
|
|
728
|
+
let a = We(t.schema.entities, t.entityCode, r);
|
|
729
|
+
return a ? /* @__PURE__ */ Q(Ye, {
|
|
730
|
+
node: e,
|
|
731
|
+
ctx: t,
|
|
732
|
+
assocCode: r,
|
|
733
|
+
assocEntity: i,
|
|
734
|
+
fkField: a
|
|
735
|
+
}) : /* @__PURE__ */ $("div", {
|
|
736
|
+
style: {
|
|
737
|
+
fontSize: 12.5,
|
|
738
|
+
color: "var(--text-3)",
|
|
739
|
+
padding: "8px 0"
|
|
740
|
+
},
|
|
741
|
+
children: [
|
|
742
|
+
n("record.associated_foreign_key_not_found", "No foreign key joins these two entities."),
|
|
743
|
+
" ",
|
|
744
|
+
r,
|
|
745
|
+
" → ",
|
|
746
|
+
t.entityCode
|
|
747
|
+
]
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
function Ye({ node: n, ctx: r, assocCode: i, assocEntity: o, fkField: s }) {
|
|
751
|
+
let c = z(), l = z("errors"), u = n.columns && n.columns.length > 0 ? n.columns.filter((e) => e !== s && !!o.fields.get(e)) : o.fields.names().filter((e) => {
|
|
752
|
+
if (e === s) return !1;
|
|
753
|
+
let t = o.fields.get(e);
|
|
754
|
+
return !(!t || t.primary || t.display?.is_listable === !1);
|
|
755
|
+
}), d = S(o, "update"), f = n.interaction ?? (d ? "navigate" : "readonly"), p = (f === "inline_edit" || f === "row_edit") && d && n.editable !== !1, h = c(o.display?.name_plural) || c(o.display?.name) || i, _ = n.searchable === !0 || n.filters && n.filters.length > 0, v = J(() => Ue(o.actions, s, r.recordId), [
|
|
756
|
+
o.actions,
|
|
757
|
+
s,
|
|
758
|
+
r.recordId
|
|
759
|
+
]), y = J(() => {
|
|
760
|
+
let e = {};
|
|
761
|
+
for (let { code: t, action: n } of v) e[t] = n;
|
|
762
|
+
return e;
|
|
763
|
+
}, [v]), b = J(() => {
|
|
764
|
+
let e = o.action_layout ?? null;
|
|
765
|
+
return g(c, e ?? a(y, "list_toolbar"), y, void 0, {}, []);
|
|
766
|
+
}, [
|
|
767
|
+
c,
|
|
768
|
+
o.action_layout,
|
|
769
|
+
y
|
|
770
|
+
]), { run: x } = C(), w = G(), T = J(() => ({
|
|
771
|
+
entity: o,
|
|
772
|
+
entityCode: i,
|
|
773
|
+
screenRoute: typeof window < "u" ? window.location.pathname : "",
|
|
774
|
+
selectedRows: [],
|
|
775
|
+
selectedIds: [],
|
|
776
|
+
t: c,
|
|
777
|
+
tabNavigate: (e, t) => w(e, {
|
|
778
|
+
title: t?.title,
|
|
779
|
+
icon: t?.icon,
|
|
780
|
+
search: t?.search
|
|
781
|
+
}),
|
|
782
|
+
runActionApi: (e, t) => W(e, t)
|
|
783
|
+
}), [
|
|
784
|
+
o,
|
|
785
|
+
i,
|
|
786
|
+
c,
|
|
787
|
+
w
|
|
788
|
+
]), E = Z(), D = q(() => {
|
|
789
|
+
E.invalidateQueries({ predicate: (e) => {
|
|
790
|
+
let t = e.queryKey;
|
|
791
|
+
return t[0] === "entity-children" && t[3] === i;
|
|
792
|
+
} });
|
|
793
|
+
}, [E, i]), O = q((e, t) => {
|
|
794
|
+
let n = se(l, e, t, {}, i);
|
|
795
|
+
if (n !== null) return x({
|
|
796
|
+
action: t,
|
|
797
|
+
title: c(t.display?.name) || e,
|
|
798
|
+
execute: async (e) => {
|
|
799
|
+
let t = await W(n, B(e, void 0));
|
|
800
|
+
return D(), t;
|
|
801
|
+
}
|
|
802
|
+
});
|
|
803
|
+
}, [
|
|
804
|
+
c,
|
|
805
|
+
l,
|
|
806
|
+
x,
|
|
807
|
+
i,
|
|
808
|
+
D
|
|
809
|
+
]), [k, A] = X(0), j = /* @__PURE__ */ $("div", {
|
|
810
|
+
style: {
|
|
811
|
+
display: "flex",
|
|
812
|
+
alignItems: "center",
|
|
813
|
+
gap: 6,
|
|
814
|
+
flex: "1 1 auto",
|
|
815
|
+
minWidth: 0,
|
|
816
|
+
justifyContent: "flex-end"
|
|
817
|
+
},
|
|
818
|
+
children: [o.action_layout ? b.length > 0 && /* @__PURE__ */ Q(ie, {
|
|
819
|
+
kind: "toolbar",
|
|
820
|
+
layout: b,
|
|
821
|
+
entityActions: y,
|
|
822
|
+
onRun: O,
|
|
823
|
+
widgetContext: T,
|
|
824
|
+
ariaLabel: c("record.associated.toolbar_actions", "{name} toolbar actions", { name: h })
|
|
825
|
+
}) : v.map(({ code: e, action: t }) => /* @__PURE__ */ Q(Re, {
|
|
826
|
+
actionCode: e,
|
|
827
|
+
action: t,
|
|
828
|
+
entityCode: i,
|
|
829
|
+
variant: "ghost",
|
|
830
|
+
size: "sm",
|
|
831
|
+
onSuccess: D
|
|
832
|
+
}, e)), p && /* @__PURE__ */ Q(m, {
|
|
833
|
+
kind: "ghost",
|
|
834
|
+
size: "xs",
|
|
835
|
+
icon: /* @__PURE__ */ Q(e.plus, { size: 12 }),
|
|
836
|
+
onClick: () => A((e) => e + 1),
|
|
837
|
+
children: c("record.row.add", "Add row")
|
|
838
|
+
})]
|
|
839
|
+
}), M = _ ? /* @__PURE__ */ Q(Ze, {
|
|
840
|
+
entityCode: i,
|
|
841
|
+
entity: o,
|
|
842
|
+
parentEntity: r.entityCode,
|
|
843
|
+
parentId: r.recordId,
|
|
844
|
+
foreignKey: s,
|
|
845
|
+
columns: u,
|
|
846
|
+
editable: p,
|
|
847
|
+
interaction: f,
|
|
848
|
+
ctx: r,
|
|
849
|
+
searchable: n.searchable,
|
|
850
|
+
filterFields: n.filters,
|
|
851
|
+
sort: n.sort,
|
|
852
|
+
startDraftSignal: k
|
|
853
|
+
}) : /* @__PURE__ */ Q(Xe, {
|
|
854
|
+
entityCode: i,
|
|
855
|
+
entity: o,
|
|
856
|
+
parentEntity: r.entityCode,
|
|
857
|
+
parentId: r.recordId,
|
|
858
|
+
foreignKey: s,
|
|
859
|
+
columns: u,
|
|
860
|
+
editable: p,
|
|
861
|
+
interaction: f,
|
|
862
|
+
ctx: r,
|
|
863
|
+
sort: n.sort,
|
|
864
|
+
startDraftSignal: k
|
|
865
|
+
});
|
|
866
|
+
return r.withinCard ? /* @__PURE__ */ $("div", { children: [/* @__PURE__ */ Q("div", {
|
|
867
|
+
style: {
|
|
868
|
+
display: "flex",
|
|
869
|
+
justifyContent: "flex-end",
|
|
870
|
+
marginBottom: 8
|
|
871
|
+
},
|
|
872
|
+
children: j
|
|
873
|
+
}), M] }) : /* @__PURE__ */ Q(Se, {
|
|
874
|
+
title: h,
|
|
875
|
+
icon: o.display?.icon ? /* @__PURE__ */ Q(t, {
|
|
876
|
+
name: o.display.icon,
|
|
877
|
+
size: 14
|
|
878
|
+
}) : void 0,
|
|
879
|
+
right: j,
|
|
880
|
+
children: M
|
|
881
|
+
});
|
|
882
|
+
}
|
|
883
|
+
function Xe({ entityCode: e, entity: t, parentEntity: n, parentId: i, foreignKey: a, columns: o, editable: s, interaction: c, ctx: u, sort: d, startDraftSignal: f }) {
|
|
884
|
+
let p = Z(), { data: m, isLoading: h, isError: g } = l(n, i, e, a, d), _ = m?.data ?? [], v = m?.$refs, y = q(() => {
|
|
885
|
+
p.invalidateQueries({ queryKey: [
|
|
886
|
+
r,
|
|
887
|
+
n,
|
|
888
|
+
i,
|
|
889
|
+
e
|
|
890
|
+
] });
|
|
891
|
+
}, [
|
|
892
|
+
p,
|
|
893
|
+
n,
|
|
894
|
+
i,
|
|
895
|
+
e
|
|
896
|
+
]);
|
|
897
|
+
return /* @__PURE__ */ Q(Qe, {
|
|
898
|
+
entityCode: e,
|
|
899
|
+
entity: t,
|
|
900
|
+
parentId: i,
|
|
901
|
+
foreignKey: a,
|
|
902
|
+
columns: o,
|
|
903
|
+
editable: s,
|
|
904
|
+
interaction: c,
|
|
905
|
+
ctx: u,
|
|
906
|
+
rows: _,
|
|
907
|
+
refs: v,
|
|
908
|
+
isLoading: h,
|
|
909
|
+
isError: g,
|
|
910
|
+
invalidateQuery: y,
|
|
911
|
+
startDraftSignal: f
|
|
912
|
+
});
|
|
913
|
+
}
|
|
914
|
+
function Ze({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey: i, columns: a, editable: o, interaction: s, ctx: c, searchable: l, filterFields: u, sort: d, startDraftSignal: f }) {
|
|
915
|
+
let p = z(), h = Z(), [g, _] = X(""), [v, y] = X(""), [b, x] = X({}), S = Y(void 0);
|
|
916
|
+
pe(() => (S.current && clearTimeout(S.current), S.current = setTimeout(() => {
|
|
917
|
+
y(g);
|
|
918
|
+
}, 300), () => {
|
|
919
|
+
S.current && clearTimeout(S.current);
|
|
920
|
+
}), [g]);
|
|
921
|
+
let C = q((e, t) => {
|
|
922
|
+
x((n) => {
|
|
923
|
+
if (t === "__all__") {
|
|
924
|
+
let { [e]: t, ...r } = n;
|
|
925
|
+
return r;
|
|
926
|
+
}
|
|
927
|
+
return {
|
|
928
|
+
...n,
|
|
929
|
+
[e]: t
|
|
930
|
+
};
|
|
931
|
+
});
|
|
932
|
+
}, []), w = J(() => Object.keys(b).length > 0 ? b : void 0, [b]), { data: T, isLoading: E, isError: O, hasNextPage: k, fetchNextPage: A, isFetchingNextPage: j } = Le(n, r, e, i, d, void 0, v || void 0, w), { rows: M, refs: N } = J(() => {
|
|
933
|
+
if (!T?.pages) return {
|
|
934
|
+
rows: [],
|
|
935
|
+
refs: void 0
|
|
936
|
+
};
|
|
937
|
+
let e = [], t;
|
|
938
|
+
for (let n of T.pages) if (e.push(...n.data), n.$refs) {
|
|
939
|
+
if (!t) t = { ...n.$refs };
|
|
940
|
+
else for (let [e, r] of Object.entries(n.$refs)) t[e] = {
|
|
941
|
+
...t[e],
|
|
942
|
+
...r
|
|
943
|
+
};
|
|
944
|
+
}
|
|
945
|
+
return {
|
|
946
|
+
rows: e,
|
|
947
|
+
refs: t
|
|
948
|
+
};
|
|
949
|
+
}, [T]), P = q(() => {
|
|
950
|
+
h.invalidateQueries({ predicate: (t) => {
|
|
951
|
+
let n = t.queryKey;
|
|
952
|
+
return n[0] === "entity-children" && n[3] === e;
|
|
953
|
+
} });
|
|
954
|
+
}, [h, e]);
|
|
955
|
+
return /* @__PURE__ */ $("div", { children: [
|
|
956
|
+
/* @__PURE__ */ Q(Be, {
|
|
957
|
+
entity: t,
|
|
958
|
+
searchable: l,
|
|
959
|
+
filterFields: u,
|
|
960
|
+
searchValue: g,
|
|
961
|
+
onSearchChange: _,
|
|
962
|
+
filters: b,
|
|
963
|
+
onFilterChange: C,
|
|
964
|
+
allEntities: c.schema.entities
|
|
965
|
+
}),
|
|
966
|
+
/* @__PURE__ */ Q(Qe, {
|
|
967
|
+
entityCode: e,
|
|
968
|
+
entity: t,
|
|
969
|
+
parentId: r,
|
|
970
|
+
foreignKey: i,
|
|
971
|
+
columns: a,
|
|
972
|
+
editable: o,
|
|
973
|
+
interaction: s,
|
|
974
|
+
ctx: c,
|
|
975
|
+
rows: M,
|
|
976
|
+
refs: N,
|
|
977
|
+
isLoading: E,
|
|
978
|
+
isError: O,
|
|
979
|
+
invalidateQuery: P,
|
|
980
|
+
startDraftSignal: f
|
|
981
|
+
}),
|
|
982
|
+
k && /* @__PURE__ */ Q("div", {
|
|
983
|
+
style: { marginTop: 4 },
|
|
984
|
+
children: /* @__PURE__ */ Q(m, {
|
|
985
|
+
kind: "ghost",
|
|
986
|
+
size: "xs",
|
|
987
|
+
icon: j ? /* @__PURE__ */ Q(D, { size: 12 }) : void 0,
|
|
988
|
+
onClick: () => A(),
|
|
989
|
+
disabled: j,
|
|
990
|
+
children: p("record.associated.load_more", "Load more")
|
|
991
|
+
})
|
|
992
|
+
})
|
|
993
|
+
] });
|
|
994
|
+
}
|
|
995
|
+
function Qe({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i, editable: a, interaction: o, ctx: s, rows: c, refs: l, isLoading: u, isError: d, invalidateQuery: f, startDraftSignal: p }) {
|
|
996
|
+
let m = z(), g = z("errors"), _ = O(), v = _.isPhone && s.relatedRecordsPresentation === "table", b = i.find((e) => e !== r), S = J(() => o === "navigate" ? h(void 0, t, s.schema.screens) : null, [
|
|
997
|
+
o,
|
|
998
|
+
t,
|
|
999
|
+
s.schema.screens
|
|
1000
|
+
]), w = J(() => a ? Ge(t, i, r) : /* @__PURE__ */ new Set(), [
|
|
1001
|
+
i,
|
|
1002
|
+
r,
|
|
1003
|
+
t,
|
|
1004
|
+
a
|
|
1005
|
+
]), T = J(() => Ke(t, i, r), [
|
|
1006
|
+
i,
|
|
1007
|
+
r,
|
|
1008
|
+
t
|
|
1009
|
+
]), E = J(() => {
|
|
1010
|
+
let e = /* @__PURE__ */ new Map();
|
|
1011
|
+
for (let n of c) {
|
|
1012
|
+
let r = x(t, n);
|
|
1013
|
+
e.set(V(r), r);
|
|
1014
|
+
}
|
|
1015
|
+
return e;
|
|
1016
|
+
}, [c, t]), D = J(() => {
|
|
1017
|
+
let e = /* @__PURE__ */ new Map();
|
|
1018
|
+
for (let n of c) {
|
|
1019
|
+
let r = n.$row_version;
|
|
1020
|
+
typeof r == "string" && r !== "" && e.set(V(x(t, n)), r);
|
|
1021
|
+
}
|
|
1022
|
+
return e;
|
|
1023
|
+
}, [c, t]), k = J(() => He(t.actions), [t.actions]), [A, j] = X(null), [M, N] = X(null), [P, F] = X([]), [I, L] = X({}), R = Y(I);
|
|
1024
|
+
R.current = I;
|
|
1025
|
+
let B = Y({});
|
|
1026
|
+
pe(() => {
|
|
1027
|
+
let e = B.current;
|
|
1028
|
+
return () => {
|
|
1029
|
+
for (let t of Object.values(e)) clearTimeout(t);
|
|
1030
|
+
};
|
|
1031
|
+
}, []);
|
|
1032
|
+
let [H, U] = X(null), [W, G] = X([]), [ie, ae] = X(!1), { run: oe } = C(), [se, ue] = X(/* @__PURE__ */ new Set()), K = q(async (t, n, r) => {
|
|
1033
|
+
L((e) => ({
|
|
1034
|
+
...e,
|
|
1035
|
+
[t]: {
|
|
1036
|
+
...e[t],
|
|
1037
|
+
saving: !0,
|
|
1038
|
+
error: void 0
|
|
1039
|
+
}
|
|
1040
|
+
}));
|
|
1041
|
+
try {
|
|
1042
|
+
let i = D.get(t), a = i ? {
|
|
1043
|
+
...n,
|
|
1044
|
+
$row_version: i
|
|
1045
|
+
} : n;
|
|
1046
|
+
return await re(e, E.get(t) ?? t, a), L((e) => {
|
|
1047
|
+
let n = e[t];
|
|
1048
|
+
if (!n) return e;
|
|
1049
|
+
if (n.ver > r) return {
|
|
1050
|
+
...e,
|
|
1051
|
+
[t]: {
|
|
1052
|
+
...n,
|
|
1053
|
+
saving: !1
|
|
1054
|
+
}
|
|
1055
|
+
};
|
|
1056
|
+
let { [t]: i, ...a } = e;
|
|
1057
|
+
return a;
|
|
1058
|
+
}), f(), !0;
|
|
1059
|
+
} catch (e) {
|
|
1060
|
+
let n = ne(g, e);
|
|
1061
|
+
return L((e) => ({
|
|
1062
|
+
...e,
|
|
1063
|
+
[t]: {
|
|
1064
|
+
...e[t],
|
|
1065
|
+
saving: !1,
|
|
1066
|
+
error: n
|
|
1067
|
+
}
|
|
1068
|
+
})), !1;
|
|
1069
|
+
}
|
|
1070
|
+
}, [
|
|
1071
|
+
e,
|
|
1072
|
+
g,
|
|
1073
|
+
f,
|
|
1074
|
+
E,
|
|
1075
|
+
D
|
|
1076
|
+
]), de = q((e, t, n) => {
|
|
1077
|
+
L((r) => {
|
|
1078
|
+
let i = r[e] ?? {
|
|
1079
|
+
buffer: {},
|
|
1080
|
+
ver: 0,
|
|
1081
|
+
saving: !1
|
|
1082
|
+
}, a = i.ver + 1;
|
|
1083
|
+
return {
|
|
1084
|
+
...r,
|
|
1085
|
+
[e]: {
|
|
1086
|
+
...i,
|
|
1087
|
+
buffer: {
|
|
1088
|
+
...i.buffer,
|
|
1089
|
+
[t]: n
|
|
1090
|
+
},
|
|
1091
|
+
ver: a
|
|
1092
|
+
}
|
|
1093
|
+
};
|
|
1094
|
+
}), o === "inline_edit" && (B.current[e] && clearTimeout(B.current[e]), B.current[e] = setTimeout(() => {
|
|
1095
|
+
let t = R.current[e];
|
|
1096
|
+
t && Object.keys(t.buffer).length > 0 && K(e, { ...t.buffer }, t.ver);
|
|
1097
|
+
}, 500));
|
|
1098
|
+
}, [K, o]), fe = q(() => {
|
|
1099
|
+
let e = {};
|
|
1100
|
+
e[r] = n;
|
|
1101
|
+
for (let n of i) {
|
|
1102
|
+
let r = t.fields.get(n);
|
|
1103
|
+
r && (r.default === void 0 ? r.type === "bool" && (e[n] = !1) : e[n] = r.default);
|
|
1104
|
+
}
|
|
1105
|
+
U(e), G([]);
|
|
1106
|
+
}, [
|
|
1107
|
+
r,
|
|
1108
|
+
n,
|
|
1109
|
+
i,
|
|
1110
|
+
t.fields
|
|
1111
|
+
]), me = Y(p);
|
|
1112
|
+
pe(() => {
|
|
1113
|
+
p !== void 0 && p !== me.current && (me.current = p, !H && fe());
|
|
1114
|
+
}, [
|
|
1115
|
+
p,
|
|
1116
|
+
H,
|
|
1117
|
+
fe
|
|
1118
|
+
]);
|
|
1119
|
+
let he = q(async () => {
|
|
1120
|
+
if (!H) return;
|
|
1121
|
+
let n = qe(H, i, t, r);
|
|
1122
|
+
if (n.length > 0) {
|
|
1123
|
+
G(n);
|
|
1124
|
+
return;
|
|
1125
|
+
}
|
|
1126
|
+
ae(!0);
|
|
1127
|
+
try {
|
|
1128
|
+
await ee(e, H), U(null), G([]), f();
|
|
1129
|
+
} catch (e) {
|
|
1130
|
+
let t = ne(g, e);
|
|
1131
|
+
G([`_error:${t}`]);
|
|
1132
|
+
} finally {
|
|
1133
|
+
ae(!1);
|
|
1134
|
+
}
|
|
1135
|
+
}, [
|
|
1136
|
+
H,
|
|
1137
|
+
i,
|
|
1138
|
+
t,
|
|
1139
|
+
r,
|
|
1140
|
+
e,
|
|
1141
|
+
g,
|
|
1142
|
+
f
|
|
1143
|
+
]), ge = q((e) => {
|
|
1144
|
+
L({}), F([]), N(e);
|
|
1145
|
+
}, []), _e = q(async (e) => {
|
|
1146
|
+
let n = R.current[e], a = n?.buffer ?? {};
|
|
1147
|
+
if (Object.keys(a).length === 0) {
|
|
1148
|
+
N(null), F([]);
|
|
1149
|
+
return;
|
|
1150
|
+
}
|
|
1151
|
+
let o = qe({
|
|
1152
|
+
...c.find((n) => V(x(t, n)) === e) ?? {},
|
|
1153
|
+
...a
|
|
1154
|
+
}, i, t, r);
|
|
1155
|
+
if (o.length > 0) {
|
|
1156
|
+
F(o);
|
|
1157
|
+
return;
|
|
1158
|
+
}
|
|
1159
|
+
await K(e, { ...a }, n?.ver ?? 0) && (N(null), F([]));
|
|
1160
|
+
}, [
|
|
1161
|
+
c,
|
|
1162
|
+
t,
|
|
1163
|
+
i,
|
|
1164
|
+
r,
|
|
1165
|
+
K
|
|
1166
|
+
]), Z = q((e) => {
|
|
1167
|
+
L((t) => {
|
|
1168
|
+
if (!t[e]) return t;
|
|
1169
|
+
let { [e]: n, ...r } = t;
|
|
1170
|
+
return r;
|
|
1171
|
+
}), F([]), N(null);
|
|
1172
|
+
}, []), ve = q((n, r) => {
|
|
1173
|
+
let i = E.get(n) ?? n;
|
|
1174
|
+
return oe({
|
|
1175
|
+
action: t.actions?.__delete,
|
|
1176
|
+
destructive: !0,
|
|
1177
|
+
title: m(t.display?.name) || m("record.action.delete", "Delete"),
|
|
1178
|
+
row: r,
|
|
1179
|
+
entity: e,
|
|
1180
|
+
execute: async () => {
|
|
1181
|
+
ue((e) => new Set(e).add(n));
|
|
1182
|
+
try {
|
|
1183
|
+
return await te(e, i);
|
|
1184
|
+
} finally {
|
|
1185
|
+
ue((e) => {
|
|
1186
|
+
let t = new Set(e);
|
|
1187
|
+
return t.delete(n), t;
|
|
1188
|
+
});
|
|
1189
|
+
}
|
|
1190
|
+
},
|
|
1191
|
+
onSuccess: () => f()
|
|
1192
|
+
});
|
|
1193
|
+
}, [
|
|
1194
|
+
m,
|
|
1195
|
+
oe,
|
|
1196
|
+
t,
|
|
1197
|
+
e,
|
|
1198
|
+
f,
|
|
1199
|
+
E
|
|
1200
|
+
]);
|
|
1201
|
+
if (d) return /* @__PURE__ */ Q("div", {
|
|
1202
|
+
style: {
|
|
1203
|
+
fontSize: 12.5,
|
|
1204
|
+
color: "var(--danger)",
|
|
1205
|
+
padding: "8px 0"
|
|
1206
|
+
},
|
|
1207
|
+
children: g("record.related_rows_unreadable", "The related records could not be loaded.")
|
|
1208
|
+
});
|
|
1209
|
+
if (u) return /* @__PURE__ */ $("div", {
|
|
1210
|
+
style: {
|
|
1211
|
+
display: "flex",
|
|
1212
|
+
flexDirection: "column",
|
|
1213
|
+
gap: 8,
|
|
1214
|
+
padding: "8px 0"
|
|
1215
|
+
},
|
|
1216
|
+
children: [/* @__PURE__ */ Q("div", { style: {
|
|
1217
|
+
height: 32,
|
|
1218
|
+
background: "var(--surface-3)",
|
|
1219
|
+
borderRadius: 6
|
|
1220
|
+
} }), /* @__PURE__ */ Q("div", { style: {
|
|
1221
|
+
height: 32,
|
|
1222
|
+
background: "var(--surface-3)",
|
|
1223
|
+
borderRadius: 6
|
|
1224
|
+
} })]
|
|
1225
|
+
});
|
|
1226
|
+
let ye = c.length === 0 && !H;
|
|
1227
|
+
return _.isPhone && !v ? /* @__PURE__ */ $("div", { children: [ye && !a && /* @__PURE__ */ Q("div", {
|
|
1228
|
+
style: {
|
|
1229
|
+
fontSize: 12.5,
|
|
1230
|
+
color: "var(--text-3)",
|
|
1231
|
+
padding: "12px 0"
|
|
1232
|
+
},
|
|
1233
|
+
children: m("record.related.empty", "No records yet.")
|
|
1234
|
+
}), (!ye || a) && /* @__PURE__ */ $("div", {
|
|
1235
|
+
style: {
|
|
1236
|
+
display: "flex",
|
|
1237
|
+
flexDirection: "column",
|
|
1238
|
+
gap: 10
|
|
1239
|
+
},
|
|
1240
|
+
children: [c.map((n) => {
|
|
1241
|
+
let r = V(x(t, n)), c = se.has(r), u = I[r], d = S && r ? S.replace(/:\w+/, r) : void 0;
|
|
1242
|
+
return /* @__PURE__ */ Q($e, {
|
|
1243
|
+
rowId: r,
|
|
1244
|
+
row: n,
|
|
1245
|
+
entity: t,
|
|
1246
|
+
entities: s.schema.entities,
|
|
1247
|
+
screens: s.schema.screens,
|
|
1248
|
+
columns: i,
|
|
1249
|
+
editableColumns: w,
|
|
1250
|
+
editable: a,
|
|
1251
|
+
interaction: o,
|
|
1252
|
+
isEditing: M === r,
|
|
1253
|
+
editErrors: P,
|
|
1254
|
+
isDeleting: c,
|
|
1255
|
+
activeCell: A,
|
|
1256
|
+
setActiveCell: j,
|
|
1257
|
+
rowState: u,
|
|
1258
|
+
onCellChange: de,
|
|
1259
|
+
onDeleteClick: (e) => void ve(e, n),
|
|
1260
|
+
onStartEdit: ge,
|
|
1261
|
+
onConfirmEdit: _e,
|
|
1262
|
+
onCancelEdit: Z,
|
|
1263
|
+
refs: l,
|
|
1264
|
+
identityCol: b,
|
|
1265
|
+
href: d,
|
|
1266
|
+
rowActions: k,
|
|
1267
|
+
entityCode: e,
|
|
1268
|
+
onRowActionSuccess: f
|
|
1269
|
+
}, r);
|
|
1270
|
+
}), H && /* @__PURE__ */ Q(it, {
|
|
1271
|
+
draftRow: H,
|
|
1272
|
+
entity: t,
|
|
1273
|
+
columns: i,
|
|
1274
|
+
editableColumns: T,
|
|
1275
|
+
foreignKey: r,
|
|
1276
|
+
draftErrors: W,
|
|
1277
|
+
draftSaving: ie,
|
|
1278
|
+
onChange: (e, t) => U((n) => n && {
|
|
1279
|
+
...n,
|
|
1280
|
+
[e]: t
|
|
1281
|
+
}),
|
|
1282
|
+
onConfirm: he,
|
|
1283
|
+
onCancel: () => {
|
|
1284
|
+
U(null), G([]);
|
|
1285
|
+
},
|
|
1286
|
+
refs: l
|
|
1287
|
+
})]
|
|
1288
|
+
})] }) : /* @__PURE__ */ $("div", { children: [ye && !a && /* @__PURE__ */ Q("div", {
|
|
1289
|
+
style: {
|
|
1290
|
+
fontSize: 12.5,
|
|
1291
|
+
color: "var(--text-3)",
|
|
1292
|
+
padding: "12px 0"
|
|
1293
|
+
},
|
|
1294
|
+
children: m("record.related.empty", "No records yet.")
|
|
1295
|
+
}), (!ye || a) && /* @__PURE__ */ Q("div", {
|
|
1296
|
+
style: { overflowX: "auto" },
|
|
1297
|
+
children: /* @__PURE__ */ $("table", {
|
|
1298
|
+
style: le,
|
|
1299
|
+
children: [/* @__PURE__ */ Q("thead", { children: /* @__PURE__ */ $("tr", { children: [
|
|
1300
|
+
i.map((e) => {
|
|
1301
|
+
let n = t.fields.get(e);
|
|
1302
|
+
return /* @__PURE__ */ Q("th", {
|
|
1303
|
+
style: ce,
|
|
1304
|
+
children: n ? y(m, n, e, s.schema.entities) : e
|
|
1305
|
+
}, e);
|
|
1306
|
+
}),
|
|
1307
|
+
a && /* @__PURE__ */ Q("th", { style: {
|
|
1308
|
+
height: 30,
|
|
1309
|
+
width: 72
|
|
1310
|
+
} }),
|
|
1311
|
+
!a && k.length > 0 && /* @__PURE__ */ Q("th", { style: {
|
|
1312
|
+
height: 30,
|
|
1313
|
+
width: 40
|
|
1314
|
+
} })
|
|
1315
|
+
] }) }), /* @__PURE__ */ $("tbody", { children: [c.map((n) => {
|
|
1316
|
+
let r = V(x(t, n)), c = se.has(r), u = I[r], d = S && r ? S.replace(/:\w+/, r) : void 0;
|
|
1317
|
+
return /* @__PURE__ */ Q(et, {
|
|
1318
|
+
rowId: r,
|
|
1319
|
+
row: n,
|
|
1320
|
+
entity: t,
|
|
1321
|
+
entities: s.schema.entities,
|
|
1322
|
+
screens: s.schema.screens,
|
|
1323
|
+
columns: i,
|
|
1324
|
+
editableColumns: w,
|
|
1325
|
+
editable: a,
|
|
1326
|
+
interaction: o,
|
|
1327
|
+
isEditing: M === r,
|
|
1328
|
+
editErrors: P,
|
|
1329
|
+
isDeleting: c,
|
|
1330
|
+
activeCell: A,
|
|
1331
|
+
setActiveCell: j,
|
|
1332
|
+
rowState: u,
|
|
1333
|
+
onCellChange: de,
|
|
1334
|
+
onDeleteClick: (e) => void ve(e, n),
|
|
1335
|
+
onStartEdit: ge,
|
|
1336
|
+
onConfirmEdit: _e,
|
|
1337
|
+
onCancelEdit: Z,
|
|
1338
|
+
refs: l,
|
|
1339
|
+
identityCol: b,
|
|
1340
|
+
href: d,
|
|
1341
|
+
rowActions: k,
|
|
1342
|
+
entityCode: e,
|
|
1343
|
+
onRowActionSuccess: f
|
|
1344
|
+
}, r);
|
|
1345
|
+
}), H && /* @__PURE__ */ Q(rt, {
|
|
1346
|
+
draftRow: H,
|
|
1347
|
+
entity: t,
|
|
1348
|
+
columns: i,
|
|
1349
|
+
editableColumns: T,
|
|
1350
|
+
foreignKey: r,
|
|
1351
|
+
draftErrors: W,
|
|
1352
|
+
draftSaving: ie,
|
|
1353
|
+
onChange: (e, t) => U((n) => n && {
|
|
1354
|
+
...n,
|
|
1355
|
+
[e]: t
|
|
1356
|
+
}),
|
|
1357
|
+
onConfirm: he,
|
|
1358
|
+
onCancel: () => {
|
|
1359
|
+
U(null), G([]);
|
|
1360
|
+
},
|
|
1361
|
+
refs: l
|
|
1362
|
+
})] })]
|
|
1363
|
+
})
|
|
1364
|
+
})] });
|
|
1365
|
+
}
|
|
1366
|
+
function $e({ rowId: t, row: n, entity: r, entities: i, screens: a, columns: o, editableColumns: s, editable: l, interaction: u, isEditing: d, editErrors: f, isDeleting: p, rowState: m, onCellChange: h, onDeleteClick: g, onStartEdit: _, onConfirmEdit: v, onCancelEdit: b, refs: x, identityCol: S, href: C, rowActions: T, onRowActionSuccess: E }) {
|
|
1367
|
+
let O = z(), k = me(), A = J(() => !m || Object.keys(m.buffer).length === 0 ? n : {
|
|
1368
|
+
...n,
|
|
1369
|
+
...m.buffer
|
|
1370
|
+
}, [n, m]);
|
|
1371
|
+
if (u === "row_edit" && d) {
|
|
1372
|
+
let e = m?.error ? [...f, `_error:${m.error}`] : f;
|
|
1373
|
+
return /* @__PURE__ */ Q(nt, {
|
|
1374
|
+
values: A,
|
|
1375
|
+
entity: r,
|
|
1376
|
+
columns: o,
|
|
1377
|
+
editableColumns: s,
|
|
1378
|
+
errors: e,
|
|
1379
|
+
saving: m?.saving ?? !1,
|
|
1380
|
+
onChange: (e, n) => h(t, e, n),
|
|
1381
|
+
onConfirm: () => v(t),
|
|
1382
|
+
onCancel: () => b(t),
|
|
1383
|
+
refs: x
|
|
1384
|
+
});
|
|
1385
|
+
}
|
|
1386
|
+
return /* @__PURE__ */ $("div", {
|
|
1387
|
+
style: {
|
|
1388
|
+
border: "1px solid var(--border)",
|
|
1389
|
+
borderRadius: 8,
|
|
1390
|
+
background: "var(--surface)",
|
|
1391
|
+
opacity: p ? .58 : 1,
|
|
1392
|
+
overflow: "hidden"
|
|
1393
|
+
},
|
|
1394
|
+
children: [/* @__PURE__ */ Q("div", {
|
|
1395
|
+
style: {
|
|
1396
|
+
padding: 10,
|
|
1397
|
+
display: "flex",
|
|
1398
|
+
flexDirection: "column",
|
|
1399
|
+
gap: 12
|
|
1400
|
+
},
|
|
1401
|
+
children: o.map((e) => {
|
|
1402
|
+
let n = r.fields.get(e), o = l && u === "inline_edit" && s.has(e), c = C && e === S, d = n ? y(O, n, e, i) : e, f = `${k}-${t}-${e}`, p = `${f}-label`, m = {
|
|
1403
|
+
fontSize: 11.5,
|
|
1404
|
+
fontWeight: 600,
|
|
1405
|
+
color: "var(--text-3)"
|
|
1406
|
+
}, g = n ? j({
|
|
1407
|
+
field: n,
|
|
1408
|
+
fieldName: e,
|
|
1409
|
+
value: A[e],
|
|
1410
|
+
mode: o ? "edit" : "display",
|
|
1411
|
+
onChange: o ? (n) => h(t, e, n) : void 0,
|
|
1412
|
+
record: A,
|
|
1413
|
+
refs: x,
|
|
1414
|
+
compact: o,
|
|
1415
|
+
entity: r,
|
|
1416
|
+
entities: i,
|
|
1417
|
+
screens: c ? void 0 : a,
|
|
1418
|
+
fieldId: f,
|
|
1419
|
+
labelId: p,
|
|
1420
|
+
t: O
|
|
1421
|
+
}) : w(A[e]);
|
|
1422
|
+
return /* @__PURE__ */ $("div", {
|
|
1423
|
+
style: {
|
|
1424
|
+
display: "flex",
|
|
1425
|
+
flexDirection: "column",
|
|
1426
|
+
gap: 5,
|
|
1427
|
+
minWidth: 0
|
|
1428
|
+
},
|
|
1429
|
+
children: [o && n ? /* @__PURE__ */ Q("label", {
|
|
1430
|
+
id: p,
|
|
1431
|
+
htmlFor: f,
|
|
1432
|
+
style: m,
|
|
1433
|
+
children: d
|
|
1434
|
+
}) : /* @__PURE__ */ Q("div", {
|
|
1435
|
+
id: p,
|
|
1436
|
+
style: m,
|
|
1437
|
+
children: d
|
|
1438
|
+
}), /* @__PURE__ */ Q("div", {
|
|
1439
|
+
style: { minWidth: 0 },
|
|
1440
|
+
children: c && !o ? /* @__PURE__ */ Q("a", {
|
|
1441
|
+
href: C,
|
|
1442
|
+
style: {
|
|
1443
|
+
color: "var(--accent)",
|
|
1444
|
+
textDecoration: "none",
|
|
1445
|
+
fontWeight: 500
|
|
1446
|
+
},
|
|
1447
|
+
children: g
|
|
1448
|
+
}) : g
|
|
1449
|
+
})]
|
|
1450
|
+
}, e);
|
|
1451
|
+
})
|
|
1452
|
+
}), (l || T && T.length > 0) && /* @__PURE__ */ $("div", {
|
|
1453
|
+
style: {
|
|
1454
|
+
minHeight: 42,
|
|
1455
|
+
padding: "6px 8px",
|
|
1456
|
+
borderTop: "1px solid var(--divider)",
|
|
1457
|
+
display: "flex",
|
|
1458
|
+
alignItems: "center",
|
|
1459
|
+
justifyContent: "flex-end",
|
|
1460
|
+
gap: 6
|
|
1461
|
+
},
|
|
1462
|
+
children: [l && /* @__PURE__ */ $(ve, { children: [
|
|
1463
|
+
m?.saving && /* @__PURE__ */ Q(D, { size: 12 }),
|
|
1464
|
+
m?.error && /* @__PURE__ */ Q("span", {
|
|
1465
|
+
style: {
|
|
1466
|
+
fontSize: 11,
|
|
1467
|
+
color: "var(--danger)"
|
|
1468
|
+
},
|
|
1469
|
+
title: m.error,
|
|
1470
|
+
children: "!"
|
|
1471
|
+
}),
|
|
1472
|
+
u === "row_edit" && /* @__PURE__ */ Q(c, {
|
|
1473
|
+
size: 32,
|
|
1474
|
+
icon: /* @__PURE__ */ Q(e.edit, { size: 14 }),
|
|
1475
|
+
onClick: () => _(t),
|
|
1476
|
+
title: O("record.row.edit", "Edit row")
|
|
1477
|
+
}),
|
|
1478
|
+
/* @__PURE__ */ Q(c, {
|
|
1479
|
+
size: 32,
|
|
1480
|
+
icon: /* @__PURE__ */ Q(e.trash, { size: 14 }),
|
|
1481
|
+
onClick: () => g(t),
|
|
1482
|
+
title: O("record.row.delete", "Delete row")
|
|
1483
|
+
})
|
|
1484
|
+
] }), !l && T && T.length > 0 && /* @__PURE__ */ Q(ze, {
|
|
1485
|
+
entity: r,
|
|
1486
|
+
actions: T,
|
|
1487
|
+
objectIds: [t],
|
|
1488
|
+
row: A,
|
|
1489
|
+
onSuccess: E
|
|
1490
|
+
})]
|
|
1491
|
+
})]
|
|
1492
|
+
});
|
|
1493
|
+
}
|
|
1494
|
+
function et({ rowId: t, row: n, entity: r, entities: i, screens: a, columns: o, editableColumns: s, editable: l, interaction: u, isEditing: d, editErrors: f, isDeleting: p, activeCell: m, setActiveCell: h, rowState: g, onCellChange: _, onDeleteClick: v, onStartEdit: y, onConfirmEdit: b, onCancelEdit: x, refs: S, identityCol: C, href: T, rowActions: E, onRowActionSuccess: O }) {
|
|
1495
|
+
let k = z(), A = J(() => !g || Object.keys(g.buffer).length === 0 ? n : {
|
|
1496
|
+
...n,
|
|
1497
|
+
...g.buffer
|
|
1498
|
+
}, [n, g]);
|
|
1499
|
+
if (u === "row_edit" && d) {
|
|
1500
|
+
let e = g?.error ? [...f, `_error:${g.error}`] : f;
|
|
1501
|
+
return /* @__PURE__ */ Q(tt, {
|
|
1502
|
+
values: A,
|
|
1503
|
+
entity: r,
|
|
1504
|
+
columns: o,
|
|
1505
|
+
editableColumns: s,
|
|
1506
|
+
errors: e,
|
|
1507
|
+
saving: g?.saving ?? !1,
|
|
1508
|
+
onChange: (e, n) => _(t, e, n),
|
|
1509
|
+
onConfirm: () => b(t),
|
|
1510
|
+
onCancel: () => x(t),
|
|
1511
|
+
refs: S
|
|
1512
|
+
});
|
|
1513
|
+
}
|
|
1514
|
+
let M = ue, N = {
|
|
1515
|
+
padding: "4px 4px",
|
|
1516
|
+
borderBottom: "1px solid var(--divider)",
|
|
1517
|
+
verticalAlign: "middle"
|
|
1518
|
+
}, P = u === "inline_edit";
|
|
1519
|
+
return /* @__PURE__ */ $("tr", {
|
|
1520
|
+
style: { opacity: p ? .5 : 1 },
|
|
1521
|
+
children: [
|
|
1522
|
+
o.map((e) => {
|
|
1523
|
+
let n = r.fields.get(e), o = s.has(e);
|
|
1524
|
+
if (P && m?.rowId === t && m?.col === e && o) return /* @__PURE__ */ Q("td", {
|
|
1525
|
+
style: N,
|
|
1526
|
+
children: n ? j({
|
|
1527
|
+
field: n,
|
|
1528
|
+
fieldName: e,
|
|
1529
|
+
value: A[e],
|
|
1530
|
+
mode: "edit",
|
|
1531
|
+
onChange: (n) => _(t, e, n),
|
|
1532
|
+
record: A,
|
|
1533
|
+
refs: S,
|
|
1534
|
+
compact: !0,
|
|
1535
|
+
t: k
|
|
1536
|
+
}) : w(A[e])
|
|
1537
|
+
}, e);
|
|
1538
|
+
let c = T && e === C, l = n ? j({
|
|
1539
|
+
field: n,
|
|
1540
|
+
fieldName: e,
|
|
1541
|
+
value: A[e],
|
|
1542
|
+
mode: "display",
|
|
1543
|
+
record: A,
|
|
1544
|
+
refs: S,
|
|
1545
|
+
entity: r,
|
|
1546
|
+
entities: i,
|
|
1547
|
+
screens: c ? void 0 : a,
|
|
1548
|
+
t: k
|
|
1549
|
+
}) : w(A[e]), u = P && o && !p;
|
|
1550
|
+
return /* @__PURE__ */ Q("td", {
|
|
1551
|
+
style: {
|
|
1552
|
+
...M,
|
|
1553
|
+
cursor: u ? "pointer" : "default"
|
|
1554
|
+
},
|
|
1555
|
+
onClick: u ? () => h({
|
|
1556
|
+
rowId: t,
|
|
1557
|
+
col: e
|
|
1558
|
+
}) : void 0,
|
|
1559
|
+
children: c ? /* @__PURE__ */ Q("a", {
|
|
1560
|
+
href: T,
|
|
1561
|
+
style: {
|
|
1562
|
+
color: "var(--accent)",
|
|
1563
|
+
textDecoration: "none",
|
|
1564
|
+
fontWeight: 500
|
|
1565
|
+
},
|
|
1566
|
+
onMouseEnter: (e) => e.currentTarget.style.textDecoration = "underline",
|
|
1567
|
+
onMouseLeave: (e) => e.currentTarget.style.textDecoration = "none",
|
|
1568
|
+
children: l
|
|
1569
|
+
}) : l
|
|
1570
|
+
}, e);
|
|
1571
|
+
}),
|
|
1572
|
+
l && /* @__PURE__ */ Q("td", {
|
|
1573
|
+
style: {
|
|
1574
|
+
padding: "4px 8px",
|
|
1575
|
+
borderBottom: "1px solid var(--divider)",
|
|
1576
|
+
verticalAlign: "middle"
|
|
1577
|
+
},
|
|
1578
|
+
children: /* @__PURE__ */ $("div", {
|
|
1579
|
+
style: {
|
|
1580
|
+
display: "flex",
|
|
1581
|
+
alignItems: "center",
|
|
1582
|
+
gap: 4
|
|
1583
|
+
},
|
|
1584
|
+
children: [
|
|
1585
|
+
g?.saving && /* @__PURE__ */ Q(D, { size: 12 }),
|
|
1586
|
+
g?.error && /* @__PURE__ */ Q("span", {
|
|
1587
|
+
style: {
|
|
1588
|
+
fontSize: 11,
|
|
1589
|
+
color: "var(--danger)"
|
|
1590
|
+
},
|
|
1591
|
+
title: g.error,
|
|
1592
|
+
children: "!"
|
|
1593
|
+
}),
|
|
1594
|
+
u === "row_edit" && /* @__PURE__ */ Q(c, {
|
|
1595
|
+
size: 24,
|
|
1596
|
+
icon: /* @__PURE__ */ Q(e.edit, { size: 12 }),
|
|
1597
|
+
onClick: () => y(t),
|
|
1598
|
+
title: k("record.row.edit", "Edit row")
|
|
1599
|
+
}),
|
|
1600
|
+
/* @__PURE__ */ Q(c, {
|
|
1601
|
+
size: 24,
|
|
1602
|
+
icon: /* @__PURE__ */ Q(e.trash, { size: 12 }),
|
|
1603
|
+
onClick: () => v(t),
|
|
1604
|
+
title: k("record.row.delete", "Delete row")
|
|
1605
|
+
})
|
|
1606
|
+
]
|
|
1607
|
+
})
|
|
1608
|
+
}),
|
|
1609
|
+
!l && E && E.length > 0 && /* @__PURE__ */ Q("td", {
|
|
1610
|
+
style: {
|
|
1611
|
+
padding: "4px 8px",
|
|
1612
|
+
borderBottom: "1px solid var(--divider)",
|
|
1613
|
+
verticalAlign: "middle"
|
|
1614
|
+
},
|
|
1615
|
+
children: /* @__PURE__ */ Q(ze, {
|
|
1616
|
+
entity: r,
|
|
1617
|
+
actions: E,
|
|
1618
|
+
objectIds: [t],
|
|
1619
|
+
row: A,
|
|
1620
|
+
onSuccess: O
|
|
1621
|
+
})
|
|
1622
|
+
})
|
|
1623
|
+
]
|
|
1624
|
+
});
|
|
1625
|
+
}
|
|
1626
|
+
function tt({ values: t, entity: n, columns: r, editableColumns: i, errors: a, saving: o, onChange: s, onConfirm: l, onCancel: u, refs: d, accent: f }) {
|
|
1627
|
+
let p = z(), m = a.find((e) => e.startsWith("_error:")), h = new Set(a.filter((e) => !e.startsWith("_error:"))), g = {
|
|
1628
|
+
padding: "6px 12px",
|
|
1629
|
+
borderBottom: "1px solid var(--divider)",
|
|
1630
|
+
verticalAlign: "middle",
|
|
1631
|
+
height: 40,
|
|
1632
|
+
minWidth: 0
|
|
1633
|
+
}, _ = {
|
|
1634
|
+
display: "block",
|
|
1635
|
+
width: "100%",
|
|
1636
|
+
maxWidth: "100%",
|
|
1637
|
+
minWidth: 0
|
|
1638
|
+
};
|
|
1639
|
+
return /* @__PURE__ */ $("tr", {
|
|
1640
|
+
style: f ? { boxShadow: "inset 3px 0 0 var(--accent)" } : void 0,
|
|
1641
|
+
onKeyDown: (e) => {
|
|
1642
|
+
e.key === "Enter" && !e.shiftKey ? (e.preventDefault(), l()) : e.key === "Escape" && (e.preventDefault(), u());
|
|
1643
|
+
},
|
|
1644
|
+
children: [r.map((e) => {
|
|
1645
|
+
let r = n.fields.get(e), a = i.has(e), o = h.has(e);
|
|
1646
|
+
return a ? /* @__PURE__ */ Q("td", {
|
|
1647
|
+
style: {
|
|
1648
|
+
...g,
|
|
1649
|
+
outline: o ? "1px solid var(--danger)" : "none",
|
|
1650
|
+
outlineOffset: -1
|
|
1651
|
+
},
|
|
1652
|
+
title: o ? p("record.row.field_required", "{field} is required", { field: e }) : void 0,
|
|
1653
|
+
children: /* @__PURE__ */ Q("div", {
|
|
1654
|
+
style: _,
|
|
1655
|
+
children: r ? j({
|
|
1656
|
+
field: r,
|
|
1657
|
+
fieldName: e,
|
|
1658
|
+
value: t[e],
|
|
1659
|
+
mode: "edit",
|
|
1660
|
+
onChange: (t) => s(e, t),
|
|
1661
|
+
record: t,
|
|
1662
|
+
refs: d,
|
|
1663
|
+
compact: !0,
|
|
1664
|
+
t: p
|
|
1665
|
+
}) : w(t[e])
|
|
1666
|
+
})
|
|
1667
|
+
}, e) : /* @__PURE__ */ Q("td", {
|
|
1668
|
+
style: {
|
|
1669
|
+
...g,
|
|
1670
|
+
color: "var(--text-3)"
|
|
1671
|
+
},
|
|
1672
|
+
children: r?.auto ? "—" : w(t[e])
|
|
1673
|
+
}, e);
|
|
1674
|
+
}), /* @__PURE__ */ Q("td", {
|
|
1675
|
+
style: g,
|
|
1676
|
+
children: /* @__PURE__ */ $("div", {
|
|
1677
|
+
style: {
|
|
1678
|
+
display: "flex",
|
|
1679
|
+
alignItems: "center",
|
|
1680
|
+
gap: 4,
|
|
1681
|
+
justifyContent: "flex-end"
|
|
1682
|
+
},
|
|
1683
|
+
children: [
|
|
1684
|
+
m && /* @__PURE__ */ Q("span", {
|
|
1685
|
+
style: {
|
|
1686
|
+
fontSize: 11,
|
|
1687
|
+
color: "var(--danger)"
|
|
1688
|
+
},
|
|
1689
|
+
title: m.slice(7),
|
|
1690
|
+
children: "!"
|
|
1691
|
+
}),
|
|
1692
|
+
/* @__PURE__ */ Q(c, {
|
|
1693
|
+
size: 24,
|
|
1694
|
+
icon: Q(o ? D : e.check, { size: 12 }),
|
|
1695
|
+
onClick: l,
|
|
1696
|
+
title: p("record.row.confirm", "Confirm (Enter)")
|
|
1697
|
+
}),
|
|
1698
|
+
/* @__PURE__ */ Q(c, {
|
|
1699
|
+
size: 24,
|
|
1700
|
+
icon: /* @__PURE__ */ Q(e.x, { size: 12 }),
|
|
1701
|
+
onClick: u,
|
|
1702
|
+
title: p("record.row.cancel", "Cancel (Esc)")
|
|
1703
|
+
})
|
|
1704
|
+
]
|
|
1705
|
+
})
|
|
1706
|
+
})]
|
|
1707
|
+
});
|
|
1708
|
+
}
|
|
1709
|
+
function nt({ values: t, entity: n, columns: r, editableColumns: i, errors: a, saving: o, onChange: s, onConfirm: l, onCancel: u, refs: d, accent: f }) {
|
|
1710
|
+
let p = z(), m = me(), h = a.find((e) => e.startsWith("_error:")), g = new Set(a.filter((e) => !e.startsWith("_error:")));
|
|
1711
|
+
return /* @__PURE__ */ $("div", {
|
|
1712
|
+
style: {
|
|
1713
|
+
border: "1px solid var(--border)",
|
|
1714
|
+
borderRadius: 8,
|
|
1715
|
+
background: "var(--surface)",
|
|
1716
|
+
overflow: "hidden",
|
|
1717
|
+
boxShadow: f ? "inset 3px 0 0 var(--accent)" : void 0
|
|
1718
|
+
},
|
|
1719
|
+
onKeyDown: (e) => {
|
|
1720
|
+
e.key === "Enter" && !e.shiftKey ? (e.preventDefault(), l()) : e.key === "Escape" && (e.preventDefault(), u());
|
|
1721
|
+
},
|
|
1722
|
+
children: [/* @__PURE__ */ Q("div", {
|
|
1723
|
+
style: {
|
|
1724
|
+
padding: 10,
|
|
1725
|
+
display: "flex",
|
|
1726
|
+
flexDirection: "column",
|
|
1727
|
+
gap: 12
|
|
1728
|
+
},
|
|
1729
|
+
children: r.map((e) => {
|
|
1730
|
+
let r = n.fields.get(e), a = i.has(e), o = g.has(e), c = r ? y(p, r, e) : e, l = `${m}-${e}`, u = `${l}-label`, f = {
|
|
1731
|
+
fontSize: 11.5,
|
|
1732
|
+
fontWeight: 600,
|
|
1733
|
+
color: "var(--text-3)"
|
|
1734
|
+
};
|
|
1735
|
+
return /* @__PURE__ */ $("div", {
|
|
1736
|
+
style: {
|
|
1737
|
+
display: "flex",
|
|
1738
|
+
flexDirection: "column",
|
|
1739
|
+
gap: 5,
|
|
1740
|
+
minWidth: 0
|
|
1741
|
+
},
|
|
1742
|
+
children: [a && r ? /* @__PURE__ */ Q("label", {
|
|
1743
|
+
id: u,
|
|
1744
|
+
htmlFor: l,
|
|
1745
|
+
style: f,
|
|
1746
|
+
children: c
|
|
1747
|
+
}) : /* @__PURE__ */ Q("div", {
|
|
1748
|
+
id: u,
|
|
1749
|
+
style: f,
|
|
1750
|
+
children: c
|
|
1751
|
+
}), /* @__PURE__ */ Q("div", {
|
|
1752
|
+
style: {
|
|
1753
|
+
minWidth: 0,
|
|
1754
|
+
outline: o ? "1px solid var(--danger)" : "none",
|
|
1755
|
+
outlineOffset: 3,
|
|
1756
|
+
borderRadius: o ? 5 : 0
|
|
1757
|
+
},
|
|
1758
|
+
title: o ? p("record.row.field_required", "{field} is required", { field: e }) : void 0,
|
|
1759
|
+
children: a ? r ? j({
|
|
1760
|
+
field: r,
|
|
1761
|
+
fieldName: e,
|
|
1762
|
+
value: t[e],
|
|
1763
|
+
mode: "edit",
|
|
1764
|
+
onChange: (t) => s(e, t),
|
|
1765
|
+
record: t,
|
|
1766
|
+
refs: d,
|
|
1767
|
+
compact: !0,
|
|
1768
|
+
fieldId: l,
|
|
1769
|
+
labelId: u,
|
|
1770
|
+
t: p
|
|
1771
|
+
}) : w(t[e]) : r?.auto ? "—" : w(t[e])
|
|
1772
|
+
})]
|
|
1773
|
+
}, e);
|
|
1774
|
+
})
|
|
1775
|
+
}), /* @__PURE__ */ $("div", {
|
|
1776
|
+
style: {
|
|
1777
|
+
minHeight: 42,
|
|
1778
|
+
padding: "6px 8px",
|
|
1779
|
+
borderTop: "1px solid var(--divider)",
|
|
1780
|
+
display: "flex",
|
|
1781
|
+
alignItems: "center",
|
|
1782
|
+
justifyContent: "flex-end",
|
|
1783
|
+
gap: 6
|
|
1784
|
+
},
|
|
1785
|
+
children: [
|
|
1786
|
+
h && /* @__PURE__ */ Q("span", {
|
|
1787
|
+
style: {
|
|
1788
|
+
fontSize: 11,
|
|
1789
|
+
color: "var(--danger)"
|
|
1790
|
+
},
|
|
1791
|
+
title: h.slice(7),
|
|
1792
|
+
children: "!"
|
|
1793
|
+
}),
|
|
1794
|
+
/* @__PURE__ */ Q(c, {
|
|
1795
|
+
size: 32,
|
|
1796
|
+
icon: Q(o ? D : e.check, { size: 14 }),
|
|
1797
|
+
onClick: l,
|
|
1798
|
+
title: p("record.row.confirm", "Confirm (Enter)")
|
|
1799
|
+
}),
|
|
1800
|
+
/* @__PURE__ */ Q(c, {
|
|
1801
|
+
size: 32,
|
|
1802
|
+
icon: /* @__PURE__ */ Q(e.x, { size: 14 }),
|
|
1803
|
+
onClick: u,
|
|
1804
|
+
title: p("record.row.cancel", "Cancel (Esc)")
|
|
1805
|
+
})
|
|
1806
|
+
]
|
|
1807
|
+
})]
|
|
1808
|
+
});
|
|
1809
|
+
}
|
|
1810
|
+
function rt({ draftRow: e, entity: t, columns: n, editableColumns: r, foreignKey: i, draftErrors: a, draftSaving: o, onChange: s, onConfirm: c, onCancel: l, refs: u }) {
|
|
1811
|
+
let d = J(() => {
|
|
1812
|
+
let e = new Set(r);
|
|
1813
|
+
return e.delete(i), e;
|
|
1814
|
+
}, [r, i]);
|
|
1815
|
+
return /* @__PURE__ */ Q(tt, {
|
|
1816
|
+
values: e,
|
|
1817
|
+
entity: t,
|
|
1818
|
+
columns: n,
|
|
1819
|
+
editableColumns: d,
|
|
1820
|
+
errors: a,
|
|
1821
|
+
saving: o,
|
|
1822
|
+
onChange: s,
|
|
1823
|
+
onConfirm: c,
|
|
1824
|
+
onCancel: l,
|
|
1825
|
+
refs: u,
|
|
1826
|
+
accent: !0
|
|
1827
|
+
});
|
|
1828
|
+
}
|
|
1829
|
+
function it({ draftRow: e, entity: t, columns: n, editableColumns: r, foreignKey: i, draftErrors: a, draftSaving: o, onChange: s, onConfirm: c, onCancel: l, refs: u }) {
|
|
1830
|
+
let d = J(() => {
|
|
1831
|
+
let e = new Set(r);
|
|
1832
|
+
return e.delete(i), e;
|
|
1833
|
+
}, [r, i]);
|
|
1834
|
+
return /* @__PURE__ */ Q(nt, {
|
|
1835
|
+
values: e,
|
|
1836
|
+
entity: t,
|
|
1837
|
+
columns: n,
|
|
1838
|
+
editableColumns: d,
|
|
1839
|
+
errors: a,
|
|
1840
|
+
saving: o,
|
|
1841
|
+
onChange: s,
|
|
1842
|
+
onConfirm: c,
|
|
1843
|
+
onCancel: l,
|
|
1844
|
+
refs: u,
|
|
1845
|
+
accent: !0
|
|
1846
|
+
});
|
|
1847
|
+
}
|
|
1848
|
+
//#endregion
|
|
1849
|
+
//#region src/components/shared/ErrorBoundary.tsx
|
|
1850
|
+
var at = class extends K {
|
|
1851
|
+
constructor(e) {
|
|
1852
|
+
super(e), this.state = {
|
|
1853
|
+
hasError: !1,
|
|
1854
|
+
error: null
|
|
1855
|
+
};
|
|
1856
|
+
}
|
|
1857
|
+
static getDerivedStateFromError(e) {
|
|
1858
|
+
return {
|
|
1859
|
+
hasError: !0,
|
|
1860
|
+
error: e
|
|
1861
|
+
};
|
|
1862
|
+
}
|
|
1863
|
+
componentDidCatch(e, t) {
|
|
1864
|
+
console.error("[ErrorBoundary]", e, t.componentStack);
|
|
1865
|
+
}
|
|
1866
|
+
handleRetry = () => {
|
|
1867
|
+
this.setState({
|
|
1868
|
+
hasError: !1,
|
|
1869
|
+
error: null
|
|
1870
|
+
});
|
|
1871
|
+
};
|
|
1872
|
+
render() {
|
|
1873
|
+
return this.state.hasError ? this.props.fallback ? this.props.fallback : /* @__PURE__ */ Q(st, {
|
|
1874
|
+
message: this.state.error?.message,
|
|
1875
|
+
onRetry: this.handleRetry
|
|
1876
|
+
}) : this.props.children;
|
|
1877
|
+
}
|
|
1878
|
+
}, ot = R(void 0, "en", "en");
|
|
1879
|
+
function st(e) {
|
|
1880
|
+
return fe(he) ? /* @__PURE__ */ Q(ct, { ...e }) : /* @__PURE__ */ Q(lt, {
|
|
1881
|
+
...e,
|
|
1882
|
+
t: ot,
|
|
1883
|
+
errorTitle: ot
|
|
1884
|
+
});
|
|
1885
|
+
}
|
|
1886
|
+
function ct(e) {
|
|
1887
|
+
let t = z(), n = z("errors");
|
|
1888
|
+
return /* @__PURE__ */ Q(lt, {
|
|
1889
|
+
...e,
|
|
1890
|
+
t,
|
|
1891
|
+
errorTitle: n
|
|
1892
|
+
});
|
|
1893
|
+
}
|
|
1894
|
+
function lt({ message: e, onRetry: t, t: n, errorTitle: r }) {
|
|
1895
|
+
return /* @__PURE__ */ Q("div", {
|
|
1896
|
+
style: {
|
|
1897
|
+
display: "flex",
|
|
1898
|
+
alignItems: "center",
|
|
1899
|
+
justifyContent: "center",
|
|
1900
|
+
minHeight: 200,
|
|
1901
|
+
padding: 32
|
|
1902
|
+
},
|
|
1903
|
+
children: /* @__PURE__ */ $("div", {
|
|
1904
|
+
style: {
|
|
1905
|
+
textAlign: "center",
|
|
1906
|
+
maxWidth: 420,
|
|
1907
|
+
display: "flex",
|
|
1908
|
+
flexDirection: "column",
|
|
1909
|
+
gap: 10
|
|
1910
|
+
},
|
|
1911
|
+
children: [
|
|
1912
|
+
/* @__PURE__ */ Q("h2", {
|
|
1913
|
+
style: {
|
|
1914
|
+
fontSize: 16,
|
|
1915
|
+
fontWeight: 600,
|
|
1916
|
+
margin: 0,
|
|
1917
|
+
color: "var(--text)"
|
|
1918
|
+
},
|
|
1919
|
+
children: r("ui.render_failed", "This part of the page could not be shown.")
|
|
1920
|
+
}),
|
|
1921
|
+
/* @__PURE__ */ Q("p", {
|
|
1922
|
+
style: {
|
|
1923
|
+
fontSize: 12.5,
|
|
1924
|
+
color: "var(--text-3)",
|
|
1925
|
+
margin: 0
|
|
1926
|
+
},
|
|
1927
|
+
children: e || r("ui.render_failed_undescribed", "An unexpected error occurred.")
|
|
1928
|
+
}),
|
|
1929
|
+
/* @__PURE__ */ Q("div", { children: /* @__PURE__ */ Q(m, {
|
|
1930
|
+
onClick: t,
|
|
1931
|
+
children: n("control.try_again", "Try again")
|
|
1932
|
+
}) })
|
|
1933
|
+
]
|
|
1934
|
+
})
|
|
1935
|
+
});
|
|
1936
|
+
}
|
|
1937
|
+
//#endregion
|
|
1938
|
+
//#region src/components/detail-layout/widgets/registry.ts
|
|
1939
|
+
var ut = /* @__PURE__ */ new Map();
|
|
1940
|
+
function dt(e, t) {
|
|
1941
|
+
ut.set(e, t);
|
|
1942
|
+
}
|
|
1943
|
+
function ft(e) {
|
|
1944
|
+
return ut.get(e);
|
|
1945
|
+
}
|
|
1946
|
+
function pt(e) {
|
|
1947
|
+
return ut.has(e);
|
|
1948
|
+
}
|
|
1949
|
+
//#endregion
|
|
1950
|
+
export { Je as a, Ie as c, je as d, we as f, Se as h, at as i, Pe as l, Ce as m, pt as n, Re as o, Te as p, dt as r, Fe as s, ft as t, Ne as u };
|