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
@@ -5834,6 +5834,7 @@ function withStopPropagation(events, element) {
5834
5834
  props[prop] = function(e2) {
5835
5835
  var _a, _b;
5836
5836
  e2.stopPropagation();
5837
+ e2.nativeEvent.stopImmediatePropagation();
5837
5838
  (_b = (_a = element.props)[prop]) === null || _b === void 0 ? void 0 : _b.call(_a, e2);
5838
5839
  };
5839
5840
  }
@@ -27604,7 +27605,7 @@ const Multiple = (p) => {
27604
27605
  const index = attachPropertiesToComponent(TreeSelect, {
27605
27606
  Multiple
27606
27607
  });
27607
- function useClickOutside(handler, ref2) {
27608
+ function useClickOutside(handler, ref2, hasKeyboardProps = false) {
27608
27609
  React$3.useEffect(() => {
27609
27610
  function handleClick(event) {
27610
27611
  if (!ref2.current || ref2.current.contains(event.target)) {
@@ -27612,9 +27613,9 @@ function useClickOutside(handler, ref2) {
27612
27613
  }
27613
27614
  handler(event);
27614
27615
  }
27615
- document.addEventListener("click", handleClick, true);
27616
+ document.addEventListener("click", handleClick, hasKeyboardProps ? true : false);
27616
27617
  return () => {
27617
- document.removeEventListener("click", handleClick, true);
27618
+ document.removeEventListener("click", handleClick, hasKeyboardProps ? true : false);
27618
27619
  };
27619
27620
  }, [handler, ref2]);
27620
27621
  }
@@ -27702,7 +27703,7 @@ const VirtualInput = React$3.forwardRef((props, ref2) => {
27702
27703
  }
27703
27704
  useClickOutside(() => {
27704
27705
  setBlur();
27705
- }, rootRef);
27706
+ }, rootRef, !!mergedProps.keyboard);
27706
27707
  const keyboard = mergedProps.keyboard;
27707
27708
  const keyboardElement = keyboard && React$3.cloneElement(keyboard, {
27708
27709
  onInput: (v) => {
@@ -27729,14 +27730,21 @@ const VirtualInput = React$3.forwardRef((props, ref2) => {
27729
27730
  },
27730
27731
  visible: hasFocus,
27731
27732
  onClose: () => {
27732
- var _a, _b;
27733
+ var _a, _b, _c;
27734
+ const activeElement = document.activeElement;
27735
+ if (activeElement === contentRef.current) {
27736
+ (_a = contentRef.current) === null || _a === void 0 ? void 0 : _a.blur();
27737
+ }
27733
27738
  setBlur();
27734
- (_b = (_a = keyboard.props).onClose) === null || _b === void 0 ? void 0 : _b.call(_a);
27739
+ (_c = (_b = keyboard.props).onClose) === null || _c === void 0 ? void 0 : _c.call(_b);
27735
27740
  },
27736
27741
  getContainer: null
27737
27742
  });
27738
27743
  const setCaretPositionToEnd = (e2) => {
27739
27744
  var _a, _b, _c;
27745
+ if (mergedProps.disabled) {
27746
+ return;
27747
+ }
27740
27748
  if (caretPosition !== value.length) {
27741
27749
  setCaretPosition(value.length);
27742
27750
  (_b = (_a = mergedProps.cursor) === null || _a === void 0 ? void 0 : _a.onMove) === null || _b === void 0 ? void 0 : _b.call(_a, value.length);