integra-ng 20.1.9 → 20.1.11
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/integra-ng.mjs +645 -2
- package/fesm2022/integra-ng.mjs.map +1 -1
- package/index.d.ts +228 -2
- package/package.json +2 -1
package/fesm2022/integra-ng.mjs
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { EventEmitter, Output, Input, Component, ContentChildren, ElementRef, ViewChild, createComponent, Directive, Optional, Self, forwardRef, HostListener, ChangeDetectionStrategy, signal, inject, EnvironmentInjector, ApplicationRef, Injectable, input, computed, ViewEncapsulation, Inject } from '@angular/core';
|
|
2
|
+
import { EventEmitter, Output, Input, Component, ContentChildren, ElementRef, ViewChild, createComponent, Directive, Optional, Self, forwardRef, HostListener, ChangeDetectionStrategy, signal, inject, EnvironmentInjector, ApplicationRef, Injectable, input, computed, ViewEncapsulation, ViewChildren, Inject } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/common';
|
|
4
4
|
import { NgClass, CommonModule, NgTemplateOutlet, NgIf, NgFor, NgStyle, DOCUMENT } from '@angular/common';
|
|
5
5
|
import * as i2 from '@angular/forms';
|
|
6
6
|
import { FormsModule, NG_VALUE_ACCESSOR, NgControl } from '@angular/forms';
|
|
7
7
|
import { take } from 'rxjs/operators';
|
|
8
8
|
import { Subject, BehaviorSubject } from 'rxjs';
|
|
9
|
+
import { Chart, registerables } from 'chart.js';
|
|
9
10
|
import * as i1$1 from '@angular/platform-browser';
|
|
10
11
|
|
|
11
12
|
var lastId = 0;
|
|
@@ -6807,6 +6808,648 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImpor
|
|
|
6807
6808
|
args: ['document:mouseup']
|
|
6808
6809
|
}] } });
|
|
6809
6810
|
|
|
6811
|
+
// Register all Chart.js components
|
|
6812
|
+
Chart.register(...registerables);
|
|
6813
|
+
/**
|
|
6814
|
+
* Built-in color palette for chart colors.
|
|
6815
|
+
* Users can reference these colors using shorthand like '--blue-500' or direct hex values.
|
|
6816
|
+
* @internal
|
|
6817
|
+
*/
|
|
6818
|
+
const CHART_COLOR_PALETTE = {
|
|
6819
|
+
blue: {
|
|
6820
|
+
50: '#f5f9ff',
|
|
6821
|
+
100: '#d0e1fd',
|
|
6822
|
+
200: '#abc9fb',
|
|
6823
|
+
300: '#85b2f9',
|
|
6824
|
+
400: '#609af8',
|
|
6825
|
+
500: '#3b82f6',
|
|
6826
|
+
600: '#326fd1',
|
|
6827
|
+
700: '#295bac',
|
|
6828
|
+
800: '#204887',
|
|
6829
|
+
900: '#183462',
|
|
6830
|
+
},
|
|
6831
|
+
green: {
|
|
6832
|
+
50: '#f4fcf7',
|
|
6833
|
+
100: '#caf1d8',
|
|
6834
|
+
200: '#a0e6ba',
|
|
6835
|
+
300: '#76db9b',
|
|
6836
|
+
400: '#4cd07d',
|
|
6837
|
+
500: '#22c55e',
|
|
6838
|
+
600: '#1da750',
|
|
6839
|
+
700: '#188a42',
|
|
6840
|
+
800: '#136c34',
|
|
6841
|
+
900: '#0e4f26',
|
|
6842
|
+
},
|
|
6843
|
+
yellow: {
|
|
6844
|
+
50: '#fefbf3',
|
|
6845
|
+
100: '#faedc4',
|
|
6846
|
+
200: '#f6de95',
|
|
6847
|
+
300: '#f2d066',
|
|
6848
|
+
400: '#eec137',
|
|
6849
|
+
500: '#eab308',
|
|
6850
|
+
600: '#c79807',
|
|
6851
|
+
700: '#a47d06',
|
|
6852
|
+
800: '#816204',
|
|
6853
|
+
900: '#5e4803',
|
|
6854
|
+
},
|
|
6855
|
+
cyan: {
|
|
6856
|
+
50: '#f3fbfd',
|
|
6857
|
+
100: '#c3edf5',
|
|
6858
|
+
200: '#94e0ed',
|
|
6859
|
+
300: '#65d2e4',
|
|
6860
|
+
400: '#35c4dc',
|
|
6861
|
+
500: '#06b6d4',
|
|
6862
|
+
600: '#059bb4',
|
|
6863
|
+
700: '#047f94',
|
|
6864
|
+
800: '#036475',
|
|
6865
|
+
900: '#024955',
|
|
6866
|
+
},
|
|
6867
|
+
pink: {
|
|
6868
|
+
50: '#fef6fa',
|
|
6869
|
+
100: '#fad3e7',
|
|
6870
|
+
200: '#f7b0d3',
|
|
6871
|
+
300: '#f38ec0',
|
|
6872
|
+
400: '#f06bac',
|
|
6873
|
+
500: '#ec4899',
|
|
6874
|
+
600: '#c93d82',
|
|
6875
|
+
700: '#a5326b',
|
|
6876
|
+
800: '#822854',
|
|
6877
|
+
900: '#5e1d3d',
|
|
6878
|
+
},
|
|
6879
|
+
indigo: {
|
|
6880
|
+
50: '#f7f7fe',
|
|
6881
|
+
100: '#dadafc',
|
|
6882
|
+
200: '#bcbdf9',
|
|
6883
|
+
300: '#9ea0f6',
|
|
6884
|
+
400: '#8183f4',
|
|
6885
|
+
500: '#6366f1',
|
|
6886
|
+
600: '#5457cd',
|
|
6887
|
+
700: '#4547a9',
|
|
6888
|
+
800: '#363885',
|
|
6889
|
+
900: '#282960',
|
|
6890
|
+
},
|
|
6891
|
+
teal: {
|
|
6892
|
+
50: '#f3fbfb',
|
|
6893
|
+
100: '#c7eeea',
|
|
6894
|
+
200: '#9ae0d9',
|
|
6895
|
+
300: '#6dd3c8',
|
|
6896
|
+
400: '#41c5b7',
|
|
6897
|
+
500: '#14b8a6',
|
|
6898
|
+
600: '#119c8d',
|
|
6899
|
+
700: '#0e8174',
|
|
6900
|
+
800: '#0b655b',
|
|
6901
|
+
900: '#084a42',
|
|
6902
|
+
},
|
|
6903
|
+
orange: {
|
|
6904
|
+
50: '#fff7ed',
|
|
6905
|
+
100: '#ffedd5',
|
|
6906
|
+
200: '#fed7aa',
|
|
6907
|
+
300: '#fdba74',
|
|
6908
|
+
400: '#fb923c',
|
|
6909
|
+
500: '#f59e0b',
|
|
6910
|
+
600: '#d97706',
|
|
6911
|
+
700: '#b45309',
|
|
6912
|
+
800: '#92400e',
|
|
6913
|
+
900: '#78350f',
|
|
6914
|
+
},
|
|
6915
|
+
bluegray: {
|
|
6916
|
+
50: '#f7f8f9',
|
|
6917
|
+
100: '#dadee3',
|
|
6918
|
+
200: '#bcc3cd',
|
|
6919
|
+
300: '#9fa9b7',
|
|
6920
|
+
400: '#818ea1',
|
|
6921
|
+
500: '#64748b',
|
|
6922
|
+
600: '#556376',
|
|
6923
|
+
700: '#465161',
|
|
6924
|
+
800: '#37404c',
|
|
6925
|
+
900: '#282e38',
|
|
6926
|
+
},
|
|
6927
|
+
purple: {
|
|
6928
|
+
50: '#fbf7ff',
|
|
6929
|
+
100: '#ead6fd',
|
|
6930
|
+
200: '#dab6fc',
|
|
6931
|
+
300: '#c996fa',
|
|
6932
|
+
400: '#b975f9',
|
|
6933
|
+
500: '#a855f7',
|
|
6934
|
+
600: '#8f48d2',
|
|
6935
|
+
700: '#763cad',
|
|
6936
|
+
800: '#5c2f88',
|
|
6937
|
+
900: '#432263',
|
|
6938
|
+
},
|
|
6939
|
+
red: {
|
|
6940
|
+
50: '#fff5f5',
|
|
6941
|
+
100: '#ffd0ce',
|
|
6942
|
+
200: '#ffaca7',
|
|
6943
|
+
300: '#ff8780',
|
|
6944
|
+
400: '#ff6259',
|
|
6945
|
+
500: '#ff3d32',
|
|
6946
|
+
600: '#d9342b',
|
|
6947
|
+
700: '#b32b23',
|
|
6948
|
+
800: '#8c221c',
|
|
6949
|
+
900: '#661814',
|
|
6950
|
+
},
|
|
6951
|
+
gray: {
|
|
6952
|
+
0: '#ffffff',
|
|
6953
|
+
50: '#f8fafc',
|
|
6954
|
+
100: '#f1f5f9',
|
|
6955
|
+
200: '#e2e8f0',
|
|
6956
|
+
300: '#cbd5e1',
|
|
6957
|
+
400: '#94a3b8',
|
|
6958
|
+
500: '#64748b',
|
|
6959
|
+
600: '#475569',
|
|
6960
|
+
700: '#334155',
|
|
6961
|
+
800: '#1e293b',
|
|
6962
|
+
900: '#111827',
|
|
6963
|
+
950: '#020617',
|
|
6964
|
+
},
|
|
6965
|
+
};
|
|
6966
|
+
/**
|
|
6967
|
+
* Chart Component
|
|
6968
|
+
*
|
|
6969
|
+
* A Chart.js-based chart component for displaying various chart types.
|
|
6970
|
+
* Supports multiple charts in a responsive grid layout.
|
|
6971
|
+
*
|
|
6972
|
+
* @example
|
|
6973
|
+
* ```html
|
|
6974
|
+
* <i-chart
|
|
6975
|
+
* [charts]="myCharts"
|
|
6976
|
+
* height="25rem">
|
|
6977
|
+
* </i-chart>
|
|
6978
|
+
* ```
|
|
6979
|
+
*
|
|
6980
|
+
* @example
|
|
6981
|
+
* ```typescript
|
|
6982
|
+
* myCharts: IChartData[] = [
|
|
6983
|
+
* {
|
|
6984
|
+
* chartId: 'sales-chart',
|
|
6985
|
+
* chartType: 'bar',
|
|
6986
|
+
* labels: ['Jan', 'Feb', 'Mar'],
|
|
6987
|
+
* dataSets: [{
|
|
6988
|
+
* label: 'Sales',
|
|
6989
|
+
* data: [100, 200, 150],
|
|
6990
|
+
* backgroundColors: ['--blue-500', '--green-500', '--orange-500']
|
|
6991
|
+
* }]
|
|
6992
|
+
* }
|
|
6993
|
+
* ];
|
|
6994
|
+
* ```
|
|
6995
|
+
*/
|
|
6996
|
+
class IChart {
|
|
6997
|
+
/**
|
|
6998
|
+
* Array of chart data objects to render
|
|
6999
|
+
*/
|
|
7000
|
+
charts = [];
|
|
7001
|
+
/**
|
|
7002
|
+
* Default height for charts
|
|
7003
|
+
* @default '20rem'
|
|
7004
|
+
*/
|
|
7005
|
+
height = '20rem';
|
|
7006
|
+
/**
|
|
7007
|
+
* Whether charts should be responsive
|
|
7008
|
+
* @default true
|
|
7009
|
+
*/
|
|
7010
|
+
responsive = true;
|
|
7011
|
+
/**
|
|
7012
|
+
* Reference to all canvas elements
|
|
7013
|
+
* @internal
|
|
7014
|
+
*/
|
|
7015
|
+
canvasElements;
|
|
7016
|
+
/**
|
|
7017
|
+
* Array of display configurations for each chart
|
|
7018
|
+
* @internal
|
|
7019
|
+
*/
|
|
7020
|
+
chartDisplays = [];
|
|
7021
|
+
/**
|
|
7022
|
+
* Chart.js instances for cleanup
|
|
7023
|
+
* @internal
|
|
7024
|
+
*/
|
|
7025
|
+
chartInstances = [];
|
|
7026
|
+
/**
|
|
7027
|
+
* Flag to track if component has initialized
|
|
7028
|
+
* @internal
|
|
7029
|
+
*/
|
|
7030
|
+
initialized = false;
|
|
7031
|
+
/**
|
|
7032
|
+
* Reference to pending animation frame for cleanup
|
|
7033
|
+
* @internal
|
|
7034
|
+
*/
|
|
7035
|
+
pendingAnimationFrame = null;
|
|
7036
|
+
ngAfterViewInit() {
|
|
7037
|
+
this.initialized = true;
|
|
7038
|
+
this.initializeCharts();
|
|
7039
|
+
}
|
|
7040
|
+
ngOnChanges(changes) {
|
|
7041
|
+
if (changes['charts'] && this.initialized) {
|
|
7042
|
+
this.destroyCharts();
|
|
7043
|
+
this.initializeCharts();
|
|
7044
|
+
}
|
|
7045
|
+
}
|
|
7046
|
+
ngOnDestroy() {
|
|
7047
|
+
this.cancelPendingInitialization();
|
|
7048
|
+
this.destroyCharts();
|
|
7049
|
+
}
|
|
7050
|
+
/**
|
|
7051
|
+
* Cancel any pending chart initialization
|
|
7052
|
+
* @internal
|
|
7053
|
+
*/
|
|
7054
|
+
cancelPendingInitialization() {
|
|
7055
|
+
if (this.pendingAnimationFrame !== null) {
|
|
7056
|
+
cancelAnimationFrame(this.pendingAnimationFrame);
|
|
7057
|
+
this.pendingAnimationFrame = null;
|
|
7058
|
+
}
|
|
7059
|
+
}
|
|
7060
|
+
/**
|
|
7061
|
+
* Initialize all charts
|
|
7062
|
+
* @internal
|
|
7063
|
+
*/
|
|
7064
|
+
initializeCharts() {
|
|
7065
|
+
this.chartDisplays = this.charts.map((chart) => this.transformToChartDisplay(chart));
|
|
7066
|
+
// Cancel any pending initialization
|
|
7067
|
+
this.cancelPendingInitialization();
|
|
7068
|
+
// Use requestAnimationFrame for proper timing after view update
|
|
7069
|
+
this.pendingAnimationFrame = requestAnimationFrame(() => {
|
|
7070
|
+
this.pendingAnimationFrame = null;
|
|
7071
|
+
this.canvasElements.forEach((canvasRef, index) => {
|
|
7072
|
+
const chartDisplay = this.chartDisplays[index];
|
|
7073
|
+
if (chartDisplay && canvasRef) {
|
|
7074
|
+
const chartInstance = this.createChartInstance(canvasRef.nativeElement, chartDisplay);
|
|
7075
|
+
this.chartInstances.push(chartInstance);
|
|
7076
|
+
}
|
|
7077
|
+
});
|
|
7078
|
+
});
|
|
7079
|
+
}
|
|
7080
|
+
/**
|
|
7081
|
+
* Destroy all chart instances
|
|
7082
|
+
* @internal
|
|
7083
|
+
*/
|
|
7084
|
+
destroyCharts() {
|
|
7085
|
+
this.chartInstances.forEach((chart) => {
|
|
7086
|
+
chart.destroy();
|
|
7087
|
+
});
|
|
7088
|
+
this.chartInstances = [];
|
|
7089
|
+
this.chartDisplays = [];
|
|
7090
|
+
}
|
|
7091
|
+
/**
|
|
7092
|
+
* Create a Chart.js instance
|
|
7093
|
+
* @internal
|
|
7094
|
+
*/
|
|
7095
|
+
createChartInstance(canvas, display) {
|
|
7096
|
+
const config = {
|
|
7097
|
+
type: display.type,
|
|
7098
|
+
data: display.data,
|
|
7099
|
+
options: display.options,
|
|
7100
|
+
};
|
|
7101
|
+
return new Chart(canvas, config);
|
|
7102
|
+
}
|
|
7103
|
+
/**
|
|
7104
|
+
* Transform IChartData to IChartDisplay
|
|
7105
|
+
* @internal
|
|
7106
|
+
*/
|
|
7107
|
+
transformToChartDisplay(chart) {
|
|
7108
|
+
const documentStyle = getComputedStyle(document.documentElement);
|
|
7109
|
+
// Use proper theme CSS variable names with fallbacks
|
|
7110
|
+
const textColor = documentStyle.getPropertyValue('--color-text-primary').trim() ||
|
|
7111
|
+
documentStyle.getPropertyValue('--text-color').trim() ||
|
|
7112
|
+
'#333333';
|
|
7113
|
+
const textColorSecondary = documentStyle.getPropertyValue('--color-text-secondary').trim() ||
|
|
7114
|
+
documentStyle.getPropertyValue('--text-color-secondary').trim() ||
|
|
7115
|
+
'#666666';
|
|
7116
|
+
const surfaceBorder = documentStyle.getPropertyValue('--surface-border').trim() ||
|
|
7117
|
+
documentStyle.getPropertyValue('--color-border').trim() ||
|
|
7118
|
+
'#e2e8f0';
|
|
7119
|
+
const chartType = this.mapChartType(chart.chartType);
|
|
7120
|
+
const height = this.getChartHeight(chart.chartType);
|
|
7121
|
+
const options = this.getChartOptions(chart.chartType, textColor, textColorSecondary, surfaceBorder);
|
|
7122
|
+
const data = {
|
|
7123
|
+
labels: chart.labels,
|
|
7124
|
+
datasets: chart.dataSets.map((dataset) => this.transformDataset(dataset, documentStyle)),
|
|
7125
|
+
};
|
|
7126
|
+
return {
|
|
7127
|
+
type: chartType,
|
|
7128
|
+
data,
|
|
7129
|
+
options,
|
|
7130
|
+
height,
|
|
7131
|
+
};
|
|
7132
|
+
}
|
|
7133
|
+
/**
|
|
7134
|
+
* Map custom chart type strings to Chart.js types
|
|
7135
|
+
* @internal
|
|
7136
|
+
*/
|
|
7137
|
+
mapChartType(chartType) {
|
|
7138
|
+
const typeMap = {
|
|
7139
|
+
bar: 'bar',
|
|
7140
|
+
'bar-stack': 'bar',
|
|
7141
|
+
'bar-large': 'bar',
|
|
7142
|
+
'bar-horizontal': 'bar',
|
|
7143
|
+
pie: 'pie',
|
|
7144
|
+
doughnut: 'doughnut',
|
|
7145
|
+
line: 'line',
|
|
7146
|
+
scatter: 'scatter',
|
|
7147
|
+
bubble: 'bubble',
|
|
7148
|
+
polarArea: 'polarArea',
|
|
7149
|
+
radar: 'radar',
|
|
7150
|
+
};
|
|
7151
|
+
return typeMap[chartType] || 'bar';
|
|
7152
|
+
}
|
|
7153
|
+
/**
|
|
7154
|
+
* Get chart height based on chart type
|
|
7155
|
+
* @internal
|
|
7156
|
+
*/
|
|
7157
|
+
getChartHeight(chartType) {
|
|
7158
|
+
if (chartType === 'bar-large') {
|
|
7159
|
+
return '40rem';
|
|
7160
|
+
}
|
|
7161
|
+
return this.height;
|
|
7162
|
+
}
|
|
7163
|
+
/**
|
|
7164
|
+
* Get chart options based on chart type
|
|
7165
|
+
* @internal
|
|
7166
|
+
*/
|
|
7167
|
+
getChartOptions(chartType, textColor, textColorSecondary, surfaceBorder) {
|
|
7168
|
+
const baseOptions = {
|
|
7169
|
+
maintainAspectRatio: false,
|
|
7170
|
+
responsive: this.responsive,
|
|
7171
|
+
plugins: {
|
|
7172
|
+
legend: {
|
|
7173
|
+
labels: {
|
|
7174
|
+
color: textColor,
|
|
7175
|
+
},
|
|
7176
|
+
},
|
|
7177
|
+
},
|
|
7178
|
+
};
|
|
7179
|
+
switch (chartType) {
|
|
7180
|
+
case 'bar':
|
|
7181
|
+
return {
|
|
7182
|
+
...baseOptions,
|
|
7183
|
+
scales: this.getBarScales(textColorSecondary, surfaceBorder),
|
|
7184
|
+
};
|
|
7185
|
+
case 'bar-stack':
|
|
7186
|
+
return {
|
|
7187
|
+
...baseOptions,
|
|
7188
|
+
scales: this.getStackedBarScales(textColorSecondary, surfaceBorder),
|
|
7189
|
+
};
|
|
7190
|
+
case 'bar-large':
|
|
7191
|
+
return {
|
|
7192
|
+
...baseOptions,
|
|
7193
|
+
scales: this.getBarScales(textColorSecondary, surfaceBorder),
|
|
7194
|
+
};
|
|
7195
|
+
case 'bar-horizontal':
|
|
7196
|
+
return {
|
|
7197
|
+
...baseOptions,
|
|
7198
|
+
indexAxis: 'y',
|
|
7199
|
+
scales: this.getBarScales(textColorSecondary, surfaceBorder),
|
|
7200
|
+
};
|
|
7201
|
+
case 'pie':
|
|
7202
|
+
case 'doughnut':
|
|
7203
|
+
return {
|
|
7204
|
+
...baseOptions,
|
|
7205
|
+
plugins: {
|
|
7206
|
+
legend: {
|
|
7207
|
+
labels: {
|
|
7208
|
+
color: textColor,
|
|
7209
|
+
},
|
|
7210
|
+
position: 'bottom',
|
|
7211
|
+
},
|
|
7212
|
+
},
|
|
7213
|
+
};
|
|
7214
|
+
case 'line':
|
|
7215
|
+
return {
|
|
7216
|
+
...baseOptions,
|
|
7217
|
+
scales: this.getLineScales(textColorSecondary, surfaceBorder),
|
|
7218
|
+
};
|
|
7219
|
+
case 'radar':
|
|
7220
|
+
return {
|
|
7221
|
+
...baseOptions,
|
|
7222
|
+
plugins: {
|
|
7223
|
+
legend: {
|
|
7224
|
+
labels: {
|
|
7225
|
+
color: textColor,
|
|
7226
|
+
},
|
|
7227
|
+
},
|
|
7228
|
+
},
|
|
7229
|
+
scales: {
|
|
7230
|
+
r: {
|
|
7231
|
+
grid: {
|
|
7232
|
+
color: surfaceBorder,
|
|
7233
|
+
},
|
|
7234
|
+
pointLabels: {
|
|
7235
|
+
color: textColorSecondary,
|
|
7236
|
+
},
|
|
7237
|
+
},
|
|
7238
|
+
},
|
|
7239
|
+
};
|
|
7240
|
+
case 'polarArea':
|
|
7241
|
+
return {
|
|
7242
|
+
...baseOptions,
|
|
7243
|
+
scales: {
|
|
7244
|
+
r: {
|
|
7245
|
+
grid: {
|
|
7246
|
+
color: surfaceBorder,
|
|
7247
|
+
},
|
|
7248
|
+
},
|
|
7249
|
+
},
|
|
7250
|
+
};
|
|
7251
|
+
default:
|
|
7252
|
+
return baseOptions;
|
|
7253
|
+
}
|
|
7254
|
+
}
|
|
7255
|
+
/**
|
|
7256
|
+
* Get scales configuration for bar charts
|
|
7257
|
+
* @internal
|
|
7258
|
+
*/
|
|
7259
|
+
getBarScales(textColorSecondary, surfaceBorder) {
|
|
7260
|
+
return {
|
|
7261
|
+
x: {
|
|
7262
|
+
ticks: {
|
|
7263
|
+
color: textColorSecondary,
|
|
7264
|
+
},
|
|
7265
|
+
grid: {
|
|
7266
|
+
color: surfaceBorder,
|
|
7267
|
+
},
|
|
7268
|
+
},
|
|
7269
|
+
y: {
|
|
7270
|
+
ticks: {
|
|
7271
|
+
color: textColorSecondary,
|
|
7272
|
+
},
|
|
7273
|
+
grid: {
|
|
7274
|
+
color: surfaceBorder,
|
|
7275
|
+
},
|
|
7276
|
+
},
|
|
7277
|
+
};
|
|
7278
|
+
}
|
|
7279
|
+
/**
|
|
7280
|
+
* Get scales configuration for stacked bar charts
|
|
7281
|
+
* @internal
|
|
7282
|
+
*/
|
|
7283
|
+
getStackedBarScales(textColorSecondary, surfaceBorder) {
|
|
7284
|
+
return {
|
|
7285
|
+
x: {
|
|
7286
|
+
stacked: true,
|
|
7287
|
+
ticks: {
|
|
7288
|
+
color: textColorSecondary,
|
|
7289
|
+
},
|
|
7290
|
+
grid: {
|
|
7291
|
+
color: surfaceBorder,
|
|
7292
|
+
},
|
|
7293
|
+
},
|
|
7294
|
+
y: {
|
|
7295
|
+
stacked: true,
|
|
7296
|
+
ticks: {
|
|
7297
|
+
color: textColorSecondary,
|
|
7298
|
+
},
|
|
7299
|
+
grid: {
|
|
7300
|
+
color: surfaceBorder,
|
|
7301
|
+
},
|
|
7302
|
+
},
|
|
7303
|
+
};
|
|
7304
|
+
}
|
|
7305
|
+
/**
|
|
7306
|
+
* Get scales configuration for line charts
|
|
7307
|
+
* @internal
|
|
7308
|
+
*/
|
|
7309
|
+
getLineScales(textColorSecondary, surfaceBorder) {
|
|
7310
|
+
return {
|
|
7311
|
+
x: {
|
|
7312
|
+
ticks: {
|
|
7313
|
+
color: textColorSecondary,
|
|
7314
|
+
},
|
|
7315
|
+
grid: {
|
|
7316
|
+
color: surfaceBorder,
|
|
7317
|
+
},
|
|
7318
|
+
},
|
|
7319
|
+
y: {
|
|
7320
|
+
ticks: {
|
|
7321
|
+
color: textColorSecondary,
|
|
7322
|
+
},
|
|
7323
|
+
grid: {
|
|
7324
|
+
color: surfaceBorder,
|
|
7325
|
+
},
|
|
7326
|
+
},
|
|
7327
|
+
};
|
|
7328
|
+
}
|
|
7329
|
+
/**
|
|
7330
|
+
* Transform dataset with resolved colors
|
|
7331
|
+
* @internal
|
|
7332
|
+
*/
|
|
7333
|
+
transformDataset(dataset, documentStyle) {
|
|
7334
|
+
return {
|
|
7335
|
+
label: dataset.label,
|
|
7336
|
+
data: dataset.data,
|
|
7337
|
+
backgroundColor: dataset.backgroundColors.map((color) => {
|
|
7338
|
+
const resolvedColor = this.resolveColor(color, documentStyle);
|
|
7339
|
+
return this.addTransparency(resolvedColor);
|
|
7340
|
+
}),
|
|
7341
|
+
borderColor: dataset.backgroundColors.map((color) => this.resolveColor(color, documentStyle)),
|
|
7342
|
+
borderWidth: 1,
|
|
7343
|
+
};
|
|
7344
|
+
}
|
|
7345
|
+
/**
|
|
7346
|
+
* Resolve color to hex value. Supports:
|
|
7347
|
+
* - Direct hex colors (e.g., '#ff0000')
|
|
7348
|
+
* - RGB/RGBA colors (e.g., 'rgb(255, 0, 0)', 'rgba(255, 0, 0, 0.5)')
|
|
7349
|
+
* - Built-in palette shorthand (e.g., '--blue-500', '--green-400')
|
|
7350
|
+
* - CSS custom properties (e.g., '--my-custom-color')
|
|
7351
|
+
* @internal
|
|
7352
|
+
*/
|
|
7353
|
+
resolveColor(color, documentStyle) {
|
|
7354
|
+
// If it's already a hex color or rgb/rgba, return as-is
|
|
7355
|
+
if (color.startsWith('#') || color.startsWith('rgb(') || color.startsWith('rgba(')) {
|
|
7356
|
+
return color;
|
|
7357
|
+
}
|
|
7358
|
+
// Handle CSS variable format (--color-name or --color-shade)
|
|
7359
|
+
if (color.startsWith('--')) {
|
|
7360
|
+
// Try to resolve from built-in palette first (e.g., --blue-500)
|
|
7361
|
+
const paletteColor = this.resolveFromPalette(color);
|
|
7362
|
+
if (paletteColor) {
|
|
7363
|
+
return paletteColor;
|
|
7364
|
+
}
|
|
7365
|
+
// Fall back to CSS custom property lookup
|
|
7366
|
+
const cssValue = documentStyle.getPropertyValue(color).trim();
|
|
7367
|
+
if (cssValue) {
|
|
7368
|
+
return cssValue;
|
|
7369
|
+
}
|
|
7370
|
+
// If CSS variable is not found, return a fallback color
|
|
7371
|
+
return '#64748b'; // Default gray-500
|
|
7372
|
+
}
|
|
7373
|
+
return color;
|
|
7374
|
+
}
|
|
7375
|
+
/**
|
|
7376
|
+
* Resolve color from built-in palette using shorthand format (e.g., '--blue-500')
|
|
7377
|
+
* @internal
|
|
7378
|
+
*/
|
|
7379
|
+
resolveFromPalette(colorVar) {
|
|
7380
|
+
// Remove leading '--' and split by '-'
|
|
7381
|
+
const colorName = colorVar.substring(2); // Remove '--'
|
|
7382
|
+
const lastDashIndex = colorName.lastIndexOf('-');
|
|
7383
|
+
if (lastDashIndex === -1) {
|
|
7384
|
+
return null;
|
|
7385
|
+
}
|
|
7386
|
+
const name = colorName.substring(0, lastDashIndex);
|
|
7387
|
+
const shade = colorName.substring(lastDashIndex + 1);
|
|
7388
|
+
const colorGroup = CHART_COLOR_PALETTE[name];
|
|
7389
|
+
if (colorGroup) {
|
|
7390
|
+
// Try as string key first, then as number for numeric shades like 500
|
|
7391
|
+
if (colorGroup[shade]) {
|
|
7392
|
+
return colorGroup[shade];
|
|
7393
|
+
}
|
|
7394
|
+
const numericShade = parseInt(shade, 10);
|
|
7395
|
+
if (!isNaN(numericShade) && colorGroup[numericShade]) {
|
|
7396
|
+
return colorGroup[numericShade];
|
|
7397
|
+
}
|
|
7398
|
+
}
|
|
7399
|
+
return null;
|
|
7400
|
+
}
|
|
7401
|
+
/**
|
|
7402
|
+
* Add transparency to a color. Supports hex and rgb/rgba formats.
|
|
7403
|
+
* @internal
|
|
7404
|
+
*/
|
|
7405
|
+
addTransparency(color) {
|
|
7406
|
+
// If it's a hex color, add transparency
|
|
7407
|
+
if (color.startsWith('#')) {
|
|
7408
|
+
return color + 'bf'; // ~75% opacity
|
|
7409
|
+
}
|
|
7410
|
+
// If it's an rgb color, convert to rgba with transparency
|
|
7411
|
+
if (color.startsWith('rgb(')) {
|
|
7412
|
+
// Extract the rgb values and convert to rgba
|
|
7413
|
+
const rgbMatch = color.match(/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/);
|
|
7414
|
+
if (rgbMatch) {
|
|
7415
|
+
return `rgba(${rgbMatch[1]}, ${rgbMatch[2]}, ${rgbMatch[3]}, 0.75)`;
|
|
7416
|
+
}
|
|
7417
|
+
}
|
|
7418
|
+
// If it's already rgba, leave as-is (user specified their own alpha)
|
|
7419
|
+
return color;
|
|
7420
|
+
}
|
|
7421
|
+
/**
|
|
7422
|
+
* Get the height style for a chart display
|
|
7423
|
+
* @param display - The chart display configuration
|
|
7424
|
+
* @returns The height CSS value
|
|
7425
|
+
*/
|
|
7426
|
+
getChartHeightStyle(display) {
|
|
7427
|
+
return display.height || this.height;
|
|
7428
|
+
}
|
|
7429
|
+
/**
|
|
7430
|
+
* Get the number of active chart instances (for testing)
|
|
7431
|
+
* @returns The count of active chart instances
|
|
7432
|
+
*/
|
|
7433
|
+
getChartInstanceCount() {
|
|
7434
|
+
return this.chartInstances.length;
|
|
7435
|
+
}
|
|
7436
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: IChart, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
7437
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.3", type: IChart, isStandalone: true, selector: "i-chart", inputs: { charts: "charts", height: "height", responsive: "responsive" }, viewQueries: [{ propertyName: "canvasElements", predicate: ["chartCanvas"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"i-charts-container\">\n @for (chartDisplay of chartDisplays; track chartDisplay) {\n <div class=\"i-chart-item\" [style.height]=\"getChartHeightStyle(chartDisplay)\">\n <canvas #chartCanvas></canvas>\n </div>\n }\n</div>\n", styles: [".i-charts-container{display:flex;flex-wrap:wrap;width:100%;gap:4rem}.i-chart-item{flex:1 1 45%;min-width:300px;box-sizing:border-box}@media (max-width: 768px){.i-charts-container{flex-direction:column}.i-chart-item{width:100%}}\n"] });
|
|
7438
|
+
}
|
|
7439
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: IChart, decorators: [{
|
|
7440
|
+
type: Component,
|
|
7441
|
+
args: [{ selector: 'i-chart', standalone: true, imports: [], template: "<div class=\"i-charts-container\">\n @for (chartDisplay of chartDisplays; track chartDisplay) {\n <div class=\"i-chart-item\" [style.height]=\"getChartHeightStyle(chartDisplay)\">\n <canvas #chartCanvas></canvas>\n </div>\n }\n</div>\n", styles: [".i-charts-container{display:flex;flex-wrap:wrap;width:100%;gap:4rem}.i-chart-item{flex:1 1 45%;min-width:300px;box-sizing:border-box}@media (max-width: 768px){.i-charts-container{flex-direction:column}.i-chart-item{width:100%}}\n"] }]
|
|
7442
|
+
}], propDecorators: { charts: [{
|
|
7443
|
+
type: Input
|
|
7444
|
+
}], height: [{
|
|
7445
|
+
type: Input
|
|
7446
|
+
}], responsive: [{
|
|
7447
|
+
type: Input
|
|
7448
|
+
}], canvasElements: [{
|
|
7449
|
+
type: ViewChildren,
|
|
7450
|
+
args: ['chartCanvas']
|
|
7451
|
+
}] } });
|
|
7452
|
+
|
|
6810
7453
|
/**
|
|
6811
7454
|
* Service for broadcasting data update events across the application.
|
|
6812
7455
|
*
|
|
@@ -7265,5 +7908,5 @@ var zindexutils = ZIndexUtils();
|
|
|
7265
7908
|
* Generated bundle index. Do not edit.
|
|
7266
7909
|
*/
|
|
7267
7910
|
|
|
7268
|
-
export { AbstractDialog, ConfirmationDialogComponent, ConfirmationDialogService, DataUpdateEventService, DialogService, EmptyStateComponent, EmptyStateTableComponent, IAccordion, IAccordionList, IButton, ICalendar, ICard, ICheckbox, IChip, IChipsComponent, IDialog, IDialogActions, IDialogBase, IInputText, IListbox, IMessage, IMultiSelect, IPanel, IRadioButton, ISelect, ITabPanel, ITable, ITabs, ITreeView, IWhisper, SeoService, StructuredDataService, TooltipComponent, TooltipDirective, UniqueComponentId, WhisperService, ZIndexUtils, lastId };
|
|
7911
|
+
export { AbstractDialog, ConfirmationDialogComponent, ConfirmationDialogService, DataUpdateEventService, DialogService, EmptyStateComponent, EmptyStateTableComponent, IAccordion, IAccordionList, IButton, ICalendar, ICard, IChart, ICheckbox, IChip, IChipsComponent, IDialog, IDialogActions, IDialogBase, IInputText, IListbox, IMessage, IMultiSelect, IPanel, IRadioButton, ISelect, ITabPanel, ITable, ITabs, ITreeView, IWhisper, SeoService, StructuredDataService, TooltipComponent, TooltipDirective, UniqueComponentId, WhisperService, ZIndexUtils, lastId };
|
|
7269
7912
|
//# sourceMappingURL=integra-ng.mjs.map
|