@nivaro/react 0.3.52 → 0.3.53

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 (34) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +47 -3
  4. package/dist/shared/components/ItemEditForm.js +3851 -3821
  5. package/dist/shared/components/NotificationBell.js +163 -150
  6. package/dist/shared/components/PageRenderer.js +600 -549
  7. package/dist/shared/components/ProfileView.js +36 -34
  8. package/dist/shared/components/QueryStatStrip.js +96 -89
  9. package/dist/shared/components/QueryTable.js +214 -215
  10. package/dist/shared/components/ReportView.js +548 -529
  11. package/dist/shared/components/alerts/AlertManagerView.js +346 -320
  12. package/dist/shared/components/item-edit/CatalogPickerField.js +1300 -1219
  13. package/dist/shared/components/item-edit/FieldAffordances.js +145 -136
  14. package/dist/shared/components/item-edit/FieldRenderer.js +366 -326
  15. package/dist/shared/components/item-edit/InlineTableField.js +3047 -2932
  16. package/dist/shared/components/item-edit/NestedRelationEditor.js +149 -143
  17. package/dist/shared/components/item-edit/PlanGrid.js +718 -705
  18. package/dist/shared/components/item-edit/SummaryPanel.js +351 -337
  19. package/dist/shared/components/item-edit/line-qty.js +115 -53
  20. package/dist/shared/components/item-edit/save-refusal.js +18 -18
  21. package/dist/shared/components/item-edit/usePersonalDefaults.js +210 -207
  22. package/dist/shared/components/panels/CommentPanel.js +204 -197
  23. package/dist/shared/components/panels/ItemLockBanner.js +318 -291
  24. package/dist/shared/components/panels/PipelinePanel.js +1388 -1218
  25. package/dist/shared/components/panels/RecordIntegrityBanner.js +201 -172
  26. package/dist/shared/components/panels/RevisionsPanel.js +101 -106
  27. package/dist/shared/components/panels/TransitionRequirementsDialog.js +564 -534
  28. package/dist/shared/components/panels/requirement-side-effects.js +46 -29
  29. package/dist/shared/components/queue/QueueItemSheet.js +219 -146
  30. package/dist/shared/components/queue/QueueWorklist.js +738 -730
  31. package/dist/shared/components/widgets/ReviewListWidget.js +236 -201
  32. package/dist/shared/lib/activity-sentence.js +236 -227
  33. package/dist/shared/lib/record-ref.js +43 -34
  34. package/package.json +1 -1
@@ -1,13 +1,13 @@
1
1
  import { jsxs as p, jsx as n } from "react/jsx-runtime";
2
- import { useQueryClient as ge, useQuery as j } from "@tanstack/react-query";
2
+ import { useQueryClient as ge, useQuery as k } from "@tanstack/react-query";
3
3
  import { Loader2 as Pe, Pencil as De, X as Ke } from "lucide-react";
4
- import { useMemo as L, useRef as $e, useEffect as ke, useState as T, Fragment as je } from "react";
4
+ import { useMemo as L, useRef as $e, useEffect as je, useState as T, Fragment as ke } from "react";
5
5
  import { useNivaroClient as Le } from "../../context.js";
6
- import { get as K, post as Te, patch as Fe, del as Ae } from "../../lib/commands.js";
7
- import { titleCase as R, formatNumber as Je, cn as ue, toLocalDateString as Ye } from "../../lib/utils.js";
6
+ import { get as K, post as Te, patch as Fe, del as Me } from "../../lib/commands.js";
7
+ import { titleCase as R, formatNumber as Ae, cn as ue, toLocalDateString as Je } from "../../lib/utils.js";
8
8
  import { FieldRenderer as fe } from "./FieldRenderer.js";
9
- import { SENTINEL_FIELDS as Me, EMPTY_NESTED_OPS as O, applyDisplayTemplate as Se } from "./helpers.js";
10
- const We = /* @__PURE__ */ new Set([
9
+ import { SENTINEL_FIELDS as Ye, EMPTY_NESTED_OPS as O, applyDisplayTemplate as Se } from "./helpers.js";
10
+ const Ie = /* @__PURE__ */ new Set([
11
11
  "alias",
12
12
  "o2m",
13
13
  "m2m",
@@ -15,22 +15,27 @@ const We = /* @__PURE__ */ new Set([
15
15
  "presentation",
16
16
  "group",
17
17
  "divider"
18
- ]), ze = /* @__PURE__ */ new Set(["__apply_values__", "__create_with_defaults__"]);
19
- function Ie(d, a) {
20
- return d === a || d == null && a == null ? !0 : d == null || a == null ? !1 : typeof d == "string" && typeof a == "number" || typeof d == "number" && typeof a == "string" ? String(d) === String(a) : JSON.stringify(d) === JSON.stringify(a);
18
+ ]), We = /* @__PURE__ */ new Set(["__apply_values__", "__create_with_defaults__"]);
19
+ function ze(o, l) {
20
+ return o === l || o == null && l == null ? !0 : o == null || l == null ? !1 : typeof o == "string" && typeof l == "number" || typeof o == "number" && typeof l == "string" ? String(o) === String(l) : JSON.stringify(o) === JSON.stringify(l);
21
21
  }
22
- function me(d) {
22
+ function me(o) {
23
23
  var x;
24
- const a = d == null ? void 0 : d.response;
25
- if ((x = a == null ? void 0 : a.violations) != null && x.length) {
26
- const q = a.violations.map((b) => b.explanation).filter(Boolean).join("; ");
24
+ const l = o == null ? void 0 : o.response;
25
+ if ((x = l == null ? void 0 : l.violations) != null && x.length) {
26
+ const q = l.violations.map((b) => b.explanation).filter(Boolean).join("; ");
27
27
  if (q) return q;
28
28
  }
29
- return a != null && a.message ? a.message : a != null && a.error ? a.error : d instanceof Error && d.message ? d.message : "Save failed";
29
+ return l != null && l.message ? l.message : l != null && l.error ? l.error : o instanceof Error && o.message ? o.message : "Save failed";
30
30
  }
31
- function Oe({
32
- parentCollection: d,
33
- relationField: a,
31
+ function Ue(o) {
32
+ if (!Number.isFinite(o)) return o;
33
+ const l = Math.round((o + Math.sign(o) * Number.EPSILON) * 100) / 100;
34
+ return Object.is(l, -0) ? 0 : l;
35
+ }
36
+ function Ce({
37
+ parentCollection: o,
38
+ relationField: l,
34
39
  parentRowId: x,
35
40
  stagedMembers: q,
36
41
  onStagedChange: b,
@@ -40,191 +45,191 @@ function Oe({
40
45
  outerGridInvalidateKey: C,
41
46
  deferred: F = !1,
42
47
  onRowsChange: G,
43
- stagedOps: A,
48
+ stagedOps: M,
44
49
  onStagedOpsChange: f,
45
50
  matchCollection: m,
46
- matchQuery: J,
47
- matchSeed: Y
51
+ matchQuery: A,
52
+ matchSeed: J
48
53
  }) {
49
- const y = Le(), ee = ge(), { data: M, isLoading: xe } = j({
50
- queryKey: ["collection-meta", d],
51
- queryFn: () => y.request(K(`/collections/${d}`)).then((e) => {
54
+ const y = Le(), ee = ge(), { data: Y, isLoading: xe } = k({
55
+ queryKey: ["collection-meta", o],
56
+ queryFn: () => y.request(K(`/collections/${o}`)).then((e) => {
52
57
  const t = e.data;
53
58
  return (t == null ? void 0 : t.relations) ?? [];
54
59
  }),
55
60
  staleTime: 10 * 6e4
56
61
  }), P = L(
57
- () => M == null ? void 0 : M.find(
58
- (e) => e.one_collection === d && e.one_field === a
62
+ () => Y == null ? void 0 : Y.find(
63
+ (e) => e.one_collection === o && e.one_field === l
59
64
  ),
60
- [M, d, a]
61
- ), c = m ?? (P == null ? void 0 : P.many_collection) ?? null, v = m ? null : (P == null ? void 0 : P.many_field) ?? null, { data: S = [] } = j({
62
- queryKey: ["collection-meta", c],
63
- queryFn: () => y.request(K(`/collections/${c}`)).then((e) => {
65
+ [Y, o, l]
66
+ ), d = m ?? (P == null ? void 0 : P.many_collection) ?? null, v = m ? null : (P == null ? void 0 : P.many_field) ?? null, { data: S = [] } = k({
67
+ queryKey: ["collection-meta", d],
68
+ queryFn: () => y.request(K(`/collections/${d}`)).then((e) => {
64
69
  const t = e.data;
65
70
  return (t == null ? void 0 : t.relations) ?? [];
66
71
  }),
67
- enabled: !!c,
72
+ enabled: !!d,
68
73
  staleTime: 10 * 6e4
69
- }), { data: te = [] } = j({
70
- queryKey: ["field-config", c, null],
71
- queryFn: () => y.request(K(`/field-config/${c}`)).then((e) => e.data ?? []),
72
- enabled: !!c,
74
+ }), { data: te = [] } = k({
75
+ queryKey: ["field-config", d, null],
76
+ queryFn: () => y.request(K(`/field-config/${d}`)).then((e) => e.data ?? []),
77
+ enabled: !!d,
73
78
  staleTime: 6e4
74
79
  }), E = L(
75
80
  () => te.filter(
76
- (e) => !e.hidden && !We.has(e.type) && e.field !== v && !(Y && e.field in Y) && e.field !== "id" && !Me.has(e.field) && !ze.has(e.group_key ?? "")
81
+ (e) => !e.hidden && !Ie.has(e.type) && e.field !== v && !(J && e.field in J) && e.field !== "id" && !Ye.has(e.field) && !We.has(e.group_key ?? "")
77
82
  ),
78
83
  [te, v]
79
- ), re = m ? ["nested-rows", c, JSON.stringify(J ?? null)] : ["nested-rows", c, v, x], { data: W = [], isLoading: Q } = j({
84
+ ), re = m ? ["nested-rows", d, JSON.stringify(A ?? null)] : ["nested-rows", d, v, x], { data: I = [], isLoading: Q } = k({
80
85
  queryKey: re,
81
86
  queryFn: () => y.request(
82
- K(`/items/${c}`, {
87
+ K(`/items/${d}`, {
83
88
  filter: JSON.stringify(
84
- m ? J : { [v]: { _eq: x } }
89
+ m ? A : { [v]: { _eq: x } }
85
90
  ),
86
91
  limit: 200
87
92
  })
88
93
  ).then((e) => e.data ?? []),
89
- enabled: m ? !!J : !!c && !!v && x != null,
94
+ enabled: m ? !!A : !!d && !!v && x != null,
90
95
  staleTime: 3e4
91
96
  }), N = L(() => {
92
97
  if (x != null) {
93
98
  if (F) {
94
- const e = A ?? O, t = new Set(e.deleted), r = new Map(e.updated.map((l) => [l.id, l.changes])), i = W.filter((l) => !t.has(String(l.id))).map((l) => {
95
- const u = r.get(String(l.id));
96
- return { key: String(l.id), data: u ? { ...l, ...u } : l };
97
- }), s = e.created.map((l, u) => ({ key: `created:${u}`, data: l }));
98
- return [...i, ...s];
99
+ const e = M ?? O, t = new Set(e.deleted), r = new Map(e.updated.map((a) => [a.id, a.changes])), s = I.filter((a) => !t.has(String(a.id))).map((a) => {
100
+ const u = r.get(String(a.id));
101
+ return { key: String(a.id), data: u ? { ...a, ...u } : a };
102
+ }), i = e.created.map((a, u) => ({ key: `created:${u}`, data: a }));
103
+ return [...s, ...i];
99
104
  }
100
- return W.map((e) => ({ key: String(e.id), data: e }));
105
+ return I.map((e) => ({ key: String(e.id), data: e }));
101
106
  }
102
107
  return (q ?? []).map((e, t) => ({ key: `staged:${t}`, data: e }));
103
- }, [x, W, q, F, A]), ne = $e("");
104
- ke(() => {
108
+ }, [x, I, q, F, M]), ne = $e("");
109
+ je(() => {
105
110
  if (!G) return;
106
111
  const e = JSON.stringify(N.map((t) => t.data));
107
112
  e !== ne.current && (ne.current = e, G(N.map((t) => t.data)));
108
113
  }, [N, G]);
109
- const [o, V] = T(null), [h, z] = T({}), [be, X] = T(null), [I, se] = T(!1), [U, w] = T(null);
110
- function ie(e, t) {
111
- z((r) => ({ ...r, [e]: t })), w(null);
114
+ const [c, V] = T(null), [h, W] = T({}), [be, X] = T(null), [z, ie] = T(!1), [U, w] = T(null);
115
+ function se(e, t) {
116
+ W((r) => ({ ...r, [e]: t })), w(null);
112
117
  }
113
118
  function ye() {
114
- _ || (V("new"), z({}), w(null));
119
+ _ || (V("new"), W({}), w(null));
115
120
  }
116
121
  function le(e, t) {
117
- _ || (V(e), z({ ...t }), w(null));
122
+ _ || (V(e), W({ ...t }), w(null));
118
123
  }
119
124
  function D() {
120
- V(null), z({}), w(null);
125
+ V(null), W({}), w(null);
121
126
  }
122
127
  function ae() {
123
128
  ee.invalidateQueries({ queryKey: re }), C && ee.invalidateQueries({ queryKey: C });
124
129
  }
125
130
  async function oe() {
126
- if (!o) return;
127
- if (x != null && c && (v || m)) {
128
- const t = new Set(E.map((i) => i.field)), r = Object.fromEntries(
129
- Object.entries(h).filter(([i]) => t.has(i))
131
+ if (!c) return;
132
+ if (x != null && d && (v || m)) {
133
+ const t = new Set(E.map((s) => s.field)), r = Object.fromEntries(
134
+ Object.entries(h).filter(([s]) => t.has(s))
130
135
  );
131
136
  if (F) {
132
- const i = A ?? O, s = m ? { ...i, collection: m } : i, l = m ? { ...r, ...Y ?? {} } : r;
133
- if (o === "new")
134
- f == null || f({ ...s, created: [...s.created, l] });
135
- else if (o.startsWith("created:")) {
136
- const u = parseInt(o.slice(8), 10), $ = [...s.created];
137
- $[u] = l, f == null || f({ ...s, created: $ });
137
+ const s = M ?? O, i = m ? { ...s, collection: m } : s, a = m ? { ...r, ...J ?? {} } : r;
138
+ if (c === "new")
139
+ f == null || f({ ...i, created: [...i.created, a] });
140
+ else if (c.startsWith("created:")) {
141
+ const u = parseInt(c.slice(8), 10), $ = [...i.created];
142
+ $[u] = a, f == null || f({ ...i, created: $ });
138
143
  } else {
139
- const u = W.find((k) => String(k.id) === o), $ = Object.fromEntries(
140
- Object.entries(r).filter(([k, Ee]) => !Ie(Ee, u == null ? void 0 : u[k]))
141
- ), de = s.updated.filter((k) => k.id !== o);
142
- Object.keys($).length > 0 && de.push({ id: o, changes: $ }), f == null || f({ ...s, updated: de });
144
+ const u = I.find((j) => String(j.id) === c), $ = Object.fromEntries(
145
+ Object.entries(r).filter(([j, Ee]) => !ze(Ee, u == null ? void 0 : u[j]))
146
+ ), de = i.updated.filter((j) => j.id !== c);
147
+ Object.keys($).length > 0 && de.push({ id: c, changes: $ }), f == null || f({ ...i, updated: de });
143
148
  }
144
149
  D();
145
150
  return;
146
151
  }
147
- se(!0);
152
+ ie(!0);
148
153
  try {
149
- o === "new" ? await y.request(
150
- Te(`/items/${c}`, {
154
+ c === "new" ? await y.request(
155
+ Te(`/items/${d}`, {
151
156
  ...r,
152
- ...m ? Y ?? {} : { [v]: x }
157
+ ...m ? J ?? {} : { [v]: x }
153
158
  })
154
- ) : await y.request(Fe(`/items/${c}/${o}`, r)), ae(), D();
155
- } catch (i) {
156
- w(me(i));
159
+ ) : await y.request(Fe(`/items/${d}/${c}`, r)), ae(), D();
160
+ } catch (s) {
161
+ w(me(s));
157
162
  } finally {
158
- se(!1);
163
+ ie(!1);
159
164
  }
160
165
  return;
161
166
  }
162
167
  const e = q ?? [];
163
- if (o === "new")
168
+ if (c === "new")
164
169
  b == null || b([...e, h]);
165
- else if (o.startsWith("staged:")) {
166
- const t = parseInt(o.slice(7), 10), r = [...e];
170
+ else if (c.startsWith("staged:")) {
171
+ const t = parseInt(c.slice(7), 10), r = [...e];
167
172
  r[t] = h, b == null || b(r);
168
173
  }
169
174
  D();
170
175
  }
171
176
  async function Ne(e) {
172
- if (x != null && c)
177
+ if (x != null && d)
173
178
  if (F) {
174
- const t = A ?? O, r = m ? { ...t, collection: m } : t;
179
+ const t = M ?? O, r = m ? { ...t, collection: m } : t;
175
180
  if (e.startsWith("created:")) {
176
- const i = parseInt(e.slice(8), 10);
177
- f == null || f({ ...r, created: r.created.filter((s, l) => l !== i) });
181
+ const s = parseInt(e.slice(8), 10);
182
+ f == null || f({ ...r, created: r.created.filter((i, a) => a !== s) });
178
183
  } else
179
184
  f == null || f({
180
185
  ...r,
181
- updated: r.updated.filter((i) => i.id !== e),
186
+ updated: r.updated.filter((s) => s.id !== e),
182
187
  deleted: r.deleted.includes(e) ? r.deleted : [...r.deleted, e]
183
188
  });
184
189
  } else
185
190
  try {
186
- await y.request(Ae(`/items/${c}/${e}`)), ae();
191
+ await y.request(Me(`/items/${d}/${e}`)), ae();
187
192
  } catch (t) {
188
193
  w(me(t));
189
194
  return;
190
195
  }
191
196
  else {
192
197
  const t = parseInt(e.slice(7), 10);
193
- b == null || b((q ?? []).filter((r, i) => i !== t));
198
+ b == null || b((q ?? []).filter((r, s) => s !== t));
194
199
  }
195
- X(null), w(null), o === e && D();
200
+ X(null), w(null), c === e && D();
196
201
  }
197
202
  const H = L(() => {
198
203
  const e = /* @__PURE__ */ new Map();
199
204
  for (const t of E) {
200
205
  const r = S.find(
201
- (i) => i.many_collection === c && i.many_field === t.field && !i.junction_field
206
+ (s) => s.many_collection === d && s.many_field === t.field && !s.junction_field
202
207
  );
203
208
  r != null && r.one_collection && e.set(t.field, r);
204
209
  }
205
210
  return e;
206
- }, [E, S, c]), Z = L(() => {
211
+ }, [E, S, d]), Z = L(() => {
207
212
  const e = /* @__PURE__ */ new Map();
208
213
  for (const { key: t, data: r } of N) {
209
- const i = o === t ? h : r;
210
- for (const [s, l] of H) {
211
- const u = i[s];
212
- u == null || u === "" || !l.one_collection || (e.has(l.one_collection) || e.set(l.one_collection, /* @__PURE__ */ new Set()), e.get(l.one_collection).add(String(u)));
214
+ const s = c === t ? h : r;
215
+ for (const [i, a] of H) {
216
+ const u = s[i];
217
+ u == null || u === "" || !a.one_collection || (e.has(a.one_collection) || e.set(a.one_collection, /* @__PURE__ */ new Set()), e.get(a.one_collection).add(String(u)));
213
218
  }
214
219
  }
215
220
  return e;
216
- }, [N, o, h, H]), { data: he = {} } = j({
221
+ }, [N, c, h, H]), { data: he = {} } = k({
217
222
  queryKey: [
218
223
  "nested-m2o-display",
219
- c,
224
+ d,
220
225
  ...Array.from(Z.entries()).flatMap(([e, t]) => [e, ...t])
221
226
  ],
222
227
  queryFn: async () => {
223
228
  const e = {};
224
229
  return await Promise.all(
225
230
  [...Z.entries()].map(async ([t, r]) => {
226
- var l;
227
- const [i, s] = await Promise.all([
231
+ var a;
232
+ const [s, i] = await Promise.all([
228
233
  y.request(
229
234
  K(`/collections/${t}`)
230
235
  ),
@@ -236,9 +241,9 @@ function Oe({
236
241
  )
237
242
  ]);
238
243
  e[t] = {};
239
- for (const u of s.data ?? [])
244
+ for (const u of i.data ?? [])
240
245
  e[t][String(u.id)] = Se(
241
- (l = i.data) == null ? void 0 : l.display_template,
246
+ (a = s.data) == null ? void 0 : a.display_template,
242
247
  u
243
248
  );
244
249
  })
@@ -248,40 +253,40 @@ function Oe({
248
253
  staleTime: 6e4
249
254
  });
250
255
  function we(e, t) {
251
- var i;
256
+ var s;
252
257
  if (t == null || t === "")
253
258
  return /* @__PURE__ */ n("span", { className: "text-slate-300", children: "—" });
254
259
  const r = H.get(e.field);
255
260
  if (r != null && r.one_collection) {
256
- const s = (i = he[r.one_collection]) == null ? void 0 : i[String(t)];
257
- return /* @__PURE__ */ n("span", { className: "block truncate", children: s ?? String(t) });
261
+ const i = (s = he[r.one_collection]) == null ? void 0 : s[String(t)];
262
+ return /* @__PURE__ */ n("span", { className: "block truncate", children: i ?? String(t) });
258
263
  }
259
264
  if (e.type === "boolean")
260
265
  return /* @__PURE__ */ n("span", { className: t ? "text-emerald-600" : "text-slate-400", children: t ? "Yes" : "No" });
261
266
  if (e.type === "datetime" || e.type === "date")
262
267
  try {
263
- return /* @__PURE__ */ n("span", { className: "block truncate", children: Ye(t) });
268
+ return /* @__PURE__ */ n("span", { className: "block truncate", children: Je(t) });
264
269
  } catch {
265
270
  }
266
271
  return /* @__PURE__ */ n("span", { className: "block truncate", children: String(t) });
267
272
  }
268
273
  const _e = g && Number(pe[g.cap_field]) || 0, ve = g ? N.reduce(
269
274
  (e, t) => {
270
- const r = o === t.key ? h : t.data;
275
+ const r = c === t.key ? h : t.data;
271
276
  return e + (Number(r[g.sum_field]) || 0);
272
277
  },
273
- o === "new" && Number(h[g.sum_field]) || 0
274
- ) : 0, ce = _e - ve;
275
- if (xe && !m || !c || !v && !m) return null;
276
- if (m && !J)
278
+ c === "new" && Number(h[g.sum_field]) || 0
279
+ ) : 0, ce = Ue(_e - ve);
280
+ if (xe && !m || !d || !v && !m) return null;
281
+ if (m && !A)
277
282
  return /* @__PURE__ */ p("p", { className: "rounded-md border border-slate-200 bg-slate-50 px-2 py-1.5 text-[11px] text-slate-400", children: [
278
- R(a),
283
+ R(l),
279
284
  " — available after this row is saved."
280
285
  ] });
281
286
  const qe = _ ? 0 : 1, B = E.length + qe;
282
287
  return /* @__PURE__ */ p("div", { className: "overflow-hidden rounded-md border border-slate-200", children: [
283
288
  /* @__PURE__ */ p("div", { className: "flex items-center gap-2 px-2 py-1 bg-slate-50 border-b border-slate-200", children: [
284
- /* @__PURE__ */ n("span", { className: "text-[10px] font-medium text-slate-400 uppercase tracking-wide", children: R(a) }),
289
+ /* @__PURE__ */ n("span", { className: "text-[10px] font-medium text-slate-400 uppercase tracking-wide", children: R(l) }),
285
290
  /* @__PURE__ */ n("span", { className: "rounded bg-slate-100 px-1.5 py-0.5 text-[10px] font-medium text-slate-500", children: N.length }),
286
291
  g && /* @__PURE__ */ p(
287
292
  "span",
@@ -292,7 +297,7 @@ function Oe({
292
297
  ),
293
298
  children: [
294
299
  "remaining: ",
295
- Je(ce)
300
+ Ae(ce)
296
301
  ]
297
302
  }
298
303
  )
@@ -312,8 +317,8 @@ function Oe({
312
317
  /* @__PURE__ */ p("tbody", { children: [
313
318
  Q && /* @__PURE__ */ n("tr", { children: /* @__PURE__ */ n("td", { colSpan: B, className: "px-2 py-3 text-center text-slate-400", children: /* @__PURE__ */ n(Pe, { className: "h-3.5 w-3.5 animate-spin inline" }) }) }),
314
319
  !Q && N.map(({ key: e, data: t }) => {
315
- const r = o === e, i = be === e;
316
- return /* @__PURE__ */ p(je, { children: [
320
+ const r = c === e, s = be === e;
321
+ return /* @__PURE__ */ p(ke, { children: [
317
322
  /* @__PURE__ */ p(
318
323
  "tr",
319
324
  {
@@ -324,49 +329,49 @@ function Oe({
324
329
  !r && !_ ? "cursor-pointer" : ""
325
330
  ),
326
331
  children: [
327
- E.map((s) => /* @__PURE__ */ n("td", { className: "px-2 py-1 align-top", children: r ? /* @__PURE__ */ n(
332
+ E.map((i) => /* @__PURE__ */ n("td", { className: "px-2 py-1 align-top", children: r ? /* @__PURE__ */ n(
328
333
  fe,
329
334
  {
330
- field: s,
331
- value: h[s.field] ?? null,
332
- onChange: (l) => ie(s.field, l),
335
+ field: i,
336
+ value: h[i.field] ?? null,
337
+ onChange: (a) => se(i.field, a),
333
338
  relations: S,
334
- collection: c,
339
+ collection: d,
335
340
  itemId: x != null ? e : "new"
336
341
  }
337
- ) : /* @__PURE__ */ n("div", { className: "py-0.5 overflow-hidden", children: we(s, t[s.field]) }) }, s.field)),
342
+ ) : /* @__PURE__ */ n("div", { className: "py-0.5 overflow-hidden", children: we(i, t[i.field]) }) }, i.field)),
338
343
  !_ && /* @__PURE__ */ n("td", { className: "px-1 py-1 align-middle", children: r ? /* @__PURE__ */ p("div", { className: "flex items-stretch gap-1", children: [
339
344
  /* @__PURE__ */ n(
340
345
  "button",
341
346
  {
342
347
  type: "button",
343
- disabled: I,
344
- onClick: (s) => {
345
- s.stopPropagation(), oe();
348
+ disabled: z,
349
+ onClick: (i) => {
350
+ i.stopPropagation(), oe();
346
351
  },
347
352
  className: "rounded px-2 h-7 bg-nvr-cyan text-white text-[10px] font-medium hover:brightness-110 disabled:opacity-50",
348
- children: I ? "…" : "Save"
353
+ children: z ? "…" : "Save"
349
354
  }
350
355
  ),
351
356
  /* @__PURE__ */ n(
352
357
  "button",
353
358
  {
354
359
  type: "button",
355
- onClick: (s) => {
356
- s.stopPropagation(), D();
360
+ onClick: (i) => {
361
+ i.stopPropagation(), D();
357
362
  },
358
363
  className: "rounded px-1.5 h-7 text-slate-400 hover:text-slate-700 text-[10px]",
359
364
  children: "✕"
360
365
  }
361
366
  )
362
- ] }) : i ? /* @__PURE__ */ p("div", { className: "flex items-center justify-end gap-1", children: [
367
+ ] }) : s ? /* @__PURE__ */ p("div", { className: "flex items-center justify-end gap-1", children: [
363
368
  /* @__PURE__ */ n("span", { className: "text-[10px] text-slate-400", children: "Delete?" }),
364
369
  /* @__PURE__ */ n(
365
370
  "button",
366
371
  {
367
372
  type: "button",
368
- onClick: (s) => {
369
- s.stopPropagation(), Ne(e);
373
+ onClick: (i) => {
374
+ i.stopPropagation(), Ne(e);
370
375
  },
371
376
  className: "rounded px-1.5 py-0.5 text-[10px] text-red-500 hover:text-red-700 border border-red-200 hover:border-red-400",
372
377
  children: "Yes"
@@ -376,8 +381,8 @@ function Oe({
376
381
  "button",
377
382
  {
378
383
  type: "button",
379
- onClick: (s) => {
380
- s.stopPropagation(), X(null), w(null);
384
+ onClick: (i) => {
385
+ i.stopPropagation(), X(null), w(null);
381
386
  },
382
387
  className: "rounded px-1.5 py-0.5 text-[10px] text-slate-400 hover:text-slate-700 border border-slate-200",
383
388
  children: "Cancel"
@@ -388,8 +393,8 @@ function Oe({
388
393
  "button",
389
394
  {
390
395
  type: "button",
391
- onClick: (s) => {
392
- s.stopPropagation(), le(e, t);
396
+ onClick: (i) => {
397
+ i.stopPropagation(), le(e, t);
393
398
  },
394
399
  className: "rounded p-0.5 text-slate-300 hover:text-nvr-cyan",
395
400
  children: /* @__PURE__ */ n(De, { className: "h-3 w-3" })
@@ -399,8 +404,8 @@ function Oe({
399
404
  "button",
400
405
  {
401
406
  type: "button",
402
- onClick: (s) => {
403
- s.stopPropagation(), X(e), w(null);
407
+ onClick: (i) => {
408
+ i.stopPropagation(), X(e), w(null);
404
409
  },
405
410
  className: "rounded p-0.5 text-slate-300 hover:text-red-500",
406
411
  children: /* @__PURE__ */ n(Ke, { className: "h-3 w-3" })
@@ -410,18 +415,18 @@ function Oe({
410
415
  ]
411
416
  }
412
417
  ),
413
- (r || i) && U && /* @__PURE__ */ n("tr", { className: "border-b border-slate-100 bg-red-50/50", children: /* @__PURE__ */ n("td", { colSpan: B, className: "px-2 py-1 text-[11px] text-red-600", children: U }) })
418
+ (r || s) && U && /* @__PURE__ */ n("tr", { className: "border-b border-slate-100 bg-red-50/50", children: /* @__PURE__ */ n("td", { colSpan: B, className: "px-2 py-1 text-[11px] text-red-600", children: U }) })
414
419
  ] }, e);
415
420
  }),
416
- o === "new" && /* @__PURE__ */ p("tr", { className: "border-b border-slate-100 bg-[#f0fbff] dark:bg-nvr-cyan/5", children: [
421
+ c === "new" && /* @__PURE__ */ p("tr", { className: "border-b border-slate-100 bg-[#f0fbff] dark:bg-nvr-cyan/5", children: [
417
422
  E.map((e) => /* @__PURE__ */ n("td", { className: "px-2 py-1 align-top", children: /* @__PURE__ */ n(
418
423
  fe,
419
424
  {
420
425
  field: e,
421
426
  value: h[e.field] ?? null,
422
- onChange: (t) => ie(e.field, t),
427
+ onChange: (t) => se(e.field, t),
423
428
  relations: S,
424
- collection: c,
429
+ collection: d,
425
430
  itemId: "new"
426
431
  }
427
432
  ) }, e.field)),
@@ -430,10 +435,10 @@ function Oe({
430
435
  "button",
431
436
  {
432
437
  type: "button",
433
- disabled: I,
438
+ disabled: z,
434
439
  onClick: oe,
435
440
  className: "rounded px-2 h-7 bg-nvr-cyan text-white text-[10px] font-medium hover:brightness-110 disabled:opacity-50",
436
- children: I ? "…" : "Add"
441
+ children: z ? "…" : "Add"
437
442
  }
438
443
  ),
439
444
  /* @__PURE__ */ n(
@@ -447,8 +452,8 @@ function Oe({
447
452
  )
448
453
  ] }) })
449
454
  ] }),
450
- o === "new" && U && /* @__PURE__ */ n("tr", { className: "border-b border-slate-100 bg-red-50/50", children: /* @__PURE__ */ n("td", { colSpan: B, className: "px-2 py-1 text-[11px] text-red-600", children: U }) }),
451
- !Q && N.length === 0 && o !== "new" && /* @__PURE__ */ n("tr", { children: /* @__PURE__ */ n(
455
+ c === "new" && U && /* @__PURE__ */ n("tr", { className: "border-b border-slate-100 bg-red-50/50", children: /* @__PURE__ */ n("td", { colSpan: B, className: "px-2 py-1 text-[11px] text-red-600", children: U }) }),
456
+ !Q && N.length === 0 && c !== "new" && /* @__PURE__ */ n("tr", { children: /* @__PURE__ */ n(
452
457
  "td",
453
458
  {
454
459
  colSpan: B,
@@ -458,7 +463,7 @@ function Oe({
458
463
  ) })
459
464
  ] })
460
465
  ] }),
461
- !_ && o !== "new" && /* @__PURE__ */ n("div", { className: "px-2 py-1 bg-slate-50/50 border-t border-slate-200", children: /* @__PURE__ */ n(
466
+ !_ && c !== "new" && /* @__PURE__ */ n("div", { className: "px-2 py-1 bg-slate-50/50 border-t border-slate-200", children: /* @__PURE__ */ n(
462
467
  "button",
463
468
  {
464
469
  type: "button",
@@ -470,5 +475,6 @@ function Oe({
470
475
  ] });
471
476
  }
472
477
  export {
473
- Oe as NestedRelationEditor
478
+ Ce as NestedRelationEditor,
479
+ Ue as roundCents
474
480
  };