@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.
- package/conformance/authoring.json +243 -0
- package/conformance/behavior.json +484 -36
- package/conformance/cel-helpers.json +231 -0
- package/docs/conditional-fields.md +6 -2
- package/docs/implementation-guide.md +80 -1
- package/docs/implementation-pitfalls.md +78 -6
- package/docs/spec.md +154 -35
- package/docs/todo.md +1 -1
- package/examples/group-layout/README.md +41 -2
- package/examples/group-layout/data.json +2 -1
- package/examples/group-layout/schema.json +10 -1
- package/examples/group-layout/translations.json +10 -2
- package/examples/group-layout/uischema.json +90 -40
- package/examples/index.js +3 -3
- package/examples/kitchen-sink/uischema.json +9 -10
- package/examples/label-interpolation/README.md +29 -2
- package/examples/label-interpolation/data.json +3 -1
- package/examples/label-interpolation/schema.json +9 -0
- package/examples/label-interpolation/translations.json +12 -2
- package/examples/label-interpolation/uischema.json +44 -0
- 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
package/docs/spec.md
CHANGED
|
@@ -222,6 +222,14 @@ Three consequences follow, and each has been got wrong:
|
|
|
222
222
|
resolves within its own construct; a duplicate *within* one construct is a
|
|
223
223
|
configuration error and MUST be diagnosed rather than resolved by position.
|
|
224
224
|
|
|
225
|
+
### 2.2 `slot` assigns placement in the immediate parent
|
|
226
|
+
|
|
227
|
+
`slot` is an optional, nonempty, case-sensitive string field on an element,
|
|
228
|
+
independent of its `name`, label and options. It assigns that child to a named
|
|
229
|
+
destination supported by its immediate parent. Omission uses the parent's normal
|
|
230
|
+
placement. Group destinations and fallback behavior are defined in [§8.1](#81-group).
|
|
231
|
+
This field does not rename a Template or change structural Slot lookup.
|
|
232
|
+
|
|
225
233
|
## 3. Runtime context and the action contract
|
|
226
234
|
|
|
227
235
|
A reference web context:
|
|
@@ -791,31 +799,69 @@ does not look like a mistake.
|
|
|
791
799
|
An ordinary Group presents related controls as a labelled section. Its default
|
|
792
800
|
visual treatment belongs to the renderer family and requires no variant.
|
|
793
801
|
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
802
|
+
All Group children are authored in `elements`. A direct child may declare the
|
|
803
|
+
optional top-level `slot` field: `"cover"` places it before the heading,
|
|
804
|
+
`"header"` supplies the authored heading, and `"footer"` places it after the
|
|
805
|
+
body. Children not selected for a region form the body in authored relative
|
|
806
|
+
order, including children without `slot`. Group
|
|
807
|
+
orders the regions as cover, heading, body and footer regardless of their
|
|
808
|
+
positions in `elements`. There is no Group-level `slots` mapping or activation
|
|
809
|
+
switch. With no slot assignments, the Group is an ordinary body-only Group.
|
|
810
|
+
|
|
811
|
+
Each region uses the **first direct child in authored `elements` order** whose
|
|
812
|
+
`slot` exactly matches that region. Later children with the same slot name remain
|
|
813
|
+
in the body, as if their `slot` were omitted. Unrecognized slot names likewise
|
|
814
|
+
use ordinary body placement. There is no dedicated `body` slot; `slot: "body"`
|
|
815
|
+
is an unrecognized name and uses the same fallback. These are valid fallback cases, not configuration
|
|
816
|
+
errors; no child is discarded or rendered twice. Body fallback children follow
|
|
817
|
+
ordinary body collapse, data-presence and validation-indicator behavior.
|
|
818
|
+
|
|
819
|
+
Authors SHOULD assign only one child to each recognized slot. To intentionally
|
|
820
|
+
compose multiple elements in a region, put them in one ordinary layout assigned
|
|
821
|
+
to that slot. Group does not automatically combine repeated assignments.
|
|
822
|
+
|
|
823
|
+
`slot` is placement metadata read by the immediate parent, independent of `name`.
|
|
824
|
+
For example, a Template can have `name: "partner-summary"` and `slot: "header"`:
|
|
825
|
+
its name still selects the registered template. A child named `header` without a
|
|
826
|
+
`slot` remains body content. Nested assignments do not fill an ancestor Group's
|
|
827
|
+
regions. Other parent constructs define their own slot support; parents without
|
|
828
|
+
such support retain ordinary child placement.
|
|
829
|
+
`slot` is not `options.slot`, a styling part, or a structural `Slot` element.
|
|
830
|
+
|
|
831
|
+
Dispatch every region child through the normal registry with the Group's schema,
|
|
832
|
+
data path and enabled state. Generic child traversal uses `elements` for all
|
|
833
|
+
regions. Determine placement and occurrence identity from authored children
|
|
834
|
+
before conditional or rule filtering. Hiding or conditionally omitting the first
|
|
835
|
+
matching child does not promote a later match from the body. A hidden region
|
|
836
|
+
stays assigned and never falls into the body; filtering must not remount surviving body editors. An empty
|
|
837
|
+
region renders nothing. Renderer families choose native components and styling;
|
|
838
|
+
slot assignments require neither a Card component nor identical pixels.
|
|
839
|
+
The former Group-level `cover`, `header` and `footer` child fields are no longer
|
|
840
|
+
part of this contract; migrate their content into slotted `elements` children.
|
|
841
|
+
Open authoring schemas may preserve those unknown keys without validating their
|
|
842
|
+
contents or implying support.
|
|
843
|
+
|
|
844
|
+
An authored header supplies the heading instead of repeating the Group label.
|
|
845
|
+
When no header content is visible, use `label` as the visible title and accessible
|
|
846
|
+
name. For the header child's own Label, or Labels within its authored layout
|
|
847
|
+
children, the first visible Label in depth-first authored order supplies the
|
|
848
|
+
resolved accessible name. Do not search Control details, registered Template
|
|
849
|
+
expansions or other independent content contexts for a title; when no eligible
|
|
850
|
+
Label exists, use the Group label as the accessible name. Resolve effective Label
|
|
851
|
+
text and recompute after locale, dynamic-text or visibility changes. A header
|
|
852
|
+
layout may contain a title Label followed by a supporting Label; renderers SHOULD
|
|
853
|
+
give the supporting Label a smaller, muted treatment.
|
|
854
|
+
|
|
855
|
+
For a collapsible Group, the existing status and chevron stay at the far right of
|
|
856
|
+
the heading row. The cover and one heading area remain visible when collapsed;
|
|
857
|
+
only the body and footer hide. Keep authored interactive header and footer content
|
|
858
|
+
outside the disclosure trigger. Group visibility hides every region. Enabled,
|
|
859
|
+
read-only and rule behavior apply to dispatched children as usual. Group data-presence
|
|
860
|
+
and validation indicators aggregate bound Controls across **all** children in
|
|
861
|
+
`elements` and their descendants, including cover, header, footer and body
|
|
862
|
+
fallback children. Placement does not change binding participation. Labels,
|
|
863
|
+
images and other presentation-only elements do not contribute data or errors
|
|
864
|
+
merely by displaying content or carrying a `scope` field. This presentation boundary does not change document validation.
|
|
819
865
|
|
|
820
866
|
For Groups that declare regions, keep the authored content in one card frame.
|
|
821
867
|
In a collapsible presentation, the cover and one heading area stay inside the
|
|
@@ -835,13 +881,19 @@ their card library's sections where available, or its documented composition pat
|
|
|
835
881
|
{
|
|
836
882
|
"type": "Group",
|
|
837
883
|
"options": { "collapsible": true, "collapsed": true },
|
|
838
|
-
"
|
|
839
|
-
|
|
840
|
-
{
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
884
|
+
"elements": [
|
|
885
|
+
{ "type": "ImageView", "slot": "cover", "src": "/hotel.jpg", "alt": "Hotel courtyard", "options": { "width": "100%" } },
|
|
886
|
+
{
|
|
887
|
+
"type": "VerticalLayout",
|
|
888
|
+
"slot": "header",
|
|
889
|
+
"elements": [
|
|
890
|
+
{ "type": "Label", "text": "Hospitality partner" },
|
|
891
|
+
{ "type": "Label", "text": "Verified member since 2018" }
|
|
892
|
+
]
|
|
893
|
+
},
|
|
894
|
+
{ "type": "Control", "scope": "#/properties/name" },
|
|
895
|
+
{ "type": "Button", "slot": "footer", "label": "View partnership", "action": "viewPartner" }
|
|
896
|
+
]
|
|
845
897
|
}
|
|
846
898
|
```
|
|
847
899
|
|
|
@@ -851,14 +903,16 @@ name control and footer button.
|
|
|
851
903
|
|
|
852
904
|
`ImageView` retains its URL policy and alternative-text rules (§13.1); `Button`
|
|
853
905
|
retains the action, disabled and pending rules (§14). Authors can place any
|
|
854
|
-
supported UI-schema element in
|
|
855
|
-
|
|
906
|
+
supported UI-schema element in any region, including editable fields. A field
|
|
907
|
+
in the footer, header or cover participates in Group indicators just as a body
|
|
908
|
+
field does. Collapse and ordinary visibility rules do not exclude bindings from
|
|
909
|
+
aggregation; conditional omission still removes inactive presentation bindings.
|
|
856
910
|
|
|
857
911
|
| Option | Default | Behaviour |
|
|
858
912
|
| --- | --- | --- |
|
|
859
913
|
| `collapsible` | `false` | Enables an accessible disclosure control |
|
|
860
914
|
| `collapsed` | `false` | Initializes expansion and synchronizes it when the effective boolean changes. Ignored unless `collapsible` is true |
|
|
861
|
-
| `showDataIndicator` | `false` | Shows a data-presence indicator when at least one bound descendant contains data |
|
|
915
|
+
| `showDataIndicator` | `false` | Shows a data-presence indicator when at least one bound descendant in any region contains data |
|
|
862
916
|
| `showValidationIndicator` | `false` | Shows an aggregated descendant-error indicator. See §8.3 |
|
|
863
917
|
|
|
864
918
|
```json
|
|
@@ -1376,6 +1430,64 @@ zone renders the previous day for readers west of the meridian, which is a
|
|
|
1376
1430
|
one-day error that appears for some readers only; such a value MUST be
|
|
1377
1431
|
formatted as UTC.
|
|
1378
1432
|
|
|
1433
|
+
Numeric formatting MUST accept both CEL `int` and `double` values. In
|
|
1434
|
+
particular, JSON data numbers and integer-valued literals or computations MUST
|
|
1435
|
+
not require different authoring expressions. The portable signatures are
|
|
1436
|
+
`number(int|double): string`, `number(int|double, int): string`,
|
|
1437
|
+
`currency(int|double, string): string`, and `percent(int|double): string`;
|
|
1438
|
+
`int|double` denotes two separate overloads. The second `number` argument fixes
|
|
1439
|
+
both minimum and maximum fraction digits. CEL integer precision MUST be retained
|
|
1440
|
+
until formatting, including values outside JavaScript's safe integer range.
|
|
1441
|
+
|
|
1442
|
+
The temporal functions `date`, `time`, and `dateTime` MUST also accept CEL
|
|
1443
|
+
`google.protobuf.Timestamp` values, including a value produced by
|
|
1444
|
+
`timestamp("2026-10-01T12:30:00Z")`. A JavaScript host may supply its `Date`
|
|
1445
|
+
representation of that type. Format timestamps as instants in the viewer's time
|
|
1446
|
+
zone, using medium date, short time, or both respectively. The string overloads
|
|
1447
|
+
keep their existing calendar-date, clock-only, and timestamp semantics. This does
|
|
1448
|
+
not introduce numeric epoch overloads: a number's units cannot be inferred from
|
|
1449
|
+
its CEL type. Unparseable temporal values follow the expression-failure policy.
|
|
1450
|
+
|
|
1451
|
+
### 9.3a Portable URL-component and date-time helpers
|
|
1452
|
+
|
|
1453
|
+
Hosts evaluating the canonical CEL text-expression profile MUST expose these
|
|
1454
|
+
case-sensitive signatures, including hosts consumed through HTML or JavaScript.
|
|
1455
|
+
They are registered CEL functions, independent of JavaScript globals.
|
|
1456
|
+
|
|
1457
|
+
| Signature | Behavior |
|
|
1458
|
+
| --- | --- |
|
|
1459
|
+
| `encodeUriComponent(string): string` | Encode a single URL path segment or query value using the UTF-8 percent-encoding semantics of JavaScript `encodeURIComponent`. Encoding is locale-independent. |
|
|
1460
|
+
| `dateTime(string): string` and `dateTime(google.protobuf.Timestamp): string` | For an RFC 3339 date-time with `Z` or an explicit offset, format its instant using the active form locale, a medium date and a short time in the viewer's time zone, equivalent to `Intl.DateTimeFormat(locale, { dateStyle: 'medium', timeStyle: 'short' })`. |
|
|
1461
|
+
|
|
1462
|
+
`encodeUriComponent` MUST encode reserved delimiters such as `/`, `?`, `&`, `#`,
|
|
1463
|
+
and `=`, spaces as `%20`, and a literal `%` as `%25`. It MUST retain the same
|
|
1464
|
+
unescaped characters as `encodeURIComponent`, including `!`, `~`, `*`, apostrophes,
|
|
1465
|
+
and parentheses. It does not detect previously encoded text: `a%2Fb` becomes
|
|
1466
|
+
`a%252Fb`. An unpaired UTF-16 surrogate fails the expression. The CEL argument is
|
|
1467
|
+
string-only; use `encodeUriComponent(string(id))` for a numeric identifier.
|
|
1468
|
+
|
|
1469
|
+
For example, with declared `name` and `id` text parameters:
|
|
1470
|
+
|
|
1471
|
+
```md
|
|
1472
|
+
[{name}](#/users/{encodeUriComponent(id)})
|
|
1473
|
+
```
|
|
1474
|
+
|
|
1475
|
+
Component encoding MUST NOT replace the substitution escaping in §9.4 or the
|
|
1476
|
+
resolved-destination URL policy in §12. Parentheses and apostrophes left by
|
|
1477
|
+
component encoding still pass through the renderer's normal markup escaping.
|
|
1478
|
+
|
|
1479
|
+
`dateTime` preserves the instant represented by an offset; equivalent timestamps
|
|
1480
|
+
MUST render identically for the same locale and viewer time zone. Switching the
|
|
1481
|
+
form locale re-formats the value. The viewer's zone is a host environment input,
|
|
1482
|
+
so adapters MUST control it when comparing acceptance output across platforms;
|
|
1483
|
+
localized strings may also vary with locale-data versions. Use `date` for calendar
|
|
1484
|
+
dates and `time` for clock-only values. Values the formatter cannot parse, wrong
|
|
1485
|
+
CEL argument types, and encoding errors follow the existing expression-failure
|
|
1486
|
+
policy in §9.2; they MUST NOT take down the surrounding form.
|
|
1487
|
+
|
|
1488
|
+
The JSON cases in `conformance/cel-helpers.json` are portable adapter inputs,
|
|
1489
|
+
not evidence of execution by a renderer.
|
|
1490
|
+
|
|
1379
1491
|
### 9.4 Substitution, escaping and order
|
|
1380
1492
|
|
|
1381
1493
|
**Pipeline:** effective `textParams` → translation and message lookup →
|
|
@@ -3959,6 +4071,13 @@ latest draft is valid.
|
|
|
3959
4071
|
- **Clear supersedes queued edits**, so an old callback cannot restore the
|
|
3960
4072
|
cleared value.
|
|
3961
4073
|
|
|
4074
|
+
A completed commit may equal the value already stored in the current model. In
|
|
4075
|
+
that case, any pending contribution for that edit MUST settle without requiring
|
|
4076
|
+
a data-change event or a new data snapshot: there may be no such acknowledgement.
|
|
4077
|
+
Notify participating validity consumers when this state changes. Preserve newer
|
|
4078
|
+
queued drafts, unresolved edits and independent pending validation; completing a
|
|
4079
|
+
no-op write does not make those contributions valid.
|
|
4080
|
+
|
|
3962
4081
|
**Disposal must leave no stale write callback active**, and there are three
|
|
3963
4082
|
ways a queued write outlives its target — only one of which is disposal:
|
|
3964
4083
|
|
package/docs/todo.md
CHANGED
|
@@ -74,7 +74,7 @@ separate from the experimental descriptor schema and adapter tests.
|
|
|
74
74
|
environment snapshots and reevaluation when input namespaces change.
|
|
75
75
|
- Resolution before renderer/cell selection, parent-consumed metadata, and
|
|
76
76
|
nested/detail occurrences.
|
|
77
|
-
- Group `cover`, `header`, and `footer`
|
|
77
|
+
- Group children with `slot: "cover"`, `slot: "header"`, and `slot: "footer"` resolve through dynamic
|
|
78
78
|
dispatch. Verify region updates, the effective header Label's accessible
|
|
79
79
|
name, and preservation of the mounted body editor.
|
|
80
80
|
- Immediate draft discard on editor replacement, scope-change editing sessions,
|
|
@@ -97,7 +97,10 @@ the inner.
|
|
|
97
97
|
## Cover, header and footer
|
|
98
98
|
|
|
99
99
|
The **Card regions** tab in `uischema.json` demonstrates the optional structural
|
|
100
|
-
regions
|
|
100
|
+
regions through direct `elements` children with `slot: "cover"`,
|
|
101
|
+
`slot: "header"` and `slot: "footer"`. The header uses a VerticalLayout; the
|
|
102
|
+
footer uses a HorizontalLayout for its labels and actions. No Group-level
|
|
103
|
+
`slots` mapping is needed, and unslotted children form the body. A self-contained courtyard photograph fills the 800px-wide card cover.
|
|
101
104
|
Two authored header Labels provide the title and smaller supporting text. The
|
|
102
105
|
footer follows the body with space on both sides of its divider.
|
|
103
106
|
The group starts
|
|
@@ -110,6 +113,28 @@ buttons use ordinary action dispatch and enabled/read-only behavior. The two
|
|
|
110
113
|
buttons select English or Bulgarian through the demo host's `setLocale` action.
|
|
111
114
|
The card's width limit comes from its parent VerticalLayout item constraint.
|
|
112
115
|
|
|
116
|
+
### Repeated and unknown slot names
|
|
117
|
+
|
|
118
|
+
Author one child per region, wrapping several items in a layout when needed.
|
|
119
|
+
If a region is assigned more than once, its first authored child fills it and
|
|
120
|
+
later matches stay in the body. An unknown name also stays in the body:
|
|
121
|
+
|
|
122
|
+
```json
|
|
123
|
+
{
|
|
124
|
+
"type": "Group",
|
|
125
|
+
"elements": [
|
|
126
|
+
{ "type": "Label", "slot": "header", "text": "Heading" },
|
|
127
|
+
{ "type": "Label", "slot": "header", "text": "Body first" },
|
|
128
|
+
{ "type": "Label", "slot": "bottom", "text": "Body second" },
|
|
129
|
+
{ "type": "Label", "text": "Body third" }
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
This produces one heading and three body elements, each rendered once. Hiding
|
|
135
|
+
the first header does not move the second Label out of the body. These are
|
|
136
|
+
portable acceptance expectations; renderer adapters must verify them.
|
|
137
|
+
|
|
113
138
|
## Not covered: `collapsed` driven from data
|
|
114
139
|
|
|
115
140
|
§8's worked example binds `collapsed` through `$dynamic`:
|
|
@@ -142,8 +167,22 @@ required by this package.
|
|
|
142
167
|
|
|
143
168
|
## Feature navigation
|
|
144
169
|
|
|
145
|
-
Explore one feature at a time using the tabs: **Identity group**, **Contact group**, **Insurance group**, **Audit group**, **False and zero**, and **
|
|
170
|
+
Explore one feature at a time using the tabs: **Identity group**, **Contact group**, **Insurance group**, **Audit group**, **False and zero**, **Card regions**, and **Region bindings**. Tab titles are localized in English and Bulgarian. The tabs share the existing form data.
|
|
146
171
|
|
|
147
172
|
## Consolidated demo coverage
|
|
148
173
|
|
|
149
174
|
The False and zero tab starts collapsed with `false` and `0`: both count as present data.
|
|
175
|
+
|
|
176
|
+
## Indicators include fields in every region
|
|
177
|
+
|
|
178
|
+
The **Region bindings** tab has its only bound Control in the footer. That note
|
|
179
|
+
is required, so clearing or removing its value remains invalid. It starts
|
|
180
|
+
collapsed with a populated valid value, so the data indicator appears even though
|
|
181
|
+
the body has no bound fields. Open it and enter `x`: data and error indicators
|
|
182
|
+
appear. Clear the value: only the error indicator remains. Collapsing the Group
|
|
183
|
+
does not remove those signals. The header/body Labels are presentation only.
|
|
184
|
+
The same binding participation applies to header and cover Controls, unslotted
|
|
185
|
+
children and unknown-slot fallback children (including `slot: "body"`).
|
|
186
|
+
|
|
187
|
+
This is a portable acceptance example; the spec validates its assets, while
|
|
188
|
+
renderer adapters must execute the interactions above.
|
|
@@ -27,7 +27,11 @@
|
|
|
27
27
|
"regions.tab.label": "Card regions",
|
|
28
28
|
"regions.footer.text": "Preview language",
|
|
29
29
|
"regions.header.title.text": "Hospitality partner",
|
|
30
|
-
"regions.header.description.text": "Verified service partner · Member since 2018"
|
|
30
|
+
"regions.header.description.text": "Verified service partner · Member since 2018",
|
|
31
|
+
"featureNavigation.regionBindings.label": "Region bindings",
|
|
32
|
+
"regionBindings.heading.text": "Field in the footer",
|
|
33
|
+
"regionBindings.body.text": "The body contains no bound fields.",
|
|
34
|
+
"regionNote.label": "Footer note"
|
|
31
35
|
},
|
|
32
36
|
"bg": {
|
|
33
37
|
"group.dataIndicator": "Съдържа данни",
|
|
@@ -57,6 +61,10 @@
|
|
|
57
61
|
"regions.tab.label": "Секции на картата",
|
|
58
62
|
"regions.footer.text": "Език на прегледа",
|
|
59
63
|
"regions.header.title.text": "Партньор в хотелиерството",
|
|
60
|
-
"regions.header.description.text": "Проверен партньор · Член от 2018 г."
|
|
64
|
+
"regions.header.description.text": "Проверен партньор · Член от 2018 г.",
|
|
65
|
+
"featureNavigation.regionBindings.label": "Полета в областите",
|
|
66
|
+
"regionBindings.heading.text": "Поле в долната част",
|
|
67
|
+
"regionBindings.body.text": "Основната част не съдържа свързани полета.",
|
|
68
|
+
"regionNote.label": "Бележка в долната част"
|
|
61
69
|
}
|
|
62
70
|
}
|