x-ui-design 0.9.43 → 0.9.46
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/esm/types/components/DatePicker/RangePicker/RangePicker.d.ts +1 -1
- package/dist/esm/types/components/Dropdown/Dropdown.d.ts +1 -1
- package/dist/esm/types/components/Popover/Popover.d.ts +1 -1
- package/dist/esm/types/hooks/usePopupPosition.d.ts +1 -2
- package/dist/esm/types/types/datepicker.d.ts +0 -2
- package/dist/esm/types/types/dropdown.d.ts +0 -1
- package/dist/esm/types/types/popover.d.ts +0 -1
- package/dist/index.esm.js +11 -20
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +11 -20
- package/dist/index.js.map +1 -1
- package/lib/components/DatePicker/RangePicker/RangePicker.tsx +0 -2
- package/lib/components/DatePicker/TimePicker/TimePicker.tsx +0 -2
- package/lib/components/Dropdown/Dropdown.tsx +0 -2
- package/lib/components/Popover/Popover.tsx +0 -2
- package/lib/hooks/usePopupPosition.ts +9 -11
- package/lib/types/datepicker.ts +0 -2
- package/lib/types/dropdown.ts +0 -1
- package/lib/types/popover.ts +0 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TRangePickerProps } from '../../../types/datepicker';
|
|
3
3
|
import './style.css';
|
|
4
|
-
declare const RangePicker: ({ prefixCls, value, onChange, placeholder, disabled, error, format, prefix, allowClear, inputReadOnly, size, picker, locale, disabledDate, onVisibleChange, onCalendarChange, style, className, separator, defaultValue, bordered, getPopupContainer, placement,
|
|
4
|
+
declare const RangePicker: ({ prefixCls, value, onChange, placeholder, disabled, error, format, prefix, allowClear, inputReadOnly, size, picker, locale, disabledDate, onVisibleChange, onCalendarChange, style, className, separator, defaultValue, bordered, getPopupContainer, placement, }: TRangePickerProps) => React.JSX.Element;
|
|
5
5
|
export default RangePicker;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DropdownProps } from '../../types/dropdown';
|
|
3
3
|
import './style.css';
|
|
4
|
-
declare const Dropdown: ({ children, menu, open: controlledOpen, defaultOpen, onVisibleChange, trigger, placement, overlayClassName, overlayStyle, getPopupContainer, destroyOnHidden, disabled, arrow, autoFocus, popupRender, className, overlay, prefixCls,
|
|
4
|
+
declare const Dropdown: ({ children, menu, open: controlledOpen, defaultOpen, onVisibleChange, trigger, placement, overlayClassName, overlayStyle, getPopupContainer, destroyOnHidden, disabled, arrow, autoFocus, popupRender, className, overlay, prefixCls, }: DropdownProps) => React.JSX.Element;
|
|
5
5
|
export default Dropdown;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { PopoverProps } from "../../types/popover";
|
|
3
3
|
import './style.css';
|
|
4
|
-
declare const Popover: ({ prefixCls, content, children, trigger, placement, open, visible, title, style, overlayClassName, overlayStyle,
|
|
4
|
+
declare const Popover: ({ prefixCls, content, children, trigger, placement, open, visible, title, style, overlayClassName, overlayStyle, onVisibleChange, getPopupContainer }: PopoverProps) => React.JSX.Element;
|
|
5
5
|
export default Popover;
|
|
@@ -7,9 +7,8 @@ type TPopupPosition = {
|
|
|
7
7
|
popupRef: RefObject<HTMLDivElement | null>;
|
|
8
8
|
placement?: Placement;
|
|
9
9
|
popupContainer?: HTMLElement | null;
|
|
10
|
-
showInnerContent?: boolean;
|
|
11
10
|
};
|
|
12
|
-
export declare const usePopupPosition: ({ open, setOpen, popupRef, targetRef, placement, popupContainer,
|
|
11
|
+
export declare const usePopupPosition: ({ open, setOpen, popupRef, targetRef, placement, popupContainer, }: TPopupPosition) => {
|
|
13
12
|
_placement: Placement;
|
|
14
13
|
popupStyle: CSSProperties;
|
|
15
14
|
};
|
|
@@ -40,7 +40,6 @@ export type TDatePickerProps = DefaultProps & {
|
|
|
40
40
|
picker?: PanelMode;
|
|
41
41
|
bordered?: boolean;
|
|
42
42
|
defaultPickerValue?: Date;
|
|
43
|
-
showInnerContent?: boolean;
|
|
44
43
|
};
|
|
45
44
|
export type TRangePickerProps = Omit<TDatePickerProps, 'placeholder' | 'value' | 'defaultValue'> & {
|
|
46
45
|
placeholder?: string[];
|
|
@@ -120,5 +119,4 @@ export type TimePickerProps = DefaultProps & {
|
|
|
120
119
|
suffixIcon?: ReactNode;
|
|
121
120
|
placeholder?: string;
|
|
122
121
|
placement?: Placement;
|
|
123
|
-
showInnerContent?: boolean;
|
|
124
122
|
};
|
|
@@ -28,7 +28,6 @@ export type DropdownProps = DefaultProps & {
|
|
|
28
28
|
autoAdjustOverflow?: boolean;
|
|
29
29
|
popupRender?: (node: ReactNode) => ReactNode;
|
|
30
30
|
overlay?: ReactElement | OverlayFunc;
|
|
31
|
-
showInnerContent?: boolean;
|
|
32
31
|
};
|
|
33
32
|
export type DropdownMenuInnerProps = DefaultProps & {
|
|
34
33
|
items: DropdownItemType[];
|
|
@@ -12,7 +12,6 @@ export type PopoverProps = DefaultProps & {
|
|
|
12
12
|
visible?: boolean;
|
|
13
13
|
listenPopoverPositions?: CSSProperties;
|
|
14
14
|
placementPositionOffset?: number;
|
|
15
|
-
showInnerContent?: boolean;
|
|
16
15
|
onVisibleChange?: ((open: boolean) => void) | undefined;
|
|
17
16
|
getPopupContainer?: ((node: HTMLElement) => HTMLElement) | undefined;
|
|
18
17
|
};
|
package/dist/index.esm.js
CHANGED
|
@@ -2626,8 +2626,7 @@ const usePopupPosition = ({
|
|
|
2626
2626
|
popupRef,
|
|
2627
2627
|
targetRef,
|
|
2628
2628
|
placement,
|
|
2629
|
-
popupContainer
|
|
2630
|
-
showInnerContent
|
|
2629
|
+
popupContainer
|
|
2631
2630
|
}) => {
|
|
2632
2631
|
const [_placement, _setPlacement] = useState(placement ?? "bottomLeft");
|
|
2633
2632
|
const [popupPosition, setPopupPosition] = useState({});
|
|
@@ -2658,6 +2657,7 @@ const usePopupPosition = ({
|
|
|
2658
2657
|
if (e?.target === scrollableParents && inBody) {
|
|
2659
2658
|
setOpen(false);
|
|
2660
2659
|
setPopupPosition({});
|
|
2660
|
+
_setPlacement(placement ?? "bottomLeft");
|
|
2661
2661
|
return;
|
|
2662
2662
|
}
|
|
2663
2663
|
const popupRect = popupRef.current?.getBoundingClientRect();
|
|
@@ -2697,13 +2697,11 @@ const usePopupPosition = ({
|
|
|
2697
2697
|
newPlacement = newPlacement.replace('Left', 'Right');
|
|
2698
2698
|
}
|
|
2699
2699
|
}
|
|
2700
|
-
if (
|
|
2701
|
-
if (
|
|
2700
|
+
if (availableSpace.right < 0 && availableSpace.left < 0) {
|
|
2701
|
+
if (newPlacement.includes('Left') || newPlacement.includes('Right')) {
|
|
2702
2702
|
const popupWidth = popupRect.width;
|
|
2703
2703
|
const targetWidth = container.width;
|
|
2704
|
-
if (!popupContainer) {
|
|
2705
|
-
positions.left = positions.left - popupWidth / 2 + targetWidth / 2;
|
|
2706
|
-
} else if (_containsElement) {
|
|
2704
|
+
if (!popupContainer || _containsElement) {
|
|
2707
2705
|
positions.left = positions.left - popupWidth / 2 + targetWidth / 2;
|
|
2708
2706
|
} else if (inBody) {
|
|
2709
2707
|
positions.left = container.left + window.scrollX + targetWidth / 2 - popupWidth / 2;
|
|
@@ -2770,7 +2768,7 @@ const usePopupPosition = ({
|
|
|
2770
2768
|
}
|
|
2771
2769
|
};
|
|
2772
2770
|
_calculation();
|
|
2773
|
-
}, [targetRef, popupContainer, popupRef,
|
|
2771
|
+
}, [targetRef, popupContainer, popupRef, placement, inBody, _placement, setOpen]);
|
|
2774
2772
|
useEffect(() => {
|
|
2775
2773
|
if (!open) {
|
|
2776
2774
|
return;
|
|
@@ -2790,8 +2788,9 @@ const usePopupPosition = ({
|
|
|
2790
2788
|
return () => {
|
|
2791
2789
|
controller.abort();
|
|
2792
2790
|
setPopupPosition({});
|
|
2791
|
+
_setPlacement(placement ?? "bottomLeft");
|
|
2793
2792
|
};
|
|
2794
|
-
}, [open, targetRef, calculatePosition]);
|
|
2793
|
+
}, [open, targetRef, placement, calculatePosition]);
|
|
2795
2794
|
return {
|
|
2796
2795
|
_placement,
|
|
2797
2796
|
popupStyle: {
|
|
@@ -3178,8 +3177,7 @@ const RangePicker = ({
|
|
|
3178
3177
|
defaultValue,
|
|
3179
3178
|
bordered = true,
|
|
3180
3179
|
getPopupContainer,
|
|
3181
|
-
placement = "bottomLeft"
|
|
3182
|
-
showInnerContent
|
|
3180
|
+
placement = "bottomLeft"
|
|
3183
3181
|
}) => {
|
|
3184
3182
|
const [isOpen, setIsOpen] = useState(false);
|
|
3185
3183
|
const [selectedDates, setSelectedDates] = useState([value?.[0] || defaultValue?.[0] || null, value?.[1] || defaultValue?.[1] || null]);
|
|
@@ -3200,7 +3198,6 @@ const RangePicker = ({
|
|
|
3200
3198
|
popupRef,
|
|
3201
3199
|
placement,
|
|
3202
3200
|
open: isOpen,
|
|
3203
|
-
showInnerContent,
|
|
3204
3201
|
setOpen: setIsOpen,
|
|
3205
3202
|
popupContainer: getPopupContainer?.(targetRef.current)
|
|
3206
3203
|
});
|
|
@@ -3502,8 +3499,7 @@ const TimePicker = ({
|
|
|
3502
3499
|
suffixIcon = /*#__PURE__*/React.createElement(TimeIcon, null),
|
|
3503
3500
|
placeholder = 'Select time',
|
|
3504
3501
|
getPopupContainer,
|
|
3505
|
-
placement = "bottomLeft"
|
|
3506
|
-
showInnerContent
|
|
3502
|
+
placement = "bottomLeft"
|
|
3507
3503
|
}) => {
|
|
3508
3504
|
const [open, setOpen] = useState(false);
|
|
3509
3505
|
const [innerValue, setInnerValue] = useState(propValue || defaultValue ? new Date(propValue || defaultValue) : null);
|
|
@@ -3522,7 +3518,6 @@ const TimePicker = ({
|
|
|
3522
3518
|
popupRef,
|
|
3523
3519
|
placement,
|
|
3524
3520
|
targetRef,
|
|
3525
|
-
showInnerContent,
|
|
3526
3521
|
setOpen: setOpen,
|
|
3527
3522
|
popupContainer: getPopupContainer?.(targetRef.current)
|
|
3528
3523
|
});
|
|
@@ -5486,8 +5481,7 @@ const Dropdown = ({
|
|
|
5486
5481
|
popupRender,
|
|
5487
5482
|
className = '',
|
|
5488
5483
|
overlay,
|
|
5489
|
-
prefixCls = prefixClsDropdown
|
|
5490
|
-
showInnerContent
|
|
5484
|
+
prefixCls = prefixClsDropdown
|
|
5491
5485
|
}) => {
|
|
5492
5486
|
const [open, setOpen] = useState(controlledOpen ?? defaultOpen);
|
|
5493
5487
|
const isControlled = controlledOpen !== undefined;
|
|
@@ -5503,7 +5497,6 @@ const Dropdown = ({
|
|
|
5503
5497
|
popupRef,
|
|
5504
5498
|
targetRef,
|
|
5505
5499
|
placement,
|
|
5506
|
-
showInnerContent,
|
|
5507
5500
|
popupContainer: getPopupContainer?.(targetRef.current)
|
|
5508
5501
|
});
|
|
5509
5502
|
useEffect(() => {
|
|
@@ -5655,7 +5648,6 @@ const Popover = ({
|
|
|
5655
5648
|
style = {},
|
|
5656
5649
|
overlayClassName = '',
|
|
5657
5650
|
overlayStyle = {},
|
|
5658
|
-
showInnerContent,
|
|
5659
5651
|
onVisibleChange,
|
|
5660
5652
|
getPopupContainer
|
|
5661
5653
|
}) => {
|
|
@@ -5671,7 +5663,6 @@ const Popover = ({
|
|
|
5671
5663
|
popupRef,
|
|
5672
5664
|
placement,
|
|
5673
5665
|
open: isOpen,
|
|
5674
|
-
showInnerContent,
|
|
5675
5666
|
setOpen: setInnerOpen,
|
|
5676
5667
|
popupContainer: getPopupContainer?.(targetRef.current)
|
|
5677
5668
|
});
|