diginet-core-ui 1.3.42 → 1.3.43
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/images/menu/dhr/MHRM00N0002.svg +22 -0
- package/assets/images/menu/dhr/MHRM00N0003.svg +17 -0
- package/assets/images/menu/dhr/MHRM00N0004.svg +12 -0
- package/assets/images/menu/dhr/MHRM13N0002.svg +13 -0
- package/assets/images/menu/dhr/MHRM13N0003.svg +12 -0
- package/assets/images/menu/dhr/MHRM29N0004.svg +18 -0
- package/assets/images/menu/dhr/MHRM39N0017.svg +14 -0
- package/assets/images/menu/dhr/MHRM39N0018.svg +5 -0
- package/assets/images/menu/dhr/MHRM39N0019.svg +11 -0
- package/components/alert/notify.js +16 -16
- package/components/badge/index.js +5 -5
- package/components/button/index.js +13 -13
- package/components/form-control/attachment/index.js +20 -20
- package/components/form-control/calendar/function.js +113 -113
- package/components/form-control/calendar/index.js +16 -16
- package/components/form-control/checkbox/index.js +152 -154
- package/components/form-control/date-range-picker/index.js +6 -6
- package/components/form-control/dropdown-box/index.js +3 -9
- package/components/form-control/form-group/index.js +40 -36
- package/components/form-control/label/index.js +12 -6
- package/components/form-control/number-input/index2.js +21 -19
- package/components/form-control/text-input/index.js +21 -19
- package/components/form-control/toggle/index.js +46 -56
- package/components/paging/page-info.js +9 -9
- package/components/popover/index.js +21 -21
- package/components/popup/v2/index.js +7 -7
- package/components/progress/circular.js +12 -12
- package/components/tab/tab-container.js +19 -11
- package/components/tab/tab-header.js +34 -31
- package/components/tab/tab-panel.js +15 -12
- package/components/tab/tab.js +60 -58
- package/icons/effect.js +15 -15
- package/package.json +1 -1
- package/readme.md +49 -33
- package/utils/number.js +6 -6
|
@@ -75,13 +75,13 @@ const NumberInput = /*#__PURE__*/forwardRef(({
|
|
|
75
75
|
const clamp = (num, min, max) => Math.min(Math.max(num, min), max);
|
|
76
76
|
|
|
77
77
|
if (valueProps || valueProps === 0) valueProps = clamp(valueProps, min, max);
|
|
78
|
-
/**
|
|
79
|
-
* Convert number to format money
|
|
80
|
-
* @param vl {number} - value
|
|
81
|
-
* @type {function(*): number}
|
|
82
|
-
* @return {string}
|
|
83
|
-
* @example 1200300.123 => 1,200,300.123
|
|
84
|
-
* @example 1200300,123 => 1.200.300,123
|
|
78
|
+
/**
|
|
79
|
+
* Convert number to format money
|
|
80
|
+
* @param vl {number} - value
|
|
81
|
+
* @type {function(*): number}
|
|
82
|
+
* @return {string}
|
|
83
|
+
* @example 1200300.123 => 1,200,300.123
|
|
84
|
+
* @example 1200300,123 => 1.200.300,123
|
|
85
85
|
*/
|
|
86
86
|
|
|
87
87
|
const parseNumberToMoney = useCallback((vl, isNumber) => {
|
|
@@ -117,13 +117,13 @@ const NumberInput = /*#__PURE__*/forwardRef(({
|
|
|
117
117
|
|
|
118
118
|
return number;
|
|
119
119
|
}, [decimalSymbol, max, value]);
|
|
120
|
-
/**
|
|
121
|
-
* Convert money to format number
|
|
122
|
-
* @param vl {string} - value
|
|
123
|
-
* @type {function(*): number}
|
|
124
|
-
* @return {number}
|
|
125
|
-
* @example 1,200,300.123 => 1200300.123
|
|
126
|
-
* @example 1.200.300,123 => 1200300.123
|
|
120
|
+
/**
|
|
121
|
+
* Convert money to format number
|
|
122
|
+
* @param vl {string} - value
|
|
123
|
+
* @type {function(*): number}
|
|
124
|
+
* @return {number}
|
|
125
|
+
* @example 1,200,300.123 => 1200300.123
|
|
126
|
+
* @example 1.200.300,123 => 1200300.123
|
|
127
127
|
*/
|
|
128
128
|
|
|
129
129
|
const convertMoneyToNumber = useCallback((vl, isNumber) => {
|
|
@@ -172,6 +172,7 @@ const NumberInput = /*#__PURE__*/forwardRef(({
|
|
|
172
172
|
var _value$split, _value$split$;
|
|
173
173
|
|
|
174
174
|
const {
|
|
175
|
+
key,
|
|
175
176
|
keyCode,
|
|
176
177
|
ctrlKey,
|
|
177
178
|
metaKey,
|
|
@@ -183,10 +184,11 @@ const NumberInput = /*#__PURE__*/forwardRef(({
|
|
|
183
184
|
}
|
|
184
185
|
} = e; // 0-9 only
|
|
185
186
|
|
|
186
|
-
const isNumber = keyCode >= 48 && keyCode <= 57 && shiftKey === false || keyCode >= 96 && keyCode <= 105; // character input type="number"
|
|
187
|
+
const isNumber = keyCode >= 48 && keyCode <= 57 && shiftKey === false || keyCode >= 96 && keyCode <= 105 || keyCode === 231 && key >= '0' && key <= '9'; // character input type="number"
|
|
187
188
|
|
|
188
189
|
const allowKeyTypeNumber = isNumber || keyCode === 8 || // key backspace
|
|
189
190
|
keyCode > 34 && keyCode < 40 || keyCode === 190 || keyCode === 110 || // .
|
|
191
|
+
keyCode === 231 && key === '.' || // .
|
|
190
192
|
keyCode === 188 || // ,
|
|
191
193
|
(ctrlKey || metaKey) && (keyCode === 65 || keyCode === 67 || keyCode === 86) || // ctrl + A, ctrl + C, ctrl + V
|
|
192
194
|
keyCode === 46 || // key delete
|
|
@@ -392,10 +394,10 @@ NumberInput.propTypes = {
|
|
|
392
394
|
/** style inline of input in NumberInput component */
|
|
393
395
|
inputStyle: PropTypes.object,
|
|
394
396
|
|
|
395
|
-
/** validation value, argument can:<br/>
|
|
396
|
-
* * string: the validation rule. Example required.<br/>
|
|
397
|
-
* * object: the validation rule insist name, property, message. Example {name: 'min', compareValue: 9, message: 'Error'} or {max: 99}<br/>
|
|
398
|
-
* * array: the validation rule list, insist object/string
|
|
397
|
+
/** validation value, argument can:<br/>
|
|
398
|
+
* * string: the validation rule. Example required.<br/>
|
|
399
|
+
* * object: the validation rule insist name, property, message. Example {name: 'min', compareValue: 9, message: 'Error'} or {max: 99}<br/>
|
|
400
|
+
* * array: the validation rule list, insist object/string
|
|
399
401
|
*/
|
|
400
402
|
validates: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.array, PropTypes.func]),
|
|
401
403
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
|
-
import { memo, useEffect, useRef, forwardRef, useImperativeHandle } from 'react';
|
|
4
|
+
import { memo, useEffect, useRef, forwardRef, useState, useImperativeHandle } from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { jsx, css } from '@emotion/core';
|
|
7
7
|
import { ButtonIcon, CircularProgress as Circular, HelperText, InputBase, Label } from '../../';
|
|
8
8
|
import { renderIcon, onValidate } from '../../../utils';
|
|
9
|
+
import { displayBlock, flexRow, positionRelative } from '../../../styles/general';
|
|
9
10
|
const icons = {
|
|
10
11
|
default: `<svg width="20" height="19" viewBox="0 0 20 19" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
11
12
|
<path fillRule="evenodd" clipRule="evenodd" d="M15.5616 19.0007C15.4036 19.0007 15.2446 18.9637 15.0986 18.8877L9.99962 16.2237L4.90162 18.8877C4.56362 19.0627 4.15562 19.0327 3.84962 18.8087C3.54162 18.5847 3.38862 18.2057 3.45362 17.8307L4.42462 12.2027L0.304623 8.21765C0.030623 7.95265 -0.068377 7.55465 0.048623 7.19065C0.165623 6.82865 0.478623 6.56365 0.856623 6.50965L6.55662 5.68165L9.10462 0.555654C9.44262 -0.124346 10.5576 -0.124346 10.8956 0.555654L13.4436 5.68165L19.1436 6.50965C19.5216 6.56365 19.8346 6.82865 19.9516 7.19065C20.0686 7.55465 19.9696 7.95265 19.6956 8.21765L15.5756 12.2027L16.5466 17.8307C16.6116 18.2057 16.4576 18.5847 16.1506 18.8087C15.9766 18.9367 15.7696 19.0007 15.5616 19.0007Z" fill="#7F828E"/>
|
|
@@ -33,7 +34,7 @@ const TextInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
33
34
|
className,
|
|
34
35
|
label,
|
|
35
36
|
defaultValue,
|
|
36
|
-
value,
|
|
37
|
+
value: valueProp,
|
|
37
38
|
placeholder,
|
|
38
39
|
resize,
|
|
39
40
|
startIcon,
|
|
@@ -77,19 +78,20 @@ const TextInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
77
78
|
|
|
78
79
|
const iconRef = useRef(null);
|
|
79
80
|
let currentValue = '';
|
|
80
|
-
const
|
|
81
|
+
const [value, setValue] = useState(valueProp || defaultValue);
|
|
82
|
+
const isError = !!error;
|
|
81
83
|
/* Start styled */
|
|
82
84
|
|
|
83
85
|
const TextInputRoot = css`
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
86
|
+
${displayBlock}
|
|
87
|
+
${positionRelative}
|
|
88
|
+
margin-bottom: 20px;
|
|
87
89
|
`;
|
|
88
90
|
const TextInputIcon = css`
|
|
89
|
-
|
|
91
|
+
${flexRow}
|
|
90
92
|
color: inherit;
|
|
91
93
|
.edit-icon-pen {
|
|
92
|
-
|
|
94
|
+
${flexRow}
|
|
93
95
|
}
|
|
94
96
|
.edit-icon-confirm {
|
|
95
97
|
display: none;
|
|
@@ -176,12 +178,12 @@ const TextInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
176
178
|
inputRef.current.disabled = false;
|
|
177
179
|
};
|
|
178
180
|
|
|
181
|
+
useEffect(() => {
|
|
182
|
+
setValue(valueProp);
|
|
183
|
+
}, [valueProp]);
|
|
179
184
|
useEffect(() => {
|
|
180
185
|
!!refs && refs(ref);
|
|
181
|
-
|
|
182
|
-
if (defaultValue !== undefined && defaultValue !== '') {
|
|
183
|
-
currentValue = defaultValue;
|
|
184
|
-
}
|
|
186
|
+
currentValue = defaultValue || '';
|
|
185
187
|
}, []);
|
|
186
188
|
useEffect(() => {
|
|
187
189
|
if (/^(quick)?Edit/i.test(type) && !multiline) {
|
|
@@ -326,7 +328,7 @@ const TextInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
326
328
|
return jsx("div", {
|
|
327
329
|
ref: ref,
|
|
328
330
|
css: TextInputRoot,
|
|
329
|
-
className: ['DGN-UI-TextInput', className].join(' ').trim(),
|
|
331
|
+
className: ['DGN-UI-TextInput', className].join(' ').trim().replace(/\s+/g, ' '),
|
|
330
332
|
style: style,
|
|
331
333
|
...props
|
|
332
334
|
}, !!label && jsx(Label, {
|
|
@@ -339,7 +341,6 @@ const TextInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
339
341
|
inputRef: inputRef,
|
|
340
342
|
viewType: viewType,
|
|
341
343
|
defaultValue: defaultValue,
|
|
342
|
-
value: value,
|
|
343
344
|
placeholder: placeholder,
|
|
344
345
|
autoFocus: autoFocus,
|
|
345
346
|
disabled: disabled,
|
|
@@ -360,7 +361,8 @@ const TextInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
360
361
|
onInput: onInput,
|
|
361
362
|
onKeyDown: onKeyDown,
|
|
362
363
|
onKeyUp: onKeyUp,
|
|
363
|
-
onPaste: onPaste
|
|
364
|
+
onPaste: onPaste,
|
|
365
|
+
value: valueProp
|
|
364
366
|
}), isError && jsx(HelperText, {
|
|
365
367
|
disabled: disabled,
|
|
366
368
|
status: status
|
|
@@ -497,10 +499,10 @@ TextInput.propTypes = {
|
|
|
497
499
|
/** on focus function */
|
|
498
500
|
onFocus: PropTypes.func,
|
|
499
501
|
|
|
500
|
-
/** validation value, argument can:<br/>
|
|
501
|
-
* * string: the validation rule. Example required.<br/>
|
|
502
|
-
* * object: the validation rule insist name, property, message. Example {name: 'min', compareValue: 9, message: 'Error'} or {max: 99}<br/>
|
|
503
|
-
* * array: the validation rule list, insist object/string
|
|
502
|
+
/** validation value, argument can:<br/>
|
|
503
|
+
* * string: the validation rule. Example required.<br/>
|
|
504
|
+
* * object: the validation rule insist name, property, message. Example {name: 'min', compareValue: 9, message: 'Error'} or {max: 99}<br/>
|
|
505
|
+
* * array: the validation rule list, insist object/string
|
|
504
506
|
*/
|
|
505
507
|
validates: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.array, PropTypes.func]),
|
|
506
508
|
|
|
@@ -7,7 +7,7 @@ import { forwardRef, memo, useEffect, useMemo, useRef, useState } from 'react';
|
|
|
7
7
|
import theme from '../../../theme/settings';
|
|
8
8
|
import generateRandom from '../../../utils/randomString';
|
|
9
9
|
import Typography from '../../typography';
|
|
10
|
-
import { alignCenter,
|
|
10
|
+
import { alignCenter, cursorNoDrop, cursorPointer, displayBlock, flexRow, positionAbsolute, positionRelative } from '../../../styles/general';
|
|
11
11
|
const {
|
|
12
12
|
colors: {
|
|
13
13
|
system: {
|
|
@@ -30,6 +30,7 @@ const {
|
|
|
30
30
|
const Toggle = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
31
31
|
id,
|
|
32
32
|
disabled,
|
|
33
|
+
readOnly,
|
|
33
34
|
name,
|
|
34
35
|
height,
|
|
35
36
|
width,
|
|
@@ -48,25 +49,21 @@ const Toggle = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
const [checkedState, setCheckedState] = useState(Boolean(checked !== undefined ? checked : defaultChecked));
|
|
52
|
+
const padding = spacing(0.5);
|
|
51
53
|
const formCheck = css`
|
|
52
54
|
${positionRelative};
|
|
53
|
-
${cursorPointer};
|
|
54
|
-
${userSelectNone};
|
|
55
55
|
min-height: ${height}px;
|
|
56
|
-
|
|
57
|
-
${pointerEventsNone};
|
|
58
|
-
}
|
|
56
|
+
padding: ${padding}px;
|
|
59
57
|
`;
|
|
60
58
|
const toggle = css`
|
|
61
59
|
${flexRow};
|
|
62
60
|
${alignCenter};
|
|
63
|
-
${cursorPointer};
|
|
64
61
|
${positionRelative};
|
|
62
|
+
${cursorPointer};
|
|
65
63
|
margin: 0;
|
|
66
64
|
`;
|
|
67
65
|
const slider = css`
|
|
68
66
|
${positionRelative};
|
|
69
|
-
${cursorPointer};
|
|
70
67
|
${displayBlock};
|
|
71
68
|
height: ${height}px;
|
|
72
69
|
width: ${width}px;
|
|
@@ -74,6 +71,12 @@ const Toggle = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
74
71
|
border-radius: ${height}px;
|
|
75
72
|
background: ${clWhite};
|
|
76
73
|
outline: 1px solid ${clRest};
|
|
74
|
+
&.disabled {
|
|
75
|
+
outline: 1px solid ${clDisabled} !important;
|
|
76
|
+
}
|
|
77
|
+
&.disabled, &.read-only{
|
|
78
|
+
${cursorNoDrop};
|
|
79
|
+
}
|
|
77
80
|
&::after {
|
|
78
81
|
${positionAbsolute};
|
|
79
82
|
background: ${clRest};
|
|
@@ -84,20 +87,13 @@ const Toggle = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
84
87
|
left: 2px;
|
|
85
88
|
border-radius: 100%;
|
|
86
89
|
transition: 0.3s ease-in-out;
|
|
87
|
-
margin: 0px auto;
|
|
88
|
-
}
|
|
89
|
-
&:hover {
|
|
90
|
-
box-shadow: 0 0 0 2px ${clHover};
|
|
91
|
-
background-color: ${clHover};
|
|
92
|
-
outline-color: ${clPrimary};
|
|
90
|
+
margin: 0px auto;pop
|
|
93
91
|
}
|
|
94
|
-
&:
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
box-shadow: 0 0 0 2px ${clFillFocus};
|
|
100
|
-
background-color: ${clFillFocus};
|
|
92
|
+
&:not(.disabled):not(.read-only) {
|
|
93
|
+
&:active,
|
|
94
|
+
&:focus {
|
|
95
|
+
box-shadow: 0 0 0 2px ${clFillFocus};
|
|
96
|
+
}
|
|
101
97
|
}
|
|
102
98
|
`;
|
|
103
99
|
const checkbox = css`
|
|
@@ -109,27 +105,27 @@ const Toggle = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
109
105
|
background: ${clWhite};
|
|
110
106
|
left: ${width - height}px;
|
|
111
107
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
${userSelectNone};
|
|
115
|
-
${pointerEventsNone};
|
|
116
|
-
${cursorNotAllowed};
|
|
117
|
-
background: ${clDisabled};
|
|
118
|
-
outline-color: ${clDisabled};
|
|
119
|
-
}
|
|
120
|
-
&:hover:not(:checked) + label > span.css-${slider.name} {
|
|
121
|
-
background: ${clHover};
|
|
122
|
-
outline: 1px solid ${clPrimary};
|
|
123
|
-
transition: 0.3s ease-in-out;
|
|
124
|
-
::after {
|
|
125
|
-
background: ${clPrimary};
|
|
108
|
+
&.disabled {
|
|
109
|
+
background: ${clDisabled} !important;
|
|
126
110
|
}
|
|
127
111
|
}
|
|
128
|
-
&:
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
112
|
+
&:not(:checked) + label > span.css-${slider.name} {
|
|
113
|
+
&:not(.disabled):not(.read-only) {
|
|
114
|
+
&:hover {
|
|
115
|
+
box-shadow: 0 0 0 2px ${clHover};
|
|
116
|
+
outline-color: ${clPrimary};
|
|
117
|
+
background-color: ${clHover};
|
|
118
|
+
}
|
|
119
|
+
&:hover:after {
|
|
120
|
+
background-color: ${clActive};
|
|
121
|
+
}
|
|
122
|
+
&:active,
|
|
123
|
+
&:focus {
|
|
124
|
+
background-color: ${clFillFocus};
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
&.disabled:after {
|
|
128
|
+
background: ${clDisabled} !important;
|
|
133
129
|
}
|
|
134
130
|
}
|
|
135
131
|
`;
|
|
@@ -139,7 +135,7 @@ const Toggle = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
139
135
|
});
|
|
140
136
|
|
|
141
137
|
const handleChange = () => {
|
|
142
|
-
if (disabled) return;
|
|
138
|
+
if (disabled || readOnly) return;
|
|
143
139
|
setCheckedState(checked !== undefined ? Boolean(checked) : !checkedState);
|
|
144
140
|
const e = {
|
|
145
141
|
value: !checkedState,
|
|
@@ -150,19 +146,6 @@ const Toggle = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
150
146
|
if (onChange) onChange(e);
|
|
151
147
|
};
|
|
152
148
|
|
|
153
|
-
useEffect(() => {
|
|
154
|
-
if (disabled) {
|
|
155
|
-
inputRef.current.disabled = disabled;
|
|
156
|
-
inputRef.current.parentNode.parentNode.classList.add('disabled');
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
return () => {
|
|
160
|
-
if (disabled && inputRef.current) {
|
|
161
|
-
inputRef.current.disabled = false;
|
|
162
|
-
inputRef.current.parentNode.parentNode.classList.remove('disabled');
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
}, [disabled, onChange]);
|
|
166
149
|
useEffect(() => {
|
|
167
150
|
if (checked !== undefined) setCheckedState(Boolean(checked));
|
|
168
151
|
}, [checked]);
|
|
@@ -176,6 +159,8 @@ const Toggle = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
176
159
|
hidden: true,
|
|
177
160
|
name: name,
|
|
178
161
|
type: "checkbox",
|
|
162
|
+
disabled: disabled,
|
|
163
|
+
readOnly: readOnly,
|
|
179
164
|
css: checkbox,
|
|
180
165
|
checked: checkedState,
|
|
181
166
|
onChange: handleChange
|
|
@@ -183,7 +168,8 @@ const Toggle = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
183
168
|
css: toggle,
|
|
184
169
|
onClick: handleChange
|
|
185
170
|
}, jsx("span", {
|
|
186
|
-
css: slider
|
|
171
|
+
css: slider,
|
|
172
|
+
className: `${disabled ? 'disabled' : ''} ${readOnly ? 'read-only' : ''}`
|
|
187
173
|
}), label !== undefined && jsx(Typography, {
|
|
188
174
|
type: 'p1',
|
|
189
175
|
style: {
|
|
@@ -194,10 +180,11 @@ const Toggle = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
194
180
|
hoverTooltip: hoverTooltip,
|
|
195
181
|
lineClamp: lineClamp || null,
|
|
196
182
|
mapping: 'label'
|
|
197
|
-
}, label))), [disabled, onChange, checkedState]);
|
|
183
|
+
}, label))), [disabled, onChange, checkedState, readOnly]);
|
|
198
184
|
}));
|
|
199
185
|
Toggle.defaultProps = {
|
|
200
186
|
disabled: false,
|
|
187
|
+
readOnly: false,
|
|
201
188
|
defaultChecked: false,
|
|
202
189
|
label: '',
|
|
203
190
|
value: '',
|
|
@@ -210,6 +197,9 @@ Toggle.propTypes = {
|
|
|
210
197
|
/** * If `true`, the component is disabled. */
|
|
211
198
|
disabled: PropTypes.bool,
|
|
212
199
|
|
|
200
|
+
/** prevent all event if true */
|
|
201
|
+
readOnly: PropTypes.bool,
|
|
202
|
+
|
|
213
203
|
/** If `true`, the component is defaultChecked. */
|
|
214
204
|
defaultChecked: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf([0, 1])]),
|
|
215
205
|
|
|
@@ -323,15 +323,15 @@ PagingInfo.propTypes = {
|
|
|
323
323
|
/** the function will run after change quantity on per page */
|
|
324
324
|
onChangePerPage: PropTypes.func,
|
|
325
325
|
|
|
326
|
-
/**
|
|
327
|
-
* ref methods (ref.current.instance.*method*)
|
|
328
|
-
*
|
|
329
|
-
* * onChangePage(page): Change page number
|
|
330
|
-
* * @param {page} - number
|
|
331
|
-
* * onChangePerPage(per): Change quantity on per page
|
|
332
|
-
* * @param {per} - number
|
|
333
|
-
* * setTotalItems(items): Set total items
|
|
334
|
-
* * @param {items} - number
|
|
326
|
+
/**
|
|
327
|
+
* ref methods (ref.current.instance.*method*)
|
|
328
|
+
*
|
|
329
|
+
* * onChangePage(page): Change page number
|
|
330
|
+
* * @param {page} - number
|
|
331
|
+
* * onChangePerPage(per): Change quantity on per page
|
|
332
|
+
* * @param {per} - number
|
|
333
|
+
* * setTotalItems(items): Set total items
|
|
334
|
+
* * @param {items} - number
|
|
335
335
|
*/
|
|
336
336
|
reference: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
337
337
|
current: PropTypes.instanceOf(Element)
|
|
@@ -441,32 +441,32 @@ Popover.propTypes = {
|
|
|
441
441
|
/** An HTML element, or a function that returns one. It's used to set the position of the popover. */
|
|
442
442
|
anchor: PropTypes.oneOfType([PropTypes.instanceOf(Element), PropTypes.func, PropTypes.object]),
|
|
443
443
|
|
|
444
|
-
/**
|
|
445
|
-
* This is the point on the anchor where the popover's anchor will attach to.
|
|
446
|
-
* Options: vertical: [top, center, bottom]; horizontal: [left, center, right].
|
|
444
|
+
/**
|
|
445
|
+
* This is the point on the anchor where the popover's anchor will attach to.
|
|
446
|
+
* Options: vertical: [top, center, bottom]; horizontal: [left, center, right].
|
|
447
447
|
*/
|
|
448
448
|
anchorOrigin: PropTypes.shape({
|
|
449
449
|
horizontal: PropTypes.oneOf(['center', 'left', 'right']),
|
|
450
450
|
vertical: PropTypes.oneOf(['bottom', 'center', 'top'])
|
|
451
451
|
}),
|
|
452
452
|
|
|
453
|
-
/**
|
|
454
|
-
* This is the point on the popover which will attach to the anchor's origin.
|
|
455
|
-
* Options: vertical: [top, center, bottom]; horizontal: [left, center, right].
|
|
453
|
+
/**
|
|
454
|
+
* This is the point on the popover which will attach to the anchor's origin.
|
|
455
|
+
* Options: vertical: [top, center, bottom]; horizontal: [left, center, right].
|
|
456
456
|
*/
|
|
457
457
|
transformOrigin: PropTypes.shape({
|
|
458
458
|
horizontal: PropTypes.oneOf(['center', 'left', 'right']),
|
|
459
459
|
vertical: PropTypes.oneOf(['bottom', 'center', 'top'])
|
|
460
460
|
}),
|
|
461
461
|
|
|
462
|
-
/**
|
|
463
|
-
* Direction when Popover shown.
|
|
464
|
-
* Note: This prop will overwrite anchorOrigin & transformOrigin.
|
|
465
|
-
*
|
|
466
|
-
* * top: anchorOrigin: { vertical: 'top', horizontal: 'center' }, transformOrigin: { vertical: 'bottom', horizontal: 'center' }
|
|
467
|
-
* * left: anchorOrigin: { vertical: 'center', horizontal: 'left' }, transformOrigin: { vertical: 'center', horizontal: 'right' }
|
|
468
|
-
* * right: anchorOrigin: { vertical: 'center', horizontal: 'right' }, transformOrigin: { vertical: 'center', horizontal: 'left' }
|
|
469
|
-
* * right: anchorOrigin: { vertical: 'bottom', horizontal: 'center' }, transformOrigin: { vertical: 'top', horizontal: 'center' }
|
|
462
|
+
/**
|
|
463
|
+
* Direction when Popover shown.
|
|
464
|
+
* Note: This prop will overwrite anchorOrigin & transformOrigin.
|
|
465
|
+
*
|
|
466
|
+
* * top: anchorOrigin: { vertical: 'top', horizontal: 'center' }, transformOrigin: { vertical: 'bottom', horizontal: 'center' }
|
|
467
|
+
* * left: anchorOrigin: { vertical: 'center', horizontal: 'left' }, transformOrigin: { vertical: 'center', horizontal: 'right' }
|
|
468
|
+
* * right: anchorOrigin: { vertical: 'center', horizontal: 'right' }, transformOrigin: { vertical: 'center', horizontal: 'left' }
|
|
469
|
+
* * right: anchorOrigin: { vertical: 'bottom', horizontal: 'center' }, transformOrigin: { vertical: 'top', horizontal: 'center' }
|
|
470
470
|
*/
|
|
471
471
|
direction: PropTypes.oneOf(['top', 'left', 'right', 'bottom']),
|
|
472
472
|
|
|
@@ -485,13 +485,13 @@ Popover.propTypes = {
|
|
|
485
485
|
/** The content of the component. */
|
|
486
486
|
children: PropTypes.node,
|
|
487
487
|
|
|
488
|
-
/**
|
|
489
|
-
* ref methods (ref.current.instance.*method*)
|
|
490
|
-
*
|
|
491
|
-
* * show: Show popover
|
|
492
|
-
* * close: Close popover
|
|
493
|
-
* * setPosition(element): Set position of popover
|
|
494
|
-
* * @param {element} - element
|
|
488
|
+
/**
|
|
489
|
+
* ref methods (ref.current.instance.*method*)
|
|
490
|
+
*
|
|
491
|
+
* * show: Show popover
|
|
492
|
+
* * close: Close popover
|
|
493
|
+
* * setPosition(element): Set position of popover
|
|
494
|
+
* * @param {element} - element
|
|
495
495
|
*/
|
|
496
496
|
reference: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
497
497
|
current: PropTypes.instanceOf(Element)
|
|
@@ -465,13 +465,13 @@ Popup.propTypes = {
|
|
|
465
465
|
/** the function will run when click on cancel button */
|
|
466
466
|
onCancel: func,
|
|
467
467
|
|
|
468
|
-
/**
|
|
469
|
-
* named ref: get ref of Popup component, insist:<br />
|
|
470
|
-
* * element<br />
|
|
471
|
-
* * show: the method to show Popup (ref.current.show(options, callback))<br />
|
|
472
|
-
* + options: {type, title, icon, yesNo, description, confirmProps, cancelProps, onCancel, onConfirm}<br />
|
|
473
|
-
* + callback: the function will run after click on button (callback(true) with confirm Button and callback(false) with cancel Button). Alternate both onCancel, onConfirm methods of options<br />
|
|
474
|
-
* * close: the method to close Popup<br />
|
|
468
|
+
/**
|
|
469
|
+
* named ref: get ref of Popup component, insist:<br />
|
|
470
|
+
* * element<br />
|
|
471
|
+
* * show: the method to show Popup (ref.current.show(options, callback))<br />
|
|
472
|
+
* + options: {type, title, icon, yesNo, description, confirmProps, cancelProps, onCancel, onConfirm}<br />
|
|
473
|
+
* + callback: the function will run after click on button (callback(true) with confirm Button and callback(false) with cancel Button). Alternate both onCancel, onConfirm methods of options<br />
|
|
474
|
+
* * close: the method to close Popup<br />
|
|
475
475
|
*/
|
|
476
476
|
reference: oneOfType([func, shape({
|
|
477
477
|
current: instanceOf(elementType)
|
|
@@ -63,8 +63,8 @@ const getDimension = size => {
|
|
|
63
63
|
strokeWidth
|
|
64
64
|
};
|
|
65
65
|
};
|
|
66
|
-
/**
|
|
67
|
-
* Determinate circular progress
|
|
66
|
+
/**
|
|
67
|
+
* Determinate circular progress
|
|
68
68
|
*/
|
|
69
69
|
|
|
70
70
|
|
|
@@ -113,8 +113,8 @@ const Determinate = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
113
113
|
|
|
114
114
|
return angle;
|
|
115
115
|
};
|
|
116
|
-
/**
|
|
117
|
-
* style
|
|
116
|
+
/**
|
|
117
|
+
* style
|
|
118
118
|
*/
|
|
119
119
|
|
|
120
120
|
|
|
@@ -216,8 +216,8 @@ Determinate.propTypes = {
|
|
|
216
216
|
width: PropTypes.number
|
|
217
217
|
};
|
|
218
218
|
export const DeterminateCircularProgress = Determinate;
|
|
219
|
-
/**
|
|
220
|
-
* Indeterminate circular progress
|
|
219
|
+
/**
|
|
220
|
+
* Indeterminate circular progress
|
|
221
221
|
*/
|
|
222
222
|
|
|
223
223
|
const Indeterminate = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
@@ -254,8 +254,8 @@ const Indeterminate = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
254
254
|
stroke-dashoffset: -${r * 124 / 200};
|
|
255
255
|
}
|
|
256
256
|
`;
|
|
257
|
-
/**
|
|
258
|
-
* style
|
|
257
|
+
/**
|
|
258
|
+
* style
|
|
259
259
|
*/
|
|
260
260
|
|
|
261
261
|
|
|
@@ -286,8 +286,8 @@ const Indeterminate = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
286
286
|
stroke-linecap: round;
|
|
287
287
|
stroke-width: ${circleStrokeW};
|
|
288
288
|
`;
|
|
289
|
-
/**
|
|
290
|
-
* component
|
|
289
|
+
/**
|
|
290
|
+
* component
|
|
291
291
|
*/
|
|
292
292
|
|
|
293
293
|
const CircleBackgroundMemo = useMemo(() => jsx("circle", {
|
|
@@ -330,8 +330,8 @@ Indeterminate.propTypes = {
|
|
|
330
330
|
width: PropTypes.number
|
|
331
331
|
};
|
|
332
332
|
export const IndeterminateCircularProgress = Indeterminate;
|
|
333
|
-
/**
|
|
334
|
-
* Circular progress
|
|
333
|
+
/**
|
|
334
|
+
* Circular progress
|
|
335
335
|
*/
|
|
336
336
|
|
|
337
337
|
const CircularProgress = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
@@ -14,7 +14,7 @@ const TabContainer = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
14
14
|
tabIndex,
|
|
15
15
|
width,
|
|
16
16
|
direction,
|
|
17
|
-
level
|
|
17
|
+
level,
|
|
18
18
|
className,
|
|
19
19
|
...props
|
|
20
20
|
}, reference) => {
|
|
@@ -29,6 +29,9 @@ const TabContainer = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
29
29
|
}));
|
|
30
30
|
if (level === 'level1') level = 'h3';
|
|
31
31
|
if (level === 'level2') level = 'p1';
|
|
32
|
+
|
|
33
|
+
const _TabContainerCSS = TabContainerCSS(direction, width);
|
|
34
|
+
|
|
32
35
|
useEffect(() => {
|
|
33
36
|
if (isNumeric(value)) setTabIndexState(value);else setTabIndexState(tabIndex);
|
|
34
37
|
}, [value, tabIndex]);
|
|
@@ -42,7 +45,7 @@ const TabContainer = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
42
45
|
return currentRef;
|
|
43
46
|
});
|
|
44
47
|
return jsx("div", {
|
|
45
|
-
css:
|
|
48
|
+
css: _TabContainerCSS,
|
|
46
49
|
className: ['DGN-UI-Tab-Container', className].join(' ').trim().replace(/\s+/g, ' '),
|
|
47
50
|
id: `DGN-${id}-tab-button-container`,
|
|
48
51
|
ref: ref,
|
|
@@ -59,9 +62,9 @@ const TabContainer = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
59
62
|
}));
|
|
60
63
|
|
|
61
64
|
const TabContainerCSS = (direction, width) => css`
|
|
62
|
-
${direction === 'vertical' ? flexRow : flexCol}
|
|
63
|
-
${positionRelative}
|
|
64
|
-
${parseWidth(width)}
|
|
65
|
+
${direction === 'vertical' ? flexRow : flexCol};
|
|
66
|
+
${positionRelative};
|
|
67
|
+
${parseWidth(width)};
|
|
65
68
|
`;
|
|
66
69
|
|
|
67
70
|
TabContainer.defaultProps = {
|
|
@@ -74,27 +77,32 @@ TabContainer.defaultProps = {
|
|
|
74
77
|
};
|
|
75
78
|
const typesTypography = Typography.propTypes.type;
|
|
76
79
|
TabContainer.propTypes = {
|
|
80
|
+
/** Width of component. */
|
|
77
81
|
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
82
|
+
|
|
83
|
+
/** The value of the currently selected Tab. */
|
|
78
84
|
tabIndex: PropTypes.number,
|
|
85
|
+
|
|
86
|
+
/** The content of the component. */
|
|
79
87
|
children: PropTypes.node,
|
|
80
88
|
|
|
81
|
-
/**
|
|
89
|
+
/** Direction change the position of Tabs. */
|
|
82
90
|
direction: PropTypes.oneOf(['vertical', 'horizontal']),
|
|
83
91
|
|
|
84
|
-
/**
|
|
92
|
+
/** Direction change the size typography of Tab (typesTypography is types of Typography - exp: h1, h2, h3, p1 ...). */
|
|
85
93
|
level: PropTypes.oneOfType([PropTypes.oneOf(['level1', 'level2']), typesTypography]),
|
|
86
94
|
|
|
87
|
-
/**
|
|
95
|
+
/** Class for component */
|
|
88
96
|
className: PropTypes.string,
|
|
89
97
|
|
|
90
|
-
/**
|
|
98
|
+
/** Style inline of component. */
|
|
91
99
|
style: PropTypes.object,
|
|
92
100
|
|
|
93
|
-
/**
|
|
101
|
+
/** Any props else. */
|
|
94
102
|
props: PropTypes.any,
|
|
95
103
|
|
|
96
104
|
/**
|
|
97
|
-
*
|
|
105
|
+
* Ref methods.
|
|
98
106
|
*/
|
|
99
107
|
reference: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
100
108
|
current: PropTypes.instanceOf(Element)
|