@titaui/pc 1.12.7 → 1.12.9-beta.2

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.
Files changed (100) hide show
  1. package/lib/components/change-okr-modal/Item.js +19 -18
  2. package/lib/components/change-okr-modal/styledComponents.js +9 -9
  3. package/lib/components/create-okr-modal/createSuccessCmp.js +47 -19
  4. package/lib/components/create-okr-modal/fields/index.css +14 -3
  5. package/lib/components/create-okr-modal/fields/o-new-name.js +31 -20
  6. package/lib/components/create-okr-modal/fields/okr-case.js +7 -5
  7. package/lib/components/create-okr-modal/fields/okr-parent.js +7 -5
  8. package/lib/components/create-okr-modal/index.js +215 -142
  9. package/lib/components/create-okr-modal/kr-items/index.css +23 -13
  10. package/lib/components/create-okr-modal/kr-items/krDatas.js +96 -76
  11. package/lib/components/create-okr-modal/kr-items/krItem.js +54 -57
  12. package/lib/components/create-okr-modal/style.js +5 -5
  13. package/lib/components/dynamic/components/title/index.js +1 -1
  14. package/lib/components/dynamic/dynamic-item/components/feed-operate/index.js +7 -7
  15. package/lib/components/dynamic/dynamic-item/dynamic-align/index.js +7 -7
  16. package/lib/components/dynamic/dynamic-item/dynamic-create-o/index.js +17 -17
  17. package/lib/components/dynamic/dynamic-item/dynamic-kr/index.js +3 -1
  18. package/lib/components/dynamic/dynamic-item/dynamic-relative/index.js +9 -9
  19. package/lib/components/dynamic/dynamic-item/dynamic-reply/index.js +3 -1
  20. package/lib/components/dynamic/dynamic-item/dynamic-task/index.js +3 -1
  21. package/lib/components/eReport/eReportLists/reportList.js +29 -30
  22. package/lib/components/eReport/eReportShare/style.js +1 -1
  23. package/lib/components/edit-kr-wight/EditKrWightModal.js +11 -9
  24. package/lib/components/nav-top/components/menu/index.js +3 -3
  25. package/lib/components/nav-top/components/user-message/components/inform/inform-item.js +1 -1
  26. package/lib/components/nav-top/components/user-message/components/todos/todo-item.js +3 -3
  27. package/lib/components/okr-detail/components/ao-nice/index.css +0 -1
  28. package/lib/components/okr-detail/components/header/edit-name.js +76 -39
  29. package/lib/components/okr-detail/components/header/index.css +122 -41
  30. package/lib/components/okr-detail/components/header/index.js +45 -48
  31. package/lib/components/okr-detail/components/header/o-classify.js +154 -0
  32. package/lib/components/okr-detail/components/header/o-name.js +7 -5
  33. package/lib/components/okr-detail/components/o-progress-update/index.js +2 -2
  34. package/lib/components/okr-detail/components/okr-tree/tree-node/e-kr-node/index.js +3 -1
  35. package/lib/components/okr-detail/components/okr-tree/tree-node/kr-node/index.css +66 -4
  36. package/lib/components/okr-detail/components/okr-tree/tree-node/kr-node/index.js +174 -64
  37. package/lib/components/okr-detail/components/okr-tree/tree-node/o-child-node/index.js +9 -9
  38. package/lib/components/okr-detail/components/okr-tree/tree-node/o-parent-node/index.js +15 -13
  39. package/lib/components/okr-detail/components/tab-panel-content/index.css +1 -0
  40. package/lib/components/okr-detail/detail-header/index.js +11 -5
  41. package/lib/components/okr-detail/okr-list/create-kr-item/index.css +17 -0
  42. package/lib/components/okr-detail/okr-list/create-kr-item/index.js +75 -53
  43. package/lib/components/okr-detail/okr-list/index.css +9 -0
  44. package/lib/components/okr-detail/okr-list/index.js +25 -25
  45. package/lib/components/okr-detail/request-apis.js +73 -69
  46. package/lib/components/okr-detail/schedule/components/kr-progress/index.js +3 -1
  47. package/lib/components/okr-detail/schedule/components/o-progress/index.js +34 -32
  48. package/lib/components/okr-detail/schedule/components/sub-o-progress/index.js +3 -1
  49. package/lib/components/okr-flow/child-node/kr-node.js +3 -1
  50. package/lib/components/okr-flow/child-node/work-node.js +3 -1
  51. package/lib/components/okr-flow/export-modal/color.png +0 -0
  52. package/lib/components/okr-flow/export-modal/index.css +28 -13
  53. package/lib/components/okr-flow/export-modal/index.js +57 -14
  54. package/lib/components/okr-flow/export-modal/trans1.png +0 -0
  55. package/lib/components/okr-progress/components/kr-progress/index.js +5 -3
  56. package/lib/components/okr-progress/components/o-progress/index.js +3 -1
  57. package/lib/components/okr-progress/components/o-progress-update/index.js +2 -2
  58. package/lib/components/okr-progress/components/sub-o-progress/index.js +3 -1
  59. package/lib/components/okr-review/ReviewPop/components/ReviewBody/index.js +3 -3
  60. package/lib/components/okr-share/common-painter/openDataPainter.js +9 -6
  61. package/lib/components/okr-share/common-painter/utils.js +187 -36
  62. package/lib/components/okr-share/index.css +5 -4
  63. package/lib/components/okr-share/pink-card/card.js +3 -3
  64. package/lib/components/okr-share/pink-card/drawKrs.js +97 -18
  65. package/lib/components/okr-share/pink-card/index.js +20 -12
  66. package/lib/components/open-data-painter/index.js +6 -5
  67. package/lib/components/period-selector/components/button/style.js +1 -1
  68. package/lib/components/period-selector/index.css +1 -0
  69. package/lib/components/period-selector/index.js +7 -2
  70. package/lib/components/search-key-handle/index.js +12 -10
  71. package/lib/components/select-layer/index.js +22 -8
  72. package/lib/components/task-relation-modal/helper.js +1 -56
  73. package/lib/components/task-relation-modal/okr-relation/relation-task-model/search-form.js +1 -4
  74. package/lib/components/task-relation-modal/okr-relation/request-api.js +2 -6
  75. package/lib/components/task-relation-modal/okr-relation/tree/task-tree/index.css +2 -2
  76. package/lib/components/task-relation-modal/request-api.js +5 -2
  77. package/lib/components/task-relation-modal/tree/work-tree/index.js +27 -31
  78. package/lib/components/task-relation-modal/tree/work-tree/search-form.js +22 -3
  79. package/lib/components/task-relation-modal/tree-node/kr-node/index.js +4 -4
  80. package/lib/components/task-relation-modal/tree-node/o-node/index.js +8 -8
  81. package/lib/components/task-relation-modal/tree-node/work-node/index.js +11 -11
  82. package/lib/components/tooltip/tooltip.js +9 -4
  83. package/lib/components/upload/components/uploadedPreview.js +17 -17
  84. package/lib/components/upload/index.js +23 -23
  85. package/lib/components/user-selector/category-selector-panel/depart-tree.js +3 -1
  86. package/lib/components/user-selector/export-modules/field-tree-selector/index.css +2 -1
  87. package/lib/components/user-selector/export-modules/field-tree-selector/index.js +35 -17
  88. package/lib/components/user-selector/export-modules/multiple-user-selector--bak/index.css +1 -1
  89. package/lib/components/user-selector/request-apis.js +20 -5
  90. package/lib/components/user-selector/searched-panel/index.js +9 -5
  91. package/lib/components/wechat-btn/index.css +5 -1
  92. package/lib/components-v1/userSelector/components/SingleMode.js +7 -5
  93. package/lib/pages/home/components/data-list/table/columns/krName.js +3 -1
  94. package/lib/pages/home/components/data-list/table/columns/okrName.js +4 -2
  95. package/lib/pages/new-okr-list/header/index.js +15 -15
  96. package/lib/utils/hooks.js +5 -5
  97. package/lib/utils/open-data.js +216 -66
  98. package/lib/utils/tita-okr-cycle.js +3 -3
  99. package/package.json +2 -1
  100. package/lib/utils/planDataJson.js +0 -11115
@@ -9,10 +9,14 @@ exports["default"] = void 0;
9
9
 
10
10
  var _react = _interopRequireWildcard(require("react"));
11
11
 
12
+ var _richEditor = require("@titaui/rich-editor");
13
+
12
14
  var _uuid = _interopRequireDefault(require("uuid"));
13
15
 
14
16
  var _titaUi = require("tita-ui");
15
17
 
18
+ var _scrollbar = _interopRequireDefault(require("../scrollbar"));
19
+
16
20
  var _bsGlobal = require("../../utils/bs-global");
17
21
 
18
22
  var _roundWeight = require("../../utils/roundWeight");
@@ -108,6 +112,13 @@ var initOCheckResult = function initOCheckResult() {
108
112
  });
109
113
  };
110
114
 
115
+ var DefaultOkrNameData = {
116
+ mentionUsers: [],
117
+ pureText: '',
118
+ pureTextExcludeAt: '',
119
+ richText: undefined
120
+ };
121
+
111
122
  function CreateOkrModal(_ref, ref) {
112
123
  var initCycle = _ref.initCycle,
113
124
  userInfo = _ref.userInfo,
@@ -123,10 +134,15 @@ function CreateOkrModal(_ref, ref) {
123
134
  _ref$isFromAssess = _ref.isFromAssess,
124
135
  isFromAssess = _ref$isFromAssess === void 0 ? false : _ref$isFromAssess;
125
136
 
126
- var _useState = (0, _react.useState)(visible),
137
+ var _useState = (0, _react.useState)('initialization'),
127
138
  _useState2 = _slicedToArray(_useState, 2),
128
- isVisible = _useState2[0],
129
- setVisible = _useState2[1]; // @ts-ignore
139
+ richEditorStatus = _useState2[0],
140
+ setRichEditorStatus = _useState2[1];
141
+
142
+ var _useState3 = (0, _react.useState)(visible),
143
+ _useState4 = _slicedToArray(_useState3, 2),
144
+ isVisible = _useState4[0],
145
+ setVisible = _useState4[1]; // @ts-ignore
130
146
 
131
147
 
132
148
  var userId = BSGlobal.loginUserInfo.Id;
@@ -140,80 +156,80 @@ function CreateOkrModal(_ref, ref) {
140
156
  Id = _ref2.Id,
141
157
  UserAvatar = _ref2.UserAvatar;
142
158
 
143
- var _useState3 = (0, _react.useState)(''),
144
- _useState4 = _slicedToArray(_useState3, 2),
145
- okrName = _useState4[0],
146
- setOkrName = _useState4[1]; // 目标名称
159
+ var _useState5 = (0, _react.useState)(DefaultOkrNameData),
160
+ _useState6 = _slicedToArray(_useState5, 2),
161
+ okrNameData = _useState6[0],
162
+ setOkrNameData = _useState6[1]; // 目标名称
147
163
 
148
164
 
149
- var _useState5 = (0, _react.useState)({
165
+ var _useState7 = (0, _react.useState)({
150
166
  name: Name,
151
167
  id: Id,
152
168
  avatar: UserAvatar
153
169
  }),
154
- _useState6 = _slicedToArray(_useState5, 2),
155
- user = _useState6[0],
156
- setUser = _useState6[1]; // 负责人
170
+ _useState8 = _slicedToArray(_useState7, 2),
171
+ user = _useState8[0],
172
+ setUser = _useState8[1]; // 负责人
157
173
 
158
174
 
159
- var _useState7 = (0, _react.useState)(false),
160
- _useState8 = _slicedToArray(_useState7, 2),
161
- isCustomWeight = _useState8[0],
162
- setIsCustomWeight = _useState8[1]; // 是否自定义权重
175
+ var _useState9 = (0, _react.useState)(false),
176
+ _useState10 = _slicedToArray(_useState9, 2),
177
+ isCustomWeight = _useState10[0],
178
+ setIsCustomWeight = _useState10[1]; // 是否自定义权重
163
179
 
164
180
 
165
- var _useState9 = (0, _react.useState)({
181
+ var _useState11 = (0, _react.useState)({
166
182
  departmentId: 0,
167
183
  departmentName: ''
168
184
  }),
169
- _useState10 = _slicedToArray(_useState9, 2),
170
- dept = _useState10[0],
171
- setDept = _useState10[1]; // 部门信息 用于目标类型为部门时
185
+ _useState12 = _slicedToArray(_useState11, 2),
186
+ dept = _useState12[0],
187
+ setDept = _useState12[1]; // 部门信息 用于目标类型为部门时
172
188
 
173
189
 
174
- var _useState11 = (0, _react.useState)({
190
+ var _useState13 = (0, _react.useState)({
175
191
  groupId: 0,
176
192
  groupName: ''
177
193
  }),
178
- _useState12 = _slicedToArray(_useState11, 2),
179
- team = _useState12[0],
180
- setTeam = _useState12[1]; // 团队信息 用于目标类型为团队时
194
+ _useState14 = _slicedToArray(_useState13, 2),
195
+ team = _useState14[0],
196
+ setTeam = _useState14[1]; // 团队信息 用于目标类型为团队时
181
197
 
182
198
 
183
- var _useState13 = (0, _react.useState)({
199
+ var _useState15 = (0, _react.useState)({
184
200
  typeName: (0, _getLocale.getLocale)('OKR_MyO_Pop_Individual'),
185
201
  typeId: 1
186
202
  }),
187
- _useState14 = _slicedToArray(_useState13, 2),
188
- type = _useState14[0],
189
- setType = _useState14[1]; // 目标类型
190
-
191
-
192
- var _useState15 = (0, _react.useState)(initCycle),
193
203
  _useState16 = _slicedToArray(_useState15, 2),
194
- cycle = _useState16[0],
195
- setCycle = _useState16[1]; // 目标周期信息
204
+ type = _useState16[0],
205
+ setType = _useState16[1]; // 目标类型
196
206
 
197
207
 
198
- var _useState17 = (0, _react.useState)(),
208
+ var _useState17 = (0, _react.useState)(initCycle),
199
209
  _useState18 = _slicedToArray(_useState17, 2),
200
- okrClassify = _useState18[0],
201
- setOkrClassify = _useState18[1]; // 目标类别
210
+ cycle = _useState18[0],
211
+ setCycle = _useState18[1]; // 目标周期信息
202
212
 
203
213
 
204
- var _useState19 = (0, _react.useState)(1),
214
+ var _useState19 = (0, _react.useState)(),
205
215
  _useState20 = _slicedToArray(_useState19, 2),
206
- visibility = _useState20[0],
207
- setVisibility = _useState20[1]; // 可见性
216
+ okrClassify = _useState20[0],
217
+ setOkrClassify = _useState20[1]; // 目标类别
208
218
 
209
219
 
210
- var _useState21 = (0, _react.useState)({}),
220
+ var _useState21 = (0, _react.useState)(1),
211
221
  _useState22 = _slicedToArray(_useState21, 2),
212
- visiableLimit = _useState22[0],
213
- setVisiableLimit = _useState22[1]; // 可见性指定范围
222
+ visibility = _useState22[0],
223
+ setVisibility = _useState22[1]; // 可见性
224
+
225
+
226
+ var _useState23 = (0, _react.useState)({}),
227
+ _useState24 = _slicedToArray(_useState23, 2),
228
+ visiableLimit = _useState24[0],
229
+ setVisiableLimit = _useState24[1]; // 可见性指定范围
214
230
 
215
231
 
216
- var _useState23 = (0, _react.useState)([{
232
+ var _useState25 = (0, _react.useState)([{
217
233
  // kr信息
218
234
  uuid: _uuid["default"].v1(),
219
235
  principalId: Id,
@@ -221,91 +237,94 @@ function CreateOkrModal(_ref, ref) {
221
237
  userAvatar: UserAvatar,
222
238
  krWeight: 100,
223
239
  mileStoneName: '',
240
+ mileStoneNamePureTextExcludeAt: '',
241
+ mileStoneNameRichText: undefined,
242
+ aiteUsers: [],
224
243
  confidenceIndex: 5
225
244
  }]),
226
- _useState24 = _slicedToArray(_useState23, 2),
227
- krDatas = _useState24[0],
228
- setKrDatas = _useState24[1];
245
+ _useState26 = _slicedToArray(_useState25, 2),
246
+ krDatas = _useState26[0],
247
+ setKrDatas = _useState26[1];
229
248
 
230
- var _useState25 = (0, _react.useState)({
249
+ var _useState27 = (0, _react.useState)({
231
250
  // 对其目标
232
251
  parentWorkId: 0,
233
252
  parentWorkName: '',
234
253
  parentType: 0,
235
254
  parentKrId: 0
236
255
  }),
237
- _useState26 = _slicedToArray(_useState25, 2),
238
- parent = _useState26[0],
239
- setParent = _useState26[1];
240
-
241
- var _useState27 = (0, _react.useState)(false),
242
256
  _useState28 = _slicedToArray(_useState27, 2),
243
- oNameIsInput = _useState28[0],
244
- setONameIsInput = _useState28[1];
257
+ parent = _useState28[0],
258
+ setParent = _useState28[1];
245
259
 
246
260
  var _useState29 = (0, _react.useState)(false),
247
261
  _useState30 = _slicedToArray(_useState29, 2),
248
- krIsInput = _useState30[0],
249
- setKrIsInput = _useState30[1];
262
+ oNameIsInput = _useState30[0],
263
+ setONameIsInput = _useState30[1];
250
264
 
251
- var _useState31 = (0, _react.useState)(initOCheckResult()),
265
+ var _useState31 = (0, _react.useState)(false),
252
266
  _useState32 = _slicedToArray(_useState31, 2),
253
- oNameCheckResult = _useState32[0],
254
- setONameCheckResult = _useState32[1];
267
+ krIsInput = _useState32[0],
268
+ setKrIsInput = _useState32[1];
255
269
 
256
- var _useState33 = (0, _react.useState)({
270
+ var _useState33 = (0, _react.useState)(initOCheckResult()),
271
+ _useState34 = _slicedToArray(_useState33, 2),
272
+ oNameCheckResult = _useState34[0],
273
+ setONameCheckResult = _useState34[1];
274
+
275
+ var _useState35 = (0, _react.useState)({
257
276
  finalResult: _okrCreateSuggest.EOkrCreateSuggestResultType.normal,
258
277
  friendlyResult: []
259
278
  }),
260
- _useState34 = _slicedToArray(_useState33, 2),
261
- krsCheckResult = _useState34[0],
262
- setKrsCheckResult = _useState34[1];
263
-
264
- var _useState35 = (0, _react.useState)(false),
265
279
  _useState36 = _slicedToArray(_useState35, 2),
266
- customCloseOSuggest = _useState36[0],
267
- setCustomCloseOSuggest = _useState36[1]; // 用户点击收起后不再自动弹出
268
-
280
+ krsCheckResult = _useState36[0],
281
+ setKrsCheckResult = _useState36[1];
269
282
 
270
283
  var _useState37 = (0, _react.useState)(false),
271
284
  _useState38 = _slicedToArray(_useState37, 2),
272
- customCloseKrSuggest = _useState38[0],
273
- setCustomCloseKrSuggest = _useState38[1];
285
+ customCloseOSuggest = _useState38[0],
286
+ setCustomCloseOSuggest = _useState38[1]; // 用户点击收起后不再自动弹出
287
+
274
288
 
275
- var _useState39 = (0, _react.useState)(),
289
+ var _useState39 = (0, _react.useState)(false),
276
290
  _useState40 = _slicedToArray(_useState39, 2),
277
- createdSuccessInfo = _useState40[0],
278
- setCreatedSuccessInfo = _useState40[1];
291
+ customCloseKrSuggest = _useState40[0],
292
+ setCustomCloseKrSuggest = _useState40[1];
279
293
 
280
- var _useState41 = (0, _react.useState)(false),
294
+ var _useState41 = (0, _react.useState)(),
281
295
  _useState42 = _slicedToArray(_useState41, 2),
282
- showCreatedSuccessInfo = _useState42[0],
283
- setShowCreatedSuccessInfo = _useState42[1];
296
+ createdSuccessInfo = _useState42[0],
297
+ setCreatedSuccessInfo = _useState42[1];
284
298
 
285
- var _useState43 = (0, _react.useState)(Math.floor(Math.random() * 6)),
299
+ var _useState43 = (0, _react.useState)(false),
286
300
  _useState44 = _slicedToArray(_useState43, 2),
287
- tipIndex = _useState44[0],
288
- setTipIndex = _useState44[1];
301
+ showCreatedSuccessInfo = _useState44[0],
302
+ setShowCreatedSuccessInfo = _useState44[1];
289
303
 
290
- var _useState45 = (0, _react.useState)(''),
304
+ var _useState45 = (0, _react.useState)(Math.floor(Math.random() * 6)),
291
305
  _useState46 = _slicedToArray(_useState45, 2),
292
- userAvatarBase64Url = _useState46[0],
293
- setUserAvatarBase64Url = _useState46[1];
306
+ tipIndex = _useState46[0],
307
+ setTipIndex = _useState46[1];
294
308
 
295
- var _useState47 = (0, _react.useState)(false),
309
+ var _useState47 = (0, _react.useState)(''),
296
310
  _useState48 = _slicedToArray(_useState47, 2),
297
- krIsValidate = _useState48[0],
298
- setKrIsValidate = _useState48[1];
311
+ userAvatarBase64Url = _useState48[0],
312
+ setUserAvatarBase64Url = _useState48[1];
299
313
 
300
314
  var _useState49 = (0, _react.useState)(false),
301
315
  _useState50 = _slicedToArray(_useState49, 2),
302
- isApplyTpl = _useState50[0],
303
- setIsApplyTpl = _useState50[1];
316
+ krIsValidate = _useState50[0],
317
+ setKrIsValidate = _useState50[1];
304
318
 
305
319
  var _useState51 = (0, _react.useState)(false),
306
320
  _useState52 = _slicedToArray(_useState51, 2),
307
- isInputContent = _useState52[0],
308
- setIsInputContent = _useState52[1];
321
+ isApplyTpl = _useState52[0],
322
+ setIsApplyTpl = _useState52[1];
323
+
324
+ var _useState53 = (0, _react.useState)(false),
325
+ _useState54 = _slicedToArray(_useState53, 2),
326
+ isInputContent = _useState54[0],
327
+ setIsInputContent = _useState54[1];
309
328
 
310
329
  var wrapperRef = (0, _react.useRef)();
311
330
  var modalRef = (0, _react.useRef)();
@@ -338,7 +357,12 @@ function CreateOkrModal(_ref, ref) {
338
357
  setCase: function setCase(data) {
339
358
  var name = data.name,
340
359
  subelements = data.subelements;
341
- setOkrName(name);
360
+ setOkrNameData({
361
+ mentionUsers: [],
362
+ pureText: name,
363
+ pureTextExcludeAt: name,
364
+ richText: (0, _richEditor.TitaRichEditorInitTextState)(name)
365
+ });
342
366
  setKrDatas(subelements.map(function (s) {
343
367
  return {
344
368
  uuid: _uuid["default"].v1(),
@@ -347,13 +371,21 @@ function CreateOkrModal(_ref, ref) {
347
371
  userAvatar: UserAvatar,
348
372
  krWeight: (0, _roundWeight.RoundWeight)(100 / subelements.length),
349
373
  mileStoneName: s.name,
374
+ mileStoneNamePureTextExcludeAt: '',
375
+ mileStoneNameRichText: (0, _richEditor.TitaRichEditorInitTextState)(s.name),
376
+ aiteUsers: [],
350
377
  confidenceIndex: 5
351
378
  };
352
379
  }));
353
380
  setIsCustomWeight(false);
354
381
  },
355
382
  setData: function setData(data) {
356
- setOkrName(data.okrName);
383
+ setOkrNameData({
384
+ mentionUsers: [],
385
+ pureText: data.okrName,
386
+ pureTextExcludeAt: data.okrName,
387
+ richText: (0, _richEditor.TitaRichEditorInitTextState)(data.okrName)
388
+ });
357
389
  setUser(data.user);
358
390
  },
359
391
  show: showCreateOkrModal,
@@ -403,13 +435,15 @@ function CreateOkrModal(_ref, ref) {
403
435
 
404
436
  var onModalOkHandler = /*#__PURE__*/function () {
405
437
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
406
- var orkNameLengthValidate, visibilityArea, data, krNum, krTotalLength, krAvarageLength, krMeasurableLength, oHasVtWords, callData, workId;
438
+ var mentionUsers, pureText, pureTextExcludeAt, richText, orkNameLengthValidate, visibilityArea, formData, data, krNum, krTotalLength, krAvarageLength, krMeasurableLength, oHasVtWords, callData, workId;
407
439
  return _regeneratorRuntime().wrap(function _callee$(_context) {
408
440
  while (1) {
409
441
  switch (_context.prev = _context.next) {
410
442
  case 0:
411
- if (okrName) {
412
- _context.next = 3;
443
+ mentionUsers = okrNameData.mentionUsers, pureText = okrNameData.pureText, pureTextExcludeAt = okrNameData.pureTextExcludeAt, richText = okrNameData.richText;
444
+
445
+ if (pureText) {
446
+ _context.next = 4;
413
447
  break;
414
448
  }
415
449
 
@@ -419,9 +453,9 @@ function CreateOkrModal(_ref, ref) {
419
453
 
420
454
  return _context.abrupt("return");
421
455
 
422
- case 3:
423
- if (!(okrName.length > 500)) {
424
- _context.next = 6;
456
+ case 4:
457
+ if (!(pureTextExcludeAt.length > 500)) {
458
+ _context.next = 7;
425
459
  break;
426
460
  }
427
461
 
@@ -431,9 +465,9 @@ function CreateOkrModal(_ref, ref) {
431
465
 
432
466
  return _context.abrupt("return");
433
467
 
434
- case 6:
468
+ case 7:
435
469
  if (allKrHasName) {
436
- _context.next = 10;
470
+ _context.next = 11;
437
471
  break;
438
472
  }
439
473
 
@@ -444,13 +478,15 @@ function CreateOkrModal(_ref, ref) {
444
478
  setKrIsValidate(true);
445
479
  return _context.abrupt("return");
446
480
 
447
- case 10:
481
+ case 11:
448
482
  orkNameLengthValidate = krDatas.filter(function (kr) {
449
- return kr.mileStoneName.trim().length > 500;
483
+ var _trim;
484
+
485
+ return ((_trim = (kr.mileStoneNamePureTextExcludeAt || '').trim()) === null || _trim === void 0 ? void 0 : _trim.length) > 500;
450
486
  }).length == 0;
451
487
 
452
488
  if (orkNameLengthValidate) {
453
- _context.next = 14;
489
+ _context.next = 15;
454
490
  break;
455
491
  }
456
492
 
@@ -460,11 +496,11 @@ function CreateOkrModal(_ref, ref) {
460
496
 
461
497
  return _context.abrupt("return");
462
498
 
463
- case 14:
499
+ case 15:
464
500
  setKrIsValidate(false);
465
501
 
466
502
  if (krWeightValid) {
467
- _context.next = 18;
503
+ _context.next = 19;
468
504
  break;
469
505
  }
470
506
 
@@ -474,27 +510,32 @@ function CreateOkrModal(_ref, ref) {
474
510
 
475
511
  return _context.abrupt("return");
476
512
 
477
- case 18:
513
+ case 19:
478
514
  if (cycle) {
479
- _context.next = 20;
515
+ _context.next = 21;
480
516
  break;
481
517
  }
482
518
 
483
519
  return _context.abrupt("return");
484
520
 
485
- case 20:
521
+ case 21:
486
522
  handleCreatedClose();
487
523
  visibilityArea = formatVisiableLimit();
488
- _context.next = 24;
489
- return (0, _requestApi.createWidthKr)(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
524
+ formData = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
490
525
  krInfos: krDatas.map(function (kr) {
526
+ // @ts-ignore
527
+ delete kr.mileStoneNamePureTextExcludeAt;
491
528
  return _objectSpread(_objectSpread({}, kr), {}, {
492
529
  startDate: cycle.startDate,
493
530
  endDate: cycle.endDate
494
531
  });
495
532
  })
496
533
  }, cycle), {}, {
497
- workName: okrName
534
+ workName: pureText,
535
+ workNameRichText: richText,
536
+ aiteUsers: mentionUsers === null || mentionUsers === void 0 ? void 0 : mentionUsers.map(function (user) {
537
+ return user.mentionId;
538
+ })
498
539
  }, parent), {}, {
499
540
  workType: 6,
500
541
  visibility: visibility,
@@ -507,13 +548,15 @@ function CreateOkrModal(_ref, ref) {
507
548
  }]
508
549
  }, visibilityArea), {}, {
509
550
  CreateFromAssess: isFromAssess
510
- }));
551
+ });
552
+ _context.next = 26;
553
+ return (0, _requestApi.createWidthKr)(formData);
511
554
 
512
- case 24:
555
+ case 26:
513
556
  data = _context.sent;
514
557
 
515
558
  if (!(data.Code === 0)) {
516
- _context.next = 28;
559
+ _context.next = 30;
517
560
  break;
518
561
  }
519
562
 
@@ -523,7 +566,7 @@ function CreateOkrModal(_ref, ref) {
523
566
 
524
567
  return _context.abrupt("return");
525
568
 
526
- case 28:
569
+ case 30:
527
570
  hideCreateOkrModal();
528
571
 
529
572
  if (onSuccess || !isHiddenCreatedCard) {
@@ -531,8 +574,10 @@ function CreateOkrModal(_ref, ref) {
531
574
  krNum = krDatas.length;
532
575
  krTotalLength = 0;
533
576
  krDatas && krDatas.forEach(function (kr) {
577
+ var _kr$mileStoneNamePure;
578
+
534
579
  // 计算平均长度要去掉百分号和数字
535
- krTotalLength += kr.mileStoneName.replace(/(%|\d)/g, '').length;
580
+ krTotalLength += (_kr$mileStoneNamePure = kr.mileStoneNamePureTextExcludeAt) === null || _kr$mileStoneNamePure === void 0 ? void 0 : _kr$mileStoneNamePure.replace(/(%|\d)/g, '').length;
536
581
  });
537
582
  krAvarageLength = krDatas.length > 0 ? krTotalLength / krDatas.length : 0;
538
583
  krMeasurableLength = krsCheckResult.friendlyResult.filter(function (kr) {
@@ -540,7 +585,7 @@ function CreateOkrModal(_ref, ref) {
540
585
  }).length;
541
586
  oHasVtWords = oNameCheckResult[0].result === _okrCreateSuggest.EOkrCreateSuggestResultType.correct;
542
587
  callData = data;
543
- callData.countSurpassPercentage = (0, _getCreateOkrSurpassPercent["default"])(okrName.replace(/(%|\d)/g, '').length, oHasVtWords, krNum, krMeasurableLength, Number.parseInt(krAvarageLength.toString()));
588
+ callData.countSurpassPercentage = (0, _getCreateOkrSurpassPercent["default"])(okrNameData.pureTextExcludeAt.replace(/(%|\d)/g, '').length, oHasVtWords, krNum, krMeasurableLength, Number.parseInt(krAvarageLength.toString()));
544
589
  newOkrDataRef.current = callData;
545
590
  handleOnSuccess();
546
591
  } else {
@@ -553,7 +598,7 @@ function CreateOkrModal(_ref, ref) {
553
598
 
554
599
  setIsApplyTpl(false);
555
600
 
556
- case 31:
601
+ case 33:
557
602
  case "end":
558
603
  return _context.stop();
559
604
  }
@@ -570,20 +615,33 @@ function CreateOkrModal(_ref, ref) {
570
615
  var OnOkRApplyTplHandler = function OnOkRApplyTplHandler(data) {
571
616
  var name = data.name,
572
617
  subelements = data.subelements;
573
- setOkrName(name);
574
- setKrDatas(subelements.map(function (s) {
618
+ setOkrNameData(function () {
575
619
  return {
576
- uuid: _uuid["default"].v1(),
577
- principalId: Id,
578
- principalName: Name,
579
- userAvatar: UserAvatar,
580
- krWeight: (0, _roundWeight.RoundWeight)(100 / subelements.length),
581
- mileStoneName: s.name,
582
- confidenceIndex: 5
620
+ mentionUsers: [],
621
+ pureText: name,
622
+ pureTextExcludeAt: name,
623
+ richText: (0, _richEditor.TitaRichEditorInitTextState)(name)
583
624
  };
584
- }));
625
+ });
626
+ setKrDatas(function () {
627
+ return subelements.map(function (s) {
628
+ return {
629
+ uuid: _uuid["default"].v1(),
630
+ principalId: Id,
631
+ principalName: Name,
632
+ userAvatar: UserAvatar,
633
+ krWeight: (0, _roundWeight.RoundWeight)(100 / subelements.length),
634
+ mileStoneName: s.name,
635
+ mileStoneNamePureTextExcludeAt: s.name,
636
+ mileStoneNameRichText: (0, _richEditor.TitaRichEditorInitTextState)(s.name),
637
+ aiteUsers: [],
638
+ confidenceIndex: 5
639
+ };
640
+ });
641
+ });
585
642
  setIsCustomWeight(false);
586
643
  setIsApplyTpl(true);
644
+ setRichEditorStatus('refresh');
587
645
  };
588
646
 
589
647
  (0, _react.useEffect)(function () {
@@ -595,9 +653,12 @@ function CreateOkrModal(_ref, ref) {
595
653
  userAvatar: UserAvatar,
596
654
  krWeight: 100,
597
655
  mileStoneName: '',
656
+ mileStoneNamePureTextExcludeAt: '',
657
+ mileStoneNameRichText: undefined,
658
+ aiteUsers: [],
598
659
  confidenceIndex: 5
599
660
  }]);
600
- setOkrName('');
661
+ setOkrNameData(DefaultOkrNameData);
601
662
  setUser({
602
663
  name: Name,
603
664
  id: Id,
@@ -622,6 +683,10 @@ function CreateOkrModal(_ref, ref) {
622
683
  parentKrId: 0
623
684
  });
624
685
  }
686
+
687
+ return function () {
688
+ return setRichEditorStatus('initialization');
689
+ };
625
690
  }, [isVisible]);
626
691
  var handleONameSuggestClose = (0, _react.useCallback)(function () {
627
692
  setONameIsInput(false);
@@ -733,7 +798,11 @@ function CreateOkrModal(_ref, ref) {
733
798
  className: "create-modal__title"
734
799
  }, (0, _getLocale.getLocale)('OKR_MyO_Pop_Title_Newobjective')), /*#__PURE__*/_react["default"].createElement(_okrCase["default"], {
735
800
  okrTemplateEnabled: true,
736
- onOkrApply: OnOkRApplyTplHandler
801
+ onOkrApply: OnOkRApplyTplHandler,
802
+ onVisibleChange: function onVisibleChange() {
803
+ setIsApplyTpl(false);
804
+ setRichEditorStatus('initialization');
805
+ }
737
806
  }));
738
807
  }, []);
739
808
  var krCheckFinalResult = (0, _react.useMemo)(function () {
@@ -841,17 +910,21 @@ function CreateOkrModal(_ref, ref) {
841
910
  }
842
911
  }, /*#__PURE__*/_react["default"].createElement(_style.Wrapper, {
843
912
  ref: wrapperRef
913
+ }, /*#__PURE__*/_react["default"].createElement(_scrollbar["default"], null, /*#__PURE__*/_react["default"].createElement("div", {
914
+ className: "create-modal__wrapper-inner"
844
915
  }, /*#__PURE__*/_react["default"].createElement(_oNewName["default"], {
845
916
  container: modalRef,
917
+ richEditorStatus: richEditorStatus,
918
+ key: richEditorStatus,
846
919
  user: user,
847
920
  setUser: setUser,
848
- okrName: okrName,
849
- setOkrName: setOkrName,
921
+ okrNameData: okrNameData,
922
+ setOkrNameData: setOkrNameData,
850
923
  onOInputFocusStateChange: handleOInputFocusStateChange,
851
924
  setONameCheckResult: setONameCheckResult,
852
925
  setIsInputContent: setIsInputContent
853
926
  }), /*#__PURE__*/_react["default"].createElement(_krDatas["default"], {
854
- krs: krDatas,
927
+ isApplyTpl: isApplyTpl,
855
928
  isCustomWeight: isCustomWeight,
856
929
  wrapperRef: wrapperRef,
857
930
  krDatas: krDatas,
@@ -901,29 +974,29 @@ function CreateOkrModal(_ref, ref) {
901
974
  okrClassify: okrClassify,
902
975
  setOkrClassify: setOkrClassify,
903
976
  isCreateModal: true
904
- }))), !customCloseOSuggest && oNameIsInput ? /*#__PURE__*/_react["default"].createElement(_okrCreateSuggest["default"], {
977
+ }))))), /*#__PURE__*/_react["default"].createElement("img", {
978
+ className: "teach-suggest teach-suggest__o",
979
+ src: _hand["default"],
980
+ onClick: handleShowOSuggest
981
+ }), /*#__PURE__*/_react["default"].createElement("img", {
982
+ className: "teach-suggest teach-suggest__kr",
983
+ src: _hand["default"],
984
+ onClick: handleShowKrSuggest
985
+ }), !customCloseOSuggest && oNameIsInput ? /*#__PURE__*/_react["default"].createElement(_okrCreateSuggest["default"], {
905
986
  isInput: isInputContent,
906
987
  isOSuggest: true,
907
988
  descs: (0, _constant.getODesc)(),
908
989
  example: (0, _constant.getOExample)(),
909
990
  results: oNameCheckResult,
910
991
  handleClose: handleONameSuggestClose
911
- }) : null, /*#__PURE__*/_react["default"].createElement("img", {
912
- className: "teach-suggest teach-suggest__o",
913
- src: _hand["default"],
914
- onClick: handleShowOSuggest
915
- }), !customCloseKrSuggest && krIsInput ? /*#__PURE__*/_react["default"].createElement(_okrCreateSuggest["default"], {
992
+ }) : null, !customCloseKrSuggest && krIsInput ? /*#__PURE__*/_react["default"].createElement(_okrCreateSuggest["default"], {
916
993
  isInput: isInputContent,
917
994
  isOSuggest: false,
918
995
  descs: (0, _constant.getKrDesc)(),
919
996
  example: (0, _constant.KrExample)(),
920
997
  results: krCheckFinalResult,
921
998
  handleClose: handleKrSuggestClose
922
- }) : null, /*#__PURE__*/_react["default"].createElement("img", {
923
- className: "teach-suggest teach-suggest__kr",
924
- src: _hand["default"],
925
- onClick: handleShowKrSuggest
926
- })))), !isApplyTpl && !isHiddenCreatedCard && showCreatedSuccessInfo ? /*#__PURE__*/_react["default"].createElement(_createSuccessCmpWrapper["default"], null, /*#__PURE__*/_react["default"].createElement(_createSuccessCmp["default"], {
999
+ }) : null))), !isApplyTpl && !isHiddenCreatedCard && showCreatedSuccessInfo ? /*#__PURE__*/_react["default"].createElement(_createSuccessCmpWrapper["default"], null, /*#__PURE__*/_react["default"].createElement(_createSuccessCmp["default"], {
927
1000
  tipIndex: tipIndex,
928
1001
  createdSuccessInfo: createdSuccessInfo,
929
1002
  isDownload: false,