@chobantonov/jsonforms-extended-spec 0.4.0 → 1.0.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/conformance/authoring.json +243 -0
- package/conformance/behavior.json +271 -36
- package/docs/conditional-fields.md +6 -2
- package/docs/implementation-guide.md +2 -1
- package/docs/implementation-pitfalls.md +28 -6
- package/docs/spec.md +84 -34
- package/docs/todo.md +1 -1
- package/examples/group-layout/README.md +26 -1
- package/examples/group-layout/uischema.json +50 -41
- package/examples/index.js +2 -2
- package/examples/kitchen-sink/uischema.json +9 -10
- package/package.json +1 -1
- package/schemas/README.md +10 -0
- package/schemas/jsonforms-extended-uischema.schema.json +5 -15
- package/schemas/jsonforms-uischema.schema.json +5 -15
- package/typescript/README.md +6 -0
- package/typescript/lib/authoring/forSchema.d.ts +10 -6
- package/typescript/src/authoring/forSchema.ts +10 -6
- package/typescript/test/typedAuthoringCoverage.test.ts +15 -7
|
@@ -403,14 +403,7 @@
|
|
|
403
403
|
"type": "Control",
|
|
404
404
|
"scope": "#/properties/color",
|
|
405
405
|
"i18n": "color"
|
|
406
|
-
}
|
|
407
|
-
],
|
|
408
|
-
"label": "Your next role",
|
|
409
|
-
"i18n": "roleGroup",
|
|
410
|
-
"options": {
|
|
411
|
-
"part": "job-preferences"
|
|
412
|
-
},
|
|
413
|
-
"footer": [
|
|
406
|
+
},
|
|
414
407
|
{
|
|
415
408
|
"type": "Label",
|
|
416
409
|
"i18n": "preferencesSummary",
|
|
@@ -422,9 +415,15 @@
|
|
|
422
415
|
"position": "{data.position}",
|
|
423
416
|
"mode": "{translate(\"workMode.\" + data.workMode)}"
|
|
424
417
|
}
|
|
425
|
-
}
|
|
418
|
+
},
|
|
419
|
+
"slot": "footer"
|
|
426
420
|
}
|
|
427
|
-
]
|
|
421
|
+
],
|
|
422
|
+
"label": "Your next role",
|
|
423
|
+
"i18n": "roleGroup",
|
|
424
|
+
"options": {
|
|
425
|
+
"part": "job-preferences"
|
|
426
|
+
}
|
|
428
427
|
}
|
|
429
428
|
]
|
|
430
429
|
},
|
package/package.json
CHANGED
package/schemas/README.md
CHANGED
|
@@ -80,3 +80,13 @@ inventory marks the styling switch as pending verification rather than
|
|
|
80
80
|
claiming a traced renderer implementation. Keep field-dependent `elementLabelProp`,
|
|
81
81
|
`detail`, `summary` and `cells` on their controls; isolated merged-config readers
|
|
82
82
|
do not establish a common global default.
|
|
83
|
+
|
|
84
|
+
## Group child placement
|
|
85
|
+
|
|
86
|
+
Both UI profiles validate nonempty top-level child `slot` strings. Group uses
|
|
87
|
+
the first authored direct child for each of `cover`, `header` and `footer`.
|
|
88
|
+
Later matches and unknown slot names are valid and remain in the body, as if
|
|
89
|
+
`slot` were omitted. The schemas accept these fallback cases; determining actual
|
|
90
|
+
placement requires the parent semantics. All region content is under `elements`.
|
|
91
|
+
The removed Group-level region fields are unknown extension keys, not supported
|
|
92
|
+
child locations. `slot` and Template `name` are independent.
|
|
@@ -74,6 +74,11 @@
|
|
|
74
74
|
"textParams": {
|
|
75
75
|
"type": "object",
|
|
76
76
|
"additionalProperties": true
|
|
77
|
+
},
|
|
78
|
+
"slot": {
|
|
79
|
+
"type": "string",
|
|
80
|
+
"minLength": 1,
|
|
81
|
+
"description": "Placement in the immediate parent’s named destination, independent of name. Group assigns the first authored child for each of cover, header and footer; later matches and unrecognized names use ordinary body placement. Omission uses ordinary placement."
|
|
77
82
|
}
|
|
78
83
|
},
|
|
79
84
|
"allOf": [
|
|
@@ -382,21 +387,6 @@
|
|
|
382
387
|
"label": {
|
|
383
388
|
"type": "string"
|
|
384
389
|
},
|
|
385
|
-
"cover": {
|
|
386
|
-
"$ref": "#/$defs/element"
|
|
387
|
-
},
|
|
388
|
-
"header": {
|
|
389
|
-
"type": "array",
|
|
390
|
-
"items": {
|
|
391
|
-
"$ref": "#/$defs/element"
|
|
392
|
-
}
|
|
393
|
-
},
|
|
394
|
-
"footer": {
|
|
395
|
-
"type": "array",
|
|
396
|
-
"items": {
|
|
397
|
-
"$ref": "#/$defs/element"
|
|
398
|
-
}
|
|
399
|
-
},
|
|
400
390
|
"elements": {
|
|
401
391
|
"type": "array",
|
|
402
392
|
"items": {
|
|
@@ -97,6 +97,11 @@
|
|
|
97
97
|
"textParams": {
|
|
98
98
|
"type": "object",
|
|
99
99
|
"additionalProperties": true
|
|
100
|
+
},
|
|
101
|
+
"slot": {
|
|
102
|
+
"type": "string",
|
|
103
|
+
"minLength": 1,
|
|
104
|
+
"description": "Placement in the immediate parent’s named destination, independent of name. Group assigns the first authored child for each of cover, header and footer; later matches and unrecognized names use ordinary body placement. Omission uses ordinary placement."
|
|
100
105
|
}
|
|
101
106
|
},
|
|
102
107
|
"allOf": [
|
|
@@ -342,21 +347,6 @@
|
|
|
342
347
|
"label": {
|
|
343
348
|
"type": "string"
|
|
344
349
|
},
|
|
345
|
-
"cover": {
|
|
346
|
-
"$ref": "#/$defs/element"
|
|
347
|
-
},
|
|
348
|
-
"header": {
|
|
349
|
-
"type": "array",
|
|
350
|
-
"items": {
|
|
351
|
-
"$ref": "#/$defs/element"
|
|
352
|
-
}
|
|
353
|
-
},
|
|
354
|
-
"footer": {
|
|
355
|
-
"type": "array",
|
|
356
|
-
"items": {
|
|
357
|
-
"$ref": "#/$defs/element"
|
|
358
|
-
}
|
|
359
|
-
},
|
|
360
350
|
"elements": {
|
|
361
351
|
"type": "array",
|
|
362
352
|
"items": {
|
package/typescript/README.md
CHANGED
|
@@ -544,3 +544,9 @@ object boundary. Nested object and array-item boundaries resolve independently.
|
|
|
544
544
|
Explicit layouts preserve placement and update conditional required indicators
|
|
545
545
|
without generating extra controls. See the conditional-fields contract for
|
|
546
546
|
ownership, validation, examples and platform support limits.
|
|
547
|
+
|
|
548
|
+
Group regions are ordinary children in `elements`, with a top-level
|
|
549
|
+
`slot: 'cover'`, `'header'` or `'footer'`. The typed helpers accept `slot` on
|
|
550
|
+
controls, labels and layouts; use `raw` for a Template whose `name` selects its
|
|
551
|
+
registered content independently of its `slot`. The parent resolves placement: Group uses the first authored match per region;
|
|
552
|
+
later matches and unrecognized names remain in the body.
|
|
@@ -237,6 +237,8 @@ export type TypedLabelDescriptor = {
|
|
|
237
237
|
export type ControlPath<S> = (DataPath<S> & string) | '';
|
|
238
238
|
export interface TypedControl<S, P extends ControlPath<S> = ControlPath<S>> {
|
|
239
239
|
type: 'Control';
|
|
240
|
+
/** Placement in the immediate parent; Group supports cover, header and footer. */
|
|
241
|
+
slot?: string;
|
|
240
242
|
scope: Scope<P>;
|
|
241
243
|
label?: string | boolean | TypedLabelDescriptor;
|
|
242
244
|
/** Translation-key prefix for this element, per core's i18n precedence. */
|
|
@@ -248,6 +250,8 @@ export interface TypedControl<S, P extends ControlPath<S> = ControlPath<S>> {
|
|
|
248
250
|
/** An unbound label element. */
|
|
249
251
|
export interface TypedLabelElement<S> {
|
|
250
252
|
type: 'Label';
|
|
253
|
+
/** Placement in the immediate parent; Group supports cover, header and footer. */
|
|
254
|
+
slot?: string;
|
|
251
255
|
text?: string;
|
|
252
256
|
i18n?: string;
|
|
253
257
|
options?: Record<string, unknown> & {
|
|
@@ -260,6 +264,8 @@ export interface TypedLabelElement<S> {
|
|
|
260
264
|
/** One tab or step of a `Categorization`. */
|
|
261
265
|
export interface TypedCategory<S> {
|
|
262
266
|
type: 'Category';
|
|
267
|
+
/** Placement in the immediate parent; Group supports cover, header and footer. */
|
|
268
|
+
slot?: string;
|
|
263
269
|
label?: string;
|
|
264
270
|
i18n?: string;
|
|
265
271
|
elements: TypedElement<S>[];
|
|
@@ -269,14 +275,10 @@ export interface TypedCategory<S> {
|
|
|
269
275
|
}
|
|
270
276
|
export interface TypedLayout<S> {
|
|
271
277
|
type: 'VerticalLayout' | 'HorizontalLayout' | 'Group' | 'Categorization';
|
|
278
|
+
/** Placement in the immediate parent; Group supports cover, header and footer. */
|
|
279
|
+
slot?: string;
|
|
272
280
|
label?: string;
|
|
273
281
|
i18n?: string;
|
|
274
|
-
/** Group's prominent media, dispatched before its heading. */
|
|
275
|
-
cover?: TypedElement<S>;
|
|
276
|
-
/** Group's supplemental heading content, outside the disclosure trigger. */
|
|
277
|
-
header?: TypedElement<S>[];
|
|
278
|
-
/** Group's content after its body; may contain any supported elements. */
|
|
279
|
-
footer?: TypedElement<S>[];
|
|
280
282
|
elements: (TypedElement<S> | TypedCategory<S>)[];
|
|
281
283
|
options?: {
|
|
282
284
|
/** Own conditional object presentation for this layout subtree. */
|
|
@@ -310,6 +312,8 @@ export interface TypedLayout<S> {
|
|
|
310
312
|
*/
|
|
311
313
|
export interface RawElement {
|
|
312
314
|
type: string;
|
|
315
|
+
/** Placement in the immediate parent; Group supports cover, header and footer. */
|
|
316
|
+
slot?: string;
|
|
313
317
|
[key: string]: unknown;
|
|
314
318
|
}
|
|
315
319
|
export type TypedElement<S> = TypedControl<S> | TypedLayout<S> | TypedLabelElement<S> | RawElement;
|
|
@@ -197,6 +197,8 @@ export type ControlPath<S> = (DataPath<S> & string) | '';
|
|
|
197
197
|
|
|
198
198
|
export interface TypedControl<S, P extends ControlPath<S> = ControlPath<S>> {
|
|
199
199
|
type: 'Control';
|
|
200
|
+
/** Placement in the immediate parent; Group supports cover, header and footer. */
|
|
201
|
+
slot?: string;
|
|
200
202
|
scope: Scope<P>;
|
|
201
203
|
label?: string | boolean | TypedLabelDescriptor;
|
|
202
204
|
/** Translation-key prefix for this element, per core's i18n precedence. */
|
|
@@ -209,6 +211,8 @@ export interface TypedControl<S, P extends ControlPath<S> = ControlPath<S>> {
|
|
|
209
211
|
/** An unbound label element. */
|
|
210
212
|
export interface TypedLabelElement<S> {
|
|
211
213
|
type: 'Label';
|
|
214
|
+
/** Placement in the immediate parent; Group supports cover, header and footer. */
|
|
215
|
+
slot?: string;
|
|
212
216
|
text?: string;
|
|
213
217
|
i18n?: string;
|
|
214
218
|
options?: Record<string, unknown> & {
|
|
@@ -222,6 +226,8 @@ export interface TypedLabelElement<S> {
|
|
|
222
226
|
/** One tab or step of a `Categorization`. */
|
|
223
227
|
export interface TypedCategory<S> {
|
|
224
228
|
type: 'Category';
|
|
229
|
+
/** Placement in the immediate parent; Group supports cover, header and footer. */
|
|
230
|
+
slot?: string;
|
|
225
231
|
label?: string;
|
|
226
232
|
i18n?: string;
|
|
227
233
|
elements: TypedElement<S>[];
|
|
@@ -232,14 +238,10 @@ export interface TypedCategory<S> {
|
|
|
232
238
|
|
|
233
239
|
export interface TypedLayout<S> {
|
|
234
240
|
type: 'VerticalLayout' | 'HorizontalLayout' | 'Group' | 'Categorization';
|
|
241
|
+
/** Placement in the immediate parent; Group supports cover, header and footer. */
|
|
242
|
+
slot?: string;
|
|
235
243
|
label?: string;
|
|
236
244
|
i18n?: string;
|
|
237
|
-
/** Group's prominent media, dispatched before its heading. */
|
|
238
|
-
cover?: TypedElement<S>;
|
|
239
|
-
/** Group's supplemental heading content, outside the disclosure trigger. */
|
|
240
|
-
header?: TypedElement<S>[];
|
|
241
|
-
/** Group's content after its body; may contain any supported elements. */
|
|
242
|
-
footer?: TypedElement<S>[];
|
|
243
245
|
elements: (TypedElement<S> | TypedCategory<S>)[];
|
|
244
246
|
options?: {
|
|
245
247
|
/** Own conditional object presentation for this layout subtree. */
|
|
@@ -280,6 +282,8 @@ export interface TypedLayout<S> {
|
|
|
280
282
|
*/
|
|
281
283
|
export interface RawElement {
|
|
282
284
|
type: string;
|
|
285
|
+
/** Placement in the immediate parent; Group supports cover, header and footer. */
|
|
286
|
+
slot?: string;
|
|
283
287
|
[key: string]: unknown;
|
|
284
288
|
}
|
|
285
289
|
|
|
@@ -74,14 +74,22 @@ describe('every element kind is expressible', () => {
|
|
|
74
74
|
const ui = f.layout({
|
|
75
75
|
type: 'Group',
|
|
76
76
|
label: 'Contact',
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
elements: [
|
|
78
|
+
f.raw({ type: 'ImageView', slot: 'cover', src: '/contact.jpg', alt: 'Office' }),
|
|
79
|
+
f.layout({ type: 'VerticalLayout', slot: 'header', elements: [f.label({ text: 'Verified' })] }),
|
|
80
|
+
f.control('email'),
|
|
81
|
+
f.raw({ type: 'Template', name: 'contact-actions', slot: 'footer' }),
|
|
82
|
+
],
|
|
83
|
+
});
|
|
84
|
+
expect(ui.elements.map(child => child.slot)).toEqual(['cover', 'header', undefined, 'footer']);
|
|
85
|
+
expect(ui.elements[3]).toMatchObject({ name: 'contact-actions', slot: 'footer' });
|
|
86
|
+
f.control('email', { slot: 'header' });
|
|
87
|
+
f.label({ text: 'Heading', slot: 'header' });
|
|
88
|
+
f.layout({
|
|
89
|
+
type: 'Group', elements: [],
|
|
90
|
+
// @ts-expect-error Group regions are child slot assignments, not separate child fields.
|
|
91
|
+
header: [],
|
|
81
92
|
});
|
|
82
|
-
expect(ui.cover?.type).toBe('ImageView');
|
|
83
|
-
expect(ui.header).toHaveLength(1);
|
|
84
|
-
expect(ui.footer).toHaveLength(1);
|
|
85
93
|
});
|
|
86
94
|
|
|
87
95
|
it('builds labels, categories, rules and the root scope', () => {
|