@nivaro/react 0.3.13 → 0.3.14

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 (48) hide show
  1. package/dist/components/slots/pipeline/OwnersSection.js +79 -75
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useSessionRecorder.js +1 -1
  4. package/dist/index.d.ts +33 -2
  5. package/dist/index.js +520 -516
  6. package/dist/shared/components/CollectionBrowserView.js +2373 -2298
  7. package/dist/shared/components/DataTable.js +347 -335
  8. package/dist/shared/components/ItemEditForm.js +5278 -5149
  9. package/dist/shared/components/ListLoadError.js +33 -0
  10. package/dist/shared/components/PageRenderer.js +562 -529
  11. package/dist/shared/components/ProfileView.js +53 -51
  12. package/dist/shared/components/RecordReadView.js +119 -117
  13. package/dist/shared/components/ReportView.js +1268 -1241
  14. package/dist/shared/components/cbv/export-rows.js +69 -0
  15. package/dist/shared/components/cbv/saved-view-risk.js +35 -0
  16. package/dist/shared/components/cbv/unknown-fields.js +18 -0
  17. package/dist/shared/components/integrations/console/AlertsView.js +27 -25
  18. package/dist/shared/components/integrations/console/EventsView.js +244 -209
  19. package/dist/shared/components/item-edit/CatalogPickerField.js +946 -878
  20. package/dist/shared/components/item-edit/DraftRecoveryBanner.js +84 -57
  21. package/dist/shared/components/item-edit/FieldAffordances.js +63 -61
  22. package/dist/shared/components/item-edit/FieldRow.js +195 -179
  23. package/dist/shared/components/item-edit/FilePickerField.js +257 -254
  24. package/dist/shared/components/item-edit/HeaderTools.js +139 -95
  25. package/dist/shared/components/item-edit/InlineTableField.js +2087 -2075
  26. package/dist/shared/components/item-edit/RowComments.js +1 -3
  27. package/dist/shared/components/item-edit/SummaryPanel.js +62 -62
  28. package/dist/shared/components/item-edit/UserChip.js +113 -113
  29. package/dist/shared/components/item-edit/file-download.js +18 -0
  30. package/dist/shared/components/item-edit/line-qty.js +67 -32
  31. package/dist/shared/components/item-edit/save-refusal.js +23 -0
  32. package/dist/shared/components/monitoring/TrafficMiniMap.js +9 -9
  33. package/dist/shared/components/panels/CommentPanel.js +30 -30
  34. package/dist/shared/components/panels/ItemLockBanner.js +207 -185
  35. package/dist/shared/components/panels/PipelinePanel.js +915 -786
  36. package/dist/shared/components/pipeline/PipelineEditorView.js +45 -25
  37. package/dist/shared/components/profile/DelegationCard.js +1 -1
  38. package/dist/shared/components/profile/session-actions.js +24 -24
  39. package/dist/shared/components/queue/QueueItemSheet.js +18 -18
  40. package/dist/shared/components/queue/QueueWorklist.js +517 -504
  41. package/dist/shared/components/ui/dropdown-menu.js +8 -7
  42. package/dist/shared/lib/draft-store.js +60 -33
  43. package/dist/shared/lib/leave-guard.js +38 -0
  44. package/dist/shared/lib/load-error.js +38 -17
  45. package/dist/shared/lib/summary-mode.js +25 -25
  46. package/dist/shared/lib/table-pins.js +23 -0
  47. package/dist/shared/lib/validation-rules.js +55 -51
  48. package/package.json +1 -1
@@ -1,70 +1,73 @@
1
- import { jsxs as n, jsx as t } from "react/jsx-runtime";
2
- import { useState as i, useRef as R, useEffect as y, useCallback as $ } from "react";
3
- import { get as L, del as q, post as M } from "../../../lib/commands.js";
4
- import { initials as W } from "./HistoryTimeline.js";
5
- function N({
1
+ import { jsxs as t, jsx as n } from "react/jsx-runtime";
2
+ import { useState as a, useRef as E, useEffect as g, useCallback as W } from "react";
3
+ import { get as _, del as F, post as H } from "../../../lib/commands.js";
4
+ import { initials as U } from "./HistoryTimeline.js";
5
+ import { userErrorMessage as N } from "../../../shared/lib/safe-error.js";
6
+ function K({
6
7
  collection: l,
7
8
  itemId: u,
8
9
  states: c,
9
10
  client: r
10
11
  }) {
11
- const [f, g] = i([]), [j, S] = i([]), [k, _] = i(!0), [b, h] = i(!1), [o, p] = i(""), [x, w] = i(""), [v, C] = i(!1), a = R(!0);
12
- y(() => (a.current = !0, () => {
13
- a.current = !1;
12
+ const [f, k] = a([]), [j, S] = a([]), [b, B] = a(!0), [x, h] = a(!1), [o, p] = a(""), [C, w] = a(""), [m, A] = a(!1), [O, M] = a(!1), [L, v] = a(null), i = E(!0);
13
+ g(() => (i.current = !0, () => {
14
+ i.current = !1;
14
15
  }), []);
15
- const s = $(async () => {
16
+ const s = W(async () => {
17
+ var e;
16
18
  if (r)
17
19
  try {
18
- const e = await r.request(
19
- L(`/pipelines/instance/${l}/${u}/owners`)
20
+ const d = await r.request(
21
+ _(`/pipelines/instance/${l}/${u}/owners`)
20
22
  );
21
- a.current && g(e.data ?? []);
23
+ i.current && (k(d.data ?? []), M(((e = d.meta) == null ? void 0 : e.can_add) === !0));
22
24
  } catch {
23
- a.current && g([]);
25
+ i.current && k([]);
24
26
  } finally {
25
- a.current && _(!1);
27
+ i.current && B(!1);
26
28
  }
27
29
  }, [r, l, u]);
28
- y(() => {
30
+ g(() => {
29
31
  s();
30
- }, [s]), y(() => {
31
- r && r.request(L("/users", { limit: 200, sort: "first_name" })).then((e) => {
32
- a.current && S(e.data ?? []);
32
+ }, [s]), g(() => {
33
+ r && r.request(_("/users", { limit: 200, sort: "first_name" })).then((e) => {
34
+ i.current && S(e.data ?? []);
33
35
  }).catch(() => {
34
36
  });
35
37
  }, [r]);
36
- const B = (e) => {
38
+ const R = (e) => {
37
39
  if (!e) return null;
38
- const d = c.find((m) => m.id === e) ?? c.find((m) => m.key === e);
40
+ const d = c.find((y) => y.id === e) ?? c.find((y) => y.key === e);
39
41
  return (d == null ? void 0 : d.label) ?? e;
40
42
  };
41
- async function O() {
42
- if (!(!r || !o || v)) {
43
- C(!0);
43
+ async function $() {
44
+ if (!(!r || !o || m)) {
45
+ A(!0), v(null);
44
46
  try {
45
47
  await r.request(
46
- M(`/pipelines/instance/${l}/${u}/owners`, {
48
+ H(`/pipelines/instance/${l}/${u}/owners`, {
47
49
  user: o,
48
- state: x || void 0
50
+ state: C || void 0
49
51
  })
50
52
  ), h(!1), p(""), w(""), await s();
51
- } catch {
53
+ } catch (e) {
54
+ i.current && v(N(e, "Failed to add owner"));
52
55
  } finally {
53
- a.current && C(!1);
56
+ i.current && A(!1);
54
57
  }
55
58
  }
56
59
  }
57
- async function A(e) {
60
+ async function q(e) {
58
61
  if (r)
59
62
  try {
60
- await r.request(q(`/pipelines/instance-owners/${e}`)), await s();
63
+ await r.request(F(`/pipelines/instance-owners/${e}`)), await s();
61
64
  } catch {
62
65
  }
63
66
  }
64
- return /* @__PURE__ */ n("div", { "data-nf-owners-section": !0, children: [
65
- /* @__PURE__ */ n("div", { "data-nf-owners-header": !0, children: [
66
- /* @__PURE__ */ n("span", { "data-nf-owners-title": !0, children: [
67
- /* @__PURE__ */ n(
67
+ return /* @__PURE__ */ t("div", { "data-nf-owners-section": !0, children: [
68
+ /* @__PURE__ */ t("div", { "data-nf-owners-header": !0, children: [
69
+ /* @__PURE__ */ t("span", { "data-nf-owners-title": !0, children: [
70
+ /* @__PURE__ */ t(
68
71
  "svg",
69
72
  {
70
73
  "aria-hidden": "true",
@@ -77,22 +80,22 @@ function N({
77
80
  strokeLinecap: "round",
78
81
  strokeLinejoin: "round",
79
82
  children: [
80
- /* @__PURE__ */ t("path", { d: "M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2" }),
81
- /* @__PURE__ */ t("circle", { cx: "9", cy: "7", r: "4" }),
82
- /* @__PURE__ */ t("path", { d: "M23 21v-2a4 4 0 0 0-3-3.87" }),
83
- /* @__PURE__ */ t("path", { d: "M16 3.13a4 4 0 0 1 0 7.75" })
83
+ /* @__PURE__ */ n("path", { d: "M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2" }),
84
+ /* @__PURE__ */ n("circle", { cx: "9", cy: "7", r: "4" }),
85
+ /* @__PURE__ */ n("path", { d: "M23 21v-2a4 4 0 0 0-3-3.87" }),
86
+ /* @__PURE__ */ n("path", { d: "M16 3.13a4 4 0 0 1 0 7.75" })
84
87
  ]
85
88
  }
86
89
  ),
87
90
  "Owners",
88
- k ? /* @__PURE__ */ t("span", { "data-nf-skeleton": !0, style: { display: "inline-block", width: 16, height: 10 } }) : /* @__PURE__ */ n("span", { "data-nf-owners-count": !0, children: [
91
+ b ? /* @__PURE__ */ n("span", { "data-nf-skeleton": !0, style: { display: "inline-block", width: 16, height: 10 } }) : /* @__PURE__ */ t("span", { "data-nf-owners-count": !0, children: [
89
92
  "(",
90
93
  f.length,
91
94
  ")"
92
95
  ] })
93
96
  ] }),
94
- !b && /* @__PURE__ */ n("button", { type: "button", "data-nf-owners-add-btn": !0, onClick: () => h(!0), children: [
95
- /* @__PURE__ */ n(
97
+ !x && O && /* @__PURE__ */ t("button", { type: "button", "data-nf-owners-add-btn": !0, onClick: () => h(!0), children: [
98
+ /* @__PURE__ */ t(
96
99
  "svg",
97
100
  {
98
101
  "aria-hidden": "true",
@@ -105,47 +108,47 @@ function N({
105
108
  strokeLinecap: "round",
106
109
  strokeLinejoin: "round",
107
110
  children: [
108
- /* @__PURE__ */ t("path", { d: "M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2" }),
109
- /* @__PURE__ */ t("circle", { cx: "8.5", cy: "7", r: "4" }),
110
- /* @__PURE__ */ t("line", { x1: "20", y1: "8", x2: "20", y2: "14" }),
111
- /* @__PURE__ */ t("line", { x1: "23", y1: "11", x2: "17", y2: "11" })
111
+ /* @__PURE__ */ n("path", { d: "M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2" }),
112
+ /* @__PURE__ */ n("circle", { cx: "8.5", cy: "7", r: "4" }),
113
+ /* @__PURE__ */ n("line", { x1: "20", y1: "8", x2: "20", y2: "14" }),
114
+ /* @__PURE__ */ n("line", { x1: "23", y1: "11", x2: "17", y2: "11" })
112
115
  ]
113
116
  }
114
117
  ),
115
118
  "Add"
116
119
  ] })
117
120
  ] }),
118
- k ? /* @__PURE__ */ n("div", { "data-nf-owners-loading": !0, children: [
119
- /* @__PURE__ */ t(
121
+ b ? /* @__PURE__ */ t("div", { "data-nf-owners-loading": !0, children: [
122
+ /* @__PURE__ */ n(
120
123
  "span",
121
124
  {
122
125
  "data-nf-skeleton": !0,
123
126
  style: { height: 28, display: "block", borderRadius: 6, marginBottom: 6 }
124
127
  }
125
128
  ),
126
- /* @__PURE__ */ t(
129
+ /* @__PURE__ */ n(
127
130
  "span",
128
131
  {
129
132
  "data-nf-skeleton": !0,
130
133
  style: { height: 28, width: "75%", display: "block", borderRadius: 6 }
131
134
  }
132
135
  )
133
- ] }) : f.length === 0 ? /* @__PURE__ */ t("p", { "data-nf-empty": !0, children: "No owners assigned." }) : /* @__PURE__ */ t("div", { "data-nf-owner-list": !0, children: f.map((e) => /* @__PURE__ */ n("div", { "data-nf-owner-row": !0, children: [
134
- /* @__PURE__ */ t("span", { "data-nf-owner-avatar": !0, children: W(e.first_name, e.last_name, e.email) }),
135
- /* @__PURE__ */ n("div", { "data-nf-owner-info": !0, children: [
136
- /* @__PURE__ */ t("span", { "data-nf-owner-name": !0, children: [e.first_name, e.last_name].filter(Boolean).join(" ") || e.email }),
137
- /* @__PURE__ */ t("span", { "data-nf-owner-email": !0, children: e.email })
136
+ ] }) : f.length === 0 ? /* @__PURE__ */ n("p", { "data-nf-empty": !0, children: "No owners assigned." }) : /* @__PURE__ */ n("div", { "data-nf-owner-list": !0, children: f.map((e) => /* @__PURE__ */ t("div", { "data-nf-owner-row": !0, children: [
137
+ /* @__PURE__ */ n("span", { "data-nf-owner-avatar": !0, children: U(e.first_name, e.last_name, e.email) }),
138
+ /* @__PURE__ */ t("div", { "data-nf-owner-info": !0, children: [
139
+ /* @__PURE__ */ n("span", { "data-nf-owner-name": !0, children: [e.first_name, e.last_name].filter(Boolean).join(" ") || e.email }),
140
+ /* @__PURE__ */ n("span", { "data-nf-owner-email": !0, children: e.email })
138
141
  ] }),
139
- /* @__PURE__ */ t("span", { "data-nf-owner-scope": !0, children: e.state ? B(e.state) : "all states" }),
140
- /* @__PURE__ */ t(
142
+ /* @__PURE__ */ n("span", { "data-nf-owner-scope": !0, children: e.state ? R(e.state) : "all states" }),
143
+ /* @__PURE__ */ n(
141
144
  "button",
142
145
  {
143
146
  type: "button",
144
147
  "data-nf-icon-btn": !0,
145
148
  "data-nf-icon-btn-danger": !0,
146
149
  title: "Remove",
147
- onClick: () => void A(e.id),
148
- children: /* @__PURE__ */ n(
150
+ onClick: () => void q(e.id),
151
+ children: /* @__PURE__ */ t(
149
152
  "svg",
150
153
  {
151
154
  "aria-hidden": "true",
@@ -158,55 +161,56 @@ function N({
158
161
  strokeLinecap: "round",
159
162
  strokeLinejoin: "round",
160
163
  children: [
161
- /* @__PURE__ */ t("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
162
- /* @__PURE__ */ t("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
164
+ /* @__PURE__ */ n("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
165
+ /* @__PURE__ */ n("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
163
166
  ]
164
167
  }
165
168
  )
166
169
  }
167
170
  )
168
171
  ] }, e.id)) }),
169
- b && /* @__PURE__ */ n("div", { "data-nf-owners-form": !0, children: [
170
- /* @__PURE__ */ t("p", { "data-nf-owners-form-title": !0, children: "Add owner" }),
171
- /* @__PURE__ */ n("select", { value: o, onChange: (e) => p(e.target.value), "data-nf-task-input": !0, children: [
172
- /* @__PURE__ */ t("option", { value: "", children: "Select a user…" }),
172
+ x && /* @__PURE__ */ t("div", { "data-nf-owners-form": !0, children: [
173
+ /* @__PURE__ */ n("p", { "data-nf-owners-form-title": !0, children: "Add owner" }),
174
+ /* @__PURE__ */ t("select", { value: o, onChange: (e) => p(e.target.value), "data-nf-task-input": !0, children: [
175
+ /* @__PURE__ */ n("option", { value: "", children: "Select a user…" }),
173
176
  j.map((e) => {
174
177
  const d = [e.first_name, e.last_name].filter(Boolean).join(" ") || e.email;
175
- return /* @__PURE__ */ t("option", { value: e.id, children: d }, e.id);
178
+ return /* @__PURE__ */ n("option", { value: e.id, children: d }, e.id);
176
179
  })
177
180
  ] }),
178
- /* @__PURE__ */ n(
181
+ /* @__PURE__ */ t(
179
182
  "select",
180
183
  {
181
- value: x,
184
+ value: C,
182
185
  onChange: (e) => w(e.target.value),
183
186
  "data-nf-task-input": !0,
184
187
  children: [
185
- /* @__PURE__ */ t("option", { value: "", children: "All states" }),
186
- c.map((e) => /* @__PURE__ */ t("option", { value: e.id, children: e.label }, e.id))
188
+ /* @__PURE__ */ n("option", { value: "", children: "All states" }),
189
+ c.map((e) => /* @__PURE__ */ n("option", { value: e.id, children: e.label }, e.id))
187
190
  ]
188
191
  }
189
192
  ),
190
- /* @__PURE__ */ n("div", { "data-nf-confirm-actions": !0, children: [
191
- /* @__PURE__ */ t(
193
+ L ? /* @__PURE__ */ n("span", { role: "alert", "data-nf-owners-error": !0, children: L }) : null,
194
+ /* @__PURE__ */ t("div", { "data-nf-confirm-actions": !0, children: [
195
+ /* @__PURE__ */ n(
192
196
  "button",
193
197
  {
194
198
  type: "button",
195
199
  "data-nf-btn-ghost": !0,
196
200
  onClick: () => {
197
- h(!1), p(""), w("");
201
+ h(!1), p(""), w(""), v(null);
198
202
  },
199
203
  children: "Cancel"
200
204
  }
201
205
  ),
202
- /* @__PURE__ */ t(
206
+ /* @__PURE__ */ n(
203
207
  "button",
204
208
  {
205
209
  type: "button",
206
210
  "data-nf-btn-primary": !0,
207
- disabled: !o || v,
208
- onClick: () => void O(),
209
- children: v ? "…" : "Add"
211
+ disabled: !o || m,
212
+ onClick: () => void $(),
213
+ children: m ? "…" : "Add"
210
214
  }
211
215
  )
212
216
  ] })
@@ -214,5 +218,5 @@ function N({
214
218
  ] });
215
219
  }
216
220
  export {
217
- N as OwnersSection
221
+ K as OwnersSection
218
222
  };