@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,164 +1,223 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { get as
|
|
4
|
-
import { useOptionalNivaroClient as
|
|
5
|
-
function
|
|
6
|
-
|
|
1
|
+
import { jsx as r, jsxs as p } from "react/jsx-runtime";
|
|
2
|
+
import { useState as v, useRef as L, useEffect as _, useCallback as z } from "react";
|
|
3
|
+
import { get as M, del as W, post as H, patch as Q } from "../lib/commands.js";
|
|
4
|
+
import { useOptionalNivaroClient as T, useGridFlush as X } from "../shared/context.js";
|
|
5
|
+
function Y({
|
|
6
|
+
value: o,
|
|
7
|
+
onValue: d,
|
|
8
|
+
placeholder: l
|
|
9
|
+
}) {
|
|
10
|
+
const [m, f] = v(null), i = o == null ? "" : String(o);
|
|
11
|
+
return /* @__PURE__ */ r(
|
|
12
|
+
"input",
|
|
13
|
+
{
|
|
14
|
+
type: "number",
|
|
15
|
+
value: m ?? i,
|
|
16
|
+
onChange: (c) => {
|
|
17
|
+
var $;
|
|
18
|
+
const g = c.target.value;
|
|
19
|
+
if (g === "" && (($ = c.target.validity) != null && $.badInput)) {
|
|
20
|
+
f("");
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (f(g), g.trim() === "") return d(null);
|
|
24
|
+
const w = Number(g);
|
|
25
|
+
Number.isFinite(w) && d(w);
|
|
26
|
+
},
|
|
27
|
+
onBlur: () => f(null),
|
|
28
|
+
placeholder: l,
|
|
29
|
+
"data-nf-grid-cell": !0
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
async function A(o, d, l) {
|
|
34
|
+
const m = /* @__PURE__ */ new Map(), f = [...new Set(l)].filter((i) => i && i !== "new");
|
|
35
|
+
for (let i = 0; i < f.length; i += 500)
|
|
36
|
+
try {
|
|
37
|
+
const c = await o.request(
|
|
38
|
+
M("/revisions/latest", {
|
|
39
|
+
collection: d,
|
|
40
|
+
items: f.slice(i, i + 500).join(",")
|
|
41
|
+
})
|
|
42
|
+
);
|
|
43
|
+
for (const [g, w] of Object.entries((c == null ? void 0 : c.data) ?? {}))
|
|
44
|
+
m.set(g, typeof w == "number" && Number.isFinite(w) ? w : null);
|
|
45
|
+
} catch {
|
|
46
|
+
}
|
|
47
|
+
return m;
|
|
48
|
+
}
|
|
49
|
+
function Z(o) {
|
|
50
|
+
var l;
|
|
51
|
+
const d = o == null ? void 0 : o.response;
|
|
52
|
+
return (((l = d == null ? void 0 : d.data) == null ? void 0 : l.code) ?? (d == null ? void 0 : d.code)) === "MIDAIR_COLLISION";
|
|
7
53
|
}
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
-
|
|
54
|
+
function V(o) {
|
|
55
|
+
return o.replace(/_/g, " ").replace(/\b\w/g, (d) => d.toUpperCase());
|
|
56
|
+
}
|
|
57
|
+
function it({
|
|
58
|
+
field: o,
|
|
59
|
+
itemId: d
|
|
11
60
|
}) {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
61
|
+
const l = T(), m = X(), f = o.relation, i = (f == null ? void 0 : f.relatedCollection) ?? "", c = (f == null ? void 0 : f.manyField) ?? "", [g, w] = v([]), [$, x] = v([]), [S, O] = v(/* @__PURE__ */ new Map()), [b, k] = v([]), [C, F] = v(/* @__PURE__ */ new Set()), y = L(!0);
|
|
62
|
+
_(() => (y.current = !0, () => {
|
|
63
|
+
y.current = !1;
|
|
15
64
|
}), []);
|
|
16
|
-
const
|
|
17
|
-
if (!(!
|
|
65
|
+
const B = S.size > 0 || b.length > 0 || C.size > 0, D = L(/* @__PURE__ */ new Map()), N = z(async () => {
|
|
66
|
+
if (!(!l || !d || !i || !c))
|
|
18
67
|
try {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
filter: JSON.stringify({ [
|
|
68
|
+
const n = (await l.request(
|
|
69
|
+
M(`/items/${i}`, {
|
|
70
|
+
filter: JSON.stringify({ [c]: { _eq: d } }),
|
|
22
71
|
limit: 200,
|
|
23
72
|
fields: "*"
|
|
24
73
|
})
|
|
25
|
-
);
|
|
26
|
-
|
|
74
|
+
)).data ?? [];
|
|
75
|
+
D.current = await A(
|
|
76
|
+
l,
|
|
77
|
+
i,
|
|
78
|
+
n.map((e) => String(e.id))
|
|
79
|
+
), y.current && x(n);
|
|
27
80
|
} catch {
|
|
28
|
-
|
|
81
|
+
y.current && x([]);
|
|
29
82
|
}
|
|
30
|
-
}, [
|
|
31
|
-
|
|
32
|
-
!
|
|
33
|
-
if (!
|
|
83
|
+
}, [l, d, i, c]);
|
|
84
|
+
_(() => {
|
|
85
|
+
!l || !i || l.request(M(`/field-config/${i}`)).then((t) => {
|
|
86
|
+
if (!y.current) return;
|
|
34
87
|
const n = (t.data ?? []).filter(
|
|
35
|
-
(
|
|
88
|
+
(e) => !e.field.startsWith("_") && e.field !== "id" && e.field !== c
|
|
36
89
|
);
|
|
37
|
-
|
|
90
|
+
w(n);
|
|
38
91
|
}).catch(() => {
|
|
39
92
|
});
|
|
40
|
-
}, [
|
|
93
|
+
}, [l, i, c]), _(() => {
|
|
41
94
|
N();
|
|
42
95
|
}, [N]);
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
96
|
+
const j = z(async () => {
|
|
97
|
+
if (!l) return;
|
|
98
|
+
for (const e of C)
|
|
99
|
+
await l.request(W(`/items/${i}/${e}`));
|
|
100
|
+
for (const e of b)
|
|
101
|
+
await l.request(H(`/items/${i}`, { ...e, [c]: d }));
|
|
102
|
+
const t = [...S].filter(([e]) => !C.has(e)), n = t.map(([e]) => e).filter((e) => !((D.current.get(e) ?? 0) > 0));
|
|
103
|
+
if (n.length > 0) {
|
|
104
|
+
const e = await A(l, i, n);
|
|
105
|
+
for (const [s, a] of e) D.current.set(s, a);
|
|
52
106
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
107
|
+
for (const [e, s] of t) {
|
|
108
|
+
const a = D.current.get(e);
|
|
109
|
+
try {
|
|
110
|
+
await l.request(
|
|
111
|
+
Q(
|
|
112
|
+
`/items/${i}/${e}`,
|
|
113
|
+
typeof a == "number" && a > 0 ? { ...s, _base_revision: a } : s
|
|
114
|
+
)
|
|
115
|
+
);
|
|
116
|
+
} catch (h) {
|
|
117
|
+
throw Z(h) && await N(), h;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
y.current && (O(/* @__PURE__ */ new Map()), k([]), F(/* @__PURE__ */ new Set()), await N());
|
|
121
|
+
}, [l, i, c, d, C, b, S, N]), I = `inline-grid:${i}:${c}`;
|
|
122
|
+
_(() => (m == null || m.register(I, j), () => m == null ? void 0 : m.unregister(I)), [m, I, j]);
|
|
123
|
+
function J(t, n, e, s) {
|
|
124
|
+
var a, h;
|
|
125
|
+
return e ? ((a = b[s]) == null ? void 0 : a[n]) ?? "" : ((h = S.get(String(t.id))) == null ? void 0 : h[n]) ?? t[n] ?? "";
|
|
58
126
|
}
|
|
59
|
-
function
|
|
60
|
-
if (
|
|
61
|
-
|
|
127
|
+
function K(t, n, e, s, a) {
|
|
128
|
+
if (s) {
|
|
129
|
+
k((R) => R.map((u, P) => P === a ? { ...u, [n]: e } : u));
|
|
62
130
|
return;
|
|
63
131
|
}
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
return
|
|
132
|
+
const h = String(t.id);
|
|
133
|
+
O((R) => {
|
|
134
|
+
const u = new Map(R);
|
|
135
|
+
return u.set(h, { ...u.get(h) ?? {}, [n]: e }), u;
|
|
68
136
|
});
|
|
69
137
|
}
|
|
70
|
-
function
|
|
71
|
-
const
|
|
72
|
-
return t.type === "boolean" ? /* @__PURE__ */
|
|
138
|
+
function U(t, n, e, s) {
|
|
139
|
+
const a = J(n, t.field, e, s), h = (u) => K(n, t.field, u, e, s), R = ["integer", "bigInteger", "float", "decimal", "numeric"].includes(t.type);
|
|
140
|
+
return t.type === "boolean" ? /* @__PURE__ */ r(
|
|
73
141
|
"input",
|
|
74
142
|
{
|
|
75
143
|
type: "checkbox",
|
|
76
|
-
checked: !!
|
|
77
|
-
onChange: (
|
|
144
|
+
checked: !!a,
|
|
145
|
+
onChange: (u) => h(u.target.checked),
|
|
78
146
|
"data-nf-grid-cell-checkbox": !0
|
|
79
147
|
}
|
|
80
|
-
) :
|
|
81
|
-
"input",
|
|
82
|
-
{
|
|
83
|
-
type: "number",
|
|
84
|
-
value: i == null ? "" : String(i),
|
|
85
|
-
onChange: (a) => u(a.target.value === "" ? null : Number(a.target.value)),
|
|
86
|
-
placeholder: t.note ?? void 0,
|
|
87
|
-
"data-nf-grid-cell": !0
|
|
88
|
-
}
|
|
89
|
-
) : t.type === "datetime" || t.interface === "datetime" ? /* @__PURE__ */ e(
|
|
148
|
+
) : R ? /* @__PURE__ */ r(Y, { value: a, onValue: h, placeholder: t.note ?? void 0 }) : t.type === "datetime" || t.interface === "datetime" ? /* @__PURE__ */ r(
|
|
90
149
|
"input",
|
|
91
150
|
{
|
|
92
151
|
type: "datetime-local",
|
|
93
|
-
value:
|
|
94
|
-
onChange: (
|
|
152
|
+
value: a ? String(a).slice(0, 16) : "",
|
|
153
|
+
onChange: (u) => h(u.target.value ? new Date(u.target.value).toISOString() : null),
|
|
95
154
|
"data-nf-grid-cell": !0
|
|
96
155
|
}
|
|
97
|
-
) : /* @__PURE__ */
|
|
156
|
+
) : /* @__PURE__ */ r(
|
|
98
157
|
"input",
|
|
99
158
|
{
|
|
100
159
|
type: "text",
|
|
101
|
-
value:
|
|
102
|
-
onChange: (
|
|
160
|
+
value: a == null ? "" : String(a),
|
|
161
|
+
onChange: (u) => h(u.target.value || null),
|
|
103
162
|
placeholder: t.note ?? void 0,
|
|
104
163
|
"data-nf-grid-cell": !0
|
|
105
164
|
}
|
|
106
165
|
);
|
|
107
166
|
}
|
|
108
|
-
if (!
|
|
109
|
-
return /* @__PURE__ */
|
|
110
|
-
const
|
|
111
|
-
...
|
|
112
|
-
...
|
|
113
|
-
],
|
|
167
|
+
if (!d)
|
|
168
|
+
return /* @__PURE__ */ r("div", { "data-nf-inline-grid": !0, "data-nf-inline-grid-empty": !0, children: /* @__PURE__ */ r("p", { "data-nf-empty": !0, children: "Save the record first to manage related rows." }) });
|
|
169
|
+
const E = $.filter((t) => !C.has(String(t.id))), q = [
|
|
170
|
+
...E.map((t) => ({ ...t, ...S.get(String(t.id)) ?? {} })),
|
|
171
|
+
...b
|
|
172
|
+
], G = g.filter(
|
|
114
173
|
(t) => ["integer", "bigInteger", "float", "decimal", "numeric"].includes(t.type)
|
|
115
174
|
);
|
|
116
|
-
return /* @__PURE__ */
|
|
117
|
-
/* @__PURE__ */
|
|
118
|
-
|
|
119
|
-
|
|
175
|
+
return /* @__PURE__ */ p("div", { "data-nf-inline-grid": !0, children: [
|
|
176
|
+
/* @__PURE__ */ p("span", { "data-nf-inline-grid-label": !0, children: [
|
|
177
|
+
o.label ?? V(o.field),
|
|
178
|
+
o.note ? /* @__PURE__ */ p("span", { "data-nf-inline-grid-note": !0, title: o.note, children: [
|
|
120
179
|
" ",
|
|
121
180
|
"?"
|
|
122
181
|
] }) : null
|
|
123
182
|
] }),
|
|
124
|
-
|
|
125
|
-
/* @__PURE__ */
|
|
126
|
-
/* @__PURE__ */
|
|
127
|
-
/* @__PURE__ */
|
|
128
|
-
|
|
129
|
-
/* @__PURE__ */
|
|
183
|
+
B && /* @__PURE__ */ r("div", { "data-nf-inline-grid-pending": !0, children: "Unsaved changes — will save with the record" }),
|
|
184
|
+
/* @__PURE__ */ p("div", { "data-nf-inline-grid-wrap": !0, children: [
|
|
185
|
+
/* @__PURE__ */ r("div", { "data-nf-inline-grid-scroll": !0, children: /* @__PURE__ */ p("table", { "data-nf-inline-grid-table": !0, children: [
|
|
186
|
+
/* @__PURE__ */ r("thead", { children: /* @__PURE__ */ p("tr", { children: [
|
|
187
|
+
g.map((t) => /* @__PURE__ */ r("th", { "data-nf-grid-th": !0, children: t.label ?? V(t.field) }, t.field)),
|
|
188
|
+
/* @__PURE__ */ r("th", { "data-nf-grid-th-action": !0 })
|
|
130
189
|
] }) }),
|
|
131
|
-
/* @__PURE__ */
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
/* @__PURE__ */
|
|
190
|
+
/* @__PURE__ */ p("tbody", { children: [
|
|
191
|
+
E.map((t) => /* @__PURE__ */ p("tr", { "data-nf-grid-row": !0, children: [
|
|
192
|
+
g.map((n) => /* @__PURE__ */ r("td", { "data-nf-grid-td": !0, children: U(n, t, !1, -1) }, n.field)),
|
|
193
|
+
/* @__PURE__ */ r("td", { "data-nf-grid-td-action": !0, children: /* @__PURE__ */ r(
|
|
135
194
|
"button",
|
|
136
195
|
{
|
|
137
196
|
type: "button",
|
|
138
197
|
"data-nf-grid-delete": !0,
|
|
139
198
|
"aria-label": "Delete row",
|
|
140
|
-
onClick: () =>
|
|
141
|
-
const
|
|
142
|
-
return
|
|
199
|
+
onClick: () => F((n) => {
|
|
200
|
+
const e = new Set(n);
|
|
201
|
+
return e.add(String(t.id)), e;
|
|
143
202
|
}),
|
|
144
203
|
children: "×"
|
|
145
204
|
}
|
|
146
205
|
) })
|
|
147
206
|
] }, String(t.id))),
|
|
148
|
-
|
|
207
|
+
b.map((t, n) => /* @__PURE__ */ p(
|
|
149
208
|
"tr",
|
|
150
209
|
{
|
|
151
210
|
"data-nf-grid-row": !0,
|
|
152
211
|
"data-nf-grid-row-new": !0,
|
|
153
212
|
children: [
|
|
154
|
-
|
|
155
|
-
/* @__PURE__ */
|
|
213
|
+
g.map((e) => /* @__PURE__ */ r("td", { "data-nf-grid-td": !0, children: U(e, t, !0, n) }, e.field)),
|
|
214
|
+
/* @__PURE__ */ r("td", { "data-nf-grid-td-action": !0, children: /* @__PURE__ */ r(
|
|
156
215
|
"button",
|
|
157
216
|
{
|
|
158
217
|
type: "button",
|
|
159
218
|
"data-nf-grid-delete": !0,
|
|
160
219
|
"aria-label": "Remove new row",
|
|
161
|
-
onClick: () =>
|
|
220
|
+
onClick: () => k((e) => e.filter((s, a) => a !== n)),
|
|
162
221
|
children: "×"
|
|
163
222
|
}
|
|
164
223
|
) })
|
|
@@ -166,26 +225,26 @@ function tt({
|
|
|
166
225
|
},
|
|
167
226
|
t._rowId ?? `new-${n}`
|
|
168
227
|
)),
|
|
169
|
-
|
|
228
|
+
q.length === 0 && /* @__PURE__ */ r("tr", { children: /* @__PURE__ */ r("td", { colSpan: g.length + 1, "data-nf-grid-empty-row": !0, children: "No rows yet" }) })
|
|
170
229
|
] }),
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
if (!
|
|
174
|
-
const
|
|
175
|
-
return /* @__PURE__ */
|
|
230
|
+
G.length > 0 && q.length > 0 && /* @__PURE__ */ r("tfoot", { children: /* @__PURE__ */ p("tr", { "data-nf-grid-totals": !0, children: [
|
|
231
|
+
g.map((t) => {
|
|
232
|
+
if (!G.some((s) => s.field === t.field)) return /* @__PURE__ */ r("td", { "data-nf-grid-total-cell": !0 }, t.field);
|
|
233
|
+
const e = q.reduce((s, a) => s + (Number(a[t.field]) || 0), 0);
|
|
234
|
+
return /* @__PURE__ */ r("td", { "data-nf-grid-total-cell": !0, "data-nf-grid-total-num": !0, children: e.toLocaleString(void 0, {
|
|
176
235
|
minimumFractionDigits: 2,
|
|
177
236
|
maximumFractionDigits: 2
|
|
178
237
|
}) }, t.field);
|
|
179
238
|
}),
|
|
180
|
-
/* @__PURE__ */
|
|
239
|
+
/* @__PURE__ */ r("td", { "data-nf-grid-total-cell": !0 })
|
|
181
240
|
] }) })
|
|
182
241
|
] }) }),
|
|
183
|
-
/* @__PURE__ */
|
|
242
|
+
/* @__PURE__ */ r("div", { "data-nf-inline-grid-footer": !0, children: /* @__PURE__ */ r(
|
|
184
243
|
"button",
|
|
185
244
|
{
|
|
186
245
|
type: "button",
|
|
187
246
|
"data-nf-grid-add": !0,
|
|
188
|
-
onClick: () =>
|
|
247
|
+
onClick: () => k((t) => [...t, { _rowId: crypto.randomUUID() }]),
|
|
189
248
|
children: "+ Add row"
|
|
190
249
|
}
|
|
191
250
|
) })
|
|
@@ -193,5 +252,7 @@ function tt({
|
|
|
193
252
|
] });
|
|
194
253
|
}
|
|
195
254
|
export {
|
|
196
|
-
|
|
255
|
+
Y as GridNumberInput,
|
|
256
|
+
it as InlineGridField,
|
|
257
|
+
A as latestRevisions
|
|
197
258
|
};
|