diginet-core-ui 1.3.78 → 1.3.79
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/components/accordion/details.js +2 -6
- package/components/accordion/group.js +2 -9
- package/components/accordion/index.js +2 -15
- package/components/accordion/summary.js +4 -27
- package/components/alert/index.js +98 -137
- package/components/alert/notify.js +97 -166
- package/components/avatar/index.js +4 -63
- package/components/badge/index.js +7 -34
- package/components/button/icon.js +120 -186
- package/components/button/index.js +136 -205
- package/components/button/more.js +0 -12
- package/components/button/ripple-effect.js +46 -44
- package/components/card/body.js +2 -7
- package/components/card/extra.js +2 -7
- package/components/card/footer.js +2 -7
- package/components/card/header.js +2 -7
- package/components/card/index.js +2 -22
- package/components/chart/Pie/Circle.js +0 -1
- package/components/chart/Pie/Sector.js +0 -17
- package/components/chart/Pie/Sectors.js +0 -10
- package/components/chart/Pie/index.js +4 -36
- package/components/chart/Pie-v2/Circle.js +0 -1
- package/components/chart/Pie-v2/Sector.js +0 -13
- package/components/chart/Pie-v2/Sectors.js +0 -20
- package/components/chart/Pie-v2/index.js +11 -38
- package/components/chart/bar/Axis.js +0 -12
- package/components/chart/bar/Bar.js +13 -35
- package/components/chart/bar/Grid.js +0 -18
- package/components/chart/bar/Labels.js +0 -18
- package/components/chart/bar/Points.js +0 -17
- package/components/chart/bar/index.js +6 -26
- package/components/chart/bar-v2/Axis.js +0 -12
- package/components/chart/bar-v2/Bar.js +15 -36
- package/components/chart/bar-v2/Grid.js +0 -18
- package/components/chart/bar-v2/Labels.js +0 -18
- package/components/chart/bar-v2/Points.js +0 -17
- package/components/chart/bar-v2/index.js +6 -26
- package/components/chart/line/Axis.js +4 -16
- package/components/chart/line/Grid.js +2 -19
- package/components/chart/line/Labels.js +0 -18
- package/components/chart/line/Path.js +23 -33
- package/components/chart/line/Point.js +6 -40
- package/components/chart/line/Title.js +0 -3
- package/components/chart/line/index.js +12 -35
- package/components/chart/line-v2/Axis.js +0 -13
- package/components/chart/line-v2/Grid.js +0 -18
- package/components/chart/line-v2/Labels.js +0 -18
- package/components/chart/line-v2/Path.js +23 -33
- package/components/chart/line-v2/Point.js +6 -35
- package/components/chart/line-v2/Title.js +0 -3
- package/components/chart/line-v2/index.js +12 -30
- package/components/check-text/index.js +0 -8
- package/components/check-text/interview-confirmation.js +0 -7
- package/components/check-text/interview-status.js +0 -7
- package/components/chip/attach.js +4 -17
- package/components/chip/index.js +6 -33
- package/components/collapse/index.js +0 -13
- package/components/divider/index.js +0 -8
- package/components/form-control/attachment/index.js +24 -202
- package/components/form-control/calendar/function.js +40 -94
- package/components/form-control/calendar/index.js +5 -30
- package/components/form-control/calendar/range.js +11 -28
- package/components/form-control/checkbox/index.js +4 -37
- package/components/form-control/control/index.js +3 -13
- package/components/form-control/date-picker/index-old.js +18 -0
- package/components/form-control/date-picker/index.js +23 -99
- package/components/form-control/date-range-picker/index.js +86 -221
- package/components/form-control/dropdown/index.js +72 -289
- package/components/form-control/dropdown-box/index.js +6 -35
- package/components/form-control/form/index.js +0 -2
- package/components/form-control/form-group/index.js +1 -6
- package/components/form-control/helper-text/index.js +2 -9
- package/components/form-control/input-base/index.js +218 -399
- package/components/form-control/label/index.js +2 -12
- package/components/form-control/money-input/index.js +43 -132
- package/components/form-control/number-input/index.js +15 -113
- package/components/form-control/number-input/index2.js +78 -119
- package/components/form-control/phone-input/index.js +16 -78
- package/components/form-control/radio/index.js +4 -23
- package/components/form-control/text-input/index.js +33 -256
- package/components/form-control/time-picker/index.js +14 -71
- package/components/form-control/time-picker/swiper.js +21 -73
- package/components/form-control/toggle/index.js +4 -19
- package/components/form-view/helper-text.js +2 -2
- package/components/form-view/index.js +0 -14
- package/components/form-view/input.js +2 -13
- package/components/form-view/label.js +0 -2
- package/components/grid/Col.js +2 -15
- package/components/grid/Container.js +2 -21
- package/components/grid/Row.js +2 -21
- package/components/grid/index.js +2 -43
- package/components/image/index.js +2 -22
- package/components/index.js +62 -31
- package/components/list/list-item-action.js +0 -9
- package/components/list/list-item-icon.js +0 -9
- package/components/list/list-item-text.js +0 -5
- package/components/list/list-item.js +0 -11
- package/components/list/list.js +0 -13
- package/components/list/sub-header.js +0 -4
- package/components/modal/body.js +2 -6
- package/components/modal/footer.js +2 -11
- package/components/modal/header.js +2 -12
- package/components/modal/index.js +2 -10
- package/components/modal/modal.js +11 -52
- package/components/others/extra/index.js +3 -10
- package/components/others/import/index.js +0 -7
- package/components/others/option-wrapper/index.js +4 -7
- package/components/others/scrollbar/index.js +0 -3
- package/components/paging/page-info.js +39 -101
- package/components/paging/page-selector.js +7 -35
- package/components/paging/page-selector2.js +35 -74
- package/components/paper/index.js +0 -11
- package/components/popover/body.js +2 -6
- package/components/popover/footer.js +2 -11
- package/components/popover/header.js +2 -7
- package/components/popover/index.js +39 -123
- package/components/popup/danger_popup.js +0 -19
- package/components/popup/index.js +2 -48
- package/components/popup/proposals_popup.js +10 -49
- package/components/popup/v2/index.js +0 -31
- package/components/progress/circular.js +19 -81
- package/components/progress/linear.js +4 -20
- package/components/rating/index.js +0 -24
- package/components/slider/slider-container.js +3 -40
- package/components/slider/slider-item.js +10 -25
- package/components/status/index.js +2 -16
- package/components/tab/tab-container.js +2 -16
- package/components/tab/tab-header.js +4 -24
- package/components/tab/tab-panel.js +4 -16
- package/components/tab/tab.js +4 -28
- package/components/tooltip/index.js +12 -97
- package/components/tooltip/portal.js +0 -2
- package/components/transfer/index.js +22 -67
- package/components/tree-view/index.js +62 -202
- package/components/typography/index.js +3 -31
- package/global/index.js +0 -8
- package/icons/basic.js +0 -48
- package/icons/effect.js +17 -29
- package/icons/general/clock/clock.js +0 -2
- package/icons/general/color-handler/background.js +0 -2
- package/icons/general/color-handler/text.js +0 -2
- package/icons/general/emoji/emoji.js +0 -2
- package/icons/general/font-properties/bold.js +0 -2
- package/icons/general/font-properties/font-family.js +0 -2
- package/icons/general/font-properties/font-size.js +0 -2
- package/icons/general/font-properties/italic.js +0 -2
- package/icons/general/font-properties/underline.js +0 -2
- package/icons/general/hyperlink/hyperlink.js +0 -2
- package/icons/general/indent/decrease.js +0 -2
- package/icons/general/indent/increase.js +0 -2
- package/icons/general/list/bullets.js +0 -2
- package/icons/general/list/numbering.js +0 -2
- package/icons/general/picture/picture.js +0 -2
- package/icons/general/steps/redo.js +0 -2
- package/icons/general/steps/undo.js +0 -2
- package/icons/general/text-align/center.js +0 -2
- package/icons/general/text-align/justify.js +0 -2
- package/icons/general/text-align/left.js +0 -2
- package/icons/general/text-align/right.js +0 -2
- package/icons/menu/dhr.js +2 -1
- package/icons/menu/index.js +2 -2
- package/icons/menu/v2/index.js +0 -10
- package/package.json +1 -1
- package/readme.md +11 -1
- package/styles/animation.js +15 -58
- package/styles/color-helper.js +24 -54
- package/styles/colors.js +17 -9
- package/styles/general.js +6 -2
- package/styles/typography.js +4 -4
- package/styles/utils.js +2 -2
- package/theme/createBreakpoints.js +7 -18
- package/theme/make-styles.js +2 -5
- package/theme/set-theme.js +3 -6
- package/theme/settings.js +3 -2
- package/theme/theme-provider.js +0 -1
- package/utils/array/array.js +14 -23
- package/utils/classNames.js +0 -5
- package/utils/console.js +0 -6
- package/utils/date.js +13 -82
- package/utils/error/error.js +1 -9
- package/utils/error/errors.js +1 -48
- package/utils/getFileType.js +0 -9
- package/utils/handleBreakpoints.js +0 -5
- package/utils/intersectionObserver.js +0 -5
- package/utils/iterator.js +0 -9
- package/utils/map-parent.js +3 -10
- package/utils/object/extend.js +0 -10
- package/utils/object/object.js +12 -11
- package/utils/parseHTML.js +0 -1
- package/utils/promisify.js +0 -5
- package/utils/randomString.js +0 -7
- package/utils/remove-unicode.js +0 -1
- package/utils/render-portal.js +1 -9
- package/utils/renderHTML.js +4 -6
- package/utils/renderIcon.js +4 -14
- package/utils/sb-template.js +6 -5
- package/utils/string/capitalize.js +0 -1
- package/utils/string/capitalizeSentenceCase.js +0 -2
- package/utils/string/string.js +0 -13
- package/utils/type.js +0 -21
- package/utils/updatePosition.js +4 -5
- package/utils/useDelayUnmount.js +0 -4
- package/utils/useElementSize.js +9 -3
- package/utils/useEventListener.js +12 -6
- package/utils/useInput.js +0 -6
- package/utils/useMediaQuery.js +8 -10
- package/utils/useOnClickOutside.js +0 -2
- package/utils/usePortal.js +3 -10
- package/utils/validate.js +6 -20
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
4
3
|
import { useRef, memo, forwardRef } from 'react';
|
|
5
4
|
import PropTypes from 'prop-types';
|
|
@@ -25,11 +24,9 @@ const Sector = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
25
24
|
...props
|
|
26
25
|
}, ref) => {
|
|
27
26
|
let result;
|
|
28
|
-
|
|
29
27
|
if (!ref) {
|
|
30
28
|
ref = useRef(null);
|
|
31
29
|
}
|
|
32
|
-
|
|
33
30
|
const pathRef = useRef(null);
|
|
34
31
|
const SectorCSS = expandOnHover || expandedIndex >= 0 ? css`
|
|
35
32
|
transition-property: ${transitionProperty};
|
|
@@ -61,7 +58,6 @@ const Sector = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
61
58
|
onMouseLeave: onMouseLeave,
|
|
62
59
|
...props
|
|
63
60
|
}, renderSelectedItem);
|
|
64
|
-
|
|
65
61
|
if (href) {
|
|
66
62
|
result = jsx("a", {
|
|
67
63
|
href: href
|
|
@@ -69,7 +65,6 @@ const Sector = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
69
65
|
} else {
|
|
70
66
|
result = content;
|
|
71
67
|
}
|
|
72
|
-
|
|
73
68
|
return result;
|
|
74
69
|
}));
|
|
75
70
|
Sector.defaultProps = {
|
|
@@ -85,35 +80,27 @@ Sector.defaultProps = {
|
|
|
85
80
|
Sector.propTypes = {
|
|
86
81
|
/** the fill change color of pie chart */
|
|
87
82
|
fill: PropTypes.string.isRequired,
|
|
88
|
-
|
|
89
83
|
/** event click mouse in pie chart */
|
|
90
84
|
onMouseEnter: PropTypes.func,
|
|
91
|
-
|
|
92
85
|
/** event leave mouse in pie chart */
|
|
93
86
|
onMouseLeave: PropTypes.func,
|
|
94
87
|
onTouchEnd: PropTypes.func,
|
|
95
88
|
onTouchStart: PropTypes.func,
|
|
96
|
-
|
|
97
89
|
/** function displays selected items by custom, example:<br/>
|
|
98
90
|
* renderItem={(data, index) => index + ' - ' + data.name}<br/>
|
|
99
91
|
*/
|
|
100
92
|
renderSelectedItem: PropTypes.func,
|
|
101
93
|
path: PropTypes.string.isRequired,
|
|
102
|
-
|
|
103
94
|
/** the StrokeColor change color border and Stroke */
|
|
104
95
|
strokeColor: PropTypes.string,
|
|
105
|
-
|
|
106
96
|
/** it can be applied to any element but it has effect only on the following nine */
|
|
107
97
|
strokeLinejoin: PropTypes.string,
|
|
108
|
-
|
|
109
98
|
/** The strokeWidth attribute is a presentation attribute defining the width of the stroke to be applied to the shape */
|
|
110
99
|
strokeWidth: PropTypes.number,
|
|
111
100
|
quantity: PropTypes.number,
|
|
112
101
|
href: PropTypes.string,
|
|
113
|
-
|
|
114
102
|
/** The transition-duration CSS property sets the length of time a transition animation should take to complete. Default 0.3s */
|
|
115
103
|
transitionDuration: PropTypes.string,
|
|
116
|
-
|
|
117
104
|
/** The transition-timing-function CSS property sets how intermediate values are calculated for CSS properties being affected*/
|
|
118
105
|
transitionTimingFunction: PropTypes.string,
|
|
119
106
|
className: PropTypes.string
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/* eslint-disable react/prop-types */
|
|
2
|
-
|
|
3
2
|
/** @jsxRuntime classic */
|
|
4
|
-
|
|
5
3
|
/** @jsx jsx */
|
|
6
4
|
import { useState } from 'react';
|
|
7
5
|
import PropTypes from 'prop-types';
|
|
@@ -9,7 +7,6 @@ import Sector from './Sector';
|
|
|
9
7
|
import { jsx, css } from '@emotion/core';
|
|
10
8
|
import { randomString } from '../../../utils';
|
|
11
9
|
import { typography } from '../../../styles/typography';
|
|
12
|
-
|
|
13
10
|
const Sectors = ({
|
|
14
11
|
center,
|
|
15
12
|
data,
|
|
@@ -37,25 +34,21 @@ const Sectors = ({
|
|
|
37
34
|
const total = data.reduce((prev, current) => current.quantity + prev, 0);
|
|
38
35
|
let angleStart = startAngle;
|
|
39
36
|
let angleEnd = startAngle;
|
|
40
|
-
|
|
41
37
|
const getPath = (d, i) => {
|
|
42
38
|
const anglePosition = (angleStart + angleEnd) / 2;
|
|
43
39
|
var rotateX = 0;
|
|
44
40
|
var rotateY = 0;
|
|
45
41
|
var xte = 0;
|
|
46
42
|
var yte = 0;
|
|
47
|
-
|
|
48
43
|
const measureText = (str, fontSize = 16) => {
|
|
49
44
|
const widths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.2796875, 0.2765625, 0.3546875, 0.5546875, 0.5546875, 0.8890625, 0.665625, 0.190625, 0.3328125, 0.3328125, 0.3890625, 0.5828125, 0.2765625, 0.3328125, 0.2765625, 0.3015625, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.2765625, 0.2765625, 0.584375, 0.5828125, 0.584375, 0.5546875, 1.0140625, 0.665625, 0.665625, 0.721875, 0.721875, 0.665625, 0.609375, 0.7765625, 0.721875, 0.2765625, 0.5, 0.665625, 0.5546875, 0.8328125, 0.721875, 0.7765625, 0.665625, 0.7765625, 0.721875, 0.665625, 0.609375, 0.721875, 0.665625, 0.94375, 0.665625, 0.665625, 0.609375, 0.2765625, 0.3546875, 0.2765625, 0.4765625, 0.5546875, 0.3328125, 0.5546875, 0.5546875, 0.5, 0.5546875, 0.5546875, 0.2765625, 0.5546875, 0.5546875, 0.221875, 0.240625, 0.5, 0.221875, 0.8328125, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.3328125, 0.5, 0.2765625, 0.5546875, 0.5, 0.721875, 0.5, 0.5, 0.5, 0.3546875, 0.259375, 0.353125, 0.5890625];
|
|
50
45
|
const avg = 0.5279276315789471;
|
|
51
46
|
return str.split('').map(c => c.charCodeAt(0) < widths.length ? widths[c.charCodeAt(0)] : avg).reduce((cur, acc) => acc + cur) * fontSize;
|
|
52
47
|
};
|
|
53
|
-
|
|
54
48
|
const xPath = center + center * Math.cos(Math.PI * anglePosition / 180);
|
|
55
49
|
const yPath = center + center * Math.sin(Math.PI * anglePosition / 180);
|
|
56
50
|
const x1Path = center + center * 1.3 * Math.cos(Math.PI * anglePosition / 180);
|
|
57
51
|
const y1Path = center + center * 1.3 * Math.sin(Math.PI * anglePosition / 180);
|
|
58
|
-
|
|
59
52
|
if (anglePosition > 271 || anglePosition < 89) {
|
|
60
53
|
rotateX += x1Path + measureText((d.quantity / total * 100).toFixed(2) + '%') + 5;
|
|
61
54
|
rotateY += y1Path;
|
|
@@ -67,7 +60,6 @@ const Sectors = ({
|
|
|
67
60
|
xte += x1Path - 30;
|
|
68
61
|
yte += y1Path - 6;
|
|
69
62
|
}
|
|
70
|
-
|
|
71
63
|
const path1 = `
|
|
72
64
|
M${xPath},${yPath}
|
|
73
65
|
L${x1Path},${y1Path}
|
|
@@ -127,7 +119,6 @@ const Sectors = ({
|
|
|
127
119
|
fill: d.color
|
|
128
120
|
}, (d.quantity / total * 100).toFixed(2), '%'));
|
|
129
121
|
};
|
|
130
|
-
|
|
131
122
|
return total > 0 ? jsx("g", null, data.map((d, i) => {
|
|
132
123
|
const isLarge = d.quantity / total > 0.5;
|
|
133
124
|
const angle = 360 * d.quantity / total;
|
|
@@ -150,19 +141,16 @@ const Sectors = ({
|
|
|
150
141
|
z
|
|
151
142
|
`;
|
|
152
143
|
angleEnd += angleMargin;
|
|
153
|
-
|
|
154
144
|
const MouseEnterTarget = (d, e, i) => {
|
|
155
145
|
if (onSectorHover) onSectorHover(d, i, e);
|
|
156
146
|
document.getElementById(`${id}` + i).style.display = 'block';
|
|
157
147
|
document.getElementById(`${id1}` + i).style.display = 'block';
|
|
158
148
|
};
|
|
159
|
-
|
|
160
149
|
const MouseLeaveTarget = (e, i) => {
|
|
161
150
|
if (onSectorHover) onSectorHover(null, null, e);
|
|
162
151
|
document.getElementById(`${id}` + i).style.display = 'none';
|
|
163
152
|
document.getElementById(`${id1}` + i).style.display = 'none';
|
|
164
153
|
};
|
|
165
|
-
|
|
166
154
|
return jsx("g", {
|
|
167
155
|
key: i,
|
|
168
156
|
id: 'sector' + i
|
|
@@ -185,7 +173,6 @@ const Sectors = ({
|
|
|
185
173
|
}), getPath(d, i));
|
|
186
174
|
})) : null;
|
|
187
175
|
};
|
|
188
|
-
|
|
189
176
|
Sectors.defaultProps = {
|
|
190
177
|
expandSize: 10,
|
|
191
178
|
strokeWidthTooltip: 2,
|
|
@@ -195,29 +182,22 @@ Sectors.defaultProps = {
|
|
|
195
182
|
};
|
|
196
183
|
Sectors.propTypes = {
|
|
197
184
|
center: PropTypes.number.isRequired,
|
|
198
|
-
|
|
199
185
|
/** The array of elements that appear in the PieChart */
|
|
200
186
|
data: PropTypes.arrayOf(PropTypes.shape({
|
|
201
187
|
color: PropTypes.string.isRequired,
|
|
202
188
|
name: PropTypes.string,
|
|
203
189
|
quantity: PropTypes.number.isRequired
|
|
204
190
|
})).isRequired,
|
|
205
|
-
|
|
206
191
|
/** returns the data of the object to be hover */
|
|
207
192
|
onSectorHover: PropTypes.func,
|
|
208
|
-
|
|
209
193
|
/** the Size expand On Hover */
|
|
210
194
|
expandSize: PropTypes.number,
|
|
211
|
-
|
|
212
195
|
/** the StrokeWidth change color border and Stroke */
|
|
213
196
|
strokeColor: Sector.propTypes.strokeColor,
|
|
214
|
-
|
|
215
197
|
/** The strokeWidth attribute is a presentation attribute defining the width of the stroke to be applied to the shape */
|
|
216
198
|
strokeWidth: Sector.propTypes.strokeWidth,
|
|
217
|
-
|
|
218
199
|
/** The starting angle is drawn in a circle from data first */
|
|
219
200
|
startAngle: PropTypes.number,
|
|
220
|
-
|
|
221
201
|
/** */
|
|
222
202
|
angleMargin: PropTypes.number
|
|
223
203
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
4
3
|
import { useState, useRef, memo, forwardRef } from 'react';
|
|
5
4
|
import PropTypes from 'prop-types';
|
|
@@ -39,35 +38,28 @@ const PieChart = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
39
38
|
allowUppercase: false,
|
|
40
39
|
allowSymbol: false
|
|
41
40
|
}));
|
|
42
|
-
|
|
43
41
|
if (data[0] && !data[0].color) {
|
|
44
42
|
var colors = [];
|
|
45
43
|
let Count = data.length;
|
|
46
|
-
|
|
47
44
|
while (colors.length < Count) {
|
|
48
45
|
do {
|
|
49
46
|
var makeColorCode = '0123456789ABCDEF';
|
|
50
47
|
var code = '#';
|
|
51
|
-
|
|
52
48
|
for (var count = 0; count < 6; count++) {
|
|
53
49
|
code = code + makeColorCode[Math.floor(Math.random() * 16)];
|
|
54
50
|
}
|
|
55
51
|
} while (colors.indexOf(code) >= 0);
|
|
56
|
-
|
|
57
52
|
colors.push('#' + ('000000' + code.toString(16)).slice(-6));
|
|
58
53
|
}
|
|
59
|
-
|
|
60
54
|
for (let i in data) {
|
|
61
55
|
data[i].color = colors[i];
|
|
62
56
|
}
|
|
63
57
|
}
|
|
64
|
-
|
|
65
58
|
const ZoomIn = () => {
|
|
66
59
|
let zoom = 0;
|
|
67
60
|
zoom = (width + height) / 2;
|
|
68
61
|
return zoom;
|
|
69
62
|
};
|
|
70
|
-
|
|
71
63
|
const svgCSS = css`
|
|
72
64
|
position: relative;
|
|
73
65
|
display: block;
|
|
@@ -106,23 +98,24 @@ const PieChart = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
106
98
|
`;
|
|
107
99
|
const padding1 = ZoomIn() / 10;
|
|
108
100
|
var padding = 0;
|
|
109
|
-
|
|
110
101
|
if (padding1 >= 60) {
|
|
111
102
|
padding += padding1 / 2;
|
|
112
103
|
} else {
|
|
113
104
|
padding += padding1;
|
|
114
105
|
}
|
|
115
|
-
|
|
116
106
|
const dem = data.length;
|
|
117
107
|
const position = (ZoomIn() - padding * 2) / dem;
|
|
118
108
|
const center = ZoomIn() / 4;
|
|
119
109
|
const dataWithValue = data.filter(d => d.quantity > 0);
|
|
120
110
|
const [isExpanded, setExpanded] = useState('false');
|
|
121
|
-
const expandedIndex = useRef(null);
|
|
122
|
-
|
|
123
|
-
const DataTitle = data.map((item, i) => ({
|
|
111
|
+
const expandedIndex = useRef(null);
|
|
112
|
+
// const dataSource = data.map((item, i) => ({ ...item, x: i * position }));
|
|
113
|
+
const DataTitle = data.map((item, i) => ({
|
|
114
|
+
...item,
|
|
124
115
|
x: position + i * 10
|
|
125
|
-
}));
|
|
116
|
+
}));
|
|
117
|
+
|
|
118
|
+
// const measureText = (str, fontSize = 16) => {
|
|
126
119
|
// const widths = [
|
|
127
120
|
// 0,
|
|
128
121
|
// 0,
|
|
@@ -260,7 +253,6 @@ const PieChart = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
260
253
|
// .reduce((cur, acc) => acc + cur) * fontSize
|
|
261
254
|
// );
|
|
262
255
|
// };
|
|
263
|
-
|
|
264
256
|
const handleSectorHover = (data, index, e) => {
|
|
265
257
|
if (expandOnHover) {
|
|
266
258
|
setExpanded({
|
|
@@ -268,12 +260,10 @@ const PieChart = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
268
260
|
});
|
|
269
261
|
expandedIndex.current = index !== null ? index : props.expandedIndex > -1 ? props.expandedIndex : null;
|
|
270
262
|
}
|
|
271
|
-
|
|
272
263
|
if (onSectorHover) {
|
|
273
264
|
onSectorHover(data, index, e);
|
|
274
265
|
}
|
|
275
266
|
};
|
|
276
|
-
|
|
277
267
|
const renderSingleData = (d, center) => {
|
|
278
268
|
return jsx(Circle, {
|
|
279
269
|
center: center,
|
|
@@ -286,13 +276,14 @@ const PieChart = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
286
276
|
...d
|
|
287
277
|
});
|
|
288
278
|
};
|
|
289
|
-
|
|
290
279
|
const renderMultipleData = center => {
|
|
291
280
|
return jsx(Sectors, {
|
|
292
281
|
center: center,
|
|
293
|
-
data: expandOnHover ? data.map((d, i) => ({
|
|
282
|
+
data: expandOnHover ? data.map((d, i) => ({
|
|
283
|
+
...d,
|
|
294
284
|
expanded: `${isExpanded ? i === expandedIndex.current : i === props.expandedIndex}`
|
|
295
|
-
})) : data.map((d, i) => ({
|
|
285
|
+
})) : data.map((d, i) => ({
|
|
286
|
+
...d,
|
|
296
287
|
expanded: `${i === props.expandedIndex}`
|
|
297
288
|
})),
|
|
298
289
|
...props,
|
|
@@ -302,7 +293,6 @@ const PieChart = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
302
293
|
onSectorHover: handleSectorHover
|
|
303
294
|
});
|
|
304
295
|
};
|
|
305
|
-
|
|
306
296
|
return jsx("div", {
|
|
307
297
|
ref: ref,
|
|
308
298
|
className: `DGN-CUI-Container-PieChart`
|
|
@@ -455,19 +445,14 @@ PieChart.defaultProps = {
|
|
|
455
445
|
PieChart.propTypes = {
|
|
456
446
|
/** the viewData will display information about the input data */
|
|
457
447
|
viewData: PropTypes.bool,
|
|
458
|
-
|
|
459
448
|
/** drawn Ratio of Width entered by user, default is: 900px */
|
|
460
449
|
width: PropTypes.number,
|
|
461
|
-
|
|
462
450
|
/** drawn Ratio of Height entered by user, default is: 500px */
|
|
463
451
|
height: PropTypes.number,
|
|
464
|
-
|
|
465
452
|
/** change from PieChart to DonutChart */
|
|
466
453
|
Donut: PropTypes.bool,
|
|
467
|
-
|
|
468
454
|
/** Typography of font in core, default: h4 */
|
|
469
455
|
type: PropTypes.string,
|
|
470
|
-
|
|
471
456
|
/** The array of elements that appear in the PieChart */
|
|
472
457
|
data: PropTypes.arrayOf(PropTypes.shape({
|
|
473
458
|
color: PropTypes.string,
|
|
@@ -475,40 +460,28 @@ PieChart.propTypes = {
|
|
|
475
460
|
quantity: PropTypes.number.isRequired,
|
|
476
461
|
href: PropTypes.string
|
|
477
462
|
})).isRequired,
|
|
478
|
-
|
|
479
463
|
/** the animation expand On Hover */
|
|
480
464
|
expandOnHover: PropTypes.bool,
|
|
481
|
-
|
|
482
465
|
/** the Size expand On Hover */
|
|
483
466
|
expandSize: PropTypes.number,
|
|
484
|
-
|
|
485
467
|
/** the specified position is hovering by default */
|
|
486
468
|
expandedIndex: PropTypes.number,
|
|
487
|
-
|
|
488
469
|
/** returns the data of the object to be hover */
|
|
489
470
|
onSectorHover: PropTypes.func,
|
|
490
|
-
|
|
491
471
|
/** the StrokeWidth change color border and Stroke */
|
|
492
472
|
strokeColor: Sector.propTypes.strokeColor,
|
|
493
|
-
|
|
494
473
|
/** it can be applied to any element but it has effect only on the following nine */
|
|
495
474
|
strokeLinejoin: Sector.propTypes.strokeLinejoin,
|
|
496
|
-
|
|
497
475
|
/** The strokeWidth attribute is a presentation attribute defining the width of the stroke to be applied to the shape */
|
|
498
476
|
strokeWidth: Sector.propTypes.strokeWidth,
|
|
499
|
-
|
|
500
477
|
/** The starting angle is drawn in a circle from data first */
|
|
501
478
|
startAngle: PropTypes.number,
|
|
502
|
-
|
|
503
479
|
/** */
|
|
504
480
|
angleMargin: PropTypes.number,
|
|
505
|
-
|
|
506
481
|
/** The transition-duration CSS property sets the length of time a transition animation should take to complete. Default 0.3s */
|
|
507
482
|
transitionDuration: Sector.propTypes.transitionDuration,
|
|
508
|
-
|
|
509
483
|
/** The transition-timing-function CSS property sets how intermediate values are calculated for CSS properties being affected*/
|
|
510
484
|
transitionTimingFunction: Sector.propTypes.transitionTimingFunction,
|
|
511
|
-
|
|
512
485
|
/** The title is add from the data */
|
|
513
486
|
name: Sector.propTypes.name
|
|
514
487
|
};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
4
3
|
import PropTypes from "prop-types";
|
|
5
4
|
import { jsx } from '@emotion/core';
|
|
6
|
-
|
|
7
5
|
const Axis = ({
|
|
8
6
|
axisColor,
|
|
9
7
|
axisVisible,
|
|
@@ -33,7 +31,6 @@ const Axis = ({
|
|
|
33
31
|
y2: getY(maxY + 5)
|
|
34
32
|
})) : null;
|
|
35
33
|
};
|
|
36
|
-
|
|
37
34
|
Axis.defaultProps = {
|
|
38
35
|
axisColor: '#7F828E',
|
|
39
36
|
axisOpacity: 1,
|
|
@@ -46,33 +43,24 @@ Axis.defaultProps = {
|
|
|
46
43
|
Axis.propTypes = {
|
|
47
44
|
/** the axisColor change color */
|
|
48
45
|
axisColor: PropTypes.string,
|
|
49
|
-
|
|
50
46
|
/** the axisOpacity property sets the opacity of an element*/
|
|
51
47
|
axisOpacity: PropTypes.number,
|
|
52
|
-
|
|
53
48
|
/** the axisVisible Hide or show the Axis axis */
|
|
54
49
|
axisVisible: PropTypes.bool,
|
|
55
|
-
|
|
56
50
|
/** the axisWidth change the thickness of the column */
|
|
57
51
|
axisWidth: PropTypes.number,
|
|
58
|
-
|
|
59
52
|
/** the getX position x on Ox*/
|
|
60
53
|
getX: PropTypes.func,
|
|
61
|
-
|
|
62
54
|
/** the getY position y on Oy */
|
|
63
55
|
getY: PropTypes.func,
|
|
64
|
-
|
|
65
56
|
/** the maxX is maximum of Ox quantity returned by data*/
|
|
66
57
|
maxX: PropTypes.number,
|
|
67
|
-
|
|
68
58
|
/** the maxY is maximum of Oy quantity returned by data*/
|
|
69
59
|
maxY: PropTypes.number,
|
|
70
|
-
|
|
71
60
|
/** the minX is minimum of OX quantity returned by data*/
|
|
72
61
|
minX: PropTypes.number,
|
|
73
62
|
//** the minY is minimum of Oy quantity returned by data*/
|
|
74
63
|
minY: PropTypes.number,
|
|
75
|
-
|
|
76
64
|
/** the unitWidth */
|
|
77
65
|
unitWidth: PropTypes.number
|
|
78
66
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
4
3
|
import { memo, useRef, forwardRef } from 'react';
|
|
5
4
|
import { css, jsx } from '@emotion/core';
|
|
@@ -20,8 +19,8 @@ const Bars = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
20
19
|
minX,
|
|
21
20
|
minY,
|
|
22
21
|
unitWidth,
|
|
23
|
-
onClick
|
|
24
|
-
|
|
22
|
+
onClick
|
|
23
|
+
// ...props
|
|
25
24
|
}, ref) => {
|
|
26
25
|
// Start create css in Component
|
|
27
26
|
const barChartCSS = css`
|
|
@@ -34,18 +33,19 @@ const Bars = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
34
33
|
const textChartCSS = css`
|
|
35
34
|
text-anchor: middle;
|
|
36
35
|
${typography.paragraph3};
|
|
37
|
-
`;
|
|
38
|
-
//
|
|
36
|
+
`;
|
|
37
|
+
// End create css in Component
|
|
39
38
|
|
|
39
|
+
// Create variable to calculate
|
|
40
40
|
const round = n => {
|
|
41
41
|
return Math.round(n * 100) / 100;
|
|
42
42
|
};
|
|
43
|
-
|
|
44
43
|
const barChart = useRef(null);
|
|
45
44
|
const BARS_MARGIN_DEFAULT = 0.16;
|
|
46
45
|
const margin = barsMargin >= 0 && barsMargin < unitWidth / 2 ? barsMargin : BARS_MARGIN_DEFAULT;
|
|
47
|
-
const barsWidth = unitWidth - margin * 3;
|
|
46
|
+
const barsWidth = unitWidth - margin * 3;
|
|
48
47
|
|
|
48
|
+
// create drawing function tooltips in different positions
|
|
49
49
|
const topTooltipPath = (width, height, offset, radius) => {
|
|
50
50
|
const left = -width / 2;
|
|
51
51
|
const right = width / 2;
|
|
@@ -64,7 +64,6 @@ const Bars = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
64
64
|
H ${offset}
|
|
65
65
|
L 0,0 z`;
|
|
66
66
|
};
|
|
67
|
-
|
|
68
67
|
const bottomTooltipPath = (width, height, offset, radius) => {
|
|
69
68
|
const left = -width / 2;
|
|
70
69
|
const right = width / 2;
|
|
@@ -83,7 +82,6 @@ const Bars = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
83
82
|
H ${offset}
|
|
84
83
|
L 0,0 z`;
|
|
85
84
|
};
|
|
86
|
-
|
|
87
85
|
const leftTooltipPath = (width, height, offset, radius) => {
|
|
88
86
|
const left = -offset - width;
|
|
89
87
|
const right = -offset;
|
|
@@ -102,7 +100,6 @@ const Bars = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
102
100
|
V ${offset}
|
|
103
101
|
L 0,0 z`;
|
|
104
102
|
};
|
|
105
|
-
|
|
106
103
|
const rightTooltipPath = (width, height, offset, radius) => {
|
|
107
104
|
const left = offset;
|
|
108
105
|
const right = offset + width;
|
|
@@ -120,49 +117,41 @@ const Bars = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
120
117
|
Q ${left},${bottom} ${left},${bottom - radius}
|
|
121
118
|
V ${offset}
|
|
122
119
|
L 0,0 z`;
|
|
123
|
-
};
|
|
124
|
-
|
|
120
|
+
};
|
|
125
121
|
|
|
122
|
+
// Create event management function
|
|
126
123
|
const MouseEnterTarget = (e, i) => {
|
|
127
124
|
if (onEnter) onEnter(e, i);
|
|
128
125
|
document.getElementById('tooltip-bar' + i).style.display = 'block';
|
|
129
126
|
};
|
|
130
|
-
|
|
131
127
|
const MouseLeaveTarget = (e, i) => {
|
|
132
128
|
if (onRemote) onRemote(e, i);
|
|
133
129
|
document.getElementById('tooltip-bar' + i).style.display = 'none';
|
|
134
130
|
};
|
|
135
|
-
|
|
136
131
|
const handleChange = event => {
|
|
137
132
|
if (onClick) onClick(event);
|
|
138
|
-
};
|
|
139
|
-
|
|
133
|
+
};
|
|
140
134
|
|
|
135
|
+
// Create function to display tooltip by position
|
|
141
136
|
const getPlacement = (point, i) => {
|
|
142
137
|
// convert number -> string
|
|
143
138
|
const h = `${point.quantity}`;
|
|
144
139
|
var Width = 0;
|
|
145
|
-
|
|
146
140
|
if (h.length == 2 || h.length == 1 || h.length == 3) {
|
|
147
141
|
Width += 35;
|
|
148
142
|
}
|
|
149
|
-
|
|
150
143
|
if (h.length == 4 || h.length == 5) {
|
|
151
144
|
Width += 40;
|
|
152
145
|
}
|
|
153
|
-
|
|
154
146
|
if (h.length == 6 || h.length == 7) {
|
|
155
147
|
Width += 50;
|
|
156
148
|
}
|
|
157
|
-
|
|
158
149
|
if (h.length == 8 || h.length == 9) {
|
|
159
150
|
Width += 70;
|
|
160
151
|
}
|
|
161
|
-
|
|
162
152
|
if (h.length == 10 || h.length == 11) {
|
|
163
153
|
Width += 90;
|
|
164
154
|
}
|
|
165
|
-
|
|
166
155
|
if (getX(point.x + unitWidth / 2) < 20) {
|
|
167
156
|
return jsx("g", {
|
|
168
157
|
id: `tooltip-bar` + i,
|
|
@@ -186,7 +175,6 @@ const Bars = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
186
175
|
fill: "#fff"
|
|
187
176
|
}, point.quantity));
|
|
188
177
|
}
|
|
189
|
-
|
|
190
178
|
if (getX(point.x + unitWidth / 2) > viewBoxWidth) {
|
|
191
179
|
return jsx("g", {
|
|
192
180
|
id: `tooltip-bar` + i,
|
|
@@ -210,7 +198,6 @@ const Bars = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
210
198
|
fill: "#fff"
|
|
211
199
|
}, point.quantity));
|
|
212
200
|
}
|
|
213
|
-
|
|
214
201
|
if (getY(point.quantity + 0.5) > 10) {
|
|
215
202
|
return jsx("g", {
|
|
216
203
|
id: `tooltip-bar` + i,
|
|
@@ -233,7 +220,6 @@ const Bars = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
233
220
|
fill: "#fff"
|
|
234
221
|
}, point.quantity));
|
|
235
222
|
}
|
|
236
|
-
|
|
237
223
|
return jsx("g", {
|
|
238
224
|
id: `tooltip-bar` + i,
|
|
239
225
|
className: 'DGN-Tooltip-Bar',
|
|
@@ -254,9 +240,9 @@ const Bars = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
254
240
|
css: textChartCSS,
|
|
255
241
|
fill: "#fff"
|
|
256
242
|
}, point.quantity));
|
|
257
|
-
};
|
|
258
|
-
|
|
243
|
+
};
|
|
259
244
|
|
|
245
|
+
// Create function to display data
|
|
260
246
|
const getPlacementNotHover = (point, i) => {
|
|
261
247
|
return jsx("g", {
|
|
262
248
|
id: `tooltip-bar` + i,
|
|
@@ -272,7 +258,6 @@ const Bars = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
272
258
|
fill: barsColor
|
|
273
259
|
}, point.quantity));
|
|
274
260
|
};
|
|
275
|
-
|
|
276
261
|
return hoverTooltip ? jsx("g", {
|
|
277
262
|
className: 'DGN-CUI-Bar',
|
|
278
263
|
ref: ref
|
|
@@ -321,33 +306,26 @@ Bars.propTypes = {
|
|
|
321
306
|
/** change color of Bar in BarChart */
|
|
322
307
|
barsColor: PropTypes.string,
|
|
323
308
|
barsMargin: PropTypes.number,
|
|
324
|
-
|
|
325
309
|
/** change the percentage of blurred colors on the column */
|
|
326
310
|
barsOpacity: PropTypes.number,
|
|
327
311
|
data: PropTypes.arrayOf(PropTypes.shape({
|
|
328
312
|
x: PropTypes.number,
|
|
329
313
|
quantity: PropTypes.number
|
|
330
314
|
})).isRequired,
|
|
331
|
-
|
|
332
315
|
/** the getX position x on Ox*/
|
|
333
316
|
getX: PropTypes.func,
|
|
334
|
-
|
|
335
317
|
/** the getY position y on Oy */
|
|
336
318
|
getY: PropTypes.func,
|
|
337
319
|
labelsHeightX: Labels.propTypes.labelsHeightX,
|
|
338
320
|
labelsOffsetX: Labels.propTypes.labelsOffsetX,
|
|
339
321
|
labelsOffsetY: Labels.propTypes.labelsOffsetY,
|
|
340
322
|
labelsWidthY: PropTypes.number,
|
|
341
|
-
|
|
342
323
|
/** the minX is minimum of OX quantity returned by data*/
|
|
343
324
|
minX: PropTypes.number.isRequired,
|
|
344
|
-
|
|
345
325
|
/** the minY is minimum of Oy quantity returned by data*/
|
|
346
326
|
minY: PropTypes.number.isRequired,
|
|
347
|
-
|
|
348
327
|
/** the unitWidth */
|
|
349
328
|
unitWidth: PropTypes.number,
|
|
350
|
-
|
|
351
329
|
/** Shows tooltip containing data on hover */
|
|
352
330
|
hoverTooltip: PropTypes.bool
|
|
353
331
|
};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
4
3
|
import PropTypes from "prop-types";
|
|
5
4
|
import { jsx } from '@emotion/core';
|
|
6
|
-
|
|
7
5
|
const Grid = ({
|
|
8
6
|
getX,
|
|
9
7
|
getY,
|
|
@@ -19,7 +17,6 @@ const Grid = ({
|
|
|
19
17
|
}) => {
|
|
20
18
|
let gridX = [];
|
|
21
19
|
let gridY = [];
|
|
22
|
-
|
|
23
20
|
for (let i = minX; i <= maxX + unitWidth; i++) {
|
|
24
21
|
gridX.push(jsx("line", {
|
|
25
22
|
key: i,
|
|
@@ -29,9 +26,7 @@ const Grid = ({
|
|
|
29
26
|
y2: getY(maxY + 5)
|
|
30
27
|
}));
|
|
31
28
|
}
|
|
32
|
-
|
|
33
29
|
const yStep = labelsCountY > 0 ? labelsCountY : unitWidth;
|
|
34
|
-
|
|
35
30
|
for (let i = minY; i <= maxY; i += Math.floor(maxY / yStep)) {
|
|
36
31
|
gridY.push(jsx("line", {
|
|
37
32
|
key: i,
|
|
@@ -41,7 +36,6 @@ const Grid = ({
|
|
|
41
36
|
y2: getY(i)
|
|
42
37
|
}));
|
|
43
38
|
}
|
|
44
|
-
|
|
45
39
|
if (GridLines === 'full') {
|
|
46
40
|
return jsx("g", {
|
|
47
41
|
className: 'DGN-Grid-BarChart',
|
|
@@ -49,7 +43,6 @@ const Grid = ({
|
|
|
49
43
|
strokeWidth: gridWidth
|
|
50
44
|
}, gridX, gridY);
|
|
51
45
|
}
|
|
52
|
-
|
|
53
46
|
if (GridLines === 'horizontal') {
|
|
54
47
|
return jsx("g", {
|
|
55
48
|
className: 'DGN-Grid-BarChart',
|
|
@@ -57,7 +50,6 @@ const Grid = ({
|
|
|
57
50
|
strokeWidth: gridWidth
|
|
58
51
|
}, gridY);
|
|
59
52
|
}
|
|
60
|
-
|
|
61
53
|
if (GridLines === 'none') {
|
|
62
54
|
return null;
|
|
63
55
|
} else {
|
|
@@ -68,37 +60,27 @@ const Grid = ({
|
|
|
68
60
|
}, gridY);
|
|
69
61
|
}
|
|
70
62
|
};
|
|
71
|
-
|
|
72
63
|
Grid.propTypes = {
|
|
73
64
|
/** the getX position x on Ox*/
|
|
74
65
|
getX: PropTypes.func,
|
|
75
|
-
|
|
76
66
|
/** the getY position y on Oy */
|
|
77
67
|
getY: PropTypes.func,
|
|
78
|
-
|
|
79
68
|
/** change color of grid Columb*/
|
|
80
69
|
gridColor: PropTypes.string,
|
|
81
|
-
|
|
82
70
|
/** change Columb grid display style ['full' , 'horizontal', 'none']*/
|
|
83
71
|
GridLines: PropTypes.string,
|
|
84
|
-
|
|
85
72
|
/** hiden or show grid columb*/
|
|
86
73
|
gridVisible: PropTypes.bool,
|
|
87
74
|
gridWidth: PropTypes.number,
|
|
88
75
|
labelsCountY: PropTypes.number,
|
|
89
|
-
|
|
90
76
|
/** the maxX is maximum of Ox quantity returned by data*/
|
|
91
77
|
maxX: PropTypes.number,
|
|
92
|
-
|
|
93
78
|
/** the maxY is maximum of Oy quantity returned by data*/
|
|
94
79
|
maxY: PropTypes.number,
|
|
95
|
-
|
|
96
80
|
/** the minX is minimum of OX quantity returned by data*/
|
|
97
81
|
minX: PropTypes.number,
|
|
98
|
-
|
|
99
82
|
/** the minY is minimum of Oy quantity returned by data*/
|
|
100
83
|
minY: PropTypes.number,
|
|
101
|
-
|
|
102
84
|
/** the unitWidth */
|
|
103
85
|
unitWidth: PropTypes.number
|
|
104
86
|
};
|