@bizy/core 21.5.14 → 21.7.0

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.
@@ -2,12 +2,12 @@ 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, throttleTime, interval, filter as filter$1, skip, auditTime } from 'rxjs';
5
+ import { Subscription, Subject, debounceTime, distinctUntilChanged, BehaviorSubject, fromEvent, merge, take, throttleTime, interval, filter as filter$1, skip, auditTime, timer } 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';
9
9
  import { DragDropModule } from '@angular/cdk/drag-drop';
10
- import { debounceTime as debounceTime$1, map, filter, distinctUntilChanged as distinctUntilChanged$1, takeUntil, take as take$1 } from 'rxjs/operators';
10
+ import { debounceTime as debounceTime$1, map, filter, distinctUntilChanged as distinctUntilChanged$1, takeUntil, switchMap, tap, take as take$1 } from 'rxjs/operators';
11
11
  import * as i1$2 from '@angular/router';
12
12
  import { NavigationEnd, NavigationStart, Router } from '@angular/router';
13
13
  import validator from 'validator';
@@ -11953,6 +11953,59 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.5", ngImpor
11953
11953
  }]
11954
11954
  }] });
11955
11955
 
11956
+ class BizyDonutChartSectionComponent {
11957
+ #elementRef = inject(ElementRef);
11958
+ #document = inject(DOCUMENT);
11959
+ id = `bizy-donut-chart-section-${Math.random()}`;
11960
+ value = null;
11961
+ name = null;
11962
+ metadata = null;
11963
+ onSelect = new EventEmitter();
11964
+ #changes = new Subject();
11965
+ get changes$() {
11966
+ return this.#changes.asObservable();
11967
+ }
11968
+ ngOnChanges() {
11969
+ this.#changes.next();
11970
+ }
11971
+ #getClosestCssVariable = (element, cssVariable) => {
11972
+ while (element) {
11973
+ const value = getComputedStyle(element).getPropertyValue(cssVariable).trim();
11974
+ if (value) {
11975
+ return value;
11976
+ }
11977
+ element = element.parentElement;
11978
+ }
11979
+ const rootValue = getComputedStyle(this.#document.documentElement).getPropertyValue(cssVariable).trim();
11980
+ return rootValue || null;
11981
+ };
11982
+ getColor = () => this.#getClosestCssVariable(this.#elementRef.nativeElement, '--bizy-donut-chart-section-color');
11983
+ getNativeElement = () => this.#elementRef?.nativeElement;
11984
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: BizyDonutChartSectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
11985
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.5", type: BizyDonutChartSectionComponent, isStandalone: true, selector: "bizy-donut-chart-section", inputs: { id: "id", value: "value", name: "name", metadata: "metadata" }, outputs: { onSelect: "onSelect" }, host: { properties: { "id": "id" } }, usesOnChanges: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
11986
+ }
11987
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: BizyDonutChartSectionComponent, decorators: [{
11988
+ type: Component,
11989
+ args: [{
11990
+ selector: 'bizy-donut-chart-section',
11991
+ template: '',
11992
+ changeDetection: ChangeDetectionStrategy.OnPush,
11993
+ host: {
11994
+ '[id]': 'id'
11995
+ }
11996
+ }]
11997
+ }], propDecorators: { id: [{
11998
+ type: Input
11999
+ }], value: [{
12000
+ type: Input
12001
+ }], name: [{
12002
+ type: Input
12003
+ }], metadata: [{
12004
+ type: Input
12005
+ }], onSelect: [{
12006
+ type: Output
12007
+ }] } });
12008
+
11956
12009
  class BizyDonutChartPopupComponent {
11957
12010
  #popup = inject(BizyPopupService);
11958
12011
  #renderer = inject(Renderer2);
@@ -12011,7 +12064,7 @@ class BizyDonutChartPopupComponent {
12011
12064
  html2canvas(this.#chartContainer).then(canvas => {
12012
12065
  var link = this.#renderer.createElement('a');
12013
12066
  link.href = canvas.toDataURL('image/png');
12014
- link.download = `${data.download.name}.png`;
12067
+ link.download = `${data.download.fileName}.png`;
12015
12068
  this.#renderer.appendChild(this.#document.body, link);
12016
12069
  link.click();
12017
12070
  this.#renderer.removeChild(this.#document.body, link);
@@ -12037,12 +12090,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.5", ngImpor
12037
12090
  args: [{ selector: 'bizy-donut-chart-popup', template: '', styles: [":host{display:inline-block;height:min(60rem,90dvh);width:min(60rem,85dvw)}\n"] }]
12038
12091
  }] });
12039
12092
 
12040
- const EMPTY_CHART$1 = [0];
12041
- const DEFAULT_CHART_SIZE$3 = '300px';
12093
+ const DEFAULT_EMPTY_LABEL$1 = 'Sin elementos';
12094
+ const DEFAULT_CHART_SIZE$3 = 300;
12042
12095
  const DEFAULT_DOWNLOAD$3 = {
12043
12096
  show: true,
12044
12097
  label: 'Descargar',
12045
- name: 'Bizy'
12098
+ fileName: 'Bizy'
12046
12099
  };
12047
12100
  const DEFAULT_EXPAND$2 = {
12048
12101
  show: true,
@@ -12052,7 +12105,7 @@ const DEFAULT_TOOLTIP$3 = {
12052
12105
  show: true
12053
12106
  };
12054
12107
  const DEFAULT_LEGEND$1 = {
12055
- show: true,
12108
+ show: false,
12056
12109
  orient: 'vertical',
12057
12110
  position: {
12058
12111
  x: 'auto',
@@ -12060,227 +12113,273 @@ const DEFAULT_LEGEND$1 = {
12060
12113
  }
12061
12114
  };
12062
12115
  const DEFAULT_LABEL$1 = {
12063
- show: false,
12116
+ show: true,
12064
12117
  overflow: 'break',
12065
12118
  line: true
12066
12119
  };
12120
+ class BizyDonutChartService {
12121
+ emptyLabel = DEFAULT_EMPTY_LABEL$1;
12122
+ chartSize = DEFAULT_CHART_SIZE$3;
12123
+ downloadConfig = DEFAULT_DOWNLOAD$3;
12124
+ expandConfig = DEFAULT_EXPAND$2;
12125
+ tooltipConfig = DEFAULT_TOOLTIP$3;
12126
+ legendConfig = DEFAULT_LEGEND$1;
12127
+ labelConfig = DEFAULT_LABEL$1;
12128
+ getEmptyLabel = () => this.emptyLabel;
12129
+ setEmptyLabel = (label) => {
12130
+ if (!label) {
12131
+ return;
12132
+ }
12133
+ this.emptyLabel = label;
12134
+ };
12135
+ getChartSize = () => this.chartSize;
12136
+ setChartSize = (size) => {
12137
+ if (typeof size === 'undefined' || size === null) {
12138
+ return;
12139
+ }
12140
+ this.chartSize = size;
12141
+ };
12142
+ getDownloadConfig = () => this.downloadConfig;
12143
+ setDownloadConfig = (config) => {
12144
+ this.downloadConfig = Object.assign(this.downloadConfig, config);
12145
+ };
12146
+ getExpandConfig = () => this.expandConfig;
12147
+ setExpandConfig = (config) => {
12148
+ this.expandConfig = Object.assign(this.expandConfig, config);
12149
+ };
12150
+ getTooltipConfig = () => this.tooltipConfig;
12151
+ setTooltipConfig = (config) => {
12152
+ this.tooltipConfig = Object.assign(this.tooltipConfig, config);
12153
+ };
12154
+ getLegendConfig = () => this.legendConfig;
12155
+ setLegendConfig = (config) => {
12156
+ this.legendConfig = Object.assign(this.legendConfig, config);
12157
+ };
12158
+ getLabelConfig = () => this.labelConfig;
12159
+ setLabelConfig = (config) => {
12160
+ this.labelConfig = Object.assign(this.labelConfig, config);
12161
+ };
12162
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: BizyDonutChartService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
12163
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: BizyDonutChartService });
12164
+ }
12165
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: BizyDonutChartService, decorators: [{
12166
+ type: Injectable
12167
+ }] });
12168
+
12067
12169
  class BizyDonutChartComponent {
12068
12170
  #elementRef = inject(ElementRef);
12069
12171
  #document = inject(DOCUMENT);
12070
12172
  #ref = inject(ChangeDetectorRef);
12071
12173
  #renderer = inject(Renderer2);
12072
12174
  #popup = inject(BizyPopupService);
12175
+ #donutChartService = inject(BizyDonutChartService);
12176
+ sections = null;
12073
12177
  resizeRef = null;
12074
12178
  centerLabel = null;
12075
- tooltip = DEFAULT_TOOLTIP$3;
12076
- legend = DEFAULT_LEGEND$1;
12077
- download = DEFAULT_DOWNLOAD$3;
12078
- expand = DEFAULT_EXPAND$2;
12079
- label = DEFAULT_LABEL$1;
12080
- onSelect = new EventEmitter();
12179
+ tooltip = this.#donutChartService.getTooltipConfig();
12180
+ legend = this.#donutChartService.getLegendConfig();
12181
+ download = this.#donutChartService.getDownloadConfig();
12182
+ expand = this.#donutChartService.getDownloadConfig();
12183
+ label = this.#donutChartService.getLabelConfig();
12081
12184
  onDownload = new EventEmitter();
12082
12185
  #echarts = null;
12186
+ #echartsContainer = null;
12083
12187
  #resizeObserver = null;
12084
- #afterViewInitSubscription = new Subscription();
12085
12188
  #resizeSubscription = new Subscription();
12086
12189
  #chartContainer = null;
12087
- #afterViewInit = new BehaviorSubject(false);
12088
12190
  #resize$ = new Subject();
12089
- #data = EMPTY_CHART$1;
12090
- ngAfterViewInit() {
12091
- this.#afterViewInit.next(true);
12092
- }
12191
+ #donutChartSectionSubscription = new Subscription();
12192
+ #donutChartSectionChangesSubscription = new Subscription();
12193
+ #renderSubscription = new Subscription();
12194
+ #render = new Subject();
12093
12195
  getNativeElement = () => this.#elementRef?.nativeElement;
12094
- set data(data) {
12095
- if (!data) {
12196
+ ngAfterContentInit() {
12197
+ import('echarts').then(echarts => {
12198
+ this.#echarts = echarts;
12199
+ this.#resizeObserver = new ResizeObserver(() => this.#resize$.next());
12200
+ const resizeRef = this.resizeRef ? this.resizeRef : this.#renderer.parentNode(this.#elementRef.nativeElement) ? this.#renderer.parentNode(this.#elementRef.nativeElement) : this.#elementRef.nativeElement;
12201
+ this.#resizeObserver.observe(resizeRef);
12202
+ this.#resizeSubscription = new Subscription();
12203
+ this.#resizeSubscription.add(this.#resize$.subscribe(() => {
12204
+ this.#render.next();
12205
+ }));
12206
+ this.sections.forEach(_section => {
12207
+ this.#donutChartSectionChangesSubscription.add(_section.changes$.subscribe(() => {
12208
+ this.#render.next();
12209
+ }));
12210
+ });
12211
+ this.#donutChartSectionSubscription.add(this.sections.changes.subscribe(_sections => {
12212
+ this.#donutChartSectionChangesSubscription.unsubscribe();
12213
+ this.#donutChartSectionChangesSubscription = new Subscription();
12214
+ this.#render.next();
12215
+ _sections.forEach(_section => {
12216
+ this.#donutChartSectionChangesSubscription.add(_section.changes$.subscribe(() => {
12217
+ this.#render.next();
12218
+ }));
12219
+ });
12220
+ }));
12221
+ this.#renderSubscription.add(this.#render.asObservable().pipe(debounceTime(150), throttleTime(300)).subscribe(() => {
12222
+ this.render();
12223
+ }));
12224
+ this.#render.next();
12225
+ });
12226
+ }
12227
+ render = () => {
12228
+ this.#deleteChartContainer();
12229
+ this.#createChartContainer();
12230
+ if (!this.#chartContainer) {
12096
12231
  return;
12097
12232
  }
12098
- if (data.length > 0) {
12099
- this.#setChartData(data);
12100
- }
12101
- else {
12102
- this.#deleteChartContainer();
12103
- this.#setChartData(EMPTY_CHART$1);
12233
+ let data = [];
12234
+ this.sections.forEach(_section => {
12235
+ const section = {
12236
+ id: _section.id,
12237
+ name: _section.name || '---',
12238
+ value: _section.value ?? 0,
12239
+ metadata: _section.metadata ?? {}
12240
+ };
12241
+ const color = _section.getColor();
12242
+ const itemStyle = color ? { color } : {};
12243
+ data.push({
12244
+ id: section.id,
12245
+ name: section.name,
12246
+ value: section.value,
12247
+ metadata: section.metadata,
12248
+ itemStyle,
12249
+ });
12250
+ });
12251
+ if (data.length === 0) {
12252
+ data = [{
12253
+ name: this.#donutChartService.getEmptyLabel(),
12254
+ value: 0
12255
+ }];
12104
12256
  }
12105
- }
12106
- async #setChartData(data) {
12107
- this.#afterViewInitSubscription.add(this.#afterViewInit.pipe(filter$1(value => value === true), take(1)).subscribe(() => {
12108
- /**
12109
- * setTimeout fix angular render problem
12110
- */
12111
- setTimeout(() => {
12112
- this.#createChartContainer();
12113
- if (!this.#chartContainer) {
12114
- return;
12115
- }
12116
- if (data && data.length > 0 && data[0] !== 0) {
12117
- this.#data = [];
12118
- data.forEach(_d => {
12119
- if (!_d.value) {
12120
- _d.value = 0;
12121
- }
12122
- if (!_d.name) {
12123
- _d.name = '---';
12124
- }
12125
- const itemStyle = _d.color ? { color: _d.color } : {};
12126
- this.#data.push({
12127
- name: _d.name,
12128
- value: _d.value,
12129
- itemStyle
12130
- });
12131
- });
12132
- }
12133
- else {
12134
- this.#data = EMPTY_CHART$1;
12135
- }
12136
- const itemStyle = {
12137
- borderRadius: 10,
12138
- borderColor: '#fff',
12139
- borderWidth: 2
12140
- };
12141
- const label = {
12142
- show: this.label?.show ?? DEFAULT_LABEL$1.show,
12143
- overflow: this.label?.overflow ?? DEFAULT_LABEL$1.overflow,
12144
- position: 'center',
12145
- formatter: this.label?.formatter
12146
- };
12147
- const labelLine = {
12148
- show: this.label?.line ?? DEFAULT_LABEL$1.line
12149
- };
12150
- const series = [{
12151
- type: 'pie',
12152
- radius: ['50%', '70%'],
12153
- center: ['50%', '50%'],
12154
- data: this.#data,
12155
- itemStyle,
12156
- label,
12157
- labelLine
12158
- }];
12159
- const textColor = getComputedStyle(this.#document.documentElement).getPropertyValue('--bizy-donut-chart-tooltip-color');
12160
- const textBackgroundColor = getComputedStyle(this.#document.documentElement).getPropertyValue('--bizy-donut-chart-tooltip-background-color');
12161
- const borderColor = getComputedStyle(this.#document.documentElement).getPropertyValue('--bizy-donut-chart-tooltip-border-color');
12162
- const toolbox = {
12163
- show: true,
12164
- feature: {
12165
- mySaveAsImage: {
12166
- show: this.download.show ?? DEFAULT_DOWNLOAD$3.show,
12167
- 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',
12168
- title: this.download.label ?? DEFAULT_DOWNLOAD$3.label,
12169
- onclick: () => {
12170
- setTimeout(() => {
12171
- import('html2canvas').then(module => {
12172
- const html2canvas = module.default;
12173
- html2canvas(this.#chartContainer).then(canvas => {
12174
- var link = this.#renderer.createElement('a');
12175
- link.href = canvas.toDataURL('image/png');
12176
- link.download = `${this.download.name ?? DEFAULT_DOWNLOAD$3.name}.png`;
12177
- this.#renderer.appendChild(this.#document.body, link);
12178
- link.click();
12179
- this.#renderer.removeChild(this.#document.body, link);
12180
- this.onDownload.emit();
12181
- });
12182
- });
12183
- }, 500);
12184
- }
12185
- },
12186
- myExpandChart: {
12187
- show: this.expand.show ?? DEFAULT_EXPAND$2.show,
12188
- icon: 'path://M264 96L120 96C106.7 96 96 106.7 96 120L96 264C96 273.7 101.8 282.5 110.8 286.2C119.8 289.9 130.1 287.8 137 281L177 241L256 320L177 399L137 359C130.1 352.1 119.8 350.1 110.8 353.8C101.8 357.5 96 366.3 96 376L96 520C96 533.3 106.7 544 120 544L264 544C273.7 544 282.5 538.2 286.2 529.2C289.9 520.2 287.9 509.9 281 503L241 463L320 384L399 463L359 503C352.1 509.9 350.1 520.2 353.8 529.2C357.5 538.2 366.3 544 376 544L520 544C533.3 544 544 533.3 544 520L544 376C544 366.3 538.2 357.5 529.2 353.8C520.2 350.1 509.9 352.1 503 359L463 399L384 320L463 241L503 281C509.9 287.9 520.2 289.9 529.2 286.2C538.2 282.5 544 273.7 544 264L544 120C544 106.7 533.3 96 520 96L376 96C366.3 96 357.5 101.8 353.8 110.8C350.1 119.8 352.2 130.1 359 137L399 177L320 256L241 177L281 137C287.9 130.1 289.9 119.8 286.2 110.8C282.5 101.8 273.7 96 264 96z',
12189
- title: this.expand.label ?? DEFAULT_EXPAND$2.label,
12190
- onclick: () => {
12191
- this.#popup.open({
12192
- component: BizyDonutChartPopupComponent,
12193
- data: {
12194
- download: {
12195
- show: this.download?.show ?? DEFAULT_DOWNLOAD$3.show,
12196
- label: this.download?.label ?? DEFAULT_DOWNLOAD$3.label,
12197
- name: this.download?.name ?? DEFAULT_DOWNLOAD$3.name,
12198
- },
12199
- option: this.#echarts.getOption()
12200
- }
12257
+ const itemStyle = {
12258
+ borderRadius: 10,
12259
+ borderColor: '#fff',
12260
+ borderWidth: 2
12261
+ };
12262
+ const label = {
12263
+ show: this.label?.show ?? this.#donutChartService.getLabelConfig().show,
12264
+ overflow: this.label?.overflow ?? this.#donutChartService.getLabelConfig().overflow,
12265
+ position: 'center',
12266
+ formatter: this.label?.formatter
12267
+ };
12268
+ const labelLine = {
12269
+ show: this.label?.line ?? this.#donutChartService.getLabelConfig().line
12270
+ };
12271
+ const series = [{
12272
+ type: 'pie',
12273
+ radius: ['50%', '70%'],
12274
+ center: ['50%', '50%'],
12275
+ data,
12276
+ itemStyle,
12277
+ label,
12278
+ labelLine
12279
+ }];
12280
+ const textColor = getComputedStyle(this.#document.documentElement).getPropertyValue('--bizy-donut-chart-tooltip-color');
12281
+ const textBackgroundColor = getComputedStyle(this.#document.documentElement).getPropertyValue('--bizy-donut-chart-tooltip-background-color');
12282
+ const borderColor = getComputedStyle(this.#document.documentElement).getPropertyValue('--bizy-donut-chart-tooltip-border-color');
12283
+ const toolbox = {
12284
+ show: true,
12285
+ feature: {
12286
+ mySaveAsImage: {
12287
+ show: this.download.show ?? this.#donutChartService.getDownloadConfig().show,
12288
+ 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',
12289
+ title: this.download.label ?? this.#donutChartService.getDownloadConfig().label,
12290
+ onclick: () => {
12291
+ setTimeout(() => {
12292
+ import('html2canvas').then(module => {
12293
+ const html2canvas = module.default;
12294
+ html2canvas(this.#chartContainer).then(canvas => {
12295
+ var link = this.#renderer.createElement('a');
12296
+ link.href = canvas.toDataURL('image/png');
12297
+ link.download = `${this.download.fileName ?? this.#donutChartService.getDownloadConfig().fileName}.png`;
12298
+ this.#renderer.appendChild(this.#document.body, link);
12299
+ link.click();
12300
+ this.#renderer.removeChild(this.#document.body, link);
12301
+ this.onDownload.emit();
12201
12302
  });
12303
+ });
12304
+ }, 500);
12305
+ }
12306
+ },
12307
+ myExpandChart: {
12308
+ show: this.expand.show ?? this.#donutChartService.getExpandConfig().show,
12309
+ icon: 'path://M264 96L120 96C106.7 96 96 106.7 96 120L96 264C96 273.7 101.8 282.5 110.8 286.2C119.8 289.9 130.1 287.8 137 281L177 241L256 320L177 399L137 359C130.1 352.1 119.8 350.1 110.8 353.8C101.8 357.5 96 366.3 96 376L96 520C96 533.3 106.7 544 120 544L264 544C273.7 544 282.5 538.2 286.2 529.2C289.9 520.2 287.9 509.9 281 503L241 463L320 384L399 463L359 503C352.1 509.9 350.1 520.2 353.8 529.2C357.5 538.2 366.3 544 376 544L520 544C533.3 544 544 533.3 544 520L544 376C544 366.3 538.2 357.5 529.2 353.8C520.2 350.1 509.9 352.1 503 359L463 399L384 320L463 241L503 281C509.9 287.9 520.2 289.9 529.2 286.2C538.2 282.5 544 273.7 544 264L544 120C544 106.7 533.3 96 520 96L376 96C366.3 96 357.5 101.8 353.8 110.8C350.1 119.8 352.2 130.1 359 137L399 177L320 256L241 177L281 137C287.9 130.1 289.9 119.8 286.2 110.8C282.5 101.8 273.7 96 264 96z',
12310
+ title: this.expand.label ?? this.#donutChartService.getExpandConfig().label,
12311
+ onclick: () => {
12312
+ this.#popup.open({
12313
+ component: BizyDonutChartPopupComponent,
12314
+ data: {
12315
+ download: {
12316
+ show: this.download?.show ?? this.#donutChartService.getDownloadConfig().show,
12317
+ label: this.download?.label ?? this.#donutChartService.getDownloadConfig().label,
12318
+ name: this.download?.fileName ?? this.#donutChartService.getDownloadConfig().fileName,
12319
+ },
12320
+ option: this.#echartsContainer.getOption()
12202
12321
  }
12203
- }
12204
- },
12205
- emphasis: {
12206
- iconStyle: {
12207
- color: textColor,
12208
- borderColor,
12209
- borderWidth: 1,
12210
- textBackgroundColor,
12211
- textPadding: 5,
12212
- }
12322
+ });
12213
12323
  }
12214
- };
12215
- const tooltip = {
12216
- show: this.tooltip?.show ?? DEFAULT_TOOLTIP$3.show,
12217
- trigger: 'item',
12218
- appendToBody: true,
12219
- formatter: this.tooltip?.formatter
12220
- };
12221
- let legend = {
12222
- show: this.legend?.show ?? DEFAULT_LEGEND$1.show,
12223
- orient: this.legend?.orient ?? DEFAULT_LEGEND$1.orient,
12224
- left: this.legend?.position ? this.legend?.position.x : DEFAULT_LEGEND$1.position.x,
12225
- top: this.legend?.position ? this.legend?.position.y : DEFAULT_LEGEND$1.position.y,
12226
- };
12227
- let graphic;
12228
- if (this.centerLabel) {
12229
- let centerLabelColor = this.#getClosestCssVariable(this.#elementRef.nativeElement, '--bizy-donut-chart-center-label-color');
12230
- let { width, height } = this.#chartContainer.getBoundingClientRect();
12231
- let base = Math.min(width, height);
12232
- let fontSize = base / 6;
12233
- graphic = {
12234
- type: 'text',
12235
- left: 'center',
12236
- top: 'center',
12237
- style: {
12238
- text: this.centerLabel,
12239
- fill: centerLabelColor,
12240
- textAlign: 'center',
12241
- fontSize,
12242
- fontWeight: 'bold'
12243
- }
12244
- };
12245
12324
  }
12246
- const option = {
12247
- tooltip,
12248
- toolbox,
12249
- legend,
12250
- series,
12251
- graphic
12252
- };
12253
- import('echarts').then(echarts => {
12254
- this.#echarts = echarts.init(this.#chartContainer);
12255
- Promise.resolve().then(() => {
12256
- this.#echarts.setOption(option);
12257
- this.#echarts.on('click', params => {
12258
- this.onSelect.emit(params.name);
12259
- });
12260
- this.#resizeSubscription.unsubscribe();
12261
- this.#resizeObserver = new ResizeObserver(() => this.#resize$.next());
12262
- const resizeRef = this.resizeRef ? this.resizeRef : this.#renderer.parentNode(this.#elementRef.nativeElement) ? this.#renderer.parentNode(this.#elementRef.nativeElement) : this.#elementRef.nativeElement;
12263
- this.#resizeObserver.observe(resizeRef);
12264
- this.#resizeSubscription = new Subscription();
12265
- this.#resizeSubscription.add(this.#resize$.pipe(skip(1), auditTime(300), throttleTime(500)).subscribe(() => {
12266
- this.#deleteChartContainer();
12267
- this.#createChartContainer();
12268
- if (!this.#chartContainer) {
12269
- return;
12270
- }
12271
- this.#echarts = echarts.init(this.#chartContainer);
12272
- Promise.resolve().then(() => {
12273
- this.#echarts.setOption({ ...option, series: option.series.map(_serie => { return { ..._serie, data: this.#data }; }) });
12274
- this.#echarts.on('click', params => {
12275
- this.onSelect.emit(params.name);
12276
- });
12277
- });
12278
- }));
12279
- });
12280
- });
12281
- });
12282
- }));
12283
- }
12325
+ },
12326
+ emphasis: {
12327
+ iconStyle: {
12328
+ color: textColor,
12329
+ borderColor,
12330
+ borderWidth: 1,
12331
+ textBackgroundColor,
12332
+ textPadding: 5,
12333
+ }
12334
+ }
12335
+ };
12336
+ const tooltip = {
12337
+ show: this.tooltip?.show ?? this.#donutChartService.getTooltipConfig().show,
12338
+ trigger: 'item',
12339
+ appendToBody: true,
12340
+ formatter: this.tooltip?.formatter
12341
+ };
12342
+ let legend = {
12343
+ show: this.legend?.show ?? this.#donutChartService.getLegendConfig().show,
12344
+ orient: this.legend?.orient ?? this.#donutChartService.getLegendConfig().orient,
12345
+ left: this.legend?.position ? this.legend?.position.x : this.#donutChartService.getLegendConfig().position.x,
12346
+ top: this.legend?.position ? this.legend?.position.y : this.#donutChartService.getLegendConfig().position.y,
12347
+ };
12348
+ let graphic;
12349
+ if (this.centerLabel) {
12350
+ let centerLabelColor = this.#getClosestCssVariable(this.#elementRef.nativeElement, '--bizy-donut-chart-center-label-color');
12351
+ let { width, height } = this.#chartContainer.getBoundingClientRect();
12352
+ let base = Math.min(width, height);
12353
+ let fontSize = base / 6;
12354
+ graphic = {
12355
+ type: 'text',
12356
+ left: 'center',
12357
+ top: 'center',
12358
+ style: {
12359
+ text: this.centerLabel,
12360
+ fill: centerLabelColor,
12361
+ textAlign: 'center',
12362
+ fontSize,
12363
+ fontWeight: 'bold'
12364
+ }
12365
+ };
12366
+ }
12367
+ const option = {
12368
+ tooltip,
12369
+ toolbox,
12370
+ legend,
12371
+ series,
12372
+ graphic
12373
+ };
12374
+ this.#echartsContainer = this.#echarts.init(this.#chartContainer);
12375
+ this.#echartsContainer.setOption(option);
12376
+ this.#echartsContainer.on('click', (params) => {
12377
+ const section = this.sections.find(_section => _section.id === params.data.id);
12378
+ if (section) {
12379
+ section.onSelect.emit(params.event.event);
12380
+ }
12381
+ });
12382
+ };
12284
12383
  #createChartContainer = () => {
12285
12384
  if (this.#chartContainer || !this.#elementRef || !this.#elementRef.nativeElement) {
12286
12385
  return;
@@ -12289,8 +12388,8 @@ class BizyDonutChartComponent {
12289
12388
  let elementHeight = this.#elementRef.nativeElement.offsetHeight;
12290
12389
  let minWidth = this.#getClosestCssVariable(this.#elementRef.nativeElement, '--bizy-donut-chart-width');
12291
12390
  let minHeight = this.#getClosestCssVariable(this.#elementRef.nativeElement, '--bizy-donut-chart-height');
12292
- const width = minWidth ? minWidth : elementWidth ? `${elementWidth * 0.99}px` : DEFAULT_CHART_SIZE$3;
12293
- const height = minHeight ? minHeight : elementHeight ? `${elementHeight}px` : DEFAULT_CHART_SIZE$3;
12391
+ const width = minWidth ? minWidth : elementWidth ? `${elementWidth}px` : `${this.#donutChartService.getChartSize()}px`;
12392
+ const height = minHeight ? minHeight : elementHeight ? `${elementHeight}px` : `${this.#donutChartService.getChartSize()}px`;
12294
12393
  this.#chartContainer = this.#renderer.createElement('div');
12295
12394
  this.#renderer.setStyle(this.#chartContainer, 'width', width);
12296
12395
  this.#renderer.setStyle(this.#chartContainer, 'height', height);
@@ -12301,7 +12400,7 @@ class BizyDonutChartComponent {
12301
12400
  if (!this.#chartContainer || !this.#elementRef || !this.#elementRef.nativeElement) {
12302
12401
  return;
12303
12402
  }
12304
- this.#echarts.clear();
12403
+ this.#echartsContainer.clear();
12305
12404
  this.#renderer.removeChild(this.#elementRef.nativeElement, this.#chartContainer);
12306
12405
  this.#chartContainer = null;
12307
12406
  this.#ref.detectChanges();
@@ -12318,22 +12417,27 @@ class BizyDonutChartComponent {
12318
12417
  return rootValue || null;
12319
12418
  };
12320
12419
  ngOnDestroy() {
12321
- this.#afterViewInitSubscription.unsubscribe();
12322
12420
  this.#resizeSubscription.unsubscribe();
12421
+ this.#donutChartSectionSubscription.unsubscribe();
12422
+ this.#donutChartSectionChangesSubscription.unsubscribe();
12423
+ this.#renderSubscription.unsubscribe();
12323
12424
  if (this.#resizeObserver) {
12324
12425
  this.#resizeObserver.disconnect();
12325
12426
  }
12326
- if (this.#echarts) {
12327
- this.#echarts.clear();
12427
+ if (this.#echartsContainer) {
12428
+ this.#echartsContainer.clear();
12328
12429
  }
12329
12430
  }
12330
12431
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: BizyDonutChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
12331
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.5", type: BizyDonutChartComponent, isStandalone: true, selector: "bizy-donut-chart", inputs: { resizeRef: "resizeRef", centerLabel: "centerLabel", tooltip: "tooltip", legend: "legend", download: "download", expand: "expand", label: "label", data: "data" }, outputs: { onSelect: "onSelect", onDownload: "onDownload" }, ngImport: i0, template: '', isInline: true, styles: [":host{display:flex;justify-content:center}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
12432
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.5", type: BizyDonutChartComponent, isStandalone: true, selector: "bizy-donut-chart", inputs: { resizeRef: "resizeRef", centerLabel: "centerLabel", tooltip: "tooltip", legend: "legend", download: "download", expand: "expand", label: "label" }, outputs: { onDownload: "onDownload" }, queries: [{ propertyName: "sections", predicate: BizyDonutChartSectionComponent }], ngImport: i0, template: '<ng-content select="bizy-donut-chart-section"></ng-content>', isInline: true, styles: [":host{display:flex;justify-content:center}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
12332
12433
  }
12333
12434
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: BizyDonutChartComponent, decorators: [{
12334
12435
  type: Component,
12335
- args: [{ selector: 'bizy-donut-chart', template: '', changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:flex;justify-content:center}\n"] }]
12336
- }], propDecorators: { resizeRef: [{
12436
+ args: [{ selector: 'bizy-donut-chart', template: '<ng-content select="bizy-donut-chart-section"></ng-content>', changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:flex;justify-content:center}\n"] }]
12437
+ }], propDecorators: { sections: [{
12438
+ type: ContentChildren,
12439
+ args: [BizyDonutChartSectionComponent]
12440
+ }], resizeRef: [{
12337
12441
  type: Input
12338
12442
  }], centerLabel: [{
12339
12443
  type: Input
@@ -12347,30 +12451,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.5", ngImpor
12347
12451
  type: Input
12348
12452
  }], label: [{
12349
12453
  type: Input
12350
- }], onSelect: [{
12351
- type: Output
12352
12454
  }], onDownload: [{
12353
12455
  type: Output
12354
- }], data: [{
12355
- type: Input
12356
12456
  }] } });
12357
12457
 
12358
12458
  const COMPONENTS$p = [
12359
12459
  BizyDonutChartComponent,
12360
- BizyDonutChartPopupComponent
12460
+ BizyDonutChartPopupComponent,
12461
+ BizyDonutChartSectionComponent
12361
12462
  ];
12362
12463
  class BizyDonutChartModule {
12363
12464
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: BizyDonutChartModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
12364
12465
  static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.0.5", ngImport: i0, type: BizyDonutChartModule, imports: [BizyDonutChartComponent,
12365
- BizyDonutChartPopupComponent], exports: [BizyDonutChartComponent,
12366
- BizyDonutChartPopupComponent] });
12367
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: BizyDonutChartModule });
12466
+ BizyDonutChartPopupComponent,
12467
+ BizyDonutChartSectionComponent], exports: [BizyDonutChartComponent,
12468
+ BizyDonutChartPopupComponent,
12469
+ BizyDonutChartSectionComponent] });
12470
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: BizyDonutChartModule, providers: [BizyDonutChartService] });
12368
12471
  }
12369
12472
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: BizyDonutChartModule, decorators: [{
12370
12473
  type: NgModule,
12371
12474
  args: [{
12372
12475
  imports: COMPONENTS$p,
12373
12476
  exports: COMPONENTS$p,
12477
+ providers: [BizyDonutChartService]
12374
12478
  }]
12375
12479
  }] });
12376
12480
 
@@ -15147,6 +15251,59 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.5", ngImpor
15147
15251
  }]
15148
15252
  }] });
15149
15253
 
15254
+ class BizyPieChartSectionComponent {
15255
+ #elementRef = inject(ElementRef);
15256
+ #document = inject(DOCUMENT);
15257
+ id = `bizy-pie-chart-section-${Math.random()}`;
15258
+ value = null;
15259
+ name = null;
15260
+ metadata = null;
15261
+ onSelect = new EventEmitter();
15262
+ #changes = new Subject();
15263
+ get changes$() {
15264
+ return this.#changes.asObservable();
15265
+ }
15266
+ ngOnChanges() {
15267
+ this.#changes.next();
15268
+ }
15269
+ #getClosestCssVariable = (element, cssVariable) => {
15270
+ while (element) {
15271
+ const value = getComputedStyle(element).getPropertyValue(cssVariable).trim();
15272
+ if (value) {
15273
+ return value;
15274
+ }
15275
+ element = element.parentElement;
15276
+ }
15277
+ const rootValue = getComputedStyle(this.#document.documentElement).getPropertyValue(cssVariable).trim();
15278
+ return rootValue || null;
15279
+ };
15280
+ getColor = () => this.#getClosestCssVariable(this.#elementRef.nativeElement, '--bizy-pie-chart-section-color');
15281
+ getNativeElement = () => this.#elementRef?.nativeElement;
15282
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: BizyPieChartSectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
15283
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.5", type: BizyPieChartSectionComponent, isStandalone: true, selector: "bizy-pie-chart-section", inputs: { id: "id", value: "value", name: "name", metadata: "metadata" }, outputs: { onSelect: "onSelect" }, host: { properties: { "id": "id" } }, usesOnChanges: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
15284
+ }
15285
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: BizyPieChartSectionComponent, decorators: [{
15286
+ type: Component,
15287
+ args: [{
15288
+ selector: 'bizy-pie-chart-section',
15289
+ template: '',
15290
+ changeDetection: ChangeDetectionStrategy.OnPush,
15291
+ host: {
15292
+ '[id]': 'id'
15293
+ }
15294
+ }]
15295
+ }], propDecorators: { id: [{
15296
+ type: Input
15297
+ }], value: [{
15298
+ type: Input
15299
+ }], name: [{
15300
+ type: Input
15301
+ }], metadata: [{
15302
+ type: Input
15303
+ }], onSelect: [{
15304
+ type: Output
15305
+ }] } });
15306
+
15150
15307
  class BizyPieChartPopupComponent {
15151
15308
  #popup = inject(BizyPopupService);
15152
15309
  #renderer = inject(Renderer2);
@@ -15205,7 +15362,7 @@ class BizyPieChartPopupComponent {
15205
15362
  html2canvas(this.#chartContainer).then(canvas => {
15206
15363
  var link = this.#renderer.createElement('a');
15207
15364
  link.href = canvas.toDataURL('image/png');
15208
- link.download = `${data.download.name}.png`;
15365
+ link.download = `${data.download.fileName}.png`;
15209
15366
  this.#renderer.appendChild(this.#document.body, link);
15210
15367
  link.click();
15211
15368
  this.#renderer.removeChild(this.#document.body, link);
@@ -15231,12 +15388,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.5", ngImpor
15231
15388
  args: [{ selector: 'bizy-pie-chart-popup', template: '', styles: [":host{display:inline-block;height:min(60rem,90dvh);width:min(60rem,85dvw)}\n"] }]
15232
15389
  }] });
15233
15390
 
15234
- const EMPTY_CHART = [0];
15235
- const DEFAULT_CHART_SIZE = '300px';
15391
+ const DEFAULT_EMPTY_LABEL = 'Sin elementos';
15392
+ const DEFAULT_CHART_SIZE = 300;
15236
15393
  const DEFAULT_DOWNLOAD = {
15237
15394
  show: true,
15238
15395
  label: 'Descargar',
15239
- name: 'Bizy'
15396
+ fileName: 'Bizy'
15240
15397
  };
15241
15398
  const DEFAULT_EXPAND = {
15242
15399
  show: true,
@@ -15258,227 +15415,262 @@ const DEFAULT_LABEL = {
15258
15415
  overflow: 'break',
15259
15416
  line: true
15260
15417
  };
15418
+ class BizyPieChartService {
15419
+ emptyLabel = DEFAULT_EMPTY_LABEL;
15420
+ chartSize = DEFAULT_CHART_SIZE;
15421
+ downloadConfig = DEFAULT_DOWNLOAD;
15422
+ expandConfig = DEFAULT_EXPAND;
15423
+ tooltipConfig = DEFAULT_TOOLTIP;
15424
+ legendConfig = DEFAULT_LEGEND;
15425
+ labelConfig = DEFAULT_LABEL;
15426
+ getEmptyLabel = () => this.emptyLabel;
15427
+ setEmptyLabel = (label) => {
15428
+ if (!label) {
15429
+ return;
15430
+ }
15431
+ this.emptyLabel = label;
15432
+ };
15433
+ getChartSize = () => this.chartSize;
15434
+ setChartSize = (size) => {
15435
+ if (typeof size === 'undefined' || size === null) {
15436
+ return;
15437
+ }
15438
+ this.chartSize = size;
15439
+ };
15440
+ getDownloadConfig = () => this.downloadConfig;
15441
+ setDownloadConfig = (config) => {
15442
+ this.downloadConfig = Object.assign(this.downloadConfig, config);
15443
+ };
15444
+ getExpandConfig = () => this.expandConfig;
15445
+ setExpandConfig = (config) => {
15446
+ this.expandConfig = Object.assign(this.expandConfig, config);
15447
+ };
15448
+ getTooltipConfig = () => this.tooltipConfig;
15449
+ setTooltipConfig = (config) => {
15450
+ this.tooltipConfig = Object.assign(this.tooltipConfig, config);
15451
+ };
15452
+ getLegendConfig = () => this.legendConfig;
15453
+ setLegendConfig = (config) => {
15454
+ this.legendConfig = Object.assign(this.legendConfig, config);
15455
+ };
15456
+ getLabelConfig = () => this.labelConfig;
15457
+ setLabelConfig = (config) => {
15458
+ this.labelConfig = Object.assign(this.labelConfig, config);
15459
+ };
15460
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: BizyPieChartService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
15461
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: BizyPieChartService });
15462
+ }
15463
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: BizyPieChartService, decorators: [{
15464
+ type: Injectable
15465
+ }] });
15466
+
15261
15467
  class BizyPieChartComponent {
15262
15468
  #elementRef = inject(ElementRef);
15263
15469
  #document = inject(DOCUMENT);
15264
15470
  #ref = inject(ChangeDetectorRef);
15265
15471
  #renderer = inject(Renderer2);
15266
15472
  #popup = inject(BizyPopupService);
15473
+ #pieChartService = inject(BizyPieChartService);
15474
+ sections = null;
15267
15475
  resizeRef = null;
15268
15476
  centerLabel = null;
15269
- tooltip = DEFAULT_TOOLTIP;
15270
- legend = null;
15271
- download = DEFAULT_DOWNLOAD;
15272
- expand = DEFAULT_EXPAND;
15273
- label = DEFAULT_LABEL;
15274
- onSelect = new EventEmitter();
15477
+ tooltip = this.#pieChartService.getTooltipConfig();
15478
+ legend = this.#pieChartService.getLegendConfig();
15479
+ download = this.#pieChartService.getDownloadConfig();
15480
+ expand = this.#pieChartService.getExpandConfig();
15481
+ label = this.#pieChartService.getLabelConfig();
15275
15482
  onDownload = new EventEmitter();
15276
15483
  #echarts = null;
15484
+ #echartsContainer = null;
15277
15485
  #resizeObserver = null;
15278
- #afterViewInitSubscription = new Subscription();
15279
15486
  #resizeSubscription = new Subscription();
15280
15487
  #chartContainer = null;
15281
- #afterViewInit = new BehaviorSubject(false);
15282
15488
  #resize$ = new Subject();
15283
- #data = EMPTY_CHART;
15284
- ngAfterViewInit() {
15285
- this.#afterViewInit.next(true);
15286
- }
15489
+ #pieChartSectionSubscription = new Subscription();
15490
+ #pieChartSectionChangesSubscription = new Subscription();
15491
+ #renderSubscription = new Subscription();
15492
+ #render = new Subject();
15287
15493
  getNativeElement = () => this.#elementRef?.nativeElement;
15288
- set data(data) {
15289
- if (!data) {
15494
+ ngAfterContentInit() {
15495
+ import('echarts').then(echarts => {
15496
+ this.#echarts = echarts;
15497
+ this.#resizeObserver = new ResizeObserver(() => this.#resize$.next());
15498
+ const resizeRef = this.resizeRef ? this.resizeRef : this.#renderer.parentNode(this.#elementRef.nativeElement) ? this.#renderer.parentNode(this.#elementRef.nativeElement) : this.#elementRef.nativeElement;
15499
+ this.#resizeObserver.observe(resizeRef);
15500
+ this.#resizeSubscription = new Subscription();
15501
+ this.#resizeSubscription.add(this.#resize$.subscribe(() => {
15502
+ this.#render.next();
15503
+ }));
15504
+ this.sections.forEach(_section => {
15505
+ this.#pieChartSectionChangesSubscription.add(_section.changes$.subscribe(() => {
15506
+ this.#render.next();
15507
+ }));
15508
+ });
15509
+ this.#pieChartSectionSubscription.add(this.sections.changes.subscribe(_sections => {
15510
+ this.#pieChartSectionChangesSubscription.unsubscribe();
15511
+ this.#pieChartSectionChangesSubscription = new Subscription();
15512
+ this.#render.next();
15513
+ _sections.forEach(_section => {
15514
+ this.#pieChartSectionChangesSubscription.add(_section.changes$.subscribe(() => {
15515
+ this.#render.next();
15516
+ }));
15517
+ });
15518
+ }));
15519
+ this.#renderSubscription.add(this.#render.asObservable().pipe(debounceTime(150), throttleTime(300)).subscribe(() => {
15520
+ this.render();
15521
+ }));
15522
+ this.#render.next();
15523
+ });
15524
+ }
15525
+ render = () => {
15526
+ this.#deleteChartContainer();
15527
+ this.#createChartContainer();
15528
+ if (!this.#chartContainer) {
15290
15529
  return;
15291
15530
  }
15292
- if (data.length > 0) {
15293
- this.#setChartData(data);
15294
- }
15295
- else {
15296
- this.#deleteChartContainer();
15297
- this.#setChartData(EMPTY_CHART);
15531
+ let data = [];
15532
+ this.sections.forEach(_section => {
15533
+ const section = {
15534
+ id: _section.id,
15535
+ name: _section.name || '---',
15536
+ value: _section.value ?? 0,
15537
+ metadata: _section.metadata ?? {}
15538
+ };
15539
+ const color = _section.getColor();
15540
+ const itemStyle = color ? { color } : {};
15541
+ data.push({
15542
+ id: section.id,
15543
+ name: section.name,
15544
+ value: section.value,
15545
+ metadata: section.metadata,
15546
+ itemStyle,
15547
+ });
15548
+ });
15549
+ if (data.length === 0) {
15550
+ data = [{
15551
+ name: this.#pieChartService.getEmptyLabel(),
15552
+ value: 0
15553
+ }];
15298
15554
  }
15299
- }
15300
- async #setChartData(data) {
15301
- this.#afterViewInitSubscription.add(this.#afterViewInit.pipe(filter$1(value => value === true), take(1)).subscribe(() => {
15302
- /**
15303
- * setTimeout fix angular render problem
15304
- */
15305
- setTimeout(() => {
15306
- this.#createChartContainer();
15307
- if (!this.#chartContainer) {
15308
- return;
15309
- }
15310
- if (data && data.length > 0 && data[0] !== 0) {
15311
- this.#data = [];
15312
- data.forEach(_d => {
15313
- if (!_d.value) {
15314
- _d.value = 0;
15315
- }
15316
- if (!_d.name) {
15317
- _d.name = '---';
15318
- }
15319
- const itemStyle = _d.color ? { color: _d.color } : {};
15320
- this.#data.push({
15321
- name: _d.name,
15322
- value: _d.value,
15323
- itemStyle,
15324
- metadata: _d.metadata
15325
- });
15326
- });
15327
- }
15328
- else {
15329
- this.#data = EMPTY_CHART;
15330
- }
15331
- const label = {
15332
- show: this.label?.show ?? DEFAULT_LABEL.show,
15333
- overflow: this.label?.overflow ?? DEFAULT_LABEL.overflow,
15334
- formatter: this.label?.formatter
15335
- };
15336
- const labelLine = {
15337
- show: this.label?.line ?? true
15338
- };
15339
- const series = [{
15340
- type: 'pie',
15341
- radius: '50%',
15342
- center: ['50%', '50%'],
15343
- data: this.#data,
15344
- label,
15345
- labelLine
15346
- }];
15347
- const textColor = getComputedStyle(this.#document.documentElement).getPropertyValue('--bizy-pie-chart-tooltip-color');
15348
- const textBackgroundColor = getComputedStyle(this.#document.documentElement).getPropertyValue('--bizy-pie-chart-tooltip-background-color');
15349
- const borderColor = getComputedStyle(this.#document.documentElement).getPropertyValue('--bizy-pie-chart-tooltip-border-color');
15350
- const toolbox = {
15351
- show: true,
15352
- feature: {
15353
- mySaveAsImage: {
15354
- show: this.download.show ?? DEFAULT_DOWNLOAD.show,
15355
- 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',
15356
- title: this.download.label ?? DEFAULT_DOWNLOAD.label,
15357
- onclick: () => {
15358
- setTimeout(() => {
15359
- import('html2canvas').then(module => {
15360
- const html2canvas = module.default;
15361
- html2canvas(this.#chartContainer).then(canvas => {
15362
- var link = this.#renderer.createElement('a');
15363
- link.href = canvas.toDataURL('image/png');
15364
- link.download = `${this.download.name ?? DEFAULT_DOWNLOAD.name}.png`;
15365
- this.#renderer.appendChild(this.#document.body, link);
15366
- link.click();
15367
- this.#renderer.removeChild(this.#document.body, link);
15368
- this.onDownload.emit();
15369
- });
15370
- });
15371
- }, 500);
15372
- }
15373
- },
15374
- myExpandChart: {
15375
- show: this.expand.show ?? DEFAULT_EXPAND.show,
15376
- icon: 'path://M264 96L120 96C106.7 96 96 106.7 96 120L96 264C96 273.7 101.8 282.5 110.8 286.2C119.8 289.9 130.1 287.8 137 281L177 241L256 320L177 399L137 359C130.1 352.1 119.8 350.1 110.8 353.8C101.8 357.5 96 366.3 96 376L96 520C96 533.3 106.7 544 120 544L264 544C273.7 544 282.5 538.2 286.2 529.2C289.9 520.2 287.9 509.9 281 503L241 463L320 384L399 463L359 503C352.1 509.9 350.1 520.2 353.8 529.2C357.5 538.2 366.3 544 376 544L520 544C533.3 544 544 533.3 544 520L544 376C544 366.3 538.2 357.5 529.2 353.8C520.2 350.1 509.9 352.1 503 359L463 399L384 320L463 241L503 281C509.9 287.9 520.2 289.9 529.2 286.2C538.2 282.5 544 273.7 544 264L544 120C544 106.7 533.3 96 520 96L376 96C366.3 96 357.5 101.8 353.8 110.8C350.1 119.8 352.2 130.1 359 137L399 177L320 256L241 177L281 137C287.9 130.1 289.9 119.8 286.2 110.8C282.5 101.8 273.7 96 264 96z',
15377
- title: this.expand.label ?? DEFAULT_EXPAND.label,
15378
- onclick: () => {
15379
- this.#popup.open({
15380
- component: BizyPieChartPopupComponent,
15381
- data: {
15382
- download: {
15383
- show: this.download?.show ?? DEFAULT_DOWNLOAD.show,
15384
- label: this.download?.label ?? DEFAULT_DOWNLOAD.label,
15385
- name: this.download?.name ?? DEFAULT_DOWNLOAD.name,
15386
- },
15387
- option: this.#echarts.getOption()
15388
- }
15555
+ const label = {
15556
+ show: this.label?.show ?? this.#pieChartService.getLabelConfig().show,
15557
+ overflow: this.label?.overflow ?? this.#pieChartService.getLabelConfig().overflow,
15558
+ formatter: this.label?.formatter
15559
+ };
15560
+ const labelLine = {
15561
+ show: this.label?.line ?? true
15562
+ };
15563
+ const series = [{
15564
+ type: 'pie',
15565
+ radius: '50%',
15566
+ center: ['50%', '50%'],
15567
+ data,
15568
+ label,
15569
+ labelLine
15570
+ }];
15571
+ const textColor = getComputedStyle(this.#document.documentElement).getPropertyValue('--bizy-pie-chart-tooltip-color');
15572
+ const textBackgroundColor = getComputedStyle(this.#document.documentElement).getPropertyValue('--bizy-pie-chart-tooltip-background-color');
15573
+ const borderColor = getComputedStyle(this.#document.documentElement).getPropertyValue('--bizy-pie-chart-tooltip-border-color');
15574
+ const toolbox = {
15575
+ show: true,
15576
+ feature: {
15577
+ mySaveAsImage: {
15578
+ show: this.download.show ?? this.#pieChartService.getDownloadConfig().show,
15579
+ 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',
15580
+ title: this.download.label ?? this.#pieChartService.getDownloadConfig().label,
15581
+ onclick: () => {
15582
+ setTimeout(() => {
15583
+ import('html2canvas').then(module => {
15584
+ const html2canvas = module.default;
15585
+ html2canvas(this.#chartContainer).then(canvas => {
15586
+ var link = this.#renderer.createElement('a');
15587
+ link.href = canvas.toDataURL('image/png');
15588
+ link.download = `${this.download.fileName ?? this.#pieChartService.getDownloadConfig().fileName}.png`;
15589
+ this.#renderer.appendChild(this.#document.body, link);
15590
+ link.click();
15591
+ this.#renderer.removeChild(this.#document.body, link);
15592
+ this.onDownload.emit();
15389
15593
  });
15594
+ });
15595
+ }, 500);
15596
+ }
15597
+ },
15598
+ myExpandChart: {
15599
+ show: this.expand.show ?? this.#pieChartService.getExpandConfig().show,
15600
+ icon: 'path://M264 96L120 96C106.7 96 96 106.7 96 120L96 264C96 273.7 101.8 282.5 110.8 286.2C119.8 289.9 130.1 287.8 137 281L177 241L256 320L177 399L137 359C130.1 352.1 119.8 350.1 110.8 353.8C101.8 357.5 96 366.3 96 376L96 520C96 533.3 106.7 544 120 544L264 544C273.7 544 282.5 538.2 286.2 529.2C289.9 520.2 287.9 509.9 281 503L241 463L320 384L399 463L359 503C352.1 509.9 350.1 520.2 353.8 529.2C357.5 538.2 366.3 544 376 544L520 544C533.3 544 544 533.3 544 520L544 376C544 366.3 538.2 357.5 529.2 353.8C520.2 350.1 509.9 352.1 503 359L463 399L384 320L463 241L503 281C509.9 287.9 520.2 289.9 529.2 286.2C538.2 282.5 544 273.7 544 264L544 120C544 106.7 533.3 96 520 96L376 96C366.3 96 357.5 101.8 353.8 110.8C350.1 119.8 352.2 130.1 359 137L399 177L320 256L241 177L281 137C287.9 130.1 289.9 119.8 286.2 110.8C282.5 101.8 273.7 96 264 96z',
15601
+ title: this.expand.label ?? this.#pieChartService.getExpandConfig().label,
15602
+ onclick: () => {
15603
+ this.#popup.open({
15604
+ component: BizyPieChartPopupComponent,
15605
+ data: {
15606
+ download: {
15607
+ show: this.download?.show ?? this.#pieChartService.getDownloadConfig().show,
15608
+ label: this.download?.label ?? this.#pieChartService.getDownloadConfig().label,
15609
+ fileName: this.download?.fileName ?? this.#pieChartService.getDownloadConfig().fileName,
15610
+ },
15611
+ option: this.#echartsContainer.getOption()
15390
15612
  }
15391
- }
15392
- },
15393
- emphasis: {
15394
- iconStyle: {
15395
- color: textColor,
15396
- borderColor,
15397
- borderWidth: 1,
15398
- textBackgroundColor,
15399
- textPadding: 5,
15400
- }
15613
+ });
15401
15614
  }
15402
- };
15403
- const tooltip = {
15404
- show: this.tooltip?.show ?? DEFAULT_TOOLTIP.show,
15405
- trigger: 'item',
15406
- appendToBody: true,
15407
- formatter: this.tooltip?.formatter
15408
- };
15409
- let legend = {
15410
- show: this.legend?.show ?? DEFAULT_LEGEND.show,
15411
- orient: this.legend?.orient ?? DEFAULT_LEGEND.orient,
15412
- left: this.legend?.position ? this.legend?.position.x : DEFAULT_LEGEND.position.x,
15413
- top: this.legend?.position ? this.legend?.position.y : DEFAULT_LEGEND.position.y,
15414
- };
15415
- let graphic;
15416
- if (this.centerLabel) {
15417
- let centerLabelColor = this.#getClosestCssVariable(this.#elementRef.nativeElement, '--bizy-pie-chart-center-label-color');
15418
- let { width, height } = this.#chartContainer.getBoundingClientRect();
15419
- let base = Math.min(width, height);
15420
- let fontSize = base / 6;
15421
- graphic = {
15422
- type: 'text',
15423
- left: 'center',
15424
- top: 'center',
15425
- style: {
15426
- text: this.centerLabel,
15427
- fill: centerLabelColor,
15428
- textAlign: 'center',
15429
- fontSize,
15430
- fontWeight: 'bold'
15431
- }
15432
- };
15433
15615
  }
15434
- const option = {
15435
- tooltip,
15436
- toolbox,
15437
- legend,
15438
- series,
15439
- graphic
15440
- };
15441
- import('echarts').then(echarts => {
15442
- this.#echarts = echarts.init(this.#chartContainer);
15443
- Promise.resolve().then(() => {
15444
- this.#echarts.setOption(option);
15445
- this.#echarts.on('click', (params) => {
15446
- this.onSelect.emit({
15447
- name: params.data.name,
15448
- value: params.data.value,
15449
- color: params.data.itemStyle.color,
15450
- metadata: params.data.metadata || {}
15451
- });
15452
- });
15453
- this.#resizeSubscription.unsubscribe();
15454
- this.#resizeObserver = new ResizeObserver(() => this.#resize$.next());
15455
- const resizeRef = this.resizeRef ? this.resizeRef : this.#renderer.parentNode(this.#elementRef.nativeElement) ? this.#renderer.parentNode(this.#elementRef.nativeElement) : this.#elementRef.nativeElement;
15456
- this.#resizeObserver.observe(resizeRef);
15457
- this.#resizeSubscription = new Subscription();
15458
- this.#resizeSubscription.add(this.#resize$.pipe(skip(1), auditTime(300), throttleTime(500)).subscribe(() => {
15459
- this.#deleteChartContainer();
15460
- this.#createChartContainer();
15461
- if (!this.#chartContainer) {
15462
- return;
15463
- }
15464
- this.#echarts = echarts.init(this.#chartContainer);
15465
- Promise.resolve().then(() => {
15466
- this.#echarts.setOption({ ...option, series: option.series.map(_serie => { return { ..._serie, data: this.#data }; }) });
15467
- this.#echarts.on('click', (params) => {
15468
- this.onSelect.emit({
15469
- name: params.data.name,
15470
- value: params.data.value,
15471
- color: params.data.itemStyle.color,
15472
- metadata: params.data.metadata || {}
15473
- });
15474
- });
15475
- });
15476
- }));
15477
- });
15478
- });
15479
- });
15480
- }));
15481
- }
15616
+ },
15617
+ emphasis: {
15618
+ iconStyle: {
15619
+ color: textColor,
15620
+ borderColor,
15621
+ borderWidth: 1,
15622
+ textBackgroundColor,
15623
+ textPadding: 5,
15624
+ }
15625
+ }
15626
+ };
15627
+ const tooltip = {
15628
+ show: this.tooltip?.show ?? this.#pieChartService.getTooltipConfig().show,
15629
+ trigger: 'item',
15630
+ appendToBody: true,
15631
+ formatter: this.tooltip?.formatter
15632
+ };
15633
+ let legend = {
15634
+ show: this.legend?.show ?? this.#pieChartService.getLegendConfig().show,
15635
+ orient: this.legend?.orient ?? this.#pieChartService.getLegendConfig().orient,
15636
+ left: this.legend?.position ? this.legend?.position.x : this.#pieChartService.getLegendConfig().position.x,
15637
+ top: this.legend?.position ? this.legend?.position.y : this.#pieChartService.getLegendConfig().position.y,
15638
+ };
15639
+ let graphic;
15640
+ if (this.centerLabel) {
15641
+ let centerLabelColor = this.#getClosestCssVariable(this.#elementRef.nativeElement, '--bizy-pie-chart-center-label-color');
15642
+ let { width, height } = this.#chartContainer.getBoundingClientRect();
15643
+ let base = Math.min(width, height);
15644
+ let fontSize = base / 6;
15645
+ graphic = {
15646
+ type: 'text',
15647
+ left: 'center',
15648
+ top: 'center',
15649
+ style: {
15650
+ text: this.centerLabel,
15651
+ fill: centerLabelColor,
15652
+ textAlign: 'center',
15653
+ fontSize,
15654
+ fontWeight: 'bold'
15655
+ }
15656
+ };
15657
+ }
15658
+ const option = {
15659
+ tooltip,
15660
+ toolbox,
15661
+ legend,
15662
+ series,
15663
+ graphic
15664
+ };
15665
+ this.#echartsContainer = this.#echarts.init(this.#chartContainer);
15666
+ this.#echartsContainer.setOption(option);
15667
+ this.#echartsContainer.on('click', (params) => {
15668
+ const section = this.sections.find(_section => _section.id === params.data.id);
15669
+ if (section) {
15670
+ section.onSelect.emit(params.event.event);
15671
+ }
15672
+ });
15673
+ };
15482
15674
  #createChartContainer = () => {
15483
15675
  if (this.#chartContainer || !this.#elementRef || !this.#elementRef.nativeElement) {
15484
15676
  return;
@@ -15487,8 +15679,8 @@ class BizyPieChartComponent {
15487
15679
  let elementHeight = this.#elementRef.nativeElement.offsetHeight;
15488
15680
  let minWidth = this.#getClosestCssVariable(this.#elementRef.nativeElement, '--bizy-pie-chart-width');
15489
15681
  let minHeight = this.#getClosestCssVariable(this.#elementRef.nativeElement, '--bizy-pie-chart-height');
15490
- const width = minWidth ? minWidth : elementWidth ? `${elementWidth * 0.99}px` : DEFAULT_CHART_SIZE;
15491
- const height = minHeight ? minHeight : elementHeight ? `${elementHeight}px` : DEFAULT_CHART_SIZE;
15682
+ const width = minWidth ? minWidth : elementWidth ? `${elementWidth}px` : `${this.#pieChartService.getChartSize()}px`;
15683
+ const height = minHeight ? minHeight : elementHeight ? `${elementHeight}px` : `${this.#pieChartService.getChartSize()}px`;
15492
15684
  this.#chartContainer = this.#renderer.createElement('div');
15493
15685
  this.#renderer.setStyle(this.#chartContainer, 'width', width);
15494
15686
  this.#renderer.setStyle(this.#chartContainer, 'height', height);
@@ -15499,7 +15691,7 @@ class BizyPieChartComponent {
15499
15691
  if (!this.#chartContainer || !this.#elementRef || !this.#elementRef.nativeElement) {
15500
15692
  return;
15501
15693
  }
15502
- this.#echarts.clear();
15694
+ this.#echartsContainer.clear();
15503
15695
  this.#renderer.removeChild(this.#elementRef.nativeElement, this.#chartContainer);
15504
15696
  this.#chartContainer = null;
15505
15697
  this.#ref.detectChanges();
@@ -15516,22 +15708,27 @@ class BizyPieChartComponent {
15516
15708
  return rootValue || null;
15517
15709
  };
15518
15710
  ngOnDestroy() {
15519
- this.#afterViewInitSubscription.unsubscribe();
15520
15711
  this.#resizeSubscription.unsubscribe();
15712
+ this.#pieChartSectionSubscription.unsubscribe();
15713
+ this.#pieChartSectionChangesSubscription.unsubscribe();
15714
+ this.#renderSubscription.unsubscribe();
15521
15715
  if (this.#resizeObserver) {
15522
15716
  this.#resizeObserver.disconnect();
15523
15717
  }
15524
- if (this.#echarts) {
15525
- this.#echarts.clear();
15718
+ if (this.#echartsContainer) {
15719
+ this.#echartsContainer.clear();
15526
15720
  }
15527
15721
  }
15528
15722
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: BizyPieChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
15529
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.5", type: BizyPieChartComponent, isStandalone: true, selector: "bizy-pie-chart", inputs: { resizeRef: "resizeRef", centerLabel: "centerLabel", tooltip: "tooltip", legend: "legend", download: "download", expand: "expand", label: "label", data: "data" }, outputs: { onSelect: "onSelect", onDownload: "onDownload" }, ngImport: i0, template: '', isInline: true, styles: [":host{display:flex;justify-content:center}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
15723
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.5", type: BizyPieChartComponent, isStandalone: true, selector: "bizy-pie-chart", inputs: { resizeRef: "resizeRef", centerLabel: "centerLabel", tooltip: "tooltip", legend: "legend", download: "download", expand: "expand", label: "label" }, outputs: { onDownload: "onDownload" }, queries: [{ propertyName: "sections", predicate: BizyPieChartSectionComponent }], ngImport: i0, template: '<ng-content select="bizy-pie-chart-section"></ng-content>', isInline: true, styles: [":host{display:flex;justify-content:center}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
15530
15724
  }
15531
15725
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: BizyPieChartComponent, decorators: [{
15532
15726
  type: Component,
15533
- args: [{ selector: 'bizy-pie-chart', template: '', changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:flex;justify-content:center}\n"] }]
15534
- }], propDecorators: { resizeRef: [{
15727
+ args: [{ selector: 'bizy-pie-chart', template: '<ng-content select="bizy-pie-chart-section"></ng-content>', changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:flex;justify-content:center}\n"] }]
15728
+ }], propDecorators: { sections: [{
15729
+ type: ContentChildren,
15730
+ args: [BizyPieChartSectionComponent]
15731
+ }], resizeRef: [{
15535
15732
  type: Input
15536
15733
  }], centerLabel: [{
15537
15734
  type: Input
@@ -15545,30 +15742,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.5", ngImpor
15545
15742
  type: Input
15546
15743
  }], label: [{
15547
15744
  type: Input
15548
- }], onSelect: [{
15549
- type: Output
15550
15745
  }], onDownload: [{
15551
15746
  type: Output
15552
- }], data: [{
15553
- type: Input
15554
15747
  }] } });
15555
15748
 
15556
15749
  const COMPONENTS$e = [
15557
15750
  BizyPieChartComponent,
15558
- BizyPieChartPopupComponent
15751
+ BizyPieChartPopupComponent,
15752
+ BizyPieChartSectionComponent
15559
15753
  ];
15560
15754
  class BizyPieChartModule {
15561
15755
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: BizyPieChartModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
15562
15756
  static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.0.5", ngImport: i0, type: BizyPieChartModule, imports: [BizyPieChartComponent,
15563
- BizyPieChartPopupComponent], exports: [BizyPieChartComponent,
15564
- BizyPieChartPopupComponent] });
15565
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: BizyPieChartModule });
15757
+ BizyPieChartPopupComponent,
15758
+ BizyPieChartSectionComponent], exports: [BizyPieChartComponent,
15759
+ BizyPieChartPopupComponent,
15760
+ BizyPieChartSectionComponent] });
15761
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: BizyPieChartModule, providers: [BizyPieChartService] });
15566
15762
  }
15567
15763
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: BizyPieChartModule, decorators: [{
15568
15764
  type: NgModule,
15569
15765
  args: [{
15570
15766
  imports: COMPONENTS$e,
15571
15767
  exports: COMPONENTS$e,
15768
+ providers: [BizyPieChartService]
15572
15769
  }]
15573
15770
  }] });
15574
15771
 
@@ -18271,6 +18468,42 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.5", ngImpor
18271
18468
  }]
18272
18469
  }] });
18273
18470
 
18471
+ class BizyMouseOverDirective {
18472
+ #elementRef = inject((ElementRef));
18473
+ bizyMouseOverDelay = 150;
18474
+ bizyMouseOver = new EventEmitter();
18475
+ bizyMouseOut = new EventEmitter();
18476
+ destroy$ = new Subject();
18477
+ ngOnInit() {
18478
+ const mouseEnter$ = fromEvent(this.#elementRef.nativeElement, 'mouseenter');
18479
+ const mouseLeave$ = fromEvent(this.#elementRef.nativeElement, 'mouseleave');
18480
+ mouseEnter$
18481
+ .pipe(switchMap(event => timer(this.bizyMouseOverDelay).pipe(tap(() => this.bizyMouseOver.emit(event)), takeUntil(mouseLeave$))), takeUntil(this.destroy$))
18482
+ .subscribe();
18483
+ mouseLeave$
18484
+ .pipe(tap(event => this.bizyMouseOut.emit(event)), takeUntil(this.destroy$))
18485
+ .subscribe();
18486
+ }
18487
+ ngOnDestroy() {
18488
+ this.destroy$.next();
18489
+ this.destroy$.complete();
18490
+ }
18491
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: BizyMouseOverDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
18492
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.0.5", type: BizyMouseOverDirective, isStandalone: true, selector: "[bizyMouseOver]", inputs: { bizyMouseOverDelay: "bizyMouseOverDelay" }, outputs: { bizyMouseOver: "bizyMouseOver", bizyMouseOut: "bizyMouseOut" }, ngImport: i0 });
18493
+ }
18494
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: BizyMouseOverDirective, decorators: [{
18495
+ type: Directive,
18496
+ args: [{
18497
+ selector: '[bizyMouseOver]'
18498
+ }]
18499
+ }], propDecorators: { bizyMouseOverDelay: [{
18500
+ type: Input
18501
+ }], bizyMouseOver: [{
18502
+ type: Output
18503
+ }], bizyMouseOut: [{
18504
+ type: Output
18505
+ }] } });
18506
+
18274
18507
  class BizyReloadDirective {
18275
18508
  bizyReloadThreshold = 200;
18276
18509
  bizyReload = new EventEmitter();
@@ -18987,7 +19220,8 @@ const DIRECTIVES = [
18987
19220
  BizyTextEllipsisDirective,
18988
19221
  BizyTooltipDirective,
18989
19222
  BizyAutoFocusDirective,
18990
- BizyReloadDirective
19223
+ BizyReloadDirective,
19224
+ BizyMouseOverDirective
18991
19225
  ];
18992
19226
  class BizyDirectivesModule {
18993
19227
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: BizyDirectivesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
@@ -19000,7 +19234,8 @@ class BizyDirectivesModule {
19000
19234
  BizyTextEllipsisDirective,
19001
19235
  BizyTooltipDirective,
19002
19236
  BizyAutoFocusDirective,
19003
- BizyReloadDirective], exports: [BizyCopyToClipboardDirective,
19237
+ BizyReloadDirective,
19238
+ BizyMouseOverDirective], exports: [BizyCopyToClipboardDirective,
19004
19239
  BizyCurrencyFormatDirective,
19005
19240
  BizyLoadingDirective,
19006
19241
  BizyLongPressDirective,
@@ -19009,7 +19244,8 @@ class BizyDirectivesModule {
19009
19244
  BizyTextEllipsisDirective,
19010
19245
  BizyTooltipDirective,
19011
19246
  BizyAutoFocusDirective,
19012
- BizyReloadDirective] });
19247
+ BizyReloadDirective,
19248
+ BizyMouseOverDirective] });
19013
19249
  static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: BizyDirectivesModule });
19014
19250
  }
19015
19251
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.5", ngImport: i0, type: BizyDirectivesModule, decorators: [{
@@ -19024,5 +19260,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.5", ngImpor
19024
19260
  * Generated bundle index. Do not edit.
19025
19261
  */
19026
19262
 
19027
- export { BIZY_ANIMATION, BIZY_BAR_LINE_CHART_AXIS_POSITION, BIZY_CALENDAR_DAY, BIZY_CALENDAR_EVENT_ACTION, BIZY_CALENDAR_LANGUAGE, BIZY_CALENDAR_MODE, BIZY_FORMAT_SECONDS_FORMAT, BIZY_FORMAT_SECONDS_LANGUAGE, BIZY_SKELETON_SHAPE, BIZY_STACKED_BAR_CHART_LEGEND_POSITION, BIZY_TAG_TYPE, BizyAccordionComponent, BizyAccordionModule, BizyAnimationService, BizyAudioPlayerComponent, BizyAudioPlayerFormatSecondsPipe, BizyAudioPlayerModule, BizyAudioRecorderComponent, BizyAudioRecorderModule, BizyAutoFocusDirective, BizyAveragePipe, BizyBarChartComponent, BizyBarLineChartComponent, BizyBarLineChartModule, BizyBarLineChartPopupComponent, BizyBreadcrumbComponent, BizyBreadcrumbModule, BizyButtonComponent, BizyButtonModule, BizyCacheService, BizyCalendarComponent, BizyCalendarModule, BizyCardComponent, BizyCardModule, BizyCheckboxComponent, BizyCheckboxModule, BizyContentComponent, BizyContentModule, BizyCopyToClipboardDirective, BizyCopyToClipboardService, BizyCurrencyFormatDirective, BizyDatePickerComponent, BizyDatePickerModule, BizyDeviceService, BizyDirectivesModule, BizyDonutChartComponent, BizyDonutChartModule, BizyDonutChartPopupComponent, BizyEnumToArrayPipe, BizyExportToCSVService, BizyExtractNumbersPipe, BizyFileUploaderComponent, BizyFileUploaderModule, BizyFileUploaderService, BizyFilterComponent, BizyFilterContentComponent, BizyFilterModule, BizyFilterPipe, BizyFilterSectionCheckboxOptionComponent, BizyFilterSectionComponent, BizyFilterSectionRangeOptionComponent, BizyFilterSectionSearchOptionComponent, BizyFilterSectionsComponent, BizyFormComponent, BizyFormModule, BizyFormatSecondsPipe, BizyFormatSecondsService, BizyFullScreenPopupWrapperComponent, BizyGaugeChartComponent, BizyGaugeChartModule, BizyGaugeChartPopupComponent, BizyGridComponent, BizyGridForDirective, BizyGridModule, BizyGridRowComponent, BizyHeatMapChartComponent, BizyHeatMapChartModule, BizyInputComponent, BizyInputModule, BizyInputOptionComponent, BizyKeyboardService, BizyLineChartComponent, BizyListComponent, BizyListModule, BizyLoadingDirective, BizyLogService, BizyLongPressDirective, BizyMenuBarComponent, BizyMenuBarModule, BizyMenuBarOptionComponent, BizyMenuComponent, BizyMenuModule, BizyMenuOptionComponent, BizyMenuTitleComponent, BizyOnlyNumbersDirective, BizyOnlyPhoneDigitsDirective, BizyOrderByPipe, BizyPieChartComponent, BizyPieChartModule, BizyPieChartPopupComponent, BizyPipesModule, BizyPopupModule, BizyPopupService, BizyPopupWrapperComponent, BizyProgressBarComponent, BizyProgressBarModule, BizyRadioComponent, BizyRadioModule, BizyRangeFilterPipe, BizyReducePipe, BizyReloadDirective, BizyRepeatPipe, BizyRoundPipe, BizyRouterService, BizySafePipe, BizySearchPipe, BizySectionCenterComponent, BizySectionComponent, BizySectionEndComponent, BizySectionModule, BizySectionStartComponent, BizySelectComponent, BizySelectModule, BizySelectOptionComponent, BizySelectSelectedOptionComponent, BizyServicesModule, BizySetToArrayPipe, BizySidebarComponent, BizySidebarFloatingOptionComponent, BizySidebarFloatingOptionTitleComponent, BizySidebarModule, BizySidebarOptionComponent, BizySkeletonComponent, BizySkeletonModule, BizySliderComponent, BizySliderModule, BizyStackedBarChartComponent, BizyStackedBarChartModule, BizyStackedBarChartSegmentComponent, BizyStorageService, BizyTabComponent, BizyTableColumnArrowsComponent, BizyTableColumnComponent, BizyTableColumnFixedDirective, BizyTableComponent, BizyTableFooterComponent, BizyTableHeaderComponent, BizyTableModule, BizyTableRowComponent, BizyTableRowExpandContentComponent, BizyTableScrollingComponent, BizyTableScrollingDirective, BizyTabsComponent, BizyTabsModule, BizyTagComponent, BizyTagModule, BizyTextEllipsisDirective, BizyTimelineComponent, BizyTimelineEventComponent, BizyTimelineModule, BizyToastModule, BizyToastService, BizyToastWrapperComponent, BizyToggleComponent, BizyToggleModule, BizyToolbarComponent, BizyToolbarModule, BizyTooltipDirective, BizyTranslateModule, BizyTranslatePipe, BizyTranslateService, BizyUniquePipe, BizyValidatorService, BizyViewportService, LANGUAGE, LOADING_TYPE, MIME_TYPE, POPUP_PLACEMENT };
19263
+ export { BIZY_ANIMATION, BIZY_BAR_LINE_CHART_AXIS_POSITION, BIZY_CALENDAR_DAY, BIZY_CALENDAR_EVENT_ACTION, BIZY_CALENDAR_LANGUAGE, BIZY_CALENDAR_MODE, BIZY_FORMAT_SECONDS_FORMAT, BIZY_FORMAT_SECONDS_LANGUAGE, BIZY_SKELETON_SHAPE, BIZY_STACKED_BAR_CHART_LEGEND_POSITION, BIZY_TAG_TYPE, BizyAccordionComponent, BizyAccordionModule, BizyAnimationService, BizyAudioPlayerComponent, BizyAudioPlayerFormatSecondsPipe, BizyAudioPlayerModule, BizyAudioRecorderComponent, BizyAudioRecorderModule, BizyAutoFocusDirective, BizyAveragePipe, BizyBarChartComponent, BizyBarLineChartComponent, BizyBarLineChartModule, BizyBarLineChartPopupComponent, BizyBreadcrumbComponent, BizyBreadcrumbModule, BizyButtonComponent, BizyButtonModule, BizyCacheService, BizyCalendarComponent, BizyCalendarModule, BizyCardComponent, BizyCardModule, BizyCheckboxComponent, BizyCheckboxModule, BizyContentComponent, BizyContentModule, BizyCopyToClipboardDirective, BizyCopyToClipboardService, BizyCurrencyFormatDirective, BizyDatePickerComponent, BizyDatePickerModule, BizyDeviceService, BizyDirectivesModule, BizyDonutChartComponent, BizyDonutChartModule, BizyDonutChartPopupComponent, BizyDonutChartSectionComponent, BizyEnumToArrayPipe, BizyExportToCSVService, BizyExtractNumbersPipe, BizyFileUploaderComponent, BizyFileUploaderModule, BizyFileUploaderService, BizyFilterComponent, BizyFilterContentComponent, BizyFilterModule, BizyFilterPipe, BizyFilterSectionCheckboxOptionComponent, BizyFilterSectionComponent, BizyFilterSectionRangeOptionComponent, BizyFilterSectionSearchOptionComponent, BizyFilterSectionsComponent, BizyFormComponent, BizyFormModule, BizyFormatSecondsPipe, BizyFormatSecondsService, BizyFullScreenPopupWrapperComponent, BizyGaugeChartComponent, BizyGaugeChartModule, BizyGaugeChartPopupComponent, BizyGridComponent, BizyGridForDirective, BizyGridModule, BizyGridRowComponent, BizyHeatMapChartComponent, BizyHeatMapChartModule, BizyInputComponent, BizyInputModule, BizyInputOptionComponent, BizyKeyboardService, BizyLineChartComponent, BizyListComponent, BizyListModule, BizyLoadingDirective, BizyLogService, BizyLongPressDirective, BizyMenuBarComponent, BizyMenuBarModule, BizyMenuBarOptionComponent, BizyMenuComponent, BizyMenuModule, BizyMenuOptionComponent, BizyMenuTitleComponent, BizyMouseOverDirective, BizyOnlyNumbersDirective, BizyOnlyPhoneDigitsDirective, BizyOrderByPipe, BizyPieChartComponent, BizyPieChartModule, BizyPieChartPopupComponent, BizyPieChartSectionComponent, BizyPieChartService, BizyPipesModule, BizyPopupModule, BizyPopupService, BizyPopupWrapperComponent, BizyProgressBarComponent, BizyProgressBarModule, BizyRadioComponent, BizyRadioModule, BizyRangeFilterPipe, BizyReducePipe, BizyReloadDirective, BizyRepeatPipe, BizyRoundPipe, BizyRouterService, BizySafePipe, BizySearchPipe, BizySectionCenterComponent, BizySectionComponent, BizySectionEndComponent, BizySectionModule, BizySectionStartComponent, BizySelectComponent, BizySelectModule, BizySelectOptionComponent, BizySelectSelectedOptionComponent, BizyServicesModule, BizySetToArrayPipe, BizySidebarComponent, BizySidebarFloatingOptionComponent, BizySidebarFloatingOptionTitleComponent, BizySidebarModule, BizySidebarOptionComponent, BizySkeletonComponent, BizySkeletonModule, BizySliderComponent, BizySliderModule, BizyStackedBarChartComponent, BizyStackedBarChartModule, BizyStackedBarChartSegmentComponent, BizyStorageService, BizyTabComponent, BizyTableColumnArrowsComponent, BizyTableColumnComponent, BizyTableColumnFixedDirective, BizyTableComponent, BizyTableFooterComponent, BizyTableHeaderComponent, BizyTableModule, BizyTableRowComponent, BizyTableRowExpandContentComponent, BizyTableScrollingComponent, BizyTableScrollingDirective, BizyTabsComponent, BizyTabsModule, BizyTagComponent, BizyTagModule, BizyTextEllipsisDirective, BizyTimelineComponent, BizyTimelineEventComponent, BizyTimelineModule, BizyToastModule, BizyToastService, BizyToastWrapperComponent, BizyToggleComponent, BizyToggleModule, BizyToolbarComponent, BizyToolbarModule, BizyTooltipDirective, BizyTranslateModule, BizyTranslatePipe, BizyTranslateService, BizyUniquePipe, BizyValidatorService, BizyViewportService, LANGUAGE, LOADING_TYPE, MIME_TYPE, POPUP_PLACEMENT };
19028
19264
  //# sourceMappingURL=bizy-core.mjs.map