@cloudbase/weda-ui 3.1.0 → 3.1.1
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/CHANGELOG.md +7 -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 +248 -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.js +3 -0
- package/dist/setupTests.d.ts +1 -0
- package/dist/setupTests.js +14 -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 +32 -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 +28 -0
- package/dist/web/components/chart/common/core/eChartLine.js +168 -0
- package/dist/web/components/chart/common/core/eChartPie.d.ts +28 -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 +431 -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 +62 -0
- package/dist/web/components/form/location/common/propsConfig.js +52 -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 +34 -0
- package/dist/web/components/form/location/common/useLocationInfo.js +88 -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 +347 -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 +259 -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 +502 -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 +299 -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 +295 -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 -11
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { useMediaQuery } from '@react-hookz/web';
|
|
2
|
+
import { REL_DICT } from './constant';
|
|
3
|
+
/**
|
|
4
|
+
* 当前环境是否为 H5 端
|
|
5
|
+
*/
|
|
6
|
+
export const isH5Platform = () => {
|
|
7
|
+
var _a;
|
|
8
|
+
if (window.matchMedia) {
|
|
9
|
+
return (_a = window.matchMedia('(max-width: 1024px)')) === null || _a === void 0 ? void 0 : _a.matches;
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
let is = false;
|
|
13
|
+
try {
|
|
14
|
+
const ua = navigator && navigator.userAgent;
|
|
15
|
+
is = /Android|webOS|BlackBerry|iPhone|iPad|iPod|iOS/i.test(ua);
|
|
16
|
+
}
|
|
17
|
+
catch (e) {
|
|
18
|
+
null;
|
|
19
|
+
}
|
|
20
|
+
return is;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* 判断当前是否是 cloud 开头的文件协议
|
|
25
|
+
*/
|
|
26
|
+
export const isCloudFileID = (url) => {
|
|
27
|
+
return /^cloud:\/\/.*/.test(url);
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* 判断当前是否是 http/https 开头的文件协议
|
|
31
|
+
*/
|
|
32
|
+
export const isHttpFileID = (url) => {
|
|
33
|
+
return /^http(s?):\/\/.*/.test(url);
|
|
34
|
+
};
|
|
35
|
+
export function usePlatform() {
|
|
36
|
+
var _a, _b;
|
|
37
|
+
const smallScreen = (_a = useMediaQuery('(max-width: 992px)')) !== null && _a !== void 0 ? _a : isH5Platform();
|
|
38
|
+
const touchDevice = (_b = useMediaQuery('(pointer:coarse)')) !== null && _b !== void 0 ? _b : smallScreen;
|
|
39
|
+
// 非高精度指针(鼠标)就直接 h5, 否则当屏幕小于992 时用h5
|
|
40
|
+
return touchDevice || smallScreen ? 'h5' : 'pc';
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* 在h5下,判断当前是否是移动浏览器
|
|
44
|
+
*/
|
|
45
|
+
export function inH5IsMobile() {
|
|
46
|
+
try {
|
|
47
|
+
// 区分h5是在编辑器还是移动浏览器
|
|
48
|
+
let is_mobile_ua = false;
|
|
49
|
+
const ua = navigator && navigator.userAgent;
|
|
50
|
+
is_mobile_ua = /Android|webOS|BlackBerry|iPhone|iPad|iPod|iOS/i.test(ua);
|
|
51
|
+
return is_mobile_ua;
|
|
52
|
+
}
|
|
53
|
+
catch (e) {
|
|
54
|
+
console.log('isMobile err', e);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* 过滤非字符串,返回字符串数组
|
|
59
|
+
* 用于兼容单个组件和组件数组
|
|
60
|
+
*/
|
|
61
|
+
export const filterStrList = (value) => {
|
|
62
|
+
return [].concat(value).filter((d) => typeof d === 'string' && d !== '');
|
|
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
|
+
export const downloadFile = (url) => {
|
|
88
|
+
if (!url) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const urlObj = new URL(url);
|
|
92
|
+
urlObj.searchParams.append('response-content-disposition', 'attawchment');
|
|
93
|
+
const urls = urlObj.toString();
|
|
94
|
+
window.open(urls);
|
|
95
|
+
setTimeout(() => {
|
|
96
|
+
window.URL.revokeObjectURL(urls);
|
|
97
|
+
}, 0);
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* 文件名截取,保留后缀类型
|
|
101
|
+
*/
|
|
102
|
+
export const cutFileTitle = (str = '', count = 10) => {
|
|
103
|
+
let [title, type] = [str, ''];
|
|
104
|
+
const dotIndex = `${str}`.lastIndexOf('.');
|
|
105
|
+
if (dotIndex > -1) {
|
|
106
|
+
type = str.slice(dotIndex + 1);
|
|
107
|
+
title = str.slice(0, dotIndex);
|
|
108
|
+
}
|
|
109
|
+
if (title.length > count) {
|
|
110
|
+
title = `${title.slice(0, 7)}...${title.slice(-3)}`;
|
|
111
|
+
}
|
|
112
|
+
if (type) {
|
|
113
|
+
title = `${title}.${type}`;
|
|
114
|
+
}
|
|
115
|
+
return title;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* 判断是否在 ide 中
|
|
119
|
+
*/
|
|
120
|
+
export const isInIde = () => { var _a, _b; return !!((_b = (_a = window === null || window === void 0 ? void 0 : window.app) === null || _a === void 0 ? void 0 : _a.cloud) === null || _b === void 0 ? void 0 : _b.IS_WEDA_IDE); };
|
|
121
|
+
/**
|
|
122
|
+
* 解析素材资源
|
|
123
|
+
*/
|
|
124
|
+
export const resolveStaticResourceUrl = (path) => {
|
|
125
|
+
var _a, _b;
|
|
126
|
+
try {
|
|
127
|
+
// eslint-disable-next-line no-unsafe-optional-chaining
|
|
128
|
+
const resourceUrl = (_b = (_a = window === null || window === void 0 ? void 0 : window.app) === null || _a === void 0 ? void 0 : _a.__internal__) === null || _b === void 0 ? void 0 : _b.resolveStaticResourceUrl(path);
|
|
129
|
+
return resourceUrl;
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
return '';
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* cloudid和文件名转换
|
|
137
|
+
*/
|
|
138
|
+
export const transFileCloudidToName = (fileID) => {
|
|
139
|
+
const uuidReg = /(file-)?[0-9a-f]{8}((-)?[0-9a-f]{4}){3}(-)?[0-9a-f]{12}-/;
|
|
140
|
+
const lastIndex = `${fileID}`.lastIndexOf('/');
|
|
141
|
+
const name = `${fileID}`.slice(lastIndex + 1);
|
|
142
|
+
const title = name.replace(uuidReg, '');
|
|
143
|
+
return title;
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* 判断是否是url
|
|
147
|
+
*/
|
|
148
|
+
const reg =
|
|
149
|
+
// eslint-disable-next-line no-useless-escape
|
|
150
|
+
/(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/;
|
|
151
|
+
export const isUrl = (path) => reg.test(path);
|
|
152
|
+
/**
|
|
153
|
+
* 生成随机数
|
|
154
|
+
*/
|
|
155
|
+
export const randomStr = (len = 32) => {
|
|
156
|
+
const s = [];
|
|
157
|
+
const hexDigits = '0123456789abcdef';
|
|
158
|
+
const dictLen = hexDigits.length;
|
|
159
|
+
for (var i = 0; i < len; i++) {
|
|
160
|
+
const index = Math.floor(Math.random() * dictLen);
|
|
161
|
+
s[i] = hexDigits[index];
|
|
162
|
+
}
|
|
163
|
+
const result = s.join('');
|
|
164
|
+
return result;
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* 根据编辑器传入数据筛选条件,转换接口参数条件
|
|
168
|
+
*/
|
|
169
|
+
export const getWhereList = (where) => {
|
|
170
|
+
const result = [];
|
|
171
|
+
Array.isArray(where) &&
|
|
172
|
+
where.forEach((item1) => {
|
|
173
|
+
if ((item1 === null || item1 === void 0 ? void 0 : item1.groupLogic) !== 'or' && Array.isArray(item1 === null || item1 === void 0 ? void 0 : item1.logicData)) {
|
|
174
|
+
item1 === null || item1 === void 0 ? void 0 : item1.logicData.forEach((item2) => {
|
|
175
|
+
let [rel, val] = [REL_DICT[item2 === null || item2 === void 0 ? void 0 : item2.rel], item2 === null || item2 === void 0 ? void 0 : item2.value];
|
|
176
|
+
if ('_begin_with' === rel) {
|
|
177
|
+
rel = 'regex';
|
|
178
|
+
val = `^${val}`;
|
|
179
|
+
}
|
|
180
|
+
if ('_exclude' === rel) {
|
|
181
|
+
rel = 'regex';
|
|
182
|
+
val = `^((?!${val}).)*$`;
|
|
183
|
+
}
|
|
184
|
+
if ((item2 === null || item2 === void 0 ? void 0 : item2.logic) !== 'or' && (item2 === null || item2 === void 0 ? void 0 : item2.key) && rel && val !== undefined) {
|
|
185
|
+
result.push({ key: item2.key, rel, val });
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
return result;
|
|
191
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 云存储/云函数相关
|
|
3
|
+
*/
|
|
4
|
+
export function getCloudInstance(): Promise<any>;
|
|
5
|
+
/**
|
|
6
|
+
* 获取单个临时链接
|
|
7
|
+
* 单个cos文件,返回字符串
|
|
8
|
+
* 多个cos文件,返回 {fileID: src} 这样的对象
|
|
9
|
+
*/
|
|
10
|
+
export function getTempFileURL(data: any): Promise<any>;
|
|
11
|
+
/**
|
|
12
|
+
* 云函数获取数据
|
|
13
|
+
*/
|
|
14
|
+
export function callDataSource(param: any): Promise<any>;
|
|
15
|
+
/**
|
|
16
|
+
* 云API:获取用户自定义导航内容
|
|
17
|
+
* param
|
|
18
|
+
* WeAppId: string,
|
|
19
|
+
* EnvId: string,
|
|
20
|
+
* PublishType?: string,
|
|
21
|
+
*/
|
|
22
|
+
export function getAppCustomNav(): Promise<any>;
|
|
23
|
+
export function callWedaApi(...args: any[]): any;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { isInIde } from './platform';
|
|
2
|
+
/**
|
|
3
|
+
* 云存储/云函数相关
|
|
4
|
+
*/
|
|
5
|
+
// cloudbase._useDefaultAdapter();
|
|
6
|
+
// const tcb = cloudbase.init({
|
|
7
|
+
// env: 'hole-2ggmiaj108259587',
|
|
8
|
+
// });
|
|
9
|
+
// export default app;
|
|
10
|
+
// import cloudbase from '@cloudbase/js-sdk';
|
|
11
|
+
// cloudbase._useDefaultAdapter();
|
|
12
|
+
// const tcb = cloudbase.init({
|
|
13
|
+
// env: 'hole-2ggmiaj108259587',
|
|
14
|
+
// });
|
|
15
|
+
// export function getNativeCloudInstance() {
|
|
16
|
+
// return tcb;
|
|
17
|
+
// }
|
|
18
|
+
export async function getCloudInstance() {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
const tcb = await ((_b = (_a = window === null || window === void 0 ? void 0 : window.app) === null || _a === void 0 ? void 0 : _a.cloud) === null || _b === void 0 ? void 0 : _b.getCloudInstance());
|
|
21
|
+
return tcb;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* 获取单个临时链接
|
|
25
|
+
* 单个cos文件,返回字符串
|
|
26
|
+
* 多个cos文件,返回 {fileID: src} 这样的对象
|
|
27
|
+
*/
|
|
28
|
+
export async function getTempFileURL(data) {
|
|
29
|
+
var _a, _b, _c, _d;
|
|
30
|
+
if ((_b = (_a = window === null || window === void 0 ? void 0 : window.app) === null || _a === void 0 ? void 0 : _a.cloud) === null || _b === void 0 ? void 0 : _b.getTempFileURL) {
|
|
31
|
+
return await ((_d = (_c = window === null || window === void 0 ? void 0 : window.app) === null || _c === void 0 ? void 0 : _c.cloud) === null || _d === void 0 ? void 0 : _d.getTempFileURL(data));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* 云函数获取数据
|
|
36
|
+
*/
|
|
37
|
+
export async function callDataSource(param) {
|
|
38
|
+
var _a, _b, _c;
|
|
39
|
+
const { params, dataSourceName, methodName } = param;
|
|
40
|
+
try {
|
|
41
|
+
const res = await ((_c = (_b = (_a = window === null || window === void 0 ? void 0 : window.app) === null || _a === void 0 ? void 0 : _a.cloud) === null || _b === void 0 ? void 0 : _b.callDataSource) === null || _c === void 0 ? void 0 : _c.call(_b, {
|
|
42
|
+
params,
|
|
43
|
+
dataSourceName,
|
|
44
|
+
methodName,
|
|
45
|
+
}));
|
|
46
|
+
return res;
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
console.error('错误', error);
|
|
50
|
+
return {};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* 云API:获取用户自定义导航内容
|
|
55
|
+
* param
|
|
56
|
+
* WeAppId: string,
|
|
57
|
+
* EnvId: string,
|
|
58
|
+
* PublishType?: string,
|
|
59
|
+
*/
|
|
60
|
+
export async function getAppCustomNav() {
|
|
61
|
+
var _a;
|
|
62
|
+
try {
|
|
63
|
+
const PublishType = isInIde() ? 'preview' : '';
|
|
64
|
+
const WeAppId = (_a = window === null || window === void 0 ? void 0 : window.app) === null || _a === void 0 ? void 0 : _a.id;
|
|
65
|
+
const res = await callWedaApi({
|
|
66
|
+
action: 'DescribeAppCustomNav',
|
|
67
|
+
serviceType: 'lowcode',
|
|
68
|
+
data: {
|
|
69
|
+
WeAppId,
|
|
70
|
+
PublishType,
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
return res;
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
console.error('错误', error);
|
|
77
|
+
return {};
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
export function callWedaApi(...args) {
|
|
81
|
+
return window.app.cloud.callWedaApi(...args);
|
|
82
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export function getTMap(): any;
|
|
2
|
+
export function calculateDistance(latlng1: any, latlng2: any): number;
|
|
3
|
+
export const base64LocationIcon: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODQiIGhlaWdodD0iODgiIHZpZXdCb3g9IjAgMCA4NCA4OCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgb3BhY2l0eT0iMC45OCIgZmlsdGVyPSJ1cmwoI2ZpbHRlcjBfZGRkXzI0NDdfNTc0OSkiPgo8Y2lyY2xlIGN4PSI0MiIgY3k9IjM2IiByPSIxMiIgZmlsbD0id2hpdGUiLz4KPC9nPgo8Y2lyY2xlIGN4PSI0MiIgY3k9IjM2IiByPSI3IiBmaWxsPSIjMDA1MkQ5Ii8+CjxkZWZzPgo8ZmlsdGVyIGlkPSJmaWx0ZXIwX2RkZF8yNDQ3XzU3NDkiIHg9IjAiIHk9IjAiIHdpZHRoPSI4NCIgaGVpZ2h0PSI4OCIgZmlsdGVyVW5pdHM9InVzZXJTcGFjZU9uVXNlIiBjb2xvci1pbnRlcnBvbGF0aW9uLWZpbHRlcnM9InNSR0IiPgo8ZmVGbG9vZCBmbG9vZC1vcGFjaXR5PSIwIiByZXN1bHQ9IkJhY2tncm91bmRJbWFnZUZpeCIvPgo8ZmVDb2xvck1hdHJpeCBpbj0iU291cmNlQWxwaGEiIHR5cGU9Im1hdHJpeCIgdmFsdWVzPSIwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAxMjcgMCIgcmVzdWx0PSJoYXJkQWxwaGEiLz4KPGZlT2Zmc2V0IGR5PSI4Ii8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AwIDAgMCAwIDAgMCAwIDAgMCAwIDAgMCAwIDAuMDUgMCIvPgo8ZmVCbGVuZCBtb2RlPSJub3JtYWwiIGluMj0iZWZmZWN0Ml9kcm9wU2hhZG93XzI0NDdfNTc0OSIgcmVzdWx0PSJlZmZlY3QzX2Ryb3BTaGFkb3dfMjQ0N181NzQ5Ii8+CjxmZUJsZW5kIG1vZGU9Im5vcm1hbCIgaW49IlNvdXJjZUdyYXBoaWMiIGluMj0iZWZmZWN0M19kcm9wU2hhZG93XzI0NDdfNTc0OSIgcmVzdWx0PSJzaGFwZSIvPgo8L2ZpbHRlcj4KPC9kZWZzPgo8L3N2Zz4K";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export function getTMap() {
|
|
2
|
+
const TMap = window === null || window === void 0 ? void 0 : window.TMap;
|
|
3
|
+
return TMap;
|
|
4
|
+
}
|
|
5
|
+
export function calculateDistance(latlng1, latlng2) {
|
|
6
|
+
let lat1 = latlng1.latitude;
|
|
7
|
+
let lng1 = latlng1.longitude;
|
|
8
|
+
let lat2 = latlng2.latitude;
|
|
9
|
+
let lng2 = latlng2.longitude;
|
|
10
|
+
var radLat1 = (lat1 * Math.PI) / 180.0;
|
|
11
|
+
var radLat2 = (lat2 * Math.PI) / 180.0;
|
|
12
|
+
var a = radLat1 - radLat2;
|
|
13
|
+
var b = (lng1 * Math.PI) / 180.0 - (lng2 * Math.PI) / 180.0;
|
|
14
|
+
var s = 2 *
|
|
15
|
+
Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) +
|
|
16
|
+
Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)));
|
|
17
|
+
s = s * 6378.137; // EARTH_RADIUS;
|
|
18
|
+
s = Math.round(s * 10000) / 10000;
|
|
19
|
+
return s * 1000;
|
|
20
|
+
}
|
|
21
|
+
export const base64LocationIcon = 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODQiIGhlaWdodD0iODgiIHZpZXdCb3g9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GFwZSIvPgo8L2ZpbHRlcj4KPC9kZWZzPgo8L3N2Zz4K';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useSetState: <T extends object>(initialState?: T) => [T, (patch: Partial<T> | ((prevState: T) => Partial<T>)) => void];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { useCallback, useState } from 'react';
|
|
2
|
+
export const useSetState = (initialState = {}) => {
|
|
3
|
+
const [state, set] = useState(initialState);
|
|
4
|
+
const setState = useCallback((patch) => {
|
|
5
|
+
set((prevState) => Object.assign({}, prevState, patch instanceof Function ? patch(prevState) : patch));
|
|
6
|
+
}, []);
|
|
7
|
+
return [state, setState];
|
|
8
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
2
|
+
import { usePrevious } from '@react-hookz/web';
|
|
3
|
+
export function useSyncValue(defaultValue, comparotor = Object.is) {
|
|
4
|
+
const [stateValue, setStateValue] = useState(defaultValue);
|
|
5
|
+
const prevValue = usePrevious(defaultValue);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
if (!comparotor(prevValue, defaultValue)) {
|
|
8
|
+
setStateValue(defaultValue);
|
|
9
|
+
}
|
|
10
|
+
}, [defaultValue]);
|
|
11
|
+
const setter = useCallback((next) => {
|
|
12
|
+
setStateValue(next);
|
|
13
|
+
}, [setStateValue]);
|
|
14
|
+
return [stateValue, setter];
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default weui;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 组件库通用样式
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
body .weda-ui {
|
|
6
|
+
--weui-BRAND: #006eff;
|
|
7
|
+
--weui-TAG-TEXT-BLUE: #0067eb;
|
|
8
|
+
--weui-BTN-DEFAULT-COLOR: #576b95;
|
|
9
|
+
--weui-WECHAT: #07c160;
|
|
10
|
+
--weui-TAG-TEXT-GREEN: #06ae56;
|
|
11
|
+
--weui-BG-2: rgba(255, 255, 255, 0);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.weda-ui.weui-form {
|
|
15
|
+
min-height: 0%;
|
|
16
|
+
padding: 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.weda-ui .weui-cells {
|
|
20
|
+
margin-top: 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.weda-ui.weui-form .weui-cells__tips {
|
|
24
|
+
margin-bottom: 1.14286rem;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.weda-ui.weda-picker {
|
|
28
|
+
--weui-BG-2: rgba(255, 255, 255, 1);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* 为了避免该属性被转为REM, 所以使用大写的PX */
|
|
32
|
+
.weda-ui.weda-picker .weui-picker__item {
|
|
33
|
+
/* prettier-ignore */
|
|
34
|
+
height: 48PX;
|
|
35
|
+
/* prettier-ignore */
|
|
36
|
+
line-height: 48PX;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.weda-ui.weda-picker .weui-btn_primary:not(.weui-btn_disabled):active {
|
|
40
|
+
background-color: var(--weui-TAG-TEXT-BLUE);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@media (min-width: 1024px) {
|
|
44
|
+
.weda-ui .weui-cells {
|
|
45
|
+
/* prettier-ignore */
|
|
46
|
+
font-size: 1em;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
@media (min-width: 1024px) {
|
|
50
|
+
.weui .weui-cell_active:active {
|
|
51
|
+
background-color: unset !important;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.weda-ui.weda-radio .weui-check,
|
|
56
|
+
.weda-ui.weda-checkbox .weui-check {
|
|
57
|
+
position: absolute;
|
|
58
|
+
left: -714.21429rem;
|
|
59
|
+
width: 0;
|
|
60
|
+
height: 0;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.weda-ui .weui-cell {
|
|
64
|
+
font-size: inherit; /* 要让内联样式生效 */
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.weda-ui .weui-cells {
|
|
68
|
+
font-size: 1em;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.weui-picker a:link:hover {
|
|
72
|
+
text-decoration: none;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.weda-formcells__pc.vertical .wedatea2td-form__label label {
|
|
76
|
+
width: auto; /* vertcal 情况下label不固定宽度 */
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.weda-ui .weui-btn_input-clear {
|
|
80
|
+
visibility: hidden; /* visibilty 防止居中而且宽度auto时,出现输入时宽度抖动 */
|
|
81
|
+
display: inline;
|
|
82
|
+
}
|
|
83
|
+
.weui-input:focus:not(:placeholder-shown) + .weui-btn_input-clear {
|
|
84
|
+
visibility: visible;
|
|
85
|
+
display: inline;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.weda-ui .wedatea2td-form__controls {
|
|
89
|
+
font-size: 1em;
|
|
90
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/weda-ui",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index",
|
|
6
6
|
"miniprogram": "mpdist",
|
|
@@ -44,7 +44,9 @@
|
|
|
44
44
|
"clear:snap": "rimraf ./src/test/__snapshots__",
|
|
45
45
|
"size": "npm run build:cli && size-limit",
|
|
46
46
|
"new": "npx hygen comp new",
|
|
47
|
-
"
|
|
47
|
+
"_postinstall": "node tools/post-install.mjs",
|
|
48
|
+
"prepack": "pinst --disable",
|
|
49
|
+
"postpack": "pinst --enable"
|
|
48
50
|
},
|
|
49
51
|
"keywords": [
|
|
50
52
|
"weda",
|
|
@@ -55,16 +57,14 @@
|
|
|
55
57
|
"license": "MIT",
|
|
56
58
|
"description": "腾讯云微搭低代码组件库模板",
|
|
57
59
|
"dependencies": {
|
|
58
|
-
"@cloudbase/ui-react": "^1.0.4",
|
|
59
60
|
"@loadable/component": "^5.15.2",
|
|
60
61
|
"@react-hookz/web": "^14.2.2",
|
|
61
62
|
"@tcwd/style-wedatheme": "^1.0.4",
|
|
62
63
|
"@use-gesture/react": "^10.2.14",
|
|
63
|
-
"braft-editor": "^2.3.9",
|
|
64
|
-
"braft-utils": "^3.0.12",
|
|
65
64
|
"dayjs": "^1.10.7",
|
|
66
65
|
"destr": "^1.1.1",
|
|
67
66
|
"echarts": "^5.3.0",
|
|
67
|
+
"kedao": "0.1.13",
|
|
68
68
|
"lodash.isequal": "^4.5.0",
|
|
69
69
|
"object.fromentries": "^2.0.5",
|
|
70
70
|
"prop-types": "^15.7.2",
|
|
@@ -84,7 +84,6 @@
|
|
|
84
84
|
"@babel/preset-env": "^7.17.2",
|
|
85
85
|
"@babel/preset-react": "^7.17.2",
|
|
86
86
|
"@babel/preset-typescript": "^7.17.2",
|
|
87
|
-
"@cloudbase/lowcode-build-dependence": "^0.9.0",
|
|
88
87
|
"@cloudbase/lowcode-cli": "^0.14.0",
|
|
89
88
|
"@commitlint/cli": "^16.0.2",
|
|
90
89
|
"@commitlint/config-conventional": "^17.0.0",
|
|
@@ -126,14 +125,16 @@
|
|
|
126
125
|
"jest": "^27.5.1",
|
|
127
126
|
"jest-canvas-mock": "^2.4.0",
|
|
128
127
|
"jest-environment-jsdom": "^27",
|
|
128
|
+
"jest-preview": "^0.2.5",
|
|
129
129
|
"less": "^4.1.2",
|
|
130
130
|
"miniprogram-simulate": "^1.5.7",
|
|
131
131
|
"nano-staged": "^0.8.0",
|
|
132
|
+
"pinst": "^3.0.0",
|
|
132
133
|
"prettier": "^2.6.2",
|
|
133
|
-
"react": "^
|
|
134
|
-
"react-dom": "^
|
|
134
|
+
"react": "^16",
|
|
135
|
+
"react-dom": "^16",
|
|
135
136
|
"react-scripts": "^4.0.3",
|
|
136
|
-
"react-test-renderer": "^
|
|
137
|
+
"react-test-renderer": "^16",
|
|
137
138
|
"regenerator-runtime": "^0.13.9",
|
|
138
139
|
"rimraf": "^3.0.2",
|
|
139
140
|
"size-limit": "^7.0.8",
|
|
@@ -159,7 +160,7 @@
|
|
|
159
160
|
{
|
|
160
161
|
"path": ".temp/dist/*.main.*",
|
|
161
162
|
"webpack": false,
|
|
162
|
-
"limit": "
|
|
163
|
+
"limit": "500 KB"
|
|
163
164
|
}
|
|
164
165
|
],
|
|
165
166
|
"nyc": {
|
|
@@ -167,4 +168,4 @@
|
|
|
167
168
|
"excludeAfterRemap": false,
|
|
168
169
|
"report-dir": "cypress-coverage"
|
|
169
170
|
}
|
|
170
|
-
}
|
|
171
|
+
}
|