@taiga-ui/addon-charts 2.44.0 → 2.45.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/bundles/taiga-ui-addon-charts-components-arc-chart.umd.js +41 -6
- package/bundles/taiga-ui-addon-charts-components-arc-chart.umd.js.map +1 -1
- package/bundles/taiga-ui-addon-charts-components-arc-chart.umd.min.js +2 -2
- package/bundles/taiga-ui-addon-charts-components-arc-chart.umd.min.js.map +1 -1
- package/bundles/taiga-ui-addon-charts-components-line-chart.umd.js +1 -1
- package/bundles/taiga-ui-addon-charts-components-line-chart.umd.min.js +1 -1
- package/bundles/taiga-ui-addon-charts-components-line-chart.umd.min.js.map +1 -1
- package/components/arc-chart/arc-chart.component.d.ts +7 -1
- package/components/arc-chart/taiga-ui-addon-charts-components-arc-chart.metadata.json +1 -1
- package/components/line-chart/taiga-ui-addon-charts-components-line-chart.metadata.json +1 -1
- package/esm2015/components/arc-chart/arc-chart.component.js +33 -5
- package/esm2015/components/line-chart/line-chart.component.js +1 -1
- package/esm5/components/arc-chart/arc-chart.component.js +43 -6
- package/esm5/components/line-chart/line-chart.component.js +1 -1
- package/fesm2015/taiga-ui-addon-charts-components-arc-chart.js +32 -4
- package/fesm2015/taiga-ui-addon-charts-components-arc-chart.js.map +1 -1
- package/fesm2015/taiga-ui-addon-charts-components-line-chart.js +1 -1
- package/fesm5/taiga-ui-addon-charts-components-arc-chart.js +42 -5
- package/fesm5/taiga-ui-addon-charts-components-arc-chart.js.map +1 -1
- package/fesm5/taiga-ui-addon-charts-components-line-chart.js +1 -1
- package/package.json +3 -3
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { __decorate, __param } from "tslib";
|
|
2
|
-
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, HostBinding, Inject, Input, } from '@angular/core';
|
|
1
|
+
import { __decorate, __param, __read, __spread } from "tslib";
|
|
2
|
+
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, HostBinding, Inject, Input, Output, QueryList, ViewChildren, } from '@angular/core';
|
|
3
3
|
import { DomSanitizer, SafeValue } from '@angular/platform-browser';
|
|
4
|
-
import { tuiDefaultProp } from '@taiga-ui/cdk';
|
|
4
|
+
import { tuiDefaultProp, typedFromEvent } from '@taiga-ui/cdk';
|
|
5
|
+
import { merge, ReplaySubject } from 'rxjs';
|
|
6
|
+
import { mapTo, startWith, switchMap, tap } from 'rxjs/operators';
|
|
5
7
|
// 3/4 with 1% safety offset
|
|
6
8
|
var ARC = 0.76;
|
|
7
9
|
var SIZE = {
|
|
@@ -23,11 +25,18 @@ var TuiArcChartComponent = /** @class */ (function () {
|
|
|
23
25
|
function TuiArcChartComponent(sanitizer, changeDetectorRef) {
|
|
24
26
|
var _this = this;
|
|
25
27
|
this.sanitizer = sanitizer;
|
|
28
|
+
this.arcs$ = new ReplaySubject(1);
|
|
26
29
|
this.value = [];
|
|
27
30
|
this.size = 'm';
|
|
28
31
|
this.max = 100;
|
|
29
32
|
this.minLabel = '0%';
|
|
30
33
|
this.maxLabel = '100%';
|
|
34
|
+
this.activeItemIndex = NaN;
|
|
35
|
+
this.activeItemIndexChange = this.arcs$.pipe(switchMap(function (arcs) {
|
|
36
|
+
return arcs.changes.pipe(startWith(null), switchMap(function () { return merge.apply(void 0, __spread(arcsToIndex(arcs))); }));
|
|
37
|
+
}), tap(function (index) {
|
|
38
|
+
_this.activeItemIndex = index;
|
|
39
|
+
}));
|
|
31
40
|
this.initialized = false;
|
|
32
41
|
// So initial animation works
|
|
33
42
|
setTimeout(function () {
|
|
@@ -35,6 +44,13 @@ var TuiArcChartComponent = /** @class */ (function () {
|
|
|
35
44
|
changeDetectorRef.markForCheck();
|
|
36
45
|
});
|
|
37
46
|
}
|
|
47
|
+
Object.defineProperty(TuiArcChartComponent.prototype, "arcs", {
|
|
48
|
+
set: function (arcs) {
|
|
49
|
+
this.arcs$.next(arcs);
|
|
50
|
+
},
|
|
51
|
+
enumerable: true,
|
|
52
|
+
configurable: true
|
|
53
|
+
});
|
|
38
54
|
Object.defineProperty(TuiArcChartComponent.prototype, "width", {
|
|
39
55
|
get: function () {
|
|
40
56
|
return SIZE[this.size];
|
|
@@ -49,6 +65,9 @@ var TuiArcChartComponent = /** @class */ (function () {
|
|
|
49
65
|
enumerable: true,
|
|
50
66
|
configurable: true
|
|
51
67
|
});
|
|
68
|
+
TuiArcChartComponent.prototype.isInactive = function (index) {
|
|
69
|
+
return !isNaN(this.activeItemIndex) && index !== this.activeItemIndex;
|
|
70
|
+
};
|
|
52
71
|
TuiArcChartComponent.prototype.getInset = function (index) {
|
|
53
72
|
return this.strokeWidth / 2 + index * (this.strokeWidth + GAP[this.size]);
|
|
54
73
|
};
|
|
@@ -68,6 +87,9 @@ var TuiArcChartComponent = /** @class */ (function () {
|
|
|
68
87
|
{ type: DomSanitizer, decorators: [{ type: Inject, args: [DomSanitizer,] }] },
|
|
69
88
|
{ type: ChangeDetectorRef, decorators: [{ type: Inject, args: [ChangeDetectorRef,] }] }
|
|
70
89
|
]; };
|
|
90
|
+
__decorate([
|
|
91
|
+
ViewChildren('arc')
|
|
92
|
+
], TuiArcChartComponent.prototype, "arcs", null);
|
|
71
93
|
__decorate([
|
|
72
94
|
Input(),
|
|
73
95
|
tuiDefaultProp()
|
|
@@ -89,6 +111,13 @@ var TuiArcChartComponent = /** @class */ (function () {
|
|
|
89
111
|
Input(),
|
|
90
112
|
tuiDefaultProp()
|
|
91
113
|
], TuiArcChartComponent.prototype, "maxLabel", void 0);
|
|
114
|
+
__decorate([
|
|
115
|
+
Input(),
|
|
116
|
+
tuiDefaultProp()
|
|
117
|
+
], TuiArcChartComponent.prototype, "activeItemIndex", void 0);
|
|
118
|
+
__decorate([
|
|
119
|
+
Output()
|
|
120
|
+
], TuiArcChartComponent.prototype, "activeItemIndexChange", void 0);
|
|
92
121
|
__decorate([
|
|
93
122
|
HostBinding('style.width.rem'),
|
|
94
123
|
HostBinding('style.height.rem')
|
|
@@ -99,9 +128,9 @@ var TuiArcChartComponent = /** @class */ (function () {
|
|
|
99
128
|
TuiArcChartComponent = __decorate([
|
|
100
129
|
Component({
|
|
101
130
|
selector: 'tui-arc-chart',
|
|
102
|
-
template: "<svg\n *tuiRepeatTimes=\"let index of value.length\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"-100 -100 200 200\"\n focusable=\"false\"\n class=\"t-svg\"\n [style.top.em]=\"getInset(index)\"\n [style.left.em]=\"getInset(index)\"\n [style.width.em]=\"getDiameter(index)\"\n [style.height.em]=\"getDiameter(index)\"\n>\n <path\n vector-effect=\"non-scaling-stroke\"\n d=\"M -70 70 A 100 100 0 1 1 70 70\"\n />\n <path\n vector-effect=\"non-scaling-stroke\"\n d=\"M -70 70 A 100 100 0 1 1 70 70\"\n class=\"t-value\"\n [style.stroke]=\"getColor(index)\"\n [style.strokeDasharray.em]=\"getLength(index)\"\n [style.strokeDashoffset.em]=\"initialized ? getOffset(index) : getLength(index)\"\n />\n</svg>\n<div class=\"t-content\">\n <div class=\"t-wrapper\"><ng-content></ng-content></div>\n</div>\n<div class=\"t-percent\">\n <span>{{minLabel}}</span>\n <span>{{maxLabel}}</span>\n</div>\n",
|
|
131
|
+
template: "<svg\n *tuiRepeatTimes=\"let index of value.length\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"-100 -100 200 200\"\n focusable=\"false\"\n class=\"t-svg\"\n [style.top.em]=\"getInset(index)\"\n [style.left.em]=\"getInset(index)\"\n [style.width.em]=\"getDiameter(index)\"\n [style.height.em]=\"getDiameter(index)\"\n>\n <path\n vector-effect=\"non-scaling-stroke\"\n d=\"M -70 70 A 100 100 0 1 1 70 70\"\n />\n <path\n #arc\n vector-effect=\"non-scaling-stroke\"\n d=\"M -70 70 A 100 100 0 1 1 70 70\"\n class=\"t-value\"\n [class.t-value_inactive]=\"isInactive(index)\"\n [style.stroke]=\"getColor(index)\"\n [style.strokeDasharray.em]=\"getLength(index)\"\n [style.strokeDashoffset.em]=\"initialized ? getOffset(index) : getLength(index)\"\n />\n</svg>\n<div class=\"t-content\">\n <div class=\"t-wrapper\"><ng-content></ng-content></div>\n</div>\n<div class=\"t-percent\">\n <span>{{minLabel}}</span>\n <span>{{maxLabel}}</span>\n</div>\n",
|
|
103
132
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
104
|
-
styles: [":host{position:relative;display:block;flex-shrink:0}.t-svg{position:absolute;top:0;left:0;bottom:0;right:0;overflow:visible;fill:none;stroke:currentColor;stroke-linecap:round;color:var(--tui-secondary);font-size:1rem}.t-value{transition-property:stroke-dashoffset;transition-duration:var(--tui-duration,300ms);transition-timing-function:ease-in-out}.t-content{position:absolute;top:0;left:0;width:100%;height:100%;display:flex;justify-content:center;align-items:center;text-align:center;color:var(--tui-text-02);font:var(--tui-font-text-xs)}:host[data-size=xl] .t-content{font:var(--tui-font-text-m)}.t-wrapper{
|
|
133
|
+
styles: [":host{position:relative;display:block;flex-shrink:0}.t-svg{position:absolute;top:0;left:0;bottom:0;right:0;overflow:visible;fill:none;stroke:currentColor;stroke-linecap:round;color:var(--tui-secondary);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,300ms);transition-timing-function:ease-in-out;opacity:.16}.t-content{position:absolute;top:0;left:0;width:100%;height:100%;display:flex;justify-content:center;align-items:center;text-align:center;color:var(--tui-text-02);font:var(--tui-font-text-xs);pointer-events:none}:host[data-size=xl] .t-content{font:var(--tui-font-text-m)}.t-wrapper{pointer-events:auto}.t-wrapper:first-line{color:var(--tui-text-01)}:host[data-size='m'] .t-wrapper:first-line{font:var(--tui-font-text-s);font-weight:700}:host[data-size='l'] .t-wrapper:first-line{font:var(--tui-font-text-m);font-weight:700}:host[data-size=xl] .t-wrapper:first-line{font:var(--tui-font-heading-5)}.t-percent{position:absolute;left:25%;bottom:11%;display:flex;width:50%;justify-content:space-between;font:var(--tui-font-text-xs);color:var(--tui-text-02)}:host[data-size=xl] .t-percent{font:var(--tui-font-text-m)}"]
|
|
105
134
|
}),
|
|
106
135
|
__param(0, Inject(DomSanitizer)),
|
|
107
136
|
__param(1, Inject(ChangeDetectorRef))
|
|
@@ -109,4 +138,12 @@ var TuiArcChartComponent = /** @class */ (function () {
|
|
|
109
138
|
return TuiArcChartComponent;
|
|
110
139
|
}());
|
|
111
140
|
export { TuiArcChartComponent };
|
|
112
|
-
|
|
141
|
+
function arcsToIndex(arcs) {
|
|
142
|
+
return arcs
|
|
143
|
+
.toArray()
|
|
144
|
+
.map(function (_a, index) {
|
|
145
|
+
var nativeElement = _a.nativeElement;
|
|
146
|
+
return merge(typedFromEvent(nativeElement, 'mouseenter').pipe(mapTo(index)), typedFromEvent(nativeElement, 'mouseleave').pipe(mapTo(NaN)));
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXJjLWNoYXJ0LmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiJuZzovL0B0YWlnYS11aS9hZGRvbi1jaGFydHMvY29tcG9uZW50cy9hcmMtY2hhcnQvIiwic291cmNlcyI6WyJhcmMtY2hhcnQuY29tcG9uZW50LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxPQUFPLEVBQ0gsdUJBQXVCLEVBQ3ZCLGlCQUFpQixFQUNqQixTQUFTLEVBQ1QsVUFBVSxFQUNWLFdBQVcsRUFDWCxNQUFNLEVBQ04sS0FBSyxFQUNMLE1BQU0sRUFDTixTQUFTLEVBQ1QsWUFBWSxHQUNmLE1BQU0sZUFBZSxDQUFDO0FBQ3ZCLE9BQU8sRUFBQyxZQUFZLEVBQUUsU0FBUyxFQUFDLE1BQU0sMkJBQTJCLENBQUM7QUFDbEUsT0FBTyxFQUFDLGNBQWMsRUFBRSxjQUFjLE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bnVtYmVyW10gPSBbXTtcblxuICAgIEBJbnB1dCgpXG4gICAgQEhvc3RCaW5kaW5nKCdhdHRyLmRhdGEtc2l6ZScpXG4gICAgQHR1aURlZmF1bHRQcm9wKClcbiAgICBzaXplOiBUdWlTaXplWEwgPSAnbSc7XG5cbiAgICBASW5wdXQoKVxuICAgIEB0dWlEZWZhdWx0UHJvcCgpXG4gICAgbWF4ID0gMTAwO1xuXG4gICAgQElucHV0KClcbiAgICBAdHVpRGVmYXVsdFByb3AoKVxuICAgIG1pbkxhYmVsID0gJzAlJztcblxuICAgIEBJbnB1dCgpXG4gICAgQHR1aURlZmF1bHRQcm9wKClcbiAgICBtYXhMYWJlbCA9ICcxMDAlJztcblxuICAgIEBJbnB1dCgpXG4gICAgQHR1aURlZmF1bHRQcm9wKClcbiAgICBhY3RpdmVJdGVtSW5kZXggPSBOYU47XG5cbiAgICBAT3V0cHV0KClcbiAgICByZWFkb25seSBhY3RpdmVJdGVtSW5kZXhDaGFuZ2UgPSB0aGlzLmFyY3MkLnBpcGUoXG4gICAgICAgIHN3aXRjaE1hcChhcmNzID0+XG4gICAgICAgICAgICBhcmNzLmNoYW5nZXMucGlwZShcbiAgICAgICAgICAgICAgICBzdGFydFdpdGgobnVsbCksXG4gICAgICAgICAgICAgICAgc3dpdGNoTWFwKCgpID0+IG1lcmdlKC4uLmFyY3NUb0luZGV4KGFyY3MpKSksXG4gICAgICAgICAgICApLFxuICAgICAgICApLFxuICAgICAgICB0YXAoaW5kZXggPT4ge1xuICAgICAgICAgICAgdGhpcy5hY3RpdmVJdGVtSW5kZXggPSBpbmRleDtcbiAgICAgICAgfSksXG4gICAgKTtcblxuICAgIGluaXRpYWxpemVkID0gZmFsc2U7XG5cbiAgICBjb25zdHJ1Y3RvcihcbiAgICAgICAgQEluamVjdChEb21TYW5pdGl6ZXIpIHByaXZhdGUgcmVhZG9ubHkgc2FuaXRpemVyOiBEb21TYW5pdGl6ZXIsXG4gICAgICAgIEBJbmplY3QoQ2h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yhOYU4pKSxcbiAgICAgICAgICAgICksXG4gICAgICAgICk7XG59XG4iXX0=
|
|
@@ -231,7 +231,7 @@ var TuiLineChartComponent = /** @class */ (function () {
|
|
|
231
231
|
selector: 'tui-line-chart',
|
|
232
232
|
template: "<ng-container *tuiLet=\"hovered$ | async as hovered\">\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n focusable=\"false\"\n preserveAspectRatio=\"none\"\n width=\"100%\"\n height=\"100%\"\n class=\"t-svg\"\n [attr.viewBox]=\"viewBox\"\n >\n <defs>\n <linearGradient\n x1=\"0\"\n x2=\"0\"\n y1=\"1\"\n y2=\"0\"\n [attr.id]=\"fillId\"\n >\n <stop\n stop-color=\"currentColor\"\n offset=\"0%\"\n stop-opacity=\"0.5\"\n />\n <stop\n stop-color=\"currentColor\"\n offset=\"100%\"\n stop-opacity=\"0\"\n />\n </linearGradient>\n </defs>\n <path\n stroke=\"none\"\n [attr.fill]=\"fill\"\n [attr.d]=\"fillD\"\n />\n <path\n fill=\"none\"\n stroke=\"currentColor\"\n vector-effect=\"non-scaling-stroke\"\n stroke-width=\"2\"\n [attr.d]=\"d\"\n />\n </svg>\n <ng-container *ngIf=\"dots\">\n <div\n *ngFor=\"let point of value\"\n class=\"t-dot\"\n [style.left.%]=\"getLeft(point[0])\"\n [style.bottom.%]=\"getBottom(point[1])\"\n ></div>\n </ng-container>\n <ng-container *ngIf=\"hasHints\">\n <ng-container *ngFor=\"let point of value; let index = index\">\n <div\n *ngIf=\"value.length > 1 || dots\"\n tuiHintDirection=\"top-left\"\n class=\"t-column\"\n [class.t-column_hovered]=\"hovered === index\"\n [tuiHintHost]=\"hintHost\"\n [tuiHint]=\"hintDirective || hintContent ? hint : ''\"\n [tuiHintId]=\"getHintId(index)\"\n [style.left.%]=\"getLeft(getX(index))\"\n [style.width.%]=\"getWidth(index)\"\n (mouseenter)=\"onMouseEnter(index)\"\n >\n <div\n class=\"t-line t-line_vertical\"\n [style.left.%]=\"getOffset(index)\"\n ></div>\n <div\n #hintHost\n class=\"t-host\"\n [style.left.%]=\"getOffset(index)\"\n [style.bottom.%]=\"getBottom(point[1])\"\n [tuiFocusable]=\"isFocusable\"\n [tuiDescribedBy]=\"getHintId(index)\"\n ></div>\n </div>\n <div\n *ngIf=\"isFocusable\"\n class=\"t-line t-line_horizontal\"\n [style.bottom.%]=\"getBottom(point[1])\"\n ></div>\n <ng-template #hint>\n <div\n *ngIf=\"hintDirective else single\"\n polymorpheus-outlet\n class=\"t-text\"\n [content]=\"hintDirective.hint\"\n [context]=\"getContentContext(point, index)\"\n ></div>\n <ng-template #single>\n <div\n polymorpheus-outlet\n class=\"t-text\"\n [content]=\"hintContent\"\n [context]=\"{ $implicit: point, index: index }\"\n ></div>\n </ng-template>\n </ng-template>\n </ng-container>\n </ng-container>\n <ng-container *ngIf=\"getHovered(hovered) as point\">\n <div\n *ngIf=\"xStringify\"\n class=\"t-hint t-hint_x\"\n [style.left.%]=\"getLeft(point[0])\"\n >\n {{ xStringify(point[0]) }}\n </div>\n <div\n *ngIf=\"yStringify\"\n class=\"t-hint t-hint_y\"\n [style.bottom.%]=\"getBottom(point[1])\"\n >\n {{ yStringify(point[1]) }}\n </div>\n </ng-container>\n</ng-container>\n",
|
|
233
233
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
234
|
-
styles: [":host{display:flex;width:100%;height:100%;pointer-events:none}.t-svg{transform:scale(1,-1)}.t-column{position:absolute;top:0;height:100%;pointer-events:auto}.t-dot{position:absolute;width:.375rem;height:.375rem;border-radius:100%;background:currentColor;margin:-.1875rem;box-shadow:0 0 0 2px #fff}.t-host{position:absolute;left:50%;width:.5rem;height:.5rem;border-radius:100%;opacity:0;background:#fff;margin:-.25rem;box-shadow:0 0 0 2px currentColor,0 .0625rem .1875rem .125rem rgba(0,0,0,.1);outline:0;pointer-events:none}.column._hint_hovered .t-host,.column:hover .t-host,.column_hovered .t-host,.t-host:focus{opacity:1}.t-line{position:absolute;opacity:0;background:var(--tui-base-03)}.t-line_vertical{top:0;bottom:0;left:50%;width:1px}.t-line_horizontal{z-index:-1;width:100%;height:1px}:host:not([style]) .column._hint_hovered .t-line,:host:not([style]) .column._hint_hovered+.t-line,:host:not([style]) .column:hover .t-line,:host:not([style]) .column:hover+.t-line,:host[style^='z-index: 0'] .column_hovered .t-line,:host[style^='z-index: 0'] .column_hovered+.t-line{opacity:1}.t-text{white-space:pre-wrap}.t-hint{box-shadow:0 .25rem 1.5rem rgba(0,0,0,.12);position:absolute;font:var(--tui-font-text-xs);height:1.25rem;line-height:1.25rem;margin-bottom:-.625rem;padding:0 .375rem;white-space:nowrap;color:var(--tui-base-09);background:var(--tui-base-01);transform:translate3d(-50%,0,0)}.t-hint_x{bottom:0}.t-hint_y{left:0}"]
|
|
234
|
+
styles: [":host{display:flex;width:100%;height:100%;pointer-events:none}.t-svg{transform:scale(1,-1)}.t-column{position:absolute;top:0;height:100%;pointer-events:auto}.t-dot{position:absolute;width:.375rem;height:.375rem;border-radius:100%;background:currentColor;margin:-.1875rem;box-shadow:0 0 0 2px #fff}.t-host{position:absolute;left:50%;width:.5rem;height:.5rem;border-radius:100%;opacity:0;background:#fff;margin:-.25rem;box-shadow:0 0 0 2px currentColor,0 .0625rem .1875rem .125rem rgba(0,0,0,.1);outline:0;pointer-events:none}.t-column._hint_hovered .t-host,.t-column:hover .t-host,.t-column_hovered .t-host,.t-host:focus{opacity:1}.t-line{position:absolute;opacity:0;background:var(--tui-base-03)}.t-line_vertical{top:0;bottom:0;left:50%;width:1px}.t-line_horizontal{z-index:-1;width:100%;height:1px}:host:not([style]) .t-column._hint_hovered .t-line,:host:not([style]) .t-column._hint_hovered+.t-line,:host:not([style]) .t-column:hover .t-line,:host:not([style]) .t-column:hover+.t-line,:host[style^='z-index: 0'] .t-column_hovered .t-line,:host[style^='z-index: 0'] .t-column_hovered+.t-line{opacity:1}.t-text{white-space:pre-wrap}.t-hint{box-shadow:0 .25rem 1.5rem rgba(0,0,0,.12);position:absolute;font:var(--tui-font-text-xs);height:1.25rem;line-height:1.25rem;margin-bottom:-.625rem;padding:0 .375rem;white-space:nowrap;color:var(--tui-base-09);background:var(--tui-base-01);transform:translate3d(-50%,0,0)}.t-hint_x{bottom:0}.t-hint_y{left:0}"]
|
|
235
235
|
}),
|
|
236
236
|
__param(0, Inject(TuiIdService)),
|
|
237
237
|
__param(1, Inject(NgZone)),
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { __decorate, __param } from 'tslib';
|
|
2
|
-
import { Inject, ChangeDetectorRef, Input, HostBinding, Component, ChangeDetectionStrategy, NgModule } from '@angular/core';
|
|
2
|
+
import { Inject, ChangeDetectorRef, ViewChildren, Input, HostBinding, Output, Component, ChangeDetectionStrategy, NgModule } from '@angular/core';
|
|
3
3
|
import { DomSanitizer } from '@angular/platform-browser';
|
|
4
|
-
import { tuiDefaultProp, TuiRepeatTimesModule } from '@taiga-ui/cdk';
|
|
4
|
+
import { typedFromEvent, tuiDefaultProp, TuiRepeatTimesModule } from '@taiga-ui/cdk';
|
|
5
|
+
import { ReplaySubject, merge } from 'rxjs';
|
|
6
|
+
import { switchMap, startWith, mapTo, tap } from 'rxjs/operators';
|
|
5
7
|
|
|
6
8
|
// 3/4 with 1% safety offset
|
|
7
9
|
const ARC = 0.76;
|
|
@@ -23,11 +25,16 @@ const GAP = {
|
|
|
23
25
|
let TuiArcChartComponent = class TuiArcChartComponent {
|
|
24
26
|
constructor(sanitizer, changeDetectorRef) {
|
|
25
27
|
this.sanitizer = sanitizer;
|
|
28
|
+
this.arcs$ = new ReplaySubject(1);
|
|
26
29
|
this.value = [];
|
|
27
30
|
this.size = 'm';
|
|
28
31
|
this.max = 100;
|
|
29
32
|
this.minLabel = '0%';
|
|
30
33
|
this.maxLabel = '100%';
|
|
34
|
+
this.activeItemIndex = NaN;
|
|
35
|
+
this.activeItemIndexChange = this.arcs$.pipe(switchMap(arcs => arcs.changes.pipe(startWith(null), switchMap(() => merge(...arcsToIndex(arcs))))), tap(index => {
|
|
36
|
+
this.activeItemIndex = index;
|
|
37
|
+
}));
|
|
31
38
|
this.initialized = false;
|
|
32
39
|
// So initial animation works
|
|
33
40
|
setTimeout(() => {
|
|
@@ -35,12 +42,18 @@ let TuiArcChartComponent = class TuiArcChartComponent {
|
|
|
35
42
|
changeDetectorRef.markForCheck();
|
|
36
43
|
});
|
|
37
44
|
}
|
|
45
|
+
set arcs(arcs) {
|
|
46
|
+
this.arcs$.next(arcs);
|
|
47
|
+
}
|
|
38
48
|
get width() {
|
|
39
49
|
return SIZE[this.size];
|
|
40
50
|
}
|
|
41
51
|
get strokeWidth() {
|
|
42
52
|
return WIDTH[this.size];
|
|
43
53
|
}
|
|
54
|
+
isInactive(index) {
|
|
55
|
+
return !isNaN(this.activeItemIndex) && index !== this.activeItemIndex;
|
|
56
|
+
}
|
|
44
57
|
getInset(index) {
|
|
45
58
|
return this.strokeWidth / 2 + index * (this.strokeWidth + GAP[this.size]);
|
|
46
59
|
}
|
|
@@ -61,6 +74,9 @@ TuiArcChartComponent.ctorParameters = () => [
|
|
|
61
74
|
{ type: DomSanitizer, decorators: [{ type: Inject, args: [DomSanitizer,] }] },
|
|
62
75
|
{ type: ChangeDetectorRef, decorators: [{ type: Inject, args: [ChangeDetectorRef,] }] }
|
|
63
76
|
];
|
|
77
|
+
__decorate([
|
|
78
|
+
ViewChildren('arc')
|
|
79
|
+
], TuiArcChartComponent.prototype, "arcs", null);
|
|
64
80
|
__decorate([
|
|
65
81
|
Input(),
|
|
66
82
|
tuiDefaultProp()
|
|
@@ -82,6 +98,13 @@ __decorate([
|
|
|
82
98
|
Input(),
|
|
83
99
|
tuiDefaultProp()
|
|
84
100
|
], TuiArcChartComponent.prototype, "maxLabel", void 0);
|
|
101
|
+
__decorate([
|
|
102
|
+
Input(),
|
|
103
|
+
tuiDefaultProp()
|
|
104
|
+
], TuiArcChartComponent.prototype, "activeItemIndex", void 0);
|
|
105
|
+
__decorate([
|
|
106
|
+
Output()
|
|
107
|
+
], TuiArcChartComponent.prototype, "activeItemIndexChange", void 0);
|
|
85
108
|
__decorate([
|
|
86
109
|
HostBinding('style.width.rem'),
|
|
87
110
|
HostBinding('style.height.rem')
|
|
@@ -92,13 +115,18 @@ __decorate([
|
|
|
92
115
|
TuiArcChartComponent = __decorate([
|
|
93
116
|
Component({
|
|
94
117
|
selector: 'tui-arc-chart',
|
|
95
|
-
template: "<svg\n *tuiRepeatTimes=\"let index of value.length\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"-100 -100 200 200\"\n focusable=\"false\"\n class=\"t-svg\"\n [style.top.em]=\"getInset(index)\"\n [style.left.em]=\"getInset(index)\"\n [style.width.em]=\"getDiameter(index)\"\n [style.height.em]=\"getDiameter(index)\"\n>\n <path\n vector-effect=\"non-scaling-stroke\"\n d=\"M -70 70 A 100 100 0 1 1 70 70\"\n />\n <path\n vector-effect=\"non-scaling-stroke\"\n d=\"M -70 70 A 100 100 0 1 1 70 70\"\n class=\"t-value\"\n [style.stroke]=\"getColor(index)\"\n [style.strokeDasharray.em]=\"getLength(index)\"\n [style.strokeDashoffset.em]=\"initialized ? getOffset(index) : getLength(index)\"\n />\n</svg>\n<div class=\"t-content\">\n <div class=\"t-wrapper\"><ng-content></ng-content></div>\n</div>\n<div class=\"t-percent\">\n <span>{{minLabel}}</span>\n <span>{{maxLabel}}</span>\n</div>\n",
|
|
118
|
+
template: "<svg\n *tuiRepeatTimes=\"let index of value.length\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"-100 -100 200 200\"\n focusable=\"false\"\n class=\"t-svg\"\n [style.top.em]=\"getInset(index)\"\n [style.left.em]=\"getInset(index)\"\n [style.width.em]=\"getDiameter(index)\"\n [style.height.em]=\"getDiameter(index)\"\n>\n <path\n vector-effect=\"non-scaling-stroke\"\n d=\"M -70 70 A 100 100 0 1 1 70 70\"\n />\n <path\n #arc\n vector-effect=\"non-scaling-stroke\"\n d=\"M -70 70 A 100 100 0 1 1 70 70\"\n class=\"t-value\"\n [class.t-value_inactive]=\"isInactive(index)\"\n [style.stroke]=\"getColor(index)\"\n [style.strokeDasharray.em]=\"getLength(index)\"\n [style.strokeDashoffset.em]=\"initialized ? getOffset(index) : getLength(index)\"\n />\n</svg>\n<div class=\"t-content\">\n <div class=\"t-wrapper\"><ng-content></ng-content></div>\n</div>\n<div class=\"t-percent\">\n <span>{{minLabel}}</span>\n <span>{{maxLabel}}</span>\n</div>\n",
|
|
96
119
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
97
|
-
styles: [":host{position:relative;display:block;flex-shrink:0}.t-svg{position:absolute;top:0;left:0;bottom:0;right:0;overflow:visible;fill:none;stroke:currentColor;stroke-linecap:round;color:var(--tui-secondary);font-size:1rem}.t-value{transition-property:stroke-dashoffset;transition-duration:var(--tui-duration,300ms);transition-timing-function:ease-in-out}.t-content{position:absolute;top:0;left:0;width:100%;height:100%;display:flex;justify-content:center;align-items:center;text-align:center;color:var(--tui-text-02);font:var(--tui-font-text-xs)}:host[data-size=xl] .t-content{font:var(--tui-font-text-m)}.t-wrapper{
|
|
120
|
+
styles: [":host{position:relative;display:block;flex-shrink:0}.t-svg{position:absolute;top:0;left:0;bottom:0;right:0;overflow:visible;fill:none;stroke:currentColor;stroke-linecap:round;color:var(--tui-secondary);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,300ms);transition-timing-function:ease-in-out;opacity:.16}.t-content{position:absolute;top:0;left:0;width:100%;height:100%;display:flex;justify-content:center;align-items:center;text-align:center;color:var(--tui-text-02);font:var(--tui-font-text-xs);pointer-events:none}:host[data-size=xl] .t-content{font:var(--tui-font-text-m)}.t-wrapper{pointer-events:auto}.t-wrapper:first-line{color:var(--tui-text-01)}:host[data-size='m'] .t-wrapper:first-line{font:var(--tui-font-text-s);font-weight:700}:host[data-size='l'] .t-wrapper:first-line{font:var(--tui-font-text-m);font-weight:700}:host[data-size=xl] .t-wrapper:first-line{font:var(--tui-font-heading-5)}.t-percent{position:absolute;left:25%;bottom:11%;display:flex;width:50%;justify-content:space-between;font:var(--tui-font-text-xs);color:var(--tui-text-02)}:host[data-size=xl] .t-percent{font:var(--tui-font-text-m)}"]
|
|
98
121
|
}),
|
|
99
122
|
__param(0, Inject(DomSanitizer)),
|
|
100
123
|
__param(1, Inject(ChangeDetectorRef))
|
|
101
124
|
], TuiArcChartComponent);
|
|
125
|
+
function arcsToIndex(arcs) {
|
|
126
|
+
return arcs
|
|
127
|
+
.toArray()
|
|
128
|
+
.map(({ nativeElement }, index) => merge(typedFromEvent(nativeElement, 'mouseenter').pipe(mapTo(index)), typedFromEvent(nativeElement, 'mouseleave').pipe(mapTo(NaN))));
|
|
129
|
+
}
|
|
102
130
|
|
|
103
131
|
let TuiArcChartModule = class TuiArcChartModule {
|
|
104
132
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-addon-charts-components-arc-chart.js","sources":["ng://@taiga-ui/addon-charts/components/arc-chart/arc-chart.component.ts","ng://@taiga-ui/addon-charts/components/arc-chart/arc-chart.module.ts","ng://@taiga-ui/addon-charts/components/arc-chart/taiga-ui-addon-charts-components-arc-chart.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n HostBinding,\n Inject,\n Input,\n} from '@angular/core';\nimport {DomSanitizer, SafeValue} from '@angular/platform-browser';\nimport {tuiDefaultProp} from '@taiga-ui/cdk';\nimport {TuiSizeXL} from '@taiga-ui/core';\n\n// 3/4 with 1% safety offset\nconst ARC = 0.76;\n\nconst SIZE: Record<TuiSizeXL, number> = {\n m: 9,\n l: 11,\n xl: 16,\n};\n\nconst WIDTH: Record<TuiSizeXL, number> = {\n m: 0.25,\n l: 0.375,\n xl: 0.5625,\n};\n\nconst GAP: Record<TuiSizeXL, number> = {\n m: 0.125,\n l: 0.1875,\n xl: 0.25,\n};\n\n@Component({\n selector: 'tui-arc-chart',\n templateUrl: './arc-chart.template.html',\n styleUrls: ['./arc-chart.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class TuiArcChartComponent {\n @Input()\n @tuiDefaultProp()\n value: readonly number[] = [];\n\n @Input()\n @HostBinding('attr.data-size')\n @tuiDefaultProp()\n size: TuiSizeXL = 'm';\n\n @Input()\n @tuiDefaultProp()\n max = 100;\n\n @Input()\n @tuiDefaultProp()\n minLabel = '0%';\n\n @Input()\n @tuiDefaultProp()\n maxLabel = '100%';\n\n initialized = false;\n\n constructor(\n @Inject(DomSanitizer) private readonly sanitizer: DomSanitizer,\n @Inject(ChangeDetectorRef) changeDetectorRef: ChangeDetectorRef,\n ) {\n // So initial animation works\n setTimeout(() => {\n this.initialized = true;\n changeDetectorRef.markForCheck();\n });\n }\n\n @HostBinding('style.width.rem')\n @HostBinding('style.height.rem')\n get width(): number {\n return SIZE[this.size];\n }\n\n @HostBinding('style.strokeWidth.rem')\n get strokeWidth(): number {\n return WIDTH[this.size];\n }\n\n getInset(index: number): number {\n return this.strokeWidth / 2 + index * (this.strokeWidth + GAP[this.size]);\n }\n\n getDiameter(index: number): number {\n return SIZE[this.size] - 2 * this.getInset(index);\n }\n\n getLength(index: number): number {\n return Math.PI * this.getDiameter(index) * ARC;\n }\n\n getOffset(index: number): number {\n return this.getLength(index) * (1 - Math.min(this.value[index] / this.max, 1));\n }\n\n getColor(index: number): SafeValue {\n return this.sanitizer.bypassSecurityTrustStyle(\n `var(--tui-chart-${index}, var(--tui-support-0${index + 1}))`,\n );\n }\n}\n","import {NgModule} from '@angular/core';\nimport {TuiRepeatTimesModule} from '@taiga-ui/cdk';\n\nimport {TuiArcChartComponent} from './arc-chart.component';\n\n@NgModule({\n imports: [TuiRepeatTimesModule],\n declarations: [TuiArcChartComponent],\n exports: [TuiArcChartComponent],\n})\nexport class TuiArcChartModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"taiga-ui-addon-charts-components-arc-chart.js","sources":["ng://@taiga-ui/addon-charts/components/arc-chart/arc-chart.component.ts","ng://@taiga-ui/addon-charts/components/arc-chart/arc-chart.module.ts","ng://@taiga-ui/addon-charts/components/arc-chart/taiga-ui-addon-charts-components-arc-chart.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n HostBinding,\n Inject,\n Input,\n Output,\n QueryList,\n ViewChildren,\n} from '@angular/core';\nimport {DomSanitizer, SafeValue} from '@angular/platform-browser';\nimport {tuiDefaultProp, typedFromEvent} from '@taiga-ui/cdk';\nimport {TuiSizeXL} from '@taiga-ui/core';\nimport {merge, Observable, ReplaySubject} from 'rxjs';\nimport {mapTo, startWith, switchMap, tap} from 'rxjs/operators';\n\n// 3/4 with 1% safety offset\nconst ARC = 0.76;\n\nconst SIZE: Record<TuiSizeXL, number> = {\n m: 9,\n l: 11,\n xl: 16,\n};\n\nconst WIDTH: Record<TuiSizeXL, number> = {\n m: 0.25,\n l: 0.375,\n xl: 0.5625,\n};\n\nconst GAP: Record<TuiSizeXL, number> = {\n m: 0.125,\n l: 0.1875,\n xl: 0.25,\n};\n\n@Component({\n selector: 'tui-arc-chart',\n templateUrl: './arc-chart.template.html',\n styleUrls: ['./arc-chart.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class TuiArcChartComponent {\n private readonly arcs$ = new ReplaySubject<QueryList<ElementRef<SVGElement>>>(1);\n\n @ViewChildren('arc')\n set arcs(arcs: QueryList<ElementRef<SVGElement>>) {\n this.arcs$.next(arcs);\n }\n\n @Input()\n @tuiDefaultProp()\n value: readonly number[] = [];\n\n @Input()\n @HostBinding('attr.data-size')\n @tuiDefaultProp()\n size: TuiSizeXL = 'm';\n\n @Input()\n @tuiDefaultProp()\n max = 100;\n\n @Input()\n @tuiDefaultProp()\n minLabel = '0%';\n\n @Input()\n @tuiDefaultProp()\n maxLabel = '100%';\n\n @Input()\n @tuiDefaultProp()\n activeItemIndex = NaN;\n\n @Output()\n readonly activeItemIndexChange = this.arcs$.pipe(\n switchMap(arcs =>\n arcs.changes.pipe(\n startWith(null),\n switchMap(() => merge(...arcsToIndex(arcs))),\n ),\n ),\n tap(index => {\n this.activeItemIndex = index;\n }),\n );\n\n initialized = false;\n\n constructor(\n @Inject(DomSanitizer) private readonly sanitizer: DomSanitizer,\n @Inject(ChangeDetectorRef) changeDetectorRef: ChangeDetectorRef,\n ) {\n // So initial animation works\n setTimeout(() => {\n this.initialized = true;\n changeDetectorRef.markForCheck();\n });\n }\n\n @HostBinding('style.width.rem')\n @HostBinding('style.height.rem')\n get width(): number {\n return SIZE[this.size];\n }\n\n @HostBinding('style.strokeWidth.rem')\n get strokeWidth(): number {\n return WIDTH[this.size];\n }\n\n isInactive(index: number): boolean {\n return !isNaN(this.activeItemIndex) && index !== this.activeItemIndex;\n }\n\n getInset(index: number): number {\n return this.strokeWidth / 2 + index * (this.strokeWidth + GAP[this.size]);\n }\n\n getDiameter(index: number): number {\n return SIZE[this.size] - 2 * this.getInset(index);\n }\n\n getLength(index: number): number {\n return Math.PI * this.getDiameter(index) * ARC;\n }\n\n getOffset(index: number): number {\n return this.getLength(index) * (1 - Math.min(this.value[index] / this.max, 1));\n }\n\n getColor(index: number): SafeValue {\n return this.sanitizer.bypassSecurityTrustStyle(\n `var(--tui-chart-${index}, var(--tui-support-0${index + 1}))`,\n );\n }\n}\n\nfunction arcsToIndex(arcs: QueryList<ElementRef<SVGElement>>): Array<Observable<number>> {\n return arcs\n .toArray()\n .map(({nativeElement}, index) =>\n merge(\n typedFromEvent(nativeElement, 'mouseenter').pipe(mapTo(index)),\n typedFromEvent(nativeElement, 'mouseleave').pipe(mapTo(NaN)),\n ),\n );\n}\n","import {NgModule} from '@angular/core';\nimport {TuiRepeatTimesModule} from '@taiga-ui/cdk';\n\nimport {TuiArcChartComponent} from './arc-chart.component';\n\n@NgModule({\n imports: [TuiRepeatTimesModule],\n declarations: [TuiArcChartComponent],\n exports: [TuiArcChartComponent],\n})\nexport class TuiArcChartModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAkBA;AACA,MAAM,GAAG,GAAG,IAAI,CAAC;AAEjB,MAAM,IAAI,GAA8B;IACpC,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,EAAE;IACL,EAAE,EAAE,EAAE;CACT,CAAC;AAEF,MAAM,KAAK,GAA8B;IACrC,CAAC,EAAE,IAAI;IACP,CAAC,EAAE,KAAK;IACR,EAAE,EAAE,MAAM;CACb,CAAC;AAEF,MAAM,GAAG,GAA8B;IACnC,CAAC,EAAE,KAAK;IACR,CAAC,EAAE,MAAM;IACT,EAAE,EAAE,IAAI;CACX,CAAC;IAQW,oBAAoB,GAAjC,MAAa,oBAAoB;IAgD7B,YAC2C,SAAuB,EACnC,iBAAoC;QADxB,cAAS,GAAT,SAAS,CAAc;QAhDjD,UAAK,GAAG,IAAI,aAAa,CAAoC,CAAC,CAAC,CAAC;QASjF,UAAK,GAAsB,EAAE,CAAC;QAK9B,SAAI,GAAc,GAAG,CAAC;QAItB,QAAG,GAAG,GAAG,CAAC;QAIV,aAAQ,GAAG,IAAI,CAAC;QAIhB,aAAQ,GAAG,MAAM,CAAC;QAIlB,oBAAe,GAAG,GAAG,CAAC;QAGb,0BAAqB,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAC5C,SAAS,CAAC,IAAI,IACV,IAAI,CAAC,OAAO,CAAC,IAAI,CACb,SAAS,CAAC,IAAI,CAAC,EACf,SAAS,CAAC,MAAM,KAAK,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAC/C,CACJ,EACD,GAAG,CAAC,KAAK;YACL,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;SAChC,CAAC,CACL,CAAC;QAEF,gBAAW,GAAG,KAAK,CAAC;;QAOhB,U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BAAiB,GAA9B,MAAa,iBAAiB;EAAG;AAApB,iBAAiB;IAL7B,QAAQ,CAAC;QACN,OAAO,EAAE,CAAC,oBAAoB,CAAC;QAC/B,YAAY,EAAE,CAAC,oBAAoB,CAAC;QACpC,OAAO,EAAE,CAAC,oBAAoB,CAAC;KAClC,CAAC;GACW,iBAAiB,CAAG;;ACVjC;;;;;;"}
|
|
@@ -255,7 +255,7 @@ TuiLineChartComponent = __decorate([
|
|
|
255
255
|
selector: 'tui-line-chart',
|
|
256
256
|
template: "<ng-container *tuiLet=\"hovered$ | async as hovered\">\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n focusable=\"false\"\n preserveAspectRatio=\"none\"\n width=\"100%\"\n height=\"100%\"\n class=\"t-svg\"\n [attr.viewBox]=\"viewBox\"\n >\n <defs>\n <linearGradient\n x1=\"0\"\n x2=\"0\"\n y1=\"1\"\n y2=\"0\"\n [attr.id]=\"fillId\"\n >\n <stop\n stop-color=\"currentColor\"\n offset=\"0%\"\n stop-opacity=\"0.5\"\n />\n <stop\n stop-color=\"currentColor\"\n offset=\"100%\"\n stop-opacity=\"0\"\n />\n </linearGradient>\n </defs>\n <path\n stroke=\"none\"\n [attr.fill]=\"fill\"\n [attr.d]=\"fillD\"\n />\n <path\n fill=\"none\"\n stroke=\"currentColor\"\n vector-effect=\"non-scaling-stroke\"\n stroke-width=\"2\"\n [attr.d]=\"d\"\n />\n </svg>\n <ng-container *ngIf=\"dots\">\n <div\n *ngFor=\"let point of value\"\n class=\"t-dot\"\n [style.left.%]=\"getLeft(point[0])\"\n [style.bottom.%]=\"getBottom(point[1])\"\n ></div>\n </ng-container>\n <ng-container *ngIf=\"hasHints\">\n <ng-container *ngFor=\"let point of value; let index = index\">\n <div\n *ngIf=\"value.length > 1 || dots\"\n tuiHintDirection=\"top-left\"\n class=\"t-column\"\n [class.t-column_hovered]=\"hovered === index\"\n [tuiHintHost]=\"hintHost\"\n [tuiHint]=\"hintDirective || hintContent ? hint : ''\"\n [tuiHintId]=\"getHintId(index)\"\n [style.left.%]=\"getLeft(getX(index))\"\n [style.width.%]=\"getWidth(index)\"\n (mouseenter)=\"onMouseEnter(index)\"\n >\n <div\n class=\"t-line t-line_vertical\"\n [style.left.%]=\"getOffset(index)\"\n ></div>\n <div\n #hintHost\n class=\"t-host\"\n [style.left.%]=\"getOffset(index)\"\n [style.bottom.%]=\"getBottom(point[1])\"\n [tuiFocusable]=\"isFocusable\"\n [tuiDescribedBy]=\"getHintId(index)\"\n ></div>\n </div>\n <div\n *ngIf=\"isFocusable\"\n class=\"t-line t-line_horizontal\"\n [style.bottom.%]=\"getBottom(point[1])\"\n ></div>\n <ng-template #hint>\n <div\n *ngIf=\"hintDirective else single\"\n polymorpheus-outlet\n class=\"t-text\"\n [content]=\"hintDirective.hint\"\n [context]=\"getContentContext(point, index)\"\n ></div>\n <ng-template #single>\n <div\n polymorpheus-outlet\n class=\"t-text\"\n [content]=\"hintContent\"\n [context]=\"{ $implicit: point, index: index }\"\n ></div>\n </ng-template>\n </ng-template>\n </ng-container>\n </ng-container>\n <ng-container *ngIf=\"getHovered(hovered) as point\">\n <div\n *ngIf=\"xStringify\"\n class=\"t-hint t-hint_x\"\n [style.left.%]=\"getLeft(point[0])\"\n >\n {{ xStringify(point[0]) }}\n </div>\n <div\n *ngIf=\"yStringify\"\n class=\"t-hint t-hint_y\"\n [style.bottom.%]=\"getBottom(point[1])\"\n >\n {{ yStringify(point[1]) }}\n </div>\n </ng-container>\n</ng-container>\n",
|
|
257
257
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
258
|
-
styles: [":host{display:flex;width:100%;height:100%;pointer-events:none}.t-svg{transform:scale(1,-1)}.t-column{position:absolute;top:0;height:100%;pointer-events:auto}.t-dot{position:absolute;width:.375rem;height:.375rem;border-radius:100%;background:currentColor;margin:-.1875rem;box-shadow:0 0 0 2px #fff}.t-host{position:absolute;left:50%;width:.5rem;height:.5rem;border-radius:100%;opacity:0;background:#fff;margin:-.25rem;box-shadow:0 0 0 2px currentColor,0 .0625rem .1875rem .125rem rgba(0,0,0,.1);outline:0;pointer-events:none}.column._hint_hovered .t-host,.column:hover .t-host,.column_hovered .t-host,.t-host:focus{opacity:1}.t-line{position:absolute;opacity:0;background:var(--tui-base-03)}.t-line_vertical{top:0;bottom:0;left:50%;width:1px}.t-line_horizontal{z-index:-1;width:100%;height:1px}:host:not([style]) .column._hint_hovered .t-line,:host:not([style]) .column._hint_hovered+.t-line,:host:not([style]) .column:hover .t-line,:host:not([style]) .column:hover+.t-line,:host[style^='z-index: 0'] .column_hovered .t-line,:host[style^='z-index: 0'] .column_hovered+.t-line{opacity:1}.t-text{white-space:pre-wrap}.t-hint{box-shadow:0 .25rem 1.5rem rgba(0,0,0,.12);position:absolute;font:var(--tui-font-text-xs);height:1.25rem;line-height:1.25rem;margin-bottom:-.625rem;padding:0 .375rem;white-space:nowrap;color:var(--tui-base-09);background:var(--tui-base-01);transform:translate3d(-50%,0,0)}.t-hint_x{bottom:0}.t-hint_y{left:0}"]
|
|
258
|
+
styles: [":host{display:flex;width:100%;height:100%;pointer-events:none}.t-svg{transform:scale(1,-1)}.t-column{position:absolute;top:0;height:100%;pointer-events:auto}.t-dot{position:absolute;width:.375rem;height:.375rem;border-radius:100%;background:currentColor;margin:-.1875rem;box-shadow:0 0 0 2px #fff}.t-host{position:absolute;left:50%;width:.5rem;height:.5rem;border-radius:100%;opacity:0;background:#fff;margin:-.25rem;box-shadow:0 0 0 2px currentColor,0 .0625rem .1875rem .125rem rgba(0,0,0,.1);outline:0;pointer-events:none}.t-column._hint_hovered .t-host,.t-column:hover .t-host,.t-column_hovered .t-host,.t-host:focus{opacity:1}.t-line{position:absolute;opacity:0;background:var(--tui-base-03)}.t-line_vertical{top:0;bottom:0;left:50%;width:1px}.t-line_horizontal{z-index:-1;width:100%;height:1px}:host:not([style]) .t-column._hint_hovered .t-line,:host:not([style]) .t-column._hint_hovered+.t-line,:host:not([style]) .t-column:hover .t-line,:host:not([style]) .t-column:hover+.t-line,:host[style^='z-index: 0'] .t-column_hovered .t-line,:host[style^='z-index: 0'] .t-column_hovered+.t-line{opacity:1}.t-text{white-space:pre-wrap}.t-hint{box-shadow:0 .25rem 1.5rem rgba(0,0,0,.12);position:absolute;font:var(--tui-font-text-xs);height:1.25rem;line-height:1.25rem;margin-bottom:-.625rem;padding:0 .375rem;white-space:nowrap;color:var(--tui-base-09);background:var(--tui-base-01);transform:translate3d(-50%,0,0)}.t-hint_x{bottom:0}.t-hint_y{left:0}"]
|
|
259
259
|
}),
|
|
260
260
|
__param(0, Inject(TuiIdService)),
|
|
261
261
|
__param(1, Inject(NgZone)),
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { __decorate, __param } from 'tslib';
|
|
2
|
-
import { Inject, ChangeDetectorRef, Input, HostBinding, Component, ChangeDetectionStrategy, NgModule } from '@angular/core';
|
|
1
|
+
import { __spread, __decorate, __param } from 'tslib';
|
|
2
|
+
import { Inject, ChangeDetectorRef, ViewChildren, Input, HostBinding, Output, Component, ChangeDetectionStrategy, NgModule } from '@angular/core';
|
|
3
3
|
import { DomSanitizer } from '@angular/platform-browser';
|
|
4
|
-
import { tuiDefaultProp, TuiRepeatTimesModule } from '@taiga-ui/cdk';
|
|
4
|
+
import { typedFromEvent, tuiDefaultProp, TuiRepeatTimesModule } from '@taiga-ui/cdk';
|
|
5
|
+
import { ReplaySubject, merge } from 'rxjs';
|
|
6
|
+
import { switchMap, startWith, mapTo, tap } from 'rxjs/operators';
|
|
5
7
|
|
|
6
8
|
// 3/4 with 1% safety offset
|
|
7
9
|
var ARC = 0.76;
|
|
@@ -24,11 +26,18 @@ var TuiArcChartComponent = /** @class */ (function () {
|
|
|
24
26
|
function TuiArcChartComponent(sanitizer, changeDetectorRef) {
|
|
25
27
|
var _this = this;
|
|
26
28
|
this.sanitizer = sanitizer;
|
|
29
|
+
this.arcs$ = new ReplaySubject(1);
|
|
27
30
|
this.value = [];
|
|
28
31
|
this.size = 'm';
|
|
29
32
|
this.max = 100;
|
|
30
33
|
this.minLabel = '0%';
|
|
31
34
|
this.maxLabel = '100%';
|
|
35
|
+
this.activeItemIndex = NaN;
|
|
36
|
+
this.activeItemIndexChange = this.arcs$.pipe(switchMap(function (arcs) {
|
|
37
|
+
return arcs.changes.pipe(startWith(null), switchMap(function () { return merge.apply(void 0, __spread(arcsToIndex(arcs))); }));
|
|
38
|
+
}), tap(function (index) {
|
|
39
|
+
_this.activeItemIndex = index;
|
|
40
|
+
}));
|
|
32
41
|
this.initialized = false;
|
|
33
42
|
// So initial animation works
|
|
34
43
|
setTimeout(function () {
|
|
@@ -36,6 +45,13 @@ var TuiArcChartComponent = /** @class */ (function () {
|
|
|
36
45
|
changeDetectorRef.markForCheck();
|
|
37
46
|
});
|
|
38
47
|
}
|
|
48
|
+
Object.defineProperty(TuiArcChartComponent.prototype, "arcs", {
|
|
49
|
+
set: function (arcs) {
|
|
50
|
+
this.arcs$.next(arcs);
|
|
51
|
+
},
|
|
52
|
+
enumerable: true,
|
|
53
|
+
configurable: true
|
|
54
|
+
});
|
|
39
55
|
Object.defineProperty(TuiArcChartComponent.prototype, "width", {
|
|
40
56
|
get: function () {
|
|
41
57
|
return SIZE[this.size];
|
|
@@ -50,6 +66,9 @@ var TuiArcChartComponent = /** @class */ (function () {
|
|
|
50
66
|
enumerable: true,
|
|
51
67
|
configurable: true
|
|
52
68
|
});
|
|
69
|
+
TuiArcChartComponent.prototype.isInactive = function (index) {
|
|
70
|
+
return !isNaN(this.activeItemIndex) && index !== this.activeItemIndex;
|
|
71
|
+
};
|
|
53
72
|
TuiArcChartComponent.prototype.getInset = function (index) {
|
|
54
73
|
return this.strokeWidth / 2 + index * (this.strokeWidth + GAP[this.size]);
|
|
55
74
|
};
|
|
@@ -69,6 +88,9 @@ var TuiArcChartComponent = /** @class */ (function () {
|
|
|
69
88
|
{ type: DomSanitizer, decorators: [{ type: Inject, args: [DomSanitizer,] }] },
|
|
70
89
|
{ type: ChangeDetectorRef, decorators: [{ type: Inject, args: [ChangeDetectorRef,] }] }
|
|
71
90
|
]; };
|
|
91
|
+
__decorate([
|
|
92
|
+
ViewChildren('arc')
|
|
93
|
+
], TuiArcChartComponent.prototype, "arcs", null);
|
|
72
94
|
__decorate([
|
|
73
95
|
Input(),
|
|
74
96
|
tuiDefaultProp()
|
|
@@ -90,6 +112,13 @@ var TuiArcChartComponent = /** @class */ (function () {
|
|
|
90
112
|
Input(),
|
|
91
113
|
tuiDefaultProp()
|
|
92
114
|
], TuiArcChartComponent.prototype, "maxLabel", void 0);
|
|
115
|
+
__decorate([
|
|
116
|
+
Input(),
|
|
117
|
+
tuiDefaultProp()
|
|
118
|
+
], TuiArcChartComponent.prototype, "activeItemIndex", void 0);
|
|
119
|
+
__decorate([
|
|
120
|
+
Output()
|
|
121
|
+
], TuiArcChartComponent.prototype, "activeItemIndexChange", void 0);
|
|
93
122
|
__decorate([
|
|
94
123
|
HostBinding('style.width.rem'),
|
|
95
124
|
HostBinding('style.height.rem')
|
|
@@ -100,15 +129,23 @@ var TuiArcChartComponent = /** @class */ (function () {
|
|
|
100
129
|
TuiArcChartComponent = __decorate([
|
|
101
130
|
Component({
|
|
102
131
|
selector: 'tui-arc-chart',
|
|
103
|
-
template: "<svg\n *tuiRepeatTimes=\"let index of value.length\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"-100 -100 200 200\"\n focusable=\"false\"\n class=\"t-svg\"\n [style.top.em]=\"getInset(index)\"\n [style.left.em]=\"getInset(index)\"\n [style.width.em]=\"getDiameter(index)\"\n [style.height.em]=\"getDiameter(index)\"\n>\n <path\n vector-effect=\"non-scaling-stroke\"\n d=\"M -70 70 A 100 100 0 1 1 70 70\"\n />\n <path\n vector-effect=\"non-scaling-stroke\"\n d=\"M -70 70 A 100 100 0 1 1 70 70\"\n class=\"t-value\"\n [style.stroke]=\"getColor(index)\"\n [style.strokeDasharray.em]=\"getLength(index)\"\n [style.strokeDashoffset.em]=\"initialized ? getOffset(index) : getLength(index)\"\n />\n</svg>\n<div class=\"t-content\">\n <div class=\"t-wrapper\"><ng-content></ng-content></div>\n</div>\n<div class=\"t-percent\">\n <span>{{minLabel}}</span>\n <span>{{maxLabel}}</span>\n</div>\n",
|
|
132
|
+
template: "<svg\n *tuiRepeatTimes=\"let index of value.length\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"-100 -100 200 200\"\n focusable=\"false\"\n class=\"t-svg\"\n [style.top.em]=\"getInset(index)\"\n [style.left.em]=\"getInset(index)\"\n [style.width.em]=\"getDiameter(index)\"\n [style.height.em]=\"getDiameter(index)\"\n>\n <path\n vector-effect=\"non-scaling-stroke\"\n d=\"M -70 70 A 100 100 0 1 1 70 70\"\n />\n <path\n #arc\n vector-effect=\"non-scaling-stroke\"\n d=\"M -70 70 A 100 100 0 1 1 70 70\"\n class=\"t-value\"\n [class.t-value_inactive]=\"isInactive(index)\"\n [style.stroke]=\"getColor(index)\"\n [style.strokeDasharray.em]=\"getLength(index)\"\n [style.strokeDashoffset.em]=\"initialized ? getOffset(index) : getLength(index)\"\n />\n</svg>\n<div class=\"t-content\">\n <div class=\"t-wrapper\"><ng-content></ng-content></div>\n</div>\n<div class=\"t-percent\">\n <span>{{minLabel}}</span>\n <span>{{maxLabel}}</span>\n</div>\n",
|
|
104
133
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
105
|
-
styles: [":host{position:relative;display:block;flex-shrink:0}.t-svg{position:absolute;top:0;left:0;bottom:0;right:0;overflow:visible;fill:none;stroke:currentColor;stroke-linecap:round;color:var(--tui-secondary);font-size:1rem}.t-value{transition-property:stroke-dashoffset;transition-duration:var(--tui-duration,300ms);transition-timing-function:ease-in-out}.t-content{position:absolute;top:0;left:0;width:100%;height:100%;display:flex;justify-content:center;align-items:center;text-align:center;color:var(--tui-text-02);font:var(--tui-font-text-xs)}:host[data-size=xl] .t-content{font:var(--tui-font-text-m)}.t-wrapper{
|
|
134
|
+
styles: [":host{position:relative;display:block;flex-shrink:0}.t-svg{position:absolute;top:0;left:0;bottom:0;right:0;overflow:visible;fill:none;stroke:currentColor;stroke-linecap:round;color:var(--tui-secondary);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,300ms);transition-timing-function:ease-in-out;opacity:.16}.t-content{position:absolute;top:0;left:0;width:100%;height:100%;display:flex;justify-content:center;align-items:center;text-align:center;color:var(--tui-text-02);font:var(--tui-font-text-xs);pointer-events:none}:host[data-size=xl] .t-content{font:var(--tui-font-text-m)}.t-wrapper{pointer-events:auto}.t-wrapper:first-line{color:var(--tui-text-01)}:host[data-size='m'] .t-wrapper:first-line{font:var(--tui-font-text-s);font-weight:700}:host[data-size='l'] .t-wrapper:first-line{font:var(--tui-font-text-m);font-weight:700}:host[data-size=xl] .t-wrapper:first-line{font:var(--tui-font-heading-5)}.t-percent{position:absolute;left:25%;bottom:11%;display:flex;width:50%;justify-content:space-between;font:var(--tui-font-text-xs);color:var(--tui-text-02)}:host[data-size=xl] .t-percent{font:var(--tui-font-text-m)}"]
|
|
106
135
|
}),
|
|
107
136
|
__param(0, Inject(DomSanitizer)),
|
|
108
137
|
__param(1, Inject(ChangeDetectorRef))
|
|
109
138
|
], TuiArcChartComponent);
|
|
110
139
|
return TuiArcChartComponent;
|
|
111
140
|
}());
|
|
141
|
+
function arcsToIndex(arcs) {
|
|
142
|
+
return arcs
|
|
143
|
+
.toArray()
|
|
144
|
+
.map(function (_a, index) {
|
|
145
|
+
var nativeElement = _a.nativeElement;
|
|
146
|
+
return merge(typedFromEvent(nativeElement, 'mouseenter').pipe(mapTo(index)), typedFromEvent(nativeElement, 'mouseleave').pipe(mapTo(NaN)));
|
|
147
|
+
});
|
|
148
|
+
}
|
|
112
149
|
|
|
113
150
|
var TuiArcChartModule = /** @class */ (function () {
|
|
114
151
|
function TuiArcChartModule() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-addon-charts-components-arc-chart.js","sources":["ng://@taiga-ui/addon-charts/components/arc-chart/arc-chart.component.ts","ng://@taiga-ui/addon-charts/components/arc-chart/arc-chart.module.ts","ng://@taiga-ui/addon-charts/components/arc-chart/taiga-ui-addon-charts-components-arc-chart.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n HostBinding,\n Inject,\n Input,\n} from '@angular/core';\nimport {DomSanitizer, SafeValue} from '@angular/platform-browser';\nimport {tuiDefaultProp} from '@taiga-ui/cdk';\nimport {TuiSizeXL} from '@taiga-ui/core';\n\n// 3/4 with 1% safety offset\nconst ARC = 0.76;\n\nconst SIZE: Record<TuiSizeXL, number> = {\n m: 9,\n l: 11,\n xl: 16,\n};\n\nconst WIDTH: Record<TuiSizeXL, number> = {\n m: 0.25,\n l: 0.375,\n xl: 0.5625,\n};\n\nconst GAP: Record<TuiSizeXL, number> = {\n m: 0.125,\n l: 0.1875,\n xl: 0.25,\n};\n\n@Component({\n selector: 'tui-arc-chart',\n templateUrl: './arc-chart.template.html',\n styleUrls: ['./arc-chart.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class TuiArcChartComponent {\n @Input()\n @tuiDefaultProp()\n value: readonly number[] = [];\n\n @Input()\n @HostBinding('attr.data-size')\n @tuiDefaultProp()\n size: TuiSizeXL = 'm';\n\n @Input()\n @tuiDefaultProp()\n max = 100;\n\n @Input()\n @tuiDefaultProp()\n minLabel = '0%';\n\n @Input()\n @tuiDefaultProp()\n maxLabel = '100%';\n\n initialized = false;\n\n constructor(\n @Inject(DomSanitizer) private readonly sanitizer: DomSanitizer,\n @Inject(ChangeDetectorRef) changeDetectorRef: ChangeDetectorRef,\n ) {\n // So initial animation works\n setTimeout(() => {\n this.initialized = true;\n changeDetectorRef.markForCheck();\n });\n }\n\n @HostBinding('style.width.rem')\n @HostBinding('style.height.rem')\n get width(): number {\n return SIZE[this.size];\n }\n\n @HostBinding('style.strokeWidth.rem')\n get strokeWidth(): number {\n return WIDTH[this.size];\n }\n\n getInset(index: number): number {\n return this.strokeWidth / 2 + index * (this.strokeWidth + GAP[this.size]);\n }\n\n getDiameter(index: number): number {\n return SIZE[this.size] - 2 * this.getInset(index);\n }\n\n getLength(index: number): number {\n return Math.PI * this.getDiameter(index) * ARC;\n }\n\n getOffset(index: number): number {\n return this.getLength(index) * (1 - Math.min(this.value[index] / this.max, 1));\n }\n\n getColor(index: number): SafeValue {\n return this.sanitizer.bypassSecurityTrustStyle(\n `var(--tui-chart-${index}, var(--tui-support-0${index + 1}))`,\n );\n }\n}\n","import {NgModule} from '@angular/core';\nimport {TuiRepeatTimesModule} from '@taiga-ui/cdk';\n\nimport {TuiArcChartComponent} from './arc-chart.component';\n\n@NgModule({\n imports: [TuiRepeatTimesModule],\n declarations: [TuiArcChartComponent],\n exports: [TuiArcChartComponent],\n})\nexport class TuiArcChartModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"taiga-ui-addon-charts-components-arc-chart.js","sources":["ng://@taiga-ui/addon-charts/components/arc-chart/arc-chart.component.ts","ng://@taiga-ui/addon-charts/components/arc-chart/arc-chart.module.ts","ng://@taiga-ui/addon-charts/components/arc-chart/taiga-ui-addon-charts-components-arc-chart.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n HostBinding,\n Inject,\n Input,\n Output,\n QueryList,\n ViewChildren,\n} from '@angular/core';\nimport {DomSanitizer, SafeValue} from '@angular/platform-browser';\nimport {tuiDefaultProp, typedFromEvent} from '@taiga-ui/cdk';\nimport {TuiSizeXL} from '@taiga-ui/core';\nimport {merge, Observable, ReplaySubject} from 'rxjs';\nimport {mapTo, startWith, switchMap, tap} from 'rxjs/operators';\n\n// 3/4 with 1% safety offset\nconst ARC = 0.76;\n\nconst SIZE: Record<TuiSizeXL, number> = {\n m: 9,\n l: 11,\n xl: 16,\n};\n\nconst WIDTH: Record<TuiSizeXL, number> = {\n m: 0.25,\n l: 0.375,\n xl: 0.5625,\n};\n\nconst GAP: Record<TuiSizeXL, number> = {\n m: 0.125,\n l: 0.1875,\n xl: 0.25,\n};\n\n@Component({\n selector: 'tui-arc-chart',\n templateUrl: './arc-chart.template.html',\n styleUrls: ['./arc-chart.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class TuiArcChartComponent {\n private readonly arcs$ = new ReplaySubject<QueryList<ElementRef<SVGElement>>>(1);\n\n @ViewChildren('arc')\n set arcs(arcs: QueryList<ElementRef<SVGElement>>) {\n this.arcs$.next(arcs);\n }\n\n @Input()\n @tuiDefaultProp()\n value: readonly number[] = [];\n\n @Input()\n @HostBinding('attr.data-size')\n @tuiDefaultProp()\n size: TuiSizeXL = 'm';\n\n @Input()\n @tuiDefaultProp()\n max = 100;\n\n @Input()\n @tuiDefaultProp()\n minLabel = '0%';\n\n @Input()\n @tuiDefaultProp()\n maxLabel = '100%';\n\n @Input()\n @tuiDefaultProp()\n activeItemIndex = NaN;\n\n @Output()\n readonly activeItemIndexChange = this.arcs$.pipe(\n switchMap(arcs =>\n arcs.changes.pipe(\n startWith(null),\n switchMap(() => merge(...arcsToIndex(arcs))),\n ),\n ),\n tap(index => {\n this.activeItemIndex = index;\n }),\n );\n\n initialized = false;\n\n constructor(\n @Inject(DomSanitizer) private readonly sanitizer: DomSanitizer,\n @Inject(ChangeDetectorRef) changeDetectorRef: ChangeDetectorRef,\n ) {\n // So initial animation works\n setTimeout(() => {\n this.initialized = true;\n changeDetectorRef.markForCheck();\n });\n }\n\n @HostBinding('style.width.rem')\n @HostBinding('style.height.rem')\n get width(): number {\n return SIZE[this.size];\n }\n\n @HostBinding('style.strokeWidth.rem')\n get strokeWidth(): number {\n return WIDTH[this.size];\n }\n\n isInactive(index: number): boolean {\n return !isNaN(this.activeItemIndex) && index !== this.activeItemIndex;\n }\n\n getInset(index: number): number {\n return this.strokeWidth / 2 + index * (this.strokeWidth + GAP[this.size]);\n }\n\n getDiameter(index: number): number {\n return SIZE[this.size] - 2 * this.getInset(index);\n }\n\n getLength(index: number): number {\n return Math.PI * this.getDiameter(index) * ARC;\n }\n\n getOffset(index: number): number {\n return this.getLength(index) * (1 - Math.min(this.value[index] / this.max, 1));\n }\n\n getColor(index: number): SafeValue {\n return this.sanitizer.bypassSecurityTrustStyle(\n `var(--tui-chart-${index}, var(--tui-support-0${index + 1}))`,\n );\n }\n}\n\nfunction arcsToIndex(arcs: QueryList<ElementRef<SVGElement>>): Array<Observable<number>> {\n return arcs\n .toArray()\n .map(({nativeElement}, index) =>\n merge(\n typedFromEvent(nativeElement, 'mouseenter').pipe(mapTo(index)),\n typedFromEvent(nativeElement, 'mouseleave').pipe(mapTo(NaN)),\n ),\n );\n}\n","import {NgModule} from '@angular/core';\nimport {TuiRepeatTimesModule} from '@taiga-ui/cdk';\n\nimport {TuiArcChartComponent} from './arc-chart.component';\n\n@NgModule({\n imports: [TuiRepeatTimesModule],\n declarations: [TuiArcChartComponent],\n exports: [TuiArcChartComponent],\n})\nexport class TuiArcChartModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAkBA;AACA,IAAM,GAAG,GAAG,IAAI,CAAC;AAEjB,IAAM,IAAI,GAA8B;IACpC,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,EAAE;IACL,EAAE,EAAE,EAAE;CACT,CAAC;AAEF,IAAM,KAAK,GAA8B;IACrC,CAAC,EAAE,IAAI;IACP,CAAC,EAAE,KAAK;IACR,EAAE,EAAE,MAAM;CACb,CAAC;AAEF,IAAM,GAAG,GAA8B;IACnC,CAAC,EAAE,KAAK;IACR,CAAC,EAAE,MAAM;IACT,EAAE,EAAE,IAAI;CACX,CAAC;;IAwDE,8BAC2C,SAAuB,EACnC,iBAAoC;QAFnE,iBASC;QAR0C,cAAS,G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;QADC,MAAM,EAAE;uEAWP;IAiBF;QAFC,WAAW,CAAC,iBAAiB,CAAC;QAC9B,WAAW,CAAC,kBAAkB,CAAC;qDAG/B;IAGD;QADC,WAAW,CAAC,uBAAuB,CAAC;2DAGpC;IApEQ,oBAAoB;QANhC,SAAS,CAAC;YACP,QAAQ,EAAE,eAAe;YACzB,wjCAAwC;YAExC,eAAe,EAAE,uBAAuB,CAAC,MAAM;;SAClD,CAAC;QAkDO,WAAA,MAAM,CAAC,YAAY,CAAC,CAAA;QACpB,WAAA,MAAM,CAAC,iBAAiB,CAAC,CAAA;OAlDrB,oBAAoB,CA+FhC;IAAD,2BAAC;CA/FD,IA+FC;AAED,SAAS,WAAW,CAAC,IAAuC;IACxD,OAAO,IAAI;SACN,OAAO,EAAE;SACT,GAAG,CAAC,UAAC,EAAe,EAAE,KAAK;YAArB,gCAAa;QAChB,OAAA,KAAK,CACD,cAAc,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAC9D,cAAc,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAC/D;KAAA,CACJ,CAAC;AACV;;;IC7IA;KAAiC;IAApB,iBAAiB;QAL7B,QAAQ,CAAC;YACN,OAAO,EAAE,CAAC,oBAAoB,CAAC;YAC/B,YAAY,EAAE,CAAC,oBAAoB,CAAC;YACpC,OAAO,EAAE,CAAC,oBAAoB,CAAC;SAClC,CAAC;OACW,iBAAiB,CAAG;IAAD,wBAAC;CAAjC;;ACVA;;;;;;"}
|
|
@@ -303,7 +303,7 @@ var TuiLineChartComponent = /** @class */ (function () {
|
|
|
303
303
|
selector: 'tui-line-chart',
|
|
304
304
|
template: "<ng-container *tuiLet=\"hovered$ | async as hovered\">\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n focusable=\"false\"\n preserveAspectRatio=\"none\"\n width=\"100%\"\n height=\"100%\"\n class=\"t-svg\"\n [attr.viewBox]=\"viewBox\"\n >\n <defs>\n <linearGradient\n x1=\"0\"\n x2=\"0\"\n y1=\"1\"\n y2=\"0\"\n [attr.id]=\"fillId\"\n >\n <stop\n stop-color=\"currentColor\"\n offset=\"0%\"\n stop-opacity=\"0.5\"\n />\n <stop\n stop-color=\"currentColor\"\n offset=\"100%\"\n stop-opacity=\"0\"\n />\n </linearGradient>\n </defs>\n <path\n stroke=\"none\"\n [attr.fill]=\"fill\"\n [attr.d]=\"fillD\"\n />\n <path\n fill=\"none\"\n stroke=\"currentColor\"\n vector-effect=\"non-scaling-stroke\"\n stroke-width=\"2\"\n [attr.d]=\"d\"\n />\n </svg>\n <ng-container *ngIf=\"dots\">\n <div\n *ngFor=\"let point of value\"\n class=\"t-dot\"\n [style.left.%]=\"getLeft(point[0])\"\n [style.bottom.%]=\"getBottom(point[1])\"\n ></div>\n </ng-container>\n <ng-container *ngIf=\"hasHints\">\n <ng-container *ngFor=\"let point of value; let index = index\">\n <div\n *ngIf=\"value.length > 1 || dots\"\n tuiHintDirection=\"top-left\"\n class=\"t-column\"\n [class.t-column_hovered]=\"hovered === index\"\n [tuiHintHost]=\"hintHost\"\n [tuiHint]=\"hintDirective || hintContent ? hint : ''\"\n [tuiHintId]=\"getHintId(index)\"\n [style.left.%]=\"getLeft(getX(index))\"\n [style.width.%]=\"getWidth(index)\"\n (mouseenter)=\"onMouseEnter(index)\"\n >\n <div\n class=\"t-line t-line_vertical\"\n [style.left.%]=\"getOffset(index)\"\n ></div>\n <div\n #hintHost\n class=\"t-host\"\n [style.left.%]=\"getOffset(index)\"\n [style.bottom.%]=\"getBottom(point[1])\"\n [tuiFocusable]=\"isFocusable\"\n [tuiDescribedBy]=\"getHintId(index)\"\n ></div>\n </div>\n <div\n *ngIf=\"isFocusable\"\n class=\"t-line t-line_horizontal\"\n [style.bottom.%]=\"getBottom(point[1])\"\n ></div>\n <ng-template #hint>\n <div\n *ngIf=\"hintDirective else single\"\n polymorpheus-outlet\n class=\"t-text\"\n [content]=\"hintDirective.hint\"\n [context]=\"getContentContext(point, index)\"\n ></div>\n <ng-template #single>\n <div\n polymorpheus-outlet\n class=\"t-text\"\n [content]=\"hintContent\"\n [context]=\"{ $implicit: point, index: index }\"\n ></div>\n </ng-template>\n </ng-template>\n </ng-container>\n </ng-container>\n <ng-container *ngIf=\"getHovered(hovered) as point\">\n <div\n *ngIf=\"xStringify\"\n class=\"t-hint t-hint_x\"\n [style.left.%]=\"getLeft(point[0])\"\n >\n {{ xStringify(point[0]) }}\n </div>\n <div\n *ngIf=\"yStringify\"\n class=\"t-hint t-hint_y\"\n [style.bottom.%]=\"getBottom(point[1])\"\n >\n {{ yStringify(point[1]) }}\n </div>\n </ng-container>\n</ng-container>\n",
|
|
305
305
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
306
|
-
styles: [":host{display:flex;width:100%;height:100%;pointer-events:none}.t-svg{transform:scale(1,-1)}.t-column{position:absolute;top:0;height:100%;pointer-events:auto}.t-dot{position:absolute;width:.375rem;height:.375rem;border-radius:100%;background:currentColor;margin:-.1875rem;box-shadow:0 0 0 2px #fff}.t-host{position:absolute;left:50%;width:.5rem;height:.5rem;border-radius:100%;opacity:0;background:#fff;margin:-.25rem;box-shadow:0 0 0 2px currentColor,0 .0625rem .1875rem .125rem rgba(0,0,0,.1);outline:0;pointer-events:none}.column._hint_hovered .t-host,.column:hover .t-host,.column_hovered .t-host,.t-host:focus{opacity:1}.t-line{position:absolute;opacity:0;background:var(--tui-base-03)}.t-line_vertical{top:0;bottom:0;left:50%;width:1px}.t-line_horizontal{z-index:-1;width:100%;height:1px}:host:not([style]) .column._hint_hovered .t-line,:host:not([style]) .column._hint_hovered+.t-line,:host:not([style]) .column:hover .t-line,:host:not([style]) .column:hover+.t-line,:host[style^='z-index: 0'] .column_hovered .t-line,:host[style^='z-index: 0'] .column_hovered+.t-line{opacity:1}.t-text{white-space:pre-wrap}.t-hint{box-shadow:0 .25rem 1.5rem rgba(0,0,0,.12);position:absolute;font:var(--tui-font-text-xs);height:1.25rem;line-height:1.25rem;margin-bottom:-.625rem;padding:0 .375rem;white-space:nowrap;color:var(--tui-base-09);background:var(--tui-base-01);transform:translate3d(-50%,0,0)}.t-hint_x{bottom:0}.t-hint_y{left:0}"]
|
|
306
|
+
styles: [":host{display:flex;width:100%;height:100%;pointer-events:none}.t-svg{transform:scale(1,-1)}.t-column{position:absolute;top:0;height:100%;pointer-events:auto}.t-dot{position:absolute;width:.375rem;height:.375rem;border-radius:100%;background:currentColor;margin:-.1875rem;box-shadow:0 0 0 2px #fff}.t-host{position:absolute;left:50%;width:.5rem;height:.5rem;border-radius:100%;opacity:0;background:#fff;margin:-.25rem;box-shadow:0 0 0 2px currentColor,0 .0625rem .1875rem .125rem rgba(0,0,0,.1);outline:0;pointer-events:none}.t-column._hint_hovered .t-host,.t-column:hover .t-host,.t-column_hovered .t-host,.t-host:focus{opacity:1}.t-line{position:absolute;opacity:0;background:var(--tui-base-03)}.t-line_vertical{top:0;bottom:0;left:50%;width:1px}.t-line_horizontal{z-index:-1;width:100%;height:1px}:host:not([style]) .t-column._hint_hovered .t-line,:host:not([style]) .t-column._hint_hovered+.t-line,:host:not([style]) .t-column:hover .t-line,:host:not([style]) .t-column:hover+.t-line,:host[style^='z-index: 0'] .t-column_hovered .t-line,:host[style^='z-index: 0'] .t-column_hovered+.t-line{opacity:1}.t-text{white-space:pre-wrap}.t-hint{box-shadow:0 .25rem 1.5rem rgba(0,0,0,.12);position:absolute;font:var(--tui-font-text-xs);height:1.25rem;line-height:1.25rem;margin-bottom:-.625rem;padding:0 .375rem;white-space:nowrap;color:var(--tui-base-09);background:var(--tui-base-01);transform:translate3d(-50%,0,0)}.t-hint_x{bottom:0}.t-hint_y{left:0}"]
|
|
307
307
|
}),
|
|
308
308
|
__param(0, Inject(TuiIdService)),
|
|
309
309
|
__param(1, Inject(NgZone)),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taiga-ui/addon-charts",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.45.0",
|
|
4
4
|
"description": "Extension package for Taiga UI that adds various charts, graphs and related components.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"@angular/common": ">=9.0.0",
|
|
18
18
|
"@angular/core": ">=9.0.0",
|
|
19
19
|
"@ng-web-apis/common": ">=1.12.1 < 2",
|
|
20
|
-
"@taiga-ui/cdk": ">=2.
|
|
21
|
-
"@taiga-ui/core": ">=2.
|
|
20
|
+
"@taiga-ui/cdk": ">=2.45.0",
|
|
21
|
+
"@taiga-ui/core": ">=2.45.0",
|
|
22
22
|
"@tinkoff/ng-polymorpheus": ">=3.1.12 < 4"
|
|
23
23
|
},
|
|
24
24
|
"main": "bundles/taiga-ui-addon-charts.umd.js",
|