@nivaro/react 0.3.49 → 0.3.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/InlineGridField.js +166 -105
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +38 -4
- package/dist/shared/components/ItemEditForm.js +5258 -5034
- package/dist/shared/components/QueryTable.js +489 -347
- package/dist/shared/components/ReportView.js +105 -99
- package/dist/shared/components/alerts/AlertManagerView.js +327 -301
- package/dist/shared/components/item-edit/CatalogPickerField.js +1230 -1175
- package/dist/shared/components/item-edit/CloneDialog.js +192 -142
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +58 -53
- package/dist/shared/components/item-edit/FieldRenderer.js +249 -244
- package/dist/shared/components/item-edit/FieldRow.js +402 -370
- package/dist/shared/components/item-edit/FilePickerField.js +315 -307
- package/dist/shared/components/item-edit/InlineGridField.js +92 -90
- package/dist/shared/components/item-edit/InlineTableField.js +3119 -2951
- package/dist/shared/components/item-edit/MidairCollisionDialog.js +175 -0
- package/dist/shared/components/item-edit/PlanGrid.js +162 -162
- package/dist/shared/components/item-edit/PolishFields.js +169 -162
- package/dist/shared/components/item-edit/RecordHeaderActions.js +76 -75
- package/dist/shared/components/item-edit/RecordLiveSync.js +93 -91
- package/dist/shared/components/item-edit/RelationCombobox.js +198 -191
- package/dist/shared/components/item-edit/SummaryPanel.js +282 -259
- package/dist/shared/components/item-edit/UserChip.js +233 -200
- package/dist/shared/components/item-edit/ValidationSummary.js +64 -47
- package/dist/shared/components/item-edit/header-midair.js +51 -0
- package/dist/shared/components/item-edit/helpers.js +181 -155
- package/dist/shared/components/item-edit/line-midair.js +207 -0
- package/dist/shared/components/item-edit/soft-rules.js +27 -0
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/panels/CommentPanel.js +290 -284
- package/dist/shared/components/panels/ItemLockBanner.js +414 -358
- package/dist/shared/components/panels/PipelinePanel.js +1241 -992
- package/dist/shared/components/panels/RecordIntegrityBanner.js +1 -1
- package/dist/shared/components/panels/TaskPanel.js +71 -61
- package/dist/shared/components/panels/TransitionRequirementsDialog.js +569 -439
- package/dist/shared/components/panels/requirement-side-effects.js +40 -0
- package/dist/shared/components/queue/QueueWorklist.js +925 -871
- package/dist/shared/components/queue/column-chooser.js +21 -0
- package/dist/shared/components/queue/live-state-aspect.js +6 -0
- package/dist/shared/components/ui/number-draft-input.js +93 -0
- package/dist/shared/components/widgets/ReviewListWidget.js +191 -166
- package/dist/shared/lib/draft-store.js +48 -34
- package/dist/shared/lib/error-hints.js +1 -0
- package/dist/shared/lib/query-stats.js +60 -60
- package/package.json +1 -1
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { jsxs as n, jsx as
|
|
2
|
-
import { AlertCircle as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { cn as
|
|
5
|
-
const
|
|
6
|
-
function
|
|
7
|
-
items:
|
|
8
|
-
onJump:
|
|
9
|
-
onDismiss:
|
|
1
|
+
import { jsxs as n, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { AlertCircle as S, X as L, Check as I } from "lucide-react";
|
|
3
|
+
import { useState as p, useRef as j } from "react";
|
|
4
|
+
import { cn as s } from "../../lib/utils.js";
|
|
5
|
+
const b = 6;
|
|
6
|
+
function M({
|
|
7
|
+
items: d,
|
|
8
|
+
onJump: k,
|
|
9
|
+
onDismiss: g
|
|
10
10
|
}) {
|
|
11
|
-
const [
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
const [v, c] = p(!1), [l, N] = p(0), m = j(/* @__PURE__ */ new Map());
|
|
12
|
+
for (const e of d) m.current.set(e.field, e);
|
|
13
|
+
if (d.length === 0) return null;
|
|
14
|
+
const t = d.length, w = new Set(d.map((e) => e.field)), a = [...m.current.values()], x = new Set(a.map((e) => e.location).filter(Boolean)), y = x.size > 1 || x.size === 1 && a.some((e) => !e.location), u = v ? a : a.slice(0, b), h = a.length - u.length, f = (e) => {
|
|
15
|
+
const o = d[e];
|
|
16
|
+
o && (k(o.field), N((e + 1) % t), e + 1 >= b && c(!0));
|
|
16
17
|
};
|
|
17
18
|
return /* @__PURE__ */ n(
|
|
18
19
|
"div",
|
|
@@ -23,7 +24,7 @@ function L({
|
|
|
23
24
|
className: "rounded-lg border border-red-200 bg-red-50 px-4 py-2.5 dark:border-red-500/30 dark:bg-red-400/10",
|
|
24
25
|
children: [
|
|
25
26
|
/* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
|
|
26
|
-
/* @__PURE__ */
|
|
27
|
+
/* @__PURE__ */ r(S, { className: "h-3.5 w-3.5 shrink-0 text-red-600 dark:text-red-400", "aria-hidden": !0 }),
|
|
27
28
|
/* @__PURE__ */ n("span", { className: "text-[12.5px] font-medium text-red-800 dark:text-red-300", children: [
|
|
28
29
|
"Can’t save yet — ",
|
|
29
30
|
t,
|
|
@@ -37,63 +38,79 @@ function L({
|
|
|
37
38
|
"button",
|
|
38
39
|
{
|
|
39
40
|
type: "button",
|
|
40
|
-
onClick: () =>
|
|
41
|
+
onClick: () => f(l % t),
|
|
41
42
|
"data-validation-next": !0,
|
|
42
43
|
className: "ml-1 inline-flex h-6 items-center gap-1 rounded-md border border-red-300 bg-white px-2 text-[11px] font-medium text-red-800 hover:bg-red-100 dark:border-red-500/40 dark:bg-transparent dark:text-red-200 dark:hover:bg-red-400/20",
|
|
43
44
|
children: [
|
|
44
45
|
"Next issue (",
|
|
45
|
-
|
|
46
|
+
l % t + 1,
|
|
46
47
|
"/",
|
|
47
48
|
t,
|
|
48
49
|
") →"
|
|
49
50
|
]
|
|
50
51
|
}
|
|
51
52
|
),
|
|
52
|
-
/* @__PURE__ */
|
|
53
|
+
/* @__PURE__ */ r(
|
|
53
54
|
"button",
|
|
54
55
|
{
|
|
55
56
|
type: "button",
|
|
56
|
-
onClick:
|
|
57
|
+
onClick: g,
|
|
57
58
|
"aria-label": "Dismiss",
|
|
58
59
|
className: "ml-auto rounded p-0.5 text-red-500 hover:bg-red-100 hover:text-red-700 dark:text-red-400 dark:hover:bg-red-400/20",
|
|
59
|
-
children: /* @__PURE__ */
|
|
60
|
+
children: /* @__PURE__ */ r(L, { className: "h-3.5 w-3.5" })
|
|
60
61
|
}
|
|
61
62
|
)
|
|
62
63
|
] }),
|
|
63
|
-
/* @__PURE__ */
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
"button",
|
|
73
|
-
{
|
|
74
|
-
type: "button",
|
|
75
|
-
onClick: () => m(a),
|
|
76
|
-
className: "shrink-0 font-medium text-red-800 underline decoration-dotted underline-offset-2 hover:decoration-solid dark:text-red-300",
|
|
77
|
-
children: e.label
|
|
78
|
-
}
|
|
64
|
+
/* @__PURE__ */ r("ul", { className: "nvr-stagger-direct mt-1.5 space-y-0.5", children: u.map((e) => {
|
|
65
|
+
const o = d.findIndex((C) => C.field === e.field), i = !w.has(e.field);
|
|
66
|
+
return /* @__PURE__ */ n(
|
|
67
|
+
"li",
|
|
68
|
+
{
|
|
69
|
+
"data-validation-fixed": i ? "" : void 0,
|
|
70
|
+
className: s(
|
|
71
|
+
"nvr-section-enter flex items-baseline gap-2 rounded-sm px-1 -mx-1 text-[12px]",
|
|
72
|
+
!i && o === l % t && t > 1 && "bg-red-100/70 dark:bg-red-400/15"
|
|
79
73
|
),
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
74
|
+
children: [
|
|
75
|
+
i ? /* @__PURE__ */ n("span", { className: "inline-flex shrink-0 items-center gap-1 font-medium text-emerald-700 line-through decoration-emerald-600/60 dark:text-emerald-400", children: [
|
|
76
|
+
/* @__PURE__ */ r(I, { className: "h-3 w-3 shrink-0 no-underline", "aria-hidden": !0 }),
|
|
77
|
+
e.label
|
|
78
|
+
] }) : /* @__PURE__ */ r(
|
|
79
|
+
"button",
|
|
80
|
+
{
|
|
81
|
+
type: "button",
|
|
82
|
+
onClick: () => f(o),
|
|
83
|
+
className: "shrink-0 font-medium text-red-800 underline decoration-dotted underline-offset-2 hover:decoration-solid dark:text-red-300",
|
|
84
|
+
children: e.label
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
/* @__PURE__ */ r(
|
|
88
|
+
"span",
|
|
89
|
+
{
|
|
90
|
+
className: s(
|
|
91
|
+
"min-w-0 flex-1",
|
|
92
|
+
i ? "text-emerald-700/80 dark:text-emerald-400/80" : "text-red-800/90 dark:text-red-200/90"
|
|
93
|
+
),
|
|
94
|
+
children: i ? "Fixed" : e.message
|
|
95
|
+
}
|
|
96
|
+
),
|
|
97
|
+
y && e.location && /* @__PURE__ */ r("span", { className: "shrink-0 text-[11px] text-red-600/80 dark:text-red-400/70", children: e.location })
|
|
98
|
+
]
|
|
99
|
+
},
|
|
100
|
+
e.field
|
|
101
|
+
);
|
|
102
|
+
}) }),
|
|
103
|
+
h > 0 && /* @__PURE__ */ n(
|
|
87
104
|
"button",
|
|
88
105
|
{
|
|
89
106
|
type: "button",
|
|
90
|
-
onClick: () =>
|
|
91
|
-
className:
|
|
107
|
+
onClick: () => c(!0),
|
|
108
|
+
className: s(
|
|
92
109
|
"mt-1 text-[11.5px] font-medium text-red-700 underline decoration-dotted underline-offset-2 dark:text-red-300"
|
|
93
110
|
),
|
|
94
111
|
children: [
|
|
95
112
|
"Show ",
|
|
96
|
-
|
|
113
|
+
h,
|
|
97
114
|
" more"
|
|
98
115
|
]
|
|
99
116
|
}
|
|
@@ -103,5 +120,5 @@ function L({
|
|
|
103
120
|
);
|
|
104
121
|
}
|
|
105
122
|
export {
|
|
106
|
-
|
|
123
|
+
M as ValidationSummary
|
|
107
124
|
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
function l(e) {
|
|
2
|
+
const n = { ...e.draft }, i = { ...e.initial }, t = [], f = [];
|
|
3
|
+
for (const r of e.conflicts)
|
|
4
|
+
i[r.field] = r.current_value, e.takeTheirs.has(r.field) ? (n[r.field] = r.current_value, t.push(r.field)) : (e.mine[r.field] !== void 0 && (n[r.field] = e.mine[r.field]), f.push(r.field));
|
|
5
|
+
return { draft: n, initial: i, theirs: t, kept: f };
|
|
6
|
+
}
|
|
7
|
+
function o(e, n) {
|
|
8
|
+
return e === n || e == null && n == null ? !0 : e == null || n == null ? !1 : typeof e == "string" && typeof n == "number" || typeof e == "number" && typeof n == "string" ? String(e) === String(n) : JSON.stringify(e) === JSON.stringify(n);
|
|
9
|
+
}
|
|
10
|
+
function u(e) {
|
|
11
|
+
const n = e.base ?? {}, i = [];
|
|
12
|
+
for (const [t, f] of Object.entries(e.fields))
|
|
13
|
+
t in n && (o(n[t], e.current[t]) || o(f, e.current[t]) || i.push({ field: t, current_value: e.current[t] }));
|
|
14
|
+
return i;
|
|
15
|
+
}
|
|
16
|
+
function c(e) {
|
|
17
|
+
const n = [];
|
|
18
|
+
for (const [i, t] of e.guard)
|
|
19
|
+
i in e.payload && (o(t, e.current[i]) || o(e.payload[i], e.current[i]) || n.push({ field: i, current_value: e.current[i] }));
|
|
20
|
+
return n;
|
|
21
|
+
}
|
|
22
|
+
function s(e) {
|
|
23
|
+
return e.conflicts.filter((n) => !(n.field in e.payload && o(e.payload[n.field], n.current_value) || e.decided.has(n.field) && o(e.decided.get(n.field), n.current_value)));
|
|
24
|
+
}
|
|
25
|
+
function d(e) {
|
|
26
|
+
const n = Object.keys(e.payload).filter((t) => !t.startsWith("_"));
|
|
27
|
+
if (n.length === 0) return !1;
|
|
28
|
+
const i = new Set(
|
|
29
|
+
e.conflicts.filter((t) => t.field in e.payload && o(e.payload[t.field], t.current_value)).map((t) => t.field)
|
|
30
|
+
);
|
|
31
|
+
return n.every((t) => i.has(t));
|
|
32
|
+
}
|
|
33
|
+
function a(e, n) {
|
|
34
|
+
return Object.assign(new Error("Someone else changed this record since your draft"), {
|
|
35
|
+
status: 409,
|
|
36
|
+
response: {
|
|
37
|
+
code: "MIDAIR_COLLISION",
|
|
38
|
+
message: "Someone else changed this record since your draft was saved",
|
|
39
|
+
conflicts: e,
|
|
40
|
+
latest_revision: n ?? 0
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
export {
|
|
45
|
+
a as clientMidairError,
|
|
46
|
+
s as conflictsNeedingPerson,
|
|
47
|
+
l as resolveHeaderCollision,
|
|
48
|
+
c as restoredDraftCollisions,
|
|
49
|
+
d as saveIsEcho,
|
|
50
|
+
u as staleDraftConflicts
|
|
51
|
+
};
|
|
@@ -1,207 +1,232 @@
|
|
|
1
|
-
import { useRef as
|
|
2
|
-
import { useNivaroClient as
|
|
3
|
-
import { get as
|
|
4
|
-
import { htmlToText as
|
|
5
|
-
function
|
|
6
|
-
if (!
|
|
7
|
-
const i = [
|
|
1
|
+
import { useRef as O, useEffect as A, useState as E } from "react";
|
|
2
|
+
import { useNivaroClient as I, useParentDraft as J } from "../../context.js";
|
|
3
|
+
import { get as q } from "../../lib/commands.js";
|
|
4
|
+
import { htmlToText as C } from "../../lib/sanitize-html.js";
|
|
5
|
+
function z(e, t) {
|
|
6
|
+
if (!e) {
|
|
7
|
+
const i = [t.first_name, t.last_name].filter((l) => l != null && String(l).trim() !== "").join(" ");
|
|
8
8
|
return String(
|
|
9
|
-
|
|
9
|
+
t.name ?? t.title ?? t.label ?? t.type ?? t.description ?? (i || null) ?? t.email ?? t.id ?? ""
|
|
10
10
|
);
|
|
11
11
|
}
|
|
12
|
-
return
|
|
13
|
-
const
|
|
14
|
-
let s =
|
|
15
|
-
for (const
|
|
12
|
+
return e.replace(/\{\{([^}]+)\}\}/g, (i, l) => {
|
|
13
|
+
const c = l.trim().split(".");
|
|
14
|
+
let s = t;
|
|
15
|
+
for (const u of c) {
|
|
16
16
|
if (s == null || typeof s != "object") {
|
|
17
17
|
s = null;
|
|
18
18
|
break;
|
|
19
19
|
}
|
|
20
|
-
s = s[
|
|
20
|
+
s = s[u];
|
|
21
21
|
}
|
|
22
22
|
return String(s ?? "");
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
-
function T(
|
|
26
|
-
if (
|
|
27
|
-
if (typeof
|
|
28
|
-
if (typeof
|
|
25
|
+
function T(e) {
|
|
26
|
+
if (e == null) return null;
|
|
27
|
+
if (typeof e == "object") return e;
|
|
28
|
+
if (typeof e != "string") return null;
|
|
29
29
|
try {
|
|
30
|
-
return JSON.parse(
|
|
30
|
+
return JSON.parse(e);
|
|
31
31
|
} catch {
|
|
32
32
|
return null;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
function
|
|
36
|
-
const
|
|
37
|
-
return Array.isArray(
|
|
35
|
+
function D(e) {
|
|
36
|
+
const t = T(e);
|
|
37
|
+
return Array.isArray(t == null ? void 0 : t.cascade_filters) ? t.cascade_filters : [];
|
|
38
38
|
}
|
|
39
|
-
function
|
|
40
|
-
var
|
|
41
|
-
let
|
|
42
|
-
const i = [], l = [],
|
|
43
|
-
if (
|
|
44
|
-
|
|
39
|
+
function K(e) {
|
|
40
|
+
var u, b;
|
|
41
|
+
let t;
|
|
42
|
+
const i = [], l = [], c = [], s = (o, a) => {
|
|
43
|
+
if (t || (t = {}), o.filter_is_m2m)
|
|
44
|
+
t[o.filter_column] = { _some: a };
|
|
45
45
|
else if (o.filter_column.includes(".")) {
|
|
46
|
-
const
|
|
47
|
-
let
|
|
48
|
-
for (let
|
|
49
|
-
|
|
46
|
+
const _ = o.filter_column.split(".");
|
|
47
|
+
let f = a;
|
|
48
|
+
for (let m = _.length - 1; m >= 1; m--) f = { [_[m]]: f };
|
|
49
|
+
t[_[0]] = o.filter_via_many ? { _some: f } : f;
|
|
50
50
|
} else
|
|
51
|
-
|
|
51
|
+
t[o.filter_column] = a;
|
|
52
52
|
};
|
|
53
|
-
for (const o of
|
|
54
|
-
if ((
|
|
55
|
-
const a =
|
|
53
|
+
for (const o of e.rules) {
|
|
54
|
+
if ((u = e.skipParent) != null && u.call(e, o.parent_field)) continue;
|
|
55
|
+
const a = e.parentValue(o.parent_field);
|
|
56
56
|
if (a != null && a !== "" && !(Array.isArray(a) && a.length === 0)) {
|
|
57
|
-
let
|
|
57
|
+
let f = a;
|
|
58
58
|
if (o.value_map && typeof o.value_map == "object") {
|
|
59
|
-
const y = o.value_map,
|
|
60
|
-
|
|
59
|
+
const y = o.value_map, w = (n) => y[String(n)] ?? o.value_map_default ?? n;
|
|
60
|
+
f = Array.isArray(a) ? [
|
|
61
61
|
...new Set(
|
|
62
|
-
a.flatMap((
|
|
63
|
-
const r =
|
|
62
|
+
a.flatMap((n) => {
|
|
63
|
+
const r = w(n);
|
|
64
64
|
return Array.isArray(r) ? r : [r];
|
|
65
65
|
})
|
|
66
66
|
)
|
|
67
|
-
] :
|
|
67
|
+
] : w(a);
|
|
68
68
|
}
|
|
69
|
-
const
|
|
70
|
-
s(o, o.filter_is_m2m ? { id:
|
|
69
|
+
const m = Array.isArray(f) ? { _in: f } : { _eq: f };
|
|
70
|
+
s(o, o.filter_is_m2m ? { id: m } : m), i.push(String(o.parent_field));
|
|
71
71
|
} else {
|
|
72
|
-
l.push(String(o.parent_field)), o.show_all_if_no_parent === !1 &&
|
|
73
|
-
const
|
|
74
|
-
|
|
72
|
+
l.push(String(o.parent_field)), o.show_all_if_no_parent === !1 && c.push(String(o.parent_field));
|
|
73
|
+
const f = o.value_map || (b = e.parentOptionFilter) == null ? void 0 : b.call(e, o.parent_field);
|
|
74
|
+
f && s(o, f);
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
return { filter:
|
|
77
|
+
return { filter: t, satisfiedParents: i, unsatisfiedParents: l, missingRequiredParents: c };
|
|
78
78
|
}
|
|
79
|
-
function
|
|
80
|
-
const l = (
|
|
81
|
-
(r) => r.many_collection === i && r.many_field ===
|
|
82
|
-
),
|
|
83
|
-
for (const
|
|
84
|
-
if (
|
|
85
|
-
const r =
|
|
86
|
-
r.length && l(
|
|
79
|
+
function W(e, t, i) {
|
|
80
|
+
const l = (n) => t.some(
|
|
81
|
+
(r) => r.many_collection === i && r.many_field === n && !r.junction_field || r.one_collection === i && r.one_field === n
|
|
82
|
+
), c = /* @__PURE__ */ new Map();
|
|
83
|
+
for (const n of e) {
|
|
84
|
+
if (n.hidden) continue;
|
|
85
|
+
const r = D(n.dependency_config);
|
|
86
|
+
r.length && l(n.field) && c.set(n.field, r);
|
|
87
87
|
}
|
|
88
|
-
const s = new Set(
|
|
89
|
-
for (const
|
|
90
|
-
for (const r of
|
|
91
|
-
const
|
|
92
|
-
[...s].filter((
|
|
93
|
-
),
|
|
94
|
-
[...
|
|
95
|
-
),
|
|
96
|
-
if (!
|
|
97
|
-
const r =
|
|
98
|
-
return r.length === 0 || r.some((
|
|
88
|
+
const s = new Set(c.keys());
|
|
89
|
+
for (const n of c.values())
|
|
90
|
+
for (const r of n) l(r.parent_field) && s.add(r.parent_field);
|
|
91
|
+
const u = (n, r) => [...r].filter((S) => S !== n && (c.get(S) ?? []).some((k) => k.parent_field === n)), b = new Set(e.filter((n) => n.required).map((n) => n.field)), o = (n) => b.has(n) && (c.get(n) ?? []).some((r) => r.show_all_if_no_parent !== !0), a = new Set(
|
|
92
|
+
[...s].filter((n) => u(n, s).length === 0 && !o(n))
|
|
93
|
+
), _ = new Set([...s].filter((n) => !a.has(n))), f = new Set(
|
|
94
|
+
[..._].filter((n) => u(n, _).length > 0 || c.has(n))
|
|
95
|
+
), m = [..._].filter((n) => {
|
|
96
|
+
if (!f.has(n)) return !1;
|
|
97
|
+
const r = u(n, s);
|
|
98
|
+
return r.length === 0 || r.some((S) => _.has(S));
|
|
99
99
|
});
|
|
100
|
-
if (
|
|
100
|
+
if (m.length > 0) {
|
|
101
101
|
s.clear();
|
|
102
|
-
for (const
|
|
102
|
+
for (const n of m) s.add(n);
|
|
103
103
|
}
|
|
104
|
-
const y = [],
|
|
105
|
-
for (;
|
|
106
|
-
let
|
|
107
|
-
for (const
|
|
108
|
-
const
|
|
109
|
-
if (
|
|
110
|
-
(
|
|
104
|
+
const y = [], w = new Set(s);
|
|
105
|
+
for (; w.size; ) {
|
|
106
|
+
let n = null, r = Number.POSITIVE_INFINITY;
|
|
107
|
+
for (const S of [...w].sort()) {
|
|
108
|
+
const k = (c.get(S) ?? []).filter((g) => s.has(g.parent_field));
|
|
109
|
+
if (k.filter(
|
|
110
|
+
(g) => g.show_all_if_no_parent === !1 && !y.includes(g.parent_field)
|
|
111
111
|
).length > 0) continue;
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
).size * 100 +
|
|
115
|
-
|
|
112
|
+
const h = new Set(
|
|
113
|
+
k.map((g) => g.parent_field).filter((g) => !y.includes(g) && g !== S)
|
|
114
|
+
).size * 100 + k.length;
|
|
115
|
+
h < r && (r = h, n = S);
|
|
116
116
|
}
|
|
117
|
-
|
|
118
|
-
(
|
|
119
|
-
var
|
|
120
|
-
return (((
|
|
117
|
+
n == null && (n = [...w].sort(
|
|
118
|
+
(S, k) => {
|
|
119
|
+
var d, p;
|
|
120
|
+
return (((d = c.get(S)) == null ? void 0 : d.length) ?? 0) - (((p = c.get(k)) == null ? void 0 : p.length) ?? 0);
|
|
121
121
|
}
|
|
122
|
-
)[0]), y.push(
|
|
122
|
+
)[0]), y.push(n), w.delete(n);
|
|
123
123
|
}
|
|
124
124
|
return y;
|
|
125
125
|
}
|
|
126
|
-
function
|
|
127
|
-
|
|
128
|
-
|
|
126
|
+
function j(e) {
|
|
127
|
+
if (e == null || e === "") return null;
|
|
128
|
+
if (Array.isArray(e)) return e.map((t) => j(t) ?? "").join(",");
|
|
129
|
+
if (typeof e == "object") {
|
|
130
|
+
const t = e.id;
|
|
131
|
+
return t == null ? JSON.stringify(e) : String(t);
|
|
132
|
+
}
|
|
133
|
+
return String(e);
|
|
134
|
+
}
|
|
135
|
+
function B({
|
|
136
|
+
cascadeRules: e,
|
|
137
|
+
cascadeFilter: t,
|
|
129
138
|
currentValue: i,
|
|
130
139
|
relatedCollection: l,
|
|
131
|
-
missingRequiredParents:
|
|
140
|
+
missingRequiredParents: c,
|
|
132
141
|
onClear: s
|
|
133
142
|
}) {
|
|
134
|
-
const
|
|
135
|
-
a.current = s
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
143
|
+
const u = I(), b = JSON.stringify(t), o = O(void 0), a = O(s);
|
|
144
|
+
a.current = s;
|
|
145
|
+
const _ = J(), f = _ == null ? void 0 : _.dirtyFields, m = e.filter((d) => d.clear_on_parent_change).map((d) => d.parent_field), y = _ ? JSON.stringify(m.map((d) => {
|
|
146
|
+
var p;
|
|
147
|
+
return j((p = _.draft) == null ? void 0 : p[d]);
|
|
148
|
+
})) : "", w = O(void 0), n = O(!1);
|
|
149
|
+
A(() => {
|
|
150
|
+
const d = w.current;
|
|
151
|
+
if (w.current = y, _ && d !== void 0 && d !== y) {
|
|
152
|
+
const h = JSON.parse(d), g = JSON.parse(y);
|
|
153
|
+
m.some((v, N) => h[N] !== g[N] && (!f || f.has(v))) && (n.current = !0);
|
|
154
|
+
}
|
|
155
|
+
const p = o.current;
|
|
156
|
+
if (o.current = b, p !== void 0 && p !== b && m.length !== 0) {
|
|
157
|
+
if (_) {
|
|
158
|
+
if (!n.current) return;
|
|
159
|
+
n.current = !1;
|
|
160
|
+
}
|
|
161
|
+
a.current();
|
|
162
|
+
}
|
|
163
|
+
}, [b, y, e, f]);
|
|
164
|
+
const r = O(null), S = (c ?? []).join(","), k = O(null);
|
|
165
|
+
return A(() => {
|
|
141
166
|
if (i == null || i === "") return;
|
|
142
|
-
const
|
|
143
|
-
(
|
|
167
|
+
const d = (c ?? []).filter(
|
|
168
|
+
(h) => (f == null ? void 0 : f.has(h)) && e.some((g) => g.parent_field === h && g.clear_on_unavailable)
|
|
144
169
|
);
|
|
145
|
-
if (
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
}, [
|
|
149
|
-
if (!
|
|
150
|
-
(
|
|
170
|
+
if (d.length === 0) return;
|
|
171
|
+
const p = `${String(i)}|${d.join(",")}`;
|
|
172
|
+
k.current !== p && (k.current = p, a.current());
|
|
173
|
+
}, [S, i, f, e]), A(() => {
|
|
174
|
+
if (!t || Object.keys(t).length === 0 || !e.some((h) => h.clear_on_unavailable) || i == null || !l || !e.some(
|
|
175
|
+
(h) => h.clear_on_unavailable && (f == null ? void 0 : f.has(h.parent_field))
|
|
151
176
|
)) return;
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
filter: JSON.stringify({ ...
|
|
177
|
+
const p = `${l}|${String(i)}|${b}`;
|
|
178
|
+
r.current !== p && (r.current = p, u.request(
|
|
179
|
+
q(`/items/${l}`, {
|
|
180
|
+
filter: JSON.stringify({ ...t, id: { _eq: i } }),
|
|
156
181
|
limit: 1,
|
|
157
182
|
fields: "id"
|
|
158
183
|
})
|
|
159
|
-
).then((
|
|
160
|
-
(
|
|
184
|
+
).then((h) => {
|
|
185
|
+
(h.data ?? []).length === 0 && a.current();
|
|
161
186
|
}).catch(() => {
|
|
162
|
-
|
|
187
|
+
r.current === p && (r.current = null);
|
|
163
188
|
}));
|
|
164
189
|
}, [
|
|
165
|
-
n,
|
|
166
|
-
h,
|
|
167
190
|
t,
|
|
168
|
-
|
|
191
|
+
b,
|
|
192
|
+
e,
|
|
193
|
+
u,
|
|
169
194
|
i,
|
|
170
195
|
l,
|
|
171
|
-
|
|
196
|
+
f
|
|
172
197
|
]), null;
|
|
173
198
|
}
|
|
174
|
-
function
|
|
175
|
-
const [
|
|
176
|
-
return
|
|
177
|
-
const l =
|
|
199
|
+
function U(e) {
|
|
200
|
+
const [t, i] = E(9999);
|
|
201
|
+
return A(() => {
|
|
202
|
+
const l = e.current;
|
|
178
203
|
if (!l) return;
|
|
179
204
|
i(l.getBoundingClientRect().width);
|
|
180
|
-
const
|
|
205
|
+
const c = new ResizeObserver(([s]) => {
|
|
181
206
|
i(s.contentRect.width);
|
|
182
207
|
});
|
|
183
|
-
return
|
|
184
|
-
}, [
|
|
208
|
+
return c.observe(l), () => c.disconnect();
|
|
209
|
+
}, [e]), t;
|
|
185
210
|
}
|
|
186
|
-
function
|
|
187
|
-
const i = T(
|
|
188
|
-
return
|
|
211
|
+
function Y(e, t) {
|
|
212
|
+
const i = T(e), l = (i == null ? void 0 : i.col_span) ?? 0, c = [3, 4, 6, 12].includes(l) ? l : 12;
|
|
213
|
+
return t < 480 ? 12 : t < 800 ? c <= 6 ? 6 : 12 : c;
|
|
189
214
|
}
|
|
190
|
-
function
|
|
191
|
-
if (!
|
|
215
|
+
function F(e) {
|
|
216
|
+
if (!e) return "";
|
|
192
217
|
try {
|
|
193
|
-
return new Date(String(
|
|
218
|
+
return new Date(String(e)).toISOString().slice(0, 16);
|
|
194
219
|
} catch {
|
|
195
220
|
return "";
|
|
196
221
|
}
|
|
197
222
|
}
|
|
198
|
-
const
|
|
223
|
+
const Q = /* @__PURE__ */ new Set([
|
|
199
224
|
"id",
|
|
200
225
|
"date_created",
|
|
201
226
|
"date_updated",
|
|
202
227
|
"user_created",
|
|
203
228
|
"user_updated"
|
|
204
|
-
]),
|
|
229
|
+
]), $ = /* @__PURE__ */ new Set([
|
|
205
230
|
"__pipeline__",
|
|
206
231
|
"__comments__",
|
|
207
232
|
"__tasks__",
|
|
@@ -211,44 +236,45 @@ const U = /* @__PURE__ */ new Set([
|
|
|
211
236
|
"__owners__",
|
|
212
237
|
"__pdf__",
|
|
213
238
|
"__subtitle__"
|
|
214
|
-
]),
|
|
215
|
-
function
|
|
216
|
-
if (typeof
|
|
217
|
-
const
|
|
218
|
-
if (!
|
|
219
|
-
if (
|
|
239
|
+
]), G = (e) => $.has(e) || e.startsWith("__widget_") && e.endsWith("__"), H = { created: [], updated: [], deleted: [] };
|
|
240
|
+
function V(e) {
|
|
241
|
+
if (typeof e != "string") return null;
|
|
242
|
+
const t = e.trim();
|
|
243
|
+
if (!t) return null;
|
|
244
|
+
if (t.startsWith("{") && /"blocks"\s*:/.test(t))
|
|
220
245
|
try {
|
|
221
|
-
const i = JSON.parse(
|
|
246
|
+
const i = JSON.parse(t);
|
|
222
247
|
if (Array.isArray(i.blocks)) {
|
|
223
248
|
const l = [];
|
|
224
|
-
for (const
|
|
225
|
-
const s =
|
|
249
|
+
for (const c of i.blocks) {
|
|
250
|
+
const s = c.data ?? {};
|
|
226
251
|
typeof s.text == "string" ? l.push(s.text) : Array.isArray(s.items) && l.push(
|
|
227
252
|
s.items.map(
|
|
228
|
-
(
|
|
253
|
+
(u) => typeof u == "string" ? u : String((u == null ? void 0 : u.content) ?? "")
|
|
229
254
|
).filter(Boolean).join(" · ")
|
|
230
255
|
);
|
|
231
256
|
}
|
|
232
|
-
return
|
|
257
|
+
return P(l.join(" ")).trim();
|
|
233
258
|
}
|
|
234
259
|
} catch {
|
|
235
260
|
}
|
|
236
|
-
return /<[a-z][\s\S]*>/i.test(
|
|
261
|
+
return /<[a-z][\s\S]*>/i.test(t) ? P(t).trim() : null;
|
|
237
262
|
}
|
|
238
|
-
const
|
|
263
|
+
const P = C;
|
|
239
264
|
export {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
265
|
+
B as CascadeEffectController,
|
|
266
|
+
H as EMPTY_NESTED_OPS,
|
|
267
|
+
$ as SENTINEL_FIELDS,
|
|
268
|
+
Q as SYSTEM_FIELDS,
|
|
269
|
+
z as applyDisplayTemplate,
|
|
270
|
+
K as buildCascadeFilter,
|
|
271
|
+
j as cascadeParentKey,
|
|
272
|
+
D as getCascadeFilters,
|
|
273
|
+
G as isSentinelKey,
|
|
248
274
|
T as parseJson,
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
275
|
+
Y as resolveColSpan,
|
|
276
|
+
V as richTextToPlain,
|
|
277
|
+
W as seedQuickPickerSteps,
|
|
278
|
+
F as toLocalDatetime,
|
|
279
|
+
U as useContainerWidth
|
|
254
280
|
};
|