@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,22 +1,23 @@
|
|
|
1
|
-
import { jsxs as d, jsx as o, Fragment as
|
|
1
|
+
import { jsxs as d, jsx as o, Fragment as K } from "react/jsx-runtime";
|
|
2
2
|
import { useQuery as te } from "@tanstack/react-query";
|
|
3
|
-
import { Search as re, LayoutPanelTop as oe, Plus as
|
|
4
|
-
import { useState as W, useMemo as
|
|
5
|
-
import { useNivaroClient as
|
|
6
|
-
import { get as
|
|
7
|
-
import { HEADER_GROUP_KEY as
|
|
8
|
-
import { listLayoutSlots as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
|
|
3
|
+
import { Search as re, LayoutPanelTop as oe, Sigma as ae, Plus as Q, CopyPlus as ie, Check as ne } from "lucide-react";
|
|
4
|
+
import { useState as W, useMemo as Y } from "react";
|
|
5
|
+
import { useNivaroClient as se } from "../../context.js";
|
|
6
|
+
import { get as le } from "../../lib/commands.js";
|
|
7
|
+
import { HEADER_GROUP_KEY as R, isCanvasSlot as de } from "../../lib/layout-ops.js";
|
|
8
|
+
import { listLayoutSlots as ce } from "../../lib/layout-slots.js";
|
|
9
|
+
import { nextDisplayFormulaField as me } from "../../lib/placement-behaviour.js";
|
|
10
|
+
import { titleCase as $, cn as X } from "../../lib/utils.js";
|
|
11
|
+
import { sectionOp as ue, fieldSpot as j, slotSpot as pe, placeOp as z } from "./add-target.js";
|
|
12
|
+
import { MeaningSuggestions as _e } from "./ai-forms/MeaningSuggestions.js";
|
|
13
|
+
import { useAddDragSource as fe } from "./dnd/node.js";
|
|
14
|
+
import { useFormFields as ge } from "./inspect/inspect-api.js";
|
|
15
|
+
import { textMatcher as he } from "./nav/find.js";
|
|
16
|
+
import { useOverviewFields as xe } from "./overview/overview-api.js";
|
|
17
|
+
import { LibraryRows as ye } from "./reuse/LibraryRows.js";
|
|
18
|
+
import { slotName as O } from "./slot-names.js";
|
|
19
|
+
import { useFieldFillRates as ke, fillText as be } from "./usage/usage-api.js";
|
|
20
|
+
const we = [
|
|
20
21
|
"__pipeline__",
|
|
21
22
|
"__comments__",
|
|
22
23
|
"__tasks__",
|
|
@@ -26,7 +27,7 @@ const ke = [
|
|
|
26
27
|
"__owners__",
|
|
27
28
|
"__pdf__",
|
|
28
29
|
"__subtitle__"
|
|
29
|
-
],
|
|
30
|
+
], J = {
|
|
30
31
|
__pipeline__: "State track and actions",
|
|
31
32
|
__comments__: "Notes and replies",
|
|
32
33
|
__tasks__: "To-dos on this record",
|
|
@@ -36,18 +37,18 @@ const ke = [
|
|
|
36
37
|
__owners__: "Who owns it at each step",
|
|
37
38
|
__pdf__: "Generate and download a PDF",
|
|
38
39
|
__subtitle__: "A line of values under the title"
|
|
39
|
-
},
|
|
40
|
-
function
|
|
40
|
+
}, Ne = ["review_list", "rollup"];
|
|
41
|
+
function V(a) {
|
|
41
42
|
return {
|
|
42
43
|
widget_id: a.id,
|
|
43
|
-
input_bindings:
|
|
44
|
+
input_bindings: Ne.includes(a.widget_type) ? [{ key: "record_id", binding_type: "item_field", binding_value: "id" }] : []
|
|
44
45
|
};
|
|
45
46
|
}
|
|
46
|
-
function
|
|
47
|
-
const
|
|
48
|
-
if (
|
|
49
|
-
if (
|
|
50
|
-
if (
|
|
47
|
+
function ve(a) {
|
|
48
|
+
const n = a.interface ?? "";
|
|
49
|
+
if (n.includes("o2m") || n === "list-o2m" || n === "inline-grid") return "Grid";
|
|
50
|
+
if (n.includes("m2m") || n.includes("m2a")) return "Several records";
|
|
51
|
+
if (n.includes("m2o")) return "Record";
|
|
51
52
|
switch (a.type) {
|
|
52
53
|
case "string":
|
|
53
54
|
case "uuid":
|
|
@@ -74,39 +75,39 @@ function Ne(a) {
|
|
|
74
75
|
return a.type ? $(a.type) : "";
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
|
-
const
|
|
78
|
+
const Ce = "h-8 w-full rounded-md border border-slate-200 bg-white pl-7 pr-2.5 text-[12.5px] text-slate-800 outline-none placeholder:text-slate-400 focus:border-nvr-cyan dark:border-border dark:bg-background dark:text-foreground dark:placeholder:text-muted-foreground", N = "px-2 pb-1 pt-3 text-[11.5px] font-semibold text-slate-500 dark:text-muted-foreground";
|
|
78
79
|
function M({ children: a }) {
|
|
79
80
|
return /* @__PURE__ */ d("span", { className: "inline-flex shrink-0 items-center gap-0.5 text-[11px] font-medium text-[#0089ad] dark:text-nvr-cyan", children: [
|
|
80
81
|
/* @__PURE__ */ o(ne, { className: "h-3 w-3" }),
|
|
81
82
|
a
|
|
82
83
|
] });
|
|
83
84
|
}
|
|
84
|
-
function
|
|
85
|
+
function y({
|
|
85
86
|
title: a,
|
|
86
|
-
sub:
|
|
87
|
+
sub: n,
|
|
87
88
|
aside: c,
|
|
88
89
|
onClick: u,
|
|
89
90
|
attrs: l,
|
|
90
91
|
extra: g,
|
|
91
92
|
drag: _ = null
|
|
92
93
|
}) {
|
|
93
|
-
const
|
|
94
|
+
const p = fe(_), t = /* @__PURE__ */ d(
|
|
94
95
|
"button",
|
|
95
96
|
{
|
|
96
97
|
type: "button",
|
|
97
|
-
...
|
|
98
|
+
...p.props,
|
|
98
99
|
onClick: () => {
|
|
99
|
-
|
|
100
|
+
p.clickBlocked() || u();
|
|
100
101
|
},
|
|
101
102
|
...l,
|
|
102
|
-
className:
|
|
103
|
+
className: X(
|
|
103
104
|
"group flex w-full min-w-0 items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-muted",
|
|
104
|
-
|
|
105
|
+
p.dragging && "opacity-40"
|
|
105
106
|
),
|
|
106
107
|
children: [
|
|
107
108
|
/* @__PURE__ */ d("span", { className: "flex min-w-0 flex-1 flex-col", children: [
|
|
108
109
|
/* @__PURE__ */ o("span", { className: "truncate text-[12.5px] font-medium text-slate-900 dark:text-foreground", children: a }),
|
|
109
|
-
|
|
110
|
+
n && /* @__PURE__ */ o("span", { className: "truncate text-[11.5px] text-slate-500 dark:text-muted-foreground", children: n })
|
|
110
111
|
] }),
|
|
111
112
|
c
|
|
112
113
|
]
|
|
@@ -117,60 +118,60 @@ function w({
|
|
|
117
118
|
g
|
|
118
119
|
] }) : t;
|
|
119
120
|
}
|
|
120
|
-
function
|
|
121
|
+
function Ye({
|
|
121
122
|
bundle: a,
|
|
122
|
-
collection:
|
|
123
|
+
collection: n,
|
|
123
124
|
selected: c,
|
|
124
125
|
apply: u,
|
|
125
126
|
onSelect: l
|
|
126
127
|
}) {
|
|
127
|
-
const g =
|
|
128
|
+
const g = se(), [_, p] = W(""), [t, s] = W("form"), { data: h = [] } = xe(n), { data: D } = ke(n), { data: Z = [], error: T } = te({
|
|
128
129
|
queryKey: ["layout-editor", "widgets"],
|
|
129
|
-
queryFn: () => g.request(
|
|
130
|
+
queryFn: () => g.request(le("/widgets-internal")).then((e) => e.data ?? []),
|
|
130
131
|
staleTime: 6e4,
|
|
131
132
|
retry: !1
|
|
132
|
-
}), [v,
|
|
133
|
+
}), [v, L] = W(null), f = he(_), P = Y(() => {
|
|
133
134
|
const e = /* @__PURE__ */ new Map();
|
|
134
135
|
for (const r of a.placements) e.set(r.field, [...e.get(r.field) ?? [], r]);
|
|
135
136
|
return e;
|
|
136
|
-
}, [a.placements]), C = (e) => (P.get(e) ?? []).find((r) => r.group_key !==
|
|
137
|
+
}, [a.placements]), C = (e) => (P.get(e) ?? []).find((r) => r.group_key !== R), E = (e) => (P.get(e) ?? []).find((r) => r.group_key === R), S = (e) => e.group_key === R ? { kind: "header", field: e.field } : {
|
|
137
138
|
kind: e.field.startsWith("__") ? "slot" : "field",
|
|
138
139
|
field: e.field,
|
|
139
140
|
group_key: e.group_key
|
|
140
|
-
},
|
|
141
|
-
const
|
|
142
|
-
u([
|
|
143
|
-
}, F = (e, r,
|
|
141
|
+
}, B = (e, r, i) => {
|
|
142
|
+
const m = t === "header" ? j(a, c, "header") : de({ field: e, group_key: null }) ? pe(a, c) : e === "__subtitle__" ? { group_key: null, index: 0 } : j(a, c);
|
|
143
|
+
u([z(e, m, i)], { label: `Add ${r}` }), l(S({ field: e, group_key: m.group_key }));
|
|
144
|
+
}, F = (e, r, i, m) => i ? null : {
|
|
144
145
|
field: e,
|
|
145
146
|
label: r,
|
|
146
|
-
patch:
|
|
147
|
+
patch: m,
|
|
147
148
|
to: t,
|
|
148
|
-
onAdded: (
|
|
149
|
-
const x =
|
|
149
|
+
onAdded: (w) => {
|
|
150
|
+
const x = w[0];
|
|
150
151
|
(x == null ? void 0 : x.op) === "place" && l(S({ field: e, group_key: x.group_key }));
|
|
151
152
|
}
|
|
152
|
-
},
|
|
153
|
-
|
|
154
|
-
const
|
|
155
|
-
|
|
153
|
+
}, A = (e, r, i) => {
|
|
154
|
+
L(null);
|
|
155
|
+
const m = t === "header" ? E(e) : C(e);
|
|
156
|
+
m ? l(S(m)) : B(e, r, i);
|
|
156
157
|
}, ee = (e, r) => {
|
|
157
|
-
var
|
|
158
|
-
const
|
|
159
|
-
if ((P.get(e) ?? []).some((
|
|
160
|
-
const
|
|
161
|
-
|
|
158
|
+
var m;
|
|
159
|
+
const i = j(a, c);
|
|
160
|
+
if ((P.get(e) ?? []).some((w) => w.group_key === i.group_key)) {
|
|
161
|
+
const w = i.group_key === null ? "Ungrouped" : ((m = a.groups.find((x) => x.key === i.group_key)) == null ? void 0 : m.label) ?? i.group_key;
|
|
162
|
+
L({
|
|
162
163
|
field: e,
|
|
163
|
-
text: `${r} is already in ${
|
|
164
|
+
text: `${r} is already in ${w}. Select another section first.`
|
|
164
165
|
});
|
|
165
166
|
return;
|
|
166
167
|
}
|
|
167
|
-
|
|
168
|
-
}, { data:
|
|
169
|
-
() =>
|
|
170
|
-
[a,
|
|
171
|
-
).filter((e) =>
|
|
168
|
+
L(null), u([z(e, i)], { label: `Add another ${r}` }), l(S({ field: e, group_key: i.group_key }));
|
|
169
|
+
}, { data: G = [] } = ge(n), I = Y(
|
|
170
|
+
() => Se(a, G, h),
|
|
171
|
+
[a, G, h]
|
|
172
|
+
).filter((e) => f(e.title, e.field)).slice(0, 8), U = h.filter((e) => e.field && !e.field.startsWith("__")).map((e) => ({ ...e, title: e.label || $(e.field) })).filter((e) => f(e.title, e.field)).sort((e, r) => e.title.localeCompare(r.title)), q = [...we, ...ce().map((e) => `__ext_${e}__`)].filter(
|
|
172
173
|
(e) => t === "header" ? e === "__owners__" : !0
|
|
173
|
-
).filter((e) =>
|
|
174
|
+
).filter((e) => f(O(e), J[e])), H = Z.filter((e) => f(e.name, e.widget_type)), k = ue(a, c), b = k.op === "group_create" ? k.label.replace(/^New /, "") : "";
|
|
174
175
|
return /* @__PURE__ */ d("div", { "data-editor-add": "", className: "flex flex-col px-2 pb-4", children: [
|
|
175
176
|
/* @__PURE__ */ d("div", { className: "sticky top-0 z-10 flex flex-col gap-2 bg-white px-1 pb-1 pt-2 dark:bg-card", children: [
|
|
176
177
|
/* @__PURE__ */ d("div", { className: "relative", children: [
|
|
@@ -179,10 +180,10 @@ function He({
|
|
|
179
180
|
"input",
|
|
180
181
|
{
|
|
181
182
|
value: _,
|
|
182
|
-
onChange: (e) =>
|
|
183
|
+
onChange: (e) => p(e.target.value),
|
|
183
184
|
placeholder: "Find a field, panel or widget",
|
|
184
185
|
"aria-label": "Find something to add",
|
|
185
|
-
className:
|
|
186
|
+
className: Ce
|
|
186
187
|
}
|
|
187
188
|
)
|
|
188
189
|
] }),
|
|
@@ -194,7 +195,7 @@ function He({
|
|
|
194
195
|
type: "button",
|
|
195
196
|
"aria-pressed": t === e,
|
|
196
197
|
onClick: () => s(e),
|
|
197
|
-
className:
|
|
198
|
+
className: X(
|
|
198
199
|
"rounded-md px-2 py-0.5 font-medium transition-colors",
|
|
199
200
|
t === e ? "bg-accent text-slate-900 dark:text-foreground" : "hover:bg-muted hover:text-slate-800 dark:hover:text-foreground"
|
|
200
201
|
),
|
|
@@ -204,60 +205,76 @@ function He({
|
|
|
204
205
|
))
|
|
205
206
|
] })
|
|
206
207
|
] }),
|
|
207
|
-
t === "form" &&
|
|
208
|
+
t === "form" && f(b, "section", "tab", "step") && /* @__PURE__ */ d(K, { children: [
|
|
208
209
|
/* @__PURE__ */ o("p", { className: N, children: "Layout" }),
|
|
209
210
|
/* @__PURE__ */ o(
|
|
210
|
-
|
|
211
|
+
y,
|
|
211
212
|
{
|
|
212
|
-
title:
|
|
213
|
-
sub: `A new ${
|
|
213
|
+
title: b.charAt(0).toUpperCase() + b.slice(1),
|
|
214
|
+
sub: `A new ${b.toLowerCase()} after the selection`,
|
|
214
215
|
attrs: { "data-add-section": "" },
|
|
215
216
|
aside: /* @__PURE__ */ o(oe, { className: "h-3.5 w-3.5 text-slate-400" }),
|
|
216
217
|
onClick: () => {
|
|
217
|
-
u([
|
|
218
|
+
u([k], { label: `Add ${b.toLowerCase()}` }), k.op === "group_create" && l({ kind: "group", key: k.key });
|
|
218
219
|
}
|
|
219
220
|
}
|
|
220
221
|
)
|
|
221
222
|
] }),
|
|
222
|
-
t === "form" && !
|
|
223
|
-
|
|
223
|
+
t === "form" && !["table", "file"].includes(String(a.layout.layout_type ?? "grouped")) && f("Display formula", "formula calculation remaining total") && /* @__PURE__ */ o(
|
|
224
|
+
y,
|
|
225
|
+
{
|
|
226
|
+
title: "Display formula",
|
|
227
|
+
sub: "A read-only figure worked out from fields on the form, never saved",
|
|
228
|
+
attrs: { "data-add-formula": "" },
|
|
229
|
+
aside: /* @__PURE__ */ o(ae, { className: "h-3.5 w-3.5 text-slate-400" }),
|
|
230
|
+
onClick: () => B(
|
|
231
|
+
me(a.placements.map((e) => e.field)),
|
|
232
|
+
"a display formula",
|
|
233
|
+
{
|
|
234
|
+
overrides: { label: "Formula", display_formula: { expr: "", format: "" } }
|
|
235
|
+
}
|
|
236
|
+
)
|
|
237
|
+
}
|
|
238
|
+
),
|
|
239
|
+
t === "form" && !_.trim() && /* @__PURE__ */ o(_e, { bundle: a, collection: n, apply: u }),
|
|
240
|
+
t === "form" && I.length > 0 && /* @__PURE__ */ d(K, { children: [
|
|
224
241
|
/* @__PURE__ */ o("p", { className: N, children: "On other forms" }),
|
|
225
|
-
|
|
226
|
-
|
|
242
|
+
I.map((e) => /* @__PURE__ */ o(
|
|
243
|
+
y,
|
|
227
244
|
{
|
|
228
245
|
title: e.title,
|
|
229
246
|
sub: `On ${e.count} of ${e.of} other forms · ${e.names.join(", ")}`,
|
|
230
247
|
attrs: { "data-add-suggested": e.field },
|
|
231
|
-
aside: /* @__PURE__ */ o(
|
|
232
|
-
onClick: () =>
|
|
248
|
+
aside: /* @__PURE__ */ o(Q, { className: "h-3.5 w-3.5 shrink-0 text-slate-400 opacity-0 group-hover:opacity-100" }),
|
|
249
|
+
onClick: () => A(e.field, e.title),
|
|
233
250
|
drag: F(e.field, e.title, null)
|
|
234
251
|
},
|
|
235
252
|
e.field
|
|
236
253
|
))
|
|
237
254
|
] }),
|
|
238
255
|
t === "form" && /* @__PURE__ */ o(
|
|
239
|
-
|
|
256
|
+
ye,
|
|
240
257
|
{
|
|
241
258
|
bundle: a,
|
|
242
|
-
collection:
|
|
259
|
+
collection: n,
|
|
243
260
|
selected: c,
|
|
244
261
|
apply: u,
|
|
245
262
|
onSelect: l,
|
|
246
|
-
matches:
|
|
263
|
+
matches: f
|
|
247
264
|
}
|
|
248
265
|
),
|
|
249
266
|
/* @__PURE__ */ o("p", { className: N, children: "Fields" }),
|
|
250
|
-
|
|
267
|
+
U.map((e) => {
|
|
251
268
|
const r = t === "header" ? E(e.field) : C(e.field);
|
|
252
269
|
return /* @__PURE__ */ d("div", { children: [
|
|
253
270
|
/* @__PURE__ */ o(
|
|
254
|
-
|
|
271
|
+
y,
|
|
255
272
|
{
|
|
256
273
|
title: e.title,
|
|
257
|
-
sub: [e.field,
|
|
274
|
+
sub: [e.field, ve(e), D ? be(D.pct.get(e.field), D.total) : null].filter(Boolean).join(" · "),
|
|
258
275
|
attrs: { "data-add-field": e.field, "data-on-form": r ? "true" : void 0 },
|
|
259
|
-
aside: r ? /* @__PURE__ */ o(M, { children: t === "header" ? "in header" : "on this form" }) : /* @__PURE__ */ o(
|
|
260
|
-
onClick: () =>
|
|
276
|
+
aside: r ? /* @__PURE__ */ o(M, { children: t === "header" ? "in header" : "on this form" }) : /* @__PURE__ */ o(Q, { className: "h-3.5 w-3.5 shrink-0 text-slate-400 opacity-0 group-hover:opacity-100" }),
|
|
277
|
+
onClick: () => A(e.field, e.title),
|
|
261
278
|
drag: F(e.field, e.title, r),
|
|
262
279
|
extra: r && t === "form" ? /* @__PURE__ */ o(
|
|
263
280
|
"button",
|
|
@@ -268,7 +285,7 @@ function He({
|
|
|
268
285
|
"data-tip": "Add another copy after the selection",
|
|
269
286
|
onClick: () => ee(e.field, e.title),
|
|
270
287
|
className: "inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-slate-400 transition-colors hover:bg-muted hover:text-slate-700 dark:hover:text-foreground",
|
|
271
|
-
children: /* @__PURE__ */ o(
|
|
288
|
+
children: /* @__PURE__ */ o(ie, { className: "h-3.5 w-3.5" })
|
|
272
289
|
}
|
|
273
290
|
) : null
|
|
274
291
|
}
|
|
@@ -284,10 +301,10 @@ function He({
|
|
|
284
301
|
)
|
|
285
302
|
] }, e.field);
|
|
286
303
|
}),
|
|
287
|
-
!
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
const r = t === "header" ? E(e) : C(e),
|
|
304
|
+
!U.length && /* @__PURE__ */ o("p", { className: "px-2 py-1.5 text-[12px] text-slate-500 dark:text-muted-foreground", children: "No fields match." }),
|
|
305
|
+
q.length > 0 && /* @__PURE__ */ o("p", { className: N, children: "Panels" }),
|
|
306
|
+
q.map((e) => {
|
|
307
|
+
const r = t === "header" ? E(e) : C(e), i = e === "__subtitle__" ? {
|
|
291
308
|
input_bindings: [
|
|
292
309
|
{
|
|
293
310
|
key: "__subtitle_config__",
|
|
@@ -297,56 +314,56 @@ function He({
|
|
|
297
314
|
]
|
|
298
315
|
} : void 0;
|
|
299
316
|
return /* @__PURE__ */ o(
|
|
300
|
-
|
|
317
|
+
y,
|
|
301
318
|
{
|
|
302
|
-
title:
|
|
303
|
-
sub:
|
|
319
|
+
title: O(e),
|
|
320
|
+
sub: J[e] ?? "Extension panel",
|
|
304
321
|
attrs: { "data-add-slot": e, "data-on-form": r ? "true" : void 0 },
|
|
305
322
|
aside: r ? /* @__PURE__ */ o(M, { children: "on this form" }) : null,
|
|
306
|
-
onClick: () =>
|
|
307
|
-
drag: e === "__subtitle__" ? null : F(e,
|
|
323
|
+
onClick: () => A(e, O(e), i),
|
|
324
|
+
drag: e === "__subtitle__" ? null : F(e, O(e), r)
|
|
308
325
|
},
|
|
309
326
|
e
|
|
310
327
|
);
|
|
311
328
|
}),
|
|
312
|
-
t === "form" && (
|
|
313
|
-
t === "form" &&
|
|
329
|
+
t === "form" && (H.length > 0 || T) && /* @__PURE__ */ o("p", { className: N, children: "Widgets" }),
|
|
330
|
+
t === "form" && T && /* @__PURE__ */ d("p", { role: "alert", className: "px-2 py-1.5 text-[12px] text-red-700 dark:text-red-300", children: [
|
|
314
331
|
"Widgets could not be loaded: ",
|
|
315
|
-
|
|
332
|
+
T.message
|
|
316
333
|
] }),
|
|
317
|
-
t === "form" &&
|
|
318
|
-
const r = `__widget_${e.id}__`,
|
|
334
|
+
t === "form" && H.map((e) => {
|
|
335
|
+
const r = `__widget_${e.id}__`, i = C(r);
|
|
319
336
|
return /* @__PURE__ */ o(
|
|
320
|
-
|
|
337
|
+
y,
|
|
321
338
|
{
|
|
322
339
|
title: e.name,
|
|
323
340
|
sub: $(e.widget_type),
|
|
324
|
-
attrs: { "data-add-widget": String(e.id), "data-on-form":
|
|
325
|
-
aside:
|
|
326
|
-
onClick: () =>
|
|
327
|
-
drag: F(r, e.name,
|
|
341
|
+
attrs: { "data-add-widget": String(e.id), "data-on-form": i ? "true" : void 0 },
|
|
342
|
+
aside: i ? /* @__PURE__ */ o(M, { children: "on this form" }) : null,
|
|
343
|
+
onClick: () => A(r, e.name, V(e)),
|
|
344
|
+
drag: F(r, e.name, i, V(e))
|
|
328
345
|
},
|
|
329
346
|
e.id
|
|
330
347
|
);
|
|
331
348
|
})
|
|
332
349
|
] });
|
|
333
350
|
}
|
|
334
|
-
function
|
|
335
|
-
const u = String(a.layout.layout_type || "grouped"), l =
|
|
351
|
+
function Se(a, n, c) {
|
|
352
|
+
const u = String(a.layout.layout_type || "grouped"), l = n.filter(
|
|
336
353
|
(t) => Number(t.layout_id) !== Number(a.layout.id) && t.layout_type === u
|
|
337
354
|
);
|
|
338
355
|
if (!l.length) return [];
|
|
339
356
|
const g = new Set(
|
|
340
|
-
a.placements.filter((t) => t.group_key !==
|
|
341
|
-
), _ = new Map(c.map((t) => [t.field, t])),
|
|
357
|
+
a.placements.filter((t) => t.group_key !== R).map((t) => t.field)
|
|
358
|
+
), _ = new Map(c.map((t) => [t.field, t])), p = /* @__PURE__ */ new Map();
|
|
342
359
|
for (const t of l)
|
|
343
360
|
for (const s of t.fields)
|
|
344
|
-
!g.has(s) && _.has(s) &&
|
|
345
|
-
return [...
|
|
346
|
-
var
|
|
361
|
+
!g.has(s) && _.has(s) && p.set(s, [...p.get(s) ?? [], t.name]);
|
|
362
|
+
return [...p.entries()].map(([t, s]) => {
|
|
363
|
+
var h;
|
|
347
364
|
return {
|
|
348
365
|
field: t,
|
|
349
|
-
title: ((
|
|
366
|
+
title: ((h = _.get(t)) == null ? void 0 : h.label) || $(t),
|
|
350
367
|
count: s.length,
|
|
351
368
|
of: l.length,
|
|
352
369
|
names: s.slice(0, 3).concat(s.length > 3 ? [`${s.length - 3} more`] : [])
|
|
@@ -354,6 +371,6 @@ function ve(a, i, c) {
|
|
|
354
371
|
}).sort((t, s) => s.count - t.count || t.title.localeCompare(s.title));
|
|
355
372
|
}
|
|
356
373
|
export {
|
|
357
|
-
|
|
358
|
-
|
|
374
|
+
Ye as AddPanel,
|
|
375
|
+
Se as otherFormSuggestions
|
|
359
376
|
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { jsxs as r, jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import { useState as
|
|
2
|
+
import { useState as v, useMemo as b } from "react";
|
|
3
3
|
import { cn as u } from "../../lib/utils.js";
|
|
4
|
-
import { Popover as
|
|
4
|
+
import { Popover as N, PopoverAnchor as y, PopoverContent as w } from "../ui/popover.js";
|
|
5
5
|
import { inputBase as f } from "./panel-style.js";
|
|
6
|
-
import { unsavedText as
|
|
7
|
-
function
|
|
6
|
+
import { unsavedText as C } from "./UnsavedConfirm.js";
|
|
7
|
+
function D(e) {
|
|
8
8
|
const t = e == null ? void 0 : e.change_note;
|
|
9
9
|
return t === "note" || t === "note_ticket" ? t : null;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function P(e, t) {
|
|
12
12
|
return e ? t.reason.trim().length < 3 ? !1 : e !== "note_ticket" || t.ticket.trim().length > 0 : !0;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function F(e) {
|
|
15
15
|
return { reason: e.reason.trim(), ticket: e.ticket.trim() || null };
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function S({
|
|
18
18
|
policy: e,
|
|
19
19
|
value: t,
|
|
20
20
|
onChange: o,
|
|
@@ -60,7 +60,7 @@ function P({
|
|
|
60
60
|
] })
|
|
61
61
|
] });
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function K({
|
|
64
64
|
open: e,
|
|
65
65
|
anchor: t,
|
|
66
66
|
policy: o,
|
|
@@ -68,14 +68,15 @@ function F({
|
|
|
68
68
|
value: s,
|
|
69
69
|
onChange: n,
|
|
70
70
|
onSave: p,
|
|
71
|
-
onClose: l
|
|
71
|
+
onClose: l,
|
|
72
|
+
intro: x
|
|
72
73
|
}) {
|
|
73
|
-
const [c, d] =
|
|
74
|
+
const [c, d] = v(!1), g = b(
|
|
74
75
|
() => ({ current: t ?? document.body }),
|
|
75
76
|
[t]
|
|
76
77
|
);
|
|
77
78
|
if (!e) return null;
|
|
78
|
-
const m =
|
|
79
|
+
const m = P(o, s), h = async () => {
|
|
79
80
|
if (!(!m || c)) {
|
|
80
81
|
d(!0);
|
|
81
82
|
try {
|
|
@@ -86,22 +87,22 @@ function F({
|
|
|
86
87
|
}
|
|
87
88
|
};
|
|
88
89
|
return /* @__PURE__ */ r(
|
|
89
|
-
|
|
90
|
+
N,
|
|
90
91
|
{
|
|
91
92
|
open: !0,
|
|
92
|
-
onOpenChange: (
|
|
93
|
-
!
|
|
93
|
+
onOpenChange: (k) => {
|
|
94
|
+
!k && !c && l();
|
|
94
95
|
},
|
|
95
96
|
children: [
|
|
96
|
-
/* @__PURE__ */ a(
|
|
97
|
-
/* @__PURE__ */ r(
|
|
97
|
+
/* @__PURE__ */ a(y, { virtualRef: g }),
|
|
98
|
+
/* @__PURE__ */ r(w, { align: "end", className: "w-[320px] p-3", "data-change-note-save": "", children: [
|
|
98
99
|
/* @__PURE__ */ r("p", { className: "text-[13px] font-semibold text-slate-900 dark:text-foreground", children: [
|
|
99
100
|
"Save ",
|
|
100
|
-
|
|
101
|
+
C(i)
|
|
101
102
|
] }),
|
|
102
|
-
/* @__PURE__ */ a("p", { className: "mb-2 mt-0.5 text-[12px] leading-snug text-slate-600 dark:text-muted-foreground", children: "This layout keeps a reason with every save. It shows in History." }),
|
|
103
|
+
/* @__PURE__ */ a("p", { className: "mb-2 mt-0.5 text-[12px] leading-snug text-slate-600 dark:text-muted-foreground", children: x ?? "This layout keeps a reason with every save. It shows in History." }),
|
|
103
104
|
/* @__PURE__ */ a(
|
|
104
|
-
|
|
105
|
+
S,
|
|
105
106
|
{
|
|
106
107
|
policy: o,
|
|
107
108
|
value: s,
|
|
@@ -138,9 +139,9 @@ function F({
|
|
|
138
139
|
);
|
|
139
140
|
}
|
|
140
141
|
export {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
142
|
+
S as ChangeNoteFields,
|
|
143
|
+
K as ChangeNoteSave,
|
|
144
|
+
F as changeNoteMeta,
|
|
145
|
+
D as changeNotePolicyOf,
|
|
146
|
+
P as changeNoteReady
|
|
146
147
|
};
|