@nivaro/react 0.3.50 → 0.3.52

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 (29) hide show
  1. package/dist/hooks/useSessionRecorder.js +1 -1
  2. package/dist/index.d.ts +13 -3
  3. package/dist/shared/components/ItemEditForm.js +4801 -4666
  4. package/dist/shared/components/QueryTable.js +337 -324
  5. package/dist/shared/components/ReportView.js +105 -99
  6. package/dist/shared/components/alerts/AlertManagerView.js +327 -301
  7. package/dist/shared/components/item-edit/CatalogPickerField.js +1149 -1111
  8. package/dist/shared/components/item-edit/DraftRecoveryBanner.js +58 -53
  9. package/dist/shared/components/item-edit/FieldRenderer.js +227 -223
  10. package/dist/shared/components/item-edit/FieldRow.js +287 -265
  11. package/dist/shared/components/item-edit/FilePickerField.js +315 -307
  12. package/dist/shared/components/item-edit/InlineTableField.js +491 -466
  13. package/dist/shared/components/item-edit/RecordHeaderActions.js +76 -75
  14. package/dist/shared/components/item-edit/RecordLiveSync.js +93 -91
  15. package/dist/shared/components/item-edit/RelationCombobox.js +62 -60
  16. package/dist/shared/components/item-edit/SummaryPanel.js +287 -277
  17. package/dist/shared/components/item-edit/UserChip.js +233 -200
  18. package/dist/shared/components/item-edit/header-midair.js +51 -0
  19. package/dist/shared/components/item-edit/line-midair.js +76 -70
  20. package/dist/shared/components/panels/CommentPanel.js +290 -284
  21. package/dist/shared/components/panels/ItemLockBanner.js +30 -30
  22. package/dist/shared/components/panels/PipelinePanel.js +956 -901
  23. package/dist/shared/components/panels/TaskPanel.js +71 -61
  24. package/dist/shared/components/panels/TransitionRequirementsDialog.js +569 -439
  25. package/dist/shared/components/panels/requirement-side-effects.js +40 -0
  26. package/dist/shared/components/queue/QueueWorklist.js +141 -130
  27. package/dist/shared/lib/draft-store.js +48 -34
  28. package/dist/shared/lib/query-stats.js +60 -60
  29. package/package.json +1 -1
@@ -7,10 +7,10 @@ import { useNivaroClient as De, useItemEditAuth as Ye } from "../../context.js";
7
7
  import { post as A, get as Fe, del as B } from "../../lib/commands.js";
8
8
  import { idleState as ze } from "../../lib/idle.js";
9
9
  import { useOptionalRealtime as fe, updateTouches as Pe } from "../../lib/realtime.js";
10
- import { announceRecordTabs as W, useRecordTabsSignal as je } from "../../lib/record-tabs.js";
10
+ import { announceRecordTabs as J, useRecordTabsSignal as je } from "../../lib/record-tabs.js";
11
11
  import { Button as O } from "../ui/button.js";
12
12
  import { Popover as me, PopoverTrigger as he, PopoverContent as ke } from "../ui/popover.js";
13
- const J = 1e4, be = 1500, Be = 2e3, Ke = 5 * 6e4, Qe = 3e4, Ue = 6e4, Ve = 15e3, We = 1500;
13
+ const G = 1e4, be = 1500, Be = 2e3, Ke = 5 * 6e4, Qe = 3e4, Ue = 6e4, Ve = 15e3, We = 1500;
14
14
  function ve(e, t) {
15
15
  return e ? `${t ?? "Someone else"} took over editing — your changes are still here, but can’t be saved until they release it` : "Someone else started editing while you were away — your changes are still here, but can’t be saved until they release it";
16
16
  }
@@ -60,8 +60,8 @@ function Ge() {
60
60
  function lt(e, t, s, C = {}) {
61
61
  const { lazy: f = !1, active: T = !0, dirty: g } = C, _ = q(g);
62
62
  _.current = g;
63
- const x = L(() => f && _.current === !1, [f]), o = De(), { isAdmin: R, userId: c } = Ye(), b = Me(Oe), [M, S] = E(null), [G, p] = E(!1), [z, ae] = E(!1), [ye, ge] = E([]), [xe, P] = E(null), [we, se] = E(!1), [_e, oe] = E(""), [pe, X] = E(!1), [Le, ie] = E(!1), K = q(null), i = q(!1), I = q(!1), Z = q(!1), H = q(0), D = q(!1), j = q(null), Q = q(null), m = L(() => {
64
- K.current && (clearInterval(K.current), K.current = null);
63
+ const x = L(() => f && _.current === !1, [f]), o = De(), { isAdmin: R, userId: c } = Ye(), b = Me(Oe), [M, S] = E(null), [K, p] = E(!1), [z, ae] = E(!1), [ye, ge] = E([]), [xe, P] = E(null), [we, se] = E(!1), [_e, oe] = E(""), [pe, X] = E(!1), [Le, ie] = E(!1), Q = q(null), i = q(!1), I = q(!1), Z = q(!1), H = q(0), D = q(!1), j = q(null), U = q(null), m = L(() => {
64
+ Q.current && (clearInterval(Q.current), Q.current = null);
65
65
  }, []), ee = L(
66
66
  (a) => {
67
67
  var r, l;
@@ -72,11 +72,11 @@ function lt(e, t, s, C = {}) {
72
72
  ), h = L(async () => {
73
73
  var a, n;
74
74
  if (!e || !t || D.current) return !1;
75
- j.current = null, Q.current = null;
75
+ j.current = null, U.current = null;
76
76
  try {
77
77
  return await o.request(
78
- A(`/item-locks/${e}/${t}/lock`, { beat_ms: J })
79
- ), i.current = !0, p(!0), X(!1), S(null), m(), K.current = setInterval(() => {
78
+ A(`/item-locks/${e}/${t}/lock`, { beat_ms: G })
79
+ ), i.current = !0, p(!0), X(!1), S(null), m(), Q.current = setInterval(() => {
80
80
  const v = Math.max(
81
81
  0,
82
82
  Math.floor((Date.now() - new Date(ze().last_active).getTime()) / 1e3)
@@ -84,7 +84,7 @@ function lt(e, t, s, C = {}) {
84
84
  o.request(
85
85
  A(`/item-locks/${e}/${t}/heartbeat`, {
86
86
  idle_seconds: v,
87
- beat_ms: J
87
+ beat_ms: G
88
88
  })
89
89
  ).then((u) => {
90
90
  if (!(u != null && u.idle_released)) return;
@@ -115,10 +115,10 @@ function lt(e, t, s, C = {}) {
115
115
  N.taken_over === !1 ? ve(!1) : `${N.locked_by_name ?? "Another user"} took over editing — your changes are no longer being saved`
116
116
  ));
117
117
  });
118
- }, J), !0;
118
+ }, G), !0;
119
119
  } catch (v) {
120
120
  const u = v, r = u.status ?? ((a = u.response) == null ? void 0 : a.status), l = ((n = u.response) == null ? void 0 : n.data) ?? u.response;
121
- return j.current = r ?? null, Q.current = (l == null ? void 0 : l.taken_over) === !0 ? l.locked_by_name ?? "Someone else" : null, ee(v) ? !1 : r === 404 ? (D.current = !0, m(), i.current = !1, p(!1), !1) : (r === 409 && (l != null && l.locked_by) && (i.current = !1, p(!1), S({
121
+ return j.current = r ?? null, U.current = (l == null ? void 0 : l.taken_over) === !0 ? l.locked_by_name ?? "Someone else" : null, ee(v) ? !1 : r === 404 ? (D.current = !0, m(), i.current = !1, p(!1), !1) : (r === 409 && (l != null && l.locked_by) && (i.current = !1, p(!1), S({
122
122
  locked_by: l.locked_by,
123
123
  locked_by_name: l.locked_by_name ?? null,
124
124
  ...typeof l.may_take_over == "boolean" ? { may_take_over: l.may_take_over } : {}
@@ -162,7 +162,7 @@ function lt(e, t, s, C = {}) {
162
162
  }, [Y, w]), $(() => {
163
163
  if (!(!s || !e || !t))
164
164
  return I.current = !1, D.current = !1, f ? w() : h(), () => {
165
- m(), I.current = !1, i.current && (i.current = !1, o.request(B(`/item-locks/${e}/${t}/lock`)).then(() => W(c, "lock-released", e, t)).catch(() => {
165
+ m(), I.current = !1, i.current && (i.current = !1, o.request(B(`/item-locks/${e}/${t}/lock`)).then(() => J(c, "lock-released", e, t)).catch(() => {
166
166
  }));
167
167
  };
168
168
  }, [s, e, t, h, o, m, c, f, w]);
@@ -183,7 +183,7 @@ function lt(e, t, s, C = {}) {
183
183
  };
184
184
  return window.addEventListener("online", a), () => window.removeEventListener("online", a);
185
185
  }, []);
186
- const U = L(() => {
186
+ const V = L(() => {
187
187
  var a;
188
188
  if (!(!e || !t))
189
189
  try {
@@ -196,28 +196,28 @@ function lt(e, t, s, C = {}) {
196
196
  credentials: n ? "omit" : "include",
197
197
  headers: n ? { Authorization: `Bearer ${n}` } : {}
198
198
  }
199
- ).then(() => W(c, "lock-released", e, t)).catch(() => {
199
+ ).then(() => J(c, "lock-released", e, t)).catch(() => {
200
200
  });
201
201
  } catch {
202
202
  }
203
- }, [o, e, t, c]), te = Ge(), $e = Je(), V = T && te && $e;
203
+ }, [o, e, t, c]), te = Ge(), $e = Je(), W = T && te && $e;
204
204
  $(() => {
205
205
  if (!(!s || !e || !t)) {
206
- if (V) {
206
+ if (W) {
207
207
  if (I.current) {
208
208
  if (I.current = !1, x()) return;
209
209
  h().then((a) => {
210
- !a && j.current === 409 && d.warning(ve(Q.current != null, Q.current));
210
+ !a && j.current === 409 && d.warning(ve(U.current != null, U.current));
211
211
  });
212
212
  }
213
213
  return;
214
214
  }
215
- i.current && (m(), i.current = !1, p(!1), I.current = !0, te ? o.request(B(`/item-locks/${e}/${t}/lock`)).then(() => W(c, "lock-released", e, t)).catch(() => {
216
- }) : U());
215
+ i.current && (m(), i.current = !1, p(!1), I.current = !0, te ? o.request(B(`/item-locks/${e}/${t}/lock`)).then(() => J(c, "lock-released", e, t)).catch(() => {
216
+ }) : V());
217
217
  }
218
218
  }, [
219
219
  s,
220
- V,
220
+ W,
221
221
  te,
222
222
  e,
223
223
  t,
@@ -225,32 +225,32 @@ function lt(e, t, s, C = {}) {
225
225
  o,
226
226
  m,
227
227
  c,
228
- U,
228
+ V,
229
229
  x
230
230
  ]), $(() => {
231
- if (!s || !f || !e || !t || Y || !V) return;
231
+ if (!s || !f || !e || !t || Y || !W) return;
232
232
  const a = setInterval(() => {
233
233
  !i.current && !D.current && w();
234
234
  }, Ue);
235
235
  return () => clearInterval(a);
236
- }, [s, f, e, t, Y, V, w]), $(() => {
236
+ }, [s, f, e, t, Y, W, w]), $(() => {
237
237
  if (!s || !e || !t) return;
238
238
  const a = () => {
239
- i.current && (m(), i.current = !1, I.current = !0, U());
239
+ i.current && (m(), i.current = !1, I.current = !0, V());
240
240
  }, n = (v) => {
241
241
  v.persisted && I.current && (I.current = !1, x() || h());
242
242
  };
243
243
  return window.addEventListener("pagehide", a), window.addEventListener("pageshow", n), () => {
244
244
  window.removeEventListener("pagehide", a), window.removeEventListener("pageshow", n);
245
245
  };
246
- }, [s, e, t, m, h, U, x]), $(() => {
246
+ }, [s, e, t, m, h, V, x]), $(() => {
247
247
  if (!s || !f || !e || !t || g !== !1 || !i.current) return;
248
248
  const a = setTimeout(() => {
249
- _.current !== !1 || !i.current || (m(), i.current = !1, p(!1), o.request(B(`/item-locks/${e}/${t}/lock`)).then(() => W(c, "lock-released", e, t)).catch(() => {
249
+ _.current !== !1 || !i.current || (m(), i.current = !1, p(!1), o.request(B(`/item-locks/${e}/${t}/lock`)).then(() => J(c, "lock-released", e, t)).catch(() => {
250
250
  }));
251
251
  }, We);
252
252
  return () => clearTimeout(a);
253
- }, [s, f, e, t, g, o, m, c]), je(c, "lock-released", e, t, () => {
253
+ }, [s, f, e, t, g, K, o, m, c]), je(c, "lock-released", e, t, () => {
254
254
  s && i.current && h();
255
255
  });
256
256
  const re = fe();
@@ -375,7 +375,7 @@ function lt(e, t, s, C = {}) {
375
375
  ae(!0);
376
376
  try {
377
377
  await o.request(
378
- A(`/item-locks/${e}/${t}/lock/force`, { beat_ms: J })
378
+ A(`/item-locks/${e}/${t}/lock/force`, { beat_ms: G })
379
379
  ), d.success("You now hold the edit lock"), await h();
380
380
  } catch (n) {
381
381
  const v = ((a = n == null ? void 0 : n.response) == null ? void 0 : a.error) ?? "Failed to take over the lock";
@@ -387,7 +387,7 @@ function lt(e, t, s, C = {}) {
387
387
  }, [o, e, t, h]);
388
388
  return {
389
389
  lockHolder: M,
390
- acquired: G,
390
+ acquired: K,
391
391
  isReadOnly: !!M,
392
392
  takeOver: Ae,
393
393
  takingOver: z,
@@ -527,8 +527,8 @@ function dt({
527
527
  noun: c = "this item",
528
528
  readOnlyText: b = "fields are read-only"
529
529
  }) {
530
- const [M, S] = E(!1), G = (e == null ? void 0 : e.locked_by) ?? null;
531
- if ($(() => S(!1), [G]), !e) return null;
530
+ const [M, S] = E(!1), K = (e == null ? void 0 : e.locked_by) ?? null;
531
+ if ($(() => S(!1), [K]), !e) return null;
532
532
  const p = e.locked_by_name || "Another user", z = (g == null ? void 0 : g.length) ?? 0;
533
533
  return /* @__PURE__ */ y(
534
534
  "div",