mali-applet-ui 1.0.19 → 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 +2 -0
- package/config/index.js +1 -1
- package/config/store.js +7 -7
- package/lib/components/ml-amount-input/ml-amount-input.vue +2 -2
- package/lib/components/ml-approval-type/ml-approval-type.vue +2 -2
- package/lib/components/ml-button/ml-button.vue +21 -2
- package/lib/components/ml-card/ml-card.vue +5 -1
- package/lib/components/ml-chunk-item/ml-chunk-item.vue +1 -1
- package/lib/components/ml-col/ml-col.vue +2 -2
- package/lib/components/ml-date-range-picker/ml-date-range-picker.vue +1 -1
- package/lib/components/ml-datetime-picker/ml-datetime-picker.vue +1 -1
- package/lib/components/ml-datetime-range-picker/ml-datetime-range-picker.vue +1 -1
- package/lib/components/ml-echart2/ec-canvas.vue +140 -0
- package/lib/components/ml-echart2/echarts.js +11 -0
- package/lib/components/ml-echart2/echarts.simple.min.js +18 -0
- package/lib/components/ml-echart2/ml-echart2.vue +182 -0
- package/lib/components/ml-echart2/wx-canvas.js +111 -0
- package/lib/components/ml-echarts/echarts.js +14 -14
- package/lib/components/ml-echarts/echarts.min.js +46 -46
- package/lib/components/ml-echarts/echarts.simple.min.js +18 -18
- package/lib/components/ml-echarts/ml-echarts.vue +5 -0
- package/lib/components/ml-echarts/wx-canvas.js +168 -168
- package/lib/components/ml-form/ml-form.vue +0 -1
- package/lib/components/ml-form-group/ml-form-group.vue +1 -0
- package/lib/components/ml-form-item/ml-form-item.vue +4 -7
- package/lib/components/ml-icon/iconfont.css +757 -757
- package/lib/components/ml-input/ml-input.vue +37 -13
- package/lib/components/ml-list-group/ml-list-group.vue +1 -0
- package/lib/components/ml-list-item/ml-list-item.vue +9 -1
- package/lib/components/ml-list-menu-group/ml-list-menu-group.vue +0 -1
- package/lib/components/ml-list-menu-item/ml-list-menu-item.vue +26 -5
- package/lib/components/ml-location-pick/location.js +12 -0
- package/lib/components/ml-location-pick/ml-location-pick.vue +73 -0
- package/lib/components/ml-modal/ml-modal.vue +1 -0
- package/lib/components/ml-month-picker/ml-month-picker.vue +1 -1
- package/lib/components/ml-navbar/ml-navbar.vue +1 -1
- package/lib/components/ml-number-input/ml-number-input.vue +2 -2
- package/lib/components/ml-progress-bar/ml-progress-bar.vue +1 -1
- package/lib/components/ml-rich-text/ml-rich-text.vue +1 -1
- package/lib/components/ml-search-bar/ml-search-bar.vue +8 -8
- package/lib/components/ml-select-picker/ml-select-picker.vue +1 -1
- package/lib/components/ml-status-tag/ml-status-tag.vue +11 -3
- package/lib/components/ml-switch/ml-switch.vue +1 -1
- package/lib/components/ml-tab-pane/ml-tab-pane.vue +1 -1
- package/lib/components/ml-tabbar/ml-tabbar.vue +1 -1
- package/lib/components/ml-tabs/ml-tabs.vue +1 -1
- package/lib/components/ml-text/ml-text.vue +1 -1
- package/lib/components/ml-textarea/ml-textarea.vue +3 -4
- package/lib/components/ml-textarea/voice-input.vue +1 -1
- package/lib/components/ml-toast/ml-toast.vue +1 -1
- package/lib/components/ml-upload/ml-upload.vue +5 -9
- package/lib/components/ml-year-picker/ml-year-picker.vue +1 -1
- package/package.json +1 -1
- package/theme.scss +9 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="ml-echarts" :class="className" :style="{height: height || '400rpx', width: width || '100%'}">
|
|
3
|
+
<ecCanvas ref="canvasRef" type="2d" class="ml-canvas" :canvas-id="canvasId" :id="canvasId" :ec="ec" :myinit="initChart" :options="options10"></ecCanvas>
|
|
4
|
+
</view>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
import * as echarts from './echarts'
|
|
9
|
+
import ecCanvas from './ec-canvas.vue'
|
|
10
|
+
|
|
11
|
+
function initChart (canvas, width, height) {
|
|
12
|
+
const chart = echarts.init(canvas, null, {
|
|
13
|
+
width: width,
|
|
14
|
+
height: height
|
|
15
|
+
})
|
|
16
|
+
canvas.setChart(chart)
|
|
17
|
+
const model = {
|
|
18
|
+
yCates: [
|
|
19
|
+
'Saturday',
|
|
20
|
+
'Friday',
|
|
21
|
+
'Thursday',
|
|
22
|
+
'Wednesday',
|
|
23
|
+
'Tuesday',
|
|
24
|
+
'Monday',
|
|
25
|
+
'Sunday'
|
|
26
|
+
],
|
|
27
|
+
xCates: ['1', '2', '3', '4', '5'],
|
|
28
|
+
data: [
|
|
29
|
+
// [yCateIndex, xCateIndex, value]
|
|
30
|
+
[0, 0, 5],
|
|
31
|
+
[0, 1, 7],
|
|
32
|
+
[0, 2, 3],
|
|
33
|
+
[0, 3, 5],
|
|
34
|
+
[0, 4, 2],
|
|
35
|
+
[1, 0, 1],
|
|
36
|
+
[1, 1, 2],
|
|
37
|
+
[1, 2, 4],
|
|
38
|
+
[1, 3, 8],
|
|
39
|
+
[1, 4, 2],
|
|
40
|
+
[2, 0, 2],
|
|
41
|
+
[2, 1, 3],
|
|
42
|
+
[2, 2, 8],
|
|
43
|
+
[2, 3, 6],
|
|
44
|
+
[2, 4, 7],
|
|
45
|
+
[3, 0, 3],
|
|
46
|
+
[3, 1, 7],
|
|
47
|
+
[3, 2, 5],
|
|
48
|
+
[3, 3, 1],
|
|
49
|
+
[3, 4, 6],
|
|
50
|
+
[4, 0, 3],
|
|
51
|
+
[4, 1, 2],
|
|
52
|
+
[4, 2, 7],
|
|
53
|
+
[4, 3, 8],
|
|
54
|
+
[4, 4, 9],
|
|
55
|
+
[5, 0, 2],
|
|
56
|
+
[5, 1, 2],
|
|
57
|
+
[5, 2, 3],
|
|
58
|
+
[5, 3, 4],
|
|
59
|
+
[5, 4, 7],
|
|
60
|
+
[6, 0, 6],
|
|
61
|
+
[6, 1, 5],
|
|
62
|
+
[6, 2, 3],
|
|
63
|
+
[6, 3, 1],
|
|
64
|
+
[6, 4, 2]
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
const data = model.data.map(function (item) {
|
|
68
|
+
return [item[1], item[0], item[2] || '-']
|
|
69
|
+
})
|
|
70
|
+
const option = {
|
|
71
|
+
tooltip: {
|
|
72
|
+
position: 'top'
|
|
73
|
+
},
|
|
74
|
+
animation: false,
|
|
75
|
+
grid: {
|
|
76
|
+
bottom: 60,
|
|
77
|
+
top: 10,
|
|
78
|
+
left: 80
|
|
79
|
+
},
|
|
80
|
+
xAxis: {
|
|
81
|
+
type: 'category',
|
|
82
|
+
data: model.xCates
|
|
83
|
+
},
|
|
84
|
+
yAxis: {
|
|
85
|
+
type: 'category',
|
|
86
|
+
data: model.yCates
|
|
87
|
+
},
|
|
88
|
+
visualMap: {
|
|
89
|
+
min: 1,
|
|
90
|
+
max: 10,
|
|
91
|
+
show: false,
|
|
92
|
+
calculable: true,
|
|
93
|
+
orient: 'horizontal',
|
|
94
|
+
left: 'center',
|
|
95
|
+
bottom: 10,
|
|
96
|
+
inRange: {
|
|
97
|
+
color: [
|
|
98
|
+
'#37A2DA',
|
|
99
|
+
'#32C5E9',
|
|
100
|
+
'#67E0E3',
|
|
101
|
+
'#91F2DE',
|
|
102
|
+
'#FFDB5C',
|
|
103
|
+
'#FF9F7F'
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
series: [
|
|
108
|
+
{
|
|
109
|
+
name: 'Punch Card',
|
|
110
|
+
type: 'heatmap',
|
|
111
|
+
data: data,
|
|
112
|
+
label: {
|
|
113
|
+
normal: {
|
|
114
|
+
show: true
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
itemStyle: {
|
|
118
|
+
emphasis: {
|
|
119
|
+
shadowBlur: 10,
|
|
120
|
+
shadowColor: 'rgba(0, 0, 0, 0.5)'
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
chart.setOption(option)
|
|
127
|
+
return chart
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export default {
|
|
131
|
+
name: 'MlEcharts',
|
|
132
|
+
props: {
|
|
133
|
+
options: Object,
|
|
134
|
+
height: String,
|
|
135
|
+
width: String,
|
|
136
|
+
lazyLoad: Boolean,
|
|
137
|
+
formatLegend: Function,
|
|
138
|
+
className: String
|
|
139
|
+
},
|
|
140
|
+
components: {
|
|
141
|
+
ecCanvas
|
|
142
|
+
},
|
|
143
|
+
data () {
|
|
144
|
+
return {
|
|
145
|
+
canvasId: 'dsfsdf',
|
|
146
|
+
ec: {
|
|
147
|
+
onInit: initChart
|
|
148
|
+
},
|
|
149
|
+
options10: {
|
|
150
|
+
grid: {
|
|
151
|
+
top: '10%',
|
|
152
|
+
bottom: '20%'
|
|
153
|
+
},
|
|
154
|
+
xAxis: {
|
|
155
|
+
type: 'category',
|
|
156
|
+
data: ['开发', '测试', '设计师', '产品', '运维']
|
|
157
|
+
},
|
|
158
|
+
yAxis: {
|
|
159
|
+
type: 'value'
|
|
160
|
+
},
|
|
161
|
+
series: [
|
|
162
|
+
{
|
|
163
|
+
data: [32, 8, 2, 12, 4],
|
|
164
|
+
type: 'bar',
|
|
165
|
+
barWidth: 20
|
|
166
|
+
}
|
|
167
|
+
]
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
methods: {
|
|
172
|
+
initChart
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
</script>
|
|
176
|
+
|
|
177
|
+
<style lang="scss">
|
|
178
|
+
.ml-canvas {
|
|
179
|
+
width: 100%;
|
|
180
|
+
height: 100%;
|
|
181
|
+
}
|
|
182
|
+
</style>
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
export default class WxCanvas {
|
|
3
|
+
constructor(ctx, canvasId) {
|
|
4
|
+
this.ctx = ctx;
|
|
5
|
+
this.canvasId = canvasId;
|
|
6
|
+
this.chart = null; // this._initCanvas(zrender, ctx);
|
|
7
|
+
|
|
8
|
+
this._initStyle(ctx);
|
|
9
|
+
|
|
10
|
+
this._initEvent();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
getContext(contextType) {
|
|
14
|
+
if (contextType === "2d") {
|
|
15
|
+
return this.ctx;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
setChart(chart) {
|
|
20
|
+
this.chart = chart;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
attachEvent() {
|
|
24
|
+
// noop
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
detachEvent() {
|
|
28
|
+
// noop
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
_initCanvas(zrender, ctx) {
|
|
32
|
+
zrender.util.getContext = function() {
|
|
33
|
+
return ctx;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
zrender.util.$override("measureText", function(text, font) {
|
|
37
|
+
ctx.font = font || "12px sans-serif";
|
|
38
|
+
return ctx.measureText(text);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
_initStyle(ctx) {
|
|
43
|
+
var styles = [
|
|
44
|
+
"fillStyle",
|
|
45
|
+
"strokeStyle",
|
|
46
|
+
"globalAlpha",
|
|
47
|
+
"textAlign",
|
|
48
|
+
"textBaseAlign",
|
|
49
|
+
"shadow",
|
|
50
|
+
"lineWidth",
|
|
51
|
+
"lineCap",
|
|
52
|
+
"lineJoin",
|
|
53
|
+
"lineDash",
|
|
54
|
+
"miterLimit",
|
|
55
|
+
"fontSize"
|
|
56
|
+
];
|
|
57
|
+
styles.forEach(style => {
|
|
58
|
+
Object.defineProperty(ctx, style, {
|
|
59
|
+
set: value => {
|
|
60
|
+
if (
|
|
61
|
+
(style !== "fillStyle" && style !== "strokeStyle") ||
|
|
62
|
+
(value !== "none" && value !== null)
|
|
63
|
+
) {
|
|
64
|
+
ctx[
|
|
65
|
+
"set" +
|
|
66
|
+
style.charAt(0).toUpperCase() +
|
|
67
|
+
style.slice(1)
|
|
68
|
+
](value);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
ctx.createRadialGradient = (...p) => {
|
|
75
|
+
return ctx.createCircularGradient(...p);
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
_initEvent() {
|
|
80
|
+
this.event = {};
|
|
81
|
+
const eventNames = [
|
|
82
|
+
{
|
|
83
|
+
wxName: "touchStart",
|
|
84
|
+
ecName: "mousedown"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
wxName: "touchMove",
|
|
88
|
+
ecName: "mousemove"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
wxName: "touchEnd",
|
|
92
|
+
ecName: "mouseup"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
wxName: "touchEnd",
|
|
96
|
+
ecName: "click"
|
|
97
|
+
}
|
|
98
|
+
];
|
|
99
|
+
eventNames.forEach(name => {
|
|
100
|
+
console.log(name)
|
|
101
|
+
console.log(this.event)
|
|
102
|
+
this.event[name.wxName] = e => {
|
|
103
|
+
const touch = e.touches[0];
|
|
104
|
+
this.chart.getZr().handler.dispatch(name.ecName, {
|
|
105
|
+
zrX: name.wxName === "tap" ? touch.clientX : touch.x,
|
|
106
|
+
zrY: name.wxName === "tap" ? touch.clientY : touch.y
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import * as echarts from './echarts.simple.min.js'
|
|
2
|
-
import { getAppDpr } from '../../../utils'
|
|
3
|
-
|
|
4
|
-
/* eslint-disable */
|
|
5
|
-
|
|
6
|
-
// #ifdef MP-ALIPAY
|
|
7
|
-
const eInit = echarts.init
|
|
8
|
-
echarts.init = function (p1, p2, opts = {}) {
|
|
9
|
-
opts.devicePixelRatio = opts.devicePixelRatio || getAppDpr()
|
|
10
|
-
return eInit.call(this, p1, p2, opts)
|
|
11
|
-
}
|
|
12
|
-
// #endif
|
|
13
|
-
|
|
14
|
-
export default echarts
|
|
1
|
+
import * as echarts from './echarts.simple.min.js'
|
|
2
|
+
import { getAppDpr } from '../../../utils'
|
|
3
|
+
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
|
|
6
|
+
// #ifdef MP-ALIPAY
|
|
7
|
+
const eInit = echarts.init
|
|
8
|
+
echarts.init = function (p1, p2, opts = {}) {
|
|
9
|
+
opts.devicePixelRatio = opts.devicePixelRatio || getAppDpr()
|
|
10
|
+
return eInit.call(this, p1, p2, opts)
|
|
11
|
+
}
|
|
12
|
+
// #endif
|
|
13
|
+
|
|
14
|
+
export default echarts
|