@cloudbase/weda-ui 3.2.1 → 3.3.0

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 (78) hide show
  1. package/dist/src/configs/components/chart/bar.json +9 -1
  2. package/dist/src/configs/components/chart/line.json +8 -0
  3. package/dist/src/configs/components/chart/pie.json +8 -0
  4. package/dist/src/web/actions/showModal/index.js +0 -1
  5. package/dist/src/web/components/calendar/index.js +39 -37
  6. package/dist/src/web/components/carousel/index.js +62 -62
  7. package/dist/src/web/components/chart/bar/index.js +6 -2
  8. package/dist/src/web/components/chart/common/Chart.d.ts +1 -0
  9. package/dist/src/web/components/chart/common/Chart.js +9 -1
  10. package/dist/src/web/components/chart/common/chart-custom-connector.js +1 -1
  11. package/dist/src/web/components/chart/common/core/eChartBase.js +1 -1
  12. package/dist/src/web/components/chart/common/data-transform.js +3 -1
  13. package/dist/src/web/components/chart/common/useChart.js +13 -2
  14. package/dist/src/web/components/chart/line/index.js +2 -2
  15. package/dist/src/web/components/chart/pie/index.js +2 -2
  16. package/dist/src/web/components/common/error-boundary.d.ts +5 -0
  17. package/dist/src/web/components/common/error-boundary.js +33 -0
  18. package/dist/src/web/components/common/use-loop-render-detect.d.ts +11 -0
  19. package/dist/src/web/components/common/use-loop-render-detect.js +124 -0
  20. package/dist/src/web/components/form/checkbox/index.js +29 -29
  21. package/dist/src/web/components/form/form/index.js +24 -15
  22. package/dist/src/web/components/form/input/index.js +11 -3
  23. package/dist/src/web/components/form/location/common/mapChoose.js +6 -5
  24. package/dist/src/web/components/form/location/common/mapView.js +9 -6
  25. package/dist/src/web/components/form/location/common/tmap.d.ts +3 -0
  26. package/dist/src/web/components/form/location/common/tmap.js +21 -0
  27. package/dist/src/web/components/form/location/common/useLocationInfo.js +3 -2
  28. package/dist/src/web/components/form/location/components/LocationH5/location.h5.js +6 -3
  29. package/dist/src/web/components/form/location/components/LocationPC/location.PC.js +5 -1
  30. package/dist/src/web/components/form/location/index.js +7 -0
  31. package/dist/src/web/components/form/radio/index.js +3 -3
  32. package/dist/src/web/components/form/select/allTimePicker/index.js +1 -0
  33. package/dist/src/web/components/form/select/h5.js +18 -4
  34. package/dist/src/web/components/form/select/index.js +15 -1
  35. package/dist/src/web/components/form/select/use-options.js +1 -1
  36. package/dist/src/web/components/form/uploader/uploader.h5.js +2 -2
  37. package/dist/src/web/components/form/uploader/uploader.pc.js +1 -1
  38. package/dist/src/web/components/form/uploaderFile/uploadFile.h5.js +9 -7
  39. package/dist/src/web/components/form/uploaderFile/uploadFile.pc.js +9 -6
  40. package/dist/src/web/components/form/userOrgSelect/comTool.js +3 -9
  41. package/dist/src/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.h5.js +39 -34
  42. package/dist/src/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.pc.d.ts +1 -1
  43. package/dist/src/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.pc.js +35 -36
  44. package/dist/src/web/components/form/userOrgSelect/getUserService.d.ts +11 -0
  45. package/dist/src/web/components/form/userOrgSelect/getUserService.js +159 -0
  46. package/dist/src/web/components/form/userOrgSelect/userTreeSelect.h5.d.ts +3 -2
  47. package/dist/src/web/components/form/userOrgSelect/userTreeSelect.h5.js +37 -19
  48. package/dist/src/web/components/form/userOrgSelect/userTreeSelect.pc.d.ts +1 -1
  49. package/dist/src/web/components/form/userOrgSelect/userTreeSelect.pc.js +111 -129
  50. package/dist/src/web/components/form/userOrgSelect/utils.d.ts +3 -2
  51. package/dist/src/web/components/form/userOrgSelect/utils.js +24 -16
  52. package/dist/src/web/components/formdetail/index.js +14 -11
  53. package/dist/src/web/components/graphicCard/index.js +5 -6
  54. package/dist/src/web/components/image/index.js +1 -1
  55. package/dist/src/web/components/listView/index.js +1 -0
  56. package/dist/src/web/components/lottery/index.js +10 -16
  57. package/dist/src/web/components/navLayout/index.js +1 -1
  58. package/dist/src/web/components/navigationBar/horizontalMenu.js +1 -1
  59. package/dist/src/web/components/navigationBar/index.js +6 -6
  60. package/dist/src/web/components/richText/index.js +1 -2
  61. package/dist/src/web/components/richTextView/index.js +20 -18
  62. package/dist/src/web/components/scrollView/index.d.ts +1 -2
  63. package/dist/src/web/components/scrollView/index.js +7 -5
  64. package/dist/src/web/components/swiper/index.js +62 -62
  65. package/dist/src/web/components/tabs/index.js +6 -1
  66. package/dist/src/web/components/tabs/tabs.h5.js +2 -0
  67. package/dist/src/web/components/text/index.js +10 -8
  68. package/dist/src/web/components/uploaderFileView/index.js +1 -1
  69. package/dist/src/web/components/uploaderView/index.js +1 -1
  70. package/dist/src/web/components/wedaVideo/index.js +15 -3
  71. package/dist/src/web/utils/console.d.ts +3 -0
  72. package/dist/src/web/utils/console.js +26 -0
  73. package/dist/src/web/utils/platform.js +1 -1
  74. package/dist/src/web/utils/tcb.js +1 -1
  75. package/dist/src/web/utils/useSyncValue.js +1 -0
  76. package/dist/web/components/form/input/index.css +16 -0
  77. package/dist/web/components/form/userOrgSelect/userOrgSelect.css +4 -0
  78. package/package.json +20 -20
@@ -1,4 +1,4 @@
1
- import React, { useEffect, useState } from 'react';
1
+ import React, { useCallback, useEffect, useState } from 'react';
2
2
  import { Checkbox as TeaCheckbox, ConfigProvider } from 'tea-component';
3
3
  import classNames from '../../../utils/classnames';
4
4
  import getLocalCounter from '../../../utils/getLocalCounter';
@@ -39,33 +39,8 @@ name = 'formCheckbox', label = '标题', labelVisible = true, format = '', enumN
39
39
  prevRangeRef.current = JSON.parse(JSON.stringify(option));
40
40
  setCheckedItems(fromEntries(option.map(({ value, checked }) => [value, !!checked])));
41
41
  }
42
- });
43
- useEffect(() => {
44
- // 如果绑定字段类型为枚举,且传入自定义选项集的名称则默认使用自定义选项集的内容作为选项
45
- if (format === 'x-enum' && enumName) {
46
- fetchData({ OptNameList: [enumName], PageIndex: 1, PageSize: 10 });
47
- }
48
- }, []);
49
- useEffect(() => {
50
- if (format === 'x-enum') {
51
- const opt = enumOptions &&
52
- enumOptions.map((item) => {
53
- const checked = controlValue && controlValue.find((val) => val === item.value);
54
- return {
55
- value: item.value,
56
- label: item.label,
57
- checked: !!checked,
58
- };
59
- });
60
- setOption(opt);
61
- }
62
- }, [controlValue]);
63
- useEffect(() => {
64
- if (format !== 'x-enum') {
65
- setOption(range);
66
- }
67
- }, [range]);
68
- const fetchData = async (param) => {
42
+ }, [option]);
43
+ const fetchData = useCallback(async (param) => {
69
44
  var _a, _b, _c;
70
45
  const data = await callWedaApi({
71
46
  action: 'DescribeGeneralOptionsDetailList',
@@ -91,7 +66,32 @@ name = 'formCheckbox', label = '标题', labelVisible = true, format = '', enumN
91
66
  };
92
67
  });
93
68
  setOption(opt);
94
- };
69
+ }, [controlValue]);
70
+ useEffect(() => {
71
+ // 如果绑定字段类型为枚举,且传入自定义选项集的名称则默认使用自定义选项集的内容作为选项
72
+ if (format === 'x-enum' && enumName) {
73
+ fetchData({ OptNameList: [enumName], PageIndex: 1, PageSize: 10 });
74
+ }
75
+ }, [enumName, fetchData, format]);
76
+ useEffect(() => {
77
+ if (format === 'x-enum') {
78
+ const opt = enumOptions &&
79
+ enumOptions.map((item) => {
80
+ const checked = controlValue && controlValue.find((val) => val === item.value);
81
+ return {
82
+ value: item.value,
83
+ label: item.label,
84
+ checked: !!checked,
85
+ };
86
+ });
87
+ setOption(opt);
88
+ }
89
+ }, [controlValue, enumOptions, format]);
90
+ useEffect(() => {
91
+ if (format !== 'x-enum') {
92
+ setOption(range);
93
+ }
94
+ }, [format, range]);
95
95
  /**
96
96
  * 在ios h5端, label和input的绑定不生效
97
97
  * 导致 onChange 事件触发有问题, 所以改为监听 onClick 事件
@@ -80,16 +80,19 @@ export default function Form({ className, contentSlot, style, id, layout, formTy
80
80
  platform,
81
81
  methodGetItem,
82
82
  paramGetItem,
83
+ appCloud,
84
+ events,
83
85
  ]);
84
86
  React.useEffect(() => {
87
+ var _a, _b, _c, _d;
85
88
  // 获取字段权限
86
- async () => {
89
+ const authValue = {
90
+ isDataModel,
91
+ dataSourceFields: [],
92
+ dataSourceFieldsWidthAuthList: [],
93
+ };
94
+ const getDataSourceFieldsWithAuth = async () => {
87
95
  var _a, _b, _c, _d;
88
- const authValue = {
89
- isDataModel,
90
- dataSourceFields: [],
91
- dataSourceFieldsWidthAuthList: [],
92
- };
93
96
  try {
94
97
  const datasource = await getDataSourceByName(dataSourceName);
95
98
  if (!isInIde()) {
@@ -103,17 +106,23 @@ export default function Form({ className, contentSlot, style, id, layout, formTy
103
106
  catch (err) {
104
107
  (_d = events === null || events === void 0 ? void 0 : events.onInitDataSourceFieldsWithAuth) === null || _d === void 0 ? void 0 : _d.call(events, authValue);
105
108
  alertError(platform, `获取数据源字段权限信息失败,字段权限可能无法正确展示,错误信息:${err}`);
106
- console.log('getDataSourceFieldsWithAuth err', err);
109
+ console.error('getDataSourceFieldsWithAuth err', err);
107
110
  }
108
111
  };
109
- // 权限功能,待sdk兼容问题解决后上线
110
- // if (isDataModel && dataSourceName) {
111
- // getDataSourceFieldsWithAuth();
112
- // } else {
113
- // // 在表单容器里面的表单元素 if 默认是 false,需要通过onInitDataSourceFieldsWithAuth设置为true
114
- // events?.onInitDataSourceFieldsWithAuth?.({ isDataModel });
115
- // }
116
- }, [formType, isDataModel, platform, dataSourceName]);
112
+ // 兼容私有环境,新接口不存在的情况,产品策略完善后移除
113
+ if ((window === null || window === void 0 ? void 0 : window['_isPrivate']) &&
114
+ !((_b = (_a = window === null || window === void 0 ? void 0 : window.app) === null || _a === void 0 ? void 0 : _a.cloud) === null || _b === void 0 ? void 0 : _b.getDataSourceProfileAsync)) {
115
+ (_c = events === null || events === void 0 ? void 0 : events.onInitDataSourceFieldsWithAuth) === null || _c === void 0 ? void 0 : _c.call(events, { isDataModel });
116
+ return;
117
+ }
118
+ if (isDataModel && dataSourceName) {
119
+ getDataSourceFieldsWithAuth();
120
+ }
121
+ else {
122
+ // 在表单容器里面的表单元素 if 默认是 false,需要通过onInitDataSourceFieldsWithAuth设置为true
123
+ (_d = events === null || events === void 0 ? void 0 : events.onInitDataSourceFieldsWithAuth) === null || _d === void 0 ? void 0 : _d.call(events, { isDataModel });
124
+ }
125
+ }, [formType, isDataModel, platform, dataSourceName, events]);
117
126
  // pc 渲染
118
127
  const renderPc = () => {
119
128
  return (React.createElement(ConfigProvider, { classPrefix: "wedatea2td" },
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import classNames from '../../../utils/classnames';
3
3
  import { usePlatform } from '../../../utils/platform';
4
- import { Input as TeaInput, ConfigProvider } from 'tea-component';
4
+ import { Input as TeaInput, ConfigProvider, Icon } from 'tea-component';
5
5
  import { renderDecorator } from '../renderDecorator';
6
6
  import { useSyncValue } from '../../../utils/useSyncValue';
7
7
  import './index.css';
@@ -23,7 +23,11 @@ label = '标题', labelVisible = true, name = 'formInput', defaultValue = '', pa
23
23
  });
24
24
  const inputType = getInputType(type, password);
25
25
  // 两次默认值不同时, 需要刷新value
26
- const [value, setValue] = useSyncValue(defaultValue);
26
+ const [value, setValue] = useSyncValue(defaultValue !== null && defaultValue !== void 0 ? defaultValue : '');
27
+ const [isFocus, setIsFocus] = React.useState(false);
28
+ const showPcClear = React.useMemo(() => {
29
+ return platform === 'pc' && clearable && isFocus && (value === null || value === void 0 ? void 0 : value.length) > 0;
30
+ }, [platform, clearable, isFocus, value === null || value === void 0 ? void 0 : value.length]);
27
31
  const onChange = function (e) {
28
32
  const text = typeof e === 'string' ? e : e.target.value;
29
33
  if (maxLength > 0 && text.length > maxLength) {
@@ -50,16 +54,20 @@ label = '标题', labelVisible = true, name = 'formInput', defaultValue = '', pa
50
54
  };
51
55
  const onFocus = function (e) {
52
56
  events.focus({ value: e.target.value }, { originEvent: e });
57
+ setIsFocus(true);
53
58
  };
54
59
  const onBlur = function (e) {
55
60
  events.blur({ value: e.target.value }, { originEvent: e });
61
+ setIsFocus(false);
56
62
  };
57
63
  const fieldEl = platform === 'h5' ? (React.createElement("div", { className: subCls },
58
64
  React.createElement("div", { className: "weui-cell__bd weui-flex" },
59
65
  React.createElement("input", { className: "weui-input", "data-testid": "weui-input-test", type: inputType, placeholder: placeholder, value: value, disabled: disabled, name: name, autoFocus: autoFocus, onChange: onChange, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown, role: "input" }),
60
66
  clearable && (React.createElement("button", { "data-testid": "weui-btn_input-clear-test", className: "weui-btn_reset weui-btn_icon weui-btn_input-clear", onMouseDown: onClear },
61
67
  React.createElement("i", { className: "weui-icon-clear" })))))) : (React.createElement(ConfigProvider, { classPrefix: "wedatea2td" },
62
- React.createElement(TeaInput, { size: size, type: inputType, placeholder: placeholder, value: value, disabled: disabled, name: name, autoFocus: autoFocus, onChange: onChange, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown })));
68
+ React.createElement("div", { className: 'weui-pc-input' },
69
+ React.createElement(TeaInput, { "data-testid": "weui-input-test-pc", className: 'pc-input', size: size, type: inputType, placeholder: placeholder, value: value, disabled: disabled, name: name, autoFocus: autoFocus, onChange: onChange, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown }),
70
+ showPcClear && (React.createElement(Icon, { "data-testid": "weui-input-test-pc-clear", className: 'pc-clear', type: "dismiss", size: "s", onMouseDown: onClear })))));
63
71
  return renderDecorator(fieldEl, decorator)({
64
72
  id,
65
73
  className: cls,
@@ -1,10 +1,11 @@
1
+ /* eslint-disable react-hooks/exhaustive-deps */
1
2
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2
3
  // @ts-nocheck
3
4
  import * as React from 'react';
4
5
  import classNames from '../../../../utils/classnames';
5
6
  import debounce from '../../../../utils/debounce';
6
7
  import { tmapApiUrl } from '../constants';
7
- import { getTMap, calculateDistance, base64LocationIcon, } from '../../../../utils/tmap';
8
+ import { getTMap, calculateDistance, base64LocationIcon } from './tmap';
8
9
  import './mapChoose.css';
9
10
  import { Icon } from 'tea-component';
10
11
  const { useEffect, useState, useRef, useMemo } = React;
@@ -54,7 +55,7 @@ export default function MapChoose({ changeLocation, onConfirm, onClose, currentL
54
55
  initMap();
55
56
  };
56
57
  script.onerror = (error) => {
57
- console.log(' load mapchoose error success', APIKEY, error);
58
+ console.error(' load mapchoose error success', APIKEY, error);
58
59
  };
59
60
  document.body.appendChild(script);
60
61
  }
@@ -229,7 +230,7 @@ export default function MapChoose({ changeLocation, onConfirm, onClose, currentL
229
230
  .catch((error) => {
230
231
  setSearchLoadingStatus(false);
231
232
  setRealLocation({ lat, lng }, []);
232
- console.log('explore error', error);
233
+ console.error('explore error', error);
233
234
  });
234
235
  }, 500);
235
236
  // 逆解析查询当前经纬度地址
@@ -260,7 +261,7 @@ export default function MapChoose({ changeLocation, onConfirm, onClose, currentL
260
261
  }
261
262
  })
262
263
  .catch((error) => {
263
- console.log('getAddress error', error);
264
+ console.error('getAddress error', error);
264
265
  let item = {
265
266
  id: 'current-location',
266
267
  location: {
@@ -317,7 +318,7 @@ export default function MapChoose({ changeLocation, onConfirm, onClose, currentL
317
318
  }
318
319
  })
319
320
  .catch((error) => {
320
- console.log('error', error);
321
+ console.error('error', error);
321
322
  });
322
323
  }
323
324
  else {
@@ -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 '../../../../utils/tmap';
6
+ import { getTMap } from '../common/tmap';
7
7
  const { useEffect, useRef, useState } = React;
8
8
  const defaultLatLng = {
9
9
  lat: null,
@@ -36,7 +36,7 @@ export default function MapView({ APIKEY = '', drag = true, zoom = true, latlng
36
36
  setMapStatus(true);
37
37
  }
38
38
  catch (error) {
39
- console.log('initMap error', error);
39
+ console.error('initMap error', error);
40
40
  }
41
41
  };
42
42
  const initMarker = () => {
@@ -64,7 +64,7 @@ export default function MapView({ APIKEY = '', drag = true, zoom = true, latlng
64
64
  }
65
65
  }
66
66
  catch (err) {
67
- console.log('initMarker err', err);
67
+ console.error('initMarker err', err);
68
68
  }
69
69
  };
70
70
  useEffect(() => {
@@ -83,7 +83,7 @@ export default function MapView({ APIKEY = '', drag = true, zoom = true, latlng
83
83
  initMap();
84
84
  };
85
85
  script.onerror = (err) => {
86
- console.log('loadScript err', err);
86
+ console.error('loadScript err', err);
87
87
  };
88
88
  document.body.appendChild(script);
89
89
  }
@@ -97,12 +97,15 @@ 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
100
101
  }, [APIKEY]);
101
102
  useEffect(() => {
102
103
  mapRef.current && mapRef.current.setDraggable(drag);
104
+ // eslint-disable-next-line react-hooks/exhaustive-deps
103
105
  }, [drag, mapRef.current]);
104
106
  useEffect(() => {
105
107
  mapRef.current && getTMap() && removeOrAddZoom(mapRef.current, getTMap());
108
+ // eslint-disable-next-line react-hooks/exhaustive-deps
106
109
  }, [zoom, mapRef.current]);
107
110
  useEffect(() => {
108
111
  const TMap = getTMap();
@@ -121,7 +124,7 @@ export default function MapView({ APIKEY = '', drag = true, zoom = true, latlng
121
124
  ]);
122
125
  }
123
126
  catch (error) {
124
- console.log('updateGeometries error view', error);
127
+ console.error('updateGeometries error view', error);
125
128
  }
126
129
  }
127
130
  }, [lat, lng, mapStatus]);
@@ -144,7 +147,7 @@ export default function MapView({ APIKEY = '', drag = true, zoom = true, latlng
144
147
  }
145
148
  }
146
149
  catch (error) {
147
- console.log('removeOrAddZoom error', error);
150
+ console.error('removeOrAddZoom error', error);
148
151
  }
149
152
  };
150
153
  // 移除缩放控件
@@ -0,0 +1,3 @@
1
+ export function getTMap(): any;
2
+ export function calculateDistance(latlng1: any, latlng2: any): number;
3
+ export const base64LocationIcon: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODQiIGhlaWdodD0iODgiIHZpZXdCb3g9IjAgMCA4NCA4OCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgb3BhY2l0eT0iMC45OCIgZmlsdGVyPSJ1cmwoI2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+ }
5
+ export function calculateDistance(latlng1, latlng2) {
6
+ let lat1 = latlng1.latitude;
7
+ let lng1 = latlng1.longitude;
8
+ let lat2 = latlng2.latitude;
9
+ let lng2 = latlng2.longitude;
10
+ var radLat1 = (lat1 * Math.PI) / 180.0;
11
+ var radLat2 = (lat2 * Math.PI) / 180.0;
12
+ var a = radLat1 - radLat2;
13
+ var b = (lng1 * Math.PI) / 180.0 - (lng2 * Math.PI) / 180.0;
14
+ var s = 2 *
15
+ Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) +
16
+ Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)));
17
+ s = s * 6378.137; // EARTH_RADIUS;
18
+ s = Math.round(s * 10000) / 10000;
19
+ return s * 1000;
20
+ }
21
+ export const base64LocationIcon = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODQiIGhlaWdodD0iODgiIHZpZXdCb3g9IjAgMCA4NCA4OCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgb3BhY2l0eT0iMC45OCIgZmlsdGVyPSJ1cmwoI2ZpbHRlcjBfZGRkXzI0NDdfNTc0OSkiPgo8Y2lyY2xlIGN4PSI0MiIgY3k9IjM2IiByPSIxMiIgZmlsbD0id2hpdGUiLz4KPC9nPgo8Y2lyY2xlIGN4PSI0MiIgY3k9IjM2IiByPSI3IiBmaWxsPSIjMDA1MkQ5Ii8+CjxkZWZzPgo8ZmlsdGVyIGlkPSJmaWx0ZXIwX2RkZF8yNDQ3XzU3NDkiIHg9IjAiIHk9IjAiIHdpZHRoPSI4NCIgaGVpZ2h0PSI4OCIgZmlsdGVyVW5pdHM9InVzZXJTcGFjZU9uVXNlIiBjb2xvci1pbnRlcnBvbGF0aW9uLWZpbHRlcnM9InNSR0IiPgo8ZmVGbG9vZCBmbG9vZC1vcGFjaXR5PSIwIiByZXN1bHQ9IkJhY2tncm91bmRJbWFnZUZp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AgMCAwIDAgMCAwIDEyNyAwIiByZXN1bHQ9ImhhcmRBbHBoYSIvPgo8ZmVPZmZzZXQgZHk9IjYiLz4KPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj0iMTUiLz4KPGZlQ29sb3JNYXRyaXggdHlwZT0ibWF0cml4IiB2YWx1ZXM9IjAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAuMDUgMCIvPgo8ZmVCbGVuZCBtb2RlPSJub3JtYWwiIGluMj0iZWZmZWN0Ml9kcm9wU2hhZG93XzI0NDdfNTc0OSIgcmVzdWx0PSJlZmZlY3QzX2Ryb3BTaGFkb3dfMjQ0N181NzQ5Ii8+CjxmZUJsZW5kIG1vZGU9Im5vcm1hbCIgaW49IlNvdXJjZUdyYXBoaWMiIGluMj0iZWZmZWN0M19kcm9wU2hhZG93XzI0NDdfNTc0OSIgcmVzdWx0PSJzaGFwZSIvPgo8L2ZpbHRlcj4KPC9kZWZzPgo8L3N2Zz4K';
@@ -63,7 +63,7 @@ export default function useLocationInfo({ apiKey: APIKEY, locationType, eventsCh
63
63
  longitude: lng,
64
64
  }, locationType === 1);
65
65
  }, (error) => {
66
- console.log('error loc', error);
66
+ console.error('error loc', error);
67
67
  currentLocations.current = null;
68
68
  setApiKeyStatus({
69
69
  status: false,
@@ -75,7 +75,7 @@ export default function useLocationInfo({ apiKey: APIKEY, locationType, eventsCh
75
75
  });
76
76
  };
77
77
  script.onerror = (error) => {
78
- console.log('Geolocation script onerror', error);
78
+ console.error('Geolocation script onerror', error);
79
79
  setApiKeyStatus({
80
80
  status: false,
81
81
  message: '定位失败',
@@ -90,6 +90,7 @@ export default function useLocationInfo({ apiKey: APIKEY, locationType, eventsCh
90
90
  document.body.appendChild(script);
91
91
  }
92
92
  loadScript();
93
+ // eslint-disable-next-line react-hooks/exhaustive-deps
93
94
  }, [APIKEY, locationType]);
94
95
  return {
95
96
  location,
@@ -69,6 +69,7 @@ export default function LocationH5(props) {
69
69
  events.change && events.change(res);
70
70
  }
71
71
  setLocation(location);
72
+ // eslint-disable-next-line react-hooks/exhaustive-deps
72
73
  }, [value, locationType]);
73
74
  useEffect(() => {
74
75
  let loc = {
@@ -83,6 +84,7 @@ export default function LocationH5(props) {
83
84
  setLocation(loc);
84
85
  // 暂不支持自定位置,初始化表单值都是{}
85
86
  events.change({ value: {} });
87
+ // eslint-disable-next-line react-hooks/exhaustive-deps
86
88
  }, [locationType]);
87
89
  useEffect(() => {
88
90
  if (checkCustomLocation(value)) {
@@ -150,7 +152,7 @@ export default function LocationH5(props) {
150
152
  });
151
153
  }
152
154
  }, (error) => {
153
- console.log('error loc', error);
155
+ console.error('error loc', error);
154
156
  currentLocations.current = null;
155
157
  setApiKeyStatus({
156
158
  status: false,
@@ -162,7 +164,7 @@ export default function LocationH5(props) {
162
164
  });
163
165
  };
164
166
  script.onerror = (error) => {
165
- console.log('Geolocation script onerror', error);
167
+ console.error('Geolocation script onerror', error);
166
168
  setApiKeyStatus({
167
169
  status: false,
168
170
  message: '定位失败',
@@ -177,6 +179,7 @@ export default function LocationH5(props) {
177
179
  document.body.appendChild(script);
178
180
  }
179
181
  loadScript();
182
+ // eslint-disable-next-line react-hooks/exhaustive-deps
180
183
  }, [APIKEY, locationType, dataSourceStatus]);
181
184
  useEffect(() => {
182
185
  // 调用连接器数据源方法
@@ -199,7 +202,7 @@ export default function LocationH5(props) {
199
202
  }
200
203
  })
201
204
  .catch((error) => {
202
- console.log('datasources error', error);
205
+ console.error('datasources error', error);
203
206
  setDataSourceStatus({
204
207
  status: false,
205
208
  message: error,
@@ -66,6 +66,7 @@ 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
69
70
  }, [value]);
70
71
  useEffect(() => {
71
72
  if (value || !currentLocations.current)
@@ -91,6 +92,7 @@ export default function LocationPC(props) {
91
92
  });
92
93
  }
93
94
  setLocation(location);
95
+ // eslint-disable-next-line react-hooks/exhaustive-deps
94
96
  }, [value, locationType]);
95
97
  const showToast = (message) => {
96
98
  weui.toast(message, {
@@ -142,7 +144,7 @@ export default function LocationPC(props) {
142
144
  }
143
145
  })
144
146
  .catch((error) => {
145
- console.log('datasources error', error);
147
+ console.error('datasources error', error);
146
148
  setDataSourceStatus({
147
149
  status: false,
148
150
  message: error,
@@ -156,6 +158,7 @@ export default function LocationPC(props) {
156
158
  });
157
159
  showToast('请配置地图连接器');
158
160
  }
161
+ // eslint-disable-next-line react-hooks/exhaustive-deps
159
162
  }, [dataSource]);
160
163
  useEffect(() => {
161
164
  let loc = {
@@ -187,6 +190,7 @@ export default function LocationPC(props) {
187
190
  poiname: loc.poiname,
188
191
  detailedAddress: loc.detailedAddress,
189
192
  }, true);
193
+ // eslint-disable-next-line react-hooks/exhaustive-deps
190
194
  }, [locationType]);
191
195
  const getIsShowMap = () => {
192
196
  let status = showMap;
@@ -4,8 +4,15 @@ import './index.css';
4
4
  import { usePlatform } from '../../../utils/platform';
5
5
  import LocationH5 from './components/LocationH5/location.h5';
6
6
  import LocationPC from './components/LocationPC/location.PC';
7
+ import { CommonErrorBoundary } from '../../common/error-boundary';
8
+ import { useLoopRenderDetect } from '../../common/use-loop-render-detect';
7
9
  export default function Location(props) {
10
+ return (React.createElement(CommonErrorBoundary, null,
11
+ React.createElement(LocationImpl, { ...props })));
12
+ }
13
+ function LocationImpl(props) {
8
14
  const platform = usePlatform();
15
+ useLoopRenderDetect();
9
16
  if ((props === null || props === void 0 ? void 0 : props.showType) === 'pc') {
10
17
  return React.createElement(LocationPC, { ...props });
11
18
  }
@@ -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
- });
41
+ }, [option]);
42
42
  useEffect(() => {
43
43
  // 如果绑定字段类型为枚举,且传入自定义选项集的名称则默认使用自定义选项集的内容作为选项
44
44
  if (format === 'x-enum' && enumName) {
45
45
  fetchData({ OptNameList: [enumName], PageIndex: 1, PageSize: 10 });
46
46
  }
47
- }, []);
47
+ }, [enumName, format]);
48
48
  useEffect(() => {
49
49
  if (format !== 'x-enum') {
50
50
  setOption(range);
51
51
  }
52
- }, [range]);
52
+ }, [format, range]);
53
53
  const fetchData = async (param) => {
54
54
  var _a, _b, _c;
55
55
  const data = await callWedaApi({
@@ -1,3 +1,4 @@
1
+ /* eslint-disable react-hooks/exhaustive-deps */
1
2
  import React, { useEffect, useRef, useState } from 'react';
2
3
  import Calendar from './calendar';
3
4
  import { Portal } from '../../../common/portal';
@@ -75,9 +75,17 @@ defaultRegion, defaultMutiRegion, separator, regionType, onChange, }) {
75
75
  defaultMutiRegion,
76
76
  };
77
77
  }
78
- });
78
+ }, [
79
+ defaultValue,
80
+ defaultDate,
81
+ defaultTime,
82
+ defaultRegion,
83
+ defaultMutiRegion,
84
+ regionType,
85
+ dateMode,
86
+ ]);
79
87
  //实现初始值触发change事件
80
- const defaultMutiRegionChange = function (treeValue, defaultMutiRegion) {
88
+ const defaultMutiRegionChange = React.useCallback(function (treeValue, defaultMutiRegion) {
81
89
  var _a;
82
90
  const defaultValue = defaultMutiRegion
83
91
  ? defaultMutiRegion.split(',')
@@ -96,7 +104,7 @@ defaultRegion, defaultMutiRegion, separator, regionType, onChange, }) {
96
104
  });
97
105
  (_a = events === null || events === void 0 ? void 0 : events.change) === null || _a === void 0 ? void 0 : _a.call(events, { value: defaultMutiRegion, result: changeValue });
98
106
  }
99
- };
107
+ }, [events]);
100
108
  React.useEffect(() => {
101
109
  if (mode == 'region' || mode == 'mutiRegion') {
102
110
  if (regionData.length < 1) {
@@ -131,7 +139,13 @@ defaultRegion, defaultMutiRegion, separator, regionType, onChange, }) {
131
139
  break;
132
140
  }
133
141
  }
134
- }, [regionType, mode, regionData]);
142
+ }, [
143
+ regionType,
144
+ mode,
145
+ regionData,
146
+ defaultMutiRegionChange,
147
+ defaultMutiRegion,
148
+ ]);
135
149
  const onDateclick = function () {
136
150
  const options = {
137
151
  className: 'weda-ui weda-picker',
@@ -12,11 +12,18 @@ import { emptyObject } from '../../../utils/constant';
12
12
  import { PureSelectPc } from './dropdown-select/ui';
13
13
  import { useOptions } from './use-options';
14
14
  import { getRegionTree, getAreaCode } from './region';
15
+ import { CommonErrorBoundary } from '../../common/error-boundary';
16
+ import { useLoopRenderDetect } from '../../common/use-loop-render-detect';
15
17
  // @ts-ignore TODO: fix 与plugin构建阶段效果不同
16
18
  export const moment = (typeof _moment === 'function' ? _moment : _moment.default);
17
19
  export default function Select(props) {
20
+ return (React.createElement(CommonErrorBoundary, null,
21
+ React.createElement(SelectImpl, { ...props })));
22
+ }
23
+ function SelectImpl(props) {
18
24
  const { id, style, className, label = '标题', labelVisible = true, layout = 'horizontal', requiredFlag = false, size = 'l', decorator, } = props;
19
25
  const platform = usePlatform();
26
+ useLoopRenderDetect();
20
27
  let selectEl;
21
28
  if (platform === 'h5') {
22
29
  selectEl = React.createElement(SelectH5, { ...props });
@@ -125,7 +132,14 @@ function SelectPc({ where, dataSourceName, viewId, format, primaryField, enumNam
125
132
  defaultMutiRegion,
126
133
  };
127
134
  }
128
- });
135
+ }, [
136
+ defaultValue,
137
+ defaultDate,
138
+ defaultTime,
139
+ defaultRegion,
140
+ defaultMutiRegion,
141
+ dateMode,
142
+ ]);
129
143
  React.useEffect(() => {
130
144
  if (mode == 'region' || mode == 'mutiRegion') {
131
145
  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
- }, [state, state.status]);
101
+ }, [setOptions, state, state.status]);
102
102
  return [options];
103
103
  }
@@ -36,7 +36,7 @@ export function ImageUploaderH5({ title, maxUploadCount, maxSize = 10, acceptTyp
36
36
  return inputValue;
37
37
  }
38
38
  return [];
39
- }, [inputValue]);
39
+ }, [inputValue, setInputValue]);
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
- }, [fileIdList]);
62
+ }, [events, fileIdList, onChange, single]);
63
63
  const onProgress = (progressEvent) => {
64
64
  let percentCompleted = 0;
65
65
  try {
@@ -53,7 +53,7 @@ export function UploaderPCInner(props) {
53
53
  initialValue = initialValue[0] ? [initialValue[0]] : [];
54
54
  }
55
55
  setfileIDList(initialValue);
56
- }, [defaultValue]);
56
+ }, [defaultValue, single]);
57
57
  // 值变化事件
58
58
  React.useEffect(() => {
59
59
  if (!isObjectEqual(fileRef.current, fileIDList)) {
@@ -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
- }, [fileIDList]);
73
+ }, [events, fileIDList, onChange, single]);
74
74
  // 外层组件类
75
75
  const cls = classNames({
76
76
  'weda-ui': true,
@@ -218,12 +218,9 @@ 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]);
222
- React.useEffect(() => {
223
- handleUpload(file);
224
- }, [file === null || file === void 0 ? void 0 : file._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]);
225
222
  // 上传过程
226
- const handleUpload = async (file) => {
223
+ const handleUpload = React.useCallback(async (file) => {
227
224
  var _a;
228
225
  const tcb = await getCloudInstance();
229
226
  try {
@@ -245,7 +242,12 @@ const TcbFileUpload = ({ file, disabled }) => {
245
242
  setStatus('UPLOAD_STATUS_ERROR');
246
243
  (_a = events === null || events === void 0 ? void 0 : events.error) === null || _a === void 0 ? void 0 : _a.call(events, err);
247
244
  }
248
- };
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]);
249
251
  return (React.createElement("div", { className: `${CLASS_PREFIX}__item`, role: "TcbFileUpload" },
250
252
  React.createElement("div", { className: `${CLASS_PREFIX}__item-left` },
251
253
  React.createElement(UploadFileStatus, { status: status, percent: percent, size: size, title: title, percentSize: (((file === null || file === void 0 ? void 0 : file.size) / 1024) * percent) / 100 })),