@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
|
@@ -46,7 +46,7 @@ src, alt, mode, lazyLoad, imgPreview, maskClosable, fit, }) {
|
|
|
46
46
|
else {
|
|
47
47
|
return style;
|
|
48
48
|
}
|
|
49
|
-
}, [
|
|
49
|
+
}, [style, fit]);
|
|
50
50
|
return src === realSrc || (realSrc !== undefined && src !== realSrc) ? (React.createElement(ImageInner, { objectFit: realFit, style: realStyle, className: cls, alt: alt, src: realSrc, isError: isError, setIsError: setIsError, events: events, lazyLoad: lazyLoad, imgPreview: imgPreview, maskClosable: maskClosable })) : null;
|
|
51
51
|
}
|
|
52
52
|
function getObjectFitByWxImageMode(mode) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable react/jsx-key */
|
|
2
|
-
import React, { useState, useEffect, useCallback, useImperativeHandle,
|
|
2
|
+
import React, { useState, useEffect, useCallback, useImperativeHandle, } from 'react';
|
|
3
3
|
import { usePlatform } from '../../utils/platform';
|
|
4
4
|
import classNames from '../../utils/classnames';
|
|
5
5
|
import './index.css';
|
|
@@ -14,7 +14,7 @@ export default React.forwardRef(function Lottery({ className, id, style, prizeLi
|
|
|
14
14
|
const [lotteryList, setLotteryList] = useState([]);
|
|
15
15
|
const [btnActived, setBtnActived] = useState(false);
|
|
16
16
|
//获取初始化默认数据,数据不足8条设置默认,超过8条获取前8条
|
|
17
|
-
const lotteryListDefault =
|
|
17
|
+
const lotteryListDefault = () => {
|
|
18
18
|
const list = [];
|
|
19
19
|
if (prizeList == null) {
|
|
20
20
|
return list;
|
|
@@ -39,15 +39,21 @@ export default React.forwardRef(function Lottery({ className, id, style, prizeLi
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
return list;
|
|
42
|
-
}
|
|
42
|
+
};
|
|
43
43
|
const startLottery = useCallback(() => {
|
|
44
|
-
setLotteryList(lotteryListDefault);
|
|
44
|
+
setLotteryList(lotteryListDefault());
|
|
45
45
|
setBtnActived(true);
|
|
46
46
|
if (lotteryAction.isStart)
|
|
47
47
|
return;
|
|
48
48
|
events === null || events === void 0 ? void 0 : events.clickLotteryButton();
|
|
49
49
|
setIsStartLottery(true);
|
|
50
|
-
}, [
|
|
50
|
+
}, [
|
|
51
|
+
lotteryAction.isStart,
|
|
52
|
+
setIsStartLottery,
|
|
53
|
+
setBtnActived,
|
|
54
|
+
lotteryListDefault,
|
|
55
|
+
setLotteryList,
|
|
56
|
+
]);
|
|
51
57
|
useImperativeHandle(ref, () => {
|
|
52
58
|
return {
|
|
53
59
|
methods: {
|
|
@@ -56,8 +62,8 @@ export default React.forwardRef(function Lottery({ className, id, style, prizeLi
|
|
|
56
62
|
};
|
|
57
63
|
}, [startLottery]);
|
|
58
64
|
useEffect(() => {
|
|
59
|
-
setLotteryList(lotteryListDefault);
|
|
60
|
-
}, [
|
|
65
|
+
setLotteryList(lotteryListDefault());
|
|
66
|
+
}, [prizeList]);
|
|
61
67
|
useEffect(() => {
|
|
62
68
|
lotteryAction.animationCallback = ({ idx, isEnd }) => {
|
|
63
69
|
setActivedId(idx == -1 ? 0 : idx);
|
|
@@ -84,7 +90,7 @@ export default React.forwardRef(function Lottery({ className, id, style, prizeLi
|
|
|
84
90
|
}, 700);
|
|
85
91
|
}
|
|
86
92
|
};
|
|
87
|
-
}, [
|
|
93
|
+
}, [lotteryList]);
|
|
88
94
|
useEffect(() => {
|
|
89
95
|
// 当满足开启抽奖条件并且点击了开奖开关时,启用抽奖
|
|
90
96
|
if (enablePrize && isStartLottery) {
|
|
@@ -102,7 +108,7 @@ export default React.forwardRef(function Lottery({ className, id, style, prizeLi
|
|
|
102
108
|
//立马停止抽奖
|
|
103
109
|
lotteryAction.stop();
|
|
104
110
|
}
|
|
105
|
-
}, [isStartLottery, enablePrize
|
|
111
|
+
}, [isStartLottery, enablePrize]);
|
|
106
112
|
useEffect(() => {
|
|
107
113
|
// 设置抽奖结果
|
|
108
114
|
lotteryAction.end(prizeResult);
|
|
@@ -182,7 +188,7 @@ export default React.forwardRef(function Lottery({ className, id, style, prizeLi
|
|
|
182
188
|
setDotHeight(dotHeight);
|
|
183
189
|
}
|
|
184
190
|
}
|
|
185
|
-
}, [
|
|
191
|
+
}, [style]);
|
|
186
192
|
const renderDot = (direction, list) => {
|
|
187
193
|
return (React.createElement(React.Fragment, null,
|
|
188
194
|
React.createElement("div", { className: classNames(`${CLASS_PREFIX}__dot`, `${CLASS_PREFIX}__dot-${direction}`) }, list.map((item, index) => {
|
|
@@ -54,7 +54,7 @@ export default function NavLayout({ navOption = emptyArray, mobileCol, pcCol, ic
|
|
|
54
54
|
}, [colCount, navOption]);
|
|
55
55
|
React.useEffect(() => {
|
|
56
56
|
setColCount(platform === 'h5' ? mobileCol : pcCol);
|
|
57
|
-
}, [mobileCol, pcCol
|
|
57
|
+
}, [mobileCol, pcCol]);
|
|
58
58
|
// 每个col的宽度百分比
|
|
59
59
|
const colStyle = {
|
|
60
60
|
width: `${(1 / colCount) * 100}%`,
|
|
@@ -48,7 +48,7 @@ const HorizontalMenu = ({ menuData, navigationStyle, selected, setSelected }) =>
|
|
|
48
48
|
if (platform !== 'h5' && isHorizontal && ((_a = navWrapRef === null || navWrapRef === void 0 ? void 0 : navWrapRef.current) === null || _a === void 0 ? void 0 : _a.children)) {
|
|
49
49
|
getMenuOffset();
|
|
50
50
|
}
|
|
51
|
-
}, [platform, isHorizontal, navWrapRef
|
|
51
|
+
}, [platform, isHorizontal, navWrapRef]);
|
|
52
52
|
// 渲染下拉菜单
|
|
53
53
|
const renderMenuList = (item, navigationStyle) => {
|
|
54
54
|
return (React.createElement(List, { type: "option", className: `${CLASS_PREFIX}__dropdown-menu-list`, style: { background: navigationStyle.menuBackgroundColor } }, item === null || item === void 0 ? void 0 : item.map((menu) => {
|
|
@@ -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
|
+
}, []);
|
|
96
96
|
const excludeControls = useMemo(() => {
|
|
97
97
|
const result = [
|
|
98
98
|
'media',
|
|
@@ -134,6 +134,7 @@ label, labelVisible, value: initialValue, readOnly, layout, requiredFlag, onChan
|
|
|
134
134
|
maxSize,
|
|
135
135
|
cloudPath,
|
|
136
136
|
latestEditorState,
|
|
137
|
+
insertMedias,
|
|
137
138
|
setEditorState,
|
|
138
139
|
isH5,
|
|
139
140
|
]);
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import React, { useEffect,
|
|
1
|
+
import React, { useEffect, 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);
|
|
8
7
|
export default function RichTextView({ value = '', className, style, id, }) {
|
|
9
8
|
const parseValue = destr(value);
|
|
10
9
|
const cls = classNames({
|
|
@@ -13,26 +12,25 @@ export default function RichTextView({ value = '', className, style, id, }) {
|
|
|
13
12
|
[className]: className,
|
|
14
13
|
});
|
|
15
14
|
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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
if (newURL) {
|
|
28
|
-
const htmlWithTempUrl = valueWithErrorHandle.replace(new RegExp(url, 'g'), newURL);
|
|
29
|
-
setDisplayValue(htmlWithTempUrl);
|
|
30
|
-
}
|
|
17
|
+
let tempValue = parseValue
|
|
18
|
+
.toString()
|
|
19
|
+
.replace(/<img /g, `<img onerror=${iferror} style="max-width:100%" `);
|
|
20
|
+
const getSrc = async (img) => {
|
|
21
|
+
const url = img.replace(regex, '$1');
|
|
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);
|
|
31
27
|
}
|
|
32
|
-
}
|
|
33
|
-
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
setDisplayValue(tempValue);
|
|
34
32
|
try {
|
|
35
|
-
const imgs = parseValue.match(
|
|
33
|
+
const imgs = parseValue.match(regex);
|
|
36
34
|
if (imgs && imgs.length > 0) {
|
|
37
35
|
imgs.forEach((img) => {
|
|
38
36
|
getSrc(img);
|
|
@@ -40,7 +38,7 @@ export default function RichTextView({ value = '', className, style, id, }) {
|
|
|
40
38
|
}
|
|
41
39
|
}
|
|
42
40
|
catch (e) { }
|
|
43
|
-
}, [
|
|
41
|
+
}, [value]);
|
|
44
42
|
return (displayValue && (React.createElement("div", { className: cls, style: style, id: id },
|
|
45
43
|
React.createElement("div", { dangerouslySetInnerHTML: { __html: displayValue } }))));
|
|
46
44
|
}
|
|
@@ -8,7 +8,6 @@ export interface PropsType extends CommonPropsType {
|
|
|
8
8
|
scrollIntoView?: string;
|
|
9
9
|
upperThreshold?: number;
|
|
10
10
|
lowerThreshold?: number;
|
|
11
|
-
domRef?: any;
|
|
12
11
|
}
|
|
13
12
|
export default function ScrollView({ id, scrollX, scrollY, style, scrollTop, scrollLeft, scrollIntoView, className, children, upperThreshold, lowerThreshold, events, }: {
|
|
14
13
|
id: any;
|
|
@@ -1,8 +1,6 @@
|
|
|
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,
|
|
4
|
-
// domRef,
|
|
5
|
-
events, }) {
|
|
3
|
+
export default function ScrollView({ id, scrollX = false, scrollY = true, style, scrollTop, scrollLeft, scrollIntoView, className, children, upperThreshold = 50, lowerThreshold = 50, events, }) {
|
|
6
4
|
const [toUpper, setToUpper] = React.useState(false);
|
|
7
5
|
const [toLower, setToLower] = React.useState(false);
|
|
8
6
|
const [scrollLeftPos, setScrollLeftPos] = React.useState(0);
|
|
@@ -66,10 +64,10 @@ events, }) {
|
|
|
66
64
|
}, [scrollLeft]);
|
|
67
65
|
React.useEffect(() => {
|
|
68
66
|
toUpper && events.scrolltoupper();
|
|
69
|
-
}, [
|
|
67
|
+
}, [toUpper]);
|
|
70
68
|
React.useEffect(() => {
|
|
71
69
|
toLower && events.scrolltolower();
|
|
72
|
-
}, [
|
|
70
|
+
}, [toLower]);
|
|
73
71
|
React.useEffect(() => {
|
|
74
72
|
if (scrollIntoView) {
|
|
75
73
|
const children = scrollViewRef.current.children;
|
|
@@ -78,7 +76,7 @@ events, }) {
|
|
|
78
76
|
scrollX && (scrollViewRef.current.scrollLeft = item.offsetLeft);
|
|
79
77
|
// console.log('children', children, item)
|
|
80
78
|
}
|
|
81
|
-
}, [scrollIntoView
|
|
79
|
+
}, [scrollIntoView]);
|
|
82
80
|
const webStyles = {
|
|
83
81
|
position: 'relative',
|
|
84
82
|
width: '100%',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { useState,
|
|
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';
|
|
@@ -12,15 +12,6 @@ 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]);
|
|
24
15
|
useEffect(() => {
|
|
25
16
|
if (autoplay) {
|
|
26
17
|
// 自动切换
|
|
@@ -30,60 +21,10 @@ export default function Swiper({ children, className, style, autoplay = true, ci
|
|
|
30
21
|
}, interval);
|
|
31
22
|
return () => clearInterval(timer);
|
|
32
23
|
}
|
|
33
|
-
}, [currentIndex, autoplay, itemCount
|
|
24
|
+
}, [currentIndex, autoplay, itemCount]);
|
|
34
25
|
// 触发切换
|
|
35
26
|
const pre = useRef({ index: currentIndex }).current;
|
|
36
27
|
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
|
-
};
|
|
87
28
|
updateSwipeStyle(currentIndex, pre.index, itemCount);
|
|
88
29
|
change({
|
|
89
30
|
current: currentIndex,
|
|
@@ -91,7 +32,7 @@ export default function Swiper({ children, className, style, autoplay = true, ci
|
|
|
91
32
|
return () => {
|
|
92
33
|
pre.index = currentIndex;
|
|
93
34
|
};
|
|
94
|
-
}, [
|
|
35
|
+
}, [currentIndex, vertical]);
|
|
95
36
|
const outerWrapRef = useRef();
|
|
96
37
|
useEventListener(outerWrapRef, 'load', (e) => {
|
|
97
38
|
setHeight(e.target.clientHeight);
|
|
@@ -99,6 +40,65 @@ export default function Swiper({ children, className, style, autoplay = true, ci
|
|
|
99
40
|
const itemsClone = React.Children.map(children, (x, i) => {
|
|
100
41
|
return (React.createElement("div", { className: "g-swiper-item", "data-index": i }, x));
|
|
101
42
|
});
|
|
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 },
|
|
@@ -2,17 +2,15 @@ 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
|
-
|
|
12
|
-
}
|
|
13
|
-
return { ...textStyle, ...style };
|
|
14
|
-
}, [maxLines, space, userSelect, style]);
|
|
5
|
+
const textStyle = {
|
|
6
|
+
WebkitLineClamp: maxLines,
|
|
7
|
+
whiteSpace: space ? 'pre-wrap' : 'pre-line',
|
|
8
|
+
};
|
|
9
|
+
if (!userSelect) {
|
|
10
|
+
textStyle.userSelect = 'none';
|
|
11
|
+
}
|
|
15
12
|
const levelName = level === '0' || !level ? '' : `level_${level}`;
|
|
13
|
+
const inlineStyle = React.useMemo(() => ({ ...textStyle, ...style }), [textStyle, style]);
|
|
16
14
|
return (React.createElement("p", {
|
|
17
15
|
//@ts-expect-error contentEditable type def sucks
|
|
18
16
|
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));
|
|
@@ -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]);
|
|
23
23
|
const boxStyle = {
|
|
24
24
|
marginRight: gutter,
|
|
25
25
|
marginBottom: gutter,
|
|
@@ -121,19 +121,7 @@ const WedaVideo = ({ className, style, id, videoDataSource, posterImage, autoPla
|
|
|
121
121
|
setVideoModalStatus(true);
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
|
-
}, [
|
|
125
|
-
autoPlay,
|
|
126
|
-
controlBarStatus,
|
|
127
|
-
endTime,
|
|
128
|
-
loopPlay,
|
|
129
|
-
mutePlay,
|
|
130
|
-
posterImage,
|
|
131
|
-
realSrc,
|
|
132
|
-
startTime,
|
|
133
|
-
videoDataSource,
|
|
134
|
-
videoRef,
|
|
135
|
-
videoType,
|
|
136
|
-
]);
|
|
124
|
+
}, [videoRef]);
|
|
137
125
|
useEffect(() => {
|
|
138
126
|
// 切换视频源
|
|
139
127
|
if (playerRef.current && videoType) {
|
|
@@ -146,7 +134,7 @@ const WedaVideo = ({ className, style, id, videoDataSource, posterImage, autoPla
|
|
|
146
134
|
playerRef.current.src(srcOption);
|
|
147
135
|
playerRef.current.load(realSrc);
|
|
148
136
|
}
|
|
149
|
-
}, [realSrc
|
|
137
|
+
}, [realSrc]);
|
|
150
138
|
return (React.createElement(ConfigProvider, { classPrefix: "wedatea2td" },
|
|
151
139
|
React.createElement("div", { className: cls, id: id, style: style, "data-testid": "wedaVideo" },
|
|
152
140
|
React.createElement("div", { "data-vjs-player": true },
|
|
File without changes
|
|
File without changes
|
|
@@ -7,7 +7,6 @@ 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
|
|
11
10
|
}, [defaultValue]);
|
|
12
11
|
const setter = useCallback((next) => {
|
|
13
12
|
setStateValue(next);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/weda-ui",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.4",
|
|
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 && mkdir 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.9",
|
|
99
|
+
"@storybook/addon-essentials": "^6.5.9",
|
|
100
|
+
"@storybook/addon-links": "^6.5.9",
|
|
101
|
+
"@storybook/addon-storyshots": "^6.5.9",
|
|
102
|
+
"@storybook/builder-webpack5": "^6.5.9",
|
|
103
|
+
"@storybook/manager-webpack5": "^6.5.9",
|
|
104
|
+
"@storybook/react": "^6.5.9",
|
|
105
105
|
"@swc-node/jest": "^1.5.2",
|
|
106
|
-
"@testing-library/jest-dom": "^5.16.
|
|
106
|
+
"@testing-library/jest-dom": "^5.16.4",
|
|
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.30.5",
|
|
113
|
+
"@typescript-eslint/parser": "^5.30.5",
|
|
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.19.0",
|
|
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.2.4",
|
|
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.30.1",
|
|
129
129
|
"eslint-plugin-rulesdir": "^0.2.1",
|
|
130
|
-
"eslint-plugin-storybook": "^0.
|
|
130
|
+
"eslint-plugin-storybook": "^0.5.13",
|
|
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.2.6",
|
|
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.7.4",
|
|
159
|
+
"webpack": "^5.73.0",
|
|
160
160
|
"webpack-cli": "^4.10.0",
|
|
161
|
-
"webpack-dev-server": "^4.
|
|
161
|
+
"webpack-dev-server": "^4.9.3",
|
|
162
162
|
"zx": "^5.2.0"
|
|
163
163
|
},
|
|
164
164
|
"nano-staged": {
|