@cloudbase/weda-ui 3.3.2 → 3.3.4

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 (54) hide show
  1. package/dist/web/components/calendar/index.js +37 -39
  2. package/dist/web/components/carousel/index.js +62 -62
  3. package/dist/web/components/chart/bar/index.js +0 -4
  4. package/dist/web/components/chart/common/Chart.d.ts +0 -1
  5. package/dist/web/components/chart/common/Chart.js +1 -9
  6. package/dist/web/components/chart/common/chart-custom-connector.js +1 -1
  7. package/dist/web/components/chart/common/core/eChartBase.js +1 -1
  8. package/dist/web/components/chart/common/data-transform.js +1 -1
  9. package/dist/web/components/chart/common/useChart.js +2 -11
  10. package/dist/web/components/common/use-loop-render-detect.d.ts +2 -2
  11. package/dist/web/components/common/use-loop-render-detect.js +7 -9
  12. package/dist/web/components/form/checkbox/index.js +29 -29
  13. package/dist/web/components/form/enumSelect/MultipleSelect.d.ts +2 -2
  14. package/dist/web/components/form/enumSelect/NormalSelect.d.ts +2 -2
  15. package/dist/web/components/form/enumSelect/index.d.ts +2 -2
  16. package/dist/web/components/form/enumSelect/props/propsTypes.d.ts +2 -2
  17. package/dist/web/components/form/form/index.js +1 -3
  18. package/dist/web/components/form/location/common/mapChoose.js +9 -10
  19. package/dist/web/components/form/location/common/mapView.js +1 -4
  20. package/dist/web/components/form/location/common/propsConfig.d.ts +1 -1
  21. package/dist/web/components/form/location/common/useLocationInfo.d.ts +1 -1
  22. package/dist/web/components/form/location/components/LocationPC/location.PC.js +0 -4
  23. package/dist/web/components/form/radio/index.js +3 -3
  24. package/dist/web/components/form/select/allTimePicker/index.js +0 -1
  25. package/dist/web/components/form/select/h5.js +4 -18
  26. package/dist/web/components/form/select/index.js +1 -8
  27. package/dist/web/components/form/select/use-options.js +1 -1
  28. package/dist/web/components/form/uploader/uploader.h5.js +8 -7
  29. package/dist/web/components/form/uploader/uploader.pc.d.ts +1 -0
  30. package/dist/web/components/form/uploader/uploader.pc.js +17 -4
  31. package/dist/web/components/form/uploaderFile/uploadFile.h5.js +7 -9
  32. package/dist/web/components/form/uploaderFile/uploadFile.pc.js +6 -9
  33. package/dist/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.pc.js +6 -7
  34. package/dist/web/components/form/userOrgSelect/userOrgSelect.css +17 -3
  35. package/dist/web/components/form/userOrgSelect/userTreeSelect.pc.js +6 -7
  36. package/dist/web/components/formdetail/index.js +10 -12
  37. package/dist/web/components/graphicCard/index.js +6 -5
  38. package/dist/web/components/image/index.js +1 -1
  39. package/dist/web/components/listView/index.js +0 -1
  40. package/dist/web/components/lottery/index.js +16 -10
  41. package/dist/web/components/navLayout/index.js +1 -1
  42. package/dist/web/components/navigationBar/horizontalMenu.js +1 -1
  43. package/dist/web/components/richText/index.js +2 -1
  44. package/dist/web/components/richTextView/index.js +18 -20
  45. package/dist/web/components/scrollView/index.d.ts +0 -1
  46. package/dist/web/components/scrollView/index.js +4 -6
  47. package/dist/web/components/swiper/index.js +62 -62
  48. package/dist/web/components/text/index.js +8 -10
  49. package/dist/web/components/uploaderView/index.js +1 -1
  50. package/dist/web/components/wedaVideo/index.js +2 -14
  51. package/dist/web/{components/form/location/common → utils}/tmap.d.ts +0 -0
  52. package/dist/web/{components/form/location/common → utils}/tmap.js +0 -0
  53. package/dist/web/utils/useSyncValue.js +0 -1
  54. package/package.json +20 -20
@@ -1,11 +1,10 @@
1
- /* eslint-disable react-hooks/exhaustive-deps */
2
1
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
3
2
  // @ts-nocheck
4
3
  import * as React from 'react';
5
4
  import classNames from '../../../../utils/classnames';
6
5
  import debounce from '../../../../utils/debounce';
7
6
  import { tmapApiUrl } from '../constants';
8
- import { getTMap, calculateDistance, base64LocationIcon } from './tmap';
7
+ import { getTMap, calculateDistance, base64LocationIcon, } from '../../../../utils/tmap';
9
8
  import './mapChoose.css';
10
9
  import { Icon } from 'tea-component';
11
10
  const { useEffect, useState, useRef, useMemo } = React;
@@ -32,7 +31,7 @@ export default function MapChoose({ changeLocation, onConfirm, onClose, currentL
32
31
  });
33
32
  const [exploreList, setExploreList] = useState([]);
34
33
  const [searchList, setSearchList] = useState([]);
35
- const mapDomName = Date.now();
34
+ const mapDomName = useRef(new Date().getTime());
36
35
  const clientHeight = useMemo(() => document.documentElement.clientHeight, []);
37
36
  const [mapBoxHeight, setMapBoxHeight] = useState(clientHeight - 328);
38
37
  const [searchLoadingStatus, setSearchLoadingStatus] = useState(false);
@@ -80,7 +79,7 @@ export default function MapChoose({ changeLocation, onConfirm, onClose, currentL
80
79
  //定义地图中心点坐标
81
80
  const center = new TMap.LatLng(lat, lng);
82
81
  //定义map变量,调用 TMap.Map() 构造函数创建地图
83
- mapRef.current = new TMap.Map(document.getElementById(`form-map-choose-${mapDomName}`), {
82
+ mapRef.current = new TMap.Map(document.getElementById(`form-map-choose-${mapDomName.current}`), {
84
83
  center,
85
84
  zoom: 16, //设置地图缩放级别
86
85
  });
@@ -112,12 +111,12 @@ export default function MapChoose({ changeLocation, onConfirm, onClose, currentL
112
111
  },
113
112
  geometries: [
114
113
  {
115
- id: `pointer-origin-${mapDomName}`,
114
+ id: `pointer-origin-${mapDomName.current}`,
116
115
  styleId: 'originPointer',
117
116
  position: currentLocationsPosition,
118
117
  },
119
118
  {
120
- id: `pointer-${mapDomName}`,
119
+ id: `pointer-${mapDomName.current}`,
121
120
  styleId: 'pointer',
122
121
  position,
123
122
  },
@@ -161,7 +160,7 @@ export default function MapChoose({ changeLocation, onConfirm, onClose, currentL
161
160
  centerRef.current = centerPosition;
162
161
  markerRef.current.updateGeometries([
163
162
  {
164
- id: `pointer-${mapDomName}`,
163
+ id: `pointer-${mapDomName.current}`,
165
164
  styleId: 'pointer',
166
165
  position: mapRef.current.getCenter(),
167
166
  },
@@ -283,7 +282,7 @@ export default function MapChoose({ changeLocation, onConfirm, onClose, currentL
283
282
  mapRef.current.setCenter(center);
284
283
  markerRef.current.updateGeometries([
285
284
  {
286
- id: `pointer-${mapDomName}`,
285
+ id: `pointer-${mapDomName.current}`,
287
286
  styleId: 'pointer',
288
287
  position: center,
289
288
  },
@@ -337,7 +336,7 @@ export default function MapChoose({ changeLocation, onConfirm, onClose, currentL
337
336
  changeSearchBoxHeight(false);
338
337
  };
339
338
  const renderMapView = () => {
340
- return (React.createElement("div", { id: `form-map-choose-${mapDomName}`, style: { height: '100%', width: '100%', position: 'relative' } },
339
+ return (React.createElement("div", { id: `form-map-choose-${mapDomName.current}`, style: { height: '100%', width: '100%', position: 'relative' } },
341
340
  React.createElement("div", { className: "weda-ui_mapChoose_map_control", onClick: backToOrigin, onTouchEnd: backToOrigin },
342
341
  React.createElement("img", { src: "https://qcloudimg.tencent-cloud.cn/raw/16f372916b73decb45faa912e37f6e6f.svg", className: "weda-ui_mapChoose_map_control_img", alt: "" }))));
343
342
  };
@@ -456,7 +455,7 @@ export default function MapChoose({ changeLocation, onConfirm, onClose, currentL
456
455
  const nowPosition = new TMap.LatLng(currentLocationsLatlng.lat, currentLocationsLatlng.lng);
457
456
  markerRef.current.updateGeometries([
458
457
  {
459
- id: `pointer-${mapDomName}`,
458
+ id: `pointer-${mapDomName.current}`,
460
459
  styleId: 'pointer',
461
460
  position: nowPosition,
462
461
  },
@@ -3,7 +3,7 @@
3
3
  import * as React from 'react';
4
4
  import * as PropTypes from 'prop-types';
5
5
  import { tmapApiUrl } from '../constants';
6
- import { getTMap } from '../common/tmap';
6
+ import { getTMap } from '../../../../utils/tmap';
7
7
  const { useEffect, useRef, useState } = React;
8
8
  const defaultLatLng = {
9
9
  lat: null,
@@ -97,15 +97,12 @@ export default function MapView({ APIKEY = '', drag = true, zoom = true, latlng
97
97
  mapRef.current = null;
98
98
  setMapStatus(false);
99
99
  };
100
- // eslint-disable-next-line react-hooks/exhaustive-deps
101
100
  }, [APIKEY]);
102
101
  useEffect(() => {
103
102
  mapRef.current && mapRef.current.setDraggable(drag);
104
- // eslint-disable-next-line react-hooks/exhaustive-deps
105
103
  }, [drag, mapRef.current]);
106
104
  useEffect(() => {
107
105
  mapRef.current && getTMap() && removeOrAddZoom(mapRef.current, getTMap());
108
- // eslint-disable-next-line react-hooks/exhaustive-deps
109
106
  }, [zoom, mapRef.current]);
110
107
  useEffect(() => {
111
108
  const TMap = getTMap();
@@ -13,7 +13,7 @@ export namespace propTypes {
13
13
  const zoom: PropTypes.Requireable<boolean>;
14
14
  const disabled: PropTypes.Requireable<boolean>;
15
15
  const requiredFlag: PropTypes.Requireable<boolean>;
16
- const decorator: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
16
+ const decorator: PropTypes.Requireable<PropTypes.ReactNodeLike>;
17
17
  const value: PropTypes.Requireable<object>;
18
18
  const locationType: PropTypes.Requireable<number>;
19
19
  const dataSource: PropTypes.Requireable<object>;
@@ -1,4 +1,4 @@
1
- export default function useLocationInfo({ apiKey, locationType, eventsChange, dataSourceStatus, }: {
1
+ export default function useLocationInfo({ apiKey: APIKEY, locationType, eventsChange, dataSourceStatus, }: {
2
2
  apiKey: any;
3
3
  locationType: any;
4
4
  eventsChange: any;
@@ -66,7 +66,6 @@ export default function LocationPC(props) {
66
66
  customLocation.current = value;
67
67
  setLocation(loc);
68
68
  }
69
- // eslint-disable-next-line react-hooks/exhaustive-deps
70
69
  }, [value]);
71
70
  useEffect(() => {
72
71
  if (value || !currentLocations.current)
@@ -92,7 +91,6 @@ export default function LocationPC(props) {
92
91
  });
93
92
  }
94
93
  setLocation(location);
95
- // eslint-disable-next-line react-hooks/exhaustive-deps
96
94
  }, [value, locationType]);
97
95
  const showToast = (message) => {
98
96
  weui.toast(message, {
@@ -158,7 +156,6 @@ export default function LocationPC(props) {
158
156
  });
159
157
  showToast('请配置地图连接器');
160
158
  }
161
- // eslint-disable-next-line react-hooks/exhaustive-deps
162
159
  }, [dataSource]);
163
160
  useEffect(() => {
164
161
  let loc = {
@@ -190,7 +187,6 @@ export default function LocationPC(props) {
190
187
  poiname: loc.poiname,
191
188
  detailedAddress: loc.detailedAddress,
192
189
  }, true);
193
- // eslint-disable-next-line react-hooks/exhaustive-deps
194
190
  }, [locationType]);
195
191
  const getIsShowMap = () => {
196
192
  let status = showMap;
@@ -38,18 +38,18 @@ label = '标题', labelVisible = true, format = '', enumName = '', name = 'formR
38
38
  prevRangeRef.current = option;
39
39
  setCheckedItemValue((_a = option.find((item) => item.checked)) === null || _a === void 0 ? void 0 : _a.value);
40
40
  }
41
- }, [option]);
41
+ });
42
42
  useEffect(() => {
43
43
  // 如果绑定字段类型为枚举,且传入自定义选项集的名称则默认使用自定义选项集的内容作为选项
44
44
  if (format === 'x-enum' && enumName) {
45
45
  fetchData({ OptNameList: [enumName], PageIndex: 1, PageSize: 10 });
46
46
  }
47
- }, [enumName, format]);
47
+ }, []);
48
48
  useEffect(() => {
49
49
  if (format !== 'x-enum') {
50
50
  setOption(range);
51
51
  }
52
- }, [format, range]);
52
+ }, [range]);
53
53
  const fetchData = async (param) => {
54
54
  var _a, _b, _c;
55
55
  const data = await callWedaApi({
@@ -1,4 +1,3 @@
1
- /* eslint-disable react-hooks/exhaustive-deps */
2
1
  import React, { useEffect, useRef, useState } from 'react';
3
2
  import Calendar from './calendar';
4
3
  import { Portal } from '../../../common/portal';
@@ -75,17 +75,9 @@ defaultRegion, defaultMutiRegion, separator, regionType, onChange, }) {
75
75
  defaultMutiRegion,
76
76
  };
77
77
  }
78
- }, [
79
- defaultValue,
80
- defaultDate,
81
- defaultTime,
82
- defaultRegion,
83
- defaultMutiRegion,
84
- regionType,
85
- dateMode,
86
- ]);
78
+ });
87
79
  //实现初始值触发change事件
88
- const defaultMutiRegionChange = React.useCallback(function (treeValue, defaultMutiRegion) {
80
+ const defaultMutiRegionChange = function (treeValue, defaultMutiRegion) {
89
81
  var _a;
90
82
  const defaultValue = defaultMutiRegion
91
83
  ? defaultMutiRegion.split(',')
@@ -104,7 +96,7 @@ defaultRegion, defaultMutiRegion, separator, regionType, onChange, }) {
104
96
  });
105
97
  (_a = events === null || events === void 0 ? void 0 : events.change) === null || _a === void 0 ? void 0 : _a.call(events, { value: defaultMutiRegion, result: changeValue });
106
98
  }
107
- }, [events]);
99
+ };
108
100
  React.useEffect(() => {
109
101
  if (mode == 'region' || mode == 'mutiRegion') {
110
102
  if (regionData.length < 1) {
@@ -139,13 +131,7 @@ defaultRegion, defaultMutiRegion, separator, regionType, onChange, }) {
139
131
  break;
140
132
  }
141
133
  }
142
- }, [
143
- regionType,
144
- mode,
145
- regionData,
146
- defaultMutiRegionChange,
147
- defaultMutiRegion,
148
- ]);
134
+ }, [regionType, mode, regionData]);
149
135
  const onDateclick = function () {
150
136
  const options = {
151
137
  className: 'weda-ui weda-picker',
@@ -132,14 +132,7 @@ function SelectPc({ where, dataSourceName, viewId, format, primaryField, enumNam
132
132
  defaultMutiRegion,
133
133
  };
134
134
  }
135
- }, [
136
- defaultValue,
137
- defaultDate,
138
- defaultTime,
139
- defaultRegion,
140
- defaultMutiRegion,
141
- dateMode,
142
- ]);
135
+ });
143
136
  React.useEffect(() => {
144
137
  if (mode == 'region' || mode == 'mutiRegion') {
145
138
  if (regionData.length < 1) {
@@ -98,6 +98,6 @@ export function useOptions(params) {
98
98
  if (state.status === 'success') {
99
99
  setOptions(state.result);
100
100
  }
101
- }, [setOptions, state, state.status]);
101
+ }, [state, state.status]);
102
102
  return [options];
103
103
  }
@@ -5,7 +5,7 @@ import { getCloudInstance } from '../../../utils/tcb';
5
5
  import isObjectEqual from '../../../utils/isObjectEqual';
6
6
  import { useSyncValue } from '../../../utils/useSyncValue';
7
7
  import { randomStr } from '../../../utils/platform';
8
- import { IMAGE_TYPES } from './uploader.pc';
8
+ import { IMAGE_TYPES, encodeConvert } from './uploader.pc';
9
9
  import { useTempUrl } from '../../../utils/use-cloud-id-temp-url';
10
10
  const uploadPath = 'weda-uploader';
11
11
  /**
@@ -36,7 +36,7 @@ export function ImageUploaderH5({ title, maxUploadCount, maxSize = 10, acceptTyp
36
36
  return inputValue;
37
37
  }
38
38
  return [];
39
- }, [inputValue, setInputValue]);
39
+ }, [inputValue]);
40
40
  const finalMaxImgCount = React.useMemo(() => {
41
41
  if (single)
42
42
  return 1;
@@ -59,7 +59,7 @@ export function ImageUploaderH5({ title, maxUploadCount, maxSize = 10, acceptTyp
59
59
  onChange && onChange(fileIdList);
60
60
  events.change && events.change({ value: fileIdList });
61
61
  }
62
- }, [events, fileIdList, onChange, single]);
62
+ }, [fileIdList]);
63
63
  const onProgress = (progressEvent) => {
64
64
  let percentCompleted = 0;
65
65
  try {
@@ -73,7 +73,7 @@ export function ImageUploaderH5({ title, maxUploadCount, maxSize = 10, acceptTyp
73
73
  setUploading(true);
74
74
  getCloudInstance().then(async (tcb) => {
75
75
  try {
76
- const cloudPath = `${uploadPath}/${randomStr()}-${file === null || file === void 0 ? void 0 : file.name}`;
76
+ const cloudPath = `${uploadPath}/${randomStr()}-${file === null || file === void 0 ? void 0 : file.name.replace(/[%#]/g, '-')}`;
77
77
  const { fileID } = await tcb.uploadFile({
78
78
  cloudPath,
79
79
  filePath: file,
@@ -163,18 +163,19 @@ function SingleImage({ src, deleteBySrc }) {
163
163
  'weui-uploader__file': true,
164
164
  });
165
165
  const { data: realSrc, error } = useTempUrl(src);
166
+ const encodeSrc = encodeConvert(realSrc);
166
167
  const imgStyle = {
167
- backgroundImage: `url(${realSrc})`,
168
+ backgroundImage: `url(${encodeURI(encodeSrc)})`,
168
169
  };
169
170
  const showGallery = () => {
170
- const gallery = weui.gallery(encodeURI(realSrc), {
171
+ const gallery = weui.gallery(encodeURI(encodeSrc), {
171
172
  onDelete: function () {
172
173
  deleteBySrc(src);
173
174
  gallery.hide();
174
175
  },
175
176
  });
176
177
  };
177
- return (React.createElement("li", { className: cls, style: imgStyle, onClick: showGallery }, error || status ? (React.createElement("div", { className: "weui-uploader__file-content" }, error ? (React.createElement("i", { role: "img", "aria-label": "\u9519\u8BEF", className: "weui-icon-warn" })) : (React.createElement("i", { className: "weui-loading", style: { width: 30, height: 30 } })))) : (false)));
178
+ return (React.createElement("li", { className: cls, style: imgStyle, onClick: showGallery, "data-testid": "uploaderh5_imgStyle" }, error || status ? (React.createElement("div", { className: "weui-uploader__file-content" }, error ? (React.createElement("i", { role: "img", "aria-label": "\u9519\u8BEF", className: "weui-icon-warn" })) : (React.createElement("i", { className: "weui-loading", style: { width: 30, height: 30 } })))) : (false)));
178
179
  }
179
180
  const UploaderLabel = ({ layout, title, currentCount, maxCount, requiredFlag, }) => {
180
181
  if (layout === 'horizontal') {
@@ -27,3 +27,4 @@ export interface PropsType extends H5UploaderProps {
27
27
  btnTitle?: string;
28
28
  uploadPath?: string;
29
29
  }
30
+ export declare function encodeConvert(src: any): any;
@@ -53,7 +53,7 @@ export function UploaderPCInner(props) {
53
53
  initialValue = initialValue[0] ? [initialValue[0]] : [];
54
54
  }
55
55
  setfileIDList(initialValue);
56
- }, [defaultValue, single]);
56
+ }, [defaultValue]);
57
57
  // 值变化事件
58
58
  React.useEffect(() => {
59
59
  if (!isObjectEqual(fileRef.current, fileIDList)) {
@@ -121,7 +121,7 @@ export function UploaderPCInner(props) {
121
121
  setUploading(true);
122
122
  getCloudInstance().then(async (tcb) => {
123
123
  try {
124
- const cloudPath = `${uploadPath}/${randomStr()}-${file === null || file === void 0 ? void 0 : file.name}`;
124
+ const cloudPath = `${uploadPath}/${randomStr()}-${file === null || file === void 0 ? void 0 : file.name.replace(/[%#]/g, '-')}`;
125
125
  const { fileID } = await tcb.uploadFile({
126
126
  cloudPath,
127
127
  filePath: file,
@@ -190,19 +190,32 @@ export const TcbImage = (props) => {
190
190
  const { fileID, isZoom, ...rest } = props;
191
191
  const [isError, setIsError] = React.useState(false);
192
192
  const { data: src, error: requestError } = useTempUrl(fileID);
193
+ const encodeSrc = encodeConvert(src);
193
194
  if (isError || requestError) {
194
195
  return React.createElement(ErrorTip, null);
195
196
  }
196
197
  if (src) {
197
- return isZoom ? (React.createElement(ImagePreview, { key: fileID, className: `${CLASS_PREFIX}__image`, ...rest, src: encodeURI(src), previewSrc: encodeURI(src),
198
+ return isZoom ? (React.createElement(ImagePreview, { key: fileID, className: `${CLASS_PREFIX}__image`, ...rest, src: encodeURI(encodeSrc), previewSrc: encodeURI(encodeSrc),
198
199
  /** @ts-expect-error tea imagepreview onError */
199
200
  onError: (e) => {
200
201
  setIsError(true);
201
202
  (props === null || props === void 0 ? void 0 : props.onError) && props.onError(e);
202
- } })) : (React.createElement("img", { key: fileID, className: `${CLASS_PREFIX}__image`, ...rest, src: encodeURI(src), onError: (e) => {
203
+ } })) : (React.createElement("img", { "data-testid": "uploaderpc_imgStyle", key: fileID, className: `${CLASS_PREFIX}__image`, ...rest, src: encodeURI(encodeSrc), onError: (e) => {
203
204
  setIsError(true);
204
205
  (props === null || props === void 0 ? void 0 : props.onError) && props.onError(e);
205
206
  } }));
206
207
  }
207
208
  return null;
208
209
  };
210
+ //兼容私有化下载链接encodeURIComponent被编码情况
211
+ export function encodeConvert(src) {
212
+ if (src) {
213
+ try {
214
+ return 'https://' + decodeURIComponent(src.split('https://')[1]);
215
+ }
216
+ catch (e) {
217
+ return src;
218
+ }
219
+ }
220
+ return src;
221
+ }
@@ -70,7 +70,7 @@ events = emptyObject, defaultValue, uploadPath = 'weda-uploader', single = true,
70
70
  (_c = events === null || events === void 0 ? void 0 : events.success) === null || _c === void 0 ? void 0 : _c.call(events, { value: pureFileIDList });
71
71
  fileRef.current = fileIDList;
72
72
  }
73
- }, [events, fileIDList, onChange, single]);
73
+ }, [fileIDList]);
74
74
  // 外层组件类
75
75
  const cls = classNames({
76
76
  'weda-ui': true,
@@ -218,9 +218,12 @@ const TcbFileUpload = ({ file, disabled }) => {
218
218
  const title = (file === null || file === void 0 ? void 0 : file.name) || '';
219
219
  const uuid = file === null || file === void 0 ? void 0 : file._uuid;
220
220
  return { size, title, uuid };
221
- }, [file === null || file === void 0 ? void 0 : file._uuid, file === null || file === void 0 ? void 0 : file.name, file === null || file === void 0 ? void 0 : file.size]);
221
+ }, [file === null || file === void 0 ? void 0 : file._uuid]);
222
+ React.useEffect(() => {
223
+ handleUpload(file);
224
+ }, [file === null || file === void 0 ? void 0 : file._uuid]);
222
225
  // 上传过程
223
- const handleUpload = React.useCallback(async (file) => {
226
+ const handleUpload = async (file) => {
224
227
  var _a;
225
228
  const tcb = await getCloudInstance();
226
229
  try {
@@ -242,12 +245,7 @@ const TcbFileUpload = ({ file, disabled }) => {
242
245
  setStatus('UPLOAD_STATUS_ERROR');
243
246
  (_a = events === null || events === void 0 ? void 0 : events.error) === null || _a === void 0 ? void 0 : _a.call(events, err);
244
247
  }
245
- },
246
- // eslint-disable-next-line react-hooks/exhaustive-deps
247
- [size, uploadPath, uuid]);
248
- React.useEffect(() => {
249
- handleUpload(file);
250
- }, [file, file._uuid, handleUpload]);
248
+ };
251
249
  return (React.createElement("div", { className: `${CLASS_PREFIX}__item`, role: "TcbFileUpload" },
252
250
  React.createElement("div", { className: `${CLASS_PREFIX}__item-left` },
253
251
  React.createElement(UploadFileStatus, { status: status, percent: percent, size: size, title: title, percentSize: (((file === null || file === void 0 ? void 0 : file.size) / 1024) * percent) / 100 })),
@@ -61,7 +61,6 @@ acceptTypes = emptyArray, downloadVisible = true, deleteVisible = true, uploadPa
61
61
  (_c = events === null || events === void 0 ? void 0 : events.success) === null || _c === void 0 ? void 0 : _c.call(events, { value: pureFileIDList });
62
62
  fileRef.current = fileIDList;
63
63
  }
64
- // eslint-disable-next-line react-hooks/exhaustive-deps
65
64
  }, [fileIDList]);
66
65
  // 外层组件类
67
66
  const cls = classNames({
@@ -210,9 +209,12 @@ const TcbFileUpload = ({ file, disabled }) => {
210
209
  const title = (file === null || file === void 0 ? void 0 : file.name) || '';
211
210
  const uuid = file === null || file === void 0 ? void 0 : file._uuid;
212
211
  return { size, title, uuid };
213
- }, [file === null || file === void 0 ? void 0 : file._uuid, file === null || file === void 0 ? void 0 : file.name, file === null || file === void 0 ? void 0 : file.size]);
212
+ }, [file === null || file === void 0 ? void 0 : file._uuid]);
213
+ React.useEffect(() => {
214
+ handleUpload(file);
215
+ }, [file === null || file === void 0 ? void 0 : file._uuid]);
214
216
  // 上传过程
215
- const handleUpload = React.useCallback(async (file) => {
217
+ const handleUpload = async (file) => {
216
218
  const tcb = await getCloudInstance();
217
219
  try {
218
220
  setStatus('0');
@@ -233,12 +235,7 @@ const TcbFileUpload = ({ file, disabled }) => {
233
235
  setStatus('3');
234
236
  events.error && events.error(e);
235
237
  }
236
- },
237
- // eslint-disable-next-line react-hooks/exhaustive-deps
238
- [size, uploadPath, uuid]);
239
- React.useEffect(() => {
240
- handleUpload(file);
241
- }, [file, file._uuid, handleUpload]);
238
+ };
242
239
  return (React.createElement("div", { className: `${CLASS_PREFIX}--item ${CLASS_PREFIX}--item-body` },
243
240
  React.createElement("div", { className: `${CLASS_PREFIX}--item-title`, title: title }, cutFileTitle(title)),
244
241
  React.createElement("div", { className: `${CLASS_PREFIX}--item-size` }, size),
@@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react';
2
2
  import { emptyObject } from '../../../../utils/constant';
3
3
  import { renderDecorator } from '../../renderDecorator';
4
4
  import classNames from 'classnames';
5
- import { Dropdown, ConfigProvider, Text } from 'tea-component';
5
+ import { Dropdown, ConfigProvider, Text, Icon } from 'tea-component';
6
6
  import { getNode, getRelationData, dealOrgData } from '../utils';
7
7
  import { getDepartById, defaultRequest } from '../getUserService';
8
8
  import '../userOrgSelect.css';
@@ -141,12 +141,11 @@ const SelectViewContainer = (props) => {
141
141
  return React.createElement(Text, { className: "placeholder" }, placeholder);
142
142
  return (React.createElement(React.Fragment, null,
143
143
  React.createElement(ViewCell, { data: curSelectItem, showType: "tree", relation: undefined }),
144
- moveIn && (React.createElement(React.Fragment, null,
145
- React.createElement("div", { className: "weda-select-user-dept__dialog-input-clear", onClick: (e) => {
146
- e.stopPropagation();
147
- onChange === null || onChange === void 0 ? void 0 : onChange();
148
- } },
149
- React.createElement("p", { className: "weda-select-user-dept__dialog-input-clear-close" }))))));
144
+ moveIn && (React.createElement("div", { className: "weda-select-user-dept-input-clear", onClick: (e) => {
145
+ e.stopPropagation();
146
+ onChange === null || onChange === void 0 ? void 0 : onChange();
147
+ } },
148
+ React.createElement(Icon, { className: 'pc-clear', type: "dismiss", size: "s", onMouseDown: onChange })))));
150
149
  };
151
150
  const ViewCell = ({ data, showType, relation }) => {
152
151
  if (showType === 'tree') {
@@ -562,6 +562,7 @@
562
562
  z-index: 20;
563
563
  cursor: pointer;
564
564
  }
565
+
565
566
  .weda-select-user-dept__dialog
566
567
  .weda-select-user-dept__dialog-input-clear::before,
567
568
  .weda-select-user-dept__dialog
@@ -673,14 +674,14 @@
673
674
  .weda-select-user-dept__dialog .user_loading {
674
675
  top: -0.14286rem;
675
676
  }
676
-
677
677
  .weda-select-user-dept__dialog .wedatea2td-form-check .wedatea2td-checkbox,
678
678
  .weda-select-user-dept__dialog .wedatea2td-form-check .wedatea2td-radio-wrap {
679
679
  height: 1.42857rem;
680
680
  margin-right: 0.85714rem;
681
681
  }
682
- .weda-select-user-dept__dialog .wedatea2td-radio,
683
- input[type='radio'] {
682
+ .weda-select-user-dept__dialog
683
+ .weda-select-user-dept__list-item-wrap
684
+ .wedatea2td-radio {
684
685
  width: 1.42857rem;
685
686
  height: 1.42857rem;
686
687
  }
@@ -807,3 +808,16 @@ input[type='radio'] {
807
808
  .weda-user-model-select .size-auto-width .wedatea2td-dropdown__value {
808
809
  white-space: pre-wrap;
809
810
  }
811
+ .weda-select-user-dept-input-clear {
812
+ position: absolute;
813
+ right: 0.57143rem;
814
+ top: 0;
815
+ cursor: pointer;
816
+ background-color: white;
817
+ }
818
+ .weda-select-user-dept-input-clear .pc-clear {
819
+ position: relative;
820
+ top: 25%;
821
+ display: inline-block;
822
+ background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+PHBhdGggZmlsbD0iIzg4OCIgZD0iTTggMWE3IDcgMCAxIDAgMCAxNEE3IDcgMCAwIDAgOCAxem0zLjUzNiA5LjEyMWwtMS40MTQgMS40MTRMOCA5LjQxNGwtMi4xMjEgMi4xMjEtMS40MTQtMS40MTRMNi41ODYgOCA0LjQ2NCA1Ljg3OWwxLjQxNC0xLjQxNEw4IDYuNTg2bDIuMTIxLTIuMTIxIDEuNDE0IDEuNDE0TDkuNDE0IDhsMi4xMjIgMi4xMjF6Ii8+PC9zdmc+) !important;
823
+ }
@@ -2,7 +2,7 @@ import React, { useState, useEffect, useCallback } from 'react';
2
2
  import { renderDecorator } from '../renderDecorator';
3
3
  import { isInIde, filterStrList } from '../../../utils/platform';
4
4
  import classNames from 'classnames';
5
- import { Dropdown, ConfigProvider, Text, Modal } from 'tea-component';
5
+ import { Dropdown, ConfigProvider, Text, Modal, Icon } from 'tea-component';
6
6
  import { getNode, getRelationData, dealOrgData, dealUserData, removeMarkString, } from './utils';
7
7
  import { getUserInfo, defaultRequest } from './getUserService';
8
8
  import './userOrgSelect.css';
@@ -237,12 +237,11 @@ const SelectViewContainer = (props) => {
237
237
  return React.createElement(Text, { className: "placeholder1" }, placeholder);
238
238
  return (React.createElement(React.Fragment, null,
239
239
  React.createElement(ViewCell, { data: data, showType: "tree", relation: undefined }),
240
- moveIn && (React.createElement(React.Fragment, null,
241
- React.createElement("div", { className: "weda-select-user-dept__dialog-input-clear", onClick: (e) => {
242
- e.stopPropagation();
243
- onChange === null || onChange === void 0 ? void 0 : onChange();
244
- } },
245
- React.createElement("p", { className: "weda-select-user-dept__dialog-input-clear-close" }))))));
240
+ moveIn && (React.createElement("div", { className: "weda-select-user-dept-input-clear", onClick: (e) => {
241
+ e.stopPropagation();
242
+ onChange === null || onChange === void 0 ? void 0 : onChange();
243
+ } },
244
+ React.createElement(Icon, { className: 'pc-clear', type: "dismiss", size: "s", onMouseDown: onChange })))));
246
245
  };
247
246
  const ViewCell = ({ data, showType, relation }) => {
248
247
  if (showType === 'tree') {
@@ -1,4 +1,4 @@
1
- import React, { useEffect, forwardRef, useImperativeHandle, useState, useCallback, } from 'react';
1
+ import React, { useEffect, useRef, forwardRef, useImperativeHandle, useState, } from 'react';
2
2
  import destr from 'destr';
3
3
  import classNames from '../../utils/classnames';
4
4
  import { usePlatform, randomStr } from '../../utils/platform';
@@ -60,11 +60,12 @@ export const changeHandle = ({ type, name, data, childFormItem, isPureArray, par
60
60
  };
61
61
  export default forwardRef(function FormDetail(props, ref) {
62
62
  const { className, id, style, children, events, name, value: initDetailValue, isPureArray, parent, } = props;
63
+ const observeRef = useRef(null); // 当前监听对象
63
64
  const [defaultValue, setDetailValue] = useState([]);
64
65
  const [contextData, setContextData] = useState([]);
65
66
  const [childFormItem, setCildFormItem] = useState([]);
66
67
  const platform = usePlatform();
67
- const init = useCallback((defaultValue) => {
68
+ const init = (defaultValue) => {
68
69
  var _a;
69
70
  const formDetailItemValue = {};
70
71
  let childFormItem = defaultValue[0] ? Object.keys(defaultValue[0]) : [];
@@ -110,12 +111,10 @@ export default forwardRef(function FormDetail(props, ref) {
110
111
  // eslint-disable-next-line rulesdir/no-timer
111
112
  setTimeout(() => {
112
113
  if (!isObjectEqual(formDetailItemValue, {})) {
113
- if ((parent === null || parent === void 0 ? void 0 : parent.setValue) && typeof (parent === null || parent === void 0 ? void 0 : parent.setValue) === 'function') {
114
- parent === null || parent === void 0 ? void 0 : parent.setValue(formDetailItemValue);
115
- }
114
+ parent.setValue(formDetailItemValue);
116
115
  }
117
116
  }, 0);
118
- }, [events, isPureArray, name, parent]);
117
+ };
119
118
  // 初始化context的值
120
119
  useEffect(() => {
121
120
  if (!isObjectEqual(initDetailValue, defaultValue)) {
@@ -129,13 +128,12 @@ export default forwardRef(function FormDetail(props, ref) {
129
128
  setDetailValue(initDetailValue);
130
129
  // 组件卸载时触发
131
130
  return () => {
132
- var _a;
133
- (_a = events === null || events === void 0 ? void 0 : events.onDataChange) === null || _a === void 0 ? void 0 : _a.call(events, { data: [] });
131
+ var _a, _b;
132
+ (_a = observeRef.current) === null || _a === void 0 ? void 0 : _a.disconnect();
133
+ (_b = events === null || events === void 0 ? void 0 : events.onDataChange) === null || _b === void 0 ? void 0 : _b.call(events, { data: [] });
134
134
  };
135
- // 只执行一次;
136
- // eslint-disable-next-line react-hooks/exhaustive-deps
137
135
  }, []);
138
- const onChange = useCallback((type, params) => {
136
+ const onChange = (type, params) => {
139
137
  var _a;
140
138
  let data = destr(contextData);
141
139
  data = changeHandle({
@@ -148,7 +146,7 @@ export default forwardRef(function FormDetail(props, ref) {
148
146
  });
149
147
  setContextData(data);
150
148
  (_a = events === null || events === void 0 ? void 0 : events.onDataChange) === null || _a === void 0 ? void 0 : _a.call(events, { data });
151
- }, [childFormItem, contextData, events, isPureArray, name]);
149
+ };
152
150
  useImperativeHandle(ref, () => {
153
151
  return {
154
152
  methods: {
@@ -1,4 +1,4 @@
1
- import React, { useMemo } from 'react';
1
+ import React, { useEffect, useMemo } from 'react';
2
2
  import './index.css';
3
3
  import classNames from '../../utils/classnames';
4
4
  import { Row, Col, ConfigProvider, Button, Text } from 'tea-component';
@@ -12,6 +12,7 @@ const CLASS_PREFIX = 'weda-graphic-card';
12
12
  export default function GraphicCard({ navOption = emptyArray, ColMobile, ColPC, iconWidthSize, iconHeightSize, titleVisible, desVisible, buttonVisible, textAlign, className, titleColor, titleFontWeight, titleFontSize, titleLineHeight, titleMaxLines, desColor, desFontWeight, desFontSize, desLineHeight, desMaxLines, buttonText, style, }) {
13
13
  const platform = usePlatform();
14
14
  const isH5 = platform === 'h5';
15
+ const [colCount, setColCount] = React.useState(2);
15
16
  // 一个栅格的宽度
16
17
  const { width } = useWindowSize();
17
18
  const singleGrid = useMemo(() => (width - 24 * 2) / 12, [width]);
@@ -23,10 +24,10 @@ export default function GraphicCard({ navOption = emptyArray, ColMobile, ColPC,
23
24
  [className]: className,
24
25
  [`${CLASS_PREFIX}-mobile`]: isH5,
25
26
  });
26
- const colCount = useMemo(() => {
27
+ useEffect(() => {
27
28
  const col = isH5 ? ColMobile : ColPC;
28
- return col !== null && col !== void 0 ? col : 2;
29
- }, [ColMobile, ColPC, isH5]);
29
+ setColCount(col);
30
+ }, [isH5]);
30
31
  const cardList = useMemo(() => {
31
32
  const list = [];
32
33
  if (prevColRef.current !== colCount ||
@@ -121,7 +122,7 @@ export default function GraphicCard({ navOption = emptyArray, ColMobile, ColPC,
121
122
  ? iconHeightSize
122
123
  : (Number(height) * parseInt(iconHeightSize)) / 100 + 'px';
123
124
  return { width, height };
124
- }, [platform, ColMobile, ColPC, iconWidthSize, iconHeightSize]);
125
+ }, [iconWidthSize, iconHeightSize, ColMobile, ColPC, isH5]);
125
126
  const tapTo = (colInfo = navOption[0]) => {
126
127
  switch (colInfo === null || colInfo === void 0 ? void 0 : colInfo.tapStatus) {
127
128
  case 'tap':