@declarion/react 0.54.0 → 0.56.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/{DraggableChildrenTable-CPoUY99R.js → DraggableChildrenTable-BV5sb8Uo.js} +32 -32
- package/dist-lib/{Grid--QAEby8k.js → Grid-DWgUPuZ3.js} +45 -45
- package/dist-lib/{JsonEditor-DoNmyrYd.js → JsonEditor-Dz1PQHC8.js} +2 -2
- package/dist-lib/{LayoutRenderer-BxZ7Nd9b.js → LayoutRenderer-C9AH9cXf.js} +716 -714
- package/dist-lib/{ListCardsBody-BPV4GPrv.js → ListCardsBody-DXcDg536.js} +29 -29
- package/dist-lib/{MarkdownRenderer-CIKuh_0i.js → MarkdownRenderer-CcSFc2N3.js} +1 -1
- package/dist-lib/{RefreshControl-DMLkZP3R.js → RefreshControl-CNtN8zSl.js} +41 -41
- package/dist-lib/{SmartDetailPage.impl-SnNu6Ug-.js → SmartDetailPage.impl-lskCd-WG.js} +492 -492
- package/dist-lib/{SmartListPage.impl-C73pR7Iw.js → SmartListPage.impl-CrGbdzyK.js} +744 -743
- package/dist-lib/{SmartRecordListPage.impl-rJjQZe1V.js → SmartRecordListPage.impl-Bkl9aZJ8.js} +129 -129
- package/dist-lib/{SortHeaderMenu-DQ_KrkWk.js → SortHeaderMenu-SYSAaqQJ.js} +1 -1
- package/dist-lib/{action-dispatch-DsuUS7ae.js → action-dispatch-CR4ajBtT.js} +179 -179
- package/dist-lib/api/auth.d.ts +1 -1
- package/dist-lib/api/batch.d.ts +1 -1
- package/dist-lib/api/data.d.ts +3 -3
- package/dist-lib/api/entities.d.ts +1 -1
- package/dist-lib/api/events.d.ts +13 -4
- package/dist-lib/api/params.d.ts +1 -1
- package/dist-lib/api/properties.d.ts +1 -1
- package/dist-lib/api/schema.d.ts +1 -1
- package/dist-lib/api/status.d.ts +1 -1
- package/dist-lib/{cardProjection-BadzqyeQ.js → cardProjection-CW5RIMko.js} +24 -24
- package/dist-lib/components/actions/ActionButton.d.ts +1 -1
- package/dist-lib/components/actions/ActionDialog.d.ts +1 -1
- package/dist-lib/components/actions/ActionRunner.d.ts +1 -1
- package/dist-lib/components/actions/ObjectActionBar.d.ts +3 -3
- package/dist-lib/components/actions/PropertyGridEditor.d.ts +2 -2
- package/dist-lib/components/actions/ResponsiveActionBar.d.ts +2 -2
- package/dist-lib/components/actions/RowActionsKebab.d.ts +1 -1
- package/dist-lib/components/agents/AgentConversationDrawer.d.ts +1 -1
- package/dist-lib/components/agents/AgentPicker.d.ts +1 -1
- package/dist-lib/components/agents/transcript-runs.d.ts +1 -1
- package/dist-lib/components/chrome/AssociationTabs.d.ts +1 -1
- package/dist-lib/components/chrome/Breadcrumbs.d.ts +1 -1
- package/dist-lib/components/detail-layout/AssociatedBlock.d.ts +1 -1
- package/dist-lib/components/detail-layout/AssociatedToolbar.d.ts +1 -1
- package/dist-lib/components/detail-layout/ChildrenBlock.d.ts +2 -2
- package/dist-lib/components/detail-layout/DetailAuditStrip.d.ts +2 -2
- package/dist-lib/components/detail-layout/DetailHighlights.d.ts +3 -3
- package/dist-lib/components/detail-layout/DraggableChildrenTable.d.ts +3 -3
- package/dist-lib/components/detail-layout/EditableChildrenTable.d.ts +3 -3
- package/dist-lib/components/detail-layout/EvidenceBlock.d.ts +1 -1
- package/dist-lib/components/detail-layout/FieldsBlock.d.ts +1 -1
- package/dist-lib/components/detail-layout/LayoutColumn.d.ts +1 -1
- package/dist-lib/components/detail-layout/LayoutRenderer.d.ts +3 -3
- package/dist-lib/components/detail-layout/LayoutRow.d.ts +1 -1
- package/dist-lib/components/detail-layout/LayoutTabs.d.ts +1 -1
- package/dist-lib/components/detail-layout/PropertiesBlock.d.ts +1 -1
- package/dist-lib/components/detail-layout/QuickAddForm.d.ts +2 -2
- package/dist-lib/components/detail-layout/SectionBlock.d.ts +1 -1
- package/dist-lib/components/detail-layout/StatusesBlock.d.ts +1 -1
- package/dist-lib/components/detail-layout/TimelineComposer.d.ts +2 -2
- package/dist-lib/components/detail-layout/blockMeta.d.ts +1 -1
- package/dist-lib/components/detail-layout/useQuickAdd.d.ts +2 -2
- package/dist-lib/components/detail-layout/widgets/WidgetHost.d.ts +1 -1
- package/dist-lib/components/fields/RefCombobox.d.ts +2 -2
- package/dist-lib/components/fields/cells/factories/host-icons.d.ts +1 -1
- package/dist-lib/components/fields/cells/registry.d.ts +2 -2
- package/dist-lib/components/fields/index.d.ts +3 -3
- package/dist-lib/components/file-widgets/helpers.d.ts +1 -1
- package/dist-lib/components/file-widgets/host.d.ts +3 -3
- package/dist-lib/components/file-widgets/payload.d.ts +2 -2
- package/dist-lib/components/file-widgets/types.d.ts +1 -1
- package/dist-lib/components/file-widgets/useEmbedFileSrc.d.ts +1 -1
- package/dist-lib/components/filters/FilterChips.d.ts +1 -1
- package/dist-lib/components/filters/FilterDrawer.d.ts +3 -3
- package/dist-lib/components/layout/CommandPalette.d.ts +2 -2
- package/dist-lib/components/layout/Layout.d.ts +3 -3
- package/dist-lib/components/layout/Rail.d.ts +2 -2
- package/dist-lib/components/layout/Sidebar.d.ts +1 -1
- package/dist-lib/components/layout/TabStrip.d.ts +1 -1
- package/dist-lib/components/layout/TenantChip.d.ts +1 -1
- package/dist-lib/components/layout/TopBar.d.ts +1 -1
- package/dist-lib/components/layout/tab-close.d.ts +1 -1
- package/dist-lib/components/list/InlineEditCell.d.ts +1 -1
- package/dist-lib/components/list/PeekFieldCell.d.ts +2 -2
- package/dist-lib/components/list/QuickPeek.d.ts +3 -3
- package/dist-lib/components/list/ViewSwitcher.d.ts +1 -1
- package/dist-lib/components/pages/DocumentsMenu.d.ts +1 -1
- package/dist-lib/components/pages/ExportMenu.d.ts +1 -1
- package/dist-lib/components/pages/RecordDocumentsPanel.d.ts +1 -1
- package/dist-lib/components/pages/auth/AuthShell.d.ts +1 -1
- package/dist-lib/components/pages/exportRequest.d.ts +1 -1
- package/dist-lib/components/pages/list/ListCardRow.d.ts +3 -3
- package/dist-lib/components/pages/list/ListCardsBody.d.ts +3 -3
- package/dist-lib/components/pages/list/ListFloatbar.d.ts +3 -3
- package/dist-lib/components/pages/list/ListHeader.d.ts +3 -3
- package/dist-lib/components/pages/list/ListNoRows.d.ts +1 -1
- package/dist-lib/components/pages/list/ListTable.d.ts +2 -2
- package/dist-lib/components/pages/list/ListTableRow.d.ts +1 -1
- package/dist-lib/components/pages/list/ListToolbar.d.ts +7 -5
- package/dist-lib/components/pages/list/RowActionsCell.d.ts +1 -1
- package/dist-lib/components/pages/list/RowContextMenu.d.ts +1 -1
- package/dist-lib/components/pages/list/SortHeaderMenu.d.ts +1 -1
- package/dist-lib/components/pages/list/cardProjection.d.ts +2 -2
- package/dist-lib/components/pages/list/columns.d.ts +3 -3
- package/dist-lib/components/pages/list/filter-meta.d.ts +2 -2
- package/dist-lib/components/pages/list/sortable-header.d.ts +1 -1
- package/dist-lib/components/pages/list/table-features.d.ts +1 -1
- package/dist-lib/components/pages/list/use-filter-value-labels.d.ts +4 -4
- package/dist-lib/components/pages/list/useListColumnLayout.d.ts +1 -1
- package/dist-lib/components/pages/list/useListQuery.d.ts +4 -8
- package/dist-lib/components/pages/list/useListRowInteraction.d.ts +4 -4
- package/dist-lib/components/pages/list/useListSelection.d.ts +2 -2
- package/dist-lib/components/pages/list/useListSort.d.ts +1 -1
- package/dist-lib/components/pages/list/useListViews.d.ts +3 -3
- package/dist-lib/components/pages/list/useRowMenu.d.ts +3 -3
- package/dist-lib/components/pages/tenant-params/TenantParamsPage.d.ts +1 -1
- package/dist-lib/components/params/param-editors.d.ts +1 -1
- package/dist-lib/components/primitives/ClassifiedFieldLocked.d.ts +1 -1
- package/dist-lib/components/shared/MarkdownRenderer.d.ts +1 -1
- package/dist-lib/components/shared/StatusGroupsDisplay.d.ts +2 -2
- package/dist-lib/embed/screen-location.d.ts +1 -1
- package/dist-lib/{field-classification-sMkkAEg9.js → field-classification-D6xQYn-h.js} +271 -400
- package/dist-lib/{format-count-B5SLlNOb.js → format-count-Dobmi-Ji.js} +238 -238
- package/dist-lib/hooks/useAgentConversation.d.ts +1 -1
- package/dist-lib/hooks/useAllEntityData.d.ts +1 -1
- package/dist-lib/hooks/useAssociatedData.d.ts +1 -1
- package/dist-lib/hooks/useBranding.d.ts +4 -4
- package/dist-lib/hooks/useBrandingChrome.d.ts +2 -2
- package/dist-lib/hooks/useChildrenData.d.ts +1 -1
- package/dist-lib/hooks/useCurrentScreen.d.ts +1 -1
- package/dist-lib/hooks/useCursorEntityData.d.ts +5 -5
- package/dist-lib/hooks/useEntity.d.ts +1 -1
- package/dist-lib/hooks/useEntityData.d.ts +8 -1
- package/dist-lib/hooks/useFilters.d.ts +1 -1
- package/dist-lib/hooks/useImpersonation.d.ts +1 -1
- package/dist-lib/hooks/useLiveObject.d.ts +2 -2
- package/dist-lib/hooks/useMutations.d.ts +3 -3
- package/dist-lib/hooks/useObject.d.ts +1 -1
- package/dist-lib/hooks/useParams.d.ts +2 -2
- package/dist-lib/hooks/useRealtimeThresholds.d.ts +1 -0
- package/dist-lib/hooks/useRegisterScreenTab.d.ts +1 -1
- package/dist-lib/hooks/useResponsiveMode.d.ts +1 -1
- package/dist-lib/hooks/useSSE.d.ts +1 -2
- package/dist-lib/hooks/useScreen.d.ts +1 -1
- package/dist-lib/hooks/useTimelineData.d.ts +2 -2
- package/dist-lib/hooks/useViews.d.ts +1 -1
- package/dist-lib/index.js +811 -811
- package/dist-lib/lib/action-dispatch.d.ts +2 -2
- package/dist-lib/lib/actions.d.ts +1 -1
- package/dist-lib/lib/brand-tokens.d.ts +1 -1
- package/dist-lib/lib/branding.d.ts +1 -1
- package/dist-lib/lib/child-config.d.ts +1 -1
- package/dist-lib/lib/children-validation.d.ts +2 -2
- package/dist-lib/lib/document-templates.d.ts +1 -1
- package/dist-lib/lib/evidence-verdict.d.ts +1 -1
- package/dist-lib/lib/mass-edit.d.ts +1 -1
- package/dist-lib/lib/messages.d.ts +2 -2
- package/dist-lib/lib/realtime-query-keys.d.ts +22 -0
- package/dist-lib/lib/realtime-reconcile.d.ts +1 -10
- package/dist-lib/lib/realtime-resync.d.ts +23 -0
- package/dist-lib/lib/rich-text.d.ts +1 -1
- package/dist-lib/lib/schema-routing.d.ts +1 -1
- package/dist-lib/lib/screen-back.d.ts +1 -1
- package/dist-lib/lib/size-value.d.ts +1 -1
- package/dist-lib/lib/toast.d.ts +2 -2
- package/dist-lib/lib/ui-actions.d.ts +1 -1
- package/dist-lib/lib/variants.d.ts +1 -1
- package/dist-lib/{peekDraftStore-CbHFwz_F.js → peekDraftStore-5wQ7lq_V.js} +17 -17
- package/dist-lib/{registry-D0RhCnEL.js → registry-CjgUaF7C.js} +511 -511
- package/dist-lib/stores/auth.d.ts +1 -1
- package/dist-lib/stores/preferences.d.ts +1 -1
- package/dist-lib/stores/realtime.d.ts +86 -19
- package/dist-lib/testing.d.ts +4 -4
- package/dist-lib/testing.js +40 -40
- package/dist-lib/types/api.d.ts +1 -1
- package/dist-lib/types/schema.d.ts +2 -2
- package/dist-lib/{useCurrentScreen-DVTXCj_K.js → useCurrentScreen-CzwzQpoW.js} +2476 -1967
- package/dist-lib/useListQuery-D7Hr5WM1.js +96 -0
- package/dist-lib/{useProperties-BcIz-MyO.js → useProperties-CqtCzFCr.js} +25 -25
- package/dist-lib/{useTabSearchMirror-UYCsopxP.js → useTabSearchMirror-C39U85cg.js} +13 -13
- package/dist-lib/{value-CQzGOI0F.js → value-Bo8C8WMU.js} +4 -4
- package/package.json +10 -10
- package/dist-lib/useListQuery-C2nq58YV.js +0 -90
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { s as e, t } from "./DynamicIcon-DW5krHuX.js";
|
|
2
|
-
import { $
|
|
3
|
-
import { O as
|
|
4
|
-
import { c as
|
|
5
|
-
import { n as
|
|
6
|
-
import { Component as
|
|
7
|
-
import { useInfiniteQuery as
|
|
2
|
+
import { $n as n, $t as r, Br as i, Cr as a, D as o, Er as s, F as c, Gn as l, H as u, Lr as d, Mr as f, O as p, Or as m, P as h, Q as g, Qn as _, Qt as v, V as y, Vr as b, W as x, X as S, Xt as C, Y as w, Zn as T, Zt as E, cr as D, en as O, et as k, gt as A, hr as j, i as M, in as N, jt as P, kr as F, ln as I, mr as L, nn as R, nr as z, q as B, tr as V, tt as H, un as U, wn as W, xt as ee, zr as G } from "./useCurrentScreen-CzwzQpoW.js";
|
|
3
|
+
import { O as te } from "./field-classification-D6xQYn-h.js";
|
|
4
|
+
import { c as ne, l as re, o as ie, t as ae } from "./action-dispatch-CR4ajBtT.js";
|
|
5
|
+
import { n as oe, r as se, t as K } from "./dataTableStyles-vwD1mVOP.js";
|
|
6
|
+
import { Component as ce, useCallback as q, useEffect as le, useId as ue, useMemo as J, useRef as Y, useState as X } from "react";
|
|
7
|
+
import { useInfiniteQuery as de, useQuery as fe, useQueryClient as pe } from "@tanstack/react-query";
|
|
8
8
|
import { Fragment as me, jsx as Z, jsxs as Q } from "react/jsx-runtime";
|
|
9
9
|
import { clsx as he } from "clsx";
|
|
10
10
|
import { twMerge as ge } from "tailwind-merge";
|
|
@@ -19,8 +19,8 @@ var $ = {
|
|
|
19
19
|
shadow: "none"
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
|
-
function _e({ title: t, subtitle: n, right: r, badge:
|
|
23
|
-
let [h, g] =
|
|
22
|
+
function _e({ title: t, subtitle: n, right: r, badge: a, count: o, children: s, footer: c, collapsible: l = !0, defaultOpen: u = !0, icon: d, emphasis: f = "primary", headingLevel: p = 2, padding: m = "16px" }) {
|
|
23
|
+
let [h, g] = X(u), _ = $[f] ?? $.primary;
|
|
24
24
|
return /* @__PURE__ */ Q("div", {
|
|
25
25
|
"data-emphasis": f,
|
|
26
26
|
style: {
|
|
@@ -89,7 +89,7 @@ function _e({ title: t, subtitle: n, right: r, badge: i, count: a, children: o,
|
|
|
89
89
|
},
|
|
90
90
|
children: t
|
|
91
91
|
}),
|
|
92
|
-
|
|
92
|
+
o !== void 0 && /* @__PURE__ */ Z("span", {
|
|
93
93
|
className: "num",
|
|
94
94
|
style: {
|
|
95
95
|
fontSize: 11,
|
|
@@ -102,7 +102,7 @@ function _e({ title: t, subtitle: n, right: r, badge: i, count: a, children: o,
|
|
|
102
102
|
textAlign: "center",
|
|
103
103
|
flexShrink: 0
|
|
104
104
|
},
|
|
105
|
-
children:
|
|
105
|
+
children: o
|
|
106
106
|
}),
|
|
107
107
|
n && /* @__PURE__ */ Z("div", {
|
|
108
108
|
style: {
|
|
@@ -118,14 +118,14 @@ function _e({ title: t, subtitle: n, right: r, badge: i, count: a, children: o,
|
|
|
118
118
|
]
|
|
119
119
|
})
|
|
120
120
|
}),
|
|
121
|
-
|
|
122
|
-
tone:
|
|
121
|
+
a && /* @__PURE__ */ Z(G, {
|
|
122
|
+
tone: a.tone ?? "violet",
|
|
123
123
|
size: "xs",
|
|
124
|
-
dot:
|
|
125
|
-
children:
|
|
124
|
+
dot: a.dot,
|
|
125
|
+
children: a.text
|
|
126
126
|
}),
|
|
127
127
|
r,
|
|
128
|
-
l && /* @__PURE__ */ Z(
|
|
128
|
+
l && /* @__PURE__ */ Z(i, {
|
|
129
129
|
size: 24,
|
|
130
130
|
icon: Z(h ? e.up : e.down, { size: 14 }),
|
|
131
131
|
onClick: () => g((e) => !e),
|
|
@@ -135,7 +135,7 @@ function _e({ title: t, subtitle: n, right: r, badge: i, count: a, children: o,
|
|
|
135
135
|
}),
|
|
136
136
|
h && /* @__PURE__ */ Z("div", {
|
|
137
137
|
style: { padding: m },
|
|
138
|
-
children:
|
|
138
|
+
children: s
|
|
139
139
|
}),
|
|
140
140
|
c && h && /* @__PURE__ */ Z("div", {
|
|
141
141
|
style: {
|
|
@@ -171,31 +171,31 @@ function be(e) {
|
|
|
171
171
|
}
|
|
172
172
|
//#endregion
|
|
173
173
|
//#region src/hooks/useAssociatedData.ts
|
|
174
|
-
function xe(e, t, n, r, i, a,
|
|
175
|
-
let
|
|
176
|
-
return
|
|
174
|
+
function xe(e, t, n, r, i, a, s, c) {
|
|
175
|
+
let l = c ? JSON.stringify(Object.entries(c).sort()) : void 0;
|
|
176
|
+
return de({
|
|
177
177
|
queryKey: [
|
|
178
|
-
|
|
178
|
+
o,
|
|
179
179
|
e,
|
|
180
180
|
t,
|
|
181
181
|
n,
|
|
182
182
|
i,
|
|
183
183
|
a,
|
|
184
|
-
|
|
185
|
-
|
|
184
|
+
s,
|
|
185
|
+
l
|
|
186
186
|
],
|
|
187
187
|
queryFn: ({ pageParam: e }) => {
|
|
188
|
-
let
|
|
188
|
+
let o = new URLSearchParams(), l = [{
|
|
189
189
|
field: r,
|
|
190
190
|
op: "eq",
|
|
191
191
|
value: t
|
|
192
192
|
}];
|
|
193
|
-
if (
|
|
193
|
+
if (c) for (let [e, t] of Object.entries(c)) t && t !== "__all__" && l.push({
|
|
194
194
|
field: e,
|
|
195
195
|
op: "eq",
|
|
196
196
|
value: t
|
|
197
197
|
});
|
|
198
|
-
return
|
|
198
|
+
return o.set("filters", JSON.stringify(l)), i && o.set("sort", i), a && o.set("limit", String(a)), s && o.set("search", s), e && o.set("after", e), W(`/api/data/${n}?${o.toString()}`);
|
|
199
199
|
},
|
|
200
200
|
getNextPageParam: (e) => e.meta?.has_more ? e.meta.cursor : void 0,
|
|
201
201
|
initialPageParam: void 0,
|
|
@@ -204,146 +204,146 @@ function xe(e, t, n, r, i, a, o, s) {
|
|
|
204
204
|
}
|
|
205
205
|
//#endregion
|
|
206
206
|
//#region src/components/actions/ActionButton.tsx
|
|
207
|
-
function Se({ actionCode:
|
|
208
|
-
let [
|
|
209
|
-
if (
|
|
210
|
-
|
|
207
|
+
function Se({ actionCode: n, action: r, entityCode: a, objectIds: o = [], row: s, variant: l = "outline", size: u = "default", onSuccess: d }) {
|
|
208
|
+
let [f, p] = X(!1), [m, _] = X(!1), { data: v } = U(), y = te(), { run: S } = M(), T = w(r), E = !s || x(r.conditions, s), D = q(async () => {
|
|
209
|
+
if (r.association && o.length !== 0) {
|
|
210
|
+
p(!0);
|
|
211
211
|
try {
|
|
212
|
-
let e = a ? `${a}.${
|
|
213
|
-
if (!
|
|
214
|
-
|
|
212
|
+
let e = a ? `${a}.${r.association}` : r.association, t = await N(e, o), n = B(v, t.target_entity);
|
|
213
|
+
if (!n) {
|
|
214
|
+
P.error(`No list screen found for ${t.target_entity}`);
|
|
215
215
|
return;
|
|
216
216
|
}
|
|
217
|
-
let
|
|
217
|
+
let i = v?.entities[t.target_entity], s = z(r.display?.name) || t.target_entity;
|
|
218
218
|
if (t.ids.length === 0) {
|
|
219
|
-
|
|
219
|
+
P.info(`No related ${s} found`);
|
|
220
220
|
return;
|
|
221
221
|
}
|
|
222
|
-
let
|
|
223
|
-
|
|
224
|
-
title:
|
|
225
|
-
icon:
|
|
226
|
-
search:
|
|
227
|
-
}),
|
|
222
|
+
let c = i?.fields.names().find((e) => i.fields.get(e)?.primary) ?? "id", l = new URLSearchParams();
|
|
223
|
+
l.set(`filter_${c}`, t.ids.join(",")), y(n.route, {
|
|
224
|
+
title: s,
|
|
225
|
+
icon: r.display?.icon || n.icon,
|
|
226
|
+
search: l.toString()
|
|
227
|
+
}), d?.();
|
|
228
228
|
} catch (e) {
|
|
229
|
-
|
|
229
|
+
P.error(e instanceof Error ? e.message : "Failed to resolve association");
|
|
230
230
|
} finally {
|
|
231
|
-
|
|
231
|
+
p(!1);
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
234
|
}, [
|
|
235
|
-
|
|
235
|
+
r,
|
|
236
236
|
a,
|
|
237
237
|
o,
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
]),
|
|
242
|
-
|
|
243
|
-
action:
|
|
244
|
-
title:
|
|
245
|
-
row:
|
|
238
|
+
v,
|
|
239
|
+
y,
|
|
240
|
+
d
|
|
241
|
+
]), k = r.entity ? `${r.entity}.${n}` : n, A = o.length > 0 ? o : void 0, j = q(() => {
|
|
242
|
+
_(!0), S({
|
|
243
|
+
action: r,
|
|
244
|
+
title: z(r.display?.name) || n,
|
|
245
|
+
row: s,
|
|
246
246
|
entity: a,
|
|
247
|
-
execute: (e) =>
|
|
248
|
-
onSuccess: () =>
|
|
249
|
-
}).finally(() =>
|
|
247
|
+
execute: (e) => O(k, C(e, A)),
|
|
248
|
+
onSuccess: () => d?.()
|
|
249
|
+
}).finally(() => _(!1));
|
|
250
250
|
}, [
|
|
251
|
-
|
|
252
|
-
i,
|
|
251
|
+
S,
|
|
253
252
|
r,
|
|
254
|
-
|
|
253
|
+
n,
|
|
254
|
+
s,
|
|
255
255
|
a,
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
]),
|
|
260
|
-
if (
|
|
261
|
-
|
|
256
|
+
k,
|
|
257
|
+
A,
|
|
258
|
+
d
|
|
259
|
+
]), F = q(() => {
|
|
260
|
+
if (c(r)) {
|
|
261
|
+
h(r.ui_steps, { row: s }).then(() => d?.());
|
|
262
262
|
return;
|
|
263
263
|
}
|
|
264
|
-
if (
|
|
265
|
-
|
|
264
|
+
if (T) {
|
|
265
|
+
D();
|
|
266
266
|
return;
|
|
267
267
|
}
|
|
268
|
-
if (
|
|
269
|
-
let e = a ?
|
|
270
|
-
a && (
|
|
271
|
-
title:
|
|
272
|
-
icon:
|
|
273
|
-
}),
|
|
268
|
+
if (r.href && !r.handler && !r.association) {
|
|
269
|
+
let e = a ? v?.entities[a] : void 0, t = g(s, e), i = r.href;
|
|
270
|
+
a && (i = i.replaceAll("${entity}", a)), t && (i = i.replaceAll("${id}", encodeURIComponent(t))), y(i, {
|
|
271
|
+
title: z(r.display?.name) || n,
|
|
272
|
+
icon: r.display?.icon
|
|
273
|
+
}), d?.();
|
|
274
274
|
return;
|
|
275
275
|
}
|
|
276
|
-
|
|
276
|
+
j();
|
|
277
277
|
}, [
|
|
278
|
-
i,
|
|
279
|
-
d,
|
|
280
|
-
a,
|
|
281
|
-
S?.entities,
|
|
282
278
|
r,
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
279
|
+
s,
|
|
280
|
+
a,
|
|
281
|
+
v?.entities,
|
|
282
|
+
n,
|
|
283
|
+
y,
|
|
284
|
+
T,
|
|
285
|
+
D,
|
|
286
|
+
j,
|
|
287
|
+
d
|
|
288
|
+
]), I = z(r.display?.name), L = r.display?.icon, R = L && e[L], V = R ? /* @__PURE__ */ Z(R, { size: 13 }) : L ? /* @__PURE__ */ Z(t, {
|
|
289
|
+
name: L,
|
|
290
290
|
size: 13
|
|
291
|
-
}) : null, H = !
|
|
292
|
-
return
|
|
291
|
+
}) : null, H = !E || m || f;
|
|
292
|
+
return u === "icon" ? /* @__PURE__ */ Z(i, {
|
|
293
293
|
icon: V ?? /* @__PURE__ */ Z(e.bolt, { size: 13 }),
|
|
294
|
-
onClick:
|
|
295
|
-
title:
|
|
296
|
-
}) : /* @__PURE__ */ Z(
|
|
297
|
-
kind:
|
|
294
|
+
onClick: F,
|
|
295
|
+
title: I
|
|
296
|
+
}) : /* @__PURE__ */ Z(b, {
|
|
297
|
+
kind: l === "default" ? "primary" : l === "ghost" ? "ghost" : "default",
|
|
298
298
|
size: "sm",
|
|
299
299
|
icon: V,
|
|
300
|
-
danger:
|
|
301
|
-
onClick:
|
|
300
|
+
danger: r.destructive,
|
|
301
|
+
onClick: F,
|
|
302
302
|
disabled: H,
|
|
303
|
-
title:
|
|
304
|
-
"aria-label":
|
|
305
|
-
children:
|
|
303
|
+
title: I,
|
|
304
|
+
"aria-label": I,
|
|
305
|
+
children: I
|
|
306
306
|
});
|
|
307
307
|
}
|
|
308
308
|
//#endregion
|
|
309
309
|
//#region src/components/actions/RowActionsKebab.tsx
|
|
310
|
-
function Ce({ actions: t, objectIds: n, row: r, entity:
|
|
311
|
-
let f =
|
|
310
|
+
function Ce({ actions: t, objectIds: n, row: r, entity: a, onSuccess: o, preMenu: s, divider: c, size: l = 22, align: u = "end" }) {
|
|
311
|
+
let f = Y(null), [p, m] = X(!1), [h, g] = X(null), { run: _ } = M(), v = J(() => {
|
|
312
312
|
let e = {};
|
|
313
313
|
for (let { code: n, action: r } of t) e[n] = r;
|
|
314
314
|
return e;
|
|
315
|
-
}, [t]), b =
|
|
315
|
+
}, [t]), b = J(() => {
|
|
316
316
|
let e = t.map(({ code: e }) => ({
|
|
317
317
|
kind: "action",
|
|
318
318
|
code: e,
|
|
319
319
|
enabled: !0,
|
|
320
320
|
reason: null
|
|
321
321
|
}));
|
|
322
|
-
return r ?
|
|
322
|
+
return r ? y(e, v, void 0, r, [], ie(a, r)) : e;
|
|
323
323
|
}, [
|
|
324
324
|
t,
|
|
325
|
-
|
|
325
|
+
v,
|
|
326
326
|
r,
|
|
327
|
-
|
|
328
|
-
]), x =
|
|
327
|
+
a
|
|
328
|
+
]), x = q((e, t) => {
|
|
329
329
|
m(!1);
|
|
330
330
|
let i = t.entity ? `${t.entity}.${e}` : e;
|
|
331
|
-
return
|
|
331
|
+
return _({
|
|
332
332
|
action: t,
|
|
333
|
-
title:
|
|
333
|
+
title: z(t.display?.name) || e,
|
|
334
334
|
row: r,
|
|
335
335
|
execute: async (e) => {
|
|
336
|
-
let t = await
|
|
337
|
-
return
|
|
336
|
+
let t = await O(i, C(e, n));
|
|
337
|
+
return o?.(), t;
|
|
338
338
|
}
|
|
339
339
|
});
|
|
340
340
|
}, [
|
|
341
|
-
|
|
341
|
+
_,
|
|
342
342
|
r,
|
|
343
343
|
n,
|
|
344
|
-
|
|
344
|
+
o
|
|
345
345
|
]);
|
|
346
|
-
return !
|
|
346
|
+
return !s && b.length === 0 ? null : /* @__PURE__ */ Q("div", {
|
|
347
347
|
className: "sl-row-actions",
|
|
348
348
|
"data-open": p ? "true" : void 0,
|
|
349
349
|
style: {
|
|
@@ -351,24 +351,24 @@ function Ce({ actions: t, objectIds: n, row: r, entity: i, onSuccess: a, preMenu
|
|
|
351
351
|
alignItems: "center",
|
|
352
352
|
justifyContent: "flex-end"
|
|
353
353
|
},
|
|
354
|
-
children: [/* @__PURE__ */ Z(
|
|
354
|
+
children: [/* @__PURE__ */ Z(i, {
|
|
355
355
|
ref: f,
|
|
356
|
-
size:
|
|
357
|
-
icon: /* @__PURE__ */ Z(e.more, { size: Math.round(
|
|
356
|
+
size: l,
|
|
357
|
+
icon: /* @__PURE__ */ Z(e.more, { size: Math.round(l * .55) }),
|
|
358
358
|
onClick: () => m((e) => !e),
|
|
359
359
|
title: "Actions"
|
|
360
|
-
}), /* @__PURE__ */ Q(
|
|
360
|
+
}), /* @__PURE__ */ Q(d, {
|
|
361
361
|
open: p,
|
|
362
362
|
anchor: f.current,
|
|
363
363
|
onClose: () => m(!1),
|
|
364
364
|
width: 200,
|
|
365
|
-
align:
|
|
365
|
+
align: u,
|
|
366
366
|
children: [
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
/* @__PURE__ */ Z(
|
|
367
|
+
s,
|
|
368
|
+
s && c && b.length > 0 && /* @__PURE__ */ Z(F, { divider: !0 }),
|
|
369
|
+
/* @__PURE__ */ Z(re, {
|
|
370
370
|
layout: b,
|
|
371
|
-
entityActions:
|
|
371
|
+
entityActions: v,
|
|
372
372
|
onRun: x,
|
|
373
373
|
loading: h,
|
|
374
374
|
onLoadingChange: g,
|
|
@@ -380,82 +380,82 @@ function Ce({ actions: t, objectIds: n, row: r, entity: i, onSuccess: a, preMenu
|
|
|
380
380
|
}
|
|
381
381
|
//#endregion
|
|
382
382
|
//#region src/components/detail-layout/AssociatedToolbar.tsx
|
|
383
|
-
function we({ entity: t, searchable:
|
|
384
|
-
let
|
|
385
|
-
return !
|
|
383
|
+
function we({ entity: t, searchable: r, filterFields: i, searchValue: o, onSearchChange: c, filters: l, onFilterChange: u, allEntities: d }) {
|
|
384
|
+
let f = r === !0, p = i && i.length > 0;
|
|
385
|
+
return !f && !p ? null : /* @__PURE__ */ Q("div", {
|
|
386
386
|
style: {
|
|
387
387
|
display: "flex",
|
|
388
388
|
alignItems: "center",
|
|
389
389
|
gap: 6,
|
|
390
390
|
marginBottom: 8
|
|
391
391
|
},
|
|
392
|
-
children: [
|
|
392
|
+
children: [f && /* @__PURE__ */ Z("div", {
|
|
393
393
|
style: {
|
|
394
394
|
flex: 1,
|
|
395
395
|
maxWidth: 220
|
|
396
396
|
},
|
|
397
|
-
children: /* @__PURE__ */ Z(
|
|
398
|
-
value:
|
|
399
|
-
onChange:
|
|
397
|
+
children: /* @__PURE__ */ Z(s, {
|
|
398
|
+
value: o,
|
|
399
|
+
onChange: c,
|
|
400
400
|
placeholder: "Search…",
|
|
401
401
|
prefix: /* @__PURE__ */ Z(e.search, { size: 12 })
|
|
402
402
|
})
|
|
403
|
-
}),
|
|
404
|
-
let
|
|
405
|
-
if (!
|
|
406
|
-
let
|
|
407
|
-
if (
|
|
408
|
-
field:
|
|
409
|
-
label:
|
|
410
|
-
value:
|
|
411
|
-
onChange: (t) =>
|
|
403
|
+
}), p && i.map((e) => {
|
|
404
|
+
let r = t.fields.get(e);
|
|
405
|
+
if (!r) return null;
|
|
406
|
+
let i = l[e] ?? "__all__", o = n(r, e, d);
|
|
407
|
+
if (r.type === "ref" && r.ref?.entity) return /* @__PURE__ */ Z(Te, {
|
|
408
|
+
field: r,
|
|
409
|
+
label: o,
|
|
410
|
+
value: i,
|
|
411
|
+
onChange: (t) => u(e, t)
|
|
412
412
|
}, e);
|
|
413
|
-
if (!
|
|
414
|
-
let
|
|
413
|
+
if (!r.values) return null;
|
|
414
|
+
let s = [{
|
|
415
415
|
value: "__all__",
|
|
416
|
-
label: `All ${
|
|
417
|
-
}, ...
|
|
416
|
+
label: `All ${o}`
|
|
417
|
+
}, ...r.values.map((e) => ({
|
|
418
418
|
value: e.code,
|
|
419
|
-
label:
|
|
419
|
+
label: z(e.name) || e.code
|
|
420
420
|
}))];
|
|
421
421
|
return /* @__PURE__ */ Z("div", {
|
|
422
422
|
style: { width: 160 },
|
|
423
|
-
children: /* @__PURE__ */ Z(
|
|
424
|
-
value:
|
|
425
|
-
options:
|
|
426
|
-
onChange: (t) =>
|
|
427
|
-
placeholder:
|
|
423
|
+
children: /* @__PURE__ */ Z(a, {
|
|
424
|
+
value: i,
|
|
425
|
+
options: s,
|
|
426
|
+
onChange: (t) => u(e, t),
|
|
427
|
+
placeholder: o
|
|
428
428
|
})
|
|
429
429
|
}, e);
|
|
430
430
|
})]
|
|
431
431
|
});
|
|
432
432
|
}
|
|
433
433
|
function Te({ field: e, label: t, value: n, onChange: r }) {
|
|
434
|
-
let
|
|
434
|
+
let i = A(e.ref?.entity), o = e.display?.ref_display_field ?? i?.display?.display_field, s = J(() => i ? [...i.fields].find(([, e]) => e.primary)?.[0] ?? "id" : "id", [i]), { data: c } = ee(e.ref?.entity, {
|
|
435
435
|
per_page: 200,
|
|
436
436
|
sort: o ? `${o}:asc` : void 0
|
|
437
|
-
}),
|
|
437
|
+
}), u = c?.data ?? [], d = (e) => {
|
|
438
438
|
if (e == null) return "—";
|
|
439
439
|
if (typeof e == "object" && !Array.isArray(e)) {
|
|
440
440
|
let t = Object.values(e)[0];
|
|
441
|
-
return t == null ? "—" :
|
|
441
|
+
return t == null ? "—" : L(t);
|
|
442
442
|
}
|
|
443
|
-
return
|
|
444
|
-
},
|
|
443
|
+
return L(e);
|
|
444
|
+
}, f = [{
|
|
445
445
|
value: "__all__",
|
|
446
446
|
label: `All ${t}`
|
|
447
|
-
}, ...
|
|
448
|
-
let t = String(e[s]), n = e[
|
|
447
|
+
}, ...u.map((e) => {
|
|
448
|
+
let t = String(e[s]), n = e[l];
|
|
449
449
|
return {
|
|
450
450
|
value: t,
|
|
451
|
-
label: typeof n == "string" && n !== "" ? n : o ?
|
|
451
|
+
label: typeof n == "string" && n !== "" ? n : o ? d(e[o] ?? t) : t
|
|
452
452
|
};
|
|
453
453
|
})];
|
|
454
454
|
return /* @__PURE__ */ Z("div", {
|
|
455
455
|
style: { width: 160 },
|
|
456
|
-
children: /* @__PURE__ */ Z(
|
|
456
|
+
children: /* @__PURE__ */ Z(a, {
|
|
457
457
|
value: n,
|
|
458
|
-
options:
|
|
458
|
+
options: f,
|
|
459
459
|
onChange: r,
|
|
460
460
|
placeholder: t
|
|
461
461
|
})
|
|
@@ -466,7 +466,7 @@ function Te({ field: e, label: t, value: n, onChange: r }) {
|
|
|
466
466
|
function Ee(e) {
|
|
467
467
|
if (!e) return [];
|
|
468
468
|
let t = [];
|
|
469
|
-
for (let [n, r] of Object.entries(e)) (r.visibility ?? []).includes("list_row") && (r.association ||
|
|
469
|
+
for (let [n, r] of Object.entries(e)) (r.visibility ?? []).includes("list_row") && (r.association || S(n) || t.push({
|
|
470
470
|
code: n,
|
|
471
471
|
action: r
|
|
472
472
|
}));
|
|
@@ -488,7 +488,7 @@ function De(e, t, n) {
|
|
|
488
488
|
let n = a.resolved_params.items().filter((e) => e.name !== t);
|
|
489
489
|
e = {
|
|
490
490
|
...e,
|
|
491
|
-
resolved_params: new
|
|
491
|
+
resolved_params: new j(n)
|
|
492
492
|
};
|
|
493
493
|
}
|
|
494
494
|
r.push({
|
|
@@ -521,7 +521,7 @@ function Oe(e, t, n) {
|
|
|
521
521
|
return null;
|
|
522
522
|
}
|
|
523
523
|
function ke(e, t, n) {
|
|
524
|
-
let r = new Set(
|
|
524
|
+
let r = new Set(V(e));
|
|
525
525
|
return new Set(t.filter((t) => {
|
|
526
526
|
if (t === n || r.has(t)) return !1;
|
|
527
527
|
let i = e.fields.get(t);
|
|
@@ -583,55 +583,55 @@ function Ne({ node: n, ctx: r, assocCode: i, assocEntity: a, fkField: o }) {
|
|
|
583
583
|
if (e === o) return !1;
|
|
584
584
|
let t = a.fields.get(e);
|
|
585
585
|
return !(!t || t.primary || t.display?.is_listable === !1);
|
|
586
|
-
}),
|
|
586
|
+
}), c = T(a, "update"), l = n.interaction ?? (c ? "navigate" : "readonly"), d = (l === "inline_edit" || l === "row_edit") && c && n.editable !== !1, f = z(a.display?.name_plural) || z(a.display?.name) || i, p = n.searchable === !0 || n.filters && n.filters.length > 0, m = J(() => De(a.actions, o, r.recordId), [
|
|
587
587
|
a.actions,
|
|
588
588
|
o,
|
|
589
589
|
r.recordId
|
|
590
|
-
]),
|
|
590
|
+
]), h = J(() => {
|
|
591
591
|
let e = {};
|
|
592
|
-
for (let { code: t, action: n } of
|
|
592
|
+
for (let { code: t, action: n } of m) e[t] = n;
|
|
593
593
|
return e;
|
|
594
|
-
}, [
|
|
594
|
+
}, [m]), g = J(() => {
|
|
595
595
|
let e = a.action_layout ?? null;
|
|
596
|
-
return
|
|
597
|
-
}, [a.action_layout,
|
|
596
|
+
return y(e ?? u(h, "list_toolbar"), h, void 0, {}, []);
|
|
597
|
+
}, [a.action_layout, h]), { run: _ } = M(), v = te(), x = k(), S = J(() => ({
|
|
598
598
|
entity: a,
|
|
599
599
|
entityCode: i,
|
|
600
600
|
screenRoute: typeof window < "u" ? window.location.pathname : "",
|
|
601
601
|
selectedRows: [],
|
|
602
602
|
selectedIds: [],
|
|
603
603
|
locale: x,
|
|
604
|
-
tabNavigate: (e, t) =>
|
|
604
|
+
tabNavigate: (e, t) => v(e, {
|
|
605
605
|
title: t?.title,
|
|
606
606
|
icon: t?.icon,
|
|
607
607
|
search: t?.search
|
|
608
608
|
}),
|
|
609
|
-
runActionApi: (e, t) =>
|
|
609
|
+
runActionApi: (e, t) => O(e, t)
|
|
610
610
|
}), [
|
|
611
611
|
a,
|
|
612
612
|
i,
|
|
613
613
|
x,
|
|
614
|
-
|
|
615
|
-
]),
|
|
616
|
-
|
|
614
|
+
v
|
|
615
|
+
]), w = pe(), E = q(() => {
|
|
616
|
+
w.invalidateQueries({ predicate: (e) => {
|
|
617
617
|
let t = e.queryKey;
|
|
618
618
|
return t[0] === "entity-children" && t[3] === i;
|
|
619
619
|
} });
|
|
620
|
-
}, [
|
|
621
|
-
let n =
|
|
622
|
-
if (n !== null) return
|
|
620
|
+
}, [w, i]), D = q((e, t) => {
|
|
621
|
+
let n = ae(e, t, {}, i);
|
|
622
|
+
if (n !== null) return _({
|
|
623
623
|
action: t,
|
|
624
|
-
title:
|
|
624
|
+
title: z(t.display?.name) || e,
|
|
625
625
|
execute: async (e) => {
|
|
626
|
-
let t = await
|
|
627
|
-
return
|
|
626
|
+
let t = await O(n, C(e, void 0));
|
|
627
|
+
return E(), t;
|
|
628
628
|
}
|
|
629
629
|
});
|
|
630
630
|
}, [
|
|
631
|
-
|
|
631
|
+
_,
|
|
632
632
|
i,
|
|
633
|
-
|
|
634
|
-
]), [A, j] =
|
|
633
|
+
E
|
|
634
|
+
]), [A, j] = X(0), N = /* @__PURE__ */ Q("div", {
|
|
635
635
|
style: {
|
|
636
636
|
display: "flex",
|
|
637
637
|
alignItems: "center",
|
|
@@ -640,36 +640,36 @@ function Ne({ node: n, ctx: r, assocCode: i, assocEntity: a, fkField: o }) {
|
|
|
640
640
|
minWidth: 0,
|
|
641
641
|
justifyContent: "flex-end"
|
|
642
642
|
},
|
|
643
|
-
children: [a.action_layout ?
|
|
643
|
+
children: [a.action_layout ? g.length > 0 && /* @__PURE__ */ Z(ne, {
|
|
644
644
|
kind: "toolbar",
|
|
645
|
-
layout:
|
|
646
|
-
entityActions:
|
|
647
|
-
onRun:
|
|
648
|
-
widgetContext:
|
|
649
|
-
ariaLabel: `${
|
|
650
|
-
}) :
|
|
645
|
+
layout: g,
|
|
646
|
+
entityActions: h,
|
|
647
|
+
onRun: D,
|
|
648
|
+
widgetContext: S,
|
|
649
|
+
ariaLabel: `${f} toolbar actions`
|
|
650
|
+
}) : m.map(({ code: e, action: t }) => /* @__PURE__ */ Z(Se, {
|
|
651
651
|
actionCode: e,
|
|
652
652
|
action: t,
|
|
653
653
|
entityCode: i,
|
|
654
654
|
variant: "ghost",
|
|
655
655
|
size: "sm",
|
|
656
|
-
onSuccess:
|
|
657
|
-
}, e)),
|
|
656
|
+
onSuccess: E
|
|
657
|
+
}, e)), d && /* @__PURE__ */ Z(b, {
|
|
658
658
|
kind: "ghost",
|
|
659
659
|
size: "xs",
|
|
660
660
|
icon: /* @__PURE__ */ Z(e.plus, { size: 12 }),
|
|
661
661
|
onClick: () => j((e) => e + 1),
|
|
662
662
|
children: "Add row"
|
|
663
663
|
})]
|
|
664
|
-
}), P =
|
|
664
|
+
}), P = p ? /* @__PURE__ */ Z(Fe, {
|
|
665
665
|
entityCode: i,
|
|
666
666
|
entity: a,
|
|
667
667
|
parentEntity: r.entityCode,
|
|
668
668
|
parentId: r.recordId,
|
|
669
669
|
foreignKey: o,
|
|
670
670
|
columns: s,
|
|
671
|
-
editable:
|
|
672
|
-
interaction:
|
|
671
|
+
editable: d,
|
|
672
|
+
interaction: l,
|
|
673
673
|
ctx: r,
|
|
674
674
|
searchable: n.searchable,
|
|
675
675
|
filterFields: n.filters,
|
|
@@ -682,8 +682,8 @@ function Ne({ node: n, ctx: r, assocCode: i, assocEntity: a, fkField: o }) {
|
|
|
682
682
|
parentId: r.recordId,
|
|
683
683
|
foreignKey: o,
|
|
684
684
|
columns: s,
|
|
685
|
-
editable:
|
|
686
|
-
interaction:
|
|
685
|
+
editable: d,
|
|
686
|
+
interaction: l,
|
|
687
687
|
ctx: r,
|
|
688
688
|
sort: n.sort,
|
|
689
689
|
startDraftSignal: A
|
|
@@ -696,7 +696,7 @@ function Ne({ node: n, ctx: r, assocCode: i, assocEntity: a, fkField: o }) {
|
|
|
696
696
|
},
|
|
697
697
|
children: N
|
|
698
698
|
}), P] }) : /* @__PURE__ */ Z(_e, {
|
|
699
|
-
title:
|
|
699
|
+
title: f,
|
|
700
700
|
icon: a.display?.icon ? /* @__PURE__ */ Z(t, {
|
|
701
701
|
name: a.display.icon,
|
|
702
702
|
size: 14
|
|
@@ -705,45 +705,45 @@ function Ne({ node: n, ctx: r, assocCode: i, assocEntity: a, fkField: o }) {
|
|
|
705
705
|
children: P
|
|
706
706
|
});
|
|
707
707
|
}
|
|
708
|
-
function Pe({ entityCode: e, entity: t, parentEntity: n, parentId:
|
|
709
|
-
let f =
|
|
708
|
+
function Pe({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey: i, columns: a, editable: s, interaction: c, ctx: l, sort: u, startDraftSignal: d }) {
|
|
709
|
+
let f = pe(), { data: m, isLoading: h, isError: g } = p(n, r, e, i, u), _ = m?.data ?? [], v = m?.$refs, y = q(() => {
|
|
710
710
|
f.invalidateQueries({ queryKey: [
|
|
711
|
-
|
|
711
|
+
o,
|
|
712
712
|
n,
|
|
713
|
-
|
|
713
|
+
r,
|
|
714
714
|
e
|
|
715
715
|
] });
|
|
716
716
|
}, [
|
|
717
717
|
f,
|
|
718
718
|
n,
|
|
719
|
-
|
|
719
|
+
r,
|
|
720
720
|
e
|
|
721
721
|
]);
|
|
722
722
|
return /* @__PURE__ */ Z(Ie, {
|
|
723
723
|
entityCode: e,
|
|
724
724
|
entity: t,
|
|
725
|
-
parentId:
|
|
726
|
-
foreignKey:
|
|
727
|
-
columns:
|
|
725
|
+
parentId: r,
|
|
726
|
+
foreignKey: i,
|
|
727
|
+
columns: a,
|
|
728
728
|
editable: s,
|
|
729
729
|
interaction: c,
|
|
730
730
|
ctx: l,
|
|
731
|
-
rows:
|
|
732
|
-
refs:
|
|
733
|
-
isLoading:
|
|
734
|
-
isError:
|
|
735
|
-
invalidateQuery:
|
|
731
|
+
rows: _,
|
|
732
|
+
refs: v,
|
|
733
|
+
isLoading: h,
|
|
734
|
+
isError: g,
|
|
735
|
+
invalidateQuery: y,
|
|
736
736
|
startDraftSignal: d
|
|
737
737
|
});
|
|
738
738
|
}
|
|
739
|
-
function Fe({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey: i, columns:
|
|
740
|
-
let
|
|
741
|
-
|
|
742
|
-
|
|
739
|
+
function Fe({ 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 }) {
|
|
740
|
+
let p = pe(), [h, g] = X(""), [_, v] = X(""), [y, x] = X({}), S = Y(void 0);
|
|
741
|
+
le(() => (S.current && clearTimeout(S.current), S.current = setTimeout(() => {
|
|
742
|
+
v(h);
|
|
743
743
|
}, 300), () => {
|
|
744
744
|
S.current && clearTimeout(S.current);
|
|
745
|
-
}), [
|
|
746
|
-
let C =
|
|
745
|
+
}), [h]);
|
|
746
|
+
let C = q((e, t) => {
|
|
747
747
|
x((n) => {
|
|
748
748
|
if (t === "__all__") {
|
|
749
749
|
let { [e]: t, ...r } = n;
|
|
@@ -754,7 +754,7 @@ function Fe({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
|
|
|
754
754
|
[e]: t
|
|
755
755
|
};
|
|
756
756
|
});
|
|
757
|
-
}, []), w =
|
|
757
|
+
}, []), w = J(() => Object.keys(y).length > 0 ? y : void 0, [y]), { data: T, isLoading: E, isError: D, hasNextPage: O, fetchNextPage: k, isFetchingNextPage: A } = xe(n, r, e, i, d, void 0, _ || void 0, w), { rows: j, refs: M } = J(() => {
|
|
758
758
|
if (!T?.pages) return {
|
|
759
759
|
rows: [],
|
|
760
760
|
refs: void 0
|
|
@@ -771,45 +771,45 @@ function Fe({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
|
|
|
771
771
|
rows: e,
|
|
772
772
|
refs: t
|
|
773
773
|
};
|
|
774
|
-
}, [T]), N =
|
|
775
|
-
|
|
774
|
+
}, [T]), N = q(() => {
|
|
775
|
+
p.invalidateQueries({ predicate: (t) => {
|
|
776
776
|
let n = t.queryKey;
|
|
777
777
|
return n[0] === "entity-children" && n[3] === e;
|
|
778
778
|
} });
|
|
779
|
-
}, [
|
|
779
|
+
}, [p, e]);
|
|
780
780
|
return /* @__PURE__ */ Q("div", { children: [
|
|
781
781
|
/* @__PURE__ */ Z(we, {
|
|
782
782
|
entity: t,
|
|
783
|
-
searchable:
|
|
784
|
-
filterFields:
|
|
785
|
-
searchValue:
|
|
786
|
-
onSearchChange:
|
|
787
|
-
filters:
|
|
783
|
+
searchable: l,
|
|
784
|
+
filterFields: u,
|
|
785
|
+
searchValue: h,
|
|
786
|
+
onSearchChange: g,
|
|
787
|
+
filters: y,
|
|
788
788
|
onFilterChange: C,
|
|
789
|
-
allEntities:
|
|
789
|
+
allEntities: c.schema.entities
|
|
790
790
|
}),
|
|
791
791
|
/* @__PURE__ */ Z(Ie, {
|
|
792
792
|
entityCode: e,
|
|
793
793
|
entity: t,
|
|
794
794
|
parentId: r,
|
|
795
795
|
foreignKey: i,
|
|
796
|
-
columns:
|
|
797
|
-
editable:
|
|
798
|
-
interaction:
|
|
799
|
-
ctx:
|
|
796
|
+
columns: a,
|
|
797
|
+
editable: o,
|
|
798
|
+
interaction: s,
|
|
799
|
+
ctx: c,
|
|
800
800
|
rows: j,
|
|
801
801
|
refs: M,
|
|
802
802
|
isLoading: E,
|
|
803
803
|
isError: D,
|
|
804
804
|
invalidateQuery: N,
|
|
805
|
-
startDraftSignal:
|
|
805
|
+
startDraftSignal: f
|
|
806
806
|
}),
|
|
807
807
|
O && /* @__PURE__ */ Z("div", {
|
|
808
808
|
style: { marginTop: 4 },
|
|
809
|
-
children: /* @__PURE__ */ Z(
|
|
809
|
+
children: /* @__PURE__ */ Z(b, {
|
|
810
810
|
kind: "ghost",
|
|
811
811
|
size: "xs",
|
|
812
|
-
icon: A ? /* @__PURE__ */ Z(
|
|
812
|
+
icon: A ? /* @__PURE__ */ Z(m, { size: 12 }) : void 0,
|
|
813
813
|
onClick: () => k(),
|
|
814
814
|
disabled: A,
|
|
815
815
|
children: "Load more"
|
|
@@ -817,45 +817,45 @@ function Fe({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
|
|
|
817
817
|
})
|
|
818
818
|
] });
|
|
819
819
|
}
|
|
820
|
-
function Ie({ entityCode: e, entity: t, parentId:
|
|
821
|
-
let
|
|
822
|
-
|
|
820
|
+
function Ie({ entityCode: e, entity: t, parentId: i, foreignKey: a, columns: o, editable: s, interaction: c, ctx: l, rows: u, refs: d, isLoading: p, isError: m, invalidateQuery: h, startDraftSignal: g }) {
|
|
821
|
+
let y = f(), b = y.isPhone && l.relatedRecordsPresentation === "table", x = o.find((e) => e !== a), S = J(() => c === "navigate" ? D(void 0, t, l.schema.screens) : null, [
|
|
822
|
+
c,
|
|
823
823
|
t,
|
|
824
|
-
|
|
825
|
-
]),
|
|
826
|
-
|
|
827
|
-
|
|
824
|
+
l.schema.screens
|
|
825
|
+
]), C = J(() => s ? ke(t, o, a) : /* @__PURE__ */ new Set(), [
|
|
826
|
+
o,
|
|
827
|
+
a,
|
|
828
828
|
t,
|
|
829
|
-
|
|
830
|
-
]),
|
|
831
|
-
|
|
832
|
-
|
|
829
|
+
s
|
|
830
|
+
]), w = J(() => Ae(t, o, a), [
|
|
831
|
+
o,
|
|
832
|
+
a,
|
|
833
833
|
t
|
|
834
|
-
]),
|
|
834
|
+
]), T = J(() => {
|
|
835
835
|
let e = /* @__PURE__ */ new Map();
|
|
836
|
-
for (let n of
|
|
837
|
-
let
|
|
838
|
-
e.set(
|
|
836
|
+
for (let n of u) {
|
|
837
|
+
let i = _(t, n);
|
|
838
|
+
e.set(r(i), i);
|
|
839
839
|
}
|
|
840
840
|
return e;
|
|
841
|
-
}, [
|
|
841
|
+
}, [u, t]), O = J(() => {
|
|
842
842
|
let e = /* @__PURE__ */ new Map();
|
|
843
|
-
for (let n of
|
|
844
|
-
let
|
|
845
|
-
typeof
|
|
843
|
+
for (let n of u) {
|
|
844
|
+
let i = n.$row_version;
|
|
845
|
+
typeof i == "string" && i !== "" && e.set(r(_(t, n)), i);
|
|
846
846
|
}
|
|
847
847
|
return e;
|
|
848
|
-
}, [
|
|
849
|
-
|
|
850
|
-
let
|
|
851
|
-
|
|
852
|
-
let e =
|
|
848
|
+
}, [u, t]), k = J(() => Ee(t.actions), [t.actions]), [A, j] = X(null), [N, P] = X(null), [F, L] = X([]), [R, B] = X({}), V = Y(R);
|
|
849
|
+
V.current = R;
|
|
850
|
+
let H = Y({});
|
|
851
|
+
le(() => {
|
|
852
|
+
let e = H.current;
|
|
853
853
|
return () => {
|
|
854
854
|
for (let t of Object.values(e)) clearTimeout(t);
|
|
855
855
|
};
|
|
856
856
|
}, []);
|
|
857
|
-
let [
|
|
858
|
-
|
|
857
|
+
let [U, W] = X(null), [ee, G] = X([]), [te, ne] = X(!1), { run: re } = M(), [ie, ae] = X(/* @__PURE__ */ new Set()), K = q(async (t, n, r) => {
|
|
858
|
+
B((e) => ({
|
|
859
859
|
...e,
|
|
860
860
|
[t]: {
|
|
861
861
|
...e[t],
|
|
@@ -864,11 +864,11 @@ function Ie({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
864
864
|
}
|
|
865
865
|
}));
|
|
866
866
|
try {
|
|
867
|
-
let i =
|
|
867
|
+
let i = O.get(t), a = i ? {
|
|
868
868
|
...n,
|
|
869
869
|
$row_version: i
|
|
870
870
|
} : n;
|
|
871
|
-
return await
|
|
871
|
+
return await I(e, T.get(t) ?? t, a), B((e) => {
|
|
872
872
|
let n = e[t];
|
|
873
873
|
if (!n) return e;
|
|
874
874
|
if (n.ver > r) return {
|
|
@@ -880,10 +880,10 @@ function Ie({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
880
880
|
};
|
|
881
881
|
let { [t]: i, ...a } = e;
|
|
882
882
|
return a;
|
|
883
|
-
}),
|
|
883
|
+
}), h(), !0;
|
|
884
884
|
} catch (e) {
|
|
885
885
|
let n = e instanceof Error ? e.message : "Save failed";
|
|
886
|
-
return
|
|
886
|
+
return B((e) => ({
|
|
887
887
|
...e,
|
|
888
888
|
[t]: {
|
|
889
889
|
...e[t],
|
|
@@ -894,11 +894,11 @@ function Ie({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
894
894
|
}
|
|
895
895
|
}, [
|
|
896
896
|
e,
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
]),
|
|
901
|
-
|
|
897
|
+
h,
|
|
898
|
+
T,
|
|
899
|
+
O
|
|
900
|
+
]), ce = q((e, t, n) => {
|
|
901
|
+
B((r) => {
|
|
902
902
|
let i = r[e] ?? {
|
|
903
903
|
buffer: {},
|
|
904
904
|
ver: 0,
|
|
@@ -915,110 +915,110 @@ function Ie({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
915
915
|
ver: a
|
|
916
916
|
}
|
|
917
917
|
};
|
|
918
|
-
}),
|
|
919
|
-
let t =
|
|
920
|
-
t && Object.keys(t.buffer).length > 0 &&
|
|
918
|
+
}), c === "inline_edit" && (H.current[e] && clearTimeout(H.current[e]), H.current[e] = setTimeout(() => {
|
|
919
|
+
let t = V.current[e];
|
|
920
|
+
t && Object.keys(t.buffer).length > 0 && K(e, { ...t.buffer }, t.ver);
|
|
921
921
|
}, 500));
|
|
922
|
-
}, [
|
|
922
|
+
}, [K, c]), ue = q(() => {
|
|
923
923
|
let e = {};
|
|
924
|
-
e[
|
|
925
|
-
for (let n of
|
|
924
|
+
e[a] = i;
|
|
925
|
+
for (let n of o) {
|
|
926
926
|
let r = t.fields.get(n);
|
|
927
927
|
r && (r.default === void 0 ? r.type === "bool" && (e[n] = !1) : e[n] = r.default);
|
|
928
928
|
}
|
|
929
|
-
|
|
929
|
+
W(e), G([]);
|
|
930
930
|
}, [
|
|
931
|
-
|
|
932
|
-
n,
|
|
931
|
+
a,
|
|
933
932
|
i,
|
|
933
|
+
o,
|
|
934
934
|
t.fields
|
|
935
|
-
]),
|
|
936
|
-
|
|
937
|
-
|
|
935
|
+
]), de = Y(g);
|
|
936
|
+
le(() => {
|
|
937
|
+
g !== void 0 && g !== de.current && (de.current = g, !U && ue());
|
|
938
938
|
}, [
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
939
|
+
g,
|
|
940
|
+
U,
|
|
941
|
+
ue
|
|
942
942
|
]);
|
|
943
|
-
let
|
|
944
|
-
if (!
|
|
945
|
-
let n = je(
|
|
943
|
+
let fe = q(async () => {
|
|
944
|
+
if (!U) return;
|
|
945
|
+
let n = je(U, o, t, a);
|
|
946
946
|
if (n.length > 0) {
|
|
947
|
-
|
|
947
|
+
G(n);
|
|
948
948
|
return;
|
|
949
949
|
}
|
|
950
|
-
|
|
950
|
+
ne(!0);
|
|
951
951
|
try {
|
|
952
|
-
await
|
|
952
|
+
await E(e, U), W(null), G([]), h();
|
|
953
953
|
} catch (e) {
|
|
954
954
|
let t = e instanceof Error ? e.message : "Create failed";
|
|
955
|
-
|
|
955
|
+
G([`_error:${t}`]);
|
|
956
956
|
} finally {
|
|
957
|
-
|
|
957
|
+
ne(!1);
|
|
958
958
|
}
|
|
959
959
|
}, [
|
|
960
|
-
|
|
961
|
-
|
|
960
|
+
U,
|
|
961
|
+
o,
|
|
962
962
|
t,
|
|
963
|
-
|
|
963
|
+
a,
|
|
964
964
|
e,
|
|
965
|
-
|
|
966
|
-
]),
|
|
967
|
-
|
|
968
|
-
}, []), me =
|
|
969
|
-
let n =
|
|
970
|
-
if (Object.keys(
|
|
971
|
-
|
|
965
|
+
h
|
|
966
|
+
]), pe = q((e) => {
|
|
967
|
+
B({}), L([]), P(e);
|
|
968
|
+
}, []), me = q(async (e) => {
|
|
969
|
+
let n = V.current[e], i = n?.buffer ?? {};
|
|
970
|
+
if (Object.keys(i).length === 0) {
|
|
971
|
+
P(null), L([]);
|
|
972
972
|
return;
|
|
973
973
|
}
|
|
974
|
-
let
|
|
975
|
-
...
|
|
976
|
-
...
|
|
977
|
-
},
|
|
978
|
-
if (
|
|
979
|
-
|
|
974
|
+
let s = je({
|
|
975
|
+
...u.find((n) => r(_(t, n)) === e) ?? {},
|
|
976
|
+
...i
|
|
977
|
+
}, o, t, a);
|
|
978
|
+
if (s.length > 0) {
|
|
979
|
+
L(s);
|
|
980
980
|
return;
|
|
981
981
|
}
|
|
982
|
-
await
|
|
982
|
+
await K(e, { ...i }, n?.ver ?? 0) && (P(null), L([]));
|
|
983
983
|
}, [
|
|
984
|
-
|
|
984
|
+
u,
|
|
985
985
|
t,
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
]), he =
|
|
990
|
-
|
|
986
|
+
o,
|
|
987
|
+
a,
|
|
988
|
+
K
|
|
989
|
+
]), he = q((e) => {
|
|
990
|
+
B((t) => {
|
|
991
991
|
if (!t[e]) return t;
|
|
992
992
|
let { [e]: n, ...r } = t;
|
|
993
993
|
return r;
|
|
994
|
-
}),
|
|
995
|
-
}, []), ge =
|
|
996
|
-
let i =
|
|
997
|
-
return
|
|
994
|
+
}), L([]), P(null);
|
|
995
|
+
}, []), ge = q((n, r) => {
|
|
996
|
+
let i = T.get(n) ?? n;
|
|
997
|
+
return re({
|
|
998
998
|
action: t.actions?.__delete,
|
|
999
999
|
destructive: !0,
|
|
1000
|
-
title:
|
|
1000
|
+
title: z(t.display?.name) || "Delete",
|
|
1001
1001
|
row: r,
|
|
1002
1002
|
entity: e,
|
|
1003
1003
|
execute: async () => {
|
|
1004
|
-
|
|
1004
|
+
ae((e) => new Set(e).add(n));
|
|
1005
1005
|
try {
|
|
1006
|
-
return await
|
|
1006
|
+
return await v(e, i);
|
|
1007
1007
|
} finally {
|
|
1008
|
-
|
|
1008
|
+
ae((e) => {
|
|
1009
1009
|
let t = new Set(e);
|
|
1010
1010
|
return t.delete(n), t;
|
|
1011
1011
|
});
|
|
1012
1012
|
}
|
|
1013
1013
|
},
|
|
1014
|
-
onSuccess: () =>
|
|
1014
|
+
onSuccess: () => h()
|
|
1015
1015
|
});
|
|
1016
1016
|
}, [
|
|
1017
|
-
|
|
1017
|
+
re,
|
|
1018
1018
|
t,
|
|
1019
1019
|
e,
|
|
1020
|
-
|
|
1021
|
-
|
|
1020
|
+
h,
|
|
1021
|
+
T
|
|
1022
1022
|
]);
|
|
1023
1023
|
if (m) return /* @__PURE__ */ Z("div", {
|
|
1024
1024
|
style: {
|
|
@@ -1045,156 +1045,156 @@ function Ie({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: i,
|
|
|
1045
1045
|
borderRadius: 6
|
|
1046
1046
|
} })]
|
|
1047
1047
|
});
|
|
1048
|
-
let $ =
|
|
1049
|
-
return
|
|
1048
|
+
let $ = u.length === 0 && !U;
|
|
1049
|
+
return y.isPhone && !b ? /* @__PURE__ */ Q("div", { children: [$ && !s && /* @__PURE__ */ Z("div", {
|
|
1050
1050
|
style: {
|
|
1051
1051
|
fontSize: 12.5,
|
|
1052
1052
|
color: "var(--text-3)",
|
|
1053
1053
|
padding: "12px 0"
|
|
1054
1054
|
},
|
|
1055
1055
|
children: "No records yet."
|
|
1056
|
-
}), (!$ ||
|
|
1056
|
+
}), (!$ || s) && /* @__PURE__ */ Q("div", {
|
|
1057
1057
|
style: {
|
|
1058
1058
|
display: "flex",
|
|
1059
1059
|
flexDirection: "column",
|
|
1060
1060
|
gap: 10
|
|
1061
1061
|
},
|
|
1062
|
-
children: [
|
|
1063
|
-
let
|
|
1062
|
+
children: [u.map((n) => {
|
|
1063
|
+
let i = r(_(t, n)), a = ie.has(i), u = R[i], f = S && i ? S.replace(/:\w+/, i) : void 0;
|
|
1064
1064
|
return /* @__PURE__ */ Z(Le, {
|
|
1065
|
-
rowId:
|
|
1065
|
+
rowId: i,
|
|
1066
1066
|
row: n,
|
|
1067
1067
|
entity: t,
|
|
1068
|
-
entities:
|
|
1069
|
-
screens:
|
|
1070
|
-
columns:
|
|
1071
|
-
editableColumns:
|
|
1072
|
-
editable:
|
|
1073
|
-
interaction:
|
|
1074
|
-
isEditing:
|
|
1075
|
-
editErrors:
|
|
1076
|
-
isDeleting:
|
|
1077
|
-
activeCell:
|
|
1078
|
-
setActiveCell:
|
|
1079
|
-
rowState:
|
|
1080
|
-
onCellChange:
|
|
1068
|
+
entities: l.schema.entities,
|
|
1069
|
+
screens: l.schema.screens,
|
|
1070
|
+
columns: o,
|
|
1071
|
+
editableColumns: C,
|
|
1072
|
+
editable: s,
|
|
1073
|
+
interaction: c,
|
|
1074
|
+
isEditing: N === i,
|
|
1075
|
+
editErrors: F,
|
|
1076
|
+
isDeleting: a,
|
|
1077
|
+
activeCell: A,
|
|
1078
|
+
setActiveCell: j,
|
|
1079
|
+
rowState: u,
|
|
1080
|
+
onCellChange: ce,
|
|
1081
1081
|
onDeleteClick: (e) => void ge(e, n),
|
|
1082
|
-
onStartEdit:
|
|
1082
|
+
onStartEdit: pe,
|
|
1083
1083
|
onConfirmEdit: me,
|
|
1084
1084
|
onCancelEdit: he,
|
|
1085
|
-
refs:
|
|
1086
|
-
identityCol:
|
|
1087
|
-
href:
|
|
1088
|
-
rowActions:
|
|
1085
|
+
refs: d,
|
|
1086
|
+
identityCol: x,
|
|
1087
|
+
href: f,
|
|
1088
|
+
rowActions: k,
|
|
1089
1089
|
entityCode: e,
|
|
1090
|
-
onRowActionSuccess:
|
|
1091
|
-
},
|
|
1092
|
-
}),
|
|
1093
|
-
draftRow:
|
|
1090
|
+
onRowActionSuccess: h
|
|
1091
|
+
}, i);
|
|
1092
|
+
}), U && /* @__PURE__ */ Z(He, {
|
|
1093
|
+
draftRow: U,
|
|
1094
1094
|
entity: t,
|
|
1095
|
-
columns:
|
|
1096
|
-
editableColumns:
|
|
1097
|
-
foreignKey:
|
|
1098
|
-
draftErrors:
|
|
1099
|
-
draftSaving:
|
|
1100
|
-
onChange: (e, t) =>
|
|
1095
|
+
columns: o,
|
|
1096
|
+
editableColumns: w,
|
|
1097
|
+
foreignKey: a,
|
|
1098
|
+
draftErrors: ee,
|
|
1099
|
+
draftSaving: te,
|
|
1100
|
+
onChange: (e, t) => W((n) => n && {
|
|
1101
1101
|
...n,
|
|
1102
1102
|
[e]: t
|
|
1103
1103
|
}),
|
|
1104
|
-
onConfirm:
|
|
1104
|
+
onConfirm: fe,
|
|
1105
1105
|
onCancel: () => {
|
|
1106
|
-
|
|
1106
|
+
W(null), G([]);
|
|
1107
1107
|
},
|
|
1108
|
-
refs:
|
|
1108
|
+
refs: d
|
|
1109
1109
|
})]
|
|
1110
|
-
})] }) : /* @__PURE__ */ Q("div", { children: [$ && !
|
|
1110
|
+
})] }) : /* @__PURE__ */ Q("div", { children: [$ && !s && /* @__PURE__ */ Z("div", {
|
|
1111
1111
|
style: {
|
|
1112
1112
|
fontSize: 12.5,
|
|
1113
1113
|
color: "var(--text-3)",
|
|
1114
1114
|
padding: "12px 0"
|
|
1115
1115
|
},
|
|
1116
1116
|
children: "No records yet."
|
|
1117
|
-
}), (!$ ||
|
|
1117
|
+
}), (!$ || s) && /* @__PURE__ */ Z("div", {
|
|
1118
1118
|
style: { overflowX: "auto" },
|
|
1119
1119
|
children: /* @__PURE__ */ Q("table", {
|
|
1120
|
-
style:
|
|
1120
|
+
style: se,
|
|
1121
1121
|
children: [/* @__PURE__ */ Z("thead", { children: /* @__PURE__ */ Q("tr", { children: [
|
|
1122
|
-
|
|
1123
|
-
let
|
|
1122
|
+
o.map((e) => {
|
|
1123
|
+
let r = t.fields.get(e);
|
|
1124
1124
|
return /* @__PURE__ */ Z("th", {
|
|
1125
|
-
style:
|
|
1126
|
-
children:
|
|
1125
|
+
style: oe,
|
|
1126
|
+
children: r ? n(r, e, l.schema.entities) : e
|
|
1127
1127
|
}, e);
|
|
1128
1128
|
}),
|
|
1129
|
-
|
|
1129
|
+
s && /* @__PURE__ */ Z("th", { style: {
|
|
1130
1130
|
height: 30,
|
|
1131
1131
|
width: 72
|
|
1132
1132
|
} }),
|
|
1133
|
-
!
|
|
1133
|
+
!s && k.length > 0 && /* @__PURE__ */ Z("th", { style: {
|
|
1134
1134
|
height: 30,
|
|
1135
1135
|
width: 40
|
|
1136
1136
|
} })
|
|
1137
|
-
] }) }), /* @__PURE__ */ Q("tbody", { children: [
|
|
1138
|
-
let
|
|
1137
|
+
] }) }), /* @__PURE__ */ Q("tbody", { children: [u.map((n) => {
|
|
1138
|
+
let i = r(_(t, n)), a = ie.has(i), u = R[i], f = S && i ? S.replace(/:\w+/, i) : void 0;
|
|
1139
1139
|
return /* @__PURE__ */ Z(Re, {
|
|
1140
|
-
rowId:
|
|
1140
|
+
rowId: i,
|
|
1141
1141
|
row: n,
|
|
1142
1142
|
entity: t,
|
|
1143
|
-
entities:
|
|
1144
|
-
screens:
|
|
1145
|
-
columns:
|
|
1146
|
-
editableColumns:
|
|
1147
|
-
editable:
|
|
1148
|
-
interaction:
|
|
1149
|
-
isEditing:
|
|
1150
|
-
editErrors:
|
|
1151
|
-
isDeleting:
|
|
1152
|
-
activeCell:
|
|
1153
|
-
setActiveCell:
|
|
1154
|
-
rowState:
|
|
1155
|
-
onCellChange:
|
|
1143
|
+
entities: l.schema.entities,
|
|
1144
|
+
screens: l.schema.screens,
|
|
1145
|
+
columns: o,
|
|
1146
|
+
editableColumns: C,
|
|
1147
|
+
editable: s,
|
|
1148
|
+
interaction: c,
|
|
1149
|
+
isEditing: N === i,
|
|
1150
|
+
editErrors: F,
|
|
1151
|
+
isDeleting: a,
|
|
1152
|
+
activeCell: A,
|
|
1153
|
+
setActiveCell: j,
|
|
1154
|
+
rowState: u,
|
|
1155
|
+
onCellChange: ce,
|
|
1156
1156
|
onDeleteClick: (e) => void ge(e, n),
|
|
1157
|
-
onStartEdit:
|
|
1157
|
+
onStartEdit: pe,
|
|
1158
1158
|
onConfirmEdit: me,
|
|
1159
1159
|
onCancelEdit: he,
|
|
1160
|
-
refs:
|
|
1161
|
-
identityCol:
|
|
1162
|
-
href:
|
|
1163
|
-
rowActions:
|
|
1160
|
+
refs: d,
|
|
1161
|
+
identityCol: x,
|
|
1162
|
+
href: f,
|
|
1163
|
+
rowActions: k,
|
|
1164
1164
|
entityCode: e,
|
|
1165
|
-
onRowActionSuccess:
|
|
1166
|
-
},
|
|
1167
|
-
}),
|
|
1168
|
-
draftRow:
|
|
1165
|
+
onRowActionSuccess: h
|
|
1166
|
+
}, i);
|
|
1167
|
+
}), U && /* @__PURE__ */ Z(Ve, {
|
|
1168
|
+
draftRow: U,
|
|
1169
1169
|
entity: t,
|
|
1170
|
-
columns:
|
|
1171
|
-
editableColumns:
|
|
1172
|
-
foreignKey:
|
|
1173
|
-
draftErrors:
|
|
1174
|
-
draftSaving:
|
|
1175
|
-
onChange: (e, t) =>
|
|
1170
|
+
columns: o,
|
|
1171
|
+
editableColumns: w,
|
|
1172
|
+
foreignKey: a,
|
|
1173
|
+
draftErrors: ee,
|
|
1174
|
+
draftSaving: te,
|
|
1175
|
+
onChange: (e, t) => W((n) => n && {
|
|
1176
1176
|
...n,
|
|
1177
1177
|
[e]: t
|
|
1178
1178
|
}),
|
|
1179
|
-
onConfirm:
|
|
1179
|
+
onConfirm: fe,
|
|
1180
1180
|
onCancel: () => {
|
|
1181
|
-
|
|
1181
|
+
W(null), G([]);
|
|
1182
1182
|
},
|
|
1183
|
-
refs:
|
|
1183
|
+
refs: d
|
|
1184
1184
|
})] })]
|
|
1185
1185
|
})
|
|
1186
1186
|
})] });
|
|
1187
1187
|
}
|
|
1188
|
-
function Le({ rowId: t, row:
|
|
1189
|
-
let D =
|
|
1190
|
-
...
|
|
1188
|
+
function Le({ rowId: t, row: r, entity: a, entities: o, screens: s, columns: c, editableColumns: l, editable: u, interaction: d, isEditing: f, editErrors: p, isDeleting: h, rowState: g, onCellChange: _, onDeleteClick: v, onStartEdit: y, onConfirmEdit: b, onCancelEdit: x, refs: S, identityCol: C, href: w, rowActions: T, onRowActionSuccess: E }) {
|
|
1189
|
+
let D = k(), O = ue(), A = J(() => !g || Object.keys(g.buffer).length === 0 ? r : {
|
|
1190
|
+
...r,
|
|
1191
1191
|
...g.buffer
|
|
1192
|
-
}, [
|
|
1193
|
-
if (
|
|
1194
|
-
let e = g?.error ? [...
|
|
1192
|
+
}, [r, g]);
|
|
1193
|
+
if (d === "row_edit" && f) {
|
|
1194
|
+
let e = g?.error ? [...p, `_error:${g.error}`] : p;
|
|
1195
1195
|
return /* @__PURE__ */ Z(Be, {
|
|
1196
|
-
values:
|
|
1197
|
-
entity:
|
|
1196
|
+
values: A,
|
|
1197
|
+
entity: a,
|
|
1198
1198
|
columns: c,
|
|
1199
1199
|
editableColumns: l,
|
|
1200
1200
|
errors: e,
|
|
@@ -1221,26 +1221,26 @@ function Le({ rowId: t, row: n, entity: r, entities: i, screens: o, columns: c,
|
|
|
1221
1221
|
gap: 12
|
|
1222
1222
|
},
|
|
1223
1223
|
children: c.map((e) => {
|
|
1224
|
-
let
|
|
1224
|
+
let r = a.fields.get(e), i = u && d === "inline_edit" && l.has(e), c = w && e === C, f = r ? n(r, e, o) : e, p = `${O}-${t}-${e}`, m = `${p}-label`, h = {
|
|
1225
1225
|
fontSize: 11.5,
|
|
1226
1226
|
fontWeight: 600,
|
|
1227
1227
|
color: "var(--text-3)"
|
|
1228
|
-
}, g =
|
|
1229
|
-
field:
|
|
1228
|
+
}, g = r ? H({
|
|
1229
|
+
field: r,
|
|
1230
1230
|
fieldName: e,
|
|
1231
|
-
value:
|
|
1232
|
-
mode:
|
|
1233
|
-
onChange:
|
|
1234
|
-
record:
|
|
1231
|
+
value: A[e],
|
|
1232
|
+
mode: i ? "edit" : "display",
|
|
1233
|
+
onChange: i ? (n) => _(t, e, n) : void 0,
|
|
1234
|
+
record: A,
|
|
1235
1235
|
refs: S,
|
|
1236
|
-
compact:
|
|
1237
|
-
entity:
|
|
1238
|
-
entities:
|
|
1239
|
-
screens:
|
|
1236
|
+
compact: i,
|
|
1237
|
+
entity: a,
|
|
1238
|
+
entities: o,
|
|
1239
|
+
screens: c ? void 0 : s,
|
|
1240
1240
|
fieldId: p,
|
|
1241
1241
|
labelId: m,
|
|
1242
1242
|
locale: D
|
|
1243
|
-
}) :
|
|
1243
|
+
}) : L(A[e]);
|
|
1244
1244
|
return /* @__PURE__ */ Q("div", {
|
|
1245
1245
|
style: {
|
|
1246
1246
|
display: "flex",
|
|
@@ -1248,18 +1248,18 @@ function Le({ rowId: t, row: n, entity: r, entities: i, screens: o, columns: c,
|
|
|
1248
1248
|
gap: 5,
|
|
1249
1249
|
minWidth: 0
|
|
1250
1250
|
},
|
|
1251
|
-
children: [
|
|
1251
|
+
children: [i && r ? /* @__PURE__ */ Z("label", {
|
|
1252
1252
|
id: m,
|
|
1253
1253
|
htmlFor: p,
|
|
1254
1254
|
style: h,
|
|
1255
|
-
children:
|
|
1255
|
+
children: f
|
|
1256
1256
|
}) : /* @__PURE__ */ Z("div", {
|
|
1257
1257
|
id: m,
|
|
1258
1258
|
style: h,
|
|
1259
|
-
children:
|
|
1259
|
+
children: f
|
|
1260
1260
|
}), /* @__PURE__ */ Z("div", {
|
|
1261
1261
|
style: { minWidth: 0 },
|
|
1262
|
-
children:
|
|
1262
|
+
children: c && !i ? /* @__PURE__ */ Z("a", {
|
|
1263
1263
|
href: w,
|
|
1264
1264
|
style: {
|
|
1265
1265
|
color: "var(--accent)",
|
|
@@ -1282,7 +1282,7 @@ function Le({ rowId: t, row: n, entity: r, entities: i, screens: o, columns: c,
|
|
|
1282
1282
|
gap: 6
|
|
1283
1283
|
},
|
|
1284
1284
|
children: [u && /* @__PURE__ */ Q(me, { children: [
|
|
1285
|
-
g?.saving && /* @__PURE__ */ Z(
|
|
1285
|
+
g?.saving && /* @__PURE__ */ Z(m, { size: 12 }),
|
|
1286
1286
|
g?.error && /* @__PURE__ */ Z("span", {
|
|
1287
1287
|
style: {
|
|
1288
1288
|
fontSize: 11,
|
|
@@ -1291,40 +1291,40 @@ function Le({ rowId: t, row: n, entity: r, entities: i, screens: o, columns: c,
|
|
|
1291
1291
|
title: g.error,
|
|
1292
1292
|
children: "!"
|
|
1293
1293
|
}),
|
|
1294
|
-
|
|
1294
|
+
d === "row_edit" && /* @__PURE__ */ Z(i, {
|
|
1295
1295
|
size: 32,
|
|
1296
1296
|
icon: /* @__PURE__ */ Z(e.edit, { size: 14 }),
|
|
1297
1297
|
onClick: () => y(t),
|
|
1298
1298
|
title: "Edit row"
|
|
1299
1299
|
}),
|
|
1300
|
-
/* @__PURE__ */ Z(
|
|
1300
|
+
/* @__PURE__ */ Z(i, {
|
|
1301
1301
|
size: 32,
|
|
1302
1302
|
icon: /* @__PURE__ */ Z(e.trash, { size: 14 }),
|
|
1303
1303
|
onClick: () => v(t),
|
|
1304
1304
|
title: "Delete row"
|
|
1305
1305
|
})
|
|
1306
1306
|
] }), !u && T && T.length > 0 && /* @__PURE__ */ Z(Ce, {
|
|
1307
|
-
entity:
|
|
1307
|
+
entity: a,
|
|
1308
1308
|
actions: T,
|
|
1309
1309
|
objectIds: [t],
|
|
1310
|
-
row:
|
|
1310
|
+
row: A,
|
|
1311
1311
|
onSuccess: E
|
|
1312
1312
|
})]
|
|
1313
1313
|
})]
|
|
1314
1314
|
});
|
|
1315
1315
|
}
|
|
1316
|
-
function Re({ rowId: t, row: n, entity: r, entities:
|
|
1317
|
-
let O =
|
|
1316
|
+
function Re({ rowId: t, row: n, entity: r, entities: a, screens: o, columns: s, editableColumns: c, editable: l, interaction: u, isEditing: d, editErrors: f, isDeleting: p, activeCell: h, setActiveCell: g, rowState: _, onCellChange: v, onDeleteClick: y, onStartEdit: b, onConfirmEdit: x, onCancelEdit: S, refs: C, identityCol: w, href: T, rowActions: E, onRowActionSuccess: D }) {
|
|
1317
|
+
let O = k(), A = J(() => !_ || Object.keys(_.buffer).length === 0 ? n : {
|
|
1318
1318
|
...n,
|
|
1319
1319
|
..._.buffer
|
|
1320
1320
|
}, [n, _]);
|
|
1321
|
-
if (
|
|
1322
|
-
let e = _?.error ? [...
|
|
1321
|
+
if (u === "row_edit" && d) {
|
|
1322
|
+
let e = _?.error ? [...f, `_error:${_.error}`] : f;
|
|
1323
1323
|
return /* @__PURE__ */ Z(ze, {
|
|
1324
|
-
values:
|
|
1324
|
+
values: A,
|
|
1325
1325
|
entity: r,
|
|
1326
|
-
columns:
|
|
1327
|
-
editableColumns:
|
|
1326
|
+
columns: s,
|
|
1327
|
+
editableColumns: c,
|
|
1328
1328
|
errors: e,
|
|
1329
1329
|
saving: _?.saving ?? !1,
|
|
1330
1330
|
onChange: (e, n) => v(t, e, n),
|
|
@@ -1333,45 +1333,45 @@ function Re({ rowId: t, row: n, entity: r, entities: i, screens: o, columns: c,
|
|
|
1333
1333
|
refs: C
|
|
1334
1334
|
});
|
|
1335
1335
|
}
|
|
1336
|
-
let
|
|
1336
|
+
let j = K, M = {
|
|
1337
1337
|
padding: "4px 4px",
|
|
1338
1338
|
borderBottom: "1px solid var(--divider)",
|
|
1339
1339
|
verticalAlign: "middle"
|
|
1340
|
-
},
|
|
1340
|
+
}, N = u === "inline_edit";
|
|
1341
1341
|
return /* @__PURE__ */ Q("tr", {
|
|
1342
|
-
style: { opacity:
|
|
1342
|
+
style: { opacity: p ? .5 : 1 },
|
|
1343
1343
|
children: [
|
|
1344
|
-
|
|
1345
|
-
let n = r.fields.get(e),
|
|
1346
|
-
if (
|
|
1347
|
-
style:
|
|
1348
|
-
children: n ?
|
|
1344
|
+
s.map((e) => {
|
|
1345
|
+
let n = r.fields.get(e), i = c.has(e);
|
|
1346
|
+
if (N && h?.rowId === t && h?.col === e && i) return /* @__PURE__ */ Z("td", {
|
|
1347
|
+
style: M,
|
|
1348
|
+
children: n ? H({
|
|
1349
1349
|
field: n,
|
|
1350
1350
|
fieldName: e,
|
|
1351
|
-
value:
|
|
1351
|
+
value: A[e],
|
|
1352
1352
|
mode: "edit",
|
|
1353
1353
|
onChange: (n) => v(t, e, n),
|
|
1354
|
-
record:
|
|
1354
|
+
record: A,
|
|
1355
1355
|
refs: C,
|
|
1356
1356
|
compact: !0,
|
|
1357
1357
|
locale: O
|
|
1358
|
-
}) :
|
|
1358
|
+
}) : L(A[e])
|
|
1359
1359
|
}, e);
|
|
1360
|
-
let s = T && e === w,
|
|
1360
|
+
let s = T && e === w, l = n ? H({
|
|
1361
1361
|
field: n,
|
|
1362
1362
|
fieldName: e,
|
|
1363
|
-
value:
|
|
1363
|
+
value: A[e],
|
|
1364
1364
|
mode: "display",
|
|
1365
|
-
record:
|
|
1365
|
+
record: A,
|
|
1366
1366
|
refs: C,
|
|
1367
1367
|
entity: r,
|
|
1368
|
-
entities:
|
|
1368
|
+
entities: a,
|
|
1369
1369
|
screens: s ? void 0 : o,
|
|
1370
1370
|
locale: O
|
|
1371
|
-
}) :
|
|
1371
|
+
}) : L(A[e]), u = N && i && !p;
|
|
1372
1372
|
return /* @__PURE__ */ Z("td", {
|
|
1373
1373
|
style: {
|
|
1374
|
-
...
|
|
1374
|
+
...j,
|
|
1375
1375
|
cursor: u ? "pointer" : "default"
|
|
1376
1376
|
},
|
|
1377
1377
|
onClick: u ? () => g({
|
|
@@ -1387,11 +1387,11 @@ function Re({ rowId: t, row: n, entity: r, entities: i, screens: o, columns: c,
|
|
|
1387
1387
|
},
|
|
1388
1388
|
onMouseEnter: (e) => e.currentTarget.style.textDecoration = "underline",
|
|
1389
1389
|
onMouseLeave: (e) => e.currentTarget.style.textDecoration = "none",
|
|
1390
|
-
children:
|
|
1391
|
-
}) :
|
|
1390
|
+
children: l
|
|
1391
|
+
}) : l
|
|
1392
1392
|
}, e);
|
|
1393
1393
|
}),
|
|
1394
|
-
|
|
1394
|
+
l && /* @__PURE__ */ Z("td", {
|
|
1395
1395
|
style: {
|
|
1396
1396
|
padding: "4px 8px",
|
|
1397
1397
|
borderBottom: "1px solid var(--divider)",
|
|
@@ -1404,7 +1404,7 @@ function Re({ rowId: t, row: n, entity: r, entities: i, screens: o, columns: c,
|
|
|
1404
1404
|
gap: 4
|
|
1405
1405
|
},
|
|
1406
1406
|
children: [
|
|
1407
|
-
_?.saving && /* @__PURE__ */ Z(
|
|
1407
|
+
_?.saving && /* @__PURE__ */ Z(m, { size: 12 }),
|
|
1408
1408
|
_?.error && /* @__PURE__ */ Z("span", {
|
|
1409
1409
|
style: {
|
|
1410
1410
|
fontSize: 11,
|
|
@@ -1413,13 +1413,13 @@ function Re({ rowId: t, row: n, entity: r, entities: i, screens: o, columns: c,
|
|
|
1413
1413
|
title: _.error,
|
|
1414
1414
|
children: "!"
|
|
1415
1415
|
}),
|
|
1416
|
-
|
|
1416
|
+
u === "row_edit" && /* @__PURE__ */ Z(i, {
|
|
1417
1417
|
size: 24,
|
|
1418
1418
|
icon: /* @__PURE__ */ Z(e.edit, { size: 12 }),
|
|
1419
1419
|
onClick: () => b(t),
|
|
1420
1420
|
title: "Edit row"
|
|
1421
1421
|
}),
|
|
1422
|
-
/* @__PURE__ */ Z(
|
|
1422
|
+
/* @__PURE__ */ Z(i, {
|
|
1423
1423
|
size: 24,
|
|
1424
1424
|
icon: /* @__PURE__ */ Z(e.trash, { size: 12 }),
|
|
1425
1425
|
onClick: () => y(t),
|
|
@@ -1428,7 +1428,7 @@ function Re({ rowId: t, row: n, entity: r, entities: i, screens: o, columns: c,
|
|
|
1428
1428
|
]
|
|
1429
1429
|
})
|
|
1430
1430
|
}),
|
|
1431
|
-
!
|
|
1431
|
+
!l && E && E.length > 0 && /* @__PURE__ */ Z("td", {
|
|
1432
1432
|
style: {
|
|
1433
1433
|
padding: "4px 8px",
|
|
1434
1434
|
borderBottom: "1px solid var(--divider)",
|
|
@@ -1438,15 +1438,15 @@ function Re({ rowId: t, row: n, entity: r, entities: i, screens: o, columns: c,
|
|
|
1438
1438
|
entity: r,
|
|
1439
1439
|
actions: E,
|
|
1440
1440
|
objectIds: [t],
|
|
1441
|
-
row:
|
|
1441
|
+
row: A,
|
|
1442
1442
|
onSuccess: D
|
|
1443
1443
|
})
|
|
1444
1444
|
})
|
|
1445
1445
|
]
|
|
1446
1446
|
});
|
|
1447
1447
|
}
|
|
1448
|
-
function ze({ values: t, entity: n, columns: r, editableColumns:
|
|
1449
|
-
let
|
|
1448
|
+
function ze({ values: t, entity: n, columns: r, editableColumns: a, errors: o, saving: s, onChange: c, onConfirm: l, onCancel: u, refs: d, accent: f }) {
|
|
1449
|
+
let p = k(), h = o.find((e) => e.startsWith("_error:")), g = new Set(o.filter((e) => !e.startsWith("_error:"))), _ = {
|
|
1450
1450
|
padding: "6px 12px",
|
|
1451
1451
|
borderBottom: "1px solid var(--divider)",
|
|
1452
1452
|
verticalAlign: "middle",
|
|
@@ -1459,13 +1459,13 @@ function ze({ values: t, entity: n, columns: r, editableColumns: i, errors: o, s
|
|
|
1459
1459
|
minWidth: 0
|
|
1460
1460
|
};
|
|
1461
1461
|
return /* @__PURE__ */ Q("tr", {
|
|
1462
|
-
style:
|
|
1462
|
+
style: f ? { boxShadow: "inset 3px 0 0 var(--accent)" } : void 0,
|
|
1463
1463
|
onKeyDown: (e) => {
|
|
1464
|
-
e.key === "Enter" && !e.shiftKey ? (e.preventDefault(),
|
|
1464
|
+
e.key === "Enter" && !e.shiftKey ? (e.preventDefault(), l()) : e.key === "Escape" && (e.preventDefault(), u());
|
|
1465
1465
|
},
|
|
1466
1466
|
children: [r.map((e) => {
|
|
1467
|
-
let r = n.fields.get(e),
|
|
1468
|
-
return
|
|
1467
|
+
let r = n.fields.get(e), i = a.has(e), o = g.has(e);
|
|
1468
|
+
return i ? /* @__PURE__ */ Z("td", {
|
|
1469
1469
|
style: {
|
|
1470
1470
|
..._,
|
|
1471
1471
|
outline: o ? "1px solid var(--danger)" : "none",
|
|
@@ -1474,24 +1474,24 @@ function ze({ values: t, entity: n, columns: r, editableColumns: i, errors: o, s
|
|
|
1474
1474
|
title: o ? `${e} is required` : void 0,
|
|
1475
1475
|
children: /* @__PURE__ */ Z("div", {
|
|
1476
1476
|
style: v,
|
|
1477
|
-
children: r ?
|
|
1477
|
+
children: r ? H({
|
|
1478
1478
|
field: r,
|
|
1479
1479
|
fieldName: e,
|
|
1480
1480
|
value: t[e],
|
|
1481
1481
|
mode: "edit",
|
|
1482
|
-
onChange: (t) =>
|
|
1482
|
+
onChange: (t) => c(e, t),
|
|
1483
1483
|
record: t,
|
|
1484
|
-
refs:
|
|
1484
|
+
refs: d,
|
|
1485
1485
|
compact: !0,
|
|
1486
|
-
locale:
|
|
1487
|
-
}) :
|
|
1486
|
+
locale: p
|
|
1487
|
+
}) : L(t[e])
|
|
1488
1488
|
})
|
|
1489
1489
|
}, e) : /* @__PURE__ */ Z("td", {
|
|
1490
1490
|
style: {
|
|
1491
1491
|
..._,
|
|
1492
1492
|
color: "var(--text-3)"
|
|
1493
1493
|
},
|
|
1494
|
-
children: r?.auto ? "—" :
|
|
1494
|
+
children: r?.auto ? "—" : L(t[e])
|
|
1495
1495
|
}, e);
|
|
1496
1496
|
}), /* @__PURE__ */ Z("td", {
|
|
1497
1497
|
style: _,
|
|
@@ -1511,16 +1511,16 @@ function ze({ values: t, entity: n, columns: r, editableColumns: i, errors: o, s
|
|
|
1511
1511
|
title: h.slice(7),
|
|
1512
1512
|
children: "!"
|
|
1513
1513
|
}),
|
|
1514
|
-
/* @__PURE__ */ Z(
|
|
1514
|
+
/* @__PURE__ */ Z(i, {
|
|
1515
1515
|
size: 24,
|
|
1516
|
-
icon: Z(
|
|
1517
|
-
onClick:
|
|
1516
|
+
icon: Z(s ? m : e.check, { size: 12 }),
|
|
1517
|
+
onClick: l,
|
|
1518
1518
|
title: "Confirm (Enter)"
|
|
1519
1519
|
}),
|
|
1520
|
-
/* @__PURE__ */ Z(
|
|
1520
|
+
/* @__PURE__ */ Z(i, {
|
|
1521
1521
|
size: 24,
|
|
1522
1522
|
icon: /* @__PURE__ */ Z(e.x, { size: 12 }),
|
|
1523
|
-
onClick:
|
|
1523
|
+
onClick: u,
|
|
1524
1524
|
title: "Cancel (Esc)"
|
|
1525
1525
|
})
|
|
1526
1526
|
]
|
|
@@ -1528,18 +1528,18 @@ function ze({ values: t, entity: n, columns: r, editableColumns: i, errors: o, s
|
|
|
1528
1528
|
})]
|
|
1529
1529
|
});
|
|
1530
1530
|
}
|
|
1531
|
-
function Be({ values: t, entity:
|
|
1532
|
-
let h =
|
|
1531
|
+
function Be({ values: t, entity: r, columns: a, editableColumns: o, errors: s, saving: c, onChange: l, onConfirm: u, onCancel: d, refs: f, accent: p }) {
|
|
1532
|
+
let h = k(), g = ue(), _ = s.find((e) => e.startsWith("_error:")), v = new Set(s.filter((e) => !e.startsWith("_error:")));
|
|
1533
1533
|
return /* @__PURE__ */ Q("div", {
|
|
1534
1534
|
style: {
|
|
1535
1535
|
border: "1px solid var(--border)",
|
|
1536
1536
|
borderRadius: 8,
|
|
1537
1537
|
background: "var(--surface)",
|
|
1538
1538
|
overflow: "hidden",
|
|
1539
|
-
boxShadow:
|
|
1539
|
+
boxShadow: p ? "inset 3px 0 0 var(--accent)" : void 0
|
|
1540
1540
|
},
|
|
1541
1541
|
onKeyDown: (e) => {
|
|
1542
|
-
e.key === "Enter" && !e.shiftKey ? (e.preventDefault(), u()) : e.key === "Escape" && (e.preventDefault(),
|
|
1542
|
+
e.key === "Enter" && !e.shiftKey ? (e.preventDefault(), u()) : e.key === "Escape" && (e.preventDefault(), d());
|
|
1543
1543
|
},
|
|
1544
1544
|
children: [/* @__PURE__ */ Z("div", {
|
|
1545
1545
|
style: {
|
|
@@ -1548,8 +1548,8 @@ function Be({ values: t, entity: n, columns: r, editableColumns: i, errors: o, s
|
|
|
1548
1548
|
flexDirection: "column",
|
|
1549
1549
|
gap: 12
|
|
1550
1550
|
},
|
|
1551
|
-
children:
|
|
1552
|
-
let
|
|
1551
|
+
children: a.map((e) => {
|
|
1552
|
+
let i = r.fields.get(e), a = o.has(e), s = v.has(e), c = i ? n(i, e) : e, u = `${g}-${e}`, d = `${u}-label`, p = {
|
|
1553
1553
|
fontSize: 11.5,
|
|
1554
1554
|
fontWeight: 600,
|
|
1555
1555
|
color: "var(--text-3)"
|
|
@@ -1561,36 +1561,36 @@ function Be({ values: t, entity: n, columns: r, editableColumns: i, errors: o, s
|
|
|
1561
1561
|
gap: 5,
|
|
1562
1562
|
minWidth: 0
|
|
1563
1563
|
},
|
|
1564
|
-
children: [a &&
|
|
1565
|
-
id:
|
|
1566
|
-
htmlFor:
|
|
1567
|
-
style:
|
|
1568
|
-
children:
|
|
1564
|
+
children: [a && i ? /* @__PURE__ */ Z("label", {
|
|
1565
|
+
id: d,
|
|
1566
|
+
htmlFor: u,
|
|
1567
|
+
style: p,
|
|
1568
|
+
children: c
|
|
1569
1569
|
}) : /* @__PURE__ */ Z("div", {
|
|
1570
|
-
id:
|
|
1571
|
-
style:
|
|
1572
|
-
children:
|
|
1570
|
+
id: d,
|
|
1571
|
+
style: p,
|
|
1572
|
+
children: c
|
|
1573
1573
|
}), /* @__PURE__ */ Z("div", {
|
|
1574
1574
|
style: {
|
|
1575
1575
|
minWidth: 0,
|
|
1576
|
-
outline:
|
|
1576
|
+
outline: s ? "1px solid var(--danger)" : "none",
|
|
1577
1577
|
outlineOffset: 3,
|
|
1578
|
-
borderRadius:
|
|
1578
|
+
borderRadius: s ? 5 : 0
|
|
1579
1579
|
},
|
|
1580
|
-
title:
|
|
1581
|
-
children: a ?
|
|
1582
|
-
field:
|
|
1580
|
+
title: s ? `${e} is required` : void 0,
|
|
1581
|
+
children: a ? i ? H({
|
|
1582
|
+
field: i,
|
|
1583
1583
|
fieldName: e,
|
|
1584
1584
|
value: t[e],
|
|
1585
1585
|
mode: "edit",
|
|
1586
1586
|
onChange: (t) => l(e, t),
|
|
1587
1587
|
record: t,
|
|
1588
|
-
refs:
|
|
1588
|
+
refs: f,
|
|
1589
1589
|
compact: !0,
|
|
1590
|
-
fieldId:
|
|
1591
|
-
labelId:
|
|
1590
|
+
fieldId: u,
|
|
1591
|
+
labelId: d,
|
|
1592
1592
|
locale: h
|
|
1593
|
-
}) :
|
|
1593
|
+
}) : L(t[e]) : i?.auto ? "—" : L(t[e])
|
|
1594
1594
|
})]
|
|
1595
1595
|
}, e);
|
|
1596
1596
|
})
|
|
@@ -1613,16 +1613,16 @@ function Be({ values: t, entity: n, columns: r, editableColumns: i, errors: o, s
|
|
|
1613
1613
|
title: _.slice(7),
|
|
1614
1614
|
children: "!"
|
|
1615
1615
|
}),
|
|
1616
|
-
/* @__PURE__ */ Z(
|
|
1616
|
+
/* @__PURE__ */ Z(i, {
|
|
1617
1617
|
size: 32,
|
|
1618
|
-
icon: Z(c ?
|
|
1618
|
+
icon: Z(c ? m : e.check, { size: 14 }),
|
|
1619
1619
|
onClick: u,
|
|
1620
1620
|
title: "Confirm (Enter)"
|
|
1621
1621
|
}),
|
|
1622
|
-
/* @__PURE__ */ Z(
|
|
1622
|
+
/* @__PURE__ */ Z(i, {
|
|
1623
1623
|
size: 32,
|
|
1624
1624
|
icon: /* @__PURE__ */ Z(e.x, { size: 14 }),
|
|
1625
|
-
onClick:
|
|
1625
|
+
onClick: d,
|
|
1626
1626
|
title: "Cancel (Esc)"
|
|
1627
1627
|
})
|
|
1628
1628
|
]
|
|
@@ -1630,7 +1630,7 @@ function Be({ values: t, entity: n, columns: r, editableColumns: i, errors: o, s
|
|
|
1630
1630
|
});
|
|
1631
1631
|
}
|
|
1632
1632
|
function Ve({ draftRow: e, entity: t, columns: n, editableColumns: r, foreignKey: i, draftErrors: a, draftSaving: o, onChange: s, onConfirm: c, onCancel: l, refs: u }) {
|
|
1633
|
-
let d =
|
|
1633
|
+
let d = J(() => {
|
|
1634
1634
|
let e = new Set(r);
|
|
1635
1635
|
return e.delete(i), e;
|
|
1636
1636
|
}, [r, i]);
|
|
@@ -1649,7 +1649,7 @@ function Ve({ draftRow: e, entity: t, columns: n, editableColumns: r, foreignKey
|
|
|
1649
1649
|
});
|
|
1650
1650
|
}
|
|
1651
1651
|
function He({ draftRow: e, entity: t, columns: n, editableColumns: r, foreignKey: i, draftErrors: a, draftSaving: o, onChange: s, onConfirm: c, onCancel: l, refs: u }) {
|
|
1652
|
-
let d =
|
|
1652
|
+
let d = J(() => {
|
|
1653
1653
|
let e = new Set(r);
|
|
1654
1654
|
return e.delete(i), e;
|
|
1655
1655
|
}, [r, i]);
|
|
@@ -1669,7 +1669,7 @@ function He({ draftRow: e, entity: t, columns: n, editableColumns: r, foreignKey
|
|
|
1669
1669
|
}
|
|
1670
1670
|
//#endregion
|
|
1671
1671
|
//#region src/components/shared/ErrorBoundary.tsx
|
|
1672
|
-
var Ue = class extends
|
|
1672
|
+
var Ue = class extends ce {
|
|
1673
1673
|
constructor(e) {
|
|
1674
1674
|
super(e), this.state = {
|
|
1675
1675
|
hasError: !1,
|
|
@@ -1726,7 +1726,7 @@ var Ue = class extends le {
|
|
|
1726
1726
|
},
|
|
1727
1727
|
children: this.state.error?.message || "An unexpected error occurred."
|
|
1728
1728
|
}),
|
|
1729
|
-
/* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(
|
|
1729
|
+
/* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(b, {
|
|
1730
1730
|
onClick: this.handleRetry,
|
|
1731
1731
|
children: "Try again"
|
|
1732
1732
|
}) })
|
|
@@ -1746,9 +1746,9 @@ function We(e, t) {
|
|
|
1746
1746
|
}
|
|
1747
1747
|
function Ge(e, t) {
|
|
1748
1748
|
let n = We(e, t), r = n[2];
|
|
1749
|
-
return
|
|
1749
|
+
return fe({
|
|
1750
1750
|
queryKey: n,
|
|
1751
|
-
queryFn: () =>
|
|
1751
|
+
queryFn: () => R(e, t),
|
|
1752
1752
|
enabled: !!e && !!t && t !== "new" && r !== void 0
|
|
1753
1753
|
});
|
|
1754
1754
|
}
|