@giteeteam/apps-team-components 0.3.13 → 1.0.0

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 (516) hide show
  1. package/README.md +3 -1
  2. package/dist/{common → components/common}/EmptyField.d.ts +2 -1
  3. package/dist/components/common/EmptyField.js +8 -0
  4. package/dist/components/common/overflow-tooltip/BaseOverflowTooltip.d.ts +11 -0
  5. package/dist/components/common/overflow-tooltip/BaseOverflowTooltip.js +25 -0
  6. package/dist/components/common/overflow-tooltip/SimpleOverflowToolTip.d.ts +9 -0
  7. package/dist/components/common/overflow-tooltip/SimpleOverflowToolTip.js +14 -0
  8. package/dist/components/common/overflow-tooltip/style/index.d.ts +3 -0
  9. package/dist/components/common/overflow-tooltip/style/index.js +19 -0
  10. package/dist/components/common/style/global.d.ts +1 -0
  11. package/dist/components/common/style/global.js +4 -0
  12. package/dist/{common → components/common}/user-field/UserAvatar.d.ts +3 -3
  13. package/dist/components/common/user-field/UserAvatar.js +13 -0
  14. package/dist/components/common/user-field/style/index.d.ts +3 -0
  15. package/dist/components/common/user-field/style/index.js +26 -0
  16. package/dist/components/common/utils.d.ts +6 -0
  17. package/dist/components/common/utils.js +39 -0
  18. package/dist/components/field-behavior/fields/type.d.ts +1 -0
  19. package/dist/components/field-behavior/fields/type.js +6 -0
  20. package/dist/components/fields/actors/BaseField.d.ts +1 -0
  21. package/dist/components/fields/actors/BaseField.js +7 -0
  22. package/dist/components/fields/actors/ReadView.d.ts +4 -0
  23. package/dist/components/fields/actors/ReadView.js +29 -0
  24. package/dist/components/fields/assignee/ReadView.d.ts +7 -0
  25. package/dist/components/fields/assignee/ReadView.js +21 -0
  26. package/dist/components/fields/base-component/types.d.ts +7 -0
  27. package/dist/components/fields/base-component/types.js +1 -0
  28. package/dist/components/fields/bind-workspace/ReadView.d.ts +4 -0
  29. package/dist/components/fields/bind-workspace/ReadView.js +18 -0
  30. package/dist/components/fields/bind-workspace/hooks.d.ts +3 -0
  31. package/dist/components/fields/bind-workspace/hooks.js +16 -0
  32. package/dist/components/fields/bind-workspace/style/index.d.ts +1 -0
  33. package/dist/components/fields/bind-workspace/style/index.js +5 -0
  34. package/dist/components/fields/checkbox/ReadView.d.ts +5 -0
  35. package/dist/components/fields/checkbox/ReadView.js +21 -0
  36. package/dist/components/fields/created-at/ReadView.d.ts +5 -0
  37. package/dist/components/fields/created-at/ReadView.js +21 -0
  38. package/dist/components/fields/created-by/ReadView.d.ts +6 -0
  39. package/dist/components/fields/created-by/ReadView.js +25 -0
  40. package/dist/components/fields/data-quote/ReadView.d.ts +7 -0
  41. package/dist/components/fields/data-quote/ReadView.js +22 -0
  42. package/dist/components/fields/data-quote/utils.d.ts +3 -0
  43. package/dist/components/fields/data-quote/utils.js +25 -0
  44. package/dist/components/fields/date/ReadView.d.ts +8 -0
  45. package/dist/components/fields/date/ReadView.js +14 -0
  46. package/dist/components/fields/dropdown/BaseField.d.ts +6 -0
  47. package/dist/components/fields/dropdown/BaseField.js +4 -0
  48. package/dist/components/fields/dropdown/ReadView.d.ts +4 -0
  49. package/dist/components/fields/dropdown/ReadView.js +22 -0
  50. package/dist/components/fields/file/ReadView.d.ts +4 -0
  51. package/dist/components/fields/file/ReadView.js +14 -0
  52. package/dist/components/fields/formula/ReadView.d.ts +9 -0
  53. package/dist/components/fields/formula/ReadView.js +14 -0
  54. package/dist/components/fields/hooks/useParamsAdapter.d.ts +11 -0
  55. package/dist/components/fields/hooks/useParamsAdapter.js +1 -0
  56. package/dist/components/fields/hyper-link/ReadView.d.ts +12 -0
  57. package/dist/components/fields/hyper-link/ReadView.js +16 -0
  58. package/dist/components/fields/hyper-link/style/index.d.ts +3 -0
  59. package/dist/components/fields/hyper-link/style/index.js +19 -0
  60. package/dist/components/fields/item-group/ReadView.d.ts +5 -0
  61. package/dist/components/fields/item-group/ReadView.js +6 -0
  62. package/dist/components/fields/item-type/ReadView.d.ts +4 -0
  63. package/dist/components/fields/item-type/ReadView.js +9 -0
  64. package/dist/components/fields/key/ReadView.d.ts +4 -0
  65. package/dist/components/fields/key/ReadView.js +9 -0
  66. package/dist/components/fields/long-text/ReadView.d.ts +4 -0
  67. package/dist/components/fields/long-text/ReadView.js +10 -0
  68. package/dist/components/fields/long-text/style/index.d.ts +1 -0
  69. package/dist/components/fields/long-text/style/index.js +7 -0
  70. package/dist/{cells → components/fields}/number/BaseField.d.ts +4 -5
  71. package/dist/components/fields/number/BaseField.js +4 -0
  72. package/dist/components/fields/number/ReadView.d.ts +4 -0
  73. package/dist/components/fields/number/ReadView.js +21 -0
  74. package/dist/components/fields/priority/ReadView.d.ts +15 -0
  75. package/dist/components/fields/priority/ReadView.js +17 -0
  76. package/dist/components/fields/priority/style/index.d.ts +3 -0
  77. package/dist/components/fields/priority/style/index.js +30 -0
  78. package/dist/components/fields/radio/BaseField.d.ts +13 -0
  79. package/dist/components/fields/radio/BaseField.js +1 -0
  80. package/dist/components/fields/radio/ReadView.d.ts +5 -0
  81. package/dist/components/fields/radio/ReadView.js +19 -0
  82. package/dist/components/fields/reporter/ReadView.d.ts +7 -0
  83. package/dist/components/fields/reporter/ReadView.js +25 -0
  84. package/dist/components/fields/script/BaseField.d.ts +10 -0
  85. package/dist/components/fields/script/BaseField.js +12 -0
  86. package/dist/components/fields/script/ReadView.d.ts +4 -0
  87. package/dist/components/fields/script/ReadView.js +21 -0
  88. package/dist/components/fields/sprint/ReadView.d.ts +4 -0
  89. package/dist/components/fields/sprint/ReadView.js +12 -0
  90. package/dist/{cells/status/index.d.ts → components/fields/status/Cell.d.ts} +1 -1
  91. package/dist/components/fields/status/Cell.js +19 -0
  92. package/dist/{cells → components/fields}/status/Field.d.ts +8 -8
  93. package/dist/components/fields/status/Field.js +1 -0
  94. package/dist/components/fields/status/ReadView.d.ts +4 -0
  95. package/dist/components/fields/status/ReadView.js +22 -0
  96. package/dist/{cells → components/fields}/status/Transition.d.ts +4 -3
  97. package/dist/components/fields/status/Transition.js +44 -0
  98. package/dist/{cells → components/fields}/status/TransitionButton.d.ts +9 -2
  99. package/dist/components/fields/status/TransitionButton.js +122 -0
  100. package/dist/{cells → components/fields}/status/TransitionPanel.d.ts +4 -1
  101. package/dist/components/fields/status/TransitionPanel.js +245 -0
  102. package/dist/{cells → components/fields}/status/View.d.ts +2 -2
  103. package/dist/components/fields/status/View.js +20 -0
  104. package/dist/components/fields/status/style/index.d.ts +20 -0
  105. package/dist/components/fields/status/style/index.js +155 -0
  106. package/dist/components/fields/story-point/ReadView.d.ts +4 -0
  107. package/dist/components/fields/story-point/ReadView.js +10 -0
  108. package/dist/{cells → components/fields}/tag/BaseField.d.ts +6 -7
  109. package/dist/components/fields/tag/BaseField.js +1 -0
  110. package/dist/components/fields/tag/ReadView.d.ts +6 -0
  111. package/dist/components/fields/tag/ReadView.js +20 -0
  112. package/dist/components/fields/tag/style/index.d.ts +1 -0
  113. package/dist/components/fields/tag/style/index.js +7 -0
  114. package/dist/components/fields/team/ReadView.d.ts +5 -0
  115. package/dist/components/fields/team/ReadView.js +17 -0
  116. package/dist/components/fields/team/style/index.d.ts +2 -0
  117. package/dist/components/fields/team/style/index.js +5 -0
  118. package/dist/{cells → components/fields}/text/BaseField.d.ts +5 -5
  119. package/dist/components/fields/text/BaseField.js +1 -0
  120. package/dist/components/fields/text/ReadView.d.ts +4 -0
  121. package/dist/components/fields/text/ReadView.js +18 -0
  122. package/dist/{cells → components/fields}/tree/BaseField.d.ts +4 -6
  123. package/dist/components/fields/tree/BaseField.js +1 -0
  124. package/dist/components/fields/tree/ReadView.d.ts +4 -0
  125. package/dist/components/fields/tree/ReadView.js +56 -0
  126. package/dist/components/fields/tree/utils.js +22 -0
  127. package/dist/components/fields/types.d.ts +6 -0
  128. package/dist/components/fields/types.js +1 -0
  129. package/dist/components/fields/updated-at/ReadView.d.ts +5 -0
  130. package/dist/components/fields/updated-at/ReadView.js +21 -0
  131. package/dist/components/fields/updated-by/ReadView.d.ts +6 -0
  132. package/dist/components/fields/updated-by/ReadView.js +25 -0
  133. package/dist/components/fields/user/ReadView.d.ts +4 -0
  134. package/dist/components/fields/user/ReadView.js +22 -0
  135. package/dist/components/fields/user/style/index.d.ts +3 -0
  136. package/dist/components/fields/user/style/index.js +13 -0
  137. package/dist/components/fields/user-group/ActionCell.d.ts +7 -0
  138. package/dist/components/fields/user-group/ActionCell.js +1 -0
  139. package/dist/components/fields/user-group/BaseField.d.ts +16 -0
  140. package/dist/components/fields/user-group/BaseField.js +1 -0
  141. package/dist/components/fields/user-group/ReadView.d.ts +5 -0
  142. package/dist/components/fields/user-group/ReadView.js +55 -0
  143. package/dist/components/fields/version/ReadView.d.ts +5 -0
  144. package/dist/components/fields/version/ReadView.js +12 -0
  145. package/dist/components/fields/workspace/ReadView.d.ts +8 -0
  146. package/dist/components/fields/workspace/ReadView.js +9 -0
  147. package/dist/components/item/hooks.d.ts +1 -0
  148. package/dist/components/item/hooks.js +5 -0
  149. package/dist/components/table-components/EditTableCell.d.ts +16 -0
  150. package/dist/components/table-components/EditTableCell.js +17 -0
  151. package/dist/components/table-components/index.d.ts +12 -0
  152. package/dist/components/table-components/index.js +67 -0
  153. package/dist/components/table-components/style/index.d.ts +1 -0
  154. package/dist/components/table-components/style/index.js +9 -0
  155. package/dist/components/table-components/utils.d.ts +4 -0
  156. package/dist/components/table-components/utils.js +88 -0
  157. package/dist/icons/index.d.ts +7 -48
  158. package/dist/icons/index.js +10 -0
  159. package/dist/icons/svg/HollowCircle.svg +6 -0
  160. package/dist/icons/svg/Workflow.svg +12 -0
  161. package/dist/index.d.ts +41 -47
  162. package/dist/index.js +43 -3
  163. package/dist/lib/array.d.ts +10 -0
  164. package/dist/lib/array.js +44 -0
  165. package/dist/lib/contexts/antdConfig.d.ts +9 -0
  166. package/dist/lib/contexts/antdConfig.js +11 -0
  167. package/dist/lib/contexts/currentUser.d.ts +17 -0
  168. package/dist/lib/contexts/currentUser.js +9 -0
  169. package/dist/lib/contexts/currentWorkspace.d.ts +8 -0
  170. package/dist/lib/contexts/currentWorkspace.js +9 -0
  171. package/dist/lib/contexts/datetimeFormat.d.ts +9 -0
  172. package/dist/lib/contexts/datetimeFormat.js +9 -0
  173. package/dist/lib/contexts/index.d.ts +13 -7
  174. package/dist/lib/contexts/index.js +17 -0
  175. package/dist/lib/contexts/itemConfig.d.ts +11 -0
  176. package/dist/lib/contexts/itemConfig.js +9 -0
  177. package/dist/lib/contexts/teamConfig.d.ts +9 -0
  178. package/dist/lib/contexts/teamConfig.js +10 -0
  179. package/dist/lib/contexts/tenant.d.ts +8 -0
  180. package/dist/lib/contexts/tenant.js +9 -0
  181. package/dist/lib/contexts/workflowConfig.d.ts +15 -0
  182. package/dist/lib/contexts/workflowConfig.js +9 -0
  183. package/dist/lib/dataType.d.ts +2 -0
  184. package/dist/lib/dataType.js +16 -0
  185. package/dist/lib/date.d.ts +7 -1
  186. package/dist/lib/date.js +87 -0
  187. package/dist/lib/dayjs.d.ts +0 -1
  188. package/dist/lib/dayjs.js +4 -0
  189. package/dist/lib/global.d.ts +42 -1053
  190. package/dist/lib/global.js +97 -0
  191. package/dist/lib/hooks/useAntdConfig.d.ts +3 -0
  192. package/dist/lib/hooks/useAntdConfig.js +7 -0
  193. package/dist/lib/hooks/useCurrentUser.d.ts +2 -2
  194. package/dist/lib/hooks/useCurrentUser.js +7 -0
  195. package/dist/lib/hooks/useCurrentWorkspace.d.ts +3 -0
  196. package/dist/lib/hooks/useCurrentWorkspace.js +7 -0
  197. package/dist/lib/hooks/useDataQuoteStore.d.ts +4 -3
  198. package/dist/lib/hooks/useDataQuoteStore.js +65 -0
  199. package/dist/lib/hooks/useDateTimeFormatType.d.ts +3 -0
  200. package/dist/lib/hooks/useDateTimeFormatType.js +7 -0
  201. package/dist/lib/hooks/useI18n.d.ts +4 -1
  202. package/dist/lib/hooks/useI18n.js +7 -0
  203. package/dist/lib/hooks/useItemConfig.d.ts +3 -0
  204. package/dist/lib/hooks/useItemConfig.js +7 -0
  205. package/dist/lib/hooks/useTeamConfig.d.ts +3 -0
  206. package/dist/lib/hooks/useTeamConfig.js +7 -0
  207. package/dist/lib/hooks/useTenant.d.ts +2 -0
  208. package/dist/lib/hooks/useTenant.js +7 -0
  209. package/dist/lib/hooks/useWorkflowConfig.d.ts +3 -0
  210. package/dist/lib/hooks/useWorkflowConfig.js +7 -0
  211. package/dist/lib/i18n.d.ts +4 -22
  212. package/dist/lib/i18n.js +34 -0
  213. package/dist/lib/isInOne.d.ts +2 -0
  214. package/dist/lib/isInOne.js +12 -0
  215. package/dist/lib/number.d.ts +1 -0
  216. package/dist/lib/number.js +3 -0
  217. package/dist/lib/regExp.d.ts +1 -11
  218. package/dist/lib/regExp.js +1 -0
  219. package/dist/lib/store/dataQuoteStore.js +9 -0
  220. package/dist/lib/swr/constants.d.ts +30 -0
  221. package/dist/lib/swr/constants.js +32 -0
  222. package/dist/lib/swr/hooks.d.ts +7 -0
  223. package/dist/lib/swr/hooks.js +14 -0
  224. package/dist/lib/useUser.d.ts +4 -50
  225. package/dist/lib/useUser.js +33 -0
  226. package/dist/lib/users.d.ts +6 -3
  227. package/dist/lib/users.js +8 -0
  228. package/dist/lib/workflow.d.ts +31 -31
  229. package/dist/lib/workflow.js +371 -0
  230. package/dist/locales/index.d.ts +117 -0
  231. package/dist/locales/index.js +117 -0
  232. package/dist/style/common.d.ts +23 -0
  233. package/dist/style/common.js +23 -0
  234. package/package.json +37 -93
  235. package/dist/cells/actors/BaseField.d.ts +0 -17
  236. package/dist/cells/actors/index.d.ts +0 -4
  237. package/dist/cells/annex/index.d.ts +0 -7
  238. package/dist/cells/assignee/index.d.ts +0 -23
  239. package/dist/cells/bind-workspace/BaseField.d.ts +0 -15
  240. package/dist/cells/bind-workspace/index.d.ts +0 -12
  241. package/dist/cells/board/index.d.ts +0 -22
  242. package/dist/cells/card-type/index.d.ts +0 -6
  243. package/dist/cells/checkbox/BaseField.d.ts +0 -14
  244. package/dist/cells/created-at/index.d.ts +0 -7
  245. package/dist/cells/created-by/index.d.ts +0 -9
  246. package/dist/cells/data-quote/index.d.ts +0 -8
  247. package/dist/cells/data-quote/util.d.ts +0 -9
  248. package/dist/cells/date/BaseField.d.ts +0 -21
  249. package/dist/cells/date/index.d.ts +0 -6
  250. package/dist/cells/date-range/BaseField.d.ts +0 -19
  251. package/dist/cells/date-range/index.d.ts +0 -6
  252. package/dist/cells/dropdown/BaseField.d.ts +0 -30
  253. package/dist/cells/dropdown/index.d.ts +0 -22
  254. package/dist/cells/editor/BaseField.d.ts +0 -29
  255. package/dist/cells/editor/Field.d.ts +0 -16
  256. package/dist/cells/editor/config/autoformatRules.d.ts +0 -3
  257. package/dist/cells/editor/config/index.d.ts +0 -5
  258. package/dist/cells/editor/config/pluginOptions.d.ts +0 -10
  259. package/dist/cells/editor/config/withDeserializeHTML.d.ts +0 -64
  260. package/dist/cells/editor/config/withStyledDraggables.d.ts +0 -2
  261. package/dist/cells/editor/config/withStyledPlaceHolders.d.ts +0 -2
  262. package/dist/cells/editor/elements/ImageElement.d.ts +0 -3
  263. package/dist/cells/editor/elements/MentionElement.d.ts +0 -3
  264. package/dist/cells/editor/elements/index.d.ts +0 -2
  265. package/dist/cells/editor/hooks.d.ts +0 -11
  266. package/dist/cells/editor/index.d.ts +0 -15
  267. package/dist/cells/editor/plugins/Fullscreen.d.ts +0 -7
  268. package/dist/cells/editor/plugins/ToolbarButton.d.ts +0 -3
  269. package/dist/cells/editor/plugins/ToolbarFont.d.ts +0 -12
  270. package/dist/cells/editor/plugins/ToolbarFontColor.d.ts +0 -7
  271. package/dist/cells/editor/plugins/ToolbarHistory.d.ts +0 -7
  272. package/dist/cells/editor/plugins/ToolbarLink.d.ts +0 -4
  273. package/dist/cells/editor/plugins/ToolbarTable.d.ts +0 -4
  274. package/dist/cells/editor/plugins/ToolbarUpload.d.ts +0 -4
  275. package/dist/cells/editor/plugins/Toolbars.d.ts +0 -11
  276. package/dist/cells/editor/plugins/font-bg-color/createFontBgColorPlugin.d.ts +0 -3
  277. package/dist/cells/editor/plugins/font-bg-color/defaults.d.ts +0 -2
  278. package/dist/cells/editor/plugins/font-bg-color/getFontDeserialize.d.ts +0 -2
  279. package/dist/cells/editor/plugins/font-bg-color/index.d.ts +0 -3
  280. package/dist/cells/editor/plugins/font-color/createFontColorPlugin.d.ts +0 -3
  281. package/dist/cells/editor/plugins/font-color/defaults.d.ts +0 -2
  282. package/dist/cells/editor/plugins/font-color/getFontDeserialize.d.ts +0 -2
  283. package/dist/cells/editor/plugins/font-color/index.d.ts +0 -3
  284. package/dist/cells/editor/plugins/font-family/createFontFamilyPlugin.d.ts +0 -3
  285. package/dist/cells/editor/plugins/font-family/defaults.d.ts +0 -2
  286. package/dist/cells/editor/plugins/font-family/getFontDeserialize.d.ts +0 -2
  287. package/dist/cells/editor/plugins/font-family/index.d.ts +0 -3
  288. package/dist/cells/editor/plugins/font-line-height/createFontLineHeightPlugin.d.ts +0 -3
  289. package/dist/cells/editor/plugins/font-line-height/defaults.d.ts +0 -2
  290. package/dist/cells/editor/plugins/font-line-height/getFontDeserialize.d.ts +0 -2
  291. package/dist/cells/editor/plugins/font-line-height/index.d.ts +0 -3
  292. package/dist/cells/editor/plugins/font-size/createFontSizePlugin.d.ts +0 -3
  293. package/dist/cells/editor/plugins/font-size/defaults.d.ts +0 -2
  294. package/dist/cells/editor/plugins/font-size/getFontDeserialize.d.ts +0 -2
  295. package/dist/cells/editor/plugins/font-size/index.d.ts +0 -3
  296. package/dist/cells/editor/plugins/image/createImagePlugin.d.ts +0 -3
  297. package/dist/cells/editor/plugins/image/getImageDeserialize.d.ts +0 -2
  298. package/dist/cells/editor/plugins/image/index.d.ts +0 -3
  299. package/dist/cells/editor/plugins/image/insertImage.d.ts +0 -2
  300. package/dist/cells/editor/plugins/image/withImageUpload.d.ts +0 -3
  301. package/dist/cells/editor/plugins/index.d.ts +0 -6
  302. package/dist/cells/editor/utils.d.ts +0 -13
  303. package/dist/cells/file/BaseField.d.ts +0 -15
  304. package/dist/cells/file/UploadFile.d.ts +0 -19
  305. package/dist/cells/file/index.d.ts +0 -13
  306. package/dist/cells/formula/BaseField.d.ts +0 -10
  307. package/dist/cells/formula/index.d.ts +0 -9
  308. package/dist/cells/item-group/index.d.ts +0 -22
  309. package/dist/cells/item-type/index.d.ts +0 -23
  310. package/dist/cells/key/index.d.ts +0 -6
  311. package/dist/cells/long-text/BaseField.d.ts +0 -17
  312. package/dist/cells/long-text/index.d.ts +0 -15
  313. package/dist/cells/name/index.d.ts +0 -14
  314. package/dist/cells/number/index.d.ts +0 -23
  315. package/dist/cells/priority/index.d.ts +0 -16
  316. package/dist/cells/radio/BaseField.d.ts +0 -14
  317. package/dist/cells/script/BaseField.d.ts +0 -8
  318. package/dist/cells/script/index.d.ts +0 -7
  319. package/dist/cells/security-level/BaseField.d.ts +0 -19
  320. package/dist/cells/sprint/index.d.ts +0 -22
  321. package/dist/cells/status/hooks.d.ts +0 -3
  322. package/dist/cells/story-point/index.d.ts +0 -23
  323. package/dist/cells/tableCellMapping.d.ts +0 -23
  324. package/dist/cells/tag/tag-multiple-select/PopoverPanel.d.ts +0 -4
  325. package/dist/cells/tag/tag-multiple-select/TagPopoverSelect.d.ts +0 -4
  326. package/dist/cells/text/index.d.ts +0 -16
  327. package/dist/cells/time/BaseField.d.ts +0 -15
  328. package/dist/cells/time/index.d.ts +0 -6
  329. package/dist/cells/time-range/BaseField.d.ts +0 -20
  330. package/dist/cells/time-range/index.d.ts +0 -7
  331. package/dist/cells/updated-at/index.d.ts +0 -7
  332. package/dist/cells/updated-by/index.d.ts +0 -9
  333. package/dist/cells/user/BaseField.d.ts +0 -27
  334. package/dist/cells/user/index.d.ts +0 -21
  335. package/dist/cells/version/index.d.ts +0 -22
  336. package/dist/cells/workspace/index.d.ts +0 -22
  337. package/dist/common/FieldErrorBoundary.d.ts +0 -14
  338. package/dist/common/OverflowTooltip.d.ts +0 -23
  339. package/dist/common/UploadFile.d.ts +0 -19
  340. package/dist/common/base-table/ChildCardInlineCreator.d.ts +0 -9
  341. package/dist/common/base-table/index.d.ts +0 -16
  342. package/dist/common/columns-settings/ColumnsSettings.d.ts +0 -5
  343. package/dist/common/columns-settings/ColumnsSettingsItem.d.ts +0 -4
  344. package/dist/common/data-source/context.d.ts +0 -2
  345. package/dist/common/date/DatePicker.d.ts +0 -11
  346. package/dist/common/date/TimePicker.d.ts +0 -19
  347. package/dist/common/filters/filter-query/FilterPanel.d.ts +0 -4
  348. package/dist/common/filters/filter-query/IqlExpression.d.ts +0 -6
  349. package/dist/common/filters/filter-query/QuerySelector.d.ts +0 -4
  350. package/dist/common/filters/filter-query/utils.d.ts +0 -18
  351. package/dist/common/form-field/FormField.d.ts +0 -15
  352. package/dist/common/form-field/pure-field/FieldLayout.d.ts +0 -5
  353. package/dist/common/form-field/pure-field/FormikEnhance.d.ts +0 -1
  354. package/dist/common/form-field/pure-field/PureField.d.ts +0 -8
  355. package/dist/common/formik-field-touched/FormikFieldTouched.d.ts +0 -2
  356. package/dist/common/index.d.ts +0 -16
  357. package/dist/common/item/IssueActionDropdown.d.ts +0 -18
  358. package/dist/common/item-icon/ItemIcon.d.ts +0 -8
  359. package/dist/common/plugin/PluginComponents.d.ts +0 -17
  360. package/dist/common/plugin/PluginErrorContainer.d.ts +0 -15
  361. package/dist/common/plugin/PluginLoadComponent.d.ts +0 -27
  362. package/dist/common/search-select/PopoverPanel.d.ts +0 -4
  363. package/dist/common/search-select/SearchPopoverSelect.d.ts +0 -4
  364. package/dist/common/status-selector/index.d.ts +0 -9
  365. package/dist/common/structure/hooks.d.ts +0 -30
  366. package/dist/common/structure/index.d.ts +0 -11
  367. package/dist/common/structure/table-components/TableActionMenu.d.ts +0 -18
  368. package/dist/common/structure/table-components/TableColumnSettings.d.ts +0 -13
  369. package/dist/common/structure/table-components/TableEmpty.d.ts +0 -6
  370. package/dist/common/structure/table-components/TableTitleCell.d.ts +0 -16
  371. package/dist/common/structure/table-components/index.d.ts +0 -11
  372. package/dist/common/structure/table-components/tableCellMapping.d.ts +0 -23
  373. package/dist/common/structure/table-components/useCacheColumns.d.ts +0 -13
  374. package/dist/common/structure/table-components/useTableColumns.d.ts +0 -22
  375. package/dist/common/structure/table-components/useTableMenu.d.ts +0 -42
  376. package/dist/common/structure-table/Table.d.ts +0 -4
  377. package/dist/common/structure-table/components/Action.d.ts +0 -15
  378. package/dist/common/structure-table/components/Collapse.d.ts +0 -12
  379. package/dist/common/structure-table/components/CollapseIcon.d.ts +0 -6
  380. package/dist/common/structure-table/components/DraggableRow.d.ts +0 -5
  381. package/dist/common/structure-table/components/Handle.d.ts +0 -3
  382. package/dist/common/structure-table/components/Row.d.ts +0 -25
  383. package/dist/common/structure-table/components/index.d.ts +0 -6
  384. package/dist/common/structure-table/index.d.ts +0 -1
  385. package/dist/common/user-field/UserField.d.ts +0 -15
  386. package/dist/common/user-field/index.d.ts +0 -2
  387. package/dist/common/utils.d.ts +0 -41
  388. package/dist/common/workflow/View.d.ts +0 -11
  389. package/dist/common/workflow/config.d.ts +0 -87
  390. package/dist/common/workflow/nodes/StartNode.d.ts +0 -10
  391. package/dist/common/workflow/nodes/TaskNode.d.ts +0 -12
  392. package/dist/common/workflow/nodes/index.d.ts +0 -2
  393. package/dist/fields/base-component/BaseLabel.d.ts +0 -10
  394. package/dist/fields/base-component/utils.d.ts +0 -4
  395. package/dist/fields/data-quote/util.d.ts +0 -9
  396. package/dist/fields/item-activity/BaseField.d.ts +0 -7
  397. package/dist/fields/item-activity/Comment.d.ts +0 -7
  398. package/dist/fields/item-level/hooks.d.ts +0 -15
  399. package/dist/fields/item-level/utils.d.ts +0 -25
  400. package/dist/index.js.LICENSE.txt +0 -40
  401. package/dist/index.js.map +0 -1
  402. package/dist/lib/ParentMessage.d.ts +0 -7
  403. package/dist/lib/apis/filter/iql.d.ts +0 -6
  404. package/dist/lib/apis/forest.d.ts +0 -2
  405. package/dist/lib/apis/groups/index.d.ts +0 -21
  406. package/dist/lib/apis/roles/index.d.ts +0 -11
  407. package/dist/lib/apis/screen/fields.d.ts +0 -21
  408. package/dist/lib/apis/screen/fieldsBehavior.d.ts +0 -10
  409. package/dist/lib/apis/screen/index.d.ts +0 -20
  410. package/dist/lib/contexts/LibraryProvider.d.ts +0 -18
  411. package/dist/lib/contexts/currentUserAndRoles.d.ts +0 -15
  412. package/dist/lib/contexts/token.d.ts +0 -13
  413. package/dist/lib/contexts/users.d.ts +0 -11
  414. package/dist/lib/contexts/values.d.ts +0 -6
  415. package/dist/lib/customFields/hooks.d.ts +0 -24
  416. package/dist/lib/env.d.ts +0 -2
  417. package/dist/lib/error/index.d.ts +0 -2
  418. package/dist/lib/error/log.d.ts +0 -13
  419. package/dist/lib/error/utils.d.ts +0 -13
  420. package/dist/lib/events.d.ts +0 -11
  421. package/dist/lib/fetch.d.ts +0 -49
  422. package/dist/lib/filters/filter-query/utils.d.ts +0 -18
  423. package/dist/lib/forest.d.ts +0 -60
  424. package/dist/lib/hooks/index.d.ts +0 -13
  425. package/dist/lib/hooks/useCustomFields.d.ts +0 -9
  426. package/dist/lib/hooks/useFieldTypes.d.ts +0 -9
  427. package/dist/lib/hooks/useFields.d.ts +0 -12
  428. package/dist/lib/hooks/useItemsInfinite.d.ts +0 -48
  429. package/dist/lib/hooks/useRemoteComponents.d.ts +0 -25
  430. package/dist/lib/hooks/useTenants.d.ts +0 -7
  431. package/dist/lib/hooks/useToken.d.ts +0 -3
  432. package/dist/lib/hooks/useUsers.d.ts +0 -8
  433. package/dist/lib/hooks/useWatchItemUpdate.d.ts +0 -32
  434. package/dist/lib/hooks/useWorkspaces.d.ts +0 -8
  435. package/dist/lib/iql.d.ts +0 -31
  436. package/dist/lib/item/hooks.d.ts +0 -31
  437. package/dist/lib/item/utils.d.ts +0 -34
  438. package/dist/lib/kanban/hooks.d.ts +0 -8
  439. package/dist/lib/locales.d.ts +0 -4
  440. package/dist/lib/models.d.ts +0 -59
  441. package/dist/lib/parse.d.ts +0 -3
  442. package/dist/lib/path.d.ts +0 -4
  443. package/dist/lib/proxima-sdk/components/index.d.ts +0 -2
  444. package/dist/lib/proxima-sdk/hooks/index.d.ts +0 -4
  445. package/dist/lib/proxima-sdk/index.d.ts +0 -5
  446. package/dist/lib/proxima-sdk/lib/index.d.ts +0 -9
  447. package/dist/lib/proxima-sdk/schema/index.d.ts +0 -2
  448. package/dist/lib/storage.d.ts +0 -7
  449. package/dist/lib/store.d.ts +0 -14
  450. package/dist/lib/types/index.d.ts +0 -3
  451. package/dist/lib/types/parse-models.d.ts +0 -6
  452. package/dist/lib/useInitialRecoilState.d.ts +0 -3
  453. package/dist/lib/useParseQuery.d.ts +0 -53
  454. package/dist/lib/usePluginManifest.d.ts +0 -33
  455. package/dist/lib/useWatchApp.d.ts +0 -4
  456. package/dist/lib/useWorkspace.d.ts +0 -1
  457. package/dist/lib/workspace.d.ts +0 -2
  458. package/dist/locales/en/en_US.d.ts +0 -45
  459. package/dist/locales/en/package/application.d.ts +0 -73
  460. package/dist/locales/en/package/automation.d.ts +0 -303
  461. package/dist/locales/en/package/date.d.ts +0 -54
  462. package/dist/locales/en/package/fields.d.ts +0 -409
  463. package/dist/locales/en/package/filters.d.ts +0 -89
  464. package/dist/locales/en/package/formField.d.ts +0 -157
  465. package/dist/locales/en/package/global.d.ts +0 -318
  466. package/dist/locales/en/package/item.d.ts +0 -488
  467. package/dist/locales/en/package/itemTypes.d.ts +0 -154
  468. package/dist/locales/en/package/lib.d.ts +0 -127
  469. package/dist/locales/en/package/message.d.ts +0 -251
  470. package/dist/locales/en/package/pages.d.ts +0 -67
  471. package/dist/locales/en/package/permission.d.ts +0 -471
  472. package/dist/locales/en/package/placeholder.d.ts +0 -179
  473. package/dist/locales/en/package/plugin.d.ts +0 -20
  474. package/dist/locales/en/package/report.d.ts +0 -150
  475. package/dist/locales/en/package/reportPlugin.d.ts +0 -183
  476. package/dist/locales/en/package/screen.d.ts +0 -121
  477. package/dist/locales/en/package/sections.d.ts +0 -60
  478. package/dist/locales/en/package/settings.d.ts +0 -194
  479. package/dist/locales/en/package/sprint.d.ts +0 -52
  480. package/dist/locales/en/package/users.d.ts +0 -58
  481. package/dist/locales/en/package/validate.d.ts +0 -138
  482. package/dist/locales/en/package/views.d.ts +0 -383
  483. package/dist/locales/en/package/workflow.d.ts +0 -245
  484. package/dist/locales/en/package/workspace.d.ts +0 -342
  485. package/dist/locales/zh/package/application.d.ts +0 -73
  486. package/dist/locales/zh/package/automation.d.ts +0 -303
  487. package/dist/locales/zh/package/date.d.ts +0 -54
  488. package/dist/locales/zh/package/fields.d.ts +0 -409
  489. package/dist/locales/zh/package/filters.d.ts +0 -89
  490. package/dist/locales/zh/package/formField.d.ts +0 -162
  491. package/dist/locales/zh/package/global.d.ts +0 -318
  492. package/dist/locales/zh/package/item.d.ts +0 -489
  493. package/dist/locales/zh/package/itemTypes.d.ts +0 -153
  494. package/dist/locales/zh/package/lib.d.ts +0 -127
  495. package/dist/locales/zh/package/message.d.ts +0 -251
  496. package/dist/locales/zh/package/pages.d.ts +0 -67
  497. package/dist/locales/zh/package/permission.d.ts +0 -470
  498. package/dist/locales/zh/package/placeholder.d.ts +0 -172
  499. package/dist/locales/zh/package/plugin.d.ts +0 -20
  500. package/dist/locales/zh/package/report.d.ts +0 -150
  501. package/dist/locales/zh/package/reportPlugin.d.ts +0 -183
  502. package/dist/locales/zh/package/screen.d.ts +0 -116
  503. package/dist/locales/zh/package/sections.d.ts +0 -63
  504. package/dist/locales/zh/package/settings.d.ts +0 -192
  505. package/dist/locales/zh/package/sprint.d.ts +0 -52
  506. package/dist/locales/zh/package/users.d.ts +0 -58
  507. package/dist/locales/zh/package/validate.d.ts +0 -138
  508. package/dist/locales/zh/package/views.d.ts +0 -380
  509. package/dist/locales/zh/package/workflow.d.ts +0 -245
  510. package/dist/locales/zh/package/workspace.d.ts +0 -344
  511. package/dist/locales/zh/zh_CN.d.ts +0 -46
  512. package/dist/main.css +0 -28488
  513. package/dist/main.css.map +0 -1
  514. package/dist/osui/index.d.ts +0 -8
  515. /package/dist/{cells → components/fields}/tree/utils.d.ts +0 -0
  516. /package/dist/lib/{dataQuoteStore.d.ts → store/dataQuoteStore.d.ts} +0 -0
@@ -1,15 +1,24 @@
1
+ import { CurrentUser } from './contexts/currentUser';
1
2
  import { ItemResultProps } from './types/item';
2
- import { ResultType, TransitionProps } from './types/workflow';
3
- export declare const StatusTypeKey: {
4
- Start: string;
5
- InProgress: string;
6
- Finished: string;
7
- };
8
- export declare enum StatusType {
9
- Start = "\u672A\u5F00\u59CB",
10
- InProgress = "\u8FDB\u884C\u4E2D",
11
- Finished = "\u5DF2\u5B8C\u6210"
3
+ import { ObjectId } from './types/models';
4
+ import { ResultType, TransitionProps, WorkflowPermissionType } from './types/workflow';
5
+ export declare enum ElementEnum {
6
+ Node = "Node",
7
+ Edge = "Edge"
8
+ }
9
+ export declare enum NodeEnum {
10
+ Start = "Start",
11
+ Task = "Task"
12
12
  }
13
+ export type userType = {
14
+ objectId: string;
15
+ username: string;
16
+ nickname: string;
17
+ email: string;
18
+ createdAt: string;
19
+ updatedAt: string;
20
+ };
21
+ export declare const getScriptUser: (user: CurrentUser) => userType;
13
22
  export declare const EmptyConditionList: {
14
23
  key: string;
15
24
  name: string;
@@ -86,26 +95,17 @@ export declare const DropdownConditions: {
86
95
  name: string;
87
96
  };
88
97
  };
89
- export declare const CustomFieldComponentTypes: {
90
- Date: string;
91
- Dropdown: string;
92
- User: string;
93
- Assignee: string;
94
- Number: string;
95
- LongText: string;
96
- Text: string;
97
- File: string;
98
- };
99
98
  export declare function isEmptyCondition(key: string): boolean;
100
- /** 校验用户是否有状态流转操作权限 */
101
- export declare function checkUserPermission(transition: TransitionProps, userId: string, roleIds: string[], groupIds: string[], values: Record<string, any>): ResultType;
102
- /** 校验事项 value 字段是否可流转 */
99
+ interface CheckUserPermissionParams {
100
+ transition: TransitionProps;
101
+ userId: ObjectId;
102
+ roleIds: ObjectId[];
103
+ groupIds: ObjectId[];
104
+ item: ItemResultProps;
105
+ workspaceRoleIds: ObjectId[];
106
+ }
107
+ export declare function checkUserPermission({ transition, userId, roleIds, groupIds, item, workspaceRoleIds, }: CheckUserPermissionParams): ResultType;
103
108
  export declare function checkItemCondition(transition: TransitionProps, item: ItemResultProps): ResultType;
104
- /** 校验事项状态是否可流转 */
105
- export declare function checkTransition(item: ItemResultProps, transition: TransitionProps, userId: string, roleIds: string[], groupIds: string[]): ResultType;
106
- export declare function checkTransitionScript(scriptText: string, params: {
107
- itemId: string;
108
- itemType: string;
109
- workspace: string;
110
- status: string;
111
- }, sessionToken: string): Promise<ResultType>;
109
+ export declare function checkTransition(item: ItemResultProps, transition: TransitionProps, permissions: WorkflowPermissionType): ResultType;
110
+ export declare const useWorkflowPermission: (workspaceId: ObjectId) => [ObjectId[], ObjectId[], ObjectId[]];
111
+ export {};
@@ -0,0 +1,371 @@
1
+ import { useEffect, useState } from 'react';
2
+ import { pick } from 'lodash-es';
3
+ import { SUPPORT_USER_KEYS } from '../components/field-behavior/fields/type';
4
+ import useWorkflowConfig from './hooks/useWorkflowConfig';
5
+ import { getDateType, getFormat } from './date';
6
+ import { CustomFieldComponentTypes } from './global';
7
+ import { i18n } from './i18n';
8
+ export var ElementEnum;
9
+ (function (ElementEnum) {
10
+ ElementEnum["Node"] = "Node";
11
+ ElementEnum["Edge"] = "Edge";
12
+ })(ElementEnum || (ElementEnum = {}));
13
+ export var NodeEnum;
14
+ (function (NodeEnum) {
15
+ NodeEnum["Start"] = "Start";
16
+ NodeEnum["Task"] = "Task";
17
+ })(NodeEnum || (NodeEnum = {}));
18
+ export const getScriptUser = (user) => {
19
+ if (!user)
20
+ return null;
21
+ return pick(user.toJSON(), [
22
+ 'objectId',
23
+ 'username',
24
+ 'email',
25
+ 'nickname',
26
+ 'createdAt',
27
+ 'updatedAt',
28
+ ]);
29
+ };
30
+ const EmptyCondition = { key: 'isEmpty', name: '为空' };
31
+ const NotEmptyCondition = { key: 'notEmpty', name: '非空' };
32
+ export const EmptyConditionList = [EmptyCondition, NotEmptyCondition];
33
+ export const NumberConditions = {
34
+ equalTo: { key: 'equalTo', name: '等于' },
35
+ greaterThan: { key: 'greaterThan', name: '大于' },
36
+ greaterThanOrEqualTo: { key: 'greaterThanOrEqualTo', name: '大于等于' },
37
+ lessThan: { key: 'lessThan', name: '小于' },
38
+ lessThanOrEqualTo: { key: 'lessThanOrEqualTo', name: '小于等于' },
39
+ notEqualTo: { key: 'notEqualTo', name: '不等于' },
40
+ isEmpty: EmptyCondition,
41
+ notEmpty: NotEmptyCondition,
42
+ };
43
+ export const StringConditions = {
44
+ equalTo: { key: 'equalTo', name: '等于' },
45
+ notEqualTo: { key: 'notEqualTo', name: '不等于' },
46
+ isEmpty: EmptyCondition,
47
+ notEmpty: NotEmptyCondition,
48
+ };
49
+ export const DropdownConditions = {
50
+ containedIn: { key: 'containedIn', name: '包含', not: 'File' },
51
+ notContainedIn: { key: 'notContainedIn', name: '不包含', not: 'File' },
52
+ isEmpty: EmptyCondition,
53
+ notEmpty: NotEmptyCondition,
54
+ };
55
+ const ItemFieldType = {
56
+ name: 'name',
57
+ itemType: 'itemType',
58
+ status: 'status',
59
+ workspace: 'workspace',
60
+ reporter: 'reporter',
61
+ };
62
+ export function isEmptyCondition(key) {
63
+ return EmptyConditionList.map(d => d.key).includes(key);
64
+ }
65
+ function numberToCompare(num1, num2, compareString) {
66
+ switch (compareString) {
67
+ case NumberConditions.isEmpty.key:
68
+ return num1 !== 0 && !num1;
69
+ case NumberConditions.notEmpty.key:
70
+ return num1 === 0 || !!num1;
71
+ case NumberConditions.equalTo.key:
72
+ return num1 === num2;
73
+ case NumberConditions.greaterThan.key:
74
+ return num1 > num2;
75
+ case NumberConditions.greaterThanOrEqualTo.key:
76
+ return num1 >= num2;
77
+ case NumberConditions.lessThan.key:
78
+ return num1 < num2;
79
+ case NumberConditions.lessThanOrEqualTo.key:
80
+ return num1 <= num2;
81
+ case NumberConditions.notEqualTo.key:
82
+ return num1 !== num2;
83
+ default:
84
+ return false;
85
+ }
86
+ }
87
+ function stringToCompare(str1, str2, compareString) {
88
+ switch (compareString) {
89
+ case StringConditions.isEmpty.key:
90
+ return !str1;
91
+ case StringConditions.notEmpty.key:
92
+ return !!str1;
93
+ case StringConditions.equalTo.key:
94
+ return str1 === str2;
95
+ case StringConditions.notEqualTo.key:
96
+ return str1 !== str2;
97
+ default:
98
+ return false;
99
+ }
100
+ }
101
+ function listToCompare(list1, list2, compareString) {
102
+ switch (compareString) {
103
+ case DropdownConditions.isEmpty.key:
104
+ return !(list1 === null || list1 === void 0 ? void 0 : list1.length);
105
+ case DropdownConditions.notEmpty.key:
106
+ return !!(list1 === null || list1 === void 0 ? void 0 : list1.length);
107
+ case DropdownConditions.containedIn.key:
108
+ return list2.every(item => list1.includes(item));
109
+ case DropdownConditions.notContainedIn.key:
110
+ return list2.every(item => {
111
+ const r = !list1.includes(item);
112
+ return r;
113
+ });
114
+ default:
115
+ return false;
116
+ }
117
+ }
118
+ export function checkUserPermission({ transition, userId, roleIds, groupIds, item, workspaceRoleIds, }) {
119
+ var _a, _b, _c;
120
+ const values = (item === null || item === void 0 ? void 0 : item.values) || {};
121
+ const { users: authUsers, roles: authRoles, groups: authGroups, customFields: authUserFields, workspaceRoles: authWorkspaceRoles, creatorAuth, } = ((_a = transition.parameters) === null || _a === void 0 ? void 0 : _a.permissionType) || {};
122
+ const hasUsers = (authUsers === null || authUsers === void 0 ? void 0 : authUsers.length) > 0;
123
+ const hasRoles = (authRoles === null || authRoles === void 0 ? void 0 : authRoles.length) > 0;
124
+ const hasGroups = (authGroups === null || authGroups === void 0 ? void 0 : authGroups.length) > 0;
125
+ const hasUserFields = (authUserFields === null || authUserFields === void 0 ? void 0 : authUserFields.length) > 0;
126
+ const hasWorkspaceRoles = (authWorkspaceRoles === null || authWorkspaceRoles === void 0 ? void 0 : authWorkspaceRoles.length) > 0;
127
+ const tipText = [];
128
+ if (!hasUsers && !hasRoles && !hasGroups && !hasUserFields && !hasWorkspaceRoles && !creatorAuth) {
129
+ return { result: true };
130
+ }
131
+ if (creatorAuth) {
132
+ if (![(_b = item.createdBy) === null || _b === void 0 ? void 0 : _b.objectId, (_c = item.createdBy) === null || _c === void 0 ? void 0 : _c.id].includes(userId)) {
133
+ tipText.push(i18n.t('pages.workflow.default.userType.creatorAuth'));
134
+ }
135
+ else {
136
+ return { result: true };
137
+ }
138
+ }
139
+ if (hasUsers) {
140
+ const hasAuth = authUsers.map(user => user.value).includes(userId);
141
+ if (!hasAuth) {
142
+ const tipUsers = authUsers.map(user => (user === null || user === void 0 ? void 0 : user.label) || (user === null || user === void 0 ? void 0 : user.children)).join('、');
143
+ tipText.push(`${i18n.t('libs.workflow.user')}:${tipUsers}`);
144
+ }
145
+ else {
146
+ return { result: true };
147
+ }
148
+ }
149
+ if (hasRoles) {
150
+ const hasAuth = authRoles.some(role => roleIds.includes(role.value || role.key));
151
+ if (!hasAuth) {
152
+ const tipRoles = authRoles.map(role => role.label || role.children).join('、');
153
+ tipText.push(`${i18n.t('libs.workflow.role')}:${tipRoles}`);
154
+ }
155
+ else {
156
+ return { result: true };
157
+ }
158
+ }
159
+ if (hasGroups) {
160
+ const hasAuth = authGroups.some(group => groupIds.includes(group.value || group.key));
161
+ if (!hasAuth) {
162
+ const tipGroup = authGroups.map(group => group.label || group.children).join('、');
163
+ tipText.push(`${i18n.t('libs.workflow.group')}:${tipGroup}`);
164
+ }
165
+ else {
166
+ return { result: true };
167
+ }
168
+ }
169
+ if (hasUserFields) {
170
+ const userFieldObj = pick(values, authUserFields.map(field => field.value || field.key));
171
+ let hasAuth = false;
172
+ const keys = Object.keys(userFieldObj);
173
+ for (let i = 0; i < keys.length; i++) {
174
+ const fieldObj = userFieldObj[keys[i]];
175
+ if (fieldObj && fieldObj.length) {
176
+ hasAuth = fieldObj.map(user => user.value).includes(userId);
177
+ if (hasAuth)
178
+ break;
179
+ }
180
+ }
181
+ if (!hasAuth) {
182
+ const tipRoles = authUserFields.map(field => field.label || field.children).join('、');
183
+ tipText.push(`${i18n.t('libs.workflow.userFields')}:${tipRoles}`);
184
+ }
185
+ else {
186
+ return { result: true };
187
+ }
188
+ }
189
+ if (hasWorkspaceRoles) {
190
+ const hasAuth = authWorkspaceRoles.some(workspaceRole => workspaceRoleIds.includes(workspaceRole.value || workspaceRole.key));
191
+ if (!hasAuth) {
192
+ const tipWorkspaceRoles = authWorkspaceRoles
193
+ .map(workspaceRole => workspaceRole.label || workspaceRole.children)
194
+ .join('、');
195
+ tipText.push(`${i18n.t('libs.workflow.workspaceRoles')}:${tipWorkspaceRoles}`);
196
+ }
197
+ else {
198
+ return { result: true };
199
+ }
200
+ }
201
+ if (tipText.length) {
202
+ return { result: false, message: i18n.t('libs.default.tipText', { text: tipText.join('; ') }) };
203
+ }
204
+ return { result: true };
205
+ }
206
+ export function checkItemCondition(transition, item) {
207
+ var _a, _b;
208
+ const conditions = ((_a = transition.parameters) === null || _a === void 0 ? void 0 : _a.fieldType) || [];
209
+ for (const i in conditions) {
210
+ const { comparedValue, numberCompare, stringCompare, dropDownCompare, field, pickerType } = conditions[i];
211
+ let fieldValue;
212
+ if (field.key === ItemFieldType.name) {
213
+ fieldValue = item.name;
214
+ }
215
+ else if (field.key === ItemFieldType.reporter) {
216
+ const reporter = item[field.key];
217
+ fieldValue = { label: reporter.username, value: reporter.objectId };
218
+ }
219
+ else if ([ItemFieldType.itemType, ItemFieldType.workspace, ItemFieldType.status].includes(field.key)) {
220
+ fieldValue = item[field.key].objectId;
221
+ }
222
+ else {
223
+ fieldValue = (_b = item.values) === null || _b === void 0 ? void 0 : _b[field.key];
224
+ }
225
+ let sourceValue = null, targetValue = null;
226
+ switch (field.componentType) {
227
+ case CustomFieldComponentTypes.Number:
228
+ case CustomFieldComponentTypes.Date:
229
+ targetValue = comparedValue;
230
+ if (field.componentType === CustomFieldComponentTypes.Date && NumberConditions.equalTo.key === numberCompare) {
231
+ targetValue = getFormat(targetValue || null, getDateType(pickerType));
232
+ fieldValue = getFormat(fieldValue || null, getDateType(pickerType));
233
+ if (targetValue !== fieldValue) {
234
+ return {
235
+ result: false,
236
+ message: i18n.t('libs.default.flowTextTip.0', {
237
+ field: field.children,
238
+ condition: i18n.t(`pages.workflow.condition.${NumberConditions[numberCompare].key}`),
239
+ target: targetValue,
240
+ }),
241
+ };
242
+ }
243
+ }
244
+ else if (!numberToCompare(fieldValue, Number(targetValue), numberCompare)) {
245
+ if (isEmptyCondition(numberCompare)) {
246
+ return {
247
+ result: false,
248
+ message: i18n.t('libs.default.flowTextTip.1', {
249
+ field: field.children,
250
+ condition: i18n.t(`pages.workflow.condition.${NumberConditions[numberCompare].key}`),
251
+ }),
252
+ };
253
+ }
254
+ let showValue = comparedValue;
255
+ if (field.componentType === CustomFieldComponentTypes.Date) {
256
+ showValue = getFormat(comparedValue, getDateType('dateTime'));
257
+ }
258
+ return {
259
+ result: false,
260
+ message: i18n.t('libs.default.flowTextTip.0', {
261
+ field: field.children,
262
+ condition: i18n.t(`pages.workflow.condition.${NumberConditions[numberCompare].key}`),
263
+ target: showValue,
264
+ }),
265
+ };
266
+ }
267
+ break;
268
+ case CustomFieldComponentTypes.Text:
269
+ case CustomFieldComponentTypes.LongText:
270
+ targetValue = comparedValue;
271
+ if (!stringToCompare(fieldValue, targetValue, stringCompare)) {
272
+ let message = '';
273
+ if (isEmptyCondition(stringCompare)) {
274
+ message = i18n.t('libs.default.flowTextTip.1', {
275
+ field: field.children,
276
+ condition: i18n.t(`pages.workflow.condition.${StringConditions[stringCompare].key}`),
277
+ });
278
+ }
279
+ else {
280
+ message = i18n.t('libs.default.flowTextTip.0', {
281
+ field: field.children,
282
+ condition: i18n.t(`pages.workflow.condition.${StringConditions[stringCompare].key}`),
283
+ target: targetValue,
284
+ });
285
+ }
286
+ return {
287
+ result: false,
288
+ message,
289
+ };
290
+ }
291
+ break;
292
+ case CustomFieldComponentTypes.User:
293
+ case CustomFieldComponentTypes.Dropdown:
294
+ case CustomFieldComponentTypes.File:
295
+ case CustomFieldComponentTypes.Assignee:
296
+ case CustomFieldComponentTypes.Reporter:
297
+ case CustomFieldComponentTypes.Radio:
298
+ case CustomFieldComponentTypes.Checkbox:
299
+ sourceValue = fieldValue || [];
300
+ if (!(sourceValue instanceof Array)) {
301
+ sourceValue = [sourceValue];
302
+ }
303
+ if (SUPPORT_USER_KEYS.includes(field.componentType)) {
304
+ sourceValue = sourceValue.map(item => item.value);
305
+ }
306
+ targetValue = comparedValue ? comparedValue.map(item => item.value) : [];
307
+ if (!listToCompare(sourceValue, targetValue, dropDownCompare)) {
308
+ if (isEmptyCondition(dropDownCompare)) {
309
+ return {
310
+ result: false,
311
+ message: i18n.t('libs.default.flowTextTip.1', {
312
+ field: field.children,
313
+ condition: i18n.t(`pages.workflow.condition.${DropdownConditions[dropDownCompare].key}`),
314
+ }),
315
+ };
316
+ }
317
+ const targetText = comparedValue
318
+ ? comparedValue.map(c => (c === null || c === void 0 ? void 0 : c.label) || c.children).join(',')
319
+ : '';
320
+ return {
321
+ result: false,
322
+ message: i18n.t('libs.default.flowTextTip.0', {
323
+ field: field.children,
324
+ condition: i18n.t(`pages.workflow.condition.${DropdownConditions[dropDownCompare].key}`),
325
+ target: targetText,
326
+ }),
327
+ };
328
+ }
329
+ break;
330
+ default:
331
+ break;
332
+ }
333
+ }
334
+ return { result: true };
335
+ }
336
+ export function checkTransition(item, transition, permissions) {
337
+ if (!item || !transition)
338
+ return { result: false };
339
+ const roleCheck = checkUserPermission({
340
+ transition,
341
+ item,
342
+ ...permissions,
343
+ });
344
+ if (!roleCheck.result)
345
+ return roleCheck;
346
+ const conditionCheck = checkItemCondition(transition, item);
347
+ if (!conditionCheck.result)
348
+ return conditionCheck;
349
+ return { result: true };
350
+ }
351
+ export const useWorkflowPermission = (workspaceId) => {
352
+ const [roles, setRoles] = useState([]);
353
+ const [groups, setGroups] = useState([]);
354
+ const [workspaceRoles, setWorkspaceRoles] = useState([]);
355
+ const { fetchRole } = useWorkflowConfig();
356
+ useEffect(() => {
357
+ const _fetchRole = async () => {
358
+ try {
359
+ const { groups, roles, workspaceRoles } = await fetchRole(workspaceId);
360
+ setGroups(groups);
361
+ setWorkspaceRoles(workspaceRoles);
362
+ setRoles(roles);
363
+ }
364
+ catch (error) {
365
+ console.error(error.message);
366
+ }
367
+ };
368
+ workspaceId && _fetchRole();
369
+ }, [workspaceId, fetchRole]);
370
+ return [groups, roles, workspaceRoles];
371
+ };
@@ -0,0 +1,117 @@
1
+ export declare const en: {
2
+ 'pages.users.default.delete': string;
3
+ 'pages.users.default.forbidden': string;
4
+ 'views.common.emptyField.user': string;
5
+ 'views.common.emptyField.null': string;
6
+ 'data.format.week': string;
7
+ 'pages.fields.default.toWorkspacePage': string;
8
+ 'pages.fields.view.noWorkflowOrAuth': string;
9
+ 'pages.fields.view.viewWorkflow': string;
10
+ 'pages.fields.view.unrestrictedStatus': string;
11
+ 'pages.fields.view.approvalStatus': string;
12
+ 'pages.fields.view.checkInStatus': string;
13
+ 'pages.fields.view.readonlyStatus': string;
14
+ 'pages.workflow.default.userType.creatorAuth': string;
15
+ 'pages.workflow.condition.isEmpty': string;
16
+ 'pages.workflow.condition.notEmpty': string;
17
+ 'pages.workflow.condition.equal': string;
18
+ 'pages.workflow.condition.equalTo': string;
19
+ 'pages.workflow.condition.greaterThan': string;
20
+ 'pages.workflow.condition.greaterThanOrEqualTo': string;
21
+ 'pages.workflow.condition.lessThan': string;
22
+ 'pages.workflow.condition.lessThanOrEqualTo': string;
23
+ 'pages.workflow.condition.notEqualTo': string;
24
+ 'pages.workflow.condition.containedIn': string;
25
+ 'pages.workflow.condition.notContainedIn': string;
26
+ 'global.stateless': string;
27
+ 'global.haveDelete': string;
28
+ 'global.columns.forbiddenActive': string;
29
+ 'message.fields.stateFlowSuccess': string;
30
+ 'message.fields.stateFlowFailure': string;
31
+ 'libs.workflow.user': string;
32
+ 'libs.workflow.role': string;
33
+ 'libs.workflow.group': string;
34
+ 'libs.workflow.userFields': string;
35
+ 'libs.workflow.workspaceRoles': string;
36
+ 'libs.default.tipText': string;
37
+ 'libs.default.flowTextTip.0': string;
38
+ 'libs.default.flowTextTip.1': string;
39
+ };
40
+ export declare const zh: {
41
+ 'pages.users.default.delete': string;
42
+ 'pages.users.default.forbidden': string;
43
+ 'views.common.emptyField.user': string;
44
+ 'views.common.emptyField.null': string;
45
+ 'data.format.week': string;
46
+ 'pages.fields.default.toWorkspacePage': string;
47
+ 'pages.fields.view.noWorkflowOrAuth': string;
48
+ 'pages.fields.view.viewWorkflow': string;
49
+ 'pages.fields.view.unrestrictedStatus': string;
50
+ 'pages.fields.view.approvalStatus': string;
51
+ 'pages.fields.view.checkInStatus': string;
52
+ 'pages.fields.view.readonlyStatus': string;
53
+ 'pages.workflow.default.userType.creatorAuth': string;
54
+ 'pages.workflow.condition.isEmpty': string;
55
+ 'pages.workflow.condition.notEmpty': string;
56
+ 'pages.workflow.condition.equal': string;
57
+ 'pages.workflow.condition.equalTo': string;
58
+ 'pages.workflow.condition.greaterThan': string;
59
+ 'pages.workflow.condition.greaterThanOrEqualTo': string;
60
+ 'pages.workflow.condition.lessThan': string;
61
+ 'pages.workflow.condition.lessThanOrEqualTo': string;
62
+ 'pages.workflow.condition.notEqualTo': string;
63
+ 'pages.workflow.condition.containedIn': string;
64
+ 'pages.workflow.condition.notContainedIn': string;
65
+ 'global.stateless': string;
66
+ 'global.haveDelete': string;
67
+ 'global.columns.forbiddenActive': string;
68
+ 'message.fields.stateFlowSuccess': string;
69
+ 'message.fields.stateFlowFailure': string;
70
+ 'libs.workflow.user': string;
71
+ 'libs.workflow.role': string;
72
+ 'libs.workflow.group': string;
73
+ 'libs.workflow.userFields': string;
74
+ 'libs.workflow.workspaceRoles': string;
75
+ 'libs.default.tipText': string;
76
+ 'libs.default.flowTextTip.0': string;
77
+ 'libs.default.flowTextTip.1': string;
78
+ };
79
+ export declare const ru: {
80
+ 'pages.users.default.delete': string;
81
+ 'pages.users.default.forbidden': string;
82
+ 'views.common.emptyField.user': string;
83
+ 'views.common.emptyField.null': string;
84
+ 'data.format.week': string;
85
+ 'pages.fields.default.toWorkspacePage': string;
86
+ 'pages.fields.view.noWorkflowOrAuth': string;
87
+ 'pages.fields.view.viewWorkflow': string;
88
+ 'pages.fields.view.unrestrictedStatus': string;
89
+ 'pages.fields.view.approvalStatus': string;
90
+ 'pages.fields.view.checkInStatus': string;
91
+ 'pages.fields.view.readonlyStatus': string;
92
+ 'pages.workflow.default.userType.creatorAuth': string;
93
+ 'pages.workflow.condition.isEmpty': string;
94
+ 'pages.workflow.condition.notEmpty': string;
95
+ 'pages.workflow.condition.equal': string;
96
+ 'pages.workflow.condition.equalTo': string;
97
+ 'pages.workflow.condition.greaterThan': string;
98
+ 'pages.workflow.condition.greaterThanOrEqualTo': string;
99
+ 'pages.workflow.condition.lessThan': string;
100
+ 'pages.workflow.condition.lessThanOrEqualTo': string;
101
+ 'pages.workflow.condition.notEqualTo': string;
102
+ 'pages.workflow.condition.containedIn': string;
103
+ 'pages.workflow.condition.notContainedIn': string;
104
+ 'global.stateless': string;
105
+ 'global.haveDelete': string;
106
+ 'global.columns.forbiddenActive': string;
107
+ 'message.fields.stateFlowSuccess': string;
108
+ 'message.fields.stateFlowFailure': string;
109
+ 'libs.workflow.user': string;
110
+ 'libs.workflow.role': string;
111
+ 'libs.workflow.group': string;
112
+ 'libs.workflow.userFields': string;
113
+ 'libs.workflow.workspaceRoles': string;
114
+ 'libs.default.tipText': string;
115
+ 'libs.default.flowTextTip.0': string;
116
+ 'libs.default.flowTextTip.1': string;
117
+ };