()
| 713 | } |
| 714 | |
| 715 | getItems() { |
| 716 | const { options, ctx } = this.props; |
| 717 | const auto = this.getAuto(); |
| 718 | const i18n = this.getI18n(); |
| 719 | const config = this.getConfig(); |
| 720 | const stylesheet = this.getStylesheet(); |
| 721 | const templates = this.getTemplates(); |
| 722 | const value = this.state.value; |
| 723 | return value.map((itemValue, i) => { |
| 724 | const type = this.typeInfo.innerType.meta.type; |
| 725 | const itemType = getTypeFromUnion(type, itemValue); |
| 726 | const itemOptions = getComponentOptions( |
| 727 | options.item, |
| 728 | noobj, |
| 729 | itemValue, |
| 730 | type |
| 731 | ); |
| 732 | const ItemComponent = getFormComponent(itemType, itemOptions); |
| 733 | const buttons = []; |
| 734 | if (!options.disableRemove) { |
| 735 | buttons.push({ |
| 736 | type: "remove", |
| 737 | label: i18n.remove, |
| 738 | click: this.removeItem.bind(this, i) |
| 739 | }); |
| 740 | } |
| 741 | if (!options.disableOrder) { |
| 742 | buttons.push( |
| 743 | { |
| 744 | type: "move-up", |
| 745 | label: i18n.up, |
| 746 | click: this.moveUpItem.bind(this, i) |
| 747 | }, |
| 748 | { |
| 749 | type: "move-down", |
| 750 | label: i18n.down, |
| 751 | click: this.moveDownItem.bind(this, i) |
| 752 | } |
| 753 | ); |
| 754 | } |
| 755 | return { |
| 756 | input: React.createElement(ItemComponent, { |
| 757 | ref: i, |
| 758 | type: itemType, |
| 759 | options: itemOptions, |
| 760 | value: itemValue, |
| 761 | onChange: this.onItemChange.bind(this, i), |
| 762 | ctx: { |
| 763 | context: ctx.context, |
| 764 | uidGenerator: ctx.uidGenerator, |
| 765 | auto, |
| 766 | config, |
| 767 | label: ctx.label ? `${ctx.label}[${i + 1}]` : String(i + 1), |
| 768 | i18n, |
| 769 | stylesheet, |
| 770 | templates, |
| 771 | path: ctx.path.concat(i) |
| 772 | } |
no test coverage detected