@cloudbase/weda-ui 3.4.11 → 3.4.12

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 (150) hide show
  1. package/dist/configs/components/common/form-input-required.js +3 -3
  2. package/dist/configs/components/customer-service.js +3 -0
  3. package/dist/configs/components/dataView.js +20 -10
  4. package/dist/configs/components/form-checkbox.js +15 -2
  5. package/dist/configs/components/form-email.js +17 -2
  6. package/dist/configs/components/form-input.js +17 -2
  7. package/dist/configs/components/form-phone.js +17 -2
  8. package/dist/configs/components/form-radio.js +15 -2
  9. package/dist/configs/components/form-select-multiple.js +362 -0
  10. package/dist/configs/components/form-switch.js +15 -2
  11. package/dist/configs/components/form-text-area.js +15 -2
  12. package/dist/configs/components/form-url.js +17 -2
  13. package/dist/configs/components/form-user-tree-select.js +13 -0
  14. package/dist/configs/components/listView.js +32 -49
  15. package/dist/configs/components/table.json +1 -54
  16. package/dist/configs/components/wd-bubble.js +46 -8
  17. package/dist/configs/components/wd-button.js +3 -0
  18. package/dist/configs/components/wd-checkbox.js +464 -0
  19. package/dist/configs/components/wd-form.js +66 -10
  20. package/dist/configs/components/wd-input-email.js +37 -0
  21. package/dist/configs/components/wd-input-phone.js +43 -0
  22. package/dist/configs/components/wd-input-url.js +37 -0
  23. package/dist/configs/components/wd-input.js +94 -0
  24. package/dist/configs/components/wd-official-account.js +87 -0
  25. package/dist/configs/components/wd-radio.js +443 -0
  26. package/dist/configs/components/wd-switch.js +315 -0
  27. package/dist/configs/components/wd-table.js +8 -56
  28. package/dist/configs/components/wd-textarea.js +82 -0
  29. package/dist/configs/components/wd-tree.js +443 -0
  30. package/dist/configs/components/web-view.js +3 -0
  31. package/dist/configs/index.js +24 -1
  32. package/dist/configs/type-utils/type-form.js +681 -0
  33. package/dist/docs/common/components/json-schema-view.js +1 -1
  34. package/dist/docs/common/components/methods-view.js +1 -1
  35. package/dist/docs/common/components/properties-view.js +3 -1
  36. package/dist/docs/common/format.js +7 -7
  37. package/dist/docs/common/tableView.js +3 -1
  38. package/dist/enum/index.js +196 -0
  39. package/dist/style/index.scss +1 -1
  40. package/dist/web/actions/showMessage/index.js +4 -1
  41. package/dist/web/components/carousel/index.js +1 -1
  42. package/dist/web/components/customer-service/customer-service.js +19 -2
  43. package/dist/web/components/dataView/index.js +16 -3
  44. package/dist/web/components/flow/common/hooks/useCommonFlowData/flow-get.js +5 -1
  45. package/dist/web/components/flow/common/request.js +5 -5
  46. package/dist/web/components/flow/modules/operations/controls-items/flow-task-info-modal.js +90 -0
  47. package/dist/web/components/form/formcell/index.css +13 -1
  48. package/dist/web/components/form/formcell/index.js +1 -1
  49. package/dist/web/components/form/location/components/LocationH5/location.h5.js +1 -1
  50. package/dist/web/components/form/select/dropdown-select/index.js +7 -1
  51. package/dist/web/components/form/select/h5.js +18 -8
  52. package/dist/web/components/form/select/index.js +9 -9
  53. package/dist/web/components/form/select/region/index.js +1 -1
  54. package/dist/web/components/form/selectMultiple/dropdown-select/h5.js +111 -0
  55. package/dist/web/components/form/selectMultiple/dropdown-select/index.css +270 -0
  56. package/dist/web/components/form/selectMultiple/dropdown-select/index.js +206 -0
  57. package/dist/web/components/form/selectMultiple/dropdown-select/pc.js +115 -0
  58. package/dist/web/components/form/selectMultiple/dropdown-select/ui.js +113 -0
  59. package/dist/web/components/form/selectMultiple/h5.js +40 -0
  60. package/dist/web/components/form/selectMultiple/index.js +94 -0
  61. package/dist/web/components/form/selectMultiple/request.js +76 -0
  62. package/dist/web/components/form/selectMultiple/status/allEmpty.js +5 -0
  63. package/dist/web/components/form/selectMultiple/status/empty.js +19 -0
  64. package/dist/web/components/form/selectMultiple/status/index.css +63 -0
  65. package/dist/web/components/form/selectMultiple/status/index.js +7 -0
  66. package/dist/web/components/form/selectMultiple/status/loading.js +19 -0
  67. package/dist/web/components/form/selectMultiple/status/propsType.js +1 -0
  68. package/dist/web/components/form/selectMultiple/status/retry.js +19 -0
  69. package/dist/web/components/form/tips/index.css +9 -3
  70. package/dist/web/components/form/uploader/index.css +10 -0
  71. package/dist/web/components/form/uploader/uploader.h5.js +60 -62
  72. package/dist/web/components/form/uploader/uploader.pc.js +48 -41
  73. package/dist/web/components/form/uploaderFile/uploadFile.h5.js +8 -33
  74. package/dist/web/components/form/uploaderFile/uploadFile.pc.js +8 -37
  75. package/dist/web/components/form/userOrgSelect/common/fetch-data-service.js +76 -50
  76. package/dist/web/components/form/userOrgSelect/common/utils.js +24 -8
  77. package/dist/web/components/form/userOrgSelect/component/depart-select/depart-select-pc.js +3 -8
  78. package/dist/web/components/form/userOrgSelect/component/depart-select/index.js +14 -18
  79. package/dist/web/components/form/userOrgSelect/component/depart-select/org-modal-pc.js +20 -14
  80. package/dist/web/components/form/userOrgSelect/component/modal-select-h5.js +1 -1
  81. package/dist/web/components/form/userOrgSelect/component/org-tree.js +21 -9
  82. package/dist/web/components/form/userOrgSelect/component/user-select-h5/index.js +57 -10
  83. package/dist/web/components/form/userOrgSelect/component/user-select-pc/user-model.js +2 -7
  84. package/dist/web/components/form/userOrgSelect/component/user-select-pc/user-select-pc.js +6 -4
  85. package/dist/web/components/form/userOrgSelect/component/userOrgSelect.css +8 -2
  86. package/dist/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.h5.js +25 -51
  87. package/dist/web/components/form/userOrgSelect/hooks/use-depart-data.js +3 -3
  88. package/dist/web/components/form-input-hooks/index.js +39 -14
  89. package/dist/web/components/form-select-multiple/index.js +26 -0
  90. package/dist/web/components/form-user-tree-select/index.js +2 -2
  91. package/dist/web/components/formdetail/index.css +31 -1
  92. package/dist/web/components/formdetail/index.js +30 -0
  93. package/dist/web/components/index.js +17 -1
  94. package/dist/web/components/listView/index.js +20 -5
  95. package/dist/web/components/phone/index.js +26 -1
  96. package/dist/web/components/phoneCode/index.js +3 -1
  97. package/dist/web/components/richText/index.css +70 -67
  98. package/dist/web/components/richText/index.js +311 -251
  99. package/dist/web/components/richText/richtext.module.css +1 -0
  100. package/dist/web/components/richTextView/index.css +39 -0
  101. package/dist/web/components/richTextView/index.js +1 -1
  102. package/dist/web/components/share/index.js +26 -1
  103. package/dist/web/components/wd-checkbox/checkbox.js +34 -0
  104. package/dist/web/components/wd-checkbox/index.js +3 -0
  105. package/dist/web/components/wd-checkbox-list/checkboxList.js +140 -0
  106. package/dist/web/components/wd-checkbox-list/index.js +3 -0
  107. package/dist/web/components/wd-form/index.js +25 -12
  108. package/dist/web/components/wd-form/wd-form.js +42 -0
  109. package/dist/web/components/wd-form-cell/index.js +3 -0
  110. package/dist/web/components/wd-form-cell/wd-form-cell.js +42 -0
  111. package/dist/web/components/wd-form-item/index.js +4 -0
  112. package/dist/web/components/wd-form-item/wd-form-item.js +55 -0
  113. package/dist/web/components/wd-form-item/wd-input-group.js +24 -0
  114. package/dist/web/components/wd-input/index.js +3 -0
  115. package/dist/web/components/wd-input/wd-input.js +155 -0
  116. package/dist/web/components/wd-input-email/index.js +3 -0
  117. package/dist/web/components/wd-input-email/wd-input-email.js +13 -0
  118. package/dist/web/components/wd-input-group/index.js +3 -0
  119. package/dist/web/components/wd-input-group/wd-input-group.js +10 -0
  120. package/dist/web/components/wd-input-phone/index.js +3 -0
  121. package/dist/web/components/wd-input-phone/wd-input-phone.js +14 -0
  122. package/dist/web/components/wd-input-url/index.js +3 -0
  123. package/dist/web/components/wd-input-url/wd-input-url.js +13 -0
  124. package/dist/web/components/wd-input-wrap/index.js +3 -0
  125. package/dist/web/components/wd-input-wrap/wd-input-wrap.js +18 -0
  126. package/dist/web/components/wd-official-account/index.css +29 -0
  127. package/dist/web/components/wd-official-account/index.js +36 -0
  128. package/dist/web/components/wd-radio/index.js +3 -0
  129. package/dist/web/components/wd-radio/wd-radio.js +30 -0
  130. package/dist/web/components/wd-radio-list/index.js +3 -0
  131. package/dist/web/components/wd-radio-list/wd-radio-list.js +104 -0
  132. package/dist/web/components/wd-switch/index.js +3 -0
  133. package/dist/web/components/wd-switch/wd-switch.js +52 -0
  134. package/dist/web/components/wd-table/components/FieldRender/index.js +5 -4
  135. package/dist/web/components/wd-table/components/Table/index.js +12 -2
  136. package/dist/web/components/wd-table/hooks/useQueryParams.js +4 -1
  137. package/dist/web/components/wd-table/utils/index.js +6 -2
  138. package/dist/web/components/wd-table/wd-table.js +70 -57
  139. package/dist/web/components/wd-textarea/index.js +3 -0
  140. package/dist/web/components/wd-textarea/wd-textarea.js +78 -0
  141. package/dist/web/components/wd-tree/index.js +3 -0
  142. package/dist/web/components/wd-tree/utils.js +291 -0
  143. package/dist/web/components/wd-tree/wd-tree.js +193 -0
  144. package/dist/web/utils/constant.js +16 -0
  145. package/dist/web/utils/datasource.js +2 -2
  146. package/dist/web/utils/date.js +3 -3
  147. package/dist/web/utils/hooks/useFormLegacy.js +111 -0
  148. package/dist/web/utils/tool.js +12 -2
  149. package/dist/web/weda-ui.css +193 -3
  150. package/package.json +6 -5
@@ -1,5 +1,5 @@
1
1
  import { isH5Platform } from '../../utils/platform';
2
- import { message } from 'tea-component';
2
+ import { message, setConfig } from 'tea-component';
3
3
  import './index.css';
4
4
  const iconType = {
5
5
  success: 'success',
@@ -24,6 +24,9 @@ export default function showMessage(props) {
24
24
  });
25
25
  }
26
26
  else {
27
+ setConfig({
28
+ classPrefix: 'wedatea2td',
29
+ });
27
30
  const realIcon = iconType[icon];
28
31
  const isNotShowIcon = realIcon === 'none' || !realIcon;
29
32
  message[isNotShowIcon ? 'success' : icon]({
@@ -28,7 +28,7 @@ export default function Carousel({ className, style, autoplay, circular, vertica
28
28
  }, interval);
29
29
  return () => clearInterval(timer);
30
30
  }
31
- }, [currentIndex, autoplay]);
31
+ }, [currentIndex, autoplay, itemCount]);
32
32
  // 触发切换
33
33
  const pre = useRef({ index: currentIndex }).current;
34
34
  useEffect(() => {
@@ -1,13 +1,30 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { forwardRef } from 'react';
2
+ import React, { forwardRef } from 'react';
3
3
  import { Bubble, ConfigProvider } from 'tea-component';
4
4
  import { emptyObject } from '../../utils/constant';
5
+ // @ts-ignore忽略ts交验
6
+ // eslint-disable-next-line rulesdir/no-phantom-deps,import/no-unresolved
7
+ import { autorun } from 'mobx';
5
8
  export const CustomerService = forwardRef(function CustomerService(props, ref) {
9
+ var _a, _b;
6
10
  const { id, className, style, events = emptyObject, } = props;
11
+ const [editorPlatforms, setEditorPlatforms] = React.useState([]);
12
+ const dispose = React.useMemo(() => {
13
+ return autorun(() => {
14
+ var _a, _b;
15
+ setEditorPlatforms((_b = (_a = window === null || window === void 0 ? void 0 : window.$w) === null || _a === void 0 ? void 0 : _a.wedaContext) === null || _b === void 0 ? void 0 : _b.editorPlatforms);
16
+ });
17
+ }, []);
18
+ React.useEffect(() => {
19
+ return () => {
20
+ dispose();
21
+ };
22
+ }, [dispose]);
7
23
  // 方法
8
24
  const onClick = (e) => {
9
25
  var _a;
10
26
  (_a = events === null || events === void 0 ? void 0 : events.tap) === null || _a === void 0 ? void 0 : _a.call(events, {}, { originEvent: e });
11
27
  };
12
- return (_jsx(ConfigProvider, { classPrefix: "wedatea2td", children: _jsx(Bubble, { placement: "auto", openDelay: 300, content: "\u7F16\u8F91\u5668\u6682\u4E0D\u652F\u6301\u6253\u5F00\u5BA2\u670D\u4F1A\u8BDD\uFF0C\u8BF7\u53D1\u5E03\u5C0F\u7A0B\u5E8F\u540E\u4F7F\u7528\u771F\u673A\u8C03\u8BD5\u3002PC/H5\u7AEF\u5C06\u9690\u85CF\u8BE5\u7EC4\u4EF6\uFF0C\u8BF7\u6CE8\u610F\u9875\u9762\u5E03\u5C40\u3002", children: _jsx("div", { id: id, className: className, style: style, onClick: onClick, "data-role": "wd-customer-service", ref: ref, children: props.children }) }) }));
28
+ return (_jsx(ConfigProvider, { classPrefix: "wedatea2td", children: ((_b = (_a = window.$w) === null || _a === void 0 ? void 0 : _a.wedaContext) === null || _b === void 0 ? void 0 : _b.isEditorMode) ||
29
+ (editorPlatforms === null || editorPlatforms === void 0 ? void 0 : editorPlatforms.includes('MP')) ? (_jsx(Bubble, { placement: "auto", openDelay: 300, content: "\u7F16\u8F91\u5668\u6682\u4E0D\u652F\u6301\u6253\u5F00\u5BA2\u670D\u4F1A\u8BDD\uFF0C\u8BF7\u53D1\u5E03\u5C0F\u7A0B\u5E8F\u540E\u4F7F\u7528\u771F\u673A\u8C03\u8BD5\u3002PC/H5\u7AEF\u5C06\u9690\u85CF\u8BE5\u7EC4\u4EF6\uFF0C\u8BF7\u6CE8\u610F\u9875\u9762\u5E03\u5C40\u3002", children: _jsx("div", { id: id, className: className, style: style, onClick: onClick, "data-role": "wd-customer-service", ref: ref, children: props.children }) })) : null }));
13
30
  });
@@ -1,12 +1,25 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import React from 'react';
2
+ import React, { useCallback, useImperativeHandle, useState, useRef, } from 'react';
3
3
  import ListView from '../listView';
4
4
  import { useLoopRenderDetect } from '../common/use-loop-render-detect';
5
- const beforeDataChange = (values) => (values === null || values === void 0 ? void 0 : values[0]) || {};
6
5
  /**
7
6
  * 数据容器-列表视图
8
7
  */
9
8
  export default React.forwardRef(function DataView(props, ref) {
10
9
  useLoopRenderDetect({ limit: 600 });
11
- return (_jsx(ListView, { ...props, ref: ref, isRecords: false, orderBy: undefined, orderType: undefined, template: "none", pageSize: 1, pagination: "none", beforeDataChange: beforeDataChange }));
10
+ const listViewRef = useRef(null);
11
+ const [record, setRecord] = useState();
12
+ const beforeDataChange = useCallback((values) => {
13
+ const record = (values === null || values === void 0 ? void 0 : values[0]) || {};
14
+ setRecord(record);
15
+ return record;
16
+ }, []);
17
+ const refresh = useCallback(() => { var _a, _b; return (_b = (_a = listViewRef.current) === null || _a === void 0 ? void 0 : _a.refresh) === null || _b === void 0 ? void 0 : _b.call(_a); }, [listViewRef.current]);
18
+ const deleteOne = useCallback((params) => { var _a, _b; return (_b = (_a = listViewRef.current) === null || _a === void 0 ? void 0 : _a.deleteOne) === null || _b === void 0 ? void 0 : _b.call(_a, params); }, [listViewRef.current]);
19
+ useImperativeHandle(ref, () => ({ record, refresh, deleteOne }), [
20
+ record,
21
+ refresh,
22
+ deleteOne,
23
+ ]);
24
+ return (_jsx(ListView, { ...props, ref: listViewRef, isRecords: false, orderBy: undefined, orderType: undefined, template: "none", pageSize: 1, pagination: "none", beforeDataChange: beforeDataChange }));
12
25
  });
@@ -44,7 +44,11 @@ async function getApprovalPageDetail(processInstance, pageType) {
44
44
  pageType,
45
45
  taskId: processInstance === null || processInstance === void 0 ? void 0 : processInstance.taskId,
46
46
  },
47
- }, { previewData: getApprovalPageDetailPreviewData });
47
+ }, {
48
+ previewData: getApprovalPageDetailPreviewData,
49
+ // 这两个内部数据是动态的业务数据,不能进行首字母小写转换
50
+ lowerResultCaseIgnoreKeys: ['FieldValueMap', 'FieldValueMapList'],
51
+ });
48
52
  const { objectMap, objectListMap } = translateObjectLikeMap(result);
49
53
  return {
50
54
  approvalPageDetail: result,
@@ -5,28 +5,28 @@ import { isInIde } from './utils';
5
5
  * @description 基于callWedaApi 封装,主要是处理出入参大小写,以及预览数据
6
6
  */
7
7
  export async function flowRequest(params, config) {
8
- const { previewData, upperCaseData = true, upperCaseIgnoreKeys, lowerCaseResult = true, } = config || {};
8
+ const { previewData, upperCaseData = true, upperCaseIgnoreKeys, lowerCaseResult = true, lowerResultCaseIgnoreKeys, } = config || {};
9
9
  if (isInIde()) {
10
- return toTransKeyCase(previewData || {}, lowerCaseResult ? 'toLowerCase' : 'toUpperCase');
10
+ return toTransKeyCase(previewData || {}, lowerCaseResult ? 'toLowerCase' : 'toUpperCase', lowerResultCaseIgnoreKeys);
11
11
  }
12
12
  const result = await callWedaApi({
13
13
  ...params,
14
14
  data: toTransKeyCase(params.data, upperCaseData ? 'toUpperCase' : 'toLowerCase', upperCaseIgnoreKeys),
15
15
  });
16
- return toTransKeyCase(result, lowerCaseResult ? 'toLowerCase' : 'toUpperCase');
16
+ return toTransKeyCase(result, lowerCaseResult ? 'toLowerCase' : 'toUpperCase', lowerResultCaseIgnoreKeys);
17
17
  }
18
18
  /** 转换具体参数的首字母大小写 */
19
19
  function toTransKeyCase(target, method, ignoreKeyValues) {
20
20
  const result = {};
21
21
  if (isArray(target)) {
22
- return target === null || target === void 0 ? void 0 : target.map((item) => toTransKeyCase(item, method));
22
+ return target === null || target === void 0 ? void 0 : target.map((item) => toTransKeyCase(item, method, ignoreKeyValues));
23
23
  }
24
24
  if (isObject(target)) {
25
25
  return Object.keys(target).reduce((acc, key) => {
26
26
  const finalKey = transKey(key, method);
27
27
  acc[finalKey] = (ignoreKeyValues === null || ignoreKeyValues === void 0 ? void 0 : ignoreKeyValues.includes(key))
28
28
  ? target[key]
29
- : toTransKeyCase(target[key], method);
29
+ : toTransKeyCase(target[key], method, ignoreKeyValues);
30
30
  return acc;
31
31
  }, result);
32
32
  }
@@ -0,0 +1,90 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useRef, useEffect, useState } from 'react';
3
+ import { Modal, SelectMultiple, Button, Form, Checkbox } from 'tea-component';
4
+ import { flowRequest } from '../../../common';
5
+ import { FlowCheckListPopup } from './check-list-popup';
6
+ /**
7
+ * 选择下一节点审批人弹窗
8
+ */
9
+ export const FlowTaskInfoModal = (props) => {
10
+ const { isH5, visible, flowTaskInfoList, selectedTaskIds, setSelectedTaskIds, onSubmitTaskIds, } = useFlowTaskInfoModel(props);
11
+ const options = flowTaskInfoList.map((item) => ({
12
+ text: item === null || item === void 0 ? void 0 : item.assigneeName,
13
+ value: item === null || item === void 0 ? void 0 : item.waitFlowTaskId,
14
+ }));
15
+ const renderModal = () => {
16
+ return (_jsxs(Modal, { visible: visible, caption: props.label, onClose: () => onSubmitTaskIds(), size: "auto", children: [_jsx(Modal.Body, { children: _jsx(Form, { style: { marginBottom: '5px' }, children: _jsx(Form.Item, { label: "\u9009\u62E9\u5904\u7406\u4EBA", children: _jsx(SelectMultiple, { searchable: true, matchButtonWidth: true, appearance: "button", size: "full", style: { width: 300 }, staging: false, options: options, value: selectedTaskIds, onChange: (value) => setSelectedTaskIds(value) }) }) }) }), _jsxs(Modal.Footer, { children: [_jsx(Button, { type: "primary", onClick: () => onSubmitTaskIds(false), disabled: !selectedTaskIds.length, children: "\u786E\u5B9A" }), _jsx(Button, { type: "weak", onClick: () => onSubmitTaskIds(), children: "\u53D6\u6D88" })] })] }));
17
+ };
18
+ const renderPopup = () => {
19
+ return (_jsx(FlowCheckListPopup, { visible: visible, onClose: () => onSubmitTaskIds(), title: props.label, overlayStyle: { zIndex: 998 }, height: 550, confirmButtonProps: {
20
+ disabled: !selectedTaskIds.length,
21
+ onClick: () => onSubmitTaskIds(false),
22
+ }, children: _jsx(Checkbox.Group, { value: selectedTaskIds, onChange: (value) => setSelectedTaskIds(value), layout: "column", children: options.map((option) => (_jsx(Checkbox, { name: option.value, children: option.text }, option.value))) }) }));
23
+ };
24
+ return _jsxs(_Fragment, { children: [" ", isH5 ? renderPopup() : renderModal()] });
25
+ };
26
+ /** 下一节点审批人model */
27
+ function useFlowTaskInfoModel(params) {
28
+ const { isH5 } = params.flowModulesProps;
29
+ const { onAfterFinishFlowAction } = params.flowControlModel;
30
+ /** 弹框是否可见 */
31
+ const [visible, setVisible] = useState(false);
32
+ /** 审批人列表 */
33
+ const [flowTaskInfoList, setFlowTaskInfoList] = useState([]);
34
+ /** 已选任务数组 */
35
+ const [selectedTaskIds, setSelectedTaskIds] = useState([]);
36
+ const timer = useRef(null);
37
+ useEffect(() => {
38
+ return () => {
39
+ cleanTiming();
40
+ };
41
+ }, []);
42
+ useEffect(() => {
43
+ if (params.flowControlModel.triggerFlowTaskInfo) {
44
+ const { toBeSubmittedFlowTaskInfo } = params.flowControlModel.triggerFlowTaskInfo || {};
45
+ setVisible(true);
46
+ setFlowTaskInfoList(toBeSubmittedFlowTaskInfo || []);
47
+ timingSubmit();
48
+ }
49
+ // eslint-disable-next-line react-hooks/exhaustive-deps
50
+ }, [params.flowControlModel.triggerFlowTaskInfo]);
51
+ const cleanTiming = () => {
52
+ clearTimeout(timer.current);
53
+ };
54
+ /** 审批人列表提交 */
55
+ const submitFlowTaskList = async (flowTaskIds) => {
56
+ const result = await flowRequest({
57
+ action: 'SubmitFlowTaskList',
58
+ data: { flowTaskIds },
59
+ });
60
+ if (result === null || result === void 0 ? void 0 : result.status) {
61
+ setVisible(false);
62
+ setSelectedTaskIds([]);
63
+ cleanTiming();
64
+ // 执行完成后自定义动作
65
+ onAfterFinishFlowAction(params.actionKey, params.afterAction);
66
+ }
67
+ };
68
+ /** 定时提交 */
69
+ const timingSubmit = () => {
70
+ // eslint-disable-next-line rulesdir/no-timer
71
+ timer.current = setTimeout(() => {
72
+ submitFlowTaskList();
73
+ }, 600000);
74
+ };
75
+ /** 提交按钮动作 */
76
+ const onSubmitTaskIds = (isCancel = true) => {
77
+ const taskIds = isCancel
78
+ ? flowTaskInfoList.map((i) => i === null || i === void 0 ? void 0 : i.waitFlowTaskId)
79
+ : selectedTaskIds;
80
+ submitFlowTaskList(taskIds);
81
+ };
82
+ return {
83
+ isH5,
84
+ selectedTaskIds,
85
+ visible,
86
+ flowTaskInfoList,
87
+ setSelectedTaskIds,
88
+ onSubmitTaskIds,
89
+ };
90
+ }
@@ -35,7 +35,9 @@
35
35
  }
36
36
 
37
37
  /* formcell 在 form container 外部兼容 and 独立 layout 适配 */
38
-
38
+ .weda-formcells__pc.weda-formcells__full-width.vertical {
39
+ display: block;
40
+ }
39
41
  .weda-formcells__pc.vertical .wedatea2td-form__controls,
40
42
  .weda-formcells__pc.vertical .wedatea2td-form__label {
41
43
  display: block;
@@ -90,6 +92,16 @@
90
92
  width: 98px;
91
93
  }
92
94
 
95
+ .weda-formcells__pc.horizontal .wedatea2td-form__label.is-required label:after,
96
+ .weda-formcells__pc.vertical .wedatea2td-form__label.is-required label:after {
97
+ display: inline-block;
98
+ content: '*';
99
+ color: #e54545;
100
+ line-height: 1;
101
+ position: relative;
102
+ margin: 3px 0 0 3px;
103
+ }
104
+
93
105
  /*formcell*/
94
106
 
95
107
  .weda-formcells__full-width .wedatea2td-form__controls {
@@ -27,7 +27,7 @@ export default function FormCell({ className, style, label, layout, children, mu
27
27
  'weda-formcells__label': true,
28
28
  // 标题也采用使用weui-cell的样式
29
29
  'weui-cell': true,
30
- }), children: [_jsx("label", { children: label }), requiredFlag ? (_jsx("label", { className: "weda-formcells__flag", children: "*" })) : null] })) : null, _jsx("div", { className: classNames({
30
+ }), children: [requiredFlag ? (_jsx("label", { className: "weda-formcells__flag", children: "*" })) : null, _jsx("label", { children: label })] })) : null, _jsx("div", { className: classNames({
31
31
  'weda-formcells__content': true,
32
32
  'weui-flex__item': isFlex,
33
33
  }), children: children })] }) }));
@@ -293,7 +293,7 @@ export default function LocationH5(props) {
293
293
  }
294
294
  return status;
295
295
  };
296
- const LocationEl = (_jsxs("div", { className: "form-location weda-ui_form-location", "data-testid": "form-location", children: [_jsxs("div", { className: `form-location-warp ${styles.locationDisabled}`, style: { display: layout === 'vertical' ? 'block' : 'flex' }, children: [labelVisible && (_jsxs("div", { className: "form-location-label", children: [_jsx("label", { children: label }), requiredFlag && _jsx("span", { children: "*" })] })), _jsxs("div", { className: classNames({
296
+ const LocationEl = (_jsxs("div", { className: "form-location weda-ui_form-location", "data-testid": "form-location", children: [_jsxs("div", { className: `form-location-warp ${styles.locationDisabled}`, style: { display: layout === 'vertical' ? 'block' : 'flex' }, children: [labelVisible && (_jsxs("div", { className: "form-location-label weda-formcells__label weui-cell", children: [requiredFlag && _jsx("span", { className: "weda-formcells__flag", children: "*" }), _jsx("label", { children: label })] })), _jsxs("div", { className: classNames({
297
297
  'form-location-con': true,
298
298
  [styles.locationContent]: true,
299
299
  'form-location-con_vertical': layout === 'vertical',
@@ -118,7 +118,7 @@ export function PureSelect({ params, selectedValue, updateValue, placeholder, si
118
118
  const option = isSearch ? searchOptions : options;
119
119
  return platform === 'h5' ? option : transFormatTeaSelectKey(option);
120
120
  }, [isSearch, searchOptions, options, platform]);
121
- useEffect(() => {
121
+ const handleSearch = () => {
122
122
  // 本地搜索
123
123
  if (!isTurnPages || options.length < PAGE_SIZE) {
124
124
  const searchOpt = options.filter((item) => {
@@ -145,6 +145,9 @@ export function PureSelect({ params, selectedValue, updateValue, placeholder, si
145
145
  }, 1000);
146
146
  return () => clearTimeout(timer);
147
147
  }
148
+ };
149
+ useEffect(() => {
150
+ handleSearch();
148
151
  }, [searchValue]);
149
152
  // 加载更多
150
153
  const loadMore = () => {
@@ -184,6 +187,9 @@ export function PureSelect({ params, selectedValue, updateValue, placeholder, si
184
187
  setSearchStatus(Status.LOADING);
185
188
  setSearchOptions([]);
186
189
  setSearchValue(value);
190
+ if (value == searchValue) {
191
+ handleSearch();
192
+ }
187
193
  };
188
194
  /**
189
195
  * 精确查找
@@ -101,17 +101,18 @@ defaultRegion, defaultMutiRegion, separator, regionType, onChange, }) {
101
101
  if (mode == 'region' || mode == 'mutiRegion') {
102
102
  if (regionData.length < 1) {
103
103
  getAreaCode().then((value) => {
104
- defaultMutiRegionChange(value, defaultMutiRegion);
105
- setRegionData(value);
106
- getRegionTree(value, regionType, mode).then((tree) => {
104
+ var _a;
105
+ if (((_a = value === null || value === void 0 ? void 0 : value.length) !== null && _a !== void 0 ? _a : 0) > 0) {
106
+ defaultMutiRegionChange(value, defaultMutiRegion);
107
+ setRegionData(value);
108
+ const tree = getRegionTree(value, regionType, mode);
107
109
  setRegionTree(tree);
108
- });
110
+ }
109
111
  });
110
112
  }
111
113
  else {
112
- getRegionTree(regionData, regionType, mode).then((tree) => {
113
- setRegionTree(tree);
114
- });
114
+ const tree = getRegionTree(regionData, regionType, mode);
115
+ setRegionTree(tree);
115
116
  }
116
117
  }
117
118
  switch (regionType) {
@@ -164,7 +165,16 @@ defaultRegion, defaultMutiRegion, separator, regionType, onChange, }) {
164
165
  }
165
166
  else if (dateMode === 'day') {
166
167
  // 年月日,3 列
167
- weui.datePicker({ id: String(Date.now()), ...options });
168
+ let defaultValue = null;
169
+ if (date) {
170
+ const dayDate = new Date(getIOSNotNaNDate(date));
171
+ defaultValue = [
172
+ dayDate.getFullYear(),
173
+ dayDate.getMonth() + 1,
174
+ dayDate.getDate(),
175
+ ];
176
+ }
177
+ weui.datePicker({ id: String(Date.now()), ...options, defaultValue });
168
178
  }
169
179
  else {
170
180
  // 年月日时分秒,4列
@@ -138,21 +138,21 @@ function SelectPc({ name, where, dataSourceName, viewId, format, primaryField, e
138
138
  if (mode == 'region' || mode == 'mutiRegion') {
139
139
  if (regionData.length < 1) {
140
140
  getAreaCode().then((value) => {
141
- setRegionData(value);
142
- getRegionTree(value, regionType, mode).then((tree) => {
141
+ var _a;
142
+ if (((_a = value === null || value === void 0 ? void 0 : value.length) !== null && _a !== void 0 ? _a : 0) > 0) {
143
+ setRegionData(value);
144
+ const tree = getRegionTree(value, regionType, mode);
143
145
  setRegionTree(tree);
144
- });
146
+ }
145
147
  });
146
148
  }
147
149
  else {
148
- getRegionTree(regionData, regionType, mode).then((tree) => {
149
- setRegionTree(tree);
150
- });
150
+ const tree = getRegionTree(regionData, regionType, mode);
151
+ setRegionTree(tree);
151
152
  }
152
153
  }
153
- getRegionTree(regionData, regionType, mode).then((value) => {
154
- setRegionTree(value);
155
- });
154
+ const value = getRegionTree(regionData, regionType, mode);
155
+ setRegionTree(value);
156
156
  }, [regionType, mode, regionData]);
157
157
  const onDataChange = (value) => {
158
158
  var _a;
@@ -1,7 +1,7 @@
1
1
  import weui from '../../../../utils/weui';
2
2
  import { callWedaApi } from '../../../../utils/tcb';
3
3
  let tree;
4
- export async function getRegionTree(regionData, regionType, regionMode) {
4
+ export function getRegionTree(regionData, regionType, regionMode) {
5
5
  tree = [];
6
6
  tree = formatTreeData(regionData, regionType, regionMode);
7
7
  return tree;
@@ -0,0 +1,111 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useRef, useState } from 'react';
3
+ import { Portal } from '../../../common/portal';
4
+ import './index.css';
5
+ import { Status } from '../status';
6
+ import Loading from '../status/loading';
7
+ import Retry from '../status/retry';
8
+ import Empty from '../status/empty';
9
+ import AllEmpty from '../status/allEmpty';
10
+ import { PAGE_SIZE } from '../request';
11
+ import { alertErrorMessage } from '../../../../utils/platform';
12
+ export function SelectPickerH5({ updateValue, selectedValue, options, isTurnPages, loadMore, onSearchValue, reTry, status, isShow, getIsShow, }) {
13
+ const focusRef = useRef();
14
+ const contentRef = useRef();
15
+ const heightRef = useRef(0);
16
+ const indexRef = useRef(1);
17
+ const [inputFocus, setInputFocus] = useState(false);
18
+ const [searchValue, setSearchValue] = useState('');
19
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
20
+ const [ind, setInd] = useState(0);
21
+ const checkIndex = (param) => {
22
+ if (selectedValue) {
23
+ const check = selectedValue.find((item) => item === param.value);
24
+ return !!check;
25
+ }
26
+ else {
27
+ return false;
28
+ }
29
+ };
30
+ useEffect(() => {
31
+ if (isShow) {
32
+ onSearchValue(searchValue);
33
+ }
34
+ else {
35
+ onSearchValue('');
36
+ }
37
+ }, [searchValue, isShow]);
38
+ const clear = () => {
39
+ setInputFocus(false);
40
+ setSearchValue('');
41
+ updateValue(undefined);
42
+ getIsShow();
43
+ };
44
+ const confirm = () => {
45
+ getIsShow();
46
+ };
47
+ const contentScroll = () => {
48
+ if (status !== Status.LOADING || !isTurnPages) {
49
+ return;
50
+ }
51
+ const item = contentRef.current.children.item(0);
52
+ if (!item) {
53
+ return;
54
+ }
55
+ if (heightRef.current === 0) {
56
+ const length = options.length + (status === Status.FINISH ? 0 : 1);
57
+ heightRef.current = item.scrollHeight / length;
58
+ }
59
+ const index = Math.ceil((item.scrollTop + item.clientHeight) / heightRef.current);
60
+ // 过滤重复数据
61
+ if (indexRef.current === index) {
62
+ return;
63
+ }
64
+ indexRef.current = index;
65
+ // 到底了,加载更多
66
+ // -20标识提前20条数据加载,||后面条件为保底条件,防止前面触发不了
67
+ if (options.length >= PAGE_SIZE &&
68
+ ((index + 20) % PAGE_SIZE === 0 || options.length + 1 <= index) &&
69
+ status === Status.LOADING) {
70
+ loadMore();
71
+ }
72
+ };
73
+ return isShow ? (_jsx(Portal, { type: "div", children: _jsxs("div", { className: "weda-ui-custom-picker", children: [_jsx("div", { className: "weda-ui-custom-backdrop", onClick: () => {
74
+ setInputFocus(false);
75
+ setSearchValue('');
76
+ // confirm();
77
+ } }), _jsxs("div", { className: "weda-ui-custom-picker__inner", style: inputFocus ? { height: 'calc(100vh - 96px)' } : null, children: [!inputFocus && (_jsxs("div", { className: "weda-ui-custom-picker__header", children: [_jsx("div", { className: "weda-ui-custom-picker__header-cancle", onClick: clear, children: "\u6E05\u7A7A" }), _jsx("div", { className: "weda-ui-custom-picker__header-confirm", onClick: confirm, children: "\u786E\u5B9A" })] })), _jsxs("div", { className: "weda-ui-custom-picker__body", children: [_jsxs("div", { style: { margin: inputFocus ? '16px 16px 8px 16px' : '8px 16px' }, className: `weda-ui-custom-search
78
+ ${inputFocus ? 'is-focused' : ''}`, children: [_jsxs("div", { className: "weda-ui-custom-search-box ", onClick: () => {
79
+ setInputFocus(true);
80
+ }, children: [inputFocus ? (_jsx("input", { className: "weda-ui-input", ref: focusRef, value: searchValue, autoFocus: true, onChange: (e) => setSearchValue(e.target.value) })) : (
81
+ // 此处主要为了兼容 iOS
82
+ _jsx("div", { className: "weda-ui-input" })), _jsxs("div", { className: `weda-ui-custom-search-box__label multiple`, children: [_jsx("span", { className: "weda-ui-custom-search-box__search-icon " }), _jsx("span", { className: "weda-ui-custom-search-box__search-placeholder", children: "\u641C\u7D22" })] }), inputFocus && searchValue !== '' && (_jsx("span", { className: "weda-ui-custom-search-box__dismiss-icon", onClick: () => setSearchValue('') }))] }), _jsx("button", { className: "weda-ui-custom-search__btn-cancle", onClick: () => {
83
+ setInputFocus(false);
84
+ setSearchValue('');
85
+ }, children: "\u53D6\u6D88" })] }), status === Status.ALl_EMPTY ? (_jsx(AllEmpty, { height: inputFocus ? 'calc(100vh - 160px)' : '280px' })) : (_jsx("div", { className: "weda-ui-custom-picker__cloumns weda-ui-custom-picker__cloumns--select-multiple ", style: {
86
+ height: inputFocus ? 'calc(100vh - 160px)' : '280px',
87
+ }, onScroll: contentScroll, ref: contentRef, children: _jsxs("ul", { className: "weda-ui-custom-picker__cloumn", style: {
88
+ height: inputFocus ? 'calc(100vh - 190px)' : '250px',
89
+ }, children: [options === null || options === void 0 ? void 0 : options.map((item, index) => {
90
+ return (_jsx("li", {
91
+ // is-selected 选中态
92
+ // is-disabled 禁用态
93
+ className: `weda-ui-custom-picker__cloumn-item ${checkIndex(item) ? 'is-selected' : ''} ${index === -1 ? 'is-disabled' : ''}`, onClick: () => {
94
+ if (selectedValue && selectedValue.length > 49) {
95
+ if (selectedValue.indexOf(item.value) !== -1) {
96
+ updateValue(item);
97
+ setInd(Math.random());
98
+ }
99
+ else {
100
+ alertErrorMessage({
101
+ message: '最多选择50条数据',
102
+ });
103
+ }
104
+ }
105
+ else {
106
+ updateValue(item);
107
+ setInd(Math.random());
108
+ }
109
+ }, children: _jsx("p", { className: 'weda-ui-custom-picker__cloumn-item-text-multiple', children: item.label }) }, index));
110
+ }), status === Status.LOADING && (_jsx("li", { children: _jsx(Loading, {}) }, 'loading')), status === Status.ERROR && (_jsx("li", { children: _jsx(Retry, { reTry: reTry }) }, 'retry')), status === Status.EMPTY && (_jsx("li", { children: _jsx(Empty, {}) }, 'empty'))] }) }))] })] })] }) })) : null;
111
+ }