evui 3.1.38 → 3.1.42
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 +2699 -970
- package/dist/evui.common.js.map +1 -1
- package/dist/evui.umd.js +2699 -970
- 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/calendar/Calendar.vue +194 -82
- package/src/components/calendar/uses.js +457 -138
- package/src/components/chart/chart.core.js +27 -23
- package/src/components/chart/element/element.bar.js +28 -20
- package/src/components/chart/element/element.line.js +13 -0
- package/src/components/chart/helpers/helpers.constant.js +27 -0
- package/src/components/chart/helpers/helpers.util.js +2 -2
- package/src/components/chart/plugins/plugins.interaction.js +5 -5
- package/src/components/chart/plugins/plugins.legend.js +6 -3
- package/src/components/chart/plugins/plugins.tooltip.js +14 -1
- package/src/components/chart/scale/scale.js +520 -56
- package/src/components/chart/scale/scale.linear.js +8 -0
- package/src/components/chart/scale/scale.logarithmic.js +8 -0
- package/src/components/chart/scale/scale.step.js +148 -69
- package/src/components/chart/scale/scale.time.category.js +8 -0
- package/src/components/chart/scale/scale.time.js +8 -0
- package/src/components/chart/uses.js +2 -2
- package/src/components/contextMenu/MenuList.vue +1 -1
- package/src/components/datePicker/DatePicker.vue +91 -29
- package/src/components/datePicker/uses.js +231 -21
- package/src/components/grid/Grid.vue +15 -10
- package/src/components/tabs/Tabs.vue +12 -11
- package/src/components/treeGrid/TreeGrid.vue +56 -2
- package/src/components/treeGrid/TreeGridNode.vue +10 -1
- package/src/components/treeGrid/treeGrid.toolbar.vue +26 -0
- package/src/components/treeGrid/uses.js +66 -6
|
@@ -441,38 +441,42 @@ class EvChart {
|
|
|
441
441
|
let lh = 0;
|
|
442
442
|
|
|
443
443
|
axesX.forEach((axis, index) => {
|
|
444
|
-
|
|
445
|
-
|
|
444
|
+
if (axis.labelStyle?.show) {
|
|
445
|
+
lw = range.x[index].size.width + labelBuffer.width;
|
|
446
|
+
lh = range.x[index].size.height + labelBuffer.height;
|
|
446
447
|
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
448
|
+
if (axis.position === 'bottom') {
|
|
449
|
+
if (lh > labelOffset.bottom) {
|
|
450
|
+
labelOffset.bottom = lh;
|
|
451
|
+
}
|
|
452
|
+
} else if (axis.position === 'top') {
|
|
453
|
+
if (lh > labelOffset.top) {
|
|
454
|
+
labelOffset.top = lh;
|
|
455
|
+
}
|
|
454
456
|
}
|
|
455
|
-
}
|
|
456
457
|
|
|
457
|
-
|
|
458
|
-
|
|
458
|
+
labelOffset.left = (lw / 2) > labelOffset.left ? (lw / 2) : labelOffset.left;
|
|
459
|
+
labelOffset.right = (lw / 2) > labelOffset.right ? (lw / 2) : labelOffset.right;
|
|
460
|
+
}
|
|
459
461
|
});
|
|
460
462
|
|
|
461
463
|
axesY.forEach((axis, index) => {
|
|
462
|
-
|
|
464
|
+
if (axis.labelStyle?.show) {
|
|
465
|
+
lw = Math.max(range.y[index].size.width + labelBuffer.width, 42 + labelBuffer.width);
|
|
463
466
|
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
467
|
+
if (axis.position === 'left') {
|
|
468
|
+
if (lw > labelOffset.left) {
|
|
469
|
+
labelOffset.left = lw;
|
|
470
|
+
}
|
|
471
|
+
} else if (axis.position === 'right') {
|
|
472
|
+
if (lw > labelOffset.right) {
|
|
473
|
+
labelOffset.right = lw;
|
|
474
|
+
}
|
|
471
475
|
}
|
|
472
|
-
}
|
|
473
476
|
|
|
474
|
-
|
|
475
|
-
|
|
477
|
+
labelOffset.top = (lh / 2) > labelOffset.top ? (lh / 2) : labelOffset.top;
|
|
478
|
+
labelOffset.bottom = (lh / 2) > labelOffset.bottom ? (lh / 2) : labelOffset.bottom;
|
|
479
|
+
}
|
|
476
480
|
});
|
|
477
481
|
|
|
478
482
|
return labelOffset;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { defaultsDeep } from 'lodash-es';
|
|
2
|
-
import { numberWithComma } from '@/common/utils';
|
|
3
2
|
import { COLOR, BAR_OPTION } from '../helpers/helpers.constant';
|
|
4
3
|
import Canvas from '../helpers/helpers.canvas';
|
|
5
4
|
import Util from '../helpers/helpers.util';
|
|
@@ -333,67 +332,76 @@ class Bar {
|
|
|
333
332
|
*/
|
|
334
333
|
drawValueLabels({ context, data, positions, isHighlight }) {
|
|
335
334
|
const isHorizontal = this.isHorizontal;
|
|
336
|
-
const
|
|
335
|
+
const { fontSize, textColor, align, formatter } = this.showValue;
|
|
337
336
|
const { x, y, w, h } = positions;
|
|
338
337
|
const ctx = context;
|
|
339
338
|
|
|
340
339
|
ctx.save();
|
|
341
340
|
ctx.beginPath();
|
|
342
341
|
|
|
342
|
+
ctx.font = `normal normal normal ${fontSize}px Roboto`;
|
|
343
|
+
ctx.fillStyle = textColor;
|
|
344
|
+
ctx.lineWidth = 1;
|
|
345
|
+
ctx.textBaseline = 'middle';
|
|
346
|
+
ctx.textAlign = isHorizontal && align !== 'center' ? 'left' : 'center';
|
|
347
|
+
|
|
343
348
|
let value;
|
|
344
349
|
const isStacked = !isNaN(data.o);
|
|
345
350
|
if (data.o === null) {
|
|
346
|
-
value =
|
|
351
|
+
value = isHorizontal ? data.x : data.y;
|
|
347
352
|
} else if (isStacked) {
|
|
348
|
-
value =
|
|
353
|
+
value = data.o;
|
|
349
354
|
} else {
|
|
350
355
|
value = '';
|
|
351
356
|
}
|
|
352
357
|
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
+
let formattedTxt;
|
|
359
|
+
if (formatter) {
|
|
360
|
+
formattedTxt = formatter(value);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
if (!formatter || typeof formattedTxt !== 'string') {
|
|
364
|
+
formattedTxt = Util.labelSignFormat(value);
|
|
365
|
+
}
|
|
358
366
|
|
|
359
|
-
const vw = Math.round(ctx.measureText(
|
|
360
|
-
const vh =
|
|
367
|
+
const vw = Math.round(ctx.measureText(formattedTxt).width);
|
|
368
|
+
const vh = fontSize + 4;
|
|
361
369
|
const minXPos = x + 10;
|
|
362
370
|
const minYPos = y - 10;
|
|
363
371
|
const centerX = x + (w / 2) <= minXPos ? minXPos : x + (w / 2);
|
|
364
372
|
const centerY = y + (h / 2) >= minYPos ? minYPos : y + (h / 2);
|
|
365
373
|
const centerYHorizontal = isHighlight ? y + (h / 2) : y - (h / 2);
|
|
366
374
|
|
|
367
|
-
switch (
|
|
375
|
+
switch (align) {
|
|
368
376
|
case 'start':
|
|
369
377
|
if (isHorizontal) {
|
|
370
|
-
ctx.fillText(
|
|
378
|
+
ctx.fillText(formattedTxt, minXPos, centerYHorizontal);
|
|
371
379
|
} else {
|
|
372
|
-
ctx.fillText(
|
|
380
|
+
ctx.fillText(formattedTxt, centerX, minYPos);
|
|
373
381
|
}
|
|
374
382
|
break;
|
|
375
383
|
case 'center':
|
|
376
384
|
if (isHorizontal) {
|
|
377
|
-
ctx.fillText(
|
|
385
|
+
ctx.fillText(formattedTxt, centerX, centerYHorizontal);
|
|
378
386
|
} else {
|
|
379
|
-
ctx.fillText(
|
|
387
|
+
ctx.fillText(formattedTxt, centerX, centerY);
|
|
380
388
|
}
|
|
381
389
|
break;
|
|
382
390
|
case 'out':
|
|
383
391
|
if (isHorizontal) {
|
|
384
|
-
ctx.fillText(
|
|
392
|
+
ctx.fillText(formattedTxt, minXPos + w, centerYHorizontal);
|
|
385
393
|
} else {
|
|
386
|
-
ctx.fillText(
|
|
394
|
+
ctx.fillText(formattedTxt, centerX, y + h - (vh / 2));
|
|
387
395
|
}
|
|
388
396
|
break;
|
|
389
397
|
case 'end':
|
|
390
398
|
default:
|
|
391
399
|
if (isHorizontal) {
|
|
392
400
|
const xPos = x + w - (vw * 2);
|
|
393
|
-
ctx.fillText(
|
|
401
|
+
ctx.fillText(formattedTxt, xPos <= minXPos ? minXPos : xPos, centerYHorizontal);
|
|
394
402
|
} else {
|
|
395
403
|
const yPos = y + h + vh;
|
|
396
|
-
ctx.fillText(
|
|
404
|
+
ctx.fillText(formattedTxt, centerX, yPos >= minYPos ? minYPos : yPos);
|
|
397
405
|
}
|
|
398
406
|
break;
|
|
399
407
|
}
|
|
@@ -303,6 +303,19 @@ class Line {
|
|
|
303
303
|
|
|
304
304
|
return item;
|
|
305
305
|
}
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Returns items in range
|
|
309
|
+
* @param {object} params range values
|
|
310
|
+
*
|
|
311
|
+
* @returns {array}
|
|
312
|
+
*/
|
|
313
|
+
findItems({ xsp, width }) {
|
|
314
|
+
console.log(this.data);
|
|
315
|
+
const xep = xsp + width;
|
|
316
|
+
|
|
317
|
+
return this.data.filter(seriesData => (xsp - 1 <= seriesData.xp) && (seriesData.xp <= xep + 1));
|
|
318
|
+
}
|
|
306
319
|
}
|
|
307
320
|
|
|
308
321
|
export default Line;
|
|
@@ -58,6 +58,7 @@ export const BAR_OPTION = {
|
|
|
58
58
|
use: false,
|
|
59
59
|
fontSize: 12,
|
|
60
60
|
textColor: '#000000',
|
|
61
|
+
formatter: null,
|
|
61
62
|
},
|
|
62
63
|
};
|
|
63
64
|
|
|
@@ -86,6 +87,7 @@ export const AXIS_OPTION = {
|
|
|
86
87
|
interval: null,
|
|
87
88
|
decimalPoint: null,
|
|
88
89
|
labelStyle: {
|
|
90
|
+
show: true,
|
|
89
91
|
fontSize: 12,
|
|
90
92
|
color: '#25262E',
|
|
91
93
|
fontFamily: 'Roboto',
|
|
@@ -95,6 +97,31 @@ export const AXIS_OPTION = {
|
|
|
95
97
|
},
|
|
96
98
|
};
|
|
97
99
|
|
|
100
|
+
export const PLOT_LINE_OPTION = {
|
|
101
|
+
color: '#FF0000',
|
|
102
|
+
lineWidth: 1,
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export const PLOT_LINE_LABEL_OPTION = {
|
|
106
|
+
show: false,
|
|
107
|
+
fontSize: 12,
|
|
108
|
+
fontColor: '#FF0000',
|
|
109
|
+
fillColor: '#FFFFFF',
|
|
110
|
+
lineColor: '#FF0000',
|
|
111
|
+
lineWidth: 0,
|
|
112
|
+
fontWeight: 400,
|
|
113
|
+
fontFamily: 'Roboto',
|
|
114
|
+
verticalAlign: 'middle',
|
|
115
|
+
textAlign: 'center',
|
|
116
|
+
textOverflow: 'none', // 'none', 'ellipsis'
|
|
117
|
+
maxWidth: null,
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export const PLOT_BAND_OPTION = {
|
|
121
|
+
color: '#FAE59D',
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
|
|
98
125
|
export const TIME_INTERVALS = {
|
|
99
126
|
millisecond: {
|
|
100
127
|
common: true,
|
|
@@ -133,11 +133,11 @@ export default {
|
|
|
133
133
|
/**
|
|
134
134
|
* Create sign format with number
|
|
135
135
|
* @param {number} value graph value
|
|
136
|
-
* @param {
|
|
136
|
+
* @param {number} decimalPoint decimal point
|
|
137
137
|
*
|
|
138
138
|
* @returns {string} signed value
|
|
139
139
|
*/
|
|
140
|
-
labelSignFormat(value, decimalPoint) {
|
|
140
|
+
labelSignFormat(value, decimalPoint = 0) {
|
|
141
141
|
const quad = quadrillion(1);
|
|
142
142
|
const trill = trillion(1);
|
|
143
143
|
const billi = billions(1);
|
|
@@ -146,8 +146,8 @@ const modules = {
|
|
|
146
146
|
this.onMouseDown = (e) => {
|
|
147
147
|
const { dragSelection, type } = this.options;
|
|
148
148
|
|
|
149
|
-
if (dragSelection.use && type === 'scatter') {
|
|
150
|
-
this.dragStart(e);
|
|
149
|
+
if (dragSelection.use && (type === 'scatter' || type === 'line')) {
|
|
150
|
+
this.dragStart(e, type);
|
|
151
151
|
}
|
|
152
152
|
};
|
|
153
153
|
|
|
@@ -174,7 +174,7 @@ const modules = {
|
|
|
174
174
|
*
|
|
175
175
|
* @returns {undefined}
|
|
176
176
|
*/
|
|
177
|
-
dragStart(evt) {
|
|
177
|
+
dragStart(evt, type) {
|
|
178
178
|
const [offsetX, offsetY] = this.getMousePosition(evt);
|
|
179
179
|
const chartRect = this.chartRect;
|
|
180
180
|
const labelOffset = this.labelOffset;
|
|
@@ -231,9 +231,9 @@ const modules = {
|
|
|
231
231
|
}
|
|
232
232
|
|
|
233
233
|
dragInfo.xsp = Math.min(xcp, xep);
|
|
234
|
-
dragInfo.ysp = Math.min(ycp, yep);
|
|
234
|
+
dragInfo.ysp = type === 'scatter' ? Math.min(ycp, yep) : aRange.y1;
|
|
235
235
|
dragInfo.width = Math.ceil(Math.abs(xep - xcp));
|
|
236
|
-
dragInfo.height = Math.ceil(Math.abs(yep - ycp));
|
|
236
|
+
dragInfo.height = type === 'scatter' ? Math.ceil(Math.abs(yep - ycp)) : aRange.y2 - aRange.y1;
|
|
237
237
|
|
|
238
238
|
this.overlayClear();
|
|
239
239
|
this.drawSelectionArea(dragInfo);
|
|
@@ -313,15 +313,18 @@ const modules = {
|
|
|
313
313
|
|
|
314
314
|
let chartRect;
|
|
315
315
|
const title = opt?.title?.show ? opt?.title?.height : 0;
|
|
316
|
-
const
|
|
316
|
+
const positionTop = title + opt?.legend?.height;
|
|
317
|
+
const { top = 0, bottom = 0, left = 0, right = 0 } = opt?.legend?.padding ?? {};
|
|
317
318
|
|
|
318
319
|
if (!wrapperStyle || !legendStyle) {
|
|
319
320
|
return;
|
|
320
321
|
}
|
|
321
322
|
|
|
323
|
+
boxStyle.padding = `${top}px ${right}px ${bottom}px ${left}px`;
|
|
324
|
+
|
|
322
325
|
switch (position) {
|
|
323
326
|
case 'top':
|
|
324
|
-
wrapperStyle.padding = `${
|
|
327
|
+
wrapperStyle.padding = `${positionTop}px 0 0 0`;
|
|
325
328
|
chartRect = this.chartDOM.getBoundingClientRect();
|
|
326
329
|
|
|
327
330
|
boxStyle.width = '100%';
|
|
@@ -335,7 +338,7 @@ const modules = {
|
|
|
335
338
|
legendStyle.width = `${chartRect.width}px`;
|
|
336
339
|
legendStyle.height = `${opt.legend.height + 4}px`; // 4 resize bar size
|
|
337
340
|
|
|
338
|
-
resizeStyle.top = `${
|
|
341
|
+
resizeStyle.top = `${positionTop}px`;
|
|
339
342
|
resizeStyle.right = '';
|
|
340
343
|
resizeStyle.bottom = '';
|
|
341
344
|
resizeStyle.left = '';
|
|
@@ -301,8 +301,21 @@ const modules = {
|
|
|
301
301
|
ctx.save();
|
|
302
302
|
|
|
303
303
|
// 3. Draw value
|
|
304
|
+
let formattedTxt;
|
|
305
|
+
if (opt.formatter) {
|
|
306
|
+
formattedTxt = opt.formatter({
|
|
307
|
+
x: this.options.horizontal ? value : hitItem.x,
|
|
308
|
+
y: this.options.horizontal ? hitItem.y : value,
|
|
309
|
+
name,
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
if (!opt.formatter || typeof formattedTxt !== 'string') {
|
|
314
|
+
formattedTxt = numberWithComma(value);
|
|
315
|
+
}
|
|
316
|
+
|
|
304
317
|
ctx.textAlign = 'right';
|
|
305
|
-
ctx.fillText(
|
|
318
|
+
ctx.fillText(formattedTxt, this.tooltipDOM.offsetWidth - boxPadding.r, itemY);
|
|
306
319
|
ctx.restore();
|
|
307
320
|
ctx.closePath();
|
|
308
321
|
|