zan-choose-dialog
Advanced tools
Comparing version 4.3.14 to 4.3.15
@@ -285,3 +285,3 @@ 'use strict'; | ||
typeMap = _ref.typeMap; | ||
return function (_onChoose, config, linkValue) { | ||
return function (_onChoose, config, value) { | ||
if (choose) { | ||
@@ -292,6 +292,6 @@ return choose({ | ||
onChoose: function onChoose(data, tabIndex) { | ||
var value = (0, _isArray2['default'])(data) ? data[0] : data; | ||
var choosedValue = (0, _isArray2['default'])(data) ? data[0] : data; | ||
var type = (0, _isString2['default'])(typeMap) ? typeMap : typeMap[tabIndex]; | ||
normalizeLinkValue(type, value, config).then(_onChoose)['catch'](function (err) { | ||
normalizeLinkValue(type, choosedValue, config).then(_onChoose)['catch'](function (err) { | ||
return _notify2['default'].error(err); | ||
@@ -301,3 +301,3 @@ }); | ||
linkValue: linkValue | ||
value: value | ||
}); | ||
@@ -304,0 +304,0 @@ } |
@@ -9,2 +9,4 @@ 'use strict'; | ||
var _class, _temp, _initialiseProps; | ||
exports['default'] = chooseWeappLink; | ||
@@ -58,3 +60,3 @@ | ||
var Content = function (_ref) { | ||
var Content = (_temp = _class = function (_ref) { | ||
_inherits(Content, _ref); | ||
@@ -67,47 +69,8 @@ | ||
_this.handleChangeLinkType = function (e) { | ||
var linkType = e.target.value; | ||
_this.setState({ | ||
link_type: linkType | ||
}); | ||
}; | ||
_initialiseProps.call(_this); | ||
_this.handleChangeInput = function (e) { | ||
var _e$target = e.target, | ||
value = _e$target.value, | ||
name = _e$target.name; | ||
var value = props.value; | ||
_this.setState(_defineProperty({}, name, value), function () { | ||
_this.validate(); | ||
}); | ||
}; | ||
_this.onConfirm = function () { | ||
if (!_this.validate()) { | ||
_this.setState({ | ||
showError: true | ||
}); | ||
return; | ||
} | ||
var _this$props = _this.props, | ||
id = _this$props.id, | ||
onChoose = _this$props.onChoose; | ||
var link = (0, _pick2['default'])(_this.state, ['link_type', 'my_weapp_link', 'other_weapp_appid', 'other_weapp_link']); | ||
onChoose(link); | ||
_dialog2['default'].closeDialog(id); | ||
}; | ||
_this.onCancel = function () { | ||
var id = _this.props.id; | ||
_dialog2['default'].closeDialog(id); | ||
}; | ||
var linkValue = props.linkValue; | ||
if ((0, _isEmpty2['default'])(linkValue) || !linkValue.extra_data) { | ||
if ((0, _isEmpty2['default'])(value) || !value.extra_data) { | ||
_this.state = { | ||
@@ -122,7 +85,7 @@ link_type: '1', | ||
} else { | ||
var _linkValue$extra_data = linkValue.extra_data, | ||
linkType = _linkValue$extra_data.link_type, | ||
myWeappLink = _linkValue$extra_data.my_weapp_link, | ||
otherWeappAppId = _linkValue$extra_data.other_weapp_appid, | ||
otherWeappLink = _linkValue$extra_data.other_weapp_link; | ||
var _value$extra_data = value.extra_data, | ||
linkType = _value$extra_data.link_type, | ||
myWeappLink = _value$extra_data.my_weapp_link, | ||
otherWeappAppId = _value$extra_data.other_weapp_appid, | ||
otherWeappLink = _value$extra_data.other_weapp_link; | ||
@@ -282,7 +245,49 @@ | ||
return Content; | ||
}(_react.PureComponent || _react.Component); | ||
}(_react.PureComponent || _react.Component), _initialiseProps = function _initialiseProps() { | ||
var _this2 = this; | ||
this.handleChangeLinkType = function (e) { | ||
var linkType = e.target.value; | ||
_this2.setState({ | ||
link_type: linkType | ||
}); | ||
}; | ||
this.handleChangeInput = function (e) { | ||
var _e$target = e.target, | ||
value = _e$target.value, | ||
name = _e$target.name; | ||
_this2.setState(_defineProperty({}, name, value), function () { | ||
_this2.validate(); | ||
}); | ||
}; | ||
this.onConfirm = function () { | ||
if (!_this2.validate()) { | ||
_this2.setState({ | ||
showError: true | ||
}); | ||
return; | ||
} | ||
var _props = _this2.props, | ||
id = _props.id, | ||
onChoose = _props.onChoose; | ||
var link = (0, _pick2['default'])(_this2.state, ['link_type', 'my_weapp_link', 'other_weapp_appid', 'other_weapp_link']); | ||
onChoose(link); | ||
_dialog2['default'].closeDialog(id); | ||
}; | ||
this.onCancel = function () { | ||
var id = _this2.props.id; | ||
_dialog2['default'].closeDialog(id); | ||
}; | ||
}, _temp); | ||
function chooseWeappLink(options) { | ||
var id = (0, _uniqueId2['default'])('rc-choose-dialog-weapp-link'); | ||
var linkValue = options.linkValue, | ||
var value = options.value, | ||
onChoose = options.onChoose; | ||
@@ -294,5 +299,5 @@ | ||
title: '小程序路径', | ||
children: _react2['default'].createElement(Content, { id: id, linkValue: linkValue, onChoose: onChoose }) | ||
children: _react2['default'].createElement(Content, { id: id, value: value, onChoose: onChoose }) | ||
}); | ||
} | ||
module.exports = exports['default']; |
{ | ||
"name": "zan-choose-dialog", | ||
"version": "4.3.14", | ||
"version": "4.3.15", | ||
"description": "这是一个React组件", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
1098849
31044