()
| 110 | } |
| 111 | |
| 112 | submit () { |
| 113 | let success = this.validate(); |
| 114 | if (success && this.props.beforeSubmit) { |
| 115 | success = this.props.beforeSubmit(); |
| 116 | } |
| 117 | |
| 118 | if (!success) { |
| 119 | return; |
| 120 | } |
| 121 | |
| 122 | if (this.props.onSubmit) { |
| 123 | // send clone data |
| 124 | let data = clone(this.state.data); |
| 125 | |
| 126 | // remove ignore value |
| 127 | forEach(this.items, (item) => { |
| 128 | if (item.ignore) { |
| 129 | delete data[item.name]; |
| 130 | } |
| 131 | }); |
| 132 | |
| 133 | this.props.onSubmit(data); |
| 134 | } |
| 135 | |
| 136 | return true; |
| 137 | } |
| 138 | |
| 139 | renderControls () { |
| 140 | const { data } = this.state; |
no test coverage detected