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.
Files changed (209) hide show
  1. package/components/accordion/details.js +2 -6
  2. package/components/accordion/group.js +2 -9
  3. package/components/accordion/index.js +2 -15
  4. package/components/accordion/summary.js +4 -27
  5. package/components/alert/index.js +98 -137
  6. package/components/alert/notify.js +97 -166
  7. package/components/avatar/index.js +4 -63
  8. package/components/badge/index.js +7 -34
  9. package/components/button/icon.js +120 -186
  10. package/components/button/index.js +136 -205
  11. package/components/button/more.js +0 -12
  12. package/components/button/ripple-effect.js +46 -44
  13. package/components/card/body.js +2 -7
  14. package/components/card/extra.js +2 -7
  15. package/components/card/footer.js +2 -7
  16. package/components/card/header.js +2 -7
  17. package/components/card/index.js +2 -22
  18. package/components/chart/Pie/Circle.js +0 -1
  19. package/components/chart/Pie/Sector.js +0 -17
  20. package/components/chart/Pie/Sectors.js +0 -10
  21. package/components/chart/Pie/index.js +4 -36
  22. package/components/chart/Pie-v2/Circle.js +0 -1
  23. package/components/chart/Pie-v2/Sector.js +0 -13
  24. package/components/chart/Pie-v2/Sectors.js +0 -20
  25. package/components/chart/Pie-v2/index.js +11 -38
  26. package/components/chart/bar/Axis.js +0 -12
  27. package/components/chart/bar/Bar.js +13 -35
  28. package/components/chart/bar/Grid.js +0 -18
  29. package/components/chart/bar/Labels.js +0 -18
  30. package/components/chart/bar/Points.js +0 -17
  31. package/components/chart/bar/index.js +6 -26
  32. package/components/chart/bar-v2/Axis.js +0 -12
  33. package/components/chart/bar-v2/Bar.js +15 -36
  34. package/components/chart/bar-v2/Grid.js +0 -18
  35. package/components/chart/bar-v2/Labels.js +0 -18
  36. package/components/chart/bar-v2/Points.js +0 -17
  37. package/components/chart/bar-v2/index.js +6 -26
  38. package/components/chart/line/Axis.js +4 -16
  39. package/components/chart/line/Grid.js +2 -19
  40. package/components/chart/line/Labels.js +0 -18
  41. package/components/chart/line/Path.js +23 -33
  42. package/components/chart/line/Point.js +6 -40
  43. package/components/chart/line/Title.js +0 -3
  44. package/components/chart/line/index.js +12 -35
  45. package/components/chart/line-v2/Axis.js +0 -13
  46. package/components/chart/line-v2/Grid.js +0 -18
  47. package/components/chart/line-v2/Labels.js +0 -18
  48. package/components/chart/line-v2/Path.js +23 -33
  49. package/components/chart/line-v2/Point.js +6 -35
  50. package/components/chart/line-v2/Title.js +0 -3
  51. package/components/chart/line-v2/index.js +12 -30
  52. package/components/check-text/index.js +0 -8
  53. package/components/check-text/interview-confirmation.js +0 -7
  54. package/components/check-text/interview-status.js +0 -7
  55. package/components/chip/attach.js +4 -17
  56. package/components/chip/index.js +6 -33
  57. package/components/collapse/index.js +0 -13
  58. package/components/divider/index.js +0 -8
  59. package/components/form-control/attachment/index.js +24 -202
  60. package/components/form-control/calendar/function.js +40 -94
  61. package/components/form-control/calendar/index.js +5 -30
  62. package/components/form-control/calendar/range.js +11 -28
  63. package/components/form-control/checkbox/index.js +4 -37
  64. package/components/form-control/control/index.js +3 -13
  65. package/components/form-control/date-picker/index-old.js +18 -0
  66. package/components/form-control/date-picker/index.js +23 -99
  67. package/components/form-control/date-range-picker/index.js +86 -221
  68. package/components/form-control/dropdown/index.js +72 -289
  69. package/components/form-control/dropdown-box/index.js +6 -35
  70. package/components/form-control/form/index.js +0 -2
  71. package/components/form-control/form-group/index.js +1 -6
  72. package/components/form-control/helper-text/index.js +2 -9
  73. package/components/form-control/input-base/index.js +218 -399
  74. package/components/form-control/label/index.js +2 -12
  75. package/components/form-control/money-input/index.js +43 -132
  76. package/components/form-control/number-input/index.js +15 -113
  77. package/components/form-control/number-input/index2.js +78 -119
  78. package/components/form-control/phone-input/index.js +16 -78
  79. package/components/form-control/radio/index.js +4 -23
  80. package/components/form-control/text-input/index.js +33 -256
  81. package/components/form-control/time-picker/index.js +14 -71
  82. package/components/form-control/time-picker/swiper.js +21 -73
  83. package/components/form-control/toggle/index.js +4 -19
  84. package/components/form-view/helper-text.js +2 -2
  85. package/components/form-view/index.js +0 -14
  86. package/components/form-view/input.js +2 -13
  87. package/components/form-view/label.js +0 -2
  88. package/components/grid/Col.js +2 -15
  89. package/components/grid/Container.js +2 -21
  90. package/components/grid/Row.js +2 -21
  91. package/components/grid/index.js +2 -43
  92. package/components/image/index.js +2 -22
  93. package/components/index.js +62 -31
  94. package/components/list/list-item-action.js +0 -9
  95. package/components/list/list-item-icon.js +0 -9
  96. package/components/list/list-item-text.js +0 -5
  97. package/components/list/list-item.js +0 -11
  98. package/components/list/list.js +0 -13
  99. package/components/list/sub-header.js +0 -4
  100. package/components/modal/body.js +2 -6
  101. package/components/modal/footer.js +2 -11
  102. package/components/modal/header.js +2 -12
  103. package/components/modal/index.js +2 -10
  104. package/components/modal/modal.js +11 -52
  105. package/components/others/extra/index.js +3 -10
  106. package/components/others/import/index.js +0 -7
  107. package/components/others/option-wrapper/index.js +4 -7
  108. package/components/others/scrollbar/index.js +0 -3
  109. package/components/paging/page-info.js +39 -101
  110. package/components/paging/page-selector.js +7 -35
  111. package/components/paging/page-selector2.js +35 -74
  112. package/components/paper/index.js +0 -11
  113. package/components/popover/body.js +2 -6
  114. package/components/popover/footer.js +2 -11
  115. package/components/popover/header.js +2 -7
  116. package/components/popover/index.js +39 -123
  117. package/components/popup/danger_popup.js +0 -19
  118. package/components/popup/index.js +2 -48
  119. package/components/popup/proposals_popup.js +10 -49
  120. package/components/popup/v2/index.js +0 -31
  121. package/components/progress/circular.js +19 -81
  122. package/components/progress/linear.js +4 -20
  123. package/components/rating/index.js +0 -24
  124. package/components/slider/slider-container.js +3 -40
  125. package/components/slider/slider-item.js +10 -25
  126. package/components/status/index.js +2 -16
  127. package/components/tab/tab-container.js +2 -16
  128. package/components/tab/tab-header.js +4 -24
  129. package/components/tab/tab-panel.js +4 -16
  130. package/components/tab/tab.js +4 -28
  131. package/components/tooltip/index.js +12 -97
  132. package/components/tooltip/portal.js +0 -2
  133. package/components/transfer/index.js +22 -67
  134. package/components/tree-view/index.js +62 -202
  135. package/components/typography/index.js +3 -31
  136. package/global/index.js +0 -8
  137. package/icons/basic.js +0 -48
  138. package/icons/effect.js +17 -29
  139. package/icons/general/clock/clock.js +0 -2
  140. package/icons/general/color-handler/background.js +0 -2
  141. package/icons/general/color-handler/text.js +0 -2
  142. package/icons/general/emoji/emoji.js +0 -2
  143. package/icons/general/font-properties/bold.js +0 -2
  144. package/icons/general/font-properties/font-family.js +0 -2
  145. package/icons/general/font-properties/font-size.js +0 -2
  146. package/icons/general/font-properties/italic.js +0 -2
  147. package/icons/general/font-properties/underline.js +0 -2
  148. package/icons/general/hyperlink/hyperlink.js +0 -2
  149. package/icons/general/indent/decrease.js +0 -2
  150. package/icons/general/indent/increase.js +0 -2
  151. package/icons/general/list/bullets.js +0 -2
  152. package/icons/general/list/numbering.js +0 -2
  153. package/icons/general/picture/picture.js +0 -2
  154. package/icons/general/steps/redo.js +0 -2
  155. package/icons/general/steps/undo.js +0 -2
  156. package/icons/general/text-align/center.js +0 -2
  157. package/icons/general/text-align/justify.js +0 -2
  158. package/icons/general/text-align/left.js +0 -2
  159. package/icons/general/text-align/right.js +0 -2
  160. package/icons/menu/dhr.js +2 -1
  161. package/icons/menu/index.js +2 -2
  162. package/icons/menu/v2/index.js +0 -10
  163. package/package.json +1 -1
  164. package/readme.md +11 -1
  165. package/styles/animation.js +15 -58
  166. package/styles/color-helper.js +24 -54
  167. package/styles/colors.js +17 -9
  168. package/styles/general.js +6 -2
  169. package/styles/typography.js +4 -4
  170. package/styles/utils.js +2 -2
  171. package/theme/createBreakpoints.js +7 -18
  172. package/theme/make-styles.js +2 -5
  173. package/theme/set-theme.js +3 -6
  174. package/theme/settings.js +3 -2
  175. package/theme/theme-provider.js +0 -1
  176. package/utils/array/array.js +14 -23
  177. package/utils/classNames.js +0 -5
  178. package/utils/console.js +0 -6
  179. package/utils/date.js +13 -82
  180. package/utils/error/error.js +1 -9
  181. package/utils/error/errors.js +1 -48
  182. package/utils/getFileType.js +0 -9
  183. package/utils/handleBreakpoints.js +0 -5
  184. package/utils/intersectionObserver.js +0 -5
  185. package/utils/iterator.js +0 -9
  186. package/utils/map-parent.js +3 -10
  187. package/utils/object/extend.js +0 -10
  188. package/utils/object/object.js +12 -11
  189. package/utils/parseHTML.js +0 -1
  190. package/utils/promisify.js +0 -5
  191. package/utils/randomString.js +0 -7
  192. package/utils/remove-unicode.js +0 -1
  193. package/utils/render-portal.js +1 -9
  194. package/utils/renderHTML.js +4 -6
  195. package/utils/renderIcon.js +4 -14
  196. package/utils/sb-template.js +6 -5
  197. package/utils/string/capitalize.js +0 -1
  198. package/utils/string/capitalizeSentenceCase.js +0 -2
  199. package/utils/string/string.js +0 -13
  200. package/utils/type.js +0 -21
  201. package/utils/updatePosition.js +4 -5
  202. package/utils/useDelayUnmount.js +0 -4
  203. package/utils/useElementSize.js +9 -3
  204. package/utils/useEventListener.js +12 -6
  205. package/utils/useInput.js +0 -6
  206. package/utils/useMediaQuery.js +8 -10
  207. package/utils/useOnClickOutside.js +0 -2
  208. package/utils/usePortal.js +3 -10
  209. package/utils/validate.js +6 -20
@@ -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 Points = ({
8
6
  data,
9
7
  getX,
@@ -47,52 +45,37 @@ const Points = ({
47
45
  }, jsx("title", null, point.name, " : ", point.quantity));
48
46
  })) : null;
49
47
  };
50
-
51
48
  Points.propTypes = {
52
49
  data: PropTypes.arrayOf(PropTypes.shape({
53
50
  x: PropTypes.number,
54
51
  quantity: PropTypes.number
55
52
  })).isRequired,
56
-
57
53
  /** the getX position x on Ox*/
58
54
  getX: PropTypes.func,
59
-
60
55
  /** the getY position y on Oy */
61
56
  getY: PropTypes.func,
62
-
63
57
  /** the maxX is maximum of Ox quantity returned by data*/
64
58
  maxX: PropTypes.number,
65
-
66
59
  /** the maxY is maximum of Oy quantity returned by data*/
67
60
  maxY: PropTypes.number,
68
-
69
61
  /** the minX is minimum of OX quantity returned by data*/
70
62
  minX: PropTypes.number,
71
-
72
63
  /** the minY is minimum of Oy quantity returned by data*/
73
64
  minY: PropTypes.number,
74
-
75
65
  /** change the inner color of the point button */
76
66
  pointsColor: PropTypes.string,
77
-
78
67
  /** show data information when hovering in the area containing the column */
79
68
  pointsIsHoverOnZone: PropTypes.bool,
80
-
81
69
  /** function change event hover */
82
70
  onHover: PropTypes.func,
83
-
84
71
  /** change the radius of the point is created */
85
72
  pointsRadius: PropTypes.number,
86
-
87
73
  /** change the border color of the point button */
88
74
  pointsStrokeColor: PropTypes.string,
89
-
90
75
  /** the thickness of the inner core point */
91
76
  pointsStrokeWidth: PropTypes.number,
92
-
93
77
  /** show or hiden point */
94
78
  pointsVisible: PropTypes.bool,
95
-
96
79
  /** the unitWidth */
97
80
  unitWidth: PropTypes.number
98
81
  };
@@ -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';
@@ -22,7 +21,8 @@ const BarChart = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
22
21
  labelsHeightX,
23
22
  ...props
24
23
  }, ref) => {
25
- const dataSource = data.map((item, i) => ({ ...item,
24
+ const dataSource = data.map((item, i) => ({
25
+ ...item,
26
26
  x: i
27
27
  }));
28
28
  const UNIT_WIDTH = 1;
@@ -30,48 +30,39 @@ const BarChart = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
30
30
  allowNumber: false,
31
31
  allowSymbol: false
32
32
  });
33
-
34
33
  const round = n => {
35
34
  return Math.round(n * 100) / 100;
36
35
  };
37
-
38
36
  const getMinX = () => {
39
37
  return dataSource.length > 0 ? dataSource[0].x : 0;
40
38
  };
41
-
42
39
  const getMaxX = () => {
43
40
  return dataSource.length > 0 ? dataSource[dataSource.length - 1].x : 0;
44
41
  };
45
-
46
42
  const getMinY = () => {
47
43
  return 0;
48
44
  };
49
-
50
45
  const getMaxY = () => {
51
46
  const yStep = labelsCountY > 0 ? labelsCountY : 1;
52
47
  const maxY = dataSource.length > 0 ? dataSource.reduce((max, point) => point.quantity > max ? point.quantity : max, dataSource[0].quantity) : 0;
53
48
  return maxY ? Math.ceil(maxY / yStep) * yStep : yStep;
54
49
  };
55
-
56
50
  const getSvgX = x => {
57
51
  const minX = getMinX();
58
52
  const maxX = getMaxX();
59
53
  const paddingLeft = getLabelsYWidth();
60
54
  return round((x - minX) / (maxX + 1 - minX) * (Math.abs(viewBoxWidth) - paddingLeft));
61
55
  };
62
-
63
56
  const getSvgY = y => {
64
57
  const paddingBottom = labelsVisible ? labelsHeightX + labelsOffsetX : 0;
65
58
  const height = Math.abs(viewBoxHeight) - paddingBottom;
66
59
  const maxY = getMaxY();
67
60
  return round(height - y / maxY * height);
68
61
  };
69
-
70
62
  const getLabelsYWidth = () => {
71
63
  const maxY = getMaxY();
72
64
  return labelsVisible ? maxY.toString().length * labelsCharacterWidth + labelsOffsetY : 0;
73
65
  };
74
-
75
66
  const minX = getMinX();
76
67
  const maxX = getMaxX();
77
68
  const maxY = getMaxY();
@@ -96,9 +87,11 @@ const BarChart = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
96
87
  overflow: 'visible',
97
88
  margin: `${getLabelsYWidth() * 2}`
98
89
  }
99
- }, jsx(Axis, { ...props,
90
+ }, jsx(Axis, {
91
+ ...props,
100
92
  ...commonProps
101
- }), jsx(Grid, { ...props,
93
+ }), jsx(Grid, {
94
+ ...props,
102
95
  ...commonProps
103
96
  }), jsx(Bars, {
104
97
  data: dataSource,
@@ -131,45 +124,32 @@ BarChart.propTypes = {
131
124
  x: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
132
125
  quantity: PropTypes.number
133
126
  })).isRequired,
134
-
135
127
  /** drawn Ratio of viewBoxHeight entered by user, default is: 200px */
136
128
  viewBoxHeight: PropTypes.number,
137
-
138
129
  /** drawn Ratio of viewBoxWidth entered by user, default is: 500px */
139
130
  viewBoxWidth: PropTypes.number,
140
-
141
131
  /** change color of Bar in BarChart */
142
132
  barsColor: PropTypes.string,
143
-
144
133
  /** change ColumB grid display style ['full' , 'horizontal', 'none']*/
145
134
  GridLines: PropTypes.string,
146
135
  //** change style show of label (default, italic) */
147
136
  labelStyle: PropTypes.string,
148
-
149
137
  /** the axisVisible Hide or show the Axis axis */
150
138
  axisVisible: PropTypes.bool,
151
-
152
139
  /** the axisColor change color */
153
140
  axisColor: PropTypes.string,
154
-
155
141
  /** change color of grid Columb*/
156
142
  gridColor: PropTypes.string,
157
-
158
143
  /** show data information when hovering in the area containing the column */
159
144
  pointsIsHoverOnZone: PropTypes.bool,
160
-
161
145
  /** show or hiden point */
162
146
  pointsVisible: PropTypes.bool,
163
-
164
147
  /** change the inner color of the point button */
165
148
  pointsColor: PropTypes.string,
166
-
167
149
  /** change the border color of the point button */
168
150
  pointsStrokeColor: PropTypes.string,
169
-
170
151
  /** the thickness of the inner core point */
171
152
  pointsStrokeWidth: PropTypes.number,
172
-
173
153
  /** change the radius of the point is created */
174
154
  pointsRadius: PropTypes.number,
175
155
  ...Bars.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,
@@ -13,8 +11,8 @@ const Axis = ({
13
11
  // maxX,
14
12
  // maxY,
15
13
  minX,
16
- minY // unitWidth,
17
-
14
+ minY
15
+ // unitWidth,
18
16
  }) => {
19
17
  // drawn Oxygen coordinate systems for width and height are entered or by default
20
18
  return axisVisible ? jsx("g", {
@@ -23,7 +21,8 @@ const Axis = ({
23
21
  strokeWidth: axisWidth
24
22
  }, jsx("line", {
25
23
  x1: getX(minX),
26
- y1: getY(minY) // x2={getX(maxX + unitWidth + 0.5)}
24
+ y1: getY(minY)
25
+ // x2={getX(maxX + unitWidth + 0.5)}
27
26
  ,
28
27
  x2: '100%',
29
28
  y2: getY(minY)
@@ -34,7 +33,6 @@ const Axis = ({
34
33
  y2: '-10%'
35
34
  })) : null;
36
35
  };
37
-
38
36
  Axis.defaultProps = {
39
37
  axisColor: '#7F828E',
40
38
  axisVisible: true,
@@ -46,34 +44,24 @@ Axis.defaultProps = {
46
44
  Axis.propTypes = {
47
45
  /** the axisColor change color */
48
46
  axisColor: PropTypes.string,
49
-
50
47
  /** the axisOpacity property sets the opacity of an element*/
51
48
  axisOpacity: PropTypes.number,
52
-
53
49
  /** the axisVisible Hide or show the Axis axis */
54
50
  axisVisible: PropTypes.bool,
55
-
56
51
  /** the axisWidth change the thickness of the column */
57
52
  axisWidth: PropTypes.number,
58
-
59
53
  /** the getX position x on Ox*/
60
54
  getX: PropTypes.func,
61
-
62
55
  /** the getY position y on Oy */
63
56
  getY: PropTypes.func,
64
-
65
57
  /** the maxX is maximum of Ox quantity returned by data*/
66
58
  maxX: PropTypes.number,
67
-
68
59
  /** the maxY is maximum of Oy quantity returned by data*/
69
60
  maxY: PropTypes.number,
70
-
71
61
  /** the minX is minimum of OX quantity returned by data*/
72
62
  minX: PropTypes.number,
73
-
74
63
  /** the minY is minimum of Oy quantity returned by data*/
75
64
  minY: PropTypes.number,
76
-
77
65
  /** the unitWidth */
78
66
  unitWidth: PropTypes.number
79
67
  };
@@ -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,20 +26,18 @@ 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,
38
33
  x1: getX(minX),
39
- y1: getY(i) // x2={getX(maxX + unitWidth + 0.5)}
34
+ y1: getY(i)
35
+ // x2={getX(maxX + unitWidth + 0.5)}
40
36
  ,
41
37
  x2: '100%',
42
38
  y2: getY(i)
43
39
  }));
44
40
  }
45
-
46
41
  if (GridLines === 'full') {
47
42
  return jsx("g", {
48
43
  className: 'DGN-Grid-LineChart',
@@ -50,7 +45,6 @@ const Grid = ({
50
45
  strokeWidth: gridWidth
51
46
  }, gridX, gridY);
52
47
  }
53
-
54
48
  if (GridLines === 'horizontal') {
55
49
  return jsx("g", {
56
50
  className: 'DGN-Grid-LineChart',
@@ -58,7 +52,6 @@ const Grid = ({
58
52
  strokeWidth: gridWidth
59
53
  }, gridY);
60
54
  }
61
-
62
55
  if (GridLines === 'none') {
63
56
  return null;
64
57
  } else {
@@ -69,37 +62,27 @@ const Grid = ({
69
62
  }, gridY);
70
63
  }
71
64
  };
72
-
73
65
  Grid.propTypes = {
74
66
  /** the getX position x on Ox*/
75
67
  getX: PropTypes.func,
76
-
77
68
  /** the getY position y on Oy */
78
69
  getY: PropTypes.func,
79
-
80
70
  /** change color of grid Line*/
81
71
  gridColor: PropTypes.string,
82
-
83
72
  /** change Line grid display style ['full' , 'horizontal', 'none'], default: 'full'*/
84
73
  GridLines: PropTypes.string,
85
-
86
74
  /** hiden or show grid Line*/
87
75
  gridVisible: PropTypes.bool,
88
76
  gridWidth: PropTypes.number,
89
77
  labelsCountY: PropTypes.number,
90
-
91
78
  /** the maxX is maximum of Ox quantity returned by data*/
92
79
  maxX: PropTypes.number,
93
-
94
80
  /** the maxY is maximum of Oy quantity returned by data*/
95
81
  maxY: PropTypes.number,
96
-
97
82
  /** the minX is minimum of OX quantity returned by data*/
98
83
  minX: PropTypes.number,
99
-
100
84
  /** the minY is minimum of Oy quantity returned by data*/
101
85
  minY: PropTypes.number,
102
-
103
86
  /** the unitWidth */
104
87
  unitWidth: PropTypes.number
105
88
  };
@@ -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
  };
@@ -1,12 +1,9 @@
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 { color as colors } from '../../../styles/colors';
9
-
10
7
  const Path = ({
11
8
  data,
12
9
  getX,
@@ -22,7 +19,9 @@ const Path = ({
22
19
  const x = getX(element.x + unitWidth / 1.5);
23
20
  const y = getY(element.quantity);
24
21
  return [x, y];
25
- }); // const Colors = data.map(element => {
22
+ });
23
+
24
+ // const Colors = data.map(element => {
26
25
  // const colors = element.color;
27
26
  // return colors;
28
27
  // });
@@ -39,58 +38,58 @@ const Path = ({
39
38
  stroke-linejoin: round;
40
39
  stroke-width: ${STROKEHover};
41
40
  } */
42
- `; // Properties of a line
41
+ `;
42
+
43
+ // Properties of a line
43
44
  // I: - pointA (array) [x,y]: coordinates
44
45
  // - pointB (array) [x,y]: coordinates
45
46
  // O: - (object) { length: l, angle: a }: properties of the line
46
-
47
47
  const line = (pointA, pointB) => {
48
48
  const lengthX = pointB[0] - pointA[0];
49
49
  const lengthY = pointB[1] - pointA[1];
50
50
  const Balance = 0.005 * Math.PI;
51
51
  const Re = 0.38 * Math.PI;
52
52
  let angle = Math.atan2(lengthY, lengthX);
53
-
54
53
  if (angle < -0.32 * Math.PI) {
55
54
  angle += Re; // make sure the returned angle is in the range of (-PI/2, 3PI/2]
56
55
  }
57
56
 
58
57
  if (angle > 0.16 * Math.PI) {
59
58
  angle -= Balance;
60
- } // console.log(angle);
59
+ }
61
60
 
61
+ // console.log(angle);
62
62
 
63
63
  return {
64
64
  length: Math.sqrt(Math.pow(lengthX, 2) + Math.pow(lengthY, 2)),
65
65
  angle
66
66
  };
67
- }; // Position of a control point
67
+ };
68
+
69
+ // Position of a control point
68
70
  // I: - current (array) [x, y]: current point coordinates
69
71
  // - previous (array) [x, y]: previous point coordinates
70
72
  // - next (array) [x, y]: next point coordinates
71
73
  // - reverse (boolean, optional): sets the direction
72
74
  // O: - (array) [x,y]: a tuple of coordinates
73
-
74
-
75
75
  const controlPoint = (current, previous, next, reverse) => {
76
76
  // When 'current' is the first or last point of the array
77
77
  // 'previous' or 'next' don't exist.
78
78
  // Replace with 'current'
79
79
  const c = current;
80
80
  const p = previous ? previous : c;
81
- const n = next ? next : c; // The smoothing ratio
82
-
83
- const smoothing = 0.15; // Properties of the opposed-line
84
-
85
- const o = line(p, n); // If is end-control-point, add PI to the angle to go backward
86
-
87
- const rev = reverse ? Math.PI : 0; // The control point position is relative to the current point
88
-
81
+ const n = next ? next : c;
82
+ // The smoothing ratio
83
+ const smoothing = 0.15;
84
+ // Properties of the opposed-line
85
+ const o = line(p, n);
86
+ // If is end-control-point, add PI to the angle to go backward
87
+ const rev = reverse ? Math.PI : 0;
88
+ // The control point position is relative to the current point
89
89
  const x = c[0] + Math.cos(o.angle + rev) * o.length * smoothing;
90
90
  const y = c[1] + Math.sin(o.angle * 0.095 + rev) * o.length * smoothing;
91
91
  return [x, y];
92
92
  };
93
-
94
93
  const svgPathRender = point => {
95
94
  const d = point.reduce((acc, e, i, a) => {
96
95
  if (i > 0) {
@@ -107,13 +106,13 @@ const Path = ({
107
106
  fill: 'none'
108
107
  });
109
108
  };
110
-
111
109
  const command = point => `L ${point[0]} ${point[1]} `;
112
-
113
110
  const svgPath = points => {
114
111
  // build the d attributes by looping over the points
115
- const d = points.reduce((acc, point, i, a) => i === 0 ? // if first point
116
- `M ${point[0]},${point[1]}` : // else
112
+ const d = points.reduce((acc, point, i, a) => i === 0 ?
113
+ // if first point
114
+ `M ${point[0]},${point[1]}` :
115
+ // else
117
116
  `${acc} ${command(point, i, a)}`, '');
118
117
  return jsx("path", {
119
118
  d: d,
@@ -121,36 +120,27 @@ const Path = ({
121
120
  fill: 'none'
122
121
  });
123
122
  };
124
-
125
123
  return PathVisible ? jsx("g", {
126
124
  className: 'DGN-Path-LineChart'
127
125
  }, Smooth ? svgPathRender(point) : svgPath(point)) : null;
128
126
  };
129
-
130
127
  Path.defaultProps = {
131
128
  data: PropTypes.arrayOf(PropTypes.shape({
132
129
  x: PropTypes.number,
133
130
  quantity: PropTypes.number
134
131
  })).isRequired,
135
-
136
132
  /** the getX position x on Ox*/
137
133
  getX: PropTypes.func,
138
-
139
134
  /** the getY position y on Oy */
140
135
  getY: PropTypes.func,
141
-
142
136
  /** 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. */
143
137
  pathColor: PropTypes.string,
144
-
145
138
  /** shows the line to be drawn */
146
139
  PathVisible: PropTypes.bool,
147
-
148
140
  /** show or hiden the line to be drawn smooth */
149
141
  Smooth: PropTypes.bool,
150
-
151
142
  /** the thickness of the line to be drawn */
152
143
  STROKE: PropTypes.number,
153
-
154
144
  /** the unitWidth */
155
145
  unitWidth: PropTypes.number
156
146
  };