@nivaro/react 0.3.117 → 0.3.118
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 +136 -14
- package/dist/index.js +488 -485
- package/dist/shared/components/ActivityEntry.js +130 -125
- package/dist/shared/components/AgentPresenceChip.js +36 -26
- package/dist/shared/components/CellCopyLayer.js +50 -45
- package/dist/shared/components/CollectionBrowserView.js +3757 -3695
- package/dist/shared/components/FilePreviewLightbox.js +96 -58
- package/dist/shared/components/InStep.js +18 -17
- package/dist/shared/components/ItemEditForm.js +4220 -4175
- package/dist/shared/components/JobsTray.js +8 -8
- package/dist/shared/components/LiveNewMatchesPill.js +21 -14
- package/dist/shared/components/LiveOffNote.js +3 -2
- package/dist/shared/components/LiveRowMark.js +53 -23
- package/dist/shared/components/LiveTraceView.js +162 -123
- package/dist/shared/components/MyWorkView.js +320 -299
- package/dist/shared/components/NotificationBell.js +14 -14
- package/dist/shared/components/OverflowRail.js +1 -1
- package/dist/shared/components/PageRenderer.js +120 -116
- package/dist/shared/components/ProfileView.js +203 -202
- package/dist/shared/components/RealtimeStatusBanner.js +31 -29
- package/dist/shared/components/RecordDrilldownSheet.js +7 -7
- package/dist/shared/components/RecordHoverCard.js +102 -84
- package/dist/shared/components/RecordReadView.js +146 -146
- package/dist/shared/components/ScreenRefreshButton.js +34 -32
- package/dist/shared/components/TipLayer.js +65 -58
- package/dist/shared/components/WidgetImageMenu.js +83 -43
- package/dist/shared/components/activity/RecordActivityStream.js +175 -173
- package/dist/shared/components/bulk/BulkSelectionNotices.js +142 -119
- package/dist/shared/components/change-proposals/ChangeProposalsPanel.js +158 -143
- package/dist/shared/components/change-proposals/ProposeChangeButton.js +17 -11
- package/dist/shared/components/change-proposals/ProposeChangeDialog.js +201 -173
- package/dist/shared/components/chat/ChatAnalyticsView.js +27 -27
- package/dist/shared/components/chat/HuddleAnalyticsTab.js +17 -17
- package/dist/shared/components/collections-directory/CollectionsToolbar.js +39 -41
- package/dist/shared/components/collections-directory/page-model.js +72 -67
- package/dist/shared/components/integrations/RecordIntegrationPreview.js +48 -56
- package/dist/shared/components/integrations/SendStatus.js +65 -59
- package/dist/shared/components/integrations/console/ReadyToSendView.js +275 -209
- package/dist/shared/components/integrations/console/SignalCard.js +237 -230
- package/dist/shared/components/item-edit/CatalogPickerField.js +227 -205
- package/dist/shared/components/item-edit/ChangedAfterApprovalBadge.js +131 -92
- package/dist/shared/components/item-edit/CloneDialog.js +191 -161
- package/dist/shared/components/item-edit/DerivedCauseNote.js +44 -30
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +153 -134
- package/dist/shared/components/item-edit/FieldComments.js +54 -53
- package/dist/shared/components/item-edit/FieldPointer.js +82 -67
- package/dist/shared/components/item-edit/FieldRow.js +106 -100
- package/dist/shared/components/item-edit/FieldSourceBadge.js +58 -56
- package/dist/shared/components/item-edit/FilePickerField.js +452 -387
- package/dist/shared/components/item-edit/HeaderSummaryChip.js +78 -56
- package/dist/shared/components/item-edit/HeaderTools.js +94 -85
- package/dist/shared/components/item-edit/InlineTableField.js +1242 -1218
- package/dist/shared/components/item-edit/ListNeighborNav.js +47 -50
- package/dist/shared/components/item-edit/LiveTraceSheet.js +15 -10
- package/dist/shared/components/item-edit/MembershipSetField.js +285 -254
- package/dist/shared/components/item-edit/OutboxReviewTray.js +155 -144
- package/dist/shared/components/item-edit/QueueReturnChip.js +15 -36
- package/dist/shared/components/item-edit/RecalcValue.js +57 -32
- package/dist/shared/components/item-edit/RecordHelpChip.js +21 -22
- package/dist/shared/components/item-edit/RecordLiveSync.js +283 -231
- package/dist/shared/components/item-edit/RelationCombobox.js +439 -393
- package/dist/shared/components/item-edit/RemoteChangeUi.js +292 -224
- package/dist/shared/components/item-edit/RemoteUploads.js +26 -20
- package/dist/shared/components/item-edit/RemovedLineNote.js +77 -67
- package/dist/shared/components/item-edit/RichTextEditorImpl.js +184 -179
- package/dist/shared/components/item-edit/ScheduledChangeChip.js +168 -134
- package/dist/shared/components/item-edit/SectionPresence.js +18 -10
- package/dist/shared/components/item-edit/SplitLinesButton.js +163 -139
- package/dist/shared/components/item-edit/UserChip.js +1 -1
- package/dist/shared/components/item-edit/file-live.js +69 -54
- package/dist/shared/components/item-edit/layout-switch.js +98 -89
- package/dist/shared/components/item-edit/partner-needs.js +12 -12
- package/dist/shared/components/item-edit/removed-line.js +31 -25
- package/dist/shared/components/layout-editor/pickers/field-picker.js +112 -104
- package/dist/shared/components/list/ListViewers.js +46 -35
- package/dist/shared/components/notifications/NotificationCenterView.js +479 -437
- package/dist/shared/components/panels/AccessDeniedPanel.js +176 -101
- package/dist/shared/components/panels/AlertBanners.js +82 -72
- package/dist/shared/components/panels/BranchLanes.js +22 -22
- package/dist/shared/components/panels/CommentImages.js +123 -102
- package/dist/shared/components/panels/CommentPanel.js +186 -185
- package/dist/shared/components/panels/ExternalRequestsChip.js +111 -119
- package/dist/shared/components/panels/OwnerOpenedLine.js +31 -24
- package/dist/shared/components/panels/PipelinePanel.js +2037 -1885
- package/dist/shared/components/panels/ResubmissionDiff.js +163 -142
- package/dist/shared/components/pipeline/OwnerMatrixSheet.js +400 -288
- package/dist/shared/components/pipeline/PipelineEditorView.js +7 -2
- package/dist/shared/components/profile/AgentNameField.js +107 -81
- package/dist/shared/components/profile/AgentsPanel.js +184 -184
- package/dist/shared/components/profile/PersonAccess.js +599 -495
- package/dist/shared/components/profile/SignInTroubleshooter.js +160 -127
- package/dist/shared/components/profile/SignedInDevices.js +17 -17
- package/dist/shared/components/profile/primitives.js +1 -1
- package/dist/shared/components/queue/OwnerAvatars.js +91 -54
- package/dist/shared/components/queue/QueueTeamStrip.js +56 -46
- package/dist/shared/components/queue/QueueWorklist.js +1002 -983
- package/dist/shared/components/support/AssignRules.js +1733 -0
- package/dist/shared/components/support/PersonPick.js +88 -0
- package/dist/shared/components/support/RequestList.js +790 -0
- package/dist/shared/components/support/ScreenShare.js +158 -152
- package/dist/shared/components/support/SupportRequestDialog.js +50 -48
- package/dist/shared/components/support/SupportView.js +140 -246
- package/dist/shared/components/support/TicketDetailSheet.js +82 -75
- package/dist/shared/components/support/TicketSlowScreens.js +9 -9
- package/dist/shared/components/support/assign-rules-text.js +171 -0
- package/dist/shared/components/support/support-list.js +125 -0
- package/dist/shared/components/ui/SimpleSelect.js +28 -20
- package/dist/shared/components/ui/checkbox.js +6 -6
- package/dist/shared/components/ui/select.js +43 -39
- package/dist/shared/components/ui/sheet.js +9 -9
- package/dist/shared/components/ui/switch.js +12 -11
- package/dist/shared/components/watch-list/WatchDock.js +532 -459
- package/dist/shared/components/watch-list/WatchExtras.js +332 -286
- package/dist/shared/components/watch-list/WatchRows.js +164 -140
- package/dist/shared/lib/activity-sentence.js +103 -91
- package/dist/shared/lib/agent-presence.js +27 -21
- package/dist/shared/lib/approval-progress.js +2 -2
- package/dist/shared/lib/copy-rules.js +31 -24
- package/dist/shared/lib/derived-causes.js +113 -78
- package/dist/shared/lib/grid-cursors.js +26 -26
- package/dist/shared/lib/label-flash.js +27 -0
- package/dist/shared/lib/list-return.js +137 -125
- package/dist/shared/lib/live-deltas.js +40 -34
- package/dist/shared/lib/live-groups.js +56 -52
- package/dist/shared/lib/live-preference.js +64 -59
- package/dist/shared/lib/live-screen.js +223 -192
- package/dist/shared/lib/partner-failure.js +11 -11
- package/dist/shared/lib/rollup-recalc.js +68 -64
- package/dist/shared/lib/screen-refresh.js +74 -68
- package/dist/shared/lib/screen-share.js +108 -104
- package/dist/shared/lib/send-status.js +77 -61
- package/dist/shared/lib/text-diff-window.js +29 -0
- package/dist/shared/lib/watch-list.js +210 -209
- package/dist/shared/lib/widget-image-render.js +72 -49
- package/package.json +1 -1
|
@@ -1,115 +1,182 @@
|
|
|
1
|
-
import { jsxs as l, jsx as
|
|
2
|
-
import { useQuery as
|
|
3
|
-
import {
|
|
1
|
+
import { jsxs as l, jsx as t, Fragment as re } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as ae } from "@tanstack/react-query";
|
|
3
|
+
import { CopyPlus as L, ChevronDown as Y, RotateCcw as oe } from "lucide-react";
|
|
4
4
|
import { useState as f } from "react";
|
|
5
|
-
import { toast as
|
|
6
|
-
import { useNivaroClient as
|
|
7
|
-
import { post as
|
|
8
|
-
import { copyRulesQuery as
|
|
9
|
-
import { cn as
|
|
10
|
-
import { Button as
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { FieldRenderer as
|
|
15
|
-
const
|
|
16
|
-
function
|
|
17
|
-
if (
|
|
18
|
-
const
|
|
19
|
-
return !(["sub_rows", "repeater", "rich_text", "file", "image", "o2m", "m2m", "m2a"].includes(
|
|
5
|
+
import { toast as C } from "sonner";
|
|
6
|
+
import { useNivaroClient as se, useItemNavigation as de } from "../../context.js";
|
|
7
|
+
import { post as ce } from "../../lib/commands.js";
|
|
8
|
+
import { copyRulesQuery as ue, headerCopySkip as me, groupNeverCopied as fe, fieldTitle as Z } from "../../lib/copy-rules.js";
|
|
9
|
+
import { cn as _ } from "../../lib/utils.js";
|
|
10
|
+
import { Button as O } from "../ui/button.js";
|
|
11
|
+
import { Checkbox as U } from "../ui/checkbox.js";
|
|
12
|
+
import { Dialog as pe, DialogTrigger as he, DialogContent as ge, DialogHeader as xe, DialogTitle as ye, DialogDescription as be, DialogFooter as ve } from "../ui/dialog.js";
|
|
13
|
+
import { Label as W } from "../ui/label.js";
|
|
14
|
+
import { FieldRenderer as we } from "./FieldRenderer.js";
|
|
15
|
+
const Ne = /* @__PURE__ */ new Set(["id", "created_at", "updated_at", "created_by", "updated_by"]);
|
|
16
|
+
function ke(n, c, o) {
|
|
17
|
+
if (Ne.has(n.field) || n.field.includes(".") || n.computed_formula) return !1;
|
|
18
|
+
const y = n.interface ?? "";
|
|
19
|
+
return !(["sub_rows", "repeater", "rich_text", "file", "image", "o2m", "m2m", "m2a"].includes(y) || ["sub_rows", "repeater", "rich_text"].includes(n.type) || c.some((p) => p.one_collection === o && p.one_field === n.field));
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function Ce(n) {
|
|
22
22
|
return n.interface === "sub_rows" || n.type === "sub_rows";
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function x(n) {
|
|
25
25
|
var c;
|
|
26
|
-
return ((c = n.label) == null ? void 0 : c.trim()) ||
|
|
26
|
+
return ((c = n.label) == null ? void 0 : c.trim()) || Z(n.field);
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function X(n) {
|
|
29
|
+
return n == null ? !1 : typeof n == "string" ? n.trim() !== "" : Array.isArray(n) ? n.length > 0 : !0;
|
|
30
|
+
}
|
|
31
|
+
function Ae({
|
|
29
32
|
collection: n,
|
|
30
33
|
itemId: c,
|
|
31
34
|
fields: o,
|
|
32
|
-
relations:
|
|
33
|
-
currentValues:
|
|
34
|
-
|
|
35
|
+
relations: y,
|
|
36
|
+
currentValues: u,
|
|
37
|
+
recordLabel: p,
|
|
38
|
+
onSuccess: V
|
|
35
39
|
}) {
|
|
36
|
-
const
|
|
37
|
-
(e) =>
|
|
38
|
-
), w = o.filter(
|
|
39
|
-
function
|
|
40
|
+
const P = se(), ee = de(), [S, b] = f(!1), [j, E] = f(!1), [v, T] = f(!1), [F, z] = f(!1), [M, I] = f({}), [A, B] = f({}), D = ae({ ...ue(P, n), enabled: S }), te = me(D.data), H = fe(D.data, o), $ = H.reduce((e, i) => e + i.fields.length, 0), h = S && D.isPending, w = o.filter(
|
|
41
|
+
(e) => ke(e, y, n) && !te.has(e.field)
|
|
42
|
+
), J = w.filter((e) => X(u[e.field])), N = w.filter((e) => !X(u[e.field])), k = o.filter(Ce);
|
|
43
|
+
function ne() {
|
|
40
44
|
const e = {};
|
|
41
45
|
for (const r of o)
|
|
42
|
-
e[r.field] = { include: !0, value:
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
for (const r of
|
|
46
|
-
|
|
46
|
+
e[r.field] = { include: !0, value: u[r.field] ?? null };
|
|
47
|
+
I(e);
|
|
48
|
+
const i = {};
|
|
49
|
+
for (const r of k) i[r.field] = !0;
|
|
50
|
+
B(i), T(!1), z(!1), b(!0);
|
|
47
51
|
}
|
|
48
|
-
function
|
|
49
|
-
return JSON.stringify(
|
|
52
|
+
function Q(e, i) {
|
|
53
|
+
return JSON.stringify(i.value) !== JSON.stringify(u[e] ?? null);
|
|
50
54
|
}
|
|
51
|
-
async function
|
|
52
|
-
var e,
|
|
53
|
-
|
|
55
|
+
async function ie() {
|
|
56
|
+
var e, i;
|
|
57
|
+
E(!0);
|
|
54
58
|
try {
|
|
55
|
-
const r = {},
|
|
56
|
-
for (const a of
|
|
57
|
-
const d =
|
|
59
|
+
const r = {}, g = [];
|
|
60
|
+
for (const a of w) {
|
|
61
|
+
const d = M[a.field];
|
|
58
62
|
if (d) {
|
|
59
63
|
if (!d.include) {
|
|
60
|
-
|
|
64
|
+
g.push(a.field);
|
|
61
65
|
continue;
|
|
62
66
|
}
|
|
63
|
-
|
|
67
|
+
Q(a.field, d) && (r[a.field] = d.value);
|
|
64
68
|
}
|
|
65
69
|
}
|
|
66
|
-
const
|
|
67
|
-
|
|
70
|
+
const s = k.filter((a) => A[a.field]).map((a) => a.field), m = await P.request(
|
|
71
|
+
ce(`/items/${n}/${c}/clone`, {
|
|
68
72
|
field_overrides: r,
|
|
69
|
-
exclude_fields:
|
|
70
|
-
include_sub_rows:
|
|
73
|
+
exclude_fields: g,
|
|
74
|
+
include_sub_rows: s
|
|
71
75
|
})
|
|
72
76
|
);
|
|
73
77
|
b(!1);
|
|
74
|
-
const
|
|
75
|
-
if (
|
|
76
|
-
|
|
78
|
+
const R = (e = m == null ? void 0 : m.data) == null ? void 0 : e.id;
|
|
79
|
+
if (R == null) {
|
|
80
|
+
C.success("Item cloned — open it from the list");
|
|
77
81
|
return;
|
|
78
82
|
}
|
|
79
|
-
const
|
|
80
|
-
const d =
|
|
81
|
-
return d ?
|
|
83
|
+
const le = new Map(o.map((a) => [a.field, a])), K = (((i = m == null ? void 0 : m.data) == null ? void 0 : i.not_copied) ?? []).map((a) => {
|
|
84
|
+
const d = le.get(a.field);
|
|
85
|
+
return d ? x(d) : Z(a.field);
|
|
82
86
|
});
|
|
83
|
-
|
|
87
|
+
K.length ? C.warning(`Item cloned — not copied: ${K.join(", ")}`, {
|
|
84
88
|
description: "You may not set these on a new record. Opening the copy."
|
|
85
|
-
}) :
|
|
89
|
+
}) : C.success("Item cloned — opening the copy"), V(R), ee.open({ collection: n, itemId: String(R) });
|
|
86
90
|
} catch {
|
|
87
|
-
|
|
91
|
+
C.error("Failed to clone item");
|
|
88
92
|
} finally {
|
|
89
|
-
|
|
93
|
+
E(!1);
|
|
90
94
|
}
|
|
91
95
|
}
|
|
92
|
-
const
|
|
96
|
+
const q = (e, i) => I((r) => ({ ...r, [e]: { ...r[e], value: i } }));
|
|
97
|
+
function G(e) {
|
|
98
|
+
const i = M[e.field];
|
|
99
|
+
if (!i) return null;
|
|
100
|
+
const r = Q(e.field, i), g = `clone-inc-${e.field}`;
|
|
101
|
+
return /* @__PURE__ */ l("div", { className: "flex items-start gap-2.5", "data-clone-field": e.field, children: [
|
|
102
|
+
/* @__PURE__ */ t(
|
|
103
|
+
U,
|
|
104
|
+
{
|
|
105
|
+
id: g,
|
|
106
|
+
checked: i.include,
|
|
107
|
+
"aria-label": `Copy ${x(e)}`,
|
|
108
|
+
onCheckedChange: () => I((s) => ({
|
|
109
|
+
...s,
|
|
110
|
+
[e.field]: { ...s[e.field], include: !s[e.field].include }
|
|
111
|
+
})),
|
|
112
|
+
className: "mt-2.5"
|
|
113
|
+
}
|
|
114
|
+
),
|
|
115
|
+
/* @__PURE__ */ t(
|
|
116
|
+
W,
|
|
117
|
+
{
|
|
118
|
+
htmlFor: g,
|
|
119
|
+
className: _(
|
|
120
|
+
"mt-2 w-36 shrink-0 break-words text-[12px] leading-snug",
|
|
121
|
+
!i.include && "text-slate-400 line-through dark:text-slate-500"
|
|
122
|
+
),
|
|
123
|
+
children: x(e)
|
|
124
|
+
}
|
|
125
|
+
),
|
|
126
|
+
/* @__PURE__ */ t("div", { className: _("min-w-0 flex-1", !i.include && "pointer-events-none opacity-40"), children: /* @__PURE__ */ t(
|
|
127
|
+
we,
|
|
128
|
+
{
|
|
129
|
+
field: e,
|
|
130
|
+
value: i.value,
|
|
131
|
+
onChange: (s) => q(e.field, s),
|
|
132
|
+
relations: y,
|
|
133
|
+
collection: n,
|
|
134
|
+
itemId: "new"
|
|
135
|
+
}
|
|
136
|
+
) }),
|
|
137
|
+
r && i.include && /* @__PURE__ */ t(
|
|
138
|
+
"button",
|
|
139
|
+
{
|
|
140
|
+
type: "button",
|
|
141
|
+
"data-tip": "Back to the original value",
|
|
142
|
+
"aria-label": `Reset ${x(e)}`,
|
|
143
|
+
onClick: () => q(e.field, u[e.field] ?? null),
|
|
144
|
+
className: "mt-2.5 shrink-0 text-slate-400 hover:text-slate-600 dark:hover:text-foreground",
|
|
145
|
+
children: /* @__PURE__ */ t(oe, { className: "h-3.5 w-3.5" })
|
|
146
|
+
}
|
|
147
|
+
)
|
|
148
|
+
] }, e.field);
|
|
149
|
+
}
|
|
93
150
|
return /* @__PURE__ */ l(
|
|
94
|
-
|
|
151
|
+
pe,
|
|
95
152
|
{
|
|
96
|
-
open:
|
|
153
|
+
open: S,
|
|
97
154
|
onOpenChange: (e) => {
|
|
98
|
-
e ?
|
|
155
|
+
e ? ne() : b(!1);
|
|
99
156
|
},
|
|
100
157
|
children: [
|
|
101
|
-
/* @__PURE__ */
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
158
|
+
/* @__PURE__ */ t(he, { asChild: !0, children: /* @__PURE__ */ l(
|
|
159
|
+
O,
|
|
160
|
+
{
|
|
161
|
+
size: "sm",
|
|
162
|
+
variant: "outline",
|
|
163
|
+
className: "gap-1.5",
|
|
164
|
+
"data-clone-open": !0,
|
|
165
|
+
"data-tip": "Pick which values to copy; the copy is saved at once and starts at the first step.",
|
|
166
|
+
children: [
|
|
167
|
+
/* @__PURE__ */ t(L, { className: "h-3.5 w-3.5" }),
|
|
168
|
+
"Clone and save…"
|
|
169
|
+
]
|
|
170
|
+
}
|
|
171
|
+
) }),
|
|
172
|
+
/* @__PURE__ */ l(ge, { className: "flex max-h-[85vh] max-w-xl flex-col overflow-hidden", children: [
|
|
173
|
+
/* @__PURE__ */ l(xe, { className: "shrink-0 space-y-1.5 px-6 pt-6", children: [
|
|
174
|
+
/* @__PURE__ */ t(ye, { className: "truncate text-[15px]", children: p ? `Clone ${p}` : "Clone item" }),
|
|
175
|
+
/* @__PURE__ */ l(be, { className: "text-[12.5px] leading-relaxed", "data-clone-intro": !0, children: [
|
|
109
176
|
"The copy starts at the first step with its own history.",
|
|
110
|
-
!
|
|
177
|
+
!h && $ > 0 && /* @__PURE__ */ l(re, { children: [
|
|
111
178
|
" ",
|
|
112
|
-
|
|
179
|
+
$ === 1 ? "1 field is" : `${$} fields are`,
|
|
113
180
|
" never copied.",
|
|
114
181
|
" ",
|
|
115
182
|
/* @__PURE__ */ l(
|
|
@@ -117,15 +184,15 @@ function $e({
|
|
|
117
184
|
{
|
|
118
185
|
type: "button",
|
|
119
186
|
"aria-expanded": v,
|
|
120
|
-
onClick: () =>
|
|
187
|
+
onClick: () => T((e) => !e),
|
|
121
188
|
className: "inline-flex items-center gap-0.5 font-medium text-nvr-cyan hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/60 rounded",
|
|
122
189
|
"data-clone-never-toggle": !0,
|
|
123
190
|
children: [
|
|
124
191
|
v ? "Hide" : "Show which",
|
|
125
|
-
/* @__PURE__ */
|
|
126
|
-
|
|
192
|
+
/* @__PURE__ */ t(
|
|
193
|
+
Y,
|
|
127
194
|
{
|
|
128
|
-
className:
|
|
195
|
+
className: _("h-3 w-3 transition-transform", v && "rotate-180")
|
|
129
196
|
}
|
|
130
197
|
)
|
|
131
198
|
]
|
|
@@ -133,20 +200,20 @@ function $e({
|
|
|
133
200
|
)
|
|
134
201
|
] })
|
|
135
202
|
] }),
|
|
136
|
-
v && !
|
|
203
|
+
v && !h && /* @__PURE__ */ t(
|
|
137
204
|
"dl",
|
|
138
205
|
{
|
|
139
206
|
className: "mt-1 space-y-1 rounded-md border border-slate-200 bg-slate-50 px-3 py-2 text-[12px] dark:border-border dark:bg-muted/40",
|
|
140
207
|
"data-clone-never-list": !0,
|
|
141
|
-
children:
|
|
142
|
-
/* @__PURE__ */
|
|
143
|
-
/* @__PURE__ */
|
|
208
|
+
children: H.map((e) => /* @__PURE__ */ l("div", { className: "flex gap-2", children: [
|
|
209
|
+
/* @__PURE__ */ t("dt", { className: "w-36 shrink-0 text-slate-500 dark:text-muted-foreground", children: e.label }),
|
|
210
|
+
/* @__PURE__ */ t("dd", { className: "min-w-0 text-slate-700 dark:text-foreground", children: e.fields.map((i) => i.label).join(", ") })
|
|
144
211
|
] }, e.label))
|
|
145
212
|
}
|
|
146
213
|
)
|
|
147
214
|
] }),
|
|
148
|
-
/* @__PURE__ */
|
|
149
|
-
|
|
215
|
+
/* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-y-auto px-6 py-4", children: /* @__PURE__ */ l("div", { className: "space-y-4", children: [
|
|
216
|
+
h && /* @__PURE__ */ t(
|
|
150
217
|
"p",
|
|
151
218
|
{
|
|
152
219
|
className: "text-[12px] text-slate-500 dark:text-muted-foreground",
|
|
@@ -154,101 +221,64 @@ function $e({
|
|
|
154
221
|
children: "Checking which fields a copy keeps…"
|
|
155
222
|
}
|
|
156
223
|
),
|
|
157
|
-
!
|
|
158
|
-
/* @__PURE__ */
|
|
159
|
-
/* @__PURE__ */
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
224
|
+
!h && w.length > 0 && /* @__PURE__ */ l("div", { children: [
|
|
225
|
+
/* @__PURE__ */ t("p", { className: "mb-2 text-[11px] font-medium uppercase tracking-wide text-slate-500 dark:text-muted-foreground", children: "Values the copy starts with" }),
|
|
226
|
+
/* @__PURE__ */ l("div", { className: "space-y-2.5", children: [
|
|
227
|
+
J.map(G),
|
|
228
|
+
J.length === 0 && /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-500 dark:text-muted-foreground", children: "Every field the copy could carry is empty on this record." })
|
|
229
|
+
] }),
|
|
230
|
+
N.length > 0 && /* @__PURE__ */ l("div", { className: "mt-3 border-t border-slate-100 pt-3 dark:border-border", children: [
|
|
231
|
+
/* @__PURE__ */ l(
|
|
232
|
+
"button",
|
|
165
233
|
{
|
|
166
|
-
|
|
167
|
-
"
|
|
234
|
+
type: "button",
|
|
235
|
+
"aria-expanded": F,
|
|
236
|
+
onClick: () => z((e) => !e),
|
|
237
|
+
className: "inline-flex items-center gap-1 rounded text-[12px] font-medium text-slate-600 hover:text-slate-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/60 dark:text-muted-foreground dark:hover:text-foreground",
|
|
238
|
+
"data-clone-empty-toggle": !0,
|
|
168
239
|
children: [
|
|
169
|
-
/* @__PURE__ */
|
|
170
|
-
|
|
171
|
-
{
|
|
172
|
-
checked: t.include,
|
|
173
|
-
"aria-label": `Copy ${p(e)}`,
|
|
174
|
-
onCheckedChange: () => C((s) => ({
|
|
175
|
-
...s,
|
|
176
|
-
[e.field]: { ...s[e.field], include: !s[e.field].include }
|
|
177
|
-
})),
|
|
178
|
-
className: "mt-2 shrink-0 scale-75"
|
|
179
|
-
}
|
|
180
|
-
),
|
|
181
|
-
/* @__PURE__ */ i(
|
|
182
|
-
Q,
|
|
183
|
-
{
|
|
184
|
-
className: D(
|
|
185
|
-
"mt-2.5 w-36 shrink-0 truncate text-[12px]",
|
|
186
|
-
!t.include && "text-slate-400 line-through"
|
|
187
|
-
),
|
|
188
|
-
children: p(e)
|
|
189
|
-
}
|
|
190
|
-
),
|
|
191
|
-
/* @__PURE__ */ i(
|
|
192
|
-
"div",
|
|
240
|
+
/* @__PURE__ */ t(
|
|
241
|
+
Y,
|
|
193
242
|
{
|
|
194
|
-
className:
|
|
195
|
-
"
|
|
196
|
-
!
|
|
197
|
-
),
|
|
198
|
-
children: /* @__PURE__ */ i(
|
|
199
|
-
pe,
|
|
200
|
-
{
|
|
201
|
-
field: e,
|
|
202
|
-
value: t.value,
|
|
203
|
-
onChange: (s) => H(e.field, s),
|
|
204
|
-
relations: h,
|
|
205
|
-
collection: n,
|
|
206
|
-
itemId: "new"
|
|
207
|
-
}
|
|
243
|
+
className: _(
|
|
244
|
+
"h-3.5 w-3.5 transition-transform",
|
|
245
|
+
!F && "-rotate-90"
|
|
208
246
|
)
|
|
209
247
|
}
|
|
210
248
|
),
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
type: "button",
|
|
215
|
-
"data-tip": "Back to the original value",
|
|
216
|
-
"aria-label": `Reset ${p(e)}`,
|
|
217
|
-
onClick: () => H(e.field, g[e.field] ?? null),
|
|
218
|
-
className: "mt-2.5 shrink-0 text-slate-400 hover:text-slate-600 dark:hover:text-foreground",
|
|
219
|
-
children: /* @__PURE__ */ i(ee, { className: "h-3.5 w-3.5" })
|
|
220
|
-
}
|
|
221
|
-
)
|
|
249
|
+
N.length === 1 ? "1 empty field" : `${N.length} empty fields`,
|
|
250
|
+
" ",
|
|
251
|
+
/* @__PURE__ */ t("span", { className: "font-normal text-slate-500 dark:text-muted-foreground", children: "— copied empty unless you fill them" })
|
|
222
252
|
]
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
)
|
|
226
|
-
|
|
253
|
+
}
|
|
254
|
+
),
|
|
255
|
+
F && /* @__PURE__ */ t("div", { className: "mt-2.5 space-y-2.5", "data-clone-empty-list": !0, children: N.map(G) })
|
|
256
|
+
] })
|
|
227
257
|
] }),
|
|
228
|
-
|
|
229
|
-
/* @__PURE__ */
|
|
230
|
-
/* @__PURE__ */
|
|
231
|
-
/* @__PURE__ */
|
|
232
|
-
|
|
258
|
+
k.length > 0 && /* @__PURE__ */ l("div", { children: [
|
|
259
|
+
/* @__PURE__ */ t("p", { className: "mb-2 text-[11px] font-medium uppercase tracking-wide text-slate-500 dark:text-muted-foreground", children: "Sub-rows" }),
|
|
260
|
+
/* @__PURE__ */ t("div", { className: "space-y-2", children: k.map((e) => /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
261
|
+
/* @__PURE__ */ t(
|
|
262
|
+
U,
|
|
233
263
|
{
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
264
|
+
id: `clone-sub-${e.field}`,
|
|
265
|
+
checked: !!A[e.field],
|
|
266
|
+
onCheckedChange: (i) => B((r) => ({ ...r, [e.field]: i === !0 }))
|
|
237
267
|
}
|
|
238
268
|
),
|
|
239
|
-
/* @__PURE__ */ l(
|
|
269
|
+
/* @__PURE__ */ l(W, { htmlFor: `clone-sub-${e.field}`, className: "text-[12px]", children: [
|
|
240
270
|
"Include ",
|
|
241
|
-
|
|
271
|
+
x(e),
|
|
242
272
|
" rows"
|
|
243
273
|
] })
|
|
244
274
|
] }, e.field)) })
|
|
245
275
|
] })
|
|
246
276
|
] }) }),
|
|
247
|
-
/* @__PURE__ */ l(
|
|
248
|
-
/* @__PURE__ */
|
|
249
|
-
/* @__PURE__ */ l(
|
|
250
|
-
/* @__PURE__ */
|
|
251
|
-
|
|
277
|
+
/* @__PURE__ */ l(ve, { className: "shrink-0 border-t border-slate-100 px-6 py-4 dark:border-border", children: [
|
|
278
|
+
/* @__PURE__ */ t(O, { variant: "outline", size: "sm", onClick: () => b(!1), children: "Cancel" }),
|
|
279
|
+
/* @__PURE__ */ l(O, { size: "sm", disabled: j || h, onClick: ie, children: [
|
|
280
|
+
/* @__PURE__ */ t(L, { className: "mr-1.5 h-3.5 w-3.5" }),
|
|
281
|
+
j ? "Cloning…" : "Clone"
|
|
252
282
|
] })
|
|
253
283
|
] })
|
|
254
284
|
] })
|
|
@@ -257,5 +287,5 @@ function $e({
|
|
|
257
287
|
);
|
|
258
288
|
}
|
|
259
289
|
export {
|
|
260
|
-
|
|
290
|
+
Ae as CloneDialog
|
|
261
291
|
};
|
|
@@ -1,50 +1,64 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { CornerDownRight as
|
|
3
|
-
import { useDerivedCause as
|
|
4
|
-
import { liveMotionAllowed as
|
|
5
|
-
import { formatRelative as
|
|
6
|
-
function
|
|
1
|
+
import { jsx as m, jsxs as o } from "react/jsx-runtime";
|
|
2
|
+
import { CornerDownRight as f } from "lucide-react";
|
|
3
|
+
import { useDerivedCause as u, CAUSE_FRESH_MS as p, causeSentence as h } from "../../lib/derived-causes.js";
|
|
4
|
+
import { liveMotionAllowed as x } from "../../lib/live-preference.js";
|
|
5
|
+
import { formatRelative as S, cn as g, formatDate as w, formatDateTime as D } from "../../lib/utils.js";
|
|
6
|
+
function y({
|
|
7
7
|
collection: t,
|
|
8
|
-
itemId:
|
|
8
|
+
itemId: n,
|
|
9
9
|
field: r,
|
|
10
|
-
type:
|
|
10
|
+
type: i,
|
|
11
|
+
currency: s,
|
|
12
|
+
value: e
|
|
11
13
|
}) {
|
|
12
|
-
const
|
|
13
|
-
return
|
|
14
|
+
const a = u(t, n, r);
|
|
15
|
+
return !a || e === null || e === "" || Array.isArray(e) && e.length === 0 ? null : /* @__PURE__ */ m(N, { cause: a, type: i, currency: s });
|
|
14
16
|
}
|
|
15
|
-
function
|
|
17
|
+
function l(t, n, r) {
|
|
16
18
|
if (t == null || t === "") return "empty";
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
+
const i = String(n ?? "").toLowerCase();
|
|
20
|
+
if (i === "date") return w(String(t));
|
|
21
|
+
if (/date|time/.test(i)) return D(String(t));
|
|
22
|
+
const s = typeof t == "number" ? t : Number(t);
|
|
23
|
+
if (r && Number.isFinite(s))
|
|
24
|
+
try {
|
|
25
|
+
return s.toLocaleString("en-US", { style: "currency", currency: r });
|
|
26
|
+
} catch {
|
|
27
|
+
}
|
|
28
|
+
return typeof t == "number" ? t.toLocaleString("en-US", { maximumFractionDigits: 2 }) : String(t);
|
|
19
29
|
}
|
|
20
|
-
function
|
|
30
|
+
function N({
|
|
21
31
|
cause: t,
|
|
22
|
-
type:
|
|
23
|
-
|
|
32
|
+
type: n,
|
|
33
|
+
currency: r,
|
|
34
|
+
now: i = Date.now()
|
|
24
35
|
}) {
|
|
25
|
-
const
|
|
26
|
-
return /* @__PURE__ */
|
|
36
|
+
const s = i - Date.parse(t.at) < p && x(), e = h(t, n, r), a = e.lastIndexOf(" "), d = a > 0 ? e.slice(0, a + 1) : "", c = a > 0 ? e.slice(a + 1) : e;
|
|
37
|
+
return /* @__PURE__ */ o(
|
|
27
38
|
"p",
|
|
28
39
|
{
|
|
29
40
|
"data-derived-cause": t.field,
|
|
30
|
-
"data-tip": `Was ${
|
|
31
|
-
className:
|
|
41
|
+
"data-tip": `Was ${l(t.from, n, r)} · now ${l(t.to, n, r)}`,
|
|
42
|
+
className: g(
|
|
32
43
|
"flex items-start gap-1 rounded px-0.5 text-[11.5px] leading-[1.35rem] text-slate-500 dark:text-slate-400",
|
|
33
|
-
|
|
44
|
+
s && "nvr-derived-fresh"
|
|
34
45
|
),
|
|
35
46
|
children: [
|
|
36
|
-
/* @__PURE__ */
|
|
37
|
-
|
|
47
|
+
/* @__PURE__ */ m(
|
|
48
|
+
f,
|
|
38
49
|
{
|
|
39
50
|
className: "mt-[0.3rem] h-3 w-3 shrink-0 text-slate-400 dark:text-slate-500",
|
|
40
51
|
"aria-hidden": !0
|
|
41
52
|
}
|
|
42
53
|
),
|
|
43
|
-
/* @__PURE__ */
|
|
44
|
-
|
|
45
|
-
/* @__PURE__ */
|
|
46
|
-
|
|
47
|
-
|
|
54
|
+
/* @__PURE__ */ o("span", { className: "min-w-0", children: [
|
|
55
|
+
d,
|
|
56
|
+
/* @__PURE__ */ o("span", { className: "whitespace-nowrap", children: [
|
|
57
|
+
c,
|
|
58
|
+
/* @__PURE__ */ o("span", { className: "text-slate-400 dark:text-slate-500", children: [
|
|
59
|
+
" · ",
|
|
60
|
+
S(t.at)
|
|
61
|
+
] })
|
|
48
62
|
] })
|
|
49
63
|
] })
|
|
50
64
|
]
|
|
@@ -52,6 +66,6 @@ function S({
|
|
|
52
66
|
);
|
|
53
67
|
}
|
|
54
68
|
export {
|
|
55
|
-
|
|
56
|
-
|
|
69
|
+
N as DerivedCauseLine,
|
|
70
|
+
y as DerivedCauseNote
|
|
57
71
|
};
|