@kne/form-info 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,13 +2,14 @@ import '@kne/info-page/dist/index.css';
2
2
  import '@kne/react-form-antd/dist/index.css';
3
3
  import { FormAntd, CancelButton, SubmitButton } from '@kne/react-form-antd';
4
4
  export * from '@kne/react-form-antd';
5
- import React, { forwardRef, isValidElement, useRef, createContext, useContext as useContext$1 } from 'react';
5
+ import { forwardRef, isValidElement, useRef, createElement, createContext, useContext } from 'react';
6
6
  import InfoPage from '@kne/info-page';
7
7
  import { useFlexBox } from '@kne/flex-box';
8
8
  import { FormInfo as FormInfo$1, SubList, MultiField as MultiField$1, TableList as TableList$1 } from '@kne/react-form-plus';
9
9
  import { Col, Row, Empty, Button, Divider, Modal, Flex, Steps } from 'antd';
10
+ import { jsxs, jsx } from 'react/jsx-runtime';
10
11
  import { PlusOutlined, DeleteOutlined } from '@ant-design/icons';
11
- import { useContext } from '@kne/global-context';
12
+ import { createWithIntlProvider, useIntl } from '@kne/react-intl';
12
13
  import useControlValue from '@kne/use-control-value';
13
14
 
14
15
  function _extends() {
@@ -24,7 +25,7 @@ function _objectWithoutPropertiesLoose(r, e) {
24
25
  if (null == r) return {};
25
26
  var t = {};
26
27
  for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
27
- if (e.includes(n)) continue;
28
+ if (-1 !== e.indexOf(n)) continue;
28
29
  t[n] = r[n];
29
30
  }
30
31
  return t;
@@ -112,7 +113,7 @@ var classnames = createCommonjsModule(function (module) {
112
113
  }());
113
114
  });
114
115
 
115
- var style = {"form-outer":"_ZQNNL","form-info":"_GW4Xx","extra-btn":"_eY4qR","list-part":"_SL3dC","list-item":"_PNnMa","is-important":"_Xkp38","list-item-part":"_HiB5Q","table-list-inner":"_Uw-3T","multi-field-item":"_uogqr","react-form__field-label":"_UGjS9","multi-field-add-btn":"_rjVPh","table-list":"_r8-bn","table-list-field":"_Qkutm","table-list-header":"_9WdfD","is-req":"_CsPaL","table-options":"_8smwK","steps":"_IOdkE","steps-form-inner":"_uc1HZ","steps-modal":"_vWPQO"};
116
+ var style = {"form-outer":"_ZQNNL","form-info":"_GW4Xx","extra-btn":"_eY4qR","list-part":"_SL3dC","list-item":"_PNnMa","is-important":"_Xkp38","list-item-part":"_HiB5Q","table-list-inner":"_Uw-3T","multi-field-item":"_uogqr","react-form__field-label":"_UGjS9","multi-field-add-btn":"_rjVPh","table-list":"_r8-bn","table-list-field":"_Qkutm","table-list-header":"_9WdfD","is-req":"_CsPaL","table-options":"_8smwK","steps":"_IOdkE","steps-form-inner":"_uc1HZ","steps-modal":"_vWPQO","table-list-empty":"_DXskv"};
116
117
 
117
118
  const _excluded$7 = ["className", "column", "list", "gap"];
118
119
  const FormInfo = props => {
@@ -133,7 +134,7 @@ const FormInfo = props => {
133
134
  column: flexBoxColumn
134
135
  } = useFlexBox(isFlexBox ? column : {});
135
136
  const renderInner = (column, notLayout) => {
136
- return /*#__PURE__*/React.createElement(FormInfo$1, {
137
+ return /*#__PURE__*/jsx(FormInfo$1, {
137
138
  list: list,
138
139
  column: column,
139
140
  className: classnames({
@@ -141,20 +142,24 @@ const FormInfo = props => {
141
142
  }),
142
143
  itemRender: (children, props) => {
143
144
  if (props.hidden) {
144
- return /*#__PURE__*/React.createElement("div", {
145
+ return /*#__PURE__*/jsx("div", {
145
146
  style: {
146
147
  display: 'none'
147
- }
148
- }, children);
148
+ },
149
+ children: children
150
+ });
149
151
  }
150
- return /*#__PURE__*/React.createElement(Col, {
151
- span: props.span
152
- }, children);
152
+ return /*#__PURE__*/jsx(Col, {
153
+ span: props.span,
154
+ children: children
155
+ });
156
+ },
157
+ children: children => {
158
+ return /*#__PURE__*/jsx(Row, {
159
+ gutter: [gap || 24, 0],
160
+ children: children
161
+ });
153
162
  }
154
- }, children => {
155
- return /*#__PURE__*/React.createElement(Row, {
156
- gutter: [gap || 24, 0]
157
- }, children);
158
163
  });
159
164
  };
160
165
  const renderColumn = () => {
@@ -166,34 +171,60 @@ const FormInfo = props => {
166
171
  }
167
172
  return renderInner(2, true);
168
173
  };
169
- return /*#__PURE__*/React.createElement(InfoPage.Part, _extends({}, others, {
170
- className: classnames(className, style['form-info'])
171
- }), /*#__PURE__*/React.createElement("div", {
172
- ref: flexBoxRef
173
- }), renderColumn());
174
+ return /*#__PURE__*/jsxs(InfoPage.Part, _extends({}, others, {
175
+ className: classnames(className, style['form-info']),
176
+ children: [/*#__PURE__*/jsx("div", {
177
+ ref: flexBoxRef
178
+ }), renderColumn()]
179
+ }));
180
+ };
181
+
182
+ const locale$1 = {
183
+ submit: '提交',
184
+ cancel: '取消',
185
+ complete: '完成',
186
+ next: '下一步',
187
+ addText: '添加',
188
+ deleteText: '删除'
174
189
  };
175
190
 
191
+ const locale = {
192
+ submit: 'Submit',
193
+ cancel: 'Cancel',
194
+ complete: 'Complete',
195
+ next: 'Next',
196
+ addText: 'Add',
197
+ deleteText: 'Delete'
198
+ };
199
+
200
+ const withLocale = createWithIntlProvider({
201
+ defaultLocale: 'zh-CN',
202
+ messages: {
203
+ 'zh-CN': locale$1,
204
+ 'en-US': locale
205
+ },
206
+ namespace: 'form-info'
207
+ });
208
+
176
209
  const _excluded$6 = ["className", "itemClassName", "removeIcon", "removeText", "addText", "addIcon", "important", "title"],
177
210
  _excluded2$2 = ["id", "allowRemove", "onRemove", "index", "groupArgs"];
178
- const List = p => {
211
+ const List = withLocale(p => {
179
212
  const {
180
- locale: contextLocale
181
- } = useContext();
182
- const locale = Object.assign({}, {
183
- 添加: '添加',
184
- 删除: '删除'
185
- }, contextLocale, p.locale);
213
+ formatMessage
214
+ } = useIntl();
186
215
  const _Object$assign = Object.assign({}, {
187
- addText: locale['添加'],
188
- addIcon: /*#__PURE__*/React.createElement(PlusOutlined, null),
189
- removeText: locale['删除'],
190
- removeIcon: /*#__PURE__*/React.createElement(DeleteOutlined, null),
191
- empty: /*#__PURE__*/React.createElement(Empty, {
216
+ addText: formatMessage({
217
+ id: 'addText'
218
+ }),
219
+ addIcon: /*#__PURE__*/jsx(PlusOutlined, {}),
220
+ removeText: formatMessage({
221
+ id: 'deleteText'
222
+ }),
223
+ removeIcon: /*#__PURE__*/jsx(DeleteOutlined, {}),
224
+ empty: /*#__PURE__*/jsx(Empty, {
192
225
  description: false
193
226
  })
194
- }, p, {
195
- locale
196
- }),
227
+ }, p),
197
228
  {
198
229
  className,
199
230
  itemClassName,
@@ -205,7 +236,7 @@ const List = p => {
205
236
  title
206
237
  } = _Object$assign,
207
238
  others = _objectWithoutPropertiesLoose(_Object$assign, _excluded$6);
208
- return /*#__PURE__*/React.createElement(SubList, _extends({}, others, {
239
+ return /*#__PURE__*/jsx(SubList, _extends({}, others, {
209
240
  className: classnames(className, style['list-part']),
210
241
  listRender: _ref => {
211
242
  let {
@@ -214,58 +245,59 @@ const List = p => {
214
245
  onRemove
215
246
  } = _ref,
216
247
  props = _objectWithoutPropertiesLoose(_ref, _excluded2$2);
217
- return /*#__PURE__*/React.createElement("div", {
218
- key: id,
248
+ return /*#__PURE__*/jsxs("div", {
219
249
  className: classnames(style['list-item'], {
220
250
  [style['is-important']]: important
221
- })
222
- }, /*#__PURE__*/React.createElement(FormInfo, _extends({}, props, {
223
- className: style['list-item-part'],
224
- gap: 16,
225
- extra: allowRemove && /*#__PURE__*/React.createElement(Button, {
226
- type: "link",
227
- danger: true,
228
- className: "btn-no-padding",
229
- icon: removeIcon,
230
- onClick: onRemove
231
- }, removeText)
232
- })), /*#__PURE__*/React.createElement(Divider, null));
251
+ }),
252
+ children: [/*#__PURE__*/jsx(FormInfo, _extends({}, props, {
253
+ className: style['list-item-part'],
254
+ gap: 16,
255
+ extra: allowRemove && /*#__PURE__*/jsx(Button, {
256
+ type: "link",
257
+ danger: true,
258
+ className: "btn-no-padding",
259
+ icon: removeIcon,
260
+ onClick: onRemove,
261
+ children: removeText
262
+ })
263
+ })), /*#__PURE__*/jsx(Divider, {})]
264
+ }, id);
265
+ },
266
+ children: (children, {
267
+ allowAdd,
268
+ onAdd
269
+ }) => {
270
+ return /*#__PURE__*/jsx(InfoPage.Part, {
271
+ className: itemClassName,
272
+ title: title,
273
+ extra: allowAdd && /*#__PURE__*/jsx(Button, {
274
+ className: style['extra-btn'],
275
+ icon: addIcon,
276
+ onClick: onAdd,
277
+ children: addText
278
+ }),
279
+ children: children
280
+ });
233
281
  }
234
- }), (children, {
235
- allowAdd,
236
- onAdd
237
- }) => {
238
- return /*#__PURE__*/React.createElement(InfoPage.Part, {
239
- className: itemClassName,
240
- title: title,
241
- extra: allowAdd && /*#__PURE__*/React.createElement(Button, {
242
- className: style['extra-btn'],
243
- icon: addIcon,
244
- onClick: onAdd
245
- }, addText)
246
- }, children);
247
- });
248
- };
282
+ }));
283
+ });
249
284
 
250
285
  const _excluded$5 = ["className", "addText", "addIcon", "removeIcon", "removeText"];
251
- const MultiField = p => {
286
+ const MultiField = withLocale(p => {
252
287
  const {
253
- locale: contextLocale
254
- } = useContext();
255
- const locale = Object.assign({}, {
256
- 添加: '添加'
257
- }, contextLocale, p.locale);
288
+ formatMessage
289
+ } = useIntl();
258
290
  const _Object$assign = Object.assign({}, {
259
- addText: locale['添加'],
260
- addIcon: /*#__PURE__*/React.createElement(PlusOutlined, null),
261
- removeIcon: /*#__PURE__*/React.createElement(DeleteOutlined, null),
291
+ addText: formatMessage({
292
+ id: 'addText'
293
+ }),
294
+ addIcon: /*#__PURE__*/jsx(PlusOutlined, {}),
295
+ removeIcon: /*#__PURE__*/jsx(DeleteOutlined, {}),
262
296
  removeText: null,
263
- empty: /*#__PURE__*/React.createElement(Empty, {
297
+ empty: /*#__PURE__*/jsx(Empty, {
264
298
  description: false
265
299
  })
266
- }, p, {
267
- locale
268
- }),
300
+ }, p),
269
301
  {
270
302
  className,
271
303
  addText,
@@ -274,56 +306,61 @@ const MultiField = p => {
274
306
  removeText
275
307
  } = _Object$assign,
276
308
  others = _objectWithoutPropertiesLoose(_Object$assign, _excluded$5);
277
- return /*#__PURE__*/React.createElement(MultiField$1, _extends({}, others, {
309
+ return /*#__PURE__*/jsx(MultiField$1, _extends({}, others, {
278
310
  itemRender: (children, {
279
311
  id,
280
312
  allowRemove,
281
313
  onRemove
282
314
  }) => {
283
- return /*#__PURE__*/React.createElement("div", {
284
- key: id,
285
- className: classnames('multi-field-item', style['multi-field-item'])
286
- }, children, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
287
- className: classnames(style['react-form__field-label'], 'react-form__field-label', 'multi-field-delete-label')
288
- }), /*#__PURE__*/React.createElement(Button, {
289
- icon: removeIcon,
290
- onClick: onRemove,
291
- disabled: !allowRemove
292
- }, typeof removeText === 'function' ? removeText(others.label) : removeText)));
293
- }
294
- }), (children, {
295
- allowAdd,
296
- onAdd
297
- }) => /*#__PURE__*/React.createElement("div", {
298
- className: classnames(className, 'multi-field', style['multi-field'])
299
- }, children, allowAdd && /*#__PURE__*/React.createElement(Button, {
300
- className: classnames('multi-field-add-btn', style['multi-field-add-btn']),
301
- type: "dashed",
302
- onClick: onAdd,
303
- icon: addIcon
304
- }, typeof addText === 'function' ? addText(others.label) : `${addText}${others.label}`)));
305
- };
315
+ return /*#__PURE__*/jsxs("div", {
316
+ className: classnames('multi-field-item', style['multi-field-item']),
317
+ children: [children, /*#__PURE__*/jsxs("div", {
318
+ children: [/*#__PURE__*/jsx("div", {
319
+ className: classnames(style['react-form__field-label'], 'react-form__field-label', 'multi-field-delete-label')
320
+ }), /*#__PURE__*/jsx(Button, {
321
+ icon: removeIcon,
322
+ onClick: onRemove,
323
+ disabled: !allowRemove,
324
+ children: typeof removeText === 'function' ? removeText(others.label) : removeText
325
+ })]
326
+ })]
327
+ }, id);
328
+ },
329
+ children: (children, {
330
+ allowAdd,
331
+ onAdd
332
+ }) => /*#__PURE__*/jsxs("div", {
333
+ className: classnames(className, 'multi-field', style['multi-field']),
334
+ children: [children, allowAdd && /*#__PURE__*/jsx(Button, {
335
+ className: classnames('multi-field-add-btn', style['multi-field-add-btn']),
336
+ type: "dashed",
337
+ onClick: onAdd,
338
+ icon: addIcon,
339
+ children: typeof addText === 'function' ? addText(others.label) : `${addText}${others.label}`
340
+ })]
341
+ })
342
+ }));
343
+ });
306
344
 
307
345
  const _excluded$4 = ["className", "addIcon", "addText", "removeIcon", "removeText", "title"];
308
- const TableList = p => {
346
+ const TableList = withLocale(p => {
309
347
  const {
310
- locale: contextLocale
311
- } = useContext();
312
- const locale = Object.assign({}, {
313
- 添加: '添加',
314
- 删除: '删除'
315
- }, contextLocale, p.locale);
348
+ formatMessage
349
+ } = useIntl();
316
350
  const _Object$assign = Object.assign({}, {
317
- empty: /*#__PURE__*/React.createElement(Empty, {
318
- description: false
351
+ empty: /*#__PURE__*/jsx(Empty, {
352
+ description: false,
353
+ className: style['table-list-empty']
319
354
  }),
320
- addIcon: /*#__PURE__*/React.createElement(PlusOutlined, null),
321
- addText: locale['添加'],
322
- removeIcon: /*#__PURE__*/React.createElement(DeleteOutlined, null),
323
- removeText: locale['删除']
324
- }, p, {
325
- locale
326
- }),
355
+ addIcon: /*#__PURE__*/jsx(PlusOutlined, {}),
356
+ addText: formatMessage({
357
+ id: 'addText'
358
+ }),
359
+ removeIcon: /*#__PURE__*/jsx(DeleteOutlined, {}),
360
+ removeText: formatMessage({
361
+ id: 'deleteText'
362
+ })
363
+ }, p),
327
364
  {
328
365
  className,
329
366
  addIcon,
@@ -333,36 +370,38 @@ const TableList = p => {
333
370
  title
334
371
  } = _Object$assign,
335
372
  others = _objectWithoutPropertiesLoose(_Object$assign, _excluded$4);
336
- return /*#__PURE__*/React.createElement(TableList$1, _extends({}, others, {
373
+ return /*#__PURE__*/jsx(TableList$1, _extends({}, others, {
337
374
  headerRender: (children, {
338
375
  width
339
376
  }) => {
340
- return /*#__PURE__*/React.createElement(Row, {
377
+ return /*#__PURE__*/jsxs(Row, {
341
378
  className: style['table-list-header'],
342
379
  wrap: false,
343
380
  style: {
344
381
  '--col-width': width
345
- }
346
- }, children, /*#__PURE__*/React.createElement(Col, {
347
- className: style['table-options']
348
- }));
382
+ },
383
+ children: [children, /*#__PURE__*/jsx(Col, {
384
+ className: style['table-options']
385
+ })]
386
+ });
349
387
  },
350
388
  headerItemRender: (children, {
351
389
  id,
352
390
  isReq
353
391
  }) => {
354
- return /*#__PURE__*/React.createElement(Col, {
392
+ return /*#__PURE__*/jsx(Col, {
355
393
  className: classnames({
356
394
  [style['is-req']]: isReq
357
395
  }),
358
- key: id
359
- }, children);
396
+ children: children
397
+ }, id);
360
398
  },
361
399
  itemRender: children => {
362
- return /*#__PURE__*/React.createElement(Col, {
400
+ return /*#__PURE__*/jsx(Col, {
363
401
  className: style['table-list-field'],
364
- flex: 1
365
- }, children);
402
+ flex: 1,
403
+ children: children
404
+ });
366
405
  },
367
406
  listRender: (children, {
368
407
  id,
@@ -370,43 +409,49 @@ const TableList = p => {
370
409
  onRemove,
371
410
  allowRemove
372
411
  }) => {
373
- return /*#__PURE__*/React.createElement(Row, {
374
- key: id,
412
+ return /*#__PURE__*/jsxs(Row, {
375
413
  wrap: false,
376
414
  align: "top",
377
415
  style: {
378
416
  '--col-width': width
379
- }
380
- }, children, /*#__PURE__*/React.createElement(Col, {
381
- className: style['table-options']
382
- }, /*#__PURE__*/React.createElement(Button, {
383
- type: "link",
384
- onClick: onRemove,
385
- danger: true,
386
- disabled: !allowRemove,
387
- icon: removeIcon
388
- }, removeText)));
417
+ },
418
+ children: [children, /*#__PURE__*/jsx(Col, {
419
+ className: style['table-options'],
420
+ children: /*#__PURE__*/jsx(Button, {
421
+ type: "link",
422
+ onClick: onRemove,
423
+ danger: true,
424
+ disabled: !allowRemove,
425
+ icon: removeIcon,
426
+ children: removeText
427
+ })
428
+ })]
429
+ }, id);
430
+ },
431
+ children: (children, {
432
+ onAdd,
433
+ allowAdd
434
+ }) => {
435
+ return /*#__PURE__*/jsx(InfoPage.Part, {
436
+ title: title,
437
+ className: classnames(className, style['table-list']),
438
+ extra: allowAdd && /*#__PURE__*/jsx(Button, {
439
+ className: style['extra-btn'],
440
+ icon: addIcon,
441
+ onClick: onAdd,
442
+ children: addText
443
+ }),
444
+ children: /*#__PURE__*/jsx("div", {
445
+ className: style['table-list-inner'],
446
+ children: children
447
+ })
448
+ });
389
449
  }
390
- }), (children, {
391
- onAdd,
392
- allowAdd
393
- }) => {
394
- return /*#__PURE__*/React.createElement(InfoPage.Part, {
395
- title: title,
396
- className: classnames(className, style['table-list']),
397
- extra: allowAdd && /*#__PURE__*/React.createElement(Button, {
398
- className: style['extra-btn'],
399
- icon: addIcon,
400
- onClick: onAdd
401
- }, addText)
402
- }, /*#__PURE__*/React.createElement("div", {
403
- className: style['table-list-inner']
404
- }, children));
405
- });
406
- };
450
+ }));
451
+ });
407
452
 
408
453
  const _excluded$3 = ["className", "children"];
409
- const Form = forwardRef((props, ref) => {
454
+ const Form = /*#__PURE__*/forwardRef((props, ref) => {
410
455
  const _Object$assign = Object.assign({}, {
411
456
  type: 'inner'
412
457
  }, props),
@@ -415,10 +460,13 @@ const Form = forwardRef((props, ref) => {
415
460
  children
416
461
  } = _Object$assign,
417
462
  others = _objectWithoutPropertiesLoose(_Object$assign, _excluded$3);
418
- return /*#__PURE__*/React.createElement(FormAntd, _extends({}, others, {
463
+ return /*#__PURE__*/jsx(FormAntd, _extends({}, others, {
419
464
  ref: ref,
420
- className: classnames(className, style['form-outer'])
421
- }), /*#__PURE__*/React.createElement(InfoPage, null, children));
465
+ className: classnames(className, style['form-outer']),
466
+ children: /*#__PURE__*/jsx(InfoPage, {
467
+ children: children
468
+ })
469
+ }));
422
470
  });
423
471
 
424
472
  /**
@@ -3676,24 +3724,30 @@ const ModalFooter = props => {
3676
3724
  okText
3677
3725
  } = props,
3678
3726
  others = _objectWithoutPropertiesLoose(props, _excluded$2);
3679
- const defaultFooter = /*#__PURE__*/React.createElement(Flex, {
3727
+ const defaultFooter = /*#__PURE__*/jsxs(Flex, {
3680
3728
  justify: "space-between",
3681
- gap: 8
3682
- }, /*#__PURE__*/React.createElement("div", null), /*#__PURE__*/React.createElement(Flex, {
3683
- gap: 8
3684
- }, /*#__PURE__*/React.createElement(CancelButton, Object.assign({}, cancelButtonProps, {
3685
- onClick: others.onCancel
3686
- }), cancelText), /*#__PURE__*/React.createElement(SubmitButton, Object.assign({}, okButtonProps, {
3687
- type: okType,
3688
- onClick: onOk
3689
- }), okText)));
3729
+ gap: 8,
3730
+ children: [/*#__PURE__*/jsx("div", {}), /*#__PURE__*/jsxs(Flex, {
3731
+ gap: 8,
3732
+ children: [/*#__PURE__*/jsx(CancelButton, _extends({}, Object.assign({}, cancelButtonProps, {
3733
+ onClick: others.onCancel
3734
+ }), {
3735
+ children: cancelText
3736
+ })), /*#__PURE__*/jsx(SubmitButton, _extends({}, Object.assign({}, okButtonProps, {
3737
+ type: okType,
3738
+ onClick: onOk
3739
+ }), {
3740
+ children: okText
3741
+ }))]
3742
+ })]
3743
+ });
3690
3744
  if (typeof children === 'function') {
3691
3745
  return children({
3692
3746
  defaultFooter,
3693
3747
  props: omit_1(props, ['children'])
3694
3748
  });
3695
3749
  }
3696
- if (isValidElement(children) || children === null) {
3750
+ if (/*#__PURE__*/isValidElement(children) || children === null) {
3697
3751
  return children;
3698
3752
  }
3699
3753
  return defaultFooter;
@@ -3706,7 +3760,7 @@ const ModalForm = props => {
3706
3760
  modalRender
3707
3761
  } = props,
3708
3762
  others = _objectWithoutPropertiesLoose(props, _excluded2$1);
3709
- const formChildren = /*#__PURE__*/React.createElement(Form, Object.assign({}, formProps, {
3763
+ const formChildren = /*#__PURE__*/jsx(Form, _extends({}, Object.assign({}, formProps, {
3710
3764
  onSubmit: async (data, ...args) => {
3711
3765
  const res = await (formProps.onSubmit == null ? void 0 : formProps.onSubmit(data, {
3712
3766
  close: others.onCancel
@@ -3716,31 +3770,31 @@ const ModalForm = props => {
3716
3770
  }
3717
3771
  autoClose && others.onCancel && others.onCancel();
3718
3772
  }
3719
- }), children);
3773
+ }), {
3774
+ children: children
3775
+ }));
3720
3776
  return typeof modalRender === 'function' ? modalRender({
3721
3777
  formChildren,
3722
3778
  defaultChildren: children,
3723
3779
  props: omit_1(props, ['children'])
3724
3780
  }) : formChildren;
3725
3781
  };
3726
- const FormModal = p => {
3782
+ const FormModal = withLocale(p => {
3727
3783
  const {
3728
- locale: contextLocale
3729
- } = useContext();
3730
- const locale = Object.assign({}, {
3731
- 提交: '提交',
3732
- 取消: '取消'
3733
- }, contextLocale, p.locale);
3784
+ formatMessage
3785
+ } = useIntl();
3734
3786
  const _Object$assign = Object.assign({}, {
3735
3787
  formProps: {},
3736
3788
  autoClose: true,
3737
3789
  okType: 'primary',
3738
- okText: locale['提交'],
3739
- cancelText: locale['取消'],
3740
- renderModal: props => /*#__PURE__*/React.createElement(Modal, props)
3741
- }, p, {
3742
- locale
3743
- }),
3790
+ okText: formatMessage({
3791
+ id: 'submit'
3792
+ }),
3793
+ cancelText: formatMessage({
3794
+ id: 'cancel'
3795
+ }),
3796
+ renderModal: props => /*#__PURE__*/jsx(Modal, _extends({}, props))
3797
+ }, p),
3744
3798
  {
3745
3799
  formProps,
3746
3800
  okType,
@@ -3756,14 +3810,14 @@ const FormModal = p => {
3756
3810
  } = _Object$assign,
3757
3811
  others = _objectWithoutPropertiesLoose(_Object$assign, _excluded3$1);
3758
3812
  return renderModal(Object.assign({}, others, {
3759
- modalRender: children => /*#__PURE__*/React.createElement(ModalForm, Object.assign({}, others, {
3813
+ modalRender: children => /*#__PURE__*/jsx(ModalForm, _extends({}, Object.assign({}, others, {
3760
3814
  formProps,
3761
3815
  autoClose,
3762
3816
  children,
3763
3817
  modalRender
3764
- })),
3818
+ }))),
3765
3819
  footer: () => {
3766
- return /*#__PURE__*/React.createElement(ModalFooter, Object.assign({}, others, {
3820
+ return /*#__PURE__*/jsx(ModalFooter, _extends({}, Object.assign({}, others, {
3767
3821
  children: footer,
3768
3822
  cancelText,
3769
3823
  cancelButtonProps,
@@ -3771,10 +3825,10 @@ const FormModal = p => {
3771
3825
  okType,
3772
3826
  onOk,
3773
3827
  okText
3774
- }));
3828
+ })));
3775
3829
  }
3776
3830
  }));
3777
- };
3831
+ });
3778
3832
 
3779
3833
  const _excluded$1 = ["className", "stepsClassName", "autoStep", "onComplete", "children"];
3780
3834
  const FormSteps = p => {
@@ -3802,18 +3856,20 @@ const FormSteps = p => {
3802
3856
  const currentFormProps = Object.assign({}, (_stepProps$items$curr = stepProps.items[currentStep]) == null ? void 0 : _stepProps$items$curr.formProps, {
3803
3857
  data: Object.assign({}, (_stepProps$items$curr2 = stepProps.items[currentStep]) == null || (_stepProps$items$curr2 = _stepProps$items$curr2.formProps) == null ? void 0 : _stepProps$items$curr2.data, (_stepCacheRef$current = stepCacheRef.current[currentStep]) == null ? void 0 : _stepCacheRef$current.formData)
3804
3858
  });
3805
- const inner = /*#__PURE__*/React.createElement(Flex, {
3859
+ const inner = /*#__PURE__*/jsxs(Flex, {
3806
3860
  className: className,
3807
- vertical: stepProps.direction !== 'vertical',
3808
- gap: 24
3809
- }, /*#__PURE__*/React.createElement(Steps, _extends({}, omit_1(stepProps, ['current', 'defaultCurrent', 'onChange']), {
3810
- className: classnames(stepsClassName, style['steps']),
3811
- items: stepProps.items.map(item => omit_1(item, ['formProps'])),
3812
- current: currentStep
3813
- })), /*#__PURE__*/React.createElement("div", {
3814
- className: style['steps-form-inner']
3815
- }, (_stepProps$items$curr3 = stepProps.items[currentStep]) == null ? void 0 : _stepProps$items$curr3.children));
3816
- return /*#__PURE__*/React.createElement(Form, _extends({}, Object.assign({}, currentFormProps, {
3861
+ vertical: stepProps.direction !== 'vertical' || stepProps.orientation !== 'vertical',
3862
+ gap: 24,
3863
+ children: [/*#__PURE__*/jsx(Steps, _extends({}, omit_1(stepProps, ['current', 'defaultCurrent', 'onChange']), {
3864
+ className: classnames(stepsClassName, style['steps']),
3865
+ items: stepProps.items.map(item => omit_1(item, ['formProps'])),
3866
+ current: currentStep
3867
+ })), /*#__PURE__*/jsx("div", {
3868
+ className: style['steps-form-inner'],
3869
+ children: (_stepProps$items$curr3 = stepProps.items[currentStep]) == null ? void 0 : _stepProps$items$curr3.children
3870
+ })]
3871
+ });
3872
+ return /*#__PURE__*/createElement(Form, _extends({}, Object.assign({}, currentFormProps, {
3817
3873
  onSubmit: async (data, ...args) => {
3818
3874
  if (!stepCacheRef.current[currentStep]) {
3819
3875
  stepCacheRef.current[currentStep] = {};
@@ -4220,12 +4276,12 @@ var merge_1 = merge;
4220
4276
  const _excluded = ["completeText", "nextText"],
4221
4277
  _excluded2 = ["modalProps", "completeText", "nextText", "className"],
4222
4278
  _excluded3 = ["children"];
4223
- const childrenContext = createContext({});
4279
+ const childrenContext = /*#__PURE__*/createContext({});
4224
4280
  const {
4225
4281
  Provider
4226
4282
  } = childrenContext;
4227
4283
  const useChildrenContext = () => {
4228
- return useContext$1(childrenContext);
4284
+ return useContext(childrenContext);
4229
4285
  };
4230
4286
  const StepChildren = () => {
4231
4287
  const {
@@ -4243,25 +4299,26 @@ const StepFormFooter = p => {
4243
4299
  const {
4244
4300
  isLastStep
4245
4301
  } = useChildrenContext();
4246
- return /*#__PURE__*/React.createElement(ModalFooter, _extends({}, props, {
4302
+ return /*#__PURE__*/jsx(ModalFooter, _extends({}, props, {
4247
4303
  okText: isLastStep ? completeText : nextText
4248
4304
  }));
4249
4305
  };
4250
- const FormStepsModal = p => {
4251
- const locale = Object.assign({}, {
4252
- 完成: '完成',
4253
- 下一步: '下一步'
4254
- }, p.locale);
4306
+ const FormStepsModal = withLocale(p => {
4307
+ const {
4308
+ formatMessage
4309
+ } = useIntl();
4255
4310
  const _merge = merge_1({}, {
4256
4311
  autoStep: true,
4257
4312
  modalProps: {
4258
4313
  autoClose: true
4259
4314
  },
4260
- completeText: locale['完成'],
4261
- nextText: locale['下一步']
4262
- }, p, {
4263
- locale
4264
- }),
4315
+ completeText: formatMessage({
4316
+ id: 'complete'
4317
+ }),
4318
+ nextText: formatMessage({
4319
+ id: 'next'
4320
+ })
4321
+ }, p),
4265
4322
  {
4266
4323
  modalProps,
4267
4324
  completeText,
@@ -4269,11 +4326,11 @@ const FormStepsModal = p => {
4269
4326
  className
4270
4327
  } = _merge,
4271
4328
  others = _objectWithoutPropertiesLoose(_merge, _excluded2);
4272
- return /*#__PURE__*/React.createElement(FormModal, _extends({}, modalProps, {
4329
+ return /*#__PURE__*/jsx(FormModal, _extends({}, modalProps, {
4273
4330
  modalRender: ({
4274
4331
  defaultChildren
4275
4332
  }) => {
4276
- return /*#__PURE__*/React.createElement(FormSteps, _extends({}, Object.assign({}, others, {
4333
+ return /*#__PURE__*/jsx(FormSteps, _extends({}, Object.assign({}, others, {
4277
4334
  items: others.items.map(item => {
4278
4335
  return Object.assign({}, item, {
4279
4336
  formProps: Object.assign({}, item.formProps, {
@@ -4291,29 +4348,32 @@ const FormStepsModal = p => {
4291
4348
  onComplete: async data => {
4292
4349
  const res = await (others.onComplete == null ? void 0 : others.onComplete(data));
4293
4350
  modalProps.autoClose && res !== false && (modalProps.onCancel == null ? void 0 : modalProps.onCancel());
4351
+ },
4352
+ children: _ref => {
4353
+ let {
4354
+ children: stepChildren
4355
+ } = _ref,
4356
+ props = _objectWithoutPropertiesLoose(_ref, _excluded3);
4357
+ return /*#__PURE__*/jsx(Provider, {
4358
+ value: _extends({
4359
+ stepChildren
4360
+ }, props),
4361
+ children: defaultChildren
4362
+ });
4294
4363
  }
4295
- }), _ref => {
4296
- let {
4297
- children: stepChildren
4298
- } = _ref,
4299
- props = _objectWithoutPropertiesLoose(_ref, _excluded3);
4300
- return /*#__PURE__*/React.createElement(Provider, {
4301
- value: _extends({
4302
- stepChildren
4303
- }, props)
4304
- }, defaultChildren);
4305
- });
4364
+ }));
4306
4365
  },
4307
4366
  footer: ({
4308
4367
  props
4309
4368
  }) => {
4310
- return /*#__PURE__*/React.createElement(StepFormFooter, _extends({}, props, {
4369
+ return /*#__PURE__*/jsx(StepFormFooter, _extends({}, props, {
4311
4370
  completeText: completeText,
4312
4371
  nextText: nextText
4313
4372
  }));
4314
- }
4315
- }), /*#__PURE__*/React.createElement(StepChildren, null));
4316
- };
4373
+ },
4374
+ children: /*#__PURE__*/jsx(StepChildren, {})
4375
+ }));
4376
+ });
4317
4377
 
4318
4378
  export { Form, FormModal, FormSteps, FormStepsModal, List, MultiField, List as SubList, TableList, FormInfo as default };
4319
4379
  //# sourceMappingURL=index.modern.js.map