@nivaro/react 0.3.52 → 0.3.54
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/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +47 -3
- package/dist/shared/components/ItemEditForm.js +4196 -4163
- package/dist/shared/components/NotificationBell.js +163 -150
- package/dist/shared/components/PageRenderer.js +645 -593
- package/dist/shared/components/ProfileView.js +36 -34
- package/dist/shared/components/QueryStatStrip.js +96 -89
- package/dist/shared/components/QueryTable.js +214 -215
- package/dist/shared/components/ReportView.js +548 -529
- package/dist/shared/components/alerts/AlertManagerView.js +346 -320
- package/dist/shared/components/item-edit/CatalogPickerField.js +1300 -1219
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +52 -54
- package/dist/shared/components/item-edit/FieldAffordances.js +145 -136
- package/dist/shared/components/item-edit/FieldRenderer.js +366 -326
- package/dist/shared/components/item-edit/InlineTableField.js +3047 -2932
- package/dist/shared/components/item-edit/NestedRelationEditor.js +149 -143
- package/dist/shared/components/item-edit/PersonalDefaultControl.js +12 -11
- package/dist/shared/components/item-edit/PlanGrid.js +718 -705
- package/dist/shared/components/item-edit/RelationCombobox.js +23 -20
- package/dist/shared/components/item-edit/SummaryPanel.js +415 -361
- package/dist/shared/components/item-edit/line-qty.js +115 -53
- package/dist/shared/components/item-edit/save-outcome.js +48 -0
- package/dist/shared/components/item-edit/save-refusal.js +18 -18
- package/dist/shared/components/item-edit/stale-banner.js +13 -0
- package/dist/shared/components/item-edit/usePersonalDefaults.js +225 -220
- package/dist/shared/components/panels/CommentPanel.js +204 -197
- package/dist/shared/components/panels/ItemLockBanner.js +318 -291
- package/dist/shared/components/panels/PipelinePanel.js +1388 -1218
- package/dist/shared/components/panels/RecordIntegrityBanner.js +201 -172
- package/dist/shared/components/panels/RevisionsPanel.js +101 -106
- package/dist/shared/components/panels/TransitionRequirementsDialog.js +564 -534
- package/dist/shared/components/panels/requirement-side-effects.js +46 -29
- package/dist/shared/components/queue/QueueItemSheet.js +219 -146
- package/dist/shared/components/queue/QueueWorklist.js +738 -730
- package/dist/shared/components/widgets/ReviewListWidget.js +236 -201
- package/dist/shared/lib/activity-sentence.js +236 -227
- package/dist/shared/lib/draft-store.js +35 -29
- package/dist/shared/lib/page-widget-access.js +11 -0
- package/dist/shared/lib/record-ref.js +43 -34
- package/package.json +1 -1
|
@@ -1,80 +1,78 @@
|
|
|
1
1
|
import { jsxs as a, jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { History as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { useItemNavigation as
|
|
5
|
-
import {
|
|
6
|
-
|
|
2
|
+
import { History as T, ExternalLink as B, RotateCcw as E, Trash2 as F } from "lucide-react";
|
|
3
|
+
import { useState as w, useEffect as H } from "react";
|
|
4
|
+
import { useItemNavigation as I } from "../../context.js";
|
|
5
|
+
import { draftFilledBack as J } from "../../lib/draft-store.js";
|
|
6
|
+
import { formatRelative as y, titleCase as $ } from "../../lib/utils.js";
|
|
7
|
+
const j = (t) => {
|
|
7
8
|
if (t == null || t === "") return "empty";
|
|
8
9
|
if (typeof t == "boolean") return t ? "Yes" : "No";
|
|
9
|
-
const
|
|
10
|
-
return
|
|
10
|
+
const m = typeof t == "object" ? JSON.stringify(t) : String(t);
|
|
11
|
+
return m.length > 60 ? `${m.slice(0, 60)}…` : m;
|
|
11
12
|
};
|
|
12
|
-
function
|
|
13
|
+
function K({
|
|
13
14
|
draft: t,
|
|
14
|
-
labelFor:
|
|
15
|
-
current:
|
|
16
|
-
recordChanged:
|
|
17
|
-
onRestore:
|
|
18
|
-
onDiscard:
|
|
19
|
-
createdId:
|
|
15
|
+
labelFor: m,
|
|
16
|
+
current: v,
|
|
17
|
+
recordChanged: O,
|
|
18
|
+
onRestore: _,
|
|
19
|
+
onDiscard: C,
|
|
20
|
+
createdId: c = null,
|
|
20
21
|
collection: x,
|
|
21
22
|
renderValue: p
|
|
22
23
|
}) {
|
|
23
|
-
const [
|
|
24
|
-
|
|
25
|
-
const e = setInterval(() =>
|
|
24
|
+
const [N, R] = w(!1), [, S] = w(0);
|
|
25
|
+
H(() => {
|
|
26
|
+
const e = setInterval(() => S((r) => r + 1), 3e4);
|
|
26
27
|
return () => clearInterval(e);
|
|
27
28
|
}, []);
|
|
28
|
-
const
|
|
29
|
+
const k = I(), u = Object.entries(t.fields ?? {}), D = J(t), f = u.filter(([e]) => D.has(e)).length, b = u.length - f, h = c !== null, g = Object.values(t.pending_rows ?? {}).reduce((e, r) => e + r.length, 0), i = Object.values(t.pending_edits ?? {}).reduce(
|
|
29
30
|
(e, r) => e + Object.keys(r).length,
|
|
30
31
|
0
|
|
31
|
-
),
|
|
32
|
-
return b
|
|
32
|
+
), l = Object.values(t.pending_deletes ?? {}).reduce((e, r) => e + r.length, 0), o = 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), s = [];
|
|
33
|
+
return b && s.push(`${b} field${b === 1 ? "" : "s"}`), f && s.push(`${f} filled in from ${b === 1 ? "it" : "them"}`), g && s.push(`${g} new line${g === 1 ? "" : "s"}`), i && s.push(`${i} line edit${i === 1 ? "" : "s"}`), l && s.push(`${l} line removal${l === 1 ? "" : "s"}`), o && s.push(`${o} link${o === 1 ? "" : "s"}`), d && s.push(`${d} unlink${d === 1 ? "" : "s"}`), /* @__PURE__ */ a(
|
|
33
34
|
"div",
|
|
34
35
|
{
|
|
35
36
|
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",
|
|
36
37
|
"data-nvr-draft-recovery": !0,
|
|
37
38
|
children: [
|
|
38
39
|
/* @__PURE__ */ a("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
39
|
-
/* @__PURE__ */ n(
|
|
40
|
+
/* @__PURE__ */ n(T, { className: "h-4 w-4 shrink-0 text-amber-600 dark:text-amber-400" }),
|
|
40
41
|
/* @__PURE__ */ a("span", { className: "min-w-0 flex-1", children: [
|
|
41
42
|
h ? /* @__PURE__ */ a("span", { className: "font-semibold", "data-nvr-draft-created": !0, children: [
|
|
42
43
|
"These changes from ",
|
|
43
|
-
|
|
44
|
-
" were already saved"
|
|
45
|
-
s ? ` as record ${s}` : " as a new record",
|
|
46
|
-
" — restoring them makes a second one."
|
|
44
|
+
y(t.saved_at),
|
|
45
|
+
" were already saved as a new record — restoring them makes a second one."
|
|
47
46
|
] }) : /* @__PURE__ */ a("span", { className: "font-semibold", children: [
|
|
48
47
|
"Restore your unsaved changes from ",
|
|
49
|
-
|
|
48
|
+
y(t.saved_at),
|
|
50
49
|
"?"
|
|
51
50
|
] }),
|
|
52
51
|
" ",
|
|
53
|
-
/* @__PURE__ */ n("span", { className: "text-amber-800/80 dark:text-amber-200/80", children:
|
|
54
|
-
|
|
52
|
+
/* @__PURE__ */ n("span", { className: "text-amber-800/80 dark:text-amber-200/80", children: s.join(" · ") }),
|
|
53
|
+
O && /* @__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" })
|
|
55
54
|
] }),
|
|
56
55
|
/* @__PURE__ */ n(
|
|
57
56
|
"button",
|
|
58
57
|
{
|
|
59
58
|
type: "button",
|
|
60
|
-
onClick: () =>
|
|
59
|
+
onClick: () => R((e) => !e),
|
|
61
60
|
className: "text-[11.5px] underline decoration-dotted underline-offset-2",
|
|
62
|
-
children:
|
|
61
|
+
children: N ? "Hide changes" : "Show changes"
|
|
63
62
|
}
|
|
64
63
|
),
|
|
65
|
-
h &&
|
|
64
|
+
h && c && x && /* @__PURE__ */ a(
|
|
66
65
|
"a",
|
|
67
66
|
{
|
|
68
|
-
href:
|
|
67
|
+
href: k.urlFor({ collection: x, itemId: c }),
|
|
69
68
|
onClick: (e) => {
|
|
70
|
-
e.preventDefault(),
|
|
69
|
+
e.preventDefault(), k.open({ collection: x, itemId: c });
|
|
71
70
|
},
|
|
72
71
|
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",
|
|
73
72
|
"data-nvr-draft-open-created": !0,
|
|
74
73
|
children: [
|
|
75
|
-
/* @__PURE__ */ n(
|
|
76
|
-
" Open record
|
|
77
|
-
s
|
|
74
|
+
/* @__PURE__ */ n(B, { className: "h-3 w-3" }),
|
|
75
|
+
" Open the record"
|
|
78
76
|
]
|
|
79
77
|
}
|
|
80
78
|
),
|
|
@@ -82,11 +80,11 @@ function q({
|
|
|
82
80
|
"button",
|
|
83
81
|
{
|
|
84
82
|
type: "button",
|
|
85
|
-
onClick:
|
|
83
|
+
onClick: _,
|
|
86
84
|
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",
|
|
87
85
|
"data-nvr-draft-restore": !0,
|
|
88
86
|
children: [
|
|
89
|
-
/* @__PURE__ */ n(
|
|
87
|
+
/* @__PURE__ */ n(E, { className: "h-3 w-3" }),
|
|
90
88
|
" ",
|
|
91
89
|
h ? "Restore anyway" : "Restore"
|
|
92
90
|
]
|
|
@@ -96,23 +94,23 @@ function q({
|
|
|
96
94
|
"button",
|
|
97
95
|
{
|
|
98
96
|
type: "button",
|
|
99
|
-
onClick:
|
|
97
|
+
onClick: C,
|
|
100
98
|
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",
|
|
101
99
|
"data-nvr-draft-discard": !0,
|
|
102
100
|
children: [
|
|
103
|
-
/* @__PURE__ */ n(
|
|
101
|
+
/* @__PURE__ */ n(F, { className: "h-3 w-3" }),
|
|
104
102
|
" Discard"
|
|
105
103
|
]
|
|
106
104
|
}
|
|
107
105
|
)
|
|
108
106
|
] }),
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
/* @__PURE__ */ n("span", { className: "font-medium", children:
|
|
107
|
+
N && /* @__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: [
|
|
108
|
+
u.map(([e, r]) => /* @__PURE__ */ a("div", { className: "text-[11.5px]", children: [
|
|
109
|
+
/* @__PURE__ */ n("span", { className: "font-medium", children: m(e) || $(e.replace(/_/g, " ")) }),
|
|
112
110
|
/* @__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,
|
|
111
|
+
/* @__PURE__ */ n("span", { className: "line-through opacity-70", children: p ? p(e, v[e]) : j(v[e]) }),
|
|
114
112
|
" ",
|
|
115
|
-
/* @__PURE__ */ n("span", { className: "font-medium text-amber-900 dark:text-amber-100", children: p ? p(e, r) :
|
|
113
|
+
/* @__PURE__ */ n("span", { className: "font-medium text-amber-900 dark:text-amber-100", children: p ? p(e, r) : j(r) })
|
|
116
114
|
] })
|
|
117
115
|
] }, e)),
|
|
118
116
|
Object.entries(t.pending_rows ?? {}).filter(([, e]) => e.length > 0).map(([e, r]) => /* @__PURE__ */ a("p", { className: "text-[11.5px]", children: [
|
|
@@ -121,22 +119,22 @@ function q({
|
|
|
121
119
|
r.length === 1 ? "" : "s",
|
|
122
120
|
" in",
|
|
123
121
|
" ",
|
|
124
|
-
|
|
122
|
+
$(e.split(".")[0].replace(/_/g, " "))
|
|
125
123
|
] }, e)),
|
|
124
|
+
i > 0 && /* @__PURE__ */ a("p", { className: "text-[11.5px]", children: [
|
|
125
|
+
i,
|
|
126
|
+
" edited line",
|
|
127
|
+
i === 1 ? "" : "s"
|
|
128
|
+
] }),
|
|
126
129
|
l > 0 && /* @__PURE__ */ a("p", { className: "text-[11.5px]", children: [
|
|
127
130
|
l,
|
|
128
|
-
"
|
|
131
|
+
" line removal",
|
|
129
132
|
l === 1 ? "" : "s"
|
|
130
133
|
] }),
|
|
131
134
|
o > 0 && /* @__PURE__ */ a("p", { className: "text-[11.5px]", children: [
|
|
132
135
|
o,
|
|
133
|
-
" line removal",
|
|
134
|
-
o === 1 ? "" : "s"
|
|
135
|
-
] }),
|
|
136
|
-
m > 0 && /* @__PURE__ */ a("p", { className: "text-[11.5px]", children: [
|
|
137
|
-
m,
|
|
138
136
|
" relation link",
|
|
139
|
-
|
|
137
|
+
o === 1 ? "" : "s"
|
|
140
138
|
] }),
|
|
141
139
|
d > 0 && /* @__PURE__ */ a("p", { className: "text-[11.5px]", children: [
|
|
142
140
|
d,
|
|
@@ -149,5 +147,5 @@ function q({
|
|
|
149
147
|
);
|
|
150
148
|
}
|
|
151
149
|
export {
|
|
152
|
-
|
|
150
|
+
K as DraftRecoveryBanner
|
|
153
151
|
};
|