@nucleus-suite-pe/core 1.0.0 → 1.1.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.
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, ElementRef, input, computed, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import * as i1 from 'primeng/chart';
|
|
4
|
+
import { ChartModule } from 'primeng/chart';
|
|
5
|
+
import { ThemeService, NucleusLanguage } from '@nucleus-suite-pe/core';
|
|
6
|
+
|
|
7
|
+
const LIGHT_FALLBACK = {
|
|
8
|
+
series: ['#4f6bed', '#1f9d76', '#d08700', '#c2410c', '#8b5cf6', '#0891b2'],
|
|
9
|
+
ink: '#27272a',
|
|
10
|
+
muted: '#71717a',
|
|
11
|
+
line: '#e4e4e7',
|
|
12
|
+
accent: '#4f6bed',
|
|
13
|
+
};
|
|
14
|
+
const DARK_FALLBACK = {
|
|
15
|
+
series: ['#8aa0ff', '#4cc79b', '#e8b24a', '#f08a5d', '#b794f6', '#38bdf8'],
|
|
16
|
+
ink: '#e4e4e7',
|
|
17
|
+
muted: '#a1a1aa',
|
|
18
|
+
line: '#3f3f46',
|
|
19
|
+
accent: '#8aa0ff',
|
|
20
|
+
};
|
|
21
|
+
function readToken(host, name) {
|
|
22
|
+
try {
|
|
23
|
+
const value = getComputedStyle(host).getPropertyValue(name).trim();
|
|
24
|
+
return value.length > 0 ? value : '';
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return '';
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function rotate(accent, dark) {
|
|
31
|
+
const base = dark ? DARK_FALLBACK.series : LIGHT_FALLBACK.series;
|
|
32
|
+
return [accent, ...base.filter((color) => color.toLowerCase() !== accent.toLowerCase())];
|
|
33
|
+
}
|
|
34
|
+
function chartPalette(host, dark, accent) {
|
|
35
|
+
const fallback = dark ? DARK_FALLBACK : LIGHT_FALLBACK;
|
|
36
|
+
return {
|
|
37
|
+
series: rotate(accent || fallback.accent, dark),
|
|
38
|
+
ink: readToken(host, '--ns-frame-ink') || fallback.ink,
|
|
39
|
+
muted: readToken(host, '--ns-frame-muted') || fallback.muted,
|
|
40
|
+
line: readToken(host, '--ns-frame-line') || fallback.line,
|
|
41
|
+
accent: accent || fallback.accent,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
class NucleusChart {
|
|
46
|
+
host = inject(ElementRef);
|
|
47
|
+
theme = inject(ThemeService);
|
|
48
|
+
language = inject(NucleusLanguage);
|
|
49
|
+
kind = input('line', ...(ngDevMode ? [{ debugName: "kind" }] : /* istanbul ignore next */ []));
|
|
50
|
+
series = input([], ...(ngDevMode ? [{ debugName: "series" }] : /* istanbul ignore next */ []));
|
|
51
|
+
labels = input([], ...(ngDevMode ? [{ debugName: "labels" }] : /* istanbul ignore next */ []));
|
|
52
|
+
height = input(260, ...(ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []));
|
|
53
|
+
valueKind = input('number', ...(ngDevMode ? [{ debugName: "valueKind" }] : /* istanbul ignore next */ []));
|
|
54
|
+
currency = input('', ...(ngDevMode ? [{ debugName: "currency" }] : /* istanbul ignore next */ []));
|
|
55
|
+
empty = input('', ...(ngDevMode ? [{ debugName: "empty" }] : /* istanbul ignore next */ []));
|
|
56
|
+
caption = input('', ...(ngDevMode ? [{ debugName: "caption" }] : /* istanbul ignore next */ []));
|
|
57
|
+
axisLabel = input('', ...(ngDevMode ? [{ debugName: "axisLabel" }] : /* istanbul ignore next */ []));
|
|
58
|
+
beginAtZero = input(true, ...(ngDevMode ? [{ debugName: "beginAtZero" }] : /* istanbul ignore next */ []));
|
|
59
|
+
heightPx = computed(() => `${this.height()}px`, ...(ngDevMode ? [{ debugName: "heightPx" }] : /* istanbul ignore next */ []));
|
|
60
|
+
hasData = computed(() => this.labels().length > 0 && this.series().some((serie) => serie.values.length > 0), ...(ngDevMode ? [{ debugName: "hasData" }] : /* istanbul ignore next */ []));
|
|
61
|
+
primeType = computed(() => {
|
|
62
|
+
const kind = this.kind();
|
|
63
|
+
if (kind === 'area' || kind === 'line')
|
|
64
|
+
return 'line';
|
|
65
|
+
if (kind === 'doughnut')
|
|
66
|
+
return 'doughnut';
|
|
67
|
+
return 'bar';
|
|
68
|
+
}, ...(ngDevMode ? [{ debugName: "primeType" }] : /* istanbul ignore next */ []));
|
|
69
|
+
palette = computed(() => chartPalette(this.host.nativeElement, this.theme.canvasId() === 'dark', this.theme.accentColor()), ...(ngDevMode ? [{ debugName: "palette" }] : /* istanbul ignore next */ []));
|
|
70
|
+
data = computed(() => {
|
|
71
|
+
const palette = this.palette();
|
|
72
|
+
const kind = this.kind();
|
|
73
|
+
if (kind === 'doughnut') {
|
|
74
|
+
const serie = this.series()[0];
|
|
75
|
+
return {
|
|
76
|
+
labels: [...this.labels()],
|
|
77
|
+
datasets: [
|
|
78
|
+
{
|
|
79
|
+
data: serie ? [...serie.values] : [],
|
|
80
|
+
backgroundColor: [...palette.series],
|
|
81
|
+
borderWidth: 0,
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
labels: [...this.labels()],
|
|
88
|
+
datasets: this.series().map((serie, index) => {
|
|
89
|
+
const color = serie.color ?? palette.series[index % palette.series.length];
|
|
90
|
+
return {
|
|
91
|
+
label: serie.label,
|
|
92
|
+
data: [...serie.values],
|
|
93
|
+
borderColor: color,
|
|
94
|
+
backgroundColor: kind === 'area' ? `${color}26` : color,
|
|
95
|
+
fill: kind === 'area',
|
|
96
|
+
tension: kind === 'line' || kind === 'area' ? 0.3 : 0,
|
|
97
|
+
borderWidth: kind === 'bar' || kind === 'stackedBar' ? 0 : 2,
|
|
98
|
+
pointRadius: 0,
|
|
99
|
+
pointHoverRadius: 4,
|
|
100
|
+
borderRadius: kind === 'bar' || kind === 'stackedBar' ? 4 : 0,
|
|
101
|
+
};
|
|
102
|
+
}),
|
|
103
|
+
};
|
|
104
|
+
}, ...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
105
|
+
options = computed(() => {
|
|
106
|
+
const palette = this.palette();
|
|
107
|
+
const stacked = this.kind() === 'stackedBar';
|
|
108
|
+
const doughnut = this.kind() === 'doughnut';
|
|
109
|
+
const self = this;
|
|
110
|
+
return {
|
|
111
|
+
maintainAspectRatio: false,
|
|
112
|
+
animation: { duration: 400 },
|
|
113
|
+
interaction: { mode: 'index', intersect: false },
|
|
114
|
+
plugins: {
|
|
115
|
+
legend: {
|
|
116
|
+
display: this.series().length > 1 || doughnut,
|
|
117
|
+
position: 'bottom',
|
|
118
|
+
labels: { color: palette.muted, usePointStyle: true, boxWidth: 8 },
|
|
119
|
+
},
|
|
120
|
+
tooltip: {
|
|
121
|
+
callbacks: {
|
|
122
|
+
label(context) {
|
|
123
|
+
const raw = typeof context.parsed === 'number' ? context.parsed : (context.parsed.y ?? 0);
|
|
124
|
+
const name = context.dataset.label ? `${context.dataset.label}: ` : '';
|
|
125
|
+
return name + self.format(raw);
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
scales: doughnut
|
|
131
|
+
? {}
|
|
132
|
+
: {
|
|
133
|
+
x: {
|
|
134
|
+
stacked,
|
|
135
|
+
ticks: { color: palette.muted, maxRotation: 0, autoSkipPadding: 16 },
|
|
136
|
+
grid: { display: false },
|
|
137
|
+
},
|
|
138
|
+
y: {
|
|
139
|
+
stacked,
|
|
140
|
+
beginAtZero: this.beginAtZero(),
|
|
141
|
+
ticks: {
|
|
142
|
+
color: palette.muted,
|
|
143
|
+
callback: (value) => self.format(value),
|
|
144
|
+
},
|
|
145
|
+
grid: { color: palette.line, drawBorder: false },
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
}, ...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
|
|
150
|
+
format(value) {
|
|
151
|
+
if (value === null || value === undefined)
|
|
152
|
+
return '—';
|
|
153
|
+
const locale = this.language.lang() === 'es' ? 'es-PE' : 'en-US';
|
|
154
|
+
if (this.valueKind() === 'bytes')
|
|
155
|
+
return this.bytes(value, locale);
|
|
156
|
+
if (this.valueKind() === 'currency' && this.currency()) {
|
|
157
|
+
return new Intl.NumberFormat(locale, {
|
|
158
|
+
style: 'currency',
|
|
159
|
+
currency: this.currency(),
|
|
160
|
+
maximumFractionDigits: 0,
|
|
161
|
+
}).format(value);
|
|
162
|
+
}
|
|
163
|
+
return new Intl.NumberFormat(locale, { maximumFractionDigits: 2 }).format(value);
|
|
164
|
+
}
|
|
165
|
+
bytes(value, locale) {
|
|
166
|
+
const units = ['B', 'KB', 'MB', 'GB', 'TB'];
|
|
167
|
+
let size = value;
|
|
168
|
+
let unit = 0;
|
|
169
|
+
while (size >= 1024 && unit < units.length - 1) {
|
|
170
|
+
size /= 1024;
|
|
171
|
+
unit += 1;
|
|
172
|
+
}
|
|
173
|
+
return `${new Intl.NumberFormat(locale, { maximumFractionDigits: 1 }).format(size)} ${units[unit]}`;
|
|
174
|
+
}
|
|
175
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: NucleusChart, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
176
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.22", type: NucleusChart, isStandalone: true, selector: "nucleus-chart", inputs: { kind: { classPropertyName: "kind", publicName: "kind", isSignal: true, isRequired: false, transformFunction: null }, series: { classPropertyName: "series", publicName: "series", isSignal: true, isRequired: false, transformFunction: null }, labels: { classPropertyName: "labels", publicName: "labels", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, valueKind: { classPropertyName: "valueKind", publicName: "valueKind", isSignal: true, isRequired: false, transformFunction: null }, currency: { classPropertyName: "currency", publicName: "currency", isSignal: true, isRequired: false, transformFunction: null }, empty: { classPropertyName: "empty", publicName: "empty", isSignal: true, isRequired: false, transformFunction: null }, caption: { classPropertyName: "caption", publicName: "caption", isSignal: true, isRequired: false, transformFunction: null }, axisLabel: { classPropertyName: "axisLabel", publicName: "axisLabel", isSignal: true, isRequired: false, transformFunction: null }, beginAtZero: { classPropertyName: "beginAtZero", publicName: "beginAtZero", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
177
|
+
@if (hasData()) {
|
|
178
|
+
<p-chart
|
|
179
|
+
[type]="primeType()"
|
|
180
|
+
[data]="data()"
|
|
181
|
+
[options]="options()"
|
|
182
|
+
[height]="heightPx()"
|
|
183
|
+
[responsive]="true"
|
|
184
|
+
/>
|
|
185
|
+
|
|
186
|
+
<table class="sr">
|
|
187
|
+
<caption>{{ caption() }}</caption>
|
|
188
|
+
<thead>
|
|
189
|
+
<tr>
|
|
190
|
+
<th scope="col">{{ axisLabel() }}</th>
|
|
191
|
+
@for (serie of series(); track serie.key) {
|
|
192
|
+
<th scope="col">{{ serie.label }}</th>
|
|
193
|
+
}
|
|
194
|
+
</tr>
|
|
195
|
+
</thead>
|
|
196
|
+
<tbody>
|
|
197
|
+
@for (label of labels(); track $index) {
|
|
198
|
+
<tr>
|
|
199
|
+
<th scope="row">{{ label }}</th>
|
|
200
|
+
@for (serie of series(); track serie.key) {
|
|
201
|
+
<td>{{ format(serie.values[$index]) }}</td>
|
|
202
|
+
}
|
|
203
|
+
</tr>
|
|
204
|
+
}
|
|
205
|
+
</tbody>
|
|
206
|
+
</table>
|
|
207
|
+
} @else {
|
|
208
|
+
<div class="empty" [style.height.px]="height()">{{ empty() }}</div>
|
|
209
|
+
}
|
|
210
|
+
`, isInline: true, styles: [":host{display:block;position:relative}.empty{display:grid;place-items:center;height:100%;color:var(--ns-frame-muted, #71717a);font-size:.9rem}table.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}\n"], dependencies: [{ kind: "ngmodule", type: ChartModule }, { kind: "component", type: i1.UIChart, selector: "p-chart", inputs: ["type", "plugins", "width", "height", "responsive", "ariaLabel", "ariaLabelledBy", "data", "options"], outputs: ["onDataSelect"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
211
|
+
}
|
|
212
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: NucleusChart, decorators: [{
|
|
213
|
+
type: Component,
|
|
214
|
+
args: [{ selector: 'nucleus-chart', imports: [ChartModule], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
215
|
+
@if (hasData()) {
|
|
216
|
+
<p-chart
|
|
217
|
+
[type]="primeType()"
|
|
218
|
+
[data]="data()"
|
|
219
|
+
[options]="options()"
|
|
220
|
+
[height]="heightPx()"
|
|
221
|
+
[responsive]="true"
|
|
222
|
+
/>
|
|
223
|
+
|
|
224
|
+
<table class="sr">
|
|
225
|
+
<caption>{{ caption() }}</caption>
|
|
226
|
+
<thead>
|
|
227
|
+
<tr>
|
|
228
|
+
<th scope="col">{{ axisLabel() }}</th>
|
|
229
|
+
@for (serie of series(); track serie.key) {
|
|
230
|
+
<th scope="col">{{ serie.label }}</th>
|
|
231
|
+
}
|
|
232
|
+
</tr>
|
|
233
|
+
</thead>
|
|
234
|
+
<tbody>
|
|
235
|
+
@for (label of labels(); track $index) {
|
|
236
|
+
<tr>
|
|
237
|
+
<th scope="row">{{ label }}</th>
|
|
238
|
+
@for (serie of series(); track serie.key) {
|
|
239
|
+
<td>{{ format(serie.values[$index]) }}</td>
|
|
240
|
+
}
|
|
241
|
+
</tr>
|
|
242
|
+
}
|
|
243
|
+
</tbody>
|
|
244
|
+
</table>
|
|
245
|
+
} @else {
|
|
246
|
+
<div class="empty" [style.height.px]="height()">{{ empty() }}</div>
|
|
247
|
+
}
|
|
248
|
+
`, styles: [":host{display:block;position:relative}.empty{display:grid;place-items:center;height:100%;color:var(--ns-frame-muted, #71717a);font-size:.9rem}table.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}\n"] }]
|
|
249
|
+
}], propDecorators: { kind: [{ type: i0.Input, args: [{ isSignal: true, alias: "kind", required: false }] }], series: [{ type: i0.Input, args: [{ isSignal: true, alias: "series", required: false }] }], labels: [{ type: i0.Input, args: [{ isSignal: true, alias: "labels", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], valueKind: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueKind", required: false }] }], currency: [{ type: i0.Input, args: [{ isSignal: true, alias: "currency", required: false }] }], empty: [{ type: i0.Input, args: [{ isSignal: true, alias: "empty", required: false }] }], caption: [{ type: i0.Input, args: [{ isSignal: true, alias: "caption", required: false }] }], axisLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "axisLabel", required: false }] }], beginAtZero: [{ type: i0.Input, args: [{ isSignal: true, alias: "beginAtZero", required: false }] }] } });
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Generated bundle index. Do not edit.
|
|
253
|
+
*/
|
|
254
|
+
|
|
255
|
+
export { NucleusChart, chartPalette };
|
|
256
|
+
//# sourceMappingURL=nucleus-suite-pe-core-charts.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nucleus-suite-pe-core-charts.mjs","sources":["../../../projects/core/charts/src/lib/chart-palette.ts","../../../projects/core/charts/src/lib/nucleus-chart.ts","../../../projects/core/charts/src/nucleus-suite-pe-core-charts.ts"],"sourcesContent":["import { ChartPalette } from './chart.models';\n\nconst LIGHT_FALLBACK: ChartPalette = {\n series: ['#4f6bed', '#1f9d76', '#d08700', '#c2410c', '#8b5cf6', '#0891b2'],\n ink: '#27272a',\n muted: '#71717a',\n line: '#e4e4e7',\n accent: '#4f6bed',\n};\n\nconst DARK_FALLBACK: ChartPalette = {\n series: ['#8aa0ff', '#4cc79b', '#e8b24a', '#f08a5d', '#b794f6', '#38bdf8'],\n ink: '#e4e4e7',\n muted: '#a1a1aa',\n line: '#3f3f46',\n accent: '#8aa0ff',\n};\n\nfunction readToken(host: Element, name: string): string {\n try {\n const value = getComputedStyle(host).getPropertyValue(name).trim();\n\n return value.length > 0 ? value : '';\n } catch {\n return '';\n }\n}\n\nfunction rotate(accent: string, dark: boolean): string[] {\n const base = dark ? DARK_FALLBACK.series : LIGHT_FALLBACK.series;\n\n return [accent, ...base.filter((color) => color.toLowerCase() !== accent.toLowerCase())];\n}\n\nexport function chartPalette(host: Element, dark: boolean, accent: string): ChartPalette {\n const fallback = dark ? DARK_FALLBACK : LIGHT_FALLBACK;\n\n return {\n series: rotate(accent || fallback.accent, dark),\n ink: readToken(host, '--ns-frame-ink') || fallback.ink,\n muted: readToken(host, '--ns-frame-muted') || fallback.muted,\n line: readToken(host, '--ns-frame-line') || fallback.line,\n accent: accent || fallback.accent,\n };\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n computed,\n inject,\n input,\n} from '@angular/core';\nimport { ChartModule } from 'primeng/chart';\n\nimport { NucleusLanguage, ThemeService } from '@nucleus-suite-pe/core';\nimport { ChartKind, ChartSeries, ChartValueKind } from './chart.models';\nimport { chartPalette } from './chart-palette';\n\n@Component({\n selector: 'nucleus-chart',\n imports: [ChartModule],\n changeDetection: ChangeDetectionStrategy.OnPush,\n styles: `\n :host {\n display: block;\n position: relative;\n }\n\n .empty {\n display: grid;\n place-items: center;\n height: 100%;\n color: var(--ns-frame-muted, #71717a);\n font-size: 0.9rem;\n }\n\n table.sr {\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip: rect(0 0 0 0);\n white-space: nowrap;\n }\n `,\n template: `\n @if (hasData()) {\n <p-chart\n [type]=\"primeType()\"\n [data]=\"data()\"\n [options]=\"options()\"\n [height]=\"heightPx()\"\n [responsive]=\"true\"\n />\n\n <table class=\"sr\">\n <caption>{{ caption() }}</caption>\n <thead>\n <tr>\n <th scope=\"col\">{{ axisLabel() }}</th>\n @for (serie of series(); track serie.key) {\n <th scope=\"col\">{{ serie.label }}</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (label of labels(); track $index) {\n <tr>\n <th scope=\"row\">{{ label }}</th>\n @for (serie of series(); track serie.key) {\n <td>{{ format(serie.values[$index]) }}</td>\n }\n </tr>\n }\n </tbody>\n </table>\n } @else {\n <div class=\"empty\" [style.height.px]=\"height()\">{{ empty() }}</div>\n }\n `,\n})\nexport class NucleusChart {\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly theme = inject(ThemeService);\n private readonly language = inject(NucleusLanguage);\n\n readonly kind = input<ChartKind>('line');\n readonly series = input<readonly ChartSeries[]>([]);\n readonly labels = input<readonly string[]>([]);\n readonly height = input(260);\n readonly valueKind = input<ChartValueKind>('number');\n readonly currency = input('');\n readonly empty = input('');\n readonly caption = input('');\n readonly axisLabel = input('');\n readonly beginAtZero = input(true);\n\n protected readonly heightPx = computed(() => `${this.height()}px`);\n\n protected readonly hasData = computed(\n () => this.labels().length > 0 && this.series().some((serie) => serie.values.length > 0),\n );\n\n protected readonly primeType = computed(() => {\n const kind = this.kind();\n\n if (kind === 'area' || kind === 'line') return 'line';\n if (kind === 'doughnut') return 'doughnut';\n\n return 'bar';\n });\n\n private readonly palette = computed(() =>\n chartPalette(\n this.host.nativeElement,\n this.theme.canvasId() === 'dark',\n this.theme.accentColor(),\n ),\n );\n\n protected readonly data = computed(() => {\n const palette = this.palette();\n const kind = this.kind();\n\n if (kind === 'doughnut') {\n const serie = this.series()[0];\n\n return {\n labels: [...this.labels()],\n datasets: [\n {\n data: serie ? [...serie.values] : [],\n backgroundColor: [...palette.series],\n borderWidth: 0,\n },\n ],\n };\n }\n\n return {\n labels: [...this.labels()],\n datasets: this.series().map((serie, index) => {\n const color = serie.color ?? palette.series[index % palette.series.length];\n\n return {\n label: serie.label,\n data: [...serie.values],\n borderColor: color,\n backgroundColor: kind === 'area' ? `${color}26` : color,\n fill: kind === 'area',\n tension: kind === 'line' || kind === 'area' ? 0.3 : 0,\n borderWidth: kind === 'bar' || kind === 'stackedBar' ? 0 : 2,\n pointRadius: 0,\n pointHoverRadius: 4,\n borderRadius: kind === 'bar' || kind === 'stackedBar' ? 4 : 0,\n };\n }),\n };\n });\n\n protected readonly options = computed(() => {\n const palette = this.palette();\n const stacked = this.kind() === 'stackedBar';\n const doughnut = this.kind() === 'doughnut';\n const self = this;\n\n return {\n maintainAspectRatio: false,\n animation: { duration: 400 },\n interaction: { mode: 'index', intersect: false },\n plugins: {\n legend: {\n display: this.series().length > 1 || doughnut,\n position: 'bottom',\n labels: { color: palette.muted, usePointStyle: true, boxWidth: 8 },\n },\n tooltip: {\n callbacks: {\n label(context: { dataset: { label?: string }; parsed: { y?: number } | number }) {\n const raw =\n typeof context.parsed === 'number' ? context.parsed : (context.parsed.y ?? 0);\n const name = context.dataset.label ? `${context.dataset.label}: ` : '';\n\n return name + self.format(raw);\n },\n },\n },\n },\n scales: doughnut\n ? {}\n : {\n x: {\n stacked,\n ticks: { color: palette.muted, maxRotation: 0, autoSkipPadding: 16 },\n grid: { display: false },\n },\n y: {\n stacked,\n beginAtZero: this.beginAtZero(),\n ticks: {\n color: palette.muted,\n callback: (value: number) => self.format(value),\n },\n grid: { color: palette.line, drawBorder: false },\n },\n },\n };\n });\n\n protected format(value: number | null | undefined): string {\n if (value === null || value === undefined) return '—';\n\n const locale = this.language.lang() === 'es' ? 'es-PE' : 'en-US';\n\n if (this.valueKind() === 'bytes') return this.bytes(value, locale);\n\n if (this.valueKind() === 'currency' && this.currency()) {\n return new Intl.NumberFormat(locale, {\n style: 'currency',\n currency: this.currency(),\n maximumFractionDigits: 0,\n }).format(value);\n }\n\n return new Intl.NumberFormat(locale, { maximumFractionDigits: 2 }).format(value);\n }\n\n private bytes(value: number, locale: string): string {\n const units = ['B', 'KB', 'MB', 'GB', 'TB'];\n let size = value;\n let unit = 0;\n\n while (size >= 1024 && unit < units.length - 1) {\n size /= 1024;\n unit += 1;\n }\n\n return `${new Intl.NumberFormat(locale, { maximumFractionDigits: 1 }).format(size)} ${units[unit]}`;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAEA,MAAM,cAAc,GAAiB;AACnC,IAAA,MAAM,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC;AAC1E,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,KAAK,EAAE,SAAS;AAChB,IAAA,IAAI,EAAE,SAAS;AACf,IAAA,MAAM,EAAE,SAAS;CAClB;AAED,MAAM,aAAa,GAAiB;AAClC,IAAA,MAAM,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC;AAC1E,IAAA,GAAG,EAAE,SAAS;AACd,IAAA,KAAK,EAAE,SAAS;AAChB,IAAA,IAAI,EAAE,SAAS;AACf,IAAA,MAAM,EAAE,SAAS;CAClB;AAED,SAAS,SAAS,CAAC,IAAa,EAAE,IAAY,EAAA;AAC5C,IAAA,IAAI;AACF,QAAA,MAAM,KAAK,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE;AAElE,QAAA,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,GAAG,KAAK,GAAG,EAAE;IACtC;AAAE,IAAA,MAAM;AACN,QAAA,OAAO,EAAE;IACX;AACF;AAEA,SAAS,MAAM,CAAC,MAAc,EAAE,IAAa,EAAA;AAC3C,IAAA,MAAM,IAAI,GAAG,IAAI,GAAG,aAAa,CAAC,MAAM,GAAG,cAAc,CAAC,MAAM;IAEhE,OAAO,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,WAAW,EAAE,KAAK,MAAM,CAAC,WAAW,EAAE,CAA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,EAAA,MAAA,EAAA,CAAA,wPAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EA3DS,WAAW,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,OAAA,EAAA,QAAA,EAAA,SAAA,EAAA,MAAA,EAAA,CAAA,MAAA,EAAA,SAAA,EAAA,OAAA,EAAA,QAAA,EAAA,YAAA,EAAA,WAAA,EAAA,gBAAA,EAAA,MAAA,EAAA,SAAA,CAAA,EAAA,OAAA,EAAA,CAAA,cAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;4FA6DV,YAAY,EAAA,UAAA,EAAA,CAAA;kBA/DxB,SAAS;+BACE,eAAe,EAAA,OAAA,EAChB,CAAC,WAAW,CAAC,mBACL,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAwBrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCT,EAAA,CAAA,EAAA,MAAA,EAAA,CAAA,wPAAA,CAAA,EAAA;;;AC3EH;;AAEG;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nucleus-suite-pe/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Capa compartida de la suite Nucleus: sesión única, permisos, tema y marco de aplicación para Angular.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -26,11 +26,17 @@
|
|
|
26
26
|
"@primeuix/themes": "^3.0.0",
|
|
27
27
|
"@angular/router": "^21.2.0",
|
|
28
28
|
"@angular/forms": "^21.2.0",
|
|
29
|
-
"primeicons": "^8.0.0"
|
|
29
|
+
"primeicons": "^8.0.0",
|
|
30
|
+
"chart.js": "^4.4.0"
|
|
30
31
|
},
|
|
31
32
|
"dependencies": {
|
|
32
33
|
"tslib": "^2.3.0"
|
|
33
34
|
},
|
|
35
|
+
"peerDependenciesMeta": {
|
|
36
|
+
"chart.js": {
|
|
37
|
+
"optional": true
|
|
38
|
+
}
|
|
39
|
+
},
|
|
34
40
|
"module": "fesm2022/nucleus-suite-pe-core.mjs",
|
|
35
41
|
"typings": "types/nucleus-suite-pe-core.d.ts",
|
|
36
42
|
"exports": {
|
|
@@ -40,6 +46,10 @@
|
|
|
40
46
|
".": {
|
|
41
47
|
"types": "./types/nucleus-suite-pe-core.d.ts",
|
|
42
48
|
"default": "./fesm2022/nucleus-suite-pe-core.mjs"
|
|
49
|
+
},
|
|
50
|
+
"./charts": {
|
|
51
|
+
"types": "./types/nucleus-suite-pe-core-charts.d.ts",
|
|
52
|
+
"default": "./fesm2022/nucleus-suite-pe-core-charts.mjs"
|
|
43
53
|
}
|
|
44
54
|
},
|
|
45
55
|
"type": "module"
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
|
|
3
|
+
type ChartKind = 'line' | 'area' | 'bar' | 'stackedBar' | 'doughnut';
|
|
4
|
+
type ChartValueKind = 'number' | 'bytes' | 'currency';
|
|
5
|
+
interface ChartSeries {
|
|
6
|
+
readonly key: string;
|
|
7
|
+
readonly label: string;
|
|
8
|
+
readonly values: readonly (number | null)[];
|
|
9
|
+
readonly color?: string;
|
|
10
|
+
}
|
|
11
|
+
interface ChartPalette {
|
|
12
|
+
readonly series: readonly string[];
|
|
13
|
+
readonly ink: string;
|
|
14
|
+
readonly muted: string;
|
|
15
|
+
readonly line: string;
|
|
16
|
+
readonly accent: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare function chartPalette(host: Element, dark: boolean, accent: string): ChartPalette;
|
|
20
|
+
|
|
21
|
+
declare class NucleusChart {
|
|
22
|
+
private readonly host;
|
|
23
|
+
private readonly theme;
|
|
24
|
+
private readonly language;
|
|
25
|
+
readonly kind: _angular_core.InputSignal<ChartKind>;
|
|
26
|
+
readonly series: _angular_core.InputSignal<readonly ChartSeries[]>;
|
|
27
|
+
readonly labels: _angular_core.InputSignal<readonly string[]>;
|
|
28
|
+
readonly height: _angular_core.InputSignal<number>;
|
|
29
|
+
readonly valueKind: _angular_core.InputSignal<ChartValueKind>;
|
|
30
|
+
readonly currency: _angular_core.InputSignal<string>;
|
|
31
|
+
readonly empty: _angular_core.InputSignal<string>;
|
|
32
|
+
readonly caption: _angular_core.InputSignal<string>;
|
|
33
|
+
readonly axisLabel: _angular_core.InputSignal<string>;
|
|
34
|
+
readonly beginAtZero: _angular_core.InputSignal<boolean>;
|
|
35
|
+
protected readonly heightPx: _angular_core.Signal<string>;
|
|
36
|
+
protected readonly hasData: _angular_core.Signal<boolean>;
|
|
37
|
+
protected readonly primeType: _angular_core.Signal<"line" | "bar" | "doughnut">;
|
|
38
|
+
private readonly palette;
|
|
39
|
+
protected readonly data: _angular_core.Signal<{
|
|
40
|
+
labels: string[];
|
|
41
|
+
datasets: {
|
|
42
|
+
data: (number | null)[];
|
|
43
|
+
backgroundColor: string[];
|
|
44
|
+
borderWidth: number;
|
|
45
|
+
}[];
|
|
46
|
+
} | {
|
|
47
|
+
labels: string[];
|
|
48
|
+
datasets: {
|
|
49
|
+
label: string;
|
|
50
|
+
data: (number | null)[];
|
|
51
|
+
borderColor: string;
|
|
52
|
+
backgroundColor: string;
|
|
53
|
+
fill: boolean;
|
|
54
|
+
tension: number;
|
|
55
|
+
borderWidth: number;
|
|
56
|
+
pointRadius: number;
|
|
57
|
+
pointHoverRadius: number;
|
|
58
|
+
borderRadius: number;
|
|
59
|
+
}[];
|
|
60
|
+
}>;
|
|
61
|
+
protected readonly options: _angular_core.Signal<{
|
|
62
|
+
maintainAspectRatio: boolean;
|
|
63
|
+
animation: {
|
|
64
|
+
duration: number;
|
|
65
|
+
};
|
|
66
|
+
interaction: {
|
|
67
|
+
mode: string;
|
|
68
|
+
intersect: boolean;
|
|
69
|
+
};
|
|
70
|
+
plugins: {
|
|
71
|
+
legend: {
|
|
72
|
+
display: boolean;
|
|
73
|
+
position: string;
|
|
74
|
+
labels: {
|
|
75
|
+
color: string;
|
|
76
|
+
usePointStyle: boolean;
|
|
77
|
+
boxWidth: number;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
tooltip: {
|
|
81
|
+
callbacks: {
|
|
82
|
+
label(context: {
|
|
83
|
+
dataset: {
|
|
84
|
+
label?: string;
|
|
85
|
+
};
|
|
86
|
+
parsed: {
|
|
87
|
+
y?: number;
|
|
88
|
+
} | number;
|
|
89
|
+
}): string;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
scales: {
|
|
94
|
+
x?: undefined;
|
|
95
|
+
y?: undefined;
|
|
96
|
+
} | {
|
|
97
|
+
x: {
|
|
98
|
+
stacked: boolean;
|
|
99
|
+
ticks: {
|
|
100
|
+
color: string;
|
|
101
|
+
maxRotation: number;
|
|
102
|
+
autoSkipPadding: number;
|
|
103
|
+
};
|
|
104
|
+
grid: {
|
|
105
|
+
display: boolean;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
y: {
|
|
109
|
+
stacked: boolean;
|
|
110
|
+
beginAtZero: boolean;
|
|
111
|
+
ticks: {
|
|
112
|
+
color: string;
|
|
113
|
+
callback: (value: number) => string;
|
|
114
|
+
};
|
|
115
|
+
grid: {
|
|
116
|
+
color: string;
|
|
117
|
+
drawBorder: boolean;
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
}>;
|
|
122
|
+
protected format(value: number | null | undefined): string;
|
|
123
|
+
private bytes;
|
|
124
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NucleusChart, never>;
|
|
125
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<NucleusChart, "nucleus-chart", never, { "kind": { "alias": "kind"; "required": false; "isSignal": true; }; "series": { "alias": "series"; "required": false; "isSignal": true; }; "labels": { "alias": "labels"; "required": false; "isSignal": true; }; "height": { "alias": "height"; "required": false; "isSignal": true; }; "valueKind": { "alias": "valueKind"; "required": false; "isSignal": true; }; "currency": { "alias": "currency"; "required": false; "isSignal": true; }; "empty": { "alias": "empty"; "required": false; "isSignal": true; }; "caption": { "alias": "caption"; "required": false; "isSignal": true; }; "axisLabel": { "alias": "axisLabel"; "required": false; "isSignal": true; }; "beginAtZero": { "alias": "beginAtZero"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export { NucleusChart, chartPalette };
|
|
129
|
+
export type { ChartKind, ChartPalette, ChartSeries, ChartValueKind };
|