@cloudbase/weda-ui 2.0.26 → 3.1.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/package.json +12 -13
- package/src/configs/actions/showModal.json +0 -48
- package/src/configs/actions/showToast.json +0 -41
- package/src/configs/components/auth.json +0 -16
- package/src/configs/components/button.json +0 -239
- package/src/configs/components/calendar.json +0 -81
- package/src/configs/components/carousel.json +0 -292
- package/src/configs/components/chart/bar.json +0 -721
- package/src/configs/components/chart/line.json +0 -674
- package/src/configs/components/chart/pie.json +0 -494
- package/src/configs/components/chart/statisticsCard.json +0 -376
- package/src/configs/components/container.json +0 -50
- package/src/configs/components/dataView.json +0 -151
- package/src/configs/components/drawer.json +0 -115
- package/src/configs/components/form/checkbox.json +0 -173
- package/src/configs/components/form/form.json +0 -45
- package/src/configs/components/form/input.json +0 -154
- package/src/configs/components/form/label.json +0 -22
- package/src/configs/components/form/location.json +0 -155
- package/src/configs/components/form/radio.json +0 -203
- package/src/configs/components/form/richText.json +0 -125
- package/src/configs/components/form/select.json +0 -411
- package/src/configs/components/form/switch.json +0 -58
- package/src/configs/components/form/textarea.json +0 -116
- package/src/configs/components/form/tips.json +0 -34
- package/src/configs/components/form/uploader.json +0 -169
- package/src/configs/components/form/uploaderFile.json +0 -158
- package/src/configs/components/graphicCard.json +0 -413
- package/src/configs/components/image.json +0 -179
- package/src/configs/components/link.json +0 -79
- package/src/configs/components/listView.json +0 -281
- package/src/configs/components/lottery.json +0 -157
- package/src/configs/components/modal.json +0 -83
- package/src/configs/components/navLayout.json +0 -368
- package/src/configs/components/navigationBar.json +0 -62
- package/src/configs/components/picker/datePicker.json +0 -33
- package/src/configs/components/picker/picker.json +0 -18
- package/src/configs/components/picker/timePicker.json +0 -23
- package/src/configs/components/richtextview.json +0 -26
- package/src/configs/components/scrollVeiw.json +0 -253
- package/src/configs/components/slot.json +0 -17
- package/src/configs/components/swiper.json +0 -90
- package/src/configs/components/tabs.json +0 -121
- package/src/configs/components/text.json +0 -95
- package/src/configs/components/wedaVideo.json +0 -89
- package/src/configs/components/wxOpenApi/phone.json +0 -127
- package/src/configs/components/wxOpenApi/phoneCode.json +0 -109
- package/src/configs/components/wxOpenApi/share.json +0 -157
- package/src/configs/components/wxOpenApi/userInfo.json +0 -156
- package/src/configs/index.js +0 -111
- package/src/index.js +0 -4
- package/src/mp/README.md +0 -1
- package/src/mp/actions/showModal/index.js +0 -3
- package/src/mp/actions/showToast/index.js +0 -3
- package/src/mp/components/button/index.js +0 -91
- package/src/mp/components/button/index.json +0 -4
- package/src/mp/components/button/index.wxml +0 -22
- package/src/mp/components/button/index.wxss +0 -13
- package/src/mp/components/calendar/arrowright--line.svg +0 -11
- package/src/mp/components/calendar/index.js +0 -268
- package/src/mp/components/calendar/index.json +0 -5
- package/src/mp/components/calendar/index.wxml +0 -35
- package/src/mp/components/calendar/index.wxss +0 -179
- package/src/mp/components/carousel/index.js +0 -88
- package/src/mp/components/carousel/index.json +0 -7
- package/src/mp/components/carousel/index.wxml +0 -6
- package/src/mp/components/chart/bar/index.js +0 -257
- package/src/mp/components/chart/bar/index.json +0 -6
- package/src/mp/components/chart/bar/index.wxml +0 -3
- package/src/mp/components/chart/bar/index.wxss +0 -9
- package/src/mp/components/chart/common/config/bar.js +0 -50
- package/src/mp/components/chart/common/config/global.js +0 -16
- package/src/mp/components/chart/common/config/line.js +0 -48
- package/src/mp/components/chart/common/config/pie.js +0 -36
- package/src/mp/components/chart/common/core/eChartBar.js +0 -258
- package/src/mp/components/chart/common/core/eChartBase.js +0 -389
- package/src/mp/components/chart/common/core/eChartLine.js +0 -223
- package/src/mp/components/chart/common/core/eChartPie.js +0 -169
- package/src/mp/components/chart/common/lib/echarts.min.js +0 -18
- package/src/mp/components/chart/ec-canvas/ec-canvas.js +0 -277
- package/src/mp/components/chart/ec-canvas/ec-canvas.json +0 -4
- package/src/mp/components/chart/ec-canvas/ec-canvas.wxml +0 -4
- package/src/mp/components/chart/ec-canvas/ec-canvas.wxss +0 -4
- package/src/mp/components/chart/ec-canvas/wx-canvas.js +0 -109
- package/src/mp/components/chart/line/index.js +0 -247
- package/src/mp/components/chart/line/index.json +0 -6
- package/src/mp/components/chart/line/index.wxml +0 -3
- package/src/mp/components/chart/line/index.wxss +0 -9
- package/src/mp/components/chart/pie/index.js +0 -182
- package/src/mp/components/chart/pie/index.json +0 -6
- package/src/mp/components/chart/pie/index.wxml +0 -3
- package/src/mp/components/chart/pie/index.wxss +0 -9
- package/src/mp/components/chart/statisticsCard/index.js +0 -253
- package/src/mp/components/chart/statisticsCard/index.json +0 -4
- package/src/mp/components/chart/statisticsCard/index.wxml +0 -9
- package/src/mp/components/chart/statisticsCard/index.wxss +0 -42
- package/src/mp/components/container/index.js +0 -20
- package/src/mp/components/container/index.json +0 -4
- package/src/mp/components/container/index.wxml +0 -3
- package/src/mp/components/dataView/index.js +0 -34
- package/src/mp/components/dataView/index.json +0 -7
- package/src/mp/components/dataView/index.wxml +0 -3
- package/src/mp/components/dataView/index.wxss +0 -0
- package/src/mp/components/form/checkbox/index.js +0 -124
- package/src/mp/components/form/checkbox/index.json +0 -7
- package/src/mp/components/form/checkbox/index.wxml +0 -13
- package/src/mp/components/form/checkbox/index.wxss +0 -1
- package/src/mp/components/form/form/index.js +0 -18
- package/src/mp/components/form/form/index.json +0 -4
- package/src/mp/components/form/form/index.wxml +0 -5
- package/src/mp/components/form/form/index.wxss +0 -1
- package/src/mp/components/form/formcell/index.js +0 -54
- package/src/mp/components/form/formcell/index.json +0 -4
- package/src/mp/components/form/formcell/index.wxml +0 -11
- package/src/mp/components/form/formcell/index.wxss +0 -31
- package/src/mp/components/form/input/index.js +0 -110
- package/src/mp/components/form/input/index.json +0 -7
- package/src/mp/components/form/input/index.wxml +0 -24
- package/src/mp/components/form/input/index.wxss +0 -22
- package/src/mp/components/form/location/components/mapChoose/index.js +0 -201
- package/src/mp/components/form/location/components/mapChoose/index.json +0 -4
- package/src/mp/components/form/location/components/mapChoose/index.wxml +0 -42
- package/src/mp/components/form/location/components/mapChoose/index.wxss +0 -188
- package/src/mp/components/form/location/index.js +0 -388
- package/src/mp/components/form/location/index.json +0 -6
- package/src/mp/components/form/location/index.wxml +0 -21
- package/src/mp/components/form/location/index.wxss +0 -89
- package/src/mp/components/form/radio/index.js +0 -124
- package/src/mp/components/form/radio/index.json +0 -7
- package/src/mp/components/form/radio/index.wxml +0 -13
- package/src/mp/components/form/radio/index.wxss +0 -1
- package/src/mp/components/form/select/index.js +0 -677
- package/src/mp/components/form/select/index.json +0 -7
- package/src/mp/components/form/select/index.wxml +0 -12
- package/src/mp/components/form/select/index.wxss +0 -16
- package/src/mp/components/form/select/region/index.js +0 -107
- package/src/mp/components/form/switch/index.js +0 -75
- package/src/mp/components/form/switch/index.json +0 -7
- package/src/mp/components/form/switch/index.wxml +0 -11
- package/src/mp/components/form/switch/index.wxss +0 -1
- package/src/mp/components/form/textarea/index.js +0 -90
- package/src/mp/components/form/textarea/index.json +0 -7
- package/src/mp/components/form/textarea/index.wxml +0 -8
- package/src/mp/components/form/textarea/index.wxss +0 -10
- package/src/mp/components/form/tips/index.js +0 -41
- package/src/mp/components/form/tips/index.json +0 -4
- package/src/mp/components/form/tips/index.wxml +0 -1
- package/src/mp/components/form/tips/index.wxss +0 -1
- package/src/mp/components/form/uploader/index.js +0 -158
- package/src/mp/components/form/uploader/index.json +0 -10
- package/src/mp/components/form/uploader/index.wxml +0 -14
- package/src/mp/components/form/uploader/index.wxss +0 -36
- package/src/mp/components/form/uploader/weui-uploader.js +0 -219
- package/src/mp/components/form/uploader/weui-uploader.json +0 -7
- package/src/mp/components/form/uploader/weui-uploader.wxml +0 -45
- package/src/mp/components/form/uploader/weui-uploader.wxss +0 -1
- package/src/mp/components/form/uploaderFile/index.js +0 -313
- package/src/mp/components/form/uploaderFile/index.json +0 -9
- package/src/mp/components/form/uploaderFile/index.wxml +0 -45
- package/src/mp/components/form/uploaderFile/index.wxss +0 -105
- package/src/mp/components/graphicCard/chevron-right.svg +0 -3
- package/src/mp/components/graphicCard/index.js +0 -203
- package/src/mp/components/graphicCard/index.json +0 -4
- package/src/mp/components/graphicCard/index.wxml +0 -25
- package/src/mp/components/graphicCard/index.wxss +0 -157
- package/src/mp/components/image/index.js +0 -182
- package/src/mp/components/image/index.json +0 -7
- package/src/mp/components/image/index.wxml +0 -9
- package/src/mp/components/image/index.wxss +0 -49
- package/src/mp/components/listView/arrow-right-line.svg +0 -3
- package/src/mp/components/listView/index.js +0 -274
- package/src/mp/components/listView/index.json +0 -4
- package/src/mp/components/listView/index.wxml +0 -38
- package/src/mp/components/listView/index.wxss +0 -155
- package/src/mp/components/listView/more-line.svg +0 -3
- package/src/mp/components/lottery/index.js +0 -270
- package/src/mp/components/lottery/index.json +0 -4
- package/src/mp/components/lottery/index.wxml +0 -41
- package/src/mp/components/lottery/index.wxss +0 -323
- package/src/mp/components/modal/index.js +0 -39
- package/src/mp/components/modal/index.json +0 -4
- package/src/mp/components/modal/index.wxml +0 -1
- package/src/mp/components/navLayout/index.js +0 -120
- package/src/mp/components/navLayout/index.json +0 -7
- package/src/mp/components/navLayout/index.wxml +0 -23
- package/src/mp/components/navLayout/index.wxss +0 -1193
- package/src/mp/components/navigationBar/index.js +0 -193
- package/src/mp/components/navigationBar/index.json +0 -5
- package/src/mp/components/navigationBar/index.wxml +0 -80
- package/src/mp/components/navigationBar/index.wxss +0 -1257
- package/src/mp/components/richText/index.js +0 -67
- package/src/mp/components/richText/index.json +0 -4
- package/src/mp/components/richText/index.wxml +0 -3
- package/src/mp/components/richText/index.wxss +0 -27
- package/src/mp/components/scrollView/index.js +0 -119
- package/src/mp/components/scrollView/index.json +0 -4
- package/src/mp/components/scrollView/index.wxml +0 -38
- package/src/mp/components/slot/index.js +0 -20
- package/src/mp/components/slot/index.json +0 -4
- package/src/mp/components/slot/index.wxml +0 -3
- package/src/mp/components/swiper/index.js +0 -65
- package/src/mp/components/swiper/index.json +0 -4
- package/src/mp/components/swiper/index.wxml +0 -3
- package/src/mp/components/tabs/index.js +0 -59
- package/src/mp/components/tabs/index.json +0 -4
- package/src/mp/components/tabs/index.wxml +0 -12
- package/src/mp/components/tabs/index.wxss +0 -57
- package/src/mp/components/text/index.js +0 -40
- package/src/mp/components/text/index.json +0 -4
- package/src/mp/components/text/index.wxml +0 -1
- package/src/mp/components/text/index.wxss +0 -26
- package/src/mp/components/wedaVideo/index.js +0 -86
- package/src/mp/components/wedaVideo/index.json +0 -4
- package/src/mp/components/wedaVideo/index.wxml +0 -4
- package/src/mp/components/wedaVideo/index.wxss +0 -20
- package/src/mp/components/wxOpenApi/phone/index.js +0 -109
- package/src/mp/components/wxOpenApi/phone/index.json +0 -4
- package/src/mp/components/wxOpenApi/phone/index.wxml +0 -4
- package/src/mp/components/wxOpenApi/phone/index.wxss +0 -22
- package/src/mp/components/wxOpenApi/phoneCode/index.js +0 -89
- package/src/mp/components/wxOpenApi/phoneCode/index.json +0 -4
- package/src/mp/components/wxOpenApi/phoneCode/index.wxml +0 -4
- package/src/mp/components/wxOpenApi/phoneCode/index.wxss +0 -22
- package/src/mp/components/wxOpenApi/share/index.js +0 -117
- package/src/mp/components/wxOpenApi/share/index.json +0 -4
- package/src/mp/components/wxOpenApi/share/index.wxml +0 -4
- package/src/mp/components/wxOpenApi/share/index.wxss +0 -22
- package/src/mp/components/wxOpenApi/userInfo/index.js +0 -88
- package/src/mp/components/wxOpenApi/userInfo/index.json +0 -4
- package/src/mp/components/wxOpenApi/userInfo/index.wxml +0 -4
- package/src/mp/components/wxOpenApi/userInfo/index.wxss +0 -22
- package/src/mp/index.json +0 -52
- package/src/mp/package.json +0 -6
- package/src/mp/style/weda-ui.wxss +0 -71
- package/src/mp/utils/classnames.js +0 -39
- package/src/mp/utils/constant.js +0 -20
- package/src/mp/utils/dayjs.min.js +0 -1
- package/src/mp/utils/debounce.js +0 -133
- package/src/mp/utils/deepEqual.js +0 -42
- package/src/mp/utils/destr.js +0 -49
- package/src/mp/utils/dr_square_point.js +0 -29
- package/src/mp/utils/handleEvents.js +0 -32
- package/src/mp/utils/lodash.js +0 -2
- package/src/mp/utils/platform.js +0 -45
- package/src/mp/utils/qqmap-wx-jssdk1.2/qqmap-wx-jssdk.js +0 -1336
- package/src/mp/utils/spark-md5.js +0 -776
- package/src/mp/utils/tcb.js +0 -76
- package/src/setupTests.js +0 -14
- package/src/web/actions/index.js +0 -2
- package/src/web/actions/showModal/index.tsx +0 -118
- package/src/web/actions/showToast/index.js +0 -3
- package/src/web/components/auth/index.css +0 -0
- package/src/web/components/auth/index.js +0 -66
- package/src/web/components/button/index.css +0 -27
- package/src/web/components/button/index.tsx +0 -119
- package/src/web/components/calendar/index.css +0 -416
- package/src/web/components/calendar/index.jsx +0 -312
- package/src/web/components/calendar/util.js +0 -90
- package/src/web/components/carousel/index.css +0 -119
- package/src/web/components/carousel/index.tsx +0 -417
- package/src/web/components/chart/bar/index.tsx +0 -140
- package/src/web/components/chart/common/config/bar.js +0 -49
- package/src/web/components/chart/common/config/global.js +0 -16
- package/src/web/components/chart/common/config/line.js +0 -50
- package/src/web/components/chart/common/config/pie.js +0 -37
- package/src/web/components/chart/common/core/eChartBar.js +0 -259
- package/src/web/components/chart/common/core/eChartBase.ts +0 -396
- package/src/web/components/chart/common/core/eChartLine.js +0 -225
- package/src/web/components/chart/common/core/eChartPie.js +0 -173
- package/src/web/components/chart/common/core/type.ts +0 -34
- package/src/web/components/chart/common/echart.css +0 -106
- package/src/web/components/chart/common/echarts.ts +0 -31
- package/src/web/components/chart/common/useChart.tsx +0 -87
- package/src/web/components/chart/line/index.tsx +0 -136
- package/src/web/components/chart/pie/index.tsx +0 -99
- package/src/web/components/chart/statisticsCard/index.css +0 -63
- package/src/web/components/chart/statisticsCard/index.tsx +0 -307
- package/src/web/components/chart/statisticsCard/interface.ts +0 -14
- package/src/web/components/container/index.tsx +0 -34
- package/src/web/components/dataView/index.tsx +0 -20
- package/src/web/components/dataView/interface.ts +0 -6
- package/src/web/components/drawer/index.tsx +0 -68
- package/src/web/components/form/checkbox/index.tsx +0 -210
- package/src/web/components/form/enumSelect/MultipleSelect.jsx +0 -89
- package/src/web/components/form/enumSelect/NormalSelect.tsx +0 -92
- package/src/web/components/form/enumSelect/SelectContainer.jsx +0 -43
- package/src/web/components/form/enumSelect/index.jsx +0 -9
- package/src/web/components/form/enumSelect/props/defaultProps.js +0 -39
- package/src/web/components/form/enumSelect/props/propsTypes.js +0 -50
- package/src/web/components/form/form/index.css +0 -9
- package/src/web/components/form/form/index.tsx +0 -51
- package/src/web/components/form/formcell/index.css +0 -85
- package/src/web/components/form/formcell/index.tsx +0 -85
- package/src/web/components/form/input/index.css +0 -40
- package/src/web/components/form/input/index.tsx +0 -166
- package/src/web/components/form/location/common/mapChoose.css +0 -180
- package/src/web/components/form/location/common/mapChoose.jsx +0 -343
- package/src/web/components/form/location/common/mapView.jsx +0 -190
- package/src/web/components/form/location/common/propsConfig.js +0 -54
- package/src/web/components/form/location/common/selectModal.css +0 -44
- package/src/web/components/form/location/common/selectModal.jsx +0 -73
- package/src/web/components/form/location/common/useLocationInfo.js +0 -104
- package/src/web/components/form/location/components/LocationH5/index.css +0 -239
- package/src/web/components/form/location/components/LocationH5/location.h5.jsx +0 -413
- package/src/web/components/form/location/components/LocationPC/Header.jsx +0 -96
- package/src/web/components/form/location/components/LocationPC/index.css +0 -44
- package/src/web/components/form/location/components/LocationPC/location.PC.jsx +0 -332
- package/src/web/components/form/location/constants.js +0 -4
- package/src/web/components/form/location/index.css +0 -0
- package/src/web/components/form/location/index.jsx +0 -25
- package/src/web/components/form/radio/index.css +0 -12
- package/src/web/components/form/radio/index.tsx +0 -179
- package/src/web/components/form/renderDecorator.tsx +0 -28
- package/src/web/components/form/select/h5.tsx +0 -602
- package/src/web/components/form/select/index.css +0 -27
- package/src/web/components/form/select/index.tsx +0 -510
- package/src/web/components/form/select/region/index.ts +0 -152
- package/src/web/components/form/select/time.jsx +0 -145
- package/src/web/components/form/select/year.tsx +0 -172
- package/src/web/components/form/switch/index.tsx +0 -100
- package/src/web/components/form/textarea/index.css +0 -11
- package/src/web/components/form/textarea/index.tsx +0 -127
- package/src/web/components/form/tips/index.css +0 -4
- package/src/web/components/form/tips/index.tsx +0 -34
- package/src/web/components/form/types.d.ts +0 -12
- package/src/web/components/form/uploader/index.css +0 -118
- package/src/web/components/form/uploader/index.tsx +0 -65
- package/src/web/components/form/uploader/uploader.h5.tsx +0 -290
- package/src/web/components/form/uploader/uploader.pc.tsx +0 -287
- package/src/web/components/form/uploaderFile/fail.svg +0 -12
- package/src/web/components/form/uploaderFile/index.css +0 -422
- package/src/web/components/form/uploaderFile/index.jsx +0 -25
- package/src/web/components/form/uploaderFile/pending.svg +0 -18
- package/src/web/components/form/uploaderFile/success.svg +0 -12
- package/src/web/components/form/uploaderFile/uploadFile.h5.tsx +0 -606
- package/src/web/components/form/uploaderFile/uploadFile.pc.tsx +0 -520
- package/src/web/components/graphicCard/index.css +0 -159
- package/src/web/components/graphicCard/index.tsx +0 -310
- package/src/web/components/image/image.tsx +0 -187
- package/src/web/components/image/index.css +0 -54
- package/src/web/components/image/index.tsx +0 -121
- package/src/web/components/index.js +0 -95
- package/src/web/components/link/index.css +0 -8
- package/src/web/components/link/index.tsx +0 -119
- package/src/web/components/listView/arrow-right-line.svg +0 -3
- package/src/web/components/listView/index.css +0 -143
- package/src/web/components/listView/index.tsx +0 -346
- package/src/web/components/listView/interface.ts +0 -98
- package/src/web/components/lottery/index.css +0 -333
- package/src/web/components/lottery/index.tsx +0 -567
- package/src/web/components/lottery/lotteryUtil.ts +0 -130
- package/src/web/components/modal/index.tsx +0 -60
- package/src/web/components/navLayout/index.css +0 -332
- package/src/web/components/navLayout/index.tsx +0 -247
- package/src/web/components/navigationBar/chevron-right--double.svg +0 -3
- package/src/web/components/navigationBar/common.tsx +0 -198
- package/src/web/components/navigationBar/h5Menu.tsx +0 -179
- package/src/web/components/navigationBar/horizontalMenu.tsx +0 -200
- package/src/web/components/navigationBar/index.css +0 -762
- package/src/web/components/navigationBar/index.tsx +0 -230
- package/src/web/components/navigationBar/type.d.ts +0 -111
- package/src/web/components/navigationBar/verticalMenu.tsx +0 -81
- package/src/web/components/phone/index.css +0 -0
- package/src/web/components/phone/index.tsx +0 -22
- package/src/web/components/phoneCode/index.css +0 -0
- package/src/web/components/phoneCode/index.tsx +0 -22
- package/src/web/components/picker/datePicker.tsx +0 -48
- package/src/web/components/picker/picker.tsx +0 -59
- package/src/web/components/picker/timePicker.tsx +0 -56
- package/src/web/components/richText/const.ts +0 -3
- package/src/web/components/richText/index.css +0 -93
- package/src/web/components/richText/index.jsx +0 -473
- package/src/web/components/richTextView/index.css +0 -63
- package/src/web/components/richTextView/index.tsx +0 -63
- package/src/web/components/scrollView/index.tsx +0 -148
- package/src/web/components/share/index.css +0 -0
- package/src/web/components/share/index.tsx +0 -38
- package/src/web/components/slot/index.tsx +0 -19
- package/src/web/components/swiper/index.css +0 -106
- package/src/web/components/swiper/index.tsx +0 -291
- package/src/web/components/tabs/index.css +0 -64
- package/src/web/components/tabs/index.tsx +0 -35
- package/src/web/components/tabs/tabs.h5.tsx +0 -84
- package/src/web/components/tabs/tabs.pc.tsx +0 -74
- package/src/web/components/text/index.css +0 -26
- package/src/web/components/text/index.tsx +0 -60
- package/src/web/components/uploaderFileView/index.css +0 -11
- package/src/web/components/uploaderFileView/index.jsx +0 -84
- package/src/web/components/uploaderView/index.css +0 -31
- package/src/web/components/uploaderView/index.tsx +0 -92
- package/src/web/components/userInfo/index.css +0 -0
- package/src/web/components/userInfo/index.tsx +0 -30
- package/src/web/components/wedaVideo/index.css +0 -42
- package/src/web/components/wedaVideo/index.tsx +0 -208
- package/src/web/index.js +0 -4
- package/src/web/types.d.ts +0 -21
- package/src/web/utils/classnames.js +0 -39
- package/src/web/utils/constant.ts +0 -23
- package/src/web/utils/debounce.js +0 -98
- package/src/web/utils/events.js +0 -2
- package/src/web/utils/getLocalCounter.js +0 -5
- package/src/web/utils/isObjectEqual.js +0 -15
- package/src/web/utils/loading-fallback.tsx +0 -2
- package/src/web/utils/lodash.ts +0 -2
- package/src/web/utils/platform.js +0 -156
- package/src/web/utils/tcb.js +0 -86
- package/src/web/utils/tmap.js +0 -4
- package/src/web/utils/useSetState.ts +0 -18
- package/src/web/utils/useSyncValue.ts +0 -17
- package/src/web/utils/weui.js +0 -3
- package/src/web/weda-ui.css +0 -86
|
@@ -1,208 +0,0 @@
|
|
|
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 type { CommonPropsType } from '../../types';
|
|
9
|
-
import { ConfigProvider, Icon } from 'tea-component';
|
|
10
|
-
|
|
11
|
-
const { useEffect, useRef, useMemo, useState } = React;
|
|
12
|
-
export interface VideoProps {
|
|
13
|
-
videoDataSource: string;
|
|
14
|
-
posterImage: string;
|
|
15
|
-
autoPlay: boolean;
|
|
16
|
-
loopPlay: boolean;
|
|
17
|
-
mutePlay: boolean;
|
|
18
|
-
controlBarStatus: boolean;
|
|
19
|
-
startTime: number;
|
|
20
|
-
endTime: number;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export type WedaVideoProps = Partial<CommonPropsType & VideoProps>;
|
|
24
|
-
|
|
25
|
-
const MimetypesKind = {
|
|
26
|
-
opus: 'video/ogg',
|
|
27
|
-
ogv: 'video/ogg',
|
|
28
|
-
mp4: 'video/mp4',
|
|
29
|
-
mov: 'video/mp4',
|
|
30
|
-
m4v: 'video/mp4',
|
|
31
|
-
mkv: 'video/x-matroska',
|
|
32
|
-
m4a: 'audio/mp4',
|
|
33
|
-
mp3: 'audio/mpeg',
|
|
34
|
-
aac: 'audio/aac',
|
|
35
|
-
caf: 'audio/x-caf',
|
|
36
|
-
flac: 'audio/flac',
|
|
37
|
-
oga: 'audio/ogg',
|
|
38
|
-
wav: 'audio/wav',
|
|
39
|
-
m3u8: 'application/x-mpegURL',
|
|
40
|
-
jpg: 'image/jpeg',
|
|
41
|
-
jpeg: 'image/jpeg',
|
|
42
|
-
gif: 'image/gif',
|
|
43
|
-
png: 'image/png',
|
|
44
|
-
svg: 'image/svg+xml',
|
|
45
|
-
webp: 'image/webp',
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const CLASS_PREFIX = 'weda-ui_video';
|
|
49
|
-
|
|
50
|
-
const WedaVideo: React.FC<WedaVideoProps> = ({
|
|
51
|
-
className,
|
|
52
|
-
style,
|
|
53
|
-
id,
|
|
54
|
-
videoDataSource,
|
|
55
|
-
posterImage,
|
|
56
|
-
autoPlay,
|
|
57
|
-
loopPlay,
|
|
58
|
-
mutePlay,
|
|
59
|
-
controlBarStatus,
|
|
60
|
-
startTime,
|
|
61
|
-
endTime,
|
|
62
|
-
}) => {
|
|
63
|
-
const platform = usePlatform();
|
|
64
|
-
const cls = classNames({
|
|
65
|
-
[className]: className,
|
|
66
|
-
[CLASS_PREFIX]: true,
|
|
67
|
-
[`${CLASS_PREFIX}-h5`]: platform === 'h5',
|
|
68
|
-
'weda-ui_video_control': !controlBarStatus,
|
|
69
|
-
});
|
|
70
|
-
const videoRef = useRef<HTMLVideoElement>(null);
|
|
71
|
-
const playerRef = useRef(null);
|
|
72
|
-
|
|
73
|
-
const [realSrc, setRealSrc] = useState(null);
|
|
74
|
-
const [videoModalStatus, setVideoModalStatus] = useState(true);
|
|
75
|
-
const [videoErrMsg, setVideoErrMsg] = useState('');
|
|
76
|
-
|
|
77
|
-
const videoType = useMemo(() => {
|
|
78
|
-
return realSrc?.substring(realSrc.lastIndexOf('.') + 1).toLowerCase();
|
|
79
|
-
}, [realSrc]);
|
|
80
|
-
|
|
81
|
-
useEffect(() => {
|
|
82
|
-
async function getCloudUrl(fileID) {
|
|
83
|
-
if (isCloudFileID(fileID)) {
|
|
84
|
-
try {
|
|
85
|
-
const fileSrc = await getTempFileURL(fileID);
|
|
86
|
-
setVideoErrMsg('');
|
|
87
|
-
setRealSrc(fileSrc);
|
|
88
|
-
} catch (err) {
|
|
89
|
-
console.error('getCloudUrl error', err);
|
|
90
|
-
setVideoErrMsg('获取云文件资源失败');
|
|
91
|
-
setRealSrc('');
|
|
92
|
-
}
|
|
93
|
-
} else {
|
|
94
|
-
setRealSrc(videoDataSource);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
getCloudUrl(videoDataSource);
|
|
98
|
-
}, [videoDataSource]);
|
|
99
|
-
|
|
100
|
-
useEffect(() => {
|
|
101
|
-
const videoElement = videoRef.current;
|
|
102
|
-
if (!playerRef.current) {
|
|
103
|
-
const videoOptions = {
|
|
104
|
-
poster: posterImage,
|
|
105
|
-
autoplay: autoPlay, //自动播放
|
|
106
|
-
bigPlayButton: true, //全屏按钮
|
|
107
|
-
loop: loopPlay, //循环播放
|
|
108
|
-
muted: mutePlay, // 是否静音
|
|
109
|
-
controls: controlBarStatus, //显示控制栏
|
|
110
|
-
language: 'zh-CN', // 设置语言
|
|
111
|
-
fluid: true, // 自适应宽高
|
|
112
|
-
controlBar: {
|
|
113
|
-
children: [
|
|
114
|
-
{ name: 'playToggle' }, // 底部暂停按钮
|
|
115
|
-
{ name: 'currentTimeDisplay' }, // 当前已播放时间
|
|
116
|
-
{ name: 'progressControl' }, // 进度条
|
|
117
|
-
{ name: 'durationDisplay' }, // 总时间
|
|
118
|
-
{
|
|
119
|
-
name: 'volumePanel', // 音量控制
|
|
120
|
-
inline: false, // 不使用水平方式
|
|
121
|
-
},
|
|
122
|
-
{ name: 'FullscreenToggle' }, // 全屏按钮
|
|
123
|
-
],
|
|
124
|
-
},
|
|
125
|
-
sources: [
|
|
126
|
-
{
|
|
127
|
-
src: realSrc || 'no',
|
|
128
|
-
type: MimetypesKind[videoType] || 'video/mp4',
|
|
129
|
-
},
|
|
130
|
-
],
|
|
131
|
-
};
|
|
132
|
-
playerRef.current = videojs(videoElement, videoOptions, () => {
|
|
133
|
-
players.currentTime(startTime); //指定播放时间
|
|
134
|
-
setVideoModalStatus(false);
|
|
135
|
-
setVideoErrMsg('');
|
|
136
|
-
});
|
|
137
|
-
const players = playerRef.current;
|
|
138
|
-
// 指定结束时间
|
|
139
|
-
if (endTime) {
|
|
140
|
-
players.on('timeupdate', () => {
|
|
141
|
-
//播放时间改变
|
|
142
|
-
const currentTime = players.currentTime();
|
|
143
|
-
if (startTime >= endTime) return;
|
|
144
|
-
if (currentTime > endTime) {
|
|
145
|
-
players.currentTime(startTime);
|
|
146
|
-
setTimeout(() => {
|
|
147
|
-
!loopPlay && players.pause();
|
|
148
|
-
}, 200);
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
players.on('canplaythrough', function () {
|
|
153
|
-
setVideoModalStatus(false);
|
|
154
|
-
setVideoErrMsg('');
|
|
155
|
-
});
|
|
156
|
-
players.on('error', function () {
|
|
157
|
-
let errorMsg = `视频资源加载出错,错误信息:${
|
|
158
|
-
players?.error().message
|
|
159
|
-
}`;
|
|
160
|
-
let pattern = new RegExp('^(((https?)://)|/resources/)[^\\s]+$');
|
|
161
|
-
if (
|
|
162
|
-
isInIde() &&
|
|
163
|
-
!pattern.test(videoDataSource) &&
|
|
164
|
-
!isCloudFileID(videoDataSource)
|
|
165
|
-
) {
|
|
166
|
-
errorMsg = '请在预览区查看视频效果';
|
|
167
|
-
}
|
|
168
|
-
console.log('player error', errorMsg);
|
|
169
|
-
setVideoErrMsg(errorMsg);
|
|
170
|
-
setVideoModalStatus(true);
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
}, [videoRef]);
|
|
174
|
-
|
|
175
|
-
useEffect(() => {
|
|
176
|
-
// 切换视频源
|
|
177
|
-
if (playerRef.current && videoType) {
|
|
178
|
-
let srcOption = [
|
|
179
|
-
{
|
|
180
|
-
src: realSrc,
|
|
181
|
-
type: MimetypesKind[videoType],
|
|
182
|
-
},
|
|
183
|
-
];
|
|
184
|
-
playerRef.current.src(srcOption);
|
|
185
|
-
playerRef.current.load(realSrc);
|
|
186
|
-
}
|
|
187
|
-
}, [realSrc]);
|
|
188
|
-
|
|
189
|
-
return (
|
|
190
|
-
<ConfigProvider classPrefix="wedatea2td">
|
|
191
|
-
<div className={cls} id={id} style={style} data-testid="wedaVideo">
|
|
192
|
-
<div data-vjs-player>
|
|
193
|
-
<video
|
|
194
|
-
ref={videoRef}
|
|
195
|
-
className={`video-js vjs-big-play-centered ${CLASS_PREFIX}__video-wrap`}
|
|
196
|
-
/>
|
|
197
|
-
</div>
|
|
198
|
-
{videoModalStatus && (
|
|
199
|
-
<div className={`${CLASS_PREFIX}__video-loading`}>
|
|
200
|
-
{realSrc === null ? <Icon type="loading" /> : videoErrMsg}
|
|
201
|
-
</div>
|
|
202
|
-
)}
|
|
203
|
-
</div>
|
|
204
|
-
</ConfigProvider>
|
|
205
|
-
);
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
export default WedaVideo;
|
package/src/web/index.js
DELETED
package/src/web/types.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/// <reference types="resize-observer-browser" />
|
|
2
|
-
|
|
3
|
-
import { any } from 'prop-types';
|
|
4
|
-
import * as React from 'react';
|
|
5
|
-
export type unknownFunction = (...args: unknown[]) => unknown;
|
|
6
|
-
export interface CommonPropsType {
|
|
7
|
-
style?: React.CSSProperties;
|
|
8
|
-
id?: string;
|
|
9
|
-
events?: Record<string, unknownFunction>;
|
|
10
|
-
className?: string;
|
|
11
|
-
children?: React.ReactNode | undefined;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
declare global {
|
|
15
|
-
var app: any;
|
|
16
|
-
interface Window {
|
|
17
|
-
app: any;
|
|
18
|
-
qq: any;
|
|
19
|
-
TMap: any;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/* !
|
|
2
|
-
Copyright (c) 2018 Jed Watson.
|
|
3
|
-
Licensed under the MIT License (MIT), see
|
|
4
|
-
http://jedwatson.github.io/classnames
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
function classNames(...args) {
|
|
8
|
-
const classes = [];
|
|
9
|
-
|
|
10
|
-
for (let i = 0; i < args.length; i++) {
|
|
11
|
-
const arg = args[i];
|
|
12
|
-
if (!arg) continue;
|
|
13
|
-
|
|
14
|
-
const argType = typeof arg;
|
|
15
|
-
|
|
16
|
-
if (argType === 'string' || argType === 'number') {
|
|
17
|
-
classes.push(arg);
|
|
18
|
-
} else if (Array.isArray(arg)) {
|
|
19
|
-
if (arg.length) {
|
|
20
|
-
const inner = classes.push(classNames(...arg));
|
|
21
|
-
if (inner) {
|
|
22
|
-
classes.push(inner);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
} else if (argType === 'object') {
|
|
26
|
-
if (arg.toString === Object.prototype.toString) {
|
|
27
|
-
Object.keys(arg).forEach((key) => {
|
|
28
|
-
arg[key] && classes.push(key);
|
|
29
|
-
});
|
|
30
|
-
} else {
|
|
31
|
-
classes.push(arg.toString());
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return classes.join(' ');
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export default classNames;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export const TitleType = {
|
|
2
|
-
LEFT: 'left',
|
|
3
|
-
TOP: 'top',
|
|
4
|
-
NONE: 'none',
|
|
5
|
-
} as const;
|
|
6
|
-
|
|
7
|
-
export const LOAD_ERR_IMG_BASE64 =
|
|
8
|
-
'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgdmlld0JveD0iMCAwIDMyIDMyIiBmaWxsPSJub25lIj4KICA8cGF0aCBkPSJNMjUuMzIgMTYuMzU5N0MyNi4wNzY0IDE2LjM1OTcgMjYuODI1NCAxNi41MDg3IDI3LjUyNDMgMTYuNzk4MUMyOC4yMjMxIDE3LjA4NzYgMjguODU4MSAxNy41MTE5IDI5LjM5MjkgMTguMDQ2OEMyOS45Mjc4IDE4LjU4MTYgMzAuMzUyMSAxOS4yMTY2IDMwLjY0MTYgMTkuOTE1NEMzMC45MzEgMjAuNjE0MyAzMS4wOCAyMS4zNjMzIDMxLjA4IDIyLjExOTdDMzEuMDggMjIuODc2MSAzMC45MzEgMjMuNjI1MSAzMC42NDE2IDI0LjMyMzlDMzAuMzUyMSAyNS4wMjI4IDI5LjkyNzggMjUuNjU3OCAyOS4zOTI5IDI2LjE5MjZDMjguODU4MSAyNi43Mjc1IDI4LjIyMzEgMjcuMTUxOCAyNy41MjQzIDI3LjQ0MTJDMjYuODI1NCAyNy43MzA3IDI2LjA3NjQgMjcuODc5NyAyNS4zMiAyNy44Nzk3QzIzLjc5MjQgMjcuODc5NyAyMi4zMjczIDI3LjI3MjggMjEuMjQ3MSAyNi4xOTI2QzIwLjE2NjkgMjUuMTEyNCAxOS41NiAyMy42NDczIDE5LjU2IDIyLjExOTdDMTkuNTYgMjAuNTkyIDIwLjE2NjkgMTkuMTI3IDIxLjI0NzEgMTguMDQ2OEMyMi4zMjczIDE2Ljk2NjUgMjMuNzkyNCAxNi4zNTk3IDI1LjMyIDE2LjM1OTdaTTI4IDMuNTU5NjlWMTQuODc2OEMyNy4xNzc3IDE0LjU4NjYgMjYuMTkyIDE0LjQzODggMjUuMzIgMTQuNDM5N0MyNC4wMzEgMTQuNDM5NyAyMi44MTU3IDE0Ljc1NzEgMjEuNzQ4OCAxNS4zMTg0TDIwLjc5NTIgMTMuMTU5N0wxNi4wMjU5IDIwLjAyNzVMOC40NDU3NiAxNi40NDFMMy41NiAyMy4zOTk3SDE3Ljc0NjJDMTcuOTg2NyAyNC44MjkgMTguNjI4MiAyNi4xNjA2IDE5LjU5NTggMjcuMjM5N0gxVjMuNTU5NjlIMjhaTTI1Ljk2IDI0LjAzOTdIMjQuNjhWMjUuMzE5N0gyNS45NlYyNC4wMzk3Wk0yNS45NiAxOC45MTk3SDI0LjY4VjIzLjM5OTdIMjUuOTZWMTguOTE5N1pNNi4xMiAxMC41OTk3QzYuMTIgMTEuOTk4MSA3LjE5OTA0IDEzLjEwODUgOC42MDc2OCAxMy4xNTg0QzEwLjAyMDggMTMuMjA3NyAxMS4yNCAxMi4wNDggMTEuMjQgMTAuNTk5N0MxMS4yNCA5LjI0NjA5IDEwLjA2NDMgOC4wODU3NyA4Ljc1MjMyIDguMDQwOTdDNy4yOTU2OCA3Ljk5MTY5IDYuMTIgOS4xNTEzNyA2LjEyIDEwLjU5OTdaIiBmaWxsPSIjQkNDNEQwIj48L3BhdGg+Cjwvc3ZnPgo=' as const;
|
|
9
|
-
|
|
10
|
-
export const REL_DICT = {
|
|
11
|
-
equal: 'eq', // 等于
|
|
12
|
-
unequal: 'neq', // 不等于
|
|
13
|
-
include: 'search', // 包含
|
|
14
|
-
exclude: '_exclude', // 不包含
|
|
15
|
-
begin_with: '_begin_with', // 开头是
|
|
16
|
-
greater: 'gt', // 大于
|
|
17
|
-
greater_or_equal: 'gte', // 大于等于
|
|
18
|
-
bigger_or_equal: 'gte', //大于等于
|
|
19
|
-
less: 'lt', // 小于
|
|
20
|
-
less_or_equal: 'lte', // 小于等于
|
|
21
|
-
in: 'in', // 多选值
|
|
22
|
-
not_in: 'nin', // 不在多选值
|
|
23
|
-
} as const;
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
function isObject(value) {
|
|
2
|
-
const type = typeof value;
|
|
3
|
-
return value != null && (type === 'object' || type === 'function');
|
|
4
|
-
}
|
|
5
|
-
function debounce(func, wait, options) {
|
|
6
|
-
let lastArgs, lastThis, maxWait, result, timerId, lastCallTime;
|
|
7
|
-
let lastInvokeTime = 0;
|
|
8
|
-
let leading = false;
|
|
9
|
-
let maxing = false;
|
|
10
|
-
let trailing = true;
|
|
11
|
-
if (typeof func !== 'function') {
|
|
12
|
-
throw new TypeError('Expected a function');
|
|
13
|
-
}
|
|
14
|
-
wait = +wait || 0;
|
|
15
|
-
if (isObject(options)) {
|
|
16
|
-
leading = !!options.leading;
|
|
17
|
-
maxing = 'maxWait' in options;
|
|
18
|
-
maxWait = maxing ? Math.max(+options.maxWait || 0, wait) : maxWait;
|
|
19
|
-
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
20
|
-
}
|
|
21
|
-
function invokeFunc(time) {
|
|
22
|
-
const args = lastArgs;
|
|
23
|
-
const thisArg = lastThis;
|
|
24
|
-
|
|
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
|
-
|
|
43
|
-
return maxing
|
|
44
|
-
? Math.min(timeWaiting, maxWait - timeSinceLastInvoke)
|
|
45
|
-
: timeWaiting;
|
|
46
|
-
}
|
|
47
|
-
function shouldInvoke(time) {
|
|
48
|
-
const timeSinceLastCall = time - lastCallTime;
|
|
49
|
-
const timeSinceLastInvoke = time - lastInvokeTime;
|
|
50
|
-
return (
|
|
51
|
-
lastCallTime === undefined ||
|
|
52
|
-
timeSinceLastCall >= wait ||
|
|
53
|
-
timeSinceLastCall < 0 ||
|
|
54
|
-
(maxing && timeSinceLastInvoke >= maxWait)
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
function timerExpired() {
|
|
58
|
-
const time = Date.now();
|
|
59
|
-
if (shouldInvoke(time)) {
|
|
60
|
-
return trailingEdge(time);
|
|
61
|
-
}
|
|
62
|
-
timerId = startTimer(timerExpired, remainingWait(time));
|
|
63
|
-
}
|
|
64
|
-
function trailingEdge(time) {
|
|
65
|
-
timerId = undefined;
|
|
66
|
-
if (trailing && lastArgs) {
|
|
67
|
-
return invokeFunc(time);
|
|
68
|
-
}
|
|
69
|
-
lastArgs = lastThis = undefined;
|
|
70
|
-
return result;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
//debouncedFunc
|
|
74
|
-
function debounced(...args) {
|
|
75
|
-
const time = Date.now();
|
|
76
|
-
const isInvoking = shouldInvoke(time);
|
|
77
|
-
|
|
78
|
-
lastArgs = args;
|
|
79
|
-
lastThis = this;
|
|
80
|
-
lastCallTime = time;
|
|
81
|
-
|
|
82
|
-
if (isInvoking) {
|
|
83
|
-
if (timerId === undefined) {
|
|
84
|
-
return leadingEdge(lastCallTime);
|
|
85
|
-
}
|
|
86
|
-
if (maxing) {
|
|
87
|
-
timerId = startTimer(timerExpired, wait);
|
|
88
|
-
return invokeFunc(lastCallTime);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
if (timerId === undefined) {
|
|
92
|
-
timerId = startTimer(timerExpired, wait);
|
|
93
|
-
}
|
|
94
|
-
return result;
|
|
95
|
-
}
|
|
96
|
-
return debounced;
|
|
97
|
-
}
|
|
98
|
-
export default debounce;
|
package/src/web/utils/events.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import isEqual from 'lodash.isequal';
|
|
2
|
-
|
|
3
|
-
export function serde(a) {
|
|
4
|
-
return JSON.parse(JSON.stringify(a));
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
const isObj = (a) => typeof a === 'object' && a !== null;
|
|
8
|
-
|
|
9
|
-
export default function (a, b, shouldSerde = false) {
|
|
10
|
-
if (shouldSerde && isObj(a) && isObj(b)) {
|
|
11
|
-
// for Proxy created by mbox
|
|
12
|
-
return isEqual(serde(a), serde(b));
|
|
13
|
-
}
|
|
14
|
-
return isEqual(a, b);
|
|
15
|
-
}
|
package/src/web/utils/lodash.ts
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
// 平台类方法,如 BOM、DOM、区分 h5 和 pc 端
|
|
2
|
-
import { useMediaQuery } from '@react-hookz/web';
|
|
3
|
-
/**
|
|
4
|
-
* 当前环境是否为 H5 端
|
|
5
|
-
*/
|
|
6
|
-
export const isH5Platform = () => {
|
|
7
|
-
if (window.matchMedia) {
|
|
8
|
-
return window.matchMedia('(max-width: 1024px)')?.matches;
|
|
9
|
-
} else {
|
|
10
|
-
let is = false;
|
|
11
|
-
try {
|
|
12
|
-
const ua = navigator && navigator.userAgent;
|
|
13
|
-
is = /Android|webOS|BlackBerry|iPhone|iPad|iPod|iOS/i.test(ua);
|
|
14
|
-
} catch (e) {
|
|
15
|
-
null;
|
|
16
|
-
}
|
|
17
|
-
return is;
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* 判断当前是否是 cloud 开头的文件协议
|
|
23
|
-
*/
|
|
24
|
-
export const isCloudFileID = (url) => {
|
|
25
|
-
return /^cloud:\/\/.*/.test(url);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* 判断当前是否是 http/https 开头的文件协议
|
|
30
|
-
*/
|
|
31
|
-
export const isHttpFileID = (url) => {
|
|
32
|
-
return /^http(s?):\/\/.*/.test(url);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export function usePlatform() {
|
|
36
|
-
const smallScreen = useMediaQuery('(max-width: 1024px)') ?? isH5Platform();
|
|
37
|
-
const touchDevice = useMediaQuery('(pointer:coarse)') ?? smallScreen;
|
|
38
|
-
return touchDevice || smallScreen ? 'h5' : 'pc';
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* 在h5下,判断当前是否是移动浏览器
|
|
43
|
-
*/
|
|
44
|
-
export function inH5IsMobile() {
|
|
45
|
-
try {
|
|
46
|
-
// 区分h5是在编辑器还是移动浏览器
|
|
47
|
-
let is_mobile_ua = false;
|
|
48
|
-
const ua = navigator && navigator.userAgent;
|
|
49
|
-
is_mobile_ua = /Android|webOS|BlackBerry|iPhone|iPad|iPod|iOS/i.test(ua);
|
|
50
|
-
return is_mobile_ua;
|
|
51
|
-
} catch (e) {
|
|
52
|
-
console.log('isMobile err', e);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* 过滤非字符串,返回字符串数组
|
|
58
|
-
* 用于兼容单个组件和组件数组
|
|
59
|
-
*/
|
|
60
|
-
export const filterStrList = (value) => {
|
|
61
|
-
return [].concat(value).filter((d) => typeof d === 'string' && d !== '');
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* 文件字节转换
|
|
66
|
-
*/
|
|
67
|
-
export const transSize = (size) => {
|
|
68
|
-
const b = parseInt(size) || 0;
|
|
69
|
-
const getBig = (d) => Math.ceil(d / 1024) || 0;
|
|
70
|
-
if (b < 1024) {
|
|
71
|
-
return `${size}B`;
|
|
72
|
-
}
|
|
73
|
-
const k = getBig(size);
|
|
74
|
-
if (k < 1024) {
|
|
75
|
-
return `${k}K`;
|
|
76
|
-
}
|
|
77
|
-
const m = getBig(k);
|
|
78
|
-
if (m < 1024) {
|
|
79
|
-
return `${m}M`;
|
|
80
|
-
}
|
|
81
|
-
const g = getBig(m);
|
|
82
|
-
return `${g}G`;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* 链接转换为下载
|
|
87
|
-
*/
|
|
88
|
-
export const downloadFile = (url) => {
|
|
89
|
-
if (!url) {
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
const urlObj = new URL(url);
|
|
93
|
-
urlObj.searchParams.append('response-content-disposition', 'attawchment');
|
|
94
|
-
const urls = urlObj.toString();
|
|
95
|
-
window.open(urls);
|
|
96
|
-
setTimeout(() => {
|
|
97
|
-
window.URL.revokeObjectURL(urls);
|
|
98
|
-
}, 0);
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* 文件名截取,保留后缀类型
|
|
103
|
-
*/
|
|
104
|
-
export const cutFileTitle = (str = '', count = 10) => {
|
|
105
|
-
let [title, type] = [str, ''];
|
|
106
|
-
const dotIndex = `${str}`.lastIndexOf('.');
|
|
107
|
-
if (dotIndex > -1) {
|
|
108
|
-
type = str.slice(dotIndex + 1);
|
|
109
|
-
title = str.slice(0, dotIndex);
|
|
110
|
-
}
|
|
111
|
-
if (title.length > count) {
|
|
112
|
-
title = `${title.slice(0, 7)}...${title.slice(-3)}`;
|
|
113
|
-
}
|
|
114
|
-
if (type) {
|
|
115
|
-
title = `${title}.${type}`;
|
|
116
|
-
}
|
|
117
|
-
return title;
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* 判断是否在 ide 中
|
|
122
|
-
*/
|
|
123
|
-
export const isInIde = () => !!window?.app?.cloud?.IS_WEDA_IDE;
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* cloudid和文件名转换
|
|
127
|
-
*/
|
|
128
|
-
export const transFileCloudidToName = (fileID) => {
|
|
129
|
-
const uuidReg = /(file-)?[0-9a-f]{8}((-)?[0-9a-f]{4}){3}(-)?[0-9a-f]{12}-/;
|
|
130
|
-
const lastIndex = `${fileID}`.lastIndexOf('/');
|
|
131
|
-
const name = `${fileID}`.slice(lastIndex + 1);
|
|
132
|
-
const title = name.replace(uuidReg, '');
|
|
133
|
-
return title;
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* 判断是否是url
|
|
138
|
-
*/
|
|
139
|
-
const reg =
|
|
140
|
-
// eslint-disable-next-line no-useless-escape
|
|
141
|
-
/(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/;
|
|
142
|
-
|
|
143
|
-
export const isUrl = (path) => reg.test(path);
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* 生成随机数
|
|
147
|
-
*/
|
|
148
|
-
export const randomUuid = () => {
|
|
149
|
-
var s = [];
|
|
150
|
-
var hexDigits = '0123456789abcdef';
|
|
151
|
-
for (var i = 0; i < 32; i++) {
|
|
152
|
-
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
|
|
153
|
-
}
|
|
154
|
-
var uuid = s.join('');
|
|
155
|
-
return uuid;
|
|
156
|
-
};
|
package/src/web/utils/tcb.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { isInIde } from './platform';
|
|
2
|
-
/**
|
|
3
|
-
* 云存储/云函数相关
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
// cloudbase._useDefaultAdapter();
|
|
7
|
-
// const tcb = cloudbase.init({
|
|
8
|
-
// env: 'hole-2ggmiaj108259587',
|
|
9
|
-
// });
|
|
10
|
-
|
|
11
|
-
// export default app;
|
|
12
|
-
|
|
13
|
-
// import cloudbase from '@cloudbase/js-sdk';
|
|
14
|
-
|
|
15
|
-
// cloudbase._useDefaultAdapter();
|
|
16
|
-
// const tcb = cloudbase.init({
|
|
17
|
-
// env: 'hole-2ggmiaj108259587',
|
|
18
|
-
// });
|
|
19
|
-
|
|
20
|
-
// export function getNativeCloudInstance() {
|
|
21
|
-
// return tcb;
|
|
22
|
-
// }
|
|
23
|
-
|
|
24
|
-
export async function getCloudInstance() {
|
|
25
|
-
const tcb = await window?.app?.cloud?.getCloudInstance();
|
|
26
|
-
return tcb;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* 获取单个临时链接
|
|
31
|
-
* 单个cos文件,返回字符串
|
|
32
|
-
* 多个cos文件,返回 {fileID: src} 这样的对象
|
|
33
|
-
*/
|
|
34
|
-
export async function getTempFileURL(data) {
|
|
35
|
-
if (window?.app?.cloud?.getTempFileURL) {
|
|
36
|
-
return await window?.app?.cloud?.getTempFileURL(data);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* 云函数获取数据
|
|
42
|
-
*/
|
|
43
|
-
export async function callDataSource(param) {
|
|
44
|
-
const { params, dataSourceName, methodName } = param;
|
|
45
|
-
try {
|
|
46
|
-
const res = await window?.app?.cloud?.callDataSource?.({
|
|
47
|
-
params,
|
|
48
|
-
dataSourceName,
|
|
49
|
-
methodName,
|
|
50
|
-
});
|
|
51
|
-
return res;
|
|
52
|
-
} catch (error) {
|
|
53
|
-
console.error('错误', error);
|
|
54
|
-
return {};
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* 云API:获取用户自定义导航内容
|
|
60
|
-
* param
|
|
61
|
-
* WeAppId: string,
|
|
62
|
-
* EnvId: string,
|
|
63
|
-
* PublishType?: string,
|
|
64
|
-
*/
|
|
65
|
-
export async function getAppCustomNav() {
|
|
66
|
-
try {
|
|
67
|
-
const PublishType = isInIde() ? 'preview' : '';
|
|
68
|
-
const WeAppId = window?.app?.id;
|
|
69
|
-
const res = await callWedaApi({
|
|
70
|
-
action: 'DescribeAppCustomNav',
|
|
71
|
-
serviceType: 'lowcode',
|
|
72
|
-
data: {
|
|
73
|
-
WeAppId,
|
|
74
|
-
PublishType,
|
|
75
|
-
},
|
|
76
|
-
});
|
|
77
|
-
return res;
|
|
78
|
-
} catch (error) {
|
|
79
|
-
console.error('错误', error);
|
|
80
|
-
return {};
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export function callWedaApi(...args) {
|
|
85
|
-
return window.app.cloud.callWedaApi(...args);
|
|
86
|
-
}
|
package/src/web/utils/tmap.js
DELETED