@desynova-digital/components 9.0.26 → 9.1.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/_helpers/globals.js +9 -10
- package/_helpers/pagination.js +10 -15
- package/_helpers/story-example.js +16 -39
- package/_helpers/story-helpers.js +15 -14
- package/_helpers/story-stack.js +22 -43
- package/_helpers/uniqueId.js +2 -5
- package/_helpers/utils.js +28 -4
- package/atoms/avatar/avatar.js +19 -42
- package/atoms/avatar/avatar.story.js +25 -58
- package/atoms/avatar/index.js +13 -11
- package/atoms/badge/badge.js +14 -37
- package/atoms/badge/badge.story.js +45 -103
- package/atoms/badge/index.js +12 -10
- package/atoms/button/button.js +85 -161
- package/atoms/button/button.story.js +354 -508
- package/atoms/button/index.js +5 -9
- package/atoms/card/card.js +26 -55
- package/atoms/card/card.story.js +39 -88
- package/atoms/card/index.js +12 -10
- package/atoms/cardStack/cardStack.js +88 -147
- package/atoms/cardStack/cardStack.story.js +106 -210
- package/atoms/cardStack/index.js +12 -10
- package/atoms/cardV2/cardV2.js +57 -106
- package/atoms/cardV2/cardV2.story.js +184 -232
- package/atoms/cardV2/content.js +154 -256
- package/atoms/cardV2/index.js +4 -8
- package/atoms/cardV2/thumbnail.js +138 -208
- package/atoms/cardV2/timeline.js +167 -123
- package/atoms/checkbox/checkbox.js +85 -157
- package/atoms/checkbox/checkbox.story.js +237 -365
- package/atoms/checkbox/index.js +4 -9
- package/atoms/customSelect/customSelect.js +136 -215
- package/atoms/customSelect/customSelect.story.js +745 -851
- package/atoms/customSelect/index.js +4 -8
- package/atoms/datePicker/datePicker.js +299 -431
- package/atoms/datePicker/datePicker.story.js +453 -501
- package/atoms/datePicker/index.js +4 -8
- package/atoms/dateTime/dateTime.js +3 -6
- package/atoms/dateTime/dateTime.story.js +17 -63
- package/atoms/dateTime/index.js +5 -9
- package/atoms/draftInputText/draftInputText.js +121 -189
- package/atoms/draftInputText/draftInputText.story.js +200 -249
- package/atoms/draftInputText/index.js +5 -9
- package/atoms/dropdown/dropdown.js +38 -66
- package/atoms/dropdown/dropdown.story.js +102 -262
- package/atoms/dropdown/index.js +4 -8
- package/atoms/dropdownList/dropdownList.js +78 -108
- package/atoms/dropdownList/dropdownList.story.js +1546 -1621
- package/atoms/dropdownList/index.js +4 -8
- package/atoms/graphs/barGraph/barGraph.js +95 -146
- package/atoms/graphs/barGraph/barGraph.story.js +65 -87
- package/atoms/graphs/barGraph/index.js +4 -8
- package/atoms/graphs/circleDonut/circleDonut.js +177 -229
- package/atoms/graphs/circleDonut/circleDonut.story.js +328 -394
- package/atoms/graphs/circleDonut/index.js +5 -9
- package/atoms/graphs/circleGraph/circleGraph.js +60 -90
- package/atoms/graphs/circleGraph/circleGraph.story.js +36 -54
- package/atoms/graphs/circleGraph/index.js +4 -8
- package/atoms/graphs/circleNested/circleNested.js +216 -262
- package/atoms/graphs/circleNested/circleNested.story.js +91 -116
- package/atoms/graphs/circleNested/index.js +5 -9
- package/atoms/graphs/pieChart/index.js +4 -8
- package/atoms/graphs/pieChart/pieChart.js +162 -191
- package/atoms/graphs/pieChart/pieChart.story.js +147 -176
- package/atoms/graphs/verticalBarGraph/index.js +5 -9
- package/atoms/graphs/verticalBarGraph/verticalBarGraph.js +75 -98
- package/atoms/graphs/verticalBarGraph/verticalBarGraph.story.js +26 -45
- package/atoms/icon/icon.js +41 -72
- package/atoms/icon/icon.story.js +831 -260
- package/atoms/icon/index.js +19 -12
- package/atoms/image/image.js +18 -32
- package/atoms/image/image.story.js +10 -19
- package/atoms/image/index.js +4 -8
- package/atoms/inputText/index.js +4 -8
- package/atoms/inputText/inputText.js +86 -131
- package/atoms/inputText/inputText.story.js +191 -255
- package/atoms/label/index.js +4 -8
- package/atoms/label/label.js +25 -50
- package/atoms/label/label.story.js +42 -83
- package/atoms/loader/CircleLoader.js +29 -63
- package/atoms/loader/ShimmerComponent/CollabShimmerCard.js +39 -50
- package/atoms/loader/ShimmerComponent/CollabShimmerCardTray.js +41 -42
- package/atoms/loader/ShimmerComponent/FiltersShimmer.js +30 -30
- package/atoms/loader/ShimmerComponent/GraphDetailShimmer.js +21 -34
- package/atoms/loader/ShimmerComponent/GraphTitleShimmer.js +30 -34
- package/atoms/loader/ShimmerComponent/GraphsComponentShimmer.js +23 -32
- package/atoms/loader/ShimmerComponent/Shimmer.js +24 -32
- package/atoms/loader/ThreeDotLoader.js +14 -29
- package/atoms/loader/index.js +13 -11
- package/atoms/loader/loader.js +34 -58
- package/atoms/loader/loader.story.js +48 -52
- package/atoms/loader/spinningLoader.js +23 -34
- package/atoms/popup/index.js +5 -9
- package/atoms/popup/popup.js +123 -208
- package/atoms/popup/popup.story.js +97 -131
- package/atoms/radio/index.js +18 -11
- package/atoms/radio/radio.js +58 -112
- package/atoms/radio/radio.story.js +197 -420
- package/atoms/select/index.js +4 -8
- package/atoms/select/select.js +48 -86
- package/atoms/sideBar/index.js +5 -9
- package/atoms/sideBar/sidebar.js +89 -140
- package/atoms/switch/index.js +4 -8
- package/atoms/switch/switch.js +56 -86
- package/atoms/switch/switch.story.js +268 -415
- package/atoms/tag/index.js +12 -10
- package/atoms/tag/tag.js +29 -63
- package/atoms/tag/tag.story.js +135 -209
- package/atoms/textarea/index.js +5 -9
- package/atoms/textarea/textarea.js +55 -99
- package/atoms/textarea/textarea.story.js +48 -41
- package/atoms/thematicBreak/index.js +12 -10
- package/atoms/thematicBreak/thematicBreak.js +20 -38
- package/atoms/thematicBreak/thematicBreak.story.js +25 -37
- package/atoms/timeCodeInput/index.js +4 -8
- package/atoms/timeCodeInput/timCodeInput.story.js +21 -35
- package/atoms/timeCodeInput/timeCodeInput.js +33 -51
- package/atoms/timer/index.js +5 -9
- package/atoms/timer/timer.js +57 -108
- package/atoms/timer/timer.story.js +13 -26
- package/atoms/toast/index.js +5 -9
- package/atoms/toast/toast.js +81 -116
- package/atoms/toast/toast.story.js +50 -76
- package/atoms/videoCard/index.js +12 -10
- package/atoms/videoCard/videoCard.js +265 -447
- package/atoms/videoCard/videoCard.story.js +495 -710
- package/components.js +411 -294
- package/index.js +350 -61
- package/molecules/carousel/carousel.js +121 -207
- package/molecules/carousel/carousel.story.js +240 -223
- package/molecules/carousel/index.js +5 -9
- package/molecules/errorScreen/CollabErrorScreen.js +35 -66
- package/molecules/errorScreen/TableErrorScreen.js +109 -102
- package/molecules/errorScreen/TableErrorScreen.jsx +7 -6
- package/molecules/errorScreen/errorScreen.js +41 -94
- package/molecules/filter/constants.js +1 -0
- package/molecules/filter/filter.js +378 -562
- package/molecules/filter/filter.story.js +79 -104
- package/molecules/filter/index.js +5 -9
- package/molecules/graphCard/graphCard.js +97 -193
- package/molecules/graphCard/graphCard.story.js +159 -191
- package/molecules/graphCard/index.js +4 -8
- package/molecules/graphCard/loader.js +28 -68
- package/molecules/graphDetailCard/graphDetailCard.js +115 -183
- package/molecules/graphDetailCard/graphDetailCard.story.js +218 -254
- package/molecules/graphDetailCard/index.js +5 -9
- package/molecules/pageHeader/index.js +12 -10
- package/molecules/pageHeader/pageHeader.js +38 -79
- package/molecules/pageHeader/pageHeader.story.js +34 -55
- package/molecules/pagination/index.js +4 -8
- package/molecules/pagination/pagination.js +126 -202
- package/molecules/pagination/pagination.story.js +40 -52
- package/molecules/richTextInput/RichTextInput.js +354 -0
- package/molecules/richTextInput/RichTextInput.story.js +50 -0
- package/molecules/richTextInput/index.js +9 -0
- package/molecules/table/index.js +4 -8
- package/molecules/table/table-column.js +10 -16
- package/molecules/table/table-header.js +31 -72
- package/molecules/table/table.js +743 -1075
- package/molecules/table/table.story.js +274 -304
- package/molecules/tabs/index.js +4 -8
- package/molecules/tabs/tabs.js +112 -184
- package/molecules/tabs/tabs.story.js +66 -133
- package/molecules/videoCardList/index.js +4 -8
- package/molecules/videoCardList/videoCardList.js +24 -41
- package/molecules/videoCardList/videoCardList.story.js +449 -664
- package/molecules/videoPlayer/index.js +4 -8
- package/molecules/videoPlayer/videoPlayer.js +1019 -1097
- package/molecules/videoPlayer/videoPlayer.story.js +10 -21
- package/package.json +2 -2
|
@@ -1,242 +1,190 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
6
|
+
value: true
|
|
5
7
|
});
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
|
-
|
|
25
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
26
|
-
|
|
27
|
-
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
28
|
-
|
|
29
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
30
|
-
|
|
31
|
-
function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
32
|
-
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
12
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
13
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
17
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
18
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
19
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
20
|
+
var _templateObject;
|
|
21
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
22
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
23
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
24
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
33
25
|
var propTypes = {};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return props.data.graph_type === 'donutThin' ? '0.8' : props.data.graph_type === 'donutThick' ? '7.5' : '2.5';
|
|
26
|
+
var StyledCircleDonut = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n\n// code reference \n// https://codepen.io/sergiopedercini/pen/aWawra\n// https://medium.com/@pppped/how-to-code-a-responsive-circular-percentage-chart-with-svg-and-css-3632f8cd7705\n\nposition: relative;\n.circular-chart {\n display: block;\n margin: 0px auto;\n max-width: 200px;\n max-height: 250px;\n }\n \n .circle {\n fill: none;\n stroke-width: ", " ;\n stroke-linecap: ", " ;\n\n &.base{\n stroke: #121D29;\n }\n \n &.main{\n //animation: progress 1s ease-out forwards;\n transition: all 1s ease;\n opacity:1;\n &.stroke-transparent{\n opacity:0;\n }\n }\n\n }\n \n @keyframes progress {\n 0% {\n stroke-dasharray: 0 100;\n }\n }\n\n\n .display-info {\n color: #fff;\n width: auto;\n display: inline-block; \n text-align: center;\n position: absolute;\n top: 75px;\n left: 150px;\n font-size: 30px;\n font-family: 'SFUIText-Medium';\n transform: translate(-50%, 0px );\n opacity: 0;\n top: 50%;\n left: 50%;\n transform: translate(-50%,-50%);\n & > div{\n font-size: 10px;\n font-family: 'SFUIText-Regular';\n margin-top: 5px;\n }\n }\n\n .active.display-info {\n opacity: 1;\n display: inline-block;\n }\n"])), function (props) {
|
|
27
|
+
return props.data.graph_type === 'donutThin' ? '0.8' : props.data.graph_type === 'donutThick' ? '7.5' : '2.5';
|
|
37
28
|
}, function (props) {
|
|
38
|
-
|
|
29
|
+
return props.data.graph_type === 'donutThin' || props.data.graph_type === 'donutThick' ? 'butt' : 'round';
|
|
39
30
|
});
|
|
40
|
-
|
|
41
31
|
var circleList = {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
32
|
+
donutDefault: {
|
|
33
|
+
d: "M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831",
|
|
34
|
+
c: 100
|
|
35
|
+
},
|
|
36
|
+
donutThin: {
|
|
37
|
+
d: "M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831",
|
|
38
|
+
c: 100
|
|
39
|
+
},
|
|
40
|
+
donutThick: {
|
|
41
|
+
d: "M18 4.949283642996061 a 13.050716357003939 13.050716357003939 0 0 1 0 26.101432714007878 a 13.050716357003939 13.050716357003939 0 0 1 0 -26.101432714007878",
|
|
42
|
+
c: 82.0330743
|
|
43
|
+
}
|
|
55
44
|
};
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
} },
|
|
180
|
-
_this.props.data.data.total
|
|
181
|
-
),
|
|
182
|
-
_react2.default.createElement(
|
|
183
|
-
'div',
|
|
184
|
-
null,
|
|
185
|
-
_this.props.valueSub
|
|
186
|
-
)
|
|
187
|
-
),
|
|
188
|
-
_this.props.data.data.total > 0 && _this.props.data.data.values.map(function (item, idx) {
|
|
189
|
-
return percentDataArr[idx] > 0 && _react2.default.createElement(
|
|
190
|
-
'div',
|
|
191
|
-
{ key: graphTitleName + 'display-info' + idx, className: activeInfo === idx ? "active display-info" : "display-info" },
|
|
192
|
-
_react2.default.createElement(
|
|
193
|
-
'span',
|
|
194
|
-
{ style: {
|
|
195
|
-
color: graphColors[idx][0]
|
|
196
|
-
} },
|
|
197
|
-
item.data
|
|
198
|
-
),
|
|
199
|
-
_react2.default.createElement(
|
|
200
|
-
'div',
|
|
201
|
-
null,
|
|
202
|
-
item.name
|
|
203
|
-
)
|
|
204
|
-
);
|
|
205
|
-
})
|
|
206
|
-
);
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
_this.state = {
|
|
210
|
-
animate: false,
|
|
211
|
-
activeInfo: null
|
|
212
|
-
};
|
|
213
|
-
return _this;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
return CircleDonut;
|
|
45
|
+
var CircleDonut = /*#__PURE__*/function (_Component) {
|
|
46
|
+
function CircleDonut(props) {
|
|
47
|
+
var _this;
|
|
48
|
+
(0, _classCallCheck2["default"])(this, CircleDonut);
|
|
49
|
+
_this = _callSuper(this, CircleDonut, [props]);
|
|
50
|
+
(0, _defineProperty2["default"])(_this, "componentDidMount", function () {
|
|
51
|
+
setTimeout(function () {
|
|
52
|
+
_this.setState({
|
|
53
|
+
animate: true
|
|
54
|
+
});
|
|
55
|
+
}, 1000);
|
|
56
|
+
});
|
|
57
|
+
(0, _defineProperty2["default"])(_this, "hightlightme", function (e) {
|
|
58
|
+
_this.setState({
|
|
59
|
+
activeInfo: parseInt(e.target.getAttribute('idx'))
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
(0, _defineProperty2["default"])(_this, "onMouseOut", function (e) {
|
|
63
|
+
_this.setState({
|
|
64
|
+
activeInfo: null
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
(0, _defineProperty2["default"])(_this, "onMouseMove", function (e) {
|
|
68
|
+
//console.log('onMouseMove >>>', e.target.getAttribute('idx'));
|
|
69
|
+
});
|
|
70
|
+
(0, _defineProperty2["default"])(_this, "render", function () {
|
|
71
|
+
var graphColors = _this.props.graphColors;
|
|
72
|
+
var _this$state = _this.state,
|
|
73
|
+
animate = _this$state.animate,
|
|
74
|
+
activeInfo = _this$state.activeInfo;
|
|
75
|
+
var percentDataArr = [];
|
|
76
|
+
if (animate) {
|
|
77
|
+
percentDataArr = _this.props.data.data.values.map(function (item, idx) {
|
|
78
|
+
return !_this.props.data.data.total > 0 ? 0 : item.data / _this.props.data.data.total * 100;
|
|
79
|
+
});
|
|
80
|
+
percentDataArr = _this.props.data.data.values.map(function (item, idx) {
|
|
81
|
+
var perValue = 0;
|
|
82
|
+
for (var i = 0; i <= idx; i++) {
|
|
83
|
+
perValue = perValue + percentDataArr[i];
|
|
84
|
+
}
|
|
85
|
+
return perValue;
|
|
86
|
+
});
|
|
87
|
+
} else {
|
|
88
|
+
percentDataArr = [0, 0, 0];
|
|
89
|
+
}
|
|
90
|
+
var pathD = _this.props.data.graph_type && _this.props.data.graph_type != '' ? circleList[_this.props.data.graph_type].d : circleList['donutDefault'].d;
|
|
91
|
+
var circleCircumference = _this.props.data.graph_type && _this.props.data.graph_type != '' ? circleList[_this.props.data.graph_type].c : circleList['donutDefault'].c;
|
|
92
|
+
var graphTitleName = _this.props.data && _this.props.data.data && _this.props.data.data.name ? _this.props.data.data.name : new Date().getTime() + '';
|
|
93
|
+
graphTitleName = graphTitleName.replaceAll(" ", '');
|
|
94
|
+
return /*#__PURE__*/_react["default"].createElement(StyledCircleDonut, (0, _extends2["default"])({}, _this.props, {
|
|
95
|
+
className: "circle-donut",
|
|
96
|
+
onClick: function onClick() {}
|
|
97
|
+
}), /*#__PURE__*/_react["default"].createElement("svg", {
|
|
98
|
+
viewBox: "0 0 36 36",
|
|
99
|
+
className: "circular-chart"
|
|
100
|
+
}, /*#__PURE__*/_react["default"].createElement("defs", null, graphColors ? graphColors.map(function (item, idx) {
|
|
101
|
+
return /*#__PURE__*/_react["default"].createElement("linearGradient", {
|
|
102
|
+
key: graphTitleName + 'gradient-color' + idx,
|
|
103
|
+
id: 'gradient-color' + graphTitleName + idx,
|
|
104
|
+
x1: "0%",
|
|
105
|
+
y1: "0%",
|
|
106
|
+
x2: "53%",
|
|
107
|
+
y2: "7%"
|
|
108
|
+
}, /*#__PURE__*/_react["default"].createElement("stop", {
|
|
109
|
+
offset: "0%",
|
|
110
|
+
stopColor: item[1]
|
|
111
|
+
}), /*#__PURE__*/_react["default"].createElement("stop", {
|
|
112
|
+
offset: "100%",
|
|
113
|
+
stopColor: item[0]
|
|
114
|
+
}));
|
|
115
|
+
}) : null), /*#__PURE__*/_react["default"].createElement("path", {
|
|
116
|
+
className: "circle base"
|
|
117
|
+
//stroke-dasharray="100, 100"
|
|
118
|
+
,
|
|
119
|
+
strokeDasharray: circleCircumference + ", " + circleCircumference,
|
|
120
|
+
d: pathD
|
|
121
|
+
}), _this.props.data.data.values.map(function (item, idx) {
|
|
122
|
+
idx = _this.props.data.data.values.length - 1 - idx;
|
|
123
|
+
return percentDataArr[idx] > -1 && /*#__PURE__*/_react["default"].createElement("path", {
|
|
124
|
+
idx: idx,
|
|
125
|
+
key: graphTitleName + 'path' + idx,
|
|
126
|
+
className: percentDataArr[idx] == 0 || _this.props.data.data.total === 0 ? "circle main stroke-transparent" : "circle main"
|
|
127
|
+
//stroke-dasharray={""+ percentDataArr[idx] +", 100"}
|
|
128
|
+
//stroke={!percentDataArr[idx] >0 || !this.props.data.data.total > 0 ? "transparent" : ""+graphColors[idx][0]} //"url(#gradient-color"+idx +")"
|
|
129
|
+
,
|
|
130
|
+
stroke: "url(#gradient-color" + graphTitleName + idx + ")",
|
|
131
|
+
strokeDasharray: "" + circleCircumference * percentDataArr[idx] / 100 + ", " + circleCircumference,
|
|
132
|
+
d: pathD,
|
|
133
|
+
onMouseOver: function onMouseOver(e) {
|
|
134
|
+
_this.hightlightme(e);
|
|
135
|
+
},
|
|
136
|
+
onMouseOut: function onMouseOut(e) {
|
|
137
|
+
_this.onMouseOut(e);
|
|
138
|
+
},
|
|
139
|
+
onMouseMove: function onMouseMove(e) {
|
|
140
|
+
_this.onMouseMove(e);
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
144
|
+
className: activeInfo === null ? "active display-info" : "display-info"
|
|
145
|
+
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
146
|
+
style: {
|
|
147
|
+
color: '#FFF'
|
|
148
|
+
}
|
|
149
|
+
}, _this.props.data.data.total), /*#__PURE__*/_react["default"].createElement("div", null, _this.props.valueSub)), _this.props.data.data.total > 0 && _this.props.data.data.values.map(function (item, idx) {
|
|
150
|
+
return percentDataArr[idx] > 0 && /*#__PURE__*/_react["default"].createElement("div", {
|
|
151
|
+
key: graphTitleName + 'display-info' + idx,
|
|
152
|
+
className: activeInfo === idx ? "active display-info" : "display-info"
|
|
153
|
+
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
154
|
+
style: {
|
|
155
|
+
color: graphColors[idx][0]
|
|
156
|
+
}
|
|
157
|
+
}, item.data), /*#__PURE__*/_react["default"].createElement("div", null, item.name));
|
|
158
|
+
}));
|
|
159
|
+
});
|
|
160
|
+
_this.state = {
|
|
161
|
+
animate: false,
|
|
162
|
+
activeInfo: null
|
|
163
|
+
};
|
|
164
|
+
return _this;
|
|
165
|
+
}
|
|
166
|
+
(0, _inherits2["default"])(CircleDonut, _Component);
|
|
167
|
+
return (0, _createClass2["default"])(CircleDonut);
|
|
217
168
|
}(_react.Component);
|
|
218
|
-
|
|
219
169
|
CircleDonut.propTypes = {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
170
|
+
data: _propTypes["default"].shape({
|
|
171
|
+
graph_name: _propTypes["default"].string,
|
|
172
|
+
graph_type: _propTypes["default"].string,
|
|
173
|
+
data: _propTypes["default"].shape({
|
|
174
|
+
total: _propTypes["default"].number.isRequired,
|
|
175
|
+
name: _propTypes["default"].string,
|
|
176
|
+
values: _propTypes["default"].arrayOf(_propTypes["default"].shape({
|
|
177
|
+
data: _propTypes["default"].number.isRequired
|
|
178
|
+
}).isRequired)
|
|
179
|
+
})
|
|
180
|
+
}).isRequired,
|
|
181
|
+
theme: _propTypes["default"].oneOf(['light', 'dark']),
|
|
182
|
+
graphColors: _propTypes["default"].array,
|
|
183
|
+
graphPlaceholder: _propTypes["default"].bool,
|
|
184
|
+
valueSub: _propTypes["default"].string
|
|
235
185
|
};
|
|
236
|
-
|
|
237
186
|
CircleDonut.defaultProps = {
|
|
238
|
-
|
|
239
|
-
|
|
187
|
+
theme: 'light',
|
|
188
|
+
graphColors: [['#00C8E7', '#00E6B9'], ['#FFE259', '#FFA751'], ['#FF8D29', '#F6462C'], ['#FFFFFF', '#DDDDDD']]
|
|
240
189
|
};
|
|
241
|
-
|
|
242
|
-
exports.default = CircleDonut;
|
|
190
|
+
var _default = exports["default"] = CircleDonut;
|