@nivaro/react 0.3.9 → 0.3.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/fields/FileField.js +20 -19
- package/dist/full.css +1 -1
- package/dist/hooks/useNivaroForm.js +129 -126
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +69 -1
- package/dist/index.js +512 -501
- package/dist/shared/components/CollectionBrowserView.js +1000 -1001
- package/dist/shared/components/ConformanceView.js +36 -35
- package/dist/shared/components/ForceReloadBanner.js +58 -34
- package/dist/shared/components/ItemEditForm.js +3687 -3580
- package/dist/shared/components/JsonMapEditor.js +18 -17
- package/dist/shared/components/MatrixEditor.js +8 -7
- package/dist/shared/components/MyWorkView.js +32 -31
- package/dist/shared/components/PageRenderer.js +146 -145
- package/dist/shared/components/RecordGridEditor.js +76 -75
- package/dist/shared/components/ai/AiMemorySuggestions.js +15 -14
- package/dist/shared/components/ai/AskPanel.js +55 -54
- package/dist/shared/components/bulk/BulkActionButtons.js +30 -29
- package/dist/shared/components/bulk/PushBulkButtons.js +57 -56
- package/dist/shared/components/chat/SlashCommands.js +30 -29
- package/dist/shared/components/chat/chat-outbox.js +76 -75
- package/dist/shared/components/help-videos/recorder/useLeaveWarning.js +6 -5
- package/dist/shared/components/integrations/console/SignalCard.js +124 -123
- package/dist/shared/components/integrations/console/SnoozeMenu.js +24 -23
- package/dist/shared/components/item-edit/CloneDialog.js +85 -78
- package/dist/shared/components/item-edit/InlineTableField.js +301 -300
- package/dist/shared/components/item-edit/MembershipSetField.js +24 -23
- package/dist/shared/components/item-edit/QuickCreateButton.js +8 -7
- package/dist/shared/components/item-edit/RecordLiveSync.js +101 -100
- package/dist/shared/components/item-edit/staged-links.js +86 -0
- package/dist/shared/components/layout-editor/LayoutEditor.js +275 -274
- package/dist/shared/components/layout-editor/editors/cascade-rule-row.js +18 -17
- package/dist/shared/components/layout-editor/inspector/HelpTab.js +37 -36
- package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +50 -49
- package/dist/shared/components/profile/AiMemoryCard.js +15 -14
- package/dist/shared/components/profile/PersonAdminTools.js +70 -67
- package/dist/shared/components/queue/QueueItemSheet.js +36 -35
- package/dist/shared/components/queue/QueueWorklist.js +597 -598
- package/dist/shared/lib/client-version.js +63 -0
- package/dist/shared/lib/force-reload.js +36 -0
- package/dist/shared/lib/load-error.js +11 -10
- package/dist/shared/lib/presence-live.js +54 -35
- package/dist/shared/lib/record-outbox.js +76 -75
- package/dist/shared/lib/safe-error.js +39 -0
- package/dist/shared/lib/server-clock.js +11 -7
- package/dist/shared/lib/unsaved-work.js +62 -0
- package/package.json +1 -1
|
@@ -6,29 +6,30 @@ import { createPortal as tl } from "react-dom";
|
|
|
6
6
|
import { ChangeReasonDialog as nl, changeReasonChallenge as $i } from "./ChangeReasonDialog.js";
|
|
7
7
|
import { toast as Se } from "sonner";
|
|
8
8
|
import { useNivaroClient as Pr, useDrilldown as rl, useParentDraft as il, useReimportHandler as sl, useItemEditAuth as ol, fieldDrilldownConfig as wo } from "../../context.js";
|
|
9
|
-
import { get as te, patch as bt, post as
|
|
9
|
+
import { get as te, patch as bt, post as Me, del as jo } from "../../lib/commands.js";
|
|
10
10
|
import { useAfterIdle as al } from "../../lib/defer.js";
|
|
11
11
|
import { evaluateNumeric as mt, evaluateBoolean as ll } from "../../lib/expression.js";
|
|
12
12
|
import { numericIntlOptions as ht } from "../../lib/format-value.js";
|
|
13
13
|
import { useOptionalRealtime as dl } from "../../lib/realtime.js";
|
|
14
14
|
import { useRecordReader as cl } from "../../lib/record-loader.js";
|
|
15
|
+
import { userErrorMessage as ul } from "../../lib/safe-error.js";
|
|
15
16
|
import { titleCase as Le, cn as ye, formatRelative as _o } from "../../lib/utils.js";
|
|
16
|
-
import { formulaInputsChanged as
|
|
17
|
-
import { ImportFromFileButton as
|
|
18
|
-
import { Sheet as
|
|
19
|
-
import { useAddendumO2M as
|
|
20
|
-
import { resolveCompareEndpoint as
|
|
17
|
+
import { formulaInputsChanged as fl } from "../../lib/write-formula.js";
|
|
18
|
+
import { ImportFromFileButton as ml } from "../import/ImportFromFileButton.js";
|
|
19
|
+
import { Sheet as pl, SheetContent as gl, SheetHeader as hl, SheetTitle as bl } from "../ui/sheet.js";
|
|
20
|
+
import { useAddendumO2M as yl, useAddendumView as xl } from "./AddendumFieldContext.js";
|
|
21
|
+
import { resolveCompareEndpoint as vl, useCompareSeries as wl, compareColumnClosed as Mt, fmtMoney as qi, CompareProposalBanner as _l, CompareStripChips as kl, GridStatChip as Nl, CompareCell as Ei, compareRowFor as Oi, compareColumnSum as Sl, ReconcileAction as $l } from "./CompareSeries.js";
|
|
21
22
|
import { FieldRenderer as bn } from "./FieldRenderer.js";
|
|
22
|
-
import { GridBulkEditDialog as
|
|
23
|
-
import { SENTINEL_FIELDS as Ii, applyDisplayTemplate as Vn, parseJson as ko, EMPTY_NESTED_OPS as
|
|
23
|
+
import { GridBulkEditDialog as ql } from "./GridBulkEditDialog.js";
|
|
24
|
+
import { SENTINEL_FIELDS as Ii, applyDisplayTemplate as Vn, parseJson as ko, EMPTY_NESTED_OPS as Mr, SYSTEM_FIELDS as No } from "./helpers.js";
|
|
24
25
|
import { NestedRelationEditor as Ai } from "./NestedRelationEditor.js";
|
|
25
|
-
import { useO2MStaging as
|
|
26
|
+
import { useO2MStaging as El, useLiveRows as Ol, useStagedRelations as Il } from "./O2MStagingContext.js";
|
|
26
27
|
import { RelationCombobox as ji } from "./RelationCombobox.js";
|
|
27
|
-
import { useRowCommentCounts as
|
|
28
|
-
import { RowHistorySheet as So, parseImportStamp as
|
|
29
|
-
import { useRowMatches as
|
|
30
|
-
import { RowWatchButton as
|
|
31
|
-
import { RuleProvenanceChip as
|
|
28
|
+
import { useRowCommentCounts as Al, RowCommentButton as jl } from "./RowComments.js";
|
|
29
|
+
import { RowHistorySheet as So, parseImportStamp as Tl } from "./RowHistorySheet.js";
|
|
30
|
+
import { useRowMatches as Ll, RowMatchDot as $o, rowFromCandidate as Ml, RowMatchPanel as Kl } from "./RowMatchPanel.js";
|
|
31
|
+
import { RowWatchButton as Rl } from "./RowWatchButton.js";
|
|
32
|
+
import { RuleProvenanceChip as Pl } from "./RuleProvenancePopover.js";
|
|
32
33
|
import { resolveOptionFilterTokens as To } from "../../lib/option-filter-tokens.js";
|
|
33
34
|
function qo(a, f) {
|
|
34
35
|
const v = a[f.field], E = v == null || v === "", U = f.op ?? "eq";
|
|
@@ -49,14 +50,14 @@ function Ti(a, f) {
|
|
|
49
50
|
!((E = P == null ? void 0 : P.when) != null && E.field) || !((U = P == null ? void 0 : P.expect) != null && U.field) || qo(a, P.when) && (qo(a, P.expect) || v.push(P.label || `${P.when.field} vs ${P.expect.field}`));
|
|
50
51
|
return v;
|
|
51
52
|
}
|
|
52
|
-
const
|
|
53
|
+
const Dl = {
|
|
53
54
|
lt: "<",
|
|
54
55
|
gt: ">",
|
|
55
56
|
quot: '"',
|
|
56
57
|
amp: "&",
|
|
57
58
|
"#39": "'"
|
|
58
59
|
};
|
|
59
|
-
function
|
|
60
|
+
function Wl({ children: a }) {
|
|
60
61
|
const [f, v] = D(null);
|
|
61
62
|
return /* @__PURE__ */ _(
|
|
62
63
|
"span",
|
|
@@ -86,11 +87,11 @@ function Dl({ children: a }) {
|
|
|
86
87
|
}
|
|
87
88
|
);
|
|
88
89
|
}
|
|
89
|
-
function
|
|
90
|
+
function Ul(a) {
|
|
90
91
|
if (typeof a != "string" || !a.trim()) return [];
|
|
91
92
|
const f = a.replace(
|
|
92
93
|
/&(lt|gt|quot|amp|#39);/g,
|
|
93
|
-
(P, ee) =>
|
|
94
|
+
(P, ee) => Dl[ee] ?? ""
|
|
94
95
|
), v = [], E = /"detail"\s*:\s*"((?:[^"\\]|\\.)*)"/g;
|
|
95
96
|
let U = E.exec(f);
|
|
96
97
|
for (; U; ) {
|
|
@@ -131,13 +132,13 @@ function Lo(a, f, v, E) {
|
|
|
131
132
|
}
|
|
132
133
|
return ee;
|
|
133
134
|
}
|
|
134
|
-
const
|
|
135
|
-
function
|
|
135
|
+
const Mi = 1e3;
|
|
136
|
+
function Jl(a) {
|
|
136
137
|
let f = 0;
|
|
137
138
|
for (let v = 0; v < a.length; v++) f = f * 31 + a.charCodeAt(v) | 0;
|
|
138
139
|
return f;
|
|
139
140
|
}
|
|
140
|
-
function
|
|
141
|
+
function zl(a) {
|
|
141
142
|
if (a.line_number != null && a.line_number !== "") return `line ${a.line_number}`;
|
|
142
143
|
for (const f of ["year", "name", "title", "label", "number"]) {
|
|
143
144
|
const v = a[f];
|
|
@@ -145,10 +146,10 @@ function Jl(a) {
|
|
|
145
146
|
}
|
|
146
147
|
return null;
|
|
147
148
|
}
|
|
148
|
-
function
|
|
149
|
+
function Kt(a, f) {
|
|
149
150
|
return mt(a, f);
|
|
150
151
|
}
|
|
151
|
-
function
|
|
152
|
+
function Ki(a, f) {
|
|
152
153
|
return f.map((v) => {
|
|
153
154
|
const E = a[`__m2m_${v}`];
|
|
154
155
|
return String(E !== void 0 ? E ?? "" : a[v] ?? "");
|
|
@@ -182,16 +183,16 @@ function Rr(a, f, v, E) {
|
|
|
182
183
|
}
|
|
183
184
|
return { query: U, seed: P };
|
|
184
185
|
}
|
|
185
|
-
function
|
|
186
|
+
function Kr(a, f) {
|
|
186
187
|
return f.split(".").reduce(
|
|
187
188
|
(v, E) => v && typeof v == "object" ? v[E] : void 0,
|
|
188
189
|
a
|
|
189
190
|
);
|
|
190
191
|
}
|
|
191
|
-
function
|
|
192
|
+
function Ql(a, f, v) {
|
|
192
193
|
return f === "presence" ? a != null && String(a).trim() !== "" ? "Yes" : "No" : a == null || a === "" ? "—" : f === "currency" && Number.isFinite(Number(a)) ? Number(a).toLocaleString("en-US", ht(v, "currency")) : String(a);
|
|
193
194
|
}
|
|
194
|
-
function
|
|
195
|
+
function Fl({
|
|
195
196
|
config: a,
|
|
196
197
|
relatedCollection: f,
|
|
197
198
|
manyField: v,
|
|
@@ -207,7 +208,7 @@ function Ql({
|
|
|
207
208
|
pendingEdits: T,
|
|
208
209
|
pendingDeletes: Z
|
|
209
210
|
}) {
|
|
210
|
-
const me = Pr(), [Y, $e] = D(!1), [Je, ne] = D(null), [qe, pe] = D({}), [G,
|
|
211
|
+
const me = Pr(), [Y, $e] = D(!1), [Je, ne] = D(null), [qe, pe] = D({}), [G, le] = D(null), ge = j(
|
|
211
212
|
() => (a.columns ?? []).map(
|
|
212
213
|
(z) => typeof z == "string" ? {
|
|
213
214
|
path: z,
|
|
@@ -224,12 +225,12 @@ function Ql({
|
|
|
224
225
|
), tt = j(() => {
|
|
225
226
|
const z = /* @__PURE__ */ new Set(["id"]);
|
|
226
227
|
a.group_by && z.add(a.group_by);
|
|
227
|
-
const R = (
|
|
228
|
-
/^__\w+__$/.test(
|
|
228
|
+
const R = (K) => {
|
|
229
|
+
/^__\w+__$/.test(K) || z.add(K);
|
|
229
230
|
};
|
|
230
|
-
for (const
|
|
231
|
-
|
|
232
|
-
for (const A of (
|
|
231
|
+
for (const K of ge) {
|
|
232
|
+
K.path && R(K.path);
|
|
233
|
+
for (const A of (K.formula ?? "").matchAll(/\{\{\s*([\w.]+)\s*\}\}/g)) R(A[1]);
|
|
233
234
|
}
|
|
234
235
|
return [...z].join(",");
|
|
235
236
|
}, [ge, a.group_by]), { data: ze = [], isFetching: Rt } = Fe({
|
|
@@ -248,54 +249,54 @@ function Ql({
|
|
|
248
249
|
).then((z) => z.data ?? []),
|
|
249
250
|
enabled: Y,
|
|
250
251
|
staleTime: 0
|
|
251
|
-
}),
|
|
252
|
+
}), oe = j(() => {
|
|
252
253
|
const z = /* @__PURE__ */ new Map();
|
|
253
254
|
for (const R of U) {
|
|
254
|
-
const
|
|
255
|
-
|
|
255
|
+
const K = R[a.target_field];
|
|
256
|
+
K != null && z.set(String(K), R);
|
|
256
257
|
}
|
|
257
258
|
return z;
|
|
258
259
|
}, [U, a.target_field]);
|
|
259
260
|
function Ae(z) {
|
|
260
|
-
const R =
|
|
261
|
+
const R = oe.get(z), K = (R == null ? void 0 : R.id) != null ? String(R.id) : null, A = !!(K && (Z != null && Z.has(K))), re = (Ie ?? []).findIndex(
|
|
261
262
|
(S) => String(S[a.target_field]) === z
|
|
262
263
|
);
|
|
263
264
|
let ce = 0;
|
|
264
265
|
if (re >= 0) ce = Number((Ie ?? [])[re][a.value_field]) || 0;
|
|
265
266
|
else if (R && !A) {
|
|
266
|
-
const S =
|
|
267
|
+
const S = K ? T == null ? void 0 : T.get(K) : void 0;
|
|
267
268
|
ce = Number(
|
|
268
269
|
S && a.value_field in S ? S[a.value_field] : R[a.value_field]
|
|
269
270
|
) || 0;
|
|
270
271
|
}
|
|
271
272
|
return { savedRow: R, pendingIdx: re, amount: ce, deleted: A };
|
|
272
273
|
}
|
|
273
|
-
async function yt(z, R,
|
|
274
|
+
async function yt(z, R, K) {
|
|
274
275
|
let A = R.trim() === "" ? null : Number(R);
|
|
275
276
|
if (A !== null && !Number.isFinite(A)) return;
|
|
276
|
-
if (A !== null &&
|
|
277
|
-
const ce = he(
|
|
277
|
+
if (A !== null && K) {
|
|
278
|
+
const ce = he(K);
|
|
278
279
|
ce !== null && A > ce && (A = Math.max(0, Math.round(ce * 100) / 100), pe((S) => ({ ...S, [z]: String(A) })));
|
|
279
280
|
}
|
|
280
281
|
if (C && I) {
|
|
281
|
-
const { savedRow: ce, pendingIdx: S, deleted: xe } = Ae(z),
|
|
282
|
-
A === null || A === 0 ? S >= 0 ? I.removeRow(f, v, S) :
|
|
282
|
+
const { savedRow: ce, pendingIdx: S, deleted: xe } = Ae(z), ae = (ce == null ? void 0 : ce.id) != null ? String(ce.id) : null;
|
|
283
|
+
A === null || A === 0 ? S >= 0 ? I.removeRow(f, v, S) : ae && !xe && (I.cancelPendingEdit(f, v, ae), I.queueDelete(f, v, ae)) : S >= 0 ? I.updateRow(f, v, S, {
|
|
283
284
|
...(Ie ?? [])[S],
|
|
284
285
|
[a.value_field]: A
|
|
285
|
-
}) :
|
|
286
|
+
}) : ae ? (xe && I.cancelPendingDelete(f, v, ae), I.queueEdit(f, v, ae, { [a.value_field]: A })) : I.queueRow(f, v, {
|
|
286
287
|
...P,
|
|
287
288
|
[a.target_field]: z,
|
|
288
289
|
[a.value_field]: A
|
|
289
290
|
});
|
|
290
291
|
return;
|
|
291
292
|
}
|
|
292
|
-
const re =
|
|
293
|
+
const re = oe.get(z);
|
|
293
294
|
ne(z);
|
|
294
295
|
try {
|
|
295
296
|
A === null || A === 0 ? (re == null ? void 0 : re.id) != null && await me.request(jo(`/items/${f}/${re.id}`)) : (re == null ? void 0 : re.id) != null ? Number(re[a.value_field]) !== A && await me.request(
|
|
296
297
|
bt(`/items/${f}/${re.id}`, { [a.value_field]: A })
|
|
297
298
|
) : await me.request(
|
|
298
|
-
|
|
299
|
+
Me(`/items/${f}`, {
|
|
299
300
|
...P,
|
|
300
301
|
[a.target_field]: z,
|
|
301
302
|
[a.value_field]: A,
|
|
@@ -307,21 +308,21 @@ function Ql({
|
|
|
307
308
|
ne(null);
|
|
308
309
|
}
|
|
309
310
|
}
|
|
310
|
-
function Ze(z, R,
|
|
311
|
-
return mt(z, (A) => A in
|
|
311
|
+
function Ze(z, R, K) {
|
|
312
|
+
return mt(z, (A) => A in K ? K[A] : Kr(R, A));
|
|
312
313
|
}
|
|
313
314
|
function Re(z) {
|
|
314
|
-
const R =
|
|
315
|
-
return { __input__: A !== void 0 && A !== "" ? Number(A) || 0 : re, __saved__:
|
|
315
|
+
const R = oe.get(z), K = Number((R == null ? void 0 : R[a.value_field]) ?? 0) || 0, A = qe[z], re = C ? Ae(z).amount : K;
|
|
316
|
+
return { __input__: A !== void 0 && A !== "" ? Number(A) || 0 : re, __saved__: K };
|
|
316
317
|
}
|
|
317
318
|
function Ce(z, R) {
|
|
318
|
-
const
|
|
319
|
-
return
|
|
319
|
+
const K = Ze(z, R, Re(String(R.id)));
|
|
320
|
+
return K === null ? "—" : K.toLocaleString("en-US", { style: "currency", currency: "USD" });
|
|
320
321
|
}
|
|
321
322
|
function he(z) {
|
|
322
323
|
if (!a.value_max) return null;
|
|
323
|
-
const R =
|
|
324
|
-
return Ze(a.value_max, z, { __input__:
|
|
324
|
+
const R = oe.get(String(z.id)), K = Number((R == null ? void 0 : R[a.value_field]) ?? 0) || 0;
|
|
325
|
+
return Ze(a.value_max, z, { __input__: K, __saved__: K });
|
|
325
326
|
}
|
|
326
327
|
return /* @__PURE__ */ _(yn, { children: [
|
|
327
328
|
/* @__PURE__ */ o(
|
|
@@ -333,8 +334,8 @@ function Ql({
|
|
|
333
334
|
children: "Allocate…"
|
|
334
335
|
}
|
|
335
336
|
),
|
|
336
|
-
/* @__PURE__ */ o(
|
|
337
|
-
/* @__PURE__ */ o(
|
|
337
|
+
/* @__PURE__ */ o(pl, { open: Y, onOpenChange: $e, children: /* @__PURE__ */ _(gl, { side: "right", className: "w-[92vw] sm:max-w-[1200px] overflow-y-auto p-0", children: [
|
|
338
|
+
/* @__PURE__ */ o(hl, { className: "border-b border-slate-200 px-5 py-3", children: /* @__PURE__ */ o(bl, { className: "text-[14px]", children: a.title ?? "Allocate" }) }),
|
|
338
339
|
/* @__PURE__ */ _("div", { className: "p-4", children: [
|
|
339
340
|
/* @__PURE__ */ o("p", { className: "mb-2 text-[11px] text-slate-400", children: "Enter an amount to allocate a line — clearing it removes the allocation." }),
|
|
340
341
|
Rt ? /* @__PURE__ */ o("div", { className: "py-10 text-center", children: /* @__PURE__ */ o(xn, { className: "inline h-4 w-4 animate-spin text-slate-400" }) }) : ze.length === 0 ? /* @__PURE__ */ o("p", { className: "py-10 text-center text-[12px] text-slate-400", children: "No eligible rows for the current record's filters." }) : /* @__PURE__ */ o("div", { className: "overflow-x-auto rounded-lg border border-slate-200", children: /* @__PURE__ */ _("table", { className: "w-full text-left text-[12px]", children: [
|
|
@@ -350,20 +351,20 @@ function Ql({
|
|
|
350
351
|
/* @__PURE__ */ o("th", { className: "whitespace-nowrap px-2.5 py-1.5 text-[11px] font-medium text-slate-500", children: a.value_label ?? "Allocate" })
|
|
351
352
|
] }) }),
|
|
352
353
|
/* @__PURE__ */ o("tbody", { className: "divide-y divide-slate-100", children: (() => {
|
|
353
|
-
const z = (xe) => a.group_by ? String(
|
|
354
|
-
let R = ze,
|
|
355
|
-
a.group_by && (
|
|
356
|
-
(xe) => ze.filter((
|
|
354
|
+
const z = (xe) => a.group_by ? String(Kr(xe, a.group_by) ?? "—") : "";
|
|
355
|
+
let R = ze, K = [];
|
|
356
|
+
a.group_by && (K = [...new Set(ze.map(z))], R = K.flatMap(
|
|
357
|
+
(xe) => ze.filter((ae) => z(ae) === xe)
|
|
357
358
|
));
|
|
358
359
|
const A = G ?? new Set(
|
|
359
360
|
ze.filter((xe) => Ae(String(xe.id)).amount > 0).map(z)
|
|
360
|
-
), re = (xe) =>
|
|
361
|
-
const B = new Set(
|
|
361
|
+
), re = (xe) => le((ae) => {
|
|
362
|
+
const B = new Set(ae ?? A);
|
|
362
363
|
return B.has(xe) ? B.delete(xe) : B.add(xe), B;
|
|
363
364
|
}), ce = [];
|
|
364
365
|
let S = null;
|
|
365
366
|
for (const xe of R) {
|
|
366
|
-
const
|
|
367
|
+
const ae = String(xe.id), B = z(xe);
|
|
367
368
|
if (a.group_by && B !== S) {
|
|
368
369
|
S = B;
|
|
369
370
|
const fe = ze.filter((et) => z(et) === B), O = fe.filter(
|
|
@@ -374,7 +375,7 @@ function Ql({
|
|
|
374
375
|
const He = ge[et];
|
|
375
376
|
let Xn = 0;
|
|
376
377
|
for (const ve of fe) {
|
|
377
|
-
const wn = He.formula ? Ze(He.formula, ve, Re(String(ve.id))) : Number(
|
|
378
|
+
const wn = He.formula ? Ze(He.formula, ve, Re(String(ve.id))) : Number(Kr(ve, He.path ?? ""));
|
|
378
379
|
wn !== null && Number.isFinite(wn) && (Xn += wn);
|
|
379
380
|
}
|
|
380
381
|
return Xn.toLocaleString("en-US", {
|
|
@@ -439,11 +440,11 @@ function Ql({
|
|
|
439
440
|
);
|
|
440
441
|
}
|
|
441
442
|
if (a.group_by && !A.has(B)) continue;
|
|
442
|
-
const k = Ae(
|
|
443
|
+
const k = Ae(ae), vn = k.amount > 0 ? k.savedRow ?? {} : void 0, Pt = qe[ae] ?? (k.amount > 0 ? String(k.amount) : "");
|
|
443
444
|
ce.push(
|
|
444
445
|
/* @__PURE__ */ _("tr", { className: ye(vn && "bg-nvr-cyan/5"), children: [
|
|
445
446
|
ge.map((fe, O) => {
|
|
446
|
-
const N = fe.formula ? Ce(fe.formula, xe) :
|
|
447
|
+
const N = fe.formula ? Ce(fe.formula, xe) : Ql(Kr(xe, fe.path ?? ""), fe.format);
|
|
447
448
|
return /* @__PURE__ */ o(
|
|
448
449
|
"td",
|
|
449
450
|
{
|
|
@@ -468,12 +469,12 @@ function Ql({
|
|
|
468
469
|
min: 0,
|
|
469
470
|
value: Pt,
|
|
470
471
|
title: fe !== null ? `Max ${fe.toLocaleString("en-US", { style: "currency", currency: "USD" })}` : void 0,
|
|
471
|
-
onChange: (N) => pe((Dt) => ({ ...Dt, [
|
|
472
|
+
onChange: (N) => pe((Dt) => ({ ...Dt, [ae]: N.target.value })),
|
|
472
473
|
onBlur: () => {
|
|
473
|
-
qe[
|
|
474
|
+
qe[ae] !== void 0 && yt(ae, qe[ae], xe);
|
|
474
475
|
},
|
|
475
476
|
onKeyDown: (N) => {
|
|
476
|
-
N.key === "Enter" && qe[
|
|
477
|
+
N.key === "Enter" && qe[ae] !== void 0 && yt(ae, qe[ae], xe);
|
|
477
478
|
},
|
|
478
479
|
placeholder: "0",
|
|
479
480
|
className: ye(
|
|
@@ -483,9 +484,9 @@ function Ql({
|
|
|
483
484
|
}
|
|
484
485
|
);
|
|
485
486
|
})(),
|
|
486
|
-
Je ===
|
|
487
|
+
Je === ae && /* @__PURE__ */ o(xn, { className: "h-3 w-3 animate-spin text-slate-400" })
|
|
487
488
|
] }) })
|
|
488
|
-
] },
|
|
489
|
+
] }, ae)
|
|
489
490
|
);
|
|
490
491
|
}
|
|
491
492
|
return ce;
|
|
@@ -495,7 +496,7 @@ function Ql({
|
|
|
495
496
|
] }) })
|
|
496
497
|
] });
|
|
497
498
|
}
|
|
498
|
-
function
|
|
499
|
+
function Vl({
|
|
499
500
|
config: a,
|
|
500
501
|
rows: f,
|
|
501
502
|
relatedCollection: v,
|
|
@@ -537,23 +538,23 @@ function Fl({
|
|
|
537
538
|
})
|
|
538
539
|
).then((G) => G.data ?? []), $e = a.aggregate.op ?? "sum", Je = /* @__PURE__ */ new Map();
|
|
539
540
|
for (const G of Y) {
|
|
540
|
-
const
|
|
541
|
-
!
|
|
541
|
+
const le = String(G[Z.many_field] ?? ""), ge = Number(G[a.aggregate.field]);
|
|
542
|
+
!le || Number.isNaN(ge) || Je.set(le, [...Je.get(le) ?? [], ge]);
|
|
542
543
|
}
|
|
543
544
|
const ne = (G) => {
|
|
544
|
-
const
|
|
545
|
-
return $e === "count" ?
|
|
545
|
+
const le = Je.get(String(G)) ?? [];
|
|
546
|
+
return $e === "count" ? le.length : le.length === 0 ? 0 : $e === "min" ? Math.min(...le) : $e === "max" ? Math.max(...le) : le.reduce((ge, Be) => ge + Be, 0);
|
|
546
547
|
};
|
|
547
548
|
let qe = 0, pe = 0;
|
|
548
549
|
for (const G of f) {
|
|
549
|
-
const
|
|
550
|
-
if (a.guard && !ll(a.guard,
|
|
550
|
+
const le = { ...G, __agg__: ne(G.id) };
|
|
551
|
+
if (a.guard && !ll(a.guard, le)) {
|
|
551
552
|
pe++;
|
|
552
553
|
continue;
|
|
553
554
|
}
|
|
554
555
|
const ge = {};
|
|
555
556
|
for (const [Be, tt] of Object.entries(a.set)) {
|
|
556
|
-
const ze =
|
|
557
|
+
const ze = Kt(tt, le);
|
|
557
558
|
ze != null && Number.isFinite(ze) && (ge[Be] = Math.round(ze * 100) / 100);
|
|
558
559
|
}
|
|
559
560
|
if (Object.keys(ge).length === 0) {
|
|
@@ -605,7 +606,7 @@ function Fl({
|
|
|
605
606
|
}
|
|
606
607
|
);
|
|
607
608
|
}
|
|
608
|
-
function
|
|
609
|
+
function Bl({
|
|
609
610
|
config: a,
|
|
610
611
|
matchCfg: f,
|
|
611
612
|
rows: v,
|
|
@@ -619,7 +620,7 @@ function Vl({
|
|
|
619
620
|
C(!0), T(null);
|
|
620
621
|
const me = a.fk_field, Y = a.alloc_qty_field, $e = a.candidates.min_capacity ?? 1, Je = [
|
|
621
622
|
...a.candidates.capacity_formula.matchAll(/\{\{\s*(\w+)\s*\}\}/g)
|
|
622
|
-
].map((
|
|
623
|
+
].map((le) => le[1]), ne = {};
|
|
623
624
|
let qe = 0, pe = 0;
|
|
624
625
|
const G = [];
|
|
625
626
|
try {
|
|
@@ -634,8 +635,8 @@ function Vl({
|
|
|
634
635
|
fields: `id,${me},${Y}`,
|
|
635
636
|
limit: 500
|
|
636
637
|
})
|
|
637
|
-
).then((R) => R.data ?? []),
|
|
638
|
-
let Ae = tt -
|
|
638
|
+
).then((R) => R.data ?? []), oe = Rt.reduce((R, K) => R + (Number(K[Y]) || 0), 0);
|
|
639
|
+
let Ae = tt - oe;
|
|
639
640
|
if (Ae <= 0) continue;
|
|
640
641
|
const yt = Rr(
|
|
641
642
|
{
|
|
@@ -668,31 +669,31 @@ function Vl({
|
|
|
668
669
|
})
|
|
669
670
|
).then((R) => R.data ?? []), he = {};
|
|
670
671
|
for (const R of Ce) {
|
|
671
|
-
const
|
|
672
|
-
he[
|
|
672
|
+
const K = String(R[me]);
|
|
673
|
+
he[K] = (he[K] ?? 0) + (Number(R[Y]) || 0);
|
|
673
674
|
}
|
|
674
675
|
const z = Ae;
|
|
675
676
|
for (const R of Ze) {
|
|
676
677
|
if (Ae <= 0) break;
|
|
677
|
-
const
|
|
678
|
+
const K = String(R.id), re = (Kt(a.candidates.capacity_formula, R) ?? 0) - (he[K] ?? 0) - (ne[K] ?? 0);
|
|
678
679
|
if (re < $e) continue;
|
|
679
|
-
const ce = Math.min(Ae, re), S = Rt.find((xe) => String(xe[me]) ===
|
|
680
|
+
const ce = Math.min(Ae, re), S = Rt.find((xe) => String(xe[me]) === K);
|
|
680
681
|
S ? await se.request(
|
|
681
682
|
bt(`/items/${f.collection}/${S.id}`, {
|
|
682
683
|
[Y]: (Number(S[Y]) || 0) + ce
|
|
683
684
|
})
|
|
684
685
|
) : await se.request(
|
|
685
|
-
|
|
686
|
-
), ne[
|
|
686
|
+
Me(`/items/${f.collection}`, { ...ze.seed, [me]: R.id, [Y]: ce })
|
|
687
|
+
), ne[K] = (ne[K] ?? 0) + ce, Ae -= ce, qe += ce;
|
|
687
688
|
}
|
|
688
689
|
Ae < z && pe++, Ae > 0 && G.push(ge + 1);
|
|
689
690
|
}
|
|
690
|
-
const
|
|
691
|
-
|
|
691
|
+
const le = [];
|
|
692
|
+
le.push(
|
|
692
693
|
qe > 0 ? `Allocated ${qe.toLocaleString("en-US", { maximumFractionDigits: 2 })} across ${pe} row${pe === 1 ? "" : "s"}` : "Nothing to allocate"
|
|
693
|
-
), G.length > 0 &&
|
|
694
|
-
} catch (
|
|
695
|
-
T(`Auto-allocate failed: ${
|
|
694
|
+
), G.length > 0 && le.push(`short on row${G.length === 1 ? "" : "s"} ${G.join(", ")}`), T(le.join(" — ")), W.invalidateQueries({ queryKey: ["o2m-rows", P, ee, E] }), W.invalidateQueries({ queryKey: ["match-agg"] });
|
|
695
|
+
} catch (le) {
|
|
696
|
+
T(`Auto-allocate failed: ${ul(le, "unknown error")}`);
|
|
696
697
|
} finally {
|
|
697
698
|
C(!1);
|
|
698
699
|
}
|
|
@@ -711,7 +712,7 @@ function Vl({
|
|
|
711
712
|
Ie && /* @__PURE__ */ o("span", { className: "text-[11px] text-slate-500", children: Ie })
|
|
712
713
|
] });
|
|
713
714
|
}
|
|
714
|
-
function
|
|
715
|
+
function Od({
|
|
715
716
|
relatedCollection: a,
|
|
716
717
|
manyField: f,
|
|
717
718
|
parentId: v,
|
|
@@ -734,13 +735,13 @@ function qd({
|
|
|
734
735
|
sortDir: qe = "asc",
|
|
735
736
|
sectionGroupBy: pe,
|
|
736
737
|
freezeFirstColumn: G = !1,
|
|
737
|
-
rowFilter:
|
|
738
|
+
rowFilter: le,
|
|
738
739
|
rowDefaults: ge,
|
|
739
740
|
allocateDrawer: Be,
|
|
740
741
|
autoAllocate: tt,
|
|
741
742
|
rowBulkActions: ze,
|
|
742
743
|
uploadTemplate: Rt,
|
|
743
|
-
rowMatchPanel:
|
|
744
|
+
rowMatchPanel: oe,
|
|
744
745
|
lineSla: Ae,
|
|
745
746
|
rowLints: yt,
|
|
746
747
|
stats: Ze,
|
|
@@ -749,13 +750,13 @@ function qd({
|
|
|
749
750
|
spreadRemaining: he,
|
|
750
751
|
submissionErrors: z,
|
|
751
752
|
prefillParentId: R,
|
|
752
|
-
parentFieldKey:
|
|
753
|
+
parentFieldKey: K,
|
|
753
754
|
readOnly: A = !1,
|
|
754
755
|
emptyLabel: re,
|
|
755
756
|
editorMode: ce
|
|
756
757
|
}) {
|
|
757
758
|
var ho, bo;
|
|
758
|
-
const S = Pr(), xe = cl(),
|
|
759
|
+
const S = Pr(), xe = cl(), ae = rl(), B = Io(), k = El(), vn = Ol(), Pt = Il(), fe = yl()[K ?? ""] ?? [], O = v === "new", N = il(), Dt = sl(), $t = dl(), Yn = `nvr_grid_editor_${a}_${K ?? f}`, [Gn, et] = D(() => {
|
|
759
760
|
if (typeof localStorage > "u") return null;
|
|
760
761
|
try {
|
|
761
762
|
const e = localStorage.getItem(Yn);
|
|
@@ -766,11 +767,11 @@ function qd({
|
|
|
766
767
|
}), { data: He } = Fe({
|
|
767
768
|
queryKey: ["field-config", E ?? "", null],
|
|
768
769
|
queryFn: () => S.request(te(`/field-config/${E}`)).then((e) => e.data ?? []),
|
|
769
|
-
enabled: ce === void 0 && !!E && !!
|
|
770
|
+
enabled: ce === void 0 && !!E && !!K,
|
|
770
771
|
staleTime: 5 * 6e4
|
|
771
772
|
}), Xn = j(() => {
|
|
772
773
|
if (ce) return ce;
|
|
773
|
-
const e = He == null ? void 0 : He.find((t) => t.field ===
|
|
774
|
+
const e = He == null ? void 0 : He.find((t) => t.field === K), n = e != null && e.options ? typeof e.options == "string" ? (() => {
|
|
774
775
|
try {
|
|
775
776
|
return JSON.parse(e.options);
|
|
776
777
|
} catch {
|
|
@@ -778,7 +779,7 @@ function qd({
|
|
|
778
779
|
}
|
|
779
780
|
})() : e.options : {};
|
|
780
781
|
return (n == null ? void 0 : n.editor_mode) === "split" ? "split" : "drawer";
|
|
781
|
-
}, [ce, He,
|
|
782
|
+
}, [ce, He, K]), ve = !A && (Gn ?? Xn) === "split", wn = (e) => {
|
|
782
783
|
et(e);
|
|
783
784
|
try {
|
|
784
785
|
localStorage.setItem(Yn, e);
|
|
@@ -809,7 +810,7 @@ function qd({
|
|
|
809
810
|
const e = (n) => {
|
|
810
811
|
const t = n.detail;
|
|
811
812
|
if (!t || typeof t.target != "string" || !t.target || E && t.collection !== E) return;
|
|
812
|
-
const r =
|
|
813
|
+
const r = K ?? f;
|
|
813
814
|
if (!(t.grid !== r && t.grid !== a)) {
|
|
814
815
|
if (t.handled = !0, !Wi.current) {
|
|
815
816
|
tr.current = { target: t.target, value: t.value ?? null };
|
|
@@ -819,7 +820,7 @@ function qd({
|
|
|
819
820
|
}
|
|
820
821
|
};
|
|
821
822
|
return window.addEventListener("nvr:grid-apply-field", e), () => window.removeEventListener("nvr:grid-apply-field", e);
|
|
822
|
-
}, [A, E,
|
|
823
|
+
}, [A, E, K, f, a]), Ne(() => {
|
|
823
824
|
const e = er.current;
|
|
824
825
|
if (!e || !ve) return;
|
|
825
826
|
const n = (t) => {
|
|
@@ -831,7 +832,7 @@ function qd({
|
|
|
831
832
|
};
|
|
832
833
|
return e.addEventListener("keydown", n), () => e.removeEventListener("keydown", n);
|
|
833
834
|
}, [ve]);
|
|
834
|
-
const [Ct,
|
|
835
|
+
const [Ct, Ko] = D(!1), [Wt, nr] = D(/* @__PURE__ */ new Set()), [Ro, Ui] = D(!1), Ji = (e) => nr((n) => {
|
|
835
836
|
const t = new Set(n);
|
|
836
837
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
837
838
|
}), zi = z ? z.line_field ?? "line_number" : null, { data: rr } = Fe({
|
|
@@ -850,7 +851,7 @@ function qd({
|
|
|
850
851
|
if (!["ERROR", "FAILED"].includes(d)) continue;
|
|
851
852
|
const c = String((s == null ? void 0 : s.lineNumber) ?? "");
|
|
852
853
|
if (!c || e.has(c)) continue;
|
|
853
|
-
const l =
|
|
854
|
+
const l = Ul(s == null ? void 0 : s.lineDetailedMessage), m = l.find(
|
|
854
855
|
(p) => new RegExp(`^Line(?:Number)?\\s*${c}\\s*:`, "i").test(p.trim())
|
|
855
856
|
) ?? l[0];
|
|
856
857
|
m && e.set(c, m.replace(/^Line(?:Number)?\s*\d+\s*:\s*/i, ""));
|
|
@@ -871,7 +872,7 @@ function qd({
|
|
|
871
872
|
Qi.current = !0, S.request(
|
|
872
873
|
te(`/items/${a}`, {
|
|
873
874
|
filter: JSON.stringify({ [f]: { _eq: R } }),
|
|
874
|
-
limit:
|
|
875
|
+
limit: Mi
|
|
875
876
|
})
|
|
876
877
|
).then((e) => {
|
|
877
878
|
for (const n of e.data ?? [])
|
|
@@ -899,7 +900,7 @@ function qd({
|
|
|
899
900
|
const t = (await S.request(
|
|
900
901
|
te(`/items/${a}`, {
|
|
901
902
|
filter: JSON.stringify({ [f]: { _eq: e } }),
|
|
902
|
-
limit:
|
|
903
|
+
limit: Mi
|
|
903
904
|
})
|
|
904
905
|
)).data ?? [];
|
|
905
906
|
for (const r of t) {
|
|
@@ -951,7 +952,7 @@ function qd({
|
|
|
951
952
|
Hi(!0);
|
|
952
953
|
try {
|
|
953
954
|
await S.request(
|
|
954
|
-
|
|
955
|
+
Me("/revisions/o2m-restore", {
|
|
955
956
|
collection: a,
|
|
956
957
|
many_field: f,
|
|
957
958
|
parent_id: v,
|
|
@@ -1041,7 +1042,7 @@ function qd({
|
|
|
1041
1042
|
const i = [];
|
|
1042
1043
|
for (const s of r.members)
|
|
1043
1044
|
try {
|
|
1044
|
-
await S.request(
|
|
1045
|
+
await S.request(Me(`/items/${r.collection}`, { ...s, [r.fkField]: r.rowId }));
|
|
1045
1046
|
} catch (d) {
|
|
1046
1047
|
i.push(s), n || (n = Oo(d));
|
|
1047
1048
|
}
|
|
@@ -1056,7 +1057,7 @@ function qd({
|
|
|
1056
1057
|
} : null
|
|
1057
1058
|
);
|
|
1058
1059
|
}
|
|
1059
|
-
const [ar, qn] = D(null), je =
|
|
1060
|
+
const [ar, qn] = D(null), je = xl(), [Qr, Zo] = D(() => {
|
|
1060
1061
|
var e;
|
|
1061
1062
|
return me === Bn ? Bn : me && (Z != null && Z.some((n) => n.name === me)) ? me : (e = Z == null ? void 0 : Z[0]) == null ? void 0 : e.name;
|
|
1062
1063
|
});
|
|
@@ -1097,12 +1098,12 @@ function qd({
|
|
|
1097
1098
|
enabled: !!Jt,
|
|
1098
1099
|
staleTime: 5 * 6e4
|
|
1099
1100
|
}), X = (Vr == null ? void 0 : Vr.row_order_field) ?? null, dr = j(() => {
|
|
1100
|
-
if (!
|
|
1101
|
+
if (!le || Object.keys(le).length === 0) return null;
|
|
1101
1102
|
const e = {};
|
|
1102
|
-
for (const [n, t] of Object.entries(
|
|
1103
|
+
for (const [n, t] of Object.entries(le))
|
|
1103
1104
|
e[n] = t !== null && typeof t == "object" ? t : { _eq: t };
|
|
1104
1105
|
return e;
|
|
1105
|
-
}, [
|
|
1106
|
+
}, [le]), zt = j(
|
|
1106
1107
|
() => Object.fromEntries(
|
|
1107
1108
|
Object.entries(ge ?? {}).filter(
|
|
1108
1109
|
([, e]) => e === null || ["string", "number", "boolean"].includes(typeof e)
|
|
@@ -1147,14 +1148,14 @@ function qd({
|
|
|
1147
1148
|
queryKey: [
|
|
1148
1149
|
"line-aging",
|
|
1149
1150
|
E ?? "",
|
|
1150
|
-
|
|
1151
|
+
K ?? f,
|
|
1151
1152
|
v,
|
|
1152
1153
|
cr
|
|
1153
1154
|
],
|
|
1154
1155
|
queryFn: () => S.request(
|
|
1155
1156
|
te("/sla/line-aging", {
|
|
1156
1157
|
collection: E ?? "",
|
|
1157
|
-
field:
|
|
1158
|
+
field: K ?? f,
|
|
1158
1159
|
parent_id: v
|
|
1159
1160
|
})
|
|
1160
1161
|
).then((e) => e.data ?? null),
|
|
@@ -1167,7 +1168,7 @@ function qd({
|
|
|
1167
1168
|
), ns = nt != null && nt.overdue ? `${nt.label} still missing · ${nt.days} ${nt.days === 1 ? "day" : "days"} on the clock (limit ${nt.threshold_days})` : void 0, Br = (nn == null ? void 0 : nn.data) ?? {}, ta = (nn == null ? void 0 : nn.created) ?? {}, ur = (e) => {
|
|
1168
1169
|
const n = ta[e];
|
|
1169
1170
|
if (!n) return null;
|
|
1170
|
-
const t =
|
|
1171
|
+
const t = Tl(n.comment);
|
|
1171
1172
|
return t ? `From ${t.template} · ${_o(n.at)} by ${n.who}` : null;
|
|
1172
1173
|
}, On = Ie ?? [], rs = Zt({
|
|
1173
1174
|
queries: On.map((e) => ({
|
|
@@ -1205,11 +1206,11 @@ function qd({
|
|
|
1205
1206
|
}
|
|
1206
1207
|
}));
|
|
1207
1208
|
}), e;
|
|
1208
|
-
}, [On, rs, N]),
|
|
1209
|
+
}, [On, rs, N]), M = W === "pending", L = k ? k.getPendingRows(a, f) : [], H = M && k ? k.getPendingEdits(a, f) : /* @__PURE__ */ new Map(), [fr, mr] = D({});
|
|
1209
1210
|
Ne(() => {
|
|
1210
1211
|
Ye.current || mr({});
|
|
1211
1212
|
}, [cr]);
|
|
1212
|
-
const We =
|
|
1213
|
+
const We = M && k ? k.getPendingDeletes(a, f) : /* @__PURE__ */ new Set(), Hr = j(
|
|
1213
1214
|
() => new Map(
|
|
1214
1215
|
we.filter((e) => e.computed_type === "write" && !!e.computed_formula).map((e) => [e.field, String(e.computed_formula)])
|
|
1215
1216
|
),
|
|
@@ -1354,13 +1355,13 @@ function qd({
|
|
|
1354
1355
|
let e = ut ? Ge.map((n) => ({ ...n, ...ut[String(n.id)] ?? {} })) : Ge;
|
|
1355
1356
|
if (X) {
|
|
1356
1357
|
const n = (t) => {
|
|
1357
|
-
const r =
|
|
1358
|
+
const r = M ? H.get(String(t.id)) : void 0, i = (r == null ? void 0 : r[X]) ?? t[X];
|
|
1358
1359
|
return Number(i ?? -1);
|
|
1359
1360
|
};
|
|
1360
1361
|
e = [...e].sort((t, r) => n(t) - n(r));
|
|
1361
1362
|
}
|
|
1362
1363
|
if (ne && (e = [...e].sort((n, t) => {
|
|
1363
|
-
const r =
|
|
1364
|
+
const r = M ? H.get(String(n.id)) : void 0, i = M ? H.get(String(t.id)) : void 0, s = (r == null ? void 0 : r[ne]) ?? n[ne], d = (i == null ? void 0 : i[ne]) ?? t[ne];
|
|
1364
1365
|
let c = 0;
|
|
1365
1366
|
return s == null && d == null ? c = 0 : s == null ? c = 1 : d == null ? c = -1 : typeof s == "number" && typeof d == "number" ? c = s - d : c = String(s).localeCompare(String(d), void 0, { sensitivity: "base" }), qe === "desc" ? -c : c;
|
|
1366
1367
|
})), pe && ut) {
|
|
@@ -1375,12 +1376,12 @@ function qd({
|
|
|
1375
1376
|
Ge,
|
|
1376
1377
|
ut,
|
|
1377
1378
|
X,
|
|
1378
|
-
|
|
1379
|
+
M,
|
|
1379
1380
|
H,
|
|
1380
1381
|
ne,
|
|
1381
1382
|
qe,
|
|
1382
1383
|
pe
|
|
1383
|
-
]), ds = !!pe && !!ut, pr = pe ? `nvr_grid_sections:${a}:${
|
|
1384
|
+
]), ds = !!pe && !!ut, pr = pe ? `nvr_grid_sections:${a}:${K ?? f}` : null, [cs, ia] = D(() => {
|
|
1384
1385
|
if (!pr || typeof localStorage > "u") return /* @__PURE__ */ new Set();
|
|
1385
1386
|
try {
|
|
1386
1387
|
const e = localStorage.getItem(pr), n = e ? JSON.parse(e) : null;
|
|
@@ -1398,7 +1399,7 @@ function qd({
|
|
|
1398
1399
|
return t;
|
|
1399
1400
|
}), oa = (e) => {
|
|
1400
1401
|
const n = [];
|
|
1401
|
-
for (const t of
|
|
1402
|
+
for (const t of Ke) {
|
|
1402
1403
|
const r = ko(t.options) ?? {}, i = r.aggregate;
|
|
1403
1404
|
if (!i || t.interface === "formula-column" || t.interface === "match-agg-column") continue;
|
|
1404
1405
|
const s = e.map((l) => {
|
|
@@ -1428,8 +1429,8 @@ function qd({
|
|
|
1428
1429
|
const t = n === void 0 ? aa(e.id) : n, r = { ...e };
|
|
1429
1430
|
for (const i of us) {
|
|
1430
1431
|
const s = i.computed_formula;
|
|
1431
|
-
if (t && !
|
|
1432
|
-
const d =
|
|
1432
|
+
if (t && !fl(s, r, t)) continue;
|
|
1433
|
+
const d = Kt(s, r);
|
|
1433
1434
|
d !== null && (r[i.field] = d);
|
|
1434
1435
|
}
|
|
1435
1436
|
return r;
|
|
@@ -1462,7 +1463,7 @@ function qd({
|
|
|
1462
1463
|
const t = new Set(n);
|
|
1463
1464
|
for (const d of $) {
|
|
1464
1465
|
const c = Number(
|
|
1465
|
-
(
|
|
1466
|
+
(M ? (s = H.get(String(d.id))) == null ? void 0 : s[X] : void 0) ?? d[X]
|
|
1466
1467
|
);
|
|
1467
1468
|
Number.isFinite(c) && t.add(c);
|
|
1468
1469
|
}
|
|
@@ -1503,7 +1504,7 @@ function qd({
|
|
|
1503
1504
|
e.baseRows ? n : void 0
|
|
1504
1505
|
)
|
|
1505
1506
|
) : ei;
|
|
1506
|
-
}, [je, fe, ei]), fs = Ge.length >=
|
|
1507
|
+
}, [je, fe, ei]), fs = Ge.length >= Mi, vt = N == null ? void 0 : N.draft, Qt = Lt(
|
|
1507
1508
|
(e) => {
|
|
1508
1509
|
if (e.startsWith("$parent."))
|
|
1509
1510
|
return (vt == null ? void 0 : vt[e.slice(8)]) ?? 0;
|
|
@@ -1515,9 +1516,9 @@ function qd({
|
|
|
1515
1516
|
},
|
|
1516
1517
|
[vt, jn]
|
|
1517
1518
|
), ti = j(() => Ze != null && Ze.length ? Ze.map((e) => ({ ...e, result: mt(e.value, Qt) })) : null, [Ze, Qt]), gr = j(
|
|
1518
|
-
() => Re != null && Re.endpoint ?
|
|
1519
|
+
() => Re != null && Re.endpoint ? vl(Re.endpoint, vt) : null,
|
|
1519
1520
|
[Re == null ? void 0 : Re.endpoint, vt]
|
|
1520
|
-
), ni =
|
|
1521
|
+
), ni = wl({
|
|
1521
1522
|
client: S,
|
|
1522
1523
|
endpoint: gr,
|
|
1523
1524
|
enabled: !!Re && !O
|
|
@@ -1525,7 +1526,7 @@ function qd({
|
|
|
1525
1526
|
(e) => e.label || Le(e.field),
|
|
1526
1527
|
[]
|
|
1527
1528
|
), { isAdmin: ri } = ol(), ii = Lt(
|
|
1528
|
-
(e, n) => !!(q != null && q.closed_locked) && !ri && q.columns.includes(e) &&
|
|
1529
|
+
(e, n) => !!(q != null && q.closed_locked) && !ri && q.columns.includes(e) && Mt(q, n[q.key_field], e),
|
|
1529
1530
|
[q, ri]
|
|
1530
1531
|
), on = Lt(
|
|
1531
1532
|
async (e, n, t) => {
|
|
@@ -1539,7 +1540,7 @@ function qd({
|
|
|
1539
1540
|
);
|
|
1540
1541
|
return;
|
|
1541
1542
|
}
|
|
1542
|
-
if (
|
|
1543
|
+
if (M && k) {
|
|
1543
1544
|
k.queueEdit(a, f, e, {
|
|
1544
1545
|
...n,
|
|
1545
1546
|
_change_reason: t
|
|
@@ -1555,7 +1556,7 @@ function qd({
|
|
|
1555
1556
|
}
|
|
1556
1557
|
},
|
|
1557
1558
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1558
|
-
[L, k,
|
|
1559
|
+
[L, k, M, a, f, S, B, v]
|
|
1559
1560
|
), Tn = gr ? `nvr_compare_dismiss:${gr}` : null, [gs, da] = D(() => {
|
|
1560
1561
|
try {
|
|
1561
1562
|
return !Tn || typeof window > "u" ? /* @__PURE__ */ new Set() : new Set(JSON.parse(window.localStorage.getItem(Tn) ?? "[]"));
|
|
@@ -1591,7 +1592,7 @@ function qd({
|
|
|
1591
1592
|
if (d.category != null) continue;
|
|
1592
1593
|
const c = $.find((p) => String(p[n]) === String(d.key)), l = L.findIndex((p) => String(p[n]) === String(d.key)), u = c ? { ...c, ...s.get(String(c.id)) ?? {} } : l >= 0 ? L[l] : null, m = {};
|
|
1593
1594
|
for (const [p, h] of Object.entries(d.values))
|
|
1594
|
-
|
|
1595
|
+
Mt(q, d.key, p) || u && !r(u[p]) || (m[p] = h);
|
|
1595
1596
|
Object.keys(m).length !== 0 && (i++, c ? on(String(c.id), m, t) : l >= 0 ? on(`pending:${l}`, m, t) : k && k.queueRow(
|
|
1596
1597
|
a,
|
|
1597
1598
|
f,
|
|
@@ -1628,7 +1629,7 @@ function qd({
|
|
|
1628
1629
|
const u = [], m = [];
|
|
1629
1630
|
for (const w of l)
|
|
1630
1631
|
for (const x of he.fields)
|
|
1631
|
-
r && !i(w.row[x]) || q &&
|
|
1632
|
+
r && !i(w.row[x]) || q && Mt(q, w.row[q.key_field], x) || (u.push({ id: w.id, field: x }), m.push(0));
|
|
1632
1633
|
if (u.length === 0) {
|
|
1633
1634
|
Se.message("Nothing to spread into — every target is filled or closed");
|
|
1634
1635
|
return;
|
|
@@ -1748,7 +1749,7 @@ function qd({
|
|
|
1748
1749
|
return { id: l, tag: s.tag ?? "Default" };
|
|
1749
1750
|
}
|
|
1750
1751
|
return null;
|
|
1751
|
-
},
|
|
1752
|
+
}, Mn = (e, n) => {
|
|
1752
1753
|
const t = Ln.get(e);
|
|
1753
1754
|
return t ? vs(t, n) : null;
|
|
1754
1755
|
}, _e = we.filter(
|
|
@@ -1837,30 +1838,30 @@ function qd({
|
|
|
1837
1838
|
e.set(n, i);
|
|
1838
1839
|
}
|
|
1839
1840
|
return e;
|
|
1840
|
-
}, [Vt, _t, $s, an]), xr = j(() => $.map((e) => String(e.id)), [$]),
|
|
1841
|
-
() => `nvr-gf-${Math.abs(
|
|
1842
|
-
[a,
|
|
1841
|
+
}, [Vt, _t, $s, an]), xr = j(() => $.map((e) => String(e.id)), [$]), Kn = j(
|
|
1842
|
+
() => `nvr-gf-${Math.abs(Jl(`${a}:${K ?? f}`)) % 1e5}`,
|
|
1843
|
+
[a, K, f]
|
|
1843
1844
|
), qs = j(() => {
|
|
1844
1845
|
if (!G) return null;
|
|
1845
1846
|
const e = [];
|
|
1846
|
-
C && (X || O ||
|
|
1847
|
+
C && (X || O || M) && e.push(24), I && e.push(32), (O || M) && e.push(80), e.push(220);
|
|
1847
1848
|
let n = 0;
|
|
1848
1849
|
const t = [];
|
|
1849
1850
|
return e.forEach((r, i) => {
|
|
1850
1851
|
t.push(
|
|
1851
|
-
`.${
|
|
1852
|
+
`.${Kn} tr > *:nth-child(${i + 1}){position:sticky;left:${n}px;z-index:2;min-width:${r}px;max-width:${i === e.length - 1 ? 320 : r}px;background:hsl(var(--card, 0 0% 100%))}`
|
|
1852
1853
|
), n += r;
|
|
1853
|
-
}), t.push(`.${
|
|
1854
|
-
`.${
|
|
1854
|
+
}), t.push(`.${Kn} thead tr > *:nth-child(-n+${e.length}){z-index:3}`), t.push(
|
|
1855
|
+
`.${Kn} tr > *:nth-child(${e.length}){box-shadow:2px 0 0 0 rgba(100,116,139,0.18)}`
|
|
1855
1856
|
), t.join(`
|
|
1856
1857
|
`);
|
|
1857
1858
|
}, [
|
|
1858
1859
|
G,
|
|
1859
|
-
|
|
1860
|
+
Kn,
|
|
1860
1861
|
C,
|
|
1861
1862
|
X,
|
|
1862
1863
|
O,
|
|
1863
|
-
|
|
1864
|
+
M,
|
|
1864
1865
|
I
|
|
1865
1866
|
]), [dn, pa] = D(150), Es = be(null);
|
|
1866
1867
|
Ne(() => {
|
|
@@ -1874,7 +1875,7 @@ function qd({
|
|
|
1874
1875
|
);
|
|
1875
1876
|
return n.observe(e), () => n.disconnect();
|
|
1876
1877
|
}, [$.length, dn]);
|
|
1877
|
-
const ga = xr.join(","), ha =
|
|
1878
|
+
const ga = xr.join(","), ha = Al(
|
|
1878
1879
|
a,
|
|
1879
1880
|
xr,
|
|
1880
1881
|
!!ee && !O
|
|
@@ -2094,7 +2095,7 @@ function qd({
|
|
|
2094
2095
|
const r = e.field.slice(0, t), i = e.field.slice(t + 1), s = Ts(r, n, !1);
|
|
2095
2096
|
if (s.length === 0) return "—";
|
|
2096
2097
|
const d = (u = yr.get(r)) == null ? void 0 : u.get(i);
|
|
2097
|
-
if (!(d != null && d.one_collection) || !
|
|
2098
|
+
if (!(d != null && d.one_collection) || !ae) return Rn(e, n, !1);
|
|
2098
2099
|
const c = d.one_collection, l = s.map((m) => {
|
|
2099
2100
|
var h;
|
|
2100
2101
|
const p = m[i];
|
|
@@ -2105,7 +2106,7 @@ function qd({
|
|
|
2105
2106
|
{
|
|
2106
2107
|
type: "button",
|
|
2107
2108
|
onClick: (h) => {
|
|
2108
|
-
h.stopPropagation(),
|
|
2109
|
+
h.stopPropagation(), ae.open({ collection: c, itemId: m.id, title: m.label, width: "80%" });
|
|
2109
2110
|
},
|
|
2110
2111
|
className: "truncate text-left underline decoration-slate-300 decoration-dotted underline-offset-2 hover:text-[#172940] hover:decoration-nvr-cyan dark:hover:text-nvr-cyan",
|
|
2111
2112
|
children: m.label
|
|
@@ -2113,7 +2114,7 @@ function qd({
|
|
|
2113
2114
|
`${m.id}:${p}`
|
|
2114
2115
|
)) });
|
|
2115
2116
|
}
|
|
2116
|
-
const
|
|
2117
|
+
const Ke = wt && (_s.length > 0 || js.length > 0) ? [..._s, ...js] : _e, cn = be(null), [ba, li] = D(0), Ls = be(/* @__PURE__ */ new Map()), qt = be(0), Ms = 1e4, st = (e) => Ls.current.set(String(e), Date.now()), Pn = _e.map((e) => e.field).filter((e) => !e.includes(".")).join(","), kt = Lt(
|
|
2117
2118
|
(e) => {
|
|
2118
2119
|
const n = {};
|
|
2119
2120
|
for (const t of Pn ? Pn.split(",") : []) {
|
|
@@ -2128,7 +2129,7 @@ function qd({
|
|
|
2128
2129
|
return !0;
|
|
2129
2130
|
}, _r = (e, n) => {
|
|
2130
2131
|
const t = Ls.current.get(e);
|
|
2131
|
-
return !!t && n - t <
|
|
2132
|
+
return !!t && n - t < Ms;
|
|
2132
2133
|
};
|
|
2133
2134
|
Ne(() => {
|
|
2134
2135
|
if (O || tn || !Pn) return;
|
|
@@ -2140,7 +2141,7 @@ function qd({
|
|
|
2140
2141
|
let r = !1;
|
|
2141
2142
|
for (const i of Ge) {
|
|
2142
2143
|
const s = String(i.id);
|
|
2143
|
-
t.add(s), (_r(s, n) || !e.has(s) && n - qt.current <
|
|
2144
|
+
t.add(s), (_r(s, n) || !e.has(s) && n - qt.current < Ms) && (e.set(s, kt(i)), r = !0);
|
|
2144
2145
|
}
|
|
2145
2146
|
for (const i of [...e.keys()])
|
|
2146
2147
|
!t.has(i) && _r(i, n) && (e.delete(i), r = !0);
|
|
@@ -2164,7 +2165,7 @@ function qd({
|
|
|
2164
2165
|
return t.size === 0 && r.size === 0 && i.length === 0 ? null : { added: t, changed: r, removed: i, total: t.size + r.size + i.length };
|
|
2165
2166
|
}, [Ge, ba, Cr, O, kt]), xa = () => {
|
|
2166
2167
|
cn.current = new Map(Ge.map((e) => [String(e.id), kt(e)])), li((e) => e + 1);
|
|
2167
|
-
}, un = be(null), [kr,
|
|
2168
|
+
}, un = be(null), [kr, Ks] = D({}), Dn = j(() => {
|
|
2168
2169
|
const e = un.current, n = g == null ? void 0 : g.rowId;
|
|
2169
2170
|
if (!e || !n || e.rowId !== n || n === "new" || n.startsWith("pending:")) return [];
|
|
2170
2171
|
const t = Ge.find((s) => String(s.id) === n);
|
|
@@ -2182,12 +2183,12 @@ function qd({
|
|
|
2182
2183
|
const s = { ...kr }, d = {};
|
|
2183
2184
|
for (const c of Dn)
|
|
2184
2185
|
i && c.field !== i || (d[c.field] = c.theirs, s[c.field] = c.theirs, un.current && (un.current.snap[c.field] = c.theirs));
|
|
2185
|
-
yi(d),
|
|
2186
|
+
yi(d), Ks(s);
|
|
2186
2187
|
}, r = () => {
|
|
2187
2188
|
const i = { ...kr };
|
|
2188
2189
|
for (const s of Dn)
|
|
2189
2190
|
i[s.field] = s.theirs, un.current && (un.current.snap[s.field] = s.theirs);
|
|
2190
|
-
|
|
2191
|
+
Ks(i);
|
|
2191
2192
|
};
|
|
2192
2193
|
return /* @__PURE__ */ _(
|
|
2193
2194
|
"div",
|
|
@@ -2421,7 +2422,7 @@ function qd({
|
|
|
2421
2422
|
const i = /* @__PURE__ */ new Set();
|
|
2422
2423
|
if (Ln.has(n.field))
|
|
2423
2424
|
for (const c of [...$, ...L]) {
|
|
2424
|
-
const l =
|
|
2425
|
+
const l = Mn(n.field, c);
|
|
2425
2426
|
(l == null ? void 0 : l.id) != null && i.add(String(l.id));
|
|
2426
2427
|
}
|
|
2427
2428
|
const s = n.ids.filter((c) => !r.has(c) && !i.has(c));
|
|
@@ -2520,7 +2521,7 @@ function qd({
|
|
|
2520
2521
|
let Te = { [w]: ke[w] };
|
|
2521
2522
|
if (T && T.length > 0) {
|
|
2522
2523
|
const ie = await S.request(
|
|
2523
|
-
|
|
2524
|
+
Me("/field-rules/evaluate", {
|
|
2524
2525
|
collection: a,
|
|
2525
2526
|
data: V,
|
|
2526
2527
|
locks_only: !0,
|
|
@@ -2531,7 +2532,7 @@ function qd({
|
|
|
2531
2532
|
).catch(() => null), St = bi(w, V, ie == null ? void 0 : ie.expected);
|
|
2532
2533
|
for (const Tr of St) ke[Tr] = null;
|
|
2533
2534
|
const Xt = await S.request(
|
|
2534
|
-
|
|
2535
|
+
Me("/field-rules/evaluate", {
|
|
2535
2536
|
collection: a,
|
|
2536
2537
|
data: ke,
|
|
2537
2538
|
changed_field: w,
|
|
@@ -2557,7 +2558,7 @@ function qd({
|
|
|
2557
2558
|
});
|
|
2558
2559
|
for (const V of Ue) {
|
|
2559
2560
|
const ke = String(V.id), Te = await ue({ ...V, ...H.get(ke) ?? {} });
|
|
2560
|
-
if ((
|
|
2561
|
+
if ((M || O) && k)
|
|
2561
2562
|
k.queueEdit(a, f, ke, Te);
|
|
2562
2563
|
else if (!await S.request(bt(`/items/${a}/${ke}`, Te)).then(() => !0).catch(() => !1)) {
|
|
2563
2564
|
s++;
|
|
@@ -2567,13 +2568,13 @@ function qd({
|
|
|
2567
2568
|
(ie) => ie && ie.rowId === ke ? { ...ie, draft: de({ ...ie.draft, ...Te }) } : ie
|
|
2568
2569
|
);
|
|
2569
2570
|
}
|
|
2570
|
-
Ue.length && !((
|
|
2571
|
+
Ue.length && !((M || O) && k) && await B.invalidateQueries({
|
|
2571
2572
|
queryKey: ["o2m-rows", a, f, v]
|
|
2572
2573
|
});
|
|
2573
2574
|
}
|
|
2574
2575
|
const d = ((u = n[0]) == null ? void 0 : u.cfg.label) ?? "Value", c = ((p = N == null ? void 0 : N.fieldLabels) == null ? void 0 : p[((m = n[0]) == null ? void 0 : m.rule.parent_field) ?? ""]) ?? Le(((h = n[0]) == null ? void 0 : h.rule.parent_field) ?? "parent");
|
|
2575
2576
|
r && Se.message(
|
|
2576
|
-
`${d} switched to the default on ${r} ${r === 1 ? "line" : "lines"} — the previous one is not available for this ${c}${(
|
|
2577
|
+
`${d} switched to the default on ${r} ${r === 1 ? "line" : "lines"} — the previous one is not available for this ${c}${(M || O) && k ? " (saved with the record)" : ""}`
|
|
2577
2578
|
), (i || s) && Se.warning(
|
|
2578
2579
|
`${i + s} ${i + s === 1 ? "line" : "lines"} could not be switched — no matching default option${s ? " / save failed" : ""}`
|
|
2579
2580
|
);
|
|
@@ -2653,11 +2654,11 @@ function qd({
|
|
|
2653
2654
|
enabled: Wn.size > 0,
|
|
2654
2655
|
staleTime: 6e4
|
|
2655
2656
|
}), Sa = j(
|
|
2656
|
-
() =>
|
|
2657
|
+
() => oe != null && oe.unmatched_banner ? L.map((e) => de({ ...e })) : void 0,
|
|
2657
2658
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2658
|
-
[
|
|
2659
|
-
), Ot =
|
|
2660
|
-
config:
|
|
2659
|
+
[oe == null ? void 0 : oe.unmatched_banner, L]
|
|
2660
|
+
), Ot = Ll({
|
|
2661
|
+
config: oe,
|
|
2661
2662
|
rows: $,
|
|
2662
2663
|
stagedRows: Sa,
|
|
2663
2664
|
relatedCollection: a,
|
|
@@ -2670,13 +2671,13 @@ function qd({
|
|
|
2670
2671
|
async function Fs(e) {
|
|
2671
2672
|
if (!S || !(T != null && T.length) || O && L.length === 0) return;
|
|
2672
2673
|
ro(e ? "preview" : "apply");
|
|
2673
|
-
const n =
|
|
2674
|
+
const n = M && !!k, t = L.map((i, s) => ({ ...i, id: `pending:${s}` })), r = {};
|
|
2674
2675
|
if (k)
|
|
2675
2676
|
for (const [i, s] of k.getPendingEdits(a, f))
|
|
2676
2677
|
r[String(i)] = s;
|
|
2677
2678
|
try {
|
|
2678
2679
|
const s = (await S.request(
|
|
2679
|
-
|
|
2680
|
+
Me("/field-rules/apply", {
|
|
2680
2681
|
collection: a,
|
|
2681
2682
|
fk_field: f,
|
|
2682
2683
|
...O ? {} : { parent_id: v },
|
|
@@ -2720,7 +2721,7 @@ function qd({
|
|
|
2720
2721
|
}
|
|
2721
2722
|
if (d.length > 0) {
|
|
2722
2723
|
const l = await S.request(
|
|
2723
|
-
|
|
2724
|
+
Me("/field-rules/apply", {
|
|
2724
2725
|
collection: a,
|
|
2725
2726
|
fk_field: f,
|
|
2726
2727
|
parent_id: v,
|
|
@@ -2763,7 +2764,7 @@ function qd({
|
|
|
2763
2764
|
}
|
|
2764
2765
|
function Sr(e, n) {
|
|
2765
2766
|
!S || !T || T.length === 0 || S.request(
|
|
2766
|
-
|
|
2767
|
+
Me("/field-rules/evaluate", {
|
|
2767
2768
|
collection: a,
|
|
2768
2769
|
data: n,
|
|
2769
2770
|
locks_only: !0,
|
|
@@ -2848,7 +2849,7 @@ function qd({
|
|
|
2848
2849
|
dt.current.rowId !== t && (dt.current = { rowId: t, seqs: /* @__PURE__ */ new Map() });
|
|
2849
2850
|
const r = ++zr.current;
|
|
2850
2851
|
dt.current.seqs.set(e, r), S.request(
|
|
2851
|
-
|
|
2852
|
+
Me("/field-rules/evaluate", {
|
|
2852
2853
|
collection: a,
|
|
2853
2854
|
data: n.draft,
|
|
2854
2855
|
target_fields: [e],
|
|
@@ -2950,7 +2951,7 @@ function qd({
|
|
|
2950
2951
|
const c = It(), l = bi(e, (t == null ? void 0 : t.draft) ?? {}, t == null ? void 0 : t.expected), u = { ...s };
|
|
2951
2952
|
for (const m of l) u[m] = null;
|
|
2952
2953
|
S.request(
|
|
2953
|
-
|
|
2954
|
+
Me("/field-rules/evaluate", {
|
|
2954
2955
|
collection: a,
|
|
2955
2956
|
data: u,
|
|
2956
2957
|
changed_field: e,
|
|
@@ -2970,12 +2971,12 @@ function qd({
|
|
|
2970
2971
|
((s = Ye.current) == null ? void 0 : s.rowId) === e && Qe(null);
|
|
2971
2972
|
};
|
|
2972
2973
|
if (Je != null && Je.length) {
|
|
2973
|
-
const s = g.rowId.startsWith("pending:"), d = s ? parseInt(g.rowId.split(":")[1], 10) : null, c = g.rowId === "new" || s ? null : g.rowId, l =
|
|
2974
|
+
const s = g.rowId.startsWith("pending:"), d = s ? parseInt(g.rowId.split(":")[1], 10) : null, c = g.rowId === "new" || s ? null : g.rowId, l = Ki(g.draft, Je);
|
|
2974
2975
|
if ($.some((m) => {
|
|
2975
2976
|
if (String(m.id) === c || We.has(String(m.id))) return !1;
|
|
2976
2977
|
const p = H.has(String(m.id)) ? { ...m, ...H.get(String(m.id)) } : m;
|
|
2977
|
-
return
|
|
2978
|
-
}) || L.some((m, p) => p !== d &&
|
|
2978
|
+
return Ki(p, Je) === l;
|
|
2979
|
+
}) || L.some((m, p) => p !== d && Ki(m, Je) === l))
|
|
2979
2980
|
return Sn(`A row with the same ${Je.join(" + ")} already exists.`), !1;
|
|
2980
2981
|
}
|
|
2981
2982
|
const t = (s) => s == null || s === "", r = _e.filter(
|
|
@@ -3018,7 +3019,7 @@ function qd({
|
|
|
3018
3019
|
return k == null || k.updateRow(a, f, s, g.draft), d != null && d.__prefilled && (d == null ? void 0 : d.id) != null && Ia((c) => /* @__PURE__ */ new Set([...c, d.id])), n(), Nn(!1), !0;
|
|
3019
3020
|
}
|
|
3020
3021
|
if (g.rowId === "new") {
|
|
3021
|
-
if ((O ||
|
|
3022
|
+
if ((O || M) && k)
|
|
3022
3023
|
return k.queueRow(a, f, rn({ ...g.draft })), n(), !0;
|
|
3023
3024
|
const s = Object.entries(g.draft).filter(([p]) => p.startsWith("__m2m_")), d = Object.entries(g.draft).filter(([p]) => p.startsWith("__o2m_")), c = Object.fromEntries(
|
|
3024
3025
|
Object.entries(g.draft).filter(
|
|
@@ -3028,7 +3029,7 @@ function qd({
|
|
|
3028
3029
|
let u = null;
|
|
3029
3030
|
try {
|
|
3030
3031
|
u = await S.request(
|
|
3031
|
-
|
|
3032
|
+
Me(`/items/${a}${lt}`, l)
|
|
3032
3033
|
);
|
|
3033
3034
|
} catch (p) {
|
|
3034
3035
|
const h = $i(p);
|
|
@@ -3038,7 +3039,7 @@ function qd({
|
|
|
3038
3039
|
retry: async (b) => {
|
|
3039
3040
|
var x;
|
|
3040
3041
|
const w = await S.request(
|
|
3041
|
-
|
|
3042
|
+
Me(`/items/${a}${lt}`, {
|
|
3042
3043
|
...l,
|
|
3043
3044
|
_change_reason: b
|
|
3044
3045
|
})
|
|
@@ -3059,7 +3060,7 @@ function qd({
|
|
|
3059
3060
|
interface: "select-multiple-m2m"
|
|
3060
3061
|
});
|
|
3061
3062
|
return w ? S.request(
|
|
3062
|
-
|
|
3063
|
+
Me(`/items/${w.junctionCollection}`, {
|
|
3063
3064
|
[w.junctionManyField]: m,
|
|
3064
3065
|
[w.junctionOtherField]: h
|
|
3065
3066
|
})
|
|
@@ -3083,7 +3084,7 @@ function qd({
|
|
|
3083
3084
|
for (const V of ue)
|
|
3084
3085
|
try {
|
|
3085
3086
|
await S.request(
|
|
3086
|
-
|
|
3087
|
+
Me(`/items/${F.many_collection}`, {
|
|
3087
3088
|
...V,
|
|
3088
3089
|
[F.many_field]: m
|
|
3089
3090
|
})
|
|
@@ -3119,7 +3120,7 @@ function qd({
|
|
|
3119
3120
|
]), c = Object.fromEntries(
|
|
3120
3121
|
Object.entries(g.draft).filter(([l]) => d.has(l))
|
|
3121
3122
|
);
|
|
3122
|
-
if (
|
|
3123
|
+
if (M && k) {
|
|
3123
3124
|
const l = Object.entries(g.draft).filter(
|
|
3124
3125
|
([p]) => p.startsWith("__nested_ops_")
|
|
3125
3126
|
), u = $.find((p) => String(p.id) === g.rowId), m = u ? Object.fromEntries(
|
|
@@ -3160,8 +3161,8 @@ function qd({
|
|
|
3160
3161
|
Nn(!1);
|
|
3161
3162
|
}
|
|
3162
3163
|
}
|
|
3163
|
-
const [Oa, Ia] = D(/* @__PURE__ */ new Set()), [gt, Gs] = D(null), [jt, Xs] = D(null), [Aa, Zs] = D(!1), [Ht, ja] = D(1), [Yt, pn] = D(!1), [Cs, Ta] = D(!1), [xi, La] = D({}), [eo, to] = D(!1), [no, qr] = D(!1), [vi,
|
|
3164
|
-
function
|
|
3164
|
+
const [Oa, Ia] = D(/* @__PURE__ */ new Set()), [gt, Gs] = D(null), [jt, Xs] = D(null), [Aa, Zs] = D(!1), [Ht, ja] = D(1), [Yt, pn] = D(!1), [Cs, Ta] = D(!1), [xi, La] = D({}), [eo, to] = D(!1), [no, qr] = D(!1), [vi, Ma] = D("empty-only"), [Er, ro] = D(null), [Tt, gn] = D(null), [Gt, io] = D({}), [so, oo] = D(!1);
|
|
3165
|
+
function Ka(e, n) {
|
|
3165
3166
|
La((t) => ({ ...t, [e]: n }));
|
|
3166
3167
|
}
|
|
3167
3168
|
async function Ra() {
|
|
@@ -3171,7 +3172,7 @@ function qd({
|
|
|
3171
3172
|
oo(!0);
|
|
3172
3173
|
try {
|
|
3173
3174
|
if ($.length)
|
|
3174
|
-
if (
|
|
3175
|
+
if (M && k)
|
|
3175
3176
|
$.filter((n) => !We.has(String(n.id))).forEach(
|
|
3176
3177
|
(n) => k.queueEdit(a, f, String(n.id), Gt)
|
|
3177
3178
|
);
|
|
@@ -3198,7 +3199,7 @@ function qd({
|
|
|
3198
3199
|
const d = new Date(t.getFullYear(), t.getMonth() + 1 + s, 1), c = `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-01`;
|
|
3199
3200
|
return { ...zt, ...xi, [e]: c };
|
|
3200
3201
|
});
|
|
3201
|
-
if ((O ||
|
|
3202
|
+
if ((O || M) && k) {
|
|
3202
3203
|
for (const i of sn(r)) k.queueRow(a, f, i);
|
|
3203
3204
|
return;
|
|
3204
3205
|
}
|
|
@@ -3206,7 +3207,7 @@ function qd({
|
|
|
3206
3207
|
try {
|
|
3207
3208
|
for (const i of sn(r))
|
|
3208
3209
|
await S.request(
|
|
3209
|
-
|
|
3210
|
+
Me(`/items/${a}${lt}`, { ...i, [f]: v })
|
|
3210
3211
|
);
|
|
3211
3212
|
qt.current = Date.now(), B.invalidateQueries({ queryKey: ["o2m-rows", a, f, v] });
|
|
3212
3213
|
} catch {
|
|
@@ -3215,13 +3216,13 @@ function qd({
|
|
|
3215
3216
|
}
|
|
3216
3217
|
}
|
|
3217
3218
|
async function Da() {
|
|
3218
|
-
const e =
|
|
3219
|
+
const e = oe == null ? void 0 : oe.unmatched_banner;
|
|
3219
3220
|
if (!e || Ot.unmatchedCandidates.length === 0) return;
|
|
3220
3221
|
const n = Ot.unmatchedCandidates.map((t) => ({
|
|
3221
3222
|
...zt,
|
|
3222
|
-
...
|
|
3223
|
+
...Ml(e, t)
|
|
3223
3224
|
}));
|
|
3224
|
-
if ((O ||
|
|
3225
|
+
if ((O || M) && k) {
|
|
3225
3226
|
for (const t of sn(n)) k.queueRow(a, f, t);
|
|
3226
3227
|
return;
|
|
3227
3228
|
}
|
|
@@ -3229,7 +3230,7 @@ function qd({
|
|
|
3229
3230
|
try {
|
|
3230
3231
|
for (const t of sn(n))
|
|
3231
3232
|
await S.request(
|
|
3232
|
-
|
|
3233
|
+
Me(`/items/${a}${lt}`, { ...t, [f]: v })
|
|
3233
3234
|
);
|
|
3234
3235
|
qt.current = Date.now(), B.invalidateQueries({ queryKey: ["o2m-rows", a, f, v] });
|
|
3235
3236
|
} catch (t) {
|
|
@@ -3240,7 +3241,7 @@ function qd({
|
|
|
3240
3241
|
}
|
|
3241
3242
|
async function ao(e) {
|
|
3242
3243
|
const n = Math.max(1, Math.min(100, Ht)), t = e ? { ...zt, ...xi } : { ...zt };
|
|
3243
|
-
if ((O ||
|
|
3244
|
+
if ((O || M) && k) {
|
|
3244
3245
|
const r = sn(Array.from({ length: n }, () => ({ ...t })));
|
|
3245
3246
|
for (const i of r) k.queueRow(a, f, i);
|
|
3246
3247
|
return;
|
|
@@ -3249,7 +3250,7 @@ function qd({
|
|
|
3249
3250
|
try {
|
|
3250
3251
|
for (const r of sn(Array.from({ length: n }, () => ({ ...t }))))
|
|
3251
3252
|
await S.request(
|
|
3252
|
-
|
|
3253
|
+
Me(`/items/${a}${lt}`, { ...r, [f]: v })
|
|
3253
3254
|
);
|
|
3254
3255
|
qt.current = Date.now(), B.invalidateQueries({ queryKey: ["o2m-rows", a, f, v] });
|
|
3255
3256
|
} catch {
|
|
@@ -3274,10 +3275,10 @@ function qd({
|
|
|
3274
3275
|
const n = [...$], [t] = n.splice(gt, 1);
|
|
3275
3276
|
n.splice(jt, 0, t);
|
|
3276
3277
|
const r = n.map((i, s) => ({ row: i, newOrder: s })).filter(({ row: i, newOrder: s }) => {
|
|
3277
|
-
const d =
|
|
3278
|
+
const d = M ? H.get(String(i.id)) : void 0, c = (d == null ? void 0 : d[X]) ?? i[X];
|
|
3278
3279
|
return Number(c ?? -1) !== s;
|
|
3279
3280
|
});
|
|
3280
|
-
if (
|
|
3281
|
+
if (M && k) {
|
|
3281
3282
|
r.forEach(
|
|
3282
3283
|
({ row: i, newOrder: s }) => k.queueEdit(a, f, String(i.id), {
|
|
3283
3284
|
[X]: s
|
|
@@ -3302,7 +3303,7 @@ function qd({
|
|
|
3302
3303
|
async function wi(e, n) {
|
|
3303
3304
|
n.stopPropagation();
|
|
3304
3305
|
const t = e.id;
|
|
3305
|
-
if (
|
|
3306
|
+
if (M && k) {
|
|
3306
3307
|
k.queueDelete(a, f, String(t)), (g == null ? void 0 : g.rowId) === String(t) && Qe(null);
|
|
3307
3308
|
return;
|
|
3308
3309
|
}
|
|
@@ -3389,7 +3390,7 @@ function qd({
|
|
|
3389
3390
|
);
|
|
3390
3391
|
}
|
|
3391
3392
|
if (n == null) return /* @__PURE__ */ o("span", { className: "text-slate-300", children: "—" });
|
|
3392
|
-
if (e.interface === "relation-path" &&
|
|
3393
|
+
if (e.interface === "relation-path" && ae && t) {
|
|
3393
3394
|
const m = wo(e), p = (c = Oe == null ? void 0 : Oe.rows[t]) == null ? void 0 : c[e.field], h = Oe == null ? void 0 : Oe.targets[e.field];
|
|
3394
3395
|
if (m && p && h && p.ids.length > 0)
|
|
3395
3396
|
return /* @__PURE__ */ o(
|
|
@@ -3397,7 +3398,7 @@ function qd({
|
|
|
3397
3398
|
{
|
|
3398
3399
|
type: "button",
|
|
3399
3400
|
onClick: (b) => {
|
|
3400
|
-
b.stopPropagation(),
|
|
3401
|
+
b.stopPropagation(), ae.open({
|
|
3401
3402
|
collection: h,
|
|
3402
3403
|
itemId: p.ids[0],
|
|
3403
3404
|
layoutId: m.layout_id,
|
|
@@ -3415,14 +3416,14 @@ function qd({
|
|
|
3415
3416
|
const m = (l = mn[s.one_collection]) == null ? void 0 : l[String(n)];
|
|
3416
3417
|
if (!m && Na)
|
|
3417
3418
|
return /* @__PURE__ */ o(xn, { className: "h-3 w-3 animate-spin text-slate-300" });
|
|
3418
|
-
const p =
|
|
3419
|
+
const p = ae ? wo(e) : null, h = n != null && ((u = gi.get(e.field)) == null ? void 0 : u.has(String(n))) === !0;
|
|
3419
3420
|
let b;
|
|
3420
|
-
return p &&
|
|
3421
|
+
return p && ae ? b = /* @__PURE__ */ o(
|
|
3421
3422
|
"button",
|
|
3422
3423
|
{
|
|
3423
3424
|
type: "button",
|
|
3424
3425
|
onClick: (w) => {
|
|
3425
|
-
w.stopPropagation(),
|
|
3426
|
+
w.stopPropagation(), ae.open({
|
|
3426
3427
|
collection: s.one_collection,
|
|
3427
3428
|
itemId: String(n),
|
|
3428
3429
|
layoutId: p.layout_id,
|
|
@@ -3433,7 +3434,7 @@ function qd({
|
|
|
3433
3434
|
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",
|
|
3434
3435
|
children: m ?? String(n)
|
|
3435
3436
|
}
|
|
3436
|
-
) : b = /* @__PURE__ */ o("span", { className: "block truncate", children: m ?? String(n) }), h ? /* @__PURE__ */ o(
|
|
3437
|
+
) : b = /* @__PURE__ */ o("span", { className: "block truncate", children: m ?? String(n) }), h ? /* @__PURE__ */ o(Wl, { children: b }) : b;
|
|
3437
3438
|
}
|
|
3438
3439
|
if (e.type === "boolean")
|
|
3439
3440
|
return /* @__PURE__ */ o("span", { className: n ? "text-emerald-600" : "text-slate-400", children: n ? "Yes" : "No" });
|
|
@@ -3485,7 +3486,7 @@ function qd({
|
|
|
3485
3486
|
}
|
|
3486
3487
|
if (es || !O && tn)
|
|
3487
3488
|
return /* @__PURE__ */ o("div", { className: "py-3 text-center text-[12px] text-slate-400", children: /* @__PURE__ */ o(xn, { className: "h-4 w-4 animate-spin inline" }) });
|
|
3488
|
-
const Or = (g == null ? void 0 : g.rowId) === "new", ot = Ct && je === "original" && !A, Nt = (ot ? 1 : 0) + (C && (X || O ||
|
|
3489
|
+
const Or = (g == null ? void 0 : g.rowId) === "new", ot = Ct && je === "original" && !A, Nt = (ot ? 1 : 0) + (C && (X || O || M) ? 1 : 0) + (I ? 1 : 0) + (O || M ? 1 : 0) + Ke.length + 1, Jn = ot ? "select" : C && (X || M) ? "reorder" : I ? "num" : M ? "status" : "data", zn = (e) => {
|
|
3489
3490
|
if (!Et) return null;
|
|
3490
3491
|
const n = Et.added.has(e) ? "bg-emerald-500" : Et.changed.has(e) ? "bg-amber-500" : null;
|
|
3491
3492
|
return n ? /* @__PURE__ */ o(
|
|
@@ -3522,7 +3523,7 @@ function qd({
|
|
|
3522
3523
|
const n = ((t = Qn().find((r) => r.key === e.rowId)) == null ? void 0 : t.row) ?? {};
|
|
3523
3524
|
for (const [r, i] of Object.entries(e.draft)) {
|
|
3524
3525
|
if (r.startsWith("__")) {
|
|
3525
|
-
if ((Array.isArray(i) ? i.length > 0 : i != null && typeof i == "object") && JSON.stringify(i) !== JSON.stringify(
|
|
3526
|
+
if ((Array.isArray(i) ? i.length > 0 : i != null && typeof i == "object") && JSON.stringify(i) !== JSON.stringify(Mr))
|
|
3526
3527
|
return !0;
|
|
3527
3528
|
continue;
|
|
3528
3529
|
}
|
|
@@ -3583,7 +3584,7 @@ function qd({
|
|
|
3583
3584
|
if (T != null && T.length) {
|
|
3584
3585
|
try {
|
|
3585
3586
|
const y = await S.request(
|
|
3586
|
-
|
|
3587
|
+
Me("/field-rules/evaluate", {
|
|
3587
3588
|
collection: a,
|
|
3588
3589
|
data: p.row,
|
|
3589
3590
|
locks_only: !0,
|
|
@@ -3602,7 +3603,7 @@ function qd({
|
|
|
3602
3603
|
for (const ue of J) Q[ue] = null;
|
|
3603
3604
|
try {
|
|
3604
3605
|
const ue = await S.request(
|
|
3605
|
-
|
|
3606
|
+
Me("/field-rules/evaluate", {
|
|
3606
3607
|
collection: a,
|
|
3607
3608
|
data: Q,
|
|
3608
3609
|
changed_field: y,
|
|
@@ -3633,7 +3634,7 @@ function qd({
|
|
|
3633
3634
|
`Applied to ${p} ${b} — ${h.length} failed: ${h.slice(0, 3).join("; ")}`
|
|
3634
3635
|
) : Se.success(`Applied to ${p} ${b}`);
|
|
3635
3636
|
};
|
|
3636
|
-
if ((O ||
|
|
3637
|
+
if ((O || M) && k) {
|
|
3637
3638
|
let p = 0;
|
|
3638
3639
|
for (const { t: h, changes: b } of d)
|
|
3639
3640
|
Object.keys(b).length !== 0 && (h.kind === "pending" ? k.updateRow(a, f, h.idx, {
|
|
@@ -3683,14 +3684,14 @@ function qd({
|
|
|
3683
3684
|
const e = tr.current;
|
|
3684
3685
|
tr.current = null, window.setTimeout(() => void Wr.current(e.target, e.value), 0);
|
|
3685
3686
|
}
|
|
3686
|
-
const at = ve ? "split" :
|
|
3687
|
+
const at = ve ? "split" : Ke.filter((e) => !it(e)).length >= 6 ? "panel" : "inline", Ir = (e) => {
|
|
3687
3688
|
const n = ai == null ? void 0 : ai.display_template;
|
|
3688
3689
|
if (n) {
|
|
3689
3690
|
const t = Vn(n, e).trim();
|
|
3690
3691
|
if (t && t !== "-" && t !== String(e.id ?? ""))
|
|
3691
3692
|
return t.length > 60 ? `${t.slice(0, 60)}…` : t;
|
|
3692
3693
|
}
|
|
3693
|
-
for (const t of
|
|
3694
|
+
for (const t of Ke) {
|
|
3694
3695
|
if (it(t)) continue;
|
|
3695
3696
|
const r = e[t.field];
|
|
3696
3697
|
if (typeof r == "string" && r.trim() !== "" && !/^-?\d+(\.\d+)?$/.test(r.trim()))
|
|
@@ -3699,7 +3700,7 @@ function qd({
|
|
|
3699
3700
|
return e.id != null ? `#${e.id}` : "New line";
|
|
3700
3701
|
}, Fn = (e, n) => {
|
|
3701
3702
|
const t = (n == null ? void 0 : n.rowKey) ?? "__new__", r = { ...e };
|
|
3702
|
-
for (const i of
|
|
3703
|
+
for (const i of Ke) {
|
|
3703
3704
|
if (i.computed_type !== "rollup" || !i.computed_formula) continue;
|
|
3704
3705
|
let s = null;
|
|
3705
3706
|
try {
|
|
@@ -3721,9 +3722,9 @@ function qd({
|
|
|
3721
3722
|
}
|
|
3722
3723
|
d != null && (r[i.field] = d);
|
|
3723
3724
|
}
|
|
3724
|
-
for (const i of
|
|
3725
|
+
for (const i of Ke)
|
|
3725
3726
|
if (i.computed_type === "write" && i.computed_formula) {
|
|
3726
|
-
const s =
|
|
3727
|
+
const s = Kt(i.computed_formula, r);
|
|
3727
3728
|
s != null && (r[i.field] = s);
|
|
3728
3729
|
}
|
|
3729
3730
|
return r;
|
|
@@ -3748,14 +3749,14 @@ function qd({
|
|
|
3748
3749
|
matchSeed: (d == null ? void 0 : d.seed) ?? {},
|
|
3749
3750
|
// #735 — a saved line in a pending grid stages its matched
|
|
3750
3751
|
// rows with the line's queued edit, like the FK mode.
|
|
3751
|
-
...e &&
|
|
3752
|
+
...e && M ? {
|
|
3752
3753
|
deferred: !0,
|
|
3753
|
-
stagedOps: n[`__nested_ops_${r}`] ??
|
|
3754
|
+
stagedOps: n[`__nested_ops_${r}`] ?? Mr,
|
|
3754
3755
|
onStagedOpsChange: (c) => ft(`__nested_ops_${r}`, c)
|
|
3755
3756
|
} : {}
|
|
3756
|
-
} : e ?
|
|
3757
|
+
} : e ? M ? {
|
|
3757
3758
|
deferred: !0,
|
|
3758
|
-
stagedOps: n[`__nested_ops_${r}`] ??
|
|
3759
|
+
stagedOps: n[`__nested_ops_${r}`] ?? Mr,
|
|
3759
3760
|
onStagedOpsChange: (c) => ft(`__nested_ops_${r}`, c)
|
|
3760
3761
|
} : {} : {
|
|
3761
3762
|
// UNSAVED row: members stage under __o2m_<field> in the
|
|
@@ -3814,7 +3815,7 @@ function qd({
|
|
|
3814
3815
|
(() => {
|
|
3815
3816
|
const t = [
|
|
3816
3817
|
..._e.filter(jr),
|
|
3817
|
-
...
|
|
3818
|
+
...Ke.filter((r) => it(r))
|
|
3818
3819
|
];
|
|
3819
3820
|
return t.length > 0 && (() => {
|
|
3820
3821
|
const r = Fn(e.draft, { rowKey: e.rowId ?? "__new__" });
|
|
@@ -3848,7 +3849,7 @@ function qd({
|
|
|
3848
3849
|
{
|
|
3849
3850
|
className: "grid items-start gap-x-4 gap-y-3",
|
|
3850
3851
|
style: { gridTemplateColumns: "repeat(auto-fit, minmax(240px, 1fr))" },
|
|
3851
|
-
children:
|
|
3852
|
+
children: Ke.filter((t) => !jr(t)).map((t) => {
|
|
3852
3853
|
var c, l, u;
|
|
3853
3854
|
const r = t.computed_type === "write" && !!t.computed_formula, i = t.label || Le(t.field), s = t.interface === "formula-column" || t.interface === "match-agg-column" || t.interface === "relation-path";
|
|
3854
3855
|
if (it(t))
|
|
@@ -3888,7 +3889,7 @@ function qd({
|
|
|
3888
3889
|
return ((J = _e.find((Q) => Q.field === y)) == null ? void 0 : J.label) ?? y.replace(/_/g, " ");
|
|
3889
3890
|
};
|
|
3890
3891
|
return /* @__PURE__ */ o(
|
|
3891
|
-
|
|
3892
|
+
Pl,
|
|
3892
3893
|
{
|
|
3893
3894
|
kind: m,
|
|
3894
3895
|
provenance: (w = g == null ? void 0 : g.provenance) == null ? void 0 : w[t.field],
|
|
@@ -3903,7 +3904,7 @@ function qd({
|
|
|
3903
3904
|
),
|
|
3904
3905
|
r ? /* @__PURE__ */ o("div", { className: "text-[12px] italic text-slate-500", children: De(
|
|
3905
3906
|
t,
|
|
3906
|
-
|
|
3907
|
+
Kt(t.computed_formula, e.draft) ?? e.draft[t.field]
|
|
3907
3908
|
) }) : s || t.readonly || (l = g == null ? void 0 : g.locks) != null && l.includes(t.field) || ii(t.field, e.draft) ? /* @__PURE__ */ o(
|
|
3908
3909
|
"div",
|
|
3909
3910
|
{
|
|
@@ -3934,11 +3935,11 @@ function qd({
|
|
|
3934
3935
|
collection: a,
|
|
3935
3936
|
itemId: e.rowId ?? "new",
|
|
3936
3937
|
cascadeFilter: rt[t.field],
|
|
3937
|
-
pinnedOption:
|
|
3938
|
+
pinnedOption: Mn(t.field, e.draft)
|
|
3938
3939
|
}
|
|
3939
3940
|
),
|
|
3940
3941
|
q && q.columns.includes(t.field) && (() => {
|
|
3941
|
-
const m = Oi(q, e.draft), p = m == null ? void 0 : m.values[t.field], h =
|
|
3942
|
+
const m = Oi(q, e.draft), p = m == null ? void 0 : m.values[t.field], h = Mt(
|
|
3942
3943
|
q,
|
|
3943
3944
|
e.draft[q.key_field],
|
|
3944
3945
|
t.field
|
|
@@ -3963,7 +3964,7 @@ function qd({
|
|
|
3963
3964
|
}
|
|
3964
3965
|
),
|
|
3965
3966
|
h && !A && /* @__PURE__ */ o(
|
|
3966
|
-
|
|
3967
|
+
$l,
|
|
3967
3968
|
{
|
|
3968
3969
|
data: q,
|
|
3969
3970
|
rowKey: e.draft[q.key_field],
|
|
@@ -3987,7 +3988,7 @@ function qd({
|
|
|
3987
3988
|
}
|
|
3988
3989
|
),
|
|
3989
3990
|
he && ((n = he.fields) == null ? void 0 : n.length) > 0 && !A && /* @__PURE__ */ o(
|
|
3990
|
-
|
|
3991
|
+
Hl,
|
|
3991
3992
|
{
|
|
3992
3993
|
config: he,
|
|
3993
3994
|
draft: e.draft,
|
|
@@ -3995,7 +3996,7 @@ function qd({
|
|
|
3995
3996
|
onApply: yi,
|
|
3996
3997
|
closedFields: q ? new Set(
|
|
3997
3998
|
he.fields.filter(
|
|
3998
|
-
(t) =>
|
|
3999
|
+
(t) => Mt(q, e.draft[q.key_field], t)
|
|
3999
4000
|
)
|
|
4000
4001
|
) : void 0,
|
|
4001
4002
|
shapeSource: (() => {
|
|
@@ -4014,7 +4015,7 @@ function qd({
|
|
|
4014
4015
|
})()
|
|
4015
4016
|
}
|
|
4016
4017
|
),
|
|
4017
|
-
|
|
4018
|
+
oe && e.rowId && !e.rowId.startsWith("pending:") && e.rowId !== "new" && /* @__PURE__ */ o(Kl, { config: oe, result: Ot.byRow.get(e.rowId) }),
|
|
4018
4019
|
e.drawer
|
|
4019
4020
|
]
|
|
4020
4021
|
}
|
|
@@ -4157,7 +4158,7 @@ function qd({
|
|
|
4157
4158
|
);
|
|
4158
4159
|
})(),
|
|
4159
4160
|
Be && (!O || k) && /* @__PURE__ */ o(
|
|
4160
|
-
|
|
4161
|
+
Fl,
|
|
4161
4162
|
{
|
|
4162
4163
|
config: Be,
|
|
4163
4164
|
relatedCollection: a,
|
|
@@ -4173,7 +4174,7 @@ function qd({
|
|
|
4173
4174
|
e ? st(e) : qt.current = Date.now();
|
|
4174
4175
|
},
|
|
4175
4176
|
staging: k,
|
|
4176
|
-
stagingActive: (O ||
|
|
4177
|
+
stagingActive: (O || M) && !!k,
|
|
4177
4178
|
pendingRows: L,
|
|
4178
4179
|
pendingEdits: H,
|
|
4179
4180
|
pendingDeletes: We
|
|
@@ -4184,7 +4185,7 @@ function qd({
|
|
|
4184
4185
|
(n) => typeof n == "object" && n.field === tt.relation && !!n.match
|
|
4185
4186
|
);
|
|
4186
4187
|
return e != null && e.match ? /* @__PURE__ */ o(
|
|
4187
|
-
|
|
4188
|
+
Bl,
|
|
4188
4189
|
{
|
|
4189
4190
|
config: tt,
|
|
4190
4191
|
matchCfg: e.match,
|
|
@@ -4197,7 +4198,7 @@ function qd({
|
|
|
4197
4198
|
) : null;
|
|
4198
4199
|
})(),
|
|
4199
4200
|
(ze ?? []).map((e) => /* @__PURE__ */ o(
|
|
4200
|
-
|
|
4201
|
+
Vl,
|
|
4201
4202
|
{
|
|
4202
4203
|
config: e,
|
|
4203
4204
|
rows: [...$, ...L.map((n, t) => ({ ...n, __pendingIndex: t }))],
|
|
@@ -4210,7 +4211,7 @@ function qd({
|
|
|
4210
4211
|
return;
|
|
4211
4212
|
}
|
|
4212
4213
|
const i = String(n.id);
|
|
4213
|
-
if (
|
|
4214
|
+
if (M && k) {
|
|
4214
4215
|
k.queueEdit(a, f, i, t);
|
|
4215
4216
|
return;
|
|
4216
4217
|
}
|
|
@@ -4222,7 +4223,7 @@ function qd({
|
|
|
4222
4223
|
e.label
|
|
4223
4224
|
)),
|
|
4224
4225
|
Rt && !O && !A && Dt && E && /* @__PURE__ */ o(
|
|
4225
|
-
|
|
4226
|
+
ml,
|
|
4226
4227
|
{
|
|
4227
4228
|
collection: E,
|
|
4228
4229
|
templateFilter: (e) => {
|
|
@@ -4285,7 +4286,7 @@ function qd({
|
|
|
4285
4286
|
}
|
|
4286
4287
|
),
|
|
4287
4288
|
he && ((bo = he.fields) == null ? void 0 : bo.length) > 0 && he.across_rows !== !1 && $.length + L.length > 1 && /* @__PURE__ */ o(
|
|
4288
|
-
|
|
4289
|
+
Yl,
|
|
4289
4290
|
{
|
|
4290
4291
|
config: he,
|
|
4291
4292
|
remaining: mt(he.remaining, Qt),
|
|
@@ -4316,7 +4317,7 @@ function qd({
|
|
|
4316
4317
|
"aria-pressed": Ct,
|
|
4317
4318
|
"data-tip": Ct ? "Hide the selection checkboxes" : "Tick rows to edit several lines at once",
|
|
4318
4319
|
onClick: () => {
|
|
4319
|
-
|
|
4320
|
+
Ko((e) => !e), nr(/* @__PURE__ */ new Set());
|
|
4320
4321
|
},
|
|
4321
4322
|
className: ye(
|
|
4322
4323
|
"inline-flex h-6 items-center gap-1 rounded border px-2 transition-colors",
|
|
@@ -4360,7 +4361,7 @@ function qd({
|
|
|
4360
4361
|
),
|
|
4361
4362
|
Yt && /* @__PURE__ */ o(xn, { className: "h-3 w-3 animate-spin text-slate-400" }),
|
|
4362
4363
|
(() => {
|
|
4363
|
-
if (!((O ||
|
|
4364
|
+
if (!((O || M) && !!k))
|
|
4364
4365
|
return /* @__PURE__ */ _(
|
|
4365
4366
|
"span",
|
|
4366
4367
|
{
|
|
@@ -4454,7 +4455,7 @@ function qd({
|
|
|
4454
4455
|
/* @__PURE__ */ _("p", { className: "text-[11px] text-slate-500", children: [
|
|
4455
4456
|
"Rules edited after these lines were created never touched them. Preview first — nothing is written until you",
|
|
4456
4457
|
" ",
|
|
4457
|
-
|
|
4458
|
+
M && k ? "stage them: staged lines show as Edited and land with Save." : "apply, and every applied change lands in each line’s history."
|
|
4458
4459
|
] }),
|
|
4459
4460
|
/* @__PURE__ */ _("div", { className: "flex flex-wrap items-center gap-3 text-[11px]", children: [
|
|
4460
4461
|
[
|
|
@@ -4481,7 +4482,7 @@ function qd({
|
|
|
4481
4482
|
name: `rerun-mode-${f}`,
|
|
4482
4483
|
checked: vi === e,
|
|
4483
4484
|
onChange: () => {
|
|
4484
|
-
|
|
4485
|
+
Ma(e), gn(null);
|
|
4485
4486
|
},
|
|
4486
4487
|
className: "accent-nvr-cyan"
|
|
4487
4488
|
}
|
|
@@ -4508,7 +4509,7 @@ function qd({
|
|
|
4508
4509
|
disabled: Er !== null,
|
|
4509
4510
|
onClick: () => void Fs(!1),
|
|
4510
4511
|
className: "h-7 rounded bg-nvr-cyan px-3 text-[11px] font-medium text-white hover:brightness-110 disabled:opacity-50",
|
|
4511
|
-
children: Er === "apply" ?
|
|
4512
|
+
children: Er === "apply" ? M && k ? "Staging…" : "Applying…" : `${M && k ? "Stage for" : "Apply to"} ${Tt.changes.length} ${Tt.changes.length === 1 ? "line" : "lines"}`
|
|
4512
4513
|
}
|
|
4513
4514
|
)
|
|
4514
4515
|
] }),
|
|
@@ -4527,9 +4528,9 @@ function qd({
|
|
|
4527
4528
|
Tt.truncated && /* @__PURE__ */ o("li", { className: "text-amber-700", children: "Preview shows the first 200 lines." })
|
|
4528
4529
|
] }) })
|
|
4529
4530
|
] }),
|
|
4530
|
-
(
|
|
4531
|
+
(oe == null ? void 0 : oe.unmatched_banner) && !A && Ot.unmatchedCandidates.length > 0 && (() => {
|
|
4531
4532
|
var d, c, l, u, m, p, h, b;
|
|
4532
|
-
const e = Ot.unmatchedCandidates.length, n = ((d =
|
|
4533
|
+
const e = Ot.unmatchedCandidates.length, n = ((d = oe.unmatched_banner) == null ? void 0 : d.label) ?? "related line", t = e === 1 ? n : `${n}s`, r = ((c = oe.candidates) == null ? void 0 : c.primary) ?? ((m = (u = (l = oe.candidates) == null ? void 0 : l.keys) == null ? void 0 : u[0]) == null ? void 0 : m.row), i = (b = (h = (p = oe.candidates) == null ? void 0 : p.keys) == null ? void 0 : h.find(
|
|
4533
4534
|
(w) => w.row === r
|
|
4534
4535
|
)) == null ? void 0 : b.candidate, s = i ? Ot.unmatchedCandidates.map((w) => String(w[i] ?? "")).filter(Boolean).slice(0, 8) : [];
|
|
4535
4536
|
return /* @__PURE__ */ _("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-1 rounded-lg border border-amber-200 bg-amber-50/60 px-3 py-2 text-[11px] text-amber-800 dark:border-amber-500/40 dark:bg-amber-500/10 dark:text-amber-200", children: [
|
|
@@ -4559,7 +4560,7 @@ function qd({
|
|
|
4559
4560
|
disabled: Yt,
|
|
4560
4561
|
onClick: () => void Da(),
|
|
4561
4562
|
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",
|
|
4562
|
-
"data-tip": O ||
|
|
4563
|
+
"data-tip": O || M ? "Stages one row per missing line — saved with the record" : "Adds one row per missing line now",
|
|
4563
4564
|
children: Yt ? "Adding…" : `Add ${e === 1 ? "it" : `all ${e}`} as ${e === 1 ? "a row" : "rows"}`
|
|
4564
4565
|
}
|
|
4565
4566
|
)
|
|
@@ -4623,7 +4624,7 @@ function qd({
|
|
|
4623
4624
|
/* @__PURE__ */ o("div", { className: "h-8 rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))] animate-pulse" })
|
|
4624
4625
|
] }),
|
|
4625
4626
|
!A && hs.length > 0 && /* @__PURE__ */ o(
|
|
4626
|
-
|
|
4627
|
+
_l,
|
|
4627
4628
|
{
|
|
4628
4629
|
proposals: hs,
|
|
4629
4630
|
onApply: ca,
|
|
@@ -4631,9 +4632,9 @@ function qd({
|
|
|
4631
4632
|
}
|
|
4632
4633
|
),
|
|
4633
4634
|
(ti && ti.length > 0 || Re && !O && (q || ms || ps)) && /* @__PURE__ */ _("div", { "data-o2m-stats": !0, className: "mb-2 flex flex-wrap items-stretch gap-1.5", children: [
|
|
4634
|
-
/* @__PURE__ */ o(
|
|
4635
|
+
/* @__PURE__ */ o(kl, { data: q, loading: ms, error: ps }),
|
|
4635
4636
|
(ti ?? []).map((e) => /* @__PURE__ */ o(
|
|
4636
|
-
|
|
4637
|
+
Nl,
|
|
4637
4638
|
{
|
|
4638
4639
|
label: e.label,
|
|
4639
4640
|
value: e.result,
|
|
@@ -4658,7 +4659,7 @@ function qd({
|
|
|
4658
4659
|
/* @__PURE__ */ _(
|
|
4659
4660
|
"table",
|
|
4660
4661
|
{
|
|
4661
|
-
className: G ? `w-full min-w-max ${
|
|
4662
|
+
className: G ? `w-full min-w-max ${Kn}` : "w-full table-fixed",
|
|
4662
4663
|
children: [
|
|
4663
4664
|
/* @__PURE__ */ o("thead", { className: "bg-slate-50 border-b border-slate-200 [&>tr>th:first-child]:rounded-tl-lg [&>tr>th:last-child]:rounded-tr-lg", children: /* @__PURE__ */ _("tr", { children: [
|
|
4664
4665
|
ot && /* @__PURE__ */ o("th", { className: "w-7 px-1.5 py-2 align-middle", children: /* @__PURE__ */ o(
|
|
@@ -4671,10 +4672,10 @@ function qd({
|
|
|
4671
4672
|
onChange: (e) => nr(e.target.checked ? new Set(_i) : /* @__PURE__ */ new Set())
|
|
4672
4673
|
}
|
|
4673
4674
|
) }),
|
|
4674
|
-
C && (X || O ||
|
|
4675
|
+
C && (X || O || M) && /* @__PURE__ */ o("th", { className: "w-6" }),
|
|
4675
4676
|
I && /* @__PURE__ */ o("th", { className: "w-8 px-2 py-2 text-left font-medium text-slate-400 text-[11px]", children: "#" }),
|
|
4676
|
-
(O ||
|
|
4677
|
-
|
|
4677
|
+
(O || M) && /* @__PURE__ */ o("th", { className: "px-3 py-2 text-left font-medium text-slate-400 text-[11px] w-20", children: "Status" }),
|
|
4678
|
+
Ke.map((e) => /* @__PURE__ */ o(
|
|
4678
4679
|
"th",
|
|
4679
4680
|
{
|
|
4680
4681
|
className: "px-3 py-2 text-left font-medium text-slate-500 text-[11px]",
|
|
@@ -4687,9 +4688,9 @@ function qd({
|
|
|
4687
4688
|
/* @__PURE__ */ _("tbody", { children: [
|
|
4688
4689
|
Cs && /* @__PURE__ */ _("tr", { className: "border-b border-nvr-cyan/20 bg-nvr-cyan/5", children: [
|
|
4689
4690
|
ot && /* @__PURE__ */ o("td", { className: "w-7" }),
|
|
4690
|
-
C && (X || O ||
|
|
4691
|
+
C && (X || O || M) && /* @__PURE__ */ o("td", { className: "w-6" }),
|
|
4691
4692
|
I && /* @__PURE__ */ o("td", { className: "w-8" }),
|
|
4692
|
-
(O ||
|
|
4693
|
+
(O || M) && /* @__PURE__ */ o("td", { className: "px-3 py-0.5 align-middle w-20", children: /* @__PURE__ */ o("span", { className: "text-[10px] font-medium uppercase tracking-wide text-slate-500 dark:text-muted-foreground", children: "Defaults" }) }),
|
|
4693
4694
|
zs.map((e) => /* @__PURE__ */ o(
|
|
4694
4695
|
"td",
|
|
4695
4696
|
{
|
|
@@ -4699,7 +4700,7 @@ function qd({
|
|
|
4699
4700
|
{
|
|
4700
4701
|
field: e,
|
|
4701
4702
|
value: xi[e.field] ?? null,
|
|
4702
|
-
onChange: (n) =>
|
|
4703
|
+
onChange: (n) => Ka(e.field, n),
|
|
4703
4704
|
relations: Pe,
|
|
4704
4705
|
collection: a,
|
|
4705
4706
|
itemId: "new"
|
|
@@ -4818,7 +4819,7 @@ function qd({
|
|
|
4818
4819
|
]
|
|
4819
4820
|
}
|
|
4820
4821
|
),
|
|
4821
|
-
C && (X ||
|
|
4822
|
+
C && (X || M) && /* @__PURE__ */ _(
|
|
4822
4823
|
"td",
|
|
4823
4824
|
{
|
|
4824
4825
|
className: "relative w-6 px-1 align-middle",
|
|
@@ -4833,11 +4834,11 @@ function qd({
|
|
|
4833
4834
|
Jn === "num" && zn(t),
|
|
4834
4835
|
/* @__PURE__ */ _("span", { className: "inline-flex items-center gap-1", children: [
|
|
4835
4836
|
n + 1,
|
|
4836
|
-
|
|
4837
|
+
oe && /* @__PURE__ */ o(
|
|
4837
4838
|
$o,
|
|
4838
4839
|
{
|
|
4839
4840
|
result: Ot.byRow.get(t),
|
|
4840
|
-
title:
|
|
4841
|
+
title: oe.title
|
|
4841
4842
|
}
|
|
4842
4843
|
),
|
|
4843
4844
|
ur(t) && /* @__PURE__ */ o(
|
|
@@ -4869,13 +4870,13 @@ function qd({
|
|
|
4869
4870
|
})()
|
|
4870
4871
|
] })
|
|
4871
4872
|
] }),
|
|
4872
|
-
|
|
4873
|
+
M && /* @__PURE__ */ _("td", { className: "relative px-3 py-1 align-middle w-20", children: [
|
|
4873
4874
|
Jn === "status" && zn(t),
|
|
4874
|
-
!I &&
|
|
4875
|
+
!I && oe && /* @__PURE__ */ o(
|
|
4875
4876
|
$o,
|
|
4876
4877
|
{
|
|
4877
4878
|
result: Ot.byRow.get(t),
|
|
4878
|
-
title:
|
|
4879
|
+
title: oe.title
|
|
4879
4880
|
}
|
|
4880
4881
|
),
|
|
4881
4882
|
!I && ur(t) && /* @__PURE__ */ o(
|
|
@@ -4917,11 +4918,11 @@ function qd({
|
|
|
4917
4918
|
drawer: Ar(t, (g == null ? void 0 : g.draft) ?? b)
|
|
4918
4919
|
}) : (() => {
|
|
4919
4920
|
const x = Fn(b, { rowKey: t });
|
|
4920
|
-
return
|
|
4921
|
+
return Ke.map((y, J) => {
|
|
4921
4922
|
var V, ke, Te;
|
|
4922
4923
|
if (it(y))
|
|
4923
4924
|
return /* @__PURE__ */ o("td", { className: "px-2 py-1 align-top", children: /* @__PURE__ */ o("div", { className: "py-0.5 overflow-hidden text-slate-500", children: wr(y, b) }) }, y.field);
|
|
4924
|
-
const Q = y.computed_type === "write" && !!y.computed_formula, ue = Q ?
|
|
4925
|
+
const Q = y.computed_type === "write" && !!y.computed_formula, ue = Q ? Kt(
|
|
4925
4926
|
y.computed_formula,
|
|
4926
4927
|
c ? (g == null ? void 0 : g.draft) ?? b : b
|
|
4927
4928
|
) ?? b[y.field] : null, F = P && !c && !h ? (V = Br[t]) == null ? void 0 : V[y.field] : void 0, Ue = F ? `${y.label || Le(y.field)} · changed ${_o(F.at)} by ${F.who}${F.reason ? `
|
|
@@ -4932,13 +4933,13 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
4932
4933
|
className: ye(
|
|
4933
4934
|
"px-2 py-1 align-top",
|
|
4934
4935
|
(F || J === 0 && Jn === "data") && "relative",
|
|
4935
|
-
q &&
|
|
4936
|
+
q && Mt(
|
|
4936
4937
|
q,
|
|
4937
4938
|
b[q.key_field],
|
|
4938
4939
|
y.field
|
|
4939
4940
|
) && "bg-slate-50/80 dark:bg-white/[0.035]"
|
|
4940
4941
|
),
|
|
4941
|
-
"data-compare-closed": q &&
|
|
4942
|
+
"data-compare-closed": q && Mt(
|
|
4942
4943
|
q,
|
|
4943
4944
|
b[q.key_field],
|
|
4944
4945
|
y.field
|
|
@@ -4988,7 +4989,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
4988
4989
|
collection: a,
|
|
4989
4990
|
itemId: t,
|
|
4990
4991
|
cascadeFilter: rt[y.field],
|
|
4991
|
-
pinnedOption:
|
|
4992
|
+
pinnedOption: Mn(
|
|
4992
4993
|
y.field,
|
|
4993
4994
|
(g == null ? void 0 : g.draft) ?? {}
|
|
4994
4995
|
),
|
|
@@ -5087,7 +5088,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5087
5088
|
}
|
|
5088
5089
|
),
|
|
5089
5090
|
ee && t != null && /* @__PURE__ */ o(
|
|
5090
|
-
|
|
5091
|
+
jl,
|
|
5091
5092
|
{
|
|
5092
5093
|
collection: a,
|
|
5093
5094
|
rowId: String(t),
|
|
@@ -5107,11 +5108,11 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5107
5108
|
}
|
|
5108
5109
|
),
|
|
5109
5110
|
t != null && !String(t).startsWith("pending") && /* @__PURE__ */ o(
|
|
5110
|
-
|
|
5111
|
+
Rl,
|
|
5111
5112
|
{
|
|
5112
5113
|
collection: a,
|
|
5113
5114
|
rowId: String(t),
|
|
5114
|
-
rowLabel:
|
|
5115
|
+
rowLabel: zl(e)
|
|
5115
5116
|
}
|
|
5116
5117
|
),
|
|
5117
5118
|
!A && /* @__PURE__ */ o(
|
|
@@ -5170,9 +5171,9 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5170
5171
|
matchCollection: Q.collection,
|
|
5171
5172
|
matchQuery: (F == null ? void 0 : F.query) ?? null,
|
|
5172
5173
|
matchSeed: (F == null ? void 0 : F.seed) ?? {}
|
|
5173
|
-
} :
|
|
5174
|
+
} : M ? {
|
|
5174
5175
|
deferred: !0,
|
|
5175
|
-
stagedOps: (g == null ? void 0 : g.draft[`__nested_ops_${y}`]) ??
|
|
5176
|
+
stagedOps: (g == null ? void 0 : g.draft[`__nested_ops_${y}`]) ?? Mr,
|
|
5176
5177
|
onStagedOpsChange: (Ue) => ft(`__nested_ops_${y}`, Ue)
|
|
5177
5178
|
} : {}
|
|
5178
5179
|
},
|
|
@@ -5209,9 +5210,9 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5209
5210
|
children: [
|
|
5210
5211
|
at !== "panel" && /* @__PURE__ */ _(yn, { children: [
|
|
5211
5212
|
ot && /* @__PURE__ */ o("td", { className: "w-7" }),
|
|
5212
|
-
(X || O ||
|
|
5213
|
+
(X || O || M) && /* @__PURE__ */ o("td", { className: "w-6" }),
|
|
5213
5214
|
I && /* @__PURE__ */ o("td", { className: "w-8 px-2 align-middle text-slate-400 text-[11px] select-none", children: $.length + L.length + 1 }),
|
|
5214
|
-
(O ||
|
|
5215
|
+
(O || M) && /* @__PURE__ */ o("td", { className: "px-3 py-1.5" })
|
|
5215
5216
|
] }),
|
|
5216
5217
|
at === "panel" ? ki({
|
|
5217
5218
|
identity: `${I ? `Line ${$.length + L.length + 1} · ` : ""}New line`,
|
|
@@ -5219,13 +5220,13 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5219
5220
|
rowId: void 0,
|
|
5220
5221
|
saveLabel: "Save",
|
|
5221
5222
|
drawer: Ar(void 0, g.draft)
|
|
5222
|
-
}) :
|
|
5223
|
+
}) : Ke.map((e) => {
|
|
5223
5224
|
if (it(e))
|
|
5224
5225
|
return /* @__PURE__ */ o("td", { className: "px-2 py-1 align-top", children: /* @__PURE__ */ o("div", { className: "py-0.5 overflow-hidden text-slate-500", children: Rn(e, g.draft, !0) }) }, e.field);
|
|
5225
5226
|
const n = e.computed_type === "write" && !!e.computed_formula, t = An(e.interface), r = `__m2m_${e.field}`, i = t ? Zr(e) : null;
|
|
5226
5227
|
return /* @__PURE__ */ o("td", { className: "px-2 py-1 align-top", children: n ? /* @__PURE__ */ o("div", { className: "py-0.5 overflow-hidden text-slate-500 italic", children: De(
|
|
5227
5228
|
e,
|
|
5228
|
-
|
|
5229
|
+
Kt(e.computed_formula, g.draft) ?? null
|
|
5229
5230
|
) }) : t && i ? /* @__PURE__ */ o("div", { onClick: (s) => s.stopPropagation(), children: /* @__PURE__ */ o(
|
|
5230
5231
|
ji,
|
|
5231
5232
|
{
|
|
@@ -5244,7 +5245,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5244
5245
|
collection: a,
|
|
5245
5246
|
itemId: "new",
|
|
5246
5247
|
cascadeFilter: rt[e.field],
|
|
5247
|
-
pinnedOption:
|
|
5248
|
+
pinnedOption: Mn(e.field, g.draft)
|
|
5248
5249
|
}
|
|
5249
5250
|
) }) }, e.field);
|
|
5250
5251
|
}),
|
|
@@ -5274,7 +5275,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5274
5275
|
),
|
|
5275
5276
|
$.length === 0 && L.length === 0 && !Or && /* @__PURE__ */ o("tr", { children: /* @__PURE__ */ o("td", { colSpan: Nt, className: "px-3 py-14 text-center text-slate-400", children: re ? `No ${re.toLowerCase()} yet` : O ? "No pending rows" : "No rows yet" }) }),
|
|
5276
5277
|
!O && je !== "original" && (() => {
|
|
5277
|
-
const e = fe.find((c) => c.addendumId === je), n = (C && (X ||
|
|
5278
|
+
const e = fe.find((c) => c.addendumId === je), n = (C && (X || M) ? 1 : 0) + (I ? 1 : 0) + (M ? 1 : 0) + Ke.length + 1;
|
|
5278
5279
|
if (!e)
|
|
5279
5280
|
return $.length === 0 ? /* @__PURE__ */ o("tr", { children: /* @__PURE__ */ o(
|
|
5280
5281
|
"td",
|
|
@@ -5284,10 +5285,10 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5284
5285
|
children: re ? `No ${re.toLowerCase()} yet` : "No rows"
|
|
5285
5286
|
}
|
|
5286
5287
|
) }) : $.map((c, l) => /* @__PURE__ */ _("tr", { className: "border-b border-slate-100", children: [
|
|
5287
|
-
C && (X ||
|
|
5288
|
+
C && (X || M) && /* @__PURE__ */ o("td", { className: "w-6" }),
|
|
5288
5289
|
I && /* @__PURE__ */ o("td", { className: "w-8 px-2 align-middle text-[11px] text-slate-400 select-none", children: l + 1 }),
|
|
5289
|
-
|
|
5290
|
-
|
|
5290
|
+
M && /* @__PURE__ */ o("td", { className: "w-20" }),
|
|
5291
|
+
Ke.map((u) => /* @__PURE__ */ o("td", { className: "px-2 py-1.5 text-[11px] text-slate-700", children: it(u) ? wr(u, c) : De(
|
|
5291
5292
|
u,
|
|
5292
5293
|
c[u.field],
|
|
5293
5294
|
c.id != null ? String(c.id) : void 0
|
|
@@ -5318,10 +5319,10 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5318
5319
|
{
|
|
5319
5320
|
className: "border-b border-red-100 bg-red-50/40 dark:border-red-500/25 dark:bg-red-500/10",
|
|
5320
5321
|
children: [
|
|
5321
|
-
C && (X ||
|
|
5322
|
+
C && (X || M) && /* @__PURE__ */ o("td", { className: "w-6" }),
|
|
5322
5323
|
I && /* @__PURE__ */ o("td", { className: "w-8 px-2 align-middle text-[11px] text-red-300 select-none", children: "–" }),
|
|
5323
|
-
|
|
5324
|
-
|
|
5324
|
+
M && /* @__PURE__ */ o("td", { className: "w-20" }),
|
|
5325
|
+
Ke.map((m) => /* @__PURE__ */ o(
|
|
5325
5326
|
"td",
|
|
5326
5327
|
{
|
|
5327
5328
|
className: "px-2 py-1.5 text-[11px] text-red-700/70 line-through dark:text-red-300/70",
|
|
@@ -5360,7 +5361,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5360
5361
|
{
|
|
5361
5362
|
className: w ? "border-b border-amber-100 bg-amber-50/40 dark:border-amber-500/25 dark:bg-amber-400/10" : "border-b border-slate-100",
|
|
5362
5363
|
children: [
|
|
5363
|
-
C && (X ||
|
|
5364
|
+
C && (X || M) && /* @__PURE__ */ o("td", { className: "w-6" }),
|
|
5364
5365
|
I && /* @__PURE__ */ o(
|
|
5365
5366
|
"td",
|
|
5366
5367
|
{
|
|
@@ -5368,8 +5369,8 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5368
5369
|
children: l + 1
|
|
5369
5370
|
}
|
|
5370
5371
|
),
|
|
5371
|
-
|
|
5372
|
-
|
|
5372
|
+
M && /* @__PURE__ */ o("td", { className: "w-20" }),
|
|
5373
|
+
Ke.map((x) => /* @__PURE__ */ o(
|
|
5373
5374
|
"td",
|
|
5374
5375
|
{
|
|
5375
5376
|
className: `px-2 py-1.5 text-[11px] ${b.has(x.field) ? "bg-amber-50 text-amber-900 dark:bg-amber-400/15 dark:text-amber-300" : "text-slate-700 dark:text-slate-300"}`,
|
|
@@ -5407,13 +5408,13 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5407
5408
|
className: "border-b border-dashed border-slate-200 bg-slate-50/60 dark:border-border dark:bg-white/[0.025]",
|
|
5408
5409
|
children: [
|
|
5409
5410
|
ot && /* @__PURE__ */ o("td", {}),
|
|
5410
|
-
C && (X || O ||
|
|
5411
|
+
C && (X || O || M) && /* @__PURE__ */ o("td", {}),
|
|
5411
5412
|
I && /* @__PURE__ */ o("td", {}),
|
|
5412
|
-
(O ||
|
|
5413
|
+
(O || M) && /* @__PURE__ */ o("td", { className: "px-3 py-1 align-top", children: /* @__PURE__ */ _("span", { className: "text-[10px] font-medium uppercase tracking-wide text-slate-500 dark:text-slate-400", children: [
|
|
5413
5414
|
q.label,
|
|
5414
5415
|
" only"
|
|
5415
5416
|
] }) }),
|
|
5416
|
-
|
|
5417
|
+
Ke.map(
|
|
5417
5418
|
(r) => r.field === q.key_field ? /* @__PURE__ */ _("td", { className: "px-2 py-1 align-top", children: [
|
|
5418
5419
|
/* @__PURE__ */ o("div", { className: "py-0.5 text-[12px] font-medium text-slate-700 dark:text-slate-200", children: String(t.key) }),
|
|
5419
5420
|
/* @__PURE__ */ _(
|
|
@@ -5432,7 +5433,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5432
5433
|
{
|
|
5433
5434
|
className: ye(
|
|
5434
5435
|
"px-2 py-1 align-top",
|
|
5435
|
-
|
|
5436
|
+
Mt(q, t.key, r.field) && "bg-slate-100/70 dark:bg-white/[0.035]"
|
|
5436
5437
|
),
|
|
5437
5438
|
children: [
|
|
5438
5439
|
q.columns.includes(r.field) && /* @__PURE__ */ o("div", { className: "py-0.5 text-[12px] text-slate-300 dark:text-slate-600", children: "—" }),
|
|
@@ -5555,7 +5556,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5555
5556
|
r ? g.draft : e,
|
|
5556
5557
|
{ rowKey: t }
|
|
5557
5558
|
);
|
|
5558
|
-
return
|
|
5559
|
+
return Ke.map((u) => {
|
|
5559
5560
|
var J;
|
|
5560
5561
|
if (it(u))
|
|
5561
5562
|
return /* @__PURE__ */ o("td", { className: "px-2 py-1 align-top", children: /* @__PURE__ */ o("div", { className: "py-0.5 overflow-hidden text-slate-500", children: Rn(
|
|
@@ -5563,7 +5564,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5563
5564
|
r ? g.draft : e,
|
|
5564
5565
|
!0
|
|
5565
5566
|
) }) }, u.field);
|
|
5566
|
-
const m = u.computed_type === "write" && !!u.computed_formula, p = An(u.interface), h = `__m2m_${u.field}`, b = p && i ? Zr(u) : null, w = u.interface === "relation-path" && e.id != null ? (J = ut == null ? void 0 : ut[String(e.id)]) == null ? void 0 : J[u.field] : void 0, x = m ?
|
|
5567
|
+
const m = u.computed_type === "write" && !!u.computed_formula, p = An(u.interface), h = `__m2m_${u.field}`, b = p && i ? Zr(u) : null, w = u.interface === "relation-path" && e.id != null ? (J = ut == null ? void 0 : ut[String(e.id)]) == null ? void 0 : J[u.field] : void 0, x = m ? Kt(
|
|
5567
5568
|
u.computed_formula,
|
|
5568
5569
|
r ? g.draft : e
|
|
5569
5570
|
) ?? e[u.field] : r ? g.draft[u.field] ?? w : e[u.field] ?? w, y = Array.isArray(e.__rule_set) ? e.__rule_set.includes(u.field) : !1;
|
|
@@ -5594,7 +5595,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5594
5595
|
collection: a,
|
|
5595
5596
|
itemId: "new",
|
|
5596
5597
|
cascadeFilter: rt[u.field],
|
|
5597
|
-
pinnedOption:
|
|
5598
|
+
pinnedOption: Mn(u.field, g.draft)
|
|
5598
5599
|
}
|
|
5599
5600
|
) }) : u.interface === "formula-column" ? /* @__PURE__ */ o("div", { className: "py-0.5 overflow-hidden", children: De(u, l[u.field], void 0, l) }) : u.computed_type === "rollup" ? /* @__PURE__ */ o("div", { className: "py-0.5 overflow-hidden", children: De(
|
|
5600
5601
|
u,
|
|
@@ -5703,7 +5704,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5703
5704
|
})
|
|
5704
5705
|
] }),
|
|
5705
5706
|
je === "original" && (() => {
|
|
5706
|
-
if (
|
|
5707
|
+
if (Ke.filter((t) => !!(t.options ? typeof t.options == "string" ? (() => {
|
|
5707
5708
|
try {
|
|
5708
5709
|
return JSON.parse(t.options);
|
|
5709
5710
|
} catch {
|
|
@@ -5728,17 +5729,17 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5728
5729
|
];
|
|
5729
5730
|
return /* @__PURE__ */ o("tfoot", { children: /* @__PURE__ */ _("tr", { className: "border-t border-slate-200 bg-slate-50 text-[11px] font-medium text-slate-600 dark:border-slate-700 dark:bg-white/[0.03] dark:text-slate-300", children: [
|
|
5730
5731
|
ot && /* @__PURE__ */ o("td", {}),
|
|
5731
|
-
C && (X || O ||
|
|
5732
|
+
C && (X || O || M) && /* @__PURE__ */ o("td", {}),
|
|
5732
5733
|
I && /* @__PURE__ */ o("td", {}),
|
|
5733
|
-
(O ||
|
|
5734
|
-
|
|
5734
|
+
(O || M) && /* @__PURE__ */ o("td", {}),
|
|
5735
|
+
Ke.map((t) => {
|
|
5735
5736
|
const r = t.options ? typeof t.options == "string" ? (() => {
|
|
5736
5737
|
try {
|
|
5737
5738
|
return JSON.parse(t.options);
|
|
5738
5739
|
} catch {
|
|
5739
5740
|
return {};
|
|
5740
5741
|
}
|
|
5741
|
-
})() : t.options : {}, i = r.aggregate, s =
|
|
5742
|
+
})() : t.options : {}, i = r.aggregate, s = Sl(q, t.field), d = s != null ? /* @__PURE__ */ _(
|
|
5742
5743
|
"div",
|
|
5743
5744
|
{
|
|
5744
5745
|
"data-compare-footer": t.field,
|
|
@@ -5900,7 +5901,7 @@ Reason: “${F.reason}”` : ""}` : void 0;
|
|
|
5900
5901
|
);
|
|
5901
5902
|
})(),
|
|
5902
5903
|
/* @__PURE__ */ o(
|
|
5903
|
-
|
|
5904
|
+
ql,
|
|
5904
5905
|
{
|
|
5905
5906
|
open: Ro,
|
|
5906
5907
|
onOpenChange: Ui,
|
|
@@ -5988,7 +5989,7 @@ const Eo = {
|
|
|
5988
5989
|
back: "Back-loaded",
|
|
5989
5990
|
shape: "Like previous"
|
|
5990
5991
|
};
|
|
5991
|
-
function
|
|
5992
|
+
function Mo(a) {
|
|
5992
5993
|
return a.presets.length < 2 ? null : /* @__PURE__ */ o("span", { className: "inline-flex items-center gap-0.5", "data-o2m-spread-presets": !0, children: a.presets.map((f) => /* @__PURE__ */ o(
|
|
5993
5994
|
"button",
|
|
5994
5995
|
{
|
|
@@ -6005,7 +6006,7 @@ function Ko(a) {
|
|
|
6005
6006
|
f
|
|
6006
6007
|
)) });
|
|
6007
6008
|
}
|
|
6008
|
-
function
|
|
6009
|
+
function Hl({
|
|
6009
6010
|
config: a,
|
|
6010
6011
|
draft: f,
|
|
6011
6012
|
remaining: v,
|
|
@@ -6026,8 +6027,8 @@ function Bl({
|
|
|
6026
6027
|
onClick: () => {
|
|
6027
6028
|
if ($e) return;
|
|
6028
6029
|
const ne = P ? I.map((G) => P.values[G] ?? 0) : void 0, qe = Lo(me, I.length, Z, ne), pe = {};
|
|
6029
|
-
I.forEach((G,
|
|
6030
|
-
pe[G] = qe[
|
|
6030
|
+
I.forEach((G, le) => {
|
|
6031
|
+
pe[G] = qe[le];
|
|
6031
6032
|
}), E(pe);
|
|
6032
6033
|
},
|
|
6033
6034
|
disabled: !!$e,
|
|
@@ -6040,7 +6041,7 @@ function Bl({
|
|
|
6040
6041
|
}
|
|
6041
6042
|
),
|
|
6042
6043
|
!$e && /* @__PURE__ */ o(
|
|
6043
|
-
|
|
6044
|
+
Mo,
|
|
6044
6045
|
{
|
|
6045
6046
|
presets: C,
|
|
6046
6047
|
value: Z,
|
|
@@ -6065,7 +6066,7 @@ function Bl({
|
|
|
6065
6066
|
$e && /* @__PURE__ */ o("span", { className: "text-[11px] text-slate-400 dark:text-slate-500", children: $e })
|
|
6066
6067
|
] });
|
|
6067
6068
|
}
|
|
6068
|
-
function
|
|
6069
|
+
function Yl(a) {
|
|
6069
6070
|
const [f, v] = D(!1), [E, U] = D("even"), P = a.remaining == null || !Number.isFinite(a.remaining) ? 0 : Math.round(a.remaining * 100) / 100, ee = (W) => a.config.format === "number" ? W.toLocaleString(void 0, { maximumFractionDigits: 2 }) : W.toLocaleString(void 0, { style: "currency", currency: "USD" });
|
|
6070
6071
|
if (P <= 0) return null;
|
|
6071
6072
|
const se = (a.config.presets ?? ["even", "front", "back"]).filter(
|
|
@@ -6104,7 +6105,7 @@ function Hl(a) {
|
|
|
6104
6105
|
" first."
|
|
6105
6106
|
] }),
|
|
6106
6107
|
/* @__PURE__ */ o("div", { className: "mt-2", children: /* @__PURE__ */ o(
|
|
6107
|
-
|
|
6108
|
+
Mo,
|
|
6108
6109
|
{
|
|
6109
6110
|
presets: se,
|
|
6110
6111
|
value: se.includes(E) ? E : se[0],
|
|
@@ -6145,8 +6146,8 @@ function Oo(a) {
|
|
|
6145
6146
|
return ((v = f == null ? void 0 : f.response) == null ? void 0 : v.error) ?? ((E = f == null ? void 0 : f.response) == null ? void 0 : E.message) ?? (f == null ? void 0 : f.message) ?? "the server refused it";
|
|
6146
6147
|
}
|
|
6147
6148
|
export {
|
|
6148
|
-
|
|
6149
|
-
|
|
6149
|
+
Od as InlineTableField,
|
|
6150
|
+
Kt as evalClientFormula,
|
|
6150
6151
|
Ti as failingLints,
|
|
6151
6152
|
Lo as spreadAmounts
|
|
6152
6153
|
};
|