diginet-core-ui 1.3.43 → 1.3.45

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 (30) hide show
  1. package/assets/images/menu/dhr/MHRM00N0005.svg +11 -0
  2. package/assets/images/menu/dhr/MHRM09N1010.svg +12 -0
  3. package/assets/images/menu/dhr/MHRM09N1015.svg +18 -0
  4. package/assets/images/menu/dhr/MHRM09N1020.svg +13 -0
  5. package/assets/images/menu/dhr/MHRM09N1400.svg +11 -0
  6. package/assets/images/menu/dhr/MHRP25L0101.svg +15 -0
  7. package/assets/images/menu/dhr/MHRP25L0501.svg +14 -0
  8. package/components/button/icon.js +211 -216
  9. package/components/chart/line/Axis.js +11 -10
  10. package/components/chart/line/Grid.js +4 -3
  11. package/components/chart/line/Path.js +11 -10
  12. package/components/chart/line/Point.js +107 -80
  13. package/components/chart/line/index.js +36 -17
  14. package/components/form-control/checkbox/index.js +5 -5
  15. package/components/form-control/date-picker/index.js +131 -119
  16. package/components/form-control/dropdown/index.js +3 -4
  17. package/components/form-control/dropdown-box/index.js +1 -1
  18. package/components/form-control/helper-text/index.js +35 -33
  19. package/components/form-control/input-base/index.js +318 -317
  20. package/components/form-control/text-input/index.js +4 -4
  21. package/components/form-control/time-picker/index.js +10 -19
  22. package/components/modal/modal.js +10 -4
  23. package/components/paging/page-info.js +78 -41
  24. package/components/slider/slider-container.js +150 -126
  25. package/components/slider/slider-item.js +84 -89
  26. package/components/tree-view/css.js +17 -16
  27. package/components/tree-view/index.js +41 -23
  28. package/package.json +1 -1
  29. package/readme.md +20 -0
  30. package/theme/settings.js +3 -1
@@ -1,7 +1,7 @@
1
1
  /** @jsxRuntime classic */
2
2
 
3
3
  /** @jsx jsx */
4
- import PropTypes from "prop-types";
4
+ import PropTypes from 'prop-types';
5
5
  import { jsx } from '@emotion/core';
6
6
 
7
7
  const Axis = ({
@@ -10,27 +10,28 @@ const Axis = ({
10
10
  axisWidth,
11
11
  getX,
12
12
  getY,
13
- maxX,
14
- maxY,
13
+ // maxX,
14
+ // maxY,
15
15
  minX,
16
- minY,
17
- unitWidth
16
+ minY // unitWidth,
17
+
18
18
  }) => {
19
- // drawn Oxygen coordinate systems for width and height are entered or by default
19
+ // drawn Oxygen coordinate systems for width and height are entered or by default
20
20
  return axisVisible ? jsx("g", {
21
- className: 'DGN-Axis-LineChart',
21
+ className: 'DGN-UI-LineChart-Axis',
22
22
  stroke: axisColor,
23
23
  strokeWidth: axisWidth
24
24
  }, jsx("line", {
25
25
  x1: getX(minX),
26
- y1: getY(minY),
27
- x2: getX(maxX + unitWidth + 0.5),
26
+ y1: getY(minY) // x2={getX(maxX + unitWidth + 0.5)}
27
+ ,
28
+ x2: '100%',
28
29
  y2: getY(minY)
29
30
  }), jsx("line", {
30
31
  x1: getX(minX),
31
32
  y1: getY(minX),
32
33
  x2: getX(minX),
33
- y2: getY(maxY + 10)
34
+ y2: '-10%'
34
35
  })) : null;
35
36
  };
36
37
 
@@ -1,7 +1,7 @@
1
1
  /** @jsxRuntime classic */
2
2
 
3
3
  /** @jsx jsx */
4
- import PropTypes from "prop-types";
4
+ import PropTypes from 'prop-types';
5
5
  import { jsx } from '@emotion/core';
6
6
 
7
7
  const Grid = ({
@@ -36,8 +36,9 @@ const Grid = ({
36
36
  gridY.push(jsx("line", {
37
37
  key: i,
38
38
  x1: getX(minX),
39
- y1: getY(i),
40
- x2: getX(maxX + unitWidth + 0.5),
39
+ y1: getY(i) // x2={getX(maxX + unitWidth + 0.5)}
40
+ ,
41
+ x2: '100%',
41
42
  y2: getY(i)
42
43
  }));
43
44
  }
@@ -1,8 +1,9 @@
1
1
  /** @jsxRuntime classic */
2
2
 
3
3
  /** @jsx jsx */
4
- import PropTypes from "prop-types";
4
+ import PropTypes from 'prop-types';
5
5
  import { jsx, css } from '@emotion/core';
6
+ import { color as colors } from '../../../styles/colors';
6
7
 
7
8
  const Path = ({
8
9
  data,
@@ -26,18 +27,18 @@ const Path = ({
26
27
  return colors;
27
28
  });
28
29
  const PathCSS = css`
29
- stroke: ${pathColor};
30
+ stroke: ${colors[pathColor] || pathColor};
30
31
  stroke-width: ${STROKE};
31
32
  stroke-linecap: round;
32
33
  stroke-linejoin: round;
33
34
  /* &:hover {
34
35
  cursor: pointer;
35
- stroke: ${pathColor};
36
+ stroke: ${colors[pathColor] || pathColor};
36
37
  stroke-linecap: round;
37
38
  stroke-linejoin: round;
38
39
  stroke-width: ${STROKEHover};
39
40
  } */
40
- `; // Properties of a line
41
+ `; // Properties of a line
41
42
  // I: - pointA (array) [x,y]: coordinates
42
43
  // - pointB (array) [x,y]: coordinates
43
44
  // O: - (object) { length: l, angle: a }: properties of the line
@@ -62,7 +63,7 @@ const Path = ({
62
63
  length: Math.sqrt(Math.pow(lengthX, 2) + Math.pow(lengthY, 2)),
63
64
  angle
64
65
  };
65
- }; // Position of a control point
66
+ }; // Position of a control point
66
67
  // I: - current (array) [x, y]: current point coordinates
67
68
  // - previous (array) [x, y]: previous point coordinates
68
69
  // - next (array) [x, y]: next point coordinates
@@ -102,7 +103,7 @@ const Path = ({
102
103
  return jsx("path", {
103
104
  d: d,
104
105
  css: PathCSS,
105
- fill: "none"
106
+ fill: 'none'
106
107
  });
107
108
  };
108
109
 
@@ -110,13 +111,13 @@ const Path = ({
110
111
 
111
112
  const svgPath = points => {
112
113
  // build the d attributes by looping over the points
113
- const d = points.reduce((acc, point, i, a) => i === 0 // if first point
114
- ? `M ${point[0]},${point[1]}` // else
115
- : `${acc} ${command(point, i, a)}`, '');
114
+ const d = points.reduce((acc, point, i, a) => i === 0 ? // if first point
115
+ `M ${point[0]},${point[1]}` : // else
116
+ `${acc} ${command(point, i, a)}`, '');
116
117
  return jsx("path", {
117
118
  d: d,
118
119
  css: PathCSS,
119
- fill: "none"
120
+ fill: 'none'
120
121
  });
121
122
  };
122
123
 
@@ -1,9 +1,10 @@
1
1
  /** @jsxRuntime classic */
2
2
 
3
3
  /** @jsx jsx */
4
- import PropTypes from "prop-types";
4
+ import PropTypes from 'prop-types';
5
5
  import { jsx, css } from '@emotion/core';
6
- import { typography } from "../../../styles/typography";
6
+ import { typography } from '../../../styles/typography';
7
+ import { color as colors } from '../../../styles/colors';
7
8
 
8
9
  const Points = ({
9
10
  data,
@@ -23,16 +24,17 @@ const Points = ({
23
24
  pointsVisible,
24
25
  strokeWidth,
25
26
  onClick,
26
- unitWidth
27
+ unitWidth,
28
+ pointHoverAlignment
27
29
  }) => {
28
30
  const PointCSS = css`
29
- fill: ${pointsColor};
31
+ fill: ${colors[pointsColor] || pointsColor};
30
32
  stroke: ${pointsStrokeColor};
31
33
  stroke-width: ${strokeWidth};
32
34
  &:hover {
33
35
  cursor: pointer;
34
36
  fill: #fff;
35
- stroke: ${pointsColor};
37
+ stroke: ${colors[pointsColor] || pointsColor};
36
38
  stroke-width: ${pointsStrokeHover};
37
39
  }
38
40
  `;
@@ -170,78 +172,69 @@ const Points = ({
170
172
  Width += 90;
171
173
  }
172
174
 
173
- if (getX(point.x + unitWidth / 1.5) < 20) {
174
- return jsx("g", {
175
- id: `tooltipLine` + i,
176
- className: 'DGN-Tooltip-Bar',
177
- style: {
178
- display: 'none'
179
- },
180
- transform: `translate(${getX(point.x + unitWidth / 1.5) + 4}, ${getY(point.quantity)})`
181
- }, jsx("path", {
182
- d: rightTooltipPath(Width, 20, 6, 4),
183
- fill: pointsColor,
184
- stroke: pointsColor,
185
- style: {
186
- filter: 'drop-shadow(0px 0px 4px rgba(0, 0, 0, 0.15))'
187
- }
188
- }), jsx("text", {
189
- x: x,
190
- y: y,
191
- dy: "1em",
192
- css: textChartCSS,
193
- fill: "#fff"
194
- }, point.quantity));
195
- }
196
-
197
- if (getX(point.x + unitWidth / 1.5) > viewBoxWidth) {
198
- return jsx("g", {
199
- id: `tooltipLine` + i,
200
- className: 'DGN-Tooltip-Bar',
201
- style: {
202
- display: 'none'
203
- },
204
- transform: `translate(${getX(point.x + unitWidth / 1.5) - 4}, ${getY(point.quantity)})`
205
- }, jsx("path", {
206
- d: leftTooltipPath(Width, 20, 6, 4),
207
- fill: pointsColor,
208
- stroke: pointsColor,
209
- style: {
210
- filter: 'drop-shadow(0px 0px 4px rgba(0, 0, 0, 0.15))'
211
- }
212
- }), jsx("text", {
213
- x: x1,
214
- y: y1,
215
- dy: "1em",
216
- css: textChartCSS,
217
- fill: "#fff"
218
- }, point.quantity));
219
- }
220
-
221
- if (getY(point.quantity) > 10) {
222
- return jsx("g", {
223
- id: `tooltipLine` + i,
224
- className: 'DGN-Tooltip-Bar',
225
- style: {
226
- display: 'none'
227
- },
228
- transform: `translate(${getX(point.x + unitWidth / 1.5)}, ${getY(point.quantity) - 4})`
229
- }, jsx("path", {
230
- d: topTooltipPath(Width, 20, 6, 4),
231
- fill: pointsColor,
232
- stroke: pointsColor,
233
- style: {
234
- filter: 'drop-shadow(0px 0px 4px rgba(0, 0, 0, 0.15))'
235
- }
236
- }), jsx("text", {
237
- y: "-23",
238
- dy: "1em",
239
- css: textChartCSS,
240
- fill: "#fff"
241
- }, point.quantity));
242
- }
243
-
244
- return jsx("g", {
175
+ const toolTipRight = jsx("g", {
176
+ id: `tooltipLine` + i,
177
+ className: 'DGN-Tooltip-Bar',
178
+ style: {
179
+ display: 'none'
180
+ },
181
+ transform: `translate(${getX(point.x + unitWidth / 1.5) + 4}, ${getY(point.quantity)})`
182
+ }, jsx("path", {
183
+ d: rightTooltipPath(Width, 20, 6, 4),
184
+ fill: colors[pointsColor] || pointsColor,
185
+ stroke: colors[pointsColor] || pointsColor,
186
+ style: {
187
+ filter: 'drop-shadow(0px 0px 4px rgba(0, 0, 0, 0.15))'
188
+ }
189
+ }), jsx("text", {
190
+ x: x,
191
+ y: y,
192
+ dy: "1em",
193
+ css: textChartCSS,
194
+ fill: "#fff"
195
+ }, point.quantity));
196
+ const toolTipLeft = jsx("g", {
197
+ id: `tooltipLine` + i,
198
+ className: 'DGN-Tooltip-Bar',
199
+ style: {
200
+ display: 'none'
201
+ },
202
+ transform: `translate(${getX(point.x + unitWidth / 1.5) - 4}, ${getY(point.quantity)})`
203
+ }, jsx("path", {
204
+ d: leftTooltipPath(Width, 20, 6, 4),
205
+ fill: colors[pointsColor] || pointsColor,
206
+ stroke: colors[pointsColor] || pointsColor,
207
+ style: {
208
+ filter: 'drop-shadow(0px 0px 4px rgba(0, 0, 0, 0.15))'
209
+ }
210
+ }), jsx("text", {
211
+ x: x1,
212
+ y: y1,
213
+ dy: "1em",
214
+ css: textChartCSS,
215
+ fill: "#fff"
216
+ }, point.quantity));
217
+ const toolTipTop = jsx("g", {
218
+ id: `tooltipLine` + i,
219
+ className: 'DGN-Tooltip-Bar',
220
+ style: {
221
+ display: 'none'
222
+ },
223
+ transform: `translate(${getX(point.x + unitWidth / 1.5)}, ${getY(point.quantity) - 4})`
224
+ }, jsx("path", {
225
+ d: topTooltipPath(Width, 20, 6, 4),
226
+ fill: colors[pointsColor] || pointsColor,
227
+ stroke: colors[pointsColor] || pointsColor,
228
+ style: {
229
+ filter: 'drop-shadow(0px 0px 4px rgba(0, 0, 0, 0.15))'
230
+ }
231
+ }), jsx("text", {
232
+ y: "-23",
233
+ dy: "1em",
234
+ css: textChartCSS,
235
+ fill: "#fff"
236
+ }, point.quantity));
237
+ const toolTipBottom = jsx("g", {
245
238
  id: `tooltipLine` + i,
246
239
  className: 'DGN-Tooltip-Bar',
247
240
  style: {
@@ -250,8 +243,8 @@ const Points = ({
250
243
  transform: `translate(${getX(point.x + unitWidth / 1.5)}, ${getY(point.quantity) + 4})`
251
244
  }, jsx("path", {
252
245
  d: bottomTooltipPath(Width, 20, 6, 4),
253
- fill: pointsColor,
254
- stroke: pointsColor,
246
+ fill: colors[pointsColor] || pointsColor,
247
+ stroke: colors[pointsColor] || pointsColor,
255
248
  style: {
256
249
  filter: 'drop-shadow(0px 0px 4px rgba(0, 0, 0, 0.15))'
257
250
  }
@@ -261,6 +254,37 @@ const Points = ({
261
254
  css: textChartCSS,
262
255
  fill: "#fff"
263
256
  }, point.quantity));
257
+
258
+ if (pointHoverAlignment) {
259
+ switch (pointHoverAlignment) {
260
+ case 'right':
261
+ return toolTipRight;
262
+
263
+ case 'left':
264
+ return toolTipLeft;
265
+
266
+ case 'top':
267
+ return toolTipTop;
268
+
269
+ case 'bottom':
270
+ default:
271
+ return toolTipBottom;
272
+ }
273
+ } else {
274
+ if (getX(point.x + unitWidth / 1.5) < 20) {
275
+ return toolTipRight;
276
+ }
277
+
278
+ if (getX(point.x + unitWidth / 1.5) > viewBoxWidth) {
279
+ return toolTipLeft;
280
+ }
281
+
282
+ if (getY(point.quantity) > 10) {
283
+ return toolTipTop;
284
+ }
285
+
286
+ return toolTipBottom;
287
+ }
264
288
  };
265
289
 
266
290
  return pointsVisible ? jsx("g", {
@@ -332,7 +356,10 @@ Points.propTypes = {
332
356
  pointsVisible: PropTypes.bool,
333
357
 
334
358
  /** the unitWidth */
335
- unitWidth: PropTypes.number
359
+ unitWidth: PropTypes.number,
360
+
361
+ /** the direction to display tootip */
362
+ pointHoverAlignment: PropTypes.oneOf(['top', 'bottom', 'left', 'right'])
336
363
  };
337
364
  Points.defaultProps = {
338
365
  getX: x => x,
@@ -1,17 +1,17 @@
1
1
  /** @jsxRuntime classic */
2
2
 
3
3
  /** @jsx jsx */
4
- import PropTypes from "prop-types";
5
- import { memo, forwardRef } from "react";
4
+ import PropTypes from 'prop-types';
5
+ import { memo, forwardRef } from 'react';
6
6
  import { jsx } from '@emotion/core';
7
7
  import Axis from './Axis';
8
8
  import Labels from './Labels';
9
9
  import Grid from './Grid';
10
- import Points from './Point';
11
- import Title from './Title';
10
+ import Points from './Point'; // import Title from './Title';
11
+
12
12
  import Path from './Path';
13
13
  import { randomString } from '../../../utils';
14
- const BarChart = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
14
+ const LineChart = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
15
15
  labelsVisible,
16
16
  labelsCharacterWidth,
17
17
  labelsCountY,
@@ -21,8 +21,9 @@ const BarChart = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
21
21
  viewBoxWidth,
22
22
  labelsOffsetX,
23
23
  labelsHeightX,
24
- unitWidth,
24
+ // unitWidth,
25
25
  style,
26
+ className,
26
27
  ...props
27
28
  }, ref) => {
28
29
  const colors = ['#FFD600', '#FFA800', '#FF7A00', '#FF0000', '#B61414', '#8FFF00', '#629000', '#019A5A', '#00C875', '#00FFD1', '#4200FF', '#0075FF', '#0095FF', '#00C2FF', '#00E0FF', '#8F00FF', '#BD00FF', '#FA00FF', '#FF00B8', '#FF3D71'];
@@ -41,7 +42,9 @@ const BarChart = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
41
42
  };
42
43
 
43
44
  const getMinX = () => {
44
- return dataSource.length > 0 ? dataSource[0].x : 0;
45
+ var _dataSource$;
46
+
47
+ return (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) > 0 ? (_dataSource$ = dataSource[0]) === null || _dataSource$ === void 0 ? void 0 : _dataSource$.x : 0;
45
48
  };
46
49
 
47
50
  const getMinY = () => {
@@ -49,12 +52,16 @@ const BarChart = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
49
52
  };
50
53
 
51
54
  const getMaxX = () => {
52
- return dataSource.length > 0 ? dataSource[dataSource.length - 1].x : 0;
55
+ var _dataSource;
56
+
57
+ 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;
53
58
  };
54
59
 
55
60
  const getMaxY = () => {
61
+ var _dataSource$2;
62
+
56
63
  const yStep = labelsCountY > 0 ? labelsCountY : 1;
57
- const maxY = dataSource.length > 0 ? dataSource.reduce((max, point) => point.quantity > max ? point.quantity : max, dataSource[0].quantity) : 0;
64
+ 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;
58
65
  return maxY ? Math.ceil(maxY / yStep) * yStep : yStep;
59
66
  };
60
67
 
@@ -94,13 +101,15 @@ const BarChart = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
94
101
  };
95
102
  return jsx("svg", {
96
103
  id: id,
97
- className: 'DGN-CUI-LineChart',
104
+ className: ['DGN-CUI-LineChart', className].join(' ').trim().replace(/\s+/g, ' '),
98
105
  viewBox: `0 0 ${Math.abs(viewBoxWidth)} ${Math.abs(viewBoxHeight)}`,
99
106
  style: {
100
107
  display: 'block',
101
108
  overflow: 'visible',
102
- margin: `${getLabelsYWidth() * 2}`
103
- }
109
+ margin: `${getLabelsYWidth() * 2}`,
110
+ ...style
111
+ },
112
+ ref: ref
104
113
  }, jsx(Axis, { ...props,
105
114
  ...commonProps
106
115
  }), jsx(Grid, { ...props,
@@ -121,7 +130,9 @@ const BarChart = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
121
130
  ...commonProps
122
131
  }));
123
132
  }));
124
- BarChart.defaultProps = {
133
+ LineChart.defaultProps = {
134
+ style: {},
135
+ className: '',
125
136
  data: [],
126
137
  viewBoxHeight: 200,
127
138
  viewBoxWidth: 500,
@@ -130,7 +141,12 @@ BarChart.defaultProps = {
130
141
  ...Points.defaultProps,
131
142
  ...Grid.defaultProps
132
143
  };
133
- BarChart.propTypes = {
144
+ LineChart.propTypes = {
145
+ /** style inline for component */
146
+ style: PropTypes.object,
147
+
148
+ /** className for component */
149
+ className: PropTypes.string,
134
150
  data: PropTypes.array.isRequired,
135
151
 
136
152
  /** drawn Ratio of viewBoxHeight entered by user, default is: 200px */
@@ -154,7 +170,7 @@ BarChart.propTypes = {
154
170
  /** show data information when hovering in the area containing the column */
155
171
  pointsIsHoverOnZone: PropTypes.bool,
156
172
 
157
- /** show or hiden point */
173
+ /** show or hidden point */
158
174
  pointsVisible: PropTypes.bool,
159
175
 
160
176
  /** change the inner color of the point button */
@@ -172,11 +188,14 @@ BarChart.propTypes = {
172
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. */
173
189
  pathColor: PropTypes.string,
174
190
 
175
- /** show or hiden the line to be drawn smooth */
191
+ /** show or hidden the line to be drawn smooth */
176
192
  Smooth: PropTypes.bool,
193
+
194
+ /** the direction to display tootip */
195
+ pointHoverAlignment: PropTypes.oneOf(['top', 'bottom', 'left', 'right']),
177
196
  ...Axis.propTypes,
178
197
  ...Labels.propTypes,
179
198
  ...Points.propTypes,
180
199
  ...Grid.propTypes
181
200
  };
182
- export default BarChart;
201
+ export default LineChart;
@@ -316,11 +316,11 @@ Checkbox.propTypes = {
316
316
  /** The function will run to return a true or false value of Radio Component */
317
317
  onChange: PropTypes.func,
318
318
 
319
- /**
320
- * ref methods
321
- *
322
- * * setChecked: Set check for input
323
- * * getChecked: Get check of input
319
+ /**
320
+ * ref methods
321
+ *
322
+ * * setChecked: Set check for input
323
+ * * getChecked: Get check of input
324
324
  */
325
325
  ref: PropTypes.any
326
326
  };