x-ui-design 0.8.62 → 0.8.64
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 +16 -15
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +16 -15
- package/dist/index.js.map +1 -1
- package/lib/components/DatePicker/TimePicker/TimePicker.tsx +7 -7
- package/lib/components/Dropdown/Dropdown.tsx +10 -9
- package/lib/components/Menu/Menu.tsx +3 -0
- package/package.json +1 -1
- package/src/app/page.tsx +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -3367,7 +3367,7 @@ const TimePicker = ({
|
|
|
3367
3367
|
const [innerValue, setInnerValue] = useState(propValue || defaultValue ? new Date(propValue || defaultValue) : null);
|
|
3368
3368
|
const [[showHour, showMinutes, showSeconds]] = useState(`${format}`.split(':'));
|
|
3369
3369
|
const [tempValue, setTempValue] = useState(null);
|
|
3370
|
-
const
|
|
3370
|
+
const triggerRef = useRef(null);
|
|
3371
3371
|
const popupRef = useRef(null);
|
|
3372
3372
|
const hourRef = useRef(null);
|
|
3373
3373
|
const minuteRef = useRef(null);
|
|
@@ -3378,15 +3378,15 @@ const TimePicker = ({
|
|
|
3378
3378
|
popupRef,
|
|
3379
3379
|
placement,
|
|
3380
3380
|
isOpen: open,
|
|
3381
|
-
triggerRef:
|
|
3382
|
-
getPopupContainer: getPopupContainer?.(
|
|
3381
|
+
triggerRef: triggerRef,
|
|
3382
|
+
getPopupContainer: getPopupContainer?.(triggerRef.current)
|
|
3383
3383
|
});
|
|
3384
3384
|
useEffect(() => {
|
|
3385
3385
|
setInnerValue(propValue || defaultValue ? new Date(propValue || defaultValue) : null);
|
|
3386
3386
|
}, [propValue]);
|
|
3387
3387
|
useEffect(() => {
|
|
3388
3388
|
const handleClickOutside = e => {
|
|
3389
|
-
if (popupRef.current && !popupRef.current.contains(e.target) &&
|
|
3389
|
+
if (popupRef.current && !popupRef.current.contains(e.target) && triggerRef.current && !triggerRef.current.contains(e.target)) {
|
|
3390
3390
|
setOpen(false);
|
|
3391
3391
|
setTempValue(null);
|
|
3392
3392
|
if (!innerValue) {
|
|
@@ -3635,7 +3635,7 @@ const TimePicker = ({
|
|
|
3635
3635
|
className: `${prefixCls}-input-wrapper`,
|
|
3636
3636
|
onClick: () => setOpen(true)
|
|
3637
3637
|
}, /*#__PURE__*/React.createElement("input", {
|
|
3638
|
-
ref:
|
|
3638
|
+
ref: triggerRef,
|
|
3639
3639
|
size: INPUT_SIZE,
|
|
3640
3640
|
placeholder: placeholder,
|
|
3641
3641
|
className: `${prefixCls}-input`,
|
|
@@ -3662,7 +3662,7 @@ const TimePicker = ({
|
|
|
3662
3662
|
}
|
|
3663
3663
|
}, suffixIcon))), open && /*#__PURE__*/React.createElement(ConditionalWrapper, {
|
|
3664
3664
|
condition: getPopupContainer !== undefined,
|
|
3665
|
-
wrapper: element => getPopupContainer ? /*#__PURE__*/createPortal(element, getPopupContainer(
|
|
3665
|
+
wrapper: element => getPopupContainer ? /*#__PURE__*/createPortal(element, getPopupContainer(triggerRef.current)) : /*#__PURE__*/React.createElement(React.Fragment, null, element)
|
|
3666
3666
|
}, /*#__PURE__*/React.createElement("div", {
|
|
3667
3667
|
ref: popupRef,
|
|
3668
3668
|
style: dropdownPosition,
|
|
@@ -5187,6 +5187,8 @@ const Menu = ({
|
|
|
5187
5187
|
});
|
|
5188
5188
|
}, [openKeysProp, hasInteracted, _triggerSubMenuActionClick]);
|
|
5189
5189
|
const onItemClick = useCallback((key, domEvent) => {
|
|
5190
|
+
domEvent?.preventDefault();
|
|
5191
|
+
domEvent?.stopPropagation();
|
|
5190
5192
|
if (!selectable) {
|
|
5191
5193
|
return;
|
|
5192
5194
|
}
|
|
@@ -5395,8 +5397,7 @@ const Dropdown = ({
|
|
|
5395
5397
|
const onTriggerClick = e => {
|
|
5396
5398
|
e.preventDefault();
|
|
5397
5399
|
e.stopPropagation();
|
|
5398
|
-
|
|
5399
|
-
if (triggerRef.current && triggers.includes('click')) {
|
|
5400
|
+
if (triggers.includes('click') && triggerRef.current && !open && triggerRef.current?.contains(e.target)) {
|
|
5400
5401
|
setOpenInternal(!open);
|
|
5401
5402
|
}
|
|
5402
5403
|
};
|
|
@@ -5412,8 +5413,12 @@ const Dropdown = ({
|
|
|
5412
5413
|
};
|
|
5413
5414
|
const popup = /*#__PURE__*/React.createElement(ConditionalWrapper, {
|
|
5414
5415
|
condition: getPopupContainer !== undefined,
|
|
5415
|
-
wrapper: element => getPopupContainer ? /*#__PURE__*/createPortal(element, getPopupContainer(
|
|
5416
|
-
}, /*#__PURE__*/React.createElement(
|
|
5416
|
+
wrapper: element => getPopupContainer ? /*#__PURE__*/createPortal(element, getPopupContainer(popupRef.current)) : /*#__PURE__*/React.createElement(React.Fragment, null, element)
|
|
5417
|
+
}, /*#__PURE__*/React.createElement(React.Fragment, null, console.log({
|
|
5418
|
+
zIndex: 10000,
|
|
5419
|
+
...overlayStyle,
|
|
5420
|
+
...dropdownPosition
|
|
5421
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
5417
5422
|
ref: popupRef,
|
|
5418
5423
|
className: `${prefixCls}-overlay ${prefixCls}-${placement} ${overlayClassName}`,
|
|
5419
5424
|
style: {
|
|
@@ -5441,11 +5446,7 @@ const Dropdown = ({
|
|
|
5441
5446
|
style: {
|
|
5442
5447
|
padding: 8
|
|
5443
5448
|
}
|
|
5444
|
-
}, "Empty menu")));
|
|
5445
|
-
console.log({
|
|
5446
|
-
open,
|
|
5447
|
-
popup
|
|
5448
|
-
});
|
|
5449
|
+
}, "Empty menu"))));
|
|
5449
5450
|
return /*#__PURE__*/React.createElement("div", {
|
|
5450
5451
|
ref: triggerRef,
|
|
5451
5452
|
className: className,
|