@nivaro/react 0.3.48 → 0.3.50

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.
Files changed (52) hide show
  1. package/dist/components/InlineGridField.js +166 -105
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useSessionRecorder.js +1 -1
  4. package/dist/index.d.ts +25 -1
  5. package/dist/shared/components/CellCopyLayer.js +81 -44
  6. package/dist/shared/components/CollectionBrowserView.js +306 -297
  7. package/dist/shared/components/DataTable.js +3 -3
  8. package/dist/shared/components/FulfilmentPill.js +98 -78
  9. package/dist/shared/components/ItemEditForm.js +4682 -4570
  10. package/dist/shared/components/NotificationSourcesCard.js +151 -147
  11. package/dist/shared/components/ProfileView.js +72 -70
  12. package/dist/shared/components/QueryTable.js +462 -333
  13. package/dist/shared/components/imports/ImportConsole.js +4 -4
  14. package/dist/shared/components/integrations/console/IntegrationsConsole.js +58 -50
  15. package/dist/shared/components/item-edit/CatalogPickerField.js +1144 -1127
  16. package/dist/shared/components/item-edit/CloneDialog.js +192 -142
  17. package/dist/shared/components/item-edit/FieldRenderer.js +127 -126
  18. package/dist/shared/components/item-edit/FieldRow.js +236 -226
  19. package/dist/shared/components/item-edit/HeaderTools.js +118 -113
  20. package/dist/shared/components/item-edit/InlineGridField.js +92 -90
  21. package/dist/shared/components/item-edit/InlineTableField.js +3091 -2942
  22. package/dist/shared/components/item-edit/MidairCollisionDialog.js +175 -0
  23. package/dist/shared/components/item-edit/PlanGrid.js +162 -162
  24. package/dist/shared/components/item-edit/PolishFields.js +169 -162
  25. package/dist/shared/components/item-edit/RelationCombobox.js +186 -181
  26. package/dist/shared/components/item-edit/SummaryPanel.js +148 -135
  27. package/dist/shared/components/item-edit/ValidationSummary.js +64 -47
  28. package/dist/shared/components/item-edit/helpers.js +181 -155
  29. package/dist/shared/components/item-edit/line-midair.js +201 -0
  30. package/dist/shared/components/item-edit/soft-rules.js +27 -0
  31. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  32. package/dist/shared/components/layout-editor/settings/ResolveSettings.js +65 -65
  33. package/dist/shared/components/layout-editor/settings/settings-registry.js +4 -4
  34. package/dist/shared/components/notifications/DeliveryChips.js +9 -9
  35. package/dist/shared/components/panels/ItemLockBanner.js +414 -358
  36. package/dist/shared/components/panels/PipelinePanel.js +1171 -975
  37. package/dist/shared/components/panels/RecordIntegrityBanner.js +1 -1
  38. package/dist/shared/components/panels/SlaBreachBanner.js +2 -2
  39. package/dist/shared/components/panels/TransitionRequirementsDialog.js +384 -380
  40. package/dist/shared/components/profile/PersonProfile.js +23 -21
  41. package/dist/shared/components/profile/SignedInDevices.js +126 -0
  42. package/dist/shared/components/queue/QueueItemSheet.js +38 -37
  43. package/dist/shared/components/queue/QueueWorklist.js +870 -827
  44. package/dist/shared/components/queue/column-chooser.js +21 -0
  45. package/dist/shared/components/queue/live-state-aspect.js +6 -0
  46. package/dist/shared/components/support/SupportView.js +1 -1
  47. package/dist/shared/components/ui/number-draft-input.js +93 -0
  48. package/dist/shared/components/widgets/ReviewListWidget.js +191 -166
  49. package/dist/shared/lib/edit-lock-fields.js +7 -0
  50. package/dist/shared/lib/error-hints.js +1 -0
  51. package/dist/shared/lib/reimport-visibility.js +10 -0
  52. package/package.json +1 -1
@@ -0,0 +1,201 @@
1
+ var _ = Object.defineProperty;
2
+ var $ = (r, t, n) => t in r ? _(r, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[t] = n;
3
+ var m = (r, t, n) => $(r, typeof t != "symbol" ? t + "" : t, n);
4
+ import { patch as b, get as h } from "../../lib/commands.js";
5
+ import { midairCollisionOf as d } from "../../lib/record-outbox.js";
6
+ function q(r, t) {
7
+ return typeof t != "number" || !Number.isFinite(t) || t <= 0 ? r : { ...r, _base_revision: t };
8
+ }
9
+ function B(r, t) {
10
+ return `${r.key}\0${r.rowId}\0${t}`;
11
+ }
12
+ function C(r, t) {
13
+ const n = {};
14
+ for (const [s, e] of Object.entries(r)) t.has(s) || (n[s] = e);
15
+ return Object.keys(n).some((s) => s !== "_change_reason" && s !== "__flush_early") ? n : null;
16
+ }
17
+ function N(r, t, n) {
18
+ const i = r.findIndex((o) => String(o.id) === String(t)), s = i >= 0 ? r[i] : void 0, e = (s == null ? void 0 : s[n || "line_number"]) ?? (s == null ? void 0 : s.line_number);
19
+ return e != null && e !== "" ? `Line ${String(e)}` : i >= 0 ? `Line ${i + 1}` : `Row ${t}`;
20
+ }
21
+ const w = 500;
22
+ function k(r) {
23
+ var n;
24
+ const t = r;
25
+ return ((t == null ? void 0 : t.status) ?? ((n = t == null ? void 0 : t.response) == null ? void 0 : n.status)) === 404;
26
+ }
27
+ async function S(r, t, n) {
28
+ const i = /* @__PURE__ */ new Map(), s = [...new Set(n.map(String))].filter(
29
+ (e) => e && e !== "new" && !e.startsWith("pending:")
30
+ );
31
+ for (let e = 0; e < s.length; e += w) {
32
+ const o = s.slice(e, e + w);
33
+ try {
34
+ const a = await r.request(
35
+ h("/revisions/latest", { collection: t, items: o.join(",") })
36
+ );
37
+ for (const [c, u] of Object.entries((a == null ? void 0 : a.data) ?? {}))
38
+ i.set(c, typeof u == "number" && Number.isFinite(u) ? u : null);
39
+ } catch (a) {
40
+ if (!k(a)) continue;
41
+ let c = 0;
42
+ const u = async () => {
43
+ var g;
44
+ for (; c < o.length; ) {
45
+ const y = o[c++];
46
+ try {
47
+ const f = await r.request(
48
+ h("/revisions", { collection: t, item: y, latest_only: "1" })
49
+ ), l = (g = f == null ? void 0 : f.data) == null ? void 0 : g.latest;
50
+ i.set(y, typeof l == "number" && Number.isFinite(l) ? l : null);
51
+ } catch {
52
+ }
53
+ }
54
+ };
55
+ await Promise.all(Array.from({ length: Math.min(4, o.length) }, u));
56
+ }
57
+ }
58
+ return i;
59
+ }
60
+ function M(r) {
61
+ try {
62
+ return JSON.stringify(r);
63
+ } catch {
64
+ return String(Math.random());
65
+ }
66
+ }
67
+ class R {
68
+ constructor(t) {
69
+ m(this, "entries", /* @__PURE__ */ new Map());
70
+ this.fetcher = t;
71
+ }
72
+ put(t, n, i) {
73
+ const s = {
74
+ sig: n,
75
+ base: i
76
+ };
77
+ this.entries.set(t, s), i.then((e) => {
78
+ s.settled = e;
79
+ });
80
+ }
81
+ /** Record a read of these rows. */
82
+ noteRows(t) {
83
+ var s;
84
+ const n = [];
85
+ for (const e of t) {
86
+ const o = (e == null ? void 0 : e.id) == null ? "" : String(e.id);
87
+ if (!o || o === "new" || o.startsWith("pending:")) continue;
88
+ const a = M(e);
89
+ ((s = this.entries.get(o)) == null ? void 0 : s.sig) !== a && n.push({ id: o, sig: a });
90
+ }
91
+ if (n.length === 0) return;
92
+ const i = this.fetcher(n.map((e) => e.id)).catch(() => /* @__PURE__ */ new Map());
93
+ for (const e of n)
94
+ this.put(
95
+ e.id,
96
+ e.sig,
97
+ i.then((o) => o.has(e.id) ? o.get(e.id) ?? null : null)
98
+ );
99
+ }
100
+ /** The base for a write to this row — read-time when known, else fetched
101
+ * now. Null = the row has no revision (or could not be read). */
102
+ async baseOf(t) {
103
+ const n = this.entries.get(t);
104
+ if (n) {
105
+ const e = await n.base;
106
+ if (e != null) return e;
107
+ }
108
+ const s = (await this.fetcher([t]).catch(() => /* @__PURE__ */ new Map())).get(t) ?? null;
109
+ return s != null && this.set(t, s), s;
110
+ }
111
+ /** The read-time base of a row, if a read noted it (undefined = never read). */
112
+ peek(t) {
113
+ var n;
114
+ return (n = this.entries.get(t)) == null ? void 0 : n.base;
115
+ }
116
+ /** The read-time base once its read answered (sync; undefined = not yet). */
117
+ settled(t) {
118
+ var n;
119
+ return (n = this.entries.get(t)) == null ? void 0 : n.settled;
120
+ }
121
+ /** After a 409: the person's next write is a choice made against `latest`. */
122
+ set(t, n) {
123
+ var e;
124
+ const s = { sig: ((e = this.entries.get(t)) == null ? void 0 : e.sig) ?? "", base: Promise.resolve(n), settled: n };
125
+ this.entries.set(t, s);
126
+ }
127
+ /** After the person's own write: the next read brings the new base. */
128
+ forget(t) {
129
+ this.entries.delete(t);
130
+ }
131
+ }
132
+ const p = /* @__PURE__ */ new WeakMap();
133
+ function L(r, t) {
134
+ let n = p.get(r);
135
+ n || (n = /* @__PURE__ */ new Map(), p.set(r, n));
136
+ let i = n.get(t);
137
+ return i || (i = new R((s) => S(r, t, s)), n.set(t, i)), i;
138
+ }
139
+ async function j(r, t, n, i, s, e) {
140
+ const o = await t.baseOf(i);
141
+ try {
142
+ await r.request(b(n, q(s, o)));
143
+ } catch (a) {
144
+ const c = d(a);
145
+ if (!c) throw a;
146
+ return c.latest > 0 && t.set(i, c.latest), {
147
+ ok: !1,
148
+ conflict: {
149
+ key: e.key,
150
+ rowId: i,
151
+ label: e.label,
152
+ conflicts: c.conflicts,
153
+ latest: c.latest,
154
+ mine: s,
155
+ url: n
156
+ }
157
+ };
158
+ }
159
+ return t.forget(i), { ok: !0 };
160
+ }
161
+ async function x(r, t, n, i, s, e = 3) {
162
+ for (let o = 0; o < e; o++) {
163
+ const a = await S(r, t, [n]), c = await r.request(
164
+ h(`/items/${t}/${n}`, { fields: `id,${i}` })
165
+ ).then((u) => (u == null ? void 0 : u.data) ?? null);
166
+ if (!c) return !1;
167
+ try {
168
+ return await r.request(
169
+ b(
170
+ `/items/${t}/${n}`,
171
+ q({ [i]: (Number(c[i]) || 0) + s }, a.get(n))
172
+ )
173
+ ), !0;
174
+ } catch (u) {
175
+ if (!d(u)) throw u;
176
+ }
177
+ }
178
+ return !1;
179
+ }
180
+ function F(r, t, n) {
181
+ const i = (e, o) => {
182
+ e[0] !== "o2m-rows" || String(e[3]) !== n || typeof e[1] != "string" || Array.isArray(o) && L(t, e[1]).noteRows(o);
183
+ }, s = r.getQueryCache();
184
+ for (const e of s.findAll({ queryKey: ["o2m-rows"] })) i(e.queryKey, e.state.data);
185
+ return s.subscribe((e) => {
186
+ e.type !== "updated" || e.action.type !== "success" || i(e.query.queryKey, e.query.state.data);
187
+ });
188
+ }
189
+ export {
190
+ w as LATEST_BATCH,
191
+ R as RowBaseBook,
192
+ S as fetchLatestRevisions,
193
+ x as incrementGuarded,
194
+ B as lineConflictKey,
195
+ N as lineLabelOf,
196
+ F as noteLineReads,
197
+ C as resolveLineCollision,
198
+ L as rowBaseBookFor,
199
+ q as withRowBaseRevision,
200
+ j as writeLineGuarded
201
+ };
@@ -0,0 +1,27 @@
1
+ import { titleCase as a } from "../../lib/utils.js";
2
+ import { applyValidationRule as s } from "../../lib/validation-rules.js";
3
+ import { ruleValueFor as f } from "./line-qty.js";
4
+ function y(r, e) {
5
+ const t = r.validation_rules;
6
+ if (t == null || t === "") return null;
7
+ let o = t;
8
+ if (typeof t == "string")
9
+ try {
10
+ o = JSON.parse(t);
11
+ } catch {
12
+ return null;
13
+ }
14
+ if (!Array.isArray(o)) return null;
15
+ const l = f(r.type, e[r.field]);
16
+ if (l == null || l === "") return null;
17
+ const i = r.label || a(r.field);
18
+ for (const n of o) {
19
+ if (!n || typeof n != "object" || !n.soft) continue;
20
+ const u = s(n, l, i, e);
21
+ if (u) return u;
22
+ }
23
+ return null;
24
+ }
25
+ export {
26
+ y as softRuleWarning
27
+ };