@kne/form-info 0.1.7 → 0.1.10

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.
package/dist/index.js CHANGED
@@ -5,15 +5,19 @@ var react = require('react');
5
5
  var InfoPage = require('@kne/info-page');
6
6
  var flexBox = require('@kne/flex-box');
7
7
  var reactFormPlus = require('@kne/react-form-plus');
8
+ var responsiveUtils = require('@kne/responsive-utils');
8
9
  var antd = require('antd');
9
10
  var jsxRuntime = require('react/jsx-runtime');
10
11
  var icons = require('@ant-design/icons');
11
12
  var reactIntl = require('@kne/react-intl');
13
+ var TableView = require('@kne/table-view');
14
+ require('@kne/table-view/dist/index.css');
12
15
  var useControlValue = require('@kne/use-control-value');
13
16
 
14
17
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
15
18
 
16
19
  var InfoPage__default = /*#__PURE__*/_interopDefaultLegacy(InfoPage);
20
+ var TableView__default = /*#__PURE__*/_interopDefaultLegacy(TableView);
17
21
  var useControlValue__default = /*#__PURE__*/_interopDefaultLegacy(useControlValue);
18
22
 
19
23
  function _extends() {
@@ -117,7 +121,7 @@ var classnames = createCommonjsModule(function (module) {
117
121
  }());
118
122
  });
119
123
 
120
- 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","extra-container":"_wU-w4"};
124
+ var style = {"kne-responsive-boundary":"kne-form-info_gh14z","kne-responsive-scroll":"kne-form-info_Kfn6L","form-outer":"kne-form-info_ZQNNL","form-info":"kne-form-info_GW4Xx","extra-btn":"kne-form-info_eY4qR","list-part":"kne-form-info_SL3dC","list-item":"kne-form-info_PNnMa","list-item-part":"kne-form-info_HiB5Q","is-important":"kne-form-info_Xkp38","table-list-inner":"kne-form-info_Uw-3T","multi-field-item":"kne-form-info_uogqr","react-form__field-label":"kne-form-info_UGjS9","multi-field-add-btn":"kne-form-info_rjVPh","table-list-view":"kne-form-info_ZD9zd","table-list":"kne-form-info_r8-bn","is-mobile":"kne-form-info_LtgJz","table-list-mobile-list":"kne-form-info_5uGUh","table-list-mobile-card":"kne-form-info_H8TZT","table-list-mobile-card-body":"kne-form-info_3Mhy7","table-list-mobile-field":"kne-form-info_-e-f1","table-list-mobile-actions":"kne-form-info_FVPV7","table-list-field":"kne-form-info_Qkutm","table-list-header":"kne-form-info_9WdfD","is-req":"kne-form-info_CsPaL","table-options":"kne-form-info_8smwK","steps":"kne-form-info_IOdkE","steps-vertical":"kne-form-info_03aHQ","steps-form-inner":"kne-form-info_uc1HZ","steps-modal":"kne-form-info_vWPQO","table-list-empty":"kne-form-info_DXskv","extra-container":"kne-form-info_wU-w4"};
121
125
 
122
126
  const _excluded$7 = ["className", "column", "list", "gap"];
123
127
  const FormInfo = props => {
@@ -125,18 +129,16 @@ const FormInfo = props => {
125
129
  column: 2,
126
130
  list: []
127
131
  }, props),
128
- {
129
- className,
130
- column,
131
- list,
132
- gap
133
- } = _Object$assign,
132
+ className = _Object$assign.className,
133
+ column = _Object$assign.column,
134
+ list = _Object$assign.list,
135
+ gap = _Object$assign.gap,
134
136
  others = _objectWithoutPropertiesLoose(_Object$assign, _excluded$7);
135
- const isFlexBox = !(Number.isInteger(column) && column > 0);
136
- const {
137
- ref: flexBoxRef,
138
- column: flexBoxColumn
139
- } = flexBox.useFlexBox(isFlexBox ? column : {});
137
+ const isMobile = responsiveUtils.useIsMobile();
138
+ const isFlexBox = !isMobile && !(Number.isInteger(column) && column > 0);
139
+ const _useFlexBox = flexBox.useFlexBox(isFlexBox ? column : {}),
140
+ flexBoxRef = _useFlexBox.ref,
141
+ flexBoxColumn = _useFlexBox.column;
140
142
  const renderInner = (column, notLayout) => {
141
143
  return /*#__PURE__*/jsxRuntime.jsx(reactFormPlus.FormInfo, {
142
144
  list: list,
@@ -167,6 +169,9 @@ const FormInfo = props => {
167
169
  });
168
170
  };
169
171
  const renderColumn = () => {
172
+ if (isMobile) {
173
+ return renderInner(1);
174
+ }
170
175
  if (!isFlexBox) {
171
176
  return renderInner(column);
172
177
  }
@@ -210,12 +215,12 @@ const withLocale = reactIntl.createWithIntlProvider({
210
215
  namespace: 'form-info'
211
216
  });
212
217
 
213
- const _excluded$6 = ["className", "itemClassName", "removeIcon", "removeText", "addText", "addIcon", "important", "title"],
218
+ const _excluded$6 = ["className", "itemClassName", "removeIcon", "removeText", "addText", "addIcon", "important", "title", "bordered"],
214
219
  _excluded2$2 = ["id", "allowRemove", "onRemove", "index", "groupArgs"];
215
220
  const List = withLocale(p => {
216
- const {
217
- formatMessage
218
- } = reactIntl.useIntl();
221
+ const _useIntl = reactIntl.useIntl(),
222
+ formatMessage = _useIntl.formatMessage;
223
+ const isMobile = responsiveUtils.useIsMobile();
219
224
  const _Object$assign = Object.assign({}, {
220
225
  addText: formatMessage({
221
226
  id: 'addText'
@@ -229,31 +234,29 @@ const List = withLocale(p => {
229
234
  description: false
230
235
  })
231
236
  }, p),
232
- {
233
- className,
234
- itemClassName,
235
- removeIcon,
236
- removeText,
237
- addText,
238
- addIcon,
239
- important,
240
- title
241
- } = _Object$assign,
237
+ className = _Object$assign.className,
238
+ itemClassName = _Object$assign.itemClassName,
239
+ removeIcon = _Object$assign.removeIcon,
240
+ removeText = _Object$assign.removeText,
241
+ addText = _Object$assign.addText,
242
+ addIcon = _Object$assign.addIcon,
243
+ important = _Object$assign.important,
244
+ title = _Object$assign.title,
245
+ bordered = _Object$assign.bordered,
242
246
  others = _objectWithoutPropertiesLoose(_Object$assign, _excluded$6);
247
+ const showBorder = isMobile ? false : bordered;
243
248
  return /*#__PURE__*/jsxRuntime.jsx(reactFormPlus.SubList, _extends({}, others, {
244
- className: classnames(className, style['list-part']),
245
249
  listRender: _ref => {
246
- let {
247
- id,
248
- allowRemove,
249
- onRemove
250
- } = _ref,
250
+ let id = _ref.id,
251
+ allowRemove = _ref.allowRemove,
252
+ onRemove = _ref.onRemove,
251
253
  props = _objectWithoutPropertiesLoose(_ref, _excluded2$2);
252
254
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
253
255
  className: classnames(style['list-item'], {
254
256
  [style['is-important']]: important
255
257
  }),
256
258
  children: [/*#__PURE__*/jsxRuntime.jsx(FormInfo, _extends({}, props, {
259
+ bordered: showBorder,
257
260
  className: style['list-item-part'],
258
261
  gap: 16,
259
262
  extra: allowRemove && /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
@@ -268,13 +271,12 @@ const List = withLocale(p => {
268
271
  }, id);
269
272
  },
270
273
  children: (children, _ref2) => {
271
- let {
272
- allowAdd,
273
- onAdd
274
- } = _ref2;
274
+ let allowAdd = _ref2.allowAdd,
275
+ onAdd = _ref2.onAdd;
275
276
  return /*#__PURE__*/jsxRuntime.jsx(InfoPage__default["default"].Part, {
276
- className: itemClassName,
277
+ className: classnames(className, itemClassName, style['list-part']),
277
278
  title: title,
279
+ bordered: showBorder,
278
280
  extra: /*#__PURE__*/jsxRuntime.jsx("div", {
279
281
  className: style['extra-container'],
280
282
  children: allowAdd && /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
@@ -292,9 +294,8 @@ const List = withLocale(p => {
292
294
 
293
295
  const _excluded$5 = ["className", "addText", "addIcon", "removeIcon", "removeText"];
294
296
  const MultiField = withLocale(p => {
295
- const {
296
- formatMessage
297
- } = reactIntl.useIntl();
297
+ const _useIntl = reactIntl.useIntl(),
298
+ formatMessage = _useIntl.formatMessage;
298
299
  const _Object$assign = Object.assign({}, {
299
300
  addText: formatMessage({
300
301
  id: 'addText'
@@ -306,21 +307,17 @@ const MultiField = withLocale(p => {
306
307
  description: false
307
308
  })
308
309
  }, p),
309
- {
310
- className,
311
- addText,
312
- addIcon,
313
- removeIcon,
314
- removeText
315
- } = _Object$assign,
310
+ className = _Object$assign.className,
311
+ addText = _Object$assign.addText,
312
+ addIcon = _Object$assign.addIcon,
313
+ removeIcon = _Object$assign.removeIcon,
314
+ removeText = _Object$assign.removeText,
316
315
  others = _objectWithoutPropertiesLoose(_Object$assign, _excluded$5);
317
316
  return /*#__PURE__*/jsxRuntime.jsx(reactFormPlus.MultiField, _extends({}, others, {
318
317
  itemRender: (children, _ref) => {
319
- let {
320
- id,
321
- allowRemove,
322
- onRemove
323
- } = _ref;
318
+ let id = _ref.id,
319
+ allowRemove = _ref.allowRemove,
320
+ onRemove = _ref.onRemove;
324
321
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
325
322
  className: classnames('multi-field-item', style['multi-field-item']),
326
323
  children: [children, /*#__PURE__*/jsxRuntime.jsxs("div", {
@@ -336,10 +333,8 @@ const MultiField = withLocale(p => {
336
333
  }, id);
337
334
  },
338
335
  children: (children, _ref2) => {
339
- let {
340
- allowAdd,
341
- onAdd
342
- } = _ref2;
336
+ let allowAdd = _ref2.allowAdd,
337
+ onAdd = _ref2.onAdd;
343
338
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
344
339
  className: classnames(className, 'multi-field', style['multi-field']),
345
340
  children: [children, allowAdd && /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
@@ -354,11 +349,28 @@ const MultiField = withLocale(p => {
354
349
  }));
355
350
  });
356
351
 
357
- const _excluded$4 = ["className", "addIcon", "addText", "removeIcon", "removeText", "title"];
352
+ const _excluded$4 = ["className", "addIcon", "addText", "removeIcon", "removeText", "title", "bordered", "renderMobile", "list"];
353
+ const buildColumns = (list, _ref) => {
354
+ let removeText = _ref.removeText;
355
+ const fieldList = Array.isArray(list) ? list : [];
356
+ return [...fieldList.filter(item => {
357
+ var _item$props, _item$props2;
358
+ return (item == null || (_item$props = item.props) == null ? void 0 : _item$props.display) !== false && !(item != null && (_item$props2 = item.props) != null && _item$props2.hidden);
359
+ }).map(item => ({
360
+ name: item.props.name,
361
+ title: item.props.label,
362
+ render: value => value
363
+ })), {
364
+ name: '__options__',
365
+ type: 'options',
366
+ title: removeText || '',
367
+ width: 100,
368
+ render: value => value
369
+ }];
370
+ };
358
371
  const TableList = withLocale(p => {
359
- const {
360
- formatMessage
361
- } = reactIntl.useIntl();
372
+ const _useIntl = reactIntl.useIntl(),
373
+ formatMessage = _useIntl.formatMessage;
362
374
  const _Object$assign = Object.assign({}, {
363
375
  empty: /*#__PURE__*/jsxRuntime.jsx(antd.Empty, {
364
376
  description: false,
@@ -373,20 +385,46 @@ const TableList = withLocale(p => {
373
385
  id: 'deleteText'
374
386
  })
375
387
  }, p),
376
- {
377
- className,
378
- addIcon,
379
- addText,
380
- removeIcon,
381
- removeText,
382
- title
383
- } = _Object$assign,
388
+ className = _Object$assign.className,
389
+ addIcon = _Object$assign.addIcon,
390
+ addText = _Object$assign.addText,
391
+ removeIcon = _Object$assign.removeIcon,
392
+ removeText = _Object$assign.removeText,
393
+ title = _Object$assign.title,
394
+ bordered = _Object$assign.bordered,
395
+ _Object$assign$render = _Object$assign.renderMobile,
396
+ renderMobile = _Object$assign$render === void 0 ? true : _Object$assign$render,
397
+ list = _Object$assign.list,
384
398
  others = _objectWithoutPropertiesLoose(_Object$assign, _excluded$4);
385
- return /*#__PURE__*/jsxRuntime.jsx(reactFormPlus.TableList, _extends({}, others, {
386
- headerRender: (children, _ref) => {
387
- let {
388
- width
389
- } = _ref;
399
+ const isMobile = responsiveUtils.useIsMobile();
400
+ const useMobileRender = TableView.isRenderMobileActive(renderMobile, isMobile);
401
+ const resolvedRenderMobile = react.useMemo(() => TableView.resolveRenderMobile(renderMobile), [renderMobile]);
402
+ const columns = react.useMemo(() => buildColumns(list, {
403
+ removeText
404
+ }), [list, removeText]);
405
+ const renderPart = (children, _ref2, extraClassName) => {
406
+ let onAdd = _ref2.onAdd,
407
+ allowAdd = _ref2.allowAdd;
408
+ return /*#__PURE__*/jsxRuntime.jsx(InfoPage__default["default"].Part, {
409
+ title: title,
410
+ className: classnames(className, style['table-list'], extraClassName),
411
+ bordered: bordered,
412
+ extra: /*#__PURE__*/jsxRuntime.jsx("div", {
413
+ className: style['extra-container'],
414
+ children: allowAdd && /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
415
+ className: style['extra-btn'],
416
+ icon: addIcon,
417
+ onClick: onAdd,
418
+ children: addText
419
+ })
420
+ }),
421
+ children: children
422
+ });
423
+ };
424
+ const renderDesktop = () => /*#__PURE__*/jsxRuntime.jsx(reactFormPlus.TableList, _extends({}, others, {
425
+ list: list,
426
+ headerRender: (children, _ref3) => {
427
+ let width = _ref3.width;
390
428
  return /*#__PURE__*/jsxRuntime.jsxs(antd.Row, {
391
429
  className: style['table-list-header'],
392
430
  wrap: false,
@@ -398,11 +436,9 @@ const TableList = withLocale(p => {
398
436
  })]
399
437
  });
400
438
  },
401
- headerItemRender: (children, _ref2) => {
402
- let {
403
- id,
404
- isReq
405
- } = _ref2;
439
+ headerItemRender: (children, _ref4) => {
440
+ let id = _ref4.id,
441
+ isReq = _ref4.isReq;
406
442
  return /*#__PURE__*/jsxRuntime.jsx(antd.Col, {
407
443
  className: classnames({
408
444
  [style['is-req']]: isReq
@@ -417,13 +453,11 @@ const TableList = withLocale(p => {
417
453
  children: children
418
454
  });
419
455
  },
420
- listRender: (children, _ref3) => {
421
- let {
422
- id,
423
- width,
424
- onRemove,
425
- allowRemove
426
- } = _ref3;
456
+ listRender: (children, _ref5) => {
457
+ let id = _ref5.id,
458
+ width = _ref5.width,
459
+ onRemove = _ref5.onRemove,
460
+ allowRemove = _ref5.allowRemove;
427
461
  return /*#__PURE__*/jsxRuntime.jsxs(antd.Row, {
428
462
  wrap: false,
429
463
  align: "top",
@@ -443,30 +477,67 @@ const TableList = withLocale(p => {
443
477
  })]
444
478
  }, id);
445
479
  },
446
- children: (children, _ref4) => {
447
- let {
448
- onAdd,
449
- allowAdd
450
- } = _ref4;
451
- return /*#__PURE__*/jsxRuntime.jsx(InfoPage__default["default"].Part, {
452
- title: title,
453
- className: classnames(className, style['table-list']),
454
- extra: /*#__PURE__*/jsxRuntime.jsx("div", {
455
- className: style['extra-container'],
456
- children: allowAdd && /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
457
- className: style['extra-btn'],
458
- icon: addIcon,
459
- onClick: onAdd,
460
- children: addText
480
+ children: (children, controls) => renderPart(/*#__PURE__*/jsxRuntime.jsx("div", {
481
+ className: style['table-list-inner'],
482
+ children: children
483
+ }), controls)
484
+ }));
485
+ const renderMobileList = () => /*#__PURE__*/jsxRuntime.jsx(reactFormPlus.SubList, _extends({}, others, {
486
+ list: list,
487
+ listRender: _ref6 => {
488
+ let id = _ref6.id,
489
+ rowList = _ref6.list,
490
+ groupArgs = _ref6.groupArgs,
491
+ onRemove = _ref6.onRemove,
492
+ allowRemove = _ref6.allowRemove;
493
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
494
+ className: classnames(style['table-list-mobile-card'], 'info-page-table-mobile-card'),
495
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
496
+ className: style['table-list-mobile-card-body'],
497
+ children: /*#__PURE__*/jsxRuntime.jsx(reactFormPlus.FieldList, {
498
+ list: rowList,
499
+ groupArgs: groupArgs,
500
+ itemRender: (children, targetProps) => {
501
+ if (targetProps.hidden) {
502
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
503
+ style: {
504
+ display: 'none'
505
+ },
506
+ children: children
507
+ });
508
+ }
509
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
510
+ className: style['table-list-mobile-field'],
511
+ children: children
512
+ });
513
+ }
461
514
  })
462
- }),
463
- children: /*#__PURE__*/jsxRuntime.jsx("div", {
464
- className: style['table-list-inner'],
465
- children: children
466
- })
467
- });
468
- }
515
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
516
+ className: style['table-list-mobile-actions'],
517
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
518
+ type: "link",
519
+ onClick: onRemove,
520
+ danger: true,
521
+ disabled: !allowRemove,
522
+ icon: removeIcon,
523
+ children: removeText
524
+ })
525
+ })]
526
+ }, id);
527
+ },
528
+ children: (children, controls) => renderPart(/*#__PURE__*/jsxRuntime.jsx("div", {
529
+ className: classnames(style['table-list-mobile-list'], 'info-page-table-mobile-card-list'),
530
+ children: children
531
+ }), controls, style['is-mobile'])
469
532
  }));
533
+ return /*#__PURE__*/jsxRuntime.jsx(TableView__default["default"], {
534
+ columns: columns,
535
+ dataSource: [],
536
+ empty: null,
537
+ className: style['table-list-view'],
538
+ renderMobile: useMobileRender ? typeof resolvedRenderMobile === 'function' ? resolvedRenderMobile : () => renderMobileList() : false,
539
+ render: () => renderDesktop()
540
+ });
470
541
  });
471
542
 
472
543
  const _excluded$3 = ["className", "children"];
@@ -474,10 +545,8 @@ const Form = /*#__PURE__*/react.forwardRef((props, ref) => {
474
545
  const _Object$assign = Object.assign({}, {
475
546
  type: 'inner'
476
547
  }, props),
477
- {
478
- className,
479
- children
480
- } = _Object$assign,
548
+ className = _Object$assign.className,
549
+ children = _Object$assign.children,
481
550
  others = _objectWithoutPropertiesLoose(_Object$assign, _excluded$3);
482
551
  return /*#__PURE__*/jsxRuntime.jsx(reactFormAntd.FormAntd, _extends({}, others, {
483
552
  ref: ref,
@@ -3345,7 +3414,9 @@ var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
3345
3414
  function baseUnset(object, path) {
3346
3415
  path = _castPath(path, object);
3347
3416
 
3348
- // Prevent prototype pollution, see: https://github.com/lodash/lodash/security/advisories/GHSA-xxjr-mmjv-4gpg
3417
+ // Prevent prototype pollution:
3418
+ // https://github.com/lodash/lodash/security/advisories/GHSA-xxjr-mmjv-4gpg
3419
+ // https://github.com/lodash/lodash/security/advisories/GHSA-f23m-r3pf-42rh
3349
3420
  var index = -1,
3350
3421
  length = path.length;
3351
3422
 
@@ -3353,32 +3424,17 @@ function baseUnset(object, path) {
3353
3424
  return true;
3354
3425
  }
3355
3426
 
3356
- var isRootPrimitive = object == null || (typeof object !== 'object' && typeof object !== 'function');
3357
-
3358
3427
  while (++index < length) {
3359
- var key = path[index];
3360
-
3361
- // skip non-string keys (e.g., Symbols, numbers)
3362
- if (typeof key !== 'string') {
3363
- continue;
3364
- }
3428
+ var key = _toKey(path[index]);
3365
3429
 
3366
3430
  // Always block "__proto__" anywhere in the path if it's not expected
3367
3431
  if (key === '__proto__' && !hasOwnProperty$1.call(object, '__proto__')) {
3368
3432
  return false;
3369
3433
  }
3370
3434
 
3371
- // Block "constructor.prototype" chains
3372
- if (key === 'constructor' &&
3373
- (index + 1) < length &&
3374
- typeof path[index + 1] === 'string' &&
3375
- path[index + 1] === 'prototype') {
3376
-
3377
- // Allow ONLY when the path starts at a primitive root, e.g., _.unset(0, 'constructor.prototype.a')
3378
- if (isRootPrimitive && index === 0) {
3379
- continue;
3380
- }
3381
-
3435
+ // Block constructor/prototype as non-terminal traversal keys to prevent
3436
+ // escaping the object graph into built-in constructors and prototypes.
3437
+ if ((key === 'constructor' || key === 'prototype') && index < length - 1) {
3382
3438
  return false;
3383
3439
  }
3384
3440
  }
@@ -3778,15 +3834,13 @@ const _excluded$2 = ["children", "cancelText", "cancelButtonProps", "okButtonPro
3778
3834
  _excluded2$1 = ["formProps", "autoClose", "children", "modalRender"],
3779
3835
  _excluded3$1 = ["formProps", "okType", "okButtonProps", "okText", "onOk", "cancelButtonProps", "cancelText", "footer", "renderModal", "modalRender", "autoClose"];
3780
3836
  const ModalFooter = props => {
3781
- const {
3782
- children,
3783
- cancelText,
3784
- cancelButtonProps,
3785
- okButtonProps,
3786
- okType,
3787
- onOk,
3788
- okText
3789
- } = props,
3837
+ const children = props.children,
3838
+ cancelText = props.cancelText,
3839
+ cancelButtonProps = props.cancelButtonProps,
3840
+ okButtonProps = props.okButtonProps,
3841
+ okType = props.okType,
3842
+ onOk = props.onOk,
3843
+ okText = props.okText,
3790
3844
  others = _objectWithoutPropertiesLoose(props, _excluded$2);
3791
3845
  const defaultFooter = /*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
3792
3846
  justify: "space-between",
@@ -3817,12 +3871,10 @@ const ModalFooter = props => {
3817
3871
  return defaultFooter;
3818
3872
  };
3819
3873
  const ModalForm = props => {
3820
- const {
3821
- formProps,
3822
- autoClose,
3823
- children,
3824
- modalRender
3825
- } = props,
3874
+ const formProps = props.formProps,
3875
+ autoClose = props.autoClose,
3876
+ children = props.children,
3877
+ modalRender = props.modalRender,
3826
3878
  others = _objectWithoutPropertiesLoose(props, _excluded2$1);
3827
3879
  const formChildren = /*#__PURE__*/jsxRuntime.jsx(Form, _extends({}, Object.assign({}, formProps, {
3828
3880
  onSubmit: function (data) {
@@ -3850,9 +3902,8 @@ const ModalForm = props => {
3850
3902
  }) : formChildren;
3851
3903
  };
3852
3904
  const FormModal = withLocale(p => {
3853
- const {
3854
- formatMessage
3855
- } = reactIntl.useIntl();
3905
+ const _useIntl = reactIntl.useIntl(),
3906
+ formatMessage = _useIntl.formatMessage;
3856
3907
  const _Object$assign = Object.assign({}, {
3857
3908
  formProps: {},
3858
3909
  autoClose: true,
@@ -3865,19 +3916,17 @@ const FormModal = withLocale(p => {
3865
3916
  }),
3866
3917
  renderModal: props => /*#__PURE__*/jsxRuntime.jsx(antd.Modal, _extends({}, props))
3867
3918
  }, p),
3868
- {
3869
- formProps,
3870
- okType,
3871
- okButtonProps,
3872
- okText,
3873
- onOk,
3874
- cancelButtonProps,
3875
- cancelText,
3876
- footer,
3877
- renderModal,
3878
- modalRender,
3879
- autoClose
3880
- } = _Object$assign,
3919
+ formProps = _Object$assign.formProps,
3920
+ okType = _Object$assign.okType,
3921
+ okButtonProps = _Object$assign.okButtonProps,
3922
+ okText = _Object$assign.okText,
3923
+ onOk = _Object$assign.onOk,
3924
+ cancelButtonProps = _Object$assign.cancelButtonProps,
3925
+ cancelText = _Object$assign.cancelText,
3926
+ footer = _Object$assign.footer,
3927
+ renderModal = _Object$assign.renderModal,
3928
+ modalRender = _Object$assign.modalRender,
3929
+ autoClose = _Object$assign.autoClose,
3881
3930
  others = _objectWithoutPropertiesLoose(_Object$assign, _excluded3$1);
3882
3931
  return renderModal(Object.assign({}, others, {
3883
3932
  modalRender: children => /*#__PURE__*/jsxRuntime.jsx(ModalForm, _extends({}, Object.assign({}, others, {
@@ -3909,18 +3958,19 @@ const FormSteps = p => {
3909
3958
  items: [],
3910
3959
  onComplete: () => {}
3911
3960
  }, p),
3912
- {
3913
- className,
3914
- stepsClassName,
3915
- autoStep,
3916
- onComplete,
3917
- children
3918
- } = _Object$assign,
3961
+ className = _Object$assign.className,
3962
+ stepsClassName = _Object$assign.stepsClassName,
3963
+ autoStep = _Object$assign.autoStep,
3964
+ onComplete = _Object$assign.onComplete,
3965
+ children = _Object$assign.children,
3919
3966
  stepProps = _objectWithoutPropertiesLoose(_Object$assign, _excluded$1);
3920
- const [currentStep, onStepChange] = useControlValue__default["default"](stepProps, {
3921
- value: 'current',
3922
- defaultValue: 'defaultCurrent'
3923
- });
3967
+ const isMobile = responsiveUtils.useIsMobile();
3968
+ const _useControlValue = useControlValue__default["default"](stepProps, {
3969
+ value: 'current',
3970
+ defaultValue: 'defaultCurrent'
3971
+ }),
3972
+ currentStep = _useControlValue[0],
3973
+ onStepChange = _useControlValue[1];
3924
3974
  const stepCacheRef = react.useRef([]);
3925
3975
  const isLastStep = currentStep === stepProps.items.length - 1;
3926
3976
  const currentFormProps = Object.assign({}, (_stepProps$items$curr = stepProps.items[currentStep]) == null ? void 0 : _stepProps$items$curr.formProps, {
@@ -3942,12 +3992,20 @@ const FormSteps = p => {
3942
3992
  }
3943
3993
  return currentItem;
3944
3994
  });
3995
+
3996
+ // 移动端强制垂直布局,不允许水平 Steps
3997
+ const stepsDirection = isMobile ? 'vertical' : stepProps.direction || stepProps.orientation;
3998
+ const isVerticalSteps = stepsDirection === 'vertical';
3945
3999
  const inner = /*#__PURE__*/jsxRuntime.jsxs(antd.Flex, {
3946
4000
  className: className,
3947
- vertical: stepProps.direction !== 'vertical' || stepProps.orientation !== 'vertical',
4001
+ vertical: !isVerticalSteps || isMobile,
3948
4002
  gap: 24,
3949
- children: [/*#__PURE__*/jsxRuntime.jsx(antd.Steps, _extends({}, omit_1(stepProps, ['current', 'defaultCurrent', 'onChange']), {
3950
- className: classnames(stepsClassName, style['steps']),
4003
+ children: [/*#__PURE__*/jsxRuntime.jsx(antd.Steps, _extends({}, omit_1(stepProps, ['current', 'defaultCurrent', 'onChange', 'direction', 'orientation']), {
4004
+ direction: stepsDirection,
4005
+ orientation: stepsDirection,
4006
+ className: classnames(stepsClassName, style['steps'], {
4007
+ [style['steps-vertical']]: isVerticalSteps
4008
+ }),
3951
4009
  items: stepItems,
3952
4010
  current: currentStep
3953
4011
  })), /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -4379,36 +4437,29 @@ const _excluded = ["completeText", "nextText"],
4379
4437
  _excluded2 = ["modalProps", "completeText", "nextText", "className"],
4380
4438
  _excluded3 = ["children"];
4381
4439
  const childrenContext = /*#__PURE__*/react.createContext({});
4382
- const {
4383
- Provider
4384
- } = childrenContext;
4440
+ const Provider = childrenContext.Provider;
4385
4441
  const useChildrenContext = () => {
4386
4442
  return react.useContext(childrenContext);
4387
4443
  };
4388
4444
  const StepChildren = () => {
4389
- const {
4390
- stepChildren
4391
- } = useChildrenContext();
4445
+ const _useChildrenContext = useChildrenContext(),
4446
+ stepChildren = _useChildrenContext.stepChildren;
4392
4447
  return stepChildren;
4393
4448
  };
4394
4449
  const StepFormFooter = p => {
4395
4450
  const _Object$assign = Object.assign({}, p),
4396
- {
4397
- completeText,
4398
- nextText
4399
- } = _Object$assign,
4451
+ completeText = _Object$assign.completeText,
4452
+ nextText = _Object$assign.nextText,
4400
4453
  props = _objectWithoutPropertiesLoose(_Object$assign, _excluded);
4401
- const {
4402
- isLastStep
4403
- } = useChildrenContext();
4454
+ const _useChildrenContext2 = useChildrenContext(),
4455
+ isLastStep = _useChildrenContext2.isLastStep;
4404
4456
  return /*#__PURE__*/jsxRuntime.jsx(ModalFooter, _extends({}, props, {
4405
4457
  okText: isLastStep ? completeText : nextText
4406
4458
  }));
4407
4459
  };
4408
4460
  const FormStepsModal = withLocale(p => {
4409
- const {
4410
- formatMessage
4411
- } = reactIntl.useIntl();
4461
+ const _useIntl = reactIntl.useIntl(),
4462
+ formatMessage = _useIntl.formatMessage;
4412
4463
  const _merge = merge_1({}, {
4413
4464
  autoStep: true,
4414
4465
  modalProps: {
@@ -4421,18 +4472,14 @@ const FormStepsModal = withLocale(p => {
4421
4472
  id: 'next'
4422
4473
  })
4423
4474
  }, p),
4424
- {
4425
- modalProps,
4426
- completeText,
4427
- nextText,
4428
- className
4429
- } = _merge,
4475
+ modalProps = _merge.modalProps,
4476
+ completeText = _merge.completeText,
4477
+ nextText = _merge.nextText,
4478
+ className = _merge.className,
4430
4479
  others = _objectWithoutPropertiesLoose(_merge, _excluded2);
4431
4480
  return /*#__PURE__*/jsxRuntime.jsx(FormModal, _extends({}, modalProps, {
4432
4481
  modalRender: _ref => {
4433
- let {
4434
- defaultChildren
4435
- } = _ref;
4482
+ let defaultChildren = _ref.defaultChildren;
4436
4483
  return /*#__PURE__*/jsxRuntime.jsx(FormSteps, _extends({}, Object.assign({}, others, {
4437
4484
  items: others.items.map(item => {
4438
4485
  return Object.assign({}, item, {
@@ -4458,9 +4505,7 @@ const FormStepsModal = withLocale(p => {
4458
4505
  }
4459
4506
  },
4460
4507
  children: _ref2 => {
4461
- let {
4462
- children: stepChildren
4463
- } = _ref2,
4508
+ let stepChildren = _ref2.children,
4464
4509
  props = _objectWithoutPropertiesLoose(_ref2, _excluded3);
4465
4510
  return /*#__PURE__*/jsxRuntime.jsx(Provider, {
4466
4511
  value: _extends({
@@ -4472,9 +4517,7 @@ const FormStepsModal = withLocale(p => {
4472
4517
  }));
4473
4518
  },
4474
4519
  footer: _ref3 => {
4475
- let {
4476
- props
4477
- } = _ref3;
4520
+ let props = _ref3.props;
4478
4521
  return /*#__PURE__*/jsxRuntime.jsx(StepFormFooter, _extends({}, props, {
4479
4522
  completeText: completeText,
4480
4523
  nextText: nextText