@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.
- package/dist/src/configs/components/chart/bar.json +9 -1
- package/dist/src/configs/components/chart/line.json +8 -0
- package/dist/src/configs/components/chart/pie.json +8 -0
- package/dist/src/web/actions/showModal/index.js +0 -1
- package/dist/src/web/components/calendar/index.js +39 -37
- package/dist/src/web/components/carousel/index.js +62 -62
- package/dist/src/web/components/chart/bar/index.js +6 -2
- package/dist/src/web/components/chart/common/Chart.d.ts +1 -0
- package/dist/src/web/components/chart/common/Chart.js +9 -1
- package/dist/src/web/components/chart/common/chart-custom-connector.js +1 -1
- package/dist/src/web/components/chart/common/core/eChartBase.js +1 -1
- package/dist/src/web/components/chart/common/data-transform.js +3 -1
- package/dist/src/web/components/chart/common/useChart.js +13 -2
- package/dist/src/web/components/chart/line/index.js +2 -2
- package/dist/src/web/components/chart/pie/index.js +2 -2
- package/dist/src/web/components/common/error-boundary.d.ts +5 -0
- package/dist/src/web/components/common/error-boundary.js +33 -0
- package/dist/src/web/components/common/use-loop-render-detect.d.ts +11 -0
- package/dist/src/web/components/common/use-loop-render-detect.js +124 -0
- package/dist/src/web/components/form/checkbox/index.js +29 -29
- package/dist/src/web/components/form/form/index.js +24 -15
- package/dist/src/web/components/form/input/index.js +11 -3
- package/dist/src/web/components/form/location/common/mapChoose.js +6 -5
- package/dist/src/web/components/form/location/common/mapView.js +9 -6
- package/dist/src/web/components/form/location/common/tmap.d.ts +3 -0
- package/dist/src/web/components/form/location/common/tmap.js +21 -0
- package/dist/src/web/components/form/location/common/useLocationInfo.js +3 -2
- package/dist/src/web/components/form/location/components/LocationH5/location.h5.js +6 -3
- package/dist/src/web/components/form/location/components/LocationPC/location.PC.js +5 -1
- package/dist/src/web/components/form/location/index.js +7 -0
- package/dist/src/web/components/form/radio/index.js +3 -3
- package/dist/src/web/components/form/select/allTimePicker/index.js +1 -0
- package/dist/src/web/components/form/select/h5.js +18 -4
- package/dist/src/web/components/form/select/index.js +15 -1
- package/dist/src/web/components/form/select/use-options.js +1 -1
- package/dist/src/web/components/form/uploader/uploader.h5.js +2 -2
- package/dist/src/web/components/form/uploader/uploader.pc.js +1 -1
- package/dist/src/web/components/form/uploaderFile/uploadFile.h5.js +9 -7
- package/dist/src/web/components/form/uploaderFile/uploadFile.pc.js +9 -6
- package/dist/src/web/components/form/userOrgSelect/comTool.js +3 -9
- package/dist/src/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.h5.js +39 -34
- package/dist/src/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.pc.d.ts +1 -1
- package/dist/src/web/components/form/userOrgSelect/departTreeSelect/departTreeSelect.pc.js +35 -36
- package/dist/src/web/components/form/userOrgSelect/getUserService.d.ts +11 -0
- package/dist/src/web/components/form/userOrgSelect/getUserService.js +159 -0
- package/dist/src/web/components/form/userOrgSelect/userTreeSelect.h5.d.ts +3 -2
- package/dist/src/web/components/form/userOrgSelect/userTreeSelect.h5.js +37 -19
- package/dist/src/web/components/form/userOrgSelect/userTreeSelect.pc.d.ts +1 -1
- package/dist/src/web/components/form/userOrgSelect/userTreeSelect.pc.js +111 -129
- package/dist/src/web/components/form/userOrgSelect/utils.d.ts +3 -2
- package/dist/src/web/components/form/userOrgSelect/utils.js +24 -16
- package/dist/src/web/components/formdetail/index.js +14 -11
- package/dist/src/web/components/graphicCard/index.js +5 -6
- package/dist/src/web/components/image/index.js +1 -1
- package/dist/src/web/components/listView/index.js +1 -0
- package/dist/src/web/components/lottery/index.js +10 -16
- package/dist/src/web/components/navLayout/index.js +1 -1
- package/dist/src/web/components/navigationBar/horizontalMenu.js +1 -1
- package/dist/src/web/components/navigationBar/index.js +6 -6
- package/dist/src/web/components/richText/index.js +1 -2
- package/dist/src/web/components/richTextView/index.js +20 -18
- package/dist/src/web/components/scrollView/index.d.ts +1 -2
- package/dist/src/web/components/scrollView/index.js +7 -5
- package/dist/src/web/components/swiper/index.js +62 -62
- package/dist/src/web/components/tabs/index.js +6 -1
- package/dist/src/web/components/tabs/tabs.h5.js +2 -0
- package/dist/src/web/components/text/index.js +10 -8
- package/dist/src/web/components/uploaderFileView/index.js +1 -1
- package/dist/src/web/components/uploaderView/index.js +1 -1
- package/dist/src/web/components/wedaVideo/index.js +15 -3
- package/dist/src/web/utils/console.d.ts +3 -0
- package/dist/src/web/utils/console.js +26 -0
- package/dist/src/web/utils/platform.js +1 -1
- package/dist/src/web/utils/tcb.js +1 -1
- package/dist/src/web/utils/useSyncValue.js +1 -0
- package/dist/web/components/form/input/index.css +16 -0
- package/dist/web/components/form/userOrgSelect/userOrgSelect.css +4 -0
- package/package.json +20 -20
|
@@ -92,7 +92,7 @@ label, labelVisible, value: initialValue, readOnly, layout, requiredFlag, onChan
|
|
|
92
92
|
useEffect(() => {
|
|
93
93
|
const state = createStateFromContent(initialValue, {});
|
|
94
94
|
setEditorState(state);
|
|
95
|
-
}, []);
|
|
95
|
+
}, [initialValue]);
|
|
96
96
|
const excludeControls = useMemo(() => {
|
|
97
97
|
const result = [
|
|
98
98
|
'media',
|
|
@@ -134,7 +134,6 @@ label, labelVisible, value: initialValue, readOnly, layout, requiredFlag, onChan
|
|
|
134
134
|
maxSize,
|
|
135
135
|
cloudPath,
|
|
136
136
|
latestEditorState,
|
|
137
|
-
insertMedias,
|
|
138
137
|
setEditorState,
|
|
139
138
|
isH5,
|
|
140
139
|
]);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
1
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
2
2
|
import classNames from '../../utils/classnames';
|
|
3
3
|
import { getTempFileURL } from '../../utils/tcb';
|
|
4
4
|
import './index.css';
|
|
5
5
|
import { LOAD_ERR_IMG_BASE64 } from '../../utils/constant';
|
|
6
6
|
import destr from 'destr';
|
|
7
|
+
const imgRegex = new RegExp(/<img [^>]*src=\\*"([^"]*?)\\*"/g);
|
|
7
8
|
export default function RichTextView({ value = '', className, style, id, }) {
|
|
8
9
|
const parseValue = destr(value);
|
|
9
10
|
const cls = classNames({
|
|
@@ -12,25 +13,26 @@ export default function RichTextView({ value = '', className, style, id, }) {
|
|
|
12
13
|
[className]: className,
|
|
13
14
|
});
|
|
14
15
|
const [displayValue, setDisplayValue] = useState('');
|
|
15
|
-
const regex = new RegExp(/<img [^>]*src=\\*"([^"]*?)\\*"/g);
|
|
16
16
|
const iferror = `javascript:this.width='80';this.src='${LOAD_ERR_IMG_BASE64}';this.onerror=null`;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
if (img.includes('cloud://')) {
|
|
23
|
-
const newURL = await getTempFileURL(url);
|
|
24
|
-
if (newURL) {
|
|
25
|
-
tempValue = tempValue.replace(new RegExp(url, 'g'), newURL);
|
|
26
|
-
setDisplayValue(tempValue);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
};
|
|
17
|
+
const valueWithErrorHandle = useMemo(() => {
|
|
18
|
+
return parseValue
|
|
19
|
+
.toString()
|
|
20
|
+
.replace(/<img /g, `<img onerror=${iferror} style="max-width:100%" `);
|
|
21
|
+
}, [iferror, parseValue]);
|
|
30
22
|
useEffect(() => {
|
|
31
|
-
|
|
23
|
+
const getSrc = async (img) => {
|
|
24
|
+
const url = img.replace(imgRegex, '$1');
|
|
25
|
+
if (img.includes('cloud://')) {
|
|
26
|
+
const newURL = await getTempFileURL(url);
|
|
27
|
+
if (newURL) {
|
|
28
|
+
const htmlWithTempUrl = valueWithErrorHandle.replace(new RegExp(url, 'g'), newURL);
|
|
29
|
+
setDisplayValue(htmlWithTempUrl);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
setDisplayValue(valueWithErrorHandle);
|
|
32
34
|
try {
|
|
33
|
-
const imgs = parseValue.match(
|
|
35
|
+
const imgs = parseValue.match(imgRegex);
|
|
34
36
|
if (imgs && imgs.length > 0) {
|
|
35
37
|
imgs.forEach((img) => {
|
|
36
38
|
getSrc(img);
|
|
@@ -38,7 +40,7 @@ export default function RichTextView({ value = '', className, style, id, }) {
|
|
|
38
40
|
}
|
|
39
41
|
}
|
|
40
42
|
catch (e) { }
|
|
41
|
-
}, [
|
|
43
|
+
}, [parseValue, valueWithErrorHandle]);
|
|
42
44
|
return (displayValue && (React.createElement("div", { className: cls, style: style, id: id },
|
|
43
45
|
React.createElement("div", { dangerouslySetInnerHTML: { __html: displayValue } }))));
|
|
44
46
|
}
|
|
@@ -10,7 +10,7 @@ export interface PropsType extends CommonPropsType {
|
|
|
10
10
|
lowerThreshold?: number;
|
|
11
11
|
domRef?: any;
|
|
12
12
|
}
|
|
13
|
-
export default function ScrollView({ id, scrollX, scrollY, style, scrollTop, scrollLeft, scrollIntoView, className, children, upperThreshold, lowerThreshold,
|
|
13
|
+
export default function ScrollView({ id, scrollX, scrollY, style, scrollTop, scrollLeft, scrollIntoView, className, children, upperThreshold, lowerThreshold, events, }: {
|
|
14
14
|
id: any;
|
|
15
15
|
scrollX?: boolean;
|
|
16
16
|
scrollY?: boolean;
|
|
@@ -22,6 +22,5 @@ export default function ScrollView({ id, scrollX, scrollY, style, scrollTop, scr
|
|
|
22
22
|
children: any;
|
|
23
23
|
upperThreshold?: number;
|
|
24
24
|
lowerThreshold?: number;
|
|
25
|
-
domRef: any;
|
|
26
25
|
events: any;
|
|
27
26
|
}): JSX.Element;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import classNames from '../../utils/classnames';
|
|
3
|
-
export default function ScrollView({ id, scrollX = false, scrollY = true, style, scrollTop, scrollLeft, scrollIntoView, className, children, upperThreshold = 50, lowerThreshold = 50,
|
|
3
|
+
export default function ScrollView({ id, scrollX = false, scrollY = true, style, scrollTop, scrollLeft, scrollIntoView, className, children, upperThreshold = 50, lowerThreshold = 50,
|
|
4
|
+
// domRef,
|
|
5
|
+
events, }) {
|
|
4
6
|
const [toUpper, setToUpper] = React.useState(false);
|
|
5
7
|
const [toLower, setToLower] = React.useState(false);
|
|
6
8
|
const [scrollLeftPos, setScrollLeftPos] = React.useState(0);
|
|
7
9
|
const [scrollTopPos, setScrollTopPos] = React.useState(0);
|
|
8
|
-
const scrollViewRef =
|
|
10
|
+
const scrollViewRef = React.useRef(null);
|
|
9
11
|
const handleOnScroll = function (e) {
|
|
10
12
|
const detail = {
|
|
11
13
|
scrollLeft: e.target.scrollLeft,
|
|
@@ -64,10 +66,10 @@ export default function ScrollView({ id, scrollX = false, scrollY = true, style,
|
|
|
64
66
|
}, [scrollLeft]);
|
|
65
67
|
React.useEffect(() => {
|
|
66
68
|
toUpper && events.scrolltoupper();
|
|
67
|
-
}, [toUpper]);
|
|
69
|
+
}, [events, toUpper]);
|
|
68
70
|
React.useEffect(() => {
|
|
69
71
|
toLower && events.scrolltolower();
|
|
70
|
-
}, [toLower]);
|
|
72
|
+
}, [events, toLower]);
|
|
71
73
|
React.useEffect(() => {
|
|
72
74
|
if (scrollIntoView) {
|
|
73
75
|
const children = scrollViewRef.current.children;
|
|
@@ -76,7 +78,7 @@ export default function ScrollView({ id, scrollX = false, scrollY = true, style,
|
|
|
76
78
|
scrollX && (scrollViewRef.current.scrollLeft = item.offsetLeft);
|
|
77
79
|
// console.log('children', children, item)
|
|
78
80
|
}
|
|
79
|
-
}, [scrollIntoView]);
|
|
81
|
+
}, [scrollIntoView, scrollX, scrollY]);
|
|
80
82
|
const webStyles = {
|
|
81
83
|
position: 'relative',
|
|
82
84
|
width: '100%',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { useState, useEffect, useRef } from 'react';
|
|
2
|
+
import { useState, useCallback, 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';
|
|
@@ -12,6 +12,15 @@ export default function Swiper({ children, className, style, autoplay = true, ci
|
|
|
12
12
|
const [swipeStyle, setSwipeStyle] = useState(null);
|
|
13
13
|
const [height, setHeight] = useState(0);
|
|
14
14
|
const { change = () => { } } = events;
|
|
15
|
+
const setIndex = useCallback((index) => {
|
|
16
|
+
if (index >= itemCount) {
|
|
17
|
+
index = 0;
|
|
18
|
+
}
|
|
19
|
+
if (index < 0) {
|
|
20
|
+
index = itemCount - 1;
|
|
21
|
+
}
|
|
22
|
+
setCurrentIndex(index);
|
|
23
|
+
}, [itemCount]);
|
|
15
24
|
useEffect(() => {
|
|
16
25
|
if (autoplay) {
|
|
17
26
|
// 自动切换
|
|
@@ -21,10 +30,60 @@ export default function Swiper({ children, className, style, autoplay = true, ci
|
|
|
21
30
|
}, interval);
|
|
22
31
|
return () => clearInterval(timer);
|
|
23
32
|
}
|
|
24
|
-
}, [currentIndex, autoplay, itemCount]);
|
|
33
|
+
}, [currentIndex, autoplay, itemCount, interval, setIndex]);
|
|
25
34
|
// 触发切换
|
|
26
35
|
const pre = useRef({ index: currentIndex }).current;
|
|
27
36
|
useEffect(() => {
|
|
37
|
+
// 设置容器样式、动画
|
|
38
|
+
// TODO fix settimeout mess
|
|
39
|
+
const updateSwipeStyle = (to, cur, length) => {
|
|
40
|
+
// 最后向前到最开始
|
|
41
|
+
if (to === 0 && cur === length - 1) {
|
|
42
|
+
circular &&
|
|
43
|
+
setSwipeStyle({
|
|
44
|
+
transform: `translate3d(0, 0, 0)`,
|
|
45
|
+
});
|
|
46
|
+
// 不知道
|
|
47
|
+
// eslint-disable-next-line rulesdir/no-timer
|
|
48
|
+
setTimeout(() => {
|
|
49
|
+
setSwipeStyle({
|
|
50
|
+
transform: vertical
|
|
51
|
+
? `translate3d(0, -100%, 0)`
|
|
52
|
+
: `translate3d(-100%, 0, 0)`,
|
|
53
|
+
transitionDuration: `${duration}ms`,
|
|
54
|
+
});
|
|
55
|
+
}, 50);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
// 第一个后退到最后
|
|
59
|
+
if (to === length - 1 && cur === 0) {
|
|
60
|
+
circular &&
|
|
61
|
+
setSwipeStyle({
|
|
62
|
+
transform: vertical
|
|
63
|
+
? `translate3d(0, -${(to + 2) * 100}%, 0)`
|
|
64
|
+
: `translate3d(-${(to + 2) * 100}%, 0, 0)`,
|
|
65
|
+
});
|
|
66
|
+
// eslint-disable-next-line rulesdir/no-timer
|
|
67
|
+
setTimeout(() => {
|
|
68
|
+
setSwipeStyle({
|
|
69
|
+
transform: vertical
|
|
70
|
+
? `translate3d(0, -${(to + 1) * 100}%, 0)`
|
|
71
|
+
: `translate3d(-${(to + 1) * 100}%, 0, 0)`,
|
|
72
|
+
transitionDuration: `${duration}ms`,
|
|
73
|
+
});
|
|
74
|
+
}, 50);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const style = {
|
|
78
|
+
transform: vertical
|
|
79
|
+
? `translate3d(0, -${(to + 1) * 100}%, 0)`
|
|
80
|
+
: `translate3d(-${(to + 1) * 100}%, 0, 0)`,
|
|
81
|
+
};
|
|
82
|
+
if (to !== cur) {
|
|
83
|
+
style.transitionDuration = `${duration}ms`;
|
|
84
|
+
}
|
|
85
|
+
setSwipeStyle(style);
|
|
86
|
+
};
|
|
28
87
|
updateSwipeStyle(currentIndex, pre.index, itemCount);
|
|
29
88
|
change({
|
|
30
89
|
current: currentIndex,
|
|
@@ -32,7 +91,7 @@ export default function Swiper({ children, className, style, autoplay = true, ci
|
|
|
32
91
|
return () => {
|
|
33
92
|
pre.index = currentIndex;
|
|
34
93
|
};
|
|
35
|
-
}, [currentIndex, vertical]);
|
|
94
|
+
}, [change, circular, currentIndex, duration, itemCount, pre, vertical]);
|
|
36
95
|
const outerWrapRef = useRef();
|
|
37
96
|
useEventListener(outerWrapRef, 'load', (e) => {
|
|
38
97
|
setHeight(e.target.clientHeight);
|
|
@@ -40,65 +99,6 @@ export default function Swiper({ children, className, style, autoplay = true, ci
|
|
|
40
99
|
const itemsClone = React.Children.map(children, (x, i) => {
|
|
41
100
|
return (React.createElement("div", { className: "g-swiper-item", "data-index": i }, x));
|
|
42
101
|
});
|
|
43
|
-
const setIndex = (index) => {
|
|
44
|
-
if (index >= itemCount) {
|
|
45
|
-
index = 0;
|
|
46
|
-
}
|
|
47
|
-
if (index < 0) {
|
|
48
|
-
index = itemCount - 1;
|
|
49
|
-
}
|
|
50
|
-
setCurrentIndex(index);
|
|
51
|
-
};
|
|
52
|
-
// 设置容器样式、动画
|
|
53
|
-
// TODO fix settimeout mess
|
|
54
|
-
const updateSwipeStyle = (to, cur, length) => {
|
|
55
|
-
// 最后向前到最开始
|
|
56
|
-
if (to === 0 && cur === length - 1) {
|
|
57
|
-
circular &&
|
|
58
|
-
setSwipeStyle({
|
|
59
|
-
transform: `translate3d(0, 0, 0)`,
|
|
60
|
-
});
|
|
61
|
-
// 不知道
|
|
62
|
-
// eslint-disable-next-line rulesdir/no-timer
|
|
63
|
-
setTimeout(() => {
|
|
64
|
-
setSwipeStyle({
|
|
65
|
-
transform: vertical
|
|
66
|
-
? `translate3d(0, -100%, 0)`
|
|
67
|
-
: `translate3d(-100%, 0, 0)`,
|
|
68
|
-
transitionDuration: `${duration}ms`,
|
|
69
|
-
});
|
|
70
|
-
}, 50);
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
// 第一个后退到最后
|
|
74
|
-
if (to === length - 1 && cur === 0) {
|
|
75
|
-
circular &&
|
|
76
|
-
setSwipeStyle({
|
|
77
|
-
transform: vertical
|
|
78
|
-
? `translate3d(0, -${(to + 2) * 100}%, 0)`
|
|
79
|
-
: `translate3d(-${(to + 2) * 100}%, 0, 0)`,
|
|
80
|
-
});
|
|
81
|
-
// eslint-disable-next-line rulesdir/no-timer
|
|
82
|
-
setTimeout(() => {
|
|
83
|
-
setSwipeStyle({
|
|
84
|
-
transform: vertical
|
|
85
|
-
? `translate3d(0, -${(to + 1) * 100}%, 0)`
|
|
86
|
-
: `translate3d(-${(to + 1) * 100}%, 0, 0)`,
|
|
87
|
-
transitionDuration: `${duration}ms`,
|
|
88
|
-
});
|
|
89
|
-
}, 50);
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
const style = {
|
|
93
|
-
transform: vertical
|
|
94
|
-
? `translate3d(0, -${(to + 1) * 100}%, 0)`
|
|
95
|
-
: `translate3d(-${(to + 1) * 100}%, 0, 0)`,
|
|
96
|
-
};
|
|
97
|
-
if (to !== cur) {
|
|
98
|
-
style.transitionDuration = `${duration}ms`;
|
|
99
|
-
}
|
|
100
|
-
setSwipeStyle(style);
|
|
101
|
-
};
|
|
102
102
|
return (React.createElement("div", { className: classNames('g-swiper weda-ui', className, {
|
|
103
103
|
vertical: vertical,
|
|
104
104
|
}), style: { height: height ? height : 'auto', ...style }, ref: outerWrapRef, id: id },
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { usePlatform } from '../../utils/platform';
|
|
3
|
+
import { CommonErrorBoundary } from '../common/error-boundary';
|
|
3
4
|
// import { fallback } from '../../utils/loading-fallback';
|
|
4
5
|
import TabsH5 from './tabs.h5';
|
|
5
6
|
import TabsPc from './tabs.pc';
|
|
6
|
-
|
|
7
|
+
function TabsImpl(props) {
|
|
7
8
|
const platform = usePlatform();
|
|
8
9
|
if ((props === null || props === void 0 ? void 0 : props.showType) === 'pc') {
|
|
9
10
|
return React.createElement(TabsPc, { ...props });
|
|
@@ -13,3 +14,7 @@ export default function Tabs(props) {
|
|
|
13
14
|
}
|
|
14
15
|
return platform === 'h5' ? React.createElement(TabsH5, { ...props }) : React.createElement(TabsPc, { ...props });
|
|
15
16
|
}
|
|
17
|
+
export default function Tabs(props) {
|
|
18
|
+
return (React.createElement(CommonErrorBoundary, null,
|
|
19
|
+
React.createElement(TabsImpl, { ...props })));
|
|
20
|
+
}
|
|
@@ -5,7 +5,9 @@ import { useSyncValue } from '../../utils/useSyncValue';
|
|
|
5
5
|
import { useCustomCompareEffect, useSyncedRef } from '@react-hookz/web';
|
|
6
6
|
import isObjectEqual from '../../utils/isObjectEqual';
|
|
7
7
|
import { emptyArray } from '../../utils/constant';
|
|
8
|
+
import { useLoopRenderDetect } from '../common/use-loop-render-detect';
|
|
8
9
|
export default function TabsH5({ tabs = emptyArray, selectedIndex, events, className, style, isMultipleSlot = true, ...restProps }) {
|
|
10
|
+
useLoopRenderDetect();
|
|
9
11
|
const [currentIndex, setCurrentIndex] = useSyncValue(typeof selectedIndex === 'string' ? parseInt(selectedIndex) : selectedIndex);
|
|
10
12
|
const stickyStyle = useMemo(() => {
|
|
11
13
|
const length = tabs.length;
|
|
@@ -2,15 +2,17 @@ import * as React from 'react';
|
|
|
2
2
|
import classNames from '../../utils/classnames';
|
|
3
3
|
import './index.css';
|
|
4
4
|
export default function Text({ text, maxLines, space, userSelect, style, className, events, id, level, contenteditable, onInput, onBlur, }) {
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
const inlineStyle = React.useMemo(() => {
|
|
6
|
+
const textStyle = {
|
|
7
|
+
WebkitLineClamp: maxLines,
|
|
8
|
+
whiteSpace: space ? 'pre-wrap' : 'pre-line',
|
|
9
|
+
};
|
|
10
|
+
if (!userSelect) {
|
|
11
|
+
textStyle.userSelect = 'none';
|
|
12
|
+
}
|
|
13
|
+
return { ...textStyle, ...style };
|
|
14
|
+
}, [maxLines, space, userSelect, style]);
|
|
12
15
|
const levelName = level === '0' || !level ? '' : `level_${level}`;
|
|
13
|
-
const inlineStyle = React.useMemo(() => ({ ...textStyle, ...style }), [textStyle, style]);
|
|
14
16
|
return (React.createElement("p", {
|
|
15
17
|
//@ts-expect-error contentEditable type def sucks
|
|
16
18
|
contentEditable: contenteditable, onInput: onInput, onBlur: onBlur, style: inlineStyle, className: classNames('weda-text', 'weda-ui', className, levelName), id: id, onClick: (e) => events.tap({}, { originEvent: e }) }, text));
|
|
@@ -11,12 +11,12 @@ const CLASS_PREFIX = 'weda-uploader-file-view';
|
|
|
11
11
|
export default function UploaderFileView({ value, className, single = true, // 展示为单行 a 标签
|
|
12
12
|
showType, // 展示端为 pc 还是 h5 样式
|
|
13
13
|
...rest }) {
|
|
14
|
+
const platform = usePlatform();
|
|
14
15
|
const fileIDList = filterStrList(value);
|
|
15
16
|
if (single) {
|
|
16
17
|
return React.createElement(FileView, { fileID: fileIDList[0] });
|
|
17
18
|
}
|
|
18
19
|
else {
|
|
19
|
-
const platform = usePlatform();
|
|
20
20
|
const showTypeMix = showType ? (showType === 'h5' ? 'h5' : 'pc') : platform;
|
|
21
21
|
const uploadFileProps = {
|
|
22
22
|
...rest,
|
|
@@ -19,7 +19,7 @@ alt = '[加载失败]', gutter = 8, height = 100, width = 100, events = emptyObj
|
|
|
19
19
|
const [errorList, setErrorList] = React.useState([]);
|
|
20
20
|
React.useEffect(() => {
|
|
21
21
|
events.load && events.load({ success: successList, error: errorList });
|
|
22
|
-
}, [successList, errorList]);
|
|
22
|
+
}, [successList, errorList, events]);
|
|
23
23
|
const boxStyle = {
|
|
24
24
|
marginRight: gutter,
|
|
25
25
|
marginBottom: gutter,
|
|
@@ -116,12 +116,24 @@ const WedaVideo = ({ className, style, id, videoDataSource, posterImage, autoPla
|
|
|
116
116
|
!isCloudFileID(videoDataSource)) {
|
|
117
117
|
errorMsg = '请在预览区查看视频效果';
|
|
118
118
|
}
|
|
119
|
-
console.
|
|
119
|
+
console.error('player error', errorMsg);
|
|
120
120
|
setVideoErrMsg(errorMsg);
|
|
121
121
|
setVideoModalStatus(true);
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
|
-
}, [
|
|
124
|
+
}, [
|
|
125
|
+
autoPlay,
|
|
126
|
+
controlBarStatus,
|
|
127
|
+
endTime,
|
|
128
|
+
loopPlay,
|
|
129
|
+
mutePlay,
|
|
130
|
+
posterImage,
|
|
131
|
+
realSrc,
|
|
132
|
+
startTime,
|
|
133
|
+
videoDataSource,
|
|
134
|
+
videoRef,
|
|
135
|
+
videoType,
|
|
136
|
+
]);
|
|
125
137
|
useEffect(() => {
|
|
126
138
|
// 切换视频源
|
|
127
139
|
if (playerRef.current && videoType) {
|
|
@@ -134,7 +146,7 @@ const WedaVideo = ({ className, style, id, videoDataSource, posterImage, autoPla
|
|
|
134
146
|
playerRef.current.src(srcOption);
|
|
135
147
|
playerRef.current.load(realSrc);
|
|
136
148
|
}
|
|
137
|
-
}, [realSrc]);
|
|
149
|
+
}, [realSrc, videoType]);
|
|
138
150
|
return (React.createElement(ConfigProvider, { classPrefix: "wedatea2td" },
|
|
139
151
|
React.createElement("div", { className: cls, id: id, style: style, "data-testid": "wedaVideo" },
|
|
140
152
|
React.createElement("div", { "data-vjs-player": true },
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { noop } from './constant';
|
|
2
|
+
export const debug = (label) => {
|
|
3
|
+
var _a;
|
|
4
|
+
const envLabel = (_a = (typeof window !== 'undefined' &&
|
|
5
|
+
window.localStorage.getItem('WEDA_COMP_DEBUG'))) !== null && _a !== void 0 ? _a : '';
|
|
6
|
+
const showLog = envLabel.startsWith(label) || envLabel == '*';
|
|
7
|
+
const globalVar = typeof globalThis !== 'undefined'
|
|
8
|
+
? globalThis
|
|
9
|
+
: typeof self !== 'undefined'
|
|
10
|
+
? self
|
|
11
|
+
: window;
|
|
12
|
+
// 防 drop console
|
|
13
|
+
const globalConsoleObj = globalVar['con' + 'sole'];
|
|
14
|
+
return new Proxy(globalConsoleObj, {
|
|
15
|
+
get(_console, k) {
|
|
16
|
+
if (showLog) {
|
|
17
|
+
return (...args) => {
|
|
18
|
+
globalConsoleObj[k](label, ...args);
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
return noop;
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
};
|
|
@@ -110,7 +110,7 @@ export const getDataSourceByName = async (dbName) => {
|
|
|
110
110
|
// dbName 为空时
|
|
111
111
|
if (!dbName)
|
|
112
112
|
return;
|
|
113
|
-
const datasource = await window.app.cloud.
|
|
113
|
+
const datasource = await window.app.cloud.getDataSourceProfileAsync({
|
|
114
114
|
Name: dbName,
|
|
115
115
|
GetColumnAuth: true,
|
|
116
116
|
});
|
|
@@ -7,6 +7,7 @@ export function useSyncValue(defaultValue, comparotor = Object.is) {
|
|
|
7
7
|
if (!comparotor(prevValue, defaultValue)) {
|
|
8
8
|
setStateValue(defaultValue);
|
|
9
9
|
}
|
|
10
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
10
11
|
}, [defaultValue]);
|
|
11
12
|
const setter = useCallback((next) => {
|
|
12
13
|
setStateValue(next);
|
|
@@ -38,3 +38,19 @@
|
|
|
38
38
|
.weda-input .weui-input {
|
|
39
39
|
font-weight: inherit;
|
|
40
40
|
}
|
|
41
|
+
|
|
42
|
+
.weui-pc-input {
|
|
43
|
+
white-space: nowrap;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.weui-pc-input .pc-clear {
|
|
47
|
+
position: relative;
|
|
48
|
+
right: 1.78571rem;
|
|
49
|
+
top: 25%;
|
|
50
|
+
display: inline-block;
|
|
51
|
+
background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+PHBhdGggZmlsbD0iIzg4OCIgZD0iTTggMWE3IDcgMCAxIDAgMCAxNEE3IDcgMCAwIDAgOCAxem0zLjUzNiA5LjEyMWwtMS40MTQgMS40MTRMOCA5LjQxNGwtMi4xMjEgMi4xMjEtMS40MTQtMS40MTRMNi41ODYgOCA0LjQ2NCA1Ljg3OWwxLjQxNC0xLjQxNEw4IDYuNTg2bDIuMTIxLTIuMTIxIDEuNDE0IDEuNDE0TDkuNDE0IDhsMi4xMjIgMi4xMjF6Ii8+PC9zdmc+) !important;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.weui-pc-input .pc-input {
|
|
55
|
+
padding-right: 2.14286rem;
|
|
56
|
+
}
|
|
@@ -245,6 +245,7 @@
|
|
|
245
245
|
/** 用户 tab start */
|
|
246
246
|
.dim-tree-select.dim-tree-select--user {
|
|
247
247
|
padding: 0.21429rem 0 0.57143rem 0;
|
|
248
|
+
margin-top: 0;
|
|
248
249
|
}
|
|
249
250
|
.dim-tree-select.dim-tree-select--user
|
|
250
251
|
.dim-tree-select-tabs
|
|
@@ -354,6 +355,9 @@
|
|
|
354
355
|
background-image: url(data:image/svg+xml;charset=utf-8;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTExLjUgNUMxMS41IDYuOTMzIDkuOTMzIDguNSA4IDguNUM2LjA2NyA4LjUgNC41IDYuOTMzIDQuNSA1QzQuNSAzLjA2NyA2LjA2NyAxLjUgOCAxLjVDOS45MzMgMS41IDExLjUgMy4wNjcgMTEuNSA1Wk0xMC41IDVDMTAuNSAzLjYxOTI5IDkuMzgwNzEgMi41IDggMi41QzYuNjE5MjkgMi41IDUuNSAzLjYxOTI5IDUuNSA1QzUuNSA2LjM4MDcxIDYuNjE5MjkgNy41IDggNy41QzkuMzgwNzEgNy41IDEwLjUgNi4zODA3MSAxMC41IDVaIiBmaWxsPSJibGFjayIgZmlsbC1vcGFjaXR5PSIwLjQiLz4KPHBhdGggZD0iTTEzLjk2MzEgMTAuODUyOEMxNC4yOTcgMTEuMDEyMiAxNC41IDExLjM1NDcgMTQuNSAxMS43MjQ2VjE0QzE0LjUgMTQuMjc2MSAxNC4yNzYxIDE0LjUgMTQgMTQuNUgyQzEuNzIzODYgMTQuNSAxLjUgMTQuMjc2MSAxLjUgMTRWMTEuNzI0NkMxLjUgMTEuMzU0NyAxLjcwMzAyIDExLjAxMjIgMi4wMzY4NiAxMC44NTI4QzMuODQ5NCA5Ljk4NzA4IDUuODY2NTEgOS41IDggOS41QzEwLjEzMzUgOS41IDEyLjE1MDYgOS45ODcwOCAxMy45NjMxIDEwLjg1MjhaTTggMTAuNUM2LjAzMzQgMTAuNSA0LjE3NDM1IDEwLjk0NTcgMi41IDExLjczOThWMTMuNUgxMy41VjExLjczOThDMTEuODI1NyAxMC45NDU3IDkuOTY2NiAxMC41IDggMTAuNVoiIGZpbGw9ImJsYWNrIiBmaWxsLW9wYWNpdHk9IjAuNCIvPgo8L3N2Zz4K);
|
|
355
356
|
background-repeat: no-repeat;
|
|
356
357
|
}
|
|
358
|
+
.role-tree-select.role-tree-select--depart .dropdown-cell {
|
|
359
|
+
word-break: break-all;
|
|
360
|
+
}
|
|
357
361
|
.role-tree-select.role-tree-select--depart
|
|
358
362
|
.is-expanded.wedatea2td-dropdown-btn
|
|
359
363
|
.wedatea2td-dropdown__header
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/weda-ui",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index",
|
|
6
6
|
"miniprogram": "mpdist",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"lint": "eslint --ext .js,.jsx,.ts,.tsx .",
|
|
39
39
|
"lint:fix": "npm run lint -- --fix",
|
|
40
40
|
"prepare": "husky install || true",
|
|
41
|
-
"build-npm": "rimraf dist &&
|
|
41
|
+
"build-npm": "rimraf dist && mkdirp dist && cp -r src/web dist/ && cp -r src/configs dist/ && cp src/index.js dist/",
|
|
42
42
|
"build-mp": "rimraf mpdist && cp -r src/mp mpdist",
|
|
43
43
|
"clear:snap": "rimraf ./src/test/__snapshots__",
|
|
44
44
|
"size": "npm run build:cli && size-limit",
|
|
@@ -95,45 +95,45 @@
|
|
|
95
95
|
"@cypress/webpack-dev-server": "~2.0.0",
|
|
96
96
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
|
97
97
|
"@size-limit/preset-big-lib": "^7.0.8",
|
|
98
|
-
"@storybook/addon-actions": "^6.5.
|
|
99
|
-
"@storybook/addon-essentials": "^6.5.
|
|
100
|
-
"@storybook/addon-links": "^6.5.
|
|
101
|
-
"@storybook/addon-storyshots": "^6.5.
|
|
102
|
-
"@storybook/builder-webpack5": "^6.5.
|
|
103
|
-
"@storybook/manager-webpack5": "^6.5.
|
|
104
|
-
"@storybook/react": "^6.5.
|
|
98
|
+
"@storybook/addon-actions": "^6.5.12",
|
|
99
|
+
"@storybook/addon-essentials": "^6.5.12",
|
|
100
|
+
"@storybook/addon-links": "^6.5.12",
|
|
101
|
+
"@storybook/addon-storyshots": "^6.5.12",
|
|
102
|
+
"@storybook/builder-webpack5": "^6.5.12",
|
|
103
|
+
"@storybook/manager-webpack5": "^6.5.12",
|
|
104
|
+
"@storybook/react": "^6.5.12",
|
|
105
105
|
"@swc-node/jest": "^1.5.2",
|
|
106
|
-
"@testing-library/jest-dom": "^5.16.
|
|
106
|
+
"@testing-library/jest-dom": "^5.16.5",
|
|
107
107
|
"@testing-library/react": "^12.1.5",
|
|
108
108
|
"@testing-library/react-hooks": "^8.0.1",
|
|
109
109
|
"@types/jest": "^27.5.1",
|
|
110
110
|
"@types/resize-observer-browser": "^0.1.7",
|
|
111
111
|
"@types/testing-library__jest-dom": "^5.14.5",
|
|
112
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
113
|
-
"@typescript-eslint/parser": "^5.
|
|
112
|
+
"@typescript-eslint/eslint-plugin": "^5.37.0",
|
|
113
|
+
"@typescript-eslint/parser": "^5.37.0",
|
|
114
114
|
"babel-loader": "^8.2.5",
|
|
115
115
|
"babel-plugin-istanbul": "^6.1.1",
|
|
116
116
|
"cross-env": "^7.0.3",
|
|
117
117
|
"cypress": "~10.3.0",
|
|
118
118
|
"cypress-image-diff-js": "^1.20.0",
|
|
119
119
|
"cypress-wait-until": "^1.7.2",
|
|
120
|
-
"eslint": "^8.
|
|
120
|
+
"eslint": "^8.23.1",
|
|
121
121
|
"eslint-config-prettier": "^8.5.0",
|
|
122
122
|
"eslint-config-tencent": "^1.0.4",
|
|
123
|
-
"eslint-import-resolver-typescript": "^3.
|
|
123
|
+
"eslint-import-resolver-typescript": "^3.5.1",
|
|
124
124
|
"eslint-plugin-cypress": "^2.12.1",
|
|
125
125
|
"eslint-plugin-import": "^2.26.0",
|
|
126
126
|
"eslint-plugin-jest": "^26.5.3",
|
|
127
127
|
"eslint-plugin-prettier": "^4.2.1",
|
|
128
|
-
"eslint-plugin-react": "^7.
|
|
128
|
+
"eslint-plugin-react": "^7.31.8",
|
|
129
129
|
"eslint-plugin-rulesdir": "^0.2.1",
|
|
130
|
-
"eslint-plugin-storybook": "^0.
|
|
130
|
+
"eslint-plugin-storybook": "^0.6.4",
|
|
131
131
|
"husky": "^8.0.1",
|
|
132
132
|
"identity-obj-proxy": "^3.0.0",
|
|
133
133
|
"jest": "^27.5.1",
|
|
134
134
|
"jest-canvas-mock": "^2.4.0",
|
|
135
135
|
"jest-environment-jsdom": "^27",
|
|
136
|
-
"jest-preview": "^0.
|
|
136
|
+
"jest-preview": "^0.3.1",
|
|
137
137
|
"miniprogram-simulate": "^1.5.7",
|
|
138
138
|
"mkdirp": "^1.0.4",
|
|
139
139
|
"mochawesome": "^7.1.3",
|
|
@@ -155,10 +155,10 @@
|
|
|
155
155
|
"swc-plugin-coverage-instrument": "^0.0.7",
|
|
156
156
|
"ts-loader": "^9.3.1",
|
|
157
157
|
"ts-node": "^10.9.1",
|
|
158
|
-
"typescript": "^4.
|
|
159
|
-
"webpack": "^5.
|
|
158
|
+
"typescript": "^4.8.3",
|
|
159
|
+
"webpack": "^5.74.0",
|
|
160
160
|
"webpack-cli": "^4.10.0",
|
|
161
|
-
"webpack-dev-server": "^4.
|
|
161
|
+
"webpack-dev-server": "^4.11.0",
|
|
162
162
|
"zx": "^5.2.0"
|
|
163
163
|
},
|
|
164
164
|
"nano-staged": {
|