x-ui-design 0.7.49 → 0.7.51

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.
package/dist/index.esm.js CHANGED
@@ -2849,10 +2849,22 @@ const TimePicker = ({
2849
2849
  const shouldShowAbove = offsetHeight - (inputRef.current?.getBoundingClientRect().bottom || 0) < 230;
2850
2850
  const shouldShowBelow = inputRef.current?.getBoundingClientRect().top < 230;
2851
2851
  if (open && !shouldShowBelow && !shouldShowAbove) {
2852
- if (getPopupContainer && !Object.keys(dropdownPosition).length) {
2853
- toAbove();
2854
- }
2855
- return;
2852
+ setDropdownPosition(previousDropdownPosition => {
2853
+ if (!Object.keys(previousDropdownPosition).length) {
2854
+ if (getPopupContainer) {
2855
+ return {
2856
+ top: (inputRef.current?.getBoundingClientRect().top || 0) + document.documentElement.scrollTop - 230,
2857
+ left: (inputRef.current?.getBoundingClientRect().left || 0) + document.documentElement.scrollLeft
2858
+ };
2859
+ } else {
2860
+ return {
2861
+ top: (inputRef.current?.offsetTop || 0) + (inputRef.current?.offsetHeight || 0),
2862
+ left: inputRef.current?.offsetLeft
2863
+ };
2864
+ }
2865
+ }
2866
+ return previousDropdownPosition;
2867
+ });
2856
2868
  }
2857
2869
  if (getPopupContainer) {
2858
2870
  if (!shouldShowBelow) {
@@ -2863,10 +2875,6 @@ const TimePicker = ({
2863
2875
  toAbove();
2864
2876
  }
2865
2877
  } else {
2866
- console.log({
2867
- shouldShowBelow,
2868
- shouldShowAbove
2869
- });
2870
2878
  if (shouldShowBelow) {
2871
2879
  setDropdownPosition({
2872
2880
  top: inputRef.current.offsetTop + inputRef.current.offsetHeight,
@@ -3040,7 +3048,7 @@ const TimePicker = ({
3040
3048
  ref: popupRef,
3041
3049
  style: {
3042
3050
  ...dropdownPosition,
3043
- opacity: getPopupContainer ? Object.keys(dropdownPosition).length ? 1 : 0 : 1
3051
+ opacity: Object.keys(dropdownPosition).length ? 1 : 0
3044
3052
  },
3045
3053
  className: clsx([`${prefixCls}-popup`, {
3046
3054
  [`${prefixCls}-popup-up`]: openUpward