mali-applet-ui 0.1.55 → 0.1.56
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.
|
@@ -9,6 +9,15 @@ import XEUtils from 'xe-utils'
|
|
|
9
9
|
import WxCanvas from './wx-canvas';
|
|
10
10
|
import * as echarts from './echarts';
|
|
11
11
|
|
|
12
|
+
function wrapTouch(event) {
|
|
13
|
+
for (let i = 0; i < event.touches.length; ++i) {
|
|
14
|
+
const touch = event.touches[i];
|
|
15
|
+
touch.offsetX = touch.x;
|
|
16
|
+
touch.offsetY = touch.y;
|
|
17
|
+
}
|
|
18
|
+
return event;
|
|
19
|
+
}
|
|
20
|
+
|
|
12
21
|
export default {
|
|
13
22
|
name: 'MlEcharts',
|
|
14
23
|
props: {
|
|
@@ -18,6 +27,12 @@ export default {
|
|
|
18
27
|
lazyLoad:Boolean,
|
|
19
28
|
className: String
|
|
20
29
|
},
|
|
30
|
+
inject: {
|
|
31
|
+
currVM: {
|
|
32
|
+
from: '$pageVM',
|
|
33
|
+
default: null
|
|
34
|
+
}
|
|
35
|
+
},
|
|
21
36
|
data() {
|
|
22
37
|
return {
|
|
23
38
|
canvasId: XEUtils.uniqueId('chart')
|
|
@@ -61,7 +76,7 @@ export default {
|
|
|
61
76
|
return opts
|
|
62
77
|
},
|
|
63
78
|
customFormat (name) {
|
|
64
|
-
return this.formatLegend(name, this.options || {})
|
|
79
|
+
return this.formatLegend.call(this.currVM, name, this.options || {})
|
|
65
80
|
},
|
|
66
81
|
loadChart () {
|
|
67
82
|
if (this.chart) {
|
|
@@ -81,7 +96,7 @@ export default {
|
|
|
81
96
|
this.chart = chart
|
|
82
97
|
this.loadChart()
|
|
83
98
|
},
|
|
84
|
-
init
|
|
99
|
+
init() {
|
|
85
100
|
const query = uni.createSelectorQuery().in(this)
|
|
86
101
|
query
|
|
87
102
|
.in(this)
|
|
@@ -139,7 +154,6 @@ export default {
|
|
|
139
154
|
});
|
|
140
155
|
}
|
|
141
156
|
},
|
|
142
|
-
|
|
143
157
|
touchStart(e) {
|
|
144
158
|
if (this.chart && e.touches.length > 0) {
|
|
145
159
|
var touch = e.touches[0];
|
|
@@ -155,7 +169,6 @@ export default {
|
|
|
155
169
|
handler.processGesture(wrapTouch(e), 'start');
|
|
156
170
|
}
|
|
157
171
|
},
|
|
158
|
-
|
|
159
172
|
touchMove(e) {
|
|
160
173
|
if (this.chart && e.touches.length > 0) {
|
|
161
174
|
var touch = e.touches[0];
|
|
@@ -167,7 +180,6 @@ export default {
|
|
|
167
180
|
handler.processGesture(wrapTouch(e), 'change');
|
|
168
181
|
}
|
|
169
182
|
},
|
|
170
|
-
|
|
171
183
|
touchEnd(e) {
|
|
172
184
|
if (this.chart) {
|
|
173
185
|
const touch = e.changedTouches ? e.changedTouches[0] : {};
|
|
@@ -185,14 +197,6 @@ export default {
|
|
|
185
197
|
}
|
|
186
198
|
}
|
|
187
199
|
}
|
|
188
|
-
function wrapTouch(event) {
|
|
189
|
-
for (let i = 0; i < event.touches.length; ++i) {
|
|
190
|
-
const touch = event.touches[i];
|
|
191
|
-
touch.offsetX = touch.x;
|
|
192
|
-
touch.offsetY = touch.y;
|
|
193
|
-
}
|
|
194
|
-
return event;
|
|
195
|
-
}
|
|
196
200
|
</script>
|
|
197
201
|
|
|
198
202
|
<style lang="scss">
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
:titleUnderline="column.cellRender.props ? column.cellRender.props.titleUnderline : false"
|
|
46
46
|
:showNum="column.cellRender.props ? column.cellRender.props.showNum : false"
|
|
47
47
|
:max="column.cellRender.props && column.cellRender.props.max ? column.cellRender.props.max : 100"
|
|
48
|
-
:activeColor="
|
|
48
|
+
:activeColor="getBarActiveColor({ type: 'body', row, rowIndex, column, columnIndex })"
|
|
49
49
|
:backgroundColor="column.cellRender.props ? column.cellRender.props.backgroundColor : ''">
|
|
50
50
|
</ml-progress-bar>
|
|
51
51
|
<ml-progress-bar
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
:max="row[column.cellRender.maxField] || ''"
|
|
56
56
|
:titleUnderline="column.cellRender.props ? column.cellRender.props.titleUnderline : false"
|
|
57
57
|
:showNum="column.cellRender.props ? column.cellRender.props.showNum : false"
|
|
58
|
-
:activeColor="(
|
|
58
|
+
:activeColor="getBarActiveColor({ type: 'body', row, rowIndex, column, columnIndex }) || '#FA8C16'"
|
|
59
59
|
:backgroundColor="(column.cellRender.props ? column.cellRender.props.backgroundColor : '') || '#1890FF'">
|
|
60
60
|
</ml-progress-bar>
|
|
61
61
|
<text v-else>{{ getCellValue({ type: 'body', row, rowIndex, column, columnIndex }) }}</text>
|
|
@@ -98,6 +98,12 @@ export default {
|
|
|
98
98
|
// 仅用于MlProgressBar参数
|
|
99
99
|
barActiveColor: Function
|
|
100
100
|
},
|
|
101
|
+
inject: {
|
|
102
|
+
currVM: {
|
|
103
|
+
from: '$pageVM',
|
|
104
|
+
default: null
|
|
105
|
+
}
|
|
106
|
+
},
|
|
101
107
|
data () {
|
|
102
108
|
return {
|
|
103
109
|
tableColumn: [],
|
|
@@ -140,10 +146,20 @@ export default {
|
|
|
140
146
|
return { ...column, order, colid: XEUtils.uniqueId('col_') }
|
|
141
147
|
})
|
|
142
148
|
},
|
|
149
|
+
getBarActiveColor (params) {
|
|
150
|
+
const { column } = params
|
|
151
|
+
if (this.barActiveColor) {
|
|
152
|
+
if (XEUtils.isFunction(this.barActiveColor)) {
|
|
153
|
+
return this.barActiveColor.call(this.currVM, params)
|
|
154
|
+
}
|
|
155
|
+
return `${this.barActiveColor}`
|
|
156
|
+
}
|
|
157
|
+
return column.cellRender.props ? column.cellRender.props.activeColor : ''
|
|
158
|
+
},
|
|
143
159
|
getHeaderCellClass(params) {
|
|
144
160
|
if (this.headerCellClass) {
|
|
145
161
|
if (XEUtils.isFunction(this.headerCellClass)) {
|
|
146
|
-
return this.headerCellClass(params)
|
|
162
|
+
return this.headerCellClass.call(this.currVM, params)
|
|
147
163
|
}
|
|
148
164
|
return `${this.headerCellClass}`
|
|
149
165
|
}
|
|
@@ -152,8 +168,8 @@ export default {
|
|
|
152
168
|
getHeaderCellValue (params) {
|
|
153
169
|
const { row, column } = params
|
|
154
170
|
const cellValue = row[column.field]
|
|
155
|
-
if (this.headerCellFormat) {
|
|
156
|
-
return this.headerCellFormat({ ...params, cellValue })
|
|
171
|
+
if (XEUtils.isFunction(this.headerCellFormat)) {
|
|
172
|
+
return this.headerCellFormat.call(this.currVM, { ...params, cellValue })
|
|
157
173
|
}
|
|
158
174
|
return XEUtils.eqNull(cellValue) ? '' : cellValue
|
|
159
175
|
},
|
|
@@ -162,7 +178,7 @@ export default {
|
|
|
162
178
|
const cellValue = row[column.field]
|
|
163
179
|
if (this.cellClass) {
|
|
164
180
|
if (XEUtils.isFunction(this.cellClass)) {
|
|
165
|
-
return this.cellClass({ ...params, cellValue })
|
|
181
|
+
return this.cellClass.call(this.currVM, { ...params, cellValue })
|
|
166
182
|
}
|
|
167
183
|
return `${this.cellClass}`
|
|
168
184
|
}
|
|
@@ -172,7 +188,7 @@ export default {
|
|
|
172
188
|
const { row, column } = params
|
|
173
189
|
const cellValue = row[column.field]
|
|
174
190
|
if (this.cellFormat) {
|
|
175
|
-
return this.cellFormat({ ...params, cellValue })
|
|
191
|
+
return this.cellFormat.call(this.currVM, { ...params, cellValue })
|
|
176
192
|
}
|
|
177
193
|
return XEUtils.eqNull(cellValue) ? '' : cellValue
|
|
178
194
|
},
|
|
@@ -70,6 +70,10 @@ export default {
|
|
|
70
70
|
removeFile: Function
|
|
71
71
|
},
|
|
72
72
|
inject: {
|
|
73
|
+
currVM: {
|
|
74
|
+
from: '$pageVM',
|
|
75
|
+
default: null
|
|
76
|
+
},
|
|
73
77
|
form: {
|
|
74
78
|
from: 'mlForm',
|
|
75
79
|
default: null
|
|
@@ -190,7 +194,7 @@ export default {
|
|
|
190
194
|
const fileSuffix = this.getSuffix(file.name)
|
|
191
195
|
if (uploadMethod) {
|
|
192
196
|
return Promise.resolve(
|
|
193
|
-
uploadMethod({
|
|
197
|
+
uploadMethod.call(this.currVM, {
|
|
194
198
|
file,
|
|
195
199
|
params: this.params
|
|
196
200
|
})
|
|
@@ -237,7 +241,7 @@ export default {
|
|
|
237
241
|
const removeMethod = this.removeFile ? this.removeFile : (globalStore.upload ? globalStore.upload.removeFile : null)
|
|
238
242
|
if (item && !item.id) {
|
|
239
243
|
if (removeMethod) {
|
|
240
|
-
removeMethod({
|
|
244
|
+
removeMethod.call(this.currVM, {
|
|
241
245
|
item,
|
|
242
246
|
params: this.params
|
|
243
247
|
})
|
|
@@ -249,7 +253,7 @@ export default {
|
|
|
249
253
|
getUrl (item) {
|
|
250
254
|
const getFileMethod = this.getFileUrl ? this.getFileUrl : (globalStore.upload ? globalStore.upload.getFileUrl : null)
|
|
251
255
|
if (getFileMethod) {
|
|
252
|
-
return getFileMethod({
|
|
256
|
+
return getFileMethod.call(this.currVM, {
|
|
253
257
|
item,
|
|
254
258
|
params: this.params
|
|
255
259
|
})
|