@nivaro/react 0.3.41 → 0.3.42
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/LayoutForm.js +100 -98
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +644 -15
- package/dist/index.js +814 -775
- package/dist/shared/components/ActivityEntry.js +154 -0
- package/dist/shared/components/AudienceConfirmPanel.js +98 -0
- package/dist/shared/components/BackgroundRunOffer.js +43 -31
- package/dist/shared/components/BroadcastView.js +225 -204
- package/dist/shared/components/CollectionBrowserView.js +3924 -3584
- package/dist/shared/components/ConfigHistory.js +153 -0
- package/dist/shared/components/ConfigReadBack.js +65 -0
- package/dist/shared/components/DataTable.js +379 -346
- package/dist/shared/components/ForceReloadBanner.js +47 -40
- package/dist/shared/components/IdleReloadWatcher.js +69 -0
- package/dist/shared/components/ItemEditForm.js +4041 -3853
- package/dist/shared/components/MyWorkView.js +278 -213
- package/dist/shared/components/NotificationBell.js +130 -121
- package/dist/shared/components/ProfileView.js +776 -1003
- package/dist/shared/components/RecentRecordsRail.js +34 -16
- package/dist/shared/components/RecordReadView.js +500 -477
- package/dist/shared/components/Skeletons.js +199 -0
- package/dist/shared/components/SlowNotice.js +63 -0
- package/dist/shared/components/Term.js +23 -0
- package/dist/shared/components/WidgetSlot.js +350 -353
- package/dist/shared/components/access/PermissionSummary.js +106 -0
- package/dist/shared/components/bulk/BulkActionButtons.js +76 -73
- package/dist/shared/components/chat/ChatPanel.js +902 -886
- package/dist/shared/components/chat/MemberPaging.js +70 -0
- package/dist/shared/components/chat/RoomParts.js +147 -117
- package/dist/shared/components/chat/ScreenClip.js +73 -69
- package/dist/shared/components/chat/chat-core.js +449 -396
- package/dist/shared/components/chat/huddle/huddle-store.js +48 -43
- package/dist/shared/components/help-videos/api.js +2 -5
- package/dist/shared/components/help-videos/viewer/HelpVideoMatchChip.js +79 -0
- package/dist/shared/components/help-videos/viewer/matchChip.js +50 -0
- package/dist/shared/components/imports/CollectionImportPanel.js +139 -133
- package/dist/shared/components/imports/RunDetailSheet.js +222 -227
- package/dist/shared/components/integrations/console/ErrorExplanation.js +121 -0
- package/dist/shared/components/integrations/console/PartnerDetail.js +175 -174
- package/dist/shared/components/integrations/console/SubmissionRow.js +36 -34
- package/dist/shared/components/integrations/console/drill/SubmissionDrill.js +50 -48
- package/dist/shared/components/item-edit/FieldComments.js +212 -0
- package/dist/shared/components/item-edit/FieldRow.js +340 -336
- package/dist/shared/components/item-edit/RecordHeaderActions.js +23 -22
- package/dist/shared/components/item-edit/RelationCombobox.js +231 -222
- package/dist/shared/components/item-edit/RuleHiddenNotes.js +55 -0
- package/dist/shared/components/item-edit/field-comments-context.js +6 -0
- package/dist/shared/components/item-edit/field-sources.js +33 -0
- package/dist/shared/components/item-edit/rule-hidden.js +30 -0
- package/dist/shared/components/layout-editor/HistoryPanel.js +113 -96
- package/dist/shared/components/layout-editor/editors/cascade-filters.js +170 -145
- package/dist/shared/components/layout-editor/inspector/Breadcrumb.js +22 -18
- package/dist/shared/components/layout-editor/inspector/GroupInspector.js +177 -159
- package/dist/shared/components/layout-editor/inspector/PickerTab.js +35 -34
- package/dist/shared/components/layout-editor/inspector/RulesTab.js +124 -111
- package/dist/shared/components/layout-editor/inspector/kit.js +292 -277
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/list/CopyListLinkButton.js +41 -0
- package/dist/shared/components/list/InlineEdit.js +363 -0
- package/dist/shared/components/notifications/NotificationCenterView.js +213 -181
- package/dist/shared/components/notifications/NotificationDetailBits.js +205 -82
- package/dist/shared/components/notifications/NotificationRulesEditor.js +515 -0
- package/dist/shared/components/notifications/TestMyRules.js +137 -0
- package/dist/shared/components/notifications/changes-lines.js +24 -0
- package/dist/shared/components/notifications/why-lines.js +64 -0
- package/dist/shared/components/panels/CommentPanel.js +316 -281
- package/dist/shared/components/panels/LegalHoldBanner.js +38 -0
- package/dist/shared/components/panels/PipelinePanel.js +201 -196
- package/dist/shared/components/panels/RevisionsPanel.js +496 -479
- package/dist/shared/components/pipeline/PipelineEditorView.js +1587 -1560
- package/dist/shared/components/pipeline/PipelineStateOwners.js +116 -103
- package/dist/shared/components/profile/PersonDidPanel.js +188 -0
- package/dist/shared/components/profile/PersonProfile.js +57 -52
- package/dist/shared/components/queue/QueueWorklist.js +1526 -1365
- package/dist/shared/hooks/useSlowReason.js +39 -0
- package/dist/shared/lib/activity-sentence.js +670 -0
- package/dist/shared/lib/config-sentences.js +418 -0
- package/dist/shared/lib/core-glossary.js +229 -0
- package/dist/shared/lib/error-hints.js +159 -0
- package/dist/shared/lib/error-message.js +105 -0
- package/dist/shared/lib/error-toast.js +22 -0
- package/dist/shared/lib/field-comments.js +25 -0
- package/dist/shared/lib/filter-sentence.js +261 -0
- package/dist/shared/lib/glossary.js +55 -48
- package/dist/shared/lib/idle-reload.js +138 -0
- package/dist/shared/lib/layout-resolve.js +42 -29
- package/dist/shared/lib/list-inline-edit.js +190 -0
- package/dist/shared/lib/list-link.js +147 -0
- package/dist/shared/lib/prefetch.js +259 -106
- package/dist/shared/lib/record-ref.js +72 -0
- package/dist/shared/lib/reload-holds.js +25 -0
- package/dist/shared/lib/safe-error.js +52 -24
- package/dist/shared/lib/skeleton-shapes.js +72 -0
- package/dist/shared/lib/slow-reason.js +63 -0
- package/package.json +1 -1
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx as n, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
import { EyeOff as s, Eye as o } from "lucide-react";
|
|
3
|
+
function m({
|
|
4
|
+
items: l,
|
|
5
|
+
revealed: i,
|
|
6
|
+
onToggle: r,
|
|
7
|
+
noun: d = "section"
|
|
8
|
+
}) {
|
|
9
|
+
return l.length === 0 ? null : /* @__PURE__ */ n("ul", { "data-rule-hidden-notes": !0, className: "m-0 list-none space-y-0.5 p-0", children: l.map((e) => {
|
|
10
|
+
const a = i.has(e.key);
|
|
11
|
+
return /* @__PURE__ */ t(
|
|
12
|
+
"li",
|
|
13
|
+
{
|
|
14
|
+
"data-rule-hidden": e.key,
|
|
15
|
+
"data-rule-hidden-open": a ? "" : void 0,
|
|
16
|
+
className: "flex flex-wrap items-center gap-x-1.5 gap-y-0.5 text-[12px] leading-5 text-slate-500 dark:text-muted-foreground",
|
|
17
|
+
children: [
|
|
18
|
+
/* @__PURE__ */ n(
|
|
19
|
+
s,
|
|
20
|
+
{
|
|
21
|
+
"aria-hidden": !0,
|
|
22
|
+
className: "h-3.5 w-3.5 shrink-0 text-slate-400 dark:text-slate-500"
|
|
23
|
+
}
|
|
24
|
+
),
|
|
25
|
+
/* @__PURE__ */ t("span", { className: "min-w-0", children: [
|
|
26
|
+
/* @__PURE__ */ n("span", { className: "font-medium text-slate-600 dark:text-slate-300", children: e.label }),
|
|
27
|
+
" ",
|
|
28
|
+
"shows when ",
|
|
29
|
+
e.when,
|
|
30
|
+
a ? " — shown read-only" : ""
|
|
31
|
+
] }),
|
|
32
|
+
r && /* @__PURE__ */ t(
|
|
33
|
+
"button",
|
|
34
|
+
{
|
|
35
|
+
type: "button",
|
|
36
|
+
onClick: () => r(e.key),
|
|
37
|
+
"aria-expanded": a,
|
|
38
|
+
"aria-label": a ? `Hide the ${e.label} ${d} again` : `Show the ${e.label} ${d} anyway, read-only`,
|
|
39
|
+
"data-rule-hidden-toggle": e.key,
|
|
40
|
+
className: "inline-flex items-center gap-1 rounded px-1 text-[12px] font-medium text-[#0e7490] transition-colors hover:bg-muted dark:text-nvr-cyan",
|
|
41
|
+
children: [
|
|
42
|
+
a ? /* @__PURE__ */ n(s, { "aria-hidden": !0, className: "h-3 w-3" }) : /* @__PURE__ */ n(o, { "aria-hidden": !0, className: "h-3 w-3" }),
|
|
43
|
+
a ? "Hide again" : "Show anyway (read-only)"
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
)
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
e.key
|
|
50
|
+
);
|
|
51
|
+
}) });
|
|
52
|
+
}
|
|
53
|
+
export {
|
|
54
|
+
m as RuleHiddenNotes
|
|
55
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { describeFieldSource as s } from "../../lib/config-sentences.js";
|
|
2
|
+
import { titleCase as m } from "../../lib/utils.js";
|
|
3
|
+
function p(l, d, i) {
|
|
4
|
+
var r;
|
|
5
|
+
if (!l.length) return {};
|
|
6
|
+
const t = { fields: {}, types: {}, links: {}, collections: {} };
|
|
7
|
+
for (const o of l)
|
|
8
|
+
o.label && (t.fields[o.field] = o.label), o.type && (t.types[o.field] = o.type);
|
|
9
|
+
for (const o of d)
|
|
10
|
+
if (o.many_collection === i && o.many_field && o.one_collection && !o.junction_field && (t.links[o.many_field] = o.one_collection), o.one_collection === i && o.one_field && o.many_collection) {
|
|
11
|
+
const e = l.find((c) => c.field === o.one_field);
|
|
12
|
+
t.collections[o.many_collection] = ((r = e == null ? void 0 : e.label) == null ? void 0 : r.trim()) || m(o.many_collection);
|
|
13
|
+
}
|
|
14
|
+
const n = l.filter((o) => o.cross_record_defaults).map((o) => ({ field: o.field, config: o.cross_record_defaults })), f = {};
|
|
15
|
+
for (const o of l) {
|
|
16
|
+
if (!o.computed_type && !n.length) continue;
|
|
17
|
+
const e = s(
|
|
18
|
+
{
|
|
19
|
+
field: o.field,
|
|
20
|
+
computed_type: o.computed_type,
|
|
21
|
+
computed_formula: typeof o.computed_formula == "string" ? o.computed_formula : o.computed_formula ? JSON.stringify(o.computed_formula) : null,
|
|
22
|
+
computed_store: o.computed_store ?? null
|
|
23
|
+
},
|
|
24
|
+
t,
|
|
25
|
+
n.filter((c) => c.field !== o.field)
|
|
26
|
+
);
|
|
27
|
+
e && (f[o.field] = e);
|
|
28
|
+
}
|
|
29
|
+
return f;
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
p as fieldSourcesFor
|
|
33
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { parseVisibleWhen as r, matchesVisibleWhen as u } from "../../lib/visible-when.js";
|
|
2
|
+
import { describeShowWhen as l } from "../layout-editor/show-when.js";
|
|
3
|
+
function f(n, o, s = {}) {
|
|
4
|
+
const i = [];
|
|
5
|
+
for (const e of r(n)) {
|
|
6
|
+
if (!(e != null && e.field)) continue;
|
|
7
|
+
const t = l([e], o, s);
|
|
8
|
+
t && i.push(/^(is|has) /.test(t) ? `the record ${t}` : t);
|
|
9
|
+
}
|
|
10
|
+
return i.length ? i.join(" and ") : null;
|
|
11
|
+
}
|
|
12
|
+
function a(n, o, s) {
|
|
13
|
+
const i = n.filter((e) => !e.startsWith("__"));
|
|
14
|
+
return i.length === 0 ? !1 : s ? !0 : o ? i.some((e) => Object.hasOwn(o, e)) : !1;
|
|
15
|
+
}
|
|
16
|
+
function d(n) {
|
|
17
|
+
var i;
|
|
18
|
+
const o = new Set(n.quiet ?? []), s = [];
|
|
19
|
+
for (const e of n.groups) {
|
|
20
|
+
if (o.has(e.key) || r(e.visible_when).length === 0 || u(e.visible_when, n.values) || !n.readable(e.key)) continue;
|
|
21
|
+
const t = f(e.visible_when, n.fields, n.choices);
|
|
22
|
+
t && s.push({ key: e.key, label: ((i = e.label) == null ? void 0 : i.trim()) || e.key, when: t });
|
|
23
|
+
}
|
|
24
|
+
return s;
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
a as groupHasReadableField,
|
|
28
|
+
d as ruleHiddenGroups,
|
|
29
|
+
f as ruleHiddenWhen
|
|
30
|
+
};
|
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
import { jsxs as s, jsx as
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { Bookmark as
|
|
1
|
+
import { jsxs as s, jsx as n, Fragment as ee } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as te, useQuery as Q, useMutation as ne } from "@tanstack/react-query";
|
|
3
|
+
import { Bookmark as R } from "lucide-react";
|
|
4
4
|
import { useState as h } from "react";
|
|
5
|
-
import { toast as
|
|
6
|
-
import { useNivaroClient as ae } from "../../context.js";
|
|
7
|
-
import { get as
|
|
8
|
-
import { ExplainDiffButton as
|
|
9
|
-
import { useVersionNaming as
|
|
10
|
-
import { RestorePieceButton as
|
|
11
|
-
import { SessionHistory as
|
|
12
|
-
import { slotName as
|
|
13
|
-
import { layoutDraftKeys as
|
|
14
|
-
function
|
|
5
|
+
import { toast as D } from "sonner";
|
|
6
|
+
import { useNivaroClient as ae, useNavigation as re } from "../../context.js";
|
|
7
|
+
import { get as G, post as se } from "../../lib/commands.js";
|
|
8
|
+
import { ExplainDiffButton as oe } from "./assist/ExplainDiff.js";
|
|
9
|
+
import { useVersionNaming as ie, fetchVersionBundle as le } from "./history-api.js";
|
|
10
|
+
import { RestorePieceButton as de } from "./RestorePiece.js";
|
|
11
|
+
import { SessionHistory as ce } from "./SessionHistory.js";
|
|
12
|
+
import { slotName as me } from "./slot-names.js";
|
|
13
|
+
import { layoutDraftKeys as H, parseSaveFailure as V } from "./useLayoutDraft.js";
|
|
14
|
+
function ue(t) {
|
|
15
15
|
return /^before\b/i.test(t) ? t : `Before: ${t}`;
|
|
16
16
|
}
|
|
17
|
-
const
|
|
17
|
+
const W = H.versions, pe = H.bundle;
|
|
18
18
|
function N(t) {
|
|
19
19
|
if (t == null || t === "") return "empty";
|
|
20
20
|
if (typeof t == "object") {
|
|
21
|
-
const
|
|
22
|
-
return
|
|
21
|
+
const a = JSON.stringify(t);
|
|
22
|
+
return a.length > 60 ? `${a.slice(0, 57)}…` : a;
|
|
23
23
|
}
|
|
24
24
|
return String(t);
|
|
25
25
|
}
|
|
26
|
-
const
|
|
27
|
-
function
|
|
28
|
-
const
|
|
26
|
+
const A = (t) => t.map((a) => `${a.field} ${N(a.from)} → ${N(a.to)}`), _ = (t) => t.startsWith("__") ? me(t) : t;
|
|
27
|
+
function he(t) {
|
|
28
|
+
const a = [];
|
|
29
29
|
for (const r of t.layout)
|
|
30
|
-
|
|
31
|
-
for (const r of t.groups.added)
|
|
32
|
-
for (const r of t.groups.removed)
|
|
30
|
+
a.push({ kind: "Form", text: `${r.field}: ${N(r.from)} → ${N(r.to)}` });
|
|
31
|
+
for (const r of t.groups.added) a.push({ kind: "Group added", text: r });
|
|
32
|
+
for (const r of t.groups.removed) a.push({ kind: "Group removed", text: r });
|
|
33
33
|
for (const r of t.groups.changed)
|
|
34
|
-
|
|
35
|
-
for (const r of t.assignments.added)
|
|
34
|
+
a.push({ kind: "Group", text: `${r.label}: ${A(r.changes).join(" · ")}` });
|
|
35
|
+
for (const r of t.assignments.added) a.push({ kind: "Field added", text: _(r) });
|
|
36
36
|
for (const r of t.assignments.removed)
|
|
37
|
-
|
|
37
|
+
a.push({ kind: "Field removed", text: _(r) });
|
|
38
38
|
for (const r of t.assignments.changed)
|
|
39
|
-
|
|
39
|
+
a.push({
|
|
40
40
|
kind: "Field",
|
|
41
|
-
text: `${
|
|
41
|
+
text: `${_(r.label)}: ${A(r.changes).join(" · ")}`
|
|
42
42
|
});
|
|
43
|
-
return
|
|
43
|
+
return a;
|
|
44
44
|
}
|
|
45
|
-
function
|
|
46
|
-
const [
|
|
45
|
+
function fe({ diff: t }) {
|
|
46
|
+
const [a, r] = h(!1);
|
|
47
47
|
if (t.total === 0)
|
|
48
|
-
return /* @__PURE__ */
|
|
49
|
-
const
|
|
48
|
+
return /* @__PURE__ */ n("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." });
|
|
49
|
+
const o = he(t), x = a ? o : o.slice(0, 12);
|
|
50
50
|
return /* @__PURE__ */ s("div", { className: "mt-1", children: [
|
|
51
|
-
t.warnings.map((
|
|
51
|
+
t.warnings.map((i) => /* @__PURE__ */ n(
|
|
52
52
|
"p",
|
|
53
53
|
{
|
|
54
54
|
"data-layout-diff-warning": !0,
|
|
55
55
|
className: "mb-1 rounded bg-[#fae6eb] px-1.5 py-1 text-[12px] text-[#9c2f47] dark:bg-[#3d1621] dark:text-[#f08aa1]",
|
|
56
|
-
children:
|
|
56
|
+
children: i
|
|
57
57
|
},
|
|
58
|
-
|
|
58
|
+
i
|
|
59
59
|
)),
|
|
60
60
|
/* @__PURE__ */ s("p", { className: "text-[12px] text-slate-500 dark:text-slate-400", children: [
|
|
61
61
|
t.total,
|
|
@@ -63,82 +63,82 @@ function pe({ diff: t }) {
|
|
|
63
63
|
t.total === 1 ? "" : "s",
|
|
64
64
|
t.from.created_at ? ` since ${new Date(t.from.created_at).toLocaleString()}` : ""
|
|
65
65
|
] }),
|
|
66
|
-
/* @__PURE__ */
|
|
66
|
+
/* @__PURE__ */ n("ul", { className: "mt-1 space-y-0.5", children: x.map((i, c) => (
|
|
67
67
|
// biome-ignore lint/suspicious/noArrayIndexKey: ordered diff rows
|
|
68
68
|
/* @__PURE__ */ s("li", { className: "flex gap-2 text-[12px]", children: [
|
|
69
|
-
/* @__PURE__ */
|
|
70
|
-
/* @__PURE__ */
|
|
69
|
+
/* @__PURE__ */ n("span", { className: "w-24 shrink-0 text-[11px] text-slate-500 dark:text-slate-400", children: i.kind }),
|
|
70
|
+
/* @__PURE__ */ n("span", { className: "min-w-0 break-words text-slate-700 dark:text-slate-200", children: i.text })
|
|
71
71
|
] }, c)
|
|
72
72
|
)) }),
|
|
73
|
-
|
|
73
|
+
o.length > 12 && /* @__PURE__ */ n(
|
|
74
74
|
"button",
|
|
75
75
|
{
|
|
76
76
|
type: "button",
|
|
77
|
-
onClick: () => r((
|
|
77
|
+
onClick: () => r((i) => !i),
|
|
78
78
|
className: "mt-1 text-[11px] text-slate-500 underline dark:text-slate-400",
|
|
79
|
-
children:
|
|
79
|
+
children: a ? "Show fewer" : `Show all ${o.length}`
|
|
80
80
|
}
|
|
81
81
|
)
|
|
82
82
|
] });
|
|
83
83
|
}
|
|
84
|
-
function
|
|
84
|
+
function Le({
|
|
85
85
|
layoutId: t,
|
|
86
|
-
onRestored:
|
|
86
|
+
onRestored: a,
|
|
87
87
|
unsavedCount: r = 0,
|
|
88
|
-
onDiscardUnsaved:
|
|
88
|
+
onDiscardUnsaved: o,
|
|
89
89
|
session: x,
|
|
90
|
-
onJump:
|
|
90
|
+
onJump: i,
|
|
91
91
|
onShowOnCanvas: c,
|
|
92
|
-
bundle:
|
|
92
|
+
bundle: F,
|
|
93
93
|
onApply: S,
|
|
94
|
-
fieldLabel:
|
|
94
|
+
fieldLabel: O
|
|
95
95
|
}) {
|
|
96
|
-
const g = ae(), k =
|
|
97
|
-
queryKey:
|
|
98
|
-
queryFn: () => g.request(
|
|
96
|
+
const g = ae(), Y = re(), k = te(), [f, q] = h(null), [z, v] = h(null), { data: m = [], isLoading: J } = Q({
|
|
97
|
+
queryKey: W(t),
|
|
98
|
+
queryFn: () => g.request(G(`/collection-layouts/${t}/versions`)).then((e) => e.data ?? []),
|
|
99
99
|
staleTime: 0,
|
|
100
100
|
refetchOnMount: "always"
|
|
101
|
-
}), u = f ?? (m.length > 0 ? "newest" : null), { data: p, isLoading:
|
|
101
|
+
}), u = f ?? (m.length > 0 ? "newest" : null), { data: p, isLoading: X } = Q({
|
|
102
102
|
queryKey: ["layout-editor", "version-diff", t, u],
|
|
103
103
|
queryFn: () => g.request(
|
|
104
|
-
|
|
104
|
+
G(`/collection-layouts/${t}/versions/${u}/diff`, { against: "current" })
|
|
105
105
|
).then((e) => e.data),
|
|
106
106
|
enabled: u != null,
|
|
107
107
|
staleTime: 0,
|
|
108
108
|
refetchOnMount: "always"
|
|
109
|
-
}), b =
|
|
110
|
-
mutationFn: (e) => g.request(
|
|
109
|
+
}), b = ne({
|
|
110
|
+
mutationFn: (e) => g.request(se(`/collection-layouts/${t}/versions/${e}/restore`)),
|
|
111
111
|
onSuccess: () => {
|
|
112
|
-
v(null),
|
|
112
|
+
v(null), o == null || o(), k.invalidateQueries({ queryKey: pe(t) }), k.invalidateQueries({ queryKey: W(t) }), k.invalidateQueries({ queryKey: ["layout-editor", "version-diff", t] }), a == null || a();
|
|
113
113
|
}
|
|
114
|
-
}), y = m.find((e) => e.id === f), { nameVersion:
|
|
115
|
-
$(e),
|
|
114
|
+
}), y = m.find((e) => e.id === f), { nameVersion: Z, nameCurrent: U } = ie(t), [w, $] = h(null), [L, K] = h(""), [C, j] = h(null), B = (e, l = "") => {
|
|
115
|
+
$(e), K(l);
|
|
116
116
|
}, T = () => {
|
|
117
|
-
const e = w,
|
|
117
|
+
const e = w, l = L.trim();
|
|
118
118
|
if ($(null), e == null) return;
|
|
119
|
-
const P = { onError: (
|
|
120
|
-
e === "current" ?
|
|
119
|
+
const P = { onError: (I) => D.error(V(I, "Not named").message) };
|
|
120
|
+
e === "current" ? l && U.mutate(l, P) : Z.mutate({ versionId: e, name: l || null }, P);
|
|
121
121
|
}, E = async (e) => {
|
|
122
122
|
if (c) {
|
|
123
123
|
j(e.id);
|
|
124
124
|
try {
|
|
125
|
-
const
|
|
126
|
-
c(
|
|
127
|
-
} catch (
|
|
128
|
-
|
|
125
|
+
const l = await le(g, t, e.id);
|
|
126
|
+
c(l, e.name ? `“${e.name}” (v${e.version})` : `version ${e.version}`);
|
|
127
|
+
} catch (l) {
|
|
128
|
+
D.error(V(l, "That version could not be read").message);
|
|
129
129
|
} finally {
|
|
130
130
|
j(null);
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
-
}, M = /* @__PURE__ */
|
|
133
|
+
}, M = /* @__PURE__ */ n(
|
|
134
134
|
"input",
|
|
135
135
|
{
|
|
136
136
|
autoFocus: !0,
|
|
137
137
|
"aria-label": "Version name",
|
|
138
|
-
value:
|
|
138
|
+
value: L,
|
|
139
139
|
maxLength: 120,
|
|
140
140
|
placeholder: "e.g. Go-live baseline",
|
|
141
|
-
onChange: (e) =>
|
|
141
|
+
onChange: (e) => K(e.target.value),
|
|
142
142
|
onKeyDown: (e) => {
|
|
143
143
|
e.key === "Enter" && T(), e.key === "Escape" && (e.stopPropagation(), $(null));
|
|
144
144
|
},
|
|
@@ -147,12 +147,13 @@ function _e({
|
|
|
147
147
|
}
|
|
148
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";
|
|
149
149
|
return /* @__PURE__ */ s("div", { className: "flex flex-col gap-2 text-[12px]", "data-layout-history": !0, children: [
|
|
150
|
-
x &&
|
|
150
|
+
x && i && /* @__PURE__ */ n(ce, { session: x, onJump: i }),
|
|
151
|
+
/* @__PURE__ */ n(xe, { layoutId: t, nav: Y }),
|
|
151
152
|
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: [
|
|
152
153
|
/* @__PURE__ */ s("div", { className: "flex items-center justify-between gap-2", children: [
|
|
153
|
-
/* @__PURE__ */
|
|
154
|
+
/* @__PURE__ */ n("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` }),
|
|
154
155
|
/* @__PURE__ */ s("span", { className: "flex items-center gap-2", children: [
|
|
155
|
-
c && p && p.total > 0 && /* @__PURE__ */
|
|
156
|
+
c && p && p.total > 0 && /* @__PURE__ */ n(
|
|
156
157
|
"button",
|
|
157
158
|
{
|
|
158
159
|
type: "button",
|
|
@@ -167,7 +168,7 @@ function _e({
|
|
|
167
168
|
children: "Show on canvas"
|
|
168
169
|
}
|
|
169
170
|
),
|
|
170
|
-
f != null && /* @__PURE__ */
|
|
171
|
+
f != null && /* @__PURE__ */ n(
|
|
171
172
|
"button",
|
|
172
173
|
{
|
|
173
174
|
type: "button",
|
|
@@ -178,10 +179,10 @@ function _e({
|
|
|
178
179
|
)
|
|
179
180
|
] })
|
|
180
181
|
] }),
|
|
181
|
-
|
|
182
|
-
p && /* @__PURE__ */
|
|
183
|
-
p && p.total > 0 && u != null && /* @__PURE__ */
|
|
184
|
-
|
|
182
|
+
X && /* @__PURE__ */ n("p", { className: "mt-1 text-slate-500", children: "Comparing…" }),
|
|
183
|
+
p && /* @__PURE__ */ n(fe, { diff: p }),
|
|
184
|
+
p && p.total > 0 && u != null && /* @__PURE__ */ n(
|
|
185
|
+
oe,
|
|
185
186
|
{
|
|
186
187
|
className: "mt-2",
|
|
187
188
|
a: { layout_id: t, version: u },
|
|
@@ -190,8 +191,8 @@ function _e({
|
|
|
190
191
|
String(u)
|
|
191
192
|
)
|
|
192
193
|
] }),
|
|
193
|
-
b.isError && /* @__PURE__ */
|
|
194
|
-
/* @__PURE__ */
|
|
194
|
+
b.isError && /* @__PURE__ */ n("p", { className: "text-[12px] text-[#9c2f47] dark:text-[#f08aa1]", children: "Restore failed. Nothing was changed." }),
|
|
195
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-2", "data-name-current": "", children: w === "current" ? M : /* @__PURE__ */ s(
|
|
195
196
|
"button",
|
|
196
197
|
{
|
|
197
198
|
type: "button",
|
|
@@ -199,12 +200,12 @@ function _e({
|
|
|
199
200
|
"data-tip": "Keep the form as it is saved now, under a name, beyond the rolling 30 versions",
|
|
200
201
|
className: `${d} inline-flex items-center gap-1`,
|
|
201
202
|
children: [
|
|
202
|
-
/* @__PURE__ */
|
|
203
|
+
/* @__PURE__ */ n(R, { className: "h-3 w-3" }),
|
|
203
204
|
"Name the saved form…"
|
|
204
205
|
]
|
|
205
206
|
}
|
|
206
207
|
) }),
|
|
207
|
-
|
|
208
|
+
J ? /* @__PURE__ */ n("p", { className: "text-slate-500", children: "Loading history…" }) : m.length === 0 ? /* @__PURE__ */ n("p", { className: "text-slate-500 dark:text-slate-400", children: "No versions yet. One is saved before every change." }) : /* @__PURE__ */ n("ul", { className: "max-h-64 space-y-1 overflow-y-auto", children: m.map((e) => /* @__PURE__ */ s(
|
|
208
209
|
"li",
|
|
209
210
|
{
|
|
210
211
|
className: "flex items-center justify-between gap-2 rounded border border-slate-100 px-2 py-1 dark:border-border/60",
|
|
@@ -217,8 +218,8 @@ function _e({
|
|
|
217
218
|
"data-tip": "Named: kept beyond the rolling 30 versions",
|
|
218
219
|
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",
|
|
219
220
|
children: [
|
|
220
|
-
/* @__PURE__ */
|
|
221
|
-
/* @__PURE__ */
|
|
221
|
+
/* @__PURE__ */ n(R, { className: "h-3 w-3 shrink-0" }),
|
|
222
|
+
/* @__PURE__ */ n("span", { className: "truncate", children: e.name })
|
|
222
223
|
]
|
|
223
224
|
}
|
|
224
225
|
),
|
|
@@ -228,13 +229,13 @@ function _e({
|
|
|
228
229
|
] }),
|
|
229
230
|
" ",
|
|
230
231
|
/* @__PURE__ */ s("span", { className: "text-slate-500 dark:text-slate-400", children: [
|
|
231
|
-
e.note ? `${
|
|
232
|
+
e.note ? `${ue(e.note)} · ` : "",
|
|
232
233
|
new Date(e.created_at).toLocaleString(),
|
|
233
234
|
e.created_by_name ? ` · ${e.created_by_name}` : ""
|
|
234
235
|
] })
|
|
235
236
|
] }),
|
|
236
237
|
/* @__PURE__ */ s("span", { className: "flex shrink-0 items-center gap-1", children: [
|
|
237
|
-
/* @__PURE__ */
|
|
238
|
+
/* @__PURE__ */ n(
|
|
238
239
|
"button",
|
|
239
240
|
{
|
|
240
241
|
type: "button",
|
|
@@ -245,7 +246,7 @@ function _e({
|
|
|
245
246
|
children: e.name ? "Rename" : "Name"
|
|
246
247
|
}
|
|
247
248
|
),
|
|
248
|
-
/* @__PURE__ */
|
|
249
|
+
/* @__PURE__ */ n(
|
|
249
250
|
"button",
|
|
250
251
|
{
|
|
251
252
|
type: "button",
|
|
@@ -257,7 +258,7 @@ function _e({
|
|
|
257
258
|
children: "Compare"
|
|
258
259
|
}
|
|
259
260
|
),
|
|
260
|
-
c && /* @__PURE__ */
|
|
261
|
+
c && /* @__PURE__ */ n(
|
|
261
262
|
"button",
|
|
262
263
|
{
|
|
263
264
|
type: "button",
|
|
@@ -269,20 +270,20 @@ function _e({
|
|
|
269
270
|
children: C === e.id ? "…" : "Canvas"
|
|
270
271
|
}
|
|
271
272
|
),
|
|
272
|
-
|
|
273
|
-
|
|
273
|
+
F && S && /* @__PURE__ */ n(
|
|
274
|
+
de,
|
|
274
275
|
{
|
|
275
276
|
layoutId: t,
|
|
276
277
|
version: e,
|
|
277
|
-
bundle:
|
|
278
|
+
bundle: F,
|
|
278
279
|
onApply: S,
|
|
279
|
-
fieldLabel:
|
|
280
|
-
onDone:
|
|
280
|
+
fieldLabel: O,
|
|
281
|
+
onDone: a,
|
|
281
282
|
className: d
|
|
282
283
|
}
|
|
283
284
|
),
|
|
284
|
-
|
|
285
|
-
/* @__PURE__ */
|
|
285
|
+
z === e.id ? /* @__PURE__ */ s(ee, { children: [
|
|
286
|
+
/* @__PURE__ */ n(
|
|
286
287
|
"button",
|
|
287
288
|
{
|
|
288
289
|
type: "button",
|
|
@@ -294,8 +295,8 @@ function _e({
|
|
|
294
295
|
children: b.isPending ? "Restoring…" : r > 0 ? "Restore, drop unsaved" : "Yes, restore"
|
|
295
296
|
}
|
|
296
297
|
),
|
|
297
|
-
/* @__PURE__ */
|
|
298
|
-
] }) : /* @__PURE__ */
|
|
298
|
+
/* @__PURE__ */ n("button", { type: "button", onClick: () => v(null), className: d, children: "Cancel" })
|
|
299
|
+
] }) : /* @__PURE__ */ n(
|
|
299
300
|
"button",
|
|
300
301
|
{
|
|
301
302
|
type: "button",
|
|
@@ -314,7 +315,23 @@ function _e({
|
|
|
314
315
|
)) })
|
|
315
316
|
] });
|
|
316
317
|
}
|
|
318
|
+
function xe({
|
|
319
|
+
layoutId: t,
|
|
320
|
+
nav: a
|
|
321
|
+
}) {
|
|
322
|
+
const r = `/activity?collection=nivaro_collection_layouts&item=${encodeURIComponent(String(t))}`, o = a.consoleUrl ? a.consoleUrl(r) : r;
|
|
323
|
+
return o ? /* @__PURE__ */ n(
|
|
324
|
+
"button",
|
|
325
|
+
{
|
|
326
|
+
type: "button",
|
|
327
|
+
"data-layout-audit-link": !0,
|
|
328
|
+
onClick: () => a.navigate(o),
|
|
329
|
+
className: "self-end text-[11px] text-nvr-navy underline dark:text-nvr-cyan",
|
|
330
|
+
children: "Who changed it — open the audit log"
|
|
331
|
+
}
|
|
332
|
+
) : null;
|
|
333
|
+
}
|
|
317
334
|
export {
|
|
318
|
-
|
|
319
|
-
|
|
335
|
+
Le as HistoryPanel,
|
|
336
|
+
ue as versionNoteLabel
|
|
320
337
|
};
|