@taiga-ui/addon-charts 4.66.0 → 5.0.0-canary.856b30d
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 +2 -2
- package/components/arc-chart/arc-chart.component.d.ts +9 -14
- package/components/axes/axes.component.d.ts +18 -20
- package/components/bar/bar.component.d.ts +4 -5
- package/components/bar-chart/bar-chart.component.d.ts +11 -14
- package/components/bar-set/bar-set.component.d.ts +7 -9
- package/components/chart-hint/chart-hint.directive.d.ts +8 -0
- package/components/chart-hint/index.d.ts +1 -0
- package/components/index.d.ts +1 -0
- package/components/legend-item/legend-item.component.d.ts +6 -7
- package/components/line-chart/line-chart-hint.directive.d.ts +6 -6
- package/components/line-chart/line-chart.component.d.ts +20 -25
- package/components/line-chart/line-chart.options.d.ts +1 -3
- package/components/line-days-chart/line-days-chart-hint.directive.d.ts +3 -3
- package/components/line-days-chart/line-days-chart.component.d.ts +13 -14
- package/components/pie-chart/pie-chart.component.d.ts +7 -14
- package/components/pie-chart/pie-chart.directive.d.ts +2 -3
- package/components/ring-chart/ring-chart.component.d.ts +4 -9
- package/fesm2022/taiga-ui-addon-charts-components-arc-chart.mjs +29 -55
- package/fesm2022/taiga-ui-addon-charts-components-arc-chart.mjs.map +1 -1
- package/fesm2022/taiga-ui-addon-charts-components-axes.mjs +27 -67
- package/fesm2022/taiga-ui-addon-charts-components-axes.mjs.map +1 -1
- package/fesm2022/taiga-ui-addon-charts-components-bar-chart.mjs +28 -58
- package/fesm2022/taiga-ui-addon-charts-components-bar-chart.mjs.map +1 -1
- package/fesm2022/taiga-ui-addon-charts-components-bar-set.mjs +16 -39
- package/fesm2022/taiga-ui-addon-charts-components-bar-set.mjs.map +1 -1
- package/fesm2022/taiga-ui-addon-charts-components-bar.mjs +12 -24
- package/fesm2022/taiga-ui-addon-charts-components-bar.mjs.map +1 -1
- package/fesm2022/taiga-ui-addon-charts-components-chart-hint.mjs +24 -0
- package/fesm2022/taiga-ui-addon-charts-components-chart-hint.mjs.map +1 -0
- package/fesm2022/taiga-ui-addon-charts-components-legend-item.mjs +15 -28
- package/fesm2022/taiga-ui-addon-charts-components-legend-item.mjs.map +1 -1
- package/fesm2022/taiga-ui-addon-charts-components-line-chart.mjs +75 -138
- package/fesm2022/taiga-ui-addon-charts-components-line-chart.mjs.map +1 -1
- package/fesm2022/taiga-ui-addon-charts-components-line-days-chart.mjs +87 -124
- package/fesm2022/taiga-ui-addon-charts-components-line-days-chart.mjs.map +1 -1
- package/fesm2022/taiga-ui-addon-charts-components-pie-chart.mjs +57 -89
- package/fesm2022/taiga-ui-addon-charts-components-pie-chart.mjs.map +1 -1
- package/fesm2022/taiga-ui-addon-charts-components-ring-chart.mjs +11 -30
- package/fesm2022/taiga-ui-addon-charts-components-ring-chart.mjs.map +1 -1
- package/fesm2022/taiga-ui-addon-charts-components.mjs +1 -0
- package/fesm2022/taiga-ui-addon-charts-components.mjs.map +1 -1
- package/fesm2022/taiga-ui-addon-charts-utils.mjs +6 -3
- package/fesm2022/taiga-ui-addon-charts-utils.mjs.map +1 -1
- package/package.json +19 -40
- package/esm2022/components/arc-chart/arc-chart.component.mjs +0 -85
- package/esm2022/components/arc-chart/index.mjs +0 -2
- package/esm2022/components/arc-chart/taiga-ui-addon-charts-components-arc-chart.mjs +0 -5
- package/esm2022/components/axes/axes.component.mjs +0 -79
- package/esm2022/components/axes/index.mjs +0 -2
- package/esm2022/components/axes/taiga-ui-addon-charts-components-axes.mjs +0 -5
- package/esm2022/components/bar/bar.component.mjs +0 -35
- package/esm2022/components/bar/index.mjs +0 -2
- package/esm2022/components/bar/taiga-ui-addon-charts-components-bar.mjs +0 -5
- package/esm2022/components/bar-chart/bar-chart.component.mjs +0 -77
- package/esm2022/components/bar-chart/index.mjs +0 -2
- package/esm2022/components/bar-chart/taiga-ui-addon-charts-components-bar-chart.mjs +0 -5
- package/esm2022/components/bar-set/bar-set.component.mjs +0 -50
- package/esm2022/components/bar-set/index.mjs +0 -2
- package/esm2022/components/bar-set/taiga-ui-addon-charts-components-bar-set.mjs +0 -5
- package/esm2022/components/index.mjs +0 -11
- package/esm2022/components/legend-item/index.mjs +0 -2
- package/esm2022/components/legend-item/legend-item.component.mjs +0 -37
- package/esm2022/components/legend-item/taiga-ui-addon-charts-components-legend-item.mjs +0 -5
- package/esm2022/components/line-chart/index.mjs +0 -4
- package/esm2022/components/line-chart/line-chart-hint.directive.mjs +0 -68
- package/esm2022/components/line-chart/line-chart.component.mjs +0 -183
- package/esm2022/components/line-chart/line-chart.options.mjs +0 -14
- package/esm2022/components/line-chart/taiga-ui-addon-charts-components-line-chart.mjs +0 -5
- package/esm2022/components/line-days-chart/index.mjs +0 -3
- package/esm2022/components/line-days-chart/line-days-chart-hint.directive.mjs +0 -71
- package/esm2022/components/line-days-chart/line-days-chart.component.mjs +0 -194
- package/esm2022/components/line-days-chart/taiga-ui-addon-charts-components-line-days-chart.mjs +0 -5
- package/esm2022/components/pie-chart/index.mjs +0 -3
- package/esm2022/components/pie-chart/pie-chart.component.mjs +0 -115
- package/esm2022/components/pie-chart/pie-chart.directive.mjs +0 -48
- package/esm2022/components/pie-chart/taiga-ui-addon-charts-components-pie-chart.mjs +0 -5
- package/esm2022/components/ring-chart/index.mjs +0 -2
- package/esm2022/components/ring-chart/ring-chart.component.mjs +0 -39
- package/esm2022/components/ring-chart/taiga-ui-addon-charts-components-ring-chart.mjs +0 -5
- package/esm2022/components/taiga-ui-addon-charts-components.mjs +0 -5
- package/esm2022/index.mjs +0 -2
- package/esm2022/taiga-ui-addon-charts.mjs +0 -5
- package/esm2022/types/index.mjs +0 -2
- package/esm2022/types/taiga-ui-addon-charts-types.mjs +0 -5
- package/esm2022/utils/control-point.mjs +0 -13
- package/esm2022/utils/describe-sector.mjs +0 -33
- package/esm2022/utils/draw-curve.mjs +0 -8
- package/esm2022/utils/draw-line.mjs +0 -4
- package/esm2022/utils/draw.mjs +0 -10
- package/esm2022/utils/index.mjs +0 -8
- package/esm2022/utils/line-angle.mjs +0 -6
- package/esm2022/utils/line-length.mjs +0 -6
- package/esm2022/utils/taiga-ui-addon-charts-utils.mjs +0 -5
|
@@ -1,87 +1,61 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
import { input, model, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
import { toSignal } from '@angular/core/rxjs-interop';
|
|
4
|
+
import { TuiHovered } from '@taiga-ui/cdk/directives/hovered';
|
|
5
|
+
import { tuiZonefree } from '@taiga-ui/cdk/observables';
|
|
6
|
+
import { timer, take, map } from 'rxjs';
|
|
7
7
|
|
|
8
8
|
const ARC = 0.76; // 3/4 with 1% safety offset
|
|
9
9
|
const SIZE = { m: 9, l: 11, xl: 16 };
|
|
10
10
|
const WIDTH = { m: 0.25, l: 0.375, xl: 0.5625 };
|
|
11
11
|
const GAP = { m: 0.125, l: 0.1875, xl: 0.25 };
|
|
12
|
-
function arcsToIndex(arcs) {
|
|
13
|
-
return arcs.map(({ nativeElement }, index) => merge(tuiTypedFromEvent(nativeElement, 'mouseenter').pipe(map(() => index)), tuiTypedFromEvent(nativeElement, 'mouseleave').pipe(map(() => NaN))));
|
|
14
|
-
}
|
|
15
12
|
class TuiArcChart {
|
|
16
13
|
constructor() {
|
|
17
|
-
this.
|
|
18
|
-
this.
|
|
19
|
-
this
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
this.
|
|
23
|
-
this.
|
|
24
|
-
this.max = 100;
|
|
25
|
-
this.minLabel = '0%';
|
|
26
|
-
this.maxLabel = '100%';
|
|
27
|
-
this.activeItemIndex = NaN;
|
|
28
|
-
this.activeItemIndexChange = this.arcs$.pipe(switchMap((arcs) => arcs.changes.pipe(startWith(null), switchMap(() => merge(...arcsToIndex(arcs))))), tap((index) => {
|
|
29
|
-
this.activeItemIndex = index;
|
|
30
|
-
}));
|
|
31
|
-
}
|
|
32
|
-
set arcs(arcs) {
|
|
33
|
-
this.arcs$.next(arcs);
|
|
14
|
+
this.initialized = toSignal(timer(0).pipe(tuiZonefree(), take(1), map(() => true)), { initialValue: false });
|
|
15
|
+
this.value = input([]);
|
|
16
|
+
this.size = input('m');
|
|
17
|
+
this.max = input(100);
|
|
18
|
+
this.minLabel = input('0%');
|
|
19
|
+
this.maxLabel = input('100%');
|
|
20
|
+
this.activeItemIndex = model(NaN);
|
|
34
21
|
}
|
|
35
22
|
get width() {
|
|
36
|
-
return SIZE[this.size];
|
|
23
|
+
return SIZE[this.size()];
|
|
37
24
|
}
|
|
38
25
|
get strokeWidth() {
|
|
39
|
-
return WIDTH[this.size];
|
|
26
|
+
return WIDTH[this.size()];
|
|
27
|
+
}
|
|
28
|
+
onHovered(hovered, index) {
|
|
29
|
+
this.activeItemIndex.set(hovered ? index : NaN);
|
|
40
30
|
}
|
|
41
31
|
isInactive(index) {
|
|
42
|
-
return !Number.isNaN(this.activeItemIndex) && index !== this.activeItemIndex;
|
|
32
|
+
return !Number.isNaN(this.activeItemIndex()) && index !== this.activeItemIndex();
|
|
43
33
|
}
|
|
44
34
|
getInset(index) {
|
|
45
|
-
return this.strokeWidth / 2 + index * (this.strokeWidth + GAP[this.size]);
|
|
35
|
+
return this.strokeWidth / 2 + index * (this.strokeWidth + GAP[this.size()]);
|
|
46
36
|
}
|
|
47
37
|
getDiameter(index) {
|
|
48
|
-
return SIZE[this.size] - 2 * this.getInset(index);
|
|
38
|
+
return SIZE[this.size()] - 2 * this.getInset(index);
|
|
49
39
|
}
|
|
50
40
|
getLength(index) {
|
|
51
41
|
return Math.PI * this.getDiameter(index) * ARC;
|
|
52
42
|
}
|
|
53
43
|
getOffset(index) {
|
|
54
|
-
return (this.getLength(index) *
|
|
44
|
+
return (this.getLength(index) *
|
|
45
|
+
(1 - Math.min((this.value()[index] || 0) / this.max(), 1)));
|
|
55
46
|
}
|
|
56
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
57
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
47
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiArcChart, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
48
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: TuiArcChart, isStandalone: true, selector: "tui-arc-chart", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, minLabel: { classPropertyName: "minLabel", publicName: "minLabel", isSignal: true, isRequired: false, transformFunction: null }, maxLabel: { classPropertyName: "maxLabel", publicName: "maxLabel", isSignal: true, isRequired: false, transformFunction: null }, activeItemIndex: { classPropertyName: "activeItemIndex", publicName: "activeItemIndex", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { activeItemIndex: "activeItemIndexChange" }, host: { properties: { "attr.data-size": "size()", "style.width.rem": "width", "style.height.rem": "width", "style.strokeWidth.rem": "strokeWidth" } }, ngImport: i0, template: "@let data = value();\n@let min = minLabel();\n@let max = maxLabel();\n@for (_ of '-'.repeat(data.length); track $index) {\n <svg\n focusable=\"false\"\n viewBox=\"-100 -100 200 200\"\n xmlns=\"http://www.w3.org/2000/svg\"\n class=\"t-svg\"\n [style.height.rem]=\"getDiameter($index)\"\n [style.inset-block-start.rem]=\"getInset($index)\"\n [style.inset-inline.rem]=\"getInset($index)\"\n >\n <path\n d=\"M -70 70 A 100 100 0 1 1 70 70\"\n vector-effect=\"non-scaling-stroke\"\n />\n <path\n #arc\n d=\"M -70 70 A 100 100 0 1 1 70 70\"\n vector-effect=\"non-scaling-stroke\"\n class=\"t-value\"\n [class.t-value_inactive]=\"isInactive($index)\"\n [style.stroke]=\"`var(--tui-chart-categorical-${$index.toString().padStart(2, '0')})`\"\n [style.strokeDasharray.em]=\"getLength($index)\"\n [style.strokeDashoffset.em]=\"initialized() ? getOffset($index) : getLength($index)\"\n (tuiHoveredChange)=\"onHovered($event, $index)\"\n />\n </svg>\n}\n<div class=\"t-content\">\n <div class=\"t-wrapper\">\n <ng-content />\n </div>\n</div>\n<div class=\"t-percent\">\n <span>{{ min }}</span>\n <span>{{ max }}</span>\n</div>\n", styles: [":host{position:relative;display:block;flex-shrink:0}.t-svg{position:absolute;inset:0;overflow:visible;fill:none;stroke:currentColor;stroke-linecap:round;color:var(--tui-background-neutral-1);font-size:1rem;pointer-events:none}.t-value{pointer-events:auto;transition:stroke-dashoffset var(--tui-duration) ease-in-out,opacity var(--tui-duration) ease-in-out .1s}.t-value_inactive{transition-property:stroke-dashoffset,opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;opacity:.16}.t-content{position:absolute;top:0;left:0;inline-size:100%;block-size:100%;display:flex;justify-content:center;align-items:center;text-align:center;color:var(--tui-text-secondary);font:var(--tui-font-body-xs);pointer-events:none}:host[data-size=xl] .t-content{font:var(--tui-font-body-m)}.t-wrapper{pointer-events:auto}.t-wrapper:first-line{color:var(--tui-text-primary)}:host[data-size=m] .t-wrapper:first-line{font:var(--tui-font-body-s);font-weight:700}:host[data-size=l] .t-wrapper:first-line{font:var(--tui-font-body-m);font-weight:700}:host[data-size=xl] .t-wrapper:first-line{font:var(--tui-font-heading-h5)}.t-percent{position:absolute;display:flex;inset-block:auto 11%;inset-inline:25% auto;inline-size:50%;justify-content:space-between;font:var(--tui-font-body-xs);color:var(--tui-text-secondary)}:host[data-size=xl] .t-percent{font:var(--tui-font-body-m)}\n"], dependencies: [{ kind: "directive", type: TuiHovered, selector: "[tuiHoveredChange]", outputs: ["tuiHoveredChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
58
49
|
}
|
|
59
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
50
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiArcChart, decorators: [{
|
|
60
51
|
type: Component,
|
|
61
|
-
args: [{
|
|
62
|
-
'[attr.data-size]': 'size',
|
|
52
|
+
args: [{ selector: 'tui-arc-chart', imports: [TuiHovered], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
53
|
+
'[attr.data-size]': 'size()',
|
|
63
54
|
'[style.width.rem]': 'width',
|
|
64
55
|
'[style.height.rem]': 'width',
|
|
65
56
|
'[style.strokeWidth.rem]': 'strokeWidth',
|
|
66
|
-
}, template: "
|
|
67
|
-
}]
|
|
68
|
-
type: Input
|
|
69
|
-
}], size: [{
|
|
70
|
-
type: Input
|
|
71
|
-
}], max: [{
|
|
72
|
-
type: Input
|
|
73
|
-
}], minLabel: [{
|
|
74
|
-
type: Input
|
|
75
|
-
}], maxLabel: [{
|
|
76
|
-
type: Input
|
|
77
|
-
}], activeItemIndex: [{
|
|
78
|
-
type: Input
|
|
79
|
-
}], activeItemIndexChange: [{
|
|
80
|
-
type: Output
|
|
81
|
-
}], arcs: [{
|
|
82
|
-
type: ViewChildren,
|
|
83
|
-
args: ['arc']
|
|
84
|
-
}] } });
|
|
57
|
+
}, template: "@let data = value();\n@let min = minLabel();\n@let max = maxLabel();\n@for (_ of '-'.repeat(data.length); track $index) {\n <svg\n focusable=\"false\"\n viewBox=\"-100 -100 200 200\"\n xmlns=\"http://www.w3.org/2000/svg\"\n class=\"t-svg\"\n [style.height.rem]=\"getDiameter($index)\"\n [style.inset-block-start.rem]=\"getInset($index)\"\n [style.inset-inline.rem]=\"getInset($index)\"\n >\n <path\n d=\"M -70 70 A 100 100 0 1 1 70 70\"\n vector-effect=\"non-scaling-stroke\"\n />\n <path\n #arc\n d=\"M -70 70 A 100 100 0 1 1 70 70\"\n vector-effect=\"non-scaling-stroke\"\n class=\"t-value\"\n [class.t-value_inactive]=\"isInactive($index)\"\n [style.stroke]=\"`var(--tui-chart-categorical-${$index.toString().padStart(2, '0')})`\"\n [style.strokeDasharray.em]=\"getLength($index)\"\n [style.strokeDashoffset.em]=\"initialized() ? getOffset($index) : getLength($index)\"\n (tuiHoveredChange)=\"onHovered($event, $index)\"\n />\n </svg>\n}\n<div class=\"t-content\">\n <div class=\"t-wrapper\">\n <ng-content />\n </div>\n</div>\n<div class=\"t-percent\">\n <span>{{ min }}</span>\n <span>{{ max }}</span>\n</div>\n", styles: [":host{position:relative;display:block;flex-shrink:0}.t-svg{position:absolute;inset:0;overflow:visible;fill:none;stroke:currentColor;stroke-linecap:round;color:var(--tui-background-neutral-1);font-size:1rem;pointer-events:none}.t-value{pointer-events:auto;transition:stroke-dashoffset var(--tui-duration) ease-in-out,opacity var(--tui-duration) ease-in-out .1s}.t-value_inactive{transition-property:stroke-dashoffset,opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;opacity:.16}.t-content{position:absolute;top:0;left:0;inline-size:100%;block-size:100%;display:flex;justify-content:center;align-items:center;text-align:center;color:var(--tui-text-secondary);font:var(--tui-font-body-xs);pointer-events:none}:host[data-size=xl] .t-content{font:var(--tui-font-body-m)}.t-wrapper{pointer-events:auto}.t-wrapper:first-line{color:var(--tui-text-primary)}:host[data-size=m] .t-wrapper:first-line{font:var(--tui-font-body-s);font-weight:700}:host[data-size=l] .t-wrapper:first-line{font:var(--tui-font-body-m);font-weight:700}:host[data-size=xl] .t-wrapper:first-line{font:var(--tui-font-heading-h5)}.t-percent{position:absolute;display:flex;inset-block:auto 11%;inset-inline:25% auto;inline-size:50%;justify-content:space-between;font:var(--tui-font-body-xs);color:var(--tui-text-secondary)}:host[data-size=xl] .t-percent{font:var(--tui-font-body-m)}\n"] }]
|
|
58
|
+
}] });
|
|
85
59
|
|
|
86
60
|
/**
|
|
87
61
|
* Generated bundle index. Do not edit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-addon-charts-components-arc-chart.mjs","sources":["../../../projects/addon-charts/components/arc-chart/arc-chart.component.ts","../../../projects/addon-charts/components/arc-chart/arc-chart.template.html","../../../projects/addon-charts/components/arc-chart/taiga-ui-addon-charts-components-arc-chart.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"taiga-ui-addon-charts-components-arc-chart.mjs","sources":["../../../projects/addon-charts/components/arc-chart/arc-chart.component.ts","../../../projects/addon-charts/components/arc-chart/arc-chart.template.html","../../../projects/addon-charts/components/arc-chart/taiga-ui-addon-charts-components-arc-chart.ts"],"sourcesContent":["import {ChangeDetectionStrategy, Component, input, model} from '@angular/core';\nimport {toSignal} from '@angular/core/rxjs-interop';\nimport {TuiHovered} from '@taiga-ui/cdk/directives/hovered';\nimport {tuiZonefree} from '@taiga-ui/cdk/observables';\nimport {type TuiSizeXL} from '@taiga-ui/core/types';\nimport {map, take, timer} from 'rxjs';\n\nconst ARC = 0.76; // 3/4 with 1% safety offset\nconst SIZE = {m: 9, l: 11, xl: 16} as const;\nconst WIDTH = {m: 0.25, l: 0.375, xl: 0.5625} as const;\nconst GAP = {m: 0.125, l: 0.1875, xl: 0.25} as const;\n\n@Component({\n selector: 'tui-arc-chart',\n imports: [TuiHovered],\n templateUrl: './arc-chart.template.html',\n styleUrl: './arc-chart.style.less',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[attr.data-size]': 'size()',\n '[style.width.rem]': 'width',\n '[style.height.rem]': 'width',\n '[style.strokeWidth.rem]': 'strokeWidth',\n },\n})\nexport class TuiArcChart {\n protected readonly initialized = toSignal(\n timer(0).pipe(\n tuiZonefree(),\n take(1),\n map(() => true),\n ),\n {initialValue: false},\n );\n\n public readonly value = input<readonly number[]>([]);\n public readonly size = input<TuiSizeXL>('m');\n public readonly max = input(100);\n public readonly minLabel = input('0%');\n public readonly maxLabel = input('100%');\n\n public readonly activeItemIndex = model<number>(NaN);\n\n protected get width(): number {\n return SIZE[this.size()];\n }\n\n protected get strokeWidth(): number {\n return WIDTH[this.size()];\n }\n\n protected onHovered(hovered: boolean, index: number): void {\n this.activeItemIndex.set(hovered ? index : NaN);\n }\n\n protected isInactive(index: number): boolean {\n return !Number.isNaN(this.activeItemIndex()) && index !== this.activeItemIndex();\n }\n\n protected getInset(index: number): number {\n return this.strokeWidth / 2 + index * (this.strokeWidth + GAP[this.size()]);\n }\n\n protected getDiameter(index: number): number {\n return SIZE[this.size()] - 2 * this.getInset(index);\n }\n\n protected getLength(index: number): number {\n return Math.PI * this.getDiameter(index) * ARC;\n }\n\n protected getOffset(index: number): number {\n return (\n this.getLength(index) *\n (1 - Math.min((this.value()[index] || 0) / this.max(), 1))\n );\n }\n}\n","@let data = value();\n@let min = minLabel();\n@let max = maxLabel();\n@for (_ of '-'.repeat(data.length); track $index) {\n <svg\n focusable=\"false\"\n viewBox=\"-100 -100 200 200\"\n xmlns=\"http://www.w3.org/2000/svg\"\n class=\"t-svg\"\n [style.height.rem]=\"getDiameter($index)\"\n [style.inset-block-start.rem]=\"getInset($index)\"\n [style.inset-inline.rem]=\"getInset($index)\"\n >\n <path\n d=\"M -70 70 A 100 100 0 1 1 70 70\"\n vector-effect=\"non-scaling-stroke\"\n />\n <path\n #arc\n d=\"M -70 70 A 100 100 0 1 1 70 70\"\n vector-effect=\"non-scaling-stroke\"\n class=\"t-value\"\n [class.t-value_inactive]=\"isInactive($index)\"\n [style.stroke]=\"`var(--tui-chart-categorical-${$index.toString().padStart(2, '0')})`\"\n [style.strokeDasharray.em]=\"getLength($index)\"\n [style.strokeDashoffset.em]=\"initialized() ? getOffset($index) : getLength($index)\"\n (tuiHoveredChange)=\"onHovered($event, $index)\"\n />\n </svg>\n}\n<div class=\"t-content\">\n <div class=\"t-wrapper\">\n <ng-content />\n </div>\n</div>\n<div class=\"t-percent\">\n <span>{{ min }}</span>\n <span>{{ max }}</span>\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAOA,MAA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A,CAAA,MAAA,EAAA,CAAA,CAAA;;4FAWX,WAAW,EAAA,UAAA,EAAA,CAAA;kBAbvB,SAAS;+BACI,eAAe,EAAA,OAAA,EAChB,CAAC,UAAU,CAAC,mBAGJ,uBAAuB,CAAC,MAAM,EACzC,IAAA,EAAA;AACF,wBAAA,kBAAkB,EAAE,QAAQ;AAC5B,wBAAA,mBAAmB,EAAE,OAAO;AAC5B,wBAAA,oBAAoB,EAAE,OAAO;AAC7B,wBAAA,yBAAyB,EAAE,aAAa;AAC3C,qBAAA,EAAA,QAAA,EAAA,g0CAAA,EAAA,MAAA,EAAA,CAAA,82CAAA,CAAA,EAAA;;;AEvBL;;AAEG;;;;"}
|
|
@@ -1,81 +1,41 @@
|
|
|
1
|
-
import { NgForOf, NgIf } from '@angular/common';
|
|
2
1
|
import * as i0 from '@angular/core';
|
|
3
|
-
import {
|
|
2
|
+
import { input, computed, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
4
3
|
import { CHAR_NO_BREAK_SPACE } from '@taiga-ui/cdk/constants';
|
|
5
|
-
import { TuiRepeatTimes } from '@taiga-ui/cdk/directives/repeat-times';
|
|
6
4
|
|
|
7
|
-
const TUI_ALWAYS_DASHED = () => 'dashed';
|
|
8
|
-
const TUI_ALWAYS_DOTTED = () => 'dotted';
|
|
5
|
+
const TUI_ALWAYS_DASHED = (index) => (index && 'dashed') || 'solid';
|
|
6
|
+
const TUI_ALWAYS_DOTTED = (index) => (index && 'dotted') || 'solid';
|
|
9
7
|
const TUI_ALWAYS_SOLID = () => 'solid';
|
|
10
8
|
const TUI_ALWAYS_NONE = () => 'none';
|
|
11
9
|
class TuiAxes {
|
|
12
10
|
constructor() {
|
|
13
|
-
this.
|
|
14
|
-
this.
|
|
15
|
-
this.
|
|
16
|
-
this.
|
|
17
|
-
this.
|
|
18
|
-
this.
|
|
19
|
-
this.
|
|
20
|
-
this.
|
|
21
|
-
this.
|
|
22
|
-
this.
|
|
23
|
-
this.
|
|
24
|
-
this.
|
|
25
|
-
this.
|
|
11
|
+
this.axisXLabels = input([]);
|
|
12
|
+
this.axisYInset = input(false);
|
|
13
|
+
this.axisYLabels = input([]);
|
|
14
|
+
this.axisYName = input('');
|
|
15
|
+
this.axisYSecondaryInset = input(false);
|
|
16
|
+
this.axisYSecondaryLabels = input([]);
|
|
17
|
+
this.axisYSecondaryName = input('');
|
|
18
|
+
this.centeredXLabels = input(false);
|
|
19
|
+
this.horizontalLines = input(1);
|
|
20
|
+
this.horizontalLinesHandler = input(TUI_ALWAYS_SOLID);
|
|
21
|
+
this.verticalLines = input(1);
|
|
22
|
+
this.verticalLinesHandler = input(TUI_ALWAYS_DASHED);
|
|
23
|
+
this.fallbackLabel = CHAR_NO_BREAK_SPACE;
|
|
24
|
+
this.hasXLabels = computed(() => !!this.axisXLabels().length);
|
|
25
|
+
this.hasYLabels = computed(() => (this.axisYLabels().length && !this.axisYInset()) || !!this.axisYName());
|
|
26
|
+
this.hasYSecondaryLabels = computed(() => (this.axisYSecondaryLabels().length && !this.axisYSecondaryInset()) ||
|
|
27
|
+
!!this.axisYSecondaryName());
|
|
26
28
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
get hasYLabels() {
|
|
31
|
-
return (!!this.axisYLabels.length && !this.axisYInset) || !!this.axisYName;
|
|
32
|
-
}
|
|
33
|
-
get hasYSecondaryLabels() {
|
|
34
|
-
return ((!!this.axisYSecondaryLabels.length && !this.axisYSecondaryInset) ||
|
|
35
|
-
!!this.axisYSecondaryName);
|
|
36
|
-
}
|
|
37
|
-
fallback(label) {
|
|
38
|
-
return label || CHAR_NO_BREAK_SPACE;
|
|
39
|
-
}
|
|
40
|
-
get centeredXLabels() {
|
|
41
|
-
return this.axisY === 'none';
|
|
42
|
-
}
|
|
43
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiAxes, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
44
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TuiAxes, isStandalone: true, selector: "tui-axes", inputs: { axisX: "axisX", axisXLabels: "axisXLabels", axisY: "axisY", axisYInset: "axisYInset", axisYLabels: "axisYLabels", axisYName: "axisYName", axisYSecondaryInset: "axisYSecondaryInset", axisYSecondaryLabels: "axisYSecondaryLabels", axisYSecondaryName: "axisYSecondaryName", horizontalLines: "horizontalLines", horizontalLinesHandler: "horizontalLinesHandler", verticalLines: "verticalLines", verticalLinesHandler: "verticalLinesHandler" }, host: { attributes: { "dir": "ltr" }, properties: { "class._centered": "centeredXLabels" } }, ngImport: i0, template: "<div\n *ngIf=\"hasYLabels\"\n class=\"t-side\"\n [class.t-side_padding]=\"hasXLabels\"\n>\n <div\n *ngIf=\"axisYName\"\n automation-id=\"tui-axex__axis-y-name\"\n class=\"t-name t-name_primary\"\n >\n {{ axisYName }}\n </div>\n <div\n *ngIf=\"!axisYInset\"\n class=\"t-labels-y t-labels-y_primary\"\n >\n <div\n *ngFor=\"let label of axisYLabels\"\n automation-id=\"tui-axex__axis-y-label\"\n class=\"t-label-y\"\n >\n {{ fallback(label) }}\n </div>\n </div>\n</div>\n<div class=\"t-wrapper\">\n <div\n class=\"t-grid\"\n [style.borderBottomStyle]=\"axisX\"\n [style.borderLeftStyle]=\"axisY\"\n >\n <div class=\"t-vertical\">\n <div\n *tuiRepeatTimes=\"let index of verticalLines\"\n automation-id=\"tui-axex__vertical-line\"\n class=\"t-line t-line_vertical\"\n [style.borderRightStyle]=\"verticalLinesHandler(index, verticalLines)\"\n ></div>\n </div>\n <div class=\"t-horizontal\">\n <div\n *tuiRepeatTimes=\"let index of horizontalLines\"\n automation-id=\"tui-axex__horizontal-line\"\n class=\"t-line\"\n [style.borderTopStyle]=\"horizontalLinesHandler(index, horizontalLines)\"\n ></div>\n </div>\n <div\n *ngIf=\"axisYInset\"\n class=\"t-labels-y t-labels-y_inset\"\n >\n <div\n *ngFor=\"let label of axisYLabels\"\n automation-id=\"tui-axex__axis-y-label\"\n class=\"t-label-y\"\n >\n {{ fallback(label) }}\n </div>\n </div>\n <div\n *ngIf=\"axisYSecondaryInset\"\n class=\"t-labels-y t-labels-y_inset t-labels-y_inset_secondary\"\n >\n <div\n *ngFor=\"let label of axisYSecondaryLabels\"\n automation-id=\"tui-axex__axis-y-secondary-label\"\n class=\"t-label-y\"\n >\n {{ fallback(label) }}\n </div>\n </div>\n <div class=\"t-content\">\n <ng-content />\n </div>\n </div>\n <div\n *ngIf=\"hasXLabels\"\n class=\"t-labels-x\"\n >\n <div\n *ngFor=\"let label of axisXLabels\"\n automation-id=\"tui-axex__axis-x-label\"\n class=\"t-label-x\"\n [class.t-label-x_transparent]=\"label === null\"\n >\n {{ fallback(label) }}\n </div>\n </div>\n</div>\n<div\n *ngIf=\"hasYSecondaryLabels\"\n class=\"t-side\"\n [class.t-side_padding]=\"hasXLabels\"\n>\n <div\n *ngIf=\"!axisYSecondaryInset\"\n class=\"t-labels-y t-labels-y_secondary\"\n >\n <div\n *ngFor=\"let label of axisYSecondaryLabels\"\n automation-id=\"tui-axex__axis-y-secondary-label\"\n class=\"t-label-y\"\n >\n {{ fallback(label) }}\n </div>\n </div>\n <div\n *ngIf=\"axisYSecondaryName\"\n automation-id=\"tui-axex__axis-y-secondary-name\"\n class=\"t-name\"\n >\n {{ axisYSecondaryName }}\n </div>\n</div>\n", styles: [":host{display:flex}.t-wrapper{display:flex;flex:1;block-size:100%;flex-direction:column}.t-grid{position:relative;display:flex;flex:1;justify-content:space-around;align-items:flex-end;border-width:1px;border-color:var(--tui-border-normal);isolation:isolate}.t-horizontal{position:absolute;top:0;left:0;inline-size:100%;block-size:100%;display:flex;flex-direction:column}.t-vertical{position:absolute;top:0;left:0;inline-size:100%;block-size:100%;display:flex}:host._centered .t-vertical:after{content:\"\";display:block;flex:1 0 1px}.t-line{flex:2 0 1px;box-sizing:border-box;border-width:1px;border-color:var(--tui-border-normal)}:host._centered .t-line_vertical:first-child{flex:1 0 1px;pointer-events:none}.t-side{display:flex;align-items:stretch}.t-side_padding{padding-block-end:2rem}.t-name{font:var(--tui-font-text-xs);writing-mode:tb;text-align:center;padding-block-end:.75rem;color:var(--tui-text-secondary)}.t-name_primary{transform:rotate(180deg)}.t-labels-y{display:flex;font:var(--tui-font-text-xs);flex-direction:column-reverse;justify-content:space-between;color:var(--tui-text-secondary)}.t-labels-y_primary{text-align:end;padding-inline-end:.75rem}.t-labels-y_secondary{padding-inline-start:.75rem}.t-labels-y_transparent{border-color:transparent}.t-labels-y_inset{position:absolute;top:.5625rem;left:.25rem;bottom:-.75rem;pointer-events:none}.t-labels-y_inset_secondary{left:auto;right:.25rem;text-align:end}.t-labels-x{position:relative;display:flex;font:var(--tui-font-text-xs);border-inline-end:1px solid transparent;color:var(--tui-text-secondary)}.t-label-x{block-size:.4375rem;border-inline-start:1px solid var(--tui-border-normal);flex:1;margin-block-end:1.5625rem}.t-label-x:before{content:\"\";display:block;block-size:.5625rem}.t-label-x_transparent{border-color:transparent}:host._centered .t-label-x{block-size:2rem;text-align:center;border:none;margin:0}:host:not(._centered) .t-label-x:last-child:not(:first-child){position:absolute;right:0;text-align:end;border-inline-start:none}.t-label-y:first-child{margin-block-end:-.375rem}.t-label-y:last-child{margin-block-start:-.375rem}.t-content{position:absolute;top:0;left:-1px;right:0;bottom:-1px;display:flex;align-items:flex-end}\n"], dependencies: [{ kind: "directive", type: NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: TuiRepeatTimes, selector: "[tuiRepeatTimes][tuiRepeatTimesOf]", inputs: ["tuiRepeatTimesOf"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
29
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiAxes, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
30
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: TuiAxes, isStandalone: true, selector: "tui-axes", inputs: { axisXLabels: { classPropertyName: "axisXLabels", publicName: "axisXLabels", isSignal: true, isRequired: false, transformFunction: null }, axisYInset: { classPropertyName: "axisYInset", publicName: "axisYInset", isSignal: true, isRequired: false, transformFunction: null }, axisYLabels: { classPropertyName: "axisYLabels", publicName: "axisYLabels", isSignal: true, isRequired: false, transformFunction: null }, axisYName: { classPropertyName: "axisYName", publicName: "axisYName", isSignal: true, isRequired: false, transformFunction: null }, axisYSecondaryInset: { classPropertyName: "axisYSecondaryInset", publicName: "axisYSecondaryInset", isSignal: true, isRequired: false, transformFunction: null }, axisYSecondaryLabels: { classPropertyName: "axisYSecondaryLabels", publicName: "axisYSecondaryLabels", isSignal: true, isRequired: false, transformFunction: null }, axisYSecondaryName: { classPropertyName: "axisYSecondaryName", publicName: "axisYSecondaryName", isSignal: true, isRequired: false, transformFunction: null }, centeredXLabels: { classPropertyName: "centeredXLabels", publicName: "centeredXLabels", isSignal: true, isRequired: false, transformFunction: null }, horizontalLines: { classPropertyName: "horizontalLines", publicName: "horizontalLines", isSignal: true, isRequired: false, transformFunction: null }, horizontalLinesHandler: { classPropertyName: "horizontalLinesHandler", publicName: "horizontalLinesHandler", isSignal: true, isRequired: false, transformFunction: null }, verticalLines: { classPropertyName: "verticalLines", publicName: "verticalLines", isSignal: true, isRequired: false, transformFunction: null }, verticalLinesHandler: { classPropertyName: "verticalLinesHandler", publicName: "verticalLinesHandler", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "dir": "ltr" }, properties: { "class._centered": "centeredXLabels()" } }, ngImport: i0, template: "@let ySecLabels = axisYSecondaryLabels();\n@let ySecInset = axisYSecondaryInset();\n@let yLabels = axisYLabels();\n@let yInset = axisYInset();\n@let hasXs = hasXLabels();\n\n<div\n class=\"t-side\"\n [class.t-side_padding]=\"hasXs\"\n>\n @if (hasYLabels()) {\n @let yName = axisYName();\n @if (yName) {\n <div\n automation-id=\"tui-axex__axis-y-name\"\n class=\"t-name t-name_primary\"\n >\n {{ yName }}\n </div>\n }\n @if (!yInset) {\n <div class=\"t-labels-y t-labels-y_primary\">\n @for (label of yLabels; track label) {\n <div\n automation-id=\"tui-axex__axis-y-label\"\n class=\"t-label-y\"\n >\n {{ label || fallbackLabel }}\n </div>\n }\n </div>\n }\n }\n</div>\n<div class=\"t-wrapper\">\n @let vLineFn = verticalLinesHandler();\n @let vLines = verticalLines();\n @let hLineFn = horizontalLinesHandler();\n @let hLines = horizontalLines();\n <div\n class=\"t-grid\"\n [style.border-block-end-style]=\"hLineFn(0, hLines)\"\n [style.border-inline-start-style]=\"vLineFn(0, vLines)\"\n >\n <div class=\"t-vertical\">\n @for (_ of '-'.repeat(vLines - 1); track $index) {\n <div\n automation-id=\"tui-axex__vertical-line\"\n class=\"t-line t-line_vertical\"\n [style.border-inline-end-style]=\"vLineFn($index + 1, vLines)\"\n ></div>\n }\n </div>\n <div class=\"t-horizontal\">\n @for (_ of '-'.repeat(hLines - 1); track $index) {\n <div\n automation-id=\"tui-axex__horizontal-line\"\n class=\"t-line\"\n [style.border-block-start-style]=\"hLineFn($index + 1, hLines)\"\n ></div>\n }\n </div>\n @if (yInset) {\n <div class=\"t-labels-y t-labels-y_inset\">\n @for (label of yLabels; track $index) {\n <div\n automation-id=\"tui-axex__axis-y-label\"\n class=\"t-label-y\"\n >\n {{ label || fallbackLabel }}\n </div>\n }\n </div>\n }\n @if (ySecInset) {\n <div class=\"t-labels-y t-labels-y_inset t-labels-y_inset_secondary\">\n @for (label of ySecLabels; track $index) {\n <div\n automation-id=\"tui-axex__axis-y-secondary-label\"\n class=\"t-label-y\"\n >\n {{ label || fallbackLabel }}\n </div>\n }\n </div>\n }\n <div class=\"t-content\">\n <ng-content />\n </div>\n </div>\n @if (hasXs) {\n <div class=\"t-labels-x\">\n @for (label of axisXLabels(); track $index) {\n <div\n automation-id=\"tui-axex__axis-x-label\"\n class=\"t-label-x\"\n [class.t-label-x_transparent]=\"label === null\"\n >\n {{ label || fallbackLabel }}\n </div>\n }\n </div>\n }\n</div>\n<div\n class=\"t-side\"\n [class.t-side_padding]=\"hasXs\"\n>\n @if (hasYSecondaryLabels()) {\n @if (!ySecInset) {\n <div class=\"t-labels-y t-labels-y_secondary\">\n @for (label of ySecLabels; track label) {\n <div\n automation-id=\"tui-axex__axis-y-secondary-label\"\n class=\"t-label-y\"\n >\n {{ label || fallbackLabel }}\n </div>\n }\n </div>\n }\n @let axisYSec = axisYSecondaryName();\n @if (axisYSec) {\n <div\n automation-id=\"tui-axex__axis-y-secondary-name\"\n class=\"t-name\"\n >\n {{ axisYSec }}\n </div>\n }\n }\n</div>\n", styles: [":host{display:grid;grid-template-columns:auto 1fr auto;grid-template-rows:1fr auto;block-size:100%}.t-wrapper{display:grid;grid-template-rows:1fr auto;grid-row:span 2}.t-grid{position:relative;display:flex;flex:1;justify-content:space-around;align-items:flex-end;border-width:1px;border-color:var(--tui-border-normal);isolation:isolate;grid-row:1}.t-horizontal{position:absolute;top:0;left:0;inline-size:100%;block-size:100%;display:flex;flex-direction:column}.t-vertical{position:absolute;top:0;left:0;inline-size:100%;block-size:100%;display:flex}:host._centered .t-vertical:after{content:\"\";display:block;flex:1 0 1px}.t-line{flex:2 0 1px;box-sizing:border-box;border-width:1px;border-color:var(--tui-border-normal)}:host._centered .t-line_vertical:first-child{flex:1 0 1px;pointer-events:none}.t-side{display:flex;align-items:stretch}.t-side_padding{padding-block-end:2rem}.t-name{font:var(--tui-font-body-xs);writing-mode:tb;text-align:center;padding-block-end:.75rem;color:var(--tui-text-secondary)}.t-name_primary{transform:rotate(180deg)}.t-labels-y{display:flex;font:var(--tui-font-body-xs);flex-direction:column-reverse;justify-content:space-between;color:var(--tui-text-secondary)}.t-labels-y_primary{text-align:end;padding-inline-end:.75rem}.t-labels-y_secondary{padding-inline-start:.75rem}.t-labels-y_transparent{border-color:transparent}.t-labels-y_inset{position:absolute;inset-block:.5625rem -.75rem;inset-inline:.25rem auto;pointer-events:none}.t-labels-y_inset_secondary{inset-inline:auto .25rem;text-align:end}.t-labels-x{position:relative;display:flex;font:var(--tui-font-body-xs);border-inline-end:1px solid transparent;color:var(--tui-text-secondary)}.t-label-x{flex:1}.t-label-x:before{content:\"\";display:block;block-size:.5625rem;border-inline-start:1px solid var(--tui-border-normal)}.t-label-x:last-of-type:before{border:none}.t-label-x_transparent{border-color:transparent}:host._centered .t-label-x{block-size:2rem;text-align:center;margin:0}:host._centered .t-label-x:before{border:none}:host:not(._centered) .t-label-x:last-child:not(:first-child){position:absolute;inset-inline-end:0;text-align:end;border-inline-start:none}.t-label-y:first-child{margin-block-end:-.375rem}.t-label-y:last-child{margin-block-start:-.375rem}.t-content{position:absolute;display:flex;inset-block:0 -1px;inset-inline:-1px 0;align-items:flex-end}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
45
31
|
}
|
|
46
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
32
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiAxes, decorators: [{
|
|
47
33
|
type: Component,
|
|
48
|
-
args: [{
|
|
34
|
+
args: [{ selector: 'tui-axes', changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
49
35
|
dir: 'ltr',
|
|
50
|
-
'[class._centered]': 'centeredXLabels',
|
|
51
|
-
}, template: "<div\n
|
|
52
|
-
}]
|
|
53
|
-
type: Input
|
|
54
|
-
}], axisXLabels: [{
|
|
55
|
-
type: Input
|
|
56
|
-
}], axisY: [{
|
|
57
|
-
type: Input
|
|
58
|
-
}], axisYInset: [{
|
|
59
|
-
type: Input
|
|
60
|
-
}], axisYLabels: [{
|
|
61
|
-
type: Input
|
|
62
|
-
}], axisYName: [{
|
|
63
|
-
type: Input
|
|
64
|
-
}], axisYSecondaryInset: [{
|
|
65
|
-
type: Input
|
|
66
|
-
}], axisYSecondaryLabels: [{
|
|
67
|
-
type: Input
|
|
68
|
-
}], axisYSecondaryName: [{
|
|
69
|
-
type: Input
|
|
70
|
-
}], horizontalLines: [{
|
|
71
|
-
type: Input
|
|
72
|
-
}], horizontalLinesHandler: [{
|
|
73
|
-
type: Input
|
|
74
|
-
}], verticalLines: [{
|
|
75
|
-
type: Input
|
|
76
|
-
}], verticalLinesHandler: [{
|
|
77
|
-
type: Input
|
|
78
|
-
}] } });
|
|
36
|
+
'[class._centered]': 'centeredXLabels()',
|
|
37
|
+
}, template: "@let ySecLabels = axisYSecondaryLabels();\n@let ySecInset = axisYSecondaryInset();\n@let yLabels = axisYLabels();\n@let yInset = axisYInset();\n@let hasXs = hasXLabels();\n\n<div\n class=\"t-side\"\n [class.t-side_padding]=\"hasXs\"\n>\n @if (hasYLabels()) {\n @let yName = axisYName();\n @if (yName) {\n <div\n automation-id=\"tui-axex__axis-y-name\"\n class=\"t-name t-name_primary\"\n >\n {{ yName }}\n </div>\n }\n @if (!yInset) {\n <div class=\"t-labels-y t-labels-y_primary\">\n @for (label of yLabels; track label) {\n <div\n automation-id=\"tui-axex__axis-y-label\"\n class=\"t-label-y\"\n >\n {{ label || fallbackLabel }}\n </div>\n }\n </div>\n }\n }\n</div>\n<div class=\"t-wrapper\">\n @let vLineFn = verticalLinesHandler();\n @let vLines = verticalLines();\n @let hLineFn = horizontalLinesHandler();\n @let hLines = horizontalLines();\n <div\n class=\"t-grid\"\n [style.border-block-end-style]=\"hLineFn(0, hLines)\"\n [style.border-inline-start-style]=\"vLineFn(0, vLines)\"\n >\n <div class=\"t-vertical\">\n @for (_ of '-'.repeat(vLines - 1); track $index) {\n <div\n automation-id=\"tui-axex__vertical-line\"\n class=\"t-line t-line_vertical\"\n [style.border-inline-end-style]=\"vLineFn($index + 1, vLines)\"\n ></div>\n }\n </div>\n <div class=\"t-horizontal\">\n @for (_ of '-'.repeat(hLines - 1); track $index) {\n <div\n automation-id=\"tui-axex__horizontal-line\"\n class=\"t-line\"\n [style.border-block-start-style]=\"hLineFn($index + 1, hLines)\"\n ></div>\n }\n </div>\n @if (yInset) {\n <div class=\"t-labels-y t-labels-y_inset\">\n @for (label of yLabels; track $index) {\n <div\n automation-id=\"tui-axex__axis-y-label\"\n class=\"t-label-y\"\n >\n {{ label || fallbackLabel }}\n </div>\n }\n </div>\n }\n @if (ySecInset) {\n <div class=\"t-labels-y t-labels-y_inset t-labels-y_inset_secondary\">\n @for (label of ySecLabels; track $index) {\n <div\n automation-id=\"tui-axex__axis-y-secondary-label\"\n class=\"t-label-y\"\n >\n {{ label || fallbackLabel }}\n </div>\n }\n </div>\n }\n <div class=\"t-content\">\n <ng-content />\n </div>\n </div>\n @if (hasXs) {\n <div class=\"t-labels-x\">\n @for (label of axisXLabels(); track $index) {\n <div\n automation-id=\"tui-axex__axis-x-label\"\n class=\"t-label-x\"\n [class.t-label-x_transparent]=\"label === null\"\n >\n {{ label || fallbackLabel }}\n </div>\n }\n </div>\n }\n</div>\n<div\n class=\"t-side\"\n [class.t-side_padding]=\"hasXs\"\n>\n @if (hasYSecondaryLabels()) {\n @if (!ySecInset) {\n <div class=\"t-labels-y t-labels-y_secondary\">\n @for (label of ySecLabels; track label) {\n <div\n automation-id=\"tui-axex__axis-y-secondary-label\"\n class=\"t-label-y\"\n >\n {{ label || fallbackLabel }}\n </div>\n }\n </div>\n }\n @let axisYSec = axisYSecondaryName();\n @if (axisYSec) {\n <div\n automation-id=\"tui-axex__axis-y-secondary-name\"\n class=\"t-name\"\n >\n {{ axisYSec }}\n </div>\n }\n }\n</div>\n", styles: [":host{display:grid;grid-template-columns:auto 1fr auto;grid-template-rows:1fr auto;block-size:100%}.t-wrapper{display:grid;grid-template-rows:1fr auto;grid-row:span 2}.t-grid{position:relative;display:flex;flex:1;justify-content:space-around;align-items:flex-end;border-width:1px;border-color:var(--tui-border-normal);isolation:isolate;grid-row:1}.t-horizontal{position:absolute;top:0;left:0;inline-size:100%;block-size:100%;display:flex;flex-direction:column}.t-vertical{position:absolute;top:0;left:0;inline-size:100%;block-size:100%;display:flex}:host._centered .t-vertical:after{content:\"\";display:block;flex:1 0 1px}.t-line{flex:2 0 1px;box-sizing:border-box;border-width:1px;border-color:var(--tui-border-normal)}:host._centered .t-line_vertical:first-child{flex:1 0 1px;pointer-events:none}.t-side{display:flex;align-items:stretch}.t-side_padding{padding-block-end:2rem}.t-name{font:var(--tui-font-body-xs);writing-mode:tb;text-align:center;padding-block-end:.75rem;color:var(--tui-text-secondary)}.t-name_primary{transform:rotate(180deg)}.t-labels-y{display:flex;font:var(--tui-font-body-xs);flex-direction:column-reverse;justify-content:space-between;color:var(--tui-text-secondary)}.t-labels-y_primary{text-align:end;padding-inline-end:.75rem}.t-labels-y_secondary{padding-inline-start:.75rem}.t-labels-y_transparent{border-color:transparent}.t-labels-y_inset{position:absolute;inset-block:.5625rem -.75rem;inset-inline:.25rem auto;pointer-events:none}.t-labels-y_inset_secondary{inset-inline:auto .25rem;text-align:end}.t-labels-x{position:relative;display:flex;font:var(--tui-font-body-xs);border-inline-end:1px solid transparent;color:var(--tui-text-secondary)}.t-label-x{flex:1}.t-label-x:before{content:\"\";display:block;block-size:.5625rem;border-inline-start:1px solid var(--tui-border-normal)}.t-label-x:last-of-type:before{border:none}.t-label-x_transparent{border-color:transparent}:host._centered .t-label-x{block-size:2rem;text-align:center;margin:0}:host._centered .t-label-x:before{border:none}:host:not(._centered) .t-label-x:last-child:not(:first-child){position:absolute;inset-inline-end:0;text-align:end;border-inline-start:none}.t-label-y:first-child{margin-block-end:-.375rem}.t-label-y:last-child{margin-block-start:-.375rem}.t-content{position:absolute;display:flex;inset-block:0 -1px;inset-inline:-1px 0;align-items:flex-end}\n"] }]
|
|
38
|
+
}] });
|
|
79
39
|
|
|
80
40
|
/**
|
|
81
41
|
* Generated bundle index. Do not edit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-addon-charts-components-axes.mjs","sources":["../../../projects/addon-charts/components/axes/axes.component.ts","../../../projects/addon-charts/components/axes/axes.template.html","../../../projects/addon-charts/components/axes/taiga-ui-addon-charts-components-axes.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"taiga-ui-addon-charts-components-axes.mjs","sources":["../../../projects/addon-charts/components/axes/axes.component.ts","../../../projects/addon-charts/components/axes/axes.template.html","../../../projects/addon-charts/components/axes/taiga-ui-addon-charts-components-axes.ts"],"sourcesContent":["import {ChangeDetectionStrategy, Component, computed, input} from '@angular/core';\nimport {type TuiLineHandler} from '@taiga-ui/addon-charts/types';\nimport {CHAR_NO_BREAK_SPACE} from '@taiga-ui/cdk/constants';\n\nexport const TUI_ALWAYS_DASHED: TuiLineHandler = (index) =>\n (index && 'dashed') || 'solid';\nexport const TUI_ALWAYS_DOTTED: TuiLineHandler = (index) =>\n (index && 'dotted') || 'solid';\nexport const TUI_ALWAYS_SOLID: TuiLineHandler = () => 'solid';\nexport const TUI_ALWAYS_NONE: TuiLineHandler = () => 'none';\n\n@Component({\n selector: 'tui-axes',\n templateUrl: './axes.template.html',\n styleUrl: './axes.style.less',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n dir: 'ltr',\n '[class._centered]': 'centeredXLabels()',\n },\n})\nexport class TuiAxes {\n public readonly axisXLabels = input<ReadonlyArray<string | null>>([]);\n public readonly axisYInset = input(false);\n public readonly axisYLabels = input<readonly string[]>([]);\n public readonly axisYName = input('');\n public readonly axisYSecondaryInset = input(false);\n public readonly axisYSecondaryLabels = input<readonly string[]>([]);\n public readonly axisYSecondaryName = input('');\n public readonly centeredXLabels = input(false);\n public readonly horizontalLines = input(1);\n public readonly horizontalLinesHandler = input<TuiLineHandler>(TUI_ALWAYS_SOLID);\n public readonly verticalLines = input(1);\n public readonly verticalLinesHandler = input<TuiLineHandler>(TUI_ALWAYS_DASHED);\n\n public readonly fallbackLabel = CHAR_NO_BREAK_SPACE;\n\n public readonly hasXLabels = computed(() => !!this.axisXLabels().length);\n\n public readonly hasYLabels = computed(\n () => (this.axisYLabels().length && !this.axisYInset()) || !!this.axisYName(),\n );\n\n public readonly hasYSecondaryLabels = computed(\n () =>\n (this.axisYSecondaryLabels().length && !this.axisYSecondaryInset()) ||\n !!this.axisYSecondaryName(),\n );\n}\n","@let ySecLabels = axisYSecondaryLabels();\n@let ySecInset = axisYSecondaryInset();\n@let yLabels = axisYLabels();\n@let yInset = axisYInset();\n@let hasXs = hasXLabels();\n\n<div\n class=\"t-side\"\n [class.t-side_padding]=\"hasXs\"\n>\n @if (hasYLabels()) {\n @let yName = axisYName();\n @if (yName) {\n <div\n automation-id=\"tui-axex__axis-y-name\"\n class=\"t-name t-name_primary\"\n >\n {{ yName }}\n </div>\n }\n @if (!yInset) {\n <div class=\"t-labels-y t-labels-y_primary\">\n @for (label of yLabels; track label) {\n <div\n automation-id=\"tui-axex__axis-y-label\"\n class=\"t-label-y\"\n >\n {{ label || fallbackLabel }}\n </div>\n }\n </div>\n }\n }\n</div>\n<div class=\"t-wrapper\">\n @let vLineFn = verticalLinesHandler();\n @let vLines = verticalLines();\n @let hLineFn = horizontalLinesHandler();\n @let hLines = horizontalLines();\n <div\n class=\"t-grid\"\n [style.border-block-end-style]=\"hLineFn(0, hLines)\"\n [style.border-inline-start-style]=\"vLineFn(0, vLines)\"\n >\n <div class=\"t-vertical\">\n @for (_ of '-'.repeat(vLines - 1); track $index) {\n <div\n automation-id=\"tui-axex__vertical-line\"\n class=\"t-line t-line_vertical\"\n [style.border-inline-end-style]=\"vLineFn($index + 1, vLines)\"\n ></div>\n }\n </div>\n <div class=\"t-horizontal\">\n @for (_ of '-'.repeat(hLines - 1); track $index) {\n <div\n automation-id=\"tui-axex__horizontal-line\"\n class=\"t-line\"\n [style.border-block-start-style]=\"hLineFn($index + 1, hLines)\"\n ></div>\n }\n </div>\n @if (yInset) {\n <div class=\"t-labels-y t-labels-y_inset\">\n @for (label of yLabels; track $index) {\n <div\n automation-id=\"tui-axex__axis-y-label\"\n class=\"t-label-y\"\n >\n {{ label || fallbackLabel }}\n </div>\n }\n </div>\n }\n @if (ySecInset) {\n <div class=\"t-labels-y t-labels-y_inset t-labels-y_inset_secondary\">\n @for (label of ySecLabels; track $index) {\n <div\n automation-id=\"tui-axex__axis-y-secondary-label\"\n class=\"t-label-y\"\n >\n {{ label || fallbackLabel }}\n </div>\n }\n </div>\n }\n <div class=\"t-content\">\n <ng-content />\n </div>\n </div>\n @if (hasXs) {\n <div class=\"t-labels-x\">\n @for (label of axisXLabels(); track $index) {\n <div\n automation-id=\"tui-axex__axis-x-label\"\n class=\"t-label-x\"\n [class.t-label-x_transparent]=\"label === null\"\n >\n {{ label || fallbackLabel }}\n </div>\n }\n </div>\n }\n</div>\n<div\n class=\"t-side\"\n [class.t-side_padding]=\"hasXs\"\n>\n @if (hasYSecondaryLabels()) {\n @if (!ySecInset) {\n <div class=\"t-labels-y t-labels-y_secondary\">\n @for (label of ySecLabels; track label) {\n <div\n automation-id=\"tui-axex__axis-y-secondary-label\"\n class=\"t-label-y\"\n >\n {{ label || fallbackLabel }}\n </div>\n }\n </div>\n }\n @let axisYSec = axisYSecondaryName();\n @if (axisYSec) {\n <div\n automation-id=\"tui-axex__axis-y-secondary-name\"\n class=\"t-name\"\n >\n {{ axisYSec }}\n </div>\n }\n }\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAIa,MAAA,iBAAiB,GAAmB,CAAC,KAAK,KACnD,CAAC,KAAK,IAAI,QAAQ,KAAK;AACd,MAAA,iBAAiB,GAAmB,CAAC,KAAK,KACnD,CAAC,KAAK,IAAI,QAAQ,KAAK;MACd,gBAAgB,GAAmB,MAAM;MACzC,eAAe,GAAmB,MAAM;MAYxC,OAAO,CAAA;AAVpB,IAAA,WAAA,GAAA;AAWoB,QAAA,IAAA,CAAA,WAAW,GAAG,KAAK,CAA+B,EAAE,CAAC;AAC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AO,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAAP,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,OAAO,i8DCrBpB,gxIAoIA,EAAA,MAAA,EAAA,CAAA,6zEAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;4FD/Ga,OAAO,EAAA,UAAA,EAAA,CAAA;kBAVnB,SAAS;AACI,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,UAAU,EAGH,eAAA,EAAA,uBAAuB,CAAC,MAAM,EACzC,IAAA,EAAA;AACF,wBAAA,GAAG,EAAE,KAAK;AACV,wBAAA,mBAAmB,EAAE,mBAAmB;AAC3C,qBAAA,EAAA,QAAA,EAAA,gxIAAA,EAAA,MAAA,EAAA,CAAA,6zEAAA,CAAA,EAAA;;;AEnBL;;AAEG;;;;"}
|
|
@@ -1,79 +1,49 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AsyncPipe, NgForOf } from '@angular/common';
|
|
1
|
+
import { AsyncPipe } from '@angular/common';
|
|
3
2
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { inject,
|
|
3
|
+
import { inject, computed, viewChildren, input, output, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
5
4
|
import { TuiBarSet } from '@taiga-ui/addon-charts/components/bar-set';
|
|
6
|
-
import {
|
|
5
|
+
import { TuiChartHint } from '@taiga-ui/addon-charts/components/chart-hint';
|
|
7
6
|
import { TuiMapperPipe } from '@taiga-ui/cdk/pipes/mapper';
|
|
8
|
-
import { tuiInjectId } from '@taiga-ui/cdk/services';
|
|
9
7
|
import { tuiSum } from '@taiga-ui/cdk/utils/math';
|
|
10
|
-
import {
|
|
11
|
-
import * as i1 from '@taiga-ui/core/
|
|
12
|
-
import {
|
|
8
|
+
import { tuiGenerateId } from '@taiga-ui/cdk/utils/miscellaneous';
|
|
9
|
+
import * as i1 from '@taiga-ui/core/portals/hint';
|
|
10
|
+
import { TuiHintHover, tuiHintOptionsProvider, TuiHint } from '@taiga-ui/core/portals/hint';
|
|
13
11
|
|
|
14
12
|
class TuiBarChart {
|
|
15
13
|
constructor() {
|
|
16
|
-
this.hintOptions = inject(
|
|
17
|
-
this.autoId =
|
|
18
|
-
this.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
this.
|
|
14
|
+
this.hintOptions = inject(TuiChartHint, { optional: true });
|
|
15
|
+
this.autoId = tuiGenerateId();
|
|
16
|
+
this.getMax = computed(() => this.collapsed()
|
|
17
|
+
? Math.max(
|
|
18
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
19
|
+
...this.value().reduce((result, next) => result.map((value, index) => value + (next[index] || 0))))
|
|
20
|
+
: this.value().reduce((max, value) => Math.max(...value, max), 0));
|
|
21
|
+
this.transposed = computed(() => this.value().reduce((result, next) => next.map((_, index) => [...(result[index] || []), next[index] || 0]), []));
|
|
22
|
+
this.drivers = viewChildren(TuiHintHover);
|
|
23
|
+
this.value = input([]);
|
|
24
|
+
this.max = input(NaN);
|
|
25
|
+
this.size = input('m');
|
|
26
|
+
this.collapsed = input(false);
|
|
27
|
+
this.tapColumn = output();
|
|
28
|
+
this.computedMax = computed(() => this.max() || this.getMax());
|
|
24
29
|
this.percentMapper = (set, collapsed, max) => (100 * (collapsed ? tuiSum(...set) : Math.max(...set))) / max;
|
|
25
30
|
}
|
|
26
|
-
get transposed() {
|
|
27
|
-
return this.transpose(this.value);
|
|
28
|
-
}
|
|
29
|
-
get computedMax() {
|
|
30
|
-
return this.max || this.getMax(this.value, this.collapsed);
|
|
31
|
-
}
|
|
32
31
|
get hintContent() {
|
|
33
|
-
return this.hintOptions?.content || '';
|
|
32
|
+
return this.hintOptions?.content() || '';
|
|
34
33
|
}
|
|
35
34
|
get hintAppearance() {
|
|
36
|
-
return this.hintOptions?.appearance || '';
|
|
35
|
+
return this.hintOptions?.appearance() || '';
|
|
37
36
|
}
|
|
38
37
|
getHintId(index) {
|
|
39
38
|
return `${this.autoId}_${index}`;
|
|
40
39
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
getMax(values, collapsed) {
|
|
45
|
-
return collapsed
|
|
46
|
-
? Math.max(
|
|
47
|
-
// eslint-disable-next-line no-restricted-syntax
|
|
48
|
-
...values.reduce((result, next) => result.map((value, index) => value + (next[index] || 0))))
|
|
49
|
-
: values.reduce((max, value) => Math.max(...value, max), 0);
|
|
50
|
-
}
|
|
51
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiBarChart, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
52
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TuiBarChart, isStandalone: true, selector: "tui-bar-chart", inputs: { value: "value", max: "max", size: "size", collapsed: "collapsed" }, outputs: { tapColumn: "tapColumn" }, viewQueries: [{ propertyName: "drivers", predicate: TuiHintHover, descendants: true }], ngImport: i0, template: "<div\n *ngFor=\"let set of transposed; let index = index\"\n class=\"t-wrapper\"\n [class.t-wrapper_hoverable]=\"!!hintContent\"\n [class.t-wrapper_hovered]=\"drivers.get(index) | async\"\n [tuiHint]=\"hintContent\"\n [tuiHintAppearance]=\"hintAppearance\"\n [tuiHintContext]=\"{$implicit: index}\"\n [tuiHintDescribe]=\"getHintId(index)\"\n [tuiHintHost]=\"hintHost\"\n (click)=\"tapColumn.emit(index)\"\n (keydown.enter)=\"tapColumn.emit(index)\"\n (mouseenter.once)=\"(0)\"\n>\n <div\n class=\"t-container\"\n [style.height.%]=\"set | tuiMapper: percentMapper : collapsed : computedMax\"\n >\n <div\n #hintHost\n class=\"t-host\"\n ></div>\n <tui-bar-set\n class=\"t-set\"\n [collapsed]=\"collapsed\"\n [id]=\"getHintId(index)\"\n [size]=\"size\"\n [tabIndex]=\"hintContent ? 0 : -1\"\n [value]=\"set\"\n />\n </div>\n</div>\n", styles: [":host{display:flex;flex:1;block-size:100%}.t-wrapper{transition-property:background-color;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;position:relative;display:flex;flex:1;align-items:flex-end;justify-content:center;block-size:100%}.t-wrapper_hoverable{cursor:pointer}.t-wrapper_hoverable:hover,.t-wrapper_hoverable.t-wrapper_hovered{background-color:#0000000d}.t-container{flex:1}.t-host{position:absolute;left:50%;right:50%}.t-set{border-radius:var(--tui-radius-m);pointer-events:none;outline:none}.t-set:focus{box-shadow:0 0 0 2px var(--tui-border-focus)}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "directive", type: NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: TuiBarSet, selector: "tui-bar-set", inputs: ["value", "size", "collapsed"] }, { kind: "directive", type: i1.TuiHintDirective, selector: "[tuiHint]:not(ng-container):not(ng-template)", inputs: ["tuiHintContext", "tuiHintAppearance", "tuiHint"], outputs: ["tuiHintVisible"] }, { kind: "directive", type: i1.TuiHintDescribe, selector: "[tuiHintDescribe]", inputs: ["tuiHintDescribe"] }, { kind: "directive", type: i1.TuiHintHost, selector: "[tuiHint][tuiHintHost]", inputs: ["tuiHintHost"] }, { kind: "pipe", type: TuiMapperPipe, name: "tuiMapper" }], viewProviders: [tuiHintOptionsProvider({ direction: 'top' })], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
40
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiBarChart, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
41
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: TuiBarChart, isStandalone: true, selector: "tui-bar-chart", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, collapsed: { classPropertyName: "collapsed", publicName: "collapsed", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { tapColumn: "tapColumn" }, viewQueries: [{ propertyName: "drivers", predicate: TuiHintHover, descendants: true, isSignal: true }], ngImport: i0, template: "@for (set of transposed(); track $index) {\n <div\n class=\"t-wrapper\"\n [class.t-wrapper_hoverable]=\"!!hintContent\"\n [class.t-wrapper_hovered]=\"drivers()[$index] | async\"\n [tuiHint]=\"hintContent\"\n [tuiHintAppearance]=\"hintAppearance\"\n [tuiHintContext]=\"{$implicit: $index}\"\n [tuiHintDescribe]=\"getHintId($index)\"\n [tuiHintHost]=\"hintHost\"\n (click)=\"tapColumn.emit($index)\"\n (keydown.enter)=\"tapColumn.emit($index)\"\n (mouseenter.once)=\"(0)\"\n >\n <div\n class=\"t-container\"\n [style.height.%]=\"set | tuiMapper: percentMapper : collapsed() : computedMax()\"\n >\n <div\n #hintHost\n class=\"t-host\"\n ></div>\n <tui-bar-set\n class=\"t-set\"\n [collapsed]=\"collapsed()\"\n [id]=\"getHintId($index)\"\n [size]=\"size()\"\n [tabIndex]=\"hintContent ? 0 : -1\"\n [value]=\"set\"\n />\n </div>\n </div>\n}\n", styles: [":host{display:flex;flex:1;block-size:100%}.t-wrapper{transition-property:background-color;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;position:relative;display:flex;flex:1;align-items:flex-end;justify-content:center;block-size:100%}.t-wrapper_hoverable{cursor:pointer}.t-wrapper_hoverable:hover,.t-wrapper_hoverable.t-wrapper_hovered{background-color:#0000000d}.t-container{flex:1}.t-host{position:absolute;inset-inline:50%}.t-set{border-radius:var(--tui-radius-m);pointer-events:none;outline:none}.t-set:focus{box-shadow:0 0 0 2px var(--tui-border-focus)}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "component", type: TuiBarSet, selector: "tui-bar-set", inputs: ["value", "size", "collapsed"] }, { kind: "directive", type: i1.TuiHintDirective, selector: "[tuiHint]:not(ng-container):not(ng-template)", inputs: ["tuiHint", "tuiHintContext", "tuiHintAppearance"], outputs: ["tuiHintVisible"] }, { kind: "directive", type: i1.TuiHintDescribe, selector: "[tuiHintDescribe]", inputs: ["tuiHintDescribe"] }, { kind: "directive", type: i1.TuiHintHost, selector: "[tuiHint][tuiHintHost]", inputs: ["tuiHintHost"] }, { kind: "pipe", type: TuiMapperPipe, name: "tuiMapper" }], viewProviders: [tuiHintOptionsProvider({ direction: 'top' })], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
53
42
|
}
|
|
54
|
-
|
|
55
|
-
tuiPure
|
|
56
|
-
], TuiBarChart.prototype, "transpose", null);
|
|
57
|
-
__decorate([
|
|
58
|
-
tuiPure
|
|
59
|
-
], TuiBarChart.prototype, "getMax", null);
|
|
60
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiBarChart, decorators: [{
|
|
43
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TuiBarChart, decorators: [{
|
|
61
44
|
type: Component,
|
|
62
|
-
args: [{
|
|
63
|
-
}]
|
|
64
|
-
type: ViewChildren,
|
|
65
|
-
args: [TuiHintHover]
|
|
66
|
-
}], value: [{
|
|
67
|
-
type: Input
|
|
68
|
-
}], max: [{
|
|
69
|
-
type: Input
|
|
70
|
-
}], size: [{
|
|
71
|
-
type: Input
|
|
72
|
-
}], collapsed: [{
|
|
73
|
-
type: Input
|
|
74
|
-
}], tapColumn: [{
|
|
75
|
-
type: Output
|
|
76
|
-
}], transpose: [], getMax: [] } });
|
|
45
|
+
args: [{ selector: 'tui-bar-chart', imports: [AsyncPipe, TuiBarSet, TuiHint, TuiMapperPipe], changeDetection: ChangeDetectionStrategy.OnPush, viewProviders: [tuiHintOptionsProvider({ direction: 'top' })], template: "@for (set of transposed(); track $index) {\n <div\n class=\"t-wrapper\"\n [class.t-wrapper_hoverable]=\"!!hintContent\"\n [class.t-wrapper_hovered]=\"drivers()[$index] | async\"\n [tuiHint]=\"hintContent\"\n [tuiHintAppearance]=\"hintAppearance\"\n [tuiHintContext]=\"{$implicit: $index}\"\n [tuiHintDescribe]=\"getHintId($index)\"\n [tuiHintHost]=\"hintHost\"\n (click)=\"tapColumn.emit($index)\"\n (keydown.enter)=\"tapColumn.emit($index)\"\n (mouseenter.once)=\"(0)\"\n >\n <div\n class=\"t-container\"\n [style.height.%]=\"set | tuiMapper: percentMapper : collapsed() : computedMax()\"\n >\n <div\n #hintHost\n class=\"t-host\"\n ></div>\n <tui-bar-set\n class=\"t-set\"\n [collapsed]=\"collapsed()\"\n [id]=\"getHintId($index)\"\n [size]=\"size()\"\n [tabIndex]=\"hintContent ? 0 : -1\"\n [value]=\"set\"\n />\n </div>\n </div>\n}\n", styles: [":host{display:flex;flex:1;block-size:100%}.t-wrapper{transition-property:background-color;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;position:relative;display:flex;flex:1;align-items:flex-end;justify-content:center;block-size:100%}.t-wrapper_hoverable{cursor:pointer}.t-wrapper_hoverable:hover,.t-wrapper_hoverable.t-wrapper_hovered{background-color:#0000000d}.t-container{flex:1}.t-host{position:absolute;inset-inline:50%}.t-set{border-radius:var(--tui-radius-m);pointer-events:none;outline:none}.t-set:focus{box-shadow:0 0 0 2px var(--tui-border-focus)}\n"] }]
|
|
46
|
+
}] });
|
|
77
47
|
|
|
78
48
|
/**
|
|
79
49
|
* Generated bundle index. Do not edit.
|