diginet-core-ui 1.4.56 → 1.4.57-beta.2
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/components/accordion/details.js +1 -1
- package/components/accordion/group.js +1 -1
- package/components/accordion/index.js +1 -1
- package/components/accordion/summary.js +1 -1
- package/components/alert/index.js +1 -1
- package/components/alert/notify.js +1 -1
- package/components/avatar/index.js +2 -2
- package/components/badge/index.js +1 -1
- package/components/breadcrumb/index.js +1 -1
- package/components/button/icon.js +1 -1
- package/components/button/index.js +1 -1
- package/components/button/more.js +2 -2
- package/components/button/ripple-effect.js +1 -1
- package/components/card/body.js +1 -1
- package/components/card/extra.js +1 -1
- package/components/card/footer.js +1 -1
- package/components/card/header.js +1 -1
- package/components/card/index.js +1 -1
- package/components/chart/Pie/Circle.js +1 -1
- package/components/chart/Pie/Sector.js +1 -1
- package/components/chart/Pie/index.js +1 -1
- package/components/chart/Pie-v2/Circle.js +1 -1
- package/components/chart/Pie-v2/Sector.js +1 -1
- package/components/chart/Pie-v2/index.js +1 -1
- package/components/chart/bar/Bar.js +1 -1
- package/components/chart/bar/index.js +1 -1
- package/components/chart/bar-v2/Bar.js +1 -1
- package/components/chart/bar-v2/index.js +1 -1
- package/components/chart/line/index.js +1 -1
- package/components/chart/line-v2/index.js +1 -1
- package/components/check-text/index.js +1 -1
- package/components/check-text/interview-confirmation.js +1 -1
- package/components/check-text/interview-status.js +1 -1
- package/components/chip/index.js +1 -1
- package/components/collapse/index.js +1 -1
- package/components/divider/index.js +1 -1
- package/components/form-control/attachment/index.js +22 -22
- package/components/form-control/calendar/function.js +1 -1
- package/components/form-control/calendar/index.js +2 -2
- package/components/form-control/calendar/range.js +1 -1
- package/components/form-control/checkbox/index.js +1 -1
- package/components/form-control/control/index.js +1 -1
- package/components/form-control/date-input/index.js +1 -1
- package/components/form-control/date-picker/index.js +1 -1
- package/components/form-control/date-range-picker/index.js +2 -1
- package/components/form-control/dropdown/index.js +7 -2
- package/components/form-control/dropdown-box/index.js +64 -22
- package/components/form-control/form-group/index.js +1 -1
- package/components/form-control/helper-text/index.js +1 -1
- package/components/form-control/input-base/UncontrolledInputBase.js +1 -1
- package/components/form-control/input-base/index.js +1 -1
- package/components/form-control/label/index.js +1 -1
- package/components/form-control/money-input/index.js +1 -1
- package/components/form-control/number-input/index2.js +41 -25
- package/components/form-control/password-input/index.js +1 -1
- package/components/form-control/phone-input/index.js +1 -1
- package/components/form-control/radio/index.js +1 -1
- package/components/form-control/text-input/index.js +1 -1
- package/components/form-control/time-picker/index.js +1 -1
- package/components/form-control/time-picker/v2/index.js +1 -1
- package/components/form-control/toggle/index.js +1 -1
- package/components/form-view/input.js +1 -1
- package/components/grid/index.js +1 -1
- package/components/image/index.js +1 -1
- package/components/list/list-item-action.js +1 -1
- package/components/list/list-item-icon.js +1 -1
- package/components/list/list-item-text.js +1 -1
- package/components/list/list-item.js +1 -1
- package/components/list/list.js +1 -1
- package/components/list/sub-header.js +1 -1
- package/components/modal/body.js +1 -1
- package/components/modal/footer.js +1 -1
- package/components/modal/header.js +1 -1
- package/components/modal/index.js +1 -1
- package/components/modal/modal.js +1 -1
- package/components/others/option-wrapper/index.js +1 -1
- package/components/paging/page-info.js +35 -35
- package/components/paging/page-selector.js +1 -1
- package/components/paper/index.js +1 -1
- package/components/popover/body.js +1 -1
- package/components/popover/footer.js +1 -1
- package/components/popover/header.js +1 -1
- package/components/popover/index.js +14 -14
- package/components/popup/index.js +1 -1
- package/components/popup/v2/index.js +1 -1
- package/components/progress/circular.js +1 -1
- package/components/progress/linear.js +1 -1
- package/components/rating/index.js +1 -1
- package/components/skeleton/index.js +1 -1
- package/components/slider/slider-container.js +1 -1
- package/components/slider/slider-item.js +1 -1
- package/components/status/index.js +1 -1
- package/components/tab/tab-container.js +1 -1
- package/components/tab/tab-header.js +1 -1
- package/components/tab/tab-panel.js +1 -1
- package/components/tab/tab.js +1 -1
- package/components/tooltip/index.js +1 -1
- package/components/transfer/index.js +1 -1
- package/components/tree-view/index.js +1 -1
- package/components/typography/index.js +1 -1
- package/icons/basic.js +52 -0
- package/icons/effect.js +1 -1
- package/icons/menu/v2/index.js +1 -1
- package/package.json +78 -44
- package/readme.md +4 -0
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
import { css, jsx } from '@emotion/core';
|
|
4
|
-
import { ButtonIcon, InputBase, Label, Popover, PopoverBody } from "../..";
|
|
4
|
+
import { ButtonIcon, InputBase, Label, Popover, PopoverBody, HelperText } from "../..";
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import { Fragment, forwardRef, memo, useEffect, useImperativeHandle, useLayoutEffect, useRef, useState } from 'react';
|
|
6
|
+
import { Fragment, forwardRef, memo, useEffect, useImperativeHandle, useLayoutEffect, useRef, useState, useMemo } from 'react';
|
|
7
7
|
import { animation, borderColor, displayBlock, overflowHidden, parseHeight, parseMinWidth, positionRelative, scaleX } from "../../../styles/general";
|
|
8
8
|
import { useTheme } from "../../../theme";
|
|
9
9
|
import useThemeProps from "../../../theme/utils/useThemeProps";
|
|
10
10
|
import { classNames, getProp } from "../../../utils";
|
|
11
|
-
const
|
|
11
|
+
const regexBetween = /[^{}]+(?=})/g;
|
|
12
|
+
const regexInclude = /{|}/g;
|
|
13
|
+
const DropdownBox = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
12
14
|
if (!reference) reference = useRef(null);
|
|
13
15
|
const theme = useTheme();
|
|
14
16
|
const {
|
|
@@ -22,10 +24,14 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referen
|
|
|
22
24
|
});
|
|
23
25
|
const {
|
|
24
26
|
action = {},
|
|
27
|
+
allowInput,
|
|
25
28
|
bgColor: bgColorProp,
|
|
26
29
|
children,
|
|
27
30
|
className,
|
|
28
31
|
delayOnInput,
|
|
32
|
+
disabled,
|
|
33
|
+
displayExpr: displayExprProp,
|
|
34
|
+
error,
|
|
29
35
|
endIcon,
|
|
30
36
|
inputProps,
|
|
31
37
|
inputRef,
|
|
@@ -39,10 +45,19 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referen
|
|
|
39
45
|
placeholder,
|
|
40
46
|
startIcon,
|
|
41
47
|
style,
|
|
42
|
-
value,
|
|
43
|
-
|
|
48
|
+
value: valueProps,
|
|
49
|
+
valueExpr,
|
|
50
|
+
viewType,
|
|
51
|
+
helperTextProps
|
|
44
52
|
} = props;
|
|
53
|
+
let displayExpr = displayExprProp;
|
|
45
54
|
const bgColor = typeof bgColorProp === 'string' ? getProp(colors, bgColorProp, bgColorProp) : bgColorProp;
|
|
55
|
+
const ErrorView = useMemo(() => {
|
|
56
|
+
return error ? jsx(HelperText, {
|
|
57
|
+
...helperTextProps,
|
|
58
|
+
disabled: disabled
|
|
59
|
+
}, error) : null;
|
|
60
|
+
}, [disabled, error, helperTextProps]);
|
|
46
61
|
const ref = useRef(null);
|
|
47
62
|
const dropdownBoxRef = useRef(null);
|
|
48
63
|
const timer = useRef(null);
|
|
@@ -85,6 +100,28 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referen
|
|
|
85
100
|
onClosed === null || onClosed === void 0 ? void 0 : onClosed();
|
|
86
101
|
}
|
|
87
102
|
};
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Chuyển đổi data thành giá trị cần hiện thị dựa vào displayExpr [string, string object {field} - {field}], renderSelectedItem, displayExpr, valueExpr
|
|
106
|
+
* @param data {object} rowData of dataSource
|
|
107
|
+
* @return {string}
|
|
108
|
+
*/
|
|
109
|
+
const displayValue = data => {
|
|
110
|
+
let text = '';
|
|
111
|
+
if (data || data === 0) {
|
|
112
|
+
displayExpr = displayExpr || valueExpr;
|
|
113
|
+
let mask = data === null || data === void 0 ? void 0 : data[displayExpr];
|
|
114
|
+
// convert {id} - {name} to {<data[id]>} - {<data[name]>}
|
|
115
|
+
if (!mask && regexBetween.test(displayExpr)) {
|
|
116
|
+
var _displayExpr;
|
|
117
|
+
mask = (_displayExpr = displayExpr) === null || _displayExpr === void 0 ? void 0 : _displayExpr.replace(regexBetween, _ => (data === null || data === void 0 ? void 0 : data[_]) || '');
|
|
118
|
+
} else if (!mask) {
|
|
119
|
+
mask = typeof data !== 'object' ? data : '';
|
|
120
|
+
}
|
|
121
|
+
text = mask.toString().replace(regexInclude, '');
|
|
122
|
+
}
|
|
123
|
+
return text;
|
|
124
|
+
};
|
|
88
125
|
useLayoutEffect(() => {
|
|
89
126
|
if (ref.current) {
|
|
90
127
|
const {
|
|
@@ -130,15 +167,17 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referen
|
|
|
130
167
|
onClick: openOnClickAt === 'icon' ? onTriggerDropdown : null
|
|
131
168
|
}) : null;
|
|
132
169
|
};
|
|
170
|
+
const value = displayValue(valueProps);
|
|
133
171
|
return jsx(Fragment, null, jsx("div", {
|
|
134
172
|
ref: ref,
|
|
135
173
|
css: _DropdownBoxRootCSS,
|
|
136
|
-
className: classNames('DGN-UI-Dropdown-Box', className),
|
|
174
|
+
className: classNames('DGN-UI-Dropdown-Box', className, error && 'error'),
|
|
137
175
|
style: style
|
|
138
176
|
}, label ? jsx(Label, {
|
|
139
177
|
...labelProps
|
|
140
178
|
}, label) : null, jsx(InputBase, {
|
|
141
179
|
...inputProps,
|
|
180
|
+
readOnly: !allowInput,
|
|
142
181
|
style: inputStyle,
|
|
143
182
|
viewType: viewType,
|
|
144
183
|
inputRef: inputRef,
|
|
@@ -157,7 +196,7 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referen
|
|
|
157
196
|
anchor: ref.current,
|
|
158
197
|
width: popoverWidth,
|
|
159
198
|
onClose: closeDropdownBox
|
|
160
|
-
}, jsx(PopoverBody, null, children)));
|
|
199
|
+
}, jsx(PopoverBody, null, children)), ErrorView);
|
|
161
200
|
}));
|
|
162
201
|
const DropdownBoxRootCSS = (bgColorProp, {
|
|
163
202
|
colors
|
|
@@ -166,6 +205,17 @@ const DropdownBoxRootCSS = (bgColorProp, {
|
|
|
166
205
|
${positionRelative};
|
|
167
206
|
${parseMinWidth(150)};
|
|
168
207
|
${parseHeight('max-content')};
|
|
208
|
+
&.error {
|
|
209
|
+
.DGN-UI-InputBase {
|
|
210
|
+
${borderColor(getProp(colors, 'semantic/danger'))};
|
|
211
|
+
&::before {
|
|
212
|
+
${borderColor(getProp(colors, 'semantic/danger'))};
|
|
213
|
+
}
|
|
214
|
+
&::after {
|
|
215
|
+
${borderColor(getProp(colors, 'semantic/danger'))};
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
169
219
|
.DGN-UI-InputBase {
|
|
170
220
|
background: ${bgColorProp ? bgColorProp === true ? getProp(colors, 'fill/disabled') : bgColorProp : 'inherit'} !important;
|
|
171
221
|
${openState && css`
|
|
@@ -183,20 +233,6 @@ const DropdownBoxCSS = ({
|
|
|
183
233
|
margin-top: ${spacing([1])};
|
|
184
234
|
${overflowHidden};
|
|
185
235
|
`;
|
|
186
|
-
|
|
187
|
-
// DropdownBox.defaultProps = {
|
|
188
|
-
// className: '',
|
|
189
|
-
// label: '',
|
|
190
|
-
// placeholder: '',
|
|
191
|
-
// startIcon: 'Search',
|
|
192
|
-
// endIcon: 'ArrowDown',
|
|
193
|
-
// openOnClickAt: 'icon',
|
|
194
|
-
// viewType: 'underlined',
|
|
195
|
-
// inputProps: {},
|
|
196
|
-
// delayOnInput: 700,
|
|
197
|
-
// zIndex: zIndexCORE(1),
|
|
198
|
-
// };
|
|
199
|
-
|
|
200
236
|
DropdownBox.propTypes = {
|
|
201
237
|
/** class for dropdown */
|
|
202
238
|
className: PropTypes.string,
|
|
@@ -233,6 +269,12 @@ DropdownBox.propTypes = {
|
|
|
233
269
|
/** the function will run after open */
|
|
234
270
|
onOpened: PropTypes.func,
|
|
235
271
|
/** the function will run after close */
|
|
236
|
-
onClosed: PropTypes.func
|
|
272
|
+
onClosed: PropTypes.func,
|
|
273
|
+
/** Error message displayed below the input. */
|
|
274
|
+
error: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
275
|
+
/** If `true`, the component is disabled. */
|
|
276
|
+
disabled: PropTypes.bool,
|
|
277
|
+
/** If `true`, the input is enable. */
|
|
278
|
+
allowInput: PropTypes.bool
|
|
237
279
|
};
|
|
238
280
|
export default DropdownBox;
|
|
@@ -4,7 +4,7 @@ import { css, jsx } from '@emotion/core';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { Children, forwardRef, memo, useEffect, useImperativeHandle, useRef } from 'react';
|
|
6
6
|
import { useTheme } from "../../../theme";
|
|
7
|
-
const FormGroup = /*#__PURE__*/memo(
|
|
7
|
+
const FormGroup = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(({
|
|
8
8
|
fullWidth,
|
|
9
9
|
oneHelperText,
|
|
10
10
|
marginRight,
|
|
@@ -9,7 +9,7 @@ import { useTheme } from "../../../theme";
|
|
|
9
9
|
import useThemeProps from "../../../theme/utils/useThemeProps";
|
|
10
10
|
import { classNames, getProp } from "../../../utils";
|
|
11
11
|
const colorMap = new Map([['default', 'semantic/danger'], ['success', 'semantic/success'], ['warning', 'semantic/warning'], ['danger', 'semantic/danger'], ['info', 'semantic/info']]);
|
|
12
|
-
const HelperText = /*#__PURE__*/memo(
|
|
12
|
+
const HelperText = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
13
13
|
if (!reference) reference = useRef(null);
|
|
14
14
|
const theme = useTheme();
|
|
15
15
|
const {
|
|
@@ -9,7 +9,7 @@ import { bgColor, border, borderBottom, borderBottomColor, borderColor, borderNo
|
|
|
9
9
|
import { useTheme } from "../../../theme";
|
|
10
10
|
import useThemeProps from "../../../theme/utils/useThemeProps";
|
|
11
11
|
import { classNames, refType as ref, getProp } from "../../../utils";
|
|
12
|
-
const UncontrolledInputBase = /*#__PURE__*/memo(
|
|
12
|
+
const UncontrolledInputBase = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
13
13
|
if (!reference) reference = useRef(null);
|
|
14
14
|
const theme = useTheme();
|
|
15
15
|
const {
|
|
@@ -9,7 +9,7 @@ import { bgColor, bgTransparent, border, borderBottom, borderBottomColor, border
|
|
|
9
9
|
import { useTheme } from "../../../theme";
|
|
10
10
|
import useThemeProps from "../../../theme/utils/useThemeProps";
|
|
11
11
|
import { classNames, refType as ref, useInput, getProp } from "../../../utils";
|
|
12
|
-
const InputBase = /*#__PURE__*/memo(
|
|
12
|
+
const InputBase = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
13
13
|
if (!reference) reference = useRef(null);
|
|
14
14
|
const theme = useTheme();
|
|
15
15
|
const {
|
|
@@ -9,7 +9,7 @@ import { flexRow, parseMinHeight, typographyTypes } from "../../../styles/genera
|
|
|
9
9
|
import { useTheme } from "../../../theme";
|
|
10
10
|
import useThemeProps from "../../../theme/utils/useThemeProps";
|
|
11
11
|
import { classNames, getProp } from "../../../utils";
|
|
12
|
-
const Label = /*#__PURE__*/memo(
|
|
12
|
+
const Label = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
13
13
|
if (!reference) reference = useRef(null);
|
|
14
14
|
const theme = useTheme();
|
|
15
15
|
const {
|
|
@@ -128,7 +128,7 @@ const converters = {
|
|
|
128
128
|
en: num2WordsEn,
|
|
129
129
|
zh: num2WordsZh
|
|
130
130
|
};
|
|
131
|
-
const MoneyInput = /*#__PURE__*/memo(
|
|
131
|
+
const MoneyInput = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
132
132
|
if (!reference) reference = useRef(null);
|
|
133
133
|
|
|
134
134
|
// props priority: `inProps` > `themeDefaultProps`
|
|
@@ -49,7 +49,7 @@ const NumberInput = /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
|
49
49
|
labelProps,
|
|
50
50
|
max: maxProp,
|
|
51
51
|
maxDigit,
|
|
52
|
-
min,
|
|
52
|
+
min: minProp,
|
|
53
53
|
nonStyle,
|
|
54
54
|
onBlur,
|
|
55
55
|
onChange,
|
|
@@ -69,9 +69,12 @@ const NumberInput = /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
|
69
69
|
viewType
|
|
70
70
|
} = props;
|
|
71
71
|
let max = maxProp;
|
|
72
|
+
let min = minProp;
|
|
72
73
|
let thousandSymbol = thousandSeparator;
|
|
73
74
|
let decimalSymbol = decimalSymbolProp;
|
|
74
75
|
let valueProps = valueProp;
|
|
76
|
+
if (!min && min !== 0) min = -Infinity;
|
|
77
|
+
if (!max && max !== 0) max = Infinity;
|
|
75
78
|
const pos = useRef(null);
|
|
76
79
|
const ref = useRef(null);
|
|
77
80
|
const globalRef = useRef({});
|
|
@@ -95,13 +98,13 @@ const NumberInput = /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
|
95
98
|
|
|
96
99
|
// if (valueProps || valueProps === 0) valueProps = clamp(valueProps, min, max);
|
|
97
100
|
|
|
98
|
-
/**
|
|
99
|
-
* Convert number to format money
|
|
100
|
-
* @param vl {number} - value
|
|
101
|
-
* @type {function}
|
|
102
|
-
* @return {string}
|
|
103
|
-
* @example 1200300.123 => 1,200,300.123
|
|
104
|
-
* @example 1200300,123 => 1.200.300,123
|
|
101
|
+
/**
|
|
102
|
+
* Convert number to format money
|
|
103
|
+
* @param vl {number} - value
|
|
104
|
+
* @type {function}
|
|
105
|
+
* @return {string}
|
|
106
|
+
* @example 1200300.123 => 1,200,300.123
|
|
107
|
+
* @example 1200300,123 => 1.200.300,123
|
|
105
108
|
*/
|
|
106
109
|
const parseNumberToMoney = useCallback((vl, isNumber) => {
|
|
107
110
|
var _number, _number2, _number$, _number3;
|
|
@@ -149,13 +152,13 @@ const NumberInput = /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
|
149
152
|
return number;
|
|
150
153
|
}, [decimalSymbol, max, value, decimalDigit, fixedDecimalDigit]);
|
|
151
154
|
|
|
152
|
-
/**
|
|
153
|
-
* Convert money to format number
|
|
154
|
-
* @param vl {string} - value
|
|
155
|
-
* @type {function}
|
|
156
|
-
* @return {number}
|
|
157
|
-
* @example 1,200,300.123 => 1200300.123
|
|
158
|
-
* @example 1.200.300,123 => 1200300.123
|
|
155
|
+
/**
|
|
156
|
+
* Convert money to format number
|
|
157
|
+
* @param vl {string} - value
|
|
158
|
+
* @type {function}
|
|
159
|
+
* @return {number}
|
|
160
|
+
* @example 1,200,300.123 => 1200300.123
|
|
161
|
+
* @example 1.200.300,123 => 1200300.123
|
|
159
162
|
*/
|
|
160
163
|
const convertMoneyToNumber = useCallback((vl, isNumber) => {
|
|
161
164
|
var _number4, _number4$toString, _number4$toString$rep, _number4$toString$rep2, _number4$toString$rep3;
|
|
@@ -168,10 +171,23 @@ const NumberInput = /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
|
168
171
|
const _onInput = useCallback((e, flag) => {
|
|
169
172
|
var _e$target$value;
|
|
170
173
|
let valueT = (_e$target$value = e.target.value) !== null && _e$target$value !== void 0 ? _e$target$value : e.value;
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
if ((
|
|
174
|
-
|
|
174
|
+
let limitValueT = valueT;
|
|
175
|
+
// không chạy xử lý khi giá trị chỉ có dấu "-"
|
|
176
|
+
if (Number(!isNaN(limitValueT))) {
|
|
177
|
+
var _valueT$toString$repl, _valueT$toString$repl2;
|
|
178
|
+
// xóa các số "0" đứng trước giá trị ví dụ: 0100, 0200 để tránh lỗi Octal literals are not allowed in strict mode
|
|
179
|
+
limitValueT = (_valueT$toString$repl = (_valueT$toString$repl2 = valueT.toString().replaceAll(thousandSymbol, '')).replaceAll) === null || _valueT$toString$repl === void 0 ? void 0 : _valueT$toString$repl.call(_valueT$toString$repl2, decimalSymbol, '.').split(/([+\-*/])/).map(a => parseFloat(a) || a).join('');
|
|
180
|
+
if (disabledNegative && eval(limitValueT) <= 0) {
|
|
181
|
+
limitValueT = 0;
|
|
182
|
+
}
|
|
183
|
+
if ((min || min === 0) && eval(limitValueT) <= min) {
|
|
184
|
+
limitValueT = min;
|
|
185
|
+
}
|
|
186
|
+
if (max && eval(limitValueT) >= max) {
|
|
187
|
+
limitValueT = max;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
valueT = parseNumberToMoney(limitValueT);
|
|
175
191
|
const returnValue = convertMoneyToNumber(valueT);
|
|
176
192
|
e.value = globalRef.current.value = !isNaN(parseFloat(returnValue)) ? parseFloat(returnValue) : null;
|
|
177
193
|
// e.target.value = globalRef.current.valueString = valueT || '';
|
|
@@ -207,7 +223,7 @@ const NumberInput = /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
|
207
223
|
onBlur && onBlur(e);
|
|
208
224
|
}, [min, max]);
|
|
209
225
|
const _onKeyDown = e => {
|
|
210
|
-
var _value$split, _value$split
|
|
226
|
+
var _value$split, _value$split$, _value$toString;
|
|
211
227
|
const {
|
|
212
228
|
key,
|
|
213
229
|
keyCode,
|
|
@@ -272,7 +288,7 @@ const NumberInput = /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
|
272
288
|
|
|
273
289
|
// disabled negative
|
|
274
290
|
// const disabled180 = (keyCode === 189 || keyCode === 109) && (disabledNegative || value.includes('-'));
|
|
275
|
-
const disabled180 = (keyCode === 189 || keyCode === 109) && (min === 0 || disabledNegative);
|
|
291
|
+
const disabled180 = (keyCode === 189 || keyCode === 109) && (min === 0 || disabledNegative) || ((_value$toString = value.toString()) === null || _value$toString === void 0 ? void 0 : _value$toString[0]) === '-' && (keyCode === 189 || keyCode === 109);
|
|
276
292
|
|
|
277
293
|
// disabled max digit
|
|
278
294
|
const isMaxDigit = maxDigit && (value === null || value === void 0 ? void 0 : value.replace(regexNumber, '').length) === maxDigit && (isNumber || key === thousandSymbol || key === decimalSymbol) && selectionStart === selectionEnd;
|
|
@@ -492,10 +508,10 @@ NumberInput.propTypes = {
|
|
|
492
508
|
style: PropTypes.object,
|
|
493
509
|
/** Thousand separator character. */
|
|
494
510
|
thousandSeparator: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['.', ','])]),
|
|
495
|
-
/** Validation value, argument can:<br/>
|
|
496
|
-
* * string: the validation rule. Example required.<br/>
|
|
497
|
-
* * object: the validation rule insist name, property, message. Example {name: 'min', compareValue: 9, message: 'Error'} or {max: 99}<br/>
|
|
498
|
-
* * array: the validation rule list, insist object/string
|
|
511
|
+
/** Validation value, argument can:<br/>
|
|
512
|
+
* * string: the validation rule. Example required.<br/>
|
|
513
|
+
* * object: the validation rule insist name, property, message. Example {name: 'min', compareValue: 9, message: 'Error'} or {max: 99}<br/>
|
|
514
|
+
* * array: the validation rule list, insist object/string
|
|
499
515
|
*/
|
|
500
516
|
validates: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.array, PropTypes.func]),
|
|
501
517
|
/** The value of the input element, required for a controlled component. */
|
|
@@ -8,7 +8,7 @@ import { cursorNotAllowed, displayBlock, positionRelative } from "../../../style
|
|
|
8
8
|
import { useTheme } from "../../../theme";
|
|
9
9
|
import useThemeProps from "../../../theme/utils/useThemeProps";
|
|
10
10
|
import { classNames, onValidate, refType as ref } from "../../../utils";
|
|
11
|
-
const PasswordInput = /*#__PURE__*/memo(
|
|
11
|
+
const PasswordInput = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
12
12
|
if (!reference) reference = useRef(null);
|
|
13
13
|
const theme = useTheme();
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@ import { boxBorder, cursorNoDrop, cursorPointer, displayBlock, displayNone, posi
|
|
|
8
8
|
import { useTheme } from "../../../theme";
|
|
9
9
|
import useThemeProps from "../../../theme/utils/useThemeProps";
|
|
10
10
|
import { classNames, getProp, randomString } from "../../../utils";
|
|
11
|
-
const Radio = /*#__PURE__*/memo(
|
|
11
|
+
const Radio = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
12
12
|
if (!reference) reference = useRef(null);
|
|
13
13
|
const theme = useTheme();
|
|
14
14
|
const {
|
|
@@ -8,7 +8,7 @@ import { cursorNotAllowed, displayBlock, positionRelative } from "../../../style
|
|
|
8
8
|
import { useTheme } from "../../../theme";
|
|
9
9
|
import useThemeProps from "../../../theme/utils/useThemeProps";
|
|
10
10
|
import { classNames, onValidate, refType as ref } from "../../../utils";
|
|
11
|
-
const TextInput = /*#__PURE__*/memo(
|
|
11
|
+
const TextInput = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
12
12
|
if (!reference) reference = useRef(null);
|
|
13
13
|
const theme = useTheme();
|
|
14
14
|
|
|
@@ -9,7 +9,7 @@ import { bgColor, border, borderColor, borderNone, borderRadius4px, displayFlex,
|
|
|
9
9
|
import { useTheme } from "../../../../theme";
|
|
10
10
|
import useThemeProps from "../../../../theme/utils/useThemeProps";
|
|
11
11
|
import { classNames, date, getProp, hexToRGBA } from "../../../../utils";
|
|
12
|
-
const TimePicker = /*#__PURE__*/memo(
|
|
12
|
+
const TimePicker = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
13
13
|
if (!reference) reference = useRef(null);
|
|
14
14
|
|
|
15
15
|
// props priority: `inProps` > `themeDefaultProps`
|
|
@@ -8,7 +8,7 @@ import { borderRadius, cursorNoDrop, cursorPointer, displayBlock, flexRow, items
|
|
|
8
8
|
import { useTheme } from "../../../theme";
|
|
9
9
|
import useThemeProps from "../../../theme/utils/useThemeProps";
|
|
10
10
|
import { classNames, getProp } from "../../../utils";
|
|
11
|
-
const Toggle = /*#__PURE__*/memo(
|
|
11
|
+
const Toggle = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
12
12
|
if (!reference) reference = useRef(null);
|
|
13
13
|
const theme = useTheme();
|
|
14
14
|
|
|
@@ -6,7 +6,7 @@ import { forwardRef, memo, useEffect, useMemo, useRef } from 'react';
|
|
|
6
6
|
import { border, borderBottom, borderRadius, bottom, boxBorder, displayFlex, inset, insetX, itemsCenter, parseHeight, pointerEventsNone, positionAbsolute, positionRelative, scale } from "../../styles/general";
|
|
7
7
|
import { useTheme } from "../../theme";
|
|
8
8
|
import { formatDate, getProp } from "../../utils";
|
|
9
|
-
const InputView = /*#__PURE__*/memo(
|
|
9
|
+
const InputView = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(({
|
|
10
10
|
inputProps,
|
|
11
11
|
inputStyleProps,
|
|
12
12
|
value,
|
package/components/grid/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import { breakpointKeys } from "../../theme/createBreakpoints";
|
|
|
10
10
|
import useThemeProps from "../../theme/utils/useThemeProps";
|
|
11
11
|
import { classNames, handleBreakpoints } from "../../utils";
|
|
12
12
|
import GridContext from "./context";
|
|
13
|
-
const Grid = /*#__PURE__*/memo(
|
|
13
|
+
const Grid = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
14
14
|
if (!reference) reference = useRef(null);
|
|
15
15
|
const theme = useTheme();
|
|
16
16
|
const {
|
|
@@ -15,7 +15,7 @@ const blurKeyframe = keyframes`
|
|
|
15
15
|
75% { -webkit-filter: blur(1px);}
|
|
16
16
|
100% { -webkit-filter: blur(0px);}
|
|
17
17
|
`;
|
|
18
|
-
const Image = /*#__PURE__*/memo(
|
|
18
|
+
const Image = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
19
19
|
if (!reference) reference = useRef(null);
|
|
20
20
|
|
|
21
21
|
// props priority: `inProps` > `themeDefaultProps`
|
|
@@ -7,7 +7,7 @@ import { forwardRef, memo, useImperativeHandle, useMemo, useRef } from 'react';
|
|
|
7
7
|
import { bgColor, boxBorder, displayFlex, itemsCenter, order, parseMaxHeight, positionRelative, textColor, z } from "../../styles/general";
|
|
8
8
|
import { useTheme } from "../../theme";
|
|
9
9
|
import { classNames, getProp } from "../../utils";
|
|
10
|
-
const ListItemAction = /*#__PURE__*/memo(
|
|
10
|
+
const ListItemAction = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(({
|
|
11
11
|
children,
|
|
12
12
|
name,
|
|
13
13
|
className,
|
|
@@ -7,7 +7,7 @@ import { forwardRef, memo, useImperativeHandle, useMemo, useRef } from 'react';
|
|
|
7
7
|
import { bgColor, boxBorder, displayFlex, itemsCenter, order, parseMinWidth, positionRelative, textColor, z } from "../../styles/general";
|
|
8
8
|
import { useTheme } from "../../theme";
|
|
9
9
|
import { classNames, getProp } from "../../utils";
|
|
10
|
-
const ListItemIcon = /*#__PURE__*/memo(
|
|
10
|
+
const ListItemIcon = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(({
|
|
11
11
|
className,
|
|
12
12
|
children,
|
|
13
13
|
name,
|
|
@@ -6,7 +6,7 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import { forwardRef, memo, useImperativeHandle, useMemo, useRef } from 'react';
|
|
7
7
|
import { bgColor, boxBorder, displayFlex, itemsCenter, order, positionRelative } from "../../styles/general";
|
|
8
8
|
import { classNames } from "../../utils";
|
|
9
|
-
const ListItemText = /*#__PURE__*/memo(
|
|
9
|
+
const ListItemText = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(({
|
|
10
10
|
className,
|
|
11
11
|
children,
|
|
12
12
|
style,
|
|
@@ -7,7 +7,7 @@ import { forwardRef, memo, useEffect, useImperativeHandle, useMemo, useRef } fro
|
|
|
7
7
|
import { bgColor, boxBorder, cursorPointer, displayFlex, flexRow, itemsCenter, overflowHidden, parseMaxWidth, parseMinHeight, parseWidthHeight, positionRelative, textColor, userSelectNone } from "../../styles/general";
|
|
8
8
|
import { useTheme } from "../../theme";
|
|
9
9
|
import { classNames, getProp } from "../../utils";
|
|
10
|
-
const ListItem = /*#__PURE__*/memo(
|
|
10
|
+
const ListItem = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(({
|
|
11
11
|
children,
|
|
12
12
|
className,
|
|
13
13
|
style,
|
package/components/list/list.js
CHANGED
|
@@ -7,7 +7,7 @@ import { bgColor, borderRadius, boxBorder, displayBlock, parseMaxHeight, parseMa
|
|
|
7
7
|
import { useTheme } from "../../theme";
|
|
8
8
|
import { classNames, getProp } from "../../utils";
|
|
9
9
|
const levels = [0, 1, 'second', 'third', 'fourth', 'fifth'];
|
|
10
|
-
const List = /*#__PURE__*/memo(
|
|
10
|
+
const List = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(({
|
|
11
11
|
className,
|
|
12
12
|
width,
|
|
13
13
|
maxWidth,
|
|
@@ -6,7 +6,7 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import { forwardRef, memo, useImperativeHandle, useMemo, useRef } from 'react';
|
|
7
7
|
import { bgColor, boxBorder, displayBlock, parseWidthHeight, positionSticky, textLeft, top, userSelectNone, z } from "../../styles/general";
|
|
8
8
|
import { useTheme } from "../../theme";
|
|
9
|
-
const ListSubHeader = /*#__PURE__*/memo(
|
|
9
|
+
const ListSubHeader = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(({
|
|
10
10
|
children,
|
|
11
11
|
style,
|
|
12
12
|
...props
|
package/components/modal/body.js
CHANGED
|
@@ -9,7 +9,7 @@ import sx from "../../styles/sx";
|
|
|
9
9
|
import useThemeProps from "../../theme/utils/useThemeProps";
|
|
10
10
|
import { classNames } from "../../utils";
|
|
11
11
|
import { sxResponsivePadding } from "./header";
|
|
12
|
-
const ModalBody = /*#__PURE__*/memo(
|
|
12
|
+
const ModalBody = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
13
13
|
if (!reference) reference = useRef(null);
|
|
14
14
|
|
|
15
15
|
// props priority: `inProps` > `themeDefaultProps`
|
|
@@ -9,7 +9,7 @@ import sx from "../../styles/sx";
|
|
|
9
9
|
import useThemeProps from "../../theme/utils/useThemeProps";
|
|
10
10
|
import { classNames } from "../../utils";
|
|
11
11
|
import { sxResponsivePadding } from "./header";
|
|
12
|
-
const ModalFooter = /*#__PURE__*/memo(
|
|
12
|
+
const ModalFooter = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
13
13
|
if (!reference) reference = useRef(null);
|
|
14
14
|
|
|
15
15
|
// props priority: `inProps` > `themeDefaultProps`
|
|
@@ -17,7 +17,7 @@ export const sxResponsivePadding = {
|
|
|
17
17
|
md: [4, 6]
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
|
-
const ModalHeader = /*#__PURE__*/memo(
|
|
20
|
+
const ModalHeader = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
21
21
|
if (!reference) reference = useRef(null);
|
|
22
22
|
const theme = useTheme();
|
|
23
23
|
const {
|
|
@@ -5,7 +5,7 @@ import Body from "./body";
|
|
|
5
5
|
import Footer from "./footer";
|
|
6
6
|
import Header from "./header";
|
|
7
7
|
import Modal from "./modal";
|
|
8
|
-
const ModalSample = /*#__PURE__*/memo(
|
|
8
|
+
const ModalSample = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(({
|
|
9
9
|
action = {},
|
|
10
10
|
bodyStyle,
|
|
11
11
|
children,
|
|
@@ -13,7 +13,7 @@ import { classNames, getProp, hexToRGBA, useDelayUnmount } from "../../utils";
|
|
|
13
13
|
import ModalContext from "./context";
|
|
14
14
|
const fadeInDown = animations.fadeInDown;
|
|
15
15
|
const fadeOutUp = animations.fadeOutUp;
|
|
16
|
-
const Modal = /*#__PURE__*/memo(
|
|
16
|
+
const Modal = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
17
17
|
if (!reference) reference = useRef(null);
|
|
18
18
|
const theme = useTheme();
|
|
19
19
|
const {
|
|
@@ -4,7 +4,7 @@ import { jsx } from '@emotion/core';
|
|
|
4
4
|
import { forwardRef, memo, useEffect, useState } from 'react';
|
|
5
5
|
import sx from "../../../styles/sx";
|
|
6
6
|
const OptionWrapper = Component => {
|
|
7
|
-
const WrappedComponent = /*#__PURE__*/memo(
|
|
7
|
+
const WrappedComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((props, ref) => {
|
|
8
8
|
const [options, setOptions] = useState({});
|
|
9
9
|
const option = (option, optionValue) => {
|
|
10
10
|
if (typeof option === 'undefined') {
|