@nivaro/react 0.3.50 → 0.3.51
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/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +13 -3
- package/dist/shared/components/ItemEditForm.js +4720 -4593
- package/dist/shared/components/QueryTable.js +337 -324
- package/dist/shared/components/ReportView.js +105 -99
- package/dist/shared/components/alerts/AlertManagerView.js +327 -301
- package/dist/shared/components/item-edit/CatalogPickerField.js +1149 -1111
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +58 -53
- package/dist/shared/components/item-edit/FieldRenderer.js +227 -223
- package/dist/shared/components/item-edit/FieldRow.js +287 -265
- package/dist/shared/components/item-edit/FilePickerField.js +315 -307
- package/dist/shared/components/item-edit/InlineTableField.js +491 -466
- package/dist/shared/components/item-edit/RecordHeaderActions.js +76 -75
- package/dist/shared/components/item-edit/RecordLiveSync.js +93 -91
- package/dist/shared/components/item-edit/RelationCombobox.js +62 -60
- package/dist/shared/components/item-edit/SummaryPanel.js +287 -277
- package/dist/shared/components/item-edit/UserChip.js +233 -200
- package/dist/shared/components/item-edit/header-midair.js +51 -0
- package/dist/shared/components/item-edit/line-midair.js +76 -70
- package/dist/shared/components/panels/CommentPanel.js +290 -284
- package/dist/shared/components/panels/ItemLockBanner.js +30 -30
- package/dist/shared/components/panels/PipelinePanel.js +956 -901
- package/dist/shared/components/panels/TaskPanel.js +71 -61
- package/dist/shared/components/panels/TransitionRequirementsDialog.js +569 -439
- package/dist/shared/components/panels/requirement-side-effects.js +40 -0
- package/dist/shared/components/queue/QueueWorklist.js +141 -130
- package/dist/shared/lib/draft-store.js +48 -34
- package/dist/shared/lib/query-stats.js +60 -60
- package/package.json +1 -1
|
@@ -1,139 +1,144 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { History as
|
|
3
|
-
import { useState as
|
|
1
|
+
import { jsxs as a, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { History as R, ExternalLink as S, RotateCcw as D, Trash2 as T } from "lucide-react";
|
|
3
|
+
import { useState as N, useEffect as E } from "react";
|
|
4
4
|
import { useItemNavigation as H } from "../../context.js";
|
|
5
|
-
import { formatRelative as
|
|
6
|
-
const
|
|
7
|
-
if (
|
|
8
|
-
if (typeof
|
|
9
|
-
const c = typeof
|
|
5
|
+
import { formatRelative as k, titleCase as w } from "../../lib/utils.js";
|
|
6
|
+
const y = (t) => {
|
|
7
|
+
if (t == null || t === "") return "empty";
|
|
8
|
+
if (typeof t == "boolean") return t ? "Yes" : "No";
|
|
9
|
+
const c = typeof t == "object" ? JSON.stringify(t) : String(t);
|
|
10
10
|
return c.length > 60 ? `${c.slice(0, 60)}…` : c;
|
|
11
11
|
};
|
|
12
|
-
function
|
|
13
|
-
draft:
|
|
12
|
+
function q({
|
|
13
|
+
draft: t,
|
|
14
14
|
labelFor: c,
|
|
15
|
-
current:
|
|
16
|
-
recordChanged:
|
|
17
|
-
onRestore:
|
|
18
|
-
onDiscard:
|
|
15
|
+
current: f,
|
|
16
|
+
recordChanged: $,
|
|
17
|
+
onRestore: j,
|
|
18
|
+
onDiscard: O,
|
|
19
19
|
createdId: s = null,
|
|
20
20
|
collection: x,
|
|
21
21
|
renderValue: p
|
|
22
22
|
}) {
|
|
23
|
-
const [
|
|
24
|
-
|
|
23
|
+
const [g, _] = N(!1), [, C] = N(0);
|
|
24
|
+
E(() => {
|
|
25
|
+
const e = setInterval(() => C((r) => r + 1), 3e4);
|
|
26
|
+
return () => clearInterval(e);
|
|
27
|
+
}, []);
|
|
28
|
+
const v = H(), b = Object.entries(t.fields ?? {}), h = s !== null, u = Object.values(t.pending_rows ?? {}).reduce((e, r) => e + r.length, 0), l = Object.values(t.pending_edits ?? {}).reduce(
|
|
29
|
+
(e, r) => e + Object.keys(r).length,
|
|
25
30
|
0
|
|
26
|
-
), o = Object.values(
|
|
27
|
-
return b.length && i.push(`${b.length} field${b.length === 1 ? "" : "s"}`), u && i.push(`${u} new line${u === 1 ? "" : "s"}`), l && i.push(`${l} line edit${l === 1 ? "" : "s"}`), o && i.push(`${o} line removal${o === 1 ? "" : "s"}`), m && i.push(`${m} link${m === 1 ? "" : "s"}`), d && i.push(`${d} unlink${d === 1 ? "" : "s"}`), /* @__PURE__ */
|
|
31
|
+
), o = Object.values(t.pending_deletes ?? {}).reduce((e, r) => e + r.length, 0), m = 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), i = [];
|
|
32
|
+
return b.length && i.push(`${b.length} field${b.length === 1 ? "" : "s"}`), u && i.push(`${u} new line${u === 1 ? "" : "s"}`), l && i.push(`${l} line edit${l === 1 ? "" : "s"}`), o && i.push(`${o} line removal${o === 1 ? "" : "s"}`), m && i.push(`${m} link${m === 1 ? "" : "s"}`), d && i.push(`${d} unlink${d === 1 ? "" : "s"}`), /* @__PURE__ */ a(
|
|
28
33
|
"div",
|
|
29
34
|
{
|
|
30
35
|
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",
|
|
31
36
|
"data-nvr-draft-recovery": !0,
|
|
32
37
|
children: [
|
|
33
|
-
/* @__PURE__ */
|
|
34
|
-
/* @__PURE__ */ n(
|
|
35
|
-
/* @__PURE__ */
|
|
36
|
-
h ? /* @__PURE__ */
|
|
38
|
+
/* @__PURE__ */ a("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
39
|
+
/* @__PURE__ */ n(R, { className: "h-4 w-4 shrink-0 text-amber-600 dark:text-amber-400" }),
|
|
40
|
+
/* @__PURE__ */ a("span", { className: "min-w-0 flex-1", children: [
|
|
41
|
+
h ? /* @__PURE__ */ a("span", { className: "font-semibold", "data-nvr-draft-created": !0, children: [
|
|
37
42
|
"These changes from ",
|
|
38
|
-
|
|
43
|
+
k(t.saved_at),
|
|
39
44
|
" were already saved",
|
|
40
45
|
s ? ` as record ${s}` : " as a new record",
|
|
41
46
|
" — restoring them makes a second one."
|
|
42
|
-
] }) : /* @__PURE__ */
|
|
47
|
+
] }) : /* @__PURE__ */ a("span", { className: "font-semibold", children: [
|
|
43
48
|
"Restore your unsaved changes from ",
|
|
44
|
-
|
|
49
|
+
k(t.saved_at),
|
|
45
50
|
"?"
|
|
46
51
|
] }),
|
|
47
52
|
" ",
|
|
48
53
|
/* @__PURE__ */ n("span", { className: "text-amber-800/80 dark:text-amber-200/80", children: i.join(" · ") }),
|
|
49
|
-
|
|
54
|
+
$ && /* @__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" })
|
|
50
55
|
] }),
|
|
51
56
|
/* @__PURE__ */ n(
|
|
52
57
|
"button",
|
|
53
58
|
{
|
|
54
59
|
type: "button",
|
|
55
|
-
onClick: () =>
|
|
60
|
+
onClick: () => _((e) => !e),
|
|
56
61
|
className: "text-[11.5px] underline decoration-dotted underline-offset-2",
|
|
57
|
-
children:
|
|
62
|
+
children: g ? "Hide changes" : "Show changes"
|
|
58
63
|
}
|
|
59
64
|
),
|
|
60
|
-
h && s && x && /* @__PURE__ */
|
|
65
|
+
h && s && x && /* @__PURE__ */ a(
|
|
61
66
|
"a",
|
|
62
67
|
{
|
|
63
|
-
href:
|
|
68
|
+
href: v.urlFor({ collection: x, itemId: s }),
|
|
64
69
|
onClick: (e) => {
|
|
65
|
-
e.preventDefault(),
|
|
70
|
+
e.preventDefault(), v.open({ collection: x, itemId: s });
|
|
66
71
|
},
|
|
67
72
|
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",
|
|
68
73
|
"data-nvr-draft-open-created": !0,
|
|
69
74
|
children: [
|
|
70
|
-
/* @__PURE__ */ n(
|
|
75
|
+
/* @__PURE__ */ n(S, { className: "h-3 w-3" }),
|
|
71
76
|
" Open record ",
|
|
72
77
|
s
|
|
73
78
|
]
|
|
74
79
|
}
|
|
75
80
|
),
|
|
76
|
-
/* @__PURE__ */
|
|
81
|
+
/* @__PURE__ */ a(
|
|
77
82
|
"button",
|
|
78
83
|
{
|
|
79
84
|
type: "button",
|
|
80
|
-
onClick:
|
|
85
|
+
onClick: j,
|
|
81
86
|
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",
|
|
82
87
|
"data-nvr-draft-restore": !0,
|
|
83
88
|
children: [
|
|
84
|
-
/* @__PURE__ */ n(
|
|
89
|
+
/* @__PURE__ */ n(D, { className: "h-3 w-3" }),
|
|
85
90
|
" ",
|
|
86
91
|
h ? "Restore anyway" : "Restore"
|
|
87
92
|
]
|
|
88
93
|
}
|
|
89
94
|
),
|
|
90
|
-
/* @__PURE__ */
|
|
95
|
+
/* @__PURE__ */ a(
|
|
91
96
|
"button",
|
|
92
97
|
{
|
|
93
98
|
type: "button",
|
|
94
|
-
onClick:
|
|
99
|
+
onClick: O,
|
|
95
100
|
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",
|
|
96
101
|
"data-nvr-draft-discard": !0,
|
|
97
102
|
children: [
|
|
98
|
-
/* @__PURE__ */ n(
|
|
103
|
+
/* @__PURE__ */ n(T, { className: "h-3 w-3" }),
|
|
99
104
|
" Discard"
|
|
100
105
|
]
|
|
101
106
|
}
|
|
102
107
|
)
|
|
103
108
|
] }),
|
|
104
|
-
|
|
105
|
-
b.map(([e,
|
|
106
|
-
/* @__PURE__ */ n("span", { className: "font-medium", children: c(e) ||
|
|
107
|
-
/* @__PURE__ */
|
|
108
|
-
/* @__PURE__ */ n("span", { className: "line-through opacity-70", children: p ? p(e,
|
|
109
|
+
g && /* @__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: [
|
|
110
|
+
b.map(([e, r]) => /* @__PURE__ */ a("div", { className: "text-[11.5px]", children: [
|
|
111
|
+
/* @__PURE__ */ n("span", { className: "font-medium", children: c(e) || w(e.replace(/_/g, " ")) }),
|
|
112
|
+
/* @__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, f[e]) : y(f[e]) }),
|
|
109
114
|
" ",
|
|
110
|
-
/* @__PURE__ */ n("span", { className: "font-medium text-amber-900 dark:text-amber-100", children: p ? p(e,
|
|
115
|
+
/* @__PURE__ */ n("span", { className: "font-medium text-amber-900 dark:text-amber-100", children: p ? p(e, r) : y(r) })
|
|
111
116
|
] })
|
|
112
117
|
] }, e)),
|
|
113
|
-
Object.entries(
|
|
114
|
-
|
|
118
|
+
Object.entries(t.pending_rows ?? {}).filter(([, e]) => e.length > 0).map(([e, r]) => /* @__PURE__ */ a("p", { className: "text-[11.5px]", children: [
|
|
119
|
+
r.length,
|
|
115
120
|
" new line",
|
|
116
|
-
|
|
121
|
+
r.length === 1 ? "" : "s",
|
|
117
122
|
" in",
|
|
118
123
|
" ",
|
|
119
|
-
|
|
124
|
+
w(e.split(".")[0].replace(/_/g, " "))
|
|
120
125
|
] }, e)),
|
|
121
|
-
l > 0 && /* @__PURE__ */
|
|
126
|
+
l > 0 && /* @__PURE__ */ a("p", { className: "text-[11.5px]", children: [
|
|
122
127
|
l,
|
|
123
128
|
" edited line",
|
|
124
129
|
l === 1 ? "" : "s"
|
|
125
130
|
] }),
|
|
126
|
-
o > 0 && /* @__PURE__ */
|
|
131
|
+
o > 0 && /* @__PURE__ */ a("p", { className: "text-[11.5px]", children: [
|
|
127
132
|
o,
|
|
128
133
|
" line removal",
|
|
129
134
|
o === 1 ? "" : "s"
|
|
130
135
|
] }),
|
|
131
|
-
m > 0 && /* @__PURE__ */
|
|
136
|
+
m > 0 && /* @__PURE__ */ a("p", { className: "text-[11.5px]", children: [
|
|
132
137
|
m,
|
|
133
138
|
" relation link",
|
|
134
139
|
m === 1 ? "" : "s"
|
|
135
140
|
] }),
|
|
136
|
-
d > 0 && /* @__PURE__ */
|
|
141
|
+
d > 0 && /* @__PURE__ */ a("p", { className: "text-[11.5px]", children: [
|
|
137
142
|
d,
|
|
138
143
|
" relation removal",
|
|
139
144
|
d === 1 ? "" : "s"
|
|
@@ -144,5 +149,5 @@ function L({
|
|
|
144
149
|
);
|
|
145
150
|
}
|
|
146
151
|
export {
|
|
147
|
-
|
|
152
|
+
q as DraftRecoveryBanner
|
|
148
153
|
};
|