@konce-pt/angular 0.17.0 → 0.18.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/CHANGELOG.md CHANGED
@@ -1,5 +1,48 @@
1
1
  # @konce-pt/angular
2
2
 
3
+ ## 0.18.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 2801f61: Oś i stos wykresu, nagłówki grupowane tabeli, ikona pola tekstowego oraz poprawki portu React.
8
+
9
+ - `kpt-chart`: `valueAxis: { zero?, min?, max? }` - oś wartości nie musi zaczynać się od zera
10
+ (`zero: false` dopasowuje ją do danych), a `min` / `max` przypinają jej końce; słupki i pola rosną
11
+ od zera albo od bliższego mu końca osi, wartość poza przypiętym końcem jest ucinana na krawędzi.
12
+ - `kpt-chart`: `stacked: true` - słupki serii jedne na drugich (dodatnie w górę, ujemne w dół,
13
+ zaokrąglony tylko zewnętrzny odcinek) i linie jako narastające sumy z pasmem pod każdą (`area`).
14
+ Dymek pokazuje wartości serii, ruch osi i duch poprzedniego stanu liczą się ze stosu.
15
+ - `@konce-pt/chart`: `axisScale`, `axisBase`, `chartScale`, `stackSeries`, `scaleRows`, `bandPath`;
16
+ `dataScale` i `barLayout` przyjmują opcje osi i stosu (dotychczasowe wywołania działają bez zmian).
17
+ - `kpt-data-table`: `columnGroups: [{ header, fields }]` - wiersz nagłówków grupowanych nad
18
+ etykietami (`scope="colgroup"`), liczony z kolumn widocznych w bieżącej kolejności; działa z
19
+ kolumnami zamrożonymi, przestawianiem, ukrywaniem i oknem kolumn trybu wirtualnego. Nagłówek z
20
+ grupami i filtrami ma trzy wiersze, wszystkie przyklejone (`--kpt-thead-offset-2`).
21
+ - `@konce-pt/table`: `groupHeaderCells` i typ `KptColumnGroup`.
22
+ - `kpt-input`: `icon` - ikona z rejestru na początku pola (dekoracyjna, kliknięcie trafia w pole).
23
+ - React `KptDialog`: dialog zamontowany od razu z `open` nie zamyka się już sam pod `StrictMode`
24
+ (spóźnione zdarzenie `close` z ponownego montowania efektu jest ignorowane).
25
+ - React `KptSelect`: typ `onValueChange` idzie za `multiple` - bez niego `(value: T)`, z nim
26
+ `(value: T[])`; `multiple` liczone w locie zostawia szeroki typ. Nowe typy `KptSelectSingleProps`
27
+ i `KptSelectMultipleProps`.
28
+ - Dokumentacja: `ariaLabel` `kpt-popover` na liście wejść/propsów w obu portach.
29
+
30
+ ### Patch Changes
31
+
32
+ - Updated dependencies [2801f61]
33
+ - @konce-pt/chart@0.18.0
34
+ - @konce-pt/table@0.18.0
35
+ - @konce-pt/backdrop@0.18.0
36
+ - @konce-pt/chat@0.18.0
37
+ - @konce-pt/datetime@0.18.0
38
+ - @konce-pt/i18n@0.18.0
39
+ - @konce-pt/icons@0.18.0
40
+ - @konce-pt/map@0.18.0
41
+ - @konce-pt/mention@0.18.0
42
+ - @konce-pt/motion@0.18.0
43
+ - @konce-pt/roadmap@0.18.0
44
+ - @konce-pt/speech@0.18.0
45
+
3
46
  ## 0.17.0
4
47
 
5
48
  ### Minor Changes
@@ -13,6 +13,16 @@ Import: `import { KptChart } from '@konce-pt/angular/charts';`
13
13
  - `polarArea` - equal angles, the radius proportional to the value
14
14
  - `radar` - radial axes + a polygon per series
15
15
 
16
+ ## Value axis and stacking (line, bar)
17
+ - `valueAxis?: { zero?, min?, max? }` - the value axis starts at zero by default, so a bar and the area under a line
18
+ show the size directly. `zero: false` fits the axis to the data (a weight of 79-90 kg is no longer a flat line under
19
+ the ceiling); `min` / `max` pin an end of the axis exactly and win over `zero` - a value beyond a pinned end is
20
+ cut at the edge. Bars and areas grow from zero, or from the end of the axis nearer to it
21
+ - `stacked?: boolean` - stacked series: bars on top of each other in one band per category (positive values up,
22
+ negative down; only the outer segment is rounded), lines as running totals with a band under each one (with
23
+ `area`). The axis covers the totals; the tooltip shows the values of the series, not the totals
24
+ - The rules live in `@konce-pt/chart`: `axisScale`, `chartScale`, `stackSeries`, `bandPath` (tested)
25
+
16
26
  ## Inputs
17
27
  - `config: KptChartConfig` (required) - a single object driving everything
18
28
  - `width` / `height`: viewBox units (600x360); the chart scales to its container
@@ -1,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { input, output, ViewEncapsulation, ChangeDetectionStrategy, Component, linkedSignal, computed, viewChild, afterRenderEffect, inject, signal, effect, untracked, DestroyRef } from '@angular/core';
3
3
  import { KptI18n, KPT_MOTION_CONFIG } from '@konce-pt/angular';
4
- import { reelCells, chartAccessibleName, chartDataTable, KptChartMotion, plotArea, seriesColor, extent, domainScale, niceScale, linearScale, areaPath, linePath, significantDelta, deltaKind, formatNumber, barLayout, bandScale, radialArea, polarSlices, pieSlices, radarGrid, radarPoints, polygonPath, polarToCartesian, sameChartShape, dataScale, holdDomain } from '@konce-pt/chart';
4
+ import { reelCells, chartAccessibleName, chartDataTable, KptChartMotion, plotArea, seriesColor, domainScale, chartScale, stackSeries, linearScale, axisBase, bandPath, areaPath, linePath, significantDelta, deltaKind, formatNumber, barLayout, bandScale, radialArea, polarSlices, pieSlices, radarGrid, radarPoints, polygonPath, polarToCartesian, sameChartShape, scaleRows, dataScale } from '@konce-pt/chart';
5
5
  export { KPT_CHART_PALETTE, areaPath, barLayout, linePath, niceScale, pieSlices, polarSlices, radarGrid, radarPoints, seriesColor } from '@konce-pt/chart';
6
6
 
7
7
  const _forTrack0$2 = ($index, $item) => $item.key;
@@ -1018,37 +1018,43 @@ class KptChart {
1018
1018
  return null;
1019
1019
  const h = this.hidden();
1020
1020
  const active = c.series.map((s, i) => ({ s, i })).filter(({ s }) => !h.has('ser:' + s.name));
1021
- const values = [];
1022
- for (const { s } of active)
1023
- values.push(...s.data);
1024
- const [mn, mx] = extent(values.length ? values : [0]);
1021
+ const rows = active.map(({ s }) => s.data);
1025
1022
  const domain = this.frame().domain;
1026
- const scale = domain ? domainScale(domain.target, domain.min, domain.max) : niceScale(Math.min(0, mn), Math.max(0, mx), 5);
1023
+ const scale = domain
1024
+ ? domainScale(domain.target, domain.min, domain.max)
1025
+ : chartScale(rows, { valueAxis: c.valueAxis, stacked: c.stacked });
1026
+ // Stos: punkty serii na narastającej sumie, pasmo od linii serii pod nią.
1027
+ const stack = c.stacked ? stackSeries(rows) : null;
1027
1028
  const plot = plotArea(this.width(), this.height(), VERTICAL_INSETS);
1028
1029
  const yScale = linearScale(scale.min, scale.max, plot.y + plot.height, plot.y);
1029
1030
  const n = c.labels.length;
1030
1031
  const xAt = (i) => (n > 1 ? plot.x + (i / (n - 1)) * plot.width : plot.x + plot.width / 2);
1031
- const baseline = yScale(0);
1032
+ // Punkt nie wychodzi poza oś - przypięte `valueAxis.min`/`max` mogą uciąć wartość.
1033
+ const yAt = (v) => yScale(Math.min(scale.max, Math.max(scale.min, v)));
1034
+ const baseline = yScale(axisBase(scale));
1032
1035
  const interpolation = c.interpolation ?? 'linear';
1033
- const series = active.map(({ s, i }) => {
1034
- const pts = s.data.map((v, idx) => ({ x: xAt(idx), y: yScale(v), value: v, label: c.labels[idx] ?? '' }));
1036
+ const series = active.map(({ s, i }, k) => {
1037
+ const pts = s.data.map((v, idx) => ({ x: xAt(idx), y: yAt(stack?.top[k]?.[idx] ?? v), value: v, label: c.labels[idx] ?? '' }));
1038
+ const floor = stack ? s.data.map((_, idx) => ({ x: xAt(idx), y: yAt(stack.base[k]?.[idx] ?? 0) })) : null;
1035
1039
  const color = seriesColor(s.color, i);
1036
1040
  return {
1037
1041
  key: 'ser:' + s.name,
1038
1042
  name: s.name,
1039
1043
  color,
1040
1044
  path: linePath(pts, interpolation),
1041
- area: c.area ? areaPath(pts, baseline, interpolation) : null,
1045
+ area: c.area ? (floor ? bandPath(pts, floor, interpolation) : areaPath(pts, baseline, interpolation)) : null,
1042
1046
  points: pts,
1043
1047
  };
1044
1048
  });
1045
1049
  // Duch poprzedniego stanu w bieżącej skali, odcinki zmiany i różnice nad punktami.
1046
1050
  const ghostState = this.frame().ghost;
1051
+ // W stosie duch stoi na sumach poprzedniego stanu, tak jak bieżące punkty.
1052
+ const ghostTops = ghostState && c.stacked ? stackSeries(active.map(({ i }) => ghostState.prev[i] ?? [])).top : null;
1047
1053
  const ghost = ghostState
1048
1054
  ? active.map(({ s, i }, k) => {
1049
1055
  const prev = ghostState.prev[i] ?? [];
1050
1056
  const next = ghostState.next[i] ?? [];
1051
- const gpts = prev.map((v, idx) => ({ x: xAt(idx), y: yScale(v) }));
1057
+ const gpts = (ghostTops?.[k] ?? prev).map((v, idx) => ({ x: xAt(idx), y: yAt(v) }));
1052
1058
  const cur = series[k]?.points ?? [];
1053
1059
  return {
1054
1060
  // numer przejścia w kluczu: nowe przejście = nowe elementy, więc ich animacja CSS rusza od nowa
@@ -1088,7 +1094,7 @@ class KptChart {
1088
1094
  const plot = plotArea(this.width(), this.height(), orientation === 'vertical' ? VERTICAL_INSETS : HORIZONTAL_INSETS);
1089
1095
  const domain = this.frame().domain;
1090
1096
  const radius = c.borderRadius ?? 4;
1091
- const layout = barLayout(active.map(({ s }) => s.data), c.labels.length, plot, orientation, radius, domain ? domainScale(domain.target, domain.min, domain.max) : undefined);
1097
+ const layout = barLayout(active.map(({ s }) => s.data), c.labels.length, plot, orientation, radius, domain ? domainScale(domain.target, domain.min, domain.max) : undefined, { stacked: c.stacked, valueAxis: c.valueAxis });
1092
1098
  const colors = active.map(({ s, i }) => seriesColor(s.color, i));
1093
1099
  const names = active.map(({ s }) => s.name);
1094
1100
  const bars = layout.bars.map((b, order) => {
@@ -1113,7 +1119,7 @@ class KptChart {
1113
1119
  if (ghostState) {
1114
1120
  const prevRows = active.map(({ i }) => ghostState.prev[i] ?? []);
1115
1121
  const nextRows = active.map(({ i }) => ghostState.next[i] ?? []);
1116
- const ghostLayout = barLayout(prevRows, c.labels.length, plot, orientation, radius, layout.scale);
1122
+ const ghostLayout = barLayout(prevRows, c.labels.length, plot, orientation, radius, layout.scale, { stacked: c.stacked });
1117
1123
  ghost = ghostLayout.bars.map((g, k) => {
1118
1124
  const cur = layout.bars[k] ?? g;
1119
1125
  const kind = deltaKind(prevRows[g.seriesIndex]?.[g.categoryIndex] ?? 0, nextRows[g.seriesIndex]?.[g.categoryIndex] ?? 0);
@@ -1372,8 +1378,11 @@ class KptChart {
1372
1378
  const withAxis = next.type === 'line' || next.type === 'bar';
1373
1379
  const hidden = this.hidden();
1374
1380
  const visible = (rows) => rows.filter((_, i) => !hidden.has('ser:' + (next.series[i]?.name ?? '')));
1381
+ const axis = { valueAxis: next.valueAxis, stacked: next.stacked };
1382
+ // Skala trzymana na czas ducha obejmuje oba stany - z wierszy już złożonych w stos.
1383
+ const held = [...scaleRows(visible(from), next.stacked), ...scaleRows(visible(to), next.stacked)];
1375
1384
  const scales = withAxis
1376
- ? { start: dataScale(visible(from)), hold: dataScale([holdDomain(visible(from), visible(to))]), end: dataScale(visible(to)) }
1385
+ ? { start: dataScale(visible(from), axis), hold: chartScale(held, { valueAxis: next.valueAxis }), end: dataScale(visible(to), axis) }
1377
1386
  : null;
1378
1387
  this.motion.transition(from, to, { delta: withAxis && next.animation?.delta !== false, scales });
1379
1388
  }
@@ -1448,7 +1457,7 @@ class KptChart {
1448
1457
  '[style.--kpt-chart-delay]': "anim().delay + 'ms'",
1449
1458
  }, template: "<div class=\"kpt-chart\" [attr.data-legend]=\"legendOpts().display ? legendOpts().position : null\">\n @if (titleOpts()?.display && titleOpts()?.text) {\n <div\n class=\"kpt-chart__title\"\n [style.text-align]=\"titleStyle()\"\n [style.color]=\"titleOpts()?.color\"\n [style.font-family]=\"titleOpts()?.font?.family\"\n [style.font-size.px]=\"titleOpts()?.font?.size\"\n [style.font-weight]=\"titleOpts()?.font?.weight\"\n [style.padding-top.px]=\"titleOpts()?.padding?.top\"\n [style.padding-bottom.px]=\"titleOpts()?.padding?.bottom\"\n >\n {{ titleOpts()?.text }}\n </div>\n }\n @if (subtitleOpts()?.display && subtitleOpts()?.text) {\n <div\n class=\"kpt-chart__subtitle\"\n [style.text-align]=\"subtitleStyle()\"\n [style.color]=\"subtitleOpts()?.color\"\n [style.font-family]=\"subtitleOpts()?.font?.family\"\n [style.font-size.px]=\"subtitleOpts()?.font?.size\"\n [style.font-weight]=\"subtitleOpts()?.font?.weight\"\n [style.padding-top.px]=\"subtitleOpts()?.padding?.top\"\n [style.padding-bottom.px]=\"subtitleOpts()?.padding?.bottom\"\n >\n {{ subtitleOpts()?.text }}\n </div>\n }\n\n <div class=\"kpt-chart__body\">\n <div class=\"kpt-chart__canvas\">\n <svg\n [attr.viewBox]=\"'0 0 ' + width() + ' ' + height()\"\n class=\"kpt-chart__svg\"\n role=\"img\"\n [attr.aria-label]=\"accessibleName()\"\n [attr.aria-describedby]=\"config().description ? descId : null\"\n preserveAspectRatio=\"xMidYMid meet\"\n >\n @if (sheen(); as sh) {\n <defs>\n <linearGradient [attr.id]=\"sheenId\" gradientUnits=\"userSpaceOnUse\" [attr.x1]=\"sh.x1\" [attr.x2]=\"sh.x2\" [attr.y1]=\"sh.y1\" [attr.y2]=\"sh.y2\">\n <stop offset=\"0\" class=\"kpt-chart__sheen-stop\" stop-opacity=\"0\" />\n <stop offset=\"0.5\" class=\"kpt-chart__sheen-stop\" stop-opacity=\"0.95\" />\n <stop offset=\"1\" class=\"kpt-chart__sheen-stop\" stop-opacity=\"0\" />\n </linearGradient>\n </defs>\n }\n @switch (type()) {\n @case ('line') {\n @if (lineVm(); as vm) {\n <g class=\"kpt-chart__grid\">\n @for (g of vm.grid; track $index) {\n <line class=\"kpt-chart__gridline\" [attr.x1]=\"g.x1\" [attr.y1]=\"g.y1\" [attr.x2]=\"g.x2\" [attr.y2]=\"g.y2\" />\n }\n </g>\n @if (crosshair(); as ch) {\n <line class=\"kpt-chart__crosshair\" [attr.x1]=\"ch.x\" [attr.y1]=\"ch.y1\" [attr.x2]=\"ch.x\" [attr.y2]=\"ch.y2\" />\n }\n <g class=\"kpt-chart__axis\">\n @for (l of vm.valueLabels; track $index) {\n <text [attr.x]=\"l.x\" [attr.y]=\"l.y\" [attr.text-anchor]=\"l.anchor\">{{ l.text }}</text>\n }\n @for (l of vm.catLabels; track $index) {\n <text [attr.x]=\"l.x\" [attr.y]=\"l.y\" [attr.text-anchor]=\"l.anchor\">{{ l.text }}</text>\n }\n </g>\n @if (crosshair(); as ch) {\n <g class=\"kpt-chart__cat-active\">\n <rect [attr.x]=\"ch.pillX\" [attr.y]=\"ch.pillY\" [attr.width]=\"ch.pillW\" [attr.height]=\"ch.pillH\" [attr.rx]=\"ch.pillH / 2\" />\n <text [attr.x]=\"ch.labelX\" [attr.y]=\"ch.labelY\" text-anchor=\"middle\">{{ ch.text }}</text>\n </g>\n }\n <!-- Duch poprzedniego stanu i odcinki zmiany - tylko na czas przej\u015Bcia danych. -->\n @for (g of vm.ghost; track g.key) {\n <g class=\"kpt-chart__ghost\" aria-hidden=\"true\">\n <path class=\"kpt-chart__ghost-line\" [attr.d]=\"g.path\" />\n @for (t of g.ticks; track $index) {\n <line class=\"kpt-chart__delta\" [attr.data-kind]=\"t.kind\" [attr.x1]=\"t.x\" [attr.x2]=\"t.x\" [attr.y1]=\"t.y1\" [attr.y2]=\"t.y2\" />\n }\n </g>\n }\n @for (s of vm.series; track s.key) {\n <g class=\"kpt-chart__series\" [class.kpt-chart__series--dim]=\"dim(s.key)\">\n @if (s.area) {\n <path class=\"kpt-chart__area\" [attr.d]=\"s.area\" [style.fill]=\"s.color\" />\n }\n <path class=\"kpt-chart__line\" [attr.d]=\"s.path\" [style.stroke]=\"s.color\" pathLength=\"1\" />\n @for (p of s.points; track $index) {\n @if (vm.showPoints) {\n <circle\n class=\"kpt-chart__point\"\n [class.kpt-chart__point--active]=\"activeIndex() === $index\"\n [attr.cx]=\"p.x\"\n [attr.cy]=\"p.y\"\n r=\"4\"\n [style.fill]=\"s.color\"\n [style.--kpt-chart-i]=\"$index\"\n />\n }\n }\n </g>\n }\n @if (sheen(); as sh) {\n @for (s of vm.series; track s.key) {\n <path class=\"kpt-chart__sheen-line\" [attr.d]=\"s.path\" [attr.stroke]=\"'url(#' + sheenId + ')'\" [style.opacity]=\"sh.opacity\" aria-hidden=\"true\" />\n }\n }\n @for (g of vm.ghost; track g.key) {\n @for (c of g.chips; track c.index) {\n <text\n class=\"kpt-chart__chip\"\n [attr.data-kind]=\"c.kind\"\n [attr.x]=\"c.x\"\n [attr.y]=\"c.y\"\n text-anchor=\"middle\"\n [style.--kpt-chart-i]=\"c.index\"\n aria-hidden=\"true\"\n >{{ c.text }}</text>\n }\n }\n @for (r of ripple(); track r.id) {\n <circle class=\"kpt-chart__ripple\" [attr.cx]=\"r.x\" [attr.cy]=\"r.y\" r=\"5\" [style.stroke]=\"r.color\" aria-hidden=\"true\" />\n }\n <!-- Najechanie: najbli\u017Csza kategoria w ca\u0142ym obszarze wykresu - dymek jedzie mi\u0119dzy punktami bez ga\u015Bni\u0119cia. -->\n <rect\n class=\"kpt-chart__hover\"\n [attr.x]=\"vm.plot.x - 12\"\n [attr.y]=\"vm.plot.y - 12\"\n [attr.width]=\"vm.plot.width + 24\"\n [attr.height]=\"vm.plot.height + 24\"\n (pointermove)=\"onCategoryMove($event)\"\n (pointerleave)=\"hideTip()\"\n />\n }\n }\n\n @case ('bar') {\n @if (barVm(); as vm) {\n <g class=\"kpt-chart__grid\">\n @for (g of vm.grid; track $index) {\n <line class=\"kpt-chart__gridline\" [attr.x1]=\"g.x1\" [attr.y1]=\"g.y1\" [attr.x2]=\"g.x2\" [attr.y2]=\"g.y2\" />\n }\n </g>\n <g class=\"kpt-chart__axis\">\n @for (l of vm.valueLabels; track $index) {\n <text [attr.x]=\"l.x\" [attr.y]=\"l.y\" [attr.text-anchor]=\"l.anchor\">{{ l.text }}</text>\n }\n @for (l of vm.catLabels; track $index) {\n <text [attr.x]=\"l.x\" [attr.y]=\"l.y\" [attr.text-anchor]=\"l.anchor\">{{ l.text }}</text>\n }\n </g>\n @if (vm.ghost.length) {\n <g class=\"kpt-chart__ghost\" aria-hidden=\"true\">\n @for (g of vm.ghost; track g.key) {\n <path class=\"kpt-chart__ghost-bar\" [attr.d]=\"g.path\" />\n }\n </g>\n }\n <g class=\"kpt-chart__bars\" [attr.data-orientation]=\"vm.orientation\">\n @for (b of vm.bars; track b.key + '#' + b.index) {\n <path\n class=\"kpt-chart__bar\"\n [class.kpt-chart__series--dim]=\"dim(b.key)\"\n [attr.d]=\"b.path\"\n [style.fill]=\"b.color\"\n [style.--kpt-chart-i]=\"b.index\"\n />\n }\n </g>\n @if (vm.ghost.length) {\n <g class=\"kpt-chart__ghost\" aria-hidden=\"true\">\n @for (g of vm.ghost; track g.key) {\n <rect\n class=\"kpt-chart__delta-bar\"\n [attr.data-kind]=\"g.delta.kind\"\n [attr.x]=\"g.delta.x\"\n [attr.y]=\"g.delta.y\"\n [attr.width]=\"g.delta.width\"\n [attr.height]=\"g.delta.height\"\n rx=\"2\"\n />\n }\n </g>\n }\n @if (sheen(); as sh) {\n @for (b of vm.bars; track b.key + '#' + b.index) {\n <path class=\"kpt-chart__sheen-bar\" [attr.d]=\"b.path\" [attr.fill]=\"'url(#' + sheenId + ')'\" [style.opacity]=\"sh.opacity * 0.7\" aria-hidden=\"true\" />\n }\n }\n <rect\n class=\"kpt-chart__hover\"\n [attr.x]=\"vm.plot.x\"\n [attr.y]=\"vm.plot.y\"\n [attr.width]=\"vm.plot.width\"\n [attr.height]=\"vm.plot.height\"\n (pointermove)=\"onCategoryMove($event)\"\n (pointerleave)=\"hideTip()\"\n />\n }\n }\n\n @case ('radar') {\n @if (radarVm(); as vm) {\n <g class=\"kpt-chart__grid\">\n @for (r of vm.rings; track $index) {\n <path class=\"kpt-chart__ring\" [attr.d]=\"r\" />\n }\n @for (a of vm.axisLines; track $index) {\n <line class=\"kpt-chart__gridline\" [attr.x1]=\"a.x1\" [attr.y1]=\"a.y1\" [attr.x2]=\"a.x2\" [attr.y2]=\"a.y2\" />\n }\n </g>\n <g class=\"kpt-chart__axis\">\n @for (l of vm.axisLabels; track $index) {\n <text [attr.x]=\"l.x\" [attr.y]=\"l.y\" [attr.text-anchor]=\"l.anchor\">{{ l.text }}</text>\n }\n </g>\n @for (s of vm.series; track s.key) {\n <g class=\"kpt-chart__series kpt-chart__radar\" [class.kpt-chart__series--dim]=\"dim(s.key)\">\n <path class=\"kpt-chart__radar-area\" [attr.d]=\"s.polygon\" [style.fill]=\"s.color\" [style.stroke]=\"s.color\" />\n @for (p of s.points; track $index) {\n <circle\n class=\"kpt-chart__point\"\n [attr.cx]=\"p.x\"\n [attr.cy]=\"p.y\"\n r=\"4\"\n [style.fill]=\"s.color\"\n [style.--kpt-chart-i]=\"$index\"\n (pointerenter)=\"showTip(p.x, p.y, s.name, p.label, p.value, s.color)\"\n (pointerleave)=\"hideTip()\"\n />\n }\n </g>\n }\n }\n }\n\n @default {\n @if (pieVm(); as slices) {\n <g class=\"kpt-chart__slices\">\n @for (sl of slices; track sl.key) {\n <path\n class=\"kpt-chart__slice\"\n [class.kpt-chart__series--dim]=\"dim(sl.key)\"\n [attr.d]=\"sl.path\"\n [style.fill]=\"sl.color\"\n [style.--kpt-chart-i]=\"$index\"\n (pointerenter)=\"showTip(sl.tipX, sl.tipY, sl.label, '', sl.value, sl.color)\"\n (pointerleave)=\"hideTip()\"\n />\n }\n </g>\n }\n }\n }\n </svg>\n @if (config().description) {\n <p class=\"kpt-chart__sr\" [id]=\"descId\">{{ config().description }}</p>\n }\n <!-- Dane wykresu dla czytnika: tabela ukryta wizualnie, nie przez display:none. -->\n <table class=\"kpt-chart__sr\">\n <caption>{{ i18n.t('chart.dataTable') }}: {{ accessibleName() }}</caption>\n <thead>\n <tr>\n <th scope=\"col\">{{ i18n.t('chart.category') }}</th>\n @for (col of dataTable().columns; track $index) {\n <th scope=\"col\">{{ col }}</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of dataTable().rows; track $index) {\n <tr>\n <th scope=\"row\">{{ row.label }}</th>\n @for (value of row.values; track $index) {\n <td>{{ value }}</td>\n }\n </tr>\n }\n </tbody>\n </table>\n\n <kpt-chart-tooltip [state]=\"tooltip()\" />\n </div>\n\n @if (legendOpts().display) {\n <kpt-chart-legend\n [items]=\"legendItems()\"\n [position]=\"legendOpts().position\"\n [align]=\"legendOpts().align\"\n [pointStyle]=\"legendOpts().pointStyle\"\n [title]=\"legendOpts().title\"\n (seriesToggle)=\"onToggle($event)\"\n (highlight)=\"onHighlight($event)\"\n />\n }\n </div>\n</div>\n", styles: ["@layer kpt.components{.kpt-chart-host{display:block;--kpt-chart-duration: .4s;--kpt-chart-stagger: 60ms;--kpt-chart-delay: 0ms;--kpt-chart-ease: cubic-bezier(.25, 1, .5, 1);--kpt-chart-spring: linear(0, .0521, .1747, .3278, .4847, .6288, .7513, .849, .9224, .9741, 1.0077, 1.0272, 1.0364, 1.0384, 1.0359, 1.031, 1.025, 1.019, 1.0136, 1.009, 1.0054, 1.0027, 1.0008, .9996, .9989, .9986, .9985, .9986, .9988, .9991, .9993, .9995, .9997, .9998, .9999, 1, 1, 1, 1.0001, 1.0001, 1)}.kpt-chart{display:flex;flex-direction:column;gap:var(--kpt-space-2, .5rem);color:var(--kpt-color-on-surface)}.kpt-chart__title{font-size:var(--kpt-font-size-lg, 1.125rem);font-weight:var(--kpt-font-weight-semibold, 600);color:var(--kpt-color-on-surface)}.kpt-chart__subtitle{font-size:var(--kpt-font-size-sm, .875rem);color:var(--kpt-color-on-surface-muted, #6b7280)}.kpt-chart__body{display:flex;gap:var(--kpt-space-3, .75rem);align-items:center;min-width:0}.kpt-chart[data-legend=top] .kpt-chart__body,.kpt-chart[data-legend=bottom] .kpt-chart__body{flex-direction:column}.kpt-chart[data-legend=top] .kpt-chart-legend-host,.kpt-chart[data-legend=left] .kpt-chart-legend-host{order:-1}.kpt-chart__canvas{position:relative;flex:1 1 auto;min-width:0;width:100%}.kpt-chart__svg{display:block;width:100%;height:auto}.kpt-chart__gridline{stroke:var(--kpt-color-border);stroke-width:1;opacity:.7}.kpt-chart__ring{fill:none;stroke:var(--kpt-color-border);stroke-width:1;opacity:.7}.kpt-chart__axis text{fill:var(--kpt-color-on-surface-muted, #6b7280);font-size:11px;font-family:var(--kpt-font-family-sans)}.kpt-chart__crosshair{stroke:var(--kpt-color-border-strong);stroke-width:1;stroke-dasharray:4 4;opacity:.75;pointer-events:none}.kpt-chart__cat-active{pointer-events:none}.kpt-chart__cat-active rect{fill:var(--kpt-color-on-surface)}.kpt-chart__cat-active text{fill:var(--kpt-color-surface);font-size:11px;font-weight:var(--kpt-font-weight-medium, 500);font-family:var(--kpt-font-family-sans)}.kpt-chart__series,.kpt-chart__bar,.kpt-chart__slice{transition:opacity .2s var(--kpt-chart-ease)}.kpt-chart__series--dim{opacity:.22}.kpt-chart__line{fill:none;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round}.kpt-chart__area{stroke:none;opacity:.15}.kpt-chart__point{stroke:var(--kpt-color-surface);stroke-width:2;cursor:pointer;transition:transform .15s var(--kpt-chart-ease);transform-box:fill-box;transform-origin:center}.kpt-chart__point:hover{transform:scale(1.4)}.kpt-chart__point--active{transform:scale(1.5)}.kpt-chart__hover{fill:transparent;pointer-events:all}.kpt-chart__bar{cursor:pointer}.kpt-chart__slice{cursor:pointer;stroke:var(--kpt-color-surface);stroke-width:1.5}.kpt-chart__radar-area{fill-opacity:.18;stroke-width:2;stroke-linejoin:round}.kpt-chart__legend-title{font-size:var(--kpt-font-size-sm, .875rem);font-weight:var(--kpt-font-weight-medium, 500);color:var(--kpt-color-on-surface-muted);margin-bottom:var(--kpt-space-1, .25rem)}.kpt-chart__legend-list{display:flex;flex-wrap:wrap;gap:var(--kpt-space-2, .5rem) var(--kpt-space-4, 1rem);align-items:center;justify-content:center;margin:0;padding:0;list-style:none}.kpt-chart__legend[data-align=start] .kpt-chart__legend-list{justify-content:flex-start}.kpt-chart__legend[data-align=end] .kpt-chart__legend-list{justify-content:flex-end}.kpt-chart__legend[data-position=left] .kpt-chart__legend-list,.kpt-chart__legend[data-position=right] .kpt-chart__legend-list{flex-direction:column;align-items:flex-start}.kpt-chart__legend-item{display:inline-flex;align-items:center;gap:var(--kpt-space-2, .5rem);padding:0;border:0;background:none;cursor:pointer;font:inherit;font-size:var(--kpt-font-size-sm, .875rem);color:var(--kpt-color-on-surface)}.kpt-chart__legend-item--hidden{opacity:.45}.kpt-chart__legend-item--hidden .kpt-chart__legend-label{text-decoration:line-through}.kpt-chart__legend-marker{display:inline-block;width:12px;height:12px;background:var(--kpt-chart-legend-color);flex:none}.kpt-chart__legend-marker[data-style=circle]{border-radius:var(--kpt-radius-full, 9999px)}.kpt-chart__legend-marker[data-style=rect]{border-radius:var(--kpt-radius-sm, .25rem)}.kpt-chart__legend-marker[data-style=rectRot]{transform:rotate(45deg);border-radius:2px}.kpt-chart__legend-marker[data-style=triangle]{background:none;width:0;height:0;border-left:7px solid transparent;border-right:7px solid transparent;border-bottom:12px solid var(--kpt-chart-legend-color)}.kpt-chart__legend-marker[data-style=line]{height:3px;border-radius:var(--kpt-radius-full, 9999px)}.kpt-chart__tooltip{position:absolute;transform:translate(-50%,calc(-100% - 10px));pointer-events:none;background:var(--kpt-color-surface-raised, var(--kpt-color-surface));color:var(--kpt-color-on-surface);border:1px solid var(--kpt-color-border);border-radius:var(--kpt-radius-md, .5rem);box-shadow:0 4px 16px #0000001f;padding:var(--kpt-space-2, .5rem) var(--kpt-space-3, .75rem);font-size:var(--kpt-font-size-sm, .875rem);white-space:nowrap;z-index:2}.kpt-chart__tooltip--flip{transform:translate(-50%,12px)}.kpt-chart__tooltip{transform-origin:50% 100%;transition:opacity calc(.16s * var(--kpt-motion-scale, 1)) var(--kpt-chart-ease),scale calc(.16s * var(--kpt-motion-scale, 1)) var(--kpt-chart-ease),visibility 0s}.kpt-chart__tooltip--hidden{opacity:0;scale:.96;visibility:hidden;transition:opacity calc(.14s * var(--kpt-motion-scale, 1)) ease-in,scale calc(.14s * var(--kpt-motion-scale, 1)) ease-in,visibility 0s calc(.14s * var(--kpt-motion-scale, 1))}.kpt-chart__tooltip-label{display:inline-block}.kpt-chart__reels{display:inline-flex;font-variant-numeric:tabular-nums}.kpt-chart__reel{display:inline-block;height:1.25em;line-height:1.25em;overflow:hidden;-webkit-mask-image:linear-gradient(transparent,var(--kpt-color-on-surface) 12%,var(--kpt-color-on-surface) 88%,transparent);mask-image:linear-gradient(transparent,var(--kpt-color-on-surface) 12%,var(--kpt-color-on-surface) 88%,transparent)}.kpt-chart__reel-strip{display:flex;flex-direction:column;translate:0 calc(var(--kpt-chart-digit, 0) * -1.25em);transition:translate calc(.52s * var(--kpt-motion-scale, 1)) var(--kpt-chart-spring)}.kpt-chart__reel-strip>span,.kpt-chart__reel-text{height:1.25em;line-height:1.25em;white-space:pre}.kpt-chart__tooltip-title{font-weight:var(--kpt-font-weight-semibold, 600);margin-bottom:2px}.kpt-chart__tooltip-row{display:flex;align-items:center;gap:var(--kpt-space-2, .5rem)}.kpt-chart__tooltip-dot{width:8px;height:8px;border-radius:var(--kpt-radius-full, 9999px);flex:none}.kpt-chart__tooltip-name{color:var(--kpt-color-on-surface-muted)}.kpt-chart__tooltip-val{margin-left:auto;font-weight:var(--kpt-font-weight-medium, 500)}.kpt-chart__line{stroke-dasharray:1;stroke-dashoffset:1;animation:kpt-chart-draw var(--kpt-chart-duration) var(--kpt-chart-ease) var(--kpt-chart-delay) forwards}.kpt-chart__area{animation:kpt-chart-fade var(--kpt-chart-duration) var(--kpt-chart-ease) var(--kpt-chart-delay) backwards}.kpt-chart__point{animation:kpt-chart-fade var(--kpt-chart-duration) var(--kpt-chart-ease) calc(var(--kpt-chart-delay) + var(--kpt-chart-duration) + var(--kpt-chart-i, 0) * var(--kpt-chart-stagger)) backwards}.kpt-chart__bars[data-orientation=vertical] .kpt-chart__bar{transform-box:fill-box;transform-origin:bottom;animation:kpt-chart-grow-y var(--kpt-chart-duration) var(--kpt-chart-ease) calc(var(--kpt-chart-delay) + var(--kpt-chart-i, 0) * var(--kpt-chart-stagger)) backwards}.kpt-chart__bars[data-orientation=horizontal] .kpt-chart__bar{transform-box:fill-box;transform-origin:left;animation:kpt-chart-grow-x var(--kpt-chart-duration) var(--kpt-chart-ease) calc(var(--kpt-chart-delay) + var(--kpt-chart-i, 0) * var(--kpt-chart-stagger)) backwards}.kpt-chart__slice,.kpt-chart__radar-area{transform-box:fill-box;transform-origin:center}.kpt-chart__slice{animation:kpt-chart-pop var(--kpt-chart-duration) var(--kpt-chart-ease) calc(var(--kpt-chart-delay) + var(--kpt-chart-i, 0) * var(--kpt-chart-stagger)) backwards}.kpt-chart__radar-area{animation:kpt-chart-pop var(--kpt-chart-duration) var(--kpt-chart-ease) var(--kpt-chart-delay) backwards}@keyframes kpt-chart-draw{to{stroke-dashoffset:0}}@keyframes kpt-chart-fade{0%{opacity:0}}@keyframes kpt-chart-grow-y{0%{transform:scaleY(0)}}@keyframes kpt-chart-grow-x{0%{transform:scaleX(0)}}@keyframes kpt-chart-pop{0%{transform:scale(0);opacity:0}}.kpt-chart__ghost{pointer-events:none}.kpt-chart__ghost-line,.kpt-chart__ghost-bar{fill:none;stroke:var(--kpt-color-on-surface-muted);stroke-dasharray:4 4;animation:kpt-chart-ghost calc(1.7s * var(--kpt-motion-scale, 1)) ease-in forwards}.kpt-chart__ghost-line{stroke-width:1.5}.kpt-chart__ghost-bar{stroke-width:1;stroke-dasharray:3 3}.kpt-chart__delta,.kpt-chart__delta-bar,.kpt-chart__chip{--_kpt-chart-delta: var(--kpt-chart-delta-up, var(--kpt-color-success))}[data-kind=down]:is(.kpt-chart__delta,.kpt-chart__delta-bar,.kpt-chart__chip){--_kpt-chart-delta: var(--kpt-chart-delta-down, var(--kpt-color-danger))}[data-kind=same]:is(.kpt-chart__delta,.kpt-chart__delta-bar,.kpt-chart__chip){display:none}.kpt-chart__delta{stroke:var(--_kpt-chart-delta);stroke-width:2;stroke-linecap:round;animation:kpt-chart-ghost calc(1.7s * var(--kpt-motion-scale, 1)) ease-in forwards}.kpt-chart__delta-bar{fill:var(--_kpt-chart-delta);animation:kpt-chart-ghost-soft calc(1.7s * var(--kpt-motion-scale, 1)) ease-in forwards}.kpt-chart__chip{fill:var(--_kpt-chart-delta);font-size:10px;font-weight:var(--kpt-font-weight-bold, 700);font-family:var(--kpt-font-family-sans);font-variant-numeric:tabular-nums;pointer-events:none;animation:kpt-chart-chip calc(1.3s * var(--kpt-motion-scale, 1)) cubic-bezier(.2,0,0,1) calc((.38s + var(--kpt-chart-i, 0) * .04s) * var(--kpt-motion-scale, 1)) both}.kpt-chart__sheen-stop{stop-color:var(--kpt-chart-sheen, var(--kpt-color-info))}.kpt-chart__sheen-line{fill:none;stroke-width:5;stroke-linecap:round;filter:blur(1.2px);pointer-events:none}.kpt-chart__sheen-bar{mix-blend-mode:screen;pointer-events:none}[data-theme=dark] .kpt-chart__sheen-bar{mix-blend-mode:normal}.kpt-chart__ripple{fill:none;stroke-width:2;transform-box:fill-box;transform-origin:center;pointer-events:none;animation:kpt-chart-ripple calc(.52s * var(--kpt-motion-scale, 1)) cubic-bezier(.2,0,0,1) calc(.24s * var(--kpt-motion-scale, 1)) both}@keyframes kpt-chart-ghost{0%,50%{opacity:1}to{opacity:0}}@keyframes kpt-chart-ghost-soft{0%,50%{opacity:.45}to{opacity:0}}@keyframes kpt-chart-chip{0%{opacity:0;translate:0 6px}25%,75%{opacity:1;translate:0 0}to{opacity:0;translate:0 -6px}}@keyframes kpt-chart-ripple{0%{opacity:.55;scale:1}to{opacity:0;scale:3.2}}.kpt-chart--no-anim :is(.kpt-chart__line,.kpt-chart__area,.kpt-chart__point,.kpt-chart__bar,.kpt-chart__slice,.kpt-chart__radar-area){animation:none;stroke-dashoffset:0}@media(prefers-reduced-motion:reduce){.kpt-chart :is(.kpt-chart__line,.kpt-chart__area,.kpt-chart__point,.kpt-chart__bar,.kpt-chart__slice,.kpt-chart__radar-area){animation:none;stroke-dashoffset:0}.kpt-chart__tooltip,.kpt-chart__tooltip--hidden,.kpt-chart__reel-strip{transition:none}}.kpt-chart--no-anim :is(.kpt-chart__tooltip,.kpt-chart__tooltip--hidden,.kpt-chart__reel-strip){transition:none}.kpt-chart__sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}}\n"] }]
1450
1459
  }], () => [], { config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: true }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }] }); })();
1451
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(KptChart, { className: "KptChart", filePath: "lib/chart.component.ts", lineNumber: 179 }); })();
1460
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(KptChart, { className: "KptChart", filePath: "lib/chart.component.ts", lineNumber: 181 }); })();
1452
1461
  /** Indeks najbliższej pozycji (środka kategorii) do współrzędnej kursora. */
1453
1462
  function nearestIndex(positions, at) {
1454
1463
  let best = 0;