Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
items && items.map((value, index) => {
const itemErrorSchema = errorSchema ? errorSchema[index] : undefined;
const itemIdPrefix = idSchema.$id + '_' + index;
const itemIdSchema = toIdSchema(itemsSchema, itemIdPrefix, definitions);
return (
<div>
<button>
</button>
</div>
<div>
{
this.renderArrayFieldItem({
index,
canMoveUp: index > 0,
canMoveDown: index < items.length - 1,</div>
{Object.keys(schema.properties).map((tabKey, index) => {
const tabSchema = schema.properties[tabKey];
const itemIdSchema = toIdSchema(tabSchema, tabKey, definitions);
const saveToFormData = state => {
const formDataCopy = Object.assign({}, formData);
formDataCopy[tabKey] = state;
onChange(formDataCopy);
};
return (
saveToFormData(newState)}
registry={registry}
schema={Object.assign({}, tabSchema, { title: '' })}
uiSchema={uiSchema[tabKey]}
/>
items && items.map((item, index) => {
const additional = index >= itemSchemas.length;
const itemSchema = additional ?
additionalSchema : itemSchemas[index];
const itemIdPrefix = idSchema.$id + '_' + index;
const itemIdSchema = toIdSchema(itemSchema, itemIdPrefix, definitions);
const itemUiSchema = additional ?
uiSchema.additionalItems || {} :
Array.isArray(uiSchema.items) ?
uiSchema.items[index] : uiSchema.items || {};
const itemErrorSchema = errorSchema ? errorSchema[index] : undefined;
return this.renderArrayFieldItem({
index,
removable: additional,
canMoveUp: index >= itemSchemas.length + 1,
canMoveDown: additional && index < items.length - 1,
itemSchema,
itemData: item,
itemUiSchema,
itemIdSchema,
itemErrorSchema,
items: formData.map((item, index) => {
const itemErrorSchema = errorSchema ? errorSchema[index] : undefined;
const itemIdPrefix = `${idSchema.$id}_${index}`;
const itemIdSchema = toIdSchema(itemsSchema, itemIdPrefix, definitions);
return this.renderArrayFieldItem({
index,
canMoveUp: index > 0,
canMoveDown: index < formData.length - 1,
itemSchema: itemsSchema,
itemIdSchema,
itemErrorSchema,
itemData: item,
itemUiSchema: uiSchema.items,
autofocus: autofocus && index === 0,
onBlur,
onFocus,
});
}),
className: `field field-array field-array-of-${itemsSchema.type}`,
items: items.map((item, index) => {
const additional = index >= itemSchemas.length;
const itemSchema = additional ? additionalSchema : itemSchemas[index];
const itemIdPrefix = `${idSchema.$id}_${index}`;
const itemIdSchema = toIdSchema(itemSchema, itemIdPrefix, definitions);
const itemErrorSchema = errorSchema ? errorSchema[index] : undefined;
let itemUiSchema = null;
if (additional) {
itemUiSchema = uiSchema.additionalItems || {};
} else if (Array.isArray(uiSchema.items)) {
itemUiSchema = uiSchema.items[index];
} else {
itemUiSchema = uiSchema.items || {};
}
return this.renderArrayFieldItem({
index,
canRemove: additional,
canMoveUp: index >= itemSchemas.length + 1,
canMoveDown: additional && index < items.length - 1,