@cloudbase/weda-ui 0.2.17 → 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 +3 -0
- package/package.json +6 -3
- package/src/configs/components/calendar.json +4 -1
- package/src/configs/components/chart/bar.json +19 -6
- package/src/configs/components/chart/line.json +19 -6
- package/src/configs/components/chart/pie.json +14 -4
- package/src/configs/components/chart/statisticsCard.json +61 -13
- package/src/configs/components/container.json +7 -2
- package/src/configs/components/dataView.json +21 -6
- package/src/configs/components/form/checkbox.json +97 -5
- package/src/configs/components/form/radio.json +96 -4
- package/src/configs/components/form/select.json +245 -11
- package/src/configs/components/graphicCard.json +84 -73
- package/src/configs/components/image.json +7 -2
- package/src/configs/components/link.json +19 -3
- package/src/configs/components/listView.json +63 -17
- package/src/configs/components/modal.json +37 -5
- package/src/configs/components/navLayout.json +87 -75
- 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 +4 -1
- 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 +11 -0
- 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/input/index.js +1 -1
- package/src/mp/components/form/location/index.js +43 -2
- package/src/mp/components/form/radio/index.js +34 -1
- package/src/mp/components/form/select/index.js +360 -40
- package/src/mp/components/form/select/index.wxml +17 -2
- package/src/mp/components/form/select/region/index.js +98 -0
- package/src/mp/components/form/uploader/index.js +39 -27
- package/src/mp/components/form/uploaderFile/index.js +10 -6
- package/src/mp/components/listView/index.js +33 -27
- package/src/mp/components/listView/index.wxml +1 -1
- package/src/mp/components/listView/index.wxss +5 -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/{internals/listView → wxOpenApi/phone}/index.json +0 -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 -2
- package/src/mp/style/weda-ui.wxss +2 -0
- package/src/mp/utils/destr.js +48 -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 +3 -2
- package/src/web/components/chart/bar/index.tsx +40 -39
- 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 +55 -23
- package/src/web/components/form/radio/index.tsx +84 -53
- package/src/web/components/form/select/h5.tsx +388 -72
- 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 +89 -0
- package/src/web/components/form/select/year.tsx +170 -0
- package/src/web/components/form/uploader/uploader.h5.tsx +9 -2
- package/src/web/components/form/uploader/uploader.pc.tsx +4 -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.tsx +1 -1
- package/src/web/components/index.js +7 -0
- package/src/web/components/link/index.tsx +6 -3
- package/src/web/components/listView/index.css +4 -0
- package/src/web/components/listView/index.tsx +6 -1
- package/src/web/components/modal/index.tsx +3 -1
- 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 +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 +6 -14
- package/src/web/components/userInfo/index.css +0 -0
- package/src/web/components/userInfo/index.tsx +30 -0
- package/src/web/utils/platform.js +9 -0
- package/src/web/utils/tcb.js +26 -0
- package/src/web/weda-ui.css +2 -0
- 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
|
@@ -0,0 +1,167 @@
|
|
|
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
|
+
"remarks": "按钮组件的标题",
|
|
9
|
+
"type": "string",
|
|
10
|
+
"x-category": "基础属性",
|
|
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
|
+
"title": {
|
|
71
|
+
"title": "{{text('分享标题', help('分享(转发)卡片的标题'))}}",
|
|
72
|
+
"type": "string",
|
|
73
|
+
"default": "",
|
|
74
|
+
"x-category": "基础属性",
|
|
75
|
+
"description": "",
|
|
76
|
+
"remarks": "分享(转发)卡片的标题",
|
|
77
|
+
"x-component": "textarea",
|
|
78
|
+
"x-platforms": [
|
|
79
|
+
"MP"
|
|
80
|
+
],
|
|
81
|
+
"x-index": 4
|
|
82
|
+
},
|
|
83
|
+
"image": {
|
|
84
|
+
"title": "{{text('分享图片', help('分享(转发)卡片的图片'))}}",
|
|
85
|
+
"type": "string",
|
|
86
|
+
"x-component": "image",
|
|
87
|
+
"default": "",
|
|
88
|
+
"x-platforms": [
|
|
89
|
+
"MP"
|
|
90
|
+
],
|
|
91
|
+
"description": "",
|
|
92
|
+
"remarks": "分享(转发)卡片的图片",
|
|
93
|
+
"x-category": "基础属性",
|
|
94
|
+
"x-index": 5
|
|
95
|
+
},
|
|
96
|
+
"path": {
|
|
97
|
+
"type": "string",
|
|
98
|
+
"title": "{{text('选择页面', help('选择分享(转发)的页面'))}}",
|
|
99
|
+
"default": "",
|
|
100
|
+
"x-index": 6,
|
|
101
|
+
"addHidden": true,
|
|
102
|
+
"x-category": "基础属性",
|
|
103
|
+
"remarks": "选择分享(转发)的页面",
|
|
104
|
+
"x-linkages": [
|
|
105
|
+
{
|
|
106
|
+
"type": "value:state",
|
|
107
|
+
"state": {
|
|
108
|
+
"pageId": "{{$self.value}}"
|
|
109
|
+
},
|
|
110
|
+
"target": "*(params)",
|
|
111
|
+
"condition": "{{$self.value && $self.value.length>0}}"
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
"description": "",
|
|
115
|
+
"x-component": "page-list",
|
|
116
|
+
"x-component-props": {
|
|
117
|
+
"hideAddPlatform": [
|
|
118
|
+
"MP"
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
"withParams": {
|
|
123
|
+
"type": "boolean",
|
|
124
|
+
"title": "携带参数",
|
|
125
|
+
"x-category": "基础属性",
|
|
126
|
+
"default": false,
|
|
127
|
+
"remarks": "分享(转发)的页面path是否携带参数",
|
|
128
|
+
"x-index": 7,
|
|
129
|
+
"x-linkages": [
|
|
130
|
+
{
|
|
131
|
+
"type": "value:visible",
|
|
132
|
+
"target": "params",
|
|
133
|
+
"condition": "{{$self.value===true}}"
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
},
|
|
137
|
+
"params": {
|
|
138
|
+
"type": "array",
|
|
139
|
+
"title": "参数",
|
|
140
|
+
"x-category": "基础属性",
|
|
141
|
+
"remarks": "分享(转发)的页面的参数,会自动获取到当前选择页面内存在的页面参数并自动根据页面参数进行展开,当用户通过转发的链接进入小程序时,页面便会按照配置的参数进行渲染。如果采用绑定数据的方式,数据格式参考如下:[{key: 'paramKey1', value: 'paramValue1'}, {key: 'paramKey2', value: 'paramValue2'}]",
|
|
142
|
+
"pageId": "",
|
|
143
|
+
"default": [],
|
|
144
|
+
"x-index": 8,
|
|
145
|
+
"x-component": "page-params"
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
"events": [],
|
|
150
|
+
"meta": {
|
|
151
|
+
"title": "小程序分享",
|
|
152
|
+
"description": "支持快捷实现小程序分享功能。",
|
|
153
|
+
"icon": "//imgcache.qq.com/qcloud/lowcode/static/ide/left-material-icon/Share.svg",
|
|
154
|
+
"category": "微信开放能力",
|
|
155
|
+
"categoryOrder": 100,
|
|
156
|
+
"componentOrder": 3,
|
|
157
|
+
"platform": [
|
|
158
|
+
"MP"
|
|
159
|
+
],
|
|
160
|
+
"visible": [
|
|
161
|
+
"APP"
|
|
162
|
+
]
|
|
163
|
+
},
|
|
164
|
+
"configMeta": {
|
|
165
|
+
"docsUrl": "https://docs.cloudbase.net/lowcode/components/wedaUI/src/docs/compsdocs/wxOpen/Share"
|
|
166
|
+
}
|
|
167
|
+
}
|
|
@@ -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
|
@@ -35,6 +35,7 @@ import showToast from './actions/showToast.json';
|
|
|
35
35
|
import showModal from './actions/showModal.json';
|
|
36
36
|
|
|
37
37
|
import ListView from './components/listView.json';
|
|
38
|
+
import NavigationBar from './components/navigationBar.json';
|
|
38
39
|
import Line from './components/chart/line.json';
|
|
39
40
|
import Bar from './components/chart/bar.json';
|
|
40
41
|
import Pie from './components/chart/pie.json';
|
|
@@ -42,6 +43,11 @@ import Pie from './components/chart/pie.json';
|
|
|
42
43
|
import DataView from './components/dataView.json';
|
|
43
44
|
import StatisticsCard from './components/chart/statisticsCard.json';
|
|
44
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
|
+
|
|
45
51
|
export const components = {
|
|
46
52
|
Button,
|
|
47
53
|
Text,
|
|
@@ -78,11 +84,16 @@ export const components = {
|
|
|
78
84
|
ListView,
|
|
79
85
|
DataView,
|
|
80
86
|
NavLayout,
|
|
87
|
+
NavigationBar,
|
|
81
88
|
Line,
|
|
82
89
|
Bar,
|
|
83
90
|
Pie,
|
|
84
91
|
StatisticsCard,
|
|
85
92
|
GraphicCard,
|
|
93
|
+
Phone,
|
|
94
|
+
PhoneCode,
|
|
95
|
+
Share,
|
|
96
|
+
UserInfo,
|
|
86
97
|
};
|
|
87
98
|
|
|
88
99
|
export const actions = {
|
|
@@ -223,8 +223,11 @@ Component({
|
|
|
223
223
|
},
|
|
224
224
|
observers: {
|
|
225
225
|
// 当参数变化时
|
|
226
|
-
|
|
227
|
-
|
|
226
|
+
'**': async function() {
|
|
227
|
+
const objEChartBar = new EchartBar();
|
|
228
|
+
await objEChartBar.setOptions(this.properties);
|
|
229
|
+
const options = await objEChartBar.getOptions();
|
|
230
|
+
this._chart && this._chart.setOption(options);
|
|
228
231
|
},
|
|
229
232
|
},
|
|
230
233
|
methods: {
|
|
@@ -248,6 +251,7 @@ Component({
|
|
|
248
251
|
// objEchart.clear();
|
|
249
252
|
console.log('设置前参数bar', options);
|
|
250
253
|
objEchart.setOption(options);
|
|
254
|
+
this._chart = objEchart;
|
|
251
255
|
return objEchart;
|
|
252
256
|
},
|
|
253
257
|
},
|
|
@@ -21,7 +21,7 @@ class EchartBar extends EchartBase {
|
|
|
21
21
|
groupKey,
|
|
22
22
|
groupKeyTimeSpan,
|
|
23
23
|
}) {
|
|
24
|
-
xField = xField || {};
|
|
24
|
+
xField = xField || {}; // 向前兼容
|
|
25
25
|
const { name = '', type = '', methodName = '' } = dataSource;
|
|
26
26
|
if (name !== '') {
|
|
27
27
|
const params = this.createWhere({
|
|
@@ -40,9 +40,10 @@ class EchartBar extends EchartBase {
|
|
|
40
40
|
params,
|
|
41
41
|
);
|
|
42
42
|
// 获取 x 轴数据
|
|
43
|
-
const
|
|
43
|
+
const sortedXAxisData = this.sortXAxisData(arrSourData, xField.format);
|
|
44
|
+
const arrXaxisData = this.setXaxis(sortedXAxisData, xField.format);
|
|
44
45
|
const arrXisCountEmptyIndex = []; // 记录空值的key
|
|
45
|
-
if (
|
|
46
|
+
if (Object.keys(groupKey ?? {}).length === 0) { // 没有分组
|
|
46
47
|
const numLine = arrSourData[0].YLabels.length;
|
|
47
48
|
if (numLine > 0) {
|
|
48
49
|
for (let j = 0; j < numLine; j++) {
|
|
@@ -57,9 +58,9 @@ class EchartBar extends EchartBase {
|
|
|
57
58
|
stack: isPile ? 'pile' : null,
|
|
58
59
|
data: [],
|
|
59
60
|
};
|
|
60
|
-
|
|
61
|
+
sortedXAxisData.forEach((itemSource,index) => {
|
|
61
62
|
this.config.series[j].name = itemSource.YLabels[j].Cn_Name;
|
|
62
|
-
if ((!itemSource.YLabels[j].Value
|
|
63
|
+
if ((!itemSource.YLabels[j].Value === undefined || itemSource.YLabels[j].Value === null) && !xIsCountEmpty) {
|
|
63
64
|
arrXisCountEmptyIndex.push(index);
|
|
64
65
|
} else {
|
|
65
66
|
const value = itemSource.YLabels[j].Value ? itemSource.YLabels[j].Value : 0;
|
|
@@ -75,7 +76,7 @@ class EchartBar extends EchartBase {
|
|
|
75
76
|
// 如果是分组,则这里需要特殊处理
|
|
76
77
|
// 按groupKey分组存放数据值
|
|
77
78
|
const objGroupKey = {}; // {'分组字段':[{value:'统计的值', dimensionality:'维度名', name:'统计的数值字段名'}]}
|
|
78
|
-
|
|
79
|
+
sortedXAxisData.forEach((itemSourData) => {
|
|
79
80
|
itemSourData.YLabels.forEach((yLabel) => {
|
|
80
81
|
if (!objGroupKey[yLabel.Group_Name]) {
|
|
81
82
|
objGroupKey[yLabel.Group_Name] = [];
|
|
@@ -150,7 +151,7 @@ class EchartBar extends EchartBase {
|
|
|
150
151
|
itemSeries.label.formatter = (params) => {
|
|
151
152
|
const objNewValue = this.getValueByUnit(params.value, unit);
|
|
152
153
|
return (
|
|
153
|
-
`${objNewValue.toFixed(decimalDigits)}${
|
|
154
|
+
`${objNewValue.toFixed(decimalDigits)}${suffix}`
|
|
154
155
|
);
|
|
155
156
|
};
|
|
156
157
|
}
|
|
@@ -158,7 +159,7 @@ class EchartBar extends EchartBase {
|
|
|
158
159
|
if (isUnit) {
|
|
159
160
|
this.config.yAxis.axisLabel.formatter = (value) => {
|
|
160
161
|
const objNewValue = this.getValueByUnit(value, unit);
|
|
161
|
-
return `${objNewValue.toFixed(decimalDigits)}${
|
|
162
|
+
return `${objNewValue.toFixed(decimalDigits)}${suffix}`;
|
|
162
163
|
};
|
|
163
164
|
} else {
|
|
164
165
|
this.config.yAxis.axisLabel.formatter = null;
|
|
@@ -180,8 +180,26 @@ class EchartBase {
|
|
|
180
180
|
* @param { Array<object> } arrData 后台返回的数据
|
|
181
181
|
* @param { string } formatType 类型 datetime:日期时间;date:日期,time:时间,其它
|
|
182
182
|
*/
|
|
183
|
-
setXaxis(
|
|
183
|
+
setXaxis(sortedXAxisData, formatType = '') {
|
|
184
184
|
const xAxisData = [];
|
|
185
|
+
if (sortedXAxisData.length > 0) {
|
|
186
|
+
sortedXAxisData.forEach((itemSource) => {
|
|
187
|
+
let value = itemSource.XLabel.Value;
|
|
188
|
+
if (formatType === 'datetime') {
|
|
189
|
+
value = this.formatTime(itemSource.XLabel.Value, 'dt');
|
|
190
|
+
} else if (formatType === 'date') {
|
|
191
|
+
value = this.formatTime(itemSource.XLabel.Value, 'd');
|
|
192
|
+
} else if (formatType === 'time') {
|
|
193
|
+
value = this.formatTime(itemSource.XLabel.Value, 't');
|
|
194
|
+
}
|
|
195
|
+
xAxisData.push(value);
|
|
196
|
+
});
|
|
197
|
+
this.config.xAxis.data = xAxisData;
|
|
198
|
+
}
|
|
199
|
+
return xAxisData;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
sortXAxisData(arrData, formatType = '') {
|
|
185
203
|
let xFields = [...arrData];
|
|
186
204
|
if(['datetime', 'date', 'time'].includes(formatType)) {
|
|
187
205
|
xFields.sort((a, b) => {
|
|
@@ -197,21 +215,7 @@ class EchartBase {
|
|
|
197
215
|
}
|
|
198
216
|
});
|
|
199
217
|
}
|
|
200
|
-
|
|
201
|
-
xFields.forEach((itemSource) => {
|
|
202
|
-
let value = itemSource.XLabel.Value;
|
|
203
|
-
if (formatType === 'datetime') {
|
|
204
|
-
value = this.formatTime(itemSource.XLabel.Value, 'dt');
|
|
205
|
-
} else if (formatType === 'date') {
|
|
206
|
-
value = this.formatTime(itemSource.XLabel.Value, 'd');
|
|
207
|
-
} else if (formatType === 'time') {
|
|
208
|
-
value = this.formatTime(itemSource.XLabel.Value, 't');
|
|
209
|
-
}
|
|
210
|
-
xAxisData.push(value);
|
|
211
|
-
});
|
|
212
|
-
this.config.xAxis.data = xAxisData;
|
|
213
|
-
}
|
|
214
|
-
return xAxisData;
|
|
218
|
+
return xFields;
|
|
215
219
|
}
|
|
216
220
|
|
|
217
221
|
/**
|
|
@@ -39,9 +39,10 @@ class EchartLine 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
|
+
if (Object.keys(groupKey ?? {}).length === 0) {
|
|
45
46
|
const numLine = arrSourData[0].YLabels.length;
|
|
46
47
|
if (numLine > 0) {
|
|
47
48
|
for (let j = 0; j < numLine; j++) {
|
|
@@ -56,9 +57,9 @@ class EchartLine 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 ((!itemSource.YLabels[j].Value
|
|
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 EchartLine 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] = [];
|
|
@@ -210,12 +210,6 @@ Component({
|
|
|
210
210
|
detached() {
|
|
211
211
|
// 在组件实例被从页面节点树移除时执行
|
|
212
212
|
},
|
|
213
|
-
observers: {
|
|
214
|
-
// 当参数变化时
|
|
215
|
-
option() {
|
|
216
|
-
this.initData();
|
|
217
|
-
},
|
|
218
|
-
},
|
|
219
213
|
methods: {
|
|
220
214
|
initData() {
|
|
221
215
|
this.setData({
|
|
@@ -237,7 +231,17 @@ Component({
|
|
|
237
231
|
// objEchart.clear();
|
|
238
232
|
console.log('设置前参数line', options);
|
|
239
233
|
objEchart.setOption(options);
|
|
234
|
+
this._chart = objEchart;
|
|
240
235
|
return objEchart;
|
|
241
236
|
},
|
|
242
237
|
},
|
|
238
|
+
observers: {
|
|
239
|
+
// 当参数变化时
|
|
240
|
+
'**': async function() {
|
|
241
|
+
const objEChartLine = new EchartLine();
|
|
242
|
+
await objEChartLine.setOptions(this.properties);
|
|
243
|
+
const options = objEChartLine.getOptions();
|
|
244
|
+
this._chart && this._chart.setOption(options);
|
|
245
|
+
},
|
|
246
|
+
}
|
|
243
247
|
});
|
|
@@ -147,8 +147,11 @@ Component({
|
|
|
147
147
|
},
|
|
148
148
|
observers: {
|
|
149
149
|
// 当参数变化时
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
'**': async function() {
|
|
151
|
+
const objEChartPie = new EchartPie();
|
|
152
|
+
await objEChartPie.setOptions(this.properties);
|
|
153
|
+
const options = await objEChartPie.getOptions();
|
|
154
|
+
this._chart && this._chart.setOption(options);
|
|
152
155
|
},
|
|
153
156
|
},
|
|
154
157
|
methods: {
|
|
@@ -172,6 +175,7 @@ Component({
|
|
|
172
175
|
// objEchart.clear();
|
|
173
176
|
console.log('设置前参数pie', options);
|
|
174
177
|
objEchart.setOption(options);
|
|
178
|
+
this._chart = objEchart;
|
|
175
179
|
return objEchart;
|
|
176
180
|
},
|
|
177
181
|
},
|
|
@@ -108,15 +108,32 @@ Component({
|
|
|
108
108
|
}
|
|
109
109
|
return integer;
|
|
110
110
|
},
|
|
111
|
+
addDelimiter: function (fixedString, digit) {
|
|
112
|
+
let len = fixedString.length;
|
|
113
|
+
let result = '';
|
|
114
|
+
const decimalPoint = digit > 0 ? digit + 1 : 0;
|
|
115
|
+
for (let i = len - 1; i >= 0; i--) {
|
|
116
|
+
let stepFromTail = len - 1 - i;
|
|
117
|
+
let char = fixedString.charAt(i);
|
|
118
|
+
|
|
119
|
+
if (stepFromTail <= decimalPoint) {
|
|
120
|
+
// 小数部分不处理
|
|
121
|
+
result = char + result;
|
|
122
|
+
} else {
|
|
123
|
+
if ((stepFromTail - decimalPoint) % 3 === 0) {
|
|
124
|
+
if (char !== '-') {
|
|
125
|
+
result = ',' + result;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
result = char + result;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return result;
|
|
132
|
+
},
|
|
111
133
|
formatNumber: function (val, digits = 0) {
|
|
112
134
|
return isNaN(val)
|
|
113
135
|
? val
|
|
114
|
-
:
|
|
115
|
-
? Intl.NumberFormat('en-US', {
|
|
116
|
-
maximumFractionDigits: 10,
|
|
117
|
-
minimumFractionDigits: digits,
|
|
118
|
-
}).format(this.customToFixed(val, digits))
|
|
119
|
-
: val;
|
|
136
|
+
: this.addDelimiter(this.customToFixed(val, digits), digits);
|
|
120
137
|
},
|
|
121
138
|
getSourceData: async function (
|
|
122
139
|
dataSource,
|
|
@@ -223,4 +240,14 @@ Component({
|
|
|
223
240
|
this._fetchData();
|
|
224
241
|
},
|
|
225
242
|
},
|
|
243
|
+
attached() {
|
|
244
|
+
this._fetchData();
|
|
245
|
+
},
|
|
246
|
+
observers: {
|
|
247
|
+
// 当参数变化时
|
|
248
|
+
'datasource,filterData,field,operationType,label,isCountEmpty,isShowUnit,unit,decimalDigits,suffix':
|
|
249
|
+
function () {
|
|
250
|
+
this._fetchData();
|
|
251
|
+
},
|
|
252
|
+
},
|
|
226
253
|
});
|