@bizy/core 20.4.0 → 20.4.2
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/fesm2022/bizy-core.mjs +42 -38
- package/fesm2022/bizy-core.mjs.map +1 -1
- package/index.d.ts +3 -2
- package/package.json +1 -1
- package/styles/variables.css +4 -0
package/fesm2022/bizy-core.mjs
CHANGED
|
@@ -313,9 +313,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.5", ngImpor
|
|
|
313
313
|
}]
|
|
314
314
|
}] });
|
|
315
315
|
|
|
316
|
-
const MIN_CHART_SIZE = 350; // px;
|
|
317
316
|
const Y_AXIS_OFFSET = 80;
|
|
318
317
|
const GRID_BOTTOM = 30;
|
|
318
|
+
const DEFAULT_CHART_SIZE$2 = '300px';
|
|
319
319
|
class BizyBarLineChartComponent {
|
|
320
320
|
#elementRef = inject(ElementRef);
|
|
321
321
|
#document = inject(DOCUMENT);
|
|
@@ -323,7 +323,7 @@ class BizyBarLineChartComponent {
|
|
|
323
323
|
#renderer = inject(Renderer2);
|
|
324
324
|
resizeRef = null;
|
|
325
325
|
tooltip = true;
|
|
326
|
-
download = {
|
|
326
|
+
download = { show: true, label: 'Descargar', name: 'Bizy' };
|
|
327
327
|
axisPointer = 'line';
|
|
328
328
|
xAxisLabels = [];
|
|
329
329
|
onTooltipFormatter;
|
|
@@ -331,7 +331,6 @@ class BizyBarLineChartComponent {
|
|
|
331
331
|
onDownload = new EventEmitter();
|
|
332
332
|
onSelect = new EventEmitter();
|
|
333
333
|
#echarts = null;
|
|
334
|
-
#mutationObserver = null;
|
|
335
334
|
#resizeObserver = null;
|
|
336
335
|
#subscription = new Subscription();
|
|
337
336
|
#chartContainer = null;
|
|
@@ -343,14 +342,9 @@ class BizyBarLineChartComponent {
|
|
|
343
342
|
#chartStacks = [];
|
|
344
343
|
#chartNames = [];
|
|
345
344
|
ngAfterViewInit() {
|
|
346
|
-
this.#
|
|
347
|
-
if (this.#elementRef && this.#elementRef.nativeElement && (this.#elementRef.nativeElement.offsetWidth || this.#elementRef.nativeElement.offsetHeight)) {
|
|
348
|
-
this.#afterViewInit.next(true);
|
|
349
|
-
this.#mutationObserver.disconnect();
|
|
350
|
-
}
|
|
351
|
-
});
|
|
352
|
-
this.#mutationObserver.observe(this.#document.body, { childList: true, subtree: true });
|
|
345
|
+
this.#afterViewInit.next(true);
|
|
353
346
|
}
|
|
347
|
+
getNativeElement = () => this.#elementRef?.nativeElement;
|
|
354
348
|
set data(data) {
|
|
355
349
|
if (!data) {
|
|
356
350
|
return;
|
|
@@ -496,14 +490,14 @@ class BizyBarLineChartComponent {
|
|
|
496
490
|
bottom: 0,
|
|
497
491
|
data: legends
|
|
498
492
|
};
|
|
499
|
-
const textColor =
|
|
500
|
-
const textBackgroundColor =
|
|
501
|
-
const borderColor =
|
|
493
|
+
const textColor = this.#getClosestCssVariable(this.#elementRef.nativeElement, '--bizy-bar-line-chart-tooltip-color');
|
|
494
|
+
const textBackgroundColor = this.#getClosestCssVariable(this.#elementRef.nativeElement, '--bizy-bar-line-chart-tooltip-background-color');
|
|
495
|
+
const borderColor = this.#getClosestCssVariable(this.#elementRef.nativeElement, '--bizy-bar-line-chart-tooltip-border-color');
|
|
502
496
|
const toolbox = {
|
|
503
497
|
show: true,
|
|
504
498
|
feature: {
|
|
505
499
|
mySaveAsImage: {
|
|
506
|
-
show:
|
|
500
|
+
show: this.download.show,
|
|
507
501
|
icon: 'path://M288 32c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 242.7-73.4-73.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l128 128c12.5 12.5 32.8 12.5 45.3 0l128-128c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L288 274.7 288 32zM64 352c-35.3 0-64 28.7-64 64l0 32c0 35.3 28.7 64 64 64l384 0c35.3 0 64-28.7 64-64l0-32c0-35.3-28.7-64-64-64l-101.5 0-45.3 45.3c-25 25-65.5 25-90.5 0L165.5 352 64 352zm368 56a24 24 0 1 1 0 48 24 24 0 1 1 0-48z',
|
|
508
502
|
title: this.download.label,
|
|
509
503
|
onclick: () => {
|
|
@@ -532,7 +526,7 @@ class BizyBarLineChartComponent {
|
|
|
532
526
|
showAllLegends(this.#echarts);
|
|
533
527
|
setTimeout(() => {
|
|
534
528
|
html2canvas(this.#chartContainer).then(canvas => {
|
|
535
|
-
var link =
|
|
529
|
+
var link = this.#renderer.createElement('a');
|
|
536
530
|
link.href = canvas.toDataURL('image/png');
|
|
537
531
|
link.download = `${this.download.name}.png`;
|
|
538
532
|
this.#renderer.appendChild(this.#document.body, link);
|
|
@@ -592,23 +586,15 @@ class BizyBarLineChartComponent {
|
|
|
592
586
|
if (this.#chartContainer || !this.#elementRef || !this.#elementRef.nativeElement) {
|
|
593
587
|
return;
|
|
594
588
|
}
|
|
595
|
-
let elementWidth = this.#elementRef.nativeElement.offsetWidth
|
|
596
|
-
let elementHeight = this.#elementRef.nativeElement.offsetHeight
|
|
597
|
-
let minWidth =
|
|
598
|
-
let minHeight =
|
|
599
|
-
const
|
|
600
|
-
const
|
|
601
|
-
if (Number(barChartMinWidth)) {
|
|
602
|
-
minWidth = Number(barChartMinWidth);
|
|
603
|
-
}
|
|
604
|
-
if (Number(barChartMinHeight)) {
|
|
605
|
-
minHeight = Number(barChartMinHeight);
|
|
606
|
-
}
|
|
607
|
-
const width = Math.max(elementWidth, minWidth);
|
|
608
|
-
const height = Math.max(elementHeight, minHeight);
|
|
589
|
+
let elementWidth = this.#elementRef.nativeElement.offsetWidth;
|
|
590
|
+
let elementHeight = this.#elementRef.nativeElement.offsetHeight;
|
|
591
|
+
let minWidth = this.#getClosestCssVariable(this.#elementRef.nativeElement, '--bizy-bar-line-chart-width');
|
|
592
|
+
let minHeight = this.#getClosestCssVariable(this.#elementRef.nativeElement, '--bizy-bar-line-chart-height');
|
|
593
|
+
const width = minWidth ? minWidth : elementWidth ? `${elementWidth}px` : DEFAULT_CHART_SIZE$2;
|
|
594
|
+
const height = minHeight ? minHeight : elementHeight ? `${elementHeight}px` : DEFAULT_CHART_SIZE$2;
|
|
609
595
|
this.#chartContainer = this.#renderer.createElement('div');
|
|
610
|
-
this.#renderer.setStyle(this.#chartContainer, 'width',
|
|
611
|
-
this.#renderer.setStyle(this.#chartContainer, 'height',
|
|
596
|
+
this.#renderer.setStyle(this.#chartContainer, 'width', width);
|
|
597
|
+
this.#renderer.setStyle(this.#chartContainer, 'height', height);
|
|
612
598
|
this.#renderer.appendChild(this.#elementRef.nativeElement, this.#chartContainer);
|
|
613
599
|
this.#ref.detectChanges();
|
|
614
600
|
};
|
|
@@ -621,12 +607,19 @@ class BizyBarLineChartComponent {
|
|
|
621
607
|
this.#chartContainer = null;
|
|
622
608
|
this.#ref.detectChanges();
|
|
623
609
|
};
|
|
624
|
-
|
|
610
|
+
#getClosestCssVariable = (element, cssVariable) => {
|
|
611
|
+
while (element) {
|
|
612
|
+
const value = getComputedStyle(element).getPropertyValue(cssVariable).trim();
|
|
613
|
+
if (value) {
|
|
614
|
+
return value;
|
|
615
|
+
}
|
|
616
|
+
element = element.parentElement;
|
|
617
|
+
}
|
|
618
|
+
const rootValue = getComputedStyle(this.#document.documentElement).getPropertyValue(cssVariable).trim();
|
|
619
|
+
return rootValue;
|
|
620
|
+
};
|
|
625
621
|
ngOnDestroy() {
|
|
626
622
|
this.#subscription.unsubscribe();
|
|
627
|
-
if (this.#mutationObserver) {
|
|
628
|
-
this.#mutationObserver.disconnect();
|
|
629
|
-
}
|
|
630
623
|
if (this.#resizeObserver) {
|
|
631
624
|
this.#resizeObserver.disconnect();
|
|
632
625
|
}
|
|
@@ -3133,7 +3126,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.5", ngImpor
|
|
|
3133
3126
|
}]
|
|
3134
3127
|
}] });
|
|
3135
3128
|
|
|
3136
|
-
const EMPTY_CHART$1 = [0];
|
|
3137
3129
|
const DEFAULT_CHART_SIZE$1 = '300px';
|
|
3138
3130
|
class BizyHeatMapChartComponent {
|
|
3139
3131
|
#elementRef = inject(ElementRef);
|
|
@@ -3157,10 +3149,11 @@ class BizyHeatMapChartComponent {
|
|
|
3157
3149
|
#chartContainer = null;
|
|
3158
3150
|
#afterViewInit = new BehaviorSubject(false);
|
|
3159
3151
|
#resize$ = new Subject();
|
|
3160
|
-
#data =
|
|
3152
|
+
#data = [];
|
|
3161
3153
|
ngAfterViewInit() {
|
|
3162
3154
|
this.#afterViewInit.next(true);
|
|
3163
3155
|
}
|
|
3156
|
+
getNativeElement = () => this.#elementRef?.nativeElement;
|
|
3164
3157
|
set data(data) {
|
|
3165
3158
|
if (!data) {
|
|
3166
3159
|
return;
|
|
@@ -6316,7 +6309,7 @@ class BizyTableScrollingComponent {
|
|
|
6316
6309
|
return;
|
|
6317
6310
|
}
|
|
6318
6311
|
let itemSize = 30;
|
|
6319
|
-
const rowHeight =
|
|
6312
|
+
const rowHeight = this.#getClosestCssVariable(this.#elementRef.nativeElement, '--anura-table-row-height');
|
|
6320
6313
|
const fontSize = getComputedStyle(this.#document.documentElement).getPropertyValue('font-size');
|
|
6321
6314
|
const gap = Number(fontSize.split('px')[0]) * 0.1;
|
|
6322
6315
|
if (rowHeight && rowHeight.includes('rem')) {
|
|
@@ -6342,6 +6335,17 @@ class BizyTableScrollingComponent {
|
|
|
6342
6335
|
}));
|
|
6343
6336
|
}
|
|
6344
6337
|
getNativeElement = () => this.#elementRef?.nativeElement;
|
|
6338
|
+
#getClosestCssVariable = (element, cssVariable) => {
|
|
6339
|
+
while (element) {
|
|
6340
|
+
const value = getComputedStyle(element).getPropertyValue(cssVariable).trim();
|
|
6341
|
+
if (value) {
|
|
6342
|
+
return value;
|
|
6343
|
+
}
|
|
6344
|
+
element = element.parentElement;
|
|
6345
|
+
}
|
|
6346
|
+
const rootValue = getComputedStyle(this.#document.documentElement).getPropertyValue(cssVariable).trim();
|
|
6347
|
+
return rootValue || null;
|
|
6348
|
+
};
|
|
6345
6349
|
ngOnDestroy() {
|
|
6346
6350
|
this.#subscription.unsubscribe();
|
|
6347
6351
|
}
|