@nivaro/react 0.3.108 → 0.3.110
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 +3 -0
- package/dist/layout-editor.d.ts +4 -0
- package/dist/shared/components/ItemEditForm.js +1750 -1733
- package/dist/shared/components/imports/CollectionImportPanel.js +631 -595
- package/dist/shared/components/imports/import-picker-options.js +44 -0
- package/dist/shared/components/item-edit/GroupSection.js +30 -29
- package/dist/shared/components/item-edit/InlineTableField.js +441 -438
- package/dist/shared/components/item-edit/NestedRelationEditor.js +36 -36
- package/dist/shared/components/item-edit/RelationCombobox.js +1 -1
- package/dist/shared/components/item-edit/StepsBar.js +24 -23
- package/dist/shared/components/item-edit/form-density.js +1 -0
- package/dist/shared/components/item-edit/section-rows.js +39 -0
- package/dist/shared/components/layout-editor/inspector/GroupInspector.js +88 -66
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/lib/activity-sentence.js +4 -4
- package/dist/shared/lib/layout-ops.js +24 -22
- package/package.json +1 -1
|
@@ -1,47 +1,47 @@
|
|
|
1
1
|
import { jsx as l, jsxs as k, Fragment as Ln } from "react/jsx-runtime";
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { Loader2 as Rn, ListChecks as
|
|
4
|
-
import { useState as J, useMemo as K, useEffect as ge, useRef as ae, useId as
|
|
5
|
-
import { createPortal as
|
|
6
|
-
import { changeReasonChallenge as to, ChangeReasonDialog as
|
|
2
|
+
import { useQueryClient as hl, useQuery as Ye, useQueries as dn } from "@tanstack/react-query";
|
|
3
|
+
import { Loader2 as Rn, ListChecks as La, SquarePen as Ta, Rows3 as Ra, PanelBottomOpen as Ma, Zap as Ka, Clock as Zi, History as ei, AlertTriangle as hr, ChevronRight as gl, GripVertical as el, FileUp as tl, GripHorizontal as Pa, X as Da, Lock as Wa } from "lucide-react";
|
|
4
|
+
import { useState as J, useMemo as K, useEffect as ge, useRef as ae, useId as Ua, useCallback as Rt, Fragment as eo } from "react";
|
|
5
|
+
import { createPortal as Ba } from "react-dom";
|
|
6
|
+
import { changeReasonChallenge as to, ChangeReasonDialog as Ja } from "./ChangeReasonDialog.js";
|
|
7
7
|
import { toast as be } from "sonner";
|
|
8
|
-
import { useNivaroClient as si, useDrilldown as
|
|
9
|
-
import { get as de, post as Le, patch as ii, del as
|
|
10
|
-
import { useAfterIdle as
|
|
11
|
-
import { evaluateNumeric as wt, evaluateBoolean as
|
|
8
|
+
import { useNivaroClient as si, useDrilldown as Qa, useParentDraft as za, useReimportHandler as Fa, useItemEditAuth as Va, fieldDrilldownConfig as nl } from "../../context.js";
|
|
9
|
+
import { get as de, post as Le, patch as ii, del as bl } from "../../lib/commands.js";
|
|
10
|
+
import { useAfterIdle as Ha } from "../../lib/defer.js";
|
|
11
|
+
import { evaluateNumeric as wt, evaluateBoolean as Ya } from "../../lib/expression.js";
|
|
12
12
|
import { numericIntlOptions as $t } from "../../lib/format-value.js";
|
|
13
|
-
import { isOwnWrite as
|
|
14
|
-
import { useOptionalRealtime as
|
|
15
|
-
import { useRecordReader as
|
|
16
|
-
import { midairCollisionOf as
|
|
17
|
-
import { restoreSkippedNote as
|
|
13
|
+
import { isOwnWrite as Ga } from "../../lib/own-writes.js";
|
|
14
|
+
import { useOptionalRealtime as Ca } from "../../lib/realtime.js";
|
|
15
|
+
import { useRecordReader as Xa } from "../../lib/record-loader.js";
|
|
16
|
+
import { midairCollisionOf as Za } from "../../lib/record-outbox.js";
|
|
17
|
+
import { restoreSkippedNote as ed } from "../../lib/restore-skipped.js";
|
|
18
18
|
import { userErrorMessage as Tn } from "../../lib/safe-error.js";
|
|
19
|
-
import { isFileCollection as
|
|
20
|
-
import { titleCase as ve, cn as xe, formatRelative as
|
|
21
|
-
import { formulaInputsChanged as
|
|
22
|
-
import { ImportFromFileButton as
|
|
23
|
-
import { OWN_RECORD_WRITES_EVENT as
|
|
24
|
-
import { Sheet as
|
|
25
|
-
import { useAddendumO2M as
|
|
26
|
-
import { resolveCompareEndpoint as
|
|
19
|
+
import { isFileCollection as rl } from "../../lib/system-collections.js";
|
|
20
|
+
import { titleCase as ve, cn as xe, formatRelative as il, toLocalDateString as td } from "../../lib/utils.js";
|
|
21
|
+
import { formulaInputsChanged as nd } from "../../lib/write-formula.js";
|
|
22
|
+
import { ImportFromFileButton as rd } from "../import/ImportFromFileButton.js";
|
|
23
|
+
import { OWN_RECORD_WRITES_EVENT as ol } from "../panels/RecordIntegrityBanner.js";
|
|
24
|
+
import { Sheet as id, SheetContent as od, SheetHeader as sd, SheetTitle as ld } from "../ui/sheet.js";
|
|
25
|
+
import { useAddendumO2M as ad, useAddendumView as dd } from "./AddendumFieldContext.js";
|
|
26
|
+
import { resolveCompareEndpoint as cd, useCompareSeries as ud, compareColumnClosed as zt, fmtMoney as no, CompareProposalBanner as fd, CompareStripChips as md, GridStatChip as pd, CompareCell as ro, compareRowFor as io, compareColumnSum as hd, ReconcileAction as gd } from "./CompareSeries.js";
|
|
27
27
|
import { FieldRenderer as jn } from "./FieldRenderer.js";
|
|
28
|
-
import { primaryControl as
|
|
29
|
-
import { GridBulkEditDialog as
|
|
30
|
-
import { parseJson as oo, SENTINEL_FIELDS as fo, applyDisplayTemplate as mr, EMPTY_NESTED_OPS as ti, SYSTEM_FIELDS as
|
|
31
|
-
import { lineLabelOf as ni, rowBaseBookFor as
|
|
32
|
-
import { NUMBER_FIELD_TYPES as
|
|
33
|
-
import { LineCollisionDialog as
|
|
28
|
+
import { primaryControl as bd, nameFieldControl as yd } from "./field-a11y.js";
|
|
29
|
+
import { GridBulkEditDialog as wd } from "./GridBulkEditDialog.js";
|
|
30
|
+
import { parseJson as oo, SENTINEL_FIELDS as fo, applyDisplayTemplate as mr, EMPTY_NESTED_OPS as ti, SYSTEM_FIELDS as sl } from "./helpers.js";
|
|
31
|
+
import { lineLabelOf as ni, rowBaseBookFor as vd, writeLineGuarded as xd, lineConflictKey as _d, resolveLineCollision as kd, snapshotRowBases as Nd, incrementGuarded as Sd } from "./line-midair.js";
|
|
32
|
+
import { NUMBER_FIELD_TYPES as $d, checkNumberEntry as qd, changedRowFields as ll, lineRuleErrors as Ed, computedColumnErrors as Od, zeroQtyColumn as al, dropRevertedFields as Id, isRealLineEdit as Ad } from "./line-qty.js";
|
|
33
|
+
import { LineCollisionDialog as jd } from "./MidairCollisionDialog.js";
|
|
34
34
|
import { NestedRelationEditor as so } from "./NestedRelationEditor.js";
|
|
35
|
-
import { useO2MStaging as
|
|
35
|
+
import { useO2MStaging as Ld, useLiveRows as Td, useStagedRelations as Rd } from "./O2MStagingContext.js";
|
|
36
36
|
import { RelationCombobox as lo } from "./RelationCombobox.js";
|
|
37
|
-
import { useRowCommentCounts as
|
|
38
|
-
import { RowHistorySheet as
|
|
39
|
-
import { useRowMatches as
|
|
40
|
-
import { RowWatchButton as
|
|
41
|
-
import { RuleProvenanceChip as
|
|
42
|
-
import { normalizeSetAllRows as
|
|
43
|
-
import { resolveOptionFilterTokens as
|
|
44
|
-
function
|
|
37
|
+
import { useRowCommentCounts as Md, RowCommentButton as Kd } from "./RowComments.js";
|
|
38
|
+
import { RowHistorySheet as dl, parseImportStamp as Pd } from "./RowHistorySheet.js";
|
|
39
|
+
import { useRowMatches as Dd, RowMatchDot as cl, rowFromCandidate as Wd, RowMatchPanel as Ud } from "./RowMatchPanel.js";
|
|
40
|
+
import { RowWatchButton as Bd } from "./RowWatchButton.js";
|
|
41
|
+
import { RuleProvenanceChip as Jd } from "./RuleProvenancePopover.js";
|
|
42
|
+
import { normalizeSetAllRows as Qd, SetAllRowsButton as zd } from "./SetAllRowsButton.js";
|
|
43
|
+
import { resolveOptionFilterTokens as yl } from "../../lib/option-filter-tokens.js";
|
|
44
|
+
function ul(s, u) {
|
|
45
45
|
const b = s[u.field], A = b == null || b === "", U = u.op ?? "eq";
|
|
46
46
|
if (U === "null") return A;
|
|
47
47
|
if (U === "nnull") return !A;
|
|
@@ -57,17 +57,17 @@ function ao(s, u) {
|
|
|
57
57
|
if (!(u != null && u.length)) return [];
|
|
58
58
|
const b = [];
|
|
59
59
|
for (const B of u)
|
|
60
|
-
!((A = B == null ? void 0 : B.when) != null && A.field) || !((U = B == null ? void 0 : B.expect) != null && U.field) ||
|
|
60
|
+
!((A = B == null ? void 0 : B.when) != null && A.field) || !((U = B == null ? void 0 : B.expect) != null && U.field) || ul(s, B.when) && (ul(s, B.expect) || b.push(B.label || `${B.when.field} vs ${B.expect.field}`));
|
|
61
61
|
return b;
|
|
62
62
|
}
|
|
63
|
-
const
|
|
63
|
+
const Fd = {
|
|
64
64
|
lt: "<",
|
|
65
65
|
gt: ">",
|
|
66
66
|
quot: '"',
|
|
67
67
|
amp: "&",
|
|
68
68
|
"#39": "'"
|
|
69
69
|
};
|
|
70
|
-
function
|
|
70
|
+
function Vd(s, u) {
|
|
71
71
|
const b = [];
|
|
72
72
|
return { rows: s.map((U) => {
|
|
73
73
|
const B = [], ee = { ...U };
|
|
@@ -78,7 +78,7 @@ function Fd(s, u) {
|
|
|
78
78
|
return b.push(B), ee;
|
|
79
79
|
}), dropped: b };
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function fl({
|
|
82
82
|
saved: s,
|
|
83
83
|
onDelete: u
|
|
84
84
|
}) {
|
|
@@ -102,11 +102,11 @@ function ul({
|
|
|
102
102
|
A(!1), u(U);
|
|
103
103
|
},
|
|
104
104
|
className: b ? "rounded bg-red-50 p-0.5 text-red-600 dark:bg-red-900/20 dark:text-red-400" : "rounded p-0.5 text-slate-300 hover:text-red-500",
|
|
105
|
-
children: /* @__PURE__ */ l(
|
|
105
|
+
children: /* @__PURE__ */ l(Da, { className: "h-3 w-3" })
|
|
106
106
|
}
|
|
107
107
|
);
|
|
108
108
|
}
|
|
109
|
-
function
|
|
109
|
+
function Hd({ children: s }) {
|
|
110
110
|
const [u, b] = J(null);
|
|
111
111
|
return /* @__PURE__ */ k(
|
|
112
112
|
"span",
|
|
@@ -121,7 +121,7 @@ function Vd({ children: s }) {
|
|
|
121
121
|
children: [
|
|
122
122
|
/* @__PURE__ */ l(hr, { className: "h-3 w-3 shrink-0 text-amber-500" }),
|
|
123
123
|
/* @__PURE__ */ l("span", { className: "min-w-0 truncate", children: s }),
|
|
124
|
-
u &&
|
|
124
|
+
u && Ba(
|
|
125
125
|
/* @__PURE__ */ l(
|
|
126
126
|
"div",
|
|
127
127
|
{
|
|
@@ -136,11 +136,11 @@ function Vd({ children: s }) {
|
|
|
136
136
|
}
|
|
137
137
|
);
|
|
138
138
|
}
|
|
139
|
-
function
|
|
139
|
+
function Yd(s) {
|
|
140
140
|
if (typeof s != "string" || !s.trim()) return [];
|
|
141
141
|
const u = s.replace(
|
|
142
142
|
/&(lt|gt|quot|amp|#39);/g,
|
|
143
|
-
(B, ee) =>
|
|
143
|
+
(B, ee) => Fd[ee] ?? ""
|
|
144
144
|
), b = [], A = /"detail"\s*:\s*"((?:[^"\\]|\\.)*)"/g;
|
|
145
145
|
let U = A.exec(u);
|
|
146
146
|
for (; U; ) {
|
|
@@ -166,7 +166,7 @@ const mo = /* @__PURE__ */ new Set([
|
|
|
166
166
|
"group",
|
|
167
167
|
"divider"
|
|
168
168
|
]), pr = "__all__";
|
|
169
|
-
function
|
|
169
|
+
function wl(s, u, b, A) {
|
|
170
170
|
if (u <= 0) return [];
|
|
171
171
|
let U;
|
|
172
172
|
for (b === "front" ? U = Array.from({ length: u }, (Q, R) => u - R) : b === "back" ? U = Array.from({ length: u }, (Q, R) => R + 1) : b === "shape" && A && A.some((Q) => Q > 0) ? U = A.slice(0, u).map((Q) => Math.max(0, Q)) : U = Array.from({ length: u }, () => 1); U.length < u; ) U.push(0);
|
|
@@ -182,12 +182,12 @@ function yl(s, u, b, A) {
|
|
|
182
182
|
return ee;
|
|
183
183
|
}
|
|
184
184
|
const co = 1e3;
|
|
185
|
-
function
|
|
185
|
+
function Gd(s) {
|
|
186
186
|
let u = 0;
|
|
187
187
|
for (let b = 0; b < s.length; b++) u = u * 31 + s.charCodeAt(b) | 0;
|
|
188
188
|
return u;
|
|
189
189
|
}
|
|
190
|
-
function
|
|
190
|
+
function Cd(s) {
|
|
191
191
|
if (s.line_number != null && s.line_number !== "") return `line ${s.line_number}`;
|
|
192
192
|
for (const u of ["year", "name", "title", "label", "number"]) {
|
|
193
193
|
const b = s[u];
|
|
@@ -238,10 +238,10 @@ function ri(s, u) {
|
|
|
238
238
|
s
|
|
239
239
|
);
|
|
240
240
|
}
|
|
241
|
-
function
|
|
241
|
+
function Xd(s, u, b) {
|
|
242
242
|
return u === "presence" ? s != null && String(s).trim() !== "" ? "Yes" : "No" : s == null || s === "" ? "—" : u === "currency" && Number.isFinite(Number(s)) ? Number(s).toLocaleString("en-US", $t(b, "currency")) : String(s);
|
|
243
243
|
}
|
|
244
|
-
function
|
|
244
|
+
function Zd({
|
|
245
245
|
config: s,
|
|
246
246
|
relatedCollection: u,
|
|
247
247
|
manyField: b,
|
|
@@ -271,7 +271,7 @@ function Xd({
|
|
|
271
271
|
),
|
|
272
272
|
[s.columns]
|
|
273
273
|
), Ze = K(
|
|
274
|
-
() =>
|
|
274
|
+
() => yl(s.filter, ee, A),
|
|
275
275
|
[s.filter, ee, A]
|
|
276
276
|
), qt = K(() => {
|
|
277
277
|
const F = /* @__PURE__ */ new Set(["id"]);
|
|
@@ -348,7 +348,7 @@ function Xd({
|
|
|
348
348
|
we(F);
|
|
349
349
|
try {
|
|
350
350
|
if (H === null || H === 0)
|
|
351
|
-
(pe == null ? void 0 : pe.id) != null && await Se.request(
|
|
351
|
+
(pe == null ? void 0 : pe.id) != null && await Se.request(bl(`/items/${u}/${pe.id}`));
|
|
352
352
|
else if ((pe == null ? void 0 : pe.id) != null) {
|
|
353
353
|
if (Number(pe[s.value_field]) !== H) {
|
|
354
354
|
const $ = { [s.value_field]: H };
|
|
@@ -395,8 +395,8 @@ function Xd({
|
|
|
395
395
|
children: "Allocate…"
|
|
396
396
|
}
|
|
397
397
|
),
|
|
398
|
-
/* @__PURE__ */ l(
|
|
399
|
-
/* @__PURE__ */ l(
|
|
398
|
+
/* @__PURE__ */ l(id, { open: We, onOpenChange: fe, children: /* @__PURE__ */ k(od, { side: "right", className: "w-[92vw] sm:max-w-[1200px] overflow-y-auto p-0", children: [
|
|
399
|
+
/* @__PURE__ */ l(sd, { className: "border-b border-slate-200 px-5 py-3", children: /* @__PURE__ */ l(ld, { className: "text-[14px]", children: s.title ?? "Allocate" }) }),
|
|
400
400
|
/* @__PURE__ */ k("div", { className: "p-4", children: [
|
|
401
401
|
/* @__PURE__ */ l("p", { className: "mb-2 text-[11px] text-slate-400", children: "Enter an amount to allocate a line — clearing it removes the allocation." }),
|
|
402
402
|
at ? /* @__PURE__ */ l("div", { className: "py-10 text-center", children: /* @__PURE__ */ l(Rn, { className: "inline h-4 w-4 animate-spin text-slate-400" }) }) : le.length === 0 ? /* @__PURE__ */ l("p", { className: "py-10 text-center text-[12px] text-slate-400", children: "No eligible rows for the current record's filters." }) : /* @__PURE__ */ l("div", { className: "overflow-x-auto rounded-lg border border-slate-200", children: /* @__PURE__ */ k("table", { className: "w-full text-left text-[12px]", children: [
|
|
@@ -461,7 +461,7 @@ function Xd({
|
|
|
461
461
|
className: "flex w-full items-center gap-1.5 text-left",
|
|
462
462
|
children: [
|
|
463
463
|
/* @__PURE__ */ l(
|
|
464
|
-
|
|
464
|
+
gl,
|
|
465
465
|
{
|
|
466
466
|
className: xe(
|
|
467
467
|
"h-3 w-3 shrink-0 text-slate-400 transition-transform",
|
|
@@ -505,7 +505,7 @@ function Xd({
|
|
|
505
505
|
$.push(
|
|
506
506
|
/* @__PURE__ */ k("tr", { className: xe(Kn && "bg-nvr-cyan/5"), children: [
|
|
507
507
|
qe.map((q, S) => {
|
|
508
|
-
const rt = q.formula ? Mn(q.formula, me) :
|
|
508
|
+
const rt = q.formula ? Mn(q.formula, me) : Xd(ri(me, q.path ?? ""), q.format);
|
|
509
509
|
return /* @__PURE__ */ l(
|
|
510
510
|
"td",
|
|
511
511
|
{
|
|
@@ -557,7 +557,7 @@ function Xd({
|
|
|
557
557
|
] }) })
|
|
558
558
|
] });
|
|
559
559
|
}
|
|
560
|
-
function
|
|
560
|
+
function ec({
|
|
561
561
|
config: s,
|
|
562
562
|
rows: u,
|
|
563
563
|
relatedCollection: b,
|
|
@@ -609,7 +609,7 @@ function Zd({
|
|
|
609
609
|
let ze = 0, we = 0;
|
|
610
610
|
for (const Y of u) {
|
|
611
611
|
const ye = { ...Y, __agg__: fe(Y.id) };
|
|
612
|
-
if (s.guard && !
|
|
612
|
+
if (s.guard && !Ya(s.guard, ye)) {
|
|
613
613
|
we++;
|
|
614
614
|
continue;
|
|
615
615
|
}
|
|
@@ -667,7 +667,7 @@ function Zd({
|
|
|
667
667
|
}
|
|
668
668
|
);
|
|
669
669
|
}
|
|
670
|
-
function
|
|
670
|
+
function tc({
|
|
671
671
|
config: s,
|
|
672
672
|
matchCfg: u,
|
|
673
673
|
rows: b,
|
|
@@ -676,14 +676,14 @@ function ec({
|
|
|
676
676
|
relatedCollection: B,
|
|
677
677
|
manyField: ee
|
|
678
678
|
}) {
|
|
679
|
-
const oe = si(), Q =
|
|
679
|
+
const oe = si(), Q = hl(), [R, se] = J(!1), [je, D] = J(null), re = async () => {
|
|
680
680
|
if (R) return;
|
|
681
681
|
se(!0), D(null);
|
|
682
682
|
const Ne = s.fk_field, te = s.alloc_qty_field, Se = s.candidates.min_capacity ?? 1, We = [
|
|
683
683
|
...s.candidates.capacity_formula.matchAll(/\{\{\s*(\w+)\s*\}\}/g)
|
|
684
684
|
].map((Te) => Te[1]), fe = {};
|
|
685
685
|
let ze = 0, we = 0, Y = 0;
|
|
686
|
-
const ye = [], Ge = (Te, qe) =>
|
|
686
|
+
const ye = [], Ge = (Te, qe) => Sd(oe, u.collection, Te, te, qe);
|
|
687
687
|
try {
|
|
688
688
|
for (let qe = 0; qe < b.length; qe++) {
|
|
689
689
|
const Ze = b[qe], qt = Number(Ze[s.row_qty_field]);
|
|
@@ -778,12 +778,12 @@ function ec({
|
|
|
778
778
|
je && /* @__PURE__ */ l("span", { className: "text-[11px] text-slate-500", children: je })
|
|
779
779
|
] });
|
|
780
780
|
}
|
|
781
|
-
function
|
|
781
|
+
function nc(s) {
|
|
782
782
|
return s.filter(
|
|
783
783
|
(u) => u.group_key === "__apply_values__" && !mo.has(u.type ?? "") && !fo.has(u.field) && !u.readonly && !(u.computed_type === "write" && u.computed_formula) && u.interface !== "formula-column" && u.interface !== "match-agg-column" && u.interface !== "relation-path"
|
|
784
784
|
);
|
|
785
785
|
}
|
|
786
|
-
function
|
|
786
|
+
function Hc({
|
|
787
787
|
relatedCollection: s,
|
|
788
788
|
manyField: u,
|
|
789
789
|
parentId: b,
|
|
@@ -827,8 +827,8 @@ function Vc({
|
|
|
827
827
|
emptyLabel: H,
|
|
828
828
|
editorMode: pe
|
|
829
829
|
}) {
|
|
830
|
-
var
|
|
831
|
-
const $ = si(), Ee =
|
|
830
|
+
var Xs, Zs;
|
|
831
|
+
const $ = si(), Ee = Xa(), me = Qa(), z = hl(), x = Ld(), Mt = Td(), Kn = Rd(), dt = ad()[M ?? ""] ?? [], q = b === "new", S = za(), rt = Fa(), Kt = Ca(), Vt = `nvr_grid_editor_${s}_${M ?? u}`, [li, gr] = J(() => {
|
|
832
832
|
if (typeof localStorage > "u") return null;
|
|
833
833
|
try {
|
|
834
834
|
const e = localStorage.getItem(Vt);
|
|
@@ -904,7 +904,7 @@ function Vc({
|
|
|
904
904
|
};
|
|
905
905
|
return e.addEventListener("keydown", n), () => e.removeEventListener("keydown", n);
|
|
906
906
|
}, [$e]);
|
|
907
|
-
const [cn,
|
|
907
|
+
const [cn, xl] = J(!1), [Pt, xr] = J(/* @__PURE__ */ new Set()), [Dn, yo] = J(!1), wo = (e) => xr((n) => {
|
|
908
908
|
const t = new Set(n);
|
|
909
909
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
910
910
|
}), vo = xt ? xt.line_field ?? "line_number" : null, { data: _r } = Ye({
|
|
@@ -912,7 +912,7 @@ function Vc({
|
|
|
912
912
|
queryFn: () => $.request(de(`/erp-submissions/${A}/${encodeURIComponent(String(b))}`)).then((e) => e.data ?? []),
|
|
913
913
|
enabled: !!xt && !!A && !q && !!b,
|
|
914
914
|
staleTime: 15e3
|
|
915
|
-
}),
|
|
915
|
+
}), _l = K(() => {
|
|
916
916
|
const e = /* @__PURE__ */ new Map(), n = _r == null ? void 0 : _r[0];
|
|
917
917
|
if (!n || n.status !== "failed") return e;
|
|
918
918
|
const t = n.response, r = t && typeof t == "object" && Array.isArray(t.orderDetailResponse) ? t.orderDetailResponse : [];
|
|
@@ -923,7 +923,7 @@ function Vc({
|
|
|
923
923
|
if (!["ERROR", "FAILED"].includes(a)) continue;
|
|
924
924
|
const c = String((o == null ? void 0 : o.lineNumber) ?? "");
|
|
925
925
|
if (!c || e.has(c)) continue;
|
|
926
|
-
const d =
|
|
926
|
+
const d = Yd(o == null ? void 0 : o.lineDetailedMessage), g = d.find(
|
|
927
927
|
(p) => new RegExp(`^Line(?:Number)?\\s*${c}\\s*:`, "i").test(p.trim())
|
|
928
928
|
) ?? d[0];
|
|
929
929
|
g && e.set(c, g.replace(/^Line(?:Number)?\s*\d+\s*:\s*/i, ""));
|
|
@@ -953,7 +953,7 @@ function Vc({
|
|
|
953
953
|
}).catch(() => di(!1));
|
|
954
954
|
}
|
|
955
955
|
}, []);
|
|
956
|
-
const [
|
|
956
|
+
const [kl, ko] = J(!1), Nl = K(
|
|
957
957
|
() => /* @__PURE__ */ new Set([
|
|
958
958
|
"id",
|
|
959
959
|
u,
|
|
@@ -966,7 +966,7 @@ function Vc({
|
|
|
966
966
|
"creator"
|
|
967
967
|
]),
|
|
968
968
|
[u]
|
|
969
|
-
), No = ae(/* @__PURE__ */ new WeakMap()),
|
|
969
|
+
), No = ae(/* @__PURE__ */ new WeakMap()), Sl = async (e) => {
|
|
970
970
|
const n = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set([
|
|
971
971
|
...Object.keys(Ve),
|
|
972
972
|
...Object.keys(ir)
|
|
@@ -1001,7 +1001,7 @@ function Vc({
|
|
|
1001
1001
|
}
|
|
1002
1002
|
})
|
|
1003
1003
|
), n;
|
|
1004
|
-
},
|
|
1004
|
+
}, $l = async (e) => {
|
|
1005
1005
|
if (x)
|
|
1006
1006
|
try {
|
|
1007
1007
|
const t = (await $.request(
|
|
@@ -1012,9 +1012,9 @@ function Vc({
|
|
|
1012
1012
|
)).data ?? [], r = t.map((g) => {
|
|
1013
1013
|
const p = {};
|
|
1014
1014
|
for (const [h, v] of Object.entries(g))
|
|
1015
|
-
!
|
|
1015
|
+
!Nl.has(h) && v != null && typeof v != "object" && (p[h] = v);
|
|
1016
1016
|
return p;
|
|
1017
|
-
}), i = await
|
|
1017
|
+
}), i = await Sl(r), { rows: o, dropped: a } = Vd(r, i);
|
|
1018
1018
|
en(o).forEach((g, p) => {
|
|
1019
1019
|
var h;
|
|
1020
1020
|
(h = a[p]) != null && h.length && No.current.set(g, new Set(a[p])), x.queueRow(s, u, g);
|
|
@@ -1031,14 +1031,14 @@ function Vc({
|
|
|
1031
1031
|
} catch {
|
|
1032
1032
|
be.error("Could not copy lines");
|
|
1033
1033
|
}
|
|
1034
|
-
}, ut = A && !q ? `?parent_collection=${encodeURIComponent(A)}&parent_id=${encodeURIComponent(b)}` : "", [Oe, Wn] = J(null), [
|
|
1034
|
+
}, ut = A && !q ? `?parent_collection=${encodeURIComponent(A)}&parent_id=${encodeURIComponent(b)}` : "", [Oe, Wn] = J(null), [ql, ci] = J(null), [So, kr] = J(!1), [El, $o] = J(!1), { data: Ol = [], isLoading: Il } = Ye({
|
|
1035
1035
|
queryKey: ["o2m-row-revisions", s, Oe == null ? void 0 : Oe.id],
|
|
1036
1036
|
queryFn: () => $.request(
|
|
1037
1037
|
de("/revisions", { collection: s, item: String(Oe == null ? void 0 : Oe.id) })
|
|
1038
1038
|
).then((e) => e.data ?? []),
|
|
1039
1039
|
enabled: !!(Oe != null && Oe.id),
|
|
1040
1040
|
staleTime: 15e3
|
|
1041
|
-
}), { data: Yt, isLoading:
|
|
1041
|
+
}), { data: Yt, isLoading: Al } = Ye({
|
|
1042
1042
|
queryKey: ["o2m-field-snapshots", s, u, b],
|
|
1043
1043
|
queryFn: () => $.request(
|
|
1044
1044
|
de("/revisions/o2m-snapshots", {
|
|
@@ -1049,7 +1049,7 @@ function Vc({
|
|
|
1049
1049
|
),
|
|
1050
1050
|
enabled: So && !q,
|
|
1051
1051
|
staleTime: 15e3
|
|
1052
|
-
}),
|
|
1052
|
+
}), jl = K(
|
|
1053
1053
|
() => ((Yt == null ? void 0 : Yt.data) ?? []).map((e) => ({
|
|
1054
1054
|
id: e.revision_id,
|
|
1055
1055
|
delta: e.delta ?? null,
|
|
@@ -1064,7 +1064,7 @@ function Vc({
|
|
|
1064
1064
|
})),
|
|
1065
1065
|
[Yt]
|
|
1066
1066
|
);
|
|
1067
|
-
async function
|
|
1067
|
+
async function Ll(e) {
|
|
1068
1068
|
$o(!0);
|
|
1069
1069
|
try {
|
|
1070
1070
|
const n = await $.request(
|
|
@@ -1074,7 +1074,7 @@ function Vc({
|
|
|
1074
1074
|
parent_id: b,
|
|
1075
1075
|
target_timestamp: e
|
|
1076
1076
|
})
|
|
1077
|
-
), t =
|
|
1077
|
+
), t = ed(n);
|
|
1078
1078
|
t && be.warning(t, { duration: 1e4 }), z.invalidateQueries({ queryKey: ["o2m-rows", s, u, b] }), z.invalidateQueries({
|
|
1079
1079
|
queryKey: ["o2m-field-snapshots", s, u, b]
|
|
1080
1080
|
}), kr(!1);
|
|
@@ -1089,13 +1089,13 @@ function Vc({
|
|
|
1089
1089
|
(D ?? []).filter((e) => e.target_type === "lock").map((e) => e.target_field)
|
|
1090
1090
|
),
|
|
1091
1091
|
[D]
|
|
1092
|
-
), [f, Be] = J(null), ft =
|
|
1092
|
+
), [f, Be] = J(null), ft = Ua(), Bn = (e, n) => `${ft}-${e}-${n}`, Ce = ae(null), qo = (e, n) => e && e !== "new" && !e.startsWith("pending:") ? `${s}:${e}:${n}` : void 0, Et = ae(null), Nr = (e, n) => {
|
|
1093
1093
|
!e || typeof window > "u" || window.dispatchEvent(new CustomEvent("nvr:cell-editing", { detail: { cell: e, state: n } }));
|
|
1094
|
-
},
|
|
1094
|
+
}, Tl = (e) => {
|
|
1095
1095
|
var t, r, i;
|
|
1096
1096
|
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;
|
|
1097
1097
|
n !== Et.current && (Et.current && Nr(Et.current, "end"), Et.current = n, n && Nr(n, "start"));
|
|
1098
|
-
},
|
|
1098
|
+
}, Rl = (e) => {
|
|
1099
1099
|
var t, r;
|
|
1100
1100
|
(r = (t = e.relatedTarget) == null ? void 0 : t.closest) != null && r.call(t, "[data-grid-cell]") || (Et.current && Nr(Et.current, "end"), Et.current = null);
|
|
1101
1101
|
};
|
|
@@ -1185,7 +1185,7 @@ function Vc({
|
|
|
1185
1185
|
return document.addEventListener("mousedown", e, !0), () => document.removeEventListener("mousedown", e, !0);
|
|
1186
1186
|
}, [f, L]);
|
|
1187
1187
|
const [_t, fn] = J(!1), [jo, Ot] = J(null), [Qn, $r] = J(null), [Lo, To] = J(!1);
|
|
1188
|
-
async function
|
|
1188
|
+
async function Ml() {
|
|
1189
1189
|
if (!Qn) return;
|
|
1190
1190
|
To(!0);
|
|
1191
1191
|
const e = [];
|
|
@@ -1196,7 +1196,7 @@ function Vc({
|
|
|
1196
1196
|
try {
|
|
1197
1197
|
await $.request(Le(`/items/${r.collection}`, { ...o, [r.fkField]: r.rowId }));
|
|
1198
1198
|
} catch (a) {
|
|
1199
|
-
i.push(o), n || (n =
|
|
1199
|
+
i.push(o), n || (n = pl(a));
|
|
1200
1200
|
}
|
|
1201
1201
|
i.length && e.push({ ...r, members: i });
|
|
1202
1202
|
}
|
|
@@ -1209,12 +1209,12 @@ function Vc({
|
|
|
1209
1209
|
} : null
|
|
1210
1210
|
);
|
|
1211
1211
|
}
|
|
1212
|
-
const [qr, zn] = J(null), Ie =
|
|
1212
|
+
const [qr, zn] = J(null), Ie = dd(), [fi, Kl] = J(() => {
|
|
1213
1213
|
var e;
|
|
1214
1214
|
return Ne === pr ? pr : Ne && (re != null && re.some((n) => n.name === Ne)) ? Ne : (e = re == null ? void 0 : re[0]) == null ? void 0 : e.name;
|
|
1215
1215
|
});
|
|
1216
1216
|
function Ro(e) {
|
|
1217
|
-
|
|
1217
|
+
Kl(e);
|
|
1218
1218
|
}
|
|
1219
1219
|
const pt = ae(null), Fn = ae(!1), Er = (e) => {
|
|
1220
1220
|
const n = e;
|
|
@@ -1235,14 +1235,17 @@ function Vc({
|
|
|
1235
1235
|
)
|
|
1236
1236
|
).then((e) => e.data ?? []),
|
|
1237
1237
|
staleTime: 6e4
|
|
1238
|
-
}), { data:
|
|
1239
|
-
|
|
1238
|
+
}), { data: Ko } = Ye({
|
|
1239
|
+
// Its own key: other readers keep the WHOLE meta object under ['collection-meta', c], and
|
|
1240
|
+
// whichever filled the cache first decided the shape here (prod 2026-11-13: relations.find
|
|
1241
|
+
// is not a function).
|
|
1242
|
+
queryKey: ["collection-relations", s],
|
|
1240
1243
|
queryFn: () => $.request(de(`/collections/${s}`)).then((e) => {
|
|
1241
1244
|
const n = e.data;
|
|
1242
1245
|
return (n == null ? void 0 : n.relations) ?? [];
|
|
1243
1246
|
}),
|
|
1244
1247
|
staleTime: 10 * 6e4
|
|
1245
|
-
}), { data: pi } = Ye({
|
|
1248
|
+
}), Me = Array.isArray(Ko) ? Ko : [], { data: pi } = Ye({
|
|
1246
1249
|
queryKey: ["layout-meta", Ct],
|
|
1247
1250
|
queryFn: () => $.request(
|
|
1248
1251
|
de(`/collection-layouts/${Ct}`)
|
|
@@ -1285,7 +1288,7 @@ function Vc({
|
|
|
1285
1288
|
enabled: !q,
|
|
1286
1289
|
staleTime: 3e4
|
|
1287
1290
|
}), kt = K(
|
|
1288
|
-
() =>
|
|
1291
|
+
() => vd($, s),
|
|
1289
1292
|
[$, s]
|
|
1290
1293
|
);
|
|
1291
1294
|
ge(() => {
|
|
@@ -1302,7 +1305,7 @@ function Vc({
|
|
|
1302
1305
|
for (const r of e) t.set(r.rowId, r);
|
|
1303
1306
|
return [...t.values()];
|
|
1304
1307
|
});
|
|
1305
|
-
},
|
|
1308
|
+
}, Pl = Ha(2e3), { data: gn } = Ye({
|
|
1306
1309
|
queryKey: ["o2m-cell-provenance", s, u, b, Ir],
|
|
1307
1310
|
queryFn: () => $.request(
|
|
1308
1311
|
de("/revisions/o2m-cell-provenance", {
|
|
@@ -1311,10 +1314,10 @@ function Vc({
|
|
|
1311
1314
|
parent_id: b
|
|
1312
1315
|
})
|
|
1313
1316
|
).then((e) => ({ data: e.data ?? {}, created: e.created ?? {} })),
|
|
1314
|
-
enabled:
|
|
1317
|
+
enabled: Pl && !!B && !q && Je.length > 0,
|
|
1315
1318
|
staleTime: 6e4,
|
|
1316
1319
|
placeholderData: (e) => e
|
|
1317
|
-
}),
|
|
1320
|
+
}), Dl = !!(at != null && at.enabled) && typeof (at == null ? void 0 : at.field) == "string", { data: it } = Ye({
|
|
1318
1321
|
queryKey: [
|
|
1319
1322
|
"line-aging",
|
|
1320
1323
|
A ?? "",
|
|
@@ -1329,18 +1332,18 @@ function Vc({
|
|
|
1329
1332
|
parent_id: b
|
|
1330
1333
|
})
|
|
1331
1334
|
).then((e) => e.data ?? null),
|
|
1332
|
-
enabled:
|
|
1335
|
+
enabled: Dl && !q && !!A,
|
|
1333
1336
|
staleTime: 6e4,
|
|
1334
1337
|
placeholderData: (e) => e
|
|
1335
|
-
}),
|
|
1338
|
+
}), Po = K(
|
|
1336
1339
|
() => new Set(it != null && it.overdue ? it.overdue_ids : []),
|
|
1337
1340
|
[it]
|
|
1338
|
-
),
|
|
1339
|
-
const n =
|
|
1341
|
+
), Do = it != null && it.overdue ? `${it.label} still missing · ${it.days} ${it.days === 1 ? "day" : "days"} on the clock (limit ${it.threshold_days})` : void 0, bi = (gn == null ? void 0 : gn.data) ?? {}, Wl = (gn == null ? void 0 : gn.created) ?? {}, jr = (e) => {
|
|
1342
|
+
const n = Wl[e];
|
|
1340
1343
|
if (!n) return null;
|
|
1341
|
-
const t =
|
|
1342
|
-
return t ? `From ${t.template} · ${
|
|
1343
|
-
}, Zt = je ?? [],
|
|
1344
|
+
const t = Pd(n.comment);
|
|
1345
|
+
return t ? `From ${t.template} · ${il(n.at)} by ${n.who}` : null;
|
|
1346
|
+
}, Zt = je ?? [], Wo = dn({
|
|
1344
1347
|
queries: Zt.map((e) => ({
|
|
1345
1348
|
queryKey: [
|
|
1346
1349
|
"resolve-cascade",
|
|
@@ -1364,7 +1367,7 @@ function Vc({
|
|
|
1364
1367
|
const e = {};
|
|
1365
1368
|
return !S || !Zt.length || Zt.forEach((n, t) => {
|
|
1366
1369
|
var o;
|
|
1367
|
-
const r = (o =
|
|
1370
|
+
const r = (o = Wo[t]) == null ? void 0 : o.data;
|
|
1368
1371
|
if (!r || r.type === "none") return;
|
|
1369
1372
|
const i = S.draft[n.parent_field];
|
|
1370
1373
|
i == null || i === "" || (r.type === "direct_fk" ? e[n.child_field] = { [r.filter_column]: { _eq: i } } : r.type === "m2m_junction" && (e[n.child_field] = {
|
|
@@ -1376,7 +1379,7 @@ function Vc({
|
|
|
1376
1379
|
}
|
|
1377
1380
|
}));
|
|
1378
1381
|
}), e;
|
|
1379
|
-
}, [Zt,
|
|
1382
|
+
}, [Zt, Wo, S]), Lr = K(() => {
|
|
1380
1383
|
var n, t;
|
|
1381
1384
|
const e = {};
|
|
1382
1385
|
for (const r of Zt) {
|
|
@@ -1394,11 +1397,11 @@ function Vc({
|
|
|
1394
1397
|
ce.filter((e) => e.computed_type === "write" && !!e.computed_formula).map((e) => [e.field, String(e.computed_formula)])
|
|
1395
1398
|
),
|
|
1396
1399
|
[ce]
|
|
1397
|
-
),
|
|
1400
|
+
), Uo = K(
|
|
1398
1401
|
() => ce.filter((e) => e.interface === "relation-path" && e.field.includes(".")).map((e) => e.field),
|
|
1399
1402
|
[ce]
|
|
1400
|
-
),
|
|
1401
|
-
() =>
|
|
1403
|
+
), Bo = K(() => ce.filter((e) => e.interface === "match-agg-column"), [ce]), wi = K(
|
|
1404
|
+
() => Bo.map((e) => {
|
|
1402
1405
|
const n = e.options ? typeof e.options == "string" ? (() => {
|
|
1403
1406
|
try {
|
|
1404
1407
|
return JSON.parse(e.options);
|
|
@@ -1442,8 +1445,8 @@ function Vc({
|
|
|
1442
1445
|
format: n.format ?? null
|
|
1443
1446
|
};
|
|
1444
1447
|
}),
|
|
1445
|
-
[
|
|
1446
|
-
),
|
|
1448
|
+
[Bo, b, S == null ? void 0 : S.draft]
|
|
1449
|
+
), Jo = dn({
|
|
1447
1450
|
queries: wi.map((e) => ({
|
|
1448
1451
|
queryKey: [
|
|
1449
1452
|
"match-agg",
|
|
@@ -1466,18 +1469,18 @@ function Vc({
|
|
|
1466
1469
|
enabled: !e.unresolved && !!e.collection && !q,
|
|
1467
1470
|
staleTime: 3e4
|
|
1468
1471
|
}))
|
|
1469
|
-
}),
|
|
1472
|
+
}), Ul = K(() => {
|
|
1470
1473
|
const e = /* @__PURE__ */ new Map();
|
|
1471
1474
|
return wi.forEach((n, t) => {
|
|
1472
1475
|
var r;
|
|
1473
1476
|
e.set(n.field, {
|
|
1474
1477
|
cfg: n,
|
|
1475
|
-
rows: ((r =
|
|
1478
|
+
rows: ((r = Jo[t]) == null ? void 0 : r.data) ?? []
|
|
1476
1479
|
});
|
|
1477
1480
|
}), e;
|
|
1478
|
-
}, [wi,
|
|
1481
|
+
}, [wi, Jo]), Qo = K(() => ce.filter((e) => e.interface === "formula-column"), [ce]), zo = K(() => {
|
|
1479
1482
|
const e = /* @__PURE__ */ new Set();
|
|
1480
|
-
for (const n of
|
|
1483
|
+
for (const n of Qo) {
|
|
1481
1484
|
const t = n.options ? typeof n.options == "string" ? (() => {
|
|
1482
1485
|
try {
|
|
1483
1486
|
return JSON.parse(n.options);
|
|
@@ -1489,11 +1492,11 @@ function Vc({
|
|
|
1489
1492
|
i[1].includes(".") && e.add(i[1]);
|
|
1490
1493
|
}
|
|
1491
1494
|
return [...e];
|
|
1492
|
-
}, [
|
|
1493
|
-
const e = new Set(
|
|
1494
|
-
for (const n of
|
|
1495
|
+
}, [Qo]), vi = K(() => {
|
|
1496
|
+
const e = new Set(Uo);
|
|
1497
|
+
for (const n of zo) e.add(n);
|
|
1495
1498
|
return we != null && we.includes(".") && e.add(we), [...e];
|
|
1496
|
-
}, [
|
|
1499
|
+
}, [Uo, zo, we]), Bl = P.map((e) => String(e.id ?? "")).join(","), xi = K(() => {
|
|
1497
1500
|
const e = /* @__PURE__ */ new Set(), n = (t) => {
|
|
1498
1501
|
const r = t == null ? "" : String(t);
|
|
1499
1502
|
r && !r.startsWith("pending:") && r !== "new" && e.add(r);
|
|
@@ -1505,7 +1508,7 @@ function Vc({
|
|
|
1505
1508
|
for (const r of (t == null ? void 0 : t.rows) ?? []) n(r.id);
|
|
1506
1509
|
}
|
|
1507
1510
|
return [...e];
|
|
1508
|
-
}, [Je,
|
|
1511
|
+
}, [Je, Bl, Ie, dt]), { data: Ae } = Ye({
|
|
1509
1512
|
queryKey: [
|
|
1510
1513
|
"o2m-resolve-paths",
|
|
1511
1514
|
s,
|
|
@@ -1560,7 +1563,7 @@ function Vc({
|
|
|
1560
1563
|
fe,
|
|
1561
1564
|
ze,
|
|
1562
1565
|
we
|
|
1563
|
-
]),
|
|
1566
|
+
]), Fo = !!we && !!ht, Mr = we ? `nvr_grid_sections:${s}:${M ?? u}` : null, [Vo, Jl] = J(() => {
|
|
1564
1567
|
if (!Mr || typeof localStorage > "u") return /* @__PURE__ */ new Set();
|
|
1565
1568
|
try {
|
|
1566
1569
|
const e = localStorage.getItem(Mr), n = e ? JSON.parse(e) : null;
|
|
@@ -1568,7 +1571,7 @@ function Vc({
|
|
|
1568
1571
|
} catch {
|
|
1569
1572
|
return /* @__PURE__ */ new Set();
|
|
1570
1573
|
}
|
|
1571
|
-
}), Hn = (e) => String(e[we ?? ""] ?? "").trim() || "Uncategorized",
|
|
1574
|
+
}), Hn = (e) => String(e[we ?? ""] ?? "").trim() || "Uncategorized", Ql = (e) => Jl((n) => {
|
|
1572
1575
|
const t = new Set(n);
|
|
1573
1576
|
if (t.has(e) ? t.delete(e) : t.add(e), Mr)
|
|
1574
1577
|
try {
|
|
@@ -1576,7 +1579,7 @@ function Vc({
|
|
|
1576
1579
|
} catch {
|
|
1577
1580
|
}
|
|
1578
1581
|
return t;
|
|
1579
|
-
}),
|
|
1582
|
+
}), zl = (e) => {
|
|
1580
1583
|
const n = [];
|
|
1581
1584
|
for (const t of Ke) {
|
|
1582
1585
|
const r = oo(t.options) ?? {}, i = r.aggregate;
|
|
@@ -1605,22 +1608,22 @@ function Vc({
|
|
|
1605
1608
|
);
|
|
1606
1609
|
function he(e, n) {
|
|
1607
1610
|
if (!_i.length) return e;
|
|
1608
|
-
const t = n === void 0 ?
|
|
1611
|
+
const t = n === void 0 ? Ho(e.id) : n, r = { ...e };
|
|
1609
1612
|
for (const i of _i) {
|
|
1610
1613
|
const o = i.computed_formula;
|
|
1611
|
-
if (t && !
|
|
1614
|
+
if (t && !nd(o, r, t)) continue;
|
|
1612
1615
|
const a = Ft(o, r);
|
|
1613
1616
|
a !== null && (r[i.field] = a);
|
|
1614
1617
|
}
|
|
1615
1618
|
return r;
|
|
1616
1619
|
}
|
|
1617
|
-
function
|
|
1620
|
+
function Ho(e) {
|
|
1618
1621
|
if (e == null || e === "") return;
|
|
1619
1622
|
const n = String(e);
|
|
1620
1623
|
if (!(n.startsWith("pending:") || n === "new"))
|
|
1621
1624
|
return O.find((t) => String(t.id) === n);
|
|
1622
1625
|
}
|
|
1623
|
-
const
|
|
1626
|
+
const Fl = /* @__PURE__ */ new Set(["__apply_values__", "__create_with_defaults__"]), Yn = (e) => e === "select-multiple-m2m" || (e ?? "").endsWith("-m2m");
|
|
1624
1627
|
function ki(e) {
|
|
1625
1628
|
const n = Me.find(
|
|
1626
1629
|
(r) => r.one_collection === s && (r.one_field === e.field || r.junction_field != null && r.many_collection === e.field)
|
|
@@ -1683,7 +1686,7 @@ function Vc({
|
|
|
1683
1686
|
e.baseRows ? n : void 0
|
|
1684
1687
|
)
|
|
1685
1688
|
) : Si;
|
|
1686
|
-
}, [Ie, dt, Si]),
|
|
1689
|
+
}, [Ie, dt, Si]), Yo = Je.length >= co, It = S == null ? void 0 : S.draft, tn = Rt(
|
|
1687
1690
|
(e) => {
|
|
1688
1691
|
if (e.startsWith("$parent."))
|
|
1689
1692
|
return (It == null ? void 0 : It[e.slice(8)]) ?? 0;
|
|
@@ -1695,16 +1698,16 @@ function Vc({
|
|
|
1695
1698
|
},
|
|
1696
1699
|
[It, Cn]
|
|
1697
1700
|
), $i = K(() => Re != null && Re.length ? Re.map((e) => ({ ...e, result: wt(e.value, tn) })) : null, [Re, tn]), Kr = K(
|
|
1698
|
-
() => Pe != null && Pe.endpoint ?
|
|
1701
|
+
() => Pe != null && Pe.endpoint ? cd(Pe.endpoint, It) : null,
|
|
1699
1702
|
[Pe == null ? void 0 : Pe.endpoint, It]
|
|
1700
|
-
), qi =
|
|
1703
|
+
), qi = ud({
|
|
1701
1704
|
client: $,
|
|
1702
1705
|
endpoint: Kr,
|
|
1703
1706
|
enabled: !!Pe && !q
|
|
1704
|
-
}), j = Pe && !q ? qi.data ?? null : null,
|
|
1707
|
+
}), j = Pe && !q ? qi.data ?? null : null, Go = !!Pe && !q && !!Kr && qi.isLoading, Co = !!Pe && !q && qi.isError, Xn = Rt(
|
|
1705
1708
|
(e) => e.label || ve(e.field),
|
|
1706
1709
|
[]
|
|
1707
|
-
), { isAdmin: bn } =
|
|
1710
|
+
), { isAdmin: bn } = Va(), Pr = Rt(
|
|
1708
1711
|
(e) => {
|
|
1709
1712
|
var n;
|
|
1710
1713
|
return !bn && ((n = oo(e.options)) == null ? void 0 : n.admin_only_edit) === !0;
|
|
@@ -1744,21 +1747,21 @@ function Vc({
|
|
|
1744
1747
|
},
|
|
1745
1748
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1746
1749
|
[P, x, W, s, u, $, z, b]
|
|
1747
|
-
), Zn = Kr ? `nvr_compare_dismiss:${Kr}` : null, [
|
|
1750
|
+
), Zn = Kr ? `nvr_compare_dismiss:${Kr}` : null, [Xo, Vl] = J(() => {
|
|
1748
1751
|
try {
|
|
1749
1752
|
return !Zn || typeof window > "u" ? /* @__PURE__ */ new Set() : new Set(JSON.parse(window.localStorage.getItem(Zn) ?? "[]"));
|
|
1750
1753
|
} catch {
|
|
1751
1754
|
return /* @__PURE__ */ new Set();
|
|
1752
1755
|
}
|
|
1753
|
-
}),
|
|
1756
|
+
}), Zo = K(
|
|
1754
1757
|
// `add` proposals need the plan grid's per-period arithmetic; the flat grid only fills.
|
|
1755
1758
|
() => ((j == null ? void 0 : j.proposals) ?? []).filter(
|
|
1756
|
-
(e) => e.mode !== "add" && !
|
|
1759
|
+
(e) => e.mode !== "add" && !Xo.has(e.id)
|
|
1757
1760
|
),
|
|
1758
|
-
[j == null ? void 0 : j.proposals,
|
|
1761
|
+
[j == null ? void 0 : j.proposals, Xo]
|
|
1759
1762
|
), Oi = Rt(
|
|
1760
1763
|
(e, n = !0) => {
|
|
1761
|
-
|
|
1764
|
+
Vl((t) => {
|
|
1762
1765
|
const r = new Set(t);
|
|
1763
1766
|
r.add(e.id);
|
|
1764
1767
|
try {
|
|
@@ -1769,7 +1772,7 @@ function Vc({
|
|
|
1769
1772
|
});
|
|
1770
1773
|
},
|
|
1771
1774
|
[Zn]
|
|
1772
|
-
),
|
|
1775
|
+
), Hl = Rt(
|
|
1773
1776
|
(e) => {
|
|
1774
1777
|
if (!j) return;
|
|
1775
1778
|
const n = j.key_field, t = e.change_reason ?? e.label, r = (a) => a == null || a === "" || Number(a) === 0;
|
|
@@ -1801,7 +1804,7 @@ function Vc({
|
|
|
1801
1804
|
yn,
|
|
1802
1805
|
Oi
|
|
1803
1806
|
]
|
|
1804
|
-
),
|
|
1807
|
+
), Yl = Rt(
|
|
1805
1808
|
(e) => {
|
|
1806
1809
|
var v;
|
|
1807
1810
|
if (!((v = _e == null ? void 0 : _e.fields) != null && v.length)) return;
|
|
@@ -1821,7 +1824,7 @@ function Vc({
|
|
|
1821
1824
|
be.message("Nothing to spread into — every target is filled or closed");
|
|
1822
1825
|
return;
|
|
1823
1826
|
}
|
|
1824
|
-
const p =
|
|
1827
|
+
const p = wl(
|
|
1825
1828
|
t,
|
|
1826
1829
|
m.length,
|
|
1827
1830
|
e === "shape" ? "even" : e,
|
|
@@ -1856,16 +1859,16 @@ function Vc({
|
|
|
1856
1859
|
), nn = Mt == null ? void 0 : Mt.report;
|
|
1857
1860
|
ge(() => {
|
|
1858
1861
|
if (nn) {
|
|
1859
|
-
if (
|
|
1862
|
+
if (Yo || mn) {
|
|
1860
1863
|
nn(s, u, null);
|
|
1861
1864
|
return;
|
|
1862
1865
|
}
|
|
1863
1866
|
nn(s, u, Cn);
|
|
1864
1867
|
}
|
|
1865
|
-
}, [nn, s, u, Cn,
|
|
1866
|
-
const
|
|
1868
|
+
}, [nn, s, u, Cn, Yo, mn]);
|
|
1869
|
+
const es = ae(() => {
|
|
1867
1870
|
});
|
|
1868
|
-
|
|
1871
|
+
es.current = () => nn == null ? void 0 : nn(s, u, null), ge(() => () => es.current(), []);
|
|
1869
1872
|
const er = K(() => {
|
|
1870
1873
|
const e = /* @__PURE__ */ new Map();
|
|
1871
1874
|
for (const n of ce) {
|
|
@@ -1883,7 +1886,7 @@ function Vc({
|
|
|
1883
1886
|
i.length && e.set(n.field, i);
|
|
1884
1887
|
}
|
|
1885
1888
|
return e;
|
|
1886
|
-
}, [ce]),
|
|
1889
|
+
}, [ce]), ts = K(() => {
|
|
1887
1890
|
var n;
|
|
1888
1891
|
const e = [];
|
|
1889
1892
|
for (const t of je ?? []) {
|
|
@@ -1897,10 +1900,10 @@ function Vc({
|
|
|
1897
1900
|
);
|
|
1898
1901
|
}
|
|
1899
1902
|
return e;
|
|
1900
|
-
}, [je]),
|
|
1903
|
+
}, [je]), Gl = K(() => {
|
|
1901
1904
|
var n, t;
|
|
1902
1905
|
const e = /* @__PURE__ */ new Map();
|
|
1903
|
-
for (const r of [...er.values(),
|
|
1906
|
+
for (const r of [...er.values(), ts])
|
|
1904
1907
|
for (const i of r) {
|
|
1905
1908
|
const o = (n = S == null ? void 0 : S.draft) == null ? void 0 : n[i.parent_field];
|
|
1906
1909
|
if (o == null || o === "" || typeof o == "object") continue;
|
|
@@ -1912,17 +1915,17 @@ function Vc({
|
|
|
1912
1915
|
}), (t = e.get(a)) == null || t.fields.add(i.source_field);
|
|
1913
1916
|
}
|
|
1914
1917
|
return [...e.entries()];
|
|
1915
|
-
}, [er,
|
|
1916
|
-
queries:
|
|
1918
|
+
}, [er, ts, S == null ? void 0 : S.draft]), ns = dn({
|
|
1919
|
+
queries: Gl.map(([e, n]) => ({
|
|
1917
1920
|
queryKey: ["pinned-parent", n.collection, n.id, [...n.fields].sort().join(",")],
|
|
1918
1921
|
queryFn: () => Ee(n.collection, n.id, [...n.fields]).then((t) => [e, t]).catch(() => [e, null]),
|
|
1919
1922
|
staleTime: 6e4
|
|
1920
1923
|
}))
|
|
1921
1924
|
}), Dr = K(() => {
|
|
1922
1925
|
const e = /* @__PURE__ */ new Map();
|
|
1923
|
-
for (const n of
|
|
1926
|
+
for (const n of ns) n.data && e.set(n.data[0], n.data[1]);
|
|
1924
1927
|
return e;
|
|
1925
|
-
}, [
|
|
1928
|
+
}, [ns]), rs = (e, n) => {
|
|
1926
1929
|
var t, r, i;
|
|
1927
1930
|
for (const o of e) {
|
|
1928
1931
|
if ((t = o.when) != null && t.field) {
|
|
@@ -1938,17 +1941,17 @@ function Vc({
|
|
|
1938
1941
|
return null;
|
|
1939
1942
|
}, wn = (e, n) => {
|
|
1940
1943
|
const t = er.get(e);
|
|
1941
|
-
return t ?
|
|
1944
|
+
return t ? rs(t, n) : null;
|
|
1942
1945
|
}, ke = ce.filter(
|
|
1943
|
-
(e) => !e.hidden && (!mo.has(e.type) || Yn(e.interface)) && e.field !== u && e.field !== "id" && (!Ct || e.layout_assigned === !0) && !fo.has(e.field) && !
|
|
1944
|
-
), At = re && re.length >= 2 && fi !== pr ? re.find((e) => e.name === fi) : void 0,
|
|
1946
|
+
(e) => !e.hidden && (!mo.has(e.type) || Yn(e.interface)) && e.field !== u && e.field !== "id" && (!Ct || e.layout_assigned === !0) && !fo.has(e.field) && !Fl.has(e.group_key ?? "")
|
|
1947
|
+
), At = re && re.length >= 2 && fi !== pr ? re.find((e) => e.name === fi) : void 0, Cl = new Set(
|
|
1945
1948
|
(te ?? []).map((e) => typeof e == "string" ? e : e.field)
|
|
1946
|
-
),
|
|
1949
|
+
), is = At ? new Set(
|
|
1947
1950
|
At.columns.filter((e) => {
|
|
1948
1951
|
const n = e.indexOf(".");
|
|
1949
|
-
return n < 0 ? !0 : !
|
|
1952
|
+
return n < 0 ? !0 : !Cl.has(e.slice(0, n));
|
|
1950
1953
|
})
|
|
1951
|
-
) : null,
|
|
1954
|
+
) : null, os = is ? ke.filter((e) => is.has(e.field)) : [], vn = K(() => {
|
|
1952
1955
|
if (!At) return [];
|
|
1953
1956
|
const e = [];
|
|
1954
1957
|
for (const n of At.columns) {
|
|
@@ -1982,39 +1985,39 @@ function Vc({
|
|
|
1982
1985
|
)
|
|
1983
1986
|
],
|
|
1984
1987
|
[jt]
|
|
1985
|
-
),
|
|
1988
|
+
), ss = dn({
|
|
1986
1989
|
queries: xn.map((e) => ({
|
|
1987
1990
|
queryKey: ["field-config", e, null],
|
|
1988
1991
|
queryFn: () => $.request(de(`/field-config/${e}`)).then((n) => n.data ?? []),
|
|
1989
1992
|
staleTime: 6e4
|
|
1990
1993
|
}))
|
|
1991
|
-
}),
|
|
1994
|
+
}), ls = dn({
|
|
1992
1995
|
queries: xn.map((e) => ({
|
|
1993
|
-
queryKey: ["collection-
|
|
1996
|
+
queryKey: ["collection-relations", e],
|
|
1994
1997
|
queryFn: () => $.request(de(`/collections/${e}`)).then((n) => {
|
|
1995
1998
|
var t;
|
|
1996
1999
|
return ((t = n.data) == null ? void 0 : t.relations) ?? [];
|
|
1997
2000
|
}),
|
|
1998
2001
|
staleTime: 10 * 6e4
|
|
1999
2002
|
}))
|
|
2000
|
-
}),
|
|
2003
|
+
}), as = K(() => {
|
|
2001
2004
|
const e = /* @__PURE__ */ new Map();
|
|
2002
2005
|
return xn.forEach((n, t) => {
|
|
2003
2006
|
var r;
|
|
2004
|
-
e.set(n, ((r =
|
|
2007
|
+
e.set(n, ((r = ss[t]) == null ? void 0 : r.data) ?? []);
|
|
2005
2008
|
}), e;
|
|
2006
|
-
}, [xn,
|
|
2009
|
+
}, [xn, ss]), ds = K(() => {
|
|
2007
2010
|
const e = /* @__PURE__ */ new Map();
|
|
2008
2011
|
return xn.forEach((n, t) => {
|
|
2009
2012
|
var r;
|
|
2010
|
-
e.set(n, ((r =
|
|
2013
|
+
e.set(n, ((r = ls[t]) == null ? void 0 : r.data) ?? []);
|
|
2011
2014
|
}), e;
|
|
2012
|
-
}, [xn,
|
|
2015
|
+
}, [xn, ls]), Wr = K(() => {
|
|
2013
2016
|
const e = /* @__PURE__ */ new Map();
|
|
2014
2017
|
for (const n of rn) {
|
|
2015
2018
|
const t = jt.get(n);
|
|
2016
2019
|
if (!t) continue;
|
|
2017
|
-
const r =
|
|
2020
|
+
const r = ds.get(t.grandCollection) ?? [], i = /* @__PURE__ */ new Map();
|
|
2018
2021
|
for (const o of vn) {
|
|
2019
2022
|
if (o.relationField !== n) continue;
|
|
2020
2023
|
const a = r.find(
|
|
@@ -2025,10 +2028,10 @@ function Vc({
|
|
|
2025
2028
|
e.set(n, i);
|
|
2026
2029
|
}
|
|
2027
2030
|
return e;
|
|
2028
|
-
}, [rn, jt,
|
|
2029
|
-
() => `nvr-gf-${Math.abs(
|
|
2031
|
+
}, [rn, jt, ds, vn]), Ur = K(() => O.map((e) => String(e.id)), [O]), tr = K(
|
|
2032
|
+
() => `nvr-gf-${Math.abs(Gd(`${s}:${M ?? u}`)) % 1e5}`,
|
|
2030
2033
|
[s, M, u]
|
|
2031
|
-
),
|
|
2034
|
+
), cs = K(() => {
|
|
2032
2035
|
if (!Y) return null;
|
|
2033
2036
|
const e = [];
|
|
2034
2037
|
se && (G || q || W) && e.push(24), R && e.push(32), (q || W) && e.push(80), e.push(220);
|
|
@@ -2050,23 +2053,23 @@ function Vc({
|
|
|
2050
2053
|
q,
|
|
2051
2054
|
W,
|
|
2052
2055
|
R
|
|
2053
|
-
]), [_n,
|
|
2056
|
+
]), [_n, Xl] = J(150), us = ae(null);
|
|
2054
2057
|
ge(() => {
|
|
2055
|
-
const e =
|
|
2058
|
+
const e = us.current;
|
|
2056
2059
|
if (!e || O.length <= _n) return;
|
|
2057
2060
|
const n = new IntersectionObserver(
|
|
2058
2061
|
(t) => {
|
|
2059
|
-
t.some((r) => r.isIntersecting) &&
|
|
2062
|
+
t.some((r) => r.isIntersecting) && Xl((r) => r + 150);
|
|
2060
2063
|
},
|
|
2061
2064
|
{ rootMargin: "400px" }
|
|
2062
2065
|
);
|
|
2063
2066
|
return n.observe(e), () => n.disconnect();
|
|
2064
2067
|
}, [O.length, _n]);
|
|
2065
|
-
const
|
|
2068
|
+
const Zl = Ur.join(","), ea = Md(
|
|
2066
2069
|
s,
|
|
2067
2070
|
Ur,
|
|
2068
2071
|
!!ee && !q
|
|
2069
|
-
),
|
|
2072
|
+
), fs = dn({
|
|
2070
2073
|
queries: rn.map((e) => {
|
|
2071
2074
|
const n = jt.get(e);
|
|
2072
2075
|
return {
|
|
@@ -2077,7 +2080,7 @@ function Vc({
|
|
|
2077
2080
|
b,
|
|
2078
2081
|
"summary-members",
|
|
2079
2082
|
e,
|
|
2080
|
-
|
|
2083
|
+
Zl
|
|
2081
2084
|
],
|
|
2082
2085
|
queryFn: () => n ? $.request(
|
|
2083
2086
|
de(`/items/${n.grandCollection}`, {
|
|
@@ -2095,15 +2098,15 @@ function Vc({
|
|
|
2095
2098
|
var o;
|
|
2096
2099
|
const r = jt.get(n), i = /* @__PURE__ */ new Map();
|
|
2097
2100
|
if (r)
|
|
2098
|
-
for (const a of ((o =
|
|
2101
|
+
for (const a of ((o = fs[t]) == null ? void 0 : o.data) ?? []) {
|
|
2099
2102
|
const c = String(a[r.fkField]);
|
|
2100
2103
|
i.has(c) || i.set(c, []), i.get(c).push(a);
|
|
2101
2104
|
}
|
|
2102
2105
|
e.set(n, i);
|
|
2103
2106
|
}), e;
|
|
2104
|
-
}, [rn, jt,
|
|
2107
|
+
}, [rn, jt, fs]), ms = Kn == null ? void 0 : Kn.report;
|
|
2105
2108
|
ge(() => {
|
|
2106
|
-
if (!
|
|
2109
|
+
if (!ms || !te || te.length === 0) return;
|
|
2107
2110
|
const e = `${s}.${u}`, n = (r, i) => {
|
|
2108
2111
|
const o = {};
|
|
2109
2112
|
for (const [a, c] of Object.entries(r))
|
|
@@ -2141,11 +2144,11 @@ function Vc({
|
|
|
2141
2144
|
}
|
|
2142
2145
|
(c.created.length || c.updated.length || c.deleted.length) && (t[o.many_collection] = c);
|
|
2143
2146
|
}
|
|
2144
|
-
|
|
2147
|
+
ms(e, Object.keys(t).length > 0 ? t : null);
|
|
2145
2148
|
});
|
|
2146
2149
|
const Ii = K(() => {
|
|
2147
2150
|
const e = /* @__PURE__ */ new Map(), n = (t, r) => {
|
|
2148
|
-
r == null || r === "" ||
|
|
2151
|
+
r == null || r === "" || rl(t) || (e.has(t) || e.set(t, []), e.get(t).push(String(r)));
|
|
2149
2152
|
};
|
|
2150
2153
|
for (const [t, r] of Br) {
|
|
2151
2154
|
const i = Wr.get(t);
|
|
@@ -2177,7 +2180,7 @@ function Vc({
|
|
|
2177
2180
|
}
|
|
2178
2181
|
for (const [t, r] of e) e.set(t, [...new Set(r)].sort());
|
|
2179
2182
|
return e;
|
|
2180
|
-
}, [Br, Wr, P, C, Tr]), { data:
|
|
2183
|
+
}, [Br, Wr, P, C, Tr]), { data: ps = {} } = Ye({
|
|
2181
2184
|
queryKey: [
|
|
2182
2185
|
"summary-m2o-display",
|
|
2183
2186
|
s,
|
|
@@ -2217,9 +2220,9 @@ function Vc({
|
|
|
2217
2220
|
).then((e) => e.data),
|
|
2218
2221
|
enabled: !!s,
|
|
2219
2222
|
staleTime: 10 * 6e4
|
|
2220
|
-
}),
|
|
2223
|
+
}), hs = K(
|
|
2221
2224
|
() => vn.map(({ relationField: e, memberField: n }) => {
|
|
2222
|
-
const t = jt.get(e), i = (t ?
|
|
2225
|
+
const t = jt.get(e), i = (t ? as.get(t.grandCollection) ?? [] : []).find((o) => o.field === n);
|
|
2223
2226
|
return {
|
|
2224
2227
|
field: `${e}.${n}`,
|
|
2225
2228
|
type: "presentation",
|
|
@@ -2239,12 +2242,12 @@ function Vc({
|
|
|
2239
2242
|
dependency_config: null
|
|
2240
2243
|
};
|
|
2241
2244
|
}),
|
|
2242
|
-
[vn, jt,
|
|
2245
|
+
[vn, jt, as]
|
|
2243
2246
|
);
|
|
2244
2247
|
function ot(e) {
|
|
2245
2248
|
return e.type === "presentation" && e.field.includes(".");
|
|
2246
2249
|
}
|
|
2247
|
-
function
|
|
2250
|
+
function gs(e, n, t) {
|
|
2248
2251
|
var m, g;
|
|
2249
2252
|
if (t) {
|
|
2250
2253
|
const p = n[`__o2m_${e}`];
|
|
@@ -2266,12 +2269,12 @@ function Vc({
|
|
|
2266
2269
|
var m;
|
|
2267
2270
|
const r = e.field.indexOf(".");
|
|
2268
2271
|
if (r < 0) return "—";
|
|
2269
|
-
const i = e.field.slice(0, r), o = e.field.slice(r + 1), a =
|
|
2272
|
+
const i = e.field.slice(0, r), o = e.field.slice(r + 1), a = gs(i, n, t);
|
|
2270
2273
|
if (a.length === 0) return "—";
|
|
2271
2274
|
const c = (m = Wr.get(i)) == null ? void 0 : m.get(o), d = a.map((g) => {
|
|
2272
2275
|
var h;
|
|
2273
2276
|
const p = g[o];
|
|
2274
|
-
return p == null || p === "" ? null : c != null && c.one_collection ? ((h =
|
|
2277
|
+
return p == null || p === "" ? null : c != null && c.one_collection ? ((h = ps[c.one_collection]) == null ? void 0 : h[String(p)]) ?? String(p) : String(p);
|
|
2275
2278
|
}).filter((g) => !!g);
|
|
2276
2279
|
return d.length > 0 ? d.join(", ") : "—";
|
|
2277
2280
|
}
|
|
@@ -2279,14 +2282,14 @@ function Vc({
|
|
|
2279
2282
|
var m;
|
|
2280
2283
|
const t = e.field.indexOf(".");
|
|
2281
2284
|
if (t < 0) return "—";
|
|
2282
|
-
const r = e.field.slice(0, t), i = e.field.slice(t + 1), o =
|
|
2285
|
+
const r = e.field.slice(0, t), i = e.field.slice(t + 1), o = gs(r, n, !1);
|
|
2283
2286
|
if (o.length === 0) return "—";
|
|
2284
2287
|
const a = (m = Wr.get(r)) == null ? void 0 : m.get(i);
|
|
2285
2288
|
if (!(a != null && a.one_collection) || !me) return nr(e, n, !1);
|
|
2286
2289
|
const c = a.one_collection, d = o.map((g) => {
|
|
2287
2290
|
var h;
|
|
2288
2291
|
const p = g[i];
|
|
2289
|
-
return p == null || p === "" ? null : { id: String(p), label: ((h =
|
|
2292
|
+
return p == null || p === "" ? null : { id: String(p), label: ((h = ps[c]) == null ? void 0 : h[String(p)]) ?? String(p) };
|
|
2290
2293
|
}).filter((g) => !!g);
|
|
2291
2294
|
return d.length === 0 ? "—" : /* @__PURE__ */ l("span", { className: "inline-flex flex-wrap gap-x-1.5", children: d.map((g, p) => /* @__PURE__ */ l(
|
|
2292
2295
|
"button",
|
|
@@ -2301,16 +2304,16 @@ function Vc({
|
|
|
2301
2304
|
`${g.id}:${p}`
|
|
2302
2305
|
)) });
|
|
2303
2306
|
}
|
|
2304
|
-
const Ke = At && (
|
|
2307
|
+
const Ke = At && (os.length > 0 || hs.length > 0) ? [...os, ...hs] : ke, kn = ae(null), [ta, ji] = J(0), bs = ae(/* @__PURE__ */ new Map()), Dt = ae(0), ys = 1e4, gt = (e) => bs.current.set(String(e), Date.now());
|
|
2305
2308
|
ge(() => {
|
|
2306
2309
|
const e = (n) => {
|
|
2307
2310
|
var r;
|
|
2308
2311
|
const t = ((r = n.detail) == null ? void 0 : r.writes) ?? [];
|
|
2309
2312
|
for (const i of t) i.collection === s && gt(i.id);
|
|
2310
2313
|
};
|
|
2311
|
-
return window.addEventListener(
|
|
2314
|
+
return window.addEventListener(ol, e), () => window.removeEventListener(ol, e);
|
|
2312
2315
|
}, [s]), hn.current = async (e, n, t, r) => {
|
|
2313
|
-
const i = await
|
|
2316
|
+
const i = await xd($, kt, e, n, t, {
|
|
2314
2317
|
key: `${s}.${u}`,
|
|
2315
2318
|
label: ni(O, n, G),
|
|
2316
2319
|
...r !== void 0 ? { base: r } : {}
|
|
@@ -2320,14 +2323,14 @@ function Vc({
|
|
|
2320
2323
|
const Li = async (e, n, t) => {
|
|
2321
2324
|
const r = await hn.current(e, n, t);
|
|
2322
2325
|
return r || Vn(), r;
|
|
2323
|
-
},
|
|
2326
|
+
}, na = async (e) => {
|
|
2324
2327
|
const n = Ar ?? [];
|
|
2325
2328
|
hi(null);
|
|
2326
2329
|
let t = 0;
|
|
2327
2330
|
for (const r of n) {
|
|
2328
2331
|
const i = new Set(
|
|
2329
|
-
r.conflicts.filter((a) => e.has(
|
|
2330
|
-
), o =
|
|
2332
|
+
r.conflicts.filter((a) => e.has(_d(r, a.field))).map((a) => a.field)
|
|
2333
|
+
), o = kd(r.mine, i);
|
|
2331
2334
|
if (o) {
|
|
2332
2335
|
r.latest > 0 && kt.set(r.rowId, r.latest);
|
|
2333
2336
|
try {
|
|
@@ -2348,12 +2351,12 @@ function Vc({
|
|
|
2348
2351
|
return n;
|
|
2349
2352
|
},
|
|
2350
2353
|
[rr]
|
|
2351
|
-
),
|
|
2354
|
+
), ra = (e, n) => {
|
|
2352
2355
|
for (const t of Object.keys(n)) if (String(e[t] ?? "") !== String(n[t] ?? "")) return !1;
|
|
2353
2356
|
return !0;
|
|
2354
2357
|
}, Qr = (e, n) => {
|
|
2355
|
-
const t =
|
|
2356
|
-
return t && n - t <
|
|
2358
|
+
const t = bs.current.get(e);
|
|
2359
|
+
return t && n - t < ys ? !0 : Ga(s, e);
|
|
2357
2360
|
};
|
|
2358
2361
|
ge(() => {
|
|
2359
2362
|
if (q || mn || !rr) return;
|
|
@@ -2365,7 +2368,7 @@ function Vc({
|
|
|
2365
2368
|
let r = !1;
|
|
2366
2369
|
for (const i of Je) {
|
|
2367
2370
|
const o = String(i.id);
|
|
2368
|
-
t.add(o), (Qr(o, n) || !e.has(o) && n - Dt.current <
|
|
2371
|
+
t.add(o), (Qr(o, n) || !e.has(o) && n - Dt.current < ys) && (e.set(o, Lt(i)), r = !0);
|
|
2369
2372
|
}
|
|
2370
2373
|
for (const i of [...e.keys()])
|
|
2371
2374
|
!t.has(i) && Qr(i, n) && (e.delete(i), r = !0);
|
|
@@ -2383,13 +2386,13 @@ function Vc({
|
|
|
2383
2386
|
t.add(c);
|
|
2384
2387
|
continue;
|
|
2385
2388
|
}
|
|
2386
|
-
Qr(c, n) ||
|
|
2389
|
+
Qr(c, n) || ra(Lt(a), d) || r.add(c);
|
|
2387
2390
|
}
|
|
2388
2391
|
for (const a of e.keys()) o.has(a) || i.push(a);
|
|
2389
2392
|
return t.size === 0 && r.size === 0 && i.length === 0 ? null : { added: t, changed: r, removed: i, total: t.size + r.size + i.length };
|
|
2390
|
-
}, [Je,
|
|
2393
|
+
}, [Je, ta, Ni, q, Lt]), ia = () => {
|
|
2391
2394
|
kn.current = new Map(Je.map((e) => [String(e.id), Lt(e)])), ji((e) => e + 1);
|
|
2392
|
-
}, Nn = ae(null), [zr,
|
|
2395
|
+
}, Nn = ae(null), [zr, ws] = J({}), Sn = K(() => {
|
|
2393
2396
|
const e = Nn.current, n = f == null ? void 0 : f.rowId;
|
|
2394
2397
|
if (!e || !n || e.rowId !== n || n === "new" || n.startsWith("pending:")) return [];
|
|
2395
2398
|
const t = Je.find((o) => String(o.id) === n);
|
|
@@ -2401,18 +2404,18 @@ function Vc({
|
|
|
2401
2404
|
(a == null ? void 0 : a.computed_type) === "write" && a.computed_formula || i.push({ field: o, label: (a == null ? void 0 : a.label) || ve(o), theirs: r[o], was: e.snap[o] });
|
|
2402
2405
|
}
|
|
2403
2406
|
return i;
|
|
2404
|
-
}, [Je, f == null ? void 0 : f.rowId, f == null ? void 0 : f.draft, zr, Lt, ce]),
|
|
2407
|
+
}, [Je, f == null ? void 0 : f.rowId, f == null ? void 0 : f.draft, zr, Lt, ce]), vs = (e) => {
|
|
2405
2408
|
if (!e || Sn.length === 0 || (f == null ? void 0 : f.rowId) !== e) return null;
|
|
2406
2409
|
const n = (i) => i == null || i === "" ? "∅" : String(i).slice(0, 40), t = (i) => {
|
|
2407
2410
|
const o = { ...zr }, a = {};
|
|
2408
2411
|
for (const c of Sn)
|
|
2409
2412
|
i && c.field !== i || (a[c.field] = c.theirs, o[c.field] = c.theirs, Nn.current && (Nn.current.snap[c.field] = c.theirs));
|
|
2410
|
-
zi(a),
|
|
2413
|
+
zi(a), ws(o), (!i || Sn.length === 1) && Ui(e);
|
|
2411
2414
|
}, r = () => {
|
|
2412
2415
|
const i = { ...zr };
|
|
2413
2416
|
for (const o of Sn)
|
|
2414
2417
|
i[o.field] = o.theirs, Nn.current && (Nn.current.snap[o.field] = o.theirs);
|
|
2415
|
-
|
|
2418
|
+
ws(i), Ui(e);
|
|
2416
2419
|
};
|
|
2417
2420
|
return /* @__PURE__ */ k(
|
|
2418
2421
|
"div",
|
|
@@ -2465,7 +2468,7 @@ function Vc({
|
|
|
2465
2468
|
]
|
|
2466
2469
|
}
|
|
2467
2470
|
);
|
|
2468
|
-
},
|
|
2471
|
+
}, xs = K(() => {
|
|
2469
2472
|
if (!bt) return [];
|
|
2470
2473
|
const e = /* @__PURE__ */ new Set();
|
|
2471
2474
|
for (const n of bt.changed) {
|
|
@@ -2475,8 +2478,8 @@ function Vc({
|
|
|
2475
2478
|
r.who && e.add(r.who);
|
|
2476
2479
|
}
|
|
2477
2480
|
return [...e];
|
|
2478
|
-
}, [bt, bi]), [Xe, on] = J(null), Ti = ae(/* @__PURE__ */ new Set()),
|
|
2479
|
-
}),
|
|
2481
|
+
}, [bt, bi]), [Xe, on] = J(null), Ti = ae(/* @__PURE__ */ new Set()), _s = (e, n) => JSON.stringify([e, n]), [$n, oa] = J(() => /* @__PURE__ */ new Map()), ks = ae(""), Ri = ae(() => {
|
|
2482
|
+
}), sa = (e) => {
|
|
2480
2483
|
const n = wr.current;
|
|
2481
2484
|
if (!n) return null;
|
|
2482
2485
|
const t = `${s}:${e}`;
|
|
@@ -2486,10 +2489,10 @@ function Vc({
|
|
|
2486
2489
|
return i != null && i.trim() ? i : null;
|
|
2487
2490
|
}
|
|
2488
2491
|
return null;
|
|
2489
|
-
},
|
|
2492
|
+
}, Ns = !Mo && (q || !mn);
|
|
2490
2493
|
ge(() => {
|
|
2491
2494
|
const e = wr.current;
|
|
2492
|
-
if (!e || !
|
|
2495
|
+
if (!e || !Ns || typeof MutationObserver > "u") return;
|
|
2493
2496
|
const n = `${s}:`, t = () => {
|
|
2494
2497
|
const i = /* @__PURE__ */ new Map();
|
|
2495
2498
|
for (const a of e.querySelectorAll("[data-o2m-row][data-remote-editor]")) {
|
|
@@ -2500,7 +2503,7 @@ function Vc({
|
|
|
2500
2503
|
}
|
|
2501
2504
|
const o = [...i.entries()].map(([a, c]) => `${a}\0${c}`).sort().join(`
|
|
2502
2505
|
`);
|
|
2503
|
-
o !==
|
|
2506
|
+
o !== ks.current && (ks.current = o, oa(i));
|
|
2504
2507
|
};
|
|
2505
2508
|
Ri.current = t, t();
|
|
2506
2509
|
const r = new MutationObserver(t);
|
|
@@ -2513,7 +2516,7 @@ function Vc({
|
|
|
2513
2516
|
r.disconnect(), Ri.current = () => {
|
|
2514
2517
|
};
|
|
2515
2518
|
};
|
|
2516
|
-
}, [
|
|
2519
|
+
}, [Ns, s]), ge(() => {
|
|
2517
2520
|
const e = Ti.current;
|
|
2518
2521
|
for (const n of [...e]) {
|
|
2519
2522
|
const [t, r] = JSON.parse(n);
|
|
@@ -2549,20 +2552,20 @@ function Vc({
|
|
|
2549
2552
|
n(), e && clearTimeout(e);
|
|
2550
2553
|
};
|
|
2551
2554
|
}, [Kt, s, u, b, q, z]);
|
|
2552
|
-
const
|
|
2555
|
+
const Ss = ae(null);
|
|
2553
2556
|
ge(() => {
|
|
2554
2557
|
const e = {
|
|
2555
2558
|
edits: new Set(C.keys()),
|
|
2556
2559
|
deletes: new Set(Qe),
|
|
2557
2560
|
pending: P.length
|
|
2558
|
-
}, n =
|
|
2559
|
-
if (
|
|
2561
|
+
}, n = Ss.current;
|
|
2562
|
+
if (Ss.current = e, !!n) {
|
|
2560
2563
|
for (const t of n.edits) e.edits.has(t) || gt(t);
|
|
2561
2564
|
for (const t of n.deletes) e.deletes.has(t) || gt(t);
|
|
2562
2565
|
e.pending < n.pending && (Dt.current = Date.now());
|
|
2563
2566
|
}
|
|
2564
2567
|
}, [Ni]);
|
|
2565
|
-
const Ki = K(() =>
|
|
2568
|
+
const Ki = K(() => nc(ce), [ce]), $s = K(
|
|
2566
2569
|
() => ce.filter(
|
|
2567
2570
|
(e) => e.group_key === "__create_with_defaults__" && !mo.has(e.type ?? "") && !fo.has(e.field)
|
|
2568
2571
|
),
|
|
@@ -2588,7 +2591,7 @@ function Vc({
|
|
|
2588
2591
|
}
|
|
2589
2592
|
})() : null, i = r == null ? void 0 : r.option_filter;
|
|
2590
2593
|
if (!i || typeof i != "object") continue;
|
|
2591
|
-
const o =
|
|
2594
|
+
const o = yl(
|
|
2592
2595
|
i,
|
|
2593
2596
|
S == null ? void 0 : S.draft,
|
|
2594
2597
|
((n = S == null ? void 0 : S.draft) == null ? void 0 : n.id) != null ? String(S.draft.id) : ""
|
|
@@ -2614,7 +2617,7 @@ function Vc({
|
|
|
2614
2617
|
a.length && e.push({ field: t, target: r.one_collection, filter: o, ids: a });
|
|
2615
2618
|
}
|
|
2616
2619
|
return e;
|
|
2617
|
-
}, [Ve, ir, He, O, P]),
|
|
2620
|
+
}, [Ve, ir, He, O, P]), qs = dn({
|
|
2618
2621
|
queries: Pi.map((e) => ({
|
|
2619
2622
|
queryKey: [
|
|
2620
2623
|
"cascade-stale-sweep",
|
|
@@ -2636,7 +2639,7 @@ function Vc({
|
|
|
2636
2639
|
const e = /* @__PURE__ */ new Map();
|
|
2637
2640
|
return Pi.forEach((n, t) => {
|
|
2638
2641
|
var a;
|
|
2639
|
-
const r = (a =
|
|
2642
|
+
const r = (a = qs[t]) == null ? void 0 : a.data;
|
|
2640
2643
|
if (!r) return;
|
|
2641
2644
|
const i = /* @__PURE__ */ new Set();
|
|
2642
2645
|
if (er.has(n.field))
|
|
@@ -2649,7 +2652,7 @@ function Vc({
|
|
|
2649
2652
|
}), e;
|
|
2650
2653
|
}, [
|
|
2651
2654
|
Pi,
|
|
2652
|
-
|
|
2655
|
+
qs,
|
|
2653
2656
|
er,
|
|
2654
2657
|
Dr,
|
|
2655
2658
|
S == null ? void 0 : S.draft,
|
|
@@ -2674,7 +2677,7 @@ function Vc({
|
|
|
2674
2677
|
const g = {};
|
|
2675
2678
|
let p = !0;
|
|
2676
2679
|
for (const [h, v] of Object.entries(i.replace)) {
|
|
2677
|
-
const N = Array.isArray(v) ?
|
|
2680
|
+
const N = Array.isArray(v) ? rs(v, {}) : null;
|
|
2678
2681
|
if (!N) {
|
|
2679
2682
|
p = !1;
|
|
2680
2683
|
break;
|
|
@@ -2812,12 +2815,12 @@ function Vc({
|
|
|
2812
2815
|
const e = /* @__PURE__ */ new Map(), n = [...O, ...P], t = [...C.values()], r = dt.flatMap((i) => i.rows);
|
|
2813
2816
|
f != null && f.draft && r.push(f.draft);
|
|
2814
2817
|
for (const [i, o] of He) {
|
|
2815
|
-
if (!o.one_collection ||
|
|
2818
|
+
if (!o.one_collection || rl(o.one_collection)) continue;
|
|
2816
2819
|
const a = n.map((g) => g[i]).filter((g) => g != null).map(String), c = t.map((g) => g[i]).filter((g) => g != null).map(String), d = r.map((g) => g[i]).filter((g) => g != null).map(String), m = [.../* @__PURE__ */ new Set([...a, ...c, ...d])].sort();
|
|
2817
2820
|
m.length && e.set(o.one_collection, m);
|
|
2818
2821
|
}
|
|
2819
2822
|
return e;
|
|
2820
|
-
}, [O, P, C, He, dt, f == null ? void 0 : f.draft]),
|
|
2823
|
+
}, [O, P, C, He, dt, f == null ? void 0 : f.draft]), la = K(() => {
|
|
2821
2824
|
const e = /* @__PURE__ */ new Map();
|
|
2822
2825
|
for (const n of ke) {
|
|
2823
2826
|
const t = He.get(n.field);
|
|
@@ -2830,11 +2833,11 @@ function Vc({
|
|
|
2830
2833
|
}
|
|
2831
2834
|
}
|
|
2832
2835
|
return e;
|
|
2833
|
-
}, [ke, He]),
|
|
2836
|
+
}, [ke, He]), aa = K(
|
|
2834
2837
|
() => ["m2o-display", s, ...Array.from(or.entries()).flat(2)],
|
|
2835
2838
|
[s, or]
|
|
2836
|
-
), { data: qn = {}, isFetching:
|
|
2837
|
-
queryKey:
|
|
2839
|
+
), { data: qn = {}, isFetching: da } = Ye({
|
|
2840
|
+
queryKey: aa,
|
|
2838
2841
|
queryFn: async () => {
|
|
2839
2842
|
const e = {}, n = await Promise.all(
|
|
2840
2843
|
[...or.keys()].map(
|
|
@@ -2849,7 +2852,7 @@ function Vc({
|
|
|
2849
2852
|
);
|
|
2850
2853
|
return await Promise.all(
|
|
2851
2854
|
n.map(async ({ collection: t, meta: r }) => {
|
|
2852
|
-
const i = or.get(t), o =
|
|
2855
|
+
const i = or.get(t), o = la.get(t);
|
|
2853
2856
|
let a;
|
|
2854
2857
|
if (o)
|
|
2855
2858
|
a = `id,${o.groupField}.*,${o.optionField}.*`;
|
|
@@ -2883,14 +2886,14 @@ function Vc({
|
|
|
2883
2886
|
// already known on screen while the new one loads.
|
|
2884
2887
|
placeholderData: (e) => e,
|
|
2885
2888
|
staleTime: 6e4
|
|
2886
|
-
}),
|
|
2889
|
+
}), ca = K(
|
|
2887
2890
|
() => le != null && le.unmatched_banner ? P.map((e) => he({ ...e })) : void 0,
|
|
2888
2891
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2889
2892
|
[le == null ? void 0 : le.unmatched_banner, P]
|
|
2890
|
-
), Wt =
|
|
2893
|
+
), Wt = Dd({
|
|
2891
2894
|
config: le,
|
|
2892
2895
|
rows: O,
|
|
2893
|
-
stagedRows:
|
|
2896
|
+
stagedRows: ca,
|
|
2894
2897
|
relatedCollection: s,
|
|
2895
2898
|
childRelations: Me,
|
|
2896
2899
|
parentDraft: S == null ? void 0 : S.draft,
|
|
@@ -2898,9 +2901,9 @@ function Vc({
|
|
|
2898
2901
|
m2oDisplays: qn,
|
|
2899
2902
|
client: $
|
|
2900
2903
|
});
|
|
2901
|
-
async function
|
|
2904
|
+
async function Es(e) {
|
|
2902
2905
|
if (!$ || !(D != null && D.length) || q && P.length === 0) return;
|
|
2903
|
-
|
|
2906
|
+
Ws(e ? "preview" : "apply");
|
|
2904
2907
|
const n = W && !!x, t = P.map((i, o) => ({ ...i, id: `pending:${o}` })), r = {};
|
|
2905
2908
|
if (x)
|
|
2906
2909
|
for (const [i, o] of x.getPendingEdits(s, u))
|
|
@@ -2974,7 +2977,7 @@ function Vc({
|
|
|
2974
2977
|
} catch (i) {
|
|
2975
2978
|
be.error(`Re-run rules failed: ${Tn(i, "unknown error")}`);
|
|
2976
2979
|
} finally {
|
|
2977
|
-
|
|
2980
|
+
Ws(null);
|
|
2978
2981
|
}
|
|
2979
2982
|
}
|
|
2980
2983
|
function Ut() {
|
|
@@ -3034,8 +3037,8 @@ function Vc({
|
|
|
3034
3037
|
const n = String(e.id);
|
|
3035
3038
|
if ((f == null ? void 0 : f.rowId) === n) return;
|
|
3036
3039
|
Ri.current();
|
|
3037
|
-
const t =
|
|
3038
|
-
if (t && !Ti.current.has(
|
|
3040
|
+
const t = sa(n);
|
|
3041
|
+
if (t && !Ti.current.has(_s(n, t))) {
|
|
3039
3042
|
on({ rowKey: n, editor: t });
|
|
3040
3043
|
return;
|
|
3041
3044
|
}
|
|
@@ -3057,7 +3060,7 @@ function Vc({
|
|
|
3057
3060
|
};
|
|
3058
3061
|
return window.addEventListener("nvr:grid-open-row", e), () => window.removeEventListener("nvr:grid-open-row", e);
|
|
3059
3062
|
}, [s, u, O]);
|
|
3060
|
-
function
|
|
3063
|
+
function Os(e, n) {
|
|
3061
3064
|
if (L) return;
|
|
3062
3065
|
const t = `pending:${n}`;
|
|
3063
3066
|
if ((f == null ? void 0 : f.rowId) === t) return;
|
|
@@ -3065,7 +3068,7 @@ function Vc({
|
|
|
3065
3068
|
const r = he({ ...e });
|
|
3066
3069
|
Be({ rowId: t, draft: r, locksPending: Un.size > 0 }), Vr(t, r);
|
|
3067
3070
|
}
|
|
3068
|
-
function
|
|
3071
|
+
function Is(e) {
|
|
3069
3072
|
var d, m, g, p;
|
|
3070
3073
|
const n = (m = (d = Ce.current) == null ? void 0 : d.lockReasons) == null ? void 0 : m[e];
|
|
3071
3074
|
if (!n) return "Set automatically for this row";
|
|
@@ -3075,7 +3078,7 @@ function Vc({
|
|
|
3075
3078
|
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";
|
|
3076
3079
|
return `Locked — ${r} ${c}${n.op === "null" || n.op === "nnull" ? "" : ` ${n.value ?? ""}`}`;
|
|
3077
3080
|
}
|
|
3078
|
-
function
|
|
3081
|
+
function ua(e) {
|
|
3079
3082
|
const n = f == null ? void 0 : f.expected;
|
|
3080
3083
|
if (!n || !(e in n)) return null;
|
|
3081
3084
|
const t = f == null ? void 0 : f.draft[e];
|
|
@@ -3083,7 +3086,7 @@ function Vc({
|
|
|
3083
3086
|
const i = n[e];
|
|
3084
3087
|
return i == null || i === "" ? null : String(t) === String(i) ? "auto" : "overridden";
|
|
3085
3088
|
}
|
|
3086
|
-
function
|
|
3089
|
+
function fa(e) {
|
|
3087
3090
|
const n = Ce.current;
|
|
3088
3091
|
if (!n || !$ || !D || D.length === 0) return;
|
|
3089
3092
|
const t = n.rowId;
|
|
@@ -3100,7 +3103,7 @@ function Vc({
|
|
|
3100
3103
|
row_rules: D
|
|
3101
3104
|
})
|
|
3102
3105
|
).then(
|
|
3103
|
-
(i) =>
|
|
3106
|
+
(i) => As(t, r, { ...i, updates: { [e]: null, ...i.updates } })
|
|
3104
3107
|
).catch(() => {
|
|
3105
3108
|
});
|
|
3106
3109
|
}
|
|
@@ -3119,7 +3122,7 @@ function Vc({
|
|
|
3119
3122
|
return o == null || o === "" || a == null || a === "" ? !1 : String(o) === String(a);
|
|
3120
3123
|
});
|
|
3121
3124
|
}
|
|
3122
|
-
function
|
|
3125
|
+
function As(e, n, t, r = []) {
|
|
3123
3126
|
var c;
|
|
3124
3127
|
if (((c = Ce.current) == null ? void 0 : c.rowId) !== e || mt.current.rowId !== e) return;
|
|
3125
3128
|
const i = mt.current.seqs, o = {};
|
|
@@ -3138,12 +3141,12 @@ function Vc({
|
|
|
3138
3141
|
provenance: t.provenance ?? d.provenance
|
|
3139
3142
|
});
|
|
3140
3143
|
}
|
|
3141
|
-
function
|
|
3144
|
+
function js(e, n) {
|
|
3142
3145
|
if (L) return;
|
|
3143
3146
|
const t = { ...e };
|
|
3144
3147
|
if (n.rowDeleted || !n.itemId) {
|
|
3145
3148
|
delete t.id;
|
|
3146
|
-
for (const r of Object.keys(t))
|
|
3149
|
+
for (const r of Object.keys(t)) sl.has(r) && delete t[r];
|
|
3147
3150
|
delete t[u], Be({
|
|
3148
3151
|
rowId: "new",
|
|
3149
3152
|
draft: Gn(t),
|
|
@@ -3170,10 +3173,10 @@ function Vc({
|
|
|
3170
3173
|
const n = e.filter((i) => !document.getElementById(Bn(i.field, "cell")));
|
|
3171
3174
|
n.length && Ot(n.map((i) => i.message).join(" · "));
|
|
3172
3175
|
const t = e.find((i) => !n.includes(i));
|
|
3173
|
-
t && ((r =
|
|
3176
|
+
t && ((r = bd(document.getElementById(Bn(t.field, "cell")))) == null || r.focus());
|
|
3174
3177
|
});
|
|
3175
3178
|
}
|
|
3176
|
-
function
|
|
3179
|
+
function ma() {
|
|
3177
3180
|
L || (Be({ rowId: "new", draft: { ...Xt }, locksPending: Un.size > 0 }), Vr("new", { ...Xt }));
|
|
3178
3181
|
}
|
|
3179
3182
|
function sr() {
|
|
@@ -3229,18 +3232,18 @@ function Vc({
|
|
|
3229
3232
|
parent_context: _,
|
|
3230
3233
|
row_rules: D
|
|
3231
3234
|
})
|
|
3232
|
-
).then((E) =>
|
|
3235
|
+
).then((E) => As(r ?? "", i, E, I)).catch(() => {
|
|
3233
3236
|
});
|
|
3234
3237
|
}
|
|
3235
3238
|
}
|
|
3236
3239
|
function Tt() {
|
|
3237
3240
|
if (Gt.current) return Gt.current;
|
|
3238
|
-
const e =
|
|
3241
|
+
const e = pa().finally(() => {
|
|
3239
3242
|
Gt.current === e && (Gt.current = null);
|
|
3240
3243
|
});
|
|
3241
3244
|
return Gt.current = e, e;
|
|
3242
3245
|
}
|
|
3243
|
-
async function
|
|
3246
|
+
async function pa() {
|
|
3244
3247
|
var g;
|
|
3245
3248
|
if (!f) return !1;
|
|
3246
3249
|
const e = f.rowId, n = () => {
|
|
@@ -3268,13 +3271,13 @@ function Vc({
|
|
|
3268
3271
|
), Be(
|
|
3269
3272
|
(p) => p && { ...p, missing: r.map((h) => h.field), invalid: void 0 }
|
|
3270
3273
|
), !1;
|
|
3271
|
-
const i =
|
|
3274
|
+
const i = Ho(f.rowId), o = ke.flatMap((p) => {
|
|
3272
3275
|
var v;
|
|
3273
3276
|
if (fr(p) || (v = f.locks) != null && v.includes(p.field)) return [];
|
|
3274
|
-
if (
|
|
3277
|
+
if (!$d.has(p.type ?? "")) return [];
|
|
3275
3278
|
if (i && String(i[p.field] ?? "") === String(f.draft[p.field] ?? ""))
|
|
3276
3279
|
return [];
|
|
3277
|
-
const h =
|
|
3280
|
+
const h = qd(f.draft[p.field], {
|
|
3278
3281
|
type: p.type,
|
|
3279
3282
|
label: p.label || ve(p.field)
|
|
3280
3283
|
});
|
|
@@ -3282,7 +3285,7 @@ function Vc({
|
|
|
3282
3285
|
});
|
|
3283
3286
|
if (o.length > 0)
|
|
3284
3287
|
return Qi(o), !1;
|
|
3285
|
-
const a = i ?
|
|
3288
|
+
const a = i ? ll(f.draft, i, new Set(Object.keys(f.draft))) : f.draft, c = Ed(
|
|
3286
3289
|
ce.map((p) => ({
|
|
3287
3290
|
field: p.field,
|
|
3288
3291
|
label: p.label || ve(p.field),
|
|
@@ -3294,7 +3297,7 @@ function Vc({
|
|
|
3294
3297
|
);
|
|
3295
3298
|
if (c.length > 0)
|
|
3296
3299
|
return Qi(c), !1;
|
|
3297
|
-
const d =
|
|
3300
|
+
const d = Od(
|
|
3298
3301
|
ce,
|
|
3299
3302
|
he({ ...f.draft }),
|
|
3300
3303
|
i,
|
|
@@ -3326,12 +3329,12 @@ function Vc({
|
|
|
3326
3329
|
}
|
|
3327
3330
|
}
|
|
3328
3331
|
Ot(null);
|
|
3329
|
-
const m =
|
|
3330
|
-
m && !(i &&
|
|
3332
|
+
const m = al(ce, f.draft);
|
|
3333
|
+
m && !(i && al(ce, i)) && be.warning(`${m} is 0 — this is a $0 line. Remove it if it is not needed.`), fn(!0);
|
|
3331
3334
|
try {
|
|
3332
3335
|
if (f.rowId.startsWith("pending:")) {
|
|
3333
3336
|
const p = parseInt(f.rowId.split(":")[1], 10), h = P[p];
|
|
3334
|
-
return x == null || x.updateRow(s, u, p, f.draft), h != null && h.__prefilled && (h == null ? void 0 : h.id) != null &&
|
|
3337
|
+
return x == null || x.updateRow(s, u, p, f.draft), h != null && h.__prefilled && (h == null ? void 0 : h.id) != null && ga((v) => /* @__PURE__ */ new Set([...v, h.id])), n(), fn(!1), !0;
|
|
3335
3338
|
}
|
|
3336
3339
|
if (f.rowId === "new") {
|
|
3337
3340
|
if ((q || W) && x)
|
|
@@ -3405,7 +3408,7 @@ function Vc({
|
|
|
3405
3408
|
})
|
|
3406
3409
|
);
|
|
3407
3410
|
} catch (An) {
|
|
3408
|
-
tt.push(nt), I || (I =
|
|
3411
|
+
tt.push(nt), I || (I = pl(An));
|
|
3409
3412
|
}
|
|
3410
3413
|
tt.length && _.push({
|
|
3411
3414
|
label: ve(ue),
|
|
@@ -3432,11 +3435,11 @@ function Vc({
|
|
|
3432
3435
|
// A reason an editor action prefilled (carry-forward) rides the row:
|
|
3433
3436
|
// the server stores it on the activity row, never in a column.
|
|
3434
3437
|
"_change_reason"
|
|
3435
|
-
]), v = O.find((_) => String(_.id) === f.rowId), N =
|
|
3438
|
+
]), v = O.find((_) => String(_.id) === f.rowId), N = ll(f.draft, v, h);
|
|
3436
3439
|
if (W && x) {
|
|
3437
3440
|
const _ = Object.entries(f.draft).filter(
|
|
3438
3441
|
([ie]) => ie.startsWith("__nested_ops_")
|
|
3439
|
-
), I = N, { rest: T, reverted: E } =
|
|
3442
|
+
), I = N, { rest: T, reverted: E } = Id(
|
|
3440
3443
|
C.get(f.rowId),
|
|
3441
3444
|
f.draft,
|
|
3442
3445
|
v
|
|
@@ -3448,7 +3451,7 @@ function Vc({
|
|
|
3448
3451
|
...I,
|
|
3449
3452
|
...Object.fromEntries(_)
|
|
3450
3453
|
};
|
|
3451
|
-
if (
|
|
3454
|
+
if (Ad(ie)) {
|
|
3452
3455
|
const V = await Bi(f.rowId);
|
|
3453
3456
|
x.queueEdit(s, u, f.rowId, {
|
|
3454
3457
|
...ie,
|
|
@@ -3488,7 +3491,7 @@ function Vc({
|
|
|
3488
3491
|
}
|
|
3489
3492
|
}), fn(!1), !1;
|
|
3490
3493
|
}
|
|
3491
|
-
const T =
|
|
3494
|
+
const T = Za(_);
|
|
3492
3495
|
if (T)
|
|
3493
3496
|
return Bt.current.set(e, Promise.resolve(T.latest || null)), T.latest > 0 && kt.set(e, T.latest), z.invalidateQueries({ queryKey: ["o2m-rows", s, u, b] }), be.warning(
|
|
3494
3497
|
"Someone else changed this line while you edited it — take their values or keep yours, then save again"
|
|
@@ -3504,15 +3507,15 @@ function Vc({
|
|
|
3504
3507
|
fn(!1);
|
|
3505
3508
|
}
|
|
3506
3509
|
}
|
|
3507
|
-
const [
|
|
3508
|
-
function
|
|
3509
|
-
|
|
3510
|
+
const [ha, ga] = J(/* @__PURE__ */ new Set()), [Nt, Ls] = J(null), [Jt, Ts] = J(null), [ba, Rs] = J(!1), [sn, ya] = J(1), [ln, En] = J(!1), [Ms, wa] = J(!1), [Fi, va] = J({}), [Ks, Ps] = J(!1), [Ds, Yr] = J(!1), [Vi, xa] = J("empty-only"), [Gr, Ws] = J(null), [Qt, On] = J(null), [an, Us] = J({}), [Bs, Js] = J(!1);
|
|
3511
|
+
function _a(e, n) {
|
|
3512
|
+
va((t) => ({ ...t, [e]: n }));
|
|
3510
3513
|
}
|
|
3511
|
-
async function
|
|
3514
|
+
async function ka() {
|
|
3512
3515
|
if (Object.keys(an).some(
|
|
3513
3516
|
(n) => an[n] !== null && an[n] !== void 0
|
|
3514
3517
|
)) {
|
|
3515
|
-
|
|
3518
|
+
Js(!0);
|
|
3516
3519
|
try {
|
|
3517
3520
|
if (O.length)
|
|
3518
3521
|
if (W && x)
|
|
@@ -3540,14 +3543,14 @@ function Vc({
|
|
|
3540
3543
|
}
|
|
3541
3544
|
P.length && x && P.forEach(
|
|
3542
3545
|
(n, t) => x.updateRow(s, u, t, { ...n, ...an })
|
|
3543
|
-
),
|
|
3546
|
+
), Ps(!1), Us({});
|
|
3544
3547
|
} catch {
|
|
3545
3548
|
} finally {
|
|
3546
|
-
|
|
3549
|
+
Js(!1);
|
|
3547
3550
|
}
|
|
3548
3551
|
}
|
|
3549
3552
|
}
|
|
3550
|
-
async function
|
|
3553
|
+
async function Na(e) {
|
|
3551
3554
|
const n = Math.max(1, Math.min(24, sn)), t = /* @__PURE__ */ new Date(), r = Array.from({ length: n }, (i, o) => {
|
|
3552
3555
|
const a = new Date(t.getFullYear(), t.getMonth() + 1 + o, 1), c = `${a.getFullYear()}-${String(a.getMonth() + 1).padStart(2, "0")}-01`;
|
|
3553
3556
|
return { ...Xt, ...Fi, [e]: c };
|
|
@@ -3568,12 +3571,12 @@ function Vc({
|
|
|
3568
3571
|
En(!1);
|
|
3569
3572
|
}
|
|
3570
3573
|
}
|
|
3571
|
-
async function
|
|
3574
|
+
async function Sa() {
|
|
3572
3575
|
const e = le == null ? void 0 : le.unmatched_banner;
|
|
3573
3576
|
if (!e || Wt.unmatchedCandidates.length === 0) return;
|
|
3574
3577
|
const n = Wt.unmatchedCandidates.map((t) => ({
|
|
3575
3578
|
...Xt,
|
|
3576
|
-
...
|
|
3579
|
+
...Wd(e, t)
|
|
3577
3580
|
}));
|
|
3578
3581
|
if ((q || W) && x) {
|
|
3579
3582
|
for (const t of en(n)) x.queueRow(s, u, t);
|
|
@@ -3592,7 +3595,7 @@ function Vc({
|
|
|
3592
3595
|
En(!1);
|
|
3593
3596
|
}
|
|
3594
3597
|
}
|
|
3595
|
-
async function
|
|
3598
|
+
async function Qs(e) {
|
|
3596
3599
|
const n = Math.max(1, Math.min(100, sn)), t = e ? { ...Xt, ...Fi } : { ...Xt };
|
|
3597
3600
|
if ((q || W) && x) {
|
|
3598
3601
|
const r = en(Array.from({ length: n }, () => ({ ...t })));
|
|
@@ -3611,16 +3614,16 @@ function Vc({
|
|
|
3611
3614
|
En(!1);
|
|
3612
3615
|
}
|
|
3613
3616
|
}
|
|
3614
|
-
function
|
|
3615
|
-
|
|
3617
|
+
function zs(e) {
|
|
3618
|
+
Ls(e);
|
|
3616
3619
|
}
|
|
3617
|
-
function
|
|
3618
|
-
e.preventDefault(),
|
|
3620
|
+
function Fs(e, n) {
|
|
3621
|
+
e.preventDefault(), Ts(n);
|
|
3619
3622
|
}
|
|
3620
3623
|
function In() {
|
|
3621
|
-
|
|
3624
|
+
Ls(null), Ts(null);
|
|
3622
3625
|
}
|
|
3623
|
-
async function
|
|
3626
|
+
async function $a(e) {
|
|
3624
3627
|
if (e.preventDefault(), Nt === null || Jt === null || Nt === Jt) {
|
|
3625
3628
|
In();
|
|
3626
3629
|
return;
|
|
@@ -3639,7 +3642,7 @@ function Vc({
|
|
|
3639
3642
|
), In();
|
|
3640
3643
|
return;
|
|
3641
3644
|
}
|
|
3642
|
-
|
|
3645
|
+
Rs(!0);
|
|
3643
3646
|
try {
|
|
3644
3647
|
await Promise.all(
|
|
3645
3648
|
r.map(
|
|
@@ -3650,7 +3653,7 @@ function Vc({
|
|
|
3650
3653
|
), z.invalidateQueries({ queryKey: ["o2m-rows", s, u, b] });
|
|
3651
3654
|
} catch {
|
|
3652
3655
|
} finally {
|
|
3653
|
-
|
|
3656
|
+
Rs(!1), In();
|
|
3654
3657
|
}
|
|
3655
3658
|
}
|
|
3656
3659
|
async function Hi(e, n) {
|
|
@@ -3661,7 +3664,7 @@ function Vc({
|
|
|
3661
3664
|
return;
|
|
3662
3665
|
}
|
|
3663
3666
|
try {
|
|
3664
|
-
await $.request(
|
|
3667
|
+
await $.request(bl(`/items/${s}/${t}${ut}`)), gt(String(t)), z.invalidateQueries({ queryKey: ["o2m-rows", s, u, b] }), (f == null ? void 0 : f.rowId) === String(t) && Be(null), B && z.invalidateQueries({
|
|
3665
3668
|
queryKey: ["o2m-field-snapshots", s, u, b]
|
|
3666
3669
|
});
|
|
3667
3670
|
} catch {
|
|
@@ -3700,7 +3703,7 @@ function Vc({
|
|
|
3700
3703
|
return /* @__PURE__ */ l("span", { className: "tabular-nums", "data-tip": `${g} = ${y} = ${N}`, children: N });
|
|
3701
3704
|
}
|
|
3702
3705
|
if (e.interface === "match-agg-column") {
|
|
3703
|
-
const g =
|
|
3706
|
+
const g = Ul.get(e.field);
|
|
3704
3707
|
if (!g || !t) return /* @__PURE__ */ l("span", { className: "text-slate-300", children: "—" });
|
|
3705
3708
|
const p = O.find((w) => String(w.id) === t) ?? {}, h = (w, _) => _.split(".").reduce(
|
|
3706
3709
|
(I, T) => I && typeof I == "object" ? I[T] : void 0,
|
|
@@ -3744,7 +3747,7 @@ function Vc({
|
|
|
3744
3747
|
}
|
|
3745
3748
|
if (n == null) return /* @__PURE__ */ l("span", { className: "text-slate-300", children: "—" });
|
|
3746
3749
|
if (e.interface === "relation-path" && me && t) {
|
|
3747
|
-
const g =
|
|
3750
|
+
const g = nl(e), p = (c = Ae == null ? void 0 : Ae.rows[t]) == null ? void 0 : c[e.field], h = Ae == null ? void 0 : Ae.targets[e.field];
|
|
3748
3751
|
if (g && p && h && p.ids.length > 0)
|
|
3749
3752
|
return /* @__PURE__ */ l(
|
|
3750
3753
|
"button",
|
|
@@ -3767,9 +3770,9 @@ function Vc({
|
|
|
3767
3770
|
const o = He.get(e.field);
|
|
3768
3771
|
if (o != null && o.one_collection) {
|
|
3769
3772
|
const g = (d = qn[o.one_collection]) == null ? void 0 : d[String(n)];
|
|
3770
|
-
if (!g &&
|
|
3773
|
+
if (!g && da)
|
|
3771
3774
|
return /* @__PURE__ */ l(Rn, { className: "h-3 w-3 animate-spin text-slate-300" });
|
|
3772
|
-
const p = me ?
|
|
3775
|
+
const p = me ? nl(e) : null, h = n != null && ((m = Di.get(e.field)) == null ? void 0 : m.has(String(n))) === !0;
|
|
3773
3776
|
let v;
|
|
3774
3777
|
return p && me ? v = /* @__PURE__ */ l(
|
|
3775
3778
|
"button",
|
|
@@ -3787,13 +3790,13 @@ function Vc({
|
|
|
3787
3790
|
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",
|
|
3788
3791
|
children: g ?? String(n)
|
|
3789
3792
|
}
|
|
3790
|
-
) : v = /* @__PURE__ */ l("span", { className: "block truncate", children: g ?? String(n) }), h ? /* @__PURE__ */ l(
|
|
3793
|
+
) : v = /* @__PURE__ */ l("span", { className: "block truncate", children: g ?? String(n) }), h ? /* @__PURE__ */ l(Hd, { children: v }) : v;
|
|
3791
3794
|
}
|
|
3792
3795
|
if (e.type === "boolean")
|
|
3793
3796
|
return /* @__PURE__ */ l("span", { className: n ? "text-emerald-600" : "text-slate-400", children: n ? "Yes" : "No" });
|
|
3794
3797
|
if (e.type === "datetime" || e.type === "date")
|
|
3795
3798
|
try {
|
|
3796
|
-
return /* @__PURE__ */ l("span", { className: "block truncate", children:
|
|
3799
|
+
return /* @__PURE__ */ l("span", { className: "block truncate", children: td(n) });
|
|
3797
3800
|
} catch {
|
|
3798
3801
|
}
|
|
3799
3802
|
if ([
|
|
@@ -3855,9 +3858,9 @@ function Vc({
|
|
|
3855
3858
|
return Ie !== "original" || (q || O.slice(0, _n).forEach((n, t) => {
|
|
3856
3859
|
const r = String(n.id);
|
|
3857
3860
|
if (!Qe.has(r)) {
|
|
3858
|
-
if (
|
|
3861
|
+
if (Fo) {
|
|
3859
3862
|
const i = Hn(n);
|
|
3860
|
-
if (i !== null &&
|
|
3863
|
+
if (i !== null && Vo.has(i)) return;
|
|
3861
3864
|
}
|
|
3862
3865
|
e.push({
|
|
3863
3866
|
key: r,
|
|
@@ -3869,7 +3872,7 @@ function Vc({
|
|
|
3869
3872
|
}), P.forEach((n, t) => {
|
|
3870
3873
|
e.push({ key: `pending:${t}`, kind: "pending", row: n, idx: t });
|
|
3871
3874
|
})), e;
|
|
3872
|
-
}, Gi = st ? dr().map((e) => e.key) : [],
|
|
3875
|
+
}, Gi = st ? dr().map((e) => e.key) : [], qa = Gi.length > 0 && Gi.every((e) => Pt.has(e)), cr = st ? dr().filter((e) => Pt.has(e.key)) : [], Ea = () => {
|
|
3873
3876
|
var t;
|
|
3874
3877
|
const e = Ce.current;
|
|
3875
3878
|
if (!e) return !1;
|
|
@@ -3885,27 +3888,27 @@ function Vc({
|
|
|
3885
3888
|
return !0;
|
|
3886
3889
|
}
|
|
3887
3890
|
return !1;
|
|
3888
|
-
},
|
|
3891
|
+
}, Oa = async (e) => {
|
|
3889
3892
|
const n = Ce.current;
|
|
3890
3893
|
if (!n || n.rowId === "new") return;
|
|
3891
3894
|
const t = dr(), r = t.findIndex((a) => a.key === n.rowId);
|
|
3892
3895
|
if (r < 0) return;
|
|
3893
3896
|
const i = r + e;
|
|
3894
3897
|
if (i < 0 || i >= t.length) return;
|
|
3895
|
-
if (
|
|
3898
|
+
if (Ea()) {
|
|
3896
3899
|
if (!await Tt()) return;
|
|
3897
3900
|
} else
|
|
3898
3901
|
sr();
|
|
3899
3902
|
const o = t[i];
|
|
3900
|
-
o.kind === "pending" ?
|
|
3903
|
+
o.kind === "pending" ? Os(o.row, o.idx) : Hr(o.row), window.setTimeout(() => {
|
|
3901
3904
|
const a = document.querySelector(
|
|
3902
3905
|
`[data-o2m-row="${s}:${o.key}"]`
|
|
3903
3906
|
);
|
|
3904
3907
|
a && (a.focus({ preventScroll: !0 }), a.scrollIntoView({ block: "nearest" }));
|
|
3905
3908
|
}, 0);
|
|
3906
3909
|
};
|
|
3907
|
-
go.current =
|
|
3908
|
-
async function
|
|
3910
|
+
go.current = Oa;
|
|
3911
|
+
async function Ia(e) {
|
|
3909
3912
|
const n = Yi.current;
|
|
3910
3913
|
await Ci(
|
|
3911
3914
|
e,
|
|
@@ -3913,13 +3916,13 @@ function Vc({
|
|
|
3913
3916
|
{ clearSelection: !0, noun: "row", baseOf: (t) => n.get(t) }
|
|
3914
3917
|
), Yi.current = /* @__PURE__ */ new Map();
|
|
3915
3918
|
}
|
|
3916
|
-
function
|
|
3917
|
-
Yi.current = q || L ? /* @__PURE__ */ new Map() :
|
|
3919
|
+
function Aa() {
|
|
3920
|
+
Yi.current = q || L ? /* @__PURE__ */ new Map() : Nd(
|
|
3918
3921
|
kt,
|
|
3919
3922
|
[...Pt].filter((e) => !e.startsWith("pending:"))
|
|
3920
3923
|
), yo(!0);
|
|
3921
3924
|
}
|
|
3922
|
-
const
|
|
3925
|
+
const Vs = () => {
|
|
3923
3926
|
const e = [];
|
|
3924
3927
|
return Ie !== "original" || (q || O.forEach((n, t) => {
|
|
3925
3928
|
const r = String(n.id);
|
|
@@ -4051,7 +4054,7 @@ function Vc({
|
|
|
4051
4054
|
};
|
|
4052
4055
|
await g(0);
|
|
4053
4056
|
}
|
|
4054
|
-
if (ai.current = (e, n) => Ci({ [e]: n },
|
|
4057
|
+
if (ai.current = (e, n) => Ci({ [e]: n }, Vs(), {
|
|
4055
4058
|
clearSelection: !1,
|
|
4056
4059
|
noun: "line"
|
|
4057
4060
|
}), bo.current = !0, vr.current) {
|
|
@@ -4145,7 +4148,7 @@ function Vc({
|
|
|
4145
4148
|
},
|
|
4146
4149
|
r
|
|
4147
4150
|
);
|
|
4148
|
-
}) }), fr = (e) => e.computed_type === "write" && !!e.computed_formula || e.interface === "formula-column" || e.interface === "match-agg-column" || e.interface === "relation-path" || !!e.readonly || Pr(e) || ot(e),
|
|
4151
|
+
}) }), fr = (e) => e.computed_type === "write" && !!e.computed_formula || e.interface === "formula-column" || e.interface === "match-agg-column" || e.interface === "relation-path" || !!e.readonly || Pr(e) || ot(e), Hs = (e) => {
|
|
4149
4152
|
var n;
|
|
4150
4153
|
return /* @__PURE__ */ k(
|
|
4151
4154
|
"div",
|
|
@@ -4217,7 +4220,7 @@ function Vc({
|
|
|
4217
4220
|
}) });
|
|
4218
4221
|
})();
|
|
4219
4222
|
})(),
|
|
4220
|
-
|
|
4223
|
+
vs(e.rowId),
|
|
4221
4224
|
/* @__PURE__ */ l(
|
|
4222
4225
|
"div",
|
|
4223
4226
|
{
|
|
@@ -4241,7 +4244,7 @@ function Vc({
|
|
|
4241
4244
|
"div",
|
|
4242
4245
|
{
|
|
4243
4246
|
id: Bn(t.field, "cell"),
|
|
4244
|
-
ref: (I) =>
|
|
4247
|
+
ref: (I) => yd(I, m, p),
|
|
4245
4248
|
"data-grid-cell": qo(e.rowId, t.field),
|
|
4246
4249
|
className: xe(
|
|
4247
4250
|
"flex min-w-0 flex-col gap-1",
|
|
@@ -4260,7 +4263,7 @@ function Vc({
|
|
|
4260
4263
|
a && /* @__PURE__ */ l("span", { className: "ml-1 normal-case tracking-normal", children: "· required" }),
|
|
4261
4264
|
(() => {
|
|
4262
4265
|
var ie, V;
|
|
4263
|
-
const I =
|
|
4266
|
+
const I = ua(t.field);
|
|
4264
4267
|
if (!I) return null;
|
|
4265
4268
|
const T = He.get(t.field), E = (ue) => {
|
|
4266
4269
|
var ne;
|
|
@@ -4270,14 +4273,14 @@ function Vc({
|
|
|
4270
4273
|
return ((ne = ke.find((Z) => Z.field === ue)) == null ? void 0 : ne.label) ?? ue.replace(/_/g, " ");
|
|
4271
4274
|
};
|
|
4272
4275
|
return /* @__PURE__ */ l(
|
|
4273
|
-
|
|
4276
|
+
Jd,
|
|
4274
4277
|
{
|
|
4275
4278
|
kind: I,
|
|
4276
4279
|
provenance: (ie = f == null ? void 0 : f.provenance) == null ? void 0 : ie[t.field],
|
|
4277
4280
|
labelOf: E,
|
|
4278
4281
|
fieldLabel: X,
|
|
4279
4282
|
relatedCollection: (T == null ? void 0 : T.one_collection) ?? null,
|
|
4280
|
-
onReset: I === "overridden" && !L && !((V = f == null ? void 0 : f.locks) != null && V.includes(t.field)) ? () =>
|
|
4283
|
+
onReset: I === "overridden" && !L && !((V = f == null ? void 0 : f.locks) != null && V.includes(t.field)) ? () => fa(t.field) : void 0
|
|
4281
4284
|
}
|
|
4282
4285
|
);
|
|
4283
4286
|
})()
|
|
@@ -4292,7 +4295,7 @@ function Vc({
|
|
|
4292
4295
|
{
|
|
4293
4296
|
className: "text-[12px] text-slate-500",
|
|
4294
4297
|
"data-compare-locked": Ei(t.field, e.draft) ? t.field : void 0,
|
|
4295
|
-
"data-tip": (_ = f == null ? void 0 : f.locks) != null && _.includes(t.field) ?
|
|
4298
|
+
"data-tip": (_ = f == null ? void 0 : f.locks) != null && _.includes(t.field) ? Is(t.field) : Ei(t.field, e.draft) ? (j == null ? void 0 : j.closed_locked_message) || "This month is closed — only reconciling it to the actual is allowed" : void 0,
|
|
4296
4299
|
children: De(t, e.draft[t.field], e.rowId)
|
|
4297
4300
|
}
|
|
4298
4301
|
) : f != null && f.locksPending && Un.has(t.field) ? (
|
|
@@ -4341,13 +4344,13 @@ function Vc({
|
|
|
4341
4344
|
className: "inline-flex items-center gap-0.5 text-[10px] uppercase tracking-wide text-slate-400",
|
|
4342
4345
|
"data-tip": j.closed_locked && bn ? `${j.closed_rule ?? ""} A change here needs a reason.`.trim() : j.closed_rule,
|
|
4343
4346
|
children: [
|
|
4344
|
-
/* @__PURE__ */ l(
|
|
4347
|
+
/* @__PURE__ */ l(Wa, { className: "h-2.5 w-2.5", "aria-hidden": "true" }),
|
|
4345
4348
|
" closed"
|
|
4346
4349
|
]
|
|
4347
4350
|
}
|
|
4348
4351
|
),
|
|
4349
4352
|
E && !L && /* @__PURE__ */ l(
|
|
4350
|
-
|
|
4353
|
+
gd,
|
|
4351
4354
|
{
|
|
4352
4355
|
data: j,
|
|
4353
4356
|
rowKey: e.draft[j.key_field],
|
|
@@ -4381,7 +4384,7 @@ function Vc({
|
|
|
4381
4384
|
}
|
|
4382
4385
|
),
|
|
4383
4386
|
_e && ((n = _e.fields) == null ? void 0 : n.length) > 0 && !L && /* @__PURE__ */ l(
|
|
4384
|
-
|
|
4387
|
+
rc,
|
|
4385
4388
|
{
|
|
4386
4389
|
config: _e,
|
|
4387
4390
|
draft: e.draft,
|
|
@@ -4408,14 +4411,14 @@ function Vc({
|
|
|
4408
4411
|
})()
|
|
4409
4412
|
}
|
|
4410
4413
|
),
|
|
4411
|
-
le && e.rowId && !e.rowId.startsWith("pending:") && e.rowId !== "new" && /* @__PURE__ */ l(
|
|
4414
|
+
le && e.rowId && !e.rowId.startsWith("pending:") && e.rowId !== "new" && /* @__PURE__ */ l(Ud, { config: le, result: Wt.byRow.get(e.rowId) }),
|
|
4412
4415
|
e.drawer
|
|
4413
4416
|
]
|
|
4414
4417
|
}
|
|
4415
4418
|
);
|
|
4416
|
-
}, Xi = (e) => /* @__PURE__ */ l("td", { colSpan: St, className: "p-0", children:
|
|
4419
|
+
}, Xi = (e) => /* @__PURE__ */ l("td", { colSpan: St, className: "p-0", children: Hs(e) }), Ys = (e, n) => {
|
|
4417
4420
|
const t = e.editor.split(/\s+/).map((i) => i[0]).filter(Boolean).slice(0, 2).join("").toUpperCase(), r = () => {
|
|
4418
|
-
Ti.current.add(
|
|
4421
|
+
Ti.current.add(_s(e.rowKey, e.editor)), on(null);
|
|
4419
4422
|
const i = O.find((o) => String(o.id) === e.rowKey);
|
|
4420
4423
|
i && Hr(C.has(e.rowKey) ? { ...i, ...C.get(e.rowKey) } : i);
|
|
4421
4424
|
};
|
|
@@ -4455,7 +4458,7 @@ function Vc({
|
|
|
4455
4458
|
]
|
|
4456
4459
|
}
|
|
4457
4460
|
);
|
|
4458
|
-
},
|
|
4461
|
+
}, Gs = fi === pr, ja = Gs ? null : (At == null ? void 0 : At.name) ?? ((Xs = re == null ? void 0 : re[0]) == null ? void 0 : Xs.name), Cs = re && re.length >= 2 && /* @__PURE__ */ k("div", { className: "flex items-center gap-1 text-[11px]", children: [
|
|
4459
4462
|
/* @__PURE__ */ l(
|
|
4460
4463
|
"button",
|
|
4461
4464
|
{
|
|
@@ -4463,7 +4466,7 @@ function Vc({
|
|
|
4463
4466
|
onClick: () => Ro(pr),
|
|
4464
4467
|
className: xe(
|
|
4465
4468
|
"h-6 px-2.5 rounded border transition-colors",
|
|
4466
|
-
|
|
4469
|
+
Gs ? "border-nvr-cyan bg-nvr-cyan/10 text-nvr-cyan" : "border-slate-200 text-slate-600 hover:border-slate-400 hover:text-slate-800"
|
|
4467
4470
|
),
|
|
4468
4471
|
children: "All"
|
|
4469
4472
|
}
|
|
@@ -4475,7 +4478,7 @@ function Vc({
|
|
|
4475
4478
|
onClick: () => Ro(e.name),
|
|
4476
4479
|
className: xe(
|
|
4477
4480
|
"h-6 px-2.5 rounded border transition-colors",
|
|
4478
|
-
|
|
4481
|
+
ja === 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"
|
|
4479
4482
|
),
|
|
4480
4483
|
children: e.name
|
|
4481
4484
|
},
|
|
@@ -4491,11 +4494,11 @@ function Vc({
|
|
|
4491
4494
|
{
|
|
4492
4495
|
className: "space-y-1.5",
|
|
4493
4496
|
"data-o2m-collection": s,
|
|
4494
|
-
onFocusCapture:
|
|
4495
|
-
onBlurCapture:
|
|
4497
|
+
onFocusCapture: Tl,
|
|
4498
|
+
onBlurCapture: Rl,
|
|
4496
4499
|
children: [
|
|
4497
4500
|
/* @__PURE__ */ l(
|
|
4498
|
-
|
|
4501
|
+
Ja,
|
|
4499
4502
|
{
|
|
4500
4503
|
challenge: (qr == null ? void 0 : qr.challenge) ?? null,
|
|
4501
4504
|
onCancel: () => zn(null),
|
|
@@ -4506,7 +4509,7 @@ function Vc({
|
|
|
4506
4509
|
}
|
|
4507
4510
|
),
|
|
4508
4511
|
Ar && Ar.length > 0 && /* @__PURE__ */ l(
|
|
4509
|
-
|
|
4512
|
+
jd,
|
|
4510
4513
|
{
|
|
4511
4514
|
lines: Ar.map((e) => ({
|
|
4512
4515
|
...e,
|
|
@@ -4533,7 +4536,7 @@ function Vc({
|
|
|
4533
4536
|
queryKey: ["o2m-rows", s, u, b]
|
|
4534
4537
|
});
|
|
4535
4538
|
},
|
|
4536
|
-
onResolve: (e) => void
|
|
4539
|
+
onResolve: (e) => void na(e)
|
|
4537
4540
|
}
|
|
4538
4541
|
),
|
|
4539
4542
|
!L && /* @__PURE__ */ k("div", { className: "flex items-center gap-2 text-[11px]", children: [
|
|
@@ -4545,7 +4548,7 @@ function Vc({
|
|
|
4545
4548
|
min: 1,
|
|
4546
4549
|
max: 100,
|
|
4547
4550
|
value: sn,
|
|
4548
|
-
onChange: (e) =>
|
|
4551
|
+
onChange: (e) => ya(Math.max(1, Math.min(100, parseInt(e.target.value, 10) || 1))),
|
|
4549
4552
|
className: "w-14 h-6 rounded border border-slate-200 px-2 text-[11px] text-slate-700 text-center focus:outline-none focus:ring-1 focus:ring-nvr-cyan"
|
|
4550
4553
|
}
|
|
4551
4554
|
),
|
|
@@ -4554,7 +4557,7 @@ function Vc({
|
|
|
4554
4557
|
{
|
|
4555
4558
|
type: "button",
|
|
4556
4559
|
disabled: ln,
|
|
4557
|
-
onClick: () =>
|
|
4560
|
+
onClick: () => Qs(!1),
|
|
4558
4561
|
className: "h-6 px-2.5 rounded border border-slate-200 text-slate-600 hover:border-slate-400 hover:text-slate-800 disabled:opacity-40 transition-colors",
|
|
4559
4562
|
children: [
|
|
4560
4563
|
"blank ",
|
|
@@ -4571,7 +4574,7 @@ function Vc({
|
|
|
4571
4574
|
{
|
|
4572
4575
|
type: "button",
|
|
4573
4576
|
disabled: ln,
|
|
4574
|
-
onClick: () =>
|
|
4577
|
+
onClick: () => Na(e[0].field),
|
|
4575
4578
|
"data-tip": `Generate ${sn} rows with ${e[0].field} advancing one month per row (starting next month)`,
|
|
4576
4579
|
className: "h-6 px-2.5 rounded border border-dashed border-slate-300 text-slate-500 hover:border-nvr-cyan/60 hover:text-slate-700 disabled:opacity-40 transition-colors",
|
|
4577
4580
|
children: [
|
|
@@ -4582,7 +4585,7 @@ function Vc({
|
|
|
4582
4585
|
);
|
|
4583
4586
|
})(),
|
|
4584
4587
|
Te && (!q || x) && /* @__PURE__ */ l(
|
|
4585
|
-
|
|
4588
|
+
Zd,
|
|
4586
4589
|
{
|
|
4587
4590
|
config: Te,
|
|
4588
4591
|
relatedCollection: s,
|
|
@@ -4611,7 +4614,7 @@ function Vc({
|
|
|
4611
4614
|
(n) => typeof n == "object" && n.field === qe.relation && !!n.match
|
|
4612
4615
|
);
|
|
4613
4616
|
return e != null && e.match ? /* @__PURE__ */ l(
|
|
4614
|
-
|
|
4617
|
+
tc,
|
|
4615
4618
|
{
|
|
4616
4619
|
config: qe,
|
|
4617
4620
|
matchCfg: e.match,
|
|
@@ -4624,7 +4627,7 @@ function Vc({
|
|
|
4624
4627
|
) : null;
|
|
4625
4628
|
})(),
|
|
4626
4629
|
(Ze ?? []).map((e) => /* @__PURE__ */ l(
|
|
4627
|
-
|
|
4630
|
+
ec,
|
|
4628
4631
|
{
|
|
4629
4632
|
config: e,
|
|
4630
4633
|
rows: [...O, ...P.map((n, t) => ({ ...n, __pendingIndex: t }))],
|
|
@@ -4652,7 +4655,7 @@ function Vc({
|
|
|
4652
4655
|
e.label
|
|
4653
4656
|
)),
|
|
4654
4657
|
qt && !q && !L && rt && A && /* @__PURE__ */ l(
|
|
4655
|
-
|
|
4658
|
+
rd,
|
|
4656
4659
|
{
|
|
4657
4660
|
collection: A,
|
|
4658
4661
|
templateFilter: (e) => {
|
|
@@ -4678,26 +4681,26 @@ function Vc({
|
|
|
4678
4681
|
children: "Copy from…"
|
|
4679
4682
|
}
|
|
4680
4683
|
),
|
|
4681
|
-
|
|
4684
|
+
kl && /* @__PURE__ */ l("span", { className: "absolute left-0 top-full z-[70] mt-1 w-[300px] rounded-lg border border-slate-200 bg-white p-2 shadow-xl dark:border-border dark:bg-card", children: /* @__PURE__ */ l(
|
|
4682
4685
|
lo,
|
|
4683
4686
|
{
|
|
4684
4687
|
collection: A,
|
|
4685
4688
|
value: null,
|
|
4686
4689
|
onChange: (e) => {
|
|
4687
|
-
e != null &&
|
|
4690
|
+
e != null && $l(String(e));
|
|
4688
4691
|
},
|
|
4689
4692
|
placeholder: "Pick the record to copy from…"
|
|
4690
4693
|
}
|
|
4691
4694
|
) })
|
|
4692
4695
|
] }),
|
|
4693
|
-
|
|
4696
|
+
$s.length > 0 && /* @__PURE__ */ l(
|
|
4694
4697
|
"button",
|
|
4695
4698
|
{
|
|
4696
4699
|
type: "button",
|
|
4697
|
-
onClick: () =>
|
|
4700
|
+
onClick: () => wa((e) => !e),
|
|
4698
4701
|
className: xe(
|
|
4699
4702
|
"h-6 px-2.5 rounded border transition-colors",
|
|
4700
|
-
|
|
4703
|
+
Ms ? "border-nvr-cyan bg-nvr-cyan/10 text-nvr-cyan" : "border-slate-200 text-slate-600 hover:border-slate-400 hover:text-slate-800"
|
|
4701
4704
|
),
|
|
4702
4705
|
children: "with defaults…"
|
|
4703
4706
|
}
|
|
@@ -4706,21 +4709,21 @@ function Vc({
|
|
|
4706
4709
|
"button",
|
|
4707
4710
|
{
|
|
4708
4711
|
type: "button",
|
|
4709
|
-
onClick: () =>
|
|
4712
|
+
onClick: () => Ps((e) => !e),
|
|
4710
4713
|
className: xe(
|
|
4711
4714
|
"h-6 px-2.5 rounded border transition-colors",
|
|
4712
|
-
|
|
4715
|
+
Ks ? "border-amber-400 bg-amber-50 text-amber-700 dark:border-amber-600 dark:bg-amber-950/30 dark:text-amber-300" : "border-slate-200 text-slate-600 hover:border-slate-400 hover:text-slate-800"
|
|
4713
4716
|
),
|
|
4714
4717
|
children: "apply values…"
|
|
4715
4718
|
}
|
|
4716
4719
|
),
|
|
4717
|
-
_e && ((
|
|
4718
|
-
|
|
4720
|
+
_e && ((Zs = _e.fields) == null ? void 0 : Zs.length) > 0 && _e.across_rows !== !1 && O.length + P.length > 1 && /* @__PURE__ */ l(
|
|
4721
|
+
ic,
|
|
4719
4722
|
{
|
|
4720
4723
|
config: _e,
|
|
4721
4724
|
remaining: wt(_e.remaining, tn),
|
|
4722
4725
|
rowNoun: j ? ve(j.key_field).toLowerCase() : "row",
|
|
4723
|
-
onApply:
|
|
4726
|
+
onApply: Yl
|
|
4724
4727
|
}
|
|
4725
4728
|
),
|
|
4726
4729
|
!!(D != null && D.length) && O.length + P.length > 0 && /* @__PURE__ */ l(
|
|
@@ -4732,16 +4735,16 @@ function Vc({
|
|
|
4732
4735
|
},
|
|
4733
4736
|
className: xe(
|
|
4734
4737
|
"h-6 px-2.5 rounded border transition-colors",
|
|
4735
|
-
|
|
4738
|
+
Ds ? "border-nvr-cyan bg-nvr-cyan/10 text-nvr-cyan" : "border-slate-200 text-slate-600 hover:border-slate-400 hover:text-slate-800"
|
|
4736
4739
|
),
|
|
4737
4740
|
"data-tip": "Re-run this grid's auto-fill rules over every line, saved or not yet saved",
|
|
4738
4741
|
children: "re-run rules…"
|
|
4739
4742
|
}
|
|
4740
4743
|
),
|
|
4741
|
-
!L && Ie === "original" && O.length + P.length > 0 &&
|
|
4742
|
-
const n = cr.length > 0 ? cr :
|
|
4744
|
+
!L && Ie === "original" && O.length + P.length > 0 && Qd(Mn).filter((e) => !e.admin_only || bn).map((e) => {
|
|
4745
|
+
const n = cr.length > 0 ? cr : Vs(), t = ce.find((a) => a.field === e.field), r = e.label ?? (t ? Xn(t) : ve(e.field)), i = new Set(n.map((a) => String(a.row[e.field] ?? ""))), o = i.size === 1 && [...i][0] || null;
|
|
4743
4746
|
return /* @__PURE__ */ l(
|
|
4744
|
-
|
|
4747
|
+
zd,
|
|
4745
4748
|
{
|
|
4746
4749
|
label: r,
|
|
4747
4750
|
count: n.length,
|
|
@@ -4763,14 +4766,14 @@ function Vc({
|
|
|
4763
4766
|
"aria-pressed": cn,
|
|
4764
4767
|
"data-tip": cn ? "Hide the selection checkboxes" : "Tick rows to edit several lines at once",
|
|
4765
4768
|
onClick: () => {
|
|
4766
|
-
|
|
4769
|
+
xl((e) => !e), xr(/* @__PURE__ */ new Set());
|
|
4767
4770
|
},
|
|
4768
4771
|
className: xe(
|
|
4769
4772
|
"inline-flex h-6 items-center gap-1 rounded border px-2 transition-colors",
|
|
4770
4773
|
cn ? "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"
|
|
4771
4774
|
),
|
|
4772
4775
|
children: [
|
|
4773
|
-
/* @__PURE__ */ l(
|
|
4776
|
+
/* @__PURE__ */ l(La, { className: "h-3 w-3", "aria-hidden": "true" }),
|
|
4774
4777
|
cn ? "Selecting" : "Select rows"
|
|
4775
4778
|
]
|
|
4776
4779
|
}
|
|
@@ -4779,11 +4782,11 @@ function Vc({
|
|
|
4779
4782
|
"button",
|
|
4780
4783
|
{
|
|
4781
4784
|
type: "button",
|
|
4782
|
-
onClick:
|
|
4785
|
+
onClick: Aa,
|
|
4783
4786
|
"data-tip": "Set the same values on every selected line",
|
|
4784
4787
|
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",
|
|
4785
4788
|
children: [
|
|
4786
|
-
/* @__PURE__ */ l(
|
|
4789
|
+
/* @__PURE__ */ l(Ta, { className: "h-3 w-3", "aria-hidden": "true" }),
|
|
4787
4790
|
"Edit ",
|
|
4788
4791
|
Pt.size,
|
|
4789
4792
|
" selected…"
|
|
@@ -4802,7 +4805,7 @@ function Vc({
|
|
|
4802
4805
|
"inline-flex h-6 w-6 items-center justify-center rounded border transition-colors",
|
|
4803
4806
|
$e ? "border-nvr-cyan bg-nvr-cyan/10 text-nvr-cyan" : "border-slate-200 text-slate-500 hover:border-slate-400 hover:text-slate-800 dark:border-border dark:text-slate-300"
|
|
4804
4807
|
),
|
|
4805
|
-
children: $e ? /* @__PURE__ */ l(
|
|
4808
|
+
children: $e ? /* @__PURE__ */ l(Ra, { className: "h-3 w-3", "aria-hidden": "true" }) : /* @__PURE__ */ l(Ma, { className: "h-3 w-3", "aria-hidden": "true" })
|
|
4806
4809
|
}
|
|
4807
4810
|
),
|
|
4808
4811
|
ln && /* @__PURE__ */ l(Rn, { className: "h-3 w-3 animate-spin text-slate-400" }),
|
|
@@ -4815,7 +4818,7 @@ function Vc({
|
|
|
4815
4818
|
"data-grid-save-mode": "live",
|
|
4816
4819
|
"data-tip": "Every change to a line here is saved the moment you make it — no Save needed",
|
|
4817
4820
|
children: [
|
|
4818
|
-
/* @__PURE__ */ l(
|
|
4821
|
+
/* @__PURE__ */ l(Ka, { className: "h-3 w-3", "aria-hidden": "true" }),
|
|
4819
4822
|
"Saves as you go"
|
|
4820
4823
|
]
|
|
4821
4824
|
}
|
|
@@ -4838,7 +4841,7 @@ function Vc({
|
|
|
4838
4841
|
}
|
|
4839
4842
|
);
|
|
4840
4843
|
})(),
|
|
4841
|
-
|
|
4844
|
+
Cs,
|
|
4842
4845
|
B && !q && /* @__PURE__ */ l(
|
|
4843
4846
|
"button",
|
|
4844
4847
|
{
|
|
@@ -4850,7 +4853,7 @@ function Vc({
|
|
|
4850
4853
|
}
|
|
4851
4854
|
)
|
|
4852
4855
|
] }),
|
|
4853
|
-
|
|
4856
|
+
Ks && Ki.length > 0 && /* @__PURE__ */ k("div", { className: "rounded-lg border border-amber-200 bg-amber-50/60 p-3 space-y-2 dark:border-amber-500/30 dark:bg-amber-400/10", children: [
|
|
4854
4857
|
/* @__PURE__ */ k("p", { className: "text-[11px] font-medium text-amber-700 dark:text-amber-300", children: [
|
|
4855
4858
|
"Apply values to all ",
|
|
4856
4859
|
O.length + P.length,
|
|
@@ -4864,7 +4867,7 @@ function Vc({
|
|
|
4864
4867
|
{
|
|
4865
4868
|
field: e,
|
|
4866
4869
|
value: an[e.field] ?? null,
|
|
4867
|
-
onChange: (n) =>
|
|
4870
|
+
onChange: (n) => Us((t) => ({ ...t, [e.field]: n })),
|
|
4868
4871
|
relations: Me,
|
|
4869
4872
|
collection: s,
|
|
4870
4873
|
itemId: "new"
|
|
@@ -4875,15 +4878,15 @@ function Vc({
|
|
|
4875
4878
|
"button",
|
|
4876
4879
|
{
|
|
4877
4880
|
type: "button",
|
|
4878
|
-
disabled:
|
|
4879
|
-
onClick:
|
|
4881
|
+
disabled: Bs || !(O.length + P.length),
|
|
4882
|
+
onClick: ka,
|
|
4880
4883
|
className: "h-9 rounded px-3 bg-amber-500 text-white text-[11px] font-medium hover:brightness-110 disabled:opacity-50 whitespace-nowrap",
|
|
4881
|
-
children:
|
|
4884
|
+
children: Bs ? "Applying…" : `Apply to all ${O.length + P.length} rows`
|
|
4882
4885
|
}
|
|
4883
4886
|
)
|
|
4884
4887
|
] })
|
|
4885
4888
|
] }),
|
|
4886
|
-
|
|
4889
|
+
Ds && !!(D != null && D.length) && /* @__PURE__ */ k("div", { className: "rounded-lg border border-nvr-cyan/40 bg-nvr-cyan/5 p-3 space-y-2 dark:bg-nvr-cyan/5", children: [
|
|
4887
4890
|
/* @__PURE__ */ k("p", { className: "text-[11px] font-medium text-slate-700 dark:text-slate-200", children: [
|
|
4888
4891
|
"Re-run rules on ",
|
|
4889
4892
|
O.length + P.length,
|
|
@@ -4928,7 +4931,7 @@ function Vc({
|
|
|
4928
4931
|
name: `rerun-mode-${u}`,
|
|
4929
4932
|
checked: Vi === e,
|
|
4930
4933
|
onChange: () => {
|
|
4931
|
-
|
|
4934
|
+
xa(e), On(null);
|
|
4932
4935
|
},
|
|
4933
4936
|
className: "accent-nvr-cyan"
|
|
4934
4937
|
}
|
|
@@ -4943,7 +4946,7 @@ function Vc({
|
|
|
4943
4946
|
{
|
|
4944
4947
|
type: "button",
|
|
4945
4948
|
disabled: Gr !== null,
|
|
4946
|
-
onClick: () => void
|
|
4949
|
+
onClick: () => void Es(!0),
|
|
4947
4950
|
className: "h-7 rounded border border-slate-300 bg-white px-2.5 text-[11px] font-medium text-slate-700 hover:border-slate-400 disabled:opacity-50 dark:bg-card dark:text-slate-200",
|
|
4948
4951
|
children: Gr === "preview" ? "Previewing…" : "Preview"
|
|
4949
4952
|
}
|
|
@@ -4953,7 +4956,7 @@ function Vc({
|
|
|
4953
4956
|
{
|
|
4954
4957
|
type: "button",
|
|
4955
4958
|
disabled: Gr !== null,
|
|
4956
|
-
onClick: () => void
|
|
4959
|
+
onClick: () => void Es(!1),
|
|
4957
4960
|
className: "h-7 rounded bg-nvr-cyan px-3 text-[11px] font-medium text-white hover:brightness-110 disabled:opacity-50",
|
|
4958
4961
|
children: Gr === "apply" ? W && x ? "Staging…" : "Applying…" : `${W && x ? "Stage for" : "Apply to"} ${Qt.changes.length} ${Qt.changes.length === 1 ? "line" : "lines"}`
|
|
4959
4962
|
}
|
|
@@ -5004,7 +5007,7 @@ function Vc({
|
|
|
5004
5007
|
{
|
|
5005
5008
|
type: "button",
|
|
5006
5009
|
disabled: ln,
|
|
5007
|
-
onClick: () => void
|
|
5010
|
+
onClick: () => void Sa(),
|
|
5008
5011
|
className: "ml-auto h-6 rounded border border-amber-300 bg-white px-2.5 text-[11px] font-medium text-amber-800 hover:border-amber-400 disabled:opacity-50 dark:border-amber-500/50 dark:bg-transparent dark:text-amber-200",
|
|
5009
5012
|
"data-tip": q || W ? "Stages one row per missing line — saved with the record" : "Adds one row per missing line now",
|
|
5010
5013
|
children: ln ? "Adding…" : `Add ${e === 1 ? "it" : `all ${e}`} as ${e === 1 ? "a row" : "rows"}`
|
|
@@ -5034,7 +5037,7 @@ function Vc({
|
|
|
5034
5037
|
] }),
|
|
5035
5038
|
/* @__PURE__ */ k("span", { className: "text-amber-700/80 dark:text-amber-300/80", children: [
|
|
5036
5039
|
t.join(" · "),
|
|
5037
|
-
|
|
5040
|
+
xs.length > 0 && ` · changed by ${xs.join(", ")}`
|
|
5038
5041
|
] }),
|
|
5039
5042
|
r.length > 0 && /* @__PURE__ */ k("span", { className: "text-amber-700/80 dark:text-amber-300/80", children: [
|
|
5040
5043
|
"removed: ",
|
|
@@ -5045,7 +5048,7 @@ function Vc({
|
|
|
5045
5048
|
"button",
|
|
5046
5049
|
{
|
|
5047
5050
|
type: "button",
|
|
5048
|
-
onClick:
|
|
5051
|
+
onClick: ia,
|
|
5049
5052
|
className: "ml-auto h-6 rounded border border-amber-300 bg-white px-2.5 text-[11px] font-medium text-amber-800 hover:border-amber-400 dark:border-amber-500/50 dark:bg-transparent dark:text-amber-200",
|
|
5050
5053
|
"data-tip": "Take the current rows as the new baseline",
|
|
5051
5054
|
children: "Dismiss"
|
|
@@ -5069,18 +5072,18 @@ function Vc({
|
|
|
5069
5072
|
/* @__PURE__ */ l("div", { className: "h-8 rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))] animate-pulse" }),
|
|
5070
5073
|
/* @__PURE__ */ l("div", { className: "h-8 rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))] animate-pulse" })
|
|
5071
5074
|
] }),
|
|
5072
|
-
!L &&
|
|
5073
|
-
|
|
5075
|
+
!L && Zo.length > 0 && /* @__PURE__ */ l(
|
|
5076
|
+
fd,
|
|
5074
5077
|
{
|
|
5075
|
-
proposals:
|
|
5076
|
-
onApply:
|
|
5078
|
+
proposals: Zo,
|
|
5079
|
+
onApply: Hl,
|
|
5077
5080
|
onDismiss: (e) => Oi(e, !0)
|
|
5078
5081
|
}
|
|
5079
5082
|
),
|
|
5080
|
-
($i && $i.length > 0 || Pe && !q && (j ||
|
|
5081
|
-
/* @__PURE__ */ l(
|
|
5083
|
+
($i && $i.length > 0 || Pe && !q && (j || Go || Co)) && /* @__PURE__ */ k("div", { "data-o2m-stats": !0, className: "mb-2 flex flex-wrap items-stretch gap-1.5", children: [
|
|
5084
|
+
/* @__PURE__ */ l(md, { data: j, loading: Go, error: Co }),
|
|
5082
5085
|
($i ?? []).map((e) => /* @__PURE__ */ l(
|
|
5083
|
-
|
|
5086
|
+
pd,
|
|
5084
5087
|
{
|
|
5085
5088
|
label: e.label,
|
|
5086
5089
|
value: e.result,
|
|
@@ -5090,18 +5093,18 @@ function Vc({
|
|
|
5090
5093
|
e.label
|
|
5091
5094
|
))
|
|
5092
5095
|
] }),
|
|
5093
|
-
L &&
|
|
5096
|
+
L && Cs,
|
|
5094
5097
|
/* @__PURE__ */ k(
|
|
5095
5098
|
"div",
|
|
5096
5099
|
{
|
|
5097
5100
|
ref: wr,
|
|
5098
5101
|
className: _o ? "hidden" : `relative rounded-lg border border-slate-200 text-[12px]${Y ? " overflow-x-auto" : ""}`,
|
|
5099
5102
|
children: [
|
|
5100
|
-
|
|
5103
|
+
ba && /* @__PURE__ */ l("div", { className: "absolute inset-0 z-10 flex items-center justify-center rounded-lg bg-white/60 backdrop-blur-[1px] dark:bg-black/40", children: /* @__PURE__ */ k("div", { className: "flex items-center gap-2 rounded-md border border-slate-200 bg-white px-3 py-1.5 shadow-sm text-[12px] text-slate-500", children: [
|
|
5101
5104
|
/* @__PURE__ */ l(Rn, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
5102
5105
|
"Saving order…"
|
|
5103
5106
|
] }) }),
|
|
5104
|
-
|
|
5107
|
+
cs && /* @__PURE__ */ l("style", { children: cs }),
|
|
5105
5108
|
/* @__PURE__ */ k(
|
|
5106
5109
|
"table",
|
|
5107
5110
|
{
|
|
@@ -5114,7 +5117,7 @@ function Vc({
|
|
|
5114
5117
|
type: "checkbox",
|
|
5115
5118
|
"aria-label": "Select all rows",
|
|
5116
5119
|
className: "accent-nvr-cyan",
|
|
5117
|
-
checked:
|
|
5120
|
+
checked: qa,
|
|
5118
5121
|
onChange: (e) => xr(e.target.checked ? new Set(Gi) : /* @__PURE__ */ new Set())
|
|
5119
5122
|
}
|
|
5120
5123
|
) }),
|
|
@@ -5132,12 +5135,12 @@ function Vc({
|
|
|
5132
5135
|
/* @__PURE__ */ l("th", { className: "w-20" })
|
|
5133
5136
|
] }) }),
|
|
5134
5137
|
/* @__PURE__ */ k("tbody", { children: [
|
|
5135
|
-
|
|
5138
|
+
Ms && /* @__PURE__ */ k("tr", { className: "border-b border-nvr-cyan/20 bg-nvr-cyan/5", children: [
|
|
5136
5139
|
st && /* @__PURE__ */ l("td", { className: "w-7" }),
|
|
5137
5140
|
se && (G || q || W) && /* @__PURE__ */ l("td", { className: "w-6" }),
|
|
5138
5141
|
R && /* @__PURE__ */ l("td", { className: "w-8" }),
|
|
5139
5142
|
(q || W) && /* @__PURE__ */ l("td", { className: "px-3 py-0.5 align-middle w-20", children: /* @__PURE__ */ l("span", { className: "text-[10px] font-medium uppercase tracking-wide text-slate-500 dark:text-muted-foreground", children: "Defaults" }) }),
|
|
5140
|
-
|
|
5143
|
+
$s.map((e) => /* @__PURE__ */ l(
|
|
5141
5144
|
"td",
|
|
5142
5145
|
{
|
|
5143
5146
|
className: "px-2 py-0.5 align-middle text-[11px] [&_button]:h-7 [&_button]:min-h-0 [&_button]:text-[11px] [&_input]:h-7 [&_input]:text-[11px] [&_textarea]:min-h-[28px] [&_label]:hidden",
|
|
@@ -5146,7 +5149,7 @@ function Vc({
|
|
|
5146
5149
|
{
|
|
5147
5150
|
field: e,
|
|
5148
5151
|
value: Fi[e.field] ?? null,
|
|
5149
|
-
onChange: (n) =>
|
|
5152
|
+
onChange: (n) => _a(e.field, n),
|
|
5150
5153
|
relations: Me,
|
|
5151
5154
|
collection: s,
|
|
5152
5155
|
itemId: "new"
|
|
@@ -5160,24 +5163,24 @@ function Vc({
|
|
|
5160
5163
|
{
|
|
5161
5164
|
type: "button",
|
|
5162
5165
|
disabled: ln,
|
|
5163
|
-
onClick: () =>
|
|
5166
|
+
onClick: () => Qs(!0),
|
|
5164
5167
|
className: "rounded px-2 h-7 bg-nvr-cyan text-white text-[11px] font-medium hover:brightness-110 disabled:opacity-50 whitespace-nowrap",
|
|
5165
5168
|
children: ln ? "…" : `Add ${sn}`
|
|
5166
5169
|
}
|
|
5167
5170
|
) })
|
|
5168
5171
|
] }),
|
|
5169
5172
|
!q && Ie === "original" && O.slice(0, _n).map((e, n) => {
|
|
5170
|
-
const t = String(e.id), r =
|
|
5173
|
+
const t = String(e.id), r = Fo ? Hn(e) : null, i = r !== null && (n === 0 || Hn(O[n - 1]) !== r), o = r !== null && Vo.has(r), a = i && r !== null ? /* @__PURE__ */ l("tr", { className: "border-b border-slate-200 bg-slate-100/80 dark:border-border dark:bg-muted", children: /* @__PURE__ */ l("td", { colSpan: St, className: "px-2 py-1", children: /* @__PURE__ */ k(
|
|
5171
5174
|
"button",
|
|
5172
5175
|
{
|
|
5173
5176
|
type: "button",
|
|
5174
5177
|
onClick: (y) => {
|
|
5175
|
-
y.stopPropagation(),
|
|
5178
|
+
y.stopPropagation(), Ql(r);
|
|
5176
5179
|
},
|
|
5177
5180
|
className: "flex w-full items-center gap-1.5 text-left",
|
|
5178
5181
|
children: [
|
|
5179
5182
|
/* @__PURE__ */ l(
|
|
5180
|
-
|
|
5183
|
+
gl,
|
|
5181
5184
|
{
|
|
5182
5185
|
className: xe(
|
|
5183
5186
|
"h-3 w-3 shrink-0 text-slate-400 transition-transform",
|
|
@@ -5188,7 +5191,7 @@ function Vc({
|
|
|
5188
5191
|
/* @__PURE__ */ l("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: r }),
|
|
5189
5192
|
/* @__PURE__ */ l("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: O.reduce((y, w) => y + (Hn(w) === r ? 1 : 0), 0) }),
|
|
5190
5193
|
(() => {
|
|
5191
|
-
const y =
|
|
5194
|
+
const y = zl(
|
|
5192
5195
|
O.filter(
|
|
5193
5196
|
(w) => Hn(w) === r && !Qe.has(String(w.id))
|
|
5194
5197
|
)
|
|
@@ -5210,7 +5213,7 @@ function Vc({
|
|
|
5210
5213
|
}
|
|
5211
5214
|
) }) }) : null;
|
|
5212
5215
|
if (o) return /* @__PURE__ */ l(eo, { children: a }, t);
|
|
5213
|
-
const c = (f == null ? void 0 : f.rowId) === t, d = c && !$e, m = Nt === n, g = Jt === n && Nt !== n, p = C.has(t), h = Qe.has(t), v = p ? { ...e, ...C.get(t) } : e, N = vo && !h ?
|
|
5216
|
+
const c = (f == null ? void 0 : f.rowId) === t, d = c && !$e, m = Nt === n, g = Jt === n && Nt !== n, p = C.has(t), h = Qe.has(t), v = p ? { ...e, ...C.get(t) } : e, N = vo && !h ? _l.get(String(v[vo] ?? "")) ?? null : null;
|
|
5214
5217
|
return /* @__PURE__ */ k(eo, { children: [
|
|
5215
5218
|
a,
|
|
5216
5219
|
/* @__PURE__ */ k(
|
|
@@ -5220,9 +5223,9 @@ function Vc({
|
|
|
5220
5223
|
"data-o2m-editing": c ? "" : void 0,
|
|
5221
5224
|
tabIndex: $e ? -1 : void 0,
|
|
5222
5225
|
draggable: se && !!G && !c && !h,
|
|
5223
|
-
onDragStart: () =>
|
|
5224
|
-
onDragOver: (y) =>
|
|
5225
|
-
onDrop:
|
|
5226
|
+
onDragStart: () => zs(n),
|
|
5227
|
+
onDragOver: (y) => Fs(y, n),
|
|
5228
|
+
onDrop: $a,
|
|
5226
5229
|
onDragEnd: In,
|
|
5227
5230
|
onClick: () => !c && !h && Hr(v),
|
|
5228
5231
|
onBlur: (y) => {
|
|
@@ -5272,7 +5275,7 @@ function Vc({
|
|
|
5272
5275
|
onClick: (y) => y.stopPropagation(),
|
|
5273
5276
|
children: [
|
|
5274
5277
|
lr === "reorder" && ar(t),
|
|
5275
|
-
G && /* @__PURE__ */ l(
|
|
5278
|
+
G && /* @__PURE__ */ l(el, { className: "h-3 w-3 text-slate-300 cursor-grab" })
|
|
5276
5279
|
]
|
|
5277
5280
|
}
|
|
5278
5281
|
),
|
|
@@ -5281,26 +5284,26 @@ function Vc({
|
|
|
5281
5284
|
/* @__PURE__ */ k("span", { className: "inline-flex items-center gap-1", children: [
|
|
5282
5285
|
n + 1,
|
|
5283
5286
|
le && /* @__PURE__ */ l(
|
|
5284
|
-
|
|
5287
|
+
cl,
|
|
5285
5288
|
{
|
|
5286
5289
|
result: Wt.byRow.get(t),
|
|
5287
5290
|
title: le.title
|
|
5288
5291
|
}
|
|
5289
5292
|
),
|
|
5290
5293
|
jr(t) && /* @__PURE__ */ l(
|
|
5291
|
-
|
|
5294
|
+
tl,
|
|
5292
5295
|
{
|
|
5293
5296
|
className: "h-2.5 w-2.5 text-slate-300 dark:text-slate-500",
|
|
5294
5297
|
"aria-label": "Imported line",
|
|
5295
5298
|
"data-tip": jr(t) ?? void 0
|
|
5296
5299
|
}
|
|
5297
5300
|
),
|
|
5298
|
-
|
|
5301
|
+
Po.has(t) && /* @__PURE__ */ l(
|
|
5299
5302
|
Zi,
|
|
5300
5303
|
{
|
|
5301
5304
|
className: "h-2.5 w-2.5 text-amber-500",
|
|
5302
5305
|
"aria-label": "Line overdue",
|
|
5303
|
-
"data-tip":
|
|
5306
|
+
"data-tip": Do
|
|
5304
5307
|
}
|
|
5305
5308
|
),
|
|
5306
5309
|
(() => {
|
|
@@ -5319,26 +5322,26 @@ function Vc({
|
|
|
5319
5322
|
W && /* @__PURE__ */ k("td", { className: "relative px-3 py-1 align-middle w-20", children: [
|
|
5320
5323
|
lr === "status" && ar(t),
|
|
5321
5324
|
!R && le && /* @__PURE__ */ l(
|
|
5322
|
-
|
|
5325
|
+
cl,
|
|
5323
5326
|
{
|
|
5324
5327
|
result: Wt.byRow.get(t),
|
|
5325
5328
|
title: le.title
|
|
5326
5329
|
}
|
|
5327
5330
|
),
|
|
5328
5331
|
!R && jr(t) && /* @__PURE__ */ l(
|
|
5329
|
-
|
|
5332
|
+
tl,
|
|
5330
5333
|
{
|
|
5331
5334
|
className: "mr-1 inline h-2.5 w-2.5 text-slate-300 dark:text-slate-500",
|
|
5332
5335
|
"aria-label": "Imported line",
|
|
5333
5336
|
"data-tip": jr(t) ?? void 0
|
|
5334
5337
|
}
|
|
5335
5338
|
),
|
|
5336
|
-
!R &&
|
|
5339
|
+
!R && Po.has(t) && /* @__PURE__ */ l(
|
|
5337
5340
|
Zi,
|
|
5338
5341
|
{
|
|
5339
5342
|
className: "mr-1 inline h-2.5 w-2.5 text-amber-500",
|
|
5340
5343
|
"aria-label": "Line overdue",
|
|
5341
|
-
"data-tip":
|
|
5344
|
+
"data-tip": Do
|
|
5342
5345
|
}
|
|
5343
5346
|
),
|
|
5344
5347
|
!R && (() => {
|
|
@@ -5379,7 +5382,7 @@ function Vc({
|
|
|
5379
5382
|
const I = w.computed_type === "write" && !!w.computed_formula, T = I ? Ft(
|
|
5380
5383
|
w.computed_formula,
|
|
5381
5384
|
c ? (f == null ? void 0 : f.draft) ?? v : v
|
|
5382
|
-
) ?? v[w.field] : null, E = B && !c && !h ? (ie = bi[t]) == null ? void 0 : ie[w.field] : void 0, X = E ? `${w.label || ve(w.field)} · changed ${
|
|
5385
|
+
) ?? v[w.field] : null, E = B && !c && !h ? (ie = bi[t]) == null ? void 0 : ie[w.field] : void 0, X = E ? `${w.label || ve(w.field)} · changed ${il(E.at)} by ${E.who}${E.reason ? `
|
|
5383
5386
|
Reason: “${E.reason}”` : ""}` : void 0;
|
|
5384
5387
|
return /* @__PURE__ */ k(
|
|
5385
5388
|
"td",
|
|
@@ -5431,7 +5434,7 @@ Reason: “${E.reason}”` : ""}` : void 0;
|
|
|
5431
5434
|
"div",
|
|
5432
5435
|
{
|
|
5433
5436
|
onClick: (ne) => ne.stopPropagation(),
|
|
5434
|
-
"data-tip": d && ((V = f == null ? void 0 : f.locks) != null && V.includes(w.field)) ?
|
|
5437
|
+
"data-tip": d && ((V = f == null ? void 0 : f.locks) != null && V.includes(w.field)) ? Is(w.field) : Pr(w) ? "Only administrators can change this field" : void 0,
|
|
5435
5438
|
"data-grid-cell": d ? qo(t, w.field) : void 0,
|
|
5436
5439
|
children: /* @__PURE__ */ l(
|
|
5437
5440
|
jn,
|
|
@@ -5543,11 +5546,11 @@ Reason: “${E.reason}”` : ""}` : void 0;
|
|
|
5543
5546
|
}
|
|
5544
5547
|
),
|
|
5545
5548
|
ee && t != null && /* @__PURE__ */ l(
|
|
5546
|
-
|
|
5549
|
+
Kd,
|
|
5547
5550
|
{
|
|
5548
5551
|
collection: s,
|
|
5549
5552
|
rowId: String(t),
|
|
5550
|
-
count:
|
|
5553
|
+
count: ea[String(t)] ?? 0
|
|
5551
5554
|
}
|
|
5552
5555
|
),
|
|
5553
5556
|
B && /* @__PURE__ */ l(
|
|
@@ -5563,15 +5566,15 @@ Reason: “${E.reason}”` : ""}` : void 0;
|
|
|
5563
5566
|
}
|
|
5564
5567
|
),
|
|
5565
5568
|
t != null && !String(t).startsWith("pending") && /* @__PURE__ */ l(
|
|
5566
|
-
|
|
5569
|
+
Bd,
|
|
5567
5570
|
{
|
|
5568
5571
|
collection: s,
|
|
5569
5572
|
rowId: String(t),
|
|
5570
|
-
rowLabel:
|
|
5573
|
+
rowLabel: Cd(e)
|
|
5571
5574
|
}
|
|
5572
5575
|
),
|
|
5573
5576
|
!L && /* @__PURE__ */ l(
|
|
5574
|
-
|
|
5577
|
+
fl,
|
|
5575
5578
|
{
|
|
5576
5579
|
saved: t != null && !String(t).startsWith("pending"),
|
|
5577
5580
|
onDelete: (y) => Hi(e, y)
|
|
@@ -5581,8 +5584,8 @@ Reason: “${E.reason}”` : ""}` : void 0;
|
|
|
5581
5584
|
]
|
|
5582
5585
|
}
|
|
5583
5586
|
),
|
|
5584
|
-
!$e && (Xe == null ? void 0 : Xe.rowKey) === t && /* @__PURE__ */ l("tr", { "data-row-soft-lock-row": "", children: /* @__PURE__ */ l("td", { colSpan: St, className: "p-0", children:
|
|
5585
|
-
c && lt === "inline" && Sn.length > 0 && /* @__PURE__ */ l("tr", { "data-row-remote-change-row": "", children: /* @__PURE__ */ l("td", { colSpan: St, className: "px-2 pt-2", children:
|
|
5587
|
+
!$e && (Xe == null ? void 0 : Xe.rowKey) === t && /* @__PURE__ */ l("tr", { "data-row-soft-lock-row": "", children: /* @__PURE__ */ l("td", { colSpan: St, className: "p-0", children: Ys(Xe, "row") }) }),
|
|
5588
|
+
c && lt === "inline" && Sn.length > 0 && /* @__PURE__ */ l("tr", { "data-row-remote-change-row": "", children: /* @__PURE__ */ l("td", { colSpan: St, className: "px-2 pt-2", children: vs(t) }) }),
|
|
5586
5589
|
N && /* @__PURE__ */ l("tr", { children: /* @__PURE__ */ k(
|
|
5587
5590
|
"td",
|
|
5588
5591
|
{
|
|
@@ -5843,7 +5846,7 @@ Reason: “${E.reason}”` : ""}` : void 0;
|
|
|
5843
5846
|
);
|
|
5844
5847
|
}), ...o];
|
|
5845
5848
|
})(),
|
|
5846
|
-
!q && Ie === "original" && O.length > _n && /* @__PURE__ */ l("tr", { ref:
|
|
5849
|
+
!q && Ie === "original" && O.length > _n && /* @__PURE__ */ l("tr", { ref: us, children: /* @__PURE__ */ k("td", { colSpan: St, className: "px-3 py-2 text-center text-[11px] text-slate-400", children: [
|
|
5847
5850
|
"Showing ",
|
|
5848
5851
|
_n,
|
|
5849
5852
|
" of ",
|
|
@@ -5923,13 +5926,13 @@ Reason: “${E.reason}”` : ""}` : void 0;
|
|
|
5923
5926
|
"data-o2m-row": `${s}:${t}`,
|
|
5924
5927
|
tabIndex: $e ? -1 : void 0,
|
|
5925
5928
|
draggable: se && !r,
|
|
5926
|
-
onDragStart: () =>
|
|
5927
|
-
onDragOver: (d) =>
|
|
5929
|
+
onDragStart: () => zs(n),
|
|
5930
|
+
onDragOver: (d) => Fs(d, n),
|
|
5928
5931
|
onDrop: (d) => {
|
|
5929
5932
|
d.preventDefault(), Nt !== null && Jt !== null && Nt !== Jt && (x == null || x.reorderRows(s, u, Nt, Jt)), In();
|
|
5930
5933
|
},
|
|
5931
5934
|
onDragEnd: In,
|
|
5932
|
-
onClick: () => !r &&
|
|
5935
|
+
onClick: () => !r && Os(e, n),
|
|
5933
5936
|
onBlur: (d) => {
|
|
5934
5937
|
!r || _t || d.currentTarget.contains(d.relatedTarget) || Er(d.relatedTarget) || (pt.current = setTimeout(() => {
|
|
5935
5938
|
Fn.current || Er(document.activeElement) || Tt();
|
|
@@ -5969,7 +5972,7 @@ Reason: “${E.reason}”` : ""}` : void 0;
|
|
|
5969
5972
|
{
|
|
5970
5973
|
className: "w-6 px-1 align-middle",
|
|
5971
5974
|
onClick: (d) => d.stopPropagation(),
|
|
5972
|
-
children: /* @__PURE__ */ l(
|
|
5975
|
+
children: /* @__PURE__ */ l(el, { className: "h-3 w-3 text-slate-300 cursor-grab" })
|
|
5973
5976
|
}
|
|
5974
5977
|
),
|
|
5975
5978
|
R && /* @__PURE__ */ l("td", { className: "w-8 px-2 align-middle text-slate-400 text-[11px] select-none", children: /* @__PURE__ */ k("span", { className: "inline-flex items-center gap-1", children: [
|
|
@@ -5991,7 +5994,7 @@ Reason: “${E.reason}”` : ""}` : void 0;
|
|
|
5991
5994
|
] }) }),
|
|
5992
5995
|
/* @__PURE__ */ k("td", { className: "px-3 py-1 align-middle w-16", children: [
|
|
5993
5996
|
!r && !c && /* @__PURE__ */ l("span", { className: "nvr-pop inline-flex text-[10px] font-medium text-amber-600 bg-amber-50 border border-amber-200 dark:text-amber-400 dark:bg-amber-500/10 dark:border-amber-500/40 rounded px-1.5 py-0.5", children: "Pending" }),
|
|
5994
|
-
!r && c && e.id != null &&
|
|
5997
|
+
!r && c && e.id != null && ha.has(e.id) && /* @__PURE__ */ l("span", { className: "inline-flex text-[10px] font-medium text-blue-600 bg-blue-50 border border-blue-200 rounded px-1.5 py-0.5", children: "Edited" })
|
|
5995
5998
|
] })
|
|
5996
5999
|
] }),
|
|
5997
6000
|
r && lt === "panel" ? Xi({
|
|
@@ -6126,7 +6129,7 @@ Reason: “${E.reason}”` : ""}` : void 0;
|
|
|
6126
6129
|
}
|
|
6127
6130
|
),
|
|
6128
6131
|
/* @__PURE__ */ l(
|
|
6129
|
-
|
|
6132
|
+
fl,
|
|
6130
6133
|
{
|
|
6131
6134
|
saved: !1,
|
|
6132
6135
|
onDelete: (d) => {
|
|
@@ -6200,7 +6203,7 @@ Reason: “${E.reason}”` : ""}` : void 0;
|
|
|
6200
6203
|
} catch {
|
|
6201
6204
|
return {};
|
|
6202
6205
|
}
|
|
6203
|
-
})() : t.options : {}, i = r.aggregate, o =
|
|
6206
|
+
})() : t.options : {}, i = r.aggregate, o = hd(j, t.field), a = o != null ? /* @__PURE__ */ k(
|
|
6204
6207
|
"div",
|
|
6205
6208
|
{
|
|
6206
6209
|
"data-compare-footer": t.field,
|
|
@@ -6277,7 +6280,7 @@ Reason: “${E.reason}”` : ""}` : void 0;
|
|
|
6277
6280
|
type: "button",
|
|
6278
6281
|
"data-grid-nested-retry": "",
|
|
6279
6282
|
disabled: Lo,
|
|
6280
|
-
onClick: () => void
|
|
6283
|
+
onClick: () => void Ml(),
|
|
6281
6284
|
className: "font-semibold underline-offset-2 hover:underline disabled:opacity-50",
|
|
6282
6285
|
children: Lo ? "Retrying…" : "Retry"
|
|
6283
6286
|
}
|
|
@@ -6298,7 +6301,7 @@ Reason: “${E.reason}”` : ""}` : void 0;
|
|
|
6298
6301
|
"button",
|
|
6299
6302
|
{
|
|
6300
6303
|
type: "button",
|
|
6301
|
-
onClick:
|
|
6304
|
+
onClick: ma,
|
|
6302
6305
|
className: "text-[11px] font-medium text-nvr-cyan hover:underline",
|
|
6303
6306
|
children: "+ Add row"
|
|
6304
6307
|
}
|
|
@@ -6306,7 +6309,7 @@ Reason: “${E.reason}”` : ""}` : void 0;
|
|
|
6306
6309
|
]
|
|
6307
6310
|
}
|
|
6308
6311
|
),
|
|
6309
|
-
$e && Xe && Ie === "original" && /* @__PURE__ */ l("div", { "data-grid-split-editor-lock": "", children:
|
|
6312
|
+
$e && Xe && Ie === "original" && /* @__PURE__ */ l("div", { "data-grid-split-editor-lock": "", children: Ys(Xe, "docked") }),
|
|
6310
6313
|
$e && f && Ie === "original" && (() => {
|
|
6311
6314
|
const e = f.rowId, n = e.startsWith("pending:"), t = n ? parseInt(e.split(":")[1], 10) : -1, r = !n && e !== "new" ? O.findIndex((d) => String(d.id) === e) : -1, i = r >= 0 ? O[r] : void 0, o = e === "new" ? O.length + P.length + 1 : n ? O.length + t + 1 : r + 1, a = R ? `Line ${o} · ` : "", c = e === "new" ? `${a}New line` : `${a}${Xr(f.draft)}`;
|
|
6312
6315
|
return /* @__PURE__ */ k(
|
|
@@ -6342,10 +6345,10 @@ Reason: “${E.reason}”` : ""}` : void 0;
|
|
|
6342
6345
|
(m) => Math.max(160, Math.min(900, m + (d.key === "ArrowDown" ? 24 : -24)))
|
|
6343
6346
|
));
|
|
6344
6347
|
},
|
|
6345
|
-
children: /* @__PURE__ */ l(
|
|
6348
|
+
children: /* @__PURE__ */ l(Pa, { className: "h-3 w-3", "aria-hidden": "true" })
|
|
6346
6349
|
}
|
|
6347
6350
|
),
|
|
6348
|
-
/* @__PURE__ */ l("div", { className: "min-h-0 flex-1 overflow-y-auto", children:
|
|
6351
|
+
/* @__PURE__ */ l("div", { className: "min-h-0 flex-1 overflow-y-auto", children: Hs({
|
|
6349
6352
|
identity: c,
|
|
6350
6353
|
draft: f.draft,
|
|
6351
6354
|
rowId: e === "new" ? void 0 : e,
|
|
@@ -6362,18 +6365,18 @@ Reason: “${E.reason}”` : ""}` : void 0;
|
|
|
6362
6365
|
);
|
|
6363
6366
|
})(),
|
|
6364
6367
|
/* @__PURE__ */ l(
|
|
6365
|
-
|
|
6368
|
+
wd,
|
|
6366
6369
|
{
|
|
6367
6370
|
open: Dn,
|
|
6368
6371
|
onOpenChange: yo,
|
|
6369
6372
|
columns: ke.filter(
|
|
6370
|
-
(e) => !fr(e) && !e.field.includes(".") && !Yn(e.interface) && !
|
|
6373
|
+
(e) => !fr(e) && !e.field.includes(".") && !Yn(e.interface) && !sl.has(e.field)
|
|
6371
6374
|
),
|
|
6372
6375
|
rows: cr.map((e) => e.row),
|
|
6373
6376
|
relations: Me,
|
|
6374
6377
|
collection: s,
|
|
6375
6378
|
cascadeFilters: Ve,
|
|
6376
|
-
onApply:
|
|
6379
|
+
onApply: Ia,
|
|
6377
6380
|
onEditIntent: () => {
|
|
6378
6381
|
var e;
|
|
6379
6382
|
(e = x == null ? void 0 : x.noteEditIntent) == null || e.call(x), Ao(!0);
|
|
@@ -6381,14 +6384,14 @@ Reason: “${E.reason}”` : ""}` : void 0;
|
|
|
6381
6384
|
}
|
|
6382
6385
|
),
|
|
6383
6386
|
/* @__PURE__ */ l(
|
|
6384
|
-
|
|
6387
|
+
dl,
|
|
6385
6388
|
{
|
|
6386
6389
|
mode: "timeline",
|
|
6387
6390
|
open: So,
|
|
6388
6391
|
onOpenChange: kr,
|
|
6389
6392
|
rowTitle: `${O.length} ${O.length === 1 ? "line" : "lines"} on this record`,
|
|
6390
|
-
revisions:
|
|
6391
|
-
loading:
|
|
6393
|
+
revisions: jl,
|
|
6394
|
+
loading: Al,
|
|
6392
6395
|
truncated: !!(Yt != null && Yt.truncated),
|
|
6393
6396
|
fields: ce,
|
|
6394
6397
|
displayCols: ke,
|
|
@@ -6405,13 +6408,13 @@ Reason: “${E.reason}”` : ""}` : void 0;
|
|
|
6405
6408
|
), a = o ? String(n[o.field]) : null;
|
|
6406
6409
|
return { title: i, subtitle: a && a.length > 48 ? `${a.slice(0, 48)}…` : a };
|
|
6407
6410
|
},
|
|
6408
|
-
onRestore: (e, n) =>
|
|
6409
|
-
onRestoreAllTo:
|
|
6410
|
-
restoringAll:
|
|
6411
|
+
onRestore: (e, n) => js(e, n),
|
|
6412
|
+
onRestoreAllTo: Ll,
|
|
6413
|
+
restoringAll: El
|
|
6411
6414
|
}
|
|
6412
6415
|
),
|
|
6413
6416
|
/* @__PURE__ */ l(
|
|
6414
|
-
|
|
6417
|
+
dl,
|
|
6415
6418
|
{
|
|
6416
6419
|
open: !!Oe,
|
|
6417
6420
|
onOpenChange: (e) => {
|
|
@@ -6428,8 +6431,8 @@ Reason: “${E.reason}”` : ""}` : void 0;
|
|
|
6428
6431
|
);
|
|
6429
6432
|
return e ? String(Oe[e.field]) : null;
|
|
6430
6433
|
})(),
|
|
6431
|
-
revisions:
|
|
6432
|
-
loading:
|
|
6434
|
+
revisions: Ol,
|
|
6435
|
+
loading: Il,
|
|
6433
6436
|
fields: ce,
|
|
6434
6437
|
displayCols: ke,
|
|
6435
6438
|
parentField: u,
|
|
@@ -6439,8 +6442,8 @@ Reason: “${E.reason}”` : ""}` : void 0;
|
|
|
6439
6442
|
m2oDisplays: qn,
|
|
6440
6443
|
client: $,
|
|
6441
6444
|
allowRestore: !!oe && !L,
|
|
6442
|
-
focusRevisionId:
|
|
6443
|
-
onRestore: (e, n) =>
|
|
6445
|
+
focusRevisionId: ql,
|
|
6446
|
+
onRestore: (e, n) => js(e, { ...n, itemId: n.itemId ?? String(Oe.id) })
|
|
6444
6447
|
}
|
|
6445
6448
|
)
|
|
6446
6449
|
]
|
|
@@ -6448,13 +6451,13 @@ Reason: “${E.reason}”` : ""}` : void 0;
|
|
|
6448
6451
|
)
|
|
6449
6452
|
);
|
|
6450
6453
|
}
|
|
6451
|
-
const
|
|
6454
|
+
const ml = {
|
|
6452
6455
|
even: "Evenly",
|
|
6453
6456
|
front: "Front-loaded",
|
|
6454
6457
|
back: "Back-loaded",
|
|
6455
6458
|
shape: "Like previous"
|
|
6456
6459
|
};
|
|
6457
|
-
function
|
|
6460
|
+
function vl(s) {
|
|
6458
6461
|
return s.presets.length < 2 ? null : /* @__PURE__ */ l("span", { className: "inline-flex items-center gap-0.5", "data-o2m-spread-presets": !0, children: s.presets.map((u) => /* @__PURE__ */ l(
|
|
6459
6462
|
"button",
|
|
6460
6463
|
{
|
|
@@ -6466,12 +6469,12 @@ function wl(s) {
|
|
|
6466
6469
|
"rounded-full border px-2 py-px text-[10.5px]",
|
|
6467
6470
|
s.value === u ? "border-nvr-cyan bg-nvr-cyan/10 font-semibold text-slate-800 dark:text-slate-100" : "border-slate-200 text-slate-500 hover:bg-muted dark:border-border dark:text-slate-400"
|
|
6468
6471
|
),
|
|
6469
|
-
children: u === "shape" ? s.shapeLabel ??
|
|
6472
|
+
children: u === "shape" ? s.shapeLabel ?? ml.shape : ml[u]
|
|
6470
6473
|
},
|
|
6471
6474
|
u
|
|
6472
6475
|
)) });
|
|
6473
6476
|
}
|
|
6474
|
-
function
|
|
6477
|
+
function rc({
|
|
6475
6478
|
config: s,
|
|
6476
6479
|
draft: u,
|
|
6477
6480
|
remaining: b,
|
|
@@ -6491,7 +6494,7 @@ function nc({
|
|
|
6491
6494
|
type: "button",
|
|
6492
6495
|
onClick: () => {
|
|
6493
6496
|
if (Se) return;
|
|
6494
|
-
const fe = B ? R.map((Y) => B.values[Y] ?? 0) : void 0, ze =
|
|
6497
|
+
const fe = B ? R.map((Y) => B.values[Y] ?? 0) : void 0, ze = wl(Ne, R.length, re, fe), we = {};
|
|
6495
6498
|
R.forEach((Y, ye) => {
|
|
6496
6499
|
we[Y] = ze[ye];
|
|
6497
6500
|
}), A(we);
|
|
@@ -6506,7 +6509,7 @@ function nc({
|
|
|
6506
6509
|
}
|
|
6507
6510
|
),
|
|
6508
6511
|
!Se && /* @__PURE__ */ l(
|
|
6509
|
-
|
|
6512
|
+
vl,
|
|
6510
6513
|
{
|
|
6511
6514
|
presets: se,
|
|
6512
6515
|
value: re,
|
|
@@ -6531,7 +6534,7 @@ function nc({
|
|
|
6531
6534
|
Se && /* @__PURE__ */ l("span", { className: "text-[11px] text-slate-400 dark:text-slate-500", children: Se })
|
|
6532
6535
|
] });
|
|
6533
6536
|
}
|
|
6534
|
-
function
|
|
6537
|
+
function ic(s) {
|
|
6535
6538
|
const [u, b] = J(!1), [A, U] = J("even"), B = s.remaining == null || !Number.isFinite(s.remaining) ? 0 : Math.round(s.remaining * 100) / 100, ee = (Q) => s.config.format === "number" ? Q.toLocaleString(void 0, { maximumFractionDigits: 2 }) : Q.toLocaleString(void 0, { style: "currency", currency: "USD" });
|
|
6536
6539
|
if (B <= 0) return null;
|
|
6537
6540
|
const oe = (s.config.presets ?? ["even", "front", "back"]).filter(
|
|
@@ -6570,7 +6573,7 @@ function rc(s) {
|
|
|
6570
6573
|
" first."
|
|
6571
6574
|
] }),
|
|
6572
6575
|
/* @__PURE__ */ l("div", { className: "mt-2", children: /* @__PURE__ */ l(
|
|
6573
|
-
|
|
6576
|
+
vl,
|
|
6574
6577
|
{
|
|
6575
6578
|
presets: oe,
|
|
6576
6579
|
value: oe.includes(A) ? A : oe[0],
|
|
@@ -6605,17 +6608,17 @@ function rc(s) {
|
|
|
6605
6608
|
)
|
|
6606
6609
|
] });
|
|
6607
6610
|
}
|
|
6608
|
-
function
|
|
6611
|
+
function pl(s) {
|
|
6609
6612
|
var b, A;
|
|
6610
6613
|
const u = s;
|
|
6611
6614
|
return ((b = u == null ? void 0 : u.response) == null ? void 0 : b.error) ?? ((A = u == null ? void 0 : u.response) == null ? void 0 : A.message) ?? (u == null ? void 0 : u.message) ?? "the server refused it";
|
|
6612
6615
|
}
|
|
6613
6616
|
export {
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
6617
|
+
fl as DeleteLineButton,
|
|
6618
|
+
Hc as InlineTableField,
|
|
6619
|
+
nc as applyValueColumns,
|
|
6620
|
+
Vd as dropUnavailableValues,
|
|
6618
6621
|
Ft as evalClientFormula,
|
|
6619
6622
|
ao as failingLints,
|
|
6620
|
-
|
|
6623
|
+
wl as spreadAmounts
|
|
6621
6624
|
};
|