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