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
@@ -21904,17 +21904,18 @@ const defaultProps$z = {
21904
21904
  visible: false
21905
21905
  };
21906
21906
  const ImageViewer$1 = (p) => {
21907
- var _a, _b, _c;
21907
+ var _a, _b, _c, _d;
21908
21908
  const props = mergeProps(defaultProps$z, p);
21909
21909
  const node = React$3.createElement(Mask, {
21910
21910
  visible: props.visible,
21911
+ afterClose: props === null || props === void 0 ? void 0 : props.afterClose,
21912
+ className: (_a = props === null || props === void 0 ? void 0 : props.classNames) === null || _a === void 0 ? void 0 : _a.mask,
21913
+ onMaskClick: (_b = props.mask) === null || _b === void 0 ? void 0 : _b.onClick,
21911
21914
  disableBodyScroll: false,
21912
21915
  opacity: "thick",
21913
- afterClose: props.afterClose,
21914
- destroyOnClose: true,
21915
- className: (_a = props === null || props === void 0 ? void 0 : props.classNames) === null || _a === void 0 ? void 0 : _a.mask
21916
+ destroyOnClose: true
21916
21917
  }, React$3.createElement("div", {
21917
- className: classNames(`${classPrefix$I}-content`, (_b = props === null || props === void 0 ? void 0 : props.classNames) === null || _b === void 0 ? void 0 : _b.body)
21918
+ className: classNames(`${classPrefix$I}-content`, (_c = props === null || props === void 0 ? void 0 : props.classNames) === null || _c === void 0 ? void 0 : _c.body)
21918
21919
  }, (props.image || typeof props.imageRender === "function") && React$3.createElement(Slide, {
21919
21920
  image: props.image,
21920
21921
  onTap: props.onClose,
@@ -21922,7 +21923,7 @@ const ImageViewer$1 = (p) => {
21922
21923
  imageRender: props.imageRender
21923
21924
  })), props.image && React$3.createElement("div", {
21924
21925
  className: `${classPrefix$I}-footer`
21925
- }, (_c = props.renderFooter) === null || _c === void 0 ? void 0 : _c.call(props, props.image), React$3.createElement(SafeArea, {
21926
+ }, (_d = props.renderFooter) === null || _d === void 0 ? void 0 : _d.call(props, props.image), React$3.createElement(SafeArea, {
21926
21927
  position: "bottom"
21927
21928
  })));
21928
21929
  return renderToContainer(props.getContainer, node);
@@ -21931,7 +21932,7 @@ const multiDefaultProps = Object.assign(Object.assign({}, defaultProps$z), {
21931
21932
  defaultIndex: 0
21932
21933
  });
21933
21934
  const MultiImageViewer = React$3.forwardRef((p, ref2) => {
21934
- var _a, _b, _c;
21935
+ var _a, _b, _c, _d;
21935
21936
  const props = mergeProps(multiDefaultProps, p);
21936
21937
  const [index2, setIndex] = React$3.useState(props.defaultIndex);
21937
21938
  const slidesRef = React$3.useRef(null);
@@ -21951,13 +21952,14 @@ const MultiImageViewer = React$3.forwardRef((p, ref2) => {
21951
21952
  }, [props.onIndexChange, index2]);
21952
21953
  const node = React$3.createElement(Mask, {
21953
21954
  visible: props.visible,
21955
+ afterClose: props === null || props === void 0 ? void 0 : props.afterClose,
21956
+ className: (_a = props === null || props === void 0 ? void 0 : props.classNames) === null || _a === void 0 ? void 0 : _a.mask,
21957
+ onMaskClick: (_b = props.mask) === null || _b === void 0 ? void 0 : _b.onClick,
21954
21958
  disableBodyScroll: false,
21955
21959
  opacity: "thick",
21956
- afterClose: props.afterClose,
21957
- destroyOnClose: true,
21958
- className: (_a = props === null || props === void 0 ? void 0 : props.classNames) === null || _a === void 0 ? void 0 : _a.mask
21960
+ destroyOnClose: true
21959
21961
  }, React$3.createElement("div", {
21960
- className: classNames(`${classPrefix$I}-content`, (_b = props === null || props === void 0 ? void 0 : props.classNames) === null || _b === void 0 ? void 0 : _b.body)
21962
+ className: classNames(`${classPrefix$I}-content`, (_c = props === null || props === void 0 ? void 0 : props.classNames) === null || _c === void 0 ? void 0 : _c.body)
21961
21963
  }, props.images && React$3.createElement(Slides, {
21962
21964
  ref: slidesRef,
21963
21965
  defaultIndex: index2,
@@ -21968,7 +21970,7 @@ const MultiImageViewer = React$3.forwardRef((p, ref2) => {
21968
21970
  imageRender: props.imageRender
21969
21971
  })), props.images && React$3.createElement("div", {
21970
21972
  className: `${classPrefix$I}-footer`
21971
- }, (_c = props.renderFooter) === null || _c === void 0 ? void 0 : _c.call(props, props.images[index2], index2), React$3.createElement(SafeArea, {
21973
+ }, (_d = props.renderFooter) === null || _d === void 0 ? void 0 : _d.call(props, props.images[index2], index2), React$3.createElement(SafeArea, {
21972
21974
  position: "bottom"
21973
21975
  })));
21974
21976
  return renderToContainer(props.getContainer, node);
@@ -23254,20 +23256,27 @@ const NumberKeyboard = (p) => {
23254
23256
  onKeyPress(e2, "BACKSPACE");
23255
23257
  };
23256
23258
  const renderKey = (key, index2) => {
23257
- const isNumberKey = /^\d$/.test(key);
23258
- const isBackspace = key === "BACKSPACE";
23259
+ const keyConfig = typeof key === "string" ? {
23260
+ key,
23261
+ title: key
23262
+ } : key;
23263
+ const realKey = keyConfig.key;
23264
+ const isNumberKey = /^\d$/.test(realKey);
23265
+ const isBackspace = realKey === "BACKSPACE";
23266
+ const title2 = isBackspace ? locale.Input.clear : keyConfig.title;
23259
23267
  const className = classNames(`${classPrefix$x}-key`, {
23260
23268
  [`${classPrefix$x}-key-number`]: isNumberKey,
23261
- [`${classPrefix$x}-key-sign`]: !isNumberKey && key,
23269
+ [`${classPrefix$x}-key-sign`]: !isNumberKey && realKey,
23262
23270
  [`${classPrefix$x}-key-mid`]: index2 === 9 && !!confirmText && keys2.length < 12
23263
23271
  });
23264
- const ariaProps = key ? {
23272
+ const ariaProps = realKey ? {
23265
23273
  role: "button",
23266
- title: isBackspace ? locale.Input.clear : key,
23274
+ title: title2,
23275
+ "aria-label": title2,
23267
23276
  tabIndex: -1
23268
23277
  } : void 0;
23269
23278
  return React$3.createElement("div", Object.assign({
23270
- key,
23279
+ key: realKey,
23271
23280
  className,
23272
23281
  // 仅为 backspace 绑定,支持长按快速删除
23273
23282
  onTouchStart: isBackspace ? onBackspaceTouchStart : void 0,
@@ -23279,9 +23288,9 @@ const NumberKeyboard = (p) => {
23279
23288
  // backspace touchend 时会 preventDefault 阻止其后续 click 事件
23280
23289
  onClick: (e2) => {
23281
23290
  stopContinueClear();
23282
- onKeyPress(e2, key);
23291
+ onKeyPress(e2, realKey);
23283
23292
  }
23284
- }, ariaProps), isBackspace ? React$3.createElement(TextDeletionOutline, null) : key);
23293
+ }, ariaProps), isBackspace ? React$3.createElement(TextDeletionOutline, null) : realKey);
23285
23294
  };
23286
23295
  return React$3.createElement(Popup, {
23287
23296
  visible,
@@ -27730,6 +27739,7 @@ const VirtualInput = React$3.forwardRef((props, ref2) => {
27730
27739
  (_b = (_a = mergedProps.cursor) === null || _a === void 0 ? void 0 : _a.onMove) === null || _b === void 0 ? void 0 : _b.call(_a, value.length);
27731
27740
  }
27732
27741
  (_c = mergedProps.onClick) === null || _c === void 0 ? void 0 : _c.call(mergedProps, e2);
27742
+ setHasFocus(true);
27733
27743
  };
27734
27744
  const changeCaretPosition = (index2) => (e2) => {
27735
27745
  var _a, _b, _c;
@@ -27803,7 +27813,7 @@ const VirtualInput = React$3.forwardRef((props, ref2) => {
27803
27813
  className: `${classPrefix$2}-content`,
27804
27814
  ref: contentRef,
27805
27815
  "aria-disabled": mergedProps.disabled,
27806
- "aria-label": value || mergedProps.placeholder,
27816
+ "aria-label": value ? void 0 : mergedProps.placeholder,
27807
27817
  role: "textbox",
27808
27818
  tabIndex: mergedProps.disabled ? void 0 : 0,
27809
27819
  // note: 这里增加 onFocus 有两个目的: