@bizy/core 21.5.4 → 21.5.6
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 +91 -43
- package/fesm2022/bizy-core.mjs.map +1 -1
- package/package.json +1 -1
- package/types/bizy-core.d.ts +1 -0
package/fesm2022/bizy-core.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { inject, ChangeDetectorRef, ElementRef, EventEmitter, Output, Input, ChangeDetectionStrategy, Component, NgModule, Pipe, Renderer2, ViewChild, ViewContainerRef, RendererFactory2, Inject, Injectable, DOCUMENT as DOCUMENT$1, NgZone, ContentChildren, Directive, ContentChild, TemplateRef, HostListener } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/common';
|
|
4
4
|
import { CommonModule, DOCUMENT, registerLocaleData, DatePipe } from '@angular/common';
|
|
5
|
-
import { Subscription, Subject, debounceTime, distinctUntilChanged, BehaviorSubject, fromEvent, merge, take,
|
|
5
|
+
import { Subscription, Subject, debounceTime, distinctUntilChanged, BehaviorSubject, fromEvent, merge, take, throttleTime, interval, filter as filter$1, skip, auditTime } from 'rxjs';
|
|
6
6
|
import * as i3 from '@angular/cdk/dialog';
|
|
7
7
|
import { DIALOG_DATA, DialogRef, DialogModule, Dialog } from '@angular/cdk/dialog';
|
|
8
8
|
import * as i1$1 from '@angular/cdk/drag-drop';
|
|
@@ -10305,53 +10305,59 @@ class BizyBarLineChartComponent {
|
|
|
10305
10305
|
#barChartChangesSubscription = new Subscription();
|
|
10306
10306
|
#lineChartsSubscription = new Subscription();
|
|
10307
10307
|
#lineChartChangesSubscription = new Subscription();
|
|
10308
|
+
#renderSubscription = new Subscription();
|
|
10309
|
+
#render = new Subject();
|
|
10308
10310
|
#gridTop = 0;
|
|
10309
10311
|
#gridRight = 0;
|
|
10310
10312
|
#gridBottom = 0;
|
|
10311
10313
|
#gridLeft = 0;
|
|
10312
10314
|
#chartStacks = [];
|
|
10313
10315
|
#chartNames = [];
|
|
10316
|
+
#chartGroups = new Map();
|
|
10314
10317
|
ngAfterContentInit() {
|
|
10315
10318
|
import('echarts').then(echarts => {
|
|
10316
10319
|
this.#echarts = echarts;
|
|
10317
|
-
this
|
|
10320
|
+
this.#resizeObserver = new ResizeObserver(() => this.#resize$.next());
|
|
10321
|
+
const resizeRef = this.resizeRef ? this.resizeRef : this.#renderer.parentNode(this.#elementRef.nativeElement) ? this.#renderer.parentNode(this.#elementRef.nativeElement) : this.#elementRef.nativeElement;
|
|
10322
|
+
this.#resizeObserver.observe(resizeRef);
|
|
10323
|
+
this.#resizeSubscription = new Subscription();
|
|
10324
|
+
this.#resizeSubscription.add(this.#resize$.subscribe(() => {
|
|
10325
|
+
this.#render.next();
|
|
10326
|
+
}));
|
|
10318
10327
|
this.lineCharts.forEach(_lineChart => {
|
|
10319
10328
|
this.#lineChartChangesSubscription.add(_lineChart.changes$.subscribe(() => {
|
|
10320
|
-
this.
|
|
10329
|
+
this.#render.next();
|
|
10321
10330
|
}));
|
|
10322
10331
|
});
|
|
10323
10332
|
this.barCharts.forEach(_barChart => {
|
|
10324
10333
|
this.#barChartChangesSubscription.add(_barChart.changes$.subscribe(() => {
|
|
10325
|
-
this.
|
|
10334
|
+
this.#render.next();
|
|
10326
10335
|
}));
|
|
10327
10336
|
});
|
|
10328
|
-
this.#resizeObserver = new ResizeObserver(() => this.#resize$.next());
|
|
10329
|
-
const resizeRef = this.resizeRef ? this.resizeRef : this.#renderer.parentNode(this.#elementRef.nativeElement) ? this.#renderer.parentNode(this.#elementRef.nativeElement) : this.#elementRef.nativeElement;
|
|
10330
|
-
this.#resizeObserver.observe(resizeRef);
|
|
10331
|
-
this.#resizeSubscription = new Subscription();
|
|
10332
|
-
this.#resizeSubscription.add(this.#resize$.pipe(skip(1), auditTime(300), throttleTime(500)).subscribe(() => {
|
|
10333
|
-
this.render();
|
|
10334
|
-
}));
|
|
10335
10337
|
this.#barChartsSubscription.add(this.barCharts.changes.subscribe(_barCharts => {
|
|
10336
10338
|
this.#barChartChangesSubscription.unsubscribe();
|
|
10337
10339
|
this.#barChartChangesSubscription = new Subscription();
|
|
10338
|
-
this.
|
|
10340
|
+
this.#render.next();
|
|
10339
10341
|
_barCharts.forEach(_barChart => {
|
|
10340
10342
|
this.#barChartChangesSubscription.add(_barChart.changes$.subscribe(() => {
|
|
10341
|
-
this.
|
|
10343
|
+
this.#render.next();
|
|
10342
10344
|
}));
|
|
10343
10345
|
});
|
|
10344
10346
|
}));
|
|
10345
10347
|
this.#lineChartsSubscription.add(this.lineCharts.changes.subscribe(_lineCharts => {
|
|
10346
10348
|
this.#lineChartChangesSubscription.unsubscribe();
|
|
10347
10349
|
this.#lineChartChangesSubscription = new Subscription();
|
|
10348
|
-
this.
|
|
10350
|
+
this.#render.next();
|
|
10349
10351
|
_lineCharts.forEach(_lineChart => {
|
|
10350
10352
|
this.#lineChartChangesSubscription.add(_lineChart.changes$.subscribe(() => {
|
|
10351
|
-
this.
|
|
10353
|
+
this.#render.next();
|
|
10352
10354
|
}));
|
|
10353
10355
|
});
|
|
10354
10356
|
}));
|
|
10357
|
+
this.#renderSubscription.add(this.#render.asObservable().pipe(debounceTime(150), throttleTime(300)).subscribe(() => {
|
|
10358
|
+
this.render();
|
|
10359
|
+
}));
|
|
10360
|
+
this.#render.next();
|
|
10355
10361
|
});
|
|
10356
10362
|
}
|
|
10357
10363
|
getNativeElement = () => this.#elementRef?.nativeElement;
|
|
@@ -10374,6 +10380,7 @@ class BizyBarLineChartComponent {
|
|
|
10374
10380
|
const defaultYAxisColor = this.#getClosestCssVariable(this.#elementRef.nativeElement, '--bizy-bar-line-chart-y-axis-color');
|
|
10375
10381
|
const defaultXAxisColor = this.#getClosestCssVariable(this.#elementRef.nativeElement, '--bizy-bar-line-chart-x-axis-color');
|
|
10376
10382
|
this.lineCharts.forEach((_line, _i) => {
|
|
10383
|
+
let axisIndex = _i;
|
|
10377
10384
|
const lineXAxis = _line.xAxis;
|
|
10378
10385
|
const lineYAxis = _line.yAxis;
|
|
10379
10386
|
const xAxisType = !lineXAxis || typeof lineXAxis.independent === 'undefined' ? BIZY_BAR_LINE_CHART_AXIS_TYPE.INDEPENDENT : lineXAxis?.independent ? BIZY_BAR_LINE_CHART_AXIS_TYPE.INDEPENDENT : BIZY_BAR_LINE_CHART_AXIS_TYPE.DEPENDENT;
|
|
@@ -10387,6 +10394,15 @@ class BizyBarLineChartComponent {
|
|
|
10387
10394
|
const thereIsOtherVisibleYAxis = (position === BIZY_BAR_LINE_CHART_AXIS_POSITION.LEFT && this.#gridLeft > 0 || position === BIZY_BAR_LINE_CHART_AXIS_POSITION.RIGHT && this.#gridRight > 0);
|
|
10388
10395
|
const offset = show && thereIsOtherVisibleYAxis && typeof lineYAxis.offset !== 'undefined' ? lineYAxis.offset : show && thereIsOtherVisibleYAxis ? Y_AXIS_OFFSET : 0;
|
|
10389
10396
|
const color = _line.getYAxisColor() ? _line.getYAxisColor() : yAxisType === BIZY_BAR_LINE_CHART_AXIS_TYPE.DEPENDENT && _line.getColor() ? _line.getColor() : defaultYAxisColor;
|
|
10397
|
+
if (lineYAxis.group && yAxisType === BIZY_BAR_LINE_CHART_AXIS_TYPE.DEPENDENT) {
|
|
10398
|
+
const _axisIndex = this.#chartGroups.get(lineYAxis.group);
|
|
10399
|
+
if (_axisIndex) {
|
|
10400
|
+
axisIndex = _axisIndex;
|
|
10401
|
+
}
|
|
10402
|
+
else {
|
|
10403
|
+
this.#chartGroups.set(lineYAxis.group, this.#getRandomFourDigitsNumber());
|
|
10404
|
+
}
|
|
10405
|
+
}
|
|
10390
10406
|
yAxis.push({
|
|
10391
10407
|
type: yAxisType,
|
|
10392
10408
|
name: lineYAxis?.name,
|
|
@@ -10434,6 +10450,15 @@ class BizyBarLineChartComponent {
|
|
|
10434
10450
|
const thereIsOtherVisibleXAxis = (position === BIZY_BAR_LINE_CHART_AXIS_POSITION.TOP && this.#gridTop > 0 || position === BIZY_BAR_LINE_CHART_AXIS_POSITION.BOTTOM && this.#gridBottom > 0);
|
|
10435
10451
|
const offset = show && thereIsOtherVisibleXAxis && typeof lineXAxis.offset !== 'undefined' ? lineXAxis.offset : show && thereIsOtherVisibleXAxis ? X_AXIS_OFFSET : 0;
|
|
10436
10452
|
const color = _line.getXAxisColor() ? _line.getXAxisColor() : xAxisType === BIZY_BAR_LINE_CHART_AXIS_TYPE.DEPENDENT && _line.getColor() ? _line.getColor() : defaultXAxisColor;
|
|
10453
|
+
if (lineXAxis.group && xAxisType === BIZY_BAR_LINE_CHART_AXIS_TYPE.DEPENDENT) {
|
|
10454
|
+
const _axisIndex = this.#chartGroups.get(lineXAxis.group);
|
|
10455
|
+
if (_axisIndex) {
|
|
10456
|
+
axisIndex = _axisIndex;
|
|
10457
|
+
}
|
|
10458
|
+
else {
|
|
10459
|
+
this.#chartGroups.set(lineXAxis.group, this.#getRandomFourDigitsNumber());
|
|
10460
|
+
}
|
|
10461
|
+
}
|
|
10437
10462
|
xAxis.push({
|
|
10438
10463
|
type: xAxisType,
|
|
10439
10464
|
name: lineXAxis?.name,
|
|
@@ -10472,16 +10497,17 @@ class BizyBarLineChartComponent {
|
|
|
10472
10497
|
}
|
|
10473
10498
|
}
|
|
10474
10499
|
}
|
|
10475
|
-
|
|
10476
|
-
|
|
10477
|
-
|
|
10478
|
-
|
|
10479
|
-
|
|
10480
|
-
|
|
10500
|
+
if (axisIndex !== _i) {
|
|
10501
|
+
const _name = this.#chartNames.find(_name => _name === _line.name);
|
|
10502
|
+
if (_name) {
|
|
10503
|
+
const index = series.findIndex(_s => _s.name === _name);
|
|
10504
|
+
if (index !== -1) {
|
|
10505
|
+
axisIndex = index;
|
|
10506
|
+
}
|
|
10507
|
+
}
|
|
10508
|
+
else {
|
|
10509
|
+
this.#chartNames.push(_line.name);
|
|
10481
10510
|
}
|
|
10482
|
-
}
|
|
10483
|
-
else {
|
|
10484
|
-
this.#chartNames.push(_line.name);
|
|
10485
10511
|
}
|
|
10486
10512
|
series.push({
|
|
10487
10513
|
type: BIZY_BAR_LINE_CHART_TYPE.LINE,
|
|
@@ -10501,6 +10527,7 @@ class BizyBarLineChartComponent {
|
|
|
10501
10527
|
legends.add(_line.name);
|
|
10502
10528
|
});
|
|
10503
10529
|
this.barCharts.forEach((_bar, _i) => {
|
|
10530
|
+
let axisIndex = _i + this.lineCharts.length;
|
|
10504
10531
|
const barXAxis = _bar.xAxis;
|
|
10505
10532
|
const barYAxis = _bar.yAxis;
|
|
10506
10533
|
const xAxisType = !barXAxis || typeof barXAxis.independent === 'undefined' ? BIZY_BAR_LINE_CHART_AXIS_TYPE.INDEPENDENT : barXAxis?.independent ? BIZY_BAR_LINE_CHART_AXIS_TYPE.INDEPENDENT : BIZY_BAR_LINE_CHART_AXIS_TYPE.DEPENDENT;
|
|
@@ -10514,6 +10541,15 @@ class BizyBarLineChartComponent {
|
|
|
10514
10541
|
const thereIsOtherVisibleYAxis = (position === BIZY_BAR_LINE_CHART_AXIS_POSITION.LEFT && this.#gridLeft > 0 || position === BIZY_BAR_LINE_CHART_AXIS_POSITION.RIGHT && this.#gridRight > 0);
|
|
10515
10542
|
const offset = show && thereIsOtherVisibleYAxis && typeof barYAxis.offset !== 'undefined' ? barYAxis.offset : show && thereIsOtherVisibleYAxis ? Y_AXIS_OFFSET : 0;
|
|
10516
10543
|
const color = _bar.getYAxisColor() ? _bar.getYAxisColor() : yAxisType === BIZY_BAR_LINE_CHART_AXIS_TYPE.DEPENDENT && _bar.getColor() ? _bar.getColor() : defaultYAxisColor;
|
|
10544
|
+
if (barYAxis.group && yAxisType === BIZY_BAR_LINE_CHART_AXIS_TYPE.DEPENDENT) {
|
|
10545
|
+
const _axisIndex = this.#chartGroups.get(barYAxis.group);
|
|
10546
|
+
if (_axisIndex) {
|
|
10547
|
+
axisIndex = _axisIndex;
|
|
10548
|
+
}
|
|
10549
|
+
else {
|
|
10550
|
+
this.#chartGroups.set(barYAxis.group, this.#getRandomFourDigitsNumber());
|
|
10551
|
+
}
|
|
10552
|
+
}
|
|
10517
10553
|
yAxis.push({
|
|
10518
10554
|
type: yAxisType,
|
|
10519
10555
|
name: barYAxis?.name,
|
|
@@ -10562,6 +10598,15 @@ class BizyBarLineChartComponent {
|
|
|
10562
10598
|
const thereIsOtherVisibleXAxis = (position === BIZY_BAR_LINE_CHART_AXIS_POSITION.TOP && this.#gridTop > 0 || position === BIZY_BAR_LINE_CHART_AXIS_POSITION.BOTTOM && this.#gridBottom > 0);
|
|
10563
10599
|
const offset = show && thereIsOtherVisibleXAxis && typeof barXAxis.offset !== 'undefined' ? barXAxis.offset : show && thereIsOtherVisibleXAxis ? X_AXIS_OFFSET : 0;
|
|
10564
10600
|
const color = _bar.getXAxisColor() ? _bar.getXAxisColor() : xAxisType === BIZY_BAR_LINE_CHART_AXIS_TYPE.DEPENDENT && _bar.getColor() ? _bar.getColor() : defaultXAxisColor;
|
|
10601
|
+
if (barXAxis.group && xAxisType === BIZY_BAR_LINE_CHART_AXIS_TYPE.DEPENDENT) {
|
|
10602
|
+
const _axisIndex = this.#chartGroups.get(barXAxis.group);
|
|
10603
|
+
if (_axisIndex) {
|
|
10604
|
+
axisIndex = _axisIndex;
|
|
10605
|
+
}
|
|
10606
|
+
else {
|
|
10607
|
+
this.#chartGroups.set(barXAxis.group, this.#getRandomFourDigitsNumber());
|
|
10608
|
+
}
|
|
10609
|
+
}
|
|
10565
10610
|
xAxis.push({
|
|
10566
10611
|
type: xAxisType,
|
|
10567
10612
|
name: barXAxis?.name,
|
|
@@ -10601,29 +10646,30 @@ class BizyBarLineChartComponent {
|
|
|
10601
10646
|
}
|
|
10602
10647
|
}
|
|
10603
10648
|
}
|
|
10604
|
-
|
|
10605
|
-
|
|
10606
|
-
|
|
10607
|
-
|
|
10608
|
-
|
|
10609
|
-
|
|
10610
|
-
|
|
10649
|
+
if (axisIndex !== _i + this.lineCharts.length) {
|
|
10650
|
+
if (_bar.stack) {
|
|
10651
|
+
const _stack = this.#chartStacks.find(_stack => _stack === _bar.stack);
|
|
10652
|
+
if (_stack) {
|
|
10653
|
+
const index = series.findIndex(_s => _s.stack === _stack);
|
|
10654
|
+
if (index !== -1) {
|
|
10655
|
+
axisIndex = yAxisType === BIZY_BAR_LINE_CHART_AXIS_TYPE.DEPENDENT ? series[index].yAxisIndex : series[index].xAxisIndex;
|
|
10656
|
+
}
|
|
10611
10657
|
}
|
|
10612
|
-
|
|
10613
|
-
|
|
10614
|
-
this.#chartStacks.push(_bar.stack);
|
|
10615
|
-
}
|
|
10616
|
-
}
|
|
10617
|
-
else {
|
|
10618
|
-
const _name = this.#chartNames.find(_name => _name === _bar.name);
|
|
10619
|
-
if (_name) {
|
|
10620
|
-
const index = series.findIndex(_s => _s.name === _name);
|
|
10621
|
-
if (index !== -1) {
|
|
10622
|
-
axisIndex = index;
|
|
10658
|
+
else {
|
|
10659
|
+
this.#chartStacks.push(_bar.stack);
|
|
10623
10660
|
}
|
|
10624
10661
|
}
|
|
10625
10662
|
else {
|
|
10626
|
-
this.#chartNames.
|
|
10663
|
+
const _name = this.#chartNames.find(_name => _name === _bar.name);
|
|
10664
|
+
if (_name) {
|
|
10665
|
+
const index = series.findIndex(_s => _s.name === _name);
|
|
10666
|
+
if (index !== -1) {
|
|
10667
|
+
axisIndex = index;
|
|
10668
|
+
}
|
|
10669
|
+
}
|
|
10670
|
+
else {
|
|
10671
|
+
this.#chartNames.push(_bar.name);
|
|
10672
|
+
}
|
|
10627
10673
|
}
|
|
10628
10674
|
}
|
|
10629
10675
|
if (_bar.getMinHeight()) {
|
|
@@ -10785,12 +10831,14 @@ class BizyBarLineChartComponent {
|
|
|
10785
10831
|
const rootValue = getComputedStyle(document.documentElement).getPropertyValue(cssVariable).trim();
|
|
10786
10832
|
return rootValue || null;
|
|
10787
10833
|
};
|
|
10834
|
+
#getRandomFourDigitsNumber = () => Math.floor(1000 + Math.random() * 9000);
|
|
10788
10835
|
ngOnDestroy() {
|
|
10789
10836
|
this.#resizeSubscription.unsubscribe();
|
|
10790
10837
|
this.#barChartsSubscription.unsubscribe();
|
|
10791
10838
|
this.#barChartChangesSubscription.unsubscribe();
|
|
10792
10839
|
this.#lineChartsSubscription.unsubscribe();
|
|
10793
10840
|
this.#lineChartChangesSubscription.unsubscribe();
|
|
10841
|
+
this.#renderSubscription.unsubscribe();
|
|
10794
10842
|
if (this.#resizeObserver) {
|
|
10795
10843
|
this.#resizeObserver.disconnect();
|
|
10796
10844
|
}
|