@titaui/pc 1.11.60 → 1.11.61

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,6 +13,8 @@ var _userSelector = _interopRequireDefault(require("../../user-selector"));
13
13
 
14
14
  var _searchDropdown = _interopRequireDefault(require("./search-dropdown"));
15
15
 
16
+ var _openData = require("../../../utils/open-data");
17
+
16
18
  var _getLocale = require("../../../utils/getLocale");
17
19
 
18
20
  require("./search-dropdown/index.css");
@@ -41,7 +43,7 @@ function Principal(props) {
41
43
  initValue = _props$initValue === void 0 ? [] : _props$initValue,
42
44
  setRelation = props.setRelation,
43
45
  _props$position = props.position,
44
- position = _props$position === void 0 ? "bottom" : _props$position,
46
+ position = _props$position === void 0 ? 'bottom' : _props$position,
45
47
  _props$multiple = props.multiple,
46
48
  multiple = _props$multiple === void 0 ? true : _props$multiple;
47
49
 
@@ -55,12 +57,7 @@ function Principal(props) {
55
57
  isInit = _useState4[0],
56
58
  setIsInit = _useState4[1];
57
59
 
58
- var _useState5 = (0, _react.useState)((0, _getLocale.getLocale)("Pro_page_Plan_Allpersonnel")),
59
- _useState6 = _slicedToArray(_useState5, 2),
60
- selectText = _useState6[0],
61
- setSelectText = _useState6[1];
62
-
63
- var userSelectorRef = (0, _react.useRef)(document.createElement("div"));
60
+ var userSelectorRef = (0, _react.useRef)(document.createElement('div'));
64
61
 
65
62
  var singleSelect = function singleSelect(users) {
66
63
  var _users$;
@@ -84,25 +81,30 @@ function Principal(props) {
84
81
  setIsInit(true);
85
82
  }, []);
86
83
  (0, _react.useEffect)(function () {
87
- setRelation(0); // console.log(users);
84
+ setRelation(0);
85
+ isInit && onChange(users);
86
+ }, [users]);
88
87
 
88
+ var renderName = function renderName() {
89
89
  if (users.length > 0) {
90
- var text = ""; // 我在拼name
91
-
92
- users.forEach(function (item, key) {
90
+ return users.map(function (item, key) {
93
91
  if (key === users.length - 1) {
94
- text += item.name;
92
+ return /*#__PURE__*/_react["default"].createElement(_openData.OpenUserName, {
93
+ name: item.name,
94
+ id: item.userId
95
+ });
95
96
  } else {
96
- text = "".concat(text + item.name, ",");
97
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_openData.OpenUserName, {
98
+ name: item.name,
99
+ id: item.userId
100
+ }), ",");
97
101
  }
98
102
  });
99
- setSelectText(text);
100
103
  } else {
101
- setSelectText((0, _getLocale.getLocale)("Pro_page_Plan_Allpersonnel"));
104
+ return (0, _getLocale.getLocale)('Pro_page_Plan_Allpersonnel');
102
105
  }
106
+ };
103
107
 
104
- isInit && onChange(users);
105
- }, [users]);
106
108
  return /*#__PURE__*/_react["default"].createElement("div", {
107
109
  ref: userSelectorRef
108
110
  }, /*#__PURE__*/_react["default"].createElement(_userSelector["default"], {
@@ -126,7 +128,7 @@ function Principal(props) {
126
128
  popClass: "pull-screen-ignore"
127
129
  }, /*#__PURE__*/_react["default"].createElement(_searchDropdown["default"], null, /*#__PURE__*/_react["default"].createElement("span", {
128
130
  className: "titaui-search-dropdown__principal-text"
129
- }, selectText))));
131
+ }, renderName()))));
130
132
  }
131
133
 
132
134
  var _default = Principal;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@titaui/pc",
3
- "version": "1.11.60",
3
+ "version": "1.11.61",
4
4
  "nameCN": "",
5
5
  "description": "",
6
6
  "main": "lib/index.js",