@nivaro/react 0.3.49 → 0.3.51
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/InlineGridField.js +166 -105
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +38 -4
- package/dist/shared/components/ItemEditForm.js +5258 -5034
- package/dist/shared/components/QueryTable.js +489 -347
- 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 +1230 -1175
- package/dist/shared/components/item-edit/CloneDialog.js +192 -142
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +58 -53
- package/dist/shared/components/item-edit/FieldRenderer.js +249 -244
- package/dist/shared/components/item-edit/FieldRow.js +402 -370
- package/dist/shared/components/item-edit/FilePickerField.js +315 -307
- package/dist/shared/components/item-edit/InlineGridField.js +92 -90
- package/dist/shared/components/item-edit/InlineTableField.js +3119 -2951
- package/dist/shared/components/item-edit/MidairCollisionDialog.js +175 -0
- package/dist/shared/components/item-edit/PlanGrid.js +162 -162
- package/dist/shared/components/item-edit/PolishFields.js +169 -162
- 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 +198 -191
- package/dist/shared/components/item-edit/SummaryPanel.js +282 -259
- package/dist/shared/components/item-edit/UserChip.js +233 -200
- package/dist/shared/components/item-edit/ValidationSummary.js +64 -47
- package/dist/shared/components/item-edit/header-midair.js +51 -0
- package/dist/shared/components/item-edit/helpers.js +181 -155
- package/dist/shared/components/item-edit/line-midair.js +207 -0
- package/dist/shared/components/item-edit/soft-rules.js +27 -0
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/panels/CommentPanel.js +290 -284
- package/dist/shared/components/panels/ItemLockBanner.js +414 -358
- package/dist/shared/components/panels/PipelinePanel.js +1241 -992
- package/dist/shared/components/panels/RecordIntegrityBanner.js +1 -1
- 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 +925 -871
- package/dist/shared/components/queue/column-chooser.js +21 -0
- package/dist/shared/components/queue/live-state-aspect.js +6 -0
- package/dist/shared/components/ui/number-draft-input.js +93 -0
- package/dist/shared/components/widgets/ReviewListWidget.js +191 -166
- package/dist/shared/lib/draft-store.js +48 -34
- package/dist/shared/lib/error-hints.js +1 -0
- package/dist/shared/lib/query-stats.js +60 -60
- package/package.json +1 -1
|
@@ -1,209 +1,259 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Copy as O, RotateCcw as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { toast as
|
|
5
|
-
import { useNivaroClient as
|
|
6
|
-
import { post as
|
|
7
|
-
import { titleCase as
|
|
1
|
+
import { jsxs as a, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { Copy as O, RotateCcw as $ } from "lucide-react";
|
|
3
|
+
import { useState as N } from "react";
|
|
4
|
+
import { toast as b } from "sonner";
|
|
5
|
+
import { useNivaroClient as q } from "../../context.js";
|
|
6
|
+
import { post as E } from "../../lib/commands.js";
|
|
7
|
+
import { titleCase as H, cn as R } from "../../lib/utils.js";
|
|
8
8
|
import { Button as w } from "../ui/button.js";
|
|
9
|
-
import { Dialog as
|
|
10
|
-
import { Input as
|
|
9
|
+
import { Dialog as K, DialogTrigger as P, DialogContent as Y, DialogHeader as A, DialogTitle as G, DialogFooter as Q } from "../ui/dialog.js";
|
|
10
|
+
import { Input as v } from "../ui/input.js";
|
|
11
11
|
import { Label as z } from "../ui/label.js";
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
import { NumberDraftInput as L } from "../ui/number-draft-input.js";
|
|
13
|
+
import { Switch as j } from "../ui/switch.js";
|
|
14
|
+
const U = /* @__PURE__ */ new Set(["id", "created_at", "updated_at", "created_by", "updated_by"]);
|
|
15
|
+
function V(n, l, r) {
|
|
16
|
+
if (U.has(n.field) || n.computed_formula) return !1;
|
|
17
|
+
const s = n.interface ?? "";
|
|
18
|
+
return !(["sub_rows", "repeater", "rich_text", "file", "image", "o2m", "m2m", "m2a"].includes(s) || ["sub_rows", "repeater", "rich_text"].includes(n.type) || l.some((f) => f.one_collection === r && f.one_field === n.field));
|
|
18
19
|
}
|
|
19
|
-
function W(
|
|
20
|
-
return
|
|
20
|
+
function W(n) {
|
|
21
|
+
return n.interface === "sub_rows" || n.type === "sub_rows";
|
|
21
22
|
}
|
|
22
|
-
function X(
|
|
23
|
-
if (!
|
|
23
|
+
function X(n) {
|
|
24
|
+
if (!n) return "";
|
|
24
25
|
try {
|
|
25
|
-
return new Date(String(
|
|
26
|
+
return new Date(String(n)).toISOString().slice(0, 16);
|
|
26
27
|
} catch {
|
|
27
28
|
return "";
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
|
-
function Z({
|
|
31
|
-
|
|
31
|
+
function Z({
|
|
32
|
+
field: n,
|
|
33
|
+
value: l,
|
|
34
|
+
onChange: r
|
|
35
|
+
}) {
|
|
36
|
+
return n.type === "boolean" ? /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
|
|
32
37
|
/* @__PURE__ */ t(
|
|
33
38
|
"input",
|
|
34
39
|
{
|
|
35
40
|
type: "checkbox",
|
|
36
|
-
checked: !!
|
|
37
|
-
onChange: (
|
|
41
|
+
checked: !!l,
|
|
42
|
+
onChange: (s) => r(s.target.checked),
|
|
38
43
|
className: "h-4 w-4 accent-nvr-cyan rounded"
|
|
39
44
|
}
|
|
40
45
|
),
|
|
41
|
-
/* @__PURE__ */ t("span", { className: "text-[12px] text-slate-500", children:
|
|
42
|
-
] }) :
|
|
43
|
-
|
|
46
|
+
/* @__PURE__ */ t("span", { className: "text-[12px] text-slate-500", children: l ? "Yes" : "No" })
|
|
47
|
+
] }) : n.type === "datetime" || n.interface === "datetime" ? /* @__PURE__ */ t(
|
|
48
|
+
v,
|
|
44
49
|
{
|
|
45
50
|
type: "datetime-local",
|
|
46
|
-
value: X(
|
|
47
|
-
onChange: (
|
|
51
|
+
value: X(l),
|
|
52
|
+
onChange: (s) => r(s.target.value ? new Date(s.target.value).toISOString() : null),
|
|
48
53
|
className: "h-7 text-[12px]"
|
|
49
54
|
}
|
|
50
|
-
) :
|
|
51
|
-
|
|
55
|
+
) : n.type === "date" ? /* @__PURE__ */ t(
|
|
56
|
+
v,
|
|
52
57
|
{
|
|
53
58
|
type: "date",
|
|
54
|
-
value:
|
|
55
|
-
onChange: (
|
|
59
|
+
value: l ? String(l).slice(0, 10) : "",
|
|
60
|
+
onChange: (s) => r(s.target.value || null),
|
|
56
61
|
className: "h-7 text-[12px]"
|
|
57
62
|
}
|
|
58
|
-
) :
|
|
59
|
-
|
|
63
|
+
) : n.type === "integer" || n.type === "bigInteger" ? /* @__PURE__ */ t(
|
|
64
|
+
L,
|
|
60
65
|
{
|
|
61
66
|
type: "number",
|
|
62
67
|
step: "1",
|
|
63
|
-
value:
|
|
64
|
-
|
|
68
|
+
value: l,
|
|
69
|
+
onValue: r,
|
|
65
70
|
className: "h-7 text-[12px]"
|
|
66
71
|
}
|
|
67
|
-
) :
|
|
68
|
-
|
|
72
|
+
) : n.type === "float" || n.type === "decimal" || n.type === "double" ? /* @__PURE__ */ t(
|
|
73
|
+
L,
|
|
69
74
|
{
|
|
70
75
|
type: "number",
|
|
71
76
|
step: "any",
|
|
72
|
-
value:
|
|
73
|
-
|
|
77
|
+
value: l,
|
|
78
|
+
onValue: r,
|
|
74
79
|
className: "h-7 text-[12px]"
|
|
75
80
|
}
|
|
76
81
|
) : /* @__PURE__ */ t(
|
|
77
|
-
|
|
82
|
+
v,
|
|
78
83
|
{
|
|
79
|
-
value:
|
|
80
|
-
onChange: (
|
|
84
|
+
value: l == null ? "" : String(l),
|
|
85
|
+
onChange: (s) => r(s.target.value || null),
|
|
81
86
|
className: "h-7 text-[12px]",
|
|
82
87
|
placeholder: "(empty)"
|
|
83
88
|
}
|
|
84
89
|
);
|
|
85
90
|
}
|
|
86
|
-
function
|
|
87
|
-
|
|
88
|
-
|
|
91
|
+
function fe({
|
|
92
|
+
collection: n,
|
|
93
|
+
itemId: l,
|
|
94
|
+
fields: r,
|
|
95
|
+
relations: s,
|
|
96
|
+
currentValues: m,
|
|
97
|
+
onSuccess: f
|
|
98
|
+
}) {
|
|
99
|
+
const B = q(), [J, p] = N(!1), [C, k] = N(!1), [S, h] = N({}), [_, I] = N({}), x = r.filter((e) => V(e, s, n)), g = r.filter(W);
|
|
100
|
+
function M() {
|
|
89
101
|
const e = {};
|
|
90
102
|
for (const o of x)
|
|
91
|
-
e[o.field] = { include: !0, value:
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
for (const o of
|
|
95
|
-
I(
|
|
103
|
+
e[o.field] = { include: !0, value: m[o.field] ?? null };
|
|
104
|
+
h(e);
|
|
105
|
+
const i = {};
|
|
106
|
+
for (const o of g) i[o.field] = !0;
|
|
107
|
+
I(i), p(!0);
|
|
96
108
|
}
|
|
97
|
-
function D(e,
|
|
98
|
-
return JSON.stringify(
|
|
109
|
+
function D(e, i) {
|
|
110
|
+
return JSON.stringify(i.value) !== JSON.stringify(m[e] ?? null);
|
|
99
111
|
}
|
|
100
|
-
async function
|
|
112
|
+
async function T() {
|
|
101
113
|
var e;
|
|
102
|
-
|
|
114
|
+
k(!0);
|
|
103
115
|
try {
|
|
104
|
-
const
|
|
116
|
+
const i = {}, o = [];
|
|
105
117
|
for (const d of x) {
|
|
106
|
-
const
|
|
107
|
-
if (
|
|
108
|
-
if (!
|
|
118
|
+
const y = S[d.field];
|
|
119
|
+
if (y) {
|
|
120
|
+
if (!y.include) {
|
|
109
121
|
o.push(d.field);
|
|
110
122
|
continue;
|
|
111
123
|
}
|
|
112
|
-
D(d.field,
|
|
124
|
+
D(d.field, y) && (i[d.field] = y.value);
|
|
113
125
|
}
|
|
114
126
|
}
|
|
115
|
-
const c =
|
|
116
|
-
|
|
127
|
+
const c = g.filter((d) => _[d.field]).map((d) => d.field), u = await B.request(
|
|
128
|
+
E(`/items/${n}/${l}/clone`, {
|
|
129
|
+
field_overrides: i,
|
|
130
|
+
exclude_fields: o,
|
|
131
|
+
include_sub_rows: c
|
|
132
|
+
})
|
|
117
133
|
);
|
|
118
|
-
|
|
134
|
+
p(!1);
|
|
119
135
|
const F = (e = u == null ? void 0 : u.data) == null ? void 0 : e.id;
|
|
120
136
|
if (F == null) {
|
|
121
|
-
|
|
137
|
+
b.success("Item cloned — open it from the list");
|
|
122
138
|
return;
|
|
123
139
|
}
|
|
124
|
-
|
|
140
|
+
b.success("Item cloned"), f(F);
|
|
125
141
|
} catch {
|
|
126
|
-
|
|
142
|
+
b.error("Failed to clone item");
|
|
127
143
|
} finally {
|
|
128
|
-
|
|
144
|
+
k(!1);
|
|
129
145
|
}
|
|
130
146
|
}
|
|
131
|
-
return /* @__PURE__ */
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
/* @__PURE__ */ t(
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
147
|
+
return /* @__PURE__ */ a(
|
|
148
|
+
K,
|
|
149
|
+
{
|
|
150
|
+
open: J,
|
|
151
|
+
onOpenChange: (e) => {
|
|
152
|
+
e ? M() : p(!1);
|
|
153
|
+
},
|
|
154
|
+
children: [
|
|
155
|
+
/* @__PURE__ */ t(P, { asChild: !0, children: /* @__PURE__ */ a(w, { size: "sm", variant: "outline", className: "gap-1.5", children: [
|
|
156
|
+
/* @__PURE__ */ t(O, { className: "h-3.5 w-3.5" }),
|
|
157
|
+
"Clone"
|
|
158
|
+
] }) }),
|
|
159
|
+
/* @__PURE__ */ a(Y, { className: "flex max-h-[85vh] max-w-lg flex-col overflow-hidden", children: [
|
|
160
|
+
/* @__PURE__ */ t(A, { className: "shrink-0 px-6 pt-6", children: /* @__PURE__ */ t(G, { className: "text-[15px]", children: "Clone item" }) }),
|
|
161
|
+
/* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-y-auto px-6 py-4", children: /* @__PURE__ */ a("div", { className: "space-y-4", children: [
|
|
162
|
+
x.length > 0 && /* @__PURE__ */ a("div", { children: [
|
|
163
|
+
/* @__PURE__ */ t("p", { className: "mb-2 text-[11px] font-medium uppercase tracking-wide text-slate-400", children: "Field values" }),
|
|
164
|
+
/* @__PURE__ */ t("div", { className: "space-y-2", children: x.map((e) => {
|
|
165
|
+
const i = S[e.field];
|
|
166
|
+
if (!i) return null;
|
|
167
|
+
const o = D(e.field, i);
|
|
168
|
+
return /* @__PURE__ */ a("div", { className: "flex items-start gap-2", children: [
|
|
169
|
+
/* @__PURE__ */ t(
|
|
170
|
+
j,
|
|
171
|
+
{
|
|
172
|
+
checked: i.include,
|
|
173
|
+
onCheckedChange: () => h((c) => ({
|
|
174
|
+
...c,
|
|
175
|
+
[e.field]: { ...c[e.field], include: !c[e.field].include }
|
|
176
|
+
})),
|
|
177
|
+
className: "mt-1 shrink-0 scale-75"
|
|
178
|
+
}
|
|
179
|
+
),
|
|
180
|
+
/* @__PURE__ */ t(
|
|
181
|
+
z,
|
|
182
|
+
{
|
|
183
|
+
className: R(
|
|
184
|
+
"mt-1.5 w-32 shrink-0 truncate text-[12px]",
|
|
185
|
+
!i.include && "text-slate-400 line-through"
|
|
186
|
+
),
|
|
187
|
+
children: H(e.field)
|
|
188
|
+
}
|
|
189
|
+
),
|
|
190
|
+
/* @__PURE__ */ t(
|
|
191
|
+
"div",
|
|
192
|
+
{
|
|
193
|
+
className: R(
|
|
194
|
+
"flex-1",
|
|
195
|
+
!i.include && "pointer-events-none opacity-40"
|
|
196
|
+
),
|
|
197
|
+
children: /* @__PURE__ */ t(
|
|
198
|
+
Z,
|
|
199
|
+
{
|
|
200
|
+
field: e,
|
|
201
|
+
value: i.value,
|
|
202
|
+
onChange: (c) => h((u) => ({
|
|
203
|
+
...u,
|
|
204
|
+
[e.field]: { ...u[e.field], value: c }
|
|
205
|
+
}))
|
|
206
|
+
}
|
|
207
|
+
)
|
|
208
|
+
}
|
|
209
|
+
),
|
|
210
|
+
o && i.include && /* @__PURE__ */ t(
|
|
211
|
+
"button",
|
|
212
|
+
{
|
|
213
|
+
type: "button",
|
|
214
|
+
title: "Reset to original",
|
|
215
|
+
onClick: () => h((c) => ({
|
|
216
|
+
...c,
|
|
217
|
+
[e.field]: { ...c[e.field], value: m[e.field] ?? null }
|
|
218
|
+
})),
|
|
219
|
+
className: "mt-1.5 shrink-0 text-slate-400 hover:text-slate-600",
|
|
220
|
+
children: /* @__PURE__ */ t($, { className: "h-3.5 w-3.5" })
|
|
221
|
+
}
|
|
222
|
+
)
|
|
223
|
+
] }, e.field);
|
|
224
|
+
}) })
|
|
225
|
+
] }),
|
|
226
|
+
g.length > 0 && /* @__PURE__ */ a("div", { children: [
|
|
227
|
+
/* @__PURE__ */ t("p", { className: "mb-2 text-[11px] font-medium uppercase tracking-wide text-slate-400", children: "Sub-rows" }),
|
|
228
|
+
/* @__PURE__ */ t("div", { className: "space-y-2", children: g.map((e) => /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
|
|
229
|
+
/* @__PURE__ */ t(
|
|
230
|
+
j,
|
|
231
|
+
{
|
|
232
|
+
checked: !!_[e.field],
|
|
233
|
+
onCheckedChange: (i) => I((o) => ({ ...o, [e.field]: i })),
|
|
234
|
+
className: "shrink-0 scale-75"
|
|
235
|
+
}
|
|
236
|
+
),
|
|
237
|
+
/* @__PURE__ */ a(z, { className: "text-[12px]", children: [
|
|
238
|
+
"Include ",
|
|
239
|
+
/* @__PURE__ */ t("span", { className: "font-mono", children: e.field }),
|
|
240
|
+
" sub-rows"
|
|
241
|
+
] })
|
|
242
|
+
] }, e.field)) })
|
|
193
243
|
] })
|
|
194
|
-
] }
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
244
|
+
] }) }),
|
|
245
|
+
/* @__PURE__ */ a(Q, { className: "shrink-0 border-t border-slate-100 px-6 py-4 dark:border-border", children: [
|
|
246
|
+
/* @__PURE__ */ t(w, { variant: "outline", size: "sm", onClick: () => p(!1), children: "Cancel" }),
|
|
247
|
+
/* @__PURE__ */ a(w, { size: "sm", disabled: C, onClick: T, children: [
|
|
248
|
+
/* @__PURE__ */ t(O, { className: "mr-1.5 h-3.5 w-3.5" }),
|
|
249
|
+
C ? "Cloning…" : "Clone"
|
|
250
|
+
] })
|
|
251
|
+
] })
|
|
202
252
|
] })
|
|
203
|
-
]
|
|
204
|
-
|
|
205
|
-
|
|
253
|
+
]
|
|
254
|
+
}
|
|
255
|
+
);
|
|
206
256
|
}
|
|
207
257
|
export {
|
|
208
|
-
|
|
258
|
+
fe as CloneDialog
|
|
209
259
|
};
|
|
@@ -1,139 +1,144 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { History as
|
|
3
|
-
import { useState as
|
|
1
|
+
import { jsxs as a, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { History as R, ExternalLink as S, RotateCcw as D, Trash2 as T } from "lucide-react";
|
|
3
|
+
import { useState as N, useEffect as E } from "react";
|
|
4
4
|
import { useItemNavigation as H } from "../../context.js";
|
|
5
|
-
import { formatRelative as
|
|
6
|
-
const
|
|
7
|
-
if (
|
|
8
|
-
if (typeof
|
|
9
|
-
const c = typeof
|
|
5
|
+
import { formatRelative as k, titleCase as w } from "../../lib/utils.js";
|
|
6
|
+
const y = (t) => {
|
|
7
|
+
if (t == null || t === "") return "empty";
|
|
8
|
+
if (typeof t == "boolean") return t ? "Yes" : "No";
|
|
9
|
+
const c = typeof t == "object" ? JSON.stringify(t) : String(t);
|
|
10
10
|
return c.length > 60 ? `${c.slice(0, 60)}…` : c;
|
|
11
11
|
};
|
|
12
|
-
function
|
|
13
|
-
draft:
|
|
12
|
+
function q({
|
|
13
|
+
draft: t,
|
|
14
14
|
labelFor: c,
|
|
15
|
-
current:
|
|
16
|
-
recordChanged:
|
|
17
|
-
onRestore:
|
|
18
|
-
onDiscard:
|
|
15
|
+
current: f,
|
|
16
|
+
recordChanged: $,
|
|
17
|
+
onRestore: j,
|
|
18
|
+
onDiscard: O,
|
|
19
19
|
createdId: s = null,
|
|
20
20
|
collection: x,
|
|
21
21
|
renderValue: p
|
|
22
22
|
}) {
|
|
23
|
-
const [
|
|
24
|
-
|
|
23
|
+
const [g, _] = N(!1), [, C] = N(0);
|
|
24
|
+
E(() => {
|
|
25
|
+
const e = setInterval(() => C((r) => r + 1), 3e4);
|
|
26
|
+
return () => clearInterval(e);
|
|
27
|
+
}, []);
|
|
28
|
+
const v = H(), b = Object.entries(t.fields ?? {}), h = s !== null, u = Object.values(t.pending_rows ?? {}).reduce((e, r) => e + r.length, 0), l = Object.values(t.pending_edits ?? {}).reduce(
|
|
29
|
+
(e, r) => e + Object.keys(r).length,
|
|
25
30
|
0
|
|
26
|
-
), o = Object.values(
|
|
27
|
-
return b.length && i.push(`${b.length} field${b.length === 1 ? "" : "s"}`), u && i.push(`${u} new line${u === 1 ? "" : "s"}`), l && i.push(`${l} line edit${l === 1 ? "" : "s"}`), o && i.push(`${o} line removal${o === 1 ? "" : "s"}`), m && i.push(`${m} link${m === 1 ? "" : "s"}`), d && i.push(`${d} unlink${d === 1 ? "" : "s"}`), /* @__PURE__ */
|
|
31
|
+
), o = Object.values(t.pending_deletes ?? {}).reduce((e, r) => e + r.length, 0), m = Object.values(t.m2m_links ?? {}).reduce((e, r) => e + r.length, 0), d = Object.values(t.m2m_unlinks ?? {}).reduce((e, r) => e + r.length, 0), i = [];
|
|
32
|
+
return b.length && i.push(`${b.length} field${b.length === 1 ? "" : "s"}`), u && i.push(`${u} new line${u === 1 ? "" : "s"}`), l && i.push(`${l} line edit${l === 1 ? "" : "s"}`), o && i.push(`${o} line removal${o === 1 ? "" : "s"}`), m && i.push(`${m} link${m === 1 ? "" : "s"}`), d && i.push(`${d} unlink${d === 1 ? "" : "s"}`), /* @__PURE__ */ a(
|
|
28
33
|
"div",
|
|
29
34
|
{
|
|
30
35
|
className: "mb-2 rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-[12.5px] text-amber-900 dark:border-amber-500/40 dark:bg-amber-500/10 dark:text-amber-200",
|
|
31
36
|
"data-nvr-draft-recovery": !0,
|
|
32
37
|
children: [
|
|
33
|
-
/* @__PURE__ */
|
|
34
|
-
/* @__PURE__ */ n(
|
|
35
|
-
/* @__PURE__ */
|
|
36
|
-
h ? /* @__PURE__ */
|
|
38
|
+
/* @__PURE__ */ a("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
39
|
+
/* @__PURE__ */ n(R, { className: "h-4 w-4 shrink-0 text-amber-600 dark:text-amber-400" }),
|
|
40
|
+
/* @__PURE__ */ a("span", { className: "min-w-0 flex-1", children: [
|
|
41
|
+
h ? /* @__PURE__ */ a("span", { className: "font-semibold", "data-nvr-draft-created": !0, children: [
|
|
37
42
|
"These changes from ",
|
|
38
|
-
|
|
43
|
+
k(t.saved_at),
|
|
39
44
|
" were already saved",
|
|
40
45
|
s ? ` as record ${s}` : " as a new record",
|
|
41
46
|
" — restoring them makes a second one."
|
|
42
|
-
] }) : /* @__PURE__ */
|
|
47
|
+
] }) : /* @__PURE__ */ a("span", { className: "font-semibold", children: [
|
|
43
48
|
"Restore your unsaved changes from ",
|
|
44
|
-
|
|
49
|
+
k(t.saved_at),
|
|
45
50
|
"?"
|
|
46
51
|
] }),
|
|
47
52
|
" ",
|
|
48
53
|
/* @__PURE__ */ n("span", { className: "text-amber-800/80 dark:text-amber-200/80", children: i.join(" · ") }),
|
|
49
|
-
|
|
54
|
+
$ && /* @__PURE__ */ n("span", { className: "ml-1 rounded bg-amber-200/70 px-1 py-px text-[10.5px] font-semibold uppercase tracking-wide text-amber-900 dark:bg-amber-500/30 dark:text-amber-100", children: "record changed since — review before restoring" })
|
|
50
55
|
] }),
|
|
51
56
|
/* @__PURE__ */ n(
|
|
52
57
|
"button",
|
|
53
58
|
{
|
|
54
59
|
type: "button",
|
|
55
|
-
onClick: () =>
|
|
60
|
+
onClick: () => _((e) => !e),
|
|
56
61
|
className: "text-[11.5px] underline decoration-dotted underline-offset-2",
|
|
57
|
-
children:
|
|
62
|
+
children: g ? "Hide changes" : "Show changes"
|
|
58
63
|
}
|
|
59
64
|
),
|
|
60
|
-
h && s && x && /* @__PURE__ */
|
|
65
|
+
h && s && x && /* @__PURE__ */ a(
|
|
61
66
|
"a",
|
|
62
67
|
{
|
|
63
|
-
href:
|
|
68
|
+
href: v.urlFor({ collection: x, itemId: s }),
|
|
64
69
|
onClick: (e) => {
|
|
65
|
-
e.preventDefault(),
|
|
70
|
+
e.preventDefault(), v.open({ collection: x, itemId: s });
|
|
66
71
|
},
|
|
67
72
|
className: "inline-flex h-7 items-center gap-1 rounded-md bg-amber-600 px-2.5 text-[11.5px] font-semibold text-white hover:bg-amber-700",
|
|
68
73
|
"data-nvr-draft-open-created": !0,
|
|
69
74
|
children: [
|
|
70
|
-
/* @__PURE__ */ n(
|
|
75
|
+
/* @__PURE__ */ n(S, { className: "h-3 w-3" }),
|
|
71
76
|
" Open record ",
|
|
72
77
|
s
|
|
73
78
|
]
|
|
74
79
|
}
|
|
75
80
|
),
|
|
76
|
-
/* @__PURE__ */
|
|
81
|
+
/* @__PURE__ */ a(
|
|
77
82
|
"button",
|
|
78
83
|
{
|
|
79
84
|
type: "button",
|
|
80
|
-
onClick:
|
|
85
|
+
onClick: j,
|
|
81
86
|
className: h ? "inline-flex h-7 items-center gap-1 rounded-md border border-amber-300 px-2.5 text-[11.5px] font-medium hover:bg-amber-100 dark:border-amber-500/40 dark:hover:bg-amber-500/15" : "inline-flex h-7 items-center gap-1 rounded-md bg-amber-600 px-2.5 text-[11.5px] font-semibold text-white hover:bg-amber-700",
|
|
82
87
|
"data-nvr-draft-restore": !0,
|
|
83
88
|
children: [
|
|
84
|
-
/* @__PURE__ */ n(
|
|
89
|
+
/* @__PURE__ */ n(D, { className: "h-3 w-3" }),
|
|
85
90
|
" ",
|
|
86
91
|
h ? "Restore anyway" : "Restore"
|
|
87
92
|
]
|
|
88
93
|
}
|
|
89
94
|
),
|
|
90
|
-
/* @__PURE__ */
|
|
95
|
+
/* @__PURE__ */ a(
|
|
91
96
|
"button",
|
|
92
97
|
{
|
|
93
98
|
type: "button",
|
|
94
|
-
onClick:
|
|
99
|
+
onClick: O,
|
|
95
100
|
className: "inline-flex h-7 items-center gap-1 rounded-md border border-amber-300 px-2.5 text-[11.5px] font-medium hover:bg-amber-100 dark:border-amber-500/40 dark:hover:bg-amber-500/15",
|
|
96
101
|
"data-nvr-draft-discard": !0,
|
|
97
102
|
children: [
|
|
98
|
-
/* @__PURE__ */ n(
|
|
103
|
+
/* @__PURE__ */ n(T, { className: "h-3 w-3" }),
|
|
99
104
|
" Discard"
|
|
100
105
|
]
|
|
101
106
|
}
|
|
102
107
|
)
|
|
103
108
|
] }),
|
|
104
|
-
|
|
105
|
-
b.map(([e,
|
|
106
|
-
/* @__PURE__ */ n("span", { className: "font-medium", children: c(e) ||
|
|
107
|
-
/* @__PURE__ */
|
|
108
|
-
/* @__PURE__ */ n("span", { className: "line-through opacity-70", children: p ? p(e,
|
|
109
|
+
g && /* @__PURE__ */ a("div", { className: "mt-2 max-h-[240px] space-y-1 overflow-y-auto border-t border-amber-200/70 pt-2 dark:border-amber-500/30", children: [
|
|
110
|
+
b.map(([e, r]) => /* @__PURE__ */ a("div", { className: "text-[11.5px]", children: [
|
|
111
|
+
/* @__PURE__ */ n("span", { className: "font-medium", children: c(e) || w(e.replace(/_/g, " ")) }),
|
|
112
|
+
/* @__PURE__ */ a("p", { className: "break-words text-amber-800/80 dark:text-amber-200/80", children: [
|
|
113
|
+
/* @__PURE__ */ n("span", { className: "line-through opacity-70", children: p ? p(e, f[e]) : y(f[e]) }),
|
|
109
114
|
" ",
|
|
110
|
-
/* @__PURE__ */ n("span", { className: "font-medium text-amber-900 dark:text-amber-100", children: p ? p(e,
|
|
115
|
+
/* @__PURE__ */ n("span", { className: "font-medium text-amber-900 dark:text-amber-100", children: p ? p(e, r) : y(r) })
|
|
111
116
|
] })
|
|
112
117
|
] }, e)),
|
|
113
|
-
Object.entries(
|
|
114
|
-
|
|
118
|
+
Object.entries(t.pending_rows ?? {}).filter(([, e]) => e.length > 0).map(([e, r]) => /* @__PURE__ */ a("p", { className: "text-[11.5px]", children: [
|
|
119
|
+
r.length,
|
|
115
120
|
" new line",
|
|
116
|
-
|
|
121
|
+
r.length === 1 ? "" : "s",
|
|
117
122
|
" in",
|
|
118
123
|
" ",
|
|
119
|
-
|
|
124
|
+
w(e.split(".")[0].replace(/_/g, " "))
|
|
120
125
|
] }, e)),
|
|
121
|
-
l > 0 && /* @__PURE__ */
|
|
126
|
+
l > 0 && /* @__PURE__ */ a("p", { className: "text-[11.5px]", children: [
|
|
122
127
|
l,
|
|
123
128
|
" edited line",
|
|
124
129
|
l === 1 ? "" : "s"
|
|
125
130
|
] }),
|
|
126
|
-
o > 0 && /* @__PURE__ */
|
|
131
|
+
o > 0 && /* @__PURE__ */ a("p", { className: "text-[11.5px]", children: [
|
|
127
132
|
o,
|
|
128
133
|
" line removal",
|
|
129
134
|
o === 1 ? "" : "s"
|
|
130
135
|
] }),
|
|
131
|
-
m > 0 && /* @__PURE__ */
|
|
136
|
+
m > 0 && /* @__PURE__ */ a("p", { className: "text-[11.5px]", children: [
|
|
132
137
|
m,
|
|
133
138
|
" relation link",
|
|
134
139
|
m === 1 ? "" : "s"
|
|
135
140
|
] }),
|
|
136
|
-
d > 0 && /* @__PURE__ */
|
|
141
|
+
d > 0 && /* @__PURE__ */ a("p", { className: "text-[11.5px]", children: [
|
|
137
142
|
d,
|
|
138
143
|
" relation removal",
|
|
139
144
|
d === 1 ? "" : "s"
|
|
@@ -144,5 +149,5 @@ function L({
|
|
|
144
149
|
);
|
|
145
150
|
}
|
|
146
151
|
export {
|
|
147
|
-
|
|
152
|
+
q as DraftRecoveryBanner
|
|
148
153
|
};
|