@chobantonov/jsonforms-extended-spec 0.4.0 → 1.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.
@@ -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
  },
@@ -38,8 +38,8 @@ changing rather than taken on trust.
38
38
  | --- | --- |
39
39
  | **Interpolation** | static parameters, data through a parameter, a plural, absent data, a literal brace |
40
40
  | **Markdown** | Markdown with no interpolation |
41
- | **Both together** | a value inside the author's own markup, and a value that *contains* markup |
42
- | **Locale and translation** | `translate()`, `date()`, `currency()`, `number()`, and a value left unformatted |
41
+ | **Both together** | a value inside the author's own markup, a value that *contains* markup, and a component-encoded profile link |
42
+ | **Locale and translation** | `translate()`, `date()`, `dateTime()`, `currency()`, `number()`, and a value left unformatted |
43
43
  | **Interpolation off** | what the same text does without the option |
44
44
  | **JavaScript names** | a property called `constructor`, and one called `toString` |
45
45
  | **Incorrect usage** | the five things that are reported, and why |
@@ -255,3 +255,30 @@ Proposed adapter acceptance cases (not executed renderer tests in this package):
255
255
  - Supply a non-boolean local `textParamSpans` through unchecked input: it inherits
256
256
  the host default rather than becoming truthy or forcing false. Authoring
257
257
  validation must still reject it.
258
+
259
+ ## URL components and date-time instants
260
+
261
+ The profile link uses `[{name}](#/users/{encodeUriComponent(id)})` with parameters
262
+ bound to `data.customerName` and `data.accountId`. Edit the identifier to include
263
+ `/`, `?`, `&`, `#`, spaces or Unicode: the value remains one encoded component.
264
+ The link label remains literal text even when the account name contains Markdown.
265
+ Percent escapes in the input are encoded again; markup escaping and the resolved
266
+ URL policy still apply. For numeric identifiers, call
267
+ `encodeUriComponent(string(id))` explicitly.
268
+
269
+ The meeting label calls `dateTime(when)` on `data.meetingAt`. Its medium-date and
270
+ short-time output follows the form locale and viewer time zone. The timestamp
271
+ `2026-10-01T14:30:00+02:00` represents the same instant as the initial value and
272
+ must display identically in the same environment. A calendar date continues to
273
+ use `date`, and a clock-only value uses `time`.
274
+
275
+ These labels also work when a browser/JavaScript host mounts the same documents:
276
+ the CEL helper belongs to the host evaluator rather than a JavaScript global.
277
+ The portable helper signatures and edge cases are specified in
278
+ [§9.3a](../../docs/spec.md#93a-portable-url-component-and-date-time-helpers).
279
+
280
+ The locale tab also exercises integer-valued expressions: `number(count, 2)`
281
+ receives a `size()` result, `percent(1)` receives an integer literal, and
282
+ `dateTime(timestamp(when))` receives a native CEL timestamp. These must have the
283
+ same formatting behavior as equivalent data values and timestamp strings. A
284
+ host-provided `Date` follows the same timestamp overload in JavaScript clients.
@@ -9,5 +9,7 @@
9
9
  "seatPrice": 49.5,
10
10
  "reference": 2026,
11
11
  "constructor": "a perfectly ordinary value",
12
- "toString": "also ordinary"
12
+ "toString": "also ordinary",
13
+ "accountId": "Име/a?x=1&y=#(profile)",
14
+ "meetingAt": "2026-10-01T12:30:00Z"
13
15
  }
@@ -55,6 +55,15 @@
55
55
  "toString": {
56
56
  "type": "string",
57
57
  "title": "toString (a legal property name)"
58
+ },
59
+ "accountId": {
60
+ "type": "string",
61
+ "title": "Account identifier"
62
+ },
63
+ "meetingAt": {
64
+ "type": "string",
65
+ "format": "date-time",
66
+ "title": "Meeting time"
58
67
  }
59
68
  },
60
69
  "required": [
@@ -45,7 +45,12 @@
45
45
  "Incorrect usage": "Incorrect usage",
46
46
  "hostLocale.text": "Current language: {language}.",
47
47
  "namedLocale.text": "Explicit parameter named locale: {locale}.",
48
- "undeclaredLocale.text": "Locale without a declared parameter: \"{locale}\"."
48
+ "undeclaredLocale.text": "Locale without a declared parameter: \"{locale}\".",
49
+ "encodedProfile.text": "[{name}](#/users/{encodeUriComponent(id)})",
50
+ "meetingTime.text": "Meeting: {dateTime(when)}.",
51
+ "accountId.label": "Account identifier",
52
+ "meetingAt.label": "Meeting time",
53
+ "overloadExamples.text": "Count: {number(count, 2)}; whole ratio: {percent(1)}; timestamp: {dateTime(timestamp(when))}."
49
54
  },
50
55
  "bg": {
51
56
  "product.text": "Абонирани сте за {product}.",
@@ -93,6 +98,11 @@
93
98
  "Incorrect usage": "Неправилна употреба",
94
99
  "hostLocale.text": "Текущ език: {language}.",
95
100
  "namedLocale.text": "Изрично зададен параметър с име locale: {locale}.",
96
- "undeclaredLocale.text": "Език без деклариран параметър: „{locale}“."
101
+ "undeclaredLocale.text": "Език без деклариран параметър: „{locale}“.",
102
+ "encodedProfile.text": "[{name}](#/users/{encodeUriComponent(id)})",
103
+ "meetingTime.text": "Среща: {dateTime(when)}.",
104
+ "accountId.label": "Идентификатор на акаунта",
105
+ "meetingAt.label": "Час на срещата",
106
+ "overloadExamples.text": "Брой: {number(count, 2)}; цял дял: {percent(1)}; времеви отпечатък: {dateTime(timestamp(when))}."
97
107
  }
98
108
  }
@@ -140,6 +140,23 @@
140
140
  "scope": "#/properties/displayName"
141
141
  }
142
142
  ]
143
+ },
144
+ {
145
+ "type": "Label",
146
+ "i18n": "encodedProfile",
147
+ "text": "[{name}](#/users/{encodeUriComponent(id)})",
148
+ "options": {
149
+ "interpolate": true,
150
+ "markup": "markdown",
151
+ "textParams": {
152
+ "name": "{data.customerName}",
153
+ "id": "{data.accountId}"
154
+ }
155
+ }
156
+ },
157
+ {
158
+ "type": "Control",
159
+ "scope": "#/properties/accountId"
143
160
  }
144
161
  ]
145
162
  },
@@ -242,6 +259,33 @@
242
259
  "scope": "#/properties/reference"
243
260
  }
244
261
  ]
262
+ },
263
+ {
264
+ "type": "Label",
265
+ "i18n": "meetingTime",
266
+ "text": "Meeting: {dateTime(when)}.",
267
+ "options": {
268
+ "interpolate": true,
269
+ "textParams": {
270
+ "when": "{data.meetingAt}"
271
+ }
272
+ }
273
+ },
274
+ {
275
+ "type": "Control",
276
+ "scope": "#/properties/meetingAt"
277
+ },
278
+ {
279
+ "type": "Label",
280
+ "i18n": "overloadExamples",
281
+ "text": "Count: {number(count, 2)}; whole ratio: {percent(1)}; timestamp: {dateTime(timestamp(when))}.",
282
+ "options": {
283
+ "interpolate": true,
284
+ "textParams": {
285
+ "count": "{size([data.plan])}",
286
+ "when": "{data.meetingAt}"
287
+ }
288
+ }
245
289
  }
246
290
  ]
247
291
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chobantonov/jsonforms-extended-spec",
3
- "version": "0.4.0",
3
+ "version": "1.1.0",
4
4
  "description": "Portable JSON Forms extended UI model specification, JSON schemas and examples",
5
5
  "type": "module",
6
6
  "license": "MIT",
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": {
@@ -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
- cover: f.raw({ type: 'ImageView', src: '/contact.jpg', alt: 'Office' }),
78
- header: [f.label({ text: 'Verified' })],
79
- elements: [f.control('email')],
80
- footer: [f.raw({ type: 'Button', label: 'Verify', action: 'verify' })],
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', () => {