@chobantonov/jsonforms-extended-spec 0.3.0 → 0.4.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.
Files changed (32) hide show
  1. package/conformance/behavior.json +1503 -5
  2. package/docs/audit.md +17 -2
  3. package/docs/conditional-fields.md +101 -16
  4. package/docs/external-resources-proposal.md +8 -2
  5. package/docs/implementation-guide.md +75 -89
  6. package/docs/implementation-pitfalls.md +232 -6
  7. package/docs/implementation-web-typescript.md +2 -5
  8. package/docs/renderer-and-demo.md +47 -34
  9. package/docs/spec.md +85 -13
  10. package/docs/todo.md +58 -21
  11. package/examples/catalog.json +16 -1
  12. package/examples/conditional-fields/README.md +10 -0
  13. package/examples/conditional-template-slots/README.md +14 -0
  14. package/examples/conditional-template-slots/config.json +7 -0
  15. package/examples/conditional-template-slots/data.json +5 -0
  16. package/examples/conditional-template-slots/schema.json +37 -0
  17. package/examples/conditional-template-slots/translations.json +16 -0
  18. package/examples/conditional-template-slots/uischema.json +22 -0
  19. package/examples/index.js +3 -2
  20. package/examples/kitchen-sink/README.md +93 -4
  21. package/examples/kitchen-sink/config.json +7 -0
  22. package/examples/kitchen-sink/data.json +14 -2
  23. package/examples/kitchen-sink/invalid-data.json +13 -1
  24. package/examples/kitchen-sink/schema.json +100 -1
  25. package/examples/kitchen-sink/translations.json +80 -2
  26. package/examples/kitchen-sink/uischema.json +239 -4
  27. package/examples/label-interpolation/README.md +17 -1
  28. package/examples/label-interpolation/translations.json +8 -4
  29. package/examples/label-interpolation/uischema.json +25 -6
  30. package/package.json +1 -1
  31. package/schemas/jsonforms-extended-uischema.schema.json +3 -3
  32. package/schemas/jsonforms-uischema.schema.json +3 -3
@@ -34,6 +34,13 @@
34
34
  "showValidationIndicator": true
35
35
  },
36
36
  "elements": [
37
+ {
38
+ "type": "Label",
39
+ "i18n": "identityGuide",
40
+ "options": {
41
+ "markup": "markdown"
42
+ }
43
+ },
37
44
  {
38
45
  "type": "VerticalLayout",
39
46
  "elements": [
@@ -131,6 +138,12 @@
131
138
  "layout": {
132
139
  "weight": 1,
133
140
  "minWidth": 240
141
+ },
142
+ "startAdornment": {
143
+ "kind": "icon",
144
+ "icon": "lock",
145
+ "label": "Account security",
146
+ "i18n": "accountSecurity"
134
147
  }
135
148
  }
136
149
  },
@@ -167,6 +180,13 @@
167
180
  "showValidationIndicator": true
168
181
  },
169
182
  "elements": [
183
+ {
184
+ "type": "Label",
185
+ "i18n": "contactGuide",
186
+ "options": {
187
+ "markup": "markdown"
188
+ }
189
+ },
170
190
  {
171
191
  "type": "Control",
172
192
  "scope": "#/properties/address",
@@ -213,8 +233,15 @@
213
233
  },
214
234
  "elements": [
215
235
  {
216
- "type": "VerticalLayout",
236
+ "type": "Group",
217
237
  "elements": [
238
+ {
239
+ "type": "Label",
240
+ "i18n": "preferencesGuide",
241
+ "options": {
242
+ "markup": "markdown"
243
+ }
244
+ },
218
245
  {
219
246
  "type": "HorizontalLayout",
220
247
  "options": {
@@ -246,6 +273,52 @@
246
273
  }
247
274
  ]
248
275
  },
276
+ {
277
+ "type": "Control",
278
+ "scope": "#/properties/employmentType",
279
+ "i18n": "employmentType",
280
+ "options": {
281
+ "format": "cards",
282
+ "choices": [
283
+ {
284
+ "value": "permanent",
285
+ "label": "Permanent",
286
+ "i18n": "employmentType.permanent",
287
+ "content": {
288
+ "type": "Label",
289
+ "i18n": "employmentType.permanentBody",
290
+ "options": {
291
+ "markup": "markdown"
292
+ }
293
+ }
294
+ },
295
+ {
296
+ "value": "fixed-term",
297
+ "label": "Fixed term",
298
+ "i18n": "employmentType.fixed-term",
299
+ "content": {
300
+ "type": "Label",
301
+ "i18n": "employmentType.fixed-termBody",
302
+ "options": {
303
+ "markup": "markdown"
304
+ }
305
+ }
306
+ },
307
+ {
308
+ "value": "contract",
309
+ "label": "Contract",
310
+ "i18n": "employmentType.contract",
311
+ "content": {
312
+ "type": "Label",
313
+ "i18n": "employmentType.contractBody",
314
+ "options": {
315
+ "markup": "markdown"
316
+ }
317
+ }
318
+ }
319
+ ]
320
+ }
321
+ },
249
322
  {
250
323
  "type": "Control",
251
324
  "scope": "#/properties/workMode",
@@ -254,6 +327,16 @@
254
327
  "format": "radio"
255
328
  }
256
329
  },
330
+ {
331
+ "type": "Control",
332
+ "scope": "#/properties/preferredOffice",
333
+ "i18n": "preferredOffice"
334
+ },
335
+ {
336
+ "type": "Control",
337
+ "scope": "#/properties/homeOfficeLocation",
338
+ "i18n": "homeOfficeLocation"
339
+ },
257
340
  {
258
341
  "type": "Control",
259
342
  "scope": "#/properties/newsletter",
@@ -267,6 +350,11 @@
267
350
  "toggle": true
268
351
  }
269
352
  },
353
+ {
354
+ "type": "Control",
355
+ "scope": "#/properties/relocationCity",
356
+ "i18n": "relocationCity"
357
+ },
270
358
  {
271
359
  "type": "HorizontalLayout",
272
360
  "options": {
@@ -292,6 +380,12 @@
292
380
  "layout": {
293
381
  "weight": 1,
294
382
  "minWidth": 220
383
+ },
384
+ "startAdornment": "€",
385
+ "endAdornment": {
386
+ "kind": "text",
387
+ "text": "/ year",
388
+ "i18n": "salaryPeriod"
295
389
  }
296
390
  }
297
391
  }
@@ -310,6 +404,26 @@
310
404
  "scope": "#/properties/color",
311
405
  "i18n": "color"
312
406
  }
407
+ ],
408
+ "label": "Your next role",
409
+ "i18n": "roleGroup",
410
+ "options": {
411
+ "part": "job-preferences"
412
+ },
413
+ "footer": [
414
+ {
415
+ "type": "Label",
416
+ "i18n": "preferencesSummary",
417
+ "options": {
418
+ "markup": "markdown",
419
+ "interpolate": true,
420
+ "part": "preferences-summary",
421
+ "textParams": {
422
+ "position": "{data.position}",
423
+ "mode": "{translate(\"workMode.\" + data.workMode)}"
424
+ }
425
+ }
426
+ }
313
427
  ]
314
428
  }
315
429
  ]
@@ -322,6 +436,13 @@
322
436
  "showValidationIndicator": true
323
437
  },
324
438
  "elements": [
439
+ {
440
+ "type": "Label",
441
+ "i18n": "scheduleGuide",
442
+ "options": {
443
+ "markup": "markdown"
444
+ }
445
+ },
325
446
  {
326
447
  "type": "Control",
327
448
  "scope": "#/properties/startDate",
@@ -340,7 +461,16 @@
340
461
  {
341
462
  "type": "Control",
342
463
  "scope": "#/properties/duration",
343
- "i18n": "duration"
464
+ "i18n": "duration",
465
+ "options": {
466
+ "endAdornment": {
467
+ "kind": "icon",
468
+ "icon": "information",
469
+ "label": "About contract duration",
470
+ "tooltip": "Choose the duration you can commit to.",
471
+ "i18n": "durationHelp"
472
+ }
473
+ }
344
474
  },
345
475
  {
346
476
  "type": "Control",
@@ -360,6 +490,13 @@
360
490
  {
361
491
  "type": "VerticalLayout",
362
492
  "elements": [
493
+ {
494
+ "type": "Label",
495
+ "i18n": "collectionsGuide",
496
+ "options": {
497
+ "markup": "markdown"
498
+ }
499
+ },
363
500
  {
364
501
  "type": "ListWithDetail",
365
502
  "scope": "#/properties/experience",
@@ -368,7 +505,23 @@
368
505
  {
369
506
  "type": "Control",
370
507
  "scope": "#/properties/tags",
371
- "i18n": "tags"
508
+ "i18n": "tags",
509
+ "options": {
510
+ "variant": "chips"
511
+ }
512
+ },
513
+ {
514
+ "type": "Control",
515
+ "scope": "#/properties/languages",
516
+ "i18n": "languages",
517
+ "options": {
518
+ "variant": "multi-select"
519
+ }
520
+ },
521
+ {
522
+ "type": "Control",
523
+ "scope": "#/properties/learningTopics",
524
+ "i18n": "learningTopics"
372
525
  },
373
526
  {
374
527
  "type": "Control",
@@ -407,6 +560,13 @@
407
560
  "showValidationIndicator": true
408
561
  },
409
562
  "elements": [
563
+ {
564
+ "type": "Label",
565
+ "i18n": "tableGuide",
566
+ "options": {
567
+ "markup": "markdown"
568
+ }
569
+ },
410
570
  {
411
571
  "type": "Control",
412
572
  "scope": "#/properties/team",
@@ -505,6 +665,13 @@
505
665
  "showValidationIndicator": true
506
666
  },
507
667
  "elements": [
668
+ {
669
+ "type": "Label",
670
+ "i18n": "gridGuide",
671
+ "options": {
672
+ "markup": "markdown"
673
+ }
674
+ },
508
675
  {
509
676
  "type": "Control",
510
677
  "scope": "#/properties/gridTeam",
@@ -668,6 +835,13 @@
668
835
  "showValidationIndicator": true
669
836
  },
670
837
  "elements": [
838
+ {
839
+ "type": "Label",
840
+ "i18n": "workSampleGuide",
841
+ "options": {
842
+ "markup": "markdown"
843
+ }
844
+ },
671
845
  {
672
846
  "type": "Control",
673
847
  "scope": "#/properties/policy",
@@ -690,6 +864,13 @@
690
864
  "showValidationIndicator": true
691
865
  },
692
866
  "elements": [
867
+ {
868
+ "type": "Label",
869
+ "i18n": "integrationGuide",
870
+ "options": {
871
+ "markup": "markdown"
872
+ }
873
+ },
693
874
  {
694
875
  "type": "Control",
695
876
  "scope": "#/properties/payload",
@@ -705,12 +886,62 @@
705
886
  "showValidationIndicator": true
706
887
  },
707
888
  "elements": [
889
+ {
890
+ "type": "Label",
891
+ "i18n": "reviewGuide",
892
+ "options": {
893
+ "markup": "markdown"
894
+ }
895
+ },
896
+ {
897
+ "type": "Label",
898
+ "i18n": "applicationSummary",
899
+ "options": {
900
+ "markup": "markdown",
901
+ "interpolate": true,
902
+ "textParamSpans": true,
903
+ "part": "application-summary prominent",
904
+ "textParams": {
905
+ "applicant": "{data.firstName + \" \" + data.lastName}",
906
+ "position": "{data.position}",
907
+ "mode": "{translate(\"workMode.\" + data.workMode)}",
908
+ "salary": "{currency(data.budget, \"EUR\")}"
909
+ }
910
+ }
911
+ },
912
+ {
913
+ "type": "Label",
914
+ "i18n": "contactSummary",
915
+ "options": {
916
+ "markup": "markdown",
917
+ "interpolate": true,
918
+ "textParamSpans": false,
919
+ "part": "application-contact",
920
+ "textParams": {
921
+ "email": "{data.email}"
922
+ }
923
+ }
924
+ },
708
925
  {
709
926
  "type": "Control",
710
927
  "scope": "#/properties/termsAccepted",
711
928
  "i18n": "termsAccepted"
712
929
  }
713
930
  ]
931
+ },
932
+ {
933
+ "type": "Category",
934
+ "label": "Demo guide",
935
+ "i18n": "demoGuide",
936
+ "elements": [
937
+ {
938
+ "type": "Label",
939
+ "i18n": "featureGuide",
940
+ "options": {
941
+ "markup": "markdown"
942
+ }
943
+ }
944
+ ]
714
945
  }
715
946
  ]
716
947
  }
@@ -718,5 +949,9 @@
718
949
  }
719
950
  ]
720
951
  }
721
- ]
952
+ ],
953
+ "options": {
954
+ "conditionalFields": true,
955
+ "part": "application-form"
956
+ }
722
957
  }
@@ -113,6 +113,15 @@ The Bulgarian renewal string is phrased with a colon and no trailing period,
113
113
  because a Bulgarian medium date already ends in `г.`. Punctuation belongs to
114
114
  the catalog entry.
115
115
 
116
+ The text has no implicit locale variable. The locale tab declares
117
+ `"textParams": { "language": "{locale}" }` and uses `{language}` in the message.
118
+ A second Label declares `"locale": "{locale}"`: the name is allowed, and the
119
+ parameter reads the host locale without referring to itself. Both declarations
120
+ work with the data-access gate closed and update when the host locale changes.
121
+ The incorrect-usage tab demonstrates that undeclared `{locale}` is reported.
122
+ Adapters implementing the older implicit-locale contract need to migrate to
123
+ these explicit parameters; support for this revision is unverified here.
124
+
116
125
  ## `translate()` turns a value into a word
117
126
 
118
127
  `data.plan` is `"Team"` in every language — a key, not a word. The parameter
@@ -181,7 +190,7 @@ What stays an error is anything wrong *however* the form is filled in, and the
181
190
  | a parameter never declared | `Unknown variable: customer` |
182
191
  | a function that does not exist | `no matching overload for 'shout'` |
183
192
  | a namespace that does not exist | `Unknown variable: nowhere` |
184
- | a parameter named `locale` | `textParams.locale is a reserved name` |
193
+ | undeclared `{locale}` in text | `Unknown variable: locale` |
185
194
 
186
195
  Each keeps the rest of its sentence — a label is content, and content is worth
187
196
  showing even when part of it is missing.
@@ -239,3 +248,10 @@ Proposed adapter acceptance cases (not executed renderer tests in this package):
239
248
  - Run `styling-*` behavior vectors for parsing boundaries, URL security,
240
249
  normalization and the documented native no-op. Record actual results per
241
250
  renderer family; schema validation does not establish support.
251
+
252
+ - With the data-access gate closed, switch the host locale and verify that
253
+ `language` and the declared `locale` parameter update, with eligible styling
254
+ spans. Undeclared `{locale}` reports an unknown variable and receives no span.
255
+ - Supply a non-boolean local `textParamSpans` through unchecked input: it inherits
256
+ the host default rather than becoming truthy or forcing false. Authoring
257
+ validation must still reject it.
@@ -20,7 +20,6 @@
20
20
  "undeclared.text": "A parameter that was never declared: \"{customer}\".",
21
21
  "unknownFn.text": "A function that does not exist: \"{shout(account)}\".",
22
22
  "badNamespace.text": "A namespace that does not exist: \"{who}\".",
23
- "reserved.text": "A parameter named after a reserved name: \"{locale}\".",
24
23
  "plan.Starter": "Starter",
25
24
  "plan.Team": "Team",
26
25
  "plan.Enterprise": "Enterprise",
@@ -43,7 +42,10 @@
43
42
  "Locale and translation": "Locale and translation",
44
43
  "Interpolation off": "Interpolation off",
45
44
  "JavaScript names": "JavaScript names",
46
- "Incorrect usage": "Incorrect usage"
45
+ "Incorrect usage": "Incorrect usage",
46
+ "hostLocale.text": "Current language: {language}.",
47
+ "namedLocale.text": "Explicit parameter named locale: {locale}.",
48
+ "undeclaredLocale.text": "Locale without a declared parameter: \"{locale}\"."
47
49
  },
48
50
  "bg": {
49
51
  "product.text": "Абонирани сте за {product}.",
@@ -66,7 +68,6 @@
66
68
  "undeclared.text": "Недеклариран параметър: „{customer}“.",
67
69
  "unknownFn.text": "Несъществуваща функция: „{shout(account)}“.",
68
70
  "badNamespace.text": "Несъществуващо пространство от имена: „{who}“.",
69
- "reserved.text": "Параметър със запазено име: „{locale}“.",
70
71
  "plan.Starter": "Начален",
71
72
  "plan.Team": "Екип",
72
73
  "plan.Enterprise": "Корпоративен",
@@ -89,6 +90,9 @@
89
90
  "Locale and translation": "Език и превод",
90
91
  "Interpolation off": "Без заместване",
91
92
  "JavaScript names": "JavaScript имена",
92
- "Incorrect usage": "Неправилна употреба"
93
+ "Incorrect usage": "Неправилна употреба",
94
+ "hostLocale.text": "Текущ език: {language}.",
95
+ "namedLocale.text": "Изрично зададен параметър с име locale: {locale}.",
96
+ "undeclaredLocale.text": "Език без деклариран параметър: „{locale}“."
93
97
  }
94
98
  }
@@ -147,6 +147,28 @@
147
147
  "type": "Category",
148
148
  "label": "Locale and translation",
149
149
  "elements": [
150
+ {
151
+ "type": "Label",
152
+ "i18n": "hostLocale",
153
+ "text": "Current language: {language}.",
154
+ "options": {
155
+ "interpolate": true,
156
+ "textParams": {
157
+ "language": "{locale}"
158
+ }
159
+ }
160
+ },
161
+ {
162
+ "type": "Label",
163
+ "i18n": "namedLocale",
164
+ "text": "Explicit parameter named locale: {locale}.",
165
+ "options": {
166
+ "interpolate": true,
167
+ "textParams": {
168
+ "locale": "{locale}"
169
+ }
170
+ }
171
+ },
150
172
  {
151
173
  "type": "Label",
152
174
  "i18n": "planName",
@@ -357,13 +379,10 @@
357
379
  },
358
380
  {
359
381
  "type": "Label",
360
- "i18n": "reserved",
361
- "text": "A parameter named after a reserved name: \"{locale}\".",
382
+ "i18n": "undeclaredLocale",
383
+ "text": "Locale without a declared parameter: \"{locale}\".",
362
384
  "options": {
363
- "interpolate": true,
364
- "textParams": {
365
- "locale": "{data.plan}"
366
- }
385
+ "interpolate": true
367
386
  }
368
387
  },
369
388
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chobantonov/jsonforms-extended-spec",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Portable JSON Forms extended UI model specification, JSON schemas and examples",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -59,7 +59,7 @@
59
59
  },
60
60
  "conditionalFields": {
61
61
  "type": "boolean",
62
- "description": "Opt in to conditional object presentation on an object Control or object-context layout entry. Local false overrides config. The entry owns descendant layouts and Categories; nested object/item boundaries are independent. Explicit layouts filter inactive branch-only bindings and update required markers without adding controls or deleting data."
62
+ "description": "Opt in to conditional object presentation on an object Control or owning VerticalLayout, HorizontalLayout, Group, Categorization, TemplateLayout, Template or Slot entry. Entry-local false overrides config. Descendant layout and Category options are ignored in both directions; this option is also ignored on other element kinds. Nested object/item and independent host form boundaries resolve independently. Filter inactive branch-only field bindings in bodies and Group regions without adding controls, pruning empty containers or deleting data. Whole-value editors retain the authored schema. Template child addresses remain reserved when inactive; known inactive slots render nothing without fallback or unknown-slot warnings."
63
63
  }
64
64
  }
65
65
  },
@@ -1004,7 +1004,7 @@
1004
1004
  },
1005
1005
  "conditionalFields": {
1006
1006
  "type": "boolean",
1007
- "description": "Opt in to conditional object presentation on an object Control or object-context layout entry. Local false overrides config. The entry owns descendant layouts and Categories; nested object/item boundaries are independent. Explicit layouts filter inactive branch-only bindings and update required markers without adding controls or deleting data."
1007
+ "description": "Opt in to conditional object presentation on an object Control or owning VerticalLayout, HorizontalLayout, Group, Categorization, TemplateLayout, Template or Slot entry. Entry-local false overrides config. Descendant layout and Category options are ignored in both directions; this option is also ignored on other element kinds. Nested object/item and independent host form boundaries resolve independently. Filter inactive branch-only field bindings in bodies and Group regions without adding controls, pruning empty containers or deleting data. Whole-value editors retain the authored schema. Template child addresses remain reserved when inactive; known inactive slots render nothing without fallback or unknown-slot warnings."
1008
1008
  },
1009
1009
  "choices": {
1010
1010
  "type": "array",
@@ -1659,7 +1659,7 @@
1659
1659
  "textParams": {
1660
1660
  "type": "object",
1661
1661
  "additionalProperties": true,
1662
- "description": "Named values exposed to the expressions as bare identifiers. Always in scope, unlike the data/item/config/context namespaces, which require jsonformsExtended.dynamicValues.enabled."
1662
+ "description": "Declared values exposed to text expressions as bare identifiers. Text has no implicit locale variable: declare a parameter such as language with value {locale} to expose the host locale. A parameter named locale is allowed. Parameter expressions may read host locale without the data-access gate; data/item/config/context require jsonformsExtended.dynamicValues.enabled."
1663
1663
  }
1664
1664
  }
1665
1665
  }
@@ -82,7 +82,7 @@
82
82
  },
83
83
  "conditionalFields": {
84
84
  "type": "boolean",
85
- "description": "Opt in to conditional object presentation on an object Control or object-context layout entry. Local false overrides config. The entry owns descendant layouts and Categories; nested object/item boundaries are independent. Explicit layouts filter inactive branch-only bindings and update required markers without adding controls or deleting data."
85
+ "description": "Opt in to conditional object presentation on an object Control or owning VerticalLayout, HorizontalLayout, Group, Categorization, TemplateLayout, Template or Slot entry. Entry-local false overrides config. Descendant layout and Category options are ignored in both directions; this option is also ignored on other element kinds. Nested object/item and independent host form boundaries resolve independently. Filter inactive branch-only field bindings in bodies and Group regions without adding controls, pruning empty containers or deleting data. Whole-value editors retain the authored schema. Template child addresses remain reserved when inactive; known inactive slots render nothing without fallback or unknown-slot warnings."
86
86
  }
87
87
  }
88
88
  },
@@ -1013,7 +1013,7 @@
1013
1013
  },
1014
1014
  "conditionalFields": {
1015
1015
  "type": "boolean",
1016
- "description": "Opt in to conditional object presentation on an object Control or object-context layout entry. Local false overrides config. The entry owns descendant layouts and Categories; nested object/item boundaries are independent. Explicit layouts filter inactive branch-only bindings and update required markers without adding controls or deleting data."
1016
+ "description": "Opt in to conditional object presentation on an object Control or owning VerticalLayout, HorizontalLayout, Group, Categorization, TemplateLayout, Template or Slot entry. Entry-local false overrides config. Descendant layout and Category options are ignored in both directions; this option is also ignored on other element kinds. Nested object/item and independent host form boundaries resolve independently. Filter inactive branch-only field bindings in bodies and Group regions without adding controls, pruning empty containers or deleting data. Whole-value editors retain the authored schema. Template child addresses remain reserved when inactive; known inactive slots render nothing without fallback or unknown-slot warnings."
1017
1017
  },
1018
1018
  "pagination": {
1019
1019
  "$ref": "#/$defs/pagination"
@@ -1146,7 +1146,7 @@
1146
1146
  },
1147
1147
  "textParamSpans": {
1148
1148
  "type": "boolean",
1149
- "description": "Overrides jsonformsExtended.markup.textParamSpans for this Label, including explicit false. Omit to inherit; otherwise defaults to false. Optional HTML styling markers; documented native or canvas no-op is permitted."
1149
+ "description": "Overrides jsonformsExtended.markup.textParamSpans for this Label, including explicit false. Omit to inherit; otherwise defaults to false. Unchecked non-boolean local values are ignored as omitted. Optional HTML styling markers for declared parameters only; documented native or canvas no-op is permitted."
1150
1150
  }
1151
1151
  }
1152
1152
  }