@nivaro/react 0.3.48 → 0.3.50
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 +25 -1
- package/dist/shared/components/CellCopyLayer.js +81 -44
- package/dist/shared/components/CollectionBrowserView.js +306 -297
- package/dist/shared/components/DataTable.js +3 -3
- package/dist/shared/components/FulfilmentPill.js +98 -78
- package/dist/shared/components/ItemEditForm.js +4682 -4570
- package/dist/shared/components/NotificationSourcesCard.js +151 -147
- package/dist/shared/components/ProfileView.js +72 -70
- package/dist/shared/components/QueryTable.js +462 -333
- package/dist/shared/components/imports/ImportConsole.js +4 -4
- package/dist/shared/components/integrations/console/IntegrationsConsole.js +58 -50
- package/dist/shared/components/item-edit/CatalogPickerField.js +1144 -1127
- package/dist/shared/components/item-edit/CloneDialog.js +192 -142
- package/dist/shared/components/item-edit/FieldRenderer.js +127 -126
- package/dist/shared/components/item-edit/FieldRow.js +236 -226
- package/dist/shared/components/item-edit/HeaderTools.js +118 -113
- package/dist/shared/components/item-edit/InlineGridField.js +92 -90
- package/dist/shared/components/item-edit/InlineTableField.js +3091 -2942
- 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/RelationCombobox.js +186 -181
- package/dist/shared/components/item-edit/SummaryPanel.js +148 -135
- package/dist/shared/components/item-edit/ValidationSummary.js +64 -47
- package/dist/shared/components/item-edit/helpers.js +181 -155
- package/dist/shared/components/item-edit/line-midair.js +201 -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/layout-editor/settings/ResolveSettings.js +65 -65
- package/dist/shared/components/layout-editor/settings/settings-registry.js +4 -4
- package/dist/shared/components/notifications/DeliveryChips.js +9 -9
- package/dist/shared/components/panels/ItemLockBanner.js +414 -358
- package/dist/shared/components/panels/PipelinePanel.js +1171 -975
- package/dist/shared/components/panels/RecordIntegrityBanner.js +1 -1
- package/dist/shared/components/panels/SlaBreachBanner.js +2 -2
- package/dist/shared/components/panels/TransitionRequirementsDialog.js +384 -380
- package/dist/shared/components/profile/PersonProfile.js +23 -21
- package/dist/shared/components/profile/SignedInDevices.js +126 -0
- package/dist/shared/components/queue/QueueItemSheet.js +38 -37
- package/dist/shared/components/queue/QueueWorklist.js +870 -827
- 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/support/SupportView.js +1 -1
- package/dist/shared/components/ui/number-draft-input.js +93 -0
- package/dist/shared/components/widgets/ReviewListWidget.js +191 -166
- package/dist/shared/lib/edit-lock-fields.js +7 -0
- package/dist/shared/lib/error-hints.js +1 -0
- package/dist/shared/lib/reimport-visibility.js +10 -0
- 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
|
};
|