x-ui-design 0.9.36 → 0.9.37
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 +2 -1
- package/dist/esm/types/types/datepicker.d.ts +2 -0
- package/dist/esm/types/types/dropdown.d.ts +1 -0
- package/dist/esm/types/types/popover.d.ts +1 -0
- package/dist/index.esm.js +27 -18
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +27 -18
- package/dist/index.js.map +1 -1
- package/lib/components/DatePicker/RangePicker/RangePicker.tsx +3 -1
- package/lib/components/DatePicker/TimePicker/TimePicker.tsx +3 -1
- package/lib/components/Dropdown/Dropdown.tsx +4 -2
- package/lib/components/Popover/Popover.tsx +2 -2
- package/lib/helpers/index.ts +0 -2
- package/lib/hooks/usePopupPosition.ts +15 -11
- package/lib/types/datepicker.ts +2 -0
- package/lib/types/dropdown.ts +1 -1
- package/lib/types/popover.ts +1 -0
- package/package.json +1 -1
- package/dist/esm/types/hooks/usePosition.d.ts +0 -18
- package/lib/hooks/usePosition.ts +0 -203
|
@@ -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 }: TRangePickerProps) => React.JSX.Element;
|
|
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, showInnerContent }: 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, }: DropdownProps) => React.JSX.Element;
|
|
4
|
+
declare const Dropdown: ({ children, menu, open: controlledOpen, defaultOpen, onVisibleChange, trigger, placement, overlayClassName, overlayStyle, getPopupContainer, destroyOnHidden, disabled, arrow, autoFocus, popupRender, className, overlay, prefixCls, showInnerContent }: 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, showInnerContent, onVisibleChange, getPopupContainer }: PopoverProps) => React.JSX.Element;
|
|
5
5
|
export default Popover;
|
|
@@ -7,8 +7,9 @@ type TPopupPosition = {
|
|
|
7
7
|
popupRef: RefObject<HTMLDivElement | null>;
|
|
8
8
|
placement?: Placement;
|
|
9
9
|
popupContainer?: HTMLElement | null;
|
|
10
|
+
showInnerContent?: boolean;
|
|
10
11
|
};
|
|
11
|
-
export declare const usePopupPosition: ({ open, setOpen, popupRef, targetRef, placement, popupContainer, }: TPopupPosition) => {
|
|
12
|
+
export declare const usePopupPosition: ({ open, setOpen, popupRef, targetRef, placement, popupContainer, showInnerContent }: TPopupPosition) => {
|
|
12
13
|
_placement: Placement;
|
|
13
14
|
popupStyle: CSSProperties;
|
|
14
15
|
};
|
|
@@ -40,6 +40,7 @@ export type TDatePickerProps = DefaultProps & {
|
|
|
40
40
|
picker?: PanelMode;
|
|
41
41
|
bordered?: boolean;
|
|
42
42
|
defaultPickerValue?: Date;
|
|
43
|
+
showInnerContent?: boolean;
|
|
43
44
|
};
|
|
44
45
|
export type TRangePickerProps = Omit<TDatePickerProps, 'placeholder' | 'value' | 'defaultValue'> & {
|
|
45
46
|
placeholder?: string[];
|
|
@@ -119,4 +120,5 @@ export type TimePickerProps = DefaultProps & {
|
|
|
119
120
|
suffixIcon?: ReactNode;
|
|
120
121
|
placeholder?: string;
|
|
121
122
|
placement?: Placement;
|
|
123
|
+
showInnerContent?: boolean;
|
|
122
124
|
};
|
|
@@ -28,6 +28,7 @@ export type DropdownProps = DefaultProps & {
|
|
|
28
28
|
autoAdjustOverflow?: boolean;
|
|
29
29
|
popupRender?: (node: ReactNode) => ReactNode;
|
|
30
30
|
overlay?: ReactElement | OverlayFunc;
|
|
31
|
+
showInnerContent?: boolean;
|
|
31
32
|
};
|
|
32
33
|
export type DropdownMenuInnerProps = DefaultProps & {
|
|
33
34
|
items: DropdownItemType[];
|
|
@@ -12,6 +12,7 @@ export type PopoverProps = DefaultProps & {
|
|
|
12
12
|
visible?: boolean;
|
|
13
13
|
listenPopoverPositions?: CSSProperties;
|
|
14
14
|
placementPositionOffset?: number;
|
|
15
|
+
showInnerContent?: boolean;
|
|
15
16
|
onVisibleChange?: ((open: boolean) => void) | undefined;
|
|
16
17
|
getPopupContainer?: ((node: HTMLElement) => HTMLElement) | undefined;
|
|
17
18
|
};
|
package/dist/index.esm.js
CHANGED
|
@@ -2618,14 +2618,15 @@ const ConditionalWrapper = ({
|
|
|
2618
2618
|
children
|
|
2619
2619
|
}) => condition ? wrapper(children) : children;
|
|
2620
2620
|
|
|
2621
|
-
const OFFSET =
|
|
2621
|
+
const OFFSET = 11;
|
|
2622
2622
|
const usePopupPosition = ({
|
|
2623
2623
|
open,
|
|
2624
2624
|
setOpen,
|
|
2625
2625
|
popupRef,
|
|
2626
2626
|
targetRef,
|
|
2627
2627
|
placement,
|
|
2628
|
-
popupContainer
|
|
2628
|
+
popupContainer,
|
|
2629
|
+
showInnerContent
|
|
2629
2630
|
}) => {
|
|
2630
2631
|
const [_placement, _setPlacement] = useState(placement ?? "bottomLeft");
|
|
2631
2632
|
const [popupPosition, setPopupPosition] = useState({});
|
|
@@ -2686,14 +2687,16 @@ const usePopupPosition = ({
|
|
|
2686
2687
|
} else if (availableSpace.right < 0 && availableSpace.left > 0 && availableSpace.left > popupRect.width) {
|
|
2687
2688
|
newPlacement = newPlacement.replace('Left', 'Right');
|
|
2688
2689
|
}
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2690
|
+
if (showInnerContent) {
|
|
2691
|
+
if (availableSpace.right < 0 && availableSpace.left < 0) {
|
|
2692
|
+
if (newPlacement.includes('Right')) {
|
|
2693
|
+
positions.left = popupRect.width - positions.left + container.left;
|
|
2694
|
+
}
|
|
2695
|
+
if (newPlacement.includes('Left')) {
|
|
2696
|
+
positions.left = positions.left - popupRect.width + container.width;
|
|
2697
|
+
}
|
|
2698
|
+
}
|
|
2699
|
+
}
|
|
2697
2700
|
_setPlacement(newPlacement);
|
|
2698
2701
|
}
|
|
2699
2702
|
const _calculation = () => {
|
|
@@ -2737,7 +2740,7 @@ const usePopupPosition = ({
|
|
|
2737
2740
|
}
|
|
2738
2741
|
};
|
|
2739
2742
|
_calculation();
|
|
2740
|
-
}, [targetRef, popupContainer, popupRef, inBody, _placement, setOpen]);
|
|
2743
|
+
}, [targetRef, popupContainer, popupRef, showInnerContent, inBody, _placement, setOpen]);
|
|
2741
2744
|
useEffect(() => {
|
|
2742
2745
|
if (!open) {
|
|
2743
2746
|
return;
|
|
@@ -3145,7 +3148,8 @@ const RangePicker = ({
|
|
|
3145
3148
|
defaultValue,
|
|
3146
3149
|
bordered = true,
|
|
3147
3150
|
getPopupContainer,
|
|
3148
|
-
placement = "bottomLeft"
|
|
3151
|
+
placement = "bottomLeft",
|
|
3152
|
+
showInnerContent
|
|
3149
3153
|
}) => {
|
|
3150
3154
|
const [isOpen, setIsOpen] = useState(false);
|
|
3151
3155
|
const [selectedDates, setSelectedDates] = useState([value?.[0] || defaultValue?.[0] || null, value?.[1] || defaultValue?.[1] || null]);
|
|
@@ -3166,6 +3170,7 @@ const RangePicker = ({
|
|
|
3166
3170
|
popupRef,
|
|
3167
3171
|
placement,
|
|
3168
3172
|
open: isOpen,
|
|
3173
|
+
showInnerContent,
|
|
3169
3174
|
setOpen: setIsOpen,
|
|
3170
3175
|
popupContainer: getPopupContainer?.(targetRef.current)
|
|
3171
3176
|
});
|
|
@@ -3467,7 +3472,8 @@ const TimePicker = ({
|
|
|
3467
3472
|
suffixIcon = /*#__PURE__*/React.createElement(TimeIcon, null),
|
|
3468
3473
|
placeholder = 'Select time',
|
|
3469
3474
|
getPopupContainer,
|
|
3470
|
-
placement = "bottomLeft"
|
|
3475
|
+
placement = "bottomLeft",
|
|
3476
|
+
showInnerContent
|
|
3471
3477
|
}) => {
|
|
3472
3478
|
const [open, setOpen] = useState(false);
|
|
3473
3479
|
const [innerValue, setInnerValue] = useState(propValue || defaultValue ? new Date(propValue || defaultValue) : null);
|
|
@@ -3486,6 +3492,7 @@ const TimePicker = ({
|
|
|
3486
3492
|
popupRef,
|
|
3487
3493
|
placement,
|
|
3488
3494
|
targetRef,
|
|
3495
|
+
showInnerContent,
|
|
3489
3496
|
setOpen: setOpen,
|
|
3490
3497
|
popupContainer: getPopupContainer?.(targetRef.current)
|
|
3491
3498
|
});
|
|
@@ -5449,7 +5456,8 @@ const Dropdown = ({
|
|
|
5449
5456
|
popupRender,
|
|
5450
5457
|
className = '',
|
|
5451
5458
|
overlay,
|
|
5452
|
-
prefixCls = prefixClsDropdown
|
|
5459
|
+
prefixCls = prefixClsDropdown,
|
|
5460
|
+
showInnerContent
|
|
5453
5461
|
}) => {
|
|
5454
5462
|
const [open, setOpen] = useState(controlledOpen ?? defaultOpen);
|
|
5455
5463
|
const isControlled = controlledOpen !== undefined;
|
|
@@ -5461,10 +5469,11 @@ const Dropdown = ({
|
|
|
5461
5469
|
_placement
|
|
5462
5470
|
} = usePopupPosition({
|
|
5463
5471
|
open,
|
|
5464
|
-
|
|
5472
|
+
setOpen,
|
|
5465
5473
|
popupRef,
|
|
5474
|
+
targetRef,
|
|
5466
5475
|
placement,
|
|
5467
|
-
|
|
5476
|
+
showInnerContent,
|
|
5468
5477
|
popupContainer: getPopupContainer?.(targetRef.current)
|
|
5469
5478
|
});
|
|
5470
5479
|
useEffect(() => {
|
|
@@ -5616,8 +5625,7 @@ const Popover = ({
|
|
|
5616
5625
|
style = {},
|
|
5617
5626
|
overlayClassName = '',
|
|
5618
5627
|
overlayStyle = {},
|
|
5619
|
-
|
|
5620
|
-
placementPositionOffset,
|
|
5628
|
+
showInnerContent,
|
|
5621
5629
|
onVisibleChange,
|
|
5622
5630
|
getPopupContainer
|
|
5623
5631
|
}) => {
|
|
@@ -5633,6 +5641,7 @@ const Popover = ({
|
|
|
5633
5641
|
popupRef,
|
|
5634
5642
|
placement,
|
|
5635
5643
|
open: isOpen,
|
|
5644
|
+
showInnerContent,
|
|
5636
5645
|
setOpen: setInnerOpen,
|
|
5637
5646
|
popupContainer: getPopupContainer?.(targetRef.current)
|
|
5638
5647
|
});
|