antd-mobile 5.42.2-alpha.0 → 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 (28) 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/cjs/components/virtual-input/use-click-outside.d.ts +1 -1
  8. package/2x/cjs/components/virtual-input/use-click-outside.js +10 -4
  9. package/2x/cjs/components/virtual-input/virtual-input.js +11 -3
  10. package/2x/es/components/virtual-input/use-click-outside.d.ts +1 -1
  11. package/2x/es/components/virtual-input/use-click-outside.js +10 -4
  12. package/2x/es/components/virtual-input/virtual-input.js +11 -3
  13. package/2x/package.json +1 -1
  14. package/bundle/antd-mobile.cjs.development.js +13 -6
  15. package/bundle/antd-mobile.cjs.js +4 -4
  16. package/bundle/antd-mobile.compatible.umd.js +1 -1
  17. package/bundle/antd-mobile.es.development.js +13 -6
  18. package/bundle/antd-mobile.es.js +372 -372
  19. package/bundle/antd-mobile.umd.development.js +13 -6
  20. package/bundle/antd-mobile.umd.js +4 -4
  21. package/cjs/components/virtual-input/use-click-outside.d.ts +1 -1
  22. package/cjs/components/virtual-input/use-click-outside.js +10 -4
  23. package/cjs/components/virtual-input/virtual-input.js +11 -3
  24. package/es/components/virtual-input/use-click-outside.d.ts +1 -1
  25. package/es/components/virtual-input/use-click-outside.js +10 -4
  26. package/es/components/virtual-input/virtual-input.js +11 -3
  27. package/package.json +1 -1
  28. package/umd/antd-mobile.js +1 -1
@@ -27586,7 +27586,7 @@ const Multiple = (p) => {
27586
27586
  const index = attachPropertiesToComponent(TreeSelect, {
27587
27587
  Multiple
27588
27588
  });
27589
- function useClickOutside(handler, ref2) {
27589
+ function useClickOutside(handler, ref2, hasKeyboardProps = false) {
27590
27590
  useEffect(() => {
27591
27591
  function handleClick(event) {
27592
27592
  if (!ref2.current || ref2.current.contains(event.target)) {
@@ -27594,9 +27594,9 @@ function useClickOutside(handler, ref2) {
27594
27594
  }
27595
27595
  handler(event);
27596
27596
  }
27597
- document.addEventListener("click", handleClick, true);
27597
+ document.addEventListener("click", handleClick, hasKeyboardProps ? true : false);
27598
27598
  return () => {
27599
- document.removeEventListener("click", handleClick, true);
27599
+ document.removeEventListener("click", handleClick, hasKeyboardProps ? true : false);
27600
27600
  };
27601
27601
  }, [handler, ref2]);
27602
27602
  }
@@ -27684,7 +27684,7 @@ const VirtualInput = forwardRef((props, ref2) => {
27684
27684
  }
27685
27685
  useClickOutside(() => {
27686
27686
  setBlur();
27687
- }, rootRef);
27687
+ }, rootRef, !!mergedProps.keyboard);
27688
27688
  const keyboard = mergedProps.keyboard;
27689
27689
  const keyboardElement = keyboard && React__default.cloneElement(keyboard, {
27690
27690
  onInput: (v) => {
@@ -27711,14 +27711,21 @@ const VirtualInput = forwardRef((props, ref2) => {
27711
27711
  },
27712
27712
  visible: hasFocus,
27713
27713
  onClose: () => {
27714
- var _a, _b;
27714
+ var _a, _b, _c;
27715
+ const activeElement = document.activeElement;
27716
+ if (activeElement === contentRef.current) {
27717
+ (_a = contentRef.current) === null || _a === void 0 ? void 0 : _a.blur();
27718
+ }
27715
27719
  setBlur();
27716
- (_b = (_a = keyboard.props).onClose) === null || _b === void 0 ? void 0 : _b.call(_a);
27720
+ (_c = (_b = keyboard.props).onClose) === null || _c === void 0 ? void 0 : _c.call(_b);
27717
27721
  },
27718
27722
  getContainer: null
27719
27723
  });
27720
27724
  const setCaretPositionToEnd = (e2) => {
27721
27725
  var _a, _b, _c;
27726
+ if (mergedProps.disabled) {
27727
+ return;
27728
+ }
27722
27729
  if (caretPosition !== value.length) {
27723
27730
  setCaretPosition(value.length);
27724
27731
  (_b = (_a = mergedProps.cursor) === null || _a === void 0 ? void 0 : _a.onMove) === null || _b === void 0 ? void 0 : _b.call(_a, value.length);