@taiga-ui/addon-charts 2.27.1 → 2.28.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.
Files changed (34) hide show
  1. package/bundles/taiga-ui-addon-charts-components-arc-chart.umd.js +352 -0
  2. package/bundles/taiga-ui-addon-charts-components-arc-chart.umd.js.map +1 -0
  3. package/bundles/taiga-ui-addon-charts-components-arc-chart.umd.min.js +16 -0
  4. package/bundles/taiga-ui-addon-charts-components-arc-chart.umd.min.js.map +1 -0
  5. package/bundles/taiga-ui-addon-charts-components.umd.js +12 -4
  6. package/bundles/taiga-ui-addon-charts-components.umd.js.map +1 -1
  7. package/bundles/taiga-ui-addon-charts-components.umd.min.js +1 -1
  8. package/components/arc-chart/arc-chart.component.d.ts +20 -0
  9. package/components/arc-chart/arc-chart.module.d.ts +2 -0
  10. package/components/arc-chart/index.d.ts +2 -0
  11. package/components/arc-chart/package.json +13 -0
  12. package/components/arc-chart/taiga-ui-addon-charts-components-arc-chart.d.ts +4 -0
  13. package/components/arc-chart/taiga-ui-addon-charts-components-arc-chart.metadata.json +1 -0
  14. package/components/index.d.ts +1 -0
  15. package/components/taiga-ui-addon-charts-components.metadata.json +1 -1
  16. package/esm2015/components/arc-chart/arc-chart.component.js +102 -0
  17. package/esm2015/components/arc-chart/arc-chart.module.js +15 -0
  18. package/esm2015/components/arc-chart/index.js +3 -0
  19. package/esm2015/components/arc-chart/taiga-ui-addon-charts-components-arc-chart.js +5 -0
  20. package/esm2015/components/index.js +2 -1
  21. package/esm5/components/arc-chart/arc-chart.component.js +112 -0
  22. package/esm5/components/arc-chart/arc-chart.module.js +18 -0
  23. package/esm5/components/arc-chart/index.js +3 -0
  24. package/esm5/components/arc-chart/taiga-ui-addon-charts-components-arc-chart.js +5 -0
  25. package/esm5/components/index.js +2 -1
  26. package/fesm2015/taiga-ui-addon-charts-components-arc-chart.js +118 -0
  27. package/fesm2015/taiga-ui-addon-charts-components-arc-chart.js.map +1 -0
  28. package/fesm2015/taiga-ui-addon-charts-components.js +1 -0
  29. package/fesm2015/taiga-ui-addon-charts-components.js.map +1 -1
  30. package/fesm5/taiga-ui-addon-charts-components-arc-chart.js +131 -0
  31. package/fesm5/taiga-ui-addon-charts-components-arc-chart.js.map +1 -0
  32. package/fesm5/taiga-ui-addon-charts-components.js +1 -0
  33. package/fesm5/taiga-ui-addon-charts-components.js.map +1 -1
  34. package/package.json +3 -3
@@ -0,0 +1,131 @@
1
+ import { __decorate, __param } from 'tslib';
2
+ import { Inject, ChangeDetectorRef, Input, HostBinding, Component, ChangeDetectionStrategy, NgModule } from '@angular/core';
3
+ import { DomSanitizer } from '@angular/platform-browser';
4
+ import { tuiDefaultProp, TuiRepeatTimesModule } from '@taiga-ui/cdk';
5
+
6
+ // 3/4 with 1% safety offset
7
+ var ARC = 0.76;
8
+ var SIZE = {
9
+ m: 9,
10
+ l: 11,
11
+ xl: 16,
12
+ };
13
+ var WIDTH = {
14
+ m: 0.25,
15
+ l: 0.375,
16
+ xl: 0.5625,
17
+ };
18
+ var GAP = {
19
+ m: 0.125,
20
+ l: 0.1875,
21
+ xl: 0.25,
22
+ };
23
+ var TuiArcChartComponent = /** @class */ (function () {
24
+ function TuiArcChartComponent(sanitizer, changeDetectorRef) {
25
+ var _this = this;
26
+ this.sanitizer = sanitizer;
27
+ this.value = [];
28
+ this.size = 'm';
29
+ this.max = 100;
30
+ this.minLabel = '0%';
31
+ this.maxLabel = '100%';
32
+ this.initialized = false;
33
+ // So initial animation works
34
+ setTimeout(function () {
35
+ _this.initialized = true;
36
+ changeDetectorRef.markForCheck();
37
+ });
38
+ }
39
+ Object.defineProperty(TuiArcChartComponent.prototype, "width", {
40
+ get: function () {
41
+ return SIZE[this.size];
42
+ },
43
+ enumerable: true,
44
+ configurable: true
45
+ });
46
+ Object.defineProperty(TuiArcChartComponent.prototype, "strokeWidth", {
47
+ get: function () {
48
+ return WIDTH[this.size];
49
+ },
50
+ enumerable: true,
51
+ configurable: true
52
+ });
53
+ TuiArcChartComponent.prototype.getInset = function (index) {
54
+ return this.strokeWidth / 2 + index * (this.strokeWidth + GAP[this.size]);
55
+ };
56
+ TuiArcChartComponent.prototype.getDiameter = function (index) {
57
+ return SIZE[this.size] - 2 * this.getInset(index);
58
+ };
59
+ TuiArcChartComponent.prototype.getLength = function (index) {
60
+ return Math.PI * this.getDiameter(index) * ARC;
61
+ };
62
+ TuiArcChartComponent.prototype.getOffset = function (index) {
63
+ return this.getLength(index) * (1 - Math.min(this.value[index] / this.max, 1));
64
+ };
65
+ TuiArcChartComponent.prototype.getColor = function (index) {
66
+ return this.sanitizer.bypassSecurityTrustStyle("var(--tui-chart-" + index + ", var(--tui-support-0" + (index + 1) + "))");
67
+ };
68
+ TuiArcChartComponent.ctorParameters = function () { return [
69
+ { type: DomSanitizer, decorators: [{ type: Inject, args: [DomSanitizer,] }] },
70
+ { type: ChangeDetectorRef, decorators: [{ type: Inject, args: [ChangeDetectorRef,] }] }
71
+ ]; };
72
+ __decorate([
73
+ Input(),
74
+ tuiDefaultProp()
75
+ ], TuiArcChartComponent.prototype, "value", void 0);
76
+ __decorate([
77
+ Input(),
78
+ HostBinding('attr.data-size'),
79
+ tuiDefaultProp()
80
+ ], TuiArcChartComponent.prototype, "size", void 0);
81
+ __decorate([
82
+ Input(),
83
+ tuiDefaultProp()
84
+ ], TuiArcChartComponent.prototype, "max", void 0);
85
+ __decorate([
86
+ Input(),
87
+ tuiDefaultProp()
88
+ ], TuiArcChartComponent.prototype, "minLabel", void 0);
89
+ __decorate([
90
+ Input(),
91
+ tuiDefaultProp()
92
+ ], TuiArcChartComponent.prototype, "maxLabel", void 0);
93
+ __decorate([
94
+ HostBinding('style.width.rem'),
95
+ HostBinding('style.height.rem')
96
+ ], TuiArcChartComponent.prototype, "width", null);
97
+ __decorate([
98
+ HostBinding('style.strokeWidth.rem')
99
+ ], TuiArcChartComponent.prototype, "strokeWidth", null);
100
+ TuiArcChartComponent = __decorate([
101
+ Component({
102
+ 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",
104
+ 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{flex:1}.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
+ }),
107
+ __param(0, Inject(DomSanitizer)),
108
+ __param(1, Inject(ChangeDetectorRef))
109
+ ], TuiArcChartComponent);
110
+ return TuiArcChartComponent;
111
+ }());
112
+
113
+ var TuiArcChartModule = /** @class */ (function () {
114
+ function TuiArcChartModule() {
115
+ }
116
+ TuiArcChartModule = __decorate([
117
+ NgModule({
118
+ imports: [TuiRepeatTimesModule],
119
+ declarations: [TuiArcChartComponent],
120
+ exports: [TuiArcChartComponent],
121
+ })
122
+ ], TuiArcChartModule);
123
+ return TuiArcChartModule;
124
+ }());
125
+
126
+ /**
127
+ * Generated bundle index. Do not edit.
128
+ */
129
+
130
+ export { TuiArcChartComponent, TuiArcChartModule };
131
+ //# sourceMappingURL=taiga-ui-addon-charts-components-arc-chart.js.map
@@ -0,0 +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":";;;;;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B,oBAAoB,CAmEhC;IAAD,2BAAC;CAnED;;;IC7BA;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;;;;;;"}
@@ -1,3 +1,4 @@
1
+ export * from '@taiga-ui/addon-charts/components/arc-chart';
1
2
  export * from '@taiga-ui/addon-charts/components/axes';
2
3
  export * from '@taiga-ui/addon-charts/components/bar';
3
4
  export * from '@taiga-ui/addon-charts/components/bar-chart';
@@ -1 +1 @@
1
- {"version":3,"file":"taiga-ui-addon-charts-components.js","sources":["ng://@taiga-ui/addon-charts/components/taiga-ui-addon-charts-components.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;AAAA;;"}
1
+ {"version":3,"file":"taiga-ui-addon-charts-components.js","sources":["ng://@taiga-ui/addon-charts/components/taiga-ui-addon-charts-components.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;AAAA;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taiga-ui/addon-charts",
3
- "version": "2.27.1",
3
+ "version": "2.28.0",
4
4
  "description": "Extension package for Taiga UI that adds various charts, graphs and related components.",
5
5
  "keywords": [
6
6
  "angular",
@@ -18,8 +18,8 @@
18
18
  "@angular/core": ">=9.0.0",
19
19
  "@ng-web-apis/common": "1.12.1",
20
20
  "@tinkoff/ng-polymorpheus": "3.1.12",
21
- "@taiga-ui/cdk": "2.27.1",
22
- "@taiga-ui/core": "2.27.1"
21
+ "@taiga-ui/cdk": "2.28.0",
22
+ "@taiga-ui/core": "2.28.0"
23
23
  },
24
24
  "main": "bundles/taiga-ui-addon-charts.umd.js",
25
25
  "module": "fesm5/taiga-ui-addon-charts.js",