@nivaro/react 0.3.57 → 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.
Files changed (69) hide show
  1. package/dist/components/fields/RelationField.js +110 -80
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useRelationOptions.js +1 -0
  4. package/dist/hooks/useSessionRecorder.js +1 -1
  5. package/dist/index.d.ts +37 -2
  6. package/dist/index.js +523 -520
  7. package/dist/shared/components/CollectionBrowserView.js +2693 -2619
  8. package/dist/shared/components/DataTable.js +538 -495
  9. package/dist/shared/components/ItemEditForm.js +4559 -4386
  10. package/dist/shared/components/PageRenderer.js +537 -508
  11. package/dist/shared/components/ProfileView.js +716 -715
  12. package/dist/shared/components/QueryTable.js +74 -74
  13. package/dist/shared/components/RecordReadView.js +367 -364
  14. package/dist/shared/components/ReportView.js +64 -39
  15. package/dist/shared/components/WidgetSlot.js +543 -520
  16. package/dist/shared/components/alerts/AlertManagerView.js +324 -317
  17. package/dist/shared/components/alerts/types.js +37 -14
  18. package/dist/shared/components/cbv/row-focus.js +19 -0
  19. package/dist/shared/components/help-videos/HelpVideoPlayer.js +152 -147
  20. package/dist/shared/components/integrations/console/SignalCard.js +59 -59
  21. package/dist/shared/components/integrations/console/tone.js +52 -30
  22. package/dist/shared/components/item-edit/CatalogPickerField.js +525 -505
  23. package/dist/shared/components/item-edit/FieldRenderer.js +22 -20
  24. package/dist/shared/components/item-edit/FieldRow.js +175 -173
  25. package/dist/shared/components/item-edit/GridBulkEditDialog.js +55 -54
  26. package/dist/shared/components/item-edit/InlineTableField.js +2487 -2442
  27. package/dist/shared/components/item-edit/M2MCombobox.js +321 -295
  28. package/dist/shared/components/item-edit/MidairCollisionDialog.js +1 -1
  29. package/dist/shared/components/item-edit/PlanGrid.js +973 -894
  30. package/dist/shared/components/item-edit/QuickCreateButton.js +335 -106
  31. package/dist/shared/components/item-edit/RecordLiveSync.js +77 -75
  32. package/dist/shared/components/item-edit/RelationCombobox.js +452 -335
  33. package/dist/shared/components/item-edit/RelationGroupedCombobox.js +262 -141
  34. package/dist/shared/components/item-edit/SummaryPanel.js +385 -358
  35. package/dist/shared/components/item-edit/duplicate-rehearsal.js +47 -0
  36. package/dist/shared/components/item-edit/line-midair.js +82 -75
  37. package/dist/shared/components/item-edit/option-disambiguate.js +44 -32
  38. package/dist/shared/components/item-edit/related-missing.js +45 -0
  39. package/dist/shared/components/item-edit/save-outcome.js +9 -7
  40. package/dist/shared/components/notifications/NotificationRulesEditor.js +130 -123
  41. package/dist/shared/components/panels/AccessDeniedPanel.js +52 -48
  42. package/dist/shared/components/panels/ItemLockBanner.js +213 -211
  43. package/dist/shared/components/panels/PipelinePanel.js +1140 -1053
  44. package/dist/shared/components/panels/RecordIntegrityBanner.js +114 -86
  45. package/dist/shared/components/panels/RevisionsPanel.js +316 -299
  46. package/dist/shared/components/panels/TaskPanel.js +265 -249
  47. package/dist/shared/components/panels/landing-state.js +27 -0
  48. package/dist/shared/components/pipeline/PipelineEditorView.js +110 -92
  49. package/dist/shared/components/profile/AiMemoryCard.js +12 -10
  50. package/dist/shared/components/queue/OwnerAvatars.js +80 -41
  51. package/dist/shared/components/queue/QueueQuickFilters.js +52 -52
  52. package/dist/shared/components/queue/QueueWorklist.js +1050 -1026
  53. package/dist/shared/components/queue/group-sums.js +27 -0
  54. package/dist/shared/components/queue/live-state-aspect.js +9 -5
  55. package/dist/shared/components/widgets/ReviewListWidget.js +175 -154
  56. package/dist/shared/lib/back-closes.js +25 -0
  57. package/dist/shared/lib/display-prefs.js +60 -52
  58. package/dist/shared/lib/draft-store.js +71 -48
  59. package/dist/shared/lib/expression.js +53 -53
  60. package/dist/shared/lib/form-usage-beacon.js +7 -7
  61. package/dist/shared/lib/list-page-memory.js +63 -0
  62. package/dist/shared/lib/live.js +44 -44
  63. package/dist/shared/lib/money-input.js +45 -0
  64. package/dist/shared/lib/own-writes.js +76 -28
  65. package/dist/shared/lib/request-gate.js +110 -109
  66. package/dist/shared/lib/sanitize-html.js +10 -6
  67. package/dist/shared/lib/staged-row-labels.js +18 -0
  68. package/dist/shared/lib/validation-rules.js +34 -19
  69. 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 m = (s, t, n) => _(s, typeof t != "symbol" ? t + "" : t, n);
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 B(s, t) {
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 [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;
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, i) {
18
- const r = s.findIndex((a) => String(a.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);
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 r >= 0 ? `Line ${r + 1}` : `Row ${t}`;
25
+ return i >= 0 ? `Line ${i + 1}` : `Row ${t}`;
26
26
  }
27
- const w = 500;
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 i = /* @__PURE__ */ new Map(), r = [...new Set(n.map(String))].filter(
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 < r.length; e += w) {
38
- const o = r.slice(e, e + w);
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 [u, c] of Object.entries((a == null ? void 0 : a.data) ?? {}))
44
- i.set(u, typeof c == "number" && Number.isFinite(c) ? c : null);
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 u = 0;
48
- const c = async () => {
47
+ let c = 0;
48
+ const u = async () => {
49
49
  var g;
50
- for (; u < o.length; ) {
51
- const y = o[u++];
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
- i.set(y, typeof l == "number" && Number.isFinite(l) ? l : null);
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) }, c));
61
+ await Promise.all(Array.from({ length: Math.min(4, o.length) }, u));
62
62
  }
63
63
  }
64
- return i;
64
+ return r;
65
65
  }
66
- function L(s) {
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 M {
73
+ class R {
74
74
  constructor(t) {
75
- m(this, "entries", /* @__PURE__ */ new Map());
75
+ w(this, "entries", /* @__PURE__ */ new Map());
76
76
  this.fetcher = t;
77
77
  }
78
- put(t, n, i) {
79
- const r = {
78
+ put(t, n, r) {
79
+ const i = {
80
80
  sig: n,
81
- base: i
81
+ base: r
82
82
  };
83
- this.entries.set(t, r), i.then((e) => {
84
- r.settled = e;
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 r;
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 = L(e);
95
- ((r = this.entries.get(o)) == null ? void 0 : r.sig) !== a && n.push({ id: o, sig: a });
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 i = this.fetcher(n.map((e) => e.id)).catch(() => /* @__PURE__ */ new Map());
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
- i.then((o) => o.has(e.id) ? o.get(e.id) ?? null : null)
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 r = (await this.fetcher([t]).catch(() => /* @__PURE__ */ new Map())).get(t) ?? null;
115
- return r != null && this.set(t, r), r;
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 r = { sig: ((e = this.entries.get(t)) == null ? void 0 : e.sig) ?? "", base: Promise.resolve(n), settled: n };
131
- this.entries.set(t, r);
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 p = /* @__PURE__ */ new WeakMap();
139
- function R(s, t) {
140
- let n = p.get(s);
141
- n || (n = /* @__PURE__ */ new Map(), p.set(s, n));
142
- let i = n.get(t);
143
- return i || (i = new M((r) => $(s, t, r)), n.set(t, i)), i;
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
- async function j(s, t, n, i, r, e) {
146
- const o = await t.baseOf(i);
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(r, o)));
149
- } catch (a) {
150
- const u = d(a);
151
- if (!u) throw a;
152
- return u.latest > 0 && t.set(i, u.latest), {
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: i,
162
+ rowId: r,
157
163
  label: e.label,
158
164
  conflicts: u.conflicts,
159
165
  latest: u.latest,
160
- mine: r,
166
+ mine: i,
161
167
  url: n
162
168
  }
163
169
  };
164
170
  }
165
- return t.forget(i), { ok: !0 };
171
+ return t.forget(r), { ok: !0 };
166
172
  }
167
- async function x(s, t, n, i, r, e = 3) {
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]), u = await s.request(
170
- h(`/items/${t}/${n}`, { fields: `id,${i}` })
171
- ).then((c) => (c == null ? void 0 : c.data) ?? null);
172
- if (!u) return !1;
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({ [i]: (Number(u[i]) || 0) + r }, a.get(n))
183
+ S({ [r]: (Number(c[r]) || 0) + i }, a.get(n))
178
184
  )
179
185
  ), !0;
180
- } catch (c) {
181
- if (!d(c)) throw c;
186
+ } catch (u) {
187
+ if (!d(u)) throw u;
182
188
  }
183
189
  }
184
190
  return !1;
185
191
  }
186
- function F(s, t, n) {
187
- const i = (e, o) => {
188
- e[0] !== "o2m-rows" || String(e[3]) !== n || typeof e[1] != "string" || Array.isArray(o) && R(t, e[1]).noteRows(o);
189
- }, r = s.getQueryCache();
190
- for (const e of r.findAll({ queryKey: ["o2m-rows"] })) i(e.queryKey, e.state.data);
191
- return r.subscribe((e) => {
192
- e.type !== "updated" || e.action.type !== "success" || i(e.query.queryKey, e.query.state.data);
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
- w as LATEST_BATCH,
197
- M as RowBaseBook,
202
+ p as LATEST_BATCH,
203
+ R as RowBaseBook,
198
204
  $ as fetchLatestRevisions,
199
- x as incrementGuarded,
200
- B as lineConflictKey,
205
+ F as incrementGuarded,
206
+ A as lineConflictKey,
201
207
  N as lineLabelOf,
202
- F as noteLineReads,
208
+ K as noteLineReads,
203
209
  C as resolveLineCollision,
204
- R as rowBaseBookFor,
210
+ L as rowBaseBookFor,
211
+ j as snapshotRowBases,
205
212
  S as withRowBaseRevision,
206
- j as writeLineGuarded
213
+ x as writeLineGuarded
207
214
  };
@@ -1,13 +1,17 @@
1
- import { titleCase as y } from "../../lib/utils.js";
2
- function S(n, i) {
1
+ import { titleCase as p, formatDateTime as y } from "../../lib/utils.js";
2
+ function w(e) {
3
+ return !/[\p{L}\p{N}]/u.test(e ?? "");
4
+ }
5
+ const E = "Unnamed record";
6
+ function k(e, o) {
3
7
  const r = /* @__PURE__ */ new Map();
4
- for (const o of n) {
5
- const s = i(o).trim().toLowerCase(), a = r.get(s);
6
- a ? a.push(String(o.id)) : r.set(s, [String(o.id)]);
8
+ for (const i of e) {
9
+ const n = o(i).trim().toLowerCase(), a = r.get(n);
10
+ a ? a.push(String(i.id)) : r.set(n, [String(i.id)]);
7
11
  }
8
- return [...r.values()].filter((o) => o.length > 1).flat();
12
+ return [...r.values()].filter((i) => i.length > 1).flat();
9
13
  }
10
- const b = /* @__PURE__ */ new Set([
14
+ const S = /* @__PURE__ */ new Set([
11
15
  "id",
12
16
  "sort",
13
17
  "date_created",
@@ -17,37 +21,45 @@ const b = /* @__PURE__ */ new Set([
17
21
  "created_at",
18
22
  "updated_at",
19
23
  "created_by",
20
- "updated_by"
21
- ]), m = /(^|_)(system_id|code|number|no|key|name|type|status)$/i;
22
- function p(n) {
23
- if (n == null || typeof n == "object") return null;
24
- const i = String(n).trim();
25
- return i === "" ? null : i;
24
+ "updated_by",
25
+ "created",
26
+ "changed",
27
+ "modified"
28
+ ]), b = /(^|_)(system_id|code|number|no|key|name|type|status)$/i, _ = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/;
29
+ function m(e) {
30
+ if (e == null || typeof e == "object") return null;
31
+ const o = String(e).trim();
32
+ return o === "" ? null : _.test(o) ? y(o) : o;
26
33
  }
27
- function w(n, i = []) {
28
- const r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set([...b, ...i]);
29
- for (const s of n) {
30
- if (s.length < 2) continue;
31
- const a = [...new Set(s.flatMap((t) => Object.keys(t)))].filter(
32
- (t) => !o.has(t) && !t.startsWith("_")
34
+ function L(e, o = []) {
35
+ const r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set([...S, ...o]);
36
+ for (const n of e) {
37
+ if (n.length < 2) continue;
38
+ const a = [...new Set(n.flatMap((t) => Object.keys(t)))].filter(
39
+ (t) => !i.has(t) && !t.startsWith("_")
33
40
  );
34
- let e = null;
41
+ let s = null;
35
42
  for (const t of a) {
36
- const c = s.map((d) => p(d[t]));
37
- if (c.some((d) => d === null)) continue;
38
- const u = new Set(c).size;
39
- if (u < 2) continue;
40
- const f = m.test(t), l = s.some((d) => typeof d[t] == "string");
41
- (!e || u > e.distinct || u === e.distinct && (f !== e.preferred ? f : l && !e.text)) && (e = { key: t, distinct: u, preferred: f, text: l });
42
- }
43
- for (const t of s) {
44
- const c = String(t.id);
45
- r.set(c, e ? `${y(e.key)}: ${p(t[e.key])}` : `#${c}`);
43
+ const u = n.map((c) => m(c[t]));
44
+ if (u.some((c) => c === null)) continue;
45
+ const d = new Set(u).size;
46
+ if (d < 2) continue;
47
+ const f = b.test(t), l = n.some((c) => typeof c[t] == "string");
48
+ (!s || d > s.distinct || d === s.distinct && (f !== s.preferred ? f : l && !s.text)) && (s = { key: t, distinct: d, preferred: f, text: l });
46
49
  }
50
+ n.forEach((t, u) => {
51
+ const d = String(t.id);
52
+ r.set(
53
+ d,
54
+ s ? `${p(s.key)}: ${m(t[s.key])}` : `Same name · ${u + 1} of ${n.length}`
55
+ );
56
+ });
47
57
  }
48
58
  return r;
49
59
  }
50
60
  export {
51
- S as collidingIds,
52
- w as disambiguators
61
+ E as NAMELESS_LABEL,
62
+ k as collidingIds,
63
+ L as disambiguators,
64
+ w as isNamelessLabel
53
65
  };
@@ -0,0 +1,45 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { describeError as d } from "../../lib/error-message.js";
3
+ import { cn as r } from "../../lib/utils.js";
4
+ function i(e) {
5
+ if (e == null)
6
+ return {
7
+ kind: "no-access",
8
+ text: "Not available to you",
9
+ tip: "Your access does not include this record."
10
+ };
11
+ const t = d(e).kind;
12
+ return t === "forbidden" || t === "signed-out" ? {
13
+ kind: "no-access",
14
+ text: "Not available to you",
15
+ tip: "Your access does not include this record."
16
+ } : t === "not-found" ? {
17
+ kind: "not-found",
18
+ text: "Record not found",
19
+ tip: "It may have been deleted, or it is outside what you can see."
20
+ } : {
21
+ kind: "failed",
22
+ text: "Couldn’t load",
23
+ tip: "The linked record didn’t load. Reload the page to try again."
24
+ };
25
+ }
26
+ function u(e, t) {
27
+ return i(t).kind !== "failed" ? !1 : e < 2;
28
+ }
29
+ function c({ error: e, className: t }) {
30
+ const n = i(e);
31
+ return /* @__PURE__ */ o(
32
+ "span",
33
+ {
34
+ className: r("italic text-muted-foreground", t),
35
+ "data-related-unavailable": n.kind,
36
+ "data-tip": n.tip,
37
+ children: n.text
38
+ }
39
+ );
40
+ }
41
+ export {
42
+ c as RelatedMissingLabel,
43
+ i as relatedMissing,
44
+ u as retryRelatedRead
45
+ };
@@ -1,8 +1,9 @@
1
- function r(e) {
1
+ const i = "nvr-save-outcome";
2
+ function a(e) {
2
3
  return e.childFailed === !0 || e.reasonWaiting === !0;
3
4
  }
4
- function a(e, s) {
5
- const { isNew: t } = s, i = s.noun.toLowerCase();
5
+ function o(e, s) {
6
+ const { isNew: t } = s, r = s.noun.toLowerCase();
6
7
  if (e.childFailed) {
7
8
  const n = e.childErrors ?? [];
8
9
  return n.length === 0 && e.linkProblems.length > 0 ? null : {
@@ -21,7 +22,7 @@ function a(e, s) {
21
22
  const n = e.hidden.reason ? ` (${e.hidden.reason})` : "";
22
23
  return {
23
24
  kind: "warning",
24
- text: t ? `The new ${i} was created, but it’s outside what you can see${n}.` : `Saved, but this ${i} is now outside what you can see${n}.`,
25
+ text: t ? `The new ${r} was created, but it’s outside what you can see${n}.` : `Saved, but this ${r} is now outside what you can see${n}.`,
25
26
  duration: 15e3
26
27
  };
27
28
  }
@@ -29,7 +30,7 @@ function a(e, s) {
29
30
  const n = e.lineConflicts;
30
31
  return {
31
32
  kind: "warning",
32
- text: `Saved, except ${n} ${n === 1 ? "line" : "lines"} someone else changed — pick which value wins`,
33
+ text: `Saved, except ${n} ${n === 1 ? "row" : "rows"} someone else changed — pick which value wins`,
33
34
  duration: 1e4
34
35
  };
35
36
  }
@@ -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
- a as saveClosingMessage,
47
- r as saveLeftWorkStaged
47
+ i as SAVE_OUTCOME_TOAST_ID,
48
+ o as saveClosingMessage,
49
+ a as saveLeftWorkStaged
48
50
  };