@uiw/react-overlay-trigger
Advanced tools
Comparing version 4.1.2 to 4.2.0
@@ -21,3 +21,5 @@ import React from 'react'; | ||
show: boolean; | ||
trigger: OverlayTriggerProps['trigger']; | ||
overlayStyl: OverlayStyl; | ||
transitionName: OverlayProps['transitionName']; | ||
} | ||
@@ -46,2 +48,6 @@ export declare type Delay = number | { | ||
componentDidUpdate(prevProps: OverlayTriggerProps): void; | ||
/** | ||
* Trigger value change prohibits animation transition effect | ||
*/ | ||
static getDerivedStateFromProps(props: OverlayTriggerProps, state: OverlayTriggerState): OverlayTriggerState; | ||
componentDidMount(): void; | ||
@@ -48,0 +54,0 @@ componentWillUnmount(): void; |
@@ -83,5 +83,3 @@ "use strict"; | ||
(0, _classCallCheck2.default)(this, OverlayTrigger); | ||
_this = _super.call(this, props); // this.trigger = React.createRef(); | ||
// this.popup = React.createRef(); | ||
_this = _super.call(this, props); | ||
_this.state = void 0; | ||
@@ -204,2 +202,4 @@ _this.trigger = /*#__PURE__*/_react.default.createRef(); | ||
show: !!props.isOpen, | ||
trigger: props.trigger, | ||
transitionName: props.transitionName, | ||
overlayStyl: { | ||
@@ -215,7 +215,14 @@ placement: props.placement | ||
value: function componentDidUpdate(prevProps) { | ||
if (prevProps.isOpen !== this.props.isOpen) { | ||
var isOpen = !!this.props.isOpen; | ||
isOpen ? this.show() : this.hide(); | ||
if (this.props.isOpen !== this.state.show && prevProps.isOpen !== this.props.isOpen) { | ||
this.props.isOpen ? this.show() : this.hide(); | ||
} | ||
if (this.props.trigger !== prevProps.trigger) { | ||
this.hide(); | ||
} | ||
} | ||
/** | ||
* Trigger value change prohibits animation transition effect | ||
*/ | ||
}, { | ||
@@ -502,2 +509,3 @@ key: "componentDidMount", | ||
usePortal: usePortal, | ||
transitionName: this.state.transitionName, | ||
isOpen: this.state.show, | ||
@@ -511,2 +519,15 @@ hasBackdrop: false | ||
} | ||
}], [{ | ||
key: "getDerivedStateFromProps", | ||
value: function getDerivedStateFromProps(props, state) { | ||
if (props.trigger !== state.trigger) { | ||
state.trigger = props.trigger; | ||
state.show = !!props.isOpen; | ||
state.transitionName = '-'; | ||
} else { | ||
state.transitionName = props.transitionName; | ||
} | ||
return state; | ||
} | ||
}]); | ||
@@ -513,0 +534,0 @@ return OverlayTrigger; |
@@ -21,3 +21,5 @@ import React from 'react'; | ||
show: boolean; | ||
trigger: OverlayTriggerProps['trigger']; | ||
overlayStyl: OverlayStyl; | ||
transitionName: OverlayProps['transitionName']; | ||
} | ||
@@ -46,2 +48,6 @@ export declare type Delay = number | { | ||
componentDidUpdate(prevProps: OverlayTriggerProps): void; | ||
/** | ||
* Trigger value change prohibits animation transition effect | ||
*/ | ||
static getDerivedStateFromProps(props: OverlayTriggerProps, state: OverlayTriggerState): OverlayTriggerState; | ||
componentDidMount(): void; | ||
@@ -48,0 +54,0 @@ componentWillUnmount(): void; |
@@ -58,5 +58,3 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
_this = _super.call(this, props); // this.trigger = React.createRef(); | ||
// this.popup = React.createRef(); | ||
_this = _super.call(this, props); | ||
_this.state = void 0; | ||
@@ -179,2 +177,4 @@ _this.trigger = /*#__PURE__*/React.createRef(); | ||
show: !!props.isOpen, | ||
trigger: props.trigger, | ||
transitionName: props.transitionName, | ||
overlayStyl: { | ||
@@ -190,7 +190,14 @@ placement: props.placement | ||
value: function componentDidUpdate(prevProps) { | ||
if (prevProps.isOpen !== this.props.isOpen) { | ||
var isOpen = !!this.props.isOpen; | ||
isOpen ? this.show() : this.hide(); | ||
if (this.props.isOpen !== this.state.show && prevProps.isOpen !== this.props.isOpen) { | ||
this.props.isOpen ? this.show() : this.hide(); | ||
} | ||
if (this.props.trigger !== prevProps.trigger) { | ||
this.hide(); | ||
} | ||
} | ||
/** | ||
* Trigger value change prohibits animation transition effect | ||
*/ | ||
}, { | ||
@@ -478,2 +485,3 @@ key: "componentDidMount", | ||
usePortal: usePortal, | ||
transitionName: this.state.transitionName, | ||
isOpen: this.state.show, | ||
@@ -487,2 +495,15 @@ hasBackdrop: false | ||
} | ||
}], [{ | ||
key: "getDerivedStateFromProps", | ||
value: function getDerivedStateFromProps(props, state) { | ||
if (props.trigger !== state.trigger) { | ||
state.trigger = props.trigger; | ||
state.show = !!props.isOpen; | ||
state.transitionName = '-'; | ||
} else { | ||
state.transitionName = props.transitionName; | ||
} | ||
return state; | ||
} | ||
}]); | ||
@@ -489,0 +510,0 @@ |
{ | ||
"name": "@uiw/react-overlay-trigger", | ||
"version": "4.1.2", | ||
"version": "4.2.0", | ||
"description": "OverlayTrigger component", | ||
@@ -46,3 +46,3 @@ "author": "Kenny Wong <wowohoo@qq.com>", | ||
"dependencies": { | ||
"@uiw/react-overlay": "^4.1.2", | ||
"@uiw/react-overlay": "^4.2.0", | ||
"@uiw/utils": "^4.1.2", | ||
@@ -60,3 +60,3 @@ "classnames": "^2.2.6" | ||
}, | ||
"gitHead": "caafb4b0a1360c2a2bd46903932e4531860ce608" | ||
"gitHead": "ef630720992e1b680084bf028b6304fdcbcf71b9" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
206914
2304
Updated@uiw/react-overlay@^4.2.0