@titaui/pc 1.5.82 → 1.5.83

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 (319) hide show
  1. package/lib/components/avatar/icon-avatar/index.css +15 -0
  2. package/lib/components/avatar/icon-avatar/index.js +50 -0
  3. package/lib/components/avatar/index.js +9 -1
  4. package/lib/components/avatar/num-avatar/index.css +12 -0
  5. package/lib/components/avatar/num-avatar/index.js +34 -0
  6. package/lib/components/button/admin-button/default.js +35 -0
  7. package/lib/components/button/admin-button/drop-down-arrow.js +93 -0
  8. package/lib/components/button/admin-button/index.css +86 -0
  9. package/lib/components/button/admin-button/index.js +40 -0
  10. package/lib/components/button/admin-button/primary.js +33 -0
  11. package/lib/components/button/admin-button/secondary.js +35 -0
  12. package/lib/components/button/default-button/index.css +49 -0
  13. package/lib/components/button/default-button/index.js +51 -0
  14. package/lib/components/button/export-button/index.css +51 -0
  15. package/lib/components/button/export-button/index.js +81 -0
  16. package/lib/components/button/images/daoru.svg +18 -0
  17. package/lib/components/button/index.js +23 -0
  18. package/lib/components/button/interface.js +5 -0
  19. package/lib/components/change-okr/Filter.js +133 -65
  20. package/lib/components/change-okr/Item.js +6 -0
  21. package/lib/components/change-okr/filterTab.js +2 -0
  22. package/lib/components/change-okr/index.js +2 -2
  23. package/lib/components/checkbox/index.js +4 -3
  24. package/lib/components/communication/CommunicationRecord.js +116 -161
  25. package/lib/components/communication/ConvertUserName.js +1 -1
  26. package/lib/components/communication/index.css +63 -0
  27. package/lib/components/communication/index.js +53 -28
  28. package/lib/components/communication/style.js +21 -25
  29. package/lib/components/create-okr/animation/check-animation.js +2746 -0
  30. package/lib/components/create-okr/constant.js +27 -0
  31. package/lib/components/create-okr/createCycle.js +193 -0
  32. package/lib/components/create-okr/createSuccessCmp.js +233 -0
  33. package/lib/components/create-okr/createSuccessCmpWrapper.js +20 -0
  34. package/lib/components/create-okr/fields/date-cycle.js +98 -0
  35. package/lib/components/create-okr/fields/index.css +346 -0
  36. package/lib/components/create-okr/fields/index.js +17 -0
  37. package/lib/components/create-okr/fields/input-with-err-popup.js +57 -0
  38. package/lib/components/create-okr/fields/o-new-name.js +197 -0
  39. package/lib/components/create-okr/fields/okr-case.js +98 -0
  40. package/lib/components/create-okr/fields/okr-classify.js +51 -0
  41. package/lib/components/create-okr/fields/okr-create-suggest.js +147 -0
  42. package/lib/components/create-okr/fields/okr-new-user-selector.js +106 -0
  43. package/lib/components/create-okr/fields/okr-parent.js +157 -0
  44. package/lib/components/create-okr/fields/okr-type-detail.js +196 -0
  45. package/lib/components/create-okr/fields/okr-type.js +131 -0
  46. package/lib/components/create-okr/fields/okr-visibility-detail.js +224 -0
  47. package/lib/components/create-okr/fields/okr-visibility.js +169 -0
  48. package/lib/components/create-okr/img/check-normal.svg +29 -0
  49. package/lib/components/create-okr/img/check-right.svg +16 -0
  50. package/lib/components/create-okr/img/check-wrong.svg +29 -0
  51. package/lib/components/create-okr/img/create-success-head.png +0 -0
  52. package/lib/components/create-okr/img/create-success-left-quotation.svg +14 -0
  53. package/lib/components/create-okr/img/create-success-message.svg +1 -0
  54. package/lib/components/create-okr/img/create-success-right-quotation.svg +14 -0
  55. package/lib/components/create-okr/img/create-success-shadow.svg +23 -0
  56. package/lib/components/create-okr/img/example.svg +11 -0
  57. package/lib/components/create-okr/img/hand.svg +12 -0
  58. package/lib/components/create-okr/img/kr-add.svg +12 -0
  59. package/lib/components/create-okr/img/left-quotation.svg +12 -0
  60. package/lib/components/create-okr/img/light.svg +1 -0
  61. package/lib/components/create-okr/img/pack-up.js +28 -0
  62. package/lib/components/create-okr/img/qr-code.png +0 -0
  63. package/lib/components/create-okr/img/right-quotation.svg +12 -0
  64. package/lib/components/create-okr/img/shower.png +0 -0
  65. package/lib/components/create-okr/img/target.svg +19 -0
  66. package/lib/components/create-okr/img/teach-okr.svg +17 -0
  67. package/lib/components/create-okr/img/wave.png +0 -0
  68. package/lib/components/create-okr/img/weight.svg +12 -0
  69. package/lib/components/create-okr/index.css +446 -0
  70. package/lib/components/create-okr/index.js +911 -0
  71. package/lib/components/create-okr/interface.js +5 -0
  72. package/lib/components/create-okr/kr-items/index.css +180 -0
  73. package/lib/components/create-okr/kr-items/kr-item-weight.js +194 -0
  74. package/lib/components/create-okr/kr-items/krDatas.js +299 -0
  75. package/lib/components/create-okr/kr-items/krItem.js +167 -0
  76. package/lib/components/create-okr/objectType.js +273 -0
  77. package/lib/components/create-okr/request-api.js +220 -0
  78. package/lib/components/create-okr/style.js +100 -0
  79. package/lib/components/create-okr/utils/getCreateOkrSurpassPercent.js +124 -0
  80. package/lib/components/create-okr/utils/helper.js +99 -0
  81. package/lib/components/create-okr/utils/index.js +23 -0
  82. package/lib/components/dropdown-layer/icon-item.js +5 -3
  83. package/lib/components/dropdown-layer/index.css +16 -0
  84. package/lib/components/dropdown-layer/index.js +21 -14
  85. package/lib/components/dynamic/components/condition-render/index.js +20 -0
  86. package/lib/components/dynamic/components/dangerous-html/index.js +22 -0
  87. package/lib/components/dynamic/components/dynamic-search-input/index.css +78 -0
  88. package/lib/components/dynamic/components/dynamic-search-input/index.js +192 -0
  89. package/lib/components/dynamic/components/obj-status/index.css +22 -0
  90. package/lib/components/dynamic/components/obj-status/index.js +38 -0
  91. package/lib/components/dynamic/components/percent/index.css +21 -0
  92. package/lib/components/dynamic/components/percent/index.js +38 -0
  93. package/lib/components/dynamic/components/title/index.css +35 -0
  94. package/lib/components/dynamic/components/title/index.js +59 -0
  95. package/lib/components/dynamic/constant.js +97 -0
  96. package/lib/components/dynamic/context/index.js +13 -0
  97. package/lib/components/dynamic/dynamic-item/components/header/index.css +101 -0
  98. package/lib/components/dynamic/dynamic-item/components/header/index.js +299 -0
  99. package/lib/components/dynamic/dynamic-item/components/icon/index.css +10 -0
  100. package/lib/components/dynamic/dynamic-item/components/icon/index.js +35 -0
  101. package/lib/components/dynamic/dynamic-item/dynamic-align/img/dynamic-align.svg +22 -0
  102. package/lib/components/dynamic/dynamic-item/dynamic-align/img/dynamic-relative.svg +22 -0
  103. package/lib/components/dynamic/dynamic-item/dynamic-align/index.css +95 -0
  104. package/lib/components/dynamic/dynamic-item/dynamic-align/index.js +173 -0
  105. package/lib/components/dynamic/dynamic-item/dynamic-announcement/index.css +59 -0
  106. package/lib/components/dynamic/dynamic-item/dynamic-announcement/index.js +107 -0
  107. package/lib/components/dynamic/dynamic-item/dynamic-assessment/index.css +48 -0
  108. package/lib/components/dynamic/dynamic-item/dynamic-assessment/index.js +89 -0
  109. package/lib/components/dynamic/dynamic-item/dynamic-create-o/index.css +96 -0
  110. package/lib/components/dynamic/dynamic-item/dynamic-create-o/index.js +171 -0
  111. package/lib/components/dynamic/dynamic-item/dynamic-kr/index.css +67 -0
  112. package/lib/components/dynamic/dynamic-item/dynamic-kr/index.js +110 -0
  113. package/lib/components/dynamic/dynamic-item/dynamic-milestone/constant.js +16 -0
  114. package/lib/components/dynamic/dynamic-item/dynamic-milestone/img/milestone.png +0 -0
  115. package/lib/components/dynamic/dynamic-item/dynamic-milestone/index.css +111 -0
  116. package/lib/components/dynamic/dynamic-item/dynamic-milestone/index.js +158 -0
  117. package/lib/components/dynamic/dynamic-item/dynamic-progress/index.css +95 -0
  118. package/lib/components/dynamic/dynamic-item/dynamic-progress/index.js +215 -0
  119. package/lib/components/dynamic/dynamic-item/dynamic-project/constant.js +16 -0
  120. package/lib/components/dynamic/dynamic-item/dynamic-project/img/project.png +0 -0
  121. package/lib/components/dynamic/dynamic-item/dynamic-project/index.css +91 -0
  122. package/lib/components/dynamic/dynamic-item/dynamic-project/index.js +125 -0
  123. package/lib/components/dynamic/dynamic-item/dynamic-relative/img/dynamic-relative.svg +22 -0
  124. package/lib/components/dynamic/dynamic-item/dynamic-relative/index.css +95 -0
  125. package/lib/components/dynamic/dynamic-item/dynamic-relative/index.js +192 -0
  126. package/lib/components/dynamic/dynamic-item/dynamic-replay/index.css +138 -0
  127. package/lib/components/dynamic/dynamic-item/dynamic-replay/index.js +183 -0
  128. package/lib/components/dynamic/dynamic-item/dynamic-report/index.css +153 -0
  129. package/lib/components/dynamic/dynamic-item/dynamic-report/index.js +138 -0
  130. package/lib/components/dynamic/dynamic-item/dynamic-reward/index.css +97 -0
  131. package/lib/components/dynamic/dynamic-item/dynamic-reward/index.js +207 -0
  132. package/lib/components/dynamic/dynamic-item/dynamic-share/index.css +59 -0
  133. package/lib/components/dynamic/dynamic-item/dynamic-share/index.js +107 -0
  134. package/lib/components/dynamic/dynamic-item/dynamic-task/constant.js +50 -0
  135. package/lib/components/dynamic/dynamic-item/dynamic-task/img/task-cancel.png +0 -0
  136. package/lib/components/dynamic/dynamic-item/dynamic-task/img/task-delay.png +0 -0
  137. package/lib/components/dynamic/dynamic-item/dynamic-task/img/task-done.png +0 -0
  138. package/lib/components/dynamic/dynamic-item/dynamic-task/img/task-pause.png +0 -0
  139. package/lib/components/dynamic/dynamic-item/dynamic-task/img/task-progress.png +0 -0
  140. package/lib/components/dynamic/dynamic-item/dynamic-task/img/task-unaccept.png +0 -0
  141. package/lib/components/dynamic/dynamic-item/dynamic-task/img/task-unstart.png +0 -0
  142. package/lib/components/dynamic/dynamic-item/dynamic-task/index.css +111 -0
  143. package/lib/components/dynamic/dynamic-item/dynamic-task/index.js +164 -0
  144. package/lib/components/dynamic/dynamic-item/index.css +128 -0
  145. package/lib/components/dynamic/dynamic-item/index.js +352 -0
  146. package/lib/components/dynamic/dynamic-like-ranking/image/like-ranking.svg +23 -0
  147. package/lib/components/dynamic/dynamic-like-ranking/image/ranking-1.png +0 -0
  148. package/lib/components/dynamic/dynamic-like-ranking/image/ranking-2.png +0 -0
  149. package/lib/components/dynamic/dynamic-like-ranking/image/ranking-3.png +0 -0
  150. package/lib/components/dynamic/dynamic-like-ranking/index.css +126 -0
  151. package/lib/components/dynamic/dynamic-like-ranking/index.js +157 -0
  152. package/lib/components/dynamic/dynamic-like-ranking/item.js +107 -0
  153. package/lib/components/dynamic/dynamic-like-ranking/mock.js +84 -0
  154. package/lib/components/dynamic/dynamic-liking/image/like-dynamic.svg +30 -0
  155. package/lib/components/dynamic/dynamic-liking/index.css +81 -0
  156. package/lib/components/dynamic/dynamic-liking/index.js +76 -0
  157. package/lib/components/dynamic/dynamic-liking/item.js +91 -0
  158. package/lib/components/dynamic/dynamic-liking/mock.js +83 -0
  159. package/lib/components/dynamic/dynamic-list/index.css +36 -0
  160. package/lib/components/dynamic/dynamic-list/index.js +61 -0
  161. package/lib/components/dynamic/dynamic-topping/image/quotationMark.svg +16 -0
  162. package/lib/components/dynamic/dynamic-topping/image/topIcon.svg +30 -0
  163. package/lib/components/dynamic/dynamic-topping/index.css +148 -0
  164. package/lib/components/dynamic/dynamic-topping/index.js +80 -0
  165. package/lib/components/dynamic/dynamic-topping/interface.js +5 -0
  166. package/lib/components/dynamic/dynamic-topping/item.js +140 -0
  167. package/lib/components/dynamic/dynamic-topping/request-api.js +36 -0
  168. package/lib/components/dynamic/dynamic.css +204 -0
  169. package/lib/components/dynamic/dynamic.js +391 -0
  170. package/lib/components/dynamic/export-module/index.js +33 -0
  171. package/lib/components/dynamic/img/dynamic-P1.svg +15 -0
  172. package/lib/components/dynamic/img/dynamic-P2.svg +15 -0
  173. package/lib/components/dynamic/img/dynamic-P3.svg +15 -0
  174. package/lib/components/dynamic/img/dynamic-P4.svg +15 -0
  175. package/lib/components/dynamic/img/dynamic-P5.svg +15 -0
  176. package/lib/components/dynamic/img/dynamic-delay.svg +17 -0
  177. package/lib/components/dynamic/img/dynamic-desire.svg +61 -0
  178. package/lib/components/dynamic/img/dynamic-empty.png +0 -0
  179. package/lib/components/dynamic/img/dynamic-end.svg +17 -0
  180. package/lib/components/dynamic/img/dynamic-left-quoto.svg +13 -0
  181. package/lib/components/dynamic/img/dynamic-loading.gif +0 -0
  182. package/lib/components/dynamic/img/dynamic-normal.svg +17 -0
  183. package/lib/components/dynamic/img/dynamic-promise.svg +61 -0
  184. package/lib/components/dynamic/img/dynamic-reword.svg +24 -0
  185. package/lib/components/dynamic/img/dynamic-right-quoto.svg +13 -0
  186. package/lib/components/dynamic/img/dynamic-risk.svg +17 -0
  187. package/lib/components/dynamic/img/dynamic-submit-delay.svg +16 -0
  188. package/lib/components/dynamic/img/dynamic-submit-normal.svg +18 -0
  189. package/lib/components/dynamic/img/dynamic-top.svg +14 -0
  190. package/lib/components/dynamic/index.js +27 -0
  191. package/lib/components/dynamic/interface.js +5 -0
  192. package/lib/components/dynamic/quick-operation/components/create-announcement/index.css +25 -0
  193. package/lib/components/dynamic/quick-operation/components/create-announcement/index.js +37 -0
  194. package/lib/components/dynamic/quick-operation/components/create-okr/index.css +25 -0
  195. package/lib/components/dynamic/quick-operation/components/create-okr/index.js +37 -0
  196. package/lib/components/dynamic/quick-operation/components/create-share/index.css +25 -0
  197. package/lib/components/dynamic/quick-operation/components/create-share/index.js +37 -0
  198. package/lib/components/dynamic/quick-operation/components/create-task/index.css +25 -0
  199. package/lib/components/dynamic/quick-operation/components/create-task/index.js +42 -0
  200. package/lib/components/dynamic/quick-operation/img/create-announcement.png +0 -0
  201. package/lib/components/dynamic/quick-operation/img/create-okr.png +0 -0
  202. package/lib/components/dynamic/quick-operation/img/create-share.png +0 -0
  203. package/lib/components/dynamic/quick-operation/img/create-task.png +0 -0
  204. package/lib/components/dynamic/quick-operation/index.css +51 -0
  205. package/lib/components/dynamic/quick-operation/index.js +112 -0
  206. package/lib/components/dynamic/request-api.js +92 -0
  207. package/lib/components/dynamic/util.js +140 -0
  208. package/lib/components/emotionsSelector/style.js +1 -1
  209. package/lib/components/file-list/components/single-file/index.css +84 -0
  210. package/lib/components/file-list/components/single-file/index.js +115 -0
  211. package/lib/components/file-list/img/new-file-list-doc.svg +1 -0
  212. package/lib/components/file-list/img/new-file-list-other.svg +1 -0
  213. package/lib/components/file-list/img/new-file-list-pdf.svg +1 -0
  214. package/lib/components/file-list/img/new-file-list-ppt.svg +1 -0
  215. package/lib/components/file-list/img/new-file-list-radio.svg +1 -0
  216. package/lib/components/file-list/img/new-file-list-video.svg +1 -0
  217. package/lib/components/file-list/img/new-file-list-xls.svg +1 -0
  218. package/lib/components/file-list/index.css +5 -0
  219. package/lib/components/file-list/index.js +61 -0
  220. package/lib/components/file-list/interface.js +5 -0
  221. package/lib/components/file-list/util.js +78 -0
  222. package/lib/components/form/form-fields/input/index.css +11 -0
  223. package/lib/components/form/form-fields/input/index.js +3 -1
  224. package/lib/components/grid-page/image/{Assistant.svg → assistant.svg} +0 -0
  225. package/lib/components/grid-page/image/{Boss.svg → boss.svg} +0 -0
  226. package/lib/components/grid-page/image/{Default-background.png → default-background.png} +0 -0
  227. package/lib/components/grid-page/image/{UserManager.svg → userManager.svg} +0 -0
  228. package/lib/components/grid-page/personal-info/index.js +5 -5
  229. package/lib/components/img-viewer/icon/enlarge.js +30 -0
  230. package/lib/components/img-viewer/icon/left-rotate.js +46 -0
  231. package/lib/components/img-viewer/icon/right-rotate.js +44 -0
  232. package/lib/components/img-viewer/icon/shrink.js +37 -0
  233. package/lib/components/img-viewer/image/loading.gif +0 -0
  234. package/lib/components/img-viewer/index.css +155 -0
  235. package/lib/components/img-viewer/index.js +228 -0
  236. package/lib/components/img-viewer/interface.js +5 -0
  237. package/lib/components/img-viewer/util.js +16 -0
  238. package/lib/components/mblog/components/MblogAction.js +10 -6
  239. package/lib/components/mblog/index.js +24 -11
  240. package/lib/components/mblog/style.js +8 -8
  241. package/lib/components/okr-detail/components/header/index.css +4 -0
  242. package/lib/components/okr-detail/components/header/o-cycle.js +2 -2
  243. package/lib/components/okr-detail/components/okr-tree/tree-node/e-kr-node/index.js +15 -8
  244. package/lib/components/okr-flow/child-node/work-node.js +7 -1
  245. package/lib/components/okr-period-selector/select-cycle.js +139 -151
  246. package/lib/components/okr-progress-detail/index.css +1 -0
  247. package/lib/components/okr-review/ReviewPop/components/ReviewBody/index.js +5 -5
  248. package/lib/components/okr-review/ReviewPop/index.js +4 -4
  249. package/lib/components/period-selector/common.js +168 -17
  250. package/lib/components/period-selector/components/selector/index.js +103 -38
  251. package/lib/components/period-selector/components/selector/style.js +23 -9
  252. package/lib/components/period-selector/index.js +29 -28
  253. package/lib/components/popup/index.js +3 -1
  254. package/lib/components/publish-dynamic-modal/index.js +13 -0
  255. package/lib/components/publish-dynamic-modal/interface.js +5 -0
  256. package/lib/components/publish-dynamic-modal/publish-dynamic-modal.css +3 -0
  257. package/lib/components/publish-dynamic-modal/publish-dynamic-modal.js +191 -0
  258. package/lib/components/publish-dynamic-modal/requist-api.js +48 -0
  259. package/lib/components/radio/index.css +5 -0
  260. package/lib/components/radio/radio.js +12 -4
  261. package/lib/components/search-key-handle/index.js +39 -0
  262. package/lib/components/table/index.css +0 -1
  263. package/lib/components/upload/components/uploadedPreview.js +62 -54
  264. package/lib/components/upload/img/doc.svg +1 -0
  265. package/lib/components/upload/img/other.svg +1 -0
  266. package/lib/components/upload/img/pdf.svg +1 -0
  267. package/lib/components/upload/img/ppt.svg +1 -0
  268. package/lib/components/upload/img/radio.svg +1 -0
  269. package/lib/components/upload/img/video.svg +1 -0
  270. package/lib/components/upload/img/xls.svg +1 -0
  271. package/lib/components/upload/index.css +26 -0
  272. package/lib/components/upload/index.js +89 -57
  273. package/lib/components/upload/style.js +7 -7
  274. package/lib/components/upload/type.js +15 -15
  275. package/lib/components/upload/util.js +102 -0
  276. package/lib/components/upvote/index.js +37 -14
  277. package/lib/components/user-selector/export-modules/field-tree-selector/index.css +4 -0
  278. package/lib/components/user-selector/export-modules/field-tree-selector/index.js +50 -24
  279. package/lib/components/user-selector/export-modules/field-tree-selector/single-selector/index.js +11 -2
  280. package/lib/components/user-selector/layout/index.css +1 -1
  281. package/lib/components-v1/buttonv2/ButtonLinked.js +35 -0
  282. package/lib/components-v1/buttonv2/ButtonOutlined.js +64 -0
  283. package/lib/components-v1/buttonv2/ButtonRounded.js +101 -0
  284. package/lib/components-v1/buttonv2/DefaultButton.js +86 -0
  285. package/lib/components-v1/buttonv2/index.js +37 -0
  286. package/lib/components-v1/buttonv2/style/style.js +53 -0
  287. package/lib/components-v1/buttonv2/style/theme.css +3 -0
  288. package/lib/components-v1/confirm/index.js +158 -0
  289. package/lib/index.js +49 -5
  290. package/lib/pages/dynamic/index.css +5 -0
  291. package/lib/pages/dynamic/index.js +25 -0
  292. package/lib/pages/home-page/components/data-list/nav-selector/index.js +18 -0
  293. package/lib/pages/home-page/components/data-list/table/utils-function.js +6 -3
  294. package/lib/pages/like-ranking/column.js +141 -0
  295. package/lib/pages/like-ranking/filter-buttons/department.js +44 -0
  296. package/lib/pages/like-ranking/filter-buttons/group.js +34 -0
  297. package/lib/pages/like-ranking/filter-buttons/index.css +19 -0
  298. package/lib/pages/like-ranking/filter-buttons/index.js +40 -0
  299. package/lib/pages/like-ranking/filter-buttons/modular.js +110 -0
  300. package/lib/pages/like-ranking/filter-buttons/name.js +73 -0
  301. package/lib/pages/like-ranking/filter-buttons/search-dropdown/index.css +27 -0
  302. package/lib/pages/like-ranking/filter-buttons/search-dropdown/index.js +38 -0
  303. package/lib/pages/like-ranking/filter-buttons/timer.js +56 -0
  304. package/lib/pages/like-ranking/image/dynamic-empty.png +0 -0
  305. package/lib/pages/like-ranking/image/loading.gif +0 -0
  306. package/lib/pages/like-ranking/image/ranking-1.png +0 -0
  307. package/lib/pages/like-ranking/image/ranking-2.png +0 -0
  308. package/lib/pages/like-ranking/image/ranking-3.png +0 -0
  309. package/lib/pages/like-ranking/index.css +185 -0
  310. package/lib/pages/like-ranking/index.js +252 -0
  311. package/lib/pages/like-ranking/mock.js +366 -0
  312. package/lib/pages/like-ranking/request-api.js +15 -0
  313. package/lib/utils/auth.js +46 -5
  314. package/lib/utils/bs-global.js +26 -2
  315. package/lib/utils/format-time.js +161 -0
  316. package/lib/utils/helpers.js +41 -0
  317. package/lib/utils/roundWeight.js +105 -0
  318. package/lib/utils/tools.js +140 -20
  319. package/package.json +2 -2
@@ -0,0 +1,911 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+
10
+ var _react = _interopRequireWildcard(require("react"));
11
+
12
+ var _uuid = _interopRequireDefault(require("uuid"));
13
+
14
+ var _titaUi = require("tita-ui");
15
+
16
+ var _bsGlobal = require("../../utils/bs-global");
17
+
18
+ var _roundWeight = require("../../utils/roundWeight");
19
+
20
+ var _popDownNotification = require("../pop-down-notification");
21
+
22
+ var _krDatas = _interopRequireDefault(require("./kr-items/krDatas"));
23
+
24
+ var _style = require("./style");
25
+
26
+ var _oNewName = _interopRequireDefault(require("./fields/o-new-name"));
27
+
28
+ var _dateCycle = _interopRequireDefault(require("./fields/date-cycle"));
29
+
30
+ var _okrVisibility = _interopRequireDefault(require("./fields/okr-visibility"));
31
+
32
+ var _okrType = _interopRequireDefault(require("./fields/okr-type"));
33
+
34
+ var _okrClassify = _interopRequireDefault(require("./fields/okr-classify"));
35
+
36
+ var _okrParent = _interopRequireDefault(require("./fields/okr-parent"));
37
+
38
+ var _okrCase = _interopRequireDefault(require("./fields/okr-case"));
39
+
40
+ var _manager = _interopRequireDefault(require("../drawer/manager"));
41
+
42
+ var _okrCreateSuggest = _interopRequireWildcard(require("./fields/okr-create-suggest"));
43
+
44
+ var _constant = require("./constant");
45
+
46
+ var _getCreateOkrSurpassPercent = _interopRequireDefault(require("./utils/getCreateOkrSurpassPercent"));
47
+
48
+ var _createSuccessCmpWrapper = _interopRequireDefault(require("./createSuccessCmpWrapper"));
49
+
50
+ var _createSuccessCmp = _interopRequireDefault(require("./createSuccessCmp"));
51
+
52
+ var _helpers = require("../../utils/helpers");
53
+
54
+ var _requestApi = require("./request-api");
55
+
56
+ var _teachOkr = _interopRequireDefault(require("./img/teach-okr.svg"));
57
+
58
+ var _hand = _interopRequireDefault(require("./img/hand.svg"));
59
+
60
+ require("./index.css");
61
+
62
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
63
+
64
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
65
+
66
+ 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; }
67
+
68
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
69
+
70
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
71
+
72
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
73
+
74
+ 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); } }
75
+
76
+ 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); }); }; }
77
+
78
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
79
+
80
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
81
+
82
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
83
+
84
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
85
+
86
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
87
+
88
+ 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."); }
89
+
90
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
91
+
92
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
93
+
94
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
95
+
96
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
97
+
98
+ var initOCheckResult = _constant.OCheckTarget.map(function (item) {
99
+ return {
100
+ text: item,
101
+ result: _okrCreateSuggest.EOkrCreateSuggestResultType.normal
102
+ };
103
+ });
104
+
105
+ function CreateOkrModal(_ref, ref) {
106
+ var initCycle = _ref.initCycle,
107
+ userInfo = _ref.userInfo,
108
+ onSuccess = _ref.onSuccess,
109
+ _ref$isPerformance = _ref.isPerformance,
110
+ isPerformance = _ref$isPerformance === void 0 ? false : _ref$isPerformance,
111
+ _ref$handleCreatedClo = _ref.handleCreatedClose,
112
+ handleCreatedClose = _ref$handleCreatedClo === void 0 ? function () {} : _ref$handleCreatedClo,
113
+ _ref$visible = _ref.visible,
114
+ visible = _ref$visible === void 0 ? false : _ref$visible,
115
+ _ref$onClose = _ref.onClose,
116
+ onClose = _ref$onClose === void 0 ? function () {} : _ref$onClose;
117
+
118
+ var _useState = (0, _react.useState)(visible),
119
+ _useState2 = _slicedToArray(_useState, 2),
120
+ isVisible = _useState2[0],
121
+ setVisible = _useState2[1]; // @ts-ignore
122
+
123
+
124
+ var userId = BSGlobal.loginUserInfo.Id;
125
+ var setting = (0, _bsGlobal.getBSGlobal)("OkrAdvancedSetting").KRSetting;
126
+ var openOkrType = setting.OkrTypeSetting;
127
+ var openClassify = setting.OkrClassify;
128
+ var openKrWeight = setting.KrWeight;
129
+
130
+ var _ref2 = userInfo || (0, _bsGlobal.getUserInfo)(),
131
+ Name = _ref2.Name,
132
+ Id = _ref2.Id,
133
+ UserAvatar = _ref2.UserAvatar;
134
+
135
+ var _useState3 = (0, _react.useState)(""),
136
+ _useState4 = _slicedToArray(_useState3, 2),
137
+ okrName = _useState4[0],
138
+ setOkrName = _useState4[1]; // 目标名称
139
+
140
+
141
+ var _useState5 = (0, _react.useState)({
142
+ name: Name,
143
+ id: Id,
144
+ avatar: UserAvatar
145
+ }),
146
+ _useState6 = _slicedToArray(_useState5, 2),
147
+ user = _useState6[0],
148
+ setUser = _useState6[1]; // 负责人
149
+
150
+
151
+ var _useState7 = (0, _react.useState)(false),
152
+ _useState8 = _slicedToArray(_useState7, 2),
153
+ isCustomWeight = _useState8[0],
154
+ setIsCustomWeight = _useState8[1]; // 是否自定义权重
155
+
156
+
157
+ var _useState9 = (0, _react.useState)({
158
+ departmentId: 0,
159
+ departmentName: ""
160
+ }),
161
+ _useState10 = _slicedToArray(_useState9, 2),
162
+ dept = _useState10[0],
163
+ setDept = _useState10[1]; // 部门信息 用于目标类型为部门时
164
+
165
+
166
+ var _useState11 = (0, _react.useState)({
167
+ groupId: 0,
168
+ groupName: ""
169
+ }),
170
+ _useState12 = _slicedToArray(_useState11, 2),
171
+ team = _useState12[0],
172
+ setTeam = _useState12[1]; // 团队信息 用于目标类型为团队时
173
+
174
+
175
+ var _useState13 = (0, _react.useState)({
176
+ typeName: "个人",
177
+ typeId: 1
178
+ }),
179
+ _useState14 = _slicedToArray(_useState13, 2),
180
+ type = _useState14[0],
181
+ setType = _useState14[1]; // 目标类型
182
+
183
+
184
+ var _useState15 = (0, _react.useState)(initCycle),
185
+ _useState16 = _slicedToArray(_useState15, 2),
186
+ cycle = _useState16[0],
187
+ setCycle = _useState16[1]; // 目标周期信息
188
+
189
+
190
+ var _useState17 = (0, _react.useState)(),
191
+ _useState18 = _slicedToArray(_useState17, 2),
192
+ okrClassify = _useState18[0],
193
+ setOkrClassify = _useState18[1]; // 目标类别
194
+
195
+
196
+ var _useState19 = (0, _react.useState)(1),
197
+ _useState20 = _slicedToArray(_useState19, 2),
198
+ visibility = _useState20[0],
199
+ setVisibility = _useState20[1]; // 可见性
200
+
201
+
202
+ var _useState21 = (0, _react.useState)({}),
203
+ _useState22 = _slicedToArray(_useState21, 2),
204
+ visiableLimit = _useState22[0],
205
+ setVisiableLimit = _useState22[1]; // 可见性指定范围
206
+
207
+
208
+ var _useState23 = (0, _react.useState)([{
209
+ // kr信息
210
+ uuid: _uuid["default"].v1(),
211
+ principalId: Id,
212
+ principalName: Name,
213
+ userAvatar: UserAvatar,
214
+ krWeight: 100,
215
+ mileStoneName: "",
216
+ confidenceIndex: 5
217
+ }]),
218
+ _useState24 = _slicedToArray(_useState23, 2),
219
+ krDatas = _useState24[0],
220
+ setKrDatas = _useState24[1];
221
+
222
+ var _useState25 = (0, _react.useState)({
223
+ // 对其目标
224
+ parentWorkId: 0,
225
+ parentWorkName: "",
226
+ parentType: 0,
227
+ parentKrId: 0
228
+ }),
229
+ _useState26 = _slicedToArray(_useState25, 2),
230
+ parent = _useState26[0],
231
+ setParent = _useState26[1];
232
+
233
+ var _useState27 = (0, _react.useState)(false),
234
+ _useState28 = _slicedToArray(_useState27, 2),
235
+ oNameIsInput = _useState28[0],
236
+ setONameIsInput = _useState28[1];
237
+
238
+ var _useState29 = (0, _react.useState)(false),
239
+ _useState30 = _slicedToArray(_useState29, 2),
240
+ krIsInput = _useState30[0],
241
+ setKrIsInput = _useState30[1];
242
+
243
+ var _useState31 = (0, _react.useState)(initOCheckResult),
244
+ _useState32 = _slicedToArray(_useState31, 2),
245
+ oNameCheckResult = _useState32[0],
246
+ setONameCheckResult = _useState32[1];
247
+
248
+ var _useState33 = (0, _react.useState)({
249
+ finalResult: _okrCreateSuggest.EOkrCreateSuggestResultType.normal,
250
+ friendlyResult: []
251
+ }),
252
+ _useState34 = _slicedToArray(_useState33, 2),
253
+ krsCheckResult = _useState34[0],
254
+ setKrsCheckResult = _useState34[1];
255
+
256
+ var _useState35 = (0, _react.useState)(false),
257
+ _useState36 = _slicedToArray(_useState35, 2),
258
+ customCloseOSuggest = _useState36[0],
259
+ setCustomCloseOSuggest = _useState36[1]; // 用户点击收起后不再自动弹出
260
+
261
+
262
+ var _useState37 = (0, _react.useState)(false),
263
+ _useState38 = _slicedToArray(_useState37, 2),
264
+ customCloseKrSuggest = _useState38[0],
265
+ setCustomCloseKrSuggest = _useState38[1];
266
+
267
+ var _useState39 = (0, _react.useState)(),
268
+ _useState40 = _slicedToArray(_useState39, 2),
269
+ createdSuccessInfo = _useState40[0],
270
+ setCreatedSuccessInfo = _useState40[1];
271
+
272
+ var _useState41 = (0, _react.useState)(false),
273
+ _useState42 = _slicedToArray(_useState41, 2),
274
+ showCreatedSuccessInfo = _useState42[0],
275
+ setShowCreatedSuccessInfo = _useState42[1];
276
+
277
+ var _useState43 = (0, _react.useState)(Math.floor(Math.random() * 6)),
278
+ _useState44 = _slicedToArray(_useState43, 2),
279
+ tipIndex = _useState44[0],
280
+ setTipIndex = _useState44[1];
281
+
282
+ var _useState45 = (0, _react.useState)(""),
283
+ _useState46 = _slicedToArray(_useState45, 2),
284
+ userAvatarBase64Url = _useState46[0],
285
+ setUserAvatarBase64Url = _useState46[1];
286
+
287
+ var _useState47 = (0, _react.useState)(false),
288
+ _useState48 = _slicedToArray(_useState47, 2),
289
+ krIsValidate = _useState48[0],
290
+ setKrIsValidate = _useState48[1];
291
+
292
+ var _useState49 = (0, _react.useState)(false),
293
+ _useState50 = _slicedToArray(_useState49, 2),
294
+ isApplyTpl = _useState50[0],
295
+ setIsApplyTpl = _useState50[1];
296
+
297
+ var _useState51 = (0, _react.useState)(false),
298
+ _useState52 = _slicedToArray(_useState51, 2),
299
+ isInputContent = _useState52[0],
300
+ setIsInputContent = _useState52[1];
301
+
302
+ var wrapperRef = (0, _react.useRef)();
303
+ var modalRef = (0, _react.useRef)();
304
+ var oInputFoucsRef = (0, _react.useRef)(false);
305
+ var krInputFoucsRef = (0, _react.useRef)(false);
306
+ var downloadDomRef = (0, _react.useRef)(document.createElement("div"));
307
+ var newOkrDataRef = (0, _react.useRef)(); //kr权重总计
308
+
309
+ var total = 0;
310
+ krDatas.forEach(function (kr) {
311
+ return total += Number(kr.krWeight);
312
+ }); //权重未自定义过或总计为100为合法权重
313
+
314
+ var krWeightValid = !isCustomWeight || total == 100 || krDatas.length == 0 || !openKrWeight;
315
+ var allKrHasName = krDatas.filter(function (kr) {
316
+ return !kr.mileStoneName.trim().length;
317
+ }).length == 0;
318
+ var showCreateOkrModal = (0, _react.useCallback)(function () {
319
+ setVisible(true);
320
+ }, []);
321
+ var hideCreateOkrModal = (0, _react.useCallback)(function () {
322
+ onClose && onClose();
323
+ setVisible(false);
324
+ }, []);
325
+ (0, _react.useEffect)(function () {
326
+ setVisible(visible);
327
+ }, [visible]);
328
+ (0, _react.useImperativeHandle)(ref, function () {
329
+ return {
330
+ setCase: function setCase(data) {
331
+ var name = data.name,
332
+ subelements = data.subelements;
333
+ setOkrName(name);
334
+ setKrDatas(subelements.map(function (s) {
335
+ return {
336
+ uuid: _uuid["default"].v1(),
337
+ principalId: Id,
338
+ principalName: Name,
339
+ userAvatar: UserAvatar,
340
+ krWeight: (0, _roundWeight.RoundWeight)(100 / subelements.length),
341
+ mileStoneName: s.name,
342
+ confidenceIndex: 5
343
+ };
344
+ }));
345
+ setIsCustomWeight(false);
346
+ },
347
+ setData: function setData(data) {
348
+ setOkrName(data.okrName);
349
+ setUser(data.user);
350
+ }
351
+ };
352
+ });
353
+ var handleOnSuccess = (0, _react.useCallback)(function () {
354
+ var data = newOkrDataRef.current;
355
+ data.userAvatarBase64Url = userAvatarBase64Url;
356
+ setCreatedSuccessInfo(data);
357
+
358
+ if (!localStorage.getItem("dontShowValue".concat(userId)) && !isPerformance && !isApplyTpl) {
359
+ setShowCreatedSuccessInfo(true);
360
+ setTipIndex(Math.floor(Math.random() * 6));
361
+ } else {
362
+ _popDownNotification.Toast.Success("创建成功", {
363
+ duration: 3000
364
+ });
365
+
366
+ onSuccess && onSuccess(data);
367
+ }
368
+ }, [userAvatarBase64Url, isApplyTpl]);
369
+
370
+ var formatVisiableLimit = function formatVisiableLimit() {
371
+ var _visiableLimit$users = visiableLimit.users,
372
+ users = _visiableLimit$users === void 0 ? [] : _visiableLimit$users,
373
+ _visiableLimit$depart = visiableLimit.departments,
374
+ departments = _visiableLimit$depart === void 0 ? [] : _visiableLimit$depart,
375
+ _visiableLimit$groups = visiableLimit.groups,
376
+ groups = _visiableLimit$groups === void 0 ? [] : _visiableLimit$groups;
377
+ var areaUserIds = (users || []).reduce(function (res, cur) {
378
+ return [].concat(_toConsumableArray(res), [cur.userId]);
379
+ }, []);
380
+ var areaOrgIds = (departments || []).reduce(function (res, cur) {
381
+ return [].concat(_toConsumableArray(res), [cur.id]);
382
+ }, []);
383
+ var areaGroupIds = (groups || []).reduce(function (res, cur) {
384
+ return [].concat(_toConsumableArray(res), [cur.id]);
385
+ }, []);
386
+ return {
387
+ areaUserIds: areaUserIds,
388
+ areaOrgIds: areaOrgIds,
389
+ areaGroupIds: areaGroupIds
390
+ };
391
+ }; // 表单保存功能
392
+
393
+
394
+ var onModalOkHandler = /*#__PURE__*/function () {
395
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
396
+ var orkNameLengthValidate, visibilityArea, data, krNum, krTotalLength, krAvarageLength, krMeasurableLength, oHasVtWords, callData, workId;
397
+ return regeneratorRuntime.wrap(function _callee$(_context) {
398
+ while (1) {
399
+ switch (_context.prev = _context.next) {
400
+ case 0:
401
+ if (okrName) {
402
+ _context.next = 3;
403
+ break;
404
+ }
405
+
406
+ _popDownNotification.Toast.Error("目标名称不能为空", {
407
+ canClose: false
408
+ });
409
+
410
+ return _context.abrupt("return");
411
+
412
+ case 3:
413
+ if (!(okrName.length > 500)) {
414
+ _context.next = 6;
415
+ break;
416
+ }
417
+
418
+ _popDownNotification.Toast.Error("目标名称不能超过500字", {
419
+ canClose: false
420
+ });
421
+
422
+ return _context.abrupt("return");
423
+
424
+ case 6:
425
+ if (allKrHasName) {
426
+ _context.next = 10;
427
+ break;
428
+ }
429
+
430
+ _popDownNotification.Toast.Error("关键成果不能为空", {
431
+ canClose: false
432
+ });
433
+
434
+ setKrIsValidate(true);
435
+ return _context.abrupt("return");
436
+
437
+ case 10:
438
+ orkNameLengthValidate = krDatas.filter(function (kr) {
439
+ return kr.mileStoneName.trim().length > 500;
440
+ }).length == 0;
441
+
442
+ if (orkNameLengthValidate) {
443
+ _context.next = 14;
444
+ break;
445
+ }
446
+
447
+ _popDownNotification.Toast.Error("关键成果不能超过500字", {
448
+ canClose: false
449
+ });
450
+
451
+ return _context.abrupt("return");
452
+
453
+ case 14:
454
+ setKrIsValidate(false);
455
+
456
+ if (krWeightValid) {
457
+ _context.next = 18;
458
+ break;
459
+ }
460
+
461
+ _popDownNotification.Toast.Error("关键成果总权重不等于100%", {
462
+ canClose: false
463
+ });
464
+
465
+ return _context.abrupt("return");
466
+
467
+ case 18:
468
+ if (cycle) {
469
+ _context.next = 20;
470
+ break;
471
+ }
472
+
473
+ return _context.abrupt("return");
474
+
475
+ case 20:
476
+ handleCreatedClose();
477
+ visibilityArea = formatVisiableLimit();
478
+ _context.next = 24;
479
+ return (0, _requestApi.createWidthKr)(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
480
+ krInfos: krDatas.map(function (kr) {
481
+ return _objectSpread(_objectSpread({}, kr), {}, {
482
+ startDate: cycle.startDate,
483
+ endDate: cycle.endDate
484
+ });
485
+ })
486
+ }, cycle), {}, {
487
+ workName: okrName
488
+ }, parent), {}, {
489
+ workType: 6,
490
+ visibility: visibility,
491
+ okrClassify: openClassify ? okrClassify : "",
492
+ okrType: openOkrType ? type.typeId : ""
493
+ }, dept), team), {}, {
494
+ workRoles: [{
495
+ roleType: 1,
496
+ models: [user]
497
+ }]
498
+ }, visibilityArea));
499
+
500
+ case 24:
501
+ data = _context.sent;
502
+
503
+ if (!(data.Code === 0)) {
504
+ _context.next = 28;
505
+ break;
506
+ }
507
+
508
+ _popDownNotification.Toast.Error("创建失败,请重试", {
509
+ canClose: false
510
+ });
511
+
512
+ return _context.abrupt("return");
513
+
514
+ case 28:
515
+ hideCreateOkrModal();
516
+
517
+ if (onSuccess || !isPerformance) {
518
+ // 带上超过创建okr人数的计算值
519
+ krNum = krDatas.length;
520
+ krTotalLength = 0;
521
+ krDatas && krDatas.forEach(function (kr) {
522
+ // 计算平均长度要去掉百分号和数字
523
+ krTotalLength += kr.mileStoneName.replace(/(%|\d)/g, "").length;
524
+ });
525
+ krAvarageLength = krDatas.length > 0 ? krTotalLength / krDatas.length : 0;
526
+ krMeasurableLength = krsCheckResult.friendlyResult.filter(function (kr) {
527
+ return kr.hasNumWords === true;
528
+ }).length;
529
+ oHasVtWords = oNameCheckResult[0].result === _okrCreateSuggest.EOkrCreateSuggestResultType.correct ? true : false;
530
+ callData = data;
531
+ callData.countSurpassPercentage = (0, _getCreateOkrSurpassPercent["default"])(okrName.replace(/(%|\d)/g, "").length, oHasVtWords, krNum, krMeasurableLength, Number.parseInt(krAvarageLength.toString()));
532
+ newOkrDataRef.current = callData;
533
+ handleOnSuccess();
534
+ } else {
535
+ workId = data.workId;
536
+
537
+ _manager["default"].open("okrDetail", {
538
+ okrId: workId
539
+ });
540
+ }
541
+
542
+ setIsApplyTpl(false);
543
+
544
+ case 31:
545
+ case "end":
546
+ return _context.stop();
547
+ }
548
+ }
549
+ }, _callee);
550
+ }));
551
+
552
+ return function onModalOkHandler() {
553
+ return _ref3.apply(this, arguments);
554
+ };
555
+ }(); // 从OKR案例库中应用模板
556
+
557
+
558
+ var OnOkRApplyTplHandler = function OnOkRApplyTplHandler(data) {
559
+ var name = data.name,
560
+ subelements = data.subelements;
561
+ setOkrName(name);
562
+ setKrDatas(subelements.map(function (s) {
563
+ return {
564
+ uuid: _uuid["default"].v1(),
565
+ principalId: Id,
566
+ principalName: Name,
567
+ userAvatar: UserAvatar,
568
+ krWeight: (0, _roundWeight.RoundWeight)(100 / subelements.length),
569
+ mileStoneName: s.name,
570
+ confidenceIndex: 5
571
+ };
572
+ }));
573
+ setIsCustomWeight(false);
574
+ setIsApplyTpl(true);
575
+ };
576
+
577
+ (0, _react.useEffect)(function () {
578
+ if (!isVisible) {
579
+ setKrDatas([{
580
+ uuid: _uuid["default"].v1(),
581
+ principalId: Id,
582
+ principalName: Name,
583
+ userAvatar: UserAvatar,
584
+ krWeight: 100,
585
+ mileStoneName: "",
586
+ confidenceIndex: 5
587
+ }]);
588
+ setOkrName("");
589
+ setUser({
590
+ name: Name,
591
+ id: Id,
592
+ avatar: UserAvatar
593
+ });
594
+ setIsCustomWeight(false);
595
+ setDept({
596
+ departmentId: 0,
597
+ departmentName: ""
598
+ });
599
+ setType({
600
+ typeName: "个人",
601
+ typeId: 1
602
+ });
603
+ setCycle(cycle);
604
+ setOkrClassify(undefined);
605
+ setVisibility(1);
606
+ setParent({
607
+ parentWorkId: 0,
608
+ parentWorkName: "",
609
+ parentType: 0,
610
+ parentKrId: 0
611
+ });
612
+ }
613
+ }, [isVisible]);
614
+ var handleONameSuggestClose = (0, _react.useCallback)(function () {
615
+ setONameIsInput(false);
616
+ setCustomCloseOSuggest(true);
617
+ }, []);
618
+ var handleKrSuggestClose = (0, _react.useCallback)(function () {
619
+ setKrIsInput(false);
620
+ setCustomCloseKrSuggest(true);
621
+ }, []);
622
+ var handleOInputFocusStateChange = (0, _react.useCallback)(function (state) {
623
+ if (state) {
624
+ setKrIsInput(false);
625
+ oInputFoucsRef.current = true;
626
+ setONameIsInput(state);
627
+ } else {
628
+ // 为了解决输入框聚焦之后,点击小手检查窗口还在引入了这个 ref,但是这个 ref 会在正常失焦也被赋值,所以需要一定时间后赋为默认值,krInputFoucsRef 也是
629
+ setTimeout(function () {
630
+ oInputFoucsRef.current = false;
631
+ }, 500); // 为了解决输入框聚焦之后,点击收起时组件先销毁然后无法触发关闭事件
632
+
633
+ setTimeout(function () {
634
+ setONameIsInput(false);
635
+ }, 100);
636
+ }
637
+ }, []);
638
+ var handleKrInputStateChange = (0, _react.useCallback)(function (state) {
639
+ if (state) {
640
+ setONameIsInput(false);
641
+ krInputFoucsRef.current = true; // 防止从上一个kr输入框聚焦情况直接tab切到下一个不展示输入框
642
+
643
+ setTimeout(function () {
644
+ setKrIsInput(state);
645
+ }, 100);
646
+ } else {
647
+ setTimeout(function () {
648
+ krInputFoucsRef.current = false;
649
+ }, 500);
650
+ setTimeout(function () {
651
+ setKrIsInput(false);
652
+ }, 100);
653
+ }
654
+ }, []);
655
+ var handleShowOSuggest = (0, _react.useCallback)(function () {
656
+ setCustomCloseOSuggest(false);
657
+
658
+ if (oInputFoucsRef.current) {
659
+ oInputFoucsRef.current = false;
660
+ var result = oNameIsInput;
661
+
662
+ if (customCloseOSuggest) {
663
+ result = true;
664
+ } else {
665
+ result = !oNameIsInput;
666
+ }
667
+
668
+ setTimeout(function () {
669
+ setONameIsInput(result);
670
+
671
+ if (!result) {
672
+ setCustomCloseOSuggest(true);
673
+ }
674
+ }, 100);
675
+ return;
676
+ }
677
+
678
+ setTimeout(function () {
679
+ setONameIsInput(!oNameIsInput);
680
+
681
+ if (oNameIsInput) {
682
+ setCustomCloseOSuggest(true);
683
+ }
684
+ }, 100);
685
+ setKrIsInput(false);
686
+ }, [oNameIsInput, customCloseOSuggest]);
687
+ var handleShowKrSuggest = (0, _react.useCallback)(function () {
688
+ setCustomCloseKrSuggest(false);
689
+
690
+ if (krInputFoucsRef.current) {
691
+ krInputFoucsRef.current = false;
692
+ var result = krIsInput;
693
+
694
+ if (customCloseKrSuggest) {
695
+ result = true;
696
+ } else {
697
+ result = !krIsInput;
698
+ }
699
+
700
+ setTimeout(function () {
701
+ setKrIsInput(result);
702
+
703
+ if (!result) {
704
+ setCustomCloseKrSuggest(true);
705
+ }
706
+ }, 100);
707
+ return;
708
+ }
709
+
710
+ setTimeout(function () {
711
+ setKrIsInput(!krIsInput);
712
+
713
+ if (krIsInput) {
714
+ setCustomCloseKrSuggest(true);
715
+ }
716
+ }, 100);
717
+ setONameIsInput(false);
718
+ }, [krIsInput, krIsInput]);
719
+ var ModalTitle = (0, _react.useMemo)(function () {
720
+ return /*#__PURE__*/_react["default"].createElement(_style.Line, null, /*#__PURE__*/_react["default"].createElement("span", {
721
+ className: "create-modal__title"
722
+ }, "\u521B\u5EFA\u76EE\u6807"), /*#__PURE__*/_react["default"].createElement(_okrCase["default"], {
723
+ okrTemplateEnabled: true,
724
+ onOkrApply: OnOkRApplyTplHandler
725
+ }));
726
+ }, []);
727
+ var krCheckFinalResult = (0, _react.useMemo)(function () {
728
+ return _constant.KrCheckTarget.map(function (item, index) {
729
+ if (index === 0) {
730
+ return {
731
+ text: item,
732
+ result: krDatas.length > 0 ? _okrCreateSuggest.EOkrCreateSuggestResultType.correct : _okrCreateSuggest.EOkrCreateSuggestResultType.wrong
733
+ };
734
+ } else if (index === 1) {
735
+ return {
736
+ text: item,
737
+ result: krDatas.length <= 5 ? _okrCreateSuggest.EOkrCreateSuggestResultType.correct : _okrCreateSuggest.EOkrCreateSuggestResultType.wrong
738
+ };
739
+ } else {
740
+ return {
741
+ text: item,
742
+ result: krsCheckResult.finalResult
743
+ };
744
+ }
745
+ });
746
+ }, [krDatas, krsCheckResult.finalResult]);
747
+ var handleCloseShowSuccessInfo = (0, _react.useCallback)(function (dontShowValue, workId) {
748
+ if (dontShowValue) {
749
+ localStorage.setItem("dontShowValue".concat(userId), userId);
750
+ }
751
+
752
+ setShowCreatedSuccessInfo(false);
753
+ onSuccess && onSuccess(newOkrDataRef.current);
754
+ }, []);
755
+ (0, _react.useEffect)(function () {
756
+ if (!isVisible) return; // @ts-ignore
757
+
758
+ (0, _requestApi.getImageBase64ByUrl)(user.id).then(function (data) {
759
+ setUserAvatarBase64Url(data.obj);
760
+ })["catch"](function (err) {
761
+ _popDownNotification.Toast.Error(err);
762
+ });
763
+ }, [user, isVisible]);
764
+
765
+ var trackAction = function trackAction() {
766
+ // @ts-ignore
767
+ window.titaTracker && window.titaTracker('action').record({
768
+ actionName: '点击【教你写OKR】',
769
+ actionGroup: '创建OKR',
770
+ productName: 'OKR'
771
+ });
772
+ };
773
+
774
+ var renderFooterTeachWriteOKr = (0, _react.useMemo)(function () {
775
+ {
776
+ /*钉钉用 https://wiki.tita.com/pages/viewpage.action?pageId=15696093 */
777
+ }
778
+ return /*#__PURE__*/_react["default"].createElement("a", {
779
+ className: "teact-write-okr",
780
+ href: (0, _helpers.isDingDing)() ? "https://wiki.tita.com/pages/viewpage.action?pageId=15696093" : "https://docs.tita.com/question/okr-write/",
781
+ target: "_blank",
782
+ onClick: trackAction
783
+ }, /*#__PURE__*/_react["default"].createElement("img", {
784
+ className: "teact-write-okr__icon",
785
+ src: _teachOkr["default"]
786
+ }), /*#__PURE__*/_react["default"].createElement("span", {
787
+ className: "teact-write-okr__text"
788
+ }, "\u6559\u4F60\u5199 OKR"));
789
+ }, []);
790
+ (0, _react.useEffect)(function () {
791
+ // @ts-ignore
792
+ window.showCreateOkrModal = showCreateOkrModal; // @ts-ignore
793
+
794
+ window.hideCreateOkrModal = hideCreateOkrModal;
795
+ }, []);
796
+ return /*#__PURE__*/_react["default"].createElement(_react.Fragment, null, /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_titaUi.Modal, {
797
+ ref: modalRef,
798
+ width: 600,
799
+ mask: true,
800
+ centered: true,
801
+ onOk: onModalOkHandler,
802
+ okText: "\u7ACB\u5373\u521B\u5EFA",
803
+ title: ModalTitle,
804
+ visible: isVisible,
805
+ onCancel: hideCreateOkrModal,
806
+ maskClosable: false,
807
+ footerLeftContent: renderFooterTeachWriteOKr
808
+ }, /*#__PURE__*/_react["default"].createElement(_style.Wrapper, {
809
+ ref: wrapperRef
810
+ }, /*#__PURE__*/_react["default"].createElement(_oNewName["default"], {
811
+ container: modalRef,
812
+ user: user,
813
+ setUser: setUser,
814
+ okrName: okrName,
815
+ setOkrName: setOkrName,
816
+ onOInputFocusStateChange: handleOInputFocusStateChange,
817
+ setONameCheckResult: setONameCheckResult,
818
+ setIsInputContent: setIsInputContent
819
+ }), /*#__PURE__*/_react["default"].createElement(_krDatas["default"], {
820
+ krs: krDatas,
821
+ isCustomWeight: isCustomWeight,
822
+ wrapperRef: wrapperRef,
823
+ krDatas: krDatas,
824
+ setKrDatas: setKrDatas,
825
+ container: modalRef,
826
+ setIsCustomWeight: setIsCustomWeight,
827
+ handleKrInputStateChange: handleKrInputStateChange,
828
+ setKrsCheckResult: setKrsCheckResult,
829
+ krIsValidate: krIsValidate,
830
+ setKrIsValidate: setKrIsValidate,
831
+ setIsInputContent: setIsInputContent
832
+ }), /*#__PURE__*/_react["default"].createElement("div", {
833
+ className: "create-modal__title-line"
834
+ }, /*#__PURE__*/_react["default"].createElement(_style.BlueBar, null), "\u66F4\u591A\u8BBE\u7F6E"), /*#__PURE__*/_react["default"].createElement("div", {
835
+ className: "space-between-row"
836
+ }, /*#__PURE__*/_react["default"].createElement(_okrParent["default"], {
837
+ parent: parent,
838
+ modalRef: modalRef,
839
+ setParent: setParent,
840
+ isCreateModal: true
841
+ }), /*#__PURE__*/_react["default"].createElement(_dateCycle["default"], {
842
+ cycle: cycle,
843
+ modalRef: modalRef,
844
+ setCycle: setCycle,
845
+ user: user,
846
+ setUser: setUser,
847
+ isCreateModal: true
848
+ })), /*#__PURE__*/_react["default"].createElement("div", {
849
+ className: "space-between-row space-between-row--margin-bottom-4"
850
+ }, /*#__PURE__*/_react["default"].createElement(_okrVisibility["default"], {
851
+ visibility: visibility,
852
+ setVisibility: setVisibility,
853
+ visiableLimit: visiableLimit,
854
+ setVisiableLimit: setVisiableLimit,
855
+ isCreateModal: true
856
+ }), openOkrType && /*#__PURE__*/_react["default"].createElement(_style.Space, null), /*#__PURE__*/_react["default"].createElement("div", {
857
+ className: "space-between-row okr-type-classify"
858
+ }, openOkrType && /*#__PURE__*/_react["default"].createElement(_okrType["default"], {
859
+ dept: dept,
860
+ type: type,
861
+ setDept: setDept,
862
+ setType: setType,
863
+ team: team,
864
+ setTeam: setTeam,
865
+ isCreateModal: true
866
+ }), openClassify && /*#__PURE__*/_react["default"].createElement(_style.Space, null), openClassify && /*#__PURE__*/_react["default"].createElement(_okrClassify["default"], {
867
+ okrClassify: okrClassify,
868
+ setOkrClassify: setOkrClassify,
869
+ isCreateModal: true
870
+ }))), !customCloseOSuggest && oNameIsInput ? /*#__PURE__*/_react["default"].createElement(_okrCreateSuggest["default"], {
871
+ isInput: isInputContent,
872
+ isOSuggest: true,
873
+ descs: _constant.ODesc,
874
+ example: _constant.OExample,
875
+ results: oNameCheckResult,
876
+ handleClose: handleONameSuggestClose
877
+ }) : null, /*#__PURE__*/_react["default"].createElement("img", {
878
+ className: "teach-suggest teach-suggest__o",
879
+ src: _hand["default"],
880
+ onClick: handleShowOSuggest
881
+ }), !customCloseKrSuggest && krIsInput ? /*#__PURE__*/_react["default"].createElement(_okrCreateSuggest["default"], {
882
+ isInput: isInputContent,
883
+ isOSuggest: false,
884
+ descs: _constant.KrDesc,
885
+ example: _constant.KrExample,
886
+ results: krCheckFinalResult,
887
+ handleClose: handleKrSuggestClose
888
+ }) : null, /*#__PURE__*/_react["default"].createElement("img", {
889
+ className: "teach-suggest teach-suggest__kr",
890
+ src: _hand["default"],
891
+ onClick: handleShowKrSuggest
892
+ })))), !isApplyTpl && !isPerformance && showCreatedSuccessInfo ? /*#__PURE__*/_react["default"].createElement(_createSuccessCmpWrapper["default"], null, /*#__PURE__*/_react["default"].createElement(_createSuccessCmp["default"], {
893
+ tipIndex: tipIndex,
894
+ createdSuccessInfo: createdSuccessInfo,
895
+ isDownload: false,
896
+ onCloseModel: handleCloseShowSuccessInfo,
897
+ downLoadRef: downloadDomRef
898
+ })) : null, !isApplyTpl && !isPerformance && showCreatedSuccessInfo ? /*#__PURE__*/_react["default"].createElement("div", {
899
+ className: "download-dom--hidden"
900
+ }, /*#__PURE__*/_react["default"].createElement(_createSuccessCmp["default"], {
901
+ tipIndex: tipIndex,
902
+ createdSuccessInfo: createdSuccessInfo,
903
+ isDownload: true,
904
+ onCloseModel: handleCloseShowSuccessInfo,
905
+ downLoadRef: downloadDomRef
906
+ })) : null);
907
+ }
908
+
909
+ var _default = /*#__PURE__*/(0, _react.forwardRef)(CreateOkrModal);
910
+
911
+ exports["default"] = _default;