antd-mobile 5.9.4-dev.2 → 5.10.0

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.
Files changed (127) hide show
  1. package/2x/cjs/components/capsule-tabs/capsule-tabs.js +3 -3
  2. package/2x/cjs/components/collapse/collapse.js +3 -3
  3. package/2x/cjs/components/dialog/dialog.d.ts +1 -0
  4. package/2x/cjs/components/dialog/dialog.js +4 -2
  5. package/2x/cjs/components/divider/divider.css +19 -8
  6. package/2x/cjs/components/divider/divider.d.ts +1 -0
  7. package/2x/cjs/components/divider/divider.js +3 -2
  8. package/2x/cjs/components/form/form-item.js +3 -1
  9. package/2x/cjs/components/form/form.js +3 -2
  10. package/2x/cjs/components/image-uploader/image-uploader.d.ts +2 -0
  11. package/2x/cjs/components/image-uploader/image-uploader.js +4 -1
  12. package/2x/cjs/components/image-uploader/preview-item.d.ts +2 -0
  13. package/2x/cjs/components/image-uploader/preview-item.js +3 -2
  14. package/2x/cjs/components/index-bar/index-bar.js +3 -3
  15. package/2x/cjs/components/jumbo-tabs/jumbo-tabs.js +3 -3
  16. package/2x/cjs/components/modal/modal.d.ts +1 -0
  17. package/2x/cjs/components/modal/modal.js +4 -2
  18. package/2x/cjs/components/number-keyboard/number-keyboard.js +0 -5
  19. package/2x/cjs/components/picker-view/picker-view.d.ts +1 -0
  20. package/2x/cjs/components/picker-view/wheel.js +3 -1
  21. package/2x/cjs/components/popover/popover-menu.js +2 -1
  22. package/2x/cjs/components/side-bar/side-bar.js +3 -3
  23. package/2x/cjs/components/stepper/stepper.js +15 -8
  24. package/2x/cjs/components/tab-bar/tab-bar.js +3 -3
  25. package/2x/cjs/components/tabs/tabs.js +3 -3
  26. package/2x/cjs/components/tree-select/multiple.js +2 -1
  27. package/2x/cjs/utils/traverse-react-node.d.ts +2 -0
  28. package/2x/cjs/utils/traverse-react-node.js +29 -0
  29. package/2x/cjs/utils/undefined-fallback.d.ts +3 -0
  30. package/2x/cjs/utils/undefined-fallback.js +16 -0
  31. package/2x/es/components/capsule-tabs/capsule-tabs.js +2 -1
  32. package/2x/es/components/collapse/collapse.js +2 -1
  33. package/2x/es/components/dialog/dialog.d.ts +1 -0
  34. package/2x/es/components/dialog/dialog.js +4 -2
  35. package/2x/es/components/divider/divider.css +19 -8
  36. package/2x/es/components/divider/divider.d.ts +1 -0
  37. package/2x/es/components/divider/divider.js +3 -2
  38. package/2x/es/components/form/form-item.js +2 -1
  39. package/2x/es/components/form/form.js +2 -1
  40. package/2x/es/components/image-uploader/image-uploader.d.ts +2 -0
  41. package/2x/es/components/image-uploader/image-uploader.js +4 -1
  42. package/2x/es/components/image-uploader/preview-item.d.ts +2 -0
  43. package/2x/es/components/image-uploader/preview-item.js +3 -2
  44. package/2x/es/components/index-bar/index-bar.js +2 -1
  45. package/2x/es/components/jumbo-tabs/jumbo-tabs.js +2 -1
  46. package/2x/es/components/modal/modal.d.ts +1 -0
  47. package/2x/es/components/modal/modal.js +4 -2
  48. package/2x/es/components/number-keyboard/number-keyboard.js +0 -5
  49. package/2x/es/components/picker-view/picker-view.d.ts +1 -0
  50. package/2x/es/components/picker-view/wheel.js +3 -1
  51. package/2x/es/components/popover/popover-menu.js +2 -1
  52. package/2x/es/components/side-bar/side-bar.js +2 -1
  53. package/2x/es/components/stepper/stepper.js +14 -8
  54. package/2x/es/components/tab-bar/tab-bar.js +2 -1
  55. package/2x/es/components/tabs/tabs.js +2 -1
  56. package/2x/es/components/tree-select/multiple.js +2 -1
  57. package/2x/es/utils/traverse-react-node.d.ts +2 -0
  58. package/2x/es/utils/traverse-react-node.js +18 -0
  59. package/2x/es/utils/undefined-fallback.d.ts +3 -0
  60. package/2x/es/utils/undefined-fallback.js +9 -0
  61. package/2x/package.json +11 -7
  62. package/bundle/antd-mobile.cjs.js +66 -32
  63. package/bundle/antd-mobile.es.js +65 -32
  64. package/bundle/style.css +18 -8
  65. package/cjs/components/capsule-tabs/capsule-tabs.js +3 -3
  66. package/cjs/components/collapse/collapse.js +3 -3
  67. package/cjs/components/dialog/dialog.d.ts +1 -0
  68. package/cjs/components/dialog/dialog.js +4 -2
  69. package/cjs/components/divider/divider.css +18 -8
  70. package/cjs/components/divider/divider.d.ts +1 -0
  71. package/cjs/components/divider/divider.js +3 -2
  72. package/cjs/components/form/form-item.js +3 -1
  73. package/cjs/components/form/form.js +3 -2
  74. package/cjs/components/image-uploader/image-uploader.d.ts +2 -0
  75. package/cjs/components/image-uploader/image-uploader.js +4 -1
  76. package/cjs/components/image-uploader/preview-item.d.ts +2 -0
  77. package/cjs/components/image-uploader/preview-item.js +3 -2
  78. package/cjs/components/index-bar/index-bar.js +3 -3
  79. package/cjs/components/jumbo-tabs/jumbo-tabs.js +3 -3
  80. package/cjs/components/modal/modal.d.ts +1 -0
  81. package/cjs/components/modal/modal.js +4 -2
  82. package/cjs/components/number-keyboard/number-keyboard.js +0 -5
  83. package/cjs/components/picker-view/picker-view.d.ts +1 -0
  84. package/cjs/components/picker-view/wheel.js +3 -1
  85. package/cjs/components/popover/popover-menu.js +2 -1
  86. package/cjs/components/side-bar/side-bar.js +3 -3
  87. package/cjs/components/stepper/stepper.js +15 -8
  88. package/cjs/components/tab-bar/tab-bar.js +3 -3
  89. package/cjs/components/tabs/tabs.js +3 -3
  90. package/cjs/components/tree-select/multiple.js +2 -1
  91. package/cjs/utils/traverse-react-node.d.ts +2 -0
  92. package/cjs/utils/traverse-react-node.js +29 -0
  93. package/cjs/utils/undefined-fallback.d.ts +3 -0
  94. package/cjs/utils/undefined-fallback.js +16 -0
  95. package/es/components/capsule-tabs/capsule-tabs.js +2 -1
  96. package/es/components/collapse/collapse.js +2 -1
  97. package/es/components/dialog/dialog.d.ts +1 -0
  98. package/es/components/dialog/dialog.js +4 -2
  99. package/es/components/divider/divider.css +18 -8
  100. package/es/components/divider/divider.d.ts +1 -0
  101. package/es/components/divider/divider.js +3 -2
  102. package/es/components/form/form-item.js +2 -1
  103. package/es/components/form/form.js +2 -1
  104. package/es/components/image-uploader/image-uploader.d.ts +2 -0
  105. package/es/components/image-uploader/image-uploader.js +4 -1
  106. package/es/components/image-uploader/preview-item.d.ts +2 -0
  107. package/es/components/image-uploader/preview-item.js +3 -2
  108. package/es/components/index-bar/index-bar.js +2 -1
  109. package/es/components/jumbo-tabs/jumbo-tabs.js +2 -1
  110. package/es/components/modal/modal.d.ts +1 -0
  111. package/es/components/modal/modal.js +4 -2
  112. package/es/components/number-keyboard/number-keyboard.js +0 -5
  113. package/es/components/picker-view/picker-view.d.ts +1 -0
  114. package/es/components/picker-view/wheel.js +3 -1
  115. package/es/components/popover/popover-menu.js +2 -1
  116. package/es/components/side-bar/side-bar.js +2 -1
  117. package/es/components/stepper/stepper.js +14 -8
  118. package/es/components/tab-bar/tab-bar.js +2 -1
  119. package/es/components/tabs/tabs.js +2 -1
  120. package/es/components/tree-select/multiple.js +2 -1
  121. package/es/utils/traverse-react-node.d.ts +2 -0
  122. package/es/utils/traverse-react-node.js +18 -0
  123. package/es/utils/undefined-fallback.d.ts +3 -0
  124. package/es/utils/undefined-fallback.js +9 -0
  125. package/package.json +11 -7
  126. package/umd/antd-mobile.js +1 -1
  127. package/umd/antd-mobile.js.LICENSE.txt +9 -0
@@ -6,11 +6,13 @@ var classNames = require("classnames");
6
6
  var ahooks = require("ahooks");
7
7
  var web = require("@react-spring/web");
8
8
  var dayjs = require("dayjs");
9
+ var reactIs = require("react-is");
9
10
  var react = require("@use-gesture/react");
10
11
  var antdMobileIcons = require("antd-mobile-icons");
11
12
  var stagedComponents = require("staged-components");
12
13
  var RcForm = require("rc-field-form");
13
14
  var dom = require("@floating-ui/dom");
15
+ var Big = require("big.js");
14
16
  function _interopDefaultLegacy(e) {
15
17
  return e && typeof e === "object" && "default" in e ? e : { "default": e };
16
18
  }
@@ -18,6 +20,7 @@ var React__default = /* @__PURE__ */ _interopDefaultLegacy(React$1);
18
20
  var classNames__default = /* @__PURE__ */ _interopDefaultLegacy(classNames);
19
21
  var dayjs__default = /* @__PURE__ */ _interopDefaultLegacy(dayjs);
20
22
  var RcForm__default = /* @__PURE__ */ _interopDefaultLegacy(RcForm);
23
+ var Big__default = /* @__PURE__ */ _interopDefaultLegacy(Big);
21
24
  var global$1 = "";
22
25
  const canUseDom = !!(typeof window !== "undefined" && typeof document !== "undefined" && window.document && window.document.createElement);
23
26
  if (canUseDom) {
@@ -9144,6 +9147,20 @@ const ScrollMask = (props) => {
9144
9147
  }
9145
9148
  }));
9146
9149
  };
9150
+ function traverseReactNode(children, fn) {
9151
+ let i = 0;
9152
+ function handle(target) {
9153
+ React__default["default"].Children.forEach(target, (child) => {
9154
+ if (!reactIs.isFragment(child)) {
9155
+ fn(child, i);
9156
+ i += 1;
9157
+ } else {
9158
+ handle(child.props.children);
9159
+ }
9160
+ });
9161
+ }
9162
+ handle(children);
9163
+ }
9147
9164
  const classPrefix$15 = `adm-capsule-tabs`;
9148
9165
  const CapsuleTab = () => {
9149
9166
  return null;
@@ -9155,7 +9172,7 @@ const CapsuleTabs = (props) => {
9155
9172
  const keyToIndexRecord = {};
9156
9173
  let firstActiveKey = null;
9157
9174
  const panes = [];
9158
- React__default["default"].Children.forEach(props.children, (child, index2) => {
9175
+ traverseReactNode(props.children, (child, index2) => {
9159
9176
  if (!React__default["default"].isValidElement(child))
9160
9177
  return;
9161
9178
  const key = child.key;
@@ -9673,6 +9690,7 @@ const Wheel = React$1.memo((props) => {
9673
9690
  className: `${classPrefix$13}-column-wheel`,
9674
9691
  "aria-hidden": true
9675
9692
  }, column.map((item, index2) => {
9693
+ var _a;
9676
9694
  const selected = props.value === item.value;
9677
9695
  if (selected)
9678
9696
  selectedIndex = index2;
@@ -9681,7 +9699,7 @@ const Wheel = React$1.memo((props) => {
9681
9699
  scrollSelect(index2);
9682
9700
  }
9683
9701
  return React__default["default"].createElement("div", {
9684
- key: item.value,
9702
+ key: (_a = item.key) !== null && _a !== void 0 ? _a : item.value,
9685
9703
  "data-selected": item.value === value,
9686
9704
  className: `${classPrefix$13}-column-item`,
9687
9705
  onClick: handleClick,
@@ -10058,7 +10076,7 @@ const Tabs$1 = (p) => {
10058
10076
  const keyToIndexRecord = {};
10059
10077
  let firstActiveKey = null;
10060
10078
  const panes = [];
10061
- React__default["default"].Children.forEach(props.children, (child, index2) => {
10079
+ traverseReactNode(props.children, (child, index2) => {
10062
10080
  if (!React__default["default"].isValidElement(child))
10063
10081
  return;
10064
10082
  const key = child.key;
@@ -10921,7 +10939,7 @@ const CollapsePanelContent = (props) => {
10921
10939
  const Collapse = (props) => {
10922
10940
  var _a;
10923
10941
  const panels = [];
10924
- React__default["default"].Children.forEach(props.children, (child) => {
10942
+ traverseReactNode(props.children, (child) => {
10925
10943
  if (!React__default["default"].isValidElement(child))
10926
10944
  return;
10927
10945
  const key = child.key;
@@ -11556,7 +11574,8 @@ const defaultProps$G = {
11556
11574
  closeOnAction: false,
11557
11575
  closeOnMaskClick: false,
11558
11576
  stopPropagation: ["click"],
11559
- getContainer: null
11577
+ getContainer: null,
11578
+ disableBodyScroll: true
11560
11579
  };
11561
11580
  const Dialog = (p) => {
11562
11581
  const props = mergeProps(defaultProps$G, p);
@@ -11629,7 +11648,8 @@ const Dialog = (p) => {
11629
11648
  visible: props.visible,
11630
11649
  onMaskClick: props.closeOnMaskClick ? props.onClose : void 0,
11631
11650
  style: props.maskStyle,
11632
- className: classNames__default["default"](cls$1("mask"), props.maskClassName)
11651
+ className: classNames__default["default"](cls$1("mask"), props.maskClassName),
11652
+ disableBodyScroll: props.disableBodyScroll
11633
11653
  }), React__default["default"].createElement("div", {
11634
11654
  className: cls$1("wrap"),
11635
11655
  style: {
@@ -11731,12 +11751,13 @@ var index$b = attachPropertiesToComponent(Dialog, {
11731
11751
  var divider = "";
11732
11752
  const classPrefix$R = `adm-divider`;
11733
11753
  const defaultProps$E = {
11734
- contentPosition: "center"
11754
+ contentPosition: "center",
11755
+ direction: "horizontal"
11735
11756
  };
11736
11757
  const Divider = (p) => {
11737
11758
  const props = mergeProps(defaultProps$E, p);
11738
11759
  return withNativeProps(props, React__default["default"].createElement("div", {
11739
- className: classNames__default["default"](classPrefix$R, `${classPrefix$R}-${props.contentPosition}`)
11760
+ className: classNames__default["default"](classPrefix$R, `${classPrefix$R}-${props.direction}`, `${classPrefix$R}-${props.contentPosition}`)
11740
11761
  }, props.children && React__default["default"].createElement("div", {
11741
11762
  className: `${classPrefix$R}-content`
11742
11763
  }, props.children)));
@@ -12889,7 +12910,7 @@ const Form$1 = React$1.forwardRef((p, ref) => {
12889
12910
  }, items));
12890
12911
  items = [];
12891
12912
  }
12892
- React__default["default"].Children.forEach(props.children, (child) => {
12913
+ traverseReactNode(props.children, (child) => {
12893
12914
  if (React__default["default"].isValidElement(child)) {
12894
12915
  if (child.type === Header) {
12895
12916
  collect();
@@ -13329,6 +13350,14 @@ const PopoverMenu = React$1.forwardRef((props, ref) => {
13329
13350
  var Popover = attachPropertiesToComponent(Popover$1, {
13330
13351
  Menu: PopoverMenu
13331
13352
  });
13353
+ function undefinedFallback(...items) {
13354
+ let i;
13355
+ for (i = 0; i < items.length; i++) {
13356
+ if (items[i] !== void 0)
13357
+ break;
13358
+ }
13359
+ return items[i];
13360
+ }
13332
13361
  const NAME_SPLIT = "__SPLIT__";
13333
13362
  const classPrefix$H = `adm-form-item`;
13334
13363
  const MemoInput = React__default["default"].memo(({
@@ -13448,7 +13477,7 @@ const FormItem = (props) => {
13448
13477
  const {
13449
13478
  validateTrigger: contextValidateTrigger
13450
13479
  } = React$1.useContext(default_1);
13451
- const mergedValidateTrigger = validateTrigger !== void 0 ? validateTrigger : contextValidateTrigger;
13480
+ const mergedValidateTrigger = undefinedFallback(validateTrigger, contextValidateTrigger, trigger);
13452
13481
  const updateRef = React__default["default"].useRef(0);
13453
13482
  updateRef.current += 1;
13454
13483
  const [subMetas, setSubMetas] = React$1.useState({});
@@ -14012,7 +14041,8 @@ const PreviewItem = (props) => {
14012
14041
  url,
14013
14042
  file,
14014
14043
  deletable,
14015
- onDelete
14044
+ onDelete,
14045
+ imageFit
14016
14046
  } = props;
14017
14047
  const src = React$1.useMemo(() => {
14018
14048
  if (url) {
@@ -14047,7 +14077,7 @@ const PreviewItem = (props) => {
14047
14077
  }, React__default["default"].createElement(Image$1, {
14048
14078
  className: `${classPrefix$B}-cell-image`,
14049
14079
  src,
14050
- fit: "cover",
14080
+ fit: imageFit,
14051
14081
  onClick: props.onClick
14052
14082
  }), renderLoading(), renderDelete());
14053
14083
  };
@@ -14087,7 +14117,8 @@ const defaultProps$t = {
14087
14117
  defaultValue: [],
14088
14118
  accept: "image/*",
14089
14119
  preview: true,
14090
- showFailed: true
14120
+ showFailed: true,
14121
+ imageFit: "cover"
14091
14122
  };
14092
14123
  const ImageUploader = (p) => {
14093
14124
  const props = mergeProps(defaultProps$t, p);
@@ -14213,6 +14244,7 @@ const ImageUploader = (p) => {
14213
14244
  key: (_a = fileItem.key) !== null && _a !== void 0 ? _a : index2,
14214
14245
  url: (_b = fileItem.thumbnailUrl) !== null && _b !== void 0 ? _b : fileItem.url,
14215
14246
  deletable: props.deletable,
14247
+ imageFit: props.imageFit,
14216
14248
  onClick: () => {
14217
14249
  if (props.preview) {
14218
14250
  previewImage(index2);
@@ -14236,6 +14268,7 @@ const ImageUploader = (p) => {
14236
14268
  file: task.file,
14237
14269
  deletable: task.status !== "pending",
14238
14270
  status: task.status,
14271
+ imageFit: props.imageFit,
14239
14272
  onDelete: () => {
14240
14273
  setTasks(tasks.filter((x) => x.id !== task.id));
14241
14274
  }
@@ -14333,7 +14366,7 @@ const IndexBar = React$1.forwardRef((p, ref) => {
14333
14366
  const bodyRef = React$1.useRef(null);
14334
14367
  const indexItems = [];
14335
14368
  const panels = [];
14336
- React__default["default"].Children.forEach(props.children, (child) => {
14369
+ traverseReactNode(props.children, (child) => {
14337
14370
  var _a;
14338
14371
  if (!React__default["default"].isValidElement(child))
14339
14372
  return;
@@ -14601,7 +14634,7 @@ const JumboTabs = (props) => {
14601
14634
  const keyToIndexRecord = {};
14602
14635
  let firstActiveKey = null;
14603
14636
  const panes = [];
14604
- React__default["default"].Children.forEach(props.children, (child, index2) => {
14637
+ traverseReactNode(props.children, (child, index2) => {
14605
14638
  if (!React__default["default"].isValidElement(child))
14606
14639
  return;
14607
14640
  const key = child.key;
@@ -14725,7 +14758,8 @@ const defaultProps$q = {
14725
14758
  closeOnMaskClick: false,
14726
14759
  stopPropagation: ["click"],
14727
14760
  showCloseButton: false,
14728
- getContainer: null
14761
+ getContainer: null,
14762
+ disableBodyScroll: true
14729
14763
  };
14730
14764
  const Modal = (p) => {
14731
14765
  const props = mergeProps(defaultProps$q, p);
@@ -14799,7 +14833,8 @@ const Modal = (p) => {
14799
14833
  visible: props.visible,
14800
14834
  onMaskClick: props.closeOnMaskClick ? props.onClose : void 0,
14801
14835
  style: props.maskStyle,
14802
- className: classNames__default["default"](cls("mask"), props.maskClassName)
14836
+ className: classNames__default["default"](cls("mask"), props.maskClassName),
14837
+ disableBodyScroll: props.disableBodyScroll
14803
14838
  }), React__default["default"].createElement("div", {
14804
14839
  className: cls("wrap"),
14805
14840
  style: {
@@ -15131,9 +15166,6 @@ const NumberKeyboard = (p) => {
15131
15166
  onBackspacePressEnd();
15132
15167
  }
15133
15168
  },
15134
- onMouseUp: (e) => {
15135
- onKeyPress(e, key);
15136
- },
15137
15169
  title: key,
15138
15170
  role: "button"
15139
15171
  }, key === "BACKSPACE" ? React__default["default"].createElement(antdMobileIcons.TextDeletionOutline, null) : key);
@@ -15169,13 +15201,11 @@ const NumberKeyboard = (p) => {
15169
15201
  onKeyPress(e, "BACKSPACE");
15170
15202
  onBackspacePressEnd();
15171
15203
  },
15172
- onMouseUp: (e) => onKeyPress(e, "BACKSPACE"),
15173
15204
  title: "BACKSPACE",
15174
15205
  role: "button"
15175
15206
  }, React__default["default"].createElement(antdMobileIcons.TextDeletionOutline, null)), React__default["default"].createElement("div", {
15176
15207
  className: `${classPrefix$r}-key extra-key ok-key`,
15177
15208
  onTouchEnd: (e) => onKeyPress(e, "OK"),
15178
- onMouseUp: (e) => onKeyPress(e, "OK"),
15179
15209
  role: "button"
15180
15210
  }, confirmText))), props.safeArea && React__default["default"].createElement("div", {
15181
15211
  className: `${classPrefix$r}-footer`
@@ -15902,7 +15932,7 @@ const SideBar = (props) => {
15902
15932
  var _a;
15903
15933
  let firstActiveKey = null;
15904
15934
  const items = [];
15905
- React__default["default"].Children.forEach(props.children, (child, index2) => {
15935
+ traverseReactNode(props.children, (child, index2) => {
15906
15936
  if (!React__default["default"].isValidElement(child))
15907
15937
  return;
15908
15938
  const key = child.key;
@@ -16278,12 +16308,12 @@ const Stepper = (p) => {
16278
16308
  inputReadOnly
16279
16309
  } = props;
16280
16310
  const [value, setValue] = usePropsValue(props);
16281
- const [inputValue, setInputValue] = React$1.useState(() => convertValueToText(value));
16311
+ const [inputValue, setInputValue] = React$1.useState(() => convertValueToText(value, props.digits));
16282
16312
  function setValueWithCheck(v) {
16283
16313
  if (isNaN(v))
16284
16314
  return;
16285
16315
  let target = bound(v, props.min, props.max);
16286
- if (props.digits || props.digits === 0) {
16316
+ if (props.digits !== void 0) {
16287
16317
  target = parseFloat(target.toFixed(props.digits));
16288
16318
  }
16289
16319
  setValue(target);
@@ -16291,12 +16321,12 @@ const Stepper = (p) => {
16291
16321
  const [hasFocus, setHasFocus] = React$1.useState(false);
16292
16322
  React$1.useEffect(() => {
16293
16323
  if (!hasFocus) {
16294
- setInputValue(convertValueToText(value));
16324
+ setInputValue(convertValueToText(value, props.digits));
16295
16325
  }
16296
16326
  }, [hasFocus]);
16297
16327
  React$1.useEffect(() => {
16298
16328
  if (!hasFocus) {
16299
- setInputValue(convertValueToText(value));
16329
+ setInputValue(convertValueToText(value, props.digits));
16300
16330
  }
16301
16331
  }, [value]);
16302
16332
  const handleInputChange = (v) => {
@@ -16313,10 +16343,10 @@ const Stepper = (p) => {
16313
16343
  }
16314
16344
  };
16315
16345
  const handleMinus = () => {
16316
- setValueWithCheck((value !== null && value !== void 0 ? value : 0) - step);
16346
+ setValueWithCheck(Big__default["default"](value !== null && value !== void 0 ? value : 0).minus(step).toNumber());
16317
16347
  };
16318
16348
  const handlePlus = () => {
16319
- setValueWithCheck((value !== null && value !== void 0 ? value : 0) + step);
16349
+ setValueWithCheck(Big__default["default"](value !== null && value !== void 0 ? value : 0).add(step).toNumber());
16320
16350
  };
16321
16351
  const minusDisabled = () => {
16322
16352
  if (disabled)
@@ -16378,10 +16408,14 @@ const Stepper = (p) => {
16378
16408
  color: "primary"
16379
16409
  }, React__default["default"].createElement(antdMobileIcons.AddOutline, null))));
16380
16410
  };
16381
- function convertValueToText(value) {
16411
+ function convertValueToText(value, digits) {
16382
16412
  if (value === null)
16383
16413
  return "";
16384
- return value.toString();
16414
+ if (digits !== void 0) {
16415
+ return value.toFixed(digits);
16416
+ } else {
16417
+ return value.toString();
16418
+ }
16385
16419
  }
16386
16420
  function convertTextToValue(text) {
16387
16421
  if (text === "")
@@ -16973,7 +17007,7 @@ const TabBar = (p) => {
16973
17007
  const props = mergeProps(defaultProps$7, p);
16974
17008
  let firstActiveKey = null;
16975
17009
  const items = [];
16976
- React__default["default"].Children.forEach(props.children, (child, index2) => {
17010
+ traverseReactNode(props.children, (child, index2) => {
16977
17011
  if (!React__default["default"].isValidElement(child))
16978
17012
  return;
16979
17013
  const key = child.key;
@@ -4,11 +4,13 @@ import classNames from "classnames";
4
4
  import { useUnmountedRef, useUpdate, useMemoizedFn, useUpdateEffect, useIsomorphicLayoutEffect, createUpdateEffect, useThrottleFn, useDebounceEffect, useMount, useInViewport, useClickAway, useUnmount, useLockFn, useTimeout } from "ahooks";
5
5
  import { useSpring, animated, to } from "@react-spring/web";
6
6
  import dayjs from "dayjs";
7
+ import { isFragment } from "react-is";
7
8
  import { useDrag, createUseGesture, dragAction, pinchAction } from "@use-gesture/react";
8
9
  import { RightOutline, CheckOutline, DownOutline, PictureOutline, PictureWrongOutline, DownFill, QuestionCircleOutline, CloseOutline, AddOutline, CloseCircleFill, LeftOutline, SoundOutline, TextDeletionOutline, StarFill, CheckCircleFill, InformationCircleFill, ClockCircleFill, ExclamationCircleFill, SearchOutline, MinusOutline } from "antd-mobile-icons";
9
10
  import { staged } from "staged-components";
10
11
  import RcForm, { List as List$2, Field, useForm } from "rc-field-form";
11
12
  import { computePosition, offset, shift, limitShift, flip, hide, arrow, autoUpdate } from "@floating-ui/dom";
13
+ import Big from "big.js";
12
14
  var global$1 = "";
13
15
  const canUseDom = !!(typeof window !== "undefined" && typeof document !== "undefined" && window.document && window.document.createElement);
14
16
  if (canUseDom) {
@@ -9135,6 +9137,20 @@ const ScrollMask = (props) => {
9135
9137
  }
9136
9138
  }));
9137
9139
  };
9140
+ function traverseReactNode(children, fn) {
9141
+ let i = 0;
9142
+ function handle(target) {
9143
+ React$1.Children.forEach(target, (child) => {
9144
+ if (!isFragment(child)) {
9145
+ fn(child, i);
9146
+ i += 1;
9147
+ } else {
9148
+ handle(child.props.children);
9149
+ }
9150
+ });
9151
+ }
9152
+ handle(children);
9153
+ }
9138
9154
  const classPrefix$15 = `adm-capsule-tabs`;
9139
9155
  const CapsuleTab = () => {
9140
9156
  return null;
@@ -9146,7 +9162,7 @@ const CapsuleTabs = (props) => {
9146
9162
  const keyToIndexRecord = {};
9147
9163
  let firstActiveKey = null;
9148
9164
  const panes = [];
9149
- React$1.Children.forEach(props.children, (child, index2) => {
9165
+ traverseReactNode(props.children, (child, index2) => {
9150
9166
  if (!React$1.isValidElement(child))
9151
9167
  return;
9152
9168
  const key = child.key;
@@ -9664,6 +9680,7 @@ const Wheel = memo((props) => {
9664
9680
  className: `${classPrefix$13}-column-wheel`,
9665
9681
  "aria-hidden": true
9666
9682
  }, column.map((item, index2) => {
9683
+ var _a;
9667
9684
  const selected = props.value === item.value;
9668
9685
  if (selected)
9669
9686
  selectedIndex = index2;
@@ -9672,7 +9689,7 @@ const Wheel = memo((props) => {
9672
9689
  scrollSelect(index2);
9673
9690
  }
9674
9691
  return React$1.createElement("div", {
9675
- key: item.value,
9692
+ key: (_a = item.key) !== null && _a !== void 0 ? _a : item.value,
9676
9693
  "data-selected": item.value === value,
9677
9694
  className: `${classPrefix$13}-column-item`,
9678
9695
  onClick: handleClick,
@@ -10049,7 +10066,7 @@ const Tabs$1 = (p) => {
10049
10066
  const keyToIndexRecord = {};
10050
10067
  let firstActiveKey = null;
10051
10068
  const panes = [];
10052
- React$1.Children.forEach(props.children, (child, index2) => {
10069
+ traverseReactNode(props.children, (child, index2) => {
10053
10070
  if (!React$1.isValidElement(child))
10054
10071
  return;
10055
10072
  const key = child.key;
@@ -10912,7 +10929,7 @@ const CollapsePanelContent = (props) => {
10912
10929
  const Collapse = (props) => {
10913
10930
  var _a;
10914
10931
  const panels = [];
10915
- React$1.Children.forEach(props.children, (child) => {
10932
+ traverseReactNode(props.children, (child) => {
10916
10933
  if (!React$1.isValidElement(child))
10917
10934
  return;
10918
10935
  const key = child.key;
@@ -11547,7 +11564,8 @@ const defaultProps$G = {
11547
11564
  closeOnAction: false,
11548
11565
  closeOnMaskClick: false,
11549
11566
  stopPropagation: ["click"],
11550
- getContainer: null
11567
+ getContainer: null,
11568
+ disableBodyScroll: true
11551
11569
  };
11552
11570
  const Dialog = (p) => {
11553
11571
  const props = mergeProps(defaultProps$G, p);
@@ -11620,7 +11638,8 @@ const Dialog = (p) => {
11620
11638
  visible: props.visible,
11621
11639
  onMaskClick: props.closeOnMaskClick ? props.onClose : void 0,
11622
11640
  style: props.maskStyle,
11623
- className: classNames(cls$1("mask"), props.maskClassName)
11641
+ className: classNames(cls$1("mask"), props.maskClassName),
11642
+ disableBodyScroll: props.disableBodyScroll
11624
11643
  }), React$1.createElement("div", {
11625
11644
  className: cls$1("wrap"),
11626
11645
  style: {
@@ -11722,12 +11741,13 @@ var index$b = attachPropertiesToComponent(Dialog, {
11722
11741
  var divider = "";
11723
11742
  const classPrefix$R = `adm-divider`;
11724
11743
  const defaultProps$E = {
11725
- contentPosition: "center"
11744
+ contentPosition: "center",
11745
+ direction: "horizontal"
11726
11746
  };
11727
11747
  const Divider = (p) => {
11728
11748
  const props = mergeProps(defaultProps$E, p);
11729
11749
  return withNativeProps(props, React$1.createElement("div", {
11730
- className: classNames(classPrefix$R, `${classPrefix$R}-${props.contentPosition}`)
11750
+ className: classNames(classPrefix$R, `${classPrefix$R}-${props.direction}`, `${classPrefix$R}-${props.contentPosition}`)
11731
11751
  }, props.children && React$1.createElement("div", {
11732
11752
  className: `${classPrefix$R}-content`
11733
11753
  }, props.children)));
@@ -12880,7 +12900,7 @@ const Form$1 = forwardRef((p, ref) => {
12880
12900
  }, items));
12881
12901
  items = [];
12882
12902
  }
12883
- React$1.Children.forEach(props.children, (child) => {
12903
+ traverseReactNode(props.children, (child) => {
12884
12904
  if (React$1.isValidElement(child)) {
12885
12905
  if (child.type === Header) {
12886
12906
  collect();
@@ -13320,6 +13340,14 @@ const PopoverMenu = forwardRef((props, ref) => {
13320
13340
  var Popover = attachPropertiesToComponent(Popover$1, {
13321
13341
  Menu: PopoverMenu
13322
13342
  });
13343
+ function undefinedFallback(...items) {
13344
+ let i;
13345
+ for (i = 0; i < items.length; i++) {
13346
+ if (items[i] !== void 0)
13347
+ break;
13348
+ }
13349
+ return items[i];
13350
+ }
13323
13351
  const NAME_SPLIT = "__SPLIT__";
13324
13352
  const classPrefix$H = `adm-form-item`;
13325
13353
  const MemoInput = React$1.memo(({
@@ -13439,7 +13467,7 @@ const FormItem = (props) => {
13439
13467
  const {
13440
13468
  validateTrigger: contextValidateTrigger
13441
13469
  } = useContext(default_1);
13442
- const mergedValidateTrigger = validateTrigger !== void 0 ? validateTrigger : contextValidateTrigger;
13470
+ const mergedValidateTrigger = undefinedFallback(validateTrigger, contextValidateTrigger, trigger);
13443
13471
  const updateRef = React$1.useRef(0);
13444
13472
  updateRef.current += 1;
13445
13473
  const [subMetas, setSubMetas] = useState({});
@@ -14003,7 +14031,8 @@ const PreviewItem = (props) => {
14003
14031
  url,
14004
14032
  file,
14005
14033
  deletable,
14006
- onDelete
14034
+ onDelete,
14035
+ imageFit
14007
14036
  } = props;
14008
14037
  const src = useMemo(() => {
14009
14038
  if (url) {
@@ -14038,7 +14067,7 @@ const PreviewItem = (props) => {
14038
14067
  }, React$1.createElement(Image$1, {
14039
14068
  className: `${classPrefix$B}-cell-image`,
14040
14069
  src,
14041
- fit: "cover",
14070
+ fit: imageFit,
14042
14071
  onClick: props.onClick
14043
14072
  }), renderLoading(), renderDelete());
14044
14073
  };
@@ -14078,7 +14107,8 @@ const defaultProps$t = {
14078
14107
  defaultValue: [],
14079
14108
  accept: "image/*",
14080
14109
  preview: true,
14081
- showFailed: true
14110
+ showFailed: true,
14111
+ imageFit: "cover"
14082
14112
  };
14083
14113
  const ImageUploader = (p) => {
14084
14114
  const props = mergeProps(defaultProps$t, p);
@@ -14204,6 +14234,7 @@ const ImageUploader = (p) => {
14204
14234
  key: (_a = fileItem.key) !== null && _a !== void 0 ? _a : index2,
14205
14235
  url: (_b = fileItem.thumbnailUrl) !== null && _b !== void 0 ? _b : fileItem.url,
14206
14236
  deletable: props.deletable,
14237
+ imageFit: props.imageFit,
14207
14238
  onClick: () => {
14208
14239
  if (props.preview) {
14209
14240
  previewImage(index2);
@@ -14227,6 +14258,7 @@ const ImageUploader = (p) => {
14227
14258
  file: task.file,
14228
14259
  deletable: task.status !== "pending",
14229
14260
  status: task.status,
14261
+ imageFit: props.imageFit,
14230
14262
  onDelete: () => {
14231
14263
  setTasks(tasks.filter((x) => x.id !== task.id));
14232
14264
  }
@@ -14324,7 +14356,7 @@ const IndexBar = forwardRef((p, ref) => {
14324
14356
  const bodyRef = useRef(null);
14325
14357
  const indexItems = [];
14326
14358
  const panels = [];
14327
- React$1.Children.forEach(props.children, (child) => {
14359
+ traverseReactNode(props.children, (child) => {
14328
14360
  var _a;
14329
14361
  if (!React$1.isValidElement(child))
14330
14362
  return;
@@ -14592,7 +14624,7 @@ const JumboTabs = (props) => {
14592
14624
  const keyToIndexRecord = {};
14593
14625
  let firstActiveKey = null;
14594
14626
  const panes = [];
14595
- React$1.Children.forEach(props.children, (child, index2) => {
14627
+ traverseReactNode(props.children, (child, index2) => {
14596
14628
  if (!React$1.isValidElement(child))
14597
14629
  return;
14598
14630
  const key = child.key;
@@ -14716,7 +14748,8 @@ const defaultProps$q = {
14716
14748
  closeOnMaskClick: false,
14717
14749
  stopPropagation: ["click"],
14718
14750
  showCloseButton: false,
14719
- getContainer: null
14751
+ getContainer: null,
14752
+ disableBodyScroll: true
14720
14753
  };
14721
14754
  const Modal = (p) => {
14722
14755
  const props = mergeProps(defaultProps$q, p);
@@ -14790,7 +14823,8 @@ const Modal = (p) => {
14790
14823
  visible: props.visible,
14791
14824
  onMaskClick: props.closeOnMaskClick ? props.onClose : void 0,
14792
14825
  style: props.maskStyle,
14793
- className: classNames(cls("mask"), props.maskClassName)
14826
+ className: classNames(cls("mask"), props.maskClassName),
14827
+ disableBodyScroll: props.disableBodyScroll
14794
14828
  }), React$1.createElement("div", {
14795
14829
  className: cls("wrap"),
14796
14830
  style: {
@@ -15122,9 +15156,6 @@ const NumberKeyboard = (p) => {
15122
15156
  onBackspacePressEnd();
15123
15157
  }
15124
15158
  },
15125
- onMouseUp: (e) => {
15126
- onKeyPress(e, key);
15127
- },
15128
15159
  title: key,
15129
15160
  role: "button"
15130
15161
  }, key === "BACKSPACE" ? React$1.createElement(TextDeletionOutline, null) : key);
@@ -15160,13 +15191,11 @@ const NumberKeyboard = (p) => {
15160
15191
  onKeyPress(e, "BACKSPACE");
15161
15192
  onBackspacePressEnd();
15162
15193
  },
15163
- onMouseUp: (e) => onKeyPress(e, "BACKSPACE"),
15164
15194
  title: "BACKSPACE",
15165
15195
  role: "button"
15166
15196
  }, React$1.createElement(TextDeletionOutline, null)), React$1.createElement("div", {
15167
15197
  className: `${classPrefix$r}-key extra-key ok-key`,
15168
15198
  onTouchEnd: (e) => onKeyPress(e, "OK"),
15169
- onMouseUp: (e) => onKeyPress(e, "OK"),
15170
15199
  role: "button"
15171
15200
  }, confirmText))), props.safeArea && React$1.createElement("div", {
15172
15201
  className: `${classPrefix$r}-footer`
@@ -15893,7 +15922,7 @@ const SideBar = (props) => {
15893
15922
  var _a;
15894
15923
  let firstActiveKey = null;
15895
15924
  const items = [];
15896
- React$1.Children.forEach(props.children, (child, index2) => {
15925
+ traverseReactNode(props.children, (child, index2) => {
15897
15926
  if (!React$1.isValidElement(child))
15898
15927
  return;
15899
15928
  const key = child.key;
@@ -16269,12 +16298,12 @@ const Stepper = (p) => {
16269
16298
  inputReadOnly
16270
16299
  } = props;
16271
16300
  const [value, setValue] = usePropsValue(props);
16272
- const [inputValue, setInputValue] = useState(() => convertValueToText(value));
16301
+ const [inputValue, setInputValue] = useState(() => convertValueToText(value, props.digits));
16273
16302
  function setValueWithCheck(v) {
16274
16303
  if (isNaN(v))
16275
16304
  return;
16276
16305
  let target = bound(v, props.min, props.max);
16277
- if (props.digits || props.digits === 0) {
16306
+ if (props.digits !== void 0) {
16278
16307
  target = parseFloat(target.toFixed(props.digits));
16279
16308
  }
16280
16309
  setValue(target);
@@ -16282,12 +16311,12 @@ const Stepper = (p) => {
16282
16311
  const [hasFocus, setHasFocus] = useState(false);
16283
16312
  useEffect(() => {
16284
16313
  if (!hasFocus) {
16285
- setInputValue(convertValueToText(value));
16314
+ setInputValue(convertValueToText(value, props.digits));
16286
16315
  }
16287
16316
  }, [hasFocus]);
16288
16317
  useEffect(() => {
16289
16318
  if (!hasFocus) {
16290
- setInputValue(convertValueToText(value));
16319
+ setInputValue(convertValueToText(value, props.digits));
16291
16320
  }
16292
16321
  }, [value]);
16293
16322
  const handleInputChange = (v) => {
@@ -16304,10 +16333,10 @@ const Stepper = (p) => {
16304
16333
  }
16305
16334
  };
16306
16335
  const handleMinus = () => {
16307
- setValueWithCheck((value !== null && value !== void 0 ? value : 0) - step);
16336
+ setValueWithCheck(Big(value !== null && value !== void 0 ? value : 0).minus(step).toNumber());
16308
16337
  };
16309
16338
  const handlePlus = () => {
16310
- setValueWithCheck((value !== null && value !== void 0 ? value : 0) + step);
16339
+ setValueWithCheck(Big(value !== null && value !== void 0 ? value : 0).add(step).toNumber());
16311
16340
  };
16312
16341
  const minusDisabled = () => {
16313
16342
  if (disabled)
@@ -16369,10 +16398,14 @@ const Stepper = (p) => {
16369
16398
  color: "primary"
16370
16399
  }, React$1.createElement(AddOutline, null))));
16371
16400
  };
16372
- function convertValueToText(value) {
16401
+ function convertValueToText(value, digits) {
16373
16402
  if (value === null)
16374
16403
  return "";
16375
- return value.toString();
16404
+ if (digits !== void 0) {
16405
+ return value.toFixed(digits);
16406
+ } else {
16407
+ return value.toString();
16408
+ }
16376
16409
  }
16377
16410
  function convertTextToValue(text) {
16378
16411
  if (text === "")
@@ -16964,7 +16997,7 @@ const TabBar = (p) => {
16964
16997
  const props = mergeProps(defaultProps$7, p);
16965
16998
  let firstActiveKey = null;
16966
16999
  const items = [];
16967
- React$1.Children.forEach(props.children, (child, index2) => {
17000
+ traverseReactNode(props.children, (child, index2) => {
16968
17001
  if (!React$1.isValidElement(child))
16969
17002
  return;
16970
17003
  const key = child.key;