@nivaro/react 0.3.111 → 0.3.112

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 (75) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +170 -2
  4. package/dist/index.js +745 -728
  5. package/dist/shared/components/CollectionBrowserView.js +3097 -2972
  6. package/dist/shared/components/CollectionImportBanner.js +135 -0
  7. package/dist/shared/components/ItemEditForm.js +2235 -2218
  8. package/dist/shared/components/JobsTray.js +54 -47
  9. package/dist/shared/components/ViewAsPersonButton.js +109 -0
  10. package/dist/shared/components/bulk/BulkFieldUpdate.js +228 -150
  11. package/dist/shared/components/bulk/BulkFieldUpdateButton.js +35 -41
  12. package/dist/shared/components/bulk/BulkLinksValue.js +91 -0
  13. package/dist/shared/components/bulk/bulk-field-options.js +20 -19
  14. package/dist/shared/components/bulk/bulk-update-preview.js +39 -0
  15. package/dist/shared/components/cbv/ColumnHeaderMenu.js +113 -0
  16. package/dist/shared/components/cbv/column-totals.js +66 -0
  17. package/dist/shared/components/collections-directory/CollectionHoverCard.js +108 -81
  18. package/dist/shared/components/collections-directory/CollectionRow.js +164 -148
  19. package/dist/shared/components/collections-directory/CollectionsDirectory.js +167 -166
  20. package/dist/shared/components/collections-directory/directory-data.js +70 -58
  21. package/dist/shared/components/imports/CollectionImportPanel.js +120 -118
  22. package/dist/shared/components/imports/DefinitionsPanel.js +24 -24
  23. package/dist/shared/components/imports/ImportDuplicatesNotice.js +65 -0
  24. package/dist/shared/components/item-edit/CatalogPickerField.js +631 -639
  25. package/dist/shared/components/item-edit/DuplicateNotice.js +168 -0
  26. package/dist/shared/components/item-edit/FieldRow.js +248 -246
  27. package/dist/shared/components/item-edit/InlineGridField.js +34 -33
  28. package/dist/shared/components/item-edit/InlineTableField.js +3064 -2882
  29. package/dist/shared/components/item-edit/MembershipSetField.js +165 -169
  30. package/dist/shared/components/item-edit/NestedRelationEditor.js +184 -189
  31. package/dist/shared/components/item-edit/PlanGrid.js +2 -1
  32. package/dist/shared/components/item-edit/QuickPickerDialog.js +35 -34
  33. package/dist/shared/components/item-edit/RecordLiveSync.js +32 -30
  34. package/dist/shared/components/item-edit/RelationCombobox.js +101 -100
  35. package/dist/shared/components/item-edit/RowHistorySheet.js +28 -27
  36. package/dist/shared/components/item-edit/SummaryPanel.js +133 -135
  37. package/dist/shared/components/item-edit/ViewAsRole.js +129 -52
  38. package/dist/shared/components/item-edit/grid-search.js +345 -0
  39. package/dist/shared/components/item-edit/render-stability.js +61 -54
  40. package/dist/shared/components/notifications/NotificationRulesEditor.js +25 -20
  41. package/dist/shared/components/ops-report/DigestSections.js +163 -144
  42. package/dist/shared/components/ops-report/drill.js +97 -97
  43. package/dist/shared/components/panels/AddendumLinesDiff.js +52 -51
  44. package/dist/shared/components/panels/AddendumPanel.js +92 -91
  45. package/dist/shared/components/panels/AsyncUserPicker.js +108 -0
  46. package/dist/shared/components/panels/CommentPanel.js +265 -252
  47. package/dist/shared/components/panels/OwnersSlot.js +47 -35
  48. package/dist/shared/components/panels/PipelineInsight.js +186 -0
  49. package/dist/shared/components/panels/PipelinePanel.js +1529 -1492
  50. package/dist/shared/components/panels/RecordIntegrityBanner.js +39 -38
  51. package/dist/shared/components/panels/RevisionsPanel.js +261 -260
  52. package/dist/shared/components/pipeline/FieldPicker.js +41 -40
  53. package/dist/shared/components/pipeline/OwnerMatrix.js +829 -700
  54. package/dist/shared/components/pipeline/OwnerRecordTrial.js +362 -0
  55. package/dist/shared/components/pipeline/PipelineEditorView.js +483 -467
  56. package/dist/shared/components/pipeline/PipelineStateOwners.js +65 -64
  57. package/dist/shared/components/pipeline/owner-matrix-draft.js +178 -0
  58. package/dist/shared/components/profile/MyDefaultsCard.js +36 -35
  59. package/dist/shared/components/profile/PersonHeader.js +29 -29
  60. package/dist/shared/components/profile/PersonProfile.js +30 -28
  61. package/dist/shared/components/profile/SlowScreensCard.js +286 -0
  62. package/dist/shared/components/queue/QueueWorklist.js +1090 -1071
  63. package/dist/shared/components/quick-filters/useQuickFilterEditing.js +45 -44
  64. package/dist/shared/components/support/TicketDetailSheet.js +25 -16
  65. package/dist/shared/components/support/TicketSlowScreens.js +32 -0
  66. package/dist/shared/lib/activity-sentence.js +224 -178
  67. package/dist/shared/lib/collection-import-banner.js +27 -0
  68. package/dist/shared/lib/crash-report.js +112 -0
  69. package/dist/shared/lib/export-runs.js +99 -0
  70. package/dist/shared/lib/jobs-tray.js +89 -67
  71. package/dist/shared/lib/list-link.js +76 -69
  72. package/dist/shared/lib/nav-trail.js +180 -76
  73. package/dist/shared/lib/query-keys.js +26 -0
  74. package/dist/shared/lib/view-as.js +16 -11
  75. package/package.json +1 -1
@@ -108,7 +108,8 @@ function dl(k) {
108
108
  many_field: h,
109
109
  parent_id: f
110
110
  })
111
- ).then((e) => e.data ?? {}),
111
+ ).then((e) => ({ data: e.data ?? {}, created: e.created ?? {} })),
112
+ select: (e) => (e == null ? void 0 : e.data) ?? {},
112
113
  enabled: F && x && !s && q.length > 0,
113
114
  staleTime: 6e4,
114
115
  placeholderData: (e) => e
@@ -3,12 +3,13 @@ import { useQuery as _ } from "@tanstack/react-query";
3
3
  import { useState as N, useMemo as b, useCallback as F } from "react";
4
4
  import { useNivaroClient as D } from "../../context.js";
5
5
  import { get as P, getActiveLayout as T } from "../../lib/commands.js";
6
- import { titleCase as I } from "../../lib/utils.js";
7
- import { Dialog as S, DialogContent as H, DialogHeader as J, DialogTitle as R } from "../ui/dialog.js";
8
- import { Popover as z, PopoverAnchor as B, PopoverContent as E } from "../ui/popover.js";
9
- import { QuickPicker as G } from "./QuickPicker.js";
10
- function U(n, l) {
11
- var c;
6
+ import { queryKeys as I } from "../../lib/query-keys.js";
7
+ import { titleCase as S } from "../../lib/utils.js";
8
+ import { Dialog as H, DialogContent as J, DialogHeader as R, DialogTitle as z } from "../ui/dialog.js";
9
+ import { Popover as B, PopoverAnchor as E, PopoverContent as G } from "../ui/popover.js";
10
+ import { QuickPicker as U } from "./QuickPicker.js";
11
+ function V(n, l) {
12
+ var f;
12
13
  const o = D(), { data: r, isLoading: h } = _({
13
14
  queryKey: ["active-layout", n ?? "", l ?? null, "new"],
14
15
  queryFn: () => o.request(
@@ -21,22 +22,22 @@ function U(n, l) {
21
22
  staleTime: 6e4
22
23
  });
23
24
  return { steps: b(() => {
24
- var f;
25
- const s = (f = r == null ? void 0 : r.layout) == null ? void 0 : f.quick_picker;
25
+ var c;
26
+ const s = (c = r == null ? void 0 : r.layout) == null ? void 0 : c.quick_picker;
26
27
  return Array.isArray(s) ? s.filter((d) => typeof d == "string") : [];
27
- }, [r]), layoutId: ((c = r == null ? void 0 : r.layout) == null ? void 0 : c.id) ?? null, loading: h };
28
+ }, [r]), layoutId: ((f = r == null ? void 0 : r.layout) == null ? void 0 : f.id) ?? null, loading: h };
28
29
  }
29
- function re({
30
+ function se({
30
31
  collection: n,
31
32
  layoutSlug: l,
32
33
  open: o,
33
34
  onOpenChange: r,
34
35
  onDone: h,
35
36
  noun: y = "record",
36
- anchorEl: c
37
+ anchorEl: f
37
38
  }) {
38
- const s = D(), { steps: f, layoutId: d } = U(o ? n : null, l), { data: a = [] } = _({
39
- queryKey: ["field-config", n, d],
39
+ const s = D(), { steps: c, layoutId: d } = V(o ? n : null, l), { data: a = [] } = _({
40
+ queryKey: I.fieldConfig(n, d),
40
41
  queryFn: () => s.request(
41
42
  P(`/field-config/${n}`, d ? { layout_id: String(d) } : {})
42
43
  ).then((e) => e.data ?? []),
@@ -47,10 +48,10 @@ function re({
47
48
  queryFn: () => s.request(P(`/data-model/relations/for/${n}`)).then((e) => e.data ?? []),
48
49
  enabled: o && !!n,
49
50
  staleTime: 3e5
50
- }), [x, q] = N({}), [k, C] = N({}), L = b(
51
- () => Object.fromEntries(a.map((e) => [e.field, e.label || I(e.field)])),
51
+ }), [x, q] = N({}), [k, C] = N({}), K = b(
52
+ () => Object.fromEntries(a.map((e) => [e.field, e.label || S(e.field)])),
52
53
  [a]
53
- ), M = b(() => {
54
+ ), L = b(() => {
54
55
  const e = {};
55
56
  for (const t of a)
56
57
  try {
@@ -59,7 +60,7 @@ function re({
59
60
  } catch {
60
61
  }
61
62
  return e;
62
- }, [a]), $ = F(
63
+ }, [a]), M = F(
63
64
  (e) => {
64
65
  var v;
65
66
  const t = u.find(
@@ -70,37 +71,37 @@ function re({
70
71
  return t.one_field ?? `${t.many_collection}.${i ?? ""}`;
71
72
  },
72
73
  [u, n]
73
- ), A = F((e) => k[e] ?? [], [k]), w = () => {
74
+ ), $ = F((e) => k[e] ?? [], [k]), w = () => {
74
75
  q({}), C({});
75
- }, K = () => {
76
+ }, A = () => {
76
77
  const e = {};
77
78
  for (const [t, i] of Object.entries(k))
78
- i.length && (e[$(t)] = i);
79
+ i.length && (e[M(t)] = i);
79
80
  h({ ...x, ...Object.keys(e).length ? { __links: e } : {} }), w();
80
- }, O = /* @__PURE__ */ p(Q, { children: f.length > 0 && a.length > 0 && u.length > 0 && /* @__PURE__ */ p(
81
- G,
81
+ }, O = /* @__PURE__ */ p(Q, { children: c.length > 0 && a.length > 0 && u.length > 0 && /* @__PURE__ */ p(
82
+ U,
82
83
  {
83
84
  collection: n,
84
85
  itemId: "new",
85
- steps: f,
86
+ steps: c,
86
87
  fieldConfig: a,
87
88
  relations: u,
88
89
  draft: x,
89
- getM2M: A,
90
+ getM2M: $,
90
91
  onChange: (e, t) => q((i) => ({ ...i, [e]: t })),
91
92
  onM2MChange: (e, t) => C((i) => ({ ...i, [e]: t })),
92
- fieldLabels: L,
93
- fieldOptionFilters: M,
94
- onFinish: K,
93
+ fieldLabels: K,
94
+ fieldOptionFilters: L,
95
+ onFinish: A,
95
96
  finishLabel: `Create ${y}`
96
97
  }
97
98
  ) }), j = (e) => {
98
99
  e || w(), r(e);
99
100
  };
100
- return c ? /* @__PURE__ */ g(z, { open: o, onOpenChange: j, children: [
101
- /* @__PURE__ */ p(B, { virtualRef: { current: c } }),
101
+ return f ? /* @__PURE__ */ g(B, { open: o, onOpenChange: j, children: [
102
+ /* @__PURE__ */ p(E, { virtualRef: { current: f } }),
102
103
  /* @__PURE__ */ g(
103
- E,
104
+ G,
104
105
  {
105
106
  align: "end",
106
107
  sideOffset: 6,
@@ -115,8 +116,8 @@ function re({
115
116
  ]
116
117
  }
117
118
  )
118
- ] }) : /* @__PURE__ */ p(S, { open: o, onOpenChange: j, children: /* @__PURE__ */ g(H, { className: "max-w-[540px]", "data-quick-picker-dialog": !0, children: [
119
- /* @__PURE__ */ p(J, { children: /* @__PURE__ */ g(R, { className: "text-[15px]", children: [
119
+ ] }) : /* @__PURE__ */ p(H, { open: o, onOpenChange: j, children: /* @__PURE__ */ g(J, { className: "max-w-[540px]", "data-quick-picker-dialog": !0, children: [
120
+ /* @__PURE__ */ p(R, { children: /* @__PURE__ */ g(z, { className: "text-[15px]", children: [
120
121
  "New ",
121
122
  y
122
123
  ] }) }),
@@ -124,6 +125,6 @@ function re({
124
125
  ] }) });
125
126
  }
126
127
  export {
127
- re as QuickPickerDialog,
128
- U as useQuickPickerSteps
128
+ se as QuickPickerDialog,
129
+ V as useQuickPickerSteps
129
130
  };
@@ -10,8 +10,9 @@ import { useOptionalRealtime as Ne } from "../../lib/realtime.js";
10
10
  import { useRecordTabsSignal as Re, useRecordTabs as Te } from "../../lib/record-tabs.js";
11
11
  import { userErrorMessage as _e } from "../../lib/safe-error.js";
12
12
  import { formatRelative as $e } from "../../lib/utils.js";
13
- import { markLiveRecordWrite as Ke } from "./live-record-marks.js";
14
- function Ee(e, r, u) {
13
+ import { CollectionImportBanner as Ke } from "../CollectionImportBanner.js";
14
+ import { markLiveRecordWrite as Ee } from "./live-record-marks.js";
15
+ function De(e, r, u) {
15
16
  var p;
16
17
  if (u.active)
17
18
  return { text: e ? `${e} moved this to ${r}` : `This record moved to ${r}` };
@@ -21,11 +22,11 @@ function Ee(e, r, u) {
21
22
  open: u.open
22
23
  };
23
24
  }
24
- function De(e, r) {
25
+ function Qe(e, r) {
25
26
  const u = e == null ? void 0 : e.user_id;
26
27
  return typeof u == "string" && !!r && u.toUpperCase() === String(r).toUpperCase();
27
28
  }
28
- const Qe = 8e3, te = [
29
+ const qe = 8e3, te = [
29
30
  "item",
30
31
  "rrv-record",
31
32
  "revisions",
@@ -48,13 +49,13 @@ const Qe = 8e3, te = [
48
49
  "item-actions",
49
50
  "ext-item-actions"
50
51
  ];
51
- function qe(e, r, u) {
52
+ function Ce(e, r, u) {
52
53
  const f = new Set(te), p = String(u);
53
54
  e.removeQueries({
54
55
  predicate: (c) => f.has(c.queryKey[0]) && c.queryKey[1] === r && String(c.queryKey[2]) === p
55
56
  });
56
57
  }
57
- function Ge(e, r, u) {
58
+ function Xe(e, r, u) {
58
59
  if (!r || u.length === 0) return;
59
60
  const f = new Set(te), p = new Set(u.map(String));
60
61
  e.invalidateQueries({
@@ -95,27 +96,27 @@ const Ae = (e) => {
95
96
  var r;
96
97
  return (e == null ? void 0 : e.status) ?? ((r = e == null ? void 0 : e.response) == null ? void 0 : r.status);
97
98
  };
98
- function Je({
99
+ function Ze({
99
100
  collection: e,
100
101
  itemId: r,
101
102
  dirty: u = !1,
102
103
  loadDenied: f = !1,
103
104
  onGoneChange: p
104
105
  }) {
105
- const c = Ne(), T = ve(), b = ce(), [D, j] = w(!1), [Q, se] = w([]), [i, ae] = w(null), [ne, q] = w({}), [B, F] = w(!1), [P, Y] = w(!1), S = v(null), N = v(null), _ = v(Date.now()), L = v(null), $ = v(p);
106
+ const c = Ne(), T = ve(), b = ce(), [D, B] = w(!1), [Q, se] = w([]), [i, ae] = w(null), [ne, q] = w({}), [j, F] = w(!1), [P, Y] = w(!1), S = v(null), N = v(null), _ = v(Date.now()), C = v(null), $ = v(p);
106
107
  $.current = p;
107
108
  const x = v(null), W = ye(), H = v(W);
108
109
  H.current = W;
109
110
  const R = (s) => {
110
111
  var t;
111
- x.current = s, ae(s), (t = $.current) == null || t.call($, s), (s == null ? void 0 : s.kind) === "access" && setTimeout(() => qe(b, e, r), 0);
112
+ x.current = s, ae(s), (t = $.current) == null || t.call($, s), (s == null ? void 0 : s.kind) === "access" && setTimeout(() => Ce(b, e, r), 0);
112
113
  };
113
114
  k(() => {
114
- _.current = Date.now(), L.current = null, q({}), x.current && R(null);
115
+ _.current = Date.now(), C.current = null, q({}), x.current && R(null);
115
116
  }, [e, r]);
116
117
  const l = (s) => {
117
118
  for (const t of s) b.invalidateQueries({ queryKey: t });
118
- }, A = async (s) => {
119
+ }, L = async (s) => {
119
120
  let t = null;
120
121
  try {
121
122
  t = (await T.request(
@@ -138,8 +139,8 @@ function Je({
138
139
  const t = (await T.request(
139
140
  U(`/pipelines/instance/${e}/${r}`)
140
141
  )).data, o = (s = t == null ? void 0 : t.history) == null ? void 0 : s[0];
141
- if (!o || o.id === L.current || o.timestamp && new Date(o.timestamp).getTime() < _.current - 5e3 || (L.current = o.id, typeof document < "u" && document.visibilityState === "hidden")) return;
142
- const h = [o.first_name, o.last_name].filter(Boolean).join(" ") || o.user_email || null, n = o.to_state_label ?? "a new state", a = Ee(h, n, H.current);
142
+ if (!o || o.id === C.current || o.timestamp && new Date(o.timestamp).getTime() < _.current - 5e3 || (C.current = o.id, typeof document < "u" && document.visibilityState === "hidden")) return;
143
+ const h = [o.first_name, o.last_name].filter(Boolean).join(" ") || o.user_email || null, n = o.to_state_label ?? "a new state", a = De(h, n, H.current);
143
144
  O.info(
144
145
  a.text,
145
146
  a.open ? { action: { label: "Open", onClick: a.open } } : {}
@@ -149,11 +150,11 @@ function Je({
149
150
  }, ie = (s) => {
150
151
  var o, h;
151
152
  if (s.deleted) {
152
- A("deleted");
153
+ L("deleted");
153
154
  return;
154
155
  }
155
156
  if (x.current) return;
156
- s.events.some((n) => n.source === "import" && !n.own) && (Y(!0), S.current && clearTimeout(S.current), S.current = setTimeout(() => Y(!1), Qe));
157
+ s.events.some((n) => n.source === "import" && !n.own) && (Y(!0), S.current && clearTimeout(S.current), S.current = setTimeout(() => Y(!1), qe));
157
158
  const t = (n) => Se(s, n);
158
159
  if (t(y.state) && (l([
159
160
  ["pipeline-instance", e, r],
@@ -179,7 +180,7 @@ function Je({
179
180
  }
180
181
  b.invalidateQueries({
181
182
  predicate: (n) => n.queryKey[0] === "o2m-rows" && String(n.queryKey[3]) === String(r) || n.queryKey[0] === "o2m-compare"
182
- }), Ke(
183
+ }), Ee(
183
184
  e,
184
185
  r,
185
186
  ((h = s.changedFields) == null ? void 0 : h.filter((n) => !n.startsWith("$"))) ?? null
@@ -195,7 +196,7 @@ function Je({
195
196
  ]);
196
197
  const t = ["last-touch", e, String(r)];
197
198
  await b.invalidateQueries({ queryKey: t }).catch(() => {
198
- }), !(!s || De(b.getQueryData(t), z.current)) && (j(!0), N.current && clearTimeout(N.current), N.current = setTimeout(() => j(!1), 4e3));
199
+ }), !(!s || Qe(b.getQueryData(t), z.current)) && (B(!0), N.current && clearTimeout(N.current), N.current = setTimeout(() => B(!1), 4e3));
199
200
  };
200
201
  ke(e, r, ie);
201
202
  const { userId: K } = xe(), z = v(K);
@@ -262,7 +263,7 @@ function Je({
262
263
  ((t = x.current) == null ? void 0 : t.kind) === "access" && (R(null), l([["item", e, r]]));
263
264
  }).catch((t) => {
264
265
  const o = Ae(t);
265
- (o === 403 || o === 404) && A("access");
266
+ (o === 403 || o === 404) && L("access");
266
267
  });
267
268
  },
268
269
  Math.floor(Math.random() * 1500)
@@ -270,7 +271,7 @@ function Je({
270
271
  },
271
272
  { debounceMs: 300 }
272
273
  ), k(() => {
273
- f && !x.current && A("access");
274
+ f && !x.current && L("access");
274
275
  }, [f]);
275
276
  const E = Te(e, r, u, K), [de, J] = w(!1);
276
277
  k(() => {
@@ -312,8 +313,8 @@ function Je({
312
313
  F(!1);
313
314
  }
314
315
  }
315
- }, C = Object.values(ne), X = E.otherDirty && !de && !u && !i;
316
- return !i && C.length === 0 && !X && !P && (!c || !D && Q.length === 0) ? null : /* @__PURE__ */ m("div", { className: "space-y-2", children: [
316
+ }, A = Object.values(ne), X = E.otherDirty && !de && !u && !i;
317
+ return !i && A.length === 0 && !X && !P && (!c || !D && Q.length === 0) ? null : /* @__PURE__ */ m("div", { className: "space-y-2", children: [
317
318
  (i == null ? void 0 : i.kind) === "deleted" && /* @__PURE__ */ m(
318
319
  "div",
319
320
  {
@@ -334,9 +335,9 @@ function Je({
334
335
  {
335
336
  type: "button",
336
337
  onClick: () => void ue(),
337
- disabled: B,
338
+ disabled: j,
338
339
  className: "h-7 shrink-0 rounded-md border border-rose-300 bg-white px-2.5 text-[11.5px] font-medium text-rose-700 hover:bg-rose-100 disabled:opacity-50 dark:border-rose-500/40 dark:bg-transparent dark:text-rose-300 dark:hover:bg-rose-500/10",
339
- children: B ? "Restoring…" : "Restore"
340
+ children: j ? "Restoring…" : "Restore"
340
341
  }
341
342
  )
342
343
  ]
@@ -388,7 +389,8 @@ function Je({
388
389
  ]
389
390
  }
390
391
  ),
391
- C.length > 0 && !i && /* @__PURE__ */ m(
392
+ !i && /* @__PURE__ */ d(Ke, { collection: e, scope: "record" }),
393
+ A.length > 0 && !i && /* @__PURE__ */ m(
392
394
  "div",
393
395
  {
394
396
  "data-record-automation": !0,
@@ -400,7 +402,7 @@ function Je({
400
402
  /* @__PURE__ */ d("span", { className: "font-semibold", children: "Automation is updating this record" }),
401
403
  " —",
402
404
  " ",
403
- C.join(", "),
405
+ A.join(", "),
404
406
  ". Its changes appear here when it finishes."
405
407
  ] })
406
408
  ]
@@ -431,9 +433,9 @@ function Je({
431
433
  export {
432
434
  te as RECORD_QUERY_HEADS,
433
435
  Le as RecordAccessLostPanel,
434
- Je as RecordLiveSync,
435
- Ge as invalidateRecordQueries,
436
- Ee as moveNotice,
437
- qe as purgeRecordQueries,
438
- De as writtenBySelf
436
+ Ze as RecordLiveSync,
437
+ Xe as invalidateRecordQueries,
438
+ De as moveNotice,
439
+ Ce as purgeRecordQueries,
440
+ Qe as writtenBySelf
439
441
  };