@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,26 @@
1
+ .weda-flow-checklist-popup {
2
+ display: flex;
3
+ flex-direction: column;
4
+ }
5
+ .weda-flow-checklist-body {
6
+ flex: 1;
7
+ overflow-y: auto;
8
+ padding: 0 16px;
9
+ }
10
+ .weda-flow-checklist-body .wedatea2td-form-check-group {
11
+ display: block;
12
+ }
13
+ .weda-flow-checklist-body .wedatea2td-form-check {
14
+ border-bottom: 0.5px solid #e7e7e7;
15
+ padding: 12px 0;
16
+ position: relative;
17
+ display: flex;
18
+ margin: 0 !important;
19
+ }
20
+
21
+ .weda-flow-checklist-confirm {
22
+ position: absolute;
23
+ top: 20px;
24
+ right: 20px;
25
+ font-size: 14px;
26
+ }
@@ -0,0 +1,98 @@
1
+ import React, { useRef, useEffect, useState } from 'react';
2
+ import { Modal, SelectMultiple, Button, Form, Checkbox } from 'tea-component';
3
+ import { FlowCheckListPopup } from './check-list-popup';
4
+ /**
5
+ * 选择下一节点审批人弹窗
6
+ */
7
+ export const FlowTaskInfoModal = (props) => {
8
+ const { isH5, visible, flowTaskInfoList, selectedTaskIds, setSelectedTaskIds, onSubmitTaskIds, } = useFlowTaskInfoModel(props);
9
+ const options = flowTaskInfoList.map((item) => ({
10
+ text: item === null || item === void 0 ? void 0 : item.assigneeName,
11
+ value: item === null || item === void 0 ? void 0 : item.waitFlowTaskId,
12
+ }));
13
+ const renderModal = () => {
14
+ return (React.createElement(Modal, { visible: visible, caption: props.label, onClose: () => onSubmitTaskIds(), size: "auto" },
15
+ React.createElement(Modal.Body, null,
16
+ React.createElement(Form, { style: { marginBottom: '5px' } },
17
+ React.createElement(Form.Item, { label: "\u9009\u62E9\u5904\u7406\u4EBA" },
18
+ React.createElement(SelectMultiple, { searchable: true, matchButtonWidth: true, appearance: "button", size: "full", style: { width: 300 }, staging: false, options: options, value: selectedTaskIds, onChange: (value) => setSelectedTaskIds(value) })))),
19
+ React.createElement(Modal.Footer, null,
20
+ React.createElement(Button, { type: "primary", onClick: () => onSubmitTaskIds(false), disabled: !selectedTaskIds.length }, "\u786E\u5B9A"),
21
+ React.createElement(Button, { type: "weak", onClick: () => onSubmitTaskIds() }, "\u53D6\u6D88"))));
22
+ };
23
+ const renderPopup = () => {
24
+ return (React.createElement(FlowCheckListPopup, { visible: visible, onClose: () => onSubmitTaskIds(), title: props.label, overlayStyle: { zIndex: 998 }, height: 550, confirmButtonProps: {
25
+ disabled: !selectedTaskIds.length,
26
+ onClick: () => onSubmitTaskIds(false),
27
+ } },
28
+ React.createElement(Checkbox.Group, { value: selectedTaskIds, onChange: (value) => setSelectedTaskIds(value), layout: "column" }, options.map((option) => (React.createElement(Checkbox, { name: option.value, key: option.value }, option.text))))));
29
+ };
30
+ return React.createElement(React.Fragment, null,
31
+ " ",
32
+ isH5 ? renderPopup() : renderModal());
33
+ };
34
+ /** 下一节点审批人model */
35
+ function useFlowTaskInfoModel(params) {
36
+ const { flowRequest, isH5 } = params.flowFrameCommonProps.flowLocalProps;
37
+ const { onAfterFinishFlowAction } = params.flowControlModel;
38
+ /** 弹框是否可见 */
39
+ const [visible, setVisible] = useState(false);
40
+ /** 审批人列表 */
41
+ const [flowTaskInfoList, setFlowTaskInfoList] = useState([]);
42
+ /** 已选任务数组 */
43
+ const [selectedTaskIds, setSelectedTaskIds] = useState([]);
44
+ const timer = useRef(null);
45
+ useEffect(() => {
46
+ return () => {
47
+ cleanTiming();
48
+ };
49
+ }, []);
50
+ useEffect(() => {
51
+ if (params.flowControlModel.triggerFlowTaskInfo) {
52
+ const { toBeSubmittedFlowTaskInfo } = params.flowControlModel.triggerFlowTaskInfo || {};
53
+ setVisible(true);
54
+ setFlowTaskInfoList(toBeSubmittedFlowTaskInfo || []);
55
+ timingSubmit();
56
+ }
57
+ // eslint-disable-next-line react-hooks/exhaustive-deps
58
+ }, [params.flowControlModel.triggerFlowTaskInfo]);
59
+ const cleanTiming = () => {
60
+ clearTimeout(timer.current);
61
+ };
62
+ /** 审批人列表提交 */
63
+ const submitFlowTaskList = async (flowTaskIds) => {
64
+ const result = await flowRequest({
65
+ action: 'SubmitFlowTaskList',
66
+ data: { flowTaskIds },
67
+ });
68
+ if (result === null || result === void 0 ? void 0 : result.status) {
69
+ setVisible(false);
70
+ setSelectedTaskIds([]);
71
+ cleanTiming();
72
+ // 执行完成后自定义动作
73
+ onAfterFinishFlowAction(params.actionKey, params.afterAction);
74
+ }
75
+ };
76
+ /** 定时提交 */
77
+ const timingSubmit = () => {
78
+ // eslint-disable-next-line rulesdir/no-timer
79
+ timer.current = setTimeout(() => {
80
+ submitFlowTaskList();
81
+ }, 600000);
82
+ };
83
+ /** 提交按钮动作 */
84
+ const onSubmitTaskIds = (isCancel = true) => {
85
+ const taskIds = isCancel
86
+ ? flowTaskInfoList.map((i) => i === null || i === void 0 ? void 0 : i.waitFlowTaskId)
87
+ : selectedTaskIds;
88
+ submitFlowTaskList(taskIds);
89
+ };
90
+ return {
91
+ isH5,
92
+ selectedTaskIds,
93
+ visible,
94
+ flowTaskInfoList,
95
+ setSelectedTaskIds,
96
+ onSubmitTaskIds,
97
+ };
98
+ }
@@ -0,0 +1,18 @@
1
+ import { AddAssigneeBtn } from './add-assignee-btn';
2
+ import { ApplyCcBtn } from './apply-cc-btn';
3
+ import { ApprovalDrawer } from './approval-drawer';
4
+ import { CancelApplyBtn } from './cancel-apply-btn';
5
+ import { FlowTaskInfoModal } from './flow-task-info-modal';
6
+ import { InitiationBtn } from './initiation-btn';
7
+ import { RevokeModal } from './revoke-modal';
8
+ import { RollbackModal } from './roll-back-modal';
9
+ export const CONTROL_COMPONENT = {
10
+ AddAssigneeBtn,
11
+ ApplyCcBtn,
12
+ ApprovalDrawer,
13
+ CancelApplyBtn,
14
+ FlowTaskInfoModal,
15
+ InitiationBtn,
16
+ RevokeModal,
17
+ RollbackModal,
18
+ };
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { message } from 'tea-component';
3
+ import { FlowButton } from '../components';
4
+ /**
5
+ * 发起阶段按钮、可用于保存草稿和提交申请两个操作
6
+ */
7
+ export function InitiationBtn(props) {
8
+ const { flowControlModel } = props;
9
+ const onClick = () => {
10
+ var _a;
11
+ const ccUserIds = (_a = flowControlModel.applyCcUser) === null || _a === void 0 ? void 0 : _a.join();
12
+ flowControlModel.completeTask({
13
+ actionKey: props.actionKey,
14
+ buttonAction: props.buttonAction,
15
+ afterAction: props.afterAction,
16
+ data: { ccUserIds },
17
+ successCallback: () => {
18
+ message.success({
19
+ content: `${props.label}成功`,
20
+ });
21
+ },
22
+ });
23
+ };
24
+ return (React.createElement(FlowButton, { ...props.buttonProps, buttonIcon: props.buttonIcon, id: props.id, onClick: onClick }, props.label));
25
+ }
@@ -0,0 +1,50 @@
1
+ import React, { useState } from 'react';
2
+ import { Button, Modal, message } from 'tea-component';
3
+ import { FlowPopup, FlowButton } from '../../components';
4
+ import './style.css';
5
+ export function RevokeModal(props) {
6
+ const { flowFrameCommonProps, flowControlModel } = props;
7
+ const { flowRequest, isH5, currentPageType } = flowFrameCommonProps.flowLocalProps;
8
+ const { flowDetail } = flowFrameCommonProps.commonFlowData;
9
+ const { onAfterFinishFlowAction } = flowControlModel;
10
+ const [visible, setVisible] = useState(false);
11
+ const onOpen = () => setVisible(true);
12
+ const onClose = () => setVisible(false);
13
+ /** 撤销请求 */
14
+ const revoke = async () => {
15
+ const result = await flowRequest({
16
+ action: 'Revoke',
17
+ data: {
18
+ flowCode: flowDetail.flowCode,
19
+ appVersion: flowDetail.flowVersion,
20
+ instanceId: flowDetail.instanceId,
21
+ revokeType: currentPageType === 'CREATE' ? 2 : 1,
22
+ taskId: currentPageType === 'DONE' ? flowDetail.taskId : undefined,
23
+ },
24
+ });
25
+ if (result) {
26
+ message.success({
27
+ content: `${props.label}成功`,
28
+ });
29
+ onAfterFinishFlowAction(props.actionKey, props.afterAction);
30
+ }
31
+ };
32
+ const renderModal = () => {
33
+ return (React.createElement(Modal, { visible: visible, caption: "\u64A4\u9500\u6D41\u7A0B\u63D0\u9192", onClose: onClose },
34
+ React.createElement(Modal.Body, null, "\u6D41\u7A0B\u6B63\u5728\u8FDB\u884C\u4E2D\uFF0C\u786E\u8BA4\u64A4\u9500\u6B64\u6D41\u7A0B\uFF1F"),
35
+ React.createElement(Modal.Footer, null,
36
+ React.createElement(Button, { type: "primary", onClick: revoke }, "\u786E\u5B9A"),
37
+ React.createElement(Button, { type: "weak", onClick: onClose }, "\u53D6\u6D88"))));
38
+ };
39
+ const renderPopup = () => {
40
+ return (React.createElement(FlowPopup, { visible: visible, onClose: onClose, title: "\u64A4\u9500\u6D41\u7A0B\u63D0\u9192", overlayStyle: { zIndex: 998 }, width: "80%", className: "weda-flow-revoke-popup" },
41
+ React.createElement("div", { className: "weda-flow-revoke-tip" },
42
+ React.createElement("div", { className: "weda-flow-revoke-content" }, "\u6D41\u7A0B\u6B63\u5728\u8FDB\u884C\u4E2D\uFF0C\u786E\u8BA4\u64A4\u9500\u6B64\u6D41\u7A0B\uFF1F"),
43
+ React.createElement("div", { className: "weda-flow-revoke-confirm" },
44
+ React.createElement(Button, { type: "text", onClick: onClose }, "\u53D6\u6D88"),
45
+ React.createElement(Button, { type: "link", onClick: revoke }, "\u786E\u8BA4")))));
46
+ };
47
+ return (React.createElement(React.Fragment, null,
48
+ React.createElement(FlowButton, { ...props.buttonProps, buttonIcon: props.buttonIcon, id: props.id, onClick: onOpen }, props.label),
49
+ isH5 ? renderPopup() : renderModal()));
50
+ }
@@ -0,0 +1,28 @@
1
+ .weda-flow-revoke-popup {
2
+ border-radius: 4px;
3
+ width: 80%;
4
+ }
5
+ .weda-flow-revoke-content {
6
+ color: #0009;
7
+ font-size: 16px;
8
+ line-height: 24px;
9
+ max-height: 288px;
10
+ overflow: auto;
11
+ padding: 0 24px;
12
+ text-align: center;
13
+ }
14
+
15
+ .weda-flow-revoke-confirm {
16
+ display: flex;
17
+ border-top: 1px solid #eee;
18
+ margin-top: 32px;
19
+ }
20
+
21
+ .weda-flow-revoke-confirm button {
22
+ width: 50%;
23
+ height: 56px;
24
+ }
25
+
26
+ .weda-flow-revoke-confirm button:first-child {
27
+ border-right: 1px solid #eee;
28
+ }
@@ -0,0 +1,104 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { Button, Modal, Select, Form, Radio, message } from 'tea-component';
3
+ import { FlowCheckListPopup } from './check-list-popup';
4
+ /** 回退弹窗 */
5
+ export function RollbackModal(props) {
6
+ const { visible, isH5, preElementList, selectedNodeId, setSelectedNodeId, onOpen, onClose, rollBack, } = useRollbackModel(props);
7
+ const renderModal = () => {
8
+ return (React.createElement(Modal, { visible: visible, caption: '流程回退', onClose: onClose },
9
+ React.createElement(Modal.Body, null,
10
+ React.createElement(Form, null,
11
+ React.createElement(Form.Item, { label: '选择回退节点' },
12
+ React.createElement(Select, { size: "full", appearance: "button", matchButtonWidth: true, options: preElementList, value: selectedNodeId, onChange: (value) => setSelectedNodeId(value), style: { width: 200 } })))),
13
+ React.createElement(Modal.Footer, null,
14
+ React.createElement(Button, { type: "primary", disabled: (preElementList === null || preElementList === void 0 ? void 0 : preElementList.length) === 0 || !selectedNodeId, onClick: rollBack }, "\u786E\u5B9A"),
15
+ React.createElement(Button, { type: "weak", onClick: onClose }, "\u53D6\u6D88"))));
16
+ };
17
+ const renderPopup = () => {
18
+ return (React.createElement(FlowCheckListPopup, { visible: visible, onClose: onClose, title: "\u8BF7\u9009\u62E9\u56DE\u9000\u8282\u70B9", overlayStyle: { zIndex: 998 }, height: 550, confirmButtonProps: {
19
+ onClick: rollBack,
20
+ disabled: (preElementList === null || preElementList === void 0 ? void 0 : preElementList.length) === 0 || !selectedNodeId,
21
+ } },
22
+ React.createElement(Radio.Group, { value: selectedNodeId, onChange: (value) => setSelectedNodeId(value), layout: "column" }, preElementList.map((ele) => (React.createElement(Radio, { name: ele.value, key: ele.value }, ele.text))))));
23
+ };
24
+ return (React.createElement(React.Fragment, null,
25
+ React.createElement(Button, { ...props.buttonProps, id: props.id, onClick: onOpen }, props.label),
26
+ isH5 ? renderPopup() : renderModal()));
27
+ }
28
+ /** 回退model */
29
+ function useRollbackModel(params) {
30
+ const { flowFrameCommonProps, flowControlModel } = params;
31
+ const { flowRequest, isH5 } = flowFrameCommonProps.flowLocalProps;
32
+ const { flowDetail } = flowFrameCommonProps.commonFlowData;
33
+ const { onAfterFinishFlowAction } = flowControlModel;
34
+ const [visible, setVisible] = useState(false);
35
+ /** 可回退节点列表 */
36
+ const [preElementList, setPreElementList] = useState([]);
37
+ const [selectedNodeId, setSelectedNodeId] = useState('');
38
+ useEffect(() => {
39
+ visible && getPreElementList();
40
+ // eslint-disable-next-line react-hooks/exhaustive-deps
41
+ }, [visible]);
42
+ const onOpen = () => setVisible(true);
43
+ const onClose = () => setVisible(false);
44
+ /** 获取回退节点列表 */
45
+ const getPreElementList = async () => {
46
+ const result = await flowRequest({
47
+ action: 'GetPreElementList',
48
+ data: {
49
+ flowCode: flowDetail.flowCode,
50
+ appVersion: flowDetail.flowVersion,
51
+ instanceId: flowDetail.instanceId,
52
+ },
53
+ });
54
+ if (result === null || result === void 0 ? void 0 : result.data) {
55
+ const options = [];
56
+ let lastNodeId = '';
57
+ result.data.forEach((item) => {
58
+ if (item.lastNode) {
59
+ lastNodeId = item.elementId;
60
+ }
61
+ options.push({
62
+ ...item,
63
+ value: item.elementId,
64
+ text: item.elementName,
65
+ });
66
+ });
67
+ setPreElementList(options);
68
+ setSelectedNodeId(lastNodeId);
69
+ }
70
+ };
71
+ /** 回退请求 */
72
+ const rollBack = async () => {
73
+ var _a;
74
+ const result = await flowRequest({
75
+ action: 'RollBack',
76
+ data: {
77
+ flowCode: flowDetail.flowCode,
78
+ appVersion: flowDetail.flowVersion,
79
+ instanceId: flowDetail.instanceId,
80
+ taskId: flowDetail.taskId,
81
+ nodeId: flowDetail.currentNodeId,
82
+ sourceType: 1,
83
+ targetNodeId: selectedNodeId,
84
+ targetActTaskId: (_a = preElementList.find((item) => item.value === selectedNodeId)) === null || _a === void 0 ? void 0 : _a.actTaskId,
85
+ },
86
+ }, { previewData: { Status: true } });
87
+ if (result) {
88
+ message.success({
89
+ content: `${params.label}成功`,
90
+ });
91
+ onAfterFinishFlowAction(params.actionKey, params.afterAction);
92
+ }
93
+ };
94
+ return {
95
+ isH5,
96
+ visible,
97
+ preElementList,
98
+ selectedNodeId,
99
+ setSelectedNodeId,
100
+ onOpen,
101
+ onClose,
102
+ rollBack,
103
+ };
104
+ }
@@ -0,0 +1,2 @@
1
+ import { ModelFlowControl } from './control';
2
+ export default ModelFlowControl;
@@ -0,0 +1,20 @@
1
+ .weda-flow-control {
2
+ height: auto;
3
+ overflow-x: auto;
4
+ background: #fff;
5
+ text-align: center;
6
+ padding: 20px;
7
+ }
8
+ .weda-flow-h5-control {
9
+ padding: 20px 0px;
10
+ }
11
+ .weda-flow-control-divider {
12
+ border-top: 0;
13
+ display: inline-block;
14
+ margin: 0 12px;
15
+ border-left: var(--wd-divider-size-border) solid
16
+ var(--wd-divider-color-border);
17
+ height: 1em;
18
+ vertical-align: middle;
19
+ width: 0;
20
+ }
@@ -0,0 +1,137 @@
1
+ import { useState } from 'react';
2
+ import { PAGE_TYPE } from '../../constants';
3
+ import { CommonFlowDataUtils, } from '../../frame';
4
+ import { FLOW_CONTROL_ACTION_KEY, } from './config';
5
+ /** 流程控制主model, 包含一些公共状态或方法 */
6
+ export function useFlowControlModel(params) {
7
+ //#region model入参
8
+ const { commonFlowData, flowLocalProps, ide, reload, setFormType } = params;
9
+ const { flowDetail, pageInfo } = commonFlowData;
10
+ const { flowRequest, isWedaIde } = flowLocalProps;
11
+ const { events } = ide || {};
12
+ //#endregion
13
+ //#region hook
14
+ /** 提交申请时的抄送列表 */
15
+ const [applyCcUser, setApplyCcUser] = useState([]);
16
+ /** 流程是否已回退 */
17
+ const [hasGoBack, setHasGoBack] = useState(false);
18
+ /** 触发下一节点审批人操作 */
19
+ const [triggerFlowTaskInfo, setTriggerFlowTaskInfo] = useState(null);
20
+ //#endregion
21
+ //#region 流程操作请求
22
+ /** 提交申请、保存草稿、同意、拒绝、处理、转办 时 调用此请求 */
23
+ const completeTask = (value) => {
24
+ if (!value.buttonAction)
25
+ return;
26
+ getFormData(async (formDataMap) => {
27
+ var _a, _b, _c;
28
+ const params = {
29
+ buttonAction: value.buttonAction,
30
+ flowCode: flowDetail.flowCode,
31
+ instanceId: flowDetail.instanceId,
32
+ nodeId: flowDetail.currentNodeId,
33
+ taskId: flowDetail.taskId,
34
+ appVersion: flowDetail.flowVersion,
35
+ appCode: flowDetail === null || flowDetail === void 0 ? void 0 : flowDetail.startAppCode,
36
+ variableInfos: translateVariableInfos(formDataMap, pageInfo),
37
+ ...(value.data || {}),
38
+ };
39
+ (_a = value === null || value === void 0 ? void 0 : value.setLoadingState) === null || _a === void 0 ? void 0 : _a.call(value, true);
40
+ const result = await flowRequest({ action: 'CompleteTask', data: params }, { upperCaseIgnoreKeys: ['variableInfos'] });
41
+ (_b = value === null || value === void 0 ? void 0 : value.setLoadingState) === null || _b === void 0 ? void 0 : _b.call(value, false);
42
+ if (result) {
43
+ (_c = value === null || value === void 0 ? void 0 : value.successCallback) === null || _c === void 0 ? void 0 : _c.call(value);
44
+ if (result === null || result === void 0 ? void 0 : result.toBeSubmittedFlowTaskFlag) {
45
+ setTriggerFlowTaskInfo(result);
46
+ }
47
+ else {
48
+ // 执行完成后自定义动作
49
+ onAfterFinishFlowAction(value.actionKey, value.afterAction);
50
+ }
51
+ }
52
+ });
53
+ };
54
+ //#endregion
55
+ //#region 辅助方法
56
+ /** 获取审批申请表单数据 */
57
+ const getFormData = (callback) => {
58
+ var _a;
59
+ if (isWedaIde) {
60
+ return;
61
+ }
62
+ (_a = events === null || events === void 0 ? void 0 : events.tap) === null || _a === void 0 ? void 0 : _a.call(events, {
63
+ onGetFormData: (formDataMap) => {
64
+ if (Object.values(formDataMap).some((item) => item === undefined)) {
65
+ return;
66
+ }
67
+ callback === null || callback === void 0 ? void 0 : callback(formDataMap);
68
+ },
69
+ }, {
70
+ originEvent: null,
71
+ });
72
+ };
73
+ /** 完成流程动作后的事件 */
74
+ function onAfterFinishFlowAction(currentActionKey, afterAction) {
75
+ const customizeFinishAction = events === null || events === void 0 ? void 0 : events[afterAction];
76
+ if (customizeFinishAction) {
77
+ // 当前动作不是加签的话,需要切换URL参数
78
+ if (currentActionKey !== FLOW_CONTROL_ACTION_KEY.ADD_ASSIGNEE) {
79
+ // 默认切换页面类型为【我已处理】
80
+ let newPageType = PAGE_TYPE.DONE;
81
+ // 提交后需要切换页面类型为【我发起的】
82
+ if (currentActionKey === FLOW_CONTROL_ACTION_KEY.SUBMIT) {
83
+ newPageType = PAGE_TYPE.CREATE;
84
+ }
85
+ // 保存草稿后切换页面类型为【草稿箱】
86
+ if (currentActionKey === FLOW_CONTROL_ACTION_KEY.SAVE_DRAFT) {
87
+ newPageType = PAGE_TYPE.DRAFT;
88
+ }
89
+ CommonFlowDataUtils.updateUrlSearch({ pageType: newPageType });
90
+ }
91
+ // 操作类型不是回退的情况才reload数据 回退之后当前流程被销毁 故回退之后不刷新数据
92
+ if (currentActionKey === FLOW_CONTROL_ACTION_KEY.ROLL_BACK) {
93
+ setHasGoBack(true);
94
+ setFormType('read');
95
+ }
96
+ else {
97
+ // 重新加载数据
98
+ reload();
99
+ }
100
+ // 执行自定义事件
101
+ customizeFinishAction === null || customizeFinishAction === void 0 ? void 0 : customizeFinishAction();
102
+ }
103
+ }
104
+ //#endregion
105
+ return {
106
+ hasGoBack,
107
+ applyCcUser,
108
+ triggerFlowTaskInfo,
109
+ setApplyCcUser,
110
+ completeTask,
111
+ onAfterFinishFlowAction,
112
+ };
113
+ }
114
+ /** 涉及提交申请表单时,转换variableInfos */
115
+ function translateVariableInfos(currentFormData, pageInfo) {
116
+ var _a;
117
+ const outEntityCodes = (pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.outEntityCodes) || [];
118
+ const originObjectMap = ((_a = pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.variableInfos) === null || _a === void 0 ? void 0 : _a.objectMap) || [];
119
+ return outEntityCodes === null || outEntityCodes === void 0 ? void 0 : outEntityCodes.map((item) => {
120
+ const originVariableInfo = originObjectMap === null || originObjectMap === void 0 ? void 0 : originObjectMap.find((info) => (info === null || info === void 0 ? void 0 : info.entityCode) === (item === null || item === void 0 ? void 0 : item.entityCode));
121
+ const { recordId, fieldValueMap } = originVariableInfo || {};
122
+ const currentFieldValueMap = ((currentFormData === null || currentFormData === void 0 ? void 0 : currentFormData[item === null || item === void 0 ? void 0 : item.entityCode]) ||
123
+ {});
124
+ const Value = Object.assign({
125
+ entityCode: item === null || item === void 0 ? void 0 : item.entityCode,
126
+ fieldValueMap: {
127
+ ...(fieldValueMap || {}),
128
+ ...currentFieldValueMap,
129
+ },
130
+ }, recordId ? { recordId } : {});
131
+ const variableInfo = {
132
+ Type: item === null || item === void 0 ? void 0 : item.type,
133
+ Value,
134
+ };
135
+ return variableInfo;
136
+ });
137
+ }
@@ -1,8 +1,8 @@
1
1
  export const instanceMockData = {
2
2
  InstanceId: '1540637032124833793',
3
- Name: 'kong123提交的hongqi_var',
3
+ Name: '示例流程名称',
4
4
  Description: '',
5
- StartedBy: 'kong123',
5
+ StartedBy: '示例流程发起人',
6
6
  CurrentApprover: '1538836331989536769',
7
7
  StartTime: 1656151467000,
8
8
  IsCompleted: false,
@@ -11,6 +11,7 @@ export const pageDetailMockData = {
11
11
  ShowTurnToPerson: true,
12
12
  ShowAddAssignee: true,
13
13
  ShowRollBack: true,
14
+ ShowRevoke: false,
14
15
  OutEntityCodes: [],
15
16
  Buttons: {
16
17
  1: '同意',
@@ -130,7 +130,7 @@ export function SelectPickerH5({ updateValue, selectedValue, options, isTurnPage
130
130
  setSearchValue('');
131
131
  updateValue(item, true, true);
132
132
  } },
133
- React.createElement("p", null, item.label)));
133
+ React.createElement("p", { className: 'weda-ui-custom-picker__cloumn-item-text' }, item.label)));
134
134
  }),
135
135
  status === Status.LOADING && (React.createElement("li", { key: 'loading' },
136
136
  React.createElement(Loading, null))),
@@ -157,3 +157,10 @@
157
157
  .wedatea2td-search--simple .wedatea2td-input--search {
158
158
  caret-color: #000000;
159
159
  }
160
+
161
+ .weda-ui-custom-picker__cloumn-item-text {
162
+ overflow: hidden;
163
+ text-overflow: ellipsis;
164
+ white-space: nowrap;
165
+ margin-right: 40px;
166
+ }
@@ -187,13 +187,8 @@ function SelectPc({ where, dataSourceName, viewId, format, primaryField, enumNam
187
187
  setSelectedValue(value);
188
188
  } }));
189
189
  case 'date': {
190
- const now = moment();
191
- const start = startDate
192
- ? decodeIsoDatetime(startDate, 'date')
193
- : `${now.year() - 20}-01-01`;
194
- const end = endDate
195
- ? decodeIsoDatetime(endDate, 'date')
196
- : `${now.year() + 20}-12-31`;
190
+ const start = startDate ? decodeIsoDatetime(startDate, 'date') : null;
191
+ const end = endDate ? decodeIsoDatetime(endDate, 'date') : null;
197
192
  const dateProps = {
198
193
  range: [moment(start), moment(end)],
199
194
  onChange: onDataChange,
@@ -24,7 +24,7 @@ label = '标题', labelVisible = true, defaultValue = '', placeholder = '请输
24
24
  'weui-cell_disabled': disabled,
25
25
  });
26
26
  // 两次默认值不同时, 需要刷新value
27
- const [value, setValue] = useSyncValue(defaultValue);
27
+ const [value, setValue] = useSyncValue(defaultValue !== null && defaultValue !== void 0 ? defaultValue : '');
28
28
  const counter = React.useMemo(() => (value === null || value === void 0 ? void 0 : value.length) || 0, [value]);
29
29
  const onChange = function (e) {
30
30
  const text = typeof e === 'string' ? e : e.target.value;
@@ -54,6 +54,10 @@
54
54
  width: 100%;
55
55
  cursor: zoom-in;
56
56
  }
57
+ ._weda-fn-upload-result__item .weda-uploader-pc__image {
58
+ width: 100%;
59
+ object-fit: cover;
60
+ }
57
61
 
58
62
  .weda-uploader-pc__input-box .wedatea2td-disabled {
59
63
  cursor: not-allowed;
@@ -123,3 +127,18 @@
123
127
  width: 6.85714em;
124
128
  height: 6.85714em;
125
129
  }
130
+ .weda-ui .img-shape-ectangle {
131
+ border-radius: 0;
132
+ }
133
+ .weda-ui .img-shape-circular {
134
+ border-radius: 50%;
135
+ }
136
+ .weda-ui .img-shape-rounded-tectangle {
137
+ border-radius: 6px;
138
+ }
139
+ .img-shape-circular:before {
140
+ border-radius: 50%;
141
+ }
142
+ .img-shape-rounded-tectangle:before {
143
+ border-radius: 6px;
144
+ }
@@ -31,12 +31,30 @@ function UploaderPc(props) {
31
31
  });
32
32
  }
33
33
  export default function Uploader(props) {
34
+ const { showShape } = props;
35
+ const [imgTypeCls, setImgTypeCls] = React.useState(null);
36
+ React.useEffect(() => {
37
+ // let shapeClass;
38
+ switch (showShape) {
39
+ // 圆角矩形-roundedTectangle
40
+ case 'roundedTectangle':
41
+ setImgTypeCls('img-shape-rounded-tectangle');
42
+ break;
43
+ // 圆形-circular
44
+ case 'circular':
45
+ setImgTypeCls('img-shape-circular');
46
+ break;
47
+ default:
48
+ setImgTypeCls('img-shape-ectangle');
49
+ break;
50
+ }
51
+ }, [showShape]);
34
52
  const platform = usePlatform();
35
53
  if ((props === null || props === void 0 ? void 0 : props.showType) === 'pc') {
36
- return React.createElement(UploaderPc, { ...props });
54
+ return React.createElement(UploaderPc, { imgTypeCls: imgTypeCls, ...props });
37
55
  }
38
56
  if ((props === null || props === void 0 ? void 0 : props.showType) === 'h5') {
39
- return React.createElement(UploaderH5, { ...props });
57
+ return React.createElement(UploaderH5, { imgTypeCls: imgTypeCls, ...props });
40
58
  }
41
- return platform === 'h5' ? (React.createElement(UploaderH5, { ...props })) : (React.createElement(UploaderPc, { ...props }));
59
+ return platform === 'h5' ? (React.createElement(UploaderH5, { imgTypeCls: imgTypeCls, ...props })) : (React.createElement(UploaderPc, { imgTypeCls: imgTypeCls, ...props }));
42
60
  }