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,11 +1,8 @@
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
-
9
6
  const Path = ({
10
7
  data,
11
8
  getX,
@@ -21,7 +18,9 @@ const Path = ({
21
18
  const x = getX(element.x + unitWidth / 1.5);
22
19
  const y = getY(element.quantity);
23
20
  return [x, y];
24
- }); // const Colors = data.map(element => {
21
+ });
22
+
23
+ // const Colors = data.map(element => {
25
24
  // const colors = element.color;
26
25
  // return colors;
27
26
  // });
@@ -38,58 +37,58 @@ const Path = ({
38
37
  stroke-linejoin: round;
39
38
  stroke-width: ${STROKEHover};
40
39
  } */
41
- `; // Properties of a line
40
+ `;
41
+
42
+ // Properties of a line
42
43
  // I: - pointA (array) [x,y]: coordinates
43
44
  // - pointB (array) [x,y]: coordinates
44
45
  // O: - (object) { length: l, angle: a }: properties of the line
45
-
46
46
  const line = (pointA, pointB) => {
47
47
  const lengthX = pointB[0] - pointA[0];
48
48
  const lengthY = pointB[1] - pointA[1];
49
49
  const Balance = 0.005 * Math.PI;
50
50
  const Re = 0.38 * Math.PI;
51
51
  let angle = Math.atan2(lengthY, lengthX);
52
-
53
52
  if (angle < -0.32 * Math.PI) {
54
53
  angle += Re; // make sure the returned angle is in the range of (-PI/2, 3PI/2]
55
54
  }
56
55
 
57
56
  if (angle > 0.16 * Math.PI) {
58
57
  angle -= Balance;
59
- } // console.log(angle);
58
+ }
60
59
 
60
+ // console.log(angle);
61
61
 
62
62
  return {
63
63
  length: Math.sqrt(Math.pow(lengthX, 2) + Math.pow(lengthY, 2)),
64
64
  angle
65
65
  };
66
- }; // Position of a control point
66
+ };
67
+
68
+ // Position of a control point
67
69
  // I: - current (array) [x, y]: current point coordinates
68
70
  // - previous (array) [x, y]: previous point coordinates
69
71
  // - next (array) [x, y]: next point coordinates
70
72
  // - reverse (boolean, optional): sets the direction
71
73
  // O: - (array) [x,y]: a tuple of coordinates
72
-
73
-
74
74
  const controlPoint = (current, previous, next, reverse) => {
75
75
  // When 'current' is the first or last point of the array
76
76
  // 'previous' or 'next' don't exist.
77
77
  // Replace with 'current'
78
78
  const c = current;
79
79
  const p = previous ? previous : c;
80
- const n = next ? next : c; // The smoothing ratio
81
-
82
- const smoothing = 0.15; // Properties of the opposed-line
83
-
84
- const o = line(p, n); // If is end-control-point, add PI to the angle to go backward
85
-
86
- const rev = reverse ? Math.PI : 0; // The control point position is relative to the current point
87
-
80
+ const n = next ? next : c;
81
+ // The smoothing ratio
82
+ const smoothing = 0.15;
83
+ // Properties of the opposed-line
84
+ const o = line(p, n);
85
+ // If is end-control-point, add PI to the angle to go backward
86
+ const rev = reverse ? Math.PI : 0;
87
+ // The control point position is relative to the current point
88
88
  const x = c[0] + Math.cos(o.angle + rev) * o.length * smoothing;
89
89
  const y = c[1] + Math.sin(o.angle * 0.095 + rev) * o.length * smoothing;
90
90
  return [x, y];
91
91
  };
92
-
93
92
  const svgPathRender = point => {
94
93
  const d = point.reduce((acc, e, i, a) => {
95
94
  if (i > 0) {
@@ -106,13 +105,13 @@ const Path = ({
106
105
  fill: 'none'
107
106
  });
108
107
  };
109
-
110
108
  const command = point => `L ${point[0]} ${point[1]} `;
111
-
112
109
  const svgPath = points => {
113
110
  // build the d attributes by looping over the points
114
- const d = points.reduce((acc, point, i, a) => i === 0 ? // if first point
115
- `M ${point[0]},${point[1]}` : // else
111
+ const d = points.reduce((acc, point, i, a) => i === 0 ?
112
+ // if first point
113
+ `M ${point[0]},${point[1]}` :
114
+ // else
116
115
  `${acc} ${command(point, i, a)}`, '');
117
116
  return jsx("path", {
118
117
  d: d,
@@ -120,36 +119,27 @@ const Path = ({
120
119
  fill: 'none'
121
120
  });
122
121
  };
123
-
124
122
  return PathVisible ? jsx("g", {
125
123
  className: 'DGN-Path-LineChart'
126
124
  }, Smooth ? svgPathRender(point) : svgPath(point)) : null;
127
125
  };
128
-
129
126
  Path.defaultProps = {
130
127
  data: PropTypes.arrayOf(PropTypes.shape({
131
128
  x: PropTypes.number,
132
129
  quantity: PropTypes.number
133
130
  })).isRequired,
134
-
135
131
  /** the getX position x on Ox*/
136
132
  getX: PropTypes.func,
137
-
138
133
  /** the getY position y on Oy */
139
134
  getY: PropTypes.func,
140
-
141
135
  /** 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. */
142
136
  pathColor: PropTypes.string,
143
-
144
137
  /** shows the line to be drawn */
145
138
  PathVisible: PropTypes.bool,
146
-
147
139
  /** show or hiden the line to be drawn smooth */
148
140
  Smooth: PropTypes.bool,
149
-
150
141
  /** the thickness of the line to be drawn */
151
142
  STROKE: PropTypes.number,
152
-
153
143
  /** the unitWidth */
154
144
  unitWidth: PropTypes.number
155
145
  };
@@ -1,14 +1,11 @@
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';
8
6
  import { jsx, css } from '@emotion/core';
9
7
  import { randomString } from '../../../utils';
10
8
  import { typography } from '../../../styles/typography';
11
-
12
9
  const Points = ({
13
10
  data,
14
11
  getX,
@@ -47,8 +44,9 @@ const Points = ({
47
44
  const textChartCSS = css`
48
45
  text-anchor: middle;
49
46
  ${typography.paragraph3};
50
- `; // create drawing function tooltips in different positions
47
+ `;
51
48
 
49
+ // create drawing function tooltips in different positions
52
50
  const topTooltipPath = (width, height, offset, radius) => {
53
51
  const left = -width / 2;
54
52
  const right = width / 2;
@@ -67,7 +65,6 @@ const Points = ({
67
65
  H ${offset}
68
66
  L 0,0 z`;
69
67
  };
70
-
71
68
  const bottomTooltipPath = (width, height, offset, radius) => {
72
69
  const left = -width / 2;
73
70
  const right = width / 2;
@@ -86,7 +83,6 @@ const Points = ({
86
83
  H ${offset}
87
84
  L 0,0 z`;
88
85
  };
89
-
90
86
  const leftTooltipPath = (width, height, offset, radius) => {
91
87
  const left = -offset - width;
92
88
  const right = -offset;
@@ -105,7 +101,6 @@ const Points = ({
105
101
  V ${offset}
106
102
  L 0,0 z`;
107
103
  };
108
-
109
104
  const rightTooltipPath = (width, height, offset, radius) => {
110
105
  const left = offset;
111
106
  const right = offset + width;
@@ -123,24 +118,22 @@ const Points = ({
123
118
  Q ${left},${bottom} ${left},${bottom - radius}
124
119
  V ${offset}
125
120
  L 0,0 z`;
126
- }; // Create event management function
127
-
121
+ };
128
122
 
123
+ // Create event management function
129
124
  const MouseEnterTarget = (e, i) => {
130
125
  if (onEnter) onEnter(e, i);
131
126
  document.getElementById(`${id}` + i).style.display = 'block';
132
127
  };
133
-
134
128
  const MouseLeaveTarget = (e, i) => {
135
129
  if (onRemote) onRemote(e, i);
136
130
  document.getElementById(`${id}` + i).style.display = 'none';
137
131
  };
138
-
139
132
  const handleChange = event => {
140
133
  if (onClick) onClick(event);
141
- }; // Create function to display tooltip by position
142
-
134
+ };
143
135
 
136
+ // Create function to display tooltip by position
144
137
  const getPlacement = (point, i) => {
145
138
  // convert number -> string
146
139
  const h = `${point.quantity}`;
@@ -149,7 +142,6 @@ const Points = ({
149
142
  var y = 0;
150
143
  var x1 = 0;
151
144
  var y1 = 0;
152
-
153
145
  if (h.length == 2 || h.length == 1 || h.length == 3) {
154
146
  Width += 35;
155
147
  x += 23;
@@ -157,7 +149,6 @@ const Points = ({
157
149
  x1 += -23;
158
150
  y1 += -8;
159
151
  }
160
-
161
152
  if (h.length == 4 || h.length == 5) {
162
153
  Width += 40;
163
154
  x += 26;
@@ -165,19 +156,15 @@ const Points = ({
165
156
  x1 += -26;
166
157
  y1 += -8;
167
158
  }
168
-
169
159
  if (h.length == 6 || h.length == 7) {
170
160
  Width += 50;
171
161
  }
172
-
173
162
  if (h.length == 8 || h.length == 9) {
174
163
  Width += 70;
175
164
  }
176
-
177
165
  if (h.length == 10 || h.length == 11) {
178
166
  Width += 90;
179
167
  }
180
-
181
168
  if (getX(point.x + unitWidth / 1.5) < 20) {
182
169
  return jsx("g", {
183
170
  id: `${id}` + i,
@@ -201,7 +188,6 @@ const Points = ({
201
188
  fill: "#fff"
202
189
  }, point.quantity));
203
190
  }
204
-
205
191
  if (getX(point.x + unitWidth / 1.5) > viewBoxWidth) {
206
192
  return jsx("g", {
207
193
  id: `${id}` + i,
@@ -225,7 +211,6 @@ const Points = ({
225
211
  fill: "#fff"
226
212
  }, point.quantity));
227
213
  }
228
-
229
214
  if (getY(point.quantity) > 10) {
230
215
  return jsx("g", {
231
216
  id: `${id}` + i,
@@ -248,7 +233,6 @@ const Points = ({
248
233
  fill: "#fff"
249
234
  }, point.quantity));
250
235
  }
251
-
252
236
  return jsx("g", {
253
237
  id: `${id}` + i,
254
238
  className: 'DGN-Tooltip-Bar',
@@ -270,7 +254,6 @@ const Points = ({
270
254
  fill: "#fff"
271
255
  }, point.quantity));
272
256
  };
273
-
274
257
  return pointsVisible ? jsx("g", {
275
258
  className: 'DGN-Point-LineChart'
276
259
  }, data.map((point, i) => {
@@ -304,41 +287,29 @@ const Points = ({
304
287
  }), getPlacement(point, i));
305
288
  })) : null;
306
289
  };
307
-
308
290
  Points.propTypes = {
309
291
  /** the getX position x on Ox*/
310
292
  getX: PropTypes.func,
311
-
312
293
  /** the getY position y on Oy */
313
294
  getY: PropTypes.func,
314
-
315
295
  /** the maxX is maximum of Ox quantity returned by data*/
316
296
  maxX: PropTypes.number,
317
-
318
297
  /** the maxY is maximum of Oy quantity returned by data*/
319
298
  maxY: PropTypes.number,
320
-
321
299
  /** the minX is minimum of OX quantity returned by data*/
322
300
  minX: PropTypes.number,
323
-
324
301
  /** the minY is minimum of Oy quantity returned by data*/
325
302
  minY: PropTypes.number,
326
-
327
303
  /** change the inner color of the point button */
328
304
  pointsColor: PropTypes.string,
329
-
330
305
  /** show data information when hovering in the area containing the column */
331
306
  pointsIsHoverOnZone: PropTypes.bool,
332
-
333
307
  /** change the radius of the point is created */
334
308
  pointsRadius: PropTypes.number,
335
-
336
309
  /** change the border color of the point button */
337
310
  pointsStrokeColor: PropTypes.string,
338
-
339
311
  /** show or hiden point */
340
312
  pointsVisible: PropTypes.bool,
341
-
342
313
  /** the unitWidth */
343
314
  unitWidth: PropTypes.number
344
315
  };
@@ -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'; // import Title from './Title';
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 BarChart = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
@@ -26,57 +25,52 @@ const BarChart = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
26
25
  ...props
27
26
  }, ref) => {
28
27
  // const colors = ['#FFD600', '#FFA800', '#FF7A00', '#FF0000', '#B61414', '#8FFF00', '#629000', '#019A5A', '#00C875', '#00FFD1', '#4200FF', '#0075FF', '#0095FF', '#00C2FF', '#00E0FF', '#8F00FF', '#BD00FF', '#FA00FF', '#FF00B8', '#FF3D71'];
29
- const dataSource = data.map((item, i) => ({ ...item,
28
+
29
+ const dataSource = data.map((item, i) => ({
30
+ ...item,
30
31
  x: i
31
- })); // console.log(dataSource);
32
+ }));
33
+
34
+ // console.log(dataSource);
32
35
 
33
36
  const UNIT_WIDTH = 1;
34
37
  const id = 'DGN-CUI-LineChart-' + randomString(6, {
35
38
  allowNumber: false,
36
39
  allowSymbol: false
37
40
  });
38
-
39
41
  const round = n => {
40
42
  return Math.round(n * 100) / 100;
41
43
  };
42
-
43
44
  const getMinX = () => {
44
45
  return dataSource.length > 0 ? dataSource[0].x : 0;
45
46
  };
46
-
47
47
  const getMinY = () => {
48
48
  return 0;
49
49
  };
50
-
51
50
  const getMaxX = () => {
52
51
  return dataSource.length > 0 ? dataSource[dataSource.length - 1].x : 0;
53
52
  };
54
-
55
53
  const getMaxY = () => {
56
54
  const yStep = labelsCountY > 0 ? labelsCountY : 1;
57
55
  const maxY = dataSource.length > 0 ? dataSource.reduce((max, point) => point.quantity > max ? point.quantity : max, dataSource[0].quantity) : 0;
58
56
  return maxY ? Math.ceil(maxY / yStep) * yStep : yStep;
59
57
  };
60
-
61
58
  const getSvgX = x => {
62
59
  const minX = getMinX();
63
60
  const maxX = getMaxX();
64
61
  const paddingLeft = getLabelsYWidth();
65
62
  return round((x - minX) / (maxX + 1 - minX) * (Math.abs(viewBoxWidth) - paddingLeft));
66
63
  };
67
-
68
64
  const getSvgY = y => {
69
65
  const paddingBottom = labelsVisible ? labelsHeightX + labelsOffsetX : 0;
70
66
  const height = Math.abs(viewBoxHeight) - paddingBottom;
71
67
  const maxY = getMaxY();
72
68
  return round(height - y / maxY * height);
73
69
  };
74
-
75
70
  const getLabelsYWidth = () => {
76
71
  const maxY = getMaxY();
77
72
  return labelsVisible ? maxY.toString().length * labelsCharacterWidth + labelsOffsetY : 0;
78
73
  };
79
-
80
74
  const minX = getMinX();
81
75
  const maxX = getMaxX();
82
76
  const maxY = getMaxY();
@@ -102,9 +96,11 @@ const BarChart = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
102
96
  overflow: 'visible',
103
97
  margin: `${getLabelsYWidth() * 2}`
104
98
  }
105
- }, jsx(Axis, { ...props,
99
+ }, jsx(Axis, {
100
+ ...props,
106
101
  ...commonProps
107
- }), jsx(Grid, { ...props,
102
+ }), jsx(Grid, {
103
+ ...props,
108
104
  ...commonProps
109
105
  }), jsx(Labels, {
110
106
  data: dataSource,
@@ -133,46 +129,32 @@ BarChart.defaultProps = {
133
129
  };
134
130
  BarChart.propTypes = {
135
131
  data: PropTypes.array.isRequired,
136
-
137
132
  /** drawn Ratio of viewBoxHeight entered by user, default is: 200px */
138
133
  viewBoxHeight: PropTypes.number,
139
-
140
134
  /** drawn Ratio of viewBoxWidth entered by user, default is: 500px */
141
135
  viewBoxWidth: PropTypes.number,
142
-
143
136
  /** the axisColor change color */
144
137
  axisColor: PropTypes.string,
145
-
146
138
  /** the axisVisible Hide or show the Axis axis */
147
139
  axisVisible: PropTypes.bool,
148
-
149
140
  /** change style show of label ['', 'italic'], default: 'italic' */
150
141
  labelStyle: PropTypes.string,
151
-
152
142
  /** change Line grid display style ['full' , 'horizontal', 'none'], default: 'full'*/
153
143
  GridLines: PropTypes.string,
154
-
155
144
  /** show data information when hovering in the area containing the column */
156
145
  pointsIsHoverOnZone: PropTypes.bool,
157
-
158
146
  /** show or hiden point */
159
147
  pointsVisible: PropTypes.bool,
160
-
161
148
  /** change the inner color of the point button */
162
149
  pointsColor: PropTypes.string,
163
-
164
150
  /** change the radius of the point is created */
165
151
  pointsRadius: PropTypes.number,
166
-
167
152
  /** the thickness of the line to be drawn */
168
153
  STROKE: PropTypes.number,
169
-
170
154
  /** shows the line to be drawn */
171
155
  PathVisible: PropTypes.bool,
172
-
173
156
  /** 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. */
174
157
  pathColor: PropTypes.string,
175
-
176
158
  /** show or hiden the line to be drawn smooth */
177
159
  Smooth: PropTypes.bool,
178
160
  ...Axis.propTypes,
@@ -1,5 +1,4 @@
1
1
  /** @jsxRuntime classic */
2
-
3
2
  /** @jsx jsx */
4
3
  import { memo, useEffect, useRef, forwardRef } from 'react';
5
4
  import PropTypes from 'prop-types';
@@ -24,7 +23,6 @@ const InterviewStatus = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
24
23
  if (!ref) {
25
24
  ref = useRef(null);
26
25
  }
27
-
28
26
  const checkText = css`
29
27
  display: inline-flex;
30
28
  color: ${disabled ? theme.colors.disabled : theme.colors.border};
@@ -48,7 +46,6 @@ const InterviewStatus = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
48
46
  background: ${theme.colors.border};
49
47
  border-radius: 1px;
50
48
  `;
51
-
52
49
  const onClickItem = (e, index) => {
53
50
  const clickedItem = ref.current.querySelectorAll('div');
54
51
  if (readOnly || clickedItem[index].style.color) return;
@@ -66,7 +63,6 @@ const InterviewStatus = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
66
63
  if (onClick) onClick(e);
67
64
  if (onChoose) onChoose(e);
68
65
  };
69
-
70
66
  useEffect(() => {
71
67
  ref.current.querySelectorAll('div').forEach((el, i) => {
72
68
  if (i === chosen || el.textContent === chosen) {
@@ -142,16 +138,12 @@ InterviewStatus.defaultProps = {
142
138
  InterviewStatus.propsTypes = {
143
139
  /** Prevent all event if true */
144
140
  disabled: PropTypes.bool,
145
-
146
141
  /** Item of CheckText in CheckText component */
147
142
  option: PropTypes.oneOf(['status', 'success', 'warning', 'danger']),
148
-
149
143
  /** the displayed chosen for each change */
150
144
  chosen: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
151
-
152
145
  /** The function will run to return a value of CheckText Component */
153
146
  onClick: PropTypes.func,
154
-
155
147
  /** The function will run to return a value of CheckText Component */
156
148
  onChoose: PropTypes.func
157
149
  };
@@ -1,5 +1,4 @@
1
1
  /** @jsxRuntime classic */
2
-
3
2
  /** @jsx jsx */
4
3
  import { memo, useMemo, useEffect, useRef, forwardRef } from 'react';
5
4
  import PropTypes from 'prop-types';
@@ -22,7 +21,6 @@ const InterviewConfirmation = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
22
21
  if (!ref) {
23
22
  ref = useRef(null);
24
23
  }
25
-
26
24
  const checkText = css`
27
25
  display: inline-flex;
28
26
  color: ${disabled ? theme.colors.disabled : theme.colors.border};
@@ -46,7 +44,6 @@ const InterviewConfirmation = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
46
44
  background: ${theme.colors.border};
47
45
  border-radius: 1px;
48
46
  `;
49
-
50
47
  const onClickItem = (e, index) => {
51
48
  const clickedItem = ref.current.querySelectorAll('div');
52
49
  if (readOnly || clickedItem[index].style.color) return;
@@ -64,7 +61,6 @@ const InterviewConfirmation = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
64
61
  if (onClick) onClick(e);
65
62
  if (onChoose) onChoose(e);
66
63
  };
67
-
68
64
  useEffect(() => {
69
65
  ref.current.querySelectorAll('div').forEach((el, i) => {
70
66
  if (i === chosen || el.textContent === chosen) {
@@ -159,13 +155,10 @@ const InterviewConfirmation = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
159
155
  InterviewConfirmation.propsTypes = {
160
156
  /** Prevent all event if true */
161
157
  disabled: PropTypes.bool,
162
-
163
158
  /** the displayed chosen for each change */
164
159
  chosen: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
165
-
166
160
  /** The function will run to return a value of CheckText Component */
167
161
  onClick: PropTypes.func,
168
-
169
162
  /** The function will run to return a value of CheckText Component */
170
163
  onChoose: PropTypes.func
171
164
  };
@@ -1,5 +1,4 @@
1
1
  /** @jsxRuntime classic */
2
-
3
2
  /** @jsx jsx */
4
3
  import { memo, useMemo, useEffect, useRef, forwardRef } from 'react';
5
4
  import PropTypes from 'prop-types';
@@ -22,7 +21,6 @@ const InterviewStatus = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
22
21
  if (!ref) {
23
22
  ref = useRef(null);
24
23
  }
25
-
26
24
  const checkText = css`
27
25
  display: inline-flex;
28
26
  color: ${disabled ? theme.colors.disabled : theme.colors.border};
@@ -46,7 +44,6 @@ const InterviewStatus = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
46
44
  background: ${theme.colors.border};
47
45
  border-radius: 1px;
48
46
  `;
49
-
50
47
  const onClickItem = (e, index) => {
51
48
  const clickedItem = ref.current.querySelectorAll('div');
52
49
  if (readOnly || clickedItem[index].style.color) return;
@@ -64,7 +61,6 @@ const InterviewStatus = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
64
61
  if (onClick) onClick(e);
65
62
  if (onChoose) onChoose(e);
66
63
  };
67
-
68
64
  useEffect(() => {
69
65
  ref.current.querySelectorAll('div').forEach((el, i) => {
70
66
  if (i === chosen || el.textContent === chosen) {
@@ -125,13 +121,10 @@ const InterviewStatus = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
125
121
  InterviewStatus.propsTypes = {
126
122
  /** Prevent all event if true */
127
123
  disabled: PropTypes.bool,
128
-
129
124
  /** the displayed chosen for each change */
130
125
  chosen: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
131
-
132
126
  /** The function will run to return a value of CheckText Component */
133
127
  onClick: PropTypes.func,
134
-
135
128
  /** The function will run to return a value of CheckText Component */
136
129
  onChoose: PropTypes.func
137
130
  };