@nivaro/react 0.3.36 → 0.3.38
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/slots/CommentsSlot.js +44 -36
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +9 -1
- package/dist/shared/components/AgentBadge.js +26 -0
- package/dist/shared/components/AgentQuestionsCard.js +198 -0
- package/dist/shared/components/ItemEditForm.js +3329 -3263
- package/dist/shared/components/McpConnectionScope.js +480 -0
- package/dist/shared/components/MyWorkView.js +223 -208
- package/dist/shared/components/RecordReadView.js +620 -575
- package/dist/shared/components/chat/ChatPanel.js +683 -671
- package/dist/shared/components/imports/DownloadSampleButton.js +69 -0
- package/dist/shared/components/imports/ImportConsole.js +106 -104
- package/dist/shared/components/imports/RunDetailSheet.js +34 -32
- package/dist/shared/components/item-edit/FieldAffordances.js +32 -32
- package/dist/shared/components/item-edit/FormTour.js +279 -0
- package/dist/shared/components/item-edit/GroupSection.js +377 -360
- package/dist/shared/components/item-edit/PersonalDefaultControl.js +28 -28
- package/dist/shared/components/item-edit/entry/EntryStrip.js +30 -26
- package/dist/shared/components/item-edit/form-density.js +36 -0
- package/dist/shared/components/item-edit/useFormUsageBeacon.js +59 -46
- package/dist/shared/components/item-edit/usePersonalDefaults.js +312 -296
- package/dist/shared/components/layout-editor/AddPanel.js +349 -192
- package/dist/shared/components/layout-editor/DesignNode.js +126 -112
- package/dist/shared/components/layout-editor/EditorTopBar.js +123 -103
- package/dist/shared/components/layout-editor/LayoutEditor.js +829 -751
- package/dist/shared/components/layout-editor/PlaceTools.js +334 -0
- package/dist/shared/components/layout-editor/SlashInsert.js +252 -0
- package/dist/shared/components/layout-editor/StructureMenu.js +285 -242
- package/dist/shared/components/layout-editor/add-target.js +54 -43
- package/dist/shared/components/layout-editor/ai-forms/AiComposer.js +238 -155
- package/dist/shared/components/layout-editor/ai-forms/AiFormsButton.js +1 -1
- package/dist/shared/components/layout-editor/ai-forms/ai-forms-api.js +15 -12
- package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +347 -189
- package/dist/shared/components/layout-editor/dnd/TrashZone.js +60 -32
- package/dist/shared/components/layout-editor/dnd/UndoChip.js +76 -0
- package/dist/shared/components/layout-editor/dnd/merge-drop.js +33 -0
- package/dist/shared/components/layout-editor/dnd/multi-drop.js +87 -0
- package/dist/shared/components/layout-editor/dnd/node.js +115 -105
- package/dist/shared/components/layout-editor/dnd/sensors.js +23 -0
- package/dist/shared/components/layout-editor/dnd/trash-drop.js +34 -28
- package/dist/shared/components/layout-editor/dnd/trash-links.js +97 -0
- package/dist/shared/components/layout-editor/even-row.js +86 -0
- package/dist/shared/components/layout-editor/field-list.js +99 -0
- package/dist/shared/components/layout-editor/format-painter.js +102 -0
- package/dist/shared/components/layout-editor/grid-guides.js +15 -13
- package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +150 -132
- package/dist/shared/components/layout-editor/inspector/BulkInspector.js +57 -53
- package/dist/shared/components/layout-editor/inspector/EvenRowAction.js +31 -0
- package/dist/shared/components/layout-editor/inspector/GroupInspector.js +154 -141
- package/dist/shared/components/layout-editor/inspector/Inspector.js +209 -178
- package/dist/shared/components/layout-editor/inspector/LookTab.js +106 -98
- package/dist/shared/components/layout-editor/inspector/RulesTab.js +38 -37
- package/dist/shared/components/layout-editor/inspector/kit.js +280 -223
- package/dist/shared/components/layout-editor/keyboard-move.js +15 -15
- package/dist/shared/components/layout-editor/lint/LabelStyle.js +201 -0
- package/dist/shared/components/layout-editor/lint/LintPanel.js +132 -84
- package/dist/shared/components/layout-editor/lint/lint-api.js +65 -28
- package/dist/shared/components/layout-editor/nav/NavTools.js +14 -12
- package/dist/shared/components/layout-editor/nav/ZoomControls.js +145 -0
- package/dist/shared/components/layout-editor/nav/useEditorNav.js +34 -32
- package/dist/shared/components/layout-editor/nav/view-prefs.js +100 -15
- package/dist/shared/components/layout-editor/outputs/LayoutFile.js +89 -0
- package/dist/shared/components/layout-editor/outputs/OutputsButton.js +272 -195
- package/dist/shared/components/layout-editor/outputs/layout-file-plan.js +176 -0
- package/dist/shared/components/layout-editor/outputs/output-api.js +71 -37
- package/dist/shared/components/layout-editor/overview/describe-conditions.js +16 -11
- package/dist/shared/components/layout-editor/overview/purpose.js +5 -5
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/layout-editor/pin.js +37 -19
- package/dist/shared/components/layout-editor/place-clip.js +257 -0
- package/dist/shared/components/layout-editor/preview/PreviewModes.js +27 -26
- package/dist/shared/components/layout-editor/preview/PreviewPanes.js +148 -117
- package/dist/shared/components/layout-editor/preview/SampleRecord.js +113 -0
- package/dist/shared/components/layout-editor/preview/preview-model.js +79 -60
- package/dist/shared/components/layout-editor/preview/sample-record.js +105 -0
- package/dist/shared/components/layout-editor/removed-log.js +151 -0
- package/dist/shared/components/layout-editor/reuse/LibraryRows.js +109 -78
- package/dist/shared/components/layout-editor/reuse/linked-sections.js +373 -0
- package/dist/shared/components/layout-editor/revert-element.js +140 -0
- package/dist/shared/components/layout-editor/section-structure.js +193 -170
- package/dist/shared/components/layout-editor/settings/EntrySection.js +63 -45
- package/dist/shared/components/layout-editor/settings/LayoutSection.js +63 -32
- package/dist/shared/components/layout-editor/settings/ResolveSettings.js +179 -137
- package/dist/shared/components/layout-editor/settings/WhoSection.js +18 -17
- package/dist/shared/components/layout-editor/settings/settings-registry.js +24 -0
- package/dist/shared/components/layout-editor/shortcuts.js +21 -16
- package/dist/shared/components/layout-editor/structure-ops.js +221 -195
- package/dist/shared/components/layout-editor/usage/UsagePanel.js +133 -85
- package/dist/shared/components/layout-editor/usage/refusal-lens.js +130 -0
- package/dist/shared/components/layout-editor/usage/usage-api.js +12 -11
- package/dist/shared/components/panels/CommentPanel.js +47 -45
- package/dist/shared/components/panels/RevisionsPanel.js +66 -64
- package/dist/shared/components/panels/TaskPanel.js +395 -332
- package/dist/shared/components/profile/AgentsPanel.js +196 -147
- package/dist/shared/components/profile/ConnectionRollback.js +329 -0
- package/dist/shared/components/profile/MyDefaultsCard.js +526 -520
- package/dist/shared/lib/entry-config.js +22 -22
- package/dist/shared/lib/form-usage-beacon.js +91 -55
- package/dist/shared/lib/layout-lint.js +530 -284
- package/dist/shared/lib/layout-resolve.js +58 -44
- package/package.json +1 -1
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
var I = Object.defineProperty;
|
|
2
|
+
var N = (i, r, o) => r in i ? I(i, r, { enumerable: !0, configurable: !0, writable: !0, value: o }) : i[r] = o;
|
|
3
|
+
var c = (i, r, o) => N(i, typeof r != "symbol" ? r + "" : r, o);
|
|
4
|
+
import { UNGROUPED_KEY as $, applyLayoutOps as P, isCanvasSlot as v, HEADER_GROUP_KEY as _ } from "../../lib/layout-ops.js";
|
|
5
|
+
import { titleCase as y } from "../../lib/utils.js";
|
|
6
|
+
import { sectionLabel as T } from "./canvas-diff.js";
|
|
7
|
+
import { normalizedBundle as w } from "./field-zones.js";
|
|
8
|
+
import { restorePieceOps as a } from "./restore-piece.js";
|
|
9
|
+
import { slotName as U } from "./slot-names.js";
|
|
10
|
+
import { refuse as k, checked as z } from "./structure-ops.js";
|
|
11
|
+
import { humanizeOpError as G } from "./useLayoutDraft.js";
|
|
12
|
+
const L = (i, r) => i.sort - r.sort, u = (i, r) => i.placements.filter((o) => o.group_key === r && !v(o)).sort(L), M = (i) => i.kind === "header" ? _ : i.group_key;
|
|
13
|
+
class E {
|
|
14
|
+
constructor(r) {
|
|
15
|
+
c(this, "list", []);
|
|
16
|
+
/** The baseline does not have it: the revert takes it off. */
|
|
17
|
+
c(this, "isNew", !1);
|
|
18
|
+
/** Where it ends up, to select afterwards. */
|
|
19
|
+
c(this, "select");
|
|
20
|
+
this.w = r;
|
|
21
|
+
}
|
|
22
|
+
push(...r) {
|
|
23
|
+
for (const o of r)
|
|
24
|
+
this.w = P(this.w, [o]), this.list.push(o);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const x = (i, r) => r === null || r === _ || i.groups.some((o) => o.key === r);
|
|
28
|
+
function h(i, r, o, e) {
|
|
29
|
+
if (i.select = e.group_key === _ ? { kind: "header", field: e.field } : {
|
|
30
|
+
kind: e.field.startsWith("__") ? "slot" : "field",
|
|
31
|
+
field: e.field,
|
|
32
|
+
group_key: e.group_key
|
|
33
|
+
}, e.group_key !== o.group_key) {
|
|
34
|
+
if (!x(i.w, e.group_key))
|
|
35
|
+
throw new Error(
|
|
36
|
+
`Its saved section “${T(r.groups, e.group_key)}” is not on the form — put that back first`
|
|
37
|
+
);
|
|
38
|
+
i.push({
|
|
39
|
+
op: "move",
|
|
40
|
+
from: { field: o.field, group_key: o.group_key },
|
|
41
|
+
to_group_key: e.group_key,
|
|
42
|
+
index: Math.max(
|
|
43
|
+
0,
|
|
44
|
+
u(r, e.group_key).findIndex((t) => t.field === e.field)
|
|
45
|
+
)
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
i.push(
|
|
49
|
+
...a(i.w, r, {
|
|
50
|
+
kind: "field",
|
|
51
|
+
field: e.field,
|
|
52
|
+
group_key: e.group_key
|
|
53
|
+
})
|
|
54
|
+
);
|
|
55
|
+
const f = u(r, e.group_key).findIndex((t) => t.field === e.field), s = u(i.w, e.group_key).findIndex((t) => t.field === e.field);
|
|
56
|
+
if (!v(e) && f >= 0 && s >= 0 && f !== s) {
|
|
57
|
+
const t = u(i.w, e.group_key).length;
|
|
58
|
+
i.push({
|
|
59
|
+
op: "move",
|
|
60
|
+
from: { field: e.field, group_key: e.group_key },
|
|
61
|
+
to_group_key: e.group_key,
|
|
62
|
+
index: Math.min(f, t - 1)
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function R(i, r, o) {
|
|
67
|
+
const e = M(o), f = i.placements.find((n) => n.field === o.field && n.group_key === e);
|
|
68
|
+
if (!f) throw new Error("That is no longer on this form");
|
|
69
|
+
const s = new E(i), t = r.placements.find((n) => n.field === o.field && n.group_key === e);
|
|
70
|
+
if (t)
|
|
71
|
+
return h(s, r, f, t), s;
|
|
72
|
+
const d = r.placements.filter((n) => n.field === o.field).find(
|
|
73
|
+
(n) => !i.placements.some((p) => p.field === n.field && p.group_key === n.group_key)
|
|
74
|
+
);
|
|
75
|
+
return d ? (h(s, r, f, d), s) : (s.isNew = !0, s.push({ op: "remove", at: { field: f.field, group_key: f.group_key } }), s);
|
|
76
|
+
}
|
|
77
|
+
function B(i, r, o) {
|
|
78
|
+
if (o === $) throw new Error("Ungrouped is not a section");
|
|
79
|
+
if (!i.groups.some((t) => t.key === o)) throw new Error("That section is no longer here");
|
|
80
|
+
const e = new E(i);
|
|
81
|
+
if (r.groups.some((t) => t.key === o))
|
|
82
|
+
return e.push(...a(i, r, { kind: "group", key: o })), e.select = { kind: "group", key: o }, e;
|
|
83
|
+
e.isNew = !0;
|
|
84
|
+
const f = [], s = (t) => {
|
|
85
|
+
for (const l of i.groups) l.parent_key === t && s(l.key);
|
|
86
|
+
f.push(t);
|
|
87
|
+
};
|
|
88
|
+
s(o);
|
|
89
|
+
for (const t of f) {
|
|
90
|
+
if (r.groups.some((l) => l.key === t)) {
|
|
91
|
+
e.push(...a(e.w, r, { kind: "group", key: t }));
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
for (const l of u(e.w, t)) {
|
|
95
|
+
const d = r.placements.find(
|
|
96
|
+
(n) => n.field === l.field && !e.w.placements.some((p) => p.field === n.field && p.group_key === n.group_key) && x(e.w, n.group_key) && !f.includes(n.group_key ?? "")
|
|
97
|
+
);
|
|
98
|
+
d ? e.push({
|
|
99
|
+
op: "move",
|
|
100
|
+
from: { field: l.field, group_key: t },
|
|
101
|
+
to_group_key: d.group_key,
|
|
102
|
+
index: Math.max(
|
|
103
|
+
0,
|
|
104
|
+
u(r, d.group_key).findIndex((n) => n.field === d.field)
|
|
105
|
+
)
|
|
106
|
+
}) : e.push({ op: "remove", at: { field: l.field, group_key: t } });
|
|
107
|
+
}
|
|
108
|
+
e.push({ op: "group_remove", key: t, placements: "delete" });
|
|
109
|
+
}
|
|
110
|
+
return e;
|
|
111
|
+
}
|
|
112
|
+
function j(i, r, o, e = {}) {
|
|
113
|
+
var m;
|
|
114
|
+
if (!o) return k("Select a field or section first");
|
|
115
|
+
if (!r) return k("The saved form is still loading");
|
|
116
|
+
const f = e.baseline === "opened" ? "as it was when you opened the form" : "as saved", s = w(i), t = w(r), l = o.kind === "group" ? (() => {
|
|
117
|
+
const g = s.groups.find((O) => O.key === o.key);
|
|
118
|
+
return g ? g.label || y(g.key) : y(o.key);
|
|
119
|
+
})() : o.field.startsWith("__") ? U(o.field) : ((m = e.fieldLabel) == null ? void 0 : m.call(e, o.field)) ?? y(o.field);
|
|
120
|
+
let d;
|
|
121
|
+
try {
|
|
122
|
+
d = o.kind === "group" ? B(s, t, o.key) : R(s, t, o);
|
|
123
|
+
} catch (g) {
|
|
124
|
+
return k(G(g.message));
|
|
125
|
+
}
|
|
126
|
+
if (d.list.length === 0) return k(`${l} is already ${f}`);
|
|
127
|
+
const n = d.isNew, p = n ? [
|
|
128
|
+
e.baseline === "opened" ? "It was not on the form when you opened it: it comes off" : "It is not on the saved form: it comes off"
|
|
129
|
+
] : [];
|
|
130
|
+
return z(s, {
|
|
131
|
+
ok: !0,
|
|
132
|
+
ops: d.list,
|
|
133
|
+
label: n ? `Take ${l} off (not ${f})` : `Put ${l} back ${f}`,
|
|
134
|
+
notes: p,
|
|
135
|
+
select: n ? void 0 : d.select
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
export {
|
|
139
|
+
j as revertPlan
|
|
140
|
+
};
|
|
@@ -1,241 +1,264 @@
|
|
|
1
|
-
import { readGroupStructure as
|
|
2
|
-
import { GROUP_PATCH_KEYS as
|
|
1
|
+
import { readGroupStructure as g, withGroupStructure as w, isFolded as E, FOLD_KEY as G, rowOf as L } from "../../lib/form-structure.js";
|
|
2
|
+
import { GROUP_PATCH_KEYS as M, applyLayoutOps as W } from "../../lib/layout-ops.js";
|
|
3
3
|
import { titleCase as N } from "../../lib/utils.js";
|
|
4
|
-
import { newGroupKey as
|
|
5
|
-
import { normalizedBundle as
|
|
6
|
-
import { withKey as
|
|
7
|
-
import { isPinned as
|
|
8
|
-
import { humanizeOpError as
|
|
9
|
-
const
|
|
10
|
-
function
|
|
11
|
-
if (
|
|
4
|
+
import { newGroupKey as Y } from "./add-target.js";
|
|
5
|
+
import { normalizedBundle as T, zoneItems as x, keyOf as O, plural as _, inPageOrder as D, selectedPlacements as z } from "./field-zones.js";
|
|
6
|
+
import { withKey as A, readOverrides as J } from "./inspector/model.js";
|
|
7
|
+
import { isPinned as P } from "./pin.js";
|
|
8
|
+
import { humanizeOpError as H } from "./useLayoutDraft.js";
|
|
9
|
+
const d = (t) => ({ ok: !1, reason: t });
|
|
10
|
+
function $(t, n) {
|
|
11
|
+
if (n.ops.length === 0) return d("Nothing would change");
|
|
12
12
|
try {
|
|
13
|
-
return
|
|
13
|
+
return W(t, n.ops), n;
|
|
14
14
|
} catch (e) {
|
|
15
|
-
return
|
|
15
|
+
return d(H(e.message));
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
const a = (t,
|
|
19
|
-
function
|
|
20
|
-
const e = new Map(t.map((
|
|
21
|
-
return t.map((
|
|
22
|
-
const
|
|
23
|
-
if (!
|
|
24
|
-
const i =
|
|
25
|
-
return i.length >= 2 ? Math.min(...i) :
|
|
18
|
+
const a = (t, n) => n ? t.groups.find((e) => e.key === n) ?? null : null, u = (t) => t.label || N(t.key), j = /* @__PURE__ */ new Set(["section", "tab"]), B = (t) => !t.field.startsWith("__");
|
|
19
|
+
function C(t, n) {
|
|
20
|
+
const e = new Map(t.map((o, s) => [o.field, s]));
|
|
21
|
+
return t.map((o, s) => {
|
|
22
|
+
const r = L(n, o.field);
|
|
23
|
+
if (!r) return s;
|
|
24
|
+
const i = r.fields.map((p) => e.get(p)).filter((p) => p != null);
|
|
25
|
+
return i.length >= 2 ? Math.min(...i) : s;
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
|
-
const
|
|
29
|
-
function
|
|
30
|
-
const e = {},
|
|
31
|
-
for (const
|
|
32
|
-
return e.swap_config =
|
|
28
|
+
const I = (t, n) => t.map((e) => ({ ...e, fields: e.fields.filter((o) => n.has(o)) })).filter((e) => e.fields.length > 0);
|
|
29
|
+
function q(t, n) {
|
|
30
|
+
const e = {}, o = /* @__PURE__ */ new Set(["label", "content", "content_tone", "summary_fields", "editor_note", "i18n"]);
|
|
31
|
+
for (const s of M) !o.has(s) && s !== "swap_config" && (e[s] = t[s]);
|
|
32
|
+
return e.swap_config = w(null, { rows: n }), e;
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
if (!
|
|
36
|
-
if (
|
|
37
|
-
const e = a(t,
|
|
34
|
+
function Q(t, n) {
|
|
35
|
+
if (!n || n.kind !== "field" && n.kind !== "slot") return "Select the field to split at";
|
|
36
|
+
if (n.group_key === null) return "Ungrouped fields are not in a section";
|
|
37
|
+
const e = a(t, n.group_key);
|
|
38
38
|
if (!e) return "This comes from the parent form: override it here first";
|
|
39
|
-
if (!
|
|
40
|
-
if (
|
|
41
|
-
const
|
|
42
|
-
return
|
|
43
|
-
}
|
|
44
|
-
function
|
|
45
|
-
const e =
|
|
46
|
-
if (e) return
|
|
47
|
-
const
|
|
39
|
+
if (!j.has(e.type)) return "Only sections, tabs and steps split";
|
|
40
|
+
if (P(e) || P(a(t, e.parent_key))) return "Unpin it first";
|
|
41
|
+
const o = T(t), s = x(o, e.key), r = s.findIndex((p) => p.field === n.field);
|
|
42
|
+
return r < 0 ? "That field is no longer where it was" : C(s, g(e.swap_config).rows)[r] !== r ? "Split before or after the row it sits in" : r === 0 ? "It is already the first field: nothing above it would stay" : null;
|
|
43
|
+
}
|
|
44
|
+
function pe(t, n) {
|
|
45
|
+
const e = Q(t, n);
|
|
46
|
+
if (e) return d(e);
|
|
47
|
+
const o = n, s = T(t), r = a(s, o.group_key), i = g(r.swap_config), p = x(s, r.key), f = C(p, i.rows), b = p.findIndex((h) => h.field === o.field), y = p.filter((h, U) => f[U] >= b), k = new Set(y.map((h) => h.field)), m = new Set(p.filter((h) => !k.has(h.field)).map((h) => h.field)), c = Y(s, `${r.key}_2`), S = `${u(r)} (continued)`, l = [
|
|
48
48
|
{
|
|
49
49
|
op: "group_create",
|
|
50
|
-
key:
|
|
51
|
-
label:
|
|
52
|
-
group_type:
|
|
53
|
-
parent_key:
|
|
54
|
-
index:
|
|
55
|
-
patch:
|
|
50
|
+
key: c,
|
|
51
|
+
label: S,
|
|
52
|
+
group_type: r.type,
|
|
53
|
+
parent_key: r.parent_key,
|
|
54
|
+
index: r.sort + 1,
|
|
55
|
+
patch: q(r, I(i.rows, k))
|
|
56
56
|
},
|
|
57
|
-
...
|
|
58
|
-
],
|
|
59
|
-
JSON.stringify(
|
|
57
|
+
...y.map((h, U) => ({ op: "move", from: O(h), to_group_key: c, index: U }))
|
|
58
|
+
], v = I(i.rows, m);
|
|
59
|
+
JSON.stringify(v) !== JSON.stringify(i.rows) && l.push({
|
|
60
60
|
op: "group_update",
|
|
61
|
-
key:
|
|
62
|
-
patch: { swap_config:
|
|
61
|
+
key: r.key,
|
|
62
|
+
patch: { swap_config: w(r.swap_config, { rows: v }) }
|
|
63
63
|
});
|
|
64
|
-
const
|
|
65
|
-
return i.sticky &&
|
|
64
|
+
const F = [`${_(y.length, "field")} move to ${S}`];
|
|
65
|
+
return i.sticky && F.push("Only the first part stays pinned to the top"), $(t, {
|
|
66
66
|
ok: !0,
|
|
67
|
-
ops:
|
|
68
|
-
label: `Split ${
|
|
69
|
-
notes:
|
|
70
|
-
select: { kind: "group", key:
|
|
67
|
+
ops: l,
|
|
68
|
+
label: `Split ${u(r)}`,
|
|
69
|
+
notes: F,
|
|
70
|
+
select: { kind: "group", key: c }
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
|
-
function
|
|
74
|
-
const e =
|
|
75
|
-
if (!
|
|
76
|
-
const
|
|
77
|
-
return
|
|
73
|
+
function K(t, n) {
|
|
74
|
+
const e = T(t), o = a(e, n);
|
|
75
|
+
if (!o) return null;
|
|
76
|
+
const r = e.groups.filter((i) => i.parent_key === o.parent_key).sort((i, p) => i.sort - p.sort).find((i) => i.sort > o.sort);
|
|
77
|
+
return r && r.sort === o.sort + 1 && r.type === o.type ? r : null;
|
|
78
78
|
}
|
|
79
|
-
function
|
|
80
|
-
const e = a(t,
|
|
79
|
+
function V(t, n) {
|
|
80
|
+
const e = a(t, n);
|
|
81
81
|
if (!e) return "This comes from the parent form: override it here first";
|
|
82
|
-
if (!
|
|
83
|
-
const
|
|
84
|
-
return
|
|
85
|
-
}
|
|
86
|
-
function
|
|
87
|
-
const e =
|
|
88
|
-
if (e) return
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
82
|
+
if (!j.has(e.type)) return "Only sections, tabs and steps join";
|
|
83
|
+
const o = K(t, n);
|
|
84
|
+
return o ? [e, o].some((s) => P(s)) || P(a(t, e.parent_key)) ? "Unpin it first" : null : e.type === "tab" ? "No tab or step right after it" : "No section right below it";
|
|
85
|
+
}
|
|
86
|
+
function ce(t, n) {
|
|
87
|
+
const e = V(t, n);
|
|
88
|
+
if (e) return d(e);
|
|
89
|
+
const o = T(t), s = a(o, n), r = K(o, n), { ops: i, notes: p } = R(o, s, r);
|
|
90
|
+
return $(t, {
|
|
91
|
+
ok: !0,
|
|
92
|
+
ops: i,
|
|
93
|
+
label: `Join ${u(s)} and ${u(r)}`,
|
|
94
|
+
notes: p,
|
|
95
|
+
select: { kind: "group", key: s.key }
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
function R(t, n, e) {
|
|
99
|
+
const o = x(t, n.key), s = new Set(o.map((c) => c.field)), r = x(t, e.key), i = [];
|
|
100
|
+
let p = o.length, f = 0;
|
|
101
|
+
for (const c of r) {
|
|
102
|
+
if (s.has(c.field)) {
|
|
103
|
+
f++, i.push({ op: "remove", at: O(c) });
|
|
94
104
|
continue;
|
|
95
105
|
}
|
|
96
|
-
|
|
106
|
+
i.push({ op: "move", from: O(c), to_group_key: n.key, index: p++ });
|
|
97
107
|
}
|
|
98
|
-
const
|
|
108
|
+
const b = g(n.swap_config), y = new Set(r.filter((c) => !s.has(c.field)).map((c) => c.field)), k = I(g(e.swap_config).rows, y).map((c) => ({
|
|
99
109
|
...c,
|
|
100
|
-
key:
|
|
110
|
+
key: b.rows.some((S) => S.key === c.key) ? `${c.key}_${e.key}` : c.key
|
|
101
111
|
}));
|
|
102
|
-
|
|
112
|
+
k.length && i.push({
|
|
103
113
|
op: "group_update",
|
|
104
114
|
key: n.key,
|
|
105
|
-
patch: { swap_config:
|
|
106
|
-
}),
|
|
107
|
-
const
|
|
108
|
-
return
|
|
115
|
+
patch: { swap_config: w(n.swap_config, { rows: [...b.rows, ...k] }) }
|
|
116
|
+
}), i.push({ op: "group_remove", key: e.key, placements: "delete" });
|
|
117
|
+
const m = [`${_(r.length, "field")} from ${u(e)} join ${u(n)}`];
|
|
118
|
+
return m.push(`${u(n)} keeps its settings`), f && m.push(`${_(f, "field")} in both ${f === 1 ? "shows" : "show"} once`), { ops: i, notes: m };
|
|
119
|
+
}
|
|
120
|
+
function X(t, n, e) {
|
|
121
|
+
if (n === e) return "It is the same section";
|
|
122
|
+
const o = a(t, n), s = a(t, e);
|
|
123
|
+
return !o || !s ? "This comes from the parent form: override it here first" : !j.has(o.type) || !j.has(s.type) ? "Only sections, tabs and steps join" : o.type !== s.type ? o.type === "tab" ? "A tab joins another tab" : "A section joins another section" : (o.parent_key ?? null) !== (s.parent_key ?? null) ? "They sit in different holders" : [o, s].some((r) => P(r)) || P(a(t, o.parent_key)) ? "Unpin it first" : null;
|
|
124
|
+
}
|
|
125
|
+
function le(t, n, e) {
|
|
126
|
+
const o = X(t, n, e);
|
|
127
|
+
if (o) return d(o);
|
|
128
|
+
const s = T(t), r = a(s, n), i = a(s, e), { ops: p, notes: f } = R(s, i, r);
|
|
129
|
+
return $(t, {
|
|
109
130
|
ok: !0,
|
|
110
|
-
ops:
|
|
111
|
-
label: `Join ${
|
|
131
|
+
ops: p,
|
|
132
|
+
label: `Join ${u(r)} into ${u(i)}`,
|
|
112
133
|
notes: f,
|
|
113
|
-
select: { kind: "group", key:
|
|
134
|
+
select: { kind: "group", key: i.key }
|
|
114
135
|
});
|
|
115
136
|
}
|
|
116
|
-
function
|
|
117
|
-
const e = z(t,
|
|
137
|
+
function Z(t, n) {
|
|
138
|
+
const e = z(t, n).filter(B);
|
|
118
139
|
if (e.length < 2) return "Select two or more fields in one section";
|
|
119
|
-
const
|
|
120
|
-
if (e.some((
|
|
121
|
-
if (
|
|
122
|
-
const
|
|
123
|
-
return
|
|
124
|
-
}
|
|
125
|
-
function
|
|
126
|
-
const
|
|
127
|
-
if (
|
|
128
|
-
const
|
|
129
|
-
let
|
|
130
|
-
for (let
|
|
131
|
-
const
|
|
132
|
-
...
|
|
133
|
-
|
|
134
|
-
],
|
|
135
|
-
|
|
136
|
-
|
|
140
|
+
const o = e[0].group_key;
|
|
141
|
+
if (e.some((r) => r.group_key !== o)) return "Pick fields from one section";
|
|
142
|
+
if (o === null) return "Ungrouped fields are not in a section: wrap them first";
|
|
143
|
+
const s = a(t, o);
|
|
144
|
+
return s ? j.has(s.type) ? e.length > 6 ? "Six fields at most share one row" : null : "Only fields in sections, tabs and steps share a row" : "This comes from the parent form: override it here first";
|
|
145
|
+
}
|
|
146
|
+
function ae(t, n, e = N) {
|
|
147
|
+
const o = Z(t, n);
|
|
148
|
+
if (o) return d(o);
|
|
149
|
+
const s = T(t), r = D(s, z(s, n).filter(B)), i = a(s, r[0].group_key), p = g(i.swap_config), f = r.map((l) => l.field), b = new Set(p.rows.map((l) => l.key));
|
|
150
|
+
let y = "row";
|
|
151
|
+
for (let l = 2; b.has(y); l++) y = `row_${l}`;
|
|
152
|
+
const k = { key: y, label: f.map(e).join(" / "), fields: f }, m = [
|
|
153
|
+
...p.rows.map((l) => ({ ...l, fields: l.fields.filter((v) => !f.includes(v)) })).filter((l) => l.fields.length >= 2),
|
|
154
|
+
k
|
|
155
|
+
], c = [], S = x(s, i.key).findIndex((l) => l.field === f[0]);
|
|
156
|
+
r.slice(1).forEach((l, v) => {
|
|
157
|
+
c.push({ op: "move", from: O(l), to_group_key: i.key, index: S + 1 + v });
|
|
137
158
|
});
|
|
138
|
-
for (const
|
|
139
|
-
E(
|
|
159
|
+
for (const l of r)
|
|
160
|
+
E(l.overrides) && c.push({
|
|
140
161
|
op: "update_placement",
|
|
141
|
-
at:
|
|
142
|
-
patch: { overrides:
|
|
162
|
+
at: O(l),
|
|
163
|
+
patch: { overrides: A(J(l), G, void 0) }
|
|
143
164
|
});
|
|
144
|
-
return
|
|
165
|
+
return c.push({
|
|
145
166
|
op: "group_update",
|
|
146
167
|
key: i.key,
|
|
147
|
-
patch: { swap_config:
|
|
148
|
-
}),
|
|
168
|
+
patch: { swap_config: w(i.swap_config, { rows: m }) }
|
|
169
|
+
}), $(t, {
|
|
149
170
|
ok: !0,
|
|
150
|
-
ops:
|
|
151
|
-
label: `Put ${
|
|
152
|
-
notes: [`Under one label: “${
|
|
153
|
-
select: { kind: "field", field:
|
|
171
|
+
ops: c,
|
|
172
|
+
label: `Put ${_(f.length, "field")} side by side`,
|
|
173
|
+
notes: [`Under one label: “${k.label}”`],
|
|
174
|
+
select: { kind: "field", field: f[0], group_key: i.key }
|
|
154
175
|
});
|
|
155
176
|
}
|
|
156
|
-
function
|
|
157
|
-
const
|
|
158
|
-
if (!
|
|
159
|
-
const
|
|
160
|
-
if (!i) return
|
|
161
|
-
const
|
|
162
|
-
return
|
|
177
|
+
function ue(t, n, e, o) {
|
|
178
|
+
const s = a(t, n);
|
|
179
|
+
if (!s) return d("That section is no longer on this form");
|
|
180
|
+
const r = g(s.swap_config), i = r.rows.find((f) => f.key === e);
|
|
181
|
+
if (!i) return d("That row is no longer on this form");
|
|
182
|
+
const p = o === null ? r.rows.filter((f) => f.key !== e) : r.rows.map((f) => f.key === e ? { ...f, ...o } : f).filter((f) => f.key !== e || f.fields.length >= 2);
|
|
183
|
+
return $(t, {
|
|
163
184
|
ok: !0,
|
|
164
185
|
ops: [
|
|
165
186
|
{
|
|
166
187
|
op: "group_update",
|
|
167
|
-
key:
|
|
168
|
-
patch: { swap_config:
|
|
188
|
+
key: s.key,
|
|
189
|
+
patch: { swap_config: w(s.swap_config, { rows: p }) }
|
|
169
190
|
}
|
|
170
191
|
],
|
|
171
|
-
label:
|
|
192
|
+
label: o === null ? `Take the row “${i.label}” apart` : `Change the row “${i.label}”`,
|
|
172
193
|
notes: []
|
|
173
194
|
});
|
|
174
195
|
}
|
|
175
|
-
function
|
|
176
|
-
const
|
|
177
|
-
let
|
|
178
|
-
for (const
|
|
179
|
-
if (!B(
|
|
180
|
-
const i = a(t,
|
|
181
|
-
if (e && i && L(
|
|
182
|
-
|
|
196
|
+
function de(t, n, e) {
|
|
197
|
+
const o = [];
|
|
198
|
+
let s = 0;
|
|
199
|
+
for (const r of n) {
|
|
200
|
+
if (!B(r) || r.group_key === null) continue;
|
|
201
|
+
const i = a(t, r.group_key);
|
|
202
|
+
if (e && i && L(g(i.swap_config).rows, r.field)) {
|
|
203
|
+
s++;
|
|
183
204
|
continue;
|
|
184
205
|
}
|
|
185
|
-
E(
|
|
206
|
+
E(r.overrides) !== e && o.push({
|
|
186
207
|
op: "update_placement",
|
|
187
|
-
at:
|
|
188
|
-
patch: { overrides:
|
|
208
|
+
at: O(r),
|
|
209
|
+
patch: { overrides: A(J(r), G, e ? !0 : void 0) }
|
|
189
210
|
});
|
|
190
211
|
}
|
|
191
|
-
return
|
|
212
|
+
return o.length === 0 && s ? d("Fields in a row stay out of the fold") : $(t, {
|
|
192
213
|
ok: !0,
|
|
193
|
-
ops:
|
|
194
|
-
label: e ? `Put ${
|
|
195
|
-
notes:
|
|
214
|
+
ops: o,
|
|
215
|
+
label: e ? `Put ${_(o.length, "field")} behind “Show more”` : `Show ${_(o.length, "field")} always`,
|
|
216
|
+
notes: s ? [`${_(s, "field")} in a row ${s === 1 ? "stays" : "stay"} out`] : []
|
|
196
217
|
});
|
|
197
218
|
}
|
|
198
|
-
function
|
|
199
|
-
const
|
|
200
|
-
if (!
|
|
201
|
-
if (
|
|
202
|
-
return
|
|
203
|
-
const
|
|
219
|
+
function he(t, n, e) {
|
|
220
|
+
const o = a(t, n);
|
|
221
|
+
if (!o) return d("That section is no longer on this form");
|
|
222
|
+
if (o.type !== "section" || o.parent_key !== null)
|
|
223
|
+
return d("Only a section at the top level of the form sticks");
|
|
224
|
+
const s = [], r = [];
|
|
204
225
|
if (e)
|
|
205
226
|
for (const i of t.groups)
|
|
206
|
-
i.key !==
|
|
227
|
+
i.key !== n && g(i.swap_config).sticky && (s.push({
|
|
207
228
|
op: "group_update",
|
|
208
229
|
key: i.key,
|
|
209
|
-
patch: { swap_config:
|
|
210
|
-
}),
|
|
211
|
-
return
|
|
230
|
+
patch: { swap_config: w(i.swap_config, { sticky: !1 }) }
|
|
231
|
+
}), r.push(`${u(i)} stops sticking: one sticky section per form`));
|
|
232
|
+
return g(o.swap_config).sticky !== e && s.push({
|
|
212
233
|
op: "group_update",
|
|
213
|
-
key:
|
|
214
|
-
patch: { swap_config:
|
|
215
|
-
}),
|
|
234
|
+
key: n,
|
|
235
|
+
patch: { swap_config: w(o.swap_config, { sticky: e }) }
|
|
236
|
+
}), $(t, {
|
|
216
237
|
ok: !0,
|
|
217
|
-
ops:
|
|
218
|
-
label: e ? `Pin ${
|
|
219
|
-
notes:
|
|
238
|
+
ops: s,
|
|
239
|
+
label: e ? `Pin ${u(o)} to the top` : `Let ${u(o)} scroll`,
|
|
240
|
+
notes: r
|
|
220
241
|
});
|
|
221
242
|
}
|
|
222
|
-
function
|
|
243
|
+
function ye(t, n) {
|
|
223
244
|
return {
|
|
224
245
|
op: "group_update",
|
|
225
246
|
key: t.key,
|
|
226
|
-
patch: { swap_config:
|
|
247
|
+
patch: { swap_config: w(t.swap_config, { emptyText: n }) }
|
|
227
248
|
};
|
|
228
249
|
}
|
|
229
250
|
export {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
251
|
+
ye as emptyTextOp,
|
|
252
|
+
de as foldPlan,
|
|
253
|
+
V as joinBlocked,
|
|
254
|
+
ce as joinPlan,
|
|
255
|
+
K as joinTarget,
|
|
256
|
+
X as mergeBlocked,
|
|
257
|
+
le as mergePlan,
|
|
258
|
+
Z as rowBlocked,
|
|
259
|
+
ae as rowPlan,
|
|
260
|
+
ue as rowUpdatePlan,
|
|
261
|
+
Q as splitBlocked,
|
|
262
|
+
pe as splitPlan,
|
|
263
|
+
he as stickyPlan
|
|
241
264
|
};
|