@cloudbase/weda-ui 3.4.5 → 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 (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
@@ -135,7 +135,7 @@ export default function ComponentList() {
135
135
  React.createElement("tbody", null, item[1].map((i) => {
136
136
  return (React.createElement("tr", { key: i.name },
137
137
  React.createElement("td", null,
138
- React.createElement("a", { href: i.meta.docsUrl }, i.meta.title),
138
+ i.meta.docsUrl ? (React.createElement("a", { href: i.meta.docsUrl }, i.meta.title)) : (i.meta.title),
139
139
  i.isStandardized && (React.createElement("span", { className: "wd-design-lable" }))),
140
140
  React.createElement("td", null, i.name),
141
141
  React.createElement("td", null, i.meta.description)));
@@ -11,7 +11,7 @@ const ModalShow = forwardRef(function ModalShow(props, ref) {
11
11
  setVisible(true);
12
12
  }, []);
13
13
  // 实例 ref 到外部
14
- useImperativeHandle(ref, () => ({ setVisible }));
14
+ useImperativeHandle(ref, () => ({ setVisible }), [setVisible]);
15
15
  return React.createElement(Modal, { ...props, visible: visible });
16
16
  });
17
17
  function show(options) {
@@ -15,7 +15,7 @@ const format = 'YYYY-MM-DD';
15
15
  const controlSectionSize = 'auto'; // 操作栏控件尺寸
16
16
  const week = ['一', '二', '三', '四', '五', '六', '日']; // 表头日历星期展示方式
17
17
  const isShowWeekend = true; // 是否显示周末
18
- export default function Calendar({ className, style, initVisible, initValue, configData = emptyArray, }) {
18
+ export default function Calendar({ id, className, style, initVisible, initValue, configData = emptyArray, }) {
19
19
  // 'h5' || 'pc'
20
20
  const platform = usePlatform();
21
21
  const visible = typeof initVisible === 'boolean' ? initVisible : true;
@@ -131,7 +131,7 @@ export default function Calendar({ className, style, initVisible, initValue, con
131
131
  value: `${item.value}`,
132
132
  }));
133
133
  };
134
- return (React.createElement("div", { "data-testid": "weda-calendar", className: classNames(blockName, 'weda-ui', platform === 'h5' ? `${blockName}-h5` : `${blockName}-pc`, {
134
+ return (React.createElement("div", { id: id, "data-testid": "weda-calendar", className: classNames(blockName, 'weda-ui', platform === 'h5' ? `${blockName}-h5` : `${blockName}-pc`, {
135
135
  [className]: className,
136
136
  }), style: style },
137
137
  React.createElement(ConfigProvider, { classPrefix: "wedatea2td" },
@@ -1,7 +1,3 @@
1
1
  export * from './HighLightComment';
2
- export * from './HighlightTextarea';
3
- export * from './WedaUserTransfer';
4
2
  export * from './FlowStatusText';
5
- export * from './FlowUserSelect';
6
3
  export * from './FlowModuleText';
7
- export * from './UserSelectModel';
@@ -4,13 +4,13 @@ import { useMediaQuery } from '@react-hookz/web';
4
4
  import { useGlobalContext } from '../../../utils/hooks/context';
5
5
  import { globalContextConnect } from '../../../utils/hooks/globalConnect';
6
6
  import { safeJsonParse } from '../../../utils/tool';
7
- import { ControlModelUtils } from '../modules/control/utils';
8
7
  import { PAGE_TYPE } from '../constants';
9
8
  import { getCommonFlowData } from './getCommonFlowData';
10
9
  import { ICommonFlowDataProps } from './types';
11
- import { CommonFlowDataUtils } from './utils';
10
+ import { CommonFlowDataUtils, FlowRequest } from './utils';
12
11
  import { useCommonFlowRequest, useElementMediaQuery, } from './hooks';
13
12
  export * from './types';
13
+ export { CommonFlowDataUtils } from './utils';
14
14
  /**
15
15
  * 各个模块 通用的高阶函数 返回一个Container组件,包含一些公共属性和逻辑
16
16
  */
@@ -41,7 +41,7 @@ export function createModuleFrame(Component, moduleName) {
41
41
  if (currentPageType === PAGE_TYPE.TO_DO &&
42
42
  data.flowDetail.taskStatus > 1) {
43
43
  // 将url参数中的pageType更新成Done
44
- ControlModelUtils.updateUrlSearch({ pageType: PAGE_TYPE.DONE });
44
+ CommonFlowDataUtils.updateUrlSearch({ pageType: PAGE_TYPE.DONE });
45
45
  // 设置表单状态为只读
46
46
  data.flowLoadData.formType = 'read';
47
47
  }
@@ -66,6 +66,7 @@ export function createModuleFrame(Component, moduleName) {
66
66
  currentPageType,
67
67
  callWedaApi,
68
68
  safeJsonParse,
69
+ flowRequest: new FlowRequest().request(callWedaApi, IS_WEDA_IDE),
69
70
  };
70
71
  return (React.createElement(ConfigProvider, { classPrefix: "wedatea2td" },
71
72
  React.createElement("div", { ...props, ref: containerRef },
@@ -185,6 +185,12 @@ export class IFlowDetailProps {
185
185
  writable: true,
186
186
  value: void 0
187
187
  });
188
+ Object.defineProperty(this, "currentApproverName", {
189
+ enumerable: true,
190
+ configurable: true,
191
+ writable: true,
192
+ value: void 0
193
+ });
188
194
  }
189
195
  }
190
196
  export class IPageInfoProps {
@@ -249,19 +255,19 @@ export class IPageInfoProps {
249
255
  writable: true,
250
256
  value: void 0
251
257
  });
252
- Object.defineProperty(this, "outEntityCodes", {
258
+ Object.defineProperty(this, "buttons", {
253
259
  enumerable: true,
254
260
  configurable: true,
255
261
  writable: true,
256
- value: void 0
262
+ value: {}
257
263
  });
258
- Object.defineProperty(this, "buttons", {
264
+ Object.defineProperty(this, "dataSourceInputParams", {
259
265
  enumerable: true,
260
266
  configurable: true,
261
267
  writable: true,
262
- value: {}
268
+ value: void 0
263
269
  });
264
- Object.defineProperty(this, "dataSourceInputParams", {
270
+ Object.defineProperty(this, "outEntityCodes", {
265
271
  enumerable: true,
266
272
  configurable: true,
267
273
  writable: true,
@@ -1,3 +1,4 @@
1
+ import { parse, stringify } from 'querystring';
1
2
  import { getPageQuery } from '../../../utils/getPageQuery';
2
3
  import { STATUS_NUMBER_MAPPING, STATUS, PAGE_TYPE } from '../constants';
3
4
  export class CommonFlowDataUtils {
@@ -41,12 +42,22 @@ export class CommonFlowDataUtils {
41
42
  /** 获取当前流程页面参数 */
42
43
  static getCurrentFlowPageQuery(isWedaIde) {
43
44
  const { flowTaskId, pageType: queryPageType } = getPageQuery();
44
- const currentPageType = isWedaIde ? PAGE_TYPE.CREATEFLOW : queryPageType;
45
+ const currentPageType = isWedaIde ? PAGE_TYPE.TO_DO : queryPageType;
45
46
  return {
46
47
  flowTaskId: flowTaskId,
47
48
  currentPageType: currentPageType,
48
49
  };
49
50
  }
51
+ /** 更新浏览器参数 */
52
+ static updateUrlSearch(newSearchOption) {
53
+ const { hash, origin, pathname } = location;
54
+ const currentHash = hash.split('?')[0];
55
+ const currentSearch = parse(hash.split('?')[1]);
56
+ const newSearch = stringify({ ...currentSearch, ...newSearchOption });
57
+ const newHash = `${currentHash}?${newSearch}`;
58
+ const newUrl = `${origin}${pathname}${newHash}`;
59
+ history.pushState('', '', newUrl);
60
+ }
50
61
  }
51
62
  /** 转换流程记录数据 */
52
63
  Object.defineProperty(CommonFlowDataUtils, "transProcessData", {
@@ -88,3 +99,51 @@ Object.defineProperty(CommonFlowDataUtils, "transProcessData", {
88
99
  });
89
100
  }
90
101
  });
102
+ /** 针对流程封装请求 */
103
+ export class FlowRequest {
104
+ /** 设置请求方法,加入 预览数据 入参首字母大小写等设置 */
105
+ request(callWedaApi, isWedaIde) {
106
+ const flowRequest = async (params, config) => {
107
+ const { previewData, upperCaseData = true, upperCaseIgnoreKeys, } = config || {};
108
+ if (isWedaIde) {
109
+ return this.toTransKeyCase(previewData || {}, 'toLowerCase');
110
+ }
111
+ const result = await callWedaApi({
112
+ ...params,
113
+ data: this.toTransKeyCase(params.data, upperCaseData ? 'toUpperCase' : 'toLowerCase', upperCaseIgnoreKeys),
114
+ });
115
+ return this.toTransKeyCase(result, 'toLowerCase');
116
+ };
117
+ return flowRequest;
118
+ }
119
+ /** 转换具体参数的首字母大小写 */
120
+ toTransKeyCase(target, method, ignoreKeyValues) {
121
+ const result = {};
122
+ if (this.isArray(target)) {
123
+ return target === null || target === void 0 ? void 0 : target.map((item) => this.toTransKeyCase(item, method));
124
+ }
125
+ if (this.isObject(target)) {
126
+ return Object.keys(target).reduce((acc, key) => {
127
+ const finalKey = this.transKey(key, method);
128
+ acc[finalKey] = (ignoreKeyValues === null || ignoreKeyValues === void 0 ? void 0 : ignoreKeyValues.includes(key))
129
+ ? target[key]
130
+ : this.toTransKeyCase(target[key], method);
131
+ return acc;
132
+ }, result);
133
+ }
134
+ return target;
135
+ }
136
+ /** 转换字符串首字母大小写 */
137
+ transKey(str, method) {
138
+ const firstChar = method === 'toLowerCase'
139
+ ? str.charAt(0).toLowerCase()
140
+ : str.charAt(0).toUpperCase();
141
+ return `${firstChar}${str.slice(1)}`;
142
+ }
143
+ isArray(value) {
144
+ return Array.isArray(value);
145
+ }
146
+ isObject(value) {
147
+ return Object.prototype.toString.call(value) === '[object Object]';
148
+ }
149
+ }
@@ -27,8 +27,7 @@ G6.Tooltip.prototype.showTooltip = function (e) {
27
27
  }
28
28
  this.updatePosition(e);
29
29
  };
30
- // eslint-disable-next-line react/display-name
31
- export const RenderProcess = React.forwardRef((props) => {
30
+ export const RenderProcess = (props) => {
32
31
  const { commonFlowData, flowLocalProps } = props;
33
32
  const { flowDetail } = commonFlowData;
34
33
  const { isWedaIde, callWedaApi, safeJsonParse } = flowLocalProps;
@@ -299,4 +298,4 @@ export const RenderProcess = React.forwardRef((props) => {
299
298
  React.createElement("span", { className: "ProcessInfo-modal_content-content" }, content)))))),
300
299
  React.createElement(Modal.Footer, null,
301
300
  React.createElement(Button, { type: "weak", onClick: closeModal }, "\u5173\u95ED")))));
302
- });
301
+ };
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import Tabs from '../../../tabs';
3
3
  import ModelFlowBasic from '../basic';
4
4
  import ModelFlowChart from '../chart';
5
- import ModelFlowControl from '../control';
5
+ import ModelFlowControl from '../operations';
6
6
  import ModelFlowLayout from '../layout';
7
7
  import ModelFlowProcess from '../process';
8
8
  const ModelFlow = (props) => {
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { Button } from 'tea-component';
3
+ import { IconFont } from 'tdesign-icons-react';
4
+ import './style.css';
5
+ /** 流程相关动作的触发按钮 */
6
+ export function FlowButton(props) {
7
+ const { buttonIcon, className, ...buttonProps } = props;
8
+ return (React.createElement(Button, { ...buttonProps, className: `weda-flow-button ${className}` },
9
+ buttonIcon ? React.createElement(IconFont, { name: buttonIcon }) : null,
10
+ props.children));
11
+ }
@@ -0,0 +1,5 @@
1
+ .weda-flow-button .t-icon {
2
+ position: relative;
3
+ bottom: 1.5px;
4
+ right: 2px;
5
+ }
@@ -0,0 +1,6 @@
1
+ import { FlowUserSelect, FlowUserSelectBtn } from './user-select';
2
+ import { FlowPopup } from './popup';
3
+ import { FlowButton } from './button';
4
+ export * from './user-select/types';
5
+ export * from './popup/types';
6
+ export { FlowUserSelect, FlowUserSelectBtn, FlowPopup, FlowButton };
@@ -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
+ }