@beisen-platform/user-selector
Advanced tools
Comparing version 1.0.19 to 1.0.20-rc.1
@@ -306,3 +306,6 @@ import _extends from "@babel/runtime/helpers/extends"; | ||
this.isSearchFetchStart = true; | ||
if (this.props.isSearchFetching !== undefined) { | ||
this.isSearchFetchStart = true; | ||
} | ||
this.setState({ | ||
@@ -309,0 +312,0 @@ isSearch: true, |
@@ -205,2 +205,3 @@ import _typeof from "@babel/runtime/helpers/typeof"; | ||
getStaff = _this$props3.getStaff, | ||
allowSearchNull = _this$props3.allowSearchNull, | ||
getUsedInfo = _this$props3.getUsedInfo, | ||
@@ -217,2 +218,8 @@ isUseInitial = _this$props3.isUseInitial, | ||
isShowDepartmentName = _this$props3.isShowDepartmentName; | ||
var hasNoEmptyRes = results.filter(function (cmp, index) { | ||
return cmp.Id != '#AllowSearchNull#'; | ||
}); | ||
var hasEmptyRes = results.filter(function (cmp, index) { | ||
return cmp.Id == '#AllowSearchNull#'; | ||
}); | ||
return React.createElement(MultiModel, { | ||
@@ -224,4 +231,6 @@ addDepartment: addDepartment, | ||
usedusers: usedusers, | ||
results: results, | ||
results: hasNoEmptyRes, | ||
emptyResult: hasEmptyRes, | ||
addResults: addResults, | ||
allowSearchNull: allowSearchNull, | ||
staffs: staffs, | ||
@@ -228,0 +237,0 @@ clearResults: clearResults, |
@@ -31,2 +31,89 @@ import _extends from "@babel/runtime/helpers/extends"; | ||
_this = _possibleConstructorReturn(this, _getPrototypeOf(MultiModel).call(this, props)); | ||
_this.clickEmptyItem = function (event) { | ||
_this.cancelBubble(event); | ||
var _this$state = _this.state, | ||
status = _this$state.status, | ||
isSearch = _this$state.isSearch; | ||
var dataNow = ''; | ||
if (isSearch) { | ||
dataNow = 'searchs'; | ||
} else { | ||
switch (status) { | ||
case 0: | ||
dataNow = 'usedusers'; | ||
break; | ||
case 1: | ||
dataNow = 'staffs'; | ||
break; | ||
case 2: | ||
dataNow = 'departments'; | ||
break; | ||
default: | ||
break; | ||
} | ||
} | ||
_this.props.addResults && _this.props.addResults('#AllowSearchNull#', dataNow, undefined); | ||
}; | ||
_this.deleteEmptyItem = function (event) { | ||
_this.cancelBubble(event); | ||
_this.props.clearResults && _this.props.clearResults(false, '#AllowSearchNull#'); | ||
}; | ||
_this.cancelBubble = function (e) { | ||
var evt = e || window.event; | ||
if (evt.cancelBubble) { | ||
// IE | ||
evt.preventDefault(); | ||
evt.cancelBubble = true; | ||
} else { | ||
// W3C | ||
evt.preventDefault(); | ||
evt.stopPropagation(); | ||
} | ||
}; | ||
_this.renderEmptySel = function () { | ||
if (_this.state.showEmptyItem) { | ||
return React.createElement("div", { | ||
className: "user_select_empty_sel", | ||
onClick: _this.clickEmptyItem | ||
}, "\u7A7A(\u672A\u586B\u5199)"); | ||
} else { | ||
return ''; | ||
} | ||
}; | ||
_this.mouseActive = function (str) { | ||
if (str == 'mouseOut') { | ||
event.target.className = 'closeButton pc-sys-guanbi-nomal-svg'; | ||
} else if (str == 'mouseOver') { | ||
event.target.className = 'closeButton pc-sys-guanbi-active-svg'; | ||
} | ||
}; | ||
_this.selectItemIsEmpty = function () { | ||
if (_this.props.emptyResult.length == 1) { | ||
return React.createElement("div", { | ||
className: "user_select_empty_isSel" | ||
}, React.createElement("span", null, "\u7A7A(\u672A\u586B\u5199)"), React.createElement("div", { | ||
className: "closeButton pc-sys-guanbi-nomal-svg", | ||
onClick: _this.deleteEmptyItem, | ||
onMouseOut: _this.mouseActive.bind(_assertThisInitialized(_this), 'mouseOut'), | ||
onMouseOver: _this.mouseActive.bind(_assertThisInitialized(_this), 'mouseOver') | ||
})); | ||
} else { | ||
return ''; | ||
} | ||
}; | ||
_this.state = { | ||
@@ -39,3 +126,4 @@ status: 0, | ||
select: false, | ||
fetchingFlag: true | ||
fetchingFlag: true, | ||
showEmptyItem: true | ||
}; | ||
@@ -371,5 +459,5 @@ _this.currentEventKey = 0; | ||
event.nativeEvent.stopImmediatePropagation(); | ||
var _this$state = this.state, | ||
status = _this$state.status, | ||
isSearch = _this$state.isSearch; | ||
var _this$state2 = this.state, | ||
status = _this$state2.status, | ||
isSearch = _this$state2.isSearch; | ||
var node = event.target; | ||
@@ -465,7 +553,11 @@ var id, pid, dataNow; | ||
isShowDepartmentName = _this$props.isShowDepartmentName; | ||
if (results.length == 0) return React.createElement("div", { | ||
className: "us-no-data" | ||
}, React.createElement("span", { | ||
className: "empty-con" | ||
})); | ||
if (results.length == 0 && this.props.emptyResult.length == 0) { | ||
return React.createElement("div", { | ||
className: "us-no-data" | ||
}, React.createElement("span", { | ||
className: "empty-con" | ||
})); | ||
} | ||
var temp = results && results.map(function (item, index) { | ||
@@ -524,3 +616,3 @@ var myItem = []; | ||
event.nativeEvent.stopImmediatePropagation(); | ||
if (this.props.results.length == 0) return; | ||
if (this.props.results.length == 0 && this.props.emptyResult.length == 0) return; | ||
this.props.clearResults && this.props.clearResults(true); | ||
@@ -543,6 +635,6 @@ } | ||
var _this$state2 = this.state, | ||
status = _this$state2.status, | ||
isSearch = _this$state2.isSearch, | ||
fetchingFlag = _this$state2.fetchingFlag; | ||
var _this$state3 = this.state, | ||
status = _this$state3.status, | ||
isSearch = _this$state3.isSearch, | ||
fetchingFlag = _this$state3.fetchingFlag; | ||
var _this$props2 = this.props, | ||
@@ -688,5 +780,5 @@ addDepartment = _this$props2.addDepartment, | ||
value: function renderUsedStaffText() { | ||
var _this$state3 = this.state, | ||
status = _this$state3.status, | ||
isSearch = _this$state3.isSearch; | ||
var _this$state4 = this.state, | ||
status = _this$state4.status, | ||
isSearch = _this$state4.isSearch; | ||
var _this$props3 = this.props, | ||
@@ -773,3 +865,4 @@ usedusers = _this$props3.usedusers, | ||
status: eventKey, | ||
isSearch: false | ||
isSearch: false, | ||
showEmptyItem: true | ||
}); | ||
@@ -797,3 +890,3 @@ this.currentEventKey = eventKey; | ||
val.stopPropagation(); | ||
this.props.onSure && this.props.onSure(this.props.results); | ||
this.props.onSure && this.props.onSure(this.props.results.concat(this.props.emptyResult)); | ||
this.props.closeComponent(); | ||
@@ -822,3 +915,4 @@ } | ||
isSearch: false, | ||
status: this.currentEventKey | ||
status: this.currentEventKey, | ||
showEmptyItem: true | ||
}); | ||
@@ -848,3 +942,4 @@ } else { | ||
isSearch: true, | ||
status: 0 | ||
status: 0, | ||
showEmptyItem: false | ||
}); | ||
@@ -956,3 +1051,3 @@ } | ||
ref: "usDepCon" | ||
}, this.renderUsedStaffText(), React.createElement("ul", { | ||
}, this.props.allowSearchNull ? this.renderEmptySel() : '', this.renderUsedStaffText(), React.createElement("ul", { | ||
className: "us-item-top", | ||
@@ -969,3 +1064,3 @@ onClick: this.depClick | ||
}, '已选人员', "\xA0\xA0", usersCount == 0 ? undefined : usersCount + '人', "\xA0\xA0", depCount == 0 ? undefined : '组' + depCount + '个', React.createElement("a", { | ||
className: results.length == 0 ? 'us-multi-clearall us-multi-clearall-disabled' : 'us-multi-clearall', | ||
className: results.length == 0 && this.props.emptyResult.length == 0 ? 'us-multi-clearall us-multi-clearall-disabled' : 'us-multi-clearall', | ||
onClick: this.clearAll | ||
@@ -978,3 +1073,3 @@ }, "\u6E05\u7A7A\u6240\u9009")), React.createElement("div", { | ||
ref: "resultPart" | ||
}, this.renderResults()))))), React.createElement("div", { | ||
}, this.renderResults(), this.selectItemIsEmpty()))))), React.createElement("div", { | ||
className: "us-footer clearfix" | ||
@@ -981,0 +1076,0 @@ }, React.createElement(BaseButton, sureButton), React.createElement(BaseButton, cancelButton))); |
{ | ||
"name": "@beisen-platform/user-selector", | ||
"version": "1.0.19", | ||
"version": "1.0.20-rc.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
113164
2710
2