@canlooks/can-ui 0.0.20 → 0.0.21
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.
|
@@ -48,8 +48,8 @@ exports.Popper = (0, react_1.forwardRef)(({ popperRef, anchorElement, container
|
|
|
48
48
|
if (openState || !openHolding.current) {
|
|
49
49
|
// 需要openHolding为false时才能关闭
|
|
50
50
|
_setInnerOpen(openState);
|
|
51
|
+
setContextMenuEvent(contextMenuEvent);
|
|
51
52
|
}
|
|
52
|
-
setContextMenuEvent(contextMenuEvent);
|
|
53
53
|
};
|
|
54
54
|
const renderedOnce = (0, react_1.useRef)(!!forceRender);
|
|
55
55
|
if (innerOpen.current) {
|
|
@@ -401,7 +401,11 @@ exports.Popper = (0, react_1.forwardRef)(({ popperRef, anchorElement, container
|
|
|
401
401
|
const contextValue = (0, react_1.useMemo)(() => ({
|
|
402
402
|
autoClose,
|
|
403
403
|
open: innerOpen.current,
|
|
404
|
-
setOpen
|
|
404
|
+
setOpen(open) {
|
|
405
|
+
// 通过context改变的open状态,需要强制将openHolding置为false
|
|
406
|
+
openHolding.current = false;
|
|
407
|
+
setInnerOpen(open);
|
|
408
|
+
},
|
|
405
409
|
beforeOpenCallbacks: beforeOpenCallbacks.current
|
|
406
410
|
}), [innerOpen.current, autoClose]);
|
|
407
411
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, react_1.isValidElement)(children)
|
|
@@ -45,8 +45,8 @@ export const Popper = forwardRef(({ popperRef, anchorElement, container = docume
|
|
|
45
45
|
if (openState || !openHolding.current) {
|
|
46
46
|
// 需要openHolding为false时才能关闭
|
|
47
47
|
_setInnerOpen(openState);
|
|
48
|
+
setContextMenuEvent(contextMenuEvent);
|
|
48
49
|
}
|
|
49
|
-
setContextMenuEvent(contextMenuEvent);
|
|
50
50
|
};
|
|
51
51
|
const renderedOnce = useRef(!!forceRender);
|
|
52
52
|
if (innerOpen.current) {
|
|
@@ -398,7 +398,11 @@ export const Popper = forwardRef(({ popperRef, anchorElement, container = docume
|
|
|
398
398
|
const contextValue = useMemo(() => ({
|
|
399
399
|
autoClose,
|
|
400
400
|
open: innerOpen.current,
|
|
401
|
-
setOpen
|
|
401
|
+
setOpen(open) {
|
|
402
|
+
// 通过context改变的open状态,需要强制将openHolding置为false
|
|
403
|
+
openHolding.current = false;
|
|
404
|
+
setInnerOpen(open);
|
|
405
|
+
},
|
|
402
406
|
beforeOpenCallbacks: beforeOpenCallbacks.current
|
|
403
407
|
}), [innerOpen.current, autoClose]);
|
|
404
408
|
return (_jsxs(_Fragment, { children: [isValidElement(children)
|