@titaui/pc 1.11.4-8 → 1.11.4-9

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.
@@ -24,6 +24,13 @@
24
24
  background-size: contain;
25
25
  }
26
26
 
27
+ .titaui-text-avatar__img {
28
+ margin-right: 4px;
29
+ display: inline-block;
30
+ vertical-align: middle;
31
+ height: 24px;
32
+ }
33
+
27
34
  .titaui-text-avatar__name {
28
35
  vertical-align: middle;
29
36
  }
@@ -17,6 +17,8 @@ var _tooltip = _interopRequireDefault(require("../../tooltip"));
17
17
 
18
18
  var _userSelector = _interopRequireDefault(require("../../user-selector"));
19
19
 
20
+ var _default2 = _interopRequireDefault(require("../default"));
21
+
20
22
  require("./index.css");
21
23
 
22
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
@@ -56,7 +58,11 @@ function TextAvatar(props) {
56
58
  _props$nameTips = props.nameTips,
57
59
  nameTips = _props$nameTips === void 0 ? function (name) {
58
60
  return name;
59
- } : _props$nameTips;
61
+ } : _props$nameTips,
62
+ _props$showAvatar = props.showAvatar,
63
+ showAvatar = _props$showAvatar === void 0 ? false : _props$showAvatar,
64
+ _props$avatar = props.avatar,
65
+ avatar = _props$avatar === void 0 ? {} : _props$avatar;
60
66
 
61
67
  var _useState = (0, _react.useState)(false),
62
68
  _useState2 = _slicedToArray(_useState, 2),
@@ -78,6 +84,29 @@ function TextAvatar(props) {
78
84
 
79
85
 
80
86
  var FieldPerson = editable ? _userSelector["default"] : "span";
87
+
88
+ var renderAvatar = function renderAvatar() {
89
+ if (showAvatar) {
90
+ return /*#__PURE__*/_react["default"].createElement("span", {
91
+ className: "".concat(preCls, "__img")
92
+ }, /*#__PURE__*/_react["default"].createElement(_default2["default"], {
93
+ userId: id,
94
+ src: avatar !== null && avatar !== void 0 && avatar.HasAvatar || avatar !== null && avatar !== void 0 && avatar.hasAvatar ? avatar.medium : "",
95
+ color: avatar === null || avatar === void 0 ? void 0 : avatar.color,
96
+ name: name,
97
+ size: {
98
+ fontSize: 12,
99
+ width: 24,
100
+ textNum: 1
101
+ }
102
+ }));
103
+ }
104
+
105
+ return /*#__PURE__*/_react["default"].createElement("span", {
106
+ className: "".concat(preCls, "__icon")
107
+ });
108
+ };
109
+
81
110
  return /*#__PURE__*/_react["default"].createElement(FieldPerson, {
82
111
  multiple: false,
83
112
  selectNodes: {},
@@ -105,9 +134,7 @@ function TextAvatar(props) {
105
134
  style: {
106
135
  maxWidth: width
107
136
  }
108
- }, /*#__PURE__*/_react["default"].createElement("span", {
109
- className: "".concat(preCls, "__icon")
110
- }), /*#__PURE__*/_react["default"].createElement("span", {
137
+ }, renderAvatar(), /*#__PURE__*/_react["default"].createElement("span", {
111
138
  ref: text,
112
139
  className: "".concat(preCls, "__name")
113
140
  }, /*#__PURE__*/_react["default"].createElement(_openData.OpenUserName, {
@@ -118,9 +145,7 @@ function TextAvatar(props) {
118
145
  style: {
119
146
  maxWidth: width
120
147
  }
121
- }, /*#__PURE__*/_react["default"].createElement("span", {
122
- className: "".concat(preCls, "__icon")
123
- }), /*#__PURE__*/_react["default"].createElement("span", {
148
+ }, renderAvatar(), /*#__PURE__*/_react["default"].createElement("span", {
124
149
  ref: text,
125
150
  className: "".concat(preCls, "__name")
126
151
  }, /*#__PURE__*/_react["default"].createElement(_openData.OpenUserName, {
@@ -45,6 +45,10 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
45
45
 
46
46
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
47
47
 
48
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
49
+
50
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
51
+
48
52
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
49
53
 
50
54
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -60,7 +64,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
60
64
  var TooltipText = _tooltip["default"].Text;
61
65
 
62
66
  var _default = function _default(props) {
63
- var _okrInfo$authority, _data$principalUser, _data$principalUser2;
67
+ var _okrInfo$authority, _data$principalUser, _data$principalUser2, _data$principalUser3;
64
68
 
65
69
  var index = props.index,
66
70
  title = props.title,
@@ -80,14 +84,9 @@ var _default = function _default(props) {
80
84
 
81
85
  var _useState3 = (0, _react.useState)(data.status === 2),
82
86
  _useState4 = _slicedToArray(_useState3, 1),
83
- isGray = _useState4[0]; // const { okrInfo } = useContext(CommonContext);
84
- // const { refreshEList } = useContext(EListContext);
85
-
87
+ isGray = _useState4[0];
86
88
 
87
89
  var okrInfo = {};
88
-
89
- var refreshEList = function refreshEList() {};
90
-
91
90
  var isParticipant = ((_okrInfo$authority = okrInfo.authority) === null || _okrInfo$authority === void 0 ? void 0 : _okrInfo$authority.roleRelation) && okrInfo.authority.roleRelation.roleType === 2;
92
91
  var hasRelativeAuth = new _auth.KRAuth({
93
92
  user: data.user,
@@ -97,19 +96,35 @@ var _default = function _default(props) {
97
96
  createUserId: okrInfo.createUserId
98
97
  }).hasAuth();
99
98
 
100
- var onSureUnConnectHandler = function onSureUnConnectHandler() {
101
- (0, _requestApis.cancelRel)({
102
- krId: data.mileStoneId,
103
- objType: data.objType,
104
- okrId: okrInfo.workId,
105
- taskId: data.id
106
- }).then(function (resp) {
107
- if (resp.Code === 1) {
108
- refreshEList();
109
- }
110
- });
111
- setUnConnectVisible(false);
112
- };
99
+ var onSureUnConnectHandler = /*#__PURE__*/function () {
100
+ var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
101
+ return regeneratorRuntime.wrap(function _callee$(_context) {
102
+ while (1) {
103
+ switch (_context.prev = _context.next) {
104
+ case 0:
105
+ _context.next = 2;
106
+ return (0, _requestApis.cancelRel)({
107
+ krId: data.mileStoneId,
108
+ objType: data.objType,
109
+ okrId: okrInfo.workId,
110
+ taskId: data.id
111
+ });
112
+
113
+ case 2:
114
+ setUnConnectVisible(false);
115
+
116
+ case 3:
117
+ case "end":
118
+ return _context.stop();
119
+ }
120
+ }
121
+ }, _callee);
122
+ }));
123
+
124
+ return function onSureUnConnectHandler() {
125
+ return _ref.apply(this, arguments);
126
+ };
127
+ }();
113
128
 
114
129
  var openProjectDetail = function openProjectDetail() {
115
130
  if ((0, _platform.isPlatform)("dd")) {
@@ -146,7 +161,9 @@ var _default = function _default(props) {
146
161
  }, /*#__PURE__*/_react["default"].createElement(_avatar["default"].Text, {
147
162
  name: data === null || data === void 0 ? void 0 : (_data$principalUser = data.principalUser) === null || _data$principalUser === void 0 ? void 0 : _data$principalUser.name,
148
163
  id: data === null || data === void 0 ? void 0 : (_data$principalUser2 = data.principalUser) === null || _data$principalUser2 === void 0 ? void 0 : _data$principalUser2.userId,
149
- width: 64,
164
+ width: 92,
165
+ showAvatar: true,
166
+ avatar: data === null || data === void 0 ? void 0 : (_data$principalUser3 = data.principalUser) === null || _data$principalUser3 === void 0 ? void 0 : _data$principalUser3.avatar,
150
167
  extraCls: isGray && "".concat(_precls["default"], "__e-project-node-gray")
151
168
  })), /*#__PURE__*/_react["default"].createElement("span", {
152
169
  className: (0, _classnames["default"])("".concat(_precls["default"], "__e-project-node-actions-date"))
@@ -138,27 +138,22 @@ function ETaskNode(props) {
138
138
  setDataInfo = _useState14[1];
139
139
 
140
140
  var _useState15 = (0, _react.useState)(function () {
141
- return (0, _bsGlobal.getBSGlobal)('TaskAdvancedSetting').TaskFunctionSetting.TaskPriority;
141
+ return (0, _bsGlobal.getBSGlobal)("TaskAdvancedSetting").TaskFunctionSetting.TaskPriority;
142
142
  }),
143
143
  _useState16 = _slicedToArray(_useState15, 1),
144
- isShowPriority = _useState16[0]; // const { okrInfo } = useContext(CommonContext);
145
- // const { refreshEList } = useContext(EListContext);
144
+ isShowPriority = _useState16[0];
146
145
 
147
-
148
- var okrInfo = {};
149
-
150
- var refreshEList = function refreshEList() {}; // extraEditAuth = new KRAuth({ user: krUser, createUserId }).hasAuth()
146
+ var okrInfo = {}; // extraEditAuth = new KRAuth({ user: krUser, createUserId }).hasAuth()
151
147
  // || new OAuth({
152
148
  // principalUser: okrInfo.principalUser,
153
149
  // createUserId: okrInfo.createUserId,
154
150
  // }).hasAuth()
155
151
 
156
-
157
152
  var hasEditAuth = new _auth.EAuth({
158
153
  principalUser: data.principalUser,
159
154
  user: data.user
160
- }).hasAuth() && // || extraEditAuth
161
- data.status !== 5;
155
+ }).hasAuth() // || extraEditAuth
156
+ && data.status !== 5;
162
157
  var isParticipant = ((_okrInfo$authority = okrInfo.authority) === null || _okrInfo$authority === void 0 ? void 0 : _okrInfo$authority.roleRelation) && okrInfo.authority.roleRelation.roleType === 2;
163
158
  var hasRelativeAuth = new _auth.KRAuth({
164
159
  user: krUser,
@@ -179,7 +174,7 @@ function ETaskNode(props) {
179
174
  if (data.Code === 1) {
180
175
  setUser(user.data);
181
176
 
182
- _toast["default"].Success((0, _getLocale.getLocale)('Mod_Successfuloperat'), {
177
+ _toast["default"].Success((0, _getLocale.getLocale)("Mod_Successfuloperat"), {
183
178
  canClose: false
184
179
  });
185
180
  } else {
@@ -188,7 +183,7 @@ function ETaskNode(props) {
188
183
  });
189
184
  }
190
185
  })["catch"](function () {
191
- _toast["default"].Error('网络异常', {
186
+ _toast["default"].Error("网络异常", {
192
187
  canClose: false
193
188
  });
194
189
  });
@@ -200,7 +195,7 @@ function ETaskNode(props) {
200
195
  status: _constant.EStatusClass2StatusType[statusType]
201
196
  }).then(function (resp) {
202
197
  if (resp.Code === 1) {
203
- _toast["default"].Success((0, _getLocale.getLocale)('Mod_Successfuloperat'), {
198
+ _toast["default"].Success((0, _getLocale.getLocale)("Mod_Successfuloperat"), {
204
199
  canClose: false
205
200
  });
206
201
 
@@ -215,7 +210,7 @@ function ETaskNode(props) {
215
210
  });
216
211
  }
217
212
  })["catch"](function () {
218
- _toast["default"].Error('网络异常', {
213
+ _toast["default"].Error("网络异常", {
219
214
  canClose: false
220
215
  });
221
216
  });
@@ -229,18 +224,16 @@ function ETaskNode(props) {
229
224
  taskId: data.taskId
230
225
  }).then(function (resp) {
231
226
  if (resp.Code === 1) {
232
- _toast["default"].Success((0, _getLocale.getLocale)('Mod_Successfuloperat'), {
227
+ _toast["default"].Success((0, _getLocale.getLocale)("Mod_Successfuloperat"), {
233
228
  canClose: false
234
229
  });
235
-
236
- refreshEList();
237
230
  } else {
238
231
  _toast["default"].Error(resp.Message, {
239
232
  canClose: false
240
233
  });
241
234
  }
242
235
  })["catch"](function () {
243
- _toast["default"].Error('网络异常', {
236
+ _toast["default"].Error("网络异常", {
244
237
  canClose: false
245
238
  });
246
239
  })["finally"](setUnConnectVisible(false));
@@ -286,7 +279,7 @@ function ETaskNode(props) {
286
279
  status: resp.Data.status
287
280
  }));
288
281
 
289
- _toast["default"].Success((0, _getLocale.getLocale)('Mod_Successfuloperat'), {
282
+ _toast["default"].Success((0, _getLocale.getLocale)("Mod_Successfuloperat"), {
290
283
  canClose: false
291
284
  });
292
285
  } else {
@@ -295,7 +288,7 @@ function ETaskNode(props) {
295
288
  });
296
289
  }
297
290
  })["catch"](function () {
298
- _toast["default"].Error('网络异常', {
291
+ _toast["default"].Error("网络异常", {
299
292
  canClose: false
300
293
  });
301
294
  });
@@ -329,7 +322,7 @@ function ETaskNode(props) {
329
322
  };
330
323
 
331
324
  var handleShowTaskDetail = function handleShowTaskDetail() {
332
- if ((0, _platform.isPlatform)('dd')) {
325
+ if ((0, _platform.isPlatform)("dd")) {
333
326
  _drawerManager["default"].close();
334
327
  }
335
328
 
@@ -337,11 +330,10 @@ function ETaskNode(props) {
337
330
  var _window$Talent, _window$Talent2;
338
331
 
339
332
  (_window$Talent = window.Talent) === null || _window$Talent === void 0 ? void 0 : _window$Talent.app.vent.off("global-pull-screen:closed:".concat(data.taskId));
340
- (_window$Talent2 = window.Talent) === null || _window$Talent2 === void 0 ? void 0 : _window$Talent2.app.vent.on("global-pull-screen:closed:".concat(data.taskId), function () {
341
- refreshEList && refreshEList();
333
+ (_window$Talent2 = window.Talent) === null || _window$Talent2 === void 0 ? void 0 : _window$Talent2.app.vent.on("global-pull-screen:closed:".concat(data.taskId), function () {// refreshEList && refreshEList();
342
334
  }); // 任务:打开推屏
343
335
 
344
- window.Talent.app.vent.trigger('global-pull-screen', data.taskId, 'task');
336
+ window.Talent.app.vent.trigger("global-pull-screen", data.taskId, "task");
345
337
  } else {
346
338
  window.open("//".concat(window.location.host).concat(window.location.pathname, "#more/taskinfo?id=").concat(data.taskId));
347
339
  }
@@ -364,7 +356,7 @@ function ETaskNode(props) {
364
356
  hasAuth: hasEditAuth,
365
357
  status: data.status
366
358
  })), /*#__PURE__*/_react["default"].createElement("span", {
367
- className: (0, _classnames["default"])("".concat(_precls["default"], "__e-task-node-title ").concat(isCancel ? "".concat(_precls["default"], "__e-project-node-gray") : '')),
359
+ className: (0, _classnames["default"])("".concat(_precls["default"], "__e-task-node-title ").concat(isCancel ? "".concat(_precls["default"], "__e-project-node-gray") : "")),
368
360
  onClick: handleShowTaskDetail
369
361
  }, /*#__PURE__*/_react["default"].createElement(TooltipText, {
370
362
  text: (0, _helpers.escapeHtml)(title),
@@ -376,10 +368,12 @@ function ETaskNode(props) {
376
368
  }, /*#__PURE__*/_react["default"].createElement(_avatar["default"].Text, {
377
369
  name: user === null || user === void 0 ? void 0 : user.name,
378
370
  id: user === null || user === void 0 ? void 0 : user.userId,
379
- width: 64,
371
+ width: 92,
380
372
  editable: dataInfo.status !== 2 && hasEditAuth,
381
373
  onEditUser: onEditUserHandler,
382
374
  isGetRoot: true,
375
+ showAvatar: true,
376
+ avatar: user === null || user === void 0 ? void 0 : user.avatar,
383
377
  extraCls: (isCancel || isGray) && "".concat(_precls["default"], "__e-project-node-gray")
384
378
  })), /*#__PURE__*/_react["default"].createElement("span", {
385
379
  className: (0, _classnames["default"])("".concat(_precls["default"], "__e-task-node-actions-date")),
@@ -397,11 +391,11 @@ function ETaskNode(props) {
397
391
  percent: progress,
398
392
  linear: true,
399
393
  linearId: data.taskId,
400
- linearStartColor: (0, _getProcessColor["default"])(dataInfo.riskLevel, 'linearStartColor', dataInfo.status),
401
- linearEndColor: (0, _getProcessColor["default"])(dataInfo.riskLevel, 'linearEndColor', dataInfo.status),
402
- backgroundColor: (0, _getProcessColor["default"])(dataInfo.riskLevel, 'backgroundColor', dataInfo.status)
394
+ linearStartColor: (0, _getProcessColor["default"])(dataInfo.riskLevel, "linearStartColor", dataInfo.status),
395
+ linearEndColor: (0, _getProcessColor["default"])(dataInfo.riskLevel, "linearEndColor", dataInfo.status),
396
+ backgroundColor: (0, _getProcessColor["default"])(dataInfo.riskLevel, "backgroundColor", dataInfo.status)
403
397
  })), okrInfo.status === 1 && hasRelation && (hasRelativeAuth || isParticipant) ? /*#__PURE__*/_react["default"].createElement(_tooltip["default"], {
404
- overlay: (0, _getLocale.getLocale)('OKR_MyO_Text_Cancel'),
398
+ overlay: (0, _getLocale.getLocale)("OKR_MyO_Text_Cancel"),
405
399
  placement: "top"
406
400
  }, /*#__PURE__*/_react["default"].createElement("span", {
407
401
  className: (0, _classnames["default"])("".concat(_precls["default"], "__e-task-node-actions-connect")),
@@ -415,17 +409,17 @@ function ETaskNode(props) {
415
409
  type: "warning"
416
410
  }, /*#__PURE__*/_react["default"].createElement("span", {
417
411
  type: "title"
418
- }, (0, _getLocale.getLocale)('OKR_MyO_Text_Cancelass')), /*#__PURE__*/_react["default"].createElement("span", {
412
+ }, (0, _getLocale.getLocale)("OKR_MyO_Text_Cancelass")), /*#__PURE__*/_react["default"].createElement("span", {
419
413
  type: "content"
420
- }, (0, _getLocale.getLocale)('OKR_MyO_Text_TtasknotO')), /*#__PURE__*/_react["default"].createElement(_dialogConfirm.CancelButton, {
414
+ }, (0, _getLocale.getLocale)("OKR_MyO_Text_TtasknotO")), /*#__PURE__*/_react["default"].createElement(_dialogConfirm.CancelButton, {
421
415
  type: "button",
422
416
  onClick: function onClick() {
423
417
  return setUnConnectVisible(false);
424
418
  }
425
- }, (0, _getLocale.getLocale)('Mod_Cancel')), /*#__PURE__*/_react["default"].createElement(_dialogConfirm.SureButton, {
419
+ }, (0, _getLocale.getLocale)("Mod_Cancel")), /*#__PURE__*/_react["default"].createElement(_dialogConfirm.SureButton, {
426
420
  type: "button",
427
421
  onClick: onSureUnConnectHandler
428
- }, (0, _getLocale.getLocale)('OKR_MyO_Butt_Determine'))));
422
+ }, (0, _getLocale.getLocale)("OKR_MyO_Butt_Determine"))));
429
423
  }
430
424
 
431
425
  var _default = ETaskNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@titaui/pc",
3
- "version": "1.11.4-8",
3
+ "version": "1.11.4-9",
4
4
  "nameCN": "",
5
5
  "description": "",
6
6
  "main": "lib/index.js",