@nivaro/react 0.3.47 → 0.3.49
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/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/shared/components/CellCopyLayer.js +81 -44
- package/dist/shared/components/CollectionBrowserView.js +306 -297
- package/dist/shared/components/DataTable.js +3 -3
- package/dist/shared/components/FulfilmentPill.js +98 -78
- package/dist/shared/components/ItemEditForm.js +2830 -2815
- package/dist/shared/components/NotificationSourcesCard.js +151 -147
- package/dist/shared/components/ProfileView.js +72 -70
- package/dist/shared/components/QueryTable.js +3 -3
- package/dist/shared/components/imports/ImportConsole.js +4 -4
- package/dist/shared/components/integrations/console/IntegrationsConsole.js +58 -50
- package/dist/shared/components/item-edit/HeaderTools.js +118 -113
- package/dist/shared/components/item-edit/InlineTableField.js +874 -868
- package/dist/shared/components/layout-editor/settings/ResolveSettings.js +65 -65
- package/dist/shared/components/layout-editor/settings/settings-registry.js +4 -4
- package/dist/shared/components/notifications/DeliveryChips.js +9 -9
- package/dist/shared/components/panels/PipelinePanel.js +73 -71
- package/dist/shared/components/panels/SlaBreachBanner.js +2 -2
- package/dist/shared/components/panels/TransitionRequirementsDialog.js +384 -380
- package/dist/shared/components/profile/PersonProfile.js +23 -21
- package/dist/shared/components/profile/SignedInDevices.js +126 -0
- package/dist/shared/components/queue/QueueItemSheet.js +38 -37
- package/dist/shared/components/support/SupportView.js +1 -1
- package/dist/shared/lib/edit-lock-fields.js +7 -0
- package/dist/shared/lib/reimport-visibility.js +10 -0
- package/package.json +1 -1
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
import { jsx as s, jsxs as _, Fragment as xn } from "react/jsx-runtime";
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { Loader2 as vn, ListChecks as
|
|
4
|
-
import { useState as U, useMemo as T, useEffect as $e, useRef as xe, useCallback as
|
|
5
|
-
import { createPortal as
|
|
6
|
-
import { ChangeReasonDialog as
|
|
2
|
+
import { useQueryClient as Lo, useQuery as Fe, useQueries as Zt } from "@tanstack/react-query";
|
|
3
|
+
import { Loader2 as vn, ListChecks as Xa, SquarePen as Ca, Rows3 as Za, PanelBottomOpen as el, Zap as tl, Clock as $i, History as Rr, AlertTriangle as Gn, ChevronRight as Mo, GripVertical as _o, FileUp as ko, X as No, GripHorizontal as nl, Lock as rl } from "lucide-react";
|
|
4
|
+
import { useState as U, useMemo as T, useEffect as $e, useRef as xe, useCallback as qt, Fragment as qi } from "react";
|
|
5
|
+
import { createPortal as il } from "react-dom";
|
|
6
|
+
import { ChangeReasonDialog as sl, changeReasonChallenge as Ei } from "./ChangeReasonDialog.js";
|
|
7
7
|
import { toast as Se } from "sonner";
|
|
8
|
-
import { useNivaroClient as
|
|
9
|
-
import { get as re, patch as yt, post as Ke, del as
|
|
10
|
-
import { useAfterIdle as
|
|
11
|
-
import { evaluateNumeric as pt, evaluateBoolean as
|
|
8
|
+
import { useNivaroClient as Ur, useDrilldown as ol, useParentDraft as al, useReimportHandler as ll, useItemEditAuth as dl, fieldDrilldownConfig as So } from "../../context.js";
|
|
9
|
+
import { get as re, patch as yt, post as Ke, del as Ko } from "../../lib/commands.js";
|
|
10
|
+
import { useAfterIdle as cl } from "../../lib/defer.js";
|
|
11
|
+
import { evaluateNumeric as pt, evaluateBoolean as ul } from "../../lib/expression.js";
|
|
12
12
|
import { numericIntlOptions as bt } from "../../lib/format-value.js";
|
|
13
|
-
import { useOptionalRealtime as
|
|
14
|
-
import { useRecordReader as
|
|
15
|
-
import { restoreSkippedNote as
|
|
16
|
-
import { userErrorMessage as
|
|
17
|
-
import { titleCase as qe, cn as ve, formatRelative as
|
|
18
|
-
import { formulaInputsChanged as
|
|
19
|
-
import { ImportFromFileButton as
|
|
20
|
-
import { Sheet as
|
|
21
|
-
import { useAddendumO2M as
|
|
22
|
-
import { resolveCompareEndpoint as
|
|
13
|
+
import { useOptionalRealtime as fl } from "../../lib/realtime.js";
|
|
14
|
+
import { useRecordReader as ml } from "../../lib/record-loader.js";
|
|
15
|
+
import { restoreSkippedNote as pl } from "../../lib/restore-skipped.js";
|
|
16
|
+
import { userErrorMessage as Xn } from "../../lib/safe-error.js";
|
|
17
|
+
import { titleCase as qe, cn as ve, formatRelative as $o, toLocalDateString as hl } from "../../lib/utils.js";
|
|
18
|
+
import { formulaInputsChanged as gl } from "../../lib/write-formula.js";
|
|
19
|
+
import { ImportFromFileButton as bl } from "../import/ImportFromFileButton.js";
|
|
20
|
+
import { Sheet as yl, SheetContent as xl, SheetHeader as vl, SheetTitle as wl } from "../ui/sheet.js";
|
|
21
|
+
import { useAddendumO2M as _l, useAddendumView as kl } from "./AddendumFieldContext.js";
|
|
22
|
+
import { resolveCompareEndpoint as Nl, useCompareSeries as Sl, compareColumnClosed as Kt, fmtMoney as Oi, CompareProposalBanner as $l, CompareStripChips as ql, GridStatChip as El, CompareCell as Ii, compareRowFor as Ai, compareColumnSum as Ol, ReconcileAction as Il } from "./CompareSeries.js";
|
|
23
23
|
import { FieldRenderer as yn } from "./FieldRenderer.js";
|
|
24
|
-
import { GridBulkEditDialog as
|
|
25
|
-
import {
|
|
26
|
-
import { NUMBER_FIELD_TYPES as
|
|
27
|
-
import { NestedRelationEditor as
|
|
28
|
-
import { useO2MStaging as
|
|
29
|
-
import { RelationCombobox as
|
|
30
|
-
import { useRowCommentCounts as
|
|
31
|
-
import { RowHistorySheet as
|
|
32
|
-
import { useRowMatches as
|
|
33
|
-
import { RowWatchButton as
|
|
34
|
-
import { RuleProvenanceChip as
|
|
35
|
-
import { resolveOptionFilterTokens as
|
|
36
|
-
function
|
|
24
|
+
import { GridBulkEditDialog as Al } from "./GridBulkEditDialog.js";
|
|
25
|
+
import { parseJson as ji, SENTINEL_FIELDS as Pi, applyDisplayTemplate as Hn, EMPTY_NESTED_OPS as Pr, SYSTEM_FIELDS as qo } from "./helpers.js";
|
|
26
|
+
import { NUMBER_FIELD_TYPES as jl, checkNumberEntry as Tl, changedRowFields as Eo, lineRuleErrors as Ll } from "./line-qty.js";
|
|
27
|
+
import { NestedRelationEditor as Ti } from "./NestedRelationEditor.js";
|
|
28
|
+
import { useO2MStaging as Ml, useLiveRows as Kl, useStagedRelations as Rl } from "./O2MStagingContext.js";
|
|
29
|
+
import { RelationCombobox as Li } from "./RelationCombobox.js";
|
|
30
|
+
import { useRowCommentCounts as Pl, RowCommentButton as Dl } from "./RowComments.js";
|
|
31
|
+
import { RowHistorySheet as Oo, parseImportStamp as Wl } from "./RowHistorySheet.js";
|
|
32
|
+
import { useRowMatches as Ul, RowMatchDot as Io, rowFromCandidate as Jl, RowMatchPanel as zl } from "./RowMatchPanel.js";
|
|
33
|
+
import { RowWatchButton as Ql } from "./RowWatchButton.js";
|
|
34
|
+
import { RuleProvenanceChip as Fl } from "./RuleProvenancePopover.js";
|
|
35
|
+
import { resolveOptionFilterTokens as Ro } from "../../lib/option-filter-tokens.js";
|
|
36
|
+
function Ao(a, f) {
|
|
37
37
|
const v = a[f.field], E = v == null || v === "", z = f.op ?? "eq";
|
|
38
38
|
if (z === "null") return E;
|
|
39
39
|
if (z === "nnull") return !E;
|
|
@@ -44,22 +44,22 @@ function Io(a, f) {
|
|
|
44
44
|
const ne = String(f.value ?? "");
|
|
45
45
|
return z === "neq" ? W !== ne : W === ne;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function Mi(a, f) {
|
|
48
48
|
var E, z;
|
|
49
49
|
if (!(f != null && f.length)) return [];
|
|
50
50
|
const v = [];
|
|
51
51
|
for (const W of f)
|
|
52
|
-
!((E = W == null ? void 0 : W.when) != null && E.field) || !((z = W == null ? void 0 : W.expect) != null && z.field) ||
|
|
52
|
+
!((E = W == null ? void 0 : W.when) != null && E.field) || !((z = W == null ? void 0 : W.expect) != null && z.field) || Ao(a, W.when) && (Ao(a, W.expect) || v.push(W.label || `${W.when.field} vs ${W.expect.field}`));
|
|
53
53
|
return v;
|
|
54
54
|
}
|
|
55
|
-
const
|
|
55
|
+
const Vl = {
|
|
56
56
|
lt: "<",
|
|
57
57
|
gt: ">",
|
|
58
58
|
quot: '"',
|
|
59
59
|
amp: "&",
|
|
60
60
|
"#39": "'"
|
|
61
61
|
};
|
|
62
|
-
function
|
|
62
|
+
function Bl({ children: a }) {
|
|
63
63
|
const [f, v] = U(null);
|
|
64
64
|
return /* @__PURE__ */ _(
|
|
65
65
|
"span",
|
|
@@ -72,9 +72,9 @@ function Vl({ children: a }) {
|
|
|
72
72
|
},
|
|
73
73
|
onMouseLeave: () => v(null),
|
|
74
74
|
children: [
|
|
75
|
-
/* @__PURE__ */ s(
|
|
75
|
+
/* @__PURE__ */ s(Gn, { className: "h-3 w-3 shrink-0 text-amber-500" }),
|
|
76
76
|
/* @__PURE__ */ s("span", { className: "min-w-0 truncate", children: a }),
|
|
77
|
-
f &&
|
|
77
|
+
f && il(
|
|
78
78
|
/* @__PURE__ */ s(
|
|
79
79
|
"div",
|
|
80
80
|
{
|
|
@@ -89,11 +89,11 @@ function Vl({ children: a }) {
|
|
|
89
89
|
}
|
|
90
90
|
);
|
|
91
91
|
}
|
|
92
|
-
function
|
|
92
|
+
function Hl(a) {
|
|
93
93
|
if (typeof a != "string" || !a.trim()) return [];
|
|
94
94
|
const f = a.replace(
|
|
95
95
|
/&(lt|gt|quot|amp|#39);/g,
|
|
96
|
-
(W, ne) =>
|
|
96
|
+
(W, ne) => Vl[ne] ?? ""
|
|
97
97
|
), v = [], E = /"detail"\s*:\s*"((?:[^"\\]|\\.)*)"/g;
|
|
98
98
|
let z = E.exec(f);
|
|
99
99
|
for (; z; ) {
|
|
@@ -110,7 +110,7 @@ function Bl(a) {
|
|
|
110
110
|
}
|
|
111
111
|
return v;
|
|
112
112
|
}
|
|
113
|
-
const
|
|
113
|
+
const Di = /* @__PURE__ */ new Set([
|
|
114
114
|
"alias",
|
|
115
115
|
"o2m",
|
|
116
116
|
"m2m",
|
|
@@ -118,8 +118,8 @@ const Ri = /* @__PURE__ */ new Set([
|
|
|
118
118
|
"presentation",
|
|
119
119
|
"group",
|
|
120
120
|
"divider"
|
|
121
|
-
]),
|
|
122
|
-
function
|
|
121
|
+
]), Yn = "__all__";
|
|
122
|
+
function Po(a, f, v, E) {
|
|
123
123
|
if (f <= 0) return [];
|
|
124
124
|
let z;
|
|
125
125
|
for (v === "front" ? z = Array.from({ length: f }, (J, A) => f - A) : v === "back" ? z = Array.from({ length: f }, (J, A) => A + 1) : v === "shape" && E && E.some((J) => J > 0) ? z = E.slice(0, f).map((J) => Math.max(0, J)) : z = Array.from({ length: f }, () => 1); z.length < f; ) z.push(0);
|
|
@@ -134,13 +134,13 @@ function Ro(a, f, v, E) {
|
|
|
134
134
|
}
|
|
135
135
|
return ne;
|
|
136
136
|
}
|
|
137
|
-
const
|
|
138
|
-
function
|
|
137
|
+
const Ki = 1e3;
|
|
138
|
+
function Yl(a) {
|
|
139
139
|
let f = 0;
|
|
140
140
|
for (let v = 0; v < a.length; v++) f = f * 31 + a.charCodeAt(v) | 0;
|
|
141
141
|
return f;
|
|
142
142
|
}
|
|
143
|
-
function
|
|
143
|
+
function Gl(a) {
|
|
144
144
|
if (a.line_number != null && a.line_number !== "") return `line ${a.line_number}`;
|
|
145
145
|
for (const f of ["year", "name", "title", "label", "number"]) {
|
|
146
146
|
const v = a[f];
|
|
@@ -151,19 +151,19 @@ function Yl(a) {
|
|
|
151
151
|
function Rt(a, f) {
|
|
152
152
|
return pt(a, f);
|
|
153
153
|
}
|
|
154
|
-
function
|
|
154
|
+
function Ri(a, f) {
|
|
155
155
|
return f.map((v) => {
|
|
156
156
|
const E = a[`__m2m_${v}`];
|
|
157
157
|
return String(E !== void 0 ? E ?? "" : a[v] ?? "");
|
|
158
158
|
}).join("\0");
|
|
159
159
|
}
|
|
160
|
-
function
|
|
160
|
+
function Wi(a, f, v, E) {
|
|
161
161
|
return typeof a != "string" ? a : a === "$parent.id" ? v : a.startsWith("$parent.") ? E == null ? void 0 : E[a.slice(8)] : a.startsWith("$row.") ? f[a.slice(5)] : a;
|
|
162
162
|
}
|
|
163
|
-
function
|
|
163
|
+
function Wr(a, f, v, E) {
|
|
164
164
|
const z = {};
|
|
165
165
|
for (const [ne, oe] of Object.entries(a.filters ?? {})) {
|
|
166
|
-
const J =
|
|
166
|
+
const J = Wi(oe, f, v, E);
|
|
167
167
|
if (J == null || J === "") return null;
|
|
168
168
|
if (ne.startsWith("_")) {
|
|
169
169
|
z[ne] = J;
|
|
@@ -180,21 +180,21 @@ function Pr(a, f, v, E) {
|
|
|
180
180
|
}
|
|
181
181
|
const W = {};
|
|
182
182
|
for (const [ne, oe] of Object.entries(a.defaults ?? {})) {
|
|
183
|
-
const J =
|
|
183
|
+
const J = Wi(oe, f, v, E);
|
|
184
184
|
J != null && J !== "" && (W[ne] = J);
|
|
185
185
|
}
|
|
186
186
|
return { query: z, seed: W };
|
|
187
187
|
}
|
|
188
|
-
function
|
|
188
|
+
function Dr(a, f) {
|
|
189
189
|
return f.split(".").reduce(
|
|
190
190
|
(v, E) => v && typeof v == "object" ? v[E] : void 0,
|
|
191
191
|
a
|
|
192
192
|
);
|
|
193
193
|
}
|
|
194
|
-
function
|
|
194
|
+
function Xl(a, f, v) {
|
|
195
195
|
return f === "presence" ? a != null && String(a).trim() !== "" ? "Yes" : "No" : a == null || a === "" ? "—" : f === "currency" && Number.isFinite(Number(a)) ? Number(a).toLocaleString("en-US", bt(v, "currency")) : String(a);
|
|
196
196
|
}
|
|
197
|
-
function
|
|
197
|
+
function Cl({
|
|
198
198
|
config: a,
|
|
199
199
|
relatedCollection: f,
|
|
200
200
|
manyField: v,
|
|
@@ -210,7 +210,7 @@ function Xl({
|
|
|
210
210
|
pendingEdits: L,
|
|
211
211
|
pendingDeletes: Z
|
|
212
212
|
}) {
|
|
213
|
-
const pe =
|
|
213
|
+
const pe = Ur(), [G, Ee] = U(!1), [ze, ie] = U(null), [Oe, he] = U({}), [X, de] = U(null), ge = T(
|
|
214
214
|
() => (a.columns ?? []).map(
|
|
215
215
|
(Q) => typeof Q == "string" ? {
|
|
216
216
|
path: Q,
|
|
@@ -222,7 +222,7 @@ function Xl({
|
|
|
222
222
|
),
|
|
223
223
|
[a.columns]
|
|
224
224
|
), He = T(
|
|
225
|
-
() =>
|
|
225
|
+
() => Ro(a.filter, ne, E),
|
|
226
226
|
[a.filter, ne, E]
|
|
227
227
|
), nt = T(() => {
|
|
228
228
|
const Q = /* @__PURE__ */ new Set(["id"]);
|
|
@@ -295,7 +295,7 @@ function Xl({
|
|
|
295
295
|
const se = ae.get(Q);
|
|
296
296
|
ie(Q);
|
|
297
297
|
try {
|
|
298
|
-
j === null || j === 0 ? (se == null ? void 0 : se.id) != null && await pe.request(
|
|
298
|
+
j === null || j === 0 ? (se == null ? void 0 : se.id) != null && await pe.request(Ko(`/items/${f}/${se.id}`)) : (se == null ? void 0 : se.id) != null ? Number(se[a.value_field]) !== j && await pe.request(
|
|
299
299
|
yt(`/items/${f}/${se.id}`, { [a.value_field]: j })
|
|
300
300
|
) : await pe.request(
|
|
301
301
|
Ke(`/items/${f}`, {
|
|
@@ -311,7 +311,7 @@ function Xl({
|
|
|
311
311
|
}
|
|
312
312
|
}
|
|
313
313
|
function Ze(Q, D, P) {
|
|
314
|
-
return pt(Q, (j) => j in P ? P[j] :
|
|
314
|
+
return pt(Q, (j) => j in P ? P[j] : Dr(D, j));
|
|
315
315
|
}
|
|
316
316
|
function Pe(Q) {
|
|
317
317
|
const D = ae.get(Q), P = Number((D == null ? void 0 : D[a.value_field]) ?? 0) || 0, j = Oe[Q], se = te ? Te(Q).amount : P;
|
|
@@ -336,8 +336,8 @@ function Xl({
|
|
|
336
336
|
children: "Allocate…"
|
|
337
337
|
}
|
|
338
338
|
),
|
|
339
|
-
/* @__PURE__ */ s(
|
|
340
|
-
/* @__PURE__ */ s(
|
|
339
|
+
/* @__PURE__ */ s(yl, { open: G, onOpenChange: Ee, children: /* @__PURE__ */ _(xl, { side: "right", className: "w-[92vw] sm:max-w-[1200px] overflow-y-auto p-0", children: [
|
|
340
|
+
/* @__PURE__ */ s(vl, { className: "border-b border-slate-200 px-5 py-3", children: /* @__PURE__ */ s(wl, { className: "text-[14px]", children: a.title ?? "Allocate" }) }),
|
|
341
341
|
/* @__PURE__ */ _("div", { className: "p-4", children: [
|
|
342
342
|
/* @__PURE__ */ s("p", { className: "mb-2 text-[11px] text-slate-400", children: "Enter an amount to allocate a line — clearing it removes the allocation." }),
|
|
343
343
|
Pt ? /* @__PURE__ */ s("div", { className: "py-10 text-center", children: /* @__PURE__ */ s(vn, { className: "inline h-4 w-4 animate-spin text-slate-400" }) }) : Qe.length === 0 ? /* @__PURE__ */ s("p", { className: "py-10 text-center text-[12px] text-slate-400", children: "No eligible rows for the current record's filters." }) : /* @__PURE__ */ s("div", { className: "overflow-x-auto rounded-lg border border-slate-200", children: /* @__PURE__ */ _("table", { className: "w-full text-left text-[12px]", children: [
|
|
@@ -353,7 +353,7 @@ function Xl({
|
|
|
353
353
|
/* @__PURE__ */ s("th", { className: "whitespace-nowrap px-2.5 py-1.5 text-[11px] font-medium text-slate-500", children: a.value_label ?? "Allocate" })
|
|
354
354
|
] }) }),
|
|
355
355
|
/* @__PURE__ */ s("tbody", { className: "divide-y divide-slate-100", children: (() => {
|
|
356
|
-
const Q = (we) => a.group_by ? String(
|
|
356
|
+
const Q = (we) => a.group_by ? String(Dr(we, a.group_by) ?? "—") : "";
|
|
357
357
|
let D = Qe, P = [];
|
|
358
358
|
a.group_by && (P = [...new Set(Qe.map(Q))], D = P.flatMap(
|
|
359
359
|
(we) => Qe.filter((le) => Q(le) === we)
|
|
@@ -373,18 +373,18 @@ function Xl({
|
|
|
373
373
|
(tt) => Te(String(tt.id)).amount > 0
|
|
374
374
|
).length, N = ge.map(
|
|
375
375
|
(tt) => !!tt.formula || tt.format === "currency"
|
|
376
|
-
), Wt = N.indexOf(!0),
|
|
376
|
+
), Wt = N.indexOf(!0), Et = Wt === -1 ? ge.length : Math.max(1, Wt), Cn = (tt) => {
|
|
377
377
|
const Ye = ge[tt];
|
|
378
|
-
let
|
|
378
|
+
let er = 0;
|
|
379
379
|
for (const _e of me) {
|
|
380
|
-
const _n = Ye.formula ? Ze(Ye.formula, _e, Pe(String(_e.id))) : Number(
|
|
381
|
-
_n !== null && Number.isFinite(_n) && (
|
|
380
|
+
const _n = Ye.formula ? Ze(Ye.formula, _e, Pe(String(_e.id))) : Number(Dr(_e, Ye.path ?? ""));
|
|
381
|
+
_n !== null && Number.isFinite(_n) && (er += _n);
|
|
382
382
|
}
|
|
383
|
-
return
|
|
383
|
+
return er.toLocaleString("en-US", {
|
|
384
384
|
style: "currency",
|
|
385
385
|
currency: "USD"
|
|
386
386
|
});
|
|
387
|
-
},
|
|
387
|
+
}, Zn = me.reduce(
|
|
388
388
|
(tt, Ye) => tt + Pe(String(Ye.id)).__input__,
|
|
389
389
|
0
|
|
390
390
|
);
|
|
@@ -394,7 +394,7 @@ function Xl({
|
|
|
394
394
|
{
|
|
395
395
|
className: "border-b border-slate-200 bg-slate-100/80",
|
|
396
396
|
children: [
|
|
397
|
-
/* @__PURE__ */ s("td", { colSpan:
|
|
397
|
+
/* @__PURE__ */ s("td", { colSpan: Et, className: "px-2 py-1", children: /* @__PURE__ */ _(
|
|
398
398
|
"button",
|
|
399
399
|
{
|
|
400
400
|
type: "button",
|
|
@@ -402,7 +402,7 @@ function Xl({
|
|
|
402
402
|
className: "flex w-full items-center gap-1.5 text-left",
|
|
403
403
|
children: [
|
|
404
404
|
/* @__PURE__ */ s(
|
|
405
|
-
|
|
405
|
+
Mo,
|
|
406
406
|
{
|
|
407
407
|
className: ve(
|
|
408
408
|
"h-3 w-3 shrink-0 text-slate-400 transition-transform",
|
|
@@ -423,15 +423,15 @@ function Xl({
|
|
|
423
423
|
]
|
|
424
424
|
}
|
|
425
425
|
) }),
|
|
426
|
-
ge.slice(
|
|
426
|
+
ge.slice(Et).map((tt, Ye) => /* @__PURE__ */ s(
|
|
427
427
|
"td",
|
|
428
428
|
{
|
|
429
429
|
className: "whitespace-nowrap px-2.5 py-1 text-[11px] font-semibold tabular-nums text-slate-600",
|
|
430
|
-
children: N[
|
|
430
|
+
children: N[Et + Ye] ? Cn(Et + Ye) : ""
|
|
431
431
|
},
|
|
432
432
|
Ye
|
|
433
433
|
)),
|
|
434
|
-
/* @__PURE__ */ s("td", { className: "whitespace-nowrap px-2.5 py-1 text-[11px] font-semibold tabular-nums text-[#0891b2]", children:
|
|
434
|
+
/* @__PURE__ */ s("td", { className: "whitespace-nowrap px-2.5 py-1 text-[11px] font-semibold tabular-nums text-[#0891b2]", children: Zn > 0 ? Zn.toLocaleString("en-US", {
|
|
435
435
|
style: "currency",
|
|
436
436
|
currency: "USD"
|
|
437
437
|
}) : "" })
|
|
@@ -446,7 +446,7 @@ function Xl({
|
|
|
446
446
|
fe.push(
|
|
447
447
|
/* @__PURE__ */ _("tr", { className: ve(wn && "bg-nvr-cyan/5"), children: [
|
|
448
448
|
ge.map((me, O) => {
|
|
449
|
-
const N = me.formula ? et(me.formula, we) :
|
|
449
|
+
const N = me.formula ? et(me.formula, we) : Xl(Dr(we, me.path ?? ""), me.format);
|
|
450
450
|
return /* @__PURE__ */ s(
|
|
451
451
|
"td",
|
|
452
452
|
{
|
|
@@ -498,14 +498,14 @@ function Xl({
|
|
|
498
498
|
] }) })
|
|
499
499
|
] });
|
|
500
500
|
}
|
|
501
|
-
function
|
|
501
|
+
function Zl({
|
|
502
502
|
config: a,
|
|
503
503
|
rows: f,
|
|
504
504
|
relatedCollection: v,
|
|
505
505
|
computedWriteFields: E,
|
|
506
506
|
applyRow: z
|
|
507
507
|
}) {
|
|
508
|
-
const W =
|
|
508
|
+
const W = Ur(), [ne, oe] = U(!1), [J, A] = U(!1), te = async () => {
|
|
509
509
|
A(!1);
|
|
510
510
|
const je = Object.keys(a.set).filter((L) => E.has(L));
|
|
511
511
|
if (je.length > 0) {
|
|
@@ -550,7 +550,7 @@ function Cl({
|
|
|
550
550
|
let Oe = 0, he = 0;
|
|
551
551
|
for (const X of f) {
|
|
552
552
|
const de = { ...X, __agg__: ie(X.id) };
|
|
553
|
-
if (a.guard && !
|
|
553
|
+
if (a.guard && !ul(a.guard, de)) {
|
|
554
554
|
he++;
|
|
555
555
|
continue;
|
|
556
556
|
}
|
|
@@ -608,7 +608,7 @@ function Cl({
|
|
|
608
608
|
}
|
|
609
609
|
);
|
|
610
610
|
}
|
|
611
|
-
function
|
|
611
|
+
function ed({
|
|
612
612
|
config: a,
|
|
613
613
|
matchCfg: f,
|
|
614
614
|
rows: v,
|
|
@@ -617,7 +617,7 @@ function Zl({
|
|
|
617
617
|
relatedCollection: W,
|
|
618
618
|
manyField: ne
|
|
619
619
|
}) {
|
|
620
|
-
const oe =
|
|
620
|
+
const oe = Ur(), J = Lo(), [A, te] = U(!1), [je, L] = U(null), Z = async () => {
|
|
621
621
|
if (A) return;
|
|
622
622
|
te(!0), L(null);
|
|
623
623
|
const pe = a.fk_field, G = a.alloc_qty_field, Ee = a.candidates.min_capacity ?? 1, ze = [
|
|
@@ -629,7 +629,7 @@ function Zl({
|
|
|
629
629
|
for (let ge = 0; ge < v.length; ge++) {
|
|
630
630
|
const He = v[ge], nt = Number(He[a.row_qty_field]);
|
|
631
631
|
if (!Number.isFinite(nt) || nt <= 0) continue;
|
|
632
|
-
const Qe =
|
|
632
|
+
const Qe = Wr(f, He, E, z);
|
|
633
633
|
if (!Qe) continue;
|
|
634
634
|
const Pt = await oe.request(
|
|
635
635
|
re(`/items/${f.collection}`, {
|
|
@@ -640,7 +640,7 @@ function Zl({
|
|
|
640
640
|
).then((D) => D.data ?? []), ae = Pt.reduce((D, P) => D + (Number(P[G]) || 0), 0);
|
|
641
641
|
let Te = nt - ae;
|
|
642
642
|
if (Te <= 0) continue;
|
|
643
|
-
const xt =
|
|
643
|
+
const xt = Wr(
|
|
644
644
|
{
|
|
645
645
|
collection: a.candidates.collection,
|
|
646
646
|
filters: a.candidates.filters,
|
|
@@ -695,7 +695,7 @@ function Zl({
|
|
|
695
695
|
Oe > 0 ? `Allocated ${Oe.toLocaleString("en-US", { maximumFractionDigits: 2 })} across ${he} row${he === 1 ? "" : "s"}` : "Nothing to allocate"
|
|
696
696
|
), X.length > 0 && de.push(`short on row${X.length === 1 ? "" : "s"} ${X.join(", ")}`), L(de.join(" — ")), J.invalidateQueries({ queryKey: ["o2m-rows", W, ne, E] }), J.invalidateQueries({ queryKey: ["match-agg"] });
|
|
697
697
|
} catch (de) {
|
|
698
|
-
L(`Auto-allocate failed: ${
|
|
698
|
+
L(`Auto-allocate failed: ${Xn(de, "unknown error")}`);
|
|
699
699
|
} finally {
|
|
700
700
|
te(!1);
|
|
701
701
|
}
|
|
@@ -714,12 +714,12 @@ function Zl({
|
|
|
714
714
|
je && /* @__PURE__ */ s("span", { className: "text-[11px] text-slate-500", children: je })
|
|
715
715
|
] });
|
|
716
716
|
}
|
|
717
|
-
function
|
|
717
|
+
function td(a) {
|
|
718
718
|
return a.filter(
|
|
719
|
-
(f) => f.group_key === "__apply_values__" && !
|
|
719
|
+
(f) => f.group_key === "__apply_values__" && !Di.has(f.type ?? "") && !Pi.has(f.field) && !f.readonly && !(f.computed_type === "write" && f.computed_formula) && f.interface !== "formula-column" && f.interface !== "match-agg-column" && f.interface !== "relation-path"
|
|
720
720
|
);
|
|
721
721
|
}
|
|
722
|
-
function
|
|
722
|
+
function Dd({
|
|
723
723
|
relatedCollection: a,
|
|
724
724
|
manyField: f,
|
|
725
725
|
parentId: v,
|
|
@@ -762,11 +762,11 @@ function Pd({
|
|
|
762
762
|
emptyLabel: se,
|
|
763
763
|
editorMode: fe
|
|
764
764
|
}) {
|
|
765
|
-
var
|
|
766
|
-
const S =
|
|
765
|
+
var vo, wo;
|
|
766
|
+
const S = Ur(), we = ml(), le = ol(), V = Lo(), k = Ml(), wn = Kl(), Dt = Rl(), me = _l()[P ?? ""] ?? [], O = v === "new", N = al(), Wt = ll(), Et = fl(), Cn = `nvr_grid_editor_${a}_${P ?? f}`, [Zn, tt] = U(() => {
|
|
767
767
|
if (typeof localStorage > "u") return null;
|
|
768
768
|
try {
|
|
769
|
-
const e = localStorage.getItem(
|
|
769
|
+
const e = localStorage.getItem(Cn);
|
|
770
770
|
return e === "split" || e === "drawer" ? e : null;
|
|
771
771
|
} catch {
|
|
772
772
|
return null;
|
|
@@ -776,7 +776,7 @@ function Pd({
|
|
|
776
776
|
queryFn: () => S.request(re(`/field-config/${E}`)).then((e) => e.data ?? []),
|
|
777
777
|
enabled: fe === void 0 && !!E && !!P,
|
|
778
778
|
staleTime: 5 * 6e4
|
|
779
|
-
}),
|
|
779
|
+
}), er = T(() => {
|
|
780
780
|
if (fe) return fe;
|
|
781
781
|
const e = Ye == null ? void 0 : Ye.find((t) => t.field === P), n = e != null && e.options ? typeof e.options == "string" ? (() => {
|
|
782
782
|
try {
|
|
@@ -786,16 +786,16 @@ function Pd({
|
|
|
786
786
|
}
|
|
787
787
|
})() : e.options : {};
|
|
788
788
|
return (n == null ? void 0 : n.editor_mode) === "split" ? "split" : "drawer";
|
|
789
|
-
}, [fe, Ye, P]), _e = !j && (
|
|
789
|
+
}, [fe, Ye, P]), _e = !j && (Zn ?? er) === "split", _n = (e) => {
|
|
790
790
|
tt(e);
|
|
791
791
|
try {
|
|
792
|
-
localStorage.setItem(
|
|
792
|
+
localStorage.setItem(Cn, e);
|
|
793
793
|
} catch {
|
|
794
794
|
}
|
|
795
|
-
},
|
|
795
|
+
}, Jr = `nvr_grid_split_h_${a}`, [tr, Ui] = U(() => {
|
|
796
796
|
if (typeof localStorage > "u") return 320;
|
|
797
797
|
try {
|
|
798
|
-
const e = Number(localStorage.getItem(
|
|
798
|
+
const e = Number(localStorage.getItem(Jr));
|
|
799
799
|
return Number.isFinite(e) && e >= 160 ? Math.min(e, 900) : 320;
|
|
800
800
|
} catch {
|
|
801
801
|
return 320;
|
|
@@ -803,15 +803,15 @@ function Pd({
|
|
|
803
803
|
});
|
|
804
804
|
$e(() => {
|
|
805
805
|
try {
|
|
806
|
-
localStorage.setItem(
|
|
806
|
+
localStorage.setItem(Jr, String(tr));
|
|
807
807
|
} catch {
|
|
808
808
|
}
|
|
809
|
-
}, [
|
|
810
|
-
const
|
|
811
|
-
}),
|
|
809
|
+
}, [tr, Jr]);
|
|
810
|
+
const nr = xe(null), rr = xe(null), Ji = xe(async () => {
|
|
811
|
+
}), zr = xe(
|
|
812
812
|
async () => {
|
|
813
813
|
}
|
|
814
|
-
),
|
|
814
|
+
), ir = xe(null), zi = xe(!1);
|
|
815
815
|
$e(() => {
|
|
816
816
|
if (j || typeof window > "u") return;
|
|
817
817
|
const e = (n) => {
|
|
@@ -819,36 +819,36 @@ function Pd({
|
|
|
819
819
|
if (!t || typeof t.target != "string" || !t.target || E && t.collection !== E) return;
|
|
820
820
|
const r = P ?? f;
|
|
821
821
|
if (!(t.grid !== r && t.grid !== a)) {
|
|
822
|
-
if (t.handled = !0, !
|
|
823
|
-
|
|
822
|
+
if (t.handled = !0, !zi.current) {
|
|
823
|
+
ir.current = { target: t.target, value: t.value ?? null };
|
|
824
824
|
return;
|
|
825
825
|
}
|
|
826
|
-
|
|
826
|
+
zr.current(t.target, t.value ?? null);
|
|
827
827
|
}
|
|
828
828
|
};
|
|
829
829
|
return window.addEventListener("nvr:grid-apply-field", e), () => window.removeEventListener("nvr:grid-apply-field", e);
|
|
830
830
|
}, [j, E, P, f, a]), $e(() => {
|
|
831
|
-
const e =
|
|
831
|
+
const e = rr.current;
|
|
832
832
|
if (!e || !_e) return;
|
|
833
833
|
const n = (t) => {
|
|
834
834
|
if (!Ge.current || t.key !== "ArrowDown" && t.key !== "ArrowUp") return;
|
|
835
835
|
const r = t.target;
|
|
836
836
|
if (!r) return;
|
|
837
837
|
const i = r.tagName;
|
|
838
|
-
i === "INPUT" || i === "SELECT" || i === "TEXTAREA" || r.isContentEditable || r.closest('[role="listbox"],[role="combobox"],[data-nvr-combobox-panel],[role="dialog"]') || (t.preventDefault(),
|
|
838
|
+
i === "INPUT" || i === "SELECT" || i === "TEXTAREA" || r.isContentEditable || r.closest('[role="listbox"],[role="combobox"],[data-nvr-combobox-panel],[role="dialog"]') || (t.preventDefault(), Ji.current(t.key === "ArrowDown" ? 1 : -1));
|
|
839
839
|
};
|
|
840
840
|
return e.addEventListener("keydown", n), () => e.removeEventListener("keydown", n);
|
|
841
841
|
}, [_e]);
|
|
842
|
-
const [en,
|
|
842
|
+
const [en, Wo] = U(!1), [Ut, sr] = U(/* @__PURE__ */ new Set()), [Uo, Qi] = U(!1), Fi = (e) => sr((n) => {
|
|
843
843
|
const t = new Set(n);
|
|
844
844
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
845
|
-
}),
|
|
845
|
+
}), Vi = Q ? Q.line_field ?? "line_number" : null, { data: or } = Fe({
|
|
846
846
|
queryKey: ["erp-submissions", E ?? "", String(v)],
|
|
847
847
|
queryFn: () => S.request(re(`/erp-submissions/${E}/${encodeURIComponent(String(v))}`)).then((e) => e.data ?? []),
|
|
848
848
|
enabled: !!Q && !!E && !O && !!v,
|
|
849
849
|
staleTime: 15e3
|
|
850
|
-
}),
|
|
851
|
-
const e = /* @__PURE__ */ new Map(), n =
|
|
850
|
+
}), Jo = T(() => {
|
|
851
|
+
const e = /* @__PURE__ */ new Map(), n = or == null ? void 0 : or[0];
|
|
852
852
|
if (!n || n.status !== "failed") return e;
|
|
853
853
|
const t = n.response, r = t && typeof t == "object" && Array.isArray(t.orderDetailResponse) ? t.orderDetailResponse : [];
|
|
854
854
|
for (const i of r)
|
|
@@ -858,7 +858,7 @@ function Pd({
|
|
|
858
858
|
if (!["ERROR", "FAILED"].includes(c)) continue;
|
|
859
859
|
const u = String((o == null ? void 0 : o.lineNumber) ?? "");
|
|
860
860
|
if (!u || e.has(u)) continue;
|
|
861
|
-
const d =
|
|
861
|
+
const d = Hl(o == null ? void 0 : o.lineDetailedMessage), m = d.find(
|
|
862
862
|
(h) => new RegExp(`^Line(?:Number)?\\s*${u}\\s*:`, "i").test(h.trim())
|
|
863
863
|
) ?? d[0];
|
|
864
864
|
m && e.set(u, m.replace(/^Line(?:Number)?\s*\d+\s*:\s*/i, ""));
|
|
@@ -869,26 +869,26 @@ function Pd({
|
|
|
869
869
|
o && !e.has(o[1]) && e.set(o[1], o[2] || i.trim());
|
|
870
870
|
}
|
|
871
871
|
return e;
|
|
872
|
-
}, [
|
|
872
|
+
}, [or]), Bi = xe(!1), [Hi, Qr] = U(O && !!D);
|
|
873
873
|
$e(() => {
|
|
874
|
-
if (!
|
|
874
|
+
if (!Bi.current) {
|
|
875
875
|
if (!O || !D || !k) {
|
|
876
|
-
|
|
876
|
+
Qr(!1);
|
|
877
877
|
return;
|
|
878
878
|
}
|
|
879
|
-
|
|
879
|
+
Bi.current = !0, S.request(
|
|
880
880
|
re(`/items/${a}`, {
|
|
881
881
|
filter: JSON.stringify({ [f]: { _eq: D } }),
|
|
882
|
-
limit:
|
|
882
|
+
limit: Ki
|
|
883
883
|
})
|
|
884
884
|
).then((e) => {
|
|
885
885
|
for (const n of e.data ?? [])
|
|
886
886
|
k.queueRow(a, f, { __prefilled: !0, ...n });
|
|
887
|
-
|
|
888
|
-
}).catch(() =>
|
|
887
|
+
Qr(!1);
|
|
888
|
+
}).catch(() => Qr(!1));
|
|
889
889
|
}
|
|
890
890
|
}, []);
|
|
891
|
-
const [
|
|
891
|
+
const [zo, Yi] = U(!1), Qo = T(
|
|
892
892
|
() => /* @__PURE__ */ new Set([
|
|
893
893
|
"id",
|
|
894
894
|
f,
|
|
@@ -901,35 +901,35 @@ function Pd({
|
|
|
901
901
|
"creator"
|
|
902
902
|
]),
|
|
903
903
|
[f]
|
|
904
|
-
),
|
|
904
|
+
), Fo = async (e) => {
|
|
905
905
|
if (k)
|
|
906
906
|
try {
|
|
907
907
|
const t = (await S.request(
|
|
908
908
|
re(`/items/${a}`, {
|
|
909
909
|
filter: JSON.stringify({ [f]: { _eq: e } }),
|
|
910
|
-
limit:
|
|
910
|
+
limit: Ki
|
|
911
911
|
})
|
|
912
912
|
)).data ?? [];
|
|
913
913
|
for (const r of t) {
|
|
914
914
|
const i = {};
|
|
915
915
|
for (const [o, c] of Object.entries(r))
|
|
916
|
-
!
|
|
916
|
+
!Qo.has(o) && c != null && typeof c != "object" && (i[o] = c);
|
|
917
917
|
k.queueRow(a, f, sn(i));
|
|
918
918
|
}
|
|
919
919
|
Se.success(
|
|
920
920
|
t.length > 0 ? `${t.length} line(s) copied in — they save with this record` : "That record has no lines on this table"
|
|
921
|
-
),
|
|
921
|
+
), Yi(!1);
|
|
922
922
|
} catch {
|
|
923
923
|
Se.error("Could not copy lines");
|
|
924
924
|
}
|
|
925
|
-
}, dt = E && !O ? `?parent_collection=${encodeURIComponent(E)}&parent_id=${encodeURIComponent(v)}` : "", [Ie, kn] = U(null), [
|
|
925
|
+
}, dt = E && !O ? `?parent_collection=${encodeURIComponent(E)}&parent_id=${encodeURIComponent(v)}` : "", [Ie, kn] = U(null), [Vo, Fr] = U(null), [Gi, ar] = U(!1), [Bo, Xi] = U(!1), { data: Ho = [], isLoading: Yo } = Fe({
|
|
926
926
|
queryKey: ["o2m-row-revisions", a, Ie == null ? void 0 : Ie.id],
|
|
927
927
|
queryFn: () => S.request(
|
|
928
928
|
re("/revisions", { collection: a, item: String(Ie == null ? void 0 : Ie.id) })
|
|
929
929
|
).then((e) => e.data ?? []),
|
|
930
930
|
enabled: !!(Ie != null && Ie.id),
|
|
931
931
|
staleTime: 15e3
|
|
932
|
-
}), { data: Jt, isLoading:
|
|
932
|
+
}), { data: Jt, isLoading: Go } = Fe({
|
|
933
933
|
queryKey: ["o2m-field-snapshots", a, f, v],
|
|
934
934
|
queryFn: () => S.request(
|
|
935
935
|
re("/revisions/o2m-snapshots", {
|
|
@@ -938,9 +938,9 @@ function Pd({
|
|
|
938
938
|
parent_id: v
|
|
939
939
|
})
|
|
940
940
|
),
|
|
941
|
-
enabled:
|
|
941
|
+
enabled: Gi && !O,
|
|
942
942
|
staleTime: 15e3
|
|
943
|
-
}),
|
|
943
|
+
}), Xo = T(
|
|
944
944
|
() => ((Jt == null ? void 0 : Jt.data) ?? []).map((e) => ({
|
|
945
945
|
id: e.revision_id,
|
|
946
946
|
delta: e.delta ?? null,
|
|
@@ -955,8 +955,8 @@ function Pd({
|
|
|
955
955
|
})),
|
|
956
956
|
[Jt]
|
|
957
957
|
);
|
|
958
|
-
async function
|
|
959
|
-
|
|
958
|
+
async function Co(e) {
|
|
959
|
+
Xi(!0);
|
|
960
960
|
try {
|
|
961
961
|
const n = await S.request(
|
|
962
962
|
Ke("/revisions/o2m-restore", {
|
|
@@ -965,13 +965,13 @@ function Pd({
|
|
|
965
965
|
parent_id: v,
|
|
966
966
|
target_timestamp: e
|
|
967
967
|
})
|
|
968
|
-
), t =
|
|
968
|
+
), t = pl(n);
|
|
969
969
|
t && Se.warning(t, { duration: 1e4 }), V.invalidateQueries({ queryKey: ["o2m-rows", a, f, v] }), V.invalidateQueries({
|
|
970
970
|
queryKey: ["o2m-field-snapshots", a, f, v]
|
|
971
|
-
}),
|
|
971
|
+
}), ar(!1);
|
|
972
972
|
} catch {
|
|
973
973
|
} finally {
|
|
974
|
-
|
|
974
|
+
Xi(!1);
|
|
975
975
|
}
|
|
976
976
|
}
|
|
977
977
|
j && (te = !1);
|
|
@@ -980,19 +980,19 @@ function Pd({
|
|
|
980
980
|
(L ?? []).filter((e) => e.target_type === "lock").map((e) => e.target_field)
|
|
981
981
|
),
|
|
982
982
|
[L]
|
|
983
|
-
), [p, De] = U(null), Ge = xe(null),
|
|
983
|
+
), [p, De] = U(null), Ge = xe(null), Ci = (e, n) => e && e !== "new" && !e.startsWith("pending:") ? `${a}:${e}:${n}` : void 0, vt = xe(null), lr = (e, n) => {
|
|
984
984
|
!e || typeof window > "u" || window.dispatchEvent(new CustomEvent("nvr:cell-editing", { detail: { cell: e, state: n } }));
|
|
985
|
-
},
|
|
985
|
+
}, Zo = (e) => {
|
|
986
986
|
var t, r, i;
|
|
987
987
|
const n = ((i = (r = (t = e.target) == null ? void 0 : t.closest) == null ? void 0 : r.call(t, "[data-grid-cell]")) == null ? void 0 : i.getAttribute("data-grid-cell")) ?? null;
|
|
988
|
-
n !== vt.current && (vt.current &&
|
|
989
|
-
},
|
|
988
|
+
n !== vt.current && (vt.current && lr(vt.current, "end"), vt.current = n, n && lr(n, "start"));
|
|
989
|
+
}, ea = (e) => {
|
|
990
990
|
var t, r;
|
|
991
|
-
(r = (t = e.relatedTarget) == null ? void 0 : t.closest) != null && r.call(t, "[data-grid-cell]") || (vt.current &&
|
|
991
|
+
(r = (t = e.relatedTarget) == null ? void 0 : t.closest) != null && r.call(t, "[data-grid-cell]") || (vt.current && lr(vt.current, "end"), vt.current = null);
|
|
992
992
|
};
|
|
993
993
|
$e(
|
|
994
994
|
() => () => {
|
|
995
|
-
vt.current &&
|
|
995
|
+
vt.current && lr(vt.current, "end");
|
|
996
996
|
},
|
|
997
997
|
[]
|
|
998
998
|
);
|
|
@@ -1016,7 +1016,7 @@ function Pd({
|
|
|
1016
1016
|
},
|
|
1017
1017
|
[]
|
|
1018
1018
|
);
|
|
1019
|
-
const
|
|
1019
|
+
const Vr = xe(0), ct = xe({
|
|
1020
1020
|
rowId: null,
|
|
1021
1021
|
seqs: /* @__PURE__ */ new Map()
|
|
1022
1022
|
});
|
|
@@ -1035,15 +1035,15 @@ function Pd({
|
|
|
1035
1035
|
En.current = !0;
|
|
1036
1036
|
return;
|
|
1037
1037
|
}
|
|
1038
|
-
En.current = !1, ut.current && (clearTimeout(ut.current), ut.current = null),
|
|
1038
|
+
En.current = !1, ut.current && (clearTimeout(ut.current), ut.current = null), Tt();
|
|
1039
1039
|
}
|
|
1040
1040
|
};
|
|
1041
1041
|
return document.addEventListener("mousedown", e, !0), () => document.removeEventListener("mousedown", e, !0);
|
|
1042
1042
|
}, [p, j]);
|
|
1043
|
-
const [ht, Sn] = U(!1), [
|
|
1044
|
-
async function
|
|
1043
|
+
const [ht, Sn] = U(!1), [Zi, zt] = U(null), [$n, dr] = U(null), [es, ts] = U(!1);
|
|
1044
|
+
async function ta() {
|
|
1045
1045
|
if (!$n) return;
|
|
1046
|
-
|
|
1046
|
+
ts(!0);
|
|
1047
1047
|
const e = [];
|
|
1048
1048
|
let n = "";
|
|
1049
1049
|
for (const r of $n.groups) {
|
|
@@ -1052,37 +1052,37 @@ function Pd({
|
|
|
1052
1052
|
try {
|
|
1053
1053
|
await S.request(Ke(`/items/${r.collection}`, { ...o, [r.fkField]: r.rowId }));
|
|
1054
1054
|
} catch (c) {
|
|
1055
|
-
i.push(o), n || (n =
|
|
1055
|
+
i.push(o), n || (n = To(c));
|
|
1056
1056
|
}
|
|
1057
1057
|
i.length && e.push({ ...r, members: i });
|
|
1058
1058
|
}
|
|
1059
|
-
|
|
1059
|
+
ts(!1), V.invalidateQueries({ queryKey: ["o2m-rows", a, f, v] });
|
|
1060
1060
|
const t = e.reduce((r, i) => r + i.members.length, 0);
|
|
1061
|
-
|
|
1061
|
+
dr(
|
|
1062
1062
|
t > 0 ? {
|
|
1063
1063
|
text: `${t} ${e.map((r) => r.label).join(", ")} row${t === 1 ? "" : "s"} still did not save — ${n}`,
|
|
1064
1064
|
groups: e
|
|
1065
1065
|
} : null
|
|
1066
1066
|
);
|
|
1067
1067
|
}
|
|
1068
|
-
const [
|
|
1068
|
+
const [cr, qn] = U(null), Le = kl(), [Br, na] = U(() => {
|
|
1069
1069
|
var e;
|
|
1070
|
-
return pe ===
|
|
1070
|
+
return pe === Yn ? Yn : pe && (Z != null && Z.some((n) => n.name === pe)) ? pe : (e = Z == null ? void 0 : Z[0]) == null ? void 0 : e.name;
|
|
1071
1071
|
});
|
|
1072
|
-
function
|
|
1073
|
-
|
|
1072
|
+
function ns(e) {
|
|
1073
|
+
na(e);
|
|
1074
1074
|
}
|
|
1075
|
-
const ut = xe(null), En = xe(!1),
|
|
1075
|
+
const ut = xe(null), En = xe(!1), ur = (e) => {
|
|
1076
1076
|
const n = e;
|
|
1077
1077
|
return !n || !(n instanceof HTMLElement) ? !1 : n.isConnected ? !!(n.closest("[data-o2m-editing]") || n.closest("[data-radix-popper-content-wrapper]") || n.closest("[data-nvr-combobox-panel]") || n.closest('[role="dialog"]') || n.closest("[data-omx-overlay]")) : !0;
|
|
1078
|
-
}, { data:
|
|
1078
|
+
}, { data: Hr } = Fe({
|
|
1079
1079
|
queryKey: ["auto-table-layout", a],
|
|
1080
1080
|
queryFn: () => S.request(
|
|
1081
1081
|
re("/collection-layouts", { collection: a })
|
|
1082
1082
|
).then((e) => (e.data ?? []).find((n) => n.layout_type === "table") ?? null),
|
|
1083
1083
|
enabled: !z,
|
|
1084
1084
|
staleTime: 5 * 6e4
|
|
1085
|
-
}), Qt = z ?? (
|
|
1085
|
+
}), Qt = z ?? (Hr == null ? void 0 : Hr.id) ?? null, { data: ke = [], isLoading: rs } = Fe({
|
|
1086
1086
|
queryKey: ["field-config", a, Qt],
|
|
1087
1087
|
queryFn: () => S.request(
|
|
1088
1088
|
re(
|
|
@@ -1098,14 +1098,14 @@ function Pd({
|
|
|
1098
1098
|
return (n == null ? void 0 : n.relations) ?? [];
|
|
1099
1099
|
}),
|
|
1100
1100
|
staleTime: 10 * 6e4
|
|
1101
|
-
}), { data:
|
|
1101
|
+
}), { data: Yr } = Fe({
|
|
1102
1102
|
queryKey: ["layout-meta", Qt],
|
|
1103
1103
|
queryFn: () => S.request(
|
|
1104
1104
|
re(`/collection-layouts/${Qt}`)
|
|
1105
1105
|
).then((e) => e.data ?? {}),
|
|
1106
1106
|
enabled: !!Qt,
|
|
1107
1107
|
staleTime: 5 * 6e4
|
|
1108
|
-
}), C = (
|
|
1108
|
+
}), C = (Yr == null ? void 0 : Yr.row_order_field) ?? null, fr = T(() => {
|
|
1109
1109
|
if (!de || Object.keys(de).length === 0) return null;
|
|
1110
1110
|
const e = {};
|
|
1111
1111
|
for (const [n, t] of Object.entries(de))
|
|
@@ -1121,27 +1121,27 @@ function Pd({
|
|
|
1121
1121
|
), {
|
|
1122
1122
|
data: Xe = [],
|
|
1123
1123
|
isLoading: nn,
|
|
1124
|
-
dataUpdatedAt:
|
|
1124
|
+
dataUpdatedAt: mr
|
|
1125
1125
|
} = Fe({
|
|
1126
1126
|
queryKey: [
|
|
1127
1127
|
"o2m-rows",
|
|
1128
1128
|
a,
|
|
1129
1129
|
f,
|
|
1130
1130
|
v,
|
|
1131
|
-
|
|
1131
|
+
fr ? JSON.stringify(fr) : ""
|
|
1132
1132
|
],
|
|
1133
1133
|
queryFn: () => S.request(
|
|
1134
1134
|
re(`/items/${a}`, {
|
|
1135
1135
|
filter: JSON.stringify(
|
|
1136
|
-
|
|
1136
|
+
fr ? { _and: [{ [f]: { _eq: v } }, fr] } : { [f]: { _eq: v } }
|
|
1137
1137
|
),
|
|
1138
1138
|
limit: 200
|
|
1139
1139
|
})
|
|
1140
1140
|
).then((e) => e.data ?? []),
|
|
1141
1141
|
enabled: !O,
|
|
1142
1142
|
staleTime: 3e4
|
|
1143
|
-
}),
|
|
1144
|
-
queryKey: ["o2m-cell-provenance", a, f, v,
|
|
1143
|
+
}), ra = cl(2e3), { data: rn } = Fe({
|
|
1144
|
+
queryKey: ["o2m-cell-provenance", a, f, v, mr],
|
|
1145
1145
|
queryFn: () => S.request(
|
|
1146
1146
|
re("/revisions/o2m-cell-provenance", {
|
|
1147
1147
|
collection: a,
|
|
@@ -1149,16 +1149,16 @@ function Pd({
|
|
|
1149
1149
|
parent_id: v
|
|
1150
1150
|
})
|
|
1151
1151
|
).then((e) => ({ data: e.data ?? {}, created: e.created ?? {} })),
|
|
1152
|
-
enabled:
|
|
1152
|
+
enabled: ra && !!W && !O && Xe.length > 0,
|
|
1153
1153
|
staleTime: 6e4,
|
|
1154
1154
|
placeholderData: (e) => e
|
|
1155
|
-
}),
|
|
1155
|
+
}), ia = !!(Te != null && Te.enabled) && typeof (Te == null ? void 0 : Te.field) == "string", { data: rt } = Fe({
|
|
1156
1156
|
queryKey: [
|
|
1157
1157
|
"line-aging",
|
|
1158
1158
|
E ?? "",
|
|
1159
1159
|
P ?? f,
|
|
1160
1160
|
v,
|
|
1161
|
-
|
|
1161
|
+
mr
|
|
1162
1162
|
],
|
|
1163
1163
|
queryFn: () => S.request(
|
|
1164
1164
|
re("/sla/line-aging", {
|
|
@@ -1167,18 +1167,18 @@ function Pd({
|
|
|
1167
1167
|
parent_id: v
|
|
1168
1168
|
})
|
|
1169
1169
|
).then((e) => e.data ?? null),
|
|
1170
|
-
enabled:
|
|
1170
|
+
enabled: ia && !O && !!E,
|
|
1171
1171
|
staleTime: 6e4,
|
|
1172
1172
|
placeholderData: (e) => e
|
|
1173
|
-
}),
|
|
1173
|
+
}), is = T(
|
|
1174
1174
|
() => new Set(rt != null && rt.overdue ? rt.overdue_ids : []),
|
|
1175
1175
|
[rt]
|
|
1176
|
-
),
|
|
1177
|
-
const n =
|
|
1176
|
+
), ss = rt != null && rt.overdue ? `${rt.label} still missing · ${rt.days} ${rt.days === 1 ? "day" : "days"} on the clock (limit ${rt.threshold_days})` : void 0, Gr = (rn == null ? void 0 : rn.data) ?? {}, sa = (rn == null ? void 0 : rn.created) ?? {}, pr = (e) => {
|
|
1177
|
+
const n = sa[e];
|
|
1178
1178
|
if (!n) return null;
|
|
1179
|
-
const t =
|
|
1180
|
-
return t ? `From ${t.template} · ${
|
|
1181
|
-
}, On = je ?? [],
|
|
1179
|
+
const t = Wl(n.comment);
|
|
1180
|
+
return t ? `From ${t.template} · ${$o(n.at)} by ${n.who}` : null;
|
|
1181
|
+
}, On = je ?? [], os = Zt({
|
|
1182
1182
|
queries: On.map((e) => ({
|
|
1183
1183
|
queryKey: [
|
|
1184
1184
|
"resolve-cascade",
|
|
@@ -1202,7 +1202,7 @@ function Pd({
|
|
|
1202
1202
|
const e = {};
|
|
1203
1203
|
return !N || !On.length || On.forEach((n, t) => {
|
|
1204
1204
|
var o;
|
|
1205
|
-
const r = (o =
|
|
1205
|
+
const r = (o = os[t]) == null ? void 0 : o.data;
|
|
1206
1206
|
if (!r || r.type === "none") return;
|
|
1207
1207
|
const i = N.draft[n.parent_field];
|
|
1208
1208
|
i == null || i === "" || (r.type === "direct_fk" ? e[n.child_field] = { [r.filter_column]: { _eq: i } } : r.type === "m2m_junction" && (e[n.child_field] = {
|
|
@@ -1214,20 +1214,20 @@ function Pd({
|
|
|
1214
1214
|
}
|
|
1215
1215
|
}));
|
|
1216
1216
|
}), e;
|
|
1217
|
-
}, [On,
|
|
1217
|
+
}, [On, os, N]), K = J === "pending", M = k ? k.getPendingRows(a, f) : [], H = K && k ? k.getPendingEdits(a, f) : /* @__PURE__ */ new Map(), [hr, gr] = U({});
|
|
1218
1218
|
$e(() => {
|
|
1219
|
-
Ge.current ||
|
|
1220
|
-
}, [
|
|
1221
|
-
const Je = K && k ? k.getPendingDeletes(a, f) : /* @__PURE__ */ new Set(),
|
|
1219
|
+
Ge.current || gr({});
|
|
1220
|
+
}, [mr]);
|
|
1221
|
+
const Je = K && k ? k.getPendingDeletes(a, f) : /* @__PURE__ */ new Set(), Xr = T(
|
|
1222
1222
|
() => new Map(
|
|
1223
1223
|
ke.filter((e) => e.computed_type === "write" && !!e.computed_formula).map((e) => [e.field, String(e.computed_formula)])
|
|
1224
1224
|
),
|
|
1225
1225
|
[ke]
|
|
1226
|
-
),
|
|
1226
|
+
), as = T(
|
|
1227
1227
|
() => ke.filter((e) => e.interface === "relation-path" && e.field.includes(".")).map((e) => e.field),
|
|
1228
1228
|
[ke]
|
|
1229
|
-
),
|
|
1230
|
-
() =>
|
|
1229
|
+
), ls = T(() => ke.filter((e) => e.interface === "match-agg-column"), [ke]), Cr = T(
|
|
1230
|
+
() => ls.map((e) => {
|
|
1231
1231
|
const n = e.options ? typeof e.options == "string" ? (() => {
|
|
1232
1232
|
try {
|
|
1233
1233
|
return JSON.parse(e.options);
|
|
@@ -1241,7 +1241,7 @@ function Pd({
|
|
|
1241
1241
|
i.push([c, u.slice(5)]);
|
|
1242
1242
|
continue;
|
|
1243
1243
|
}
|
|
1244
|
-
const d =
|
|
1244
|
+
const d = Wi(u, {}, v, N == null ? void 0 : N.draft);
|
|
1245
1245
|
if (d == null || d === "") {
|
|
1246
1246
|
o = !0;
|
|
1247
1247
|
continue;
|
|
@@ -1271,9 +1271,9 @@ function Pd({
|
|
|
1271
1271
|
format: n.format ?? null
|
|
1272
1272
|
};
|
|
1273
1273
|
}),
|
|
1274
|
-
[
|
|
1275
|
-
),
|
|
1276
|
-
queries:
|
|
1274
|
+
[ls, v, N == null ? void 0 : N.draft]
|
|
1275
|
+
), ds = Zt({
|
|
1276
|
+
queries: Cr.map((e) => ({
|
|
1277
1277
|
queryKey: [
|
|
1278
1278
|
"match-agg",
|
|
1279
1279
|
e.collection,
|
|
@@ -1295,18 +1295,18 @@ function Pd({
|
|
|
1295
1295
|
enabled: !e.unresolved && !!e.collection && !O,
|
|
1296
1296
|
staleTime: 3e4
|
|
1297
1297
|
}))
|
|
1298
|
-
}),
|
|
1298
|
+
}), oa = T(() => {
|
|
1299
1299
|
const e = /* @__PURE__ */ new Map();
|
|
1300
|
-
return
|
|
1300
|
+
return Cr.forEach((n, t) => {
|
|
1301
1301
|
var r;
|
|
1302
1302
|
e.set(n.field, {
|
|
1303
1303
|
cfg: n,
|
|
1304
|
-
rows: ((r =
|
|
1304
|
+
rows: ((r = ds[t]) == null ? void 0 : r.data) ?? []
|
|
1305
1305
|
});
|
|
1306
1306
|
}), e;
|
|
1307
|
-
}, [
|
|
1307
|
+
}, [Cr, ds]), cs = T(() => ke.filter((e) => e.interface === "formula-column"), [ke]), us = T(() => {
|
|
1308
1308
|
const e = /* @__PURE__ */ new Set();
|
|
1309
|
-
for (const n of
|
|
1309
|
+
for (const n of cs) {
|
|
1310
1310
|
const t = n.options ? typeof n.options == "string" ? (() => {
|
|
1311
1311
|
try {
|
|
1312
1312
|
return JSON.parse(n.options);
|
|
@@ -1318,11 +1318,11 @@ function Pd({
|
|
|
1318
1318
|
i[1].includes(".") && e.add(i[1]);
|
|
1319
1319
|
}
|
|
1320
1320
|
return [...e];
|
|
1321
|
-
}, [
|
|
1322
|
-
const e = new Set(
|
|
1323
|
-
for (const n of
|
|
1321
|
+
}, [cs]), Zr = T(() => {
|
|
1322
|
+
const e = new Set(as);
|
|
1323
|
+
for (const n of us) e.add(n);
|
|
1324
1324
|
return he != null && he.includes(".") && e.add(he), [...e];
|
|
1325
|
-
}, [
|
|
1325
|
+
}, [as, us, he]), aa = M.map((e) => String(e.id ?? "")).join(","), ei = T(() => {
|
|
1326
1326
|
const e = /* @__PURE__ */ new Set(), n = (t) => {
|
|
1327
1327
|
const r = t == null ? "" : String(t);
|
|
1328
1328
|
r && !r.startsWith("pending:") && r !== "new" && e.add(r);
|
|
@@ -1334,22 +1334,22 @@ function Pd({
|
|
|
1334
1334
|
for (const r of (t == null ? void 0 : t.rows) ?? []) n(r.id);
|
|
1335
1335
|
}
|
|
1336
1336
|
return [...e];
|
|
1337
|
-
}, [Xe,
|
|
1337
|
+
}, [Xe, aa, Le, me]), { data: Ae } = Fe({
|
|
1338
1338
|
queryKey: [
|
|
1339
1339
|
"o2m-resolve-paths",
|
|
1340
1340
|
a,
|
|
1341
1341
|
f,
|
|
1342
1342
|
v,
|
|
1343
|
-
|
|
1344
|
-
|
|
1343
|
+
Zr.join(","),
|
|
1344
|
+
ei.join(",")
|
|
1345
1345
|
],
|
|
1346
1346
|
queryFn: () => S.request(
|
|
1347
1347
|
re(`/items/${a}/resolve-paths`, {
|
|
1348
|
-
ids:
|
|
1349
|
-
paths:
|
|
1348
|
+
ids: ei.join(","),
|
|
1349
|
+
paths: Zr.join(",")
|
|
1350
1350
|
})
|
|
1351
1351
|
).then((e) => e.data ?? { rows: {}, targets: {} }),
|
|
1352
|
-
enabled:
|
|
1352
|
+
enabled: Zr.length > 0 && ei.length > 0,
|
|
1353
1353
|
staleTime: 3e4
|
|
1354
1354
|
}), ft = T(() => {
|
|
1355
1355
|
if (!Ae) return;
|
|
@@ -1389,26 +1389,26 @@ function Pd({
|
|
|
1389
1389
|
ie,
|
|
1390
1390
|
Oe,
|
|
1391
1391
|
he
|
|
1392
|
-
]),
|
|
1393
|
-
if (!
|
|
1392
|
+
]), fs = !!he && !!ft, br = he ? `nvr_grid_sections:${a}:${P ?? f}` : null, [ms, la] = U(() => {
|
|
1393
|
+
if (!br || typeof localStorage > "u") return /* @__PURE__ */ new Set();
|
|
1394
1394
|
try {
|
|
1395
|
-
const e = localStorage.getItem(
|
|
1395
|
+
const e = localStorage.getItem(br), n = e ? JSON.parse(e) : null;
|
|
1396
1396
|
return new Set(Array.isArray(n) ? n.map(String) : []);
|
|
1397
1397
|
} catch {
|
|
1398
1398
|
return /* @__PURE__ */ new Set();
|
|
1399
1399
|
}
|
|
1400
|
-
}), In = (e) => String(e[he ?? ""] ?? "").trim() || "Uncategorized",
|
|
1400
|
+
}), In = (e) => String(e[he ?? ""] ?? "").trim() || "Uncategorized", da = (e) => la((n) => {
|
|
1401
1401
|
const t = new Set(n);
|
|
1402
|
-
if (t.has(e) ? t.delete(e) : t.add(e),
|
|
1402
|
+
if (t.has(e) ? t.delete(e) : t.add(e), br)
|
|
1403
1403
|
try {
|
|
1404
|
-
localStorage.setItem(
|
|
1404
|
+
localStorage.setItem(br, JSON.stringify([...t]));
|
|
1405
1405
|
} catch {
|
|
1406
1406
|
}
|
|
1407
1407
|
return t;
|
|
1408
|
-
}),
|
|
1408
|
+
}), ca = (e) => {
|
|
1409
1409
|
const n = [];
|
|
1410
1410
|
for (const t of Re) {
|
|
1411
|
-
const r =
|
|
1411
|
+
const r = ji(t.options) ?? {}, i = r.aggregate;
|
|
1412
1412
|
if (!i || t.interface === "formula-column" || t.interface === "match-agg-column") continue;
|
|
1413
1413
|
const o = e.map((d) => {
|
|
1414
1414
|
const l = String(d.id), m = H.has(l) ? { ...d, ...H.get(l) } : d;
|
|
@@ -1426,31 +1426,31 @@ function Pd({
|
|
|
1426
1426
|
n.push({ label: t.label || qe(t.field), text: u });
|
|
1427
1427
|
}
|
|
1428
1428
|
return n;
|
|
1429
|
-
},
|
|
1429
|
+
}, ps = T(
|
|
1430
1430
|
() => ke.filter(
|
|
1431
1431
|
(e) => e.computed_type === "write" && typeof e.computed_formula == "string" && e.computed_formula.trim()
|
|
1432
1432
|
),
|
|
1433
1433
|
[ke]
|
|
1434
1434
|
);
|
|
1435
1435
|
function ce(e, n) {
|
|
1436
|
-
if (!
|
|
1437
|
-
const t = n === void 0 ?
|
|
1438
|
-
for (const i of
|
|
1436
|
+
if (!ps.length) return e;
|
|
1437
|
+
const t = n === void 0 ? hs(e.id) : n, r = { ...e };
|
|
1438
|
+
for (const i of ps) {
|
|
1439
1439
|
const o = i.computed_formula;
|
|
1440
|
-
if (t && !
|
|
1440
|
+
if (t && !gl(o, r, t)) continue;
|
|
1441
1441
|
const c = Rt(o, r);
|
|
1442
1442
|
c !== null && (r[i.field] = c);
|
|
1443
1443
|
}
|
|
1444
1444
|
return r;
|
|
1445
1445
|
}
|
|
1446
|
-
function
|
|
1446
|
+
function hs(e) {
|
|
1447
1447
|
if (e == null || e === "") return;
|
|
1448
1448
|
const n = String(e);
|
|
1449
1449
|
if (!(n.startsWith("pending:") || n === "new"))
|
|
1450
1450
|
return $.find((t) => String(t.id) === n);
|
|
1451
1451
|
}
|
|
1452
|
-
const
|
|
1453
|
-
function
|
|
1452
|
+
const ua = /* @__PURE__ */ new Set(["__apply_values__", "__create_with_defaults__"]), An = (e) => e === "select-multiple-m2m" || (e ?? "").endsWith("-m2m");
|
|
1453
|
+
function ti(e) {
|
|
1454
1454
|
const n = We.find(
|
|
1455
1455
|
(r) => r.one_collection === a && (r.one_field === e.field || r.junction_field != null && r.many_collection === e.field)
|
|
1456
1456
|
);
|
|
@@ -1465,7 +1465,7 @@ function Pd({
|
|
|
1465
1465
|
junctionOtherField: t.many_field
|
|
1466
1466
|
};
|
|
1467
1467
|
}
|
|
1468
|
-
const
|
|
1468
|
+
const ni = JSON.stringify([...H.entries()]) + "|" + [...Je].sort().join(",") + "|" + JSON.stringify(M), sn = (e, n = []) => {
|
|
1469
1469
|
var o;
|
|
1470
1470
|
if (!C) return e;
|
|
1471
1471
|
const t = new Set(n);
|
|
@@ -1490,7 +1490,7 @@ function Pd({
|
|
|
1490
1490
|
const r = sn(t, n);
|
|
1491
1491
|
return C && n.push(Number(r[C])), r;
|
|
1492
1492
|
});
|
|
1493
|
-
},
|
|
1493
|
+
}, ri = T(() => {
|
|
1494
1494
|
const e = [
|
|
1495
1495
|
...($ ?? []).filter((n) => !Je.has(String(n.id))).map((n) => {
|
|
1496
1496
|
const t = String(n.id), r = H.has(t) ? { ...n, ...H.get(t) } : n;
|
|
@@ -1503,16 +1503,16 @@ function Pd({
|
|
|
1503
1503
|
r >= 0 && r < e.length && (e[r] = n);
|
|
1504
1504
|
}
|
|
1505
1505
|
return e;
|
|
1506
|
-
}, [$,
|
|
1507
|
-
if (Le === "original") return
|
|
1506
|
+
}, [$, ni, p]), jn = T(() => {
|
|
1507
|
+
if (Le === "original") return ri;
|
|
1508
1508
|
const e = me.find((n) => n.addendumId === Le);
|
|
1509
1509
|
return e ? e.rows.map(
|
|
1510
1510
|
(n) => ce(
|
|
1511
1511
|
{ ...n },
|
|
1512
1512
|
e.baseRows ? n : void 0
|
|
1513
1513
|
)
|
|
1514
|
-
) :
|
|
1515
|
-
}, [Le, me,
|
|
1514
|
+
) : ri;
|
|
1515
|
+
}, [Le, me, ri]), gs = Xe.length >= Ki, wt = N == null ? void 0 : N.draft, Vt = qt(
|
|
1516
1516
|
(e) => {
|
|
1517
1517
|
if (e.startsWith("$parent."))
|
|
1518
1518
|
return (wt == null ? void 0 : wt[e.slice(8)]) ?? 0;
|
|
@@ -1523,20 +1523,26 @@ function Pd({
|
|
|
1523
1523
|
return e === "$count" ? jn.length : wt == null ? void 0 : wt[e];
|
|
1524
1524
|
},
|
|
1525
1525
|
[wt, jn]
|
|
1526
|
-
),
|
|
1527
|
-
() => Pe != null && Pe.endpoint ?
|
|
1526
|
+
), ii = T(() => Ze != null && Ze.length ? Ze.map((e) => ({ ...e, result: pt(e.value, Vt) })) : null, [Ze, Vt]), yr = T(
|
|
1527
|
+
() => Pe != null && Pe.endpoint ? Nl(Pe.endpoint, wt) : null,
|
|
1528
1528
|
[Pe == null ? void 0 : Pe.endpoint, wt]
|
|
1529
|
-
),
|
|
1529
|
+
), si = Sl({
|
|
1530
1530
|
client: S,
|
|
1531
|
-
endpoint:
|
|
1531
|
+
endpoint: yr,
|
|
1532
1532
|
enabled: !!Pe && !O
|
|
1533
|
-
}), q = Pe && !O ?
|
|
1533
|
+
}), q = Pe && !O ? si.data ?? null : null, bs = !!Pe && !O && !!yr && si.isLoading, ys = !!Pe && !O && si.isError, xr = qt(
|
|
1534
1534
|
(e) => e.label || qe(e.field),
|
|
1535
1535
|
[]
|
|
1536
|
-
), { isAdmin:
|
|
1537
|
-
(e
|
|
1538
|
-
|
|
1539
|
-
|
|
1536
|
+
), { isAdmin: Tn } = dl(), vr = qt(
|
|
1537
|
+
(e) => {
|
|
1538
|
+
var n;
|
|
1539
|
+
return !Tn && ((n = ji(e.options)) == null ? void 0 : n.admin_only_edit) === !0;
|
|
1540
|
+
},
|
|
1541
|
+
[Tn]
|
|
1542
|
+
), oi = qt(
|
|
1543
|
+
(e, n) => !!(q != null && q.closed_locked) && !Tn && q.columns.includes(e) && Kt(q, n[q.key_field], e),
|
|
1544
|
+
[q, Tn]
|
|
1545
|
+
), an = qt(
|
|
1540
1546
|
async (e, n, t) => {
|
|
1541
1547
|
if (e.startsWith("pending:")) {
|
|
1542
1548
|
const r = Number(e.slice(8)), i = M[r];
|
|
@@ -1560,37 +1566,37 @@ function Pd({
|
|
|
1560
1566
|
yt(`/items/${a}/${e}`, { ...n, _change_reason: t })
|
|
1561
1567
|
), V.invalidateQueries({ queryKey: ["o2m-rows", a, f, v] });
|
|
1562
1568
|
} catch (r) {
|
|
1563
|
-
Se.error(`Could not save: ${
|
|
1569
|
+
Se.error(`Could not save: ${Xn(r, "unknown error")}`);
|
|
1564
1570
|
}
|
|
1565
1571
|
},
|
|
1566
1572
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1567
1573
|
[M, k, K, a, f, S, V, v]
|
|
1568
|
-
),
|
|
1574
|
+
), Ln = yr ? `nvr_compare_dismiss:${yr}` : null, [xs, fa] = U(() => {
|
|
1569
1575
|
try {
|
|
1570
|
-
return !
|
|
1576
|
+
return !Ln || typeof window > "u" ? /* @__PURE__ */ new Set() : new Set(JSON.parse(window.localStorage.getItem(Ln) ?? "[]"));
|
|
1571
1577
|
} catch {
|
|
1572
1578
|
return /* @__PURE__ */ new Set();
|
|
1573
1579
|
}
|
|
1574
|
-
}),
|
|
1580
|
+
}), vs = T(
|
|
1575
1581
|
// `add` proposals need the plan grid's per-period arithmetic; the flat grid only fills.
|
|
1576
1582
|
() => ((q == null ? void 0 : q.proposals) ?? []).filter(
|
|
1577
|
-
(e) => e.mode !== "add" && !
|
|
1583
|
+
(e) => e.mode !== "add" && !xs.has(e.id)
|
|
1578
1584
|
),
|
|
1579
|
-
[q == null ? void 0 : q.proposals,
|
|
1580
|
-
),
|
|
1585
|
+
[q == null ? void 0 : q.proposals, xs]
|
|
1586
|
+
), ai = qt(
|
|
1581
1587
|
(e, n = !0) => {
|
|
1582
|
-
|
|
1588
|
+
fa((t) => {
|
|
1583
1589
|
const r = new Set(t);
|
|
1584
1590
|
r.add(e.id);
|
|
1585
1591
|
try {
|
|
1586
|
-
n &&
|
|
1592
|
+
n && Ln && typeof window < "u" && window.localStorage.setItem(Ln, JSON.stringify([...r]));
|
|
1587
1593
|
} catch {
|
|
1588
1594
|
}
|
|
1589
1595
|
return r;
|
|
1590
1596
|
});
|
|
1591
1597
|
},
|
|
1592
|
-
[
|
|
1593
|
-
),
|
|
1598
|
+
[Ln]
|
|
1599
|
+
), ma = qt(
|
|
1594
1600
|
(e) => {
|
|
1595
1601
|
if (!q) return;
|
|
1596
1602
|
const n = q.key_field, t = e.change_reason ?? e.label, r = (c) => c == null || c === "" || Number(c) === 0;
|
|
@@ -1609,7 +1615,7 @@ function Pd({
|
|
|
1609
1615
|
}
|
|
1610
1616
|
Se.success(
|
|
1611
1617
|
i ? `${e.label}: staged on ${i} ${i === 1 ? "row" : "rows"} — save to keep it` : "Nothing to apply — every suggested cell is already filled or closed"
|
|
1612
|
-
),
|
|
1618
|
+
), ai(e, !1);
|
|
1613
1619
|
},
|
|
1614
1620
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1615
1621
|
[
|
|
@@ -1620,9 +1626,9 @@ function Pd({
|
|
|
1620
1626
|
a,
|
|
1621
1627
|
f,
|
|
1622
1628
|
an,
|
|
1623
|
-
|
|
1629
|
+
ai
|
|
1624
1630
|
]
|
|
1625
|
-
),
|
|
1631
|
+
), pa = qt(
|
|
1626
1632
|
(e) => {
|
|
1627
1633
|
var g;
|
|
1628
1634
|
if (!((g = be == null ? void 0 : be.fields) != null && g.length)) return;
|
|
@@ -1642,7 +1648,7 @@ function Pd({
|
|
|
1642
1648
|
Se.message("Nothing to spread into — every target is filled or closed");
|
|
1643
1649
|
return;
|
|
1644
1650
|
}
|
|
1645
|
-
const h =
|
|
1651
|
+
const h = Po(
|
|
1646
1652
|
t,
|
|
1647
1653
|
l.length,
|
|
1648
1654
|
e === "shape" ? "even" : e,
|
|
@@ -1659,7 +1665,7 @@ function Pd({
|
|
|
1659
1665
|
`${be.label ?? "Spread remaining"} across ${b.size} rows`
|
|
1660
1666
|
);
|
|
1661
1667
|
Se.success(
|
|
1662
|
-
`Spread ${
|
|
1668
|
+
`Spread ${Oi(t)} over ${l.length} cells on ${b.size} ${b.size === 1 ? "row" : "rows"}`
|
|
1663
1669
|
);
|
|
1664
1670
|
},
|
|
1665
1671
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -1677,17 +1683,17 @@ function Pd({
|
|
|
1677
1683
|
), Bt = wn == null ? void 0 : wn.report;
|
|
1678
1684
|
$e(() => {
|
|
1679
1685
|
if (Bt) {
|
|
1680
|
-
if (
|
|
1686
|
+
if (gs || nn) {
|
|
1681
1687
|
Bt(a, f, null);
|
|
1682
1688
|
return;
|
|
1683
1689
|
}
|
|
1684
1690
|
Bt(a, f, jn);
|
|
1685
1691
|
}
|
|
1686
|
-
}, [Bt, a, f, jn,
|
|
1687
|
-
const
|
|
1692
|
+
}, [Bt, a, f, jn, gs, nn]);
|
|
1693
|
+
const ws = xe(() => {
|
|
1688
1694
|
});
|
|
1689
|
-
|
|
1690
|
-
const
|
|
1695
|
+
ws.current = () => Bt == null ? void 0 : Bt(a, f, null), $e(() => () => ws.current(), []);
|
|
1696
|
+
const Mn = T(() => {
|
|
1691
1697
|
const e = /* @__PURE__ */ new Map();
|
|
1692
1698
|
for (const n of ke) {
|
|
1693
1699
|
let t = null;
|
|
@@ -1704,7 +1710,7 @@ function Pd({
|
|
|
1704
1710
|
i.length && e.set(n.field, i);
|
|
1705
1711
|
}
|
|
1706
1712
|
return e;
|
|
1707
|
-
}, [ke]),
|
|
1713
|
+
}, [ke]), _s = T(() => {
|
|
1708
1714
|
var n;
|
|
1709
1715
|
const e = [];
|
|
1710
1716
|
for (const t of je ?? []) {
|
|
@@ -1718,10 +1724,10 @@ function Pd({
|
|
|
1718
1724
|
);
|
|
1719
1725
|
}
|
|
1720
1726
|
return e;
|
|
1721
|
-
}, [je]),
|
|
1727
|
+
}, [je]), ha = T(() => {
|
|
1722
1728
|
var n, t;
|
|
1723
1729
|
const e = /* @__PURE__ */ new Map();
|
|
1724
|
-
for (const r of [...
|
|
1730
|
+
for (const r of [...Mn.values(), _s])
|
|
1725
1731
|
for (const i of r) {
|
|
1726
1732
|
const o = (n = N == null ? void 0 : N.draft) == null ? void 0 : n[i.parent_field];
|
|
1727
1733
|
if (o == null || o === "" || typeof o == "object") continue;
|
|
@@ -1733,17 +1739,17 @@ function Pd({
|
|
|
1733
1739
|
}), (t = e.get(c)) == null || t.fields.add(i.source_field);
|
|
1734
1740
|
}
|
|
1735
1741
|
return [...e.entries()];
|
|
1736
|
-
}, [
|
|
1737
|
-
queries:
|
|
1742
|
+
}, [Mn, _s, N == null ? void 0 : N.draft]), ks = Zt({
|
|
1743
|
+
queries: ha.map(([e, n]) => ({
|
|
1738
1744
|
queryKey: ["pinned-parent", n.collection, n.id, [...n.fields].sort().join(",")],
|
|
1739
1745
|
queryFn: () => we(n.collection, n.id, [...n.fields]).then((t) => [e, t]).catch(() => [e, null]),
|
|
1740
1746
|
staleTime: 6e4
|
|
1741
1747
|
}))
|
|
1742
|
-
}),
|
|
1748
|
+
}), wr = T(() => {
|
|
1743
1749
|
const e = /* @__PURE__ */ new Map();
|
|
1744
|
-
for (const n of
|
|
1750
|
+
for (const n of ks) n.data && e.set(n.data[0], n.data[1]);
|
|
1745
1751
|
return e;
|
|
1746
|
-
}, [
|
|
1752
|
+
}, [ks]), Ns = (e, n) => {
|
|
1747
1753
|
var t, r, i;
|
|
1748
1754
|
for (const o of e) {
|
|
1749
1755
|
if ((t = o.when) != null && t.field) {
|
|
@@ -1752,24 +1758,24 @@ function Pd({
|
|
|
1752
1758
|
}
|
|
1753
1759
|
const c = (i = N == null ? void 0 : N.draft) == null ? void 0 : i[o.parent_field];
|
|
1754
1760
|
if (c == null || c === "") continue;
|
|
1755
|
-
const u =
|
|
1761
|
+
const u = wr.get(`${o.parent_collection}|${String(c)}`), d = u == null ? void 0 : u[o.source_field];
|
|
1756
1762
|
if (!(d == null || d === ""))
|
|
1757
1763
|
return { id: d, tag: o.tag ?? "Default" };
|
|
1758
1764
|
}
|
|
1759
1765
|
return null;
|
|
1760
|
-
},
|
|
1761
|
-
const t =
|
|
1762
|
-
return t ?
|
|
1766
|
+
}, Kn = (e, n) => {
|
|
1767
|
+
const t = Mn.get(e);
|
|
1768
|
+
return t ? Ns(t, n) : null;
|
|
1763
1769
|
}, Ne = ke.filter(
|
|
1764
|
-
(e) => !e.hidden && (!
|
|
1765
|
-
), _t = Z && Z.length >= 2 &&
|
|
1770
|
+
(e) => !e.hidden && (!Di.has(e.type) || An(e.interface)) && e.field !== f && e.field !== "id" && (!Qt || e.layout_assigned === !0) && !Pi.has(e.field) && !ua.has(e.group_key ?? "")
|
|
1771
|
+
), _t = Z && Z.length >= 2 && Br !== Yn ? Z.find((e) => e.name === Br) : void 0, ga = new Set(
|
|
1766
1772
|
(G ?? []).map((e) => typeof e == "string" ? e : e.field)
|
|
1767
|
-
),
|
|
1773
|
+
), Ss = _t ? new Set(
|
|
1768
1774
|
_t.columns.filter((e) => {
|
|
1769
1775
|
const n = e.indexOf(".");
|
|
1770
|
-
return n < 0 ? !0 : !
|
|
1776
|
+
return n < 0 ? !0 : !ga.has(e.slice(0, n));
|
|
1771
1777
|
})
|
|
1772
|
-
) : null,
|
|
1778
|
+
) : null, $s = Ss ? Ne.filter((e) => Ss.has(e.field)) : [], ln = T(() => {
|
|
1773
1779
|
if (!_t) return [];
|
|
1774
1780
|
const e = [];
|
|
1775
1781
|
for (const n of _t.columns) {
|
|
@@ -1803,13 +1809,13 @@ function Pd({
|
|
|
1803
1809
|
)
|
|
1804
1810
|
],
|
|
1805
1811
|
[kt]
|
|
1806
|
-
),
|
|
1812
|
+
), qs = Zt({
|
|
1807
1813
|
queries: dn.map((e) => ({
|
|
1808
1814
|
queryKey: ["field-config", e, null],
|
|
1809
1815
|
queryFn: () => S.request(re(`/field-config/${e}`)).then((n) => n.data ?? []),
|
|
1810
1816
|
staleTime: 6e4
|
|
1811
1817
|
}))
|
|
1812
|
-
}),
|
|
1818
|
+
}), Es = Zt({
|
|
1813
1819
|
queries: dn.map((e) => ({
|
|
1814
1820
|
queryKey: ["collection-meta", e],
|
|
1815
1821
|
queryFn: () => S.request(re(`/collections/${e}`)).then((n) => {
|
|
@@ -1818,24 +1824,24 @@ function Pd({
|
|
|
1818
1824
|
}),
|
|
1819
1825
|
staleTime: 10 * 6e4
|
|
1820
1826
|
}))
|
|
1821
|
-
}),
|
|
1827
|
+
}), Os = T(() => {
|
|
1822
1828
|
const e = /* @__PURE__ */ new Map();
|
|
1823
1829
|
return dn.forEach((n, t) => {
|
|
1824
1830
|
var r;
|
|
1825
|
-
e.set(n, ((r =
|
|
1831
|
+
e.set(n, ((r = qs[t]) == null ? void 0 : r.data) ?? []);
|
|
1826
1832
|
}), e;
|
|
1827
|
-
}, [dn,
|
|
1833
|
+
}, [dn, qs]), Is = T(() => {
|
|
1828
1834
|
const e = /* @__PURE__ */ new Map();
|
|
1829
1835
|
return dn.forEach((n, t) => {
|
|
1830
1836
|
var r;
|
|
1831
|
-
e.set(n, ((r =
|
|
1837
|
+
e.set(n, ((r = Es[t]) == null ? void 0 : r.data) ?? []);
|
|
1832
1838
|
}), e;
|
|
1833
|
-
}, [dn,
|
|
1839
|
+
}, [dn, Es]), _r = T(() => {
|
|
1834
1840
|
const e = /* @__PURE__ */ new Map();
|
|
1835
1841
|
for (const n of Ht) {
|
|
1836
1842
|
const t = kt.get(n);
|
|
1837
1843
|
if (!t) continue;
|
|
1838
|
-
const r =
|
|
1844
|
+
const r = Is.get(t.grandCollection) ?? [], i = /* @__PURE__ */ new Map();
|
|
1839
1845
|
for (const o of ln) {
|
|
1840
1846
|
if (o.relationField !== n) continue;
|
|
1841
1847
|
const c = r.find(
|
|
@@ -1846,10 +1852,10 @@ function Pd({
|
|
|
1846
1852
|
e.set(n, i);
|
|
1847
1853
|
}
|
|
1848
1854
|
return e;
|
|
1849
|
-
}, [Ht, kt,
|
|
1850
|
-
() => `nvr-gf-${Math.abs(
|
|
1855
|
+
}, [Ht, kt, Is, ln]), kr = T(() => $.map((e) => String(e.id)), [$]), Rn = T(
|
|
1856
|
+
() => `nvr-gf-${Math.abs(Yl(`${a}:${P ?? f}`)) % 1e5}`,
|
|
1851
1857
|
[a, P, f]
|
|
1852
|
-
),
|
|
1858
|
+
), As = T(() => {
|
|
1853
1859
|
if (!X) return null;
|
|
1854
1860
|
const e = [];
|
|
1855
1861
|
te && (C || O || K) && e.push(24), A && e.push(32), (O || K) && e.push(80), e.push(220);
|
|
@@ -1857,37 +1863,37 @@ function Pd({
|
|
|
1857
1863
|
const t = [];
|
|
1858
1864
|
return e.forEach((r, i) => {
|
|
1859
1865
|
t.push(
|
|
1860
|
-
`.${
|
|
1866
|
+
`.${Rn} tr > *:nth-child(${i + 1}){position:sticky;left:${n}px;z-index:2;min-width:${r}px;max-width:${i === e.length - 1 ? 320 : r}px;background:hsl(var(--card, 0 0% 100%))}`
|
|
1861
1867
|
), n += r;
|
|
1862
|
-
}), t.push(`.${
|
|
1863
|
-
`.${
|
|
1868
|
+
}), t.push(`.${Rn} thead tr > *:nth-child(-n+${e.length}){z-index:3}`), t.push(
|
|
1869
|
+
`.${Rn} tr > *:nth-child(${e.length}){box-shadow:2px 0 0 0 rgba(100,116,139,0.18)}`
|
|
1864
1870
|
), t.join(`
|
|
1865
1871
|
`);
|
|
1866
1872
|
}, [
|
|
1867
1873
|
X,
|
|
1868
|
-
|
|
1874
|
+
Rn,
|
|
1869
1875
|
te,
|
|
1870
1876
|
C,
|
|
1871
1877
|
O,
|
|
1872
1878
|
K,
|
|
1873
1879
|
A
|
|
1874
|
-
]), [cn,
|
|
1880
|
+
]), [cn, ba] = U(150), js = xe(null);
|
|
1875
1881
|
$e(() => {
|
|
1876
|
-
const e =
|
|
1882
|
+
const e = js.current;
|
|
1877
1883
|
if (!e || $.length <= cn) return;
|
|
1878
1884
|
const n = new IntersectionObserver(
|
|
1879
1885
|
(t) => {
|
|
1880
|
-
t.some((r) => r.isIntersecting) &&
|
|
1886
|
+
t.some((r) => r.isIntersecting) && ba((r) => r + 150);
|
|
1881
1887
|
},
|
|
1882
1888
|
{ rootMargin: "400px" }
|
|
1883
1889
|
);
|
|
1884
1890
|
return n.observe(e), () => n.disconnect();
|
|
1885
1891
|
}, [$.length, cn]);
|
|
1886
|
-
const
|
|
1892
|
+
const ya = kr.join(","), xa = Pl(
|
|
1887
1893
|
a,
|
|
1888
|
-
|
|
1894
|
+
kr,
|
|
1889
1895
|
!!ne && !O
|
|
1890
|
-
),
|
|
1896
|
+
), Ts = Zt({
|
|
1891
1897
|
queries: Ht.map((e) => {
|
|
1892
1898
|
const n = kt.get(e);
|
|
1893
1899
|
return {
|
|
@@ -1898,33 +1904,33 @@ function Pd({
|
|
|
1898
1904
|
v,
|
|
1899
1905
|
"summary-members",
|
|
1900
1906
|
e,
|
|
1901
|
-
|
|
1907
|
+
ya
|
|
1902
1908
|
],
|
|
1903
1909
|
queryFn: () => n ? S.request(
|
|
1904
1910
|
re(`/items/${n.grandCollection}`, {
|
|
1905
|
-
filter: JSON.stringify({ [n.fkField]: { _in:
|
|
1911
|
+
filter: JSON.stringify({ [n.fkField]: { _in: kr } }),
|
|
1906
1912
|
limit: 1e3
|
|
1907
1913
|
})
|
|
1908
1914
|
).then((t) => t.data ?? []) : Promise.resolve([]),
|
|
1909
|
-
enabled: !!n &&
|
|
1915
|
+
enabled: !!n && kr.length > 0,
|
|
1910
1916
|
staleTime: 3e4
|
|
1911
1917
|
};
|
|
1912
1918
|
})
|
|
1913
|
-
}),
|
|
1919
|
+
}), Nr = T(() => {
|
|
1914
1920
|
const e = /* @__PURE__ */ new Map();
|
|
1915
1921
|
return Ht.forEach((n, t) => {
|
|
1916
1922
|
var o;
|
|
1917
1923
|
const r = kt.get(n), i = /* @__PURE__ */ new Map();
|
|
1918
1924
|
if (r)
|
|
1919
|
-
for (const c of ((o =
|
|
1925
|
+
for (const c of ((o = Ts[t]) == null ? void 0 : o.data) ?? []) {
|
|
1920
1926
|
const u = String(c[r.fkField]);
|
|
1921
1927
|
i.has(u) || i.set(u, []), i.get(u).push(c);
|
|
1922
1928
|
}
|
|
1923
1929
|
e.set(n, i);
|
|
1924
1930
|
}), e;
|
|
1925
|
-
}, [Ht, kt,
|
|
1931
|
+
}, [Ht, kt, Ts]), Ls = Dt == null ? void 0 : Dt.report;
|
|
1926
1932
|
$e(() => {
|
|
1927
|
-
if (!
|
|
1933
|
+
if (!Ls || !G || G.length === 0) return;
|
|
1928
1934
|
const e = `${a}.${f}`, n = (r, i) => {
|
|
1929
1935
|
const o = {};
|
|
1930
1936
|
for (const [c, u] of Object.entries(r))
|
|
@@ -1955,21 +1961,21 @@ function Pd({
|
|
|
1955
1961
|
for (const g of m.deleted ?? []) u.deleted.push(g);
|
|
1956
1962
|
}
|
|
1957
1963
|
if (Je.size > 0) {
|
|
1958
|
-
const d =
|
|
1964
|
+
const d = Nr.get(i);
|
|
1959
1965
|
for (const l of Je)
|
|
1960
1966
|
for (const m of (d == null ? void 0 : d.get(String(l))) ?? [])
|
|
1961
1967
|
m.id != null && u.deleted.push(m.id);
|
|
1962
1968
|
}
|
|
1963
1969
|
(u.created.length || u.updated.length || u.deleted.length) && (t[o.many_collection] = u);
|
|
1964
1970
|
}
|
|
1965
|
-
|
|
1971
|
+
Ls(e, Object.keys(t).length > 0 ? t : null);
|
|
1966
1972
|
});
|
|
1967
|
-
const
|
|
1973
|
+
const li = T(() => {
|
|
1968
1974
|
const e = /* @__PURE__ */ new Map(), n = (t, r) => {
|
|
1969
1975
|
r == null || r === "" || (e.has(t) || e.set(t, []), e.get(t).push(String(r)));
|
|
1970
1976
|
};
|
|
1971
|
-
for (const [t, r] of
|
|
1972
|
-
const i =
|
|
1977
|
+
for (const [t, r] of Nr) {
|
|
1978
|
+
const i = _r.get(t);
|
|
1973
1979
|
if (!(!i || i.size === 0)) {
|
|
1974
1980
|
for (const o of r.values())
|
|
1975
1981
|
for (const c of o)
|
|
@@ -1989,7 +1995,7 @@ function Pd({
|
|
|
1989
1995
|
for (const [d, l] of i)
|
|
1990
1996
|
l.one_collection && n(l.one_collection, u[d]);
|
|
1991
1997
|
}
|
|
1992
|
-
for (const [o, c] of Object.entries(
|
|
1998
|
+
for (const [o, c] of Object.entries(hr))
|
|
1993
1999
|
if (o.endsWith(`|${t}`))
|
|
1994
2000
|
for (const u of c)
|
|
1995
2001
|
for (const [d, l] of i)
|
|
@@ -1998,16 +2004,16 @@ function Pd({
|
|
|
1998
2004
|
}
|
|
1999
2005
|
for (const [t, r] of e) e.set(t, [...new Set(r)].sort());
|
|
2000
2006
|
return e;
|
|
2001
|
-
}, [
|
|
2007
|
+
}, [Nr, _r, M, H, hr]), { data: Ms = {} } = Fe({
|
|
2002
2008
|
queryKey: [
|
|
2003
2009
|
"summary-m2o-display",
|
|
2004
2010
|
a,
|
|
2005
|
-
...Array.from(
|
|
2011
|
+
...Array.from(li.entries()).flat(2)
|
|
2006
2012
|
],
|
|
2007
2013
|
queryFn: async () => {
|
|
2008
2014
|
const e = {};
|
|
2009
2015
|
return await Promise.all(
|
|
2010
|
-
[...
|
|
2016
|
+
[...li.entries()].map(async ([n, t]) => {
|
|
2011
2017
|
var o;
|
|
2012
2018
|
const [r, i] = await Promise.all([
|
|
2013
2019
|
S.request(
|
|
@@ -2022,25 +2028,25 @@ function Pd({
|
|
|
2022
2028
|
]);
|
|
2023
2029
|
e[n] = {};
|
|
2024
2030
|
for (const c of i.data ?? [])
|
|
2025
|
-
e[n][String(c.id)] =
|
|
2031
|
+
e[n][String(c.id)] = Hn(
|
|
2026
2032
|
(o = r.data) == null ? void 0 : o.display_template,
|
|
2027
2033
|
c
|
|
2028
2034
|
);
|
|
2029
2035
|
})
|
|
2030
2036
|
), e;
|
|
2031
2037
|
},
|
|
2032
|
-
enabled:
|
|
2038
|
+
enabled: li.size > 0,
|
|
2033
2039
|
staleTime: 6e4
|
|
2034
|
-
}), { data:
|
|
2040
|
+
}), { data: di } = Fe({
|
|
2035
2041
|
queryKey: ["collection-display-meta", a],
|
|
2036
2042
|
queryFn: () => S.request(
|
|
2037
2043
|
re(`/collections/${a}`)
|
|
2038
2044
|
).then((e) => e.data),
|
|
2039
2045
|
enabled: !!a,
|
|
2040
2046
|
staleTime: 10 * 6e4
|
|
2041
|
-
}),
|
|
2047
|
+
}), Ks = T(
|
|
2042
2048
|
() => ln.map(({ relationField: e, memberField: n }) => {
|
|
2043
|
-
const t = kt.get(e), i = (t ?
|
|
2049
|
+
const t = kt.get(e), i = (t ? Os.get(t.grandCollection) ?? [] : []).find((o) => o.field === n);
|
|
2044
2050
|
return {
|
|
2045
2051
|
field: `${e}.${n}`,
|
|
2046
2052
|
type: "presentation",
|
|
@@ -2060,20 +2066,20 @@ function Pd({
|
|
|
2060
2066
|
dependency_config: null
|
|
2061
2067
|
};
|
|
2062
2068
|
}),
|
|
2063
|
-
[ln, kt,
|
|
2069
|
+
[ln, kt, Os]
|
|
2064
2070
|
);
|
|
2065
2071
|
function st(e) {
|
|
2066
2072
|
return e.type === "presentation" && e.field.includes(".");
|
|
2067
2073
|
}
|
|
2068
|
-
function
|
|
2074
|
+
function Rs(e, n, t) {
|
|
2069
2075
|
var l, m;
|
|
2070
2076
|
if (t) {
|
|
2071
2077
|
const h = n[`__o2m_${e}`];
|
|
2072
2078
|
return Array.isArray(h) ? h : [];
|
|
2073
2079
|
}
|
|
2074
|
-
const r = String(n.id), i =
|
|
2080
|
+
const r = String(n.id), i = hr[`${r}|${e}`];
|
|
2075
2081
|
if (i) return i;
|
|
2076
|
-
const o = ((l =
|
|
2082
|
+
const o = ((l = Nr.get(e)) == null ? void 0 : l.get(r)) ?? [], c = (m = H.get(r)) == null ? void 0 : m[`__nested_ops_${e}`];
|
|
2077
2083
|
if (!c) return o;
|
|
2078
2084
|
const u = new Set((c.deleted ?? []).map(String)), d = new Map((c.updated ?? []).map((h) => [String(h.id), h.changes]));
|
|
2079
2085
|
return [
|
|
@@ -2083,31 +2089,31 @@ function Pd({
|
|
|
2083
2089
|
...c.created ?? []
|
|
2084
2090
|
];
|
|
2085
2091
|
}
|
|
2086
|
-
function
|
|
2092
|
+
function Pn(e, n, t) {
|
|
2087
2093
|
var l;
|
|
2088
2094
|
const r = e.field.indexOf(".");
|
|
2089
2095
|
if (r < 0) return "—";
|
|
2090
|
-
const i = e.field.slice(0, r), o = e.field.slice(r + 1), c =
|
|
2096
|
+
const i = e.field.slice(0, r), o = e.field.slice(r + 1), c = Rs(i, n, t);
|
|
2091
2097
|
if (c.length === 0) return "—";
|
|
2092
|
-
const u = (l =
|
|
2098
|
+
const u = (l = _r.get(i)) == null ? void 0 : l.get(o), d = c.map((m) => {
|
|
2093
2099
|
var b;
|
|
2094
2100
|
const h = m[o];
|
|
2095
|
-
return h == null || h === "" ? null : u != null && u.one_collection ? ((b =
|
|
2101
|
+
return h == null || h === "" ? null : u != null && u.one_collection ? ((b = Ms[u.one_collection]) == null ? void 0 : b[String(h)]) ?? String(h) : String(h);
|
|
2096
2102
|
}).filter((m) => !!m);
|
|
2097
2103
|
return d.length > 0 ? d.join(", ") : "—";
|
|
2098
2104
|
}
|
|
2099
|
-
function
|
|
2105
|
+
function Sr(e, n) {
|
|
2100
2106
|
var l;
|
|
2101
2107
|
const t = e.field.indexOf(".");
|
|
2102
2108
|
if (t < 0) return "—";
|
|
2103
|
-
const r = e.field.slice(0, t), i = e.field.slice(t + 1), o =
|
|
2109
|
+
const r = e.field.slice(0, t), i = e.field.slice(t + 1), o = Rs(r, n, !1);
|
|
2104
2110
|
if (o.length === 0) return "—";
|
|
2105
|
-
const c = (l =
|
|
2106
|
-
if (!(c != null && c.one_collection) || !le) return
|
|
2111
|
+
const c = (l = _r.get(r)) == null ? void 0 : l.get(i);
|
|
2112
|
+
if (!(c != null && c.one_collection) || !le) return Pn(e, n, !1);
|
|
2107
2113
|
const u = c.one_collection, d = o.map((m) => {
|
|
2108
2114
|
var b;
|
|
2109
2115
|
const h = m[i];
|
|
2110
|
-
return h == null || h === "" ? null : { id: String(h), label: ((b =
|
|
2116
|
+
return h == null || h === "" ? null : { id: String(h), label: ((b = Ms[u]) == null ? void 0 : b[String(h)]) ?? String(h) };
|
|
2111
2117
|
}).filter((m) => !!m);
|
|
2112
2118
|
return d.length === 0 ? "—" : /* @__PURE__ */ s("span", { className: "inline-flex flex-wrap gap-x-1.5", children: d.map((m, h) => /* @__PURE__ */ s(
|
|
2113
2119
|
"button",
|
|
@@ -2122,40 +2128,40 @@ function Pd({
|
|
|
2122
2128
|
`${m.id}:${h}`
|
|
2123
2129
|
)) });
|
|
2124
2130
|
}
|
|
2125
|
-
const Re = _t && (
|
|
2131
|
+
const Re = _t && ($s.length > 0 || Ks.length > 0) ? [...$s, ...Ks] : Ne, un = xe(null), [va, ci] = U(0), Ps = xe(/* @__PURE__ */ new Map()), Ot = xe(0), Ds = 1e4, ot = (e) => Ps.current.set(String(e), Date.now()), Dn = Ne.map((e) => e.field).filter((e) => !e.includes(".")).join(","), Nt = qt(
|
|
2126
2132
|
(e) => {
|
|
2127
2133
|
const n = {};
|
|
2128
|
-
for (const t of
|
|
2134
|
+
for (const t of Dn ? Dn.split(",") : []) {
|
|
2129
2135
|
const r = e[t];
|
|
2130
2136
|
n[t] = r === void 0 || r !== null && typeof r == "object" ? null : r;
|
|
2131
2137
|
}
|
|
2132
2138
|
return n;
|
|
2133
2139
|
},
|
|
2134
|
-
[
|
|
2135
|
-
),
|
|
2140
|
+
[Dn]
|
|
2141
|
+
), wa = (e, n) => {
|
|
2136
2142
|
for (const t of Object.keys(n)) if (String(e[t] ?? "") !== String(n[t] ?? "")) return !1;
|
|
2137
2143
|
return !0;
|
|
2138
|
-
},
|
|
2139
|
-
const t =
|
|
2140
|
-
return !!t && n - t <
|
|
2144
|
+
}, $r = (e, n) => {
|
|
2145
|
+
const t = Ps.current.get(e);
|
|
2146
|
+
return !!t && n - t < Ds;
|
|
2141
2147
|
};
|
|
2142
2148
|
$e(() => {
|
|
2143
|
-
if (O || nn || !
|
|
2149
|
+
if (O || nn || !Dn) return;
|
|
2144
2150
|
if (!un.current) {
|
|
2145
|
-
un.current = new Map(Xe.map((i) => [String(i.id), Nt(i)])),
|
|
2151
|
+
un.current = new Map(Xe.map((i) => [String(i.id), Nt(i)])), ci((i) => i + 1);
|
|
2146
2152
|
return;
|
|
2147
2153
|
}
|
|
2148
2154
|
const e = un.current, n = Date.now(), t = /* @__PURE__ */ new Set();
|
|
2149
2155
|
let r = !1;
|
|
2150
2156
|
for (const i of Xe) {
|
|
2151
2157
|
const o = String(i.id);
|
|
2152
|
-
t.add(o), (
|
|
2158
|
+
t.add(o), ($r(o, n) || !e.has(o) && n - Ot.current < Ds) && (e.set(o, Nt(i)), r = !0);
|
|
2153
2159
|
}
|
|
2154
2160
|
for (const i of [...e.keys()])
|
|
2155
|
-
!t.has(i) &&
|
|
2156
|
-
r &&
|
|
2157
|
-
}, [
|
|
2158
|
-
const
|
|
2161
|
+
!t.has(i) && $r(i, n) && (e.delete(i), r = !0);
|
|
2162
|
+
r && ci((i) => i + 1);
|
|
2163
|
+
}, [mr, O, nn, Dn]);
|
|
2164
|
+
const It = T(() => {
|
|
2159
2165
|
const e = un.current;
|
|
2160
2166
|
if (!e || O) return null;
|
|
2161
2167
|
const n = Date.now(), t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), i = [], o = /* @__PURE__ */ new Set();
|
|
@@ -2167,36 +2173,36 @@ function Pd({
|
|
|
2167
2173
|
t.add(u);
|
|
2168
2174
|
continue;
|
|
2169
2175
|
}
|
|
2170
|
-
H.has(u) ||
|
|
2176
|
+
H.has(u) || $r(u, n) || wa(Nt(c), d) || r.add(u);
|
|
2171
2177
|
}
|
|
2172
2178
|
for (const c of e.keys()) o.has(c) || i.push(c);
|
|
2173
2179
|
return t.size === 0 && r.size === 0 && i.length === 0 ? null : { added: t, changed: r, removed: i, total: t.size + r.size + i.length };
|
|
2174
|
-
}, [Xe,
|
|
2175
|
-
un.current = new Map(Xe.map((e) => [String(e.id), Nt(e)])),
|
|
2176
|
-
}, fn = xe(null), [
|
|
2180
|
+
}, [Xe, va, ni, O, Nt]), _a = () => {
|
|
2181
|
+
un.current = new Map(Xe.map((e) => [String(e.id), Nt(e)])), ci((e) => e + 1);
|
|
2182
|
+
}, fn = xe(null), [qr, Ws] = U({}), Wn = T(() => {
|
|
2177
2183
|
const e = fn.current, n = p == null ? void 0 : p.rowId;
|
|
2178
2184
|
if (!e || !n || e.rowId !== n || n === "new" || n.startsWith("pending:")) return [];
|
|
2179
2185
|
const t = Xe.find((o) => String(o.id) === n);
|
|
2180
|
-
if (!t ||
|
|
2186
|
+
if (!t || $r(n, Date.now())) return [];
|
|
2181
2187
|
const r = Nt(t), i = [];
|
|
2182
2188
|
for (const o of Object.keys(r)) {
|
|
2183
|
-
if (String(r[o] ?? "") === String(e.snap[o] ?? "") || String(
|
|
2189
|
+
if (String(r[o] ?? "") === String(e.snap[o] ?? "") || String(qr[o] ?? "\0") === String(r[o] ?? "") || String((p == null ? void 0 : p.draft[o]) ?? "") === String(r[o] ?? "")) continue;
|
|
2184
2190
|
const c = ke.find((u) => u.field === o);
|
|
2185
2191
|
(c == null ? void 0 : c.computed_type) === "write" && c.computed_formula || i.push({ field: o, label: (c == null ? void 0 : c.label) || qe(o), theirs: r[o], was: e.snap[o] });
|
|
2186
2192
|
}
|
|
2187
2193
|
return i;
|
|
2188
|
-
}, [Xe, p == null ? void 0 : p.rowId, p == null ? void 0 : p.draft,
|
|
2189
|
-
if (!e ||
|
|
2194
|
+
}, [Xe, p == null ? void 0 : p.rowId, p == null ? void 0 : p.draft, qr, Nt, ke]), Us = (e) => {
|
|
2195
|
+
if (!e || Wn.length === 0 || (p == null ? void 0 : p.rowId) !== e) return null;
|
|
2190
2196
|
const n = (i) => i == null || i === "" ? "∅" : String(i).slice(0, 40), t = (i) => {
|
|
2191
|
-
const o = { ...
|
|
2192
|
-
for (const u of
|
|
2197
|
+
const o = { ...qr }, c = {};
|
|
2198
|
+
for (const u of Wn)
|
|
2193
2199
|
i && u.field !== i || (c[u.field] = u.theirs, o[u.field] = u.theirs, fn.current && (fn.current.snap[u.field] = u.theirs));
|
|
2194
|
-
|
|
2200
|
+
vi(c), Ws(o);
|
|
2195
2201
|
}, r = () => {
|
|
2196
|
-
const i = { ...
|
|
2197
|
-
for (const o of
|
|
2202
|
+
const i = { ...qr };
|
|
2203
|
+
for (const o of Wn)
|
|
2198
2204
|
i[o.field] = o.theirs, fn.current && (fn.current.snap[o.field] = o.theirs);
|
|
2199
|
-
|
|
2205
|
+
Ws(i);
|
|
2200
2206
|
};
|
|
2201
2207
|
return /* @__PURE__ */ _(
|
|
2202
2208
|
"div",
|
|
@@ -2208,7 +2214,7 @@ function Pd({
|
|
|
2208
2214
|
/* @__PURE__ */ _("span", { className: "min-w-0 flex-1", children: [
|
|
2209
2215
|
"Changed by others while you edit:",
|
|
2210
2216
|
" ",
|
|
2211
|
-
|
|
2217
|
+
Wn.map((i, o) => /* @__PURE__ */ _("span", { "data-row-remote-field": i.field, children: [
|
|
2212
2218
|
o > 0 && " · ",
|
|
2213
2219
|
/* @__PURE__ */ s("span", { className: "font-medium", children: i.label }),
|
|
2214
2220
|
" ",
|
|
@@ -2249,19 +2255,19 @@ function Pd({
|
|
|
2249
2255
|
]
|
|
2250
2256
|
}
|
|
2251
2257
|
);
|
|
2252
|
-
},
|
|
2253
|
-
if (!
|
|
2258
|
+
}, Js = T(() => {
|
|
2259
|
+
if (!It) return [];
|
|
2254
2260
|
const e = /* @__PURE__ */ new Set();
|
|
2255
|
-
for (const n of
|
|
2256
|
-
const t = Object.values(
|
|
2261
|
+
for (const n of It.changed) {
|
|
2262
|
+
const t = Object.values(Gr[n] ?? {});
|
|
2257
2263
|
if (t.length === 0) continue;
|
|
2258
2264
|
const r = t.reduce((i, o) => String(o.at) > String(i.at) ? o : i);
|
|
2259
2265
|
r.who && e.add(r.who);
|
|
2260
2266
|
}
|
|
2261
2267
|
return [...e];
|
|
2262
|
-
}, [
|
|
2263
|
-
}),
|
|
2264
|
-
const n =
|
|
2268
|
+
}, [It, Gr]), [Ce, Yt] = U(null), ui = xe(/* @__PURE__ */ new Set()), zs = (e, n) => JSON.stringify([e, n]), [mn, ka] = U(() => /* @__PURE__ */ new Map()), Qs = xe(""), fi = xe(() => {
|
|
2269
|
+
}), Na = (e) => {
|
|
2270
|
+
const n = rr.current;
|
|
2265
2271
|
if (!n) return null;
|
|
2266
2272
|
const t = `${a}:${e}`;
|
|
2267
2273
|
for (const r of n.querySelectorAll("[data-o2m-row]")) {
|
|
@@ -2270,10 +2276,10 @@ function Pd({
|
|
|
2270
2276
|
return i != null && i.trim() ? i : null;
|
|
2271
2277
|
}
|
|
2272
2278
|
return null;
|
|
2273
|
-
},
|
|
2279
|
+
}, Fs = !rs && (O || !nn);
|
|
2274
2280
|
$e(() => {
|
|
2275
|
-
const e =
|
|
2276
|
-
if (!e || !
|
|
2281
|
+
const e = rr.current;
|
|
2282
|
+
if (!e || !Fs || typeof MutationObserver > "u") return;
|
|
2277
2283
|
const n = `${a}:`, t = () => {
|
|
2278
2284
|
const i = /* @__PURE__ */ new Map();
|
|
2279
2285
|
for (const c of e.querySelectorAll("[data-o2m-row][data-remote-editor]")) {
|
|
@@ -2284,9 +2290,9 @@ function Pd({
|
|
|
2284
2290
|
}
|
|
2285
2291
|
const o = [...i.entries()].map(([c, u]) => `${c}\0${u}`).sort().join(`
|
|
2286
2292
|
`);
|
|
2287
|
-
o !==
|
|
2293
|
+
o !== Qs.current && (Qs.current = o, ka(i));
|
|
2288
2294
|
};
|
|
2289
|
-
|
|
2295
|
+
fi.current = t, t();
|
|
2290
2296
|
const r = new MutationObserver(t);
|
|
2291
2297
|
return r.observe(e, {
|
|
2292
2298
|
attributes: !0,
|
|
@@ -2294,11 +2300,11 @@ function Pd({
|
|
|
2294
2300
|
subtree: !0,
|
|
2295
2301
|
childList: !0
|
|
2296
2302
|
}), () => {
|
|
2297
|
-
r.disconnect(),
|
|
2303
|
+
r.disconnect(), fi.current = () => {
|
|
2298
2304
|
};
|
|
2299
2305
|
};
|
|
2300
|
-
}, [
|
|
2301
|
-
const e =
|
|
2306
|
+
}, [Fs, a]), $e(() => {
|
|
2307
|
+
const e = ui.current;
|
|
2302
2308
|
for (const n of [...e]) {
|
|
2303
2309
|
const [t, r] = JSON.parse(n);
|
|
2304
2310
|
mn.get(t) !== r && e.delete(n);
|
|
@@ -2311,7 +2317,7 @@ function Pd({
|
|
|
2311
2317
|
};
|
|
2312
2318
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
2313
2319
|
}, [Ce]);
|
|
2314
|
-
const
|
|
2320
|
+
const mi = T(() => {
|
|
2315
2321
|
if (mn.size === 0) return [];
|
|
2316
2322
|
const e = [];
|
|
2317
2323
|
return $.forEach((n, t) => {
|
|
@@ -2322,9 +2328,9 @@ function Pd({
|
|
|
2322
2328
|
}), e;
|
|
2323
2329
|
}, [mn, $]);
|
|
2324
2330
|
$e(() => {
|
|
2325
|
-
if (!
|
|
2331
|
+
if (!Et || O) return;
|
|
2326
2332
|
let e = null;
|
|
2327
|
-
const n =
|
|
2333
|
+
const n = Et.subscribeCollections([a], () => {
|
|
2328
2334
|
e && clearTimeout(e), e = setTimeout(() => {
|
|
2329
2335
|
e = null, V.invalidateQueries({ queryKey: ["o2m-rows", a, f, v] });
|
|
2330
2336
|
}, 1500);
|
|
@@ -2332,23 +2338,23 @@ function Pd({
|
|
|
2332
2338
|
return () => {
|
|
2333
2339
|
n(), e && clearTimeout(e);
|
|
2334
2340
|
};
|
|
2335
|
-
}, [
|
|
2336
|
-
const
|
|
2341
|
+
}, [Et, a, f, v, O, V]);
|
|
2342
|
+
const Vs = xe(null);
|
|
2337
2343
|
$e(() => {
|
|
2338
2344
|
const e = {
|
|
2339
2345
|
edits: new Set(H.keys()),
|
|
2340
2346
|
deletes: new Set(Je),
|
|
2341
2347
|
pending: M.length
|
|
2342
|
-
}, n =
|
|
2343
|
-
if (
|
|
2348
|
+
}, n = Vs.current;
|
|
2349
|
+
if (Vs.current = e, !!n) {
|
|
2344
2350
|
for (const t of n.edits) e.edits.has(t) || ot(t);
|
|
2345
2351
|
for (const t of n.deletes) e.deletes.has(t) || ot(t);
|
|
2346
|
-
e.pending < n.pending && (
|
|
2352
|
+
e.pending < n.pending && (Ot.current = Date.now());
|
|
2347
2353
|
}
|
|
2348
|
-
}, [
|
|
2349
|
-
const
|
|
2354
|
+
}, [ni]);
|
|
2355
|
+
const pi = T(() => td(ke), [ke]), Bs = T(
|
|
2350
2356
|
() => ke.filter(
|
|
2351
|
-
(e) => e.group_key === "__create_with_defaults__" && !
|
|
2357
|
+
(e) => e.group_key === "__create_with_defaults__" && !Di.has(e.type ?? "") && !Pi.has(e.field)
|
|
2352
2358
|
),
|
|
2353
2359
|
[ke]
|
|
2354
2360
|
), Ve = T(() => {
|
|
@@ -2360,7 +2366,7 @@ function Pd({
|
|
|
2360
2366
|
t != null && t.one_collection && e.set(n.field, t);
|
|
2361
2367
|
}
|
|
2362
2368
|
return e;
|
|
2363
|
-
}, [Ne, We, a]),
|
|
2369
|
+
}, [Ne, We, a]), hi = T(() => {
|
|
2364
2370
|
var n;
|
|
2365
2371
|
const e = {};
|
|
2366
2372
|
for (const t of Ne) {
|
|
@@ -2372,7 +2378,7 @@ function Pd({
|
|
|
2372
2378
|
}
|
|
2373
2379
|
})() : null, i = r == null ? void 0 : r.option_filter;
|
|
2374
2380
|
if (!i || typeof i != "object") continue;
|
|
2375
|
-
const o =
|
|
2381
|
+
const o = Ro(
|
|
2376
2382
|
i,
|
|
2377
2383
|
N == null ? void 0 : N.draft,
|
|
2378
2384
|
((n = N == null ? void 0 : N.draft) == null ? void 0 : n.id) != null ? String(N.draft.id) : ""
|
|
@@ -2380,15 +2386,15 @@ function Pd({
|
|
|
2380
2386
|
o && (e[t.field] = o);
|
|
2381
2387
|
}
|
|
2382
2388
|
return e;
|
|
2383
|
-
}, [Ne, N == null ? void 0 : N.draft]),
|
|
2389
|
+
}, [Ne, N == null ? void 0 : N.draft]), gi = T(() => {
|
|
2384
2390
|
const e = [], n = /* @__PURE__ */ new Set([
|
|
2385
2391
|
...Object.keys(it),
|
|
2386
|
-
...Object.keys(
|
|
2392
|
+
...Object.keys(hi)
|
|
2387
2393
|
]);
|
|
2388
2394
|
for (const t of n) {
|
|
2389
2395
|
const r = Ve.get(t);
|
|
2390
2396
|
if (!(r != null && r.one_collection)) continue;
|
|
2391
|
-
const i = [it[t],
|
|
2397
|
+
const i = [it[t], hi[t]].filter(
|
|
2392
2398
|
(u) => !!u
|
|
2393
2399
|
), o = i.length === 1 ? i[0] : { _and: i }, c = [
|
|
2394
2400
|
...new Set(
|
|
@@ -2398,8 +2404,8 @@ function Pd({
|
|
|
2398
2404
|
c.length && e.push({ field: t, target: r.one_collection, filter: o, ids: c });
|
|
2399
2405
|
}
|
|
2400
2406
|
return e;
|
|
2401
|
-
}, [it,
|
|
2402
|
-
queries:
|
|
2407
|
+
}, [it, hi, Ve, $, M]), Hs = Zt({
|
|
2408
|
+
queries: gi.map((e) => ({
|
|
2403
2409
|
queryKey: [
|
|
2404
2410
|
"cascade-stale-sweep",
|
|
2405
2411
|
a,
|
|
@@ -2416,49 +2422,49 @@ function Pd({
|
|
|
2416
2422
|
).then((n) => new Set((n.data ?? []).map((t) => String(t.id)))),
|
|
2417
2423
|
staleTime: 3e4
|
|
2418
2424
|
}))
|
|
2419
|
-
}),
|
|
2425
|
+
}), bi = T(() => {
|
|
2420
2426
|
const e = /* @__PURE__ */ new Map();
|
|
2421
|
-
return
|
|
2427
|
+
return gi.forEach((n, t) => {
|
|
2422
2428
|
var c;
|
|
2423
|
-
const r = (c =
|
|
2429
|
+
const r = (c = Hs[t]) == null ? void 0 : c.data;
|
|
2424
2430
|
if (!r) return;
|
|
2425
2431
|
const i = /* @__PURE__ */ new Set();
|
|
2426
|
-
if (
|
|
2432
|
+
if (Mn.has(n.field))
|
|
2427
2433
|
for (const u of [...$, ...M]) {
|
|
2428
|
-
const d =
|
|
2434
|
+
const d = Kn(n.field, u);
|
|
2429
2435
|
(d == null ? void 0 : d.id) != null && i.add(String(d.id));
|
|
2430
2436
|
}
|
|
2431
2437
|
const o = n.ids.filter((u) => !r.has(u) && !i.has(u));
|
|
2432
2438
|
o.length && e.set(n.field, new Set(o));
|
|
2433
2439
|
}), e;
|
|
2434
2440
|
}, [
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2441
|
+
gi,
|
|
2442
|
+
Hs,
|
|
2443
|
+
Mn,
|
|
2444
|
+
wr,
|
|
2439
2445
|
N == null ? void 0 : N.draft,
|
|
2440
2446
|
$,
|
|
2441
2447
|
M
|
|
2442
|
-
]),
|
|
2448
|
+
]), Er = xe(/* @__PURE__ */ new Set()), yi = xe(!1);
|
|
2443
2449
|
$e(() => {
|
|
2444
2450
|
var t;
|
|
2445
|
-
if (j || !S ||
|
|
2451
|
+
if (j || !S || yi.current) return;
|
|
2446
2452
|
const e = N == null ? void 0 : N.dirtyFields;
|
|
2447
2453
|
if (!e || e.size === 0) return;
|
|
2448
2454
|
const n = [];
|
|
2449
2455
|
for (const r of On) {
|
|
2450
2456
|
const i = r.on_unavailable;
|
|
2451
2457
|
if (!(i != null && i.replace) || !e.has(r.parent_field)) continue;
|
|
2452
|
-
const o =
|
|
2458
|
+
const o = bi.get(r.child_field), c = it[r.child_field], u = Ve.get(r.child_field);
|
|
2453
2459
|
if (!(o != null && o.size) || !c || !(u != null && u.one_collection)) continue;
|
|
2454
2460
|
const d = JSON.stringify(c), l = [...o].filter(
|
|
2455
|
-
(b) =>
|
|
2461
|
+
(b) => !Er.current.has(`${r.child_field}|${b}|${d}`)
|
|
2456
2462
|
);
|
|
2457
2463
|
if (!l.length) continue;
|
|
2458
2464
|
const m = {};
|
|
2459
2465
|
let h = !0;
|
|
2460
2466
|
for (const [b, g] of Object.entries(i.replace)) {
|
|
2461
|
-
const w = Array.isArray(g) ?
|
|
2467
|
+
const w = Array.isArray(g) ? Ns(g, {}) : null;
|
|
2462
2468
|
if (!w) {
|
|
2463
2469
|
h = !1;
|
|
2464
2470
|
break;
|
|
@@ -2469,10 +2475,10 @@ function Pd({
|
|
|
2469
2475
|
const b = Object.values(i.replace).flat().every((w) => {
|
|
2470
2476
|
var x;
|
|
2471
2477
|
const y = (x = N == null ? void 0 : N.draft) == null ? void 0 : x[w.parent_field];
|
|
2472
|
-
return y == null || y === "" ||
|
|
2478
|
+
return y == null || y === "" || wr.has(`${w.parent_collection}|${String(y)}`);
|
|
2473
2479
|
}), g = `hint|${r.child_field}|${d}`;
|
|
2474
|
-
if (b &&
|
|
2475
|
-
|
|
2480
|
+
if (b && !Er.current.has(g)) {
|
|
2481
|
+
Er.current.add(g);
|
|
2476
2482
|
const w = ((t = N == null ? void 0 : N.fieldLabels) == null ? void 0 : t[r.parent_field]) ?? qe(r.parent_field);
|
|
2477
2483
|
Se.message(
|
|
2478
2484
|
`${i.label ?? "Value"} on ${l.length} ${l.length === 1 ? "line is" : "lines are"} not available for this ${w} — no default ${(i.label ?? "value").toLowerCase()} is set on it (or its type), so nothing was switched`
|
|
@@ -2482,12 +2488,12 @@ function Pd({
|
|
|
2482
2488
|
}
|
|
2483
2489
|
n.push({ rule: r, cfg: i, target: u.one_collection, filter: c, filterKey: d, ids: l, replaceValues: m });
|
|
2484
2490
|
}
|
|
2485
|
-
n.length && (
|
|
2491
|
+
n.length && (yi.current = !0, (async () => {
|
|
2486
2492
|
var d, l, m, h, b;
|
|
2487
2493
|
let r = 0, i = 0, o = 0;
|
|
2488
2494
|
for (const g of n) {
|
|
2489
2495
|
for (const Y of g.ids)
|
|
2490
|
-
|
|
2496
|
+
Er.current.add(`${g.rule.child_field}|${Y}|${g.filterKey}`);
|
|
2491
2497
|
const w = g.rule.child_field, y = (g.cfg.keep ?? []).filter((Y) => typeof Y == "string" && Y), x = await S.request(
|
|
2492
2498
|
re(`/items/${g.target}`, {
|
|
2493
2499
|
filter: JSON.stringify({ id: { _in: g.ids } }),
|
|
@@ -2516,7 +2522,7 @@ function Pd({
|
|
|
2516
2522
|
ue == null ? i++ : R.set(String(Y.id), ue);
|
|
2517
2523
|
}
|
|
2518
2524
|
if (R.size === 0) continue;
|
|
2519
|
-
const I =
|
|
2525
|
+
const I = jt(), B = async (Y) => {
|
|
2520
2526
|
const ye = {
|
|
2521
2527
|
...Y,
|
|
2522
2528
|
[w]: R.get(String(Y[w]))
|
|
@@ -2532,8 +2538,8 @@ function Pd({
|
|
|
2532
2538
|
parent_context: I,
|
|
2533
2539
|
row_rules: L
|
|
2534
2540
|
})
|
|
2535
|
-
).catch(() => null), Be =
|
|
2536
|
-
for (const
|
|
2541
|
+
).catch(() => null), Be = xi(w, Y, ee == null ? void 0 : ee.expected);
|
|
2542
|
+
for (const Kr of Be) ye[Kr] = null;
|
|
2537
2543
|
const $t = await S.request(
|
|
2538
2544
|
Ke("/field-rules/evaluate", {
|
|
2539
2545
|
collection: a,
|
|
@@ -2544,7 +2550,7 @@ function Pd({
|
|
|
2544
2550
|
})
|
|
2545
2551
|
).catch(() => null);
|
|
2546
2552
|
$t != null && $t.updates && (ue = { ...ue, ...$t.updates });
|
|
2547
|
-
for (const
|
|
2553
|
+
for (const Kr of Be) Kr in ue || (ue[Kr] = null);
|
|
2548
2554
|
}
|
|
2549
2555
|
return ue;
|
|
2550
2556
|
}, F = M.map((Y, ye) => ({ r: Y, i: ye })).filter(({ r: Y }) => Y[w] != null && R.has(String(Y[w])));
|
|
@@ -2582,10 +2588,10 @@ function Pd({
|
|
|
2582
2588
|
`${i + o} ${i + o === 1 ? "line" : "lines"} could not be switched — no matching default option${o ? " / save failed" : ""}`
|
|
2583
2589
|
);
|
|
2584
2590
|
})().finally(() => {
|
|
2585
|
-
|
|
2591
|
+
yi.current = !1;
|
|
2586
2592
|
}));
|
|
2587
|
-
}, [
|
|
2588
|
-
const
|
|
2593
|
+
}, [bi, it, N == null ? void 0 : N.dirtyFields, wr]);
|
|
2594
|
+
const Un = T(() => {
|
|
2589
2595
|
const e = /* @__PURE__ */ new Map(), n = [...$, ...M], t = [...H.values()], r = me.flatMap((i) => i.rows);
|
|
2590
2596
|
for (const [i, o] of Ve) {
|
|
2591
2597
|
if (!o.one_collection) continue;
|
|
@@ -2593,12 +2599,12 @@ function Pd({
|
|
|
2593
2599
|
l.length && e.set(o.one_collection, l);
|
|
2594
2600
|
}
|
|
2595
2601
|
return e;
|
|
2596
|
-
}, [$, M, H, Ve, me]),
|
|
2602
|
+
}, [$, M, H, Ve, me]), Sa = T(() => {
|
|
2597
2603
|
const e = /* @__PURE__ */ new Map();
|
|
2598
2604
|
for (const n of Ne) {
|
|
2599
2605
|
const t = Ve.get(n.field);
|
|
2600
2606
|
if (t != null && t.one_collection && n.interface === "relation-grouped") {
|
|
2601
|
-
const r =
|
|
2607
|
+
const r = ji(n.options);
|
|
2602
2608
|
r != null && r.group_field && (r != null && r.option_field) && e.set(t.one_collection, {
|
|
2603
2609
|
groupField: r.group_field,
|
|
2604
2610
|
optionField: r.option_field
|
|
@@ -2606,14 +2612,14 @@ function Pd({
|
|
|
2606
2612
|
}
|
|
2607
2613
|
}
|
|
2608
2614
|
return e;
|
|
2609
|
-
}, [Ne, Ve]),
|
|
2610
|
-
() => ["m2o-display", a, ...Array.from(
|
|
2611
|
-
[a,
|
|
2612
|
-
), { data: pn = {}, isFetching:
|
|
2613
|
-
queryKey:
|
|
2615
|
+
}, [Ne, Ve]), $a = T(
|
|
2616
|
+
() => ["m2o-display", a, ...Array.from(Un.entries()).flat(2)],
|
|
2617
|
+
[a, Un]
|
|
2618
|
+
), { data: pn = {}, isFetching: qa } = Fe({
|
|
2619
|
+
queryKey: $a,
|
|
2614
2620
|
queryFn: async () => {
|
|
2615
2621
|
const e = {}, n = await Promise.all(
|
|
2616
|
-
[...
|
|
2622
|
+
[...Un.keys()].map(
|
|
2617
2623
|
(t) => V.fetchQuery({
|
|
2618
2624
|
queryKey: ["collection-display-meta", t],
|
|
2619
2625
|
queryFn: () => S.request(
|
|
@@ -2625,7 +2631,7 @@ function Pd({
|
|
|
2625
2631
|
);
|
|
2626
2632
|
return await Promise.all(
|
|
2627
2633
|
n.map(async ({ collection: t, meta: r }) => {
|
|
2628
|
-
const i =
|
|
2634
|
+
const i = Un.get(t), o = Sa.get(t);
|
|
2629
2635
|
let c;
|
|
2630
2636
|
if (o)
|
|
2631
2637
|
c = `id,${o.groupField}.*,${o.optionField}.*`;
|
|
@@ -2645,25 +2651,25 @@ function Pd({
|
|
|
2645
2651
|
e[t] = {};
|
|
2646
2652
|
for (const d of u)
|
|
2647
2653
|
if (o) {
|
|
2648
|
-
const l = d[o.groupField], m = d[o.optionField], h = l ?
|
|
2654
|
+
const l = d[o.groupField], m = d[o.optionField], h = l ? Hn(null, l) : null, b = m ? Hn(null, m) : null;
|
|
2649
2655
|
e[t][String(d.id)] = [h, b].filter(Boolean).join(" — ") || String(d.id);
|
|
2650
2656
|
} else {
|
|
2651
2657
|
const l = (r == null ? void 0 : r.display_template) ?? void 0;
|
|
2652
|
-
e[t][String(d.id)] =
|
|
2658
|
+
e[t][String(d.id)] = Hn(l, d);
|
|
2653
2659
|
}
|
|
2654
2660
|
})
|
|
2655
2661
|
), e;
|
|
2656
2662
|
},
|
|
2657
|
-
enabled:
|
|
2663
|
+
enabled: Un.size > 0,
|
|
2658
2664
|
staleTime: 6e4
|
|
2659
|
-
}),
|
|
2665
|
+
}), Ea = T(
|
|
2660
2666
|
() => ae != null && ae.unmatched_banner ? M.map((e) => ce({ ...e })) : void 0,
|
|
2661
2667
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2662
2668
|
[ae == null ? void 0 : ae.unmatched_banner, M]
|
|
2663
|
-
),
|
|
2669
|
+
), At = Ul({
|
|
2664
2670
|
config: ae,
|
|
2665
2671
|
rows: $,
|
|
2666
|
-
stagedRows:
|
|
2672
|
+
stagedRows: Ea,
|
|
2667
2673
|
relatedCollection: a,
|
|
2668
2674
|
childRelations: We,
|
|
2669
2675
|
parentDraft: N == null ? void 0 : N.draft,
|
|
@@ -2671,9 +2677,9 @@ function Pd({
|
|
|
2671
2677
|
m2oDisplays: pn,
|
|
2672
2678
|
client: S
|
|
2673
2679
|
});
|
|
2674
|
-
async function
|
|
2680
|
+
async function Ys(e) {
|
|
2675
2681
|
if (!S || !(L != null && L.length) || O && M.length === 0) return;
|
|
2676
|
-
|
|
2682
|
+
ao(e ? "preview" : "apply");
|
|
2677
2683
|
const n = K && !!k, t = M.map((i, o) => ({ ...i, id: `pending:${o}` })), r = {};
|
|
2678
2684
|
if (k)
|
|
2679
2685
|
for (const [i, o] of k.getPendingEdits(a, f))
|
|
@@ -2684,10 +2690,10 @@ function Pd({
|
|
|
2684
2690
|
collection: a,
|
|
2685
2691
|
fk_field: f,
|
|
2686
2692
|
...O ? {} : { parent_id: v },
|
|
2687
|
-
parent_context:
|
|
2693
|
+
parent_context: jt(),
|
|
2688
2694
|
parent_collection: E,
|
|
2689
2695
|
row_rules: L,
|
|
2690
|
-
mode:
|
|
2696
|
+
mode: _i,
|
|
2691
2697
|
dry_run: e || n || t.length > 0,
|
|
2692
2698
|
all_changes: n || t.length > 0,
|
|
2693
2699
|
rows: t,
|
|
@@ -2713,13 +2719,13 @@ function Pd({
|
|
|
2713
2719
|
for (const l of u)
|
|
2714
2720
|
Je.has(String(l.id)) || k.queueEdit(a, f, String(l.id), l.patch);
|
|
2715
2721
|
const d = c.length + u.length;
|
|
2716
|
-
Se.success(`Rules staged on ${d} ${d === 1 ? "line" : "lines"} — saved with the record`), gn(null),
|
|
2722
|
+
Se.success(`Rules staged on ${d} ${d === 1 ? "line" : "lines"} — saved with the record`), gn(null), Ar(!1);
|
|
2717
2723
|
return;
|
|
2718
2724
|
}
|
|
2719
2725
|
if (c.length > 0 && u.length === 0) {
|
|
2720
2726
|
Se.success(
|
|
2721
2727
|
`Rules applied to ${c.length} pending ${c.length === 1 ? "line" : "lines"}`
|
|
2722
|
-
), gn(null),
|
|
2728
|
+
), gn(null), Ar(!1);
|
|
2723
2729
|
return;
|
|
2724
2730
|
}
|
|
2725
2731
|
if (c.length > 0) {
|
|
@@ -2728,10 +2734,10 @@ function Pd({
|
|
|
2728
2734
|
collection: a,
|
|
2729
2735
|
fk_field: f,
|
|
2730
2736
|
parent_id: v,
|
|
2731
|
-
parent_context:
|
|
2737
|
+
parent_context: jt(),
|
|
2732
2738
|
parent_collection: E,
|
|
2733
2739
|
row_rules: L,
|
|
2734
|
-
mode:
|
|
2740
|
+
mode: _i,
|
|
2735
2741
|
dry_run: !1,
|
|
2736
2742
|
saved_overrides: r
|
|
2737
2743
|
})
|
|
@@ -2743,14 +2749,14 @@ function Pd({
|
|
|
2743
2749
|
queryKey: ["o2m-field-snapshots", a, f, v]
|
|
2744
2750
|
}), o.failed.length ? Se.error(
|
|
2745
2751
|
`Rules applied to ${o.applied} ${o.applied === 1 ? "line" : "lines"} — ${o.failed.length} failed: ${o.failed.slice(0, 3).map((d) => `#${d.id} ${d.error}`).join("; ")}`
|
|
2746
|
-
) : Se.success(`Rules applied to ${o.applied} ${o.applied === 1 ? "line" : "lines"}`), gn(null),
|
|
2752
|
+
) : Se.success(`Rules applied to ${o.applied} ${o.applied === 1 ? "line" : "lines"}`), gn(null), Ar(!1);
|
|
2747
2753
|
} catch (i) {
|
|
2748
|
-
Se.error(`Re-run rules failed: ${
|
|
2754
|
+
Se.error(`Re-run rules failed: ${Xn(i, "unknown error")}`);
|
|
2749
2755
|
} finally {
|
|
2750
|
-
|
|
2756
|
+
ao(null);
|
|
2751
2757
|
}
|
|
2752
2758
|
}
|
|
2753
|
-
function
|
|
2759
|
+
function jt() {
|
|
2754
2760
|
const e = {};
|
|
2755
2761
|
if (N != null && N.draft) {
|
|
2756
2762
|
if (Ee != null && Ee.length)
|
|
@@ -2765,14 +2771,14 @@ function Pd({
|
|
|
2765
2771
|
}
|
|
2766
2772
|
return e;
|
|
2767
2773
|
}
|
|
2768
|
-
function
|
|
2774
|
+
function Or(e, n) {
|
|
2769
2775
|
!S || !L || L.length === 0 || S.request(
|
|
2770
2776
|
Ke("/field-rules/evaluate", {
|
|
2771
2777
|
collection: a,
|
|
2772
2778
|
data: n,
|
|
2773
2779
|
locks_only: !0,
|
|
2774
2780
|
probe: !0,
|
|
2775
|
-
parent_context:
|
|
2781
|
+
parent_context: jt(),
|
|
2776
2782
|
parent_collection: E,
|
|
2777
2783
|
row_rules: L
|
|
2778
2784
|
})
|
|
@@ -2791,26 +2797,26 @@ function Pd({
|
|
|
2791
2797
|
De((t) => t && t.rowId === e ? { ...t, locksPending: !1 } : t);
|
|
2792
2798
|
});
|
|
2793
2799
|
}
|
|
2794
|
-
function
|
|
2800
|
+
function Ir(e) {
|
|
2795
2801
|
if (j) return;
|
|
2796
2802
|
const n = String(e.id);
|
|
2797
2803
|
if ((p == null ? void 0 : p.rowId) === n) return;
|
|
2798
|
-
|
|
2799
|
-
const t =
|
|
2800
|
-
if (t && !
|
|
2804
|
+
fi.current();
|
|
2805
|
+
const t = Na(n);
|
|
2806
|
+
if (t && !ui.current.has(zs(n, t))) {
|
|
2801
2807
|
Yt({ rowKey: n, editor: t });
|
|
2802
2808
|
return;
|
|
2803
2809
|
}
|
|
2804
2810
|
Ce && Yt(null);
|
|
2805
2811
|
const r = ce({ ...e });
|
|
2806
|
-
fn.current = { rowId: n, snap: Nt(e) }, De({ rowId: n, draft: r, locksPending: Nn.size > 0 }),
|
|
2812
|
+
fn.current = { rowId: n, snap: Nt(e) }, De({ rowId: n, draft: r, locksPending: Nn.size > 0 }), Or(n, r);
|
|
2807
2813
|
}
|
|
2808
2814
|
$e(() => {
|
|
2809
2815
|
const e = (n) => {
|
|
2810
2816
|
const t = n.detail;
|
|
2811
2817
|
if (!t || t.collection !== a || t.field !== f || !t.rowId) return;
|
|
2812
2818
|
const r = $.find((i) => String(i.id) === String(t.rowId));
|
|
2813
|
-
r && (
|
|
2819
|
+
r && (Ir(r), window.setTimeout(() => {
|
|
2814
2820
|
const i = document.querySelector(
|
|
2815
2821
|
`[data-o2m-row="${a}:${String(t.rowId)}"]`
|
|
2816
2822
|
);
|
|
@@ -2819,15 +2825,15 @@ function Pd({
|
|
|
2819
2825
|
};
|
|
2820
2826
|
return window.addEventListener("nvr:grid-open-row", e), () => window.removeEventListener("nvr:grid-open-row", e);
|
|
2821
2827
|
}, [a, f, $]);
|
|
2822
|
-
function
|
|
2828
|
+
function Gs(e, n) {
|
|
2823
2829
|
if (j) return;
|
|
2824
2830
|
const t = `pending:${n}`;
|
|
2825
2831
|
if ((p == null ? void 0 : p.rowId) === t) return;
|
|
2826
2832
|
Ce && Yt(null);
|
|
2827
2833
|
const r = ce({ ...e });
|
|
2828
|
-
De({ rowId: t, draft: r, locksPending: Nn.size > 0 }),
|
|
2834
|
+
De({ rowId: t, draft: r, locksPending: Nn.size > 0 }), Or(t, r);
|
|
2829
2835
|
}
|
|
2830
|
-
function
|
|
2836
|
+
function Xs(e) {
|
|
2831
2837
|
var d, l, m, h;
|
|
2832
2838
|
const n = (l = (d = Ge.current) == null ? void 0 : d.lockReasons) == null ? void 0 : l[e];
|
|
2833
2839
|
if (!n) return "Set automatically for this row";
|
|
@@ -2837,7 +2843,7 @@ function Pd({
|
|
|
2837
2843
|
const u = n.op === "neq" ? "is not" : n.op === "null" ? "is empty" : n.op === "nnull" ? "is set" : n.op === "in" ? "is one of" : n.op === "contains" ? "contains" : "is";
|
|
2838
2844
|
return `Locked — ${r} ${u}${n.op === "null" || n.op === "nnull" ? "" : ` ${n.value ?? ""}`}`;
|
|
2839
2845
|
}
|
|
2840
|
-
function
|
|
2846
|
+
function Oa(e) {
|
|
2841
2847
|
const n = p == null ? void 0 : p.expected;
|
|
2842
2848
|
if (!n || !(e in n)) return null;
|
|
2843
2849
|
const t = p == null ? void 0 : p.draft[e];
|
|
@@ -2845,28 +2851,28 @@ function Pd({
|
|
|
2845
2851
|
const i = n[e];
|
|
2846
2852
|
return i == null || i === "" ? null : String(t) === String(i) ? "auto" : "overridden";
|
|
2847
2853
|
}
|
|
2848
|
-
function
|
|
2854
|
+
function Ia(e) {
|
|
2849
2855
|
const n = Ge.current;
|
|
2850
2856
|
if (!n || !S || !L || L.length === 0) return;
|
|
2851
2857
|
const t = n.rowId;
|
|
2852
2858
|
ct.current.rowId !== t && (ct.current = { rowId: t, seqs: /* @__PURE__ */ new Map() });
|
|
2853
|
-
const r = ++
|
|
2859
|
+
const r = ++Vr.current;
|
|
2854
2860
|
ct.current.seqs.set(e, r), S.request(
|
|
2855
2861
|
Ke("/field-rules/evaluate", {
|
|
2856
2862
|
collection: a,
|
|
2857
2863
|
data: n.draft,
|
|
2858
2864
|
target_fields: [e],
|
|
2859
2865
|
probe: !0,
|
|
2860
|
-
parent_context:
|
|
2866
|
+
parent_context: jt(),
|
|
2861
2867
|
parent_collection: E,
|
|
2862
2868
|
row_rules: L
|
|
2863
2869
|
})
|
|
2864
2870
|
).then(
|
|
2865
|
-
(i) =>
|
|
2871
|
+
(i) => Cs(t, r, { ...i, updates: { [e]: null, ...i.updates } })
|
|
2866
2872
|
).catch(() => {
|
|
2867
2873
|
});
|
|
2868
2874
|
}
|
|
2869
|
-
function
|
|
2875
|
+
function xi(e, n, t) {
|
|
2870
2876
|
if (!t || !(L != null && L.length)) return [];
|
|
2871
2877
|
const r = /* @__PURE__ */ new Set();
|
|
2872
2878
|
for (const i of L) {
|
|
@@ -2881,7 +2887,7 @@ function Pd({
|
|
|
2881
2887
|
return o == null || o === "" || c == null || c === "" ? !1 : String(o) === String(c);
|
|
2882
2888
|
});
|
|
2883
2889
|
}
|
|
2884
|
-
function
|
|
2890
|
+
function Cs(e, n, t, r = []) {
|
|
2885
2891
|
var u;
|
|
2886
2892
|
if (((u = Ge.current) == null ? void 0 : u.rowId) !== e || ct.current.rowId !== e) return;
|
|
2887
2893
|
const i = ct.current.seqs, o = {};
|
|
@@ -2900,45 +2906,45 @@ function Pd({
|
|
|
2900
2906
|
provenance: t.provenance ?? d.provenance
|
|
2901
2907
|
});
|
|
2902
2908
|
}
|
|
2903
|
-
function
|
|
2909
|
+
function Zs(e, n) {
|
|
2904
2910
|
if (j) return;
|
|
2905
2911
|
const t = { ...e };
|
|
2906
2912
|
if (n.rowDeleted || !n.itemId) {
|
|
2907
2913
|
delete t.id;
|
|
2908
|
-
for (const r of Object.keys(t))
|
|
2914
|
+
for (const r of Object.keys(t)) qo.has(r) && delete t[r];
|
|
2909
2915
|
delete t[f], De({
|
|
2910
2916
|
rowId: "new",
|
|
2911
2917
|
draft: sn(t),
|
|
2912
2918
|
locksPending: Nn.size > 0
|
|
2913
|
-
}),
|
|
2919
|
+
}), Or("new", t);
|
|
2914
2920
|
} else
|
|
2915
2921
|
De({ rowId: String(n.itemId), draft: t });
|
|
2916
|
-
kn(null),
|
|
2922
|
+
kn(null), Fr(null), ar(!1);
|
|
2917
2923
|
}
|
|
2918
|
-
function
|
|
2919
|
-
j || (De({ rowId: "new", draft: { ...Ft }, locksPending: Nn.size > 0 }),
|
|
2924
|
+
function Aa() {
|
|
2925
|
+
j || (De({ rowId: "new", draft: { ...Ft }, locksPending: Nn.size > 0 }), Or("new", { ...Ft }));
|
|
2920
2926
|
}
|
|
2921
|
-
function
|
|
2927
|
+
function Jn() {
|
|
2922
2928
|
var n;
|
|
2923
2929
|
const e = (n = Ge.current) == null ? void 0 : n.rowId;
|
|
2924
|
-
De(null), zt(null),
|
|
2930
|
+
De(null), zt(null), gr((t) => {
|
|
2925
2931
|
const r = {};
|
|
2926
2932
|
for (const [i, o] of Object.entries(t))
|
|
2927
2933
|
e && i.startsWith(`${e}|`) || i.startsWith("__new__|") || (r[i] = o);
|
|
2928
2934
|
return r;
|
|
2929
2935
|
});
|
|
2930
2936
|
}
|
|
2931
|
-
function
|
|
2937
|
+
function vi(e) {
|
|
2932
2938
|
const n = Ge.current, t = (n == null ? void 0 : n.rowId) ?? null;
|
|
2933
2939
|
ct.current.rowId !== t && (ct.current = { rowId: t, seqs: /* @__PURE__ */ new Map() });
|
|
2934
|
-
for (const i of Object.keys(e)) ct.current.seqs.set(i, ++
|
|
2940
|
+
for (const i of Object.keys(e)) ct.current.seqs.set(i, ++Vr.current);
|
|
2935
2941
|
const r = ce({ ...(n == null ? void 0 : n.draft) ?? {}, ...e });
|
|
2936
2942
|
De((i) => i && { ...i, draft: r });
|
|
2937
2943
|
}
|
|
2938
2944
|
function mt(e, n) {
|
|
2939
2945
|
const t = Ge.current, r = (t == null ? void 0 : t.rowId) ?? null;
|
|
2940
2946
|
ct.current.rowId !== r && (ct.current = { rowId: r, seqs: /* @__PURE__ */ new Map() });
|
|
2941
|
-
const i = ++
|
|
2947
|
+
const i = ++Vr.current;
|
|
2942
2948
|
ct.current.seqs.set(e, i);
|
|
2943
2949
|
const o = ce(t ? { ...t.draft, [e]: n } : { [e]: n }), c = n != null && n !== "";
|
|
2944
2950
|
if (De(
|
|
@@ -2951,7 +2957,7 @@ function Pd({
|
|
|
2951
2957
|
};
|
|
2952
2958
|
}
|
|
2953
2959
|
), L && L.length > 0 && S) {
|
|
2954
|
-
const u =
|
|
2960
|
+
const u = jt(), d = xi(e, (t == null ? void 0 : t.draft) ?? {}, t == null ? void 0 : t.expected), l = { ...o };
|
|
2955
2961
|
for (const m of d) l[m] = null;
|
|
2956
2962
|
S.request(
|
|
2957
2963
|
Ke("/field-rules/evaluate", {
|
|
@@ -2962,11 +2968,11 @@ function Pd({
|
|
|
2962
2968
|
parent_context: u,
|
|
2963
2969
|
row_rules: L
|
|
2964
2970
|
})
|
|
2965
|
-
).then((m) =>
|
|
2971
|
+
).then((m) => Cs(r ?? "", i, m, d)).catch(() => {
|
|
2966
2972
|
});
|
|
2967
2973
|
}
|
|
2968
2974
|
}
|
|
2969
|
-
async function
|
|
2975
|
+
async function Tt() {
|
|
2970
2976
|
var d;
|
|
2971
2977
|
if (!p) return !1;
|
|
2972
2978
|
const e = p.rowId, n = () => {
|
|
@@ -2974,31 +2980,31 @@ function Pd({
|
|
|
2974
2980
|
((l = Ge.current) == null ? void 0 : l.rowId) === e && De(null);
|
|
2975
2981
|
};
|
|
2976
2982
|
if (ze != null && ze.length) {
|
|
2977
|
-
const l = p.rowId.startsWith("pending:"), m = l ? parseInt(p.rowId.split(":")[1], 10) : null, h = p.rowId === "new" || l ? null : p.rowId, b =
|
|
2983
|
+
const l = p.rowId.startsWith("pending:"), m = l ? parseInt(p.rowId.split(":")[1], 10) : null, h = p.rowId === "new" || l ? null : p.rowId, b = Ri(p.draft, ze);
|
|
2978
2984
|
if ($.some((w) => {
|
|
2979
2985
|
if (String(w.id) === h || Je.has(String(w.id))) return !1;
|
|
2980
2986
|
const y = H.has(String(w.id)) ? { ...w, ...H.get(String(w.id)) } : w;
|
|
2981
|
-
return
|
|
2982
|
-
}) || M.some((w, y) => y !== m &&
|
|
2987
|
+
return Ri(y, ze) === b;
|
|
2988
|
+
}) || M.some((w, y) => y !== m && Ri(w, ze) === b))
|
|
2983
2989
|
return zt(`A row with the same ${ze.join(" + ")} already exists.`), !1;
|
|
2984
2990
|
}
|
|
2985
2991
|
const t = (l) => l == null || l === "", r = Ne.filter(
|
|
2986
2992
|
(l) => {
|
|
2987
2993
|
var m;
|
|
2988
|
-
return l.required && !
|
|
2994
|
+
return l.required && !Bn(l) && !((m = p.locks) != null && m.includes(l.field)) && t(p.draft[l.field]);
|
|
2989
2995
|
}
|
|
2990
2996
|
);
|
|
2991
2997
|
if (r.length > 0)
|
|
2992
2998
|
return zt(
|
|
2993
2999
|
`Required: ${r.map((l) => l.label || qe(l.field)).join(", ")}`
|
|
2994
3000
|
), De((l) => l && { ...l, missing: r.map((m) => m.field) }), !1;
|
|
2995
|
-
const i =
|
|
3001
|
+
const i = hs(p.rowId), o = Ne.flatMap((l) => {
|
|
2996
3002
|
var h;
|
|
2997
|
-
if (
|
|
2998
|
-
if (!
|
|
3003
|
+
if (Bn(l) || (h = p.locks) != null && h.includes(l.field)) return [];
|
|
3004
|
+
if (!jl.has(l.type ?? "")) return [];
|
|
2999
3005
|
if (i && String(i[l.field] ?? "") === String(p.draft[l.field] ?? ""))
|
|
3000
3006
|
return [];
|
|
3001
|
-
const m =
|
|
3007
|
+
const m = Tl(p.draft[l.field], {
|
|
3002
3008
|
type: l.type,
|
|
3003
3009
|
label: l.label || qe(l.field)
|
|
3004
3010
|
});
|
|
@@ -3006,7 +3012,7 @@ function Pd({
|
|
|
3006
3012
|
});
|
|
3007
3013
|
if (o.length > 0)
|
|
3008
3014
|
return zt(o.map((l) => l.message).join(" · ")), De((l) => l && { ...l, missing: o.map((m) => m.field) }), !1;
|
|
3009
|
-
const c = i ?
|
|
3015
|
+
const c = i ? Eo(p.draft, i, new Set(Object.keys(p.draft))) : p.draft, u = Ll(
|
|
3010
3016
|
ke.map((l) => ({
|
|
3011
3017
|
field: l.field,
|
|
3012
3018
|
label: l.label || qe(l.field),
|
|
@@ -3045,7 +3051,7 @@ function Pd({
|
|
|
3045
3051
|
try {
|
|
3046
3052
|
if (p.rowId.startsWith("pending:")) {
|
|
3047
3053
|
const l = parseInt(p.rowId.split(":")[1], 10), m = M[l];
|
|
3048
|
-
return k == null || k.updateRow(a, f, l, p.draft), m != null && m.__prefilled && (m == null ? void 0 : m.id) != null &&
|
|
3054
|
+
return k == null || k.updateRow(a, f, l, p.draft), m != null && m.__prefilled && (m == null ? void 0 : m.id) != null && Ta((h) => /* @__PURE__ */ new Set([...h, m.id])), n(), Sn(!1), !0;
|
|
3049
3055
|
}
|
|
3050
3056
|
if (p.rowId === "new") {
|
|
3051
3057
|
if ((O || K) && k)
|
|
@@ -3061,7 +3067,7 @@ function Pd({
|
|
|
3061
3067
|
Ke(`/items/${a}${dt}`, b)
|
|
3062
3068
|
);
|
|
3063
3069
|
} catch (y) {
|
|
3064
|
-
const x =
|
|
3070
|
+
const x = Ei(y);
|
|
3065
3071
|
if (x)
|
|
3066
3072
|
return qn({
|
|
3067
3073
|
challenge: x,
|
|
@@ -3073,7 +3079,7 @@ function Pd({
|
|
|
3073
3079
|
_change_reason: R
|
|
3074
3080
|
})
|
|
3075
3081
|
);
|
|
3076
|
-
|
|
3082
|
+
Ot.current = Date.now(), ((B = I == null ? void 0 : I.data) == null ? void 0 : B.id) != null && ot(String(I.data.id)), V.invalidateQueries({
|
|
3077
3083
|
queryKey: ["o2m-rows", a, f, v]
|
|
3078
3084
|
}), n();
|
|
3079
3085
|
}
|
|
@@ -3081,10 +3087,10 @@ function Pd({
|
|
|
3081
3087
|
throw y;
|
|
3082
3088
|
}
|
|
3083
3089
|
const w = (d = g == null ? void 0 : g.data) == null ? void 0 : d.id;
|
|
3084
|
-
if (
|
|
3090
|
+
if (Ot.current = Date.now(), w != null && ot(String(w)), w != null && l.length && await Promise.all(
|
|
3085
3091
|
l.map(([y, x]) => {
|
|
3086
3092
|
if (x == null) return Promise.resolve();
|
|
3087
|
-
const R = y.slice(6), I =
|
|
3093
|
+
const R = y.slice(6), I = ti({
|
|
3088
3094
|
field: R,
|
|
3089
3095
|
interface: "select-multiple-m2m"
|
|
3090
3096
|
});
|
|
@@ -3119,7 +3125,7 @@ function Pd({
|
|
|
3119
3125
|
})
|
|
3120
3126
|
);
|
|
3121
3127
|
} catch ($t) {
|
|
3122
|
-
ee.push(Be), x || (x =
|
|
3128
|
+
ee.push(Be), x || (x = To($t));
|
|
3123
3129
|
}
|
|
3124
3130
|
ee.length && y.push({
|
|
3125
3131
|
label: qe(Y),
|
|
@@ -3130,10 +3136,10 @@ function Pd({
|
|
|
3130
3136
|
});
|
|
3131
3137
|
}
|
|
3132
3138
|
const B = y.reduce((F, Me) => F + Me.members.length, 0);
|
|
3133
|
-
I > 0 ?
|
|
3139
|
+
I > 0 ? dr({
|
|
3134
3140
|
text: `The line saved, but ${I} of ${R} nested row${R === 1 ? "" : "s"} could not be attached — the server did not return the new line's id. Open the line and add them again.`,
|
|
3135
3141
|
groups: []
|
|
3136
|
-
}) : B > 0 &&
|
|
3142
|
+
}) : B > 0 && dr({
|
|
3137
3143
|
text: `${B} of ${R} ${y.map((F) => F.label).join(", ")} row${R === 1 ? "" : "s"} did not save — ${x}`,
|
|
3138
3144
|
groups: y
|
|
3139
3145
|
});
|
|
@@ -3146,7 +3152,7 @@ function Pd({
|
|
|
3146
3152
|
// A reason an editor action prefilled (carry-forward) rides the row:
|
|
3147
3153
|
// the server stores it on the activity row, never in a column.
|
|
3148
3154
|
"_change_reason"
|
|
3149
|
-
]), h = $.find((g) => String(g.id) === p.rowId), b =
|
|
3155
|
+
]), h = $.find((g) => String(g.id) === p.rowId), b = Eo(p.draft, h, m);
|
|
3150
3156
|
if (K && k) {
|
|
3151
3157
|
const g = Object.entries(p.draft).filter(
|
|
3152
3158
|
([y]) => y.startsWith("__nested_ops_")
|
|
@@ -3163,7 +3169,7 @@ function Pd({
|
|
|
3163
3169
|
yt(`/items/${a}/${p.rowId}${dt}`, b)
|
|
3164
3170
|
);
|
|
3165
3171
|
} catch (g) {
|
|
3166
|
-
const w =
|
|
3172
|
+
const w = Ei(g);
|
|
3167
3173
|
if (w) {
|
|
3168
3174
|
const y = `/items/${a}/${p.rowId}${dt}`;
|
|
3169
3175
|
return qn({
|
|
@@ -3186,15 +3192,15 @@ function Pd({
|
|
|
3186
3192
|
Sn(!1);
|
|
3187
3193
|
}
|
|
3188
3194
|
}
|
|
3189
|
-
const [
|
|
3190
|
-
function
|
|
3191
|
-
|
|
3195
|
+
const [ja, Ta] = U(/* @__PURE__ */ new Set()), [gt, eo] = U(null), [Lt, to] = U(null), [La, no] = U(!1), [Gt, Ma] = U(1), [Xt, hn] = U(!1), [ro, Ka] = U(!1), [wi, Ra] = U({}), [io, so] = U(!1), [oo, Ar] = U(!1), [_i, Pa] = U("empty-only"), [jr, ao] = U(null), [Mt, gn] = U(null), [Ct, lo] = U({}), [co, uo] = U(!1);
|
|
3196
|
+
function Da(e, n) {
|
|
3197
|
+
Ra((t) => ({ ...t, [e]: n }));
|
|
3192
3198
|
}
|
|
3193
|
-
async function
|
|
3199
|
+
async function Wa() {
|
|
3194
3200
|
if (Object.keys(Ct).some(
|
|
3195
3201
|
(n) => Ct[n] !== null && Ct[n] !== void 0
|
|
3196
3202
|
)) {
|
|
3197
|
-
|
|
3203
|
+
uo(!0);
|
|
3198
3204
|
try {
|
|
3199
3205
|
if ($.length)
|
|
3200
3206
|
if (K && k)
|
|
@@ -3212,17 +3218,17 @@ function Pd({
|
|
|
3212
3218
|
}
|
|
3213
3219
|
M.length && k && M.forEach(
|
|
3214
3220
|
(n, t) => k.updateRow(a, f, t, { ...n, ...Ct })
|
|
3215
|
-
),
|
|
3221
|
+
), so(!1), lo({});
|
|
3216
3222
|
} catch {
|
|
3217
3223
|
} finally {
|
|
3218
|
-
|
|
3224
|
+
uo(!1);
|
|
3219
3225
|
}
|
|
3220
3226
|
}
|
|
3221
3227
|
}
|
|
3222
|
-
async function
|
|
3228
|
+
async function Ua(e) {
|
|
3223
3229
|
const n = Math.max(1, Math.min(24, Gt)), t = /* @__PURE__ */ new Date(), r = Array.from({ length: n }, (i, o) => {
|
|
3224
3230
|
const c = new Date(t.getFullYear(), t.getMonth() + 1 + o, 1), u = `${c.getFullYear()}-${String(c.getMonth() + 1).padStart(2, "0")}-01`;
|
|
3225
|
-
return { ...Ft, ...
|
|
3231
|
+
return { ...Ft, ...wi, [e]: u };
|
|
3226
3232
|
});
|
|
3227
3233
|
if ((O || K) && k) {
|
|
3228
3234
|
for (const i of on(r)) k.queueRow(a, f, i);
|
|
@@ -3234,18 +3240,18 @@ function Pd({
|
|
|
3234
3240
|
await S.request(
|
|
3235
3241
|
Ke(`/items/${a}${dt}`, { ...i, [f]: v })
|
|
3236
3242
|
);
|
|
3237
|
-
|
|
3243
|
+
Ot.current = Date.now(), V.invalidateQueries({ queryKey: ["o2m-rows", a, f, v] });
|
|
3238
3244
|
} catch {
|
|
3239
3245
|
} finally {
|
|
3240
3246
|
hn(!1);
|
|
3241
3247
|
}
|
|
3242
3248
|
}
|
|
3243
|
-
async function
|
|
3249
|
+
async function Ja() {
|
|
3244
3250
|
const e = ae == null ? void 0 : ae.unmatched_banner;
|
|
3245
|
-
if (!e ||
|
|
3246
|
-
const n =
|
|
3251
|
+
if (!e || At.unmatchedCandidates.length === 0) return;
|
|
3252
|
+
const n = At.unmatchedCandidates.map((t) => ({
|
|
3247
3253
|
...Ft,
|
|
3248
|
-
...
|
|
3254
|
+
...Jl(e, t)
|
|
3249
3255
|
}));
|
|
3250
3256
|
if ((O || K) && k) {
|
|
3251
3257
|
for (const t of on(n)) k.queueRow(a, f, t);
|
|
@@ -3257,15 +3263,15 @@ function Pd({
|
|
|
3257
3263
|
await S.request(
|
|
3258
3264
|
Ke(`/items/${a}${dt}`, { ...t, [f]: v })
|
|
3259
3265
|
);
|
|
3260
|
-
|
|
3266
|
+
Ot.current = Date.now(), V.invalidateQueries({ queryKey: ["o2m-rows", a, f, v] });
|
|
3261
3267
|
} catch (t) {
|
|
3262
|
-
Se.error(`Could not add rows: ${
|
|
3268
|
+
Se.error(`Could not add rows: ${Xn(t, "unknown error")}`);
|
|
3263
3269
|
} finally {
|
|
3264
3270
|
hn(!1);
|
|
3265
3271
|
}
|
|
3266
3272
|
}
|
|
3267
|
-
async function
|
|
3268
|
-
const n = Math.max(1, Math.min(100, Gt)), t = e ? { ...Ft, ...
|
|
3273
|
+
async function fo(e) {
|
|
3274
|
+
const n = Math.max(1, Math.min(100, Gt)), t = e ? { ...Ft, ...wi } : { ...Ft };
|
|
3269
3275
|
if ((O || K) && k) {
|
|
3270
3276
|
const r = on(Array.from({ length: n }, () => ({ ...t })));
|
|
3271
3277
|
for (const i of r) k.queueRow(a, f, i);
|
|
@@ -3277,28 +3283,28 @@ function Pd({
|
|
|
3277
3283
|
await S.request(
|
|
3278
3284
|
Ke(`/items/${a}${dt}`, { ...r, [f]: v })
|
|
3279
3285
|
);
|
|
3280
|
-
|
|
3286
|
+
Ot.current = Date.now(), V.invalidateQueries({ queryKey: ["o2m-rows", a, f, v] });
|
|
3281
3287
|
} catch {
|
|
3282
3288
|
} finally {
|
|
3283
3289
|
hn(!1);
|
|
3284
3290
|
}
|
|
3285
3291
|
}
|
|
3286
|
-
function
|
|
3287
|
-
|
|
3292
|
+
function mo(e) {
|
|
3293
|
+
eo(e);
|
|
3288
3294
|
}
|
|
3289
|
-
function
|
|
3290
|
-
e.preventDefault(),
|
|
3295
|
+
function po(e, n) {
|
|
3296
|
+
e.preventDefault(), to(n);
|
|
3291
3297
|
}
|
|
3292
3298
|
function bn() {
|
|
3293
|
-
|
|
3299
|
+
eo(null), to(null);
|
|
3294
3300
|
}
|
|
3295
|
-
async function
|
|
3296
|
-
if (e.preventDefault(), gt === null ||
|
|
3301
|
+
async function za(e) {
|
|
3302
|
+
if (e.preventDefault(), gt === null || Lt === null || gt === Lt) {
|
|
3297
3303
|
bn();
|
|
3298
3304
|
return;
|
|
3299
3305
|
}
|
|
3300
3306
|
const n = [...$], [t] = n.splice(gt, 1);
|
|
3301
|
-
n.splice(
|
|
3307
|
+
n.splice(Lt, 0, t);
|
|
3302
3308
|
const r = n.map((i, o) => ({ row: i, newOrder: o })).filter(({ row: i, newOrder: o }) => {
|
|
3303
3309
|
const c = K ? H.get(String(i.id)) : void 0, u = (c == null ? void 0 : c[C]) ?? i[C];
|
|
3304
3310
|
return Number(u ?? -1) !== o;
|
|
@@ -3311,7 +3317,7 @@ function Pd({
|
|
|
3311
3317
|
), bn();
|
|
3312
3318
|
return;
|
|
3313
3319
|
}
|
|
3314
|
-
|
|
3320
|
+
no(!0);
|
|
3315
3321
|
try {
|
|
3316
3322
|
await Promise.all(
|
|
3317
3323
|
r.map(
|
|
@@ -3322,10 +3328,10 @@ function Pd({
|
|
|
3322
3328
|
), V.invalidateQueries({ queryKey: ["o2m-rows", a, f, v] });
|
|
3323
3329
|
} catch {
|
|
3324
3330
|
} finally {
|
|
3325
|
-
|
|
3331
|
+
no(!1), bn();
|
|
3326
3332
|
}
|
|
3327
3333
|
}
|
|
3328
|
-
async function
|
|
3334
|
+
async function ki(e, n) {
|
|
3329
3335
|
n.stopPropagation();
|
|
3330
3336
|
const t = e.id;
|
|
3331
3337
|
if (K && k) {
|
|
@@ -3333,7 +3339,7 @@ function Pd({
|
|
|
3333
3339
|
return;
|
|
3334
3340
|
}
|
|
3335
3341
|
try {
|
|
3336
|
-
await S.request(
|
|
3342
|
+
await S.request(Ko(`/items/${a}/${t}${dt}`)), ot(String(t)), V.invalidateQueries({ queryKey: ["o2m-rows", a, f, v] }), (p == null ? void 0 : p.rowId) === String(t) && De(null), W && V.invalidateQueries({
|
|
3337
3343
|
queryKey: ["o2m-field-snapshots", a, f, v]
|
|
3338
3344
|
});
|
|
3339
3345
|
} catch {
|
|
@@ -3372,7 +3378,7 @@ function Pd({
|
|
|
3372
3378
|
return /* @__PURE__ */ s("span", { className: "tabular-nums", "data-tip": `${m} = ${y} = ${w}`, children: w });
|
|
3373
3379
|
}
|
|
3374
3380
|
if (e.interface === "match-agg-column") {
|
|
3375
|
-
const m =
|
|
3381
|
+
const m = oa.get(e.field);
|
|
3376
3382
|
if (!m || !t) return /* @__PURE__ */ s("span", { className: "text-slate-300", children: "—" });
|
|
3377
3383
|
const h = $.find((x) => String(x.id) === t) ?? {}, b = (x, R) => R.split(".").reduce(
|
|
3378
3384
|
(I, B) => I && typeof I == "object" ? I[B] : void 0,
|
|
@@ -3416,7 +3422,7 @@ function Pd({
|
|
|
3416
3422
|
}
|
|
3417
3423
|
if (n == null) return /* @__PURE__ */ s("span", { className: "text-slate-300", children: "—" });
|
|
3418
3424
|
if (e.interface === "relation-path" && le && t) {
|
|
3419
|
-
const m =
|
|
3425
|
+
const m = So(e), h = (u = Ae == null ? void 0 : Ae.rows[t]) == null ? void 0 : u[e.field], b = Ae == null ? void 0 : Ae.targets[e.field];
|
|
3420
3426
|
if (m && h && b && h.ids.length > 0)
|
|
3421
3427
|
return /* @__PURE__ */ s(
|
|
3422
3428
|
"button",
|
|
@@ -3439,9 +3445,9 @@ function Pd({
|
|
|
3439
3445
|
const o = Ve.get(e.field);
|
|
3440
3446
|
if (o != null && o.one_collection) {
|
|
3441
3447
|
const m = (d = pn[o.one_collection]) == null ? void 0 : d[String(n)];
|
|
3442
|
-
if (!m &&
|
|
3448
|
+
if (!m && qa)
|
|
3443
3449
|
return /* @__PURE__ */ s(vn, { className: "h-3 w-3 animate-spin text-slate-300" });
|
|
3444
|
-
const h = le ?
|
|
3450
|
+
const h = le ? So(e) : null, b = n != null && ((l = bi.get(e.field)) == null ? void 0 : l.has(String(n))) === !0;
|
|
3445
3451
|
let g;
|
|
3446
3452
|
return h && le ? g = /* @__PURE__ */ s(
|
|
3447
3453
|
"button",
|
|
@@ -3459,13 +3465,13 @@ function Pd({
|
|
|
3459
3465
|
className: "block max-w-full truncate text-left underline decoration-slate-300 decoration-dotted underline-offset-2 hover:text-[#172940] hover:decoration-nvr-cyan dark:hover:text-nvr-cyan",
|
|
3460
3466
|
children: m ?? String(n)
|
|
3461
3467
|
}
|
|
3462
|
-
) : g = /* @__PURE__ */ s("span", { className: "block truncate", children: m ?? String(n) }), b ? /* @__PURE__ */ s(
|
|
3468
|
+
) : g = /* @__PURE__ */ s("span", { className: "block truncate", children: m ?? String(n) }), b ? /* @__PURE__ */ s(Bl, { children: g }) : g;
|
|
3463
3469
|
}
|
|
3464
3470
|
if (e.type === "boolean")
|
|
3465
3471
|
return /* @__PURE__ */ s("span", { className: n ? "text-emerald-600" : "text-slate-400", children: n ? "Yes" : "No" });
|
|
3466
3472
|
if (e.type === "datetime" || e.type === "date")
|
|
3467
3473
|
try {
|
|
3468
|
-
return /* @__PURE__ */ s("span", { className: "block truncate", children:
|
|
3474
|
+
return /* @__PURE__ */ s("span", { className: "block truncate", children: hl(n) });
|
|
3469
3475
|
} catch {
|
|
3470
3476
|
}
|
|
3471
3477
|
if ([
|
|
@@ -3509,11 +3515,11 @@ function Pd({
|
|
|
3509
3515
|
}
|
|
3510
3516
|
return /* @__PURE__ */ s("span", { className: "block truncate", children: String(n) });
|
|
3511
3517
|
}
|
|
3512
|
-
if (
|
|
3518
|
+
if (rs || !O && nn)
|
|
3513
3519
|
return /* @__PURE__ */ s("div", { className: "py-3 text-center text-[12px] text-slate-400", children: /* @__PURE__ */ s(vn, { className: "h-4 w-4 animate-spin inline" }) });
|
|
3514
|
-
const
|
|
3515
|
-
if (!
|
|
3516
|
-
const n =
|
|
3520
|
+
const Tr = (p == null ? void 0 : p.rowId) === "new", at = en && Le === "original" && !j, St = (at ? 1 : 0) + (te && (C || O || K) ? 1 : 0) + (A ? 1 : 0) + (O || K ? 1 : 0) + Re.length + 1, zn = at ? "select" : te && (C || K) ? "reorder" : A ? "num" : K ? "status" : "data", Qn = (e) => {
|
|
3521
|
+
if (!It) return null;
|
|
3522
|
+
const n = It.added.has(e) ? "bg-emerald-500" : It.changed.has(e) ? "bg-amber-500" : null;
|
|
3517
3523
|
return n ? /* @__PURE__ */ s(
|
|
3518
3524
|
"span",
|
|
3519
3525
|
{
|
|
@@ -3521,14 +3527,14 @@ function Pd({
|
|
|
3521
3527
|
className: ve("pointer-events-none absolute inset-y-0 left-0 w-0.5", n)
|
|
3522
3528
|
}
|
|
3523
3529
|
) : null;
|
|
3524
|
-
},
|
|
3530
|
+
}, Fn = () => {
|
|
3525
3531
|
const e = [];
|
|
3526
3532
|
return Le !== "original" || (O || $.slice(0, cn).forEach((n, t) => {
|
|
3527
3533
|
const r = String(n.id);
|
|
3528
3534
|
if (!Je.has(r)) {
|
|
3529
|
-
if (
|
|
3535
|
+
if (fs) {
|
|
3530
3536
|
const i = In(n);
|
|
3531
|
-
if (i !== null &&
|
|
3537
|
+
if (i !== null && ms.has(i)) return;
|
|
3532
3538
|
}
|
|
3533
3539
|
e.push({
|
|
3534
3540
|
key: r,
|
|
@@ -3540,50 +3546,50 @@ function Pd({
|
|
|
3540
3546
|
}), M.forEach((n, t) => {
|
|
3541
3547
|
e.push({ key: `pending:${t}`, kind: "pending", row: n, idx: t });
|
|
3542
3548
|
})), e;
|
|
3543
|
-
},
|
|
3549
|
+
}, Ni = at ? Fn().map((e) => e.key) : [], Qa = Ni.length > 0 && Ni.every((e) => Ut.has(e)), Fa = at ? Fn().filter((e) => Ut.has(e.key)) : [], Va = () => {
|
|
3544
3550
|
var t;
|
|
3545
3551
|
const e = Ge.current;
|
|
3546
3552
|
if (!e) return !1;
|
|
3547
3553
|
if (e.rowId === "new") return !0;
|
|
3548
|
-
const n = ((t =
|
|
3554
|
+
const n = ((t = Fn().find((r) => r.key === e.rowId)) == null ? void 0 : t.row) ?? {};
|
|
3549
3555
|
for (const [r, i] of Object.entries(e.draft)) {
|
|
3550
3556
|
if (r.startsWith("__")) {
|
|
3551
|
-
if ((Array.isArray(i) ? i.length > 0 : i != null && typeof i == "object") && JSON.stringify(i) !== JSON.stringify(
|
|
3557
|
+
if ((Array.isArray(i) ? i.length > 0 : i != null && typeof i == "object") && JSON.stringify(i) !== JSON.stringify(Pr))
|
|
3552
3558
|
return !0;
|
|
3553
3559
|
continue;
|
|
3554
3560
|
}
|
|
3555
|
-
if (!
|
|
3561
|
+
if (!Xr.has(r) && Ne.some((o) => o.field === r) && String(i ?? "") !== String(n[r] ?? ""))
|
|
3556
3562
|
return !0;
|
|
3557
3563
|
}
|
|
3558
3564
|
return !1;
|
|
3559
|
-
},
|
|
3565
|
+
}, Ba = async (e) => {
|
|
3560
3566
|
const n = Ge.current;
|
|
3561
3567
|
if (!n || n.rowId === "new") return;
|
|
3562
|
-
const t =
|
|
3568
|
+
const t = Fn(), r = t.findIndex((c) => c.key === n.rowId);
|
|
3563
3569
|
if (r < 0) return;
|
|
3564
3570
|
const i = r + e;
|
|
3565
3571
|
if (i < 0 || i >= t.length) return;
|
|
3566
|
-
if (
|
|
3567
|
-
if (!await
|
|
3572
|
+
if (Va()) {
|
|
3573
|
+
if (!await Tt()) return;
|
|
3568
3574
|
} else
|
|
3569
|
-
|
|
3575
|
+
Jn();
|
|
3570
3576
|
const o = t[i];
|
|
3571
|
-
o.kind === "pending" ?
|
|
3577
|
+
o.kind === "pending" ? Gs(o.row, o.idx) : Ir(o.row), window.setTimeout(() => {
|
|
3572
3578
|
const c = document.querySelector(
|
|
3573
3579
|
`[data-o2m-row="${a}:${o.key}"]`
|
|
3574
3580
|
);
|
|
3575
3581
|
c && (c.focus({ preventScroll: !0 }), c.scrollIntoView({ block: "nearest" }));
|
|
3576
3582
|
}, 0);
|
|
3577
3583
|
};
|
|
3578
|
-
|
|
3579
|
-
async function
|
|
3580
|
-
await
|
|
3584
|
+
Ji.current = Ba;
|
|
3585
|
+
async function Ha(e) {
|
|
3586
|
+
await ho(
|
|
3581
3587
|
e,
|
|
3582
|
-
|
|
3588
|
+
Fn().filter((n) => Ut.has(n.key)),
|
|
3583
3589
|
{ clearSelection: !0, noun: "row" }
|
|
3584
3590
|
);
|
|
3585
3591
|
}
|
|
3586
|
-
const
|
|
3592
|
+
const Ya = () => {
|
|
3587
3593
|
const e = [];
|
|
3588
3594
|
return Le !== "original" || (O || $.forEach((n, t) => {
|
|
3589
3595
|
const r = String(n.id);
|
|
@@ -3597,7 +3603,7 @@ function Pd({
|
|
|
3597
3603
|
e.push({ key: `pending:${t}`, kind: "pending", row: n, idx: t });
|
|
3598
3604
|
})), e;
|
|
3599
3605
|
};
|
|
3600
|
-
async function
|
|
3606
|
+
async function ho(e, n, t) {
|
|
3601
3607
|
const r = Object.keys(e);
|
|
3602
3608
|
if (r.length === 0 || n.length === 0) return;
|
|
3603
3609
|
const i = (L ?? []).filter((h) => h.target_type !== "lock").map((h) => h.target_field).filter((h) => typeof h == "string" && h.length > 0 && h !== "id"), o = /* @__PURE__ */ new Set([
|
|
@@ -3614,7 +3620,7 @@ function Pd({
|
|
|
3614
3620
|
data: h.row,
|
|
3615
3621
|
locks_only: !0,
|
|
3616
3622
|
probe: !0,
|
|
3617
|
-
parent_context:
|
|
3623
|
+
parent_context: jt(),
|
|
3618
3624
|
parent_collection: E,
|
|
3619
3625
|
row_rules: L
|
|
3620
3626
|
})
|
|
@@ -3624,7 +3630,7 @@ function Pd({
|
|
|
3624
3630
|
}
|
|
3625
3631
|
for (const x of r) {
|
|
3626
3632
|
if (g.includes(x)) continue;
|
|
3627
|
-
const R =
|
|
3633
|
+
const R = xi(x, { ...h.row }, w), I = { ...b };
|
|
3628
3634
|
for (const B of R) I[B] = null;
|
|
3629
3635
|
try {
|
|
3630
3636
|
const B = await S.request(
|
|
@@ -3633,7 +3639,7 @@ function Pd({
|
|
|
3633
3639
|
data: I,
|
|
3634
3640
|
changed_field: x,
|
|
3635
3641
|
probe: !0,
|
|
3636
|
-
parent_context:
|
|
3642
|
+
parent_context: jt(),
|
|
3637
3643
|
parent_collection: E,
|
|
3638
3644
|
row_rules: L
|
|
3639
3645
|
})
|
|
@@ -3649,11 +3655,11 @@ function Pd({
|
|
|
3649
3655
|
const y = {};
|
|
3650
3656
|
for (const x of r) g.includes(x) || (y[x] = e[x] ?? null);
|
|
3651
3657
|
for (const [x, R] of Object.entries(b))
|
|
3652
|
-
x in y || x === "id" || x === f ||
|
|
3658
|
+
x in y || x === "id" || x === f || Xr.has(x) || !o.has(x) || String(R ?? "") !== String(h.row[x] ?? "") && (y[x] = R);
|
|
3653
3659
|
c.push({ t: h, changes: y });
|
|
3654
3660
|
}
|
|
3655
3661
|
const u = (h, b) => {
|
|
3656
|
-
t.clearSelection &&
|
|
3662
|
+
t.clearSelection && sr(/* @__PURE__ */ new Set());
|
|
3657
3663
|
const g = h === 1 ? t.noun : `${t.noun}s`;
|
|
3658
3664
|
b.length ? Se.error(
|
|
3659
3665
|
`Applied to ${h} ${g} — ${b.length} failed: ${b.slice(0, 3).join("; ")}`
|
|
@@ -3689,12 +3695,12 @@ function Pd({
|
|
|
3689
3695
|
)
|
|
3690
3696
|
), ot(w.key), d++;
|
|
3691
3697
|
} catch (x) {
|
|
3692
|
-
const R = b ? null :
|
|
3698
|
+
const R = b ? null : Ei(x);
|
|
3693
3699
|
if (R) {
|
|
3694
3700
|
qn({ challenge: R, retry: (I) => m(g, I) }), V.invalidateQueries({ queryKey: ["o2m-rows", a, f, v] });
|
|
3695
3701
|
return;
|
|
3696
3702
|
}
|
|
3697
|
-
l.push(`#${w.key} ${
|
|
3703
|
+
l.push(`#${w.key} ${Xn(x, "failed")}`);
|
|
3698
3704
|
}
|
|
3699
3705
|
}
|
|
3700
3706
|
}
|
|
@@ -3702,17 +3708,17 @@ function Pd({
|
|
|
3702
3708
|
};
|
|
3703
3709
|
await m(0);
|
|
3704
3710
|
}
|
|
3705
|
-
if (
|
|
3711
|
+
if (zr.current = (e, n) => ho({ [e]: n }, Ya(), {
|
|
3706
3712
|
clearSelection: !1,
|
|
3707
3713
|
noun: "line"
|
|
3708
|
-
}),
|
|
3709
|
-
const e =
|
|
3710
|
-
|
|
3714
|
+
}), zi.current = !0, ir.current) {
|
|
3715
|
+
const e = ir.current;
|
|
3716
|
+
ir.current = null, window.setTimeout(() => void zr.current(e.target, e.value), 0);
|
|
3711
3717
|
}
|
|
3712
|
-
const lt = _e ? "split" : Re.filter((e) => !st(e)).length >= 6 ? "panel" : "inline",
|
|
3713
|
-
const n =
|
|
3718
|
+
const lt = _e ? "split" : Re.filter((e) => !st(e)).length >= 6 ? "panel" : "inline", Lr = (e) => {
|
|
3719
|
+
const n = di == null ? void 0 : di.display_template;
|
|
3714
3720
|
if (n) {
|
|
3715
|
-
const t =
|
|
3721
|
+
const t = Hn(n, e).trim();
|
|
3716
3722
|
if (t && t !== "-" && t !== String(e.id ?? ""))
|
|
3717
3723
|
return t.length > 60 ? `${t.slice(0, 60)}…` : t;
|
|
3718
3724
|
}
|
|
@@ -3723,7 +3729,7 @@ function Pd({
|
|
|
3723
3729
|
return r.length > 60 ? `${r.slice(0, 60)}…` : r;
|
|
3724
3730
|
}
|
|
3725
3731
|
return e.id != null ? `#${e.id}` : "New line";
|
|
3726
|
-
},
|
|
3732
|
+
}, Vn = (e, n) => {
|
|
3727
3733
|
const t = (n == null ? void 0 : n.rowKey) ?? "__new__", r = { ...e };
|
|
3728
3734
|
for (const i of Re) {
|
|
3729
3735
|
if (i.computed_type !== "rollup" || !i.computed_formula) continue;
|
|
@@ -3736,7 +3742,7 @@ function Pd({
|
|
|
3736
3742
|
}
|
|
3737
3743
|
let c = null;
|
|
3738
3744
|
for (const u of (o == null ? void 0 : o.sources) ?? []) {
|
|
3739
|
-
const d = (G ?? []).map((g) => typeof g == "string" ? g : g.field), l = d.find((g) => g === u.related_collection) ?? (d.length === 1 ? d[0] : void 0), m = l ? e[`__o2m_${l}`] : void 0, h = (l ?
|
|
3745
|
+
const d = (G ?? []).map((g) => typeof g == "string" ? g : g.field), l = d.find((g) => g === u.related_collection) ?? (d.length === 1 ? d[0] : void 0), m = l ? e[`__o2m_${l}`] : void 0, h = (l ? hr[`${t}|${l}`] : void 0) ?? m;
|
|
3740
3746
|
if (!h) continue;
|
|
3741
3747
|
const b = u.aggregate ?? "sum";
|
|
3742
3748
|
if (b === "count") c = (c ?? 0) + h.length;
|
|
@@ -3753,17 +3759,17 @@ function Pd({
|
|
|
3753
3759
|
o != null && (r[i.field] = o);
|
|
3754
3760
|
}
|
|
3755
3761
|
return r;
|
|
3756
|
-
},
|
|
3757
|
-
const r = typeof t == "string" ? t : t.field, i = typeof t == "string" ? void 0 : t.hint, o = typeof t == "string" ? void 0 : t.match, c = o ?
|
|
3762
|
+
}, Mr = (e, n) => !G || G.length === 0 ? null : /* @__PURE__ */ s("div", { className: "mt-3 space-y-2 border-t border-slate-100 pt-3 dark:border-border", children: G.map((t) => {
|
|
3763
|
+
const r = typeof t == "string" ? t : t.field, i = typeof t == "string" ? void 0 : t.hint, o = typeof t == "string" ? void 0 : t.match, c = o ? Wr(o, n, v, N == null ? void 0 : N.draft) : null;
|
|
3758
3764
|
return /* @__PURE__ */ s(
|
|
3759
|
-
|
|
3765
|
+
Ti,
|
|
3760
3766
|
{
|
|
3761
3767
|
parentCollection: a,
|
|
3762
3768
|
relationField: r,
|
|
3763
3769
|
parentRowId: e ?? null,
|
|
3764
3770
|
parentDraft: n,
|
|
3765
3771
|
hint: i,
|
|
3766
|
-
onRowsChange: (u) =>
|
|
3772
|
+
onRowsChange: (u) => gr((d) => ({
|
|
3767
3773
|
...d,
|
|
3768
3774
|
[`${e ?? "__new__"}|${r}`]: u
|
|
3769
3775
|
})),
|
|
@@ -3776,12 +3782,12 @@ function Pd({
|
|
|
3776
3782
|
// rows with the line's queued edit, like the FK mode.
|
|
3777
3783
|
...e && K ? {
|
|
3778
3784
|
deferred: !0,
|
|
3779
|
-
stagedOps: n[`__nested_ops_${r}`] ??
|
|
3785
|
+
stagedOps: n[`__nested_ops_${r}`] ?? Pr,
|
|
3780
3786
|
onStagedOpsChange: (u) => mt(`__nested_ops_${r}`, u)
|
|
3781
3787
|
} : {}
|
|
3782
3788
|
} : e ? K ? {
|
|
3783
3789
|
deferred: !0,
|
|
3784
|
-
stagedOps: n[`__nested_ops_${r}`] ??
|
|
3790
|
+
stagedOps: n[`__nested_ops_${r}`] ?? Pr,
|
|
3785
3791
|
onStagedOpsChange: (u) => mt(`__nested_ops_${r}`, u)
|
|
3786
3792
|
} : {} : {
|
|
3787
3793
|
// UNSAVED row: members stage under __o2m_<field> in the
|
|
@@ -3796,7 +3802,7 @@ function Pd({
|
|
|
3796
3802
|
},
|
|
3797
3803
|
r
|
|
3798
3804
|
);
|
|
3799
|
-
}) }),
|
|
3805
|
+
}) }), Bn = (e) => e.computed_type === "write" && !!e.computed_formula || e.interface === "formula-column" || e.interface === "match-agg-column" || e.interface === "relation-path" || !!e.readonly || vr(e) || st(e), go = (e) => {
|
|
3800
3806
|
var n;
|
|
3801
3807
|
return /* @__PURE__ */ _(
|
|
3802
3808
|
"div",
|
|
@@ -3820,7 +3826,7 @@ function Pd({
|
|
|
3820
3826
|
"button",
|
|
3821
3827
|
{
|
|
3822
3828
|
type: "button",
|
|
3823
|
-
onClick:
|
|
3829
|
+
onClick: Jn,
|
|
3824
3830
|
className: "rounded px-2 py-1 text-[11px] text-slate-500 transition-colors hover:bg-slate-100 dark:hover:bg-muted",
|
|
3825
3831
|
children: "Cancel"
|
|
3826
3832
|
}
|
|
@@ -3830,7 +3836,7 @@ function Pd({
|
|
|
3830
3836
|
{
|
|
3831
3837
|
type: "button",
|
|
3832
3838
|
disabled: ht,
|
|
3833
|
-
onClick:
|
|
3839
|
+
onClick: Tt,
|
|
3834
3840
|
className: "rounded bg-nvr-cyan px-3 py-1 text-[11px] font-medium text-white transition-[filter] hover:brightness-110 disabled:opacity-50",
|
|
3835
3841
|
children: ht ? "Saving…" : e.saveLabel
|
|
3836
3842
|
}
|
|
@@ -3839,11 +3845,11 @@ function Pd({
|
|
|
3839
3845
|
] }),
|
|
3840
3846
|
(() => {
|
|
3841
3847
|
const t = [
|
|
3842
|
-
...Ne.filter(
|
|
3848
|
+
...Ne.filter(Bn),
|
|
3843
3849
|
...Re.filter((r) => st(r))
|
|
3844
3850
|
];
|
|
3845
3851
|
return t.length > 0 && (() => {
|
|
3846
|
-
const r =
|
|
3852
|
+
const r = Vn(e.draft, { rowKey: e.rowId ?? "__new__" });
|
|
3847
3853
|
return /* @__PURE__ */ s("div", { className: "mb-3 flex flex-wrap items-stretch gap-x-6 gap-y-2 rounded-md bg-slate-50/80 px-3 py-2 dark:bg-muted/40", children: t.map((i) => {
|
|
3848
3854
|
const o = i.label || qe(i.field), c = i.computed_type === "write" && !!i.computed_formula, u = i.options ? typeof i.options == "string" ? (() => {
|
|
3849
3855
|
try {
|
|
@@ -3863,30 +3869,30 @@ function Pd({
|
|
|
3863
3869
|
/* @__PURE__ */ s("span", { className: "mt-0.5 truncate text-[12px] font-medium text-slate-700 dark:text-slate-200", children: c ? Ue(i, r[i.field] ?? e.draft[i.field]) : l != null ? /* @__PURE__ */ s("span", { className: "tabular-nums", children: l.toLocaleString(
|
|
3864
3870
|
"en-US",
|
|
3865
3871
|
bt(u, u.format)
|
|
3866
|
-
) }) : i.computed_type === "rollup" ? Ue(i, r[i.field] ?? e.draft[i.field], e.rowId) : st(i) ?
|
|
3872
|
+
) }) : i.computed_type === "rollup" ? Ue(i, r[i.field] ?? e.draft[i.field], e.rowId) : st(i) ? Pn(i, e.draft, !0) : Ue(i, e.draft[i.field], e.rowId) })
|
|
3867
3873
|
] }, i.field);
|
|
3868
3874
|
}) });
|
|
3869
3875
|
})();
|
|
3870
3876
|
})(),
|
|
3871
|
-
|
|
3877
|
+
Us(e.rowId),
|
|
3872
3878
|
/* @__PURE__ */ s(
|
|
3873
3879
|
"div",
|
|
3874
3880
|
{
|
|
3875
3881
|
className: "grid items-start gap-x-4 gap-y-3",
|
|
3876
3882
|
style: { gridTemplateColumns: "repeat(auto-fit, minmax(240px, 1fr))" },
|
|
3877
|
-
children: Re.filter((t) => !
|
|
3883
|
+
children: Re.filter((t) => !Bn(t)).map((t) => {
|
|
3878
3884
|
var u, d, l;
|
|
3879
3885
|
const r = t.computed_type === "write" && !!t.computed_formula, i = t.label || qe(t.field), o = t.interface === "formula-column" || t.interface === "match-agg-column" || t.interface === "relation-path";
|
|
3880
3886
|
if (st(t))
|
|
3881
3887
|
return /* @__PURE__ */ _("div", { className: "flex min-w-0 flex-col gap-1", children: [
|
|
3882
3888
|
/* @__PURE__ */ s("span", { className: "text-[10px] font-medium uppercase tracking-wide text-slate-400", children: i }),
|
|
3883
|
-
/* @__PURE__ */ s("div", { className: "text-[12px] text-slate-500", children:
|
|
3889
|
+
/* @__PURE__ */ s("div", { className: "text-[12px] text-slate-500", children: Pn(t, e.draft, !0) })
|
|
3884
3890
|
] }, t.field);
|
|
3885
3891
|
const c = !!((u = p == null ? void 0 : p.missing) != null && u.includes(t.field));
|
|
3886
3892
|
return /* @__PURE__ */ _(
|
|
3887
3893
|
"div",
|
|
3888
3894
|
{
|
|
3889
|
-
"data-grid-cell":
|
|
3895
|
+
"data-grid-cell": Ci(e.rowId, t.field),
|
|
3890
3896
|
className: ve(
|
|
3891
3897
|
"flex min-w-0 flex-col gap-1",
|
|
3892
3898
|
c && "rounded-md [&_input]:border-red-400 [&_input]:ring-1 [&_input]:ring-red-300 [&_button]:border-red-400 [&_button]:ring-1 [&_button]:ring-red-300 dark:[&_input]:border-red-600 dark:[&_input]:ring-red-800 dark:[&_button]:border-red-600 dark:[&_button]:ring-red-800"
|
|
@@ -3904,7 +3910,7 @@ function Pd({
|
|
|
3904
3910
|
c && /* @__PURE__ */ s("span", { className: "ml-1 normal-case tracking-normal", children: "· required" }),
|
|
3905
3911
|
(() => {
|
|
3906
3912
|
var w, y;
|
|
3907
|
-
const m =
|
|
3913
|
+
const m = Oa(t.field);
|
|
3908
3914
|
if (!m) return null;
|
|
3909
3915
|
const h = Ve.get(t.field), b = (x) => {
|
|
3910
3916
|
var R;
|
|
@@ -3914,13 +3920,13 @@ function Pd({
|
|
|
3914
3920
|
return ((R = Ne.find((I) => I.field === x)) == null ? void 0 : R.label) ?? x.replace(/_/g, " ");
|
|
3915
3921
|
};
|
|
3916
3922
|
return /* @__PURE__ */ s(
|
|
3917
|
-
|
|
3923
|
+
Fl,
|
|
3918
3924
|
{
|
|
3919
3925
|
kind: m,
|
|
3920
3926
|
provenance: (w = p == null ? void 0 : p.provenance) == null ? void 0 : w[t.field],
|
|
3921
3927
|
labelOf: b,
|
|
3922
3928
|
fieldLabel: g,
|
|
3923
|
-
onReset: m === "overridden" && !j && !((y = p == null ? void 0 : p.locks) != null && y.includes(t.field)) ? () =>
|
|
3929
|
+
onReset: m === "overridden" && !j && !((y = p == null ? void 0 : p.locks) != null && y.includes(t.field)) ? () => Ia(t.field) : void 0
|
|
3924
3930
|
}
|
|
3925
3931
|
);
|
|
3926
3932
|
})()
|
|
@@ -3930,12 +3936,12 @@ function Pd({
|
|
|
3930
3936
|
r ? /* @__PURE__ */ s("div", { className: "text-[12px] italic text-slate-500", children: Ue(
|
|
3931
3937
|
t,
|
|
3932
3938
|
Rt(t.computed_formula, e.draft) ?? e.draft[t.field]
|
|
3933
|
-
) }) : o || t.readonly || (d = p == null ? void 0 : p.locks) != null && d.includes(t.field) ||
|
|
3939
|
+
) }) : o || t.readonly || vr(t) || (d = p == null ? void 0 : p.locks) != null && d.includes(t.field) || oi(t.field, e.draft) ? /* @__PURE__ */ s(
|
|
3934
3940
|
"div",
|
|
3935
3941
|
{
|
|
3936
3942
|
className: "text-[12px] text-slate-500",
|
|
3937
|
-
"data-compare-locked":
|
|
3938
|
-
"data-tip": (l = p == null ? void 0 : p.locks) != null && l.includes(t.field) ?
|
|
3943
|
+
"data-compare-locked": oi(t.field, e.draft) ? t.field : void 0,
|
|
3944
|
+
"data-tip": (l = p == null ? void 0 : p.locks) != null && l.includes(t.field) ? Xs(t.field) : oi(t.field, e.draft) ? (q == null ? void 0 : q.closed_locked_message) || "This month is closed — only reconciling it to the actual is allowed" : void 0,
|
|
3939
3945
|
children: Ue(t, e.draft[t.field], e.rowId)
|
|
3940
3946
|
}
|
|
3941
3947
|
) : p != null && p.locksPending && Nn.has(t.field) ? (
|
|
@@ -3960,11 +3966,11 @@ function Pd({
|
|
|
3960
3966
|
collection: a,
|
|
3961
3967
|
itemId: e.rowId ?? "new",
|
|
3962
3968
|
cascadeFilter: it[t.field],
|
|
3963
|
-
pinnedOption:
|
|
3969
|
+
pinnedOption: Kn(t.field, e.draft)
|
|
3964
3970
|
}
|
|
3965
3971
|
),
|
|
3966
3972
|
q && q.columns.includes(t.field) && (() => {
|
|
3967
|
-
const m =
|
|
3973
|
+
const m = Ai(q, e.draft), h = m == null ? void 0 : m.values[t.field], b = Kt(
|
|
3968
3974
|
q,
|
|
3969
3975
|
e.draft[q.key_field],
|
|
3970
3976
|
t.field
|
|
@@ -3976,29 +3982,29 @@ function Pd({
|
|
|
3976
3982
|
className: "mt-1 flex items-center gap-1 text-[11px] text-slate-500 dark:text-muted-foreground",
|
|
3977
3983
|
children: [
|
|
3978
3984
|
/* @__PURE__ */ s("span", { className: "font-mono text-[9px] uppercase tracking-wide text-slate-400", children: q.label }),
|
|
3979
|
-
/* @__PURE__ */ s("span", { className: "tabular-nums font-medium text-slate-700 dark:text-slate-200", children: h == null ? "—" :
|
|
3985
|
+
/* @__PURE__ */ s("span", { className: "tabular-nums font-medium text-slate-700 dark:text-slate-200", children: h == null ? "—" : Oi(h) }),
|
|
3980
3986
|
b && /* @__PURE__ */ _(
|
|
3981
3987
|
"span",
|
|
3982
3988
|
{
|
|
3983
3989
|
className: "inline-flex items-center gap-0.5 text-[10px] uppercase tracking-wide text-slate-400",
|
|
3984
|
-
"data-tip": q.closed_locked &&
|
|
3990
|
+
"data-tip": q.closed_locked && Tn ? `${q.closed_rule ?? ""} A change here needs a reason.`.trim() : q.closed_rule,
|
|
3985
3991
|
children: [
|
|
3986
|
-
/* @__PURE__ */ s(
|
|
3992
|
+
/* @__PURE__ */ s(rl, { className: "h-2.5 w-2.5", "aria-hidden": "true" }),
|
|
3987
3993
|
" closed"
|
|
3988
3994
|
]
|
|
3989
3995
|
}
|
|
3990
3996
|
),
|
|
3991
3997
|
b && !j && /* @__PURE__ */ s(
|
|
3992
|
-
|
|
3998
|
+
Il,
|
|
3993
3999
|
{
|
|
3994
4000
|
data: q,
|
|
3995
4001
|
rowKey: e.draft[q.key_field],
|
|
3996
4002
|
column: t.field,
|
|
3997
|
-
columnLabel:
|
|
4003
|
+
columnLabel: xr(t),
|
|
3998
4004
|
plannedRow: e.draft,
|
|
3999
4005
|
actual: h ?? 0,
|
|
4000
4006
|
variant: "button",
|
|
4001
|
-
onApply: (g, w) =>
|
|
4007
|
+
onApply: (g, w) => vi({ ...g, _change_reason: w })
|
|
4002
4008
|
}
|
|
4003
4009
|
)
|
|
4004
4010
|
]
|
|
@@ -4013,12 +4019,12 @@ function Pd({
|
|
|
4013
4019
|
}
|
|
4014
4020
|
),
|
|
4015
4021
|
be && ((n = be.fields) == null ? void 0 : n.length) > 0 && !j && /* @__PURE__ */ s(
|
|
4016
|
-
|
|
4022
|
+
nd,
|
|
4017
4023
|
{
|
|
4018
4024
|
config: be,
|
|
4019
4025
|
draft: e.draft,
|
|
4020
4026
|
remaining: pt(be.remaining, Vt),
|
|
4021
|
-
onApply:
|
|
4027
|
+
onApply: vi,
|
|
4022
4028
|
closedFields: q ? new Set(
|
|
4023
4029
|
be.fields.filter(
|
|
4024
4030
|
(t) => Kt(q, e.draft[q.key_field], t)
|
|
@@ -4040,16 +4046,16 @@ function Pd({
|
|
|
4040
4046
|
})()
|
|
4041
4047
|
}
|
|
4042
4048
|
),
|
|
4043
|
-
ae && e.rowId && !e.rowId.startsWith("pending:") && e.rowId !== "new" && /* @__PURE__ */ s(
|
|
4049
|
+
ae && e.rowId && !e.rowId.startsWith("pending:") && e.rowId !== "new" && /* @__PURE__ */ s(zl, { config: ae, result: At.byRow.get(e.rowId) }),
|
|
4044
4050
|
e.drawer
|
|
4045
4051
|
]
|
|
4046
4052
|
}
|
|
4047
4053
|
);
|
|
4048
|
-
},
|
|
4054
|
+
}, Si = (e) => /* @__PURE__ */ s("td", { colSpan: St, className: "p-0", children: go(e) }), bo = (e, n) => {
|
|
4049
4055
|
const t = e.editor.split(/\s+/).map((i) => i[0]).filter(Boolean).slice(0, 2).join("").toUpperCase(), r = () => {
|
|
4050
|
-
|
|
4056
|
+
ui.current.add(zs(e.rowKey, e.editor)), Yt(null);
|
|
4051
4057
|
const i = $.find((o) => String(o.id) === e.rowKey);
|
|
4052
|
-
i &&
|
|
4058
|
+
i && Ir(H.has(e.rowKey) ? { ...i, ...H.get(e.rowKey) } : i);
|
|
4053
4059
|
};
|
|
4054
4060
|
return /* @__PURE__ */ _(
|
|
4055
4061
|
"div",
|
|
@@ -4087,15 +4093,15 @@ function Pd({
|
|
|
4087
4093
|
]
|
|
4088
4094
|
}
|
|
4089
4095
|
);
|
|
4090
|
-
},
|
|
4096
|
+
}, yo = Br === Yn, Ga = yo ? null : (_t == null ? void 0 : _t.name) ?? ((vo = Z == null ? void 0 : Z[0]) == null ? void 0 : vo.name), xo = Z && Z.length >= 2 && /* @__PURE__ */ _("div", { className: "flex items-center gap-1 text-[11px]", children: [
|
|
4091
4097
|
/* @__PURE__ */ s(
|
|
4092
4098
|
"button",
|
|
4093
4099
|
{
|
|
4094
4100
|
type: "button",
|
|
4095
|
-
onClick: () =>
|
|
4101
|
+
onClick: () => ns(Yn),
|
|
4096
4102
|
className: ve(
|
|
4097
4103
|
"h-6 px-2.5 rounded border transition-colors",
|
|
4098
|
-
|
|
4104
|
+
yo ? "border-nvr-cyan bg-nvr-cyan/10 text-nvr-cyan" : "border-slate-200 text-slate-600 hover:border-slate-400 hover:text-slate-800"
|
|
4099
4105
|
),
|
|
4100
4106
|
children: "All"
|
|
4101
4107
|
}
|
|
@@ -4104,10 +4110,10 @@ function Pd({
|
|
|
4104
4110
|
"button",
|
|
4105
4111
|
{
|
|
4106
4112
|
type: "button",
|
|
4107
|
-
onClick: () =>
|
|
4113
|
+
onClick: () => ns(e.name),
|
|
4108
4114
|
className: ve(
|
|
4109
4115
|
"h-6 px-2.5 rounded border transition-colors",
|
|
4110
|
-
|
|
4116
|
+
Ga === e.name ? "border-nvr-cyan bg-nvr-cyan/10 text-nvr-cyan" : "border-slate-200 text-slate-600 hover:border-slate-400 hover:text-slate-800"
|
|
4111
4117
|
),
|
|
4112
4118
|
children: e.name
|
|
4113
4119
|
},
|
|
@@ -4123,16 +4129,16 @@ function Pd({
|
|
|
4123
4129
|
{
|
|
4124
4130
|
className: "space-y-1.5",
|
|
4125
4131
|
"data-o2m-collection": a,
|
|
4126
|
-
onFocusCapture:
|
|
4127
|
-
onBlurCapture:
|
|
4132
|
+
onFocusCapture: Zo,
|
|
4133
|
+
onBlurCapture: ea,
|
|
4128
4134
|
children: [
|
|
4129
4135
|
/* @__PURE__ */ s(
|
|
4130
|
-
|
|
4136
|
+
sl,
|
|
4131
4137
|
{
|
|
4132
|
-
challenge: (
|
|
4138
|
+
challenge: (cr == null ? void 0 : cr.challenge) ?? null,
|
|
4133
4139
|
onCancel: () => qn(null),
|
|
4134
4140
|
onSubmit: (e) => {
|
|
4135
|
-
const n =
|
|
4141
|
+
const n = cr;
|
|
4136
4142
|
qn(null), n == null || n.retry(e);
|
|
4137
4143
|
}
|
|
4138
4144
|
}
|
|
@@ -4146,7 +4152,7 @@ function Pd({
|
|
|
4146
4152
|
min: 1,
|
|
4147
4153
|
max: 100,
|
|
4148
4154
|
value: Gt,
|
|
4149
|
-
onChange: (e) =>
|
|
4155
|
+
onChange: (e) => Ma(Math.max(1, Math.min(100, parseInt(e.target.value, 10) || 1))),
|
|
4150
4156
|
className: "w-14 h-6 rounded border border-slate-200 px-2 text-[11px] text-slate-700 text-center focus:outline-none focus:ring-1 focus:ring-nvr-cyan"
|
|
4151
4157
|
}
|
|
4152
4158
|
),
|
|
@@ -4155,7 +4161,7 @@ function Pd({
|
|
|
4155
4161
|
{
|
|
4156
4162
|
type: "button",
|
|
4157
4163
|
disabled: Xt,
|
|
4158
|
-
onClick: () =>
|
|
4164
|
+
onClick: () => fo(!1),
|
|
4159
4165
|
className: "h-6 px-2.5 rounded border border-slate-200 text-slate-600 hover:border-slate-400 hover:text-slate-800 disabled:opacity-40 transition-colors",
|
|
4160
4166
|
children: [
|
|
4161
4167
|
"blank ",
|
|
@@ -4172,7 +4178,7 @@ function Pd({
|
|
|
4172
4178
|
{
|
|
4173
4179
|
type: "button",
|
|
4174
4180
|
disabled: Xt,
|
|
4175
|
-
onClick: () =>
|
|
4181
|
+
onClick: () => Ua(e[0].field),
|
|
4176
4182
|
"data-tip": `Generate ${Gt} rows with ${e[0].field} advancing one month per row (starting next month)`,
|
|
4177
4183
|
className: "h-6 px-2.5 rounded border border-dashed border-slate-300 text-slate-500 hover:border-nvr-cyan/60 hover:text-slate-700 disabled:opacity-40 transition-colors",
|
|
4178
4184
|
children: [
|
|
@@ -4183,7 +4189,7 @@ function Pd({
|
|
|
4183
4189
|
);
|
|
4184
4190
|
})(),
|
|
4185
4191
|
He && (!O || k) && /* @__PURE__ */ s(
|
|
4186
|
-
|
|
4192
|
+
Cl,
|
|
4187
4193
|
{
|
|
4188
4194
|
config: He,
|
|
4189
4195
|
relatedCollection: a,
|
|
@@ -4196,7 +4202,7 @@ function Pd({
|
|
|
4196
4202
|
queryKey: ["o2m-rows", a, f, v]
|
|
4197
4203
|
}),
|
|
4198
4204
|
onLocalWrite: (e) => {
|
|
4199
|
-
e ? ot(e) :
|
|
4205
|
+
e ? ot(e) : Ot.current = Date.now();
|
|
4200
4206
|
},
|
|
4201
4207
|
staging: k,
|
|
4202
4208
|
stagingActive: (O || K) && !!k,
|
|
@@ -4210,7 +4216,7 @@ function Pd({
|
|
|
4210
4216
|
(n) => typeof n == "object" && n.field === nt.relation && !!n.match
|
|
4211
4217
|
);
|
|
4212
4218
|
return e != null && e.match ? /* @__PURE__ */ s(
|
|
4213
|
-
|
|
4219
|
+
ed,
|
|
4214
4220
|
{
|
|
4215
4221
|
config: nt,
|
|
4216
4222
|
matchCfg: e.match,
|
|
@@ -4223,12 +4229,12 @@ function Pd({
|
|
|
4223
4229
|
) : null;
|
|
4224
4230
|
})(),
|
|
4225
4231
|
(Qe ?? []).map((e) => /* @__PURE__ */ s(
|
|
4226
|
-
|
|
4232
|
+
Zl,
|
|
4227
4233
|
{
|
|
4228
4234
|
config: e,
|
|
4229
4235
|
rows: [...$, ...M.map((n, t) => ({ ...n, __pendingIndex: t }))],
|
|
4230
4236
|
relatedCollection: a,
|
|
4231
|
-
computedWriteFields:
|
|
4237
|
+
computedWriteFields: Xr,
|
|
4232
4238
|
applyRow: async (n, t) => {
|
|
4233
4239
|
const r = n.__pendingIndex;
|
|
4234
4240
|
if (typeof r == "number" && k) {
|
|
@@ -4248,7 +4254,7 @@ function Pd({
|
|
|
4248
4254
|
e.label
|
|
4249
4255
|
)),
|
|
4250
4256
|
Pt && !O && !j && Wt && E && /* @__PURE__ */ s(
|
|
4251
|
-
|
|
4257
|
+
bl,
|
|
4252
4258
|
{
|
|
4253
4259
|
collection: E,
|
|
4254
4260
|
templateFilter: (e) => {
|
|
@@ -4268,55 +4274,55 @@ function Pd({
|
|
|
4268
4274
|
"button",
|
|
4269
4275
|
{
|
|
4270
4276
|
type: "button",
|
|
4271
|
-
onClick: () =>
|
|
4277
|
+
onClick: () => Yi((e) => !e),
|
|
4272
4278
|
title: "Copy this table’s lines from another record",
|
|
4273
4279
|
className: "h-6 rounded border border-slate-200 px-2.5 text-slate-600 transition-colors hover:border-slate-400 hover:text-slate-800 dark:border-border dark:text-slate-300",
|
|
4274
4280
|
children: "Copy from…"
|
|
4275
4281
|
}
|
|
4276
4282
|
),
|
|
4277
|
-
|
|
4278
|
-
|
|
4283
|
+
zo && /* @__PURE__ */ s("span", { className: "absolute left-0 top-full z-[70] mt-1 w-[300px] rounded-lg border border-slate-200 bg-white p-2 shadow-xl dark:border-border dark:bg-card", children: /* @__PURE__ */ s(
|
|
4284
|
+
Li,
|
|
4279
4285
|
{
|
|
4280
4286
|
collection: E,
|
|
4281
4287
|
value: null,
|
|
4282
4288
|
onChange: (e) => {
|
|
4283
|
-
e != null &&
|
|
4289
|
+
e != null && Fo(String(e));
|
|
4284
4290
|
},
|
|
4285
4291
|
placeholder: "Pick the record to copy from…"
|
|
4286
4292
|
}
|
|
4287
4293
|
) })
|
|
4288
4294
|
] }),
|
|
4289
|
-
|
|
4295
|
+
Bs.length > 0 && /* @__PURE__ */ s(
|
|
4290
4296
|
"button",
|
|
4291
4297
|
{
|
|
4292
4298
|
type: "button",
|
|
4293
|
-
onClick: () =>
|
|
4299
|
+
onClick: () => Ka((e) => !e),
|
|
4294
4300
|
className: ve(
|
|
4295
4301
|
"h-6 px-2.5 rounded border transition-colors",
|
|
4296
|
-
|
|
4302
|
+
ro ? "border-nvr-cyan bg-nvr-cyan/10 text-nvr-cyan" : "border-slate-200 text-slate-600 hover:border-slate-400 hover:text-slate-800"
|
|
4297
4303
|
),
|
|
4298
4304
|
children: "with defaults…"
|
|
4299
4305
|
}
|
|
4300
4306
|
),
|
|
4301
|
-
|
|
4307
|
+
pi.length > 0 && /* @__PURE__ */ s(
|
|
4302
4308
|
"button",
|
|
4303
4309
|
{
|
|
4304
4310
|
type: "button",
|
|
4305
|
-
onClick: () =>
|
|
4311
|
+
onClick: () => so((e) => !e),
|
|
4306
4312
|
className: ve(
|
|
4307
4313
|
"h-6 px-2.5 rounded border transition-colors",
|
|
4308
|
-
|
|
4314
|
+
io ? "border-amber-400 bg-amber-50 text-amber-700 dark:border-amber-600 dark:bg-amber-950/30 dark:text-amber-300" : "border-slate-200 text-slate-600 hover:border-slate-400 hover:text-slate-800"
|
|
4309
4315
|
),
|
|
4310
4316
|
children: "apply values…"
|
|
4311
4317
|
}
|
|
4312
4318
|
),
|
|
4313
|
-
be && ((
|
|
4314
|
-
|
|
4319
|
+
be && ((wo = be.fields) == null ? void 0 : wo.length) > 0 && be.across_rows !== !1 && $.length + M.length > 1 && /* @__PURE__ */ s(
|
|
4320
|
+
rd,
|
|
4315
4321
|
{
|
|
4316
4322
|
config: be,
|
|
4317
4323
|
remaining: pt(be.remaining, Vt),
|
|
4318
4324
|
rowNoun: q ? qe(q.key_field).toLowerCase() : "row",
|
|
4319
|
-
onApply:
|
|
4325
|
+
onApply: pa
|
|
4320
4326
|
}
|
|
4321
4327
|
),
|
|
4322
4328
|
!!(L != null && L.length) && $.length + M.length > 0 && /* @__PURE__ */ s(
|
|
@@ -4324,11 +4330,11 @@ function Pd({
|
|
|
4324
4330
|
{
|
|
4325
4331
|
type: "button",
|
|
4326
4332
|
onClick: () => {
|
|
4327
|
-
|
|
4333
|
+
Ar((e) => !e), gn(null);
|
|
4328
4334
|
},
|
|
4329
4335
|
className: ve(
|
|
4330
4336
|
"h-6 px-2.5 rounded border transition-colors",
|
|
4331
|
-
|
|
4337
|
+
oo ? "border-nvr-cyan bg-nvr-cyan/10 text-nvr-cyan" : "border-slate-200 text-slate-600 hover:border-slate-400 hover:text-slate-800"
|
|
4332
4338
|
),
|
|
4333
4339
|
"data-tip": "Re-run this grid's auto-fill rules over every line, saved or not yet saved",
|
|
4334
4340
|
children: "re-run rules…"
|
|
@@ -4342,14 +4348,14 @@ function Pd({
|
|
|
4342
4348
|
"aria-pressed": en,
|
|
4343
4349
|
"data-tip": en ? "Hide the selection checkboxes" : "Tick rows to edit several lines at once",
|
|
4344
4350
|
onClick: () => {
|
|
4345
|
-
|
|
4351
|
+
Wo((e) => !e), sr(/* @__PURE__ */ new Set());
|
|
4346
4352
|
},
|
|
4347
4353
|
className: ve(
|
|
4348
4354
|
"inline-flex h-6 items-center gap-1 rounded border px-2 transition-colors",
|
|
4349
4355
|
en ? "border-nvr-cyan bg-nvr-cyan/10 text-nvr-cyan" : "border-slate-200 text-slate-600 hover:border-slate-400 hover:text-slate-800 dark:border-border dark:text-slate-300"
|
|
4350
4356
|
),
|
|
4351
4357
|
children: [
|
|
4352
|
-
/* @__PURE__ */ s(
|
|
4358
|
+
/* @__PURE__ */ s(Xa, { className: "h-3 w-3", "aria-hidden": "true" }),
|
|
4353
4359
|
en ? "Selecting" : "Select rows"
|
|
4354
4360
|
]
|
|
4355
4361
|
}
|
|
@@ -4358,11 +4364,11 @@ function Pd({
|
|
|
4358
4364
|
"button",
|
|
4359
4365
|
{
|
|
4360
4366
|
type: "button",
|
|
4361
|
-
onClick: () =>
|
|
4367
|
+
onClick: () => Qi(!0),
|
|
4362
4368
|
"data-tip": "Set the same values on every selected line",
|
|
4363
4369
|
className: "inline-flex h-6 items-center gap-1 rounded border border-amber-400 bg-amber-50 px-2 font-medium text-amber-700 transition-colors hover:border-amber-500 dark:border-amber-600 dark:bg-amber-950/30 dark:text-amber-300",
|
|
4364
4370
|
children: [
|
|
4365
|
-
/* @__PURE__ */ s(
|
|
4371
|
+
/* @__PURE__ */ s(Ca, { className: "h-3 w-3", "aria-hidden": "true" }),
|
|
4366
4372
|
"Edit ",
|
|
4367
4373
|
Ut.size,
|
|
4368
4374
|
" selected…"
|
|
@@ -4381,7 +4387,7 @@ function Pd({
|
|
|
4381
4387
|
"inline-flex h-6 w-6 items-center justify-center rounded border transition-colors",
|
|
4382
4388
|
_e ? "border-nvr-cyan bg-nvr-cyan/10 text-nvr-cyan" : "border-slate-200 text-slate-500 hover:border-slate-400 hover:text-slate-800 dark:border-border dark:text-slate-300"
|
|
4383
4389
|
),
|
|
4384
|
-
children: _e ? /* @__PURE__ */ s(
|
|
4390
|
+
children: _e ? /* @__PURE__ */ s(Za, { className: "h-3 w-3", "aria-hidden": "true" }) : /* @__PURE__ */ s(el, { className: "h-3 w-3", "aria-hidden": "true" })
|
|
4385
4391
|
}
|
|
4386
4392
|
),
|
|
4387
4393
|
Xt && /* @__PURE__ */ s(vn, { className: "h-3 w-3 animate-spin text-slate-400" }),
|
|
@@ -4394,7 +4400,7 @@ function Pd({
|
|
|
4394
4400
|
"data-grid-save-mode": "live",
|
|
4395
4401
|
"data-tip": "Every change to a line here is saved the moment you make it — no Save needed",
|
|
4396
4402
|
children: [
|
|
4397
|
-
/* @__PURE__ */ s(
|
|
4403
|
+
/* @__PURE__ */ s(tl, { className: "h-3 w-3", "aria-hidden": "true" }),
|
|
4398
4404
|
"Saves as you go"
|
|
4399
4405
|
]
|
|
4400
4406
|
}
|
|
@@ -4411,39 +4417,39 @@ function Pd({
|
|
|
4411
4417
|
"data-grid-waiting": n,
|
|
4412
4418
|
"data-tip": O ? "Lines are kept with this new record and saved when you create it" : "Changes to lines here wait for the record’s Save — Cancel discards them",
|
|
4413
4419
|
children: [
|
|
4414
|
-
/* @__PURE__ */ s(
|
|
4420
|
+
/* @__PURE__ */ s($i, { className: "h-3 w-3", "aria-hidden": "true" }),
|
|
4415
4421
|
n > 0 ? `${n} line change${n === 1 ? "" : "s"} wait for Save` : "Saved with the record"
|
|
4416
4422
|
]
|
|
4417
4423
|
}
|
|
4418
4424
|
);
|
|
4419
4425
|
})(),
|
|
4420
|
-
|
|
4426
|
+
xo,
|
|
4421
4427
|
W && !O && /* @__PURE__ */ s(
|
|
4422
4428
|
"button",
|
|
4423
4429
|
{
|
|
4424
4430
|
type: "button",
|
|
4425
4431
|
"data-tip": "Lines timeline — every line added, changed or removed on this record",
|
|
4426
|
-
onClick: () =>
|
|
4432
|
+
onClick: () => ar(!0),
|
|
4427
4433
|
className: "ml-auto rounded p-1 text-slate-300 hover:text-nvr-cyan",
|
|
4428
|
-
children: /* @__PURE__ */ s(
|
|
4434
|
+
children: /* @__PURE__ */ s(Rr, { className: "h-3.5 w-3.5" })
|
|
4429
4435
|
}
|
|
4430
4436
|
)
|
|
4431
4437
|
] }),
|
|
4432
|
-
|
|
4438
|
+
io && pi.length > 0 && /* @__PURE__ */ _("div", { className: "rounded-lg border border-amber-200 bg-amber-50/60 p-3 space-y-2 dark:border-amber-500/30 dark:bg-amber-400/10", children: [
|
|
4433
4439
|
/* @__PURE__ */ _("p", { className: "text-[11px] font-medium text-amber-700 dark:text-amber-300", children: [
|
|
4434
4440
|
"Apply values to all ",
|
|
4435
4441
|
$.length + M.length,
|
|
4436
4442
|
" rows"
|
|
4437
4443
|
] }),
|
|
4438
4444
|
/* @__PURE__ */ _("div", { className: "flex flex-wrap gap-2 items-end", children: [
|
|
4439
|
-
|
|
4445
|
+
pi.map((e) => /* @__PURE__ */ _("div", { className: "min-w-[160px]", children: [
|
|
4440
4446
|
/* @__PURE__ */ s("p", { className: "text-[10px] text-slate-500 mb-0.5 dark:text-slate-400", children: e.label ?? qe(e.field) }),
|
|
4441
4447
|
/* @__PURE__ */ s(
|
|
4442
4448
|
yn,
|
|
4443
4449
|
{
|
|
4444
4450
|
field: e,
|
|
4445
4451
|
value: Ct[e.field] ?? null,
|
|
4446
|
-
onChange: (n) =>
|
|
4452
|
+
onChange: (n) => lo((t) => ({ ...t, [e.field]: n })),
|
|
4447
4453
|
relations: We,
|
|
4448
4454
|
collection: a,
|
|
4449
4455
|
itemId: "new"
|
|
@@ -4454,15 +4460,15 @@ function Pd({
|
|
|
4454
4460
|
"button",
|
|
4455
4461
|
{
|
|
4456
4462
|
type: "button",
|
|
4457
|
-
disabled:
|
|
4458
|
-
onClick:
|
|
4463
|
+
disabled: co || !($.length + M.length),
|
|
4464
|
+
onClick: Wa,
|
|
4459
4465
|
className: "h-9 rounded px-3 bg-amber-500 text-white text-[11px] font-medium hover:brightness-110 disabled:opacity-50 whitespace-nowrap",
|
|
4460
|
-
children:
|
|
4466
|
+
children: co ? "Applying…" : `Apply to all ${$.length + M.length} rows`
|
|
4461
4467
|
}
|
|
4462
4468
|
)
|
|
4463
4469
|
] })
|
|
4464
4470
|
] }),
|
|
4465
|
-
|
|
4471
|
+
oo && !!(L != null && L.length) && /* @__PURE__ */ _("div", { className: "rounded-lg border border-nvr-cyan/40 bg-nvr-cyan/5 p-3 space-y-2 dark:bg-nvr-cyan/5", children: [
|
|
4466
4472
|
/* @__PURE__ */ _("p", { className: "text-[11px] font-medium text-slate-700 dark:text-slate-200", children: [
|
|
4467
4473
|
"Re-run rules on ",
|
|
4468
4474
|
$.length + M.length,
|
|
@@ -4505,9 +4511,9 @@ function Pd({
|
|
|
4505
4511
|
{
|
|
4506
4512
|
type: "radio",
|
|
4507
4513
|
name: `rerun-mode-${f}`,
|
|
4508
|
-
checked:
|
|
4514
|
+
checked: _i === e,
|
|
4509
4515
|
onChange: () => {
|
|
4510
|
-
|
|
4516
|
+
Pa(e), gn(null);
|
|
4511
4517
|
},
|
|
4512
4518
|
className: "accent-nvr-cyan"
|
|
4513
4519
|
}
|
|
@@ -4521,25 +4527,25 @@ function Pd({
|
|
|
4521
4527
|
"button",
|
|
4522
4528
|
{
|
|
4523
4529
|
type: "button",
|
|
4524
|
-
disabled:
|
|
4525
|
-
onClick: () => void
|
|
4530
|
+
disabled: jr !== null,
|
|
4531
|
+
onClick: () => void Ys(!0),
|
|
4526
4532
|
className: "h-7 rounded border border-slate-300 bg-white px-2.5 text-[11px] font-medium text-slate-700 hover:border-slate-400 disabled:opacity-50 dark:bg-card dark:text-slate-200",
|
|
4527
|
-
children:
|
|
4533
|
+
children: jr === "preview" ? "Previewing…" : "Preview"
|
|
4528
4534
|
}
|
|
4529
4535
|
),
|
|
4530
|
-
|
|
4536
|
+
Mt && Mt.changes.length > 0 && /* @__PURE__ */ s(
|
|
4531
4537
|
"button",
|
|
4532
4538
|
{
|
|
4533
4539
|
type: "button",
|
|
4534
|
-
disabled:
|
|
4535
|
-
onClick: () => void
|
|
4540
|
+
disabled: jr !== null,
|
|
4541
|
+
onClick: () => void Ys(!1),
|
|
4536
4542
|
className: "h-7 rounded bg-nvr-cyan px-3 text-[11px] font-medium text-white hover:brightness-110 disabled:opacity-50",
|
|
4537
|
-
children:
|
|
4543
|
+
children: jr === "apply" ? K && k ? "Staging…" : "Applying…" : `${K && k ? "Stage for" : "Apply to"} ${Mt.changes.length} ${Mt.changes.length === 1 ? "line" : "lines"}`
|
|
4538
4544
|
}
|
|
4539
4545
|
)
|
|
4540
4546
|
] }),
|
|
4541
|
-
|
|
4542
|
-
Object.entries(
|
|
4547
|
+
Mt && /* @__PURE__ */ s("div", { className: "text-[11px] text-slate-600 dark:text-slate-300", children: Mt.changes.length === 0 ? /* @__PURE__ */ s("span", { children: "Every line already matches its rules — nothing to change." }) : /* @__PURE__ */ _("ul", { className: "flex flex-wrap gap-x-4 gap-y-1", children: [
|
|
4548
|
+
Object.entries(Mt.fields).map(([e, n]) => {
|
|
4543
4549
|
const t = ke.find((r) => r.field === e);
|
|
4544
4550
|
return /* @__PURE__ */ _("li", { children: [
|
|
4545
4551
|
/* @__PURE__ */ s("span", { className: "font-medium text-foreground", children: (t == null ? void 0 : t.label) || qe(e) }),
|
|
@@ -4550,16 +4556,16 @@ function Pd({
|
|
|
4550
4556
|
n === 1 ? "line" : "lines"
|
|
4551
4557
|
] }, e);
|
|
4552
4558
|
}),
|
|
4553
|
-
|
|
4559
|
+
Mt.truncated && /* @__PURE__ */ s("li", { className: "text-amber-700", children: "Preview shows the first 200 lines." })
|
|
4554
4560
|
] }) })
|
|
4555
4561
|
] }),
|
|
4556
|
-
(ae == null ? void 0 : ae.unmatched_banner) && !j &&
|
|
4562
|
+
(ae == null ? void 0 : ae.unmatched_banner) && !j && At.unmatchedCandidates.length > 0 && (() => {
|
|
4557
4563
|
var c, u, d, l, m, h, b, g;
|
|
4558
|
-
const e =
|
|
4564
|
+
const e = At.unmatchedCandidates.length, n = ((c = ae.unmatched_banner) == null ? void 0 : c.label) ?? "related line", t = e === 1 ? n : `${n}s`, r = ((u = ae.candidates) == null ? void 0 : u.primary) ?? ((m = (l = (d = ae.candidates) == null ? void 0 : d.keys) == null ? void 0 : l[0]) == null ? void 0 : m.row), i = (g = (b = (h = ae.candidates) == null ? void 0 : h.keys) == null ? void 0 : b.find(
|
|
4559
4565
|
(w) => w.row === r
|
|
4560
|
-
)) == null ? void 0 : g.candidate, o = i ?
|
|
4566
|
+
)) == null ? void 0 : g.candidate, o = i ? At.unmatchedCandidates.map((w) => String(w[i] ?? "")).filter(Boolean).slice(0, 8) : [];
|
|
4561
4567
|
return /* @__PURE__ */ _("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-1 rounded-lg border border-amber-200 bg-amber-50/60 px-3 py-2 text-[11px] text-amber-800 dark:border-amber-500/40 dark:bg-amber-500/10 dark:text-amber-200", children: [
|
|
4562
|
-
/* @__PURE__ */ s(
|
|
4568
|
+
/* @__PURE__ */ s(Gn, { className: "h-3.5 w-3.5 shrink-0", "aria-hidden": "true" }),
|
|
4563
4569
|
/* @__PURE__ */ _("span", { children: [
|
|
4564
4570
|
/* @__PURE__ */ _("span", { className: "font-medium", children: [
|
|
4565
4571
|
e,
|
|
@@ -4583,7 +4589,7 @@ function Pd({
|
|
|
4583
4589
|
{
|
|
4584
4590
|
type: "button",
|
|
4585
4591
|
disabled: Xt,
|
|
4586
|
-
onClick: () => void
|
|
4592
|
+
onClick: () => void Ja(),
|
|
4587
4593
|
className: "ml-auto h-6 rounded border border-amber-300 bg-white px-2.5 text-[11px] font-medium text-amber-800 hover:border-amber-400 disabled:opacity-50 dark:border-amber-500/50 dark:bg-transparent dark:text-amber-200",
|
|
4588
4594
|
"data-tip": O || K ? "Stages one row per missing line — saved with the record" : "Adds one row per missing line now",
|
|
4589
4595
|
children: Xt ? "Adding…" : `Add ${e === 1 ? "it" : `all ${e}`} as ${e === 1 ? "a row" : "rows"}`
|
|
@@ -4591,12 +4597,12 @@ function Pd({
|
|
|
4591
4597
|
)
|
|
4592
4598
|
] });
|
|
4593
4599
|
})(),
|
|
4594
|
-
(
|
|
4595
|
-
const e =
|
|
4600
|
+
(It || mi.length > 0) && !O && Le === "original" && (() => {
|
|
4601
|
+
const e = It, n = (e == null ? void 0 : e.total) ?? 0, t = [];
|
|
4596
4602
|
e != null && e.added.size && t.push(`${e.added.size} added`), e != null && e.changed.size && t.push(`${e.changed.size} changed`), e != null && e.removed.length && t.push(`${e.removed.length} removed`);
|
|
4597
4603
|
const r = ((e == null ? void 0 : e.removed) ?? []).slice(0, 5).map((i) => {
|
|
4598
4604
|
var o;
|
|
4599
|
-
return
|
|
4605
|
+
return Lr(((o = un.current) == null ? void 0 : o.get(i)) ?? { id: i });
|
|
4600
4606
|
});
|
|
4601
4607
|
return /* @__PURE__ */ _(
|
|
4602
4608
|
"div",
|
|
@@ -4613,7 +4619,7 @@ function Pd({
|
|
|
4613
4619
|
] }),
|
|
4614
4620
|
/* @__PURE__ */ _("span", { className: "text-amber-700/80 dark:text-amber-300/80", children: [
|
|
4615
4621
|
t.join(" · "),
|
|
4616
|
-
|
|
4622
|
+
Js.length > 0 && ` · changed by ${Js.join(", ")}`
|
|
4617
4623
|
] }),
|
|
4618
4624
|
r.length > 0 && /* @__PURE__ */ _("span", { className: "text-amber-700/80 dark:text-amber-300/80", children: [
|
|
4619
4625
|
"removed: ",
|
|
@@ -4624,42 +4630,42 @@ function Pd({
|
|
|
4624
4630
|
"button",
|
|
4625
4631
|
{
|
|
4626
4632
|
type: "button",
|
|
4627
|
-
onClick:
|
|
4633
|
+
onClick: _a,
|
|
4628
4634
|
className: "ml-auto h-6 rounded border border-amber-300 bg-white px-2.5 text-[11px] font-medium text-amber-800 hover:border-amber-400 dark:border-amber-500/50 dark:bg-transparent dark:text-amber-200",
|
|
4629
4635
|
"data-tip": "Take the current rows as the new baseline",
|
|
4630
4636
|
children: "Dismiss"
|
|
4631
4637
|
}
|
|
4632
4638
|
)
|
|
4633
4639
|
] }),
|
|
4634
|
-
|
|
4640
|
+
mi.length > 0 && /* @__PURE__ */ s(
|
|
4635
4641
|
"span",
|
|
4636
4642
|
{
|
|
4637
4643
|
"data-remote-editors": "",
|
|
4638
4644
|
className: e ? "basis-full text-amber-700/80 dark:text-amber-300/80" : "font-medium",
|
|
4639
|
-
children:
|
|
4645
|
+
children: mi.join(" · ")
|
|
4640
4646
|
}
|
|
4641
4647
|
)
|
|
4642
4648
|
]
|
|
4643
4649
|
}
|
|
4644
4650
|
);
|
|
4645
4651
|
})(),
|
|
4646
|
-
|
|
4652
|
+
Hi && /* @__PURE__ */ _("div", { className: "rounded-lg border border-slate-200 p-3 space-y-1.5", children: [
|
|
4647
4653
|
/* @__PURE__ */ s("div", { className: "h-8 rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))] animate-pulse" }),
|
|
4648
4654
|
/* @__PURE__ */ s("div", { className: "h-8 rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))] animate-pulse" }),
|
|
4649
4655
|
/* @__PURE__ */ s("div", { className: "h-8 rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))] animate-pulse" })
|
|
4650
4656
|
] }),
|
|
4651
|
-
!j &&
|
|
4652
|
-
|
|
4657
|
+
!j && vs.length > 0 && /* @__PURE__ */ s(
|
|
4658
|
+
$l,
|
|
4653
4659
|
{
|
|
4654
|
-
proposals:
|
|
4655
|
-
onApply:
|
|
4656
|
-
onDismiss: (e) =>
|
|
4660
|
+
proposals: vs,
|
|
4661
|
+
onApply: ma,
|
|
4662
|
+
onDismiss: (e) => ai(e, !0)
|
|
4657
4663
|
}
|
|
4658
4664
|
),
|
|
4659
|
-
(
|
|
4660
|
-
/* @__PURE__ */ s(
|
|
4661
|
-
(
|
|
4662
|
-
|
|
4665
|
+
(ii && ii.length > 0 || Pe && !O && (q || bs || ys)) && /* @__PURE__ */ _("div", { "data-o2m-stats": !0, className: "mb-2 flex flex-wrap items-stretch gap-1.5", children: [
|
|
4666
|
+
/* @__PURE__ */ s(ql, { data: q, loading: bs, error: ys }),
|
|
4667
|
+
(ii ?? []).map((e) => /* @__PURE__ */ s(
|
|
4668
|
+
El,
|
|
4663
4669
|
{
|
|
4664
4670
|
label: e.label,
|
|
4665
4671
|
value: e.result,
|
|
@@ -4669,22 +4675,22 @@ function Pd({
|
|
|
4669
4675
|
e.label
|
|
4670
4676
|
))
|
|
4671
4677
|
] }),
|
|
4672
|
-
j &&
|
|
4678
|
+
j && xo,
|
|
4673
4679
|
/* @__PURE__ */ _(
|
|
4674
4680
|
"div",
|
|
4675
4681
|
{
|
|
4676
|
-
ref:
|
|
4677
|
-
className:
|
|
4682
|
+
ref: rr,
|
|
4683
|
+
className: Hi ? "hidden" : `relative rounded-lg border border-slate-200 text-[12px]${X ? " overflow-x-auto" : ""}`,
|
|
4678
4684
|
children: [
|
|
4679
|
-
|
|
4685
|
+
La && /* @__PURE__ */ s("div", { className: "absolute inset-0 z-10 flex items-center justify-center rounded-lg bg-white/60 backdrop-blur-[1px] dark:bg-black/40", children: /* @__PURE__ */ _("div", { className: "flex items-center gap-2 rounded-md border border-slate-200 bg-white px-3 py-1.5 shadow-sm text-[12px] text-slate-500", children: [
|
|
4680
4686
|
/* @__PURE__ */ s(vn, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
4681
4687
|
"Saving order…"
|
|
4682
4688
|
] }) }),
|
|
4683
|
-
|
|
4689
|
+
As && /* @__PURE__ */ s("style", { children: As }),
|
|
4684
4690
|
/* @__PURE__ */ _(
|
|
4685
4691
|
"table",
|
|
4686
4692
|
{
|
|
4687
|
-
className: X ? `w-full min-w-max ${
|
|
4693
|
+
className: X ? `w-full min-w-max ${Rn}` : "w-full table-fixed",
|
|
4688
4694
|
children: [
|
|
4689
4695
|
/* @__PURE__ */ s("thead", { className: "bg-slate-50 border-b border-slate-200 [&>tr>th:first-child]:rounded-tl-lg [&>tr>th:last-child]:rounded-tr-lg", children: /* @__PURE__ */ _("tr", { children: [
|
|
4690
4696
|
at && /* @__PURE__ */ s("th", { className: "w-7 px-1.5 py-2 align-middle", children: /* @__PURE__ */ s(
|
|
@@ -4693,8 +4699,8 @@ function Pd({
|
|
|
4693
4699
|
type: "checkbox",
|
|
4694
4700
|
"aria-label": "Select all rows",
|
|
4695
4701
|
className: "accent-nvr-cyan",
|
|
4696
|
-
checked:
|
|
4697
|
-
onChange: (e) =>
|
|
4702
|
+
checked: Qa,
|
|
4703
|
+
onChange: (e) => sr(e.target.checked ? new Set(Ni) : /* @__PURE__ */ new Set())
|
|
4698
4704
|
}
|
|
4699
4705
|
) }),
|
|
4700
4706
|
te && (C || O || K) && /* @__PURE__ */ s("th", { className: "w-6" }),
|
|
@@ -4711,12 +4717,12 @@ function Pd({
|
|
|
4711
4717
|
/* @__PURE__ */ s("th", { className: "w-20" })
|
|
4712
4718
|
] }) }),
|
|
4713
4719
|
/* @__PURE__ */ _("tbody", { children: [
|
|
4714
|
-
|
|
4720
|
+
ro && /* @__PURE__ */ _("tr", { className: "border-b border-nvr-cyan/20 bg-nvr-cyan/5", children: [
|
|
4715
4721
|
at && /* @__PURE__ */ s("td", { className: "w-7" }),
|
|
4716
4722
|
te && (C || O || K) && /* @__PURE__ */ s("td", { className: "w-6" }),
|
|
4717
4723
|
A && /* @__PURE__ */ s("td", { className: "w-8" }),
|
|
4718
4724
|
(O || K) && /* @__PURE__ */ s("td", { className: "px-3 py-0.5 align-middle w-20", children: /* @__PURE__ */ s("span", { className: "text-[10px] font-medium uppercase tracking-wide text-slate-500 dark:text-muted-foreground", children: "Defaults" }) }),
|
|
4719
|
-
|
|
4725
|
+
Bs.map((e) => /* @__PURE__ */ s(
|
|
4720
4726
|
"td",
|
|
4721
4727
|
{
|
|
4722
4728
|
className: "px-2 py-0.5 align-middle text-[11px] [&_button]:h-7 [&_button]:min-h-0 [&_button]:text-[11px] [&_input]:h-7 [&_input]:text-[11px] [&_textarea]:min-h-[28px] [&_label]:hidden",
|
|
@@ -4724,8 +4730,8 @@ function Pd({
|
|
|
4724
4730
|
yn,
|
|
4725
4731
|
{
|
|
4726
4732
|
field: e,
|
|
4727
|
-
value:
|
|
4728
|
-
onChange: (n) =>
|
|
4733
|
+
value: wi[e.field] ?? null,
|
|
4734
|
+
onChange: (n) => Da(e.field, n),
|
|
4729
4735
|
relations: We,
|
|
4730
4736
|
collection: a,
|
|
4731
4737
|
itemId: "new"
|
|
@@ -4739,24 +4745,24 @@ function Pd({
|
|
|
4739
4745
|
{
|
|
4740
4746
|
type: "button",
|
|
4741
4747
|
disabled: Xt,
|
|
4742
|
-
onClick: () =>
|
|
4748
|
+
onClick: () => fo(!0),
|
|
4743
4749
|
className: "rounded px-2 h-7 bg-nvr-cyan text-white text-[11px] font-medium hover:brightness-110 disabled:opacity-50 whitespace-nowrap",
|
|
4744
4750
|
children: Xt ? "…" : `Add ${Gt}`
|
|
4745
4751
|
}
|
|
4746
4752
|
) })
|
|
4747
4753
|
] }),
|
|
4748
4754
|
!O && Le === "original" && $.slice(0, cn).map((e, n) => {
|
|
4749
|
-
const t = String(e.id), r =
|
|
4755
|
+
const t = String(e.id), r = fs ? In(e) : null, i = r !== null && (n === 0 || In($[n - 1]) !== r), o = r !== null && ms.has(r), c = i && r !== null ? /* @__PURE__ */ s("tr", { className: "border-b border-slate-200 bg-slate-100/80 dark:border-border dark:bg-muted", children: /* @__PURE__ */ s("td", { colSpan: St, className: "px-2 py-1", children: /* @__PURE__ */ _(
|
|
4750
4756
|
"button",
|
|
4751
4757
|
{
|
|
4752
4758
|
type: "button",
|
|
4753
4759
|
onClick: (y) => {
|
|
4754
|
-
y.stopPropagation(),
|
|
4760
|
+
y.stopPropagation(), da(r);
|
|
4755
4761
|
},
|
|
4756
4762
|
className: "flex w-full items-center gap-1.5 text-left",
|
|
4757
4763
|
children: [
|
|
4758
4764
|
/* @__PURE__ */ s(
|
|
4759
|
-
|
|
4765
|
+
Mo,
|
|
4760
4766
|
{
|
|
4761
4767
|
className: ve(
|
|
4762
4768
|
"h-3 w-3 shrink-0 text-slate-400 transition-transform",
|
|
@@ -4767,7 +4773,7 @@ function Pd({
|
|
|
4767
4773
|
/* @__PURE__ */ s("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: r }),
|
|
4768
4774
|
/* @__PURE__ */ s("span", { className: "rounded border border-slate-200 bg-white px-1.5 py-0.5 text-[10px] font-medium text-slate-500 dark:border-border dark:bg-background dark:text-slate-400", children: $.reduce((y, x) => y + (In(x) === r ? 1 : 0), 0) }),
|
|
4769
4775
|
(() => {
|
|
4770
|
-
const y =
|
|
4776
|
+
const y = ca(
|
|
4771
4777
|
$.filter(
|
|
4772
4778
|
(x) => In(x) === r && !Je.has(String(x.id))
|
|
4773
4779
|
)
|
|
@@ -4788,9 +4794,9 @@ function Pd({
|
|
|
4788
4794
|
]
|
|
4789
4795
|
}
|
|
4790
4796
|
) }) }) : null;
|
|
4791
|
-
if (o) return /* @__PURE__ */ s(
|
|
4792
|
-
const u = (p == null ? void 0 : p.rowId) === t, d = u && !_e, l = gt === n, m =
|
|
4793
|
-
return /* @__PURE__ */ _(
|
|
4797
|
+
if (o) return /* @__PURE__ */ s(qi, { children: c }, t);
|
|
4798
|
+
const u = (p == null ? void 0 : p.rowId) === t, d = u && !_e, l = gt === n, m = Lt === n && gt !== n, h = H.has(t), b = Je.has(t), g = h ? { ...e, ...H.get(t) } : e, w = Vi && !b ? Jo.get(String(g[Vi] ?? "")) ?? null : null;
|
|
4799
|
+
return /* @__PURE__ */ _(qi, { children: [
|
|
4794
4800
|
c,
|
|
4795
4801
|
/* @__PURE__ */ _(
|
|
4796
4802
|
"tr",
|
|
@@ -4799,14 +4805,14 @@ function Pd({
|
|
|
4799
4805
|
"data-o2m-editing": u ? "" : void 0,
|
|
4800
4806
|
tabIndex: _e ? -1 : void 0,
|
|
4801
4807
|
draggable: te && !!C && !u && !b,
|
|
4802
|
-
onDragStart: () =>
|
|
4803
|
-
onDragOver: (y) =>
|
|
4804
|
-
onDrop:
|
|
4808
|
+
onDragStart: () => mo(n),
|
|
4809
|
+
onDragOver: (y) => po(y, n),
|
|
4810
|
+
onDrop: za,
|
|
4805
4811
|
onDragEnd: bn,
|
|
4806
|
-
onClick: () => !u && !b &&
|
|
4812
|
+
onClick: () => !u && !b && Ir(g),
|
|
4807
4813
|
onBlur: (y) => {
|
|
4808
|
-
!u || ht || b || y.currentTarget.contains(y.relatedTarget) ||
|
|
4809
|
-
En.current ||
|
|
4814
|
+
!u || ht || b || y.currentTarget.contains(y.relatedTarget) || ur(y.relatedTarget) || (ut.current = setTimeout(() => {
|
|
4815
|
+
En.current || ur(document.activeElement) || Tt();
|
|
4810
4816
|
}, 150));
|
|
4811
4817
|
},
|
|
4812
4818
|
onFocus: () => {
|
|
@@ -4829,7 +4835,7 @@ function Pd({
|
|
|
4829
4835
|
onClick: (y) => y.stopPropagation(),
|
|
4830
4836
|
onKeyDown: (y) => y.stopPropagation(),
|
|
4831
4837
|
children: [
|
|
4832
|
-
|
|
4838
|
+
Qn(t),
|
|
4833
4839
|
/* @__PURE__ */ s(
|
|
4834
4840
|
"input",
|
|
4835
4841
|
{
|
|
@@ -4838,7 +4844,7 @@ function Pd({
|
|
|
4838
4844
|
className: "accent-nvr-cyan",
|
|
4839
4845
|
checked: Ut.has(t),
|
|
4840
4846
|
disabled: b,
|
|
4841
|
-
onChange: () =>
|
|
4847
|
+
onChange: () => Fi(t)
|
|
4842
4848
|
}
|
|
4843
4849
|
)
|
|
4844
4850
|
]
|
|
@@ -4850,42 +4856,42 @@ function Pd({
|
|
|
4850
4856
|
className: "relative w-6 px-1 align-middle",
|
|
4851
4857
|
onClick: (y) => y.stopPropagation(),
|
|
4852
4858
|
children: [
|
|
4853
|
-
|
|
4854
|
-
C && /* @__PURE__ */ s(
|
|
4859
|
+
zn === "reorder" && Qn(t),
|
|
4860
|
+
C && /* @__PURE__ */ s(_o, { className: "h-3 w-3 text-slate-300 cursor-grab" })
|
|
4855
4861
|
]
|
|
4856
4862
|
}
|
|
4857
4863
|
),
|
|
4858
4864
|
A && /* @__PURE__ */ _("td", { className: "relative w-8 px-2 align-middle text-slate-400 text-[11px] select-none", children: [
|
|
4859
|
-
|
|
4865
|
+
zn === "num" && Qn(t),
|
|
4860
4866
|
/* @__PURE__ */ _("span", { className: "inline-flex items-center gap-1", children: [
|
|
4861
4867
|
n + 1,
|
|
4862
4868
|
ae && /* @__PURE__ */ s(
|
|
4863
|
-
|
|
4869
|
+
Io,
|
|
4864
4870
|
{
|
|
4865
|
-
result:
|
|
4871
|
+
result: At.byRow.get(t),
|
|
4866
4872
|
title: ae.title
|
|
4867
4873
|
}
|
|
4868
4874
|
),
|
|
4869
|
-
|
|
4870
|
-
|
|
4875
|
+
pr(t) && /* @__PURE__ */ s(
|
|
4876
|
+
ko,
|
|
4871
4877
|
{
|
|
4872
4878
|
className: "h-2.5 w-2.5 text-slate-300 dark:text-slate-500",
|
|
4873
4879
|
"aria-label": "Imported line",
|
|
4874
|
-
"data-tip":
|
|
4880
|
+
"data-tip": pr(t) ?? void 0
|
|
4875
4881
|
}
|
|
4876
4882
|
),
|
|
4877
|
-
|
|
4878
|
-
|
|
4883
|
+
is.has(t) && /* @__PURE__ */ s(
|
|
4884
|
+
$i,
|
|
4879
4885
|
{
|
|
4880
4886
|
className: "h-2.5 w-2.5 text-amber-500",
|
|
4881
4887
|
"aria-label": "Line overdue",
|
|
4882
|
-
"data-tip":
|
|
4888
|
+
"data-tip": ss
|
|
4883
4889
|
}
|
|
4884
4890
|
),
|
|
4885
4891
|
(() => {
|
|
4886
|
-
const y =
|
|
4892
|
+
const y = Mi(g, xt);
|
|
4887
4893
|
return y.length ? /* @__PURE__ */ s(
|
|
4888
|
-
|
|
4894
|
+
Gn,
|
|
4889
4895
|
{
|
|
4890
4896
|
className: "h-2.5 w-2.5 text-amber-500",
|
|
4891
4897
|
"aria-label": "Line needs attention",
|
|
@@ -4896,34 +4902,34 @@ function Pd({
|
|
|
4896
4902
|
] })
|
|
4897
4903
|
] }),
|
|
4898
4904
|
K && /* @__PURE__ */ _("td", { className: "relative px-3 py-1 align-middle w-20", children: [
|
|
4899
|
-
|
|
4905
|
+
zn === "status" && Qn(t),
|
|
4900
4906
|
!A && ae && /* @__PURE__ */ s(
|
|
4901
|
-
|
|
4907
|
+
Io,
|
|
4902
4908
|
{
|
|
4903
|
-
result:
|
|
4909
|
+
result: At.byRow.get(t),
|
|
4904
4910
|
title: ae.title
|
|
4905
4911
|
}
|
|
4906
4912
|
),
|
|
4907
|
-
!A &&
|
|
4908
|
-
|
|
4913
|
+
!A && pr(t) && /* @__PURE__ */ s(
|
|
4914
|
+
ko,
|
|
4909
4915
|
{
|
|
4910
4916
|
className: "mr-1 inline h-2.5 w-2.5 text-slate-300 dark:text-slate-500",
|
|
4911
4917
|
"aria-label": "Imported line",
|
|
4912
|
-
"data-tip":
|
|
4918
|
+
"data-tip": pr(t) ?? void 0
|
|
4913
4919
|
}
|
|
4914
4920
|
),
|
|
4915
|
-
!A &&
|
|
4916
|
-
|
|
4921
|
+
!A && is.has(t) && /* @__PURE__ */ s(
|
|
4922
|
+
$i,
|
|
4917
4923
|
{
|
|
4918
4924
|
className: "mr-1 inline h-2.5 w-2.5 text-amber-500",
|
|
4919
4925
|
"aria-label": "Line overdue",
|
|
4920
|
-
"data-tip":
|
|
4926
|
+
"data-tip": ss
|
|
4921
4927
|
}
|
|
4922
4928
|
),
|
|
4923
4929
|
!A && (() => {
|
|
4924
|
-
const y =
|
|
4930
|
+
const y = Mi(g, xt);
|
|
4925
4931
|
return y.length ? /* @__PURE__ */ s(
|
|
4926
|
-
|
|
4932
|
+
Gn,
|
|
4927
4933
|
{
|
|
4928
4934
|
className: "mr-1 inline h-2.5 w-2.5 text-amber-500",
|
|
4929
4935
|
"aria-label": "Line needs attention",
|
|
@@ -4934,30 +4940,30 @@ function Pd({
|
|
|
4934
4940
|
b ? /* @__PURE__ */ s("span", { className: "inline-flex text-[10px] font-medium text-red-600 bg-red-50 border border-red-200 rounded px-1.5 py-0.5 dark:border-red-900/40 dark:bg-red-950/30 dark:text-red-300", children: "Delete" }) : h ? /* @__PURE__ */ s("span", { className: "nvr-pop inline-flex text-[10px] font-medium text-amber-600 bg-amber-50 border border-amber-200 dark:text-amber-400 dark:bg-amber-500/10 dark:border-amber-500/40 rounded px-1.5 py-0.5", children: "Edited" }) : null
|
|
4935
4941
|
] })
|
|
4936
4942
|
] }),
|
|
4937
|
-
u && !b && lt === "panel" ?
|
|
4938
|
-
identity: `${A ? `Line ${n + 1} · ` : ""}${
|
|
4943
|
+
u && !b && lt === "panel" ? Si({
|
|
4944
|
+
identity: `${A ? `Line ${n + 1} · ` : ""}${Lr(g)}`,
|
|
4939
4945
|
draft: (p == null ? void 0 : p.draft) ?? g,
|
|
4940
4946
|
rowId: t,
|
|
4941
4947
|
saveLabel: "Save",
|
|
4942
|
-
onDelete: (y) =>
|
|
4943
|
-
drawer:
|
|
4948
|
+
onDelete: (y) => ki(e, y),
|
|
4949
|
+
drawer: Mr(t, (p == null ? void 0 : p.draft) ?? g)
|
|
4944
4950
|
}) : (() => {
|
|
4945
|
-
const y =
|
|
4951
|
+
const y = Vn(g, { rowKey: t });
|
|
4946
4952
|
return Re.map((x, R) => {
|
|
4947
4953
|
var Y, ye, ue;
|
|
4948
4954
|
if (st(x))
|
|
4949
|
-
return /* @__PURE__ */ s("td", { className: "px-2 py-1 align-top", children: /* @__PURE__ */ s("div", { className: "py-0.5 overflow-hidden text-slate-500", children:
|
|
4955
|
+
return /* @__PURE__ */ s("td", { className: "px-2 py-1 align-top", children: /* @__PURE__ */ s("div", { className: "py-0.5 overflow-hidden text-slate-500", children: Sr(x, g) }) }, x.field);
|
|
4950
4956
|
const I = x.computed_type === "write" && !!x.computed_formula, B = I ? Rt(
|
|
4951
4957
|
x.computed_formula,
|
|
4952
4958
|
u ? (p == null ? void 0 : p.draft) ?? g : g
|
|
4953
|
-
) ?? g[x.field] : null, F = W && !u && !b ? (Y =
|
|
4959
|
+
) ?? g[x.field] : null, F = W && !u && !b ? (Y = Gr[t]) == null ? void 0 : Y[x.field] : void 0, Me = F ? `${x.label || qe(x.field)} · changed ${$o(F.at)} by ${F.who}${F.reason ? `
|
|
4954
4960
|
Reason: “${F.reason}”` : ""}` : void 0;
|
|
4955
4961
|
return /* @__PURE__ */ _(
|
|
4956
4962
|
"td",
|
|
4957
4963
|
{
|
|
4958
4964
|
className: ve(
|
|
4959
4965
|
"px-2 py-1 align-top",
|
|
4960
|
-
(F || R === 0 &&
|
|
4966
|
+
(F || R === 0 && zn === "data") && "relative",
|
|
4961
4967
|
q && Kt(
|
|
4962
4968
|
q,
|
|
4963
4969
|
g[q.key_field],
|
|
@@ -4971,7 +4977,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
4971
4977
|
) ? "" : void 0,
|
|
4972
4978
|
"data-tip": Me,
|
|
4973
4979
|
children: [
|
|
4974
|
-
R === 0 &&
|
|
4980
|
+
R === 0 && zn === "data" && Qn(t),
|
|
4975
4981
|
(F == null ? void 0 : F.reason) && // #513: a change made FOR a stated reason carries a
|
|
4976
4982
|
// corner mark, like a spreadsheet comment — the
|
|
4977
4983
|
// reason itself rides the cell's tip.
|
|
@@ -4989,10 +4995,10 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
4989
4995
|
type: "button",
|
|
4990
4996
|
"aria-label": `History of ${x.label || qe(x.field)}`,
|
|
4991
4997
|
onClick: (ee) => {
|
|
4992
|
-
ee.stopPropagation(),
|
|
4998
|
+
ee.stopPropagation(), Fr(F.revision_id), kn(e);
|
|
4993
4999
|
},
|
|
4994
5000
|
className: "absolute right-0.5 top-0.5 rounded p-px text-slate-300 opacity-0 transition-opacity duration-150 hover:text-nvr-cyan focus-visible:opacity-100 group-hover/row:opacity-100 dark:text-slate-500",
|
|
4995
|
-
children: /* @__PURE__ */ s(
|
|
5001
|
+
children: /* @__PURE__ */ s(Rr, { className: "h-2.5 w-2.5", "aria-hidden": "true" })
|
|
4996
5002
|
}
|
|
4997
5003
|
),
|
|
4998
5004
|
I ? /* @__PURE__ */ s("div", { className: "py-0.5 overflow-hidden text-slate-500 italic", children: Ue(x, B) }) : d && !b || An(x.interface) ? (
|
|
@@ -5002,8 +5008,8 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5002
5008
|
"div",
|
|
5003
5009
|
{
|
|
5004
5010
|
onClick: (ee) => ee.stopPropagation(),
|
|
5005
|
-
"data-tip": d && ((ye = p == null ? void 0 : p.locks) != null && ye.includes(x.field)) ?
|
|
5006
|
-
"data-grid-cell": d ?
|
|
5011
|
+
"data-tip": d && ((ye = p == null ? void 0 : p.locks) != null && ye.includes(x.field)) ? Xs(x.field) : vr(x) ? "Only administrators can change this field" : void 0,
|
|
5012
|
+
"data-grid-cell": d ? Ci(t, x.field) : void 0,
|
|
5007
5013
|
children: /* @__PURE__ */ s(
|
|
5008
5014
|
yn,
|
|
5009
5015
|
{
|
|
@@ -5014,11 +5020,11 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5014
5020
|
collection: a,
|
|
5015
5021
|
itemId: t,
|
|
5016
5022
|
cascadeFilter: it[x.field],
|
|
5017
|
-
pinnedOption:
|
|
5023
|
+
pinnedOption: Kn(
|
|
5018
5024
|
x.field,
|
|
5019
5025
|
(p == null ? void 0 : p.draft) ?? {}
|
|
5020
5026
|
),
|
|
5021
|
-
displayOnly: !d || b || d && !!((ue = p == null ? void 0 : p.locks) != null && ue.includes(x.field))
|
|
5027
|
+
displayOnly: !d || b || vr(x) || d && !!((ue = p == null ? void 0 : p.locks) != null && ue.includes(x.field))
|
|
5022
5028
|
}
|
|
5023
5029
|
)
|
|
5024
5030
|
}
|
|
@@ -5038,14 +5044,14 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5038
5044
|
e.id != null ? String(e.id) : void 0
|
|
5039
5045
|
) }),
|
|
5040
5046
|
q && /* @__PURE__ */ s(
|
|
5041
|
-
|
|
5047
|
+
Ii,
|
|
5042
5048
|
{
|
|
5043
5049
|
data: q,
|
|
5044
|
-
row:
|
|
5050
|
+
row: Ai(q, g),
|
|
5045
5051
|
rowKey: g[q.key_field],
|
|
5046
5052
|
column: x.field,
|
|
5047
5053
|
planned: d && !b ? p == null ? void 0 : p.draft[x.field] : g[x.field],
|
|
5048
|
-
columnLabel:
|
|
5054
|
+
columnLabel: xr(x),
|
|
5049
5055
|
plannedRow: g,
|
|
5050
5056
|
onAdjust: !j && !b && e.id != null ? (ee, Be) => void an(String(e.id), ee, Be) : void 0
|
|
5051
5057
|
}
|
|
@@ -5067,7 +5073,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5067
5073
|
{
|
|
5068
5074
|
type: "button",
|
|
5069
5075
|
disabled: ht,
|
|
5070
|
-
onClick:
|
|
5076
|
+
onClick: Tt,
|
|
5071
5077
|
className: "rounded px-2 h-9 bg-nvr-cyan text-white text-[11px] font-medium hover:brightness-110 disabled:opacity-50",
|
|
5072
5078
|
children: ht ? "…" : "Save"
|
|
5073
5079
|
}
|
|
@@ -5076,7 +5082,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5076
5082
|
"button",
|
|
5077
5083
|
{
|
|
5078
5084
|
type: "button",
|
|
5079
|
-
onClick:
|
|
5085
|
+
onClick: Jn,
|
|
5080
5086
|
className: "rounded px-1.5 h-9 text-slate-400 hover:text-slate-700 text-[11px]",
|
|
5081
5087
|
children: "✕"
|
|
5082
5088
|
}
|
|
@@ -5101,7 +5107,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5101
5107
|
type: "button",
|
|
5102
5108
|
title: "Undo edit",
|
|
5103
5109
|
onClick: (y) => {
|
|
5104
|
-
y.stopPropagation(), k == null || k.cancelPendingEdit(a, f, t),
|
|
5110
|
+
y.stopPropagation(), k == null || k.cancelPendingEdit(a, f, t), gr((x) => {
|
|
5105
5111
|
const R = {};
|
|
5106
5112
|
for (const [I, B] of Object.entries(x))
|
|
5107
5113
|
I.startsWith(`${t}|`) || (R[I] = B);
|
|
@@ -5113,11 +5119,11 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5113
5119
|
}
|
|
5114
5120
|
),
|
|
5115
5121
|
ne && t != null && /* @__PURE__ */ s(
|
|
5116
|
-
|
|
5122
|
+
Dl,
|
|
5117
5123
|
{
|
|
5118
5124
|
collection: a,
|
|
5119
5125
|
rowId: String(t),
|
|
5120
|
-
count:
|
|
5126
|
+
count: xa[String(t)] ?? 0
|
|
5121
5127
|
}
|
|
5122
5128
|
),
|
|
5123
5129
|
W && /* @__PURE__ */ s(
|
|
@@ -5129,32 +5135,32 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5129
5135
|
y.stopPropagation(), kn(e);
|
|
5130
5136
|
},
|
|
5131
5137
|
className: "rounded p-0.5 text-slate-300 hover:text-nvr-cyan",
|
|
5132
|
-
children: /* @__PURE__ */ s(
|
|
5138
|
+
children: /* @__PURE__ */ s(Rr, { className: "h-3 w-3" })
|
|
5133
5139
|
}
|
|
5134
5140
|
),
|
|
5135
5141
|
t != null && !String(t).startsWith("pending") && /* @__PURE__ */ s(
|
|
5136
|
-
|
|
5142
|
+
Ql,
|
|
5137
5143
|
{
|
|
5138
5144
|
collection: a,
|
|
5139
5145
|
rowId: String(t),
|
|
5140
|
-
rowLabel:
|
|
5146
|
+
rowLabel: Gl(e)
|
|
5141
5147
|
}
|
|
5142
5148
|
),
|
|
5143
5149
|
!j && /* @__PURE__ */ s(
|
|
5144
5150
|
"button",
|
|
5145
5151
|
{
|
|
5146
5152
|
type: "button",
|
|
5147
|
-
onClick: (y) =>
|
|
5153
|
+
onClick: (y) => ki(e, y),
|
|
5148
5154
|
className: "rounded p-0.5 text-slate-300 hover:text-red-500",
|
|
5149
|
-
children: /* @__PURE__ */ s(
|
|
5155
|
+
children: /* @__PURE__ */ s(No, { className: "h-3 w-3" })
|
|
5150
5156
|
}
|
|
5151
5157
|
)
|
|
5152
5158
|
] }) }) })
|
|
5153
5159
|
]
|
|
5154
5160
|
}
|
|
5155
5161
|
),
|
|
5156
|
-
!_e && (Ce == null ? void 0 : Ce.rowKey) === t && /* @__PURE__ */ s("tr", { "data-row-soft-lock-row": "", children: /* @__PURE__ */ s("td", { colSpan: St, className: "p-0", children:
|
|
5157
|
-
u && lt === "inline" &&
|
|
5162
|
+
!_e && (Ce == null ? void 0 : Ce.rowKey) === t && /* @__PURE__ */ s("tr", { "data-row-soft-lock-row": "", children: /* @__PURE__ */ s("td", { colSpan: St, className: "p-0", children: bo(Ce, "row") }) }),
|
|
5163
|
+
u && lt === "inline" && Wn.length > 0 && /* @__PURE__ */ s("tr", { "data-row-remote-change-row": "", children: /* @__PURE__ */ s("td", { colSpan: St, className: "px-2 pt-2", children: Us(t) }) }),
|
|
5158
5164
|
w && /* @__PURE__ */ s("tr", { children: /* @__PURE__ */ _(
|
|
5159
5165
|
"td",
|
|
5160
5166
|
{
|
|
@@ -5172,14 +5178,14 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5172
5178
|
"data-o2m-editing": !0,
|
|
5173
5179
|
className: "border-b border-slate-100 bg-[#f0fbff]/60 dark:bg-nvr-cyan/5",
|
|
5174
5180
|
children: /* @__PURE__ */ s("td", { colSpan: St, className: "px-3 py-2", children: /* @__PURE__ */ s("div", { className: "space-y-2", children: G.map((y) => {
|
|
5175
|
-
const x = typeof y == "string" ? y : y.field, R = typeof y == "string" ? void 0 : y.hint, I = typeof y == "string" ? void 0 : y.match, B = (p == null ? void 0 : p.draft) ?? g, F = I ?
|
|
5181
|
+
const x = typeof y == "string" ? y : y.field, R = typeof y == "string" ? void 0 : y.hint, I = typeof y == "string" ? void 0 : y.match, B = (p == null ? void 0 : p.draft) ?? g, F = I ? Wr(
|
|
5176
5182
|
I,
|
|
5177
5183
|
B,
|
|
5178
5184
|
v,
|
|
5179
5185
|
N == null ? void 0 : N.draft
|
|
5180
5186
|
) : null;
|
|
5181
5187
|
return /* @__PURE__ */ s(
|
|
5182
|
-
|
|
5188
|
+
Ti,
|
|
5183
5189
|
{
|
|
5184
5190
|
parentCollection: a,
|
|
5185
5191
|
relationField: x,
|
|
@@ -5198,7 +5204,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5198
5204
|
matchSeed: (F == null ? void 0 : F.seed) ?? {}
|
|
5199
5205
|
} : K ? {
|
|
5200
5206
|
deferred: !0,
|
|
5201
|
-
stagedOps: (p == null ? void 0 : p.draft[`__nested_ops_${x}`]) ??
|
|
5207
|
+
stagedOps: (p == null ? void 0 : p.draft[`__nested_ops_${x}`]) ?? Pr,
|
|
5202
5208
|
onStagedOpsChange: (Me) => mt(`__nested_ops_${x}`, Me)
|
|
5203
5209
|
} : {}
|
|
5204
5210
|
},
|
|
@@ -5209,7 +5215,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5209
5215
|
)
|
|
5210
5216
|
] }, t);
|
|
5211
5217
|
}),
|
|
5212
|
-
|
|
5218
|
+
Tr && _e && /* @__PURE__ */ s(
|
|
5213
5219
|
"tr",
|
|
5214
5220
|
{
|
|
5215
5221
|
"data-o2m-editing": !0,
|
|
@@ -5227,7 +5233,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5227
5233
|
)
|
|
5228
5234
|
}
|
|
5229
5235
|
),
|
|
5230
|
-
|
|
5236
|
+
Tr && !_e && /* @__PURE__ */ _(
|
|
5231
5237
|
"tr",
|
|
5232
5238
|
{
|
|
5233
5239
|
"data-o2m-editing": !0,
|
|
@@ -5239,21 +5245,21 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5239
5245
|
A && /* @__PURE__ */ s("td", { className: "w-8 px-2 align-middle text-slate-400 text-[11px] select-none", children: $.length + M.length + 1 }),
|
|
5240
5246
|
(O || K) && /* @__PURE__ */ s("td", { className: "px-3 py-1.5" })
|
|
5241
5247
|
] }),
|
|
5242
|
-
lt === "panel" ?
|
|
5248
|
+
lt === "panel" ? Si({
|
|
5243
5249
|
identity: `${A ? `Line ${$.length + M.length + 1} · ` : ""}New line`,
|
|
5244
5250
|
draft: p.draft,
|
|
5245
5251
|
rowId: void 0,
|
|
5246
5252
|
saveLabel: "Save",
|
|
5247
|
-
drawer:
|
|
5253
|
+
drawer: Mr(void 0, p.draft)
|
|
5248
5254
|
}) : Re.map((e) => {
|
|
5249
5255
|
if (st(e))
|
|
5250
|
-
return /* @__PURE__ */ s("td", { className: "px-2 py-1 align-top", children: /* @__PURE__ */ s("div", { className: "py-0.5 overflow-hidden text-slate-500", children:
|
|
5251
|
-
const n = e.computed_type === "write" && !!e.computed_formula, t = An(e.interface), r = `__m2m_${e.field}`, i = t ?
|
|
5256
|
+
return /* @__PURE__ */ s("td", { className: "px-2 py-1 align-top", children: /* @__PURE__ */ s("div", { className: "py-0.5 overflow-hidden text-slate-500", children: Pn(e, p.draft, !0) }) }, e.field);
|
|
5257
|
+
const n = e.computed_type === "write" && !!e.computed_formula, t = An(e.interface), r = `__m2m_${e.field}`, i = t ? ti(e) : null;
|
|
5252
5258
|
return /* @__PURE__ */ s("td", { className: "px-2 py-1 align-top", children: n ? /* @__PURE__ */ s("div", { className: "py-0.5 overflow-hidden text-slate-500 italic", children: Ue(
|
|
5253
5259
|
e,
|
|
5254
5260
|
Rt(e.computed_formula, p.draft) ?? null
|
|
5255
5261
|
) }) : t && i ? /* @__PURE__ */ s("div", { onClick: (o) => o.stopPropagation(), children: /* @__PURE__ */ s(
|
|
5256
|
-
|
|
5262
|
+
Li,
|
|
5257
5263
|
{
|
|
5258
5264
|
collection: i.targetCollection,
|
|
5259
5265
|
value: p.draft[r] ?? null,
|
|
@@ -5270,7 +5276,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5270
5276
|
collection: a,
|
|
5271
5277
|
itemId: "new",
|
|
5272
5278
|
cascadeFilter: it[e.field],
|
|
5273
|
-
pinnedOption:
|
|
5279
|
+
pinnedOption: Kn(e.field, p.draft)
|
|
5274
5280
|
}
|
|
5275
5281
|
) }) }, e.field);
|
|
5276
5282
|
}),
|
|
@@ -5280,7 +5286,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5280
5286
|
{
|
|
5281
5287
|
type: "button",
|
|
5282
5288
|
disabled: ht,
|
|
5283
|
-
onClick:
|
|
5289
|
+
onClick: Tt,
|
|
5284
5290
|
className: "rounded px-2 h-9 bg-nvr-cyan text-white text-[11px] font-medium hover:brightness-110 disabled:opacity-50",
|
|
5285
5291
|
children: ht ? "…" : "Add"
|
|
5286
5292
|
}
|
|
@@ -5289,7 +5295,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5289
5295
|
"button",
|
|
5290
5296
|
{
|
|
5291
5297
|
type: "button",
|
|
5292
|
-
onClick:
|
|
5298
|
+
onClick: Jn,
|
|
5293
5299
|
className: "rounded px-1.5 h-9 text-slate-400 hover:text-slate-700 text-[11px]",
|
|
5294
5300
|
children: "✕"
|
|
5295
5301
|
}
|
|
@@ -5298,7 +5304,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5298
5304
|
]
|
|
5299
5305
|
}
|
|
5300
5306
|
),
|
|
5301
|
-
$.length === 0 && M.length === 0 && !
|
|
5307
|
+
$.length === 0 && M.length === 0 && !Tr && /* @__PURE__ */ s("tr", { children: /* @__PURE__ */ s("td", { colSpan: St, className: "px-3 py-14 text-center text-slate-400", children: se ? `No ${se.toLowerCase()} yet` : O ? "No pending rows" : "No rows yet" }) }),
|
|
5302
5308
|
!O && Le !== "original" && (() => {
|
|
5303
5309
|
const e = me.find((u) => u.addendumId === Le), n = (te && (C || K) ? 1 : 0) + (A ? 1 : 0) + (K ? 1 : 0) + Re.length + 1;
|
|
5304
5310
|
if (!e)
|
|
@@ -5313,7 +5319,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5313
5319
|
te && (C || K) && /* @__PURE__ */ s("td", { className: "w-6" }),
|
|
5314
5320
|
A && /* @__PURE__ */ s("td", { className: "w-8 px-2 align-middle text-[11px] text-slate-400 select-none", children: d + 1 }),
|
|
5315
5321
|
K && /* @__PURE__ */ s("td", { className: "w-20" }),
|
|
5316
|
-
Re.map((l) => /* @__PURE__ */ s("td", { className: "px-2 py-1.5 text-[11px] text-slate-700", children: st(l) ?
|
|
5322
|
+
Re.map((l) => /* @__PURE__ */ s("td", { className: "px-2 py-1.5 text-[11px] text-slate-700", children: st(l) ? Sr(l, u) : Ue(
|
|
5317
5323
|
l,
|
|
5318
5324
|
u[l.field],
|
|
5319
5325
|
u.id != null ? String(u.id) : void 0
|
|
@@ -5351,7 +5357,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5351
5357
|
"td",
|
|
5352
5358
|
{
|
|
5353
5359
|
className: "px-2 py-1.5 text-[11px] text-red-700/70 line-through dark:text-red-300/70",
|
|
5354
|
-
children: st(m) ?
|
|
5360
|
+
children: st(m) ? Sr(m, l) : Ue(
|
|
5355
5361
|
m,
|
|
5356
5362
|
l[m.field],
|
|
5357
5363
|
l.id != null ? String(l.id) : void 0
|
|
@@ -5399,7 +5405,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5399
5405
|
"td",
|
|
5400
5406
|
{
|
|
5401
5407
|
className: `px-2 py-1.5 text-[11px] ${g.has(y.field) ? "bg-amber-50 text-amber-900 dark:bg-amber-400/15 dark:text-amber-300" : "text-slate-700 dark:text-slate-300"}`,
|
|
5402
|
-
children: st(y) ?
|
|
5408
|
+
children: st(y) ? Sr(y, l) : Ue(
|
|
5403
5409
|
y,
|
|
5404
5410
|
l[y.field],
|
|
5405
5411
|
l.id != null ? String(l.id) : void 0
|
|
@@ -5414,7 +5420,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5414
5420
|
);
|
|
5415
5421
|
}), ...o];
|
|
5416
5422
|
})(),
|
|
5417
|
-
!O && Le === "original" && $.length > cn && /* @__PURE__ */ s("tr", { ref:
|
|
5423
|
+
!O && Le === "original" && $.length > cn && /* @__PURE__ */ s("tr", { ref: js, children: /* @__PURE__ */ _("td", { colSpan: 99, className: "px-3 py-2 text-center text-[11px] text-slate-400", children: [
|
|
5418
5424
|
"Showing ",
|
|
5419
5425
|
cn,
|
|
5420
5426
|
" of ",
|
|
@@ -5463,14 +5469,14 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5463
5469
|
children: [
|
|
5464
5470
|
q.columns.includes(r.field) && /* @__PURE__ */ s("div", { className: "py-0.5 text-[12px] text-slate-300 dark:text-slate-600", children: "—" }),
|
|
5465
5471
|
/* @__PURE__ */ s(
|
|
5466
|
-
|
|
5472
|
+
Ii,
|
|
5467
5473
|
{
|
|
5468
5474
|
data: q,
|
|
5469
5475
|
row: t,
|
|
5470
5476
|
rowKey: t.key,
|
|
5471
5477
|
column: r.field,
|
|
5472
5478
|
planned: 0,
|
|
5473
|
-
columnLabel:
|
|
5479
|
+
columnLabel: xr(r)
|
|
5474
5480
|
}
|
|
5475
5481
|
)
|
|
5476
5482
|
]
|
|
@@ -5485,8 +5491,8 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5485
5491
|
));
|
|
5486
5492
|
})(),
|
|
5487
5493
|
M.length > 0 && M.map((e, n) => {
|
|
5488
|
-
const t = `pending:${n}`, r = (p == null ? void 0 : p.rowId) === t, i = r && !_e, o = gt === n, c =
|
|
5489
|
-
return /* @__PURE__ */ _(
|
|
5494
|
+
const t = `pending:${n}`, r = (p == null ? void 0 : p.rowId) === t, i = r && !_e, o = gt === n, c = Lt === n && gt !== n, u = !!e.__prefilled;
|
|
5495
|
+
return /* @__PURE__ */ _(qi, { children: [
|
|
5490
5496
|
/* @__PURE__ */ _(
|
|
5491
5497
|
"tr",
|
|
5492
5498
|
{
|
|
@@ -5494,16 +5500,16 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5494
5500
|
"data-o2m-row": `${a}:${t}`,
|
|
5495
5501
|
tabIndex: _e ? -1 : void 0,
|
|
5496
5502
|
draggable: te && !r,
|
|
5497
|
-
onDragStart: () =>
|
|
5498
|
-
onDragOver: (d) =>
|
|
5503
|
+
onDragStart: () => mo(n),
|
|
5504
|
+
onDragOver: (d) => po(d, n),
|
|
5499
5505
|
onDrop: (d) => {
|
|
5500
|
-
d.preventDefault(), gt !== null &&
|
|
5506
|
+
d.preventDefault(), gt !== null && Lt !== null && gt !== Lt && (k == null || k.reorderRows(a, f, gt, Lt)), bn();
|
|
5501
5507
|
},
|
|
5502
5508
|
onDragEnd: bn,
|
|
5503
|
-
onClick: () => !r &&
|
|
5509
|
+
onClick: () => !r && Gs(e, n),
|
|
5504
5510
|
onBlur: (d) => {
|
|
5505
|
-
!r || ht || d.currentTarget.contains(d.relatedTarget) ||
|
|
5506
|
-
En.current ||
|
|
5511
|
+
!r || ht || d.currentTarget.contains(d.relatedTarget) || ur(d.relatedTarget) || (ut.current = setTimeout(() => {
|
|
5512
|
+
En.current || ur(document.activeElement) || Tt();
|
|
5507
5513
|
}, 150));
|
|
5508
5514
|
},
|
|
5509
5515
|
onFocus: () => {
|
|
@@ -5530,7 +5536,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5530
5536
|
"aria-label": `Select line ${$.length + n + 1}`,
|
|
5531
5537
|
className: "accent-nvr-cyan",
|
|
5532
5538
|
checked: Ut.has(t),
|
|
5533
|
-
onChange: () =>
|
|
5539
|
+
onChange: () => Fi(t)
|
|
5534
5540
|
}
|
|
5535
5541
|
)
|
|
5536
5542
|
}
|
|
@@ -5540,18 +5546,18 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5540
5546
|
{
|
|
5541
5547
|
className: "w-6 px-1 align-middle",
|
|
5542
5548
|
onClick: (d) => d.stopPropagation(),
|
|
5543
|
-
children: /* @__PURE__ */ s(
|
|
5549
|
+
children: /* @__PURE__ */ s(_o, { className: "h-3 w-3 text-slate-300 cursor-grab" })
|
|
5544
5550
|
}
|
|
5545
5551
|
),
|
|
5546
5552
|
A && /* @__PURE__ */ s("td", { className: "w-8 px-2 align-middle text-slate-400 text-[11px] select-none", children: /* @__PURE__ */ _("span", { className: "inline-flex items-center gap-1", children: [
|
|
5547
5553
|
$.length + n + 1,
|
|
5548
5554
|
(() => {
|
|
5549
|
-
const d =
|
|
5555
|
+
const d = Mi(
|
|
5550
5556
|
r ? (p == null ? void 0 : p.draft) ?? e : e,
|
|
5551
5557
|
xt
|
|
5552
5558
|
);
|
|
5553
5559
|
return d.length ? /* @__PURE__ */ s(
|
|
5554
|
-
|
|
5560
|
+
Gn,
|
|
5555
5561
|
{
|
|
5556
5562
|
className: "h-2.5 w-2.5 text-amber-500",
|
|
5557
5563
|
"aria-label": "Line needs attention",
|
|
@@ -5562,11 +5568,11 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5562
5568
|
] }) }),
|
|
5563
5569
|
/* @__PURE__ */ _("td", { className: "px-3 py-1 align-middle w-16", children: [
|
|
5564
5570
|
!r && !u && /* @__PURE__ */ s("span", { className: "nvr-pop inline-flex text-[10px] font-medium text-amber-600 bg-amber-50 border border-amber-200 dark:text-amber-400 dark:bg-amber-500/10 dark:border-amber-500/40 rounded px-1.5 py-0.5", children: "Pending" }),
|
|
5565
|
-
!r && u && e.id != null &&
|
|
5571
|
+
!r && u && e.id != null && ja.has(e.id) && /* @__PURE__ */ s("span", { className: "inline-flex text-[10px] font-medium text-blue-600 bg-blue-50 border border-blue-200 rounded px-1.5 py-0.5", children: "Edited" })
|
|
5566
5572
|
] })
|
|
5567
5573
|
] }),
|
|
5568
|
-
r && lt === "panel" ?
|
|
5569
|
-
identity: `${A ? `Line ${$.length + n + 1} · ` : ""}${
|
|
5574
|
+
r && lt === "panel" ? Si({
|
|
5575
|
+
identity: `${A ? `Line ${$.length + n + 1} · ` : ""}${Lr(r ? p.draft : e)}`,
|
|
5570
5576
|
draft: (p == null ? void 0 : p.draft) ?? e,
|
|
5571
5577
|
rowId: t,
|
|
5572
5578
|
saveLabel: "Save",
|
|
@@ -5575,21 +5581,21 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5575
5581
|
},
|
|
5576
5582
|
// Grandchild rows for an unsaved row stage against the
|
|
5577
5583
|
// draft, so there is no row id to pass yet.
|
|
5578
|
-
drawer:
|
|
5584
|
+
drawer: Mr(void 0, (p == null ? void 0 : p.draft) ?? e)
|
|
5579
5585
|
}) : (() => {
|
|
5580
|
-
const d =
|
|
5586
|
+
const d = Vn(
|
|
5581
5587
|
r ? p.draft : e,
|
|
5582
5588
|
{ rowKey: t }
|
|
5583
5589
|
);
|
|
5584
5590
|
return Re.map((l) => {
|
|
5585
5591
|
var R;
|
|
5586
5592
|
if (st(l))
|
|
5587
|
-
return /* @__PURE__ */ s("td", { className: "px-2 py-1 align-top", children: /* @__PURE__ */ s("div", { className: "py-0.5 overflow-hidden text-slate-500", children:
|
|
5593
|
+
return /* @__PURE__ */ s("td", { className: "px-2 py-1 align-top", children: /* @__PURE__ */ s("div", { className: "py-0.5 overflow-hidden text-slate-500", children: Pn(
|
|
5588
5594
|
l,
|
|
5589
5595
|
r ? p.draft : e,
|
|
5590
5596
|
!0
|
|
5591
5597
|
) }) }, l.field);
|
|
5592
|
-
const m = l.computed_type === "write" && !!l.computed_formula, h = An(l.interface), b = `__m2m_${l.field}`, g = h && i ?
|
|
5598
|
+
const m = l.computed_type === "write" && !!l.computed_formula, h = An(l.interface), b = `__m2m_${l.field}`, g = h && i ? ti(l) : null, w = l.interface === "relation-path" && e.id != null ? (R = ft == null ? void 0 : ft[String(e.id)]) == null ? void 0 : R[l.field] : void 0, y = m ? Rt(
|
|
5593
5599
|
l.computed_formula,
|
|
5594
5600
|
r ? p.draft : e
|
|
5595
5601
|
) ?? e[l.field] : r ? p.draft[l.field] ?? w : e[l.field] ?? w, x = Array.isArray(e.__rule_set) ? e.__rule_set.includes(l.field) : !1;
|
|
@@ -5603,7 +5609,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5603
5609
|
"data-tip": x && !r ? `${l.label || qe(l.field)} · set by an auto-fill rule, not the file` : void 0,
|
|
5604
5610
|
children: [
|
|
5605
5611
|
m ? /* @__PURE__ */ s("div", { className: "py-0.5 overflow-hidden text-slate-500 italic", children: Ue(l, y) }) : h && i && g ? /* @__PURE__ */ s("div", { onClick: (I) => I.stopPropagation(), children: /* @__PURE__ */ s(
|
|
5606
|
-
|
|
5612
|
+
Li,
|
|
5607
5613
|
{
|
|
5608
5614
|
collection: g.targetCollection,
|
|
5609
5615
|
value: p.draft[b] ?? null,
|
|
@@ -5620,7 +5626,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5620
5626
|
collection: a,
|
|
5621
5627
|
itemId: "new",
|
|
5622
5628
|
cascadeFilter: it[l.field],
|
|
5623
|
-
pinnedOption:
|
|
5629
|
+
pinnedOption: Kn(l.field, p.draft)
|
|
5624
5630
|
}
|
|
5625
5631
|
) }) : l.interface === "formula-column" ? /* @__PURE__ */ s("div", { className: "py-0.5 overflow-hidden", children: Ue(l, d[l.field], void 0, d) }) : l.computed_type === "rollup" ? /* @__PURE__ */ s("div", { className: "py-0.5 overflow-hidden", children: Ue(
|
|
5626
5632
|
l,
|
|
@@ -5628,17 +5634,17 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5628
5634
|
String(e.id)
|
|
5629
5635
|
) }) : /* @__PURE__ */ s("div", { className: "py-0.5 overflow-hidden", children: Ue(l, y, String(e.id)) }),
|
|
5630
5636
|
q && /* @__PURE__ */ s(
|
|
5631
|
-
|
|
5637
|
+
Ii,
|
|
5632
5638
|
{
|
|
5633
5639
|
data: q,
|
|
5634
|
-
row:
|
|
5640
|
+
row: Ai(
|
|
5635
5641
|
q,
|
|
5636
5642
|
r ? p.draft : e
|
|
5637
5643
|
),
|
|
5638
5644
|
rowKey: (r ? p.draft : e)[q.key_field],
|
|
5639
5645
|
column: l.field,
|
|
5640
5646
|
planned: r ? p.draft[l.field] : e[l.field],
|
|
5641
|
-
columnLabel:
|
|
5647
|
+
columnLabel: xr(l)
|
|
5642
5648
|
}
|
|
5643
5649
|
)
|
|
5644
5650
|
]
|
|
@@ -5658,7 +5664,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5658
5664
|
{
|
|
5659
5665
|
type: "button",
|
|
5660
5666
|
disabled: ht,
|
|
5661
|
-
onClick:
|
|
5667
|
+
onClick: Tt,
|
|
5662
5668
|
className: "rounded px-2 h-9 bg-nvr-cyan text-white text-[11px] font-medium hover:brightness-110 disabled:opacity-50",
|
|
5663
5669
|
children: ht ? "…" : "Save"
|
|
5664
5670
|
}
|
|
@@ -5667,7 +5673,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5667
5673
|
"button",
|
|
5668
5674
|
{
|
|
5669
5675
|
type: "button",
|
|
5670
|
-
onClick:
|
|
5676
|
+
onClick: Jn,
|
|
5671
5677
|
className: "rounded px-1.5 h-9 text-slate-400 hover:text-slate-700 text-[11px]",
|
|
5672
5678
|
children: "✕"
|
|
5673
5679
|
}
|
|
@@ -5684,7 +5690,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5684
5690
|
d.stopPropagation(), kn(e);
|
|
5685
5691
|
},
|
|
5686
5692
|
className: "rounded p-0.5 text-slate-300 hover:text-nvr-cyan",
|
|
5687
|
-
children: /* @__PURE__ */ s(
|
|
5693
|
+
children: /* @__PURE__ */ s(Rr, { className: "h-3 w-3" })
|
|
5688
5694
|
}
|
|
5689
5695
|
),
|
|
5690
5696
|
/* @__PURE__ */ s(
|
|
@@ -5695,7 +5701,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5695
5701
|
d.stopPropagation(), k == null || k.removeRow(a, f, n);
|
|
5696
5702
|
},
|
|
5697
5703
|
className: "rounded p-0.5 text-slate-400 hover:text-red-500",
|
|
5698
|
-
children: /* @__PURE__ */ s(
|
|
5704
|
+
children: /* @__PURE__ */ s(No, { className: "h-3 w-3" })
|
|
5699
5705
|
}
|
|
5700
5706
|
)
|
|
5701
5707
|
] }) })
|
|
@@ -5710,7 +5716,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5710
5716
|
children: /* @__PURE__ */ s("td", { colSpan: St, className: "px-3 py-2", children: /* @__PURE__ */ s("div", { className: "space-y-2", children: G.map((d) => {
|
|
5711
5717
|
const l = typeof d == "string" ? d : d.field, m = typeof d == "string" ? void 0 : d.hint;
|
|
5712
5718
|
return /* @__PURE__ */ s(
|
|
5713
|
-
|
|
5719
|
+
Ti,
|
|
5714
5720
|
{
|
|
5715
5721
|
parentCollection: a,
|
|
5716
5722
|
relationField: l,
|
|
@@ -5739,7 +5745,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5739
5745
|
const n = [
|
|
5740
5746
|
...($ ?? []).filter((t) => !Je.has(String(t.id))).map((t) => {
|
|
5741
5747
|
const r = String(t.id), i = H.has(r) ? { ...t, ...H.get(r) } : t;
|
|
5742
|
-
return
|
|
5748
|
+
return Vn(
|
|
5743
5749
|
ce(i),
|
|
5744
5750
|
{ rowKey: r }
|
|
5745
5751
|
);
|
|
@@ -5747,7 +5753,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5747
5753
|
// Pending rows have no stored rollup values — derive them from
|
|
5748
5754
|
// their staged members so Allocated sums true before save.
|
|
5749
5755
|
...M.map(
|
|
5750
|
-
(t, r) =>
|
|
5756
|
+
(t, r) => Vn(ce(t), {
|
|
5751
5757
|
rowKey: `pending:${r}`
|
|
5752
5758
|
})
|
|
5753
5759
|
)
|
|
@@ -5764,14 +5770,14 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5764
5770
|
} catch {
|
|
5765
5771
|
return {};
|
|
5766
5772
|
}
|
|
5767
|
-
})() : t.options : {}, i = r.aggregate, o =
|
|
5773
|
+
})() : t.options : {}, i = r.aggregate, o = Ol(q, t.field), c = o != null ? /* @__PURE__ */ _(
|
|
5768
5774
|
"div",
|
|
5769
5775
|
{
|
|
5770
5776
|
"data-compare-footer": t.field,
|
|
5771
5777
|
className: "mt-0.5 flex min-w-0 flex-wrap items-baseline gap-x-1 text-[11px] font-normal leading-4 text-slate-500 dark:text-slate-400",
|
|
5772
5778
|
children: [
|
|
5773
5779
|
/* @__PURE__ */ s("span", { className: "font-mono text-[9px] uppercase tracking-wide text-slate-500 dark:text-slate-400", children: q == null ? void 0 : q.label }),
|
|
5774
|
-
/* @__PURE__ */ s("span", { className: "tabular-nums", children:
|
|
5780
|
+
/* @__PURE__ */ s("span", { className: "tabular-nums", children: Oi(o) })
|
|
5775
5781
|
]
|
|
5776
5782
|
}
|
|
5777
5783
|
) : null;
|
|
@@ -5827,7 +5833,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5827
5833
|
]
|
|
5828
5834
|
}
|
|
5829
5835
|
),
|
|
5830
|
-
|
|
5836
|
+
Zi && /* @__PURE__ */ s("div", { className: "border-t border-red-100 bg-red-50 px-3 py-1.5 text-[11px] text-red-600 dark:border-red-900/40 dark:bg-red-950/30 dark:text-red-300", children: Zi }),
|
|
5831
5837
|
$n && /* @__PURE__ */ _(
|
|
5832
5838
|
"div",
|
|
5833
5839
|
{
|
|
@@ -5840,17 +5846,17 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5840
5846
|
{
|
|
5841
5847
|
type: "button",
|
|
5842
5848
|
"data-grid-nested-retry": "",
|
|
5843
|
-
disabled:
|
|
5844
|
-
onClick: () => void
|
|
5849
|
+
disabled: es,
|
|
5850
|
+
onClick: () => void ta(),
|
|
5845
5851
|
className: "font-semibold underline-offset-2 hover:underline disabled:opacity-50",
|
|
5846
|
-
children:
|
|
5852
|
+
children: es ? "Retrying…" : "Retry"
|
|
5847
5853
|
}
|
|
5848
5854
|
),
|
|
5849
5855
|
/* @__PURE__ */ s(
|
|
5850
5856
|
"button",
|
|
5851
5857
|
{
|
|
5852
5858
|
type: "button",
|
|
5853
|
-
onClick: () =>
|
|
5859
|
+
onClick: () => dr(null),
|
|
5854
5860
|
className: "text-red-500/80 hover:text-red-700 dark:text-red-300/80 dark:hover:text-red-200",
|
|
5855
5861
|
children: "Dismiss"
|
|
5856
5862
|
}
|
|
@@ -5858,11 +5864,11 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5858
5864
|
]
|
|
5859
5865
|
}
|
|
5860
5866
|
),
|
|
5861
|
-
Le === "original" && !
|
|
5867
|
+
Le === "original" && !Tr && !j && /* @__PURE__ */ s("div", { className: "border-t border-slate-100 px-3 py-1.5", children: /* @__PURE__ */ s(
|
|
5862
5868
|
"button",
|
|
5863
5869
|
{
|
|
5864
5870
|
type: "button",
|
|
5865
|
-
onClick:
|
|
5871
|
+
onClick: Aa,
|
|
5866
5872
|
className: "text-[11px] font-medium text-nvr-cyan hover:underline",
|
|
5867
5873
|
children: "+ Add row"
|
|
5868
5874
|
}
|
|
@@ -5870,16 +5876,16 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5870
5876
|
]
|
|
5871
5877
|
}
|
|
5872
5878
|
),
|
|
5873
|
-
_e && Ce && Le === "original" && /* @__PURE__ */ s("div", { "data-grid-split-editor-lock": "", children:
|
|
5879
|
+
_e && Ce && Le === "original" && /* @__PURE__ */ s("div", { "data-grid-split-editor-lock": "", children: bo(Ce, "docked") }),
|
|
5874
5880
|
_e && p && Le === "original" && (() => {
|
|
5875
|
-
const e = p.rowId, n = e.startsWith("pending:"), t = n ? parseInt(e.split(":")[1], 10) : -1, r = !n && e !== "new" ? $.findIndex((d) => String(d.id) === e) : -1, i = r >= 0 ? $[r] : void 0, o = e === "new" ? $.length + M.length + 1 : n ? $.length + t + 1 : r + 1, c = A ? `Line ${o} · ` : "", u = e === "new" ? `${c}New line` : `${c}${
|
|
5881
|
+
const e = p.rowId, n = e.startsWith("pending:"), t = n ? parseInt(e.split(":")[1], 10) : -1, r = !n && e !== "new" ? $.findIndex((d) => String(d.id) === e) : -1, i = r >= 0 ? $[r] : void 0, o = e === "new" ? $.length + M.length + 1 : n ? $.length + t + 1 : r + 1, c = A ? `Line ${o} · ` : "", u = e === "new" ? `${c}New line` : `${c}${Lr(p.draft)}`;
|
|
5876
5882
|
return /* @__PURE__ */ _(
|
|
5877
5883
|
"div",
|
|
5878
5884
|
{
|
|
5879
5885
|
"data-o2m-editing": "",
|
|
5880
5886
|
"data-grid-split-editor": "",
|
|
5881
5887
|
className: "flex flex-col rounded-lg border border-nvr-cyan/40 bg-white shadow-[0_6px_24px_-8px_rgba(15,23,42,0.35)] ring-1 ring-nvr-cyan/15 dark:border-nvr-cyan/30 dark:bg-card",
|
|
5882
|
-
style: { height:
|
|
5888
|
+
style: { height: tr },
|
|
5883
5889
|
children: [
|
|
5884
5890
|
/* @__PURE__ */ s(
|
|
5885
5891
|
"button",
|
|
@@ -5889,66 +5895,66 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5889
5895
|
"data-tip": "Drag to resize · ↑/↓ nudge",
|
|
5890
5896
|
className: "flex h-3 w-full shrink-0 cursor-row-resize touch-none select-none items-center justify-center rounded-t-lg border-b border-nvr-cyan/20 text-slate-300 hover:bg-nvr-cyan/10 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-nvr-cyan dark:text-slate-500",
|
|
5891
5897
|
onPointerDown: (d) => {
|
|
5892
|
-
|
|
5898
|
+
nr.current = { startY: d.clientY, startH: tr }, d.currentTarget.setPointerCapture(d.pointerId);
|
|
5893
5899
|
},
|
|
5894
5900
|
onPointerMove: (d) => {
|
|
5895
|
-
const l =
|
|
5896
|
-
l &&
|
|
5901
|
+
const l = nr.current;
|
|
5902
|
+
l && Ui(Math.max(160, Math.min(900, l.startH + (d.clientY - l.startY))));
|
|
5897
5903
|
},
|
|
5898
5904
|
onPointerUp: () => {
|
|
5899
|
-
|
|
5905
|
+
nr.current = null;
|
|
5900
5906
|
},
|
|
5901
5907
|
onPointerCancel: () => {
|
|
5902
|
-
|
|
5908
|
+
nr.current = null;
|
|
5903
5909
|
},
|
|
5904
5910
|
onKeyDown: (d) => {
|
|
5905
|
-
(d.key === "ArrowUp" || d.key === "ArrowDown") && (d.preventDefault(),
|
|
5911
|
+
(d.key === "ArrowUp" || d.key === "ArrowDown") && (d.preventDefault(), Ui(
|
|
5906
5912
|
(l) => Math.max(160, Math.min(900, l + (d.key === "ArrowDown" ? 24 : -24)))
|
|
5907
5913
|
));
|
|
5908
5914
|
},
|
|
5909
|
-
children: /* @__PURE__ */ s(
|
|
5915
|
+
children: /* @__PURE__ */ s(nl, { className: "h-3 w-3", "aria-hidden": "true" })
|
|
5910
5916
|
}
|
|
5911
5917
|
),
|
|
5912
|
-
/* @__PURE__ */ s("div", { className: "min-h-0 flex-1 overflow-y-auto", children:
|
|
5918
|
+
/* @__PURE__ */ s("div", { className: "min-h-0 flex-1 overflow-y-auto", children: go({
|
|
5913
5919
|
identity: u,
|
|
5914
5920
|
draft: p.draft,
|
|
5915
5921
|
rowId: e === "new" ? void 0 : e,
|
|
5916
5922
|
saveLabel: e === "new" ? "Add" : "Save",
|
|
5917
5923
|
bare: !0,
|
|
5918
|
-
onDelete: i ? (d) =>
|
|
5924
|
+
onDelete: i ? (d) => ki(i, d) : n ? (d) => {
|
|
5919
5925
|
d.stopPropagation(), k == null || k.removeRow(a, f, t);
|
|
5920
5926
|
} : void 0,
|
|
5921
5927
|
// Grandchild rows of an unsaved row stage against the draft.
|
|
5922
|
-
drawer:
|
|
5928
|
+
drawer: Mr(i ? e : void 0, p.draft)
|
|
5923
5929
|
}) })
|
|
5924
5930
|
]
|
|
5925
5931
|
}
|
|
5926
5932
|
);
|
|
5927
5933
|
})(),
|
|
5928
5934
|
/* @__PURE__ */ s(
|
|
5929
|
-
|
|
5935
|
+
Al,
|
|
5930
5936
|
{
|
|
5931
|
-
open:
|
|
5932
|
-
onOpenChange:
|
|
5937
|
+
open: Uo,
|
|
5938
|
+
onOpenChange: Qi,
|
|
5933
5939
|
columns: Ne.filter(
|
|
5934
|
-
(e) => !
|
|
5940
|
+
(e) => !Bn(e) && !e.field.includes(".") && !An(e.interface) && !qo.has(e.field)
|
|
5935
5941
|
),
|
|
5936
|
-
rows:
|
|
5942
|
+
rows: Fa.map((e) => e.row),
|
|
5937
5943
|
relations: We,
|
|
5938
5944
|
collection: a,
|
|
5939
5945
|
cascadeFilters: it,
|
|
5940
|
-
onApply:
|
|
5946
|
+
onApply: Ha
|
|
5941
5947
|
}
|
|
5942
5948
|
),
|
|
5943
5949
|
/* @__PURE__ */ s(
|
|
5944
|
-
|
|
5950
|
+
Oo,
|
|
5945
5951
|
{
|
|
5946
5952
|
mode: "timeline",
|
|
5947
|
-
open:
|
|
5948
|
-
onOpenChange:
|
|
5953
|
+
open: Gi,
|
|
5954
|
+
onOpenChange: ar,
|
|
5949
5955
|
rowTitle: `${$.length} ${$.length === 1 ? "line" : "lines"} on this record`,
|
|
5950
|
-
revisions:
|
|
5951
|
-
loading:
|
|
5956
|
+
revisions: Xo,
|
|
5957
|
+
loading: Go,
|
|
5952
5958
|
truncated: !!(Jt != null && Jt.truncated),
|
|
5953
5959
|
fields: ke,
|
|
5954
5960
|
displayCols: Ne,
|
|
@@ -5965,17 +5971,17 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5965
5971
|
), o = i ? String(n[i.field]) : null;
|
|
5966
5972
|
return { title: r, subtitle: o && o.length > 48 ? `${o.slice(0, 48)}…` : o };
|
|
5967
5973
|
},
|
|
5968
|
-
onRestore: (e, n) =>
|
|
5969
|
-
onRestoreAllTo:
|
|
5970
|
-
restoringAll:
|
|
5974
|
+
onRestore: (e, n) => Zs(e, n),
|
|
5975
|
+
onRestoreAllTo: Co,
|
|
5976
|
+
restoringAll: Bo
|
|
5971
5977
|
}
|
|
5972
5978
|
),
|
|
5973
5979
|
/* @__PURE__ */ s(
|
|
5974
|
-
|
|
5980
|
+
Oo,
|
|
5975
5981
|
{
|
|
5976
5982
|
open: !!Ie,
|
|
5977
5983
|
onOpenChange: (e) => {
|
|
5978
|
-
e || (kn(null),
|
|
5984
|
+
e || (kn(null), Fr(null));
|
|
5979
5985
|
},
|
|
5980
5986
|
rowTitle: (() => {
|
|
5981
5987
|
const e = C ? Ie == null ? void 0 : Ie[C] : Ie == null ? void 0 : Ie.line_number;
|
|
@@ -5988,8 +5994,8 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5988
5994
|
);
|
|
5989
5995
|
return e ? String(Ie[e.field]) : null;
|
|
5990
5996
|
})(),
|
|
5991
|
-
revisions:
|
|
5992
|
-
loading:
|
|
5997
|
+
revisions: Ho,
|
|
5998
|
+
loading: Yo,
|
|
5993
5999
|
fields: ke,
|
|
5994
6000
|
displayCols: Ne,
|
|
5995
6001
|
parentField: f,
|
|
@@ -5999,8 +6005,8 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5999
6005
|
m2oDisplays: pn,
|
|
6000
6006
|
client: S,
|
|
6001
6007
|
allowRestore: !!oe && !j,
|
|
6002
|
-
focusRevisionId:
|
|
6003
|
-
onRestore: (e, n) =>
|
|
6008
|
+
focusRevisionId: Vo,
|
|
6009
|
+
onRestore: (e, n) => Zs(e, { ...n, itemId: n.itemId ?? String(Ie.id) })
|
|
6004
6010
|
}
|
|
6005
6011
|
)
|
|
6006
6012
|
]
|
|
@@ -6008,13 +6014,13 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
6008
6014
|
)
|
|
6009
6015
|
);
|
|
6010
6016
|
}
|
|
6011
|
-
const
|
|
6017
|
+
const jo = {
|
|
6012
6018
|
even: "Evenly",
|
|
6013
6019
|
front: "Front-loaded",
|
|
6014
6020
|
back: "Back-loaded",
|
|
6015
6021
|
shape: "Like previous"
|
|
6016
6022
|
};
|
|
6017
|
-
function
|
|
6023
|
+
function Do(a) {
|
|
6018
6024
|
return a.presets.length < 2 ? null : /* @__PURE__ */ s("span", { className: "inline-flex items-center gap-0.5", "data-o2m-spread-presets": !0, children: a.presets.map((f) => /* @__PURE__ */ s(
|
|
6019
6025
|
"button",
|
|
6020
6026
|
{
|
|
@@ -6026,12 +6032,12 @@ function Po(a) {
|
|
|
6026
6032
|
"rounded-full border px-2 py-px text-[10.5px]",
|
|
6027
6033
|
a.value === f ? "border-nvr-cyan bg-nvr-cyan/10 font-semibold text-slate-800 dark:text-slate-100" : "border-slate-200 text-slate-500 hover:bg-muted dark:border-border dark:text-slate-400"
|
|
6028
6034
|
),
|
|
6029
|
-
children: f === "shape" ? a.shapeLabel ??
|
|
6035
|
+
children: f === "shape" ? a.shapeLabel ?? jo.shape : jo[f]
|
|
6030
6036
|
},
|
|
6031
6037
|
f
|
|
6032
6038
|
)) });
|
|
6033
6039
|
}
|
|
6034
|
-
function
|
|
6040
|
+
function nd({
|
|
6035
6041
|
config: a,
|
|
6036
6042
|
draft: f,
|
|
6037
6043
|
remaining: v,
|
|
@@ -6051,7 +6057,7 @@ function td({
|
|
|
6051
6057
|
type: "button",
|
|
6052
6058
|
onClick: () => {
|
|
6053
6059
|
if (Ee) return;
|
|
6054
|
-
const ie = W ? A.map((X) => W.values[X] ?? 0) : void 0, Oe =
|
|
6060
|
+
const ie = W ? A.map((X) => W.values[X] ?? 0) : void 0, Oe = Po(pe, A.length, Z, ie), he = {};
|
|
6055
6061
|
A.forEach((X, de) => {
|
|
6056
6062
|
he[X] = Oe[de];
|
|
6057
6063
|
}), E(he);
|
|
@@ -6066,7 +6072,7 @@ function td({
|
|
|
6066
6072
|
}
|
|
6067
6073
|
),
|
|
6068
6074
|
!Ee && /* @__PURE__ */ s(
|
|
6069
|
-
|
|
6075
|
+
Do,
|
|
6070
6076
|
{
|
|
6071
6077
|
presets: te,
|
|
6072
6078
|
value: Z,
|
|
@@ -6091,7 +6097,7 @@ function td({
|
|
|
6091
6097
|
Ee && /* @__PURE__ */ s("span", { className: "text-[11px] text-slate-400 dark:text-slate-500", children: Ee })
|
|
6092
6098
|
] });
|
|
6093
6099
|
}
|
|
6094
|
-
function
|
|
6100
|
+
function rd(a) {
|
|
6095
6101
|
const [f, v] = U(!1), [E, z] = U("even"), W = a.remaining == null || !Number.isFinite(a.remaining) ? 0 : Math.round(a.remaining * 100) / 100, ne = (J) => a.config.format === "number" ? J.toLocaleString(void 0, { maximumFractionDigits: 2 }) : J.toLocaleString(void 0, { style: "currency", currency: "USD" });
|
|
6096
6102
|
if (W <= 0) return null;
|
|
6097
6103
|
const oe = (a.config.presets ?? ["even", "front", "back"]).filter(
|
|
@@ -6130,7 +6136,7 @@ function nd(a) {
|
|
|
6130
6136
|
" first."
|
|
6131
6137
|
] }),
|
|
6132
6138
|
/* @__PURE__ */ s("div", { className: "mt-2", children: /* @__PURE__ */ s(
|
|
6133
|
-
|
|
6139
|
+
Do,
|
|
6134
6140
|
{
|
|
6135
6141
|
presets: oe,
|
|
6136
6142
|
value: oe.includes(E) ? E : oe[0],
|
|
@@ -6165,15 +6171,15 @@ function nd(a) {
|
|
|
6165
6171
|
)
|
|
6166
6172
|
] });
|
|
6167
6173
|
}
|
|
6168
|
-
function
|
|
6174
|
+
function To(a) {
|
|
6169
6175
|
var v, E;
|
|
6170
6176
|
const f = a;
|
|
6171
6177
|
return ((v = f == null ? void 0 : f.response) == null ? void 0 : v.error) ?? ((E = f == null ? void 0 : f.response) == null ? void 0 : E.message) ?? (f == null ? void 0 : f.message) ?? "the server refused it";
|
|
6172
6178
|
}
|
|
6173
6179
|
export {
|
|
6174
|
-
|
|
6175
|
-
|
|
6180
|
+
Dd as InlineTableField,
|
|
6181
|
+
td as applyValueColumns,
|
|
6176
6182
|
Rt as evalClientFormula,
|
|
6177
|
-
|
|
6178
|
-
|
|
6183
|
+
Mi as failingLints,
|
|
6184
|
+
Po as spreadAmounts
|
|
6179
6185
|
};
|