@konce-pt/angular 0.3.0 → 0.5.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.
- package/README.md +88 -4
- package/dist/README.md +88 -4
- package/dist/fesm2022/konce-pt-angular-charts.mjs +957 -0
- package/dist/fesm2022/konce-pt-angular-charts.mjs.map +1 -0
- package/dist/fesm2022/konce-pt-angular.mjs +695 -165
- package/dist/fesm2022/konce-pt-angular.mjs.map +1 -1
- package/dist/package.json +5 -1
- package/dist/src/lib/confirm/llms.txt +4 -0
- package/dist/src/lib/data-table/llms.txt +6 -1
- package/dist/src/lib/date-range/llms.txt +5 -1
- package/dist/src/lib/datepicker/llms.txt +6 -0
- package/dist/src/lib/i18n/llms.txt +35 -0
- package/dist/src/lib/paginator/llms.txt +4 -0
- package/dist/src/lib/rich-text/llms.txt +5 -0
- package/dist/src/lib/select/llms.txt +4 -0
- package/dist/types/konce-pt-angular-charts.d.ts +356 -0
- package/dist/types/konce-pt-angular.d.ts +336 -14
- package/package.json +5 -1
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@konce-pt/angular",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Open-source Angular 22 component library on Signals & Signal Forms — 70+ components, rich data table, zoneless, fully tokenized. Selektory kpt-*, klasy Kpt*.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "konce.pt",
|
|
@@ -43,6 +43,10 @@
|
|
|
43
43
|
"types": "./types/konce-pt-angular-icons.d.ts",
|
|
44
44
|
"default": "./fesm2022/konce-pt-angular-icons.mjs"
|
|
45
45
|
},
|
|
46
|
+
"./charts": {
|
|
47
|
+
"types": "./types/konce-pt-angular-charts.d.ts",
|
|
48
|
+
"default": "./fesm2022/konce-pt-angular-charts.mjs"
|
|
49
|
+
},
|
|
46
50
|
"./package.json": {
|
|
47
51
|
"default": "./package.json"
|
|
48
52
|
}
|
|
@@ -11,6 +11,10 @@ Import: `import { KptConfirmService, KptConfirmContainer } from '@konce-pt/angul
|
|
|
11
11
|
- `message`: string (wymagane); `header?`: string
|
|
12
12
|
- `acceptLabel?`/`rejectLabel?`: string; `variant?`: 'filled' | 'danger'; `icon?`: string
|
|
13
13
|
|
|
14
|
+
## i18n
|
|
15
|
+
Domyślne etykiety (nagłówek, Potwierdź, Anuluj) z i18n (namespace `confirm`); pola opcji mają priorytet.
|
|
16
|
+
Domyślnie EN; konfiguracja przez `provideKptI18n` — patrz `i18n/llms.txt`.
|
|
17
|
+
|
|
14
18
|
## Przykład
|
|
15
19
|
const ok = await this.confirm.confirm({
|
|
16
20
|
message: 'Usunąć rekord?', variant: 'danger', acceptLabel: 'Usuń', icon: 'alert-triangle',
|
|
@@ -32,7 +32,7 @@ Filtry `select`/`dateRange` wymagają `import '@angular/cdk/overlay-prebuilt.css
|
|
|
32
32
|
- `pageSizeOptions`: number[] (domyślnie [5,10,20,50])
|
|
33
33
|
- `selectable`: 'none' | 'single' | 'multiple'
|
|
34
34
|
- `loading`: boolean — wiersz „Ładowanie…"
|
|
35
|
-
- `emptyMessage`: string (
|
|
35
|
+
- `emptyMessage`: string — bez wartości używa i18n (`dataTable.empty`); input ma priorytet
|
|
36
36
|
- `rowKey`: string | null — pole identyfikujące wiersz (dla zaznaczania); bez niego porównanie po referencji
|
|
37
37
|
- `reorderable`: boolean — przestawianie kolumn przeciągnij-i-upuść (natywny HTML5 DnD); kolumny `frozen` są wyłączone z przenoszenia (pozostają wiodące) i nie można upuszczać innych kolumn przed nie
|
|
38
38
|
- `exportable`: boolean — przycisk „Eksport CSV" w toolbarze
|
|
@@ -82,6 +82,11 @@ Niezależne od `selectable` (można łączyć z zaznaczaniem). Nieaktywne przy `
|
|
|
82
82
|
- Zaznaczanie 'multiple': nagłówkowy checkbox zaznacza/odznacza bieżącą stronę.
|
|
83
83
|
- Sticky header, stany pusty/ładowanie, wyrównanie i szerokości per kolumna.
|
|
84
84
|
|
|
85
|
+
## i18n
|
|
86
|
+
Etykiety toolbaru/stanów/aria (Szukaj, Eksport CSV, Ładowanie, Brak danych, zaznaczanie, filtry kolumn:
|
|
87
|
+
Filtr/Filtr min/Filtr max z `{column}`, Wszystkie, min, max, Zakres dat) pochodzą z i18n (namespace `dataTable`).
|
|
88
|
+
Domyślnie EN; konfiguracja przez `provideKptI18n` — patrz `i18n/llms.txt`.
|
|
89
|
+
|
|
85
90
|
## Tokeny
|
|
86
91
|
`--kpt-table-{bg,fg,border,radius,header-bg,header-fg,row-hover,row-selected,cell-padding}`.
|
|
87
92
|
Rozwijany wiersz: `--kpt-table-detail-bg` (fallback: surface-variant → row-hover).
|
|
@@ -11,7 +11,7 @@ Wymaga `import '@angular/cdk/overlay-prebuilt.css';`
|
|
|
11
11
|
- `mode`: 'date' | 'datetime' | 'time' (domyślnie 'date')
|
|
12
12
|
- `hourFormat`: 12 | 24 (domyślnie 24) — tarcza z AM/PM lub 24h; czas zawsze 24h w wartości
|
|
13
13
|
- `minuteStep`: number (domyślnie 1) — snap minut na tarczy
|
|
14
|
-
- `placeholder`: string (
|
|
14
|
+
- `placeholder`: string — bez wartości używa i18n (`dateRange.placeholder`); input ma priorytet
|
|
15
15
|
- `displayFormat`: 'pl' | 'iso' (domyślnie 'pl') — format wyświetlania start/end
|
|
16
16
|
- `disabled`/`invalid`/`touched`: boolean; `touch`: output
|
|
17
17
|
|
|
@@ -25,5 +25,9 @@ Tryby datetime/time: przełącznik „Od / Koniec" + tarcza zegara, zatwierdzeni
|
|
|
25
25
|
|
|
26
26
|
period = signal<KptDateRangeValue>({ start: '', end: '' });
|
|
27
27
|
|
|
28
|
+
## i18n
|
|
29
|
+
Nazwy dni/miesięcy z `Intl` wg locale; etykiety („Od/Koniec", nawigacja, „Gotowe", placeholder) z i18n
|
|
30
|
+
(namespace `dateRange` + `datepicker`/`common`). Domyślnie EN — patrz `i18n/llms.txt`.
|
|
31
|
+
|
|
28
32
|
## Tokeny
|
|
29
33
|
Pole `--kpt-form-field-*`; kalendarz `--kpt-color-surface-raised`, zakres `--kpt-color-primary`.
|
|
@@ -25,5 +25,11 @@ Import: `import { KptDatepicker } from '@konce-pt/angular';`
|
|
|
25
25
|
- `disabled`/`invalid`/`touched`: boolean; output `touch`.
|
|
26
26
|
- Panel: nawigacja (‹ ›) miesięcy/lat/dekad wg trybu; tarcza zegara z „Gotowe"; przycisk czyszczenia (×).
|
|
27
27
|
|
|
28
|
+
## i18n
|
|
29
|
+
Nazwy dni tygodnia i miesięcy są wyliczane z `Intl` wg aktywnego locale i18n (nie ze słownika).
|
|
30
|
+
Etykiety nawigacji/aria i „Gotowe" z i18n (namespace `datepicker` + `common`). Domyślnie EN;
|
|
31
|
+
konfiguracja przez `provideKptI18n` — patrz `i18n/llms.txt`. Uwaga: `displayFormat` ('pl'/'iso')
|
|
32
|
+
steruje wyłącznie formatem daty i jest niezależny od języka etykiet.
|
|
33
|
+
|
|
28
34
|
## Tokeny
|
|
29
35
|
`--kpt-form-field-{bg,text,border,border-focus,border-error,radius}`.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# i18n (provideKptI18n / KptI18n)
|
|
2
|
+
|
|
3
|
+
Tłumaczenia etykiet komponentów. Języki bazowe: EN (domyślny), PL. Oparte o sygnały (zoneless-friendly), bez zależności zewnętrznych.
|
|
4
|
+
Import: `import { provideKptI18n, KptI18n } from '@konce-pt/angular';`
|
|
5
|
+
|
|
6
|
+
## Konfiguracja (provider)
|
|
7
|
+
- `provideKptI18n({ locale?, messages? }): EnvironmentProviders` — w `bootstrapApplication`.
|
|
8
|
+
- `locale`: 'en' | 'pl' | dowolny string (domyślnie 'en').
|
|
9
|
+
- `messages`: `Record<locale, DeepPartial<KptMessages>>` — rejestruje nowy język lub nadpisuje istniejący (deep-merge, brakujące klucze → EN).
|
|
10
|
+
|
|
11
|
+
## Serwis KptI18n (providedIn: 'root')
|
|
12
|
+
- `locale: Signal<KptLocale>` — bieżący język.
|
|
13
|
+
- `setLocale(locale)` — zmiana w runtime (reaktywna dla wszystkich komponentów).
|
|
14
|
+
- `registerMessages(locale, patch)` — dodaje/nadpisuje słownik w runtime.
|
|
15
|
+
- `t(key, params?)` — tłumaczy klucz w notacji kropkowej (`'paginator.range'`) z interpolacją `{name}`.
|
|
16
|
+
|
|
17
|
+
## Dodanie własnego języka (jeden plik JSON)
|
|
18
|
+
import de from './i18n/de.json'; // kształt = interfejs KptMessages
|
|
19
|
+
provideKptI18n({ locale: 'de', messages: { de } });
|
|
20
|
+
// runtime: inject(KptI18n).registerMessages('de', de); inject(KptI18n).setLocale('de');
|
|
21
|
+
|
|
22
|
+
## Przełączanie języka w runtime
|
|
23
|
+
const i18n = inject(KptI18n);
|
|
24
|
+
i18n.setLocale('pl');
|
|
25
|
+
|
|
26
|
+
## Kontrakt kluczy (KptMessages)
|
|
27
|
+
Namespace'y: `common` (close/remove/previous/next/clear/done/all), `paginator` (rowsPerPage/range/prevPage/nextPage),
|
|
28
|
+
`select`, `listbox`, `dataView`, `dataTable`, `confirm`, `fileUpload`, `chipsInput`, `dateRange`, `datepicker`,
|
|
29
|
+
`pickList`, `orderList`, `inputNumber`, `password`, `spinner`, `speedDial`, `scrollTop`, `splitButton`, `panel`,
|
|
30
|
+
`breadcrumb`, `richText`. Interpolacje: `paginator.range` ({start},{end},{total}), `dataTable.filter*` ({column}),
|
|
31
|
+
`richText.styleHeading` ({level}). Nazwy dni/miesięcy w kalendarzach są wyliczane z `Intl` wg locale (nie ze słownika).
|
|
32
|
+
|
|
33
|
+
## Uwaga
|
|
34
|
+
Pojedyncze etykiety można też nadpisać per-komponent przez odpowiedni `input()` (np. `emptyMessage`, `acceptLabel`) —
|
|
35
|
+
input ma priorytet nad słownikiem i18n.
|
|
@@ -16,3 +16,7 @@ Paginator sterowany sygnałami. Import: `import { KptPaginator } from '@konce-pt
|
|
|
16
16
|
|
|
17
17
|
Pokazuje „X–Y z Z", wybór rozmiaru strony oraz przyciski poprzednia/następna.
|
|
18
18
|
Przy zmianie długości/rozmiaru samoczynnie koryguje `pageIndex` (effect).
|
|
19
|
+
|
|
20
|
+
## i18n
|
|
21
|
+
Etykiety („Wierszy:", separator zakresu, aria stron) pochodzą z i18n (namespace `paginator`).
|
|
22
|
+
Domyślny język EN; przełączenie/nadpisanie przez `provideKptI18n` — patrz `i18n/llms.txt`.
|
|
@@ -30,6 +30,11 @@ Import: `import { KptRichText, KptRichTool, KptRichToolbar } from '@konce-pt/ang
|
|
|
30
30
|
<kpt-rich-text [formField]="f.body" /> <!-- pełny pasek -->
|
|
31
31
|
<kpt-rich-text [(value)]="v" [toolbar]="[['bold','italic'],['ul','ol'],['link']]" />
|
|
32
32
|
|
|
33
|
+
## i18n
|
|
34
|
+
Wszystkie etykiety (aria narzędzi, style „Normalny/Nagłówek N", prompt linku, menu kontekstowe tabeli,
|
|
35
|
+
popover obramowania, „Własny…") pochodzą z i18n (namespace `richText`, w tym `richText.menu.*`,
|
|
36
|
+
`richText.border.*`). Domyślnie EN — patrz `i18n/llms.txt`.
|
|
37
|
+
|
|
33
38
|
## Uwagi
|
|
34
39
|
Formatowanie przez document.execCommand; aktywne narzędzia podświetlane (queryCommandState).
|
|
35
40
|
Wklejanie (natywne i przyciskami) jest sanityzowane (allowlista tagów/stylów; usuwa script/on*/javascript:).
|
|
@@ -18,5 +18,9 @@ Wymaga stylów overlay CDK w aplikacji: `import '@angular/cdk/overlay-prebuilt.c
|
|
|
18
18
|
- `disabled`/`invalid`/`touched`: boolean; output `touch`.
|
|
19
19
|
- Klawiatura: Enter/↓ otwiera, ↑/↓ nawigacja, Enter wybiera, Esc zamyka.
|
|
20
20
|
|
|
21
|
+
## i18n
|
|
22
|
+
Etykiety „Szukaj…", „Brak wyników" i aria usuwania chipa z i18n (namespace `select`).
|
|
23
|
+
Domyślnie EN; konfiguracja przez `provideKptI18n` — patrz `i18n/llms.txt`.
|
|
24
|
+
|
|
21
25
|
## Tokeny
|
|
22
26
|
`--kpt-form-field-{bg,text,border,border-hover,border-focus,border-error,radius}`.
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
import * as _konce_pt_angular_charts from '@konce-pt/angular/charts';
|
|
2
|
+
import * as _angular_core from '@angular/core';
|
|
3
|
+
|
|
4
|
+
type KptChartType = 'line' | 'bar' | 'pie' | 'doughnut' | 'polarArea' | 'radar';
|
|
5
|
+
/** Tryb interpolacji linii dla wykresu liniowego. */
|
|
6
|
+
type KptLineInterpolation = 'linear' | 'cubic' | 'cubic-monotonic';
|
|
7
|
+
/** Orientacja słupków. */
|
|
8
|
+
type KptBarOrientation = 'vertical' | 'horizontal';
|
|
9
|
+
/** Pojedyncza seria danych. Kolejność wartości odpowiada `labels`. */
|
|
10
|
+
interface KptChartSeries {
|
|
11
|
+
/** Nazwa serii (legenda, tooltip). */
|
|
12
|
+
name: string;
|
|
13
|
+
/** Wartości; długość zwykle równa liczbie etykiet. */
|
|
14
|
+
data: number[];
|
|
15
|
+
/** Kolor (CSS). Domyślnie z palety tokenów. */
|
|
16
|
+
color?: string;
|
|
17
|
+
}
|
|
18
|
+
type KptLegendPosition = 'top' | 'bottom' | 'left' | 'right';
|
|
19
|
+
type KptAlign = 'start' | 'center' | 'end';
|
|
20
|
+
type KptPointStyle = 'circle' | 'rect' | 'rectRot' | 'triangle' | 'line';
|
|
21
|
+
interface KptLegendTitle {
|
|
22
|
+
display?: boolean;
|
|
23
|
+
text?: string;
|
|
24
|
+
position?: KptAlign;
|
|
25
|
+
}
|
|
26
|
+
interface KptLegendOptions {
|
|
27
|
+
display?: boolean;
|
|
28
|
+
position?: KptLegendPosition;
|
|
29
|
+
align?: KptAlign;
|
|
30
|
+
pointStyle?: KptPointStyle;
|
|
31
|
+
title?: KptLegendTitle;
|
|
32
|
+
}
|
|
33
|
+
interface KptFont {
|
|
34
|
+
family?: string;
|
|
35
|
+
size?: number;
|
|
36
|
+
weight?: string | number;
|
|
37
|
+
}
|
|
38
|
+
interface KptPadding {
|
|
39
|
+
top?: number;
|
|
40
|
+
bottom?: number;
|
|
41
|
+
}
|
|
42
|
+
interface KptTitleOptions {
|
|
43
|
+
display?: boolean;
|
|
44
|
+
text?: string;
|
|
45
|
+
align?: KptAlign;
|
|
46
|
+
color?: string;
|
|
47
|
+
font?: KptFont;
|
|
48
|
+
padding?: KptPadding;
|
|
49
|
+
}
|
|
50
|
+
/** Kontekst przekazywany do formatera tooltipa. */
|
|
51
|
+
interface KptTooltipContext {
|
|
52
|
+
series: string;
|
|
53
|
+
label: string;
|
|
54
|
+
value: number;
|
|
55
|
+
}
|
|
56
|
+
interface KptTooltipOptions {
|
|
57
|
+
enabled?: boolean;
|
|
58
|
+
format?: (ctx: KptTooltipContext) => string;
|
|
59
|
+
}
|
|
60
|
+
interface KptAnimationOptions {
|
|
61
|
+
enabled?: boolean;
|
|
62
|
+
/** Czas trwania w ms (domyślnie 400). */
|
|
63
|
+
duration?: number;
|
|
64
|
+
/** Opóźnienie startu w ms (domyślnie 0). */
|
|
65
|
+
delay?: number;
|
|
66
|
+
/** Przesunięcie kolejnych elementów w ms (`delay = index * stagger`). */
|
|
67
|
+
stagger?: number;
|
|
68
|
+
}
|
|
69
|
+
/** Pełna konfiguracja wykresu. Jeden kształt dla wszystkich typów. */
|
|
70
|
+
interface KptChartConfig {
|
|
71
|
+
type: KptChartType;
|
|
72
|
+
/** Etykiety osi kategorii / wycinków. */
|
|
73
|
+
labels: string[];
|
|
74
|
+
series: KptChartSeries[];
|
|
75
|
+
/** Bar: orientacja słupków (domyślnie 'vertical'). */
|
|
76
|
+
orientation?: KptBarOrientation;
|
|
77
|
+
/** Line: tryb interpolacji (domyślnie 'linear'). */
|
|
78
|
+
interpolation?: KptLineInterpolation;
|
|
79
|
+
/** Line: wypełnienie obszaru pod linią. */
|
|
80
|
+
area?: boolean;
|
|
81
|
+
/** Line: punkty danych widoczne (domyślnie true). */
|
|
82
|
+
points?: boolean;
|
|
83
|
+
/** Line: pionowa prowadnica + podświetlona etykieta osi X przy hoverze punktu. */
|
|
84
|
+
crosshair?: boolean;
|
|
85
|
+
/** Doughnut/PolarArea/Radar: promień wewnętrzny 0..1 (doughnut, domyślnie 0.6). */
|
|
86
|
+
innerRadius?: number;
|
|
87
|
+
/** Bar: promień zaokrąglenia rogów w px (domyślnie 4). */
|
|
88
|
+
borderRadius?: number;
|
|
89
|
+
animation?: KptAnimationOptions;
|
|
90
|
+
legend?: KptLegendOptions;
|
|
91
|
+
title?: KptTitleOptions;
|
|
92
|
+
subtitle?: KptTitleOptions;
|
|
93
|
+
tooltip?: KptTooltipOptions;
|
|
94
|
+
}
|
|
95
|
+
/** Punkt w układzie SVG. */
|
|
96
|
+
interface KptPoint {
|
|
97
|
+
x: number;
|
|
98
|
+
y: number;
|
|
99
|
+
}
|
|
100
|
+
/** Prostokąt obszaru rysowania (plot area). */
|
|
101
|
+
interface KptRect {
|
|
102
|
+
x: number;
|
|
103
|
+
y: number;
|
|
104
|
+
width: number;
|
|
105
|
+
height: number;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
interface KptChartLegendItem {
|
|
109
|
+
key: string;
|
|
110
|
+
name: string;
|
|
111
|
+
color: string;
|
|
112
|
+
hidden: boolean;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
interface KptChartTooltipRow {
|
|
116
|
+
name: string;
|
|
117
|
+
value: string;
|
|
118
|
+
color: string;
|
|
119
|
+
}
|
|
120
|
+
interface KptChartTooltipState {
|
|
121
|
+
/** Pozycja pozioma w % szerokości kontenera (0..100). */
|
|
122
|
+
x: number;
|
|
123
|
+
/** Pozycja pionowa w % wysokości kontenera (0..100). */
|
|
124
|
+
y: number;
|
|
125
|
+
label: string;
|
|
126
|
+
rows: KptChartTooltipRow[];
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
interface AxisLabel {
|
|
130
|
+
x: number;
|
|
131
|
+
y: number;
|
|
132
|
+
text: string;
|
|
133
|
+
anchor: 'start' | 'middle' | 'end';
|
|
134
|
+
}
|
|
135
|
+
interface GridLine {
|
|
136
|
+
x1: number;
|
|
137
|
+
y1: number;
|
|
138
|
+
x2: number;
|
|
139
|
+
y2: number;
|
|
140
|
+
}
|
|
141
|
+
interface LinePoint {
|
|
142
|
+
x: number;
|
|
143
|
+
y: number;
|
|
144
|
+
value: number;
|
|
145
|
+
label: string;
|
|
146
|
+
}
|
|
147
|
+
interface LineSeriesVm {
|
|
148
|
+
key: string;
|
|
149
|
+
name: string;
|
|
150
|
+
color: string;
|
|
151
|
+
path: string;
|
|
152
|
+
area: string | null;
|
|
153
|
+
points: LinePoint[];
|
|
154
|
+
}
|
|
155
|
+
interface LineVm {
|
|
156
|
+
plot: {
|
|
157
|
+
x: number;
|
|
158
|
+
y: number;
|
|
159
|
+
width: number;
|
|
160
|
+
height: number;
|
|
161
|
+
};
|
|
162
|
+
series: LineSeriesVm[];
|
|
163
|
+
grid: GridLine[];
|
|
164
|
+
valueLabels: AxisLabel[];
|
|
165
|
+
catLabels: AxisLabel[];
|
|
166
|
+
showPoints: boolean;
|
|
167
|
+
}
|
|
168
|
+
interface BarVm {
|
|
169
|
+
orientation: 'vertical' | 'horizontal';
|
|
170
|
+
bars: {
|
|
171
|
+
key: string;
|
|
172
|
+
path: string;
|
|
173
|
+
color: string;
|
|
174
|
+
name: string;
|
|
175
|
+
label: string;
|
|
176
|
+
value: number;
|
|
177
|
+
tipX: number;
|
|
178
|
+
tipY: number;
|
|
179
|
+
index: number;
|
|
180
|
+
}[];
|
|
181
|
+
grid: GridLine[];
|
|
182
|
+
valueLabels: AxisLabel[];
|
|
183
|
+
catLabels: AxisLabel[];
|
|
184
|
+
}
|
|
185
|
+
interface SliceVm {
|
|
186
|
+
key: string;
|
|
187
|
+
path: string;
|
|
188
|
+
color: string;
|
|
189
|
+
label: string;
|
|
190
|
+
value: number;
|
|
191
|
+
tipX: number;
|
|
192
|
+
tipY: number;
|
|
193
|
+
}
|
|
194
|
+
interface RadarSeriesVm {
|
|
195
|
+
key: string;
|
|
196
|
+
name: string;
|
|
197
|
+
color: string;
|
|
198
|
+
polygon: string;
|
|
199
|
+
points: LinePoint[];
|
|
200
|
+
}
|
|
201
|
+
interface RadarVm {
|
|
202
|
+
rings: string[];
|
|
203
|
+
axisLines: GridLine[];
|
|
204
|
+
axisLabels: AxisLabel[];
|
|
205
|
+
series: RadarSeriesVm[];
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Wykres SVG w pełni konfigurowalny przez obiekt `config`.
|
|
209
|
+
* Typy: line, bar, pie, doughnut, polarArea, radar. Sygnały + zoneless,
|
|
210
|
+
* natywne renderowanie SVG (bez manipulacji DOM). Rdzeń obliczeń: `../core`.
|
|
211
|
+
*
|
|
212
|
+
* @example
|
|
213
|
+
* <kpt-chart [config]="{ type: 'line', labels: ['Sty','Lut','Mar'],
|
|
214
|
+
* series: [{ name: 'Sprzedaż', data: [12, 19, 7] }] }" />
|
|
215
|
+
*/
|
|
216
|
+
declare class KptChart {
|
|
217
|
+
readonly config: _angular_core.InputSignal<KptChartConfig>;
|
|
218
|
+
/** Szerokość viewBoxa (jednostki SVG). Wykres skaluje się do kontenera. */
|
|
219
|
+
readonly width: _angular_core.InputSignal<number>;
|
|
220
|
+
/** Wysokość viewBoxa (jednostki SVG). */
|
|
221
|
+
readonly height: _angular_core.InputSignal<number>;
|
|
222
|
+
protected readonly hidden: _angular_core.WritableSignal<ReadonlySet<string>>;
|
|
223
|
+
protected readonly highlighted: _angular_core.WritableSignal<string | null>;
|
|
224
|
+
protected readonly tooltip: _angular_core.WritableSignal<KptChartTooltipState | null>;
|
|
225
|
+
/** Indeks kategorii pod kursorem (dla prowadnicy crosshair w wykresie liniowym). */
|
|
226
|
+
protected readonly activeIndex: _angular_core.WritableSignal<number | null>;
|
|
227
|
+
protected readonly type: _angular_core.Signal<_konce_pt_angular_charts.KptChartType>;
|
|
228
|
+
protected readonly anim: _angular_core.Signal<Required<KptAnimationOptions>>;
|
|
229
|
+
protected readonly legendOpts: _angular_core.Signal<{
|
|
230
|
+
display: boolean;
|
|
231
|
+
position: _konce_pt_angular_charts.KptLegendPosition;
|
|
232
|
+
align: KptAlign;
|
|
233
|
+
pointStyle: _konce_pt_angular_charts.KptPointStyle;
|
|
234
|
+
title: _konce_pt_angular_charts.KptLegendTitle | undefined;
|
|
235
|
+
}>;
|
|
236
|
+
protected readonly titleOpts: _angular_core.Signal<_konce_pt_angular_charts.KptTitleOptions | undefined>;
|
|
237
|
+
protected readonly subtitleOpts: _angular_core.Signal<_konce_pt_angular_charts.KptTitleOptions | undefined>;
|
|
238
|
+
protected readonly titleStyle: _angular_core.Signal<string>;
|
|
239
|
+
protected readonly subtitleStyle: _angular_core.Signal<string>;
|
|
240
|
+
protected readonly legendItems: _angular_core.Signal<KptChartLegendItem[]>;
|
|
241
|
+
protected readonly lineVm: _angular_core.Signal<LineVm | null>;
|
|
242
|
+
protected readonly barVm: _angular_core.Signal<BarVm | null>;
|
|
243
|
+
protected readonly pieVm: _angular_core.Signal<SliceVm[] | null>;
|
|
244
|
+
protected readonly radarVm: _angular_core.Signal<RadarVm | null>;
|
|
245
|
+
protected readonly crosshair: _angular_core.Signal<{
|
|
246
|
+
x: number;
|
|
247
|
+
y1: number;
|
|
248
|
+
y2: number;
|
|
249
|
+
text: string;
|
|
250
|
+
labelX: number;
|
|
251
|
+
labelY: number;
|
|
252
|
+
pillX: number;
|
|
253
|
+
pillY: number;
|
|
254
|
+
pillW: number;
|
|
255
|
+
pillH: number;
|
|
256
|
+
} | null>;
|
|
257
|
+
protected onLineEnter(idx: number, tipX: number, tipY: number, name: string, label: string, value: number, color: string): void;
|
|
258
|
+
protected onLineLeave(): void;
|
|
259
|
+
protected showTip(tipX: number, tipY: number, name: string, label: string, value: number, color: string): void;
|
|
260
|
+
protected hideTip(): void;
|
|
261
|
+
protected onToggle(key: string): void;
|
|
262
|
+
protected onHighlight(key: string | null): void;
|
|
263
|
+
/** Czy dany element ma być wygaszony (aktywne podświetlenie innego). */
|
|
264
|
+
protected dim(key: string): boolean;
|
|
265
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<KptChart, never>;
|
|
266
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<KptChart, "kpt-chart", never, { "config": { "alias": "config"; "required": true; "isSignal": true; }; "width": { "alias": "width"; "required": false; "isSignal": true; }; "height": { "alias": "height"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
interface NiceScale {
|
|
270
|
+
min: number;
|
|
271
|
+
max: number;
|
|
272
|
+
step: number;
|
|
273
|
+
ticks: number[];
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* „Ładna" skala obejmująca [dataMin, dataMax] z ~`maxTicks` podziałkami.
|
|
277
|
+
* Wynikowy zakres jest rozszerzony do równych kroków; zawsze zawiera 0,
|
|
278
|
+
* gdy dane są jednoznakowe (typowe dla słupków/linii wartościowych).
|
|
279
|
+
*/
|
|
280
|
+
declare function niceScale(dataMin: number, dataMax: number, maxTicks?: number): NiceScale;
|
|
281
|
+
|
|
282
|
+
/** Ścieżka linii dla wybranego trybu interpolacji. */
|
|
283
|
+
declare function linePath(points: KptPoint[], mode?: KptLineInterpolation): string;
|
|
284
|
+
/** Ścieżka obszaru pod linią (domknięta do `baselineY`). */
|
|
285
|
+
declare function areaPath(points: KptPoint[], baselineY: number, mode?: KptLineInterpolation): string;
|
|
286
|
+
|
|
287
|
+
interface BarGeom {
|
|
288
|
+
rect: KptRect;
|
|
289
|
+
/** Ścieżka słupka z zaokrąglonymi rogami „od strony wzrostu". */
|
|
290
|
+
path: string;
|
|
291
|
+
seriesIndex: number;
|
|
292
|
+
categoryIndex: number;
|
|
293
|
+
value: number;
|
|
294
|
+
}
|
|
295
|
+
interface BarLayout {
|
|
296
|
+
bars: BarGeom[];
|
|
297
|
+
/** Podziałki osi wartości (wartość → współrzędna). */
|
|
298
|
+
ticks: {
|
|
299
|
+
value: number;
|
|
300
|
+
pos: number;
|
|
301
|
+
}[];
|
|
302
|
+
/** Współrzędna linii bazowej (0). */
|
|
303
|
+
baseline: number;
|
|
304
|
+
scale: ReturnType<typeof niceScale>;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Wylicza słupki dla obszaru `plot`.
|
|
308
|
+
* @param seriesData wartości[serie][kategorie]
|
|
309
|
+
* @param plot obszar rysowania {x,y,width,height}
|
|
310
|
+
* @param orientation pionowa (rośnie w górę) lub pozioma (rośnie w prawo)
|
|
311
|
+
* @param borderRadius promień zaokrąglenia w px
|
|
312
|
+
*/
|
|
313
|
+
declare function barLayout(seriesData: number[][], categoryCount: number, plot: KptRect, orientation: KptBarOrientation, borderRadius: number): BarLayout;
|
|
314
|
+
|
|
315
|
+
interface ArcSlice {
|
|
316
|
+
path: string;
|
|
317
|
+
/** Kąt środka wycinka (do pozycjonowania etykiet/tooltipa). */
|
|
318
|
+
midAngle: number;
|
|
319
|
+
startAngle: number;
|
|
320
|
+
endAngle: number;
|
|
321
|
+
value: number;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Wycinki pie/doughnut: kąt proporcjonalny do wartości (Σ = 2π).
|
|
325
|
+
* `innerRadius` w px (0 dla pie).
|
|
326
|
+
*/
|
|
327
|
+
declare function pieSlices(values: number[], cx: number, cy: number, outerRadius: number, innerRadius?: number): ArcSlice[];
|
|
328
|
+
/**
|
|
329
|
+
* Wycinki polar area: równy kąt (2π/N), promień proporcjonalny do wartości.
|
|
330
|
+
* `maxValue` skaluje promień do `outerRadius`.
|
|
331
|
+
*/
|
|
332
|
+
declare function polarSlices(values: number[], cx: number, cy: number, outerRadius: number, maxValue?: number): ArcSlice[];
|
|
333
|
+
|
|
334
|
+
interface RadarAxis {
|
|
335
|
+
/** Punkt na obwodzie (koniec osi). */
|
|
336
|
+
end: KptPoint;
|
|
337
|
+
angle: number;
|
|
338
|
+
labelIndex: number;
|
|
339
|
+
}
|
|
340
|
+
interface RadarGrid {
|
|
341
|
+
/** Poziomy siatki (pierścienie) jako ścieżki wielokątów. */
|
|
342
|
+
rings: string[];
|
|
343
|
+
axes: RadarAxis[];
|
|
344
|
+
}
|
|
345
|
+
/** Siatka radaru: `levels` koncentrycznych wielokątów + osie do etykiet. */
|
|
346
|
+
declare function radarGrid(count: number, cx: number, cy: number, radius: number, levels?: number): RadarGrid;
|
|
347
|
+
/** Punkty wielokąta serii (wartość → promień, skalowane do `maxValue`). */
|
|
348
|
+
declare function radarPoints(values: number[], cx: number, cy: number, radius: number, maxValue: number): KptPoint[];
|
|
349
|
+
|
|
350
|
+
/** Kolejność kolorów dla kolejnych serii / wycinków. */
|
|
351
|
+
declare const KPT_CHART_PALETTE: readonly string[];
|
|
352
|
+
/** Kolor serii/wycinka: jawny z danych albo z palety (cyklicznie). */
|
|
353
|
+
declare function seriesColor(explicit: string | undefined, index: number, palette?: readonly string[]): string;
|
|
354
|
+
|
|
355
|
+
export { KPT_CHART_PALETTE, KptChart, areaPath, barLayout, linePath, niceScale, pieSlices, polarSlices, radarGrid, radarPoints, seriesColor };
|
|
356
|
+
export type { KptAlign, KptAnimationOptions, KptBarOrientation, KptChartConfig, KptChartSeries, KptChartType, KptFont, KptLegendOptions, KptLegendPosition, KptLegendTitle, KptLineInterpolation, KptPadding, KptPointStyle, KptTitleOptions, KptTooltipContext, KptTooltipOptions };
|