@nivaro/react 0.3.58 → 0.3.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/fields/RelationField.js +110 -80
- package/dist/full.css +1 -1
- package/dist/hooks/useRelationOptions.js +1 -0
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +32 -1
- package/dist/index.js +523 -520
- package/dist/shared/components/CollectionBrowserView.js +2083 -2052
- package/dist/shared/components/DataTable.js +497 -465
- package/dist/shared/components/ItemEditForm.js +4430 -4282
- package/dist/shared/components/PageRenderer.js +537 -508
- package/dist/shared/components/QueryTable.js +74 -74
- package/dist/shared/components/WidgetSlot.js +543 -520
- package/dist/shared/components/alerts/AlertManagerView.js +269 -275
- package/dist/shared/components/alerts/types.js +37 -14
- package/dist/shared/components/item-edit/FieldRenderer.js +22 -20
- package/dist/shared/components/item-edit/GridBulkEditDialog.js +55 -54
- package/dist/shared/components/item-edit/InlineTableField.js +2461 -2421
- package/dist/shared/components/item-edit/M2MCombobox.js +141 -137
- package/dist/shared/components/item-edit/PlanGrid.js +876 -820
- package/dist/shared/components/item-edit/QuickCreateButton.js +323 -130
- package/dist/shared/components/item-edit/RelationCombobox.js +408 -375
- package/dist/shared/components/item-edit/RelationGroupedCombobox.js +255 -156
- package/dist/shared/components/item-edit/SummaryPanel.js +356 -343
- package/dist/shared/components/item-edit/duplicate-rehearsal.js +47 -0
- package/dist/shared/components/item-edit/line-midair.js +82 -75
- package/dist/shared/components/item-edit/save-outcome.js +6 -4
- package/dist/shared/components/panels/ItemLockBanner.js +212 -209
- package/dist/shared/components/panels/PipelinePanel.js +775 -737
- package/dist/shared/components/panels/RecordIntegrityBanner.js +114 -86
- package/dist/shared/components/panels/RevisionsPanel.js +313 -299
- package/dist/shared/components/pipeline/PipelineEditorView.js +26 -16
- package/dist/shared/components/queue/QueueQuickFilters.js +13 -13
- package/dist/shared/components/queue/QueueWorklist.js +978 -953
- package/dist/shared/components/queue/live-state-aspect.js +9 -5
- package/dist/shared/components/widgets/ReviewListWidget.js +152 -149
- package/dist/shared/lib/display-prefs.js +60 -52
- package/dist/shared/lib/draft-store.js +71 -48
- package/dist/shared/lib/expression.js +53 -53
- package/dist/shared/lib/list-page-memory.js +42 -20
- package/dist/shared/lib/money-input.js +45 -0
- package/dist/shared/lib/sanitize-html.js +10 -6
- package/dist/shared/lib/staged-row-labels.js +18 -0
- package/package.json +1 -1
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { AUDIT_FIELDS as g } from "../panels/requirement-side-effects.js";
|
|
2
|
+
const l = (t) => t == null || t === "";
|
|
3
|
+
function h(t, n) {
|
|
4
|
+
if (t === n || l(t) && l(n)) return !0;
|
|
5
|
+
if (l(t) || l(n)) return !1;
|
|
6
|
+
if (typeof t == "object" || typeof n == "object") return JSON.stringify(t) === JSON.stringify(n);
|
|
7
|
+
const i = Number(t), r = Number(n);
|
|
8
|
+
return !Number.isNaN(i) && !Number.isNaN(r) && String(t).trim() !== "" && String(n).trim() !== "" ? i === r : String(t) === String(n);
|
|
9
|
+
}
|
|
10
|
+
function j(t, n, i) {
|
|
11
|
+
const r = {};
|
|
12
|
+
for (const [s, e] of Object.entries(t)) s.startsWith("__") || (r[s] = e);
|
|
13
|
+
const f = {};
|
|
14
|
+
for (const [s, e] of Object.entries(n)) {
|
|
15
|
+
const c = i(s);
|
|
16
|
+
!c || !Array.isArray(e) || e.length === 0 || (f[s] = c, r[c] = e.map(
|
|
17
|
+
(b) => Object.fromEntries(Object.entries(b).filter(([u]) => !u.startsWith("__")))
|
|
18
|
+
));
|
|
19
|
+
}
|
|
20
|
+
return { body: r, aliases: f };
|
|
21
|
+
}
|
|
22
|
+
function p(t, n, i) {
|
|
23
|
+
const r = [];
|
|
24
|
+
for (const [f, s] of Object.entries(t)) {
|
|
25
|
+
const e = i[f], c = e ? (n == null ? void 0 : n[e]) ?? [] : [];
|
|
26
|
+
c.length !== 0 && s.forEach((b, u) => {
|
|
27
|
+
const a = c.find((o) => o.index === u) ?? c[u];
|
|
28
|
+
if (!(!a || !a.ok || !a.data))
|
|
29
|
+
for (const [o, m] of Object.entries(b)) {
|
|
30
|
+
if (o === "id" || o.startsWith("_") || g.has(o.toLowerCase()) || l(m) || typeof m == "object" || !(o in a.data)) continue;
|
|
31
|
+
const y = a.data[o];
|
|
32
|
+
h(m, y) || r.push({ key: f, index: u, field: o, from: m, to: y });
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return r;
|
|
37
|
+
}
|
|
38
|
+
function O(t, n) {
|
|
39
|
+
const i = t.line_number ?? t.sort ?? null;
|
|
40
|
+
return `Line ${i != null && i !== "" ? String(i) : n + 1}`;
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
O as copiedLineLabel,
|
|
44
|
+
p as copiedValueChanges,
|
|
45
|
+
j as rehearsalBody,
|
|
46
|
+
h as sameLineValue
|
|
47
|
+
};
|
|
@@ -1,106 +1,106 @@
|
|
|
1
1
|
var q = Object.defineProperty;
|
|
2
2
|
var _ = (s, t, n) => t in s ? q(s, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : s[t] = n;
|
|
3
|
-
var
|
|
3
|
+
var w = (s, t, n) => _(s, typeof t != "symbol" ? t + "" : t, n);
|
|
4
4
|
import { patch as b, get as h } from "../../lib/commands.js";
|
|
5
5
|
import { midairCollisionOf as d } from "../../lib/record-outbox.js";
|
|
6
6
|
function S(s, t) {
|
|
7
7
|
return typeof t != "number" || !Number.isFinite(t) || t <= 0 ? s : { ...s, _base_revision: t };
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function A(s, t) {
|
|
10
10
|
return `${s.key}\0${s.rowId}\0${t}`;
|
|
11
11
|
}
|
|
12
12
|
function C(s, t) {
|
|
13
13
|
const n = {};
|
|
14
|
-
for (const [
|
|
15
|
-
return Object.keys(n).some((
|
|
14
|
+
for (const [i, e] of Object.entries(s)) t.has(i) || (n[i] = e);
|
|
15
|
+
return Object.keys(n).some((i) => i !== "_change_reason" && i !== "__flush_early") ? n : null;
|
|
16
16
|
}
|
|
17
|
-
function N(s, t, n,
|
|
18
|
-
const
|
|
17
|
+
function N(s, t, n, r) {
|
|
18
|
+
const i = s.findIndex((a) => String(a.id) === String(t)), e = i >= 0 ? s[i] : void 0, o = (e == null ? void 0 : e[n || "line_number"]) ?? (e == null ? void 0 : e.line_number);
|
|
19
19
|
if (o != null && o !== "") return `Line ${String(o)}`;
|
|
20
20
|
if (e) {
|
|
21
21
|
const a = e.year;
|
|
22
22
|
if ((typeof a == "number" || typeof a == "string") && /^\d{4}$/.test(String(a)))
|
|
23
23
|
return `Year ${String(a)}`;
|
|
24
24
|
}
|
|
25
|
-
return
|
|
25
|
+
return i >= 0 ? `Line ${i + 1}` : `Row ${t}`;
|
|
26
26
|
}
|
|
27
|
-
const
|
|
27
|
+
const p = 500;
|
|
28
28
|
function k(s) {
|
|
29
29
|
var n;
|
|
30
30
|
const t = s;
|
|
31
31
|
return ((t == null ? void 0 : t.status) ?? ((n = t == null ? void 0 : t.response) == null ? void 0 : n.status)) === 404;
|
|
32
32
|
}
|
|
33
33
|
async function $(s, t, n) {
|
|
34
|
-
const
|
|
34
|
+
const r = /* @__PURE__ */ new Map(), i = [...new Set(n.map(String))].filter(
|
|
35
35
|
(e) => e && e !== "new" && !e.startsWith("pending:")
|
|
36
36
|
);
|
|
37
|
-
for (let e = 0; e <
|
|
38
|
-
const o =
|
|
37
|
+
for (let e = 0; e < i.length; e += p) {
|
|
38
|
+
const o = i.slice(e, e + p);
|
|
39
39
|
try {
|
|
40
40
|
const a = await s.request(
|
|
41
41
|
h("/revisions/latest", { collection: t, items: o.join(",") })
|
|
42
42
|
);
|
|
43
|
-
for (const [
|
|
44
|
-
|
|
43
|
+
for (const [c, u] of Object.entries((a == null ? void 0 : a.data) ?? {}))
|
|
44
|
+
r.set(c, typeof u == "number" && Number.isFinite(u) ? u : null);
|
|
45
45
|
} catch (a) {
|
|
46
46
|
if (!k(a)) continue;
|
|
47
|
-
let
|
|
48
|
-
const
|
|
47
|
+
let c = 0;
|
|
48
|
+
const u = async () => {
|
|
49
49
|
var g;
|
|
50
|
-
for (;
|
|
51
|
-
const y = o[
|
|
50
|
+
for (; c < o.length; ) {
|
|
51
|
+
const y = o[c++];
|
|
52
52
|
try {
|
|
53
53
|
const f = await s.request(
|
|
54
54
|
h("/revisions", { collection: t, item: y, latest_only: "1" })
|
|
55
55
|
), l = (g = f == null ? void 0 : f.data) == null ? void 0 : g.latest;
|
|
56
|
-
|
|
56
|
+
r.set(y, typeof l == "number" && Number.isFinite(l) ? l : null);
|
|
57
57
|
} catch {
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
};
|
|
61
|
-
await Promise.all(Array.from({ length: Math.min(4, o.length) },
|
|
61
|
+
await Promise.all(Array.from({ length: Math.min(4, o.length) }, u));
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
return
|
|
64
|
+
return r;
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function M(s) {
|
|
67
67
|
try {
|
|
68
68
|
return JSON.stringify(s);
|
|
69
69
|
} catch {
|
|
70
70
|
return String(Math.random());
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
class
|
|
73
|
+
class R {
|
|
74
74
|
constructor(t) {
|
|
75
|
-
|
|
75
|
+
w(this, "entries", /* @__PURE__ */ new Map());
|
|
76
76
|
this.fetcher = t;
|
|
77
77
|
}
|
|
78
|
-
put(t, n,
|
|
79
|
-
const
|
|
78
|
+
put(t, n, r) {
|
|
79
|
+
const i = {
|
|
80
80
|
sig: n,
|
|
81
|
-
base:
|
|
81
|
+
base: r
|
|
82
82
|
};
|
|
83
|
-
this.entries.set(t,
|
|
84
|
-
|
|
83
|
+
this.entries.set(t, i), r.then((e) => {
|
|
84
|
+
i.settled = e;
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
87
|
/** Record a read of these rows. */
|
|
88
88
|
noteRows(t) {
|
|
89
|
-
var
|
|
89
|
+
var i;
|
|
90
90
|
const n = [];
|
|
91
91
|
for (const e of t) {
|
|
92
92
|
const o = (e == null ? void 0 : e.id) == null ? "" : String(e.id);
|
|
93
93
|
if (!o || o === "new" || o.startsWith("pending:")) continue;
|
|
94
|
-
const a =
|
|
95
|
-
((
|
|
94
|
+
const a = M(e);
|
|
95
|
+
((i = this.entries.get(o)) == null ? void 0 : i.sig) !== a && n.push({ id: o, sig: a });
|
|
96
96
|
}
|
|
97
97
|
if (n.length === 0) return;
|
|
98
|
-
const
|
|
98
|
+
const r = this.fetcher(n.map((e) => e.id)).catch(() => /* @__PURE__ */ new Map());
|
|
99
99
|
for (const e of n)
|
|
100
100
|
this.put(
|
|
101
101
|
e.id,
|
|
102
102
|
e.sig,
|
|
103
|
-
|
|
103
|
+
r.then((o) => o.has(e.id) ? o.get(e.id) ?? null : null)
|
|
104
104
|
);
|
|
105
105
|
}
|
|
106
106
|
/** The base for a write to this row — read-time when known, else fetched
|
|
@@ -111,8 +111,8 @@ class M {
|
|
|
111
111
|
const e = await n.base;
|
|
112
112
|
if (e != null) return e;
|
|
113
113
|
}
|
|
114
|
-
const
|
|
115
|
-
return
|
|
114
|
+
const i = (await this.fetcher([t]).catch(() => /* @__PURE__ */ new Map())).get(t) ?? null;
|
|
115
|
+
return i != null && this.set(t, i), i;
|
|
116
116
|
}
|
|
117
117
|
/** The read-time base of a row, if a read noted it (undefined = never read). */
|
|
118
118
|
peek(t) {
|
|
@@ -127,81 +127,88 @@ class M {
|
|
|
127
127
|
/** After a 409: the person's next write is a choice made against `latest`. */
|
|
128
128
|
set(t, n) {
|
|
129
129
|
var e;
|
|
130
|
-
const
|
|
131
|
-
this.entries.set(t,
|
|
130
|
+
const i = { sig: ((e = this.entries.get(t)) == null ? void 0 : e.sig) ?? "", base: Promise.resolve(n), settled: n };
|
|
131
|
+
this.entries.set(t, i);
|
|
132
132
|
}
|
|
133
133
|
/** After the person's own write: the next read brings the new base. */
|
|
134
134
|
forget(t) {
|
|
135
135
|
this.entries.delete(t);
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
|
-
const
|
|
139
|
-
function
|
|
140
|
-
let n =
|
|
141
|
-
n || (n = /* @__PURE__ */ new Map(),
|
|
142
|
-
let
|
|
143
|
-
return
|
|
138
|
+
const m = /* @__PURE__ */ new WeakMap();
|
|
139
|
+
function L(s, t) {
|
|
140
|
+
let n = m.get(s);
|
|
141
|
+
n || (n = /* @__PURE__ */ new Map(), m.set(s, n));
|
|
142
|
+
let r = n.get(t);
|
|
143
|
+
return r || (r = new R((i) => $(s, t, i)), n.set(t, r)), r;
|
|
144
144
|
}
|
|
145
|
-
|
|
146
|
-
const
|
|
145
|
+
function j(s, t) {
|
|
146
|
+
const n = /* @__PURE__ */ new Map();
|
|
147
|
+
for (const r of t)
|
|
148
|
+
!r || r === "new" || r.startsWith("pending:") || n.set(r, s.baseOf(r));
|
|
149
|
+
return n;
|
|
150
|
+
}
|
|
151
|
+
async function x(s, t, n, r, i, e) {
|
|
152
|
+
const o = e.base !== void 0 ? await e.base : null, a = o != null && o > 0 ? o : await t.baseOf(r);
|
|
147
153
|
try {
|
|
148
|
-
await s.request(b(n, S(
|
|
149
|
-
} catch (
|
|
150
|
-
const u = d(
|
|
151
|
-
if (!u) throw
|
|
152
|
-
return u.latest > 0 && t.set(
|
|
154
|
+
await s.request(b(n, S(i, a)));
|
|
155
|
+
} catch (c) {
|
|
156
|
+
const u = d(c);
|
|
157
|
+
if (!u) throw c;
|
|
158
|
+
return u.latest > 0 && t.set(r, u.latest), {
|
|
153
159
|
ok: !1,
|
|
154
160
|
conflict: {
|
|
155
161
|
key: e.key,
|
|
156
|
-
rowId:
|
|
162
|
+
rowId: r,
|
|
157
163
|
label: e.label,
|
|
158
164
|
conflicts: u.conflicts,
|
|
159
165
|
latest: u.latest,
|
|
160
|
-
mine:
|
|
166
|
+
mine: i,
|
|
161
167
|
url: n
|
|
162
168
|
}
|
|
163
169
|
};
|
|
164
170
|
}
|
|
165
|
-
return t.forget(
|
|
171
|
+
return t.forget(r), { ok: !0 };
|
|
166
172
|
}
|
|
167
|
-
async function
|
|
173
|
+
async function F(s, t, n, r, i, e = 3) {
|
|
168
174
|
for (let o = 0; o < e; o++) {
|
|
169
|
-
const a = await $(s, t, [n]),
|
|
170
|
-
h(`/items/${t}/${n}`, { fields: `id,${
|
|
171
|
-
).then((
|
|
172
|
-
if (!
|
|
175
|
+
const a = await $(s, t, [n]), c = await s.request(
|
|
176
|
+
h(`/items/${t}/${n}`, { fields: `id,${r}` })
|
|
177
|
+
).then((u) => (u == null ? void 0 : u.data) ?? null);
|
|
178
|
+
if (!c) return !1;
|
|
173
179
|
try {
|
|
174
180
|
return await s.request(
|
|
175
181
|
b(
|
|
176
182
|
`/items/${t}/${n}`,
|
|
177
|
-
S({ [
|
|
183
|
+
S({ [r]: (Number(c[r]) || 0) + i }, a.get(n))
|
|
178
184
|
)
|
|
179
185
|
), !0;
|
|
180
|
-
} catch (
|
|
181
|
-
if (!d(
|
|
186
|
+
} catch (u) {
|
|
187
|
+
if (!d(u)) throw u;
|
|
182
188
|
}
|
|
183
189
|
}
|
|
184
190
|
return !1;
|
|
185
191
|
}
|
|
186
|
-
function
|
|
187
|
-
const
|
|
188
|
-
e[0] !== "o2m-rows" || String(e[3]) !== n || typeof e[1] != "string" || Array.isArray(o) &&
|
|
189
|
-
},
|
|
190
|
-
for (const e of
|
|
191
|
-
return
|
|
192
|
-
e.type !== "updated" || e.action.type !== "success" ||
|
|
192
|
+
function K(s, t, n) {
|
|
193
|
+
const r = (e, o) => {
|
|
194
|
+
e[0] !== "o2m-rows" || String(e[3]) !== n || typeof e[1] != "string" || Array.isArray(o) && L(t, e[1]).noteRows(o);
|
|
195
|
+
}, i = s.getQueryCache();
|
|
196
|
+
for (const e of i.findAll({ queryKey: ["o2m-rows"] })) r(e.queryKey, e.state.data);
|
|
197
|
+
return i.subscribe((e) => {
|
|
198
|
+
e.type !== "updated" || e.action.type !== "success" || r(e.query.queryKey, e.query.state.data);
|
|
193
199
|
});
|
|
194
200
|
}
|
|
195
201
|
export {
|
|
196
|
-
|
|
197
|
-
|
|
202
|
+
p as LATEST_BATCH,
|
|
203
|
+
R as RowBaseBook,
|
|
198
204
|
$ as fetchLatestRevisions,
|
|
199
|
-
|
|
200
|
-
|
|
205
|
+
F as incrementGuarded,
|
|
206
|
+
A as lineConflictKey,
|
|
201
207
|
N as lineLabelOf,
|
|
202
|
-
|
|
208
|
+
K as noteLineReads,
|
|
203
209
|
C as resolveLineCollision,
|
|
204
|
-
|
|
210
|
+
L as rowBaseBookFor,
|
|
211
|
+
j as snapshotRowBases,
|
|
205
212
|
S as withRowBaseRevision,
|
|
206
|
-
|
|
213
|
+
x as writeLineGuarded
|
|
207
214
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
const i = "nvr-save-outcome";
|
|
2
|
+
function a(e) {
|
|
2
3
|
return e.childFailed === !0 || e.reasonWaiting === !0;
|
|
3
4
|
}
|
|
4
|
-
function
|
|
5
|
+
function o(e, s) {
|
|
5
6
|
const { isNew: t } = s, r = s.noun.toLowerCase();
|
|
6
7
|
if (e.childFailed) {
|
|
7
8
|
const n = e.childErrors ?? [];
|
|
@@ -43,6 +44,7 @@ function a(e, s) {
|
|
|
43
44
|
return !t && e.noFieldWrite && e.onlyMain ? { kind: "plain", text: "Nothing to save — no changes" } : { kind: "success", text: t ? "Record created" : "Changes saved" };
|
|
44
45
|
}
|
|
45
46
|
export {
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
i as SAVE_OUTCOME_TOAST_ID,
|
|
48
|
+
o as saveClosingMessage,
|
|
49
|
+
a as saveLeftWorkStaged
|
|
48
50
|
};
|