@realtek/zinnext-theme 0.0.0-stage → 1.0.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 +82 -3
- package/dist-lib/DocumentViewer-BaSdIaiX.js +575 -0
- package/dist-lib/DocumentViewer-BaSdIaiX.js.map +1 -0
- package/dist-lib/DocumentViewer-DyVOzGFs.cjs +2 -0
- package/dist-lib/DocumentViewer-DyVOzGFs.cjs.map +1 -0
- package/dist-lib/FileField-CYCUE0OI.js +2887 -0
- package/dist-lib/FileField-CYCUE0OI.js.map +1 -0
- package/dist-lib/FileField-DsQMJqXA.cjs +3 -0
- package/dist-lib/FileField-DsQMJqXA.cjs.map +1 -0
- package/dist-lib/LinkedRecordFileField-IXUcG6eb.js +3834 -0
- package/dist-lib/LinkedRecordFileField-IXUcG6eb.js.map +1 -0
- package/dist-lib/LinkedRecordFileField-hK12u1Pu.cjs +4 -0
- package/dist-lib/LinkedRecordFileField-hK12u1Pu.cjs.map +1 -0
- package/dist-lib/addFormApi-DEuEstyI.js +63 -0
- package/dist-lib/addFormApi-DEuEstyI.js.map +1 -0
- package/dist-lib/addFormApi-_5jnZVE1.cjs +2 -0
- package/dist-lib/addFormApi-_5jnZVE1.cjs.map +1 -0
- package/dist-lib/authApi-CERg2tGa.js +429 -0
- package/dist-lib/authApi-CERg2tGa.js.map +1 -0
- package/dist-lib/authApi-D4ufO1Os.cjs +2 -0
- package/dist-lib/authApi-D4ufO1Os.cjs.map +1 -0
- package/dist-lib/diceCandidateMapper-BjMhHno3.cjs +2 -0
- package/dist-lib/diceCandidateMapper-BjMhHno3.cjs.map +1 -0
- package/dist-lib/diceCandidateMapper-DqBO4EhL.js +201 -0
- package/dist-lib/diceCandidateMapper-DqBO4EhL.js.map +1 -0
- package/dist-lib/dropdownApi-BSlu1x_6.cjs +2 -0
- package/dist-lib/dropdownApi-BSlu1x_6.cjs.map +1 -0
- package/dist-lib/dropdownApi-C-DH4cqu.js +583 -0
- package/dist-lib/dropdownApi-C-DH4cqu.js.map +1 -0
- package/dist-lib/formGroupsCache-Bbz-28ws.cjs +2 -0
- package/dist-lib/formGroupsCache-Bbz-28ws.cjs.map +1 -0
- package/dist-lib/formGroupsCache-JeC59oNe.js +24 -0
- package/dist-lib/formGroupsCache-JeC59oNe.js.map +1 -0
- package/dist-lib/index.cjs +10 -0
- package/dist-lib/index.cjs.map +1 -0
- package/dist-lib/index.js +71151 -0
- package/dist-lib/index.js.map +1 -0
- package/dist-lib/jobsApi-0Z3ckOL3.cjs +2 -0
- package/dist-lib/jobsApi-0Z3ckOL3.cjs.map +1 -0
- package/dist-lib/jobsApi-BWnuOB-d.js +82 -0
- package/dist-lib/jobsApi-BWnuOB-d.js.map +1 -0
- package/dist-lib/recordAccess-BxBh-Qea.js +37 -0
- package/dist-lib/recordAccess-BxBh-Qea.js.map +1 -0
- package/dist-lib/recordAccess-C0idY6GV.cjs +2 -0
- package/dist-lib/recordAccess-C0idY6GV.cjs.map +1 -0
- package/dist-lib/rolldown-runtime-Chgba0Kb.cjs +1 -0
- package/dist-lib/rolldown-runtime-Dy4uBu1J.js +11 -0
- package/dist-lib/style.css +2 -0
- package/package.json +124 -6
|
@@ -0,0 +1,3834 @@
|
|
|
1
|
+
import { C as e, E as t, O as n, S as r, a as i, d as a, o } from "./authApi-CERg2tGa.js";
|
|
2
|
+
import { A as s, B as c, C as l, E as u, F as d, H as f, M as p, O as m, S as h, U as g, V as _, a as v, bt as ee, f as y, m as te, p as ne, rt as re, st as b, tt as ie, u as ae, v as oe, vt as se, w as ce, y as le, z as ue } from "./FileField-CYCUE0OI.js";
|
|
3
|
+
import { r as de } from "./addFormApi-DEuEstyI.js";
|
|
4
|
+
import { Suspense as fe, createContext as pe, lazy as x, useCallback as me, useContext as he, useEffect as S, useMemo as C, useRef as ge, useState as w, useSyncExternalStore as _e } from "react";
|
|
5
|
+
import { Alert as ve, Breadcrumb as ye, Button as be, Checkbox as xe, Form as Se, Modal as T, Space as Ce, Spin as we, Tag as Te, Tooltip as Ee, Typography as De, message as E } from "antd";
|
|
6
|
+
import { DownOutlined as Oe, EditOutlined as ke, ExclamationCircleFilled as Ae, EyeOutlined as je, FileOutlined as Me, FilePdfOutlined as Ne, FileTextOutlined as Pe, FileWordOutlined as Fe, InfoCircleFilled as Ie, PlusOutlined as Le, UserOutlined as Re } from "@ant-design/icons";
|
|
7
|
+
import { Fragment as D, jsx as O, jsxs as k } from "react/jsx-runtime";
|
|
8
|
+
import A from "dayjs";
|
|
9
|
+
import { Link as ze } from "react-router-dom";
|
|
10
|
+
import { EditorContent as Be, useEditor as Ve } from "@tiptap/react";
|
|
11
|
+
import He from "@tiptap/starter-kit";
|
|
12
|
+
import Ue from "@tiptap/extension-link";
|
|
13
|
+
import We from "@tiptap/extension-underline";
|
|
14
|
+
import { Table as Ge, TableCell as Ke, TableHeader as qe, TableRow as Je } from "@tiptap/extension-table";
|
|
15
|
+
import j from "prop-types";
|
|
16
|
+
//#region src/theme/colors/colors.js
|
|
17
|
+
var M = {
|
|
18
|
+
brand: "#0053a5",
|
|
19
|
+
brandDark: "#1d4ed8",
|
|
20
|
+
brandDarker: "#1e40af",
|
|
21
|
+
brandHover: "#004f85",
|
|
22
|
+
brandSoft: "#dfedf7",
|
|
23
|
+
brandSofter: "#e7f2fa",
|
|
24
|
+
brandSubtle: "#edf8fe",
|
|
25
|
+
textPrimary: "#111827",
|
|
26
|
+
textSecondary: "#4b5563",
|
|
27
|
+
textMuted: "#6b7280",
|
|
28
|
+
textSubtle: "#010306",
|
|
29
|
+
textHeading: "#142235",
|
|
30
|
+
textDark: "#232a31",
|
|
31
|
+
textPlaceholder: "#a7b0bb",
|
|
32
|
+
textInverse: "#ffffff",
|
|
33
|
+
textLink: "#0053a5",
|
|
34
|
+
surfacePage: "#f5f6fa",
|
|
35
|
+
surfaceSoft: "#f8fafc",
|
|
36
|
+
surfaceSofter: "#f3f8fb",
|
|
37
|
+
surfaceCard: "#ffffff",
|
|
38
|
+
surfaceHover: "#eff6ff",
|
|
39
|
+
surfaceHoverLight: "#f8fcff",
|
|
40
|
+
surfaceHoverSoft: "#f5fbff",
|
|
41
|
+
surfaceSelected: "#dbeafe",
|
|
42
|
+
surfaceControl: "#f4f8fb",
|
|
43
|
+
surfaceRowAlt: "#fbfdff",
|
|
44
|
+
border: "#e6f0ff",
|
|
45
|
+
borderLight: "#eef3f8",
|
|
46
|
+
borderSofter: "#f0f0f0",
|
|
47
|
+
borderMuted: "#d8e4ef",
|
|
48
|
+
borderInput: "#d5dde5",
|
|
49
|
+
borderFocus: "#7dbce6",
|
|
50
|
+
borderHover: "#99c7e8",
|
|
51
|
+
controlBorder: "#77abd0",
|
|
52
|
+
controlBorderMuted: "#e7edf3",
|
|
53
|
+
controlAccent: "#4f9ac7",
|
|
54
|
+
iconMuted: "#d1d5db",
|
|
55
|
+
iconSubtle: "#9aa6b2",
|
|
56
|
+
iconNeutral: "#8c8c8c",
|
|
57
|
+
iconSoft: "#bbbbbb",
|
|
58
|
+
scrollbarThumb: "#c4ccd8",
|
|
59
|
+
scrollbarThumbLight: "#d1d5db",
|
|
60
|
+
danger: "#dc2626",
|
|
61
|
+
dangerSoft: "#ef4444",
|
|
62
|
+
dangerStrong: "#e11d24",
|
|
63
|
+
success: "#15803d",
|
|
64
|
+
successSoft: "#16a34a",
|
|
65
|
+
warning: "#f97316",
|
|
66
|
+
info: "#3b82f6",
|
|
67
|
+
transparent: "transparent",
|
|
68
|
+
statusNeutralBg: "#f1f3ee",
|
|
69
|
+
statusNeutralText: "#717b36",
|
|
70
|
+
statusProcessingBg: "#f6f4f7",
|
|
71
|
+
statusProcessingText: "#273048",
|
|
72
|
+
statusProcessingBorder: "#d4d8dd",
|
|
73
|
+
statusWarningBg: "#fff7ea",
|
|
74
|
+
statusWarningText: "#bf7328",
|
|
75
|
+
shadowMenu: "rgba(15, 35, 55, 0.08)",
|
|
76
|
+
shadowBadge: "rgba(26, 95, 145, 0.08)",
|
|
77
|
+
shadowTag: "rgba(39, 51, 70, 0.05)",
|
|
78
|
+
shadowAvatar: "rgba(57, 77, 103, 0.12)",
|
|
79
|
+
shadowDropdown: "0 6px 16px 0 rgba(0, 0, 0, .08), 0 3px 6px -4px rgba(0, 0, 0, .12), 0 9px 28px 8px rgba(0, 0, 0, .05)",
|
|
80
|
+
avatarBlueBg: "#eaf3ff",
|
|
81
|
+
avatarBlueText: "#142235",
|
|
82
|
+
avatarPurpleBg: "#f2eaff",
|
|
83
|
+
avatarMoreBg: "#eef6ff",
|
|
84
|
+
avatarMoreText: "#0053a5",
|
|
85
|
+
avatarNeutralBg: "#d9d9d9",
|
|
86
|
+
avatarNeutralText: "#555555",
|
|
87
|
+
avatarIndigo: "#6366f1",
|
|
88
|
+
avatarPurple: "#8b5cf6",
|
|
89
|
+
avatarBlue: "#3b82f6",
|
|
90
|
+
avatarGreen: "#10b981",
|
|
91
|
+
linkedIn: "#0077b5"
|
|
92
|
+
};
|
|
93
|
+
M.textPrimary, M.textSecondary, M.textMuted, M.textSubtle, M.textInverse, M.textLink, M.danger, M.success, M.danger, M.textLink, M.surfaceSoft, M.textSecondary, M.success, M.warning;
|
|
94
|
+
var N = {
|
|
95
|
+
brand: "var(--color-brand)",
|
|
96
|
+
brandDark: "var(--color-brand-dark)",
|
|
97
|
+
brandDarker: "var(--color-brand-darker)",
|
|
98
|
+
brandHover: "var(--color-brand-hover)",
|
|
99
|
+
brandSoft: "var(--color-brand-soft)",
|
|
100
|
+
brandSofter: "var(--color-brand-softer)",
|
|
101
|
+
brandSubtle: "var(--color-brand-subtle)",
|
|
102
|
+
textPrimary: "var(--color-text-primary)",
|
|
103
|
+
textSecondary: "var(--color-text-secondary)",
|
|
104
|
+
textMuted: "var(--color-text-muted)",
|
|
105
|
+
textSubtle: "var(--color-text-subtle)",
|
|
106
|
+
textHeading: "var(--color-text-heading)",
|
|
107
|
+
textDark: "var(--color-text-dark)",
|
|
108
|
+
textPlaceholder: "var(--color-text-placeholder)",
|
|
109
|
+
textInverse: "var(--color-text-inverse)",
|
|
110
|
+
textLink: "var(--color-text-link)",
|
|
111
|
+
surfacePage: "var(--color-surface-page)",
|
|
112
|
+
surfaceSoft: "var(--color-surface-soft)",
|
|
113
|
+
surfaceSofter: "var(--color-surface-softer)",
|
|
114
|
+
surfaceCard: "var(--color-surface-card)",
|
|
115
|
+
surfaceHover: "var(--color-surface-hover)",
|
|
116
|
+
surfaceHoverLight: "var(--color-surface-hover-light)",
|
|
117
|
+
surfaceHoverSoft: "var(--color-surface-hover-soft)",
|
|
118
|
+
surfaceSelected: "var(--color-surface-selected)",
|
|
119
|
+
surfaceControl: "var(--color-surface-control)",
|
|
120
|
+
surfaceRowAlt: "var(--color-surface-row-alt)",
|
|
121
|
+
border: "var(--color-border)",
|
|
122
|
+
borderLight: "var(--color-border-light)",
|
|
123
|
+
borderSofter: "var(--color-border-softer)",
|
|
124
|
+
borderMuted: "var(--color-border-muted)",
|
|
125
|
+
borderInput: "var(--color-border-input)",
|
|
126
|
+
borderFocus: "var(--color-border-focus)",
|
|
127
|
+
borderHover: "var(--color-border-hover)",
|
|
128
|
+
controlBorder: "var(--color-control-border)",
|
|
129
|
+
controlBorderMuted: "var(--color-control-border-muted)",
|
|
130
|
+
controlAccent: "var(--color-control-accent)",
|
|
131
|
+
iconMuted: "var(--color-icon-muted)",
|
|
132
|
+
iconSubtle: "var(--color-icon-subtle)",
|
|
133
|
+
iconNeutral: "var(--color-icon-neutral)",
|
|
134
|
+
iconSoft: "var(--color-icon-soft)",
|
|
135
|
+
scrollbarThumb: "var(--color-scrollbar-thumb)",
|
|
136
|
+
scrollbarThumbLight: "var(--color-scrollbar-thumb-light)",
|
|
137
|
+
danger: "var(--color-danger)",
|
|
138
|
+
dangerSoft: "var(--color-danger-soft)",
|
|
139
|
+
dangerStrong: "var(--color-danger-strong)",
|
|
140
|
+
success: "var(--color-success)",
|
|
141
|
+
successSoft: "var(--color-success-soft)",
|
|
142
|
+
warning: "var(--color-warning)",
|
|
143
|
+
info: "var(--color-info)",
|
|
144
|
+
transparent: "var(--color-transparent)",
|
|
145
|
+
linkedIn: "var(--color-linkedin)",
|
|
146
|
+
statusNeutralBg: "var(--color-status-neutral-bg)",
|
|
147
|
+
statusNeutralText: "var(--color-status-neutral-text)",
|
|
148
|
+
statusProcessingBg: "var(--color-status-processing-bg)",
|
|
149
|
+
statusProcessingText: "var(--color-status-processing-text)",
|
|
150
|
+
statusProcessingBorder: "var(--color-status-processing-border)",
|
|
151
|
+
statusWarningBg: "var(--color-status-warning-bg)",
|
|
152
|
+
statusWarningText: "var(--color-status-warning-text)",
|
|
153
|
+
shadowMenu: "var(--color-shadow-menu)",
|
|
154
|
+
shadowBadge: "var(--color-shadow-badge)",
|
|
155
|
+
shadowTag: "var(--color-shadow-tag)",
|
|
156
|
+
shadowAvatar: "var(--color-shadow-avatar)",
|
|
157
|
+
shadowDropdown: "var(--color-shadow-dropdown)",
|
|
158
|
+
avatarBlueBg: "var(--color-avatar-blue-bg)",
|
|
159
|
+
avatarBlueText: "var(--color-avatar-blue-text)",
|
|
160
|
+
avatarPurpleBg: "var(--color-avatar-purple-bg)",
|
|
161
|
+
avatarMoreBg: "var(--color-avatar-more-bg)",
|
|
162
|
+
avatarMoreText: "var(--color-avatar-more-text)"
|
|
163
|
+
}, { Text: Ye, Title: Xe, Paragraph: Ze, Link: Qe } = De, $e = {
|
|
164
|
+
display: "h1",
|
|
165
|
+
h1: "h1",
|
|
166
|
+
h2: "h2",
|
|
167
|
+
h3: "h3",
|
|
168
|
+
h4: "h4",
|
|
169
|
+
h5: "h5",
|
|
170
|
+
"section-title": "h3",
|
|
171
|
+
"card-title": "h4",
|
|
172
|
+
subtitle: "span",
|
|
173
|
+
body: "span",
|
|
174
|
+
"body-strong": "span",
|
|
175
|
+
label: "span",
|
|
176
|
+
caption: "span",
|
|
177
|
+
meta: "span",
|
|
178
|
+
metric: "span",
|
|
179
|
+
helper: "span",
|
|
180
|
+
link: "a"
|
|
181
|
+
}, et = {
|
|
182
|
+
xs: "var(--font-size-xs)",
|
|
183
|
+
sm: "var(--font-size-sm)",
|
|
184
|
+
md: "var(--font-size-md)",
|
|
185
|
+
lg: "var(--font-size-lg)",
|
|
186
|
+
xl: "var(--font-size-xl)",
|
|
187
|
+
"2xl": "var(--font-size-2xl)",
|
|
188
|
+
"3xl": "var(--font-size-3xl)",
|
|
189
|
+
"4xl": "var(--font-size-4xl)"
|
|
190
|
+
}, tt = {
|
|
191
|
+
regular: "var(--font-weight-regular)",
|
|
192
|
+
medium: "var(--font-weight-medium)",
|
|
193
|
+
semibold: "var(--font-weight-semibold)",
|
|
194
|
+
bold: "var(--font-weight-bold)",
|
|
195
|
+
extrabold: "var(--font-weight-extrabold)"
|
|
196
|
+
}, nt = {
|
|
197
|
+
tight: "var(--line-height-tight)",
|
|
198
|
+
snug: "var(--line-height-snug)",
|
|
199
|
+
normal: "var(--line-height-normal)",
|
|
200
|
+
relaxed: "var(--line-height-relaxed)"
|
|
201
|
+
}, rt = {
|
|
202
|
+
primary: N.textPrimary,
|
|
203
|
+
secondary: N.textSecondary,
|
|
204
|
+
muted: N.textMuted,
|
|
205
|
+
subtle: N.textSubtle,
|
|
206
|
+
inverse: N.textInverse,
|
|
207
|
+
link: N.textLink,
|
|
208
|
+
danger: N.danger,
|
|
209
|
+
success: N.success
|
|
210
|
+
};
|
|
211
|
+
function it(...e) {
|
|
212
|
+
return e.filter(Boolean).join(" ");
|
|
213
|
+
}
|
|
214
|
+
function P(e, t) {
|
|
215
|
+
if (e != null) return t[e] || e;
|
|
216
|
+
}
|
|
217
|
+
function at(e, t) {
|
|
218
|
+
return t === "link" || e === "a" ? Qe : e === "p" ? Ze : [
|
|
219
|
+
"h1",
|
|
220
|
+
"h2",
|
|
221
|
+
"h3",
|
|
222
|
+
"h4",
|
|
223
|
+
"h5"
|
|
224
|
+
].includes(e) ? Xe : Ye;
|
|
225
|
+
}
|
|
226
|
+
function ot(e, t) {
|
|
227
|
+
let n = e || $e[t];
|
|
228
|
+
if (n?.startsWith("h")) return Number(n.slice(1));
|
|
229
|
+
}
|
|
230
|
+
function st({ as: e, tag: t, variant: n = "body", color: r, size: i, weight: a, lineHeight: o, align: s, truncate: c = !1, display: l, className: u, style: d, children: f, ...p }) {
|
|
231
|
+
let m = t || e || $e[n] || "span", h = at(m, n), g = ot(m, n), _ = {
|
|
232
|
+
color: P(r, rt),
|
|
233
|
+
fontSize: P(i, et),
|
|
234
|
+
fontWeight: P(a, tt),
|
|
235
|
+
lineHeight: P(o, nt),
|
|
236
|
+
display: l,
|
|
237
|
+
...d
|
|
238
|
+
};
|
|
239
|
+
return /* @__PURE__ */ O(h, {
|
|
240
|
+
...g ? { level: g } : {},
|
|
241
|
+
className: it("app-typography", `app-typography--${n}`, r && rt[r] && `app-typography--${r}`, s && `app-typography--${s}`, c && "app-typography--truncate", u),
|
|
242
|
+
style: _,
|
|
243
|
+
...p,
|
|
244
|
+
children: f
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
//#endregion
|
|
248
|
+
//#region src/components/form/selectOptionColors.jsx
|
|
249
|
+
var ct = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
|
|
250
|
+
function lt(e, t = [], n) {
|
|
251
|
+
let r = Array.isArray(e?.optionColors) ? e.optionColors : [], i = n && typeof n == "object" ? n.value : n, a = (e) => String(e ?? "").trim().toLowerCase(), o = [i, t.find((e) => a(e.value) === a(i))?.label], s = r.find((e) => o.some((t) => t != null && a(e.value) === a(t))), c = {};
|
|
252
|
+
return ct.test(s?.backgroundColor ?? "") && (c.backgroundColor = s.backgroundColor), ct.test(s?.textColor ?? "") && (c.color = s.textColor, c.WebkitTextFillColor = s.textColor), c;
|
|
253
|
+
}
|
|
254
|
+
function ut(e, t = [], n) {
|
|
255
|
+
if (!(Array.isArray(e?.optionColors) ? e.optionColors : []).length) return {};
|
|
256
|
+
let r = (n) => lt(e, t, n), i = (e, n) => n ?? t.find((t) => String(t.value) === String(e))?.label ?? e, a = (e, t) => {
|
|
257
|
+
let n = r(e), a = i(e, t);
|
|
258
|
+
return Object.keys(n).length ? /* @__PURE__ */ O("span", {
|
|
259
|
+
style: {
|
|
260
|
+
...n,
|
|
261
|
+
display: "inline-block",
|
|
262
|
+
padding: "2px 8px",
|
|
263
|
+
borderRadius: 4
|
|
264
|
+
},
|
|
265
|
+
children: a
|
|
266
|
+
}) : a;
|
|
267
|
+
}, o = Array.isArray(n) ? void 0 : n?.value ?? n, s = o == null ? {} : r(o);
|
|
268
|
+
return {
|
|
269
|
+
...Object.keys(s).length ? {
|
|
270
|
+
className: "v1-value-colored-select",
|
|
271
|
+
style: {
|
|
272
|
+
...s.backgroundColor ? { "--select-option-bg": s.backgroundColor } : {},
|
|
273
|
+
...s.color ? { "--select-option-text": s.color } : {}
|
|
274
|
+
}
|
|
275
|
+
} : {},
|
|
276
|
+
optionRender: (e) => a(e.value, e.label),
|
|
277
|
+
labelRender: ({ value: e, label: t }) => a(e, t),
|
|
278
|
+
tagRender: ({ value: e, label: t, closable: n, onClose: a }) => /* @__PURE__ */ O(Te, {
|
|
279
|
+
style: r(e),
|
|
280
|
+
closable: n,
|
|
281
|
+
onClose: a,
|
|
282
|
+
onMouseDown: (e) => {
|
|
283
|
+
e.preventDefault(), e.stopPropagation();
|
|
284
|
+
},
|
|
285
|
+
children: i(e, t)
|
|
286
|
+
})
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
//#endregion
|
|
290
|
+
//#region src/components/TipTapEditor.jsx
|
|
291
|
+
var dt = (e = "") => e.trim().replace(/^\*\*(.*?)\*\*$/s, "$1").replace(/^__(.*?)__$/s, "$1"), ft = (e = []) => e.length > 0 && e.every((e) => /^:?-{3,}:?$/.test(String(e).trim())), pt = (e = "") => {
|
|
292
|
+
let t = String(e || "").replace(/\r\n?/g, "\n").trim();
|
|
293
|
+
if (!t) return null;
|
|
294
|
+
let n = t.split("\n").filter((e) => e.trim().length > 0);
|
|
295
|
+
if (n.length < 2) return null;
|
|
296
|
+
if (n.some((e) => e.includes(" "))) {
|
|
297
|
+
let e = n.map((e) => e.split(" ").map(dt)), t = Math.max(...e.map((e) => e.length));
|
|
298
|
+
return t < 2 ? null : {
|
|
299
|
+
rows: e.map((e) => [...e, ...Array(t - e.length).fill("")]),
|
|
300
|
+
hasHeaderRow: !0
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
let r = n.filter((e) => e.includes("|")).map((e) => {
|
|
304
|
+
let t = e.trim();
|
|
305
|
+
return t.startsWith("|") && (t = t.slice(1)), t.endsWith("|") && (t = t.slice(0, -1)), t.split("|").map(dt);
|
|
306
|
+
});
|
|
307
|
+
if (r.length < 2) return null;
|
|
308
|
+
let i = r.findIndex(ft), a = r.filter((e, t) => t !== i), o = Math.max(...a.map((e) => e.length));
|
|
309
|
+
return a.length < 2 || o < 2 ? null : {
|
|
310
|
+
rows: a.map((e) => [...e, ...Array(o - e.length).fill("")]),
|
|
311
|
+
hasHeaderRow: i === 1
|
|
312
|
+
};
|
|
313
|
+
}, mt = (e, t, n) => {
|
|
314
|
+
let { table: r, tableRow: i, tableHeader: a, tableCell: o, paragraph: s } = e.nodes;
|
|
315
|
+
if (!r || !i || !o || !s) return null;
|
|
316
|
+
let c = t.map((t, r) => {
|
|
317
|
+
let c = n && r === 0 && a ? a : o, l = t.map((t) => {
|
|
318
|
+
let n = String(t ?? ""), r = n ? e.text(n) : void 0;
|
|
319
|
+
return c.create(null, s.create(null, r));
|
|
320
|
+
});
|
|
321
|
+
return i.create(null, l);
|
|
322
|
+
});
|
|
323
|
+
return r.create(null, c);
|
|
324
|
+
};
|
|
325
|
+
function F({ onClick: e, active: t, disabled: n, title: r, children: i }) {
|
|
326
|
+
return /* @__PURE__ */ O("button", {
|
|
327
|
+
type: "button",
|
|
328
|
+
title: r,
|
|
329
|
+
disabled: n,
|
|
330
|
+
className: `tte-btn${t ? " tte-btn--active" : ""}`,
|
|
331
|
+
onMouseDown: (t) => {
|
|
332
|
+
t.preventDefault(), e?.();
|
|
333
|
+
},
|
|
334
|
+
children: i
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
function ht({ editor: e, disabled: t }) {
|
|
338
|
+
return e ? /* @__PURE__ */ k("div", {
|
|
339
|
+
className: `tte-toolbar${t ? " tte-toolbar--disabled" : ""}`,
|
|
340
|
+
children: [
|
|
341
|
+
/* @__PURE__ */ k("div", {
|
|
342
|
+
className: "tte-toolbar-group",
|
|
343
|
+
children: [
|
|
344
|
+
/* @__PURE__ */ O(F, {
|
|
345
|
+
title: "Bold",
|
|
346
|
+
disabled: t,
|
|
347
|
+
active: e.isActive("bold"),
|
|
348
|
+
onClick: () => e.chain().focus().toggleBold().run(),
|
|
349
|
+
children: /* @__PURE__ */ O("strong", { children: "B" })
|
|
350
|
+
}),
|
|
351
|
+
/* @__PURE__ */ O(F, {
|
|
352
|
+
title: "Italic",
|
|
353
|
+
disabled: t,
|
|
354
|
+
active: e.isActive("italic"),
|
|
355
|
+
onClick: () => e.chain().focus().toggleItalic().run(),
|
|
356
|
+
children: /* @__PURE__ */ O("em", { children: "I" })
|
|
357
|
+
}),
|
|
358
|
+
/* @__PURE__ */ O(F, {
|
|
359
|
+
title: "Underline",
|
|
360
|
+
disabled: t,
|
|
361
|
+
active: e.isActive("underline"),
|
|
362
|
+
onClick: () => e.chain().focus().toggleUnderline().run(),
|
|
363
|
+
children: /* @__PURE__ */ O("span", {
|
|
364
|
+
style: { textDecoration: "underline" },
|
|
365
|
+
children: "U"
|
|
366
|
+
})
|
|
367
|
+
}),
|
|
368
|
+
/* @__PURE__ */ O(F, {
|
|
369
|
+
title: "Strikethrough",
|
|
370
|
+
disabled: t,
|
|
371
|
+
active: e.isActive("strike"),
|
|
372
|
+
onClick: () => e.chain().focus().toggleStrike().run(),
|
|
373
|
+
children: /* @__PURE__ */ O("s", { children: "S" })
|
|
374
|
+
})
|
|
375
|
+
]
|
|
376
|
+
}),
|
|
377
|
+
/* @__PURE__ */ O("div", { className: "tte-toolbar-divider" }),
|
|
378
|
+
/* @__PURE__ */ k("div", {
|
|
379
|
+
className: "tte-toolbar-group",
|
|
380
|
+
children: [/* @__PURE__ */ O(F, {
|
|
381
|
+
title: "Bullet List",
|
|
382
|
+
disabled: t,
|
|
383
|
+
active: e.isActive("bulletList"),
|
|
384
|
+
onClick: () => e.chain().focus().toggleBulletList().run(),
|
|
385
|
+
children: "≡"
|
|
386
|
+
}), /* @__PURE__ */ O(F, {
|
|
387
|
+
title: "Ordered List",
|
|
388
|
+
disabled: t,
|
|
389
|
+
active: e.isActive("orderedList"),
|
|
390
|
+
onClick: () => e.chain().focus().toggleOrderedList().run(),
|
|
391
|
+
children: "1."
|
|
392
|
+
})]
|
|
393
|
+
}),
|
|
394
|
+
/* @__PURE__ */ O("div", { className: "tte-toolbar-divider" }),
|
|
395
|
+
/* @__PURE__ */ O("div", {
|
|
396
|
+
className: "tte-toolbar-group",
|
|
397
|
+
children: /* @__PURE__ */ O(F, {
|
|
398
|
+
title: "Link",
|
|
399
|
+
disabled: t,
|
|
400
|
+
active: e.isActive("link"),
|
|
401
|
+
onClick: () => {
|
|
402
|
+
let t = window.prompt("Enter URL");
|
|
403
|
+
if (!t) {
|
|
404
|
+
e.chain().focus().unsetLink().run();
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
e.chain().focus().setLink({ href: t }).run();
|
|
408
|
+
},
|
|
409
|
+
children: "🔗"
|
|
410
|
+
})
|
|
411
|
+
}),
|
|
412
|
+
/* @__PURE__ */ O("div", { className: "tte-toolbar-divider" }),
|
|
413
|
+
/* @__PURE__ */ k("div", {
|
|
414
|
+
className: "tte-toolbar-group tte-table-tools",
|
|
415
|
+
children: [/* @__PURE__ */ O(F, {
|
|
416
|
+
title: "Insert 3 × 3 table",
|
|
417
|
+
disabled: t,
|
|
418
|
+
active: e.isActive("table"),
|
|
419
|
+
onClick: () => e.chain().focus().insertTable({
|
|
420
|
+
rows: 3,
|
|
421
|
+
cols: 3,
|
|
422
|
+
withHeaderRow: !0
|
|
423
|
+
}).run(),
|
|
424
|
+
children: "▦"
|
|
425
|
+
}), e.isActive("table") && /* @__PURE__ */ k(D, { children: [
|
|
426
|
+
/* @__PURE__ */ O(F, {
|
|
427
|
+
title: "Add column",
|
|
428
|
+
disabled: t || !e.can().addColumnAfter(),
|
|
429
|
+
onClick: () => e.chain().focus().addColumnAfter().run(),
|
|
430
|
+
children: "C+"
|
|
431
|
+
}),
|
|
432
|
+
/* @__PURE__ */ O(F, {
|
|
433
|
+
title: "Delete column",
|
|
434
|
+
disabled: t || !e.can().deleteColumn(),
|
|
435
|
+
onClick: () => e.chain().focus().deleteColumn().run(),
|
|
436
|
+
children: "C−"
|
|
437
|
+
}),
|
|
438
|
+
/* @__PURE__ */ O(F, {
|
|
439
|
+
title: "Add row",
|
|
440
|
+
disabled: t || !e.can().addRowAfter(),
|
|
441
|
+
onClick: () => e.chain().focus().addRowAfter().run(),
|
|
442
|
+
children: "R+"
|
|
443
|
+
}),
|
|
444
|
+
/* @__PURE__ */ O(F, {
|
|
445
|
+
title: "Delete row",
|
|
446
|
+
disabled: t || !e.can().deleteRow(),
|
|
447
|
+
onClick: () => e.chain().focus().deleteRow().run(),
|
|
448
|
+
children: "R−"
|
|
449
|
+
}),
|
|
450
|
+
/* @__PURE__ */ O(F, {
|
|
451
|
+
title: "Toggle header row",
|
|
452
|
+
disabled: t || !e.can().toggleHeaderRow(),
|
|
453
|
+
onClick: () => e.chain().focus().toggleHeaderRow().run(),
|
|
454
|
+
children: "H"
|
|
455
|
+
}),
|
|
456
|
+
/* @__PURE__ */ O(F, {
|
|
457
|
+
title: "Delete table",
|
|
458
|
+
disabled: t || !e.can().deleteTable(),
|
|
459
|
+
onClick: () => e.chain().focus().deleteTable().run(),
|
|
460
|
+
children: "🗑"
|
|
461
|
+
})
|
|
462
|
+
] })]
|
|
463
|
+
}),
|
|
464
|
+
/* @__PURE__ */ O("div", { className: "tte-toolbar-divider" }),
|
|
465
|
+
/* @__PURE__ */ O("div", {
|
|
466
|
+
className: "tte-toolbar-group",
|
|
467
|
+
children: /* @__PURE__ */ O(F, {
|
|
468
|
+
title: "Clear formatting",
|
|
469
|
+
disabled: t,
|
|
470
|
+
onClick: () => e.chain().focus().clearNodes().unsetAllMarks().run(),
|
|
471
|
+
children: "✕"
|
|
472
|
+
})
|
|
473
|
+
})
|
|
474
|
+
]
|
|
475
|
+
}) : null;
|
|
476
|
+
}
|
|
477
|
+
function gt({ value: e = "", onChange: t, disabled: n = !1, placeholder: r = "" }) {
|
|
478
|
+
let i = ge(e ?? ""), a = Ve({
|
|
479
|
+
extensions: [
|
|
480
|
+
He,
|
|
481
|
+
We,
|
|
482
|
+
Ue.configure({
|
|
483
|
+
openOnClick: !1,
|
|
484
|
+
HTMLAttributes: { rel: "noopener noreferrer" }
|
|
485
|
+
}),
|
|
486
|
+
Ge.configure({
|
|
487
|
+
resizable: !0,
|
|
488
|
+
HTMLAttributes: { class: "email-template-table" }
|
|
489
|
+
}),
|
|
490
|
+
Je,
|
|
491
|
+
qe,
|
|
492
|
+
Ke
|
|
493
|
+
],
|
|
494
|
+
content: e,
|
|
495
|
+
editable: !n,
|
|
496
|
+
editorProps: {
|
|
497
|
+
attributes: { class: "tte-content" },
|
|
498
|
+
handlePaste: (e, t) => {
|
|
499
|
+
let n = pt(t.clipboardData?.getData("text/plain") || "");
|
|
500
|
+
if (!n) return !1;
|
|
501
|
+
let r = mt(e.state.schema, n.rows, n.hasHeaderRow);
|
|
502
|
+
if (!r) return !1;
|
|
503
|
+
t.preventDefault();
|
|
504
|
+
let i = e.state.tr.replaceSelectionWith(r, !1).scrollIntoView();
|
|
505
|
+
return e.dispatch(i), !0;
|
|
506
|
+
}
|
|
507
|
+
},
|
|
508
|
+
onUpdate: ({ editor: e }) => {
|
|
509
|
+
let n = e.getHTML(), r = n === "<p></p>" ? "" : n;
|
|
510
|
+
i.current = r, t?.(r);
|
|
511
|
+
}
|
|
512
|
+
});
|
|
513
|
+
return S(() => {
|
|
514
|
+
if (!a || a.isDestroyed) return;
|
|
515
|
+
let t = e || "";
|
|
516
|
+
t !== (i.current || "") && (i.current = t, a.commands.setContent(t, !1));
|
|
517
|
+
}, [e, a]), S(() => {
|
|
518
|
+
a && a.setEditable(!n);
|
|
519
|
+
}, [n, a]), /* @__PURE__ */ k("div", {
|
|
520
|
+
className: `tte-wrapper${n ? " tte-wrapper--disabled" : ""}`,
|
|
521
|
+
children: [
|
|
522
|
+
/* @__PURE__ */ O(ht, {
|
|
523
|
+
editor: a,
|
|
524
|
+
disabled: n
|
|
525
|
+
}),
|
|
526
|
+
/* @__PURE__ */ O(Be, { editor: a }),
|
|
527
|
+
!e && !a?.isFocused && r && /* @__PURE__ */ O("div", {
|
|
528
|
+
className: "tte-placeholder",
|
|
529
|
+
children: r
|
|
530
|
+
})
|
|
531
|
+
]
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
//#endregion
|
|
535
|
+
//#region src/components/form/optionsApi.js
|
|
536
|
+
var _t = /\{([A-Za-z0-9_.]+)\}/g, vt = (e) => e == null || e === "" || e === "_";
|
|
537
|
+
function yt(e) {
|
|
538
|
+
return !!(e && typeof e.path == "string" && e.path.trim());
|
|
539
|
+
}
|
|
540
|
+
function bt(e, t, n = {}) {
|
|
541
|
+
if (!yt(e)) return null;
|
|
542
|
+
let r = n[String(e.service || "core").toLowerCase()];
|
|
543
|
+
if (!r) return null;
|
|
544
|
+
let i = !1, a = e.path.trim().replace(_t, (e, n) => {
|
|
545
|
+
let r = typeof t == "function" ? t(n) : void 0;
|
|
546
|
+
return vt(r) ? (i = !0, "") : encodeURIComponent(String(r));
|
|
547
|
+
});
|
|
548
|
+
return i ? null : {
|
|
549
|
+
base: r,
|
|
550
|
+
path: a.startsWith("/") ? a : `/${a}`
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
function xt(e, t) {
|
|
554
|
+
let n = e && typeof e == "object" && "data" in e ? e.data : e;
|
|
555
|
+
return String(t || "").split(".").filter(Boolean).forEach((e) => {
|
|
556
|
+
n = n == null ? n : n[e];
|
|
557
|
+
}), Array.isArray(n) ? n : [];
|
|
558
|
+
}
|
|
559
|
+
function St({ routeParams: e = {}, searchParams: t, getFormValue: n } = {}) {
|
|
560
|
+
return (r) => {
|
|
561
|
+
if (!vt(e[r])) return e[r];
|
|
562
|
+
let i = t?.get ? t.get(r) : void 0;
|
|
563
|
+
return vt(i) ? typeof n == "function" ? n(r) : void 0 : i;
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
//#endregion
|
|
567
|
+
//#region src/services/detailedViewApi.js
|
|
568
|
+
var Ct = {
|
|
569
|
+
job: { fetchUrl: (e) => `${t}/edit/detailed-view/${encodeURIComponent(e)}` },
|
|
570
|
+
candidate: { fetchUrl: (t) => `${e}/edit/detailed-view?_id=${encodeURIComponent(t)}` },
|
|
571
|
+
candidates: { fetchUrl: (t) => `${e}/edit/detailed-view?_id=${encodeURIComponent(t)}` },
|
|
572
|
+
submission: { fetchUrl: (e) => `${n}/edit/detailed-view?_id=${encodeURIComponent(e)}` }
|
|
573
|
+
};
|
|
574
|
+
async function wt(e, t) {
|
|
575
|
+
let n = String(e ?? "").trim().toLowerCase();
|
|
576
|
+
if (n === "job" || n === "jobs") {
|
|
577
|
+
let { getJobDetailView: e } = await import("./jobsApi-BWnuOB-d.js").then((e) => e.n);
|
|
578
|
+
return e(t);
|
|
579
|
+
}
|
|
580
|
+
if (n === "candidate" || n === "candidates") return Et(n === "candidate" ? "candidate" : "candidates", t);
|
|
581
|
+
let i = new URLSearchParams({
|
|
582
|
+
module: String(e ?? ""),
|
|
583
|
+
id: String(t)
|
|
584
|
+
});
|
|
585
|
+
return o(r, `/module-data-detail?${i.toString()}`);
|
|
586
|
+
}
|
|
587
|
+
async function Tt(e) {
|
|
588
|
+
let t = await o(r, `/module-actions?module=${encodeURIComponent(e)}`), n = t?.data ?? t ?? {};
|
|
589
|
+
return {
|
|
590
|
+
actions: Array.isArray(n.actions) ? n.actions : [],
|
|
591
|
+
actionRules: Array.isArray(n.actionRules) ? n.actionRules : []
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
async function Et(e, t) {
|
|
595
|
+
if (!e) throw Error("module is required");
|
|
596
|
+
if (!t) throw Error("id is required");
|
|
597
|
+
let n = Ct[e];
|
|
598
|
+
if (!n) throw Error(`No edit config for module: ${e}`);
|
|
599
|
+
let r = await i(), a = await fetch(n.fetchUrl(t), {
|
|
600
|
+
method: "GET",
|
|
601
|
+
headers: {
|
|
602
|
+
"Content-Type": "application/json",
|
|
603
|
+
Authorization: `Bearer ${r}`
|
|
604
|
+
}
|
|
605
|
+
});
|
|
606
|
+
if (!a.ok) throw Error(`API ${a.status}: ${a.statusText}`);
|
|
607
|
+
let o = await a.json();
|
|
608
|
+
return o.data ?? o;
|
|
609
|
+
}
|
|
610
|
+
async function Dt(e, t, n, a = []) {
|
|
611
|
+
if (!e) throw Error("module is required");
|
|
612
|
+
if (!t) throw Error("id is required");
|
|
613
|
+
let o = await i(), s = new FormData();
|
|
614
|
+
s.append("json", JSON.stringify(n)), (a ?? []).forEach(({ formKey: e, file: t }) => s.append(e, t));
|
|
615
|
+
let c;
|
|
616
|
+
try {
|
|
617
|
+
c = await fetch(`${r}/module/update/${encodeURIComponent(t)}?module=${encodeURIComponent(e)}`, {
|
|
618
|
+
method: "PUT",
|
|
619
|
+
headers: { Authorization: `Bearer ${o}` },
|
|
620
|
+
body: s
|
|
621
|
+
});
|
|
622
|
+
} catch (e) {
|
|
623
|
+
let t = /* @__PURE__ */ Error("Unable to connect to the server. Please check your network connection.");
|
|
624
|
+
throw t.originalError = e, t;
|
|
625
|
+
}
|
|
626
|
+
if (!c.ok) {
|
|
627
|
+
let e = await c.text();
|
|
628
|
+
console.error("[updateRecord] Error response:", e);
|
|
629
|
+
let t = Error(kt(e) || `API ${c.status}: ${c.statusText}`);
|
|
630
|
+
throw t.status = c.status, t.response = Ot(e), t;
|
|
631
|
+
}
|
|
632
|
+
let { invalidateFormGroupsCache: l } = await import("./formGroupsCache-JeC59oNe.js").then((e) => e.n);
|
|
633
|
+
l();
|
|
634
|
+
let u = await c.json();
|
|
635
|
+
return u.data ?? u;
|
|
636
|
+
}
|
|
637
|
+
function Ot(e) {
|
|
638
|
+
let t = String(e ?? "").trim();
|
|
639
|
+
if (!t.startsWith("{")) return null;
|
|
640
|
+
try {
|
|
641
|
+
return JSON.parse(t);
|
|
642
|
+
} catch {
|
|
643
|
+
return null;
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
function kt(e) {
|
|
647
|
+
let t = String(e ?? "").trim();
|
|
648
|
+
if (!t.startsWith("{")) return t;
|
|
649
|
+
try {
|
|
650
|
+
let e = JSON.parse(t), n = e?.error ?? e?.message;
|
|
651
|
+
return typeof n == "string" && n.trim() ? n.trim() : t;
|
|
652
|
+
} catch {
|
|
653
|
+
return t;
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
var At = (e) => e?.data ?? e;
|
|
657
|
+
async function jt(e, t) {
|
|
658
|
+
if (!e || !t) return [];
|
|
659
|
+
let n = new URLSearchParams({
|
|
660
|
+
module: e,
|
|
661
|
+
id: String(t)
|
|
662
|
+
}), i = At(await o(r, `/module-activity?${n.toString()}`));
|
|
663
|
+
return Array.isArray(i) ? i : [];
|
|
664
|
+
}
|
|
665
|
+
async function Mt(e) {
|
|
666
|
+
if (!e) return [];
|
|
667
|
+
let t = At(await o(r, `/notes?relatedId=${encodeURIComponent(e)}`));
|
|
668
|
+
return Array.isArray(t) ? t : [];
|
|
669
|
+
}
|
|
670
|
+
async function Nt({ relatedId: e, notes: t, title: n, notesFor: i }) {
|
|
671
|
+
return At(await o(r, "/notes", {
|
|
672
|
+
method: "POST",
|
|
673
|
+
body: JSON.stringify({
|
|
674
|
+
relatedId: e,
|
|
675
|
+
notes: t,
|
|
676
|
+
title: n,
|
|
677
|
+
notesFor: i
|
|
678
|
+
})
|
|
679
|
+
}));
|
|
680
|
+
}
|
|
681
|
+
//#endregion
|
|
682
|
+
//#region src/components/form/formDateInputFormat.js
|
|
683
|
+
var Pt = pe(void 0);
|
|
684
|
+
function Ft(e, t) {
|
|
685
|
+
return (typeof e == "string" ? e.trim() : "") || ee(t) || se();
|
|
686
|
+
}
|
|
687
|
+
function It() {
|
|
688
|
+
let e = he(Pt);
|
|
689
|
+
return Ft(e?.override, e?.moduleName);
|
|
690
|
+
}
|
|
691
|
+
//#endregion
|
|
692
|
+
//#region src/utils/roleFormPermissionGate.js
|
|
693
|
+
function Lt(e, t) {
|
|
694
|
+
if (!e) return !0;
|
|
695
|
+
let n = e.find((e) => e.name === t);
|
|
696
|
+
return !n || n.enabled !== !1;
|
|
697
|
+
}
|
|
698
|
+
function Rt(e, t, n) {
|
|
699
|
+
if (!e) return !0;
|
|
700
|
+
let r = e.find((e) => e.name === t);
|
|
701
|
+
if (!r) return !0;
|
|
702
|
+
let i = r.fields?.find((e) => e.field === n);
|
|
703
|
+
return !i || i.locked ? !0 : i.enabled !== !1;
|
|
704
|
+
}
|
|
705
|
+
function zt(e, t, n) {
|
|
706
|
+
if (!e) return !0;
|
|
707
|
+
let r = e.find((e) => e.name === t);
|
|
708
|
+
if (!r) return !0;
|
|
709
|
+
if (r.editable === !1) return !1;
|
|
710
|
+
let i = r.fields?.find((e) => e.field === n);
|
|
711
|
+
return !i || i.editable !== !1;
|
|
712
|
+
}
|
|
713
|
+
//#endregion
|
|
714
|
+
//#region src/components/form/linkedAddRowGroups.js
|
|
715
|
+
var Bt = (e) => e === !0 || e === 1 || e === "1";
|
|
716
|
+
function Vt(e = []) {
|
|
717
|
+
let t = /* @__PURE__ */ new Map();
|
|
718
|
+
e.forEach((e) => {
|
|
719
|
+
let n = e?.linkGroup;
|
|
720
|
+
!Bt(e?.addRow) || !n || (t.has(n) || t.set(n, []), t.get(n).push(e.name));
|
|
721
|
+
});
|
|
722
|
+
let n = /* @__PURE__ */ new Map();
|
|
723
|
+
return t.forEach((e, t) => {
|
|
724
|
+
e.length < 2 || n.set(t, {
|
|
725
|
+
leaderName: e[0],
|
|
726
|
+
memberNames: e
|
|
727
|
+
});
|
|
728
|
+
}), n;
|
|
729
|
+
}
|
|
730
|
+
function Ht(e, t) {
|
|
731
|
+
for (let n of e.values()) if (n.memberNames.includes(t)) return n;
|
|
732
|
+
return null;
|
|
733
|
+
}
|
|
734
|
+
function Ut(e, t = {}) {
|
|
735
|
+
let n = { ...t };
|
|
736
|
+
return e.forEach(({ memberNames: e }) => {
|
|
737
|
+
let t = Math.max(...e.map((e) => (n[e] ?? []).length));
|
|
738
|
+
e.forEach((e) => {
|
|
739
|
+
let r = n[e] ?? [];
|
|
740
|
+
r.length < t && (n[e] = [...r, ...Array.from({ length: t - r.length }, () => ({}))]);
|
|
741
|
+
});
|
|
742
|
+
}), n;
|
|
743
|
+
}
|
|
744
|
+
//#endregion
|
|
745
|
+
//#region src/components/form/formDecisionDialog.jsx
|
|
746
|
+
var I = {
|
|
747
|
+
duplicate: {
|
|
748
|
+
className: "fdd-tone-amber",
|
|
749
|
+
Icon: Re
|
|
750
|
+
},
|
|
751
|
+
overwrite: {
|
|
752
|
+
className: "fdd-tone-amber",
|
|
753
|
+
Icon: Ae
|
|
754
|
+
},
|
|
755
|
+
suggestion: {
|
|
756
|
+
className: "fdd-tone-blue",
|
|
757
|
+
Icon: Ie
|
|
758
|
+
},
|
|
759
|
+
file: {
|
|
760
|
+
className: "fdd-tone-blue",
|
|
761
|
+
Icon: Pe
|
|
762
|
+
}
|
|
763
|
+
};
|
|
764
|
+
function L({ tone: e = "suggestion", title: t, body: n, facts: r = [], okText: i = "Continue", cancelText: a = "Cancel", danger: o = !1, footnote: s, altText: c, renderExtra: l } = {}) {
|
|
765
|
+
let { className: u, Icon: d } = I[e] ?? I.suggestion, f = r.filter((e) => e && e.value !== void 0 && e.value !== null && String(e.value).trim() !== "");
|
|
766
|
+
return new Promise((e) => {
|
|
767
|
+
let r = !1, p = (t) => {
|
|
768
|
+
r || (r = !0, e(t));
|
|
769
|
+
}, m = T.confirm({
|
|
770
|
+
...c ? { footer: (e, { OkBtn: t, CancelBtn: n }) => /* @__PURE__ */ k(D, { children: [
|
|
771
|
+
/* @__PURE__ */ O(be, {
|
|
772
|
+
size: "large",
|
|
773
|
+
className: "fdd-alt-btn",
|
|
774
|
+
onClick: () => {
|
|
775
|
+
p("alt"), m.destroy();
|
|
776
|
+
},
|
|
777
|
+
children: c
|
|
778
|
+
}),
|
|
779
|
+
/* @__PURE__ */ O(n, {}),
|
|
780
|
+
/* @__PURE__ */ O(t, {})
|
|
781
|
+
] }) } : {},
|
|
782
|
+
icon: null,
|
|
783
|
+
centered: !0,
|
|
784
|
+
width: c ? 600 : 480,
|
|
785
|
+
className: `fdd-modal ${u}${c ? " fdd-modal--three" : ""}`,
|
|
786
|
+
okText: i,
|
|
787
|
+
cancelText: a,
|
|
788
|
+
okButtonProps: {
|
|
789
|
+
danger: o,
|
|
790
|
+
size: "large"
|
|
791
|
+
},
|
|
792
|
+
cancelButtonProps: { size: "large" },
|
|
793
|
+
content: /* @__PURE__ */ k("div", {
|
|
794
|
+
className: "fdd",
|
|
795
|
+
children: [
|
|
796
|
+
/* @__PURE__ */ k("div", {
|
|
797
|
+
className: "fdd-head",
|
|
798
|
+
children: [/* @__PURE__ */ O("span", {
|
|
799
|
+
className: "fdd-icon",
|
|
800
|
+
"aria-hidden": "true",
|
|
801
|
+
children: /* @__PURE__ */ O(d, {})
|
|
802
|
+
}), /* @__PURE__ */ O("h3", {
|
|
803
|
+
className: "fdd-title",
|
|
804
|
+
children: t
|
|
805
|
+
})]
|
|
806
|
+
}),
|
|
807
|
+
f.length > 0 && /* @__PURE__ */ O("dl", {
|
|
808
|
+
className: "fdd-facts",
|
|
809
|
+
children: f.map((e) => /* @__PURE__ */ k("div", {
|
|
810
|
+
className: "fdd-fact",
|
|
811
|
+
children: [/* @__PURE__ */ O("dt", { children: e.label }), /* @__PURE__ */ O("dd", { children: e.value })]
|
|
812
|
+
}, e.label))
|
|
813
|
+
}),
|
|
814
|
+
n && /* @__PURE__ */ O("p", {
|
|
815
|
+
className: "fdd-body",
|
|
816
|
+
children: n
|
|
817
|
+
}),
|
|
818
|
+
l?.(() => {
|
|
819
|
+
p(!0), m.destroy();
|
|
820
|
+
}),
|
|
821
|
+
s && /* @__PURE__ */ O("p", {
|
|
822
|
+
className: "fdd-footnote",
|
|
823
|
+
children: s
|
|
824
|
+
})
|
|
825
|
+
]
|
|
826
|
+
}),
|
|
827
|
+
onOk: () => p(!0),
|
|
828
|
+
onCancel: () => p(!1)
|
|
829
|
+
});
|
|
830
|
+
});
|
|
831
|
+
}
|
|
832
|
+
function Wt({ tone: e = "duplicate", title: t, body: n, facts: r = [], okText: i = "Go back", renderExtra: a } = {}) {
|
|
833
|
+
let { className: o, Icon: s } = I[e] ?? I.suggestion, c = r.filter((e) => e && String(e.value ?? "").trim() !== "");
|
|
834
|
+
return new Promise((e) => {
|
|
835
|
+
let r = T.warning({
|
|
836
|
+
icon: null,
|
|
837
|
+
centered: !0,
|
|
838
|
+
width: 480,
|
|
839
|
+
className: `fdd-modal ${o}`,
|
|
840
|
+
okText: i,
|
|
841
|
+
okButtonProps: { size: "large" },
|
|
842
|
+
content: /* @__PURE__ */ k("div", {
|
|
843
|
+
className: "fdd",
|
|
844
|
+
children: [
|
|
845
|
+
/* @__PURE__ */ k("div", {
|
|
846
|
+
className: "fdd-head",
|
|
847
|
+
children: [/* @__PURE__ */ O("span", {
|
|
848
|
+
className: "fdd-icon",
|
|
849
|
+
"aria-hidden": "true",
|
|
850
|
+
children: /* @__PURE__ */ O(s, {})
|
|
851
|
+
}), /* @__PURE__ */ O("h3", {
|
|
852
|
+
className: "fdd-title",
|
|
853
|
+
children: t
|
|
854
|
+
})]
|
|
855
|
+
}),
|
|
856
|
+
c.length > 0 && /* @__PURE__ */ O("dl", {
|
|
857
|
+
className: "fdd-facts",
|
|
858
|
+
children: c.map((e) => /* @__PURE__ */ k("div", {
|
|
859
|
+
className: "fdd-fact",
|
|
860
|
+
children: [/* @__PURE__ */ O("dt", { children: e.label }), /* @__PURE__ */ O("dd", { children: e.value })]
|
|
861
|
+
}, e.label))
|
|
862
|
+
}),
|
|
863
|
+
n && /* @__PURE__ */ O("p", {
|
|
864
|
+
className: "fdd-body",
|
|
865
|
+
children: n
|
|
866
|
+
}),
|
|
867
|
+
a?.(() => {
|
|
868
|
+
e("existing"), r.destroy();
|
|
869
|
+
})
|
|
870
|
+
]
|
|
871
|
+
}),
|
|
872
|
+
onOk: () => e(!0)
|
|
873
|
+
});
|
|
874
|
+
});
|
|
875
|
+
}
|
|
876
|
+
//#endregion
|
|
877
|
+
//#region src/services/aiActionApi.js
|
|
878
|
+
async function Gt({ module: e, group: t, field: n, actionKey: a, inputs: o = {}, files: s = {} }) {
|
|
879
|
+
if (!e || !t || !n || !a) throw Error("module, group, field and actionKey are required to run an AI action");
|
|
880
|
+
let c = await i(), l = new FormData();
|
|
881
|
+
l.append("json", JSON.stringify({ inputs: o })), Object.entries(s).forEach(([e, t]) => {
|
|
882
|
+
t && l.append(e, t);
|
|
883
|
+
});
|
|
884
|
+
let u = new URLSearchParams({
|
|
885
|
+
module: e,
|
|
886
|
+
group: t,
|
|
887
|
+
field: n,
|
|
888
|
+
action: a
|
|
889
|
+
}), d = await fetch(`${r}/ai-action?${u.toString()}`, {
|
|
890
|
+
method: "POST",
|
|
891
|
+
headers: { Authorization: `Bearer ${c}` },
|
|
892
|
+
body: l
|
|
893
|
+
}), { logout: f } = await import("./authApi-CERg2tGa.js").then((e) => e.n);
|
|
894
|
+
d.status === 401 && f();
|
|
895
|
+
let p = (d.headers.get("content-type") || "").includes("application/json") ? await d.json() : await d.text();
|
|
896
|
+
if (!d.ok) {
|
|
897
|
+
let e = Error(p?.error || p?.message || `API ${d.status}: ${d.statusText}`);
|
|
898
|
+
throw e.status = d.status, e.data = p, e;
|
|
899
|
+
}
|
|
900
|
+
return p?.data ?? p;
|
|
901
|
+
}
|
|
902
|
+
//#endregion
|
|
903
|
+
//#region src/components/form/applyGroupValues.js
|
|
904
|
+
var Kt = (e) => e === !0 || e === 1 || e === "1", qt = (e) => e == null || e === "";
|
|
905
|
+
function Jt(e) {
|
|
906
|
+
return String(e ?? "").split(".").map((e) => e.trim()).filter(Boolean);
|
|
907
|
+
}
|
|
908
|
+
function R(e, t, n) {
|
|
909
|
+
let r = Array.isArray(t) ? t : Jt(t);
|
|
910
|
+
if (!r.length) return e;
|
|
911
|
+
let i = e;
|
|
912
|
+
for (let e = 0; e < r.length - 1; e += 1) {
|
|
913
|
+
let t = r[e];
|
|
914
|
+
(!i[t] || typeof i[t] != "object" || Array.isArray(i[t])) && (i[t] = {}), i = i[t];
|
|
915
|
+
}
|
|
916
|
+
return i[r[r.length - 1]] = n, e;
|
|
917
|
+
}
|
|
918
|
+
function z(e, t = []) {
|
|
919
|
+
if (!(!e || typeof e != "object")) for (let n of t) {
|
|
920
|
+
if (!n) continue;
|
|
921
|
+
let t = s(e, n);
|
|
922
|
+
if (!qt(t)) return t;
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
function B(e, t) {
|
|
926
|
+
if (!e || typeof e != "object") return;
|
|
927
|
+
let n = Object.entries(e), r = n.find(([e, n]) => t.test(e) && !qt(n));
|
|
928
|
+
if (r) return r[1];
|
|
929
|
+
for (let [, e] of n) if (e && typeof e == "object" && !Array.isArray(e)) {
|
|
930
|
+
let n = B(e, t);
|
|
931
|
+
if (!qt(n)) return n;
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
function Yt(e, t) {
|
|
935
|
+
let n = Array.isArray(e) ? e : e ? [e] : [];
|
|
936
|
+
if (!n.length) return;
|
|
937
|
+
let r = n.map((e, n) => {
|
|
938
|
+
if (typeof e == "string") return {
|
|
939
|
+
uid: `${t.field}-${n}`,
|
|
940
|
+
name: e,
|
|
941
|
+
status: "done"
|
|
942
|
+
};
|
|
943
|
+
if (!e || typeof e != "object") return null;
|
|
944
|
+
let r = z(e, [t.fileUrlKey, t.locationKey]) ?? B(e, /(location|url|path)$/i) ?? "", i = z(e, [t.fileNameKey]) ?? B(e, /(uploadName|uploadedFileName|fileName|name)$/i) ?? "";
|
|
945
|
+
if (!r && !i) return null;
|
|
946
|
+
let a = r && !String(r).startsWith("http") ? oe(r) : r;
|
|
947
|
+
return {
|
|
948
|
+
uid: String(e.id ?? e._id ?? e.uniqueName ?? e.documentCopyUniqueName ?? `${t.field}-${n}`),
|
|
949
|
+
name: i || "file",
|
|
950
|
+
status: "done",
|
|
951
|
+
existing: !0,
|
|
952
|
+
url: a || void 0,
|
|
953
|
+
stored: e
|
|
954
|
+
};
|
|
955
|
+
}).filter(Boolean);
|
|
956
|
+
return r.length ? r : void 0;
|
|
957
|
+
}
|
|
958
|
+
function Xt(e, t) {
|
|
959
|
+
if (!e || typeof e != "object") return;
|
|
960
|
+
let n = z(e, [t.fileNameKey, t.field]) ?? B(e, /(uploadName|uploadedFileName|fileName|name)$/i), r = z(e, [t.fileUrlKey, t.locationKey]) ?? B(e, /(location|url|path)$/i) ?? "";
|
|
961
|
+
if (!n && !r) return;
|
|
962
|
+
let i = r && !String(r).startsWith("http") ? oe(r) : r, a = e.documentCopyUniqueName ?? e.uniqueName ?? n ?? `${t.field}-0`;
|
|
963
|
+
return [{
|
|
964
|
+
uid: String(a),
|
|
965
|
+
name: n ?? "file",
|
|
966
|
+
status: "done",
|
|
967
|
+
existing: !0,
|
|
968
|
+
url: i || void 0
|
|
969
|
+
}];
|
|
970
|
+
}
|
|
971
|
+
function Zt(e, t, n, r) {
|
|
972
|
+
(e.fields ?? []).forEach((e) => {
|
|
973
|
+
e?.verifyAction && [
|
|
974
|
+
e.verifyResultField,
|
|
975
|
+
e.verifyTimestampField,
|
|
976
|
+
...String(e.verifyLockedWhenFields ?? "").split(/[,\s]+/)
|
|
977
|
+
].map((e) => String(e ?? "").trim()).filter(Boolean).forEach((e) => {
|
|
978
|
+
if (s(n, e) !== void 0) return;
|
|
979
|
+
let i = r(t, { field: e });
|
|
980
|
+
i != null && R(n, e, i);
|
|
981
|
+
});
|
|
982
|
+
});
|
|
983
|
+
}
|
|
984
|
+
function Qt(e) {
|
|
985
|
+
let t = Array.isArray(e.rows) ? te(e, e.rows) : null, n = Math.max(0, Number(e.minRows ?? 0) || 0), r = (t, n, r) => {
|
|
986
|
+
let i = {};
|
|
987
|
+
return (e.fields ?? []).forEach((e) => {
|
|
988
|
+
if (!e.field) return;
|
|
989
|
+
if (e.type === "file") {
|
|
990
|
+
let r = n(t, e);
|
|
991
|
+
r && R(i, e.field, r);
|
|
992
|
+
return;
|
|
993
|
+
}
|
|
994
|
+
let a = r(t, e);
|
|
995
|
+
if (a == null) {
|
|
996
|
+
let t = e.defaultOnEdit ? m(e) : void 0;
|
|
997
|
+
t !== void 0 && R(i, e.field, t);
|
|
998
|
+
return;
|
|
999
|
+
}
|
|
1000
|
+
R(i, e.field, Kt(e.addRow) ? u(e, a) : ce(e, a));
|
|
1001
|
+
}), Zt(e, t, i, r), i;
|
|
1002
|
+
}, i = p(e, { editing: !0 });
|
|
1003
|
+
if (t && t.length > 0) {
|
|
1004
|
+
let e = t.map((e) => r(e, (e, t) => Xt(e, t), (e, t) => s(e, t.field)));
|
|
1005
|
+
for (; e.length < n;) e.push({ ...i });
|
|
1006
|
+
return e;
|
|
1007
|
+
}
|
|
1008
|
+
let a = r(e, (e, t) => Yt(t.value, t), (e, t) => t.value), o = Object.keys(a).length > 0 ? [a] : [];
|
|
1009
|
+
for (; o.length < n;) o.push({ ...i });
|
|
1010
|
+
return o;
|
|
1011
|
+
}
|
|
1012
|
+
function $t(e, t = []) {
|
|
1013
|
+
let n = {};
|
|
1014
|
+
return t.forEach((e) => {
|
|
1015
|
+
e.toggleEnabled && e.toggleField && R(n, e.toggleField, !!e.toggleValue), !e.addRow && (e.fields ?? []).forEach((e) => {
|
|
1016
|
+
if (!e.field || e.addRow) return;
|
|
1017
|
+
let t = e.value, r = e.field;
|
|
1018
|
+
if (e.type === "file") {
|
|
1019
|
+
let i = Yt(t, e);
|
|
1020
|
+
i && R(n, r, i);
|
|
1021
|
+
return;
|
|
1022
|
+
}
|
|
1023
|
+
if (t == null) return;
|
|
1024
|
+
if (e.type === "checkbox" && Array.isArray(e.options) && e.options.length > 0) {
|
|
1025
|
+
let i = e.transformRule?.map;
|
|
1026
|
+
if (i) {
|
|
1027
|
+
let e = Object.entries(i).find(([, e]) => String(e) === String(t));
|
|
1028
|
+
R(n, r, e ? [e[0]] : []);
|
|
1029
|
+
} else R(n, r, _(e, Array.isArray(t) ? t : [t]));
|
|
1030
|
+
return;
|
|
1031
|
+
}
|
|
1032
|
+
let i = e.splitDialCodeInto;
|
|
1033
|
+
if (i && typeof t == "string") {
|
|
1034
|
+
let { code: a, rest: o } = l(t), s = h(a);
|
|
1035
|
+
s && R(n, i, s), R(n, r, ce(e, o || t));
|
|
1036
|
+
return;
|
|
1037
|
+
}
|
|
1038
|
+
R(n, r, ce(e, t));
|
|
1039
|
+
});
|
|
1040
|
+
}), Object.keys(n).length > 0 && e.setFieldsValue(n), n;
|
|
1041
|
+
}
|
|
1042
|
+
//#endregion
|
|
1043
|
+
//#region src/components/form/useAiActions.js
|
|
1044
|
+
function en(e) {
|
|
1045
|
+
let t = document.createElement("div");
|
|
1046
|
+
return t.innerHTML = String(e ?? ""), t.textContent || t.innerText || "";
|
|
1047
|
+
}
|
|
1048
|
+
function tn(e, t) {
|
|
1049
|
+
return t && t === "stripHtml" ? en(e) : e;
|
|
1050
|
+
}
|
|
1051
|
+
function nn(e) {
|
|
1052
|
+
return String(e ?? "").trim().split(/\s+/).filter(Boolean).length;
|
|
1053
|
+
}
|
|
1054
|
+
function V(e) {
|
|
1055
|
+
return Object.values(e || {}).some((e) => e != null && e !== "");
|
|
1056
|
+
}
|
|
1057
|
+
function rn(e, t) {
|
|
1058
|
+
if (e.kind === "file") return Array.isArray(t) ? t.length > 0 : !!t;
|
|
1059
|
+
let n = tn(t, e.transform), r = String(n ?? "").trim();
|
|
1060
|
+
if (!r) return !1;
|
|
1061
|
+
let i = Number(e.minWords) || 0;
|
|
1062
|
+
return i > 0 ? nn(r) >= i : !0;
|
|
1063
|
+
}
|
|
1064
|
+
function an(e) {
|
|
1065
|
+
let t = [], n = /* @__PURE__ */ new Set(), r = (e) => {
|
|
1066
|
+
if (!(!e || typeof e != "object" || n.has(e))) {
|
|
1067
|
+
if (n.add(e), Array.isArray(e)) {
|
|
1068
|
+
e.forEach(r);
|
|
1069
|
+
return;
|
|
1070
|
+
}
|
|
1071
|
+
Array.isArray(e.aiActions) && e.aiActions.forEach((e) => {
|
|
1072
|
+
e && typeof e == "object" && !t.includes(e) && t.push(e);
|
|
1073
|
+
}), Array.isArray(e.fields) && r(e.fields), Array.isArray(e.subFields) && r(e.subFields);
|
|
1074
|
+
}
|
|
1075
|
+
};
|
|
1076
|
+
return r(e), t;
|
|
1077
|
+
}
|
|
1078
|
+
function on(e, t) {
|
|
1079
|
+
let n = e.inputs || [];
|
|
1080
|
+
if (n.length === 0) return !0;
|
|
1081
|
+
let r = /* @__PURE__ */ new Map();
|
|
1082
|
+
n.forEach((e, t) => {
|
|
1083
|
+
let n = e.group || `__solo_${t}`;
|
|
1084
|
+
r.has(n) || r.set(n, []), r.get(n).push(e);
|
|
1085
|
+
});
|
|
1086
|
+
for (let e of r.values()) if (e.some((e) => e.required || Number(e.minWords) > 0) && !e.some((e) => rn(e, t(e.sourceField)))) return !1;
|
|
1087
|
+
return !0;
|
|
1088
|
+
}
|
|
1089
|
+
function sn(e = []) {
|
|
1090
|
+
let t = [];
|
|
1091
|
+
return e.forEach((e) => {
|
|
1092
|
+
if (e?.addRow) {
|
|
1093
|
+
e.name && t.push(e.name);
|
|
1094
|
+
return;
|
|
1095
|
+
}
|
|
1096
|
+
(e?.fields ?? []).forEach((e) => {
|
|
1097
|
+
let n = e?.field ?? e?.name;
|
|
1098
|
+
n && t.push(n);
|
|
1099
|
+
});
|
|
1100
|
+
}), t;
|
|
1101
|
+
}
|
|
1102
|
+
function cn(e, t) {
|
|
1103
|
+
return sn(t).some((t) => {
|
|
1104
|
+
let n = e.getFieldValue(t);
|
|
1105
|
+
return Array.isArray(n) ? n.some(V) : n != null && n !== "";
|
|
1106
|
+
});
|
|
1107
|
+
}
|
|
1108
|
+
function ln(e, t = [], { includeUntouched: n = !1 } = {}) {
|
|
1109
|
+
let r = e.getFieldsValue(!0) ?? {}, i = new Set([t].flat().filter(Boolean)), a = n || typeof e.isFieldTouched != "function" ? () => !0 : (t) => e.isFieldTouched(t), o = 0;
|
|
1110
|
+
return Object.entries(r).forEach(([e, t]) => {
|
|
1111
|
+
if (!(i.has(e) || !a(e) || !H(t))) {
|
|
1112
|
+
if (Array.isArray(t)) {
|
|
1113
|
+
o += t.filter((e) => e && typeof e == "object" ? V(e) : !!e).length;
|
|
1114
|
+
return;
|
|
1115
|
+
}
|
|
1116
|
+
o += 1;
|
|
1117
|
+
}
|
|
1118
|
+
}), o;
|
|
1119
|
+
}
|
|
1120
|
+
function H(e) {
|
|
1121
|
+
return e == null || e === "" ? !1 : Array.isArray(e) ? e.some((e) => e && typeof e == "object" ? V(e) : !!e) : typeof e != "object" || Object.values(e).some((e) => e != null && e !== "");
|
|
1122
|
+
}
|
|
1123
|
+
function un(e, t = [], { includeUntouched: n = !1 } = {}) {
|
|
1124
|
+
let r = e.getFieldsValue(!0) ?? {}, i = new Set([t].flat().filter(Boolean)), a = Object.keys(r).filter((e) => !i.has(e));
|
|
1125
|
+
return n ? a.some((e) => H(r[e])) : typeof e.isFieldTouched == "function" ? a.some((t) => e.isFieldTouched(t) && H(r[t])) : a.some((e) => H(r[e]));
|
|
1126
|
+
}
|
|
1127
|
+
function dn(e = []) {
|
|
1128
|
+
let t = {};
|
|
1129
|
+
return (e ?? []).forEach((e) => {
|
|
1130
|
+
e?.addRow || (e?.fields ?? []).forEach((e) => {
|
|
1131
|
+
let n = e?.field ?? e?.name;
|
|
1132
|
+
if (!n) return;
|
|
1133
|
+
let r = e?.value;
|
|
1134
|
+
r != null && r !== "" && (t[n] = r);
|
|
1135
|
+
});
|
|
1136
|
+
}), t;
|
|
1137
|
+
}
|
|
1138
|
+
function fn(e, t, n) {
|
|
1139
|
+
let r = e?.confirmWhen ?? "never";
|
|
1140
|
+
return r === "never" ? !1 : r === "always" || cn(t, n);
|
|
1141
|
+
}
|
|
1142
|
+
var pn = [
|
|
1143
|
+
"top-left",
|
|
1144
|
+
"top-center",
|
|
1145
|
+
"top-right",
|
|
1146
|
+
"bottom-left",
|
|
1147
|
+
"bottom-center",
|
|
1148
|
+
"bottom-right"
|
|
1149
|
+
], mn = "bottom-left";
|
|
1150
|
+
function hn(e = []) {
|
|
1151
|
+
let t = {};
|
|
1152
|
+
return e.forEach((e) => {
|
|
1153
|
+
let n = pn.includes(e.position) ? e.position : mn;
|
|
1154
|
+
(t[n] ??= []).push(e);
|
|
1155
|
+
}), t;
|
|
1156
|
+
}
|
|
1157
|
+
function gn({ form: e, groups: t, module: n, onApplied: r, onParsed: i, treatPrefilledAsData: a = !1, watchSourcesOnly: o = !1 }) {
|
|
1158
|
+
let [s, c] = w(null), [l, u] = w(""), d = C(() => an(t), [t]), f = Se.useWatch((e) => o ? d.map((t) => on(t, (t) => e?.[t]) ? "1" : "0").join("") : e, e), p = me((t) => {
|
|
1159
|
+
if (!o) return on(t, (e) => (f || {})[e]);
|
|
1160
|
+
let n = d.indexOf(t);
|
|
1161
|
+
return n >= 0 ? String(f ?? "")[n] === "1" : on(t, (t) => (e.getFieldsValue() || {})[t]);
|
|
1162
|
+
}, [
|
|
1163
|
+
f,
|
|
1164
|
+
o,
|
|
1165
|
+
d,
|
|
1166
|
+
e
|
|
1167
|
+
]), m = me((t) => {
|
|
1168
|
+
if (!Array.isArray(t) || t.length === 0) return !1;
|
|
1169
|
+
let n = $t(e, t.filter((e) => !e.addRow)), r = Object.keys(n).length > 0;
|
|
1170
|
+
return t.forEach((t) => {
|
|
1171
|
+
if (!t.addRow || !Array.isArray(t.rows) || t.rows.length === 0) return;
|
|
1172
|
+
let n = Qt(t);
|
|
1173
|
+
if (n.length === 0) return;
|
|
1174
|
+
r = !0;
|
|
1175
|
+
let i = () => e.setFieldsValue({ [t.name]: n }), a = (e.getFieldValue(t.name) || []).filter(V);
|
|
1176
|
+
if (a.length) {
|
|
1177
|
+
let e = t.label || t.name;
|
|
1178
|
+
L({
|
|
1179
|
+
tone: "overwrite",
|
|
1180
|
+
title: `Replace what's in ${e}?`,
|
|
1181
|
+
facts: [
|
|
1182
|
+
{
|
|
1183
|
+
label: "Section",
|
|
1184
|
+
value: e
|
|
1185
|
+
},
|
|
1186
|
+
{
|
|
1187
|
+
label: "Rows you filled in",
|
|
1188
|
+
value: a.length
|
|
1189
|
+
},
|
|
1190
|
+
{
|
|
1191
|
+
label: "Rows in the file",
|
|
1192
|
+
value: n.length
|
|
1193
|
+
}
|
|
1194
|
+
],
|
|
1195
|
+
body: `Everything currently in ${e} will be removed and replaced with what the file says. The rest of the form is not affected.`,
|
|
1196
|
+
okText: "Replace them",
|
|
1197
|
+
cancelText: "Keep mine",
|
|
1198
|
+
danger: !0
|
|
1199
|
+
}).then((e) => {
|
|
1200
|
+
e && i();
|
|
1201
|
+
});
|
|
1202
|
+
} else i();
|
|
1203
|
+
}), r;
|
|
1204
|
+
}, [e]);
|
|
1205
|
+
return {
|
|
1206
|
+
runAction: me(async (t, o, s, l) => {
|
|
1207
|
+
let d = s?.confirmWhen ?? "never";
|
|
1208
|
+
if (s?.trigger === "upload" && d !== "never" && (d === "always" || un(e, [o?.field], { includeUntouched: a }))) {
|
|
1209
|
+
let t = s.confirmMessages ?? {}, n = l?.name || e.getFieldValue(o?.field)?.slice?.(-1)?.[0]?.name, r = ln(e, [o?.field], { includeUntouched: a });
|
|
1210
|
+
if (!await L({
|
|
1211
|
+
tone: "overwrite",
|
|
1212
|
+
title: t.title || "Read this file and fill the form in?",
|
|
1213
|
+
facts: [{
|
|
1214
|
+
label: "File",
|
|
1215
|
+
value: n
|
|
1216
|
+
}, {
|
|
1217
|
+
label: "You have filled in",
|
|
1218
|
+
value: r ? `${r} ${r === 1 ? "answer" : "answers"}` : void 0
|
|
1219
|
+
}],
|
|
1220
|
+
body: t.body || "We can read the details out of this file and fill the form in for you. Where the file has an answer, it replaces what is currently in that box. Anything the file does not mention is left as you typed it.",
|
|
1221
|
+
okText: t.ok || "Read it and fill in",
|
|
1222
|
+
cancelText: t.cancel || "Keep what I typed"
|
|
1223
|
+
})) return;
|
|
1224
|
+
}
|
|
1225
|
+
c(s.key), u(s.loadingText || `Reading ${s.label || "the file"}…`);
|
|
1226
|
+
try {
|
|
1227
|
+
let a = {}, c = {};
|
|
1228
|
+
(s.inputs || []).forEach((t) => {
|
|
1229
|
+
if (t.kind === "file") {
|
|
1230
|
+
let n = e.getFieldValue(t.sourceField), r = l ?? n?.[n.length - 1]?.originFileObj;
|
|
1231
|
+
r && (c[t.param] = r);
|
|
1232
|
+
} else {
|
|
1233
|
+
let n = e.getFieldValue(t.sourceField);
|
|
1234
|
+
n != null && n !== "" && (a[t.param] = tn(n, t.transform));
|
|
1235
|
+
}
|
|
1236
|
+
}), (s.inputs || []).forEach((e) => {
|
|
1237
|
+
!e.group || e.kind !== "text" || (s.inputs || []).some((t) => t.group === e.group && t.kind === "file" && c[t.param]) && delete a[e.param];
|
|
1238
|
+
});
|
|
1239
|
+
let u = await Gt({
|
|
1240
|
+
module: n,
|
|
1241
|
+
group: t,
|
|
1242
|
+
field: o.field,
|
|
1243
|
+
actionKey: s.key,
|
|
1244
|
+
inputs: a,
|
|
1245
|
+
files: c
|
|
1246
|
+
}), d = s.label || "AI action", f = u?.groups;
|
|
1247
|
+
if (s?.trigger !== "upload" && fn(s, e, f)) {
|
|
1248
|
+
let e = s.confirmMessages ?? {}, t = sn(f).length;
|
|
1249
|
+
if (!await L({
|
|
1250
|
+
tone: "overwrite",
|
|
1251
|
+
title: e.title || `Fill the form in from ${d}?`,
|
|
1252
|
+
facts: [{
|
|
1253
|
+
label: "Source",
|
|
1254
|
+
value: d
|
|
1255
|
+
}, {
|
|
1256
|
+
label: "Boxes it would fill",
|
|
1257
|
+
value: t || void 0
|
|
1258
|
+
}],
|
|
1259
|
+
body: e.body || "We found details you can use. Applying them will replace what you have already entered in those boxes.",
|
|
1260
|
+
okText: e.ok || "Use these details",
|
|
1261
|
+
cancelText: e.cancel || "Keep what I typed"
|
|
1262
|
+
})) return E.info(`${d} cancelled — your entries were kept.`), u;
|
|
1263
|
+
}
|
|
1264
|
+
if (i) {
|
|
1265
|
+
let e = await i({
|
|
1266
|
+
action: s,
|
|
1267
|
+
field: o,
|
|
1268
|
+
groupName: t,
|
|
1269
|
+
responseGroups: f,
|
|
1270
|
+
payload: dn(f)
|
|
1271
|
+
});
|
|
1272
|
+
if (e === !1 || e === "abort") return u;
|
|
1273
|
+
}
|
|
1274
|
+
let p = m(f);
|
|
1275
|
+
return p ? E.success(`${d} completed successfully.`) : E.info(`${d} completed, but no matching details were found.`), p && r && await r({
|
|
1276
|
+
action: s,
|
|
1277
|
+
field: o,
|
|
1278
|
+
groupName: t
|
|
1279
|
+
}), u;
|
|
1280
|
+
} catch (e) {
|
|
1281
|
+
E.error(e?.message || `${s.label || "AI action"} failed`);
|
|
1282
|
+
return;
|
|
1283
|
+
} finally {
|
|
1284
|
+
c(null), u("");
|
|
1285
|
+
}
|
|
1286
|
+
}, [
|
|
1287
|
+
e,
|
|
1288
|
+
n,
|
|
1289
|
+
m,
|
|
1290
|
+
r,
|
|
1291
|
+
i,
|
|
1292
|
+
a
|
|
1293
|
+
]),
|
|
1294
|
+
loadingKey: s,
|
|
1295
|
+
loadingText: l,
|
|
1296
|
+
busy: s !== null,
|
|
1297
|
+
isActionEnabled: p
|
|
1298
|
+
};
|
|
1299
|
+
}
|
|
1300
|
+
//#endregion
|
|
1301
|
+
//#region src/components/form/AiActionButtons.jsx
|
|
1302
|
+
function _n({ position: e, actions: t, aiActions: n, groupName: r, field: i }) {
|
|
1303
|
+
if (!t || t.length === 0) return null;
|
|
1304
|
+
let a = e.endsWith("center") ? "center" : e.endsWith("right") ? "flex-end" : "flex-start";
|
|
1305
|
+
return /* @__PURE__ */ O(Ce, {
|
|
1306
|
+
size: 8,
|
|
1307
|
+
className: "v1-ai-action-buttons",
|
|
1308
|
+
style: {
|
|
1309
|
+
width: "100%",
|
|
1310
|
+
justifyContent: a
|
|
1311
|
+
},
|
|
1312
|
+
children: t.map((e) => /* @__PURE__ */ O(be, {
|
|
1313
|
+
size: "small",
|
|
1314
|
+
loading: n.loadingKey === e.key,
|
|
1315
|
+
disabled: n.busy || !n.isActionEnabled(e),
|
|
1316
|
+
onClick: () => n.runAction(r, i, e),
|
|
1317
|
+
children: e.label
|
|
1318
|
+
}, e.key))
|
|
1319
|
+
});
|
|
1320
|
+
}
|
|
1321
|
+
//#endregion
|
|
1322
|
+
//#region src/components/form/emailValidator.js
|
|
1323
|
+
function vn(e) {
|
|
1324
|
+
let t = String(e ?? "").trim(), n = /^([^\s@]+)@([^\s@]+)\.([A-Za-z]{2,})$/.exec(t);
|
|
1325
|
+
if (!n) return !1;
|
|
1326
|
+
let [, r, i] = n;
|
|
1327
|
+
return /[A-Za-z]/.test(r) && /[A-Za-z]/.test(i);
|
|
1328
|
+
}
|
|
1329
|
+
function yn(e = "Email", t) {
|
|
1330
|
+
return { validator: (n, r) => r == null || r === "" || vn(r) ? Promise.resolve() : Promise.reject(Error(t ?? `Enter a valid ${e}; numeric-only email addresses are not allowed`)) };
|
|
1331
|
+
}
|
|
1332
|
+
//#endregion
|
|
1333
|
+
//#region src/components/form/inputValidator.js
|
|
1334
|
+
var bn = [
|
|
1335
|
+
{
|
|
1336
|
+
label: "Only Numbers",
|
|
1337
|
+
value: "onlyNumber"
|
|
1338
|
+
},
|
|
1339
|
+
{
|
|
1340
|
+
label: "Only Letters",
|
|
1341
|
+
value: "onlyLetter"
|
|
1342
|
+
},
|
|
1343
|
+
{
|
|
1344
|
+
label: "Only Letters & Spaces",
|
|
1345
|
+
value: "onlyLettersAndSpace"
|
|
1346
|
+
},
|
|
1347
|
+
{
|
|
1348
|
+
label: "Only Alphanumeric",
|
|
1349
|
+
value: "onlyAlphanumeric"
|
|
1350
|
+
},
|
|
1351
|
+
{
|
|
1352
|
+
label: "Alphanumeric & Spaces",
|
|
1353
|
+
value: "alphanumericSpace"
|
|
1354
|
+
},
|
|
1355
|
+
{
|
|
1356
|
+
label: "Letters, Numbers & Hyphen",
|
|
1357
|
+
value: "onlyLettersNumberAndHyphen"
|
|
1358
|
+
},
|
|
1359
|
+
{
|
|
1360
|
+
label: "Letters, Numbers, Hyphen & Dot",
|
|
1361
|
+
value: "onlyLettersNumberHyphenAndDot"
|
|
1362
|
+
},
|
|
1363
|
+
{
|
|
1364
|
+
label: "Contact Number (digits, (), -)",
|
|
1365
|
+
value: "contactNumber"
|
|
1366
|
+
},
|
|
1367
|
+
{
|
|
1368
|
+
label: "Email (reject numeric-only address)",
|
|
1369
|
+
value: "email"
|
|
1370
|
+
},
|
|
1371
|
+
{
|
|
1372
|
+
label: "Job Title (letters, nums, symbols)",
|
|
1373
|
+
value: "jobTitle"
|
|
1374
|
+
},
|
|
1375
|
+
{
|
|
1376
|
+
label: "MSP / Ref ID (alphanumeric only)",
|
|
1377
|
+
value: "mspRefId"
|
|
1378
|
+
},
|
|
1379
|
+
{
|
|
1380
|
+
label: "Location (letters, nums, , . -)",
|
|
1381
|
+
value: "locationValidation"
|
|
1382
|
+
},
|
|
1383
|
+
{
|
|
1384
|
+
label: "Decimal / Range (number + dot)",
|
|
1385
|
+
value: "decimalRange"
|
|
1386
|
+
},
|
|
1387
|
+
{
|
|
1388
|
+
label: "Budget (numbers, must be > 0)",
|
|
1389
|
+
value: "budgetValidation"
|
|
1390
|
+
},
|
|
1391
|
+
{
|
|
1392
|
+
label: "Experience (numbers only)",
|
|
1393
|
+
value: "experience"
|
|
1394
|
+
},
|
|
1395
|
+
{
|
|
1396
|
+
label: "Numeric — 2 digits max",
|
|
1397
|
+
value: "numericTwoDigits"
|
|
1398
|
+
},
|
|
1399
|
+
{
|
|
1400
|
+
label: "Job Description (character count)",
|
|
1401
|
+
value: "jobDescription"
|
|
1402
|
+
},
|
|
1403
|
+
{
|
|
1404
|
+
label: "Website URL",
|
|
1405
|
+
value: "websiteUrl"
|
|
1406
|
+
}
|
|
1407
|
+
], xn = {
|
|
1408
|
+
onlyNumber: /^[0-9]$/,
|
|
1409
|
+
experience: /^[0-9]$/,
|
|
1410
|
+
numericTwoDigits: /^[0-9]$/,
|
|
1411
|
+
budgetValidation: /^[0-9]$/,
|
|
1412
|
+
onlyLetter: /^[a-zA-Z\s]$/,
|
|
1413
|
+
onlyLettersAndSpace: /^[a-zA-Z\s]$/,
|
|
1414
|
+
onlyAlphanumeric: /^[a-zA-Z0-9]$/,
|
|
1415
|
+
alphanumericSpace: /^[a-zA-Z0-9\s]$/,
|
|
1416
|
+
mspRefId: /^[a-zA-Z0-9]$/,
|
|
1417
|
+
onlyLettersNumberAndHyphen: /^[a-zA-Z0-9\s-]$/,
|
|
1418
|
+
locationValidation: /^[a-zA-Z0-9\s\-.,]$/,
|
|
1419
|
+
jobTitle: /^[a-zA-Z0-9\s\-.,/&+()*'"#@]$/,
|
|
1420
|
+
decimalRange: /^[0-9.]$/,
|
|
1421
|
+
contactNumber: /^[0-9()\-+\s]$/
|
|
1422
|
+
};
|
|
1423
|
+
function Sn(e) {
|
|
1424
|
+
return xn[e] ?? null;
|
|
1425
|
+
}
|
|
1426
|
+
function Cn(e, t = {}, n = "change") {
|
|
1427
|
+
if (!t?.type || e == null) return {
|
|
1428
|
+
cleaned: e ?? "",
|
|
1429
|
+
error: null
|
|
1430
|
+
};
|
|
1431
|
+
let r = String(e), { type: i, maxLength: a, maxChars: o } = t, s = t.title || "Field", c, l = null, u = (e) => n === "blur" ? e.trim() : e.replace(/^\s+/, "");
|
|
1432
|
+
switch (i) {
|
|
1433
|
+
case "onlyNumber":
|
|
1434
|
+
case "experience":
|
|
1435
|
+
case "numericTwoDigits": {
|
|
1436
|
+
let e = Number(a ?? (i === "numericTwoDigits" ? 2 : 10));
|
|
1437
|
+
c = r.replace(/[^0-9]/g, ""), r !== c && (l = `${s} allows only numbers.`), c.length > e && (l = `${s} cannot exceed ${e} characters.`, c = c.slice(0, e));
|
|
1438
|
+
break;
|
|
1439
|
+
}
|
|
1440
|
+
case "onlyLetter": {
|
|
1441
|
+
let e = Number(a ?? 50);
|
|
1442
|
+
c = r.replace(/[^a-zA-Z]/g, ""), r !== c && (l = `${s} allows only letters.`), c.length > e && (l = `${s} cannot exceed ${e} characters.`, c = c.slice(0, e));
|
|
1443
|
+
break;
|
|
1444
|
+
}
|
|
1445
|
+
case "onlyLettersAndSpace": {
|
|
1446
|
+
let e = Number(a ?? 55);
|
|
1447
|
+
c = u(r.replace(/[^a-zA-Z\s]/g, "")), r.replace(/^\s+/, "") !== c && (l = `${s} allows only letters and spaces.`), c.length > e && (l = `${s} cannot exceed ${e} characters.`, c = c.slice(0, e));
|
|
1448
|
+
break;
|
|
1449
|
+
}
|
|
1450
|
+
case "onlyAlphanumeric":
|
|
1451
|
+
case "mspRefId": {
|
|
1452
|
+
let e = Number(a ?? 50);
|
|
1453
|
+
c = u(r.replace(/[^a-zA-Z0-9]/g, "")), r.replace(/^\s+/, "") !== c && (l = `${s} allows only letters and numbers.`), c.length > e && (l = `${s} cannot exceed ${e} characters.`, c = c.slice(0, e));
|
|
1454
|
+
break;
|
|
1455
|
+
}
|
|
1456
|
+
case "alphanumericSpace": {
|
|
1457
|
+
let e = Number(a ?? 100);
|
|
1458
|
+
c = u(r.replace(/[^a-zA-Z0-9\s]/g, "")), r.replace(/^\s+/, "") !== c && (l = `${s} allows only letters, numbers and spaces.`), c.length > e && (l = `${s} cannot exceed ${e} characters.`, c = c.slice(0, e));
|
|
1459
|
+
break;
|
|
1460
|
+
}
|
|
1461
|
+
case "onlyLettersNumberAndHyphen": {
|
|
1462
|
+
let e = Number(a ?? 55);
|
|
1463
|
+
c = u(r.replace(/[^a-zA-Z0-9\s-]/g, "")), r.replace(/^\s+/, "") !== c && (l = `${s} allows only letters, numbers and hyphens.`), c.length > e && (l = `${s} cannot exceed ${e} characters.`, c = c.slice(0, e));
|
|
1464
|
+
break;
|
|
1465
|
+
}
|
|
1466
|
+
case "onlyLettersNumberHyphenAndDot": {
|
|
1467
|
+
let e = Number(a ?? 100);
|
|
1468
|
+
c = r.replace(/[^a-zA-Z0-9\-./#+[\]{}()\s]/g, "").slice(0, e), r !== c && (l = `${s} allows only letters, numbers, hyphens and dots.`);
|
|
1469
|
+
break;
|
|
1470
|
+
}
|
|
1471
|
+
case "contactNumber": {
|
|
1472
|
+
let e = Number(a ?? 15);
|
|
1473
|
+
c = r.replace(/[^0-9()\-+\s]/g, "").slice(0, e), r === c ? c && !/^(\+?[0-9]{1,3}[- ]?)?(\(?\d{1,4}\)?[- ]?)?[\d\-\s]{3,15}$/.test(c) && (l = `${s} is not a valid phone number format.`) : l = `${s} allows only digits, parentheses () and hyphens.`;
|
|
1474
|
+
break;
|
|
1475
|
+
}
|
|
1476
|
+
case "locationValidation": {
|
|
1477
|
+
let e = Number(a ?? 100);
|
|
1478
|
+
c = u(r.replace(/[^a-zA-Z0-9\s\-.,]/g, "")), r.replace(/^\s+/, "") !== c && (l = `${s} allows only letters, numbers, spaces, commas, dots and hyphens.`), c.length > e && (l = `${s} cannot exceed ${e} characters.`, c = c.slice(0, e));
|
|
1479
|
+
break;
|
|
1480
|
+
}
|
|
1481
|
+
case "jobTitle": {
|
|
1482
|
+
let e = Number(a ?? 80);
|
|
1483
|
+
c = u(r.replace(/[^a-zA-Z0-9\s\-/&.,()+#@'"*]/g, "")), r.replace(/^\s+/, "") !== c && (l = `${s} allows only letters, numbers, spaces and common symbols.`), c.length > e && (l = `${s} cannot exceed ${e} characters.`, c = c.slice(0, e));
|
|
1484
|
+
break;
|
|
1485
|
+
}
|
|
1486
|
+
case "decimalRange": {
|
|
1487
|
+
let e = r.replace(/[^0-9.]/g, "");
|
|
1488
|
+
if ((e.match(/\./g) || []).length > 1) {
|
|
1489
|
+
let t = e.indexOf(".");
|
|
1490
|
+
e = e.slice(0, t + 1) + e.slice(t + 1).replace(/\./g, ""), l = `${s} can have only one decimal point.`;
|
|
1491
|
+
}
|
|
1492
|
+
let t = e.replace(/\./g, ""), n = Number(a ?? 10);
|
|
1493
|
+
t.length > n && (e = e.slice(0, n + +!!e.includes(".")), l = `${s} cannot exceed ${n} digits.`), c = e, !l && r !== c && (l = `${s} allows only numbers and one dot.`);
|
|
1494
|
+
break;
|
|
1495
|
+
}
|
|
1496
|
+
case "budgetValidation": {
|
|
1497
|
+
let e = Number(a ?? 10);
|
|
1498
|
+
c = r.replace(/[^0-9]/g, "").slice(0, e);
|
|
1499
|
+
let t = Number(c);
|
|
1500
|
+
r === c ? c && t <= 0 && (l = `${s} must be greater than 0.`) : l = `${s} allows only numbers.`;
|
|
1501
|
+
break;
|
|
1502
|
+
}
|
|
1503
|
+
case "jobDescription": {
|
|
1504
|
+
let e = Number(o ?? a ?? 1500);
|
|
1505
|
+
r.replace(/<[^>]+>/g, " ").replace(/ /g, " ").replace(/\s+/g, " ").trim().length > e && (l = `${s} cannot exceed ${e} characters.`), c = r;
|
|
1506
|
+
break;
|
|
1507
|
+
}
|
|
1508
|
+
case "email":
|
|
1509
|
+
c = n === "blur" ? r.trim() : r, c && !vn(c) && (l = `${s} must be a valid email address; numeric-only email addresses are not allowed.`);
|
|
1510
|
+
break;
|
|
1511
|
+
case "websiteUrl":
|
|
1512
|
+
c = n === "blur" ? r.trim() : r, c && !/^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)*\/?$/i.test(c) && (l = `${s} must be a valid URL.`);
|
|
1513
|
+
break;
|
|
1514
|
+
default: c = r;
|
|
1515
|
+
}
|
|
1516
|
+
return {
|
|
1517
|
+
cleaned: c,
|
|
1518
|
+
error: l
|
|
1519
|
+
};
|
|
1520
|
+
}
|
|
1521
|
+
var U = "This value is already present";
|
|
1522
|
+
function wn(e) {
|
|
1523
|
+
return typeof e == "string" ? e : e?.type ?? e?.rule ?? e?.name;
|
|
1524
|
+
}
|
|
1525
|
+
function Tn(e) {
|
|
1526
|
+
if (wn(e) !== "unique") return null;
|
|
1527
|
+
if (typeof e == "string") return {
|
|
1528
|
+
message: U,
|
|
1529
|
+
normalizer: "trim",
|
|
1530
|
+
skipBlank: !0,
|
|
1531
|
+
validateOn: "blur"
|
|
1532
|
+
};
|
|
1533
|
+
let t = e.value && typeof e.value == "object" ? e.value : e, n = String(t.validateOn ?? "blur").toLowerCase();
|
|
1534
|
+
return {
|
|
1535
|
+
message: typeof e.message == "string" && e.message.trim() ? e.message.trim() : U,
|
|
1536
|
+
collectionField: t.collectionField ?? "",
|
|
1537
|
+
normalizer: String(t.normalizer ?? "trim"),
|
|
1538
|
+
skipBlank: t.skipBlank !== !1,
|
|
1539
|
+
validateOn: [
|
|
1540
|
+
"blur",
|
|
1541
|
+
"change",
|
|
1542
|
+
"submit"
|
|
1543
|
+
].includes(n) ? n : "blur"
|
|
1544
|
+
};
|
|
1545
|
+
}
|
|
1546
|
+
function En(e) {
|
|
1547
|
+
let t = e?.validations ?? e?.validation ?? e?.rules ?? [];
|
|
1548
|
+
if (!Array.isArray(t)) return null;
|
|
1549
|
+
for (let e of t) {
|
|
1550
|
+
let t = Tn(e);
|
|
1551
|
+
if (t) return t;
|
|
1552
|
+
}
|
|
1553
|
+
return null;
|
|
1554
|
+
}
|
|
1555
|
+
function Dn(e = []) {
|
|
1556
|
+
let t = [];
|
|
1557
|
+
return (Array.isArray(e) ? e : []).forEach((e) => {
|
|
1558
|
+
(e?.fields ?? []).forEach((e) => {
|
|
1559
|
+
let n = En(e);
|
|
1560
|
+
!n || !e?.field || t.push({
|
|
1561
|
+
field: e.field,
|
|
1562
|
+
label: e.label ?? e.field,
|
|
1563
|
+
rule: n
|
|
1564
|
+
});
|
|
1565
|
+
});
|
|
1566
|
+
}), t;
|
|
1567
|
+
}
|
|
1568
|
+
function On(e) {
|
|
1569
|
+
return e == null ? !0 : typeof e == "number" ? Number.isNaN(e) : typeof e == "boolean" ? !1 : Array.isArray(e) ? e.length === 0 : String(e).trim() === "";
|
|
1570
|
+
}
|
|
1571
|
+
function kn(e, t = "trim") {
|
|
1572
|
+
if (e == null) return "";
|
|
1573
|
+
let n = String(e);
|
|
1574
|
+
switch (String(t)) {
|
|
1575
|
+
case "exact": return n;
|
|
1576
|
+
case "lower":
|
|
1577
|
+
case "trimLower":
|
|
1578
|
+
case "email": return n.trim().toLowerCase();
|
|
1579
|
+
case "digitsOnly": return n.replace(/\D+/g, "");
|
|
1580
|
+
default: return n.trim();
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
function An(e, t) {
|
|
1584
|
+
return !(!e || e.skipBlank !== !1 && On(t));
|
|
1585
|
+
}
|
|
1586
|
+
function jn(e) {
|
|
1587
|
+
return !e || e.validateOn === "submit" ? [] : e.validateOn === "change" ? ["onChange", "onBlur"] : ["onBlur"];
|
|
1588
|
+
}
|
|
1589
|
+
var W = {
|
|
1590
|
+
SKIPPED: "skipped",
|
|
1591
|
+
AVAILABLE: "available",
|
|
1592
|
+
DUPLICATE: "duplicate",
|
|
1593
|
+
STALE: "stale",
|
|
1594
|
+
ERROR: "error"
|
|
1595
|
+
};
|
|
1596
|
+
function Mn({ module: e, field: t, recordId: n, normalized: r }) {
|
|
1597
|
+
return `${e}${t}${n ?? ""}${r}`;
|
|
1598
|
+
}
|
|
1599
|
+
function Nn({ checkFieldUnique: e, onPendingChange: t } = {}) {
|
|
1600
|
+
let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = 0, a = 0;
|
|
1601
|
+
function o(e) {
|
|
1602
|
+
a = e, typeof t == "function" && t(a);
|
|
1603
|
+
}
|
|
1604
|
+
async function s({ module: t, field: s, rule: c, value: l, recordId: u, clientId: d, region: f } = {}) {
|
|
1605
|
+
if (!c || !t || !s || typeof e != "function" || !An(c, l)) return { status: W.SKIPPED };
|
|
1606
|
+
let p = Mn({
|
|
1607
|
+
module: t,
|
|
1608
|
+
field: s,
|
|
1609
|
+
recordId: u,
|
|
1610
|
+
normalized: kn(l, c.normalizer)
|
|
1611
|
+
});
|
|
1612
|
+
if (n.has(p)) return n.get(p);
|
|
1613
|
+
i += 1;
|
|
1614
|
+
let m = i;
|
|
1615
|
+
r.set(s, m), o(a + 1);
|
|
1616
|
+
try {
|
|
1617
|
+
let i = await e({
|
|
1618
|
+
module: t,
|
|
1619
|
+
field: s,
|
|
1620
|
+
value: l,
|
|
1621
|
+
recordId: u,
|
|
1622
|
+
clientId: d,
|
|
1623
|
+
region: f
|
|
1624
|
+
});
|
|
1625
|
+
if (r.get(s) !== m) return { status: W.STALE };
|
|
1626
|
+
let a = i?.available === !1 ? {
|
|
1627
|
+
status: W.DUPLICATE,
|
|
1628
|
+
message: Pn(i) || c.message || U
|
|
1629
|
+
} : { status: W.AVAILABLE };
|
|
1630
|
+
return n.set(p, a), a;
|
|
1631
|
+
} catch (e) {
|
|
1632
|
+
return r.get(s) === m ? {
|
|
1633
|
+
status: W.ERROR,
|
|
1634
|
+
error: e
|
|
1635
|
+
} : { status: W.STALE };
|
|
1636
|
+
} finally {
|
|
1637
|
+
o(Math.max(0, a - 1));
|
|
1638
|
+
}
|
|
1639
|
+
}
|
|
1640
|
+
return {
|
|
1641
|
+
check: s,
|
|
1642
|
+
isPending: () => a > 0,
|
|
1643
|
+
pendingCount: () => a,
|
|
1644
|
+
reset: () => {
|
|
1645
|
+
n.clear(), r.clear();
|
|
1646
|
+
}
|
|
1647
|
+
};
|
|
1648
|
+
}
|
|
1649
|
+
function Pn(e) {
|
|
1650
|
+
return (e?.errors ?? []).find((e) => e?.message)?.message || e?.message || "";
|
|
1651
|
+
}
|
|
1652
|
+
var Fn = "__uniqueRule";
|
|
1653
|
+
function In({ field: e, validation: t, context: n }) {
|
|
1654
|
+
let r = Tn(t);
|
|
1655
|
+
if (!r) return { validator: () => Promise.resolve() };
|
|
1656
|
+
let i = e?.field ?? "";
|
|
1657
|
+
return !n?.checker || !n?.module || !i ? { validator: () => Promise.resolve() } : {
|
|
1658
|
+
[Fn]: r,
|
|
1659
|
+
validateTrigger: jn(r),
|
|
1660
|
+
validator: async (e, t) => {
|
|
1661
|
+
let a = await n.checker.check({
|
|
1662
|
+
module: n.module,
|
|
1663
|
+
field: i,
|
|
1664
|
+
rule: r,
|
|
1665
|
+
value: t,
|
|
1666
|
+
recordId: n.recordId,
|
|
1667
|
+
clientId: n.clientId,
|
|
1668
|
+
region: n.region
|
|
1669
|
+
});
|
|
1670
|
+
return a.status === W.DUPLICATE ? Promise.reject(Error(a.message || r.message)) : Promise.resolve();
|
|
1671
|
+
}
|
|
1672
|
+
};
|
|
1673
|
+
}
|
|
1674
|
+
function Ln(e = []) {
|
|
1675
|
+
let t = Array.isArray(e) ? e : [];
|
|
1676
|
+
if (!t.some((e) => e && e[Fn])) return t;
|
|
1677
|
+
let n = t.filter((e) => e && !e[Fn] && !e.warningOnly);
|
|
1678
|
+
return t.map((e) => {
|
|
1679
|
+
if (!e || !e[Fn]) return e;
|
|
1680
|
+
let t = e.validator;
|
|
1681
|
+
return {
|
|
1682
|
+
...e,
|
|
1683
|
+
validator: async (e, r) => await Rn(n, r, e) ? Promise.resolve() : t(e, r)
|
|
1684
|
+
};
|
|
1685
|
+
});
|
|
1686
|
+
}
|
|
1687
|
+
async function Rn(e = [], t, n = {}) {
|
|
1688
|
+
for (let r of e) if (!(!r || typeof r == "string")) {
|
|
1689
|
+
if (r.required && On(t) || !On(t) && (r.pattern instanceof RegExp && !new RegExp(r.pattern.source, r.pattern.flags).test(String(t)) || r.len != null && String(t).length !== Number(r.len))) return !0;
|
|
1690
|
+
if (typeof r.validator == "function") try {
|
|
1691
|
+
await r.validator(n, t);
|
|
1692
|
+
} catch {
|
|
1693
|
+
return !0;
|
|
1694
|
+
}
|
|
1695
|
+
}
|
|
1696
|
+
return !1;
|
|
1697
|
+
}
|
|
1698
|
+
function zn(e) {
|
|
1699
|
+
let t = String(e ?? "").trim();
|
|
1700
|
+
if (!t.startsWith("{")) return null;
|
|
1701
|
+
try {
|
|
1702
|
+
return JSON.parse(t);
|
|
1703
|
+
} catch {
|
|
1704
|
+
return null;
|
|
1705
|
+
}
|
|
1706
|
+
}
|
|
1707
|
+
function Bn(e) {
|
|
1708
|
+
if (!e) return null;
|
|
1709
|
+
if (typeof e == "string") return zn(e);
|
|
1710
|
+
let t = [
|
|
1711
|
+
e.data,
|
|
1712
|
+
e.response,
|
|
1713
|
+
e,
|
|
1714
|
+
zn(e.message)
|
|
1715
|
+
];
|
|
1716
|
+
for (let e of t) if (!(!e || typeof e != "object") && (Array.isArray(e.errors) || e.code === "DUPLICATE_VALUE")) return e;
|
|
1717
|
+
return null;
|
|
1718
|
+
}
|
|
1719
|
+
function Vn({ field: e, group: t, rowIndex: n }) {
|
|
1720
|
+
let r = String(e ?? ""), i = Number(n);
|
|
1721
|
+
return t && Number.isInteger(i) && i >= 0 ? [
|
|
1722
|
+
String(t),
|
|
1723
|
+
i,
|
|
1724
|
+
...r.split(".")
|
|
1725
|
+
] : r;
|
|
1726
|
+
}
|
|
1727
|
+
function Hn(e, { uniqueRules: t = [] } = {}) {
|
|
1728
|
+
let n = Bn(e);
|
|
1729
|
+
if (n) {
|
|
1730
|
+
let e = (Array.isArray(n.errors) ? n.errors : []).filter((e) => e?.field).map((e) => {
|
|
1731
|
+
let t = {
|
|
1732
|
+
field: e.field,
|
|
1733
|
+
name: Vn(e),
|
|
1734
|
+
message: e.message || n.message || U
|
|
1735
|
+
};
|
|
1736
|
+
return Array.isArray(t.name) && (t.group = String(e.group), t.rowIndex = Number(e.rowIndex)), t;
|
|
1737
|
+
});
|
|
1738
|
+
if (e.length) return e;
|
|
1739
|
+
}
|
|
1740
|
+
let r = String((n && (n.message || n.error)) ?? (typeof e == "string" ? e : e?.message) ?? "").trim();
|
|
1741
|
+
if (!r) return [];
|
|
1742
|
+
let i = e?.status === 409 || n?.code === "DUPLICATE_VALUE", a = t.filter((e) => String(e?.rule?.message ?? "").trim().toLowerCase() === r.toLowerCase());
|
|
1743
|
+
return a.length && (i || a.length === 1) ? a.map((e) => ({
|
|
1744
|
+
field: e.field,
|
|
1745
|
+
name: e.field,
|
|
1746
|
+
message: r
|
|
1747
|
+
})) : [];
|
|
1748
|
+
}
|
|
1749
|
+
//#endregion
|
|
1750
|
+
//#region src/components/form/patternRule.js
|
|
1751
|
+
var Un = (e) => e === !0 || e === 1 || e === "1" || typeof e == "string" && e.trim().toLowerCase() === "true";
|
|
1752
|
+
function Wn(e) {
|
|
1753
|
+
return !!(e && typeof e == "object" && Un(e.warningOnly));
|
|
1754
|
+
}
|
|
1755
|
+
function Gn({ label: e, message: t, rule: n }) {
|
|
1756
|
+
let r = {
|
|
1757
|
+
pattern: new RegExp(n.pattern ?? n.value, n.flags),
|
|
1758
|
+
message: t ?? `Enter valid ${e}`
|
|
1759
|
+
};
|
|
1760
|
+
return Wn(n) && (r.warningOnly = !0), r;
|
|
1761
|
+
}
|
|
1762
|
+
function Kn(e) {
|
|
1763
|
+
return Wn(e);
|
|
1764
|
+
}
|
|
1765
|
+
function qn(e, t) {
|
|
1766
|
+
return e?.type === "pattern" && t?.warningOnly === !0 && (e.warningOnly = !0), e;
|
|
1767
|
+
}
|
|
1768
|
+
function Jn(e) {
|
|
1769
|
+
return typeof e == "string" ? e.toUpperCase() : e;
|
|
1770
|
+
}
|
|
1771
|
+
//#endregion
|
|
1772
|
+
//#region src/services/uniqueValidationApi.js
|
|
1773
|
+
async function Yn({ module: e, field: t, value: n, recordId: i, clientId: a, region: s } = {}) {
|
|
1774
|
+
if (!e || !t) throw Error("module and field are required to check uniqueness");
|
|
1775
|
+
let c = {
|
|
1776
|
+
field: t,
|
|
1777
|
+
value: n ?? ""
|
|
1778
|
+
};
|
|
1779
|
+
i && (c.recordId = String(i)), a && (c.clientId = String(a)), s && (c.region = String(s));
|
|
1780
|
+
try {
|
|
1781
|
+
let t = await o(r, `/module/validate-unique?module=${encodeURIComponent(e)}`, {
|
|
1782
|
+
method: "POST",
|
|
1783
|
+
headers: { "Content-Type": "application/json" },
|
|
1784
|
+
body: JSON.stringify(c)
|
|
1785
|
+
}), n = t?.available !== !1;
|
|
1786
|
+
return {
|
|
1787
|
+
available: n,
|
|
1788
|
+
duplicate: !n,
|
|
1789
|
+
message: t?.message ?? "",
|
|
1790
|
+
errors: Array.isArray(t?.errors) ? t.errors : [],
|
|
1791
|
+
response: t
|
|
1792
|
+
};
|
|
1793
|
+
} catch (e) {
|
|
1794
|
+
if (e?.status === 409) {
|
|
1795
|
+
let t = e.response ?? e.data ?? {};
|
|
1796
|
+
return {
|
|
1797
|
+
available: !1,
|
|
1798
|
+
duplicate: !0,
|
|
1799
|
+
message: t?.message ?? e.message ?? "",
|
|
1800
|
+
errors: Array.isArray(t?.errors) ? t.errors : [],
|
|
1801
|
+
response: t
|
|
1802
|
+
};
|
|
1803
|
+
}
|
|
1804
|
+
throw e;
|
|
1805
|
+
}
|
|
1806
|
+
}
|
|
1807
|
+
async function Xn({ module: e, payload: t, excludeId: n } = {}) {
|
|
1808
|
+
if (!e || !t) return { duplicate: !1 };
|
|
1809
|
+
try {
|
|
1810
|
+
let i = await o(r, `/module/duplicate-check?module=${encodeURIComponent(e)}`, {
|
|
1811
|
+
method: "POST",
|
|
1812
|
+
headers: { "Content-Type": "application/json" },
|
|
1813
|
+
body: JSON.stringify({
|
|
1814
|
+
payload: t,
|
|
1815
|
+
...n ? { excludeId: n } : {}
|
|
1816
|
+
})
|
|
1817
|
+
});
|
|
1818
|
+
return i?.data ?? i ?? { duplicate: !1 };
|
|
1819
|
+
} catch {
|
|
1820
|
+
return { duplicate: !1 };
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1823
|
+
//#endregion
|
|
1824
|
+
//#region src/components/form/uploadAccept.js
|
|
1825
|
+
var Zn = [
|
|
1826
|
+
"jpg",
|
|
1827
|
+
"jpeg",
|
|
1828
|
+
"png",
|
|
1829
|
+
"gif",
|
|
1830
|
+
"webp",
|
|
1831
|
+
"bmp",
|
|
1832
|
+
"svg",
|
|
1833
|
+
"avif"
|
|
1834
|
+
], Qn = [
|
|
1835
|
+
"mp4",
|
|
1836
|
+
"webm",
|
|
1837
|
+
"ogg",
|
|
1838
|
+
"ogv",
|
|
1839
|
+
"mov",
|
|
1840
|
+
"m4v"
|
|
1841
|
+
], $n = [
|
|
1842
|
+
"pdf",
|
|
1843
|
+
"doc",
|
|
1844
|
+
"docx"
|
|
1845
|
+
], er = [
|
|
1846
|
+
{
|
|
1847
|
+
label: "Any file",
|
|
1848
|
+
value: "any"
|
|
1849
|
+
},
|
|
1850
|
+
{
|
|
1851
|
+
label: "Resume (pdf, doc, docx)",
|
|
1852
|
+
value: "resume"
|
|
1853
|
+
},
|
|
1854
|
+
{
|
|
1855
|
+
label: "Documents & Images (pdf, doc, images)",
|
|
1856
|
+
value: "documents"
|
|
1857
|
+
},
|
|
1858
|
+
{
|
|
1859
|
+
label: "Images only",
|
|
1860
|
+
value: "images"
|
|
1861
|
+
},
|
|
1862
|
+
{
|
|
1863
|
+
label: "Videos only",
|
|
1864
|
+
value: "videos"
|
|
1865
|
+
},
|
|
1866
|
+
{
|
|
1867
|
+
label: "Images & Videos",
|
|
1868
|
+
value: "imagesAndVideos"
|
|
1869
|
+
}
|
|
1870
|
+
], tr = {
|
|
1871
|
+
resume: {
|
|
1872
|
+
exts: $n,
|
|
1873
|
+
maxSizeMB: 2,
|
|
1874
|
+
hint: "PDF, DOC or DOCX",
|
|
1875
|
+
error: "Only PDF, DOC, and DOCX resume files are supported."
|
|
1876
|
+
},
|
|
1877
|
+
documents: {
|
|
1878
|
+
exts: [...$n, ...Zn],
|
|
1879
|
+
hint: "PDF, DOC or image files",
|
|
1880
|
+
error: "Only document (PDF/DOC) or image files are allowed"
|
|
1881
|
+
},
|
|
1882
|
+
images: {
|
|
1883
|
+
exts: Zn,
|
|
1884
|
+
hint: "Image files",
|
|
1885
|
+
error: "Only image files are allowed"
|
|
1886
|
+
},
|
|
1887
|
+
videos: {
|
|
1888
|
+
exts: Qn,
|
|
1889
|
+
hint: "Video files",
|
|
1890
|
+
error: "Only video files are allowed"
|
|
1891
|
+
},
|
|
1892
|
+
imagesAndVideos: {
|
|
1893
|
+
exts: [...Zn, ...Qn],
|
|
1894
|
+
hint: "Image or video files",
|
|
1895
|
+
error: "Only image or video files are allowed"
|
|
1896
|
+
}
|
|
1897
|
+
};
|
|
1898
|
+
function nr(e) {
|
|
1899
|
+
let t = String(e?.field ?? e?.payloadKey ?? "").toLowerCase();
|
|
1900
|
+
return t ? t.includes("resume") || t.includes("cv") || t.includes("curriculumvitae") : !1;
|
|
1901
|
+
}
|
|
1902
|
+
function rr(e) {
|
|
1903
|
+
let t = String(e?.accept ?? "").trim();
|
|
1904
|
+
return t && t !== "any" ? tr[t] ?? null : !t && nr(e) ? tr.resume : tr[t] ?? null;
|
|
1905
|
+
}
|
|
1906
|
+
//#endregion
|
|
1907
|
+
//#region src/components/form/quickActionLabels.js
|
|
1908
|
+
var ir = /* @__PURE__ */ new Set([
|
|
1909
|
+
"of",
|
|
1910
|
+
"and",
|
|
1911
|
+
"the",
|
|
1912
|
+
"to",
|
|
1913
|
+
"for",
|
|
1914
|
+
"in",
|
|
1915
|
+
"a",
|
|
1916
|
+
"an"
|
|
1917
|
+
]), ar = {
|
|
1918
|
+
addresses: "address",
|
|
1919
|
+
branches: "branch",
|
|
1920
|
+
batches: "batch",
|
|
1921
|
+
categories: "category",
|
|
1922
|
+
companies: "company",
|
|
1923
|
+
countries: "country",
|
|
1924
|
+
entries: "entry",
|
|
1925
|
+
people: "person",
|
|
1926
|
+
statuses: "status"
|
|
1927
|
+
};
|
|
1928
|
+
function or(e) {
|
|
1929
|
+
let t = String(e ?? "").trim();
|
|
1930
|
+
if (!t) return "";
|
|
1931
|
+
if (t.length > 1 && t === t.toUpperCase() && /[A-Z]/.test(t)) return t;
|
|
1932
|
+
let n = t.toLowerCase();
|
|
1933
|
+
return ar[n] ? ar[n] : /[^aeiou]ies$/i.test(t) ? t.slice(0, -3) + "y" : /(s|x|z|ch|sh)es$/i.test(t) ? t.slice(0, -2) : /[^s]s$/i.test(t) ? t.slice(0, -1) : t;
|
|
1934
|
+
}
|
|
1935
|
+
function G(e) {
|
|
1936
|
+
let t = String(e ?? "").trim();
|
|
1937
|
+
if (!t) return "";
|
|
1938
|
+
let n = t.replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_\-.]+/g, " ").split(/\s+/).filter(Boolean);
|
|
1939
|
+
if (!n.length) return "";
|
|
1940
|
+
let r = or(n[n.length - 1]);
|
|
1941
|
+
return [...n.slice(0, -1), r].map((e, t) => {
|
|
1942
|
+
let n = e.toLowerCase();
|
|
1943
|
+
return e.length > 1 && e === e.toUpperCase() ? e : t > 0 && ir.has(n) ? n : n.charAt(0).toUpperCase() + n.slice(1);
|
|
1944
|
+
}).join(" ");
|
|
1945
|
+
}
|
|
1946
|
+
function sr(e, t) {
|
|
1947
|
+
let n = String(e?.quickCreateLabel ?? "").trim();
|
|
1948
|
+
if (n && n.toLowerCase() !== "add more") return n;
|
|
1949
|
+
let r = G(e?.quickCreateModule || t);
|
|
1950
|
+
return r ? `Add New ${r}` : "Add New";
|
|
1951
|
+
}
|
|
1952
|
+
function cr(e, t) {
|
|
1953
|
+
let n = String(e?.quickEditLabel ?? "").trim();
|
|
1954
|
+
if (n && n.toLowerCase() !== "add more") return n;
|
|
1955
|
+
let r = G(e?.quickEditModule || t);
|
|
1956
|
+
return r ? `Edit ${r}` : "Edit";
|
|
1957
|
+
}
|
|
1958
|
+
function lr(e, t, n) {
|
|
1959
|
+
let r = G((e === "create" ? t?.quickCreateModule : t?.quickEditModule) || n);
|
|
1960
|
+
return e === "create" ? String(t?.quickCreateTitle ?? "").trim() || (r ? `Add New ${r}` : sr(t, n)) : String(t?.quickEditTitle ?? "").trim() || (r ? `Edit ${r}` : cr(t, n));
|
|
1961
|
+
}
|
|
1962
|
+
var K = (e) => e == null ? "" : String(e).trim();
|
|
1963
|
+
function ur(e) {
|
|
1964
|
+
let t = e?.quickCreateNotice;
|
|
1965
|
+
return !t || typeof t != "object" || t.enabled === !1 ? null : {
|
|
1966
|
+
enabled: !0,
|
|
1967
|
+
title: K(t.title) || "New record created",
|
|
1968
|
+
message: K(t.message) || "A new client has been created successfully. Please contact your Organization Admin to configure the required forms, workflows, permissions, and client-specific details before proceeding with further operations.",
|
|
1969
|
+
showCreator: t.showCreator !== !1,
|
|
1970
|
+
showRecordName: t.showRecordName !== !1,
|
|
1971
|
+
recordNameField: K(t.recordNameField),
|
|
1972
|
+
recordLabel: K(t.recordLabel) || "Record name",
|
|
1973
|
+
creatorLabel: K(t.creatorLabel) || "Created by"
|
|
1974
|
+
};
|
|
1975
|
+
}
|
|
1976
|
+
var dr = [
|
|
1977
|
+
"clientName",
|
|
1978
|
+
"companyName",
|
|
1979
|
+
"name",
|
|
1980
|
+
"title",
|
|
1981
|
+
"fullName",
|
|
1982
|
+
"displayName",
|
|
1983
|
+
"label",
|
|
1984
|
+
"employerName",
|
|
1985
|
+
"vendorName"
|
|
1986
|
+
], fr = (e, t) => {
|
|
1987
|
+
if (!(!e || !t)) return String(t).split(".").reduce((e, t) => e && typeof e == "object" ? e[t] : void 0, e);
|
|
1988
|
+
}, pr = (e) => typeof e == "string" || typeof e == "number" ? K(e) : e && typeof e == "object" ? K(e.label ?? e.name ?? e.title ?? "") : "";
|
|
1989
|
+
function mr(e, { recordNameField: t = "", displayField: n = "" } = {}) {
|
|
1990
|
+
if (!e || typeof e != "object") return "";
|
|
1991
|
+
for (let r of [
|
|
1992
|
+
t,
|
|
1993
|
+
n,
|
|
1994
|
+
...dr
|
|
1995
|
+
]) {
|
|
1996
|
+
if (!r) continue;
|
|
1997
|
+
let t = pr(fr(e, r));
|
|
1998
|
+
if (t) return t;
|
|
1999
|
+
}
|
|
2000
|
+
let r = Object.keys(e).find((t) => /name$/i.test(t) && typeof e[t] == "string" && e[t].trim());
|
|
2001
|
+
return r ? K(e[r]) : "";
|
|
2002
|
+
}
|
|
2003
|
+
function hr(e) {
|
|
2004
|
+
if (!e || typeof e != "object") return "";
|
|
2005
|
+
let t = [
|
|
2006
|
+
e.createdBy,
|
|
2007
|
+
e.created_by,
|
|
2008
|
+
e.createdById,
|
|
2009
|
+
e.createdUserId,
|
|
2010
|
+
e.recordMeta?.createdBy,
|
|
2011
|
+
e.ownerId
|
|
2012
|
+
];
|
|
2013
|
+
for (let e of t) {
|
|
2014
|
+
if (e == null || e === "") continue;
|
|
2015
|
+
if (typeof e == "object") {
|
|
2016
|
+
let t = K(e.$oid ?? e.userId ?? e._id ?? e.id);
|
|
2017
|
+
if (t) return t;
|
|
2018
|
+
continue;
|
|
2019
|
+
}
|
|
2020
|
+
let t = K(e);
|
|
2021
|
+
if (t) return t;
|
|
2022
|
+
}
|
|
2023
|
+
return "";
|
|
2024
|
+
}
|
|
2025
|
+
function gr(e = a) {
|
|
2026
|
+
try {
|
|
2027
|
+
return y(e()) || "";
|
|
2028
|
+
} catch {
|
|
2029
|
+
return "";
|
|
2030
|
+
}
|
|
2031
|
+
}
|
|
2032
|
+
var _r = (e, t) => o(r, `/module/list?module=${encodeURIComponent(e)}&id=${encodeURIComponent(t)}`).then((e) => {
|
|
2033
|
+
let t = e?.data?.data ?? e?.data ?? [];
|
|
2034
|
+
return Array.isArray(t) ? t[0] : t;
|
|
2035
|
+
});
|
|
2036
|
+
async function vr({ module: e, recordId: t, notice: n, displayField: r = "", deps: i = {} } = {}) {
|
|
2037
|
+
let { fetchRecord: o = _r, fetchUserNameFn: s = ae, getUser: c = a } = i, l = null;
|
|
2038
|
+
if (e && t) try {
|
|
2039
|
+
l = await o(e, t);
|
|
2040
|
+
} catch {
|
|
2041
|
+
l = null;
|
|
2042
|
+
}
|
|
2043
|
+
let u = n?.showRecordName === !1 ? "" : mr(l, {
|
|
2044
|
+
recordNameField: n?.recordNameField,
|
|
2045
|
+
displayField: r
|
|
2046
|
+
}), d = "";
|
|
2047
|
+
if (n?.showCreator !== !1) {
|
|
2048
|
+
let e = hr(l);
|
|
2049
|
+
if (e) try {
|
|
2050
|
+
d = K(await s(e));
|
|
2051
|
+
} catch {
|
|
2052
|
+
d = "";
|
|
2053
|
+
}
|
|
2054
|
+
d ||= gr(c);
|
|
2055
|
+
}
|
|
2056
|
+
return {
|
|
2057
|
+
recordName: u,
|
|
2058
|
+
creatorName: d
|
|
2059
|
+
};
|
|
2060
|
+
}
|
|
2061
|
+
var yr = (e, t) => e?.quickCreate ? e.quickCreateOnType === !0 || e.quickCreateOnType !== !1 && t === "submissions" && e.quickCreateModule === "employers" : !1;
|
|
2062
|
+
function br(e) {
|
|
2063
|
+
return String(e ?? "").trim().replace(/\s+/g, " ");
|
|
2064
|
+
}
|
|
2065
|
+
var xr = (e) => br(e).toLowerCase();
|
|
2066
|
+
function Sr(e, t) {
|
|
2067
|
+
let n = xr(e);
|
|
2068
|
+
return !n || !Array.isArray(t) ? null : t.find((e) => xr(e?.label) === n) ?? null;
|
|
2069
|
+
}
|
|
2070
|
+
function Cr({ text: e, disabled: t = !1, modalOpen: n = !1 }) {
|
|
2071
|
+
return t || n ? !1 : br(e).length >= 3;
|
|
2072
|
+
}
|
|
2073
|
+
//#endregion
|
|
2074
|
+
//#region src/components/form/QuickCreateEditField.jsx
|
|
2075
|
+
var wr = x(() => import("./index.js").then((e) => e.r)), Tr = x(() => import("./index.js").then((e) => e.n)), Er = (e) => e == null || e === "", Dr = (e) => typeof e == "string" && e.includes(".") ? e.split(".") : [e];
|
|
2076
|
+
function Or(e, t, n, r, i) {
|
|
2077
|
+
let a = e.quickEditIdFrom;
|
|
2078
|
+
if (a) {
|
|
2079
|
+
let e = Array.isArray(n) && n.length >= 3 && typeof n[1] == "number" ? [...n.slice(0, 2), ...Dr(a)] : Dr(a), i = t?.getFieldValue?.(e);
|
|
2080
|
+
return Er(i) && (i = r?.[a]), Er(i) ? null : i;
|
|
2081
|
+
}
|
|
2082
|
+
return i && typeof i == "object" ? i.value ?? null : Er(i) ? null : i;
|
|
2083
|
+
}
|
|
2084
|
+
function kr({ field: e, form: t, name: n, moduleName: r, scopeValues: i, ownValue: a, onDone: o }) {
|
|
2085
|
+
let [s, c] = w(null), [l, u] = w(null), d = !!e?.quickCreate, f = !!e?.quickEdit, p = e?.quickCreateModule || e?.lookupCollection || "", m = e?.quickEditModule || e?.lookupCollection || "", h = C(() => f ? Or(e, t, n, i, a) : null, [
|
|
2086
|
+
f,
|
|
2087
|
+
e,
|
|
2088
|
+
t,
|
|
2089
|
+
n,
|
|
2090
|
+
i,
|
|
2091
|
+
a
|
|
2092
|
+
]);
|
|
2093
|
+
if (!d && !f) return {
|
|
2094
|
+
footer: null,
|
|
2095
|
+
modal: null,
|
|
2096
|
+
openCreateWith: null,
|
|
2097
|
+
isModalOpen: !1
|
|
2098
|
+
};
|
|
2099
|
+
let g = yr(e, r), _ = () => c(null), v = () => {
|
|
2100
|
+
if (e?.quickCreateOnClick) {
|
|
2101
|
+
e.quickCreateOnClick(), document.activeElement?.blur?.();
|
|
2102
|
+
return;
|
|
2103
|
+
}
|
|
2104
|
+
if (e?.quickCreateRoute) {
|
|
2105
|
+
window.open(e.quickCreateRoute, "_blank", "noopener,noreferrer");
|
|
2106
|
+
return;
|
|
2107
|
+
}
|
|
2108
|
+
p && c({
|
|
2109
|
+
mode: "create",
|
|
2110
|
+
module: p
|
|
2111
|
+
});
|
|
2112
|
+
}, ee = (e) => {
|
|
2113
|
+
s || !p || c({
|
|
2114
|
+
mode: "create",
|
|
2115
|
+
module: p,
|
|
2116
|
+
prefill: e ?? null
|
|
2117
|
+
});
|
|
2118
|
+
}, y = () => m && h && c({
|
|
2119
|
+
mode: "edit",
|
|
2120
|
+
module: m,
|
|
2121
|
+
recordId: String(h)
|
|
2122
|
+
}), te = (t) => {
|
|
2123
|
+
let n = ur(e);
|
|
2124
|
+
n && (u({
|
|
2125
|
+
...n,
|
|
2126
|
+
recordName: "",
|
|
2127
|
+
creatorName: ""
|
|
2128
|
+
}), vr({
|
|
2129
|
+
module: p,
|
|
2130
|
+
recordId: t,
|
|
2131
|
+
notice: n,
|
|
2132
|
+
displayField: e?.displayField || ""
|
|
2133
|
+
}).then(({ recordName: e, creatorName: t }) => {
|
|
2134
|
+
u((n) => n && {
|
|
2135
|
+
...n,
|
|
2136
|
+
recordName: e,
|
|
2137
|
+
creatorName: t
|
|
2138
|
+
});
|
|
2139
|
+
}).catch(() => {}));
|
|
2140
|
+
}, re = d && !g, b = !re && !f ? null : /* @__PURE__ */ O("div", {
|
|
2141
|
+
className: "v1-quick-actions",
|
|
2142
|
+
role: "presentation",
|
|
2143
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
2144
|
+
style: {
|
|
2145
|
+
display: "flex",
|
|
2146
|
+
gap: 8,
|
|
2147
|
+
padding: "6px 8px",
|
|
2148
|
+
borderTop: "1px solid rgba(0,0,0,0.06)"
|
|
2149
|
+
},
|
|
2150
|
+
children: /* @__PURE__ */ k(Ce, {
|
|
2151
|
+
size: 8,
|
|
2152
|
+
children: [re && /* @__PURE__ */ O(be, {
|
|
2153
|
+
type: "link",
|
|
2154
|
+
size: "small",
|
|
2155
|
+
icon: /* @__PURE__ */ O(Le, {}),
|
|
2156
|
+
onClick: v,
|
|
2157
|
+
style: { paddingLeft: 0 },
|
|
2158
|
+
children: sr(e, p)
|
|
2159
|
+
}), f && /* @__PURE__ */ O(be, {
|
|
2160
|
+
type: "link",
|
|
2161
|
+
size: "small",
|
|
2162
|
+
icon: /* @__PURE__ */ O(ke, {}),
|
|
2163
|
+
onClick: y,
|
|
2164
|
+
disabled: !h,
|
|
2165
|
+
title: h ? void 0 : `Choose a ${G(m) || "record"} above first, then edit it here`,
|
|
2166
|
+
children: cr(e, m)
|
|
2167
|
+
})]
|
|
2168
|
+
})
|
|
2169
|
+
}), ie = s ? /* @__PURE__ */ O(T, {
|
|
2170
|
+
open: !0,
|
|
2171
|
+
title: lr(s.mode, e, s.mode === "create" ? p : m),
|
|
2172
|
+
width: "min(1080px, 96vw)",
|
|
2173
|
+
footer: null,
|
|
2174
|
+
destroyOnClose: !0,
|
|
2175
|
+
maskClosable: !1,
|
|
2176
|
+
onCancel: _,
|
|
2177
|
+
styles: { body: {
|
|
2178
|
+
maxHeight: "78vh",
|
|
2179
|
+
overflowY: "auto"
|
|
2180
|
+
} },
|
|
2181
|
+
children: /* @__PURE__ */ O(fe, {
|
|
2182
|
+
fallback: /* @__PURE__ */ O("div", {
|
|
2183
|
+
style: {
|
|
2184
|
+
padding: 48,
|
|
2185
|
+
textAlign: "center"
|
|
2186
|
+
},
|
|
2187
|
+
children: /* @__PURE__ */ O(we, {})
|
|
2188
|
+
}),
|
|
2189
|
+
children: s.mode === "create" ? /* @__PURE__ */ O(wr, {
|
|
2190
|
+
moduleName: s.module,
|
|
2191
|
+
embedded: !0,
|
|
2192
|
+
breadcrumbItems: [],
|
|
2193
|
+
initialRecord: s.prefill ?? void 0,
|
|
2194
|
+
onCancel: _,
|
|
2195
|
+
onSuccess: (e) => {
|
|
2196
|
+
_(), te(e), o?.("create", e);
|
|
2197
|
+
}
|
|
2198
|
+
}) : /* @__PURE__ */ O(Tr, {
|
|
2199
|
+
moduleName: s.module,
|
|
2200
|
+
recordId: s.recordId,
|
|
2201
|
+
embedded: !0,
|
|
2202
|
+
breadcrumbItems: [],
|
|
2203
|
+
onCancel: _,
|
|
2204
|
+
onSuccess: (e) => {
|
|
2205
|
+
_(), o?.("edit", e);
|
|
2206
|
+
}
|
|
2207
|
+
})
|
|
2208
|
+
})
|
|
2209
|
+
}) : null, ae = l ? /* @__PURE__ */ k(T, {
|
|
2210
|
+
open: !0,
|
|
2211
|
+
title: /* @__PURE__ */ k("span", {
|
|
2212
|
+
style: {
|
|
2213
|
+
display: "inline-flex",
|
|
2214
|
+
alignItems: "center",
|
|
2215
|
+
gap: 8
|
|
2216
|
+
},
|
|
2217
|
+
children: [/* @__PURE__ */ O(Ae, { style: { color: "#faad14" } }), l.title]
|
|
2218
|
+
}),
|
|
2219
|
+
width: "min(520px, 94vw)",
|
|
2220
|
+
maskClosable: !1,
|
|
2221
|
+
onCancel: () => u(null),
|
|
2222
|
+
footer: /* @__PURE__ */ O(ne, {
|
|
2223
|
+
variant: "primary",
|
|
2224
|
+
type: "primary",
|
|
2225
|
+
onClick: () => u(null),
|
|
2226
|
+
children: "OK"
|
|
2227
|
+
}),
|
|
2228
|
+
children: [/* @__PURE__ */ O("p", {
|
|
2229
|
+
style: {
|
|
2230
|
+
marginTop: 0,
|
|
2231
|
+
marginBottom: 16
|
|
2232
|
+
},
|
|
2233
|
+
children: l.message
|
|
2234
|
+
}), (l.recordName || l.creatorName) && /* @__PURE__ */ k("div", {
|
|
2235
|
+
style: {
|
|
2236
|
+
display: "grid",
|
|
2237
|
+
gridTemplateColumns: "auto 1fr",
|
|
2238
|
+
gap: "6px 12px",
|
|
2239
|
+
padding: "10px 12px",
|
|
2240
|
+
borderRadius: 6,
|
|
2241
|
+
background: "rgba(0,0,0,0.03)"
|
|
2242
|
+
},
|
|
2243
|
+
children: [l.recordName && /* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O("span", {
|
|
2244
|
+
style: { color: "rgba(0,0,0,0.55)" },
|
|
2245
|
+
children: l.recordLabel
|
|
2246
|
+
}), /* @__PURE__ */ O("strong", { children: l.recordName })] }), l.creatorName && /* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O("span", {
|
|
2247
|
+
style: { color: "rgba(0,0,0,0.55)" },
|
|
2248
|
+
children: l.creatorLabel
|
|
2249
|
+
}), /* @__PURE__ */ O("strong", { children: l.creatorName })] })]
|
|
2250
|
+
})]
|
|
2251
|
+
}) : null;
|
|
2252
|
+
return {
|
|
2253
|
+
footer: b,
|
|
2254
|
+
modal: ie || ae ? /* @__PURE__ */ k(D, { children: [ie, ae] }) : null,
|
|
2255
|
+
openCreateWith: ee,
|
|
2256
|
+
isModalOpen: !!s
|
|
2257
|
+
};
|
|
2258
|
+
}
|
|
2259
|
+
//#endregion
|
|
2260
|
+
//#region src/components/form/crossFieldRules.js
|
|
2261
|
+
var Ar = (e) => e == null || e === "" || Array.isArray(e) && e.length === 0;
|
|
2262
|
+
function jr(e, t, n) {
|
|
2263
|
+
let r = String(t ?? "").includes(".") ? String(t).split(".") : [t];
|
|
2264
|
+
if (typeof n == "function") {
|
|
2265
|
+
let e = n(t);
|
|
2266
|
+
return Array.isArray(e) && e.length ? [...e, ...r] : r;
|
|
2267
|
+
}
|
|
2268
|
+
return Array.isArray(e) && e.length > 1 ? [...e.slice(0, -1), ...r] : r;
|
|
2269
|
+
}
|
|
2270
|
+
function Mr({ label: e, message: t, rule: n = {}, value: r, form: i, name: a, prefixFor: o }) {
|
|
2271
|
+
let s = n.field ?? n.compareField ?? r;
|
|
2272
|
+
return { validator: async (n, r) => {
|
|
2273
|
+
if (!s || Ar(r)) return Promise.resolve();
|
|
2274
|
+
let c = i?.getFieldValue?.(jr(a, s, o));
|
|
2275
|
+
if (Ar(c)) return Promise.resolve();
|
|
2276
|
+
let l = Number(c), u = Number(r);
|
|
2277
|
+
return Number.isNaN(l) || Number.isNaN(u) || u <= l ? Promise.resolve() : Promise.reject(Error(t ?? `${e} must not exceed ${s}`));
|
|
2278
|
+
} };
|
|
2279
|
+
}
|
|
2280
|
+
function Nr(e = {}, t, n) {
|
|
2281
|
+
let r = e.field ?? e.compareField ?? e.value;
|
|
2282
|
+
return r ? jr(t, r, n) : null;
|
|
2283
|
+
}
|
|
2284
|
+
//#endregion
|
|
2285
|
+
//#region src/components/form/maxCeiling.js
|
|
2286
|
+
function Pr(e, t) {
|
|
2287
|
+
let n = String(t).split(".").filter(Boolean);
|
|
2288
|
+
if (!Array.isArray(e)) return n.length > 1 ? n : t;
|
|
2289
|
+
if (n.length > 1) {
|
|
2290
|
+
if (e.length >= 3 && typeof e[1] == "number") {
|
|
2291
|
+
let t = e.slice(0, 2), r = n[0] === String(e[0]) ? n.slice(1) : n;
|
|
2292
|
+
return [...t, ...r];
|
|
2293
|
+
}
|
|
2294
|
+
return n;
|
|
2295
|
+
}
|
|
2296
|
+
let r = [...e];
|
|
2297
|
+
return r[r.length - 1] = n[0], r;
|
|
2298
|
+
}
|
|
2299
|
+
function Fr(e, t, n) {
|
|
2300
|
+
let r = e?.getFieldValue?.(Pr(t, n));
|
|
2301
|
+
return r != null && r !== "" ? r : e?.getFieldValue?.(n);
|
|
2302
|
+
}
|
|
2303
|
+
function Ir(e) {
|
|
2304
|
+
return String(e ?? "").split(",").map((e) => e.trim()).filter(Boolean);
|
|
2305
|
+
}
|
|
2306
|
+
function Lr(e, t) {
|
|
2307
|
+
for (let n of e ?? []) {
|
|
2308
|
+
let e = t(n);
|
|
2309
|
+
if (e == null || e === "") continue;
|
|
2310
|
+
let r = Number(e);
|
|
2311
|
+
if (!(!Number.isFinite(r) || r <= 0)) return {
|
|
2312
|
+
field: n,
|
|
2313
|
+
maximum: r
|
|
2314
|
+
};
|
|
2315
|
+
}
|
|
2316
|
+
return null;
|
|
2317
|
+
}
|
|
2318
|
+
function Rr({ input: e, compareFields: t, readValue: n }) {
|
|
2319
|
+
let r = {
|
|
2320
|
+
ok: !0,
|
|
2321
|
+
field: null,
|
|
2322
|
+
maximum: null
|
|
2323
|
+
};
|
|
2324
|
+
if (e == null || e === "") return r;
|
|
2325
|
+
let i = Lr(t, n);
|
|
2326
|
+
if (!i) return r;
|
|
2327
|
+
let a = Number(e);
|
|
2328
|
+
return Number.isFinite(a) ? {
|
|
2329
|
+
ok: a <= i.maximum,
|
|
2330
|
+
field: i.field,
|
|
2331
|
+
maximum: i.maximum
|
|
2332
|
+
} : r;
|
|
2333
|
+
}
|
|
2334
|
+
//#endregion
|
|
2335
|
+
//#region src/components/form/contextPrefill.js
|
|
2336
|
+
var zr = { candidates: ["applicantId"] };
|
|
2337
|
+
function Br(e) {
|
|
2338
|
+
let t = String(e ?? "").trim();
|
|
2339
|
+
if (!t) return [];
|
|
2340
|
+
let n = t.endsWith("s") ? t.slice(0, -1) : t;
|
|
2341
|
+
return [.../* @__PURE__ */ new Set([
|
|
2342
|
+
`${n}Id`,
|
|
2343
|
+
`${t}Id`,
|
|
2344
|
+
...zr[t] ?? []
|
|
2345
|
+
])];
|
|
2346
|
+
}
|
|
2347
|
+
function Vr(e, t) {
|
|
2348
|
+
if (!t) return "";
|
|
2349
|
+
let n = (e) => e && typeof e == "object" ? e.id ?? e.value ?? "" : e ?? "";
|
|
2350
|
+
for (let r of Br(e)) {
|
|
2351
|
+
let e = String(n(t[r]) || "");
|
|
2352
|
+
if (e) return e;
|
|
2353
|
+
}
|
|
2354
|
+
return "";
|
|
2355
|
+
}
|
|
2356
|
+
function Hr(e, t) {
|
|
2357
|
+
let n = /* @__PURE__ */ new Set();
|
|
2358
|
+
return (e ?? []).forEach((e) => (e.fields ?? []).forEach((e) => {
|
|
2359
|
+
e?.prefillFromModule && n.add(t(e.prefillFromModule));
|
|
2360
|
+
})), [...n];
|
|
2361
|
+
}
|
|
2362
|
+
function Ur(e) {
|
|
2363
|
+
return e?.payloadMode === "skip";
|
|
2364
|
+
}
|
|
2365
|
+
function Wr(e) {
|
|
2366
|
+
return Array.isArray(e) ? e : Array.isArray(e?.groups) ? e.groups : Array.isArray(e?.data) ? e.data : Array.isArray(e?.data?.groups) ? e.data.groups : [];
|
|
2367
|
+
}
|
|
2368
|
+
function Gr(e) {
|
|
2369
|
+
let t = {};
|
|
2370
|
+
return (e ?? []).forEach((e) => {
|
|
2371
|
+
e?.addRow || (e?.fields ?? []).forEach((e) => {
|
|
2372
|
+
!e?.field || e.value === void 0 || e.value === null || (t[e.field] = e.value, e.payloadKey && e.payloadKey !== e.field && (t[e.payloadKey] = e.value));
|
|
2373
|
+
});
|
|
2374
|
+
}), t;
|
|
2375
|
+
}
|
|
2376
|
+
function Kr(e, t) {
|
|
2377
|
+
if (!e || !t) return;
|
|
2378
|
+
let n = e;
|
|
2379
|
+
for (let e of String(t).split(".")) {
|
|
2380
|
+
if (n == null) return;
|
|
2381
|
+
if (Array.isArray(n)) {
|
|
2382
|
+
if (!n.length) return;
|
|
2383
|
+
let t = [...n].reverse().find((t) => t && typeof t == "object" && t[e] !== void 0 && t[e] !== null);
|
|
2384
|
+
n = t ? t[e] : void 0;
|
|
2385
|
+
continue;
|
|
2386
|
+
}
|
|
2387
|
+
n = n[e];
|
|
2388
|
+
}
|
|
2389
|
+
return n;
|
|
2390
|
+
}
|
|
2391
|
+
function qr(e, t) {
|
|
2392
|
+
if (!(!e || !t)) for (let n of [
|
|
2393
|
+
t.prefillFrom,
|
|
2394
|
+
t.field,
|
|
2395
|
+
t.payloadKey
|
|
2396
|
+
]) {
|
|
2397
|
+
if (!n) continue;
|
|
2398
|
+
let t = e[n];
|
|
2399
|
+
if (t ??= s(e, n), t ??= Kr(e, n), t != null) return t;
|
|
2400
|
+
}
|
|
2401
|
+
}
|
|
2402
|
+
//#endregion
|
|
2403
|
+
//#region src/components/form/ValidationOverrideCheckbox.jsx
|
|
2404
|
+
function Jr({ form: e, field: t, flagPath: n, fieldPath: r, disabled: i }) {
|
|
2405
|
+
let a = f(t), o = Se.useWatch(n, e);
|
|
2406
|
+
if (!a) return null;
|
|
2407
|
+
let s = a.label || "Allow beyond the limit", c = () => {
|
|
2408
|
+
setTimeout(() => {
|
|
2409
|
+
e?.validateFields?.([r]).catch(() => {});
|
|
2410
|
+
});
|
|
2411
|
+
}, l = async (r) => {
|
|
2412
|
+
if (!r.target.checked) {
|
|
2413
|
+
e.setFieldValue(n, !1), c();
|
|
2414
|
+
return;
|
|
2415
|
+
}
|
|
2416
|
+
let i = await L(g(t));
|
|
2417
|
+
e.setFieldValue(n, !!i), c();
|
|
2418
|
+
}, u = a.help ? `${s} — ${a.help}` : s;
|
|
2419
|
+
return /* @__PURE__ */ O(Ee, {
|
|
2420
|
+
title: u,
|
|
2421
|
+
children: /* @__PURE__ */ O("span", {
|
|
2422
|
+
className: "v1-override-wrap",
|
|
2423
|
+
children: /* @__PURE__ */ O(xe, {
|
|
2424
|
+
className: "v1-override-checkbox",
|
|
2425
|
+
checked: !!o,
|
|
2426
|
+
disabled: i,
|
|
2427
|
+
onChange: l,
|
|
2428
|
+
"aria-label": u
|
|
2429
|
+
})
|
|
2430
|
+
})
|
|
2431
|
+
});
|
|
2432
|
+
}
|
|
2433
|
+
//#endregion
|
|
2434
|
+
//#region src/components/form/prefillWhenRules.js
|
|
2435
|
+
var Yr = (e) => String(e ?? "");
|
|
2436
|
+
function Xr(e) {
|
|
2437
|
+
let t = /* @__PURE__ */ new Set(), n = [];
|
|
2438
|
+
return (Array.isArray(e) ? e : []).forEach((e) => {
|
|
2439
|
+
let r = e?.field;
|
|
2440
|
+
!r || t.has(r) || (t.add(r), n.push(r));
|
|
2441
|
+
}), n;
|
|
2442
|
+
}
|
|
2443
|
+
function Zr(e, t, n, r) {
|
|
2444
|
+
return Xr(e).map((e) => ({
|
|
2445
|
+
field: e,
|
|
2446
|
+
path: n(t, e, r)
|
|
2447
|
+
}));
|
|
2448
|
+
}
|
|
2449
|
+
function Qr(e, t = {}) {
|
|
2450
|
+
return !e || !e.field ? !1 : Yr(t[e.field]) === Yr(e.value);
|
|
2451
|
+
}
|
|
2452
|
+
function $r({ rules: e, watched: t = {}, current: n, lastApplied: r, clearOnMismatch: i = !0, initial: a = !1 } = {}) {
|
|
2453
|
+
let o = (Array.isArray(e) ? e : []).find((e) => Qr(e, t));
|
|
2454
|
+
return o ? o.clearValue ? a ? { action: "none" } : { action: "clear" } : {
|
|
2455
|
+
action: "set",
|
|
2456
|
+
value: o.setValue
|
|
2457
|
+
} : i && r !== void 0 && Yr(n) === Yr(r) ? { action: "clear" } : { action: "none" };
|
|
2458
|
+
}
|
|
2459
|
+
//#endregion
|
|
2460
|
+
//#region src/components/form/computeFromRules.js
|
|
2461
|
+
var ei = ["daysUntil"], ti = (e) => e == null || e === "", ni = (e) => String(e ?? "");
|
|
2462
|
+
function ri(e) {
|
|
2463
|
+
return !!(e && ei.includes(e.type) && e.field);
|
|
2464
|
+
}
|
|
2465
|
+
function ii(e) {
|
|
2466
|
+
if (ti(e)) return null;
|
|
2467
|
+
let t = A.isDayjs(e) ? e : A(e?.$date ?? e);
|
|
2468
|
+
return t.isValid() ? t.format("YYYY-MM-DD") : null;
|
|
2469
|
+
}
|
|
2470
|
+
function ai(e, t) {
|
|
2471
|
+
let n = ii(e), r = ii(t ?? A());
|
|
2472
|
+
if (!(!n || !r)) return Math.max(0, A(n).diff(A(r), "day"));
|
|
2473
|
+
}
|
|
2474
|
+
function oi(e, t, n) {
|
|
2475
|
+
if (ri(e)) switch (e.type) {
|
|
2476
|
+
case "daysUntil": return ai(t, n);
|
|
2477
|
+
default: return;
|
|
2478
|
+
}
|
|
2479
|
+
}
|
|
2480
|
+
function si(e, t, n, r) {
|
|
2481
|
+
let i = Object.entries(e?.setFields || {}).filter(([e]) => !!e).map(([e, i]) => ({
|
|
2482
|
+
field: e,
|
|
2483
|
+
path: n(t, e, r),
|
|
2484
|
+
value: i
|
|
2485
|
+
}));
|
|
2486
|
+
return {
|
|
2487
|
+
source: n(t, e.field, r),
|
|
2488
|
+
setFields: i
|
|
2489
|
+
};
|
|
2490
|
+
}
|
|
2491
|
+
function ci({ cfg: e, sourceValue: t, previousSource: n, current: r, lastApplied: i, today: a } = {}) {
|
|
2492
|
+
if (!ri(e) || ti(t) || ii(t) === ii(n)) return { action: "none" };
|
|
2493
|
+
let o = oi(e, t, a);
|
|
2494
|
+
if (o === void 0) return { action: "none" };
|
|
2495
|
+
if (ti(n)) {
|
|
2496
|
+
let e = i !== void 0 && ni(r) === ni(i);
|
|
2497
|
+
if (!ti(r) && !e) return { action: "none" };
|
|
2498
|
+
}
|
|
2499
|
+
return ni(r) === ni(o) ? { action: "none" } : {
|
|
2500
|
+
action: "set",
|
|
2501
|
+
value: o
|
|
2502
|
+
};
|
|
2503
|
+
}
|
|
2504
|
+
//#endregion
|
|
2505
|
+
//#region src/components/form/ComputeFromWatcher.jsx
|
|
2506
|
+
function li({ form: e, config: t, sourcePath: n, targetPath: r, setFields: i = [] }) {
|
|
2507
|
+
let a = Se.useWatch(n, {
|
|
2508
|
+
form: e,
|
|
2509
|
+
preserve: !0
|
|
2510
|
+
}), o = ge(void 0), s = ge(void 0), c = a?.format ? a.format("YYYY-MM-DD") : String(a ?? "");
|
|
2511
|
+
return S(() => {
|
|
2512
|
+
let n = ci({
|
|
2513
|
+
cfg: t,
|
|
2514
|
+
sourceValue: a,
|
|
2515
|
+
previousSource: o.current,
|
|
2516
|
+
current: e.getFieldValue(r),
|
|
2517
|
+
lastApplied: s.current,
|
|
2518
|
+
today: b()
|
|
2519
|
+
});
|
|
2520
|
+
o.current = a, n.action === "set" && (e.setFieldValue(r, n.value), s.current = n.value, i.forEach(({ path: t, value: n }) => e.setFieldValue(t, n)));
|
|
2521
|
+
}, [c]), null;
|
|
2522
|
+
}
|
|
2523
|
+
//#endregion
|
|
2524
|
+
//#region src/components/form/optionConstraints.js
|
|
2525
|
+
var q = (e) => String(e ?? "").trim().toLowerCase();
|
|
2526
|
+
function ui(e) {
|
|
2527
|
+
let t = Array.isArray(e) ? e : [e], n = [];
|
|
2528
|
+
return t.forEach((e) => {
|
|
2529
|
+
if (e != null && e !== "") {
|
|
2530
|
+
if (typeof e == "object") {
|
|
2531
|
+
[
|
|
2532
|
+
e.value,
|
|
2533
|
+
e.id,
|
|
2534
|
+
e._id,
|
|
2535
|
+
e.label,
|
|
2536
|
+
e.name
|
|
2537
|
+
].forEach((e) => {
|
|
2538
|
+
e != null && e !== "" && n.push(q(e));
|
|
2539
|
+
});
|
|
2540
|
+
return;
|
|
2541
|
+
}
|
|
2542
|
+
n.push(q(e));
|
|
2543
|
+
}
|
|
2544
|
+
}), n;
|
|
2545
|
+
}
|
|
2546
|
+
function di(e = [], t) {
|
|
2547
|
+
let n = ui(t);
|
|
2548
|
+
if (!n.length || !Array.isArray(e) || e.length === 0) return e;
|
|
2549
|
+
let r = new Set(n), i = e.filter((e) => e == null ? !1 : typeof e == "object" ? r.has(q(e.value)) || r.has(q(e.label)) : r.has(q(e)));
|
|
2550
|
+
return i.length > 0 ? i : e;
|
|
2551
|
+
}
|
|
2552
|
+
function fi(e) {
|
|
2553
|
+
let t = [];
|
|
2554
|
+
return [e?.setValue, e?.setValueLabel].forEach((e) => {
|
|
2555
|
+
e != null && e !== "" && t.push(q(e));
|
|
2556
|
+
}), t;
|
|
2557
|
+
}
|
|
2558
|
+
function pi(e, t = {}) {
|
|
2559
|
+
let n = Array.isArray(e) ? e : [], r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
|
|
2560
|
+
return n.forEach((e) => {
|
|
2561
|
+
if (!e || e.clearValue) return;
|
|
2562
|
+
let n = fi(e);
|
|
2563
|
+
if (!n.length) return;
|
|
2564
|
+
let a = Qr(e, t) ? i : r;
|
|
2565
|
+
n.forEach((e) => a.add(e));
|
|
2566
|
+
}), i.forEach((e) => r.delete(e)), [...r];
|
|
2567
|
+
}
|
|
2568
|
+
function mi(e = [], t, n) {
|
|
2569
|
+
let r = pi(t, n);
|
|
2570
|
+
if (!r.length || !Array.isArray(e) || e.length === 0) return e;
|
|
2571
|
+
let i = new Set(r);
|
|
2572
|
+
return e.filter((e) => e == null ? !0 : typeof e == "object" ? !(i.has(q(e.value)) || i.has(q(e.label))) : !i.has(q(e)));
|
|
2573
|
+
}
|
|
2574
|
+
function hi(e, t = {}, n) {
|
|
2575
|
+
let r = Array.isArray(e) ? e : [];
|
|
2576
|
+
if (n == null || n === "") return [];
|
|
2577
|
+
let i = q(n), a = [], o = /* @__PURE__ */ new Set();
|
|
2578
|
+
return r.forEach((e) => {
|
|
2579
|
+
if (!e || e.clearValue) return;
|
|
2580
|
+
let { setValue: n, setValueLabel: r } = e;
|
|
2581
|
+
n != null && n !== "" && r && q(n) === i && Qr(e, t) && (o.has(q(n)) || (o.add(q(n)), a.push({
|
|
2582
|
+
value: n,
|
|
2583
|
+
label: r
|
|
2584
|
+
})));
|
|
2585
|
+
}), a;
|
|
2586
|
+
}
|
|
2587
|
+
//#endregion
|
|
2588
|
+
//#region src/components/form/optionMembership.js
|
|
2589
|
+
var gi = /* @__PURE__ */ new Set([
|
|
2590
|
+
"select",
|
|
2591
|
+
"radio",
|
|
2592
|
+
"checkbox"
|
|
2593
|
+
]), _i = 3e5, vi = 1e4, yi = (e) => e === !1 || e === 0 || e === "0" || e === "false", bi = (e) => e === !0 || e === 1 || e === "1" || e === "true", xi = (e) => e == null || e === "";
|
|
2594
|
+
function Si(e) {
|
|
2595
|
+
let t = e?.options ?? e?.values;
|
|
2596
|
+
return Array.isArray(t) ? t : [];
|
|
2597
|
+
}
|
|
2598
|
+
function Ci(e) {
|
|
2599
|
+
return String(e?.dataSource ?? "").trim().toLowerCase();
|
|
2600
|
+
}
|
|
2601
|
+
function wi(e) {
|
|
2602
|
+
if (!e || !gi.has(e.type) || yi(e.enforceOptions) || bi(e.allowCustomValues) || e.mode === "tags") return !1;
|
|
2603
|
+
let t = Ci(e);
|
|
2604
|
+
return t === "master" ? !0 : t === "" || t === "static" ? Si(e).length > 0 : !1;
|
|
2605
|
+
}
|
|
2606
|
+
function Ti(e) {
|
|
2607
|
+
return (Array.isArray(e) ? e : [e]).map((e) => e && typeof e == "object" ? e.value ?? e.id ?? e.label : e).filter((e) => !xi(e) && typeof e != "object" && typeof e != "boolean");
|
|
2608
|
+
}
|
|
2609
|
+
function Ei(e) {
|
|
2610
|
+
return e == null ? null : typeof e == "object" ? {
|
|
2611
|
+
label: e.label ?? e.name ?? e.value,
|
|
2612
|
+
value: e.value ?? e.id ?? e.name ?? e.label
|
|
2613
|
+
} : {
|
|
2614
|
+
label: String(e),
|
|
2615
|
+
value: e
|
|
2616
|
+
};
|
|
2617
|
+
}
|
|
2618
|
+
var Di = /* @__PURE__ */ new Map();
|
|
2619
|
+
function Oi(e, t) {
|
|
2620
|
+
return [
|
|
2621
|
+
t,
|
|
2622
|
+
e.field,
|
|
2623
|
+
e.masterName,
|
|
2624
|
+
e.groupName
|
|
2625
|
+
].map((e) => e ?? "").join("|");
|
|
2626
|
+
}
|
|
2627
|
+
async function ki(e, t) {
|
|
2628
|
+
let n = Oi(e, t), r = Di.get(n);
|
|
2629
|
+
if (r && Date.now() - r.at < _i) return r.promise;
|
|
2630
|
+
let i = Promise.resolve(ie(t, e.field, "", vi, 0, {
|
|
2631
|
+
dataSource: "master",
|
|
2632
|
+
masterName: e.masterName,
|
|
2633
|
+
groupName: e.groupName
|
|
2634
|
+
})).then((e) => {
|
|
2635
|
+
let t = Array.isArray(e) ? e : e?.data ?? [];
|
|
2636
|
+
return (Array.isArray(t) ? t : []).map(Ei).filter(Boolean);
|
|
2637
|
+
});
|
|
2638
|
+
return Di.set(n, {
|
|
2639
|
+
at: Date.now(),
|
|
2640
|
+
promise: i
|
|
2641
|
+
}), i.catch(() => Di.delete(n)), i;
|
|
2642
|
+
}
|
|
2643
|
+
async function Ai(e, { moduleName: t } = {}) {
|
|
2644
|
+
return Ci(e) === "master" ? ki(e, t) : Si(e).map(Ei).filter(Boolean);
|
|
2645
|
+
}
|
|
2646
|
+
function ji(e) {
|
|
2647
|
+
let t = /* @__PURE__ */ new Map();
|
|
2648
|
+
return e.forEach((e) => {
|
|
2649
|
+
[[e.label, e.label], [e.value, e.value]].forEach(([e, n]) => {
|
|
2650
|
+
let r = ue(e);
|
|
2651
|
+
r && !t.has(r) && t.set(r, n);
|
|
2652
|
+
});
|
|
2653
|
+
}), t;
|
|
2654
|
+
}
|
|
2655
|
+
async function Mi(e, t, { moduleName: n, constraintValue: r } = {}) {
|
|
2656
|
+
let i = Ti(t);
|
|
2657
|
+
if (!i.length) return {
|
|
2658
|
+
offList: [],
|
|
2659
|
+
snaps: /* @__PURE__ */ new Map(),
|
|
2660
|
+
options: []
|
|
2661
|
+
};
|
|
2662
|
+
let a = await Ai(e, { moduleName: n });
|
|
2663
|
+
e.optionsFromField && (a = di(a, r));
|
|
2664
|
+
let o = Ci(e) === "master", s = o ? ji(a) : c({
|
|
2665
|
+
options: a,
|
|
2666
|
+
optionAliases: e.optionAliases
|
|
2667
|
+
}), l = new Set(a.flatMap((e) => o ? [String(e.value), String(e.label)] : [String(e.value)])), u = [], d = /* @__PURE__ */ new Map();
|
|
2668
|
+
return i.forEach((e) => {
|
|
2669
|
+
if (l.has(String(e))) return;
|
|
2670
|
+
let t = s.get(ue(e));
|
|
2671
|
+
t === void 0 ? u.push(String(e)) : d.set(e, t);
|
|
2672
|
+
}), {
|
|
2673
|
+
offList: u,
|
|
2674
|
+
snaps: d,
|
|
2675
|
+
options: a
|
|
2676
|
+
};
|
|
2677
|
+
}
|
|
2678
|
+
function Ni(e, t) {
|
|
2679
|
+
let n = e.label || e.field || "this field";
|
|
2680
|
+
if (e.optionsMismatchMessage) return e.optionsMismatchMessage;
|
|
2681
|
+
let r = t.map((e) => `"${e}"`).join(", ");
|
|
2682
|
+
return t.length === 1 ? `${r} is not in the ${n} list. Please choose an option from the dropdown.` : `${r} are not in the ${n} list. Please choose options from the dropdown.`;
|
|
2683
|
+
}
|
|
2684
|
+
function Pi(e = [], t = []) {
|
|
2685
|
+
let n = t[0];
|
|
2686
|
+
return e.find((e) => e?.name === n || e?.payloadKey === n) ?? e.find((e) => (e?.fields ?? []).some((e) => e?.field === n));
|
|
2687
|
+
}
|
|
2688
|
+
var Fi = /* @__PURE__ */ new WeakMap();
|
|
2689
|
+
function Ii(e) {
|
|
2690
|
+
let t = Fi.get(e);
|
|
2691
|
+
return t || (t = {
|
|
2692
|
+
entries: /* @__PURE__ */ new Map(),
|
|
2693
|
+
listeners: /* @__PURE__ */ new Set(),
|
|
2694
|
+
snapshot: []
|
|
2695
|
+
}, Fi.set(e, t)), t;
|
|
2696
|
+
}
|
|
2697
|
+
var Li = (e) => JSON.stringify(Array.isArray(e) ? e : [e]);
|
|
2698
|
+
function Ri(e) {
|
|
2699
|
+
e.snapshot = [...e.entries.values()], e.listeners.forEach((e) => e());
|
|
2700
|
+
}
|
|
2701
|
+
function J(e, t, n) {
|
|
2702
|
+
if (!e) return;
|
|
2703
|
+
let r = Ii(e), i = Li(t);
|
|
2704
|
+
if (n) {
|
|
2705
|
+
let e = r.entries.get(i);
|
|
2706
|
+
if (e && e.message === n.message) return;
|
|
2707
|
+
r.entries.set(i, {
|
|
2708
|
+
...n,
|
|
2709
|
+
path: Array.isArray(t) ? t : [t]
|
|
2710
|
+
});
|
|
2711
|
+
} else if (r.entries.has(i)) r.entries.delete(i);
|
|
2712
|
+
else return;
|
|
2713
|
+
Ri(r);
|
|
2714
|
+
}
|
|
2715
|
+
function zi(e) {
|
|
2716
|
+
return e ? Ii(e).snapshot : [];
|
|
2717
|
+
}
|
|
2718
|
+
function Bi(e) {
|
|
2719
|
+
return _e((t) => {
|
|
2720
|
+
if (!e) return () => {};
|
|
2721
|
+
let n = Ii(e);
|
|
2722
|
+
return n.listeners.add(t), () => n.listeners.delete(t);
|
|
2723
|
+
}, () => zi(e), () => zi(e));
|
|
2724
|
+
}
|
|
2725
|
+
function Vi(e, t, n) {
|
|
2726
|
+
if (!n) return;
|
|
2727
|
+
let r = String(n).split(".").map((e) => e.trim()).filter(Boolean);
|
|
2728
|
+
if (Array.isArray(t) && t.length >= 3 && typeof t[1] == "number") {
|
|
2729
|
+
let n = e.getFieldValue([
|
|
2730
|
+
t[0],
|
|
2731
|
+
t[1],
|
|
2732
|
+
...r
|
|
2733
|
+
]);
|
|
2734
|
+
if (!xi(n)) return n;
|
|
2735
|
+
}
|
|
2736
|
+
return e.getFieldValue(r);
|
|
2737
|
+
}
|
|
2738
|
+
function Hi({ field: e, form: t, name: n, moduleName: r }) {
|
|
2739
|
+
return { validator: async (i, a) => {
|
|
2740
|
+
if (!Ti(a).length) {
|
|
2741
|
+
J(t, n, null);
|
|
2742
|
+
return;
|
|
2743
|
+
}
|
|
2744
|
+
let o;
|
|
2745
|
+
try {
|
|
2746
|
+
o = await Mi(e, a, {
|
|
2747
|
+
moduleName: r,
|
|
2748
|
+
constraintValue: Vi(t, n, e.optionsFromField)
|
|
2749
|
+
});
|
|
2750
|
+
} catch (r) {
|
|
2751
|
+
console.warn(`[optionMembership] could not load options for "${e.field}"`, r), J(t, n, null);
|
|
2752
|
+
return;
|
|
2753
|
+
}
|
|
2754
|
+
if (!o.offList.length) {
|
|
2755
|
+
J(t, n, null);
|
|
2756
|
+
return;
|
|
2757
|
+
}
|
|
2758
|
+
let s = Ni(e, o.offList);
|
|
2759
|
+
throw J(t, n, {
|
|
2760
|
+
field: e.field,
|
|
2761
|
+
label: e.label || e.field,
|
|
2762
|
+
values: o.offList,
|
|
2763
|
+
message: s
|
|
2764
|
+
}), Error(s);
|
|
2765
|
+
} };
|
|
2766
|
+
}
|
|
2767
|
+
function Ui(e, t, { labeled: n = !1, options: r = [] } = {}) {
|
|
2768
|
+
if (!t?.size) return;
|
|
2769
|
+
let i = (e) => r.find((t) => String(t.value) === String(e)) ?? r.find((t) => String(t.label) === String(e)), a = (e) => {
|
|
2770
|
+
let r = e && typeof e == "object" ? e.value : e;
|
|
2771
|
+
if (!t.has(r)) return e;
|
|
2772
|
+
let a = t.get(r);
|
|
2773
|
+
if (!n) return a;
|
|
2774
|
+
let o = i(a);
|
|
2775
|
+
return {
|
|
2776
|
+
value: o?.value ?? a,
|
|
2777
|
+
label: o?.label ?? String(a)
|
|
2778
|
+
};
|
|
2779
|
+
};
|
|
2780
|
+
return Array.isArray(e) ? e.map(a) : a(e);
|
|
2781
|
+
}
|
|
2782
|
+
function Wi({ field: e, form: t, name: n, moduleName: r, value: i, constraintValue: a, enabled: o = !0 }) {
|
|
2783
|
+
let s = !!(o && t && n !== void 0 && wi(e)), c = s ? JSON.stringify(Ti(i)) : "[]", l = s && e.optionsFromField ? JSON.stringify(a ?? null) : "", u = Li(n);
|
|
2784
|
+
S(() => {
|
|
2785
|
+
if (!s || c === "[]") return;
|
|
2786
|
+
let i = !1;
|
|
2787
|
+
return Mi(e, t.getFieldValue(n), {
|
|
2788
|
+
moduleName: r,
|
|
2789
|
+
constraintValue: a
|
|
2790
|
+
}).then(({ offList: r, snaps: a, options: o }) => {
|
|
2791
|
+
if (i) return;
|
|
2792
|
+
let s = Ui(t.getFieldValue(n), a, {
|
|
2793
|
+
labeled: d(e),
|
|
2794
|
+
options: o
|
|
2795
|
+
});
|
|
2796
|
+
s !== void 0 && t.setFieldValue(n, s), (r.length || s !== void 0 || t.getFieldError(n).length) && t.validateFields([n]).catch(() => {});
|
|
2797
|
+
}).catch(() => {}), () => {
|
|
2798
|
+
i = !0;
|
|
2799
|
+
};
|
|
2800
|
+
}, [
|
|
2801
|
+
s,
|
|
2802
|
+
c,
|
|
2803
|
+
l,
|
|
2804
|
+
u,
|
|
2805
|
+
r,
|
|
2806
|
+
t
|
|
2807
|
+
]), S(() => {
|
|
2808
|
+
if (s) return () => J(t, n, null);
|
|
2809
|
+
}, [
|
|
2810
|
+
s,
|
|
2811
|
+
u,
|
|
2812
|
+
t
|
|
2813
|
+
]);
|
|
2814
|
+
}
|
|
2815
|
+
//#endregion
|
|
2816
|
+
//#region src/components/form/OptionMismatchBanner.jsx
|
|
2817
|
+
function Gi(e, t) {
|
|
2818
|
+
let n = Pi(e, t), r = n?.label || n?.name, i = t.length >= 3 && typeof t[1] == "number";
|
|
2819
|
+
return r ? i ? `${r} #${t[1] + 1}` : r : "";
|
|
2820
|
+
}
|
|
2821
|
+
function Ki({ form: e, groups: t, onJump: n }) {
|
|
2822
|
+
let r = Bi(e);
|
|
2823
|
+
if (!r.length) return null;
|
|
2824
|
+
let i = r.length;
|
|
2825
|
+
return /* @__PURE__ */ O(ve, {
|
|
2826
|
+
type: "error",
|
|
2827
|
+
showIcon: !0,
|
|
2828
|
+
className: "v1-option-mismatch-banner",
|
|
2829
|
+
style: { marginBottom: 16 },
|
|
2830
|
+
message: `${i} ${i === 1 ? "field has a value" : "fields have values"} that ${i === 1 ? "is" : "are"} not in the dropdown list`,
|
|
2831
|
+
description: /* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O("div", {
|
|
2832
|
+
style: { marginBottom: 6 },
|
|
2833
|
+
children: "Choose a valid option for each of these before saving. The value that was read is still shown in the field so you can pick the closest match."
|
|
2834
|
+
}), /* @__PURE__ */ O("ul", {
|
|
2835
|
+
style: {
|
|
2836
|
+
margin: 0,
|
|
2837
|
+
paddingInlineStart: 18
|
|
2838
|
+
},
|
|
2839
|
+
children: r.map((e) => {
|
|
2840
|
+
let r = Gi(t, e.path);
|
|
2841
|
+
return /* @__PURE__ */ k("li", { children: [
|
|
2842
|
+
/* @__PURE__ */ k(De.Link, {
|
|
2843
|
+
onClick: () => n?.(e.path),
|
|
2844
|
+
children: [r ? `${r} → ` : "", e.label]
|
|
2845
|
+
}),
|
|
2846
|
+
": ",
|
|
2847
|
+
e.values.map((e) => `"${e}"`).join(", ")
|
|
2848
|
+
] }, JSON.stringify(e.path));
|
|
2849
|
+
})
|
|
2850
|
+
})] })
|
|
2851
|
+
});
|
|
2852
|
+
}
|
|
2853
|
+
//#endregion
|
|
2854
|
+
//#region src/components/form/optionRowFilters.js
|
|
2855
|
+
var qi = 64;
|
|
2856
|
+
function Ji(e) {
|
|
2857
|
+
if (String(e ?? "").trim() !== "currentUserId") return "";
|
|
2858
|
+
try {
|
|
2859
|
+
return typeof localStorage > "u" ? "" : String(localStorage.getItem("userId") ?? "").trim();
|
|
2860
|
+
} catch {
|
|
2861
|
+
return "";
|
|
2862
|
+
}
|
|
2863
|
+
}
|
|
2864
|
+
var Y = (e) => String(e ?? "").trim().toLowerCase(), Yi = (e) => e != null && String(e).trim() !== "";
|
|
2865
|
+
function Xi(e) {
|
|
2866
|
+
let t = Array.isArray(e) ? e : String(e ?? "").split(",");
|
|
2867
|
+
return new Set(t.map(Y).filter((e) => e !== ""));
|
|
2868
|
+
}
|
|
2869
|
+
function Zi(e, t) {
|
|
2870
|
+
return !t || !Array.isArray(e) || e.length === 0 ? !1 : e.some((e) => Yi(e?.extraData?.[t]));
|
|
2871
|
+
}
|
|
2872
|
+
function Qi(e, t, n) {
|
|
2873
|
+
let r = e?.extraData?.[t];
|
|
2874
|
+
if (!Yi(n)) return r === !0;
|
|
2875
|
+
let i = Xi(n);
|
|
2876
|
+
return i.size === 0 ? r === !0 : i.has(Y(r));
|
|
2877
|
+
}
|
|
2878
|
+
function $i(e, t) {
|
|
2879
|
+
let n = /* @__PURE__ */ new Map();
|
|
2880
|
+
return (Array.isArray(e) ? e : []).forEach((e) => {
|
|
2881
|
+
let r = Y(e?.value);
|
|
2882
|
+
r && n.set(r, Y(e?.extraData?.[t]));
|
|
2883
|
+
}), n;
|
|
2884
|
+
}
|
|
2885
|
+
function ea(e, t, n) {
|
|
2886
|
+
let r = Y(n);
|
|
2887
|
+
if (!r) return !1;
|
|
2888
|
+
let i = /* @__PURE__ */ new Set(), a = Y(e);
|
|
2889
|
+
if (!a) return !1;
|
|
2890
|
+
i.add(a);
|
|
2891
|
+
for (let e = 0; e < qi; e += 1) {
|
|
2892
|
+
let e = t.get(a);
|
|
2893
|
+
if (!e) return !1;
|
|
2894
|
+
if (e === r) return !0;
|
|
2895
|
+
if (i.has(e)) return !1;
|
|
2896
|
+
i.add(e), a = e;
|
|
2897
|
+
}
|
|
2898
|
+
return !1;
|
|
2899
|
+
}
|
|
2900
|
+
function ta(e = {}) {
|
|
2901
|
+
let t = [], n = (e) => {
|
|
2902
|
+
let n = String(e ?? "").trim();
|
|
2903
|
+
n && !t.includes(n) && t.push(n);
|
|
2904
|
+
};
|
|
2905
|
+
return (Array.isArray(e.extraFields) ? e.extraFields : []).forEach(n), n(e.optionsRequireExtraField), n(e.optionsHierarchyParentField), t;
|
|
2906
|
+
}
|
|
2907
|
+
function na(e, t = {}, n = {}) {
|
|
2908
|
+
if (!Array.isArray(e) || e.length === 0) return e;
|
|
2909
|
+
let r = n.source ? `[${n.source}]` : "[optionRowFilters]", i = t.field ?? t.label ?? "(unnamed field)", a = typeof n.warn == "function" ? n.warn : (e) => {
|
|
2910
|
+
typeof console < "u" && console.warn(e);
|
|
2911
|
+
}, o = e, s = String(t.optionsRequireExtraField ?? "").trim();
|
|
2912
|
+
s && (Zi(o, s) ? o = o.filter((e) => Qi(e, s, t.optionsRequireExtraValue)) : a(`${r} "${i}": option filter SKIPPED — no option carried extraData["${s}"], so the value filter could not be applied (the lookup API returned no such extra field). Showing the unfiltered list; this is NOT "nothing matched".`));
|
|
2913
|
+
let c = String(t.optionsHierarchyParentField ?? "").trim();
|
|
2914
|
+
if (c) {
|
|
2915
|
+
let n = String(t.optionsHierarchySelfFrom ?? "").trim() || "currentUserId", s = Ji(n);
|
|
2916
|
+
if (!s) a(`${r} "${i}": hierarchy filter SKIPPED — identity "${n}" could not be resolved (no signed-in user id available). Showing the list unrestricted by reporting line.`);
|
|
2917
|
+
else if (!Zi(e, c)) a(`${r} "${i}": hierarchy filter SKIPPED — no option carried extraData["${c}"], so the reporting chain could not be walked (the lookup API returned no such extra field). Showing the list unrestricted by reporting line; this is NOT "nobody reports to you".`);
|
|
2918
|
+
else {
|
|
2919
|
+
let t = $i(e, c);
|
|
2920
|
+
o = o.filter((e) => ea(e?.value, t, s));
|
|
2921
|
+
}
|
|
2922
|
+
}
|
|
2923
|
+
return o;
|
|
2924
|
+
}
|
|
2925
|
+
//#endregion
|
|
2926
|
+
//#region src/components/form/fieldTooltip.js
|
|
2927
|
+
var ra = (e) => e == null || String(e).trim() === "", ia = (e) => e === !0 || e === 1 || e === "1" || e === "true";
|
|
2928
|
+
function aa(e) {
|
|
2929
|
+
return ra(e?.tooltip) ? ia(e?.infoEnabled) && !ra(e?.infoText) ? String(e.infoText) : "" : String(e.tooltip);
|
|
2930
|
+
}
|
|
2931
|
+
//#endregion
|
|
2932
|
+
//#region src/components/form/autofillValue.js
|
|
2933
|
+
var oa = (e) => e == null || typeof e == "string" && e.trim() === "";
|
|
2934
|
+
function sa(e, t = {}, n = () => void 0) {
|
|
2935
|
+
let { optionKey: r } = t, i = (e ? n(e, r) : void 0) ?? e?.extraData?.[r] ?? null, { fallback: a } = t;
|
|
2936
|
+
return oa(i) && a != null && a !== "" ? a : i;
|
|
2937
|
+
}
|
|
2938
|
+
//#endregion
|
|
2939
|
+
//#region src/components/form/dependentLookupReset.js
|
|
2940
|
+
var ca = Symbol("parentFilterUnseen"), la = (e) => e == null || e === "", ua = (e, t) => String(e ?? "") === String(t ?? "");
|
|
2941
|
+
function da({ previous: e, next: t, currentValue: n, scoped: r = !0 }) {
|
|
2942
|
+
return !(!r || e === ca || ua(e, t) || la(e) || la(n));
|
|
2943
|
+
}
|
|
2944
|
+
//#endregion
|
|
2945
|
+
//#region src/utils/afterSubmitNav.js
|
|
2946
|
+
function fa(e) {
|
|
2947
|
+
return (e ?? []).filter((e) => e?.afterSubmit?.mode).sort((e, t) => (e.order ?? 0) - (t.order ?? 0))[0]?.afterSubmit ?? null;
|
|
2948
|
+
}
|
|
2949
|
+
function pa(e, t, n) {
|
|
2950
|
+
let r = String(e ?? "").trim();
|
|
2951
|
+
return !r || !r.startsWith("/") || r.startsWith("//") || /^[a-z][a-z0-9+.-]*:/i.test(r) ? null : r.replace(/:([A-Za-z_][\w]*)/g, (e, r) => {
|
|
2952
|
+
let i = r === "id" ? t : n?.[r];
|
|
2953
|
+
return encodeURIComponent(i ?? "");
|
|
2954
|
+
});
|
|
2955
|
+
}
|
|
2956
|
+
//#endregion
|
|
2957
|
+
//#region src/utils/backNav.js
|
|
2958
|
+
function ma(e = typeof window < "u" ? window : void 0) {
|
|
2959
|
+
let t = e?.history?.state?.idx;
|
|
2960
|
+
return typeof t == "number" && t > 0;
|
|
2961
|
+
}
|
|
2962
|
+
function ha({ cancelPath: e, cancelPathPriority: t = !1, fallbackPath: n = "/", win: r = typeof window < "u" ? window : void 0 } = {}) {
|
|
2963
|
+
return t && e ? { path: e } : ma(r) ? { back: !0 } : e ? { path: e } : { path: n };
|
|
2964
|
+
}
|
|
2965
|
+
function ga(e, t = {}) {
|
|
2966
|
+
let n = ha(t);
|
|
2967
|
+
return n.back ? e(-1) : e(n.path), n;
|
|
2968
|
+
}
|
|
2969
|
+
//#endregion
|
|
2970
|
+
//#region src/components/form/educationRules.js
|
|
2971
|
+
var X = (e) => e == null ? "" : String(e).trim();
|
|
2972
|
+
function _a(e, t) {
|
|
2973
|
+
let n = e?.regionRules;
|
|
2974
|
+
if (!n || typeof n != "object") return e ?? {};
|
|
2975
|
+
let r = X(t), i = n[r] ?? n[r.toUpperCase()] ?? n.default;
|
|
2976
|
+
return !i || typeof i != "object" ? e ?? {} : {
|
|
2977
|
+
...e,
|
|
2978
|
+
...i
|
|
2979
|
+
};
|
|
2980
|
+
}
|
|
2981
|
+
function va(e) {
|
|
2982
|
+
return e?.allowInProgress !== !1;
|
|
2983
|
+
}
|
|
2984
|
+
function ya(e) {
|
|
2985
|
+
return va(e) ? "" : Sa(e) ? e?.inProgressWarningMessage || e?.inProgressMessage || "In this region an unfinished qualification is not usually accepted when a candidate is put forward for a role. You can still record it here — just be aware it will have to be completed before they can be submitted." : e?.inProgressMessage || "This one needs to be finished before the application can go ahead. Please untick “still ongoing”, or remove the row.";
|
|
2986
|
+
}
|
|
2987
|
+
function ba(e) {
|
|
2988
|
+
return va(e) ? "allow" : X(e?.inProgressSeverity).toLowerCase() === "warn" ? "warn" : "block";
|
|
2989
|
+
}
|
|
2990
|
+
function xa(e) {
|
|
2991
|
+
return ba(e) === "block";
|
|
2992
|
+
}
|
|
2993
|
+
function Sa(e) {
|
|
2994
|
+
return ba(e) === "warn";
|
|
2995
|
+
}
|
|
2996
|
+
function Ca(e) {
|
|
2997
|
+
if (!xa(e)) return null;
|
|
2998
|
+
let t = ya(e);
|
|
2999
|
+
return { validator: (e, n) => n === !0 ? Promise.reject(Error(t)) : Promise.resolve() };
|
|
3000
|
+
}
|
|
3001
|
+
function wa(e, t = {}) {
|
|
3002
|
+
let n = t.tieBreak ?? "endDate", r = t.field ?? "startDate";
|
|
3003
|
+
for (let t of [n, r]) {
|
|
3004
|
+
let n = e?.[t];
|
|
3005
|
+
if (n == null || n === "") continue;
|
|
3006
|
+
let r = A(n);
|
|
3007
|
+
if (r.isValid()) return r.valueOf();
|
|
3008
|
+
}
|
|
3009
|
+
return null;
|
|
3010
|
+
}
|
|
3011
|
+
function Ta(e, t = {}) {
|
|
3012
|
+
let n = t.inProgressField ?? "currentStudyingHere";
|
|
3013
|
+
return !!e?.[n];
|
|
3014
|
+
}
|
|
3015
|
+
function Ea(e = [], t = {}) {
|
|
3016
|
+
let n = (t.direction ?? "desc") === "desc";
|
|
3017
|
+
return e.map((e, n) => ({
|
|
3018
|
+
index: n,
|
|
3019
|
+
key: wa(e, t),
|
|
3020
|
+
ongoing: t.inProgressFirst !== !1 && Ta(e, t)
|
|
3021
|
+
})).slice().sort((e, t) => e.ongoing === t.ongoing ? e.key === null && t.key === null ? e.index - t.index : e.key === null ? 1 : t.key === null ? -1 : e.key === t.key ? e.index - t.index : n ? t.key - e.key : e.key - t.key : e.ongoing ? -1 : 1).map((e) => e.index);
|
|
3022
|
+
}
|
|
3023
|
+
function Da(e, t, n = {}) {
|
|
3024
|
+
if (!Array.isArray(e) || e.length < 2 || t == null || t < 0 || t >= e.length) return null;
|
|
3025
|
+
let r = Ea(e, n).indexOf(t);
|
|
3026
|
+
return r === -1 || r === t ? null : {
|
|
3027
|
+
from: t,
|
|
3028
|
+
to: r,
|
|
3029
|
+
reason: Ta(e[t], n) ? "inProgress" : "outOfOrder"
|
|
3030
|
+
};
|
|
3031
|
+
}
|
|
3032
|
+
var Oa = Object.freeze({
|
|
3033
|
+
inProgress: "You’ve marked this one as still ongoing, so it’s the most recent. Shall we move it to the top? This list reads best newest first.",
|
|
3034
|
+
outOfOrder: "These dates make this the most recent one. Shall we move it to the top? This list reads best newest first.",
|
|
3035
|
+
ok: "Yes, move it up",
|
|
3036
|
+
keep: "No, leave it here"
|
|
3037
|
+
});
|
|
3038
|
+
function ka(e, t = {}) {
|
|
3039
|
+
let n = {
|
|
3040
|
+
...Oa,
|
|
3041
|
+
...t.messages ?? {}
|
|
3042
|
+
};
|
|
3043
|
+
return n[e] ?? n.outOfOrder;
|
|
3044
|
+
}
|
|
3045
|
+
function Aa(e, t = {}) {
|
|
3046
|
+
let n = t.levelField ?? "qualification", r = X(e?.[n]);
|
|
3047
|
+
if (!r) return null;
|
|
3048
|
+
let i = t.levels ?? {}, a = i[r] ?? i[r.toLowerCase()] ?? i[r.toUpperCase()];
|
|
3049
|
+
return Number.isFinite(Number(a)) ? Number(a) : ja(r, t);
|
|
3050
|
+
}
|
|
3051
|
+
function ja(e, t) {
|
|
3052
|
+
let n = Array.isArray(t?.levelPatterns) ? t.levelPatterns : [], r = e.toLowerCase();
|
|
3053
|
+
for (let e of n) {
|
|
3054
|
+
let t = X(e?.match);
|
|
3055
|
+
if (!t) continue;
|
|
3056
|
+
let n;
|
|
3057
|
+
try {
|
|
3058
|
+
n = new RegExp(t, "i");
|
|
3059
|
+
} catch {
|
|
3060
|
+
continue;
|
|
3061
|
+
}
|
|
3062
|
+
if (n.test(r) && Number.isFinite(Number(e.level))) return Number(e.level);
|
|
3063
|
+
}
|
|
3064
|
+
return null;
|
|
3065
|
+
}
|
|
3066
|
+
function Ma(e, t = {}) {
|
|
3067
|
+
return X((t?.levelLabels ?? {})[e]) || X(e);
|
|
3068
|
+
}
|
|
3069
|
+
function Na(e = [], t = {}) {
|
|
3070
|
+
if (!t || t.requireBelow === !1) return [];
|
|
3071
|
+
let n = t.levels ?? {}, r = t.requiredLevels ?? [];
|
|
3072
|
+
if (!r.length) return [];
|
|
3073
|
+
let i = e.map((e) => Aa(e, t)).filter((e) => e !== null);
|
|
3074
|
+
if (!i.length) return [];
|
|
3075
|
+
let a = Math.max(...i), o = [];
|
|
3076
|
+
return r.forEach((e) => {
|
|
3077
|
+
let t = typeof e == "object" ? e.label : e, r = typeof e == "object" && Number.isFinite(Number(e.level)) ? Number(e.level) : Number(n[t]);
|
|
3078
|
+
Number.isFinite(r) && (r >= a || i.includes(r) || o.push(t));
|
|
3079
|
+
}), o;
|
|
3080
|
+
}
|
|
3081
|
+
function Pa(e, t = {}) {
|
|
3082
|
+
let n = Na(e, t);
|
|
3083
|
+
if (!n.length) return "";
|
|
3084
|
+
let r = n.map((e) => Ma(e, t)).join(", ");
|
|
3085
|
+
return (t.message || "You’ve added a higher qualification but not the {missing} below it. Please add that too.").replace("{missing}", r);
|
|
3086
|
+
}
|
|
3087
|
+
async function Fa({ group: e, rows: t, rowIndex: n, move: r, confirm: i }) {
|
|
3088
|
+
let a = e?.orderBy;
|
|
3089
|
+
if (!a || a.confirmMove === !1 || typeof r != "function") return !1;
|
|
3090
|
+
let o = Da(t, n, a);
|
|
3091
|
+
if (!o) return !1;
|
|
3092
|
+
let s = {
|
|
3093
|
+
...Oa,
|
|
3094
|
+
...a.messages ?? {}
|
|
3095
|
+
};
|
|
3096
|
+
return await i({
|
|
3097
|
+
reason: o.reason,
|
|
3098
|
+
title: o.reason === "inProgress" ? "This looks like the most recent one" : "These dates make this the most recent one",
|
|
3099
|
+
body: ka(o.reason, a),
|
|
3100
|
+
okText: s.ok,
|
|
3101
|
+
cancelText: s.keep,
|
|
3102
|
+
from: o.from,
|
|
3103
|
+
to: o.to
|
|
3104
|
+
}) ? (r(o.from, o.to), !0) : !1;
|
|
3105
|
+
}
|
|
3106
|
+
function Ia(e, t) {
|
|
3107
|
+
let n = _a(e, t), r = n?.orderBy?.inProgressField;
|
|
3108
|
+
return r ? {
|
|
3109
|
+
name: n.name,
|
|
3110
|
+
label: n.label ?? n.name,
|
|
3111
|
+
rowsKey: n.payloadKey || n.name,
|
|
3112
|
+
inProgressField: r,
|
|
3113
|
+
severity: ba(n),
|
|
3114
|
+
message: ya(n)
|
|
3115
|
+
} : null;
|
|
3116
|
+
}
|
|
3117
|
+
function La(e = [], t, n) {
|
|
3118
|
+
if (!n) return {
|
|
3119
|
+
severity: "allow",
|
|
3120
|
+
message: "",
|
|
3121
|
+
group: null
|
|
3122
|
+
};
|
|
3123
|
+
let r = null;
|
|
3124
|
+
for (let i of e) {
|
|
3125
|
+
let e = Ia(i, t);
|
|
3126
|
+
if (!(!e || e.severity === "allow") && Ra(n, e.rowsKey).some((t) => Ta(t, e))) {
|
|
3127
|
+
if (e.severity === "block") return {
|
|
3128
|
+
severity: "block",
|
|
3129
|
+
message: e.message,
|
|
3130
|
+
group: e
|
|
3131
|
+
};
|
|
3132
|
+
r ??= {
|
|
3133
|
+
severity: "warn",
|
|
3134
|
+
message: e.message,
|
|
3135
|
+
group: e
|
|
3136
|
+
};
|
|
3137
|
+
}
|
|
3138
|
+
}
|
|
3139
|
+
return r ?? {
|
|
3140
|
+
severity: "allow",
|
|
3141
|
+
message: "",
|
|
3142
|
+
group: null
|
|
3143
|
+
};
|
|
3144
|
+
}
|
|
3145
|
+
function Ra(e, t) {
|
|
3146
|
+
let n = e?.[t];
|
|
3147
|
+
return Array.isArray(n) ? n : Array.isArray(n?.rows) ? n.rows : [];
|
|
3148
|
+
}
|
|
3149
|
+
function za(e) {
|
|
3150
|
+
return String(e?.severity ?? "").toLowerCase() === "block" ? "block" : "warn";
|
|
3151
|
+
}
|
|
3152
|
+
function Ba(e = [], t = {}) {
|
|
3153
|
+
let n = null;
|
|
3154
|
+
for (let r of e) {
|
|
3155
|
+
let e = r?.levelRule;
|
|
3156
|
+
if (!e) continue;
|
|
3157
|
+
let i = Va(t, r);
|
|
3158
|
+
if (!i.length) continue;
|
|
3159
|
+
let a = Pa(i, e);
|
|
3160
|
+
if (a) {
|
|
3161
|
+
if (za(e) === "block") return {
|
|
3162
|
+
severity: "block",
|
|
3163
|
+
message: a,
|
|
3164
|
+
group: r
|
|
3165
|
+
};
|
|
3166
|
+
n ??= {
|
|
3167
|
+
severity: "warn",
|
|
3168
|
+
message: a,
|
|
3169
|
+
group: r
|
|
3170
|
+
};
|
|
3171
|
+
}
|
|
3172
|
+
}
|
|
3173
|
+
return n ?? {
|
|
3174
|
+
severity: "allow",
|
|
3175
|
+
message: "",
|
|
3176
|
+
group: null
|
|
3177
|
+
};
|
|
3178
|
+
}
|
|
3179
|
+
function Va(e, t) {
|
|
3180
|
+
for (let n of [t?.name, t?.payloadKey]) {
|
|
3181
|
+
if (!n) continue;
|
|
3182
|
+
let t = e?.[n];
|
|
3183
|
+
if (Array.isArray(t)) return t;
|
|
3184
|
+
}
|
|
3185
|
+
return [];
|
|
3186
|
+
}
|
|
3187
|
+
//#endregion
|
|
3188
|
+
//#region src/components/form/clearGroupOnChange.js
|
|
3189
|
+
function Ha(e, t) {
|
|
3190
|
+
return Array.isArray(e) && e.length > 1 ? [...e.slice(0, -1), t] : [t];
|
|
3191
|
+
}
|
|
3192
|
+
function Ua(e, t) {
|
|
3193
|
+
let n = e?.field, r = [];
|
|
3194
|
+
e?.clearGroupOnChange && (t instanceof Set ? [...t] : t ?? []).forEach((e) => {
|
|
3195
|
+
e && e !== n && r.push(e);
|
|
3196
|
+
});
|
|
3197
|
+
let i = e?.linkedClearField;
|
|
3198
|
+
return Array.isArray(i) ? i.forEach((e) => {
|
|
3199
|
+
e && e !== n && r.push(e);
|
|
3200
|
+
}) : typeof i == "string" && i.trim() && i.trim() !== n && r.push(i.trim()), [...new Set(r)];
|
|
3201
|
+
}
|
|
3202
|
+
function Wa(e, t, n, r) {
|
|
3203
|
+
let i = Ua(t, r).map((e) => Ha(n, e));
|
|
3204
|
+
return i.forEach((t) => e.setFieldValue(t, null)), i;
|
|
3205
|
+
}
|
|
3206
|
+
//#endregion
|
|
3207
|
+
//#region src/components/form/resolveStoredOptions.js
|
|
3208
|
+
function Ga(e) {
|
|
3209
|
+
return (Array.isArray(e) ? e : [e]).map((e) => e && typeof e == "object" ? e.value ?? e.key ?? e.id : e).filter((e) => e != null && e !== "");
|
|
3210
|
+
}
|
|
3211
|
+
function Ka(e, t = []) {
|
|
3212
|
+
let n = new Set((t ?? []).map((e) => String(e?.value))), r = [];
|
|
3213
|
+
for (let t of Ga(e)) {
|
|
3214
|
+
let e = String(t);
|
|
3215
|
+
!n.has(e) && !r.includes(e) && r.push(e);
|
|
3216
|
+
}
|
|
3217
|
+
return r;
|
|
3218
|
+
}
|
|
3219
|
+
async function qa(e, t) {
|
|
3220
|
+
if (!e?.lookupCollection || !t?.length) return [];
|
|
3221
|
+
let n = new URLSearchParams({
|
|
3222
|
+
collection: e.lookupCollection,
|
|
3223
|
+
displayField: e.displayField ?? "",
|
|
3224
|
+
valueField: e.valueField ?? "_id",
|
|
3225
|
+
values: t.join(",")
|
|
3226
|
+
});
|
|
3227
|
+
e.displayField2 && n.set("displayField2", e.displayField2);
|
|
3228
|
+
let i = await o(r, `/admin/lookup-dropdown-values?${n}`), a = i?.data ?? i ?? [];
|
|
3229
|
+
return Array.isArray(a) ? a : [];
|
|
3230
|
+
}
|
|
3231
|
+
function Ja(e = [], t = []) {
|
|
3232
|
+
if (!t.length) return e;
|
|
3233
|
+
let n = new Set((e ?? []).map((e) => String(e?.value))), r = t.filter((e) => !n.has(String(e?.value))).map((e) => ({
|
|
3234
|
+
...e,
|
|
3235
|
+
resolvedOnly: !0
|
|
3236
|
+
}));
|
|
3237
|
+
return r.length ? [...e, ...r] : e;
|
|
3238
|
+
}
|
|
3239
|
+
//#endregion
|
|
3240
|
+
//#region src/components/form/requireAnyOf.js
|
|
3241
|
+
var Ya = (e) => e == null || e === "" || Array.isArray(e) && e.length === 0 || e === !1;
|
|
3242
|
+
function Xa(e) {
|
|
3243
|
+
let t = e?.requireAnyOf;
|
|
3244
|
+
return Array.isArray(t) ? t.filter((e) => typeof e == "string" && e.trim() !== "") : [];
|
|
3245
|
+
}
|
|
3246
|
+
function Za(e) {
|
|
3247
|
+
return !e || typeof e != "object" ? !1 : Object.values(e).some((e) => !Ya(e));
|
|
3248
|
+
}
|
|
3249
|
+
function Qa({ field: e, getRow: t }) {
|
|
3250
|
+
let n = Xa(e);
|
|
3251
|
+
if (n.length === 0 || !n.includes(e?.field)) return;
|
|
3252
|
+
let r = e.requireAnyOfMessage || `Select at least one of ${n.join(", ")}.`;
|
|
3253
|
+
return { validator: async () => {
|
|
3254
|
+
let e = t?.() ?? {};
|
|
3255
|
+
return Za(e) ? n.some((t) => !Ya(e[t])) ? Promise.resolve() : Promise.reject(Error(r)) : Promise.resolve();
|
|
3256
|
+
} };
|
|
3257
|
+
}
|
|
3258
|
+
function $a(e, t = []) {
|
|
3259
|
+
let n = Xa(e);
|
|
3260
|
+
return n.length === 0 ? t : t.map((t) => n.includes(t?.field) ? {
|
|
3261
|
+
...t,
|
|
3262
|
+
requireAnyOf: n,
|
|
3263
|
+
requireAnyOfMessage: e.requireAnyOfMessage
|
|
3264
|
+
} : t);
|
|
3265
|
+
}
|
|
3266
|
+
//#endregion
|
|
3267
|
+
//#region src/components/form/dateRules.js
|
|
3268
|
+
var Z = (e) => e == null || e === "";
|
|
3269
|
+
function eo(e) {
|
|
3270
|
+
if (!e) return null;
|
|
3271
|
+
if (typeof e.valueOf == "function") {
|
|
3272
|
+
let t = e.valueOf();
|
|
3273
|
+
return Number.isNaN(t) ? null : t;
|
|
3274
|
+
}
|
|
3275
|
+
let t = new Date(e).getTime();
|
|
3276
|
+
return Number.isNaN(t) ? null : t;
|
|
3277
|
+
}
|
|
3278
|
+
function Q(e) {
|
|
3279
|
+
if (!e) return null;
|
|
3280
|
+
let t = A(e);
|
|
3281
|
+
return t.isValid() ? t.startOf("day").valueOf() : null;
|
|
3282
|
+
}
|
|
3283
|
+
function to(e) {
|
|
3284
|
+
if (!e) return null;
|
|
3285
|
+
let t = A(e);
|
|
3286
|
+
return t.isValid() ? t.hour() * 60 + t.minute() : null;
|
|
3287
|
+
}
|
|
3288
|
+
var no = {
|
|
3289
|
+
d: "day",
|
|
3290
|
+
day: "day",
|
|
3291
|
+
days: "day",
|
|
3292
|
+
w: "week",
|
|
3293
|
+
week: "week",
|
|
3294
|
+
weeks: "week",
|
|
3295
|
+
m: "month",
|
|
3296
|
+
mo: "month",
|
|
3297
|
+
month: "month",
|
|
3298
|
+
months: "month",
|
|
3299
|
+
y: "year",
|
|
3300
|
+
yr: "year",
|
|
3301
|
+
year: "year",
|
|
3302
|
+
years: "year"
|
|
3303
|
+
};
|
|
3304
|
+
function ro(e) {
|
|
3305
|
+
if (e == null || e === "") return null;
|
|
3306
|
+
if (typeof e == "object" && !Array.isArray(e)) {
|
|
3307
|
+
let t = Number(e.value ?? e.count ?? e.amount);
|
|
3308
|
+
return !Number.isFinite(t) || t <= 0 ? null : {
|
|
3309
|
+
value: t,
|
|
3310
|
+
unit: no[String(e.unit ?? "month").toLowerCase()] ?? "month"
|
|
3311
|
+
};
|
|
3312
|
+
}
|
|
3313
|
+
let t = String(e).trim().toLowerCase();
|
|
3314
|
+
if (!t) return null;
|
|
3315
|
+
let n = t.match(/^(\d+(?:\.\d+)?)\s*([a-z]*)$/);
|
|
3316
|
+
if (!n) return null;
|
|
3317
|
+
let r = Number(n[1]);
|
|
3318
|
+
return !Number.isFinite(r) || r <= 0 ? null : {
|
|
3319
|
+
value: r,
|
|
3320
|
+
unit: no[n[2]] ?? "month"
|
|
3321
|
+
};
|
|
3322
|
+
}
|
|
3323
|
+
function io(e, t) {
|
|
3324
|
+
let n = e?.minGapFrom ?? e?.gapFrom;
|
|
3325
|
+
if (n && typeof t == "function") {
|
|
3326
|
+
let e = ro(t(n));
|
|
3327
|
+
if (e) return e;
|
|
3328
|
+
}
|
|
3329
|
+
return ro(e?.minGap);
|
|
3330
|
+
}
|
|
3331
|
+
function ao(e, t, n, r) {
|
|
3332
|
+
if (t === null) return null;
|
|
3333
|
+
let i = io(n, r), a = A(t);
|
|
3334
|
+
return i && (a = e === "dateAfterField" ? a.add(i.value, i.unit) : a.subtract(i.value, i.unit)), a.startOf("day").valueOf();
|
|
3335
|
+
}
|
|
3336
|
+
function oo(e, t, n, r, i) {
|
|
3337
|
+
if (t === null || n === null) return !1;
|
|
3338
|
+
let a = ao(e, n, r, i);
|
|
3339
|
+
if (a === null) return !1;
|
|
3340
|
+
let o = !!r?.strict && !io(r, i);
|
|
3341
|
+
return e === "dateAfterField" ? o ? t <= a : t < a : o ? t >= a : t > a;
|
|
3342
|
+
}
|
|
3343
|
+
function so(e, t, n, r) {
|
|
3344
|
+
if (n?.message) return n.message;
|
|
3345
|
+
let i = n?.value ?? n?.compareField ?? n?.field ?? "the paired date", a = io(n, r);
|
|
3346
|
+
if (a) {
|
|
3347
|
+
let n = a.value === 1 ? a.unit : `${a.unit}s`;
|
|
3348
|
+
return e === "dateAfterField" ? `${t} must be at least ${a.value} ${n} after ${i}` : `${t} must be at least ${a.value} ${n} before ${i}`;
|
|
3349
|
+
}
|
|
3350
|
+
return n?.strict ? e === "dateAfterField" ? `${t} must be after ${i}` : `${t} must be before ${i}` : e === "dateAfterField" ? `${t} must be on or after ${i}` : `${t} must be on or before ${i}`;
|
|
3351
|
+
}
|
|
3352
|
+
function co({ type: e, label: t, rule: n, readSibling: r }) {
|
|
3353
|
+
return { validator: async (i, a) => {
|
|
3354
|
+
let o = n?.value ?? n?.compareField ?? n?.field;
|
|
3355
|
+
if (!o || Z(a)) return Promise.resolve();
|
|
3356
|
+
let s = r(o);
|
|
3357
|
+
if (Z(s)) return Promise.resolve();
|
|
3358
|
+
let c = Q(a), l = Q(s);
|
|
3359
|
+
return c === null || l === null ? Promise.resolve() : oo(e, c, l, n, r) ? Promise.reject(Error(so(e, t, n, r))) : Promise.resolve();
|
|
3360
|
+
} };
|
|
3361
|
+
}
|
|
3362
|
+
function lo(e, t, { rows: n, rowIndex: r } = {}) {
|
|
3363
|
+
if (e === null || !t || !Array.isArray(n) || r == null || (t.mode ?? "newestFirst") !== "newestFirst") return !1;
|
|
3364
|
+
let i = t.startField ?? "startDate", a = t.endField ?? "endDate", o = n[r - 1];
|
|
3365
|
+
if (o) {
|
|
3366
|
+
let t = Q(o[i]);
|
|
3367
|
+
if (t !== null && e >= t) return !0;
|
|
3368
|
+
}
|
|
3369
|
+
let s = n[r + 1];
|
|
3370
|
+
if (s) {
|
|
3371
|
+
let t = Q(s[a]) ?? Q(s[i]);
|
|
3372
|
+
if (t !== null && e <= t) return !0;
|
|
3373
|
+
}
|
|
3374
|
+
return !1;
|
|
3375
|
+
}
|
|
3376
|
+
function uo(e, t = "above", n = void 0) {
|
|
3377
|
+
let r = e?.messages ?? {}, i = t === "below";
|
|
3378
|
+
return (n === "start" ? i ? r.belowStart : r.aboveStart : n === "end" ? i ? r.belowEnd : r.aboveEnd : void 0) || (i ? r.below || "Start date must be after the end date of the entry below it." : n === "end" ? r.above || "End date must be before the start date of the entry above it." : r.above || "This period overlaps the entry above it. Please adjust the dates.");
|
|
3379
|
+
}
|
|
3380
|
+
function fo({ field: e, readSibling: t, rows: n, rowIndex: r, now: i = b }) {
|
|
3381
|
+
let a = e?.validations ?? e?.validation ?? e?.rules ?? [], o = [];
|
|
3382
|
+
for (let e of a) {
|
|
3383
|
+
let n = typeof e == "string" ? { type: e } : e, r = n?.type;
|
|
3384
|
+
if (r === "noPastDate" && o.push((e) => e ? Q(e) < i().startOf("day").valueOf() : !1), r === "noFutureDate" && o.push((e) => e ? Q(e) > i().startOf("day").valueOf() : !1), r === "minAge") {
|
|
3385
|
+
let e = Number(n?.value ?? 18);
|
|
3386
|
+
o.push((t) => t ? Q(t) > i().subtract(e, "year").startOf("day").valueOf() : !1);
|
|
3387
|
+
}
|
|
3388
|
+
if (r === "dateAfterField" || r === "dateBeforeField") {
|
|
3389
|
+
let e = n?.value ?? n?.compareField ?? n?.field;
|
|
3390
|
+
if (!e) continue;
|
|
3391
|
+
o.push((i) => {
|
|
3392
|
+
if (!i) return !1;
|
|
3393
|
+
let a = t(e);
|
|
3394
|
+
return !Z(a) && oo(r, Q(i), Q(a), n, t);
|
|
3395
|
+
});
|
|
3396
|
+
}
|
|
3397
|
+
}
|
|
3398
|
+
return e?.rowHierarchy && Array.isArray(n) && r != null && o.push((t) => t ? lo(Q(t), e.rowHierarchy, {
|
|
3399
|
+
rows: n,
|
|
3400
|
+
rowIndex: r
|
|
3401
|
+
}) : !1), o.length ? (e) => o.some((t) => t(e)) : void 0;
|
|
3402
|
+
}
|
|
3403
|
+
function po(e, t = b, n = void 0, r = void 0) {
|
|
3404
|
+
if (!Z(n) && Q(n) !== null) return;
|
|
3405
|
+
let i, a = e?.validations ?? e?.validation ?? e?.rules ?? [];
|
|
3406
|
+
for (let e of a) {
|
|
3407
|
+
let n = typeof e == "string" ? { type: e } : e;
|
|
3408
|
+
if (n?.type === "minAge") {
|
|
3409
|
+
i = t().subtract(Number(n?.value ?? 18), "year");
|
|
3410
|
+
break;
|
|
3411
|
+
}
|
|
3412
|
+
if (n?.type === "noFutureDate" || n?.type === "noPastDate") {
|
|
3413
|
+
i = t();
|
|
3414
|
+
break;
|
|
3415
|
+
}
|
|
3416
|
+
}
|
|
3417
|
+
if (typeof r != "function") return i;
|
|
3418
|
+
let o = A(i ?? t()), s = mo(o, r);
|
|
3419
|
+
return !s || s.isSame(o, "month") ? i : s;
|
|
3420
|
+
}
|
|
3421
|
+
function mo(e, t, n = 240) {
|
|
3422
|
+
let r = A(e).startOf("day");
|
|
3423
|
+
if (!r.isValid() || typeof t != "function") return null;
|
|
3424
|
+
let i = (e) => {
|
|
3425
|
+
try {
|
|
3426
|
+
return !t(e);
|
|
3427
|
+
} catch {
|
|
3428
|
+
return !1;
|
|
3429
|
+
}
|
|
3430
|
+
}, a = (e) => {
|
|
3431
|
+
let t = null, n = Infinity, a = e.startOf("month"), o = a.daysInMonth();
|
|
3432
|
+
for (let e = 0; e < o; e += 1) {
|
|
3433
|
+
let o = a.add(e, "day");
|
|
3434
|
+
if (!i(o)) continue;
|
|
3435
|
+
let s = Math.abs(o.diff(r, "day"));
|
|
3436
|
+
s < n && (t = o, n = s);
|
|
3437
|
+
}
|
|
3438
|
+
return t ? {
|
|
3439
|
+
day: t,
|
|
3440
|
+
gap: n
|
|
3441
|
+
} : null;
|
|
3442
|
+
};
|
|
3443
|
+
for (let e = 0; e <= n; e += 1) {
|
|
3444
|
+
let t = (e === 0 ? [a(r)] : [a(r.subtract(e, "month")), a(r.add(e, "month"))]).filter(Boolean);
|
|
3445
|
+
if (t.length) return t.reduce((e, t) => t.gap < e.gap ? t : e).day;
|
|
3446
|
+
}
|
|
3447
|
+
return null;
|
|
3448
|
+
}
|
|
3449
|
+
function ho({ field: e, name: t, rows: n }) {
|
|
3450
|
+
if (!Array.isArray(t) || t.length === 0) return [];
|
|
3451
|
+
let r = t[t.length - 1], i = t.length >= 3 && typeof t[1] == "number", a = /* @__PURE__ */ new Set(), o = e?.validations ?? e?.validation ?? e?.rules ?? [];
|
|
3452
|
+
for (let e of o) {
|
|
3453
|
+
let t = typeof e == "string" ? { type: e } : e;
|
|
3454
|
+
if (t?.type === "dateBeforeField" || t?.type === "dateAfterField") {
|
|
3455
|
+
let e = t?.value ?? t?.compareField ?? t?.field;
|
|
3456
|
+
e && a.add(e);
|
|
3457
|
+
}
|
|
3458
|
+
}
|
|
3459
|
+
let s = e?.rowHierarchy, c = s?.startField ?? "startDate", l = s?.endField ?? "endDate";
|
|
3460
|
+
s && (a.add(c), a.add(l));
|
|
3461
|
+
let u = [];
|
|
3462
|
+
for (let e of a) e !== r && u.push(i ? [
|
|
3463
|
+
t[0],
|
|
3464
|
+
t[1],
|
|
3465
|
+
e
|
|
3466
|
+
] : [...t.slice(0, -1), e]);
|
|
3467
|
+
if (s && i && Array.isArray(n)) for (let e of [t[1] - 1, t[1] + 1]) e < 0 || e >= n.length || (u.push([
|
|
3468
|
+
t[0],
|
|
3469
|
+
e,
|
|
3470
|
+
c
|
|
3471
|
+
]), u.push([
|
|
3472
|
+
t[0],
|
|
3473
|
+
e,
|
|
3474
|
+
l
|
|
3475
|
+
]));
|
|
3476
|
+
return u;
|
|
3477
|
+
}
|
|
3478
|
+
function go({ field: e, rows: t, rowIndex: n }) {
|
|
3479
|
+
let r = e?.rowHierarchy;
|
|
3480
|
+
return { validator: async (i, a) => {
|
|
3481
|
+
if (!r || Z(a) || !Array.isArray(t) || n == null) return Promise.resolve();
|
|
3482
|
+
let o = Q(a);
|
|
3483
|
+
if (o === null || !lo(o, r, {
|
|
3484
|
+
rows: t,
|
|
3485
|
+
rowIndex: n
|
|
3486
|
+
})) return Promise.resolve();
|
|
3487
|
+
let s = r.startField ?? "startDate", c = t[n - 1], l = c ? Q(c[s]) : null, u = l !== null && o >= l ? "above" : "below", d = r.endField ?? "endDate", f = e?.field, p = f === s ? "start" : f === d ? "end" : void 0;
|
|
3488
|
+
return Promise.reject(Error(uo(r, u, p)));
|
|
3489
|
+
} };
|
|
3490
|
+
}
|
|
3491
|
+
//#endregion
|
|
3492
|
+
//#region src/utils/submitMessages.js
|
|
3493
|
+
function _o(e) {
|
|
3494
|
+
return (e ?? []).filter((e) => e?.submitMessages && typeof e.submitMessages == "object").sort((e, t) => (e.order ?? 0) - (t.order ?? 0))[0]?.submitMessages ?? null;
|
|
3495
|
+
}
|
|
3496
|
+
function $(e) {
|
|
3497
|
+
let t = String(e ?? "").trim();
|
|
3498
|
+
return t ? t.charAt(0).toUpperCase() + t.slice(1) : "Record";
|
|
3499
|
+
}
|
|
3500
|
+
function vo(e, t) {
|
|
3501
|
+
return String(e).replaceAll("${module}", $(t)).replaceAll("${moduleName}", $(t));
|
|
3502
|
+
}
|
|
3503
|
+
function yo(e, t, n) {
|
|
3504
|
+
let r = _o(e);
|
|
3505
|
+
if (r?.suppress) return null;
|
|
3506
|
+
let i = n === "edit" ? r?.editSuccess : r?.addSuccess;
|
|
3507
|
+
return i && String(i).trim() ? vo(i, t) : n === "edit" ? `${$(t)} has Updated successfully` : `${$(t)} has added successfully`;
|
|
3508
|
+
}
|
|
3509
|
+
function bo(e, t, n) {
|
|
3510
|
+
if (!e) return "";
|
|
3511
|
+
let r = "";
|
|
3512
|
+
if (typeof e == "string") {
|
|
3513
|
+
let i = e.trim();
|
|
3514
|
+
if (i.startsWith("{") && i.endsWith("}")) try {
|
|
3515
|
+
return bo(JSON.parse(i), t, n);
|
|
3516
|
+
} catch {}
|
|
3517
|
+
r = i;
|
|
3518
|
+
} else if (e instanceof Error) r = e.message || "";
|
|
3519
|
+
else if (typeof e == "object") {
|
|
3520
|
+
let t = e?.response?.data ?? e?.data ?? e;
|
|
3521
|
+
typeof t == "string" ? r = t : t?.error && typeof t.error == "string" ? r = t.error : t?.message && typeof t.message == "string" ? r = t.message : Array.isArray(t?.errors) && t.errors.length > 0 ? r = t.errors.map((e) => typeof e == "string" ? e : e?.message || e?.msg || JSON.stringify(e)).filter(Boolean).join(", ") : t?.errors && typeof t.errors == "object" ? r = Object.values(t.errors).flat().map((e) => typeof e == "string" ? e : e?.message || JSON.stringify(e)).filter(Boolean).join(", ") : e?.message && typeof e.message == "string" && (r = e.message);
|
|
3522
|
+
}
|
|
3523
|
+
if (!r || typeof r != "string") return "";
|
|
3524
|
+
if (r = r.replace(/^API\s+\d+:\s*/i, "").replace(/^Error:\s*/i, "").trim(), /failed to fetch/i.test(r) || /network\s*error/i.test(r) || /load failed/i.test(r) || /network request failed/i.test(r)) return "Unable to connect to the server. Please check your network connection.";
|
|
3525
|
+
if (/E11000\s+duplicate\s+key/i.test(r)) {
|
|
3526
|
+
let e = r.match(/dup key:\s*(\{.*?\})/);
|
|
3527
|
+
return e ? `Duplicate record detected: A record with ${e[1]} already exists.` : "A record with these unique details already exists.";
|
|
3528
|
+
}
|
|
3529
|
+
return r;
|
|
3530
|
+
}
|
|
3531
|
+
function xo(e, t, n, r) {
|
|
3532
|
+
let i = bo(r, t, n);
|
|
3533
|
+
if (i && String(i).trim()) return i;
|
|
3534
|
+
let a = _o(e), o = n === "edit" ? a?.editError : a?.addError;
|
|
3535
|
+
return o && String(o).trim() ? vo(o, t) : n === "edit" ? `Failed to update ${$(t)}` : `Failed to create ${$(t)}`;
|
|
3536
|
+
}
|
|
3537
|
+
//#endregion
|
|
3538
|
+
//#region src/utils/scrollToFirstFormError.js
|
|
3539
|
+
function So({ errorFields: e } = {}, t, { root: n = document } = {}) {
|
|
3540
|
+
if (!e?.length) return;
|
|
3541
|
+
let r = e[0]?.name;
|
|
3542
|
+
setTimeout(() => {
|
|
3543
|
+
if (t?.scrollToField && r !== void 0) try {
|
|
3544
|
+
t.scrollToField(r, {
|
|
3545
|
+
behavior: "smooth",
|
|
3546
|
+
block: "center"
|
|
3547
|
+
});
|
|
3548
|
+
} catch {}
|
|
3549
|
+
let e = (n ?? document).querySelector(".ant-form-item-has-error");
|
|
3550
|
+
if (!e) return;
|
|
3551
|
+
let i = e.querySelector("input, textarea, select, .ProseMirror"), a = i ?? e;
|
|
3552
|
+
a.scrollIntoView({
|
|
3553
|
+
behavior: "smooth",
|
|
3554
|
+
block: "center"
|
|
3555
|
+
}), setTimeout(() => {
|
|
3556
|
+
i?.focus?.({ preventScroll: !0 }), a.style.boxShadow = "0 0 0 3px rgba(255, 77, 79, 0.3)", setTimeout(() => {
|
|
3557
|
+
a.style.boxShadow = "";
|
|
3558
|
+
}, 1200);
|
|
3559
|
+
}, 350);
|
|
3560
|
+
}, 60);
|
|
3561
|
+
}
|
|
3562
|
+
//#endregion
|
|
3563
|
+
//#region src/components/form/conditionalRequired.js
|
|
3564
|
+
function Co(e, t) {
|
|
3565
|
+
return (n) => {
|
|
3566
|
+
if (!e || !n) return;
|
|
3567
|
+
let r = Array.isArray(t) && t.length > 1 ? [...t.slice(0, -1), n] : [n], i = e.getFieldValue(r);
|
|
3568
|
+
return i === void 0 ? e.getFieldValue([n]) : i;
|
|
3569
|
+
};
|
|
3570
|
+
}
|
|
3571
|
+
function wo(e, t, n) {
|
|
3572
|
+
let r = e?.requiredWhen;
|
|
3573
|
+
return !r || !t || !r.field && !(r.conditions ?? []).some((e) => e?.field) ? !1 : v(r, Co(t, n));
|
|
3574
|
+
}
|
|
3575
|
+
function To(e, t, n) {
|
|
3576
|
+
return { validator: (r, i) => {
|
|
3577
|
+
if (!wo(e, t, n) || !(i == null || i === "" || Array.isArray(i) && i.length === 0)) return Promise.resolve();
|
|
3578
|
+
let a = e?.label ?? e?.field ?? "This field";
|
|
3579
|
+
return Promise.reject(Error(e?.requiredWhen?.message ?? `${a} is required`));
|
|
3580
|
+
} };
|
|
3581
|
+
}
|
|
3582
|
+
//#endregion
|
|
3583
|
+
//#region src/components/Breadcrumb.jsx
|
|
3584
|
+
function Eo({ items: e = [] }) {
|
|
3585
|
+
let t = e.map((t, n) => ({ title: n === e.length - 1 ? /* @__PURE__ */ O(st, {
|
|
3586
|
+
variant: "body",
|
|
3587
|
+
weight: "medium",
|
|
3588
|
+
color: "link",
|
|
3589
|
+
children: t.label
|
|
3590
|
+
}) : /* @__PURE__ */ k(ze, {
|
|
3591
|
+
to: t.href,
|
|
3592
|
+
children: [/* @__PURE__ */ O(st, {
|
|
3593
|
+
variant: "body",
|
|
3594
|
+
color: "secondary",
|
|
3595
|
+
children: t.label
|
|
3596
|
+
}), t.dropdown && /* @__PURE__ */ O(Oe, {})]
|
|
3597
|
+
}) }));
|
|
3598
|
+
return /* @__PURE__ */ O(ye, { items: t });
|
|
3599
|
+
}
|
|
3600
|
+
//#endregion
|
|
3601
|
+
//#region src/components/form/canonicalOption.js
|
|
3602
|
+
var Do = (e) => String(e ?? "").trim().replace(/\s+/g, " ").toLowerCase();
|
|
3603
|
+
function Oo(e = []) {
|
|
3604
|
+
let t = /* @__PURE__ */ new Map();
|
|
3605
|
+
for (let n of e) {
|
|
3606
|
+
if (n == null) continue;
|
|
3607
|
+
let e = typeof n == "object" ? n.value : n;
|
|
3608
|
+
if (e != null && e !== "") for (let r of [n?.label, e]) {
|
|
3609
|
+
let n = Do(r);
|
|
3610
|
+
n && !t.has(n) && t.set(n, e);
|
|
3611
|
+
}
|
|
3612
|
+
}
|
|
3613
|
+
return t;
|
|
3614
|
+
}
|
|
3615
|
+
function ko(e, t) {
|
|
3616
|
+
if (!Array.isArray(e)) {
|
|
3617
|
+
let n = ko([e], t);
|
|
3618
|
+
return n.length ? n[0] : e;
|
|
3619
|
+
}
|
|
3620
|
+
let n = Oo(t), r = /* @__PURE__ */ new Set(), i = [];
|
|
3621
|
+
for (let t of e) {
|
|
3622
|
+
let e = typeof t == "object" && t ? t.value : t, a = n.get(Do(e)) ?? e, o = Do(a);
|
|
3623
|
+
o && r.has(o) || (o && r.add(o), i.push(a));
|
|
3624
|
+
}
|
|
3625
|
+
return i;
|
|
3626
|
+
}
|
|
3627
|
+
//#endregion
|
|
3628
|
+
//#region src/components/form/dependencyBusy.js
|
|
3629
|
+
function Ao(e, t = []) {
|
|
3630
|
+
if (!e) return [];
|
|
3631
|
+
let n = /* @__PURE__ */ new Set();
|
|
3632
|
+
for (let r of t) for (let t of r?.fields ?? []) if (t?.field) {
|
|
3633
|
+
if (t.field === e) for (let e of t.autofillFrom ?? []) e?.targetField && n.add(e.targetField);
|
|
3634
|
+
t.lookupFilterValueFrom === e && n.add(t.field);
|
|
3635
|
+
for (let r of t.prefillWhen ?? []) r?.field === e && n.add(t.field);
|
|
3636
|
+
}
|
|
3637
|
+
return n.delete(e), [...n];
|
|
3638
|
+
}
|
|
3639
|
+
function jo(e, t = []) {
|
|
3640
|
+
return e?.blockWhileResolving ? Ao(e.field, t).length > 0 : !1;
|
|
3641
|
+
}
|
|
3642
|
+
function Mo(e) {
|
|
3643
|
+
let t = String(e?.label ?? "").trim();
|
|
3644
|
+
return t ? `Applying ${t}…` : "Applying your selection…";
|
|
3645
|
+
}
|
|
3646
|
+
function No(e, t = []) {
|
|
3647
|
+
if (!e?.field) return [];
|
|
3648
|
+
let n = new Set(Ao(e.field, t));
|
|
3649
|
+
if (n.size === 0) return [];
|
|
3650
|
+
let r = [];
|
|
3651
|
+
for (let e of t) {
|
|
3652
|
+
let t = e?.name ?? e?.id;
|
|
3653
|
+
t && (e.fields ?? []).some((e) => e?.field && n.has(e.field)) && r.push(t);
|
|
3654
|
+
}
|
|
3655
|
+
return r;
|
|
3656
|
+
}
|
|
3657
|
+
function Po(e) {
|
|
3658
|
+
return String(e?.blockScope ?? "").toLowerCase() === "group";
|
|
3659
|
+
}
|
|
3660
|
+
//#endregion
|
|
3661
|
+
//#region src/components/form/LinkedRecordFileField.jsx
|
|
3662
|
+
var Fo = x(() => import("./index.js").then((e) => e.n)), Io = x(() => import("./DocumentViewer-BaSdIaiX.js").then((e) => e.n));
|
|
3663
|
+
function Lo(e) {
|
|
3664
|
+
let t = String(e ?? "").split(".").pop()?.toLowerCase();
|
|
3665
|
+
return O(t === "pdf" ? Ne : t === "doc" || t === "docx" ? Fe : Me, { className: "v1-file-chip__icon" });
|
|
3666
|
+
}
|
|
3667
|
+
function Ro({ field: e, recordMeta: t, onLinkedRecordUpdated: n }) {
|
|
3668
|
+
let r = e?.linkedModule, i = e?.linkedFileField, a = C(() => {
|
|
3669
|
+
let n = Vr(r, t);
|
|
3670
|
+
if (n) return n;
|
|
3671
|
+
let i = e?.linkedIdField, a = i ? t?.[i] : "";
|
|
3672
|
+
return a ? String(a) : "";
|
|
3673
|
+
}, [
|
|
3674
|
+
r,
|
|
3675
|
+
t,
|
|
3676
|
+
e?.linkedIdField
|
|
3677
|
+
]), [o, s] = w({
|
|
3678
|
+
loading: !1,
|
|
3679
|
+
fileValue: null
|
|
3680
|
+
}), [c, l] = w(!1), [u, d] = w(!1), [f, p] = w(0), m = ["candidate", "candidates"].includes(r) ? t?.candidateVersionId : void 0;
|
|
3681
|
+
S(() => {
|
|
3682
|
+
if (!a || !r) return;
|
|
3683
|
+
let e = !1;
|
|
3684
|
+
return queueMicrotask(() => {
|
|
3685
|
+
e || s((e) => ({
|
|
3686
|
+
...e,
|
|
3687
|
+
loading: !0
|
|
3688
|
+
}));
|
|
3689
|
+
}), (m ? de({
|
|
3690
|
+
module: "candidates",
|
|
3691
|
+
id: a,
|
|
3692
|
+
candidateVersionId: m
|
|
3693
|
+
}).then((e) => {
|
|
3694
|
+
let t = e.flatMap((e) => e.fields ?? []).find((e) => e.field === i || e.payloadKey === i);
|
|
3695
|
+
return { [i]: t?.value };
|
|
3696
|
+
}) : re(r, a)).then((t) => {
|
|
3697
|
+
e || s({
|
|
3698
|
+
loading: !1,
|
|
3699
|
+
fileValue: t?.[i] ?? null
|
|
3700
|
+
});
|
|
3701
|
+
}).catch(() => {
|
|
3702
|
+
e || s({
|
|
3703
|
+
loading: !1,
|
|
3704
|
+
fileValue: null
|
|
3705
|
+
});
|
|
3706
|
+
}), () => {
|
|
3707
|
+
e = !0;
|
|
3708
|
+
};
|
|
3709
|
+
}, [
|
|
3710
|
+
a,
|
|
3711
|
+
r,
|
|
3712
|
+
i,
|
|
3713
|
+
f,
|
|
3714
|
+
m
|
|
3715
|
+
]);
|
|
3716
|
+
let h = C(() => le(o.fileValue), [o.fileValue])[0], g = !!h, _ = e?.label ?? "File", v = G(r) || "record";
|
|
3717
|
+
if (!a) return /* @__PURE__ */ O("div", {
|
|
3718
|
+
className: "v1-linked-file v1-linked-file--empty",
|
|
3719
|
+
children: /* @__PURE__ */ O("span", { children: e?.unlinkedText ?? `Not available until the ${v} is set.` })
|
|
3720
|
+
});
|
|
3721
|
+
if (o.loading) return /* @__PURE__ */ O("div", {
|
|
3722
|
+
className: "v1-linked-file v1-linked-file--loading",
|
|
3723
|
+
children: /* @__PURE__ */ O(we, { size: "small" })
|
|
3724
|
+
});
|
|
3725
|
+
let ee = h ? {
|
|
3726
|
+
...h,
|
|
3727
|
+
url: h.needsAuthFetch || m ? "" : h.url,
|
|
3728
|
+
authSource: h.needsAuthFetch || m ? {
|
|
3729
|
+
module: r,
|
|
3730
|
+
refId: a,
|
|
3731
|
+
fieldName: i,
|
|
3732
|
+
candidateVersionId: m
|
|
3733
|
+
} : void 0
|
|
3734
|
+
} : null, y = () => d(!1), te = e?.emptyText ?? `No ${_.toLowerCase()} on file yet`, ne = e?.reuploadLabel ?? `${g ? "Reupload" : "Upload"} in ${v}`, b = e?.reuploadWarning ?? `The ${_.toLowerCase()} belongs to the ${v.toLowerCase()}, not to this record. Changing it here updates the ${v.toLowerCase()} everywhere it is used.`;
|
|
3735
|
+
return /* @__PURE__ */ k(D, { children: [
|
|
3736
|
+
/* @__PURE__ */ k("div", {
|
|
3737
|
+
className: `v1-linked-file-row ${g ? "" : "v1-linked-file--empty"}`,
|
|
3738
|
+
children: [/* @__PURE__ */ k("button", {
|
|
3739
|
+
type: "button",
|
|
3740
|
+
className: "v1-linked-file v1-file-chip",
|
|
3741
|
+
disabled: !g,
|
|
3742
|
+
onClick: () => g && l(!0),
|
|
3743
|
+
title: g ? `Preview or download ${h.name}` : te,
|
|
3744
|
+
children: [
|
|
3745
|
+
g ? Lo(h.name) : /* @__PURE__ */ O(Me, { className: "v1-file-chip__icon" }),
|
|
3746
|
+
/* @__PURE__ */ O("span", {
|
|
3747
|
+
className: "v1-file-chip__name",
|
|
3748
|
+
children: g ? h.name : te
|
|
3749
|
+
}),
|
|
3750
|
+
g && /* @__PURE__ */ O(je, {
|
|
3751
|
+
className: "v1-file-chip__action",
|
|
3752
|
+
"aria-hidden": "true"
|
|
3753
|
+
})
|
|
3754
|
+
]
|
|
3755
|
+
}), /* @__PURE__ */ k("button", {
|
|
3756
|
+
type: "button",
|
|
3757
|
+
className: "v1-linked-file__edit-btn",
|
|
3758
|
+
onClick: () => d(!0),
|
|
3759
|
+
title: b,
|
|
3760
|
+
children: [
|
|
3761
|
+
/* @__PURE__ */ O(ke, {}),
|
|
3762
|
+
" ",
|
|
3763
|
+
ne
|
|
3764
|
+
]
|
|
3765
|
+
})]
|
|
3766
|
+
}),
|
|
3767
|
+
c && ee && /* @__PURE__ */ O(fe, {
|
|
3768
|
+
fallback: null,
|
|
3769
|
+
children: /* @__PURE__ */ O(Io, {
|
|
3770
|
+
open: c,
|
|
3771
|
+
onClose: () => l(!1),
|
|
3772
|
+
documents: [ee]
|
|
3773
|
+
})
|
|
3774
|
+
}),
|
|
3775
|
+
u && /* @__PURE__ */ k(T, {
|
|
3776
|
+
open: !0,
|
|
3777
|
+
title: ne,
|
|
3778
|
+
width: "min(1080px, 96vw)",
|
|
3779
|
+
footer: null,
|
|
3780
|
+
destroyOnClose: !0,
|
|
3781
|
+
maskClosable: !1,
|
|
3782
|
+
onCancel: y,
|
|
3783
|
+
styles: { body: {
|
|
3784
|
+
maxHeight: "78vh",
|
|
3785
|
+
overflowY: "auto"
|
|
3786
|
+
} },
|
|
3787
|
+
children: [/* @__PURE__ */ O(ve, {
|
|
3788
|
+
type: "warning",
|
|
3789
|
+
showIcon: !0,
|
|
3790
|
+
message: b,
|
|
3791
|
+
style: { marginBottom: 16 }
|
|
3792
|
+
}), /* @__PURE__ */ O(fe, {
|
|
3793
|
+
fallback: /* @__PURE__ */ O("div", {
|
|
3794
|
+
style: {
|
|
3795
|
+
padding: 48,
|
|
3796
|
+
textAlign: "center"
|
|
3797
|
+
},
|
|
3798
|
+
children: /* @__PURE__ */ O(we, {})
|
|
3799
|
+
}),
|
|
3800
|
+
children: /* @__PURE__ */ O(Fo, {
|
|
3801
|
+
moduleName: r,
|
|
3802
|
+
recordId: a,
|
|
3803
|
+
embedded: !0,
|
|
3804
|
+
breadcrumbItems: [],
|
|
3805
|
+
onCancel: y,
|
|
3806
|
+
onSuccess: () => {
|
|
3807
|
+
y(), p((e) => e + 1), n?.(a);
|
|
3808
|
+
}
|
|
3809
|
+
})
|
|
3810
|
+
})]
|
|
3811
|
+
})
|
|
3812
|
+
] });
|
|
3813
|
+
}
|
|
3814
|
+
Ro.propTypes = {
|
|
3815
|
+
field: j.shape({
|
|
3816
|
+
label: j.string,
|
|
3817
|
+
linkedModule: j.string,
|
|
3818
|
+
linkedFileField: j.string,
|
|
3819
|
+
linkedIdField: j.string,
|
|
3820
|
+
emptyText: j.string,
|
|
3821
|
+
unlinkedText: j.string,
|
|
3822
|
+
reuploadLabel: j.string,
|
|
3823
|
+
reuploadWarning: j.string
|
|
3824
|
+
}).isRequired,
|
|
3825
|
+
recordMeta: j.object,
|
|
3826
|
+
onLinkedRecordUpdated: j.func
|
|
3827
|
+
}, Ro.defaultProps = {
|
|
3828
|
+
recordMeta: void 0,
|
|
3829
|
+
onLinkedRecordUpdated: void 0
|
|
3830
|
+
};
|
|
3831
|
+
//#endregion
|
|
3832
|
+
export { mi as $, R as $t, xa as A, rr as At, da as B, Nn as Bt, qa as C, st as Cn, Sr as Ct, Ca as D, sr as Dt, Wa as E, G as Et, _a as F, qn as Ft, Ki as G, yn as Gt, aa as H, bn as Ht, ga as I, Jn as It, wi as J, hn as Jt, Pi as K, vn as Kt, fa as L, Ln as Lt, La as M, Yn as Mt, Ba as N, Gn as Nt, Ia as O, cr as Ot, Fa as P, Kn as Pt, hi as Q, Jt as Qt, pa as R, In as Rt, Qa as S, ut as Sn, Cr as St, Ka as T, M as Tn, br as Tt, na as U, Cn as Ut, sa as V, Hn as Vt, ta as W, Sn as Wt, Bi as X, $t as Xt, Wi as Y, gn as Yt, di as Z, Qt as Zt, eo as _, St as _n, Pr as _t, jo as a, Rt as an, $r as at, ho as b, gt as bn, jr as bt, wo as c, Pt as cn, Vr as ct, xo as d, jt as dn, Ur as dt, L as en, li as et, yo as f, Tt as fn, qr as ft, po as g, Dt as gn, Fr as gt, go as h, Et as hn, Ir as ht, Mo as i, Ut as in, Zr as it, ya as j, Xn as jt, va as k, er as kt, To as l, It as ln, Wr as lt, co as m, Mt as mn, Rr as mt, Po as n, Vt as nn, ri as nt, ko as o, zt as on, Jr as ot, fo as p, wt as pn, Kr as pt, Hi as q, _n as qt, No as r, Ht as rn, Xr as rt, Eo as s, Lt as sn, Hr as st, Ro as t, Wt as tn, si as tt, So as u, Nt as un, Gr as ut, to as v, xt as vn, Nr as vt, Ja as w, N as wn, yr as wt, $a as x, lt as xn, kr as xt, Z as y, bt as yn, Mr as yt, ca as z, Dn as zt };
|
|
3833
|
+
|
|
3834
|
+
//# sourceMappingURL=LinkedRecordFileField-IXUcG6eb.js.map
|