@nivaro/react 0.3.126 → 0.3.128
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +20 -2
- package/dist/index.js +150 -147
- package/dist/shared/components/CollectionBrowserView.js +3259 -3211
- package/dist/shared/components/DataTable.js +406 -401
- package/dist/shared/components/ItemEditForm.js +4359 -4299
- package/dist/shared/components/MatrixEditor.js +548 -490
- package/dist/shared/components/MyWorkView.js +284 -274
- package/dist/shared/components/NotificationBell.js +264 -218
- package/dist/shared/components/RecordGridEditor.js +582 -472
- package/dist/shared/components/chat/chat-core.js +331 -346
- package/dist/shared/components/chat/chat-typing.js +25 -0
- package/dist/shared/components/command-center/CommandCenterView.js +1 -1
- package/dist/shared/components/command-center/PeekPanel.js +8 -1
- package/dist/shared/components/command-center/api.js +17 -9
- package/dist/shared/components/command-center/panels/AttentionPanel.js +4 -1
- package/dist/shared/components/command-center/panels/PartnersPanel.js +2 -1
- package/dist/shared/components/item-edit/GroupSection.js +1 -1
- package/dist/shared/components/item-edit/InlineTableField.js +432 -429
- package/dist/shared/components/item-edit/RecordLiveSync.js +115 -108
- package/dist/shared/components/item-edit/RecordViewersChip.js +17 -16
- package/dist/shared/components/item-edit/RowComments.js +33 -30
- package/dist/shared/components/item-edit/cascade-clear-notice.js +30 -28
- package/dist/shared/components/item-edit/live-related.js +29 -16
- package/dist/shared/components/item-edit/record-opened-live.js +86 -0
- package/dist/shared/components/item-edit/reimport-m2m.js +17 -0
- package/dist/shared/components/panels/OwnerOpenedLine.js +24 -23
- package/dist/shared/components/panels/RecordIntegrityBanner.js +1 -1
- package/dist/shared/components/pipeline/TeamSuggestions.js +1 -1
- package/dist/shared/components/queue/QueueItemSheet.js +171 -130
- package/dist/shared/components/record-grid-guard.js +85 -0
- package/dist/shared/components/support/TicketDetailSheet.js +168 -151
- package/dist/shared/lib/at-risk-fields.js +14 -0
- package/dist/shared/lib/live-queries.js +9 -8
- package/dist/shared/lib/live-screen.js +77 -76
- package/dist/shared/lib/presence-hooks.js +190 -127
- package/dist/shared/lib/user-sync.js +78 -65
- package/dist/shared/lib/waiting-count.js +40 -29
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as l, jsxs as k, Fragment as _n } from "react/jsx-runtime";
|
|
2
2
|
import { useQueryClient as sa, useQuery as Ce, useQueries as xn } from "@tanstack/react-query";
|
|
3
|
-
import { Loader2 as kn, ListChecks as Md, SquarePen as Kd, Rows3 as Pd, PanelBottomOpen as Dd, Zap as Wd, Clock as
|
|
4
|
-
import { useState as B, useMemo as j, useEffect as ne, useRef as Y, useId as Bl, useContext as zd, useDeferredValue as Jd, useCallback as Dt, Fragment as
|
|
3
|
+
import { Loader2 as kn, ListChecks as Md, SquarePen as Kd, Rows3 as Pd, PanelBottomOpen as Dd, Zap as Wd, Clock as Lo, History as wi, AlertTriangle as Kr, ChevronRight as la, GripVertical as Dl, FileUp as Wl, Lock as Ul, GripHorizontal as Ud, X as Bd } from "lucide-react";
|
|
4
|
+
import { useState as B, useMemo as j, useEffect as ne, useRef as Y, useId as Bl, useContext as zd, useDeferredValue as Jd, useCallback as Dt, Fragment as Ro } from "react";
|
|
5
5
|
import { createPortal as Qd } from "react-dom";
|
|
6
|
-
import { changeReasonChallenge as
|
|
6
|
+
import { changeReasonChallenge as Ao, ChangeReasonDialog as Vd } from "./ChangeReasonDialog.js";
|
|
7
7
|
import { toast as be } from "sonner";
|
|
8
8
|
import { useNivaroClient as $i, useDrilldown as Hd, useParentDraft as Fd, useReimportHandler as Gd, useItemEditAuth as zl, fieldDrilldownConfig as Jl } from "../../context.js";
|
|
9
9
|
import { get as ce, post as Ke, patch as Ni, del as aa } from "../../lib/commands.js";
|
|
@@ -30,7 +30,7 @@ import { resolveCompareEndpoint as bc, useCompareSeries as yc, compareColumnClos
|
|
|
30
30
|
import { FieldRenderer as zn } from "./FieldRenderer.js";
|
|
31
31
|
import { primaryControl as Nc, nameFieldControl as Sc } from "./field-a11y.js";
|
|
32
32
|
import { GridBulkEditDialog as $c } from "./GridBulkEditDialog.js";
|
|
33
|
-
import { useDebouncedValue as Ec, searchWords as qc, GRID_READ_LIMIT as Ko, useGridServerSearch as Ic, useGridChildTotal as Oc, extraSearchRows as
|
|
33
|
+
import { useDebouncedValue as Ec, searchWords as qc, GRID_READ_LIMIT as Ko, useGridServerSearch as Ic, useGridChildTotal as Oc, extraSearchRows as Lc, useGridSearchHighlight as Rc, useGridSearchShortcut as Ac, pendingRowVisibility as jc, GRID_SEARCH_MIN_ROWS as Tc, GridSearchBox as Mc, GRID_SEARCH_HIGHLIGHT_CSS as Kc, GRID_SEARCH_ROOT_ATTR as Pc, cellSearchTexts as Dc, textMatchesWords as Wc } from "./grid-search.js";
|
|
34
34
|
import { parseJson as vi, SENTINEL_FIELDS as Bo, applyDisplayTemplate as Tr, EMPTY_NESTED_OPS as xi, SYSTEM_FIELDS as Gl } from "./helpers.js";
|
|
35
35
|
import { lineLabelOf as _i, rowBaseBookFor as Uc, writeLineGuarded as Bc, lineConflictKey as zc, resolveLineCollision as Jc, snapshotRowBases as Qc, incrementGuarded as Vc } from "./line-midair.js";
|
|
36
36
|
import { NUMBER_FIELD_TYPES as Hc, checkNumberEntry as Fc, changedRowFields as Yl, lineRuleErrors as Gc, computedColumnErrors as Yc, zeroQtyColumn as Cl, dropRevertedFields as Cc, isRealLineEdit as Xc } from "./line-qty.js";
|
|
@@ -50,10 +50,10 @@ import { normalizeSetAllRows as vu, SetAllRowsButton as xu } from "./SetAllRowsB
|
|
|
50
50
|
import { SplitLinesButton as _u } from "./SplitLinesButton.js";
|
|
51
51
|
import { resolveOptionFilterTokens as da } from "../../lib/option-filter-tokens.js";
|
|
52
52
|
function ta(s, f) {
|
|
53
|
-
const y = s[f.field],
|
|
54
|
-
if (U === "null") return
|
|
55
|
-
if (U === "nnull") return !
|
|
56
|
-
if (
|
|
53
|
+
const y = s[f.field], L = y == null || y === "", U = f.op ?? "eq";
|
|
54
|
+
if (U === "null") return L;
|
|
55
|
+
if (U === "nnull") return !L;
|
|
56
|
+
if (L) return !1;
|
|
57
57
|
const z = String(typeof y == "object" && y ? y.id ?? "" : y);
|
|
58
58
|
if (U === "in")
|
|
59
59
|
return (Array.isArray(f.value) ? f.value : String(f.value ?? "").split(",")).map((J) => String(J).trim()).includes(z);
|
|
@@ -61,11 +61,11 @@ function ta(s, f) {
|
|
|
61
61
|
return U === "neq" ? z !== re : z === re;
|
|
62
62
|
}
|
|
63
63
|
function Wo(s, f) {
|
|
64
|
-
var
|
|
64
|
+
var L, U;
|
|
65
65
|
if (!(f != null && f.length)) return [];
|
|
66
66
|
const y = [];
|
|
67
67
|
for (const z of f)
|
|
68
|
-
!((
|
|
68
|
+
!((L = z == null ? void 0 : z.when) != null && L.field) || !((U = z == null ? void 0 : z.expect) != null && U.field) || ta(s, z.when) && (ta(s, z.expect) || y.push(z.label || `${z.when.field} vs ${z.expect.field}`));
|
|
69
69
|
return y;
|
|
70
70
|
}
|
|
71
71
|
const ku = {
|
|
@@ -90,10 +90,10 @@ function na({
|
|
|
90
90
|
saved: s,
|
|
91
91
|
onDelete: f
|
|
92
92
|
}) {
|
|
93
|
-
const [y,
|
|
93
|
+
const [y, L] = B(!1);
|
|
94
94
|
return ne(() => {
|
|
95
95
|
if (!y) return;
|
|
96
|
-
const U = setTimeout(() =>
|
|
96
|
+
const U = setTimeout(() => L(!1), 3e3);
|
|
97
97
|
return () => clearTimeout(U);
|
|
98
98
|
}, [y]), /* @__PURE__ */ l(
|
|
99
99
|
"button",
|
|
@@ -104,10 +104,10 @@ function na({
|
|
|
104
104
|
"data-armed": y ? "" : void 0,
|
|
105
105
|
onClick: (U) => {
|
|
106
106
|
if (U.stopPropagation(), s && !y) {
|
|
107
|
-
|
|
107
|
+
L(!0);
|
|
108
108
|
return;
|
|
109
109
|
}
|
|
110
|
-
|
|
110
|
+
L(!1), f(U);
|
|
111
111
|
},
|
|
112
112
|
className: y ? "rounded bg-red-50 p-0.5 text-red-600 dark:bg-red-900/20 dark:text-red-400" : "rounded p-0.5 text-slate-300 hover:text-red-500",
|
|
113
113
|
children: /* @__PURE__ */ l(Bd, { className: "h-3 w-3" })
|
|
@@ -121,8 +121,8 @@ function Su({ children: s }) {
|
|
|
121
121
|
{
|
|
122
122
|
"data-stale-flag": !0,
|
|
123
123
|
className: "inline-flex max-w-full items-center gap-1 rounded border border-amber-300 bg-amber-50/70 px-1.5 py-0.5 dark:border-amber-500/50 dark:bg-amber-500/10",
|
|
124
|
-
onMouseEnter: (
|
|
125
|
-
const U =
|
|
124
|
+
onMouseEnter: (L) => {
|
|
125
|
+
const U = L.currentTarget.getBoundingClientRect(), z = window.innerHeight - U.bottom < 80;
|
|
126
126
|
y({ x: U.left, y: z ? U.top - 54 : U.bottom + 4 });
|
|
127
127
|
},
|
|
128
128
|
onMouseLeave: () => y(null),
|
|
@@ -149,15 +149,15 @@ function $u(s) {
|
|
|
149
149
|
const f = s.replace(
|
|
150
150
|
/&(lt|gt|quot|amp|#39);/g,
|
|
151
151
|
(z, re) => ku[re] ?? ""
|
|
152
|
-
), y = [],
|
|
153
|
-
let U =
|
|
152
|
+
), y = [], L = /"detail"\s*:\s*"((?:[^"\\]|\\.)*)"/g;
|
|
153
|
+
let U = L.exec(f);
|
|
154
154
|
for (; U; ) {
|
|
155
155
|
try {
|
|
156
156
|
y.push(JSON.parse(`"${U[1]}"`));
|
|
157
157
|
} catch {
|
|
158
158
|
y.push(U[1]);
|
|
159
159
|
}
|
|
160
|
-
U =
|
|
160
|
+
U = L.exec(f);
|
|
161
161
|
}
|
|
162
162
|
if (y.length === 0) {
|
|
163
163
|
const z = f.replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
|
|
@@ -174,10 +174,10 @@ const zo = /* @__PURE__ */ new Set([
|
|
|
174
174
|
"group",
|
|
175
175
|
"divider"
|
|
176
176
|
]), Mr = "__all__";
|
|
177
|
-
function ca(s, f, y,
|
|
177
|
+
function ca(s, f, y, L) {
|
|
178
178
|
if (f <= 0) return [];
|
|
179
179
|
let U;
|
|
180
|
-
for (y === "front" ? U = Array.from({ length: f }, (J, M) => f - M) : y === "back" ? U = Array.from({ length: f }, (J, M) => M + 1) : y === "shape" &&
|
|
180
|
+
for (y === "front" ? U = Array.from({ length: f }, (J, M) => f - M) : y === "back" ? U = Array.from({ length: f }, (J, M) => M + 1) : y === "shape" && L && L.some((J) => J > 0) ? U = L.slice(0, f).map((J) => Math.max(0, J)) : U = Array.from({ length: f }, () => 1); U.length < f; ) U.push(0);
|
|
181
181
|
const z = U.reduce((J, M) => J + M, 0) || 1, re = [];
|
|
182
182
|
let le = 0;
|
|
183
183
|
for (let J = 0; J < f; J++)
|
|
@@ -208,17 +208,17 @@ function Wt(s, f) {
|
|
|
208
208
|
}
|
|
209
209
|
function Uo(s, f) {
|
|
210
210
|
return f.map((y) => {
|
|
211
|
-
const
|
|
212
|
-
return String(
|
|
211
|
+
const L = s[`__m2m_${y}`];
|
|
212
|
+
return String(L !== void 0 ? L ?? "" : s[y] ?? "");
|
|
213
213
|
}).join("\0");
|
|
214
214
|
}
|
|
215
|
-
function Jo(s, f, y,
|
|
216
|
-
return typeof s != "string" ? s : s === "$parent.id" ? y : s.startsWith("$parent.") ?
|
|
215
|
+
function Jo(s, f, y, L) {
|
|
216
|
+
return typeof s != "string" ? s : s === "$parent.id" ? y : s.startsWith("$parent.") ? L == null ? void 0 : L[s.slice(8)] : s.startsWith("$row.") ? f[s.slice(5)] : s;
|
|
217
217
|
}
|
|
218
|
-
function Si(s, f, y,
|
|
218
|
+
function Si(s, f, y, L) {
|
|
219
219
|
const U = {};
|
|
220
220
|
for (const [re, le] of Object.entries(s.filters ?? {})) {
|
|
221
|
-
const J = Jo(le, f, y,
|
|
221
|
+
const J = Jo(le, f, y, L);
|
|
222
222
|
if (J == null || J === "") return null;
|
|
223
223
|
if (re.startsWith("_")) {
|
|
224
224
|
U[re] = J;
|
|
@@ -235,14 +235,14 @@ function Si(s, f, y, R) {
|
|
|
235
235
|
}
|
|
236
236
|
const z = {};
|
|
237
237
|
for (const [re, le] of Object.entries(s.defaults ?? {})) {
|
|
238
|
-
const J = Jo(le, f, y,
|
|
238
|
+
const J = Jo(le, f, y, L);
|
|
239
239
|
J != null && J !== "" && (z[re] = J);
|
|
240
240
|
}
|
|
241
241
|
return { query: U, seed: z };
|
|
242
242
|
}
|
|
243
243
|
function ki(s, f) {
|
|
244
244
|
return f.split(".").reduce(
|
|
245
|
-
(y,
|
|
245
|
+
(y, L) => y && typeof y == "object" ? y[L] : void 0,
|
|
246
246
|
s
|
|
247
247
|
);
|
|
248
248
|
}
|
|
@@ -253,7 +253,7 @@ function Ou({
|
|
|
253
253
|
config: s,
|
|
254
254
|
relatedCollection: f,
|
|
255
255
|
manyField: y,
|
|
256
|
-
parentId:
|
|
256
|
+
parentId: L,
|
|
257
257
|
rows: U,
|
|
258
258
|
rowDefaults: z,
|
|
259
259
|
parentDraft: re,
|
|
@@ -267,93 +267,96 @@ function Ou({
|
|
|
267
267
|
writeRow: $e,
|
|
268
268
|
stagedBase: ie
|
|
269
269
|
}) {
|
|
270
|
-
const Ie = $i(), [Je, fe] = B(!1), [Fe, _e] = B(null), [ee, ye] = B({}), [Xe, Pe] = B(null),
|
|
270
|
+
const Ie = $i(), [Je, fe] = B(!1), [Fe, _e] = B(null), [ee, ye] = B({}), [Xe, Pe] = B(null), Le = j(
|
|
271
271
|
() => (s.columns ?? []).map(
|
|
272
|
-
(
|
|
273
|
-
path:
|
|
272
|
+
(H) => typeof H == "string" ? {
|
|
273
|
+
path: H,
|
|
274
274
|
label: void 0,
|
|
275
275
|
format: void 0,
|
|
276
276
|
formula: void 0,
|
|
277
277
|
width: void 0
|
|
278
|
-
} :
|
|
278
|
+
} : H
|
|
279
279
|
),
|
|
280
280
|
[s.columns]
|
|
281
281
|
), tt = j(
|
|
282
|
-
() => da(s.filter, re,
|
|
283
|
-
[s.filter, re,
|
|
284
|
-
),
|
|
285
|
-
const
|
|
286
|
-
s.group_by &&
|
|
287
|
-
const P = (
|
|
288
|
-
/^__\w+__$/.test(
|
|
282
|
+
() => da(s.filter, re, L),
|
|
283
|
+
[s.filter, re, L]
|
|
284
|
+
), Lt = j(() => {
|
|
285
|
+
const H = /* @__PURE__ */ new Set(["id"]);
|
|
286
|
+
s.group_by && H.add(s.group_by);
|
|
287
|
+
const P = (R) => {
|
|
288
|
+
/^__\w+__$/.test(R) || H.add(R);
|
|
289
289
|
};
|
|
290
|
-
for (const
|
|
291
|
-
|
|
292
|
-
for (const C of (
|
|
290
|
+
for (const R of Le) {
|
|
291
|
+
R.path && P(R.path);
|
|
292
|
+
for (const C of (R.formula ?? "").matchAll(/\{\{\s*([\w.]+)\s*\}\}/g)) P(C[1]);
|
|
293
293
|
}
|
|
294
|
-
return [...
|
|
295
|
-
}, [
|
|
294
|
+
return [...H].join(",");
|
|
295
|
+
}, [Le, s.group_by]), { data: ae = [], isLoading: ut } = Ce({
|
|
296
296
|
queryKey: [
|
|
297
297
|
"allocate-options",
|
|
298
298
|
s.collection,
|
|
299
299
|
JSON.stringify(tt ?? null),
|
|
300
|
-
|
|
300
|
+
Lt
|
|
301
301
|
],
|
|
302
302
|
queryFn: () => Ie.request(
|
|
303
303
|
ce(`/items/${s.collection}`, {
|
|
304
304
|
...tt ? { filter: JSON.stringify(tt) } : {},
|
|
305
|
-
fields:
|
|
305
|
+
fields: Lt,
|
|
306
306
|
limit: 500
|
|
307
307
|
})
|
|
308
|
-
).then((
|
|
308
|
+
).then((H) => H.data ?? []),
|
|
309
309
|
enabled: Je,
|
|
310
|
-
staleTime: 0
|
|
310
|
+
staleTime: 0,
|
|
311
|
+
// Low (seamless) 2: a refetch (or a filter change) keeps the table — and the amount input
|
|
312
|
+
// the person is typing in — on screen; the spinner is for the first load only.
|
|
313
|
+
placeholderData: (H) => H
|
|
311
314
|
}), $t = j(() => {
|
|
312
|
-
const
|
|
315
|
+
const H = /* @__PURE__ */ new Map();
|
|
313
316
|
for (const P of U) {
|
|
314
|
-
const
|
|
315
|
-
|
|
317
|
+
const R = P[s.target_field];
|
|
318
|
+
R != null && H.set(String(R), P);
|
|
316
319
|
}
|
|
317
|
-
return
|
|
320
|
+
return H;
|
|
318
321
|
}, [U, s.target_field]);
|
|
319
|
-
function De(
|
|
320
|
-
const P = $t.get(
|
|
321
|
-
(
|
|
322
|
+
function De(H) {
|
|
323
|
+
const P = $t.get(H), R = (P == null ? void 0 : P.id) != null ? String(P.id) : null, C = !!(R && (se != null && se.has(R))), he = (Me ?? []).findIndex(
|
|
324
|
+
(Re) => String(Re[s.target_field]) === H
|
|
322
325
|
);
|
|
323
326
|
let $ = 0;
|
|
324
327
|
if (he >= 0) $ = Number((Me ?? [])[he][s.value_field]) || 0;
|
|
325
328
|
else if (P && !C) {
|
|
326
|
-
const
|
|
329
|
+
const Re = R ? W == null ? void 0 : W.get(R) : void 0;
|
|
327
330
|
$ = Number(
|
|
328
|
-
|
|
331
|
+
Re && s.value_field in Re ? Re[s.value_field] : P[s.value_field]
|
|
329
332
|
) || 0;
|
|
330
333
|
}
|
|
331
334
|
return { savedRow: P, pendingIdx: he, amount: $, deleted: C };
|
|
332
335
|
}
|
|
333
|
-
async function Be(
|
|
336
|
+
async function Be(H, P, R) {
|
|
334
337
|
let C = P.trim() === "" ? null : Number(P);
|
|
335
338
|
if (C !== null && !Number.isFinite(C)) return;
|
|
336
|
-
if (C !== null &&
|
|
337
|
-
const $ = Et(
|
|
338
|
-
$ !== null && C > $ && (C = Math.max(0, Math.round($ * 100) / 100), ye((
|
|
339
|
+
if (C !== null && R) {
|
|
340
|
+
const $ = Et(R);
|
|
341
|
+
$ !== null && C > $ && (C = Math.max(0, Math.round($ * 100) / 100), ye((Re) => ({ ...Re, [H]: String(C) })));
|
|
339
342
|
}
|
|
340
343
|
if (oe && M) {
|
|
341
|
-
const { savedRow: $, pendingIdx:
|
|
342
|
-
C === null || C === 0 ?
|
|
343
|
-
...(Me ?? [])[
|
|
344
|
+
const { savedRow: $, pendingIdx: Re, deleted: me } = De(H), Q = ($ == null ? void 0 : $.id) != null ? String($.id) : null;
|
|
345
|
+
C === null || C === 0 ? Re >= 0 ? M.removeRow(f, y, Re) : Q && !me && (M.cancelPendingEdit(f, y, Q), M.queueDelete(f, y, Q)) : Re >= 0 ? M.updateRow(f, y, Re, {
|
|
346
|
+
...(Me ?? [])[Re],
|
|
344
347
|
[s.value_field]: C
|
|
345
348
|
}) : Q ? (me && M.cancelPendingDelete(f, y, Q), M.queueEdit(f, y, Q, {
|
|
346
349
|
[s.value_field]: C,
|
|
347
350
|
...(ie == null ? void 0 : ie(Q)) ?? {}
|
|
348
351
|
})) : M.queueRow(f, y, {
|
|
349
352
|
...z,
|
|
350
|
-
[s.target_field]:
|
|
353
|
+
[s.target_field]: H,
|
|
351
354
|
[s.value_field]: C
|
|
352
355
|
});
|
|
353
356
|
return;
|
|
354
357
|
}
|
|
355
|
-
const he = $t.get(
|
|
356
|
-
_e(
|
|
358
|
+
const he = $t.get(H);
|
|
359
|
+
_e(H);
|
|
357
360
|
try {
|
|
358
361
|
if (C === null || C === 0)
|
|
359
362
|
(he == null ? void 0 : he.id) != null && await Ie.request(aa(`/items/${f}/${he.id}`));
|
|
@@ -366,9 +369,9 @@ function Ou({
|
|
|
366
369
|
await Ie.request(
|
|
367
370
|
Ke(`/items/${f}`, {
|
|
368
371
|
...z,
|
|
369
|
-
[s.target_field]:
|
|
372
|
+
[s.target_field]: H,
|
|
370
373
|
[s.value_field]: C,
|
|
371
|
-
[y]:
|
|
374
|
+
[y]: L
|
|
372
375
|
})
|
|
373
376
|
);
|
|
374
377
|
J == null || J((he == null ? void 0 : he.id) != null ? String(he.id) : null), le();
|
|
@@ -377,21 +380,21 @@ function Ou({
|
|
|
377
380
|
_e(null);
|
|
378
381
|
}
|
|
379
382
|
}
|
|
380
|
-
function Qe(
|
|
381
|
-
return ct(
|
|
383
|
+
function Qe(H, P, R) {
|
|
384
|
+
return ct(H, (C) => C in R ? R[C] : ki(P, C));
|
|
382
385
|
}
|
|
383
|
-
function ke(
|
|
384
|
-
const P = $t.get(
|
|
385
|
-
return { __input__: C !== void 0 && C !== "" ? Number(C) || 0 : he, __saved__:
|
|
386
|
+
function ke(H) {
|
|
387
|
+
const P = $t.get(H), R = Number((P == null ? void 0 : P[s.value_field]) ?? 0) || 0, C = ee[H], he = oe ? De(H).amount : R;
|
|
388
|
+
return { __input__: C !== void 0 && C !== "" ? Number(C) || 0 : he, __saved__: R };
|
|
386
389
|
}
|
|
387
|
-
function Qn(
|
|
388
|
-
const
|
|
389
|
-
return
|
|
390
|
+
function Qn(H, P) {
|
|
391
|
+
const R = Qe(H, P, ke(String(P.id)));
|
|
392
|
+
return R === null ? "—" : R.toLocaleString("en-US", { style: "currency", currency: "USD" });
|
|
390
393
|
}
|
|
391
|
-
function Et(
|
|
394
|
+
function Et(H) {
|
|
392
395
|
if (!s.value_max) return null;
|
|
393
|
-
const P = $t.get(String(
|
|
394
|
-
return Qe(s.value_max,
|
|
396
|
+
const P = $t.get(String(H.id)), R = Number((P == null ? void 0 : P[s.value_field]) ?? 0) || 0;
|
|
397
|
+
return Qe(s.value_max, H, { __input__: R, __saved__: R });
|
|
395
398
|
}
|
|
396
399
|
return /* @__PURE__ */ k(_n, { children: [
|
|
397
400
|
/* @__PURE__ */ l(
|
|
@@ -409,39 +412,39 @@ function Ou({
|
|
|
409
412
|
/* @__PURE__ */ l("p", { className: "mb-2 text-[11px] text-slate-400", children: "Enter an amount to allocate a line — clearing it removes the allocation." }),
|
|
410
413
|
ut ? /* @__PURE__ */ l("div", { className: "py-10 text-center", children: /* @__PURE__ */ l(kn, { className: "inline h-4 w-4 animate-spin text-slate-400" }) }) : ae.length === 0 ? /* @__PURE__ */ l("p", { className: "py-10 text-center text-[12px] text-slate-400", children: "No eligible rows for the current record's filters." }) : /* @__PURE__ */ l("div", { className: "overflow-x-auto rounded-lg border border-slate-200", children: /* @__PURE__ */ k("table", { className: "w-full text-left text-[12px]", children: [
|
|
411
414
|
/* @__PURE__ */ l("thead", { children: /* @__PURE__ */ k("tr", { className: "border-b border-slate-200 bg-slate-50", children: [
|
|
412
|
-
|
|
415
|
+
Le.map((H, P) => /* @__PURE__ */ l(
|
|
413
416
|
"th",
|
|
414
417
|
{
|
|
415
418
|
className: "whitespace-nowrap px-2.5 py-1.5 text-[11px] font-medium text-slate-500",
|
|
416
|
-
children:
|
|
419
|
+
children: H.label ?? we((H.path ?? "").split(".").pop() ?? "")
|
|
417
420
|
},
|
|
418
421
|
P
|
|
419
422
|
)),
|
|
420
423
|
/* @__PURE__ */ l("th", { className: "whitespace-nowrap px-2.5 py-1.5 text-[11px] font-medium text-slate-500", children: s.value_label ?? "Allocate" })
|
|
421
424
|
] }) }),
|
|
422
425
|
/* @__PURE__ */ l("tbody", { className: "divide-y divide-slate-100", children: (() => {
|
|
423
|
-
const
|
|
424
|
-
let P = ae,
|
|
425
|
-
s.group_by && (
|
|
426
|
-
(me) => ae.filter((Q) =>
|
|
426
|
+
const H = (me) => s.group_by ? String(ki(me, s.group_by) ?? "—") : "";
|
|
427
|
+
let P = ae, R = [];
|
|
428
|
+
s.group_by && (R = [...new Set(ae.map(H))], P = R.flatMap(
|
|
429
|
+
(me) => ae.filter((Q) => H(Q) === me)
|
|
427
430
|
));
|
|
428
431
|
const C = Xe ?? new Set(
|
|
429
|
-
ae.filter((me) => De(String(me.id)).amount > 0).map(
|
|
432
|
+
ae.filter((me) => De(String(me.id)).amount > 0).map(H)
|
|
430
433
|
), he = (me) => Pe((Q) => {
|
|
431
434
|
const w = new Set(Q ?? C);
|
|
432
435
|
return w.has(me) ? w.delete(me) : w.add(me), w;
|
|
433
436
|
}), $ = [];
|
|
434
|
-
let
|
|
437
|
+
let Re = null;
|
|
435
438
|
for (const me of P) {
|
|
436
|
-
const Q = String(me.id), w =
|
|
437
|
-
if (s.group_by && w !==
|
|
438
|
-
|
|
439
|
-
const S = ae.filter((Ge) =>
|
|
439
|
+
const Q = String(me.id), w = H(me);
|
|
440
|
+
if (s.group_by && w !== Re) {
|
|
441
|
+
Re = w;
|
|
442
|
+
const S = ae.filter((Ge) => H(Ge) === w), E = S.filter(
|
|
440
443
|
(Ge) => De(String(Ge.id)).amount > 0
|
|
441
|
-
).length, ot =
|
|
444
|
+
).length, ot = Le.map(
|
|
442
445
|
(Ge) => !!Ge.formula || Ge.format === "currency"
|
|
443
|
-
), Bt = ot.indexOf(!0), Zt = Bt === -1 ?
|
|
444
|
-
const mt =
|
|
446
|
+
), Bt = ot.indexOf(!0), Zt = Bt === -1 ? Le.length : Math.max(1, Bt), Ei = (Ge) => {
|
|
447
|
+
const mt = Le[Ge];
|
|
445
448
|
let Oe = 0;
|
|
446
449
|
for (const Hn of S) {
|
|
447
450
|
const en = mt.formula ? Qe(mt.formula, Hn, ke(String(Hn.id))) : Number(ki(Hn, mt.path ?? ""));
|
|
@@ -490,7 +493,7 @@ function Ou({
|
|
|
490
493
|
]
|
|
491
494
|
}
|
|
492
495
|
) }),
|
|
493
|
-
|
|
496
|
+
Le.slice(Zt).map((Ge, mt) => /* @__PURE__ */ l(
|
|
494
497
|
"td",
|
|
495
498
|
{
|
|
496
499
|
className: "whitespace-nowrap px-2.5 py-1 text-[11px] font-semibold tabular-nums text-slate-600",
|
|
@@ -512,7 +515,7 @@ function Ou({
|
|
|
512
515
|
const Ut = De(Q), Vn = Ut.amount > 0 ? Ut.savedRow ?? {} : void 0, ft = ee[Q] ?? (Ut.amount > 0 ? String(Ut.amount) : "");
|
|
513
516
|
$.push(
|
|
514
517
|
/* @__PURE__ */ k("tr", { className: xe(Vn && "bg-nvr-cyan/5"), children: [
|
|
515
|
-
|
|
518
|
+
Le.map((S, E) => {
|
|
516
519
|
const ot = S.formula ? Qn(S.formula, me) : Iu(ki(me, S.path ?? ""), S.format);
|
|
517
520
|
return /* @__PURE__ */ l(
|
|
518
521
|
"td",
|
|
@@ -565,20 +568,20 @@ function Ou({
|
|
|
565
568
|
] }) })
|
|
566
569
|
] });
|
|
567
570
|
}
|
|
568
|
-
function
|
|
571
|
+
function Lu({
|
|
569
572
|
config: s,
|
|
570
573
|
rows: f,
|
|
571
574
|
relatedCollection: y,
|
|
572
|
-
computedWriteFields:
|
|
575
|
+
computedWriteFields: L,
|
|
573
576
|
applyRow: U
|
|
574
577
|
}) {
|
|
575
578
|
const z = $i(), [re, le] = B(!1), [J, M] = B(!1), oe = async () => {
|
|
576
579
|
M(!1);
|
|
577
|
-
const Me = Object.keys(s.set).filter((W) =>
|
|
580
|
+
const Me = Object.keys(s.set).filter((W) => L.has(W));
|
|
578
581
|
if (Me.length > 0) {
|
|
579
582
|
const W = Me[0];
|
|
580
583
|
be.error(
|
|
581
|
-
`${s.label}: "${W}" is calculated from ${
|
|
584
|
+
`${s.label}: "${W}" is calculated from ${L.get(W)} and cannot be set directly — target those fields instead`,
|
|
582
585
|
{ duration: 12e3 }
|
|
583
586
|
);
|
|
584
587
|
return;
|
|
@@ -622,8 +625,8 @@ function Ru({
|
|
|
622
625
|
continue;
|
|
623
626
|
}
|
|
624
627
|
const Xe = {};
|
|
625
|
-
for (const [Pe,
|
|
626
|
-
const tt = Wt(
|
|
628
|
+
for (const [Pe, Le] of Object.entries(s.set)) {
|
|
629
|
+
const tt = Wt(Le, ye);
|
|
627
630
|
tt != null && Number.isFinite(tt) && (Xe[Pe] = Math.round(tt * 100) / 100);
|
|
628
631
|
}
|
|
629
632
|
if (Object.keys(Xe).length === 0) {
|
|
@@ -675,11 +678,11 @@ function Ru({
|
|
|
675
678
|
}
|
|
676
679
|
);
|
|
677
680
|
}
|
|
678
|
-
function
|
|
681
|
+
function Ru({
|
|
679
682
|
config: s,
|
|
680
683
|
matchCfg: f,
|
|
681
684
|
rows: y,
|
|
682
|
-
parentId:
|
|
685
|
+
parentId: L,
|
|
683
686
|
parentDraft: U,
|
|
684
687
|
relatedCollection: z,
|
|
685
688
|
manyField: re
|
|
@@ -691,12 +694,12 @@ function Au({
|
|
|
691
694
|
...s.candidates.capacity_formula.matchAll(/\{\{\s*(\w+)\s*\}\}/g)
|
|
692
695
|
].map((Pe) => Pe[1]), fe = {};
|
|
693
696
|
let Fe = 0, _e = 0, ee = 0;
|
|
694
|
-
const ye = [], Xe = (Pe,
|
|
697
|
+
const ye = [], Xe = (Pe, Le) => Vc(le, f.collection, Pe, ie, Le);
|
|
695
698
|
try {
|
|
696
|
-
for (let
|
|
697
|
-
const tt = y[
|
|
698
|
-
if (!Number.isFinite(
|
|
699
|
-
const ae = Si(f, tt,
|
|
699
|
+
for (let Le = 0; Le < y.length; Le++) {
|
|
700
|
+
const tt = y[Le], Lt = Number(tt[s.row_qty_field]);
|
|
701
|
+
if (!Number.isFinite(Lt) || Lt <= 0) continue;
|
|
702
|
+
const ae = Si(f, tt, L, U);
|
|
700
703
|
if (!ae) continue;
|
|
701
704
|
const ut = await le.request(
|
|
702
705
|
ce(`/items/${f.collection}`, {
|
|
@@ -704,8 +707,8 @@ function Au({
|
|
|
704
707
|
fields: `id,${$e},${ie}`,
|
|
705
708
|
limit: 500
|
|
706
709
|
})
|
|
707
|
-
).then((P) => P.data ?? []), $t = ut.reduce((P,
|
|
708
|
-
let De =
|
|
710
|
+
).then((P) => P.data ?? []), $t = ut.reduce((P, R) => P + (Number(R[ie]) || 0), 0);
|
|
711
|
+
let De = Lt - $t;
|
|
709
712
|
if (De <= 0) continue;
|
|
710
713
|
const Be = Si(
|
|
711
714
|
{
|
|
@@ -714,7 +717,7 @@ function Au({
|
|
|
714
717
|
defaults: {}
|
|
715
718
|
},
|
|
716
719
|
tt,
|
|
717
|
-
|
|
720
|
+
L,
|
|
718
721
|
U
|
|
719
722
|
);
|
|
720
723
|
if (!Be) continue;
|
|
@@ -727,7 +730,7 @@ function Au({
|
|
|
727
730
|
})
|
|
728
731
|
).then((P) => P.data ?? []);
|
|
729
732
|
if (Qe.length === 0) {
|
|
730
|
-
ye.push(
|
|
733
|
+
ye.push(Le + 1);
|
|
731
734
|
continue;
|
|
732
735
|
}
|
|
733
736
|
const ke = Qe.map((P) => String(P.id)), Qn = await le.request(
|
|
@@ -738,17 +741,17 @@ function Au({
|
|
|
738
741
|
})
|
|
739
742
|
).then((P) => P.data ?? []), Et = {};
|
|
740
743
|
for (const P of Qn) {
|
|
741
|
-
const
|
|
742
|
-
Et[
|
|
744
|
+
const R = String(P[$e]);
|
|
745
|
+
Et[R] = (Et[R] ?? 0) + (Number(P[ie]) || 0);
|
|
743
746
|
}
|
|
744
|
-
const
|
|
747
|
+
const H = De;
|
|
745
748
|
for (const P of Qe) {
|
|
746
749
|
if (De <= 0) break;
|
|
747
|
-
const
|
|
750
|
+
const R = String(P.id), he = (Wt(s.candidates.capacity_formula, P) ?? 0) - (Et[R] ?? 0) - (fe[R] ?? 0);
|
|
748
751
|
if (he < Ie) continue;
|
|
749
|
-
const $ = Math.min(De, he),
|
|
750
|
-
if (
|
|
751
|
-
if (!await Xe(String(
|
|
752
|
+
const $ = Math.min(De, he), Re = ut.find((me) => String(me[$e]) === R);
|
|
753
|
+
if (Re) {
|
|
754
|
+
if (!await Xe(String(Re.id), $)) {
|
|
752
755
|
ee++;
|
|
753
756
|
continue;
|
|
754
757
|
}
|
|
@@ -756,16 +759,16 @@ function Au({
|
|
|
756
759
|
await le.request(
|
|
757
760
|
Ke(`/items/${f.collection}`, { ...ae.seed, [$e]: P.id, [ie]: $ })
|
|
758
761
|
);
|
|
759
|
-
fe[
|
|
762
|
+
fe[R] = (fe[R] ?? 0) + $, De -= $, Fe += $;
|
|
760
763
|
}
|
|
761
|
-
De <
|
|
764
|
+
De < H && _e++, De > 0 && ye.push(Le + 1);
|
|
762
765
|
}
|
|
763
766
|
const Pe = [];
|
|
764
767
|
Pe.push(
|
|
765
768
|
Fe > 0 ? `Allocated ${Fe.toLocaleString("en-US", { maximumFractionDigits: 2 })} across ${_e} row${_e === 1 ? "" : "s"}` : "Nothing to allocate"
|
|
766
769
|
), ye.length > 0 && Pe.push(`short on row${ye.length === 1 ? "" : "s"} ${ye.join(", ")}`), ee > 0 && Pe.push(
|
|
767
770
|
`${ee} allocation${ee === 1 ? "" : "s"} kept changing while this ran — left as saved; run again`
|
|
768
|
-
), W(Pe.join(" — ")), J.invalidateQueries({ queryKey: ["o2m-rows", z, re,
|
|
771
|
+
), W(Pe.join(" — ")), J.invalidateQueries({ queryKey: ["o2m-rows", z, re, L] }), J.invalidateQueries({ queryKey: ["match-agg"] });
|
|
769
772
|
} catch (Pe) {
|
|
770
773
|
W(`Auto-allocate failed: ${Jn(Pe, "unknown error")}`);
|
|
771
774
|
} finally {
|
|
@@ -786,7 +789,7 @@ function Au({
|
|
|
786
789
|
Me && /* @__PURE__ */ l("span", { className: "text-[11px] text-slate-500", children: Me })
|
|
787
790
|
] });
|
|
788
791
|
}
|
|
789
|
-
function
|
|
792
|
+
function Au(s) {
|
|
790
793
|
return s.filter(
|
|
791
794
|
(f) => f.group_key === "__apply_values__" && !zo.has(f.type ?? "") && !Bo.has(f.field) && !f.readonly && !(f.computed_type === "write" && f.computed_formula) && f.interface !== "formula-column" && f.interface !== "match-agg-column" && f.interface !== "relation-path"
|
|
792
795
|
);
|
|
@@ -795,7 +798,7 @@ function jf({
|
|
|
795
798
|
relatedCollection: s,
|
|
796
799
|
manyField: f,
|
|
797
800
|
parentId: y,
|
|
798
|
-
parentCollection:
|
|
801
|
+
parentCollection: L,
|
|
799
802
|
layoutId: U,
|
|
800
803
|
showRowRevisions: z,
|
|
801
804
|
rowComments: re,
|
|
@@ -817,9 +820,9 @@ function jf({
|
|
|
817
820
|
rowFilter: ye,
|
|
818
821
|
rowDefaults: Xe,
|
|
819
822
|
allocateDrawer: Pe,
|
|
820
|
-
autoAllocate:
|
|
823
|
+
autoAllocate: Le,
|
|
821
824
|
rowBulkActions: tt,
|
|
822
|
-
uploadTemplate:
|
|
825
|
+
uploadTemplate: Lt,
|
|
823
826
|
rowMatchPanel: ae,
|
|
824
827
|
lineSla: ut,
|
|
825
828
|
rowLints: $t,
|
|
@@ -829,14 +832,14 @@ function jf({
|
|
|
829
832
|
spreadRemaining: ke,
|
|
830
833
|
setAllRows: Qn,
|
|
831
834
|
submissionErrors: Et,
|
|
832
|
-
prefillParentId:
|
|
835
|
+
prefillParentId: H,
|
|
833
836
|
parentFieldKey: P,
|
|
834
|
-
readOnly:
|
|
837
|
+
readOnly: R = !1,
|
|
835
838
|
emptyLabel: C,
|
|
836
839
|
editorMode: he
|
|
837
840
|
}) {
|
|
838
841
|
var Kl, Pl;
|
|
839
|
-
const $ = $i(),
|
|
842
|
+
const $ = $i(), Re = oc(), me = Hd(), Q = sa(), w = eu(), Ut = tu(), Vn = nu(), ft = hc()[P ?? ""] ?? [], S = y === "new", E = Fd(), ot = Gd(), Bt = ic(), Zt = `nvr_grid_editor_${s}_${P ?? f}`, [Ei, Pr] = B(() => {
|
|
840
843
|
if (typeof localStorage > "u") return null;
|
|
841
844
|
try {
|
|
842
845
|
const e = localStorage.getItem(Zt);
|
|
@@ -845,9 +848,9 @@ function jf({
|
|
|
845
848
|
return null;
|
|
846
849
|
}
|
|
847
850
|
}), { data: Ge } = Ce({
|
|
848
|
-
queryKey: jr.fieldConfig(
|
|
849
|
-
queryFn: () => $.request(ce(`/field-config/${
|
|
850
|
-
enabled: he === void 0 && !!
|
|
851
|
+
queryKey: jr.fieldConfig(L ?? "", null),
|
|
852
|
+
queryFn: () => $.request(ce(`/field-config/${L}`)).then((e) => e.data ?? []),
|
|
853
|
+
enabled: he === void 0 && !!L && !!P,
|
|
851
854
|
staleTime: 5 * 6e4
|
|
852
855
|
}), mt = j(() => {
|
|
853
856
|
if (he) return he;
|
|
@@ -859,7 +862,7 @@ function jf({
|
|
|
859
862
|
}
|
|
860
863
|
})() : e.options : {};
|
|
861
864
|
return (n == null ? void 0 : n.editor_mode) === "split" ? "split" : "drawer";
|
|
862
|
-
}, [he, Ge, P]), Oe = !
|
|
865
|
+
}, [he, Ge, P]), Oe = !R && (Ei ?? mt) === "split", Hn = (e) => {
|
|
863
866
|
Pr(e);
|
|
864
867
|
try {
|
|
865
868
|
localStorage.setItem(Zt, e);
|
|
@@ -886,10 +889,10 @@ function jf({
|
|
|
886
889
|
}
|
|
887
890
|
), Ur = Y(null), Ho = Y(!1);
|
|
888
891
|
ne(() => {
|
|
889
|
-
if (
|
|
892
|
+
if (R || typeof window > "u") return;
|
|
890
893
|
const e = (n) => {
|
|
891
894
|
const t = n.detail;
|
|
892
|
-
if (!t || typeof t.target != "string" || !t.target ||
|
|
895
|
+
if (!t || typeof t.target != "string" || !t.target || L && t.collection !== L) return;
|
|
893
896
|
const r = P ?? f;
|
|
894
897
|
if (!(t.grid !== r && t.grid !== s)) {
|
|
895
898
|
if (t.handled = !0, !Ho.current) {
|
|
@@ -900,7 +903,7 @@ function jf({
|
|
|
900
903
|
}
|
|
901
904
|
};
|
|
902
905
|
return window.addEventListener("nvr:grid-apply-field", e), () => window.removeEventListener("nvr:grid-apply-field", e);
|
|
903
|
-
}, [
|
|
906
|
+
}, [R, L, P, f, s]), ne(() => {
|
|
904
907
|
const e = Fn.current;
|
|
905
908
|
if (!e || !Oe) return;
|
|
906
909
|
const n = (t) => {
|
|
@@ -916,9 +919,9 @@ function jf({
|
|
|
916
919
|
const t = new Set(n);
|
|
917
920
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
918
921
|
}), Co = Et ? Et.line_field ?? "line_number" : null, { data: Br } = Ce({
|
|
919
|
-
queryKey: ["erp-submissions",
|
|
920
|
-
queryFn: () => $.request(ce(`/erp-submissions/${
|
|
921
|
-
enabled: !!Et && !!
|
|
922
|
+
queryKey: ["erp-submissions", L ?? "", String(y)],
|
|
923
|
+
queryFn: () => $.request(ce(`/erp-submissions/${L}/${encodeURIComponent(String(y))}`)).then((e) => e.data ?? []),
|
|
924
|
+
enabled: !!Et && !!L && !S && !!y,
|
|
922
925
|
staleTime: 15e3
|
|
923
926
|
}), fa = j(() => {
|
|
924
927
|
const e = /* @__PURE__ */ new Map(), n = Br == null ? void 0 : Br[0];
|
|
@@ -942,16 +945,16 @@ function jf({
|
|
|
942
945
|
o && !e.has(o[1]) && e.set(o[1], o[2] || i.trim());
|
|
943
946
|
}
|
|
944
947
|
return e;
|
|
945
|
-
}, [Br]), Xo = Y(!1), [Zo, Ii] = B(S && !!
|
|
948
|
+
}, [Br]), Xo = Y(!1), [Zo, Ii] = B(S && !!H);
|
|
946
949
|
ne(() => {
|
|
947
950
|
if (!Xo.current) {
|
|
948
|
-
if (!S || !
|
|
951
|
+
if (!S || !H || !w) {
|
|
949
952
|
Ii(!1);
|
|
950
953
|
return;
|
|
951
954
|
}
|
|
952
955
|
Xo.current = !0, $.request(
|
|
953
956
|
ce(`/items/${s}`, {
|
|
954
|
-
filter: JSON.stringify({ [f]: { _eq:
|
|
957
|
+
filter: JSON.stringify({ [f]: { _eq: H } }),
|
|
955
958
|
limit: ra
|
|
956
959
|
})
|
|
957
960
|
).then((e) => {
|
|
@@ -1001,7 +1004,7 @@ function jf({
|
|
|
1001
1004
|
})
|
|
1002
1005
|
), p = new Set((d.data ?? []).map((m) => String(m.id)));
|
|
1003
1006
|
for (const m of e) {
|
|
1004
|
-
const h =
|
|
1007
|
+
const h = Rn(r, m);
|
|
1005
1008
|
(h == null ? void 0 : h.id) != null && p.add(String(h.id));
|
|
1006
1009
|
}
|
|
1007
1010
|
n.set(r, p);
|
|
@@ -1039,12 +1042,12 @@ function jf({
|
|
|
1039
1042
|
} catch {
|
|
1040
1043
|
be.error("Could not copy lines");
|
|
1041
1044
|
}
|
|
1042
|
-
}, ht =
|
|
1043
|
-
queryKey: ["o2m-row-revisions", s,
|
|
1045
|
+
}, ht = L && !S ? `?parent_collection=${encodeURIComponent(L)}&parent_id=${encodeURIComponent(y)}` : "", [Ae, Cn] = B(null), [ba, Oi] = B(null), [ns, zr] = B(!1), [ya, rs] = B(!1), { data: wa = [], isLoading: va } = Ce({
|
|
1046
|
+
queryKey: ["o2m-row-revisions", s, Ae == null ? void 0 : Ae.id],
|
|
1044
1047
|
queryFn: () => $.request(
|
|
1045
|
-
ce("/revisions", { collection: s, item: String(
|
|
1048
|
+
ce("/revisions", { collection: s, item: String(Ae == null ? void 0 : Ae.id) })
|
|
1046
1049
|
).then((e) => e.data ?? []),
|
|
1047
|
-
enabled: !!(
|
|
1050
|
+
enabled: !!(Ae != null && Ae.id),
|
|
1048
1051
|
staleTime: 15e3
|
|
1049
1052
|
}), { data: nn, isLoading: xa } = Ce({
|
|
1050
1053
|
queryKey: ["o2m-field-snapshots", s, f, y],
|
|
@@ -1091,7 +1094,7 @@ function jf({
|
|
|
1091
1094
|
rs(!1);
|
|
1092
1095
|
}
|
|
1093
1096
|
}
|
|
1094
|
-
|
|
1097
|
+
R && (oe = !1);
|
|
1095
1098
|
const Xn = j(
|
|
1096
1099
|
() => new Set(
|
|
1097
1100
|
(W ?? []).filter((e) => e.target_type === "lock").map((e) => e.target_field)
|
|
@@ -1127,7 +1130,7 @@ function jf({
|
|
|
1127
1130
|
},
|
|
1128
1131
|
[]
|
|
1129
1132
|
);
|
|
1130
|
-
const
|
|
1133
|
+
const Li = Y(0), bt = Y({
|
|
1131
1134
|
rowId: null,
|
|
1132
1135
|
seqs: /* @__PURE__ */ new Map()
|
|
1133
1136
|
});
|
|
@@ -1169,7 +1172,7 @@ function jf({
|
|
|
1169
1172
|
if (Qr)
|
|
1170
1173
|
return Qr(gt, () => os.current()), () => Qr(gt, null);
|
|
1171
1174
|
}, [Qr, gt]), ne(() => {
|
|
1172
|
-
if (!u ||
|
|
1175
|
+
if (!u || R) return;
|
|
1173
1176
|
const e = (n) => {
|
|
1174
1177
|
const t = n.target;
|
|
1175
1178
|
if (t) {
|
|
@@ -1185,7 +1188,7 @@ function jf({
|
|
|
1185
1188
|
}
|
|
1186
1189
|
};
|
|
1187
1190
|
return document.addEventListener("mousedown", e, !0), () => document.removeEventListener("mousedown", e, !0);
|
|
1188
|
-
}, [u,
|
|
1191
|
+
}, [u, R]);
|
|
1189
1192
|
const [qt, Sn] = B(!1), [ds, It] = B(null), [tr, Vr] = B(null), [cs, us] = B(!1);
|
|
1190
1193
|
async function $a() {
|
|
1191
1194
|
if (!tr) return;
|
|
@@ -1211,7 +1214,7 @@ function jf({
|
|
|
1211
1214
|
} : null
|
|
1212
1215
|
);
|
|
1213
1216
|
}
|
|
1214
|
-
const [Hr, nr] = B(null), ve = gc(), [
|
|
1217
|
+
const [Hr, nr] = B(null), ve = gc(), [Ri, Ea] = B(() => {
|
|
1215
1218
|
var e;
|
|
1216
1219
|
return $e === Mr ? Mr : $e && (se != null && se.some((n) => n.name === $e)) ? $e : (e = se == null ? void 0 : se[0]) == null ? void 0 : e.name;
|
|
1217
1220
|
});
|
|
@@ -1221,14 +1224,14 @@ function jf({
|
|
|
1221
1224
|
const yt = Y(null), rr = Y(!1), Fr = (e) => {
|
|
1222
1225
|
const n = e;
|
|
1223
1226
|
return !n || !(n instanceof HTMLElement) ? !1 : n.isConnected ? !!(n.closest("[data-o2m-editing]") || n.closest("[data-radix-popper-content-wrapper]") || n.closest("[data-nvr-combobox-panel]") || n.closest('[role="dialog"]') || n.closest("[data-omx-overlay]")) : !0;
|
|
1224
|
-
}, { data:
|
|
1227
|
+
}, { data: Ai } = Ce({
|
|
1225
1228
|
queryKey: ["auto-table-layout", s],
|
|
1226
1229
|
queryFn: () => $.request(
|
|
1227
1230
|
ce("/collection-layouts", { collection: s })
|
|
1228
1231
|
).then((e) => (e.data ?? []).find((n) => n.layout_type === "table") ?? null),
|
|
1229
1232
|
enabled: !U,
|
|
1230
1233
|
staleTime: 5 * 6e4
|
|
1231
|
-
}), on = U ?? (
|
|
1234
|
+
}), on = U ?? (Ai == null ? void 0 : Ai.id) ?? null, { data: de = [], isLoading: ms } = Ce({
|
|
1232
1235
|
queryKey: jr.fieldConfig(s, on),
|
|
1233
1236
|
queryFn: () => $.request(
|
|
1234
1237
|
ce(
|
|
@@ -1291,9 +1294,9 @@ function jf({
|
|
|
1291
1294
|
[$, s]
|
|
1292
1295
|
);
|
|
1293
1296
|
ne(() => {
|
|
1294
|
-
!S && !
|
|
1295
|
-
}, [Ne, st, S,
|
|
1296
|
-
const Ti = zd(ec) && !
|
|
1297
|
+
!S && !R && st.noteRows(Ne);
|
|
1298
|
+
}, [Ne, st, S, R]);
|
|
1299
|
+
const Ti = zd(ec) && !R && !S, qa = j(
|
|
1297
1300
|
() => Ti ? Ne.map((e) => String(e.id ?? "")).filter(Boolean) : [],
|
|
1298
1301
|
[Ne, Ti]
|
|
1299
1302
|
), ir = tc({
|
|
@@ -1339,26 +1342,26 @@ function jf({
|
|
|
1339
1342
|
}), Oa = !!(ut != null && ut.enabled) && typeof (ut == null ? void 0 : ut.field) == "string", { data: lt } = Ce({
|
|
1340
1343
|
queryKey: [
|
|
1341
1344
|
"line-aging",
|
|
1342
|
-
|
|
1345
|
+
L ?? "",
|
|
1343
1346
|
P ?? f,
|
|
1344
1347
|
y,
|
|
1345
1348
|
zt
|
|
1346
1349
|
],
|
|
1347
1350
|
queryFn: () => $.request(
|
|
1348
1351
|
ce("/sla/line-aging", {
|
|
1349
|
-
collection:
|
|
1352
|
+
collection: L ?? "",
|
|
1350
1353
|
field: P ?? f,
|
|
1351
1354
|
parent_id: y
|
|
1352
1355
|
})
|
|
1353
1356
|
).then((e) => e.data ?? null),
|
|
1354
|
-
enabled: Oa && !S && !!
|
|
1357
|
+
enabled: Oa && !S && !!L,
|
|
1355
1358
|
staleTime: 6e4,
|
|
1356
1359
|
placeholderData: (e) => e
|
|
1357
1360
|
}), gs = j(
|
|
1358
1361
|
() => new Set(lt != null && lt.overdue ? lt.overdue_ids : []),
|
|
1359
1362
|
[lt]
|
|
1360
|
-
), bs = lt != null && lt.overdue ? `${lt.label} still missing · ${lt.days} ${lt.days === 1 ? "day" : "days"} on the clock (limit ${lt.threshold_days})` : void 0, Pi = (qn == null ? void 0 : qn.data) ?? {},
|
|
1361
|
-
const n =
|
|
1363
|
+
), bs = lt != null && lt.overdue ? `${lt.label} still missing · ${lt.days} ${lt.days === 1 ? "day" : "days"} on the clock (limit ${lt.threshold_days})` : void 0, Pi = (qn == null ? void 0 : qn.data) ?? {}, La = (qn == null ? void 0 : qn.created) ?? {}, Yr = (e) => {
|
|
1364
|
+
const n = La[e];
|
|
1362
1365
|
if (!n) return null;
|
|
1363
1366
|
const t = du(n.comment);
|
|
1364
1367
|
return t ? `From ${t.template} · ${Hl(n.at)} by ${n.who}` : null;
|
|
@@ -1407,35 +1410,35 @@ function jf({
|
|
|
1407
1410
|
o.labels.push(i), o.keys.push(r.parent_field);
|
|
1408
1411
|
}
|
|
1409
1412
|
return e;
|
|
1410
|
-
}, [dn, Ye, E == null ? void 0 : E.fieldLabels]), D = J === "pending", K = w ? w.getPendingRows(s, f) : [],
|
|
1413
|
+
}, [dn, Ye, E == null ? void 0 : E.fieldLabels]), D = J === "pending", K = w ? w.getPendingRows(s, f) : [], F = D && w ? w.getPendingEdits(s, f) : /* @__PURE__ */ new Map(), [Xr, Zr] = B({});
|
|
1411
1414
|
ne(() => {
|
|
1412
1415
|
Ve.current || Zr({});
|
|
1413
1416
|
}, [zt]);
|
|
1414
|
-
const je = D && w ? w.getPendingDeletes(s, f) : /* @__PURE__ */ new Set(), [sr, ws] = B(""), Di = Y(null), lr = Jd(sr),
|
|
1417
|
+
const je = D && w ? w.getPendingDeletes(s, f) : /* @__PURE__ */ new Set(), [sr, ws] = B(""), Di = Y(null), lr = Jd(sr), Ra = Ec(sr.trim(), 300), Wi = j(() => qc(lr), [lr]), cn = !S && Ne.length >= Ko, vs = j(
|
|
1415
1418
|
() => sn ? { _and: [{ [f]: { _eq: y } }, sn] } : { [f]: { _eq: y } },
|
|
1416
1419
|
[sn, f, y]
|
|
1417
1420
|
), at = Ic({
|
|
1418
1421
|
client: $,
|
|
1419
1422
|
collection: s,
|
|
1420
1423
|
filter: vs,
|
|
1421
|
-
query:
|
|
1424
|
+
query: Ra,
|
|
1422
1425
|
enabled: cn,
|
|
1423
1426
|
version: zt
|
|
1424
|
-
}),
|
|
1427
|
+
}), Aa = Oc({
|
|
1425
1428
|
client: $,
|
|
1426
1429
|
collection: s,
|
|
1427
1430
|
filter: vs,
|
|
1428
1431
|
enabled: cn,
|
|
1429
1432
|
version: zt
|
|
1430
|
-
}), ja = Y(/* @__PURE__ */ new Map()), Ta = [...
|
|
1433
|
+
}), ja = Y(/* @__PURE__ */ new Map()), Ta = [...F.keys()].sort().join(","), Ui = (u == null ? void 0 : u.rowId) ?? null, Ma = (at.rows ?? []).map((e) => String(e.id)).join(","), Jt = j(() => {
|
|
1431
1434
|
const e = ja.current;
|
|
1432
1435
|
for (const n of [...e.keys()])
|
|
1433
|
-
n !== Ui && !
|
|
1436
|
+
n !== Ui && !F.has(n) && e.delete(n);
|
|
1434
1437
|
for (const n of at.rows ?? []) {
|
|
1435
1438
|
const t = String(n.id);
|
|
1436
|
-
(t === Ui ||
|
|
1439
|
+
(t === Ui || F.has(t)) && e.set(t, n);
|
|
1437
1440
|
}
|
|
1438
|
-
return
|
|
1441
|
+
return Lc(Ne, at.rows, [...e.values()]);
|
|
1439
1442
|
}, [Ne, Ma, Ui, Ta]), In = j(
|
|
1440
1443
|
() => new Set(Jt.map((e) => String(e.id))),
|
|
1441
1444
|
[Jt]
|
|
@@ -1444,8 +1447,8 @@ function jf({
|
|
|
1444
1447
|
[Ne, Jt]
|
|
1445
1448
|
);
|
|
1446
1449
|
ne(() => {
|
|
1447
|
-
!S && !
|
|
1448
|
-
}, [Jt, st, S,
|
|
1450
|
+
!S && !R && Jt.length && st.noteRows(Jt);
|
|
1451
|
+
}, [Jt, st, S, R]);
|
|
1449
1452
|
const Bi = Y(/* @__PURE__ */ new Set()), xs = Y(null);
|
|
1450
1453
|
ne(() => {
|
|
1451
1454
|
Bi.current = /* @__PURE__ */ new Set();
|
|
@@ -1595,13 +1598,13 @@ function jf({
|
|
|
1595
1598
|
let e = wt ? Qt.map((n) => ({ ...n, ...wt[String(n.id)] ?? {} })) : Qt;
|
|
1596
1599
|
if (X) {
|
|
1597
1600
|
const n = (t) => {
|
|
1598
|
-
const r = D ?
|
|
1601
|
+
const r = D ? F.get(String(t.id)) : void 0, i = (r == null ? void 0 : r[X]) ?? t[X];
|
|
1599
1602
|
return Number(i ?? -1);
|
|
1600
1603
|
};
|
|
1601
1604
|
e = [...e].sort((t, r) => n(t) - n(r));
|
|
1602
1605
|
}
|
|
1603
1606
|
if (fe && (e = [...e].sort((n, t) => {
|
|
1604
|
-
const r = D ?
|
|
1607
|
+
const r = D ? F.get(String(n.id)) : void 0, i = D ? F.get(String(t.id)) : void 0, o = (r == null ? void 0 : r[fe]) ?? n[fe], a = (i == null ? void 0 : i[fe]) ?? t[fe];
|
|
1605
1608
|
let c = 0;
|
|
1606
1609
|
return o == null && a == null ? c = 0 : o == null ? c = 1 : a == null ? c = -1 : typeof o == "number" && typeof a == "number" ? c = o - a : c = String(o).localeCompare(String(a), void 0, { sensitivity: "base" }), Fe === "desc" ? -c : c;
|
|
1607
1610
|
})), _e && wt) {
|
|
@@ -1617,7 +1620,7 @@ function jf({
|
|
|
1617
1620
|
wt,
|
|
1618
1621
|
X,
|
|
1619
1622
|
D,
|
|
1620
|
-
|
|
1623
|
+
F,
|
|
1621
1624
|
fe,
|
|
1622
1625
|
Fe,
|
|
1623
1626
|
_e
|
|
@@ -1643,7 +1646,7 @@ function jf({
|
|
|
1643
1646
|
const r = vi(t.options) ?? {}, i = r.aggregate;
|
|
1644
1647
|
if (!i || t.interface === "formula-column" || t.interface === "match-agg-column") continue;
|
|
1645
1648
|
const o = e.map((d) => {
|
|
1646
|
-
const p = String(d.id), m =
|
|
1649
|
+
const p = String(d.id), m = F.has(p) ? { ...d, ...F.get(p) } : d;
|
|
1647
1650
|
return Number(ge(m)[t.field]);
|
|
1648
1651
|
}).filter((d) => !Number.isNaN(d));
|
|
1649
1652
|
let a = null;
|
|
@@ -1697,13 +1700,13 @@ function jf({
|
|
|
1697
1700
|
junctionOtherField: t.many_field
|
|
1698
1701
|
};
|
|
1699
1702
|
}
|
|
1700
|
-
const Gi = JSON.stringify([...
|
|
1703
|
+
const Gi = JSON.stringify([...F.entries()]) + "|" + [...je].sort().join(",") + "|" + JSON.stringify(K), cr = (e, n = []) => {
|
|
1701
1704
|
var o;
|
|
1702
1705
|
if (!X) return e;
|
|
1703
1706
|
const t = new Set(n);
|
|
1704
1707
|
for (const a of O) {
|
|
1705
1708
|
const c = Number(
|
|
1706
|
-
(D ? (o =
|
|
1709
|
+
(D ? (o = F.get(String(a.id))) == null ? void 0 : o[X] : void 0) ?? a[X]
|
|
1707
1710
|
);
|
|
1708
1711
|
Number.isFinite(c) && t.add(c);
|
|
1709
1712
|
}
|
|
@@ -1725,7 +1728,7 @@ function jf({
|
|
|
1725
1728
|
}, Yi = j(() => {
|
|
1726
1729
|
const e = [
|
|
1727
1730
|
...(O ?? []).filter((n) => !je.has(String(n.id)) && !In.has(String(n.id))).map((n) => {
|
|
1728
|
-
const t = String(n.id), r =
|
|
1731
|
+
const t = String(n.id), r = F.has(t) ? { ...n, ...F.get(t) } : n;
|
|
1729
1732
|
return ge(r);
|
|
1730
1733
|
}),
|
|
1731
1734
|
...K.map((n) => ge(n))
|
|
@@ -1744,25 +1747,25 @@ function jf({
|
|
|
1744
1747
|
e.baseRows ? n : void 0
|
|
1745
1748
|
)
|
|
1746
1749
|
) : Yi;
|
|
1747
|
-
}, [ve, ft, Yi]), Os = Ne.length >= Ko,
|
|
1750
|
+
}, [ve, ft, Yi]), Os = Ne.length >= Ko, Rt = E == null ? void 0 : E.draft, fn = Dt(
|
|
1748
1751
|
(e) => {
|
|
1749
1752
|
if (e.startsWith("$parent."))
|
|
1750
|
-
return (
|
|
1753
|
+
return (Rt == null ? void 0 : Rt[e.slice(8)]) ?? 0;
|
|
1751
1754
|
if (e.startsWith("$sum.")) {
|
|
1752
1755
|
const n = e.slice(5);
|
|
1753
1756
|
return ur.reduce((t, r) => t + (Number(r[n]) || 0), 0);
|
|
1754
1757
|
}
|
|
1755
|
-
return e === "$count" ? ur.length :
|
|
1758
|
+
return e === "$count" ? ur.length : Rt == null ? void 0 : Rt[e];
|
|
1756
1759
|
},
|
|
1757
|
-
[
|
|
1760
|
+
[Rt, ur]
|
|
1758
1761
|
), Ci = j(() => De != null && De.length ? De.map((e) => ({ ...e, result: ct(e.value, fn) })) : null, [De, fn]), ti = j(
|
|
1759
|
-
() => Be != null && Be.endpoint ? bc(Be.endpoint,
|
|
1760
|
-
[Be == null ? void 0 : Be.endpoint,
|
|
1762
|
+
() => Be != null && Be.endpoint ? bc(Be.endpoint, Rt) : null,
|
|
1763
|
+
[Be == null ? void 0 : Be.endpoint, Rt]
|
|
1761
1764
|
), Xi = yc({
|
|
1762
1765
|
client: $,
|
|
1763
1766
|
endpoint: ti,
|
|
1764
1767
|
enabled: !!Be && !S
|
|
1765
|
-
}),
|
|
1768
|
+
}), A = Be && !S ? Xi.data ?? null : null, Ls = !!Be && !S && !!ti && Xi.isLoading, Rs = !!Be && !S && Xi.isError, fr = Dt(
|
|
1766
1769
|
(e) => e.label || we(e.field),
|
|
1767
1770
|
[]
|
|
1768
1771
|
), { isAdmin: On } = zl(), ni = Dt(
|
|
@@ -1772,9 +1775,9 @@ function jf({
|
|
|
1772
1775
|
},
|
|
1773
1776
|
[On]
|
|
1774
1777
|
), Zi = Dt(
|
|
1775
|
-
(e, n) => !!(
|
|
1776
|
-
[
|
|
1777
|
-
),
|
|
1778
|
+
(e, n) => !!(A != null && A.closed_locked) && !On && A.columns.includes(e) && Xt(A, n[A.key_field], e),
|
|
1779
|
+
[A, On]
|
|
1780
|
+
), Ln = Dt(
|
|
1778
1781
|
async (e, n, t) => {
|
|
1779
1782
|
if (e.startsWith("pending:")) {
|
|
1780
1783
|
const r = Number(e.slice(8)), i = K[r];
|
|
@@ -1805,7 +1808,7 @@ function jf({
|
|
|
1805
1808
|
},
|
|
1806
1809
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1807
1810
|
[K, w, D, s, f, $, Q, y]
|
|
1808
|
-
), mr = ti ? `nvr_compare_dismiss:${ti}` : null, [
|
|
1811
|
+
), mr = ti ? `nvr_compare_dismiss:${ti}` : null, [As, za] = B(() => {
|
|
1809
1812
|
try {
|
|
1810
1813
|
return !mr || typeof window > "u" ? /* @__PURE__ */ new Set() : new Set(JSON.parse(window.localStorage.getItem(mr) ?? "[]"));
|
|
1811
1814
|
} catch {
|
|
@@ -1813,10 +1816,10 @@ function jf({
|
|
|
1813
1816
|
}
|
|
1814
1817
|
}), js = j(
|
|
1815
1818
|
// `add` proposals need the plan grid's per-period arithmetic; the flat grid only fills.
|
|
1816
|
-
() => ((
|
|
1817
|
-
(e) => e.mode !== "add" && !
|
|
1819
|
+
() => ((A == null ? void 0 : A.proposals) ?? []).filter(
|
|
1820
|
+
(e) => e.mode !== "add" && !As.has(e.id)
|
|
1818
1821
|
),
|
|
1819
|
-
[
|
|
1822
|
+
[A == null ? void 0 : A.proposals, As]
|
|
1820
1823
|
), eo = Dt(
|
|
1821
1824
|
(e, n = !0) => {
|
|
1822
1825
|
za((t) => {
|
|
@@ -1832,16 +1835,16 @@ function jf({
|
|
|
1832
1835
|
[mr]
|
|
1833
1836
|
), Ja = Dt(
|
|
1834
1837
|
(e) => {
|
|
1835
|
-
if (!
|
|
1836
|
-
const n =
|
|
1838
|
+
if (!A) return;
|
|
1839
|
+
const n = A.key_field, t = e.change_reason ?? e.label, r = (a) => a == null || a === "" || Number(a) === 0;
|
|
1837
1840
|
let i = 0;
|
|
1838
1841
|
const o = (w == null ? void 0 : w.getPendingEdits(s, f)) ?? /* @__PURE__ */ new Map();
|
|
1839
1842
|
for (const a of e.rows) {
|
|
1840
1843
|
if (a.category != null) continue;
|
|
1841
1844
|
const c = O.find((h) => String(h[n]) === String(a.key)), d = K.findIndex((h) => String(h[n]) === String(a.key)), p = c ? { ...c, ...o.get(String(c.id)) ?? {} } : d >= 0 ? K[d] : null, m = {};
|
|
1842
1845
|
for (const [h, g] of Object.entries(a.values))
|
|
1843
|
-
Xt(
|
|
1844
|
-
Object.keys(m).length !== 0 && (i++, c ?
|
|
1846
|
+
Xt(A, a.key, h) || p && !r(p[h]) || (m[h] = g);
|
|
1847
|
+
Object.keys(m).length !== 0 && (i++, c ? Ln(String(c.id), m, t) : d >= 0 ? Ln(`pending:${d}`, m, t) : w && w.queueRow(
|
|
1845
1848
|
s,
|
|
1846
1849
|
f,
|
|
1847
1850
|
cr(ge({ [n]: a.key, ...m, _change_reason: t }))
|
|
@@ -1853,13 +1856,13 @@ function jf({
|
|
|
1853
1856
|
},
|
|
1854
1857
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1855
1858
|
[
|
|
1856
|
-
|
|
1859
|
+
A,
|
|
1857
1860
|
O,
|
|
1858
1861
|
K,
|
|
1859
1862
|
w,
|
|
1860
1863
|
s,
|
|
1861
1864
|
f,
|
|
1862
|
-
|
|
1865
|
+
Ln,
|
|
1863
1866
|
eo
|
|
1864
1867
|
]
|
|
1865
1868
|
), Qa = Dt(
|
|
@@ -1868,7 +1871,7 @@ function jf({
|
|
|
1868
1871
|
if (!((_ = ke == null ? void 0 : ke.fields) != null && _.length)) return;
|
|
1869
1872
|
const n = ct(ke.remaining, fn), t = n == null || !Number.isFinite(n) ? 0 : Math.round(n * 100) / 100;
|
|
1870
1873
|
if (t <= 0) return;
|
|
1871
|
-
const r = ke.only_empty !== !1, i = (x) => x == null || x === "" || Number(x) === 0, o = (w == null ? void 0 : w.getPendingEdits(s, f)) ?? /* @__PURE__ */ new Map(), a = (w == null ? void 0 : w.getPendingDeletes(s, f)) ?? /* @__PURE__ */ new Set(), c =
|
|
1874
|
+
const r = ke.only_empty !== !1, i = (x) => x == null || x === "" || Number(x) === 0, o = (w == null ? void 0 : w.getPendingEdits(s, f)) ?? /* @__PURE__ */ new Map(), a = (w == null ? void 0 : w.getPendingDeletes(s, f)) ?? /* @__PURE__ */ new Set(), c = A == null ? void 0 : A.key_field, d = [];
|
|
1872
1875
|
for (const x of O) {
|
|
1873
1876
|
const N = String(x.id);
|
|
1874
1877
|
a.has(N) || d.push({ id: N, row: { ...x, ...o.get(N) ?? {} } });
|
|
@@ -1877,7 +1880,7 @@ function jf({
|
|
|
1877
1880
|
const p = [], m = [];
|
|
1878
1881
|
for (const x of d)
|
|
1879
1882
|
for (const N of ke.fields)
|
|
1880
|
-
r && !i(x.row[N]) ||
|
|
1883
|
+
r && !i(x.row[N]) || A && Xt(A, x.row[A.key_field], N) || (p.push({ id: x.id, field: N }), m.push(0));
|
|
1881
1884
|
if (p.length === 0) {
|
|
1882
1885
|
be.message("Nothing to spread into — every target is filled or closed");
|
|
1883
1886
|
return;
|
|
@@ -1893,7 +1896,7 @@ function jf({
|
|
|
1893
1896
|
q[x.field] = h[N], g.set(x.id, q);
|
|
1894
1897
|
});
|
|
1895
1898
|
for (const [x, N] of g)
|
|
1896
|
-
|
|
1899
|
+
Ln(
|
|
1897
1900
|
x,
|
|
1898
1901
|
N,
|
|
1899
1902
|
`${ke.label ?? "Spread remaining"} across ${g.size} rows`
|
|
@@ -1909,10 +1912,10 @@ function jf({
|
|
|
1909
1912
|
w,
|
|
1910
1913
|
s,
|
|
1911
1914
|
f,
|
|
1912
|
-
|
|
1915
|
+
A,
|
|
1913
1916
|
O,
|
|
1914
1917
|
K,
|
|
1915
|
-
|
|
1918
|
+
Ln
|
|
1916
1919
|
]
|
|
1917
1920
|
), mn = Ut == null ? void 0 : Ut.report;
|
|
1918
1921
|
ne(() => {
|
|
@@ -1924,7 +1927,7 @@ function jf({
|
|
|
1924
1927
|
mn(s, f, ur);
|
|
1925
1928
|
}
|
|
1926
1929
|
}, [mn, s, f, ur, Os, an]);
|
|
1927
|
-
const
|
|
1930
|
+
const At = ru(), ri = `${s}.${f}`, Ts = At == null ? void 0 : At.lineInputs(ri), pr = At == null ? void 0 : At.reportLines;
|
|
1928
1931
|
ne(() => {
|
|
1929
1932
|
if (!pr || !Ts) return;
|
|
1930
1933
|
const e = (t) => {
|
|
@@ -1935,7 +1938,7 @@ function jf({
|
|
|
1935
1938
|
for (const t of O ?? []) {
|
|
1936
1939
|
const r = String(t.id);
|
|
1937
1940
|
if (je.has(r) || In.has(r)) continue;
|
|
1938
|
-
const i = { ...t, ...
|
|
1941
|
+
const i = { ...t, ...F.get(r) ?? {} };
|
|
1939
1942
|
n.push({
|
|
1940
1943
|
key: r,
|
|
1941
1944
|
values: e((u == null ? void 0 : u.rowId) === r ? { ...i, ...u.draft } : i)
|
|
@@ -1954,7 +1957,7 @@ function jf({
|
|
|
1954
1957
|
Ms.current = () => pr == null ? void 0 : pr(ri, null), ne(() => () => Ms.current(), []);
|
|
1955
1958
|
const hr = (e, n, t, r) => {
|
|
1956
1959
|
var i, o;
|
|
1957
|
-
return r || !iu(t) ? null : ((o = (i =
|
|
1960
|
+
return r || !iu(t) ? null : ((o = (i = At == null ? void 0 : At.lines[ri]) == null ? void 0 : i.rows[e]) == null ? void 0 : o[n]) ?? null;
|
|
1958
1961
|
}, Ks = Y(() => {
|
|
1959
1962
|
});
|
|
1960
1963
|
Ks.current = () => mn == null ? void 0 : mn(s, f, null), ne(() => () => Ks.current(), []);
|
|
@@ -2007,7 +2010,7 @@ function jf({
|
|
|
2007
2010
|
}, [gr, Ps, E == null ? void 0 : E.draft]), Ds = xn({
|
|
2008
2011
|
queries: Va.map(([e, n]) => ({
|
|
2009
2012
|
queryKey: ["pinned-parent", n.collection, n.id, [...n.fields].sort().join(",")],
|
|
2010
|
-
queryFn: () =>
|
|
2013
|
+
queryFn: () => Re(n.collection, n.id, [...n.fields]).then((t) => [e, t]).catch(() => [e, null]),
|
|
2011
2014
|
staleTime: 6e4
|
|
2012
2015
|
}))
|
|
2013
2016
|
}), ii = j(() => {
|
|
@@ -2028,19 +2031,19 @@ function jf({
|
|
|
2028
2031
|
return { id: d, tag: o.tag ?? "Default" };
|
|
2029
2032
|
}
|
|
2030
2033
|
return null;
|
|
2031
|
-
},
|
|
2034
|
+
}, Rn = (e, n) => {
|
|
2032
2035
|
const t = gr.get(e);
|
|
2033
2036
|
return t ? Ws(t, n) : null;
|
|
2034
2037
|
}, Se = de.filter(
|
|
2035
2038
|
(e) => !e.hidden && (!zo.has(e.type) || dr(e.interface)) && e.field !== f && e.field !== "id" && (!on || e.layout_assigned === !0) && !Bo.has(e.field) && !Ba.has(e.group_key ?? "")
|
|
2036
|
-
), jt = se && se.length >= 2 &&
|
|
2039
|
+
), jt = se && se.length >= 2 && Ri !== Mr ? se.find((e) => e.name === Ri) : void 0, Ha = new Set(
|
|
2037
2040
|
(ie ?? []).map((e) => typeof e == "string" ? e : e.field)
|
|
2038
2041
|
), Us = jt ? new Set(
|
|
2039
2042
|
jt.columns.filter((e) => {
|
|
2040
2043
|
const n = e.indexOf(".");
|
|
2041
2044
|
return n < 0 ? !0 : !Ha.has(e.slice(0, n));
|
|
2042
2045
|
})
|
|
2043
|
-
) : null, Bs = Us ? Se.filter((e) => Us.has(e.field)) : [],
|
|
2046
|
+
) : null, Bs = Us ? Se.filter((e) => Us.has(e.field)) : [], An = j(() => {
|
|
2044
2047
|
if (!jt) return [];
|
|
2045
2048
|
const e = [];
|
|
2046
2049
|
for (const n of jt.columns) {
|
|
@@ -2053,8 +2056,8 @@ function jf({
|
|
|
2053
2056
|
}
|
|
2054
2057
|
return e;
|
|
2055
2058
|
}, [jt, ie]), pn = j(
|
|
2056
|
-
() => [...new Set(
|
|
2057
|
-
[
|
|
2059
|
+
() => [...new Set(An.map((e) => e.relationField))],
|
|
2060
|
+
[An]
|
|
2058
2061
|
), Tt = j(() => {
|
|
2059
2062
|
const e = /* @__PURE__ */ new Map();
|
|
2060
2063
|
for (const n of pn) {
|
|
@@ -2104,7 +2107,7 @@ function jf({
|
|
|
2104
2107
|
const t = Tt.get(n);
|
|
2105
2108
|
if (!t) continue;
|
|
2106
2109
|
const r = Vs.get(t.grandCollection) ?? [], i = /* @__PURE__ */ new Map();
|
|
2107
|
-
for (const o of
|
|
2110
|
+
for (const o of An) {
|
|
2108
2111
|
if (o.relationField !== n) continue;
|
|
2109
2112
|
const a = r.find(
|
|
2110
2113
|
(c) => c.many_collection === t.grandCollection && c.many_field === o.memberField && !c.junction_field
|
|
@@ -2114,7 +2117,7 @@ function jf({
|
|
|
2114
2117
|
e.set(n, i);
|
|
2115
2118
|
}
|
|
2116
2119
|
return e;
|
|
2117
|
-
}, [pn, Tt, Vs,
|
|
2120
|
+
}, [pn, Tt, Vs, An]), si = j(() => O.map((e) => String(e.id)), [O]), br = j(
|
|
2118
2121
|
() => `nvr-gf-${Math.abs(Eu(`${s}:${P ?? f}`)) % 1e5}`,
|
|
2119
2122
|
[s, P, f]
|
|
2120
2123
|
), Hs = j(() => {
|
|
@@ -2211,7 +2214,7 @@ function jf({
|
|
|
2211
2214
|
const m = n(ge(d), a);
|
|
2212
2215
|
for (const h of p) c.created.push({ ...h, ...m });
|
|
2213
2216
|
}
|
|
2214
|
-
for (const [d, p] of
|
|
2217
|
+
for (const [d, p] of F) {
|
|
2215
2218
|
const m = p[`__nested_ops_${i}`];
|
|
2216
2219
|
if (!m) continue;
|
|
2217
2220
|
const h = O.find((_) => String(_.id) === d), g = n(
|
|
@@ -2250,7 +2253,7 @@ function jf({
|
|
|
2250
2253
|
for (const [d, p] of i)
|
|
2251
2254
|
p.one_collection && n(p.one_collection, c[d]);
|
|
2252
2255
|
}
|
|
2253
|
-
for (const [, o] of
|
|
2256
|
+
for (const [, o] of F) {
|
|
2254
2257
|
const a = o[`__nested_ops_${t}`];
|
|
2255
2258
|
if (a)
|
|
2256
2259
|
for (const c of [...a.created ?? [], ...(a.updated ?? []).map((d) => d.changes)])
|
|
@@ -2266,7 +2269,7 @@ function jf({
|
|
|
2266
2269
|
}
|
|
2267
2270
|
for (const [t, r] of e) e.set(t, [...new Set(r)].sort());
|
|
2268
2271
|
return e;
|
|
2269
|
-
}, [ai, oi, K,
|
|
2272
|
+
}, [ai, oi, K, F, Xr]), { data: Cs = {} } = Ce({
|
|
2270
2273
|
queryKey: [
|
|
2271
2274
|
"summary-m2o-display",
|
|
2272
2275
|
s,
|
|
@@ -2307,7 +2310,7 @@ function jf({
|
|
|
2307
2310
|
enabled: !!s,
|
|
2308
2311
|
staleTime: 10 * 6e4
|
|
2309
2312
|
}), Xs = j(
|
|
2310
|
-
() =>
|
|
2313
|
+
() => An.map(({ relationField: e, memberField: n }) => {
|
|
2311
2314
|
const t = Tt.get(e), i = (t ? Qs.get(t.grandCollection) ?? [] : []).find((o) => o.field === n);
|
|
2312
2315
|
return {
|
|
2313
2316
|
field: `${e}.${n}`,
|
|
@@ -2328,7 +2331,7 @@ function jf({
|
|
|
2328
2331
|
dependency_config: null
|
|
2329
2332
|
};
|
|
2330
2333
|
}),
|
|
2331
|
-
[
|
|
2334
|
+
[An, Tt, Qs]
|
|
2332
2335
|
);
|
|
2333
2336
|
function rt(e) {
|
|
2334
2337
|
return e.type === "presentation" && e.field.includes(".");
|
|
@@ -2341,7 +2344,7 @@ function jf({
|
|
|
2341
2344
|
}
|
|
2342
2345
|
const r = String(n.id), i = Xr[`${r}|${e}`];
|
|
2343
2346
|
if (i) return i;
|
|
2344
|
-
const o = ((p = ai.get(e)) == null ? void 0 : p.get(r)) ?? [], a = (m =
|
|
2347
|
+
const o = ((p = ai.get(e)) == null ? void 0 : p.get(r)) ?? [], a = (m = F.get(r)) == null ? void 0 : m[`__nested_ops_${e}`];
|
|
2345
2348
|
if (!a) return o;
|
|
2346
2349
|
const c = new Set((a.deleted ?? []).map(String)), d = new Map((a.updated ?? []).map((h) => [String(h.id), h.changes]));
|
|
2347
2350
|
return [
|
|
@@ -2513,17 +2516,17 @@ function jf({
|
|
|
2513
2516
|
const p = r.get(d) ?? {}, m = hu(
|
|
2514
2517
|
p,
|
|
2515
2518
|
d === o ? (i == null ? void 0 : i.draft) ?? null : null,
|
|
2516
|
-
|
|
2519
|
+
F.get(d) ?? null,
|
|
2517
2520
|
/* @__PURE__ */ new Set([f])
|
|
2518
2521
|
);
|
|
2519
|
-
d === o && (We(null), It(null)),
|
|
2522
|
+
d === o && (We(null), It(null)), F.has(d) && (w == null || w.cancelPendingEdit(s, f, d));
|
|
2520
2523
|
const h = gu(t, n, d), g = typeof document < "u" && (document.activeElement === document.body || document.activeElement == null);
|
|
2521
2524
|
h && (a === d || g) && window.setTimeout(() => {
|
|
2522
2525
|
var _;
|
|
2523
2526
|
(_ = document.querySelector(`[data-o2m-row="${s}:${h}"]`)) == null || _.focus({ preventScroll: !0 });
|
|
2524
2527
|
}, 0), a === d && (so.current = h), xr({
|
|
2525
2528
|
rowId: d,
|
|
2526
|
-
label:
|
|
2529
|
+
label: Lr(p),
|
|
2527
2530
|
lineNumber: t.indexOf(d) + 1,
|
|
2528
2531
|
row: bu(p, m),
|
|
2529
2532
|
changes: m,
|
|
@@ -2556,7 +2559,7 @@ function jf({
|
|
|
2556
2559
|
return ((n = de.find((t) => t.field === e)) == null ? void 0 : n.label) || we(e);
|
|
2557
2560
|
},
|
|
2558
2561
|
selfId: td,
|
|
2559
|
-
readOnly:
|
|
2562
|
+
readOnly: R,
|
|
2560
2563
|
onRestore: (e) => {
|
|
2561
2564
|
yo(e, { rowDeleted: !0, itemId: null }), xr(null);
|
|
2562
2565
|
},
|
|
@@ -2713,7 +2716,7 @@ function jf({
|
|
|
2713
2716
|
const dl = Y(null);
|
|
2714
2717
|
ne(() => {
|
|
2715
2718
|
const e = {
|
|
2716
|
-
edits: new Set(
|
|
2719
|
+
edits: new Set(F.keys()),
|
|
2717
2720
|
deletes: new Set(je),
|
|
2718
2721
|
pending: K.length
|
|
2719
2722
|
}, n = dl.current;
|
|
@@ -2723,7 +2726,7 @@ function jf({
|
|
|
2723
2726
|
e.pending < n.pending && (Mt.current = Date.now());
|
|
2724
2727
|
}
|
|
2725
2728
|
}, [Gi]);
|
|
2726
|
-
const uo = j(() =>
|
|
2729
|
+
const uo = j(() => Au(de), [de]), cl = j(
|
|
2727
2730
|
() => de.filter(
|
|
2728
2731
|
(e) => e.group_key === "__create_with_defaults__" && !zo.has(e.type ?? "") && !Bo.has(e.field)
|
|
2729
2732
|
),
|
|
@@ -2802,7 +2805,7 @@ function jf({
|
|
|
2802
2805
|
const i = /* @__PURE__ */ new Set();
|
|
2803
2806
|
if (gr.has(n.field))
|
|
2804
2807
|
for (const c of [...O, ...K]) {
|
|
2805
|
-
const d =
|
|
2808
|
+
const d = Rn(n.field, c);
|
|
2806
2809
|
(d == null ? void 0 : d.id) != null && i.add(String(d.id));
|
|
2807
2810
|
}
|
|
2808
2811
|
const o = n.ids.filter((c) => !r.has(c) && !i.has(c));
|
|
@@ -2819,7 +2822,7 @@ function jf({
|
|
|
2819
2822
|
]), ui = Y(/* @__PURE__ */ new Set()), po = Y(!1);
|
|
2820
2823
|
ne(() => {
|
|
2821
2824
|
var t;
|
|
2822
|
-
if (
|
|
2825
|
+
if (R || !$ || po.current) return;
|
|
2823
2826
|
const e = E == null ? void 0 : E.dirtyFields;
|
|
2824
2827
|
if (!e || e.size === 0) return;
|
|
2825
2828
|
const n = [];
|
|
@@ -2863,21 +2866,21 @@ function jf({
|
|
|
2863
2866
|
var p, m, h, g, _;
|
|
2864
2867
|
let r = 0, i = 0, o = 0, a = 0;
|
|
2865
2868
|
for (const x of n) {
|
|
2866
|
-
for (const
|
|
2867
|
-
ui.current.add(`${x.rule.child_field}|${
|
|
2868
|
-
const N = x.rule.child_field, q = (x.cfg.keep ?? []).filter((
|
|
2869
|
+
for (const G of x.ids)
|
|
2870
|
+
ui.current.add(`${x.rule.child_field}|${G}|${x.filterKey}`);
|
|
2871
|
+
const N = x.rule.child_field, q = (x.cfg.keep ?? []).filter((G) => typeof G == "string" && G), b = await $.request(
|
|
2869
2872
|
ce(`/items/${x.target}`, {
|
|
2870
2873
|
filter: JSON.stringify({ id: { _in: x.ids } }),
|
|
2871
2874
|
fields: ["id", ...q].join(","),
|
|
2872
2875
|
limit: x.ids.length
|
|
2873
2876
|
})
|
|
2874
|
-
).then((
|
|
2875
|
-
for (const
|
|
2877
|
+
).then((G) => G.data ?? []).catch(() => []), v = /* @__PURE__ */ new Map();
|
|
2878
|
+
for (const G of b) {
|
|
2876
2879
|
const ue = [
|
|
2877
2880
|
x.filter,
|
|
2878
2881
|
...Object.entries(x.replaceValues).map(([te, qe]) => ({ [te]: { _eq: qe } })),
|
|
2879
2882
|
...q.map(
|
|
2880
|
-
(te) =>
|
|
2883
|
+
(te) => G[te] == null || G[te] === "" ? { [te]: { _null: !0 } } : { [te]: { _eq: G[te] } }
|
|
2881
2884
|
)
|
|
2882
2885
|
], pe = await $.request(
|
|
2883
2886
|
ce(`/items/${x.target}`, {
|
|
@@ -2890,26 +2893,26 @@ function jf({
|
|
|
2890
2893
|
var qe, Ze;
|
|
2891
2894
|
return ((Ze = (qe = te.data) == null ? void 0 : qe[0]) == null ? void 0 : Ze.id) ?? null;
|
|
2892
2895
|
}).catch(() => null);
|
|
2893
|
-
pe == null ? i++ : v.set(String(
|
|
2896
|
+
pe == null ? i++ : v.set(String(G.id), pe);
|
|
2894
2897
|
}
|
|
2895
2898
|
if (v.size === 0) continue;
|
|
2896
|
-
const T = Ft(), I = async (
|
|
2899
|
+
const T = Ft(), I = async (G) => {
|
|
2897
2900
|
const ue = {
|
|
2898
|
-
...
|
|
2899
|
-
[N]: v.get(String(
|
|
2901
|
+
...G,
|
|
2902
|
+
[N]: v.get(String(G[N]))
|
|
2900
2903
|
};
|
|
2901
2904
|
let pe = { [N]: ue[N] };
|
|
2902
2905
|
if (W && W.length > 0) {
|
|
2903
2906
|
const te = await $.request(
|
|
2904
2907
|
Ke("/field-rules/evaluate", {
|
|
2905
2908
|
collection: s,
|
|
2906
|
-
data:
|
|
2909
|
+
data: G,
|
|
2907
2910
|
locks_only: !0,
|
|
2908
2911
|
probe: !0,
|
|
2909
2912
|
parent_context: T,
|
|
2910
2913
|
row_rules: W
|
|
2911
2914
|
})
|
|
2912
|
-
).catch(() => null), qe = bo(N,
|
|
2915
|
+
).catch(() => null), qe = bo(N, G, te == null ? void 0 : te.expected);
|
|
2913
2916
|
for (const Bn of qe) ue[Bn] = null;
|
|
2914
2917
|
const Ze = await $.request(
|
|
2915
2918
|
Ke("/field-rules/evaluate", {
|
|
@@ -2924,20 +2927,20 @@ function jf({
|
|
|
2924
2927
|
for (const Bn of qe) Bn in pe || (pe[Bn] = null);
|
|
2925
2928
|
}
|
|
2926
2929
|
return pe;
|
|
2927
|
-
}, Z = K.map((
|
|
2928
|
-
for (const { r:
|
|
2929
|
-
const pe = await I(
|
|
2930
|
-
w == null || w.updateRow(s, f, ue, { ...
|
|
2930
|
+
}, Z = K.map((G, ue) => ({ r: G, i: ue })).filter(({ r: G }) => G[N] != null && v.has(String(G[N])));
|
|
2931
|
+
for (const { r: G, i: ue } of Z) {
|
|
2932
|
+
const pe = await I(G);
|
|
2933
|
+
w == null || w.updateRow(s, f, ue, { ...G, ...pe }), r++;
|
|
2931
2934
|
}
|
|
2932
|
-
const V = O.filter((
|
|
2935
|
+
const V = O.filter((G) => {
|
|
2933
2936
|
var te;
|
|
2934
|
-
const ue = String(
|
|
2937
|
+
const ue = String(G.id);
|
|
2935
2938
|
if (je.has(ue)) return !1;
|
|
2936
|
-
const pe = ((te =
|
|
2939
|
+
const pe = ((te = F.get(ue)) == null ? void 0 : te[N]) ?? G[N];
|
|
2937
2940
|
return pe != null && v.has(String(pe));
|
|
2938
2941
|
});
|
|
2939
|
-
for (const
|
|
2940
|
-
const ue = String(
|
|
2942
|
+
for (const G of V) {
|
|
2943
|
+
const ue = String(G.id), pe = await I({ ...G, ...F.get(ue) ?? {} });
|
|
2941
2944
|
if ((D || S) && w)
|
|
2942
2945
|
w.queueEdit(s, f, ue, { ...pe, ...$n(ue) });
|
|
2943
2946
|
else {
|
|
@@ -2970,7 +2973,7 @@ function jf({
|
|
|
2970
2973
|
}));
|
|
2971
2974
|
}, [mo, Ye, E == null ? void 0 : E.dirtyFields, ii]);
|
|
2972
2975
|
const kr = j(() => {
|
|
2973
|
-
const e = /* @__PURE__ */ new Map(), n = [...O, ...K], t = [...
|
|
2976
|
+
const e = /* @__PURE__ */ new Map(), n = [...O, ...K], t = [...F.values()], r = ft.flatMap((i) => i.rows);
|
|
2974
2977
|
u != null && u.draft && r.push(u.draft);
|
|
2975
2978
|
for (const [i, o] of He) {
|
|
2976
2979
|
if (!o.one_collection || Vl(o.one_collection)) continue;
|
|
@@ -2978,7 +2981,7 @@ function jf({
|
|
|
2978
2981
|
p.length && e.set(o.one_collection, p);
|
|
2979
2982
|
}
|
|
2980
2983
|
return e;
|
|
2981
|
-
}, [O, K,
|
|
2984
|
+
}, [O, K, F, He, ft, u == null ? void 0 : u.draft]), od = j(() => {
|
|
2982
2985
|
const e = /* @__PURE__ */ new Map();
|
|
2983
2986
|
for (const n of Se) {
|
|
2984
2987
|
const t = He.get(n.field);
|
|
@@ -3073,7 +3076,7 @@ function jf({
|
|
|
3073
3076
|
fk_field: f,
|
|
3074
3077
|
...S ? {} : { parent_id: y },
|
|
3075
3078
|
parent_context: Ft(),
|
|
3076
|
-
parent_collection:
|
|
3079
|
+
parent_collection: L,
|
|
3077
3080
|
row_rules: W,
|
|
3078
3081
|
mode: _o,
|
|
3079
3082
|
dry_run: e || n || t.length > 0,
|
|
@@ -3117,7 +3120,7 @@ function jf({
|
|
|
3117
3120
|
fk_field: f,
|
|
3118
3121
|
parent_id: y,
|
|
3119
3122
|
parent_context: Ft(),
|
|
3120
|
-
parent_collection:
|
|
3123
|
+
parent_collection: L,
|
|
3121
3124
|
row_rules: W,
|
|
3122
3125
|
mode: _o,
|
|
3123
3126
|
dry_run: !1,
|
|
@@ -3161,7 +3164,7 @@ function jf({
|
|
|
3161
3164
|
locks_only: !0,
|
|
3162
3165
|
probe: !0,
|
|
3163
3166
|
parent_context: Ft(),
|
|
3164
|
-
parent_collection:
|
|
3167
|
+
parent_collection: L,
|
|
3165
3168
|
row_rules: W
|
|
3166
3169
|
})
|
|
3167
3170
|
).then((t) => {
|
|
@@ -3182,7 +3185,7 @@ function jf({
|
|
|
3182
3185
|
const Gt = Y(/* @__PURE__ */ new Map());
|
|
3183
3186
|
function ho(e) {
|
|
3184
3187
|
if (!(S || e === "new" || e.startsWith("pending:"))) {
|
|
3185
|
-
if (D &&
|
|
3188
|
+
if (D && F.has(e)) {
|
|
3186
3189
|
Gt.current.delete(e);
|
|
3187
3190
|
return;
|
|
3188
3191
|
}
|
|
@@ -3191,7 +3194,7 @@ function jf({
|
|
|
3191
3194
|
}
|
|
3192
3195
|
const go = async (e) => await Gt.current.get(e) ?? null;
|
|
3193
3196
|
function mi(e) {
|
|
3194
|
-
if (
|
|
3197
|
+
if (R) return;
|
|
3195
3198
|
const n = String(e.id);
|
|
3196
3199
|
if ((u == null ? void 0 : u.rowId) === n || ir.view(n).readOnly) return;
|
|
3197
3200
|
ao.current();
|
|
@@ -3219,7 +3222,7 @@ function jf({
|
|
|
3219
3222
|
return window.addEventListener("nvr:grid-open-row", e), () => window.removeEventListener("nvr:grid-open-row", e);
|
|
3220
3223
|
}, [s, f, O]);
|
|
3221
3224
|
function ml(e, n) {
|
|
3222
|
-
if (
|
|
3225
|
+
if (R) return;
|
|
3223
3226
|
const t = `pending:${n}`;
|
|
3224
3227
|
if ((u == null ? void 0 : u.rowId) === t) return;
|
|
3225
3228
|
et && gn(null);
|
|
@@ -3249,7 +3252,7 @@ function jf({
|
|
|
3249
3252
|
if (!n || !$ || !W || W.length === 0) return;
|
|
3250
3253
|
const t = n.rowId;
|
|
3251
3254
|
bt.current.rowId !== t && (bt.current = { rowId: t, seqs: /* @__PURE__ */ new Map() });
|
|
3252
|
-
const r = ++
|
|
3255
|
+
const r = ++Li.current;
|
|
3253
3256
|
bt.current.seqs.set(e, r), $.request(
|
|
3254
3257
|
Ke("/field-rules/evaluate", {
|
|
3255
3258
|
collection: s,
|
|
@@ -3257,7 +3260,7 @@ function jf({
|
|
|
3257
3260
|
target_fields: [e],
|
|
3258
3261
|
probe: !0,
|
|
3259
3262
|
parent_context: Ft(),
|
|
3260
|
-
parent_collection:
|
|
3263
|
+
parent_collection: L,
|
|
3261
3264
|
row_rules: W
|
|
3262
3265
|
})
|
|
3263
3266
|
).then(
|
|
@@ -3300,7 +3303,7 @@ function jf({
|
|
|
3300
3303
|
});
|
|
3301
3304
|
}
|
|
3302
3305
|
function yo(e, n) {
|
|
3303
|
-
if (
|
|
3306
|
+
if (R) return;
|
|
3304
3307
|
const t = { ...e };
|
|
3305
3308
|
if (n.rowDeleted || !n.itemId) {
|
|
3306
3309
|
delete t.id;
|
|
@@ -3335,7 +3338,7 @@ function jf({
|
|
|
3335
3338
|
});
|
|
3336
3339
|
}
|
|
3337
3340
|
function ud() {
|
|
3338
|
-
|
|
3341
|
+
R || (We({ rowId: "new", draft: { ...ln }, locksPending: Xn.size > 0 }), fi("new", { ...ln }));
|
|
3339
3342
|
}
|
|
3340
3343
|
function Nr() {
|
|
3341
3344
|
var n;
|
|
@@ -3352,7 +3355,7 @@ function jf({
|
|
|
3352
3355
|
(i = w == null ? void 0 : w.noteEditIntent) == null || i.call(w);
|
|
3353
3356
|
const n = Ve.current, t = (n == null ? void 0 : n.rowId) ?? null;
|
|
3354
3357
|
er.current = t, bt.current.rowId !== t && (bt.current = { rowId: t, seqs: /* @__PURE__ */ new Map() });
|
|
3355
|
-
for (const o of Object.keys(e)) bt.current.seqs.set(o, ++
|
|
3358
|
+
for (const o of Object.keys(e)) bt.current.seqs.set(o, ++Li.current);
|
|
3356
3359
|
const r = ge({ ...(n == null ? void 0 : n.draft) ?? {}, ...e });
|
|
3357
3360
|
We((o) => o && { ...o, draft: r });
|
|
3358
3361
|
}
|
|
@@ -3361,7 +3364,7 @@ function jf({
|
|
|
3361
3364
|
(_ = w == null ? void 0 : w.noteEditIntent) == null || _.call(w);
|
|
3362
3365
|
const t = Ve.current, r = (t == null ? void 0 : t.rowId) ?? null;
|
|
3363
3366
|
er.current = r, bt.current.rowId !== r && (bt.current = { rowId: r, seqs: /* @__PURE__ */ new Map() });
|
|
3364
|
-
const i = ++
|
|
3367
|
+
const i = ++Li.current;
|
|
3365
3368
|
bt.current.seqs.set(e, i);
|
|
3366
3369
|
const o = ge(t ? { ...t.draft, [e]: n } : { [e]: n }), a = n != null && n !== "", c = !!((x = Se.find((b) => b.field === e)) != null && x.required), d = (a || !c) && !!((N = t == null ? void 0 : t.missing) != null && N.includes(e)), p = d ? ((t == null ? void 0 : t.missing) ?? []).filter((b) => b !== e) : t == null ? void 0 : t.missing, m = ((t == null ? void 0 : t.invalid) ?? []).filter(
|
|
3367
3370
|
(b) => de.some((v) => v.field === b && v.computed_type === "write")
|
|
@@ -3412,7 +3415,7 @@ function jf({
|
|
|
3412
3415
|
const h = u.rowId.startsWith("pending:"), g = h ? parseInt(u.rowId.split(":")[1], 10) : null, _ = u.rowId === "new" || h ? null : u.rowId, x = Uo(u.draft, Je);
|
|
3413
3416
|
if (O.some((q) => {
|
|
3414
3417
|
if (String(q.id) === _ || je.has(String(q.id))) return !1;
|
|
3415
|
-
const b =
|
|
3418
|
+
const b = F.has(String(q.id)) ? { ...q, ...F.get(String(q.id)) } : q;
|
|
3416
3419
|
return Uo(b, Je) === x;
|
|
3417
3420
|
}) || K.some((q, b) => b !== g && Uo(q, Je) === x))
|
|
3418
3421
|
return It(`A row with the same ${Je.join(" + ")} already exists.`), !1;
|
|
@@ -3420,7 +3423,7 @@ function jf({
|
|
|
3420
3423
|
const t = (h) => h == null || h === "", r = Se.filter(
|
|
3421
3424
|
(h) => {
|
|
3422
3425
|
var g;
|
|
3423
|
-
return h.required && !
|
|
3426
|
+
return h.required && !Ar(h) && !((g = u.locks) != null && g.includes(h.field)) && t(u.draft[h.field]);
|
|
3424
3427
|
}
|
|
3425
3428
|
);
|
|
3426
3429
|
if (r.length > 0)
|
|
@@ -3431,7 +3434,7 @@ function jf({
|
|
|
3431
3434
|
), !1;
|
|
3432
3435
|
const i = Is(u.rowId), o = Se.flatMap((h) => {
|
|
3433
3436
|
var _;
|
|
3434
|
-
if (
|
|
3437
|
+
if (Ar(h) || (_ = u.locks) != null && _.includes(h.field)) return [];
|
|
3435
3438
|
if (!Hc.has(h.type ?? "")) return [];
|
|
3436
3439
|
if (i && String(i[h.field] ?? "") === String(u.draft[h.field] ?? ""))
|
|
3437
3440
|
return [];
|
|
@@ -3467,13 +3470,13 @@ function jf({
|
|
|
3467
3470
|
const h = ct(Qe.cap, fn);
|
|
3468
3471
|
if (h != null) {
|
|
3469
3472
|
const g = Qe.field, _ = ge({ ...u.draft }), x = u.rowId.startsWith("pending:") ? Number(u.rowId.slice(8)) : -1, N = (O ?? []).some((I) => String(I.id) === u.rowId), q = (O ?? []).filter((I) => !je.has(String(I.id)) && String(I.id) !== u.rowId).reduce((I, Z) => {
|
|
3470
|
-
const V = String(Z.id),
|
|
3471
|
-
return I + (Number(ge(
|
|
3473
|
+
const V = String(Z.id), G = F.has(V) ? { ...Z, ...F.get(V) } : Z;
|
|
3474
|
+
return I + (Number(ge(G)[g]) || 0);
|
|
3472
3475
|
}, 0) + K.reduce(
|
|
3473
3476
|
(I, Z, V) => V === x ? I : I + (Number(ge(Z)[g]) || 0),
|
|
3474
3477
|
0
|
|
3475
3478
|
), b = N ? (() => {
|
|
3476
|
-
const I = (O ?? []).find((V) => String(V.id) === u.rowId), Z =
|
|
3479
|
+
const I = (O ?? []).find((V) => String(V.id) === u.rowId), Z = F.has(u.rowId) ? { ...I, ...F.get(u.rowId) } : I;
|
|
3477
3480
|
return Number(ge(Z)[g]) || 0;
|
|
3478
3481
|
})() : x >= 0 && Number(
|
|
3479
3482
|
ge(K[x])[g]
|
|
@@ -3508,7 +3511,7 @@ function jf({
|
|
|
3508
3511
|
Ke(`/items/${s}${ht}`, x)
|
|
3509
3512
|
);
|
|
3510
3513
|
} catch (b) {
|
|
3511
|
-
const v =
|
|
3514
|
+
const v = Ao(b);
|
|
3512
3515
|
if (v)
|
|
3513
3516
|
return nr({
|
|
3514
3517
|
challenge: v,
|
|
@@ -3545,8 +3548,8 @@ function jf({
|
|
|
3545
3548
|
), g.length) {
|
|
3546
3549
|
const b = [];
|
|
3547
3550
|
let v = "", T = 0, I = 0;
|
|
3548
|
-
for (const [V,
|
|
3549
|
-
const ue = V.slice(6), pe = Array.isArray(
|
|
3551
|
+
for (const [V, G] of g) {
|
|
3552
|
+
const ue = V.slice(6), pe = Array.isArray(G) ? G : [];
|
|
3550
3553
|
if (pe.length === 0) continue;
|
|
3551
3554
|
T += pe.length;
|
|
3552
3555
|
const te = Ue.find(
|
|
@@ -3576,7 +3579,7 @@ function jf({
|
|
|
3576
3579
|
members: qe
|
|
3577
3580
|
});
|
|
3578
3581
|
}
|
|
3579
|
-
const Z = b.reduce((V,
|
|
3582
|
+
const Z = b.reduce((V, G) => V + G.members.length, 0);
|
|
3580
3583
|
I > 0 ? Vr({
|
|
3581
3584
|
text: `The line saved, but ${I} of ${T} nested row${T === 1 ? "" : "s"} could not be attached — the server did not return the new line's id. Open the line and add them again.`,
|
|
3582
3585
|
groups: []
|
|
@@ -3598,7 +3601,7 @@ function jf({
|
|
|
3598
3601
|
const b = Object.entries(u.draft).filter(
|
|
3599
3602
|
([V]) => V.startsWith("__nested_ops_")
|
|
3600
3603
|
), v = x, { rest: T, reverted: I } = Cc(
|
|
3601
|
-
|
|
3604
|
+
F.get(u.rowId),
|
|
3602
3605
|
u.draft,
|
|
3603
3606
|
_
|
|
3604
3607
|
);
|
|
@@ -3610,10 +3613,10 @@ function jf({
|
|
|
3610
3613
|
...Object.fromEntries(b)
|
|
3611
3614
|
};
|
|
3612
3615
|
if (Xc(V)) {
|
|
3613
|
-
const
|
|
3616
|
+
const G = await go(u.rowId);
|
|
3614
3617
|
w.queueEdit(s, f, u.rowId, {
|
|
3615
3618
|
...V,
|
|
3616
|
-
...
|
|
3619
|
+
...G != null ? { __base_revision: G } : {}
|
|
3617
3620
|
});
|
|
3618
3621
|
}
|
|
3619
3622
|
return Gt.current.delete(u.rowId), n(), !0;
|
|
@@ -3635,7 +3638,7 @@ function jf({
|
|
|
3635
3638
|
Ni(`/items/${s}/${u.rowId}${ht}`, q(x))
|
|
3636
3639
|
);
|
|
3637
3640
|
} catch (b) {
|
|
3638
|
-
const v =
|
|
3641
|
+
const v = Ao(b);
|
|
3639
3642
|
if (v) {
|
|
3640
3643
|
const I = `/items/${s}/${u.rowId}${ht}`;
|
|
3641
3644
|
return nr({
|
|
@@ -3789,7 +3792,7 @@ function jf({
|
|
|
3789
3792
|
const n = [...O], [t] = n.splice(Ot, 1);
|
|
3790
3793
|
n.splice(Yt, 0, t);
|
|
3791
3794
|
const r = n.map((i, o) => ({ row: i, newOrder: o })).filter(({ row: i, newOrder: o }) => {
|
|
3792
|
-
const a = D ?
|
|
3795
|
+
const a = D ? F.get(String(i.id)) : void 0, c = (a == null ? void 0 : a[X]) ?? i[X];
|
|
3793
3796
|
return Number(c ?? -1) !== o;
|
|
3794
3797
|
});
|
|
3795
3798
|
if (D && w) {
|
|
@@ -3998,17 +4001,17 @@ function jf({
|
|
|
3998
4001
|
}
|
|
3999
4002
|
return /* @__PURE__ */ l("span", { className: "block truncate", children: String(n) });
|
|
4000
4003
|
}
|
|
4001
|
-
const No = Y(/* @__PURE__ */ new Map()), Sd = Bl(), $d = (tn && ve === "original" && !
|
|
4002
|
-
|
|
4004
|
+
const No = Y(/* @__PURE__ */ new Map()), Sd = Bl(), $d = (tn && ve === "original" && !R ? 1 : 0) + (oe && (X || S || D) ? 1 : 0) + (M ? 1 : 0) + (S || D ? 1 : 0);
|
|
4005
|
+
Rc(
|
|
4003
4006
|
Sd,
|
|
4004
4007
|
Fn,
|
|
4005
4008
|
ve === "original" ? Wi : [],
|
|
4006
4009
|
`tr[data-o2m-row]:not([data-o2m-editing]) > td:nth-child(n+${$d + 1}):not(:last-child)`
|
|
4007
4010
|
);
|
|
4008
4011
|
const Ol = Y(null);
|
|
4009
|
-
if (
|
|
4012
|
+
if (Ac(Ol, Di, ve === "original"), ms || !S && an)
|
|
4010
4013
|
return /* @__PURE__ */ l("div", { className: "py-3 text-center text-[12px] text-slate-400", children: /* @__PURE__ */ l(kn, { className: "h-4 w-4 animate-spin inline" }) });
|
|
4011
|
-
const Sr = (u == null ? void 0 : u.rowId) === "new", it = tn && ve === "original" && !
|
|
4014
|
+
const Sr = (u == null ? void 0 : u.rowId) === "new", it = tn && ve === "original" && !R, kt = (it ? 1 : 0) + (oe && (X || S || D) ? 1 : 0) + (M ? 1 : 0) + (S || D ? 1 : 0) + Te.length + 1, $r = it ? "select" : oe && (X || D) ? "reorder" : M ? "num" : D ? "status" : "data", Er = (e) => {
|
|
4012
4015
|
if (!xt) return null;
|
|
4013
4016
|
const n = xt.added.has(e) ? "bg-emerald-500" : xt.changed.has(e) ? "bg-amber-500" : null;
|
|
4014
4017
|
return n ? /* @__PURE__ */ l(
|
|
@@ -4047,28 +4050,28 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
4047
4050
|
return Wc(n.join(`
|
|
4048
4051
|
`), Wi);
|
|
4049
4052
|
}, Un = [];
|
|
4050
|
-
let
|
|
4053
|
+
let Ll = 0;
|
|
4051
4054
|
!S && ve === "original" && O.forEach((e, n) => {
|
|
4052
4055
|
if (!Nt) {
|
|
4053
4056
|
Un.push({ row: e, ri: n });
|
|
4054
4057
|
return;
|
|
4055
4058
|
}
|
|
4056
|
-
const t = String(e.id), r =
|
|
4057
|
-
i &&
|
|
4059
|
+
const t = String(e.id), r = F.has(t) ? { ...e, ...F.get(t) } : e, i = In.has(t) || So(r);
|
|
4060
|
+
i && Ll++, (i || (u == null ? void 0 : u.rowId) === t || Bi.current.has(t)) && Un.push({ row: e, ri: n });
|
|
4058
4061
|
});
|
|
4059
4062
|
const gi = K.map(
|
|
4060
4063
|
(e, n) => Nt ? jc(e, {
|
|
4061
4064
|
matches: So(e),
|
|
4062
4065
|
editing: (u == null ? void 0 : u.rowId) === `pending:${n}`
|
|
4063
4066
|
}) : "show"
|
|
4064
|
-
), qd = Nt ? K.filter((e) => So(e)).length : 0, Id = gi.filter((e) => e === "dim").length, $o = Un.slice(0, li), bi = cn ?
|
|
4067
|
+
), qd = Nt ? K.filter((e) => So(e)).length : 0, Id = gi.filter((e) => e === "dim").length, $o = Un.slice(0, li), bi = cn ? Aa ?? Ne.length : Ne.length, Rl = ve === "original" && (cn || Ne.length + K.length > Tc || sr.trim() !== ""), qr = Rl ? /* @__PURE__ */ l(
|
|
4065
4068
|
Mc,
|
|
4066
4069
|
{
|
|
4067
4070
|
value: sr,
|
|
4068
4071
|
onChange: ws,
|
|
4069
4072
|
inputRef: Di,
|
|
4070
4073
|
searching: Nt,
|
|
4071
|
-
shown:
|
|
4074
|
+
shown: Ll + qd,
|
|
4072
4075
|
total: bi + K.length,
|
|
4073
4076
|
loaded: cn ? Ne.length : null,
|
|
4074
4077
|
loadedOf: cn ? bi : null,
|
|
@@ -4092,7 +4095,7 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
4092
4095
|
e.push({
|
|
4093
4096
|
key: r,
|
|
4094
4097
|
kind: "saved",
|
|
4095
|
-
row:
|
|
4098
|
+
row: F.has(r) ? { ...n, ...F.get(r) } : n,
|
|
4096
4099
|
idx: t
|
|
4097
4100
|
});
|
|
4098
4101
|
}
|
|
@@ -4100,7 +4103,7 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
4100
4103
|
return K.forEach((n, t) => {
|
|
4101
4104
|
gi[t] !== "hide" && e.push({ key: `pending:${t}`, kind: "pending", row: n, idx: t });
|
|
4102
4105
|
}), e;
|
|
4103
|
-
}, Eo = it ? Ir().map((e) => e.key) : [], Od = Eo.length > 0 && Eo.every((e) => pt.has(e)), Or = it ? Ir().filter((e) => pt.has(e.key)) : [],
|
|
4106
|
+
}, Eo = it ? Ir().map((e) => e.key) : [], Od = Eo.length > 0 && Eo.every((e) => pt.has(e)), Or = it ? Ir().filter((e) => pt.has(e.key)) : [], Ld = () => {
|
|
4104
4107
|
var t;
|
|
4105
4108
|
const e = Ve.current;
|
|
4106
4109
|
if (!e) return !1;
|
|
@@ -4116,14 +4119,14 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
4116
4119
|
return !0;
|
|
4117
4120
|
}
|
|
4118
4121
|
return !1;
|
|
4119
|
-
},
|
|
4122
|
+
}, Rd = async (e) => {
|
|
4120
4123
|
const n = Ve.current;
|
|
4121
4124
|
if (!n || n.rowId === "new") return;
|
|
4122
4125
|
const t = Ir(), r = t.findIndex((a) => a.key === n.rowId);
|
|
4123
4126
|
if (r < 0) return;
|
|
4124
4127
|
const i = r + e;
|
|
4125
4128
|
if (i < 0 || i >= t.length) return;
|
|
4126
|
-
if (
|
|
4129
|
+
if (Ld()) {
|
|
4127
4130
|
if (!await Pt()) return;
|
|
4128
4131
|
} else
|
|
4129
4132
|
Nr();
|
|
@@ -4135,8 +4138,8 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
4135
4138
|
a && (a.focus({ preventScroll: !0 }), a.scrollIntoView({ block: "nearest" }));
|
|
4136
4139
|
}, 0);
|
|
4137
4140
|
};
|
|
4138
|
-
Vo.current =
|
|
4139
|
-
async function
|
|
4141
|
+
Vo.current = Rd;
|
|
4142
|
+
async function Ad(e) {
|
|
4140
4143
|
const n = No.current;
|
|
4141
4144
|
await qo(
|
|
4142
4145
|
e,
|
|
@@ -4145,19 +4148,19 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
4145
4148
|
), No.current = /* @__PURE__ */ new Map();
|
|
4146
4149
|
}
|
|
4147
4150
|
function jd() {
|
|
4148
|
-
No.current = S ||
|
|
4151
|
+
No.current = S || R ? /* @__PURE__ */ new Map() : Qc(
|
|
4149
4152
|
st,
|
|
4150
4153
|
[...pt].filter((e) => !e.startsWith("pending:"))
|
|
4151
4154
|
), Go(!0);
|
|
4152
4155
|
}
|
|
4153
|
-
const
|
|
4156
|
+
const Al = () => {
|
|
4154
4157
|
const e = [];
|
|
4155
4158
|
return ve !== "original" || (S || O.forEach((n, t) => {
|
|
4156
4159
|
const r = String(n.id);
|
|
4157
4160
|
je.has(r) || In.has(r) || e.push({
|
|
4158
4161
|
key: r,
|
|
4159
4162
|
kind: "saved",
|
|
4160
|
-
row:
|
|
4163
|
+
row: F.has(r) ? { ...n, ...F.get(r) } : n,
|
|
4161
4164
|
idx: t
|
|
4162
4165
|
});
|
|
4163
4166
|
}), K.forEach((n, t) => {
|
|
@@ -4183,7 +4186,7 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
4183
4186
|
locks_only: !0,
|
|
4184
4187
|
probe: !0,
|
|
4185
4188
|
parent_context: Ft(),
|
|
4186
|
-
parent_collection:
|
|
4189
|
+
parent_collection: L,
|
|
4187
4190
|
row_rules: W
|
|
4188
4191
|
})
|
|
4189
4192
|
);
|
|
@@ -4202,12 +4205,12 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
4202
4205
|
changed_field: b,
|
|
4203
4206
|
probe: !0,
|
|
4204
4207
|
parent_context: Ft(),
|
|
4205
|
-
parent_collection:
|
|
4208
|
+
parent_collection: L,
|
|
4206
4209
|
row_rules: W
|
|
4207
4210
|
})
|
|
4208
4211
|
), Z = {};
|
|
4209
|
-
for (const [V,
|
|
4210
|
-
V in e || (Z[V] =
|
|
4212
|
+
for (const [V, G] of Object.entries(I.updates ?? {}))
|
|
4213
|
+
V in e || (Z[V] = G);
|
|
4211
4214
|
for (const V of v) !(V in Z) && !(V in e) && (Z[V] = null);
|
|
4212
4215
|
_ = ge({ ..._, ...Z }), x = I.locks ?? x, N = I.expected ?? N;
|
|
4213
4216
|
} catch {
|
|
@@ -4269,7 +4272,7 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
4269
4272
|
(x = t.baseOf) == null ? void 0 : x.call(t, q.key)
|
|
4270
4273
|
) && d++;
|
|
4271
4274
|
} catch (v) {
|
|
4272
|
-
const T = _ ? null :
|
|
4275
|
+
const T = _ ? null : Ao(v);
|
|
4273
4276
|
if (T) {
|
|
4274
4277
|
nr({ challenge: T, retry: (I) => m(N, I) }), Q.invalidateQueries({ queryKey: ["o2m-rows", s, f, y] });
|
|
4275
4278
|
return;
|
|
@@ -4282,14 +4285,14 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
4282
4285
|
};
|
|
4283
4286
|
await m(0);
|
|
4284
4287
|
}
|
|
4285
|
-
if (qi.current = (e, n) => qo({ [e]: n },
|
|
4288
|
+
if (qi.current = (e, n) => qo({ [e]: n }, Al(), {
|
|
4286
4289
|
clearSelection: !1,
|
|
4287
4290
|
noun: "line"
|
|
4288
4291
|
}), Ho.current = !0, Ur.current) {
|
|
4289
4292
|
const e = Ur.current;
|
|
4290
4293
|
Ur.current = null, window.setTimeout(() => void qi.current(e.target, e.value), 0);
|
|
4291
4294
|
}
|
|
4292
|
-
const dt = Oe ? "split" : Te.filter((e) => !rt(e)).length >= 6 ? "panel" : "inline",
|
|
4295
|
+
const dt = Oe ? "split" : Te.filter((e) => !rt(e)).length >= 6 ? "panel" : "inline", Lr = (e) => {
|
|
4293
4296
|
const n = no == null ? void 0 : no.display_template;
|
|
4294
4297
|
if (n) {
|
|
4295
4298
|
const t = yu(Tr(n, e));
|
|
@@ -4303,7 +4306,7 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
4303
4306
|
return r.length > 60 ? `${r.slice(0, 60)}…` : r;
|
|
4304
4307
|
}
|
|
4305
4308
|
return e.id != null ? `#${e.id}` : "New line";
|
|
4306
|
-
},
|
|
4309
|
+
}, Rr = (e, n) => {
|
|
4307
4310
|
const t = (n == null ? void 0 : n.rowKey) ?? "__new__", r = { ...e };
|
|
4308
4311
|
for (const i of Te) {
|
|
4309
4312
|
if (i.computed_type !== "rollup" || !i.computed_formula) continue;
|
|
@@ -4376,7 +4379,7 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
4376
4379
|
},
|
|
4377
4380
|
r
|
|
4378
4381
|
);
|
|
4379
|
-
}) }),
|
|
4382
|
+
}) }), Ar = (e) => e.computed_type === "write" && !!e.computed_formula || e.interface === "formula-column" || e.interface === "match-agg-column" || e.interface === "relation-path" || !!e.readonly || ni(e) || rt(e), jl = (e) => {
|
|
4380
4383
|
var n;
|
|
4381
4384
|
return /* @__PURE__ */ k(
|
|
4382
4385
|
"div",
|
|
@@ -4419,11 +4422,11 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
4419
4422
|
] }),
|
|
4420
4423
|
(() => {
|
|
4421
4424
|
const t = [
|
|
4422
|
-
...Se.filter(
|
|
4425
|
+
...Se.filter(Ar),
|
|
4423
4426
|
...Te.filter((r) => rt(r))
|
|
4424
4427
|
];
|
|
4425
4428
|
return t.length > 0 && (() => {
|
|
4426
|
-
const r =
|
|
4429
|
+
const r = Rr(e.draft, { rowKey: e.rowId ?? "__new__" });
|
|
4427
4430
|
return /* @__PURE__ */ l("div", { className: "mb-3 flex flex-wrap items-stretch gap-x-6 gap-y-2 rounded-md bg-slate-50/80 px-3 py-2 dark:bg-muted/40", children: t.map((i) => {
|
|
4428
4431
|
const o = i.label || we(i.field), a = i.computed_type === "write" && !!i.computed_formula, c = i.options ? typeof i.options == "string" ? (() => {
|
|
4429
4432
|
try {
|
|
@@ -4454,7 +4457,7 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
4454
4457
|
{
|
|
4455
4458
|
className: "grid items-start gap-x-4 gap-y-3",
|
|
4456
4459
|
style: { gridTemplateColumns: "repeat(auto-fit, minmax(240px, 1fr))" },
|
|
4457
|
-
children: Te.filter((t) => !
|
|
4460
|
+
children: Te.filter((t) => !Ar(t)).map((t) => {
|
|
4458
4461
|
var g, _, x, N, q, b;
|
|
4459
4462
|
const r = t.computed_type === "write" && !!t.computed_formula, i = t.label || we(t.field), o = t.interface === "formula-column" || t.interface === "match-agg-column" || t.interface === "relation-path";
|
|
4460
4463
|
if (rt(t))
|
|
@@ -4494,7 +4497,7 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
4494
4497
|
})(),
|
|
4495
4498
|
a && /* @__PURE__ */ l("span", { className: "ml-1 normal-case tracking-normal", children: "· required" }),
|
|
4496
4499
|
(() => {
|
|
4497
|
-
var V,
|
|
4500
|
+
var V, G;
|
|
4498
4501
|
const v = dd(t.field);
|
|
4499
4502
|
if (!v) return null;
|
|
4500
4503
|
const T = He.get(t.field), I = (ue) => {
|
|
@@ -4512,7 +4515,7 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
4512
4515
|
labelOf: I,
|
|
4513
4516
|
fieldLabel: Z,
|
|
4514
4517
|
relatedCollection: (T == null ? void 0 : T.one_collection) ?? null,
|
|
4515
|
-
onReset: v === "overridden" && !
|
|
4518
|
+
onReset: v === "overridden" && !R && !((G = u == null ? void 0 : u.locks) != null && G.includes(t.field)) ? () => cd(t.field) : void 0
|
|
4516
4519
|
}
|
|
4517
4520
|
);
|
|
4518
4521
|
})()
|
|
@@ -4527,7 +4530,7 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
4527
4530
|
{
|
|
4528
4531
|
className: "text-[12px] text-slate-500",
|
|
4529
4532
|
"data-compare-locked": Zi(t.field, e.draft) ? t.field : void 0,
|
|
4530
|
-
"data-tip": (b = u == null ? void 0 : u.locks) != null && b.includes(t.field) ? pl(t.field) : Zi(t.field, e.draft) ? (
|
|
4533
|
+
"data-tip": (b = u == null ? void 0 : u.locks) != null && b.includes(t.field) ? pl(t.field) : Zi(t.field, e.draft) ? (A == null ? void 0 : A.closed_locked_message) || "This month is closed — only reconciling it to the actual is allowed" : void 0,
|
|
4531
4534
|
children: ze(t, e.draft[t.field], e.rowId)
|
|
4532
4535
|
}
|
|
4533
4536
|
) : u != null && u.locksPending && Xn.has(t.field) ? (
|
|
@@ -4553,13 +4556,13 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
4553
4556
|
itemId: e.rowId ?? "new",
|
|
4554
4557
|
cascadeFilter: Ye[t.field],
|
|
4555
4558
|
narrowedBy: Cr[t.field],
|
|
4556
|
-
pinnedOption:
|
|
4559
|
+
pinnedOption: Rn(t.field, e.draft)
|
|
4557
4560
|
}
|
|
4558
4561
|
),
|
|
4559
|
-
|
|
4560
|
-
const v = Mo(
|
|
4561
|
-
|
|
4562
|
-
e.draft[
|
|
4562
|
+
A && A.columns.includes(t.field) && (() => {
|
|
4563
|
+
const v = Mo(A, e.draft), T = v == null ? void 0 : v.values[t.field], I = Xt(
|
|
4564
|
+
A,
|
|
4565
|
+
e.draft[A.key_field],
|
|
4563
4566
|
t.field
|
|
4564
4567
|
);
|
|
4565
4568
|
return /* @__PURE__ */ k(
|
|
@@ -4568,24 +4571,24 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
4568
4571
|
"data-compare-editor-hint": t.field,
|
|
4569
4572
|
className: "mt-1 flex items-center gap-1 text-[11px] text-slate-500 dark:text-muted-foreground",
|
|
4570
4573
|
children: [
|
|
4571
|
-
/* @__PURE__ */ l("span", { className: "font-mono text-[9px] uppercase tracking-wide text-slate-400", children:
|
|
4574
|
+
/* @__PURE__ */ l("span", { className: "font-mono text-[9px] uppercase tracking-wide text-slate-400", children: A.label }),
|
|
4572
4575
|
/* @__PURE__ */ l("span", { className: "tabular-nums font-medium text-slate-700 dark:text-slate-200", children: T == null ? "—" : jo(T) }),
|
|
4573
4576
|
I && /* @__PURE__ */ k(
|
|
4574
4577
|
"span",
|
|
4575
4578
|
{
|
|
4576
4579
|
className: "inline-flex items-center gap-0.5 text-[10px] uppercase tracking-wide text-slate-400",
|
|
4577
|
-
"data-tip":
|
|
4580
|
+
"data-tip": A.closed_locked && On ? `${A.closed_rule ?? ""} A change here needs a reason.`.trim() : A.closed_rule,
|
|
4578
4581
|
children: [
|
|
4579
4582
|
/* @__PURE__ */ l(Ul, { className: "h-2.5 w-2.5", "aria-hidden": "true" }),
|
|
4580
4583
|
" closed"
|
|
4581
4584
|
]
|
|
4582
4585
|
}
|
|
4583
4586
|
),
|
|
4584
|
-
I && !
|
|
4587
|
+
I && !R && /* @__PURE__ */ l(
|
|
4585
4588
|
kc,
|
|
4586
4589
|
{
|
|
4587
|
-
data:
|
|
4588
|
-
rowKey: e.draft[
|
|
4590
|
+
data: A,
|
|
4591
|
+
rowKey: e.draft[A.key_field],
|
|
4589
4592
|
column: t.field,
|
|
4590
4593
|
columnLabel: fr(t),
|
|
4591
4594
|
plannedRow: e.draft,
|
|
@@ -4615,23 +4618,23 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
4615
4618
|
})
|
|
4616
4619
|
}
|
|
4617
4620
|
),
|
|
4618
|
-
ke && ((n = ke.fields) == null ? void 0 : n.length) > 0 && !
|
|
4621
|
+
ke && ((n = ke.fields) == null ? void 0 : n.length) > 0 && !R && /* @__PURE__ */ l(
|
|
4619
4622
|
ju,
|
|
4620
4623
|
{
|
|
4621
4624
|
config: ke,
|
|
4622
4625
|
draft: e.draft,
|
|
4623
4626
|
remaining: ct(ke.remaining, fn),
|
|
4624
4627
|
onApply: vo,
|
|
4625
|
-
closedFields:
|
|
4628
|
+
closedFields: A ? new Set(
|
|
4626
4629
|
ke.fields.filter(
|
|
4627
|
-
(t) => Xt(
|
|
4630
|
+
(t) => Xt(A, e.draft[A.key_field], t)
|
|
4628
4631
|
)
|
|
4629
4632
|
) : void 0,
|
|
4630
4633
|
shapeSource: (() => {
|
|
4631
|
-
if (!
|
|
4632
|
-
const t = Number(e.draft[
|
|
4634
|
+
if (!A) return null;
|
|
4635
|
+
const t = Number(e.draft[A.key_field]);
|
|
4633
4636
|
if (!Number.isFinite(t)) return null;
|
|
4634
|
-
const r = O.find((a) => Number(a[
|
|
4637
|
+
const r = O.find((a) => Number(a[A.key_field]) === t - 1);
|
|
4635
4638
|
if (!r) return null;
|
|
4636
4639
|
const i = {};
|
|
4637
4640
|
let o = !1;
|
|
@@ -4652,7 +4655,7 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
4652
4655
|
const t = e.editor.split(/\s+/).map((i) => i[0]).filter(Boolean).slice(0, 2).join("").toUpperCase(), r = () => {
|
|
4653
4656
|
lo.current.add(sl(e.rowKey, e.editor)), gn(null);
|
|
4654
4657
|
const i = O.find((o) => String(o.id) === e.rowKey);
|
|
4655
|
-
i && mi(
|
|
4658
|
+
i && mi(F.has(e.rowKey) ? { ...i, ...F.get(e.rowKey) } : i);
|
|
4656
4659
|
};
|
|
4657
4660
|
return /* @__PURE__ */ k(
|
|
4658
4661
|
"div",
|
|
@@ -4690,7 +4693,7 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
4690
4693
|
]
|
|
4691
4694
|
}
|
|
4692
4695
|
);
|
|
4693
|
-
}, Ml =
|
|
4696
|
+
}, Ml = Ri === Mr, Td = Ml ? null : (jt == null ? void 0 : jt.name) ?? ((Kl = se == null ? void 0 : se[0]) == null ? void 0 : Kl.name), Oo = se && se.length >= 2 && /* @__PURE__ */ k("div", { className: "flex items-center gap-1 text-[11px]", children: [
|
|
4694
4697
|
/* @__PURE__ */ l(
|
|
4695
4698
|
"button",
|
|
4696
4699
|
{
|
|
@@ -4727,7 +4730,7 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
4727
4730
|
ref: Ol,
|
|
4728
4731
|
className: "space-y-1.5",
|
|
4729
4732
|
"data-o2m-collection": s,
|
|
4730
|
-
...
|
|
4733
|
+
...Rl ? { [Pc]: "" } : {},
|
|
4731
4734
|
onFocusCapture: Na,
|
|
4732
4735
|
onBlurCapture: Sa,
|
|
4733
4736
|
children: [
|
|
@@ -4773,7 +4776,7 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
4773
4776
|
onResolve: (e) => void Xa(e)
|
|
4774
4777
|
}
|
|
4775
4778
|
),
|
|
4776
|
-
!
|
|
4779
|
+
!R && /* @__PURE__ */ k("div", { className: "flex flex-wrap items-center gap-2 text-[11px]", children: [
|
|
4777
4780
|
/* @__PURE__ */ l("span", { className: "text-slate-400", children: "Add" }),
|
|
4778
4781
|
/* @__PURE__ */ l(
|
|
4779
4782
|
"input",
|
|
@@ -4837,20 +4840,20 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
4837
4840
|
staging: w,
|
|
4838
4841
|
stagingActive: (S || D) && !!w,
|
|
4839
4842
|
pendingRows: K,
|
|
4840
|
-
pendingEdits:
|
|
4843
|
+
pendingEdits: F,
|
|
4841
4844
|
pendingDeletes: je,
|
|
4842
4845
|
writeRow: (e, n) => oo(`/items/${s}/${e}`, e, n),
|
|
4843
4846
|
stagedBase: $n
|
|
4844
4847
|
}
|
|
4845
4848
|
),
|
|
4846
|
-
|
|
4849
|
+
Le && !S && !R && (() => {
|
|
4847
4850
|
const e = (ie ?? []).find(
|
|
4848
|
-
(n) => typeof n == "object" && n.field ===
|
|
4851
|
+
(n) => typeof n == "object" && n.field === Le.relation && !!n.match
|
|
4849
4852
|
);
|
|
4850
4853
|
return e != null && e.match ? /* @__PURE__ */ l(
|
|
4851
|
-
|
|
4854
|
+
Ru,
|
|
4852
4855
|
{
|
|
4853
|
-
config:
|
|
4856
|
+
config: Le,
|
|
4854
4857
|
matchCfg: e.match,
|
|
4855
4858
|
rows: O,
|
|
4856
4859
|
parentId: y,
|
|
@@ -4861,7 +4864,7 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
4861
4864
|
) : null;
|
|
4862
4865
|
})(),
|
|
4863
4866
|
(tt ?? []).map((e) => /* @__PURE__ */ l(
|
|
4864
|
-
|
|
4867
|
+
Lu,
|
|
4865
4868
|
{
|
|
4866
4869
|
config: e,
|
|
4867
4870
|
rows: [...O, ...K.map((n, t) => ({ ...n, __pendingIndex: t }))],
|
|
@@ -4888,13 +4891,13 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
4888
4891
|
},
|
|
4889
4892
|
e.label
|
|
4890
4893
|
)),
|
|
4891
|
-
|
|
4894
|
+
Lt && !S && !R && ot && L && /* @__PURE__ */ l(
|
|
4892
4895
|
cc,
|
|
4893
4896
|
{
|
|
4894
|
-
collection:
|
|
4897
|
+
collection: L,
|
|
4895
4898
|
templateFilter: (e) => {
|
|
4896
4899
|
var n;
|
|
4897
|
-
return e.name ===
|
|
4900
|
+
return e.name === Lt && ((n = e.reimport) == null ? void 0 : n.enabled) === !0;
|
|
4898
4901
|
},
|
|
4899
4902
|
getLabel: (e) => {
|
|
4900
4903
|
var n;
|
|
@@ -4904,7 +4907,7 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
4904
4907
|
compact: !0
|
|
4905
4908
|
}
|
|
4906
4909
|
),
|
|
4907
|
-
|
|
4910
|
+
L && w && !R && /* @__PURE__ */ k("span", { className: "relative inline-flex", children: [
|
|
4908
4911
|
/* @__PURE__ */ l(
|
|
4909
4912
|
"button",
|
|
4910
4913
|
{
|
|
@@ -4918,7 +4921,7 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
4918
4921
|
ma && /* @__PURE__ */ l("span", { className: "absolute left-0 top-full z-[70] mt-1 w-[300px] rounded-lg border border-slate-200 bg-white p-2 shadow-xl dark:border-border dark:bg-card", children: /* @__PURE__ */ l(
|
|
4919
4922
|
Do,
|
|
4920
4923
|
{
|
|
4921
|
-
collection:
|
|
4924
|
+
collection: L,
|
|
4922
4925
|
value: null,
|
|
4923
4926
|
onChange: (e) => {
|
|
4924
4927
|
e != null && ga(String(e));
|
|
@@ -4956,7 +4959,7 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
4956
4959
|
{
|
|
4957
4960
|
config: ke,
|
|
4958
4961
|
remaining: ct(ke.remaining, fn),
|
|
4959
|
-
rowNoun:
|
|
4962
|
+
rowNoun: A ? we(A.key_field).toLowerCase() : "row",
|
|
4960
4963
|
onApply: Qa
|
|
4961
4964
|
}
|
|
4962
4965
|
),
|
|
@@ -4975,8 +4978,8 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
4975
4978
|
children: "re-run rules…"
|
|
4976
4979
|
}
|
|
4977
4980
|
),
|
|
4978
|
-
!
|
|
4979
|
-
const n = Or.length > 0 ? Or :
|
|
4981
|
+
!R && ve === "original" && O.length + K.length > 0 && vu(Qn).filter((e) => !e.admin_only || On).map((e) => {
|
|
4982
|
+
const n = Or.length > 0 ? Or : Al(), t = de.find((a) => a.field === e.field), r = e.label ?? (t ? fr(t) : we(e.field)), i = new Set(n.map((a) => String(a.row[e.field] ?? ""))), o = i.size === 1 && [...i][0] || null;
|
|
4980
4983
|
return /* @__PURE__ */ l(
|
|
4981
4984
|
xu,
|
|
4982
4985
|
{
|
|
@@ -5027,19 +5030,19 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
5027
5030
|
]
|
|
5028
5031
|
}
|
|
5029
5032
|
),
|
|
5030
|
-
it && pt.size > 0 && !S && !!
|
|
5033
|
+
it && pt.size > 0 && !S && !!L && // Idea 4: the ticked lines leave for a new record (off unless the
|
|
5031
5034
|
// parent collection turns it on for this line list).
|
|
5032
5035
|
/* @__PURE__ */ l(
|
|
5033
5036
|
_u,
|
|
5034
5037
|
{
|
|
5035
|
-
parentCollection:
|
|
5038
|
+
parentCollection: L,
|
|
5036
5039
|
parentId: String(y),
|
|
5037
5040
|
lineCollection: s,
|
|
5038
5041
|
linkField: f,
|
|
5039
5042
|
selectedIds: [...pt].filter((e) => !e.startsWith("pending:")),
|
|
5040
5043
|
selectedUnsaved: [...pt].filter((e) => e.startsWith("pending:")).length,
|
|
5041
5044
|
totalSaved: Math.max(0, O.length - je.size),
|
|
5042
|
-
unsavedEdits: D && (
|
|
5045
|
+
unsavedEdits: D && (F.size > 0 || je.size > 0),
|
|
5043
5046
|
onMoved: () => {
|
|
5044
5047
|
Gn(/* @__PURE__ */ new Set()), Fo(!1);
|
|
5045
5048
|
}
|
|
@@ -5075,7 +5078,7 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
5075
5078
|
]
|
|
5076
5079
|
}
|
|
5077
5080
|
);
|
|
5078
|
-
const n = K.length +
|
|
5081
|
+
const n = K.length + F.size + je.size;
|
|
5079
5082
|
return /* @__PURE__ */ k(
|
|
5080
5083
|
"span",
|
|
5081
5084
|
{
|
|
@@ -5087,7 +5090,7 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
5087
5090
|
"data-grid-waiting": n,
|
|
5088
5091
|
"data-tip": S ? "Lines are kept with this new record and saved when you create it" : "Changes to lines here wait for the record’s Save — Cancel discards them",
|
|
5089
5092
|
children: [
|
|
5090
|
-
/* @__PURE__ */ l(
|
|
5093
|
+
/* @__PURE__ */ l(Lo, { className: "h-3 w-3", "aria-hidden": "true" }),
|
|
5091
5094
|
n > 0 ? `${n} line change${n === 1 ? "" : "s"} wait for Save` : "Saved with the record"
|
|
5092
5095
|
]
|
|
5093
5096
|
}
|
|
@@ -5233,7 +5236,7 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
5233
5236
|
Ct.truncated && /* @__PURE__ */ l("li", { className: "text-amber-700", children: "Preview shows the first 200 lines." })
|
|
5234
5237
|
] }) })
|
|
5235
5238
|
] }),
|
|
5236
|
-
(ae == null ? void 0 : ae.unmatched_banner) && !
|
|
5239
|
+
(ae == null ? void 0 : ae.unmatched_banner) && !R && Ht.unmatchedCandidates.length > 0 && (() => {
|
|
5237
5240
|
var a, c, d, p, m, h, g, _;
|
|
5238
5241
|
const e = Ht.unmatchedCandidates.length, n = ((a = ae.unmatched_banner) == null ? void 0 : a.label) ?? "related line", t = e === 1 ? n : `${n}s`, r = ((c = ae.candidates) == null ? void 0 : c.primary) ?? ((m = (p = (d = ae.candidates) == null ? void 0 : d.keys) == null ? void 0 : p[0]) == null ? void 0 : m.row), i = (_ = (g = (h = ae.candidates) == null ? void 0 : h.keys) == null ? void 0 : g.find(
|
|
5239
5242
|
(x) => x.row === r
|
|
@@ -5280,7 +5283,7 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
5280
5283
|
(c) => {
|
|
5281
5284
|
var d;
|
|
5282
5285
|
return wu(
|
|
5283
|
-
|
|
5286
|
+
Lr(((d = hn.current) == null ? void 0 : d.get(c)) ?? { id: c }),
|
|
5284
5287
|
r.indexOf(c) + 1 || null
|
|
5285
5288
|
);
|
|
5286
5289
|
}
|
|
@@ -5335,7 +5338,7 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
5335
5338
|
/* @__PURE__ */ l("div", { className: "h-8 rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))] animate-pulse" }),
|
|
5336
5339
|
/* @__PURE__ */ l("div", { className: "h-8 rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))] animate-pulse" })
|
|
5337
5340
|
] }),
|
|
5338
|
-
!
|
|
5341
|
+
!R && js.length > 0 && /* @__PURE__ */ l(
|
|
5339
5342
|
wc,
|
|
5340
5343
|
{
|
|
5341
5344
|
proposals: js,
|
|
@@ -5343,8 +5346,8 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
5343
5346
|
onDismiss: (e) => eo(e, !0)
|
|
5344
5347
|
}
|
|
5345
5348
|
),
|
|
5346
|
-
(Ci && Ci.length > 0 || Be && !S && (
|
|
5347
|
-
/* @__PURE__ */ l(vc, { data:
|
|
5349
|
+
(Ci && Ci.length > 0 || Be && !S && (A || Ls || Rs)) && /* @__PURE__ */ k("div", { "data-o2m-stats": !0, className: "mb-2 flex flex-wrap items-stretch gap-1.5", children: [
|
|
5350
|
+
/* @__PURE__ */ l(vc, { data: A, loading: Ls, error: Rs }),
|
|
5348
5351
|
(Ci ?? []).map((e) => /* @__PURE__ */ l(
|
|
5349
5352
|
xc,
|
|
5350
5353
|
{
|
|
@@ -5356,7 +5359,7 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
5356
5359
|
e.label
|
|
5357
5360
|
))
|
|
5358
5361
|
] }),
|
|
5359
|
-
|
|
5362
|
+
R && (qr ? /* @__PURE__ */ k("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
5360
5363
|
Oo,
|
|
5361
5364
|
/* @__PURE__ */ l("div", { className: "ml-auto", children: qr })
|
|
5362
5365
|
] }) : Oo),
|
|
@@ -5484,9 +5487,9 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
5484
5487
|
]
|
|
5485
5488
|
}
|
|
5486
5489
|
) }) }) : null;
|
|
5487
|
-
if (a) return /* @__PURE__ */ l(
|
|
5488
|
-
const d = (u == null ? void 0 : u.rowId) === r, p = d && !Oe, m = ir.view(r), h = Ot === n, g = Yt === n && Ot !== n, _ =
|
|
5489
|
-
return /* @__PURE__ */ k(
|
|
5490
|
+
if (a) return /* @__PURE__ */ l(Ro, { children: c }, r);
|
|
5491
|
+
const d = (u == null ? void 0 : u.rowId) === r, p = d && !Oe, m = ir.view(r), h = Ot === n, g = Yt === n && Ot !== n, _ = F.has(r), x = je.has(r), N = _ ? { ...e, ...F.get(r) } : e, q = Co && !x ? fa.get(String(N[Co] ?? "")) ?? null : null;
|
|
5492
|
+
return /* @__PURE__ */ k(Ro, { children: [
|
|
5490
5493
|
c,
|
|
5491
5494
|
/* @__PURE__ */ k(
|
|
5492
5495
|
"tr",
|
|
@@ -5585,7 +5588,7 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
5585
5588
|
}
|
|
5586
5589
|
),
|
|
5587
5590
|
gs.has(r) && /* @__PURE__ */ l(
|
|
5588
|
-
|
|
5591
|
+
Lo,
|
|
5589
5592
|
{
|
|
5590
5593
|
className: "h-2.5 w-2.5 text-amber-500",
|
|
5591
5594
|
"aria-label": "Line overdue",
|
|
@@ -5623,7 +5626,7 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
5623
5626
|
}
|
|
5624
5627
|
),
|
|
5625
5628
|
!M && gs.has(r) && /* @__PURE__ */ l(
|
|
5626
|
-
|
|
5629
|
+
Lo,
|
|
5627
5630
|
{
|
|
5628
5631
|
className: "mr-1 inline h-2.5 w-2.5 text-amber-500",
|
|
5629
5632
|
"aria-label": "Line overdue",
|
|
@@ -5653,14 +5656,14 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
5653
5656
|
] })
|
|
5654
5657
|
] }),
|
|
5655
5658
|
d && !x && dt === "panel" ? Io({
|
|
5656
|
-
identity: `${M ? `Line ${n + 1} · ` : ""}${
|
|
5659
|
+
identity: `${M ? `Line ${n + 1} · ` : ""}${Lr(N)}`,
|
|
5657
5660
|
draft: (u == null ? void 0 : u.draft) ?? N,
|
|
5658
5661
|
rowId: r,
|
|
5659
5662
|
saveLabel: "Save",
|
|
5660
5663
|
onDelete: (b) => ko(e, b),
|
|
5661
5664
|
drawer: yi(r, (u == null ? void 0 : u.draft) ?? N)
|
|
5662
5665
|
}) : (() => {
|
|
5663
|
-
const b =
|
|
5666
|
+
const b = Rr(N, { rowKey: r });
|
|
5664
5667
|
return Te.map((v, T) => {
|
|
5665
5668
|
var ue, pe, te;
|
|
5666
5669
|
if (rt(v))
|
|
@@ -5668,7 +5671,7 @@ ${a.toLocaleString("en-US", St(t, t.format))}`;
|
|
|
5668
5671
|
const I = v.computed_type === "write" && !!v.computed_formula, Z = I ? Wt(
|
|
5669
5672
|
v.computed_formula,
|
|
5670
5673
|
d ? (u == null ? void 0 : u.draft) ?? N : N
|
|
5671
|
-
) ?? N[v.field] : null, V = z && !d && !x ? (ue = Pi[r]) == null ? void 0 : ue[v.field] : void 0,
|
|
5674
|
+
) ?? N[v.field] : null, V = z && !d && !x ? (ue = Pi[r]) == null ? void 0 : ue[v.field] : void 0, G = V ? `${v.label || we(v.field)} · changed ${Hl(V.at)} by ${V.who}${V.reason ? `
|
|
5672
5675
|
Reason: “${V.reason}”` : ""}` : void 0;
|
|
5673
5676
|
return /* @__PURE__ */ k(
|
|
5674
5677
|
"td",
|
|
@@ -5681,18 +5684,18 @@ Reason: “${V.reason}”` : ""}` : void 0;
|
|
|
5681
5684
|
N[v.field],
|
|
5682
5685
|
p
|
|
5683
5686
|
)) && "relative",
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
N[
|
|
5687
|
+
A && Xt(
|
|
5688
|
+
A,
|
|
5689
|
+
N[A.key_field],
|
|
5687
5690
|
v.field
|
|
5688
5691
|
) && "bg-slate-50/80 dark:bg-white/[0.035]"
|
|
5689
5692
|
),
|
|
5690
|
-
"data-compare-closed":
|
|
5691
|
-
|
|
5692
|
-
N[
|
|
5693
|
+
"data-compare-closed": A && Xt(
|
|
5694
|
+
A,
|
|
5695
|
+
N[A.key_field],
|
|
5693
5696
|
v.field
|
|
5694
5697
|
) ? "" : void 0,
|
|
5695
|
-
"data-tip":
|
|
5698
|
+
"data-tip": G,
|
|
5696
5699
|
children: [
|
|
5697
5700
|
T === 0 && $r === "data" && Er(r),
|
|
5698
5701
|
(() => {
|
|
@@ -5747,7 +5750,7 @@ Reason: “${V.reason}”` : ""}` : void 0;
|
|
|
5747
5750
|
itemId: r,
|
|
5748
5751
|
cascadeFilter: Ye[v.field],
|
|
5749
5752
|
narrowedBy: Cr[v.field],
|
|
5750
|
-
pinnedOption:
|
|
5753
|
+
pinnedOption: Rn(
|
|
5751
5754
|
v.field,
|
|
5752
5755
|
(u == null ? void 0 : u.draft) ?? {}
|
|
5753
5756
|
),
|
|
@@ -5770,17 +5773,17 @@ Reason: “${V.reason}”` : ""}` : void 0;
|
|
|
5770
5773
|
N[v.field],
|
|
5771
5774
|
e.id != null ? String(e.id) : void 0
|
|
5772
5775
|
) }),
|
|
5773
|
-
|
|
5776
|
+
A && /* @__PURE__ */ l(
|
|
5774
5777
|
To,
|
|
5775
5778
|
{
|
|
5776
|
-
data:
|
|
5777
|
-
row: Mo(
|
|
5778
|
-
rowKey: N[
|
|
5779
|
+
data: A,
|
|
5780
|
+
row: Mo(A, N),
|
|
5781
|
+
rowKey: N[A.key_field],
|
|
5779
5782
|
column: v.field,
|
|
5780
5783
|
planned: p && !x ? u == null ? void 0 : u.draft[v.field] : N[v.field],
|
|
5781
5784
|
columnLabel: fr(v),
|
|
5782
5785
|
plannedRow: N,
|
|
5783
|
-
onAdjust: !
|
|
5786
|
+
onAdjust: !R && !x && e.id != null ? (qe, Ze) => void Ln(String(e.id), qe, Ze) : void 0
|
|
5784
5787
|
}
|
|
5785
5788
|
)
|
|
5786
5789
|
]
|
|
@@ -5885,7 +5888,7 @@ Reason: “${V.reason}”` : ""}` : void 0;
|
|
|
5885
5888
|
rowLabel: qu(e)
|
|
5886
5889
|
}
|
|
5887
5890
|
),
|
|
5888
|
-
!
|
|
5891
|
+
!R && /* @__PURE__ */ l(
|
|
5889
5892
|
na,
|
|
5890
5893
|
{
|
|
5891
5894
|
saved: r != null && !String(r).startsWith("pending"),
|
|
@@ -5942,7 +5945,7 @@ Reason: “${V.reason}”` : ""}` : void 0;
|
|
|
5942
5945
|
} : D ? {
|
|
5943
5946
|
deferred: !0,
|
|
5944
5947
|
stagedOps: (u == null ? void 0 : u.draft[`__nested_ops_${v}`]) ?? xi,
|
|
5945
|
-
onStagedOpsChange: (
|
|
5948
|
+
onStagedOpsChange: (G) => _t(`__nested_ops_${v}`, G)
|
|
5946
5949
|
} : {}
|
|
5947
5950
|
},
|
|
5948
5951
|
v
|
|
@@ -6014,7 +6017,7 @@ Reason: “${V.reason}”` : ""}` : void 0;
|
|
|
6014
6017
|
itemId: "new",
|
|
6015
6018
|
cascadeFilter: Ye[e.field],
|
|
6016
6019
|
narrowedBy: Cr[e.field],
|
|
6017
|
-
pinnedOption:
|
|
6020
|
+
pinnedOption: Rn(e.field, u.draft)
|
|
6018
6021
|
}
|
|
6019
6022
|
) }) }, e.field);
|
|
6020
6023
|
}),
|
|
@@ -6207,11 +6210,11 @@ Reason: “${V.reason}”` : ""}` : void 0;
|
|
|
6207
6210
|
] })
|
|
6208
6211
|
}
|
|
6209
6212
|
) }),
|
|
6210
|
-
|
|
6213
|
+
A && ve === "original" && (() => {
|
|
6211
6214
|
const e = /* @__PURE__ */ new Set();
|
|
6212
|
-
for (const t of O ?? []) e.add(String(t[
|
|
6213
|
-
for (const t of K) e.add(String(t[
|
|
6214
|
-
const n =
|
|
6215
|
+
for (const t of O ?? []) e.add(String(t[A.key_field] ?? ""));
|
|
6216
|
+
for (const t of K) e.add(String(t[A.key_field] ?? ""));
|
|
6217
|
+
const n = A.rows.filter((t) => !e.has(String(t.key)));
|
|
6215
6218
|
return n.length === 0 ? null : n.map((t) => /* @__PURE__ */ k(
|
|
6216
6219
|
"tr",
|
|
6217
6220
|
{
|
|
@@ -6222,20 +6225,20 @@ Reason: “${V.reason}”` : ""}` : void 0;
|
|
|
6222
6225
|
oe && (X || S || D) && /* @__PURE__ */ l("td", {}),
|
|
6223
6226
|
M && /* @__PURE__ */ l("td", {}),
|
|
6224
6227
|
(S || D) && /* @__PURE__ */ l("td", { className: "px-3 py-1 align-top", children: /* @__PURE__ */ k("span", { className: "text-[10px] font-medium uppercase tracking-wide text-slate-500 dark:text-slate-400", children: [
|
|
6225
|
-
|
|
6228
|
+
A.label,
|
|
6226
6229
|
" only"
|
|
6227
6230
|
] }) }),
|
|
6228
6231
|
Te.map(
|
|
6229
|
-
(r) => r.field ===
|
|
6232
|
+
(r) => r.field === A.key_field ? /* @__PURE__ */ k("td", { className: "px-2 py-1 align-top", children: [
|
|
6230
6233
|
/* @__PURE__ */ l("div", { className: "py-0.5 text-[12px] font-medium text-slate-700 dark:text-slate-200", children: String(t.key) }),
|
|
6231
6234
|
/* @__PURE__ */ k(
|
|
6232
6235
|
"div",
|
|
6233
6236
|
{
|
|
6234
6237
|
className: "mt-0.5 text-[10.5px] text-slate-600 dark:text-slate-300",
|
|
6235
|
-
"data-tip": `${
|
|
6238
|
+
"data-tip": `${A.label} recorded for ${String(t.key)} with no ${C ? C.toLowerCase() : "row"} to compare against — add a row for ${String(t.key)} to plan against it`,
|
|
6236
6239
|
children: [
|
|
6237
6240
|
"No plan for this ",
|
|
6238
|
-
we(
|
|
6241
|
+
we(A.key_field).toLowerCase()
|
|
6239
6242
|
]
|
|
6240
6243
|
}
|
|
6241
6244
|
)
|
|
@@ -6244,14 +6247,14 @@ Reason: “${V.reason}”` : ""}` : void 0;
|
|
|
6244
6247
|
{
|
|
6245
6248
|
className: xe(
|
|
6246
6249
|
"px-2 py-1 align-top",
|
|
6247
|
-
Xt(
|
|
6250
|
+
Xt(A, t.key, r.field) && "bg-slate-100/70 dark:bg-white/[0.035]"
|
|
6248
6251
|
),
|
|
6249
6252
|
children: [
|
|
6250
|
-
|
|
6253
|
+
A.columns.includes(r.field) && /* @__PURE__ */ l("div", { className: "py-0.5 text-[12px] text-slate-300 dark:text-slate-600", children: "—" }),
|
|
6251
6254
|
/* @__PURE__ */ l(
|
|
6252
6255
|
To,
|
|
6253
6256
|
{
|
|
6254
|
-
data:
|
|
6257
|
+
data: A,
|
|
6255
6258
|
row: t,
|
|
6256
6259
|
rowKey: t.key,
|
|
6257
6260
|
column: r.field,
|
|
@@ -6274,7 +6277,7 @@ Reason: “${V.reason}”` : ""}` : void 0;
|
|
|
6274
6277
|
const t = `pending:${n}`, r = gi[n] ?? "show";
|
|
6275
6278
|
if (r === "hide") return null;
|
|
6276
6279
|
const i = (u == null ? void 0 : u.rowId) === t, o = i && !Oe, a = Ot === n, c = Yt === n && Ot !== n, d = !!e.__prefilled;
|
|
6277
|
-
return /* @__PURE__ */ k(
|
|
6280
|
+
return /* @__PURE__ */ k(Ro, { children: [
|
|
6278
6281
|
/* @__PURE__ */ k(
|
|
6279
6282
|
"tr",
|
|
6280
6283
|
{
|
|
@@ -6357,7 +6360,7 @@ Reason: “${V.reason}”` : ""}` : void 0;
|
|
|
6357
6360
|
] })
|
|
6358
6361
|
] }),
|
|
6359
6362
|
i && dt === "panel" ? Io({
|
|
6360
|
-
identity: `${M ? `Line ${O.length + n + 1} · ` : ""}${
|
|
6363
|
+
identity: `${M ? `Line ${O.length + n + 1} · ` : ""}${Lr(i ? u.draft : e)}`,
|
|
6361
6364
|
draft: (u == null ? void 0 : u.draft) ?? e,
|
|
6362
6365
|
rowId: t,
|
|
6363
6366
|
saveLabel: "Save",
|
|
@@ -6368,7 +6371,7 @@ Reason: “${V.reason}”` : ""}` : void 0;
|
|
|
6368
6371
|
// draft, so there is no row id to pass yet.
|
|
6369
6372
|
drawer: yi(void 0, (u == null ? void 0 : u.draft) ?? e)
|
|
6370
6373
|
}) : (() => {
|
|
6371
|
-
const p =
|
|
6374
|
+
const p = Rr(
|
|
6372
6375
|
i ? u.draft : e,
|
|
6373
6376
|
{ rowKey: t }
|
|
6374
6377
|
);
|
|
@@ -6422,7 +6425,7 @@ Reason: “${V.reason}”` : ""}` : void 0;
|
|
|
6422
6425
|
itemId: "new",
|
|
6423
6426
|
cascadeFilter: Ye[m.field],
|
|
6424
6427
|
narrowedBy: Cr[m.field],
|
|
6425
|
-
pinnedOption:
|
|
6428
|
+
pinnedOption: Rn(m.field, u.draft)
|
|
6426
6429
|
}
|
|
6427
6430
|
) }) : m.interface === "formula-column" ? /* @__PURE__ */ l("div", { className: "py-0.5 overflow-hidden", children: ze(m, p[m.field], void 0, p) }) : m.computed_type === "rollup" ? /* @__PURE__ */ l("div", { className: "py-0.5 overflow-hidden", children: ze(
|
|
6428
6431
|
m,
|
|
@@ -6437,15 +6440,15 @@ Reason: “${V.reason}”` : ""}` : void 0;
|
|
|
6437
6440
|
children: "Pick again"
|
|
6438
6441
|
}
|
|
6439
6442
|
) : /* @__PURE__ */ l("div", { className: "py-0.5 overflow-hidden", children: ze(m, q, String(e.id)) }),
|
|
6440
|
-
|
|
6443
|
+
A && /* @__PURE__ */ l(
|
|
6441
6444
|
To,
|
|
6442
6445
|
{
|
|
6443
|
-
data:
|
|
6446
|
+
data: A,
|
|
6444
6447
|
row: Mo(
|
|
6445
|
-
|
|
6448
|
+
A,
|
|
6446
6449
|
i ? u.draft : e
|
|
6447
6450
|
),
|
|
6448
|
-
rowKey: (i ? u.draft : e)[
|
|
6451
|
+
rowKey: (i ? u.draft : e)[A.key_field],
|
|
6449
6452
|
column: m.field,
|
|
6450
6453
|
planned: i ? u.draft[m.field] : e[m.field],
|
|
6451
6454
|
columnLabel: fr(m)
|
|
@@ -6546,8 +6549,8 @@ Reason: “${V.reason}”` : ""}` : void 0;
|
|
|
6546
6549
|
})() : t.options : {}).aggregate).length === 0) return null;
|
|
6547
6550
|
const n = [
|
|
6548
6551
|
...(O ?? []).filter((t) => !je.has(String(t.id))).map((t) => {
|
|
6549
|
-
const r = String(t.id), i =
|
|
6550
|
-
return
|
|
6552
|
+
const r = String(t.id), i = F.has(r) ? { ...t, ...F.get(r) } : t;
|
|
6553
|
+
return Rr(
|
|
6551
6554
|
ge(i),
|
|
6552
6555
|
{ rowKey: r }
|
|
6553
6556
|
);
|
|
@@ -6555,7 +6558,7 @@ Reason: “${V.reason}”` : ""}` : void 0;
|
|
|
6555
6558
|
// Pending rows have no stored rollup values — derive them from
|
|
6556
6559
|
// their staged members so Allocated sums true before save.
|
|
6557
6560
|
...K.map(
|
|
6558
|
-
(t, r) =>
|
|
6561
|
+
(t, r) => Rr(ge(t), {
|
|
6559
6562
|
rowKey: `pending:${r}`
|
|
6560
6563
|
})
|
|
6561
6564
|
)
|
|
@@ -6572,13 +6575,13 @@ Reason: “${V.reason}”` : ""}` : void 0;
|
|
|
6572
6575
|
} catch {
|
|
6573
6576
|
return {};
|
|
6574
6577
|
}
|
|
6575
|
-
})() : t.options : {}, i = r.aggregate, o = _c(
|
|
6578
|
+
})() : t.options : {}, i = r.aggregate, o = _c(A, t.field), a = o != null ? /* @__PURE__ */ k(
|
|
6576
6579
|
"div",
|
|
6577
6580
|
{
|
|
6578
6581
|
"data-compare-footer": t.field,
|
|
6579
6582
|
className: "mt-0.5 flex min-w-0 flex-wrap items-baseline gap-x-1 text-[11px] font-normal leading-4 text-slate-500 dark:text-slate-400",
|
|
6580
6583
|
children: [
|
|
6581
|
-
/* @__PURE__ */ l("span", { className: "font-mono text-[9px] uppercase tracking-wide text-slate-500 dark:text-slate-400", children:
|
|
6584
|
+
/* @__PURE__ */ l("span", { className: "font-mono text-[9px] uppercase tracking-wide text-slate-500 dark:text-slate-400", children: A == null ? void 0 : A.label }),
|
|
6582
6585
|
/* @__PURE__ */ l("span", { className: "tabular-nums", children: jo(o) })
|
|
6583
6586
|
]
|
|
6584
6587
|
}
|
|
@@ -6666,7 +6669,7 @@ Reason: “${V.reason}”` : ""}` : void 0;
|
|
|
6666
6669
|
]
|
|
6667
6670
|
}
|
|
6668
6671
|
),
|
|
6669
|
-
ve === "original" && !Sr && !
|
|
6672
|
+
ve === "original" && !Sr && !R && /* @__PURE__ */ l("div", { className: "border-t border-slate-100 px-3 py-1.5", children: /* @__PURE__ */ l(
|
|
6670
6673
|
"button",
|
|
6671
6674
|
{
|
|
6672
6675
|
type: "button",
|
|
@@ -6680,7 +6683,7 @@ Reason: “${V.reason}”` : ""}` : void 0;
|
|
|
6680
6683
|
),
|
|
6681
6684
|
Oe && et && ve === "original" && /* @__PURE__ */ l("div", { "data-grid-split-editor-lock": "", children: Tl(et, "docked") }),
|
|
6682
6685
|
Oe && u && ve === "original" && (() => {
|
|
6683
|
-
const e = u.rowId, n = e.startsWith("pending:"), t = n ? parseInt(e.split(":")[1], 10) : -1, r = !n && e !== "new" ? O.findIndex((d) => String(d.id) === e) : -1, i = r >= 0 ? O[r] : void 0, o = e === "new" ? O.length + K.length + 1 : n ? O.length + t + 1 : r + 1, a = M ? `Line ${o} · ` : "", c = e === "new" ? `${a}New line` : `${a}${
|
|
6686
|
+
const e = u.rowId, n = e.startsWith("pending:"), t = n ? parseInt(e.split(":")[1], 10) : -1, r = !n && e !== "new" ? O.findIndex((d) => String(d.id) === e) : -1, i = r >= 0 ? O[r] : void 0, o = e === "new" ? O.length + K.length + 1 : n ? O.length + t + 1 : r + 1, a = M ? `Line ${o} · ` : "", c = e === "new" ? `${a}New line` : `${a}${Lr(u.draft)}`;
|
|
6684
6687
|
return /* @__PURE__ */ k(
|
|
6685
6688
|
"div",
|
|
6686
6689
|
{
|
|
@@ -6739,13 +6742,13 @@ Reason: “${V.reason}”` : ""}` : void 0;
|
|
|
6739
6742
|
open: Yn,
|
|
6740
6743
|
onOpenChange: Go,
|
|
6741
6744
|
columns: Se.filter(
|
|
6742
|
-
(e) => !
|
|
6745
|
+
(e) => !Ar(e) && !e.field.includes(".") && !dr(e.interface) && !Gl.has(e.field)
|
|
6743
6746
|
),
|
|
6744
6747
|
rows: Or.map((e) => e.row),
|
|
6745
6748
|
relations: Ue,
|
|
6746
6749
|
collection: s,
|
|
6747
6750
|
cascadeFilters: Ye,
|
|
6748
|
-
onApply:
|
|
6751
|
+
onApply: Ad,
|
|
6749
6752
|
onEditIntent: () => {
|
|
6750
6753
|
var e;
|
|
6751
6754
|
(e = w == null ? void 0 : w.noteEditIntent) == null || e.call(w), as(!0);
|
|
@@ -6770,7 +6773,7 @@ Reason: “${V.reason}”` : ""}` : void 0;
|
|
|
6770
6773
|
collection: s,
|
|
6771
6774
|
m2oDisplays: bn,
|
|
6772
6775
|
client: $,
|
|
6773
|
-
allowRestore: !!le && !
|
|
6776
|
+
allowRestore: !!le && !R,
|
|
6774
6777
|
rowLabel: (e, n) => {
|
|
6775
6778
|
const t = X ? n[X] : n.line_number, r = O.findIndex((c) => String(c.id) === String(e)) + 1, i = t != null && t !== "" ? `Line ${String(t)}` : r > 0 ? `Line ${r}` : "A removed line", o = Se.find(
|
|
6776
6779
|
(c) => c.field !== "id" && !He.get(c.field) && /^(string|text)$/i.test(c.type ?? "") && typeof n[c.field] == "string" && n[c.field].trim() !== ""
|
|
@@ -6785,20 +6788,20 @@ Reason: “${V.reason}”` : ""}` : void 0;
|
|
|
6785
6788
|
/* @__PURE__ */ l(
|
|
6786
6789
|
Zl,
|
|
6787
6790
|
{
|
|
6788
|
-
open: !!
|
|
6791
|
+
open: !!Ae,
|
|
6789
6792
|
onOpenChange: (e) => {
|
|
6790
6793
|
e || (Cn(null), Oi(null));
|
|
6791
6794
|
},
|
|
6792
6795
|
rowTitle: (() => {
|
|
6793
|
-
const e = X ?
|
|
6796
|
+
const e = X ? Ae == null ? void 0 : Ae[X] : Ae == null ? void 0 : Ae.line_number;
|
|
6794
6797
|
return e != null && e !== "" ? `Line ${String(e)}` : "This row";
|
|
6795
6798
|
})(),
|
|
6796
6799
|
rowSubtitle: (() => {
|
|
6797
|
-
if (!
|
|
6800
|
+
if (!Ae) return null;
|
|
6798
6801
|
const e = Se.find(
|
|
6799
|
-
(n) => n.field !== "id" && !He.get(n.field) && /^(string|text)$/i.test(n.type ?? "") && typeof
|
|
6802
|
+
(n) => n.field !== "id" && !He.get(n.field) && /^(string|text)$/i.test(n.type ?? "") && typeof Ae[n.field] == "string" && Ae[n.field].trim() !== ""
|
|
6800
6803
|
);
|
|
6801
|
-
return e ? String(
|
|
6804
|
+
return e ? String(Ae[e.field]) : null;
|
|
6802
6805
|
})(),
|
|
6803
6806
|
revisions: wa,
|
|
6804
6807
|
loading: va,
|
|
@@ -6810,9 +6813,9 @@ Reason: “${V.reason}”` : ""}` : void 0;
|
|
|
6810
6813
|
collection: s,
|
|
6811
6814
|
m2oDisplays: bn,
|
|
6812
6815
|
client: $,
|
|
6813
|
-
allowRestore: !!le && !
|
|
6816
|
+
allowRestore: !!le && !R,
|
|
6814
6817
|
focusRevisionId: ba,
|
|
6815
|
-
onRestore: (e, n) => yo(e, { ...n, itemId: n.itemId ?? String(
|
|
6818
|
+
onRestore: (e, n) => yo(e, { ...n, itemId: n.itemId ?? String(Ae.id) })
|
|
6816
6819
|
}
|
|
6817
6820
|
)
|
|
6818
6821
|
]
|
|
@@ -6847,7 +6850,7 @@ function ju({
|
|
|
6847
6850
|
config: s,
|
|
6848
6851
|
draft: f,
|
|
6849
6852
|
remaining: y,
|
|
6850
|
-
onApply:
|
|
6853
|
+
onApply: L,
|
|
6851
6854
|
closedFields: U,
|
|
6852
6855
|
shapeSource: z
|
|
6853
6856
|
}) {
|
|
@@ -6866,7 +6869,7 @@ function ju({
|
|
|
6866
6869
|
const fe = z ? M.map((ee) => z.values[ee] ?? 0) : void 0, Fe = ca($e, M.length, se, fe), _e = {};
|
|
6867
6870
|
M.forEach((ee, ye) => {
|
|
6868
6871
|
_e[ee] = Fe[ye];
|
|
6869
|
-
}),
|
|
6872
|
+
}), L(_e);
|
|
6870
6873
|
},
|
|
6871
6874
|
disabled: !!Ie,
|
|
6872
6875
|
title: Ie ?? `${ie($e)} across ${M.length} ${M.length === 1 ? "field" : "fields"}`,
|
|
@@ -6904,7 +6907,7 @@ function ju({
|
|
|
6904
6907
|
] });
|
|
6905
6908
|
}
|
|
6906
6909
|
function Tu(s) {
|
|
6907
|
-
const [f, y] = B(!1), [
|
|
6910
|
+
const [f, y] = B(!1), [L, U] = B("even"), z = s.remaining == null || !Number.isFinite(s.remaining) ? 0 : Math.round(s.remaining * 100) / 100, re = (J) => s.config.format === "number" ? J.toLocaleString(void 0, { maximumFractionDigits: 2 }) : J.toLocaleString(void 0, { style: "currency", currency: "USD" });
|
|
6908
6911
|
if (z <= 0) return null;
|
|
6909
6912
|
const le = (s.config.presets ?? ["even", "front", "back"]).filter(
|
|
6910
6913
|
(J) => J !== "shape"
|
|
@@ -6945,7 +6948,7 @@ function Tu(s) {
|
|
|
6945
6948
|
ua,
|
|
6946
6949
|
{
|
|
6947
6950
|
presets: le,
|
|
6948
|
-
value: le.includes(
|
|
6951
|
+
value: le.includes(L) ? L : le[0],
|
|
6949
6952
|
onChange: U
|
|
6950
6953
|
}
|
|
6951
6954
|
) }),
|
|
@@ -6965,7 +6968,7 @@ function Tu(s) {
|
|
|
6965
6968
|
type: "button",
|
|
6966
6969
|
"data-o2m-spread-rows-apply": !0,
|
|
6967
6970
|
onClick: () => {
|
|
6968
|
-
s.onApply(le.includes(
|
|
6971
|
+
s.onApply(le.includes(L) ? L : le[0]), y(!1);
|
|
6969
6972
|
},
|
|
6970
6973
|
className: "h-7 rounded-md bg-nvr-cyan px-3 text-[12px] font-semibold text-white hover:opacity-90",
|
|
6971
6974
|
children: "Stage the spread"
|
|
@@ -6978,14 +6981,14 @@ function Tu(s) {
|
|
|
6978
6981
|
] });
|
|
6979
6982
|
}
|
|
6980
6983
|
function oa(s) {
|
|
6981
|
-
var y,
|
|
6984
|
+
var y, L;
|
|
6982
6985
|
const f = s;
|
|
6983
|
-
return ((y = f == null ? void 0 : f.response) == null ? void 0 : y.error) ?? ((
|
|
6986
|
+
return ((y = f == null ? void 0 : f.response) == null ? void 0 : y.error) ?? ((L = f == null ? void 0 : f.response) == null ? void 0 : L.message) ?? (f == null ? void 0 : f.message) ?? "the server refused it";
|
|
6984
6987
|
}
|
|
6985
6988
|
export {
|
|
6986
6989
|
na as DeleteLineButton,
|
|
6987
6990
|
jf as InlineTableField,
|
|
6988
|
-
|
|
6991
|
+
Au as applyValueColumns,
|
|
6989
6992
|
Nu as dropUnavailableValues,
|
|
6990
6993
|
Wt as evalClientFormula,
|
|
6991
6994
|
Wo as failingLints,
|