@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
|
@@ -1,2854 +0,0 @@
|
|
|
1
|
-
import { s as e } from "./DynamicIcon-DW5krHuX.js";
|
|
2
|
-
import { $n as t, Bn as n, Br as r, Er as i, Et as a, G as o, H as s, Ht as c, J as l, K as u, Kn as d, Lr as f, Mr as p, Or as m, Qn as h, R as g, Rr as _, U as v, V as y, Vr as b, Vt as x, Xt as S, Yn as C, Zn as w, _ as T, _t as E, ar as D, at as O, b as ee, dn as te, en as ne, er as k, et as re, g as A, h as j, i as M, jt as ie, kr as N, lr as P, m as F, mr as I, nr as L, nt as ae, p as R, qn as oe, rn as se, rt as ce, tn as le, tr as ue, un as de, v as fe, z as pe, zr as me } from "./useCurrentScreen-CzwzQpoW.js";
|
|
3
|
-
import { a as he, i as ge, m as _e, s as ve, t as ye } from "./RefreshControl-CNtN8zSl.js";
|
|
4
|
-
import { t as be } from "./Check-DAfMbQIw.js";
|
|
5
|
-
import { C as xe, M as Se, O as Ce, P as we, T as Te, l as Ee, n as De, p as Oe, u as ke, x as Ae } from "./field-classification-D6xQYn-h.js";
|
|
6
|
-
import { a as je, c as Me, f as Ne, h as Pe, l as Fe, m as Ie, n as Le, o as Re, p as ze, r as Be, t as Ve } from "./action-dispatch-CR4ajBtT.js";
|
|
7
|
-
import { c as He, i as Ue, n as We, o as Ge, r as Ke, s as qe, t as Je } from "./cardProjection-CW5RIMko.js";
|
|
8
|
-
import { a as Ye, c as Xe, d as Ze, f as Qe, l as $e, o as et, p as tt, s as nt, t as rt, u as z } from "./format-count-Dobmi-Ji.js";
|
|
9
|
-
import { l as it, m as at, n as ot, t as st } from "./useTabSearchMirror-C39U85cg.js";
|
|
10
|
-
import { a as ct, c as lt, i as ut, n as dt, o as B, s as ft, t as pt } from "./peekDraftStore-5wQ7lq_V.js";
|
|
11
|
-
import { t as mt } from "./useListQuery-D7Hr5WM1.js";
|
|
12
|
-
import { Suspense as ht, createElement as V, lazy as gt, memo as H, useCallback as U, useEffect as W, useMemo as G, useRef as K, useState as q } from "react";
|
|
13
|
-
import { useSearchParams as _t } from "react-router";
|
|
14
|
-
import { useQueries as vt, useQueryClient as yt } from "@tanstack/react-query";
|
|
15
|
-
import { Fragment as J, jsx as Y, jsxs as X } from "react/jsx-runtime";
|
|
16
|
-
import { columnResizingFeature as bt, columnSizingFeature as xt, columnVisibilityFeature as St, flexRender as Ct, rowSelectionFeature as wt, rowSortingFeature as Tt, tableFeatures as Et, useTable as Dt } from "@tanstack/react-table";
|
|
17
|
-
import { useVirtualizer as Ot } from "@tanstack/react-virtual";
|
|
18
|
-
//#region src/components/pages/list/table-features.ts
|
|
19
|
-
var kt = Et({
|
|
20
|
-
rowSortingFeature: Tt,
|
|
21
|
-
rowSelectionFeature: wt,
|
|
22
|
-
columnSizingFeature: xt,
|
|
23
|
-
columnResizingFeature: bt,
|
|
24
|
-
columnVisibilityFeature: St
|
|
25
|
-
}), At = [
|
|
26
|
-
25,
|
|
27
|
-
50,
|
|
28
|
-
100,
|
|
29
|
-
200,
|
|
30
|
-
500,
|
|
31
|
-
1e3
|
|
32
|
-
];
|
|
33
|
-
//#endregion
|
|
34
|
-
//#region src/components/pages/list/filter-meta.ts
|
|
35
|
-
function jt(e, n, r) {
|
|
36
|
-
if (!e || !n) return [];
|
|
37
|
-
let i = e.filters ?? n.fields.names(), a = e.filter_operators ?? {}, o = [];
|
|
38
|
-
for (let s of i) {
|
|
39
|
-
let i = a[s];
|
|
40
|
-
if (!i || i.length === 0) continue;
|
|
41
|
-
if (s.startsWith("$status.")) {
|
|
42
|
-
let e = s.slice(8), t = n.status_groups?.[e];
|
|
43
|
-
if (!t) continue;
|
|
44
|
-
o.push({
|
|
45
|
-
code: s,
|
|
46
|
-
label: L(t.name) || e,
|
|
47
|
-
type: "status",
|
|
48
|
-
operators: i,
|
|
49
|
-
options: t.statuses.map((e) => ({
|
|
50
|
-
value: e.code,
|
|
51
|
-
label: L(e.name) || e.code,
|
|
52
|
-
color: e.color
|
|
53
|
-
}))
|
|
54
|
-
});
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
if (s.startsWith("$property.")) {
|
|
58
|
-
let e = s.slice(10), t = n.properties?.[e];
|
|
59
|
-
if (!t) continue;
|
|
60
|
-
o.push({
|
|
61
|
-
code: s,
|
|
62
|
-
label: L(t.name) || e,
|
|
63
|
-
type: "property",
|
|
64
|
-
operators: i
|
|
65
|
-
});
|
|
66
|
-
continue;
|
|
67
|
-
}
|
|
68
|
-
let c = n.fields.get(s);
|
|
69
|
-
if (!c) continue;
|
|
70
|
-
let l = t(c, s, r), u = c.values?.map((e) => ({
|
|
71
|
-
value: e.code,
|
|
72
|
-
label: L(e.name) || e.code,
|
|
73
|
-
color: e.color
|
|
74
|
-
})), d = C(c.filter_special_values, e?.filter_special_values?.[s]);
|
|
75
|
-
o.push({
|
|
76
|
-
code: s,
|
|
77
|
-
label: l,
|
|
78
|
-
type: c.type,
|
|
79
|
-
operators: i,
|
|
80
|
-
options: u,
|
|
81
|
-
ref: c.ref,
|
|
82
|
-
specialValues: d.length > 0 ? d : void 0
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
return o;
|
|
86
|
-
}
|
|
87
|
-
//#endregion
|
|
88
|
-
//#region src/components/pages/list/useListSort.ts
|
|
89
|
-
function Mt({ searchParams: e, setSearchParams: t, screenSortDefault: n, commitScreenTabSearch: r }) {
|
|
90
|
-
let i = e.get("sort") ?? n ?? "", a = G(() => j(i), [i]), o = G(() => {
|
|
91
|
-
let e = /* @__PURE__ */ new Map();
|
|
92
|
-
for (let t of a) t.nulls && e.set(t.field, t.nulls);
|
|
93
|
-
return e;
|
|
94
|
-
}, [a]), s = G(() => fe(i), [i]), c = G(() => a.map((e) => ({
|
|
95
|
-
id: e.field,
|
|
96
|
-
desc: e.dir === "desc"
|
|
97
|
-
})), [a]), l = U((n) => {
|
|
98
|
-
let i = n.slice(0, 5), a = new URLSearchParams(e);
|
|
99
|
-
i.length === 0 ? a.delete("sort") : a.set("sort", T(i)), a.set("page", "1"), r(a.toString()), t(a);
|
|
100
|
-
}, [
|
|
101
|
-
e,
|
|
102
|
-
r,
|
|
103
|
-
t
|
|
104
|
-
]);
|
|
105
|
-
return {
|
|
106
|
-
cols: a,
|
|
107
|
-
nullsByField: o,
|
|
108
|
-
forRequest: s,
|
|
109
|
-
tableSorting: c,
|
|
110
|
-
write: l,
|
|
111
|
-
applyColumn: U((e, t, n) => l([{
|
|
112
|
-
field: e,
|
|
113
|
-
dir: t,
|
|
114
|
-
...n ? { nulls: n } : {}
|
|
115
|
-
}]), [l]),
|
|
116
|
-
shiftClickColumn: U((e) => l(F(a, e)), [a, l]),
|
|
117
|
-
appendColumn: U((e, t, n) => l(R(a, {
|
|
118
|
-
field: e,
|
|
119
|
-
dir: t,
|
|
120
|
-
...n ? { nulls: n } : {}
|
|
121
|
-
})), [a, l]),
|
|
122
|
-
clearColumn: U((e) => l(A(a, e)), [a, l]),
|
|
123
|
-
clearAll: U(() => l([]), [l])
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
//#endregion
|
|
127
|
-
//#region src/components/pages/list/useListSelection.ts
|
|
128
|
-
var Nt = {};
|
|
129
|
-
function Pt(e, t) {
|
|
130
|
-
return D(e, h(e, t));
|
|
131
|
-
}
|
|
132
|
-
function Ft(e, t, n) {
|
|
133
|
-
if (!e || n.length === 0) return [];
|
|
134
|
-
let r = new Set(n);
|
|
135
|
-
return t.filter((t) => r.has(Pt(e, t))).map((t) => h(e, t));
|
|
136
|
-
}
|
|
137
|
-
function It(e, t, n) {
|
|
138
|
-
let [r, i] = Ze("selection", Nt, { scope: "path" }), a = G(() => e?.fields.names().find((t) => e.fields.get(t)?.primary) ?? "id", [e]), o = U((t) => e ? Pt(e, t) : I(t[a]), [e, a]), s = G(() => Object.keys(r).filter((e) => r[e]), [r]), c = G(() => Ft(e, t, s), [
|
|
139
|
-
e,
|
|
140
|
-
t,
|
|
141
|
-
s
|
|
142
|
-
]), l = G(() => {
|
|
143
|
-
if (s.length === 0) return [];
|
|
144
|
-
let e = /* @__PURE__ */ new Map();
|
|
145
|
-
for (let n of t) e.set(o(n), n);
|
|
146
|
-
return s.map((t) => e.get(t)).filter((e) => e !== void 0);
|
|
147
|
-
}, [
|
|
148
|
-
s,
|
|
149
|
-
t,
|
|
150
|
-
o
|
|
151
|
-
]);
|
|
152
|
-
return W(() => {
|
|
153
|
-
n || i((e) => {
|
|
154
|
-
let n = Object.keys(e);
|
|
155
|
-
if (n.length === 0) return e;
|
|
156
|
-
let r = new Set(t.map((e) => o(e))), i = {}, a = !1;
|
|
157
|
-
for (let t of n) r.has(t) ? i[t] = e[t] : a = !0;
|
|
158
|
-
return a ? i : e;
|
|
159
|
-
});
|
|
160
|
-
}, [
|
|
161
|
-
t,
|
|
162
|
-
n,
|
|
163
|
-
o,
|
|
164
|
-
i
|
|
165
|
-
]), {
|
|
166
|
-
state: r,
|
|
167
|
-
setState: i,
|
|
168
|
-
ids: s,
|
|
169
|
-
pkValues: c,
|
|
170
|
-
rows: l,
|
|
171
|
-
keyOf: o
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
//#endregion
|
|
175
|
-
//#region src/components/pages/list/useListColumnLayout.ts
|
|
176
|
-
function Lt({ screenCode: e, screen: t, searchParams: n, setSearchParams: r }) {
|
|
177
|
-
let i = G(() => {
|
|
178
|
-
let e = n.get("columns");
|
|
179
|
-
return e ? e.split(",").filter(Boolean) : t?.default_columns ?? t?.columns ?? [];
|
|
180
|
-
}, [
|
|
181
|
-
n,
|
|
182
|
-
t?.default_columns,
|
|
183
|
-
t?.columns
|
|
184
|
-
]), { widths: a, prune: o, setWidths: s, resetWidths: c, resizeEduShown: l, markResizeEduShown: u } = xe(e), [d, f] = q(() => a);
|
|
185
|
-
W(() => {
|
|
186
|
-
f(a);
|
|
187
|
-
}, [a]);
|
|
188
|
-
let p = G(() => t?.columns ?? [], [t?.columns]);
|
|
189
|
-
W(() => {
|
|
190
|
-
p.length > 0 && o(p);
|
|
191
|
-
}, [p, o]);
|
|
192
|
-
let m = U((e) => {
|
|
193
|
-
if (e.length === 0) return;
|
|
194
|
-
let t = new URLSearchParams(n);
|
|
195
|
-
t.set("columns", e.join(",")), r(t);
|
|
196
|
-
}, [n, r]);
|
|
197
|
-
return {
|
|
198
|
-
visible: i,
|
|
199
|
-
sizing: d,
|
|
200
|
-
setSizing: f,
|
|
201
|
-
apply: m,
|
|
202
|
-
clear: U(() => {
|
|
203
|
-
let e = new URLSearchParams(n);
|
|
204
|
-
e.delete("columns"), r(e);
|
|
205
|
-
}, [n, r]),
|
|
206
|
-
move: U((e, t) => {
|
|
207
|
-
let n = i.indexOf(e);
|
|
208
|
-
if (n === -1) return;
|
|
209
|
-
let r = t === "up" ? n - 1 : n + 1;
|
|
210
|
-
if (r < 0 || r >= i.length) return;
|
|
211
|
-
let a = [...i];
|
|
212
|
-
[a[n], a[r]] = [a[r], a[n]], m(a);
|
|
213
|
-
}, [i, m]),
|
|
214
|
-
commitResize: U((e) => {
|
|
215
|
-
s(e), !l && (u(), ie.info("Column width saved on this device", "Widths are personal and never shared. Column order, sort and filters can be saved into a view."));
|
|
216
|
-
}, [
|
|
217
|
-
s,
|
|
218
|
-
l,
|
|
219
|
-
u
|
|
220
|
-
]),
|
|
221
|
-
resetWidths: c
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
function Rt(e, t, n = 10) {
|
|
225
|
-
switch (t.type) {
|
|
226
|
-
case "down": return {
|
|
227
|
-
origin: {
|
|
228
|
-
x: t.x,
|
|
229
|
-
y: t.y
|
|
230
|
-
},
|
|
231
|
-
outcome: "pending"
|
|
232
|
-
};
|
|
233
|
-
case "move": return e ? Math.abs(t.x - e.x) > n || Math.abs(t.y - e.y) > n ? {
|
|
234
|
-
origin: null,
|
|
235
|
-
outcome: "idle"
|
|
236
|
-
} : {
|
|
237
|
-
origin: e,
|
|
238
|
-
outcome: "pending"
|
|
239
|
-
} : {
|
|
240
|
-
origin: null,
|
|
241
|
-
outcome: "idle"
|
|
242
|
-
};
|
|
243
|
-
case "release": return {
|
|
244
|
-
origin: null,
|
|
245
|
-
outcome: "idle"
|
|
246
|
-
};
|
|
247
|
-
case "held": return e ? {
|
|
248
|
-
origin: null,
|
|
249
|
-
outcome: "fire"
|
|
250
|
-
} : {
|
|
251
|
-
origin: null,
|
|
252
|
-
outcome: "idle"
|
|
253
|
-
};
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
function zt(e) {
|
|
257
|
-
return e instanceof Element && e.closest("a, button, input, select, [role='button'], [role='menuitem']") !== null;
|
|
258
|
-
}
|
|
259
|
-
function Bt(e, t) {
|
|
260
|
-
return e != null && e.rowId === t ? "double" : "single";
|
|
261
|
-
}
|
|
262
|
-
//#endregion
|
|
263
|
-
//#region src/hooks/useLongPress.ts
|
|
264
|
-
function Vt(e) {
|
|
265
|
-
let t = K(null), n = K(null), r = K(!1), i = U(() => {
|
|
266
|
-
n.current !== null && clearTimeout(n.current), n.current = null;
|
|
267
|
-
}, []);
|
|
268
|
-
W(() => i, [i]);
|
|
269
|
-
let a = U((e) => {
|
|
270
|
-
let n = Rt(t.current, e);
|
|
271
|
-
return t.current = n.origin, n.outcome !== "pending" && i(), n;
|
|
272
|
-
}, [i]);
|
|
273
|
-
return {
|
|
274
|
-
handlers: {
|
|
275
|
-
onPointerDown: (o) => {
|
|
276
|
-
if (o.pointerType === "mouse" || zt(o.target)) return;
|
|
277
|
-
r.current = !1, i();
|
|
278
|
-
let s = {
|
|
279
|
-
x: o.clientX,
|
|
280
|
-
y: o.clientY
|
|
281
|
-
};
|
|
282
|
-
a({
|
|
283
|
-
type: "down",
|
|
284
|
-
...s
|
|
285
|
-
}), n.current = setTimeout(() => {
|
|
286
|
-
let i = Rt(t.current, { type: "held" });
|
|
287
|
-
t.current = i.origin, n.current = null, i.outcome === "fire" && (r.current = !0, e(s));
|
|
288
|
-
}, 500);
|
|
289
|
-
},
|
|
290
|
-
onPointerMove: (e) => {
|
|
291
|
-
t.current && a({
|
|
292
|
-
type: "move",
|
|
293
|
-
x: e.clientX,
|
|
294
|
-
y: e.clientY
|
|
295
|
-
});
|
|
296
|
-
},
|
|
297
|
-
onPointerUp: () => void a({ type: "release" }),
|
|
298
|
-
onPointerCancel: () => void a({ type: "release" }),
|
|
299
|
-
onPointerLeave: () => void a({ type: "release" })
|
|
300
|
-
},
|
|
301
|
-
consumePressFired: U(() => {
|
|
302
|
-
let e = r.current;
|
|
303
|
-
return r.current = !1, e;
|
|
304
|
-
}, [])
|
|
305
|
-
};
|
|
306
|
-
}
|
|
307
|
-
//#endregion
|
|
308
|
-
//#region src/components/pages/list/useListRowInteraction.ts
|
|
309
|
-
function Ht({ entity: e, screen: n, screens: r, entities: i, searchParams: a, tabNavigate: o, commitScreenTabSearch: s, isPhone: c, canUpdate: l }) {
|
|
310
|
-
let [u, d] = q(null), [f, p] = q(null), m = K(null), g = K(null);
|
|
311
|
-
W(() => () => {
|
|
312
|
-
g.current && clearTimeout(g.current.timer);
|
|
313
|
-
}, []);
|
|
314
|
-
let _ = n?.on_row_click === "peek" && n.quick_peek?.enabled !== !1 && !c, v = U((t, i) => {
|
|
315
|
-
if (!e || !n) return;
|
|
316
|
-
let c = h(e, t), l = D(e, c), u = oe(n, e, r, c);
|
|
317
|
-
if (!u) return;
|
|
318
|
-
if (i?.draft) {
|
|
319
|
-
dt(l, i.draft);
|
|
320
|
-
let [e, t] = u.split("?", 2), n = new URLSearchParams(t ?? "");
|
|
321
|
-
n.set("edit", "true"), u = `${e}?${n.toString()}`;
|
|
322
|
-
}
|
|
323
|
-
let d = k(t, e) ?? L(e.display.name), f = n.display?.icon || e.display.icon;
|
|
324
|
-
s(a.toString()), o(u, {
|
|
325
|
-
title: d,
|
|
326
|
-
icon: f
|
|
327
|
-
});
|
|
328
|
-
}, [
|
|
329
|
-
e,
|
|
330
|
-
n,
|
|
331
|
-
r,
|
|
332
|
-
a,
|
|
333
|
-
o,
|
|
334
|
-
s
|
|
335
|
-
]), y = Vt(U((e) => {
|
|
336
|
-
let t = m.current;
|
|
337
|
-
t && p({
|
|
338
|
-
x: e.x,
|
|
339
|
-
y: e.y,
|
|
340
|
-
row: t
|
|
341
|
-
});
|
|
342
|
-
}, [])), b = U((t, n) => {
|
|
343
|
-
if (y.consumePressFired() || zt(t.target)) return;
|
|
344
|
-
if (!_ || !e) {
|
|
345
|
-
v(n);
|
|
346
|
-
return;
|
|
347
|
-
}
|
|
348
|
-
let r = Pt(e, n);
|
|
349
|
-
if (Bt(g.current, r) === "double") {
|
|
350
|
-
clearTimeout(g.current.timer), g.current = null, d(null), v(n);
|
|
351
|
-
return;
|
|
352
|
-
}
|
|
353
|
-
g.current && clearTimeout(g.current.timer);
|
|
354
|
-
let i = setTimeout(() => {
|
|
355
|
-
g.current = null, d(n);
|
|
356
|
-
}, 250);
|
|
357
|
-
g.current = {
|
|
358
|
-
rowId: r,
|
|
359
|
-
timer: i
|
|
360
|
-
};
|
|
361
|
-
}, [
|
|
362
|
-
e,
|
|
363
|
-
_,
|
|
364
|
-
v,
|
|
365
|
-
y
|
|
366
|
-
]);
|
|
367
|
-
return {
|
|
368
|
-
peekAllowed: _,
|
|
369
|
-
peekRow: u,
|
|
370
|
-
setPeekRow: d,
|
|
371
|
-
peekFields: G(() => {
|
|
372
|
-
if (!_ || !e || !u) return [];
|
|
373
|
-
let a = Be(e, n, u);
|
|
374
|
-
return Ke(e, a, r).map((n) => {
|
|
375
|
-
if (e.files?.get(n)) return {
|
|
376
|
-
key: n,
|
|
377
|
-
label: Ie(e, n, i),
|
|
378
|
-
kind: "file",
|
|
379
|
-
readOnly: !l
|
|
380
|
-
};
|
|
381
|
-
let r = e.fields.get(n), a = l && !r.primary && !r.auto && !r.ref && r.files?.mode !== "rich_text_inline";
|
|
382
|
-
return {
|
|
383
|
-
key: n,
|
|
384
|
-
label: t(r, n, i),
|
|
385
|
-
kind: "field",
|
|
386
|
-
field: r,
|
|
387
|
-
readOnly: !a
|
|
388
|
-
};
|
|
389
|
-
});
|
|
390
|
-
}, [
|
|
391
|
-
_,
|
|
392
|
-
u,
|
|
393
|
-
e,
|
|
394
|
-
n,
|
|
395
|
-
i,
|
|
396
|
-
r,
|
|
397
|
-
l
|
|
398
|
-
]),
|
|
399
|
-
peekActions: G(() => e?.actions ?? {}, [e?.actions]),
|
|
400
|
-
peekExecute: U(async (t, n, r) => {
|
|
401
|
-
let i = e?.fields.names().find((t) => e.fields.get(t)?.primary), a = i && u ? [I(u[i])] : void 0, o = n.entity ? `${n.entity}.${t}` : t;
|
|
402
|
-
return ne(o, S(r, a));
|
|
403
|
-
}, [e, u]),
|
|
404
|
-
contextMenu: f,
|
|
405
|
-
setContextMenu: p,
|
|
406
|
-
pressedRow: m,
|
|
407
|
-
longPress: y,
|
|
408
|
-
onRowClick: b,
|
|
409
|
-
navigateToDetail: v
|
|
410
|
-
};
|
|
411
|
-
}
|
|
412
|
-
//#endregion
|
|
413
|
-
//#region src/components/pages/list/column-sizing.ts
|
|
414
|
-
function Ut(e) {
|
|
415
|
-
return `--header-${e}-size`;
|
|
416
|
-
}
|
|
417
|
-
function Wt(e) {
|
|
418
|
-
return `--col-${e}-size`;
|
|
419
|
-
}
|
|
420
|
-
function Gt(e) {
|
|
421
|
-
return `calc(var(${e}) * 1px)`;
|
|
422
|
-
}
|
|
423
|
-
function Kt(e) {
|
|
424
|
-
let t = e.getFlatHeaders(), n = {};
|
|
425
|
-
for (let e of t) n[Ut(e.id)] = e.getSize(), n[Wt(e.column.id)] = e.column.getSize();
|
|
426
|
-
return n;
|
|
427
|
-
}
|
|
428
|
-
//#endregion
|
|
429
|
-
//#region src/components/pages/list/sortable-header.ts
|
|
430
|
-
var qt = /* @__PURE__ */ new Set([
|
|
431
|
-
"secret",
|
|
432
|
-
"password",
|
|
433
|
-
"json",
|
|
434
|
-
"string_array",
|
|
435
|
-
"int_array",
|
|
436
|
-
"uuid_array"
|
|
437
|
-
]);
|
|
438
|
-
function Jt(e, t) {
|
|
439
|
-
if (e === "_actions" || e === "_select" || e.startsWith("$property.") || e.startsWith("$refs.")) return !1;
|
|
440
|
-
if (e.startsWith("$status.")) return !0;
|
|
441
|
-
let n = t?.fields.get(e);
|
|
442
|
-
return !n || t?.list_pagination === "cursor" && n.cross_store_sortable === !1 ? !1 : !qt.has(n.type);
|
|
443
|
-
}
|
|
444
|
-
//#endregion
|
|
445
|
-
//#region src/components/pages/list/ListTable.tsx
|
|
446
|
-
var Yt = gt(() => import("./SortHeaderMenu-SYSAaqQJ.js").then((e) => ({ default: e.SortHeaderMenu }))), Xt = H(function({ virtualItems: e, topPad: t, bottomPad: n, colSpan: r, rows: i, renderRow: a }) {
|
|
447
|
-
return /* @__PURE__ */ X("tbody", { children: [
|
|
448
|
-
e.length > 0 && /* @__PURE__ */ Y("tr", { children: /* @__PURE__ */ Y("td", {
|
|
449
|
-
style: { height: t },
|
|
450
|
-
colSpan: r
|
|
451
|
-
}) }),
|
|
452
|
-
e.map((e) => a(i[e.index], e.index)),
|
|
453
|
-
e.length > 0 && /* @__PURE__ */ Y("tr", { children: /* @__PURE__ */ Y("td", {
|
|
454
|
-
style: { height: n },
|
|
455
|
-
colSpan: r
|
|
456
|
-
}) })
|
|
457
|
-
] });
|
|
458
|
-
}, (e, t) => t.isResizing);
|
|
459
|
-
function Zt({ table: t, columns: n, rows: r, entity: i, columnSizeVars: a, totalColumnsWidth: o, theadRef: s, virtualizer: c, visibleCols: l, headerReorder: u, sortCols: d, sortNullsMap: f, shiftClickColumn: p, applyColumnSort: m, appendColumnSort: h, clearColumnSort: g, clearAllSorts: _, renderRow: v, isResizingColumn: y }) {
|
|
460
|
-
return /* @__PURE__ */ X("table", {
|
|
461
|
-
"data-virtual-rows": "true",
|
|
462
|
-
style: {
|
|
463
|
-
...a,
|
|
464
|
-
tableLayout: "fixed",
|
|
465
|
-
width: "100%",
|
|
466
|
-
minWidth: o,
|
|
467
|
-
borderCollapse: "separate",
|
|
468
|
-
borderSpacing: 0,
|
|
469
|
-
fontSize: 12.5,
|
|
470
|
-
color: "var(--text)"
|
|
471
|
-
},
|
|
472
|
-
children: [/* @__PURE__ */ Y("thead", {
|
|
473
|
-
ref: s,
|
|
474
|
-
children: t.getHeaderGroups().map((t) => /* @__PURE__ */ X("tr", {
|
|
475
|
-
style: {
|
|
476
|
-
height: 32,
|
|
477
|
-
background: "var(--surface-2)"
|
|
478
|
-
},
|
|
479
|
-
children: [t.headers.map((t) => {
|
|
480
|
-
let n = Jt(t.id, i), r = t.column.getIsSorted(), a = t.id === "_select", o = t.id === "_actions", s = r ? d.findIndex((e) => e.field === t.id) + 1 : 0, c = d.length > 1 && s > 0, v = s > 0, y = d.length < 5, b = n ? t.column.getToggleSortingHandler() : void 0, x = n ? (e) => {
|
|
481
|
-
if (e.shiftKey) {
|
|
482
|
-
e.preventDefault(), p(t.id);
|
|
483
|
-
return;
|
|
484
|
-
}
|
|
485
|
-
b?.(e);
|
|
486
|
-
} : void 0, S = !a && !o, C = S ? l.indexOf(t.id) : -1, w = u.dragColId === t.id, T = u.isDragging && C !== -1 && u.dropIndex === C, E = u.isDragging && C !== -1 && C === l.length - 1 && u.dropIndex === l.length;
|
|
487
|
-
return /* @__PURE__ */ X("th", {
|
|
488
|
-
"data-col-id": S ? t.id : void 0,
|
|
489
|
-
onMouseDown: S ? (e) => u.onHeaderMouseDown(t.id, e) : void 0,
|
|
490
|
-
onClick: (e) => {
|
|
491
|
-
u.consumeDragSuppression() || x?.(e);
|
|
492
|
-
},
|
|
493
|
-
style: {
|
|
494
|
-
padding: a ? "0 6px 0 12px" : o ? "0 6px" : "0 10px",
|
|
495
|
-
textAlign: "left",
|
|
496
|
-
fontWeight: 600,
|
|
497
|
-
fontSize: 11,
|
|
498
|
-
letterSpacing: "0.01em",
|
|
499
|
-
color: "var(--text-3)",
|
|
500
|
-
whiteSpace: "nowrap",
|
|
501
|
-
cursor: n ? "pointer" : "default",
|
|
502
|
-
opacity: w ? .4 : 1,
|
|
503
|
-
boxShadow: T ? "inset 2px 0 0 0 var(--accent)" : E ? "inset -2px 0 0 0 var(--accent)" : void 0,
|
|
504
|
-
width: Gt(Ut(t.id)),
|
|
505
|
-
minWidth: Gt(Ut(t.id)),
|
|
506
|
-
borderBottom: "1px solid var(--border)",
|
|
507
|
-
background: "var(--surface-2)",
|
|
508
|
-
position: "sticky",
|
|
509
|
-
top: 0,
|
|
510
|
-
left: a ? 0 : "auto",
|
|
511
|
-
zIndex: a ? 3 : 2
|
|
512
|
-
},
|
|
513
|
-
children: [t.isPlaceholder ? null : n ? /* @__PURE__ */ X("span", {
|
|
514
|
-
style: {
|
|
515
|
-
display: "inline-flex",
|
|
516
|
-
alignItems: "center",
|
|
517
|
-
gap: 4,
|
|
518
|
-
textTransform: "uppercase",
|
|
519
|
-
fontSize: 10.5,
|
|
520
|
-
letterSpacing: "0.04em"
|
|
521
|
-
},
|
|
522
|
-
children: [
|
|
523
|
-
Ct(t.column.columnDef.header, t.getContext()),
|
|
524
|
-
/* @__PURE__ */ X("span", {
|
|
525
|
-
style: {
|
|
526
|
-
display: "inline-flex",
|
|
527
|
-
flexDirection: "column",
|
|
528
|
-
alignItems: "center",
|
|
529
|
-
lineHeight: 0
|
|
530
|
-
},
|
|
531
|
-
children: [r === "asc" ? /* @__PURE__ */ Y(e.arrowUp, { size: 11 }) : r === "desc" ? /* @__PURE__ */ Y(e.arrowDown, { size: 11 }) : /* @__PURE__ */ Y(e.sort, {
|
|
532
|
-
size: 11,
|
|
533
|
-
style: { opacity: .35 }
|
|
534
|
-
}), r && f.get(t.id) === "first" ? /* @__PURE__ */ Y("span", {
|
|
535
|
-
"aria-hidden": "true",
|
|
536
|
-
style: {
|
|
537
|
-
width: 4,
|
|
538
|
-
height: 4,
|
|
539
|
-
marginTop: 1,
|
|
540
|
-
borderRadius: 9999,
|
|
541
|
-
background: "var(--text-3)"
|
|
542
|
-
}
|
|
543
|
-
}) : null]
|
|
544
|
-
}),
|
|
545
|
-
c ? /* @__PURE__ */ Y("span", {
|
|
546
|
-
"aria-label": `Sort rank ${s}`,
|
|
547
|
-
style: {
|
|
548
|
-
fontSize: 10,
|
|
549
|
-
lineHeight: 1,
|
|
550
|
-
color: "var(--text-3)",
|
|
551
|
-
verticalAlign: "super",
|
|
552
|
-
fontVariantNumeric: "tabular-nums"
|
|
553
|
-
},
|
|
554
|
-
children: s
|
|
555
|
-
}) : null,
|
|
556
|
-
/* @__PURE__ */ Y(ht, {
|
|
557
|
-
fallback: null,
|
|
558
|
-
children: /* @__PURE__ */ Y(Yt, {
|
|
559
|
-
field: t.id,
|
|
560
|
-
activeDir: r,
|
|
561
|
-
activeNulls: f.get(t.id),
|
|
562
|
-
inMultiSort: v,
|
|
563
|
-
canAppend: y,
|
|
564
|
-
onApply: (e, n) => m(t.id, e, n),
|
|
565
|
-
onAppend: (e, n) => h(t.id, e, n),
|
|
566
|
-
onClearColumn: () => g(t.id),
|
|
567
|
-
onClearAll: _
|
|
568
|
-
})
|
|
569
|
-
})
|
|
570
|
-
]
|
|
571
|
-
}) : Ct(t.column.columnDef.header, t.getContext()), t.column.getCanResize() && /* @__PURE__ */ Y("div", {
|
|
572
|
-
"data-testid": "col-resize-handle",
|
|
573
|
-
"aria-hidden": "true",
|
|
574
|
-
onMouseDown: (e) => {
|
|
575
|
-
e.stopPropagation(), t.getResizeHandler()(e);
|
|
576
|
-
},
|
|
577
|
-
onTouchStart: (e) => {
|
|
578
|
-
e.stopPropagation(), t.getResizeHandler()(e);
|
|
579
|
-
},
|
|
580
|
-
onClick: (e) => e.stopPropagation(),
|
|
581
|
-
style: {
|
|
582
|
-
position: "absolute",
|
|
583
|
-
top: 0,
|
|
584
|
-
right: 0,
|
|
585
|
-
height: "100%",
|
|
586
|
-
width: 9,
|
|
587
|
-
display: "flex",
|
|
588
|
-
justifyContent: "center",
|
|
589
|
-
cursor: "col-resize",
|
|
590
|
-
touchAction: "none",
|
|
591
|
-
userSelect: "none",
|
|
592
|
-
zIndex: 3
|
|
593
|
-
},
|
|
594
|
-
children: /* @__PURE__ */ Y("span", { style: {
|
|
595
|
-
width: 2,
|
|
596
|
-
height: "60%",
|
|
597
|
-
alignSelf: "center",
|
|
598
|
-
borderRadius: 1,
|
|
599
|
-
background: t.column.getIsResizing() ? "var(--accent)" : "var(--border)"
|
|
600
|
-
} })
|
|
601
|
-
})]
|
|
602
|
-
}, t.id);
|
|
603
|
-
}), /* @__PURE__ */ Y("th", {
|
|
604
|
-
"aria-hidden": "true",
|
|
605
|
-
style: {
|
|
606
|
-
borderBottom: "1px solid var(--border)",
|
|
607
|
-
background: "var(--surface-2)",
|
|
608
|
-
position: "sticky",
|
|
609
|
-
top: 0,
|
|
610
|
-
zIndex: 2
|
|
611
|
-
}
|
|
612
|
-
})]
|
|
613
|
-
}, t.id))
|
|
614
|
-
}), /* @__PURE__ */ Y(Xt, {
|
|
615
|
-
virtualItems: c.getVirtualItems(),
|
|
616
|
-
topPad: c.getVirtualItems()[0]?.start ?? 0,
|
|
617
|
-
bottomPad: c.getTotalSize() - (c.getVirtualItems().at(-1)?.end ?? 0),
|
|
618
|
-
colSpan: n.length + 1,
|
|
619
|
-
rows: r,
|
|
620
|
-
renderRow: v,
|
|
621
|
-
isResizing: !!y
|
|
622
|
-
})]
|
|
623
|
-
});
|
|
624
|
-
}
|
|
625
|
-
//#endregion
|
|
626
|
-
//#region src/components/pages/list/DataCell.tsx
|
|
627
|
-
function Qt({ cell: e }) {
|
|
628
|
-
let t = e.column.id === "_select", n = e.column.id === "_actions", r = e.column.columnDef.cell, i = typeof r == "function" ? r(e.getContext()) : r;
|
|
629
|
-
return /* @__PURE__ */ Y("td", {
|
|
630
|
-
title: typeof i == "string" ? i : void 0,
|
|
631
|
-
style: {
|
|
632
|
-
padding: t ? "0 6px 0 12px" : n ? "0 6px" : "0 10px",
|
|
633
|
-
verticalAlign: "middle",
|
|
634
|
-
borderBottom: "1px solid var(--divider)",
|
|
635
|
-
width: Gt(Wt(e.column.id)),
|
|
636
|
-
whiteSpace: "nowrap",
|
|
637
|
-
overflow: "hidden",
|
|
638
|
-
textOverflow: "ellipsis",
|
|
639
|
-
maxWidth: Gt(Wt(e.column.id)),
|
|
640
|
-
color: "var(--text)",
|
|
641
|
-
position: t ? "sticky" : "static",
|
|
642
|
-
left: t ? 0 : "auto",
|
|
643
|
-
zIndex: +!!t
|
|
644
|
-
},
|
|
645
|
-
onClick: t || n ? (e) => e.stopPropagation() : void 0,
|
|
646
|
-
children: i
|
|
647
|
-
});
|
|
648
|
-
}
|
|
649
|
-
//#endregion
|
|
650
|
-
//#region src/components/pages/list/ListTableRow.tsx
|
|
651
|
-
function $t({ row: e, rowIndex: t, entity: n, hasSoftDelete: r, zebra: i, hasDetailTarget: a, interaction: o, measureElement: s }) {
|
|
652
|
-
let c = e.original, l = r && c[n.soft_delete] != null, u = e.getIsSelected(), d = i && t % 2 == 1;
|
|
653
|
-
return /* @__PURE__ */ X("tr", {
|
|
654
|
-
"data-index": t,
|
|
655
|
-
"data-row-stripe": d ? "" : void 0,
|
|
656
|
-
"aria-selected": u,
|
|
657
|
-
ref: (e) => s(e),
|
|
658
|
-
style: {
|
|
659
|
-
height: "var(--row-h)",
|
|
660
|
-
cursor: a || o.peekAllowed ? "pointer" : "default",
|
|
661
|
-
opacity: l ? .5 : 1,
|
|
662
|
-
fontStyle: l ? "italic" : "normal",
|
|
663
|
-
transition: "background-color 120ms"
|
|
664
|
-
},
|
|
665
|
-
onClick: a || o.peekAllowed ? (e) => o.onRowClick(e, c) : void 0,
|
|
666
|
-
onContextMenu: (e) => {
|
|
667
|
-
e.preventDefault(), o.setContextMenu({
|
|
668
|
-
x: e.clientX,
|
|
669
|
-
y: e.clientY,
|
|
670
|
-
row: c
|
|
671
|
-
});
|
|
672
|
-
},
|
|
673
|
-
...o.longPress.handlers,
|
|
674
|
-
onPointerDown: (e) => {
|
|
675
|
-
o.pressedRow.current = c, o.longPress.handlers.onPointerDown(e);
|
|
676
|
-
},
|
|
677
|
-
children: [e.getVisibleCells().map((e) => /* @__PURE__ */ Y(Qt, { cell: e }, e.id)), /* @__PURE__ */ Y("td", {
|
|
678
|
-
"aria-hidden": "true",
|
|
679
|
-
style: { borderBottom: "1px solid var(--divider)" }
|
|
680
|
-
})]
|
|
681
|
-
}, e.id);
|
|
682
|
-
}
|
|
683
|
-
//#endregion
|
|
684
|
-
//#region src/components/pages/list/ListNoRows.tsx
|
|
685
|
-
function en(e) {
|
|
686
|
-
if (e instanceof n) {
|
|
687
|
-
let t = e.ext("field"), n = e.ext("value");
|
|
688
|
-
return t && n !== void 0 ? `${e.message} ${t}: "${n}"` : t ? `${e.message} ${t}` : e.message;
|
|
689
|
-
}
|
|
690
|
-
return e instanceof Error && e.message ? e.message : "Something went wrong. Please try again.";
|
|
691
|
-
}
|
|
692
|
-
function tn({ isLoading: e, tableLoadingStale: t, isError: n, error: r, rowCount: i, entity: o, screen: s, screenName: c, screenIcon: l, isFiltered: u, canCreate: d, toolbarActions: f, onRetry: p }) {
|
|
693
|
-
let m = o.display;
|
|
694
|
-
return e && t ? /* @__PURE__ */ Y("div", {
|
|
695
|
-
style: { padding: "0 20px" },
|
|
696
|
-
children: /* @__PURE__ */ Y(z, {
|
|
697
|
-
icon: "alert-circle",
|
|
698
|
-
title: "Still loading data",
|
|
699
|
-
description: "This table is taking longer than expected. Retry the request or check network and server health.",
|
|
700
|
-
action: /* @__PURE__ */ Y(b, {
|
|
701
|
-
kind: "primary",
|
|
702
|
-
size: "sm",
|
|
703
|
-
onClick: p,
|
|
704
|
-
children: "Retry"
|
|
705
|
-
})
|
|
706
|
-
})
|
|
707
|
-
}) : e ? /* @__PURE__ */ Y(Ge, { cols: s.columns?.length ?? 4 }) : n ? /* @__PURE__ */ Y("div", {
|
|
708
|
-
style: { padding: "0 20px" },
|
|
709
|
-
children: /* @__PURE__ */ Y(z, {
|
|
710
|
-
icon: "alert-circle",
|
|
711
|
-
title: "Failed to load data",
|
|
712
|
-
description: en(r),
|
|
713
|
-
action: /* @__PURE__ */ Y(b, {
|
|
714
|
-
kind: "primary",
|
|
715
|
-
size: "sm",
|
|
716
|
-
onClick: p,
|
|
717
|
-
children: "Retry"
|
|
718
|
-
})
|
|
719
|
-
})
|
|
720
|
-
}) : i === 0 ? /* @__PURE__ */ Y("div", {
|
|
721
|
-
style: { padding: "0 20px" },
|
|
722
|
-
children: (() => {
|
|
723
|
-
let e = m.empty_state, t = L(e?.title), n = L(e?.body), r = a(e?.learn_more_url), i = u ? "No results found" : t || `No ${L(m.name_plural).toLowerCase() || c.toLowerCase()} yet`, o = d && f.some(({ code: e }) => e === "__new" || e === "__create"), s;
|
|
724
|
-
return s = u ? "Try adjusting your search or filters" : n ? /* @__PURE__ */ X(J, { children: [n, r && /* @__PURE__ */ X(J, { children: [" ", /* @__PURE__ */ Y("a", {
|
|
725
|
-
href: r,
|
|
726
|
-
target: "_blank",
|
|
727
|
-
rel: "noopener noreferrer",
|
|
728
|
-
children: "Learn more"
|
|
729
|
-
})] })] }) : o ? `Create your first ${L(m.name).toLowerCase()} to get started` : void 0, /* @__PURE__ */ Y(z, {
|
|
730
|
-
icon: l,
|
|
731
|
-
title: i,
|
|
732
|
-
description: s
|
|
733
|
-
});
|
|
734
|
-
})()
|
|
735
|
-
}) : null;
|
|
736
|
-
}
|
|
737
|
-
//#endregion
|
|
738
|
-
//#region src/components/pages/list/ListFooter.tsx
|
|
739
|
-
function nn({ meta: t, isCursor: n, isPhone: i, rowsLoaded: a, selectedCount: o, countTotal: s, countStrategy: c, countLoading: l, countError: u, page: d, totalPages: f, goToPage: p, perPage: h, setPerPage: g, hasMorePages: _, fetchNextPage: v, isFetchingNextPage: y }) {
|
|
740
|
-
let b = ve("list");
|
|
741
|
-
return !t && !n ? null : /* @__PURE__ */ X("div", {
|
|
742
|
-
style: {
|
|
743
|
-
display: "flex",
|
|
744
|
-
alignItems: "center",
|
|
745
|
-
paddingTop: 8,
|
|
746
|
-
paddingBottom: 8,
|
|
747
|
-
...i ? Te(12) : {
|
|
748
|
-
paddingLeft: 14,
|
|
749
|
-
paddingRight: 14
|
|
750
|
-
},
|
|
751
|
-
background: "var(--surface-2)",
|
|
752
|
-
borderTop: "1px solid var(--border)",
|
|
753
|
-
fontSize: 11.5,
|
|
754
|
-
color: "var(--text-3)",
|
|
755
|
-
gap: 12,
|
|
756
|
-
flexWrap: "wrap"
|
|
757
|
-
},
|
|
758
|
-
children: [
|
|
759
|
-
b.isVisible("show_count") && /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y("span", {
|
|
760
|
-
className: "num",
|
|
761
|
-
"data-testid": "list-footer-count",
|
|
762
|
-
style: {
|
|
763
|
-
display: "inline-flex",
|
|
764
|
-
alignItems: "center",
|
|
765
|
-
gap: 5
|
|
766
|
-
},
|
|
767
|
-
children: s === void 0 ? l && !u ? /* @__PURE__ */ Y("span", {
|
|
768
|
-
"data-testid": "list-footer-count-pending",
|
|
769
|
-
style: { display: "inline-flex" },
|
|
770
|
-
children: /* @__PURE__ */ Y(m, { size: 11 })
|
|
771
|
-
}) : /* @__PURE__ */ X(J, { children: [
|
|
772
|
-
a,
|
|
773
|
-
" ",
|
|
774
|
-
a === 1 ? "record" : "records"
|
|
775
|
-
] }) : /* @__PURE__ */ X(J, { children: [
|
|
776
|
-
a,
|
|
777
|
-
" of ",
|
|
778
|
-
rt(s, c ?? "exact"),
|
|
779
|
-
" ",
|
|
780
|
-
s === 1 ? "record" : "records"
|
|
781
|
-
] })
|
|
782
|
-
}), /* @__PURE__ */ Y("span", { children: "·" })] }),
|
|
783
|
-
/* @__PURE__ */ X("span", { children: [
|
|
784
|
-
"Selected:",
|
|
785
|
-
" ",
|
|
786
|
-
/* @__PURE__ */ Y("span", {
|
|
787
|
-
className: "num",
|
|
788
|
-
style: {
|
|
789
|
-
color: "var(--text-2)",
|
|
790
|
-
fontWeight: 500
|
|
791
|
-
},
|
|
792
|
-
children: o
|
|
793
|
-
})
|
|
794
|
-
] }),
|
|
795
|
-
/* @__PURE__ */ Y("div", { style: { flex: i ? "1 1 100%" : 1 } }),
|
|
796
|
-
!i && /* @__PURE__ */ Y("span", { children: "Rows per page" }),
|
|
797
|
-
/* @__PURE__ */ Y("select", {
|
|
798
|
-
"aria-label": "Rows per page",
|
|
799
|
-
value: h,
|
|
800
|
-
onChange: (e) => g(parseInt(e.target.value, 10)),
|
|
801
|
-
style: {
|
|
802
|
-
fontSize: 11.5,
|
|
803
|
-
padding: "2px 4px",
|
|
804
|
-
background: "var(--surface)",
|
|
805
|
-
border: "1px solid var(--border)",
|
|
806
|
-
borderRadius: 4,
|
|
807
|
-
color: "var(--text-2)",
|
|
808
|
-
cursor: "pointer"
|
|
809
|
-
},
|
|
810
|
-
children: At.map((e) => /* @__PURE__ */ Y("option", {
|
|
811
|
-
value: e,
|
|
812
|
-
children: e
|
|
813
|
-
}, e))
|
|
814
|
-
}),
|
|
815
|
-
n ? _ && /* @__PURE__ */ X("button", {
|
|
816
|
-
type: "button",
|
|
817
|
-
className: "num",
|
|
818
|
-
"data-testid": "list-footer-load-more",
|
|
819
|
-
onClick: v,
|
|
820
|
-
disabled: y,
|
|
821
|
-
style: {
|
|
822
|
-
display: "inline-flex",
|
|
823
|
-
alignItems: "center",
|
|
824
|
-
gap: 6,
|
|
825
|
-
padding: "2px 10px",
|
|
826
|
-
background: "var(--surface)",
|
|
827
|
-
border: "1px solid var(--border)",
|
|
828
|
-
borderRadius: 4,
|
|
829
|
-
color: "var(--text-2)",
|
|
830
|
-
cursor: y ? "default" : "pointer"
|
|
831
|
-
},
|
|
832
|
-
children: [y ? /* @__PURE__ */ Y(m, { size: 11 }) : null, "Load more"]
|
|
833
|
-
}) : (_ || d > 1) && /* @__PURE__ */ X("div", {
|
|
834
|
-
style: {
|
|
835
|
-
display: "flex",
|
|
836
|
-
alignItems: "center",
|
|
837
|
-
gap: 4
|
|
838
|
-
},
|
|
839
|
-
children: [
|
|
840
|
-
/* @__PURE__ */ Y(r, {
|
|
841
|
-
size: 22,
|
|
842
|
-
icon: /* @__PURE__ */ Y(e.left, { size: 12 }),
|
|
843
|
-
onClick: () => p(d - 1),
|
|
844
|
-
disabled: d <= 1
|
|
845
|
-
}),
|
|
846
|
-
/* @__PURE__ */ X("span", {
|
|
847
|
-
className: "num",
|
|
848
|
-
style: { padding: "0 6px" },
|
|
849
|
-
children: [
|
|
850
|
-
"Page ",
|
|
851
|
-
d,
|
|
852
|
-
f === void 0 ? "" : ` of ${f}`
|
|
853
|
-
]
|
|
854
|
-
}),
|
|
855
|
-
/* @__PURE__ */ Y(r, {
|
|
856
|
-
size: 22,
|
|
857
|
-
icon: /* @__PURE__ */ Y(e.right, { size: 12 }),
|
|
858
|
-
onClick: () => p(d + 1),
|
|
859
|
-
disabled: f === void 0 ? !_ : d >= f
|
|
860
|
-
})
|
|
861
|
-
]
|
|
862
|
-
})
|
|
863
|
-
]
|
|
864
|
-
});
|
|
865
|
-
}
|
|
866
|
-
//#endregion
|
|
867
|
-
//#region src/components/pages/ExportMenu.tsx
|
|
868
|
-
function rn(e) {
|
|
869
|
-
return !(e && e.enabled === !1);
|
|
870
|
-
}
|
|
871
|
-
function an(e) {
|
|
872
|
-
return e == null ? "all matching rows" : `${e.toLocaleString()} ${e === 1 ? "row" : "rows"}`;
|
|
873
|
-
}
|
|
874
|
-
function on(t) {
|
|
875
|
-
let { isPhone: r } = p(), { entityCode: i, entity: a, screen: o, viewState: s, visibleColumns: c, selectedRowPKs: l, totalRows: u, pageSize: d, locale: m, align: h = "end", variant: g = "toolbar", onBeforeOpen: _ } = t, [v, y] = q(!1), [x, S] = q(!1), [C, w] = q(null), T = K(null), E = rn(a.export), D = rn(o?.export);
|
|
876
|
-
if (!E || !D) return null;
|
|
877
|
-
async function O(e) {
|
|
878
|
-
w(null), S(!0);
|
|
879
|
-
try {
|
|
880
|
-
let t = lt(s, {
|
|
881
|
-
scope: e,
|
|
882
|
-
visibleColumns: c,
|
|
883
|
-
selectedRowPKs: e === "selected_rows" ? l : void 0,
|
|
884
|
-
locale: m
|
|
885
|
-
}), { blob: n, filename: r } = await le(i, t);
|
|
886
|
-
cn(n, r || `${i}-${sn()}.csv`), y(!1);
|
|
887
|
-
} catch (e) {
|
|
888
|
-
let t = e instanceof n ? {
|
|
889
|
-
code: e.code,
|
|
890
|
-
message: e.message
|
|
891
|
-
} : {
|
|
892
|
-
code: "",
|
|
893
|
-
message: String(e)
|
|
894
|
-
};
|
|
895
|
-
w(t);
|
|
896
|
-
} finally {
|
|
897
|
-
S(!1);
|
|
898
|
-
}
|
|
899
|
-
}
|
|
900
|
-
if (g === "selection-menu-item") {
|
|
901
|
-
let t = x || l.length === 0;
|
|
902
|
-
return /* @__PURE__ */ Y(N, {
|
|
903
|
-
icon: /* @__PURE__ */ Y(e.download, { size: 12 }),
|
|
904
|
-
"data-testid": "export-selection-menu-item",
|
|
905
|
-
onClick: t ? void 0 : () => {
|
|
906
|
-
_?.(), O("selected_rows");
|
|
907
|
-
},
|
|
908
|
-
children: x ? "Exporting…" : "Export selection (CSV)"
|
|
909
|
-
});
|
|
910
|
-
}
|
|
911
|
-
let ee = l.length > 0, te = a.list_pagination === "cursor";
|
|
912
|
-
return /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y(b, {
|
|
913
|
-
ref: T,
|
|
914
|
-
kind: "ghost",
|
|
915
|
-
size: "sm",
|
|
916
|
-
icon: /* @__PURE__ */ Y(e.download, { size: 12 }),
|
|
917
|
-
onClick: () => {
|
|
918
|
-
_?.(), y((e) => !e);
|
|
919
|
-
},
|
|
920
|
-
disabled: x,
|
|
921
|
-
"aria-label": "Export",
|
|
922
|
-
title: "Export",
|
|
923
|
-
children: r ? null : x ? "Exporting…" : "Export"
|
|
924
|
-
}), /* @__PURE__ */ X(f, {
|
|
925
|
-
open: v,
|
|
926
|
-
anchor: T.current,
|
|
927
|
-
onClose: () => y(!1),
|
|
928
|
-
align: h,
|
|
929
|
-
width: 260,
|
|
930
|
-
children: [
|
|
931
|
-
/* @__PURE__ */ X(N, {
|
|
932
|
-
icon: /* @__PURE__ */ Y(e.download, { size: 12 }),
|
|
933
|
-
onClick: x ? void 0 : () => void O("current_view"),
|
|
934
|
-
children: ["Current view (CSV) · ", an(u)]
|
|
935
|
-
}),
|
|
936
|
-
ee && /* @__PURE__ */ X(N, {
|
|
937
|
-
icon: /* @__PURE__ */ Y(e.check, { size: 12 }),
|
|
938
|
-
onClick: x ? void 0 : () => void O("selected_rows"),
|
|
939
|
-
children: ["Selected rows (CSV) · ", l.length]
|
|
940
|
-
}),
|
|
941
|
-
te ? /* @__PURE__ */ Y(N, {
|
|
942
|
-
icon: /* @__PURE__ */ Y(e.columns, { size: 12 }),
|
|
943
|
-
"data-testid": "export-current-page-disabled",
|
|
944
|
-
disabled: !0,
|
|
945
|
-
children: "Current page · n/a (infinite scroll)"
|
|
946
|
-
}) : /* @__PURE__ */ X(N, {
|
|
947
|
-
icon: /* @__PURE__ */ Y(e.columns, { size: 12 }),
|
|
948
|
-
onClick: x ? void 0 : () => void O("current_page"),
|
|
949
|
-
children: ["Current page (CSV) · ", d ? `${d} rows` : "page window"]
|
|
950
|
-
}),
|
|
951
|
-
/* @__PURE__ */ Y(N, {
|
|
952
|
-
icon: /* @__PURE__ */ Y(e.grid, { size: 12 }),
|
|
953
|
-
children: "XLSX (coming soon)"
|
|
954
|
-
}),
|
|
955
|
-
C && /* @__PURE__ */ Y("div", {
|
|
956
|
-
role: "alert",
|
|
957
|
-
style: {
|
|
958
|
-
padding: "6px 10px",
|
|
959
|
-
marginTop: 4,
|
|
960
|
-
fontSize: 12,
|
|
961
|
-
color: "var(--destructive)",
|
|
962
|
-
borderTop: "1px solid var(--border)"
|
|
963
|
-
},
|
|
964
|
-
children: C.message
|
|
965
|
-
})
|
|
966
|
-
]
|
|
967
|
-
})] });
|
|
968
|
-
}
|
|
969
|
-
function sn() {
|
|
970
|
-
let e = /* @__PURE__ */ new Date(), t = (e) => String(e).padStart(2, "0");
|
|
971
|
-
return `${e.getUTCFullYear()}${t(e.getUTCMonth() + 1)}${t(e.getUTCDate())}-${t(e.getUTCHours())}${t(e.getUTCMinutes())}`;
|
|
972
|
-
}
|
|
973
|
-
function cn(e, t) {
|
|
974
|
-
let n = URL.createObjectURL(e), r = document.createElement("a");
|
|
975
|
-
r.href = n, r.download = t, r.style.display = "none", document.body.appendChild(r), r.click(), document.body.removeChild(r), setTimeout(() => URL.revokeObjectURL(n), 0);
|
|
976
|
-
}
|
|
977
|
-
//#endregion
|
|
978
|
-
//#region src/components/pages/list/ListToolbar.tsx
|
|
979
|
-
function ln({ screen: t, entity: n, entityCode: a, schema: o, screenCode: s, screenName: c, locale: l, isPhone: u, isCardsPresentation: d, sort: p, columns: m, views: h, query: g, selection: v, filters: y, searchValue: x, onSearchChange: S, onSaveView: C, page: w, perPage: T, includeDeleted: E, canViewDeleted: D, onToggleDeleted: O, realtime: ee, isLive: te }) {
|
|
980
|
-
let [ne, k] = q(!1), [re, A] = q(!1), [j, M] = q(!1), ie = K(null), P = K(null), F = we((e) => e.density), I = () => {
|
|
981
|
-
let e = F === "compact" ? "comfortable" : F === "comfortable" ? "cozy" : "compact";
|
|
982
|
-
we.getState().setMany({ density: e });
|
|
983
|
-
}, ae = !u || ne || x !== "", R = (e) => {
|
|
984
|
-
if (e.startsWith("$status.")) {
|
|
985
|
-
let t = e.slice(8), r = n.status_groups?.[t];
|
|
986
|
-
return r ? L(r.name) || t : e;
|
|
987
|
-
}
|
|
988
|
-
if (e.startsWith("$property.")) {
|
|
989
|
-
let t = e.slice(10), r = n.properties?.[t];
|
|
990
|
-
return r ? L(r.name) || t : e;
|
|
991
|
-
}
|
|
992
|
-
return Ie(n, e, o?.entities);
|
|
993
|
-
}, oe = (t.columns ?? []).filter((e) => Jt(e, n));
|
|
994
|
-
return /* @__PURE__ */ X("div", {
|
|
995
|
-
style: {
|
|
996
|
-
display: "flex",
|
|
997
|
-
alignItems: "center",
|
|
998
|
-
gap: u ? 6 : 8,
|
|
999
|
-
paddingTop: 0,
|
|
1000
|
-
paddingBottom: 10,
|
|
1001
|
-
...u ? Te(12) : {
|
|
1002
|
-
paddingLeft: 20,
|
|
1003
|
-
paddingRight: 20
|
|
1004
|
-
},
|
|
1005
|
-
flexWrap: "wrap"
|
|
1006
|
-
},
|
|
1007
|
-
children: [
|
|
1008
|
-
/* @__PURE__ */ Y(et, {
|
|
1009
|
-
views: h.all,
|
|
1010
|
-
activeViewId: h.activeId,
|
|
1011
|
-
isDirty: h.isDirty,
|
|
1012
|
-
onSelect: h.apply,
|
|
1013
|
-
onSaveAs: C
|
|
1014
|
-
}),
|
|
1015
|
-
ae ? /* @__PURE__ */ X("div", {
|
|
1016
|
-
style: {
|
|
1017
|
-
position: "relative",
|
|
1018
|
-
width: u ? "100%" : 260,
|
|
1019
|
-
order: u ? -1 : 0
|
|
1020
|
-
},
|
|
1021
|
-
children: [/* @__PURE__ */ Y(i, {
|
|
1022
|
-
value: x,
|
|
1023
|
-
onChange: S,
|
|
1024
|
-
placeholder: `Search ${c.toLowerCase()}…`,
|
|
1025
|
-
prefix: /* @__PURE__ */ Y(e.search, { size: 13 })
|
|
1026
|
-
}), /* @__PURE__ */ Y("span", {
|
|
1027
|
-
style: {
|
|
1028
|
-
position: "absolute",
|
|
1029
|
-
right: 6,
|
|
1030
|
-
top: "50%",
|
|
1031
|
-
transform: "translateY(-50%)",
|
|
1032
|
-
pointerEvents: "none"
|
|
1033
|
-
},
|
|
1034
|
-
children: /* @__PURE__ */ Y(_, { children: "/" })
|
|
1035
|
-
})]
|
|
1036
|
-
}) : /* @__PURE__ */ Y(r, {
|
|
1037
|
-
icon: /* @__PURE__ */ Y(e.search, { size: 14 }),
|
|
1038
|
-
title: `Search ${c.toLowerCase()}`,
|
|
1039
|
-
onClick: () => k(!0)
|
|
1040
|
-
}),
|
|
1041
|
-
/* @__PURE__ */ X(b, {
|
|
1042
|
-
icon: /* @__PURE__ */ Y(e.filter, { size: 13 }),
|
|
1043
|
-
onClick: y.onOpen,
|
|
1044
|
-
active: y.count > 0,
|
|
1045
|
-
children: ["Filters", y.count > 0 && /* @__PURE__ */ Y(me, {
|
|
1046
|
-
tone: "violet",
|
|
1047
|
-
size: "xs",
|
|
1048
|
-
style: { marginLeft: 4 },
|
|
1049
|
-
children: y.count
|
|
1050
|
-
})]
|
|
1051
|
-
}),
|
|
1052
|
-
d && /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ X(b, {
|
|
1053
|
-
ref: ie,
|
|
1054
|
-
icon: /* @__PURE__ */ Y(e.sort, { size: 13 }),
|
|
1055
|
-
onClick: () => A((e) => !e),
|
|
1056
|
-
active: re || p.cols.length > 0,
|
|
1057
|
-
children: ["Sort", p.cols.length > 0 && /* @__PURE__ */ Y(me, {
|
|
1058
|
-
tone: "slate",
|
|
1059
|
-
size: "xs",
|
|
1060
|
-
style: { marginLeft: 4 },
|
|
1061
|
-
children: p.cols.length
|
|
1062
|
-
})]
|
|
1063
|
-
}), /* @__PURE__ */ X(f, {
|
|
1064
|
-
open: re,
|
|
1065
|
-
anchor: ie.current,
|
|
1066
|
-
onClose: () => A(!1),
|
|
1067
|
-
align: "start",
|
|
1068
|
-
width: 280,
|
|
1069
|
-
children: [
|
|
1070
|
-
/* @__PURE__ */ Y("div", {
|
|
1071
|
-
style: {
|
|
1072
|
-
padding: "6px 8px 4px",
|
|
1073
|
-
fontSize: 10,
|
|
1074
|
-
color: "var(--text-3)",
|
|
1075
|
-
fontWeight: 700,
|
|
1076
|
-
letterSpacing: "0.08em",
|
|
1077
|
-
textTransform: "uppercase"
|
|
1078
|
-
},
|
|
1079
|
-
children: "Sort by"
|
|
1080
|
-
}),
|
|
1081
|
-
oe.map((t) => {
|
|
1082
|
-
let n = p.cols.find((e) => e.field === t);
|
|
1083
|
-
return /* @__PURE__ */ Y(N, {
|
|
1084
|
-
icon: n ? n.dir === "desc" ? /* @__PURE__ */ Y(e.arrowDown, { size: 12 }) : /* @__PURE__ */ Y(e.arrowUp, { size: 12 }) : /* @__PURE__ */ Y("span", { style: {
|
|
1085
|
-
width: 12,
|
|
1086
|
-
display: "inline-block"
|
|
1087
|
-
} }),
|
|
1088
|
-
active: !!n,
|
|
1089
|
-
onClick: () => {
|
|
1090
|
-
p.applyColumn(t, n?.dir === "asc" ? "desc" : "asc", void 0), A(!1);
|
|
1091
|
-
},
|
|
1092
|
-
children: R(t)
|
|
1093
|
-
}, t);
|
|
1094
|
-
}),
|
|
1095
|
-
p.cols.length > 0 && /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y(N, { divider: !0 }), /* @__PURE__ */ Y(N, {
|
|
1096
|
-
icon: /* @__PURE__ */ Y(e.x, { size: 12 }),
|
|
1097
|
-
onClick: () => {
|
|
1098
|
-
p.clearAll(), A(!1);
|
|
1099
|
-
},
|
|
1100
|
-
children: "Clear sort"
|
|
1101
|
-
})] })
|
|
1102
|
-
]
|
|
1103
|
-
})] }),
|
|
1104
|
-
!d && /* @__PURE__ */ Y(nt, {
|
|
1105
|
-
availableColumns: t.columns ?? [],
|
|
1106
|
-
visibleColumns: m.visible,
|
|
1107
|
-
onToggle: (e) => {
|
|
1108
|
-
let t = m.visible.includes(e) ? m.visible.filter((t) => t !== e) : [...m.visible, e];
|
|
1109
|
-
m.apply(t);
|
|
1110
|
-
},
|
|
1111
|
-
onMove: m.move,
|
|
1112
|
-
onReset: m.clear,
|
|
1113
|
-
onShowAll: () => m.apply(t.columns ?? []),
|
|
1114
|
-
onResetWidths: m.resetWidths,
|
|
1115
|
-
columnLabel: R
|
|
1116
|
-
}),
|
|
1117
|
-
!u && /* @__PURE__ */ Y("span", { style: {
|
|
1118
|
-
width: 1,
|
|
1119
|
-
height: 20,
|
|
1120
|
-
background: "var(--divider)"
|
|
1121
|
-
} }),
|
|
1122
|
-
!u && /* @__PURE__ */ Y(r, {
|
|
1123
|
-
icon: /* @__PURE__ */ Y(e.grid, { size: 14 }),
|
|
1124
|
-
title: "Density",
|
|
1125
|
-
active: F !== "compact",
|
|
1126
|
-
onClick: I
|
|
1127
|
-
}),
|
|
1128
|
-
/* @__PURE__ */ Y(ye, {
|
|
1129
|
-
liveObject: {
|
|
1130
|
-
refetch: g.retry,
|
|
1131
|
-
isLoading: g.isLoading,
|
|
1132
|
-
isLive: te
|
|
1133
|
-
},
|
|
1134
|
-
realtime: ee
|
|
1135
|
-
}),
|
|
1136
|
-
!u && /* @__PURE__ */ Y("div", { style: { flex: 1 } }),
|
|
1137
|
-
!u && D && /* @__PURE__ */ Y(b, {
|
|
1138
|
-
kind: "ghost",
|
|
1139
|
-
size: "sm",
|
|
1140
|
-
icon: Y(E ? e.eyeOff : e.eye, { size: 12 }),
|
|
1141
|
-
onClick: O,
|
|
1142
|
-
active: E,
|
|
1143
|
-
children: E ? "Hide deleted" : "Show deleted"
|
|
1144
|
-
}),
|
|
1145
|
-
u && /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y(r, {
|
|
1146
|
-
ref: P,
|
|
1147
|
-
icon: /* @__PURE__ */ Y(e.more, { size: 14 }),
|
|
1148
|
-
title: "More",
|
|
1149
|
-
active: j,
|
|
1150
|
-
onClick: () => M((e) => !e)
|
|
1151
|
-
}), /* @__PURE__ */ X(f, {
|
|
1152
|
-
open: j,
|
|
1153
|
-
anchor: P.current,
|
|
1154
|
-
onClose: () => M(!1),
|
|
1155
|
-
align: "end",
|
|
1156
|
-
width: 220,
|
|
1157
|
-
children: [/* @__PURE__ */ Y(N, {
|
|
1158
|
-
icon: /* @__PURE__ */ Y(e.grid, { size: 13 }),
|
|
1159
|
-
onClick: () => {
|
|
1160
|
-
I(), M(!1);
|
|
1161
|
-
},
|
|
1162
|
-
children: "Density"
|
|
1163
|
-
}), D && /* @__PURE__ */ Y(N, {
|
|
1164
|
-
icon: Y(E ? e.eyeOff : e.eye, { size: 13 }),
|
|
1165
|
-
onClick: () => {
|
|
1166
|
-
O(), M(!1);
|
|
1167
|
-
},
|
|
1168
|
-
children: E ? "Hide deleted" : "Show deleted"
|
|
1169
|
-
})]
|
|
1170
|
-
})] }),
|
|
1171
|
-
a && n && /* @__PURE__ */ Y(ft, {
|
|
1172
|
-
entityCode: a,
|
|
1173
|
-
scope: "list",
|
|
1174
|
-
selectedIds: v.ids,
|
|
1175
|
-
viewState: {
|
|
1176
|
-
screenCode: s,
|
|
1177
|
-
jsonFilters: y.json,
|
|
1178
|
-
search: y.debouncedSearch,
|
|
1179
|
-
sort: p.forRequest,
|
|
1180
|
-
includeDeleted: E || void 0,
|
|
1181
|
-
page: w,
|
|
1182
|
-
perPage: T
|
|
1183
|
-
},
|
|
1184
|
-
locale: l,
|
|
1185
|
-
capability: n.documents,
|
|
1186
|
-
canManageTemplates: B(o)
|
|
1187
|
-
}),
|
|
1188
|
-
a && n && /* @__PURE__ */ Y(on, {
|
|
1189
|
-
entityCode: a,
|
|
1190
|
-
entity: n,
|
|
1191
|
-
screen: t,
|
|
1192
|
-
viewState: {
|
|
1193
|
-
screenCode: s,
|
|
1194
|
-
jsonFilters: y.json,
|
|
1195
|
-
search: y.debouncedSearch,
|
|
1196
|
-
sort: p.forRequest,
|
|
1197
|
-
includeDeleted: E || void 0,
|
|
1198
|
-
page: w,
|
|
1199
|
-
perPage: T
|
|
1200
|
-
},
|
|
1201
|
-
visibleColumns: m.visible,
|
|
1202
|
-
selectedRowPKs: v.pkValues,
|
|
1203
|
-
totalRows: g.countTotal,
|
|
1204
|
-
pageSize: T,
|
|
1205
|
-
locale: l
|
|
1206
|
-
})
|
|
1207
|
-
]
|
|
1208
|
-
});
|
|
1209
|
-
}
|
|
1210
|
-
//#endregion
|
|
1211
|
-
//#region src/components/pages/list/useListViews.ts
|
|
1212
|
-
function un(e) {
|
|
1213
|
-
let t = new URLSearchParams(), n = e.get("search");
|
|
1214
|
-
n && t.set("search", n);
|
|
1215
|
-
for (let n of c) {
|
|
1216
|
-
let r = e.get(n);
|
|
1217
|
-
r !== null && t.set(n, r);
|
|
1218
|
-
}
|
|
1219
|
-
return t;
|
|
1220
|
-
}
|
|
1221
|
-
function dn(e, t) {
|
|
1222
|
-
let n = I(t.id);
|
|
1223
|
-
n && e.setQueriesData({ queryKey: ["entity-data", "view"] }, (e) => !e || e.data.some((e) => I(e.id) === n) ? e : {
|
|
1224
|
-
...e,
|
|
1225
|
-
data: [t, ...e.data]
|
|
1226
|
-
});
|
|
1227
|
-
}
|
|
1228
|
-
function fn({ screenCode: e, screen: t, searchParams: n, setSearchParams: r, userId: i, tenantId: a, filterError: o, filters: s, visibleColumns: c, sort: l }) {
|
|
1229
|
-
let u = yt(), d = Qe(e, i), f = n.get("view"), p = G(() => d.find((e) => e.id === f), [d, f]), m = ke("view"), h = Oe("view"), g = `dcl:smartlist:default-view-cleared:${e}`, _ = K(!1);
|
|
1230
|
-
W(() => {
|
|
1231
|
-
if (_.current) return;
|
|
1232
|
-
if (o) {
|
|
1233
|
-
_.current = !0;
|
|
1234
|
-
return;
|
|
1235
|
-
}
|
|
1236
|
-
if (!d || d.length === 0) return;
|
|
1237
|
-
if (n.get("view")) {
|
|
1238
|
-
_.current = !0;
|
|
1239
|
-
return;
|
|
1240
|
-
}
|
|
1241
|
-
if (typeof window < "u" && window.sessionStorage?.getItem(g)) {
|
|
1242
|
-
_.current = !0;
|
|
1243
|
-
return;
|
|
1244
|
-
}
|
|
1245
|
-
let e = d.find((e) => e.source === "personal" && e.is_default) ?? (t?.default_view ? d.find((e) => e.source === "system" && e.id === t.default_view) : void 0);
|
|
1246
|
-
if (!e || !e.id) return;
|
|
1247
|
-
_.current = !0;
|
|
1248
|
-
let i = un(n);
|
|
1249
|
-
i.set("view", e.id), e.filters && Array.isArray(e.filters) && e.filters.length > 0 && i.set("filters", JSON.stringify(e.filters)), e.columns && e.columns.length > 0 && i.set("columns", e.columns.join(",")), e.sort && i.set("sort", e.sort), r(i, { replace: !0 });
|
|
1250
|
-
}, [
|
|
1251
|
-
d,
|
|
1252
|
-
o,
|
|
1253
|
-
n,
|
|
1254
|
-
r,
|
|
1255
|
-
g,
|
|
1256
|
-
t?.default_view
|
|
1257
|
-
]);
|
|
1258
|
-
let v = G(() => {
|
|
1259
|
-
if (!f || !p) return !1;
|
|
1260
|
-
let e = p.filters ?? [], n = p.columns?.length ? p.columns : t?.default_columns ?? t?.columns ?? [], r = p.sort ?? t?.sort_default ?? "";
|
|
1261
|
-
return JSON.stringify(s) !== JSON.stringify(e) || c.join(",") !== n.join(",") || (l ?? "") !== r;
|
|
1262
|
-
}, [
|
|
1263
|
-
f,
|
|
1264
|
-
p,
|
|
1265
|
-
s,
|
|
1266
|
-
c,
|
|
1267
|
-
l,
|
|
1268
|
-
t?.default_columns,
|
|
1269
|
-
t?.columns,
|
|
1270
|
-
t?.sort_default
|
|
1271
|
-
]), y = U((e) => {
|
|
1272
|
-
let i = new URLSearchParams(n), a = un(n);
|
|
1273
|
-
e.id ? (a.set("view", e.id), e.filters && Array.isArray(e.filters) && e.filters.length > 0 && a.set("filters", JSON.stringify(e.filters)), e.columns && e.columns.length > 0 && a.set("columns", e.columns.join(",")), e.sort && a.set("sort", e.sort), a.set("page", "1")) : typeof window < "u" && window.sessionStorage?.setItem(g, "1"), r(a);
|
|
1274
|
-
let o = i.get("view"), s = o ? d.find((e) => e.id === o) : void 0, c = (s?.columns?.length ? s.columns : t?.default_columns ?? t?.columns ?? []).join(",");
|
|
1275
|
-
(i.get("columns") ?? c) !== c && ie.info("View applied", "Your unsaved column changes were replaced.", { action: {
|
|
1276
|
-
label: "Undo",
|
|
1277
|
-
onClick: () => r(i)
|
|
1278
|
-
} });
|
|
1279
|
-
}, [
|
|
1280
|
-
n,
|
|
1281
|
-
r,
|
|
1282
|
-
g,
|
|
1283
|
-
d,
|
|
1284
|
-
t?.default_columns,
|
|
1285
|
-
t?.columns
|
|
1286
|
-
]), b = U(async () => {
|
|
1287
|
-
p?.id && p.source === "personal" && (await h.mutateAsync({
|
|
1288
|
-
pkValues: p.id,
|
|
1289
|
-
data: {
|
|
1290
|
-
filters: s,
|
|
1291
|
-
columns: c,
|
|
1292
|
-
sort: l ?? null
|
|
1293
|
-
}
|
|
1294
|
-
}), await u.invalidateQueries({ queryKey: ["entity-data", "view"] }));
|
|
1295
|
-
}, [
|
|
1296
|
-
p,
|
|
1297
|
-
h,
|
|
1298
|
-
s,
|
|
1299
|
-
c,
|
|
1300
|
-
l,
|
|
1301
|
-
u
|
|
1302
|
-
]);
|
|
1303
|
-
return {
|
|
1304
|
-
all: d,
|
|
1305
|
-
activeId: f,
|
|
1306
|
-
active: p,
|
|
1307
|
-
isDirty: v,
|
|
1308
|
-
apply: y,
|
|
1309
|
-
saveAsNew: U(async (t) => {
|
|
1310
|
-
if (!i || !a) return;
|
|
1311
|
-
let o = await m.mutateAsync({
|
|
1312
|
-
tenant_id: a,
|
|
1313
|
-
screen_code: e,
|
|
1314
|
-
user_id: i,
|
|
1315
|
-
name: { en: t },
|
|
1316
|
-
filters: s,
|
|
1317
|
-
columns: c,
|
|
1318
|
-
...l ? { sort: l } : {},
|
|
1319
|
-
is_shared: !1,
|
|
1320
|
-
is_default: !1
|
|
1321
|
-
}), d = I(o.data.id);
|
|
1322
|
-
if (!d) return;
|
|
1323
|
-
dn(u, o.data), await u.invalidateQueries({ queryKey: ["entity-data", "view"] });
|
|
1324
|
-
let f = new URLSearchParams(n);
|
|
1325
|
-
f.set("view", d), r(f);
|
|
1326
|
-
}, [
|
|
1327
|
-
i,
|
|
1328
|
-
a,
|
|
1329
|
-
m,
|
|
1330
|
-
e,
|
|
1331
|
-
s,
|
|
1332
|
-
c,
|
|
1333
|
-
l,
|
|
1334
|
-
u,
|
|
1335
|
-
n,
|
|
1336
|
-
r
|
|
1337
|
-
]),
|
|
1338
|
-
overwriteActive: b,
|
|
1339
|
-
isSaving: m.isPending || h.isPending
|
|
1340
|
-
};
|
|
1341
|
-
}
|
|
1342
|
-
function pn(e) {
|
|
1343
|
-
return e && e.source === "personal" ? L(e.name) : null;
|
|
1344
|
-
}
|
|
1345
|
-
//#endregion
|
|
1346
|
-
//#region src/components/pages/list/use-filter-value-labels.ts
|
|
1347
|
-
var Z = 200;
|
|
1348
|
-
function mn(e, t, n, r) {
|
|
1349
|
-
let i = new Map(e.map((e) => [e.code, e])), a = hn(i, t, n, r), o = vt({ queries: a.map((e) => {
|
|
1350
|
-
let t = {
|
|
1351
|
-
per_page: Z,
|
|
1352
|
-
filters: [{
|
|
1353
|
-
field: e.lookupField,
|
|
1354
|
-
op: "in",
|
|
1355
|
-
value: e.values
|
|
1356
|
-
}],
|
|
1357
|
-
count: "window"
|
|
1358
|
-
};
|
|
1359
|
-
return {
|
|
1360
|
-
queryKey: [
|
|
1361
|
-
"entity-data",
|
|
1362
|
-
e.entity,
|
|
1363
|
-
t
|
|
1364
|
-
],
|
|
1365
|
-
queryFn: ({ signal: n }) => se(e.entity, t, { signal: n }),
|
|
1366
|
-
staleTime: 6e4
|
|
1367
|
-
};
|
|
1368
|
-
}) }), s = {};
|
|
1369
|
-
if (n) for (let [e, t] of Object.entries(n)) s[e] = { ...t };
|
|
1370
|
-
let c = /* @__PURE__ */ new Set();
|
|
1371
|
-
return o.forEach((e, t) => {
|
|
1372
|
-
let n = a[t];
|
|
1373
|
-
if (!n) return;
|
|
1374
|
-
let r = e.data?.data;
|
|
1375
|
-
if (r) {
|
|
1376
|
-
let e = s[n.entity] ??= {};
|
|
1377
|
-
for (let t of r) {
|
|
1378
|
-
let r = I(t[n.lookupField]);
|
|
1379
|
-
r && (e[r] = t);
|
|
1380
|
-
}
|
|
1381
|
-
}
|
|
1382
|
-
if (e.isLoading) for (let e of n.values) s[n.entity]?.[e] || c.add(`${n.entity}::${e}`);
|
|
1383
|
-
}), {
|
|
1384
|
-
labelFor: (e, t) => {
|
|
1385
|
-
let n = I(t), a = i.get(e);
|
|
1386
|
-
if (!a) return {
|
|
1387
|
-
status: "plain",
|
|
1388
|
-
raw: n
|
|
1389
|
-
};
|
|
1390
|
-
let o = a.specialValues?.find((e) => e.code === n);
|
|
1391
|
-
if (o) return {
|
|
1392
|
-
status: "special",
|
|
1393
|
-
label: L(o.label) || n,
|
|
1394
|
-
raw: n
|
|
1395
|
-
};
|
|
1396
|
-
if (a.options) {
|
|
1397
|
-
let e = a.options.find((e) => e.value === n);
|
|
1398
|
-
if (e) return {
|
|
1399
|
-
status: "resolved",
|
|
1400
|
-
label: e.label,
|
|
1401
|
-
raw: n
|
|
1402
|
-
};
|
|
1403
|
-
}
|
|
1404
|
-
if (a.type === "ref" && a.ref?.entity) {
|
|
1405
|
-
let e = a.ref.entity, t = s[e]?.[n];
|
|
1406
|
-
if (t) {
|
|
1407
|
-
let i = a.ref.display?.field ?? r?.[e]?.display?.display_field;
|
|
1408
|
-
return {
|
|
1409
|
-
status: "resolved",
|
|
1410
|
-
label: P(t, i, n),
|
|
1411
|
-
raw: n
|
|
1412
|
-
};
|
|
1413
|
-
}
|
|
1414
|
-
return c.has(`${e}::${n}`) ? {
|
|
1415
|
-
status: "loading",
|
|
1416
|
-
raw: n
|
|
1417
|
-
} : {
|
|
1418
|
-
status: "unresolved",
|
|
1419
|
-
raw: n
|
|
1420
|
-
};
|
|
1421
|
-
}
|
|
1422
|
-
return {
|
|
1423
|
-
status: "plain",
|
|
1424
|
-
raw: n
|
|
1425
|
-
};
|
|
1426
|
-
},
|
|
1427
|
-
refs: s
|
|
1428
|
-
};
|
|
1429
|
-
}
|
|
1430
|
-
function hn(e, t, n, r) {
|
|
1431
|
-
let i = /* @__PURE__ */ new Map();
|
|
1432
|
-
for (let a of it(t)) {
|
|
1433
|
-
if (!a.field) continue;
|
|
1434
|
-
let t = e.get(a.field);
|
|
1435
|
-
if (!t || t.type !== "ref" || !t.ref?.entity) continue;
|
|
1436
|
-
let o = t.ref.entity, s = r?.[o], c = t.ref.field || (s ? ue(s)[0] : "id") || "id", l = Array.isArray(a.value) ? a.value : [a.value];
|
|
1437
|
-
for (let e of l) {
|
|
1438
|
-
let r = I(e);
|
|
1439
|
-
if (!r || t.specialValues?.some((e) => e.code === r) || n?.[o]?.[r]) continue;
|
|
1440
|
-
let a = `${o}::${c}`, s = i.get(a);
|
|
1441
|
-
s || (s = {
|
|
1442
|
-
key: a,
|
|
1443
|
-
entity: o,
|
|
1444
|
-
lookupField: c,
|
|
1445
|
-
values: []
|
|
1446
|
-
}, i.set(a, s)), s.values.includes(r) || s.values.push(r);
|
|
1447
|
-
}
|
|
1448
|
-
}
|
|
1449
|
-
let a = [...i.values()];
|
|
1450
|
-
for (let e of a) e.values.sort();
|
|
1451
|
-
return a.sort((e, t) => e.key.localeCompare(t.key)), a;
|
|
1452
|
-
}
|
|
1453
|
-
//#endregion
|
|
1454
|
-
//#region src/components/pages/list/SaveViewDialog.tsx
|
|
1455
|
-
function gn({ open: e, pending: t, onClose: n, onSave: r, overwriteViewName: a, onOverwrite: o }) {
|
|
1456
|
-
let [s, c] = q(""), l = !!(a && o);
|
|
1457
|
-
if (W(() => {
|
|
1458
|
-
e && c("");
|
|
1459
|
-
}, [e]), !e) return null;
|
|
1460
|
-
let u = s.trim();
|
|
1461
|
-
return /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y("div", {
|
|
1462
|
-
onClick: n,
|
|
1463
|
-
style: {
|
|
1464
|
-
position: "fixed",
|
|
1465
|
-
inset: 0,
|
|
1466
|
-
background: "var(--scrim)",
|
|
1467
|
-
zIndex: 70
|
|
1468
|
-
}
|
|
1469
|
-
}), /* @__PURE__ */ X("div", {
|
|
1470
|
-
role: "dialog",
|
|
1471
|
-
"aria-label": "Save view",
|
|
1472
|
-
"aria-modal": "true",
|
|
1473
|
-
style: {
|
|
1474
|
-
position: "fixed",
|
|
1475
|
-
top: "50%",
|
|
1476
|
-
left: "50%",
|
|
1477
|
-
transform: "translate(-50%, -50%)",
|
|
1478
|
-
width: 360,
|
|
1479
|
-
maxWidth: "calc(100vw - 32px)",
|
|
1480
|
-
background: "var(--surface)",
|
|
1481
|
-
border: "1px solid var(--border)",
|
|
1482
|
-
borderRadius: 10,
|
|
1483
|
-
boxShadow: "var(--shadow-lg)",
|
|
1484
|
-
zIndex: 80,
|
|
1485
|
-
padding: 16,
|
|
1486
|
-
display: "flex",
|
|
1487
|
-
flexDirection: "column",
|
|
1488
|
-
gap: 12
|
|
1489
|
-
},
|
|
1490
|
-
children: [
|
|
1491
|
-
/* @__PURE__ */ X("div", { children: [/* @__PURE__ */ Y("h3", {
|
|
1492
|
-
style: {
|
|
1493
|
-
margin: 0,
|
|
1494
|
-
fontSize: 14,
|
|
1495
|
-
color: "var(--text)"
|
|
1496
|
-
},
|
|
1497
|
-
children: "Save view"
|
|
1498
|
-
}), /* @__PURE__ */ Y("p", {
|
|
1499
|
-
style: {
|
|
1500
|
-
margin: "4px 0 0",
|
|
1501
|
-
fontSize: 12,
|
|
1502
|
-
color: "var(--text-3)"
|
|
1503
|
-
},
|
|
1504
|
-
children: "Views save columns, order, filters, and sort. Widths stay personal to this device and are never part of a view."
|
|
1505
|
-
})] }),
|
|
1506
|
-
/* @__PURE__ */ X("label", {
|
|
1507
|
-
style: {
|
|
1508
|
-
display: "flex",
|
|
1509
|
-
flexDirection: "column",
|
|
1510
|
-
gap: 4
|
|
1511
|
-
},
|
|
1512
|
-
children: [/* @__PURE__ */ Y("span", {
|
|
1513
|
-
style: {
|
|
1514
|
-
fontSize: 11.5,
|
|
1515
|
-
color: "var(--text-3)",
|
|
1516
|
-
fontWeight: 500
|
|
1517
|
-
},
|
|
1518
|
-
children: "Name"
|
|
1519
|
-
}), /* @__PURE__ */ Y(i, {
|
|
1520
|
-
autoFocus: !0,
|
|
1521
|
-
"aria-label": "View name",
|
|
1522
|
-
value: s,
|
|
1523
|
-
onChange: c,
|
|
1524
|
-
placeholder: "My filtered view",
|
|
1525
|
-
onKeyDown: (e) => {
|
|
1526
|
-
e.key === "Escape" && n(), e.key === "Enter" && u && !t && r(u);
|
|
1527
|
-
}
|
|
1528
|
-
})]
|
|
1529
|
-
}),
|
|
1530
|
-
/* @__PURE__ */ X("div", {
|
|
1531
|
-
style: {
|
|
1532
|
-
display: "flex",
|
|
1533
|
-
justifyContent: "flex-end",
|
|
1534
|
-
gap: 8
|
|
1535
|
-
},
|
|
1536
|
-
children: [
|
|
1537
|
-
/* @__PURE__ */ Y(b, {
|
|
1538
|
-
onClick: n,
|
|
1539
|
-
disabled: t,
|
|
1540
|
-
children: "Cancel"
|
|
1541
|
-
}),
|
|
1542
|
-
l && /* @__PURE__ */ X(b, {
|
|
1543
|
-
onClick: () => void o(),
|
|
1544
|
-
disabled: t,
|
|
1545
|
-
children: [
|
|
1546
|
-
"Overwrite “",
|
|
1547
|
-
a,
|
|
1548
|
-
"”"
|
|
1549
|
-
]
|
|
1550
|
-
}),
|
|
1551
|
-
/* @__PURE__ */ Y(b, {
|
|
1552
|
-
kind: "primary",
|
|
1553
|
-
onClick: () => void r(u),
|
|
1554
|
-
disabled: !u || t,
|
|
1555
|
-
children: "Save as new"
|
|
1556
|
-
})
|
|
1557
|
-
]
|
|
1558
|
-
})
|
|
1559
|
-
]
|
|
1560
|
-
})] });
|
|
1561
|
-
}
|
|
1562
|
-
//#endregion
|
|
1563
|
-
//#region src/components/pages/list/ListHeader.tsx
|
|
1564
|
-
function _n({ title: t, description: n, toolbarActions: i, screenActionLayout: a, entityActionLayout: c, selectedIds: l, data: u, rowKey: d, onActionSuccess: f, widgetContext: m }) {
|
|
1565
|
-
let { run: h } = M(), { isPhone: g } = p(), _ = ve("list"), b = _.isVisible("show_title"), x = _.isVisible("show_actions"), C = Ee(), w = G(() => {
|
|
1566
|
-
let e = {};
|
|
1567
|
-
for (let { code: t, action: n } of i) e[t] = n;
|
|
1568
|
-
return e;
|
|
1569
|
-
}, [i]), T = G(() => o((a ?? c) || s(w, "list_toolbar"), w, void 0, "list_toolbar"), [
|
|
1570
|
-
a,
|
|
1571
|
-
c,
|
|
1572
|
-
w
|
|
1573
|
-
]), E = G(() => v(T, w, void 0, pe, "Select one or more rows first"), [T, w]), D = G(() => {
|
|
1574
|
-
if (l.length === 0) return [];
|
|
1575
|
-
let e = /* @__PURE__ */ new Map();
|
|
1576
|
-
for (let t of u) e.set(d(t), t);
|
|
1577
|
-
return l.map((t) => e.get(t)).filter((e) => e !== void 0);
|
|
1578
|
-
}, [
|
|
1579
|
-
l,
|
|
1580
|
-
u,
|
|
1581
|
-
d
|
|
1582
|
-
]), O = G(() => y(T, w, void 0, {}, D), [
|
|
1583
|
-
T,
|
|
1584
|
-
w,
|
|
1585
|
-
D
|
|
1586
|
-
]), ee = l.length > 0 ? O : E, te = (e, t) => {
|
|
1587
|
-
let n = Ve(e, t, {});
|
|
1588
|
-
if (n === null) return;
|
|
1589
|
-
let r = L(t.display?.name) || e;
|
|
1590
|
-
return h({
|
|
1591
|
-
action: t,
|
|
1592
|
-
title: r,
|
|
1593
|
-
bulkSelection: D.length > 0 ? D : void 0,
|
|
1594
|
-
execute: async (e) => {
|
|
1595
|
-
let t = l.length > 0 ? l : void 0, r = await ne(n, S(e, t));
|
|
1596
|
-
return t && t.length > 0 && f(), r;
|
|
1597
|
-
}
|
|
1598
|
-
});
|
|
1599
|
-
};
|
|
1600
|
-
return !b && !x ? null : /* @__PURE__ */ X("div", {
|
|
1601
|
-
style: {
|
|
1602
|
-
display: "flex",
|
|
1603
|
-
alignItems: "center",
|
|
1604
|
-
gap: 8,
|
|
1605
|
-
flexWrap: g ? "wrap" : "nowrap",
|
|
1606
|
-
paddingTop: g ? 12 : 16,
|
|
1607
|
-
paddingBottom: 10,
|
|
1608
|
-
...g ? Te(12) : {
|
|
1609
|
-
paddingLeft: 20,
|
|
1610
|
-
paddingRight: 20
|
|
1611
|
-
}
|
|
1612
|
-
},
|
|
1613
|
-
children: [
|
|
1614
|
-
b && C.hasOriginBack && /* @__PURE__ */ Y(r, {
|
|
1615
|
-
icon: /* @__PURE__ */ Y(e.back, { size: 14 }),
|
|
1616
|
-
title: "Back",
|
|
1617
|
-
onClick: C.goBack
|
|
1618
|
-
}),
|
|
1619
|
-
b && /* @__PURE__ */ Y("div", {
|
|
1620
|
-
style: {
|
|
1621
|
-
flex: g ? "1 1 100%" : "1 1 auto",
|
|
1622
|
-
minWidth: 0
|
|
1623
|
-
},
|
|
1624
|
-
children: /* @__PURE__ */ X("div", {
|
|
1625
|
-
style: {
|
|
1626
|
-
display: "flex",
|
|
1627
|
-
alignItems: "baseline",
|
|
1628
|
-
gap: 10
|
|
1629
|
-
},
|
|
1630
|
-
children: [/* @__PURE__ */ Y("h1", {
|
|
1631
|
-
style: {
|
|
1632
|
-
margin: 0,
|
|
1633
|
-
minWidth: 0,
|
|
1634
|
-
overflow: "hidden",
|
|
1635
|
-
textOverflow: "ellipsis",
|
|
1636
|
-
whiteSpace: "nowrap",
|
|
1637
|
-
fontSize: "var(--page-title-size, var(--page-title-size-list))",
|
|
1638
|
-
lineHeight: "var(--page-title-line-height, var(--page-title-line-height-list))",
|
|
1639
|
-
fontWeight: 600,
|
|
1640
|
-
letterSpacing: "-0.012em",
|
|
1641
|
-
color: "var(--text)"
|
|
1642
|
-
},
|
|
1643
|
-
children: t
|
|
1644
|
-
}), n && /* @__PURE__ */ Y(_e, {
|
|
1645
|
-
label: n,
|
|
1646
|
-
"data-testid": "list-description-info"
|
|
1647
|
-
})]
|
|
1648
|
-
})
|
|
1649
|
-
}),
|
|
1650
|
-
x && ee.length > 0 && /* @__PURE__ */ Y(Me, {
|
|
1651
|
-
layout: ee,
|
|
1652
|
-
kind: "toolbar",
|
|
1653
|
-
entityActions: w,
|
|
1654
|
-
onRun: te,
|
|
1655
|
-
widgetContext: m,
|
|
1656
|
-
ariaLabel: "List toolbar actions"
|
|
1657
|
-
})
|
|
1658
|
-
]
|
|
1659
|
-
});
|
|
1660
|
-
}
|
|
1661
|
-
//#endregion
|
|
1662
|
-
//#region src/components/pages/list/ListFloatbar.tsx
|
|
1663
|
-
function vn({ selectedIds: t, floatbarActions: n, screenActionLayout: r, entityActionLayout: i, data: a, rowKey: c, entityCode: l, entity: u, screen: d, onClear: f, onActionSuccess: p, widgetContext: m }) {
|
|
1664
|
-
let { run: h } = M(), g = G(() => {
|
|
1665
|
-
let e = {};
|
|
1666
|
-
for (let { code: t, action: r } of n) e[t] = r;
|
|
1667
|
-
return e;
|
|
1668
|
-
}, [n]), _ = G(() => {
|
|
1669
|
-
if (t.length === 0) return [];
|
|
1670
|
-
let e = /* @__PURE__ */ new Map();
|
|
1671
|
-
for (let t of a) e.set(c(t), t);
|
|
1672
|
-
return t.map((t) => e.get(t)).filter((e) => e !== void 0);
|
|
1673
|
-
}, [
|
|
1674
|
-
t,
|
|
1675
|
-
a,
|
|
1676
|
-
c
|
|
1677
|
-
]), v = G(() => {
|
|
1678
|
-
if (!u || !d || _.length === 0) return r;
|
|
1679
|
-
let e = _.map((e) => je(u, d, e));
|
|
1680
|
-
return e.some((t) => t !== e[0]) ? r : Be(u, d, _[0])?.action_layout;
|
|
1681
|
-
}, [
|
|
1682
|
-
u,
|
|
1683
|
-
d,
|
|
1684
|
-
_,
|
|
1685
|
-
r
|
|
1686
|
-
]), b = G(() => o((v ?? i) || s(g, "list_floatbar"), g, void 0, "list_floatbar"), [
|
|
1687
|
-
v,
|
|
1688
|
-
i,
|
|
1689
|
-
g
|
|
1690
|
-
]), x = G(() => y(b, g, void 0, {}, _, Le(u, _)), [
|
|
1691
|
-
b,
|
|
1692
|
-
g,
|
|
1693
|
-
_,
|
|
1694
|
-
u
|
|
1695
|
-
]);
|
|
1696
|
-
return x.length === 0 ? null : /* @__PURE__ */ X("div", {
|
|
1697
|
-
style: {
|
|
1698
|
-
position: "fixed",
|
|
1699
|
-
left: "50%",
|
|
1700
|
-
bottom: "calc(var(--tabbar-h) + var(--safe-area-bottom) + 14px)",
|
|
1701
|
-
transform: "translateX(-50%)",
|
|
1702
|
-
zIndex: 45,
|
|
1703
|
-
display: "flex",
|
|
1704
|
-
alignItems: "center",
|
|
1705
|
-
flexWrap: "wrap",
|
|
1706
|
-
gap: 8,
|
|
1707
|
-
padding: "6px 10px 6px 14px",
|
|
1708
|
-
maxWidth: "calc(100vw - var(--safe-area-left) - var(--safe-area-right) - 24px)",
|
|
1709
|
-
boxSizing: "border-box",
|
|
1710
|
-
background: "var(--text)",
|
|
1711
|
-
color: "var(--background)",
|
|
1712
|
-
borderRadius: 10,
|
|
1713
|
-
boxShadow: "var(--shadow-lg)",
|
|
1714
|
-
animation: "floatbarIn .15s ease-out"
|
|
1715
|
-
},
|
|
1716
|
-
children: [
|
|
1717
|
-
/* @__PURE__ */ Y("style", { children: "@keyframes floatbarIn{from{transform:translateX(-50%) translateY(8px);opacity:0}to{transform:translateX(-50%) translateY(0);opacity:1}}" }),
|
|
1718
|
-
/* @__PURE__ */ X("span", {
|
|
1719
|
-
style: {
|
|
1720
|
-
fontSize: 12.5,
|
|
1721
|
-
fontWeight: 600
|
|
1722
|
-
},
|
|
1723
|
-
children: [/* @__PURE__ */ Y("span", {
|
|
1724
|
-
style: {
|
|
1725
|
-
padding: "1px 7px",
|
|
1726
|
-
borderRadius: 4,
|
|
1727
|
-
background: "var(--accent)",
|
|
1728
|
-
color: "var(--accent-foreground)",
|
|
1729
|
-
marginRight: 6,
|
|
1730
|
-
fontSize: 11.5
|
|
1731
|
-
},
|
|
1732
|
-
children: t.length
|
|
1733
|
-
}), "selected"]
|
|
1734
|
-
}),
|
|
1735
|
-
/* @__PURE__ */ Y(Me, {
|
|
1736
|
-
layout: x,
|
|
1737
|
-
kind: "toolbar",
|
|
1738
|
-
entityActions: g,
|
|
1739
|
-
rowSelection: _,
|
|
1740
|
-
onRun: (e, n) => {
|
|
1741
|
-
let r = Ve(e, n, {}, l);
|
|
1742
|
-
if (r !== null) return h({
|
|
1743
|
-
action: n,
|
|
1744
|
-
title: L(n.display?.name) || e,
|
|
1745
|
-
bulkSelection: _,
|
|
1746
|
-
entity: l,
|
|
1747
|
-
execute: async (e) => {
|
|
1748
|
-
let n = await ne(r, S(e, t));
|
|
1749
|
-
return p(), n;
|
|
1750
|
-
}
|
|
1751
|
-
});
|
|
1752
|
-
},
|
|
1753
|
-
widgetContext: m,
|
|
1754
|
-
ariaLabel: "Floating action bar",
|
|
1755
|
-
constrain: !1
|
|
1756
|
-
}),
|
|
1757
|
-
/* @__PURE__ */ Y("button", {
|
|
1758
|
-
onClick: f,
|
|
1759
|
-
style: {
|
|
1760
|
-
background: "none",
|
|
1761
|
-
border: "none",
|
|
1762
|
-
color: "var(--background)",
|
|
1763
|
-
cursor: "pointer",
|
|
1764
|
-
opacity: .6,
|
|
1765
|
-
padding: "4px 6px",
|
|
1766
|
-
borderRadius: 6
|
|
1767
|
-
},
|
|
1768
|
-
title: "Clear selection",
|
|
1769
|
-
children: /* @__PURE__ */ Y(e.x, { size: 14 })
|
|
1770
|
-
})
|
|
1771
|
-
]
|
|
1772
|
-
});
|
|
1773
|
-
}
|
|
1774
|
-
//#endregion
|
|
1775
|
-
//#region src/components/pages/list/useRowMenu.ts
|
|
1776
|
-
function yn(e, t) {
|
|
1777
|
-
let n = (e) => e === "__peek" && !t.peek || e === "__open" && !t.open, r = [];
|
|
1778
|
-
for (let i of e) if (i.kind === "action") {
|
|
1779
|
-
if (n(i.code)) continue;
|
|
1780
|
-
r.push(i);
|
|
1781
|
-
} else {
|
|
1782
|
-
let e = yn(i.items, t);
|
|
1783
|
-
e.length > 0 && r.push({
|
|
1784
|
-
...i,
|
|
1785
|
-
items: e
|
|
1786
|
-
});
|
|
1787
|
-
}
|
|
1788
|
-
return r;
|
|
1789
|
-
}
|
|
1790
|
-
function bn(e, t) {
|
|
1791
|
-
for (let n of e) if (n.kind === "action") {
|
|
1792
|
-
if (n.code === t) return !0;
|
|
1793
|
-
} else if (bn(n.items, t)) return !0;
|
|
1794
|
-
return !1;
|
|
1795
|
-
}
|
|
1796
|
-
function xn({ row: e, rowId: t, screen: n, fullScreen: r, entity: i, entityCode: a, rowActions: c, tabNavigate: l, locale: u, peekAllowed: d, hasDetailTarget: f, onPeek: p }) {
|
|
1797
|
-
let { run: m } = M(), h = r.detail_screen === void 0 && n.detail_screen !== void 0 ? {
|
|
1798
|
-
...r,
|
|
1799
|
-
detail_screen: n.detail_screen
|
|
1800
|
-
} : r, _ = Be(i, h, e) ?? h, v = G(() => {
|
|
1801
|
-
let e = {}, t = _.row_actions === void 0 ? void 0 : new Set(_.row_actions);
|
|
1802
|
-
for (let { code: n, action: r } of c) (!t || t.has(n)) && (e[n] = r);
|
|
1803
|
-
return e;
|
|
1804
|
-
}, [c, _.row_actions]), b = G(() => ({
|
|
1805
|
-
entity: i,
|
|
1806
|
-
entityCode: a ?? "",
|
|
1807
|
-
screen: _,
|
|
1808
|
-
screenRoute: _.route,
|
|
1809
|
-
selectedRows: [],
|
|
1810
|
-
selectedIds: [],
|
|
1811
|
-
locale: u,
|
|
1812
|
-
tabNavigate: (e, t) => l(e, {
|
|
1813
|
-
title: t?.title,
|
|
1814
|
-
icon: t?.icon,
|
|
1815
|
-
search: t?.search
|
|
1816
|
-
}),
|
|
1817
|
-
runActionApi: (e, t) => ne(e, t),
|
|
1818
|
-
openPeek: (t) => p(t ?? e)
|
|
1819
|
-
}), [
|
|
1820
|
-
i,
|
|
1821
|
-
a,
|
|
1822
|
-
_,
|
|
1823
|
-
u,
|
|
1824
|
-
l,
|
|
1825
|
-
p,
|
|
1826
|
-
e
|
|
1827
|
-
]), x = G(() => {
|
|
1828
|
-
let e = _.action_layout ?? null, t = i.action_layout ?? null, n = e ?? t ?? s(v, "list_row");
|
|
1829
|
-
return o(n, v, void 0, "list_row");
|
|
1830
|
-
}, [
|
|
1831
|
-
_,
|
|
1832
|
-
i,
|
|
1833
|
-
v
|
|
1834
|
-
]), C = G(() => yn(y(x, v, void 0, e, [], Re(i, e)), {
|
|
1835
|
-
peek: d,
|
|
1836
|
-
open: f
|
|
1837
|
-
}), [
|
|
1838
|
-
x,
|
|
1839
|
-
v,
|
|
1840
|
-
e,
|
|
1841
|
-
i,
|
|
1842
|
-
d,
|
|
1843
|
-
f
|
|
1844
|
-
]);
|
|
1845
|
-
return {
|
|
1846
|
-
layout: C,
|
|
1847
|
-
entityActions: v,
|
|
1848
|
-
runRowAction: U((n, r) => {
|
|
1849
|
-
let i = Ve(n, r, { row: e });
|
|
1850
|
-
if (i !== null) return m({
|
|
1851
|
-
action: r,
|
|
1852
|
-
title: L(r.display?.name) || n,
|
|
1853
|
-
row: e,
|
|
1854
|
-
execute: (e) => ne(i, S(e, [t]))
|
|
1855
|
-
});
|
|
1856
|
-
}, [
|
|
1857
|
-
m,
|
|
1858
|
-
t,
|
|
1859
|
-
e
|
|
1860
|
-
]),
|
|
1861
|
-
widgetContext: b,
|
|
1862
|
-
hasPeek: G(() => bn(C, g), [C])
|
|
1863
|
-
};
|
|
1864
|
-
}
|
|
1865
|
-
//#endregion
|
|
1866
|
-
//#region src/components/pages/list/RowActionsCell.tsx
|
|
1867
|
-
function Sn({ row: t, rowId: n, screen: i, fullScreen: a, entity: o, entityCode: s, rowActions: c, tabNavigate: l, peekAllowed: u, hasDetailTarget: d, onPeek: f, locale: p }) {
|
|
1868
|
-
let { layout: m, entityActions: h, runRowAction: g, widgetContext: _, hasPeek: v } = xn({
|
|
1869
|
-
row: t,
|
|
1870
|
-
rowId: n,
|
|
1871
|
-
screen: i,
|
|
1872
|
-
fullScreen: a,
|
|
1873
|
-
entity: o,
|
|
1874
|
-
entityCode: s,
|
|
1875
|
-
rowActions: c,
|
|
1876
|
-
tabNavigate: l,
|
|
1877
|
-
locale: p,
|
|
1878
|
-
peekAllowed: u,
|
|
1879
|
-
hasDetailTarget: d,
|
|
1880
|
-
onPeek: f
|
|
1881
|
-
});
|
|
1882
|
-
return /* @__PURE__ */ X("div", {
|
|
1883
|
-
className: "sl-row-actions",
|
|
1884
|
-
style: {
|
|
1885
|
-
display: "flex",
|
|
1886
|
-
alignItems: "center",
|
|
1887
|
-
gap: 2,
|
|
1888
|
-
justifyContent: "flex-end"
|
|
1889
|
-
},
|
|
1890
|
-
children: [v && /* @__PURE__ */ Y(r, {
|
|
1891
|
-
size: 22,
|
|
1892
|
-
icon: /* @__PURE__ */ Y(e.eye, { size: 12 }),
|
|
1893
|
-
onClick: (e) => {
|
|
1894
|
-
e.stopPropagation(), f(t);
|
|
1895
|
-
},
|
|
1896
|
-
title: "Peek"
|
|
1897
|
-
}), m.length > 0 && /* @__PURE__ */ Y(Me, {
|
|
1898
|
-
layout: m,
|
|
1899
|
-
row: t,
|
|
1900
|
-
kind: "row",
|
|
1901
|
-
entityActions: h,
|
|
1902
|
-
onRun: g,
|
|
1903
|
-
widgetContext: _,
|
|
1904
|
-
ariaLabel: "Row actions"
|
|
1905
|
-
})]
|
|
1906
|
-
});
|
|
1907
|
-
}
|
|
1908
|
-
//#endregion
|
|
1909
|
-
//#region src/components/pages/list/columns.ts
|
|
1910
|
-
function Cn(t, n, r, i) {
|
|
1911
|
-
let a = De(n, r);
|
|
1912
|
-
if (!a || a.read !== "denied") return i ? V("span", { title: i }, t) : t;
|
|
1913
|
-
let o = a.required_permission ? `Locked column: requires "${a.required_permission}"` : `Locked column: ${a.classification} classification`;
|
|
1914
|
-
return V("span", {
|
|
1915
|
-
title: o,
|
|
1916
|
-
"aria-label": o,
|
|
1917
|
-
className: "inline-flex items-center gap-1"
|
|
1918
|
-
}, V(e.lock, { size: 12 }), t);
|
|
1919
|
-
}
|
|
1920
|
-
function Q(e) {
|
|
1921
|
-
return {
|
|
1922
|
-
minSize: Math.min(60, e),
|
|
1923
|
-
maxSize: Math.max(Ae, e)
|
|
1924
|
-
};
|
|
1925
|
-
}
|
|
1926
|
-
function wn(e) {
|
|
1927
|
-
let { visibleCols: n, entity: r, screen: i, schema: a, entityCode: o, rowActions: s, hasBatchActions: c, hasExplicitRowActions: l, canUpdate: u, canDelete: d, peekEnabled: f, hasDetailTarget: p, userLocale: m, tabNavigate: h, refsRef: g, rowSelectionKey: _, setPeekRow: v } = e;
|
|
1928
|
-
if (n.length === 0 || !r) return [];
|
|
1929
|
-
let y = [];
|
|
1930
|
-
c && y.push({
|
|
1931
|
-
id: "_select",
|
|
1932
|
-
enableResizing: !1,
|
|
1933
|
-
header: ({ table: e }) => V(be, {
|
|
1934
|
-
checked: e.getIsAllRowsSelected(),
|
|
1935
|
-
indeterminate: e.getIsSomeRowsSelected(),
|
|
1936
|
-
onChange: () => e.toggleAllRowsSelected()
|
|
1937
|
-
}),
|
|
1938
|
-
size: 34,
|
|
1939
|
-
cell: ({ row: e }) => V("span", { "data-testid": "row-select-checkbox" }, V(be, {
|
|
1940
|
-
checked: e.getIsSelected(),
|
|
1941
|
-
onChange: () => e.toggleSelected()
|
|
1942
|
-
}))
|
|
1943
|
-
});
|
|
1944
|
-
for (let e of n) {
|
|
1945
|
-
if (e.startsWith("$status.")) {
|
|
1946
|
-
let t = e.slice(8), n = r.status_groups?.[t];
|
|
1947
|
-
if (!n) continue;
|
|
1948
|
-
let i = new Map(n.statuses.map((e) => [e.code, e]));
|
|
1949
|
-
y.push({
|
|
1950
|
-
id: e,
|
|
1951
|
-
header: L(n.name) || t,
|
|
1952
|
-
size: 140,
|
|
1953
|
-
...Q(140),
|
|
1954
|
-
cell: ({ row: e }) => {
|
|
1955
|
-
let n = e.original.$statuses?.find((e) => e.group_code === t);
|
|
1956
|
-
if (!n) return V("span", { className: "text-sm text-muted-foreground" }, "-");
|
|
1957
|
-
let r = i.get(n.status_code);
|
|
1958
|
-
return V(me, {
|
|
1959
|
-
tone: r?.color ?? "slate",
|
|
1960
|
-
size: "xs"
|
|
1961
|
-
}, L(r?.name) || n.status_code);
|
|
1962
|
-
}
|
|
1963
|
-
});
|
|
1964
|
-
continue;
|
|
1965
|
-
}
|
|
1966
|
-
if (e.startsWith("$property.")) {
|
|
1967
|
-
let t = e.slice(10), n = r.properties?.[t];
|
|
1968
|
-
if (!n) continue;
|
|
1969
|
-
y.push({
|
|
1970
|
-
id: e,
|
|
1971
|
-
header: () => Cn(L(n.name) || t, r, t, L(n.description) || void 0),
|
|
1972
|
-
size: 150,
|
|
1973
|
-
...Q(150),
|
|
1974
|
-
enableSorting: !1,
|
|
1975
|
-
cell: ({ row: e }) => {
|
|
1976
|
-
let n = e.original.$properties?.find((e) => e.property_code === t);
|
|
1977
|
-
return !n || n.value == null ? V("span", { className: "text-sm text-muted-foreground" }, "-") : V("span", { className: "text-sm" }, I(n.value));
|
|
1978
|
-
}
|
|
1979
|
-
});
|
|
1980
|
-
continue;
|
|
1981
|
-
}
|
|
1982
|
-
if (e === "$evidence") {
|
|
1983
|
-
y.push({
|
|
1984
|
-
id: e,
|
|
1985
|
-
header: "Evidence",
|
|
1986
|
-
size: 140,
|
|
1987
|
-
...Q(140),
|
|
1988
|
-
enableSorting: !1,
|
|
1989
|
-
cell: ({ row: e }) => {
|
|
1990
|
-
let t = e.original.$evidence?.verdict ?? "unverified";
|
|
1991
|
-
return V(me, {
|
|
1992
|
-
tone: ct(t),
|
|
1993
|
-
size: "xs",
|
|
1994
|
-
dot: !0
|
|
1995
|
-
}, ut(t));
|
|
1996
|
-
}
|
|
1997
|
-
});
|
|
1998
|
-
continue;
|
|
1999
|
-
}
|
|
2000
|
-
if (r.files?.get(e)) {
|
|
2001
|
-
y.push({
|
|
2002
|
-
id: e,
|
|
2003
|
-
accessorFn: (t) => t.$files?.[e] ?? null,
|
|
2004
|
-
header: () => Cn(Ie(r, e, a?.entities), r, e),
|
|
2005
|
-
size: 150,
|
|
2006
|
-
...Q(150),
|
|
2007
|
-
cell: ({ row: t }) => ze({
|
|
2008
|
-
entity: r,
|
|
2009
|
-
entityCode: o,
|
|
2010
|
-
fieldName: e,
|
|
2011
|
-
record: t.original,
|
|
2012
|
-
mode: "display",
|
|
2013
|
-
surface: "list",
|
|
2014
|
-
refs: g.current,
|
|
2015
|
-
locale: m
|
|
2016
|
-
})
|
|
2017
|
-
});
|
|
2018
|
-
continue;
|
|
2019
|
-
}
|
|
2020
|
-
let n = r.fields.get(e);
|
|
2021
|
-
if (!n) continue;
|
|
2022
|
-
let i = t(n, e, a?.entities), s = n.display?.width, c = ae({
|
|
2023
|
-
field: n,
|
|
2024
|
-
fieldName: e,
|
|
2025
|
-
surface: "list",
|
|
2026
|
-
entity: r,
|
|
2027
|
-
entities: a?.entities,
|
|
2028
|
-
screens: a?.screens,
|
|
2029
|
-
refs: () => g.current,
|
|
2030
|
-
locale: m
|
|
2031
|
-
});
|
|
2032
|
-
y.push({
|
|
2033
|
-
id: e,
|
|
2034
|
-
accessorKey: e,
|
|
2035
|
-
header: () => Cn(i, r, e, L(n.display?.description) || void 0),
|
|
2036
|
-
enableSorting: n.type !== "json",
|
|
2037
|
-
size: s ?? 150,
|
|
2038
|
-
...Q(s ?? 150),
|
|
2039
|
-
cell: ({ getValue: e, row: t }) => c(e(), t.original)
|
|
2040
|
-
});
|
|
2041
|
-
}
|
|
2042
|
-
return (!l && u || !l && d || s.length > 0) && y.push({
|
|
2043
|
-
id: "_actions",
|
|
2044
|
-
enableResizing: !1,
|
|
2045
|
-
header: "",
|
|
2046
|
-
size: 40,
|
|
2047
|
-
cell: ({ row: e }) => V(Sn, {
|
|
2048
|
-
row: e.original,
|
|
2049
|
-
rowId: _(r, e.original),
|
|
2050
|
-
screen: i,
|
|
2051
|
-
fullScreen: i,
|
|
2052
|
-
entity: r,
|
|
2053
|
-
entityCode: o,
|
|
2054
|
-
rowActions: s,
|
|
2055
|
-
tabNavigate: h,
|
|
2056
|
-
peekAllowed: f,
|
|
2057
|
-
hasDetailTarget: p,
|
|
2058
|
-
onPeek: v,
|
|
2059
|
-
locale: m
|
|
2060
|
-
})
|
|
2061
|
-
}), y;
|
|
2062
|
-
}
|
|
2063
|
-
//#endregion
|
|
2064
|
-
//#region src/components/pages/list/RowContextMenu.tsx
|
|
2065
|
-
function Tn({ x: e, y: t, row: n, rowId: r, screen: i, fullScreen: a, entity: o, entityCode: s, rowActions: c, tabNavigate: l, locale: u, peekAllowed: d, hasDetailTarget: p, onPeek: m, onClose: h }) {
|
|
2066
|
-
let { layout: g, entityActions: _, runRowAction: v, widgetContext: y } = xn({
|
|
2067
|
-
row: n,
|
|
2068
|
-
rowId: r,
|
|
2069
|
-
screen: i,
|
|
2070
|
-
fullScreen: a,
|
|
2071
|
-
entity: o,
|
|
2072
|
-
entityCode: s,
|
|
2073
|
-
rowActions: c,
|
|
2074
|
-
tabNavigate: l,
|
|
2075
|
-
locale: u,
|
|
2076
|
-
peekAllowed: d,
|
|
2077
|
-
hasDetailTarget: p,
|
|
2078
|
-
onPeek: m
|
|
2079
|
-
}), [b, x] = q(null), S = U((e, t) => (h(), v(e, t)), [h, v]);
|
|
2080
|
-
return g.length === 0 ? null : /* @__PURE__ */ X(J, { children: [/* @__PURE__ */ Y("div", {
|
|
2081
|
-
onClick: h,
|
|
2082
|
-
onContextMenu: (e) => {
|
|
2083
|
-
e.preventDefault(), h();
|
|
2084
|
-
},
|
|
2085
|
-
style: {
|
|
2086
|
-
position: "fixed",
|
|
2087
|
-
inset: 0,
|
|
2088
|
-
zIndex: 190
|
|
2089
|
-
}
|
|
2090
|
-
}), /* @__PURE__ */ Y(f, {
|
|
2091
|
-
open: !0,
|
|
2092
|
-
anchor: null,
|
|
2093
|
-
anchorPoint: {
|
|
2094
|
-
x: e,
|
|
2095
|
-
y: t
|
|
2096
|
-
},
|
|
2097
|
-
onClose: h,
|
|
2098
|
-
width: 220,
|
|
2099
|
-
children: /* @__PURE__ */ Y("div", {
|
|
2100
|
-
onClick: h,
|
|
2101
|
-
children: /* @__PURE__ */ Y(Fe, {
|
|
2102
|
-
layout: g,
|
|
2103
|
-
entityActions: _,
|
|
2104
|
-
onRun: S,
|
|
2105
|
-
loading: b,
|
|
2106
|
-
onLoadingChange: x,
|
|
2107
|
-
row: n,
|
|
2108
|
-
widgetContext: y
|
|
2109
|
-
})
|
|
2110
|
-
})
|
|
2111
|
-
})] });
|
|
2112
|
-
}
|
|
2113
|
-
//#endregion
|
|
2114
|
-
//#region src/components/pages/list/useHeaderReorder.ts
|
|
2115
|
-
var En = 5, $ = 48, Dn = 18;
|
|
2116
|
-
function On({ visibleCols: e, onReorder: t, scrollElRef: n, theadRef: r }) {
|
|
2117
|
-
let [i, a] = q(null), [o, s] = q(null), [c, l] = q(!1), u = K(null), d = K(!1), f = K(!1), p = K([]), m = K(null), h = K(0), g = K(null), _ = K(0), v = U(() => {
|
|
2118
|
-
g.current !== null && (cancelAnimationFrame(g.current), g.current = null);
|
|
2119
|
-
}, []), y = U(() => {
|
|
2120
|
-
u.current = null, d.current = !1, p.current = [], m.current = null, v(), a(null), s(null), l(!1);
|
|
2121
|
-
}, [v]), b = U((e) => {
|
|
2122
|
-
let t = p.current, r = e + ((n.current?.scrollLeft ?? 0) - _.current);
|
|
2123
|
-
for (let e = 0; e < t.length; e++) if (r < (t[e].left + t[e].right) / 2) return e;
|
|
2124
|
-
return t.length;
|
|
2125
|
-
}, [n]), x = U(() => {
|
|
2126
|
-
let e = n.current;
|
|
2127
|
-
if (!d.current || !e) {
|
|
2128
|
-
g.current = null;
|
|
2129
|
-
return;
|
|
2130
|
-
}
|
|
2131
|
-
let t = e.getBoundingClientRect(), r = h.current, i = 0;
|
|
2132
|
-
if (r < t.left + $ ? i = -Math.ceil((t.left + $ - r) / $ * Dn) : r > t.right - $ && (i = Math.ceil((r - (t.right - $)) / $ * Dn)), i !== 0) {
|
|
2133
|
-
e.scrollLeft += i;
|
|
2134
|
-
let t = b(h.current);
|
|
2135
|
-
m.current = t, s(t);
|
|
2136
|
-
}
|
|
2137
|
-
g.current = requestAnimationFrame(x);
|
|
2138
|
-
}, [n, b]), S = U((e, t) => {
|
|
2139
|
-
t.button === 0 && (u.current = {
|
|
2140
|
-
colId: e,
|
|
2141
|
-
x: t.clientX
|
|
2142
|
-
}, d.current = !1, f.current = !1);
|
|
2143
|
-
}, []), C = U(() => f.current ? (f.current = !1, !0) : !1, []);
|
|
2144
|
-
return W(() => {
|
|
2145
|
-
let i = (t) => {
|
|
2146
|
-
let i = u.current;
|
|
2147
|
-
if (!i) return;
|
|
2148
|
-
if (h.current = t.clientX, !d.current) {
|
|
2149
|
-
if (Math.abs(t.clientX - i.x) < En) return;
|
|
2150
|
-
let o = r.current, s = [];
|
|
2151
|
-
if (o) for (let t of e) {
|
|
2152
|
-
let e = o.querySelector(`[data-col-id="${CSS.escape(t)}"]`);
|
|
2153
|
-
if (e) {
|
|
2154
|
-
let n = e.getBoundingClientRect();
|
|
2155
|
-
s.push({
|
|
2156
|
-
id: t,
|
|
2157
|
-
left: n.left,
|
|
2158
|
-
right: n.right
|
|
2159
|
-
});
|
|
2160
|
-
}
|
|
2161
|
-
}
|
|
2162
|
-
p.current = s, _.current = n.current?.scrollLeft ?? 0, d.current = !0, f.current = !0, a(i.colId), l(!0), g.current === null && (g.current = requestAnimationFrame(x));
|
|
2163
|
-
}
|
|
2164
|
-
let o = b(t.clientX);
|
|
2165
|
-
m.current = o, s(o);
|
|
2166
|
-
}, o = (n) => {
|
|
2167
|
-
let r = u.current;
|
|
2168
|
-
if (r && d.current && n) {
|
|
2169
|
-
let n = e.indexOf(r.colId), i = m.current ?? n;
|
|
2170
|
-
if (n !== -1) {
|
|
2171
|
-
let a = e.filter((e, t) => t !== n);
|
|
2172
|
-
i > n && --i, i = Math.max(0, Math.min(i, a.length));
|
|
2173
|
-
let o = [
|
|
2174
|
-
...a.slice(0, i),
|
|
2175
|
-
r.colId,
|
|
2176
|
-
...a.slice(i)
|
|
2177
|
-
];
|
|
2178
|
-
o.some((t, n) => t !== e[n]) && t(o);
|
|
2179
|
-
}
|
|
2180
|
-
}
|
|
2181
|
-
y();
|
|
2182
|
-
}, c = () => o(!0), v = (e) => {
|
|
2183
|
-
e.key === "Escape" && d.current && o(!1);
|
|
2184
|
-
};
|
|
2185
|
-
return window.addEventListener("mousemove", i), window.addEventListener("mouseup", c), window.addEventListener("keydown", v), () => {
|
|
2186
|
-
window.removeEventListener("mousemove", i), window.removeEventListener("mouseup", c), window.removeEventListener("keydown", v);
|
|
2187
|
-
};
|
|
2188
|
-
}, [
|
|
2189
|
-
e,
|
|
2190
|
-
t,
|
|
2191
|
-
r,
|
|
2192
|
-
n,
|
|
2193
|
-
b,
|
|
2194
|
-
x,
|
|
2195
|
-
y
|
|
2196
|
-
]), W(() => y, [y]), {
|
|
2197
|
-
dragColId: i,
|
|
2198
|
-
dropIndex: o,
|
|
2199
|
-
isDragging: c,
|
|
2200
|
-
onHeaderMouseDown: S,
|
|
2201
|
-
consumeDragSuppression: C
|
|
2202
|
-
};
|
|
2203
|
-
}
|
|
2204
|
-
//#endregion
|
|
2205
|
-
//#region src/components/pages/SmartListPage.impl.tsx
|
|
2206
|
-
var kn = gt(() => import("./ListCardsBody-DXcDg536.js").then((e) => ({ default: e.ListCardsBody })));
|
|
2207
|
-
function An({ screenCode: e }) {
|
|
2208
|
-
return /* @__PURE__ */ Y(ce, { children: /* @__PURE__ */ Y(jn, { screenCode: e }) });
|
|
2209
|
-
}
|
|
2210
|
-
function jn({ screenCode: e }) {
|
|
2211
|
-
let n = Ce(), [r, i] = _t(), { data: a } = de(), o = re(), [s, c] = q(!1), [f, m] = q(!1), { filters: h, filterError: g, activeCount: _, setFilters: v, clearFilters: y } = tt(), S = te((e) => e.user), C = te((e) => e.activeTenant), T = O(), k = a?.screens[e], A = k?.entity ? a?.entities[k.entity] : void 0, j = k?.entity, M = w(A, "create"), ie = w(A, "update"), N = w(A, "delete"), P = a?.actions, F = G(() => u(l(A?.actions, k?.actions, "list_toolbar", P), A), [
|
|
2212
|
-
A,
|
|
2213
|
-
k?.actions,
|
|
2214
|
-
P
|
|
2215
|
-
]), R = G(() => u(l(A?.actions, void 0, "list_floatbar", P), A), [A, P]), oe = G(() => {
|
|
2216
|
-
let e = /* @__PURE__ */ new Map(), t = (t) => {
|
|
2217
|
-
for (let n of l(A?.actions, t, "list_row", P)) e.set(n.code, n);
|
|
2218
|
-
};
|
|
2219
|
-
t(k?.row_actions);
|
|
2220
|
-
for (let e of k?.variants?.items() ?? []) e.row_actions !== void 0 && t(e.row_actions);
|
|
2221
|
-
return u([...e.values()], A);
|
|
2222
|
-
}, [
|
|
2223
|
-
A,
|
|
2224
|
-
k,
|
|
2225
|
-
P
|
|
2226
|
-
]), se = k?.row_actions !== void 0, ce = G(() => R.length > 0 || A?.export?.enabled !== !1 && k?.export?.enabled !== !1, [
|
|
2227
|
-
R,
|
|
2228
|
-
A?.export?.enabled,
|
|
2229
|
-
k?.export?.enabled
|
|
2230
|
-
]), le = !!A?.soft_delete, ue = le && (S?.permissions ?? []).some((e) => e === "feature:view_deleted" || e === "feature:*" || e === "*"), fe = ue && r.get("include_deleted") === "true", pe = x(), { openTab: me, updateTabSearch: _e, findTabByPathname: ve } = Se();
|
|
2231
|
-
ot(k, A, r.toString()), st(k?.route);
|
|
2232
|
-
let ye = U((e) => {
|
|
2233
|
-
if (!k?.route || !A || pe.enabled) return;
|
|
2234
|
-
let t = ve(k.route);
|
|
2235
|
-
if (t) {
|
|
2236
|
-
_e(t.id, e);
|
|
2237
|
-
return;
|
|
2238
|
-
}
|
|
2239
|
-
me({
|
|
2240
|
-
pathname: k.route,
|
|
2241
|
-
search: e,
|
|
2242
|
-
title: L(k.display?.name) || L(A.display.name_plural),
|
|
2243
|
-
icon: k.display?.icon || A.display.icon,
|
|
2244
|
-
closable: !0
|
|
2245
|
-
});
|
|
2246
|
-
}, [
|
|
2247
|
-
k,
|
|
2248
|
-
A,
|
|
2249
|
-
pe.enabled,
|
|
2250
|
-
ve,
|
|
2251
|
-
_e,
|
|
2252
|
-
me
|
|
2253
|
-
]), be = parseInt(r.get("page") ?? "1", 10), xe = (() => {
|
|
2254
|
-
let e = parseInt(r.get("per_page") ?? "", 10);
|
|
2255
|
-
return !Number.isFinite(e) || e <= 0 || e > 1e3 ? 200 : e;
|
|
2256
|
-
})(), Te = r.get("search") ?? "", Ee = Mt({
|
|
2257
|
-
searchParams: r,
|
|
2258
|
-
setSearchParams: i,
|
|
2259
|
-
screenSortDefault: k?.sort_default,
|
|
2260
|
-
commitScreenTabSearch: ye
|
|
2261
|
-
}), { cols: De, nullsByField: ke, forRequest: Ae, tableSorting: je, write: Me, applyColumn: Fe, shiftClickColumn: Ie, appendColumn: Le, clearColumn: Re, clearAll: ze } = Ee, Ve = G(() => jt(k, A, a?.entities), [
|
|
2262
|
-
k,
|
|
2263
|
-
A,
|
|
2264
|
-
a?.entities
|
|
2265
|
-
]), Ge = Lt({
|
|
2266
|
-
screenCode: e,
|
|
2267
|
-
screen: k,
|
|
2268
|
-
searchParams: r,
|
|
2269
|
-
setSearchParams: i
|
|
2270
|
-
}), { visible: Ke, sizing: Ze, setSizing: Qe, apply: et, commitResize: nt } = Ge, rt = fn({
|
|
2271
|
-
screenCode: e,
|
|
2272
|
-
screen: k,
|
|
2273
|
-
searchParams: r,
|
|
2274
|
-
setSearchParams: i,
|
|
2275
|
-
userId: S?.id,
|
|
2276
|
-
tenantId: C?.id,
|
|
2277
|
-
filterError: !!g,
|
|
2278
|
-
filters: h,
|
|
2279
|
-
visibleColumns: Ke,
|
|
2280
|
-
sort: Ae
|
|
2281
|
-
}), { active: z, saveAsNew: it, overwriteActive: ct, isSaving: lt } = rt, ut = E(Te, 300), dt = p(), B = G(() => {
|
|
2282
|
-
let e = k?.responsive?.[dt.category]?.presentation;
|
|
2283
|
-
return e === "table" || e === "cards" ? e : dt.category === "phone" ? "cards" : "table";
|
|
2284
|
-
}, [k?.responsive, dt.category]), ft = G(() => Je({
|
|
2285
|
-
entity: A,
|
|
2286
|
-
screen: k,
|
|
2287
|
-
savedViewColumns: z?.columns
|
|
2288
|
-
}), [
|
|
2289
|
-
A,
|
|
2290
|
-
k,
|
|
2291
|
-
z?.columns
|
|
2292
|
-
]), V = G(() => We({
|
|
2293
|
-
entity: A,
|
|
2294
|
-
screen: k,
|
|
2295
|
-
presentation: B,
|
|
2296
|
-
visibleColumns: Ke,
|
|
2297
|
-
card: ft,
|
|
2298
|
-
rowActions: oe,
|
|
2299
|
-
toolbarActions: F,
|
|
2300
|
-
bulkActions: R,
|
|
2301
|
-
sort: De,
|
|
2302
|
-
screens: a?.screens
|
|
2303
|
-
}), [
|
|
2304
|
-
A,
|
|
2305
|
-
k,
|
|
2306
|
-
B,
|
|
2307
|
-
Ke,
|
|
2308
|
-
ft,
|
|
2309
|
-
oe,
|
|
2310
|
-
F,
|
|
2311
|
-
R,
|
|
2312
|
-
De,
|
|
2313
|
-
a?.screens
|
|
2314
|
-
]), gt = mt({
|
|
2315
|
-
entity: A,
|
|
2316
|
-
entityCode: j,
|
|
2317
|
-
screen: k,
|
|
2318
|
-
screenCode: e,
|
|
2319
|
-
page: be,
|
|
2320
|
-
perPage: xe,
|
|
2321
|
-
sortForRequest: Ae,
|
|
2322
|
-
debouncedSearch: ut,
|
|
2323
|
-
filters: h,
|
|
2324
|
-
filterError: !!g,
|
|
2325
|
-
includeDeleted: fe,
|
|
2326
|
-
expand: V.expandFields,
|
|
2327
|
-
select: V.selectFields,
|
|
2328
|
-
runCountQuery: !0,
|
|
2329
|
-
urlKey: `${j ?? ""}|${r.toString()}`
|
|
2330
|
-
}), { rows: H, meta: vt, refs: yt, isLoading: bt, isFetching: xt, isError: St, error: Ct, isLoadingStale: wt, retry: Tt, countTotal: Et, countStrategy: At, countLoading: Nt, countError: Ft, totalPages: Rt, hasMorePages: zt, isCursor: Bt, fetchNextPage: Vt, isFetchingNextPage: Ut } = gt, Wt = It(A, H, xt), { state: Gt, setState: qt, ids: Jt, pkValues: Yt, rows: Xt, keyOf: Qt } = Wt, en = ee(A?.realtime, j ?? ""), rn = Oe(j ?? ""), an = K(yt);
|
|
2331
|
-
an.current = yt;
|
|
2332
|
-
let on = G(() => {
|
|
2333
|
-
let e = /* @__PURE__ */ new Map();
|
|
2334
|
-
if (!A) return e;
|
|
2335
|
-
for (let t of Ue(A, k, z?.columns)) {
|
|
2336
|
-
if (t.startsWith("$") || A.files?.get(t)) continue;
|
|
2337
|
-
let n = A.fields.get(t);
|
|
2338
|
-
n && e.set(t, ae({
|
|
2339
|
-
field: n,
|
|
2340
|
-
fieldName: t,
|
|
2341
|
-
surface: "list",
|
|
2342
|
-
entity: A,
|
|
2343
|
-
entities: a?.entities,
|
|
2344
|
-
screens: a?.screens,
|
|
2345
|
-
refs: () => an.current,
|
|
2346
|
-
locale: o
|
|
2347
|
-
}));
|
|
2348
|
-
}
|
|
2349
|
-
return e;
|
|
2350
|
-
}, [
|
|
2351
|
-
A,
|
|
2352
|
-
k,
|
|
2353
|
-
z?.columns,
|
|
2354
|
-
a?.entities,
|
|
2355
|
-
a?.screens,
|
|
2356
|
-
an,
|
|
2357
|
-
o
|
|
2358
|
-
]), { labelFor: sn, refs: cn } = mn(Ve, h, yt, a?.entities), un = Ht({
|
|
2359
|
-
entity: A,
|
|
2360
|
-
screen: k,
|
|
2361
|
-
screens: a?.screens,
|
|
2362
|
-
entities: a?.entities,
|
|
2363
|
-
searchParams: r,
|
|
2364
|
-
tabNavigate: n,
|
|
2365
|
-
commitScreenTabSearch: ye,
|
|
2366
|
-
isPhone: dt.category === "phone",
|
|
2367
|
-
canUpdate: ie
|
|
2368
|
-
}), { peekAllowed: dn, peekRow: Z, setPeekRow: hn, peekFields: yn, peekActions: bn, peekExecute: xn, contextMenu: Sn, setContextMenu: Cn } = un, Q = G(() => !k || !A ? !1 : d(k, "_", A, a?.screens) !== null, [
|
|
2369
|
-
k,
|
|
2370
|
-
A,
|
|
2371
|
-
a?.screens
|
|
2372
|
-
]), En = G(() => wn({
|
|
2373
|
-
visibleCols: Ke,
|
|
2374
|
-
entity: A,
|
|
2375
|
-
screen: k,
|
|
2376
|
-
schema: a,
|
|
2377
|
-
entityCode: j,
|
|
2378
|
-
rowActions: oe,
|
|
2379
|
-
hasBatchActions: ce,
|
|
2380
|
-
hasExplicitRowActions: se,
|
|
2381
|
-
canUpdate: ie,
|
|
2382
|
-
canDelete: N,
|
|
2383
|
-
peekEnabled: dn,
|
|
2384
|
-
hasDetailTarget: Q,
|
|
2385
|
-
userLocale: o,
|
|
2386
|
-
tabNavigate: n,
|
|
2387
|
-
refsRef: an,
|
|
2388
|
-
rowSelectionKey: Pt,
|
|
2389
|
-
setPeekRow: hn
|
|
2390
|
-
}), [
|
|
2391
|
-
k,
|
|
2392
|
-
A,
|
|
2393
|
-
Ke,
|
|
2394
|
-
n,
|
|
2395
|
-
ce,
|
|
2396
|
-
oe,
|
|
2397
|
-
se,
|
|
2398
|
-
j,
|
|
2399
|
-
dn,
|
|
2400
|
-
Q,
|
|
2401
|
-
a,
|
|
2402
|
-
o,
|
|
2403
|
-
ie,
|
|
2404
|
-
N,
|
|
2405
|
-
an,
|
|
2406
|
-
hn
|
|
2407
|
-
]), $ = Dt({
|
|
2408
|
-
features: kt,
|
|
2409
|
-
data: H,
|
|
2410
|
-
columns: En,
|
|
2411
|
-
manualSorting: !0,
|
|
2412
|
-
enableColumnResizing: !0,
|
|
2413
|
-
columnResizeMode: "onChange",
|
|
2414
|
-
onColumnSizingChange: Qe,
|
|
2415
|
-
state: {
|
|
2416
|
-
sorting: je,
|
|
2417
|
-
rowSelection: Gt,
|
|
2418
|
-
columnSizing: Ze
|
|
2419
|
-
},
|
|
2420
|
-
onSortingChange: (e) => {
|
|
2421
|
-
let t = (typeof e == "function" ? e(je) : e).slice(0, 5);
|
|
2422
|
-
if (t.length === 0) {
|
|
2423
|
-
Me([]);
|
|
2424
|
-
return;
|
|
2425
|
-
}
|
|
2426
|
-
let n = t.map((e) => {
|
|
2427
|
-
let t = ke.get(e.id);
|
|
2428
|
-
return {
|
|
2429
|
-
field: e.id,
|
|
2430
|
-
dir: e.desc ? "desc" : "asc",
|
|
2431
|
-
...t ? { nulls: t } : {}
|
|
2432
|
-
};
|
|
2433
|
-
});
|
|
2434
|
-
Me(n);
|
|
2435
|
-
},
|
|
2436
|
-
onRowSelectionChange: qt,
|
|
2437
|
-
getRowId: Qt
|
|
2438
|
-
}), Dn = $.state.columnResizing.isResizingColumn, An = K(!1);
|
|
2439
|
-
W(() => {
|
|
2440
|
-
let e = !!An.current && !Dn;
|
|
2441
|
-
An.current = Dn, e && nt($.state.columnSizing);
|
|
2442
|
-
}, [
|
|
2443
|
-
Dn,
|
|
2444
|
-
nt,
|
|
2445
|
-
$
|
|
2446
|
-
]);
|
|
2447
|
-
let jn = Kt($), Mn = $.getTotalSize();
|
|
2448
|
-
W(() => {
|
|
2449
|
-
let e = (e) => {
|
|
2450
|
-
let t = e.target?.tagName;
|
|
2451
|
-
if (t === "INPUT" || t === "TEXTAREA" || t === "SELECT") {
|
|
2452
|
-
e.key === "Escape" && (e.target.blur(), c(!1));
|
|
2453
|
-
return;
|
|
2454
|
-
}
|
|
2455
|
-
e.key === "/" && !e.metaKey && !e.ctrlKey && (e.preventDefault(), document.querySelector("[placeholder*=\"Search\"]")?.focus()), e.key === "f" && !e.metaKey && !e.ctrlKey && (e.preventDefault(), c((e) => !e)), e.key === "Escape" && c(!1);
|
|
2456
|
-
};
|
|
2457
|
-
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
2458
|
-
}, []);
|
|
2459
|
-
let Nn = K(null), { rows: Pn } = $.getRowModel(), Fn = K(null), In = On({
|
|
2460
|
-
visibleCols: Ke,
|
|
2461
|
-
onReorder: et,
|
|
2462
|
-
scrollElRef: Nn,
|
|
2463
|
-
theadRef: Fn
|
|
2464
|
-
}), Ln = we((e) => e.density), Rn = we((e) => e.zebra), zn = ge(), Bn = Ot({
|
|
2465
|
-
count: Pn.length,
|
|
2466
|
-
getScrollElement: () => Nn.current,
|
|
2467
|
-
estimateSize: () => B === "cards" ? 142 : 48,
|
|
2468
|
-
overscan: 10,
|
|
2469
|
-
initialOffset: zn
|
|
2470
|
-
}), Vn = G(() => Pn.map((e) => e.id), [Pn]);
|
|
2471
|
-
he({
|
|
2472
|
-
virtualizer: Bn,
|
|
2473
|
-
scrollElementRef: Nn,
|
|
2474
|
-
rowKeys: Vn
|
|
2475
|
-
}), W(() => {
|
|
2476
|
-
Bn.measure();
|
|
2477
|
-
}, [Ln, Bn]), W(() => {
|
|
2478
|
-
Bn.measure();
|
|
2479
|
-
}, [
|
|
2480
|
-
dt.width,
|
|
2481
|
-
dt.height,
|
|
2482
|
-
B,
|
|
2483
|
-
Bn
|
|
2484
|
-
]);
|
|
2485
|
-
let Hn = U((e) => {
|
|
2486
|
-
i((t) => {
|
|
2487
|
-
let n = new URLSearchParams(t);
|
|
2488
|
-
return e ? n.set("search", e) : n.delete("search"), n.set("page", "1"), n;
|
|
2489
|
-
});
|
|
2490
|
-
}, [i]), Un = U(() => {
|
|
2491
|
-
i((e) => {
|
|
2492
|
-
let t = new URLSearchParams(e);
|
|
2493
|
-
return t.get("include_deleted") ? t.delete("include_deleted") : t.set("include_deleted", "true"), t.set("page", "1"), t;
|
|
2494
|
-
});
|
|
2495
|
-
}, [i]), Wn = U((e) => {
|
|
2496
|
-
i((t) => {
|
|
2497
|
-
let n = new URLSearchParams(t);
|
|
2498
|
-
return n.set("page", String(e)), n;
|
|
2499
|
-
});
|
|
2500
|
-
}, [i]);
|
|
2501
|
-
W(() => {
|
|
2502
|
-
Rt !== void 0 && be > Rt && Wn(Rt);
|
|
2503
|
-
}, [
|
|
2504
|
-
Rt,
|
|
2505
|
-
be,
|
|
2506
|
-
Wn
|
|
2507
|
-
]);
|
|
2508
|
-
let Gn = U((e) => {
|
|
2509
|
-
i((t) => {
|
|
2510
|
-
let n = new URLSearchParams(t);
|
|
2511
|
-
return n.set("per_page", String(e)), n.set("page", "1"), n;
|
|
2512
|
-
});
|
|
2513
|
-
}, [i]);
|
|
2514
|
-
if (!k || !A) return null;
|
|
2515
|
-
let Kn = A.display, qn = L(k.display?.name) || L(Kn.name), Jn = k.display?.icon || Kn.icon, Yn = L(k.display?.description) || L(Kn.description), Xn = dt.category === "phone", Zn = B === "cards", Qn = Yt.map((e) => D(A, e)), $n = {
|
|
2516
|
-
entity: A,
|
|
2517
|
-
entityCode: j ?? "",
|
|
2518
|
-
screen: k,
|
|
2519
|
-
screenRoute: k.route,
|
|
2520
|
-
selectedRows: Xt,
|
|
2521
|
-
selectedIds: Qn,
|
|
2522
|
-
locale: o,
|
|
2523
|
-
tabNavigate: (e, t) => n(e, {
|
|
2524
|
-
title: t?.title,
|
|
2525
|
-
icon: t?.icon,
|
|
2526
|
-
search: t?.search
|
|
2527
|
-
}),
|
|
2528
|
-
runActionApi: (e, t) => ne(e, t)
|
|
2529
|
-
};
|
|
2530
|
-
return /* @__PURE__ */ X("div", {
|
|
2531
|
-
style: {
|
|
2532
|
-
display: "flex",
|
|
2533
|
-
flexDirection: "column",
|
|
2534
|
-
height: "100%",
|
|
2535
|
-
background: "var(--background)"
|
|
2536
|
-
},
|
|
2537
|
-
children: [
|
|
2538
|
-
/* @__PURE__ */ X(J, { children: [
|
|
2539
|
-
/* @__PURE__ */ Y(_n, {
|
|
2540
|
-
title: qn,
|
|
2541
|
-
description: Yn,
|
|
2542
|
-
toolbarActions: F,
|
|
2543
|
-
screenActionLayout: k.action_layout,
|
|
2544
|
-
entityActionLayout: A.action_layout,
|
|
2545
|
-
selectedIds: Jt,
|
|
2546
|
-
data: H,
|
|
2547
|
-
rowKey: Qt,
|
|
2548
|
-
onActionSuccess: () => qt({}),
|
|
2549
|
-
widgetContext: $n
|
|
2550
|
-
}),
|
|
2551
|
-
/* @__PURE__ */ Y(ln, {
|
|
2552
|
-
screen: k,
|
|
2553
|
-
entity: A,
|
|
2554
|
-
entityCode: j,
|
|
2555
|
-
schema: a,
|
|
2556
|
-
screenCode: e,
|
|
2557
|
-
screenName: qn,
|
|
2558
|
-
locale: o,
|
|
2559
|
-
isPhone: Xn,
|
|
2560
|
-
isCardsPresentation: Zn,
|
|
2561
|
-
sort: Ee,
|
|
2562
|
-
columns: Ge,
|
|
2563
|
-
views: rt,
|
|
2564
|
-
query: gt,
|
|
2565
|
-
selection: Wt,
|
|
2566
|
-
filters: {
|
|
2567
|
-
json: h,
|
|
2568
|
-
debouncedSearch: ut,
|
|
2569
|
-
count: _,
|
|
2570
|
-
onOpen: () => c(!0)
|
|
2571
|
-
},
|
|
2572
|
-
searchValue: Te,
|
|
2573
|
-
onSearchChange: Hn,
|
|
2574
|
-
onSaveView: () => m(!0),
|
|
2575
|
-
page: be,
|
|
2576
|
-
perPage: xe,
|
|
2577
|
-
includeDeleted: fe,
|
|
2578
|
-
canViewDeleted: ue,
|
|
2579
|
-
onToggleDeleted: Un,
|
|
2580
|
-
realtime: A?.realtime === !0,
|
|
2581
|
-
isLive: en
|
|
2582
|
-
}),
|
|
2583
|
-
g && /* @__PURE__ */ X("div", {
|
|
2584
|
-
role: "alert",
|
|
2585
|
-
"data-testid": "filter-url-error",
|
|
2586
|
-
style: {
|
|
2587
|
-
margin: "0 20px 10px",
|
|
2588
|
-
padding: "8px 10px",
|
|
2589
|
-
border: "1px solid var(--danger)",
|
|
2590
|
-
borderRadius: 6,
|
|
2591
|
-
color: "var(--danger)",
|
|
2592
|
-
fontSize: 12,
|
|
2593
|
-
display: "flex",
|
|
2594
|
-
alignItems: "center",
|
|
2595
|
-
gap: 8
|
|
2596
|
-
},
|
|
2597
|
-
children: [/* @__PURE__ */ X("span", { children: [g, " Showing this list without URL filters."] }), /* @__PURE__ */ Y(b, {
|
|
2598
|
-
kind: "ghost",
|
|
2599
|
-
size: "xs",
|
|
2600
|
-
onClick: y,
|
|
2601
|
-
children: "Clear"
|
|
2602
|
-
})]
|
|
2603
|
-
}),
|
|
2604
|
-
h.length > 0 && /* @__PURE__ */ Y("div", {
|
|
2605
|
-
style: { padding: "0 20px 10px" },
|
|
2606
|
-
children: /* @__PURE__ */ Y(Xe, {
|
|
2607
|
-
filters: h,
|
|
2608
|
-
resolveValue: sn,
|
|
2609
|
-
onRemove: (e) => v(at(h, e)),
|
|
2610
|
-
onClearAll: y,
|
|
2611
|
-
onChipClick: () => c(!0),
|
|
2612
|
-
fieldLabel: (e) => {
|
|
2613
|
-
if (e.startsWith("$status.")) {
|
|
2614
|
-
let t = e.slice(8), n = A.status_groups?.[t];
|
|
2615
|
-
return n ? L(n.name) || t : e;
|
|
2616
|
-
}
|
|
2617
|
-
if (e.startsWith("$property.")) {
|
|
2618
|
-
let t = e.slice(10), n = A.properties?.[t];
|
|
2619
|
-
return n ? L(n.name) || t : e;
|
|
2620
|
-
}
|
|
2621
|
-
let n = A.fields.get(e);
|
|
2622
|
-
return n ? t(n, e, a?.entities) : e;
|
|
2623
|
-
}
|
|
2624
|
-
})
|
|
2625
|
-
})
|
|
2626
|
-
] }),
|
|
2627
|
-
/* @__PURE__ */ Y(tn, {
|
|
2628
|
-
isLoading: bt,
|
|
2629
|
-
tableLoadingStale: wt,
|
|
2630
|
-
isError: St,
|
|
2631
|
-
error: Ct,
|
|
2632
|
-
rowCount: H.length,
|
|
2633
|
-
entity: A,
|
|
2634
|
-
screen: k,
|
|
2635
|
-
screenName: qn,
|
|
2636
|
-
screenIcon: Jn,
|
|
2637
|
-
isFiltered: !!ut || _ > 0,
|
|
2638
|
-
canCreate: M,
|
|
2639
|
-
toolbarActions: F,
|
|
2640
|
-
onRetry: Tt
|
|
2641
|
-
}),
|
|
2642
|
-
bt || St || H.length === 0 ? null : /* @__PURE__ */ Y("div", {
|
|
2643
|
-
style: {
|
|
2644
|
-
flex: 1,
|
|
2645
|
-
minHeight: 0,
|
|
2646
|
-
padding: "0 20px 16px",
|
|
2647
|
-
display: "flex",
|
|
2648
|
-
flexDirection: "column"
|
|
2649
|
-
},
|
|
2650
|
-
children: /* @__PURE__ */ X("div", {
|
|
2651
|
-
style: {
|
|
2652
|
-
background: "var(--surface)",
|
|
2653
|
-
border: "1px solid var(--border)",
|
|
2654
|
-
borderRadius: 8,
|
|
2655
|
-
overflow: "hidden",
|
|
2656
|
-
boxShadow: "var(--shadow-xs)",
|
|
2657
|
-
display: "flex",
|
|
2658
|
-
flexDirection: "column",
|
|
2659
|
-
flex: 1,
|
|
2660
|
-
minHeight: 0
|
|
2661
|
-
},
|
|
2662
|
-
children: [/* @__PURE__ */ Y("div", {
|
|
2663
|
-
ref: Nn,
|
|
2664
|
-
"data-testid": "list-scroll",
|
|
2665
|
-
"data-presentation": B,
|
|
2666
|
-
style: {
|
|
2667
|
-
overflow: "auto",
|
|
2668
|
-
flex: 1,
|
|
2669
|
-
minHeight: 0
|
|
2670
|
-
},
|
|
2671
|
-
children: B === "cards" ? /* @__PURE__ */ Y(ht, {
|
|
2672
|
-
fallback: null,
|
|
2673
|
-
children: /* @__PURE__ */ Y(kn, {
|
|
2674
|
-
rows: Pn,
|
|
2675
|
-
virtualizer: Bn,
|
|
2676
|
-
entity: A,
|
|
2677
|
-
screen: k,
|
|
2678
|
-
entityCode: j,
|
|
2679
|
-
entities: a?.entities,
|
|
2680
|
-
savedViewColumns: z?.columns,
|
|
2681
|
-
refs: an.current,
|
|
2682
|
-
locale: o,
|
|
2683
|
-
renderers: on,
|
|
2684
|
-
rowActions: oe,
|
|
2685
|
-
tabNavigate: n,
|
|
2686
|
-
interaction: un,
|
|
2687
|
-
hasSoftDelete: le,
|
|
2688
|
-
zebra: Rn,
|
|
2689
|
-
hasBatchActions: ce,
|
|
2690
|
-
hasDetailTarget: Q,
|
|
2691
|
-
rowKey: Qt
|
|
2692
|
-
})
|
|
2693
|
-
}) : /* @__PURE__ */ Y(Zt, {
|
|
2694
|
-
table: $,
|
|
2695
|
-
columns: En,
|
|
2696
|
-
rows: Pn,
|
|
2697
|
-
entity: A,
|
|
2698
|
-
columnSizeVars: jn,
|
|
2699
|
-
totalColumnsWidth: Mn,
|
|
2700
|
-
theadRef: Fn,
|
|
2701
|
-
virtualizer: Bn,
|
|
2702
|
-
visibleCols: Ke,
|
|
2703
|
-
headerReorder: In,
|
|
2704
|
-
sortCols: De,
|
|
2705
|
-
sortNullsMap: ke,
|
|
2706
|
-
shiftClickColumn: Ie,
|
|
2707
|
-
applyColumnSort: Fe,
|
|
2708
|
-
appendColumnSort: Le,
|
|
2709
|
-
clearColumnSort: Re,
|
|
2710
|
-
clearAllSorts: ze,
|
|
2711
|
-
renderRow: (e, t) => /* @__PURE__ */ Y($t, {
|
|
2712
|
-
row: e,
|
|
2713
|
-
rowIndex: t,
|
|
2714
|
-
entity: A,
|
|
2715
|
-
hasSoftDelete: le,
|
|
2716
|
-
zebra: Rn,
|
|
2717
|
-
hasDetailTarget: Q,
|
|
2718
|
-
interaction: un,
|
|
2719
|
-
measureElement: Bn.measureElement
|
|
2720
|
-
}, e.id),
|
|
2721
|
-
isResizingColumn: Dn
|
|
2722
|
-
})
|
|
2723
|
-
}), /* @__PURE__ */ Y(nn, {
|
|
2724
|
-
meta: vt,
|
|
2725
|
-
isCursor: Bt,
|
|
2726
|
-
isPhone: Xn,
|
|
2727
|
-
rowsLoaded: H.length,
|
|
2728
|
-
selectedCount: Jt.length,
|
|
2729
|
-
countTotal: Et,
|
|
2730
|
-
countStrategy: At,
|
|
2731
|
-
countLoading: Nt,
|
|
2732
|
-
countError: Ft,
|
|
2733
|
-
page: be,
|
|
2734
|
-
totalPages: Rt,
|
|
2735
|
-
goToPage: Wn,
|
|
2736
|
-
perPage: xe,
|
|
2737
|
-
setPerPage: Gn,
|
|
2738
|
-
hasMorePages: zt,
|
|
2739
|
-
fetchNextPage: Vt,
|
|
2740
|
-
isFetchingNextPage: Ut
|
|
2741
|
-
})]
|
|
2742
|
-
})
|
|
2743
|
-
}),
|
|
2744
|
-
/* @__PURE__ */ Y($e, {
|
|
2745
|
-
open: s,
|
|
2746
|
-
onClose: () => c(!1),
|
|
2747
|
-
filters: h,
|
|
2748
|
-
onApply: v,
|
|
2749
|
-
availableFields: Ve,
|
|
2750
|
-
defaultFilters: k?.default_filters,
|
|
2751
|
-
refs: cn
|
|
2752
|
-
}),
|
|
2753
|
-
/* @__PURE__ */ Y(gn, {
|
|
2754
|
-
open: f,
|
|
2755
|
-
pending: lt,
|
|
2756
|
-
onClose: () => m(!1),
|
|
2757
|
-
overwriteViewName: pn(z),
|
|
2758
|
-
onOverwrite: async () => {
|
|
2759
|
-
await ct(), m(!1);
|
|
2760
|
-
},
|
|
2761
|
-
onSave: async (e) => {
|
|
2762
|
-
await it(e), m(!1);
|
|
2763
|
-
}
|
|
2764
|
-
}),
|
|
2765
|
-
Jt.length > 0 && /* @__PURE__ */ Y(vn, {
|
|
2766
|
-
selectedIds: Jt,
|
|
2767
|
-
floatbarActions: R,
|
|
2768
|
-
screenActionLayout: k.action_layout,
|
|
2769
|
-
entityActionLayout: A.action_layout,
|
|
2770
|
-
data: H,
|
|
2771
|
-
rowKey: Qt,
|
|
2772
|
-
entityCode: j,
|
|
2773
|
-
entity: A,
|
|
2774
|
-
screen: k,
|
|
2775
|
-
onClear: () => qt({}),
|
|
2776
|
-
onActionSuccess: () => qt({}),
|
|
2777
|
-
widgetContext: $n
|
|
2778
|
-
}),
|
|
2779
|
-
Sn && A && k && /* @__PURE__ */ Y(Tn, {
|
|
2780
|
-
x: Sn.x,
|
|
2781
|
-
y: Sn.y,
|
|
2782
|
-
row: Sn.row,
|
|
2783
|
-
rowId: Qt(Sn.row),
|
|
2784
|
-
screen: k,
|
|
2785
|
-
fullScreen: k,
|
|
2786
|
-
entity: A,
|
|
2787
|
-
entityCode: j,
|
|
2788
|
-
rowActions: oe,
|
|
2789
|
-
tabNavigate: n,
|
|
2790
|
-
locale: o,
|
|
2791
|
-
peekAllowed: dn,
|
|
2792
|
-
hasDetailTarget: Q,
|
|
2793
|
-
onPeek: hn,
|
|
2794
|
-
onClose: () => Cn(null)
|
|
2795
|
-
}),
|
|
2796
|
-
dn && Z && A && /* @__PURE__ */ Y(Ye, {
|
|
2797
|
-
entity: A,
|
|
2798
|
-
entityCode: j,
|
|
2799
|
-
record: Z,
|
|
2800
|
-
title: (() => {
|
|
2801
|
-
let e = k.columns?.find((e) => !e.startsWith("$status.") && !e.startsWith("$property."));
|
|
2802
|
-
return e ? I(Z[e] ?? L(A.display.name)) : L(A.display.name);
|
|
2803
|
-
})(),
|
|
2804
|
-
recordId: (() => {
|
|
2805
|
-
let e = A.fields.names()?.find((e) => A.fields.get(e)?.primary);
|
|
2806
|
-
return e ? I(Z[e]) : void 0;
|
|
2807
|
-
})(),
|
|
2808
|
-
fields: yn,
|
|
2809
|
-
screen: Be(A, k, Z),
|
|
2810
|
-
actions: bn,
|
|
2811
|
-
screenActionLayout: Be(A, k, Z)?.action_layout,
|
|
2812
|
-
entityActionLayout: A.action_layout,
|
|
2813
|
-
executeAction: xn,
|
|
2814
|
-
onClose: () => {
|
|
2815
|
-
if (A && Z) {
|
|
2816
|
-
let e = A.fields.names()?.find((e) => A.fields.get(e)?.primary);
|
|
2817
|
-
e && pt(I(Z[e]));
|
|
2818
|
-
}
|
|
2819
|
-
hn(null);
|
|
2820
|
-
},
|
|
2821
|
-
onOpen: (e) => {
|
|
2822
|
-
let t = Z;
|
|
2823
|
-
hn(null), un.navigateToDetail(t, { draft: e });
|
|
2824
|
-
},
|
|
2825
|
-
onSave: (e) => {
|
|
2826
|
-
hn(e);
|
|
2827
|
-
let t = A.fields.names()?.find((e) => A.fields.get(e)?.primary);
|
|
2828
|
-
if (!t) return;
|
|
2829
|
-
let n = I(e[t]), r = {};
|
|
2830
|
-
for (let t of A.fields.names()) {
|
|
2831
|
-
let n = Ne(A, e, t), i = Ne(A, Z, t), a = Pe(A, t, n), o = Pe(A, t, i);
|
|
2832
|
-
(a === "" ? null : a) !== (o === "" || o === void 0 ? null : o) && (r[t] = a);
|
|
2833
|
-
}
|
|
2834
|
-
let i = qe({
|
|
2835
|
-
entity: A,
|
|
2836
|
-
formData: e,
|
|
2837
|
-
record: Z,
|
|
2838
|
-
isNew: !1
|
|
2839
|
-
});
|
|
2840
|
-
if (Object.keys(i).length > 0 && (r.$files = i), Object.keys(r).length === 0) return;
|
|
2841
|
-
let a = He(i);
|
|
2842
|
-
rn.mutate({
|
|
2843
|
-
pkValues: n,
|
|
2844
|
-
data: r
|
|
2845
|
-
}, { onSuccess: () => {
|
|
2846
|
-
a.forEach((e) => T.markCommitted(e));
|
|
2847
|
-
} });
|
|
2848
|
-
}
|
|
2849
|
-
})
|
|
2850
|
-
]
|
|
2851
|
-
});
|
|
2852
|
-
}
|
|
2853
|
-
//#endregion
|
|
2854
|
-
export { An as SmartListPage, Sn as t };
|