@nivaro/react 0.2.54 → 0.2.56
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 +99 -98
- package/dist/index.d.ts +367 -2
- package/dist/index.js +645 -616
- package/dist/layout-editor.d.ts +4 -0
- package/dist/shared/components/BackgroundRunOffer.js +117 -0
- package/dist/shared/components/BroadcastView.js +214 -213
- package/dist/shared/components/CollectionBrowserView.js +2592 -2695
- package/dist/shared/components/ItemEditForm.js +4066 -3832
- package/dist/shared/components/JobsTray.js +100 -55
- package/dist/shared/components/MyWorkView.js +91 -89
- package/dist/shared/components/NotificationBell.js +80 -79
- package/dist/shared/components/ProfileView.js +568 -520
- package/dist/shared/components/RecordCompare.js +254 -0
- package/dist/shared/components/RecordReadView.js +599 -552
- package/dist/shared/components/ReportView.js +578 -543
- package/dist/shared/components/RowPresence.js +91 -0
- package/dist/shared/components/WidgetSlot.js +474 -458
- package/dist/shared/components/ai/AiAnalyticsView.js +16 -6
- package/dist/shared/components/ai/AskPanel.js +139 -119
- package/dist/shared/components/ai/FirstWeekCard.js +126 -0
- package/dist/shared/components/bulk/BulkFieldUpdate.js +289 -0
- package/dist/shared/components/bulk/bulk-field-options.js +45 -0
- package/dist/shared/components/charts/CumulativeFlowChart.js +176 -0
- package/dist/shared/components/chat/ChannelArchive.js +326 -0
- package/dist/shared/components/chat/ChannelExtras.js +141 -121
- package/dist/shared/components/chat/ChatAnalyticsView.js +112 -110
- package/dist/shared/components/chat/ChatPanel.js +1695 -1733
- package/dist/shared/components/chat/Composer.js +357 -303
- package/dist/shared/components/chat/MessageActions.js +92 -0
- package/dist/shared/components/chat/MessageFormat.js +290 -264
- package/dist/shared/components/chat/OutboxBubbles.js +146 -0
- package/dist/shared/components/chat/RequestIdCard.js +135 -0
- package/dist/shared/components/chat/RoomHeaderMenu.js +202 -0
- package/dist/shared/components/chat/RoomParts.js +213 -274
- package/dist/shared/components/chat/ScreenClip.js +184 -0
- package/dist/shared/components/chat/chat-core.js +402 -483
- package/dist/shared/components/chat/chat-drafts.js +59 -0
- package/dist/shared/components/chat/chat-emoji.js +348 -0
- package/dist/shared/components/chat/chat-local-time.js +41 -0
- package/dist/shared/components/chat/chat-outbox.js +303 -0
- package/dist/shared/components/chat/chat-window.js +163 -0
- package/dist/shared/components/chat/huddle/HuddleControls.js +143 -0
- package/dist/shared/components/chat/huddle/HuddleStage.js +164 -0
- package/dist/shared/components/chat/huddle/huddle-store.js +342 -0
- package/dist/shared/components/chat/huddle/useHuddle.js +58 -0
- package/dist/shared/components/help-videos/api.js +76 -73
- package/dist/shared/components/item-edit/CatalogPickerField.js +113 -112
- package/dist/shared/components/item-edit/ChangeReasonDialog.js +13 -13
- package/dist/shared/components/item-edit/FieldAffordances.js +2 -2
- package/dist/shared/components/item-edit/FieldRenderer.js +248 -245
- package/dist/shared/components/item-edit/FieldRow.js +292 -279
- package/dist/shared/components/item-edit/GroupSection.js +698 -574
- package/dist/shared/components/item-edit/InlineTableField.js +3 -1
- package/dist/shared/components/item-edit/RelationCombobox.js +186 -176
- package/dist/shared/components/item-edit/entry/EntryStrip.js +54 -0
- package/dist/shared/components/item-edit/entry/entry-keys.js +27 -0
- package/dist/shared/components/item-edit/entry/useEntryKeyboard.js +70 -0
- package/dist/shared/components/item-edit/entry/useEntryMode.js +59 -0
- package/dist/shared/components/item-edit/form-structure-ui.js +105 -0
- package/dist/shared/components/item-edit/lazy-sections.js +36 -0
- package/dist/shared/components/item-edit/lock-why.js +39 -32
- package/dist/shared/components/item-edit/picker-miss.js +26 -0
- package/dist/shared/components/item-edit/placement-behaviour.js +196 -0
- package/dist/shared/components/item-edit/useFormUsageBeacon.js +51 -45
- package/dist/shared/components/layout-editor/AddPanel.js +134 -117
- package/dist/shared/components/layout-editor/ChangeNote.js +25 -24
- package/dist/shared/components/layout-editor/CollabParts.js +80 -75
- package/dist/shared/components/layout-editor/DesignNode.js +126 -120
- package/dist/shared/components/layout-editor/EditorCanvas.js +30 -27
- package/dist/shared/components/layout-editor/EditorTopBar.js +203 -192
- package/dist/shared/components/layout-editor/HistoryPanel.js +120 -104
- package/dist/shared/components/layout-editor/LayoutEditor.js +768 -671
- package/dist/shared/components/layout-editor/RestorePiece.js +143 -0
- package/dist/shared/components/layout-editor/StagedChip.js +22 -0
- package/dist/shared/components/layout-editor/StructureMenu.js +237 -186
- package/dist/shared/components/layout-editor/collab/FormFollowShare.js +149 -103
- package/dist/shared/components/layout-editor/collab/collab-api.js +29 -26
- package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +81 -80
- package/dist/shared/components/layout-editor/dnd/node.js +69 -57
- package/dist/shared/components/layout-editor/draft-recovery.js +113 -43
- package/dist/shared/components/layout-editor/entry/PlacementPresets.js +149 -0
- package/dist/shared/components/layout-editor/entry/entry-editor-context.js +10 -0
- package/dist/shared/components/layout-editor/entry/presets.js +71 -0
- package/dist/shared/components/layout-editor/entry/tab-order.js +110 -0
- package/dist/shared/components/layout-editor/entry/theme-preview.js +37 -0
- package/dist/shared/components/layout-editor/grid-guides.js +142 -0
- package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +402 -0
- package/dist/shared/components/layout-editor/inspector/BulkInspector.js +61 -57
- package/dist/shared/components/layout-editor/inspector/GroupInspector.js +247 -151
- package/dist/shared/components/layout-editor/inspector/Inspector.js +176 -155
- package/dist/shared/components/layout-editor/inspector/LookTab.js +167 -116
- package/dist/shared/components/layout-editor/inspector/PickerMisses.js +129 -0
- package/dist/shared/components/layout-editor/inspector/PickerTab.js +84 -82
- package/dist/shared/components/layout-editor/inspector/RulesTab.js +66 -62
- package/dist/shared/components/layout-editor/inspector/kit.js +69 -68
- package/dist/shared/components/layout-editor/outputs/OutputsButton.js +254 -0
- package/dist/shared/components/layout-editor/outputs/help-sheet.js +154 -0
- package/dist/shared/components/layout-editor/outputs/output-api.js +61 -0
- package/dist/shared/components/layout-editor/overview/describe-conditions.js +6 -0
- package/dist/shared/components/layout-editor/overview/purpose.js +15 -13
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/layout-editor/restore-piece.js +192 -0
- package/dist/shared/components/layout-editor/section-structure.js +241 -0
- package/dist/shared/components/layout-editor/settings/EntrySection.js +296 -0
- package/dist/shared/components/layout-editor/settings/FormSettings.js +41 -39
- package/dist/shared/components/layout-editor/settings/ResolveSettings.js +255 -0
- package/dist/shared/components/layout-editor/settings/ToolsSection.js +147 -111
- package/dist/shared/components/layout-editor/settings/WhoSection.js +29 -26
- package/dist/shared/components/layout-editor/settings/settings-registry.js +114 -17
- package/dist/shared/components/layout-editor/staged-api.js +64 -0
- package/dist/shared/components/layout-editor/structure-ops.js +81 -77
- package/dist/shared/components/layout-editor/testing/TestingPanels.js +65 -60
- package/dist/shared/components/layout-editor/testing/testing-model.js +198 -185
- package/dist/shared/components/layout-editor/toolbar-kit.js +11 -11
- package/dist/shared/components/layout-editor/usage/AbTestSection.js +355 -0
- package/dist/shared/components/layout-editor/usage/UsagePanel.js +144 -70
- package/dist/shared/components/layout-editor/usage/ab-api.js +86 -0
- package/dist/shared/components/layout-editor/usage/suggest-collapse.js +32 -0
- package/dist/shared/components/layout-editor/useLayoutDraft.js +25 -24
- package/dist/shared/components/notifications/NotificationAnalyticsView.js +148 -77
- package/dist/shared/components/panels/ErpFailureBanner.js +18 -17
- package/dist/shared/components/panels/ExternalRequestsChip.js +63 -62
- package/dist/shared/components/pipeline/PipelineEditorView.js +106 -104
- package/dist/shared/components/profile/AgentsPanel.js +479 -0
- package/dist/shared/components/queue/QueueWorklist.js +1026 -1040
- package/dist/shared/components/support/SupportAnalytics.js +171 -0
- package/dist/shared/components/support/SupportView.js +75 -73
- package/dist/shared/lib/background-runs.js +150 -0
- package/dist/shared/lib/delivery-ack.js +9 -0
- package/dist/shared/lib/entry-badge-style.js +13 -0
- package/dist/shared/lib/entry-config.js +71 -0
- package/dist/shared/lib/form-sections.js +64 -0
- package/dist/shared/lib/form-structure.js +99 -0
- package/dist/shared/lib/form-usage-beacon.js +101 -52
- package/dist/shared/lib/jobs-tray.js +25 -23
- package/dist/shared/lib/keyset-pager.js +37 -0
- package/dist/shared/lib/layout-ops.js +84 -82
- package/dist/shared/lib/layout-resolve.js +113 -0
- package/dist/shared/lib/placement-behaviour.js +144 -0
- package/dist/shared/lib/prefetch.js +149 -0
- package/dist/shared/lib/presence-hooks.js +199 -0
- package/dist/shared/lib/record-outbox.js +82 -81
- package/dist/shared/lib/replay-socket.js +93 -0
- package/dist/shared/lib/request-gate.js +51 -50
- package/dist/shared/lib/room-gaps.js +96 -0
- package/dist/shared/lib/search-log.js +27 -0
- package/dist/shared/lib/socket-realtime.js +101 -80
- package/dist/shared/lib/stale-chunk.js +60 -0
- package/dist/shared/lib/worker-socket.js +200 -0
- package/package.json +1 -1
|
@@ -1,51 +1,52 @@
|
|
|
1
|
-
import { jsxs as s, jsx as a, Fragment as
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { Bookmark as
|
|
1
|
+
import { jsxs as s, jsx as a, Fragment as I } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as ee, useQuery as Q, useMutation as te } from "@tanstack/react-query";
|
|
3
|
+
import { Bookmark as D } from "lucide-react";
|
|
4
4
|
import { useState as h } from "react";
|
|
5
5
|
import { toast as G } from "sonner";
|
|
6
|
-
import { useNivaroClient as
|
|
7
|
-
import { get as
|
|
8
|
-
import { ExplainDiffButton as
|
|
9
|
-
import { useVersionNaming as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
6
|
+
import { useNivaroClient as ae } from "../../context.js";
|
|
7
|
+
import { get as R, post as ne } from "../../lib/commands.js";
|
|
8
|
+
import { ExplainDiffButton as re } from "./assist/ExplainDiff.js";
|
|
9
|
+
import { useVersionNaming as se, fetchVersionBundle as oe } from "./history-api.js";
|
|
10
|
+
import { RestorePieceButton as ie } from "./RestorePiece.js";
|
|
11
|
+
import { SessionHistory as le } from "./SessionHistory.js";
|
|
12
|
+
import { slotName as de } from "./slot-names.js";
|
|
13
|
+
import { layoutDraftKeys as W, parseSaveFailure as V } from "./useLayoutDraft.js";
|
|
14
|
+
function ce(t) {
|
|
14
15
|
return /^before\b/i.test(t) ? t : `Before: ${t}`;
|
|
15
16
|
}
|
|
16
|
-
const
|
|
17
|
+
const H = W.versions, me = W.bundle;
|
|
17
18
|
function N(t) {
|
|
18
19
|
if (t == null || t === "") return "empty";
|
|
19
20
|
if (typeof t == "object") {
|
|
20
|
-
const
|
|
21
|
-
return
|
|
21
|
+
const n = JSON.stringify(t);
|
|
22
|
+
return n.length > 60 ? `${n.slice(0, 57)}…` : n;
|
|
22
23
|
}
|
|
23
24
|
return String(t);
|
|
24
25
|
}
|
|
25
|
-
const
|
|
26
|
-
function
|
|
27
|
-
const
|
|
28
|
-
for (const
|
|
29
|
-
|
|
30
|
-
for (const
|
|
31
|
-
for (const
|
|
32
|
-
for (const
|
|
33
|
-
|
|
34
|
-
for (const
|
|
35
|
-
for (const
|
|
36
|
-
|
|
37
|
-
for (const
|
|
38
|
-
|
|
26
|
+
const O = (t) => t.map((n) => `${n.field} ${N(n.from)} → ${N(n.to)}`), F = (t) => t.startsWith("__") ? de(t) : t;
|
|
27
|
+
function ue(t) {
|
|
28
|
+
const n = [];
|
|
29
|
+
for (const r of t.layout)
|
|
30
|
+
n.push({ kind: "Form", text: `${r.field}: ${N(r.from)} → ${N(r.to)}` });
|
|
31
|
+
for (const r of t.groups.added) n.push({ kind: "Group added", text: r });
|
|
32
|
+
for (const r of t.groups.removed) n.push({ kind: "Group removed", text: r });
|
|
33
|
+
for (const r of t.groups.changed)
|
|
34
|
+
n.push({ kind: "Group", text: `${r.label}: ${O(r.changes).join(" · ")}` });
|
|
35
|
+
for (const r of t.assignments.added) n.push({ kind: "Field added", text: F(r) });
|
|
36
|
+
for (const r of t.assignments.removed)
|
|
37
|
+
n.push({ kind: "Field removed", text: F(r) });
|
|
38
|
+
for (const r of t.assignments.changed)
|
|
39
|
+
n.push({
|
|
39
40
|
kind: "Field",
|
|
40
|
-
text: `${F(
|
|
41
|
+
text: `${F(r.label)}: ${O(r.changes).join(" · ")}`
|
|
41
42
|
});
|
|
42
|
-
return
|
|
43
|
+
return n;
|
|
43
44
|
}
|
|
44
|
-
function
|
|
45
|
-
const [
|
|
45
|
+
function pe({ diff: t }) {
|
|
46
|
+
const [n, r] = h(!1);
|
|
46
47
|
if (t.total === 0)
|
|
47
48
|
return /* @__PURE__ */ a("p", { className: "mt-1 text-[12px] text-slate-500 dark:text-slate-400", children: "Nothing differs from that version. The form is exactly as it was saved." });
|
|
48
|
-
const l =
|
|
49
|
+
const l = ue(t), x = n ? l : l.slice(0, 12);
|
|
49
50
|
return /* @__PURE__ */ s("div", { className: "mt-1", children: [
|
|
50
51
|
t.warnings.map((o) => /* @__PURE__ */ a(
|
|
51
52
|
"p",
|
|
@@ -62,101 +63,104 @@ function de({ diff: t }) {
|
|
|
62
63
|
t.total === 1 ? "" : "s",
|
|
63
64
|
t.from.created_at ? ` since ${new Date(t.from.created_at).toLocaleString()}` : ""
|
|
64
65
|
] }),
|
|
65
|
-
/* @__PURE__ */ a("ul", { className: "mt-1 space-y-0.5", children: x.map((o,
|
|
66
|
+
/* @__PURE__ */ a("ul", { className: "mt-1 space-y-0.5", children: x.map((o, c) => (
|
|
66
67
|
// biome-ignore lint/suspicious/noArrayIndexKey: ordered diff rows
|
|
67
68
|
/* @__PURE__ */ s("li", { className: "flex gap-2 text-[12px]", children: [
|
|
68
69
|
/* @__PURE__ */ a("span", { className: "w-24 shrink-0 text-[11px] text-slate-500 dark:text-slate-400", children: o.kind }),
|
|
69
70
|
/* @__PURE__ */ a("span", { className: "min-w-0 break-words text-slate-700 dark:text-slate-200", children: o.text })
|
|
70
|
-
] },
|
|
71
|
+
] }, c)
|
|
71
72
|
)) }),
|
|
72
73
|
l.length > 12 && /* @__PURE__ */ a(
|
|
73
74
|
"button",
|
|
74
75
|
{
|
|
75
76
|
type: "button",
|
|
76
|
-
onClick: () =>
|
|
77
|
+
onClick: () => r((o) => !o),
|
|
77
78
|
className: "mt-1 text-[11px] text-slate-500 underline dark:text-slate-400",
|
|
78
|
-
children:
|
|
79
|
+
children: n ? "Show fewer" : `Show all ${l.length}`
|
|
79
80
|
}
|
|
80
81
|
)
|
|
81
82
|
] });
|
|
82
83
|
}
|
|
83
|
-
function
|
|
84
|
+
function _e({
|
|
84
85
|
layoutId: t,
|
|
85
|
-
onRestored:
|
|
86
|
-
unsavedCount:
|
|
86
|
+
onRestored: n,
|
|
87
|
+
unsavedCount: r = 0,
|
|
87
88
|
onDiscardUnsaved: l,
|
|
88
89
|
session: x,
|
|
89
90
|
onJump: o,
|
|
90
|
-
onShowOnCanvas:
|
|
91
|
+
onShowOnCanvas: c,
|
|
92
|
+
bundle: _,
|
|
93
|
+
onApply: S,
|
|
94
|
+
fieldLabel: Y
|
|
91
95
|
}) {
|
|
92
|
-
const g =
|
|
93
|
-
queryKey:
|
|
94
|
-
queryFn: () => g.request(
|
|
96
|
+
const g = ae(), k = ee(), [f, q] = h(null), [A, v] = h(null), { data: m = [], isLoading: z } = Q({
|
|
97
|
+
queryKey: H(t),
|
|
98
|
+
queryFn: () => g.request(R(`/collection-layouts/${t}/versions`)).then((e) => e.data ?? []),
|
|
95
99
|
staleTime: 0,
|
|
96
100
|
refetchOnMount: "always"
|
|
97
|
-
}),
|
|
98
|
-
queryKey: ["layout-editor", "version-diff", t,
|
|
101
|
+
}), u = f ?? (m.length > 0 ? "newest" : null), { data: p, isLoading: J } = Q({
|
|
102
|
+
queryKey: ["layout-editor", "version-diff", t, u],
|
|
99
103
|
queryFn: () => g.request(
|
|
100
|
-
|
|
104
|
+
R(`/collection-layouts/${t}/versions/${u}/diff`, { against: "current" })
|
|
101
105
|
).then((e) => e.data),
|
|
102
|
-
enabled:
|
|
106
|
+
enabled: u != null,
|
|
103
107
|
staleTime: 0,
|
|
104
108
|
refetchOnMount: "always"
|
|
105
|
-
}), b =
|
|
106
|
-
mutationFn: (e) => g.request(
|
|
109
|
+
}), b = te({
|
|
110
|
+
mutationFn: (e) => g.request(ne(`/collection-layouts/${t}/versions/${e}/restore`)),
|
|
107
111
|
onSuccess: () => {
|
|
108
|
-
v(null), l == null || l(), k.invalidateQueries({ queryKey:
|
|
112
|
+
v(null), l == null || l(), k.invalidateQueries({ queryKey: me(t) }), k.invalidateQueries({ queryKey: H(t) }), k.invalidateQueries({ queryKey: ["layout-editor", "version-diff", t] }), n == null || n();
|
|
109
113
|
}
|
|
110
|
-
}), y =
|
|
111
|
-
$(e),
|
|
112
|
-
},
|
|
113
|
-
const e = w, i =
|
|
114
|
+
}), y = m.find((e) => e.id === f), { nameVersion: X, nameCurrent: Z } = se(t), [w, $] = h(null), [K, L] = h(""), [C, j] = h(null), B = (e, i = "") => {
|
|
115
|
+
$(e), L(i);
|
|
116
|
+
}, T = () => {
|
|
117
|
+
const e = w, i = K.trim();
|
|
114
118
|
if ($(null), e == null) return;
|
|
115
|
-
const
|
|
116
|
-
e === "current" ? i &&
|
|
117
|
-
},
|
|
118
|
-
if (
|
|
119
|
-
|
|
119
|
+
const P = { onError: (U) => G.error(V(U, "Not named").message) };
|
|
120
|
+
e === "current" ? i && Z.mutate(i, P) : X.mutate({ versionId: e, name: i || null }, P);
|
|
121
|
+
}, E = async (e) => {
|
|
122
|
+
if (c) {
|
|
123
|
+
j(e.id);
|
|
120
124
|
try {
|
|
121
|
-
const i = await
|
|
122
|
-
|
|
125
|
+
const i = await oe(g, t, e.id);
|
|
126
|
+
c(i, e.name ? `“${e.name}” (v${e.version})` : `version ${e.version}`);
|
|
123
127
|
} catch (i) {
|
|
124
|
-
G.error(
|
|
128
|
+
G.error(V(i, "That version could not be read").message);
|
|
125
129
|
} finally {
|
|
126
|
-
|
|
130
|
+
j(null);
|
|
127
131
|
}
|
|
128
132
|
}
|
|
129
|
-
},
|
|
133
|
+
}, M = /* @__PURE__ */ a(
|
|
130
134
|
"input",
|
|
131
135
|
{
|
|
132
136
|
autoFocus: !0,
|
|
133
137
|
"aria-label": "Version name",
|
|
134
|
-
value:
|
|
138
|
+
value: K,
|
|
135
139
|
maxLength: 120,
|
|
136
140
|
placeholder: "e.g. Go-live baseline",
|
|
137
|
-
onChange: (e) =>
|
|
141
|
+
onChange: (e) => L(e.target.value),
|
|
138
142
|
onKeyDown: (e) => {
|
|
139
|
-
e.key === "Enter" &&
|
|
143
|
+
e.key === "Enter" && T(), e.key === "Escape" && (e.stopPropagation(), $(null));
|
|
140
144
|
},
|
|
141
|
-
onBlur:
|
|
145
|
+
onBlur: T,
|
|
142
146
|
className: "h-6 w-full min-w-0 rounded border border-nvr-cyan bg-white px-1.5 text-[12px] outline-none dark:bg-background dark:text-foreground"
|
|
143
147
|
}
|
|
144
|
-
),
|
|
148
|
+
), d = "rounded border border-slate-200 px-1.5 py-0.5 text-[11px] hover:bg-slate-50 dark:border-border dark:hover:bg-muted";
|
|
145
149
|
return /* @__PURE__ */ s("div", { className: "flex flex-col gap-2 text-[12px]", "data-layout-history": !0, children: [
|
|
146
|
-
x && o && /* @__PURE__ */ a(
|
|
147
|
-
|
|
150
|
+
x && o && /* @__PURE__ */ a(le, { session: x, onJump: o }),
|
|
151
|
+
m.length > 0 && /* @__PURE__ */ s("div", { className: "rounded-lg border border-slate-200 bg-slate-50 p-2 dark:border-border dark:bg-muted/40", children: [
|
|
148
152
|
/* @__PURE__ */ s("div", { className: "flex items-center justify-between gap-2", children: [
|
|
149
153
|
/* @__PURE__ */ a("p", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: f == null ? "What the last save changed" : `Version ${(y == null ? void 0 : y.version) ?? "?"} compared with now` }),
|
|
150
154
|
/* @__PURE__ */ s("span", { className: "flex items-center gap-2", children: [
|
|
151
|
-
|
|
155
|
+
c && p && p.total > 0 && /* @__PURE__ */ a(
|
|
152
156
|
"button",
|
|
153
157
|
{
|
|
154
158
|
type: "button",
|
|
155
159
|
"data-show-on-canvas": "",
|
|
156
160
|
disabled: C != null,
|
|
157
161
|
onClick: () => {
|
|
158
|
-
const e = y ??
|
|
159
|
-
e &&
|
|
162
|
+
const e = y ?? m[0];
|
|
163
|
+
e && E(e);
|
|
160
164
|
},
|
|
161
165
|
"data-tip": "Mark what differs on the form itself: added, moved, changed, removed",
|
|
162
166
|
className: "text-[11px] text-slate-600 underline dark:text-slate-300",
|
|
@@ -167,53 +171,53 @@ function ve({
|
|
|
167
171
|
"button",
|
|
168
172
|
{
|
|
169
173
|
type: "button",
|
|
170
|
-
onClick: () =>
|
|
174
|
+
onClick: () => q(null),
|
|
171
175
|
className: "text-[11px] text-slate-500 underline dark:text-slate-400",
|
|
172
176
|
children: "Show last save"
|
|
173
177
|
}
|
|
174
178
|
)
|
|
175
179
|
] })
|
|
176
180
|
] }),
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
+
J && /* @__PURE__ */ a("p", { className: "mt-1 text-slate-500", children: "Comparing…" }),
|
|
182
|
+
p && /* @__PURE__ */ a(pe, { diff: p }),
|
|
183
|
+
p && p.total > 0 && u != null && /* @__PURE__ */ a(
|
|
184
|
+
re,
|
|
181
185
|
{
|
|
182
186
|
className: "mt-2",
|
|
183
|
-
a: { layout_id: t, version:
|
|
187
|
+
a: { layout_id: t, version: u },
|
|
184
188
|
b: { layout_id: t, version: "current" }
|
|
185
189
|
},
|
|
186
|
-
String(
|
|
190
|
+
String(u)
|
|
187
191
|
)
|
|
188
192
|
] }),
|
|
189
193
|
b.isError && /* @__PURE__ */ a("p", { className: "text-[12px] text-[#9c2f47] dark:text-[#f08aa1]", children: "Restore failed. Nothing was changed." }),
|
|
190
|
-
/* @__PURE__ */ a("div", { className: "flex items-center gap-2", "data-name-current": "", children: w === "current" ?
|
|
194
|
+
/* @__PURE__ */ a("div", { className: "flex items-center gap-2", "data-name-current": "", children: w === "current" ? M : /* @__PURE__ */ s(
|
|
191
195
|
"button",
|
|
192
196
|
{
|
|
193
197
|
type: "button",
|
|
194
|
-
onClick: () =>
|
|
198
|
+
onClick: () => B("current"),
|
|
195
199
|
"data-tip": "Keep the form as it is saved now, under a name, beyond the rolling 30 versions",
|
|
196
|
-
className: `${
|
|
200
|
+
className: `${d} inline-flex items-center gap-1`,
|
|
197
201
|
children: [
|
|
198
|
-
/* @__PURE__ */ a(
|
|
202
|
+
/* @__PURE__ */ a(D, { className: "h-3 w-3" }),
|
|
199
203
|
"Name the saved form…"
|
|
200
204
|
]
|
|
201
205
|
}
|
|
202
206
|
) }),
|
|
203
|
-
|
|
207
|
+
z ? /* @__PURE__ */ a("p", { className: "text-slate-500", children: "Loading history…" }) : m.length === 0 ? /* @__PURE__ */ a("p", { className: "text-slate-500 dark:text-slate-400", children: "No versions yet. One is saved before every change." }) : /* @__PURE__ */ a("ul", { className: "max-h-64 space-y-1 overflow-y-auto", children: m.map((e) => /* @__PURE__ */ s(
|
|
204
208
|
"li",
|
|
205
209
|
{
|
|
206
210
|
className: "flex items-center justify-between gap-2 rounded border border-slate-100 px-2 py-1 dark:border-border/60",
|
|
207
211
|
children: [
|
|
208
212
|
/* @__PURE__ */ s("span", { className: "min-w-0 flex-1", children: [
|
|
209
|
-
w === e.id ?
|
|
213
|
+
w === e.id ? M : e.name && /* @__PURE__ */ s(
|
|
210
214
|
"span",
|
|
211
215
|
{
|
|
212
216
|
"data-version-name": e.name,
|
|
213
217
|
"data-tip": "Named: kept beyond the rolling 30 versions",
|
|
214
218
|
className: "mr-1 inline-flex max-w-full items-center gap-0.5 rounded bg-slate-100 px-1 text-[11px] font-medium text-slate-700 dark:bg-muted dark:text-slate-200",
|
|
215
219
|
children: [
|
|
216
|
-
/* @__PURE__ */ a(
|
|
220
|
+
/* @__PURE__ */ a(D, { className: "h-3 w-3 shrink-0" }),
|
|
217
221
|
/* @__PURE__ */ a("span", { className: "truncate", children: e.name })
|
|
218
222
|
]
|
|
219
223
|
}
|
|
@@ -224,7 +228,7 @@ function ve({
|
|
|
224
228
|
] }),
|
|
225
229
|
" ",
|
|
226
230
|
/* @__PURE__ */ s("span", { className: "text-slate-500 dark:text-slate-400", children: [
|
|
227
|
-
e.note ? `${
|
|
231
|
+
e.note ? `${ce(e.note)} · ` : "",
|
|
228
232
|
new Date(e.created_at).toLocaleString(),
|
|
229
233
|
e.created_by_name ? ` · ${e.created_by_name}` : ""
|
|
230
234
|
] })
|
|
@@ -235,9 +239,9 @@ function ve({
|
|
|
235
239
|
{
|
|
236
240
|
type: "button",
|
|
237
241
|
"data-version-name-edit": e.version,
|
|
238
|
-
onClick: () =>
|
|
242
|
+
onClick: () => B(e.id, e.name ?? ""),
|
|
239
243
|
"data-tip": e.name ? "Rename, or clear the name to let it be pruned again" : "Name this version so it is kept beyond the rolling 30",
|
|
240
|
-
className:
|
|
244
|
+
className: d,
|
|
241
245
|
children: e.name ? "Rename" : "Name"
|
|
242
246
|
}
|
|
243
247
|
),
|
|
@@ -248,24 +252,36 @@ function ve({
|
|
|
248
252
|
"data-tip": "See what differs from the form now",
|
|
249
253
|
"data-version-diff": e.version,
|
|
250
254
|
"data-setting": "tool.version_diff",
|
|
251
|
-
onClick: () =>
|
|
252
|
-
className: `${
|
|
255
|
+
onClick: () => q(e.id),
|
|
256
|
+
className: `${d} ${f === e.id ? "border-nvr-cyan text-nvr-navy dark:text-nvr-cyan" : ""}`,
|
|
253
257
|
children: "Compare"
|
|
254
258
|
}
|
|
255
259
|
),
|
|
256
|
-
|
|
260
|
+
c && /* @__PURE__ */ a(
|
|
257
261
|
"button",
|
|
258
262
|
{
|
|
259
263
|
type: "button",
|
|
260
264
|
"data-version-canvas": e.version,
|
|
261
265
|
disabled: C != null,
|
|
262
|
-
onClick: () => void
|
|
266
|
+
onClick: () => void E(e),
|
|
263
267
|
"data-tip": "Mark on the form what differs from this version",
|
|
264
|
-
className:
|
|
268
|
+
className: d,
|
|
265
269
|
children: C === e.id ? "…" : "Canvas"
|
|
266
270
|
}
|
|
267
271
|
),
|
|
268
|
-
|
|
272
|
+
_ && S && /* @__PURE__ */ a(
|
|
273
|
+
ie,
|
|
274
|
+
{
|
|
275
|
+
layoutId: t,
|
|
276
|
+
version: e,
|
|
277
|
+
bundle: _,
|
|
278
|
+
onApply: S,
|
|
279
|
+
fieldLabel: Y,
|
|
280
|
+
onDone: n,
|
|
281
|
+
className: d
|
|
282
|
+
}
|
|
283
|
+
),
|
|
284
|
+
A === e.id ? /* @__PURE__ */ s(I, { children: [
|
|
269
285
|
/* @__PURE__ */ a(
|
|
270
286
|
"button",
|
|
271
287
|
{
|
|
@@ -273,12 +289,12 @@ function ve({
|
|
|
273
289
|
"data-restore-confirm": e.id,
|
|
274
290
|
disabled: b.isPending,
|
|
275
291
|
onClick: () => b.mutate(e.id),
|
|
276
|
-
"data-tip":
|
|
292
|
+
"data-tip": r > 0 ? `Your ${r} unsaved ${r === 1 ? "change is" : "changes are"} dropped` : void 0,
|
|
277
293
|
className: "rounded bg-nvr-cyan px-1.5 py-0.5 text-[11px] text-white disabled:opacity-60",
|
|
278
|
-
children: b.isPending ? "Restoring…" :
|
|
294
|
+
children: b.isPending ? "Restoring…" : r > 0 ? "Restore, drop unsaved" : "Yes, restore"
|
|
279
295
|
}
|
|
280
296
|
),
|
|
281
|
-
/* @__PURE__ */ a("button", { type: "button", onClick: () => v(null), className:
|
|
297
|
+
/* @__PURE__ */ a("button", { type: "button", onClick: () => v(null), className: d, children: "Cancel" })
|
|
282
298
|
] }) : /* @__PURE__ */ a(
|
|
283
299
|
"button",
|
|
284
300
|
{
|
|
@@ -287,7 +303,7 @@ function ve({
|
|
|
287
303
|
"data-setting": "tool.version_restore",
|
|
288
304
|
"data-tip": "Replace the form with this version. The current one is kept as a version first.",
|
|
289
305
|
onClick: () => v(e.id),
|
|
290
|
-
className:
|
|
306
|
+
className: d,
|
|
291
307
|
children: "Restore"
|
|
292
308
|
}
|
|
293
309
|
)
|
|
@@ -299,6 +315,6 @@ function ve({
|
|
|
299
315
|
] });
|
|
300
316
|
}
|
|
301
317
|
export {
|
|
302
|
-
|
|
303
|
-
|
|
318
|
+
_e as HistoryPanel,
|
|
319
|
+
ce as versionNoteLabel
|
|
304
320
|
};
|