@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,151 +1,181 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { useRelationOptions as
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import { jsx as r, jsxs as m } from "react/jsx-runtime";
|
|
2
|
+
import { useState as k, useEffect as F } from "react";
|
|
3
|
+
import { useRelationOptions as M, renderLabel as U } from "../../hooks/useRelationOptions.js";
|
|
4
|
+
import { get as P } from "../../lib/commands.js";
|
|
5
|
+
import { useOptionalNivaroClient as _ } from "../../shared/context.js";
|
|
6
|
+
import { relatedMissing as R } from "../../shared/components/item-edit/related-missing.js";
|
|
7
|
+
function z(e, t, o, a, s) {
|
|
8
|
+
const [l, v] = k(null), c = `${t}|${o}`;
|
|
9
|
+
return F(() => {
|
|
10
|
+
if (!e || !t || !o || a) return;
|
|
11
|
+
let p = !0;
|
|
12
|
+
return e.request(
|
|
13
|
+
P(`/items/${t}/${encodeURIComponent(o)}`)
|
|
14
|
+
).then((u) => {
|
|
15
|
+
if (!p) return;
|
|
16
|
+
const g = u == null ? void 0 : u.data;
|
|
17
|
+
v({
|
|
18
|
+
key: c,
|
|
19
|
+
text: g ? U(g, s, "") || "Unnamed record" : R(null).text
|
|
20
|
+
});
|
|
21
|
+
}).catch((u) => {
|
|
22
|
+
p && v({ key: c, text: R(u).text });
|
|
23
|
+
}), () => {
|
|
24
|
+
p = !1;
|
|
25
|
+
};
|
|
26
|
+
}, [e, t, o, a, s, c]), !o || a ? null : (l == null ? void 0 : l.key) === c ? l.text : "Loading…";
|
|
27
|
+
}
|
|
28
|
+
function Q({
|
|
6
29
|
field: e,
|
|
7
|
-
value:
|
|
8
|
-
onChange:
|
|
9
|
-
error:
|
|
10
|
-
disabled:
|
|
11
|
-
readOnly:
|
|
12
|
-
inputId:
|
|
13
|
-
errorId:
|
|
30
|
+
value: t,
|
|
31
|
+
onChange: o,
|
|
32
|
+
error: a,
|
|
33
|
+
disabled: s,
|
|
34
|
+
readOnly: l,
|
|
35
|
+
inputId: v,
|
|
36
|
+
errorId: c
|
|
14
37
|
}) {
|
|
15
|
-
var
|
|
16
|
-
const
|
|
17
|
-
options:
|
|
18
|
-
loading:
|
|
19
|
-
error:
|
|
20
|
-
} =
|
|
21
|
-
search:
|
|
22
|
-
displayTemplate: ((
|
|
23
|
-
enabled: !!
|
|
24
|
-
}),
|
|
25
|
-
|
|
38
|
+
var j, A, N, $;
|
|
39
|
+
const p = _(), [u, g] = k(""), S = ((j = e.relation) == null ? void 0 : j.relatedCollection) ?? "", {
|
|
40
|
+
options: y,
|
|
41
|
+
loading: b,
|
|
42
|
+
error: h
|
|
43
|
+
} = M(p, S, {
|
|
44
|
+
search: u || void 0,
|
|
45
|
+
displayTemplate: ((A = e.relation) == null ? void 0 : A.displayTemplate) ?? null,
|
|
46
|
+
enabled: !!S
|
|
47
|
+
}), f = v ?? e.field, q = (e.fieldType === "relation-o2m" || e.fieldType === "relation-m2m") && ((N = e.options) == null ? void 0 : N.max_values) === 1, C = (e.fieldType === "relation-o2m" || e.fieldType === "relation-m2m") && !q, x = C || q ? "" : t != null && typeof t == "object" ? String(t.id ?? "") : t == null ? "" : String(t), w = !x || b || y.some((n) => String(n.id) === x), L = z(
|
|
48
|
+
p,
|
|
49
|
+
S,
|
|
50
|
+
x,
|
|
51
|
+
w,
|
|
52
|
+
($ = e.relation) == null ? void 0 : $.displayTemplate
|
|
53
|
+
);
|
|
54
|
+
if (!p)
|
|
26
55
|
return /* @__PURE__ */ r("span", { role: "alert", "data-nivaro-field-error": !0, children: "No NivaroClient available — wrap in <NivaroProvider> or pass a client prop." });
|
|
27
|
-
if (!
|
|
56
|
+
if (!S)
|
|
28
57
|
return /* @__PURE__ */ r(
|
|
29
58
|
"input",
|
|
30
59
|
{
|
|
31
60
|
type: "text",
|
|
32
|
-
id:
|
|
61
|
+
id: f,
|
|
33
62
|
name: e.field,
|
|
34
|
-
value:
|
|
35
|
-
disabled:
|
|
36
|
-
readOnly:
|
|
63
|
+
value: t == null ? "" : String(t),
|
|
64
|
+
disabled: s,
|
|
65
|
+
readOnly: l,
|
|
37
66
|
"aria-required": e.required,
|
|
38
|
-
"aria-invalid":
|
|
39
|
-
"aria-describedby":
|
|
40
|
-
onChange: (
|
|
67
|
+
"aria-invalid": a != null && a.length > 0,
|
|
68
|
+
"aria-describedby": c,
|
|
69
|
+
onChange: (n) => o(n.target.value)
|
|
41
70
|
}
|
|
42
71
|
);
|
|
43
72
|
if (q) {
|
|
44
|
-
const
|
|
45
|
-
return /* @__PURE__ */
|
|
73
|
+
const n = Array.isArray(t) ? t : t != null ? [t] : [], i = n.length > 0 ? n[0] != null && typeof n[0] == "object" ? String(n[0].id ?? "") : String(n[0]) : "";
|
|
74
|
+
return /* @__PURE__ */ m("div", { children: [
|
|
46
75
|
/* @__PURE__ */ r(
|
|
47
76
|
"input",
|
|
48
77
|
{
|
|
49
78
|
type: "search",
|
|
50
79
|
placeholder: "Search…",
|
|
51
|
-
value:
|
|
52
|
-
disabled:
|
|
53
|
-
onChange: (
|
|
80
|
+
value: u,
|
|
81
|
+
disabled: s || l,
|
|
82
|
+
onChange: (d) => g(d.target.value)
|
|
54
83
|
}
|
|
55
84
|
),
|
|
56
|
-
/* @__PURE__ */
|
|
85
|
+
/* @__PURE__ */ m(
|
|
57
86
|
"select",
|
|
58
87
|
{
|
|
59
|
-
id:
|
|
88
|
+
id: f,
|
|
60
89
|
name: e.field,
|
|
61
90
|
required: e.required,
|
|
62
|
-
disabled:
|
|
63
|
-
value:
|
|
91
|
+
disabled: s || l,
|
|
92
|
+
value: i,
|
|
64
93
|
"aria-required": e.required,
|
|
65
|
-
"aria-invalid":
|
|
66
|
-
"aria-describedby":
|
|
67
|
-
onChange: (
|
|
94
|
+
"aria-invalid": a != null && a.length > 0,
|
|
95
|
+
"aria-describedby": c,
|
|
96
|
+
onChange: (d) => o(d.target.value === "" ? [] : [d.target.value]),
|
|
68
97
|
children: [
|
|
69
98
|
/* @__PURE__ */ r("option", { value: "", children: "—" }),
|
|
70
|
-
|
|
99
|
+
y.map((d) => /* @__PURE__ */ r("option", { value: String(d.id), children: d.label }, String(d.id)))
|
|
71
100
|
]
|
|
72
101
|
}
|
|
73
102
|
),
|
|
74
|
-
|
|
75
|
-
|
|
103
|
+
b ? /* @__PURE__ */ r("span", { "aria-live": "polite", children: "Loading…" }) : null,
|
|
104
|
+
h ? /* @__PURE__ */ r("span", { role: "alert", children: h.message }) : null
|
|
76
105
|
] });
|
|
77
106
|
}
|
|
78
|
-
if (
|
|
79
|
-
const
|
|
80
|
-
(
|
|
107
|
+
if (C) {
|
|
108
|
+
const n = Array.isArray(t) ? t.map(
|
|
109
|
+
(i) => i != null && typeof i == "object" ? String(i.id) : String(i)
|
|
81
110
|
) : [];
|
|
82
|
-
return /* @__PURE__ */
|
|
111
|
+
return /* @__PURE__ */ m("div", { children: [
|
|
83
112
|
/* @__PURE__ */ r(
|
|
84
113
|
"input",
|
|
85
114
|
{
|
|
86
115
|
type: "search",
|
|
87
116
|
placeholder: "Search…",
|
|
88
|
-
value:
|
|
89
|
-
disabled:
|
|
90
|
-
onChange: (
|
|
117
|
+
value: u,
|
|
118
|
+
disabled: s || l,
|
|
119
|
+
onChange: (i) => g(i.target.value)
|
|
91
120
|
}
|
|
92
121
|
),
|
|
93
122
|
/* @__PURE__ */ r(
|
|
94
123
|
"select",
|
|
95
124
|
{
|
|
96
|
-
id:
|
|
125
|
+
id: f,
|
|
97
126
|
name: e.field,
|
|
98
127
|
multiple: !0,
|
|
99
|
-
disabled:
|
|
100
|
-
value:
|
|
128
|
+
disabled: s || l,
|
|
129
|
+
value: n,
|
|
101
130
|
"aria-required": e.required,
|
|
102
|
-
"aria-invalid":
|
|
103
|
-
"aria-describedby":
|
|
104
|
-
onChange: (
|
|
105
|
-
const
|
|
106
|
-
|
|
131
|
+
"aria-invalid": a != null && a.length > 0,
|
|
132
|
+
"aria-describedby": c,
|
|
133
|
+
onChange: (i) => {
|
|
134
|
+
const d = Array.from(i.target.selectedOptions).map((E) => E.value);
|
|
135
|
+
o(d);
|
|
107
136
|
},
|
|
108
|
-
children:
|
|
137
|
+
children: y.map((i) => /* @__PURE__ */ r("option", { value: String(i.id), children: i.label }, String(i.id)))
|
|
109
138
|
}
|
|
110
139
|
),
|
|
111
|
-
|
|
112
|
-
|
|
140
|
+
b ? /* @__PURE__ */ r("span", { "aria-live": "polite", children: "Loading…" }) : null,
|
|
141
|
+
h ? /* @__PURE__ */ r("span", { role: "alert", children: h.message }) : null
|
|
113
142
|
] });
|
|
114
143
|
}
|
|
115
|
-
const
|
|
116
|
-
return /* @__PURE__ */
|
|
144
|
+
const T = t != null && typeof t == "object" ? String(t.id ?? "") : t == null ? "" : String(t);
|
|
145
|
+
return /* @__PURE__ */ m("div", { children: [
|
|
117
146
|
/* @__PURE__ */ r(
|
|
118
147
|
"input",
|
|
119
148
|
{
|
|
120
149
|
type: "search",
|
|
121
150
|
placeholder: "Search…",
|
|
122
|
-
value:
|
|
123
|
-
disabled:
|
|
124
|
-
onChange: (
|
|
151
|
+
value: u,
|
|
152
|
+
disabled: s || l,
|
|
153
|
+
onChange: (n) => g(n.target.value)
|
|
125
154
|
}
|
|
126
155
|
),
|
|
127
|
-
/* @__PURE__ */
|
|
156
|
+
/* @__PURE__ */ m(
|
|
128
157
|
"select",
|
|
129
158
|
{
|
|
130
|
-
id:
|
|
159
|
+
id: f,
|
|
131
160
|
name: e.field,
|
|
132
161
|
required: e.required,
|
|
133
|
-
disabled:
|
|
134
|
-
value:
|
|
162
|
+
disabled: s || l,
|
|
163
|
+
value: T,
|
|
135
164
|
"aria-required": e.required,
|
|
136
|
-
"aria-invalid":
|
|
137
|
-
"aria-describedby":
|
|
138
|
-
onChange: (
|
|
165
|
+
"aria-invalid": a != null && a.length > 0,
|
|
166
|
+
"aria-describedby": c,
|
|
167
|
+
onChange: (n) => o(n.target.value === "" ? null : n.target.value),
|
|
139
168
|
children: [
|
|
140
169
|
/* @__PURE__ */ r("option", { value: "", children: "—" }),
|
|
141
|
-
|
|
170
|
+
L != null && /* @__PURE__ */ r("option", { value: T, "data-nivaro-current-unlisted": !0, children: L }),
|
|
171
|
+
y.map((n) => /* @__PURE__ */ r("option", { value: String(n.id), children: n.label }, String(n.id)))
|
|
142
172
|
]
|
|
143
173
|
}
|
|
144
174
|
),
|
|
145
|
-
|
|
146
|
-
|
|
175
|
+
b ? /* @__PURE__ */ r("span", { "aria-live": "polite", children: "Loading…" }) : null,
|
|
176
|
+
h ? /* @__PURE__ */ r("span", { role: "alert", children: h.message }) : null
|
|
147
177
|
] });
|
|
148
178
|
}
|
|
149
179
|
export {
|
|
150
|
-
|
|
180
|
+
Q as RelationField
|
|
151
181
|
};
|