@jsonforms/core 3.0.0-alpha.0 → 3.0.0-beta.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/README.md +1 -1
- package/docs/assets/js/search.json +1 -1
- package/docs/enums/ruleeffect.html +4 -4
- package/docs/globals.html +1095 -703
- package/docs/index.html +70 -43
- package/docs/interfaces/addcellrendereraction.html +3 -3
- package/docs/interfaces/addrendereraction.html +3 -3
- package/docs/interfaces/adduischemaaction.html +3 -3
- package/docs/interfaces/andcondition.html +2 -2
- package/docs/interfaces/arraycontrolprops.html +22 -22
- package/docs/interfaces/arraylayoutprops.html +22 -22
- package/docs/interfaces/categorization.html +5 -5
- package/docs/interfaces/category.html +5 -5
- package/docs/interfaces/cellprops.html +14 -14
- package/docs/interfaces/combinatorrendererprops.html +13 -13
- package/docs/interfaces/combinatorsubschemarenderinfo.html +3 -3
- package/docs/interfaces/composablecondition.html +2 -2
- package/docs/interfaces/condition.html +1 -1
- package/docs/interfaces/controlelement.html +5 -5
- package/docs/interfaces/controlprops.html +17 -17
- package/docs/interfaces/controlstate.html +2 -2
- package/docs/interfaces/controlwithdetailprops.html +18 -18
- package/docs/interfaces/dispatchcellprops.html +13 -13
- package/docs/interfaces/dispatchcellstateprops.html +13 -13
- package/docs/interfaces/dispatchpropsofarraycontrol.html +4 -4
- package/docs/interfaces/dispatchpropsofcontrol.html +1 -1
- package/docs/interfaces/dispatchpropsofmultienumcontrol.html +2 -2
- package/docs/interfaces/enumcellprops.html +15 -15
- package/docs/interfaces/enumoption.html +2 -2
- package/docs/interfaces/formatted.html +2 -2
- package/docs/interfaces/grouplayout.html +5 -5
- package/docs/interfaces/horizontallayout.html +4 -4
- package/docs/interfaces/initaction.html +6 -6
- package/docs/interfaces/initactionoptions.html +3 -3
- package/docs/interfaces/jsonformscellrendererregistryentry.html +2 -2
- package/docs/interfaces/jsonformscore.html +7 -7
- package/docs/interfaces/jsonformsdefaultdataregistryentry.html +2 -2
- package/docs/interfaces/jsonformsextendedstate.html +1 -1
- package/docs/interfaces/{jsonformslocalestate.html → jsonformsi18nstate.html} +20 -20
- package/docs/interfaces/jsonformsprops.html +9 -9
- package/docs/interfaces/jsonformsrendererregistryentry.html +2 -2
- package/docs/interfaces/jsonformsstate.html +1 -1
- package/docs/interfaces/jsonformsstore.html +5 -5
- package/docs/interfaces/jsonformssubstates.html +18 -8
- package/docs/interfaces/jsonformsuischemaregistryentry.html +2 -2
- package/docs/interfaces/labeldescription.html +2 -2
- package/docs/interfaces/labelelement.html +4 -4
- package/docs/interfaces/layout.html +4 -4
- package/docs/interfaces/layoutprops.html +10 -10
- package/docs/interfaces/leafcondition.html +3 -3
- package/docs/interfaces/orcondition.html +2 -2
- package/docs/interfaces/ownpropsofcell.html +10 -10
- package/docs/interfaces/ownpropsofcontrol.html +9 -9
- package/docs/interfaces/ownpropsofenum.html +1 -1
- package/docs/interfaces/ownpropsofenumcell.html +11 -11
- package/docs/interfaces/ownpropsofjsonformsrenderer.html +8 -8
- package/docs/interfaces/ownpropsoflayout.html +9 -9
- package/docs/interfaces/ownpropsofmasterlistitem.html +6 -6
- package/docs/interfaces/ownpropsofrenderer.html +8 -8
- package/docs/interfaces/registerdefaultdataaction.html +3 -3
- package/docs/interfaces/removecellrendereraction.html +3 -3
- package/docs/interfaces/removerendereraction.html +3 -3
- package/docs/interfaces/removeuischemaaction.html +2 -2
- package/docs/interfaces/rendererprops.html +9 -9
- package/docs/interfaces/rule.html +2 -2
- package/docs/interfaces/schemabasedcondition.html +3 -3
- package/docs/interfaces/scopable.html +1 -1
- package/docs/interfaces/setajvaction.html +3 -3
- package/docs/interfaces/setconfigaction.html +2 -2
- package/docs/interfaces/setlocaleaction.html +3 -3
- package/docs/interfaces/setschemaaction.html +2 -2
- package/docs/interfaces/{setlocalizedschemasaction.html → settranslatoraction.html} +29 -15
- package/docs/interfaces/setuischemaaction.html +2 -2
- package/docs/interfaces/setvalidationmodeaction.html +2 -2
- package/docs/interfaces/statepropsofarraycontrol.html +18 -18
- package/docs/interfaces/statepropsofarraylayout.html +18 -18
- package/docs/interfaces/statepropsofcell.html +13 -13
- package/docs/interfaces/statepropsofcombinator.html +12 -12
- package/docs/interfaces/statepropsofcontrol.html +16 -16
- package/docs/interfaces/statepropsofcontrolwithdetail.html +17 -17
- package/docs/interfaces/statepropsofenumcell.html +14 -14
- package/docs/interfaces/statepropsofjsonformsrenderer.html +9 -9
- package/docs/interfaces/statepropsoflayout.html +10 -10
- package/docs/interfaces/statepropsofmasteritem.html +7 -7
- package/docs/interfaces/statepropsofrenderer.html +9 -9
- package/docs/interfaces/statepropsofscopedrenderer.html +12 -12
- package/docs/interfaces/uischemaelement.html +3 -3
- package/docs/interfaces/unregisterdefaultdataaction.html +2 -2
- package/docs/interfaces/updateaction.html +3 -3
- package/docs/interfaces/updatecoreaction.html +6 -6
- package/docs/interfaces/updateerrorsaction.html +2 -2
- package/docs/interfaces/{setlocalizeduischemasaction.html → updatei18naction.html} +43 -15
- package/docs/interfaces/verticallayout.html +4 -4
- package/docs/interfaces/withclassname.html +1 -1
- package/lib/Helpers.d.ts +5 -0
- package/lib/actions/actions.d.ts +181 -0
- package/lib/actions/index.d.ts +1 -178
- package/lib/configDefault.d.ts +6 -6
- package/lib/generators/Generate.d.ts +6 -0
- package/lib/generators/index.d.ts +3 -10
- package/lib/generators/schema.d.ts +8 -8
- package/lib/generators/uischema.d.ts +12 -13
- package/lib/i18n/i18nTypes.d.ts +15 -0
- package/lib/i18n/i18nUtil.d.ts +18 -0
- package/lib/i18n/index.d.ts +2 -0
- package/lib/index.d.ts +11 -23
- package/lib/jsonforms-core.cjs.js +2445 -0
- package/lib/jsonforms-core.cjs.js.map +1 -0
- package/lib/jsonforms-core.esm.js +2164 -0
- package/lib/jsonforms-core.esm.js.map +1 -0
- package/lib/models/draft4.d.ts +198 -198
- package/lib/models/index.d.ts +5 -0
- package/lib/models/jsonSchema.d.ts +3 -3
- package/lib/models/jsonSchema4.d.ts +110 -110
- package/lib/models/jsonSchema7.d.ts +119 -119
- package/lib/models/uischema.d.ts +201 -201
- package/lib/reducers/cells.d.ts +11 -11
- package/lib/reducers/config.d.ts +3 -3
- package/lib/reducers/core.d.ts +24 -23
- package/lib/reducers/default-data.d.ts +10 -10
- package/lib/reducers/i18n.d.ts +8 -11
- package/lib/reducers/index.d.ts +9 -47
- package/lib/reducers/reducers.d.ts +29 -0
- package/lib/reducers/renderers.d.ts +10 -10
- package/lib/reducers/selectors.d.ts +15 -0
- package/lib/reducers/uischemas.d.ts +10 -10
- package/lib/store.d.ts +53 -56
- package/lib/testers/index.d.ts +1 -204
- package/lib/testers/testers.d.ts +203 -0
- package/lib/util/Formatted.d.ts +19 -19
- package/lib/util/array.d.ts +3 -3
- package/lib/util/cell.d.ts +79 -79
- package/lib/util/combinators.d.ts +10 -11
- package/lib/util/ids.d.ts +3 -3
- package/lib/util/index.d.ts +15 -49
- package/lib/util/label.d.ts +9 -10
- package/lib/util/path.d.ts +25 -24
- package/lib/util/renderer.d.ts +398 -395
- package/lib/util/resolvers.d.ts +25 -25
- package/lib/util/runtime.d.ts +18 -19
- package/lib/util/schema.d.ts +1 -1
- package/lib/util/type.d.ts +174 -174
- package/lib/util/uischema.d.ts +5 -5
- package/lib/util/util.d.ts +31 -0
- package/lib/util/validator.d.ts +3 -2
- package/package.json +18 -14
- package/rollup.config.js +44 -0
- package/{lib/models/jsonSchema4.js → src/Helpers.ts} +16 -8
- package/src/actions/actions.ts +345 -0
- package/src/actions/index.ts +1 -310
- package/src/configDefault.ts +1 -0
- package/{lib/util/validator.js → src/generators/Generate.ts} +18 -11
- package/src/generators/index.ts +3 -21
- package/src/generators/schema.ts +1 -1
- package/src/generators/uischema.ts +4 -4
- package/src/i18n/i18nTypes.ts +17 -0
- package/src/i18n/i18nUtil.ts +105 -0
- package/src/i18n/index.ts +2 -0
- package/src/index.ts +7 -31
- package/src/models/draft4.ts +1 -0
- package/{lib/util/type.js → src/models/index.ts} +10 -7
- package/src/models/jsonSchema.ts +1 -0
- package/src/models/uischema.ts +1 -0
- package/src/reducers/cells.ts +2 -1
- package/src/reducers/config.ts +2 -1
- package/src/reducers/core.ts +74 -52
- package/src/reducers/default-data.ts +2 -1
- package/src/reducers/i18n.ts +42 -35
- package/src/reducers/index.ts +9 -154
- package/src/reducers/reducers.ts +128 -0
- package/src/reducers/renderers.ts +2 -1
- package/src/reducers/selectors.ts +65 -0
- package/src/reducers/uischemas.ts +4 -2
- package/src/store.ts +11 -8
- package/src/testers/index.ts +1 -516
- package/src/testers/testers.ts +547 -0
- package/src/util/Formatted.ts +1 -0
- package/src/util/array.ts +25 -0
- package/src/util/cell.ts +45 -10
- package/src/util/combinators.ts +2 -4
- package/src/util/ids.ts +1 -0
- package/src/util/index.ts +11 -123
- package/src/util/label.ts +2 -2
- package/src/util/path.ts +4 -1
- package/src/util/renderer.ts +139 -66
- package/src/util/resolvers.ts +2 -1
- package/src/util/runtime.ts +3 -2
- package/src/util/schema.ts +26 -1
- package/src/util/uischema.ts +2 -1
- package/src/util/util.ts +127 -0
- package/src/util/validator.ts +5 -8
- package/stats.html +3279 -0
- package/{lib/configDefault.js → test/i18n/i18nUtil.test.ts} +25 -24
- package/test/reducers/core.test.ts +31 -44
- package/test/util/cell.test.ts +2 -2
- package/test/util/renderer.test.ts +543 -31
- package/docs/interfaces/labels.html +0 -157
- package/lib/actions/index.js +0 -125
- package/lib/actions/index.js.map +0 -1
- package/lib/configDefault.js.map +0 -1
- package/lib/generators/index.js +0 -12
- package/lib/generators/index.js.map +0 -1
- package/lib/generators/schema.js +0 -152
- package/lib/generators/schema.js.map +0 -1
- package/lib/generators/uischema.js +0 -167
- package/lib/generators/uischema.js.map +0 -1
- package/lib/index.js +0 -45
- package/lib/index.js.map +0 -1
- package/lib/jsonforms-core.js +0 -19
- package/lib/jsonforms-core.js.map +0 -1
- package/lib/models/draft4.js +0 -173
- package/lib/models/draft4.js.map +0 -1
- package/lib/models/jsonSchema.js +0 -3
- package/lib/models/jsonSchema.js.map +0 -1
- package/lib/models/jsonSchema4.js.map +0 -1
- package/lib/models/jsonSchema7.js +0 -30
- package/lib/models/jsonSchema7.js.map +0 -1
- package/lib/models/uischema.js +0 -31
- package/lib/models/uischema.js.map +0 -1
- package/lib/reducers/cells.js +0 -16
- package/lib/reducers/cells.js.map +0 -1
- package/lib/reducers/config.js +0 -44
- package/lib/reducers/config.js.map +0 -1
- package/lib/reducers/core.js +0 -259
- package/lib/reducers/core.js.map +0 -1
- package/lib/reducers/default-data.js +0 -42
- package/lib/reducers/default-data.js.map +0 -1
- package/lib/reducers/i18n.js +0 -66
- package/lib/reducers/i18n.js.map +0 -1
- package/lib/reducers/index.js +0 -92
- package/lib/reducers/index.js.map +0 -1
- package/lib/reducers/renderers.js +0 -17
- package/lib/reducers/renderers.js.map +0 -1
- package/lib/reducers/uischemas.js +0 -57
- package/lib/reducers/uischemas.js.map +0 -1
- package/lib/store.js +0 -3
- package/lib/store.js.map +0 -1
- package/lib/testers/index.js +0 -402
- package/lib/testers/index.js.map +0 -1
- package/lib/util/Formatted.js +0 -3
- package/lib/util/Formatted.js.map +0 -1
- package/lib/util/array.js +0 -19
- package/lib/util/array.js.map +0 -1
- package/lib/util/cell.js +0 -133
- package/lib/util/cell.js.map +0 -1
- package/lib/util/combinators.js +0 -56
- package/lib/util/combinators.js.map +0 -1
- package/lib/util/ids.js +0 -50
- package/lib/util/ids.js.map +0 -1
- package/lib/util/index.js +0 -132
- package/lib/util/index.js.map +0 -1
- package/lib/util/label.js +0 -70
- package/lib/util/label.js.map +0 -1
- package/lib/util/path.js +0 -84
- package/lib/util/path.js.map +0 -1
- package/lib/util/renderer.js +0 -447
- package/lib/util/renderer.js.map +0 -1
- package/lib/util/resolvers.js +0 -165
- package/lib/util/resolvers.js.map +0 -1
- package/lib/util/runtime.js +0 -159
- package/lib/util/runtime.js.map +0 -1
- package/lib/util/schema.js +0 -16
- package/lib/util/schema.js.map +0 -1
- package/lib/util/type.js.map +0 -1
- package/lib/util/uischema.js +0 -52
- package/lib/util/uischema.js.map +0 -1
- package/lib/util/validator.js.map +0 -1
- package/webpack.build.js +0 -13
|
@@ -0,0 +1,547 @@
|
|
|
1
|
+
/*
|
|
2
|
+
The MIT License
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2017-2019 EclipseSource Munich
|
|
5
|
+
https://github.com/eclipsesource/jsonforms
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
in the Software without restriction, including without limitation the rights
|
|
10
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
furnished to do so, subject to the following conditions:
|
|
13
|
+
|
|
14
|
+
The above copyright notice and this permission notice shall be included in
|
|
15
|
+
all copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
|
+
THE SOFTWARE.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import isEmpty from 'lodash/isEmpty';
|
|
27
|
+
import get from 'lodash/get';
|
|
28
|
+
import endsWith from 'lodash/endsWith';
|
|
29
|
+
import last from 'lodash/last';
|
|
30
|
+
import isArray from 'lodash/isArray';
|
|
31
|
+
import reduce from 'lodash/reduce';
|
|
32
|
+
import toPairs from 'lodash/toPairs';
|
|
33
|
+
import includes from 'lodash/includes';
|
|
34
|
+
import {
|
|
35
|
+
Categorization,
|
|
36
|
+
ControlElement,
|
|
37
|
+
JsonSchema,
|
|
38
|
+
UISchemaElement
|
|
39
|
+
} from '../models';
|
|
40
|
+
import { deriveTypes, hasType, resolveSchema } from '../util';
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Constant that indicates that a tester is not capable of handling
|
|
44
|
+
* a combination of schema/data.
|
|
45
|
+
* @type {number}
|
|
46
|
+
*/
|
|
47
|
+
export const NOT_APPLICABLE = -1;
|
|
48
|
+
/**
|
|
49
|
+
* A tester is a function that receives an UI schema and a JSON schema and returns a boolean.
|
|
50
|
+
*/
|
|
51
|
+
export type Tester = (uischema: UISchemaElement, schema: JsonSchema) => boolean;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* A ranked tester associates a tester with a number.
|
|
55
|
+
*/
|
|
56
|
+
export type RankedTester = (
|
|
57
|
+
uischema: UISchemaElement,
|
|
58
|
+
schema: JsonSchema
|
|
59
|
+
) => number;
|
|
60
|
+
|
|
61
|
+
export const isControl = (uischema: any): uischema is ControlElement =>
|
|
62
|
+
!isEmpty(uischema) && uischema.scope !== undefined;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Only applicable for Controls.
|
|
66
|
+
*
|
|
67
|
+
* This function checks whether the given UI schema is of type Control
|
|
68
|
+
* and if so, resolves the sub-schema referenced by the control and applies
|
|
69
|
+
* the given predicate
|
|
70
|
+
*
|
|
71
|
+
* @param {(JsonSchema) => boolean} predicate the predicate that should be
|
|
72
|
+
* applied to the resolved sub-schema
|
|
73
|
+
*/
|
|
74
|
+
export const schemaMatches = (
|
|
75
|
+
predicate: (schema: JsonSchema) => boolean
|
|
76
|
+
): Tester => (uischema: UISchemaElement, schema: JsonSchema): boolean => {
|
|
77
|
+
if (isEmpty(uischema) || !isControl(uischema)) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
if (isEmpty(schema)) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
const schemaPath = uischema.scope;
|
|
84
|
+
if (isEmpty(schemaPath)) {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
let currentDataSchema = schema;
|
|
88
|
+
if (hasType(schema, 'object')) {
|
|
89
|
+
currentDataSchema = resolveSchema(schema, schemaPath);
|
|
90
|
+
}
|
|
91
|
+
if (currentDataSchema === undefined) {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return predicate(currentDataSchema);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export const schemaSubPathMatches = (
|
|
99
|
+
subPath: string,
|
|
100
|
+
predicate: (schema: JsonSchema) => boolean
|
|
101
|
+
): Tester => (uischema: UISchemaElement, schema: JsonSchema): boolean => {
|
|
102
|
+
if (isEmpty(uischema) || !isControl(uischema)) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
const schemaPath = uischema.scope;
|
|
106
|
+
let currentDataSchema: JsonSchema = schema;
|
|
107
|
+
if (hasType(schema, 'object')) {
|
|
108
|
+
currentDataSchema = resolveSchema(schema, schemaPath);
|
|
109
|
+
}
|
|
110
|
+
currentDataSchema = get(currentDataSchema, subPath);
|
|
111
|
+
|
|
112
|
+
if (currentDataSchema === undefined) {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return predicate(currentDataSchema);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Only applicable for Controls.
|
|
121
|
+
*
|
|
122
|
+
* This function checks whether the given UI schema is of type Control
|
|
123
|
+
* and if so, resolves the sub-schema referenced by the control and checks
|
|
124
|
+
* whether the type of the sub-schema matches the expected one.
|
|
125
|
+
*
|
|
126
|
+
* @param {string} expectedType the expected type of the resolved sub-schema
|
|
127
|
+
*/
|
|
128
|
+
export const schemaTypeIs = (expectedType: string): Tester =>
|
|
129
|
+
schemaMatches(schema => !isEmpty(schema) && hasType(schema, expectedType));
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Only applicable for Controls.
|
|
133
|
+
*
|
|
134
|
+
* This function checks whether the given UI schema is of type Control
|
|
135
|
+
* and if so, resolves the sub-schema referenced by the control and checks
|
|
136
|
+
* whether the format of the sub-schema matches the expected one.
|
|
137
|
+
*
|
|
138
|
+
* @param {string} expectedFormat the expected format of the resolved sub-schema
|
|
139
|
+
*/
|
|
140
|
+
export const formatIs = (expectedFormat: string): Tester =>
|
|
141
|
+
schemaMatches(
|
|
142
|
+
schema =>
|
|
143
|
+
!isEmpty(schema) &&
|
|
144
|
+
schema.format === expectedFormat &&
|
|
145
|
+
schema.type === 'string'
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Checks whether the given UI schema has the expected type.
|
|
150
|
+
*
|
|
151
|
+
* @param {string} expected the expected UI schema type
|
|
152
|
+
*/
|
|
153
|
+
export const uiTypeIs = (expected: string): Tester => (
|
|
154
|
+
uischema: UISchemaElement
|
|
155
|
+
): boolean => !isEmpty(uischema) && uischema.type === expected;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Checks whether the given UI schema has an option with the given
|
|
159
|
+
* name and whether it has the expected value. If no options property
|
|
160
|
+
* is set, returns false.
|
|
161
|
+
*
|
|
162
|
+
* @param {string} optionName the name of the option to check
|
|
163
|
+
* @param {any} optionValue the expected value of the option
|
|
164
|
+
*/
|
|
165
|
+
export const optionIs = (optionName: string, optionValue: any): Tester => (
|
|
166
|
+
uischema: UISchemaElement
|
|
167
|
+
): boolean => {
|
|
168
|
+
if (isEmpty(uischema)) {
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const options = uischema.options;
|
|
173
|
+
return !isEmpty(options) && options[optionName] === optionValue;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Only applicable for Controls.
|
|
178
|
+
*
|
|
179
|
+
* Checks whether the scope of a control ends with the expected string.
|
|
180
|
+
*
|
|
181
|
+
* @param {string} expected the expected ending of the reference
|
|
182
|
+
*/
|
|
183
|
+
export const scopeEndsWith = (expected: string): Tester => (
|
|
184
|
+
uischema: UISchemaElement
|
|
185
|
+
): boolean => {
|
|
186
|
+
if (isEmpty(expected) || !isControl(uischema)) {
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
return endsWith(uischema.scope, expected);
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Only applicable for Controls.
|
|
195
|
+
*
|
|
196
|
+
* Checks whether the last segment of the scope matches the expected string.
|
|
197
|
+
*
|
|
198
|
+
* @param {string} expected the expected ending of the reference
|
|
199
|
+
*/
|
|
200
|
+
export const scopeEndIs = (expected: string): Tester => (
|
|
201
|
+
uischema: UISchemaElement
|
|
202
|
+
): boolean => {
|
|
203
|
+
if (isEmpty(expected) || !isControl(uischema)) {
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
206
|
+
const schemaPath = uischema.scope;
|
|
207
|
+
|
|
208
|
+
return !isEmpty(schemaPath) && last(schemaPath.split('/')) === expected;
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* A tester that allow composing other testers by && them.
|
|
213
|
+
*
|
|
214
|
+
* @param {Array<Tester>} testers the testers to be composed
|
|
215
|
+
*/
|
|
216
|
+
export const and = (...testers: Tester[]): Tester => (
|
|
217
|
+
uischema: UISchemaElement,
|
|
218
|
+
schema: JsonSchema
|
|
219
|
+
) => testers.reduce((acc, tester) => acc && tester(uischema, schema), true);
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* A tester that allow composing other testers by || them.
|
|
223
|
+
*
|
|
224
|
+
* @param {Array<Tester>} testers the testers to be composed
|
|
225
|
+
*/
|
|
226
|
+
export const or = (...testers: Tester[]): Tester => (
|
|
227
|
+
uischema: UISchemaElement,
|
|
228
|
+
schema: JsonSchema
|
|
229
|
+
) => testers.reduce((acc, tester) => acc || tester(uischema, schema), false);
|
|
230
|
+
/**
|
|
231
|
+
* Create a ranked tester that will associate a number with a given tester, if the
|
|
232
|
+
* latter returns true.
|
|
233
|
+
*
|
|
234
|
+
* @param {number} rank the rank to be returned in case the tester returns true
|
|
235
|
+
* @param {Tester} tester a tester
|
|
236
|
+
*/
|
|
237
|
+
export const rankWith = (rank: number, tester: Tester) => (
|
|
238
|
+
uischema: UISchemaElement,
|
|
239
|
+
schema: JsonSchema
|
|
240
|
+
): number => {
|
|
241
|
+
if (tester(uischema, schema)) {
|
|
242
|
+
return rank;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
return NOT_APPLICABLE;
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
export const withIncreasedRank = (by: number, rankedTester: RankedTester) => (
|
|
249
|
+
uischema: UISchemaElement,
|
|
250
|
+
schema: JsonSchema
|
|
251
|
+
): number => {
|
|
252
|
+
const rank = rankedTester(uischema, schema);
|
|
253
|
+
if (rank === NOT_APPLICABLE) {
|
|
254
|
+
return NOT_APPLICABLE;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
return rank + by;
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Default tester for boolean.
|
|
262
|
+
* @type {RankedTester}
|
|
263
|
+
*/
|
|
264
|
+
export const isBooleanControl = and(
|
|
265
|
+
uiTypeIs('Control'),
|
|
266
|
+
schemaTypeIs('boolean')
|
|
267
|
+
);
|
|
268
|
+
|
|
269
|
+
// TODO: rather check for properties property
|
|
270
|
+
export const isObjectControl = and(uiTypeIs('Control'), schemaTypeIs('object'));
|
|
271
|
+
|
|
272
|
+
export const isAllOfControl = and(
|
|
273
|
+
uiTypeIs('Control'),
|
|
274
|
+
schemaMatches(schema => schema.hasOwnProperty('allOf'))
|
|
275
|
+
);
|
|
276
|
+
|
|
277
|
+
export const isAnyOfControl = and(
|
|
278
|
+
uiTypeIs('Control'),
|
|
279
|
+
schemaMatches(schema => schema.hasOwnProperty('anyOf'))
|
|
280
|
+
);
|
|
281
|
+
|
|
282
|
+
export const isOneOfControl = and(
|
|
283
|
+
uiTypeIs('Control'),
|
|
284
|
+
schemaMatches(schema => schema.hasOwnProperty('oneOf'))
|
|
285
|
+
);
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Tests whether the given UI schema is of type Control and if the schema
|
|
289
|
+
* has an enum.
|
|
290
|
+
* @type {Tester}
|
|
291
|
+
*/
|
|
292
|
+
export const isEnumControl = and(
|
|
293
|
+
uiTypeIs('Control'),
|
|
294
|
+
or(
|
|
295
|
+
schemaMatches(schema => schema.hasOwnProperty('enum')),
|
|
296
|
+
schemaMatches(schema => schema.hasOwnProperty('const'))
|
|
297
|
+
)
|
|
298
|
+
);
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Tests whether the given UI schema is of type Control and if the schema
|
|
302
|
+
* has an enum based on oneOf.
|
|
303
|
+
* @type {Tester}
|
|
304
|
+
*/
|
|
305
|
+
export const isOneOfEnumControl = and(
|
|
306
|
+
uiTypeIs('Control'),
|
|
307
|
+
schemaMatches(schema =>
|
|
308
|
+
schema.hasOwnProperty('oneOf') &&
|
|
309
|
+
(schema.oneOf as JsonSchema[]).every(s => s.const !== undefined)
|
|
310
|
+
)
|
|
311
|
+
);
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Tests whether the given UI schema is of type Control and if the schema
|
|
315
|
+
* is of type integer
|
|
316
|
+
* @type {Tester}
|
|
317
|
+
*/
|
|
318
|
+
export const isIntegerControl = and(
|
|
319
|
+
uiTypeIs('Control'),
|
|
320
|
+
schemaTypeIs('integer')
|
|
321
|
+
);
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Tests whether the given UI schema is of type Control and if the schema
|
|
325
|
+
* is of type number
|
|
326
|
+
* @type {Tester}
|
|
327
|
+
*/
|
|
328
|
+
export const isNumberControl = and(uiTypeIs('Control'), schemaTypeIs('number'));
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Tests whether the given UI schema is of type Control and if the schema
|
|
332
|
+
* is of type string
|
|
333
|
+
* @type {Tester}
|
|
334
|
+
*/
|
|
335
|
+
export const isStringControl = and(uiTypeIs('Control'), schemaTypeIs('string'));
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Tests whether the given UI schema is of type Control and if is has
|
|
339
|
+
* a 'multi' option.
|
|
340
|
+
* @type {Tester}
|
|
341
|
+
*/
|
|
342
|
+
export const isMultiLineControl = and(
|
|
343
|
+
uiTypeIs('Control'),
|
|
344
|
+
optionIs('multi', true)
|
|
345
|
+
);
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Tests whether the given UI schema is of type Control and whether the schema
|
|
349
|
+
* or uischema options has a 'date' format.
|
|
350
|
+
* @type {Tester}
|
|
351
|
+
*/
|
|
352
|
+
export const isDateControl = and(
|
|
353
|
+
uiTypeIs('Control'),
|
|
354
|
+
or(formatIs('date'), optionIs('format', 'date'))
|
|
355
|
+
);
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Tests whether the given UI schema is of type Control and whether the schema
|
|
359
|
+
* or the uischema options has a 'time' format.
|
|
360
|
+
* @type {Tester}
|
|
361
|
+
*/
|
|
362
|
+
export const isTimeControl = and(
|
|
363
|
+
uiTypeIs('Control'),
|
|
364
|
+
or(formatIs('time'), optionIs('format', 'time'))
|
|
365
|
+
);
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* Tests whether the given UI schema is of type Control and whether the schema
|
|
369
|
+
* or the uischema options has a 'date-time' format.
|
|
370
|
+
* @type {Tester}
|
|
371
|
+
*/
|
|
372
|
+
export const isDateTimeControl = and(
|
|
373
|
+
uiTypeIs('Control'),
|
|
374
|
+
or(formatIs('date-time'), optionIs('format', 'date-time'))
|
|
375
|
+
);
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Tests whether the given schema is an array of objects.
|
|
379
|
+
* @type {Tester}
|
|
380
|
+
*/
|
|
381
|
+
export const isObjectArray = and(
|
|
382
|
+
schemaMatches(
|
|
383
|
+
schema => hasType(schema, 'array') && !Array.isArray(schema.items) // we don't care about tuples
|
|
384
|
+
),
|
|
385
|
+
schemaSubPathMatches('items', schema => hasType(schema, 'object'))
|
|
386
|
+
);
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Tests whether the given UI schema is of type Control and if the schema
|
|
390
|
+
* is an array of objects.
|
|
391
|
+
* @type {Tester}
|
|
392
|
+
*/
|
|
393
|
+
export const isObjectArrayControl = and(uiTypeIs('Control'), isObjectArray);
|
|
394
|
+
|
|
395
|
+
const traverse = (
|
|
396
|
+
any: JsonSchema | JsonSchema[],
|
|
397
|
+
pred: (obj: JsonSchema) => boolean
|
|
398
|
+
): boolean => {
|
|
399
|
+
if (isArray(any)) {
|
|
400
|
+
return reduce(any, (acc, el) => acc || traverse(el, pred), false);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
if (pred(any)) {
|
|
404
|
+
return true;
|
|
405
|
+
}
|
|
406
|
+
if (any.items) {
|
|
407
|
+
return traverse(any.items, pred);
|
|
408
|
+
}
|
|
409
|
+
if (any.properties) {
|
|
410
|
+
return reduce(
|
|
411
|
+
toPairs(any.properties),
|
|
412
|
+
(acc, [_key, val]) => acc || traverse(val, pred),
|
|
413
|
+
false
|
|
414
|
+
);
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
return false;
|
|
418
|
+
};
|
|
419
|
+
|
|
420
|
+
export const isObjectArrayWithNesting = (
|
|
421
|
+
uischema: UISchemaElement,
|
|
422
|
+
schema: JsonSchema
|
|
423
|
+
): boolean => {
|
|
424
|
+
if (!uiTypeIs('Control')(uischema, schema)) {
|
|
425
|
+
return false;
|
|
426
|
+
}
|
|
427
|
+
const schemaPath = (uischema as ControlElement).scope;
|
|
428
|
+
const resolvedSchema = resolveSchema(schema, schemaPath);
|
|
429
|
+
const wantedNestingByType: { [key: string]: number } = {
|
|
430
|
+
object: 2,
|
|
431
|
+
array: 1
|
|
432
|
+
};
|
|
433
|
+
if (resolvedSchema !== undefined && resolvedSchema.items !== undefined) {
|
|
434
|
+
// check if nested arrays
|
|
435
|
+
if (
|
|
436
|
+
traverse(resolvedSchema.items, val => {
|
|
437
|
+
if (val === schema) {
|
|
438
|
+
return false;
|
|
439
|
+
}
|
|
440
|
+
// we don't support multiple types
|
|
441
|
+
if (typeof val.type !== 'string') {
|
|
442
|
+
return true;
|
|
443
|
+
}
|
|
444
|
+
const typeCount = wantedNestingByType[val.type];
|
|
445
|
+
if (typeCount === undefined) {
|
|
446
|
+
return false;
|
|
447
|
+
}
|
|
448
|
+
wantedNestingByType[val.type] = typeCount - 1;
|
|
449
|
+
return wantedNestingByType[val.type] === 0;
|
|
450
|
+
})
|
|
451
|
+
) {
|
|
452
|
+
return true;
|
|
453
|
+
}
|
|
454
|
+
// check if uischema options detail is set
|
|
455
|
+
if (uischema.options && uischema.options.detail) {
|
|
456
|
+
if (typeof uischema.options.detail === 'string') {
|
|
457
|
+
return uischema.options.detail.toUpperCase() !== 'DEFAULT';
|
|
458
|
+
} else if (
|
|
459
|
+
typeof uischema.options.detail === 'object' &&
|
|
460
|
+
uischema.options.detail.type
|
|
461
|
+
) {
|
|
462
|
+
return true;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
return false;
|
|
467
|
+
};
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* Synonym for isObjectArrayControl
|
|
471
|
+
*/
|
|
472
|
+
export const isArrayObjectControl = isObjectArrayControl;
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* Tests whether the given UI schema is of type Control and if the schema
|
|
476
|
+
* is an array of a primitive type.
|
|
477
|
+
* @type {Tester}
|
|
478
|
+
*/
|
|
479
|
+
export const isPrimitiveArrayControl = and(
|
|
480
|
+
uiTypeIs('Control'),
|
|
481
|
+
schemaMatches(
|
|
482
|
+
schema => deriveTypes(schema).length !== 0 && !Array.isArray(schema.items) // we don't care about tuples
|
|
483
|
+
),
|
|
484
|
+
schemaSubPathMatches('items', schema => {
|
|
485
|
+
const types = deriveTypes(schema);
|
|
486
|
+
return (
|
|
487
|
+
types.length === 1 &&
|
|
488
|
+
includes(['integer', 'number', 'boolean', 'string'], types[0])
|
|
489
|
+
);
|
|
490
|
+
})
|
|
491
|
+
);
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* Tests whether a given UI schema is of type Control,
|
|
495
|
+
* if the schema is of type number or integer and
|
|
496
|
+
* whether the schema defines a numerical range with a default value.
|
|
497
|
+
* @type {Tester}
|
|
498
|
+
*/
|
|
499
|
+
export const isRangeControl = and(
|
|
500
|
+
uiTypeIs('Control'),
|
|
501
|
+
or(schemaTypeIs('number'), schemaTypeIs('integer')),
|
|
502
|
+
schemaMatches(
|
|
503
|
+
schema =>
|
|
504
|
+
schema.hasOwnProperty('maximum') &&
|
|
505
|
+
schema.hasOwnProperty('minimum') &&
|
|
506
|
+
schema.hasOwnProperty('default')
|
|
507
|
+
),
|
|
508
|
+
optionIs('slider', true)
|
|
509
|
+
);
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* Tests whether the given UI schema is of type Control, if the schema
|
|
513
|
+
* is of type string and has option format
|
|
514
|
+
* @type {Tester}
|
|
515
|
+
*/
|
|
516
|
+
export const isNumberFormatControl = and(
|
|
517
|
+
uiTypeIs('Control'),
|
|
518
|
+
schemaTypeIs('integer'),
|
|
519
|
+
optionIs('format', true)
|
|
520
|
+
);
|
|
521
|
+
|
|
522
|
+
export const isCategorization = (
|
|
523
|
+
category: UISchemaElement
|
|
524
|
+
): category is Categorization => category.type === 'Categorization';
|
|
525
|
+
|
|
526
|
+
export const isCategory = (uischema: UISchemaElement): boolean =>
|
|
527
|
+
uischema.type === 'Category';
|
|
528
|
+
|
|
529
|
+
export const hasCategory = (categorization: Categorization): boolean => {
|
|
530
|
+
if (isEmpty(categorization.elements)) {
|
|
531
|
+
return false;
|
|
532
|
+
}
|
|
533
|
+
// all children of the categorization have to be categories
|
|
534
|
+
return categorization.elements
|
|
535
|
+
.map(elem =>
|
|
536
|
+
isCategorization(elem) ? hasCategory(elem) : isCategory(elem)
|
|
537
|
+
)
|
|
538
|
+
.reduce((prev, curr) => prev && curr, true);
|
|
539
|
+
};
|
|
540
|
+
|
|
541
|
+
export const categorizationHasCategory = (uischema: UISchemaElement) =>
|
|
542
|
+
hasCategory(uischema as Categorization);
|
|
543
|
+
|
|
544
|
+
export const not = (tester: Tester): Tester => (
|
|
545
|
+
uischema: UISchemaElement,
|
|
546
|
+
schema: JsonSchema
|
|
547
|
+
) => !tester(uischema, schema);
|
package/src/util/Formatted.ts
CHANGED
package/src/util/array.ts
CHANGED
|
@@ -1,3 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
The MIT License
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2017-2019 EclipseSource Munich
|
|
5
|
+
https://github.com/eclipsesource/jsonforms
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
in the Software without restriction, including without limitation the rights
|
|
10
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
furnished to do so, subject to the following conditions:
|
|
13
|
+
|
|
14
|
+
The above copyright notice and this permission notice shall be included in
|
|
15
|
+
all copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
|
+
THE SOFTWARE.
|
|
24
|
+
*/
|
|
25
|
+
|
|
1
26
|
const move = (array: any[], index: number, delta: number) => {
|
|
2
27
|
const newIndex: number = index + delta;
|
|
3
28
|
if (newIndex < 0 || newIndex >= array.length) {
|
package/src/util/cell.ts
CHANGED
|
@@ -22,25 +22,42 @@
|
|
|
22
22
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
23
|
THE SOFTWARE.
|
|
24
24
|
*/
|
|
25
|
+
|
|
25
26
|
import isEmpty from 'lodash/isEmpty';
|
|
26
27
|
import union from 'lodash/union';
|
|
27
|
-
import {
|
|
28
|
+
import type { JsonFormsCellRendererRegistryEntry } from '../reducers';
|
|
29
|
+
import {
|
|
30
|
+
getAjv,
|
|
31
|
+
getConfig,
|
|
32
|
+
getData,
|
|
33
|
+
getErrorAt,
|
|
34
|
+
getSchema,
|
|
35
|
+
getTranslator,
|
|
36
|
+
} from '../reducers';
|
|
37
|
+
import { AnyAction, Dispatch } from './type';
|
|
38
|
+
import {
|
|
39
|
+
formatErrorMessage,
|
|
40
|
+
Resolve,
|
|
41
|
+
} from './util';
|
|
42
|
+
import {
|
|
43
|
+
isInherentlyEnabled,
|
|
44
|
+
isVisible,
|
|
45
|
+
} from './runtime';
|
|
28
46
|
import {
|
|
29
47
|
DispatchPropsOfControl,
|
|
30
48
|
EnumOption,
|
|
31
49
|
enumToEnumOptionMapper,
|
|
32
50
|
mapDispatchToControlProps,
|
|
51
|
+
oneOfToEnumOptionMapper,
|
|
33
52
|
OwnPropsOfControl,
|
|
34
53
|
OwnPropsOfEnum,
|
|
35
|
-
StatePropsOfScopedRenderer
|
|
54
|
+
StatePropsOfScopedRenderer,
|
|
36
55
|
} from './renderer';
|
|
37
56
|
import { JsonFormsState } from '../store';
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import { isInherentlyEnabled, isVisible } from './runtime';
|
|
41
|
-
import { AnyAction, Dispatch, formatErrorMessage, oneOfToEnumOptionMapper, Resolve } from '.';
|
|
57
|
+
import { JsonSchema } from '../models';
|
|
58
|
+
import { getI18nKeyPrefix } from '../i18n';
|
|
42
59
|
|
|
43
|
-
export { JsonFormsCellRendererRegistryEntry };
|
|
60
|
+
export type { JsonFormsCellRendererRegistryEntry };
|
|
44
61
|
|
|
45
62
|
export interface OwnPropsOfCell extends OwnPropsOfControl {
|
|
46
63
|
data?: any;
|
|
@@ -181,8 +198,20 @@ export const defaultMapStateToEnumCellProps = (
|
|
|
181
198
|
const props: StatePropsOfCell = mapStateToCellProps(state, ownProps);
|
|
182
199
|
const options: EnumOption[] =
|
|
183
200
|
ownProps.options ||
|
|
184
|
-
props.schema.enum?.map(
|
|
185
|
-
|
|
201
|
+
props.schema.enum?.map(e =>
|
|
202
|
+
enumToEnumOptionMapper(
|
|
203
|
+
e,
|
|
204
|
+
getTranslator()(state),
|
|
205
|
+
getI18nKeyPrefix(props.schema, props.uischema, props.path)
|
|
206
|
+
)
|
|
207
|
+
) ||
|
|
208
|
+
(props.schema.const && [
|
|
209
|
+
enumToEnumOptionMapper(
|
|
210
|
+
props.schema.const,
|
|
211
|
+
getTranslator()(state),
|
|
212
|
+
getI18nKeyPrefix(props.schema, props.uischema, props.path)
|
|
213
|
+
)
|
|
214
|
+
]);
|
|
186
215
|
return {
|
|
187
216
|
...props,
|
|
188
217
|
options
|
|
@@ -202,7 +231,13 @@ export const mapStateToOneOfEnumCellProps = (
|
|
|
202
231
|
const props: StatePropsOfCell = mapStateToCellProps(state, ownProps);
|
|
203
232
|
const options: EnumOption[] =
|
|
204
233
|
ownProps.options ||
|
|
205
|
-
(props.schema.oneOf as JsonSchema[])?.map(
|
|
234
|
+
(props.schema.oneOf as JsonSchema[])?.map(oneOfSubSchema =>
|
|
235
|
+
oneOfToEnumOptionMapper(
|
|
236
|
+
oneOfSubSchema,
|
|
237
|
+
getTranslator()(state),
|
|
238
|
+
getI18nKeyPrefix(props.schema, props.uischema, props.path)
|
|
239
|
+
)
|
|
240
|
+
);
|
|
206
241
|
return {
|
|
207
242
|
...props,
|
|
208
243
|
options
|
package/src/util/combinators.ts
CHANGED
|
@@ -23,11 +23,9 @@
|
|
|
23
23
|
THE SOFTWARE.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
import { JsonSchema } from '../models
|
|
27
|
-
import { ControlElement, UISchemaElement } from '../models/uischema';
|
|
26
|
+
import { ControlElement, JsonSchema, UISchemaElement } from '../models';
|
|
28
27
|
import { resolveSchema } from './resolvers';
|
|
29
|
-
import { findUISchema } from '../reducers';
|
|
30
|
-
import { JsonFormsUISchemaRegistryEntry } from '../reducers/uischemas';
|
|
28
|
+
import { findUISchema, JsonFormsUISchemaRegistryEntry } from '../reducers';
|
|
31
29
|
|
|
32
30
|
export interface CombinatorSubSchemaRenderInfo {
|
|
33
31
|
schema: JsonSchema;
|