@chobantonov/jsonforms-extended-spec 0.0.0-stage → 0.3.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/LICENSE +21 -0
- package/README.md +126 -2
- package/conformance/authoring.json +2680 -0
- package/conformance/behavior.json +1602 -0
- package/conformance/config-consumption.json +1542 -0
- package/conformance/expected-invalid.json +20 -0
- package/docs/audit.md +150 -0
- package/docs/conditional-fields.md +122 -0
- package/docs/draft-07-visual-support.md +43 -0
- package/docs/external-resources-proposal.md +536 -0
- package/docs/implementation-guide.md +233 -0
- package/docs/implementation-pitfalls.md +968 -0
- package/docs/implementation-web-typescript.md +41 -0
- package/docs/renderer-and-demo.md +1347 -0
- package/docs/renderer-selection.md +99 -0
- package/docs/spec.md +8470 -0
- package/docs/todo.md +166 -0
- package/examples/README.md +127 -0
- package/examples/additional-errors/README.md +176 -0
- package/examples/additional-errors/config.json +3 -0
- package/examples/additional-errors/data.json +11 -0
- package/examples/additional-errors/schema.json +56 -0
- package/examples/additional-errors/translations.json +64 -0
- package/examples/additional-errors/uischema.json +158 -0
- package/examples/additional-items-pagination/README.md +8 -0
- package/examples/additional-items-pagination/config.json +10 -0
- package/examples/additional-items-pagination/data.json +22 -0
- package/examples/additional-items-pagination/schema.json +30 -0
- package/examples/additional-items-pagination/translations.json +16 -0
- package/examples/additional-items-pagination/uischema.json +39 -0
- package/examples/additional-properties/README.md +203 -0
- package/examples/additional-properties/config.json +5 -0
- package/examples/additional-properties/data.json +31 -0
- package/examples/additional-properties/schema.json +78 -0
- package/examples/additional-properties/translations.json +80 -0
- package/examples/additional-properties/uischema.json +104 -0
- package/examples/ag-grid/README.md +62 -0
- package/examples/ag-grid/config.json +14 -0
- package/examples/ag-grid/data.json +124 -0
- package/examples/ag-grid/schema.json +48 -0
- package/examples/ag-grid/translations.json +58 -0
- package/examples/ag-grid/uischema.json +671 -0
- package/examples/array-choices/README.md +150 -0
- package/examples/array-choices/config.json +4 -0
- package/examples/array-choices/data.json +10 -0
- package/examples/array-choices/schema.json +68 -0
- package/examples/array-choices/translations.json +64 -0
- package/examples/array-choices/uischema.json +97 -0
- package/examples/array-controls/README.md +237 -0
- package/examples/array-controls/config.json +4 -0
- package/examples/array-controls/data.json +147 -0
- package/examples/array-controls/schema.json +374 -0
- package/examples/array-controls/translations.json +186 -0
- package/examples/array-controls/uischema.json +685 -0
- package/examples/array-detail-modes/README.md +11 -0
- package/examples/array-detail-modes/data.json +38 -0
- package/examples/array-detail-modes/schema.json +89 -0
- package/examples/array-detail-modes/translations.json +36 -0
- package/examples/array-detail-modes/uischema.json +73 -0
- package/examples/array-detail-modes/uischemas.d.mts +2 -0
- package/examples/array-detail-modes/uischemas.json +15 -0
- package/examples/boolean-controls/README.md +109 -0
- package/examples/boolean-controls/config.json +3 -0
- package/examples/boolean-controls/data.json +27 -0
- package/examples/boolean-controls/schema.json +98 -0
- package/examples/boolean-controls/translations.json +94 -0
- package/examples/boolean-controls/uischema.json +126 -0
- package/examples/button-actions/README.md +259 -0
- package/examples/button-actions/config.json +7 -0
- package/examples/button-actions/data.json +5 -0
- package/examples/button-actions/host.mjs +14 -0
- package/examples/button-actions/schema.json +20 -0
- package/examples/button-actions/translations.json +60 -0
- package/examples/button-actions/uischema.json +179 -0
- package/examples/catalog.json +634 -0
- package/examples/categorization/README.md +132 -0
- package/examples/categorization/config.json +7 -0
- package/examples/categorization/data.json +8 -0
- package/examples/categorization/schema.json +29 -0
- package/examples/categorization/translations.json +72 -0
- package/examples/categorization/uischema.json +288 -0
- package/examples/choice-controls/README.md +136 -0
- package/examples/choice-controls/config.json +10 -0
- package/examples/choice-controls/data.json +61 -0
- package/examples/choice-controls/schema.json +406 -0
- package/examples/choice-controls/translations.json +154 -0
- package/examples/choice-controls/uischema.json +575 -0
- package/examples/choice-controls/uischemas.d.mts +2 -0
- package/examples/choice-controls/uischemas.json +16 -0
- package/examples/code-editor/README.md +74 -0
- package/examples/code-editor/data.json +8 -0
- package/examples/code-editor/schema.json +28 -0
- package/examples/code-editor/translations.json +20 -0
- package/examples/code-editor/uischema.json +77 -0
- package/examples/collection-pagination/README.md +5 -0
- package/examples/collection-pagination/config.json +1 -0
- package/examples/collection-pagination/data.json +64 -0
- package/examples/collection-pagination/schema.json +23 -0
- package/examples/collection-pagination/translations.json +14 -0
- package/examples/collection-pagination/uischema.json +14 -0
- package/examples/color-control/README.md +154 -0
- package/examples/color-control/config.json +7 -0
- package/examples/color-control/data.json +11 -0
- package/examples/color-control/schema.json +61 -0
- package/examples/color-control/translations.json +76 -0
- package/examples/color-control/uischema.json +106 -0
- package/examples/combinators/README.md +223 -0
- package/examples/combinators/config.json +9 -0
- package/examples/combinators/data.json +23 -0
- package/examples/combinators/schema.json +232 -0
- package/examples/combinators/translations.json +178 -0
- package/examples/combinators/uischema.json +158 -0
- package/examples/conditional-fields/README.md +27 -0
- package/examples/conditional-fields/config.json +5 -0
- package/examples/conditional-fields/data.json +7 -0
- package/examples/conditional-fields/schema.json +59 -0
- package/examples/conditional-fields/translations.json +32 -0
- package/examples/conditional-fields/uischema.json +131 -0
- package/examples/container-validation-indicator/README.md +187 -0
- package/examples/container-validation-indicator/config.json +9 -0
- package/examples/container-validation-indicator/data.json +68 -0
- package/examples/container-validation-indicator/schema.json +222 -0
- package/examples/container-validation-indicator/translations.json +120 -0
- package/examples/container-validation-indicator/uischema.json +98 -0
- package/examples/cron-control/README.md +155 -0
- package/examples/cron-control/data.json +15 -0
- package/examples/cron-control/schema.json +72 -0
- package/examples/cron-control/translations.json +80 -0
- package/examples/cron-control/uischema.json +91 -0
- package/examples/destructive-confirmation/README.md +210 -0
- package/examples/destructive-confirmation/config.json +17 -0
- package/examples/destructive-confirmation/data.json +86 -0
- package/examples/destructive-confirmation/schema.json +204 -0
- package/examples/destructive-confirmation/translations.json +112 -0
- package/examples/destructive-confirmation/uischema.json +105 -0
- package/examples/draft-07-metaschema/README.md +11 -0
- package/examples/draft-07-metaschema/config.json +3 -0
- package/examples/draft-07-metaschema/data.json +25 -0
- package/examples/draft-07-metaschema/schema.json +172 -0
- package/examples/draft-07-metaschema/translations.json +10 -0
- package/examples/draft-07-metaschema/uischema.json +14 -0
- package/examples/dynamic-playground/README.md +95 -0
- package/examples/dynamic-playground/config.json +8 -0
- package/examples/dynamic-playground/configuration.json +152 -0
- package/examples/dynamic-playground/data.json +15 -0
- package/examples/dynamic-playground/dynamic-uischema.json +379 -0
- package/examples/dynamic-playground/host.mjs +37 -0
- package/examples/dynamic-playground/schema.json +48 -0
- package/examples/dynamic-playground/translations.json +76 -0
- package/examples/dynamic-playground/uischema.json +36 -0
- package/examples/editor-details/README.md +10 -0
- package/examples/editor-details/data.json +18 -0
- package/examples/editor-details/schema.json +49 -0
- package/examples/editor-details/translations.json +28 -0
- package/examples/editor-details/uischema.json +53 -0
- package/examples/editor-details/uischemas.d.mts +2 -0
- package/examples/editor-details/uischemas.json +14 -0
- package/examples/file-control/README.md +108 -0
- package/examples/file-control/data.json +28 -0
- package/examples/file-control/schema.json +89 -0
- package/examples/file-control/translations.json +46 -0
- package/examples/file-control/uischema.json +152 -0
- package/examples/group-layout/README.md +149 -0
- package/examples/group-layout/config.json +10 -0
- package/examples/group-layout/data.json +9 -0
- package/examples/group-layout/schema.json +51 -0
- package/examples/group-layout/translations.json +62 -0
- package/examples/group-layout/uischema.json +249 -0
- package/examples/index.d.ts +17 -0
- package/examples/index.js +69 -0
- package/examples/input-adornments/README.md +68 -0
- package/examples/input-adornments/data.json +41 -0
- package/examples/input-adornments/schema.json +207 -0
- package/examples/input-adornments/translations.json +106 -0
- package/examples/input-adornments/uischema.json +695 -0
- package/examples/job-application/README.md +23 -0
- package/examples/job-application/config.json +10 -0
- package/examples/job-application/data.json +68 -0
- package/examples/job-application/schema.json +196 -0
- package/examples/job-application/translations.json +388 -0
- package/examples/job-application/uischema.json +218 -0
- package/examples/job-application/uischemas.json +153 -0
- package/examples/json-editor/README.md +28 -0
- package/examples/json-editor/schema.json +1 -0
- package/examples/json-editor/translations.json +10 -0
- package/examples/json-editor/uischema.json +16 -0
- package/examples/json-inference/README.md +33 -0
- package/examples/json-inference/translations.json +10 -0
- package/examples/json-inference/uischema.json +16 -0
- package/examples/kitchen-sink/README.md +86 -0
- package/examples/kitchen-sink/config.json +14 -0
- package/examples/kitchen-sink/data.json +263 -0
- package/examples/kitchen-sink/invalid-data.json +263 -0
- package/examples/kitchen-sink/schema.json +515 -0
- package/examples/kitchen-sink/translations.json +270 -0
- package/examples/kitchen-sink/uischema.json +722 -0
- package/examples/label-interpolation/README.md +241 -0
- package/examples/label-interpolation/config.json +14 -0
- package/examples/label-interpolation/data.json +13 -0
- package/examples/label-interpolation/schema.json +64 -0
- package/examples/label-interpolation/translations.json +94 -0
- package/examples/label-interpolation/uischema.json +379 -0
- package/examples/layout-sizing/README.md +162 -0
- package/examples/layout-sizing/config.json +10 -0
- package/examples/layout-sizing/data.json +14 -0
- package/examples/layout-sizing/schema.json +58 -0
- package/examples/layout-sizing/translations.json +42 -0
- package/examples/layout-sizing/uischema.json +558 -0
- package/examples/markup-label/README.md +109 -0
- package/examples/markup-label/config.json +16 -0
- package/examples/markup-label/data.json +5 -0
- package/examples/markup-label/schema.json +24 -0
- package/examples/markup-label/translations.json +40 -0
- package/examples/markup-label/uischema.json +149 -0
- package/examples/mixed-control/README.md +164 -0
- package/examples/mixed-control/config.json +11 -0
- package/examples/mixed-control/data.json +70 -0
- package/examples/mixed-control/schema.json +221 -0
- package/examples/mixed-control/translations.json +158 -0
- package/examples/mixed-control/uischema.json +211 -0
- package/examples/null-control/README.md +111 -0
- package/examples/null-control/config.json +4 -0
- package/examples/null-control/data.json +6 -0
- package/examples/null-control/schema.json +36 -0
- package/examples/null-control/translations.json +42 -0
- package/examples/null-control/uischema.json +56 -0
- package/examples/numeric-controls/README.md +94 -0
- package/examples/numeric-controls/config.json +4 -0
- package/examples/numeric-controls/data.json +8 -0
- package/examples/numeric-controls/schema.json +52 -0
- package/examples/numeric-controls/translations.json +56 -0
- package/examples/numeric-controls/uischema.json +77 -0
- package/examples/object-control/README.md +220 -0
- package/examples/object-control/config.json +4 -0
- package/examples/object-control/data.json +62 -0
- package/examples/object-control/schema.json +252 -0
- package/examples/object-control/translations.json +160 -0
- package/examples/object-control/uischema.json +275 -0
- package/examples/object-control/uischemas.d.mts +2 -0
- package/examples/object-control/uischemas.json +59 -0
- package/examples/password-control/README.md +119 -0
- package/examples/password-control/config.json +3 -0
- package/examples/password-control/data.json +18 -0
- package/examples/password-control/schema.json +65 -0
- package/examples/password-control/translations.json +64 -0
- package/examples/password-control/uischema.json +94 -0
- package/examples/pre-touch-errors/README.md +176 -0
- package/examples/pre-touch-errors/config.json +4 -0
- package/examples/pre-touch-errors/data.json +5 -0
- package/examples/pre-touch-errors/schema.json +56 -0
- package/examples/pre-touch-errors/translations.json +68 -0
- package/examples/pre-touch-errors/uischema.json +85 -0
- package/examples/presentation/README.md +148 -0
- package/examples/presentation/config.json +9 -0
- package/examples/presentation/data.json +6 -0
- package/examples/presentation/schema.json +21 -0
- package/examples/presentation/translations.json +64 -0
- package/examples/presentation/uischema.json +210 -0
- package/examples/property-pagination/README.md +5 -0
- package/examples/property-pagination/config.json +1 -0
- package/examples/property-pagination/data.json +17 -0
- package/examples/property-pagination/schema.json +14 -0
- package/examples/property-pagination/translations.json +10 -0
- package/examples/property-pagination/uischema.json +24 -0
- package/examples/recursive-tree/README.md +49 -0
- package/examples/recursive-tree/config.json +1 -0
- package/examples/recursive-tree/data.json +40 -0
- package/examples/recursive-tree/schema.json +89 -0
- package/examples/recursive-tree/translations.json +42 -0
- package/examples/recursive-tree/uischema.json +84 -0
- package/examples/recursive-tree/uischemas.d.mts +2 -0
- package/examples/recursive-tree/uischemas.json +51 -0
- package/examples/split-layout/README.md +123 -0
- package/examples/split-layout/config.json +3 -0
- package/examples/split-layout/data.json +13 -0
- package/examples/split-layout/schema.json +50 -0
- package/examples/split-layout/translations.json +50 -0
- package/examples/split-layout/uischema.json +204 -0
- package/examples/string-controls/README.md +159 -0
- package/examples/string-controls/config.json +5 -0
- package/examples/string-controls/data.json +13 -0
- package/examples/string-controls/schema.json +70 -0
- package/examples/string-controls/translations.json +76 -0
- package/examples/string-controls/uischema.json +148 -0
- package/examples/table-row-details/README.md +69 -0
- package/examples/table-row-details/config.json +7 -0
- package/examples/table-row-details/data.json +280 -0
- package/examples/table-row-details/schema.json +61 -0
- package/examples/table-row-details/translations.json +56 -0
- package/examples/table-row-details/uischema.json +1303 -0
- package/examples/template-layout/README.md +250 -0
- package/examples/template-layout/config.json +9 -0
- package/examples/template-layout/data.json +20 -0
- package/examples/template-layout/host.mjs +13 -0
- package/examples/template-layout/schema.json +48 -0
- package/examples/template-layout/translations.json +70 -0
- package/examples/template-layout/uischema.json +177 -0
- package/examples/template-slots/README.md +19 -0
- package/examples/template-slots/data.json +4 -0
- package/examples/template-slots/schema.json +11 -0
- package/examples/template-slots/translations.json +26 -0
- package/examples/template-slots/uischema.json +47 -0
- package/examples/template-slots/uischemas.d.mts +2 -0
- package/examples/template-slots/uischemas.json +56 -0
- package/examples/temporal-controls/README.md +325 -0
- package/examples/temporal-controls/data.json +44 -0
- package/examples/temporal-controls/schema.json +208 -0
- package/examples/temporal-controls/translations.json +156 -0
- package/examples/temporal-controls/uischema.json +297 -0
- package/examples/tree-max-depth/README.md +5 -0
- package/examples/tree-max-depth/config.json +3 -0
- package/examples/tree-max-depth/data.json +31 -0
- package/examples/tree-max-depth/schema.json +258 -0
- package/examples/tree-max-depth/translations.json +42 -0
- package/examples/tree-max-depth/uischema.json +16 -0
- package/examples/tree-max-depth/uischemas.d.mts +2 -0
- package/examples/tree-max-depth/uischemas.json +50 -0
- package/examples/tuple-control/README.md +335 -0
- package/examples/tuple-control/config.json +4 -0
- package/examples/tuple-control/data.json +61 -0
- package/examples/tuple-control/schema.json +218 -0
- package/examples/tuple-control/translations.json +142 -0
- package/examples/tuple-control/uischema.json +128 -0
- package/examples/tuple-control/uischemas.d.mts +2 -0
- package/examples/tuple-control/uischemas.json +125 -0
- package/examples/validator-profile/README.md +197 -0
- package/examples/validator-profile/config.json +9 -0
- package/examples/validator-profile/data.json +16 -0
- package/examples/validator-profile/schema.json +139 -0
- package/examples/validator-profile/translations.json +34 -0
- package/examples/validator-profile/uischema.json +59 -0
- package/package.json +83 -3
- package/provenance.json +140 -0
- package/schemas/README.md +82 -0
- package/schemas/example.schema.json +37 -0
- package/schemas/jsonforms-config.schema.json +427 -0
- package/schemas/jsonforms-dynamic-uischema.schema.json +220 -0
- package/schemas/jsonforms-extended-config.schema.json +332 -0
- package/schemas/jsonforms-extended-uischema.schema.json +1932 -0
- package/schemas/jsonforms-rule.schema.json +104 -0
- package/schemas/jsonforms-uischema.schema.json +1434 -0
- package/typescript/README.md +546 -0
- package/typescript/lib/authoring/cssLength.d.ts +33 -0
- package/typescript/lib/authoring/cssLength.js +25 -0
- package/typescript/lib/authoring/dynamic.d.ts +73 -0
- package/typescript/lib/authoring/dynamic.js +8 -0
- package/typescript/lib/authoring/forSchema.d.ts +385 -0
- package/typescript/lib/authoring/forSchema.js +84 -0
- package/typescript/lib/authoring/schemaTypes.d.ts +111 -0
- package/typescript/lib/authoring/schemaTypes.js +15 -0
- package/typescript/lib/index.d.ts +4 -0
- package/typescript/lib/index.js +20 -0
- package/typescript/package.json +1 -0
- package/typescript/src/authoring/cssLength.ts +79 -0
- package/typescript/src/authoring/dynamic.ts +96 -0
- package/typescript/src/authoring/forSchema.ts +428 -0
- package/typescript/src/authoring/schemaTypes.ts +143 -0
- package/typescript/src/index.ts +4 -0
- package/typescript/test/schemaContract.test.ts +638 -0
- package/typescript/test/tsconfig.json +10 -0
- package/typescript/test/typedAuthoring.test.ts +151 -0
- package/typescript/test/typedAuthoringCoverage.test.ts +178 -0
- package/typescript/test/typedAuthoringCssLength.test.ts +81 -0
- package/typescript/test/typedAuthoringNames.test.ts +90 -0
- package/typescript/test/typedDynamic.test.ts +88 -0
- package/typescript/tsconfig.json +15 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "VerticalLayout",
|
|
3
|
+
"elements": [
|
|
4
|
+
{
|
|
5
|
+
"type": "Categorization",
|
|
6
|
+
"elements": [
|
|
7
|
+
{
|
|
8
|
+
"type": "Category",
|
|
9
|
+
"label": "Checkboxes",
|
|
10
|
+
"i18n": "featureNavigation.section1",
|
|
11
|
+
"elements": [
|
|
12
|
+
{
|
|
13
|
+
"type": "Label",
|
|
14
|
+
"text": "Checkbox: the default boolean presentation"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"type": "Control",
|
|
18
|
+
"scope": "#/properties/notifications"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"type": "Control",
|
|
22
|
+
"scope": "#/properties/newsletter"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"type": "Control",
|
|
26
|
+
"scope": "#/properties/handbookAccepted"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"type": "Control",
|
|
30
|
+
"scope": "#/properties/payrollOptOut"
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"type": "Category",
|
|
36
|
+
"label": "Switch",
|
|
37
|
+
"i18n": "featureNavigation.section2",
|
|
38
|
+
"elements": [
|
|
39
|
+
{
|
|
40
|
+
"type": "Label",
|
|
41
|
+
"text": "Switch: options.toggle, not a new variant"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"type": "Control",
|
|
45
|
+
"scope": "#/properties/remoteWorker",
|
|
46
|
+
"options": {
|
|
47
|
+
"toggle": true
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"type": "Category",
|
|
54
|
+
"label": "Invalid values",
|
|
55
|
+
"i18n": "featureNavigation.section3",
|
|
56
|
+
"elements": [
|
|
57
|
+
{
|
|
58
|
+
"type": "Label",
|
|
59
|
+
"text": "Values that are not booleans at all"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"type": "Control",
|
|
63
|
+
"scope": "#/properties/legacyFlag"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"type": "Control",
|
|
67
|
+
"scope": "#/properties/importedCount",
|
|
68
|
+
"options": {
|
|
69
|
+
"toggle": true
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"type": "Category",
|
|
76
|
+
"label": "Checkbox groups",
|
|
77
|
+
"i18n": "featureNavigation.section4",
|
|
78
|
+
"elements": [
|
|
79
|
+
{
|
|
80
|
+
"type": "Label",
|
|
81
|
+
"text": "Checkbox group: membership of an array, horizontal by default"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"type": "Control",
|
|
85
|
+
"scope": "#/properties/channels"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"type": "Label",
|
|
89
|
+
"text": "The same group with options.vertical: true"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"type": "Control",
|
|
93
|
+
"scope": "#/properties/escalation",
|
|
94
|
+
"options": {
|
|
95
|
+
"vertical": true
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"type": "Category",
|
|
102
|
+
"label": "Table cells",
|
|
103
|
+
"i18n": "featureNavigation.section5",
|
|
104
|
+
"elements": [
|
|
105
|
+
{
|
|
106
|
+
"type": "Label",
|
|
107
|
+
"text": "Boolean cells: checkbox and switch in a table"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"type": "Control",
|
|
111
|
+
"scope": "#/properties/team",
|
|
112
|
+
"options": {
|
|
113
|
+
"table": true,
|
|
114
|
+
"cells": {
|
|
115
|
+
"onCall": {
|
|
116
|
+
"toggle": true
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
]
|
|
126
|
+
}
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
# Example: button actions
|
|
2
|
+
|
|
3
|
+
**Example ID:** `button-actions`\
|
|
4
|
+
**Demo entry:** **Spec: Button actions** (`#spec-button-actions`)\
|
|
5
|
+
**Domain:** a subscription sign-up\
|
|
6
|
+
**Specs covered:**
|
|
7
|
+
|
|
8
|
+
- [Button, actions and script](../../docs/spec.md#14-button-actions-and-script)
|
|
9
|
+
- [Action path and Script path](../../docs/spec.md#14-button-actions-and-script)
|
|
10
|
+
- [Internationalizable text](../../docs/spec.md#14-button-actions-and-script)
|
|
11
|
+
- [The Button contract](../../docs/spec.md#14-button-actions-and-script)
|
|
12
|
+
|
|
13
|
+
A Button does not know what its command means: it hands the command to the
|
|
14
|
+
host and waits. That is the whole example, and it has **three tabs**, because
|
|
15
|
+
a Button has three ways of being told what to do and they are not
|
|
16
|
+
interchangeable.
|
|
17
|
+
|
|
18
|
+
## Layout of the page
|
|
19
|
+
|
|
20
|
+
| Tab | The path | Portable |
|
|
21
|
+
| --- | --- | --- |
|
|
22
|
+
| **Action** | A name and some params, handed to the host. Language switching, colours, disabled, pending, and the button that declares nothing. | yes |
|
|
23
|
+
| **Script** | A string of code, run in place. Needs permission. Also the button that declares an action *and* a script. | yes |
|
|
24
|
+
| **TypeScript** | A `script` that is a **function**. Needs no permission — and cannot be serialized. | **no** |
|
|
25
|
+
|
|
26
|
+
The form's own controls sit *above* the tabs: all three tabs act on the same
|
|
27
|
+
data, so it has to stay on screen.
|
|
28
|
+
|
|
29
|
+
The tabs are not decoration. The first two come from `uischema.json` and
|
|
30
|
+
travel; the third is appended in the host registration and cannot, so the boundary is
|
|
31
|
+
something you navigate rather than something you read past. **Open the UI
|
|
32
|
+
schema panel on the TypeScript tab:** the buttons are there and their `script`
|
|
33
|
+
is not.
|
|
34
|
+
|
|
35
|
+
The language buttons live on the **Action** tab, and switching language
|
|
36
|
+
retitles the tabs themselves — they are ordinary elements taking their text
|
|
37
|
+
from the catalog.
|
|
38
|
+
|
|
39
|
+
## Files
|
|
40
|
+
|
|
41
|
+
| File | Role |
|
|
42
|
+
| --- | --- |
|
|
43
|
+
| `schema.json` | Three ordinary properties, so there is a form to act on. |
|
|
44
|
+
| `uischema.json` | The **Action** and **Script** tabs: everything a Button can express portably, plain JSON, unchanged over the wire. |
|
|
45
|
+
| `data.json` | A filled-in sign-up. |
|
|
46
|
+
| `config.json` | `allowScriptEvaluation: true`, for the string script button only. |
|
|
47
|
+
| `translations.json` | English and Bulgarian — the catalogs the buttons switch between, including the tab labels. |
|
|
48
|
+
|
|
49
|
+
## Changing the language
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{ "type": "Button", "label": "Български", "action": "setLocale", "params": { "locale": "bg" } }
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Press it and every label, message and piece of help text comes back in
|
|
56
|
+
Bulgarian — including the buttons themselves, which are ordinary elements and
|
|
57
|
+
take their own text from the catalog through `i18n`.
|
|
58
|
+
|
|
59
|
+
**`params` is what makes this one command.** Without it the schema would need
|
|
60
|
+
a `setLocaleBg` action and the host a branch per language. With it, the host
|
|
61
|
+
handles `setLocale` once:
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
const handleAction = (event: ActionEvent) => {
|
|
65
|
+
if (event.action === 'setLocale' && typeof event.params?.locale === 'string') {
|
|
66
|
+
setLocale(event.params.locale);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
That is the entire host side, and it is what the demo application does.
|
|
72
|
+
|
|
73
|
+
### What the renderer does and does not do
|
|
74
|
+
|
|
75
|
+
The renderer **fires the event and awaits it**. It does not know what
|
|
76
|
+
`setLocale` means, it does not change the locale itself, and it does not touch
|
|
77
|
+
the form data. A Button invokes a command; a `Link` navigates; neither is a
|
|
78
|
+
way to spell the other.
|
|
79
|
+
|
|
80
|
+
While the promise is outstanding the button is **pending**: it shows a
|
|
81
|
+
spinner, reports `aria-busy`, and **refuses a second activation**. Press it
|
|
82
|
+
three times quickly and the host is called once. When the promise settles —
|
|
83
|
+
including when it rejects — pending clears and the button works again.
|
|
84
|
+
|
|
85
|
+
## Colours are semantic
|
|
86
|
+
|
|
87
|
+
`color` takes one of `primary`, `secondary`, `alternative`, `success`,
|
|
88
|
+
`warning`, `error`. They are names for *intent*, not paint: the renderer set
|
|
89
|
+
maps them onto its own component's semantic styling.
|
|
90
|
+
|
|
91
|
+
## Everything a Button can do
|
|
92
|
+
|
|
93
|
+
| Case | Tab | What to look for |
|
|
94
|
+
| --- | --- | --- |
|
|
95
|
+
| `action` with `params` | Action | The two language buttons; one command, two arguments |
|
|
96
|
+
| `action` alone | Action | Submit / Reset / Discard |
|
|
97
|
+
| `color` | Action | The semantic names, mapped by the renderer set |
|
|
98
|
+
| `options.disabled` | Action | **Unavailable** — still readable, fires nothing |
|
|
99
|
+
| A slow `action` | Action | **Submit slowly** — spinner, and a second press is refused |
|
|
100
|
+
| Neither | Action | **Declares neither** — still fires, with an empty action |
|
|
101
|
+
| `script` as a string | Script | **Log the form data** — needs permission |
|
|
102
|
+
| `action` **and** `script` | Script | **Declares both** — the action runs, the console warns |
|
|
103
|
+
| `script` as a function | TypeScript | **Arrow function**, **Classic function**, **Async function** |
|
|
104
|
+
|
|
105
|
+
The last row is the only one that is not in `uischema.json`, and that is the
|
|
106
|
+
point — see below.
|
|
107
|
+
|
|
108
|
+
**Why "Declares neither" is on the Action tab and "Declares both" is on the
|
|
109
|
+
Script tab.** A button with nothing declared still takes the action path, with
|
|
110
|
+
an empty action; a button with both is a question about *precedence*, which
|
|
111
|
+
only arises once a script is in the picture.
|
|
112
|
+
|
|
113
|
+
## The script path
|
|
114
|
+
|
|
115
|
+
```json
|
|
116
|
+
{ "type": "Button", "label": "Log the form data", "script": "console.log(this.context.core.data);" }
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
A **string** `script` is an async function body, invoked with the ActionEvent
|
|
120
|
+
as `this`. So `this.context`, `this.params` and `this.element` are reachable,
|
|
121
|
+
and top-level `await` works. It runs directly and never reaches the host.
|
|
122
|
+
|
|
123
|
+
It needs permission: `config.json` grants
|
|
124
|
+
`jsonformsExtended.security.allowScriptEvaluation`, and without it the button
|
|
125
|
+
is replaced by a message naming the key. The renderer reports the refusal
|
|
126
|
+
rather than weakening CSP. The specification calls script "a last-resort,
|
|
127
|
+
non-portable runtime escape hatch", and this example is the one place it
|
|
128
|
+
appears.
|
|
129
|
+
|
|
130
|
+
### Or a function, for a model authored in TypeScript
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
script: (event) => log(`saw ${JSON.stringify(event.params)}`)
|
|
134
|
+
script: function () { log(`saw ${JSON.stringify(this.params)}`); }
|
|
135
|
+
script: async () => { await save(); }
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
The event arrives as an **argument**, and `this` is bound as well. Both, on
|
|
139
|
+
purpose: `.call()` cannot bind an arrow function's `this` — it is lexical — so
|
|
140
|
+
an idiomatic `() => this.context` would compile, run and read `undefined` with
|
|
141
|
+
no diagnostic. Passing it as an argument costs one word and makes the mistake
|
|
142
|
+
unreachable, while binding `this` keeps a body pasted over from the string
|
|
143
|
+
form working.
|
|
144
|
+
|
|
145
|
+
**A function needs no `allowScriptEvaluation`.** That permission exists
|
|
146
|
+
because compiling a string needs CSP `unsafe-eval`; a function the build
|
|
147
|
+
already compiled needs nothing of the sort. The three buttons at the bottom of
|
|
148
|
+
the form run with the permission removed, while the string one is refused.
|
|
149
|
+
|
|
150
|
+
### `action` wins when an element declares both
|
|
151
|
+
|
|
152
|
+
Section 14 states the exclusivity without saying which takes precedence,
|
|
153
|
+
because carrying both is an authoring mistake — so the question is which
|
|
154
|
+
failure is least harmful.
|
|
155
|
+
|
|
156
|
+
An action goes to the host's handler, where it can be logged, refused or
|
|
157
|
+
authorised. A script runs arbitrary code with no such oversight, and the
|
|
158
|
+
section itself calls it "a last-resort, non-portable runtime escape hatch".
|
|
159
|
+
And if a JSON form carries a string script while the host has not granted the
|
|
160
|
+
permission, the script cannot run **at all** — so any other precedence would
|
|
161
|
+
make the button dead rather than merely surprising.
|
|
162
|
+
|
|
163
|
+
The conflict is a **console warning**, not a rendered message: replacing the
|
|
164
|
+
button would break a form that works today the moment somebody adds a stray
|
|
165
|
+
`action`. In TypeScript it cannot be written at all:
|
|
166
|
+
|
|
167
|
+
```ts
|
|
168
|
+
const bad = {
|
|
169
|
+
type: 'Button',
|
|
170
|
+
label: 'Both',
|
|
171
|
+
action: 'submit',
|
|
172
|
+
script: () => log('never runs'),
|
|
173
|
+
} satisfies ButtonUiSchema;
|
|
174
|
+
|
|
175
|
+
// Type '{ type: "Button"; … }' is not assignable to type
|
|
176
|
+
// '{ action?: never; script?: never; }'.
|
|
177
|
+
// Types of property 'action' are incompatible.
|
|
178
|
+
// Type 'string' is not assignable to type 'never'.
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### The script's signature comes from the type
|
|
182
|
+
|
|
183
|
+
`satisfies ButtonUiSchema` is what makes the TypeScript form worth having.
|
|
184
|
+
It checks the element *and* contextually types the script, so the event is
|
|
185
|
+
inferred rather than annotated:
|
|
186
|
+
|
|
187
|
+
```ts
|
|
188
|
+
const arrowScript = {
|
|
189
|
+
type: 'Button',
|
|
190
|
+
label: 'Arrow function',
|
|
191
|
+
params: { tier: 'express' },
|
|
192
|
+
script: (event) => log(`arrow saw ${JSON.stringify(event.params)}`),
|
|
193
|
+
// ^ ActionEvent, inferred
|
|
194
|
+
} satisfies ButtonUiSchema;
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Write `event.noSuchField` and the compiler says *Property 'noSuchField' does
|
|
198
|
+
not exist on type 'ActionEvent'* — the signature is known, not described.
|
|
199
|
+
|
|
200
|
+
## The portable boundary
|
|
201
|
+
|
|
202
|
+
`uischema.json` is the **Action** and **Script** tabs. The **TypeScript** tab
|
|
203
|
+
is appended in the host registration as a whole `Category`, because section 14 allows a
|
|
204
|
+
function-valued `script` only for a model held in memory: "an in-memory JS/TS
|
|
205
|
+
UI model can carry them directly while JSON serialization cannot."
|
|
206
|
+
|
|
207
|
+
A whole tab rather than a few more buttons, on purpose. The portable half stays
|
|
208
|
+
a complete, valid form on its own — delete the host registration's contribution and
|
|
209
|
+
`uischema.json` still renders two working tabs — and a reader cannot drift from
|
|
210
|
+
what travels to what does not without noticing they changed tab.
|
|
211
|
+
|
|
212
|
+
**Open the UI schema panel on that tab.** The three buttons are there and their
|
|
213
|
+
`script` is not — `JSON.stringify` drops a function silently. That is the
|
|
214
|
+
boundary, shown rather than described: the JSON half can be sent to another
|
|
215
|
+
renderer set on another platform; the TypeScript half cannot leave this build.
|
|
216
|
+
|
|
217
|
+
The tab is located **structurally**, by finding the `Categorization` rather
|
|
218
|
+
than by indexing into `elements`, so reordering `uischema.json` cannot silently
|
|
219
|
+
attach it to the wrong parent.
|
|
220
|
+
|
|
221
|
+
## Expected behaviour
|
|
222
|
+
|
|
223
|
+
| Action | Result |
|
|
224
|
+
| --- | --- |
|
|
225
|
+
| Press **Български** | The whole form re-renders in Bulgarian, tab labels included. |
|
|
226
|
+
| Press **English** | And back again. |
|
|
227
|
+
| Press a button three times quickly | The host is called once. |
|
|
228
|
+
| Press **Discard** | `discard` reaches the host; the colour is the only thing the renderer decided. |
|
|
229
|
+
| Press **Unavailable** | Nothing. It is disabled, and still readable. |
|
|
230
|
+
| Press **Log the form data** | The data appears in the console; the host is not called. |
|
|
231
|
+
| Remove `allowScriptEvaluation` | The **Script** tab's button is replaced by an explanation; the **TypeScript** tab keeps working. |
|
|
232
|
+
| Press **Submit slowly** twice | The second press does nothing while the first is outstanding. |
|
|
233
|
+
| Press **Declares both** | `submit` reaches the host; the console warns `action.conflict`. |
|
|
234
|
+
| Press **Declares neither** | An event with an empty action still reaches the host. |
|
|
235
|
+
| Press **Async function** | A spinner for as long as the promise is outstanding. |
|
|
236
|
+
|
|
237
|
+
## Fallback behaviour
|
|
238
|
+
|
|
239
|
+
| Situation | Result |
|
|
240
|
+
| --- | --- |
|
|
241
|
+
| No `action`, no `script` | The stable element `name` is used; without it the action name is empty. |
|
|
242
|
+
| No host handler registered | The press is a no-op; pending still clears. |
|
|
243
|
+
| Host rejects | Pending clears and the rejection propagates to the application's error handling. |
|
|
244
|
+
| `options.action` / `options.label` | Still read, below the top-level fields. |
|
|
245
|
+
| Both `action` and `script` | `action.conflict`, and neither runs. |
|
|
246
|
+
|
|
247
|
+
## Conformance scope
|
|
248
|
+
|
|
249
|
+
This walkthrough describes the portable contract. Renderer support must be checked
|
|
250
|
+
by a host adapter; the package validates the authored assets, not live UI behavior.
|
|
251
|
+
|
|
252
|
+
## Standalone host setup
|
|
253
|
+
|
|
254
|
+
- Handle named actions. String scripts require explicit permission. Native function demonstrations are in host.mjs.
|
|
255
|
+
|
|
256
|
+
The optional [host.mjs](host.mjs) demonstrates native in-memory values.
|
|
257
|
+
Those functions have no JSON representation; keep them in trusted host code.
|
|
258
|
+
|
|
259
|
+
The language buttons demonstrate `options.fullWidth: true` inside equal `options.layout.span: 6` cells of a twelve-column layout. The other buttons retain intrinsic width.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Trusted, UI-library-independent native function demonstrations.
|
|
2
|
+
* Append this category to the fixture's Categorization in a JavaScript host.
|
|
3
|
+
* JSON.stringify cannot preserve these functions; do not serialize this model.
|
|
4
|
+
*/
|
|
5
|
+
export function nativeButtonCategory(log) {
|
|
6
|
+
return {
|
|
7
|
+
type: 'Category', name: 'native', label: 'Native functions',
|
|
8
|
+
elements: [
|
|
9
|
+
{ type: 'Button', label: 'Arrow function', params: { tier: 'express' }, script: event => log(event.params) },
|
|
10
|
+
{ type: 'Button', label: 'Classic function', params: { tier: 'standard' }, script: function () { log(this.params); } },
|
|
11
|
+
{ type: 'Button', label: 'Async function', script: async event => { await log(event.params); } }
|
|
12
|
+
]
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "object",
|
|
3
|
+
"properties": {
|
|
4
|
+
"fullName": {
|
|
5
|
+
"type": "string",
|
|
6
|
+
"title": "Full name"
|
|
7
|
+
},
|
|
8
|
+
"email": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"title": "Email address"
|
|
11
|
+
},
|
|
12
|
+
"newsletter": {
|
|
13
|
+
"type": "boolean",
|
|
14
|
+
"title": "Send me the newsletter"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"required": [
|
|
18
|
+
"fullName"
|
|
19
|
+
]
|
|
20
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"en": {
|
|
3
|
+
"intro.text": "A Button invokes a command. It does not know what the command means - it hands it to the host and waits.",
|
|
4
|
+
"actionTab.label": "Action",
|
|
5
|
+
"scriptTab.label": "Script",
|
|
6
|
+
"typescriptTab.label": "TypeScript",
|
|
7
|
+
"locale.text": "These two buttons change the language of the form around them - including the tab labels above.",
|
|
8
|
+
"colours.text": "Colours are semantic names, not paint: the theme decides what each one looks like.",
|
|
9
|
+
"disabled.text": "A disabled button still says what it would do.",
|
|
10
|
+
"script.text": "A script button runs a string. It only works because this example grants permission.",
|
|
11
|
+
"submit.label": "Submit",
|
|
12
|
+
"reset.label": "Reset",
|
|
13
|
+
"discard.label": "Discard",
|
|
14
|
+
"error.required": "Enter a full name.",
|
|
15
|
+
"slow.text": "A slow command: the button shows a spinner and refuses a second press until it finishes.",
|
|
16
|
+
"conflict.text": "Declares an action and a script. The action wins, and the console says so.",
|
|
17
|
+
"neither.text": "Declares neither. It still fires an event, with an empty action, rather than being a dead control.",
|
|
18
|
+
"typescript.text": "Scripts written as TypeScript functions. They need no permission, and they cannot be serialized - look for them in the UI schema panel and they are not there.",
|
|
19
|
+
"unavailable.label": "Unavailable",
|
|
20
|
+
"slowButton.label": "Submit slowly",
|
|
21
|
+
"neitherButton.label": "Declares neither",
|
|
22
|
+
"logButton.label": "Log the form data",
|
|
23
|
+
"bothButton.label": "Declares both",
|
|
24
|
+
"nativeArrow.label": "Arrow function",
|
|
25
|
+
"nativeClassic.label": "Classic function",
|
|
26
|
+
"nativeAsync.label": "Async function",
|
|
27
|
+
"fullName.label": "Full name",
|
|
28
|
+
"email.label": "Email",
|
|
29
|
+
"newsletter.label": "Newsletter"
|
|
30
|
+
},
|
|
31
|
+
"bg": {
|
|
32
|
+
"intro.text": "Бутонът изпълнява команда. Той не знае какво означава тя - подава я на приложението и изчаква.",
|
|
33
|
+
"actionTab.label": "Действие",
|
|
34
|
+
"scriptTab.label": "Скрипт",
|
|
35
|
+
"typescriptTab.label": "TypeScript",
|
|
36
|
+
"locale.text": "Тези два бутона сменят езика на формуляра около тях - включително надписите на разделите отгоре.",
|
|
37
|
+
"colours.text": "Цветовете са смислови имена, а не боя: темата решава как изглежда всеки от тях.",
|
|
38
|
+
"disabled.text": "Деактивираният бутон все пак казва какво би направил.",
|
|
39
|
+
"script.text": "Бутонът със скрипт изпълнява низ. Работи само защото този пример дава разрешение.",
|
|
40
|
+
"submit.label": "Изпращане",
|
|
41
|
+
"reset.label": "Изчистване",
|
|
42
|
+
"discard.label": "Отхвърляне",
|
|
43
|
+
"error.required": "Въведете пълно име.",
|
|
44
|
+
"slow.text": "Бавна команда: бутонът показва индикатор и отказва второ натискане, докато не приключи.",
|
|
45
|
+
"conflict.text": "Декларира действие и скрипт. Действието печели, а конзолата го отбелязва.",
|
|
46
|
+
"neither.text": "Не декларира нито едното. Все пак изпраща събитие с празно действие, вместо да е мъртъв бутон.",
|
|
47
|
+
"typescript.text": "Скриптове, написани като функции на TypeScript. Не изискват разрешение и не могат да се сериализират - в панела с UI схемата ги няма.",
|
|
48
|
+
"unavailable.label": "Недостъпно",
|
|
49
|
+
"slowButton.label": "Бавно изпращане",
|
|
50
|
+
"neitherButton.label": "Без зададена команда",
|
|
51
|
+
"logButton.label": "Извеждане на данните в конзолата",
|
|
52
|
+
"bothButton.label": "Действие и скрипт",
|
|
53
|
+
"nativeArrow.label": "Стрелкова функция",
|
|
54
|
+
"nativeClassic.label": "Обикновена функция",
|
|
55
|
+
"nativeAsync.label": "Асинхронна функция",
|
|
56
|
+
"fullName.label": "Пълно име",
|
|
57
|
+
"email.label": "Имейл",
|
|
58
|
+
"newsletter.label": "Бюлетин"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "VerticalLayout",
|
|
3
|
+
"options": {
|
|
4
|
+
"gap": "1rem"
|
|
5
|
+
},
|
|
6
|
+
"elements": [
|
|
7
|
+
{
|
|
8
|
+
"type": "Label",
|
|
9
|
+
"i18n": "intro"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"type": "Control",
|
|
13
|
+
"scope": "#/properties/fullName"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"type": "Control",
|
|
17
|
+
"scope": "#/properties/email"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"type": "Control",
|
|
21
|
+
"scope": "#/properties/newsletter"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"type": "Categorization",
|
|
25
|
+
"elements": [
|
|
26
|
+
{
|
|
27
|
+
"type": "Category",
|
|
28
|
+
"name": "action",
|
|
29
|
+
"i18n": "actionTab",
|
|
30
|
+
"label": "Action",
|
|
31
|
+
"elements": [
|
|
32
|
+
{
|
|
33
|
+
"type": "Label",
|
|
34
|
+
"i18n": "locale"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"type": "HorizontalLayout",
|
|
38
|
+
"options": {
|
|
39
|
+
"gap": "0.5rem",
|
|
40
|
+
"gridColumns": 12
|
|
41
|
+
},
|
|
42
|
+
"elements": [
|
|
43
|
+
{
|
|
44
|
+
"type": "Button",
|
|
45
|
+
"label": "English",
|
|
46
|
+
"action": "setLocale",
|
|
47
|
+
"params": {
|
|
48
|
+
"locale": "en"
|
|
49
|
+
},
|
|
50
|
+
"color": "secondary",
|
|
51
|
+
"options": {
|
|
52
|
+
"layout": {
|
|
53
|
+
"span": 6
|
|
54
|
+
},
|
|
55
|
+
"fullWidth": true
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"type": "Button",
|
|
60
|
+
"label": "Български",
|
|
61
|
+
"action": "setLocale",
|
|
62
|
+
"params": {
|
|
63
|
+
"locale": "bg"
|
|
64
|
+
},
|
|
65
|
+
"color": "secondary",
|
|
66
|
+
"options": {
|
|
67
|
+
"layout": {
|
|
68
|
+
"span": 6
|
|
69
|
+
},
|
|
70
|
+
"fullWidth": true
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"type": "Separator"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"type": "Label",
|
|
80
|
+
"i18n": "colours"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"type": "HorizontalLayout",
|
|
84
|
+
"options": {
|
|
85
|
+
"gap": "0.5rem"
|
|
86
|
+
},
|
|
87
|
+
"elements": [
|
|
88
|
+
{
|
|
89
|
+
"type": "Button",
|
|
90
|
+
"i18n": "submit",
|
|
91
|
+
"label": "Submit",
|
|
92
|
+
"action": "submit",
|
|
93
|
+
"color": "primary"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"type": "Button",
|
|
97
|
+
"i18n": "reset",
|
|
98
|
+
"label": "Reset",
|
|
99
|
+
"action": "reset",
|
|
100
|
+
"color": "secondary"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"type": "Button",
|
|
104
|
+
"i18n": "discard",
|
|
105
|
+
"label": "Discard",
|
|
106
|
+
"action": "discard",
|
|
107
|
+
"color": "error"
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"type": "Label",
|
|
113
|
+
"i18n": "disabled"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"type": "Button",
|
|
117
|
+
"label": "Unavailable",
|
|
118
|
+
"action": "submit",
|
|
119
|
+
"options": {
|
|
120
|
+
"disabled": true
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"type": "Label",
|
|
125
|
+
"i18n": "slow"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"type": "Button",
|
|
129
|
+
"label": "Submit slowly",
|
|
130
|
+
"action": "slowExample",
|
|
131
|
+
"color": "primary"
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"type": "Label",
|
|
135
|
+
"i18n": "neither"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"type": "Button",
|
|
139
|
+
"label": "Declares neither",
|
|
140
|
+
"color": "secondary"
|
|
141
|
+
}
|
|
142
|
+
]
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"type": "Category",
|
|
146
|
+
"name": "script",
|
|
147
|
+
"i18n": "scriptTab",
|
|
148
|
+
"label": "Script",
|
|
149
|
+
"elements": [
|
|
150
|
+
{
|
|
151
|
+
"type": "Label",
|
|
152
|
+
"i18n": "script"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"type": "Button",
|
|
156
|
+
"label": "Log the form data",
|
|
157
|
+
"color": "alternative",
|
|
158
|
+
"script": "console.log(this.context.core.data);"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"type": "Separator"
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"type": "Label",
|
|
165
|
+
"i18n": "conflict"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"type": "Button",
|
|
169
|
+
"label": "Declares both",
|
|
170
|
+
"action": "submit",
|
|
171
|
+
"script": "console.log('never runs');",
|
|
172
|
+
"color": "warning"
|
|
173
|
+
}
|
|
174
|
+
]
|
|
175
|
+
}
|
|
176
|
+
]
|
|
177
|
+
}
|
|
178
|
+
]
|
|
179
|
+
}
|