Skip to content

Commit ea3f7c3

Browse files
committed
Bump version to 2.14.1 and update dist files
1 parent 48c28d2 commit ea3f7c3

File tree

5 files changed

+38
-53
lines changed

5 files changed

+38
-53
lines changed

dist/react-json-form.cjs

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,9 @@ function getSyncedArray(data, schema, getRef) {
390390

391391
let minItems = schema.minItems || schema.min_items || 0;
392392

393-
while (data.length < minItems) data.push(FILLER);
393+
if (schema.items.widget !== 'multiselect') {
394+
while (data.length < minItems) data.push(FILLER);
395+
}
394396

395397
for (let i = 0; i < data.length; i++) {
396398
let item = data[i];
@@ -2718,6 +2720,7 @@ function FormField(props) {
27182720

27192721
case 'number':
27202722
if (type === 'range') inputProps.type = 'range';else inputProps.type = 'number';
2723+
inputProps.step = 'any';
27212724
InputField = FormInput;
27222725
if (props.schema.minimum || props.schema.minimum === 0) inputProps.min = props.schema.minimum;
27232726
if (props.schema.maximum || props.schema.maximum === 0) inputProps.max = props.schema.maximum;
@@ -3150,12 +3153,10 @@ class OneOfTopLevel extends React__default["default"].Component {
31503153
};
31513154

31523155
this.getOptions = () => {
3153-
return this.props.args.schema[this.schemaName].map((option, index) => {
3154-
return {
3155-
label: option.title || 'Option ' + (index + 1),
3156-
value: index
3157-
};
3158-
});
3156+
return Array.from(this.props.args.schema[this.schemaName].keys(), index => ({
3157+
label: this.getSchema(index).title || 'Option ' + (index + 1),
3158+
value: index
3159+
}));
31593160
};
31603161

31613162
this.getSchema = index => {
@@ -4171,7 +4172,7 @@ function DataValidator(schema) {
41714172

41724173
let next_schema = schema.items;
41734174
if (next_schema.hasOwnProperty('$ref')) next_schema = this.getRef(next_schema.$ref);
4174-
let next_type = normalizeKeyword(next_schema.type);
4175+
let next_type = getSchemaType(next_schema);
41754176
let minItems = getKeyword(schema, 'minItems', 'min_items');
41764177
let maxItems = getKeyword(schema, 'maxItems', 'max_items');
41774178
let choices = getKeyword(schema.items, 'choices', 'enum');
@@ -4193,15 +4194,9 @@ function DataValidator(schema) {
41934194
if (typeof invalid_choice !== 'undefined') this.addError(coords, 'Invalid choice + "' + invalid_choice + '"');
41944195
}
41954196

4196-
let next_validator = this.getValidator(next_type);
4197+
let next_validator = this.getValidator(next_type); // currently allOf is not supported in array items
41974198

4198-
if (!next_validator) {
4199-
if (next_schema.hasOwnProperty('oneOf')) {
4200-
next_validator = this.validateOneOf;
4201-
} else if (next_schema.hasOwnProperty('anyOf')) {
4202-
next_validator = this.validateAnyOf;
4203-
} else if (next_schema.hasOwnProperty('anyOf')) ;
4204-
}
4199+
if (next_type === 'allOf') next_validator = null;
42054200

42064201
if (next_validator) {
42074202
for (let i = 0; i < data.length; i++) next_validator(next_schema, data[i], this.joinCoords([coords, i]));
@@ -4239,7 +4234,7 @@ function DataValidator(schema) {
42394234
if (schema.required.indexOf(key) > -1 && !next_schema.hasOwnProperty('required')) next_schema['required'] = true;
42404235
}
42414236

4242-
let next_type = normalizeKeyword(next_schema.type);
4237+
let next_type = getSchemaType(next_schema);
42434238
let next_validator = this.getValidator(next_type);
42444239
if (next_validator) next_validator(next_schema, data[key], this.joinCoords([coords, key]));else {
42454240
this.addError(coords, 'Unsupported type "' + next_type + '" for object properties (keys).');

dist/react-json-form.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/react-json-form.modern.js

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,9 @@ function getSyncedArray(data, schema, getRef) {
384384

385385
let minItems = schema.minItems || schema.min_items || 0;
386386

387-
while (data.length < minItems) data.push(FILLER);
387+
if (schema.items.widget !== 'multiselect') {
388+
while (data.length < minItems) data.push(FILLER);
389+
}
388390

389391
for (let i = 0; i < data.length; i++) {
390392
let item = data[i];
@@ -2712,6 +2714,7 @@ function FormField(props) {
27122714

27132715
case 'number':
27142716
if (type === 'range') inputProps.type = 'range';else inputProps.type = 'number';
2717+
inputProps.step = 'any';
27152718
InputField = FormInput;
27162719
if (props.schema.minimum || props.schema.minimum === 0) inputProps.min = props.schema.minimum;
27172720
if (props.schema.maximum || props.schema.maximum === 0) inputProps.max = props.schema.maximum;
@@ -3144,12 +3147,10 @@ class OneOfTopLevel extends React$1.Component {
31443147
};
31453148

31463149
this.getOptions = () => {
3147-
return this.props.args.schema[this.schemaName].map((option, index) => {
3148-
return {
3149-
label: option.title || 'Option ' + (index + 1),
3150-
value: index
3151-
};
3152-
});
3150+
return Array.from(this.props.args.schema[this.schemaName].keys(), index => ({
3151+
label: this.getSchema(index).title || 'Option ' + (index + 1),
3152+
value: index
3153+
}));
31533154
};
31543155

31553156
this.getSchema = index => {
@@ -4165,7 +4166,7 @@ function DataValidator(schema) {
41654166

41664167
let next_schema = schema.items;
41674168
if (next_schema.hasOwnProperty('$ref')) next_schema = this.getRef(next_schema.$ref);
4168-
let next_type = normalizeKeyword(next_schema.type);
4169+
let next_type = getSchemaType(next_schema);
41694170
let minItems = getKeyword(schema, 'minItems', 'min_items');
41704171
let maxItems = getKeyword(schema, 'maxItems', 'max_items');
41714172
let choices = getKeyword(schema.items, 'choices', 'enum');
@@ -4187,15 +4188,9 @@ function DataValidator(schema) {
41874188
if (typeof invalid_choice !== 'undefined') this.addError(coords, 'Invalid choice + "' + invalid_choice + '"');
41884189
}
41894190

4190-
let next_validator = this.getValidator(next_type);
4191+
let next_validator = this.getValidator(next_type); // currently allOf is not supported in array items
41914192

4192-
if (!next_validator) {
4193-
if (next_schema.hasOwnProperty('oneOf')) {
4194-
next_validator = this.validateOneOf;
4195-
} else if (next_schema.hasOwnProperty('anyOf')) {
4196-
next_validator = this.validateAnyOf;
4197-
} else if (next_schema.hasOwnProperty('anyOf')) ;
4198-
}
4193+
if (next_type === 'allOf') next_validator = null;
41994194

42004195
if (next_validator) {
42014196
for (let i = 0; i < data.length; i++) next_validator(next_schema, data[i], this.joinCoords([coords, i]));
@@ -4233,7 +4228,7 @@ function DataValidator(schema) {
42334228
if (schema.required.indexOf(key) > -1 && !next_schema.hasOwnProperty('required')) next_schema['required'] = true;
42344229
}
42354230

4236-
let next_type = normalizeKeyword(next_schema.type);
4231+
let next_type = getSchemaType(next_schema);
42374232
let next_validator = this.getValidator(next_type);
42384233
if (next_validator) next_validator(next_schema, data[key], this.joinCoords([coords, key]));else {
42394234
this.addError(coords, 'Unsupported type "' + next_type + '" for object properties (keys).');

dist/react-json-form.module.js

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,9 @@ function getSyncedArray(data, schema, getRef) {
384384

385385
let minItems = schema.minItems || schema.min_items || 0;
386386

387-
while (data.length < minItems) data.push(FILLER);
387+
if (schema.items.widget !== 'multiselect') {
388+
while (data.length < minItems) data.push(FILLER);
389+
}
388390

389391
for (let i = 0; i < data.length; i++) {
390392
let item = data[i];
@@ -2712,6 +2714,7 @@ function FormField(props) {
27122714

27132715
case 'number':
27142716
if (type === 'range') inputProps.type = 'range';else inputProps.type = 'number';
2717+
inputProps.step = 'any';
27152718
InputField = FormInput;
27162719
if (props.schema.minimum || props.schema.minimum === 0) inputProps.min = props.schema.minimum;
27172720
if (props.schema.maximum || props.schema.maximum === 0) inputProps.max = props.schema.maximum;
@@ -3144,12 +3147,10 @@ class OneOfTopLevel extends React$1.Component {
31443147
};
31453148

31463149
this.getOptions = () => {
3147-
return this.props.args.schema[this.schemaName].map((option, index) => {
3148-
return {
3149-
label: option.title || 'Option ' + (index + 1),
3150-
value: index
3151-
};
3152-
});
3150+
return Array.from(this.props.args.schema[this.schemaName].keys(), index => ({
3151+
label: this.getSchema(index).title || 'Option ' + (index + 1),
3152+
value: index
3153+
}));
31533154
};
31543155

31553156
this.getSchema = index => {
@@ -4165,7 +4166,7 @@ function DataValidator(schema) {
41654166

41664167
let next_schema = schema.items;
41674168
if (next_schema.hasOwnProperty('$ref')) next_schema = this.getRef(next_schema.$ref);
4168-
let next_type = normalizeKeyword(next_schema.type);
4169+
let next_type = getSchemaType(next_schema);
41694170
let minItems = getKeyword(schema, 'minItems', 'min_items');
41704171
let maxItems = getKeyword(schema, 'maxItems', 'max_items');
41714172
let choices = getKeyword(schema.items, 'choices', 'enum');
@@ -4187,15 +4188,9 @@ function DataValidator(schema) {
41874188
if (typeof invalid_choice !== 'undefined') this.addError(coords, 'Invalid choice + "' + invalid_choice + '"');
41884189
}
41894190

4190-
let next_validator = this.getValidator(next_type);
4191+
let next_validator = this.getValidator(next_type); // currently allOf is not supported in array items
41914192

4192-
if (!next_validator) {
4193-
if (next_schema.hasOwnProperty('oneOf')) {
4194-
next_validator = this.validateOneOf;
4195-
} else if (next_schema.hasOwnProperty('anyOf')) {
4196-
next_validator = this.validateAnyOf;
4197-
} else if (next_schema.hasOwnProperty('anyOf')) ;
4198-
}
4193+
if (next_type === 'allOf') next_validator = null;
41994194

42004195
if (next_validator) {
42014196
for (let i = 0; i < data.length; i++) next_validator(next_schema, data[i], this.joinCoords([coords, i]));
@@ -4233,7 +4228,7 @@ function DataValidator(schema) {
42334228
if (schema.required.indexOf(key) > -1 && !next_schema.hasOwnProperty('required')) next_schema['required'] = true;
42344229
}
42354230

4236-
let next_type = normalizeKeyword(next_schema.type);
4231+
let next_type = getSchemaType(next_schema);
42374232
let next_validator = this.getValidator(next_type);
42384233
if (next_validator) next_validator(next_schema, data[key], this.joinCoords([coords, key]));else {
42394234
this.addError(coords, 'Unsupported type "' + next_type + '" for object properties (keys).');

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@bhch/react-json-form",
3-
"version": "2.14.0",
3+
"version": "2.14.1",
44
"description": "Create forms using JSON Schema",
55
"publishConfig": {
66
"access": "public"

0 commit comments

Comments
 (0)