@cloudbase/weda-ui 3.1.0 → 3.1.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/asset-manifest.json +17 -0
- package/dist/configs/actions/showModal.json +48 -0
- package/dist/configs/actions/showToast.json +41 -0
- package/dist/configs/components/auth.json +16 -0
- package/dist/configs/components/button.json +239 -0
- package/dist/configs/components/calendar.json +81 -0
- package/dist/configs/components/carousel.json +292 -0
- package/dist/configs/components/chart/bar.json +721 -0
- package/dist/configs/components/chart/line.json +674 -0
- package/dist/configs/components/chart/pie.json +494 -0
- package/dist/configs/components/chart/statisticsCard.json +376 -0
- package/dist/configs/components/container.json +50 -0
- package/dist/configs/components/dataView.json +239 -0
- package/dist/configs/components/drawer.json +115 -0
- package/dist/configs/components/form/checkbox.json +178 -0
- package/dist/configs/components/form/form.json +45 -0
- package/dist/configs/components/form/input.json +154 -0
- package/dist/configs/components/form/location.json +216 -0
- package/dist/configs/components/form/radio.json +203 -0
- package/dist/configs/components/form/richText.json +125 -0
- package/dist/configs/components/form/select.json +430 -0
- package/dist/configs/components/form/switch.json +58 -0
- package/dist/configs/components/form/textarea.json +116 -0
- package/dist/configs/components/form/tips.json +34 -0
- package/dist/configs/components/form/uploader.json +171 -0
- package/dist/configs/components/form/uploaderFile.json +158 -0
- package/dist/configs/components/graphicCard.json +413 -0
- package/dist/configs/components/image.json +187 -0
- package/dist/configs/components/link.json +79 -0
- package/dist/configs/components/listView.json +370 -0
- package/dist/configs/components/lottery.json +163 -0
- package/dist/configs/components/modal.json +72 -0
- package/dist/configs/components/navLayout.json +368 -0
- package/dist/configs/components/navigationBar.json +62 -0
- package/dist/configs/components/richtextview.json +26 -0
- package/dist/configs/components/scrollVeiw.json +253 -0
- package/dist/configs/components/slot.json +17 -0
- package/dist/configs/components/swiper.json +90 -0
- package/dist/configs/components/tabs.json +121 -0
- package/dist/configs/components/text.json +95 -0
- package/dist/configs/components/wedaVideo.json +89 -0
- package/dist/configs/components/wxOpenApi/phone.json +127 -0
- package/dist/configs/components/wxOpenApi/phoneCode.json +109 -0
- package/dist/configs/components/wxOpenApi/share.json +157 -0
- package/dist/configs/components/wxOpenApi/userInfo.json +156 -0
- package/dist/configs/index.d.ts +97 -0
- package/dist/configs/index.js +105 -0
- package/dist/docs/common/format.d.ts +13 -0
- package/dist/docs/common/format.js +103 -0
- package/dist/docs/common/tableView.d.ts +30 -0
- package/dist/docs/common/tableView.js +159 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.html +88 -0
- package/dist/index.js +3 -0
- package/dist/setupTests.d.ts +1 -0
- package/dist/setupTests.js +14 -0
- package/dist/static/js/bundle.js +963 -0
- package/dist/static/js/bundle.js.map +1 -0
- package/dist/static/js/main.chunk.js +8841 -0
- package/dist/static/js/main.chunk.js.map +1 -0
- package/dist/static/js/vendors~main.chunk.js +247885 -0
- package/dist/static/js/vendors~main.chunk.js.map +1 -0
- package/dist/static/media/ef6fa527e24e354765d806b826b41391.fa67580a.svg +627 -0
- package/dist/web/actions/index.d.ts +2 -0
- package/dist/web/actions/index.js +2 -0
- package/dist/web/actions/showModal/index.d.ts +3 -0
- package/dist/web/actions/showModal/index.js +66 -0
- package/dist/web/actions/showToast/index.d.ts +1 -0
- package/dist/web/actions/showToast/index.js +3 -0
- package/dist/web/components/auth/index.d.ts +10 -0
- package/dist/web/components/auth/index.js +37 -0
- package/dist/web/components/button/index.css +27 -0
- package/dist/web/components/button/index.d.ts +32 -0
- package/dist/web/components/button/index.js +48 -0
- package/dist/web/components/calendar/index.css +416 -0
- package/dist/web/components/calendar/index.d.ts +19 -0
- package/dist/web/components/calendar/index.js +181 -0
- package/dist/web/components/calendar/util.d.ts +13 -0
- package/dist/web/components/calendar/util.js +74 -0
- package/dist/web/components/carousel/index.css +119 -0
- package/dist/web/components/carousel/index.d.ts +41 -0
- package/dist/web/components/carousel/index.js +240 -0
- package/dist/web/components/chart/bar/index.d.ts +41 -0
- package/dist/web/components/chart/bar/index.js +56 -0
- package/dist/web/components/chart/common/config/bar.d.ts +48 -0
- package/dist/web/components/chart/common/config/bar.js +49 -0
- package/dist/web/components/chart/common/config/global.d.ts +13 -0
- package/dist/web/components/chart/common/config/global.js +16 -0
- package/dist/web/components/chart/common/config/line.d.ts +46 -0
- package/dist/web/components/chart/common/config/line.js +49 -0
- package/dist/web/components/chart/common/config/pie.d.ts +29 -0
- package/dist/web/components/chart/common/config/pie.js +36 -0
- package/dist/web/components/chart/common/core/eChartBar.d.ts +68 -0
- package/dist/web/components/chart/common/core/eChartBar.js +196 -0
- package/dist/web/components/chart/common/core/eChartBase.d.ts +128 -0
- package/dist/web/components/chart/common/core/eChartBase.js +346 -0
- package/dist/web/components/chart/common/core/eChartLine.d.ts +62 -0
- package/dist/web/components/chart/common/core/eChartLine.js +168 -0
- package/dist/web/components/chart/common/core/eChartPie.d.ts +50 -0
- package/dist/web/components/chart/common/core/eChartPie.js +132 -0
- package/dist/web/components/chart/common/core/type.d.ts +35 -0
- package/dist/web/components/chart/common/core/type.js +9 -0
- package/dist/web/components/chart/common/echarts.d.ts +2 -0
- package/dist/web/components/chart/common/echarts.js +24 -0
- package/dist/web/components/chart/common/useChart.d.ts +8 -0
- package/dist/web/components/chart/common/useChart.js +60 -0
- package/dist/web/components/chart/line/index.d.ts +39 -0
- package/dist/web/components/chart/line/index.js +53 -0
- package/dist/web/components/chart/pie/index.d.ts +27 -0
- package/dist/web/components/chart/pie/index.js +40 -0
- package/dist/web/components/chart/statisticsCard/index.css +63 -0
- package/dist/web/components/chart/statisticsCard/index.d.ts +85 -0
- package/dist/web/components/chart/statisticsCard/index.js +203 -0
- package/dist/web/components/chart/statisticsCard/interface.d.ts +13 -0
- package/dist/web/components/chart/statisticsCard/interface.js +1 -0
- package/dist/web/components/container/index.d.ts +6 -0
- package/dist/web/components/container/index.js +6 -0
- package/dist/web/components/dataView/index.d.ts +6 -0
- package/dist/web/components/dataView/index.js +8 -0
- package/dist/web/components/dataView/interface.d.ts +5 -0
- package/dist/web/components/dataView/interface.js +1 -0
- package/dist/web/components/drawer/index.d.ts +13 -0
- package/dist/web/components/drawer/index.js +12 -0
- package/dist/web/components/form/checkbox/index.d.ts +13 -0
- package/dist/web/components/form/checkbox/index.js +167 -0
- package/dist/web/components/form/enumSelect/MultipleSelect.d.ts +78 -0
- package/dist/web/components/form/enumSelect/MultipleSelect.js +52 -0
- package/dist/web/components/form/enumSelect/NormalSelect.d.ts +83 -0
- package/dist/web/components/form/enumSelect/NormalSelect.js +52 -0
- package/dist/web/components/form/enumSelect/SelectContainer.d.ts +16 -0
- package/dist/web/components/form/enumSelect/SelectContainer.js +30 -0
- package/dist/web/components/form/enumSelect/index.d.ts +82 -0
- package/dist/web/components/form/enumSelect/index.js +6 -0
- package/dist/web/components/form/enumSelect/props/defaultProps.d.ts +34 -0
- package/dist/web/components/form/enumSelect/props/defaultProps.js +40 -0
- package/dist/web/components/form/enumSelect/props/propsTypes.d.ts +39 -0
- package/dist/web/components/form/enumSelect/props/propsTypes.js +47 -0
- package/dist/web/components/form/form/index.css +9 -0
- package/dist/web/components/form/form/index.d.ts +13 -0
- package/dist/web/components/form/form/index.js +31 -0
- package/dist/web/components/form/formcell/index.css +85 -0
- package/dist/web/components/form/formcell/index.d.ts +8 -0
- package/dist/web/components/form/formcell/index.js +40 -0
- package/dist/web/components/form/input/index.css +40 -0
- package/dist/web/components/form/input/index.d.ts +14 -0
- package/dist/web/components/form/input/index.js +86 -0
- package/dist/web/components/form/location/common/mapChoose.css +477 -0
- package/dist/web/components/form/location/common/mapChoose.d.ts +15 -0
- package/dist/web/components/form/location/common/mapChoose.js +435 -0
- package/dist/web/components/form/location/common/mapView.d.ts +19 -0
- package/dist/web/components/form/location/common/mapView.js +170 -0
- package/dist/web/components/form/location/common/propsConfig.d.ts +59 -0
- package/dist/web/components/form/location/common/propsConfig.js +50 -0
- package/dist/web/components/form/location/common/selectModal.css +45 -0
- package/dist/web/components/form/location/common/selectModal.d.ts +21 -0
- package/dist/web/components/form/location/common/selectModal.js +44 -0
- package/dist/web/components/form/location/common/useLocationInfo.d.ts +36 -0
- package/dist/web/components/form/location/common/useLocationInfo.js +104 -0
- package/dist/web/components/form/location/components/LocationH5/index.css +100 -0
- package/dist/web/components/form/location/components/LocationH5/location.h5.d.ts +8 -0
- package/dist/web/components/form/location/components/LocationH5/location.h5.js +323 -0
- package/dist/web/components/form/location/components/LocationPC/Header.d.ts +12 -0
- package/dist/web/components/form/location/components/LocationPC/Header.js +43 -0
- package/dist/web/components/form/location/components/LocationPC/index.css +40 -0
- package/dist/web/components/form/location/components/LocationPC/location.PC.d.ts +8 -0
- package/dist/web/components/form/location/components/LocationPC/location.PC.js +224 -0
- package/dist/web/components/form/location/constants.d.ts +2 -0
- package/dist/web/components/form/location/constants.js +3 -0
- package/dist/web/components/form/location/index.css +13 -0
- package/dist/web/components/form/location/index.d.ts +1 -0
- package/dist/web/components/form/location/index.js +17 -0
- package/dist/web/components/form/radio/index.css +12 -0
- package/dist/web/components/form/radio/index.d.ts +11 -0
- package/dist/web/components/form/radio/index.js +115 -0
- package/dist/web/components/form/renderDecorator.d.ts +6 -0
- package/dist/web/components/form/renderDecorator.js +20 -0
- package/dist/web/components/form/select/h5.d.ts +16 -0
- package/dist/web/components/form/select/h5.js +504 -0
- package/dist/web/components/form/select/index.css +27 -0
- package/dist/web/components/form/select/index.d.ts +65 -0
- package/dist/web/components/form/select/index.js +301 -0
- package/dist/web/components/form/select/region/index.d.ts +6 -0
- package/dist/web/components/form/select/region/index.js +147 -0
- package/dist/web/components/form/select/time.d.ts +9 -0
- package/dist/web/components/form/select/time.js +146 -0
- package/dist/web/components/form/select/year.d.ts +7 -0
- package/dist/web/components/form/select/year.js +72 -0
- package/dist/web/components/form/switch/index.d.ts +6 -0
- package/dist/web/components/form/switch/index.js +57 -0
- package/dist/web/components/form/textarea/index.css +11 -0
- package/dist/web/components/form/textarea/index.d.ts +12 -0
- package/dist/web/components/form/textarea/index.js +66 -0
- package/dist/web/components/form/tips/index.css +4 -0
- package/dist/web/components/form/tips/index.d.ts +8 -0
- package/dist/web/components/form/tips/index.js +17 -0
- package/dist/web/components/form/uploader/index.css +118 -0
- package/dist/web/components/form/uploader/index.d.ts +3 -0
- package/dist/web/components/form/uploader/index.js +42 -0
- package/dist/web/components/form/uploader/uploader.h5.d.ts +19 -0
- package/dist/web/components/form/uploader/uploader.h5.js +201 -0
- package/dist/web/components/form/uploader/uploader.pc.d.ts +29 -0
- package/dist/web/components/form/uploader/uploader.pc.js +182 -0
- package/dist/web/components/form/uploaderFile/index.css +422 -0
- package/dist/web/components/form/uploaderFile/index.d.ts +4 -0
- package/dist/web/components/form/uploaderFile/index.js +19 -0
- package/dist/web/components/form/uploaderFile/uploadFile.h5.d.ts +23 -0
- package/dist/web/components/form/uploaderFile/uploadFile.h5.js +315 -0
- package/dist/web/components/form/uploaderFile/uploadFile.pc.d.ts +24 -0
- package/dist/web/components/form/uploaderFile/uploadFile.pc.js +290 -0
- package/dist/web/components/graphicCard/index.css +159 -0
- package/dist/web/components/graphicCard/index.d.ts +31 -0
- package/dist/web/components/graphicCard/index.js +166 -0
- package/dist/web/components/image/image.d.ts +9 -0
- package/dist/web/components/image/image.js +119 -0
- package/dist/web/components/image/index.css +54 -0
- package/dist/web/components/image/index.d.ts +13 -0
- package/dist/web/components/image/index.js +91 -0
- package/dist/web/components/index.d.ts +47 -0
- package/dist/web/components/index.js +94 -0
- package/dist/web/components/link/index.css +8 -0
- package/dist/web/components/link/index.d.ts +24 -0
- package/dist/web/components/link/index.js +71 -0
- package/dist/web/components/listView/index.css +143 -0
- package/dist/web/components/listView/index.d.ts +7 -0
- package/dist/web/components/listView/index.js +262 -0
- package/dist/web/components/listView/interface.d.ts +122 -0
- package/dist/web/components/listView/interface.js +1 -0
- package/dist/web/components/lottery/index.css +359 -0
- package/dist/web/components/lottery/index.d.ts +22 -0
- package/dist/web/components/lottery/index.js +390 -0
- package/dist/web/components/lottery/lotteryUtil.d.ts +23 -0
- package/dist/web/components/lottery/lotteryUtil.js +180 -0
- package/dist/web/components/modal/h5.css +53 -0
- package/dist/web/components/modal/index.d.ts +17 -0
- package/dist/web/components/modal/index.js +11 -0
- package/dist/web/components/modal/modal.h5.d.ts +4 -0
- package/dist/web/components/modal/modal.h5.js +46 -0
- package/dist/web/components/modal/modal.pc.d.ts +3 -0
- package/dist/web/components/modal/modal.pc.js +31 -0
- package/dist/web/components/navLayout/index.css +332 -0
- package/dist/web/components/navLayout/index.d.ts +46 -0
- package/dist/web/components/navLayout/index.js +116 -0
- package/dist/web/components/navigationBar/common.d.ts +15 -0
- package/dist/web/components/navigationBar/common.js +127 -0
- package/dist/web/components/navigationBar/h5Menu.d.ts +14 -0
- package/dist/web/components/navigationBar/h5Menu.js +72 -0
- package/dist/web/components/navigationBar/horizontalMenu.d.ts +12 -0
- package/dist/web/components/navigationBar/horizontalMenu.js +99 -0
- package/dist/web/components/navigationBar/index.css +762 -0
- package/dist/web/components/navigationBar/index.d.ts +13 -0
- package/dist/web/components/navigationBar/index.js +157 -0
- package/dist/web/components/navigationBar/verticalMenu.d.ts +13 -0
- package/dist/web/components/navigationBar/verticalMenu.js +38 -0
- package/dist/web/components/phone/index.d.ts +18 -0
- package/dist/web/components/phone/index.js +4 -0
- package/dist/web/components/phoneCode/index.d.ts +18 -0
- package/dist/web/components/phoneCode/index.js +4 -0
- package/dist/web/components/picker/datePicker.d.ts +10 -0
- package/dist/web/components/picker/datePicker.js +31 -0
- package/dist/web/components/picker/picker.d.ts +6 -0
- package/dist/web/components/picker/picker.js +45 -0
- package/dist/web/components/picker/timePicker.d.ts +7 -0
- package/dist/web/components/picker/timePicker.js +42 -0
- package/dist/web/components/richText/const.d.ts +1 -0
- package/dist/web/components/richText/const.js +2 -0
- package/dist/web/components/richText/index.css +93 -0
- package/dist/web/components/richText/index.d.ts +51 -0
- package/dist/web/components/richText/index.js +298 -0
- package/dist/web/components/richTextView/index.css +63 -0
- package/dist/web/components/richTextView/index.d.ts +7 -0
- package/dist/web/components/richTextView/index.js +44 -0
- package/dist/web/components/scrollView/index.d.ts +27 -0
- package/dist/web/components/scrollView/index.js +95 -0
- package/dist/web/components/share/index.d.ts +34 -0
- package/dist/web/components/share/index.js +4 -0
- package/dist/web/components/slot/index.d.ts +6 -0
- package/dist/web/components/slot/index.js +9 -0
- package/dist/web/components/swiper/index.css +106 -0
- package/dist/web/components/swiper/index.d.ts +24 -0
- package/dist/web/components/swiper/index.js +149 -0
- package/dist/web/components/tabs/index.css +64 -0
- package/dist/web/components/tabs/index.d.ts +13 -0
- package/dist/web/components/tabs/index.js +15 -0
- package/dist/web/components/tabs/tabs.h5.d.ts +4 -0
- package/dist/web/components/tabs/tabs.h5.js +42 -0
- package/dist/web/components/tabs/tabs.pc.d.ts +3 -0
- package/dist/web/components/tabs/tabs.pc.js +40 -0
- package/dist/web/components/text/index.css +26 -0
- package/dist/web/components/text/index.d.ts +14 -0
- package/dist/web/components/text/index.js +17 -0
- package/dist/web/components/uploaderFileView/index.css +11 -0
- package/dist/web/components/uploaderFileView/index.d.ts +10 -0
- package/dist/web/components/uploaderFileView/index.js +61 -0
- package/dist/web/components/uploaderView/index.css +31 -0
- package/dist/web/components/uploaderView/index.d.ts +17 -0
- package/dist/web/components/uploaderView/index.js +48 -0
- package/dist/web/components/userInfo/index.d.ts +26 -0
- package/dist/web/components/userInfo/index.js +4 -0
- package/dist/web/components/wedaVideo/index.css +42 -0
- package/dist/web/components/wedaVideo/index.d.ts +17 -0
- package/dist/web/components/wedaVideo/index.js +159 -0
- package/dist/web/index.d.ts +8 -0
- package/dist/web/index.js +4 -0
- package/dist/web/utils/classnames.d.ts +2 -0
- package/dist/web/utils/classnames.js +37 -0
- package/dist/web/utils/constant.d.ts +23 -0
- package/dist/web/utils/constant.js +24 -0
- package/dist/web/utils/debounce.d.ts +2 -0
- package/dist/web/utils/debounce.js +92 -0
- package/dist/web/utils/events.d.ts +1 -0
- package/dist/web/utils/events.js +2 -0
- package/dist/web/utils/getLocalCounter.d.ts +1 -0
- package/dist/web/utils/getLocalCounter.js +4 -0
- package/dist/web/utils/isObjectEqual.d.ts +2 -0
- package/dist/web/utils/isObjectEqual.js +12 -0
- package/dist/web/utils/loading-fallback.d.ts +2 -0
- package/dist/web/utils/loading-fallback.js +2 -0
- package/dist/web/utils/lodash.d.ts +1 -0
- package/dist/web/utils/lodash.js +2 -0
- package/dist/web/utils/platform.d.ts +18 -0
- package/dist/web/utils/platform.js +191 -0
- package/dist/web/utils/tcb.d.ts +23 -0
- package/dist/web/utils/tcb.js +82 -0
- package/dist/web/utils/tmap.d.ts +3 -0
- package/dist/web/utils/tmap.js +21 -0
- package/dist/web/utils/useSetState.d.ts +1 -0
- package/dist/web/utils/useSetState.js +8 -0
- package/dist/web/utils/useSyncValue.d.ts +4 -0
- package/dist/web/utils/useSyncValue.js +15 -0
- package/dist/web/utils/weui.d.ts +1 -0
- package/dist/web/utils/weui.js +2 -0
- package/dist/web/weda-ui.css +90 -0
- package/package.json +12 -12
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { TcbImage } from '../form/uploader/uploader.pc';
|
|
3
|
+
import classNames from '../../utils/classnames';
|
|
4
|
+
import './index.css';
|
|
5
|
+
import { emptyObject } from '../../utils/constant';
|
|
6
|
+
const CLASS_PREFIX = 'g-uploader-view';
|
|
7
|
+
/**
|
|
8
|
+
* 图片上传-展示组件
|
|
9
|
+
*/
|
|
10
|
+
export default function UploaderView({ srcList, // 兼容 cloud:和https: 协议,兼容 字符串和字符串数组
|
|
11
|
+
alt = '[加载失败]', gutter = 8, height = 100, width = 100, events = emptyObject, isZoom = true, isEmptyPlace = true, className, id, style, }) {
|
|
12
|
+
const cls = classNames({
|
|
13
|
+
[CLASS_PREFIX]: true,
|
|
14
|
+
[className]: className,
|
|
15
|
+
});
|
|
16
|
+
// 成功事件,返回加载成功的链接
|
|
17
|
+
const [successList, setSuccessList] = React.useState([]);
|
|
18
|
+
// 失败事件,返回加载失败的链接
|
|
19
|
+
const [errorList, setErrorList] = React.useState([]);
|
|
20
|
+
React.useEffect(() => {
|
|
21
|
+
events.load && events.load({ success: successList, error: errorList });
|
|
22
|
+
}, [successList, errorList]);
|
|
23
|
+
const boxStyle = {
|
|
24
|
+
marginRight: gutter,
|
|
25
|
+
marginBottom: gutter,
|
|
26
|
+
height: height,
|
|
27
|
+
width: width,
|
|
28
|
+
};
|
|
29
|
+
const values = []
|
|
30
|
+
.concat(srcList)
|
|
31
|
+
.filter((d) => typeof d === 'string' && d !== '');
|
|
32
|
+
return (React.createElement("div", { className: cls, id: id, style: style },
|
|
33
|
+
React.createElement("div", { className: `${CLASS_PREFIX}__image-list` },
|
|
34
|
+
values.map((d, i) => {
|
|
35
|
+
const imgProps = {
|
|
36
|
+
fileID: d,
|
|
37
|
+
className: `${CLASS_PREFIX}__image`,
|
|
38
|
+
alt: alt,
|
|
39
|
+
isZoom,
|
|
40
|
+
onLoad: () => setSuccessList((list) => [...list, d]),
|
|
41
|
+
onError: () => setErrorList((list) => [...list, d]),
|
|
42
|
+
};
|
|
43
|
+
return (React.createElement("div", { className: `${CLASS_PREFIX}__image-box`, key: `${d}-${i}`, style: boxStyle, title: d },
|
|
44
|
+
React.createElement(TcbImage, { ...imgProps })));
|
|
45
|
+
}),
|
|
46
|
+
values.length === 0 && isEmptyPlace && (React.createElement("div", { className: `${CLASS_PREFIX}__image-box`, style: boxStyle },
|
|
47
|
+
React.createElement("img", { className: `${CLASS_PREFIX}__image`, alt: "\u6682\u65E0\u56FE\u7247" }))))));
|
|
48
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { CommonPropsType } from '../../types';
|
|
3
|
+
declare const UserInfo: (props: PropsType) => JSX.Element;
|
|
4
|
+
export interface PropsType extends CommonPropsType {
|
|
5
|
+
/**
|
|
6
|
+
* 按钮标题
|
|
7
|
+
*/
|
|
8
|
+
text?: string;
|
|
9
|
+
/**
|
|
10
|
+
* 按钮风格
|
|
11
|
+
*/
|
|
12
|
+
type?: 'primary' | 'warn' | 'wechat' | 'default';
|
|
13
|
+
/**
|
|
14
|
+
* 按钮大小
|
|
15
|
+
*/
|
|
16
|
+
size?: 'default' | 'mini' | 'large';
|
|
17
|
+
/**
|
|
18
|
+
* 信息用途
|
|
19
|
+
*/
|
|
20
|
+
usage?: string;
|
|
21
|
+
/**
|
|
22
|
+
* 语言
|
|
23
|
+
*/
|
|
24
|
+
language?: string;
|
|
25
|
+
}
|
|
26
|
+
export default UserInfo;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
.weda-ui_video {
|
|
2
|
+
height: 35.71429rem;
|
|
3
|
+
overflow: hidden;
|
|
4
|
+
background-color: #000;
|
|
5
|
+
position: relative;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.weda-ui_video-h5 {
|
|
9
|
+
height: 17.85714rem;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.weda-ui_video_control .vjs-control-bar {
|
|
13
|
+
background: none !important;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.weda-ui_video__video-wrap {
|
|
17
|
+
padding-top: 0 !important;
|
|
18
|
+
height: 100% !important;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.vjs-paused .vjs-big-play-button,
|
|
22
|
+
.vjs-paused.vjs-has-started .vjs-big-play-button {
|
|
23
|
+
display: block;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.vjs-slider-vertical .vjs-volume-level:before {
|
|
27
|
+
left: -0.5em !important;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.weda-ui_video__video-loading {
|
|
31
|
+
position: absolute;
|
|
32
|
+
z-index: 100;
|
|
33
|
+
left: 0;
|
|
34
|
+
top: 0;
|
|
35
|
+
width: 100%;
|
|
36
|
+
height: 100%;
|
|
37
|
+
background-color: #000;
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
color: #fff;
|
|
42
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import 'video.js/dist/video-js.css';
|
|
3
|
+
import './index.css';
|
|
4
|
+
import type { CommonPropsType } from '../../types';
|
|
5
|
+
export interface VideoProps {
|
|
6
|
+
videoDataSource: string;
|
|
7
|
+
posterImage: string;
|
|
8
|
+
autoPlay: boolean;
|
|
9
|
+
loopPlay: boolean;
|
|
10
|
+
mutePlay: boolean;
|
|
11
|
+
controlBarStatus: boolean;
|
|
12
|
+
startTime: number;
|
|
13
|
+
endTime: number;
|
|
14
|
+
}
|
|
15
|
+
export declare type WedaVideoProps = Partial<CommonPropsType & VideoProps>;
|
|
16
|
+
declare const WedaVideo: React.FC<WedaVideoProps>;
|
|
17
|
+
export default WedaVideo;
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import videojs from 'video.js';
|
|
3
|
+
import 'video.js/dist/video-js.css';
|
|
4
|
+
import './index.css';
|
|
5
|
+
import { usePlatform, isCloudFileID, isInIde } from '../../utils/platform';
|
|
6
|
+
import { getTempFileURL } from '../../utils/tcb';
|
|
7
|
+
import classNames from '../../utils/classnames';
|
|
8
|
+
import { ConfigProvider, Icon } from 'tea-component';
|
|
9
|
+
const { useEffect, useRef, useMemo, useState } = React;
|
|
10
|
+
const MimetypesKind = {
|
|
11
|
+
opus: 'video/ogg',
|
|
12
|
+
ogv: 'video/ogg',
|
|
13
|
+
mp4: 'video/mp4',
|
|
14
|
+
mov: 'video/mp4',
|
|
15
|
+
m4v: 'video/mp4',
|
|
16
|
+
mkv: 'video/x-matroska',
|
|
17
|
+
m4a: 'audio/mp4',
|
|
18
|
+
mp3: 'audio/mpeg',
|
|
19
|
+
aac: 'audio/aac',
|
|
20
|
+
caf: 'audio/x-caf',
|
|
21
|
+
flac: 'audio/flac',
|
|
22
|
+
oga: 'audio/ogg',
|
|
23
|
+
wav: 'audio/wav',
|
|
24
|
+
m3u8: 'application/x-mpegURL',
|
|
25
|
+
jpg: 'image/jpeg',
|
|
26
|
+
jpeg: 'image/jpeg',
|
|
27
|
+
gif: 'image/gif',
|
|
28
|
+
png: 'image/png',
|
|
29
|
+
svg: 'image/svg+xml',
|
|
30
|
+
webp: 'image/webp',
|
|
31
|
+
};
|
|
32
|
+
const CLASS_PREFIX = 'weda-ui_video';
|
|
33
|
+
const WedaVideo = ({ className, style, id, videoDataSource, posterImage, autoPlay, loopPlay, mutePlay, controlBarStatus, startTime, endTime, }) => {
|
|
34
|
+
const platform = usePlatform();
|
|
35
|
+
const cls = classNames({
|
|
36
|
+
[className]: className,
|
|
37
|
+
[CLASS_PREFIX]: true,
|
|
38
|
+
[`${CLASS_PREFIX}-h5`]: platform === 'h5',
|
|
39
|
+
'weda-ui_video_control': !controlBarStatus,
|
|
40
|
+
});
|
|
41
|
+
const videoRef = useRef(null);
|
|
42
|
+
const playerRef = useRef(null);
|
|
43
|
+
const [realSrc, setRealSrc] = useState(null);
|
|
44
|
+
const [videoModalStatus, setVideoModalStatus] = useState(true);
|
|
45
|
+
const [videoErrMsg, setVideoErrMsg] = useState('');
|
|
46
|
+
const videoType = useMemo(() => {
|
|
47
|
+
return realSrc === null || realSrc === void 0 ? void 0 : realSrc.substring(realSrc.lastIndexOf('.') + 1).toLowerCase();
|
|
48
|
+
}, [realSrc]);
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
async function getCloudUrl(fileID) {
|
|
51
|
+
if (isCloudFileID(fileID)) {
|
|
52
|
+
try {
|
|
53
|
+
const fileSrc = await getTempFileURL(fileID);
|
|
54
|
+
setVideoErrMsg('');
|
|
55
|
+
setRealSrc(fileSrc);
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
console.error('getCloudUrl error', err);
|
|
59
|
+
setVideoErrMsg('获取云文件资源失败');
|
|
60
|
+
setRealSrc('');
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
setRealSrc(videoDataSource);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
getCloudUrl(videoDataSource);
|
|
68
|
+
}, [videoDataSource]);
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
const videoElement = videoRef.current;
|
|
71
|
+
if (!playerRef.current) {
|
|
72
|
+
const videoOptions = {
|
|
73
|
+
poster: posterImage,
|
|
74
|
+
autoplay: autoPlay,
|
|
75
|
+
bigPlayButton: true,
|
|
76
|
+
loop: loopPlay,
|
|
77
|
+
muted: mutePlay,
|
|
78
|
+
controls: controlBarStatus,
|
|
79
|
+
language: 'zh-CN',
|
|
80
|
+
fluid: true,
|
|
81
|
+
controlBar: {
|
|
82
|
+
children: [
|
|
83
|
+
{ name: 'playToggle' },
|
|
84
|
+
{ name: 'currentTimeDisplay' },
|
|
85
|
+
{ name: 'progressControl' },
|
|
86
|
+
{ name: 'durationDisplay' },
|
|
87
|
+
{
|
|
88
|
+
name: 'volumePanel',
|
|
89
|
+
inline: false, // 不使用水平方式
|
|
90
|
+
},
|
|
91
|
+
{ name: 'FullscreenToggle' }, // 全屏按钮
|
|
92
|
+
],
|
|
93
|
+
},
|
|
94
|
+
sources: [
|
|
95
|
+
{
|
|
96
|
+
src: realSrc || 'no',
|
|
97
|
+
type: MimetypesKind[videoType] || 'video/mp4',
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
};
|
|
101
|
+
playerRef.current = videojs(videoElement, videoOptions, () => {
|
|
102
|
+
players.currentTime(startTime); //指定播放时间
|
|
103
|
+
setVideoModalStatus(false);
|
|
104
|
+
setVideoErrMsg('');
|
|
105
|
+
});
|
|
106
|
+
const players = playerRef.current;
|
|
107
|
+
// 指定结束时间
|
|
108
|
+
if (endTime) {
|
|
109
|
+
players.on('timeupdate', () => {
|
|
110
|
+
//播放时间改变
|
|
111
|
+
const currentTime = players.currentTime();
|
|
112
|
+
if (startTime >= endTime)
|
|
113
|
+
return;
|
|
114
|
+
if (currentTime > endTime) {
|
|
115
|
+
players.currentTime(startTime);
|
|
116
|
+
setTimeout(() => {
|
|
117
|
+
!loopPlay && players.pause();
|
|
118
|
+
}, 200);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
players.on('canplaythrough', function () {
|
|
123
|
+
setVideoModalStatus(false);
|
|
124
|
+
setVideoErrMsg('');
|
|
125
|
+
});
|
|
126
|
+
players.on('error', function () {
|
|
127
|
+
let errorMsg = `视频资源加载出错,错误信息:${players === null || players === void 0 ? void 0 : players.error().message}`;
|
|
128
|
+
const pattern = new RegExp('^(((https?)://)|/resources/)[^\\s]+$');
|
|
129
|
+
if (isInIde() &&
|
|
130
|
+
!pattern.test(videoDataSource) &&
|
|
131
|
+
!isCloudFileID(videoDataSource)) {
|
|
132
|
+
errorMsg = '请在预览区查看视频效果';
|
|
133
|
+
}
|
|
134
|
+
console.log('player error', errorMsg);
|
|
135
|
+
setVideoErrMsg(errorMsg);
|
|
136
|
+
setVideoModalStatus(true);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}, [videoRef]);
|
|
140
|
+
useEffect(() => {
|
|
141
|
+
// 切换视频源
|
|
142
|
+
if (playerRef.current && videoType) {
|
|
143
|
+
const srcOption = [
|
|
144
|
+
{
|
|
145
|
+
src: realSrc,
|
|
146
|
+
type: MimetypesKind[videoType],
|
|
147
|
+
},
|
|
148
|
+
];
|
|
149
|
+
playerRef.current.src(srcOption);
|
|
150
|
+
playerRef.current.load(realSrc);
|
|
151
|
+
}
|
|
152
|
+
}, [realSrc]);
|
|
153
|
+
return (React.createElement(ConfigProvider, { classPrefix: "wedatea2td" },
|
|
154
|
+
React.createElement("div", { className: cls, id: id, style: style, "data-testid": "wedaVideo" },
|
|
155
|
+
React.createElement("div", { "data-vjs-player": true },
|
|
156
|
+
React.createElement("video", { ref: videoRef, className: `video-js vjs-big-play-centered ${CLASS_PREFIX}__video-wrap` })),
|
|
157
|
+
videoModalStatus && (React.createElement("div", { className: `${CLASS_PREFIX}__video-loading` }, realSrc === null ? React.createElement(Icon, { type: "loading" }) : videoErrMsg)))));
|
|
158
|
+
};
|
|
159
|
+
export default WedaVideo;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/* !
|
|
2
|
+
Copyright (c) 2018 Jed Watson.
|
|
3
|
+
Licensed under the MIT License (MIT), see
|
|
4
|
+
http://jedwatson.github.io/classnames
|
|
5
|
+
*/
|
|
6
|
+
function classNames(...args) {
|
|
7
|
+
const classes = [];
|
|
8
|
+
for (let i = 0; i < args.length; i++) {
|
|
9
|
+
const arg = args[i];
|
|
10
|
+
if (!arg)
|
|
11
|
+
continue;
|
|
12
|
+
const argType = typeof arg;
|
|
13
|
+
if (argType === 'string' || argType === 'number') {
|
|
14
|
+
classes.push(arg);
|
|
15
|
+
}
|
|
16
|
+
else if (Array.isArray(arg)) {
|
|
17
|
+
if (arg.length) {
|
|
18
|
+
const inner = classes.push(classNames(...arg));
|
|
19
|
+
if (inner) {
|
|
20
|
+
classes.push(inner);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
else if (argType === 'object') {
|
|
25
|
+
if (arg.toString === Object.prototype.toString) {
|
|
26
|
+
Object.keys(arg).forEach((key) => {
|
|
27
|
+
arg[key] && classes.push(key);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
classes.push(arg.toString());
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return classes.join(' ');
|
|
36
|
+
}
|
|
37
|
+
export default classNames;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const TitleType: {
|
|
2
|
+
readonly LEFT: "left";
|
|
3
|
+
readonly TOP: "top";
|
|
4
|
+
readonly NONE: "none";
|
|
5
|
+
};
|
|
6
|
+
export declare const LOAD_ERR_IMG_BASE64: "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgdmlld0JveD0iMCAwIDMyIDMyIiBmaWxsPSJub25lIj4KICA8cGF0aCBkPSJNMjUuMzIgMTYuMzU5N0MyNi4wNzY0IDE2LjM1OTcgMjYuODI1NCAxNi41MDg3IDI3LjUyNDMgMTYuNzk4MUMyOC4yMjMxIDE3LjA4NzYgMjguODU4MSAxNy41MTE5IDI5LjM5MjkgMTguMDQ2OEMyOS45Mjc4IDE4LjU4MTYgMzAuMzUyMSAxOS4yMTY2IDMwLjY0MTYgMTkuOTE1NEMzMC45MzEgMjAuNjE0MyAzMS4wOCAyMS4zNjMzIDMxLjA4IDIyLjExOTdDMzEuMDggMjIuODc2MSAzMC45MzEgMjMuNjI1MSAzMC42NDE2IDI0LjMyMzlDMzAuMzUyMSAyNS4wMjI4IDI5LjkyNzggMjUuNjU3OCAyOS4zOTI5IDI2LjE5MjZDMjguODU4MSAyNi43Mjc1IDI4LjIyMzEgMjcuMTUxOCAyNy41MjQzIDI3LjQ0MTJDMjYuODI1NCAyNy43MzA3IDI2LjA3NjQgMjcuODc5NyAyNS4zMiAyNy44Nzk3QzIzLjc5MjQgMjcuODc5NyAyMi4zMjczIDI3LjI3MjggMjEuMjQ3MSAyNi4xOTI2QzIwLjE2NjkgMjUuMTEyNCAxOS41NiAyMy42NDczIDE5LjU2IDIyLjExOTdDMTkuNTYgMjAuNTkyIDIwLjE2NjkgMTkuMTI3IDIxLjI0NzEgMTguMDQ2OEMyMi4zMjczIDE2Ljk2NjUgMjMuNzkyNCAxNi4zNTk3IDI1LjMyIDE2LjM1OTdaTTI4IDMuNTU5NjlWMTQuODc2OEMyNy4xNzc3IDE0LjU4NjYgMjYuMTkyIDE0LjQzODggMjUuMzIgMTQuNDM5N0MyNC4wMzEgMTQuNDM5NyAyMi44MTU3IDE0Ljc1NzEgMjEuNzQ4OCAxNS4zMTg0TDIwLjc5NTIgMTMuMTU5N0wxNi4wMjU5IDIwLjAyNzVMOC40NDU3NiAxNi40NDFMMy41NiAyMy4zOTk3SDE3Ljc0NjJDMTcuOTg2NyAyNC44MjkgMTguNjI4MiAyNi4xNjA2IDE5LjU5NTggMjcuMjM5N0gxVjMuNTU5NjlIMjhaTTI1Ljk2IDI0LjAzOTdIMjQuNjhWMjUuMzE5N0gyNS45NlYyNC4wMzk3Wk0yNS45NiAxOC45MTk3SDI0LjY4VjIzLjM5OTdIMjUuOTZWMTguOTE5N1pNNi4xMiAxMC41OTk3QzYuMTIgMTEuOTk4MSA3LjE5OTA0IDEzLjEwODUgOC42MDc2OCAxMy4xNTg0QzEwLjAyMDggMTMuMjA3NyAxMS4yNCAxMi4wNDggMTEuMjQgMTAuNTk5N0MxMS4yNCA5LjI0NjA5IDEwLjA2NDMgOC4wODU3NyA4Ljc1MjMyIDguMDQwOTdDNy4yOTU2OCA3Ljk5MTY5IDYuMTIgOS4xNTEzNyA2LjEyIDEwLjU5OTdaIiBmaWxsPSIjQkNDNEQwIj48L3BhdGg+Cjwvc3ZnPgo=";
|
|
7
|
+
export declare const REL_DICT: {
|
|
8
|
+
readonly equal: "eq";
|
|
9
|
+
readonly unequal: "neq";
|
|
10
|
+
readonly include: "search";
|
|
11
|
+
readonly exclude: "_exclude";
|
|
12
|
+
readonly begin_with: "_begin_with";
|
|
13
|
+
readonly greater: "gt";
|
|
14
|
+
readonly greater_or_equal: "gte";
|
|
15
|
+
readonly bigger_or_equal: "gte";
|
|
16
|
+
readonly less: "lt";
|
|
17
|
+
readonly less_or_equal: "lte";
|
|
18
|
+
readonly in: "in";
|
|
19
|
+
readonly not_in: "nin";
|
|
20
|
+
};
|
|
21
|
+
export declare const emptyObject: {};
|
|
22
|
+
export declare const emptyArray: readonly [];
|
|
23
|
+
export declare const noop: () => void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const TitleType = {
|
|
2
|
+
LEFT: 'left',
|
|
3
|
+
TOP: 'top',
|
|
4
|
+
NONE: 'none',
|
|
5
|
+
};
|
|
6
|
+
export const LOAD_ERR_IMG_BASE64 = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgdmlld0JveD0iMCAwIDMyIDMyIiBmaWxsPSJub25lIj4KICA8cGF0aCBkPSJNMjUuMzIgMTYuMzU5N0MyNi4wNzY0IDE2LjM1OTcgMjYuODI1NCAxNi41MDg3IDI3LjUyNDMgMTYuNzk4MUMyOC4yMjMxIDE3LjA4NzYgMjguODU4MSAxNy41MTE5IDI5LjM5MjkgMTguMDQ2OEMyOS45Mjc4IDE4LjU4MTYgMzAuMzUyMSAxOS4yMTY2IDMwLjY0MTYgMTkuOTE1NEMzMC45MzEgMjAuNjE0MyAzMS4wOCAyMS4zNjMzIDMxLjA4IDIyLjExOTdDMzEuMDggMjIuODc2MSAzMC45MzEgMjMuNjI1MSAzMC42NDE2IDI0LjMyMzlDMzAuMzUyMSAyNS4wMjI4IDI5LjkyNzggMjUuNjU3OCAyOS4zOTI5IDI2LjE5MjZDMjguODU4MSAyNi43Mjc1IDI4LjIyMzEgMjcuMTUxOCAyNy41MjQzIDI3LjQ0MTJDMjYuODI1NCAyNy43MzA3IDI2LjA3NjQgMjcuODc5NyAyNS4zMiAyNy44Nzk3QzIzLjc5MjQgMjcuODc5NyAyMi4zMjczIDI3LjI3MjggMjEuMjQ3MSAyNi4xOTI2QzIwLjE2NjkgMjUuMTEyNCAxOS41NiAyMy42NDczIDE5LjU2IDIyLjExOTdDMTkuNTYgMjAuNTkyIDIwLjE2NjkgMTkuMTI3IDIxLjI0NzEgMTguMDQ2OEMyMi4zMjczIDE2Ljk2NjUgMjMuNzkyNCAxNi4zNTk3IDI1LjMyIDE2LjM1OTdaTTI4IDMuNTU5NjlWMTQuODc2OEMyNy4xNzc3IDE0LjU4NjYgMjYuMTkyIDE0LjQzODggMjUuMzIgMTQuNDM5N0MyNC4wMzEgMTQuNDM5NyAyMi44MTU3IDE0Ljc1NzEgMjEuNzQ4OCAxNS4zMTg0TDIwLjc5NTIgMTMuMTU5N0wxNi4wMjU5IDIwLjAyNzVMOC40NDU3NiAxNi40NDFMMy41NiAyMy4zOTk3SDE3Ljc0NjJDMTcuOTg2NyAyNC44MjkgMTguNjI4MiAyNi4xNjA2IDE5LjU5NTggMjcuMjM5N0gxVjMuNTU5NjlIMjhaTTI1Ljk2IDI0LjAzOTdIMjQuNjhWMjUuMzE5N0gyNS45NlYyNC4wMzk3Wk0yNS45NiAxOC45MTk3SDI0LjY4VjIzLjM5OTdIMjUuOTZWMTguOTE5N1pNNi4xMiAxMC41OTk3QzYuMTIgMTEuOTk4MSA3LjE5OTA0IDEzLjEwODUgOC42MDc2OCAxMy4xNTg0QzEwLjAyMDggMTMuMjA3NyAxMS4yNCAxMi4wNDggMTEuMjQgMTAuNTk5N0MxMS4yNCA5LjI0NjA5IDEwLjA2NDMgOC4wODU3NyA4Ljc1MjMyIDguMDQwOTdDNy4yOTU2OCA3Ljk5MTY5IDYuMTIgOS4xNTEzNyA2LjEyIDEwLjU5OTdaIiBmaWxsPSIjQkNDNEQwIj48L3BhdGg+Cjwvc3ZnPgo=';
|
|
7
|
+
export const REL_DICT = {
|
|
8
|
+
equal: 'eq',
|
|
9
|
+
unequal: 'neq',
|
|
10
|
+
include: 'search',
|
|
11
|
+
exclude: '_exclude',
|
|
12
|
+
begin_with: '_begin_with',
|
|
13
|
+
greater: 'gt',
|
|
14
|
+
greater_or_equal: 'gte',
|
|
15
|
+
bigger_or_equal: 'gte',
|
|
16
|
+
less: 'lt',
|
|
17
|
+
less_or_equal: 'lte',
|
|
18
|
+
in: 'in',
|
|
19
|
+
not_in: 'nin', // 不在多选值
|
|
20
|
+
};
|
|
21
|
+
export const emptyObject = {};
|
|
22
|
+
export const emptyArray = [];
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
24
|
+
export const noop = (() => { });
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
function isObject(value) {
|
|
3
|
+
const type = typeof value;
|
|
4
|
+
return value != null && (type === 'object' || type === 'function');
|
|
5
|
+
}
|
|
6
|
+
function debounce(func, wait, options) {
|
|
7
|
+
let lastArgs, lastThis, maxWait, result, timerId, lastCallTime;
|
|
8
|
+
let lastInvokeTime = 0;
|
|
9
|
+
let leading = false;
|
|
10
|
+
let maxing = false;
|
|
11
|
+
let trailing = true;
|
|
12
|
+
if (typeof func !== 'function') {
|
|
13
|
+
throw new TypeError('Expected a function');
|
|
14
|
+
}
|
|
15
|
+
wait = +wait || 0;
|
|
16
|
+
if (isObject(options)) {
|
|
17
|
+
leading = !!options.leading;
|
|
18
|
+
maxing = 'maxWait' in options;
|
|
19
|
+
maxWait = maxing ? Math.max(+options.maxWait || 0, wait) : maxWait;
|
|
20
|
+
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
21
|
+
}
|
|
22
|
+
function invokeFunc(time) {
|
|
23
|
+
const args = lastArgs;
|
|
24
|
+
const thisArg = lastThis;
|
|
25
|
+
lastArgs = lastThis = undefined;
|
|
26
|
+
lastInvokeTime = time;
|
|
27
|
+
result = func.apply(thisArg, args);
|
|
28
|
+
return result;
|
|
29
|
+
}
|
|
30
|
+
function startTimer(pendingFunc, wait) {
|
|
31
|
+
return setTimeout(pendingFunc, wait);
|
|
32
|
+
}
|
|
33
|
+
function leadingEdge(time) {
|
|
34
|
+
lastInvokeTime = time;
|
|
35
|
+
timerId = startTimer(timerExpired, wait);
|
|
36
|
+
return leading ? invokeFunc(time) : result;
|
|
37
|
+
}
|
|
38
|
+
function remainingWait(time) {
|
|
39
|
+
const timeSinceLastCall = time - lastCallTime;
|
|
40
|
+
const timeSinceLastInvoke = time - lastInvokeTime;
|
|
41
|
+
const timeWaiting = wait - timeSinceLastCall;
|
|
42
|
+
return maxing
|
|
43
|
+
? Math.min(timeWaiting, maxWait - timeSinceLastInvoke)
|
|
44
|
+
: timeWaiting;
|
|
45
|
+
}
|
|
46
|
+
function shouldInvoke(time) {
|
|
47
|
+
const timeSinceLastCall = time - lastCallTime;
|
|
48
|
+
const timeSinceLastInvoke = time - lastInvokeTime;
|
|
49
|
+
return (lastCallTime === undefined ||
|
|
50
|
+
timeSinceLastCall >= wait ||
|
|
51
|
+
timeSinceLastCall < 0 ||
|
|
52
|
+
(maxing && timeSinceLastInvoke >= maxWait));
|
|
53
|
+
}
|
|
54
|
+
function timerExpired() {
|
|
55
|
+
const time = Date.now();
|
|
56
|
+
if (shouldInvoke(time)) {
|
|
57
|
+
return trailingEdge(time);
|
|
58
|
+
}
|
|
59
|
+
timerId = startTimer(timerExpired, remainingWait(time));
|
|
60
|
+
}
|
|
61
|
+
function trailingEdge(time) {
|
|
62
|
+
timerId = undefined;
|
|
63
|
+
if (trailing && lastArgs) {
|
|
64
|
+
return invokeFunc(time);
|
|
65
|
+
}
|
|
66
|
+
lastArgs = lastThis = undefined;
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
//debouncedFunc
|
|
70
|
+
function debounced(...args) {
|
|
71
|
+
const time = Date.now();
|
|
72
|
+
const isInvoking = shouldInvoke(time);
|
|
73
|
+
lastArgs = args;
|
|
74
|
+
lastThis = this;
|
|
75
|
+
lastCallTime = time;
|
|
76
|
+
if (isInvoking) {
|
|
77
|
+
if (timerId === undefined) {
|
|
78
|
+
return leadingEdge(lastCallTime);
|
|
79
|
+
}
|
|
80
|
+
if (maxing) {
|
|
81
|
+
timerId = startTimer(timerExpired, wait);
|
|
82
|
+
return invokeFunc(lastCallTime);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (timerId === undefined) {
|
|
86
|
+
timerId = startTimer(timerExpired, wait);
|
|
87
|
+
}
|
|
88
|
+
return result;
|
|
89
|
+
}
|
|
90
|
+
return debounced;
|
|
91
|
+
}
|
|
92
|
+
export default debounce;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function events(evs: any): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function getLocalCounter(): number;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import isEqual from 'lodash.isequal';
|
|
2
|
+
export function serde(a) {
|
|
3
|
+
return JSON.parse(JSON.stringify(a));
|
|
4
|
+
}
|
|
5
|
+
const isObj = (a) => typeof a === 'object' && a !== null;
|
|
6
|
+
export default function (a, b, shouldSerde = false) {
|
|
7
|
+
if (shouldSerde && isObj(a) && isObj(b)) {
|
|
8
|
+
// for Proxy created by mbox
|
|
9
|
+
return isEqual(serde(a), serde(b));
|
|
10
|
+
}
|
|
11
|
+
return isEqual(a, b);
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isNil: (val: unknown) => val is null;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export function usePlatform(): "h5" | "pc";
|
|
2
|
+
/**
|
|
3
|
+
* 在h5下,判断当前是否是移动浏览器
|
|
4
|
+
*/
|
|
5
|
+
export function inH5IsMobile(): boolean;
|
|
6
|
+
export function isH5Platform(): boolean;
|
|
7
|
+
export function isCloudFileID(url: any): boolean;
|
|
8
|
+
export function isHttpFileID(url: any): boolean;
|
|
9
|
+
export function filterStrList(value: any): any[];
|
|
10
|
+
export function transSize(size: any): string;
|
|
11
|
+
export function downloadFile(url: any): void;
|
|
12
|
+
export function cutFileTitle(str?: string, count?: number): string;
|
|
13
|
+
export function isInIde(): boolean;
|
|
14
|
+
export function resolveStaticResourceUrl(path: any): any;
|
|
15
|
+
export function transFileCloudidToName(fileID: any): string;
|
|
16
|
+
export function isUrl(path: any): boolean;
|
|
17
|
+
export function randomStr(len?: number): string;
|
|
18
|
+
export function getWhereList(where: any): any[];
|