antd-mobile 5.33.0 → 5.33.1

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 (76) hide show
  1. package/2x/README.md +1 -1
  2. package/2x/bundle/antd-mobile.cjs.development.js +54 -28
  3. package/2x/bundle/antd-mobile.cjs.js +9 -9
  4. package/2x/bundle/antd-mobile.es.development.js +54 -28
  5. package/2x/bundle/antd-mobile.es.js +1979 -1958
  6. package/2x/bundle/antd-mobile.umd.development.js +54 -28
  7. package/2x/bundle/antd-mobile.umd.js +9 -9
  8. package/2x/bundle/style.css +2 -2
  9. package/2x/cjs/components/calendar-picker/calendar-picker.d.ts +5 -0
  10. package/2x/cjs/components/calendar-picker/calendar-picker.js +5 -3
  11. package/2x/cjs/components/cascader/cascader.js +6 -1
  12. package/2x/cjs/components/cascader-view/cascader-view.js +4 -1
  13. package/2x/cjs/components/cascader-view/use-cascader-value-extend.d.ts +3 -2
  14. package/2x/cjs/components/cascader-view/use-cascader-value-extend.js +9 -5
  15. package/2x/cjs/components/image-viewer/image-viewer.d.ts +4 -0
  16. package/2x/cjs/components/image-viewer/image-viewer.js +11 -8
  17. package/2x/cjs/components/number-keyboard/number-keyboard.js +5 -1
  18. package/2x/cjs/components/popover/popover-menu.js +3 -1
  19. package/2x/cjs/components/popover/popover.js +5 -5
  20. package/2x/cjs/components/popup/popup.js +1 -0
  21. package/2x/cjs/components/switch/switch.css +2 -2
  22. package/2x/cjs/components/virtual-input/virtual-input.js +10 -3
  23. package/2x/es/components/calendar-picker/calendar-picker.d.ts +5 -0
  24. package/2x/es/components/calendar-picker/calendar-picker.js +5 -3
  25. package/2x/es/components/cascader/cascader.js +6 -1
  26. package/2x/es/components/cascader-view/cascader-view.js +4 -1
  27. package/2x/es/components/cascader-view/use-cascader-value-extend.d.ts +3 -2
  28. package/2x/es/components/cascader-view/use-cascader-value-extend.js +9 -5
  29. package/2x/es/components/image-viewer/image-viewer.d.ts +4 -0
  30. package/2x/es/components/image-viewer/image-viewer.js +11 -8
  31. package/2x/es/components/number-keyboard/number-keyboard.js +5 -1
  32. package/2x/es/components/popover/popover-menu.js +3 -1
  33. package/2x/es/components/popover/popover.js +5 -5
  34. package/2x/es/components/popup/popup.js +1 -0
  35. package/2x/es/components/switch/switch.css +2 -2
  36. package/2x/es/components/virtual-input/virtual-input.js +10 -3
  37. package/2x/package.json +1 -1
  38. package/README.md +1 -1
  39. package/bundle/antd-mobile.cjs.development.js +54 -28
  40. package/bundle/antd-mobile.cjs.js +9 -9
  41. package/bundle/antd-mobile.compatible.umd.js +1 -1
  42. package/bundle/antd-mobile.es.development.js +54 -28
  43. package/bundle/antd-mobile.es.js +1979 -1958
  44. package/bundle/antd-mobile.umd.development.js +54 -28
  45. package/bundle/antd-mobile.umd.js +9 -9
  46. package/bundle/style.css +1 -1
  47. package/cjs/components/calendar-picker/calendar-picker.d.ts +5 -0
  48. package/cjs/components/calendar-picker/calendar-picker.js +5 -3
  49. package/cjs/components/cascader/cascader.js +6 -1
  50. package/cjs/components/cascader-view/cascader-view.js +4 -1
  51. package/cjs/components/cascader-view/use-cascader-value-extend.d.ts +3 -2
  52. package/cjs/components/cascader-view/use-cascader-value-extend.js +9 -5
  53. package/cjs/components/image-viewer/image-viewer.d.ts +4 -0
  54. package/cjs/components/image-viewer/image-viewer.js +11 -8
  55. package/cjs/components/number-keyboard/number-keyboard.js +5 -1
  56. package/cjs/components/popover/popover-menu.js +3 -1
  57. package/cjs/components/popover/popover.js +5 -5
  58. package/cjs/components/popup/popup.js +1 -0
  59. package/cjs/components/switch/switch.css +2 -2
  60. package/cjs/components/virtual-input/virtual-input.js +10 -3
  61. package/es/components/calendar-picker/calendar-picker.d.ts +5 -0
  62. package/es/components/calendar-picker/calendar-picker.js +5 -3
  63. package/es/components/cascader/cascader.js +6 -1
  64. package/es/components/cascader-view/cascader-view.js +4 -1
  65. package/es/components/cascader-view/use-cascader-value-extend.d.ts +3 -2
  66. package/es/components/cascader-view/use-cascader-value-extend.js +9 -5
  67. package/es/components/image-viewer/image-viewer.d.ts +4 -0
  68. package/es/components/image-viewer/image-viewer.js +11 -8
  69. package/es/components/number-keyboard/number-keyboard.js +5 -1
  70. package/es/components/popover/popover-menu.js +3 -1
  71. package/es/components/popover/popover.js +5 -5
  72. package/es/components/popup/popup.js +1 -0
  73. package/es/components/switch/switch.css +2 -2
  74. package/es/components/virtual-input/virtual-input.js +10 -3
  75. package/package.json +1 -1
  76. package/umd/antd-mobile.js +1 -1
package/2x/README.md CHANGED
@@ -16,7 +16,7 @@
16
16
  <span> · </span>
17
17
  <a href="https://discord.gg/jmNvw4WFYn">Discord</a>
18
18
  <span> · </span>
19
- <a href="https://user-images.githubusercontent.com/22469543/197447477-1f10603d-90e9-43ea-a023-6538c5cf40e2.jpeg">钉钉</a>
19
+ <a href="https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*8gmTR49Nr8UAAAAAAAAAAAAADrJ8AQ/original">钉钉</a>
20
20
  </h4>
21
21
  </div>
22
22
 
@@ -9558,6 +9558,7 @@ const Popup$1 = (p) => {
9558
9558
  }), React__default.default.createElement(animated.div, {
9559
9559
  className: bodyCls,
9560
9560
  style: Object.assign(Object.assign({}, props.bodyStyle), {
9561
+ pointerEvents: percent.to((v) => v === 0 ? "unset" : "none"),
9561
9562
  transform: percent.to((v) => {
9562
9563
  if (props.position === "bottom") {
9563
9564
  return `translate(0, ${v}%)`;
@@ -10793,8 +10794,9 @@ const CalendarPicker$1 = React$4.forwardRef((p, ref) => {
10793
10794
  closeOnMaskClick,
10794
10795
  onClose,
10795
10796
  onConfirm,
10796
- onMaskClick
10797
- } = props, calendarViewProps = __rest(props, ["visible", "confirmText", "popupClassName", "popupStyle", "popupBodyStyle", "forceRender", "closeOnMaskClick", "onClose", "onConfirm", "onMaskClick"]);
10797
+ onMaskClick,
10798
+ getContainer
10799
+ } = props, calendarViewProps = __rest(props, ["visible", "confirmText", "popupClassName", "popupStyle", "popupBodyStyle", "forceRender", "closeOnMaskClick", "onClose", "onConfirm", "onMaskClick", "getContainer"]);
10798
10800
  const footer2 = React__default.default.createElement("div", {
10799
10801
  className: `${classPrefix$1c}-footer`
10800
10802
  }, React__default.default.createElement(Divider, null), React__default.default.createElement("div", {
@@ -10832,7 +10834,8 @@ const CalendarPicker$1 = React$4.forwardRef((p, ref) => {
10832
10834
  if (closeOnMaskClick) {
10833
10835
  onClose === null || onClose === void 0 ? void 0 : onClose();
10834
10836
  }
10835
- }
10837
+ },
10838
+ getContainer
10836
10839
  }, React__default.default.createElement(CalendarPickerView, Object.assign({
10837
10840
  ref: calendarRef
10838
10841
  }, calendarViewProps)), footer2)));
@@ -12581,20 +12584,24 @@ function memoize(func, resolver) {
12581
12584
  }
12582
12585
  memoize.Cache = MapCache;
12583
12586
  var memoize_1 = memoize;
12584
- function useCascaderValueExtend(options) {
12587
+ function useCascaderValueExtend(options, fieldNames) {
12588
+ const {
12589
+ valueName,
12590
+ childrenName
12591
+ } = fieldNames;
12585
12592
  const generateItems = React$4.useMemo(() => {
12586
12593
  return memoize_1((val) => {
12587
12594
  const ret = [];
12588
12595
  let currentOptions = options;
12589
12596
  for (const v of val) {
12590
- const target = currentOptions.find((option) => option.value === v);
12597
+ const target = currentOptions.find((option) => option[valueName] === v);
12591
12598
  if (!target) {
12592
12599
  break;
12593
12600
  }
12594
12601
  ret.push(target);
12595
- if (!target.children)
12602
+ if (!target[childrenName])
12596
12603
  break;
12597
- currentOptions = target.children;
12604
+ currentOptions = target[childrenName];
12598
12605
  }
12599
12606
  return ret;
12600
12607
  }, (val) => JSON.stringify(val));
@@ -12603,7 +12610,7 @@ function useCascaderValueExtend(options) {
12603
12610
  return memoize_1((val) => {
12604
12611
  const children = val.reduce((currentOptions, v) => {
12605
12612
  var _a;
12606
- return ((_a = currentOptions.find((option) => option.value === v)) === null || _a === void 0 ? void 0 : _a.children) || [];
12613
+ return ((_a = currentOptions.find((option) => option[valueName] === v)) === null || _a === void 0 ? void 0 : _a[childrenName]) || [];
12607
12614
  }, options);
12608
12615
  return children.length === 0;
12609
12616
  }, (val) => JSON.stringify(val));
@@ -12683,8 +12690,11 @@ const CascaderView$1 = (p) => {
12683
12690
  const {
12684
12691
  locale
12685
12692
  } = useConfig();
12686
- const generateValueExtend = useCascaderValueExtend(props.options);
12687
12693
  const [labelName, valueName, childrenName, disabledName] = useFieldNames(props.fieldNames);
12694
+ const generateValueExtend = useCascaderValueExtend(props.options, {
12695
+ valueName,
12696
+ childrenName
12697
+ });
12688
12698
  const [value, setValue2] = usePropsValue(Object.assign(Object.assign({}, props), {
12689
12699
  onChange: (val) => {
12690
12700
  var _a;
@@ -12836,7 +12846,11 @@ const Cascader = React$4.forwardRef((p, ref) => {
12836
12846
  (_a2 = props.onConfirm) === null || _a2 === void 0 ? void 0 : _a2.call(props, val, generateValueExtend(val));
12837
12847
  }
12838
12848
  }));
12839
- const generateValueExtend = useCascaderValueExtend(props.options);
12849
+ const [, valueName, childrenName] = useFieldNames(props.fieldNames);
12850
+ const generateValueExtend = useCascaderValueExtend(props.options, {
12851
+ valueName,
12852
+ childrenName
12853
+ });
12840
12854
  const [innerValue, setInnerValue] = React$4.useState(value);
12841
12855
  React$4.useEffect(() => {
12842
12856
  if (!visible) {
@@ -20997,13 +21011,11 @@ const defaultProps$B = {
20997
21011
  placement: "top",
20998
21012
  defaultVisible: false,
20999
21013
  stopPropagation: ["click"],
21000
- getContainer: () => document.body
21014
+ getContainer: () => document.body,
21015
+ mode: "light"
21001
21016
  };
21002
21017
  const Popover$1 = React$4.forwardRef((p, ref) => {
21003
21018
  const props = mergeProps(defaultProps$B, p);
21004
- const {
21005
- mode = "light"
21006
- } = props;
21007
21019
  const placement = normalizePlacement(props.placement);
21008
21020
  const [visible, setVisible] = usePropsValue({
21009
21021
  value: props.visible,
@@ -21019,7 +21031,9 @@ const Popover$1 = React$4.forwardRef((p, ref) => {
21019
21031
  const floatingRef = React$4.useRef(null);
21020
21032
  const arrowRef = React$4.useRef(null);
21021
21033
  const floating = withStopPropagation(props.stopPropagation, withNativeProps(props, React__default.default.createElement("div", {
21022
- className: classNames(classPrefix$N, `${classPrefix$N}-${mode}`, !visible && `${classPrefix$N}-hidden`),
21034
+ className: classNames(classPrefix$N, `${classPrefix$N}-${props.mode}`, {
21035
+ [`${classPrefix$N}-hidden`]: !visible
21036
+ }),
21023
21037
  ref: floatingRef
21024
21038
  }, React__default.default.createElement("div", {
21025
21039
  className: `${classPrefix$N}-arrow`,
@@ -21155,7 +21169,9 @@ const PopoverMenu = React$4.forwardRef((props, ref) => {
21155
21169
  var _a;
21156
21170
  return React__default.default.createElement("a", {
21157
21171
  key: (_a = action.key) !== null && _a !== void 0 ? _a : index2,
21158
- className: classNames(`${classPrefix$M}-item`, "adm-plain-anchor", action.disabled && `${classPrefix$M}-item-disabled`),
21172
+ className: classNames(`${classPrefix$M}-item`, "adm-plain-anchor", {
21173
+ [`${classPrefix$M}-item-disabled`]: action.disabled
21174
+ }),
21159
21175
  onClick: () => {
21160
21176
  var _a2;
21161
21177
  if (action.disabled)
@@ -21866,23 +21882,24 @@ const defaultProps$A = {
21866
21882
  visible: false
21867
21883
  };
21868
21884
  const ImageViewer$1 = (p) => {
21869
- var _a;
21885
+ var _a, _b, _c;
21870
21886
  const props = mergeProps(defaultProps$A, p);
21871
21887
  const node = React__default.default.createElement(Mask, {
21872
21888
  visible: props.visible,
21873
21889
  disableBodyScroll: false,
21874
21890
  opacity: "thick",
21875
21891
  afterClose: props.afterClose,
21876
- destroyOnClose: true
21892
+ destroyOnClose: true,
21893
+ className: (_a = props === null || props === void 0 ? void 0 : props.classNames) === null || _a === void 0 ? void 0 : _a.mask
21877
21894
  }, React__default.default.createElement("div", {
21878
- className: `${classPrefix$H}-content`
21895
+ className: classNames(`${classPrefix$H}-content`, (_b = props === null || props === void 0 ? void 0 : props.classNames) === null || _b === void 0 ? void 0 : _b.body)
21879
21896
  }, props.image && React__default.default.createElement(Slide, {
21880
21897
  image: props.image,
21881
21898
  onTap: props.onClose,
21882
21899
  maxZoom: props.maxZoom
21883
21900
  })), props.image && React__default.default.createElement("div", {
21884
21901
  className: `${classPrefix$H}-footer`
21885
- }, (_a = props.renderFooter) === null || _a === void 0 ? void 0 : _a.call(props, props.image), React__default.default.createElement(SafeArea, {
21902
+ }, (_c = props.renderFooter) === null || _c === void 0 ? void 0 : _c.call(props, props.image), React__default.default.createElement(SafeArea, {
21886
21903
  position: "bottom"
21887
21904
  })));
21888
21905
  return renderToContainer(props.getContainer, node);
@@ -21891,7 +21908,7 @@ const multiDefaultProps = Object.assign(Object.assign({}, defaultProps$A), {
21891
21908
  defaultIndex: 0
21892
21909
  });
21893
21910
  const MultiImageViewer = React$4.forwardRef((p, ref) => {
21894
- var _a;
21911
+ var _a, _b, _c;
21895
21912
  const props = mergeProps(multiDefaultProps, p);
21896
21913
  const [index2, setIndex] = React$4.useState(props.defaultIndex);
21897
21914
  const slidesRef = React$4.useRef(null);
@@ -21914,9 +21931,10 @@ const MultiImageViewer = React$4.forwardRef((p, ref) => {
21914
21931
  disableBodyScroll: false,
21915
21932
  opacity: "thick",
21916
21933
  afterClose: props.afterClose,
21917
- destroyOnClose: true
21934
+ destroyOnClose: true,
21935
+ className: (_a = props === null || props === void 0 ? void 0 : props.classNames) === null || _a === void 0 ? void 0 : _a.mask
21918
21936
  }, React__default.default.createElement("div", {
21919
- className: `${classPrefix$H}-content`
21937
+ className: classNames(`${classPrefix$H}-content`, (_b = props === null || props === void 0 ? void 0 : props.classNames) === null || _b === void 0 ? void 0 : _b.body)
21920
21938
  }, props.images && React__default.default.createElement(Slides, {
21921
21939
  ref: slidesRef,
21922
21940
  defaultIndex: index2,
@@ -21926,7 +21944,7 @@ const MultiImageViewer = React$4.forwardRef((p, ref) => {
21926
21944
  maxZoom: props.maxZoom
21927
21945
  })), props.images && React__default.default.createElement("div", {
21928
21946
  className: `${classPrefix$H}-footer`
21929
- }, (_a = props.renderFooter) === null || _a === void 0 ? void 0 : _a.call(props, props.images[index2], index2), React__default.default.createElement(SafeArea, {
21947
+ }, (_c = props.renderFooter) === null || _c === void 0 ? void 0 : _c.call(props, props.images[index2], index2), React__default.default.createElement(SafeArea, {
21930
21948
  position: "bottom"
21931
21949
  })));
21932
21950
  return renderToContainer(props.getContainer, node);
@@ -23182,7 +23200,7 @@ const NumberKeyboard$1 = (p) => {
23182
23200
  className: classNames(`${classPrefix$w}-header`, {
23183
23201
  [`${classPrefix$w}-header-with-title`]: !!title
23184
23202
  })
23185
- }, React__default.default.createElement("div", {
23203
+ }, !!title && React__default.default.createElement("div", {
23186
23204
  className: `${classPrefix$w}-title`,
23187
23205
  "aria-label": title
23188
23206
  }, title), showCloseButton && React__default.default.createElement("span", {
@@ -23257,6 +23275,9 @@ const NumberKeyboard$1 = (p) => {
23257
23275
  onKeyPress(e2, "BACKSPACE");
23258
23276
  onBackspacePressEnd();
23259
23277
  },
23278
+ onContextMenu: (e2) => {
23279
+ e2.preventDefault();
23280
+ },
23260
23281
  title: "BACKSPACE",
23261
23282
  role: "grid",
23262
23283
  tabIndex: -1
@@ -26813,9 +26834,14 @@ const VirtualInput$1 = React$4.forwardRef((p, ref) => {
26813
26834
  },
26814
26835
  visible: hasFocus,
26815
26836
  onClose: () => {
26816
- var _a, _b, _c;
26817
- (_a = rootRef.current) === null || _a === void 0 ? void 0 : _a.blur();
26818
- (_c = (_b = keyboard.props).onClose) === null || _c === void 0 ? void 0 : _c.call(_b);
26837
+ var _a, _b, _c, _d;
26838
+ const activeElement = document.activeElement;
26839
+ if (activeElement && ((_a = rootRef.current) === null || _a === void 0 ? void 0 : _a.contains(activeElement))) {
26840
+ activeElement.blur();
26841
+ } else {
26842
+ (_b = rootRef.current) === null || _b === void 0 ? void 0 : _b.blur();
26843
+ }
26844
+ (_d = (_c = keyboard.props).onClose) === null || _d === void 0 ? void 0 : _d.call(_c);
26819
26845
  },
26820
26846
  getContainer: null
26821
26847
  });