@cloudbase/weda-ui 3.3.2 → 3.3.3
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.
- package/dist/web/components/calendar/index.js +37 -39
- package/dist/web/components/carousel/index.js +62 -62
- package/dist/web/components/chart/bar/index.js +0 -4
- package/dist/web/components/chart/common/Chart.d.ts +0 -1
- package/dist/web/components/chart/common/Chart.js +1 -9
- package/dist/web/components/chart/common/chart-custom-connector.js +1 -1
- package/dist/web/components/chart/common/core/eChartBase.js +1 -1
- package/dist/web/components/chart/common/data-transform.js +1 -1
- package/dist/web/components/chart/common/useChart.js +2 -11
- package/dist/web/components/common/use-loop-render-detect.d.ts +2 -2
- package/dist/web/components/common/use-loop-render-detect.js +7 -9
- package/dist/web/components/form/checkbox/index.js +29 -29
- package/dist/web/components/form/form/index.js +1 -3
- package/dist/web/components/form/location/common/mapChoose.js +1 -2
- package/dist/web/components/form/location/common/mapView.js +1 -4
- package/dist/web/components/form/location/components/LocationPC/location.PC.js +0 -4
- package/dist/web/components/form/radio/index.js +3 -3
- package/dist/web/components/form/select/allTimePicker/index.js +0 -1
- package/dist/web/components/form/select/h5.js +4 -18
- package/dist/web/components/form/select/index.js +1 -8
- package/dist/web/components/form/select/use-options.js +1 -1
- package/dist/web/components/form/uploader/uploader.h5.js +2 -2
- package/dist/web/components/form/uploader/uploader.pc.js +1 -1
- package/dist/web/components/form/uploaderFile/uploadFile.h5.js +7 -9
- package/dist/web/components/form/uploaderFile/uploadFile.pc.js +6 -9
- package/dist/web/components/formdetail/index.js +10 -12
- package/dist/web/components/graphicCard/index.js +6 -5
- package/dist/web/components/image/index.js +1 -1
- package/dist/web/components/listView/index.js +0 -1
- package/dist/web/components/lottery/index.js +16 -10
- package/dist/web/components/navLayout/index.js +1 -1
- package/dist/web/components/navigationBar/horizontalMenu.js +1 -1
- package/dist/web/components/richText/index.js +2 -1
- package/dist/web/components/richTextView/index.js +18 -20
- package/dist/web/components/scrollView/index.d.ts +0 -1
- package/dist/web/components/scrollView/index.js +4 -6
- package/dist/web/components/swiper/index.js +62 -62
- package/dist/web/components/text/index.js +8 -10
- package/dist/web/components/uploaderView/index.js +1 -1
- package/dist/web/components/wedaVideo/index.js +2 -14
- package/dist/web/utils/tmap.d.ts +3 -0
- package/dist/web/utils/tmap.js +21 -0
- package/dist/web/utils/useSyncValue.js +0 -1
- package/package.json +20 -20
|
@@ -50,45 +50,43 @@ export default function Calendar({ className, style, initVisible, initValue, con
|
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
return [yearList, monthList];
|
|
53
|
-
}, [year]);
|
|
54
|
-
//
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
configArr
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
item.matchDate = date.join('-');
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
for (const item of configArr) {
|
|
74
|
-
_map.set(item.matchDate, item);
|
|
75
|
-
}
|
|
76
|
-
return configList.map((item) => {
|
|
77
|
-
return item.reduce((res, i) => {
|
|
78
|
-
if (_map.has(i.formattedDate)) {
|
|
79
|
-
const _disabled = _map.get(i.formattedDate)['disabled'];
|
|
80
|
-
const _marked = _map.get(i.formattedDate)['marked'];
|
|
81
|
-
i['disabled'] =
|
|
82
|
-
_disabled !== undefined ? JSON.parse(_disabled) : false;
|
|
83
|
-
i['marked'] = _marked;
|
|
84
|
-
}
|
|
85
|
-
res.push(i);
|
|
86
|
-
return res;
|
|
87
|
-
}, []);
|
|
53
|
+
}, [year, month]);
|
|
54
|
+
// 匹配数据
|
|
55
|
+
const _dateList = (configList) => {
|
|
56
|
+
const _map = new Map();
|
|
57
|
+
const configArr = JSON.parse(JSON.stringify(configData));
|
|
58
|
+
// 补日期的零
|
|
59
|
+
configArr &&
|
|
60
|
+
configArr.length &&
|
|
61
|
+
configArr.map((item) => {
|
|
62
|
+
if (item.matchDate === '' || item.matchDate === undefined)
|
|
63
|
+
return;
|
|
64
|
+
const date = item.matchDate.split('-');
|
|
65
|
+
const day = date[2].split('');
|
|
66
|
+
if (day.length === 1) {
|
|
67
|
+
date[2] = `0${date[2]}`;
|
|
68
|
+
item.matchDate = date.join('-');
|
|
69
|
+
}
|
|
88
70
|
});
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
71
|
+
for (const item of configArr) {
|
|
72
|
+
_map.set(item.matchDate, item);
|
|
73
|
+
}
|
|
74
|
+
return configList.map((item) => {
|
|
75
|
+
return item.reduce((res, i) => {
|
|
76
|
+
if (_map.has(i.formattedDate)) {
|
|
77
|
+
const _disabled = _map.get(i.formattedDate)['disabled'];
|
|
78
|
+
const _marked = _map.get(i.formattedDate)['marked'];
|
|
79
|
+
i['disabled'] =
|
|
80
|
+
_disabled !== undefined ? JSON.parse(_disabled) : false;
|
|
81
|
+
i['marked'] = _marked;
|
|
82
|
+
}
|
|
83
|
+
res.push(i);
|
|
84
|
+
return res;
|
|
85
|
+
}, []);
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
// 日历单元格数据
|
|
89
|
+
const dateList = useMemo(() => _dateList(createDateList(year, month, firstDayOfWeek, value, format)), [year, month, firstDayOfWeek, format, value, configData]);
|
|
92
90
|
// 表头数组
|
|
93
91
|
const colHeaderList = useMemo(() => {
|
|
94
92
|
const weekTextArr = week;
|
|
@@ -114,7 +112,7 @@ export default function Calendar({ className, style, initVisible, initValue, con
|
|
|
114
112
|
}
|
|
115
113
|
}
|
|
116
114
|
return list;
|
|
117
|
-
}, []);
|
|
115
|
+
}, [firstDayOfWeek, isShowWeekend, week]);
|
|
118
116
|
// 补零
|
|
119
117
|
// const fix0 = (num) => {
|
|
120
118
|
// return num < 10 ? `0${num}` : num;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { useState, useEffect, useRef
|
|
2
|
+
import { useState, useEffect, useRef } from 'react';
|
|
3
3
|
import classNames from '../../utils/classnames';
|
|
4
4
|
import Swipe from 'react-easy-swipe';
|
|
5
5
|
import { useDebouncedCallback, useEventListener, useResizeObserver, } from '@react-hookz/web';
|
|
@@ -13,15 +13,6 @@ export default function Carousel({ className, style, autoplay, circular, vertica
|
|
|
13
13
|
const [swipeStyle, setSwipeStyle] = useState(null);
|
|
14
14
|
const [height, setHeight] = useState(0);
|
|
15
15
|
const { change = () => { } } = events;
|
|
16
|
-
const setIndex = useCallback((index) => {
|
|
17
|
-
if (index >= itemCount) {
|
|
18
|
-
index = 0;
|
|
19
|
-
}
|
|
20
|
-
if (index < 0) {
|
|
21
|
-
index = itemCount - 1;
|
|
22
|
-
}
|
|
23
|
-
setCurrentIndex(index);
|
|
24
|
-
}, [itemCount, setCurrentIndex]);
|
|
25
16
|
// 自动切换
|
|
26
17
|
useEffect(() => {
|
|
27
18
|
if (autoplay) {
|
|
@@ -32,60 +23,10 @@ export default function Carousel({ className, style, autoplay, circular, vertica
|
|
|
32
23
|
}, interval);
|
|
33
24
|
return () => clearInterval(timer);
|
|
34
25
|
}
|
|
35
|
-
}, [currentIndex, autoplay
|
|
26
|
+
}, [currentIndex, autoplay]);
|
|
36
27
|
// 触发切换
|
|
37
28
|
const pre = useRef({ index: currentIndex }).current;
|
|
38
29
|
useEffect(() => {
|
|
39
|
-
// 设置容器样式、动画
|
|
40
|
-
// TODO fix settimeout mess
|
|
41
|
-
const updateSwipeStyle = (to, cur, length) => {
|
|
42
|
-
let style = {};
|
|
43
|
-
// 最后向前到最开始
|
|
44
|
-
if (to === 0 && cur === length - 1) {
|
|
45
|
-
circular &&
|
|
46
|
-
setSwipeStyle({
|
|
47
|
-
transform: `translate3d(0, 0, 0)`,
|
|
48
|
-
});
|
|
49
|
-
// eslint-disable-next-line rulesdir/no-timer
|
|
50
|
-
setTimeout(() => {
|
|
51
|
-
setSwipeStyle({
|
|
52
|
-
transform: vertical
|
|
53
|
-
? `translate3d(0, -100%, 0)`
|
|
54
|
-
: `translate3d(-100%, 0, 0)`,
|
|
55
|
-
transitionDuration: `${duration}ms`,
|
|
56
|
-
});
|
|
57
|
-
}, 50);
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
// 第一个后退到最后
|
|
61
|
-
if (to === length - 1 && cur === 0) {
|
|
62
|
-
circular &&
|
|
63
|
-
setSwipeStyle({
|
|
64
|
-
transform: vertical
|
|
65
|
-
? `translate3d(0, -${(to + 2) * 100}%, 0)`
|
|
66
|
-
: `translate3d(-${(to + 2) * 100}%, 0, 0)`,
|
|
67
|
-
});
|
|
68
|
-
// eslint-disable-next-line rulesdir/no-timer
|
|
69
|
-
setTimeout(() => {
|
|
70
|
-
setSwipeStyle({
|
|
71
|
-
transform: vertical
|
|
72
|
-
? `translate3d(0, -${(to + 1) * 100}%, 0)`
|
|
73
|
-
: `translate3d(-${(to + 1) * 100}%, 0, 0)`,
|
|
74
|
-
transitionDuration: `${duration}ms`,
|
|
75
|
-
});
|
|
76
|
-
}, 50);
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
style = {
|
|
80
|
-
transform: vertical
|
|
81
|
-
? `translate3d(0, -${(to + 1) * 100}%, 0)`
|
|
82
|
-
: `translate3d(-${(to + 1) * 100}%, 0, 0)`,
|
|
83
|
-
};
|
|
84
|
-
if (to !== cur) {
|
|
85
|
-
style.transitionDuration = `${duration}ms`;
|
|
86
|
-
}
|
|
87
|
-
setSwipeStyle(style);
|
|
88
|
-
};
|
|
89
30
|
updateSwipeStyle(currentIndex, pre.index, itemCount);
|
|
90
31
|
change({
|
|
91
32
|
current: currentIndex,
|
|
@@ -93,7 +34,7 @@ export default function Carousel({ className, style, autoplay, circular, vertica
|
|
|
93
34
|
return () => {
|
|
94
35
|
pre.index = currentIndex;
|
|
95
36
|
};
|
|
96
|
-
}, [currentIndex, vertical
|
|
37
|
+
}, [currentIndex, vertical]);
|
|
97
38
|
const outerWrapRef = useRef();
|
|
98
39
|
useEventListener(outerWrapRef, 'load', (e) => {
|
|
99
40
|
setHeight(e.target.clientHeight);
|
|
@@ -105,6 +46,65 @@ export default function Carousel({ className, style, autoplay, circular, vertica
|
|
|
105
46
|
width: x.width ? x.width : '100%',
|
|
106
47
|
} })));
|
|
107
48
|
});
|
|
49
|
+
const setIndex = (index) => {
|
|
50
|
+
if (index >= itemCount) {
|
|
51
|
+
index = 0;
|
|
52
|
+
}
|
|
53
|
+
if (index < 0) {
|
|
54
|
+
index = itemCount - 1;
|
|
55
|
+
}
|
|
56
|
+
setCurrentIndex(index);
|
|
57
|
+
};
|
|
58
|
+
// 设置容器样式、动画
|
|
59
|
+
// TODO fix settimeout mess
|
|
60
|
+
const updateSwipeStyle = (to, cur, length) => {
|
|
61
|
+
let style = {};
|
|
62
|
+
// 最后向前到最开始
|
|
63
|
+
if (to === 0 && cur === length - 1) {
|
|
64
|
+
circular &&
|
|
65
|
+
setSwipeStyle({
|
|
66
|
+
transform: `translate3d(0, 0, 0)`,
|
|
67
|
+
});
|
|
68
|
+
// eslint-disable-next-line rulesdir/no-timer
|
|
69
|
+
setTimeout(() => {
|
|
70
|
+
setSwipeStyle({
|
|
71
|
+
transform: vertical
|
|
72
|
+
? `translate3d(0, -100%, 0)`
|
|
73
|
+
: `translate3d(-100%, 0, 0)`,
|
|
74
|
+
transitionDuration: `${duration}ms`,
|
|
75
|
+
});
|
|
76
|
+
}, 50);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
// 第一个后退到最后
|
|
80
|
+
if (to === length - 1 && cur === 0) {
|
|
81
|
+
circular &&
|
|
82
|
+
setSwipeStyle({
|
|
83
|
+
transform: vertical
|
|
84
|
+
? `translate3d(0, -${(to + 2) * 100}%, 0)`
|
|
85
|
+
: `translate3d(-${(to + 2) * 100}%, 0, 0)`,
|
|
86
|
+
});
|
|
87
|
+
// eslint-disable-next-line rulesdir/no-timer
|
|
88
|
+
setTimeout(() => {
|
|
89
|
+
setSwipeStyle({
|
|
90
|
+
transform: vertical
|
|
91
|
+
? `translate3d(0, -${(to + 1) * 100}%, 0)`
|
|
92
|
+
: `translate3d(-${(to + 1) * 100}%, 0, 0)`,
|
|
93
|
+
transitionDuration: `${duration}ms`,
|
|
94
|
+
});
|
|
95
|
+
}, 50);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
style = {
|
|
99
|
+
transform: vertical
|
|
100
|
+
? `translate3d(0, -${(to + 1) * 100}%, 0)`
|
|
101
|
+
: `translate3d(-${(to + 1) * 100}%, 0, 0)`,
|
|
102
|
+
};
|
|
103
|
+
if (to !== cur) {
|
|
104
|
+
style.transitionDuration = `${duration}ms`;
|
|
105
|
+
}
|
|
106
|
+
setSwipeStyle(style);
|
|
107
|
+
};
|
|
108
108
|
return (React.createElement("div", { className: classNames('g-swiper weda-ui g-carousel', className, {
|
|
109
109
|
vertical: vertical,
|
|
110
110
|
}), style: { height: height ? height : 'auto', ...style }, ref: outerWrapRef, id: id, "data-testid": "carousel" },
|
|
@@ -5,10 +5,7 @@ import { Chart } from '../common/Chart';
|
|
|
5
5
|
import { emptyArray } from '../../../utils/constant';
|
|
6
6
|
import { ChartCustomConnector } from '../common/chart-custom-connector';
|
|
7
7
|
import { CommonErrorBoundary } from '../../common/error-boundary';
|
|
8
|
-
import { debug } from '../../../utils/console';
|
|
9
|
-
const logger = debug('bar:impl');
|
|
10
8
|
function BarImpl(props) {
|
|
11
|
-
logger.log(props, checkIsNewData(props));
|
|
12
9
|
if (props.dataSourceType === 'data-model') {
|
|
13
10
|
if (checkIsNewData(props)) {
|
|
14
11
|
props.dataSource = {
|
|
@@ -24,7 +21,6 @@ function BarImpl(props) {
|
|
|
24
21
|
oldBarProps['connectorMethod'] = undefined;
|
|
25
22
|
oldBarProps['connectorParams'] = undefined;
|
|
26
23
|
oldBarProps['connector'] = undefined;
|
|
27
|
-
debug('bar:old').log('OldBar', oldBarProps);
|
|
28
24
|
return React.createElement(OldBar, { ...oldBarProps });
|
|
29
25
|
}
|
|
30
26
|
else if (props.dataSourceType === 'variable') {
|
|
@@ -3,7 +3,6 @@ import type { CommonPropsType } from '../../../types';
|
|
|
3
3
|
import type { ECOption } from './echarts';
|
|
4
4
|
interface IChartProps extends CommonPropsType {
|
|
5
5
|
chartOptions: ECOption;
|
|
6
|
-
showLoading?: boolean;
|
|
7
6
|
['data-testid']: string;
|
|
8
7
|
}
|
|
9
8
|
export declare function Chart(props: IChartProps): JSX.Element;
|
|
@@ -2,7 +2,7 @@ import React, { useEffect, useRef } from 'react';
|
|
|
2
2
|
import classNames from '../../../utils/classnames';
|
|
3
3
|
import { useChart } from './useChart';
|
|
4
4
|
export function Chart(props) {
|
|
5
|
-
const { id, style, className, chartOptions,
|
|
5
|
+
const { id, style, className, chartOptions, 'data-testid': dataTestId, } = props;
|
|
6
6
|
const inlineStyle = {
|
|
7
7
|
height: '380px',
|
|
8
8
|
width: '100%',
|
|
@@ -15,14 +15,6 @@ export function Chart(props) {
|
|
|
15
15
|
var _a;
|
|
16
16
|
(_a = chart === null || chart === void 0 ? void 0 : chart.setOption) === null || _a === void 0 ? void 0 : _a.call(chart, chartOptions);
|
|
17
17
|
}, [chart, chartOptions]);
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
if (showLoading === true) {
|
|
20
|
-
chart === null || chart === void 0 ? void 0 : chart.showLoading();
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
chart === null || chart === void 0 ? void 0 : chart.hideLoading();
|
|
24
|
-
}
|
|
25
|
-
}, [showLoading, chart]);
|
|
26
18
|
return (React.createElement("div", { id: id, "data-testid": dataTestId, ref: ref, style: inlineStyle, className: classNames({
|
|
27
19
|
'echart-wrapper-canvas': true,
|
|
28
20
|
'echart-dark-body': true,
|
|
@@ -21,7 +21,7 @@ export const ChartCustomConnector = (props) => {
|
|
|
21
21
|
}, []);
|
|
22
22
|
useEffect(() => {
|
|
23
23
|
actions.execute();
|
|
24
|
-
}, [connector, connectorMethod, connectorParams
|
|
24
|
+
}, [connector, connectorMethod, connectorParams]);
|
|
25
25
|
if (state.error) {
|
|
26
26
|
throw state.error;
|
|
27
27
|
}
|
|
@@ -19,7 +19,7 @@ class EchartBase extends AbstractEchartBaseModal {
|
|
|
19
19
|
});
|
|
20
20
|
this.config = getConfig();
|
|
21
21
|
}
|
|
22
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
23
23
|
async setOptions(_options) { }
|
|
24
24
|
/** 获取所有配置好的图表数据 */
|
|
25
25
|
getOptions() {
|
|
@@ -175,7 +175,7 @@ export function transform(chartType, dataInput, chartInput) {
|
|
|
175
175
|
});
|
|
176
176
|
});
|
|
177
177
|
}
|
|
178
|
-
logger.log(dataInput, chartInput);
|
|
178
|
+
logger.log(dataInput, chartInput, 'TRANSFORM');
|
|
179
179
|
if (chartType === 'bar' || chartType === 'line') {
|
|
180
180
|
const xAxis = {
|
|
181
181
|
name: chartInput.isXaxisName ? chartInput.xAxisName : '',
|
|
@@ -32,7 +32,6 @@ export function useWedaChart(domRef, ModalClass, options) {
|
|
|
32
32
|
const getOptions = async () => {
|
|
33
33
|
const chartModal = new ModalClass();
|
|
34
34
|
let finalOptions = await chartModal.setOptions(options);
|
|
35
|
-
logger.log(options, finalOptions);
|
|
36
35
|
if (!finalOptions) {
|
|
37
36
|
finalOptions = chartModal.getOptions();
|
|
38
37
|
}
|
|
@@ -50,16 +49,8 @@ export function useWedaChart(domRef, ModalClass, options) {
|
|
|
50
49
|
actions,
|
|
51
50
|
]);
|
|
52
51
|
useEffect(() => {
|
|
53
|
-
if (state.status === 'loading' || state.status === 'not-executed') {
|
|
54
|
-
chart === null || chart === void 0 ? void 0 : chart.showLoading();
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
chart === null || chart === void 0 ? void 0 : chart.hideLoading();
|
|
58
|
-
}, [chart, state.status]);
|
|
59
|
-
useEffect(() => {
|
|
60
|
-
logger.log(state, state.result);
|
|
61
52
|
if (state.status === 'success' && chart) {
|
|
62
|
-
logger.log(options, state.result, window.location.href);
|
|
53
|
+
logger.log(ModalClass.name, options, state.result, window.location.href);
|
|
63
54
|
chart.setOption(state.result, true // noMerge 全刷
|
|
64
55
|
);
|
|
65
56
|
}
|
|
@@ -68,5 +59,5 @@ export function useWedaChart(domRef, ModalClass, options) {
|
|
|
68
59
|
console.error(state.error);
|
|
69
60
|
}
|
|
70
61
|
}
|
|
71
|
-
}, [
|
|
62
|
+
}, [chart, state]);
|
|
72
63
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export declare const useRenderCount: () => [number, () => void];
|
|
2
|
-
declare type ILoopRenderDetectOptions =
|
|
2
|
+
declare type ILoopRenderDetectOptions = {
|
|
3
3
|
limit?: number;
|
|
4
4
|
throwError?: boolean;
|
|
5
5
|
message?: string;
|
|
6
6
|
timeWindowMs?: number;
|
|
7
|
-
}
|
|
7
|
+
};
|
|
8
8
|
export declare class DetectedRenderLoppError extends Error {
|
|
9
9
|
}
|
|
10
10
|
export declare const useLoopRenderDetect: (inputOptions?: ILoopRenderDetectOptions) => boolean;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { useSyncedRef } from '@react-hookz/web';
|
|
2
2
|
import { useCallback, useEffect, useRef } from 'react';
|
|
3
|
-
import { debug } from '../../utils/console';
|
|
4
3
|
export const useRenderCount = () => {
|
|
5
4
|
const countRef = useRef(0);
|
|
6
5
|
const syncedRef = useSyncedRef(++countRef.current);
|
|
@@ -83,7 +82,6 @@ const defaultOptions = {
|
|
|
83
82
|
message: '组件控制逻辑出现死循环,请检查并修改相关配置',
|
|
84
83
|
timeWindowMs: 6 * 1000,
|
|
85
84
|
};
|
|
86
|
-
const logger = debug('useLoopRenderDetect');
|
|
87
85
|
export class DetectedRenderLoppError extends Error {
|
|
88
86
|
}
|
|
89
87
|
export const useLoopRenderDetect = (inputOptions = defaultOptions) => {
|
|
@@ -104,14 +102,14 @@ export const useLoopRenderDetect = (inputOptions = defaultOptions) => {
|
|
|
104
102
|
clearTimeout(id);
|
|
105
103
|
}
|
|
106
104
|
};
|
|
107
|
-
}, [
|
|
105
|
+
}, []);
|
|
108
106
|
const fps = useFps();
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
});
|
|
107
|
+
// console.log({
|
|
108
|
+
// timeWindow: options.timeWindowMs,
|
|
109
|
+
// fps,
|
|
110
|
+
// renderCount,
|
|
111
|
+
// limit: options.limit,
|
|
112
|
+
// });
|
|
115
113
|
if ((renderCount > options.limit && fps < 1) ||
|
|
116
114
|
renderCount > options.limit * 3) {
|
|
117
115
|
reset();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { 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,8 +39,33 @@ 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
|
-
|
|
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) => {
|
|
44
69
|
var _a, _b, _c;
|
|
45
70
|
const data = await callWedaApi({
|
|
46
71
|
action: 'DescribeGeneralOptionsDetailList',
|
|
@@ -66,32 +91,7 @@ name = 'formCheckbox', label = '标题', labelVisible = true, format = '', enumN
|
|
|
66
91
|
};
|
|
67
92
|
});
|
|
68
93
|
setOption(opt);
|
|
69
|
-
}
|
|
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]);
|
|
94
|
+
};
|
|
95
95
|
/**
|
|
96
96
|
* 在ios h5端, label和input的绑定不生效
|
|
97
97
|
* 导致 onChange 事件触发有问题, 所以改为监听 onClick 事件
|
|
@@ -80,8 +80,6 @@ export default function Form({ className, contentSlot, style, id, layout, formTy
|
|
|
80
80
|
platform,
|
|
81
81
|
methodGetItem,
|
|
82
82
|
paramGetItem,
|
|
83
|
-
appCloud,
|
|
84
|
-
events,
|
|
85
83
|
]);
|
|
86
84
|
React.useEffect(() => {
|
|
87
85
|
// 因编辑器render时序问题暂不上线
|
|
@@ -126,7 +124,7 @@ export default function Form({ className, contentSlot, style, id, layout, formTy
|
|
|
126
124
|
// // 在表单容器里面的表单元素 if 默认是 false,需要通过onInitDataSourceFieldsWithAuth设置为true
|
|
127
125
|
// events?.onInitDataSourceFieldsWithAuth?.({ isDataModel });
|
|
128
126
|
// }
|
|
129
|
-
}, [formType, isDataModel, platform, dataSourceName
|
|
127
|
+
}, [formType, isDataModel, platform, dataSourceName]);
|
|
130
128
|
// pc 渲染
|
|
131
129
|
const renderPc = () => {
|
|
132
130
|
return (React.createElement(ConfigProvider, { classPrefix: "wedatea2td" },
|
|
@@ -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 '
|
|
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;
|
|
@@ -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 '
|
|
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();
|
|
@@ -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
|
-
}
|
|
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
|
-
}, [
|
|
47
|
+
}, []);
|
|
48
48
|
useEffect(() => {
|
|
49
49
|
if (format !== 'x-enum') {
|
|
50
50
|
setOption(range);
|
|
51
51
|
}
|
|
52
|
-
}, [
|
|
52
|
+
}, [range]);
|
|
53
53
|
const fetchData = async (param) => {
|
|
54
54
|
var _a, _b, _c;
|
|
55
55
|
const data = await callWedaApi({
|
|
@@ -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 =
|
|
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
|
-
}
|
|
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',
|