@cloudbase/weda-ui 2.0.8 → 2.0.11
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/package.json +9 -2
- package/src/mp/components/button/index.js +1 -1
- package/src/mp/components/button/index.wxml +19 -19
- package/src/mp/components/calendar/index.js +64 -37
- package/src/mp/components/calendar/index.wxml +28 -8
- package/src/mp/components/carousel/index.wxml +30 -3
- package/src/mp/components/chart/bar/index.js +1 -2
- package/src/mp/components/chart/bar/index.wxml +7 -2
- package/src/mp/components/chart/common/config/bar.js +1 -1
- package/src/mp/components/chart/common/core/eChartBar.js +29 -34
- package/src/mp/components/chart/common/core/eChartBase.js +46 -32
- package/src/mp/components/chart/common/core/eChartLine.js +34 -40
- package/src/mp/components/chart/common/core/eChartPie.js +12 -9
- package/src/mp/components/chart/ec-canvas/ec-canvas.wxml +19 -2
- package/src/mp/components/chart/ec-canvas/wx-canvas.js +24 -22
- package/src/mp/components/chart/line/index.js +2 -2
- package/src/mp/components/chart/line/index.wxml +7 -2
- package/src/mp/components/chart/pie/index.js +1 -1
- package/src/mp/components/chart/pie/index.wxml +7 -3
- package/src/mp/components/chart/statisticsCard/index.wxml +5 -1
- package/src/mp/components/dataView/index.wxml +2 -2
- package/src/mp/components/form/checkbox/index.js +10 -6
- package/src/mp/components/form/checkbox/index.wxml +26 -23
- package/src/mp/components/form/form/index.wxml +3 -3
- package/src/mp/components/form/formcell/index.wxml +9 -9
- package/src/mp/components/form/formcell/index.wxss +1 -1
- package/src/mp/components/form/input/index.js +3 -3
- package/src/mp/components/form/input/index.wxml +36 -30
- package/src/mp/components/form/input/index.wxss +2 -2
- package/src/mp/components/form/location/components/mapChoose/index.wxml +59 -12
- package/src/mp/components/form/location/index.wxml +39 -7
- package/src/mp/components/form/radio/index.js +9 -5
- package/src/mp/components/form/radio/index.wxml +23 -23
- package/src/mp/components/form/select/index.js +156 -97
- package/src/mp/components/form/select/index.wxml +39 -37
- package/src/mp/components/form/select/index.wxss +5 -3
- package/src/mp/components/form/select/region/index.js +18 -12
- package/src/mp/components/form/switch/index.wxml +20 -16
- package/src/mp/components/form/textarea/index.wxml +12 -8
- package/src/mp/components/form/tips/index.wxml +1 -3
- package/src/mp/components/form/uploader/index.js +1 -1
- package/src/mp/components/form/uploader/index.wxml +19 -18
- package/src/mp/components/form/uploader/weui-uploader.js +210 -200
- package/src/mp/components/form/uploader/weui-uploader.wxml +81 -38
- package/src/mp/components/form/uploaderFile/index.js +5 -4
- package/src/mp/components/form/uploaderFile/index.wxml +97 -41
- package/src/mp/components/graphicCard/index.js +26 -24
- package/src/mp/components/graphicCard/index.wxml +30 -6
- package/src/mp/components/image/index.wxml +25 -18
- package/src/mp/components/image/index.wxss +3 -1
- package/src/mp/components/listView/index.wxml +34 -11
- package/src/mp/components/lottery/index.wxml +29 -7
- package/src/mp/components/lottery/index.wxss +31 -25
- package/src/mp/components/navLayout/index.wxml +29 -7
- package/src/mp/components/navigationBar/index.wxml +162 -53
- package/src/mp/components/swiper/index.wxml +12 -7
- package/src/mp/components/tabs/index.js +14 -10
- package/src/mp/components/tabs/index.wxml +2 -1
- package/src/mp/components/text/index.wxml +2 -1
- package/src/mp/components/text/index.wxss +1 -1
- package/src/mp/components/wxOpenApi/phone/index.wxml +11 -12
- package/src/mp/components/wxOpenApi/phoneCode/index.wxml +11 -12
- package/src/mp/components/wxOpenApi/share/index.wxml +11 -12
- package/src/mp/components/wxOpenApi/userInfo/index.wxml +10 -11
- package/src/mp/style/weda-ui.wxss +8 -3
- package/src/mp/utils/deepEqual.js +37 -37
- package/src/mp/utils/destr.js +41 -40
- package/src/mp/utils/dr_square_point.js +10 -6
- package/src/setupTests.js +13 -13
- package/src/web/components/button/index.tsx +44 -40
- package/src/web/components/carousel/index.tsx +1 -1
- package/src/web/components/chart/common/config/bar.js +1 -1
- package/src/web/components/chart/common/core/eChartBar.js +28 -34
- package/src/web/components/chart/common/core/eChartLine.js +34 -40
- package/src/web/components/chart/common/core/eChartPie.js +12 -9
- package/src/web/components/form/form/index.tsx +5 -5
- package/src/web/components/form/formcell/index.css +5 -1
- package/src/web/components/form/formcell/index.tsx +1 -1
- package/src/web/components/form/select/h5.tsx +154 -103
- package/src/web/components/form/select/index.css +3 -0
- package/src/web/components/form/textarea/index.tsx +1 -1
- package/src/web/components/form/uploader/uploader.h5.tsx +26 -20
- package/src/web/components/image/index.css +2 -2
- package/src/web/components/image/index.tsx +1 -1
- package/src/web/components/link/index.tsx +1 -1
- package/src/web/components/navLayout/index.tsx +1 -1
- package/src/web/components/navigationBar/index.tsx +2 -2
- package/src/web/components/picker/timePicker.tsx +1 -1
- package/src/web/components/text/index.tsx +13 -14
- package/src/web/utils/isObjectEqual.js +2 -1
- package/src/web/weda-ui.css +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/weda-ui",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.11",
|
|
4
4
|
"main": "./src/index.js",
|
|
5
5
|
"module": "./src/index",
|
|
6
6
|
"miniprogram": "mpdist",
|
|
@@ -112,11 +112,13 @@
|
|
|
112
112
|
"cross-env": "^7.0.3",
|
|
113
113
|
"cypress": "~9.5.1",
|
|
114
114
|
"eslint": "^8.9.0",
|
|
115
|
+
"eslint-config-prettier": "^8.5.0",
|
|
115
116
|
"eslint-config-tencent": "^1.0.3",
|
|
116
117
|
"eslint-import-resolver-typescript": "^2.7.1",
|
|
117
118
|
"eslint-plugin-cypress": "^2.12.1",
|
|
118
119
|
"eslint-plugin-import": "^2.26.0",
|
|
119
120
|
"eslint-plugin-jest": "^26.1.2",
|
|
121
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
120
122
|
"eslint-plugin-react": "^7.28.0",
|
|
121
123
|
"eslint-plugin-rulesdir": "^0.2.1",
|
|
122
124
|
"husky": "^7.0.4",
|
|
@@ -125,6 +127,7 @@
|
|
|
125
127
|
"less": "^4.1.2",
|
|
126
128
|
"miniprogram-simulate": "^1.4.3",
|
|
127
129
|
"nano-staged": "^0.5.0",
|
|
130
|
+
"prettier": "^2.6.2",
|
|
128
131
|
"react": "^17.0.2",
|
|
129
132
|
"react-dom": "^17.0.2",
|
|
130
133
|
"react-scripts": "^4.0.3",
|
|
@@ -142,7 +145,11 @@
|
|
|
142
145
|
},
|
|
143
146
|
"nano-staged": {
|
|
144
147
|
"*.{js,jsx,ts,tsx}": [
|
|
145
|
-
"eslint --fix"
|
|
148
|
+
"eslint --fix",
|
|
149
|
+
"prettier --write"
|
|
150
|
+
],
|
|
151
|
+
"*.{json,html,wxml,wxss}": [
|
|
152
|
+
"prettier -w"
|
|
146
153
|
]
|
|
147
154
|
},
|
|
148
155
|
"size-limit": [
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
<button
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
2
|
+
class="{{cls}}"
|
|
3
|
+
style="{{style}}"
|
|
4
|
+
size="{{size}}"
|
|
5
|
+
loading="{{loading}}"
|
|
6
|
+
disabled="{{disabled}}"
|
|
7
|
+
open-type="{{openType}}"
|
|
8
|
+
form-type="{{formType}}"
|
|
9
|
+
bind:tap="tap"
|
|
10
|
+
bindcontact="contact"
|
|
11
|
+
bindlaunchapp="launchApp"
|
|
12
|
+
bindopensetting="openSetting"
|
|
13
|
+
session-from="{{sessionFrom}}"
|
|
14
|
+
send-message-title="{{sendMessageTitle}}"
|
|
15
|
+
send-message-path="{{sendMessagePath}}"
|
|
16
|
+
send-message-img="{{sendMessageImg}}"
|
|
17
|
+
show-message-card="{{showMessageCard}}"
|
|
18
|
+
app-parameter="{{appParameter}}"
|
|
19
19
|
>
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
<block>{{text ? text : ''}}</block>
|
|
21
|
+
<slot name="contentSlot" wx:if="{{!text}}" />
|
|
22
22
|
</button>
|
|
@@ -7,27 +7,27 @@ Component({
|
|
|
7
7
|
properties: {
|
|
8
8
|
className: {
|
|
9
9
|
type: String,
|
|
10
|
-
value: ''
|
|
10
|
+
value: '',
|
|
11
11
|
},
|
|
12
12
|
style: {
|
|
13
13
|
type: Object,
|
|
14
|
-
value: {}
|
|
14
|
+
value: {},
|
|
15
15
|
},
|
|
16
16
|
// 控制器显示隐藏
|
|
17
17
|
initVisible: {
|
|
18
18
|
type: String,
|
|
19
|
-
value: 'true'
|
|
19
|
+
value: 'true',
|
|
20
20
|
},
|
|
21
21
|
// 初始化日历值
|
|
22
22
|
initValue: {
|
|
23
23
|
type: String,
|
|
24
|
-
value: ''
|
|
24
|
+
value: '',
|
|
25
25
|
},
|
|
26
26
|
// 展示配置
|
|
27
27
|
configData: {
|
|
28
28
|
type: Array,
|
|
29
29
|
value: [],
|
|
30
|
-
}
|
|
30
|
+
},
|
|
31
31
|
},
|
|
32
32
|
/** 页面的初始数据 */
|
|
33
33
|
data: {
|
|
@@ -45,18 +45,17 @@ Component({
|
|
|
45
45
|
year: 0,
|
|
46
46
|
month: 0,
|
|
47
47
|
datalist: [],
|
|
48
|
-
headerlist: []
|
|
48
|
+
headerlist: [],
|
|
49
49
|
},
|
|
50
50
|
|
|
51
51
|
lifetimes: {
|
|
52
|
-
created: function () {
|
|
53
|
-
},
|
|
52
|
+
created: function () {},
|
|
54
53
|
attached: function () {
|
|
55
|
-
const {initVisible, initValue} = this.properties;
|
|
56
|
-
const {firstDayOfWeek, initFormat} = this.data;
|
|
54
|
+
const { initVisible, initValue } = this.properties;
|
|
55
|
+
const { firstDayOfWeek, initFormat } = this.data;
|
|
57
56
|
if (initVisible !== null) {
|
|
58
57
|
this.setData({
|
|
59
|
-
visible: initVisible
|
|
58
|
+
visible: initVisible,
|
|
60
59
|
});
|
|
61
60
|
}
|
|
62
61
|
if (initValue !== null && initValue !== '') {
|
|
@@ -67,8 +66,14 @@ Component({
|
|
|
67
66
|
value,
|
|
68
67
|
year,
|
|
69
68
|
month,
|
|
70
|
-
datalist: this.getDateLis(
|
|
71
|
-
|
|
69
|
+
datalist: this.getDateLis(
|
|
70
|
+
year,
|
|
71
|
+
month,
|
|
72
|
+
firstDayOfWeek,
|
|
73
|
+
value,
|
|
74
|
+
initFormat
|
|
75
|
+
),
|
|
76
|
+
headerlist: this.colHeaderList(),
|
|
72
77
|
});
|
|
73
78
|
} else {
|
|
74
79
|
const _dayjsDate = dayjs(dayjs().format('YYYY-MM-DD'));
|
|
@@ -79,16 +84,28 @@ Component({
|
|
|
79
84
|
value,
|
|
80
85
|
year,
|
|
81
86
|
month,
|
|
82
|
-
datalist: this.getDateLis(
|
|
83
|
-
|
|
87
|
+
datalist: this.getDateLis(
|
|
88
|
+
year,
|
|
89
|
+
month,
|
|
90
|
+
firstDayOfWeek,
|
|
91
|
+
value,
|
|
92
|
+
initFormat
|
|
93
|
+
),
|
|
94
|
+
headerlist: this.colHeaderList(),
|
|
84
95
|
});
|
|
85
96
|
}
|
|
86
|
-
}
|
|
97
|
+
},
|
|
87
98
|
},
|
|
88
99
|
methods: {
|
|
89
100
|
// 传入参数,修改展示列表
|
|
90
101
|
getDateLis: function (year, month, firstDayOfWeek, value, initFormat) {
|
|
91
|
-
const datalist = this.createDateList(
|
|
102
|
+
const datalist = this.createDateList(
|
|
103
|
+
year,
|
|
104
|
+
month,
|
|
105
|
+
firstDayOfWeek,
|
|
106
|
+
value,
|
|
107
|
+
initFormat
|
|
108
|
+
);
|
|
92
109
|
return this._dataList(datalist);
|
|
93
110
|
},
|
|
94
111
|
// 获取一个日期是周几(1~7)
|
|
@@ -100,13 +117,7 @@ Component({
|
|
|
100
117
|
return day;
|
|
101
118
|
},
|
|
102
119
|
// 获取日期数组
|
|
103
|
-
createDateList: function (
|
|
104
|
-
year,
|
|
105
|
-
month,
|
|
106
|
-
firstDayOfWeek,
|
|
107
|
-
value,
|
|
108
|
-
initFormat
|
|
109
|
-
) {
|
|
120
|
+
createDateList: function (year, month, firstDayOfWeek, value, initFormat) {
|
|
110
121
|
const createCellData = (belongTo, isCurrent, date, weekOrder) => {
|
|
111
122
|
const day = this.getDay(date);
|
|
112
123
|
return {
|
|
@@ -132,7 +143,8 @@ Component({
|
|
|
132
143
|
|
|
133
144
|
// 添加上个月中会在本月显示的最后几天日期
|
|
134
145
|
// getDay(monthFirstDay.toDate()) 获取每月第一天是周几
|
|
135
|
-
const lastMonthDaysCount =
|
|
146
|
+
const lastMonthDaysCount =
|
|
147
|
+
(this.getDay(monthFirstDay.toDate()) - firstDayOfWeek + 7) % 7;
|
|
136
148
|
for (let i = 0; i < lastMonthDaysCount; i++) {
|
|
137
149
|
// 获取显示在当前月的日历中,上月日期数据
|
|
138
150
|
// monthFirstDay.subtract(num, 'day' | 'month' | 'year') 表示以当月第一天日期为基准,在 日|月|年 数字上减去num
|
|
@@ -144,7 +156,9 @@ Component({
|
|
|
144
156
|
const monthDaysCount = monthFirstDay.endOf('month').daysInMonth();
|
|
145
157
|
for (let i = 0; i < monthDaysCount; i++) {
|
|
146
158
|
const dayObj = monthFirstDay.add(i, 'day');
|
|
147
|
-
list.push(
|
|
159
|
+
list.push(
|
|
160
|
+
createCellData(0, value.isSame(dayObj), dayObj.toDate(), weekCount)
|
|
161
|
+
);
|
|
148
162
|
if (list.length === 7) {
|
|
149
163
|
rowList.push(list);
|
|
150
164
|
list = [];
|
|
@@ -168,17 +182,18 @@ Component({
|
|
|
168
182
|
},
|
|
169
183
|
// 混合数据
|
|
170
184
|
_dataList: function (configList) {
|
|
171
|
-
const {configData} = this.properties;
|
|
185
|
+
const { configData } = this.properties;
|
|
172
186
|
const _map = new Map();
|
|
173
187
|
for (const item of configData) {
|
|
174
188
|
_map.set(item.matchDate, item);
|
|
175
189
|
}
|
|
176
|
-
return configList.map(item => {
|
|
190
|
+
return configList.map((item) => {
|
|
177
191
|
return item.reduce((res, i) => {
|
|
178
192
|
if (_map.has(i.formattedDate)) {
|
|
179
193
|
const _disabled = _map.get(i.formattedDate)['disabled'];
|
|
180
194
|
const _marked = _map.get(i.formattedDate)['marked'];
|
|
181
|
-
i['disabled'] =
|
|
195
|
+
i['disabled'] =
|
|
196
|
+
_disabled !== undefined ? JSON.parse(_disabled) : false;
|
|
182
197
|
i['marked'] = _marked;
|
|
183
198
|
}
|
|
184
199
|
res.push(i);
|
|
@@ -188,7 +203,7 @@ Component({
|
|
|
188
203
|
},
|
|
189
204
|
// 表头数组
|
|
190
205
|
colHeaderList: function () {
|
|
191
|
-
const {week, firstDayOfWeek, isShowWeekend} = this.data;
|
|
206
|
+
const { week, firstDayOfWeek, isShowWeekend } = this.data;
|
|
192
207
|
const list = [];
|
|
193
208
|
for (let i = firstDayOfWeek; i <= 7; i++) {
|
|
194
209
|
if (!isShowWeekend && i > 5) {
|
|
@@ -214,25 +229,37 @@ Component({
|
|
|
214
229
|
},
|
|
215
230
|
// 上一个月
|
|
216
231
|
handlePrevMonth: function () {
|
|
217
|
-
const {year, month, firstDayOfWeek, value, initFormat} = this.data;
|
|
232
|
+
const { year, month, firstDayOfWeek, value, initFormat } = this.data;
|
|
218
233
|
const _month = month == 1 ? 12 : month - 1;
|
|
219
234
|
const _year = month === 1 ? year - 1 : year;
|
|
220
235
|
this.setData({
|
|
221
236
|
year: _year,
|
|
222
237
|
month: _month,
|
|
223
|
-
datalist: this.getDateLis(
|
|
238
|
+
datalist: this.getDateLis(
|
|
239
|
+
_year,
|
|
240
|
+
_month,
|
|
241
|
+
firstDayOfWeek,
|
|
242
|
+
value,
|
|
243
|
+
initFormat
|
|
244
|
+
),
|
|
224
245
|
});
|
|
225
246
|
},
|
|
226
247
|
// 下一个月
|
|
227
248
|
handleNextMonth: function () {
|
|
228
|
-
const {year, month, firstDayOfWeek, value, initFormat} = this.data;
|
|
249
|
+
const { year, month, firstDayOfWeek, value, initFormat } = this.data;
|
|
229
250
|
const _month = month == 12 ? 1 : month + 1;
|
|
230
251
|
const _year = month === 12 ? year + 1 : year;
|
|
231
252
|
this.setData({
|
|
232
253
|
year: _year,
|
|
233
254
|
month: _month,
|
|
234
|
-
datalist: this.getDateLis(
|
|
235
|
-
|
|
236
|
-
|
|
255
|
+
datalist: this.getDateLis(
|
|
256
|
+
_year,
|
|
257
|
+
_month,
|
|
258
|
+
firstDayOfWeek,
|
|
259
|
+
value,
|
|
260
|
+
initFormat
|
|
261
|
+
),
|
|
262
|
+
});
|
|
263
|
+
},
|
|
237
264
|
},
|
|
238
|
-
});
|
|
265
|
+
});
|
|
@@ -1,18 +1,32 @@
|
|
|
1
1
|
<view class="{{className}} weda-calendar ext-class">
|
|
2
2
|
<view class="weda-calendar__control">
|
|
3
|
-
<view
|
|
4
|
-
|
|
3
|
+
<view
|
|
4
|
+
class="weda-calendar__prevMonth"
|
|
5
|
+
wx:if="{{visible}}"
|
|
6
|
+
bindtap="handlePrevMonth"
|
|
7
|
+
>
|
|
8
|
+
<image class="weda-calendar__prevMonth-icon" src="arrowright--line.svg" />
|
|
5
9
|
</view>
|
|
6
10
|
<view class="weda-calendar__current-date">{{year}}年{{month}}月</view>
|
|
7
|
-
<view
|
|
8
|
-
|
|
11
|
+
<view
|
|
12
|
+
class="weda-calendar__nextMonth"
|
|
13
|
+
wx:if="{{visible}}"
|
|
14
|
+
bindtap="handleNextMonth"
|
|
15
|
+
>
|
|
16
|
+
<image class="weda-calendar__nextMonth-icon" src="arrowright--line.svg" />
|
|
9
17
|
</view>
|
|
10
18
|
</view>
|
|
11
19
|
<view class="weda-calendar__panel">
|
|
12
20
|
<view class="weda-calendar__table">
|
|
13
21
|
<view class="weda-calendar__table-head">
|
|
14
22
|
<view class="weda-calendar__table-head-row">
|
|
15
|
-
<view
|
|
23
|
+
<view
|
|
24
|
+
class="weda-calendar__table-head-cell"
|
|
25
|
+
wx:for="{{headerlist}}"
|
|
26
|
+
wx:for-index="index"
|
|
27
|
+
wx:for-item="item"
|
|
28
|
+
wx:key="index"
|
|
29
|
+
>
|
|
16
30
|
{{item.text}}
|
|
17
31
|
</view>
|
|
18
32
|
</view>
|
|
@@ -21,11 +35,17 @@
|
|
|
21
35
|
<block wx:for="{{datalist}}" wx:for-item="dateRow" wx:key="index">
|
|
22
36
|
<view class="weda-calendar__table-body-row">
|
|
23
37
|
<block wx:for="{{dateRow}}" wx:for-item="dateCell" wx:key="index">
|
|
24
|
-
<view
|
|
38
|
+
<view
|
|
39
|
+
class="'weda-calendar__table-body-cell' {{dateCell.belongTo !== 0 ? 'is-disabled ': ''}} {{dateCell.disabled ? 'is-invalid' : ''}}{{dateCell.isNow ? 'is-now' : ''}}"
|
|
40
|
+
>
|
|
25
41
|
<view class="weda-calendar__table-body-cell-value">
|
|
26
42
|
{{dateCell.dateDay}}
|
|
27
43
|
<view class="weda-calendar__table-body-cell-bg"></view>
|
|
28
|
-
<view
|
|
44
|
+
<view
|
|
45
|
+
wx:if="{{dateCell.marked}}"
|
|
46
|
+
class="weda-calendar__table-body-cell-marked"
|
|
47
|
+
style="background: {{dateCell.marked}}"
|
|
48
|
+
></view>
|
|
29
49
|
</view>
|
|
30
50
|
</view>
|
|
31
51
|
</block>
|
|
@@ -34,4 +54,4 @@
|
|
|
34
54
|
</view>
|
|
35
55
|
</view>
|
|
36
56
|
</view>
|
|
37
|
-
</view>
|
|
57
|
+
</view>
|
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
<!--components/carousel/index.wxml-->
|
|
2
|
-
<swiper
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
<swiper
|
|
3
|
+
id="{{id}}"
|
|
4
|
+
class="weda-ui {{className}}"
|
|
5
|
+
style="{{style}}"
|
|
6
|
+
indicator-dots="{{indicatorDots}}"
|
|
7
|
+
autoplay="{{autoplay}}"
|
|
8
|
+
current="{{current}}"
|
|
9
|
+
interval="{{interval}}"
|
|
10
|
+
duration="{{duration}}"
|
|
11
|
+
circular="{{circular}}"
|
|
12
|
+
vertical="{{vertical}}"
|
|
13
|
+
indicator-color="{{indicatorColor}}"
|
|
14
|
+
indicator-active-color="{{indicatorActiveColor}}"
|
|
15
|
+
bindchange="changeCurrent"
|
|
16
|
+
>
|
|
17
|
+
<swiper-item
|
|
18
|
+
class="carousle-swiper-item"
|
|
19
|
+
bindtap="tapImg"
|
|
20
|
+
wx:for="{{images}}"
|
|
21
|
+
wx:key="index"
|
|
22
|
+
data-tapMode="{{item.tapMode}}"
|
|
23
|
+
data-insideUrl="{{item.insideUrl}}"
|
|
24
|
+
data-params="{{item.params}}"
|
|
25
|
+
>
|
|
26
|
+
<img
|
|
27
|
+
class="carousle-image"
|
|
28
|
+
src="{{item.image}}"
|
|
29
|
+
fit="{{item.fit}}"
|
|
30
|
+
style="{{'height:'+item.height+';'+'width:'+item.width}}"
|
|
31
|
+
/>
|
|
5
32
|
</swiper-item>
|
|
6
33
|
</swiper>
|
|
@@ -195,7 +195,6 @@ Component({
|
|
|
195
195
|
type: String,
|
|
196
196
|
value: '',
|
|
197
197
|
},
|
|
198
|
-
|
|
199
198
|
},
|
|
200
199
|
data: {
|
|
201
200
|
ec: {},
|
|
@@ -223,7 +222,7 @@ Component({
|
|
|
223
222
|
},
|
|
224
223
|
observers: {
|
|
225
224
|
// 当参数变化时
|
|
226
|
-
'**': async function() {
|
|
225
|
+
'**': async function () {
|
|
227
226
|
const objEChartBar = new EchartBar();
|
|
228
227
|
await objEChartBar.setOptions(this.properties);
|
|
229
228
|
const options = await objEChartBar.getOptions();
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
<view
|
|
2
|
-
|
|
1
|
+
<view
|
|
2
|
+
wx:if="ec"
|
|
3
|
+
class="{{className}} ec_container"
|
|
4
|
+
style="{{style}}"
|
|
5
|
+
id="{{id}}"
|
|
6
|
+
>
|
|
7
|
+
<ec-canvas canvas-id="{{canvas_id}}" ec="{{ ec }}"></ec-canvas>
|
|
3
8
|
</view>
|
|
@@ -37,13 +37,14 @@ class EchartBar extends EchartBase {
|
|
|
37
37
|
name,
|
|
38
38
|
methodName,
|
|
39
39
|
type,
|
|
40
|
-
params
|
|
40
|
+
params
|
|
41
41
|
);
|
|
42
42
|
// 获取 x 轴数据
|
|
43
43
|
const sortedXAxisData = this.sortXAxisData(arrSourData, xField.format);
|
|
44
44
|
const arrXaxisData = this.setXaxis(sortedXAxisData, xField.format);
|
|
45
45
|
const arrXisCountEmptyIndex = []; // 记录空值的key
|
|
46
|
-
if (Object.keys(groupKey ?? {}).length === 0) {
|
|
46
|
+
if (Object.keys(groupKey ?? {}).length === 0) {
|
|
47
|
+
// 没有分组
|
|
47
48
|
const numLine = arrSourData[0].YLabels.length;
|
|
48
49
|
if (numLine > 0) {
|
|
49
50
|
for (let j = 0; j < numLine; j++) {
|
|
@@ -58,16 +59,21 @@ class EchartBar extends EchartBase {
|
|
|
58
59
|
stack: isPile ? 'pile' : null,
|
|
59
60
|
data: [],
|
|
60
61
|
};
|
|
61
|
-
sortedXAxisData.forEach((itemSource,index) => {
|
|
62
|
+
sortedXAxisData.forEach((itemSource, index) => {
|
|
62
63
|
this.config.series[j].name = itemSource.YLabels[j].Cn_Name;
|
|
63
|
-
if (
|
|
64
|
+
if (
|
|
65
|
+
(!itemSource.YLabels[j].Value === undefined ||
|
|
66
|
+
itemSource.YLabels[j].Value === null) &&
|
|
67
|
+
!xIsCountEmpty
|
|
68
|
+
) {
|
|
64
69
|
arrXisCountEmptyIndex.push(index);
|
|
65
70
|
} else {
|
|
66
|
-
const value = itemSource.YLabels[j].Value
|
|
71
|
+
const value = itemSource.YLabels[j].Value
|
|
72
|
+
? itemSource.YLabels[j].Value
|
|
73
|
+
: 0;
|
|
67
74
|
this.config.series[j].data.push(value);
|
|
68
75
|
}
|
|
69
76
|
});
|
|
70
|
-
|
|
71
77
|
}
|
|
72
78
|
}
|
|
73
79
|
// 处理显示空值问题
|
|
@@ -103,23 +109,13 @@ class EchartBar extends EchartBase {
|
|
|
103
109
|
label: {
|
|
104
110
|
show: true,
|
|
105
111
|
},
|
|
106
|
-
data: this.getSeriesDataGroup(
|
|
107
|
-
arrXaxisData,
|
|
108
|
-
objGroupKey[groupKey],
|
|
109
|
-
),
|
|
112
|
+
data: this.getSeriesDataGroup(arrXaxisData, objGroupKey[groupKey]),
|
|
110
113
|
stack: isPile ? 'pile' : null,
|
|
111
114
|
};
|
|
112
115
|
return serie;
|
|
113
116
|
});
|
|
114
|
-
this.config.tooltip.formatter = params =>
|
|
115
|
-
`${params.data.dimensionality
|
|
116
|
-
}\r\n${
|
|
117
|
-
params.data.name
|
|
118
|
-
}\r\n${
|
|
119
|
-
params.seriesName
|
|
120
|
-
}:${
|
|
121
|
-
params.value}`
|
|
122
|
-
);
|
|
117
|
+
this.config.tooltip.formatter = (params) =>
|
|
118
|
+
`${params.data.dimensionality}\r\n${params.data.name}\r\n${params.seriesName}:${params.value}`;
|
|
123
119
|
}
|
|
124
120
|
console.log('sourData处理后数据bar:', this.config.series);
|
|
125
121
|
}
|
|
@@ -140,19 +136,17 @@ class EchartBar extends EchartBase {
|
|
|
140
136
|
isUnit,
|
|
141
137
|
unit,
|
|
142
138
|
decimalDigits,
|
|
143
|
-
suffix
|
|
139
|
+
suffix,
|
|
144
140
|
}) {
|
|
145
141
|
decimalDigits = Math.max(0, decimalDigits);
|
|
146
|
-
this.config.series.length > 0
|
|
147
|
-
|
|
142
|
+
this.config.series.length > 0 &&
|
|
143
|
+
this.config.series.forEach((itemSeries) => {
|
|
148
144
|
itemSeries.showSymbol = isSeriesShowSymbol;
|
|
149
145
|
itemSeries.label.show = isSeriesShowSymbol;
|
|
150
146
|
if (isUnit) {
|
|
151
147
|
itemSeries.label.formatter = (params) => {
|
|
152
148
|
const objNewValue = this.getValueByUnit(params.value, unit);
|
|
153
|
-
return (
|
|
154
|
-
`${objNewValue.toFixed(decimalDigits)}${suffix}`
|
|
155
|
-
);
|
|
149
|
+
return `${objNewValue.toFixed(decimalDigits)}${suffix}`;
|
|
156
150
|
};
|
|
157
151
|
}
|
|
158
152
|
});
|
|
@@ -166,17 +160,18 @@ class EchartBar extends EchartBase {
|
|
|
166
160
|
}
|
|
167
161
|
}
|
|
168
162
|
// 设置柱状图X,Y倒转
|
|
169
|
-
setDirectionType({directionType}) {
|
|
163
|
+
setDirectionType({ directionType }) {
|
|
170
164
|
let temAxis = {};
|
|
171
|
-
if (directionType === 'crosswise') {
|
|
165
|
+
if (directionType === 'crosswise') {
|
|
166
|
+
// 横向
|
|
172
167
|
temAxis = this.config.xAxis;
|
|
173
168
|
// @ts-ignore
|
|
174
169
|
this.config.xAxis = this.config.yAxis;
|
|
175
170
|
// @ts-ignore
|
|
176
171
|
this.config.yAxis = temAxis;
|
|
177
|
-
this.config.yAxis.inverse =
|
|
178
|
-
|
|
179
|
-
|
|
172
|
+
this.config.yAxis.inverse = true;
|
|
173
|
+
} else {
|
|
174
|
+
// 纵向
|
|
180
175
|
if (this.config.yAxis.inverse) {
|
|
181
176
|
temAxis = this.config.yAxis;
|
|
182
177
|
// @ts-ignore
|
|
@@ -220,7 +215,7 @@ class EchartBar extends EchartBase {
|
|
|
220
215
|
isUnit,
|
|
221
216
|
unit,
|
|
222
217
|
decimalDigits,
|
|
223
|
-
suffix
|
|
218
|
+
suffix,
|
|
224
219
|
}) {
|
|
225
220
|
if (dataSource) {
|
|
226
221
|
await this.setSourceData({
|
|
@@ -241,7 +236,7 @@ class EchartBar extends EchartBase {
|
|
|
241
236
|
this.setIsXaxisAxisLabelShow({ isXaxisAxisLabelShow });
|
|
242
237
|
this.setIsXaxisName({ isXaxisName, xAxisName });
|
|
243
238
|
this.setIsXaxisAxisTickShow({ isXaxisAxisTickShow });
|
|
244
|
-
this.setIsXaxisAxisLabelRotate({ isXaxisAxisLabelRotate, xStatistics});
|
|
239
|
+
this.setIsXaxisAxisLabelRotate({ isXaxisAxisLabelRotate, xStatistics });
|
|
245
240
|
this.setIsYAxisSplitlineLinestyleWidth({
|
|
246
241
|
isYAxisSplitlineLinestyleWidth,
|
|
247
242
|
yAxisSplitlineLinestyleType,
|
|
@@ -254,9 +249,9 @@ class EchartBar extends EchartBase {
|
|
|
254
249
|
isUnit,
|
|
255
250
|
unit,
|
|
256
251
|
decimalDigits,
|
|
257
|
-
suffix
|
|
252
|
+
suffix,
|
|
258
253
|
});
|
|
259
|
-
this.setDirectionType({directionType});
|
|
254
|
+
this.setDirectionType({ directionType });
|
|
260
255
|
}
|
|
261
256
|
}
|
|
262
257
|
|