@nivaro/react 0.3.58 → 0.3.60
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/components/fields/RelationField.js +110 -80
- package/dist/full.css +1 -1
- package/dist/hooks/useRelationOptions.js +1 -0
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +32 -1
- package/dist/index.js +523 -520
- package/dist/shared/components/CollectionBrowserView.js +2083 -2052
- package/dist/shared/components/DataTable.js +497 -465
- package/dist/shared/components/ItemEditForm.js +4430 -4282
- package/dist/shared/components/PageRenderer.js +537 -508
- package/dist/shared/components/QueryTable.js +74 -74
- package/dist/shared/components/WidgetSlot.js +543 -520
- package/dist/shared/components/alerts/AlertManagerView.js +269 -275
- package/dist/shared/components/alerts/types.js +37 -14
- package/dist/shared/components/item-edit/FieldRenderer.js +22 -20
- package/dist/shared/components/item-edit/GridBulkEditDialog.js +55 -54
- package/dist/shared/components/item-edit/InlineTableField.js +2461 -2421
- package/dist/shared/components/item-edit/M2MCombobox.js +141 -137
- package/dist/shared/components/item-edit/PlanGrid.js +876 -820
- package/dist/shared/components/item-edit/QuickCreateButton.js +323 -130
- package/dist/shared/components/item-edit/RelationCombobox.js +408 -375
- package/dist/shared/components/item-edit/RelationGroupedCombobox.js +255 -156
- package/dist/shared/components/item-edit/SummaryPanel.js +356 -343
- package/dist/shared/components/item-edit/duplicate-rehearsal.js +47 -0
- package/dist/shared/components/item-edit/line-midair.js +82 -75
- package/dist/shared/components/item-edit/save-outcome.js +6 -4
- package/dist/shared/components/panels/ItemLockBanner.js +212 -209
- package/dist/shared/components/panels/PipelinePanel.js +775 -737
- package/dist/shared/components/panels/RecordIntegrityBanner.js +114 -86
- package/dist/shared/components/panels/RevisionsPanel.js +313 -299
- package/dist/shared/components/pipeline/PipelineEditorView.js +26 -16
- package/dist/shared/components/queue/QueueQuickFilters.js +13 -13
- package/dist/shared/components/queue/QueueWorklist.js +978 -953
- package/dist/shared/components/queue/live-state-aspect.js +9 -5
- package/dist/shared/components/widgets/ReviewListWidget.js +152 -149
- package/dist/shared/lib/display-prefs.js +60 -52
- package/dist/shared/lib/draft-store.js +71 -48
- package/dist/shared/lib/expression.js +53 -53
- package/dist/shared/lib/list-page-memory.js +42 -20
- package/dist/shared/lib/money-input.js +45 -0
- package/dist/shared/lib/sanitize-html.js +10 -6
- package/dist/shared/lib/staged-row-labels.js +18 -0
- package/package.json +1 -1
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { QueryClientContext as
|
|
3
|
-
import { Lock as ue, LockOpen as
|
|
4
|
-
import { useState as S, useEffect as
|
|
1
|
+
import { jsxs as _, jsx as v } from "react/jsx-runtime";
|
|
2
|
+
import { QueryClientContext as je } from "@tanstack/react-query";
|
|
3
|
+
import { Lock as ue, LockOpen as ye } from "lucide-react";
|
|
4
|
+
import { useState as S, useEffect as x, useRef as C, useCallback as E, useContext as Be } from "react";
|
|
5
5
|
import { toast as d } from "sonner";
|
|
6
|
-
import { useNivaroClient as
|
|
7
|
-
import { post as
|
|
8
|
-
import { idleState as
|
|
9
|
-
import { useOptionalRealtime as
|
|
10
|
-
import { announceRecordTabs as Z, useRecordTabsSignal as
|
|
6
|
+
import { useNivaroClient as Qe, useItemEditAuth as Ue } from "../../context.js";
|
|
7
|
+
import { post as D, get as Ve, del as H } from "../../lib/commands.js";
|
|
8
|
+
import { idleState as We } from "../../lib/idle.js";
|
|
9
|
+
import { useOptionalRealtime as ge, updateTouches as He } from "../../lib/realtime.js";
|
|
10
|
+
import { announceRecordTabs as Z, useRecordTabsSignal as Je } from "../../lib/record-tabs.js";
|
|
11
11
|
import { noteTakeOverHold as ie } from "../item-edit/FieldAffordances.js";
|
|
12
|
-
import { Button as
|
|
13
|
-
import { Popover as
|
|
14
|
-
const ee = 1e4,
|
|
15
|
-
function
|
|
12
|
+
import { Button as M } from "../ui/button.js";
|
|
13
|
+
import { Popover as we, PopoverTrigger as xe, PopoverContent as _e } from "../ui/popover.js";
|
|
14
|
+
const ee = 1e4, pe = 1500, Ge = 2e3, Xe = 5 * 6e4, Ze = 3e4, et = 6e4, tt = 15e3, Le = 1500, rt = 1e4;
|
|
15
|
+
function Ee(e, t) {
|
|
16
16
|
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";
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function nt() {
|
|
19
19
|
const [e, t] = S(!0);
|
|
20
|
-
return
|
|
20
|
+
return x(() => {
|
|
21
21
|
if (typeof window > "u" || typeof document > "u") return;
|
|
22
|
-
let s = null,
|
|
22
|
+
let s = null, R = null, k = 0;
|
|
23
23
|
const q = () => typeof document.hasFocus == "function" ? document.hasFocus() : !0, g = () => {
|
|
24
|
-
|
|
25
|
-
}, $ = (y) => y instanceof HTMLInputElement && y.type === "file",
|
|
26
|
-
$(y.target) && (k = Date.now() +
|
|
24
|
+
R && clearInterval(R), R = null;
|
|
25
|
+
}, $ = (y) => y instanceof HTMLInputElement && y.type === "file", p = (y) => {
|
|
26
|
+
$(y.target) && (k = Date.now() + Xe);
|
|
27
27
|
}, o = (y) => {
|
|
28
|
-
!$(y.target) || !k || (k = 0, q() ||
|
|
29
|
-
},
|
|
28
|
+
!$(y.target) || !k || (k = 0, q() || T());
|
|
29
|
+
}, T = () => {
|
|
30
30
|
s && clearTimeout(s);
|
|
31
31
|
const y = k - Date.now();
|
|
32
32
|
s = setTimeout(
|
|
@@ -35,36 +35,36 @@ function rt() {
|
|
|
35
35
|
g(), t(!1);
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
|
-
g(),
|
|
38
|
+
g(), R = setInterval(() => {
|
|
39
39
|
q() || (g(), t(!1));
|
|
40
|
-
},
|
|
40
|
+
}, Ge);
|
|
41
41
|
},
|
|
42
|
-
y > 0 ? Math.max(y,
|
|
42
|
+
y > 0 ? Math.max(y, pe) : pe
|
|
43
43
|
);
|
|
44
44
|
}, c = () => {
|
|
45
45
|
s && clearTimeout(s), s = null, k = 0, g(), t(!0);
|
|
46
46
|
};
|
|
47
|
-
return window.addEventListener("blur",
|
|
48
|
-
window.removeEventListener("blur",
|
|
47
|
+
return window.addEventListener("blur", T), window.addEventListener("focus", c), document.addEventListener("click", p, !0), document.addEventListener("change", o, !0), document.addEventListener("cancel", o, !0), () => {
|
|
48
|
+
window.removeEventListener("blur", T), window.removeEventListener("focus", c), document.removeEventListener("click", p, !0), document.removeEventListener("change", o, !0), document.removeEventListener("cancel", o, !0), s && clearTimeout(s), g();
|
|
49
49
|
};
|
|
50
50
|
}, []), e;
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function at() {
|
|
53
53
|
const [e, t] = S(
|
|
54
54
|
() => typeof document > "u" || document.visibilityState !== "hidden"
|
|
55
55
|
);
|
|
56
|
-
return
|
|
56
|
+
return x(() => {
|
|
57
57
|
const s = () => t(document.visibilityState !== "hidden");
|
|
58
58
|
return document.addEventListener("visibilitychange", s), () => document.removeEventListener("visibilitychange", s);
|
|
59
59
|
}, []), e;
|
|
60
60
|
}
|
|
61
|
-
function
|
|
62
|
-
const { lazy: k = !1, active: q = !0, dirty: g } =
|
|
61
|
+
function yt(e, t, s, R = {}) {
|
|
62
|
+
const { lazy: k = !1, active: q = !0, dirty: g } = R, $ = C(g);
|
|
63
63
|
$.current = g;
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
}, [
|
|
67
|
-
|
|
64
|
+
const p = E(() => k && $.current === !1, [k]), o = Qe(), { isAdmin: T, userId: c } = Ue(), y = Be(je), [Y, N] = S(null), [z, L] = S(!1), [B, le] = S(!1), [$e, Se] = S([]), [Re, Q] = S(null), [Ne, ce] = S(!1), [Ce, de] = S(""), [Te, te] = S(!1), [qe, fe] = S(!1), J = C(null), i = C(!1), A = C(!1), re = C(!1), ne = C(0), F = C(!1), U = C(null), V = C(null), W = C(null), G = C(!1), K = `${e ?? ""}:${t ?? ""}`, P = E(() => {
|
|
65
|
+
W.current = null, G.current = !1, ie(K, !1);
|
|
66
|
+
}, [K]), f = E(() => {
|
|
67
|
+
J.current && (clearInterval(J.current), J.current = null);
|
|
68
68
|
}, []), ae = E(
|
|
69
69
|
(a) => {
|
|
70
70
|
var r, u;
|
|
@@ -74,18 +74,18 @@ function vt(e, t, s, N = {}) {
|
|
|
74
74
|
[y, e, t, f]
|
|
75
75
|
), h = E(async () => {
|
|
76
76
|
var a, n;
|
|
77
|
-
if (!e || !t ||
|
|
78
|
-
|
|
77
|
+
if (!e || !t || F.current) return !1;
|
|
78
|
+
U.current = null, V.current = null;
|
|
79
79
|
try {
|
|
80
80
|
return await o.request(
|
|
81
|
-
|
|
82
|
-
), i.current = !0, L(!0), te(!1),
|
|
81
|
+
D(`/item-locks/${e}/${t}/lock`, { beat_ms: ee })
|
|
82
|
+
), i.current = !0, L(!0), te(!1), N(null), f(), J.current = setInterval(() => {
|
|
83
83
|
const m = Math.max(
|
|
84
84
|
0,
|
|
85
|
-
Math.floor((Date.now() - new Date(
|
|
85
|
+
Math.floor((Date.now() - new Date(We().last_active).getTime()) / 1e3)
|
|
86
86
|
);
|
|
87
87
|
o.request(
|
|
88
|
-
|
|
88
|
+
D(`/item-locks/${e}/${t}/heartbeat`, {
|
|
89
89
|
idle_seconds: m,
|
|
90
90
|
beat_ms: ee
|
|
91
91
|
})
|
|
@@ -95,58 +95,58 @@ function vt(e, t, s, N = {}) {
|
|
|
95
95
|
"Your edit lock was released after inactivity — it re-locks when you resume."
|
|
96
96
|
);
|
|
97
97
|
const r = () => {
|
|
98
|
-
window.removeEventListener("pointerdown", r, !0), window.removeEventListener("keydown", r, !0), !
|
|
98
|
+
window.removeEventListener("pointerdown", r, !0), window.removeEventListener("keydown", r, !0), !p() && h();
|
|
99
99
|
};
|
|
100
100
|
window.addEventListener("pointerdown", r, !0), window.addEventListener("keydown", r, !0);
|
|
101
101
|
}).catch((l) => {
|
|
102
|
-
var
|
|
103
|
-
const r = l, u = r.status ?? ((
|
|
102
|
+
var he, be;
|
|
103
|
+
const r = l, u = r.status ?? ((he = r.response) == null ? void 0 : he.status);
|
|
104
104
|
if (ae(l) || u !== 404 && u !== 409) return;
|
|
105
|
-
const b = ((
|
|
105
|
+
const b = ((be = r.response) == null ? void 0 : be.data) ?? r.response;
|
|
106
106
|
if (u === 404 && !(b != null && b.locked_by) && (b == null ? void 0 : b.taken_over) === !0) {
|
|
107
107
|
f(), i.current = !1, L(!1);
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
`${
|
|
108
|
+
const ve = b.taken_over_by_name ?? null;
|
|
109
|
+
V.current = ve ?? "Someone else", d.warning(
|
|
110
|
+
`${ve ?? "Someone else"} took over editing — your changes are still here; they save once you edit again`
|
|
111
111
|
);
|
|
112
112
|
return;
|
|
113
113
|
}
|
|
114
114
|
if (u === 404 && !(b != null && b.locked_by)) {
|
|
115
|
-
if (
|
|
115
|
+
if (p()) {
|
|
116
116
|
f(), i.current = !1, L(!1);
|
|
117
117
|
return;
|
|
118
118
|
}
|
|
119
119
|
h();
|
|
120
120
|
return;
|
|
121
121
|
}
|
|
122
|
-
f(), i.current = !1, L(!1), b != null && b.locked_by && (
|
|
122
|
+
f(), i.current = !1, L(!1), b != null && b.locked_by && (N({
|
|
123
123
|
locked_by: b.locked_by,
|
|
124
124
|
locked_by_name: b.locked_by_name ?? null
|
|
125
125
|
}), d.warning(
|
|
126
|
-
b.taken_over === !1 ?
|
|
126
|
+
b.taken_over === !1 ? Ee(!1) : `${b.locked_by_name ?? "Another user"} took over editing — your changes are no longer being saved`
|
|
127
127
|
));
|
|
128
128
|
});
|
|
129
129
|
}, ee), !0;
|
|
130
130
|
} catch (m) {
|
|
131
131
|
const l = m, r = l.status ?? ((a = l.response) == null ? void 0 : a.status), u = ((n = l.response) == null ? void 0 : n.data) ?? l.response;
|
|
132
|
-
return
|
|
132
|
+
return U.current = r ?? null, V.current = (u == null ? void 0 : u.taken_over) === !0 ? u.locked_by_name ?? "Someone else" : null, ae(m) ? !1 : r === 404 ? (F.current = !0, f(), i.current = !1, L(!1), !1) : (r === 409 && (u != null && u.locked_by) && (i.current = !1, L(!1), N({
|
|
133
133
|
locked_by: u.locked_by,
|
|
134
134
|
locked_by_name: u.locked_by_name ?? null,
|
|
135
135
|
...typeof u.may_take_over == "boolean" ? { may_take_over: u.may_take_over } : {}
|
|
136
136
|
})), !1);
|
|
137
137
|
}
|
|
138
|
-
}, [o, e, t, f, ae,
|
|
138
|
+
}, [o, e, t, f, ae, p]), w = E(async () => {
|
|
139
139
|
if (!(!e || !t))
|
|
140
140
|
try {
|
|
141
|
-
const a = await o.request(
|
|
142
|
-
|
|
141
|
+
const a = await o.request(Ve(`/item-locks/${e}/${t}/lock`)), n = a == null ? void 0 : a.data;
|
|
142
|
+
Se(Array.isArray(n == null ? void 0 : n.queue) ? n.queue : []), Q(typeof (n == null ? void 0 : n.my_position) == "number" ? n.my_position : null);
|
|
143
143
|
const m = (n == null ? void 0 : n.is_mine) === !0 || !!c && String((n == null ? void 0 : n.locked_by) ?? "").toLowerCase() === c.toLowerCase(), l = typeof (n == null ? void 0 : n.may_take_over) == "boolean" ? { may_take_over: n.may_take_over } : {};
|
|
144
144
|
if (i.current) return;
|
|
145
145
|
if (!(n != null && n.locked_by) || m) {
|
|
146
|
-
|
|
146
|
+
N(null);
|
|
147
147
|
return;
|
|
148
148
|
}
|
|
149
|
-
|
|
149
|
+
N(
|
|
150
150
|
(r) => r && r.locked_by === String(n.locked_by) ? {
|
|
151
151
|
...r,
|
|
152
152
|
note: n.note ?? r.note ?? null,
|
|
@@ -161,40 +161,40 @@ function vt(e, t, s, N = {}) {
|
|
|
161
161
|
}
|
|
162
162
|
), te(!1);
|
|
163
163
|
} catch (a) {
|
|
164
|
-
(a == null ? void 0 : a.status) === 404 && (
|
|
164
|
+
(a == null ? void 0 : a.status) === 404 && (F.current = !0);
|
|
165
165
|
}
|
|
166
|
-
}, [o, e, t, c]),
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}, [
|
|
170
|
-
if (!
|
|
171
|
-
const a = setInterval(() => void
|
|
166
|
+
}, [o, e, t, c]), I = (Y == null ? void 0 : Y.locked_by) ?? null;
|
|
167
|
+
x(() => {
|
|
168
|
+
I && w();
|
|
169
|
+
}, [I, w]), x(() => {
|
|
170
|
+
if (!I) return;
|
|
171
|
+
const a = setInterval(() => void w(), Ze);
|
|
172
172
|
return () => clearInterval(a);
|
|
173
|
-
}, [
|
|
173
|
+
}, [I, w]), x(() => {
|
|
174
174
|
if (!(!s || !e || !t))
|
|
175
|
-
return A.current = !1,
|
|
176
|
-
f(), A.current = !1, i.current && (i.current = !1, o.request(
|
|
175
|
+
return A.current = !1, F.current = !1, k ? w() : h(), () => {
|
|
176
|
+
f(), A.current = !1, i.current && (i.current = !1, o.request(H(`/item-locks/${e}/${t}/lock`)).then(() => Z(c, "lock-released", e, t)).catch(() => {
|
|
177
177
|
}));
|
|
178
178
|
};
|
|
179
|
-
}, [s, e, t, h, o, f, c, k,
|
|
180
|
-
const
|
|
179
|
+
}, [s, e, t, h, o, f, c, k, w]);
|
|
180
|
+
const Ae = E(async () => {
|
|
181
181
|
if (!(!s || i.current || re.current) && !(Date.now() < ne.current)) {
|
|
182
182
|
re.current = !0;
|
|
183
183
|
try {
|
|
184
184
|
const a = await h();
|
|
185
|
-
!a &&
|
|
185
|
+
!a && U.current === 409 && d.warning("Someone else is editing this record — your change can’t be saved yet"), !a && U.current !== 409 && !F.current && (ne.current = Date.now() + tt);
|
|
186
186
|
} finally {
|
|
187
187
|
re.current = !1;
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
190
|
}, [s, h]);
|
|
191
|
-
|
|
191
|
+
x(() => {
|
|
192
192
|
const a = () => {
|
|
193
193
|
ne.current = 0;
|
|
194
194
|
};
|
|
195
195
|
return window.addEventListener("online", a), () => window.removeEventListener("online", a);
|
|
196
196
|
}, []);
|
|
197
|
-
const
|
|
197
|
+
const X = E(() => {
|
|
198
198
|
var a;
|
|
199
199
|
if (!(!e || !t))
|
|
200
200
|
try {
|
|
@@ -211,24 +211,27 @@ function vt(e, t, s, N = {}) {
|
|
|
211
211
|
});
|
|
212
212
|
} catch {
|
|
213
213
|
}
|
|
214
|
-
}, [o, e, t, c]), se =
|
|
215
|
-
|
|
214
|
+
}, [o, e, t, c]), se = at(), Ie = nt(), O = q && se && Ie, me = C(O);
|
|
215
|
+
x(() => {
|
|
216
|
+
const a = me.current;
|
|
217
|
+
me.current = O, !(!s || !e || !t || a || !O) && (i.current || !I || w());
|
|
218
|
+
}, [s, O, e, t, I, w]), x(() => {
|
|
216
219
|
if (!(!s || !e || !t)) {
|
|
217
|
-
if (
|
|
220
|
+
if (O) {
|
|
218
221
|
if (A.current) {
|
|
219
|
-
if (A.current = !1,
|
|
222
|
+
if (A.current = !1, p()) return;
|
|
220
223
|
h().then((a) => {
|
|
221
|
-
!a &&
|
|
224
|
+
!a && U.current === 409 && d.warning(Ee(V.current != null, V.current));
|
|
222
225
|
});
|
|
223
226
|
}
|
|
224
227
|
return;
|
|
225
228
|
}
|
|
226
|
-
i.current && (f(), i.current = !1, L(!1), A.current = !0, se ? o.request(
|
|
227
|
-
}) :
|
|
229
|
+
i.current && (f(), i.current = !1, L(!1), A.current = !0, se ? o.request(H(`/item-locks/${e}/${t}/lock`)).then(() => Z(c, "lock-released", e, t)).catch(() => {
|
|
230
|
+
}) : X());
|
|
228
231
|
}
|
|
229
232
|
}, [
|
|
230
233
|
s,
|
|
231
|
-
|
|
234
|
+
O,
|
|
232
235
|
se,
|
|
233
236
|
e,
|
|
234
237
|
t,
|
|
@@ -236,28 +239,28 @@ function vt(e, t, s, N = {}) {
|
|
|
236
239
|
o,
|
|
237
240
|
f,
|
|
238
241
|
c,
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
]),
|
|
242
|
-
if (!s || !k || !e || !t ||
|
|
242
|
+
X,
|
|
243
|
+
p
|
|
244
|
+
]), x(() => {
|
|
245
|
+
if (!s || !k || !e || !t || I || !O) return;
|
|
243
246
|
const a = setInterval(() => {
|
|
244
|
-
!i.current && !
|
|
245
|
-
},
|
|
247
|
+
!i.current && !F.current && w();
|
|
248
|
+
}, et);
|
|
246
249
|
return () => clearInterval(a);
|
|
247
|
-
}, [s, k, e, t,
|
|
250
|
+
}, [s, k, e, t, I, O, w]), x(() => {
|
|
248
251
|
if (!s || !e || !t) return;
|
|
249
252
|
const a = () => {
|
|
250
|
-
i.current && (f(), i.current = !1, A.current = !0,
|
|
253
|
+
i.current && (f(), i.current = !1, A.current = !0, X());
|
|
251
254
|
}, n = (m) => {
|
|
252
|
-
m.persisted && A.current && (A.current = !1,
|
|
255
|
+
m.persisted && A.current && (A.current = !1, p() || h());
|
|
253
256
|
};
|
|
254
257
|
return window.addEventListener("pagehide", a), window.addEventListener("pageshow", n), () => {
|
|
255
258
|
window.removeEventListener("pagehide", a), window.removeEventListener("pageshow", n);
|
|
256
259
|
};
|
|
257
|
-
}, [s, e, t, f, h,
|
|
260
|
+
}, [s, e, t, f, h, X, p]), x(() => {
|
|
258
261
|
if (!s || !k || !e || !t || g !== !1 || !i.current) return;
|
|
259
|
-
const a =
|
|
260
|
-
$.current !== !1 || !i.current || (f(), i.current = !1, L(!1),
|
|
262
|
+
const a = W.current, n = a != null && !G.current ? Math.max(Le, a + rt - Date.now()) : Le, m = setTimeout(() => {
|
|
263
|
+
$.current !== !1 || !i.current || (f(), i.current = !1, L(!1), P(), o.request(H(`/item-locks/${e}/${t}/lock`)).then(() => Z(c, "lock-released", e, t)).catch(() => {
|
|
261
264
|
}));
|
|
262
265
|
}, n);
|
|
263
266
|
return () => clearTimeout(m);
|
|
@@ -267,41 +270,41 @@ function vt(e, t, s, N = {}) {
|
|
|
267
270
|
e,
|
|
268
271
|
t,
|
|
269
272
|
g,
|
|
270
|
-
|
|
273
|
+
z,
|
|
271
274
|
o,
|
|
272
275
|
f,
|
|
273
276
|
c,
|
|
274
|
-
|
|
275
|
-
]),
|
|
276
|
-
g === !0 &&
|
|
277
|
-
}, [g]),
|
|
278
|
-
!
|
|
279
|
-
}, [
|
|
277
|
+
P
|
|
278
|
+
]), x(() => {
|
|
279
|
+
g === !0 && W.current != null && (G.current = !0);
|
|
280
|
+
}, [g]), x(() => {
|
|
281
|
+
!z && W.current != null && P();
|
|
282
|
+
}, [z, P]), x(() => () => ie(K, !1), [K]), Je(c, "lock-released", e, t, () => {
|
|
280
283
|
s && i.current && h();
|
|
281
284
|
});
|
|
282
|
-
const oe =
|
|
283
|
-
|
|
285
|
+
const oe = ge();
|
|
286
|
+
x(() => {
|
|
284
287
|
if (!(!s || !oe || !e || !t))
|
|
285
288
|
return oe.subscribeCollections([e], (a) => {
|
|
286
289
|
var n;
|
|
287
|
-
i.current ||
|
|
290
|
+
i.current || F.current || !((n = a.changed_fields) != null && n.includes("$lock")) || !He(a, t) || w();
|
|
288
291
|
});
|
|
289
|
-
}, [s, oe, e, t,
|
|
290
|
-
const
|
|
292
|
+
}, [s, oe, e, t, w]);
|
|
293
|
+
const j = ge(), [Oe, ke] = S(!1), De = E(async () => {
|
|
291
294
|
if (!(!e || !t)) {
|
|
292
|
-
|
|
295
|
+
ke(!0);
|
|
293
296
|
try {
|
|
294
|
-
await o.request(
|
|
297
|
+
await o.request(D(`/item-locks/${e}/${t}/lock/request`, {})), d.success("Asked the current editor to release the lock");
|
|
295
298
|
} catch {
|
|
296
299
|
d.error("Could not send the lock request");
|
|
297
300
|
} finally {
|
|
298
|
-
|
|
301
|
+
ke(!1);
|
|
299
302
|
}
|
|
300
303
|
}
|
|
301
304
|
}, [o, e, t]);
|
|
302
|
-
|
|
303
|
-
if (!
|
|
304
|
-
const a =
|
|
305
|
+
x(() => {
|
|
306
|
+
if (!j || !e || !t) return;
|
|
307
|
+
const a = j.on("lock:requested", (r) => {
|
|
305
308
|
if ((r == null ? void 0 : r.collection) !== e || String(r == null ? void 0 : r.item) !== String(t) || !i.current) return;
|
|
306
309
|
const u = (r == null ? void 0 : r.from) ?? {};
|
|
307
310
|
d(`${u.name ?? "Someone"} is asking you to release this record`, {
|
|
@@ -310,7 +313,7 @@ function vt(e, t, s, N = {}) {
|
|
|
310
313
|
label: "Release",
|
|
311
314
|
onClick: () => {
|
|
312
315
|
f(), i.current = !1, L(!1), o.request(
|
|
313
|
-
|
|
316
|
+
D(`/item-locks/${e}/${t}/lock/respond`, {
|
|
314
317
|
to: u.id,
|
|
315
318
|
action: "release"
|
|
316
319
|
})
|
|
@@ -321,7 +324,7 @@ function vt(e, t, s, N = {}) {
|
|
|
321
324
|
label: "Keep editing",
|
|
322
325
|
onClick: () => {
|
|
323
326
|
o.request(
|
|
324
|
-
|
|
327
|
+
D(`/item-locks/${e}/${t}/lock/respond`, {
|
|
325
328
|
to: u.id,
|
|
326
329
|
action: "decline"
|
|
327
330
|
})
|
|
@@ -330,127 +333,127 @@ function vt(e, t, s, N = {}) {
|
|
|
330
333
|
}
|
|
331
334
|
}
|
|
332
335
|
});
|
|
333
|
-
}), n =
|
|
336
|
+
}), n = j.on("lock:response", (r) => {
|
|
334
337
|
var u, b;
|
|
335
338
|
(r == null ? void 0 : r.collection) !== e || String(r == null ? void 0 : r.item) !== String(t) || i.current || ((r == null ? void 0 : r.action) === "release" ? (d.success(`${((u = r == null ? void 0 : r.from) == null ? void 0 : u.name) ?? "The editor"} released the lock — it's yours`), h()) : d.warning(
|
|
336
339
|
`${((b = r == null ? void 0 : r.from) == null ? void 0 : b.name) ?? "The editor"} is keeping the lock${r != null && r.note ? `: "${r.note}"` : ""}`
|
|
337
340
|
));
|
|
338
|
-
}), m =
|
|
339
|
-
(r == null ? void 0 : r.collection) !== e || String(r == null ? void 0 : r.item) !== String(t) || i.current || (d.success("Your turn — the edit lock is yours"),
|
|
340
|
-
}), l =
|
|
341
|
-
(r == null ? void 0 : r.collection) !== e || String(r == null ? void 0 : r.item) !== String(t) || (i.current && d(`${(r == null ? void 0 : r.user_name) ?? "Someone"} is waiting to edit this record`, { duration: 8e3 }),
|
|
341
|
+
}), m = j.on("lock:available", (r) => {
|
|
342
|
+
(r == null ? void 0 : r.collection) !== e || String(r == null ? void 0 : r.item) !== String(t) || i.current || (d.success("Your turn — the edit lock is yours"), Q(null), h());
|
|
343
|
+
}), l = j.on("lock:queued", (r) => {
|
|
344
|
+
(r == null ? void 0 : r.collection) !== e || String(r == null ? void 0 : r.item) !== String(t) || (i.current && d(`${(r == null ? void 0 : r.user_name) ?? "Someone"} is waiting to edit this record`, { duration: 8e3 }), w());
|
|
342
345
|
});
|
|
343
346
|
return () => {
|
|
344
347
|
a(), n(), m(), l();
|
|
345
348
|
};
|
|
346
|
-
}, [
|
|
347
|
-
const
|
|
349
|
+
}, [j, e, t, o, h, f, w]);
|
|
350
|
+
const Me = E(async () => {
|
|
348
351
|
if (!(!e || !t)) {
|
|
349
352
|
ce(!0);
|
|
350
353
|
try {
|
|
351
354
|
const a = await o.request(
|
|
352
|
-
|
|
355
|
+
D(`/item-locks/${e}/${t}/lock/queue`, {})
|
|
353
356
|
), n = a == null ? void 0 : a.data;
|
|
354
357
|
if (n != null && n.free) {
|
|
355
|
-
|
|
358
|
+
Q(null), N(null), d.success("Nobody is editing this record now — go ahead");
|
|
356
359
|
return;
|
|
357
360
|
}
|
|
358
361
|
const m = n == null ? void 0 : n.position;
|
|
359
|
-
|
|
362
|
+
Q(typeof m == "number" ? m : 1), d.success("You are in line — the lock comes to you automatically when it frees up"), w();
|
|
360
363
|
} catch {
|
|
361
364
|
d.error("Could not join the queue");
|
|
362
365
|
} finally {
|
|
363
366
|
ce(!1);
|
|
364
367
|
}
|
|
365
368
|
}
|
|
366
|
-
}, [o, e, t,
|
|
369
|
+
}, [o, e, t, w]), Ye = E(async () => {
|
|
367
370
|
if (!(!e || !t))
|
|
368
371
|
try {
|
|
369
|
-
await o.request(
|
|
372
|
+
await o.request(H(`/item-locks/${e}/${t}/lock/queue`)), Q(null), w();
|
|
370
373
|
} catch {
|
|
371
374
|
}
|
|
372
|
-
}, [o, e, t,
|
|
375
|
+
}, [o, e, t, w]), Fe = E(
|
|
373
376
|
async (a) => {
|
|
374
377
|
if (!(!e || !t || !i.current)) {
|
|
375
378
|
de(a);
|
|
376
379
|
try {
|
|
377
|
-
await o.request(
|
|
380
|
+
await o.request(D(`/item-locks/${e}/${t}/lock/note`, { note: a }));
|
|
378
381
|
} catch {
|
|
379
382
|
}
|
|
380
383
|
}
|
|
381
384
|
},
|
|
382
385
|
[o, e, t]
|
|
383
|
-
),
|
|
386
|
+
), ze = E(async () => {
|
|
384
387
|
if (!(!e || !t || !i.current)) {
|
|
385
388
|
fe(!0), f(), i.current = !1, L(!1);
|
|
386
389
|
try {
|
|
387
|
-
await o.request(
|
|
390
|
+
await o.request(H(`/item-locks/${e}/${t}/lock`)), te(!0), de(""), d.success("Lock released — anyone can edit this record now");
|
|
388
391
|
} catch {
|
|
389
392
|
d.error("Failed to release the lock"), h();
|
|
390
393
|
} finally {
|
|
391
394
|
fe(!1);
|
|
392
395
|
}
|
|
393
396
|
}
|
|
394
|
-
}, [o, e, t, f, h]),
|
|
397
|
+
}, [o, e, t, f, h]), Ke = E(async () => {
|
|
395
398
|
if (i.current) return !0;
|
|
396
399
|
const a = await h();
|
|
397
400
|
return a && d.success("You hold the edit lock again"), a;
|
|
398
|
-
}, [h]),
|
|
401
|
+
}, [h]), Pe = E(async () => {
|
|
399
402
|
var a;
|
|
400
403
|
if (!(!e || !t)) {
|
|
401
404
|
le(!0);
|
|
402
405
|
try {
|
|
403
406
|
await o.request(
|
|
404
|
-
|
|
405
|
-
), d.success("You now hold the edit lock"),
|
|
407
|
+
D(`/item-locks/${e}/${t}/lock/force`, { beat_ms: ee })
|
|
408
|
+
), d.success("You now hold the edit lock"), W.current = Date.now(), G.current = !1, ie(K, !0), await h() || P();
|
|
406
409
|
} catch (n) {
|
|
407
410
|
const m = ((a = n == null ? void 0 : n.response) == null ? void 0 : a.error) ?? "Failed to take over the lock";
|
|
408
|
-
d.error(m), (n == null ? void 0 : n.status) === 403 &&
|
|
411
|
+
d.error(m), (n == null ? void 0 : n.status) === 403 && N((l) => l && { ...l, may_take_over: !1 });
|
|
409
412
|
} finally {
|
|
410
413
|
le(!1);
|
|
411
414
|
}
|
|
412
415
|
}
|
|
413
|
-
}, [o, e, t, h,
|
|
416
|
+
}, [o, e, t, h, K, P]);
|
|
414
417
|
return {
|
|
415
|
-
lockHolder:
|
|
416
|
-
acquired:
|
|
417
|
-
isReadOnly: !!
|
|
418
|
-
takeOver:
|
|
419
|
-
takingOver:
|
|
420
|
-
isAdmin:
|
|
421
|
-
requestLock:
|
|
422
|
-
requesting:
|
|
423
|
-
queue:
|
|
424
|
-
myPosition:
|
|
425
|
-
joinQueue:
|
|
426
|
-
leaveQueue:
|
|
418
|
+
lockHolder: Y,
|
|
419
|
+
acquired: z,
|
|
420
|
+
isReadOnly: !!Y,
|
|
421
|
+
takeOver: Pe,
|
|
422
|
+
takingOver: B,
|
|
423
|
+
isAdmin: T,
|
|
424
|
+
requestLock: De,
|
|
425
|
+
requesting: Oe,
|
|
426
|
+
queue: $e,
|
|
427
|
+
myPosition: Re,
|
|
428
|
+
joinQueue: Me,
|
|
429
|
+
leaveQueue: Ye,
|
|
427
430
|
joining: Ne,
|
|
428
|
-
myNote:
|
|
429
|
-
saveNote:
|
|
430
|
-
release:
|
|
431
|
-
releasing:
|
|
432
|
-
released:
|
|
433
|
-
relock:
|
|
434
|
-
claim:
|
|
431
|
+
myNote: Ce,
|
|
432
|
+
saveNote: Fe,
|
|
433
|
+
release: ze,
|
|
434
|
+
releasing: qe,
|
|
435
|
+
released: Te,
|
|
436
|
+
relock: Ke,
|
|
437
|
+
claim: Ae
|
|
435
438
|
};
|
|
436
439
|
}
|
|
437
|
-
function
|
|
440
|
+
function gt({
|
|
438
441
|
note: e,
|
|
439
442
|
onSave: t,
|
|
440
443
|
waiting: s,
|
|
441
|
-
onRelease:
|
|
444
|
+
onRelease: R,
|
|
442
445
|
releasing: k,
|
|
443
446
|
released: q,
|
|
444
447
|
onRelock: g
|
|
445
448
|
}) {
|
|
446
|
-
var
|
|
447
|
-
const [$,
|
|
448
|
-
|
|
449
|
+
var T;
|
|
450
|
+
const [$, p] = S(e);
|
|
451
|
+
x(() => p(e), [e]);
|
|
449
452
|
const o = () => {
|
|
450
453
|
$.trim() !== e && t($.trim());
|
|
451
454
|
};
|
|
452
|
-
return q ? /* @__PURE__ */
|
|
453
|
-
/* @__PURE__ */ v(
|
|
455
|
+
return q ? /* @__PURE__ */ _(we, { children: [
|
|
456
|
+
/* @__PURE__ */ v(xe, { asChild: !0, children: /* @__PURE__ */ v(
|
|
454
457
|
"button",
|
|
455
458
|
{
|
|
456
459
|
type: "button",
|
|
@@ -458,14 +461,14 @@ function yt({
|
|
|
458
461
|
title: "Lock released — anyone can edit this record",
|
|
459
462
|
"data-lock-released": !0,
|
|
460
463
|
className: "relative inline-flex h-8 w-8 items-center justify-center text-slate-400 transition-colors hover:bg-accent hover:text-accent-foreground dark:text-slate-500",
|
|
461
|
-
children: /* @__PURE__ */ v(
|
|
464
|
+
children: /* @__PURE__ */ v(ye, { className: "h-4 w-4", strokeWidth: 2 })
|
|
462
465
|
}
|
|
463
466
|
) }),
|
|
464
|
-
/* @__PURE__ */
|
|
467
|
+
/* @__PURE__ */ _(_e, { align: "end", sideOffset: 6, className: "w-[300px] p-3", children: [
|
|
465
468
|
/* @__PURE__ */ v("p", { className: "text-[12px] font-semibold text-slate-700 dark:text-slate-200", children: "You released the edit lock" }),
|
|
466
469
|
/* @__PURE__ */ v("p", { className: "mt-0.5 text-[11px] text-slate-500 dark:text-slate-400", children: "Anyone can edit this record now. Your next edit locks it again — or lock it now." }),
|
|
467
|
-
/* @__PURE__ */
|
|
468
|
-
|
|
470
|
+
/* @__PURE__ */ _(
|
|
471
|
+
M,
|
|
469
472
|
{
|
|
470
473
|
type: "button",
|
|
471
474
|
size: "sm",
|
|
@@ -479,8 +482,8 @@ function yt({
|
|
|
479
482
|
}
|
|
480
483
|
)
|
|
481
484
|
] })
|
|
482
|
-
] }) : /* @__PURE__ */
|
|
483
|
-
/* @__PURE__ */ v(
|
|
485
|
+
] }) : /* @__PURE__ */ _(we, { children: [
|
|
486
|
+
/* @__PURE__ */ v(xe, { asChild: !0, children: /* @__PURE__ */ _(
|
|
484
487
|
"button",
|
|
485
488
|
{
|
|
486
489
|
type: "button",
|
|
@@ -494,14 +497,14 @@ function yt({
|
|
|
494
497
|
]
|
|
495
498
|
}
|
|
496
499
|
) }),
|
|
497
|
-
/* @__PURE__ */
|
|
500
|
+
/* @__PURE__ */ _(_e, { align: "end", sideOffset: 6, className: "w-[300px] p-3", children: [
|
|
498
501
|
/* @__PURE__ */ v("p", { className: "text-[12px] font-semibold text-slate-700 dark:text-slate-200", children: "You hold the edit lock" }),
|
|
499
502
|
/* @__PURE__ */ v("p", { className: "mt-0.5 text-[11px] text-slate-500 dark:text-slate-400", children: "Others see this record read-only. A note tells them what you’re doing." }),
|
|
500
503
|
/* @__PURE__ */ v(
|
|
501
504
|
"input",
|
|
502
505
|
{
|
|
503
506
|
value: $,
|
|
504
|
-
onChange: (c) =>
|
|
507
|
+
onChange: (c) => p(c.target.value.slice(0, 300)),
|
|
505
508
|
onBlur: o,
|
|
506
509
|
onKeyDown: (c) => {
|
|
507
510
|
c.key === "Enter" && (c.preventDefault(), o());
|
|
@@ -511,66 +514,66 @@ function yt({
|
|
|
511
514
|
className: "mt-2 h-7 w-full rounded-md border border-slate-200 bg-white px-2 text-[12px] dark:border-border dark:bg-card"
|
|
512
515
|
}
|
|
513
516
|
),
|
|
514
|
-
s.length > 0 && /* @__PURE__ */
|
|
515
|
-
/* @__PURE__ */
|
|
517
|
+
s.length > 0 && /* @__PURE__ */ _("div", { className: "mt-2 rounded-md bg-amber-50 px-2 py-1.5 text-[11px] text-amber-800 dark:bg-amber-500/10 dark:text-amber-200", children: [
|
|
518
|
+
/* @__PURE__ */ _("span", { className: "font-semibold", children: [
|
|
516
519
|
s.length,
|
|
517
520
|
" waiting for the lock:"
|
|
518
521
|
] }),
|
|
519
522
|
" ",
|
|
520
523
|
s.map((c) => c.name ?? "someone").join(", ")
|
|
521
524
|
] }),
|
|
522
|
-
|
|
523
|
-
|
|
525
|
+
R && /* @__PURE__ */ _(
|
|
526
|
+
M,
|
|
524
527
|
{
|
|
525
528
|
type: "button",
|
|
526
529
|
variant: "outline",
|
|
527
530
|
size: "sm",
|
|
528
531
|
className: "mt-2 h-7 w-full text-[12px]",
|
|
529
|
-
onClick:
|
|
532
|
+
onClick: R,
|
|
530
533
|
disabled: k,
|
|
531
534
|
"data-lock-release": !0,
|
|
532
535
|
children: [
|
|
533
|
-
/* @__PURE__ */ v(
|
|
534
|
-
k ? "Releasing…" : s.length > 0 ? `Release lock to ${((
|
|
536
|
+
/* @__PURE__ */ v(ye, { className: "mr-1.5 h-3.5 w-3.5" }),
|
|
537
|
+
k ? "Releasing…" : s.length > 0 ? `Release lock to ${((T = s[0]) == null ? void 0 : T.name) ?? "the next person"}` : "Release lock"
|
|
535
538
|
]
|
|
536
539
|
}
|
|
537
540
|
)
|
|
538
541
|
] })
|
|
539
542
|
] });
|
|
540
543
|
}
|
|
541
|
-
function
|
|
544
|
+
function wt({
|
|
542
545
|
lockHolder: e,
|
|
543
546
|
onTakeOver: t,
|
|
544
547
|
takingOver: s,
|
|
545
|
-
isAdmin:
|
|
548
|
+
isAdmin: R,
|
|
546
549
|
onRequestLock: k,
|
|
547
550
|
requesting: q,
|
|
548
551
|
queue: g,
|
|
549
552
|
myPosition: $,
|
|
550
|
-
onJoinQueue:
|
|
553
|
+
onJoinQueue: p,
|
|
551
554
|
onLeaveQueue: o,
|
|
552
|
-
joining:
|
|
555
|
+
joining: T,
|
|
553
556
|
noun: c = "this item",
|
|
554
557
|
readOnlyText: y = "fields are read-only"
|
|
555
558
|
}) {
|
|
556
|
-
const [
|
|
557
|
-
if (
|
|
558
|
-
const L = e.locked_by_name || "Another user",
|
|
559
|
-
return /* @__PURE__ */
|
|
559
|
+
const [Y, N] = S(!1), z = (e == null ? void 0 : e.locked_by) ?? null;
|
|
560
|
+
if (x(() => N(!1), [z]), !e) return null;
|
|
561
|
+
const L = e.locked_by_name || "Another user", B = (g == null ? void 0 : g.length) ?? 0;
|
|
562
|
+
return /* @__PURE__ */ _(
|
|
560
563
|
"div",
|
|
561
564
|
{
|
|
562
565
|
className: "mb-4 flex flex-wrap items-center gap-3 rounded-lg border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-900 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-100",
|
|
563
566
|
"data-lock-banner": !0,
|
|
564
567
|
children: [
|
|
565
568
|
/* @__PURE__ */ v(ue, { className: "h-4 w-4 shrink-0 text-amber-500" }),
|
|
566
|
-
/* @__PURE__ */
|
|
569
|
+
/* @__PURE__ */ _("span", { className: "min-w-0 flex-1", children: [
|
|
567
570
|
/* @__PURE__ */ v("span", { className: "font-medium", children: L }),
|
|
568
571
|
" is editing ",
|
|
569
572
|
c,
|
|
570
573
|
" — ",
|
|
571
574
|
y,
|
|
572
575
|
" until the lock is released.",
|
|
573
|
-
e.idle_minutes != null && e.idle_minutes >= 2 && /* @__PURE__ */
|
|
576
|
+
e.idle_minutes != null && e.idle_minutes >= 2 && /* @__PURE__ */ _(
|
|
574
577
|
"span",
|
|
575
578
|
{
|
|
576
579
|
className: "ml-1.5 rounded bg-amber-100 px-1 py-px text-[10px] font-semibold text-amber-700 dark:bg-amber-500/20 dark:text-amber-200",
|
|
@@ -583,20 +586,20 @@ function gt({
|
|
|
583
586
|
]
|
|
584
587
|
}
|
|
585
588
|
),
|
|
586
|
-
e.note && /* @__PURE__ */
|
|
589
|
+
e.note && /* @__PURE__ */ _("span", { className: "mt-0.5 block text-[12.5px] text-amber-800/90 dark:text-amber-200/90", children: [
|
|
587
590
|
"“",
|
|
588
591
|
e.note,
|
|
589
592
|
"”"
|
|
590
593
|
] }),
|
|
591
|
-
|
|
592
|
-
|
|
594
|
+
B > 0 && $ == null && /* @__PURE__ */ _("span", { className: "mt-0.5 block text-[11.5px] text-amber-700/80 dark:text-amber-300/80", children: [
|
|
595
|
+
B,
|
|
593
596
|
" ",
|
|
594
|
-
|
|
597
|
+
B === 1 ? "person is" : "people are",
|
|
595
598
|
" already waiting."
|
|
596
599
|
] })
|
|
597
600
|
] }),
|
|
598
|
-
|
|
599
|
-
|
|
601
|
+
p && ($ != null ? /* @__PURE__ */ _(
|
|
602
|
+
M,
|
|
600
603
|
{
|
|
601
604
|
size: "sm",
|
|
602
605
|
variant: "outline",
|
|
@@ -610,19 +613,19 @@ function gt({
|
|
|
610
613
|
]
|
|
611
614
|
}
|
|
612
615
|
) : /* @__PURE__ */ v(
|
|
613
|
-
|
|
616
|
+
M,
|
|
614
617
|
{
|
|
615
618
|
size: "sm",
|
|
616
619
|
variant: "outline",
|
|
617
620
|
className: "h-7 shrink-0 border-amber-300 bg-white text-[12px] text-amber-800 hover:bg-amber-100 dark:border-amber-500/40 dark:bg-transparent dark:text-amber-200 dark:hover:bg-amber-500/15",
|
|
618
|
-
onClick:
|
|
619
|
-
disabled:
|
|
621
|
+
onClick: p,
|
|
622
|
+
disabled: T,
|
|
620
623
|
"data-lock-queue-join": !0,
|
|
621
|
-
children:
|
|
624
|
+
children: T ? "Joining…" : "Ask to be next"
|
|
622
625
|
}
|
|
623
626
|
)),
|
|
624
627
|
k && /* @__PURE__ */ v(
|
|
625
|
-
|
|
628
|
+
M,
|
|
626
629
|
{
|
|
627
630
|
size: "sm",
|
|
628
631
|
variant: "outline",
|
|
@@ -635,34 +638,34 @@ function gt({
|
|
|
635
638
|
// Admins always; other roles only when the server says they may (the
|
|
636
639
|
// takeover-role allowlist, #256) — unknown = offered, and a 403 then
|
|
637
640
|
// hides it. A Take over that can only fail was a dead end.
|
|
638
|
-
(
|
|
641
|
+
(R || e.may_take_over !== !1) && (Y ? /* @__PURE__ */ _(
|
|
639
642
|
"span",
|
|
640
643
|
{
|
|
641
644
|
className: "flex basis-full flex-wrap items-center justify-end gap-2 text-[12px] text-amber-800 dark:text-amber-200",
|
|
642
645
|
"data-lock-takeover-confirm": !0,
|
|
643
646
|
children: [
|
|
644
|
-
/* @__PURE__ */
|
|
647
|
+
/* @__PURE__ */ _("span", { className: "min-w-0 flex-1 text-right", children: [
|
|
645
648
|
L,
|
|
646
649
|
" may have unsaved changes — they can’t save them once you take over."
|
|
647
650
|
] }),
|
|
648
651
|
/* @__PURE__ */ v(
|
|
649
|
-
|
|
652
|
+
M,
|
|
650
653
|
{
|
|
651
654
|
size: "sm",
|
|
652
655
|
variant: "outline",
|
|
653
656
|
className: "h-7 shrink-0 border-amber-300 bg-white text-[12px] text-amber-800 hover:bg-amber-100 dark:border-amber-500/40 dark:bg-transparent dark:text-amber-200 dark:hover:bg-amber-500/15",
|
|
654
|
-
onClick: () =>
|
|
657
|
+
onClick: () => N(!1),
|
|
655
658
|
disabled: s,
|
|
656
659
|
children: "Cancel"
|
|
657
660
|
}
|
|
658
661
|
),
|
|
659
662
|
/* @__PURE__ */ v(
|
|
660
|
-
|
|
663
|
+
M,
|
|
661
664
|
{
|
|
662
665
|
size: "sm",
|
|
663
666
|
className: "h-7 shrink-0 bg-amber-600 text-[12px] text-white hover:bg-amber-700",
|
|
664
667
|
onClick: () => {
|
|
665
|
-
|
|
668
|
+
N(!1), t();
|
|
666
669
|
},
|
|
667
670
|
disabled: s,
|
|
668
671
|
"data-lock-takeover-go": !0,
|
|
@@ -672,12 +675,12 @@ function gt({
|
|
|
672
675
|
]
|
|
673
676
|
}
|
|
674
677
|
) : /* @__PURE__ */ v(
|
|
675
|
-
|
|
678
|
+
M,
|
|
676
679
|
{
|
|
677
680
|
size: "sm",
|
|
678
681
|
variant: "outline",
|
|
679
|
-
className:
|
|
680
|
-
onClick: () =>
|
|
682
|
+
className: R ? "h-7 shrink-0 border-amber-300 bg-white text-[12px] text-amber-800 hover:bg-amber-100 dark:border-amber-500/40 dark:bg-transparent dark:text-amber-200 dark:hover:bg-amber-500/15" : "h-7 shrink-0 border-amber-200 bg-white/60 text-[12px] text-amber-700/80 hover:bg-amber-100 dark:border-amber-500/30 dark:bg-transparent dark:text-amber-200/80 dark:hover:bg-amber-500/15",
|
|
683
|
+
onClick: () => N(!0),
|
|
681
684
|
disabled: s,
|
|
682
685
|
children: s ? "Taking over…" : "Take over"
|
|
683
686
|
}
|
|
@@ -687,9 +690,9 @@ function gt({
|
|
|
687
690
|
);
|
|
688
691
|
}
|
|
689
692
|
export {
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
693
|
+
wt as ItemLockBanner,
|
|
694
|
+
gt as LockHolderButton,
|
|
695
|
+
rt as TAKEOVER_HOLD_MS,
|
|
696
|
+
Ee as takenAwayText,
|
|
697
|
+
yt as useItemLock
|
|
695
698
|
};
|