antd-mobile 5.42.1 → 5.42.2-alpha.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 (38) hide show
  1. package/2x/bundle/antd-mobile.cjs.development.js +13 -6
  2. package/2x/bundle/antd-mobile.cjs.js +4 -4
  3. package/2x/bundle/antd-mobile.es.development.js +13 -6
  4. package/2x/bundle/antd-mobile.es.js +372 -372
  5. package/2x/bundle/antd-mobile.umd.development.js +13 -6
  6. package/2x/bundle/antd-mobile.umd.js +4 -4
  7. package/2x/bundle/style.css +5 -0
  8. package/2x/cjs/components/space/space.css +4 -0
  9. package/2x/cjs/components/virtual-input/use-click-outside.d.ts +1 -1
  10. package/2x/cjs/components/virtual-input/use-click-outside.js +10 -4
  11. package/2x/cjs/components/virtual-input/virtual-input.css +1 -0
  12. package/2x/cjs/components/virtual-input/virtual-input.js +11 -3
  13. package/2x/es/components/space/space.css +4 -0
  14. package/2x/es/components/virtual-input/use-click-outside.d.ts +1 -1
  15. package/2x/es/components/virtual-input/use-click-outside.js +10 -4
  16. package/2x/es/components/virtual-input/virtual-input.css +1 -0
  17. package/2x/es/components/virtual-input/virtual-input.js +11 -3
  18. package/2x/package.json +1 -1
  19. package/bundle/antd-mobile.cjs.development.js +13 -6
  20. package/bundle/antd-mobile.cjs.js +4 -4
  21. package/bundle/antd-mobile.compatible.umd.js +1 -1
  22. package/bundle/antd-mobile.es.development.js +13 -6
  23. package/bundle/antd-mobile.es.js +372 -372
  24. package/bundle/antd-mobile.umd.development.js +13 -6
  25. package/bundle/antd-mobile.umd.js +4 -4
  26. package/bundle/style.css +1 -1
  27. package/cjs/components/space/space.css +3 -0
  28. package/cjs/components/virtual-input/use-click-outside.d.ts +1 -1
  29. package/cjs/components/virtual-input/use-click-outside.js +10 -4
  30. package/cjs/components/virtual-input/virtual-input.css +1 -0
  31. package/cjs/components/virtual-input/virtual-input.js +11 -3
  32. package/es/components/space/space.css +3 -0
  33. package/es/components/virtual-input/use-click-outside.d.ts +1 -1
  34. package/es/components/virtual-input/use-click-outside.js +10 -4
  35. package/es/components/virtual-input/virtual-input.css +1 -0
  36. package/es/components/virtual-input/virtual-input.js +11 -3
  37. package/package.json +1 -1
  38. package/umd/antd-mobile.js +1 -1
@@ -27604,7 +27604,7 @@ const Multiple = (p) => {
27604
27604
  const index = attachPropertiesToComponent(TreeSelect, {
27605
27605
  Multiple
27606
27606
  });
27607
- function useClickOutside(handler, ref2) {
27607
+ function useClickOutside(handler, ref2, hasKeyboardProps = false) {
27608
27608
  React$3.useEffect(() => {
27609
27609
  function handleClick(event) {
27610
27610
  if (!ref2.current || ref2.current.contains(event.target)) {
@@ -27612,9 +27612,9 @@ function useClickOutside(handler, ref2) {
27612
27612
  }
27613
27613
  handler(event);
27614
27614
  }
27615
- document.addEventListener("click", handleClick, true);
27615
+ document.addEventListener("click", handleClick, hasKeyboardProps ? true : false);
27616
27616
  return () => {
27617
- document.removeEventListener("click", handleClick, true);
27617
+ document.removeEventListener("click", handleClick, hasKeyboardProps ? true : false);
27618
27618
  };
27619
27619
  }, [handler, ref2]);
27620
27620
  }
@@ -27702,7 +27702,7 @@ const VirtualInput = React$3.forwardRef((props, ref2) => {
27702
27702
  }
27703
27703
  useClickOutside(() => {
27704
27704
  setBlur();
27705
- }, rootRef);
27705
+ }, rootRef, !!mergedProps.keyboard);
27706
27706
  const keyboard = mergedProps.keyboard;
27707
27707
  const keyboardElement = keyboard && React$3.cloneElement(keyboard, {
27708
27708
  onInput: (v) => {
@@ -27729,14 +27729,21 @@ const VirtualInput = React$3.forwardRef((props, ref2) => {
27729
27729
  },
27730
27730
  visible: hasFocus,
27731
27731
  onClose: () => {
27732
- var _a, _b;
27732
+ var _a, _b, _c;
27733
+ const activeElement = document.activeElement;
27734
+ if (activeElement === contentRef.current) {
27735
+ (_a = contentRef.current) === null || _a === void 0 ? void 0 : _a.blur();
27736
+ }
27733
27737
  setBlur();
27734
- (_b = (_a = keyboard.props).onClose) === null || _b === void 0 ? void 0 : _b.call(_a);
27738
+ (_c = (_b = keyboard.props).onClose) === null || _c === void 0 ? void 0 : _c.call(_b);
27735
27739
  },
27736
27740
  getContainer: null
27737
27741
  });
27738
27742
  const setCaretPositionToEnd = (e2) => {
27739
27743
  var _a, _b, _c;
27744
+ if (mergedProps.disabled) {
27745
+ return;
27746
+ }
27740
27747
  if (caretPosition !== value.length) {
27741
27748
  setCaretPosition(value.length);
27742
27749
  (_b = (_a = mergedProps.cursor) === null || _a === void 0 ? void 0 : _a.onMove) === null || _b === void 0 ? void 0 : _b.call(_a, value.length);