@nivaro/react 0.3.9 → 0.3.11
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/FileField.js +20 -19
- package/dist/full.css +1 -1
- package/dist/hooks/useNivaroForm.js +129 -126
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +103 -4
- package/dist/index.js +512 -501
- package/dist/shared/components/CollectionBrowserView.js +1632 -1564
- package/dist/shared/components/ConformanceView.js +36 -35
- package/dist/shared/components/ForceReloadBanner.js +58 -34
- package/dist/shared/components/ItemEditForm.js +4386 -4142
- package/dist/shared/components/JsonMapEditor.js +18 -17
- package/dist/shared/components/MatrixEditor.js +8 -7
- package/dist/shared/components/MyWorkView.js +32 -31
- package/dist/shared/components/PageRenderer.js +527 -479
- package/dist/shared/components/QueryStatStrip.js +74 -70
- package/dist/shared/components/RecordGridEditor.js +76 -75
- package/dist/shared/components/ReportView.js +818 -827
- package/dist/shared/components/SheetHeaderBody.js +16 -14
- package/dist/shared/components/ai/AiMemorySuggestions.js +15 -14
- package/dist/shared/components/ai/AskPanel.js +55 -54
- package/dist/shared/components/bulk/BulkActionButtons.js +30 -29
- package/dist/shared/components/bulk/PushBulkButtons.js +57 -56
- package/dist/shared/components/chat/SlashCommands.js +30 -29
- package/dist/shared/components/chat/chat-outbox.js +76 -75
- package/dist/shared/components/help-videos/recorder/useLeaveWarning.js +6 -5
- package/dist/shared/components/integrations/console/SignalCard.js +124 -123
- package/dist/shared/components/integrations/console/SnoozeMenu.js +24 -23
- package/dist/shared/components/item-edit/CatalogPickerField.js +1029 -933
- package/dist/shared/components/item-edit/CloneDialog.js +85 -78
- package/dist/shared/components/item-edit/FieldRenderer.js +161 -156
- package/dist/shared/components/item-edit/FieldRow.js +20 -19
- package/dist/shared/components/item-edit/FilePickerField.js +52 -40
- package/dist/shared/components/item-edit/GroupSection.js +221 -221
- package/dist/shared/components/item-edit/InlineGridField.js +41 -41
- package/dist/shared/components/item-edit/InlineTableField.js +2287 -2275
- package/dist/shared/components/item-edit/M2MCombobox.js +46 -44
- package/dist/shared/components/item-edit/MembershipSetField.js +24 -23
- package/dist/shared/components/item-edit/NestedRelationEditor.js +11 -11
- package/dist/shared/components/item-edit/QuickCreateButton.js +8 -7
- package/dist/shared/components/item-edit/QuickPicker.js +263 -216
- package/dist/shared/components/item-edit/RecordLiveSync.js +101 -100
- package/dist/shared/components/item-edit/RelationCombobox.js +285 -245
- package/dist/shared/components/item-edit/RichTextEditorImpl.js +42 -32
- package/dist/shared/components/item-edit/RowHistorySheet.js +130 -134
- package/dist/shared/components/item-edit/SummaryPanel.js +305 -279
- package/dist/shared/components/item-edit/helpers.js +133 -134
- package/dist/shared/components/item-edit/line-qty.js +57 -0
- package/dist/shared/components/item-edit/option-disambiguate.js +53 -0
- package/dist/shared/components/item-edit/staged-links.js +86 -0
- package/dist/shared/components/layout-editor/LayoutEditor.js +275 -274
- package/dist/shared/components/layout-editor/editors/cascade-rule-row.js +18 -17
- package/dist/shared/components/layout-editor/inspector/HelpTab.js +37 -36
- package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +50 -49
- package/dist/shared/components/panels/AddendumLinesDiff.js +87 -90
- package/dist/shared/components/panels/CommentPanel.js +350 -315
- package/dist/shared/components/panels/ItemLockBanner.js +297 -230
- package/dist/shared/components/panels/PipelinePanel.js +719 -701
- package/dist/shared/components/profile/AiMemoryCard.js +15 -14
- package/dist/shared/components/profile/PersonAdminTools.js +70 -67
- package/dist/shared/components/queue/QueueItemSheet.js +36 -35
- package/dist/shared/components/queue/QueueQuickFilters.js +43 -41
- package/dist/shared/components/queue/QueueWorklist.js +1026 -957
- package/dist/shared/components/widgets/ReviewListWidget.js +99 -93
- package/dist/shared/lib/client-version.js +63 -0
- package/dist/shared/lib/force-reload.js +36 -0
- package/dist/shared/lib/load-error.js +11 -10
- package/dist/shared/lib/obligation-banner.js +14 -13
- package/dist/shared/lib/obligation-reason-text.js +13 -0
- package/dist/shared/lib/presence-live.js +54 -35
- package/dist/shared/lib/query-filter-seed.js +34 -11
- package/dist/shared/lib/record-outbox.js +76 -75
- package/dist/shared/lib/safe-error.js +39 -0
- package/dist/shared/lib/sanitize-html.js +24 -15
- package/dist/shared/lib/server-clock.js +11 -7
- package/dist/shared/lib/sheet-def.js +38 -22
- package/dist/shared/lib/unique-options.js +10 -0
- package/dist/shared/lib/unsaved-work.js +62 -0
- package/dist/shared/lib/utils.js +57 -43
- package/dist/shared/lib/validation-rules.js +58 -34
- package/package.json +1 -1
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { jsxs as r, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { Copy as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { toast as
|
|
5
|
-
import { useNivaroClient as
|
|
6
|
-
import { post as
|
|
7
|
-
import { titleCase as
|
|
8
|
-
import { Button as
|
|
9
|
-
import { Dialog as
|
|
10
|
-
import { Input as
|
|
11
|
-
import { Label as
|
|
12
|
-
import { Switch as
|
|
13
|
-
const
|
|
14
|
-
function
|
|
15
|
-
if (
|
|
2
|
+
import { Copy as O, RotateCcw as T } from "lucide-react";
|
|
3
|
+
import { useState as b } from "react";
|
|
4
|
+
import { toast as v } from "sonner";
|
|
5
|
+
import { useNivaroClient as $ } from "../../context.js";
|
|
6
|
+
import { post as q } from "../../lib/commands.js";
|
|
7
|
+
import { titleCase as E, cn as R } from "../../lib/utils.js";
|
|
8
|
+
import { Button as w } from "../ui/button.js";
|
|
9
|
+
import { Dialog as H, DialogTrigger as K, DialogContent as P, DialogHeader as Y, DialogTitle as A, DialogFooter as G } from "../ui/dialog.js";
|
|
10
|
+
import { Input as m } from "../ui/input.js";
|
|
11
|
+
import { Label as z } from "../ui/label.js";
|
|
12
|
+
import { Switch as B } from "../ui/switch.js";
|
|
13
|
+
const Q = /* @__PURE__ */ new Set(["id", "created_at", "updated_at", "created_by", "updated_by"]);
|
|
14
|
+
function U(l, n, s) {
|
|
15
|
+
if (Q.has(l.field) || l.computed_formula) return !1;
|
|
16
16
|
const i = l.interface ?? "";
|
|
17
17
|
return !(["sub_rows", "repeater", "rich_text", "file", "image", "o2m", "m2m", "m2a"].includes(i) || ["sub_rows", "repeater", "rich_text"].includes(l.type) || n.some((p) => p.one_collection === s && p.one_field === l.field));
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function W(l) {
|
|
20
20
|
return l.interface === "sub_rows" || l.type === "sub_rows";
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function X(l) {
|
|
23
23
|
if (!l) return "";
|
|
24
24
|
try {
|
|
25
25
|
return new Date(String(l)).toISOString().slice(0, 16);
|
|
@@ -27,7 +27,7 @@ function U(l) {
|
|
|
27
27
|
return "";
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function Z({ field: l, value: n, onChange: s }) {
|
|
31
31
|
return l.type === "boolean" ? /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
32
32
|
/* @__PURE__ */ t(
|
|
33
33
|
"input",
|
|
@@ -40,15 +40,15 @@ function W({ field: l, value: n, onChange: s }) {
|
|
|
40
40
|
),
|
|
41
41
|
/* @__PURE__ */ t("span", { className: "text-[12px] text-slate-500", children: n ? "Yes" : "No" })
|
|
42
42
|
] }) : l.type === "datetime" || l.interface === "datetime" ? /* @__PURE__ */ t(
|
|
43
|
-
|
|
43
|
+
m,
|
|
44
44
|
{
|
|
45
45
|
type: "datetime-local",
|
|
46
|
-
value:
|
|
46
|
+
value: X(n),
|
|
47
47
|
onChange: (i) => s(i.target.value ? new Date(i.target.value).toISOString() : null),
|
|
48
48
|
className: "h-7 text-[12px]"
|
|
49
49
|
}
|
|
50
50
|
) : l.type === "date" ? /* @__PURE__ */ t(
|
|
51
|
-
|
|
51
|
+
m,
|
|
52
52
|
{
|
|
53
53
|
type: "date",
|
|
54
54
|
value: n ? String(n).slice(0, 10) : "",
|
|
@@ -56,7 +56,7 @@ function W({ field: l, value: n, onChange: s }) {
|
|
|
56
56
|
className: "h-7 text-[12px]"
|
|
57
57
|
}
|
|
58
58
|
) : l.type === "integer" || l.type === "bigInteger" ? /* @__PURE__ */ t(
|
|
59
|
-
|
|
59
|
+
m,
|
|
60
60
|
{
|
|
61
61
|
type: "number",
|
|
62
62
|
step: "1",
|
|
@@ -65,7 +65,7 @@ function W({ field: l, value: n, onChange: s }) {
|
|
|
65
65
|
className: "h-7 text-[12px]"
|
|
66
66
|
}
|
|
67
67
|
) : l.type === "float" || l.type === "decimal" || l.type === "double" ? /* @__PURE__ */ t(
|
|
68
|
-
|
|
68
|
+
m,
|
|
69
69
|
{
|
|
70
70
|
type: "number",
|
|
71
71
|
step: "any",
|
|
@@ -74,7 +74,7 @@ function W({ field: l, value: n, onChange: s }) {
|
|
|
74
74
|
className: "h-7 text-[12px]"
|
|
75
75
|
}
|
|
76
76
|
) : /* @__PURE__ */ t(
|
|
77
|
-
|
|
77
|
+
m,
|
|
78
78
|
{
|
|
79
79
|
value: n == null ? "" : String(n),
|
|
80
80
|
onChange: (i) => s(i.target.value || null),
|
|
@@ -83,103 +83,110 @@ function W({ field: l, value: n, onChange: s }) {
|
|
|
83
83
|
}
|
|
84
84
|
);
|
|
85
85
|
}
|
|
86
|
-
function
|
|
87
|
-
const
|
|
88
|
-
function
|
|
86
|
+
function ue({ collection: l, itemId: n, fields: s, relations: i, currentValues: f, onSuccess: p }) {
|
|
87
|
+
const L = $(), [j, h] = b(!1), [C, S] = b(!1), [k, g] = b({}), [_, I] = b({}), x = s.filter((e) => U(e, i, l)), y = s.filter(W);
|
|
88
|
+
function J() {
|
|
89
89
|
const e = {};
|
|
90
|
-
for (const
|
|
91
|
-
e[
|
|
92
|
-
|
|
90
|
+
for (const o of x)
|
|
91
|
+
e[o.field] = { include: !0, value: f[o.field] ?? null };
|
|
92
|
+
g(e);
|
|
93
93
|
const a = {};
|
|
94
|
-
for (const
|
|
95
|
-
|
|
94
|
+
for (const o of y) a[o.field] = !0;
|
|
95
|
+
I(a), h(!0);
|
|
96
96
|
}
|
|
97
|
-
function
|
|
98
|
-
return JSON.stringify(a.value) !== JSON.stringify(
|
|
97
|
+
function D(e, a) {
|
|
98
|
+
return JSON.stringify(a.value) !== JSON.stringify(f[e] ?? null);
|
|
99
99
|
}
|
|
100
|
-
async function
|
|
101
|
-
|
|
100
|
+
async function M() {
|
|
101
|
+
var e;
|
|
102
|
+
S(!0);
|
|
102
103
|
try {
|
|
103
|
-
const
|
|
104
|
-
for (const
|
|
105
|
-
const
|
|
106
|
-
if (
|
|
107
|
-
if (!
|
|
108
|
-
|
|
104
|
+
const a = {}, o = [];
|
|
105
|
+
for (const d of x) {
|
|
106
|
+
const N = k[d.field];
|
|
107
|
+
if (N) {
|
|
108
|
+
if (!N.include) {
|
|
109
|
+
o.push(d.field);
|
|
109
110
|
continue;
|
|
110
111
|
}
|
|
111
|
-
|
|
112
|
+
D(d.field, N) && (a[d.field] = N.value);
|
|
112
113
|
}
|
|
113
114
|
}
|
|
114
|
-
const c =
|
|
115
|
-
|
|
115
|
+
const c = y.filter((d) => _[d.field]).map((d) => d.field), u = await L.request(
|
|
116
|
+
q(`/items/${l}/${n}/clone`, { field_overrides: a, exclude_fields: o, include_sub_rows: c })
|
|
116
117
|
);
|
|
117
|
-
|
|
118
|
+
h(!1);
|
|
119
|
+
const F = (e = u == null ? void 0 : u.data) == null ? void 0 : e.id;
|
|
120
|
+
if (F == null) {
|
|
121
|
+
v.success("Item cloned — open it from the list");
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
v.success("Item cloned"), p(F);
|
|
118
125
|
} catch {
|
|
119
|
-
|
|
126
|
+
v.error("Failed to clone item");
|
|
120
127
|
} finally {
|
|
121
|
-
|
|
128
|
+
S(!1);
|
|
122
129
|
}
|
|
123
130
|
}
|
|
124
|
-
return /* @__PURE__ */ r(
|
|
125
|
-
e ?
|
|
131
|
+
return /* @__PURE__ */ r(H, { open: j, onOpenChange: (e) => {
|
|
132
|
+
e ? J() : h(!1);
|
|
126
133
|
}, children: [
|
|
127
|
-
/* @__PURE__ */ t(
|
|
128
|
-
/* @__PURE__ */ t(
|
|
134
|
+
/* @__PURE__ */ t(K, { asChild: !0, children: /* @__PURE__ */ r(w, { size: "sm", variant: "outline", className: "gap-1.5", children: [
|
|
135
|
+
/* @__PURE__ */ t(O, { className: "h-3.5 w-3.5" }),
|
|
129
136
|
"Clone"
|
|
130
137
|
] }) }),
|
|
131
|
-
/* @__PURE__ */ r(
|
|
132
|
-
/* @__PURE__ */ t(
|
|
138
|
+
/* @__PURE__ */ r(P, { className: "flex max-h-[85vh] max-w-lg flex-col overflow-hidden", children: [
|
|
139
|
+
/* @__PURE__ */ t(Y, { className: "shrink-0 px-6 pt-6", children: /* @__PURE__ */ t(A, { className: "text-[15px]", children: "Clone item" }) }),
|
|
133
140
|
/* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-y-auto px-6 py-4", children: /* @__PURE__ */ r("div", { className: "space-y-4", children: [
|
|
134
|
-
|
|
141
|
+
x.length > 0 && /* @__PURE__ */ r("div", { children: [
|
|
135
142
|
/* @__PURE__ */ t("p", { className: "mb-2 text-[11px] font-medium uppercase tracking-wide text-slate-400", children: "Field values" }),
|
|
136
|
-
/* @__PURE__ */ t("div", { className: "space-y-2", children:
|
|
137
|
-
const a =
|
|
143
|
+
/* @__PURE__ */ t("div", { className: "space-y-2", children: x.map((e) => {
|
|
144
|
+
const a = k[e.field];
|
|
138
145
|
if (!a) return null;
|
|
139
|
-
const
|
|
146
|
+
const o = D(e.field, a);
|
|
140
147
|
return /* @__PURE__ */ r("div", { className: "flex items-start gap-2", children: [
|
|
141
148
|
/* @__PURE__ */ t(
|
|
142
|
-
|
|
149
|
+
B,
|
|
143
150
|
{
|
|
144
151
|
checked: a.include,
|
|
145
|
-
onCheckedChange: () =>
|
|
152
|
+
onCheckedChange: () => g((c) => ({ ...c, [e.field]: { ...c[e.field], include: !c[e.field].include } })),
|
|
146
153
|
className: "mt-1 shrink-0 scale-75"
|
|
147
154
|
}
|
|
148
155
|
),
|
|
149
|
-
/* @__PURE__ */ t(
|
|
150
|
-
/* @__PURE__ */ t("div", { className:
|
|
151
|
-
|
|
156
|
+
/* @__PURE__ */ t(z, { className: R("mt-1.5 w-32 shrink-0 truncate text-[12px]", !a.include && "text-slate-400 line-through"), children: E(e.field) }),
|
|
157
|
+
/* @__PURE__ */ t("div", { className: R("flex-1", !a.include && "pointer-events-none opacity-40"), children: /* @__PURE__ */ t(
|
|
158
|
+
Z,
|
|
152
159
|
{
|
|
153
160
|
field: e,
|
|
154
161
|
value: a.value,
|
|
155
|
-
onChange: (
|
|
162
|
+
onChange: (c) => g((u) => ({ ...u, [e.field]: { ...u[e.field], value: c } }))
|
|
156
163
|
}
|
|
157
164
|
) }),
|
|
158
|
-
|
|
165
|
+
o && a.include && /* @__PURE__ */ t(
|
|
159
166
|
"button",
|
|
160
167
|
{
|
|
161
168
|
type: "button",
|
|
162
169
|
title: "Reset to original",
|
|
163
|
-
onClick: () =>
|
|
170
|
+
onClick: () => g((c) => ({ ...c, [e.field]: { ...c[e.field], value: f[e.field] ?? null } })),
|
|
164
171
|
className: "mt-1.5 shrink-0 text-slate-400 hover:text-slate-600",
|
|
165
|
-
children: /* @__PURE__ */ t(
|
|
172
|
+
children: /* @__PURE__ */ t(T, { className: "h-3.5 w-3.5" })
|
|
166
173
|
}
|
|
167
174
|
)
|
|
168
175
|
] }, e.field);
|
|
169
176
|
}) })
|
|
170
177
|
] }),
|
|
171
|
-
|
|
178
|
+
y.length > 0 && /* @__PURE__ */ r("div", { children: [
|
|
172
179
|
/* @__PURE__ */ t("p", { className: "mb-2 text-[11px] font-medium uppercase tracking-wide text-slate-400", children: "Sub-rows" }),
|
|
173
|
-
/* @__PURE__ */ t("div", { className: "space-y-2", children:
|
|
180
|
+
/* @__PURE__ */ t("div", { className: "space-y-2", children: y.map((e) => /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
174
181
|
/* @__PURE__ */ t(
|
|
175
|
-
|
|
182
|
+
B,
|
|
176
183
|
{
|
|
177
|
-
checked: !!
|
|
178
|
-
onCheckedChange: (a) =>
|
|
184
|
+
checked: !!_[e.field],
|
|
185
|
+
onCheckedChange: (a) => I((o) => ({ ...o, [e.field]: a })),
|
|
179
186
|
className: "shrink-0 scale-75"
|
|
180
187
|
}
|
|
181
188
|
),
|
|
182
|
-
/* @__PURE__ */ r(
|
|
189
|
+
/* @__PURE__ */ r(z, { className: "text-[12px]", children: [
|
|
183
190
|
"Include ",
|
|
184
191
|
/* @__PURE__ */ t("span", { className: "font-mono", children: e.field }),
|
|
185
192
|
" sub-rows"
|
|
@@ -187,16 +194,16 @@ function ce({ collection: l, itemId: n, fields: s, relations: i, currentValues:
|
|
|
187
194
|
] }, e.field)) })
|
|
188
195
|
] })
|
|
189
196
|
] }) }),
|
|
190
|
-
/* @__PURE__ */ r(
|
|
191
|
-
/* @__PURE__ */ t(
|
|
192
|
-
/* @__PURE__ */ r(
|
|
193
|
-
/* @__PURE__ */ t(
|
|
194
|
-
|
|
197
|
+
/* @__PURE__ */ r(G, { className: "shrink-0 border-t border-slate-100 px-6 py-4 dark:border-border", children: [
|
|
198
|
+
/* @__PURE__ */ t(w, { variant: "outline", size: "sm", onClick: () => h(!1), children: "Cancel" }),
|
|
199
|
+
/* @__PURE__ */ r(w, { size: "sm", disabled: C, onClick: M, children: [
|
|
200
|
+
/* @__PURE__ */ t(O, { className: "mr-1.5 h-3.5 w-3.5" }),
|
|
201
|
+
C ? "Cloning…" : "Clone"
|
|
195
202
|
] })
|
|
196
203
|
] })
|
|
197
204
|
] })
|
|
198
205
|
] });
|
|
199
206
|
}
|
|
200
207
|
export {
|
|
201
|
-
|
|
208
|
+
ue as CloneDialog
|
|
202
209
|
};
|