@chobantonov/jsonforms-extended-spec 0.3.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 +1755 -22
- package/docs/audit.md +17 -2
- package/docs/conditional-fields.md +105 -16
- package/docs/external-resources-proposal.md +8 -2
- package/docs/implementation-guide.md +76 -89
- package/docs/implementation-pitfalls.md +260 -12
- package/docs/implementation-web-typescript.md +2 -5
- package/docs/renderer-and-demo.md +47 -34
- package/docs/spec.md +169 -47
- package/docs/todo.md +59 -22
- package/examples/catalog.json +16 -1
- package/examples/conditional-fields/README.md +10 -0
- package/examples/conditional-template-slots/README.md +14 -0
- package/examples/conditional-template-slots/config.json +7 -0
- package/examples/conditional-template-slots/data.json +5 -0
- package/examples/conditional-template-slots/schema.json +37 -0
- package/examples/conditional-template-slots/translations.json +16 -0
- package/examples/conditional-template-slots/uischema.json +22 -0
- package/examples/group-layout/README.md +26 -1
- package/examples/group-layout/uischema.json +50 -41
- package/examples/index.js +4 -3
- package/examples/kitchen-sink/README.md +93 -4
- package/examples/kitchen-sink/config.json +7 -0
- package/examples/kitchen-sink/data.json +14 -2
- package/examples/kitchen-sink/invalid-data.json +13 -1
- package/examples/kitchen-sink/schema.json +100 -1
- package/examples/kitchen-sink/translations.json +80 -2
- package/examples/kitchen-sink/uischema.json +239 -5
- package/examples/label-interpolation/README.md +17 -1
- package/examples/label-interpolation/translations.json +8 -4
- package/examples/label-interpolation/uischema.json +25 -6
- package/package.json +1 -1
- package/schemas/README.md +10 -0
- package/schemas/jsonforms-extended-uischema.schema.json +8 -18
- package/schemas/jsonforms-uischema.schema.json +8 -18
- 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
|
@@ -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', () => {
|