@cloudbase/weda-ui 3.4.4 → 3.4.6

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 (147) hide show
  1. package/dist/configs/components/chart/bar.json +113 -8
  2. package/dist/configs/components/chart/line.js +113 -8
  3. package/dist/configs/components/chart/pie.json +113 -8
  4. package/dist/configs/components/chart/statisticsCard.json +57 -0
  5. package/dist/configs/components/dataView.js +7 -7
  6. package/dist/configs/components/form/input.json +48 -2
  7. package/dist/configs/components/form/richText.json +2 -1
  8. package/dist/configs/components/form/uploader.json +62 -14
  9. package/dist/configs/components/graphicCard.json +1 -1
  10. package/dist/configs/components/grid/col.js +4 -1
  11. package/dist/configs/components/grid/grid.js +8 -3
  12. package/dist/configs/components/grid/row.js +51 -3
  13. package/dist/configs/components/listView.js +113 -9
  14. package/dist/configs/components/navLayout.json +1 -1
  15. package/dist/configs/components/repeater.js +4 -1
  16. package/dist/configs/components/table.json +125 -9
  17. package/dist/configs/components/wd-bubble.js +6 -0
  18. package/dist/configs/components/wd-button.js +6 -0
  19. package/dist/configs/components/wd-divider.js +7 -18
  20. package/dist/configs/components/wd-icon.js +7 -0
  21. package/dist/configs/components/wd-image.js +7 -0
  22. package/dist/configs/components/wd-link.js +7 -2
  23. package/dist/configs/components/wd-text.js +14 -6
  24. package/dist/configs/index.js +0 -2
  25. package/dist/docs/common/componentList.js +1 -1
  26. package/dist/style/index.scss +1 -1
  27. package/dist/web/actions/showModal/index.js +1 -1
  28. package/dist/web/components/calendar/index.js +2 -2
  29. package/dist/web/components/chart/common/data-transform.js +1 -1
  30. package/dist/web/components/chart/statisticsCard/index.js +1 -1
  31. package/dist/web/components/flow/components/index.js +0 -4
  32. package/dist/web/components/flow/frame/index.js +4 -3
  33. package/dist/web/components/flow/frame/types.js +11 -5
  34. package/dist/web/components/flow/frame/utils.js +60 -1
  35. package/dist/web/components/flow/modules/chart/Chart.js +2 -3
  36. package/dist/web/components/flow/modules/chart/index.css +0 -3
  37. package/dist/web/components/flow/modules/combination/index.js +1 -1
  38. package/dist/web/components/flow/modules/operations/components/button/index.js +11 -0
  39. package/dist/web/components/flow/modules/operations/components/button/style.css +5 -0
  40. package/dist/web/components/flow/modules/operations/components/index.js +6 -0
  41. package/dist/web/components/flow/modules/operations/components/popup/index.js +100 -0
  42. package/dist/web/components/flow/modules/operations/components/popup/style.css +154 -0
  43. package/dist/web/components/flow/modules/operations/components/popup/types.js +1 -0
  44. package/dist/web/components/flow/modules/operations/components/user-select/index.js +43 -0
  45. package/dist/web/components/flow/modules/operations/components/user-select/style.css +4 -0
  46. package/dist/web/components/flow/modules/operations/components/user-select/types.js +1 -0
  47. package/dist/web/components/flow/modules/operations/config/approval-form-config.js +140 -0
  48. package/dist/web/components/flow/modules/operations/config/control-config.js +218 -0
  49. package/dist/web/components/flow/modules/operations/config/index.js +2 -0
  50. package/dist/web/components/flow/modules/operations/config/types.js +1 -0
  51. package/dist/web/components/flow/modules/operations/control.js +26 -0
  52. package/dist/web/components/flow/modules/operations/controls-items/add-assignee-btn.js +33 -0
  53. package/dist/web/components/flow/modules/operations/controls-items/apply-cc-btn.js +12 -0
  54. package/dist/web/components/flow/modules/operations/controls-items/approval-drawer/comment/index.js +188 -0
  55. package/dist/web/components/flow/modules/operations/controls-items/approval-drawer/comment/style.css +51 -0
  56. package/dist/web/components/flow/modules/operations/controls-items/approval-drawer/drawer-form/index.js +64 -0
  57. package/dist/web/components/flow/modules/operations/controls-items/approval-drawer/drawer-form/types.js +1 -0
  58. package/dist/web/components/flow/modules/operations/controls-items/approval-drawer/drawer-form/view-model.js +83 -0
  59. package/dist/web/components/flow/modules/operations/controls-items/approval-drawer/field/index.js +16 -0
  60. package/dist/web/components/flow/modules/operations/controls-items/approval-drawer/field/style.css +56 -0
  61. package/dist/web/components/flow/modules/operations/controls-items/approval-drawer/index.js +47 -0
  62. package/dist/web/components/flow/modules/operations/controls-items/approval-drawer/style.css +60 -0
  63. package/dist/web/components/flow/modules/operations/controls-items/cancel-apply-btn.js +15 -0
  64. package/dist/web/components/flow/modules/operations/controls-items/check-list-popup/index.js +11 -0
  65. package/dist/web/components/flow/modules/operations/controls-items/check-list-popup/style.css +26 -0
  66. package/dist/web/components/flow/modules/operations/controls-items/flow-task-info-modal.js +98 -0
  67. package/dist/web/components/flow/modules/operations/controls-items/index.js +18 -0
  68. package/dist/web/components/flow/modules/operations/controls-items/initiation-btn.js +25 -0
  69. package/dist/web/components/flow/modules/operations/controls-items/revoke-modal/index.js +50 -0
  70. package/dist/web/components/flow/modules/operations/controls-items/revoke-modal/style.css +28 -0
  71. package/dist/web/components/flow/modules/operations/controls-items/roll-back-modal.js +104 -0
  72. package/dist/web/components/flow/modules/operations/controls-items/types.js +1 -0
  73. package/dist/web/components/flow/modules/operations/index.js +2 -0
  74. package/dist/web/components/flow/modules/operations/style.css +20 -0
  75. package/dist/web/components/flow/modules/operations/view-model.js +137 -0
  76. package/dist/web/components/flow/services/ideData/instance.js +2 -2
  77. package/dist/web/components/flow/services/ideData/pageDetail.js +1 -0
  78. package/dist/web/components/form/select/dropdown-select/h5.js +1 -1
  79. package/dist/web/components/form/select/dropdown-select/index.css +7 -0
  80. package/dist/web/components/form/select/index.js +2 -7
  81. package/dist/web/components/form/textarea/index.js +1 -1
  82. package/dist/web/components/form/uploader/index.css +19 -0
  83. package/dist/web/components/form/uploader/index.js +21 -3
  84. package/dist/web/components/form/uploader/uploader.h5.js +14 -8
  85. package/dist/web/components/form/uploader/uploader.pc.js +29 -16
  86. package/dist/web/components/form/uploaderFile/index.css +9 -5
  87. package/dist/web/components/form/uploaderFile/uploadFile.h5.js +23 -21
  88. package/dist/web/components/form/uploaderFile/uploadFile.pc.js +14 -10
  89. package/dist/web/components/form/userOrgSelect/common/fetch-data-service.js +0 -1
  90. package/dist/web/components/form/userOrgSelect/component/depart-select/index.js +1 -1
  91. package/dist/web/components/form/userOrgSelect/component/user-select-h5/index.js +43 -22
  92. package/dist/web/components/form/userOrgSelect/component/user-select-h5/user-select-h5.js +15 -4
  93. package/dist/web/components/form/userOrgSelect/component/user-select-pc/user-model.js +2 -2
  94. package/dist/web/components/form/userOrgSelect/component/user-select-pc/user-select-pc.js +4 -2
  95. package/dist/web/components/grid/col.js +81 -18
  96. package/dist/web/components/grid/grid.js +1 -1
  97. package/dist/web/components/grid/row.js +4 -2
  98. package/dist/web/components/index.js +1 -1
  99. package/dist/web/components/listView/index.js +98 -100
  100. package/dist/web/components/lottery/index.js +122 -123
  101. package/dist/web/components/richTextView/index.css +2 -0
  102. package/dist/web/components/swiper/index.js +14 -8
  103. package/dist/web/components/table/BaseTable.js +3 -3
  104. package/dist/web/components/table/ExportFileModalByApi/index.js +1 -1
  105. package/dist/web/components/table/ImportFileModal/index.js +1 -1
  106. package/dist/web/components/table/ImportFileModalByApi/index.js +1 -1
  107. package/dist/web/components/wd-bubble/wd-bubble.js +11 -3
  108. package/dist/web/components/wd-button/wd-button.js +22 -13
  109. package/dist/web/components/wd-divider/wd-divider.js +10 -7
  110. package/dist/web/components/wd-icon/wd-icon.js +12 -3
  111. package/dist/web/components/wd-image/index.js +12 -5
  112. package/dist/web/components/wd-link/wd-link.js +11 -3
  113. package/dist/web/components/wd-text/wd-text.js +15 -3
  114. package/dist/web/utils/hooks/use-cloud-id-temp-url.js +7 -2
  115. package/dist/web/utils/platform.js +9 -2
  116. package/dist/web/utils/tool.js +11 -0
  117. package/dist/web/utils/widget-api/index.js +3 -0
  118. package/package.json +7 -5
  119. package/dist/configs/components/auth.json +0 -17
  120. package/dist/web/components/flow/components/FlowUserSelect/index.css +0 -116
  121. package/dist/web/components/flow/components/FlowUserSelect/index.js +0 -115
  122. package/dist/web/components/flow/components/HighlightTextarea/index.css +0 -42
  123. package/dist/web/components/flow/components/HighlightTextarea/index.js +0 -131
  124. package/dist/web/components/flow/components/UserSelectModel/UserSelect.js +0 -74
  125. package/dist/web/components/flow/components/UserSelectModel/UserSelectMobile.css +0 -8
  126. package/dist/web/components/flow/components/UserSelectModel/UserSelectMobile.js +0 -86
  127. package/dist/web/components/flow/components/UserSelectModel/index.js +0 -18
  128. package/dist/web/components/flow/components/WedaUserTransfer/index.css +0 -3
  129. package/dist/web/components/flow/components/WedaUserTransfer/index.js +0 -162
  130. package/dist/web/components/flow/modules/control/ApprovalDrawer.css +0 -144
  131. package/dist/web/components/flow/modules/control/ApprovalDrawer.js +0 -178
  132. package/dist/web/components/flow/modules/control/ApprovalPopup.css +0 -115
  133. package/dist/web/components/flow/modules/control/ApprovalPopup.js +0 -241
  134. package/dist/web/components/flow/modules/control/Control.css +0 -29
  135. package/dist/web/components/flow/modules/control/Control.js +0 -93
  136. package/dist/web/components/flow/modules/control/ControlMobile.css +0 -69
  137. package/dist/web/components/flow/modules/control/ControlMobile.js +0 -133
  138. package/dist/web/components/flow/modules/control/FlowTaskInfoModal.css +0 -3
  139. package/dist/web/components/flow/modules/control/FlowTaskInfoModal.js +0 -31
  140. package/dist/web/components/flow/modules/control/constants/index.js +0 -35
  141. package/dist/web/components/flow/modules/control/index.js +0 -15
  142. package/dist/web/components/flow/modules/control/provider/index.js +0 -17
  143. package/dist/web/components/flow/modules/control/provider/useControlModel.js +0 -256
  144. package/dist/web/components/flow/modules/control/provider/useMobileModel.js +0 -86
  145. package/dist/web/components/flow/modules/control/provider/useRevokeAndBackHook.js +0 -82
  146. package/dist/web/components/flow/modules/control/utils/ControlModelUtils.js +0 -57
  147. package/dist/web/components/flow/modules/control/utils/index.js +0 -2
@@ -0,0 +1,100 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { createPortal } from 'react-dom';
3
+ import { CSSTransition } from 'react-transition-group';
4
+ import { IconFont } from 'tdesign-icons-react';
5
+ import classNames from '../../../../../../utils/classnames';
6
+ import { POSITIONS } from './types';
7
+ import './style.css';
8
+ /** 使用移动视图的弹出层组件 */
9
+ export function FlowPopup(props) {
10
+ const { visible = false, className = '', style = {}, overlay = true, position = 'center', overlayClass = '', overlayStyle = {}, title = '', titleStyle = {}, closeable = false, container = document.body, height = 300, width = 200, children, onClose, destroyOnClose = false, closeOnClickOverlay = true, closeContent, closeContentPosition = 'top-right', } = props;
11
+ const [innerVisible, setInnerVisible] = useState(visible);
12
+ const [animatedVisible, setAnimatedVisible] = useState(innerVisible);
13
+ useEffect(() => {
14
+ if (visible) {
15
+ setAnimatedVisible(true);
16
+ }
17
+ }, [visible]);
18
+ useEffect(() => {
19
+ setInnerVisible(visible);
20
+ }, [visible]);
21
+ const onPopupClose = (e) => {
22
+ onStopPropagation(e);
23
+ onClose === null || onClose === void 0 ? void 0 : onClose();
24
+ };
25
+ /** 阻止 createPortal 的事件冒泡 */
26
+ const onStopPropagation = (e) => {
27
+ e.stopPropagation();
28
+ };
29
+ const initialStyle = getInitialStyle(position, height, width);
30
+ const initialClassName = getInitialClassName(position);
31
+ /** 标题 */
32
+ const renderTitle = () => {
33
+ if (!title)
34
+ return null;
35
+ return (React.createElement("div", { className: "weda-flow-popup-title", style: titleStyle }, title));
36
+ };
37
+ /** 关闭按钮 */
38
+ const renderCloseButton = () => {
39
+ if (!closeable)
40
+ return null;
41
+ return (React.createElement("div", { className: `weda-flow-popup-close ${closeContentPosition}`, onClick: onPopupClose }, closeContent || React.createElement(IconFont, { name: "close" })));
42
+ };
43
+ /** 遮罩层 */
44
+ const renderOverlay = () => {
45
+ const onClickOverlay = (e) => {
46
+ if (!closeOnClickOverlay)
47
+ return;
48
+ onPopupClose(e);
49
+ };
50
+ if (!overlay)
51
+ return null;
52
+ return (React.createElement("div", { className: `weda-flow-popup-overlay ${overlayClass}`, style: overlayStyle || {}, onClick: onClickOverlay }));
53
+ };
54
+ /** 弹出层 */
55
+ const renderPopup = () => {
56
+ const popupClassName = classNames('weda-flow-popup', initialClassName, className);
57
+ const popupStyle = {
58
+ ...initialStyle,
59
+ ...style,
60
+ display: !innerVisible && !animatedVisible ? 'none' : undefined,
61
+ };
62
+ return (React.createElement("div", { className: popupClassName, style: popupStyle, onClick: onStopPropagation },
63
+ renderTitle(),
64
+ renderCloseButton(),
65
+ children || null));
66
+ };
67
+ /** 弹出层动画 */
68
+ const renderPopupTransition = () => {
69
+ const transitionClassName = position === 'center'
70
+ ? 'weda-flow-popup-fade'
71
+ : `weda-flow-popup-slide-${position}`;
72
+ return (React.createElement(CSSTransition, { timeout: 300, in: visible, classNames: transitionClassName, mountOnEnter: true, unmountOnExit: destroyOnClose, onExited: () => {
73
+ setAnimatedVisible(false);
74
+ } }, renderPopup()));
75
+ };
76
+ /** 遮罩层动画 */
77
+ const renderOverlayTransition = () => {
78
+ return (React.createElement(CSSTransition, { mountOnEnter: true, unmountOnExit: true, timeout: 300, in: visible, classNames: "weda-flow-popup-fade" }, renderOverlay()));
79
+ };
80
+ return createPortal(React.createElement(React.Fragment, null,
81
+ renderOverlayTransition(),
82
+ renderPopupTransition()), container);
83
+ }
84
+ /** 获取初始样式 */
85
+ function getInitialStyle(position, height, width) {
86
+ if (['left', 'right'].includes(position)) {
87
+ return { width };
88
+ }
89
+ if (['bottom', 'top'].includes(position)) {
90
+ return { height };
91
+ }
92
+ return {};
93
+ }
94
+ /** 获取初始类名 */
95
+ function getInitialClassName(position) {
96
+ if (POSITIONS.includes(position)) {
97
+ return `weda-flow-popup-${position}`;
98
+ }
99
+ return 'weda-flow-popup-bottom';
100
+ }
@@ -0,0 +1,154 @@
1
+ .weda-flow-popup-overlay {
2
+ position: fixed;
3
+ top: 0;
4
+ left: 0;
5
+ width: 100%;
6
+ height: 100%;
7
+ background-color: rgba(0, 0, 0, 0.7);
8
+ z-index: 2020;
9
+ }
10
+
11
+ .weda-flow-popup {
12
+ position: fixed;
13
+ max-height: 100%;
14
+ overflow-y: auto;
15
+ background-color: #fff;
16
+ z-index: 2021;
17
+ }
18
+
19
+ .weda-flow-popup-bottom {
20
+ bottom: 0;
21
+ left: 0;
22
+ width: 100%;
23
+ }
24
+
25
+ .weda-flow-popup-top {
26
+ top: 0;
27
+ left: 0;
28
+ width: 100%;
29
+ }
30
+
31
+ .weda-flow-popup-left {
32
+ top: 0;
33
+ left: 0;
34
+ height: 100%;
35
+ }
36
+
37
+ .weda-flow-popup-right {
38
+ top: 0;
39
+ right: 0;
40
+ height: 100%;
41
+ }
42
+
43
+ .weda-flow-popup-center {
44
+ top: 50%;
45
+ left: 50%;
46
+ transform: translate3d(-50%, -50%, 0);
47
+ }
48
+
49
+ .weda-flow-popup-title {
50
+ text-align: center;
51
+ font-size: 14px;
52
+ font-weight: 700;
53
+ color: #333;
54
+ padding: 20px 12px;
55
+ }
56
+
57
+ .weda-flow-popup-bottom-enter-start,
58
+ .weda-flow-popup-bottom-exit-end {
59
+ transform: translate3d(0, 100%, 0);
60
+ transition: 0.2s;
61
+ }
62
+
63
+ .weda-flow-popup-enter-active {
64
+ transform: translate3d(0, 0, 0);
65
+ transition: 0.2s;
66
+ }
67
+
68
+ .weda-flow-popup-slide-top-enter,
69
+ .weda-flow-popup-slide-top-exit-active {
70
+ transform: translate3d(0, -100%, 0);
71
+ }
72
+
73
+ .weda-flow-popup-slide-right-enter,
74
+ .weda-flow-popup-slide-right-exit-active {
75
+ transform: translate3d(100%, 0, 0);
76
+ }
77
+
78
+ .weda-flow-popup-slide-bottom-enter,
79
+ .weda-flow-popup-slide-bottom-exit-active {
80
+ transform: translate3d(0, 100%, 0);
81
+ }
82
+
83
+ .weda-flow-popup-slide-left-enter,
84
+ .weda-flow-popup-slide-left-exit-active {
85
+ transform: translate3d(-100%, 0, 0);
86
+ }
87
+
88
+ .weda-flow-popup-slide-top-enter-active,
89
+ .weda-flow-popup-slide-left-enter-active,
90
+ .weda-flow-popup-slide-right-enter-active,
91
+ .weda-flow-popup-slide-bottom-enter-active {
92
+ transform: translate3d(0, 0, 0);
93
+ transition: 0.3s;
94
+ }
95
+
96
+ .weda-flow-popup-slide-top-exit-active,
97
+ .weda-flow-popup-slide-left-exit-active,
98
+ .weda-flow-popup-slide-right-exit-active,
99
+ .weda-flow-popup-slide-bottom-exit-active {
100
+ transition: 0.3s;
101
+ transition-timing-function: ease-in;
102
+ }
103
+
104
+ @keyframes fade-in {
105
+ from {
106
+ opacity: 0;
107
+ }
108
+
109
+ to {
110
+ opacity: 1;
111
+ }
112
+ }
113
+
114
+ @keyframes fade-out {
115
+ from {
116
+ opacity: 1;
117
+ }
118
+
119
+ to {
120
+ opacity: 0;
121
+ }
122
+ }
123
+
124
+ .weda-flow-popup-fade-enter-active {
125
+ animation: 0.3s fade-in both ease-out;
126
+ }
127
+ .weda-flow-popup-fade-exit-active {
128
+ animation: 0.3s fade-out both ease-in;
129
+ }
130
+
131
+ .weda-flow-popup-close {
132
+ position: absolute;
133
+ font-size: 14px;
134
+ text-align: center;
135
+ cursor: pointer;
136
+ color: #323232;
137
+ }
138
+
139
+ .weda-flow-popup-close.top-right {
140
+ right: 20px;
141
+ top: 20px;
142
+ }
143
+ .weda-flow-popup-close.top-left {
144
+ left: 20px;
145
+ top: 20px;
146
+ }
147
+ .weda-flow-popup-close.bottom-right {
148
+ right: 20px;
149
+ bottom: 20px;
150
+ }
151
+ .weda-flow-popup-close.bottom-left {
152
+ bottom: 20px;
153
+ left: 20px;
154
+ }
@@ -0,0 +1 @@
1
+ export const POSITIONS = ['bottom', 'top', 'right', 'left', 'center'];
@@ -0,0 +1,43 @@
1
+ import React, { useRef, useEffect, useState } from 'react';
2
+ import { Button } from 'tea-component';
3
+ import UserTreeSelect from '../../../../../form/userOrgSelect/component/user-select-h5';
4
+ import './style.css';
5
+ export * from './types';
6
+ /**
7
+ * 流程进一步封装选人组件
8
+ */
9
+ export function FlowUserSelect(props) {
10
+ const userSelectRef = useRef();
11
+ const onConfirm = (selection) => {
12
+ var _a, _b;
13
+ (_a = props === null || props === void 0 ? void 0 : props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, { users: selection.data, userIds: selection.value });
14
+ (_b = props === null || props === void 0 ? void 0 : props.onClose) === null || _b === void 0 ? void 0 : _b.call(props);
15
+ };
16
+ const onClose = () => {
17
+ var _a;
18
+ (_a = props === null || props === void 0 ? void 0 : props.onClose) === null || _a === void 0 ? void 0 : _a.call(props);
19
+ };
20
+ useEffect(() => {
21
+ var _a, _b, _c;
22
+ if (props.visible) {
23
+ (_c = (_b = (_a = userSelectRef.current) === null || _a === void 0 ? void 0 : _a.methods) === null || _b === void 0 ? void 0 : _b.open) === null || _c === void 0 ? void 0 : _c.call(_b);
24
+ }
25
+ }, [props.visible]);
26
+ return (React.createElement(UserTreeSelect, { labelVisible: false, decorator: null, multiple: props === null || props === void 0 ? void 0 : props.multiple, showType: (props === null || props === void 0 ? void 0 : props.isH5) ? 'h5' : 'pc', style: props.showOriginEntry
27
+ ? props.style || {}
28
+ : {
29
+ display: 'none',
30
+ }, requiredFlag: props.required, className: `${props.showOriginEntry && (props === null || props === void 0 ? void 0 : props.isH5) ? 'weda-flow-user-select-h5' : ''} ${props === null || props === void 0 ? void 0 : props.className}`, confirmAction: onConfirm, outerRef: userSelectRef, closeAction: onClose, defaultValue: props.defaultValue }));
31
+ }
32
+ /**
33
+ * 流程进一步封装选人组件 - 自定义触发按钮形式
34
+ */
35
+ export function FlowUserSelectBtn(props) {
36
+ const { buttonProps, buttonText, ...restProps } = props;
37
+ const [visible, setVisible] = useState(false);
38
+ const onOpenUserSelect = () => setVisible(true);
39
+ const onCloseUserSelect = () => setVisible(false);
40
+ return (React.createElement(React.Fragment, null,
41
+ React.createElement(Button, { ...buttonProps, onClick: onOpenUserSelect }, buttonText),
42
+ React.createElement(FlowUserSelect, { visible: visible, onClose: onCloseUserSelect, ...restProps, showOriginEntry: false })));
43
+ }
@@ -0,0 +1,4 @@
1
+ .weda-flow-user-select-h5 .weui-cells:before,
2
+ .weda-flow-user-select-h5 .weui-cells:after {
3
+ opacity: 0;
4
+ }
@@ -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';