evui 3.3.8 → 3.3.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/dist/evui.common.js +2982 -792
- package/dist/evui.common.js.map +1 -1
- package/dist/evui.umd.js +2982 -792
- package/dist/evui.umd.js.map +1 -1
- package/dist/evui.umd.min.js +1 -1
- package/dist/evui.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/chart/Chart.vue +15 -6
- package/src/components/chart/chart.core.js +86 -31
- package/src/components/chart/element/element.bar.js +9 -3
- package/src/components/chart/element/element.heatmap.js +213 -0
- package/src/components/chart/element/element.pie.js +75 -5
- package/src/components/chart/element/element.scatter.js +26 -9
- package/src/components/chart/element/element.tip.js +158 -13
- package/src/components/chart/helpers/helpers.constant.js +22 -0
- package/src/components/chart/model/model.series.js +4 -0
- package/src/components/chart/model/model.store.js +166 -2
- package/src/components/chart/plugins/plugins.interaction.js +78 -10
- package/src/components/chart/plugins/plugins.legend.js +213 -42
- package/src/components/chart/plugins/plugins.pie.js +2 -0
- package/src/components/chart/plugins/plugins.tooltip.js +249 -6
- package/src/components/chart/scale/scale.js +20 -2
- package/src/components/chart/scale/scale.step.js +20 -5
- package/src/components/chart/scale/scale.time.category.js +20 -2
- package/src/components/chart/uses.js +20 -3
- package/src/components/grid/Grid.vue +276 -132
- package/src/components/grid/grid.filter.window.vue +1 -0
- package/src/components/grid/grid.pagination.vue +75 -0
- package/src/components/grid/grid.summary.vue +221 -0
- package/src/components/grid/style/grid.scss +0 -14
- package/src/components/grid/uses.js +157 -78
- package/src/components/pagination/Pagination.vue +20 -17
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="grid-pagination">
|
|
3
|
+
<ev-pagination
|
|
4
|
+
v-model="currentValue"
|
|
5
|
+
:total="total"
|
|
6
|
+
:per-page="perPage"
|
|
7
|
+
:visible-page="visiblePage"
|
|
8
|
+
:show-page-info="showPageInfo"
|
|
9
|
+
:order="order"
|
|
10
|
+
@change="changePage"
|
|
11
|
+
>
|
|
12
|
+
</ev-pagination>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script>
|
|
17
|
+
import { ref, watch } from 'vue';
|
|
18
|
+
|
|
19
|
+
export default {
|
|
20
|
+
name: 'EvGridPagination',
|
|
21
|
+
props: {
|
|
22
|
+
total: {
|
|
23
|
+
type: [Number, String],
|
|
24
|
+
default: 0,
|
|
25
|
+
},
|
|
26
|
+
visiblePage: {
|
|
27
|
+
type: [Number, String],
|
|
28
|
+
default: 8,
|
|
29
|
+
},
|
|
30
|
+
perPage: {
|
|
31
|
+
type: [Number, String],
|
|
32
|
+
default: 20,
|
|
33
|
+
},
|
|
34
|
+
modelValue: {
|
|
35
|
+
type: [Number, String],
|
|
36
|
+
default: 1,
|
|
37
|
+
},
|
|
38
|
+
showPageInfo: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: false,
|
|
41
|
+
},
|
|
42
|
+
order: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: 'left',
|
|
45
|
+
validator: val => ['left', 'right', 'center'].includes(val),
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
emits: {
|
|
49
|
+
'update:modelValue': null,
|
|
50
|
+
},
|
|
51
|
+
setup(props, { emit }) {
|
|
52
|
+
const currentValue = ref(props.modelValue);
|
|
53
|
+
const changePage = (page) => {
|
|
54
|
+
currentValue.value = page > 0 ? page : 1;
|
|
55
|
+
emit('update:modelValue', currentValue.value);
|
|
56
|
+
};
|
|
57
|
+
watch(
|
|
58
|
+
() => props.modelValue,
|
|
59
|
+
(value) => {
|
|
60
|
+
currentValue.value = value;
|
|
61
|
+
},
|
|
62
|
+
);
|
|
63
|
+
return {
|
|
64
|
+
currentValue,
|
|
65
|
+
changePage,
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
</script>
|
|
70
|
+
|
|
71
|
+
<style lang="scss" scoped>
|
|
72
|
+
.grid-pagination {
|
|
73
|
+
padding-top: 8px;
|
|
74
|
+
}
|
|
75
|
+
</style>
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:class="{
|
|
4
|
+
'grid-summary': true,
|
|
5
|
+
'non-border': styleInfo.borderStyle === 'none',
|
|
6
|
+
}"
|
|
7
|
+
>
|
|
8
|
+
<ul class="column-list">
|
|
9
|
+
<li
|
|
10
|
+
v-if="showCheckbox"
|
|
11
|
+
:class="{
|
|
12
|
+
'column': true,
|
|
13
|
+
'non-border': !!styleInfo.borderStyle,
|
|
14
|
+
}"
|
|
15
|
+
:style="{
|
|
16
|
+
'width': `${styleInfo.minWidth}px`,
|
|
17
|
+
'line-height': `${styleInfo.rowHeight}px`
|
|
18
|
+
}"
|
|
19
|
+
>
|
|
20
|
+
<span :style="{'height': `${styleInfo.rowHeight}px`}" />
|
|
21
|
+
</li>
|
|
22
|
+
<template
|
|
23
|
+
v-for="(column, index) in columns"
|
|
24
|
+
:key="`summary_${index}`"
|
|
25
|
+
>
|
|
26
|
+
<li
|
|
27
|
+
v-if="!column.hide"
|
|
28
|
+
:class="{
|
|
29
|
+
column: true,
|
|
30
|
+
'non-border': !!styleInfo.borderStyle,
|
|
31
|
+
[column.type]: column.type,
|
|
32
|
+
[column.align]: column.align,
|
|
33
|
+
}"
|
|
34
|
+
:style="{
|
|
35
|
+
width: `${column.width}px`,
|
|
36
|
+
'min-width': `${styleInfo.minWidth}px`,
|
|
37
|
+
'line-height': `${styleInfo.rowHeight}px`,
|
|
38
|
+
}"
|
|
39
|
+
>
|
|
40
|
+
<span
|
|
41
|
+
v-if="column.summaryType || column.summaryRenderer"
|
|
42
|
+
:style="{
|
|
43
|
+
width: '100%',
|
|
44
|
+
height: `${styleInfo.rowHeight}px`,
|
|
45
|
+
}"
|
|
46
|
+
>
|
|
47
|
+
<template v-if="column.summaryRenderer">
|
|
48
|
+
{{ getSummaryRenderer(column) }}
|
|
49
|
+
</template>
|
|
50
|
+
<template v-else>
|
|
51
|
+
{{ getSummaryValue(column, column.summaryType)}}
|
|
52
|
+
</template>
|
|
53
|
+
</span>
|
|
54
|
+
<span
|
|
55
|
+
v-else
|
|
56
|
+
:style="{'height': `${styleInfo.rowHeight}px`}"
|
|
57
|
+
/>
|
|
58
|
+
</li>
|
|
59
|
+
</template>
|
|
60
|
+
</ul>
|
|
61
|
+
</div>
|
|
62
|
+
</template>
|
|
63
|
+
|
|
64
|
+
<script>
|
|
65
|
+
import { computed } from 'vue';
|
|
66
|
+
import { numberWithComma } from '@/common/utils';
|
|
67
|
+
|
|
68
|
+
export default {
|
|
69
|
+
name: 'EvGridSummary',
|
|
70
|
+
props: {
|
|
71
|
+
stores: {
|
|
72
|
+
type: Object,
|
|
73
|
+
default: () => ({}),
|
|
74
|
+
},
|
|
75
|
+
orderedColumns: {
|
|
76
|
+
type: Object,
|
|
77
|
+
default: () => ({}),
|
|
78
|
+
},
|
|
79
|
+
useCheckbox: {
|
|
80
|
+
type: Boolean,
|
|
81
|
+
default: false,
|
|
82
|
+
},
|
|
83
|
+
styleOption: {
|
|
84
|
+
type: Object,
|
|
85
|
+
default: () => ({}),
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
setup(props) {
|
|
89
|
+
const ROW_DATA_INDEX = 2;
|
|
90
|
+
const stores = computed(() => props.stores);
|
|
91
|
+
const columns = computed(() => props.orderedColumns);
|
|
92
|
+
const showCheckbox = computed(() => props.useCheckbox);
|
|
93
|
+
const styleInfo = computed(() => props.styleOption);
|
|
94
|
+
const getConvertValue = (column, value) => {
|
|
95
|
+
let convertValue = value;
|
|
96
|
+
|
|
97
|
+
if (column.type === 'number') {
|
|
98
|
+
convertValue = numberWithComma(value);
|
|
99
|
+
convertValue = convertValue === false ? value : convertValue;
|
|
100
|
+
} else if (column.type === 'float') {
|
|
101
|
+
convertValue = convertValue.toFixed(column.decimal ?? 3);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return convertValue;
|
|
105
|
+
};
|
|
106
|
+
const getColumnIndex = field => columns.value.findIndex(column => column.field === field);
|
|
107
|
+
const getSummaryValue = (column, summaryType) => {
|
|
108
|
+
let result = '';
|
|
109
|
+
const columnIndex = getColumnIndex(column.field);
|
|
110
|
+
if (columnIndex >= 0) {
|
|
111
|
+
if (summaryType === 'count') {
|
|
112
|
+
return stores.value.store.length;
|
|
113
|
+
}
|
|
114
|
+
if (column.type === 'number' || column.type === 'float') {
|
|
115
|
+
const columnValues = stores.value.store.map(rows => rows[ROW_DATA_INDEX][columnIndex]);
|
|
116
|
+
switch (summaryType) {
|
|
117
|
+
case 'sum':
|
|
118
|
+
result = columnValues.reduce((prev, curr) => {
|
|
119
|
+
const value = Number(curr);
|
|
120
|
+
if (!Number.isNaN(value)) {
|
|
121
|
+
return prev + curr;
|
|
122
|
+
}
|
|
123
|
+
return prev;
|
|
124
|
+
}, 0);
|
|
125
|
+
break;
|
|
126
|
+
case 'average':
|
|
127
|
+
result = columnValues.reduce((prev, curr) => {
|
|
128
|
+
const value = Number(curr);
|
|
129
|
+
if (!Number.isNaN(value)) {
|
|
130
|
+
return prev + curr;
|
|
131
|
+
}
|
|
132
|
+
return prev;
|
|
133
|
+
}, 0) / columnValues.length;
|
|
134
|
+
if (result % 1 !== 0) {
|
|
135
|
+
result = result.toFixed(1);
|
|
136
|
+
}
|
|
137
|
+
break;
|
|
138
|
+
case 'max':
|
|
139
|
+
result = Math.max(...columnValues);
|
|
140
|
+
break;
|
|
141
|
+
case 'min':
|
|
142
|
+
result = Math.min(...columnValues);
|
|
143
|
+
break;
|
|
144
|
+
default:
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
result = getConvertValue(column, result);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return result;
|
|
151
|
+
};
|
|
152
|
+
const getSummaryRenderer = (column) => {
|
|
153
|
+
const str = column.summaryRenderer;
|
|
154
|
+
const summaryData = column.summaryData ? column.summaryData : [];
|
|
155
|
+
const fields = [column.field, ...summaryData];
|
|
156
|
+
let result = str;
|
|
157
|
+
fields.forEach((name, idx) => {
|
|
158
|
+
const columnIndex = getColumnIndex(name);
|
|
159
|
+
if (columnIndex >= 0) {
|
|
160
|
+
const value = getSummaryValue(
|
|
161
|
+
stores.value.orderedColumns[columnIndex],
|
|
162
|
+
column.summaryType,
|
|
163
|
+
);
|
|
164
|
+
result = result.replace(`{${idx}}`, value);
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
return result;
|
|
168
|
+
};
|
|
169
|
+
return {
|
|
170
|
+
columns,
|
|
171
|
+
styleInfo,
|
|
172
|
+
showCheckbox,
|
|
173
|
+
getSummaryValue,
|
|
174
|
+
getSummaryRenderer,
|
|
175
|
+
};
|
|
176
|
+
},
|
|
177
|
+
};
|
|
178
|
+
</script>
|
|
179
|
+
|
|
180
|
+
<style lang="scss" scoped>
|
|
181
|
+
@import 'style/grid.scss';
|
|
182
|
+
.grid-summary {
|
|
183
|
+
background-color: #F8F9F9;
|
|
184
|
+
border-bottom: 1px solid #CFCFCF;
|
|
185
|
+
.non-border {
|
|
186
|
+
border-bottom: none !important;
|
|
187
|
+
}
|
|
188
|
+
span {
|
|
189
|
+
display: inline-block;
|
|
190
|
+
overflow: hidden;
|
|
191
|
+
text-overflow: ellipsis;
|
|
192
|
+
font-size: 14px;
|
|
193
|
+
color: #737373;
|
|
194
|
+
}
|
|
195
|
+
.column {
|
|
196
|
+
&.number,
|
|
197
|
+
&.float {
|
|
198
|
+
text-align: right;
|
|
199
|
+
}
|
|
200
|
+
&.string,
|
|
201
|
+
&.stringNumber {
|
|
202
|
+
text-align: left;
|
|
203
|
+
}
|
|
204
|
+
&.center {
|
|
205
|
+
text-align: center;
|
|
206
|
+
}
|
|
207
|
+
&.left {
|
|
208
|
+
text-align: left;
|
|
209
|
+
.wrap {
|
|
210
|
+
justify-content: flex-start;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
&.right {
|
|
214
|
+
text-align: right;
|
|
215
|
+
.wrap {
|
|
216
|
+
justify-content: flex-end;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
</style>
|
|
@@ -71,11 +71,6 @@
|
|
|
71
71
|
font-size: 13px;
|
|
72
72
|
color: #005CC8;
|
|
73
73
|
}
|
|
74
|
-
&.db-icon, &.user-icon {
|
|
75
|
-
width: 42px !important;
|
|
76
|
-
min-width: 42px !important;
|
|
77
|
-
border-right: 0;
|
|
78
|
-
}
|
|
79
74
|
}
|
|
80
75
|
|
|
81
76
|
.column-name {
|
|
@@ -229,14 +224,6 @@
|
|
|
229
224
|
&:last-child {
|
|
230
225
|
border-right: 0;
|
|
231
226
|
}
|
|
232
|
-
&.user-icon {
|
|
233
|
-
height: auto !important;
|
|
234
|
-
}
|
|
235
|
-
&.db-icon, &.user-icon {
|
|
236
|
-
width: 42px !important;
|
|
237
|
-
min-width: 42px !important;
|
|
238
|
-
border-right: 0;
|
|
239
|
-
}
|
|
240
227
|
}
|
|
241
228
|
}
|
|
242
229
|
|
|
@@ -271,4 +258,3 @@
|
|
|
271
258
|
height: 30px;
|
|
272
259
|
text-align: center;
|
|
273
260
|
}
|
|
274
|
-
|