@semcore/mini-chart 0.30.0-prerelease.0 → 0.30.0-prerelease.4
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/lib/cjs/component/score/Donut.js +64 -60
- package/lib/cjs/component/score/Donut.js.map +1 -1
- package/lib/cjs/component/score/Line.js +41 -38
- package/lib/cjs/component/score/Line.js.map +1 -1
- package/lib/cjs/component/score/Line.types.js.map +1 -1
- package/lib/cjs/component/score/Score.js.map +1 -1
- package/lib/cjs/component/score/index.js.map +1 -1
- package/lib/cjs/component/score/line.shadow.css +1 -1
- package/lib/cjs/component/trend/Bar.js +28 -22
- package/lib/cjs/component/trend/Bar.js.map +1 -1
- package/lib/cjs/component/trend/Line.js +26 -20
- package/lib/cjs/component/trend/Line.js.map +1 -1
- package/lib/cjs/component/trend/Trend.js +13 -9
- package/lib/cjs/component/trend/Trend.js.map +1 -1
- package/lib/cjs/component/trend/index.js +1 -1
- package/lib/cjs/component/trend/index.js.map +1 -1
- package/lib/cjs/index.js +2 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/es6/component/score/Donut.js +58 -57
- package/lib/es6/component/score/Donut.js.map +1 -1
- package/lib/es6/component/score/Line.js +31 -31
- package/lib/es6/component/score/Line.js.map +1 -1
- package/lib/es6/component/score/Line.types.js.map +1 -1
- package/lib/es6/component/score/Score.js.map +1 -1
- package/lib/es6/component/score/index.js.map +1 -1
- package/lib/es6/component/score/line.shadow.css +1 -1
- package/lib/es6/component/trend/Bar.js +21 -19
- package/lib/es6/component/trend/Bar.js.map +1 -1
- package/lib/es6/component/trend/Line.js +19 -17
- package/lib/es6/component/trend/Line.js.map +1 -1
- package/lib/es6/component/trend/Trend.js +10 -7
- package/lib/es6/component/trend/Trend.js.map +1 -1
- package/lib/es6/component/trend/index.js +1 -1
- package/lib/es6/component/trend/index.js.map +1 -1
- package/lib/es6/index.js.map +1 -1
- package/lib/esm/component/score/Donut.mjs +61 -58
- package/lib/esm/component/score/Line.mjs +37 -35
- package/lib/esm/component/score/line.shadow.css +1 -1
- package/lib/esm/component/trend/Bar.mjs +23 -20
- package/lib/esm/component/trend/Line.mjs +23 -20
- package/lib/esm/component/trend/Trend.mjs +12 -9
- package/lib/esm/index.mjs +3 -5
- package/lib/types/component/score/Donut.d.ts +11 -8
- package/lib/types/component/score/Line.d.ts +1 -1
- package/lib/types/component/score/Line.types.d.ts +9 -11
- package/lib/types/component/trend/Bar.d.ts +9 -3
- package/lib/types/component/trend/Line.d.ts +11 -7
- package/lib/types/component/trend/Trend.d.ts +4 -4
- package/lib/types/component/trend/index.d.ts +1 -1
- package/package.json +4 -4
- package/lib/cjs/utils/ScoreDonutUtils.js +0 -87
- package/lib/cjs/utils/ScoreDonutUtils.js.map +0 -1
- package/lib/es6/utils/ScoreDonutUtils.js +0 -80
- package/lib/es6/utils/ScoreDonutUtils.js.map +0 -1
- package/lib/esm/component/score/index.mjs +0 -7
- package/lib/esm/component/trend/index.mjs +0 -8
- package/lib/esm/utils/ScoreDonutUtils.mjs +0 -82
- package/lib/types/utils/ScoreDonutUtils.d.ts +0 -18
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentType } from '@semcore/core';
|
|
2
|
+
import resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';
|
|
3
|
+
import { CommonTrendProps } from './Trend';
|
|
2
4
|
type BarItem = {
|
|
3
5
|
/**
|
|
4
6
|
* Value
|
|
@@ -15,6 +17,10 @@ export type TrendBarProps = CommonTrendProps & {
|
|
|
15
17
|
*/
|
|
16
18
|
data: BarItem[];
|
|
17
19
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
type Enhances = {
|
|
21
|
+
resolveColor: ReturnType<typeof resolveColorEnhance>;
|
|
22
|
+
isHistogram?: true;
|
|
23
|
+
};
|
|
24
|
+
export declare const TrendBar: ComponentType<TrendBarProps, {}, {}, Enhances>;
|
|
25
|
+
export declare const TrendHistogram: ComponentType<TrendBarProps, {}, {}, Enhances>;
|
|
20
26
|
export {};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentType } from '@semcore/core';
|
|
2
|
+
import resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';
|
|
3
|
+
import { CommonTrendProps } from './Trend';
|
|
2
4
|
export type TrendLineProps = CommonTrendProps & {
|
|
3
5
|
/**
|
|
4
6
|
* List of values
|
|
@@ -17,9 +19,11 @@ export type TrendLineProps = CommonTrendProps & {
|
|
|
17
19
|
*/
|
|
18
20
|
lastPointRadius?: number;
|
|
19
21
|
};
|
|
20
|
-
|
|
21
|
-
uid:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
22
|
+
type Enhances = {
|
|
23
|
+
uid: string;
|
|
24
|
+
resolveColor: ReturnType<typeof resolveColorEnhance>;
|
|
25
|
+
withArea?: true;
|
|
26
|
+
};
|
|
27
|
+
export declare const TrendLine: ComponentType<TrendLineProps, {}, {}, Enhances>;
|
|
28
|
+
export declare const TrendArea: ComponentType<TrendLineProps, {}, {}, Enhances>;
|
|
29
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { BoxProps } from '@semcore/base-components';
|
|
2
|
-
import { Component } from '@semcore/core';
|
|
3
1
|
import React from 'react';
|
|
2
|
+
import { Component } from '@semcore/core';
|
|
3
|
+
import { BoxProps } from '@semcore/flex-box';
|
|
4
4
|
export type CommonTrendProps = BoxProps & {
|
|
5
5
|
/**
|
|
6
6
|
* Flag to enable animate of charts
|
|
@@ -17,10 +17,10 @@ export type CommonTrendProps = BoxProps & {
|
|
|
17
17
|
*/
|
|
18
18
|
data: any[];
|
|
19
19
|
};
|
|
20
|
-
export declare abstract class Trend<P extends CommonTrendProps, E extends readonly ((...args: any[]) => any)[]> extends Component<P,
|
|
20
|
+
export declare abstract class Trend<P extends CommonTrendProps, E extends readonly ((...args: any[]) => any)[]> extends Component<P, {}, {
|
|
21
21
|
width: number;
|
|
22
22
|
height: number;
|
|
23
|
-
}> {
|
|
23
|
+
}, E> {
|
|
24
24
|
state: {
|
|
25
25
|
width: number;
|
|
26
26
|
height: number;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/mini-chart",
|
|
3
3
|
"description": "Semrush MiniChart Component",
|
|
4
|
-
"version": "0.30.0-prerelease.
|
|
4
|
+
"version": "0.30.0-prerelease.4",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
"types": "./lib/types/index.d.ts"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@semcore/flex-box": "5.42.0-prerelease.
|
|
18
|
-
"@semcore/utils": "4.49.0-prerelease.
|
|
17
|
+
"@semcore/flex-box": "5.42.0-prerelease.4",
|
|
18
|
+
"@semcore/utils": "4.49.0-prerelease.4"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"@semcore/core": "^2.40.0-prerelease.
|
|
21
|
+
"@semcore/core": "^2.40.0-prerelease.4",
|
|
22
22
|
"react": "16.8 - 18",
|
|
23
23
|
"react-dom": "16.8 - 18"
|
|
24
24
|
},
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.ScoreDonutUtils = void 0;
|
|
8
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
var ScoreDonutUtils = exports.ScoreDonutUtils = /*#__PURE__*/function () {
|
|
12
|
-
function ScoreDonutUtils(value, isSemiDonut) {
|
|
13
|
-
(0, _classCallCheck2["default"])(this, ScoreDonutUtils);
|
|
14
|
-
(0, _defineProperty2["default"])(this, "isSemiDonut", void 0);
|
|
15
|
-
(0, _defineProperty2["default"])(this, "value", void 0);
|
|
16
|
-
(0, _defineProperty2["default"])(this, "radius", void 0);
|
|
17
|
-
this.isSemiDonut = isSemiDonut;
|
|
18
|
-
this.radius = isSemiDonut ? 9 : 10;
|
|
19
|
-
this.value = Math.max(Math.min(value, 100), 0);
|
|
20
|
-
}
|
|
21
|
-
return (0, _createClass2["default"])(ScoreDonutUtils, [{
|
|
22
|
-
key: "viewBox",
|
|
23
|
-
get: function get() {
|
|
24
|
-
return this.isSemiDonut ? '0 0 24 12' : '0 0 24 24';
|
|
25
|
-
}
|
|
26
|
-
}, {
|
|
27
|
-
key: "strokeWidth",
|
|
28
|
-
get: function get() {
|
|
29
|
-
return this.isSemiDonut ? 6 : 4;
|
|
30
|
-
}
|
|
31
|
-
}, {
|
|
32
|
-
key: "fullLength",
|
|
33
|
-
get: function get() {
|
|
34
|
-
return this.isSemiDonut ? Math.PI * this.radius : 2 * Math.PI * this.radius;
|
|
35
|
-
}
|
|
36
|
-
}, {
|
|
37
|
-
key: "point",
|
|
38
|
-
get: function get() {
|
|
39
|
-
return this.isSemiDonut ? this.fullLength / (100 / 3) : this.fullLength / 100;
|
|
40
|
-
}
|
|
41
|
-
}, {
|
|
42
|
-
key: "valueLength",
|
|
43
|
-
get: function get() {
|
|
44
|
-
return this.fullLength * (this.value / 100);
|
|
45
|
-
}
|
|
46
|
-
}, {
|
|
47
|
-
key: "animatedValueLength",
|
|
48
|
-
get: function get() {
|
|
49
|
-
return Math.min(this.valueLength, this.fullLength - this.startMargin - this.endMargin);
|
|
50
|
-
}
|
|
51
|
-
}, {
|
|
52
|
-
key: "startMargin",
|
|
53
|
-
get: function get() {
|
|
54
|
-
var margin = 0;
|
|
55
|
-
if (this.value > 0) margin = this.point;
|
|
56
|
-
return margin;
|
|
57
|
-
}
|
|
58
|
-
}, {
|
|
59
|
-
key: "endMargin",
|
|
60
|
-
get: function get() {
|
|
61
|
-
var margin = 0;
|
|
62
|
-
if (!this.isSemiDonut && this.value > 0) margin = this.point;
|
|
63
|
-
return margin;
|
|
64
|
-
}
|
|
65
|
-
}, {
|
|
66
|
-
key: "baseOffset",
|
|
67
|
-
get: function get() {
|
|
68
|
-
return -1 * (this.valueLength + this.startMargin);
|
|
69
|
-
}
|
|
70
|
-
}, {
|
|
71
|
-
key: "baseLength",
|
|
72
|
-
get: function get() {
|
|
73
|
-
return Math.max(this.fullLength - this.valueLength - this.startMargin - this.endMargin, 0);
|
|
74
|
-
}
|
|
75
|
-
}, {
|
|
76
|
-
key: "animatedBaseLengthFrom",
|
|
77
|
-
get: function get() {
|
|
78
|
-
return this.fullLength - this.startMargin - this.endMargin;
|
|
79
|
-
}
|
|
80
|
-
}, {
|
|
81
|
-
key: "animatedBaseLengthTo",
|
|
82
|
-
get: function get() {
|
|
83
|
-
return this.fullLength - this.valueLength - this.startMargin - this.endMargin;
|
|
84
|
-
}
|
|
85
|
-
}]);
|
|
86
|
-
}();
|
|
87
|
-
//# sourceMappingURL=ScoreDonutUtils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ScoreDonutUtils.js","names":["ScoreDonutUtils","exports","value","isSemiDonut","_classCallCheck2","_defineProperty2","radius","Math","max","min","_createClass2","key","get","PI","fullLength","valueLength","startMargin","endMargin","margin","point"],"sources":["../../../src/utils/ScoreDonutUtils.ts"],"sourcesContent":["export class ScoreDonutUtils {\n private readonly isSemiDonut: boolean;\n private readonly value: number;\n\n public readonly radius: number;\n\n constructor(value: number, isSemiDonut: boolean) {\n this.isSemiDonut = isSemiDonut;\n this.radius = isSemiDonut ? 9 : 10;\n this.value = Math.max(Math.min(value, 100), 0);\n }\n\n public get viewBox() {\n return this.isSemiDonut ? '0 0 24 12' : '0 0 24 24';\n }\n\n public get strokeWidth() {\n return this.isSemiDonut ? 6 : 4;\n }\n\n public get fullLength() {\n return this.isSemiDonut ? Math.PI * this.radius : 2 * Math.PI * this.radius;\n }\n\n public get point() {\n return this.isSemiDonut\n ? this.fullLength / (100 / 3)\n : this.fullLength / 100;\n }\n\n public get valueLength() {\n return this.fullLength * (this.value / 100);\n }\n\n public get animatedValueLength() {\n return Math.min(this.valueLength, this.fullLength - this.startMargin - this.endMargin);\n }\n\n public get startMargin() {\n let margin = 0;\n if (this.value > 0) margin = this.point;\n return margin;\n }\n\n public get endMargin() {\n let margin = 0;\n if (!this.isSemiDonut && this.value > 0) margin = this.point;\n return margin;\n }\n\n public get baseOffset() {\n return -1 * (this.valueLength + this.startMargin);\n };\n\n public get baseLength() {\n return Math.max(this.fullLength - this.valueLength - this.startMargin - this.endMargin, 0);\n }\n\n public get animatedBaseLengthFrom() {\n return this.fullLength - this.startMargin - this.endMargin;\n }\n\n public get animatedBaseLengthTo() {\n return this.fullLength - this.valueLength - this.startMargin - this.endMargin;\n }\n}\n"],"mappings":";;;;;;;;;;IAAaA,eAAe,GAAAC,OAAA,CAAAD,eAAA;EAM1B,SAAAA,gBAAYE,KAAa,EAAEC,WAAoB,EAAE;IAAA,IAAAC,gBAAA,mBAAAJ,eAAA;IAAA,IAAAK,gBAAA;IAAA,IAAAA,gBAAA;IAAA,IAAAA,gBAAA;IAC/C,IAAI,CAACF,WAAW,GAAGA,WAAW;IAC9B,IAAI,CAACG,MAAM,GAAGH,WAAW,GAAG,CAAC,GAAG,EAAE;IAClC,IAAI,CAACD,KAAK,GAAGK,IAAI,CAACC,GAAG,CAACD,IAAI,CAACE,GAAG,CAACP,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;EAChD;EAAC,WAAAQ,aAAA,aAAAV,eAAA;IAAAW,GAAA;IAAAC,GAAA,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C,IAAI,CAACf,WAAW,IAAI,IAAI,CAACD,KAAK,GAAG,CAAC,EAAEgB,MAAM,GAAG,IAAI,CAACC,KAAK;MAC5D,OAAOD,MAAM;IACf;EAAC;IAAAP,GAAA;IAAAC,GAAA,EAED,SAAAA,IAAA,EAAwB;MACtB,OAAO,CAAC,CAAC,IAAI,IAAI,CAACG,WAAW,GAAG,IAAI,CAACC,WAAW,CAAC;IACnD;EAAC;IAAAL,GAAA;IAAAC,GAAA,EAED,SAAAA,IAAA,EAAwB;MACtB,OAAOL,IAAI,CAACC,GAAG,CAAC,IAAI,CAACM,UAAU,GAAG,IAAI,CAACC,WAAW,GAAG,IAAI,CAACC,WAAW,GAAG,IAAI,CAACC,SAAS,EAAE,CAAC,CAAC;IAC5F;EAAC;IAAAN,GAAA;IAAAC,GAAA,EAED,SAAAA,IAAA,EAAoC;MAClC,OAAO,IAAI,CAACE,UAAU,GAAG,IAAI,CAACE,WAAW,GAAG,IAAI,CAACC,SAAS;IAC5D;EAAC;IAAAN,GAAA;IAAAC,GAAA,EAED,SAAAA,IAAA,EAAkC;MAChC,OAAO,IAAI,CAACE,UAAU,GAAG,IAAI,CAACC,WAAW,GAAG,IAAI,CAACC,WAAW,GAAG,IAAI,CAACC,SAAS;IAC/E;EAAC;AAAA","ignoreList":[]}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
-
export var ScoreDonutUtils = /*#__PURE__*/function () {
|
|
5
|
-
function ScoreDonutUtils(value, isSemiDonut) {
|
|
6
|
-
_classCallCheck(this, ScoreDonutUtils);
|
|
7
|
-
_defineProperty(this, "isSemiDonut", void 0);
|
|
8
|
-
_defineProperty(this, "value", void 0);
|
|
9
|
-
_defineProperty(this, "radius", void 0);
|
|
10
|
-
this.isSemiDonut = isSemiDonut;
|
|
11
|
-
this.radius = isSemiDonut ? 9 : 10;
|
|
12
|
-
this.value = Math.max(Math.min(value, 100), 0);
|
|
13
|
-
}
|
|
14
|
-
return _createClass(ScoreDonutUtils, [{
|
|
15
|
-
key: "viewBox",
|
|
16
|
-
get: function get() {
|
|
17
|
-
return this.isSemiDonut ? '0 0 24 12' : '0 0 24 24';
|
|
18
|
-
}
|
|
19
|
-
}, {
|
|
20
|
-
key: "strokeWidth",
|
|
21
|
-
get: function get() {
|
|
22
|
-
return this.isSemiDonut ? 6 : 4;
|
|
23
|
-
}
|
|
24
|
-
}, {
|
|
25
|
-
key: "fullLength",
|
|
26
|
-
get: function get() {
|
|
27
|
-
return this.isSemiDonut ? Math.PI * this.radius : 2 * Math.PI * this.radius;
|
|
28
|
-
}
|
|
29
|
-
}, {
|
|
30
|
-
key: "point",
|
|
31
|
-
get: function get() {
|
|
32
|
-
return this.isSemiDonut ? this.fullLength / (100 / 3) : this.fullLength / 100;
|
|
33
|
-
}
|
|
34
|
-
}, {
|
|
35
|
-
key: "valueLength",
|
|
36
|
-
get: function get() {
|
|
37
|
-
return this.fullLength * (this.value / 100);
|
|
38
|
-
}
|
|
39
|
-
}, {
|
|
40
|
-
key: "animatedValueLength",
|
|
41
|
-
get: function get() {
|
|
42
|
-
return Math.min(this.valueLength, this.fullLength - this.startMargin - this.endMargin);
|
|
43
|
-
}
|
|
44
|
-
}, {
|
|
45
|
-
key: "startMargin",
|
|
46
|
-
get: function get() {
|
|
47
|
-
var margin = 0;
|
|
48
|
-
if (this.value > 0) margin = this.point;
|
|
49
|
-
return margin;
|
|
50
|
-
}
|
|
51
|
-
}, {
|
|
52
|
-
key: "endMargin",
|
|
53
|
-
get: function get() {
|
|
54
|
-
var margin = 0;
|
|
55
|
-
if (!this.isSemiDonut && this.value > 0) margin = this.point;
|
|
56
|
-
return margin;
|
|
57
|
-
}
|
|
58
|
-
}, {
|
|
59
|
-
key: "baseOffset",
|
|
60
|
-
get: function get() {
|
|
61
|
-
return -1 * (this.valueLength + this.startMargin);
|
|
62
|
-
}
|
|
63
|
-
}, {
|
|
64
|
-
key: "baseLength",
|
|
65
|
-
get: function get() {
|
|
66
|
-
return Math.max(this.fullLength - this.valueLength - this.startMargin - this.endMargin, 0);
|
|
67
|
-
}
|
|
68
|
-
}, {
|
|
69
|
-
key: "animatedBaseLengthFrom",
|
|
70
|
-
get: function get() {
|
|
71
|
-
return this.fullLength - this.startMargin - this.endMargin;
|
|
72
|
-
}
|
|
73
|
-
}, {
|
|
74
|
-
key: "animatedBaseLengthTo",
|
|
75
|
-
get: function get() {
|
|
76
|
-
return this.fullLength - this.valueLength - this.startMargin - this.endMargin;
|
|
77
|
-
}
|
|
78
|
-
}]);
|
|
79
|
-
}();
|
|
80
|
-
//# sourceMappingURL=ScoreDonutUtils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ScoreDonutUtils.js","names":["ScoreDonutUtils","value","isSemiDonut","_classCallCheck","_defineProperty","radius","Math","max","min","_createClass","key","get","PI","fullLength","valueLength","startMargin","endMargin","margin","point"],"sources":["../../../src/utils/ScoreDonutUtils.ts"],"sourcesContent":["export class ScoreDonutUtils {\n private readonly isSemiDonut: boolean;\n private readonly value: number;\n\n public readonly radius: number;\n\n constructor(value: number, isSemiDonut: boolean) {\n this.isSemiDonut = isSemiDonut;\n this.radius = isSemiDonut ? 9 : 10;\n this.value = Math.max(Math.min(value, 100), 0);\n }\n\n public get viewBox() {\n return this.isSemiDonut ? '0 0 24 12' : '0 0 24 24';\n }\n\n public get strokeWidth() {\n return this.isSemiDonut ? 6 : 4;\n }\n\n public get fullLength() {\n return this.isSemiDonut ? Math.PI * this.radius : 2 * Math.PI * this.radius;\n }\n\n public get point() {\n return this.isSemiDonut\n ? this.fullLength / (100 / 3)\n : this.fullLength / 100;\n }\n\n public get valueLength() {\n return this.fullLength * (this.value / 100);\n }\n\n public get animatedValueLength() {\n return Math.min(this.valueLength, this.fullLength - this.startMargin - this.endMargin);\n }\n\n public get startMargin() {\n let margin = 0;\n if (this.value > 0) margin = this.point;\n return margin;\n }\n\n public get endMargin() {\n let margin = 0;\n if (!this.isSemiDonut && this.value > 0) margin = this.point;\n return margin;\n }\n\n public get baseOffset() {\n return -1 * (this.valueLength + this.startMargin);\n };\n\n public get baseLength() {\n return Math.max(this.fullLength - this.valueLength - this.startMargin - this.endMargin, 0);\n }\n\n public get animatedBaseLengthFrom() {\n return this.fullLength - this.startMargin - this.endMargin;\n }\n\n public get animatedBaseLengthTo() {\n return this.fullLength - this.valueLength - this.startMargin - this.endMargin;\n }\n}\n"],"mappings":";;;AAAA,WAAaA,eAAe;EAM1B,SAAAA,gBAAYC,KAAa,EAAEC,WAAoB,EAAE;IAAAC,eAAA,OAAAH,eAAA;IAAAI,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAC/C,IAAI,CAACF,WAAW,GAAGA,WAAW;IAC9B,IAAI,CAACG,MAAM,GAAGH,WAAW,GAAG,CAAC,GAAG,EAAE;IAClC,IAAI,CAACD,KAAK,GAAGK,IAAI,CAACC,GAAG,CAACD,IAAI,CAACE,GAAG,CAACP,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;EAChD;EAAC,OAAAQ,YAAA,CAAAT,eAAA;IAAAU,GAAA;IAAAC,GAAA,EAED,SAAAA,IAAA,EAAqB;MACnB,OAAO,IAAI,CAACT,WAAW,GAAG,WAAW,GAAG,WAAW;IACrD;EAAC;IAAAQ,GAAA;IAAAC,GAAA,EAED,SAAAA,IAAA,EAAyB;MACvB,OAAO,IAAI,CAACT,WAAW,GAAG,CAAC,GAAG,CAAC;IACjC;EAAC;IAAAQ,GAAA;IAAAC,GAAA,EAED,SAAAA,IAAA,EAAwB;MACtB,OAAO,IAAI,CAACT,WAAW,GAAGI,IAAI,CAACM,EAAE,GAAG,IAAI,CAACP,MAAM,GAAG,CAAC,GAAGC,IAAI,CAACM,EAAE,GAAG,IAAI,CAACP,MAAM;IAC7E;EAAC;IAAAK,G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AG,IAAI,CAACC,SAAS,EAAE,CAAC,CAAC;IAC5F;EAAC;IAAAN,GAAA;IAAAC,GAAA,EAED,SAAAA,IAAA,EAAoC;MAClC,OAAO,IAAI,CAACE,UAAU,GAAG,IAAI,CAACE,WAAW,GAAG,IAAI,CAACC,SAAS;IAC5D;EAAC;IAAAN,GAAA;IAAAC,GAAA,EAED,SAAAA,IAAA,EAAkC;MAChC,OAAO,IAAI,CAACE,UAAU,GAAG,IAAI,CAACC,WAAW,GAAG,IAAI,CAACC,WAAW,GAAG,IAAI,CAACC,SAAS;IAC/E;EAAC;AAAA","ignoreList":[]}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
|
-
var ScoreDonutUtils = /* @__PURE__ */ (function() {
|
|
5
|
-
function ScoreDonutUtils2(value, isSemiDonut) {
|
|
6
|
-
_classCallCheck(this, ScoreDonutUtils2);
|
|
7
|
-
_defineProperty(this, "isSemiDonut", void 0);
|
|
8
|
-
_defineProperty(this, "value", void 0);
|
|
9
|
-
_defineProperty(this, "radius", void 0);
|
|
10
|
-
this.isSemiDonut = isSemiDonut;
|
|
11
|
-
this.radius = isSemiDonut ? 9 : 10;
|
|
12
|
-
this.value = Math.max(Math.min(value, 100), 0);
|
|
13
|
-
}
|
|
14
|
-
return _createClass(ScoreDonutUtils2, [{
|
|
15
|
-
key: "viewBox",
|
|
16
|
-
get: function get() {
|
|
17
|
-
return this.isSemiDonut ? "0 0 24 12" : "0 0 24 24";
|
|
18
|
-
}
|
|
19
|
-
}, {
|
|
20
|
-
key: "strokeWidth",
|
|
21
|
-
get: function get() {
|
|
22
|
-
return this.isSemiDonut ? 6 : 4;
|
|
23
|
-
}
|
|
24
|
-
}, {
|
|
25
|
-
key: "fullLength",
|
|
26
|
-
get: function get() {
|
|
27
|
-
return this.isSemiDonut ? Math.PI * this.radius : 2 * Math.PI * this.radius;
|
|
28
|
-
}
|
|
29
|
-
}, {
|
|
30
|
-
key: "point",
|
|
31
|
-
get: function get() {
|
|
32
|
-
return this.isSemiDonut ? this.fullLength / (100 / 3) : this.fullLength / 100;
|
|
33
|
-
}
|
|
34
|
-
}, {
|
|
35
|
-
key: "valueLength",
|
|
36
|
-
get: function get() {
|
|
37
|
-
return this.fullLength * (this.value / 100);
|
|
38
|
-
}
|
|
39
|
-
}, {
|
|
40
|
-
key: "animatedValueLength",
|
|
41
|
-
get: function get() {
|
|
42
|
-
return Math.min(this.valueLength, this.fullLength - this.startMargin - this.endMargin);
|
|
43
|
-
}
|
|
44
|
-
}, {
|
|
45
|
-
key: "startMargin",
|
|
46
|
-
get: function get() {
|
|
47
|
-
var margin = 0;
|
|
48
|
-
if (this.value > 0) margin = this.point;
|
|
49
|
-
return margin;
|
|
50
|
-
}
|
|
51
|
-
}, {
|
|
52
|
-
key: "endMargin",
|
|
53
|
-
get: function get() {
|
|
54
|
-
var margin = 0;
|
|
55
|
-
if (!this.isSemiDonut && this.value > 0) margin = this.point;
|
|
56
|
-
return margin;
|
|
57
|
-
}
|
|
58
|
-
}, {
|
|
59
|
-
key: "baseOffset",
|
|
60
|
-
get: function get() {
|
|
61
|
-
return -1 * (this.valueLength + this.startMargin);
|
|
62
|
-
}
|
|
63
|
-
}, {
|
|
64
|
-
key: "baseLength",
|
|
65
|
-
get: function get() {
|
|
66
|
-
return Math.max(this.fullLength - this.valueLength - this.startMargin - this.endMargin, 0);
|
|
67
|
-
}
|
|
68
|
-
}, {
|
|
69
|
-
key: "animatedBaseLengthFrom",
|
|
70
|
-
get: function get() {
|
|
71
|
-
return this.fullLength - this.startMargin - this.endMargin;
|
|
72
|
-
}
|
|
73
|
-
}, {
|
|
74
|
-
key: "animatedBaseLengthTo",
|
|
75
|
-
get: function get() {
|
|
76
|
-
return this.fullLength - this.valueLength - this.startMargin - this.endMargin;
|
|
77
|
-
}
|
|
78
|
-
}]);
|
|
79
|
-
})();
|
|
80
|
-
export {
|
|
81
|
-
ScoreDonutUtils
|
|
82
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export declare class ScoreDonutUtils {
|
|
2
|
-
private readonly isSemiDonut;
|
|
3
|
-
private readonly value;
|
|
4
|
-
readonly radius: number;
|
|
5
|
-
constructor(value: number, isSemiDonut: boolean);
|
|
6
|
-
get viewBox(): "0 0 24 12" | "0 0 24 24";
|
|
7
|
-
get strokeWidth(): 6 | 4;
|
|
8
|
-
get fullLength(): number;
|
|
9
|
-
get point(): number;
|
|
10
|
-
get valueLength(): number;
|
|
11
|
-
get animatedValueLength(): number;
|
|
12
|
-
get startMargin(): number;
|
|
13
|
-
get endMargin(): number;
|
|
14
|
-
get baseOffset(): number;
|
|
15
|
-
get baseLength(): number;
|
|
16
|
-
get animatedBaseLengthFrom(): number;
|
|
17
|
-
get animatedBaseLengthTo(): number;
|
|
18
|
-
}
|