@nivaro/react 0.3.35 → 0.3.37
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 +13 -4
- 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 -572
- 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 +11 -10
- 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 +80 -63
- 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 +146 -131
- package/dist/shared/components/layout-editor/EditorCanvas.js +25 -17
- package/dist/shared/components/layout-editor/EditorTopBar.js +268 -206
- package/dist/shared/components/layout-editor/LayoutEditor.js +810 -731
- 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 +379 -185
- package/dist/shared/components/layout-editor/dnd/TrashZone.js +96 -0
- 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/rail-drop.js +4 -4
- package/dist/shared/components/layout-editor/dnd/sensors.js +23 -0
- package/dist/shared/components/layout-editor/dnd/trash-drop.js +58 -0
- 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/panel-frame.js +1 -1
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/layout-editor/personal-default-marks.js +40 -0
- 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 +149 -118
- 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
|
@@ -1,100 +1,122 @@
|
|
|
1
|
-
import { isCanvasSlot as R, UNGROUPED_KEY as S, applyLayoutOps as C, GROUP_PATCH_KEYS as Y } from "../../lib/layout-ops.js";
|
|
2
1
|
import { withGroupStructure as j } from "../../lib/form-structure.js";
|
|
3
|
-
import {
|
|
2
|
+
import { isCanvasSlot as R, applyLayoutOps as C, UNGROUPED_KEY as P, GROUP_PATCH_KEYS as J } from "../../lib/layout-ops.js";
|
|
3
|
+
import { titleCase as x } from "../../lib/utils.js";
|
|
4
4
|
import { newGroupKey as H } from "./add-target.js";
|
|
5
|
-
import { normalizedBundle as
|
|
6
|
-
import { readOverrides as
|
|
7
|
-
import { isPinned as
|
|
8
|
-
import { PIN_KEY as
|
|
9
|
-
import { humanizeOpError as
|
|
10
|
-
const
|
|
5
|
+
import { normalizedBundle as S, inPageOrder as K, plural as g, selectedPlacements as Z, moveToZoneOps as X, zoneItems as U, FIELD_HOLDERS as q } from "./field-zones.js";
|
|
6
|
+
import { readOverrides as B, withKey as Q, asArray as O, placementPatchOf as V } from "./inspector/model.js";
|
|
7
|
+
import { isPinned as D, withPin as F, placementOf as G, isPlacementPinned as ee, withPlacementPin as te, unpinnedPatch as oe } from "./pin.js";
|
|
8
|
+
import { PIN_KEY as He, pinLocked as Ke, pinnedZone as Be } from "./pin.js";
|
|
9
|
+
import { humanizeOpError as ne } from "./useLayoutDraft.js";
|
|
10
|
+
const k = (o) => ({ ok: !1, reason: o });
|
|
11
11
|
function m(o, e) {
|
|
12
|
-
if (e.ops.length === 0) return
|
|
12
|
+
if (e.ops.length === 0) return k("Nothing would change");
|
|
13
13
|
try {
|
|
14
14
|
return C(o, e.ops), e;
|
|
15
15
|
} catch (t) {
|
|
16
|
-
return
|
|
16
|
+
return k(ne(t.message));
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
const d = (o) => o.label ||
|
|
20
|
-
function
|
|
19
|
+
const d = (o) => o.label || x(o.key), _ = (o, e) => o.groups.find((t) => t.key === e) ?? null, T = (o, e) => o.groups.filter((t) => t.parent_key === e).sort((t, n) => t.sort - n.sort);
|
|
20
|
+
function M(o, e) {
|
|
21
21
|
const t = e.parent_key ? _(o, e.parent_key) : null;
|
|
22
22
|
return (t ? t.tab_mode : o.layout.tab_mode) === "steps" ? "steps" : "tabs";
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
return e.type === "tab" ?
|
|
24
|
+
function se(o, e) {
|
|
25
|
+
return e.type === "tab" ? M(o, e) === "steps" ? "step" : "tab" : e.type === "container" ? e.tab_mode === "steps" ? "steps holder" : "tabs holder" : e.type === "content" ? "text block" : e.type === "metadata" ? "record info section" : "section";
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function we(o, e, t) {
|
|
28
28
|
const n = _(o, e);
|
|
29
|
-
return n ?
|
|
29
|
+
return n ? D(n) === t ? k(t ? "Already pinned" : "Not pinned") : m(o, {
|
|
30
30
|
ok: !0,
|
|
31
|
-
ops: [{ op: "group_update", key: e, patch: { swap_config:
|
|
31
|
+
ops: [{ op: "group_update", key: e, patch: { swap_config: F(n.swap_config, t) } }],
|
|
32
32
|
label: `${t ? "Pin" : "Unpin"} ${d(n)}`,
|
|
33
33
|
notes: []
|
|
34
|
-
}) :
|
|
34
|
+
}) : k("That section is no longer on this form");
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function re(o, e) {
|
|
37
|
+
return !e || e.kind === "group" ? "Select a field first" : G(o, e) ? null : "This comes from the parent form: override it here first";
|
|
38
|
+
}
|
|
39
|
+
function ve(o, e, t) {
|
|
40
|
+
const n = re(o, e);
|
|
41
|
+
if (n || !e || e.kind === "group") return k(n ?? "Select a field first");
|
|
42
|
+
const i = G(o, e);
|
|
43
|
+
if (ee(i) === t) return k(t ? "Already pinned" : "Not pinned");
|
|
44
|
+
const r = i.label_override || x(e.field.replace(/^__|__$/g, ""));
|
|
45
|
+
return m(o, {
|
|
46
|
+
ok: !0,
|
|
47
|
+
ops: [
|
|
48
|
+
{
|
|
49
|
+
op: "update_placement",
|
|
50
|
+
at: { field: i.field, group_key: i.group_key },
|
|
51
|
+
patch: { overrides: te(i.overrides, t) }
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
label: `${t ? "Pin" : "Unpin"} ${r}`,
|
|
55
|
+
notes: []
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function ie(o) {
|
|
37
59
|
const e = {};
|
|
38
|
-
for (const t of
|
|
60
|
+
for (const t of J) t !== "label" && (e[t] = o[t]);
|
|
39
61
|
return e;
|
|
40
62
|
}
|
|
41
|
-
function
|
|
42
|
-
return e ? e.kind === "header" ? "A header tile shows once in the header strip" : e.kind === "slot" && R(e) ? "This panel shows once on a form" : e.kind === "field" || e.kind === "slot" ? "A field shows once per section. Duplicate its section, or add the field to another section from Add" : e.key ===
|
|
63
|
+
function le(o, e) {
|
|
64
|
+
return e ? e.kind === "header" ? "A header tile shows once in the header strip" : e.kind === "slot" && R(e) ? "This panel shows once on a form" : e.kind === "field" || e.kind === "slot" ? "A field shows once per section. Duplicate its section, or add the field to another section from Add" : e.key === P ? "Ungrouped is not a section" : _(o, e.key) ? null : "This comes from the parent form: override it here first" : "Select a section or field first";
|
|
43
65
|
}
|
|
44
|
-
function
|
|
45
|
-
const t =
|
|
46
|
-
if (t) return
|
|
47
|
-
const n =
|
|
48
|
-
let
|
|
49
|
-
const u = (c, p, v,
|
|
66
|
+
function Pe(o, e) {
|
|
67
|
+
const t = le(o, e);
|
|
68
|
+
if (t) return k(t);
|
|
69
|
+
const n = S(o), i = _(n, e.key), r = new Set(n.groups.map((c) => c.key)), l = [];
|
|
70
|
+
let a = 0;
|
|
71
|
+
const u = (c, p, v, $) => {
|
|
50
72
|
let h = `${c.key}_copy`;
|
|
51
|
-
for (let
|
|
73
|
+
for (let y = 2; r.has(h); y++) h = `${c.key}_copy_${y}`;
|
|
52
74
|
r.add(h);
|
|
53
|
-
const b =
|
|
54
|
-
return b.swap_config = j(
|
|
75
|
+
const b = ie(c);
|
|
76
|
+
return b.swap_config = j(F(c.swap_config, !1), { sticky: !1 }), l.push({
|
|
55
77
|
op: "group_create",
|
|
56
78
|
key: h,
|
|
57
|
-
label:
|
|
79
|
+
label: $,
|
|
58
80
|
group_type: c.type,
|
|
59
81
|
parent_key: p,
|
|
60
82
|
index: v,
|
|
61
83
|
patch: b
|
|
62
|
-
}), U(n, c.key).forEach((
|
|
63
|
-
|
|
84
|
+
}), U(n, c.key).forEach((y, I) => {
|
|
85
|
+
y.field.startsWith("__") || a++, l.push({
|
|
64
86
|
op: "place",
|
|
65
|
-
field:
|
|
87
|
+
field: y.field,
|
|
66
88
|
group_key: h,
|
|
67
|
-
index:
|
|
68
|
-
patch:
|
|
89
|
+
index: I,
|
|
90
|
+
patch: oe(V(y))
|
|
69
91
|
});
|
|
70
|
-
}),
|
|
71
|
-
u(
|
|
92
|
+
}), T(n, c.key).forEach((y, I) => {
|
|
93
|
+
u(y, h, I, y.label);
|
|
72
94
|
}), h;
|
|
73
|
-
}, f = u(
|
|
95
|
+
}, f = u(i, i.parent_key, i.sort + 1, `${d(i)} (copy)`), s = a ? [`Its ${g(a, "field")} now ${a === 1 ? "shows" : "show"} in both copies`] : [];
|
|
74
96
|
return m(o, {
|
|
75
97
|
ok: !0,
|
|
76
|
-
ops:
|
|
77
|
-
label: `Duplicate ${d(
|
|
98
|
+
ops: l,
|
|
99
|
+
label: `Duplicate ${d(i)}`,
|
|
78
100
|
notes: s,
|
|
79
101
|
select: { kind: "group", key: f }
|
|
80
102
|
});
|
|
81
103
|
}
|
|
82
|
-
function
|
|
83
|
-
const t =
|
|
84
|
-
if (t.layout.layout_type === "table") return
|
|
85
|
-
const n = K(t,
|
|
86
|
-
if (n.length === 0) return
|
|
87
|
-
const
|
|
88
|
-
if (
|
|
89
|
-
const
|
|
104
|
+
function Se(o, e) {
|
|
105
|
+
const t = S(o);
|
|
106
|
+
if (t.layout.layout_type === "table") return k("Table layouts have no sections");
|
|
107
|
+
const n = K(t, Z(t, e));
|
|
108
|
+
if (n.length === 0) return k("Select one or more fields first");
|
|
109
|
+
const i = n[0], r = i.group_key ? _(t, i.group_key) : null;
|
|
110
|
+
if (i.group_key && !r) return k("Those fields are not in a section of this form");
|
|
111
|
+
const l = (r == null ? void 0 : r.type) === "tab", a = (r == null ? void 0 : r.parent_key) ?? null, u = r && l ? M(t, r) : null, f = u === "steps" ? "step" : u === "tabs" ? "tab" : "section", s = r ?? _(t, P), c = s ? s.sort + 1 : Number.MAX_SAFE_INTEGER, p = H(t, f), v = {
|
|
90
112
|
op: "group_create",
|
|
91
113
|
key: p,
|
|
92
114
|
label: `New ${f}`,
|
|
93
|
-
group_type:
|
|
94
|
-
parent_key:
|
|
115
|
+
group_type: l ? "tab" : "section",
|
|
116
|
+
parent_key: a,
|
|
95
117
|
index: c
|
|
96
|
-
},
|
|
97
|
-
return
|
|
118
|
+
}, $ = C(t, [v]), h = X($, n, p), b = [], y = n.length - h.ops.length;
|
|
119
|
+
return y > 0 && b.push(`${g(y, "field")} placed twice ${y === 1 ? "goes" : "go"} in once`), m(o, {
|
|
98
120
|
ok: !0,
|
|
99
121
|
ops: [v, ...h.ops],
|
|
100
122
|
label: `Wrap ${g(h.ops.length, "field")} in a new ${f}`,
|
|
@@ -102,47 +124,47 @@ function ge(o, e) {
|
|
|
102
124
|
select: { kind: "group", key: p }
|
|
103
125
|
});
|
|
104
126
|
}
|
|
105
|
-
function
|
|
106
|
-
if (e ===
|
|
127
|
+
function ae(o, e) {
|
|
128
|
+
if (e === P) return "Ungrouped is not a section";
|
|
107
129
|
const t = _(o, e);
|
|
108
|
-
return t ? t.type === "container" ? "Use Convert to turn its tabs into sections" :
|
|
130
|
+
return t ? t.type === "container" ? "Use Convert to turn its tabs into sections" : q.has(t.type) ? null : "Only sections, tabs and steps hold fields" : "This comes from the parent form: override it here first";
|
|
109
131
|
}
|
|
110
|
-
function
|
|
111
|
-
const t =
|
|
112
|
-
if (t) return
|
|
113
|
-
const n =
|
|
114
|
-
f && r.length > 0 &&
|
|
115
|
-
const s = r.filter((c) =>
|
|
132
|
+
function Te(o, e) {
|
|
133
|
+
const t = ae(o, e);
|
|
134
|
+
if (t) return k(t);
|
|
135
|
+
const n = S(o), i = _(n, e), r = U(n, e), l = new Set(U(n, null).map((c) => c.field)), a = [], u = [], f = i.parent_key === null && l.size === 0 && !!_(n, P);
|
|
136
|
+
f && r.length > 0 && a.push({ op: "group_move", key: P, parent_key: null, index: i.sort }), a.push({ op: "group_remove", key: e, placements: "ungroup" }), r.length === 0 ? u.push("It holds no fields") : f ? u.push("Its fields stay where they are, as ungrouped fields") : u.push(`Its ${g(r.length, "field")} move to the end of Ungrouped`);
|
|
137
|
+
const s = r.filter((c) => l.has(c.field)).length;
|
|
116
138
|
return s > 0 && u.push(
|
|
117
139
|
`${g(s, "field")} already in Ungrouped ${s === 1 ? "stays" : "stay"} once`
|
|
118
140
|
), m(o, {
|
|
119
141
|
ok: !0,
|
|
120
|
-
ops:
|
|
121
|
-
label: `Unwrap ${d(
|
|
142
|
+
ops: a,
|
|
143
|
+
label: `Unwrap ${d(i)}`,
|
|
122
144
|
notes: u,
|
|
123
|
-
select: { kind: "group", key:
|
|
145
|
+
select: { kind: "group", key: P }
|
|
124
146
|
});
|
|
125
147
|
}
|
|
126
|
-
function
|
|
148
|
+
function pe(o) {
|
|
127
149
|
const e = [];
|
|
128
|
-
return o.is_collapsed && e.push("“Starts collapsed” does not apply to tabs or steps (kept, unused)"),
|
|
150
|
+
return o.is_collapsed && e.push("“Starts collapsed” does not apply to tabs or steps (kept, unused)"), O(o.summary_fields).length && e.push("The collapsed summary does not apply to tabs or steps (kept, unused)"), e;
|
|
129
151
|
}
|
|
130
|
-
function
|
|
152
|
+
function W(o) {
|
|
131
153
|
const e = [];
|
|
132
|
-
return
|
|
154
|
+
return O(o.visible_when).length && e.push("Its “Only when” rule works on steps and tabs only (kept, unused)"), O(o.skip_if_filled).length && e.push("“Skip when filled” works on steps only (kept, unused)"), e;
|
|
133
155
|
}
|
|
134
156
|
function A(o, e, t) {
|
|
135
|
-
const n = t === "steps" ? "step" : "tab",
|
|
136
|
-
if ((r == null ? void 0 : r.type) === "container" && (r.tab_mode === "steps" ? "steps" : "tabs") === t && !
|
|
137
|
-
|
|
157
|
+
const n = t === "steps" ? "step" : "tab", i = o.groups.filter((u) => u.parent_key === null).sort((u, f) => u.sort - f.sort), r = i[i.indexOf(e) - 1], l = pe(e), a = [{ op: "group_update", key: e.key, patch: { type: "tab" } }];
|
|
158
|
+
if ((r == null ? void 0 : r.type) === "container" && (r.tab_mode === "steps" ? "steps" : "tabs") === t && !D(r))
|
|
159
|
+
a.push({
|
|
138
160
|
op: "group_move",
|
|
139
161
|
key: e.key,
|
|
140
162
|
parent_key: r.key,
|
|
141
|
-
index:
|
|
142
|
-
}),
|
|
163
|
+
index: T(o, r.key).length
|
|
164
|
+
}), l.unshift(`Joins ${d(r)} as its last ${n}`);
|
|
143
165
|
else {
|
|
144
166
|
const u = H(o, t);
|
|
145
|
-
|
|
167
|
+
a.unshift({
|
|
146
168
|
op: "group_create",
|
|
147
169
|
key: u,
|
|
148
170
|
label: t === "steps" ? "Steps" : "Tabs",
|
|
@@ -150,101 +172,101 @@ function A(o, e, t) {
|
|
|
150
172
|
parent_key: null,
|
|
151
173
|
index: e.sort,
|
|
152
174
|
patch: { tab_mode: t }
|
|
153
|
-
}),
|
|
175
|
+
}), a.push({ op: "group_move", key: e.key, parent_key: u, index: 0 }), l.unshift(`A new ${t} holder takes its place, with it as the first ${n}`);
|
|
154
176
|
}
|
|
155
177
|
return m(o, {
|
|
156
178
|
ok: !0,
|
|
157
|
-
ops:
|
|
179
|
+
ops: a,
|
|
158
180
|
label: `Make ${d(e)} a ${n}`,
|
|
159
|
-
notes:
|
|
181
|
+
notes: l,
|
|
160
182
|
select: { kind: "group", key: e.key }
|
|
161
183
|
});
|
|
162
184
|
}
|
|
163
|
-
function
|
|
164
|
-
const n =
|
|
165
|
-
|
|
185
|
+
function N(o, e, t) {
|
|
186
|
+
const n = T(o, e.key), i = t ? [t] : n, r = [];
|
|
187
|
+
i.forEach((f, s) => {
|
|
166
188
|
r.push({ op: "group_move", key: f.key, parent_key: null, index: e.sort + 1 + s }), r.push({ op: "group_update", key: f.key, patch: { type: "section" } });
|
|
167
189
|
});
|
|
168
|
-
const
|
|
169
|
-
(f) =>
|
|
190
|
+
const l = i.flatMap(
|
|
191
|
+
(f) => W(f).map((s) => i.length > 1 ? `${d(f)}: ${s}` : s)
|
|
170
192
|
);
|
|
171
|
-
|
|
172
|
-
const u = t ? `Make ${d(t)} a section` : `Turn the ${
|
|
193
|
+
i.length === n.length && (r.push({ op: "group_remove", key: e.key, placements: "ungroup" }), l.unshift(`${d(e)} is removed: it would be empty`)), t ? l.unshift(`Moves out of ${d(e)}, just below it`) : l.unshift(`${g(n.length, "tab")} become sections below one another`);
|
|
194
|
+
const u = t ? `Make ${d(t)} a section` : `Turn the ${M(o, n[0] ?? e) === "steps" ? "steps" : "tabs"} of ${d(e)} into sections`;
|
|
173
195
|
return m(o, {
|
|
174
196
|
ok: !0,
|
|
175
197
|
ops: r,
|
|
176
198
|
label: u,
|
|
177
|
-
notes:
|
|
199
|
+
notes: l,
|
|
178
200
|
select: { kind: "group", key: (t ?? n[0] ?? e).key }
|
|
179
201
|
});
|
|
180
202
|
}
|
|
181
203
|
function E(o, e, t, n) {
|
|
182
|
-
const
|
|
183
|
-
e.type === "tab" &&
|
|
184
|
-
t ? `All ${r.length} tabs of ${d(t)} become ${
|
|
185
|
-
) : r.length > 0 &&
|
|
204
|
+
const i = n === "steps" ? "steps" : "tabs", r = t ? T(o, t.key) : o.groups.filter((s) => s.parent_key === null && s.type === "tab"), l = r.filter((s) => s.key !== e.key).length, a = [];
|
|
205
|
+
e.type === "tab" && l > 0 ? a.push(
|
|
206
|
+
t ? `All ${r.length} tabs of ${d(t)} become ${i}: a holder shows its tabs one way` : `All ${r.length} tabs at the top of the form become ${i}: the form shows them one way`
|
|
207
|
+
) : r.length > 0 && a.push(`${g(r.length, "tab")} show as ${i}`), n === "steps" && o.layout.validate_before_next && a.push("People must complete each step before the next");
|
|
186
208
|
const u = t ? [{ op: "group_update", key: t.key, patch: { tab_mode: n } }] : [{ op: "layout_update", patch: { tab_mode: n } }], f = e.type === "tab" ? d(e) : d(t ?? e);
|
|
187
209
|
return m(o, {
|
|
188
210
|
ok: !0,
|
|
189
211
|
ops: u,
|
|
190
|
-
label: e.type === "tab" ? `Make ${f} a ${
|
|
191
|
-
notes:
|
|
212
|
+
label: e.type === "tab" ? `Make ${f} a ${i.slice(0, -1)}` : `Show ${f} as ${i}`,
|
|
213
|
+
notes: a,
|
|
192
214
|
select: { kind: "group", key: e.key }
|
|
193
215
|
});
|
|
194
216
|
}
|
|
195
|
-
function
|
|
196
|
-
const t =
|
|
217
|
+
function Oe(o, e) {
|
|
218
|
+
const t = S(o), n = _(t, e);
|
|
197
219
|
if (!n) return [];
|
|
198
|
-
const
|
|
220
|
+
const i = n.parent_key ? _(t, n.parent_key) : null, r = [];
|
|
199
221
|
if (n.type === "section" && n.parent_key === null)
|
|
200
222
|
r.push({ to: "tab", title: "Make it a tab", plan: A(t, n, "tabs") }), r.push({ to: "step", title: "Make it a step", plan: A(t, n, "steps") });
|
|
201
223
|
else if (n.type === "tab") {
|
|
202
|
-
const
|
|
224
|
+
const l = M(t, n);
|
|
203
225
|
r.push({
|
|
204
226
|
to: "section",
|
|
205
227
|
title: "Make it a section",
|
|
206
|
-
plan:
|
|
228
|
+
plan: i ? N(t, i, n) : m(t, {
|
|
207
229
|
ok: !0,
|
|
208
230
|
ops: [{ op: "group_update", key: n.key, patch: { type: "section" } }],
|
|
209
231
|
label: `Make ${d(n)} a section`,
|
|
210
|
-
notes:
|
|
232
|
+
notes: W(n),
|
|
211
233
|
select: { kind: "group", key: n.key }
|
|
212
234
|
})
|
|
213
235
|
}), r.push(
|
|
214
|
-
|
|
236
|
+
l === "tabs" ? { to: "step", title: "Make it a step", plan: E(t, n, i, "steps") } : { to: "tab", title: "Make it a tab", plan: E(t, n, i, "tabs") }
|
|
215
237
|
);
|
|
216
238
|
} else if (n.type === "container") {
|
|
217
|
-
const
|
|
239
|
+
const l = n.tab_mode === "steps" ? "steps" : "tabs";
|
|
218
240
|
r.push(
|
|
219
|
-
|
|
241
|
+
l === "tabs" ? { to: "steps", title: "Turn its tabs into steps", plan: E(t, n, n, "steps") } : { to: "tabs", title: "Turn its steps into tabs", plan: E(t, n, n, "tabs") }
|
|
220
242
|
), r.push({
|
|
221
243
|
to: "sections",
|
|
222
|
-
title: `Turn its ${
|
|
223
|
-
plan:
|
|
244
|
+
title: `Turn its ${l} into sections`,
|
|
245
|
+
plan: T(t, n.key).length ? N(t, n) : k(`It holds no ${l}`)
|
|
224
246
|
});
|
|
225
247
|
}
|
|
226
248
|
return r;
|
|
227
249
|
}
|
|
228
|
-
const
|
|
250
|
+
const ce = ["visible_when", "hidden_for_roles", "locked_for_roles"], Ee = {
|
|
229
251
|
visible_when: "Only when (step conditions)",
|
|
230
252
|
hidden_for_roles: "Hidden for roles",
|
|
231
253
|
locked_for_roles: "Read-only for roles"
|
|
232
|
-
},
|
|
233
|
-
function
|
|
234
|
-
return
|
|
254
|
+
}, z = /* @__PURE__ */ new Set(["section", "metadata", "tab"]), xe = (o, e) => O(o[e]).length > 0, L = (o) => JSON.stringify(O(o));
|
|
255
|
+
function Me(o) {
|
|
256
|
+
return z.has(o.type) ? ce.filter((e) => e !== "visible_when" || o.type === "tab") : [];
|
|
235
257
|
}
|
|
236
|
-
function
|
|
237
|
-
return
|
|
238
|
-
(t) => t.key !== e &&
|
|
258
|
+
function Ie(o, e) {
|
|
259
|
+
return Y(S(o)).filter(
|
|
260
|
+
(t) => t.key !== e && z.has(t.type)
|
|
239
261
|
);
|
|
240
262
|
}
|
|
241
|
-
function
|
|
242
|
-
const
|
|
243
|
-
if (!
|
|
244
|
-
if (n.length === 0) return
|
|
245
|
-
if (t.length === 0) return
|
|
246
|
-
const r = [],
|
|
247
|
-
let
|
|
263
|
+
function Ue(o, e, t, n) {
|
|
264
|
+
const i = _(o, e);
|
|
265
|
+
if (!i) return k("That section is no longer on this form");
|
|
266
|
+
if (n.length === 0) return k("Pick at least one rule");
|
|
267
|
+
if (t.length === 0) return k("Pick the sections to copy onto");
|
|
268
|
+
const r = [], l = [];
|
|
269
|
+
let a = 0, u = 0;
|
|
248
270
|
for (const f of t) {
|
|
249
271
|
const s = _(o, f);
|
|
250
272
|
if (!s) continue;
|
|
@@ -254,20 +276,20 @@ function Oe(o, e, t, n) {
|
|
|
254
276
|
u++;
|
|
255
277
|
continue;
|
|
256
278
|
}
|
|
257
|
-
|
|
279
|
+
L(s[p]) !== L(i[p]) && (c[p] = i[p]);
|
|
258
280
|
}
|
|
259
|
-
Object.keys(c).length ? r.push({ op: "group_update", key: f, patch: c }) :
|
|
281
|
+
Object.keys(c).length ? r.push({ op: "group_update", key: f, patch: c }) : a++;
|
|
260
282
|
}
|
|
261
|
-
return u &&
|
|
283
|
+
return u && l.push(
|
|
262
284
|
`Step conditions skipped on ${g(u, "section")}: they work on steps and tabs only`
|
|
263
|
-
),
|
|
285
|
+
), a && l.push(`${g(a, "section")} already ${a === 1 ? "has" : "have"} these rules`), m(o, {
|
|
264
286
|
ok: !0,
|
|
265
287
|
ops: r,
|
|
266
|
-
label: `Copy the rules of ${d(
|
|
267
|
-
notes:
|
|
288
|
+
label: `Copy the rules of ${d(i)} to ${g(r.length, "section")}`,
|
|
289
|
+
notes: l
|
|
268
290
|
});
|
|
269
291
|
}
|
|
270
|
-
const
|
|
292
|
+
const Ae = {
|
|
271
293
|
group_label: "Section name",
|
|
272
294
|
text_block: "Text block",
|
|
273
295
|
label: "Field label on this form",
|
|
@@ -275,27 +297,27 @@ const Pe = {
|
|
|
275
297
|
help: "Help text on this form",
|
|
276
298
|
field_label: "Field label (sets this form’s own)",
|
|
277
299
|
field_help: "Help text (sets this form’s own)"
|
|
278
|
-
},
|
|
279
|
-
function
|
|
280
|
-
return o ? new RegExp(
|
|
300
|
+
}, ue = (o) => o.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
301
|
+
function fe(o, e) {
|
|
302
|
+
return o ? new RegExp(ue(o), e ? "g" : "gi") : null;
|
|
281
303
|
}
|
|
282
|
-
const
|
|
283
|
-
function
|
|
284
|
-
const
|
|
285
|
-
if (!
|
|
286
|
-
const r =
|
|
304
|
+
const w = (o) => typeof o == "string" && o !== "" ? o : null;
|
|
305
|
+
function Ne(o, e, t, n = {}) {
|
|
306
|
+
const i = fe(e, !!n.matchCase);
|
|
307
|
+
if (!i) return [];
|
|
308
|
+
const r = S(o), l = [], a = (s) => {
|
|
287
309
|
var p;
|
|
288
|
-
const c = ((p = s.before.match(
|
|
289
|
-
c !== 0 &&
|
|
310
|
+
const c = ((p = s.before.match(i)) == null ? void 0 : p.length) ?? 0;
|
|
311
|
+
c !== 0 && l.push({ ...s, after: s.before.replace(i, () => t), count: c });
|
|
290
312
|
};
|
|
291
|
-
for (const s of
|
|
292
|
-
|
|
313
|
+
for (const s of Y(r))
|
|
314
|
+
a({
|
|
293
315
|
id: `group:${s.key}`,
|
|
294
316
|
kind: "group_label",
|
|
295
317
|
group: s.key,
|
|
296
|
-
where:
|
|
318
|
+
where: de(r, s),
|
|
297
319
|
before: s.label
|
|
298
|
-
}), s.type === "content" &&
|
|
320
|
+
}), s.type === "content" && w(s.content) && a({
|
|
299
321
|
id: `content:${s.key}`,
|
|
300
322
|
kind: "text_block",
|
|
301
323
|
group: s.key,
|
|
@@ -306,98 +328,102 @@ function Ee(o, e, t, n = {}) {
|
|
|
306
328
|
if (s === null) return "Ungrouped";
|
|
307
329
|
if (s === "__header__") return "Header strip";
|
|
308
330
|
const c = _(r, s);
|
|
309
|
-
return c ? d(c) :
|
|
331
|
+
return c ? d(c) : x(s);
|
|
310
332
|
};
|
|
311
333
|
for (const s of K(
|
|
312
334
|
r,
|
|
313
335
|
r.placements.filter((c) => !R(c))
|
|
314
336
|
)) {
|
|
315
|
-
const c =
|
|
316
|
-
|
|
337
|
+
const c = B(s), p = u.get(s.field), $ = `${w(c.label) ?? w(s.label_override) ?? w(p == null ? void 0 : p.label) ?? x(s.field)} · ${f(s.group_key)}`, h = { field: s.field, group_key: s.group_key }, b = (y) => `${y}:${s.field}:${s.group_key ?? ""}`;
|
|
338
|
+
w(c.label) ? a({ id: b("label"), kind: "label", at: h, where: $, before: c.label }) : w(s.label_override) ? a({
|
|
317
339
|
id: b("label_override"),
|
|
318
340
|
kind: "label_override",
|
|
319
341
|
at: h,
|
|
320
|
-
where:
|
|
342
|
+
where: $,
|
|
321
343
|
before: s.label_override
|
|
322
|
-
}) :
|
|
344
|
+
}) : w(p == null ? void 0 : p.label) && !s.field.startsWith("__") && a({
|
|
323
345
|
id: b("field_label"),
|
|
324
346
|
kind: "field_label",
|
|
325
347
|
at: h,
|
|
326
|
-
where:
|
|
348
|
+
where: $,
|
|
327
349
|
before: p == null ? void 0 : p.label
|
|
328
|
-
}),
|
|
350
|
+
}), w(c.note) ? a({ id: b("help"), kind: "help", at: h, where: $, before: c.note }) : w(p == null ? void 0 : p.note) && !s.field.startsWith("__") && a({ id: b("field_help"), kind: "field_help", at: h, where: $, before: p == null ? void 0 : p.note });
|
|
329
351
|
}
|
|
330
|
-
return
|
|
352
|
+
return l;
|
|
331
353
|
}
|
|
332
|
-
function
|
|
333
|
-
return o.groups.filter((t) => t.parent_key === null && t.key !==
|
|
354
|
+
function Y(o) {
|
|
355
|
+
return o.groups.filter((t) => t.parent_key === null && t.key !== P).sort((t, n) => t.sort - n.sort).flatMap((t) => [t, ...T(o, t.key)]);
|
|
334
356
|
}
|
|
335
|
-
function
|
|
336
|
-
const t =
|
|
357
|
+
function de(o, e) {
|
|
358
|
+
const t = se(o, e);
|
|
337
359
|
return `${t[0].toUpperCase()}${t.slice(1)}`;
|
|
338
360
|
}
|
|
339
|
-
function
|
|
340
|
-
if (e.length === 0) return
|
|
361
|
+
function Le(o, e) {
|
|
362
|
+
if (e.length === 0) return k("Pick at least one match");
|
|
341
363
|
const t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
|
|
342
|
-
for (const
|
|
343
|
-
if (
|
|
344
|
-
const
|
|
345
|
-
|
|
346
|
-
} else if (
|
|
347
|
-
const
|
|
348
|
-
n.set(
|
|
364
|
+
for (const l of e)
|
|
365
|
+
if (l.group) {
|
|
366
|
+
const a = t.get(l.group) ?? {};
|
|
367
|
+
l.kind === "group_label" ? a.label = l.after : a.content = l.after, t.set(l.group, a);
|
|
368
|
+
} else if (l.at) {
|
|
369
|
+
const a = `${l.at.field}\0${l.at.group_key ?? ""}`;
|
|
370
|
+
n.set(a, [...n.get(a) ?? [], l]);
|
|
349
371
|
}
|
|
350
|
-
const
|
|
351
|
-
for (const [
|
|
352
|
-
for (const
|
|
353
|
-
const
|
|
354
|
-
(p) => p.field ===
|
|
372
|
+
const i = [];
|
|
373
|
+
for (const [l, a] of t) i.push({ op: "group_update", key: l, patch: a });
|
|
374
|
+
for (const l of n.values()) {
|
|
375
|
+
const a = l[0].at, u = o.placements.find(
|
|
376
|
+
(p) => p.field === a.field && p.group_key === a.group_key
|
|
355
377
|
);
|
|
356
378
|
if (!u) continue;
|
|
357
|
-
let f =
|
|
379
|
+
let f = B(u);
|
|
358
380
|
const s = {};
|
|
359
381
|
let c = !1;
|
|
360
|
-
for (const p of
|
|
382
|
+
for (const p of l)
|
|
361
383
|
if (p.kind === "label_override") s.label_override = p.after;
|
|
362
384
|
else {
|
|
363
385
|
const v = p.kind === "label" || p.kind === "field_label" ? "label" : "note";
|
|
364
|
-
f =
|
|
386
|
+
f = Q(f ?? {}, v, p.after === "" ? void 0 : p.after), c = !0;
|
|
365
387
|
}
|
|
366
|
-
c && (s.overrides = f),
|
|
388
|
+
c && (s.overrides = f), i.push({ op: "update_placement", at: a, patch: s });
|
|
367
389
|
}
|
|
368
|
-
const r = e.reduce((
|
|
390
|
+
const r = e.reduce((l, a) => l + a.count, 0);
|
|
369
391
|
return m(o, {
|
|
370
392
|
ok: !0,
|
|
371
|
-
ops:
|
|
393
|
+
ops: i,
|
|
372
394
|
label: `Replace ${g(r, "match", "matches")} in labels`,
|
|
373
395
|
notes: []
|
|
374
396
|
});
|
|
375
397
|
}
|
|
376
398
|
export {
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
399
|
+
Ae as HIT_KIND_LABELS,
|
|
400
|
+
He as PIN_KEY,
|
|
401
|
+
ce as RULE_KEYS,
|
|
402
|
+
Ee as RULE_LABELS,
|
|
381
403
|
m as checked,
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
404
|
+
Oe as convertChoices,
|
|
405
|
+
Ue as copyRulesPlan,
|
|
406
|
+
le as duplicateBlocked,
|
|
407
|
+
Pe as duplicatePlan,
|
|
408
|
+
re as fieldPinBlocked,
|
|
409
|
+
ve as fieldPinPlan,
|
|
410
|
+
Ne as findHits,
|
|
387
411
|
d as groupName,
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
ee as
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
412
|
+
Y as groupsInPageOrder,
|
|
413
|
+
D as isPinned,
|
|
414
|
+
ee as isPlacementPinned,
|
|
415
|
+
se as kindWord,
|
|
416
|
+
Ke as pinLocked,
|
|
417
|
+
we as pinPlan,
|
|
418
|
+
Be as pinnedZone,
|
|
419
|
+
k as refuse,
|
|
420
|
+
Le as replacePlan,
|
|
421
|
+
xe as ruleSet,
|
|
422
|
+
Ie as ruleTargets,
|
|
423
|
+
Me as rulesOf,
|
|
424
|
+
ae as unwrapBlocked,
|
|
425
|
+
Te as unwrapPlan,
|
|
426
|
+
F as withPin,
|
|
427
|
+
te as withPlacementPin,
|
|
428
|
+
Se as wrapPlan
|
|
403
429
|
};
|