@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.
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +13 -3
- package/dist/shared/components/ItemEditForm.js +4801 -4666
- package/dist/shared/components/QueryTable.js +337 -324
- package/dist/shared/components/ReportView.js +105 -99
- package/dist/shared/components/alerts/AlertManagerView.js +327 -301
- package/dist/shared/components/item-edit/CatalogPickerField.js +1149 -1111
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +58 -53
- package/dist/shared/components/item-edit/FieldRenderer.js +227 -223
- package/dist/shared/components/item-edit/FieldRow.js +287 -265
- package/dist/shared/components/item-edit/FilePickerField.js +315 -307
- package/dist/shared/components/item-edit/InlineTableField.js +491 -466
- package/dist/shared/components/item-edit/RecordHeaderActions.js +76 -75
- package/dist/shared/components/item-edit/RecordLiveSync.js +93 -91
- package/dist/shared/components/item-edit/RelationCombobox.js +62 -60
- package/dist/shared/components/item-edit/SummaryPanel.js +287 -277
- package/dist/shared/components/item-edit/UserChip.js +233 -200
- package/dist/shared/components/item-edit/header-midair.js +51 -0
- package/dist/shared/components/item-edit/line-midair.js +76 -70
- package/dist/shared/components/panels/CommentPanel.js +290 -284
- package/dist/shared/components/panels/ItemLockBanner.js +30 -30
- package/dist/shared/components/panels/PipelinePanel.js +956 -901
- package/dist/shared/components/panels/TaskPanel.js +71 -61
- package/dist/shared/components/panels/TransitionRequirementsDialog.js +569 -439
- package/dist/shared/components/panels/requirement-side-effects.js +40 -0
- package/dist/shared/components/queue/QueueWorklist.js +141 -130
- package/dist/shared/lib/draft-store.js +48 -34
- package/dist/shared/lib/query-stats.js +60 -60
- 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
|
|
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
|
|
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), [
|
|
64
|
-
|
|
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,
|
|
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:
|
|
79
|
-
), i.current = !0, p(!0), X(!1), S(null), m(),
|
|
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:
|
|
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
|
-
},
|
|
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,
|
|
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(() =>
|
|
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
|
|
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(() =>
|
|
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(),
|
|
203
|
+
}, [o, e, t, c]), te = Ge(), $e = Je(), W = T && te && $e;
|
|
204
204
|
$(() => {
|
|
205
205
|
if (!(!s || !e || !t)) {
|
|
206
|
-
if (
|
|
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(
|
|
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(() =>
|
|
216
|
-
}) :
|
|
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
|
-
|
|
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
|
-
|
|
228
|
+
V,
|
|
229
229
|
x
|
|
230
230
|
]), $(() => {
|
|
231
|
-
if (!s || !f || !e || !t || Y || !
|
|
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,
|
|
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,
|
|
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,
|
|
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(() =>
|
|
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:
|
|
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:
|
|
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),
|
|
531
|
-
if ($(() => S(!1), [
|
|
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",
|