Comparing version 1.0.4 to 1.1.0
23
index.js
@@ -69,3 +69,3 @@ 'use strict'; | ||
Dialog.prototype.onCancel = function onCancel(e) { | ||
Dialog.prototype.destroy = function() { | ||
this.setState({ | ||
@@ -75,9 +75,14 @@ visible: false | ||
this.unmountDialog(); | ||
} | ||
Dialog.prototype._onCancel = function onCancel(e) { | ||
this.props.onCancel.call(this); | ||
this.destroy(); | ||
}; | ||
Dialog.prototype.onOk = function onOk(e) { | ||
Dialog.prototype._onOk = function onOk(e) { | ||
// 点击确定按钮的回调函数,返回true或undefined则关闭对话框,返回false则不执行任何操作 | ||
var needUnmount = this.props.onOk.call(this); | ||
if (needUnmount !== false) { | ||
this.onCancel(); | ||
this._onCancel(); | ||
} | ||
@@ -131,3 +136,3 @@ }; | ||
'div', | ||
{ className: 'dialog-wrap ' + props.className, style: wrapStyle }, | ||
{ className: 'dialog-wrap ' + (props.className || ''), style: wrapStyle }, | ||
_react2.default.createElement(_maskM2.default, { className: dialogOverlayCls }), | ||
@@ -139,3 +144,3 @@ _react2.default.createElement( | ||
'b', | ||
{ onClick: this.onCancel.bind(this) }, | ||
{ onClick: this._onCancel.bind(this) }, | ||
_react2.default.createElement('i', null, String.fromCharCode(215)) | ||
@@ -158,3 +163,3 @@ ) : false, | ||
'span', | ||
{ className: 'dialog-button', onClick: this.onCancel.bind(this) }, | ||
{ className: 'dialog-button', onClick: this._onCancel.bind(this) }, | ||
props.cancelText | ||
@@ -164,3 +169,3 @@ ) : false, | ||
'span', | ||
{ className: okBtnCls, onClick: this.onOk.bind(this) }, | ||
{ className: okBtnCls, onClick: this._onOk.bind(this) }, | ||
props.okText | ||
@@ -177,6 +182,6 @@ ) | ||
Dialog.confirm = function (opt) { | ||
_reactDom2.default.render(_react2.default.createElement(Dialog, _extends({ okBtnClass: 'btn-primary' }, opt, { confirm: true })), con); | ||
return _reactDom2.default.render(_react2.default.createElement(Dialog, _extends({ okBtnClass: 'btn-primary' }, opt, { confirm: true })), con); | ||
}; | ||
Dialog.alert = function (opt) { | ||
_reactDom2.default.render(_react2.default.createElement(Dialog, _extends({ okBtnClass: '' }, opt)), con); | ||
return _reactDom2.default.render(_react2.default.createElement(Dialog, _extends({ okBtnClass: '' }, opt)), con); | ||
}; | ||
@@ -183,0 +188,0 @@ Dialog.defaultProps = { |
{ | ||
"name": "m-dialog", | ||
"version": "1.0.4", | ||
"version": "1.1.0", | ||
"description": "m-dialog 移动端模态对话框", | ||
@@ -24,3 +24,3 @@ "main": "index.js", | ||
{ | ||
"name": "柏舟", | ||
"name": "margox", | ||
"email": "margox@foxmail.com" | ||
@@ -27,0 +27,0 @@ } |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
28209
168
0