| 158 | } |
| 159 | |
| 160 | renderChildren (children) { |
| 161 | let { data } = this.state; |
| 162 | let { fetchStatus, disabled } = this.props; |
| 163 | |
| 164 | return Children.map(children, (child) => { |
| 165 | if (!child) { return null; } |
| 166 | if (typeof child === 'string') { return child; } |
| 167 | let { hintType, readOnly } = child.props; |
| 168 | let props = { |
| 169 | hintType: hintType || this.props.hintType, |
| 170 | readOnly: readOnly || disabled, |
| 171 | layout: this.props.layout, |
| 172 | }; |
| 173 | if (child.type === FormControl || child.type.displayName === 'FormItem') { |
| 174 | props.itemBind = this.itemBind; |
| 175 | props.itemUnbind = this.itemUnbind; |
| 176 | props.itemChange = this.itemChange; |
| 177 | props.formData = data; |
| 178 | } else if (child.type === FormSubmit) { |
| 179 | props.disabled = disabled; |
| 180 | if (fetchStatus !== FETCH_SUCCESS) { |
| 181 | props.children = getLang('fetch.status')[fetchStatus]; |
| 182 | } |
| 183 | } else if (child.props.children) { |
| 184 | props.children = this.renderChildren(child.props.children); |
| 185 | } |
| 186 | |
| 187 | return cloneElement(child, props); |
| 188 | }); |
| 189 | } |
| 190 | |
| 191 | renderButton (text) { |
| 192 | return <FormSubmit disabled={this.props.disabled}>{text}</FormSubmit>; |