@cloudbase/weda-ui 3.4.5 → 3.4.7

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 (129) hide show
  1. package/dist/configs/components/form/input.json +48 -2
  2. package/dist/configs/components/form/richText.json +2 -1
  3. package/dist/configs/components/form/uploader.json +62 -14
  4. package/dist/configs/components/grid/col.js +4 -1
  5. package/dist/configs/components/grid/grid.js +8 -3
  6. package/dist/configs/components/grid/row.js +51 -3
  7. package/dist/configs/components/repeater.js +4 -1
  8. package/dist/configs/components/table.json +1 -0
  9. package/dist/configs/components/wd-bubble.js +6 -0
  10. package/dist/configs/components/wd-button.js +6 -0
  11. package/dist/configs/components/wd-divider.js +7 -18
  12. package/dist/configs/components/wd-icon.js +7 -0
  13. package/dist/configs/components/wd-image.js +7 -0
  14. package/dist/configs/components/wd-link.js +7 -2
  15. package/dist/configs/components/wd-text.js +14 -6
  16. package/dist/configs/index.js +0 -2
  17. package/dist/docs/common/componentList.js +1 -1
  18. package/dist/web/actions/showModal/index.js +1 -1
  19. package/dist/web/components/calendar/index.js +2 -2
  20. package/dist/web/components/flow/components/index.js +0 -4
  21. package/dist/web/components/flow/frame/index.js +4 -3
  22. package/dist/web/components/flow/frame/types.js +11 -5
  23. package/dist/web/components/flow/frame/utils.js +60 -1
  24. package/dist/web/components/flow/modules/chart/Chart.js +2 -3
  25. package/dist/web/components/flow/modules/combination/index.js +1 -1
  26. package/dist/web/components/flow/modules/operations/components/button/index.js +11 -0
  27. package/dist/web/components/flow/modules/operations/components/button/style.css +5 -0
  28. package/dist/web/components/flow/modules/operations/components/index.js +6 -0
  29. package/dist/web/components/flow/modules/operations/components/popup/index.js +100 -0
  30. package/dist/web/components/flow/modules/operations/components/popup/style.css +154 -0
  31. package/dist/web/components/flow/modules/operations/components/popup/types.js +1 -0
  32. package/dist/web/components/flow/modules/operations/components/user-select/index.js +43 -0
  33. package/dist/web/components/flow/modules/operations/components/user-select/style.css +4 -0
  34. package/dist/web/components/flow/modules/operations/components/user-select/types.js +1 -0
  35. package/dist/web/components/flow/modules/operations/config/approval-form-config.js +140 -0
  36. package/dist/web/components/flow/modules/operations/config/control-config.js +218 -0
  37. package/dist/web/components/flow/modules/operations/config/index.js +2 -0
  38. package/dist/web/components/flow/modules/operations/config/types.js +1 -0
  39. package/dist/web/components/flow/modules/operations/control.js +26 -0
  40. package/dist/web/components/flow/modules/operations/controls-items/add-assignee-btn.js +33 -0
  41. package/dist/web/components/flow/modules/operations/controls-items/apply-cc-btn.js +12 -0
  42. package/dist/web/components/flow/modules/operations/controls-items/approval-drawer/comment/index.js +188 -0
  43. package/dist/web/components/flow/modules/operations/controls-items/approval-drawer/comment/style.css +51 -0
  44. package/dist/web/components/flow/modules/operations/controls-items/approval-drawer/drawer-form/index.js +64 -0
  45. package/dist/web/components/flow/modules/operations/controls-items/approval-drawer/drawer-form/types.js +1 -0
  46. package/dist/web/components/flow/modules/operations/controls-items/approval-drawer/drawer-form/view-model.js +83 -0
  47. package/dist/web/components/flow/modules/operations/controls-items/approval-drawer/field/index.js +16 -0
  48. package/dist/web/components/flow/modules/operations/controls-items/approval-drawer/field/style.css +56 -0
  49. package/dist/web/components/flow/modules/operations/controls-items/approval-drawer/index.js +47 -0
  50. package/dist/web/components/flow/modules/operations/controls-items/approval-drawer/style.css +60 -0
  51. package/dist/web/components/flow/modules/operations/controls-items/cancel-apply-btn.js +15 -0
  52. package/dist/web/components/flow/modules/operations/controls-items/check-list-popup/index.js +11 -0
  53. package/dist/web/components/flow/modules/operations/controls-items/check-list-popup/style.css +26 -0
  54. package/dist/web/components/flow/modules/operations/controls-items/flow-task-info-modal.js +98 -0
  55. package/dist/web/components/flow/modules/operations/controls-items/index.js +18 -0
  56. package/dist/web/components/flow/modules/operations/controls-items/initiation-btn.js +25 -0
  57. package/dist/web/components/flow/modules/operations/controls-items/revoke-modal/index.js +50 -0
  58. package/dist/web/components/flow/modules/operations/controls-items/revoke-modal/style.css +28 -0
  59. package/dist/web/components/flow/modules/operations/controls-items/roll-back-modal.js +104 -0
  60. package/dist/web/components/flow/modules/operations/controls-items/types.js +1 -0
  61. package/dist/web/components/flow/modules/operations/index.js +2 -0
  62. package/dist/web/components/flow/modules/operations/style.css +20 -0
  63. package/dist/web/components/flow/modules/operations/view-model.js +137 -0
  64. package/dist/web/components/flow/services/ideData/instance.js +2 -2
  65. package/dist/web/components/flow/services/ideData/pageDetail.js +1 -0
  66. package/dist/web/components/form/uploader/index.css +19 -0
  67. package/dist/web/components/form/uploader/index.js +21 -3
  68. package/dist/web/components/form/uploader/uploader.h5.js +14 -8
  69. package/dist/web/components/form/uploader/uploader.pc.js +29 -16
  70. package/dist/web/components/form/uploaderFile/index.css +5 -2
  71. package/dist/web/components/form/uploaderFile/uploadFile.h5.js +15 -12
  72. package/dist/web/components/form/uploaderFile/uploadFile.pc.js +11 -8
  73. package/dist/web/components/form/userOrgSelect/common/fetch-data-service.js +0 -1
  74. package/dist/web/components/form/userOrgSelect/component/depart-select/index.js +1 -1
  75. package/dist/web/components/form/userOrgSelect/component/user-select-h5/index.js +9 -5
  76. package/dist/web/components/form/userOrgSelect/component/user-select-h5/user-select-h5.js +4 -2
  77. package/dist/web/components/form/userOrgSelect/component/user-select-pc/user-model.js +2 -2
  78. package/dist/web/components/form/userOrgSelect/component/user-select-pc/user-select-pc.js +4 -2
  79. package/dist/web/components/grid/col.js +81 -18
  80. package/dist/web/components/grid/grid.js +1 -1
  81. package/dist/web/components/grid/row.js +4 -2
  82. package/dist/web/components/index.js +1 -1
  83. package/dist/web/components/listView/index.js +4 -3
  84. package/dist/web/components/lottery/index.js +122 -123
  85. package/dist/web/components/table/ExportFileModalByApi/index.js +1 -1
  86. package/dist/web/components/table/ImportFileModal/index.js +1 -1
  87. package/dist/web/components/table/ImportFileModalByApi/index.js +1 -1
  88. package/dist/web/components/wd-bubble/wd-bubble.js +11 -3
  89. package/dist/web/components/wd-button/wd-button.js +22 -13
  90. package/dist/web/components/wd-divider/wd-divider.js +10 -7
  91. package/dist/web/components/wd-icon/wd-icon.js +12 -3
  92. package/dist/web/components/wd-image/index.js +12 -5
  93. package/dist/web/components/wd-link/wd-link.js +11 -3
  94. package/dist/web/components/wd-text/wd-text.js +15 -3
  95. package/dist/web/utils/hooks/use-cloud-id-temp-url.js +7 -3
  96. package/dist/web/utils/platform.js +0 -1
  97. package/dist/web/utils/tool.js +11 -0
  98. package/dist/web/utils/widget-api/index.js +3 -0
  99. package/package.json +5 -3
  100. package/dist/configs/components/auth.json +0 -17
  101. package/dist/web/components/flow/components/FlowUserSelect/index.css +0 -116
  102. package/dist/web/components/flow/components/FlowUserSelect/index.js +0 -115
  103. package/dist/web/components/flow/components/HighlightTextarea/index.css +0 -42
  104. package/dist/web/components/flow/components/HighlightTextarea/index.js +0 -131
  105. package/dist/web/components/flow/components/UserSelectModel/UserSelect.js +0 -72
  106. package/dist/web/components/flow/components/UserSelectModel/UserSelectMobile.css +0 -8
  107. package/dist/web/components/flow/components/UserSelectModel/UserSelectMobile.js +0 -82
  108. package/dist/web/components/flow/components/UserSelectModel/index.js +0 -18
  109. package/dist/web/components/flow/components/WedaUserTransfer/index.css +0 -3
  110. package/dist/web/components/flow/components/WedaUserTransfer/index.js +0 -162
  111. package/dist/web/components/flow/modules/control/ApprovalDrawer.css +0 -144
  112. package/dist/web/components/flow/modules/control/ApprovalDrawer.js +0 -178
  113. package/dist/web/components/flow/modules/control/ApprovalPopup.css +0 -115
  114. package/dist/web/components/flow/modules/control/ApprovalPopup.js +0 -240
  115. package/dist/web/components/flow/modules/control/Control.css +0 -29
  116. package/dist/web/components/flow/modules/control/Control.js +0 -105
  117. package/dist/web/components/flow/modules/control/ControlMobile.css +0 -101
  118. package/dist/web/components/flow/modules/control/ControlMobile.js +0 -148
  119. package/dist/web/components/flow/modules/control/FlowTaskInfoModal.css +0 -3
  120. package/dist/web/components/flow/modules/control/FlowTaskInfoModal.js +0 -31
  121. package/dist/web/components/flow/modules/control/constants/index.js +0 -35
  122. package/dist/web/components/flow/modules/control/index.js +0 -15
  123. package/dist/web/components/flow/modules/control/provider/index.js +0 -17
  124. package/dist/web/components/flow/modules/control/provider/useControlModel.js +0 -252
  125. package/dist/web/components/flow/modules/control/provider/useMobileModel.js +0 -84
  126. package/dist/web/components/flow/modules/control/provider/useRevokeAndBackHook.js +0 -84
  127. package/dist/web/components/flow/modules/control/utils/ControlModelUtils.js +0 -57
  128. package/dist/web/components/flow/modules/control/utils/index.js +0 -3
  129. package/dist/web/components/flow/modules/control/utils/tools.js +0 -3
@@ -0,0 +1,140 @@
1
+ /** 审批类型操作的表单配置(同意、拒绝、处理、转办) */
2
+ export function getApprovalFormConfig(flowProps) {
3
+ var _a, _b;
4
+ const { flowDetail, pageInfo } = (flowProps === null || flowProps === void 0 ? void 0 : flowProps.commonFlowData) || {};
5
+ const { isH5 } = (flowProps === null || flowProps === void 0 ? void 0 : flowProps.flowLocalProps) || {};
6
+ const actionTypeName = (flowDetail === null || flowDetail === void 0 ? void 0 : flowDetail.userTaskType) === 2 ? '处理' : '审批';
7
+ /** 当前节点名称 只读表单项配置 */
8
+ const currentNodeNameConfig = {
9
+ label: '当前节点',
10
+ content: flowDetail === null || flowDetail === void 0 ? void 0 : flowDetail.currentNodeName,
11
+ readonly: true,
12
+ field: 'currentNodeName',
13
+ };
14
+ /** 当前审批/处理人 只读表单项配置 */
15
+ const currentApproverNameConfig = {
16
+ label: `${actionTypeName}人`,
17
+ content: (flowDetail === null || flowDetail === void 0 ? void 0 : flowDetail.currentApproverName) || '-',
18
+ readonly: true,
19
+ field: 'currentApproverName',
20
+ };
21
+ /** 审批/处理意见 表单项配置 */
22
+ const commentConfig = {
23
+ label: `${actionTypeName}意见`,
24
+ field: 'comment',
25
+ help: '输入@唤起成员选择框',
26
+ component: 'FlowComment',
27
+ defaultValue: {
28
+ operationComment: '',
29
+ opinionUserMap: {},
30
+ highlightPositionList: '{}',
31
+ },
32
+ props: {
33
+ isH5,
34
+ bordered: !isH5,
35
+ atButtonStyle: {
36
+ position: 'absolute',
37
+ top: 12,
38
+ right: 24,
39
+ },
40
+ },
41
+ extra: {
42
+ isH5Vertical: true,
43
+ },
44
+ validate: (comment) => {
45
+ var _a;
46
+ if (((_a = comment === null || comment === void 0 ? void 0 : comment.operationComment) === null || _a === void 0 ? void 0 : _a.length) > 500)
47
+ return '输入长度不可超过500,请检查';
48
+ return '';
49
+ },
50
+ };
51
+ /** 抄送/转办 表单项配置 */
52
+ const userSelectConfig = {
53
+ label: '抄送',
54
+ field: 'ccUserIds',
55
+ hidden: !(pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.showCarbonCopy),
56
+ component: 'FlowUserSelect',
57
+ props: {
58
+ label: '抄送',
59
+ showOriginEntry: true,
60
+ multiple: true,
61
+ className: 'weda-flow-approval-user-select',
62
+ isH5,
63
+ },
64
+ defaultValue: '',
65
+ transform({ userIds }) {
66
+ return (userIds || []).join();
67
+ },
68
+ };
69
+ /** 表单配置 */
70
+ return {
71
+ agree: {
72
+ formTitle: `审批意见 - ${((_a = pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.buttons) === null || _a === void 0 ? void 0 : _a[1]) || '同意'}`,
73
+ formItems: [
74
+ currentNodeNameConfig,
75
+ currentApproverNameConfig,
76
+ commentConfig,
77
+ userSelectConfig,
78
+ ],
79
+ },
80
+ reject: {
81
+ formTitle: `审批意见 - ${((_b = pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.buttons) === null || _b === void 0 ? void 0 : _b[2]) || '拒绝'}`,
82
+ formItems: [
83
+ currentNodeNameConfig,
84
+ currentApproverNameConfig,
85
+ {
86
+ ...commentConfig,
87
+ required: true,
88
+ validate: (comment) => {
89
+ var _a, _b;
90
+ if (!((_a = comment === null || comment === void 0 ? void 0 : comment.operationComment) === null || _a === void 0 ? void 0 : _a.trim()))
91
+ return '请输入审批意见';
92
+ if (((_b = comment === null || comment === void 0 ? void 0 : comment.operationComment) === null || _b === void 0 ? void 0 : _b.length) > 500)
93
+ return '输入长度不可超过500,请检查';
94
+ return '';
95
+ },
96
+ },
97
+ ],
98
+ },
99
+ handle: {
100
+ formTitle: `${(flowDetail === null || flowDetail === void 0 ? void 0 : flowDetail.operationName) || '处理'}意见`,
101
+ formItems: [
102
+ currentNodeNameConfig,
103
+ currentApproverNameConfig,
104
+ commentConfig,
105
+ userSelectConfig,
106
+ ],
107
+ },
108
+ turn_to_person: {
109
+ formTitle: '审批意见 - 转办',
110
+ formItems: [
111
+ currentNodeNameConfig,
112
+ currentApproverNameConfig,
113
+ {
114
+ ...userSelectConfig,
115
+ label: '转办',
116
+ field: 'turnToUserId',
117
+ props: {
118
+ ...userSelectConfig.props,
119
+ label: '转办',
120
+ multiple: false,
121
+ },
122
+ required: true,
123
+ transform({ userIds }) {
124
+ return userIds;
125
+ },
126
+ validate(turnToUserId) {
127
+ if (!turnToUserId)
128
+ return '请选择转办人员';
129
+ return '';
130
+ },
131
+ },
132
+ ],
133
+ submitDefaultValues: {
134
+ operationComment: '',
135
+ opinionUserMap: {},
136
+ highlightPositionList: '{}',
137
+ },
138
+ },
139
+ };
140
+ }
@@ -0,0 +1,218 @@
1
+ import { getApprovalFormConfig } from './approval-form-config';
2
+ /** 流程操作配置 */
3
+ export function getControlConfig(flowProps) {
4
+ var _a, _b, _c;
5
+ const { commonFlowData, flowLocalProps } = flowProps || {};
6
+ const { flowDetail, pageInfo } = commonFlowData || {};
7
+ const { currentPageType, isH5 } = flowLocalProps || {};
8
+ const approvalFormConfig = getApprovalFormConfig(flowProps);
9
+ const config = [
10
+ {
11
+ actionKey: FLOW_CONTROL_ACTION_KEY.ROLL_BACK,
12
+ component: 'RollbackModal',
13
+ props: {
14
+ label: '回退',
15
+ afterAction: 'afterGoBack',
16
+ buttonProps: { type: isH5 ? 'link' : 'weak' },
17
+ },
18
+ visible: currentPageType === 'TODO' &&
19
+ !(pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.showSubmitApp) &&
20
+ (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.showRollBack),
21
+ },
22
+ {
23
+ actionKey: FLOW_CONTROL_ACTION_KEY.ADD_ASSIGNEE,
24
+ component: 'AddAssigneeBtn',
25
+ props: {
26
+ label: '加签',
27
+ afterAction: 'afterAddAssignee',
28
+ buttonProps: { type: isH5 ? 'link' : 'weak' },
29
+ },
30
+ visible: currentPageType === 'TODO' &&
31
+ !(pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.showSubmitApp) &&
32
+ (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.showAddAssignee),
33
+ },
34
+ {
35
+ actionKey: FLOW_CONTROL_ACTION_KEY.TURN_TO_PERSON,
36
+ component: 'ApprovalDrawer',
37
+ props: {
38
+ label: '转办',
39
+ buttonAction: 4,
40
+ afterAction: 'afterTransfer',
41
+ approvalFormInfo: approvalFormConfig.turn_to_person,
42
+ buttonProps: { type: isH5 ? 'link' : 'weak' },
43
+ },
44
+ visible: currentPageType === 'TODO' &&
45
+ !(pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.showSubmitApp) &&
46
+ (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.showTurnToPerson),
47
+ },
48
+ {
49
+ actionKey: FLOW_CONTROL_ACTION_KEY.REJECT,
50
+ component: 'ApprovalDrawer',
51
+ props: {
52
+ label: ((_a = pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.buttons) === null || _a === void 0 ? void 0 : _a[2]) || '拒绝',
53
+ buttonAction: 3,
54
+ afterAction: 'afterReject',
55
+ approvalFormInfo: approvalFormConfig.reject,
56
+ buttonProps: {
57
+ type: isH5 ? 'link' : 'error',
58
+ style: isH5 ? { color: '#E34D59' } : {},
59
+ },
60
+ buttonIcon: isH5 ? 'close-circle' : '',
61
+ },
62
+ visible: currentPageType === 'TODO' &&
63
+ !(pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.showSubmitApp) &&
64
+ (flowDetail === null || flowDetail === void 0 ? void 0 : flowDetail.userTaskType) !== 2,
65
+ },
66
+ {
67
+ actionKey: FLOW_CONTROL_ACTION_KEY.AGREE,
68
+ component: 'ApprovalDrawer',
69
+ props: {
70
+ label: ((_b = pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.buttons) === null || _b === void 0 ? void 0 : _b[1]) || '同意',
71
+ buttonAction: 2,
72
+ afterAction: 'afterAgree',
73
+ approvalFormInfo: approvalFormConfig.agree,
74
+ buttonProps: {
75
+ type: isH5 ? 'link' : 'primary',
76
+ style: isH5 ? { color: '#00A870' } : {},
77
+ },
78
+ buttonIcon: isH5 ? 'check-circle' : '',
79
+ },
80
+ hideDivider: true,
81
+ visible: currentPageType === 'TODO' &&
82
+ !(pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.showSubmitApp) &&
83
+ (flowDetail === null || flowDetail === void 0 ? void 0 : flowDetail.userTaskType) !== 2,
84
+ },
85
+ {
86
+ actionKey: FLOW_CONTROL_ACTION_KEY.HANDLE,
87
+ component: 'ApprovalDrawer',
88
+ props: {
89
+ label: (flowDetail === null || flowDetail === void 0 ? void 0 : flowDetail.operationName) || '处理',
90
+ buttonAction: 2,
91
+ afterAction: 'afterHandle',
92
+ approvalFormInfo: approvalFormConfig.handle,
93
+ buttonProps: {
94
+ type: isH5 ? 'link' : 'primary',
95
+ style: isH5 ? { color: '#00A870' } : {},
96
+ },
97
+ buttonIcon: isH5 ? 'edit-1' : '',
98
+ },
99
+ hideDivider: true,
100
+ visible: currentPageType === 'TODO' &&
101
+ !(pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.showSubmitApp) &&
102
+ (flowDetail === null || flowDetail === void 0 ? void 0 : flowDetail.userTaskType) === 2,
103
+ },
104
+ {
105
+ actionKey: FLOW_CONTROL_ACTION_KEY.REVOKE,
106
+ component: 'RevokeModal',
107
+ props: {
108
+ label: '撤销',
109
+ afterAction: 'afterRevoke',
110
+ buttonProps: {
111
+ type: isH5 ? 'link' : 'error',
112
+ style: isH5 ? { color: '#E34D59' } : {},
113
+ },
114
+ buttonIcon: isH5 ? 'minus-circle' : '',
115
+ },
116
+ hideDivider: true,
117
+ visible: ['CREATE', 'DONE'].includes(currentPageType) && (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.showRevoke),
118
+ },
119
+ {
120
+ actionKey: FLOW_CONTROL_ACTION_KEY.CC,
121
+ component: 'ApplyCcBtn',
122
+ props: {
123
+ label: '抄送',
124
+ buttonProps: { type: isH5 ? 'link' : 'weak' },
125
+ },
126
+ visible: ['DRAFT', 'CREATEFLOW', 'TODO'].includes(currentPageType) &&
127
+ (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.show) &&
128
+ (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.showSubmitApp) &&
129
+ (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.showCarbonCopy),
130
+ },
131
+ {
132
+ actionKey: FLOW_CONTROL_ACTION_KEY.SAVE_DRAFT,
133
+ component: 'InitiationBtn',
134
+ props: {
135
+ label: '保存草稿',
136
+ buttonAction: 17,
137
+ afterAction: 'afterSavedDraft',
138
+ buttonProps: { type: isH5 ? 'link' : 'weak' },
139
+ },
140
+ visible: ['DRAFT', 'CREATEFLOW'].includes(currentPageType) &&
141
+ (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.show) &&
142
+ (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.showSubmitApp) &&
143
+ (flowDetail === null || flowDetail === void 0 ? void 0 : flowDetail.canDelete),
144
+ },
145
+ {
146
+ actionKey: FLOW_CONTROL_ACTION_KEY.CANCEL_SUBMIT,
147
+ component: 'CancelApplyBtn',
148
+ props: {
149
+ label: '取消',
150
+ buttonProps: {
151
+ type: isH5 ? 'link' : 'error',
152
+ style: isH5 ? { color: '#E34D59' } : {},
153
+ },
154
+ buttonIcon: isH5 ? 'close-circle' : '',
155
+ },
156
+ visible: ['DRAFT', 'CREATEFLOW'].includes(currentPageType) &&
157
+ (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.show) &&
158
+ (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.showSubmitApp) &&
159
+ (flowDetail === null || flowDetail === void 0 ? void 0 : flowDetail.canDelete),
160
+ },
161
+ {
162
+ actionKey: FLOW_CONTROL_ACTION_KEY.SUBMIT,
163
+ component: 'InitiationBtn',
164
+ props: {
165
+ label: ((_c = pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.buttons) === null || _c === void 0 ? void 0 : _c[3]) || '提交申请',
166
+ buttonAction: 1,
167
+ afterAction: 'afterSubmit',
168
+ buttonIcon: isH5 ? 'upload' : '',
169
+ buttonProps: {
170
+ type: isH5 ? 'link' : 'primary',
171
+ style: isH5 ? { color: '#00A870' } : {},
172
+ },
173
+ },
174
+ hideDivider: true,
175
+ visible: ['DRAFT', 'CREATEFLOW', 'TODO'].includes(currentPageType) &&
176
+ (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.show) &&
177
+ (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.showSubmitApp),
178
+ },
179
+ {
180
+ actionKey: FLOW_CONTROL_ACTION_KEY.NEXT_APPROVER,
181
+ component: 'FlowTaskInfoModal',
182
+ props: {
183
+ label: '选择下一节点处理人',
184
+ afterAction: 'afterSelectNextApprover',
185
+ },
186
+ visible: currentPageType === 'TODO',
187
+ hideDivider: true,
188
+ },
189
+ ];
190
+ config.forEach((config) => {
191
+ // 统一设置id和流程公共属性
192
+ config.props = {
193
+ ...config.props,
194
+ id: setConfigElementId(config.actionKey),
195
+ flowFrameCommonProps: flowProps,
196
+ };
197
+ });
198
+ return config;
199
+ }
200
+ /** 流程操作标识常量 */
201
+ export const FLOW_CONTROL_ACTION_KEY = {
202
+ AGREE: 'agree',
203
+ REJECT: 'reject',
204
+ HANDLE: 'handle',
205
+ TURN_TO_PERSON: 'turn_to_person',
206
+ ROLL_BACK: 'roll_back',
207
+ ADD_ASSIGNEE: 'add_assignee',
208
+ REVOKE: 'revoke',
209
+ SUBMIT: 'submit',
210
+ CC: 'cc',
211
+ SAVE_DRAFT: 'save_draft',
212
+ CANCEL_SUBMIT: 'cancel_submit',
213
+ NEXT_APPROVER: 'next_approver',
214
+ };
215
+ /** 设置流程控制配置按钮Id */
216
+ function setConfigElementId(configKey) {
217
+ return `weda_flow_${configKey}_btn`;
218
+ }
@@ -0,0 +1,2 @@
1
+ export * from './control-config';
2
+ export * from './types';
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import { Button } from 'tea-component';
3
+ import { WdDivider } from '../../../wd-divider';
4
+ import { createModuleFrame } from '../../frame';
5
+ import { getControlConfig } from './config';
6
+ import { useFlowControlModel } from './view-model';
7
+ import { CONTROL_COMPONENT } from './controls-items';
8
+ import './style.css';
9
+ /** 流程控制组件 */
10
+ const FlowControl = (props) => {
11
+ const controlModel = useFlowControlModel(props);
12
+ const configs = getControlConfig(props);
13
+ /** 已回退之后不显示任何操作按钮 */
14
+ if (controlModel.hasGoBack)
15
+ return null;
16
+ return (React.createElement("div", { className: `weda-flow-control ${props.flowLocalProps.isH5 ? 'weda-flow-h5-control' : ''}` }, configs.map((config) => {
17
+ const { component, props, visible, actionKey } = config;
18
+ const Component = CONTROL_COMPONENT[component] || Button;
19
+ if (!visible)
20
+ return null;
21
+ return (React.createElement(React.Fragment, null,
22
+ React.createElement(Component, { ...props, key: config.actionKey, actionKey: actionKey, flowControlModel: controlModel }),
23
+ !(config === null || config === void 0 ? void 0 : config.hideDivider) && (React.createElement(WdDivider, { type: "solid", className: "weda-flow-control-divider" }))));
24
+ })));
25
+ };
26
+ export const ModelFlowControl = createModuleFrame(FlowControl, 'flow-control');
@@ -0,0 +1,33 @@
1
+ import React from 'react';
2
+ import { message } from 'tea-component';
3
+ import { FlowUserSelectBtn } from '../components';
4
+ /**
5
+ * 提交申请抄送按钮
6
+ */
7
+ export function AddAssigneeBtn(props) {
8
+ const { flowControlModel, flowFrameCommonProps } = props;
9
+ const { flowRequest } = flowFrameCommonProps.flowLocalProps;
10
+ const { flowDetail } = flowFrameCommonProps.commonFlowData;
11
+ const onUserChange = (user) => {
12
+ addCounterSignAssignee(user.userIds);
13
+ };
14
+ /** 加签请求 */
15
+ const addCounterSignAssignee = async (assigneeIds) => {
16
+ const result = await flowRequest({
17
+ action: 'AddCounterSignAssignee',
18
+ data: {
19
+ instanceId: flowDetail.instanceId,
20
+ nodeId: flowDetail.currentNodeId,
21
+ taskId: flowDetail.taskId,
22
+ assigneeIds,
23
+ },
24
+ });
25
+ if (result === null || result === void 0 ? void 0 : result.status) {
26
+ message.success({
27
+ content: `${props.label}成功`,
28
+ });
29
+ flowControlModel.onAfterFinishFlowAction(props.actionKey, props.afterAction);
30
+ }
31
+ };
32
+ return (React.createElement(FlowUserSelectBtn, { buttonProps: { ...props.buttonProps, id: props.id }, buttonText: props.label, onChange: onUserChange, isH5: props.flowFrameCommonProps.flowLocalProps.isH5, multiple: true }));
33
+ }
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { FlowUserSelectBtn } from '../components';
3
+ /**
4
+ * 提交申请抄送按钮
5
+ */
6
+ export function ApplyCcBtn(props) {
7
+ var _a, _b;
8
+ const onUserChange = (user) => {
9
+ props.flowControlModel.setApplyCcUser(user.userIds);
10
+ };
11
+ return (React.createElement(FlowUserSelectBtn, { buttonProps: { ...props.buttonProps, id: props.id }, buttonText: `${props.label}(${(_b = (_a = props.flowControlModel.applyCcUser) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0})`, onChange: onUserChange, isH5: props.flowFrameCommonProps.flowLocalProps.isH5, multiple: true }));
12
+ }
@@ -0,0 +1,188 @@
1
+ import React, { useState, useRef } from 'react';
2
+ // eslint-disable-next-line import/no-named-as-default
3
+ import HighlightWithinTextarea from 'react-highlight-within-textarea';
4
+ import { Button } from 'tea-component';
5
+ import { FlowUserSelect } from '../../../components';
6
+ import './style.css';
7
+ export function FlowComment(props) {
8
+ const { placeholder = '请输入评论,可@通知他人', isH5 = false, bordered = true, } = props;
9
+ const [commentValue, setCommentValue] = useState('');
10
+ /** 高亮位置数组 */
11
+ const [highlightPositions, setHighlightPositions] = useState([]);
12
+ /** 用户弹窗是否显示 */
13
+ const [userModalVisible, setUserModalVisible] = useState(false);
14
+ /** 存储同事用户的对象 */
15
+ const opinionUserMapRef = useRef({});
16
+ /** 输入框实例对象 */
17
+ const textAreaRef = useRef();
18
+ /** 记录上一次的评论内容状态,用于统计 @ 符号 useKeyboardEventModel - countAtSignal*/
19
+ const prevCommentValue = useRef('');
20
+ const rangeModel = useRangeModel();
21
+ const keyboardModel = useKeyboardEventModel({
22
+ commentValue,
23
+ isH5,
24
+ atEvent: onPressAtSingle,
25
+ });
26
+ /** @ 按键事件 */
27
+ function onPressAtSingle() {
28
+ setUserModalVisible(true);
29
+ rangeModel.getRange(isH5);
30
+ }
31
+ /** 评论内容变更 */
32
+ const onCommentChange = (value) => {
33
+ rangeModel.getRange(!isH5);
34
+ // 防止因setHighlightPositions导致onChange重复执行
35
+ if (value === prevCommentValue.current && value !== '')
36
+ return;
37
+ prevCommentValue.current = value;
38
+ setCommentValue(value);
39
+ handleCommentValueChange(value);
40
+ };
41
+ /** 用户选择变更 */
42
+ const onUserChange = ({ users }) => {
43
+ let value = isH5 ? '@' : '';
44
+ users.forEach((user, index) => {
45
+ const name = `@${user.userName}`;
46
+ value = `${value + user.userName} `;
47
+ if (index < users.length - 1) {
48
+ value = `${value}@`;
49
+ }
50
+ if (!opinionUserMapRef.current[user.userId]) {
51
+ opinionUserMapRef.current[user.userId] = name;
52
+ }
53
+ });
54
+ const insertResult = rangeModel.insertValue(value);
55
+ const newValue = textAreaRef.current.editor.innerText;
56
+ setCommentValue(insertResult ? newValue : value);
57
+ handleCommentValueChange(insertResult ? newValue : value);
58
+ };
59
+ /** 处理评论内容变更 */
60
+ const handleCommentValueChange = (comment) => {
61
+ var _a, _b;
62
+ if (!comment) {
63
+ const values = {
64
+ operationComment: '',
65
+ opinionUserMap: {},
66
+ highlightPositionList: '{}',
67
+ };
68
+ opinionUserMapRef.current = {};
69
+ (_a = props === null || props === void 0 ? void 0 : props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, values);
70
+ setHighlightPositions([]);
71
+ return;
72
+ }
73
+ const { res: highlightPositions, obj: highlightPositionObj } = checkHighlight(comment, opinionUserMapRef.current);
74
+ const opinionUserMap = checkOpinionUserMap(opinionUserMapRef.current, comment);
75
+ const newValues = {
76
+ operationComment: comment,
77
+ opinionUserMap: opinionUserMap,
78
+ highlightPositionList: JSON.stringify(highlightPositionObj),
79
+ };
80
+ (_b = props === null || props === void 0 ? void 0 : props.onChange) === null || _b === void 0 ? void 0 : _b.call(props, newValues);
81
+ setHighlightPositions(highlightPositions);
82
+ };
83
+ return (React.createElement(React.Fragment, null,
84
+ React.createElement("div", { className: `weda-flow-comment ${bordered ? 'bordered' : ''}`, onKeyUp: keyboardModel.onKeyUp },
85
+ React.createElement(HighlightWithinTextarea, { value: commentValue, onChange: onCommentChange, highlight: highlightPositions, placeholder: placeholder, ref: textAreaRef, onFocus: () => rangeModel.getRange(!isH5), onBlur: () => rangeModel.getRange(!isH5) }),
86
+ React.createElement(FlowUserSelect, { visible: userModalVisible, multiple: true, onChange: onUserChange, onClose: () => setUserModalVisible(false), defaultValue: [], isH5: props.isH5 })),
87
+ isH5 ? (React.createElement(Button, { type: "link", onClick: onPressAtSingle, style: props.atButtonStyle }, "@\u67D0\u4EBA")) : null));
88
+ }
89
+ /** 处理评论框光标hook */
90
+ function useRangeModel() {
91
+ const range = useRef();
92
+ const getRange = (stop = false) => {
93
+ var _a;
94
+ if (stop)
95
+ return;
96
+ // 获取光标位置
97
+ const selection = window.getSelection();
98
+ if ((selection === null || selection === void 0 ? void 0 : selection.rangeCount) === 0)
99
+ return;
100
+ const currentRange = (selection === null || selection === void 0 ? void 0 : selection.rangeCount) !== 0 ? (_a = selection === null || selection === void 0 ? void 0 : selection.getRangeAt) === null || _a === void 0 ? void 0 : _a.call(selection, 0) : null;
101
+ range.current = currentRange;
102
+ };
103
+ const insertValue = (addValue) => {
104
+ var _a, _b;
105
+ if (range.current) {
106
+ (_b = (_a = range.current) === null || _a === void 0 ? void 0 : _a.insertNode) === null || _b === void 0 ? void 0 : _b.call(_a, document.createTextNode(addValue));
107
+ return true;
108
+ }
109
+ return false;
110
+ };
111
+ return {
112
+ getRange,
113
+ insertValue,
114
+ };
115
+ }
116
+ /** 处理评论框键盘事件hook */
117
+ function useKeyboardEventModel({ commentValue, isH5, atEvent, }) {
118
+ const prevCommentValueRef = useRef(commentValue);
119
+ /** 统计'@'符号个数 */
120
+ const countAtSignal = (currentValue) => {
121
+ let count1 = 0;
122
+ let count2 = 0;
123
+ for (const v of currentValue) {
124
+ if (v === '@') {
125
+ count1 += 1;
126
+ }
127
+ }
128
+ for (const v of prevCommentValueRef.current) {
129
+ if (v === '@') {
130
+ count2 += 1;
131
+ }
132
+ }
133
+ return count1 === count2;
134
+ };
135
+ /** 评论框KeyUp事件 */
136
+ const onKeyUp = (e) => {
137
+ if (!isH5 && e.shiftKey && (e.key === '@' || e.keyCode === 50)) {
138
+ atEvent === null || atEvent === void 0 ? void 0 : atEvent();
139
+ return;
140
+ }
141
+ // 判断当下value值是否存在2
142
+ if (!isH5 && e.keyCode === 50 && !countAtSignal(commentValue)) {
143
+ atEvent === null || atEvent === void 0 ? void 0 : atEvent();
144
+ }
145
+ prevCommentValueRef.current = commentValue;
146
+ };
147
+ return {
148
+ onKeyUp,
149
+ };
150
+ }
151
+ /** 检查高亮位置数据 */
152
+ function checkHighlight(text, opinionUserMap) {
153
+ const highlightList = Object.values(opinionUserMap);
154
+ const len = highlightList.length;
155
+ let v = text;
156
+ let res = [];
157
+ // 回显时使用,必须顺序排列
158
+ let obj = {};
159
+ for (let i = 0; i < len; i++) {
160
+ const indexof = v.indexOf(highlightList[i]);
161
+ const itemLen = highlightList[i].length;
162
+ if (indexof !== -1) {
163
+ const endIndex = indexof + itemLen;
164
+ res.push([indexof, endIndex]);
165
+ obj[indexof] = endIndex;
166
+ const fillText = new Array(itemLen).fill(' ').join(''); // 空格填充
167
+ v = v.substring(0, indexof) + fillText + v.substring(endIndex);
168
+ }
169
+ }
170
+ if (res.length > 0 && v.includes('@')) {
171
+ // 继续检查剩下文本,是否存在重复@
172
+ const { res: arr, obj: objCopy } = checkHighlight(v, opinionUserMap);
173
+ res = res.concat(arr);
174
+ obj = { ...obj, ...objCopy };
175
+ }
176
+ return { res, obj };
177
+ }
178
+ /** 检查通知用户Map */
179
+ function checkOpinionUserMap(currentOpinionUserMap, commentValue) {
180
+ const newOpinionUserMap = {};
181
+ // value每次change后需要再次检查opinionUserMap
182
+ for (const [id, name] of Object.entries(currentOpinionUserMap)) {
183
+ if (commentValue.indexOf(name) !== -1) {
184
+ newOpinionUserMap[id] = name;
185
+ }
186
+ }
187
+ return newOpinionUserMap;
188
+ }
@@ -0,0 +1,51 @@
1
+ .weda-flow-comment {
2
+ position: relative;
3
+ height: 100px;
4
+ text-align: left;
5
+ overflow: auto;
6
+ display: inline-block;
7
+ width: 100%;
8
+ border-radius: 3px;
9
+ }
10
+
11
+ .weda-flow-comment.bordered {
12
+ border: 1px solid #dcdee6;
13
+ }
14
+
15
+ .weda-flow-comment .DraftEditor-root {
16
+ position: absolute;
17
+ width: 100%;
18
+ z-index: 1;
19
+ height: 100%;
20
+ }
21
+ .weda-flow-comment .public-DraftEditorPlaceholder-root {
22
+ position: absolute;
23
+ z-index: 0;
24
+ margin: 5px;
25
+ color: #999999;
26
+ font-size: 12px;
27
+ left: 5px;
28
+ width: 90%;
29
+ pointer-events: none;
30
+ }
31
+
32
+ .weda-flow-comment .DraftEditor-root .DraftEditor-editorContainer {
33
+ padding: 5px;
34
+ height: 100%;
35
+ }
36
+ .weda-flow-comment
37
+ .DraftEditor-root
38
+ .DraftEditor-editorContainer
39
+ .public-DraftEditor-content {
40
+ height: 100%;
41
+ }
42
+ .weda-flow-comment .DraftEditor-root .DraftEditor-editorContainer mark {
43
+ color: #888888;
44
+ background: transparent;
45
+ }
46
+ .weda-flow-comment .highlight-textarea-placeholder {
47
+ position: absolute;
48
+ z-index: 0;
49
+ margin: 5px;
50
+ color: #999999;
51
+ }