@nivaro/react 0.3.63 → 0.3.65

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 (64) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +54 -5
  4. package/dist/shared/components/CollectionBrowserView.js +3029 -2947
  5. package/dist/shared/components/ConformanceView.js +235 -221
  6. package/dist/shared/components/DataTable.js +478 -459
  7. package/dist/shared/components/ItemEditForm.js +4469 -4266
  8. package/dist/shared/components/PageRenderer.js +146 -138
  9. package/dist/shared/components/RecordDrilldownSheet.js +73 -65
  10. package/dist/shared/components/bulk/BulkActionButtons.js +72 -72
  11. package/dist/shared/components/bulk/BulkFieldUpdate.js +114 -103
  12. package/dist/shared/components/bulk/BulkFieldUpdateButton.js +73 -0
  13. package/dist/shared/components/bulk/bulk-field-options.js +29 -23
  14. package/dist/shared/components/integrations/IntegrationObligationsView.js +191 -173
  15. package/dist/shared/components/integrations/IntegrationStatusLines.js +101 -85
  16. package/dist/shared/components/integrations/RecordIntegrationPreview.js +11 -9
  17. package/dist/shared/components/integrations/SendCurrentData.js +126 -0
  18. package/dist/shared/components/item-edit/CatalogPickerField.js +1530 -1437
  19. package/dist/shared/components/item-edit/FieldRenderer.js +49 -45
  20. package/dist/shared/components/item-edit/FieldRow.js +413 -403
  21. package/dist/shared/components/item-edit/InlineTableField.js +2903 -2816
  22. package/dist/shared/components/item-edit/M2MCombobox.js +172 -168
  23. package/dist/shared/components/item-edit/MidairCollisionDialog.js +341 -114
  24. package/dist/shared/components/item-edit/NestedRelationEditor.js +171 -163
  25. package/dist/shared/components/item-edit/PlanGrid.js +783 -724
  26. package/dist/shared/components/item-edit/QuickCreateButton.js +291 -224
  27. package/dist/shared/components/item-edit/RecordInsights.js +113 -111
  28. package/dist/shared/components/item-edit/RecordLiveSync.js +4 -1
  29. package/dist/shared/components/item-edit/RelationCombobox.js +332 -314
  30. package/dist/shared/components/item-edit/cascade-clear-notice.js +52 -0
  31. package/dist/shared/components/item-edit/collision-format.js +37 -0
  32. package/dist/shared/components/item-edit/field-a11y.js +25 -0
  33. package/dist/shared/components/item-edit/line-merge.js +58 -0
  34. package/dist/shared/components/item-edit/line-midair.js +94 -87
  35. package/dist/shared/components/item-edit/move-guard.js +17 -0
  36. package/dist/shared/components/item-edit/picker-search.js +22 -15
  37. package/dist/shared/components/item-edit/rail-width.js +8 -0
  38. package/dist/shared/components/monitoring/InactiveUserLinksView.js +322 -291
  39. package/dist/shared/components/panels/AccessDeniedPanel.js +96 -55
  40. package/dist/shared/components/panels/CommentPanel.js +142 -136
  41. package/dist/shared/components/panels/ItemLockBanner.js +246 -240
  42. package/dist/shared/components/panels/PipelinePanel.js +1366 -1194
  43. package/dist/shared/components/panels/RevisionsPanel.js +106 -102
  44. package/dist/shared/components/panels/SlaBreachBanner.js +16 -20
  45. package/dist/shared/components/panels/SlaClock.js +90 -68
  46. package/dist/shared/components/queue/QueueItemSheet.js +94 -87
  47. package/dist/shared/components/queue/QueueWorklist.js +1502 -1354
  48. package/dist/shared/components/queue/worklist-csv.js +75 -0
  49. package/dist/shared/components/queue/worklist-helpers.js +20 -0
  50. package/dist/shared/components/widgets/ReviewListWidget.js +226 -207
  51. package/dist/shared/lib/bulk-copy.js +17 -0
  52. package/dist/shared/lib/cbv-export.js +122 -0
  53. package/dist/shared/lib/delete-offer.js +13 -0
  54. package/dist/shared/lib/error-hints.js +1 -0
  55. package/dist/shared/lib/leave-guard.js +41 -26
  56. package/dist/shared/lib/list-link.js +72 -56
  57. package/dist/shared/lib/live-queries.js +32 -30
  58. package/dist/shared/lib/moved-notice.js +25 -0
  59. package/dist/shared/lib/notification-target.js +56 -54
  60. package/dist/shared/lib/obligation-banner.js +11 -8
  61. package/dist/shared/lib/obligation-reason-text.js +6 -6
  62. package/dist/shared/lib/sort-cycle.js +6 -0
  63. package/dist/shared/lib/summary-mode.js +59 -41
  64. package/package.json +1 -1
@@ -0,0 +1,52 @@
1
+ import { useRef as l, useEffect as f, useCallback as d, createContext as m, useContext as C } from "react";
2
+ import { toast as h } from "sonner";
3
+ const p = m(null), k = () => C(p);
4
+ function w(n) {
5
+ const e = [...new Set(n.filter(Boolean))];
6
+ return e.length <= 1 ? e[0] ?? "" : `${e.slice(0, -1).join(", ")} and ${e[e.length - 1]}`;
7
+ }
8
+ function T(n, e) {
9
+ const r = w(n);
10
+ return e ? `${r} cleared — not available for the ${e} you picked` : `${r} cleared — no longer available for what you picked`;
11
+ }
12
+ function S(n, e) {
13
+ const r = new Set(n.map((t) => t.field)), c = [...new Set(n.flatMap((t) => t.parents))].filter((t) => !r.has(t));
14
+ return c.length === 0 ? null : c.reduce((t, o) => e(o) > e(t) ? o : t, c[0]);
15
+ }
16
+ const g = 4e3, x = 500, R = "nvr-cascade-clear";
17
+ function N(n) {
18
+ const e = l(n);
19
+ e.current = n;
20
+ const r = l([]), c = l(0), t = l(null);
21
+ return f(
22
+ () => () => {
23
+ t.current && clearTimeout(t.current);
24
+ },
25
+ []
26
+ ), d((o) => {
27
+ const s = Date.now();
28
+ s - c.current > g && (r.current = []), c.current = s, r.current.some((a) => a.field === o.field) || r.current.push(o), t.current && clearTimeout(t.current), t.current = setTimeout(() => {
29
+ const a = r.current;
30
+ if (a.length === 0) return;
31
+ const i = S(a, e.current.editSeq);
32
+ h.info(
33
+ T(
34
+ a.map((u) => u.label),
35
+ i ? e.current.labelOf(i) : null
36
+ ),
37
+ {
38
+ id: R,
39
+ description: "Pick them again from the narrowed lists."
40
+ }
41
+ );
42
+ }, x);
43
+ }, []);
44
+ }
45
+ export {
46
+ p as CascadeClearNoticeContext,
47
+ T as cascadeClearText,
48
+ S as cascadeRootParent,
49
+ w as joinLabels,
50
+ N as useCascadeClearNotices,
51
+ k as useCascadeClearNotifier
52
+ };
@@ -0,0 +1,37 @@
1
+ const s = /(^|_)(total|amount|price|cost|subtotal|spend|budget)s?($|_)/i;
2
+ function c(t) {
3
+ return s.test(t);
4
+ }
5
+ function m(t) {
6
+ if (typeof t == "number") return Number.isFinite(t) ? t : null;
7
+ if (typeof t == "string" && /^-?\d+(\.\d+)?(e-?\d+)?$/i.test(t.trim())) {
8
+ const n = Number(t);
9
+ return Number.isFinite(n) ? n : null;
10
+ }
11
+ return null;
12
+ }
13
+ function a(t, n) {
14
+ const r = m(n);
15
+ if (r == null) return null;
16
+ const u = Number(r.toPrecision(12));
17
+ return c(t) ? u.toLocaleString("en-US", {
18
+ style: "currency",
19
+ currency: "USD",
20
+ minimumFractionDigits: 2,
21
+ maximumFractionDigits: 2
22
+ }) : u.toLocaleString("en-US", { maximumFractionDigits: 6 });
23
+ }
24
+ function f(t, n, r = 12, u = 24) {
25
+ let e = 0;
26
+ const l = Math.min(t.length, n.length);
27
+ for (; e < l && t[e] === n[e]; ) e++;
28
+ if (e < u) return { a: t, b: n };
29
+ let i = Math.max(0, e - r);
30
+ const o = t.lastIndexOf(" ", i);
31
+ return o > 0 && i - o <= 8 && (i = o + 1), { a: `…${t.slice(i)}`, b: `…${n.slice(i)}` };
32
+ }
33
+ export {
34
+ a as collisionNumberText,
35
+ f as differingTails,
36
+ c as isMoneyFieldName
37
+ };
@@ -0,0 +1,25 @@
1
+ function o(t, e) {
2
+ const a = (i, u) => {
3
+ u == null ? t.hasAttribute(i) && t.removeAttribute(i) : t.getAttribute(i) !== u && t.setAttribute(i, u);
4
+ }, r = t.tagName !== "BUTTON" || t.getAttribute("role") === "combobox";
5
+ a("aria-required", e.required && r ? "true" : null), e.hasError ? (a("aria-invalid", "true"), t.setAttribute("data-nvr-invalid", "")) : t.hasAttribute("data-nvr-invalid") && (t.removeAttribute("data-nvr-invalid"), a("aria-invalid", null));
6
+ const n = (t.getAttribute("aria-describedby") ?? "").split(/\s+/).filter((i) => i && i !== e.errorId);
7
+ e.hasError && e.describe !== !1 && n.push(e.errorId), a("aria-describedby", n.length ? n.join(" ") : null);
8
+ }
9
+ function b(t) {
10
+ return t ? t.querySelector(
11
+ 'input:not([type=hidden]), textarea, [role="combobox"], [contenteditable="true"]'
12
+ ) ?? t.querySelector("button") : null;
13
+ }
14
+ function d(t, e, a) {
15
+ const r = b(t);
16
+ if (!r || (o(r, a), r.hasAttribute("aria-label"))) return;
17
+ r.id || (r.id = `${e}-control`);
18
+ const n = r.tagName === "BUTTON" ? `${e} ${r.id}` : e;
19
+ r.getAttribute("aria-labelledby") !== n && r.setAttribute("aria-labelledby", n);
20
+ }
21
+ export {
22
+ o as applyFieldA11y,
23
+ d as nameFieldControl,
24
+ b as primaryControl
25
+ };
@@ -0,0 +1,58 @@
1
+ import { evaluateNumeric as s } from "../../lib/expression.js";
2
+ import { sameStoredValue as d } from "../../lib/write-formula.js";
3
+ import { lineConflictKey as u } from "./line-midair.js";
4
+ function m(t) {
5
+ const i = new Set((t.derived ?? []).map((e) => e.field));
6
+ return t.conflicts.map((e) => {
7
+ const r = t.mine[e.field], n = i.has(e.field) ? "derived" : d(e.current_value, r) ? "same" : "conflict";
8
+ return {
9
+ key: u(t, e.field),
10
+ field: e.field,
11
+ theirs: e.current_value,
12
+ mine: r,
13
+ kind: n
14
+ };
15
+ });
16
+ }
17
+ function p(t, i) {
18
+ return t.every((e) => e.kind !== "conflict" || i.has(e.key));
19
+ }
20
+ function y(t, i) {
21
+ const e = /* @__PURE__ */ new Set();
22
+ for (const r of t) (r.kind !== "conflict" || i.get(r.key) !== "mine") && e.add(r.key);
23
+ return e;
24
+ }
25
+ function l(t, i) {
26
+ if (!(i != null && i.length)) return t;
27
+ const e = { ...t };
28
+ for (const r of i) {
29
+ const n = s(r.formula, e);
30
+ n !== null && Number.isFinite(n) && (e[r.field] = Math.round(n * 1e6) / 1e6);
31
+ }
32
+ return e;
33
+ }
34
+ function h(t, i) {
35
+ const e = m(t), r = new Set(e.map((o) => o.field)), n = new Set((t.derived ?? []).map((o) => o.field)), f = { ...t.current ?? {} };
36
+ for (const [o, c] of Object.entries(t.edit ?? t.mine))
37
+ o.startsWith("_") || o === "id" || r.has(o) || n.has(o) || (f[o] = c);
38
+ for (const o of e)
39
+ o.kind !== "derived" && (f[o.field] = o.kind === "conflict" && i.get(o.key) === "mine" ? o.mine : o.theirs);
40
+ return l(f, t.derived);
41
+ }
42
+ function g(t, i) {
43
+ const e = [], r = (n) => {
44
+ e.includes(n) || n === "id" || n.startsWith("_") || /_id$/.test(n) || i != null && i(n) || e.push(n);
45
+ };
46
+ for (const n of Object.keys(t.edit ?? t.mine)) r(n);
47
+ for (const n of t.conflicts) r(n.field);
48
+ for (const n of t.derived ?? []) r(n.field);
49
+ return e;
50
+ }
51
+ export {
52
+ m as classifyLineConflicts,
53
+ p as mergeReady,
54
+ y as mergeTheirsKeys,
55
+ h as mergedLinePreview,
56
+ g as previewFields,
57
+ l as recomputeDerived
58
+ };
@@ -1,67 +1,70 @@
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 w = (s, t, n) => _(s, 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";
3
+ var p = (s, t, n) => _(s, typeof t != "symbol" ? t + "" : t, n);
4
+ import { patch as d, get as h } from "../../lib/commands.js";
5
+ import { midairCollisionOf as b } 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 A(s, t) {
9
+ function C(s, t) {
10
10
  return `${s.key}\0${s.rowId}\0${t}`;
11
11
  }
12
- function C(s, t) {
12
+ function N(s, t) {
13
13
  const n = {};
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;
14
+ for (const [r, e] of Object.entries(s)) t.has(r) || (n[r] = e);
15
+ return Object.keys(n).some((r) => r !== "_change_reason" && r !== "__flush_early") ? n : null;
16
16
  }
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);
17
+ function j(s, t, n, i) {
18
+ var u;
19
+ const r = s.findIndex((c) => String(c.id) === String(t)), e = r >= 0 ? s[r] : void 0, o = (e == null ? void 0 : e[n || "line_number"]) ?? (e == null ? void 0 : e.line_number);
19
20
  if (o != null && o !== "") return `Line ${String(o)}`;
20
21
  if (e) {
22
+ const c = (u = i == null ? void 0 : i(e)) == null ? void 0 : u.trim();
23
+ if (c) return c;
21
24
  const a = e.year;
22
25
  if ((typeof a == "number" || typeof a == "string") && /^\d{4}$/.test(String(a)))
23
26
  return `Year ${String(a)}`;
24
27
  }
25
- return i >= 0 ? `Line ${i + 1}` : `Row ${t}`;
28
+ return r >= 0 ? `Line ${r + 1}` : `Row ${t}`;
26
29
  }
27
- const p = 500;
30
+ const m = 500;
28
31
  function k(s) {
29
32
  var n;
30
33
  const t = s;
31
34
  return ((t == null ? void 0 : t.status) ?? ((n = t == null ? void 0 : t.response) == null ? void 0 : n.status)) === 404;
32
35
  }
33
36
  async function $(s, t, n) {
34
- const r = /* @__PURE__ */ new Map(), i = [...new Set(n.map(String))].filter(
37
+ const i = /* @__PURE__ */ new Map(), r = [...new Set(n.map(String))].filter(
35
38
  (e) => e && e !== "new" && !e.startsWith("pending:")
36
39
  );
37
- for (let e = 0; e < i.length; e += p) {
38
- const o = i.slice(e, e + p);
40
+ for (let e = 0; e < r.length; e += m) {
41
+ const o = r.slice(e, e + m);
39
42
  try {
40
- const a = await s.request(
43
+ const u = await s.request(
41
44
  h("/revisions/latest", { collection: t, items: o.join(",") })
42
45
  );
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
- } catch (a) {
46
- if (!k(a)) continue;
46
+ for (const [c, a] of Object.entries((u == null ? void 0 : u.data) ?? {}))
47
+ i.set(c, typeof a == "number" && Number.isFinite(a) ? a : null);
48
+ } catch (u) {
49
+ if (!k(u)) continue;
47
50
  let c = 0;
48
- const u = async () => {
49
- var g;
51
+ const a = async () => {
52
+ var l;
50
53
  for (; c < o.length; ) {
51
- const y = o[c++];
54
+ const f = o[c++];
52
55
  try {
53
- const f = await s.request(
54
- h("/revisions", { collection: t, item: y, latest_only: "1" })
55
- ), l = (g = f == null ? void 0 : f.data) == null ? void 0 : g.latest;
56
- r.set(y, typeof l == "number" && Number.isFinite(l) ? l : null);
56
+ const g = await s.request(
57
+ h("/revisions", { collection: t, item: f, latest_only: "1" })
58
+ ), y = (l = g == null ? void 0 : g.data) == null ? void 0 : l.latest;
59
+ i.set(f, typeof y == "number" && Number.isFinite(y) ? y : null);
57
60
  } catch {
58
61
  }
59
62
  }
60
63
  };
61
- await Promise.all(Array.from({ length: Math.min(4, o.length) }, u));
64
+ await Promise.all(Array.from({ length: Math.min(4, o.length) }, a));
62
65
  }
63
66
  }
64
- return r;
67
+ return i;
65
68
  }
66
69
  function M(s) {
67
70
  try {
@@ -72,35 +75,35 @@ function M(s) {
72
75
  }
73
76
  class R {
74
77
  constructor(t) {
75
- w(this, "entries", /* @__PURE__ */ new Map());
78
+ p(this, "entries", /* @__PURE__ */ new Map());
76
79
  this.fetcher = t;
77
80
  }
78
- put(t, n, r) {
79
- const i = {
81
+ put(t, n, i) {
82
+ const r = {
80
83
  sig: n,
81
- base: r
84
+ base: i
82
85
  };
83
- this.entries.set(t, i), r.then((e) => {
84
- i.settled = e;
86
+ this.entries.set(t, r), i.then((e) => {
87
+ r.settled = e;
85
88
  });
86
89
  }
87
90
  /** Record a read of these rows. */
88
91
  noteRows(t) {
89
- var i;
92
+ var r;
90
93
  const n = [];
91
94
  for (const e of t) {
92
95
  const o = (e == null ? void 0 : e.id) == null ? "" : String(e.id);
93
96
  if (!o || o === "new" || o.startsWith("pending:")) continue;
94
- const a = M(e);
95
- ((i = this.entries.get(o)) == null ? void 0 : i.sig) !== a && n.push({ id: o, sig: a });
97
+ const u = M(e);
98
+ ((r = this.entries.get(o)) == null ? void 0 : r.sig) !== u && n.push({ id: o, sig: u });
96
99
  }
97
100
  if (n.length === 0) return;
98
- const r = this.fetcher(n.map((e) => e.id)).catch(() => /* @__PURE__ */ new Map());
101
+ const i = this.fetcher(n.map((e) => e.id)).catch(() => /* @__PURE__ */ new Map());
99
102
  for (const e of n)
100
103
  this.put(
101
104
  e.id,
102
105
  e.sig,
103
- r.then((o) => o.has(e.id) ? o.get(e.id) ?? null : null)
106
+ i.then((o) => o.has(e.id) ? o.get(e.id) ?? null : null)
104
107
  );
105
108
  }
106
109
  /** The base for a write to this row — read-time when known, else fetched
@@ -111,8 +114,8 @@ class R {
111
114
  const e = await n.base;
112
115
  if (e != null) return e;
113
116
  }
114
- const i = (await this.fetcher([t]).catch(() => /* @__PURE__ */ new Map())).get(t) ?? null;
115
- return i != null && this.set(t, i), i;
117
+ const r = (await this.fetcher([t]).catch(() => /* @__PURE__ */ new Map())).get(t) ?? null;
118
+ return r != null && this.set(t, r), r;
116
119
  }
117
120
  /** The read-time base of a row, if a read noted it (undefined = never read). */
118
121
  peek(t) {
@@ -127,88 +130,92 @@ class R {
127
130
  /** After a 409: the person's next write is a choice made against `latest`. */
128
131
  set(t, n) {
129
132
  var e;
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);
133
+ const r = { sig: ((e = this.entries.get(t)) == null ? void 0 : e.sig) ?? "", base: Promise.resolve(n), settled: n };
134
+ this.entries.set(t, r);
132
135
  }
133
136
  /** After the person's own write: the next read brings the new base. */
134
137
  forget(t) {
135
138
  this.entries.delete(t);
136
139
  }
137
140
  }
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;
141
+ const w = /* @__PURE__ */ new WeakMap();
142
+ function O(s, t) {
143
+ let n = w.get(s);
144
+ n || (n = /* @__PURE__ */ new Map(), w.set(s, n));
145
+ let i = n.get(t);
146
+ return i || (i = new R((r) => $(s, t, r)), n.set(t, i)), i;
144
147
  }
145
- function j(s, t) {
148
+ function x(s, t) {
146
149
  const n = /* @__PURE__ */ new Map();
147
- for (const r of t)
148
- !r || r === "new" || r.startsWith("pending:") || n.set(r, s.baseOf(r));
150
+ for (const i of t)
151
+ !i || i === "new" || i.startsWith("pending:") || n.set(i, s.baseOf(i));
149
152
  return n;
150
153
  }
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);
154
+ async function F(s, t, n, i, r, e) {
155
+ const o = e.base !== void 0 ? await e.base : null, u = o != null && o > 0 ? o : await t.baseOf(i);
153
156
  try {
154
- await s.request(b(n, S(i, a)));
157
+ await s.request(d(n, S(r, u)));
155
158
  } catch (c) {
156
- const u = d(c);
157
- if (!u) throw c;
158
- return u.latest > 0 && t.set(r, u.latest), {
159
+ const a = b(c);
160
+ if (!a) throw c;
161
+ a.latest > 0 && t.set(i, a.latest);
162
+ const l = await s.request(h(n.split("?")[0])).then((f) => (f == null ? void 0 : f.data) ?? null).catch(() => null);
163
+ return {
159
164
  ok: !1,
160
165
  conflict: {
161
166
  key: e.key,
162
- rowId: r,
167
+ rowId: i,
163
168
  label: e.label,
164
- conflicts: u.conflicts,
165
- latest: u.latest,
166
- mine: i,
169
+ conflicts: a.conflicts,
170
+ latest: a.latest,
171
+ mine: r,
172
+ edit: r,
173
+ current: l,
167
174
  url: n
168
175
  }
169
176
  };
170
177
  }
171
- return t.forget(r), { ok: !0 };
178
+ return t.forget(i), { ok: !0 };
172
179
  }
173
- async function F(s, t, n, r, i, e = 3) {
180
+ async function K(s, t, n, i, r, e = 3) {
174
181
  for (let o = 0; o < e; o++) {
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);
182
+ const u = await $(s, t, [n]), c = await s.request(
183
+ h(`/items/${t}/${n}`, { fields: `id,${i}` })
184
+ ).then((a) => (a == null ? void 0 : a.data) ?? null);
178
185
  if (!c) return !1;
179
186
  try {
180
187
  return await s.request(
181
- b(
188
+ d(
182
189
  `/items/${t}/${n}`,
183
- S({ [r]: (Number(c[r]) || 0) + i }, a.get(n))
190
+ S({ [i]: (Number(c[i]) || 0) + r }, u.get(n))
184
191
  )
185
192
  ), !0;
186
- } catch (u) {
187
- if (!d(u)) throw u;
193
+ } catch (a) {
194
+ if (!b(a)) throw a;
188
195
  }
189
196
  }
190
197
  return !1;
191
198
  }
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);
199
+ function L(s, t, n) {
200
+ const i = (e, o) => {
201
+ e[0] !== "o2m-rows" || String(e[3]) !== n || typeof e[1] != "string" || Array.isArray(o) && O(t, e[1]).noteRows(o);
202
+ }, r = s.getQueryCache();
203
+ for (const e of r.findAll({ queryKey: ["o2m-rows"] })) i(e.queryKey, e.state.data);
204
+ return r.subscribe((e) => {
205
+ e.type !== "updated" || e.action.type !== "success" || i(e.query.queryKey, e.query.state.data);
199
206
  });
200
207
  }
201
208
  export {
202
- p as LATEST_BATCH,
209
+ m as LATEST_BATCH,
203
210
  R as RowBaseBook,
204
211
  $ as fetchLatestRevisions,
205
- F as incrementGuarded,
206
- A as lineConflictKey,
207
- N as lineLabelOf,
208
- K as noteLineReads,
209
- C as resolveLineCollision,
210
- L as rowBaseBookFor,
211
- j as snapshotRowBases,
212
+ K as incrementGuarded,
213
+ C as lineConflictKey,
214
+ j as lineLabelOf,
215
+ L as noteLineReads,
216
+ N as resolveLineCollision,
217
+ O as rowBaseBookFor,
218
+ x as snapshotRowBases,
212
219
  S as withRowBaseRevision,
213
- x as writeLineGuarded
220
+ F as writeLineGuarded
214
221
  };
@@ -0,0 +1,17 @@
1
+ function o(e) {
2
+ var n;
3
+ return e.isDirty || (((n = e.staged) == null ? void 0 : n.total) ?? 0) > 0;
4
+ }
5
+ function i(e) {
6
+ return e.childRefused || (e.lineConflicts ?? 0) > 0 || !!e.reasonWaiting || !!e.chooserOpen;
7
+ }
8
+ function f(e, n) {
9
+ for (const [t, r] of Object.entries(n))
10
+ if (r && e[t] !== r) return { field: t, message: r };
11
+ return null;
12
+ }
13
+ export {
14
+ i as moveBlockedAfterSave,
15
+ f as newFieldError,
16
+ o as unsavedBeforeMove
17
+ };
@@ -1,28 +1,35 @@
1
- import { useState as c, useRef as i, useEffect as s } from "react";
2
- import { matchesAllTokens as a } from "../../lib/utils.js";
3
- function S(t, n, r = 300) {
4
- const [e, o] = c(t), f = i(!1);
5
- return s(() => {
6
- if (t === e) {
7
- f.current = !1;
1
+ import { useState as i, useRef as s, useEffect as a } from "react";
2
+ import { matchesAllTokens as f } from "../../lib/utils.js";
3
+ function p(t, n, e = 300) {
4
+ const [r, c] = i(t), o = s(!1);
5
+ return a(() => {
6
+ if (t === r) {
7
+ o.current = !1;
8
8
  return;
9
9
  }
10
10
  if (!t) {
11
- o("");
11
+ c("");
12
12
  return;
13
13
  }
14
14
  if (n) {
15
- f.current = !0;
15
+ o.current = !0;
16
16
  return;
17
17
  }
18
- const u = setTimeout(() => o(t), f.current ? 0 : r);
18
+ const u = setTimeout(() => c(t), o.current ? 0 : e);
19
19
  return () => clearTimeout(u);
20
- }, [t, e, n, r]), e;
20
+ }, [t, r, n, e]), r;
21
21
  }
22
- function T(t, n, r, e) {
23
- return e || !r.trim() ? t : t.filter((o) => a(n(o), r));
22
+ function E(t, n, e, r) {
23
+ return r || !e.trim() ? t : t.filter((c) => f(n(c), e));
24
+ }
25
+ const l = 200;
26
+ function S(t, n, e) {
27
+ const r = e.replace(/[-_/]+/g, " ").trim();
28
+ return !r || t.length >= l ? [] : t.filter((c) => f(n(c), r));
24
29
  }
25
30
  export {
26
- T as narrowLocally,
27
- S as useLatestSearch
31
+ l as PICKER_PAGE,
32
+ S as labelOnlyMatches,
33
+ E as narrowLocally,
34
+ p as useLatestSearch
28
35
  };
@@ -0,0 +1,8 @@
1
+ const r = 768;
2
+ function o(R) {
3
+ return R > 0 && R < 768;
4
+ }
5
+ export {
6
+ r as NARROW_RECORD_PX,
7
+ o as isNarrowRecordWidth
8
+ };