antd-mobile 5.42.0-alpha.0 → 5.42.0-alpha.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 (38) hide show
  1. package/2x/bundle/antd-mobile.cjs.development.js +31 -21
  2. package/2x/bundle/antd-mobile.cjs.js +4 -4
  3. package/2x/bundle/antd-mobile.es.development.js +31 -21
  4. package/2x/bundle/antd-mobile.es.js +753 -747
  5. package/2x/bundle/antd-mobile.umd.development.js +31 -21
  6. package/2x/bundle/antd-mobile.umd.js +4 -4
  7. package/2x/cjs/components/image-viewer/image-viewer.d.ts +3 -0
  8. package/2x/cjs/components/image-viewer/image-viewer.js +14 -12
  9. package/2x/cjs/components/number-keyboard/number-keyboard.d.ts +6 -1
  10. package/2x/cjs/components/number-keyboard/number-keyboard.js +15 -8
  11. package/2x/cjs/components/virtual-input/virtual-input.js +2 -1
  12. package/2x/es/components/image-viewer/image-viewer.d.ts +3 -0
  13. package/2x/es/components/image-viewer/image-viewer.js +14 -12
  14. package/2x/es/components/number-keyboard/number-keyboard.d.ts +6 -1
  15. package/2x/es/components/number-keyboard/number-keyboard.js +15 -8
  16. package/2x/es/components/virtual-input/virtual-input.js +2 -1
  17. package/2x/package.json +1 -1
  18. package/bundle/antd-mobile.cjs.development.js +31 -21
  19. package/bundle/antd-mobile.cjs.js +4 -4
  20. package/bundle/antd-mobile.compatible.umd.js +1 -1
  21. package/bundle/antd-mobile.es.development.js +31 -21
  22. package/bundle/antd-mobile.es.js +753 -747
  23. package/bundle/antd-mobile.umd.development.js +31 -21
  24. package/bundle/antd-mobile.umd.js +4 -4
  25. package/cjs/components/image-viewer/image-viewer.css +1 -1
  26. package/cjs/components/image-viewer/image-viewer.d.ts +3 -0
  27. package/cjs/components/image-viewer/image-viewer.js +14 -12
  28. package/cjs/components/number-keyboard/number-keyboard.d.ts +6 -1
  29. package/cjs/components/number-keyboard/number-keyboard.js +15 -8
  30. package/cjs/components/virtual-input/virtual-input.js +2 -1
  31. package/es/components/image-viewer/image-viewer.css +1 -1
  32. package/es/components/image-viewer/image-viewer.d.ts +3 -0
  33. package/es/components/image-viewer/image-viewer.js +14 -12
  34. package/es/components/number-keyboard/number-keyboard.d.ts +6 -1
  35. package/es/components/number-keyboard/number-keyboard.js +15 -8
  36. package/es/components/virtual-input/virtual-input.js +2 -1
  37. package/package.json +1 -1
  38. package/umd/antd-mobile.js +1 -1
@@ -21886,17 +21886,18 @@ const defaultProps$z = {
21886
21886
  visible: false
21887
21887
  };
21888
21888
  const ImageViewer$1 = (p) => {
21889
- var _a, _b, _c;
21889
+ var _a, _b, _c, _d;
21890
21890
  const props = mergeProps(defaultProps$z, p);
21891
21891
  const node = React__default.createElement(Mask, {
21892
21892
  visible: props.visible,
21893
+ afterClose: props === null || props === void 0 ? void 0 : props.afterClose,
21894
+ className: (_a = props === null || props === void 0 ? void 0 : props.classNames) === null || _a === void 0 ? void 0 : _a.mask,
21895
+ onMaskClick: (_b = props.mask) === null || _b === void 0 ? void 0 : _b.onClick,
21893
21896
  disableBodyScroll: false,
21894
21897
  opacity: "thick",
21895
- afterClose: props.afterClose,
21896
- destroyOnClose: true,
21897
- className: (_a = props === null || props === void 0 ? void 0 : props.classNames) === null || _a === void 0 ? void 0 : _a.mask
21898
+ destroyOnClose: true
21898
21899
  }, React__default.createElement("div", {
21899
- className: classNames(`${classPrefix$I}-content`, (_b = props === null || props === void 0 ? void 0 : props.classNames) === null || _b === void 0 ? void 0 : _b.body)
21900
+ className: classNames(`${classPrefix$I}-content`, (_c = props === null || props === void 0 ? void 0 : props.classNames) === null || _c === void 0 ? void 0 : _c.body)
21900
21901
  }, (props.image || typeof props.imageRender === "function") && React__default.createElement(Slide, {
21901
21902
  image: props.image,
21902
21903
  onTap: props.onClose,
@@ -21904,7 +21905,7 @@ const ImageViewer$1 = (p) => {
21904
21905
  imageRender: props.imageRender
21905
21906
  })), props.image && React__default.createElement("div", {
21906
21907
  className: `${classPrefix$I}-footer`
21907
- }, (_c = props.renderFooter) === null || _c === void 0 ? void 0 : _c.call(props, props.image), React__default.createElement(SafeArea, {
21908
+ }, (_d = props.renderFooter) === null || _d === void 0 ? void 0 : _d.call(props, props.image), React__default.createElement(SafeArea, {
21908
21909
  position: "bottom"
21909
21910
  })));
21910
21911
  return renderToContainer(props.getContainer, node);
@@ -21913,7 +21914,7 @@ const multiDefaultProps = Object.assign(Object.assign({}, defaultProps$z), {
21913
21914
  defaultIndex: 0
21914
21915
  });
21915
21916
  const MultiImageViewer = forwardRef((p, ref2) => {
21916
- var _a, _b, _c;
21917
+ var _a, _b, _c, _d;
21917
21918
  const props = mergeProps(multiDefaultProps, p);
21918
21919
  const [index2, setIndex] = useState(props.defaultIndex);
21919
21920
  const slidesRef = useRef(null);
@@ -21933,13 +21934,14 @@ const MultiImageViewer = forwardRef((p, ref2) => {
21933
21934
  }, [props.onIndexChange, index2]);
21934
21935
  const node = React__default.createElement(Mask, {
21935
21936
  visible: props.visible,
21937
+ afterClose: props === null || props === void 0 ? void 0 : props.afterClose,
21938
+ className: (_a = props === null || props === void 0 ? void 0 : props.classNames) === null || _a === void 0 ? void 0 : _a.mask,
21939
+ onMaskClick: (_b = props.mask) === null || _b === void 0 ? void 0 : _b.onClick,
21936
21940
  disableBodyScroll: false,
21937
21941
  opacity: "thick",
21938
- afterClose: props.afterClose,
21939
- destroyOnClose: true,
21940
- className: (_a = props === null || props === void 0 ? void 0 : props.classNames) === null || _a === void 0 ? void 0 : _a.mask
21942
+ destroyOnClose: true
21941
21943
  }, React__default.createElement("div", {
21942
- className: classNames(`${classPrefix$I}-content`, (_b = props === null || props === void 0 ? void 0 : props.classNames) === null || _b === void 0 ? void 0 : _b.body)
21944
+ className: classNames(`${classPrefix$I}-content`, (_c = props === null || props === void 0 ? void 0 : props.classNames) === null || _c === void 0 ? void 0 : _c.body)
21943
21945
  }, props.images && React__default.createElement(Slides, {
21944
21946
  ref: slidesRef,
21945
21947
  defaultIndex: index2,
@@ -21950,7 +21952,7 @@ const MultiImageViewer = forwardRef((p, ref2) => {
21950
21952
  imageRender: props.imageRender
21951
21953
  })), props.images && React__default.createElement("div", {
21952
21954
  className: `${classPrefix$I}-footer`
21953
- }, (_c = props.renderFooter) === null || _c === void 0 ? void 0 : _c.call(props, props.images[index2], index2), React__default.createElement(SafeArea, {
21955
+ }, (_d = props.renderFooter) === null || _d === void 0 ? void 0 : _d.call(props, props.images[index2], index2), React__default.createElement(SafeArea, {
21954
21956
  position: "bottom"
21955
21957
  })));
21956
21958
  return renderToContainer(props.getContainer, node);
@@ -23236,20 +23238,27 @@ const NumberKeyboard = (p) => {
23236
23238
  onKeyPress(e2, "BACKSPACE");
23237
23239
  };
23238
23240
  const renderKey = (key, index2) => {
23239
- const isNumberKey = /^\d$/.test(key);
23240
- const isBackspace = key === "BACKSPACE";
23241
+ const keyConfig = typeof key === "string" ? {
23242
+ key,
23243
+ title: key
23244
+ } : key;
23245
+ const realKey = keyConfig.key;
23246
+ const isNumberKey = /^\d$/.test(realKey);
23247
+ const isBackspace = realKey === "BACKSPACE";
23248
+ const title2 = isBackspace ? locale.Input.clear : keyConfig.title;
23241
23249
  const className = classNames(`${classPrefix$x}-key`, {
23242
23250
  [`${classPrefix$x}-key-number`]: isNumberKey,
23243
- [`${classPrefix$x}-key-sign`]: !isNumberKey && key,
23251
+ [`${classPrefix$x}-key-sign`]: !isNumberKey && realKey,
23244
23252
  [`${classPrefix$x}-key-mid`]: index2 === 9 && !!confirmText && keys2.length < 12
23245
23253
  });
23246
- const ariaProps = key ? {
23254
+ const ariaProps = realKey ? {
23247
23255
  role: "button",
23248
- title: isBackspace ? locale.Input.clear : key,
23256
+ title: title2,
23257
+ "aria-label": title2,
23249
23258
  tabIndex: -1
23250
23259
  } : void 0;
23251
23260
  return React__default.createElement("div", Object.assign({
23252
- key,
23261
+ key: realKey,
23253
23262
  className,
23254
23263
  // 仅为 backspace 绑定,支持长按快速删除
23255
23264
  onTouchStart: isBackspace ? onBackspaceTouchStart : void 0,
@@ -23261,9 +23270,9 @@ const NumberKeyboard = (p) => {
23261
23270
  // backspace touchend 时会 preventDefault 阻止其后续 click 事件
23262
23271
  onClick: (e2) => {
23263
23272
  stopContinueClear();
23264
- onKeyPress(e2, key);
23273
+ onKeyPress(e2, realKey);
23265
23274
  }
23266
- }, ariaProps), isBackspace ? React__default.createElement(TextDeletionOutline, null) : key);
23275
+ }, ariaProps), isBackspace ? React__default.createElement(TextDeletionOutline, null) : realKey);
23267
23276
  };
23268
23277
  return React__default.createElement(Popup, {
23269
23278
  visible,
@@ -27712,6 +27721,7 @@ const VirtualInput = forwardRef((props, ref2) => {
27712
27721
  (_b = (_a = mergedProps.cursor) === null || _a === void 0 ? void 0 : _a.onMove) === null || _b === void 0 ? void 0 : _b.call(_a, value.length);
27713
27722
  }
27714
27723
  (_c = mergedProps.onClick) === null || _c === void 0 ? void 0 : _c.call(mergedProps, e2);
27724
+ setHasFocus(true);
27715
27725
  };
27716
27726
  const changeCaretPosition = (index2) => (e2) => {
27717
27727
  var _a, _b, _c;
@@ -27785,7 +27795,7 @@ const VirtualInput = forwardRef((props, ref2) => {
27785
27795
  className: `${classPrefix$2}-content`,
27786
27796
  ref: contentRef,
27787
27797
  "aria-disabled": mergedProps.disabled,
27788
- "aria-label": value || mergedProps.placeholder,
27798
+ "aria-label": value ? void 0 : mergedProps.placeholder,
27789
27799
  role: "textbox",
27790
27800
  tabIndex: mergedProps.disabled ? void 0 : 0,
27791
27801
  // note: 这里增加 onFocus 有两个目的: