@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,63 @@
|
|
|
1
|
+
/* pc style */
|
|
2
|
+
.weda-statistics-card {
|
|
3
|
+
background: #ffffff;
|
|
4
|
+
border: 0.07143rem solid #f1f2f5;
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
box-shadow: 0 0.07143rem 0.14286rem rgba(0, 0, 0, 0.1);
|
|
7
|
+
border-radius: 0.42857rem;
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
font-size: 1rem;
|
|
10
|
+
}
|
|
11
|
+
.weda-statistics-card.weda-statistics-card-pc {
|
|
12
|
+
width: 19.71429rem;
|
|
13
|
+
min-height: 9.14286rem;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.weda-statistics-card .weda-statistics-card__wrapper {
|
|
17
|
+
width: 100%;
|
|
18
|
+
padding: 2rem 1.71429rem;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.weda-statistics-card .weda-statistics-card__title {
|
|
22
|
+
font-size: 1em;
|
|
23
|
+
line-height: 1.57142em;
|
|
24
|
+
color: rgba(0, 0, 0, 0.6);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.weda-statistics-card .weda-statistics-card__detail {
|
|
28
|
+
margin-top: 0.57143rem;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.weda-statistics-card .weda-statistics-card__count {
|
|
32
|
+
font-size: 2.28571em;
|
|
33
|
+
line-height: 3.14285em;
|
|
34
|
+
color: rgba(0, 0, 0, 0.9);
|
|
35
|
+
word-break: break-all;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.weda-statistics-card .weda-statistics-card__unit {
|
|
39
|
+
font-size: 1em;
|
|
40
|
+
line-height: 1.57142em;
|
|
41
|
+
color: rgba(0, 0, 0, 0.4);
|
|
42
|
+
margin-left: 0.28571rem;
|
|
43
|
+
vertical-align: middle;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* h5 style */
|
|
47
|
+
.weda-statistics-card.weda-statistics-card-mobile {
|
|
48
|
+
max-width: 100%;
|
|
49
|
+
min-height: 10rem;
|
|
50
|
+
}
|
|
51
|
+
.weda-statistics-card-mobile .weda-statistics-card__wrapper {
|
|
52
|
+
width: 100%;
|
|
53
|
+
padding: 2.85714rem 1.71429rem;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.weda-statistics-card-mobile .weda-statistics-card__detail {
|
|
57
|
+
margin-top: 0.28571rem;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.weda-statistics-card-mobile .weda-statistics-card__count {
|
|
61
|
+
font-size: 2em;
|
|
62
|
+
line-height: 2.42857em;
|
|
63
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { CommonPropsType } from '../../../types';
|
|
3
|
+
import './index.css';
|
|
4
|
+
import { IDataSource, IField } from './interface';
|
|
5
|
+
interface PropsType extends CommonPropsType {
|
|
6
|
+
/**
|
|
7
|
+
* 数据源
|
|
8
|
+
*/
|
|
9
|
+
dataSource?: IDataSource;
|
|
10
|
+
/**
|
|
11
|
+
* 数据筛选
|
|
12
|
+
*/
|
|
13
|
+
filterData?: any;
|
|
14
|
+
/**
|
|
15
|
+
* 字段
|
|
16
|
+
*/
|
|
17
|
+
field?: IField;
|
|
18
|
+
/**
|
|
19
|
+
* 统计方式
|
|
20
|
+
*/
|
|
21
|
+
operationType?: string;
|
|
22
|
+
/**
|
|
23
|
+
* 字段展示名称
|
|
24
|
+
*/
|
|
25
|
+
label?: string;
|
|
26
|
+
/**
|
|
27
|
+
* 是否统计空值
|
|
28
|
+
*/
|
|
29
|
+
isCountEmpty?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* 是否显示单位
|
|
32
|
+
*/
|
|
33
|
+
isShowUnit?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* 单位
|
|
36
|
+
*/
|
|
37
|
+
unit?: number;
|
|
38
|
+
/**
|
|
39
|
+
* 小数位数
|
|
40
|
+
*/
|
|
41
|
+
decimalDigits?: number;
|
|
42
|
+
/**
|
|
43
|
+
* 后缀
|
|
44
|
+
*/
|
|
45
|
+
suffix?: number;
|
|
46
|
+
/**
|
|
47
|
+
* app.cloud 对象依赖,默认会从 window.app 取值
|
|
48
|
+
*/
|
|
49
|
+
appCloud?: {
|
|
50
|
+
callDataSource?: any;
|
|
51
|
+
callWedaApi?: any;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* 其他属性
|
|
55
|
+
*/
|
|
56
|
+
[key: string]: any;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* 修复科学计数法问题
|
|
60
|
+
* @param num 小数
|
|
61
|
+
* @returns {string}
|
|
62
|
+
*/
|
|
63
|
+
export declare function scientificToNumber(num: any): any;
|
|
64
|
+
/**
|
|
65
|
+
* 补齐小数位数0
|
|
66
|
+
* @param source 源字符串
|
|
67
|
+
* @param targetLength 目标长度
|
|
68
|
+
* @returns {string}
|
|
69
|
+
*/
|
|
70
|
+
export declare function padEnd(source: any, targetLength: any): any;
|
|
71
|
+
/**
|
|
72
|
+
* 修复toFixed四舍五入不准确问题
|
|
73
|
+
* @param num
|
|
74
|
+
* @param digit 小数位数
|
|
75
|
+
* @returns {string}
|
|
76
|
+
*/
|
|
77
|
+
export declare function customToFixed(num: any, digit?: number): string;
|
|
78
|
+
/**
|
|
79
|
+
* 添加千位分隔符
|
|
80
|
+
* @param fixedString
|
|
81
|
+
* @param digit
|
|
82
|
+
*/
|
|
83
|
+
export declare function addDelimiter(fixedString: any, digit: any): string;
|
|
84
|
+
export default function StatisticsCard({ dataSource, filterData, field, operationType, label, isCountEmpty, isShowUnit, unit, decimalDigits, suffix, className, style, events, id, role, appCloud, }: PropsType): JSX.Element;
|
|
85
|
+
export {};
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import './index.css';
|
|
3
|
+
import classNames from '../../../utils/classnames';
|
|
4
|
+
import { ConfigProvider } from 'tea-component';
|
|
5
|
+
import { usePlatform } from '../../../utils/platform';
|
|
6
|
+
import { useDeepCompareEffect, useIsMounted } from '@react-hookz/web';
|
|
7
|
+
import { callDataSource, callWedaApi } from '../../../utils/tcb';
|
|
8
|
+
const CLASS_PREFIX = 'weda-statistics-card';
|
|
9
|
+
// 默认显示值
|
|
10
|
+
const defaultVal = 1000;
|
|
11
|
+
/**
|
|
12
|
+
* 修复科学计数法问题
|
|
13
|
+
* @param num 小数
|
|
14
|
+
* @returns {string}
|
|
15
|
+
*/
|
|
16
|
+
export function scientificToNumber(num) {
|
|
17
|
+
const str = num;
|
|
18
|
+
const reg = /^([-]?\d+\.?\d*)(e)([-|+]?\d+)$/;
|
|
19
|
+
let zero = '';
|
|
20
|
+
if (!reg.test(str)) {
|
|
21
|
+
return num;
|
|
22
|
+
}
|
|
23
|
+
const arr = reg.exec(str);
|
|
24
|
+
const len = Math.abs(+arr[3]) - 1;
|
|
25
|
+
for (let i = 0; i < len; i += 1) {
|
|
26
|
+
zero += '0';
|
|
27
|
+
}
|
|
28
|
+
if (arr[1].indexOf('-') === 0) {
|
|
29
|
+
return `-0.${zero}${arr[1].replace('-', '').replace('.', '')}`;
|
|
30
|
+
}
|
|
31
|
+
return `0.${zero}${arr[1].replace('.', '')}`;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* 补齐小数位数0
|
|
35
|
+
* @param source 源字符串
|
|
36
|
+
* @param targetLength 目标长度
|
|
37
|
+
* @returns {string}
|
|
38
|
+
*/
|
|
39
|
+
export function padEnd(source, targetLength) {
|
|
40
|
+
targetLength = Math.floor(targetLength); //floor if number or convert non-number to 0;
|
|
41
|
+
if (source.length > targetLength) {
|
|
42
|
+
return source;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
targetLength = targetLength - source.length;
|
|
46
|
+
return source + '0'.repeat(targetLength);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* 修复toFixed四舍五入不准确问题
|
|
51
|
+
* @param num
|
|
52
|
+
* @param digit 小数位数
|
|
53
|
+
* @returns {string}
|
|
54
|
+
*/
|
|
55
|
+
export function customToFixed(num, digit = 0) {
|
|
56
|
+
const pow = Math.pow(10, digit);
|
|
57
|
+
let value = `${num}`;
|
|
58
|
+
// 如果是小数,四舍五入进行转化处理确保精度正确
|
|
59
|
+
if (!Number.isInteger(num)) {
|
|
60
|
+
if (num > 0) {
|
|
61
|
+
value = (Math.round((num + Number.EPSILON) * pow) / pow).toString();
|
|
62
|
+
}
|
|
63
|
+
else if (num < 0) {
|
|
64
|
+
value = (Math.round((num - Number.EPSILON) * pow) / pow).toString();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
value = scientificToNumber(value);
|
|
68
|
+
const [integer, decimal = ''] = value.split('.');
|
|
69
|
+
if (digit > 0) {
|
|
70
|
+
return `${integer}.${padEnd(decimal, digit)}`;
|
|
71
|
+
}
|
|
72
|
+
return integer;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* 添加千位分隔符
|
|
76
|
+
* @param fixedString
|
|
77
|
+
* @param digit
|
|
78
|
+
*/
|
|
79
|
+
export function addDelimiter(fixedString, digit) {
|
|
80
|
+
const len = fixedString.length;
|
|
81
|
+
let result = '';
|
|
82
|
+
const decimalPoint = digit > 0 ? digit + 1 : 0;
|
|
83
|
+
for (let i = len - 1; i >= 0; i--) {
|
|
84
|
+
const stepFromTail = len - 1 - i;
|
|
85
|
+
const char = fixedString.charAt(i);
|
|
86
|
+
if (stepFromTail <= decimalPoint) {
|
|
87
|
+
// 小数部分不处理
|
|
88
|
+
result = char + result;
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
if ((stepFromTail - decimalPoint) % 3 === 0) {
|
|
92
|
+
if (char !== '-') {
|
|
93
|
+
result = ',' + result;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
result = char + result;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return result;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* 格式化:添加千分符,四舍五入
|
|
103
|
+
* @param val
|
|
104
|
+
* @param digits
|
|
105
|
+
*/
|
|
106
|
+
const formatNumber = (val, digits = 0) => {
|
|
107
|
+
return isNaN(val) ? val : addDelimiter(customToFixed(val, digits), digits);
|
|
108
|
+
};
|
|
109
|
+
const defaultAppCloud = { callDataSource, callWedaApi };
|
|
110
|
+
export default function StatisticsCard({ dataSource, filterData, field, operationType, label, isCountEmpty, isShowUnit, unit, decimalDigits, suffix, className, style, events, id, role, appCloud = defaultAppCloud, }) {
|
|
111
|
+
const [val, setVal] = useState(defaultVal);
|
|
112
|
+
const isMounted = useIsMounted();
|
|
113
|
+
async function getSourceData(dataSource, filterData, field, operationType, isCountEmpty) {
|
|
114
|
+
const where = (filterData === null || filterData === void 0 ? void 0 : filterData.map)
|
|
115
|
+
? filterData.map((val) => {
|
|
116
|
+
let arrLogicData = val.logicData;
|
|
117
|
+
if (val.logicData && val.logicData.length > 0) {
|
|
118
|
+
arrLogicData = val.logicData.map((mval) => {
|
|
119
|
+
return {
|
|
120
|
+
Key: mval.key,
|
|
121
|
+
Rel: mval.rel,
|
|
122
|
+
Value: mval.value,
|
|
123
|
+
Logic: mval.logic,
|
|
124
|
+
};
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
return {
|
|
128
|
+
GroupLogic: val.groupLogic,
|
|
129
|
+
LogicData: arrLogicData,
|
|
130
|
+
};
|
|
131
|
+
})
|
|
132
|
+
: [];
|
|
133
|
+
const params = {
|
|
134
|
+
dataSourceName: dataSource === null || dataSource === void 0 ? void 0 : dataSource.name,
|
|
135
|
+
where,
|
|
136
|
+
value: [
|
|
137
|
+
{
|
|
138
|
+
Key: field === null || field === void 0 ? void 0 : field.name,
|
|
139
|
+
OperationType: operationType,
|
|
140
|
+
IsCountEmpty: isCountEmpty,
|
|
141
|
+
},
|
|
142
|
+
],
|
|
143
|
+
};
|
|
144
|
+
try {
|
|
145
|
+
if ((dataSource === null || dataSource === void 0 ? void 0 : dataSource.type) === 'database') {
|
|
146
|
+
return await (appCloud === null || appCloud === void 0 ? void 0 : appCloud.callWedaApi({
|
|
147
|
+
action: 'DescribeChartCardData',
|
|
148
|
+
data: params,
|
|
149
|
+
}));
|
|
150
|
+
}
|
|
151
|
+
return await (appCloud === null || appCloud === void 0 ? void 0 : appCloud.callDataSource({
|
|
152
|
+
dataSourceName: dataSource === null || dataSource === void 0 ? void 0 : dataSource.name,
|
|
153
|
+
methodName: dataSource === null || dataSource === void 0 ? void 0 : dataSource.methodName,
|
|
154
|
+
}));
|
|
155
|
+
}
|
|
156
|
+
catch {
|
|
157
|
+
return [];
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
const initCard = async () => {
|
|
161
|
+
var _a, _b;
|
|
162
|
+
// 内部数据源需要字段和统计方式,外部数据源不需要
|
|
163
|
+
if (((dataSource === null || dataSource === void 0 ? void 0 : dataSource.type) === 'database' && field && operationType) ||
|
|
164
|
+
(dataSource && (dataSource === null || dataSource === void 0 ? void 0 : dataSource.type) !== 'database')) {
|
|
165
|
+
let data = await getSourceData(dataSource, filterData, field, operationType, isCountEmpty);
|
|
166
|
+
// 自定义连接器 返回处理
|
|
167
|
+
if ((dataSource === null || dataSource === void 0 ? void 0 : dataSource.type) !== 'database' && (data === null || data === void 0 ? void 0 : data.result)) {
|
|
168
|
+
data = data === null || data === void 0 ? void 0 : data.result;
|
|
169
|
+
}
|
|
170
|
+
if (data === null || data === void 0 ? void 0 : data.length) {
|
|
171
|
+
const val = isNaN((_a = data[0]) === null || _a === void 0 ? void 0 : _a.Value) ? 0 : (_b = data[0]) === null || _b === void 0 ? void 0 : _b.Value;
|
|
172
|
+
isMounted && setVal(val);
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
// 返回数据为空 使用 0
|
|
176
|
+
isMounted && setVal(0);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
// 没有配置数据使用默认数据
|
|
181
|
+
isMounted && setVal(defaultVal);
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
useDeepCompareEffect(() => {
|
|
185
|
+
initCard();
|
|
186
|
+
}, [dataSource, filterData, field, operationType, isCountEmpty]);
|
|
187
|
+
const platform = usePlatform();
|
|
188
|
+
const cls = classNames({
|
|
189
|
+
'weda-ui': true,
|
|
190
|
+
[CLASS_PREFIX]: true,
|
|
191
|
+
[className]: className,
|
|
192
|
+
[`${CLASS_PREFIX}-mobile`]: platform === 'h5',
|
|
193
|
+
[`${CLASS_PREFIX}-pc`]: platform !== 'h5',
|
|
194
|
+
});
|
|
195
|
+
return (React.createElement(ConfigProvider, { classPrefix: "wedatea2td" },
|
|
196
|
+
React.createElement("div", { id: id, role: role, className: cls, style: style, onClick: (e) => events.tap({}, { originEvent: e }) },
|
|
197
|
+
React.createElement("div", { className: `${CLASS_PREFIX}__wrapper` },
|
|
198
|
+
React.createElement("div", { className: `${CLASS_PREFIX}__title` }, label),
|
|
199
|
+
React.createElement("div", { className: `${CLASS_PREFIX}__detail` },
|
|
200
|
+
React.createElement("div", { className: `${CLASS_PREFIX}__count` },
|
|
201
|
+
isShowUnit ? formatNumber(val / unit, decimalDigits) : val,
|
|
202
|
+
isShowUnit && (React.createElement("label", { className: `${CLASS_PREFIX}__unit` }, suffix))))))));
|
|
203
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { CommonPropsType } from '../../types';
|
|
3
|
+
export default function Container({ children, title, events, className, style, id, }: PropsType): JSX.Element;
|
|
4
|
+
export interface PropsType extends CommonPropsType {
|
|
5
|
+
title?: string;
|
|
6
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import classNames from '../../utils/classnames';
|
|
3
|
+
import { emptyObject } from '../../utils/constant';
|
|
4
|
+
export default function Container({ children, title, events = emptyObject, className, style, id, }) {
|
|
5
|
+
return (React.createElement("div", { role: "container", id: id, style: style, className: classNames({ 'weda-ui': true, [className]: className }), title: title, onClick: (e) => { var _a; return (_a = events === null || events === void 0 ? void 0 : events.tap) === null || _a === void 0 ? void 0 : _a.call(events, {}, { originEvent: e }); }, onContextMenu: (e) => { var _a; return (_a = events === null || events === void 0 ? void 0 : events.longpress) === null || _a === void 0 ? void 0 : _a.call(events, {}, { originEvent: e }); }, onTouchStart: (e) => { var _a; return (_a = events === null || events === void 0 ? void 0 : events.touchstart) === null || _a === void 0 ? void 0 : _a.call(events, {}, { originEvent: e }); }, onTouchMove: (e) => { var _a; return (_a = events === null || events === void 0 ? void 0 : events.touchmove) === null || _a === void 0 ? void 0 : _a.call(events, {}, { originEvent: e }); }, onTouchCancel: (e) => { var _a; return (_a = events === null || events === void 0 ? void 0 : events.touchcancel) === null || _a === void 0 ? void 0 : _a.call(events, {}, { originEvent: e }); }, onTouchEnd: (e) => { var _a; return (_a = events === null || events === void 0 ? void 0 : events.touchend) === null || _a === void 0 ? void 0 : _a.call(events, {}, { originEvent: e }); } }, children));
|
|
6
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ListView from '../listView';
|
|
3
|
+
/**
|
|
4
|
+
* 数据容器-列表视图
|
|
5
|
+
*/
|
|
6
|
+
export default function DataView(props) {
|
|
7
|
+
return (React.createElement(ListView, { ...props, isRecords: false, orderBy: undefined, orderType: undefined, template: "none", pageSize: 1, pagination: "none", beforeDataChange: (values) => values === null || values === void 0 ? void 0 : values[0] }));
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { DrawerProps } from 'tea-component';
|
|
3
|
+
import type { CommonPropsType } from '../../types';
|
|
4
|
+
declare const TeaDrawer: ({ size, title, style, events, visible, subtitle, showMask, className, placement, extraSlot, footerSlot, childrenSlot, disableCloseIcon, outerClickClosable, }: PropsType) => JSX.Element;
|
|
5
|
+
export interface PropsType extends CommonPropsType, Pick<DrawerProps, 'size' | 'title' | 'showMask' | 'placement' | 'disableCloseIcon' | 'outerClickClosable' | 'subtitle'> {
|
|
6
|
+
visible: boolean;
|
|
7
|
+
title?: string;
|
|
8
|
+
extraSlot?: React.ReactNode;
|
|
9
|
+
footerSlot?: React.ReactNode;
|
|
10
|
+
childrenSlot?: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export default TeaDrawer;
|
|
13
|
+
export { TeaDrawer };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ConfigProvider, Drawer } from 'tea-component';
|
|
3
|
+
const TeaDrawer = ({ size, title, style, events, visible, subtitle, showMask, className, placement, extraSlot, footerSlot, childrenSlot, disableCloseIcon, outerClickClosable, }) => {
|
|
4
|
+
const eventsList = {
|
|
5
|
+
onClose: () => (events === null || events === void 0 ? void 0 : events.onClose) && events.onClose({}),
|
|
6
|
+
onExited: () => (events === null || events === void 0 ? void 0 : events.onExited) && events.onExited({}),
|
|
7
|
+
};
|
|
8
|
+
return (React.createElement(ConfigProvider, { classPrefix: "wedatea2td" },
|
|
9
|
+
React.createElement(Drawer, { size: size, title: title, style: style, visible: visible, extra: extraSlot, footer: footerSlot, subtitle: subtitle, showMask: showMask, className: className, placement: placement, disableCloseIcon: disableCloseIcon, outerClickClosable: outerClickClosable, ...eventsList }, childrenSlot)));
|
|
10
|
+
};
|
|
11
|
+
export default TeaDrawer;
|
|
12
|
+
export { TeaDrawer };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { CommonFormPropsType } from '../types';
|
|
3
|
+
export default function Checkbox({ id, className, style, events, name, label, labelVisible, format, enumName, range, layout, disabled, requiredFlag, decorator, controlValue, }: PropsType): JSX.Element;
|
|
4
|
+
export interface PropsType extends CommonFormPropsType {
|
|
5
|
+
range?: Readonly<{
|
|
6
|
+
label: string;
|
|
7
|
+
value: any;
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
}[]>;
|
|
10
|
+
format?: string;
|
|
11
|
+
enumName?: string;
|
|
12
|
+
controlValue?: [];
|
|
13
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { Checkbox as TeaCheckbox, ConfigProvider } from 'tea-component';
|
|
3
|
+
import classNames from '../../../utils/classnames';
|
|
4
|
+
import getLocalCounter from '../../../utils/getLocalCounter';
|
|
5
|
+
import isObjectEqual from '../../../utils/isObjectEqual';
|
|
6
|
+
import fromEntries from 'object.fromentries';
|
|
7
|
+
import { usePlatform } from '../../../utils/platform';
|
|
8
|
+
import { renderDecorator } from '../renderDecorator';
|
|
9
|
+
import { callWedaApi } from '../../../utils/tcb';
|
|
10
|
+
import destr from 'destr';
|
|
11
|
+
import { emptyArray, emptyObject } from '../../../utils/constant';
|
|
12
|
+
export default function Checkbox({
|
|
13
|
+
// 系统属性
|
|
14
|
+
id, className, style, events = emptyObject,
|
|
15
|
+
// 组件属性
|
|
16
|
+
name = 'formCheckbox', label = '标题', labelVisible = true, format = '', enumName = '', range = emptyArray, layout = 'horizontal', disabled = false, requiredFlag = false, decorator, controlValue, }) {
|
|
17
|
+
const cls = classNames({
|
|
18
|
+
'weda-ui': true,
|
|
19
|
+
'weda-checkbox': true,
|
|
20
|
+
[className]: className,
|
|
21
|
+
});
|
|
22
|
+
const platform = usePlatform();
|
|
23
|
+
const isH5 = platform === 'h5';
|
|
24
|
+
const subCls = classNames({
|
|
25
|
+
'weui-cell': isH5,
|
|
26
|
+
'weui-cell_active': isH5,
|
|
27
|
+
'weui-check__label': isH5,
|
|
28
|
+
'weui-cell_disabled': isH5 && disabled,
|
|
29
|
+
});
|
|
30
|
+
const [option, setOption] = useState(range);
|
|
31
|
+
const [enumOptions, setEnumOptions] = useState([]);
|
|
32
|
+
const [checkedItems, setCheckedItems] = React.useState(platform === 'h5'
|
|
33
|
+
? fromEntries(option.map(({ value, checked }) => [value, !!checked]))
|
|
34
|
+
: option.filter(({ checked }) => checked).map(({ value }) => value));
|
|
35
|
+
// 两次range不同时, 需要刷新checkedItems
|
|
36
|
+
const prevRangeRef = React.useRef();
|
|
37
|
+
React.useEffect(() => {
|
|
38
|
+
if (!isObjectEqual(prevRangeRef.current, option)) {
|
|
39
|
+
prevRangeRef.current = JSON.parse(JSON.stringify(option));
|
|
40
|
+
setCheckedItems(fromEntries(option.map(({ value, checked }) => [value, !!checked])));
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
// 如果绑定字段类型为枚举,且传入自定义选项集的名称则默认使用自定义选项集的内容作为选项
|
|
45
|
+
if (format === 'x-enum' && enumName) {
|
|
46
|
+
fetchData({ OptNameList: [enumName], PageIndex: 1, PageSize: 10 });
|
|
47
|
+
}
|
|
48
|
+
}, []);
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
if (format === 'x-enum') {
|
|
51
|
+
const opt = enumOptions &&
|
|
52
|
+
enumOptions.map((item) => {
|
|
53
|
+
const checked = controlValue && controlValue.find((val) => val === item.value);
|
|
54
|
+
return {
|
|
55
|
+
value: item.value,
|
|
56
|
+
label: item.label,
|
|
57
|
+
checked: !!checked,
|
|
58
|
+
};
|
|
59
|
+
});
|
|
60
|
+
setOption(opt);
|
|
61
|
+
}
|
|
62
|
+
}, [controlValue]);
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
if (format !== 'x-enum') {
|
|
65
|
+
setOption(range);
|
|
66
|
+
}
|
|
67
|
+
}, [range]);
|
|
68
|
+
const fetchData = async (param) => {
|
|
69
|
+
var _a, _b, _c;
|
|
70
|
+
const data = await callWedaApi({
|
|
71
|
+
action: 'DescribeGeneralOptionsDetailList',
|
|
72
|
+
data: param,
|
|
73
|
+
});
|
|
74
|
+
/* istanbul ignore next */
|
|
75
|
+
const config = (_c = destr((_b = (_a = data === null || data === void 0 ? void 0 : data.Items) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.Config)) !== null && _c !== void 0 ? _c : [];
|
|
76
|
+
const enumOption = config.map((item) => {
|
|
77
|
+
return {
|
|
78
|
+
label: item.value,
|
|
79
|
+
value: item.key,
|
|
80
|
+
checked: false,
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
setEnumOptions(enumOption);
|
|
84
|
+
const opt = enumOption &&
|
|
85
|
+
enumOption.map((item) => {
|
|
86
|
+
const checked = controlValue && controlValue.find((val) => val === item.value);
|
|
87
|
+
return {
|
|
88
|
+
value: item.value,
|
|
89
|
+
label: item.label,
|
|
90
|
+
checked: !!checked,
|
|
91
|
+
};
|
|
92
|
+
});
|
|
93
|
+
setOption(opt);
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* 在ios h5端, label和input的绑定不生效
|
|
97
|
+
* 导致 onChange 事件触发有问题, 所以改为监听 onClick 事件
|
|
98
|
+
*/
|
|
99
|
+
const getChangeHandler = function (value) {
|
|
100
|
+
const onChange = function (e) {
|
|
101
|
+
e.stopPropagation();
|
|
102
|
+
const checked = !checkedItems[value];
|
|
103
|
+
const newMap = Object.assign({}, checkedItems, { [value]: checked });
|
|
104
|
+
if (!disabled) {
|
|
105
|
+
setCheckedItems(newMap);
|
|
106
|
+
events.change({
|
|
107
|
+
value: Object.entries(newMap)
|
|
108
|
+
.filter(([, checked]) => checked)
|
|
109
|
+
.map(([value]) => value),
|
|
110
|
+
}, { originEvent: e });
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
return onChange;
|
|
114
|
+
};
|
|
115
|
+
// 现在低码组件往源码组件传入的id不唯一, 暂时使用hashcode替代
|
|
116
|
+
const hashcode = React.useMemo(() => getLocalCounter(), []);
|
|
117
|
+
let checkboxElement;
|
|
118
|
+
if (platform === 'h5') {
|
|
119
|
+
checkboxElement = option.map(({ label, value }, index) => {
|
|
120
|
+
const _id = `checkbox-${hashcode}-${index}`;
|
|
121
|
+
const _name = `checkbox-${hashcode}-${name}`;
|
|
122
|
+
return (React.createElement("div", { key: _id, onClickCapture: getChangeHandler(value), className: subCls },
|
|
123
|
+
React.createElement("div", { className: "weui-cell__hd" },
|
|
124
|
+
React.createElement("input", { type: "checkbox", className: "weui-check", value: value, id: _id, name: _name, checked: checkedItems[value], disabled: disabled }),
|
|
125
|
+
React.createElement("i", { className: "weui-icon-checked" })),
|
|
126
|
+
React.createElement("div", { className: "weui-cell__bd" },
|
|
127
|
+
React.createElement("p", null, label))));
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
checkboxElement = (React.createElement(ConfigProvider, { classPrefix: "wedatea2td" },
|
|
132
|
+
React.createElement(TeaCheckbox.Group, { disabled: disabled, value: Object.entries(checkedItems)
|
|
133
|
+
.filter(([, checked]) => checked)
|
|
134
|
+
.map(([value]) => value), onChange: (value) => {
|
|
135
|
+
const newMap = option
|
|
136
|
+
.map((opt) => opt.value)
|
|
137
|
+
.reduce((acc, cur) => {
|
|
138
|
+
const idx = value.indexOf(cur);
|
|
139
|
+
if (idx < 0) {
|
|
140
|
+
acc[cur] = false;
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
acc[cur] = true;
|
|
144
|
+
}
|
|
145
|
+
return acc;
|
|
146
|
+
}, {});
|
|
147
|
+
setCheckedItems(newMap);
|
|
148
|
+
events.change({
|
|
149
|
+
value: Object.entries(newMap)
|
|
150
|
+
.filter(([, checked]) => checked)
|
|
151
|
+
.map(([value]) => value),
|
|
152
|
+
});
|
|
153
|
+
} }, option.map(({ value, label }, index) => {
|
|
154
|
+
const _id = `checkbox-${hashcode}-${index}`;
|
|
155
|
+
return (React.createElement(TeaCheckbox, { key: _id, name: value, id: _id }, label));
|
|
156
|
+
}))));
|
|
157
|
+
}
|
|
158
|
+
return renderDecorator(checkboxElement, decorator)({
|
|
159
|
+
id,
|
|
160
|
+
className: cls,
|
|
161
|
+
style,
|
|
162
|
+
label: labelVisible ? label : null,
|
|
163
|
+
layout,
|
|
164
|
+
multiCell: true,
|
|
165
|
+
requiredFlag,
|
|
166
|
+
});
|
|
167
|
+
}
|