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,13 +1,10 @@
|
|
|
1
1
|
/* eslint-disable react/prop-types */
|
|
2
|
-
|
|
3
2
|
/** @jsxRuntime classic */
|
|
4
|
-
|
|
5
3
|
/** @jsx jsx */
|
|
6
4
|
import PropTypes from 'prop-types';
|
|
7
5
|
import { jsx, css } from '@emotion/core';
|
|
8
6
|
import { typography } from '../../../styles/typography';
|
|
9
7
|
import { color as colors } from '../../../styles/colors';
|
|
10
|
-
|
|
11
8
|
const Points = ({
|
|
12
9
|
data,
|
|
13
10
|
getX,
|
|
@@ -43,8 +40,9 @@ const Points = ({
|
|
|
43
40
|
const textChartCSS = css`
|
|
44
41
|
text-anchor: middle;
|
|
45
42
|
${typography.paragraph3};
|
|
46
|
-
`;
|
|
43
|
+
`;
|
|
47
44
|
|
|
45
|
+
// create drawing function tooltips in different positions
|
|
48
46
|
const topTooltipPath = (width, height, offset, radius) => {
|
|
49
47
|
const left = -width / 2;
|
|
50
48
|
const right = width / 2;
|
|
@@ -63,7 +61,6 @@ const Points = ({
|
|
|
63
61
|
H ${offset}
|
|
64
62
|
L 0,0 z`;
|
|
65
63
|
};
|
|
66
|
-
|
|
67
64
|
const bottomTooltipPath = (width, height, offset, radius) => {
|
|
68
65
|
const left = -width / 2;
|
|
69
66
|
const right = width / 2;
|
|
@@ -82,7 +79,6 @@ const Points = ({
|
|
|
82
79
|
H ${offset}
|
|
83
80
|
L 0,0 z`;
|
|
84
81
|
};
|
|
85
|
-
|
|
86
82
|
const leftTooltipPath = (width, height, offset, radius) => {
|
|
87
83
|
const left = -offset - width;
|
|
88
84
|
const right = -offset;
|
|
@@ -101,7 +97,6 @@ const Points = ({
|
|
|
101
97
|
V ${offset}
|
|
102
98
|
L 0,0 z`;
|
|
103
99
|
};
|
|
104
|
-
|
|
105
100
|
const rightTooltipPath = (width, height, offset, radius) => {
|
|
106
101
|
const left = offset;
|
|
107
102
|
const right = offset + width;
|
|
@@ -119,24 +114,22 @@ const Points = ({
|
|
|
119
114
|
Q ${left},${bottom} ${left},${bottom - radius}
|
|
120
115
|
V ${offset}
|
|
121
116
|
L 0,0 z`;
|
|
122
|
-
};
|
|
123
|
-
|
|
117
|
+
};
|
|
124
118
|
|
|
119
|
+
// Create event management function
|
|
125
120
|
const MouseEnterTarget = (e, i) => {
|
|
126
121
|
if (onEnter) onEnter(e, i);
|
|
127
122
|
document.getElementById('tooltipLine' + i).style.display = 'block';
|
|
128
123
|
};
|
|
129
|
-
|
|
130
124
|
const MouseLeaveTarget = (e, i) => {
|
|
131
125
|
if (onRemote) onRemote(e, i);
|
|
132
126
|
document.getElementById('tooltipLine' + i).style.display = 'none';
|
|
133
127
|
};
|
|
134
|
-
|
|
135
128
|
const handleChange = event => {
|
|
136
129
|
if (onClick) onClick(event);
|
|
137
|
-
};
|
|
138
|
-
|
|
130
|
+
};
|
|
139
131
|
|
|
132
|
+
// Create function to display tooltip by position
|
|
140
133
|
const getPlacement = (point, i) => {
|
|
141
134
|
// convert number -> string
|
|
142
135
|
const h = `${point.quantity}`;
|
|
@@ -145,7 +138,6 @@ const Points = ({
|
|
|
145
138
|
var y = 0;
|
|
146
139
|
var x1 = 0;
|
|
147
140
|
var y1 = 0;
|
|
148
|
-
|
|
149
141
|
if (h.length == 2 || h.length == 1 || h.length == 3) {
|
|
150
142
|
Width += 35;
|
|
151
143
|
x += 23;
|
|
@@ -153,7 +145,6 @@ const Points = ({
|
|
|
153
145
|
x1 += -23;
|
|
154
146
|
y1 += -8;
|
|
155
147
|
}
|
|
156
|
-
|
|
157
148
|
if (h.length == 4 || h.length == 5) {
|
|
158
149
|
Width += 40;
|
|
159
150
|
x += 26;
|
|
@@ -161,19 +152,15 @@ const Points = ({
|
|
|
161
152
|
x1 += -26;
|
|
162
153
|
y1 += -8;
|
|
163
154
|
}
|
|
164
|
-
|
|
165
155
|
if (h.length == 6 || h.length == 7) {
|
|
166
156
|
Width += 50;
|
|
167
157
|
}
|
|
168
|
-
|
|
169
158
|
if (h.length == 8 || h.length == 9) {
|
|
170
159
|
Width += 70;
|
|
171
160
|
}
|
|
172
|
-
|
|
173
161
|
if (h.length == 10 || h.length == 11) {
|
|
174
162
|
Width += 90;
|
|
175
163
|
}
|
|
176
|
-
|
|
177
164
|
const toolTipRight = jsx("g", {
|
|
178
165
|
id: `tooltipLine` + i,
|
|
179
166
|
className: 'DGN-Tooltip-Bar',
|
|
@@ -256,18 +243,14 @@ const Points = ({
|
|
|
256
243
|
css: textChartCSS,
|
|
257
244
|
fill: "#fff"
|
|
258
245
|
}, point.quantity));
|
|
259
|
-
|
|
260
246
|
if (pointHoverAlignment) {
|
|
261
247
|
switch (pointHoverAlignment) {
|
|
262
248
|
case 'right':
|
|
263
249
|
return toolTipRight;
|
|
264
|
-
|
|
265
250
|
case 'left':
|
|
266
251
|
return toolTipLeft;
|
|
267
|
-
|
|
268
252
|
case 'top':
|
|
269
253
|
return toolTipTop;
|
|
270
|
-
|
|
271
254
|
case 'bottom':
|
|
272
255
|
default:
|
|
273
256
|
return toolTipBottom;
|
|
@@ -276,19 +259,15 @@ const Points = ({
|
|
|
276
259
|
if (getX(point.x + unitWidth / 1.5) < 20) {
|
|
277
260
|
return toolTipRight;
|
|
278
261
|
}
|
|
279
|
-
|
|
280
262
|
if (getX(point.x + unitWidth / 1.5) > viewBoxWidth) {
|
|
281
263
|
return toolTipLeft;
|
|
282
264
|
}
|
|
283
|
-
|
|
284
265
|
if (getY(point.quantity) > 10) {
|
|
285
266
|
return toolTipTop;
|
|
286
267
|
}
|
|
287
|
-
|
|
288
268
|
return toolTipBottom;
|
|
289
269
|
}
|
|
290
270
|
};
|
|
291
|
-
|
|
292
271
|
return pointsVisible ? jsx("g", {
|
|
293
272
|
className: 'DGN-Point-LineChart'
|
|
294
273
|
}, data.map((point, i) => {
|
|
@@ -322,44 +301,31 @@ const Points = ({
|
|
|
322
301
|
}), getPlacement(point, i));
|
|
323
302
|
})) : null;
|
|
324
303
|
};
|
|
325
|
-
|
|
326
304
|
Points.propTypes = {
|
|
327
305
|
/** the getX position x on Ox*/
|
|
328
306
|
getX: PropTypes.func,
|
|
329
|
-
|
|
330
307
|
/** the getY position y on Oy */
|
|
331
308
|
getY: PropTypes.func,
|
|
332
|
-
|
|
333
309
|
/** the maxX is maximum of Ox quantity returned by data*/
|
|
334
310
|
maxX: PropTypes.number,
|
|
335
|
-
|
|
336
311
|
/** the maxY is maximum of Oy quantity returned by data*/
|
|
337
312
|
maxY: PropTypes.number,
|
|
338
|
-
|
|
339
313
|
/** the minX is minimum of OX quantity returned by data*/
|
|
340
314
|
minX: PropTypes.number,
|
|
341
|
-
|
|
342
315
|
/** the minY is minimum of Oy quantity returned by data*/
|
|
343
316
|
minY: PropTypes.number,
|
|
344
|
-
|
|
345
317
|
/** change the inner color of the point button */
|
|
346
318
|
pointsColor: PropTypes.string,
|
|
347
|
-
|
|
348
319
|
/** show data information when hovering in the area containing the column */
|
|
349
320
|
pointsIsHoverOnZone: PropTypes.bool,
|
|
350
|
-
|
|
351
321
|
/** change the radius of the point is created */
|
|
352
322
|
pointsRadius: PropTypes.number,
|
|
353
|
-
|
|
354
323
|
/** change the border color of the point button */
|
|
355
324
|
pointsStrokeColor: PropTypes.string,
|
|
356
|
-
|
|
357
325
|
/** show or hiden point */
|
|
358
326
|
pointsVisible: PropTypes.bool,
|
|
359
|
-
|
|
360
327
|
/** the unitWidth */
|
|
361
328
|
unitWidth: PropTypes.number,
|
|
362
|
-
|
|
363
329
|
/** the direction to display tootip */
|
|
364
330
|
pointHoverAlignment: PropTypes.oneOf(['top', 'bottom', 'left', 'right'])
|
|
365
331
|
};
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
4
3
|
import PropTypes from 'prop-types';
|
|
5
4
|
import { jsx } from '@emotion/core';
|
|
6
5
|
import Typography from '../../typography';
|
|
7
|
-
|
|
8
6
|
const Title = ({
|
|
9
7
|
data
|
|
10
8
|
}) => {
|
|
@@ -45,7 +43,6 @@ const Title = ({
|
|
|
45
43
|
}, d.label));
|
|
46
44
|
}))));
|
|
47
45
|
};
|
|
48
|
-
|
|
49
46
|
Title.defaultProps = {
|
|
50
47
|
data: []
|
|
51
48
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
4
3
|
import PropTypes from 'prop-types';
|
|
5
4
|
import { memo, forwardRef } from 'react';
|
|
@@ -7,8 +6,8 @@ import { jsx } from '@emotion/core';
|
|
|
7
6
|
import Axis from './Axis';
|
|
8
7
|
import Labels from './Labels';
|
|
9
8
|
import Grid from './Grid';
|
|
10
|
-
import Points from './Point';
|
|
11
|
-
|
|
9
|
+
import Points from './Point';
|
|
10
|
+
// import Title from './Title';
|
|
12
11
|
import Path from './Path';
|
|
13
12
|
import { randomString } from '../../../utils';
|
|
14
13
|
const LineChart = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
@@ -48,63 +47,55 @@ const LineChart = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
48
47
|
// '#FF00B8',
|
|
49
48
|
// '#FF3D71',
|
|
50
49
|
// ];
|
|
51
|
-
|
|
50
|
+
|
|
51
|
+
const dataSource = data.map((item, i) => ({
|
|
52
|
+
...item,
|
|
52
53
|
x: i
|
|
53
|
-
}));
|
|
54
|
+
}));
|
|
55
|
+
|
|
56
|
+
// console.log(dataSource);
|
|
54
57
|
|
|
55
58
|
const UNIT_WIDTH = 1;
|
|
56
59
|
const id = 'DGN-CUI-LineChart-' + randomString(6, {
|
|
57
60
|
allowNumber: false,
|
|
58
61
|
allowSymbol: false
|
|
59
62
|
});
|
|
60
|
-
|
|
61
63
|
const round = n => {
|
|
62
64
|
return Math.round(n * 100) / 100;
|
|
63
65
|
};
|
|
64
|
-
|
|
65
66
|
const getMinX = () => {
|
|
66
67
|
var _dataSource$;
|
|
67
|
-
|
|
68
68
|
return (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) > 0 ? (_dataSource$ = dataSource[0]) === null || _dataSource$ === void 0 ? void 0 : _dataSource$.x : 0;
|
|
69
69
|
};
|
|
70
|
-
|
|
71
70
|
const getMinY = () => {
|
|
72
71
|
return 0;
|
|
73
72
|
};
|
|
74
|
-
|
|
75
73
|
const getMaxX = () => {
|
|
76
74
|
var _dataSource;
|
|
77
|
-
|
|
78
75
|
return (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) > 0 ? (_dataSource = dataSource[(dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) - 1]) === null || _dataSource === void 0 ? void 0 : _dataSource.x : 0;
|
|
79
76
|
};
|
|
80
|
-
|
|
81
77
|
const getMaxY = () => {
|
|
82
78
|
var _dataSource$2;
|
|
83
|
-
|
|
84
79
|
const yStep = labelsCountY > 0 ? labelsCountY : 1;
|
|
85
80
|
const maxY = (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) > 0 ? dataSource.reduce((max, point) => point.quantity > max ? point.quantity : max, (_dataSource$2 = dataSource[0]) === null || _dataSource$2 === void 0 ? void 0 : _dataSource$2.quantity) : 0;
|
|
86
81
|
return maxY ? Math.ceil(maxY / yStep) * yStep : yStep;
|
|
87
82
|
};
|
|
88
|
-
|
|
89
83
|
const getSvgX = x => {
|
|
90
84
|
const minX = getMinX();
|
|
91
85
|
const maxX = getMaxX();
|
|
92
86
|
const paddingLeft = getLabelsYWidth();
|
|
93
87
|
return round((x - minX) / (maxX + 1 - minX) * (Math.abs(viewBoxWidth) - paddingLeft));
|
|
94
88
|
};
|
|
95
|
-
|
|
96
89
|
const getSvgY = y => {
|
|
97
90
|
const paddingBottom = labelsVisible ? labelsHeightX + labelsOffsetX : 0;
|
|
98
91
|
const height = Math.abs(viewBoxHeight) - paddingBottom;
|
|
99
92
|
const maxY = getMaxY();
|
|
100
93
|
return round(height - y / maxY * height);
|
|
101
94
|
};
|
|
102
|
-
|
|
103
95
|
const getLabelsYWidth = () => {
|
|
104
96
|
const maxY = getMaxY();
|
|
105
97
|
return labelsVisible ? maxY.toString().length * labelsCharacterWidth + labelsOffsetY : 0;
|
|
106
98
|
};
|
|
107
|
-
|
|
108
99
|
const minX = getMinX();
|
|
109
100
|
const maxX = getMaxX();
|
|
110
101
|
const maxY = getMaxY();
|
|
@@ -131,9 +122,11 @@ const LineChart = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
131
122
|
...style
|
|
132
123
|
},
|
|
133
124
|
ref: ref
|
|
134
|
-
}, jsx(Axis, {
|
|
125
|
+
}, jsx(Axis, {
|
|
126
|
+
...props,
|
|
135
127
|
...commonProps
|
|
136
|
-
}), jsx(Grid, {
|
|
128
|
+
}), jsx(Grid, {
|
|
129
|
+
...props,
|
|
137
130
|
...commonProps
|
|
138
131
|
}), jsx(Labels, {
|
|
139
132
|
data: dataSource,
|
|
@@ -165,53 +158,37 @@ LineChart.defaultProps = {
|
|
|
165
158
|
LineChart.propTypes = {
|
|
166
159
|
/** style inline for component */
|
|
167
160
|
style: PropTypes.object,
|
|
168
|
-
|
|
169
161
|
/** className for component */
|
|
170
162
|
className: PropTypes.string,
|
|
171
163
|
data: PropTypes.array.isRequired,
|
|
172
|
-
|
|
173
164
|
/** drawn Ratio of viewBoxHeight entered by user, default is: 200px */
|
|
174
165
|
viewBoxHeight: PropTypes.number,
|
|
175
|
-
|
|
176
166
|
/** drawn Ratio of viewBoxWidth entered by user, default is: 500px */
|
|
177
167
|
viewBoxWidth: PropTypes.number,
|
|
178
|
-
|
|
179
168
|
/** the axisColor change color */
|
|
180
169
|
axisColor: PropTypes.string,
|
|
181
|
-
|
|
182
170
|
/** the axisVisible Hide or show the Axis axis */
|
|
183
171
|
axisVisible: PropTypes.bool,
|
|
184
|
-
|
|
185
172
|
/** change style show of label ['', 'italic'], default: 'italic' */
|
|
186
173
|
labelStyle: PropTypes.string,
|
|
187
|
-
|
|
188
174
|
/** change Line grid display style ['full' , 'horizontal', 'none'], default: 'full'*/
|
|
189
175
|
GridLines: PropTypes.string,
|
|
190
|
-
|
|
191
176
|
/** show data information when hovering in the area containing the column */
|
|
192
177
|
pointsIsHoverOnZone: PropTypes.bool,
|
|
193
|
-
|
|
194
178
|
/** show or hidden point */
|
|
195
179
|
pointsVisible: PropTypes.bool,
|
|
196
|
-
|
|
197
180
|
/** change the inner color of the point button */
|
|
198
181
|
pointsColor: PropTypes.string,
|
|
199
|
-
|
|
200
182
|
/** change the radius of the point is created */
|
|
201
183
|
pointsRadius: PropTypes.number,
|
|
202
|
-
|
|
203
184
|
/** the thickness of the line to be drawn */
|
|
204
185
|
STROKE: PropTypes.number,
|
|
205
|
-
|
|
206
186
|
/** shows the line to be drawn */
|
|
207
187
|
PathVisible: PropTypes.bool,
|
|
208
|
-
|
|
209
188
|
/** The color of the line drawn is the default color according to the data returned from the API, otherwise it will be generated by the design. */
|
|
210
189
|
pathColor: PropTypes.string,
|
|
211
|
-
|
|
212
190
|
/** show or hidden the line to be drawn smooth */
|
|
213
191
|
Smooth: PropTypes.bool,
|
|
214
|
-
|
|
215
192
|
/** the direction to display tootip */
|
|
216
193
|
pointHoverAlignment: PropTypes.oneOf(['top', 'bottom', 'left', 'right']),
|
|
217
194
|
...Axis.propTypes,
|
|
@@ -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 + 10)
|
|
34
32
|
})) : null;
|
|
35
33
|
};
|
|
36
|
-
|
|
37
34
|
Axis.defaultProps = {
|
|
38
35
|
axisColor: '#7F828E',
|
|
39
36
|
axisVisible: true,
|
|
@@ -45,34 +42,24 @@ Axis.defaultProps = {
|
|
|
45
42
|
Axis.propTypes = {
|
|
46
43
|
/** the axisColor change color */
|
|
47
44
|
axisColor: PropTypes.string,
|
|
48
|
-
|
|
49
45
|
/** the axisOpacity property sets the opacity of an element*/
|
|
50
46
|
axisOpacity: PropTypes.number,
|
|
51
|
-
|
|
52
47
|
/** the axisVisible Hide or show the Axis axis */
|
|
53
48
|
axisVisible: PropTypes.bool,
|
|
54
|
-
|
|
55
49
|
/** the axisWidth change the thickness of the column */
|
|
56
50
|
axisWidth: PropTypes.number,
|
|
57
|
-
|
|
58
51
|
/** the getX position x on Ox*/
|
|
59
52
|
getX: PropTypes.func,
|
|
60
|
-
|
|
61
53
|
/** the getY position y on Oy */
|
|
62
54
|
getY: PropTypes.func,
|
|
63
|
-
|
|
64
55
|
/** the maxX is maximum of Ox quantity returned by data*/
|
|
65
56
|
maxX: PropTypes.number,
|
|
66
|
-
|
|
67
57
|
/** the maxY is maximum of Oy quantity returned by data*/
|
|
68
58
|
maxY: PropTypes.number,
|
|
69
|
-
|
|
70
59
|
/** the minX is minimum of OX quantity returned by data*/
|
|
71
60
|
minX: PropTypes.number,
|
|
72
|
-
|
|
73
61
|
/** the minY is minimum of Oy quantity returned by data*/
|
|
74
62
|
minY: PropTypes.number,
|
|
75
|
-
|
|
76
63
|
/** the unitWidth */
|
|
77
64
|
unitWidth: PropTypes.number
|
|
78
65
|
};
|
|
@@ -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; i++) {
|
|
24
21
|
gridX.push(jsx("line", {
|
|
25
22
|
key: i,
|
|
@@ -29,9 +26,7 @@ const Grid = ({
|
|
|
29
26
|
y2: getY(maxY + 10)
|
|
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-LineChart',
|
|
@@ -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-LineChart',
|
|
@@ -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 Line*/
|
|
80
69
|
gridColor: PropTypes.string,
|
|
81
|
-
|
|
82
70
|
/** change Line grid display style ['full' , 'horizontal', 'none'], default: 'full'*/
|
|
83
71
|
GridLines: PropTypes.string,
|
|
84
|
-
|
|
85
72
|
/** hiden or show grid Line*/
|
|
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
|
};
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
/* eslint-disable react/prop-types */
|
|
2
|
-
|
|
3
2
|
/** @jsxRuntime classic */
|
|
4
|
-
|
|
5
3
|
/** @jsx jsx */
|
|
6
4
|
import PropTypes from 'prop-types';
|
|
7
5
|
import { jsx, css } from '@emotion/core';
|
|
8
6
|
import theme from '../../../theme/settings';
|
|
9
7
|
import { typography } from '../../../styles/typography';
|
|
10
|
-
|
|
11
8
|
const Labels = ({
|
|
12
9
|
getX,
|
|
13
10
|
getY,
|
|
@@ -54,13 +51,11 @@ const Labels = ({
|
|
|
54
51
|
${typography.paragraph3};
|
|
55
52
|
fill: ${theme.colors.secondary};
|
|
56
53
|
`;
|
|
57
|
-
|
|
58
54
|
if (labelsVisible) {
|
|
59
55
|
let xLabels;
|
|
60
56
|
let yLabels;
|
|
61
57
|
let tile = 4;
|
|
62
58
|
let tile2 = 9;
|
|
63
|
-
|
|
64
59
|
const TiLe = () => {
|
|
65
60
|
// eslint-disable-next-line no-undef
|
|
66
61
|
if (viewBoxWidth >= 800) {
|
|
@@ -69,7 +64,6 @@ const Labels = ({
|
|
|
69
64
|
return tile2;
|
|
70
65
|
}
|
|
71
66
|
};
|
|
72
|
-
|
|
73
67
|
xLabels = labelStyle === 'italic' ? data.map((point, x) => jsx("text", {
|
|
74
68
|
key: x,
|
|
75
69
|
css: LabelCSS,
|
|
@@ -89,11 +83,9 @@ const Labels = ({
|
|
|
89
83
|
}, labelsFormatX(point.name))));
|
|
90
84
|
const yLabelsRange = [];
|
|
91
85
|
const yStep = labelsCountY > 0 ? labelsCountY : 1;
|
|
92
|
-
|
|
93
86
|
for (let i = 0; i <= maxY; i += Math.floor(maxY / yStep)) {
|
|
94
87
|
yLabelsRange.push(i);
|
|
95
88
|
}
|
|
96
|
-
|
|
97
89
|
yLabels = yLabelsRange.map(quantity => jsx("text", {
|
|
98
90
|
key: quantity,
|
|
99
91
|
fill: labelsColor,
|
|
@@ -115,7 +107,6 @@ const Labels = ({
|
|
|
115
107
|
return null;
|
|
116
108
|
}
|
|
117
109
|
};
|
|
118
|
-
|
|
119
110
|
Labels.defaultProps = {
|
|
120
111
|
getX: x => x,
|
|
121
112
|
getY: quantity => quantity,
|
|
@@ -135,13 +126,10 @@ Labels.defaultProps = {
|
|
|
135
126
|
Labels.propTypes = {
|
|
136
127
|
/** the getX position x on Ox*/
|
|
137
128
|
getX: PropTypes.func,
|
|
138
|
-
|
|
139
129
|
/** the getY position y on Oy */
|
|
140
130
|
getY: PropTypes.func,
|
|
141
|
-
|
|
142
131
|
/** the labelsColor change color */
|
|
143
132
|
labelsColor: PropTypes.string,
|
|
144
|
-
|
|
145
133
|
/** change style show of label ['', 'italic'], default: 'italic' */
|
|
146
134
|
labelStyle: PropTypes.string,
|
|
147
135
|
labelsCountY: PropTypes.number,
|
|
@@ -151,22 +139,16 @@ Labels.propTypes = {
|
|
|
151
139
|
labelsOffsetX: PropTypes.number,
|
|
152
140
|
labelsOffsetY: PropTypes.number,
|
|
153
141
|
labelsStepX: PropTypes.number,
|
|
154
|
-
|
|
155
142
|
/** change show or hiden of label */
|
|
156
143
|
labelsVisible: PropTypes.bool,
|
|
157
|
-
|
|
158
144
|
/** the maxX is maximum of Ox quantity returned by data*/
|
|
159
145
|
maxX: PropTypes.number,
|
|
160
|
-
|
|
161
146
|
/** the maxY is maximum of Oy quantity returned by data*/
|
|
162
147
|
maxY: PropTypes.number,
|
|
163
|
-
|
|
164
148
|
/** the minX is minimum of OX quantity returned by data*/
|
|
165
149
|
minX: PropTypes.number,
|
|
166
|
-
|
|
167
150
|
/** the minY is minimum of Oy quantity returned by data*/
|
|
168
151
|
minY: PropTypes.number,
|
|
169
|
-
|
|
170
152
|
/** the unitWidth */
|
|
171
153
|
unitWidth: PropTypes.number
|
|
172
154
|
};
|