File tree 1 file changed +21
-22
lines changed
packages/form-render/src/form-core
1 file changed +21
-22
lines changed Original file line number Diff line number Diff line change @@ -195,6 +195,23 @@ const FormCore:FC<FRProps> = (props) => {
195
195
} ;
196
196
197
197
const operlabelCol = getFormItemLayout ( column , { } , { labelWidth } ) ?. labelCol ;
198
+
199
+ const footerDom : React . JSX . Element [ ] = [ ] ;
200
+ if ( ! footer ?. reset ?. hide ) {
201
+ footerDom . push (
202
+ < Button { ...footer ?. reset } onClick = { ( ) => form . resetFields ( ) } >
203
+ { footer ?. reset ?. text || t ( 'reset' ) }
204
+ </ Button >
205
+ ) ;
206
+ }
207
+ if ( ! footer ?. submit ?. hide ) {
208
+ footerDom . push (
209
+ < Button type = "primary" onClick = { form . submit } { ...footer ?. submit } >
210
+ { footer ?. submit ?. text || t ( 'submit' ) }
211
+ </ Button >
212
+ ) ;
213
+ }
214
+
198
215
return (
199
216
< Form
200
217
className = { classNames ( 'fr-form' , { [ className ] : ! ! className } ) }
@@ -218,28 +235,10 @@ const FormCore:FC<FRProps> = (props) => {
218
235
labelCol = { operlabelCol }
219
236
className = 'fr-hide-label'
220
237
>
221
- { isFunction ( footer ) ? (
222
- < Space > { footer ( ) } </ Space >
223
- ) : (
224
- < Space >
225
- { ! footer ?. reset ?. hide && (
226
- < Button
227
- { ...footer ?. reset }
228
- onClick = { ( ) => form . resetFields ( ) }
229
- >
230
- { footer ?. reset ?. text || t ( 'reset' ) }
231
- </ Button >
232
- ) }
233
- { ! footer ?. submit ?. hide && (
234
- < Button
235
- type = 'primary'
236
- onClick = { form . submit }
237
- { ...footer ?. submit }
238
- >
239
- { footer ?. submit ?. text || t ( 'submit' ) }
240
- </ Button >
241
- ) }
242
- </ Space >
238
+ { isFunction ( footer ) ? (
239
+ < Space > { footer ( footerDom ) } </ Space >
240
+ ) : (
241
+ < Space > { footerDom } </ Space >
243
242
) }
244
243
</ Form . Item >
245
244
</ Col >
You can’t perform that action at this time.
0 commit comments