@nivaro/react 0.3.57 → 0.3.58
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/index.d.ts +5 -1
- package/dist/shared/components/CollectionBrowserView.js +2633 -2590
- package/dist/shared/components/DataTable.js +247 -236
- package/dist/shared/components/ItemEditForm.js +1693 -1668
- package/dist/shared/components/ProfileView.js +716 -715
- package/dist/shared/components/RecordReadView.js +367 -364
- package/dist/shared/components/ReportView.js +64 -39
- package/dist/shared/components/alerts/AlertManagerView.js +284 -271
- package/dist/shared/components/cbv/row-focus.js +19 -0
- package/dist/shared/components/help-videos/HelpVideoPlayer.js +152 -147
- package/dist/shared/components/integrations/console/SignalCard.js +59 -59
- package/dist/shared/components/integrations/console/tone.js +52 -30
- package/dist/shared/components/item-edit/CatalogPickerField.js +525 -505
- package/dist/shared/components/item-edit/FieldRow.js +175 -173
- package/dist/shared/components/item-edit/InlineTableField.js +407 -402
- package/dist/shared/components/item-edit/M2MCombobox.js +313 -291
- package/dist/shared/components/item-edit/MidairCollisionDialog.js +1 -1
- package/dist/shared/components/item-edit/PlanGrid.js +826 -803
- package/dist/shared/components/item-edit/QuickCreateButton.js +115 -79
- package/dist/shared/components/item-edit/RecordLiveSync.js +77 -75
- package/dist/shared/components/item-edit/RelationCombobox.js +412 -328
- package/dist/shared/components/item-edit/RelationGroupedCombobox.js +147 -125
- package/dist/shared/components/item-edit/SummaryPanel.js +406 -392
- package/dist/shared/components/item-edit/option-disambiguate.js +44 -32
- package/dist/shared/components/item-edit/related-missing.js +45 -0
- package/dist/shared/components/item-edit/save-outcome.js +5 -5
- package/dist/shared/components/notifications/NotificationRulesEditor.js +130 -123
- package/dist/shared/components/panels/AccessDeniedPanel.js +52 -48
- package/dist/shared/components/panels/ItemLockBanner.js +2 -3
- package/dist/shared/components/panels/PipelinePanel.js +1027 -978
- package/dist/shared/components/panels/RevisionsPanel.js +4 -1
- package/dist/shared/components/panels/TaskPanel.js +265 -249
- package/dist/shared/components/panels/landing-state.js +27 -0
- package/dist/shared/components/pipeline/PipelineEditorView.js +86 -78
- package/dist/shared/components/profile/AiMemoryCard.js +12 -10
- package/dist/shared/components/queue/OwnerAvatars.js +80 -41
- package/dist/shared/components/queue/QueueQuickFilters.js +48 -48
- package/dist/shared/components/queue/QueueWorklist.js +357 -358
- package/dist/shared/components/queue/group-sums.js +27 -0
- package/dist/shared/components/widgets/ReviewListWidget.js +186 -168
- package/dist/shared/lib/back-closes.js +25 -0
- package/dist/shared/lib/form-usage-beacon.js +7 -7
- package/dist/shared/lib/list-page-memory.js +41 -0
- package/dist/shared/lib/live.js +44 -44
- package/dist/shared/lib/own-writes.js +76 -28
- package/dist/shared/lib/request-gate.js +110 -109
- package/dist/shared/lib/validation-rules.js +34 -19
- package/package.json +1 -1
|
@@ -1,41 +1,42 @@
|
|
|
1
1
|
import { jsx as a, jsxs as _, Fragment as An } from "react/jsx-runtime";
|
|
2
2
|
import { useQueryClient as Go, useQuery as Fe, useQueries as an } from "@tanstack/react-query";
|
|
3
|
-
import { Loader2 as Ln, ListChecks as
|
|
3
|
+
import { Loader2 as Ln, ListChecks as hl, SquarePen as gl, Rows3 as bl, PanelBottomOpen as yl, Zap as vl, Clock as Pi, History as zr, AlertTriangle as ar, ChevronRight as Co, GripVertical as Mo, FileUp as Ko, GripHorizontal as xl, X as wl, Lock as _l } from "lucide-react";
|
|
4
4
|
import { useState as Q, useMemo as M, useEffect as ke, useRef as fe, useCallback as jt, Fragment as Di } from "react";
|
|
5
5
|
import { createPortal as kl } from "react-dom";
|
|
6
6
|
import { ChangeReasonDialog as Nl, changeReasonChallenge as Wi } from "./ChangeReasonDialog.js";
|
|
7
7
|
import { toast as me } from "sonner";
|
|
8
8
|
import { useNivaroClient as Yr, useDrilldown as Sl, useParentDraft as $l, useReimportHandler as ql, useItemEditAuth as El, fieldDrilldownConfig as Po } from "../../context.js";
|
|
9
9
|
import { get as oe, post as je, patch as Fr, del as Xo } from "../../lib/commands.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { isOwnWrite as Ol } from "../../lib/own-writes.js";
|
|
11
|
+
import { useAfterIdle as Il } from "../../lib/defer.js";
|
|
12
|
+
import { evaluateNumeric as ht, evaluateBoolean as Al } from "../../lib/expression.js";
|
|
12
13
|
import { numericIntlOptions as xt } from "../../lib/format-value.js";
|
|
13
|
-
import { useOptionalRealtime as
|
|
14
|
-
import { useRecordReader as
|
|
15
|
-
import { midairCollisionOf as
|
|
16
|
-
import { restoreSkippedNote as
|
|
14
|
+
import { useOptionalRealtime as jl } from "../../lib/realtime.js";
|
|
15
|
+
import { useRecordReader as Ll } from "../../lib/record-loader.js";
|
|
16
|
+
import { midairCollisionOf as Tl } from "../../lib/record-outbox.js";
|
|
17
|
+
import { restoreSkippedNote as Rl } from "../../lib/restore-skipped.js";
|
|
17
18
|
import { userErrorMessage as jn } from "../../lib/safe-error.js";
|
|
18
|
-
import { titleCase as Se, cn as ve, formatRelative as Do, toLocalDateString as
|
|
19
|
-
import { formulaInputsChanged as
|
|
20
|
-
import { ImportFromFileButton as
|
|
19
|
+
import { titleCase as Se, cn as ve, formatRelative as Do, toLocalDateString as Ml } from "../../lib/utils.js";
|
|
20
|
+
import { formulaInputsChanged as Kl } from "../../lib/write-formula.js";
|
|
21
|
+
import { ImportFromFileButton as Pl } from "../import/ImportFromFileButton.js";
|
|
21
22
|
import { OWN_RECORD_WRITES_EVENT as Wo } from "../panels/RecordIntegrityBanner.js";
|
|
22
|
-
import { Sheet as
|
|
23
|
-
import { useAddendumO2M as
|
|
24
|
-
import { resolveCompareEndpoint as
|
|
23
|
+
import { Sheet as Dl, SheetContent as Wl, SheetHeader as Ul, SheetTitle as Jl } from "../ui/sheet.js";
|
|
24
|
+
import { useAddendumO2M as Ql, useAddendumView as zl } from "./AddendumFieldContext.js";
|
|
25
|
+
import { resolveCompareEndpoint as Vl, useCompareSeries as Bl, compareColumnClosed as Jt, fmtMoney as Ui, CompareProposalBanner as Fl, CompareStripChips as Hl, GridStatChip as Yl, CompareCell as Ji, compareRowFor as Qi, compareColumnSum as Gl, ReconcileAction as Cl } from "./CompareSeries.js";
|
|
25
26
|
import { FieldRenderer as In } from "./FieldRenderer.js";
|
|
26
|
-
import { GridBulkEditDialog as
|
|
27
|
+
import { GridBulkEditDialog as Xl } from "./GridBulkEditDialog.js";
|
|
27
28
|
import { parseJson as zi, SENTINEL_FIELDS as Ci, applyDisplayTemplate as sr, EMPTY_NESTED_OPS as Vr, SYSTEM_FIELDS as Uo } from "./helpers.js";
|
|
28
|
-
import { rowBaseBookFor as
|
|
29
|
-
import { NUMBER_FIELD_TYPES as
|
|
30
|
-
import { LineCollisionDialog as
|
|
29
|
+
import { rowBaseBookFor as Zl, writeLineGuarded as ed, lineLabelOf as Vi, lineConflictKey as td, resolveLineCollision as nd, incrementGuarded as rd } from "./line-midair.js";
|
|
30
|
+
import { NUMBER_FIELD_TYPES as id, checkNumberEntry as sd, changedRowFields as Jo, lineRuleErrors as od, computedColumnErrors as ad, zeroQtyColumn as Qo, dropRevertedFields as ld, isRealLineEdit as dd } from "./line-qty.js";
|
|
31
|
+
import { LineCollisionDialog as cd } from "./MidairCollisionDialog.js";
|
|
31
32
|
import { NestedRelationEditor as Bi } from "./NestedRelationEditor.js";
|
|
32
|
-
import { useO2MStaging as
|
|
33
|
+
import { useO2MStaging as ud, useLiveRows as fd, useStagedRelations as md } from "./O2MStagingContext.js";
|
|
33
34
|
import { RelationCombobox as Fi } from "./RelationCombobox.js";
|
|
34
|
-
import { useRowCommentCounts as
|
|
35
|
+
import { useRowCommentCounts as pd, RowCommentButton as hd } from "./RowComments.js";
|
|
35
36
|
import { RowHistorySheet as zo, parseImportStamp as gd } from "./RowHistorySheet.js";
|
|
36
|
-
import { useRowMatches as
|
|
37
|
-
import { RowWatchButton as
|
|
38
|
-
import { RuleProvenanceChip as
|
|
37
|
+
import { useRowMatches as bd, RowMatchDot as Vo, rowFromCandidate as yd, RowMatchPanel as vd } from "./RowMatchPanel.js";
|
|
38
|
+
import { RowWatchButton as xd } from "./RowWatchButton.js";
|
|
39
|
+
import { RuleProvenanceChip as wd } from "./RuleProvenancePopover.js";
|
|
39
40
|
import { resolveOptionFilterTokens as Zo } from "../../lib/option-filter-tokens.js";
|
|
40
41
|
function Bo(s, f) {
|
|
41
42
|
const y = s[f.field], O = y == null || y === "", W = f.op ?? "eq";
|
|
@@ -56,14 +57,14 @@ function Hi(s, f) {
|
|
|
56
57
|
!((O = J == null ? void 0 : J.when) != null && O.field) || !((W = J == null ? void 0 : J.expect) != null && W.field) || Bo(s, J.when) && (Bo(s, J.expect) || y.push(J.label || `${J.when.field} vs ${J.expect.field}`));
|
|
57
58
|
return y;
|
|
58
59
|
}
|
|
59
|
-
const
|
|
60
|
+
const _d = {
|
|
60
61
|
lt: "<",
|
|
61
62
|
gt: ">",
|
|
62
63
|
quot: '"',
|
|
63
64
|
amp: "&",
|
|
64
65
|
"#39": "'"
|
|
65
66
|
};
|
|
66
|
-
function
|
|
67
|
+
function kd(s, f) {
|
|
67
68
|
const y = [];
|
|
68
69
|
return { rows: s.map((W) => {
|
|
69
70
|
const J = [], X = { ...W };
|
|
@@ -102,7 +103,7 @@ function Fo({
|
|
|
102
103
|
}
|
|
103
104
|
);
|
|
104
105
|
}
|
|
105
|
-
function
|
|
106
|
+
function Nd({ children: s }) {
|
|
106
107
|
const [f, y] = Q(null);
|
|
107
108
|
return /* @__PURE__ */ _(
|
|
108
109
|
"span",
|
|
@@ -132,11 +133,11 @@ function kd({ children: s }) {
|
|
|
132
133
|
}
|
|
133
134
|
);
|
|
134
135
|
}
|
|
135
|
-
function
|
|
136
|
+
function Sd(s) {
|
|
136
137
|
if (typeof s != "string" || !s.trim()) return [];
|
|
137
138
|
const f = s.replace(
|
|
138
139
|
/&(lt|gt|quot|amp|#39);/g,
|
|
139
|
-
(J, X) =>
|
|
140
|
+
(J, X) => _d[X] ?? ""
|
|
140
141
|
), y = [], O = /"detail"\s*:\s*"((?:[^"\\]|\\.)*)"/g;
|
|
141
142
|
let W = O.exec(f);
|
|
142
143
|
for (; W; ) {
|
|
@@ -178,12 +179,12 @@ function ea(s, f, y, O) {
|
|
|
178
179
|
return X;
|
|
179
180
|
}
|
|
180
181
|
const Yi = 1e3;
|
|
181
|
-
function
|
|
182
|
+
function $d(s) {
|
|
182
183
|
let f = 0;
|
|
183
184
|
for (let y = 0; y < s.length; y++) f = f * 31 + s.charCodeAt(y) | 0;
|
|
184
185
|
return f;
|
|
185
186
|
}
|
|
186
|
-
function
|
|
187
|
+
function qd(s) {
|
|
187
188
|
if (s.line_number != null && s.line_number !== "") return `line ${s.line_number}`;
|
|
188
189
|
for (const f of ["year", "name", "title", "label", "number"]) {
|
|
189
190
|
const y = s[f];
|
|
@@ -192,7 +193,7 @@ function $d(s) {
|
|
|
192
193
|
return null;
|
|
193
194
|
}
|
|
194
195
|
function Qt(s, f) {
|
|
195
|
-
return
|
|
196
|
+
return ht(s, f);
|
|
196
197
|
}
|
|
197
198
|
function Gi(s, f) {
|
|
198
199
|
return f.map((y) => {
|
|
@@ -234,10 +235,10 @@ function Br(s, f) {
|
|
|
234
235
|
s
|
|
235
236
|
);
|
|
236
237
|
}
|
|
237
|
-
function
|
|
238
|
+
function Ed(s, f, y) {
|
|
238
239
|
return f === "presence" ? s != null && String(s).trim() !== "" ? "Yes" : "No" : s == null || s === "" ? "—" : f === "currency" && Number.isFinite(Number(s)) ? Number(s).toLocaleString("en-US", xt(y, "currency")) : String(s);
|
|
239
240
|
}
|
|
240
|
-
function
|
|
241
|
+
function Od({
|
|
241
242
|
config: s,
|
|
242
243
|
relatedCollection: f,
|
|
243
244
|
manyField: y,
|
|
@@ -296,7 +297,7 @@ function Ed({
|
|
|
296
297
|
).then((U) => U.data ?? []),
|
|
297
298
|
enabled: We,
|
|
298
299
|
staleTime: 0
|
|
299
|
-
}),
|
|
300
|
+
}), gt = M(() => {
|
|
300
301
|
const U = /* @__PURE__ */ new Map();
|
|
301
302
|
for (const q of W) {
|
|
302
303
|
const B = q[s.target_field];
|
|
@@ -305,30 +306,30 @@ function Ed({
|
|
|
305
306
|
return U;
|
|
306
307
|
}, [W, s.target_field]);
|
|
307
308
|
function Te(U) {
|
|
308
|
-
const q =
|
|
309
|
-
(
|
|
309
|
+
const q = gt.get(U), B = (q == null ? void 0 : q.id) != null ? String(q.id) : null, G = !!(B && (te != null && te.has(B))), $ = (Ie ?? []).findIndex(
|
|
310
|
+
(ge) => String(ge[s.target_field]) === U
|
|
310
311
|
);
|
|
311
|
-
let
|
|
312
|
-
if ($ >= 0)
|
|
312
|
+
let he = 0;
|
|
313
|
+
if ($ >= 0) he = Number((Ie ?? [])[$][s.value_field]) || 0;
|
|
313
314
|
else if (q && !G) {
|
|
314
|
-
const
|
|
315
|
-
|
|
316
|
-
|
|
315
|
+
const ge = B ? K == null ? void 0 : K.get(B) : void 0;
|
|
316
|
+
he = Number(
|
|
317
|
+
ge && s.value_field in ge ? ge[s.value_field] : q[s.value_field]
|
|
317
318
|
) || 0;
|
|
318
319
|
}
|
|
319
|
-
return { savedRow: q, pendingIdx: $, amount:
|
|
320
|
+
return { savedRow: q, pendingIdx: $, amount: he, deleted: G };
|
|
320
321
|
}
|
|
321
322
|
async function Ke(U, q, B) {
|
|
322
323
|
let G = q.trim() === "" ? null : Number(q);
|
|
323
324
|
if (G !== null && !Number.isFinite(G)) return;
|
|
324
325
|
if (G !== null && B) {
|
|
325
|
-
const
|
|
326
|
-
|
|
326
|
+
const he = bt(B);
|
|
327
|
+
he !== null && G > he && (G = Math.max(0, Math.round(he * 100) / 100), pe((ge) => ({ ...ge, [U]: String(G) })));
|
|
327
328
|
}
|
|
328
329
|
if (re && R) {
|
|
329
|
-
const { savedRow:
|
|
330
|
-
G === null || G === 0 ?
|
|
331
|
-
...(Ie ?? [])[
|
|
330
|
+
const { savedRow: he, pendingIdx: ge, deleted: V } = Te(U), w = (he == null ? void 0 : he.id) != null ? String(he.id) : null;
|
|
331
|
+
G === null || G === 0 ? ge >= 0 ? R.removeRow(f, y, ge) : w && !V && (R.cancelPendingEdit(f, y, w), R.queueDelete(f, y, w)) : ge >= 0 ? R.updateRow(f, y, ge, {
|
|
332
|
+
...(Ie ?? [])[ge],
|
|
332
333
|
[s.value_field]: G
|
|
333
334
|
}) : w ? (V && R.cancelPendingDelete(f, y, w), R.queueEdit(f, y, w, {
|
|
334
335
|
[s.value_field]: G,
|
|
@@ -340,15 +341,15 @@ function Ed({
|
|
|
340
341
|
});
|
|
341
342
|
return;
|
|
342
343
|
}
|
|
343
|
-
const $ =
|
|
344
|
+
const $ = gt.get(U);
|
|
344
345
|
be(U);
|
|
345
346
|
try {
|
|
346
347
|
if (G === null || G === 0)
|
|
347
348
|
($ == null ? void 0 : $.id) != null && await $e.request(Xo(`/items/${f}/${$.id}`));
|
|
348
349
|
else if (($ == null ? void 0 : $.id) != null) {
|
|
349
350
|
if (Number($[s.value_field]) !== G) {
|
|
350
|
-
const
|
|
351
|
-
Ne ? await Ne(String($.id),
|
|
351
|
+
const he = { [s.value_field]: G };
|
|
352
|
+
Ne ? await Ne(String($.id), he) : await $e.request(Fr(`/items/${f}/${$.id}`, he));
|
|
352
353
|
}
|
|
353
354
|
} else
|
|
354
355
|
await $e.request(
|
|
@@ -366,10 +367,10 @@ function Ed({
|
|
|
366
367
|
}
|
|
367
368
|
}
|
|
368
369
|
function Ue(U, q, B) {
|
|
369
|
-
return
|
|
370
|
+
return ht(U, (G) => G in B ? B[G] : Br(q, G));
|
|
370
371
|
}
|
|
371
372
|
function xe(U) {
|
|
372
|
-
const q =
|
|
373
|
+
const q = gt.get(U), B = Number((q == null ? void 0 : q[s.value_field]) ?? 0) || 0, G = H[U], $ = re ? Te(U).amount : B;
|
|
373
374
|
return { __input__: G !== void 0 && G !== "" ? Number(G) || 0 : $, __saved__: B };
|
|
374
375
|
}
|
|
375
376
|
function zt(U, q) {
|
|
@@ -378,7 +379,7 @@ function Ed({
|
|
|
378
379
|
}
|
|
379
380
|
function bt(U) {
|
|
380
381
|
if (!s.value_max) return null;
|
|
381
|
-
const q =
|
|
382
|
+
const q = gt.get(String(U.id)), B = Number((q == null ? void 0 : q[s.value_field]) ?? 0) || 0;
|
|
382
383
|
return Ue(s.value_max, U, { __input__: B, __saved__: B });
|
|
383
384
|
}
|
|
384
385
|
return /* @__PURE__ */ _(An, { children: [
|
|
@@ -391,8 +392,8 @@ function Ed({
|
|
|
391
392
|
children: "Allocate…"
|
|
392
393
|
}
|
|
393
394
|
),
|
|
394
|
-
/* @__PURE__ */ a(
|
|
395
|
-
/* @__PURE__ */ a(
|
|
395
|
+
/* @__PURE__ */ a(Dl, { open: We, onOpenChange: ae, children: /* @__PURE__ */ _(Wl, { side: "right", className: "w-[92vw] sm:max-w-[1200px] overflow-y-auto p-0", children: [
|
|
396
|
+
/* @__PURE__ */ a(Ul, { className: "border-b border-slate-200 px-5 py-3", children: /* @__PURE__ */ a(Jl, { className: "text-[14px]", children: s.title ?? "Allocate" }) }),
|
|
396
397
|
/* @__PURE__ */ _("div", { className: "p-4", children: [
|
|
397
398
|
/* @__PURE__ */ a("p", { className: "mb-2 text-[11px] text-slate-400", children: "Enter an amount to allocate a line — clearing it removes the allocation." }),
|
|
398
399
|
at ? /* @__PURE__ */ a("div", { className: "py-10 text-center", children: /* @__PURE__ */ a(Ln, { className: "inline h-4 w-4 animate-spin text-slate-400" }) }) : ie.length === 0 ? /* @__PURE__ */ a("p", { className: "py-10 text-center text-[12px] text-slate-400", children: "No eligible rows for the current record's filters." }) : /* @__PURE__ */ a("div", { className: "overflow-x-auto rounded-lg border border-slate-200", children: /* @__PURE__ */ _("table", { className: "w-full text-left text-[12px]", children: [
|
|
@@ -418,12 +419,12 @@ function Ed({
|
|
|
418
419
|
), $ = (V) => Le((w) => {
|
|
419
420
|
const Je = new Set(w ?? G);
|
|
420
421
|
return Je.has(V) ? Je.delete(V) : Je.add(V), Je;
|
|
421
|
-
}),
|
|
422
|
-
let
|
|
422
|
+
}), he = [];
|
|
423
|
+
let ge = null;
|
|
423
424
|
for (const V of q) {
|
|
424
425
|
const w = String(V.id), Je = U(V);
|
|
425
|
-
if (s.group_by && Je !==
|
|
426
|
-
|
|
426
|
+
if (s.group_by && Je !== ge) {
|
|
427
|
+
ge = Je;
|
|
427
428
|
const N = ie.filter((et) => U(et) === Je), kt = N.filter(
|
|
428
429
|
(et) => Te(String(et.id)).amount > 0
|
|
429
430
|
).length, Ze = qe.map(
|
|
@@ -443,7 +444,7 @@ function Ed({
|
|
|
443
444
|
(et, de) => et + xe(String(de.id)).__input__,
|
|
444
445
|
0
|
|
445
446
|
);
|
|
446
|
-
|
|
447
|
+
he.push(
|
|
447
448
|
/* @__PURE__ */ _(
|
|
448
449
|
"tr",
|
|
449
450
|
{
|
|
@@ -498,10 +499,10 @@ function Ed({
|
|
|
498
499
|
}
|
|
499
500
|
if (s.group_by && !G.has(Je)) continue;
|
|
500
501
|
const Lt = Te(w), _t = Lt.amount > 0 ? Lt.savedRow ?? {} : void 0, A = H[w] ?? (Lt.amount > 0 ? String(Lt.amount) : "");
|
|
501
|
-
|
|
502
|
+
he.push(
|
|
502
503
|
/* @__PURE__ */ _("tr", { className: ve(_t && "bg-nvr-cyan/5"), children: [
|
|
503
504
|
qe.map((N, kt) => {
|
|
504
|
-
const Ze = N.formula ? zt(N.formula, V) :
|
|
505
|
+
const Ze = N.formula ? zt(N.formula, V) : Ed(Br(V, N.path ?? ""), N.format);
|
|
505
506
|
return /* @__PURE__ */ a(
|
|
506
507
|
"td",
|
|
507
508
|
{
|
|
@@ -546,14 +547,14 @@ function Ed({
|
|
|
546
547
|
] }, w)
|
|
547
548
|
);
|
|
548
549
|
}
|
|
549
|
-
return
|
|
550
|
+
return he;
|
|
550
551
|
})() })
|
|
551
552
|
] }) })
|
|
552
553
|
] })
|
|
553
554
|
] }) })
|
|
554
555
|
] });
|
|
555
556
|
}
|
|
556
|
-
function
|
|
557
|
+
function Id({
|
|
557
558
|
config: s,
|
|
558
559
|
rows: f,
|
|
559
560
|
relatedCollection: y,
|
|
@@ -605,7 +606,7 @@ function Od({
|
|
|
605
606
|
let Ve = 0, be = 0;
|
|
606
607
|
for (const H of f) {
|
|
607
608
|
const pe = { ...H, __agg__: ae(H.id) };
|
|
608
|
-
if (s.guard && !
|
|
609
|
+
if (s.guard && !Al(s.guard, pe)) {
|
|
609
610
|
be++;
|
|
610
611
|
continue;
|
|
611
612
|
}
|
|
@@ -663,7 +664,7 @@ function Od({
|
|
|
663
664
|
}
|
|
664
665
|
);
|
|
665
666
|
}
|
|
666
|
-
function
|
|
667
|
+
function Ad({
|
|
667
668
|
config: s,
|
|
668
669
|
matchCfg: f,
|
|
669
670
|
rows: y,
|
|
@@ -679,7 +680,7 @@ function Id({
|
|
|
679
680
|
...s.candidates.capacity_formula.matchAll(/\{\{\s*(\w+)\s*\}\}/g)
|
|
680
681
|
].map((Le) => Le[1]), ae = {};
|
|
681
682
|
let Ve = 0, be = 0, H = 0;
|
|
682
|
-
const pe = [], He = (Le, qe) =>
|
|
683
|
+
const pe = [], He = (Le, qe) => rd(ne, f.collection, Le, Z, qe);
|
|
683
684
|
try {
|
|
684
685
|
for (let qe = 0; qe < y.length; qe++) {
|
|
685
686
|
const Xe = y[qe], wt = Number(Xe[s.row_qty_field]);
|
|
@@ -692,8 +693,8 @@ function Id({
|
|
|
692
693
|
fields: `id,${Ne},${Z}`,
|
|
693
694
|
limit: 500
|
|
694
695
|
})
|
|
695
|
-
).then((q) => q.data ?? []),
|
|
696
|
-
let Te = wt -
|
|
696
|
+
).then((q) => q.data ?? []), gt = at.reduce((q, B) => q + (Number(B[Z]) || 0), 0);
|
|
697
|
+
let Te = wt - gt;
|
|
697
698
|
if (Te <= 0) continue;
|
|
698
699
|
const Ke = Hr(
|
|
699
700
|
{
|
|
@@ -734,17 +735,17 @@ function Id({
|
|
|
734
735
|
if (Te <= 0) break;
|
|
735
736
|
const B = String(q.id), $ = (Qt(s.candidates.capacity_formula, q) ?? 0) - (bt[B] ?? 0) - (ae[B] ?? 0);
|
|
736
737
|
if ($ < $e) continue;
|
|
737
|
-
const
|
|
738
|
-
if (
|
|
739
|
-
if (!await He(String(
|
|
738
|
+
const he = Math.min(Te, $), ge = at.find((V) => String(V[Ne]) === B);
|
|
739
|
+
if (ge) {
|
|
740
|
+
if (!await He(String(ge.id), he)) {
|
|
740
741
|
H++;
|
|
741
742
|
continue;
|
|
742
743
|
}
|
|
743
744
|
} else
|
|
744
745
|
await ne.request(
|
|
745
|
-
je(`/items/${f.collection}`, { ...ie.seed, [Ne]: q.id, [Z]:
|
|
746
|
+
je(`/items/${f.collection}`, { ...ie.seed, [Ne]: q.id, [Z]: he })
|
|
746
747
|
);
|
|
747
|
-
ae[B] = (ae[B] ?? 0) +
|
|
748
|
+
ae[B] = (ae[B] ?? 0) + he, Te -= he, Ve += he;
|
|
748
749
|
}
|
|
749
750
|
Te < U && be++, Te > 0 && pe.push(qe + 1);
|
|
750
751
|
}
|
|
@@ -774,12 +775,12 @@ function Id({
|
|
|
774
775
|
Ie && /* @__PURE__ */ a("span", { className: "text-[11px] text-slate-500", children: Ie })
|
|
775
776
|
] });
|
|
776
777
|
}
|
|
777
|
-
function
|
|
778
|
+
function jd(s) {
|
|
778
779
|
return s.filter(
|
|
779
780
|
(f) => f.group_key === "__apply_values__" && !Xi.has(f.type ?? "") && !Ci.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"
|
|
780
781
|
);
|
|
781
782
|
}
|
|
782
|
-
function
|
|
783
|
+
function wc({
|
|
783
784
|
relatedCollection: s,
|
|
784
785
|
manyField: f,
|
|
785
786
|
parentId: y,
|
|
@@ -810,7 +811,7 @@ function vc({
|
|
|
810
811
|
uploadTemplate: wt,
|
|
811
812
|
rowMatchPanel: ie,
|
|
812
813
|
lineSla: at,
|
|
813
|
-
rowLints:
|
|
814
|
+
rowLints: gt,
|
|
814
815
|
stats: Te,
|
|
815
816
|
compareSeries: Ke,
|
|
816
817
|
sumCap: Ue,
|
|
@@ -823,7 +824,7 @@ function vc({
|
|
|
823
824
|
editorMode: G
|
|
824
825
|
}) {
|
|
825
826
|
var To, Ro;
|
|
826
|
-
const $ = Yr(),
|
|
827
|
+
const $ = Yr(), he = Ll(), ge = Sl(), V = Go(), w = ud(), Je = fd(), Lt = md(), _t = Ql()[U ?? ""] ?? [], A = y === "new", N = $l(), kt = ql(), Ze = jl(), Vt = `nvr_grid_editor_${s}_${U ?? f}`, [ln, Gr] = Q(() => {
|
|
827
828
|
if (typeof localStorage > "u") return null;
|
|
828
829
|
try {
|
|
829
830
|
const e = localStorage.getItem(Vt);
|
|
@@ -918,7 +919,7 @@ function vc({
|
|
|
918
919
|
if (!["ERROR", "FAILED"].includes(d)) continue;
|
|
919
920
|
const c = String((o == null ? void 0 : o.lineNumber) ?? "");
|
|
920
921
|
if (!c || e.has(c)) continue;
|
|
921
|
-
const l =
|
|
922
|
+
const l = Sd(o == null ? void 0 : o.lineDetailedMessage), b = l.find(
|
|
922
923
|
(u) => new RegExp(`^Line(?:Number)?\\s*${c}\\s*:`, "i").test(u.trim())
|
|
923
924
|
) ?? l[0];
|
|
924
925
|
b && e.set(c, b.replace(/^Line(?:Number)?\s*\d+\s*:\s*/i, ""));
|
|
@@ -1006,18 +1007,18 @@ function vc({
|
|
|
1006
1007
|
})
|
|
1007
1008
|
)).data ?? [], r = t.map((b) => {
|
|
1008
1009
|
const u = {};
|
|
1009
|
-
for (const [
|
|
1010
|
-
!oa.has(
|
|
1010
|
+
for (const [h, v] of Object.entries(b))
|
|
1011
|
+
!oa.has(h) && v != null && typeof v != "object" && (u[h] = v);
|
|
1011
1012
|
return u;
|
|
1012
|
-
}), i = await aa(r), { rows: o, dropped: d } =
|
|
1013
|
+
}), i = await aa(r), { rows: o, dropped: d } = kd(r, i);
|
|
1013
1014
|
Xt(o).forEach((b, u) => {
|
|
1014
|
-
var
|
|
1015
|
-
(
|
|
1015
|
+
var h;
|
|
1016
|
+
(h = d[u]) != null && h.length && ds.current.set(b, new Set(d[u])), w.queueRow(s, f, b);
|
|
1016
1017
|
});
|
|
1017
1018
|
const l = d.filter((b) => b.length > 0).length, p = [...new Set(d.flat())].map(
|
|
1018
1019
|
(b) => {
|
|
1019
1020
|
var u;
|
|
1020
|
-
return ((u = le.find((
|
|
1021
|
+
return ((u = le.find((h) => h.field === b)) == null ? void 0 : u.label) || Se(b);
|
|
1021
1022
|
}
|
|
1022
1023
|
);
|
|
1023
1024
|
t.length === 0 ? me.success("That record has no lines on this table") : l > 0 ? me.warning(
|
|
@@ -1059,7 +1060,7 @@ function vc({
|
|
|
1059
1060
|
})),
|
|
1060
1061
|
[Yt]
|
|
1061
1062
|
);
|
|
1062
|
-
async function
|
|
1063
|
+
async function ha(e) {
|
|
1063
1064
|
us(!0);
|
|
1064
1065
|
try {
|
|
1065
1066
|
const n = await $.request(
|
|
@@ -1069,7 +1070,7 @@ function vc({
|
|
|
1069
1070
|
parent_id: y,
|
|
1070
1071
|
target_timestamp: e
|
|
1071
1072
|
})
|
|
1072
|
-
), t =
|
|
1073
|
+
), t = Rl(n);
|
|
1073
1074
|
t && me.warning(t, { duration: 1e4 }), V.invalidateQueries({ queryKey: ["o2m-rows", s, f, y] }), V.invalidateQueries({
|
|
1074
1075
|
queryKey: ["o2m-field-snapshots", s, f, y]
|
|
1075
1076
|
}), pr(!1);
|
|
@@ -1084,19 +1085,19 @@ function vc({
|
|
|
1084
1085
|
(K ?? []).filter((e) => e.target_type === "lock").map((e) => e.target_field)
|
|
1085
1086
|
),
|
|
1086
1087
|
[K]
|
|
1087
|
-
), [m, Re] = Q(null), Ye = fe(null), fs = (e, n) => e && e !== "new" && !e.startsWith("pending:") ? `${s}:${e}:${n}` : void 0, Nt = fe(null),
|
|
1088
|
+
), [m, Re] = Q(null), Ye = fe(null), fs = (e, n) => e && e !== "new" && !e.startsWith("pending:") ? `${s}:${e}:${n}` : void 0, Nt = fe(null), hr = (e, n) => {
|
|
1088
1089
|
!e || typeof window > "u" || window.dispatchEvent(new CustomEvent("nvr:cell-editing", { detail: { cell: e, state: n } }));
|
|
1089
|
-
},
|
|
1090
|
+
}, ga = (e) => {
|
|
1090
1091
|
var t, r, i;
|
|
1091
1092
|
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;
|
|
1092
|
-
n !== Nt.current && (Nt.current &&
|
|
1093
|
+
n !== Nt.current && (Nt.current && hr(Nt.current, "end"), Nt.current = n, n && hr(n, "start"));
|
|
1093
1094
|
}, ba = (e) => {
|
|
1094
1095
|
var t, r;
|
|
1095
|
-
(r = (t = e.relatedTarget) == null ? void 0 : t.closest) != null && r.call(t, "[data-grid-cell]") || (Nt.current &&
|
|
1096
|
+
(r = (t = e.relatedTarget) == null ? void 0 : t.closest) != null && r.call(t, "[data-grid-cell]") || (Nt.current && hr(Nt.current, "end"), Nt.current = null);
|
|
1096
1097
|
};
|
|
1097
1098
|
ke(
|
|
1098
1099
|
() => () => {
|
|
1099
|
-
Nt.current &&
|
|
1100
|
+
Nt.current && hr(Nt.current, "end");
|
|
1100
1101
|
},
|
|
1101
1102
|
[]
|
|
1102
1103
|
);
|
|
@@ -1144,10 +1145,10 @@ function vc({
|
|
|
1144
1145
|
};
|
|
1145
1146
|
return document.addEventListener("mousedown", e, !0), () => document.removeEventListener("mousedown", e, !0);
|
|
1146
1147
|
}, [m, q]);
|
|
1147
|
-
const [yt, un] = Q(!1), [ms, St] = Q(null), [Mn,
|
|
1148
|
+
const [yt, un] = Q(!1), [ms, St] = Q(null), [Mn, gr] = Q(null), [ps, hs] = Q(!1);
|
|
1148
1149
|
async function ya() {
|
|
1149
1150
|
if (!Mn) return;
|
|
1150
|
-
|
|
1151
|
+
hs(!0);
|
|
1151
1152
|
const e = [];
|
|
1152
1153
|
let n = "";
|
|
1153
1154
|
for (const r of Mn.groups) {
|
|
@@ -1160,20 +1161,20 @@ function vc({
|
|
|
1160
1161
|
}
|
|
1161
1162
|
i.length && e.push({ ...r, members: i });
|
|
1162
1163
|
}
|
|
1163
|
-
|
|
1164
|
+
hs(!1), V.invalidateQueries({ queryKey: ["o2m-rows", s, f, y] });
|
|
1164
1165
|
const t = e.reduce((r, i) => r + i.members.length, 0);
|
|
1165
|
-
|
|
1166
|
+
gr(
|
|
1166
1167
|
t > 0 ? {
|
|
1167
1168
|
text: `${t} ${e.map((r) => r.label).join(", ")} row${t === 1 ? "" : "s"} still did not save — ${n}`,
|
|
1168
1169
|
groups: e
|
|
1169
1170
|
} : null
|
|
1170
1171
|
);
|
|
1171
1172
|
}
|
|
1172
|
-
const [br, Kn] = Q(null), Ae =
|
|
1173
|
+
const [br, Kn] = Q(null), Ae = zl(), [ti, va] = Q(() => {
|
|
1173
1174
|
var e;
|
|
1174
1175
|
return Ne === or ? or : Ne && (te != null && te.some((n) => n.name === Ne)) ? Ne : (e = te == null ? void 0 : te[0]) == null ? void 0 : e.name;
|
|
1175
1176
|
});
|
|
1176
|
-
function
|
|
1177
|
+
function gs(e) {
|
|
1177
1178
|
va(e);
|
|
1178
1179
|
}
|
|
1179
1180
|
const ct = fe(null), Pn = fe(!1), yr = (e) => {
|
|
@@ -1245,7 +1246,7 @@ function vc({
|
|
|
1245
1246
|
enabled: !A,
|
|
1246
1247
|
staleTime: 3e4
|
|
1247
1248
|
}), $t = M(
|
|
1248
|
-
() =>
|
|
1249
|
+
() => Zl($, s),
|
|
1249
1250
|
[$, s]
|
|
1250
1251
|
);
|
|
1251
1252
|
ke(() => {
|
|
@@ -1262,7 +1263,7 @@ function vc({
|
|
|
1262
1263
|
for (const r of e) t.set(r.rowId, r);
|
|
1263
1264
|
return [...t.values()];
|
|
1264
1265
|
});
|
|
1265
|
-
}, xa =
|
|
1266
|
+
}, xa = Il(2e3), { data: hn } = Fe({
|
|
1266
1267
|
queryKey: ["o2m-cell-provenance", s, f, y, xr],
|
|
1267
1268
|
queryFn: () => $.request(
|
|
1268
1269
|
oe("/revisions/o2m-cell-provenance", {
|
|
@@ -1295,7 +1296,7 @@ function vc({
|
|
|
1295
1296
|
}), ys = M(
|
|
1296
1297
|
() => new Set(rt != null && rt.overdue ? rt.overdue_ids : []),
|
|
1297
1298
|
[rt]
|
|
1298
|
-
), vs = rt != null && rt.overdue ? `${rt.label} still missing · ${rt.days} ${rt.days === 1 ? "day" : "days"} on the clock (limit ${rt.threshold_days})` : void 0, oi = (
|
|
1299
|
+
), vs = rt != null && rt.overdue ? `${rt.label} still missing · ${rt.days} ${rt.days === 1 ? "day" : "days"} on the clock (limit ${rt.threshold_days})` : void 0, oi = (hn == null ? void 0 : hn.data) ?? {}, _a = (hn == null ? void 0 : hn.created) ?? {}, _r = (e) => {
|
|
1299
1300
|
const n = _a[e];
|
|
1300
1301
|
if (!n) return null;
|
|
1301
1302
|
const t = gd(n.comment);
|
|
@@ -1376,7 +1377,7 @@ function vc({
|
|
|
1376
1377
|
if (d.includes(".")) {
|
|
1377
1378
|
const b = d.split(".");
|
|
1378
1379
|
let u = p;
|
|
1379
|
-
for (let
|
|
1380
|
+
for (let h = b.length - 1; h >= 1; h--) u = { [b[h]]: u };
|
|
1380
1381
|
r[b[0]] = u;
|
|
1381
1382
|
} else
|
|
1382
1383
|
r[d] = p;
|
|
@@ -1559,7 +1560,7 @@ function vc({
|
|
|
1559
1560
|
const t = n === void 0 ? Os(e.id) : n, r = { ...e };
|
|
1560
1561
|
for (const i of Es) {
|
|
1561
1562
|
const o = i.computed_formula;
|
|
1562
|
-
if (t && !
|
|
1563
|
+
if (t && !Kl(o, r, t)) continue;
|
|
1563
1564
|
const d = Qt(o, r);
|
|
1564
1565
|
d !== null && (r[i.field] = d);
|
|
1565
1566
|
}
|
|
@@ -1645,14 +1646,14 @@ function vc({
|
|
|
1645
1646
|
return e === "$count" ? zn.length : qt == null ? void 0 : qt[e];
|
|
1646
1647
|
},
|
|
1647
1648
|
[qt, zn]
|
|
1648
|
-
), pi = M(() => Te != null && Te.length ? Te.map((e) => ({ ...e, result:
|
|
1649
|
-
() => Ke != null && Ke.endpoint ?
|
|
1649
|
+
), pi = M(() => Te != null && Te.length ? Te.map((e) => ({ ...e, result: ht(e.value, Zt) })) : null, [Te, Zt]), $r = M(
|
|
1650
|
+
() => Ke != null && Ke.endpoint ? Vl(Ke.endpoint, qt) : null,
|
|
1650
1651
|
[Ke == null ? void 0 : Ke.endpoint, qt]
|
|
1651
|
-
),
|
|
1652
|
+
), hi = Bl({
|
|
1652
1653
|
client: $,
|
|
1653
1654
|
endpoint: $r,
|
|
1654
1655
|
enabled: !!Ke && !A
|
|
1655
|
-
}), I = Ke && !A ?
|
|
1656
|
+
}), I = Ke && !A ? hi.data ?? null : null, As = !!Ke && !A && !!$r && hi.isLoading, js = !!Ke && !A && hi.isError, qr = jt(
|
|
1656
1657
|
(e) => e.label || Se(e.field),
|
|
1657
1658
|
[]
|
|
1658
1659
|
), { isAdmin: Vn } = El(), Er = jt(
|
|
@@ -1661,10 +1662,10 @@ function vc({
|
|
|
1661
1662
|
return !Vn && ((n = zi(e.options)) == null ? void 0 : n.admin_only_edit) === !0;
|
|
1662
1663
|
},
|
|
1663
1664
|
[Vn]
|
|
1664
|
-
),
|
|
1665
|
+
), gi = jt(
|
|
1665
1666
|
(e, n) => !!(I != null && I.closed_locked) && !Vn && I.columns.includes(e) && Jt(I, n[I.key_field], e),
|
|
1666
1667
|
[I, Vn]
|
|
1667
|
-
),
|
|
1668
|
+
), gn = jt(
|
|
1668
1669
|
async (e, n, t) => {
|
|
1669
1670
|
if (e.startsWith("pending:")) {
|
|
1670
1671
|
const r = Number(e.slice(8)), i = D[r];
|
|
@@ -1729,9 +1730,9 @@ function vc({
|
|
|
1729
1730
|
for (const d of e.rows) {
|
|
1730
1731
|
if (d.category != null) continue;
|
|
1731
1732
|
const c = E.find((u) => String(u[n]) === String(d.key)), l = D.findIndex((u) => String(u[n]) === String(d.key)), p = c ? { ...c, ...o.get(String(c.id)) ?? {} } : l >= 0 ? D[l] : null, b = {};
|
|
1732
|
-
for (const [u,
|
|
1733
|
-
Jt(I, d.key, u) || p && !r(p[u]) || (b[u] =
|
|
1734
|
-
Object.keys(b).length !== 0 && (i++, c ?
|
|
1733
|
+
for (const [u, h] of Object.entries(d.values))
|
|
1734
|
+
Jt(I, d.key, u) || p && !r(p[u]) || (b[u] = h);
|
|
1735
|
+
Object.keys(b).length !== 0 && (i++, c ? gn(String(c.id), b, t) : l >= 0 ? gn(`pending:${l}`, b, t) : w && w.queueRow(
|
|
1735
1736
|
s,
|
|
1736
1737
|
f,
|
|
1737
1738
|
Qn(ce({ [n]: d.key, ...b, _change_reason: t }))
|
|
@@ -1749,14 +1750,14 @@ function vc({
|
|
|
1749
1750
|
w,
|
|
1750
1751
|
s,
|
|
1751
1752
|
f,
|
|
1752
|
-
|
|
1753
|
+
gn,
|
|
1753
1754
|
bi
|
|
1754
1755
|
]
|
|
1755
1756
|
), Aa = jt(
|
|
1756
1757
|
(e) => {
|
|
1757
1758
|
var v;
|
|
1758
1759
|
if (!((v = xe == null ? void 0 : xe.fields) != null && v.length)) return;
|
|
1759
|
-
const n =
|
|
1760
|
+
const n = ht(xe.remaining, Zt), t = n == null || !Number.isFinite(n) ? 0 : Math.round(n * 100) / 100;
|
|
1760
1761
|
if (t <= 0) return;
|
|
1761
1762
|
const r = xe.only_empty !== !1, i = (k) => k == null || k === "" || Number(k) === 0, o = (w == null ? void 0 : w.getPendingEdits(s, f)) ?? /* @__PURE__ */ new Map(), d = (w == null ? void 0 : w.getPendingDeletes(s, f)) ?? /* @__PURE__ */ new Set(), c = I == null ? void 0 : I.key_field, l = [];
|
|
1762
1763
|
for (const k of E) {
|
|
@@ -1777,19 +1778,19 @@ function vc({
|
|
|
1777
1778
|
p.length,
|
|
1778
1779
|
e === "shape" ? "even" : e,
|
|
1779
1780
|
b
|
|
1780
|
-
),
|
|
1781
|
+
), h = /* @__PURE__ */ new Map();
|
|
1781
1782
|
p.forEach((k, x) => {
|
|
1782
|
-
const
|
|
1783
|
-
|
|
1783
|
+
const g = h.get(k.id) ?? {};
|
|
1784
|
+
g[k.field] = u[x], h.set(k.id, g);
|
|
1784
1785
|
});
|
|
1785
|
-
for (const [k, x] of
|
|
1786
|
-
|
|
1786
|
+
for (const [k, x] of h)
|
|
1787
|
+
gn(
|
|
1787
1788
|
k,
|
|
1788
1789
|
x,
|
|
1789
|
-
`${xe.label ?? "Spread remaining"} across ${
|
|
1790
|
+
`${xe.label ?? "Spread remaining"} across ${h.size} rows`
|
|
1790
1791
|
);
|
|
1791
1792
|
me.success(
|
|
1792
|
-
`Spread ${Ui(t)} over ${p.length} cells on ${
|
|
1793
|
+
`Spread ${Ui(t)} over ${p.length} cells on ${h.size} ${h.size === 1 ? "row" : "rows"}`
|
|
1793
1794
|
);
|
|
1794
1795
|
},
|
|
1795
1796
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -1802,7 +1803,7 @@ function vc({
|
|
|
1802
1803
|
I,
|
|
1803
1804
|
E,
|
|
1804
1805
|
D,
|
|
1805
|
-
|
|
1806
|
+
gn
|
|
1806
1807
|
]
|
|
1807
1808
|
), en = Je == null ? void 0 : Je.report;
|
|
1808
1809
|
ke(() => {
|
|
@@ -1866,7 +1867,7 @@ function vc({
|
|
|
1866
1867
|
}, [Fn, Ms, N == null ? void 0 : N.draft]), Ks = an({
|
|
1867
1868
|
queries: ja.map(([e, n]) => ({
|
|
1868
1869
|
queryKey: ["pinned-parent", n.collection, n.id, [...n.fields].sort().join(",")],
|
|
1869
|
-
queryFn: () =>
|
|
1870
|
+
queryFn: () => he(n.collection, n.id, [...n.fields]).then((t) => [e, t]).catch(() => [e, null]),
|
|
1870
1871
|
staleTime: 6e4
|
|
1871
1872
|
}))
|
|
1872
1873
|
}), Or = M(() => {
|
|
@@ -1877,8 +1878,8 @@ function vc({
|
|
|
1877
1878
|
var t, r, i;
|
|
1878
1879
|
for (const o of e) {
|
|
1879
1880
|
if ((t = o.when) != null && t.field) {
|
|
1880
|
-
const p = o.when.field.startsWith("$parent.") ? (r = N == null ? void 0 : N.draft) == null ? void 0 : r[o.when.field.slice(8)] : n[o.when.field], b = o.when.op ?? "eq", u = o.when.value,
|
|
1881
|
-
if (!(b === "nnull" ?
|
|
1881
|
+
const p = o.when.field.startsWith("$parent.") ? (r = N == null ? void 0 : N.draft) == null ? void 0 : r[o.when.field.slice(8)] : n[o.when.field], b = o.when.op ?? "eq", u = o.when.value, h = p == null ? "" : String(p);
|
|
1882
|
+
if (!(b === "nnull" ? h !== "" : b === "null" ? h === "" : b === "neq" ? h !== String(u ?? "") : b === "in" ? (Array.isArray(u) ? u.map(String) : String(u ?? "").split(",").map((k) => k.trim())).includes(h) : h === String(u ?? ""))) continue;
|
|
1882
1883
|
}
|
|
1883
1884
|
const d = (i = N == null ? void 0 : N.draft) == null ? void 0 : i[o.parent_field];
|
|
1884
1885
|
if (d == null || d === "") continue;
|
|
@@ -1977,7 +1978,7 @@ function vc({
|
|
|
1977
1978
|
}
|
|
1978
1979
|
return e;
|
|
1979
1980
|
}, [tn, Ot, zs, yn]), Ar = M(() => E.map((e) => String(e.id)), [E]), Hn = M(
|
|
1980
|
-
() => `nvr-gf-${Math.abs(
|
|
1981
|
+
() => `nvr-gf-${Math.abs($d(`${s}:${U ?? f}`)) % 1e5}`,
|
|
1981
1982
|
[s, U, f]
|
|
1982
1983
|
), Vs = M(() => {
|
|
1983
1984
|
if (!H) return null;
|
|
@@ -2013,7 +2014,7 @@ function vc({
|
|
|
2013
2014
|
);
|
|
2014
2015
|
return n.observe(e), () => n.disconnect();
|
|
2015
2016
|
}, [E.length, xn]);
|
|
2016
|
-
const Ra = Ar.join(","), Ma =
|
|
2017
|
+
const Ra = Ar.join(","), Ma = pd(
|
|
2017
2018
|
s,
|
|
2018
2019
|
Ar,
|
|
2019
2020
|
!!X && !A
|
|
@@ -2076,11 +2077,11 @@ function vc({
|
|
|
2076
2077
|
for (const [l, p] of Y) {
|
|
2077
2078
|
const b = p[`__nested_ops_${i}`];
|
|
2078
2079
|
if (!b) continue;
|
|
2079
|
-
const u = E.find((v) => String(v.id) === l),
|
|
2080
|
+
const u = E.find((v) => String(v.id) === l), h = n(
|
|
2080
2081
|
ce({ ...u ?? {}, ...p }),
|
|
2081
2082
|
d
|
|
2082
2083
|
);
|
|
2083
|
-
for (const v of b.created ?? []) c.created.push({ ...v, [d]: l, ...
|
|
2084
|
+
for (const v of b.created ?? []) c.created.push({ ...v, [d]: l, ...h });
|
|
2084
2085
|
for (const v of b.updated ?? []) c.updated.push({ id: v.id, values: v.changes });
|
|
2085
2086
|
for (const v of b.deleted ?? []) c.deleted.push(v);
|
|
2086
2087
|
}
|
|
@@ -2220,9 +2221,9 @@ function vc({
|
|
|
2220
2221
|
const i = e.field.slice(0, r), o = e.field.slice(r + 1), d = Cs(i, n, t);
|
|
2221
2222
|
if (d.length === 0) return "—";
|
|
2222
2223
|
const c = (p = Ir.get(i)) == null ? void 0 : p.get(o), l = d.map((b) => {
|
|
2223
|
-
var
|
|
2224
|
+
var h;
|
|
2224
2225
|
const u = b[o];
|
|
2225
|
-
return u == null || u === "" ? null : c != null && c.one_collection ? ((
|
|
2226
|
+
return u == null || u === "" ? null : c != null && c.one_collection ? ((h = Ys[c.one_collection]) == null ? void 0 : h[String(u)]) ?? String(u) : String(u);
|
|
2226
2227
|
}).filter((b) => !!b);
|
|
2227
2228
|
return l.length > 0 ? l.join(", ") : "—";
|
|
2228
2229
|
}
|
|
@@ -2233,18 +2234,18 @@ function vc({
|
|
|
2233
2234
|
const r = e.field.slice(0, t), i = e.field.slice(t + 1), o = Cs(r, n, !1);
|
|
2234
2235
|
if (o.length === 0) return "—";
|
|
2235
2236
|
const d = (p = Ir.get(r)) == null ? void 0 : p.get(i);
|
|
2236
|
-
if (!(d != null && d.one_collection) || !
|
|
2237
|
+
if (!(d != null && d.one_collection) || !ge) return Yn(e, n, !1);
|
|
2237
2238
|
const c = d.one_collection, l = o.map((b) => {
|
|
2238
|
-
var
|
|
2239
|
+
var h;
|
|
2239
2240
|
const u = b[i];
|
|
2240
|
-
return u == null || u === "" ? null : { id: String(u), label: ((
|
|
2241
|
+
return u == null || u === "" ? null : { id: String(u), label: ((h = Ys[c]) == null ? void 0 : h[String(u)]) ?? String(u) };
|
|
2241
2242
|
}).filter((b) => !!b);
|
|
2242
2243
|
return l.length === 0 ? "—" : /* @__PURE__ */ a("span", { className: "inline-flex flex-wrap gap-x-1.5", children: l.map((b, u) => /* @__PURE__ */ a(
|
|
2243
2244
|
"button",
|
|
2244
2245
|
{
|
|
2245
2246
|
type: "button",
|
|
2246
|
-
onClick: (
|
|
2247
|
-
|
|
2247
|
+
onClick: (h) => {
|
|
2248
|
+
h.stopPropagation(), ge.open({ collection: c, itemId: b.id, title: b.label, width: "80%" });
|
|
2248
2249
|
},
|
|
2249
2250
|
className: "truncate text-left underline decoration-slate-300 decoration-dotted underline-offset-2 hover:text-[#172940] hover:decoration-nvr-cyan dark:hover:text-nvr-cyan",
|
|
2250
2251
|
children: b.label
|
|
@@ -2261,7 +2262,7 @@ function vc({
|
|
|
2261
2262
|
};
|
|
2262
2263
|
return window.addEventListener(Wo, e), () => window.removeEventListener(Wo, e);
|
|
2263
2264
|
}, [s]), pn.current = async (e, n, t) => {
|
|
2264
|
-
const r = await
|
|
2265
|
+
const r = await ed($, $t, e, n, t, {
|
|
2265
2266
|
key: `${s}.${f}`,
|
|
2266
2267
|
label: Vi(E, n, C)
|
|
2267
2268
|
});
|
|
@@ -2276,8 +2277,8 @@ function vc({
|
|
|
2276
2277
|
let t = 0;
|
|
2277
2278
|
for (const r of n) {
|
|
2278
2279
|
const i = new Set(
|
|
2279
|
-
r.conflicts.filter((d) => e.has(
|
|
2280
|
-
), o =
|
|
2280
|
+
r.conflicts.filter((d) => e.has(td(r, d.field))).map((d) => d.field)
|
|
2281
|
+
), o = nd(r.mine, i);
|
|
2281
2282
|
if (o) {
|
|
2282
2283
|
r.latest > 0 && $t.set(r.rowId, r.latest);
|
|
2283
2284
|
try {
|
|
@@ -2303,7 +2304,7 @@ function vc({
|
|
|
2303
2304
|
return !0;
|
|
2304
2305
|
}, Tr = (e, n) => {
|
|
2305
2306
|
const t = Xs.current.get(e);
|
|
2306
|
-
return
|
|
2307
|
+
return t && n - t < Zs ? !0 : Ol(s, e);
|
|
2307
2308
|
};
|
|
2308
2309
|
ke(() => {
|
|
2309
2310
|
if (A || fn || !Gn) return;
|
|
@@ -2512,7 +2513,7 @@ function vc({
|
|
|
2512
2513
|
e.pending < n.pending && (Rt.current = Date.now());
|
|
2513
2514
|
}
|
|
2514
2515
|
}, [fi]);
|
|
2515
|
-
const Si = M(() =>
|
|
2516
|
+
const Si = M(() => jd(le), [le]), ao = M(
|
|
2516
2517
|
() => le.filter(
|
|
2517
2518
|
(e) => e.group_key === "__create_with_defaults__" && !Xi.has(e.type ?? "") && !Ci.has(e.field)
|
|
2518
2519
|
),
|
|
@@ -2618,26 +2619,26 @@ function vc({
|
|
|
2618
2619
|
const o = qi.get(r.child_field), d = Ge[r.child_field], c = Be.get(r.child_field);
|
|
2619
2620
|
if (!(o != null && o.size) || !d || !(c != null && c.one_collection)) continue;
|
|
2620
2621
|
const l = JSON.stringify(d), p = [...o].filter(
|
|
2621
|
-
(
|
|
2622
|
+
(h) => !Mr.current.has(`${r.child_field}|${h}|${l}`)
|
|
2622
2623
|
);
|
|
2623
2624
|
if (!p.length) continue;
|
|
2624
2625
|
const b = {};
|
|
2625
2626
|
let u = !0;
|
|
2626
|
-
for (const [
|
|
2627
|
+
for (const [h, v] of Object.entries(i.replace)) {
|
|
2627
2628
|
const k = Array.isArray(v) ? Ps(v, {}) : null;
|
|
2628
2629
|
if (!k) {
|
|
2629
2630
|
u = !1;
|
|
2630
2631
|
break;
|
|
2631
2632
|
}
|
|
2632
|
-
b[
|
|
2633
|
+
b[h] = k.id;
|
|
2633
2634
|
}
|
|
2634
2635
|
if (!u) {
|
|
2635
|
-
const
|
|
2636
|
-
var
|
|
2637
|
-
const x = (
|
|
2636
|
+
const h = Object.values(i.replace).flat().every((k) => {
|
|
2637
|
+
var g;
|
|
2638
|
+
const x = (g = N == null ? void 0 : N.draft) == null ? void 0 : g[k.parent_field];
|
|
2638
2639
|
return x == null || x === "" || Or.has(`${k.parent_collection}|${String(x)}`);
|
|
2639
2640
|
}), v = `hint|${r.child_field}|${l}`;
|
|
2640
|
-
if (
|
|
2641
|
+
if (h && !Mr.current.has(v)) {
|
|
2641
2642
|
Mr.current.add(v);
|
|
2642
2643
|
const k = ((t = N == null ? void 0 : N.fieldLabels) == null ? void 0 : t[r.parent_field]) ?? Se(r.parent_field);
|
|
2643
2644
|
me.message(
|
|
@@ -2649,15 +2650,15 @@ function vc({
|
|
|
2649
2650
|
n.push({ rule: r, cfg: i, target: c.one_collection, filter: d, filterKey: l, ids: p, replaceValues: b });
|
|
2650
2651
|
}
|
|
2651
2652
|
n.length && (Ei.current = !0, (async () => {
|
|
2652
|
-
var p, b, u,
|
|
2653
|
+
var p, b, u, h, v;
|
|
2653
2654
|
let r = 0, i = 0, o = 0, d = 0;
|
|
2654
2655
|
for (const k of n) {
|
|
2655
2656
|
for (const F of k.ids)
|
|
2656
2657
|
Mr.current.add(`${k.rule.child_field}|${F}|${k.filterKey}`);
|
|
2657
|
-
const x = k.rule.child_field,
|
|
2658
|
+
const x = k.rule.child_field, g = (k.cfg.keep ?? []).filter((F) => typeof F == "string" && F), S = await $.request(
|
|
2658
2659
|
oe(`/items/${k.target}`, {
|
|
2659
2660
|
filter: JSON.stringify({ id: { _in: k.ids } }),
|
|
2660
|
-
fields: ["id", ...
|
|
2661
|
+
fields: ["id", ...g].join(","),
|
|
2661
2662
|
limit: k.ids.length
|
|
2662
2663
|
})
|
|
2663
2664
|
).then((F) => F.data ?? []).catch(() => []), L = /* @__PURE__ */ new Map();
|
|
@@ -2665,7 +2666,7 @@ function vc({
|
|
|
2665
2666
|
const ye = [
|
|
2666
2667
|
k.filter,
|
|
2667
2668
|
...Object.entries(k.replaceValues).map(([ee, tt]) => ({ [ee]: { _eq: tt } })),
|
|
2668
|
-
...
|
|
2669
|
+
...g.map(
|
|
2669
2670
|
(ee) => F[ee] == null || F[ee] === "" ? { [ee]: { _null: !0 } } : { [ee]: { _eq: F[ee] } }
|
|
2670
2671
|
)
|
|
2671
2672
|
], ue = await $.request(
|
|
@@ -2748,7 +2749,7 @@ function vc({
|
|
|
2748
2749
|
queryKey: ["o2m-rows", s, f, y]
|
|
2749
2750
|
});
|
|
2750
2751
|
}
|
|
2751
|
-
const c = ((b = n[0]) == null ? void 0 : b.cfg.label) ?? "Value", l = ((
|
|
2752
|
+
const c = ((b = n[0]) == null ? void 0 : b.cfg.label) ?? "Value", l = ((h = N == null ? void 0 : N.fieldLabels) == null ? void 0 : h[((u = n[0]) == null ? void 0 : u.rule.parent_field) ?? ""]) ?? Se(((v = n[0]) == null ? void 0 : v.rule.parent_field) ?? "parent");
|
|
2752
2753
|
r && me.message(
|
|
2753
2754
|
`${c} switched to the default on ${r} ${r === 1 ? "line" : "lines"} — the previous one is not available for this ${l}${(P || A) && w ? " (saved with the record)" : ""}`
|
|
2754
2755
|
), (i || o) && me.warning(
|
|
@@ -2760,13 +2761,14 @@ function vc({
|
|
|
2760
2761
|
}, [qi, Ge, N == null ? void 0 : N.dirtyFields, Or]);
|
|
2761
2762
|
const Xn = M(() => {
|
|
2762
2763
|
const e = /* @__PURE__ */ new Map(), n = [...E, ...D], t = [...Y.values()], r = _t.flatMap((i) => i.rows);
|
|
2764
|
+
m != null && m.draft && r.push(m.draft);
|
|
2763
2765
|
for (const [i, o] of Be) {
|
|
2764
2766
|
if (!o.one_collection) continue;
|
|
2765
2767
|
const d = n.map((b) => b[i]).filter((b) => b != null).map(String), c = t.map((b) => b[i]).filter((b) => b != null).map(String), l = r.map((b) => b[i]).filter((b) => b != null).map(String), p = [.../* @__PURE__ */ new Set([...d, ...c, ...l])].sort();
|
|
2766
2768
|
p.length && e.set(o.one_collection, p);
|
|
2767
2769
|
}
|
|
2768
2770
|
return e;
|
|
2769
|
-
}, [E, D, Y, Be, _t]), Qa = M(() => {
|
|
2771
|
+
}, [E, D, Y, Be, _t, m == null ? void 0 : m.draft]), Qa = M(() => {
|
|
2770
2772
|
const e = /* @__PURE__ */ new Map();
|
|
2771
2773
|
for (const n of we) {
|
|
2772
2774
|
const t = Be.get(n.field);
|
|
@@ -2818,8 +2820,8 @@ function vc({
|
|
|
2818
2820
|
e[t] = {};
|
|
2819
2821
|
for (const l of c)
|
|
2820
2822
|
if (o) {
|
|
2821
|
-
const p = l[o.groupField], b = l[o.optionField], u = p ? sr(null, p) : null,
|
|
2822
|
-
e[t][String(l.id)] = [u,
|
|
2823
|
+
const p = l[o.groupField], b = l[o.optionField], u = p ? sr(null, p) : null, h = b ? sr(null, b) : null;
|
|
2824
|
+
e[t][String(l.id)] = [u, h].filter(Boolean).join(" — ") || String(l.id);
|
|
2823
2825
|
} else {
|
|
2824
2826
|
const p = (r == null ? void 0 : r.display_template) ?? void 0;
|
|
2825
2827
|
e[t][String(l.id)] = sr(p, l);
|
|
@@ -2828,12 +2830,15 @@ function vc({
|
|
|
2828
2830
|
), e;
|
|
2829
2831
|
},
|
|
2830
2832
|
enabled: Xn.size > 0,
|
|
2833
|
+
// A new id joining the set (a line editor auto-fill) keeps the labels
|
|
2834
|
+
// already known on screen while the new one loads.
|
|
2835
|
+
placeholderData: (e) => e,
|
|
2831
2836
|
staleTime: 6e4
|
|
2832
2837
|
}), Ba = M(
|
|
2833
2838
|
() => ie != null && ie.unmatched_banner ? D.map((e) => ce({ ...e })) : void 0,
|
|
2834
2839
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2835
2840
|
[ie == null ? void 0 : ie.unmatched_banner, D]
|
|
2836
|
-
), Mt =
|
|
2841
|
+
), Mt = bd({
|
|
2837
2842
|
config: ie,
|
|
2838
2843
|
rows: E,
|
|
2839
2844
|
stagedRows: Ba,
|
|
@@ -3016,7 +3021,7 @@ function vc({
|
|
|
3016
3021
|
const n = (p = (l = Ye.current) == null ? void 0 : l.lockReasons) == null ? void 0 : p[e];
|
|
3017
3022
|
if (!n) return "Set automatically for this row";
|
|
3018
3023
|
if (n.reason) return `Locked — ${n.reason}`;
|
|
3019
|
-
const t = n.field ? le.find((
|
|
3024
|
+
const t = n.field ? le.find((h) => h.field === n.field) : void 0, r = (t == null ? void 0 : t.label) || (n.field ? Se(n.field) : "a rule"), i = n.field ? (b = Ye.current) == null ? void 0 : b.draft[n.field] : void 0, o = n.field ? Be.get(n.field) : void 0, d = i == null || i === "" ? null : o != null && o.one_collection ? ((u = Sn[o.one_collection]) == null ? void 0 : u[String(i)]) ?? String(i) : String(i);
|
|
3020
3025
|
if (d) return `Locked — ${r} is ${d}`;
|
|
3021
3026
|
const c = 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";
|
|
3022
3027
|
return `Locked — ${r} ${c}${n.op === "null" || n.op === "nnull" ? "" : ` ${n.value ?? ""}`}`;
|
|
@@ -3125,23 +3130,23 @@ function vc({
|
|
|
3125
3130
|
dt.current.rowId !== r && (dt.current = { rowId: r, seqs: /* @__PURE__ */ new Map() });
|
|
3126
3131
|
const i = ++ei.current;
|
|
3127
3132
|
dt.current.seqs.set(e, i);
|
|
3128
|
-
const o = ce(t ? { ...t.draft, [e]: n } : { [e]: n }), d = n != null && n !== "", c = !!((v = we.find((
|
|
3129
|
-
(
|
|
3130
|
-
), u = !!((x = t == null ? void 0 : t.invalid) != null && x.includes(e)) || b.length > 0,
|
|
3131
|
-
if ((l || u) && ((p == null ? void 0 : p.length) ?? 0) === 0 && ((
|
|
3132
|
-
(
|
|
3133
|
+
const o = ce(t ? { ...t.draft, [e]: n } : { [e]: n }), d = n != null && n !== "", c = !!((v = we.find((g) => g.field === e)) != null && v.required), l = (d || !c) && !!((k = t == null ? void 0 : t.missing) != null && k.includes(e)), p = l ? ((t == null ? void 0 : t.missing) ?? []).filter((g) => g !== e) : t == null ? void 0 : t.missing, b = ((t == null ? void 0 : t.invalid) ?? []).filter(
|
|
3134
|
+
(g) => le.some((S) => S.field === g && S.computed_type === "write")
|
|
3135
|
+
), u = !!((x = t == null ? void 0 : t.invalid) != null && x.includes(e)) || b.length > 0, h = u ? ((t == null ? void 0 : t.invalid) ?? []).filter((g) => g !== e && !b.includes(g)) : t == null ? void 0 : t.invalid;
|
|
3136
|
+
if ((l || u) && ((p == null ? void 0 : p.length) ?? 0) === 0 && ((h == null ? void 0 : h.length) ?? 0) === 0 && St(null), Re(
|
|
3137
|
+
(g) => {
|
|
3133
3138
|
var S, L;
|
|
3134
|
-
return
|
|
3135
|
-
...
|
|
3139
|
+
return g && {
|
|
3140
|
+
...g,
|
|
3136
3141
|
draft: o,
|
|
3137
|
-
missing: (d || !c) && ((S =
|
|
3138
|
-
invalid: (L =
|
|
3142
|
+
missing: (d || !c) && ((S = g.missing) != null && S.includes(e)) ? g.missing.filter((T) => T !== e) : g.missing,
|
|
3143
|
+
invalid: (L = g.invalid) != null && L.length ? g.invalid.filter(
|
|
3139
3144
|
(T) => T !== e && !le.some((j) => j.field === T && j.computed_type === "write")
|
|
3140
|
-
) :
|
|
3145
|
+
) : g.invalid
|
|
3141
3146
|
};
|
|
3142
3147
|
}
|
|
3143
3148
|
), K && K.length > 0 && $) {
|
|
3144
|
-
const
|
|
3149
|
+
const g = Kt(), S = Ai(e, (t == null ? void 0 : t.draft) ?? {}, t == null ? void 0 : t.expected), L = { ...o };
|
|
3145
3150
|
for (const T of S) L[T] = null;
|
|
3146
3151
|
$.request(
|
|
3147
3152
|
je("/field-rules/evaluate", {
|
|
@@ -3149,7 +3154,7 @@ function vc({
|
|
|
3149
3154
|
data: L,
|
|
3150
3155
|
changed_field: e,
|
|
3151
3156
|
probe: !0,
|
|
3152
|
-
parent_context:
|
|
3157
|
+
parent_context: g,
|
|
3153
3158
|
row_rules: K
|
|
3154
3159
|
})
|
|
3155
3160
|
).then((T) => mo(r ?? "", i, T, S)).catch(() => {
|
|
@@ -3164,43 +3169,43 @@ function vc({
|
|
|
3164
3169
|
((u = Ye.current) == null ? void 0 : u.rowId) === e && Re(null);
|
|
3165
3170
|
};
|
|
3166
3171
|
if (We != null && We.length) {
|
|
3167
|
-
const u = m.rowId.startsWith("pending:"),
|
|
3168
|
-
if (E.some((
|
|
3169
|
-
if (String(
|
|
3170
|
-
const S = Y.has(String(
|
|
3172
|
+
const u = m.rowId.startsWith("pending:"), h = u ? parseInt(m.rowId.split(":")[1], 10) : null, v = m.rowId === "new" || u ? null : m.rowId, k = Gi(m.draft, We);
|
|
3173
|
+
if (E.some((g) => {
|
|
3174
|
+
if (String(g.id) === v || ze.has(String(g.id))) return !1;
|
|
3175
|
+
const S = Y.has(String(g.id)) ? { ...g, ...Y.get(String(g.id)) } : g;
|
|
3171
3176
|
return Gi(S, We) === k;
|
|
3172
|
-
}) || D.some((
|
|
3177
|
+
}) || D.some((g, S) => S !== h && Gi(g, We) === k))
|
|
3173
3178
|
return St(`A row with the same ${We.join(" + ")} already exists.`), !1;
|
|
3174
3179
|
}
|
|
3175
3180
|
const t = (u) => u == null || u === "", r = we.filter(
|
|
3176
3181
|
(u) => {
|
|
3177
|
-
var
|
|
3178
|
-
return u.required && !ir(u) && !((
|
|
3182
|
+
var h;
|
|
3183
|
+
return u.required && !ir(u) && !((h = m.locks) != null && h.includes(u.field)) && t(m.draft[u.field]);
|
|
3179
3184
|
}
|
|
3180
3185
|
);
|
|
3181
3186
|
if (r.length > 0)
|
|
3182
3187
|
return St(
|
|
3183
3188
|
`Required: ${r.map((u) => u.label || Se(u.field)).join(", ")}`
|
|
3184
3189
|
), Re(
|
|
3185
|
-
(u) => u && { ...u, missing: r.map((
|
|
3190
|
+
(u) => u && { ...u, missing: r.map((h) => h.field), invalid: void 0 }
|
|
3186
3191
|
), !1;
|
|
3187
3192
|
const i = Os(m.rowId), o = we.flatMap((u) => {
|
|
3188
3193
|
var v;
|
|
3189
3194
|
if (ir(u) || (v = m.locks) != null && v.includes(u.field)) return [];
|
|
3190
|
-
if (!
|
|
3195
|
+
if (!id.has(u.type ?? "")) return [];
|
|
3191
3196
|
if (i && String(i[u.field] ?? "") === String(m.draft[u.field] ?? ""))
|
|
3192
3197
|
return [];
|
|
3193
|
-
const
|
|
3198
|
+
const h = sd(m.draft[u.field], {
|
|
3194
3199
|
type: u.type,
|
|
3195
3200
|
label: u.label || Se(u.field)
|
|
3196
3201
|
});
|
|
3197
|
-
return
|
|
3202
|
+
return h.ok ? [] : [{ field: u.field, message: h.message }];
|
|
3198
3203
|
});
|
|
3199
3204
|
if (o.length > 0)
|
|
3200
3205
|
return St(o.map((u) => u.message).join(" · ")), Re(
|
|
3201
|
-
(u) => u && { ...u, invalid: o.map((
|
|
3206
|
+
(u) => u && { ...u, invalid: o.map((h) => h.field), missing: void 0 }
|
|
3202
3207
|
), !1;
|
|
3203
|
-
const d = i ? Jo(m.draft, i, new Set(Object.keys(m.draft))) : m.draft, c =
|
|
3208
|
+
const d = i ? Jo(m.draft, i, new Set(Object.keys(m.draft))) : m.draft, c = od(
|
|
3204
3209
|
le.map((u) => ({
|
|
3205
3210
|
field: u.field,
|
|
3206
3211
|
label: u.label || Se(u.field),
|
|
@@ -3212,9 +3217,9 @@ function vc({
|
|
|
3212
3217
|
);
|
|
3213
3218
|
if (c.length > 0)
|
|
3214
3219
|
return St(c.map((u) => u.message).join(" · ")), Re(
|
|
3215
|
-
(u) => u && { ...u, invalid: c.map((
|
|
3220
|
+
(u) => u && { ...u, invalid: c.map((h) => h.field), missing: void 0 }
|
|
3216
3221
|
), !1;
|
|
3217
|
-
const l =
|
|
3222
|
+
const l = ad(
|
|
3218
3223
|
le,
|
|
3219
3224
|
ce({ ...m.draft }),
|
|
3220
3225
|
i,
|
|
@@ -3222,23 +3227,23 @@ function vc({
|
|
|
3222
3227
|
);
|
|
3223
3228
|
if (l.length > 0)
|
|
3224
3229
|
return St(l.map((u) => u.message).join(" · ")), Re(
|
|
3225
|
-
(u) => u && { ...u, invalid: l.map((
|
|
3230
|
+
(u) => u && { ...u, invalid: l.map((h) => h.field), missing: void 0 }
|
|
3226
3231
|
), !1;
|
|
3227
3232
|
if (Ue != null && Ue.field && Ue.cap) {
|
|
3228
|
-
const u =
|
|
3233
|
+
const u = ht(Ue.cap, Zt);
|
|
3229
3234
|
if (u != null) {
|
|
3230
|
-
const
|
|
3235
|
+
const h = Ue.field, v = ce({ ...m.draft }), k = m.rowId.startsWith("pending:") ? Number(m.rowId.slice(8)) : -1, x = (E ?? []).some((j) => String(j.id) === m.rowId), g = (E ?? []).filter((j) => !ze.has(String(j.id)) && String(j.id) !== m.rowId).reduce((j, se) => {
|
|
3231
3236
|
const _e = String(se.id), F = Y.has(_e) ? { ...se, ...Y.get(_e) } : se;
|
|
3232
|
-
return j + (Number(ce(F)[
|
|
3237
|
+
return j + (Number(ce(F)[h]) || 0);
|
|
3233
3238
|
}, 0) + D.reduce(
|
|
3234
|
-
(j, se, _e) => _e === k ? j : j + (Number(ce(se)[
|
|
3239
|
+
(j, se, _e) => _e === k ? j : j + (Number(ce(se)[h]) || 0),
|
|
3235
3240
|
0
|
|
3236
3241
|
), S = x ? (() => {
|
|
3237
3242
|
const j = (E ?? []).find((_e) => String(_e.id) === m.rowId), se = Y.has(m.rowId) ? { ...j, ...Y.get(m.rowId) } : j;
|
|
3238
|
-
return Number(ce(se)[
|
|
3243
|
+
return Number(ce(se)[h]) || 0;
|
|
3239
3244
|
})() : k >= 0 && Number(
|
|
3240
|
-
ce(D[k])[
|
|
3241
|
-
) || 0, L =
|
|
3245
|
+
ce(D[k])[h]
|
|
3246
|
+
) || 0, L = g + S, T = g + (Number(v[h]) || 0);
|
|
3242
3247
|
if (T > u + 5e-3 && T > L + 5e-3) {
|
|
3243
3248
|
const j = (se) => Ue.format === "currency" ? se.toLocaleString("en-US", { style: "currency", currency: "USD" }) : se.toLocaleString("en-US", { maximumFractionDigits: 2 });
|
|
3244
3249
|
return St(
|
|
@@ -3252,13 +3257,13 @@ function vc({
|
|
|
3252
3257
|
p && !(i && Qo(le, i)) && me.warning(`${p} is 0 — this is a $0 line. Remove it if it is not needed.`), un(!0);
|
|
3253
3258
|
try {
|
|
3254
3259
|
if (m.rowId.startsWith("pending:")) {
|
|
3255
|
-
const u = parseInt(m.rowId.split(":")[1], 10),
|
|
3256
|
-
return w == null || w.updateRow(s, f, u, m.draft),
|
|
3260
|
+
const u = parseInt(m.rowId.split(":")[1], 10), h = D[u];
|
|
3261
|
+
return w == null || w.updateRow(s, f, u, m.draft), h != null && h.__prefilled && (h == null ? void 0 : h.id) != null && Ca((v) => /* @__PURE__ */ new Set([...v, h.id])), n(), un(!1), !0;
|
|
3257
3262
|
}
|
|
3258
3263
|
if (m.rowId === "new") {
|
|
3259
3264
|
if ((A || P) && w)
|
|
3260
3265
|
return w.queueRow(s, f, Qn({ ...m.draft })), n(), !0;
|
|
3261
|
-
const u = Object.entries(m.draft).filter(([S]) => S.startsWith("__m2m_")),
|
|
3266
|
+
const u = Object.entries(m.draft).filter(([S]) => S.startsWith("__m2m_")), h = Object.entries(m.draft).filter(([S]) => S.startsWith("__o2m_")), v = Object.fromEntries(
|
|
3262
3267
|
Object.entries(m.draft).filter(
|
|
3263
3268
|
([S]) => !S.startsWith("__m2m_") && !S.startsWith("__o2m_")
|
|
3264
3269
|
)
|
|
@@ -3288,8 +3293,8 @@ function vc({
|
|
|
3288
3293
|
}), un(!1), !1;
|
|
3289
3294
|
throw S;
|
|
3290
3295
|
}
|
|
3291
|
-
const
|
|
3292
|
-
if (Rt.current = Date.now(),
|
|
3296
|
+
const g = (b = x == null ? void 0 : x.data) == null ? void 0 : b.id;
|
|
3297
|
+
if (Rt.current = Date.now(), g != null && ft(String(g)), g != null && u.length && await Promise.all(
|
|
3293
3298
|
u.map(([S, L]) => {
|
|
3294
3299
|
if (L == null) return Promise.resolve();
|
|
3295
3300
|
const T = S.slice(6), j = ui({
|
|
@@ -3298,22 +3303,22 @@ function vc({
|
|
|
3298
3303
|
});
|
|
3299
3304
|
return j ? $.request(
|
|
3300
3305
|
je(`/items/${j.junctionCollection}`, {
|
|
3301
|
-
[j.junctionManyField]:
|
|
3306
|
+
[j.junctionManyField]: g,
|
|
3302
3307
|
[j.junctionOtherField]: L
|
|
3303
3308
|
})
|
|
3304
3309
|
) : Promise.resolve();
|
|
3305
3310
|
})
|
|
3306
|
-
),
|
|
3311
|
+
), h.length) {
|
|
3307
3312
|
const S = [];
|
|
3308
3313
|
let L = "", T = 0, j = 0;
|
|
3309
|
-
for (const [_e, F] of
|
|
3314
|
+
for (const [_e, F] of h) {
|
|
3310
3315
|
const ye = _e.slice(6), ue = Array.isArray(F) ? F : [];
|
|
3311
3316
|
if (ue.length === 0) continue;
|
|
3312
3317
|
T += ue.length;
|
|
3313
3318
|
const ee = Pe.find(
|
|
3314
3319
|
(nt) => nt.one_collection === s && nt.one_field === ye
|
|
3315
3320
|
);
|
|
3316
|
-
if (
|
|
3321
|
+
if (g == null || !(ee != null && ee.many_collection) || !ee.many_field) {
|
|
3317
3322
|
j += ue.length;
|
|
3318
3323
|
continue;
|
|
3319
3324
|
}
|
|
@@ -3323,7 +3328,7 @@ function vc({
|
|
|
3323
3328
|
await $.request(
|
|
3324
3329
|
je(`/items/${ee.many_collection}`, {
|
|
3325
3330
|
...nt,
|
|
3326
|
-
[ee.many_field]:
|
|
3331
|
+
[ee.many_field]: g
|
|
3327
3332
|
})
|
|
3328
3333
|
);
|
|
3329
3334
|
} catch (On) {
|
|
@@ -3333,32 +3338,32 @@ function vc({
|
|
|
3333
3338
|
label: Se(ye),
|
|
3334
3339
|
collection: ee.many_collection,
|
|
3335
3340
|
fkField: ee.many_field,
|
|
3336
|
-
rowId:
|
|
3341
|
+
rowId: g,
|
|
3337
3342
|
members: tt
|
|
3338
3343
|
});
|
|
3339
3344
|
}
|
|
3340
3345
|
const se = S.reduce((_e, F) => _e + F.members.length, 0);
|
|
3341
|
-
j > 0 ?
|
|
3346
|
+
j > 0 ? gr({
|
|
3342
3347
|
text: `The line saved, but ${j} of ${T} nested row${T === 1 ? "" : "s"} could not be attached — the server did not return the new line's id. Open the line and add them again.`,
|
|
3343
3348
|
groups: []
|
|
3344
|
-
}) : se > 0 &&
|
|
3349
|
+
}) : se > 0 && gr({
|
|
3345
3350
|
text: `${se} of ${T} ${S.map((_e) => _e.label).join(", ")} row${T === 1 ? "" : "s"} did not save — ${L}`,
|
|
3346
3351
|
groups: S
|
|
3347
3352
|
});
|
|
3348
3353
|
}
|
|
3349
3354
|
V.invalidateQueries({ queryKey: ["o2m-rows", s, f, y] });
|
|
3350
3355
|
} else {
|
|
3351
|
-
const u = (K ?? []).filter((S) => S.target_type !== "lock").map((S) => S.target_field).filter((S) => typeof S == "string" && S.length > 0 && S !== "id"),
|
|
3356
|
+
const u = (K ?? []).filter((S) => S.target_type !== "lock").map((S) => S.target_field).filter((S) => typeof S == "string" && S.length > 0 && S !== "id"), h = /* @__PURE__ */ new Set([
|
|
3352
3357
|
...we.map((S) => S.field).filter((S) => !S.startsWith("__m2m_")),
|
|
3353
3358
|
...u,
|
|
3354
3359
|
// A reason an editor action prefilled (carry-forward) rides the row:
|
|
3355
3360
|
// the server stores it on the activity row, never in a column.
|
|
3356
3361
|
"_change_reason"
|
|
3357
|
-
]), v = E.find((S) => String(S.id) === m.rowId), k = Jo(m.draft, v,
|
|
3362
|
+
]), v = E.find((S) => String(S.id) === m.rowId), k = Jo(m.draft, v, h);
|
|
3358
3363
|
if (P && w) {
|
|
3359
3364
|
const S = Object.entries(m.draft).filter(
|
|
3360
3365
|
([_e]) => _e.startsWith("__nested_ops_")
|
|
3361
|
-
), L = k, { rest: T, reverted: j } =
|
|
3366
|
+
), L = k, { rest: T, reverted: j } = ld(
|
|
3362
3367
|
Y.get(m.rowId),
|
|
3363
3368
|
m.draft,
|
|
3364
3369
|
v
|
|
@@ -3370,7 +3375,7 @@ function vc({
|
|
|
3370
3375
|
...L,
|
|
3371
3376
|
...Object.fromEntries(S)
|
|
3372
3377
|
};
|
|
3373
|
-
if (
|
|
3378
|
+
if (dd(_e)) {
|
|
3374
3379
|
const F = await Ii(m.rowId);
|
|
3375
3380
|
w.queueEdit(s, f, m.rowId, {
|
|
3376
3381
|
..._e,
|
|
@@ -3390,10 +3395,10 @@ function vc({
|
|
|
3390
3395
|
}
|
|
3391
3396
|
if (Object.keys(k).length === 0)
|
|
3392
3397
|
return n(), !0;
|
|
3393
|
-
const x = await Ii(m.rowId),
|
|
3398
|
+
const x = await Ii(m.rowId), g = (S) => x != null ? { ...S, _base_revision: x } : S;
|
|
3394
3399
|
try {
|
|
3395
3400
|
await $.request(
|
|
3396
|
-
Fr(`/items/${s}/${m.rowId}${lt}`,
|
|
3401
|
+
Fr(`/items/${s}/${m.rowId}${lt}`, g(k))
|
|
3397
3402
|
);
|
|
3398
3403
|
} catch (S) {
|
|
3399
3404
|
const L = Wi(S);
|
|
@@ -3403,14 +3408,14 @@ function vc({
|
|
|
3403
3408
|
challenge: L,
|
|
3404
3409
|
retry: async (se) => {
|
|
3405
3410
|
await $.request(
|
|
3406
|
-
Fr(j,
|
|
3411
|
+
Fr(j, g({ ...k, _change_reason: se }))
|
|
3407
3412
|
), Pt.current.delete(e), $t.forget(e), ft(e), V.invalidateQueries({
|
|
3408
3413
|
queryKey: ["o2m-rows", s, f, y]
|
|
3409
3414
|
}), n();
|
|
3410
3415
|
}
|
|
3411
3416
|
}), un(!1), !1;
|
|
3412
3417
|
}
|
|
3413
|
-
const T =
|
|
3418
|
+
const T = Tl(S);
|
|
3414
3419
|
if (T)
|
|
3415
3420
|
return Pt.current.set(e, Promise.resolve(T.latest || null)), T.latest > 0 && $t.set(e, T.latest), V.invalidateQueries({ queryKey: ["o2m-rows", s, f, y] }), me.warning(
|
|
3416
3421
|
"Someone else changed this line while you edited it — take their values or keep yours, then save again"
|
|
@@ -3426,7 +3431,7 @@ function vc({
|
|
|
3426
3431
|
un(!1);
|
|
3427
3432
|
}
|
|
3428
3433
|
}
|
|
3429
|
-
const [Ga, Ca] = Q(/* @__PURE__ */ new Set()), [vt,
|
|
3434
|
+
const [Ga, Ca] = Q(/* @__PURE__ */ new Set()), [vt, ho] = Q(null), [Wt, go] = Q(null), [Xa, bo] = Q(!1), [rn, Za] = Q(1), [sn, $n] = Q(!1), [yo, el] = Q(!1), [Li, tl] = Q({}), [vo, xo] = Q(!1), [wo, Dr] = Q(!1), [Ti, nl] = Q("empty-only"), [Wr, _o] = Q(null), [Ut, qn] = Q(null), [on, ko] = Q({}), [No, So] = Q(!1);
|
|
3430
3435
|
function rl(e, n) {
|
|
3431
3436
|
tl((t) => ({ ...t, [e]: n }));
|
|
3432
3437
|
}
|
|
@@ -3495,7 +3500,7 @@ function vc({
|
|
|
3495
3500
|
if (!e || Mt.unmatchedCandidates.length === 0) return;
|
|
3496
3501
|
const n = Mt.unmatchedCandidates.map((t) => ({
|
|
3497
3502
|
...Ct,
|
|
3498
|
-
...
|
|
3503
|
+
...yd(e, t)
|
|
3499
3504
|
}));
|
|
3500
3505
|
if ((A || P) && w) {
|
|
3501
3506
|
for (const t of Xt(n)) w.queueRow(s, f, t);
|
|
@@ -3534,13 +3539,13 @@ function vc({
|
|
|
3534
3539
|
}
|
|
3535
3540
|
}
|
|
3536
3541
|
function qo(e) {
|
|
3537
|
-
|
|
3542
|
+
ho(e);
|
|
3538
3543
|
}
|
|
3539
3544
|
function Eo(e, n) {
|
|
3540
|
-
e.preventDefault(),
|
|
3545
|
+
e.preventDefault(), go(n);
|
|
3541
3546
|
}
|
|
3542
3547
|
function En() {
|
|
3543
|
-
|
|
3548
|
+
ho(null), go(null);
|
|
3544
3549
|
}
|
|
3545
3550
|
async function al(e) {
|
|
3546
3551
|
if (e.preventDefault(), vt === null || Wt === null || vt === Wt) {
|
|
@@ -3601,12 +3606,12 @@ function vc({
|
|
|
3601
3606
|
if (e.interface === "formula-column") {
|
|
3602
3607
|
const b = typeof i.column_formula == "string" ? i.column_formula : "";
|
|
3603
3608
|
if (!b || !t && !r) return /* @__PURE__ */ a("span", { className: "text-slate-300", children: "—" });
|
|
3604
|
-
const u = r ?? E.find((
|
|
3609
|
+
const u = r ?? E.find((g) => String(g.id) === t) ?? {}, h = (g) => typeof g == "string" && /^-?\d+(\.\d+)?$/.test(g.trim()) ? Number(g) : g, v = ht(
|
|
3605
3610
|
b,
|
|
3606
|
-
(
|
|
3611
|
+
(g) => {
|
|
3607
3612
|
var S, L;
|
|
3608
|
-
return
|
|
3609
|
-
|
|
3613
|
+
return h(
|
|
3614
|
+
g.includes(".") ? t ? (L = (S = Oe == null ? void 0 : Oe.rows[t]) == null ? void 0 : S[g]) == null ? void 0 : L.value : void 0 : u[g]
|
|
3610
3615
|
);
|
|
3611
3616
|
}
|
|
3612
3617
|
);
|
|
@@ -3614,7 +3619,7 @@ function vc({
|
|
|
3614
3619
|
const k = v.toLocaleString(
|
|
3615
3620
|
"en-US",
|
|
3616
3621
|
xt(i, i.format)
|
|
3617
|
-
), x = b.replace(/\{\{\s*([^}]+?)\s*\}\}/g, (
|
|
3622
|
+
), x = b.replace(/\{\{\s*([^}]+?)\s*\}\}/g, (g, S) => {
|
|
3618
3623
|
var T, j;
|
|
3619
3624
|
const L = S.includes(".") ? t ? (j = (T = Oe == null ? void 0 : Oe.rows[t]) == null ? void 0 : T[S]) == null ? void 0 : j.value : void 0 : u[S];
|
|
3620
3625
|
return L == null || L === "" ? "0" : String(L);
|
|
@@ -3624,23 +3629,23 @@ function vc({
|
|
|
3624
3629
|
if (e.interface === "match-agg-column") {
|
|
3625
3630
|
const b = ka.get(e.field);
|
|
3626
3631
|
if (!b || !t) return /* @__PURE__ */ a("span", { className: "text-slate-300", children: "—" });
|
|
3627
|
-
const u = E.find((
|
|
3632
|
+
const u = E.find((g) => String(g.id) === t) ?? {}, h = (g, S) => S.split(".").reduce(
|
|
3628
3633
|
(L, T) => L && typeof L == "object" ? L[T] : void 0,
|
|
3629
|
-
|
|
3634
|
+
g
|
|
3630
3635
|
), v = b.rows.filter(
|
|
3631
|
-
(
|
|
3632
|
-
const T = g
|
|
3636
|
+
(g) => b.cfg.rowKeys.every(([S, L]) => {
|
|
3637
|
+
const T = h(g, S), j = u[L];
|
|
3633
3638
|
return T == null || j === null || j === void 0 ? !1 : String(T) === String(j);
|
|
3634
3639
|
})
|
|
3635
3640
|
);
|
|
3636
|
-
let k = b.cfg.aggregate === "count" ? v.length : v.reduce((
|
|
3641
|
+
let k = b.cfg.aggregate === "count" ? v.length : v.reduce((g, S) => g + (Number(S[b.cfg.valueField]) || 0), 0);
|
|
3637
3642
|
if (b.cfg.formula) {
|
|
3638
|
-
const
|
|
3643
|
+
const g = ht(b.cfg.formula, {
|
|
3639
3644
|
...u,
|
|
3640
3645
|
__agg__: k
|
|
3641
3646
|
});
|
|
3642
|
-
if (
|
|
3643
|
-
k =
|
|
3647
|
+
if (g === null) return /* @__PURE__ */ a("span", { className: "text-slate-300", children: "—" });
|
|
3648
|
+
k = g;
|
|
3644
3649
|
}
|
|
3645
3650
|
const x = k.toLocaleString(
|
|
3646
3651
|
"en-US",
|
|
@@ -3665,16 +3670,16 @@ function vc({
|
|
|
3665
3670
|
);
|
|
3666
3671
|
}
|
|
3667
3672
|
if (n == null) return /* @__PURE__ */ a("span", { className: "text-slate-300", children: "—" });
|
|
3668
|
-
if (e.interface === "relation-path" &&
|
|
3669
|
-
const b = Po(e), u = (c = Oe == null ? void 0 : Oe.rows[t]) == null ? void 0 : c[e.field],
|
|
3670
|
-
if (b && u &&
|
|
3673
|
+
if (e.interface === "relation-path" && ge && t) {
|
|
3674
|
+
const b = Po(e), u = (c = Oe == null ? void 0 : Oe.rows[t]) == null ? void 0 : c[e.field], h = Oe == null ? void 0 : Oe.targets[e.field];
|
|
3675
|
+
if (b && u && h && u.ids.length > 0)
|
|
3671
3676
|
return /* @__PURE__ */ a(
|
|
3672
3677
|
"button",
|
|
3673
3678
|
{
|
|
3674
3679
|
type: "button",
|
|
3675
3680
|
onClick: (v) => {
|
|
3676
|
-
v.stopPropagation(),
|
|
3677
|
-
collection:
|
|
3681
|
+
v.stopPropagation(), ge.open({
|
|
3682
|
+
collection: h,
|
|
3678
3683
|
itemId: u.ids[0],
|
|
3679
3684
|
layoutId: b.layout_id,
|
|
3680
3685
|
width: b.width,
|
|
@@ -3691,14 +3696,14 @@ function vc({
|
|
|
3691
3696
|
const b = (l = Sn[o.one_collection]) == null ? void 0 : l[String(n)];
|
|
3692
3697
|
if (!b && Va)
|
|
3693
3698
|
return /* @__PURE__ */ a(Ln, { className: "h-3 w-3 animate-spin text-slate-300" });
|
|
3694
|
-
const u =
|
|
3699
|
+
const u = ge ? Po(e) : null, h = n != null && ((p = qi.get(e.field)) == null ? void 0 : p.has(String(n))) === !0;
|
|
3695
3700
|
let v;
|
|
3696
|
-
return u &&
|
|
3701
|
+
return u && ge ? v = /* @__PURE__ */ a(
|
|
3697
3702
|
"button",
|
|
3698
3703
|
{
|
|
3699
3704
|
type: "button",
|
|
3700
3705
|
onClick: (k) => {
|
|
3701
|
-
k.stopPropagation(),
|
|
3706
|
+
k.stopPropagation(), ge.open({
|
|
3702
3707
|
collection: o.one_collection,
|
|
3703
3708
|
itemId: String(n),
|
|
3704
3709
|
layoutId: u.layout_id,
|
|
@@ -3709,13 +3714,13 @@ function vc({
|
|
|
3709
3714
|
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",
|
|
3710
3715
|
children: b ?? String(n)
|
|
3711
3716
|
}
|
|
3712
|
-
) : v = /* @__PURE__ */ a("span", { className: "block truncate", children: b ?? String(n) }),
|
|
3717
|
+
) : v = /* @__PURE__ */ a("span", { className: "block truncate", children: b ?? String(n) }), h ? /* @__PURE__ */ a(Nd, { children: v }) : v;
|
|
3713
3718
|
}
|
|
3714
3719
|
if (e.type === "boolean")
|
|
3715
3720
|
return /* @__PURE__ */ a("span", { className: n ? "text-emerald-600" : "text-slate-400", children: n ? "Yes" : "No" });
|
|
3716
3721
|
if (e.type === "datetime" || e.type === "date")
|
|
3717
3722
|
try {
|
|
3718
|
-
return /* @__PURE__ */ a("span", { className: "block truncate", children:
|
|
3723
|
+
return /* @__PURE__ */ a("span", { className: "block truncate", children: Ml(n) });
|
|
3719
3724
|
} catch {
|
|
3720
3725
|
}
|
|
3721
3726
|
if ([
|
|
@@ -3737,17 +3742,17 @@ function vc({
|
|
|
3737
3742
|
const b = Number(n);
|
|
3738
3743
|
if (!Number.isNaN(b))
|
|
3739
3744
|
try {
|
|
3740
|
-
const u = e.options ? typeof e.options == "string" ? JSON.parse(e.options) : e.options : {},
|
|
3741
|
-
if (
|
|
3745
|
+
const u = e.options ? typeof e.options == "string" ? JSON.parse(e.options) : e.options : {}, h = u.format;
|
|
3746
|
+
if (h === "int")
|
|
3742
3747
|
return /* @__PURE__ */ a("span", { className: "block truncate tabular-nums", children: new Intl.NumberFormat(void 0, { maximumFractionDigits: 0 }).format(b) });
|
|
3743
|
-
if (
|
|
3748
|
+
if (h === "decimal") {
|
|
3744
3749
|
const v = typeof u.precision == "number" ? u.precision : 2;
|
|
3745
3750
|
return /* @__PURE__ */ a("span", { className: "block truncate tabular-nums", children: new Intl.NumberFormat(void 0, {
|
|
3746
3751
|
minimumFractionDigits: v,
|
|
3747
3752
|
maximumFractionDigits: v
|
|
3748
3753
|
}).format(b) });
|
|
3749
3754
|
}
|
|
3750
|
-
if (
|
|
3755
|
+
if (h === "currency") {
|
|
3751
3756
|
const v = u.currency || "USD";
|
|
3752
3757
|
return /* @__PURE__ */ a("span", { className: "block truncate tabular-nums", children: new Intl.NumberFormat(void 0, {
|
|
3753
3758
|
...xt(i, "currency"),
|
|
@@ -3855,10 +3860,10 @@ function vc({
|
|
|
3855
3860
|
...i
|
|
3856
3861
|
]), d = [];
|
|
3857
3862
|
for (const u of n) {
|
|
3858
|
-
let
|
|
3863
|
+
let h = ce({ ...u.row, ...e }), v = [], k;
|
|
3859
3864
|
if (K != null && K.length) {
|
|
3860
3865
|
try {
|
|
3861
|
-
const
|
|
3866
|
+
const g = await $.request(
|
|
3862
3867
|
je("/field-rules/evaluate", {
|
|
3863
3868
|
collection: s,
|
|
3864
3869
|
data: u.row,
|
|
@@ -3869,19 +3874,19 @@ function vc({
|
|
|
3869
3874
|
row_rules: K
|
|
3870
3875
|
})
|
|
3871
3876
|
);
|
|
3872
|
-
v =
|
|
3877
|
+
v = g.locks ?? [], k = g.expected;
|
|
3873
3878
|
} catch {
|
|
3874
3879
|
}
|
|
3875
|
-
for (const
|
|
3876
|
-
if (v.includes(
|
|
3877
|
-
const S = Ai(
|
|
3880
|
+
for (const g of r) {
|
|
3881
|
+
if (v.includes(g)) continue;
|
|
3882
|
+
const S = Ai(g, { ...u.row }, k), L = { ...h };
|
|
3878
3883
|
for (const T of S) L[T] = null;
|
|
3879
3884
|
try {
|
|
3880
3885
|
const T = await $.request(
|
|
3881
3886
|
je("/field-rules/evaluate", {
|
|
3882
3887
|
collection: s,
|
|
3883
3888
|
data: L,
|
|
3884
|
-
changed_field:
|
|
3889
|
+
changed_field: g,
|
|
3885
3890
|
probe: !0,
|
|
3886
3891
|
parent_context: Kt(),
|
|
3887
3892
|
parent_collection: O,
|
|
@@ -3891,39 +3896,39 @@ function vc({
|
|
|
3891
3896
|
for (const [se, _e] of Object.entries(T.updates ?? {}))
|
|
3892
3897
|
se in e || (j[se] = _e);
|
|
3893
3898
|
for (const se of S) !(se in j) && !(se in e) && (j[se] = null);
|
|
3894
|
-
|
|
3899
|
+
h = ce({ ...h, ...j }), v = T.locks ?? v, k = T.expected ?? k;
|
|
3895
3900
|
} catch {
|
|
3896
3901
|
}
|
|
3897
3902
|
}
|
|
3898
3903
|
}
|
|
3899
3904
|
const x = {};
|
|
3900
|
-
for (const
|
|
3901
|
-
for (const [
|
|
3902
|
-
|
|
3905
|
+
for (const g of r) v.includes(g) || (x[g] = e[g] ?? null);
|
|
3906
|
+
for (const [g, S] of Object.entries(h))
|
|
3907
|
+
g in x || g === "id" || g === f || ai.has(g) || !o.has(g) || String(S ?? "") !== String(u.row[g] ?? "") && (x[g] = S);
|
|
3903
3908
|
d.push({ t: u, changes: x });
|
|
3904
3909
|
}
|
|
3905
|
-
const c = (u,
|
|
3910
|
+
const c = (u, h) => {
|
|
3906
3911
|
t.clearSelection && fr(/* @__PURE__ */ new Set());
|
|
3907
3912
|
const v = u === 1 ? t.noun : `${t.noun}s`;
|
|
3908
|
-
|
|
3909
|
-
`Applied to ${u} ${v} — ${
|
|
3913
|
+
h.length ? me.error(
|
|
3914
|
+
`Applied to ${u} ${v} — ${h.length} failed: ${h.slice(0, 3).join("; ")}`
|
|
3910
3915
|
) : me.success(`Applied to ${u} ${v}`);
|
|
3911
3916
|
};
|
|
3912
3917
|
if ((A || P) && w) {
|
|
3913
3918
|
let u = 0;
|
|
3914
|
-
for (const { t:
|
|
3915
|
-
Object.keys(v).length !== 0 && (
|
|
3916
|
-
...D[
|
|
3919
|
+
for (const { t: h, changes: v } of d)
|
|
3920
|
+
Object.keys(v).length !== 0 && (h.kind === "pending" ? w.updateRow(s, f, h.idx, {
|
|
3921
|
+
...D[h.idx] ?? h.row,
|
|
3917
3922
|
...v
|
|
3918
|
-
}) : w.queueEdit(s, f,
|
|
3923
|
+
}) : w.queueEdit(s, f, h.key, {
|
|
3919
3924
|
...v,
|
|
3920
|
-
...mn(
|
|
3925
|
+
...mn(h.key)
|
|
3921
3926
|
}), u++);
|
|
3922
3927
|
c(u, []);
|
|
3923
3928
|
return;
|
|
3924
3929
|
}
|
|
3925
3930
|
let l = 0;
|
|
3926
|
-
const p = [], b = async (u,
|
|
3931
|
+
const p = [], b = async (u, h) => {
|
|
3927
3932
|
for (let v = u; v < d.length; v++) {
|
|
3928
3933
|
const { t: k, changes: x } = d[v];
|
|
3929
3934
|
if (Object.keys(x).length !== 0) {
|
|
@@ -3938,15 +3943,15 @@ function vc({
|
|
|
3938
3943
|
await pn.current(
|
|
3939
3944
|
`/items/${s}/${k.key}${lt}`,
|
|
3940
3945
|
k.key,
|
|
3941
|
-
|
|
3946
|
+
h ? { ...x, _change_reason: h } : x
|
|
3942
3947
|
) && l++;
|
|
3943
|
-
} catch (
|
|
3944
|
-
const S =
|
|
3948
|
+
} catch (g) {
|
|
3949
|
+
const S = h ? null : Wi(g);
|
|
3945
3950
|
if (S) {
|
|
3946
3951
|
Kn({ challenge: S, retry: (L) => b(v, L) }), V.invalidateQueries({ queryKey: ["o2m-rows", s, f, y] });
|
|
3947
3952
|
return;
|
|
3948
3953
|
}
|
|
3949
|
-
p.push(`#${k.key} ${jn(
|
|
3954
|
+
p.push(`#${k.key} ${jn(g, "failed")}`);
|
|
3950
3955
|
}
|
|
3951
3956
|
}
|
|
3952
3957
|
}
|
|
@@ -3990,11 +3995,11 @@ function vc({
|
|
|
3990
3995
|
for (const c of (o == null ? void 0 : o.sources) ?? []) {
|
|
3991
3996
|
const l = (Z ?? []).map((v) => typeof v == "string" ? v : v.field), p = l.find((v) => v === c.related_collection) ?? (l.length === 1 ? l[0] : void 0), b = p ? e[`__o2m_${p}`] : void 0, u = (p ? kr[`${t}|${p}`] : void 0) ?? b;
|
|
3992
3997
|
if (!u) continue;
|
|
3993
|
-
const
|
|
3994
|
-
if (
|
|
3998
|
+
const h = c.aggregate ?? "sum";
|
|
3999
|
+
if (h === "count") d = (d ?? 0) + u.length;
|
|
3995
4000
|
else {
|
|
3996
4001
|
const v = u.map((k) => Number(k[c.value_field ?? ""] ?? 0)).filter(Number.isFinite);
|
|
3997
|
-
|
|
4002
|
+
h === "sum" ? d = (d ?? 0) + v.reduce((k, x) => k + x, 0) : h === "avg" ? d = (d ?? 0) + (v.length ? v.reduce((k, x) => k + x, 0) / v.length : 0) : h === "min" ? d = (d ?? 0) + (v.length ? Math.min(...v) : 0) : h === "max" && (d = (d ?? 0) + (v.length ? Math.max(...v) : 0));
|
|
3998
4003
|
}
|
|
3999
4004
|
}
|
|
4000
4005
|
d != null && (r[i.field] = d);
|
|
@@ -4103,11 +4108,11 @@ function vc({
|
|
|
4103
4108
|
} catch {
|
|
4104
4109
|
return {};
|
|
4105
4110
|
}
|
|
4106
|
-
})() : i.options : {}, l = typeof c.column_formula == "string" ? c.column_formula : "", p = i.interface === "formula-column" && l ?
|
|
4111
|
+
})() : i.options : {}, l = typeof c.column_formula == "string" ? c.column_formula : "", p = i.interface === "formula-column" && l ? ht(
|
|
4107
4112
|
l,
|
|
4108
4113
|
(b) => {
|
|
4109
|
-
var u,
|
|
4110
|
-
return b.includes(".") ? (
|
|
4114
|
+
var u, h;
|
|
4115
|
+
return b.includes(".") ? (h = (u = Oe == null ? void 0 : Oe.rows[e.rowId ?? ""]) == null ? void 0 : u[b]) == null ? void 0 : h.value : r[b];
|
|
4111
4116
|
}
|
|
4112
4117
|
) : null;
|
|
4113
4118
|
return /* @__PURE__ */ _("div", { className: "flex min-w-0 flex-col justify-start", children: [
|
|
@@ -4155,9 +4160,9 @@ function vc({
|
|
|
4155
4160
|
i,
|
|
4156
4161
|
d && /* @__PURE__ */ a("span", { className: "ml-1 normal-case tracking-normal", children: "· required" }),
|
|
4157
4162
|
(() => {
|
|
4158
|
-
var
|
|
4159
|
-
const
|
|
4160
|
-
if (!
|
|
4163
|
+
var g, S;
|
|
4164
|
+
const h = Fa(t.field);
|
|
4165
|
+
if (!h) return null;
|
|
4161
4166
|
const v = Be.get(t.field), k = (L) => {
|
|
4162
4167
|
var T;
|
|
4163
4168
|
return (v != null && v.one_collection ? (T = Sn[v.one_collection]) == null ? void 0 : T[String(L)] : void 0) ?? String(L);
|
|
@@ -4166,13 +4171,13 @@ function vc({
|
|
|
4166
4171
|
return ((T = we.find((j) => j.field === L)) == null ? void 0 : T.label) ?? L.replace(/_/g, " ");
|
|
4167
4172
|
};
|
|
4168
4173
|
return /* @__PURE__ */ a(
|
|
4169
|
-
|
|
4174
|
+
wd,
|
|
4170
4175
|
{
|
|
4171
|
-
kind:
|
|
4172
|
-
provenance: (
|
|
4176
|
+
kind: h,
|
|
4177
|
+
provenance: (g = m == null ? void 0 : m.provenance) == null ? void 0 : g[t.field],
|
|
4173
4178
|
labelOf: k,
|
|
4174
4179
|
fieldLabel: x,
|
|
4175
|
-
onReset:
|
|
4180
|
+
onReset: h === "overridden" && !q && !((S = m == null ? void 0 : m.locks) != null && S.includes(t.field)) ? () => Ha(t.field) : void 0
|
|
4176
4181
|
}
|
|
4177
4182
|
);
|
|
4178
4183
|
})()
|
|
@@ -4182,12 +4187,12 @@ function vc({
|
|
|
4182
4187
|
r ? /* @__PURE__ */ a("div", { className: "text-[12px] italic text-slate-500", children: De(
|
|
4183
4188
|
t,
|
|
4184
4189
|
Qt(t.computed_formula, e.draft) ?? e.draft[t.field]
|
|
4185
|
-
) }) : o || t.readonly || Er(t) || (b = m == null ? void 0 : m.locks) != null && b.includes(t.field) ||
|
|
4190
|
+
) }) : o || t.readonly || Er(t) || (b = m == null ? void 0 : m.locks) != null && b.includes(t.field) || gi(t.field, e.draft) ? /* @__PURE__ */ a(
|
|
4186
4191
|
"div",
|
|
4187
4192
|
{
|
|
4188
4193
|
className: "text-[12px] text-slate-500",
|
|
4189
|
-
"data-compare-locked":
|
|
4190
|
-
"data-tip": (u = m == null ? void 0 : m.locks) != null && u.includes(t.field) ? fo(t.field) :
|
|
4194
|
+
"data-compare-locked": gi(t.field, e.draft) ? t.field : void 0,
|
|
4195
|
+
"data-tip": (u = m == null ? void 0 : m.locks) != null && u.includes(t.field) ? fo(t.field) : gi(t.field, e.draft) ? (I == null ? void 0 : I.closed_locked_message) || "This month is closed — only reconciling it to the actual is allowed" : void 0,
|
|
4191
4196
|
children: De(t, e.draft[t.field], e.rowId)
|
|
4192
4197
|
}
|
|
4193
4198
|
) : m != null && m.locksPending && Rn.has(t.field) ? (
|
|
@@ -4207,7 +4212,7 @@ function vc({
|
|
|
4207
4212
|
{
|
|
4208
4213
|
field: { ...t, sort: t.sort ?? 0 },
|
|
4209
4214
|
value: e.draft[t.field] ?? null,
|
|
4210
|
-
onChange: (
|
|
4215
|
+
onChange: (h) => pt(t.field, h),
|
|
4211
4216
|
relations: Pe,
|
|
4212
4217
|
collection: s,
|
|
4213
4218
|
itemId: e.rowId ?? "new",
|
|
@@ -4216,7 +4221,7 @@ function vc({
|
|
|
4216
4221
|
}
|
|
4217
4222
|
),
|
|
4218
4223
|
I && I.columns.includes(t.field) && (() => {
|
|
4219
|
-
const
|
|
4224
|
+
const h = Qi(I, e.draft), v = h == null ? void 0 : h.values[t.field], k = Jt(
|
|
4220
4225
|
I,
|
|
4221
4226
|
e.draft[I.key_field],
|
|
4222
4227
|
t.field
|
|
@@ -4241,7 +4246,7 @@ function vc({
|
|
|
4241
4246
|
}
|
|
4242
4247
|
),
|
|
4243
4248
|
k && !q && /* @__PURE__ */ a(
|
|
4244
|
-
|
|
4249
|
+
Cl,
|
|
4245
4250
|
{
|
|
4246
4251
|
data: I,
|
|
4247
4252
|
rowKey: e.draft[I.key_field],
|
|
@@ -4250,7 +4255,7 @@ function vc({
|
|
|
4250
4255
|
plannedRow: e.draft,
|
|
4251
4256
|
actual: v ?? 0,
|
|
4252
4257
|
variant: "button",
|
|
4253
|
-
onApply: (x,
|
|
4258
|
+
onApply: (x, g) => ji({ ...x, _change_reason: g })
|
|
4254
4259
|
}
|
|
4255
4260
|
)
|
|
4256
4261
|
]
|
|
@@ -4265,11 +4270,11 @@ function vc({
|
|
|
4265
4270
|
}
|
|
4266
4271
|
),
|
|
4267
4272
|
xe && ((n = xe.fields) == null ? void 0 : n.length) > 0 && !q && /* @__PURE__ */ a(
|
|
4268
|
-
|
|
4273
|
+
Ld,
|
|
4269
4274
|
{
|
|
4270
4275
|
config: xe,
|
|
4271
4276
|
draft: e.draft,
|
|
4272
|
-
remaining:
|
|
4277
|
+
remaining: ht(xe.remaining, Zt),
|
|
4273
4278
|
onApply: ji,
|
|
4274
4279
|
closedFields: I ? new Set(
|
|
4275
4280
|
xe.fields.filter(
|
|
@@ -4292,7 +4297,7 @@ function vc({
|
|
|
4292
4297
|
})()
|
|
4293
4298
|
}
|
|
4294
4299
|
),
|
|
4295
|
-
ie && e.rowId && !e.rowId.startsWith("pending:") && e.rowId !== "new" && /* @__PURE__ */ a(
|
|
4300
|
+
ie && e.rowId && !e.rowId.startsWith("pending:") && e.rowId !== "new" && /* @__PURE__ */ a(vd, { config: ie, result: Mt.byRow.get(e.rowId) }),
|
|
4296
4301
|
e.drawer
|
|
4297
4302
|
]
|
|
4298
4303
|
}
|
|
@@ -4344,7 +4349,7 @@ function vc({
|
|
|
4344
4349
|
"button",
|
|
4345
4350
|
{
|
|
4346
4351
|
type: "button",
|
|
4347
|
-
onClick: () =>
|
|
4352
|
+
onClick: () => gs(or),
|
|
4348
4353
|
className: ve(
|
|
4349
4354
|
"h-6 px-2.5 rounded border transition-colors",
|
|
4350
4355
|
jo ? "border-nvr-cyan bg-nvr-cyan/10 text-nvr-cyan" : "border-slate-200 text-slate-600 hover:border-slate-400 hover:text-slate-800"
|
|
@@ -4356,7 +4361,7 @@ function vc({
|
|
|
4356
4361
|
"button",
|
|
4357
4362
|
{
|
|
4358
4363
|
type: "button",
|
|
4359
|
-
onClick: () =>
|
|
4364
|
+
onClick: () => gs(e.name),
|
|
4360
4365
|
className: ve(
|
|
4361
4366
|
"h-6 px-2.5 rounded border transition-colors",
|
|
4362
4367
|
pl === 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"
|
|
@@ -4375,7 +4380,7 @@ function vc({
|
|
|
4375
4380
|
{
|
|
4376
4381
|
className: "space-y-1.5",
|
|
4377
4382
|
"data-o2m-collection": s,
|
|
4378
|
-
onFocusCapture:
|
|
4383
|
+
onFocusCapture: ga,
|
|
4379
4384
|
onBlurCapture: ba,
|
|
4380
4385
|
children: [
|
|
4381
4386
|
/* @__PURE__ */ a(
|
|
@@ -4390,7 +4395,7 @@ function vc({
|
|
|
4390
4395
|
}
|
|
4391
4396
|
),
|
|
4392
4397
|
wr && wr.length > 0 && /* @__PURE__ */ a(
|
|
4393
|
-
|
|
4398
|
+
cd,
|
|
4394
4399
|
{
|
|
4395
4400
|
lines: wr,
|
|
4396
4401
|
intro: "Someone else saved these line values after this table loaded, so your change was not written. Pick which value wins for each.",
|
|
@@ -4453,7 +4458,7 @@ function vc({
|
|
|
4453
4458
|
);
|
|
4454
4459
|
})(),
|
|
4455
4460
|
Le && (!A || w) && /* @__PURE__ */ a(
|
|
4456
|
-
|
|
4461
|
+
Od,
|
|
4457
4462
|
{
|
|
4458
4463
|
config: Le,
|
|
4459
4464
|
relatedCollection: s,
|
|
@@ -4482,7 +4487,7 @@ function vc({
|
|
|
4482
4487
|
(n) => typeof n == "object" && n.field === qe.relation && !!n.match
|
|
4483
4488
|
);
|
|
4484
4489
|
return e != null && e.match ? /* @__PURE__ */ a(
|
|
4485
|
-
|
|
4490
|
+
Ad,
|
|
4486
4491
|
{
|
|
4487
4492
|
config: qe,
|
|
4488
4493
|
matchCfg: e.match,
|
|
@@ -4495,7 +4500,7 @@ function vc({
|
|
|
4495
4500
|
) : null;
|
|
4496
4501
|
})(),
|
|
4497
4502
|
(Xe ?? []).map((e) => /* @__PURE__ */ a(
|
|
4498
|
-
|
|
4503
|
+
Id,
|
|
4499
4504
|
{
|
|
4500
4505
|
config: e,
|
|
4501
4506
|
rows: [...E, ...D.map((n, t) => ({ ...n, __pendingIndex: t }))],
|
|
@@ -4523,7 +4528,7 @@ function vc({
|
|
|
4523
4528
|
e.label
|
|
4524
4529
|
)),
|
|
4525
4530
|
wt && !A && !q && kt && O && /* @__PURE__ */ a(
|
|
4526
|
-
|
|
4531
|
+
Pl,
|
|
4527
4532
|
{
|
|
4528
4533
|
collection: O,
|
|
4529
4534
|
templateFilter: (e) => {
|
|
@@ -4586,10 +4591,10 @@ function vc({
|
|
|
4586
4591
|
}
|
|
4587
4592
|
),
|
|
4588
4593
|
xe && ((Ro = xe.fields) == null ? void 0 : Ro.length) > 0 && xe.across_rows !== !1 && E.length + D.length > 1 && /* @__PURE__ */ a(
|
|
4589
|
-
|
|
4594
|
+
Td,
|
|
4590
4595
|
{
|
|
4591
4596
|
config: xe,
|
|
4592
|
-
remaining:
|
|
4597
|
+
remaining: ht(xe.remaining, Zt),
|
|
4593
4598
|
rowNoun: I ? Se(I.key_field).toLowerCase() : "row",
|
|
4594
4599
|
onApply: Aa
|
|
4595
4600
|
}
|
|
@@ -4624,7 +4629,7 @@ function vc({
|
|
|
4624
4629
|
dn ? "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"
|
|
4625
4630
|
),
|
|
4626
4631
|
children: [
|
|
4627
|
-
/* @__PURE__ */ a(
|
|
4632
|
+
/* @__PURE__ */ a(hl, { className: "h-3 w-3", "aria-hidden": "true" }),
|
|
4628
4633
|
dn ? "Selecting" : "Select rows"
|
|
4629
4634
|
]
|
|
4630
4635
|
}
|
|
@@ -4637,7 +4642,7 @@ function vc({
|
|
|
4637
4642
|
"data-tip": "Set the same values on every selected line",
|
|
4638
4643
|
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",
|
|
4639
4644
|
children: [
|
|
4640
|
-
/* @__PURE__ */ a(
|
|
4645
|
+
/* @__PURE__ */ a(gl, { className: "h-3 w-3", "aria-hidden": "true" }),
|
|
4641
4646
|
"Edit ",
|
|
4642
4647
|
Ht.size,
|
|
4643
4648
|
" selected…"
|
|
@@ -4829,8 +4834,8 @@ function vc({
|
|
|
4829
4834
|
] }) })
|
|
4830
4835
|
] }),
|
|
4831
4836
|
(ie == null ? void 0 : ie.unmatched_banner) && !q && Mt.unmatchedCandidates.length > 0 && (() => {
|
|
4832
|
-
var d, c, l, p, b, u,
|
|
4833
|
-
const e = Mt.unmatchedCandidates.length, n = ((d = ie.unmatched_banner) == null ? void 0 : d.label) ?? "related line", t = e === 1 ? n : `${n}s`, r = ((c = ie.candidates) == null ? void 0 : c.primary) ?? ((b = (p = (l = ie.candidates) == null ? void 0 : l.keys) == null ? void 0 : p[0]) == null ? void 0 : b.row), i = (v = (
|
|
4837
|
+
var d, c, l, p, b, u, h, v;
|
|
4838
|
+
const e = Mt.unmatchedCandidates.length, n = ((d = ie.unmatched_banner) == null ? void 0 : d.label) ?? "related line", t = e === 1 ? n : `${n}s`, r = ((c = ie.candidates) == null ? void 0 : c.primary) ?? ((b = (p = (l = ie.candidates) == null ? void 0 : l.keys) == null ? void 0 : p[0]) == null ? void 0 : b.row), i = (v = (h = (u = ie.candidates) == null ? void 0 : u.keys) == null ? void 0 : h.find(
|
|
4834
4839
|
(k) => k.row === r
|
|
4835
4840
|
)) == null ? void 0 : v.candidate, o = i ? Mt.unmatchedCandidates.map((k) => String(k[i] ?? "")).filter(Boolean).slice(0, 8) : [];
|
|
4836
4841
|
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: [
|
|
@@ -4924,7 +4929,7 @@ function vc({
|
|
|
4924
4929
|
/* @__PURE__ */ a("div", { className: "h-8 rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))] animate-pulse" })
|
|
4925
4930
|
] }),
|
|
4926
4931
|
!q && Ts.length > 0 && /* @__PURE__ */ a(
|
|
4927
|
-
|
|
4932
|
+
Fl,
|
|
4928
4933
|
{
|
|
4929
4934
|
proposals: Ts,
|
|
4930
4935
|
onApply: Ia,
|
|
@@ -4932,9 +4937,9 @@ function vc({
|
|
|
4932
4937
|
}
|
|
4933
4938
|
),
|
|
4934
4939
|
(pi && pi.length > 0 || Ke && !A && (I || As || js)) && /* @__PURE__ */ _("div", { "data-o2m-stats": !0, className: "mb-2 flex flex-wrap items-stretch gap-1.5", children: [
|
|
4935
|
-
/* @__PURE__ */ a(
|
|
4940
|
+
/* @__PURE__ */ a(Hl, { data: I, loading: As, error: js }),
|
|
4936
4941
|
(pi ?? []).map((e) => /* @__PURE__ */ a(
|
|
4937
|
-
|
|
4942
|
+
Yl,
|
|
4938
4943
|
{
|
|
4939
4944
|
label: e.label,
|
|
4940
4945
|
value: e.result,
|
|
@@ -5040,31 +5045,31 @@ function vc({
|
|
|
5040
5045
|
}
|
|
5041
5046
|
),
|
|
5042
5047
|
/* @__PURE__ */ a("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: r }),
|
|
5043
|
-
/* @__PURE__ */ a("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: E.reduce((x,
|
|
5048
|
+
/* @__PURE__ */ a("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: E.reduce((x, g) => x + (Un(g) === r ? 1 : 0), 0) }),
|
|
5044
5049
|
(() => {
|
|
5045
5050
|
const x = qa(
|
|
5046
5051
|
E.filter(
|
|
5047
|
-
(
|
|
5052
|
+
(g) => Un(g) === r && !ze.has(String(g.id))
|
|
5048
5053
|
)
|
|
5049
5054
|
);
|
|
5050
|
-
return x.length === 0 ? null : /* @__PURE__ */ a("span", { className: "ml-auto flex flex-wrap items-baseline gap-x-3 pr-1 text-[10.5px] tabular-nums", children: x.map((
|
|
5055
|
+
return x.length === 0 ? null : /* @__PURE__ */ a("span", { className: "ml-auto flex flex-wrap items-baseline gap-x-3 pr-1 text-[10.5px] tabular-nums", children: x.map((g) => /* @__PURE__ */ _(
|
|
5051
5056
|
"span",
|
|
5052
5057
|
{
|
|
5053
5058
|
className: "text-slate-500 dark:text-slate-400",
|
|
5054
5059
|
children: [
|
|
5055
|
-
|
|
5060
|
+
g.label,
|
|
5056
5061
|
" ",
|
|
5057
|
-
/* @__PURE__ */ a("span", { className: "font-semibold text-slate-700 dark:text-slate-200", children:
|
|
5062
|
+
/* @__PURE__ */ a("span", { className: "font-semibold text-slate-700 dark:text-slate-200", children: g.text })
|
|
5058
5063
|
]
|
|
5059
5064
|
},
|
|
5060
|
-
|
|
5065
|
+
g.label
|
|
5061
5066
|
)) });
|
|
5062
5067
|
})()
|
|
5063
5068
|
]
|
|
5064
5069
|
}
|
|
5065
5070
|
) }) }) : null;
|
|
5066
5071
|
if (o) return /* @__PURE__ */ a(Di, { children: d }, t);
|
|
5067
|
-
const c = (m == null ? void 0 : m.rowId) === t, l = c && !de, p = vt === n, b = Wt === n && vt !== n, u = Y.has(t),
|
|
5072
|
+
const c = (m == null ? void 0 : m.rowId) === t, l = c && !de, p = vt === n, b = Wt === n && vt !== n, u = Y.has(t), h = ze.has(t), v = u ? { ...e, ...Y.get(t) } : e, k = ss && !h ? ia.get(String(v[ss] ?? "")) ?? null : null;
|
|
5068
5073
|
return /* @__PURE__ */ _(Di, { children: [
|
|
5069
5074
|
d,
|
|
5070
5075
|
/* @__PURE__ */ _(
|
|
@@ -5073,14 +5078,14 @@ function vc({
|
|
|
5073
5078
|
"data-o2m-row": `${s}:${t}`,
|
|
5074
5079
|
"data-o2m-editing": c ? "" : void 0,
|
|
5075
5080
|
tabIndex: de ? -1 : void 0,
|
|
5076
|
-
draggable: re && !!C && !c && !
|
|
5081
|
+
draggable: re && !!C && !c && !h,
|
|
5077
5082
|
onDragStart: () => qo(n),
|
|
5078
5083
|
onDragOver: (x) => Eo(x, n),
|
|
5079
5084
|
onDrop: al,
|
|
5080
5085
|
onDragEnd: En,
|
|
5081
|
-
onClick: () => !c && !
|
|
5086
|
+
onClick: () => !c && !h && Pr(v),
|
|
5082
5087
|
onBlur: (x) => {
|
|
5083
|
-
!c || yt ||
|
|
5088
|
+
!c || yt || h || x.currentTarget.contains(x.relatedTarget) || yr(x.relatedTarget) || (ct.current = setTimeout(() => {
|
|
5084
5089
|
Pn.current || yr(document.activeElement) || Dt();
|
|
5085
5090
|
}, 150));
|
|
5086
5091
|
},
|
|
@@ -5091,12 +5096,12 @@ function vc({
|
|
|
5091
5096
|
"group/row border-b border-slate-100 transition-[color,background-color,opacity] duration-300",
|
|
5092
5097
|
p ? "opacity-40" : "",
|
|
5093
5098
|
b ? "border-t-2 border-t-nvr-cyan" : "",
|
|
5094
|
-
|
|
5095
|
-
!
|
|
5096
|
-
!
|
|
5099
|
+
h ? "opacity-50 bg-red-50/40 cursor-default line-through dark:bg-red-900/10" : "",
|
|
5100
|
+
!h && c ? de ? "bg-[#e6f8ff] outline-none dark:bg-nvr-cyan/15 cursor-default" : "bg-[#f0fbff] dark:bg-nvr-cyan/5 cursor-default" : "",
|
|
5101
|
+
!h && !c ? k ? "bg-red-50/70 hover:bg-red-50 cursor-pointer dark:bg-red-900/15 dark:hover:bg-red-900/25" : n % 2 === 0 ? "bg-white hover:bg-slate-50/80 dark:bg-card dark:hover:bg-muted cursor-pointer" : "bg-slate-50/50 hover:bg-slate-100/60 dark:bg-white/[0.03] dark:hover:bg-muted cursor-pointer" : ""
|
|
5097
5102
|
),
|
|
5098
5103
|
children: [
|
|
5099
|
-
!(c && !
|
|
5104
|
+
!(c && !h && ot === "panel") && /* @__PURE__ */ _(An, { children: [
|
|
5100
5105
|
st && /* @__PURE__ */ _(
|
|
5101
5106
|
"td",
|
|
5102
5107
|
{
|
|
@@ -5112,7 +5117,7 @@ function vc({
|
|
|
5112
5117
|
"aria-label": `Select line ${n + 1}`,
|
|
5113
5118
|
className: "accent-nvr-cyan",
|
|
5114
5119
|
checked: Ht.has(t),
|
|
5115
|
-
disabled:
|
|
5120
|
+
disabled: h,
|
|
5116
5121
|
onChange: () => is(t)
|
|
5117
5122
|
}
|
|
5118
5123
|
)
|
|
@@ -5158,7 +5163,7 @@ function vc({
|
|
|
5158
5163
|
}
|
|
5159
5164
|
),
|
|
5160
5165
|
(() => {
|
|
5161
|
-
const x = Hi(v,
|
|
5166
|
+
const x = Hi(v, gt);
|
|
5162
5167
|
return x.length ? /* @__PURE__ */ a(
|
|
5163
5168
|
ar,
|
|
5164
5169
|
{
|
|
@@ -5196,7 +5201,7 @@ function vc({
|
|
|
5196
5201
|
}
|
|
5197
5202
|
),
|
|
5198
5203
|
!R && (() => {
|
|
5199
|
-
const x = Hi(v,
|
|
5204
|
+
const x = Hi(v, gt);
|
|
5200
5205
|
return x.length ? /* @__PURE__ */ a(
|
|
5201
5206
|
ar,
|
|
5202
5207
|
{
|
|
@@ -5206,7 +5211,7 @@ function vc({
|
|
|
5206
5211
|
}
|
|
5207
5212
|
) : null;
|
|
5208
5213
|
})(),
|
|
5209
|
-
|
|
5214
|
+
h ? /* @__PURE__ */ a("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" }) : u && (mt != null && mt.changed.has(t)) ? /* @__PURE__ */ a(
|
|
5210
5215
|
"span",
|
|
5211
5216
|
{
|
|
5212
5217
|
"data-row-changed-by-others": "",
|
|
@@ -5217,7 +5222,7 @@ function vc({
|
|
|
5217
5222
|
) : u ? /* @__PURE__ */ a("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
|
|
5218
5223
|
] })
|
|
5219
5224
|
] }),
|
|
5220
|
-
c && !
|
|
5225
|
+
c && !h && ot === "panel" ? Ki({
|
|
5221
5226
|
identity: `${R ? `Line ${n + 1} · ` : ""}${Jr(v)}`,
|
|
5222
5227
|
draft: (m == null ? void 0 : m.draft) ?? v,
|
|
5223
5228
|
rowId: t,
|
|
@@ -5226,14 +5231,14 @@ function vc({
|
|
|
5226
5231
|
drawer: Qr(t, (m == null ? void 0 : m.draft) ?? v)
|
|
5227
5232
|
}) : (() => {
|
|
5228
5233
|
const x = rr(v, { rowKey: t });
|
|
5229
|
-
return Me.map((
|
|
5234
|
+
return Me.map((g, S) => {
|
|
5230
5235
|
var _e, F, ye;
|
|
5231
|
-
if (it(
|
|
5232
|
-
return /* @__PURE__ */ a("td", { className: "px-2 py-1 align-top", children: /* @__PURE__ */ a("div", { className: "py-0.5 overflow-hidden text-slate-500", children: Lr(
|
|
5233
|
-
const L =
|
|
5234
|
-
|
|
5236
|
+
if (it(g))
|
|
5237
|
+
return /* @__PURE__ */ a("td", { className: "px-2 py-1 align-top", children: /* @__PURE__ */ a("div", { className: "py-0.5 overflow-hidden text-slate-500", children: Lr(g, v) }) }, g.field);
|
|
5238
|
+
const L = g.computed_type === "write" && !!g.computed_formula, T = L ? Qt(
|
|
5239
|
+
g.computed_formula,
|
|
5235
5240
|
c ? (m == null ? void 0 : m.draft) ?? v : v
|
|
5236
|
-
) ?? v[
|
|
5241
|
+
) ?? v[g.field] : null, j = J && !c && !h ? (_e = oi[t]) == null ? void 0 : _e[g.field] : void 0, se = j ? `${g.label || Se(g.field)} · changed ${Do(j.at)} by ${j.who}${j.reason ? `
|
|
5237
5242
|
Reason: “${j.reason}”` : ""}` : void 0;
|
|
5238
5243
|
return /* @__PURE__ */ _(
|
|
5239
5244
|
"td",
|
|
@@ -5244,13 +5249,13 @@ Reason: “${j.reason}”` : ""}` : void 0;
|
|
|
5244
5249
|
I && Jt(
|
|
5245
5250
|
I,
|
|
5246
5251
|
v[I.key_field],
|
|
5247
|
-
|
|
5252
|
+
g.field
|
|
5248
5253
|
) && "bg-slate-50/80 dark:bg-white/[0.035]"
|
|
5249
5254
|
),
|
|
5250
5255
|
"data-compare-closed": I && Jt(
|
|
5251
5256
|
I,
|
|
5252
5257
|
v[I.key_field],
|
|
5253
|
-
|
|
5258
|
+
g.field
|
|
5254
5259
|
) ? "" : void 0,
|
|
5255
5260
|
"data-tip": se,
|
|
5256
5261
|
children: [
|
|
@@ -5270,7 +5275,7 @@ Reason: “${j.reason}”` : ""}` : void 0;
|
|
|
5270
5275
|
"button",
|
|
5271
5276
|
{
|
|
5272
5277
|
type: "button",
|
|
5273
|
-
"aria-label": `History of ${
|
|
5278
|
+
"aria-label": `History of ${g.label || Se(g.field)}`,
|
|
5274
5279
|
onClick: (ue) => {
|
|
5275
5280
|
ue.stopPropagation(), Zr(j.revision_id), Tn(e);
|
|
5276
5281
|
},
|
|
@@ -5278,46 +5283,46 @@ Reason: “${j.reason}”` : ""}` : void 0;
|
|
|
5278
5283
|
children: /* @__PURE__ */ a(zr, { className: "h-2.5 w-2.5", "aria-hidden": "true" })
|
|
5279
5284
|
}
|
|
5280
5285
|
),
|
|
5281
|
-
L ? /* @__PURE__ */ a("div", { className: "py-0.5 overflow-hidden text-slate-500 italic", children: De(
|
|
5286
|
+
L ? /* @__PURE__ */ a("div", { className: "py-0.5 overflow-hidden text-slate-500 italic", children: De(g, T) }) : l && !h || Jn(g.interface) ? (
|
|
5282
5287
|
// A field a rule LOCKS on this row is read-only here too
|
|
5283
5288
|
// (the server drops the write anyway) and says why on hover.
|
|
5284
5289
|
/* @__PURE__ */ a(
|
|
5285
5290
|
"div",
|
|
5286
5291
|
{
|
|
5287
5292
|
onClick: (ue) => ue.stopPropagation(),
|
|
5288
|
-
"data-tip": l && ((F = m == null ? void 0 : m.locks) != null && F.includes(
|
|
5289
|
-
"data-grid-cell": l ? fs(t,
|
|
5293
|
+
"data-tip": l && ((F = m == null ? void 0 : m.locks) != null && F.includes(g.field)) ? fo(g.field) : Er(g) ? "Only administrators can change this field" : void 0,
|
|
5294
|
+
"data-grid-cell": l ? fs(t, g.field) : void 0,
|
|
5290
5295
|
children: /* @__PURE__ */ a(
|
|
5291
5296
|
In,
|
|
5292
5297
|
{
|
|
5293
|
-
field: { ...
|
|
5294
|
-
value: (m == null ? void 0 : m.draft[
|
|
5295
|
-
onChange: (ue) => pt(
|
|
5298
|
+
field: { ...g, sort: g.sort ?? 0 },
|
|
5299
|
+
value: (m == null ? void 0 : m.draft[g.field]) ?? null,
|
|
5300
|
+
onChange: (ue) => pt(g.field, ue),
|
|
5296
5301
|
relations: Pe,
|
|
5297
5302
|
collection: s,
|
|
5298
5303
|
itemId: t,
|
|
5299
|
-
cascadeFilter: Ge[
|
|
5304
|
+
cascadeFilter: Ge[g.field],
|
|
5300
5305
|
pinnedOption: bn(
|
|
5301
|
-
|
|
5306
|
+
g.field,
|
|
5302
5307
|
(m == null ? void 0 : m.draft) ?? {}
|
|
5303
5308
|
),
|
|
5304
|
-
displayOnly: !l ||
|
|
5309
|
+
displayOnly: !l || h || Er(g) || l && !!((ye = m == null ? void 0 : m.locks) != null && ye.includes(g.field))
|
|
5305
5310
|
}
|
|
5306
5311
|
)
|
|
5307
5312
|
}
|
|
5308
5313
|
)
|
|
5309
|
-
) :
|
|
5310
|
-
|
|
5311
|
-
x[
|
|
5314
|
+
) : g.interface === "formula-column" ? /* @__PURE__ */ a("div", { className: "py-0.5 overflow-hidden", children: De(
|
|
5315
|
+
g,
|
|
5316
|
+
x[g.field],
|
|
5312
5317
|
e.id != null ? String(e.id) : void 0,
|
|
5313
5318
|
x
|
|
5314
|
-
) }) :
|
|
5315
|
-
|
|
5316
|
-
x[
|
|
5319
|
+
) }) : g.computed_type === "rollup" ? /* @__PURE__ */ a("div", { className: "py-0.5 overflow-hidden", children: De(
|
|
5320
|
+
g,
|
|
5321
|
+
x[g.field] ?? v[g.field],
|
|
5317
5322
|
e.id != null ? String(e.id) : void 0
|
|
5318
5323
|
) }) : /* @__PURE__ */ a("div", { className: "py-0.5 overflow-hidden", children: De(
|
|
5319
|
-
|
|
5320
|
-
v[
|
|
5324
|
+
g,
|
|
5325
|
+
v[g.field],
|
|
5321
5326
|
e.id != null ? String(e.id) : void 0
|
|
5322
5327
|
) }),
|
|
5323
5328
|
I && /* @__PURE__ */ a(
|
|
@@ -5326,20 +5331,20 @@ Reason: “${j.reason}”` : ""}` : void 0;
|
|
|
5326
5331
|
data: I,
|
|
5327
5332
|
row: Qi(I, v),
|
|
5328
5333
|
rowKey: v[I.key_field],
|
|
5329
|
-
column:
|
|
5330
|
-
planned: l && !
|
|
5331
|
-
columnLabel: qr(
|
|
5334
|
+
column: g.field,
|
|
5335
|
+
planned: l && !h ? m == null ? void 0 : m.draft[g.field] : v[g.field],
|
|
5336
|
+
columnLabel: qr(g),
|
|
5332
5337
|
plannedRow: v,
|
|
5333
|
-
onAdjust: !q && !
|
|
5338
|
+
onAdjust: !q && !h && e.id != null ? (ue, ee) => void gn(String(e.id), ue, ee) : void 0
|
|
5334
5339
|
}
|
|
5335
5340
|
)
|
|
5336
5341
|
]
|
|
5337
5342
|
},
|
|
5338
|
-
|
|
5343
|
+
g.field
|
|
5339
5344
|
);
|
|
5340
5345
|
});
|
|
5341
5346
|
})(),
|
|
5342
|
-
!(c && !
|
|
5347
|
+
!(c && !h && ot === "panel") && /* @__PURE__ */ a("td", { className: "px-1 py-1 align-middle", children: l && !h ? /* @__PURE__ */ _(
|
|
5343
5348
|
"div",
|
|
5344
5349
|
{
|
|
5345
5350
|
className: "flex items-stretch gap-1",
|
|
@@ -5366,7 +5371,7 @@ Reason: “${j.reason}”` : ""}` : void 0;
|
|
|
5366
5371
|
)
|
|
5367
5372
|
]
|
|
5368
5373
|
}
|
|
5369
|
-
) : /* @__PURE__ */ a("div", { className: "flex items-center justify-end gap-0.5", children:
|
|
5374
|
+
) : /* @__PURE__ */ a("div", { className: "flex items-center justify-end gap-0.5", children: h ? /* @__PURE__ */ a(
|
|
5370
5375
|
"button",
|
|
5371
5376
|
{
|
|
5372
5377
|
type: "button",
|
|
@@ -5384,9 +5389,9 @@ Reason: “${j.reason}”` : ""}` : void 0;
|
|
|
5384
5389
|
type: "button",
|
|
5385
5390
|
title: "Undo edit",
|
|
5386
5391
|
onClick: (x) => {
|
|
5387
|
-
x.stopPropagation(), w == null || w.cancelPendingEdit(s, f, t), Nr((
|
|
5392
|
+
x.stopPropagation(), w == null || w.cancelPendingEdit(s, f, t), Nr((g) => {
|
|
5388
5393
|
const S = {};
|
|
5389
|
-
for (const [L, T] of Object.entries(
|
|
5394
|
+
for (const [L, T] of Object.entries(g))
|
|
5390
5395
|
L.startsWith(`${t}|`) || (S[L] = T);
|
|
5391
5396
|
return S;
|
|
5392
5397
|
});
|
|
@@ -5396,7 +5401,7 @@ Reason: “${j.reason}”` : ""}` : void 0;
|
|
|
5396
5401
|
}
|
|
5397
5402
|
),
|
|
5398
5403
|
X && t != null && /* @__PURE__ */ a(
|
|
5399
|
-
|
|
5404
|
+
hd,
|
|
5400
5405
|
{
|
|
5401
5406
|
collection: s,
|
|
5402
5407
|
rowId: String(t),
|
|
@@ -5416,11 +5421,11 @@ Reason: “${j.reason}”` : ""}` : void 0;
|
|
|
5416
5421
|
}
|
|
5417
5422
|
),
|
|
5418
5423
|
t != null && !String(t).startsWith("pending") && /* @__PURE__ */ a(
|
|
5419
|
-
|
|
5424
|
+
xd,
|
|
5420
5425
|
{
|
|
5421
5426
|
collection: s,
|
|
5422
5427
|
rowId: String(t),
|
|
5423
|
-
rowLabel:
|
|
5428
|
+
rowLabel: qd(e)
|
|
5424
5429
|
}
|
|
5425
5430
|
),
|
|
5426
5431
|
!q && /* @__PURE__ */ a(
|
|
@@ -5447,13 +5452,13 @@ Reason: “${j.reason}”` : ""}` : void 0;
|
|
|
5447
5452
|
]
|
|
5448
5453
|
}
|
|
5449
5454
|
) }),
|
|
5450
|
-
c && !
|
|
5455
|
+
c && !h && ot === "inline" && Z && Z.length > 0 && /* @__PURE__ */ a(
|
|
5451
5456
|
"tr",
|
|
5452
5457
|
{
|
|
5453
5458
|
"data-o2m-editing": !0,
|
|
5454
5459
|
className: "border-b border-slate-100 bg-[#f0fbff]/60 dark:bg-nvr-cyan/5",
|
|
5455
5460
|
children: /* @__PURE__ */ a("td", { colSpan: At, className: "px-3 py-2", children: /* @__PURE__ */ a("div", { className: "space-y-2", children: Z.map((x) => {
|
|
5456
|
-
const
|
|
5461
|
+
const g = typeof x == "string" ? x : x.field, S = typeof x == "string" ? void 0 : x.hint, L = typeof x == "string" ? void 0 : x.match, T = (m == null ? void 0 : m.draft) ?? v, j = L ? Hr(
|
|
5457
5462
|
L,
|
|
5458
5463
|
T,
|
|
5459
5464
|
y,
|
|
@@ -5463,7 +5468,7 @@ Reason: “${j.reason}”` : ""}` : void 0;
|
|
|
5463
5468
|
Bi,
|
|
5464
5469
|
{
|
|
5465
5470
|
parentCollection: s,
|
|
5466
|
-
relationField:
|
|
5471
|
+
relationField: g,
|
|
5467
5472
|
parentRowId: t,
|
|
5468
5473
|
parentDraft: (m == null ? void 0 : m.draft) ?? v,
|
|
5469
5474
|
hint: S,
|
|
@@ -5479,11 +5484,11 @@ Reason: “${j.reason}”` : ""}` : void 0;
|
|
|
5479
5484
|
matchSeed: (j == null ? void 0 : j.seed) ?? {}
|
|
5480
5485
|
} : P ? {
|
|
5481
5486
|
deferred: !0,
|
|
5482
|
-
stagedOps: (m == null ? void 0 : m.draft[`__nested_ops_${
|
|
5483
|
-
onStagedOpsChange: (se) => pt(`__nested_ops_${
|
|
5487
|
+
stagedOps: (m == null ? void 0 : m.draft[`__nested_ops_${g}`]) ?? Vr,
|
|
5488
|
+
onStagedOpsChange: (se) => pt(`__nested_ops_${g}`, se)
|
|
5484
5489
|
} : {}
|
|
5485
5490
|
},
|
|
5486
|
-
|
|
5491
|
+
g
|
|
5487
5492
|
);
|
|
5488
5493
|
}) }) })
|
|
5489
5494
|
}
|
|
@@ -5657,11 +5662,11 @@ Reason: “${j.reason}”` : ""}` : void 0;
|
|
|
5657
5662
|
), b = p.id != null ? t.find((x) => String(x.id) === String(p.id)) : void 0, u = b ? ce(
|
|
5658
5663
|
{ ...b },
|
|
5659
5664
|
b
|
|
5660
|
-
) : void 0,
|
|
5661
|
-
|
|
5665
|
+
) : void 0, h = !u, v = new Set(
|
|
5666
|
+
h ? we.map((x) => x.field) : we.filter((x) => !e.baseRows || x.field in u).filter(
|
|
5662
5667
|
(x) => String(p[x.field] ?? "") !== String(u[x.field] ?? "")
|
|
5663
5668
|
).map((x) => x.field)
|
|
5664
|
-
), k =
|
|
5669
|
+
), k = h || v.size > 0;
|
|
5665
5670
|
return /* @__PURE__ */ _(
|
|
5666
5671
|
"tr",
|
|
5667
5672
|
{
|
|
@@ -5688,7 +5693,7 @@ Reason: “${j.reason}”` : ""}` : void 0;
|
|
|
5688
5693
|
},
|
|
5689
5694
|
x.field
|
|
5690
5695
|
)),
|
|
5691
|
-
/* @__PURE__ */ a("td", { className: "w-20 px-2 py-1.5 text-right", children: k && /* @__PURE__ */ a("span", { className: "text-[10px] font-medium uppercase tracking-wide text-amber-400", children:
|
|
5696
|
+
/* @__PURE__ */ a("td", { className: "w-20 px-2 py-1.5 text-right", children: k && /* @__PURE__ */ a("span", { className: "text-[10px] font-medium uppercase tracking-wide text-amber-400", children: h ? "New" : "Modified" }) })
|
|
5692
5697
|
]
|
|
5693
5698
|
},
|
|
5694
5699
|
l
|
|
@@ -5829,7 +5834,7 @@ Reason: “${j.reason}”` : ""}` : void 0;
|
|
|
5829
5834
|
(() => {
|
|
5830
5835
|
const l = Hi(
|
|
5831
5836
|
r ? (m == null ? void 0 : m.draft) ?? e : e,
|
|
5832
|
-
|
|
5837
|
+
gt
|
|
5833
5838
|
);
|
|
5834
5839
|
return l.length ? /* @__PURE__ */ a(
|
|
5835
5840
|
ar,
|
|
@@ -5870,25 +5875,25 @@ Reason: “${j.reason}”` : ""}` : void 0;
|
|
|
5870
5875
|
r ? m.draft : e,
|
|
5871
5876
|
!0
|
|
5872
5877
|
) }) }, p.field);
|
|
5873
|
-
const b = p.computed_type === "write" && !!p.computed_formula, u = Jn(p.interface),
|
|
5878
|
+
const b = p.computed_type === "write" && !!p.computed_formula, u = Jn(p.interface), h = `__m2m_${p.field}`, v = u && i ? ui(p) : null, k = p.interface === "relation-path" && e.id != null ? (S = ut == null ? void 0 : ut[String(e.id)]) == null ? void 0 : S[p.field] : void 0, x = b ? Qt(
|
|
5874
5879
|
p.computed_formula,
|
|
5875
5880
|
r ? m.draft : e
|
|
5876
|
-
) ?? e[p.field] : r ? m.draft[p.field] ?? k : e[p.field] ?? k,
|
|
5881
|
+
) ?? e[p.field] : r ? m.draft[p.field] ?? k : e[p.field] ?? k, g = Array.isArray(e.__rule_set) ? e.__rule_set.includes(p.field) : !1;
|
|
5877
5882
|
return /* @__PURE__ */ _(
|
|
5878
5883
|
"td",
|
|
5879
5884
|
{
|
|
5880
5885
|
className: ve(
|
|
5881
5886
|
"px-2 py-1 align-top",
|
|
5882
|
-
|
|
5887
|
+
g && !r && "[&>div]:underline [&>div]:decoration-dotted [&>div]:decoration-amber-400 [&>div]:underline-offset-2"
|
|
5883
5888
|
),
|
|
5884
|
-
"data-tip":
|
|
5889
|
+
"data-tip": g && !r ? `${p.label || Se(p.field)} · set by an auto-fill rule, not the file` : void 0,
|
|
5885
5890
|
children: [
|
|
5886
5891
|
b ? /* @__PURE__ */ a("div", { className: "py-0.5 overflow-hidden text-slate-500 italic", children: De(p, x) }) : u && i && v ? /* @__PURE__ */ a("div", { onClick: (T) => T.stopPropagation(), children: /* @__PURE__ */ a(
|
|
5887
5892
|
Fi,
|
|
5888
5893
|
{
|
|
5889
5894
|
collection: v.targetCollection,
|
|
5890
|
-
value: m.draft[
|
|
5891
|
-
onChange: (T) => pt(
|
|
5895
|
+
value: m.draft[h] ?? null,
|
|
5896
|
+
onChange: (T) => pt(h, T),
|
|
5892
5897
|
extraFilter: Ge[p.field]
|
|
5893
5898
|
}
|
|
5894
5899
|
) }) : u ? /* @__PURE__ */ a("span", { className: "text-slate-300 text-[11px]", children: "—" }) : i ? /* @__PURE__ */ a("div", { onClick: (T) => T.stopPropagation(), children: /* @__PURE__ */ a(
|
|
@@ -6051,7 +6056,7 @@ Reason: “${j.reason}”` : ""}` : void 0;
|
|
|
6051
6056
|
} catch {
|
|
6052
6057
|
return {};
|
|
6053
6058
|
}
|
|
6054
|
-
})() : t.options : {}, i = r.aggregate, o =
|
|
6059
|
+
})() : t.options : {}, i = r.aggregate, o = Gl(I, t.field), d = o != null ? /* @__PURE__ */ _(
|
|
6055
6060
|
"div",
|
|
6056
6061
|
{
|
|
6057
6062
|
"data-compare-footer": t.field,
|
|
@@ -6064,21 +6069,21 @@ Reason: “${j.reason}”` : ""}` : void 0;
|
|
|
6064
6069
|
) : null;
|
|
6065
6070
|
if (!i)
|
|
6066
6071
|
return /* @__PURE__ */ a("td", { className: "px-2 py-1.5 align-top", children: d }, t.field);
|
|
6067
|
-
const c = t.interface === "formula-column" && typeof r.column_formula == "string" ? r.column_formula : null, l = n.map((
|
|
6072
|
+
const c = t.interface === "formula-column" && typeof r.column_formula == "string" ? r.column_formula : null, l = n.map((h) => {
|
|
6068
6073
|
if (c) {
|
|
6069
|
-
const v =
|
|
6074
|
+
const v = ht(
|
|
6070
6075
|
c,
|
|
6071
6076
|
(k) => {
|
|
6072
|
-
var x,
|
|
6073
|
-
return k.includes(".") ? (
|
|
6077
|
+
var x, g;
|
|
6078
|
+
return k.includes(".") ? (g = (x = Oe == null ? void 0 : Oe.rows[String(h.id)]) == null ? void 0 : x[k]) == null ? void 0 : g.value : h[k];
|
|
6074
6079
|
}
|
|
6075
6080
|
);
|
|
6076
6081
|
return v ?? NaN;
|
|
6077
6082
|
}
|
|
6078
|
-
return Number(
|
|
6079
|
-
}).filter((
|
|
6083
|
+
return Number(h[t.field]);
|
|
6084
|
+
}).filter((h) => !Number.isNaN(h));
|
|
6080
6085
|
let p = null;
|
|
6081
|
-
i === "count" ? p = n.length : l.length > 0 && (i === "sum" ? p = l.reduce((
|
|
6086
|
+
i === "count" ? p = n.length : l.length > 0 && (i === "sum" ? p = l.reduce((h, v) => h + v, 0) : i === "avg" ? p = l.reduce((h, v) => h + v, 0) / l.length : i === "min" ? p = Math.min(...l) : i === "max" && (p = Math.max(...l)));
|
|
6082
6087
|
const b = r.format, u = p === null ? "—" : (() => {
|
|
6083
6088
|
try {
|
|
6084
6089
|
if (b === "currency")
|
|
@@ -6087,10 +6092,10 @@ Reason: “${j.reason}”` : ""}` : void 0;
|
|
|
6087
6092
|
currency: r.currency || "USD"
|
|
6088
6093
|
}).format(p);
|
|
6089
6094
|
if (b === "decimal") {
|
|
6090
|
-
const
|
|
6095
|
+
const h = typeof r.precision == "number" ? r.precision : 2;
|
|
6091
6096
|
return new Intl.NumberFormat(void 0, {
|
|
6092
|
-
minimumFractionDigits:
|
|
6093
|
-
maximumFractionDigits:
|
|
6097
|
+
minimumFractionDigits: h,
|
|
6098
|
+
maximumFractionDigits: h
|
|
6094
6099
|
}).format(p);
|
|
6095
6100
|
}
|
|
6096
6101
|
return b === "int" || i === "count" ? new Intl.NumberFormat(void 0, {
|
|
@@ -6137,7 +6142,7 @@ Reason: “${j.reason}”` : ""}` : void 0;
|
|
|
6137
6142
|
"button",
|
|
6138
6143
|
{
|
|
6139
6144
|
type: "button",
|
|
6140
|
-
onClick: () =>
|
|
6145
|
+
onClick: () => gr(null),
|
|
6141
6146
|
className: "text-red-500/80 hover:text-red-700 dark:text-red-300/80 dark:hover:text-red-200",
|
|
6142
6147
|
children: "Dismiss"
|
|
6143
6148
|
}
|
|
@@ -6213,7 +6218,7 @@ Reason: “${j.reason}”` : ""}` : void 0;
|
|
|
6213
6218
|
);
|
|
6214
6219
|
})(),
|
|
6215
6220
|
/* @__PURE__ */ a(
|
|
6216
|
-
|
|
6221
|
+
Xl,
|
|
6217
6222
|
{
|
|
6218
6223
|
open: ra,
|
|
6219
6224
|
onOpenChange: rs,
|
|
@@ -6253,7 +6258,7 @@ Reason: “${j.reason}”` : ""}` : void 0;
|
|
|
6253
6258
|
return { title: r, subtitle: o && o.length > 48 ? `${o.slice(0, 48)}…` : o };
|
|
6254
6259
|
},
|
|
6255
6260
|
onRestore: (e, n) => po(e, n),
|
|
6256
|
-
onRestoreAllTo:
|
|
6261
|
+
onRestoreAllTo: ha,
|
|
6257
6262
|
restoringAll: ca
|
|
6258
6263
|
}
|
|
6259
6264
|
),
|
|
@@ -6318,7 +6323,7 @@ function ta(s) {
|
|
|
6318
6323
|
f
|
|
6319
6324
|
)) });
|
|
6320
6325
|
}
|
|
6321
|
-
function
|
|
6326
|
+
function Ld({
|
|
6322
6327
|
config: s,
|
|
6323
6328
|
draft: f,
|
|
6324
6329
|
remaining: y,
|
|
@@ -6378,7 +6383,7 @@ function jd({
|
|
|
6378
6383
|
$e && /* @__PURE__ */ a("span", { className: "text-[11px] text-slate-400 dark:text-slate-500", children: $e })
|
|
6379
6384
|
] });
|
|
6380
6385
|
}
|
|
6381
|
-
function
|
|
6386
|
+
function Td(s) {
|
|
6382
6387
|
const [f, y] = Q(!1), [O, W] = Q("even"), J = s.remaining == null || !Number.isFinite(s.remaining) ? 0 : Math.round(s.remaining * 100) / 100, X = (z) => s.config.format === "number" ? z.toLocaleString(void 0, { maximumFractionDigits: 2 }) : z.toLocaleString(void 0, { style: "currency", currency: "USD" });
|
|
6383
6388
|
if (J <= 0) return null;
|
|
6384
6389
|
const ne = (s.config.presets ?? ["even", "front", "back"]).filter(
|
|
@@ -6459,9 +6464,9 @@ function Yo(s) {
|
|
|
6459
6464
|
}
|
|
6460
6465
|
export {
|
|
6461
6466
|
Fo as DeleteLineButton,
|
|
6462
|
-
|
|
6463
|
-
|
|
6464
|
-
|
|
6467
|
+
wc as InlineTableField,
|
|
6468
|
+
jd as applyValueColumns,
|
|
6469
|
+
kd as dropUnavailableValues,
|
|
6465
6470
|
Qt as evalClientFormula,
|
|
6466
6471
|
Hi as failingLints,
|
|
6467
6472
|
ea as spreadAmounts
|