Icard/angular-clarity-master(work.../node_modules/primeng/fesm2022/primeng-chart.mjs.map

1 line
10 KiB
Plaintext

{"version":3,"file":"primeng-chart.mjs","sources":["../../src/app/components/chart/chart.ts","../../src/app/components/chart/primeng-chart.ts"],"sourcesContent":["import { NgModule, Component, ElementRef, AfterViewInit, OnDestroy, Input, Output, EventEmitter, ChangeDetectionStrategy, ViewEncapsulation, Inject, PLATFORM_ID, NgZone, booleanAttribute } from '@angular/core';\nimport { CommonModule, isPlatformBrowser } from '@angular/common';\nimport Chart from 'chart.js/auto';\n/**\n * Chart groups a collection of contents in tabs.\n * @group Components\n */\n@Component({\n selector: 'p-chart',\n template: `\n <div style=\"position:relative\" [style.width]=\"responsive && !width ? null : width\" [style.height]=\"responsive && !height ? null : height\">\n <canvas role=\"img\" [attr.aria-label]=\"ariaLabel\" [attr.aria-labelledby]=\"ariaLabelledBy\" [attr.width]=\"responsive && !width ? null : width\" [attr.height]=\"responsive && !height ? null : height\" (click)=\"onCanvasClick($event)\"></canvas>\n </div>\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'p-element'\n }\n})\nexport class UIChart implements AfterViewInit, OnDestroy {\n /**\n * Type of the chart.\n * @group Props\n */\n @Input() type: string | undefined;\n /**\n * Array of per-chart plugins to customize the chart behaviour.\n * @group Props\n */\n @Input() plugins: any[] = [];\n /**\n * Width of the chart.\n * @group Props\n */\n @Input() width: string | undefined;\n /**\n * Height of the chart.\n * @group Props\n */\n @Input() height: string | undefined;\n /**\n * Whether the chart is redrawn on screen size change.\n * @group Props\n */\n @Input({ transform: booleanAttribute }) responsive: boolean = true;\n /**\n * Used to define a string that autocomplete attribute the current element.\n * @group Props\n */\n @Input() ariaLabel: string | undefined;\n /**\n * Establishes relationships between the component and label(s) where its value should be one or more element IDs.\n * @group Props\n */\n @Input() ariaLabelledBy: string | undefined;\n /**\n * Data to display.\n * @group Props\n */\n @Input() get data(): any {\n return this._data;\n }\n set data(val: any) {\n this._data = val;\n this.reinit();\n }\n /**\n * Options to customize the chart.\n * @group Props\n */\n @Input() get options(): any {\n return this._options;\n }\n set options(val: any) {\n this._options = val;\n this.reinit();\n }\n /**\n * Callback to execute when an element on chart is clicked.\n * @group Emits\n */\n @Output() onDataSelect: EventEmitter<any> = new EventEmitter<any>();\n\n isBrowser: boolean = false;\n\n initialized: boolean | undefined;\n\n _data: any;\n\n _options: any = {};\n\n chart: any;\n\n constructor(@Inject(PLATFORM_ID) private platformId: any, public el: ElementRef, private zone: NgZone) {}\n\n ngAfterViewInit() {\n this.initChart();\n this.initialized = true;\n }\n\n onCanvasClick(event: Event) {\n if (this.chart) {\n const element = this.chart.getElementsAtEventForMode(event, 'nearest', { intersect: true }, false);\n const dataset = this.chart.getElementsAtEventForMode(event, 'dataset', { intersect: true }, false);\n\n if (element && element[0] && dataset) {\n this.onDataSelect.emit({ originalEvent: event, element: element[0], dataset: dataset });\n }\n }\n }\n\n initChart() {\n if (isPlatformBrowser(this.platformId)) {\n let opts = this.options || {};\n opts.responsive = this.responsive;\n\n // allows chart to resize in responsive mode\n if (opts.responsive && (this.height || this.width)) {\n opts.maintainAspectRatio = false;\n }\n\n this.zone.runOutsideAngular(() => {\n this.chart = new Chart(this.el.nativeElement.children[0].children[0], {\n type: this.type,\n data: this.data,\n options: this.options,\n plugins: this.plugins\n });\n });\n }\n }\n\n getCanvas() {\n return this.el.nativeElement.children[0].children[0];\n }\n\n getBase64Image() {\n return this.chart.toBase64Image();\n }\n\n generateLegend() {\n if (this.chart) {\n return this.chart.generateLegend();\n }\n }\n\n refresh() {\n if (this.chart) {\n this.chart.update();\n }\n }\n\n reinit() {\n if (this.chart) {\n this.chart.destroy();\n this.initChart();\n }\n }\n\n ngOnDestroy() {\n if (this.chart) {\n this.chart.destroy();\n this.initialized = false;\n this.chart = null;\n }\n }\n}\n\n@NgModule({\n imports: [CommonModule],\n exports: [UIChart],\n declarations: [UIChart]\n})\nexport class ChartModule {}\n","/**\n *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