@cloudbase/weda-ui 0.2.15 → 1.0.21
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 +41 -169
- package/package.json +28 -15
- package/src/configs/components/calendar.json +78 -0
- package/src/configs/components/carousel.json +273 -0
- package/src/configs/components/chart/bar.json +724 -0
- package/src/configs/components/chart/line.json +679 -0
- package/src/configs/components/chart/pie.json +497 -0
- package/src/configs/components/chart/statisticsCard.json +379 -0
- package/src/configs/components/container.json +7 -2
- package/src/configs/components/dataView.json +154 -0
- package/src/configs/components/form/checkbox.json +97 -5
- package/src/configs/components/form/location.json +152 -0
- package/src/configs/components/form/radio.json +96 -4
- package/src/configs/components/form/select.json +245 -11
- package/src/configs/components/form/uploaderFile.json +2 -1
- package/src/configs/components/graphicCard.json +410 -0
- package/src/configs/components/image.json +7 -2
- package/src/configs/components/link.json +20 -4
- package/src/configs/components/listView.json +277 -0
- package/src/configs/components/modal.json +37 -5
- package/src/configs/components/navLayout.json +362 -0
- package/src/configs/components/navigationBar.json +59 -0
- package/src/configs/components/richtextview.json +4 -1
- package/src/configs/components/scrollVeiw.json +74 -22
- package/src/configs/components/swiper.json +6 -3
- package/src/configs/components/tabs.json +51 -8
- package/src/configs/components/text.json +33 -25
- 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 +34 -0
- package/src/mp/components/button/index.js +12 -13
- package/src/mp/components/button/index.wxml +1 -1
- package/src/mp/components/calendar/arrowright--line.svg +11 -0
- package/src/mp/components/calendar/index.js +238 -0
- package/src/mp/components/calendar/index.json +4 -0
- package/src/mp/components/calendar/index.wxml +37 -0
- package/src/mp/components/calendar/index.wxss +178 -0
- package/src/mp/components/carousel/index.js +88 -0
- package/src/mp/components/carousel/index.json +7 -0
- package/src/mp/components/carousel/index.wxml +6 -0
- package/src/mp/components/chart/bar/index.js +258 -0
- package/src/mp/components/chart/bar/index.json +6 -0
- package/src/mp/components/chart/bar/index.wxml +3 -0
- package/src/mp/components/chart/bar/index.wxss +9 -0
- package/src/mp/components/chart/common/config/bar.js +50 -0
- package/src/mp/components/chart/common/config/global.js +16 -0
- package/src/mp/components/chart/common/config/line.js +48 -0
- package/src/mp/components/chart/common/config/pie.js +36 -0
- package/src/mp/components/chart/common/core/eChartBar.js +263 -0
- package/src/mp/components/chart/common/core/eChartBase.js +375 -0
- package/src/mp/components/chart/common/core/eChartLine.js +229 -0
- package/src/mp/components/chart/common/core/eChartPie.js +166 -0
- package/src/mp/components/chart/common/lib/echarts.min.js +18 -0
- package/src/mp/components/chart/ec-canvas/ec-canvas.js +277 -0
- package/src/mp/components/chart/ec-canvas/ec-canvas.json +4 -0
- package/src/mp/components/chart/ec-canvas/ec-canvas.wxml +4 -0
- package/src/mp/components/chart/ec-canvas/ec-canvas.wxss +4 -0
- package/src/mp/components/chart/ec-canvas/wx-canvas.js +107 -0
- package/src/mp/components/chart/line/index.js +247 -0
- package/src/mp/components/chart/line/index.json +6 -0
- package/src/mp/components/chart/line/index.wxml +3 -0
- package/src/mp/components/chart/line/index.wxss +9 -0
- package/src/mp/components/chart/pie/index.js +182 -0
- package/src/mp/components/chart/pie/index.json +6 -0
- package/src/mp/components/chart/pie/index.wxml +4 -0
- package/src/mp/components/chart/pie/index.wxss +9 -0
- package/src/mp/components/chart/statisticsCard/index.js +253 -0
- package/src/mp/components/chart/statisticsCard/index.json +4 -0
- package/src/mp/components/chart/statisticsCard/index.wxml +9 -0
- package/src/mp/components/chart/statisticsCard/index.wxss +45 -0
- package/src/mp/components/dataView/index.js +34 -0
- package/src/mp/components/dataView/index.json +7 -0
- package/src/mp/components/dataView/index.wxml +15 -0
- package/src/mp/components/dataView/index.wxss +0 -0
- 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/input/index.js +1 -1
- package/src/mp/components/form/location/components/mapChoose/index.js +201 -0
- package/src/mp/components/form/location/components/mapChoose/index.json +4 -0
- package/src/mp/components/form/location/components/mapChoose/index.wxml +42 -0
- package/src/mp/components/form/location/components/mapChoose/index.wxss +188 -0
- package/src/mp/components/form/location/index.js +382 -0
- package/src/mp/components/form/location/index.json +6 -0
- package/src/mp/components/form/location/index.wxml +25 -0
- package/src/mp/components/form/location/index.wxss +91 -0
- package/src/mp/components/form/radio/index.js +38 -0
- package/src/mp/components/form/select/index.js +360 -40
- package/src/mp/components/form/select/index.wxml +21 -6
- package/src/mp/components/form/select/region/index.js +98 -0
- package/src/mp/components/form/textarea/index.wxml +6 -5
- package/src/mp/components/form/uploader/index.js +84 -48
- package/src/mp/components/form/uploader/index.wxml +15 -3
- package/src/mp/components/form/uploaderFile/index.js +106 -27
- package/src/mp/components/graphicCard/chevron-right.svg +3 -0
- package/src/mp/components/graphicCard/index.js +203 -0
- package/src/mp/components/graphicCard/index.json +4 -0
- package/src/mp/components/graphicCard/index.wxml +29 -0
- package/src/mp/components/graphicCard/index.wxss +157 -0
- package/src/mp/components/image/index.js +0 -1
- package/src/mp/components/listView/arrow-right-line.svg +3 -0
- package/src/mp/components/listView/index.js +285 -0
- package/src/mp/components/listView/index.json +4 -0
- package/src/mp/components/listView/index.wxml +40 -0
- package/src/mp/components/listView/index.wxss +155 -0
- package/src/mp/components/listView/more-line.svg +3 -0
- package/src/mp/components/navLayout/index.js +123 -0
- package/src/mp/components/navLayout/index.json +7 -0
- package/src/mp/components/navLayout/index.wxml +25 -0
- package/src/mp/components/navLayout/index.wxss +1193 -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/swiper/index.wxml +2 -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 +18 -2
- package/src/mp/style/weda-ui.wxss +2 -0
- package/src/mp/utils/debounce.js +133 -0
- package/src/mp/utils/destr.js +48 -0
- package/src/mp/utils/dr_square_point.js +25 -0
- package/src/mp/utils/platform.js +25 -0
- package/src/mp/utils/qqmap-wx-jssdk1.2/qqmap-wx-jssdk.js +1336 -0
- package/src/mp/utils/spark-md5.js +776 -0
- package/src/mp/utils/tcb.js +62 -0
- package/src/setupTests.js +2 -1
- package/src/web/components/button/index.css +8 -1
- package/src/web/components/button/index.tsx +3 -2
- package/src/web/components/calendar/index.css +382 -0
- package/src/web/components/calendar/index.jsx +312 -0
- package/src/web/components/calendar/util.js +90 -0
- package/src/web/components/carousel/index.css +119 -0
- package/src/web/components/carousel/index.tsx +417 -0
- package/src/web/components/chart/bar/index.tsx +140 -0
- package/src/web/components/chart/common/config/bar.js +49 -0
- package/src/web/components/chart/common/config/global.js +16 -0
- package/src/web/components/chart/common/config/line.js +50 -0
- package/src/web/components/chart/common/config/pie.js +37 -0
- package/src/web/components/chart/common/core/eChartBar.js +265 -0
- package/src/web/components/chart/common/core/eChartBase.ts +383 -0
- package/src/web/components/chart/common/core/eChartLine.js +231 -0
- package/src/web/components/chart/common/core/eChartPie.js +170 -0
- package/src/web/components/chart/common/core/type.ts +34 -0
- package/src/web/components/chart/common/echart.css +106 -0
- package/src/web/components/chart/common/echarts.ts +33 -0
- package/src/web/components/chart/common/useChart.tsx +69 -0
- package/src/web/components/chart/line/index.tsx +136 -0
- package/src/web/components/chart/pie/index.tsx +99 -0
- package/src/web/components/chart/statisticsCard/index.css +62 -0
- package/src/web/components/chart/statisticsCard/index.tsx +307 -0
- package/src/web/components/chart/statisticsCard/interface.ts +14 -0
- package/src/web/components/dataView/index.tsx +20 -0
- package/src/web/components/dataView/interface.ts +6 -0
- package/src/web/components/form/checkbox/index.tsx +55 -23
- package/src/web/components/form/location/common/mapChoose.css +178 -0
- package/src/web/components/form/location/common/mapChoose.jsx +343 -0
- package/src/web/components/form/location/common/mapView.jsx +190 -0
- package/src/web/components/form/location/common/propsConfig.js +54 -0
- package/src/web/components/form/location/common/selectModal.css +44 -0
- package/src/web/components/form/location/common/selectModal.jsx +82 -0
- package/src/web/components/form/location/common/useLocationInfo.js +100 -0
- package/src/web/components/form/location/components/LocationH5/index.css +243 -0
- package/src/web/components/form/location/components/LocationH5/location.h5.jsx +403 -0
- package/src/web/components/form/location/components/LocationPC/Header.jsx +109 -0
- package/src/web/components/form/location/components/LocationPC/index.css +44 -0
- package/src/web/components/form/location/components/LocationPC/location.PC.jsx +323 -0
- package/src/web/components/form/location/constants.js +4 -0
- package/src/web/components/form/location/index.css +0 -0
- package/src/web/components/form/location/index.jsx +25 -0
- package/src/web/components/form/radio/index.tsx +84 -53
- package/src/web/components/form/select/h5.tsx +389 -71
- package/src/web/components/form/select/index.css +10 -0
- package/src/web/components/form/select/index.tsx +404 -144
- package/src/web/components/form/select/region/index.ts +122 -31
- package/src/web/components/form/select/time.jsx +90 -0
- package/src/web/components/form/select/year.tsx +170 -0
- package/src/web/components/form/uploader/uploader.h5.tsx +19 -4
- package/src/web/components/form/uploader/uploader.pc.tsx +8 -7
- package/src/web/components/form/uploaderFile/uploadFile.h5.tsx +132 -113
- package/src/web/components/form/uploaderFile/uploadFile.pc.tsx +16 -11
- package/src/web/components/graphicCard/index.css +159 -0
- package/src/web/components/graphicCard/index.tsx +310 -0
- package/src/web/components/image/image.tsx +1 -2
- package/src/web/components/image/index.tsx +1 -1
- package/src/web/components/index.js +24 -2
- package/src/web/components/link/index.tsx +6 -3
- package/src/web/components/listView/arrow-right-line.svg +3 -0
- package/src/web/components/listView/index.css +143 -0
- package/src/web/components/listView/index.tsx +359 -0
- package/src/web/components/listView/interface.ts +98 -0
- package/src/web/components/modal/index.tsx +3 -1
- package/src/web/components/navLayout/index.css +332 -0
- package/src/web/components/navLayout/index.tsx +247 -0
- 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 +231 -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/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/tabs/index.tsx +4 -2
- package/src/web/components/tabs/tabs.h5.tsx +50 -37
- package/src/web/components/tabs/tabs.pc.tsx +23 -10
- package/src/web/components/text/index.tsx +6 -14
- package/src/web/components/uploaderFileView/index.css +9 -9
- package/src/web/components/uploaderFileView/index.jsx +32 -23
- package/src/web/components/userInfo/index.css +0 -0
- package/src/web/components/userInfo/index.tsx +30 -0
- package/src/web/types.d.ts +15 -14
- package/src/web/utils/debounce.js +98 -0
- package/src/web/utils/platform.js +40 -0
- package/src/web/utils/tcb.js +49 -0
- package/src/web/utils/tmap.js +4 -0
- package/src/web/weda-ui.css +2 -0
- package/CHANGELOG.md +0 -240
- package/src/.DS_Store +0 -0
- package/src/configs/.DS_Store +0 -0
- package/src/mp/.gitignore +0 -10
- package/src/web/.DS_Store +0 -0
- 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
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/schema/lcds_component.json",
|
|
3
|
+
"data": {
|
|
4
|
+
"properties": {
|
|
5
|
+
"text": {
|
|
6
|
+
"title": "按钮标题",
|
|
7
|
+
"default": "获取用户信息",
|
|
8
|
+
"type": "string",
|
|
9
|
+
"x-category": "基础属性",
|
|
10
|
+
"remarks": "按钮组件的标题",
|
|
11
|
+
"x-platforms": [
|
|
12
|
+
"MP"
|
|
13
|
+
],
|
|
14
|
+
"x-index": 1
|
|
15
|
+
},
|
|
16
|
+
"type": {
|
|
17
|
+
"title": "按钮风格",
|
|
18
|
+
"type": "string",
|
|
19
|
+
"default": "wechat",
|
|
20
|
+
"remarks": "按钮组件的风格,相对于普通按钮组件,新增“微信”按钮风格",
|
|
21
|
+
"enum": [
|
|
22
|
+
{
|
|
23
|
+
"label": "默认",
|
|
24
|
+
"value": "default"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"label": "微信",
|
|
28
|
+
"value": "wechat"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"label": "主要",
|
|
32
|
+
"value": "primary"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"label": "警告",
|
|
36
|
+
"value": "warn"
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"x-category": "基础属性",
|
|
40
|
+
"x-platforms": [
|
|
41
|
+
"MP"
|
|
42
|
+
],
|
|
43
|
+
"x-index": 2
|
|
44
|
+
},
|
|
45
|
+
"size": {
|
|
46
|
+
"title": "按钮大小",
|
|
47
|
+
"type": "string",
|
|
48
|
+
"default": "default",
|
|
49
|
+
"remarks": "按钮的大小",
|
|
50
|
+
"enum": [
|
|
51
|
+
{
|
|
52
|
+
"label": "中",
|
|
53
|
+
"value": "default"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"label": "小",
|
|
57
|
+
"value": "mini"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"label": "大",
|
|
61
|
+
"value": "large"
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
"x-category": "基础属性",
|
|
65
|
+
"x-platforms": [
|
|
66
|
+
"MP"
|
|
67
|
+
],
|
|
68
|
+
"x-index": 3
|
|
69
|
+
},
|
|
70
|
+
"usage": {
|
|
71
|
+
"title": "{{text('信息用途', help('声明获取用户个人信息的用途\\n不超过30个字符'))}}",
|
|
72
|
+
"type": "string",
|
|
73
|
+
"default": "",
|
|
74
|
+
"x-category": "基础属性",
|
|
75
|
+
"remarks": "声明获取用户个人信息的用途,不超过30个字符,若不填写将导致功能失效",
|
|
76
|
+
"required": true,
|
|
77
|
+
"x-rules": [
|
|
78
|
+
{
|
|
79
|
+
"message": "该字段必填",
|
|
80
|
+
"required": true
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"message": "不超过30个字符",
|
|
84
|
+
"pattern": "^.{0,30}$"
|
|
85
|
+
}
|
|
86
|
+
],
|
|
87
|
+
"description": "声明获取用户个人信息的用途,不超过30个字符,若不填写将导致功能失效",
|
|
88
|
+
"x-component": "textarea",
|
|
89
|
+
"x-platforms": [
|
|
90
|
+
"MP"
|
|
91
|
+
],
|
|
92
|
+
"x-index": 4
|
|
93
|
+
},
|
|
94
|
+
"language": {
|
|
95
|
+
"title": "语言",
|
|
96
|
+
"type": "string",
|
|
97
|
+
"default": "zh_CN",
|
|
98
|
+
"description": "",
|
|
99
|
+
"remarks": "用户当前国家、省份、城市所使用的语言",
|
|
100
|
+
"enum": [
|
|
101
|
+
{
|
|
102
|
+
"label": "简体中文",
|
|
103
|
+
"value": "zh_CN"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"label": "繁体中文",
|
|
107
|
+
"value": "zh_TW"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"label": "英文",
|
|
111
|
+
"value": "en"
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
"x-category": "基础属性",
|
|
115
|
+
"x-platforms": [
|
|
116
|
+
"MP"
|
|
117
|
+
],
|
|
118
|
+
"x-index": 5
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
"events": [
|
|
123
|
+
{
|
|
124
|
+
"title": "用户信息授权成功",
|
|
125
|
+
"name": "userinfosuccess",
|
|
126
|
+
"remarks": "弹窗中点击了允许按钮后触发的事件",
|
|
127
|
+
"x-platforms": [
|
|
128
|
+
"MP"
|
|
129
|
+
],
|
|
130
|
+
"detail": {
|
|
131
|
+
"avatarUrl": {
|
|
132
|
+
"type": "string",
|
|
133
|
+
"title": "用户头像",
|
|
134
|
+
"x-index": 1
|
|
135
|
+
},
|
|
136
|
+
"nickName": {
|
|
137
|
+
"type": "string",
|
|
138
|
+
"title": "微信昵称",
|
|
139
|
+
"x-index": 2
|
|
140
|
+
},
|
|
141
|
+
"language": {
|
|
142
|
+
"type": "string",
|
|
143
|
+
"title": "语言",
|
|
144
|
+
"x-index": 4
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"title": "用户信息授权失败",
|
|
150
|
+
"name": "userinfofail",
|
|
151
|
+
"remarks": "弹窗中点击了拒绝按钮后触发的事件",
|
|
152
|
+
"x-platforms": [
|
|
153
|
+
"MP"
|
|
154
|
+
]
|
|
155
|
+
}
|
|
156
|
+
],
|
|
157
|
+
"meta": {
|
|
158
|
+
"title": "获取用户信息",
|
|
159
|
+
"description": "能够在小程序运行态对用户的微信头像、微信昵称等信息进行获取。",
|
|
160
|
+
"icon": "//imgcache.qq.com/qcloud/lowcode/static/ide/left-material-icon/UserInfo.svg",
|
|
161
|
+
"category": "微信开放能力",
|
|
162
|
+
"categoryOrder": 100,
|
|
163
|
+
"componentOrder": 1,
|
|
164
|
+
"platform": [
|
|
165
|
+
"MP"
|
|
166
|
+
],
|
|
167
|
+
"visible": [
|
|
168
|
+
"APP"
|
|
169
|
+
]
|
|
170
|
+
},
|
|
171
|
+
"configMeta": {
|
|
172
|
+
"docsUrl": "https://docs.cloudbase.net/lowcode/components/wedaUI/src/docs/compsdocs/wxOpen/UserInfo"
|
|
173
|
+
}
|
|
174
|
+
}
|
package/src/configs/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import Link from './components/link.json';
|
|
|
7
7
|
// import DatePicker from './components/picker/datePicker.json';
|
|
8
8
|
// import TimePicker from './components/picker/timePicker.json';
|
|
9
9
|
import Input from './components/form/input.json';
|
|
10
|
+
import Location from './components/form/location.json';
|
|
10
11
|
import Textarea from './components/form/textarea.json';
|
|
11
12
|
import Radio from './components/form/radio.json';
|
|
12
13
|
import Checkbox from './components/form/checkbox.json';
|
|
@@ -19,6 +20,7 @@ import Uploader from './components/form/uploader.json';
|
|
|
19
20
|
import UploaderFile from './components/form/uploaderFile.json';
|
|
20
21
|
import ScrollView from './components/scrollVeiw.json';
|
|
21
22
|
import Swiper from './components/swiper.json';
|
|
23
|
+
import Carousel from './components/carousel.json';
|
|
22
24
|
// import Label from './components/form/label.json';
|
|
23
25
|
import Tips from './components/form/tips.json';
|
|
24
26
|
import Modal from './components/modal.json';
|
|
@@ -26,10 +28,26 @@ import Drawer from './components/drawer.json';
|
|
|
26
28
|
import RichText from './components/form/richText.json';
|
|
27
29
|
import RichTextView from './components/richtextview.json';
|
|
28
30
|
import Tabs from './components/tabs.json';
|
|
31
|
+
import Calendar from './components/calendar.json';
|
|
32
|
+
import NavLayout from './components/navLayout.json';
|
|
29
33
|
|
|
30
34
|
import showToast from './actions/showToast.json';
|
|
31
35
|
import showModal from './actions/showModal.json';
|
|
32
36
|
|
|
37
|
+
import ListView from './components/listView.json';
|
|
38
|
+
import NavigationBar from './components/navigationBar.json';
|
|
39
|
+
import Line from './components/chart/line.json';
|
|
40
|
+
import Bar from './components/chart/bar.json';
|
|
41
|
+
import Pie from './components/chart/pie.json';
|
|
42
|
+
|
|
43
|
+
import DataView from './components/dataView.json';
|
|
44
|
+
import StatisticsCard from './components/chart/statisticsCard.json';
|
|
45
|
+
import GraphicCard from './components/graphicCard.json';
|
|
46
|
+
import Phone from './components/wxOpenApi/phone.json';
|
|
47
|
+
import PhoneCode from './components/wxOpenApi/phoneCode.json';
|
|
48
|
+
import Share from './components/wxOpenApi/share.json';
|
|
49
|
+
import UserInfo from './components/wxOpenApi/userInfo.json';
|
|
50
|
+
|
|
33
51
|
export const components = {
|
|
34
52
|
Button,
|
|
35
53
|
Text,
|
|
@@ -44,6 +62,7 @@ export const components = {
|
|
|
44
62
|
Switch,
|
|
45
63
|
Form,
|
|
46
64
|
Textarea,
|
|
65
|
+
Location,
|
|
47
66
|
// Cells,
|
|
48
67
|
Select,
|
|
49
68
|
Auth,
|
|
@@ -52,6 +71,7 @@ export const components = {
|
|
|
52
71
|
UploaderFile,
|
|
53
72
|
ScrollView,
|
|
54
73
|
Swiper,
|
|
74
|
+
Carousel,
|
|
55
75
|
// Label,
|
|
56
76
|
Tips,
|
|
57
77
|
Modal,
|
|
@@ -60,6 +80,20 @@ export const components = {
|
|
|
60
80
|
Link,
|
|
61
81
|
Drawer,
|
|
62
82
|
Tabs,
|
|
83
|
+
Calendar,
|
|
84
|
+
ListView,
|
|
85
|
+
DataView,
|
|
86
|
+
NavLayout,
|
|
87
|
+
NavigationBar,
|
|
88
|
+
Line,
|
|
89
|
+
Bar,
|
|
90
|
+
Pie,
|
|
91
|
+
StatisticsCard,
|
|
92
|
+
GraphicCard,
|
|
93
|
+
Phone,
|
|
94
|
+
PhoneCode,
|
|
95
|
+
Share,
|
|
96
|
+
UserInfo,
|
|
63
97
|
};
|
|
64
98
|
|
|
65
99
|
export const actions = {
|
|
@@ -45,9 +45,18 @@ Component({
|
|
|
45
45
|
data: {
|
|
46
46
|
cls: '',
|
|
47
47
|
},
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
methods: {
|
|
49
|
+
...handleEvents([
|
|
50
|
+
{ title: '点击', name: 'tap' },
|
|
51
|
+
{ title: '获取手机号', name: 'getPhoneNumber' },
|
|
52
|
+
{ title: '打开客服会话', name: 'contact' },
|
|
53
|
+
{ title: '获取用户信息', name: 'getUserInfo' },
|
|
54
|
+
{ title: '打开App', name: 'launchApp' },
|
|
55
|
+
{ title: '打开授权设置', name: 'openSetting' },
|
|
56
|
+
]),
|
|
57
|
+
},
|
|
58
|
+
observers: {
|
|
59
|
+
'className,size,type,disabled': function (className, size, type, disabled) {
|
|
51
60
|
const cls = classNames('weda-ui', {
|
|
52
61
|
'weda-button': true,
|
|
53
62
|
'weui-btn': true,
|
|
@@ -63,14 +72,4 @@ Component({
|
|
|
63
72
|
this.setData({ cls });
|
|
64
73
|
},
|
|
65
74
|
},
|
|
66
|
-
methods: {
|
|
67
|
-
...handleEvents([
|
|
68
|
-
{ title: '点击', name: 'tap' },
|
|
69
|
-
{ title: '获取手机号', name: 'getPhoneNumber' },
|
|
70
|
-
{ title: '打开客服会话', name: 'contact' },
|
|
71
|
-
{ title: '获取用户信息', name: 'getUserInfo' },
|
|
72
|
-
{ title: '打开App', name: 'launchApp' },
|
|
73
|
-
{ title: '打开授权设置', name: 'openSetting' },
|
|
74
|
-
]),
|
|
75
|
-
},
|
|
76
75
|
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16px" height="16px" viewBox="0 0 16 16" version="1.1">
|
|
2
|
+
<title>chevron-right</title>
|
|
3
|
+
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
4
|
+
<g id="Icons" transform="translate(-320.000000, -951.000000)">
|
|
5
|
+
<g id="chevron-right" transform="translate(320.000000, 951.000000)">
|
|
6
|
+
<path d="M16,0 L16,16 L0,16 L0,0 L16,0 Z" id="矩形" opacity="0.600000024" transform="translate(8.000000, 8.000000) scale(-1, -1) rotate(90.000003) translate(-8.000000, -8.000000) "/>
|
|
7
|
+
<path d="M4.68942324,5.31054639 L8.22980396,8.85092687 L11.7701844,5.31054639 L12.6894235,6.2297852 L8.22980396,10.6894045 L3.77018443,6.2297852 L4.68942324,5.31054639 Z" id="路径-4-(Stroke)" fill="#000000" transform="translate(8.229804, 7.999975) scale(-1, -1) rotate(90.000003) translate(-8.229804, -7.999975) "/>
|
|
8
|
+
</g>
|
|
9
|
+
</g>
|
|
10
|
+
</g>
|
|
11
|
+
</svg>
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
// pages/calendar/calendar.js
|
|
2
|
+
import dayjs from '../../utils/dayjs.min.js';
|
|
3
|
+
// import dayjs from 'dayjs'
|
|
4
|
+
Component({
|
|
5
|
+
externalClasses: ['ext-class'],
|
|
6
|
+
/** 传入的props */
|
|
7
|
+
properties: {
|
|
8
|
+
className: {
|
|
9
|
+
type: String,
|
|
10
|
+
value: ''
|
|
11
|
+
},
|
|
12
|
+
style: {
|
|
13
|
+
type: Object,
|
|
14
|
+
value: {}
|
|
15
|
+
},
|
|
16
|
+
// 控制器显示隐藏
|
|
17
|
+
initVisible: {
|
|
18
|
+
type: String,
|
|
19
|
+
value: 'true'
|
|
20
|
+
},
|
|
21
|
+
// 初始化日历值
|
|
22
|
+
initValue: {
|
|
23
|
+
type: String,
|
|
24
|
+
value: ''
|
|
25
|
+
},
|
|
26
|
+
// 展示配置
|
|
27
|
+
configData: {
|
|
28
|
+
type: Array,
|
|
29
|
+
value: [],
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
/** 页面的初始数据 */
|
|
33
|
+
data: {
|
|
34
|
+
// 常量
|
|
35
|
+
blockName: 'weda_calendar', // 类名前缀
|
|
36
|
+
minYear: 1970, // 最早选择年份
|
|
37
|
+
firstDayOfWeek: 1, // 日历从周一开始
|
|
38
|
+
initFormat: 'YYYY-MM-DD',
|
|
39
|
+
controlSectionSize: 'medium', // 操作栏控件尺寸
|
|
40
|
+
week: ['一', '二', '三', '四', '五', '六', '日'], // 表头日历星期展示方式
|
|
41
|
+
isShowWeekend: true, // 是否显示周末
|
|
42
|
+
// 变量
|
|
43
|
+
value: null,
|
|
44
|
+
visible: true,
|
|
45
|
+
year: 0,
|
|
46
|
+
month: 0,
|
|
47
|
+
datalist: [],
|
|
48
|
+
headerlist: []
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
lifetimes: {
|
|
52
|
+
created: function () {
|
|
53
|
+
},
|
|
54
|
+
attached: function () {
|
|
55
|
+
const {initVisible, initValue} = this.properties;
|
|
56
|
+
const {firstDayOfWeek, initFormat} = this.data;
|
|
57
|
+
if (initVisible !== null) {
|
|
58
|
+
this.setData({
|
|
59
|
+
visible: initVisible
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
if (initValue !== null && initValue !== '') {
|
|
63
|
+
const value = dayjs(initValue);
|
|
64
|
+
const year = dayjs(initValue).year();
|
|
65
|
+
const month = parseInt(dayjs(initValue).format('M'), 10);
|
|
66
|
+
this.setData({
|
|
67
|
+
value,
|
|
68
|
+
year,
|
|
69
|
+
month,
|
|
70
|
+
datalist: this.getDateLis(year, month, firstDayOfWeek, value, initFormat),
|
|
71
|
+
headerlist: this.colHeaderList()
|
|
72
|
+
});
|
|
73
|
+
} else {
|
|
74
|
+
const _dayjsDate = dayjs(dayjs().format('YYYY-MM-DD'));
|
|
75
|
+
const value = _dayjsDate;
|
|
76
|
+
const year = _dayjsDate.year();
|
|
77
|
+
const month = parseInt(_dayjsDate.format('M'), 10);
|
|
78
|
+
this.setData({
|
|
79
|
+
value,
|
|
80
|
+
year,
|
|
81
|
+
month,
|
|
82
|
+
datalist: this.getDateLis(year, month, firstDayOfWeek, value, initFormat),
|
|
83
|
+
headerlist: this.colHeaderList()
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
methods: {
|
|
89
|
+
// 传入参数,修改展示列表
|
|
90
|
+
getDateLis: function (year, month, firstDayOfWeek, value, initFormat) {
|
|
91
|
+
const datalist = this.createDateList(year, month, firstDayOfWeek, value, initFormat);
|
|
92
|
+
return this._dataList(datalist);
|
|
93
|
+
},
|
|
94
|
+
// 获取一个日期是周几(1~7)
|
|
95
|
+
getDay: function (dt) {
|
|
96
|
+
let day = dayjs(dt).day();
|
|
97
|
+
if (day === 0) {
|
|
98
|
+
day = 7;
|
|
99
|
+
}
|
|
100
|
+
return day;
|
|
101
|
+
},
|
|
102
|
+
// 获取日期数组
|
|
103
|
+
createDateList: function (
|
|
104
|
+
year,
|
|
105
|
+
month,
|
|
106
|
+
firstDayOfWeek,
|
|
107
|
+
value,
|
|
108
|
+
initFormat
|
|
109
|
+
) {
|
|
110
|
+
const createCellData = (belongTo, isCurrent, date, weekOrder) => {
|
|
111
|
+
const day = this.getDay(date);
|
|
112
|
+
return {
|
|
113
|
+
mode: 'month',
|
|
114
|
+
belongTo,
|
|
115
|
+
isCurrent,
|
|
116
|
+
day,
|
|
117
|
+
weekOrder,
|
|
118
|
+
date,
|
|
119
|
+
formattedDate: dayjs(date).format(initFormat),
|
|
120
|
+
filterDate: null,
|
|
121
|
+
formattedFilterDate: null,
|
|
122
|
+
isShowWeekend: true,
|
|
123
|
+
dateDay: date.getDate(), // 用于展示的天,需要标记
|
|
124
|
+
isNow: dayjs().format(initFormat) === dayjs(date).format(initFormat), // 是否当天
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const monthFirstDay = dayjs(`${year}-${month}`);
|
|
129
|
+
const rowList = [];
|
|
130
|
+
let list = [];
|
|
131
|
+
let weekCount = 1;
|
|
132
|
+
|
|
133
|
+
// 添加上个月中会在本月显示的最后几天日期
|
|
134
|
+
// getDay(monthFirstDay.toDate()) 获取每月第一天是周几
|
|
135
|
+
const lastMonthDaysCount = (this.getDay(monthFirstDay.toDate()) - firstDayOfWeek + 7) % 7;
|
|
136
|
+
for (let i = 0; i < lastMonthDaysCount; i++) {
|
|
137
|
+
// 获取显示在当前月的日历中,上月日期数据
|
|
138
|
+
// monthFirstDay.subtract(num, 'day' | 'month' | 'year') 表示以当月第一天日期为基准,在 日|月|年 数字上减去num
|
|
139
|
+
const dayObj = monthFirstDay.subtract(i + 1, 'day');
|
|
140
|
+
list.unshift(createCellData(-1, false, dayObj.toDate(), weekCount));
|
|
141
|
+
}
|
|
142
|
+
// 添加本月日期
|
|
143
|
+
// 获取本月最后一天是几号
|
|
144
|
+
const monthDaysCount = monthFirstDay.endOf('month').daysInMonth();
|
|
145
|
+
for (let i = 0; i < monthDaysCount; i++) {
|
|
146
|
+
const dayObj = monthFirstDay.add(i, 'day');
|
|
147
|
+
list.push(createCellData(0, value.isSame(dayObj), dayObj.toDate(), weekCount));
|
|
148
|
+
if (list.length === 7) {
|
|
149
|
+
rowList.push(list);
|
|
150
|
+
list = [];
|
|
151
|
+
weekCount += 1;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// 添加下月日期
|
|
156
|
+
if (list.length) {
|
|
157
|
+
// 获取当月最后一天
|
|
158
|
+
const monthLastDay = dayjs(`${year}-${month}`).endOf('month');
|
|
159
|
+
// 获取下月在当月日历中的天数
|
|
160
|
+
const nextMonthDaysCount = 7 - list.length;
|
|
161
|
+
for (let i = 0; i < nextMonthDaysCount; i++) {
|
|
162
|
+
const dayObj = monthLastDay.add(i + 1, 'day');
|
|
163
|
+
list.push(createCellData(1, false, dayObj.toDate(), weekCount));
|
|
164
|
+
}
|
|
165
|
+
rowList.push(list);
|
|
166
|
+
}
|
|
167
|
+
return rowList;
|
|
168
|
+
},
|
|
169
|
+
// 混合数据
|
|
170
|
+
_dataList: function (configList) {
|
|
171
|
+
const {configData} = this.properties;
|
|
172
|
+
const _map = new Map();
|
|
173
|
+
for (const item of configData) {
|
|
174
|
+
_map.set(item.matchDate, item);
|
|
175
|
+
}
|
|
176
|
+
return configList.map(item => {
|
|
177
|
+
return item.reduce((res, i) => {
|
|
178
|
+
if (_map.has(i.formattedDate)) {
|
|
179
|
+
const _disabled = _map.get(i.formattedDate)['disabled'];
|
|
180
|
+
const _marked = _map.get(i.formattedDate)['marked'];
|
|
181
|
+
i['disabled'] = _disabled !== undefined ? JSON.parse(_disabled) : false;
|
|
182
|
+
i['marked'] = _marked;
|
|
183
|
+
}
|
|
184
|
+
res.push(i);
|
|
185
|
+
return res;
|
|
186
|
+
}, []);
|
|
187
|
+
});
|
|
188
|
+
},
|
|
189
|
+
// 表头数组
|
|
190
|
+
colHeaderList: function () {
|
|
191
|
+
const {week, firstDayOfWeek, isShowWeekend} = this.data;
|
|
192
|
+
const list = [];
|
|
193
|
+
for (let i = firstDayOfWeek; i <= 7; i++) {
|
|
194
|
+
if (!isShowWeekend && i > 5) {
|
|
195
|
+
break;
|
|
196
|
+
}
|
|
197
|
+
list.push({
|
|
198
|
+
day: i,
|
|
199
|
+
text: week[i - 1],
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
if (firstDayOfWeek > 1) {
|
|
203
|
+
for (let i = 1; i < firstDayOfWeek; i++) {
|
|
204
|
+
if (!isShowWeekend && i > 5) {
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
207
|
+
list.push({
|
|
208
|
+
day: i,
|
|
209
|
+
text: week[i - 1],
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return list;
|
|
214
|
+
},
|
|
215
|
+
// 上一个月
|
|
216
|
+
handlePrevMonth: function () {
|
|
217
|
+
const {year, month, firstDayOfWeek, value, initFormat} = this.data;
|
|
218
|
+
const _month = month == 1 ? 12 : month - 1;
|
|
219
|
+
const _year = month === 1 ? year - 1 : year;
|
|
220
|
+
this.setData({
|
|
221
|
+
year: _year,
|
|
222
|
+
month: _month,
|
|
223
|
+
datalist: this.getDateLis(_year, _month, firstDayOfWeek, value, initFormat)
|
|
224
|
+
});
|
|
225
|
+
},
|
|
226
|
+
// 下一个月
|
|
227
|
+
handleNextMonth: function () {
|
|
228
|
+
const {year, month, firstDayOfWeek, value, initFormat} = this.data;
|
|
229
|
+
const _month = month == 12 ? 1 : month + 1;
|
|
230
|
+
const _year = month === 12 ? year + 1 : year;
|
|
231
|
+
this.setData({
|
|
232
|
+
year: _year,
|
|
233
|
+
month: _month,
|
|
234
|
+
datalist: this.getDateLis(_year, _month, firstDayOfWeek, value, initFormat)
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<view class="{{className}} weda-calendar ext-class">
|
|
2
|
+
<view class="weda-calendar__control">
|
|
3
|
+
<view class="weda-calendar__prevMonth" wx:if="{{visible}}" bindtap="handlePrevMonth">
|
|
4
|
+
<image class="weda-calendar__prevMonth-icon" src='arrowright--line.svg' />
|
|
5
|
+
</view>
|
|
6
|
+
<view class="weda-calendar__current-date">{{year}}年{{month}}月</view>
|
|
7
|
+
<view class="weda-calendar__nextMonth" wx:if="{{visible}}" bindtap="handleNextMonth">
|
|
8
|
+
<image class="weda-calendar__nextMonth-icon" src='arrowright--line.svg' />
|
|
9
|
+
</view>
|
|
10
|
+
</view>
|
|
11
|
+
<view class="weda-calendar__panel">
|
|
12
|
+
<view class="weda-calendar__table">
|
|
13
|
+
<view class="weda-calendar__table-head">
|
|
14
|
+
<view class="weda-calendar__table-head-row">
|
|
15
|
+
<view class="weda-calendar__table-head-cell" wx:for="{{headerlist}}" wx:for-index="index" wx:for-item="item" wx:key="index">
|
|
16
|
+
{{item.text}}
|
|
17
|
+
</view>
|
|
18
|
+
</view>
|
|
19
|
+
</view>
|
|
20
|
+
<view class="weda-calendar__table-body">
|
|
21
|
+
<block wx:for="{{datalist}}" wx:for-item="dateRow" wx:key="index">
|
|
22
|
+
<view class="weda-calendar__table-body-row">
|
|
23
|
+
<block wx:for="{{dateRow}}" wx:for-item="dateCell" wx:key="index">
|
|
24
|
+
<view class="'weda-calendar__table-body-cell' {{dateCell.belongTo !== 0 ? 'is-disabled ': ''}} {{dateCell.disabled ? 'is-invalid' : ''}}{{dateCell.isNow ? 'is-now' : ''}}">
|
|
25
|
+
<view class="weda-calendar__table-body-cell-value">
|
|
26
|
+
{{dateCell.dateDay}}
|
|
27
|
+
<view class="weda-calendar__table-body-cell-bg"></view>
|
|
28
|
+
<view wx:if="{{dateCell.marked}}" class="weda-calendar__table-body-cell-marked" style="background: {{dateCell.marked}}"></view>
|
|
29
|
+
</view>
|
|
30
|
+
</view>
|
|
31
|
+
</block>
|
|
32
|
+
</view>
|
|
33
|
+
</block>
|
|
34
|
+
</view>
|
|
35
|
+
</view>
|
|
36
|
+
</view>
|
|
37
|
+
</view>
|