@cloudbase/weda-ui 0.2.16 → 0.2.17
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 +39 -170
- package/package.json +17 -10
- package/src/configs/components/chart/bar.json +711 -0
- package/src/configs/components/chart/line.json +666 -0
- package/src/configs/components/chart/pie.json +487 -0
- package/src/configs/components/listView.json +2 -1
- package/src/configs/index.js +7 -0
- package/src/mp/components/chart/bar/index.js +254 -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 +262 -0
- package/src/mp/components/chart/common/core/eChartBase.js +371 -0
- package/src/mp/components/chart/common/core/eChartLine.js +228 -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 +243 -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 +178 -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/dataView/index.json +1 -1
- package/src/mp/components/form/radio/index.js +5 -0
- package/src/mp/components/form/select/index.wxml +4 -4
- package/src/mp/components/form/textarea/index.wxml +6 -5
- package/src/mp/components/form/uploader/index.js +42 -22
- package/src/mp/components/form/uploader/index.wxml +15 -3
- package/src/mp/components/form/uploaderFile/index.js +58 -30
- package/src/mp/components/graphicCard/index.js +26 -28
- package/src/mp/components/internals/listView/arrow-right-line.svg +3 -0
- package/src/mp/components/internals/listView/index.js +286 -0
- package/src/mp/components/internals/listView/index.json +4 -0
- package/src/mp/components/internals/listView/index.wxml +40 -0
- package/src/mp/components/internals/listView/index.wxss +150 -0
- package/src/mp/components/internals/listView/more-line.svg +3 -0
- package/src/mp/components/listView/index.js +17 -24
- package/src/mp/components/listView/index.wxml +1 -1
- package/src/mp/components/navLayout/index.js +3 -3
- package/src/mp/index.json +3 -0
- package/src/mp/utils/platform.js +15 -0
- package/src/setupTests.js +2 -1
- package/src/web/components/chart/bar/index.tsx +139 -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 +264 -0
- package/src/web/components/chart/common/core/eChartBase.ts +379 -0
- package/src/web/components/chart/common/core/eChartLine.js +229 -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 +135 -0
- package/src/web/components/chart/pie/index.tsx +99 -0
- package/src/web/components/form/location/components/LocationH5/location.h5.jsx +3 -3
- package/src/web/components/form/location/components/LocationPC/location.PC.jsx +2 -2
- package/src/web/components/form/select/h5.tsx +3 -1
- package/src/web/components/form/select/time.jsx +1 -0
- package/src/web/components/form/uploader/uploader.h5.tsx +19 -17
- package/src/web/components/form/uploader/uploader.pc.tsx +13 -16
- package/src/web/components/form/uploaderFile/uploadFile.h5.tsx +35 -37
- package/src/web/components/form/uploaderFile/uploadFile.pc.tsx +15 -21
- package/src/web/components/graphicCard/index.css +1 -5
- package/src/web/components/graphicCard/index.tsx +4 -3
- package/src/web/components/index.js +5 -2
- package/src/web/utils/platform.js +1 -1
- package/src/web/utils/tcb.js +3 -15
- 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
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
const isNull = (val) => [undefined, null].includes(val);
|
|
2
|
+
const REL_DICT = {
|
|
3
|
+
equal: 'eq', // 等于
|
|
4
|
+
unequal: 'neq', // 不等于
|
|
5
|
+
include: 'search', // 包含
|
|
6
|
+
exclude: '_exclude', // 不包含
|
|
7
|
+
begin_with: '_begin_with', // 开头是
|
|
8
|
+
greater: 'gt', // 大于
|
|
9
|
+
greater_or_equal: 'gte', // 大于等于
|
|
10
|
+
less: 'lt', // 小于
|
|
11
|
+
less_or_equal: 'lte', // 小于等于
|
|
12
|
+
in: 'in', // 多选值
|
|
13
|
+
not_in: 'nin', // 不在多选值
|
|
14
|
+
};
|
|
15
|
+
const ORDERTYPE = ['asc', 'desc'];
|
|
16
|
+
const getWhereList = (where) => {
|
|
17
|
+
let result = [];
|
|
18
|
+
Array.isArray(where) &&
|
|
19
|
+
where.forEach((item1) => {
|
|
20
|
+
if (item1?.groupLogic !== 'or' && Array.isArray(item1?.logicData)) {
|
|
21
|
+
item1?.logicData.forEach((item2) => {
|
|
22
|
+
let [rel, val] = [REL_DICT[item2?.rel], item2?.value];
|
|
23
|
+
if ('_begin_with' === rel) {
|
|
24
|
+
rel = 'regex';
|
|
25
|
+
val = `^${val}`;
|
|
26
|
+
}
|
|
27
|
+
if ('_exclude' === rel) {
|
|
28
|
+
rel = 'regex';
|
|
29
|
+
val = `^((?!${val}).)*$`;
|
|
30
|
+
}
|
|
31
|
+
if (item2?.logic !== 'or' && item2?.key && rel && !isNull(val)) {
|
|
32
|
+
result.push({ key: item2.key, rel, val });
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
39
|
+
const DEFAULT_DATA = {
|
|
40
|
+
pageNo: 1,
|
|
41
|
+
loading: false,
|
|
42
|
+
total: 0,
|
|
43
|
+
records: [],
|
|
44
|
+
pageStr: '0/0',
|
|
45
|
+
isVisiableSign: false,
|
|
46
|
+
isFirstScreen: true,
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
Component({
|
|
50
|
+
options: {
|
|
51
|
+
virtualHost: true,
|
|
52
|
+
},
|
|
53
|
+
properties: {
|
|
54
|
+
className: {
|
|
55
|
+
type: String,
|
|
56
|
+
value: '',
|
|
57
|
+
},
|
|
58
|
+
style: {
|
|
59
|
+
type: String,
|
|
60
|
+
value: '',
|
|
61
|
+
},
|
|
62
|
+
datasource: {
|
|
63
|
+
type: Object,
|
|
64
|
+
value: {},
|
|
65
|
+
},
|
|
66
|
+
orderBy: {
|
|
67
|
+
type: String,
|
|
68
|
+
},
|
|
69
|
+
orderType: {
|
|
70
|
+
type: String,
|
|
71
|
+
},
|
|
72
|
+
where: {
|
|
73
|
+
type: Array,
|
|
74
|
+
value: [],
|
|
75
|
+
},
|
|
76
|
+
pageSize: {
|
|
77
|
+
type: Number,
|
|
78
|
+
value: 5,
|
|
79
|
+
},
|
|
80
|
+
template: {
|
|
81
|
+
type: String,
|
|
82
|
+
value: 'simpleList',
|
|
83
|
+
},
|
|
84
|
+
pagination: {
|
|
85
|
+
type: String,
|
|
86
|
+
value: 'loadMoreButton',
|
|
87
|
+
},
|
|
88
|
+
beforeDataChange: {
|
|
89
|
+
type: Function,
|
|
90
|
+
value: (v) => v,
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
data: { ...DEFAULT_DATA },
|
|
94
|
+
methods: {
|
|
95
|
+
/**
|
|
96
|
+
* 列表容器拉取数据,放在 setData 的回调函数中执行
|
|
97
|
+
*/
|
|
98
|
+
_fetchData: async function () {
|
|
99
|
+
const { app } = getApp();
|
|
100
|
+
const callDataSource = app?.cloud?.callDataSource;
|
|
101
|
+
const { pageNo, loading } = this.data;
|
|
102
|
+
const { datasource, orderBy, orderType, where, pageSize } =
|
|
103
|
+
this.properties;
|
|
104
|
+
if (loading) return;
|
|
105
|
+
if (!callDataSource) {
|
|
106
|
+
console.warn(`当前环境缺少方法 app.cloud.callDataSource`);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
this.setData({ loading: true });
|
|
110
|
+
const { name: dataSourceName, extra } = datasource || {};
|
|
111
|
+
const methodName =
|
|
112
|
+
typeof extra?.methodName === 'string'
|
|
113
|
+
? extra?.methodName
|
|
114
|
+
: 'wedaGetRecords';
|
|
115
|
+
const tcbParams = {};
|
|
116
|
+
|
|
117
|
+
// tcb分页参数
|
|
118
|
+
if (!isNull(pageNo) && !isNull(pageSize)) {
|
|
119
|
+
tcbParams['pageNo'] = pageNo;
|
|
120
|
+
tcbParams['pageSize'] = pageSize;
|
|
121
|
+
}
|
|
122
|
+
// tcb排序参数
|
|
123
|
+
if (orderBy && ORDERTYPE.includes(orderType)) {
|
|
124
|
+
tcbParams['orderBy'] = orderBy;
|
|
125
|
+
tcbParams['orderType'] = orderType;
|
|
126
|
+
}
|
|
127
|
+
// tcb过滤参数
|
|
128
|
+
const whereEffected = [].concat(getWhereList(where));
|
|
129
|
+
whereEffected.length > 0 && (tcbParams['where'] = whereEffected);
|
|
130
|
+
// tcb结果和事件
|
|
131
|
+
const data = await callDataSource({
|
|
132
|
+
dataSourceName,
|
|
133
|
+
methodName,
|
|
134
|
+
params: tcbParams,
|
|
135
|
+
});
|
|
136
|
+
let records = data?.records || [];
|
|
137
|
+
let total = data?.total || 0;
|
|
138
|
+
if (
|
|
139
|
+
['loadMoreButton', 'bottomLoad'].includes(this.properties.pagination)
|
|
140
|
+
) {
|
|
141
|
+
records = [...this.data.records, ...records]; // TODO 可能存在单次 setData 数据量过大引起小程序性能问题
|
|
142
|
+
}
|
|
143
|
+
this.setData(
|
|
144
|
+
{
|
|
145
|
+
total,
|
|
146
|
+
records,
|
|
147
|
+
loading: false,
|
|
148
|
+
pageStr: `${total > 0 ? pageNo : 0}/${
|
|
149
|
+
Math.ceil(total / pageSize) || 0
|
|
150
|
+
}`,
|
|
151
|
+
},
|
|
152
|
+
() => {
|
|
153
|
+
this._handleEvents(data);
|
|
154
|
+
setTimeout(() => this._firstScreenLoadMore(), 150);
|
|
155
|
+
}
|
|
156
|
+
);
|
|
157
|
+
},
|
|
158
|
+
/**
|
|
159
|
+
* 下一页
|
|
160
|
+
*/
|
|
161
|
+
handleNext: function () {
|
|
162
|
+
if (
|
|
163
|
+
this.data.loading ||
|
|
164
|
+
!(this.properties.pageSize * this.data.pageNo < this.data.total)
|
|
165
|
+
) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
this.setData({ pageNo: this.data.pageNo + 1 }, () => this._fetchData());
|
|
169
|
+
},
|
|
170
|
+
/**
|
|
171
|
+
* 上一页
|
|
172
|
+
*/
|
|
173
|
+
handlePre: function () {
|
|
174
|
+
if (this.data.loading || !(this.properties.pageNo > 1)) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
this.setData({ pageNo: this.data.pageNo - 1 }, () => this._fetchData());
|
|
178
|
+
},
|
|
179
|
+
/**
|
|
180
|
+
* 向外部传递事件
|
|
181
|
+
*/
|
|
182
|
+
_handleEvents: function (data) {
|
|
183
|
+
const records = this.data.records || [];
|
|
184
|
+
const total = this.data.total || records?.length || 0;
|
|
185
|
+
const beforeDataChange = this.properties.beforeDataChange || ((v) => v);
|
|
186
|
+
this.triggerEvent('onDataChange', {
|
|
187
|
+
data: beforeDataChange(records),
|
|
188
|
+
});
|
|
189
|
+
if (JSON.stringify(data) === '{}') {
|
|
190
|
+
this.triggerEvent('queryFail', {
|
|
191
|
+
datasource: this.properties.datasource,
|
|
192
|
+
data: null,
|
|
193
|
+
});
|
|
194
|
+
} else {
|
|
195
|
+
if (total === 0) {
|
|
196
|
+
this.triggerEvent('queryEmpty', {
|
|
197
|
+
datasource: this.properties.datasource,
|
|
198
|
+
data: beforeDataChange([]),
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
this.triggerEvent('querySuccess', {
|
|
202
|
+
datasource: this.properties.datasource,
|
|
203
|
+
data: beforeDataChange(records),
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
/**
|
|
208
|
+
* 首屏持续触底加载特殊处理
|
|
209
|
+
*/
|
|
210
|
+
_firstScreenLoadMore: function () {
|
|
211
|
+
if (this.properties.pagination === 'bottomLoad') {
|
|
212
|
+
if (this.data.isFirstScreen) {
|
|
213
|
+
this.setData({ isFirstScreen: false });
|
|
214
|
+
this.contentObserver?.disconnect();
|
|
215
|
+
this._observerContent();
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
/**
|
|
220
|
+
* 开始监听slot
|
|
221
|
+
*/
|
|
222
|
+
_observerContent: function () {
|
|
223
|
+
this.contentObserver = this.createIntersectionObserver();
|
|
224
|
+
this.contentObserver
|
|
225
|
+
.relativeToViewport()
|
|
226
|
+
.observe('#weda-list-view_content', (res) => {
|
|
227
|
+
this.setData({
|
|
228
|
+
isFirstScreen:
|
|
229
|
+
res?.boundingClientRect?.bottom <= res?.relativeRect?.bottom,
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
},
|
|
233
|
+
/**
|
|
234
|
+
* 开始监听sign
|
|
235
|
+
*/
|
|
236
|
+
_observerSign: function () {
|
|
237
|
+
this.signObserver = this.createIntersectionObserver();
|
|
238
|
+
this.signObserver
|
|
239
|
+
.relativeTo('.weda-list-view__containor', { bottom: 10 })
|
|
240
|
+
.observe('#weda-list-view_sign', (res) => {
|
|
241
|
+
this.setData({ isVisiableSign: res?.intersectionRatio > 0 });
|
|
242
|
+
});
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
observers: {
|
|
246
|
+
'datasource,orderBy,orderType,where,pageSize,pagination': function (
|
|
247
|
+
dDatasource,
|
|
248
|
+
dOrderBy,
|
|
249
|
+
dOrderType,
|
|
250
|
+
dWhere,
|
|
251
|
+
dPageSize,
|
|
252
|
+
dPagination
|
|
253
|
+
) {
|
|
254
|
+
if (
|
|
255
|
+
dDatasource !== this.properties.datasource ||
|
|
256
|
+
dOrderBy !== this.properties.orderBy ||
|
|
257
|
+
dOrderType !== this.properties.orderType ||
|
|
258
|
+
dWhere !== this.properties.where ||
|
|
259
|
+
dPageSize !== this.properties.pageSize ||
|
|
260
|
+
dPagination !== this.properties.pagination
|
|
261
|
+
) {
|
|
262
|
+
this.setData({ ...DEFAULT_DATA }, () => this._fetchData());
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
isVisiableSign: function (dIsVisiableSign) {
|
|
266
|
+
if (dIsVisiableSign && this.properties.pagination === 'bottomLoad') {
|
|
267
|
+
this.handleNext();
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
isFirstScreen: function (dIsFirstScreen) {
|
|
271
|
+
if (dIsFirstScreen && this.properties.pagination === 'bottomLoad') {
|
|
272
|
+
this.handleNext();
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
lifetimes: {
|
|
277
|
+
attached: function () {
|
|
278
|
+
this._fetchData();
|
|
279
|
+
this._observerSign();
|
|
280
|
+
},
|
|
281
|
+
detached: function () {
|
|
282
|
+
this.contentObserver?.disconnect();
|
|
283
|
+
this.signObserver?.disconnect();
|
|
284
|
+
},
|
|
285
|
+
},
|
|
286
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<scroll-view scroll-y scroll-with-animation lower-threshold="5" style="height:97vh;{{style}}"
|
|
2
|
+
class="weda-list-view__containor weda-ui {{className}}">
|
|
3
|
+
<!-- 列表插槽 -->
|
|
4
|
+
<view class="{{template === 'cardList' ? 'weda-list-view-card' : ''}}" id="weda-list-view_content">
|
|
5
|
+
<slot></slot>
|
|
6
|
+
</view>
|
|
7
|
+
|
|
8
|
+
<view class="weda-list-view__more">
|
|
9
|
+
<!-- 加载更多 -->
|
|
10
|
+
<block wx:if="{{pagination==='loadMoreButton' && pageSize * pageNo < total}}">
|
|
11
|
+
<view class="weda-list-view__more-text" bindtap="handleNext">加载更多</view>
|
|
12
|
+
</block>
|
|
13
|
+
<!-- 触底刷新 -->
|
|
14
|
+
<block wx:elif="{{pagination==='bottomLoad'}}">
|
|
15
|
+
<view class="weda-list-view__bottom-load" id="weda-list-view_sign">
|
|
16
|
+
<view class="weda-list-view__more-symbol" wx:if="{{loading}}">
|
|
17
|
+
<view class="weda-list-view__symbol-item"></view>
|
|
18
|
+
<view class="weda-list-view__symbol-item"></view>
|
|
19
|
+
<view class="weda-list-view__symbol-item"></view>
|
|
20
|
+
</view>
|
|
21
|
+
</view>
|
|
22
|
+
</block>
|
|
23
|
+
<!-- 分页器 -->
|
|
24
|
+
<block wx:elif="{{pagination==='pagination'}}">
|
|
25
|
+
<view class="weda-list-view__more-pagination">
|
|
26
|
+
<view class="weda-list-view__pagination-pre {{pageNo > 1 ? 'active': ''}}" bindtap="handlePre">
|
|
27
|
+
<image class="weda-list-view__pagination-icon" src='arrow-right-line.svg' />
|
|
28
|
+
上一页
|
|
29
|
+
</view>
|
|
30
|
+
<view class="weda-list-view__pagination-text">{{pageStr}}</view>
|
|
31
|
+
<view class="weda-list-view__pagination-next {{pageSize * pageNo < total ? 'active' : ''}}"
|
|
32
|
+
bindtap="handleNext">
|
|
33
|
+
<image class="weda-list-view__pagination-icon" src='arrow-right-line.svg' />
|
|
34
|
+
下一页
|
|
35
|
+
</view>
|
|
36
|
+
</view>
|
|
37
|
+
</block>
|
|
38
|
+
<block wx:else></block>
|
|
39
|
+
</view>
|
|
40
|
+
</scroll-view>
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/* weda_list_view */
|
|
2
|
+
|
|
3
|
+
.weda-list-view__containor {
|
|
4
|
+
background: #fff;
|
|
5
|
+
width: 100%;
|
|
6
|
+
height: 100%;
|
|
7
|
+
overflow-x: hidden;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/* 卡片列表 */
|
|
11
|
+
.weda-list-view-card {
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-wrap: wrap;
|
|
14
|
+
margin-right: 6rpx;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* 加载更多 */
|
|
18
|
+
.weda-list-view__containor .weda-list-view__more {
|
|
19
|
+
width: 100%;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.weda-list-view__containor .weda-list-view__more .weda-list-view__more-text {
|
|
23
|
+
padding-top: 20rpx;
|
|
24
|
+
padding-bottom: 28rpx;
|
|
25
|
+
font-size: 24rpx;
|
|
26
|
+
line-height: 44rpx;
|
|
27
|
+
color: rgba(0, 0, 0, 0.4);
|
|
28
|
+
text-align: center;
|
|
29
|
+
box-sizing: border-box;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* 加载更多 ... */
|
|
33
|
+
.weda-list-view__containor .weda-list-view__more {
|
|
34
|
+
background: #fff;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.weda-list-view__bottom-load {
|
|
38
|
+
padding-top: 1px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.weda-list-view__containor .weda-list-view__more .weda-list-view__more-symbol {
|
|
42
|
+
display: flex;
|
|
43
|
+
align-items: center;
|
|
44
|
+
justify-content: center;
|
|
45
|
+
padding-top: 40rpx;
|
|
46
|
+
padding-bottom: 36rpx;
|
|
47
|
+
box-sizing: border-box;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.weda-list-view__containor .weda-list-view__more .weda-list-view__symbol-item {
|
|
51
|
+
width: 16rpx;
|
|
52
|
+
height: 16rpx;
|
|
53
|
+
background: #c4c4c4;
|
|
54
|
+
margin-left: 12rpx;
|
|
55
|
+
border-radius: 50%;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.weda-list-view__containor
|
|
59
|
+
.weda-list-view__more
|
|
60
|
+
.weda-list-view__symbol-item:first-child {
|
|
61
|
+
width: 12rpx;
|
|
62
|
+
height: 12rpx;
|
|
63
|
+
margin-left: 0;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* 加载更多 分页 */
|
|
67
|
+
.weda-list-view__containor
|
|
68
|
+
.weda-list-view__more
|
|
69
|
+
.weda-list-view__more-pagination {
|
|
70
|
+
display: flex;
|
|
71
|
+
align-items: center;
|
|
72
|
+
justify-content: space-between;
|
|
73
|
+
position: relative;
|
|
74
|
+
padding: 20rpx 36rpx 24rpx 32rpx;
|
|
75
|
+
box-sizing: border-box;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.weda-list-view__containor
|
|
79
|
+
.weda-list-view__more
|
|
80
|
+
.weda-list-view__pagination-pre,
|
|
81
|
+
.weda-list-view__containor
|
|
82
|
+
.weda-list-view__more
|
|
83
|
+
.weda-list-view__pagination-next {
|
|
84
|
+
font-size: 24rpx;
|
|
85
|
+
line-height: 48rpx;
|
|
86
|
+
color: rgba(0, 0, 0, 0.4);
|
|
87
|
+
padding: 0 48rpx;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.weda-list-view__containor
|
|
91
|
+
.weda-list-view__more
|
|
92
|
+
.weda-list-view__pagination-pre.active,
|
|
93
|
+
.weda-list-view__containor
|
|
94
|
+
.weda-list-view__more
|
|
95
|
+
.weda-list-view__pagination-next.active {
|
|
96
|
+
color: rgba(0, 0, 0, 0.9);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.weda-list-view__containor
|
|
100
|
+
.weda-list-view__more
|
|
101
|
+
.weda-list-view__pagination-pre
|
|
102
|
+
.weda-list-view__pagination-icon,
|
|
103
|
+
.weda-list-view__containor
|
|
104
|
+
.weda-list-view__more
|
|
105
|
+
.weda-list-view__pagination-next
|
|
106
|
+
.weda-list-view__pagination-icon {
|
|
107
|
+
position: absolute;
|
|
108
|
+
width: 48rpx;
|
|
109
|
+
height: 48rpx;
|
|
110
|
+
top: 20rpx;
|
|
111
|
+
opacity: 0.2;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.weda-list-view__containor
|
|
115
|
+
.weda-list-view__more
|
|
116
|
+
.active.weda-list-view__pagination-pre
|
|
117
|
+
.weda-list-view__pagination-icon,
|
|
118
|
+
.weda-list-view__containor
|
|
119
|
+
.weda-list-view__more
|
|
120
|
+
.active.weda-list-view__pagination-next
|
|
121
|
+
.weda-list-view__pagination-icon {
|
|
122
|
+
opacity: 1;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.weda-list-view__containor
|
|
126
|
+
.weda-list-view__more
|
|
127
|
+
.weda-list-view__pagination-pre
|
|
128
|
+
.weda-list-view__pagination-icon {
|
|
129
|
+
left: 32rpx;
|
|
130
|
+
transform: rotate(180deg);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.weda-list-view__containor
|
|
134
|
+
.weda-list-view__more
|
|
135
|
+
.weda-list-view__pagination-next
|
|
136
|
+
.weda-list-view__pagination-icon {
|
|
137
|
+
right: 36rpx;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.weda-list-view__containor
|
|
141
|
+
.weda-list-view__more
|
|
142
|
+
.weda-list-view__pagination-text {
|
|
143
|
+
font-size: 24rpx;
|
|
144
|
+
line-height: 44rpx;
|
|
145
|
+
color: rgba(0, 0, 0, 0.4);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.split {
|
|
149
|
+
height: 40rpx;
|
|
150
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M4.5 10.5C3.675 10.5 3 11.175 3 12C3 12.825 3.675 13.5 4.5 13.5C5.325 13.5 6 12.825 6 12C6 11.175 5.325 10.5 4.5 10.5ZM19.5 10.5C18.675 10.5 18 11.175 18 12C18 12.825 18.675 13.5 19.5 13.5C20.325 13.5 21 12.825 21 12C21 11.175 20.325 10.5 19.5 10.5ZM12 10.5C11.175 10.5 10.5 11.175 10.5 12C10.5 12.825 11.175 13.5 12 13.5C12.825 13.5 13.5 12.825 13.5 12C13.5 11.175 12.825 10.5 12 10.5Z" fill="#09121F"/>
|
|
3
|
+
</svg>
|
|
@@ -38,7 +38,6 @@ const getWhereList = (where) => {
|
|
|
38
38
|
};
|
|
39
39
|
const DEFAULT_DATA = {
|
|
40
40
|
pageNo: 1,
|
|
41
|
-
loading: false,
|
|
42
41
|
total: 0,
|
|
43
42
|
records: [],
|
|
44
43
|
pageStr: '0/0',
|
|
@@ -90,7 +89,7 @@ Component({
|
|
|
90
89
|
value: (v) => v,
|
|
91
90
|
},
|
|
92
91
|
},
|
|
93
|
-
data: { ...DEFAULT_DATA },
|
|
92
|
+
data: { ...DEFAULT_DATA, isReLoad: false, loading: false },
|
|
94
93
|
methods: {
|
|
95
94
|
/**
|
|
96
95
|
* 列表容器拉取数据,放在 setData 的回调函数中执行
|
|
@@ -98,10 +97,10 @@ Component({
|
|
|
98
97
|
_fetchData: async function () {
|
|
99
98
|
const { app } = getApp();
|
|
100
99
|
const callDataSource = app?.cloud?.callDataSource;
|
|
101
|
-
const { pageNo, loading } = this.data;
|
|
100
|
+
const { pageNo, loading, isReLoad } = this.data;
|
|
102
101
|
const { datasource, orderBy, orderType, where, pageSize } =
|
|
103
102
|
this.properties;
|
|
104
|
-
if (loading) return;
|
|
103
|
+
if (loading && !isReLoad) return;
|
|
105
104
|
if (!callDataSource) {
|
|
106
105
|
console.warn(`当前环境缺少方法 app.cloud.callDataSource`);
|
|
107
106
|
return;
|
|
@@ -136,7 +135,8 @@ Component({
|
|
|
136
135
|
let records = data?.records || [];
|
|
137
136
|
let total = data?.total || 0;
|
|
138
137
|
if (
|
|
139
|
-
['loadMoreButton', 'bottomLoad'].includes(this.properties.pagination)
|
|
138
|
+
['loadMoreButton', 'bottomLoad'].includes(this.properties.pagination) &&
|
|
139
|
+
!isReLoad
|
|
140
140
|
) {
|
|
141
141
|
records = [...this.data.records, ...records]; // TODO 可能存在单次 setData 数据量过大引起小程序性能问题
|
|
142
142
|
}
|
|
@@ -145,6 +145,7 @@ Component({
|
|
|
145
145
|
total,
|
|
146
146
|
records,
|
|
147
147
|
loading: false,
|
|
148
|
+
isReLoad: false,
|
|
148
149
|
pageStr: `${total > 0 ? pageNo : 0}/${
|
|
149
150
|
Math.ceil(total / pageSize) || 0
|
|
150
151
|
}`,
|
|
@@ -236,31 +237,22 @@ Component({
|
|
|
236
237
|
_observerSign: function () {
|
|
237
238
|
this.signObserver = this.createIntersectionObserver();
|
|
238
239
|
this.signObserver
|
|
239
|
-
.
|
|
240
|
+
.relativeToViewport()
|
|
240
241
|
.observe('#weda-list-view_sign', (res) => {
|
|
241
242
|
this.setData({ isVisiableSign: res?.intersectionRatio > 0 });
|
|
242
243
|
});
|
|
243
244
|
},
|
|
244
245
|
},
|
|
245
246
|
observers: {
|
|
246
|
-
'datasource,orderBy,orderType,where,pageSize,pagination': function (
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
dDatasource !== this.properties.datasource ||
|
|
256
|
-
dOrderBy !== this.properties.orderBy ||
|
|
257
|
-
dOrderType !== this.properties.orderType ||
|
|
258
|
-
dWhere !== this.properties.where ||
|
|
259
|
-
dPageSize !== this.properties.pageSize ||
|
|
260
|
-
dPagination !== this.properties.pagination
|
|
261
|
-
) {
|
|
262
|
-
this.setData({ ...DEFAULT_DATA }, () => this._fetchData());
|
|
263
|
-
}
|
|
247
|
+
'datasource,orderBy,orderType,where,pageSize,pagination': function () {
|
|
248
|
+
clearTimeout(this._timer);
|
|
249
|
+
this._timer = setTimeout(
|
|
250
|
+
() =>
|
|
251
|
+
this.setData({ ...DEFAULT_DATA, isReLoad: true }, () =>
|
|
252
|
+
this._fetchData()
|
|
253
|
+
),
|
|
254
|
+
200
|
|
255
|
+
);
|
|
264
256
|
},
|
|
265
257
|
isVisiableSign: function (dIsVisiableSign) {
|
|
266
258
|
if (dIsVisiableSign && this.properties.pagination === 'bottomLoad') {
|
|
@@ -275,6 +267,7 @@ Component({
|
|
|
275
267
|
},
|
|
276
268
|
lifetimes: {
|
|
277
269
|
attached: function () {
|
|
270
|
+
clearTimeout(this._timer);
|
|
278
271
|
this._fetchData();
|
|
279
272
|
this._observerSign();
|
|
280
273
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<scroll-view scroll-y scroll-with-animation lower-threshold="5" style="
|
|
1
|
+
<scroll-view scroll-y scroll-with-animation lower-threshold="5" style="{{style}}"
|
|
2
2
|
class="weda-list-view__containor weda-ui {{className}}">
|
|
3
3
|
<!-- 列表插槽 -->
|
|
4
4
|
<view class="{{template === 'cardList' ? 'weda-list-view-card' : ''}}" id="weda-list-view_content">
|
|
@@ -64,12 +64,12 @@ Component({
|
|
|
64
64
|
}
|
|
65
65
|
item.paramObj = paramObj;
|
|
66
66
|
if (item.withParams && item.params.length > 0) {
|
|
67
|
-
wx.
|
|
67
|
+
wx.redirectTo({
|
|
68
68
|
url:
|
|
69
69
|
'/pages/' + item?.insideUrl + '/index?' + item.paramObj.join('&'),
|
|
70
70
|
});
|
|
71
71
|
} else {
|
|
72
|
-
wx.
|
|
72
|
+
wx.redirectTo({
|
|
73
73
|
url: '/pages/' + item?.insideUrl + '/index',
|
|
74
74
|
});
|
|
75
75
|
}
|
|
@@ -113,7 +113,7 @@ Component({
|
|
|
113
113
|
|
|
114
114
|
// 添加对齐属性
|
|
115
115
|
if (fontWeight !== '') {
|
|
116
|
-
titleStyle = `${titleStyle};font-weight: ${fontWeight};font-size:${fontSize};line-height:${
|
|
116
|
+
titleStyle = `${titleStyle};font-weight: ${fontWeight};font-size:${fontSize}px;line-height:${
|
|
117
117
|
lineHeight == 'auto' ? 'normal' : lineHeight
|
|
118
118
|
}`;
|
|
119
119
|
}
|
package/src/mp/index.json
CHANGED
|
@@ -32,6 +32,9 @@
|
|
|
32
32
|
"DataView": "components/dataView/index",
|
|
33
33
|
"Calendar": "components/calendar/index",
|
|
34
34
|
"NavLayout": "components/navLayout/index",
|
|
35
|
+
"Line": "components/chart/line/index",
|
|
36
|
+
"Bar": "components/chart/bar/index",
|
|
37
|
+
"Pie": "components/chart/pie/index",
|
|
35
38
|
"StatisticsCard": "components/chart/statisticsCard/index",
|
|
36
39
|
"GraphicCard": "components/graphicCard/index"
|
|
37
40
|
},
|
package/src/mp/utils/platform.js
CHANGED
|
@@ -18,3 +18,18 @@ export const transSize = (size) => {
|
|
|
18
18
|
const g = getBig(m);
|
|
19
19
|
return `${g}G`;
|
|
20
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* 生成随机数
|
|
23
|
+
*/
|
|
24
|
+
export const uuid = () => {
|
|
25
|
+
var s = [];
|
|
26
|
+
var hexDigits = '0123456789abcdef';
|
|
27
|
+
for (var i = 0; i < 36; i++) {
|
|
28
|
+
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
|
|
29
|
+
}
|
|
30
|
+
s[14] = '4'; // bits 12-15 of the time_hi_and_version field to 0010
|
|
31
|
+
s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
|
|
32
|
+
s[8] = s[13] = s[18] = s[23] = '-';
|
|
33
|
+
var uuid = s.join('');
|
|
34
|
+
return uuid;
|
|
35
|
+
};
|
package/src/setupTests.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
require("regenerator-runtime");
|
|
1
2
|
Object.defineProperty(window, 'matchMedia', {
|
|
2
3
|
writable: true,
|
|
3
4
|
value: jest.fn().mockImplementation(query => ({
|
|
@@ -10,4 +11,4 @@ Object.defineProperty(window, 'matchMedia', {
|
|
|
10
11
|
removeEventListener: jest.fn(),
|
|
11
12
|
dispatchEvent: jest.fn(),
|
|
12
13
|
})),
|
|
13
|
-
});
|
|
14
|
+
});
|