evui 3.4.29 → 3.4.30
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 +223 -179
- package/dist/evui.common.js.map +1 -1
- package/dist/evui.umd.js +223 -179
- 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 +1 -1
- package/src/components/chart/chart.core.js +5 -1
- package/src/components/chart/helpers/helpers.constant.js +1 -0
- package/src/components/chart/helpers/helpers.util.js +3 -2
- package/src/components/chart/plugins/plugins.tooltip.js +30 -11
- package/src/components/chart/scale/scale.js +5 -1
- package/src/components/chart/style/chart.scss +1 -1
- package/src/components/chart/uses.js +1 -0
- package/src/components/timePicker/TimePicker.vue +44 -50
package/package.json
CHANGED
|
@@ -253,7 +253,7 @@
|
|
|
253
253
|
|
|
254
254
|
watch(() => props.realTimeScatterReset, (flag) => {
|
|
255
255
|
if (flag) {
|
|
256
|
-
Object.keys(evChart.dataSet).forEach((series) => {
|
|
256
|
+
Object.keys(evChart.dataSet ?? {}).forEach((series) => {
|
|
257
257
|
if (evChart.dataSet[series]) {
|
|
258
258
|
evChart.dataSet[series].dataGroup = [];
|
|
259
259
|
}
|
|
@@ -246,7 +246,7 @@ class EvChart {
|
|
|
246
246
|
const chartTypeSet = this.seriesInfo.charts[chartType];
|
|
247
247
|
|
|
248
248
|
for (let jx = 0; jx < chartTypeSet.length; jx++) {
|
|
249
|
-
|
|
249
|
+
let series = this.seriesList[chartTypeSet[jx]];
|
|
250
250
|
|
|
251
251
|
switch (chartType) {
|
|
252
252
|
case 'line': {
|
|
@@ -327,6 +327,10 @@ class EvChart {
|
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
329
|
|
|
330
|
+
if (this.options.realTimeScatter?.use) {
|
|
331
|
+
series = this.seriesList[chartTypeSet.at(-1 - jx)];
|
|
332
|
+
}
|
|
333
|
+
|
|
330
334
|
series.draw({
|
|
331
335
|
legendHitInfo,
|
|
332
336
|
selectInfo,
|
|
@@ -184,12 +184,13 @@ export default {
|
|
|
184
184
|
* Calculate text size with html
|
|
185
185
|
* @param {string} text text is needed to check size
|
|
186
186
|
* @param {string} fontStyle text font style
|
|
187
|
+
* @param {number} padding user define text padding
|
|
187
188
|
*
|
|
188
189
|
* @returns {object} text size information
|
|
189
190
|
*/
|
|
190
|
-
calcTextSize(text, fontStyle) {
|
|
191
|
+
calcTextSize(text, fontStyle, padding = 0) {
|
|
191
192
|
const calc = document.createElement('span');
|
|
192
|
-
const style = `visibility:hidden; position:absolute; top:-10000px; font: ${fontStyle}
|
|
193
|
+
const style = `visibility:hidden; position:absolute; top:-10000px; font: ${fontStyle}; padding: 0 ${padding}px`;
|
|
193
194
|
|
|
194
195
|
calc.setAttribute('style', style);
|
|
195
196
|
calc.style.font = fontStyle;
|
|
@@ -3,8 +3,8 @@ import debounce from '@/common/utils.debounce';
|
|
|
3
3
|
import Canvas from '../helpers/helpers.canvas';
|
|
4
4
|
import Util from '../helpers/helpers.util';
|
|
5
5
|
|
|
6
|
-
const TITLE_HEIGHT =
|
|
7
|
-
const TEXT_HEIGHT =
|
|
6
|
+
const TITLE_HEIGHT = 35;
|
|
7
|
+
const TEXT_HEIGHT = 20;
|
|
8
8
|
const LINE_SPACING = 8;
|
|
9
9
|
const COLOR_MARGIN = 16;
|
|
10
10
|
const VALUE_MARGIN = 50;
|
|
@@ -77,7 +77,7 @@ const modules = {
|
|
|
77
77
|
const [maxSeries, maxValue] = hitInfo.maxTip;
|
|
78
78
|
const seriesKeys = Object.keys(items);
|
|
79
79
|
const seriesLen = seriesKeys.length;
|
|
80
|
-
const boxPadding = { t:
|
|
80
|
+
const boxPadding = { t: 10, b: 4, r: 20, l: 16 };
|
|
81
81
|
const opt = this.options.tooltip;
|
|
82
82
|
|
|
83
83
|
|
|
@@ -169,6 +169,24 @@ const modules = {
|
|
|
169
169
|
: `${expectedPosY}px`;
|
|
170
170
|
},
|
|
171
171
|
|
|
172
|
+
/**
|
|
173
|
+
* Draw series color shape
|
|
174
|
+
* @param {object} context tooltip canvas context
|
|
175
|
+
* @param {string} shape // 'circle' | 'rect' (default)
|
|
176
|
+
* @param {object} centerPosition // {x: number, y: number}
|
|
177
|
+
*/
|
|
178
|
+
drawSeriesColorShape(context, shape, centerPosition) {
|
|
179
|
+
const { x, y } = centerPosition;
|
|
180
|
+
|
|
181
|
+
if (shape === 'circle') {
|
|
182
|
+
context.beginPath();
|
|
183
|
+
context.arc(x - 2, y - 4, 6, 0, 2 * Math.PI);
|
|
184
|
+
context.fill();
|
|
185
|
+
} else {
|
|
186
|
+
context.fillRect(x - 4, y - 12, 12, 12);
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
|
|
172
190
|
/**
|
|
173
191
|
* Draw tooltip canvas
|
|
174
192
|
* @param {object} hitInfo mousemove callback
|
|
@@ -279,10 +297,10 @@ const modules = {
|
|
|
279
297
|
}
|
|
280
298
|
|
|
281
299
|
// 1. Draw series color
|
|
282
|
-
|
|
283
|
-
ctx.fillStyle = opt.fontColor;
|
|
300
|
+
this.drawSeriesColorShape(ctx, opt.colorShape, { x: itemX, y: itemY });
|
|
284
301
|
|
|
285
302
|
// 2. Draw series name
|
|
303
|
+
ctx.fillStyle = opt.fontColor?.label ?? opt.fontColor;
|
|
286
304
|
ctx.textBaseline = 'Bottom';
|
|
287
305
|
const seriesNameSpaceWidth = opt.maxWidth - Math.round(ctx.measureText(maxValue).width)
|
|
288
306
|
- boxPadding.l - boxPadding.r - COLOR_MARGIN - VALUE_MARGIN;
|
|
@@ -317,6 +335,7 @@ const modules = {
|
|
|
317
335
|
ctx.save();
|
|
318
336
|
|
|
319
337
|
// 3. Draw value
|
|
338
|
+
ctx.fillStyle = opt.fontColor?.value ?? opt.fontColor;
|
|
320
339
|
ctx.textAlign = 'right';
|
|
321
340
|
ctx.fillText(valueText, this.tooltipDOM.offsetWidth - boxPadding.r, itemY);
|
|
322
341
|
ctx.restore();
|
|
@@ -414,10 +433,10 @@ const modules = {
|
|
|
414
433
|
}
|
|
415
434
|
|
|
416
435
|
// 1. Draw value color
|
|
417
|
-
|
|
418
|
-
ctx.fillStyle = opt.fontColor;
|
|
436
|
+
this.drawSeriesColorShape(ctx, opt.colorShape, { x: itemX, y: itemY });
|
|
419
437
|
|
|
420
438
|
// 2. Draw value y names
|
|
439
|
+
ctx.fillStyle = opt.fontColor?.label ?? opt.fontColor;
|
|
421
440
|
ctx.textBaseline = 'Bottom';
|
|
422
441
|
if (this.axesY.length) {
|
|
423
442
|
ctx.fillText(this.axesY[hitAxis.y].getLabelFormat(hitItem.y), itemX + COLOR_MARGIN, itemY);
|
|
@@ -514,10 +533,10 @@ const modules = {
|
|
|
514
533
|
}
|
|
515
534
|
|
|
516
535
|
// 1. Draw series color
|
|
517
|
-
|
|
518
|
-
ctx.fillStyle = opt.fontColor;
|
|
536
|
+
this.drawSeriesColorShape(ctx, opt.colorShape, { x: itemX, y: itemY });
|
|
519
537
|
|
|
520
538
|
// 2. Draw series name
|
|
539
|
+
ctx.fillStyle = opt.fontColor?.label ?? opt.fontColor;
|
|
521
540
|
ctx.textBaseline = 'Bottom';
|
|
522
541
|
const seriesNameSpaceWidth = opt.maxWidth - Math.round(ctx.measureText(maxValue).width)
|
|
523
542
|
- boxPadding.l - boxPadding.r - COLOR_MARGIN - VALUE_MARGIN;
|
|
@@ -626,7 +645,7 @@ const modules = {
|
|
|
626
645
|
this.tooltipDOM.style.overflowY = 'hidden';
|
|
627
646
|
this.tooltipDOM.style.backgroundColor = opt.backgroundColor;
|
|
628
647
|
this.tooltipDOM.style.border = `1px solid ${opt.borderColor}`;
|
|
629
|
-
this.tooltipDOM.style.color = opt.fontColor;
|
|
648
|
+
this.tooltipDOM.style.color = opt.fontColor?.title ?? opt.fontColor;
|
|
630
649
|
}
|
|
631
650
|
},
|
|
632
651
|
|
|
@@ -638,7 +657,7 @@ const modules = {
|
|
|
638
657
|
this.tooltipDOM.style.overflowY = 'hidden';
|
|
639
658
|
this.tooltipDOM.style.backgroundColor = tooltipOptions.backgroundColor;
|
|
640
659
|
this.tooltipDOM.style.border = `1px solid ${tooltipOptions.borderColor}`;
|
|
641
|
-
this.tooltipDOM.style.color = tooltipOptions.fontColor;
|
|
660
|
+
this.tooltipDOM.style.color = tooltipOptions.fontColor?.title ?? tooltipOptions.fontColor;
|
|
642
661
|
|
|
643
662
|
if (tooltipOptions.useShadow) {
|
|
644
663
|
const shadowColor = `rgba(0, 0, 0, ${tooltipOptions.shadowOpacity})`;
|
|
@@ -105,7 +105,11 @@ class Scale {
|
|
|
105
105
|
max: maxValue,
|
|
106
106
|
minLabel,
|
|
107
107
|
maxLabel,
|
|
108
|
-
size: Util.calcTextSize(
|
|
108
|
+
size: Util.calcTextSize(
|
|
109
|
+
maxLabel,
|
|
110
|
+
Util.getLabelStyle(this.labelStyle),
|
|
111
|
+
this.labelStyle?.padding,
|
|
112
|
+
),
|
|
109
113
|
};
|
|
110
114
|
}
|
|
111
115
|
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
class="ev-time-picker-wrapper"
|
|
15
15
|
>
|
|
16
16
|
<input
|
|
17
|
-
v-model="
|
|
17
|
+
v-model="time[0]"
|
|
18
18
|
class="ev-input"
|
|
19
19
|
:disabled="disabled"
|
|
20
20
|
:readonly="readonly"
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
class="ev-time-picker-wrapper"
|
|
46
46
|
>
|
|
47
47
|
<input
|
|
48
|
-
v-model="
|
|
48
|
+
v-model="time[1]"
|
|
49
49
|
class="ev-input"
|
|
50
50
|
:disabled="disabled"
|
|
51
51
|
:readonly="readonly"
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
</template>
|
|
106
106
|
|
|
107
107
|
<script>
|
|
108
|
-
import { ref, reactive } from 'vue';
|
|
108
|
+
import { ref, reactive, computed } from 'vue';
|
|
109
109
|
|
|
110
110
|
export default {
|
|
111
111
|
name: 'EvTimePicker',
|
|
@@ -115,7 +115,7 @@ export default {
|
|
|
115
115
|
default: '',
|
|
116
116
|
validator: (time) => {
|
|
117
117
|
const timeRegexExp = /^(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/;
|
|
118
|
-
if (Array.isArray(time) && !timeRegexExp.test(time[0])
|
|
118
|
+
if (Array.isArray(time) && (!timeRegexExp.test(time[0]) || !timeRegexExp.test(time[1]))) {
|
|
119
119
|
// range mode
|
|
120
120
|
console.warn('Please check the time format in the Timepicker.');
|
|
121
121
|
return false;
|
|
@@ -152,58 +152,60 @@ export default {
|
|
|
152
152
|
change: null,
|
|
153
153
|
},
|
|
154
154
|
setup(props, { emit }) {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
155
|
+
const time = computed({
|
|
156
|
+
get: () => props.modelValue,
|
|
157
|
+
set: (value) => {
|
|
158
|
+
if (props.type === 'range') {
|
|
159
|
+
if (Array.isArray(value)) {
|
|
160
|
+
const startTime = (value[0] > value[1] ? '00:00' : value[0]);
|
|
161
|
+
const endTime = (startTime.value > value[1] ? '23:59' : value[1]);
|
|
162
|
+
|
|
163
|
+
emit('update:modelValue', [startTime, endTime]);
|
|
164
|
+
}
|
|
165
|
+
} else {
|
|
166
|
+
emit('update:modelValue', value);
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
}); // <string | string[]>
|
|
170
|
+
|
|
171
|
+
const previousValue = ref(
|
|
172
|
+
Array.isArray(time.value) ? [`${time.value[0]}`, `${time.value[1]}`] : `${time.value}`,
|
|
173
|
+
); // <string | string[]>
|
|
174
|
+
|
|
158
175
|
const isWrongType = reactive({
|
|
159
176
|
single: false,
|
|
160
177
|
rangeStart: false,
|
|
161
178
|
rangeEnd: false,
|
|
162
179
|
});
|
|
163
180
|
|
|
164
|
-
if (props.type === 'range') {
|
|
165
|
-
if (Array.isArray(props.modelValue)) {
|
|
166
|
-
startTime = ref(props.modelValue[0] > props.modelValue[1] ? '00:00' : props.modelValue[0]);
|
|
167
|
-
endTime = ref(startTime.value > props.modelValue[1] ? '23:59' : props.modelValue[1]);
|
|
168
|
-
}
|
|
169
|
-
emit('update:modelValue', [startTime.value, endTime.value]);
|
|
170
|
-
} else {
|
|
171
|
-
time = ref(props.modelValue || '00:00');
|
|
172
|
-
emit('update:modelValue', time.value);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
const previousValue = reactive({
|
|
176
|
-
singleTime: time.value,
|
|
177
|
-
rangeStartTime: startTime.value,
|
|
178
|
-
rangeEndTime: endTime.value,
|
|
179
|
-
});
|
|
180
|
-
|
|
181
181
|
const validTimeExp = (timeExp) => {
|
|
182
182
|
const timeRegexExp = /^(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/;
|
|
183
183
|
return timeRegexExp.test(timeExp);
|
|
184
184
|
};
|
|
185
185
|
|
|
186
186
|
const setValidStartTime = () => {
|
|
187
|
-
if (!
|
|
188
|
-
|
|
187
|
+
if (!Array.isArray(time.value)) return;
|
|
188
|
+
if (!validTimeExp(time.value[0])) {
|
|
189
|
+
time.value[0] = previousValue.value[0];
|
|
189
190
|
}
|
|
190
|
-
if (
|
|
191
|
-
|
|
191
|
+
if (time.value[1] && (time.value[0] > time.value[1])) {
|
|
192
|
+
time.value[0] = time.value[1];
|
|
192
193
|
}
|
|
193
|
-
previousValue.
|
|
194
|
+
previousValue.value[0] = time.value[0];
|
|
194
195
|
};
|
|
195
196
|
|
|
196
197
|
const setValidEndTime = () => {
|
|
197
|
-
if (!
|
|
198
|
-
|
|
198
|
+
if (!Array.isArray(time.value)) return;
|
|
199
|
+
if (!validTimeExp(time.value[1])) {
|
|
200
|
+
time.value[1] = previousValue.value[1];
|
|
199
201
|
}
|
|
200
|
-
if (
|
|
201
|
-
|
|
202
|
-
if (
|
|
203
|
-
|
|
202
|
+
if (time.value[0] && (time.value[0] > time.value[1])) {
|
|
203
|
+
time.value[1] = previousValue.value[1];
|
|
204
|
+
if (time.value[0] > previousValue.value[1]) {
|
|
205
|
+
time.value[1] = time.value[0];
|
|
204
206
|
}
|
|
205
207
|
}
|
|
206
|
-
previousValue.
|
|
208
|
+
previousValue.value[1] = time.value[1];
|
|
207
209
|
};
|
|
208
210
|
|
|
209
211
|
// startTime event for range type
|
|
@@ -218,14 +220,12 @@ export default {
|
|
|
218
220
|
const changeStartTime = (e) => {
|
|
219
221
|
setValidStartTime();
|
|
220
222
|
isWrongType.rangeStart = false;
|
|
221
|
-
emit('
|
|
222
|
-
emit('change', e, [startTime.value, endTime.value]);
|
|
223
|
+
emit('change', e, time.value);
|
|
223
224
|
};
|
|
224
225
|
|
|
225
226
|
const clearStartTime = () => {
|
|
226
|
-
|
|
227
|
+
time.value[0] = '';
|
|
227
228
|
isWrongType.rangeStart = true;
|
|
228
|
-
emit('update:modelValue', [startTime.value, endTime.value]);
|
|
229
229
|
};
|
|
230
230
|
|
|
231
231
|
// endTime event for range type
|
|
@@ -240,14 +240,12 @@ export default {
|
|
|
240
240
|
const changeEndTime = (e) => {
|
|
241
241
|
setValidEndTime();
|
|
242
242
|
isWrongType.rangeEnd = false;
|
|
243
|
-
emit('
|
|
244
|
-
emit('change', e, [startTime.value, endTime.value]);
|
|
243
|
+
emit('change', e, time.value);
|
|
245
244
|
};
|
|
246
245
|
|
|
247
246
|
const clearEndTime = () => {
|
|
248
|
-
|
|
247
|
+
time.value[1] = '';
|
|
249
248
|
isWrongType.rangeEnd = true;
|
|
250
|
-
emit('update:modelValue', [startTime.value, endTime.value]);
|
|
251
249
|
};
|
|
252
250
|
|
|
253
251
|
// event for single type
|
|
@@ -261,26 +259,22 @@ export default {
|
|
|
261
259
|
|
|
262
260
|
const changeTime = (e) => {
|
|
263
261
|
if (!validTimeExp(time.value)) {
|
|
264
|
-
time.value = previousValue.
|
|
262
|
+
time.value = previousValue.value;
|
|
265
263
|
} else {
|
|
266
|
-
previousValue.
|
|
264
|
+
previousValue.value = time.value;
|
|
267
265
|
}
|
|
268
266
|
|
|
269
267
|
isWrongType.single = !validTimeExp(time.value);
|
|
270
268
|
|
|
271
|
-
emit('update:modelValue', time.value);
|
|
272
269
|
emit('change', e, time.value);
|
|
273
270
|
};
|
|
274
271
|
|
|
275
272
|
const clearContents = () => {
|
|
276
273
|
time.value = '';
|
|
277
274
|
isWrongType.single = true;
|
|
278
|
-
emit('update:modelValue', time.value);
|
|
279
275
|
};
|
|
280
276
|
|
|
281
277
|
return {
|
|
282
|
-
startTime,
|
|
283
|
-
endTime,
|
|
284
278
|
time,
|
|
285
279
|
isWrongType,
|
|
286
280
|
previousValue,
|