rc-trigger
Advanced tools
Comparing version 4.0.0-alpha.4 to 4.0.0-alpha.5
@@ -7,2 +7,3 @@ import React, { Component } from 'react'; | ||
* align - let component align the position | ||
* aligned - re-align again in case additional className changed the size | ||
* afterAlign - choice next step is trigger motion or finished | ||
@@ -13,3 +14,3 @@ * beforeMotion - should reset motion to invisible so that CSSMotion can do normal motion | ||
*/ | ||
declare type PopupStatus = null | 'measure' | 'align' | 'afterAlign' | 'beforeMotion' | 'motion' | 'AfterMotion' | 'stable'; | ||
declare type PopupStatus = null | 'measure' | 'align' | 'aligned' | 'afterAlign' | 'beforeMotion' | 'motion' | 'AfterMotion' | 'stable'; | ||
interface PopupProps { | ||
@@ -16,0 +17,0 @@ visible?: boolean; |
@@ -68,2 +68,3 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
_this.onAlign = function (popupDomNode, align) { | ||
var status = _this.state.status; | ||
var _this$props = _this.props, | ||
@@ -74,7 +75,21 @@ getClassNameFromAlign = _this$props.getClassNameFromAlign, | ||
_this.setState({ | ||
alignClassName: alignClassName | ||
}); | ||
if (status === 'align') { | ||
_this.setState({ | ||
alignClassName: alignClassName, | ||
status: 'aligned' | ||
}, function () { | ||
_this.alignRef.current.forceAlign(); | ||
}); | ||
} else if (status === 'aligned') { | ||
_this.setState({ | ||
alignClassName: alignClassName, | ||
status: 'afterAlign' | ||
}); | ||
onAlign(popupDomNode, align); | ||
onAlign(popupDomNode, align); | ||
} else { | ||
_this.setState({ | ||
alignClassName: alignClassName | ||
}); | ||
} | ||
}; | ||
@@ -184,3 +199,3 @@ | ||
var mergedAlignDisabled = !visible || status !== 'align' && status !== 'stable'; // ================== Popup ================== | ||
var mergedAlignDisabled = !visible || status !== 'align' && status !== 'aligned' && status !== 'stable'; // ================== Popup ================== | ||
@@ -315,3 +330,3 @@ var mergedPopupVisible = true; | ||
// Go to next status | ||
var queue = ['measure', 'align', 'afterAlign', 'beforeMotion', 'motion']; | ||
var queue = ['measure', 'align', null, 'beforeMotion', 'motion']; | ||
var index = queue.indexOf(status); | ||
@@ -318,0 +333,0 @@ var nextStatus = queue[index + 1]; |
@@ -7,2 +7,3 @@ import React, { Component } from 'react'; | ||
* align - let component align the position | ||
* aligned - re-align again in case additional className changed the size | ||
* afterAlign - choice next step is trigger motion or finished | ||
@@ -13,3 +14,3 @@ * beforeMotion - should reset motion to invisible so that CSSMotion can do normal motion | ||
*/ | ||
declare type PopupStatus = null | 'measure' | 'align' | 'afterAlign' | 'beforeMotion' | 'motion' | 'AfterMotion' | 'stable'; | ||
declare type PopupStatus = null | 'measure' | 'align' | 'aligned' | 'afterAlign' | 'beforeMotion' | 'motion' | 'AfterMotion' | 'stable'; | ||
interface PopupProps { | ||
@@ -16,0 +17,0 @@ visible?: boolean; |
@@ -88,2 +88,3 @@ "use strict"; | ||
_this.onAlign = function (popupDomNode, align) { | ||
var status = _this.state.status; | ||
var _this$props = _this.props, | ||
@@ -94,7 +95,21 @@ getClassNameFromAlign = _this$props.getClassNameFromAlign, | ||
_this.setState({ | ||
alignClassName: alignClassName | ||
}); | ||
if (status === 'align') { | ||
_this.setState({ | ||
alignClassName: alignClassName, | ||
status: 'aligned' | ||
}, function () { | ||
_this.alignRef.current.forceAlign(); | ||
}); | ||
} else if (status === 'aligned') { | ||
_this.setState({ | ||
alignClassName: alignClassName, | ||
status: 'afterAlign' | ||
}); | ||
onAlign(popupDomNode, align); | ||
onAlign(popupDomNode, align); | ||
} else { | ||
_this.setState({ | ||
alignClassName: alignClassName | ||
}); | ||
} | ||
}; | ||
@@ -204,3 +219,3 @@ | ||
var mergedAlignDisabled = !visible || status !== 'align' && status !== 'stable'; // ================== Popup ================== | ||
var mergedAlignDisabled = !visible || status !== 'align' && status !== 'aligned' && status !== 'stable'; // ================== Popup ================== | ||
@@ -335,3 +350,3 @@ var mergedPopupVisible = true; | ||
// Go to next status | ||
var queue = ['measure', 'align', 'afterAlign', 'beforeMotion', 'motion']; | ||
var queue = ['measure', 'align', null, 'beforeMotion', 'motion']; | ||
var index = queue.indexOf(status); | ||
@@ -338,0 +353,0 @@ var nextStatus = queue[index + 1]; |
{ | ||
"name": "rc-trigger", | ||
"version": "4.0.0-alpha.4", | ||
"version": "4.0.0-alpha.5", | ||
"description": "base abstract trigger component for react", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
131534
2684