antd-mobile 5.9.5 → 5.10.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.
Files changed (135) 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/divider/divider.css +19 -8
  4. package/2x/cjs/components/divider/divider.d.ts +1 -0
  5. package/2x/cjs/components/divider/divider.js +3 -2
  6. package/2x/cjs/components/form/form.js +3 -2
  7. package/2x/cjs/components/image-uploader/image-uploader.d.ts +2 -0
  8. package/2x/cjs/components/image-uploader/image-uploader.js +6 -2
  9. package/2x/cjs/components/image-uploader/preview-item.d.ts +2 -0
  10. package/2x/cjs/components/image-uploader/preview-item.js +3 -2
  11. package/2x/cjs/components/index-bar/index-bar.js +3 -3
  12. package/2x/cjs/components/jumbo-tabs/jumbo-tabs.js +3 -3
  13. package/2x/cjs/components/mask/mask.css +1 -0
  14. package/2x/cjs/components/mask/mask.js +8 -1
  15. package/2x/cjs/components/picker-view/picker-view.d.ts +1 -0
  16. package/2x/cjs/components/picker-view/wheel.js +3 -1
  17. package/2x/cjs/components/popover/popover-menu.js +2 -1
  18. package/2x/cjs/components/safe-area/safe-area.css +2 -2
  19. package/2x/cjs/components/side-bar/side-bar.js +3 -3
  20. package/2x/cjs/components/stepper/stepper.js +16 -9
  21. package/2x/cjs/components/swiper/swiper.js +1 -0
  22. package/2x/cjs/components/tab-bar/tab-bar.js +3 -3
  23. package/2x/cjs/components/tabs/tabs.js +3 -3
  24. package/2x/cjs/components/tree-select/multiple.js +2 -1
  25. package/2x/cjs/global/global.css +1 -0
  26. package/2x/cjs/global/theme.css +1 -0
  27. package/2x/cjs/locales/ko-KR.d.ts +102 -0
  28. package/2x/cjs/locales/ko-KR.js +115 -0
  29. package/2x/cjs/locales/zh-HK.js +56 -0
  30. package/2x/cjs/locales/zh-TW.js +56 -0
  31. package/2x/cjs/utils/traverse-react-node.d.ts +2 -0
  32. package/2x/cjs/utils/traverse-react-node.js +29 -0
  33. package/2x/es/components/capsule-tabs/capsule-tabs.js +2 -1
  34. package/2x/es/components/collapse/collapse.js +2 -1
  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.js +2 -1
  39. package/2x/es/components/image-uploader/image-uploader.d.ts +2 -0
  40. package/2x/es/components/image-uploader/image-uploader.js +6 -2
  41. package/2x/es/components/image-uploader/preview-item.d.ts +2 -0
  42. package/2x/es/components/image-uploader/preview-item.js +3 -2
  43. package/2x/es/components/index-bar/index-bar.js +2 -1
  44. package/2x/es/components/jumbo-tabs/jumbo-tabs.js +2 -1
  45. package/2x/es/components/mask/mask.css +1 -0
  46. package/2x/es/components/mask/mask.js +8 -1
  47. package/2x/es/components/picker-view/picker-view.d.ts +1 -0
  48. package/2x/es/components/picker-view/wheel.js +3 -1
  49. package/2x/es/components/popover/popover-menu.js +2 -1
  50. package/2x/es/components/safe-area/safe-area.css +2 -2
  51. package/2x/es/components/side-bar/side-bar.js +2 -1
  52. package/2x/es/components/stepper/stepper.js +15 -9
  53. package/2x/es/components/swiper/swiper.js +1 -0
  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/global/global.css +1 -0
  58. package/2x/es/global/theme.css +1 -0
  59. package/2x/es/locales/ko-KR.d.ts +102 -0
  60. package/2x/es/locales/ko-KR.js +105 -0
  61. package/2x/es/locales/zh-HK.js +56 -0
  62. package/2x/es/locales/zh-TW.js +56 -0
  63. package/2x/es/utils/traverse-react-node.d.ts +2 -0
  64. package/2x/es/utils/traverse-react-node.js +18 -0
  65. package/2x/package.json +5 -1
  66. package/bundle/antd-mobile.cjs.js +60 -25
  67. package/bundle/antd-mobile.es.js +59 -25
  68. package/bundle/style.css +22 -10
  69. package/cjs/components/capsule-tabs/capsule-tabs.js +3 -3
  70. package/cjs/components/collapse/collapse.js +3 -3
  71. package/cjs/components/divider/divider.css +18 -8
  72. package/cjs/components/divider/divider.d.ts +1 -0
  73. package/cjs/components/divider/divider.js +3 -2
  74. package/cjs/components/form/form.js +3 -2
  75. package/cjs/components/image-uploader/image-uploader.d.ts +2 -0
  76. package/cjs/components/image-uploader/image-uploader.js +6 -2
  77. package/cjs/components/image-uploader/preview-item.d.ts +2 -0
  78. package/cjs/components/image-uploader/preview-item.js +3 -2
  79. package/cjs/components/index-bar/index-bar.js +3 -3
  80. package/cjs/components/jumbo-tabs/jumbo-tabs.js +3 -3
  81. package/cjs/components/mask/mask.css +1 -0
  82. package/cjs/components/mask/mask.js +8 -1
  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/safe-area/safe-area.css +2 -2
  87. package/cjs/components/side-bar/side-bar.js +3 -3
  88. package/cjs/components/stepper/stepper.js +16 -9
  89. package/cjs/components/swiper/swiper.js +1 -0
  90. package/cjs/components/tab-bar/tab-bar.js +3 -3
  91. package/cjs/components/tabs/tabs.js +3 -3
  92. package/cjs/components/tree-select/multiple.js +2 -1
  93. package/cjs/global/global.css +1 -0
  94. package/cjs/global/theme.css +1 -0
  95. package/cjs/locales/ko-KR.d.ts +102 -0
  96. package/cjs/locales/ko-KR.js +115 -0
  97. package/cjs/locales/zh-HK.js +56 -0
  98. package/cjs/locales/zh-TW.js +56 -0
  99. package/cjs/utils/traverse-react-node.d.ts +2 -0
  100. package/cjs/utils/traverse-react-node.js +29 -0
  101. package/es/components/capsule-tabs/capsule-tabs.js +2 -1
  102. package/es/components/collapse/collapse.js +2 -1
  103. package/es/components/divider/divider.css +18 -8
  104. package/es/components/divider/divider.d.ts +1 -0
  105. package/es/components/divider/divider.js +3 -2
  106. package/es/components/form/form.js +2 -1
  107. package/es/components/image-uploader/image-uploader.d.ts +2 -0
  108. package/es/components/image-uploader/image-uploader.js +6 -2
  109. package/es/components/image-uploader/preview-item.d.ts +2 -0
  110. package/es/components/image-uploader/preview-item.js +3 -2
  111. package/es/components/index-bar/index-bar.js +2 -1
  112. package/es/components/jumbo-tabs/jumbo-tabs.js +2 -1
  113. package/es/components/mask/mask.css +1 -0
  114. package/es/components/mask/mask.js +8 -1
  115. package/es/components/picker-view/picker-view.d.ts +1 -0
  116. package/es/components/picker-view/wheel.js +3 -1
  117. package/es/components/popover/popover-menu.js +2 -1
  118. package/es/components/safe-area/safe-area.css +2 -2
  119. package/es/components/side-bar/side-bar.js +2 -1
  120. package/es/components/stepper/stepper.js +15 -9
  121. package/es/components/swiper/swiper.js +1 -0
  122. package/es/components/tab-bar/tab-bar.js +2 -1
  123. package/es/components/tabs/tabs.js +2 -1
  124. package/es/components/tree-select/multiple.js +2 -1
  125. package/es/global/global.css +1 -0
  126. package/es/global/theme.css +1 -0
  127. package/es/locales/ko-KR.d.ts +102 -0
  128. package/es/locales/ko-KR.js +105 -0
  129. package/es/locales/zh-HK.js +56 -0
  130. package/es/locales/zh-TW.js +56 -0
  131. package/es/utils/traverse-react-node.d.ts +2 -0
  132. package/es/utils/traverse-react-node.js +18 -0
  133. package/package.json +5 -1
  134. package/umd/antd-mobile.js +1 -1
  135. 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) {
@@ -8284,7 +8287,13 @@ const Mask = (p) => {
8284
8287
  opacity
8285
8288
  }, props.style), {
8286
8289
  display: active ? "unset" : "none"
8287
- })
8290
+ }),
8291
+ onClick: (e) => {
8292
+ var _a;
8293
+ if (e.target === e.currentTarget) {
8294
+ (_a = props.onMaskClick) === null || _a === void 0 ? void 0 : _a.call(props, e);
8295
+ }
8296
+ }
8288
8297
  }, props.onMaskClick && React__default["default"].createElement("div", {
8289
8298
  className: `${classPrefix$1g}-aria-button`,
8290
8299
  role: "button",
@@ -9144,6 +9153,20 @@ const ScrollMask = (props) => {
9144
9153
  }
9145
9154
  }));
9146
9155
  };
9156
+ function traverseReactNode(children, fn) {
9157
+ let i = 0;
9158
+ function handle(target) {
9159
+ React__default["default"].Children.forEach(target, (child) => {
9160
+ if (!reactIs.isFragment(child)) {
9161
+ fn(child, i);
9162
+ i += 1;
9163
+ } else {
9164
+ handle(child.props.children);
9165
+ }
9166
+ });
9167
+ }
9168
+ handle(children);
9169
+ }
9147
9170
  const classPrefix$15 = `adm-capsule-tabs`;
9148
9171
  const CapsuleTab = () => {
9149
9172
  return null;
@@ -9155,7 +9178,7 @@ const CapsuleTabs = (props) => {
9155
9178
  const keyToIndexRecord = {};
9156
9179
  let firstActiveKey = null;
9157
9180
  const panes = [];
9158
- React__default["default"].Children.forEach(props.children, (child, index2) => {
9181
+ traverseReactNode(props.children, (child, index2) => {
9159
9182
  if (!React__default["default"].isValidElement(child))
9160
9183
  return;
9161
9184
  const key = child.key;
@@ -9673,6 +9696,7 @@ const Wheel = React$1.memo((props) => {
9673
9696
  className: `${classPrefix$13}-column-wheel`,
9674
9697
  "aria-hidden": true
9675
9698
  }, column.map((item, index2) => {
9699
+ var _a;
9676
9700
  const selected = props.value === item.value;
9677
9701
  if (selected)
9678
9702
  selectedIndex = index2;
@@ -9681,7 +9705,7 @@ const Wheel = React$1.memo((props) => {
9681
9705
  scrollSelect(index2);
9682
9706
  }
9683
9707
  return React__default["default"].createElement("div", {
9684
- key: item.value,
9708
+ key: (_a = item.key) !== null && _a !== void 0 ? _a : item.value,
9685
9709
  "data-selected": item.value === value,
9686
9710
  className: `${classPrefix$13}-column-item`,
9687
9711
  onClick: handleClick,
@@ -10058,7 +10082,7 @@ const Tabs$1 = (p) => {
10058
10082
  const keyToIndexRecord = {};
10059
10083
  let firstActiveKey = null;
10060
10084
  const panes = [];
10061
- React__default["default"].Children.forEach(props.children, (child, index2) => {
10085
+ traverseReactNode(props.children, (child, index2) => {
10062
10086
  if (!React__default["default"].isValidElement(child))
10063
10087
  return;
10064
10088
  const key = child.key;
@@ -10921,7 +10945,7 @@ const CollapsePanelContent = (props) => {
10921
10945
  const Collapse = (props) => {
10922
10946
  var _a;
10923
10947
  const panels = [];
10924
- React__default["default"].Children.forEach(props.children, (child) => {
10948
+ traverseReactNode(props.children, (child) => {
10925
10949
  if (!React__default["default"].isValidElement(child))
10926
10950
  return;
10927
10951
  const key = child.key;
@@ -11733,12 +11757,13 @@ var index$b = attachPropertiesToComponent(Dialog, {
11733
11757
  var divider = "";
11734
11758
  const classPrefix$R = `adm-divider`;
11735
11759
  const defaultProps$E = {
11736
- contentPosition: "center"
11760
+ contentPosition: "center",
11761
+ direction: "horizontal"
11737
11762
  };
11738
11763
  const Divider = (p) => {
11739
11764
  const props = mergeProps(defaultProps$E, p);
11740
11765
  return withNativeProps(props, React__default["default"].createElement("div", {
11741
- className: classNames__default["default"](classPrefix$R, `${classPrefix$R}-${props.contentPosition}`)
11766
+ className: classNames__default["default"](classPrefix$R, `${classPrefix$R}-${props.direction}`, `${classPrefix$R}-${props.contentPosition}`)
11742
11767
  }, props.children && React__default["default"].createElement("div", {
11743
11768
  className: `${classPrefix$R}-content`
11744
11769
  }, props.children)));
@@ -12891,7 +12916,7 @@ const Form$1 = React$1.forwardRef((p, ref) => {
12891
12916
  }, items));
12892
12917
  items = [];
12893
12918
  }
12894
- React__default["default"].Children.forEach(props.children, (child) => {
12919
+ traverseReactNode(props.children, (child) => {
12895
12920
  if (React__default["default"].isValidElement(child)) {
12896
12921
  if (child.type === Header) {
12897
12922
  collect();
@@ -14022,7 +14047,8 @@ const PreviewItem = (props) => {
14022
14047
  url,
14023
14048
  file,
14024
14049
  deletable,
14025
- onDelete
14050
+ onDelete,
14051
+ imageFit
14026
14052
  } = props;
14027
14053
  const src = React$1.useMemo(() => {
14028
14054
  if (url) {
@@ -14057,7 +14083,7 @@ const PreviewItem = (props) => {
14057
14083
  }, React__default["default"].createElement(Image$1, {
14058
14084
  className: `${classPrefix$B}-cell-image`,
14059
14085
  src,
14060
- fit: "cover",
14086
+ fit: imageFit,
14061
14087
  onClick: props.onClick
14062
14088
  }), renderLoading(), renderDelete());
14063
14089
  };
@@ -14097,7 +14123,8 @@ const defaultProps$t = {
14097
14123
  defaultValue: [],
14098
14124
  accept: "image/*",
14099
14125
  preview: true,
14100
- showFailed: true
14126
+ showFailed: true,
14127
+ imageFit: "cover"
14101
14128
  };
14102
14129
  const ImageUploader = (p) => {
14103
14130
  const props = mergeProps(defaultProps$t, p);
@@ -14162,6 +14189,7 @@ const ImageUploader = (p) => {
14162
14189
  file
14163
14190
  }));
14164
14191
  setTasks((prev) => [...prev, ...newTasks]);
14192
+ e.target.value = "";
14165
14193
  yield Promise.all(newTasks.map((currentTask) => tslib.__awaiter(this, void 0, void 0, function* () {
14166
14194
  try {
14167
14195
  const result2 = yield props.upload(currentTask.file);
@@ -14193,7 +14221,6 @@ const ImageUploader = (p) => {
14193
14221
  throw e2;
14194
14222
  }
14195
14223
  }))).catch((error) => console.error(error));
14196
- e.target.value = "";
14197
14224
  });
14198
14225
  }
14199
14226
  const imageViewerHandlerRef = React$1.useRef(null);
@@ -14223,6 +14250,7 @@ const ImageUploader = (p) => {
14223
14250
  key: (_a = fileItem.key) !== null && _a !== void 0 ? _a : index2,
14224
14251
  url: (_b = fileItem.thumbnailUrl) !== null && _b !== void 0 ? _b : fileItem.url,
14225
14252
  deletable: props.deletable,
14253
+ imageFit: props.imageFit,
14226
14254
  onClick: () => {
14227
14255
  if (props.preview) {
14228
14256
  previewImage(index2);
@@ -14246,6 +14274,7 @@ const ImageUploader = (p) => {
14246
14274
  file: task.file,
14247
14275
  deletable: task.status !== "pending",
14248
14276
  status: task.status,
14277
+ imageFit: props.imageFit,
14249
14278
  onDelete: () => {
14250
14279
  setTasks(tasks.filter((x) => x.id !== task.id));
14251
14280
  }
@@ -14343,7 +14372,7 @@ const IndexBar = React$1.forwardRef((p, ref) => {
14343
14372
  const bodyRef = React$1.useRef(null);
14344
14373
  const indexItems = [];
14345
14374
  const panels = [];
14346
- React__default["default"].Children.forEach(props.children, (child) => {
14375
+ traverseReactNode(props.children, (child) => {
14347
14376
  var _a;
14348
14377
  if (!React__default["default"].isValidElement(child))
14349
14378
  return;
@@ -14611,7 +14640,7 @@ const JumboTabs = (props) => {
14611
14640
  const keyToIndexRecord = {};
14612
14641
  let firstActiveKey = null;
14613
14642
  const panes = [];
14614
- React__default["default"].Children.forEach(props.children, (child, index2) => {
14643
+ traverseReactNode(props.children, (child, index2) => {
14615
14644
  if (!React__default["default"].isValidElement(child))
14616
14645
  return;
14617
14646
  const key = child.key;
@@ -15909,7 +15938,7 @@ const SideBar = (props) => {
15909
15938
  var _a;
15910
15939
  let firstActiveKey = null;
15911
15940
  const items = [];
15912
- React__default["default"].Children.forEach(props.children, (child, index2) => {
15941
+ traverseReactNode(props.children, (child, index2) => {
15913
15942
  if (!React__default["default"].isValidElement(child))
15914
15943
  return;
15915
15944
  const key = child.key;
@@ -16285,12 +16314,12 @@ const Stepper = (p) => {
16285
16314
  inputReadOnly
16286
16315
  } = props;
16287
16316
  const [value, setValue] = usePropsValue(props);
16288
- const [inputValue, setInputValue] = React$1.useState(() => convertValueToText(value));
16317
+ const [inputValue, setInputValue] = React$1.useState(() => convertValueToText(value, props.digits));
16289
16318
  function setValueWithCheck(v) {
16290
16319
  if (isNaN(v))
16291
16320
  return;
16292
16321
  let target = bound(v, props.min, props.max);
16293
- if (props.digits || props.digits === 0) {
16322
+ if (props.digits !== void 0) {
16294
16323
  target = parseFloat(target.toFixed(props.digits));
16295
16324
  }
16296
16325
  setValue(target);
@@ -16298,14 +16327,14 @@ const Stepper = (p) => {
16298
16327
  const [hasFocus, setHasFocus] = React$1.useState(false);
16299
16328
  React$1.useEffect(() => {
16300
16329
  if (!hasFocus) {
16301
- setInputValue(convertValueToText(value));
16330
+ setInputValue(convertValueToText(value, props.digits));
16302
16331
  }
16303
16332
  }, [hasFocus]);
16304
16333
  React$1.useEffect(() => {
16305
16334
  if (!hasFocus) {
16306
- setInputValue(convertValueToText(value));
16335
+ setInputValue(convertValueToText(value, props.digits));
16307
16336
  }
16308
- }, [value]);
16337
+ }, [value, props.digits]);
16309
16338
  const handleInputChange = (v) => {
16310
16339
  setInputValue(v);
16311
16340
  const value2 = convertTextToValue(v);
@@ -16320,10 +16349,10 @@ const Stepper = (p) => {
16320
16349
  }
16321
16350
  };
16322
16351
  const handleMinus = () => {
16323
- setValueWithCheck((value !== null && value !== void 0 ? value : 0) - step);
16352
+ setValueWithCheck(Big__default["default"](value !== null && value !== void 0 ? value : 0).minus(step).toNumber());
16324
16353
  };
16325
16354
  const handlePlus = () => {
16326
- setValueWithCheck((value !== null && value !== void 0 ? value : 0) + step);
16355
+ setValueWithCheck(Big__default["default"](value !== null && value !== void 0 ? value : 0).add(step).toNumber());
16327
16356
  };
16328
16357
  const minusDisabled = () => {
16329
16358
  if (disabled)
@@ -16385,10 +16414,14 @@ const Stepper = (p) => {
16385
16414
  color: "primary"
16386
16415
  }, React__default["default"].createElement(antdMobileIcons.AddOutline, null))));
16387
16416
  };
16388
- function convertValueToText(value) {
16417
+ function convertValueToText(value, digits) {
16389
16418
  if (value === null)
16390
16419
  return "";
16391
- return value.toString();
16420
+ if (digits !== void 0) {
16421
+ return value.toFixed(digits);
16422
+ } else {
16423
+ return value.toString();
16424
+ }
16392
16425
  }
16393
16426
  function convertTextToValue(text) {
16394
16427
  if (text === "")
@@ -16729,6 +16762,8 @@ const Swiper = React$1.forwardRef(stagedComponents.staged((p, ref) => {
16729
16762
  onRest: () => {
16730
16763
  if (draggingRef.current)
16731
16764
  return;
16765
+ if (!loop)
16766
+ return;
16732
16767
  const rawX = position.get();
16733
16768
  const totalWidth = 100 * count;
16734
16769
  const standardPosition = modulus(rawX, totalWidth);
@@ -16980,7 +17015,7 @@ const TabBar = (p) => {
16980
17015
  const props = mergeProps(defaultProps$7, p);
16981
17016
  let firstActiveKey = null;
16982
17017
  const items = [];
16983
- React__default["default"].Children.forEach(props.children, (child, index2) => {
17018
+ traverseReactNode(props.children, (child, index2) => {
16984
17019
  if (!React__default["default"].isValidElement(child))
16985
17020
  return;
16986
17021
  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) {
@@ -8275,7 +8277,13 @@ const Mask = (p) => {
8275
8277
  opacity
8276
8278
  }, props.style), {
8277
8279
  display: active ? "unset" : "none"
8278
- })
8280
+ }),
8281
+ onClick: (e) => {
8282
+ var _a;
8283
+ if (e.target === e.currentTarget) {
8284
+ (_a = props.onMaskClick) === null || _a === void 0 ? void 0 : _a.call(props, e);
8285
+ }
8286
+ }
8279
8287
  }, props.onMaskClick && React$1.createElement("div", {
8280
8288
  className: `${classPrefix$1g}-aria-button`,
8281
8289
  role: "button",
@@ -9135,6 +9143,20 @@ const ScrollMask = (props) => {
9135
9143
  }
9136
9144
  }));
9137
9145
  };
9146
+ function traverseReactNode(children, fn) {
9147
+ let i = 0;
9148
+ function handle(target) {
9149
+ React$1.Children.forEach(target, (child) => {
9150
+ if (!isFragment(child)) {
9151
+ fn(child, i);
9152
+ i += 1;
9153
+ } else {
9154
+ handle(child.props.children);
9155
+ }
9156
+ });
9157
+ }
9158
+ handle(children);
9159
+ }
9138
9160
  const classPrefix$15 = `adm-capsule-tabs`;
9139
9161
  const CapsuleTab = () => {
9140
9162
  return null;
@@ -9146,7 +9168,7 @@ const CapsuleTabs = (props) => {
9146
9168
  const keyToIndexRecord = {};
9147
9169
  let firstActiveKey = null;
9148
9170
  const panes = [];
9149
- React$1.Children.forEach(props.children, (child, index2) => {
9171
+ traverseReactNode(props.children, (child, index2) => {
9150
9172
  if (!React$1.isValidElement(child))
9151
9173
  return;
9152
9174
  const key = child.key;
@@ -9664,6 +9686,7 @@ const Wheel = memo((props) => {
9664
9686
  className: `${classPrefix$13}-column-wheel`,
9665
9687
  "aria-hidden": true
9666
9688
  }, column.map((item, index2) => {
9689
+ var _a;
9667
9690
  const selected = props.value === item.value;
9668
9691
  if (selected)
9669
9692
  selectedIndex = index2;
@@ -9672,7 +9695,7 @@ const Wheel = memo((props) => {
9672
9695
  scrollSelect(index2);
9673
9696
  }
9674
9697
  return React$1.createElement("div", {
9675
- key: item.value,
9698
+ key: (_a = item.key) !== null && _a !== void 0 ? _a : item.value,
9676
9699
  "data-selected": item.value === value,
9677
9700
  className: `${classPrefix$13}-column-item`,
9678
9701
  onClick: handleClick,
@@ -10049,7 +10072,7 @@ const Tabs$1 = (p) => {
10049
10072
  const keyToIndexRecord = {};
10050
10073
  let firstActiveKey = null;
10051
10074
  const panes = [];
10052
- React$1.Children.forEach(props.children, (child, index2) => {
10075
+ traverseReactNode(props.children, (child, index2) => {
10053
10076
  if (!React$1.isValidElement(child))
10054
10077
  return;
10055
10078
  const key = child.key;
@@ -10912,7 +10935,7 @@ const CollapsePanelContent = (props) => {
10912
10935
  const Collapse = (props) => {
10913
10936
  var _a;
10914
10937
  const panels = [];
10915
- React$1.Children.forEach(props.children, (child) => {
10938
+ traverseReactNode(props.children, (child) => {
10916
10939
  if (!React$1.isValidElement(child))
10917
10940
  return;
10918
10941
  const key = child.key;
@@ -11724,12 +11747,13 @@ var index$b = attachPropertiesToComponent(Dialog, {
11724
11747
  var divider = "";
11725
11748
  const classPrefix$R = `adm-divider`;
11726
11749
  const defaultProps$E = {
11727
- contentPosition: "center"
11750
+ contentPosition: "center",
11751
+ direction: "horizontal"
11728
11752
  };
11729
11753
  const Divider = (p) => {
11730
11754
  const props = mergeProps(defaultProps$E, p);
11731
11755
  return withNativeProps(props, React$1.createElement("div", {
11732
- className: classNames(classPrefix$R, `${classPrefix$R}-${props.contentPosition}`)
11756
+ className: classNames(classPrefix$R, `${classPrefix$R}-${props.direction}`, `${classPrefix$R}-${props.contentPosition}`)
11733
11757
  }, props.children && React$1.createElement("div", {
11734
11758
  className: `${classPrefix$R}-content`
11735
11759
  }, props.children)));
@@ -12882,7 +12906,7 @@ const Form$1 = forwardRef((p, ref) => {
12882
12906
  }, items));
12883
12907
  items = [];
12884
12908
  }
12885
- React$1.Children.forEach(props.children, (child) => {
12909
+ traverseReactNode(props.children, (child) => {
12886
12910
  if (React$1.isValidElement(child)) {
12887
12911
  if (child.type === Header) {
12888
12912
  collect();
@@ -14013,7 +14037,8 @@ const PreviewItem = (props) => {
14013
14037
  url,
14014
14038
  file,
14015
14039
  deletable,
14016
- onDelete
14040
+ onDelete,
14041
+ imageFit
14017
14042
  } = props;
14018
14043
  const src = useMemo(() => {
14019
14044
  if (url) {
@@ -14048,7 +14073,7 @@ const PreviewItem = (props) => {
14048
14073
  }, React$1.createElement(Image$1, {
14049
14074
  className: `${classPrefix$B}-cell-image`,
14050
14075
  src,
14051
- fit: "cover",
14076
+ fit: imageFit,
14052
14077
  onClick: props.onClick
14053
14078
  }), renderLoading(), renderDelete());
14054
14079
  };
@@ -14088,7 +14113,8 @@ const defaultProps$t = {
14088
14113
  defaultValue: [],
14089
14114
  accept: "image/*",
14090
14115
  preview: true,
14091
- showFailed: true
14116
+ showFailed: true,
14117
+ imageFit: "cover"
14092
14118
  };
14093
14119
  const ImageUploader = (p) => {
14094
14120
  const props = mergeProps(defaultProps$t, p);
@@ -14153,6 +14179,7 @@ const ImageUploader = (p) => {
14153
14179
  file
14154
14180
  }));
14155
14181
  setTasks((prev) => [...prev, ...newTasks]);
14182
+ e.target.value = "";
14156
14183
  yield Promise.all(newTasks.map((currentTask) => __awaiter(this, void 0, void 0, function* () {
14157
14184
  try {
14158
14185
  const result2 = yield props.upload(currentTask.file);
@@ -14184,7 +14211,6 @@ const ImageUploader = (p) => {
14184
14211
  throw e2;
14185
14212
  }
14186
14213
  }))).catch((error) => console.error(error));
14187
- e.target.value = "";
14188
14214
  });
14189
14215
  }
14190
14216
  const imageViewerHandlerRef = useRef(null);
@@ -14214,6 +14240,7 @@ const ImageUploader = (p) => {
14214
14240
  key: (_a = fileItem.key) !== null && _a !== void 0 ? _a : index2,
14215
14241
  url: (_b = fileItem.thumbnailUrl) !== null && _b !== void 0 ? _b : fileItem.url,
14216
14242
  deletable: props.deletable,
14243
+ imageFit: props.imageFit,
14217
14244
  onClick: () => {
14218
14245
  if (props.preview) {
14219
14246
  previewImage(index2);
@@ -14237,6 +14264,7 @@ const ImageUploader = (p) => {
14237
14264
  file: task.file,
14238
14265
  deletable: task.status !== "pending",
14239
14266
  status: task.status,
14267
+ imageFit: props.imageFit,
14240
14268
  onDelete: () => {
14241
14269
  setTasks(tasks.filter((x) => x.id !== task.id));
14242
14270
  }
@@ -14334,7 +14362,7 @@ const IndexBar = forwardRef((p, ref) => {
14334
14362
  const bodyRef = useRef(null);
14335
14363
  const indexItems = [];
14336
14364
  const panels = [];
14337
- React$1.Children.forEach(props.children, (child) => {
14365
+ traverseReactNode(props.children, (child) => {
14338
14366
  var _a;
14339
14367
  if (!React$1.isValidElement(child))
14340
14368
  return;
@@ -14602,7 +14630,7 @@ const JumboTabs = (props) => {
14602
14630
  const keyToIndexRecord = {};
14603
14631
  let firstActiveKey = null;
14604
14632
  const panes = [];
14605
- React$1.Children.forEach(props.children, (child, index2) => {
14633
+ traverseReactNode(props.children, (child, index2) => {
14606
14634
  if (!React$1.isValidElement(child))
14607
14635
  return;
14608
14636
  const key = child.key;
@@ -15900,7 +15928,7 @@ const SideBar = (props) => {
15900
15928
  var _a;
15901
15929
  let firstActiveKey = null;
15902
15930
  const items = [];
15903
- React$1.Children.forEach(props.children, (child, index2) => {
15931
+ traverseReactNode(props.children, (child, index2) => {
15904
15932
  if (!React$1.isValidElement(child))
15905
15933
  return;
15906
15934
  const key = child.key;
@@ -16276,12 +16304,12 @@ const Stepper = (p) => {
16276
16304
  inputReadOnly
16277
16305
  } = props;
16278
16306
  const [value, setValue] = usePropsValue(props);
16279
- const [inputValue, setInputValue] = useState(() => convertValueToText(value));
16307
+ const [inputValue, setInputValue] = useState(() => convertValueToText(value, props.digits));
16280
16308
  function setValueWithCheck(v) {
16281
16309
  if (isNaN(v))
16282
16310
  return;
16283
16311
  let target = bound(v, props.min, props.max);
16284
- if (props.digits || props.digits === 0) {
16312
+ if (props.digits !== void 0) {
16285
16313
  target = parseFloat(target.toFixed(props.digits));
16286
16314
  }
16287
16315
  setValue(target);
@@ -16289,14 +16317,14 @@ const Stepper = (p) => {
16289
16317
  const [hasFocus, setHasFocus] = useState(false);
16290
16318
  useEffect(() => {
16291
16319
  if (!hasFocus) {
16292
- setInputValue(convertValueToText(value));
16320
+ setInputValue(convertValueToText(value, props.digits));
16293
16321
  }
16294
16322
  }, [hasFocus]);
16295
16323
  useEffect(() => {
16296
16324
  if (!hasFocus) {
16297
- setInputValue(convertValueToText(value));
16325
+ setInputValue(convertValueToText(value, props.digits));
16298
16326
  }
16299
- }, [value]);
16327
+ }, [value, props.digits]);
16300
16328
  const handleInputChange = (v) => {
16301
16329
  setInputValue(v);
16302
16330
  const value2 = convertTextToValue(v);
@@ -16311,10 +16339,10 @@ const Stepper = (p) => {
16311
16339
  }
16312
16340
  };
16313
16341
  const handleMinus = () => {
16314
- setValueWithCheck((value !== null && value !== void 0 ? value : 0) - step);
16342
+ setValueWithCheck(Big(value !== null && value !== void 0 ? value : 0).minus(step).toNumber());
16315
16343
  };
16316
16344
  const handlePlus = () => {
16317
- setValueWithCheck((value !== null && value !== void 0 ? value : 0) + step);
16345
+ setValueWithCheck(Big(value !== null && value !== void 0 ? value : 0).add(step).toNumber());
16318
16346
  };
16319
16347
  const minusDisabled = () => {
16320
16348
  if (disabled)
@@ -16376,10 +16404,14 @@ const Stepper = (p) => {
16376
16404
  color: "primary"
16377
16405
  }, React$1.createElement(AddOutline, null))));
16378
16406
  };
16379
- function convertValueToText(value) {
16407
+ function convertValueToText(value, digits) {
16380
16408
  if (value === null)
16381
16409
  return "";
16382
- return value.toString();
16410
+ if (digits !== void 0) {
16411
+ return value.toFixed(digits);
16412
+ } else {
16413
+ return value.toString();
16414
+ }
16383
16415
  }
16384
16416
  function convertTextToValue(text) {
16385
16417
  if (text === "")
@@ -16720,6 +16752,8 @@ const Swiper = forwardRef(staged((p, ref) => {
16720
16752
  onRest: () => {
16721
16753
  if (draggingRef.current)
16722
16754
  return;
16755
+ if (!loop)
16756
+ return;
16723
16757
  const rawX = position.get();
16724
16758
  const totalWidth = 100 * count;
16725
16759
  const standardPosition = modulus(rawX, totalWidth);
@@ -16971,7 +17005,7 @@ const TabBar = (p) => {
16971
17005
  const props = mergeProps(defaultProps$7, p);
16972
17006
  let firstActiveKey = null;
16973
17007
  const items = [];
16974
- React$1.Children.forEach(props.children, (child, index2) => {
17008
+ traverseReactNode(props.children, (child, index2) => {
16975
17009
  if (!React$1.isValidElement(child))
16976
17010
  return;
16977
17011
  const key = child.key;
package/bundle/style.css CHANGED
@@ -9,6 +9,7 @@
9
9
  --adm-border-color: #eeeeee;
10
10
  --adm-font-size-main: 13px;
11
11
  --adm-color-text: #333333;
12
+ --adm-hd: 1;
12
13
  --adm-font-family: -apple-system, blinkmacsystemfont, 'Helvetica Neue',
13
14
  helvetica, segoe ui, arial, roboto, 'PingFang SC', 'miui',
14
15
  'Hiragino Sans GB', 'Microsoft Yahei', sans-serif;
@@ -139,6 +140,7 @@ div.adm-px-tester {
139
140
  z-index: 0;
140
141
  width: 100%;
141
142
  height: 100%;
143
+ pointer-events: none;
142
144
  }
143
145
  .adm-mask-content {
144
146
  z-index: 1;
@@ -278,10 +280,10 @@ div.adm-px-tester {
278
280
  width: 100%;
279
281
  }
280
282
  .adm-safe-area-position-top {
281
- padding-top: env(safe-area-inset-top);
283
+ padding-top: calc(env(safe-area-inset-top) * var(--adm-hd));
282
284
  }
283
285
  .adm-safe-area-position-bottom {
284
- padding-bottom: env(safe-area-inset-bottom);
286
+ padding-bottom: calc(env(safe-area-inset-bottom) * var(--adm-hd));
285
287
  }
286
288
  .adm-auto-center {
287
289
  display: flex;
@@ -1191,24 +1193,24 @@ a.adm-list-item:active:not(.adm-list-item-disabled)::after {
1191
1193
  transform: translate(-50%, -50%);
1192
1194
  color: var(--adm-color-weak);
1193
1195
  }
1194
- .adm-divider {
1196
+ .adm-divider-horizontal {
1195
1197
  display: flex;
1196
1198
  align-items: center;
1197
1199
  margin: 16px 0;
1198
- color: var(--adm-color-weak);
1199
- font-size: 14px;
1200
1200
  border-width: 0;
1201
1201
  border-color: var(--adm-border-color);
1202
1202
  border-style: solid;
1203
+ color: var(--adm-color-weak);
1204
+ font-size: 14px;
1203
1205
  }
1204
- .adm-divider-left.adm-divider::before {
1206
+ .adm-divider-left.adm-divider-horizontal::before {
1205
1207
  max-width: 10%;
1206
1208
  }
1207
- .adm-divider-right.adm-divider::after {
1209
+ .adm-divider-right.adm-divider-horizontal::after {
1208
1210
  max-width: 10%;
1209
1211
  }
1210
- .adm-divider::after,
1211
- .adm-divider::before {
1212
+ .adm-divider-horizontal::after,
1213
+ .adm-divider-horizontal::before {
1212
1214
  flex: auto;
1213
1215
  display: block;
1214
1216
  content: '';
@@ -1216,10 +1218,20 @@ a.adm-list-item:active:not(.adm-list-item-disabled)::after {
1216
1218
  border-color: inherit;
1217
1219
  border-width: 1px 0 0;
1218
1220
  }
1219
- .adm-divider-content {
1221
+ .adm-divider-horizontal .adm-divider-content {
1220
1222
  flex: none;
1221
1223
  padding: 0 16px;
1222
1224
  }
1225
+ .adm-divider-vertical {
1226
+ position: relative;
1227
+ top: -0.06em;
1228
+ display: inline-block;
1229
+ height: 0.9em;
1230
+ margin: 0 16px;
1231
+ vertical-align: middle;
1232
+ border-top: 0;
1233
+ border-left: 1px solid var(--adm-border-color);
1234
+ }
1223
1235
  .adm-dropdown {
1224
1236
  background-color: white;
1225
1237
  }
@@ -23,6 +23,8 @@ var _scrollMask = _interopRequireDefault(require("../scroll-mask"));
23
23
 
24
24
  var _shouldRender = require("../../utils/should-render");
25
25
 
26
+ var _traverseReactNode = require("../../utils/traverse-react-node");
27
+
26
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
29
 
28
30
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -45,8 +47,7 @@ const CapsuleTabs = props => {
45
47
  const keyToIndexRecord = {};
46
48
  let firstActiveKey = null;
47
49
  const panes = [];
48
-
49
- _react.default.Children.forEach(props.children, (child, index) => {
50
+ (0, _traverseReactNode.traverseReactNode)(props.children, (child, index) => {
50
51
  if (!_react.default.isValidElement(child)) return;
51
52
  const key = child.key;
52
53
  if (typeof key !== 'string') return;
@@ -58,7 +59,6 @@ const CapsuleTabs = props => {
58
59
  const length = panes.push(child);
59
60
  keyToIndexRecord[key] = length - 1;
60
61
  });
61
-
62
62
  const [activeKey, setActiveKey] = (0, _usePropsValue.usePropsValue)({
63
63
  value: props.activeKey,
64
64
  defaultValue: (_a = props.defaultActiveKey) !== null && _a !== void 0 ? _a : firstActiveKey,