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, itemSchema, itemData: item, itemUiSchema, itemIdSchema, itemErrorSchema, autofocus: autofocus && index === 0, onBlur, }); }),
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: formData[index], itemUiSchema: uiSchema.items, autofocus: autofocus && index === 0, onBlur, }); }),