@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.
- 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/enumSelect/MultipleSelect.d.ts +2 -2
- package/dist/web/components/form/enumSelect/NormalSelect.d.ts +2 -2
- package/dist/web/components/form/enumSelect/index.d.ts +2 -2
- package/dist/web/components/form/enumSelect/props/propsTypes.d.ts +2 -2
- package/dist/web/components/form/form/index.js +1 -3
- package/dist/web/components/form/location/common/mapChoose.js +9 -10
- package/dist/web/components/form/location/common/mapView.js +1 -4
- package/dist/web/components/form/location/common/propsConfig.d.ts +1 -1
- package/dist/web/components/form/location/common/useLocationInfo.d.ts +1 -1
- 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 +8 -7
- package/dist/web/components/form/uploader/uploader.pc.d.ts +1 -0
- package/dist/web/components/form/uploader/uploader.pc.js +17 -4
- 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/form/userOrgSelect/departTreeSelect/departTreeSelect.pc.js +6 -7
- package/dist/web/components/form/userOrgSelect/userOrgSelect.css +17 -3
- package/dist/web/components/form/userOrgSelect/userTreeSelect.pc.js +6 -7
- 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/{components/form/location/common → utils}/tmap.d.ts +0 -0
- package/dist/web/{components/form/location/common → utils}/tmap.js +0 -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 事件
|
|
@@ -26,7 +26,7 @@ declare function MultipleSelect({ id, style, className, events, label, labelVisi
|
|
|
26
26
|
declare namespace MultipleSelect {
|
|
27
27
|
const propTypes: {
|
|
28
28
|
events: import("prop-types").Requireable<object>;
|
|
29
|
-
defaultValue: import("prop-types").Requireable<
|
|
29
|
+
defaultValue: import("prop-types").Requireable<string | number>;
|
|
30
30
|
name: import("prop-types").Requireable<string>;
|
|
31
31
|
placeholder: import("prop-types").Requireable<string>;
|
|
32
32
|
disabled: import("prop-types").Requireable<boolean>;
|
|
@@ -39,7 +39,7 @@ declare namespace MultipleSelect {
|
|
|
39
39
|
virtual: import("prop-types").Requireable<boolean>;
|
|
40
40
|
searchable: import("prop-types").Requireable<boolean>;
|
|
41
41
|
size: import("prop-types").Requireable<string>;
|
|
42
|
-
value: import("prop-types").Requireable<
|
|
42
|
+
value: import("prop-types").Requireable<string | any[]>;
|
|
43
43
|
enumType: import("prop-types").Requireable<string>;
|
|
44
44
|
customEnum: import("prop-types").Requireable<any[]>;
|
|
45
45
|
optionId: import("prop-types").Requireable<string>;
|
|
@@ -25,7 +25,7 @@ declare const NormalSelect: {
|
|
|
25
25
|
}): JSX.Element;
|
|
26
26
|
propTypes: {
|
|
27
27
|
events: import("prop-types").Requireable<object>;
|
|
28
|
-
defaultValue: import("prop-types").Requireable<
|
|
28
|
+
defaultValue: import("prop-types").Requireable<string | number>;
|
|
29
29
|
name: import("prop-types").Requireable<string>;
|
|
30
30
|
placeholder: import("prop-types").Requireable<string>;
|
|
31
31
|
disabled: import("prop-types").Requireable<boolean>;
|
|
@@ -38,7 +38,7 @@ declare const NormalSelect: {
|
|
|
38
38
|
virtual: import("prop-types").Requireable<boolean>;
|
|
39
39
|
searchable: import("prop-types").Requireable<boolean>;
|
|
40
40
|
size: import("prop-types").Requireable<string>;
|
|
41
|
-
value: import("prop-types").Requireable<
|
|
41
|
+
value: import("prop-types").Requireable<string | any[]>;
|
|
42
42
|
enumType: import("prop-types").Requireable<string>;
|
|
43
43
|
customEnum: import("prop-types").Requireable<any[]>;
|
|
44
44
|
optionId: import("prop-types").Requireable<string>;
|
|
@@ -25,7 +25,7 @@ declare const EnumSelect: {
|
|
|
25
25
|
}): JSX.Element;
|
|
26
26
|
propTypes: {
|
|
27
27
|
events: import("prop-types").Requireable<object>;
|
|
28
|
-
defaultValue: import("prop-types").Requireable<
|
|
28
|
+
defaultValue: import("prop-types").Requireable<string | number>;
|
|
29
29
|
name: import("prop-types").Requireable<string>;
|
|
30
30
|
placeholder: import("prop-types").Requireable<string>;
|
|
31
31
|
disabled: import("prop-types").Requireable<boolean>;
|
|
@@ -38,7 +38,7 @@ declare const EnumSelect: {
|
|
|
38
38
|
virtual: import("prop-types").Requireable<boolean>;
|
|
39
39
|
searchable: import("prop-types").Requireable<boolean>;
|
|
40
40
|
size: import("prop-types").Requireable<string>;
|
|
41
|
-
value: import("prop-types").Requireable<
|
|
41
|
+
value: import("prop-types").Requireable<string | any[]>;
|
|
42
42
|
enumType: import("prop-types").Requireable<string>;
|
|
43
43
|
customEnum: import("prop-types").Requireable<any[]>;
|
|
44
44
|
optionId: import("prop-types").Requireable<string>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export namespace propTypes {
|
|
2
2
|
const events: PropTypes.Requireable<object>;
|
|
3
|
-
const defaultValue: PropTypes.Requireable<
|
|
3
|
+
const defaultValue: PropTypes.Requireable<string | number>;
|
|
4
4
|
const name: PropTypes.Requireable<string>;
|
|
5
5
|
const placeholder: PropTypes.Requireable<string>;
|
|
6
6
|
const disabled: PropTypes.Requireable<boolean>;
|
|
@@ -13,7 +13,7 @@ export namespace propTypes {
|
|
|
13
13
|
const virtual: PropTypes.Requireable<boolean>;
|
|
14
14
|
const searchable: PropTypes.Requireable<boolean>;
|
|
15
15
|
const size: PropTypes.Requireable<string>;
|
|
16
|
-
const value: PropTypes.Requireable<
|
|
16
|
+
const value: PropTypes.Requireable<string | any[]>;
|
|
17
17
|
const enumType: PropTypes.Requireable<string>;
|
|
18
18
|
const customEnum: PropTypes.Requireable<any[]>;
|
|
19
19
|
const optionId: PropTypes.Requireable<string>;
|
|
@@ -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" },
|