simpler-forms 0.1.0-alpha.1 → 0.1.0
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/README.md +221 -76
- package/dist/src/casing.d.ts +43 -0
- package/dist/src/casing.js +146 -0
- package/dist/src/casing.js.map +1 -0
- package/dist/src/decorators/index.d.ts +1 -0
- package/dist/src/decorators/index.js +1 -0
- package/dist/src/decorators/index.js.map +1 -1
- package/dist/src/decorators/mapping.d.ts +11 -0
- package/dist/src/decorators/mapping.js +22 -0
- package/dist/src/decorators/mapping.js.map +1 -0
- package/dist/src/decorators/meta.d.ts +13 -3
- package/dist/src/decorators/meta.js +31 -4
- package/dist/src/decorators/meta.js.map +1 -1
- package/dist/src/decorators/ui.d.ts +14 -12
- package/dist/src/decorators/ui.js +20 -43
- package/dist/src/decorators/ui.js.map +1 -1
- package/dist/src/emitter.d.ts +8 -0
- package/dist/src/emitter.js +48 -13
- package/dist/src/emitter.js.map +1 -1
- package/dist/src/emitters/block-ui.d.ts +14 -3
- package/dist/src/emitters/block-ui.js +81 -119
- package/dist/src/emitters/block-ui.js.map +1 -1
- package/dist/src/emitters/layout-ui.d.ts +12 -0
- package/dist/src/emitters/layout-ui.js +225 -0
- package/dist/src/emitters/layout-ui.js.map +1 -0
- package/dist/src/emitters/overlay.d.ts +3 -6
- package/dist/src/emitters/overlay.js +3 -86
- package/dist/src/emitters/overlay.js.map +1 -1
- package/dist/src/forms.d.ts +23 -0
- package/dist/src/forms.js +54 -0
- package/dist/src/forms.js.map +1 -0
- package/dist/src/index.d.ts +15 -6
- package/dist/src/index.js +12 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/layout.d.ts +50 -0
- package/dist/src/layout.js +397 -0
- package/dist/src/layout.js.map +1 -0
- package/dist/src/lib.d.ts +485 -39
- package/dist/src/lib.js +215 -15
- package/dist/src/lib.js.map +1 -1
- package/dist/src/linter.js +2 -41
- package/dist/src/linter.js.map +1 -1
- package/dist/src/mapping-from.d.ts +20 -0
- package/dist/src/mapping-from.js +149 -0
- package/dist/src/mapping-from.js.map +1 -0
- package/dist/src/mapping.d.ts +58 -0
- package/dist/src/mapping.js +209 -0
- package/dist/src/mapping.js.map +1 -0
- package/dist/src/model.d.ts +69 -17
- package/dist/src/model.js +65 -19
- package/dist/src/model.js.map +1 -1
- package/dist/src/public.d.ts +20 -4
- package/dist/src/public.js +28 -4
- package/dist/src/public.js.map +1 -1
- package/dist/src/validate.d.ts +2 -1
- package/dist/src/validate.js +180 -58
- package/dist/src/validate.js.map +1 -1
- package/lib/main.tsp +1 -0
- package/lib/mapping.tsp +71 -0
- package/lib/meta.tsp +23 -4
- package/lib/types.tsp +13 -65
- package/lib/ui.tsp +34 -17
- package/package.json +7 -1
- package/src/casing.ts +172 -0
- package/src/decorators/index.ts +1 -0
- package/src/decorators/mapping.ts +57 -0
- package/src/decorators/meta.ts +50 -11
- package/src/decorators/ui.ts +43 -59
- package/src/emitter.ts +59 -13
- package/src/emitters/block-ui.ts +83 -135
- package/src/emitters/layout-ui.ts +280 -0
- package/src/emitters/overlay.ts +3 -103
- package/src/forms.ts +82 -0
- package/src/index.ts +12 -3
- package/src/layout.ts +592 -0
- package/src/lib.ts +221 -15
- package/src/linter.ts +1 -42
- package/src/mapping-from.ts +193 -0
- package/src/mapping.ts +351 -0
- package/src/model.ts +170 -37
- package/src/public.ts +50 -6
- package/src/validate.ts +188 -59
- package/dist/src/emitters/override-condition.d.ts +0 -12
- package/dist/src/emitters/override-condition.js +0 -25
- package/dist/src/emitters/override-condition.js.map +0 -1
- package/src/emitters/override-condition.ts +0 -37
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { getDoc } from "@typespec/compiler";
|
|
2
|
-
import { childBlock, modelLabel, modelOrder,
|
|
3
|
-
import { normalizedOverrideEnabledWhen } from "./override-condition.js";
|
|
2
|
+
import { childBlock, modelLabel, modelOrder, modelProperties, propEnabledWhen, propLabel, propOmit, propReadOnly, propReadOnlyWhen, propVisibleWhen, propWidget, readBlock, } from "../model.js";
|
|
4
3
|
/** An answered value: not null, not blank, not an empty list. */
|
|
5
4
|
const answeredSchema = {
|
|
6
5
|
not: {
|
|
@@ -26,7 +25,7 @@ const rootConditionSchema = (condition) => {
|
|
|
26
25
|
}
|
|
27
26
|
return schema;
|
|
28
27
|
};
|
|
29
|
-
const jsonFormsCondition = (condition) => condition.operator === "any"
|
|
28
|
+
export const jsonFormsCondition = (condition) => condition.operator === "any"
|
|
30
29
|
? {
|
|
31
30
|
scope: "#",
|
|
32
31
|
schema: { anyOf: condition.predicates.map(rootConditionSchema) },
|
|
@@ -39,49 +38,6 @@ const jsonFormsCondition = (condition) => condition.operator === "any"
|
|
|
39
38
|
? { failWhenUndefined: true }
|
|
40
39
|
: {}),
|
|
41
40
|
};
|
|
42
|
-
/** Convert a canonical JSON Forms scope into the dotted path addressed by @UI.overrides. */
|
|
43
|
-
const dataPathFromScope = (scope) => {
|
|
44
|
-
if (!scope.startsWith("#/properties/"))
|
|
45
|
-
return undefined;
|
|
46
|
-
const tokens = scope.slice(2).split("/");
|
|
47
|
-
const path = [];
|
|
48
|
-
for (let index = 0; index < tokens.length;) {
|
|
49
|
-
if (tokens[index] !== "properties" || !tokens[index + 1])
|
|
50
|
-
return undefined;
|
|
51
|
-
path.push(tokens[index + 1]);
|
|
52
|
-
index += 2;
|
|
53
|
-
if (tokens[index] === "items")
|
|
54
|
-
index += 1;
|
|
55
|
-
}
|
|
56
|
-
return path.join(".");
|
|
57
|
-
};
|
|
58
|
-
/** Emit the portable JSON Forms equivalent of a form-scoped enabledWhen override. */
|
|
59
|
-
const overrideEnabledRule = (override) => {
|
|
60
|
-
const condition = normalizedOverrideEnabledWhen(override);
|
|
61
|
-
if (!condition)
|
|
62
|
-
return undefined;
|
|
63
|
-
const scope = `#/${condition.sourcePath.map((step) => `properties/${step}`).join("/")}`;
|
|
64
|
-
const schema = condition.operator === "in"
|
|
65
|
-
? { enum: condition.values }
|
|
66
|
-
: { const: condition.value };
|
|
67
|
-
return { effect: "ENABLE", condition: { scope, schema } };
|
|
68
|
-
};
|
|
69
|
-
/** Apply occurrence-specific behavior after recursively composing canonical child UI trees. */
|
|
70
|
-
const applyOverrides = (node, overrides) => {
|
|
71
|
-
const out = { ...node };
|
|
72
|
-
if (typeof node.scope === "string") {
|
|
73
|
-
const path = dataPathFromScope(node.scope);
|
|
74
|
-
const rule = path ? overrideEnabledRule(overrides[path] ?? {}) : undefined;
|
|
75
|
-
if (rule && node.rule) {
|
|
76
|
-
throw new Error(`@UI.overrides enabledWhen collides with intrinsic UI behavior at ${path}`);
|
|
77
|
-
}
|
|
78
|
-
if (rule)
|
|
79
|
-
out.rule = rule;
|
|
80
|
-
}
|
|
81
|
-
if (node.elements)
|
|
82
|
-
out.elements = node.elements.map((child) => applyOverrides(child, overrides));
|
|
83
|
-
return out;
|
|
84
|
-
};
|
|
85
41
|
/** Re-prefix every Control scope so a child's tree sits under `propName`. */
|
|
86
42
|
export function rescopeUi(node, propName) {
|
|
87
43
|
const out = { ...node };
|
|
@@ -139,12 +95,11 @@ function layoutProps(program, model) {
|
|
|
139
95
|
return out;
|
|
140
96
|
}
|
|
141
97
|
/** A model laid out as a block would be, whether or not it is one. */
|
|
142
|
-
const layoutSource = (program, model) => readBlock(program, model) ?? {
|
|
98
|
+
export const layoutSource = (program, model) => readBlock(program, model) ?? {
|
|
143
99
|
model,
|
|
144
100
|
scalar: false,
|
|
145
101
|
label: modelLabel(program, model),
|
|
146
102
|
doc: getDoc(program, model),
|
|
147
|
-
overrides: modelOverrides(program, model),
|
|
148
103
|
};
|
|
149
104
|
/**
|
|
150
105
|
* The layout of one entry of a repeated property, which JSON Forms reads from a list
|
|
@@ -164,98 +119,105 @@ function itemDetail(program, prop) {
|
|
|
164
119
|
return undefined;
|
|
165
120
|
return emitBlockUi(program, layoutSource(program, item));
|
|
166
121
|
}
|
|
122
|
+
/** The model a property's fields lay out from: a composed question, or a model of the form's own. */
|
|
123
|
+
function fieldSource(program, prop) {
|
|
124
|
+
const child = childBlock(program, prop);
|
|
125
|
+
if (child)
|
|
126
|
+
return child.scalar ? undefined : child;
|
|
127
|
+
const type = prop.type;
|
|
128
|
+
if (type.kind !== "Model" || type.indexer)
|
|
129
|
+
return undefined;
|
|
130
|
+
return layoutSource(program, type);
|
|
131
|
+
}
|
|
167
132
|
/**
|
|
168
|
-
*
|
|
169
|
-
*
|
|
133
|
+
* One property as its model lays it out, scoped to that model: a Group of a composed
|
|
134
|
+
* question's fields, or of a model the form declares itself, or a Control.
|
|
135
|
+
*
|
|
136
|
+
* A Group takes the property's label before the question's, and the property's doc comment
|
|
137
|
+
* as its description, so a question asked in several roles is told apart by role.
|
|
170
138
|
*/
|
|
171
|
-
export function
|
|
172
|
-
|
|
173
|
-
if (
|
|
174
|
-
const
|
|
175
|
-
if (block.label)
|
|
176
|
-
node.label = block.label;
|
|
177
|
-
return node;
|
|
178
|
-
}
|
|
179
|
-
const nodeForProperty = (prop) => {
|
|
180
|
-
const child = childBlock(program, prop);
|
|
181
|
-
if (child && !child.scalar) {
|
|
182
|
-
return rescopeUi(emitBlockUi(program, child), prop.name);
|
|
183
|
-
}
|
|
184
|
-
const node = {
|
|
185
|
-
type: "Control",
|
|
186
|
-
scope: `#/properties/${prop.name}`,
|
|
187
|
-
};
|
|
139
|
+
export function propertyUi(program, prop) {
|
|
140
|
+
const child = fieldSource(program, prop);
|
|
141
|
+
if (child) {
|
|
142
|
+
const group = rescopeUi(emitBlockUi(program, child), prop.name);
|
|
188
143
|
const label = propLabel(program, prop);
|
|
189
144
|
if (label)
|
|
190
|
-
|
|
191
|
-
const
|
|
192
|
-
if (detail)
|
|
193
|
-
node.options = { ...(node.options ?? {}), detail };
|
|
145
|
+
group.label = label;
|
|
146
|
+
const description = getDoc(program, prop);
|
|
194
147
|
const widget = propWidget(program, prop);
|
|
195
|
-
if (widget)
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
148
|
+
if (description || widget)
|
|
149
|
+
group.options = {
|
|
150
|
+
...(group.options ?? {}),
|
|
151
|
+
...(description ? { description } : {}),
|
|
152
|
+
...(widget ? { widget } : {}),
|
|
153
|
+
};
|
|
154
|
+
return group;
|
|
155
|
+
}
|
|
156
|
+
const node = {
|
|
157
|
+
type: "Control",
|
|
158
|
+
scope: `#/properties/${prop.name}`,
|
|
159
|
+
};
|
|
160
|
+
const label = propLabel(program, prop);
|
|
161
|
+
if (label)
|
|
162
|
+
node.label = label;
|
|
163
|
+
const detail = itemDetail(program, prop);
|
|
164
|
+
if (detail)
|
|
165
|
+
node.options = { ...(node.options ?? {}), detail };
|
|
166
|
+
const widget = propWidget(program, prop);
|
|
167
|
+
if (widget)
|
|
168
|
+
node.options = { ...(node.options ?? {}), widget };
|
|
169
|
+
if (propReadOnly(program, prop))
|
|
170
|
+
node.options = { ...(node.options ?? {}), readonly: true };
|
|
171
|
+
const conds = propVisibleWhen(program, prop);
|
|
172
|
+
if (conds.length === 1) {
|
|
173
|
+
const c = conds[0];
|
|
174
|
+
node.rule = {
|
|
175
|
+
effect: "SHOW",
|
|
176
|
+
condition: jsonFormsCondition(c),
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
const enabled = propEnabledWhen(program, prop);
|
|
181
|
+
if (enabled.length === 1) {
|
|
182
|
+
const c = enabled[0];
|
|
202
183
|
node.rule = {
|
|
203
|
-
effect: "
|
|
184
|
+
effect: "ENABLE",
|
|
204
185
|
condition: jsonFormsCondition(c),
|
|
205
186
|
};
|
|
206
187
|
}
|
|
207
188
|
else {
|
|
208
|
-
const
|
|
209
|
-
if (
|
|
210
|
-
const c =
|
|
189
|
+
const readOnly = propReadOnlyWhen(program, prop);
|
|
190
|
+
if (readOnly.length === 1) {
|
|
191
|
+
const c = readOnly[0];
|
|
211
192
|
node.rule = {
|
|
212
|
-
effect: "
|
|
193
|
+
effect: "DISABLE",
|
|
213
194
|
condition: jsonFormsCondition(c),
|
|
214
195
|
};
|
|
215
196
|
}
|
|
216
|
-
else {
|
|
217
|
-
const readOnly = propReadOnlyWhen(program, prop);
|
|
218
|
-
if (readOnly.length === 1) {
|
|
219
|
-
const c = readOnly[0];
|
|
220
|
-
node.rule = {
|
|
221
|
-
effect: "DISABLE",
|
|
222
|
-
condition: jsonFormsCondition(c),
|
|
223
|
-
};
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
197
|
}
|
|
227
|
-
return node;
|
|
228
|
-
};
|
|
229
|
-
const props = block.model.kind === "Model" ? layoutProps(program, block.model) : [];
|
|
230
|
-
const elements = [];
|
|
231
|
-
const documentedStaticSections = block.sections
|
|
232
|
-
? [...block.sections.members.values()].filter((member) => getDoc(program, member) &&
|
|
233
|
-
!props.some((prop) => propSection(program, prop)?.name === member.name))
|
|
234
|
-
: [];
|
|
235
|
-
if (documentedStaticSections.length && block.sections) {
|
|
236
|
-
const emitted = new Set();
|
|
237
|
-
for (const member of block.sections.members.values()) {
|
|
238
|
-
const description = getDoc(program, member);
|
|
239
|
-
const members = props.filter((prop) => propSection(program, prop)?.name === member.name);
|
|
240
|
-
if (!members.length && description)
|
|
241
|
-
elements.push({ type: "Label", text: description });
|
|
242
|
-
for (const prop of members) {
|
|
243
|
-
elements.push(nodeForProperty(prop));
|
|
244
|
-
emitted.add(prop.name);
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
for (const prop of props)
|
|
248
|
-
if (!emitted.has(prop.name))
|
|
249
|
-
elements.push(nodeForProperty(prop));
|
|
250
198
|
}
|
|
251
|
-
|
|
252
|
-
|
|
199
|
+
return node;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* The canonical UI artifact for one block. Scopes are relative to this block's own
|
|
203
|
+
* root, so it renders standalone; children are incorporated and re-scoped.
|
|
204
|
+
*/
|
|
205
|
+
export function emitBlockUi(program, block) {
|
|
206
|
+
// A single-value question renders as one Control at its own root.
|
|
207
|
+
if (block.scalar) {
|
|
208
|
+
const node = { type: "Control", scope: "#" };
|
|
209
|
+
if (block.label)
|
|
210
|
+
node.label = block.label;
|
|
211
|
+
return node;
|
|
253
212
|
}
|
|
213
|
+
const nodeForProperty = (prop) => propertyUi(program, prop);
|
|
214
|
+
const props = block.model.kind === "Model" ? layoutProps(program, block.model) : [];
|
|
215
|
+
const elements = props.map(nodeForProperty);
|
|
254
216
|
const group = { type: "Group", elements };
|
|
255
217
|
if (block.label)
|
|
256
218
|
group.label = block.label;
|
|
257
219
|
else if (block.doc)
|
|
258
220
|
group.label = block.doc;
|
|
259
|
-
return
|
|
221
|
+
return group;
|
|
260
222
|
}
|
|
261
223
|
//# sourceMappingURL=block-ui.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block-ui.js","sourceRoot":"","sources":["../../../src/emitters/block-ui.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAIL,UAAU,EACV,UAAU,EACV,UAAU,EACV,cAAc,EACd,eAAe,EACf,eAAe,EACf,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,UAAU,EACV,SAAS,GACV,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AAExE,iEAAiE;AACjE,MAAM,cAAc,GAAG;IACrB,GAAG,EAAE;QACH,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;KACzE;CACF,CAAC;AAEF,MAAM,eAAe,GAAG,CACtB,SAA0B,EACD,EAAE,CAC3B,SAAS,CAAC,QAAQ,KAAK,IAAI;IACzB,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,MAAM,EAAE;IAC5B,CAAC,CAAC,SAAS,CAA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AAmB,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAE3E,MAAM,KAAK,GACT,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACxE,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IAE5C,MAAM,KAAK,GAAW,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;IAClD,IAAI,KAAK,CAAC,KAAK;QAAE,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;SACtC,IAAI,KAAK,CAAC,GAAG;QAAE,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC;IAC5C,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Diagnostic, Program } from "@typespec/compiler";
|
|
2
|
+
import { type ResolvedLayout } from "../layout.js";
|
|
3
|
+
import { type UiNode } from "./block-ui.js";
|
|
4
|
+
/**
|
|
5
|
+
* The JSON Forms UI for a layout. Each section is a top-level labelled Group. A field is laid
|
|
6
|
+
* out as its model lays it out, less whatever the layout places elsewhere or omits, with the
|
|
7
|
+
* entry's label, help text, widget and condition on top.
|
|
8
|
+
*/
|
|
9
|
+
export declare function emitLayoutUi(program: Program, layout: ResolvedLayout): {
|
|
10
|
+
ui: UiNode;
|
|
11
|
+
diagnostics: Diagnostic[];
|
|
12
|
+
};
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { getDoc } from "@typespec/compiler";
|
|
2
|
+
import { createDiagnostic } from "../lib.js";
|
|
3
|
+
import { behind, isList, } from "../layout.js";
|
|
4
|
+
import { modelLabel, propHelpText, propLabel, propWidget, readBlock, } from "../model.js";
|
|
5
|
+
import { emitBlockUi, jsonFormsCondition, layoutSource, propertyUi, rescopeUi, } from "./block-ui.js";
|
|
6
|
+
const key = (path) => path.join(".");
|
|
7
|
+
const emitted = new WeakMap();
|
|
8
|
+
/**
|
|
9
|
+
* The JSON Forms UI for a layout. Each section is a top-level labelled Group. A field is laid
|
|
10
|
+
* out as its model lays it out, less whatever the layout places elsewhere or omits, with the
|
|
11
|
+
* entry's label, help text, widget and condition on top.
|
|
12
|
+
*/
|
|
13
|
+
export function emitLayoutUi(program, layout) {
|
|
14
|
+
let result = emitted.get(layout);
|
|
15
|
+
if (!result)
|
|
16
|
+
emitted.set(layout, (result = build(program, layout)));
|
|
17
|
+
return result;
|
|
18
|
+
}
|
|
19
|
+
function build(program, layout) {
|
|
20
|
+
const excluded = [...layout.placed, ...layout.omitted];
|
|
21
|
+
/** What is placed elsewhere or omitted from inside the field at `path`. */
|
|
22
|
+
const excludedUnder = (path) => excluded.filter((k) => k.startsWith(`${key(path)}.`));
|
|
23
|
+
const help = (entry) => propHelpText(program, entry) ?? getDoc(program, entry);
|
|
24
|
+
/** Apply what an entry says about how its field is presented. */
|
|
25
|
+
const present = (ui, node, fallbackLabel) => {
|
|
26
|
+
const out = { ...ui };
|
|
27
|
+
const label = propLabel(program, node.entry) ?? fallbackLabel;
|
|
28
|
+
if (label)
|
|
29
|
+
out.label = label;
|
|
30
|
+
const description = help(node.entry);
|
|
31
|
+
const widget = propWidget(program, node.entry);
|
|
32
|
+
if (description || widget)
|
|
33
|
+
out.options = {
|
|
34
|
+
...(out.options ?? {}),
|
|
35
|
+
...(description ? { description } : {}),
|
|
36
|
+
...(widget ? { widget } : {}),
|
|
37
|
+
};
|
|
38
|
+
// A layout's condition replaces the field's own for this occurrence.
|
|
39
|
+
if (node.condition)
|
|
40
|
+
out.rule = {
|
|
41
|
+
effect: node.condition.effect,
|
|
42
|
+
condition: jsonFormsCondition(node.condition.condition),
|
|
43
|
+
};
|
|
44
|
+
return out;
|
|
45
|
+
};
|
|
46
|
+
/** The fields of `node`'s type that no entry lists, in their model's order. */
|
|
47
|
+
const remaining = (node) => {
|
|
48
|
+
const inner = behind(node.prop.type);
|
|
49
|
+
if (!inner)
|
|
50
|
+
return [];
|
|
51
|
+
const list = isList(node.prop.type);
|
|
52
|
+
const base = list ? node.path : node.scopeBase;
|
|
53
|
+
const steps = list ? [] : node.path.slice(node.scopeBase.length);
|
|
54
|
+
const own = emitBlockUi(program, layoutSource(program, inner));
|
|
55
|
+
// A single-value question has no fields to lay out.
|
|
56
|
+
if (!own.elements)
|
|
57
|
+
return [];
|
|
58
|
+
return own.elements
|
|
59
|
+
.map((child) => rescopeAll(child, steps))
|
|
60
|
+
.map((child) => prune(child, base, excludedUnder(node.path)))
|
|
61
|
+
.filter((child) => !!child);
|
|
62
|
+
};
|
|
63
|
+
const fieldUi = (node) => {
|
|
64
|
+
const own = rescopeAll(propertyUi(program, node.prop), node.path.slice(node.scopeBase.length, -1));
|
|
65
|
+
let ui;
|
|
66
|
+
if (node.listed) {
|
|
67
|
+
const elements = [...node.listed.flatMap(nodeUi), ...remaining(node)];
|
|
68
|
+
if (isList(node.prop.type)) {
|
|
69
|
+
ui = {
|
|
70
|
+
...own,
|
|
71
|
+
options: {
|
|
72
|
+
...(own.options ?? {}),
|
|
73
|
+
detail: { type: "Group", elements },
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
else if (own.type === "Group") {
|
|
78
|
+
ui = { ...own, elements };
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
// A field that lays out as one Control becomes a Group once a layout lists entries in it.
|
|
82
|
+
const inner = behind(node.prop.type);
|
|
83
|
+
const label = propLabel(program, node.prop) ??
|
|
84
|
+
(inner ? modelLabel(program, inner) : undefined);
|
|
85
|
+
const description = getDoc(program, node.prop);
|
|
86
|
+
ui = {
|
|
87
|
+
type: "Group",
|
|
88
|
+
...(label ? { label } : {}),
|
|
89
|
+
elements,
|
|
90
|
+
...(description ? { options: { description } } : {}),
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
ui = prune(own, node.scopeBase, excludedUnder(node.path));
|
|
96
|
+
}
|
|
97
|
+
if (!ui)
|
|
98
|
+
return [];
|
|
99
|
+
ui = present(ui, node);
|
|
100
|
+
if (node.flatten && ui.type === "Group" && !isList(node.prop.type)) {
|
|
101
|
+
const rule = ui.rule;
|
|
102
|
+
return (ui.elements ?? []).map((child) => rule && !child.rule ? { ...child, rule } : child);
|
|
103
|
+
}
|
|
104
|
+
return [ui];
|
|
105
|
+
};
|
|
106
|
+
const nodeUi = (node) => node.kind === "field"
|
|
107
|
+
? fieldUi(node)
|
|
108
|
+
: [
|
|
109
|
+
present({ type: "Group", elements: node.children.flatMap(nodeUi) }, node, node.entry.name),
|
|
110
|
+
];
|
|
111
|
+
/** A section is always a labelled Group, so a renderer shows it as one. */
|
|
112
|
+
const sectionUi = (node) => {
|
|
113
|
+
const flat = node.kind === "field" ? { ...node, flatten: false } : node;
|
|
114
|
+
return nodeUi(flat).map((ui) => {
|
|
115
|
+
if (ui.type === "Group" && ui.label)
|
|
116
|
+
return ui;
|
|
117
|
+
if (ui.type === "Group")
|
|
118
|
+
return { ...ui, label: node.entry.name };
|
|
119
|
+
// The section carries the control's rule and description: they are about the section.
|
|
120
|
+
const { rule, ...control } = ui;
|
|
121
|
+
const { description, ...options } = control.options ?? {};
|
|
122
|
+
if (control.options)
|
|
123
|
+
if (Object.keys(options).length)
|
|
124
|
+
control.options = options;
|
|
125
|
+
else
|
|
126
|
+
delete control.options;
|
|
127
|
+
const label = propLabel(program, node.entry) ??
|
|
128
|
+
(node.kind === "field"
|
|
129
|
+
? (propLabel(program, node.prop) ?? node.prop.name)
|
|
130
|
+
: node.entry.name);
|
|
131
|
+
return {
|
|
132
|
+
type: "Group",
|
|
133
|
+
label,
|
|
134
|
+
elements: [control],
|
|
135
|
+
...(rule ? { rule } : {}),
|
|
136
|
+
...(description ? { options: { description } } : {}),
|
|
137
|
+
};
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
const block = readBlock(program, layout.presented);
|
|
141
|
+
const label = modelLabel(program, layout.layout) ?? block?.label ?? block?.doc;
|
|
142
|
+
const ui = {
|
|
143
|
+
type: "Group",
|
|
144
|
+
elements: layout.sections.flatMap(sectionUi),
|
|
145
|
+
...(label ? { label } : {}),
|
|
146
|
+
};
|
|
147
|
+
return { ui, diagnostics: duplicateLabels(layout, ui) };
|
|
148
|
+
}
|
|
149
|
+
/** Re-prefix a node's scopes with each of `steps`, outermost first. */
|
|
150
|
+
function rescopeAll(node, steps) {
|
|
151
|
+
return [...steps].reverse().reduce(rescopeUi, node);
|
|
152
|
+
}
|
|
153
|
+
/** The data path a Control's scope addresses, relative to its root. */
|
|
154
|
+
function dataPath(scope) {
|
|
155
|
+
const tokens = scope.replace(/^#\/?/, "").split("/").filter(Boolean);
|
|
156
|
+
const path = [];
|
|
157
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
158
|
+
if (tokens[i] === "properties" && tokens[i + 1])
|
|
159
|
+
path.push(tokens[++i]);
|
|
160
|
+
}
|
|
161
|
+
return path;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Drop every Control whose path is excluded, and any Group left empty by that. `base` is the
|
|
165
|
+
* path the node's scopes are relative to.
|
|
166
|
+
*/
|
|
167
|
+
function prune(node, base, excluded) {
|
|
168
|
+
if (!excluded.length)
|
|
169
|
+
return node;
|
|
170
|
+
const out = { ...node };
|
|
171
|
+
if (node.scope) {
|
|
172
|
+
const path = key([...base, ...dataPath(node.scope)]);
|
|
173
|
+
if (excluded.some((e) => path === e || path.startsWith(`${e}.`)))
|
|
174
|
+
return undefined;
|
|
175
|
+
const detail = node.options?.detail;
|
|
176
|
+
if (detail) {
|
|
177
|
+
const pruned = prune(detail, path ? path.split(".") : base, excluded);
|
|
178
|
+
out.options = {
|
|
179
|
+
...node.options,
|
|
180
|
+
detail: pruned ?? { ...detail, elements: [] },
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
if (node.elements) {
|
|
185
|
+
out.elements = node.elements
|
|
186
|
+
.map((child) => prune(child, base, excluded))
|
|
187
|
+
.filter((child) => !!child);
|
|
188
|
+
if (node.elements.length && !out.elements.length)
|
|
189
|
+
return undefined;
|
|
190
|
+
}
|
|
191
|
+
return out;
|
|
192
|
+
}
|
|
193
|
+
/** Sibling entries that render under one label, which an applicant cannot tell apart. */
|
|
194
|
+
function duplicateLabels(layout, ui) {
|
|
195
|
+
const out = [];
|
|
196
|
+
const name = (node) => node.label ?? (node.scope ? dataPath(node.scope).slice(-1)[0] : undefined);
|
|
197
|
+
const visit = (node, where) => {
|
|
198
|
+
const seen = new Map();
|
|
199
|
+
for (const child of node.elements ?? []) {
|
|
200
|
+
const label = name(child);
|
|
201
|
+
const first = label === undefined ? undefined : seen.get(label);
|
|
202
|
+
if (label !== undefined && first)
|
|
203
|
+
out.push(createDiagnostic({
|
|
204
|
+
code: "layout-duplicate-label",
|
|
205
|
+
target: layout.layout,
|
|
206
|
+
format: {
|
|
207
|
+
where,
|
|
208
|
+
label,
|
|
209
|
+
first: describe(first),
|
|
210
|
+
second: describe(child),
|
|
211
|
+
},
|
|
212
|
+
}));
|
|
213
|
+
else if (label !== undefined)
|
|
214
|
+
seen.set(label, child);
|
|
215
|
+
visit(child, child.label ?? where);
|
|
216
|
+
const detail = child.options?.detail;
|
|
217
|
+
if (detail)
|
|
218
|
+
visit(detail, label ?? where);
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
visit(ui, layout.layout.name);
|
|
222
|
+
return out;
|
|
223
|
+
}
|
|
224
|
+
const describe = (node) => node.scope ?? (node.label ? `the group "${node.label}"` : "a group");
|
|
225
|
+
//# sourceMappingURL=layout-ui.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout-ui.js","sourceRoot":"","sources":["../../../src/emitters/layout-ui.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAA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KAAK,EAAE,KAAK,CAAC,CAAC;YACrD,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,CAAC;YACnC,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,EAAE,MAA4B,CAAC;YAC3D,IAAI,MAAM;gBAAE,KAAK,CAAC,MAAM,EAAE,KAAK,IAAI,KAAK,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC,CAAC;IACF,KAAK,CAAC,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC9B,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,EAAE,CAChC,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,cAAc,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC"}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import type { Model, Program } from "@typespec/compiler";
|
|
2
2
|
import { Block } from "../model.js";
|
|
3
3
|
/**
|
|
4
|
-
* The parts of a block's JSON Schema that `@typespec/json-schema` cannot produce
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* presentation a *form* puts on a member of a question it composes, from `@UI.overrides` --
|
|
8
|
-
* SF-424 calls the authorized representative's phone "AOR Telephone Number" where the
|
|
9
|
-
* question calls it "Telephone Number", and that belongs to the form.
|
|
4
|
+
* The parts of a block's JSON Schema that `@typespec/json-schema` cannot produce: what the
|
|
5
|
+
* `@Validation.*` decorators require, and the help text, read-only status and choice
|
|
6
|
+
* contracts the `@UI.*` decorators carry into the schema.
|
|
10
7
|
*
|
|
11
8
|
* Everything else -- types, constraints, enums, arrays, `required`, `$ref` composition,
|
|
12
9
|
* `extends` as `allOf` -- comes from the stock emitter. The build merges this over it.
|