@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
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { applyLayoutOps as M, LAYOUT_PATCH_KEYS as P, UNGROUPED_KEY as $, isCanvasSlot as d, newGroup as Y, newPlacement as K, GROUP_PATCH_KEYS as G, PLACEMENT_PATCH_KEYS as N } from "../../../lib/layout-ops.js";
|
|
2
|
+
import { sameValue as m } from "../canvas-diff.js";
|
|
3
|
+
const O = G, E = N, w = (r, t) => `${r}\0${t ?? ""}`, j = (r, t) => r.sort - t.sort;
|
|
4
|
+
function h(r, t, n, l = []) {
|
|
5
|
+
const u = {};
|
|
6
|
+
for (const f of n)
|
|
7
|
+
l.includes(f) || !(f in r) || r[f] === void 0 || m(r[f], t[f]) || (u[f] = r[f]);
|
|
8
|
+
return u;
|
|
9
|
+
}
|
|
10
|
+
function b(r, t) {
|
|
11
|
+
const n = r.groups.filter((l) => l.parent_key === t).map((l) => ({ key: l.key, sort: l.sort }));
|
|
12
|
+
if (t === null)
|
|
13
|
+
for (const l of r.placements) d(l) && n.push({ key: l.field, sort: l.sort });
|
|
14
|
+
return n.sort(j).map((l) => l.key);
|
|
15
|
+
}
|
|
16
|
+
function v(r, t) {
|
|
17
|
+
return r.placements.filter((n) => n.group_key === t && !d(n)).sort(j).map((n) => n.field);
|
|
18
|
+
}
|
|
19
|
+
function H(r, t) {
|
|
20
|
+
let n = M(r, []);
|
|
21
|
+
const l = [], u = [], f = (e, s) => {
|
|
22
|
+
try {
|
|
23
|
+
n = M(n, [e]), l.push(e);
|
|
24
|
+
} catch (p) {
|
|
25
|
+
u.push(`${s}: ${p.message}`);
|
|
26
|
+
}
|
|
27
|
+
}, k = {};
|
|
28
|
+
for (const e of P)
|
|
29
|
+
e in t.layout && !m(n.layout[e], t.layout[e]) && (k[e] = t.layout[e]);
|
|
30
|
+
Object.keys(k).length && f({ op: "layout_update", patch: k }, "Form settings");
|
|
31
|
+
const o = new Map(
|
|
32
|
+
t.groups.filter((e) => e.key !== $).map((e) => [e.key, e])
|
|
33
|
+
), i = new Map(t.placements.map((e) => [w(e.field, e.group_key), e])), a = (e) => {
|
|
34
|
+
const s = /* @__PURE__ */ new Map();
|
|
35
|
+
for (const p of e) s.set(p.field, (s.get(p.field) ?? 0) + 1);
|
|
36
|
+
return s;
|
|
37
|
+
}, g = a(n.placements), C = a(t.placements), S = new Set(
|
|
38
|
+
n.placements.filter(
|
|
39
|
+
(e) => g.get(e.field) === 1 && C.get(e.field) === 1 && !i.has(w(e.field, e.group_key)) && !d(e) && !t.placements.some((s) => s.field === e.field && d(s))
|
|
40
|
+
).map((e) => e.field)
|
|
41
|
+
);
|
|
42
|
+
for (const e of [...n.placements]) {
|
|
43
|
+
if (i.has(w(e.field, e.group_key))) continue;
|
|
44
|
+
const s = { field: e.field, group_key: e.group_key };
|
|
45
|
+
S.has(e.field) ? e.group_key !== null && f({ op: "move", from: s, to_group_key: null, index: 9999 }, `Move ${e.field}`) : f({ op: "remove", at: s }, `Remove ${e.field}`);
|
|
46
|
+
}
|
|
47
|
+
for (const e of [...n.groups])
|
|
48
|
+
e.key !== $ && !o.has(e.key) && n.groups.some((s) => s.key === e.key) && f({ op: "group_remove", key: e.key, placements: "ungroup" }, `Remove ${e.label}`);
|
|
49
|
+
for (const e of n.groups) {
|
|
50
|
+
const s = o.get(e.key);
|
|
51
|
+
s && e.parent_key !== null && e.parent_key !== s.parent_key && f({ op: "group_move", key: e.key, parent_key: null, index: 9999 }, `Move ${e.label}`);
|
|
52
|
+
}
|
|
53
|
+
for (const e of [...n.groups]) {
|
|
54
|
+
const s = o.get(e.key);
|
|
55
|
+
if (!s) continue;
|
|
56
|
+
const p = h(s, e, O);
|
|
57
|
+
Object.keys(p).length && f({ op: "group_update", key: e.key, patch: p }, `Change ${s.label}`);
|
|
58
|
+
}
|
|
59
|
+
const x = () => new Set(n.groups.map((e) => e.key)), T = t.groups.filter((e) => e.key !== $ && !x().has(e.key));
|
|
60
|
+
for (const e of [...T].sort(
|
|
61
|
+
(s, p) => +(s.parent_key != null) - +(p.parent_key != null)
|
|
62
|
+
)) {
|
|
63
|
+
const s = Y(e.key, e.label, e.type, e.parent_key), p = h(e, s, O, ["label", "type"]);
|
|
64
|
+
f(
|
|
65
|
+
{
|
|
66
|
+
op: "group_create",
|
|
67
|
+
key: e.key,
|
|
68
|
+
label: e.label,
|
|
69
|
+
group_type: e.type,
|
|
70
|
+
parent_key: e.parent_key,
|
|
71
|
+
index: 9999,
|
|
72
|
+
...Object.keys(p).length ? { patch: p } : {}
|
|
73
|
+
},
|
|
74
|
+
`Add ${e.label}`
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
for (const e of t.placements) {
|
|
78
|
+
if (!n.placements.find((c) => c.field === e.field && c.group_key === e.group_key) && S.has(e.field)) {
|
|
79
|
+
const c = n.placements.find((_) => _.field === e.field);
|
|
80
|
+
c && f(
|
|
81
|
+
{
|
|
82
|
+
op: "move",
|
|
83
|
+
from: { field: c.field, group_key: c.group_key },
|
|
84
|
+
to_group_key: e.group_key,
|
|
85
|
+
index: 9999
|
|
86
|
+
},
|
|
87
|
+
`Move ${e.field}`
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
const p = n.placements.find((c) => c.field === e.field && c.group_key === e.group_key);
|
|
91
|
+
if (!p) {
|
|
92
|
+
const c = K(e.field, e.group_key), _ = h(e, c, E);
|
|
93
|
+
f(
|
|
94
|
+
{
|
|
95
|
+
op: "place",
|
|
96
|
+
field: e.field,
|
|
97
|
+
group_key: e.group_key,
|
|
98
|
+
index: 9999,
|
|
99
|
+
...Object.keys(_).length ? { patch: _ } : {}
|
|
100
|
+
},
|
|
101
|
+
`Add ${e.field}`
|
|
102
|
+
);
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
const y = h(e, p, E);
|
|
106
|
+
Object.keys(y).length && f(
|
|
107
|
+
{
|
|
108
|
+
op: "update_placement",
|
|
109
|
+
at: { field: e.field, group_key: e.group_key },
|
|
110
|
+
patch: y
|
|
111
|
+
},
|
|
112
|
+
`Change ${e.field}`
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
const A = new Set(t.placements.filter((e) => !d(e)).map((e) => e.group_key));
|
|
116
|
+
for (const e of A)
|
|
117
|
+
v(t, e).forEach((p, y) => {
|
|
118
|
+
v(n, e)[y] !== p && f(
|
|
119
|
+
{ op: "move", from: { field: p, group_key: e }, to_group_key: e, index: y },
|
|
120
|
+
`Order ${p}`
|
|
121
|
+
);
|
|
122
|
+
});
|
|
123
|
+
const U = [
|
|
124
|
+
null,
|
|
125
|
+
...t.groups.filter((e) => e.type === "container").map((e) => e.key)
|
|
126
|
+
];
|
|
127
|
+
for (const e of U)
|
|
128
|
+
b(t, e).forEach((p, y) => {
|
|
129
|
+
b(n, e)[y] !== p && f({ op: "group_move", key: p, parent_key: e, index: y }, `Order ${p}`);
|
|
130
|
+
});
|
|
131
|
+
return { ops: l, remaining: [...u, ...R(n, t)], after: n };
|
|
132
|
+
}
|
|
133
|
+
function R(r, t) {
|
|
134
|
+
const n = [];
|
|
135
|
+
for (const [o, i] of Object.entries(t.layout))
|
|
136
|
+
P.includes(o) && !m(r.layout[o], i) && n.push(`The form setting ${o} differs`);
|
|
137
|
+
const l = new Map(r.groups.map((o) => [o.key, o]));
|
|
138
|
+
for (const o of t.groups) {
|
|
139
|
+
const i = l.get(o.key);
|
|
140
|
+
if (!i) {
|
|
141
|
+
n.push(`${o.label} is missing`);
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
if (o.key !== $) {
|
|
145
|
+
i.parent_key !== o.parent_key && n.push(`${o.label} sits somewhere else`);
|
|
146
|
+
for (const a of O) {
|
|
147
|
+
const g = o[a];
|
|
148
|
+
g !== void 0 && (m(i[a], g) || n.push(`${o.label}: ${a} differs`));
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
for (const o of r.groups)
|
|
153
|
+
t.groups.some((i) => i.key === o.key) || n.push(`${o.label} is still there`);
|
|
154
|
+
const u = (o) => w(o.field, o.group_key), f = new Map(r.placements.map((o) => [u(o), o]));
|
|
155
|
+
for (const o of t.placements) {
|
|
156
|
+
const i = f.get(u(o));
|
|
157
|
+
if (!i) {
|
|
158
|
+
n.push(`${o.field} is missing from ${o.group_key ?? "Ungrouped"}`);
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
for (const a of E)
|
|
162
|
+
m(i[a], o[a]) || n.push(`${o.field}: ${a} differs`);
|
|
163
|
+
}
|
|
164
|
+
const k = new Set(t.placements.map(u));
|
|
165
|
+
for (const o of r.placements)
|
|
166
|
+
k.has(u(o)) || n.push(`${o.field} is still in ${o.group_key ?? "Ungrouped"}`);
|
|
167
|
+
for (const o of new Set(t.placements.map((i) => i.group_key)))
|
|
168
|
+
v(r, o).join("\0") !== v(t, o).join("\0") && n.push(`The order in ${o ?? "Ungrouped"} differs`);
|
|
169
|
+
for (const o of [null, ...t.groups.filter((i) => i.type === "container").map((i) => i.key)])
|
|
170
|
+
b(r, o).join("\0") !== b(t, o).join("\0") && n.push(`The order of ${o ?? "the form"} differs`);
|
|
171
|
+
return [...new Set(n)];
|
|
172
|
+
}
|
|
173
|
+
export {
|
|
174
|
+
R as differences,
|
|
175
|
+
H as planFileOps
|
|
176
|
+
};
|
|
@@ -1,61 +1,95 @@
|
|
|
1
|
+
var d = Object.defineProperty;
|
|
2
|
+
var p = (e, t, a) => t in e ? d(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a;
|
|
3
|
+
var l = (e, t, a) => p(e, typeof t != "symbol" ? t + "" : t, a);
|
|
1
4
|
async function r(e) {
|
|
2
|
-
let
|
|
5
|
+
let t = `Something went wrong (${e.status})`;
|
|
3
6
|
try {
|
|
4
|
-
const
|
|
5
|
-
|
|
7
|
+
const a = await e.json();
|
|
8
|
+
a.error && (t = a.error);
|
|
6
9
|
} catch {
|
|
7
10
|
}
|
|
8
|
-
return new Error(
|
|
11
|
+
return new Error(t);
|
|
9
12
|
}
|
|
10
|
-
function
|
|
11
|
-
const
|
|
12
|
-
return (
|
|
13
|
+
function i(e, t) {
|
|
14
|
+
const a = /filename="([^"]+)"/.exec(e.headers.get("Content-Disposition") ?? "");
|
|
15
|
+
return (a == null ? void 0 : a[1]) ?? t;
|
|
13
16
|
}
|
|
14
|
-
async function
|
|
15
|
-
const o = await fetch(`${e.apiBase}${
|
|
17
|
+
async function s(e, t, a) {
|
|
18
|
+
const o = await fetch(`${e.apiBase}${t}`, {
|
|
16
19
|
headers: e.authHeaders,
|
|
17
20
|
credentials: e.credentials
|
|
18
21
|
});
|
|
19
22
|
if (!o.ok) throw await r(o);
|
|
20
|
-
return { blob: await o.blob(), filename:
|
|
23
|
+
return { blob: await o.blob(), filename: i(o, a) };
|
|
21
24
|
}
|
|
22
|
-
async function
|
|
23
|
-
const n = await fetch(`${e.apiBase}${
|
|
25
|
+
async function c(e, t, a, o) {
|
|
26
|
+
const n = await fetch(`${e.apiBase}${t}`, {
|
|
24
27
|
method: "POST",
|
|
25
28
|
headers: { ...e.authHeaders, "Content-Type": "application/json" },
|
|
26
29
|
credentials: e.credentials,
|
|
27
|
-
body: JSON.stringify(
|
|
30
|
+
body: JSON.stringify(a)
|
|
28
31
|
});
|
|
29
32
|
if (!n.ok) throw await r(n);
|
|
30
|
-
return { blob: await n.blob(), filename:
|
|
31
|
-
}
|
|
32
|
-
const
|
|
33
|
-
async function
|
|
34
|
-
const
|
|
35
|
-
let
|
|
36
|
-
for (let o = 0; o <
|
|
37
|
-
|
|
38
|
-
return btoa(
|
|
39
|
-
}
|
|
40
|
-
async function
|
|
41
|
-
const
|
|
33
|
+
return { blob: await n.blob(), filename: i(n, o) };
|
|
34
|
+
}
|
|
35
|
+
const w = (e, t) => s(e, `/collection-layouts/${t}/spreadsheet-template`, "template.xlsx"), f = (e, t, a = 5e3) => c(e, `/collection-layouts/${t}/spreadsheet-export`, { limit: a }, "records.xlsx"), b = (e, t) => s(e, `/collection-layouts/${t}/blank-form`, "blank-form.pdf"), m = (e, t, a) => c(e, "/collection-layouts/help-sheet/xlsx", { rows: t, name: a }, "help-text.xlsx");
|
|
36
|
+
async function u(e) {
|
|
37
|
+
const t = new Uint8Array(await e.arrayBuffer());
|
|
38
|
+
let a = "";
|
|
39
|
+
for (let o = 0; o < t.length; o += 32768)
|
|
40
|
+
a += String.fromCharCode(...t.subarray(o, o + 32768));
|
|
41
|
+
return btoa(a);
|
|
42
|
+
}
|
|
43
|
+
async function x(e, t) {
|
|
44
|
+
const a = await fetch(`${e.apiBase}/collection-layouts/help-sheet/parse`, {
|
|
45
|
+
method: "POST",
|
|
46
|
+
headers: { ...e.authHeaders, "Content-Type": "application/json" },
|
|
47
|
+
credentials: e.credentials,
|
|
48
|
+
body: JSON.stringify({ file: await u(t) })
|
|
49
|
+
});
|
|
50
|
+
if (!a.ok) throw await r(a);
|
|
51
|
+
return (await a.json()).data.rows;
|
|
52
|
+
}
|
|
53
|
+
const $ = (e, t) => s(e, `/collection-layouts/${t}/file?download=1`, "layout.layout.yaml");
|
|
54
|
+
class y extends Error {
|
|
55
|
+
constructor(a, o) {
|
|
56
|
+
super(a);
|
|
57
|
+
l(this, "problems");
|
|
58
|
+
this.problems = o;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
async function S(e, t, a) {
|
|
62
|
+
const o = await fetch(`${e.apiBase}/collection-layouts/${t}/file/parse`, {
|
|
42
63
|
method: "POST",
|
|
43
64
|
headers: { ...e.authHeaders, "Content-Type": "application/json" },
|
|
44
65
|
credentials: e.credentials,
|
|
45
|
-
body: JSON.stringify({
|
|
66
|
+
body: JSON.stringify({ text: a })
|
|
46
67
|
});
|
|
47
|
-
if (!
|
|
48
|
-
|
|
68
|
+
if (!o.ok) {
|
|
69
|
+
let n = {};
|
|
70
|
+
try {
|
|
71
|
+
n = await o.json();
|
|
72
|
+
} catch {
|
|
73
|
+
}
|
|
74
|
+
throw new y(
|
|
75
|
+
n.error ?? `Something went wrong (${o.status})`,
|
|
76
|
+
Array.isArray(n.problems) ? n.problems : []
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
return (await o.json()).data;
|
|
49
80
|
}
|
|
50
|
-
function
|
|
51
|
-
const
|
|
52
|
-
o.href =
|
|
81
|
+
function j({ blob: e, filename: t }) {
|
|
82
|
+
const a = URL.createObjectURL(e), o = document.createElement("a");
|
|
83
|
+
o.href = a, o.download = t, document.body.appendChild(o), o.click(), o.remove(), setTimeout(() => URL.revokeObjectURL(a), 1e3);
|
|
53
84
|
}
|
|
54
85
|
export {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
f as
|
|
60
|
-
w as
|
|
86
|
+
y as LayoutFileProblems,
|
|
87
|
+
b as downloadBlankForm,
|
|
88
|
+
m as downloadHelpSheet,
|
|
89
|
+
$ as downloadLayoutFile,
|
|
90
|
+
f as downloadRecords,
|
|
91
|
+
w as downloadTemplate,
|
|
92
|
+
x as parseHelpSheetFile,
|
|
93
|
+
S as parseLayoutFile,
|
|
94
|
+
j as saveFile
|
|
61
95
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { choiceLabel as d, titleCase as
|
|
2
|
-
const
|
|
1
|
+
import { choiceLabel as d, titleCase as y } from "../../../lib/utils.js";
|
|
2
|
+
const _ = /^\{\{\s*([A-Za-z_][A-Za-z0-9_]*)\s*\}\}(?:\s*([*+])\s*(-?\d+(?:\.\d+)?))?$/, $ = {
|
|
3
3
|
gt: "is over",
|
|
4
4
|
gte: "is at least",
|
|
5
5
|
lt: "is under",
|
|
@@ -39,7 +39,7 @@ function v(t) {
|
|
|
39
39
|
function x(t, e) {
|
|
40
40
|
var n;
|
|
41
41
|
const o = (n = e.get(t)) == null ? void 0 : n.label;
|
|
42
|
-
return o != null && o.trim() ? o.trim() :
|
|
42
|
+
return o != null && o.trim() ? o.trim() : y(t);
|
|
43
43
|
}
|
|
44
44
|
function A(t) {
|
|
45
45
|
return typeof t == "boolean" ? t : t === "true" ? !0 : t === "false" ? !1 : null;
|
|
@@ -52,7 +52,7 @@ function j(t, e, o, n) {
|
|
|
52
52
|
var r;
|
|
53
53
|
if (e == null || e === "") return "empty";
|
|
54
54
|
if (typeof e == "string") {
|
|
55
|
-
const i =
|
|
55
|
+
const i = _.exec(e.trim());
|
|
56
56
|
if (i) {
|
|
57
57
|
const c = x(i[1], o);
|
|
58
58
|
return i[2] ? `${c} ${i[2] === "*" ? "×" : "+"} ${i[3]}` : c;
|
|
@@ -70,17 +70,17 @@ function E(t, e, o) {
|
|
|
70
70
|
if (r && t.op === "neq") return [s, { text: " is set" }];
|
|
71
71
|
const i = t.op === "neq" ? [{ text: " (or empty)" }] : [], u = ((l = e.get(t.field)) == null ? void 0 : l.type) === "boolean" || typeof t.value == "boolean" ? A(t.value) : null;
|
|
72
72
|
if (u !== null && (t.op === "eq" || t.op === "neq")) {
|
|
73
|
-
const h = t.op === "eq" ? u : !u, { verb: p, name: a } = S(n),
|
|
74
|
-
return [{ text: `${p} ` }, { text: h ? a :
|
|
73
|
+
const h = t.op === "eq" ? u : !u, { verb: p, name: a } = S(n), b = p === "has" ? `no ${a}` : `not ${a}`;
|
|
74
|
+
return [{ text: `${p} ` }, { text: h ? a : b, strong: !0 }, ...i];
|
|
75
75
|
}
|
|
76
76
|
const f = j(t.field, t.value, e, o);
|
|
77
77
|
if (t.op === "eq") return [{ text: `${n} is ` }, { text: f, strong: !0 }];
|
|
78
78
|
if (t.op === "neq")
|
|
79
79
|
return [{ text: `${n} is not ` }, { text: f, strong: !0 }, ...i];
|
|
80
|
-
const
|
|
81
|
-
return [{ text: `${n} ${
|
|
80
|
+
const g = $[t.op] ?? t.op;
|
|
81
|
+
return [{ text: `${n} ${g} ` }, { text: f, strong: !0 }];
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function m(t) {
|
|
84
84
|
const e = [];
|
|
85
85
|
return t.forEach((o, n) => {
|
|
86
86
|
n > 0 && e.push({ text: " and " }), e.push(...o);
|
|
@@ -89,12 +89,12 @@ function g(t) {
|
|
|
89
89
|
function L(t, e, o) {
|
|
90
90
|
if (!(t != null && t.length)) return [];
|
|
91
91
|
const n = new Map(e.map((s) => [s.field, s]));
|
|
92
|
-
return
|
|
92
|
+
return m(t.map((s) => E(s, n, o)));
|
|
93
93
|
}
|
|
94
94
|
function O(t) {
|
|
95
95
|
return t.length ? [
|
|
96
96
|
{ text: "for " },
|
|
97
|
-
...
|
|
97
|
+
...m(t.map((e) => [{ text: e, strong: !0 }])),
|
|
98
98
|
{ text: " only" }
|
|
99
99
|
] : [];
|
|
100
100
|
}
|
|
@@ -118,6 +118,11 @@ function z(t, e, o) {
|
|
|
118
118
|
{ text: "on small screens, instead of " },
|
|
119
119
|
{ text: t.phone_of_name ?? "its form", strong: !0 }
|
|
120
120
|
];
|
|
121
|
+
case "tablet":
|
|
122
|
+
return [
|
|
123
|
+
{ text: "on tablet-width screens, instead of " },
|
|
124
|
+
{ text: t.tablet_of_name ?? "its form", strong: !0 }
|
|
125
|
+
];
|
|
121
126
|
default:
|
|
122
127
|
return [];
|
|
123
128
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import "lucide-react";
|
|
3
|
-
import { Fragment as
|
|
4
|
-
import { cn as
|
|
3
|
+
import { Fragment as i } from "react";
|
|
4
|
+
import { cn as l } from "../../../lib/utils.js";
|
|
5
5
|
import { describeReason as d } from "./describe-conditions.js";
|
|
6
6
|
const o = {
|
|
7
7
|
summary: "Read mode",
|
|
@@ -17,7 +17,7 @@ function c({ segs: e, muted: n }) {
|
|
|
17
17
|
/* @__PURE__ */ a("b", { className: "font-semibold text-slate-900 dark:text-foreground", children: r.text }, t)
|
|
18
18
|
) : (
|
|
19
19
|
// biome-ignore lint/suspicious/noArrayIndexKey: segments are positional
|
|
20
|
-
/* @__PURE__ */ a(
|
|
20
|
+
/* @__PURE__ */ a(i, { children: r.text }, t)
|
|
21
21
|
)
|
|
22
22
|
) }) : /* @__PURE__ */ a("span", { className: "text-slate-400 dark:text-muted-foreground", children: "—" });
|
|
23
23
|
}
|
|
@@ -25,7 +25,7 @@ function b({ tone: e, children: n }) {
|
|
|
25
25
|
return /* @__PURE__ */ a(
|
|
26
26
|
"span",
|
|
27
27
|
{
|
|
28
|
-
className:
|
|
28
|
+
className: l(
|
|
29
29
|
"inline-flex items-center whitespace-nowrap rounded-full px-2 py-px text-[11px] font-semibold",
|
|
30
30
|
e === "default" && "bg-nvr-cyan/15 text-[#0089ad] dark:text-nvr-cyan",
|
|
31
31
|
e === "rule" && "bg-indigo-50 text-indigo-700 dark:bg-indigo-500/15 dark:text-indigo-300",
|
|
@@ -38,7 +38,7 @@ function b({ tone: e, children: n }) {
|
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
40
|
function k(e) {
|
|
41
|
-
return e.section === "forms" ? e.is_default ? { tone: "default", text: "default" } : e.reason.kind === "record_rule" ? { tone: "rule", text: "rule" } : e.reason.kind === "role" ? { tone: "role", text: "role" } : e.reason.kind === "ab" ? { tone: "role", text: "A/B" } : e.reason.kind === "phone" ? { tone: "view", text: "phone" } : null : e.section === "link_only" ? { tone: "link", text: "link only" } : e.section === "other_views" && e.is_default ? { tone: "default", text: "default" } : null;
|
|
41
|
+
return e.section === "forms" ? e.is_default ? { tone: "default", text: "default" } : e.reason.kind === "record_rule" ? { tone: "rule", text: "rule" } : e.reason.kind === "role" ? { tone: "role", text: "role" } : e.reason.kind === "ab" ? { tone: "role", text: "A/B" } : e.reason.kind === "phone" ? { tone: "view", text: "phone" } : e.reason.kind === "tablet" ? { tone: "view", text: "tablet" } : null : e.section === "link_only" ? { tone: "link", text: "link only" } : e.section === "other_views" && e.is_default ? { tone: "default", text: "default" } : null;
|
|
42
42
|
}
|
|
43
43
|
function p(e, n, r) {
|
|
44
44
|
switch (e.section) {
|
|
@@ -42,7 +42,7 @@ function T({
|
|
|
42
42
|
{
|
|
43
43
|
"data-panel-body": "",
|
|
44
44
|
...n ? { role: "tabpanel", id: n.id, "aria-labelledby": n.labelledBy } : {},
|
|
45
|
-
className: d("min-h-0 flex-1 space-y-5 overflow-y-auto px-4 pb-8 pt-4", r),
|
|
45
|
+
className: d("relative min-h-0 flex-1 space-y-5 overflow-y-auto px-4 pb-8 pt-4", r),
|
|
46
46
|
children: e
|
|
47
47
|
}
|
|
48
48
|
);
|