mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-15 04:45:06 +01:00
fix lof preview fail if less than 2 is selected
This commit is contained in:
parent
30eb68774c
commit
500b084c2e
2 changed files with 9 additions and 1 deletions
|
|
@ -2,7 +2,8 @@ export default {
|
|||
sections: {
|
||||
type: 'array',
|
||||
itemType: 'loop',
|
||||
initializeBySelection: true
|
||||
initializeBySelection: true,
|
||||
min: 2
|
||||
},
|
||||
boolean: {
|
||||
type: 'enum',
|
||||
|
|
|
|||
|
|
@ -62,6 +62,13 @@ export default function materializeParams(services, params, schema, result, erro
|
|||
} else if (md.type === 'array') {
|
||||
if (!Array.isArray(value)) {
|
||||
errors.push({path: [...parentPath, field], message: 'not an array type'});
|
||||
continue;
|
||||
}
|
||||
if (md.min !== undefined && value.length < md.min) {
|
||||
errors.push({path: [...parentPath, field], message: 'required minimum ' + md.min + ' elements'});
|
||||
}
|
||||
if (md.max !== undefined && value.length > md.max) {
|
||||
errors.push({path: [...parentPath, field], message: 'required maximum ' + md.max + ' elements'});
|
||||
}
|
||||
if (md.itemType === 'object') {
|
||||
value = value.map((item , i) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue