@cloudbase/weda-ui 0.2.17 → 2.0.8
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/README.md +3 -0
- package/package.json +10 -5
- package/src/configs/components/button.json +0 -2
- package/src/configs/components/calendar.json +9 -3
- package/src/configs/components/carousel.json +18 -9
- package/src/configs/components/chart/bar.json +31 -12
- package/src/configs/components/chart/line.json +27 -10
- package/src/configs/components/chart/pie.json +22 -8
- package/src/configs/components/chart/statisticsCard.json +61 -13
- package/src/configs/components/container.json +7 -2
- package/src/configs/components/dataView.json +31 -11
- package/src/configs/components/form/checkbox.json +97 -5
- package/src/configs/components/form/radio.json +123 -4
- package/src/configs/components/form/select.json +247 -13
- package/src/configs/components/graphicCard.json +90 -75
- package/src/configs/components/image.json +19 -8
- package/src/configs/components/link.json +25 -6
- package/src/configs/components/listView.json +83 -27
- package/src/configs/components/lottery.json +153 -0
- package/src/configs/components/modal.json +37 -5
- package/src/configs/components/navLayout.json +97 -79
- package/src/configs/components/navigationBar.json +59 -0
- package/src/configs/components/richtextview.json +6 -2
- package/src/configs/components/scrollVeiw.json +98 -34
- package/src/configs/components/swiper.json +22 -10
- package/src/configs/components/tabs.json +54 -9
- package/src/configs/components/text.json +43 -30
- package/src/configs/components/wxOpenApi/phone.json +141 -0
- package/src/configs/components/wxOpenApi/phoneCode.json +121 -0
- package/src/configs/components/wxOpenApi/share.json +167 -0
- package/src/configs/components/wxOpenApi/userInfo.json +174 -0
- package/src/configs/index.js +13 -0
- package/src/docs/common/format.tsx +112 -0
- package/src/docs/common/tableView.css +164 -0
- package/src/docs/common/tableView.tsx +273 -0
- package/src/docs/compsdocs/chart/Bar.mdx +159 -0
- package/src/docs/compsdocs/chart/Line.mdx +100 -0
- package/src/docs/compsdocs/chart/Pie.mdx +83 -0
- package/src/docs/compsdocs/chart/_category_.json +1 -0
- package/src/docs/compsdocs/chart/statisticsCard.mdx +51 -0
- package/src/docs/compsdocs/database/DataView.mdx +33 -0
- package/src/docs/compsdocs/database/ListView.mdx +33 -0
- package/src/docs/compsdocs/database/_category_.json +1 -0
- package/src/docs/compsdocs/form/Form.mdx +35 -0
- package/src/docs/compsdocs/form/FormCheckbox.mdx +35 -0
- package/src/docs/compsdocs/form/FormDate.mdx +30 -0
- package/src/docs/compsdocs/form/FormEmail.mdx +30 -0
- package/src/docs/compsdocs/form/FormImageUploader.mdx +31 -0
- package/src/docs/compsdocs/form/FormInput.mdx +30 -0
- package/src/docs/compsdocs/form/FormLocation.mdx +64 -0
- package/src/docs/compsdocs/form/FormPhone.mdx +30 -0
- package/src/docs/compsdocs/form/FormRadio.mdx +35 -0
- package/src/docs/compsdocs/form/FormRegion.mdx +30 -0
- package/src/docs/compsdocs/form/FormSelect.mdx +36 -0
- package/src/docs/compsdocs/form/FormSwitch.mdx +30 -0
- package/src/docs/compsdocs/form/FormTextarea.mdx +30 -0
- package/src/docs/compsdocs/form/FormTime.mdx +30 -0
- package/src/docs/compsdocs/form/FormUploadFile.mdx +30 -0
- package/src/docs/compsdocs/form/FormUrl.mdx +30 -0
- package/src/docs/compsdocs/form/_category_.json +1 -0
- package/src/docs/compsdocs/grid/Card.mdx +32 -0
- package/src/docs/compsdocs/grid/Container.mdx +42 -0
- package/src/docs/compsdocs/grid/Footer.mdx +31 -0
- package/src/docs/compsdocs/grid/GridLayout.mdx +32 -0
- package/src/docs/compsdocs/grid/Header.mdx +31 -0
- package/src/docs/compsdocs/grid/Layout.mdx +25 -0
- package/src/docs/compsdocs/grid/List.mdx +31 -0
- package/src/docs/compsdocs/grid/ScrollView.mdx +37 -0
- package/src/docs/compsdocs/grid/Swiper.mdx +58 -0
- package/src/docs/compsdocs/grid/_category_.json +1 -0
- package/src/docs/compsdocs/media/Icon.mdx +31 -0
- package/src/docs/compsdocs/media/Image.mdx +55 -0
- package/src/docs/compsdocs/media/_category_.json +1 -0
- package/src/docs/compsdocs/model/ModelCreate.mdx +20 -0
- package/src/docs/compsdocs/model/ModelDetail.mdx +20 -0
- package/src/docs/compsdocs/model/ModelTable.mdx +24 -0
- package/src/docs/compsdocs/model/ModelUpdate.mdx +21 -0
- package/src/docs/compsdocs/model/PageLayout.mdx +21 -0
- package/src/docs/compsdocs/model/_category_.json +1 -0
- package/src/docs/compsdocs/navmenu/Classification.mdx +38 -0
- package/src/docs/compsdocs/navmenu/NavBar.mdx +43 -0
- package/src/docs/compsdocs/navmenu/NavLayout.mdx +30 -0
- package/src/docs/compsdocs/navmenu/TabBar.mdx +43 -0
- package/src/docs/compsdocs/navmenu/TabBarItem.mdx +29 -0
- package/src/docs/compsdocs/navmenu/_category_.json +1 -0
- package/src/docs/compsdocs/senior/Lottery.mdx +48 -0
- package/src/docs/compsdocs/senior/Modal.mdx +58 -0
- package/src/docs/compsdocs/senior/SlotMachine.mdx +52 -0
- package/src/docs/compsdocs/senior/_category_.json +1 -0
- package/src/docs/compsdocs/show/Calendar.mdx +29 -0
- package/src/docs/compsdocs/show/Divider.mdx +31 -0
- package/src/docs/compsdocs/show/GraphicCard.mdx +30 -0
- package/src/docs/compsdocs/show/Item.mdx +32 -0
- package/src/docs/compsdocs/show/ItemList.mdx +47 -0
- package/src/docs/compsdocs/show/Media.mdx +25 -0
- package/src/docs/compsdocs/show/StatusTip.mdx +25 -0
- package/src/docs/compsdocs/show/Swiper.mdx +33 -0
- package/src/docs/compsdocs/show/Tabs.mdx +38 -0
- package/src/docs/compsdocs/show/_category_.json +1 -0
- package/src/docs/compsdocs/show/button.mdx +25 -0
- package/src/docs/compsdocs/text/Link.mdx +43 -0
- package/src/docs/compsdocs/text/RichTextView.mdx +36 -0
- package/src/docs/compsdocs/text/Text.mdx +31 -0
- package/src/docs/compsdocs/text/Title.mdx +32 -0
- package/src/docs/compsdocs/text/_category_.json +1 -0
- package/src/docs/compsdocs/wxOpen/Phone.mdx +60 -0
- package/src/docs/compsdocs/wxOpen/Share.mdx +46 -0
- package/src/docs/compsdocs/wxOpen/UserInfo.mdx +60 -0
- package/src/docs/compsdocs/wxOpen/_category_.json +4 -0
- package/src/index.js +2 -0
- package/src/mp/components/button/index.js +18 -2
- package/src/mp/components/button/index.wxml +7 -4
- package/src/mp/components/chart/bar/index.js +6 -2
- package/src/mp/components/chart/common/core/eChartBar.js +9 -8
- package/src/mp/components/chart/common/core/eChartBase.js +20 -16
- package/src/mp/components/chart/common/core/eChartLine.js +6 -5
- package/src/mp/components/chart/line/index.js +10 -6
- package/src/mp/components/chart/pie/index.js +6 -2
- package/src/mp/components/chart/statisticsCard/index.js +33 -6
- package/src/mp/components/dataView/index.json +1 -1
- package/src/mp/components/form/checkbox/index.js +41 -2
- package/src/mp/components/form/checkbox/index.wxml +1 -1
- package/src/mp/components/form/form/index.wxml +1 -2
- package/src/mp/components/form/formcell/index.wxml +1 -1
- package/src/mp/components/form/formcell/index.wxss +17 -0
- package/src/mp/components/form/input/index.js +1 -1
- package/src/mp/components/form/input/index.wxss +15 -0
- package/src/mp/components/form/location/index.js +43 -2
- package/src/mp/components/form/location/index.wxss +4 -6
- package/src/mp/components/form/radio/index.js +34 -1
- package/src/mp/components/form/select/index.js +351 -41
- package/src/mp/components/form/select/index.wxml +17 -2
- package/src/mp/components/form/select/index.wxss +4 -0
- package/src/mp/components/form/select/region/index.js +101 -0
- package/src/mp/components/form/textarea/index.js +1 -1
- package/src/mp/components/form/textarea/index.wxss +4 -0
- package/src/mp/components/form/uploader/index.js +39 -27
- package/src/mp/components/form/uploader/index.json +3 -2
- package/src/mp/components/form/uploader/index.wxml +11 -7
- package/src/mp/components/form/uploader/index.wxss +20 -2
- package/src/mp/components/form/uploader/weui-uploader.js +209 -0
- package/src/mp/components/form/uploader/weui-uploader.json +7 -0
- package/src/mp/components/form/uploader/weui-uploader.wxml +45 -0
- package/src/mp/components/form/uploader/weui-uploader.wxss +1 -0
- package/src/mp/components/form/uploaderFile/index.js +10 -6
- package/src/mp/components/form/uploaderFile/index.wxss +4 -4
- package/src/mp/components/image/index.wxss +3 -2
- package/src/mp/components/listView/index.js +38 -43
- package/src/mp/components/listView/index.wxml +1 -1
- package/src/mp/components/listView/index.wxss +5 -0
- package/src/mp/components/lottery/index.js +270 -0
- package/src/mp/components/{internals/listView → lottery}/index.json +0 -0
- package/src/mp/components/lottery/index.wxml +43 -0
- package/src/mp/components/lottery/index.wxss +317 -0
- package/src/mp/components/navigationBar/index.js +193 -0
- package/src/mp/components/navigationBar/index.json +6 -0
- package/src/mp/components/navigationBar/index.wxml +88 -0
- package/src/mp/components/navigationBar/index.wxss +1257 -0
- package/src/mp/components/tabs/index.js +7 -2
- package/src/mp/components/tabs/index.wxml +2 -1
- package/src/mp/components/text/index.js +0 -25
- package/src/mp/components/text/index.wxml +3 -3
- package/src/mp/components/wxOpenApi/phone/index.js +117 -0
- package/src/mp/components/wxOpenApi/phone/index.json +4 -0
- package/src/mp/components/wxOpenApi/phone/index.wxml +15 -0
- package/src/mp/components/wxOpenApi/phone/index.wxss +22 -0
- package/src/mp/components/wxOpenApi/phoneCode/index.js +89 -0
- package/src/mp/components/wxOpenApi/phoneCode/index.json +4 -0
- package/src/mp/components/wxOpenApi/phoneCode/index.wxml +15 -0
- package/src/mp/components/wxOpenApi/phoneCode/index.wxss +22 -0
- package/src/mp/components/wxOpenApi/share/index.js +117 -0
- package/src/mp/components/wxOpenApi/share/index.json +4 -0
- package/src/mp/components/wxOpenApi/share/index.wxml +15 -0
- package/src/mp/components/wxOpenApi/share/index.wxss +22 -0
- package/src/mp/components/wxOpenApi/userInfo/index.js +88 -0
- package/src/mp/components/wxOpenApi/userInfo/index.json +4 -0
- package/src/mp/components/wxOpenApi/userInfo/index.wxml +14 -0
- package/src/mp/components/wxOpenApi/userInfo/index.wxss +22 -0
- package/src/mp/index.json +7 -1
- package/src/mp/style/weda-ui.wxss +16 -0
- package/src/mp/utils/constant.js +15 -0
- package/src/mp/utils/destr.js +48 -0
- package/src/mp/utils/lodash.js +2 -0
- package/src/mp/utils/platform.js +10 -0
- package/src/mp/utils/tcb.js +44 -0
- package/src/web/components/button/index.css +8 -1
- package/src/web/components/button/index.tsx +10 -9
- package/src/web/components/calendar/index.jsx +1 -1
- package/src/web/components/carousel/index.tsx +8 -8
- package/src/web/components/chart/bar/index.tsx +40 -39
- package/src/web/components/chart/common/config/line.js +1 -1
- package/src/web/components/chart/common/core/eChartBar.js +7 -6
- package/src/web/components/chart/common/core/eChartBase.ts +20 -16
- package/src/web/components/chart/common/core/eChartLine.js +8 -6
- package/src/web/components/chart/line/index.tsx +40 -39
- package/src/web/components/chart/statisticsCard/index.tsx +29 -8
- package/src/web/components/form/checkbox/index.tsx +61 -23
- package/src/web/components/form/form/index.css +5 -1
- package/src/web/components/form/form/index.tsx +3 -1
- package/src/web/components/form/formcell/index.css +22 -1
- package/src/web/components/form/formcell/index.tsx +11 -6
- package/src/web/components/form/input/index.css +7 -12
- package/src/web/components/form/location/components/LocationH5/index.css +4 -7
- package/src/web/components/form/location/components/LocationH5/location.h5.jsx +1 -1
- package/src/web/components/form/radio/index.tsx +90 -53
- package/src/web/components/form/select/h5.tsx +370 -73
- package/src/web/components/form/select/index.css +15 -0
- package/src/web/components/form/select/index.tsx +392 -145
- package/src/web/components/form/select/region/index.ts +122 -31
- package/src/web/components/form/select/time.jsx +89 -0
- package/src/web/components/form/select/year.tsx +170 -0
- package/src/web/components/form/textarea/index.css +4 -0
- package/src/web/components/form/textarea/index.tsx +2 -2
- package/src/web/components/form/tips/index.css +4 -0
- package/src/web/components/form/tips/index.tsx +4 -3
- package/src/web/components/form/uploader/index.css +26 -2
- package/src/web/components/form/uploader/uploader.h5.tsx +89 -57
- package/src/web/components/form/uploader/uploader.pc.tsx +4 -4
- package/src/web/components/form/uploaderFile/index.css +2 -4
- package/src/web/components/form/uploaderFile/uploadFile.h5.tsx +13 -7
- package/src/web/components/form/uploaderFile/uploadFile.pc.tsx +13 -5
- package/src/web/components/image/image.tsx +1 -1
- package/src/web/components/image/index.css +3 -3
- package/src/web/components/image/index.tsx +6 -7
- package/src/web/components/index.js +8 -0
- package/src/web/components/link/index.tsx +7 -4
- package/src/web/components/listView/index.css +4 -0
- package/src/web/components/listView/index.tsx +12 -20
- package/src/web/components/lottery/index.css +327 -0
- package/src/web/components/lottery/index.tsx +567 -0
- package/src/web/components/lottery/lotteryUtil.ts +130 -0
- package/src/web/components/modal/index.tsx +3 -1
- package/src/web/components/navLayout/index.tsx +2 -2
- package/src/web/components/navigationBar/chevron-right--double.svg +3 -0
- package/src/web/components/navigationBar/common.tsx +198 -0
- package/src/web/components/navigationBar/h5Menu.tsx +179 -0
- package/src/web/components/navigationBar/horizontalMenu.tsx +200 -0
- package/src/web/components/navigationBar/index.css +762 -0
- package/src/web/components/navigationBar/index.tsx +230 -0
- package/src/web/components/navigationBar/type.d.ts +111 -0
- package/src/web/components/navigationBar/verticalMenu.tsx +81 -0
- package/src/web/components/phone/index.css +0 -0
- package/src/web/components/phone/index.tsx +22 -0
- package/src/web/components/phoneCode/index.css +0 -0
- package/src/web/components/phoneCode/index.tsx +22 -0
- package/src/web/components/picker/timePicker.tsx +2 -2
- package/src/web/components/richTextView/index.tsx +3 -5
- package/src/web/components/share/index.css +0 -0
- package/src/web/components/share/index.tsx +38 -0
- package/src/web/components/slot/index.tsx +1 -1
- package/src/web/components/tabs/index.tsx +2 -0
- package/src/web/components/tabs/tabs.h5.tsx +43 -33
- package/src/web/components/tabs/tabs.pc.tsx +23 -10
- package/src/web/components/text/index.tsx +12 -20
- package/src/web/components/userInfo/index.css +0 -0
- package/src/web/components/userInfo/index.tsx +30 -0
- package/src/web/utils/{constant.js → constant.ts} +17 -2
- package/src/web/utils/lodash.ts +2 -0
- package/src/web/utils/platform.js +9 -0
- package/src/web/utils/tcb.js +26 -0
- package/src/web/weda-ui.css +7 -1
- package/src/mp/components/internals/listView/arrow-right-line.svg +0 -3
- package/src/mp/components/internals/listView/index.js +0 -286
- package/src/mp/components/internals/listView/index.wxml +0 -40
- package/src/mp/components/internals/listView/index.wxss +0 -150
- package/src/mp/components/internals/listView/more-line.svg +0 -3
- package/src/web/components/form/select/region/cities.ts +0 -2410
- package/src/web/components/form/select/region/provinces.ts +0 -240
- package/src/web/components/form/select/region/regions.ts +0 -20645
package/src/mp/index.json
CHANGED
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"RichTextView": "components/richText/index",
|
|
30
30
|
"Tabs": "components/tabs/index",
|
|
31
31
|
"ListView": "components/listView/index",
|
|
32
|
+
"NavigationBar": "components/navigationBar/index",
|
|
32
33
|
"DataView": "components/dataView/index",
|
|
33
34
|
"Calendar": "components/calendar/index",
|
|
34
35
|
"NavLayout": "components/navLayout/index",
|
|
@@ -36,7 +37,12 @@
|
|
|
36
37
|
"Bar": "components/chart/bar/index",
|
|
37
38
|
"Pie": "components/chart/pie/index",
|
|
38
39
|
"StatisticsCard": "components/chart/statisticsCard/index",
|
|
39
|
-
"GraphicCard": "components/graphicCard/index"
|
|
40
|
+
"GraphicCard": "components/graphicCard/index",
|
|
41
|
+
"UserInfo": "components/wxOpenApi/userInfo/index",
|
|
42
|
+
"Phone": "components/wxOpenApi/phone/index",
|
|
43
|
+
"Share": "components/wxOpenApi/share/index",
|
|
44
|
+
"Lottery": "components/lottery/index",
|
|
45
|
+
"PhoneCode": "components/wxOpenApi/phoneCode/index"
|
|
40
46
|
},
|
|
41
47
|
"actions": {
|
|
42
48
|
"showToast": "actions/showToast/index",
|
|
@@ -6,6 +6,8 @@ page .weda-ui {
|
|
|
6
6
|
--weui-BRAND: #006eff;
|
|
7
7
|
--weui-TAG-TEXT-BLUE: #0067eb;
|
|
8
8
|
--weui-BTN-DEFAULT-COLOR: #576b95;
|
|
9
|
+
--weui-WECHAT: #07c160;
|
|
10
|
+
--weui-TAG-TEXT-GREEN: #06ae56;
|
|
9
11
|
--weui-BG-2: rgba(255, 255, 255, 0);
|
|
10
12
|
}
|
|
11
13
|
|
|
@@ -38,3 +40,17 @@ page .weda-ui {
|
|
|
38
40
|
.weda-ui.weda-picker .weui-btn_primary:not(.weui-btn_disabled):active {
|
|
39
41
|
background-color: var(--weui-TAG-TEXT-BLUE);
|
|
40
42
|
}
|
|
43
|
+
|
|
44
|
+
.weda-ui .weui-cell {
|
|
45
|
+
font-size: 16px; /* 修改默认weui的17为16 */
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.weui-cells__group_form .weui-cell::before, .weui-cells__group_form .weui-cells::before {
|
|
49
|
+
left: 16px;
|
|
50
|
+
right: 16px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.weui-cells__group_form .weui-cells::after {
|
|
54
|
+
left: 16px;
|
|
55
|
+
right: 16px;
|
|
56
|
+
}
|
package/src/mp/utils/constant.js
CHANGED
|
@@ -3,3 +3,18 @@ export const TitleType = {
|
|
|
3
3
|
TOP: 'top',
|
|
4
4
|
NONE: 'none',
|
|
5
5
|
};
|
|
6
|
+
|
|
7
|
+
export const REL_DICT = {
|
|
8
|
+
equal: 'eq', // 等于
|
|
9
|
+
unequal: 'neq', // 不等于
|
|
10
|
+
include: 'search', // 包含
|
|
11
|
+
exclude: '_exclude', // 不包含
|
|
12
|
+
begin_with: '_begin_with', // 开头是
|
|
13
|
+
greater: 'gt', // 大于
|
|
14
|
+
greater_or_equal: 'gte', // 大于等于
|
|
15
|
+
bigger_or_equal: 'gte', //大于等于
|
|
16
|
+
less: 'lt', // 小于
|
|
17
|
+
less_or_equal: 'lte', // 小于等于
|
|
18
|
+
in: 'in', // 多选值
|
|
19
|
+
not_in: 'nin', // 不在多选值
|
|
20
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// https://github.com/unjs/destr/blob/2f6612533dd798d2ff5786274f2244558f86d09c/src/index.ts
|
|
2
|
+
// https://github.com/fastify/secure-json-parse
|
|
3
|
+
// https://github.com/hapijs/bourne
|
|
4
|
+
const suspectProtoRx = /"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/;
|
|
5
|
+
const suspectConstructorRx = /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;
|
|
6
|
+
const JsonSigRx = /^["{[]|^-?[0-9][0-9.]{0,14}$/;
|
|
7
|
+
function jsonParseTransform(key, value) {
|
|
8
|
+
if (key === '__proto__' || key === 'constructor') {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
return value;
|
|
12
|
+
}
|
|
13
|
+
export default function destr(val) {
|
|
14
|
+
if (typeof val !== 'string') {
|
|
15
|
+
return val;
|
|
16
|
+
}
|
|
17
|
+
const _lval = val.toLowerCase();
|
|
18
|
+
if (_lval === 'true') {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
if (_lval === 'false') {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
if (_lval === 'null') {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
if (_lval === 'nan') {
|
|
28
|
+
return NaN;
|
|
29
|
+
}
|
|
30
|
+
if (_lval === 'infinity') {
|
|
31
|
+
return Infinity;
|
|
32
|
+
}
|
|
33
|
+
if (_lval === 'undefined') {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
if (!JsonSigRx.test(val)) {
|
|
37
|
+
return val;
|
|
38
|
+
}
|
|
39
|
+
try {
|
|
40
|
+
if (suspectProtoRx.test(val) || suspectConstructorRx.test(val)) {
|
|
41
|
+
return JSON.parse(val, jsonParseTransform);
|
|
42
|
+
}
|
|
43
|
+
return JSON.parse(val);
|
|
44
|
+
}
|
|
45
|
+
catch (_e) {
|
|
46
|
+
return val;
|
|
47
|
+
}
|
|
48
|
+
}
|
package/src/mp/utils/platform.js
CHANGED
|
@@ -18,6 +18,16 @@ export const transSize = (size) => {
|
|
|
18
18
|
const g = getBig(m);
|
|
19
19
|
return `${g}G`;
|
|
20
20
|
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* 判断是否是url
|
|
24
|
+
*/
|
|
25
|
+
const reg =
|
|
26
|
+
// eslint-disable-next-line no-useless-escape
|
|
27
|
+
/(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/;
|
|
28
|
+
|
|
29
|
+
export const isUrl = (path) => reg.test(path);
|
|
30
|
+
|
|
21
31
|
/**
|
|
22
32
|
* 生成随机数
|
|
23
33
|
*/
|
package/src/mp/utils/tcb.js
CHANGED
|
@@ -13,6 +13,32 @@ export async function getTempFileURL(data) {
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* 云API:获取用户自定义导航内容
|
|
18
|
+
* param
|
|
19
|
+
* WeAppId: string,
|
|
20
|
+
* EnvId: string,
|
|
21
|
+
* PublishType?: string,
|
|
22
|
+
*/
|
|
23
|
+
export async function getAppCustomNav() {
|
|
24
|
+
try {
|
|
25
|
+
const PublishType = getApp().app.cloud?.IS_WEDA_IDE ? 'preview' : '';
|
|
26
|
+
const WeAppId = getApp().app?.id;
|
|
27
|
+
const res = await callWedaApi({
|
|
28
|
+
action: 'DescribeAppCustomNav',
|
|
29
|
+
serviceType: 'lowcode',
|
|
30
|
+
data: {
|
|
31
|
+
WeAppId,
|
|
32
|
+
PublishType,
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
return res;
|
|
36
|
+
} catch (error) {
|
|
37
|
+
console.error('错误', error);
|
|
38
|
+
return {};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
16
42
|
/**
|
|
17
43
|
* 调用微搭后端API服务
|
|
18
44
|
*/
|
|
@@ -30,3 +56,21 @@ export async function callDataSource(param) {
|
|
|
30
56
|
return await getApp().app.cloud.callDataSource(param);
|
|
31
57
|
}
|
|
32
58
|
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* 云函数获取数据
|
|
62
|
+
*/
|
|
63
|
+
export async function callDataSourceApi(param) {
|
|
64
|
+
const { params, dataSourceName, methodName } = param;
|
|
65
|
+
try {
|
|
66
|
+
const res = await getApp()?.app?.cloud?.callDataSource?.({
|
|
67
|
+
params,
|
|
68
|
+
dataSourceName,
|
|
69
|
+
methodName,
|
|
70
|
+
});
|
|
71
|
+
return res;
|
|
72
|
+
} catch (error) {
|
|
73
|
+
console.error('错误', error);
|
|
74
|
+
return {};
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -6,6 +6,14 @@
|
|
|
6
6
|
background-color: var(--weui-BRAND);
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
.weda-button.weui-btn.weui-btn_primary.weui-btn_wechat:not(.weui-btn_disabled):active {
|
|
10
|
+
background-color: var(--weui-TAG-TEXT-GREEN);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.weda-button.weui-btn_primary.weui-btn_wechat {
|
|
14
|
+
background-color: var(--weui-WECHAT);
|
|
15
|
+
}
|
|
16
|
+
|
|
9
17
|
.weda-button.weda-button-mini {
|
|
10
18
|
font-size: smaller;
|
|
11
19
|
}
|
|
@@ -17,4 +25,3 @@
|
|
|
17
25
|
text-align: center;
|
|
18
26
|
width: 100%;
|
|
19
27
|
}
|
|
20
|
-
|
|
@@ -8,13 +8,13 @@ import './index.css';
|
|
|
8
8
|
|
|
9
9
|
// 不用 react-weui 而直接用底层实现的原因是 react-weui 不能支持表单类型
|
|
10
10
|
const Button = ({
|
|
11
|
-
text
|
|
12
|
-
size
|
|
13
|
-
type
|
|
11
|
+
text,
|
|
12
|
+
size,
|
|
13
|
+
type,
|
|
14
14
|
contentSlot,
|
|
15
15
|
formType,
|
|
16
|
-
loading
|
|
17
|
-
disabled
|
|
16
|
+
loading,
|
|
17
|
+
disabled,
|
|
18
18
|
events = ({} as Record<string, unknownFunction>),
|
|
19
19
|
className,
|
|
20
20
|
style,
|
|
@@ -29,9 +29,10 @@ const Button = ({
|
|
|
29
29
|
'weda-button-mini': size === 'mini',
|
|
30
30
|
'weui-btn': isH5,
|
|
31
31
|
'weui-btn_mini': isH5 && size === 'mini',
|
|
32
|
-
'weui-btn_primary': isH5 && type === 'primary',
|
|
32
|
+
'weui-btn_primary': isH5 && (type === 'primary' || type === 'wechat'),
|
|
33
33
|
'weui-btn_default': isH5 && type === 'default',
|
|
34
34
|
'weui-btn_warn': isH5 && type === 'warn',
|
|
35
|
+
'weui-btn_wechat': isH5 && type === 'wechat',
|
|
35
36
|
'weui-btn_disabled': isH5 && disabled,
|
|
36
37
|
[className]: className,
|
|
37
38
|
});
|
|
@@ -60,7 +61,7 @@ const Button = ({
|
|
|
60
61
|
return (
|
|
61
62
|
<ConfigProvider classPrefix="wedatea2td">
|
|
62
63
|
<TeaButton
|
|
63
|
-
loading={loading}
|
|
64
|
+
loading={loading}
|
|
64
65
|
onClick={onClick}
|
|
65
66
|
disabled={disabled}
|
|
66
67
|
htmlType={formType}
|
|
@@ -90,7 +91,7 @@ export interface PropsType extends CommonPropsType {
|
|
|
90
91
|
/**
|
|
91
92
|
* 样式类型
|
|
92
93
|
*/
|
|
93
|
-
type?:
|
|
94
|
+
type?: 'primary' | 'warn' | 'wechat' | 'default';
|
|
94
95
|
/**
|
|
95
96
|
* 大小
|
|
96
97
|
*/
|
|
@@ -111,4 +112,4 @@ export interface PropsType extends CommonPropsType {
|
|
|
111
112
|
contentSlot?: string;
|
|
112
113
|
}
|
|
113
114
|
|
|
114
|
-
export default Button;
|
|
115
|
+
export default Button;
|
|
@@ -50,15 +50,15 @@ export interface PropsType extends CommonPropsType {
|
|
|
50
50
|
export default function Carousel({
|
|
51
51
|
className,
|
|
52
52
|
style = {},
|
|
53
|
-
autoplay
|
|
54
|
-
circular
|
|
55
|
-
vertical
|
|
53
|
+
autoplay,
|
|
54
|
+
circular,
|
|
55
|
+
vertical,
|
|
56
56
|
indicatorDots,
|
|
57
|
-
indicatorColor
|
|
58
|
-
indicatorActiveColor
|
|
59
|
-
duration
|
|
60
|
-
interval
|
|
61
|
-
current
|
|
57
|
+
indicatorColor,
|
|
58
|
+
indicatorActiveColor,
|
|
59
|
+
duration,
|
|
60
|
+
interval,
|
|
61
|
+
current,
|
|
62
62
|
events = {},
|
|
63
63
|
id,
|
|
64
64
|
images,
|
|
@@ -40,45 +40,46 @@ interface PropsType extends CommonPropsType {
|
|
|
40
40
|
decimalDigits?: number;
|
|
41
41
|
suffix?: string;
|
|
42
42
|
}
|
|
43
|
-
export default function Bar({
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
43
|
+
export default function Bar(opts: PropsType) {
|
|
44
|
+
const {
|
|
45
|
+
directionType,
|
|
46
|
+
isPile,
|
|
47
|
+
id,
|
|
48
|
+
style,
|
|
49
|
+
className,
|
|
50
|
+
isTitle,
|
|
51
|
+
title,
|
|
52
|
+
titleLocation,
|
|
53
|
+
dataSource,
|
|
54
|
+
setColor,
|
|
55
|
+
filterData,
|
|
56
|
+
xField,
|
|
57
|
+
xStatistics,
|
|
58
|
+
groupKey,
|
|
59
|
+
groupKeyTimeSpan,
|
|
60
|
+
xIsCountEmpty,
|
|
61
|
+
yField,
|
|
62
|
+
isLegend,
|
|
63
|
+
legend,
|
|
64
|
+
legend2,
|
|
65
|
+
isXaxisName,
|
|
66
|
+
xAxisName,
|
|
67
|
+
isXaxisAxisLabelShow,
|
|
68
|
+
isXaxisAxisTickShow,
|
|
69
|
+
isXaxisAxisLabelRotate,
|
|
70
|
+
isYAxisSplitlineLinestyleWidth,
|
|
71
|
+
yAxisSplitlineLinestyleType,
|
|
72
|
+
yAxisMax,
|
|
73
|
+
yAxisMin,
|
|
74
|
+
isYAxisName,
|
|
75
|
+
yAxisName,
|
|
76
|
+
isSeriesShowSymbol,
|
|
77
|
+
isYAxisShow,
|
|
78
|
+
isUnit,
|
|
79
|
+
unit,
|
|
80
|
+
decimalDigits,
|
|
81
|
+
suffix,
|
|
82
|
+
} = opts;
|
|
82
83
|
const domRef = useRef<HTMLDivElement>();
|
|
83
84
|
useWedaChart(domRef, EchartBar, {
|
|
84
85
|
directionType,
|
|
@@ -39,10 +39,11 @@ class EchartBar extends EchartBase {
|
|
|
39
39
|
params,
|
|
40
40
|
);
|
|
41
41
|
// 获取 x 轴数据
|
|
42
|
-
const
|
|
42
|
+
const sortedXAxisData = this.sortXAxisData(arrSourData, xField.format);
|
|
43
|
+
const arrXaxisData = this.setXaxis(sortedXAxisData, xField.format);
|
|
43
44
|
const arrXisCountEmptyIndex = []; // 记录空值的key
|
|
44
|
-
if (
|
|
45
|
-
const numLine =
|
|
45
|
+
if (Object.keys(groupKey ?? {}).length === 0) {
|
|
46
|
+
const numLine = sortedXAxisData[0].YLabels.length;
|
|
46
47
|
if (numLine > 0) {
|
|
47
48
|
for (let j = 0; j < numLine; j++) {
|
|
48
49
|
this.config.series[j] = {
|
|
@@ -56,9 +57,9 @@ class EchartBar extends EchartBase {
|
|
|
56
57
|
},
|
|
57
58
|
data: [],
|
|
58
59
|
};
|
|
59
|
-
|
|
60
|
+
sortedXAxisData.forEach((itemSource,index) => {
|
|
60
61
|
this.config.series[j].name = itemSource.YLabels[j].Cn_Name;
|
|
61
|
-
if ((
|
|
62
|
+
if ((itemSource.YLabels[j].Value === undefined || itemSource.YLabels[j].Value === null) && !xIsCountEmpty) {
|
|
62
63
|
arrXisCountEmptyIndex.push(index);
|
|
63
64
|
} else {
|
|
64
65
|
const value = itemSource.YLabels[j].Value ? itemSource.YLabels[j].Value : 0;
|
|
@@ -73,7 +74,7 @@ class EchartBar extends EchartBase {
|
|
|
73
74
|
// 如果是分组,则这里需要特殊处理
|
|
74
75
|
// 按groupKey分组存放数据值
|
|
75
76
|
const objGroupKey = {}; // {'分组字段':[{value:'统计的值', dimensionality:'维度名', name:'统计的数值字段名'}]}
|
|
76
|
-
|
|
77
|
+
sortedXAxisData.forEach((itemSourData) => {
|
|
77
78
|
itemSourData.YLabels.forEach((yLabel) => {
|
|
78
79
|
if (!objGroupKey[yLabel.Group_Name]) {
|
|
79
80
|
objGroupKey[yLabel.Group_Name] = [];
|
|
@@ -188,8 +188,25 @@ class EchartBase extends AbstractEchartBaseModal {
|
|
|
188
188
|
* @param { Array<object> } arrData 后台返回的数据
|
|
189
189
|
* @param { string } formatType 类型 datetime:日期时间;date:日期,time:时间,其它
|
|
190
190
|
*/
|
|
191
|
-
protected setXaxis(
|
|
191
|
+
protected setXaxis(sortedXAxisData, formatType) {
|
|
192
192
|
const xAxisData = [];
|
|
193
|
+
if (sortedXAxisData.length > 0) {
|
|
194
|
+
sortedXAxisData.forEach((itemSource) => {
|
|
195
|
+
let value = itemSource.XLabel.Value;
|
|
196
|
+
if (formatType === 'datetime') {
|
|
197
|
+
value = this.formatTime(itemSource.XLabel.Value, 'dt');
|
|
198
|
+
} else if (formatType === 'date') {
|
|
199
|
+
value = this.formatTime(itemSource.XLabel.Value, 'd');
|
|
200
|
+
} else if (formatType === 'time') {
|
|
201
|
+
value = this.formatTime(itemSource.XLabel.Value, 't');
|
|
202
|
+
}
|
|
203
|
+
xAxisData.push(value);
|
|
204
|
+
});
|
|
205
|
+
this.config.xAxis.data = xAxisData;
|
|
206
|
+
}
|
|
207
|
+
return xAxisData;
|
|
208
|
+
}
|
|
209
|
+
protected sortXAxisData(arrData, formatType = ''): Array<any> {
|
|
193
210
|
let xFields = [...arrData];
|
|
194
211
|
if(['datetime', 'date', 'time'].includes(formatType)) {
|
|
195
212
|
xFields.sort((a, b) => {
|
|
@@ -205,21 +222,8 @@ class EchartBase extends AbstractEchartBaseModal {
|
|
|
205
222
|
}
|
|
206
223
|
});
|
|
207
224
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
let value = itemSource.XLabel.Value;
|
|
211
|
-
if (formatType === 'datetime') {
|
|
212
|
-
value = this.formatTime(itemSource.XLabel.Value, 'dt');
|
|
213
|
-
} else if (formatType === 'date') {
|
|
214
|
-
value = this.formatTime(itemSource.XLabel.Value, 'd');
|
|
215
|
-
} else if (formatType === 'time') {
|
|
216
|
-
value = this.formatTime(itemSource.XLabel.Value, 't');
|
|
217
|
-
}
|
|
218
|
-
xAxisData.push(value);
|
|
219
|
-
});
|
|
220
|
-
this.config.xAxis.data = xAxisData;
|
|
221
|
-
}
|
|
222
|
-
return xAxisData;
|
|
225
|
+
|
|
226
|
+
return xFields;
|
|
223
227
|
}
|
|
224
228
|
|
|
225
229
|
/**
|
|
@@ -38,10 +38,12 @@ class EchartLine extends EchartBase {
|
|
|
38
38
|
params,
|
|
39
39
|
);
|
|
40
40
|
// 获取 x 轴数据
|
|
41
|
-
|
|
41
|
+
|
|
42
|
+
const sortedXAxisData = this.sortXAxisData(arrSourData, xField.format);
|
|
43
|
+
const arrXaxisData = this.setXaxis(sortedXAxisData, xField.format);
|
|
42
44
|
const arrXisCountEmptyIndex = []; // 记录空值的key
|
|
43
|
-
if (
|
|
44
|
-
const numLine =
|
|
45
|
+
if (Object.keys(groupKey ?? {}).length === 0) {
|
|
46
|
+
const numLine = sortedXAxisData[0].YLabels.length;
|
|
45
47
|
if (numLine > 0) {
|
|
46
48
|
for (let j = 0; j < numLine; j++) {
|
|
47
49
|
this.config.series[j] = {
|
|
@@ -55,9 +57,9 @@ class EchartLine extends EchartBase {
|
|
|
55
57
|
},
|
|
56
58
|
data: [],
|
|
57
59
|
};
|
|
58
|
-
|
|
60
|
+
sortedXAxisData.forEach((itemSource,index) => {
|
|
59
61
|
this.config.series[j].name = itemSource.YLabels[j].Cn_Name;
|
|
60
|
-
if ((
|
|
62
|
+
if ((itemSource.YLabels[j].Value === undefined || itemSource.YLabels[j].Value === null) && !xIsCountEmpty) {
|
|
61
63
|
arrXisCountEmptyIndex.push(index);
|
|
62
64
|
} else {
|
|
63
65
|
const value = itemSource.YLabels[j].Value ? itemSource.YLabels[j].Value : 0;
|
|
@@ -72,7 +74,7 @@ class EchartLine extends EchartBase {
|
|
|
72
74
|
// 如果是分组,则这里需要特殊处理
|
|
73
75
|
// 按groupKey分组存放数据值
|
|
74
76
|
const objGroupKey = {}; // {'分组字段':[{value:'统计的值', dimensionality:'维度名', name:'统计的数值字段名'}]}
|
|
75
|
-
|
|
77
|
+
sortedXAxisData.forEach((itemSourData) => {
|
|
76
78
|
itemSourData.YLabels.forEach((yLabel) => {
|
|
77
79
|
if (!objGroupKey[yLabel.Group_Name]) {
|
|
78
80
|
objGroupKey[yLabel.Group_Name] = [];
|
|
@@ -38,45 +38,46 @@ interface PropsType extends CommonPropsType {
|
|
|
38
38
|
decimalDigits?: number;
|
|
39
39
|
suffix?: string;
|
|
40
40
|
}
|
|
41
|
-
export default function Line({
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
41
|
+
export default function Line(opts: PropsType) {
|
|
42
|
+
const {
|
|
43
|
+
id,
|
|
44
|
+
style,
|
|
45
|
+
events,
|
|
46
|
+
className,
|
|
47
|
+
children,
|
|
48
|
+
chartType,
|
|
49
|
+
isTitle,
|
|
50
|
+
title,
|
|
51
|
+
titleLocation,
|
|
52
|
+
dataSource,
|
|
53
|
+
filterData,
|
|
54
|
+
xField,
|
|
55
|
+
xStatistics,
|
|
56
|
+
xIsCountEmpty,
|
|
57
|
+
yField,
|
|
58
|
+
groupKey,
|
|
59
|
+
groupKeyTimeSpan,
|
|
60
|
+
isLegend,
|
|
61
|
+
legend,
|
|
62
|
+
legend2,
|
|
63
|
+
isXaxisName,
|
|
64
|
+
xAxisName,
|
|
65
|
+
isXaxisAxisLabelShow,
|
|
66
|
+
isXaxisAxisTickShow,
|
|
67
|
+
isXaxisAxisLabelRotate,
|
|
68
|
+
isYAxisSplitlineLinestyleWidth,
|
|
69
|
+
yAxisSplitlineLinestyleType,
|
|
70
|
+
yAxisMax,
|
|
71
|
+
yAxisMin,
|
|
72
|
+
isYAxisName,
|
|
73
|
+
yAxisName,
|
|
74
|
+
isSeriesShowSymbol,
|
|
75
|
+
isYAxisShow,
|
|
76
|
+
isUnit,
|
|
77
|
+
unit,
|
|
78
|
+
decimalDigits,
|
|
79
|
+
suffix,
|
|
80
|
+
} = opts;
|
|
80
81
|
const domRef = useRef<HTMLDivElement>();
|
|
81
82
|
useWedaChart(domRef, EChartLine, {
|
|
82
83
|
chartType,
|
|
@@ -127,20 +127,41 @@ export function customToFixed(num, digit = 0) {
|
|
|
127
127
|
return integer;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
+
/**
|
|
131
|
+
* 添加千位分隔符
|
|
132
|
+
* @param fixedString
|
|
133
|
+
* @param digit
|
|
134
|
+
*/
|
|
135
|
+
export function addDelimiter(fixedString, digit) {
|
|
136
|
+
let len = fixedString.length;
|
|
137
|
+
let result = '';
|
|
138
|
+
const decimalPoint = digit > 0 ? digit + 1 : 0;
|
|
139
|
+
for (let i = len - 1; i >= 0; i--) {
|
|
140
|
+
let stepFromTail = len - 1 - i;
|
|
141
|
+
let char = fixedString.charAt(i);
|
|
142
|
+
|
|
143
|
+
if (stepFromTail <= decimalPoint) {
|
|
144
|
+
// 小数部分不处理
|
|
145
|
+
result = char + result;
|
|
146
|
+
} else {
|
|
147
|
+
if ((stepFromTail - decimalPoint) % 3 === 0) {
|
|
148
|
+
if (char !== '-') {
|
|
149
|
+
result = ',' + result;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
result = char + result;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return result;
|
|
156
|
+
}
|
|
157
|
+
|
|
130
158
|
/**
|
|
131
159
|
* 格式化:添加千分符,四舍五入
|
|
132
160
|
* @param val
|
|
133
161
|
* @param digits
|
|
134
162
|
*/
|
|
135
163
|
const formatNumber = (val, digits = 0) => {
|
|
136
|
-
return isNaN(val)
|
|
137
|
-
? val
|
|
138
|
-
: Intl
|
|
139
|
-
? Intl.NumberFormat('en-US', {
|
|
140
|
-
maximumFractionDigits: 10,
|
|
141
|
-
minimumFractionDigits: digits,
|
|
142
|
-
}).format(+customToFixed(val, digits))
|
|
143
|
-
: val;
|
|
164
|
+
return isNaN(val) ? val : addDelimiter(customToFixed(val, digits), digits);
|
|
144
165
|
};
|
|
145
166
|
|
|
146
167
|
export default function StatisticsCard({
|