diginet-core-ui 1.3.24 → 1.3.29
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/assets/fonts/SF-Pro-Display-Bold.otf +0 -0
- package/assets/fonts/SF-Pro-Display-Medium.otf +0 -0
- package/assets/fonts/SF-Pro-Display-Regular.otf +0 -0
- package/assets/images/icons/wifi.svg +3 -0
- package/assets/images/menu/dhr/MHRM09N0004.svg +14 -0
- package/assets/images/menu/dhr/MHRP09N0028.svg +6 -0
- package/assets/images/menu/dhr/MHRP09N0029.svg +14 -0
- package/assets/images/menu/dhr/MHRP09N0030.svg +4 -0
- package/assets/images/menu/dhr/MHRP09N0031.svg +5 -0
- package/assets/images/menu/dhr/MHRP29N0012.svg +7 -0
- package/assets/images/menu/dhr/MHRP29N0021.svg +8 -0
- package/assets/images/menu/dhr/MHRP29N0022.svg +9 -0
- package/assets/images/menu/dhr/MHRP29N0023.svg +22 -0
- package/assets/images/menu/dhr/MHRP39N0015.svg +5 -0
- package/assets/images/menu/dhr/TASK.svg +9 -0
- package/assets/images/menu/erp/D05.svg +8 -0
- package/assets/images/menu/erp/D06.svg +4 -0
- package/assets/images/menu/erp/D90R.svg +9 -0
- package/assets/images/menu/erp/DBC.svg +9 -0
- package/assets/images/menu/erp/{W05F0006.svg → W05F0006N0000.svg} +0 -0
- package/assets/images/menu/erp/{W05F0008.svg → W05F0008N0000.svg} +0 -0
- package/assets/images/menu/erp/{W05F4000.svg → W05F4000N0000.svg} +0 -0
- package/assets/images/menu/erp/{W06F0005.svg → W06F0005N0000.svg} +0 -0
- package/assets/images/menu/erp/{W06F0006.svg → W06F0006N0000.svg} +0 -0
- package/assets/images/menu/erp/{W06F0008.svg → W06F0008N0000.svg} +0 -0
- package/assets/images/menu/erp/W94F1000N0000.svg +9 -0
- package/assets/images/menu/erp/W94F1000N0001.svg +9 -0
- package/components/accordion/css.js +42 -33
- package/components/accordion/details.js +29 -17
- package/components/accordion/group.js +23 -23
- package/components/accordion/index.js +36 -27
- package/components/accordion/summary.js +10 -11
- package/components/alert/index.js +97 -91
- package/components/alert/notify.js +10 -8
- package/components/avatar/index.js +19 -17
- package/components/badge/index.js +122 -139
- package/components/button/icon.js +242 -334
- package/components/button/index.js +272 -427
- package/components/button/more.js +4 -5
- package/components/button/ripple-effect.js +4 -6
- package/components/card/body-card.js +4 -6
- package/components/card/card.js +4 -8
- package/components/card/index.js +4 -5
- package/components/chart/Pie/Sector.js +4 -5
- package/components/chart/Pie/Sectors.js +5 -5
- package/components/chart/Pie/index.js +8 -9
- package/components/chart/Pie-v2/Sector.js +4 -5
- package/components/chart/Pie-v2/Sectors.js +7 -8
- package/components/chart/Pie-v2/index.js +11 -16
- package/components/chart/bar/Bar.js +2 -3
- package/components/chart/bar/Labels.js +9 -11
- package/components/chart/bar/index.js +17 -9
- package/components/chart/bar-v2/Bar.js +2 -3
- package/components/chart/bar-v2/Labels.js +9 -11
- package/components/chart/bar-v2/index.js +17 -9
- package/components/chart/line/Labels.js +8 -10
- package/components/chart/line/Point.js +2 -3
- package/components/chart/line/index.js +17 -9
- package/components/chart/line-v2/Labels.js +8 -10
- package/components/chart/line-v2/Point.js +2 -3
- package/components/chart/line-v2/index.js +17 -9
- package/components/chip/attach.js +12 -16
- package/components/chip/index.js +8 -11
- package/components/collapse/index.js +4 -5
- package/components/divider/index.js +27 -14
- package/components/form-control/attachment/index.js +143 -87
- package/components/form-control/calendar/function.js +24 -23
- package/components/form-control/calendar/index.js +2 -4
- package/components/form-control/calendar/range.js +3 -4
- package/components/form-control/checkbox/index.js +85 -71
- package/components/form-control/control/index.js +4 -6
- package/components/form-control/date-picker/index-old.js +0 -2
- package/components/form-control/date-picker/index.js +39 -43
- package/components/form-control/date-range-picker/index.js +26 -28
- package/components/form-control/dropdown/index.js +173 -202
- package/components/form-control/dropdown-box/index.js +72 -49
- package/components/form-control/form-group/index.js +4 -5
- package/components/form-control/helper-text/index.js +4 -5
- package/components/form-control/input-base/index.js +28 -38
- package/components/form-control/label/index.js +23 -13
- package/components/form-control/money-input/index.js +6 -6
- package/components/form-control/number-input/index.js +12 -14
- package/components/form-control/phone-input/index.js +4 -5
- package/components/form-control/radio/index.js +7 -15
- package/components/form-control/text-input/index.js +14 -24
- package/components/form-control/time-picker/index.js +15 -26
- package/components/form-control/time-picker/swiper.js +2 -4
- package/components/form-control/toggle/index.js +22 -18
- package/components/form-view/helper-text.js +4 -5
- package/components/form-view/index.js +4 -5
- package/components/form-view/input.js +5 -7
- package/components/form-view/label.js +2 -6
- package/components/list/list-item-action.js +7 -8
- package/components/list/list-item-icon.js +4 -5
- package/components/list/list-item-text.js +4 -5
- package/components/list/list-item.js +4 -5
- package/components/list/list.js +4 -5
- package/components/list/sub-header.js +4 -5
- package/components/modal/body.js +4 -6
- package/components/modal/footer.js +4 -6
- package/components/modal/header.js +8 -14
- package/components/modal/index.js +4 -5
- package/components/modal/modal.js +6 -13
- package/components/others/extra/index.js +4 -8
- package/components/others/option-wrapper/index.js +57 -0
- package/components/others/scrollbar/index.js +4 -5
- package/components/paging/page-info.js +282 -231
- package/components/paging/page-selector.js +4 -7
- package/components/popover/index.js +6 -7
- package/components/popup/danger_popup.js +8 -18
- package/components/popup/index.js +26 -34
- package/components/popup/proposals_popup.js +9 -16
- package/components/popup/v2/danger-popup.js +4 -6
- package/components/popup/v2/index.js +116 -98
- package/components/popup/v2/info-popup.js +4 -6
- package/components/popup/v2/success-popup.js +4 -6
- package/components/popup/v2/warning-popup.js +4 -6
- package/components/popup/v2/yes-no-popup.js +4 -6
- package/components/progress/circular.js +17 -26
- package/components/progress/linear.js +11 -13
- package/components/rating/index.js +114 -233
- package/components/slider/slider-container.js +15 -10
- package/components/slider/slider-item.js +10 -12
- package/components/status/index.js +63 -57
- package/components/tab/tab-container.js +26 -24
- package/components/tab/tab-header.js +36 -27
- package/components/tab/tab-panel.js +32 -15
- package/components/tab/tab.js +79 -80
- package/components/tooltip/index.js +4 -4
- package/components/transfer/index.js +10 -11
- package/components/tree-view/css.js +2 -0
- package/components/tree-view/index.js +14 -13
- package/components/typography/index.js +6 -112
- package/css/styles.css +1 -1
- package/css/styles.css.map +1 -1
- package/global/index.js +2 -0
- package/icons/basic.js +1648 -959
- package/icons/effect.js +45 -103
- package/package.json +1 -1
- package/readme.md +66 -0
- package/styles/color-helper.js +7 -146
- package/styles/colors.js +6 -2
- package/styles/font.js +9 -0
- package/styles/general.js +100 -7
- package/styles/typography.js +25 -26
- package/theme/settings.js +9 -2
- package/theme/theme-provider.js +15 -7
- package/theme/with-styles.js +2 -4
- package/theme/with-theme.js +2 -4
- package/utils/isMobile.js +21 -0
- package/utils/renderHTML.js +4 -5
- package/utils/renderIcon.js +15 -11
- package/utils/updatePosition.js +2 -2
|
@@ -1,47 +1,51 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
1
|
/** @jsxRuntime classic */
|
|
4
2
|
|
|
5
3
|
/** @jsx jsx */
|
|
6
4
|
import { memo, useRef, forwardRef, useEffect, useMemo } from 'react';
|
|
7
5
|
import PropTypes from 'prop-types';
|
|
8
6
|
import { jsx, css } from '@emotion/core';
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
7
|
+
import Icon from '../../icons';
|
|
8
|
+
import { lighten } from '../../styles/color-helper';
|
|
9
|
+
import { color as colors } from '../../styles/colors';
|
|
10
|
+
import { typography } from '../../styles/typography';
|
|
11
|
+
import { alignCenter, borderBox, borderRadius4px, cursorPointer, flexRow, flexWrap, inlineFlex, justifyCenter, overflowHidden, positionAbsolute, positionRelative } from '../../styles/general';
|
|
12
12
|
const {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
icon: 19,
|
|
23
|
-
fontSize: 12
|
|
24
|
-
},
|
|
25
|
-
medium: {
|
|
26
|
-
height: 32,
|
|
27
|
-
number: 18,
|
|
28
|
-
icon: 25.33,
|
|
29
|
-
fontSize: 14
|
|
13
|
+
paragraph1,
|
|
14
|
+
paragraph2,
|
|
15
|
+
paragraph3
|
|
16
|
+
} = typography;
|
|
17
|
+
const {
|
|
18
|
+
system: {
|
|
19
|
+
active,
|
|
20
|
+
rest,
|
|
21
|
+
white
|
|
30
22
|
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
23
|
+
semantic: {
|
|
24
|
+
success,
|
|
25
|
+
warning,
|
|
26
|
+
danger,
|
|
27
|
+
info
|
|
36
28
|
}
|
|
29
|
+
} = colors;
|
|
30
|
+
const colorMap = new Map([['default', rest], ['primary', active], ['success', success], ['warning', warning], ['danger', danger], ['info', info]]);
|
|
31
|
+
const sizeMap = new Map([['medium', '40px'], ['large', '48px'], ['giant', '56px']]);
|
|
32
|
+
const iconSizeMap = new Map([['medium', '24px'], ['large', '32px'], ['giant', '40px']]);
|
|
33
|
+
const dotSizeMap = new Map([['medium', 8], ['large', 10], ['giant', 12]]);
|
|
34
|
+
const dotPaddingSizeMap = new Map([['medium', 0], ['large', 1], ['giant', 2]]);
|
|
35
|
+
const typographySizeMap = new Map([['medium', paragraph3], ['large', paragraph2], ['giant', paragraph1]]);
|
|
36
|
+
|
|
37
|
+
const calDotPos = (dotSize, dotPaddingSize, iconSize, isText, content) => {
|
|
38
|
+
return isText ? content || content === 0 ? iconSize - 4 * (dotPaddingSize + 1) : dotSize * 3 - dotPaddingSize : -(dotSize / 2);
|
|
37
39
|
};
|
|
40
|
+
|
|
38
41
|
const Badge = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
39
42
|
content,
|
|
40
43
|
max,
|
|
44
|
+
viewType,
|
|
41
45
|
name,
|
|
42
46
|
color,
|
|
43
|
-
iconProps,
|
|
44
47
|
size,
|
|
48
|
+
className,
|
|
45
49
|
style,
|
|
46
50
|
badgeNumStyle,
|
|
47
51
|
refs,
|
|
@@ -53,138 +57,122 @@ const Badge = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
53
57
|
ref = useRef(null);
|
|
54
58
|
}
|
|
55
59
|
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
box-sizing: border-box;
|
|
67
|
-
&.click-able {
|
|
68
|
-
cursor: pointer;
|
|
69
|
-
}
|
|
70
|
-
`;
|
|
71
|
-
const BadgeIcon = css`
|
|
72
|
-
display: flex;
|
|
73
|
-
position: relative;
|
|
74
|
-
justify-content: flex-start;
|
|
75
|
-
align-items: flex-end;
|
|
76
|
-
height: ${badgeIconSize}px;
|
|
77
|
-
`;
|
|
60
|
+
const _size = sizeMap.get(size);
|
|
61
|
+
|
|
62
|
+
const _color = colorMap.get(color);
|
|
63
|
+
|
|
64
|
+
const typographySize = typographySizeMap.get(size);
|
|
65
|
+
const iconSize = iconSizeMap.get(size);
|
|
66
|
+
const dotSize = content || content === 0 ? dotSizeMap.get(size) + 8 : dotSizeMap.get(size);
|
|
67
|
+
const dotColor = colorMap.get(color);
|
|
68
|
+
const dotPaddingSize = dotPaddingSizeMap.get(size);
|
|
69
|
+
const dotPos = calDotPos(dotSize, dotPaddingSize, parseInt(iconSize), viewType === 'text', content);
|
|
78
70
|
const BadgeNumber = css`
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
padding: 0 3px;
|
|
93
|
-
color: #000;
|
|
94
|
-
background-color: ${colors.secondary};
|
|
95
|
-
border-radius: ${badgeNumSize / 2}px;
|
|
96
|
-
box-sizing: border-box;
|
|
71
|
+
${typographySize};
|
|
72
|
+
${flexRow}
|
|
73
|
+
${alignCenter}
|
|
74
|
+
${justifyCenter}
|
|
75
|
+
${flexWrap}
|
|
76
|
+
${positionAbsolute}
|
|
77
|
+
${borderBox}
|
|
78
|
+
color: ${white};
|
|
79
|
+
min-height: ${dotSize}px;
|
|
80
|
+
min-width: ${dotSize}px;
|
|
81
|
+
background-color: ${dotColor};
|
|
82
|
+
border-radius: ${dotSize / 2}px;
|
|
83
|
+
padding: 0 4px;
|
|
97
84
|
z-index: 1;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
color:
|
|
112
|
-
|
|
85
|
+
`;
|
|
86
|
+
const BadgeRoot = css`
|
|
87
|
+
${inlineFlex}
|
|
88
|
+
${alignCenter}
|
|
89
|
+
${justifyCenter}
|
|
90
|
+
${positionRelative}
|
|
91
|
+
${borderBox}
|
|
92
|
+
${borderRadius4px}
|
|
93
|
+
${onClick && cursorPointer}
|
|
94
|
+
height: ${name && !children ? _size : 'max-content'};
|
|
95
|
+
width: ${name && !children ? _size : 'max-content'};
|
|
96
|
+
&.text {
|
|
97
|
+
color: ${_color};
|
|
98
|
+
background-color: ${lighten(_color, 0.9)};
|
|
99
|
+
.css-${BadgeNumber.name} {
|
|
100
|
+
bottom: ${dotPos}px;
|
|
101
|
+
left: ${dotPos}px;
|
|
102
|
+
}
|
|
113
103
|
}
|
|
114
|
-
&.
|
|
115
|
-
|
|
116
|
-
|
|
104
|
+
&.filled {
|
|
105
|
+
${name && !children && `
|
|
106
|
+
color: ${white};
|
|
107
|
+
background-color: ${_color};
|
|
108
|
+
`}
|
|
109
|
+
.css-${BadgeNumber.name} {
|
|
110
|
+
top: ${dotPos}px;
|
|
111
|
+
right: ${dotPos}px;
|
|
112
|
+
}
|
|
117
113
|
}
|
|
118
114
|
`;
|
|
115
|
+
const BadgeIcon = css`
|
|
116
|
+
${overflowHidden}
|
|
117
|
+
`;
|
|
118
|
+
|
|
119
|
+
const _onClick = event => {
|
|
120
|
+
onClick && onClick(event);
|
|
121
|
+
};
|
|
122
|
+
|
|
119
123
|
useEffect(() => {
|
|
120
124
|
if (refs) refs(ref);
|
|
121
125
|
}, []);
|
|
122
|
-
|
|
123
|
-
if (color && color !== 'default' && content) {
|
|
124
|
-
ref.current.querySelector(`.css-${BadgeNumber.name}`).classList.add(color);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
return () => {
|
|
128
|
-
if (ref.current && color && color !== 'default' && content) {
|
|
129
|
-
ref.current.querySelector(`.css-${BadgeNumber.name}`).classList.remove(color);
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
}, [color]);
|
|
133
|
-
useEffect(() => {
|
|
134
|
-
if (onClick) {
|
|
135
|
-
ref.current.classList.add('click-able');
|
|
136
|
-
ref.current.addEventListener('click', onClick);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
return () => {
|
|
140
|
-
if (onClick && ref.current) {
|
|
141
|
-
ref.current.classList.remove('click-able');
|
|
142
|
-
ref.current.removeEventListener('click', onClick);
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
}, [onClick]);
|
|
146
|
-
const BadgeView = useMemo(() => {
|
|
126
|
+
return useMemo(() => {
|
|
147
127
|
let node = children;
|
|
148
128
|
|
|
149
129
|
if (!node && name) {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}
|
|
130
|
+
node = jsx(Icon, {
|
|
131
|
+
name: name,
|
|
132
|
+
width: iconSize,
|
|
133
|
+
height: iconSize,
|
|
134
|
+
color: 'currentColor',
|
|
135
|
+
viewBox: true
|
|
136
|
+
});
|
|
158
137
|
}
|
|
159
138
|
|
|
160
|
-
return jsx("div",
|
|
139
|
+
return jsx("div", {
|
|
161
140
|
css: BadgeRoot,
|
|
141
|
+
ref: ref,
|
|
142
|
+
className: ['DGN-UI-Badge', viewType, className].join(' ').trim().replace(/\s+/g, ' '),
|
|
162
143
|
style: style,
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
144
|
+
onClick: _onClick,
|
|
145
|
+
...props
|
|
146
|
+
}, jsx("span", {
|
|
147
|
+
css: BadgeIcon,
|
|
148
|
+
className: 'DGN-UI-Badge-Icon'
|
|
166
149
|
}, node), content !== undefined && jsx("span", {
|
|
167
150
|
css: BadgeNumber,
|
|
151
|
+
className: 'DGN-UI-Badge-Dot',
|
|
168
152
|
style: badgeNumStyle
|
|
169
153
|
}, max && content > max ? max + '+' : content));
|
|
170
|
-
}, [content, name, size, children]);
|
|
171
|
-
return BadgeView;
|
|
154
|
+
}, [content, name, size, children, max, viewType, color, style, className]);
|
|
172
155
|
}));
|
|
173
156
|
Badge.defaultProps = {
|
|
157
|
+
viewType: 'filled',
|
|
158
|
+
// name: 'Notification',
|
|
174
159
|
color: 'default',
|
|
175
160
|
size: 'medium',
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}
|
|
161
|
+
content: null,
|
|
162
|
+
max: 99,
|
|
163
|
+
className: '',
|
|
164
|
+
style: {}
|
|
180
165
|
};
|
|
181
166
|
Badge.propTypes = {
|
|
182
167
|
/** the quantity is shown on the badge */
|
|
183
|
-
content: PropTypes.number,
|
|
168
|
+
content: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
184
169
|
|
|
185
170
|
/** the largest number is displayed on the badge */
|
|
186
171
|
max: PropTypes.number,
|
|
187
172
|
|
|
173
|
+
/** used to fill background for button */
|
|
174
|
+
viewType: PropTypes.oneOf(['text', 'filled']),
|
|
175
|
+
|
|
188
176
|
/** background color of badge */
|
|
189
177
|
color: PropTypes.oneOf(['default', 'primary', 'info', 'success', 'warning', 'danger']),
|
|
190
178
|
|
|
@@ -192,15 +180,10 @@ Badge.propTypes = {
|
|
|
192
180
|
name: PropTypes.string,
|
|
193
181
|
|
|
194
182
|
/** size of Badge */
|
|
195
|
-
size: PropTypes.oneOf(['
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
|
|
199
|
-
color: PropTypes.string,
|
|
200
|
-
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
201
|
-
height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
202
|
-
viewBox: PropTypes.bool
|
|
203
|
-
}),
|
|
183
|
+
size: PropTypes.oneOf(['medium', 'large', 'giant']),
|
|
184
|
+
|
|
185
|
+
/** className of badge */
|
|
186
|
+
className: PropTypes.string,
|
|
204
187
|
|
|
205
188
|
/** style inline of badge */
|
|
206
189
|
style: PropTypes.object,
|