diginet-core-ui 1.4.64 → 1.4.65-beta.1
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/MHRM09N1404.svg +18 -0
- package/assets/images/menu/dhr/MHRP25N0010.svg +16 -0
- package/assets/images/menu/eo/WEO53APP01.svg +16 -0
- package/assets/images/menu/eo/WEO53TR001.svg +15 -0
- package/assets/images/menu/invoice/D06-2.svg +11 -0
- package/assets/images/menu/invoice/D06-4.svg +5 -0
- package/assets/images/menu/invoice/D95F3090.svg +13 -0
- package/assets/images/menu/invoice/D95F3093.svg +11 -0
- package/assets/images/menu/invoice/D95F3094.svg +11 -0
- package/assets/images/menu/invoice/W102F1000.svg +11 -0
- package/assets/images/menu/invoice/W103F1000.svg +15 -0
- package/assets/images/menu/invoice/W104F1000.svg +13 -0
- package/assets/images/menu/invoice/W105F1000.svg +12 -0
- package/assets/images/menu/invoice/W106F1000.svg +15 -0
- package/assets/images/menu/invoice/W107F1000.svg +11 -0
- package/assets/images/menu/invoice/W108F1000.svg +6 -0
- package/components/button/more.js +28 -14
- package/components/form-control/calendar/function.js +1 -1
- package/components/form-control/calendar/index.js +1 -1
- package/components/form-control/date-input/DateField.js +2 -2
- package/components/form-control/date-input/utils.js +3 -3
- package/components/form-control/date-picker/index.js +1 -1
- package/components/form-control/date-range-picker/index.js +42 -24
- package/components/form-control/dropdown/index.js +46 -46
- package/components/form-control/dropdown-box/index.js +63 -21
- package/components/form-control/money-input/index.js +25 -19
- package/components/form-control/number-input/index2.js +4 -1
- package/components/popup/v2/index.js +22 -18
- package/global/index.js +2 -1
- package/icons/basic.js +66 -0
- package/icons/menu/v2/index.js +2 -2
- package/package.json +78 -44
- package/readme.md +13 -0
- package/theme/settings.js +1 -1
- package/utils/date.js +56 -56
|
@@ -29,7 +29,7 @@ const convertData = (dt, valueExpr) => {
|
|
|
29
29
|
};
|
|
30
30
|
const convertSearchDelayTime = searchDelayTime => {
|
|
31
31
|
var _searchDelayTime$matc, _searchDelayTime$matc2;
|
|
32
|
-
if (searchDelayTime === true) return getGlobal('
|
|
32
|
+
if (searchDelayTime === true) return getGlobal('delayOnSearchInput');
|
|
33
33
|
const units = {
|
|
34
34
|
m: 60000,
|
|
35
35
|
s: 1000,
|
|
@@ -122,10 +122,10 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
|
|
|
122
122
|
} = props;
|
|
123
123
|
const selectBox = multiple && selectBoxProp === undefined ? true : selectBoxProp;
|
|
124
124
|
const searchExpr = typeof searchExprProp === 'string' ? [searchExprProp] : searchExprProp;
|
|
125
|
-
const searchDelayTime = convertSearchDelayTime(searchDelayTimeProp === undefined ? getGlobal('
|
|
125
|
+
const searchDelayTime = convertSearchDelayTime(searchDelayTimeProp === undefined ? getGlobal('delayOnSearchInput') : searchDelayTimeProp);
|
|
126
126
|
let displayExpr = displayExprProp;
|
|
127
127
|
const noDataText = noDataTextProp || getGlobal('noDataText');
|
|
128
|
-
const placeholder = placeholderProp || getGlobal('dropdownPlaceholder');
|
|
128
|
+
const placeholder = placeholderProp || !readOnly && !disabled && getGlobal('dropdownPlaceholder');
|
|
129
129
|
const ref = useRef(null);
|
|
130
130
|
const dropdownRef = useRef(null);
|
|
131
131
|
const timer = useRef(null);
|
|
@@ -301,10 +301,10 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
|
|
|
301
301
|
});
|
|
302
302
|
};
|
|
303
303
|
|
|
304
|
-
/**
|
|
305
|
-
* So sánh text đầu vào cáo map với txtSearch
|
|
306
|
-
* @param text
|
|
307
|
-
* @return {boolean}
|
|
304
|
+
/**
|
|
305
|
+
* So sánh text đầu vào cáo map với txtSearch
|
|
306
|
+
* @param text
|
|
307
|
+
* @return {boolean}
|
|
308
308
|
*/
|
|
309
309
|
const handleRenderBySearch = (text = '') => {
|
|
310
310
|
if (text === null || text === undefined) text = '';
|
|
@@ -317,10 +317,10 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
|
|
|
317
317
|
} else return text.toLowerCase().includes(txtSearch.toLowerCase());
|
|
318
318
|
};
|
|
319
319
|
|
|
320
|
-
/**
|
|
321
|
-
* 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
|
|
322
|
-
* @param data {object} rowData of dataSource
|
|
323
|
-
* @return {string}
|
|
320
|
+
/**
|
|
321
|
+
* 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
|
|
322
|
+
* @param data {object} rowData of dataSource
|
|
323
|
+
* @return {string}
|
|
324
324
|
*/
|
|
325
325
|
const displayValue = data => {
|
|
326
326
|
let text = '';
|
|
@@ -1805,9 +1805,9 @@ Dropdown.propTypes = {
|
|
|
1805
1805
|
defaultValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.array]),
|
|
1806
1806
|
/** If `true`, the component is disabled. */
|
|
1807
1807
|
disabled: PropTypes.bool,
|
|
1808
|
-
/** The field name used for displaying text in the dropdown list.<br/>
|
|
1809
|
-
* Examples: 'name', '{id} - {name}', '{age} age(s)'<br/>
|
|
1810
|
-
* Note: Do not use 'id - name', as it will return undefined.
|
|
1808
|
+
/** The field name used for displaying text in the dropdown list.<br/>
|
|
1809
|
+
* Examples: 'name', '{id} - {name}', '{age} age(s)'<br/>
|
|
1810
|
+
* Note: Do not use 'id - name', as it will return undefined.
|
|
1811
1811
|
*/
|
|
1812
1812
|
displayExpr: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.array]),
|
|
1813
1813
|
/** Inline style for dropdown items. */
|
|
@@ -1816,14 +1816,14 @@ Dropdown.propTypes = {
|
|
|
1816
1816
|
error: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
1817
1817
|
/** Props applied to the [HelperText](https://core.diginet.com.vn/ui/?path=/story/form-control-text-helpertext) element. */
|
|
1818
1818
|
helperTextProps: PropTypes.object,
|
|
1819
|
-
/** The field name used for displaying icons.<br/>
|
|
1820
|
-
* Example:<br/>
|
|
1821
|
-
* string: 'icon'<br/>
|
|
1822
|
-
* object: {<br/>
|
|
1823
|
-
* key: 'icon',<br/>
|
|
1824
|
-
* prefix: 'https://imglink.com',<br/>
|
|
1825
|
-
* suffix: '.jpg'<br/>
|
|
1826
|
-
* }
|
|
1819
|
+
/** The field name used for displaying icons.<br/>
|
|
1820
|
+
* Example:<br/>
|
|
1821
|
+
* string: 'icon'<br/>
|
|
1822
|
+
* object: {<br/>
|
|
1823
|
+
* key: 'icon',<br/>
|
|
1824
|
+
* prefix: 'https://imglink.com',<br/>
|
|
1825
|
+
* suffix: '.jpg'<br/>
|
|
1826
|
+
* }
|
|
1827
1827
|
*/
|
|
1828
1828
|
iconExpr: PropTypes.oneOfType([PropTypes.string, PropTypes.shape({
|
|
1829
1829
|
key: PropTypes.string,
|
|
@@ -1859,8 +1859,8 @@ Dropdown.propTypes = {
|
|
|
1859
1859
|
onOpened: PropTypes.func,
|
|
1860
1860
|
/** Callback function fired when the dropdown is closed. */
|
|
1861
1861
|
onClosed: PropTypes.func,
|
|
1862
|
-
/** Callback function fired when the input value changes.<br/>
|
|
1863
|
-
* If undefined, the filter function will run (default behavior).
|
|
1862
|
+
/** Callback function fired when the input value changes.<br/>
|
|
1863
|
+
* If undefined, the filter function will run (default behavior).
|
|
1864
1864
|
*/
|
|
1865
1865
|
onInput: PropTypes.func,
|
|
1866
1866
|
/** Callback function fired when a key is pressed down in the input. */
|
|
@@ -1873,21 +1873,21 @@ Dropdown.propTypes = {
|
|
|
1873
1873
|
placeholder: PropTypes.string,
|
|
1874
1874
|
/** If `true`, the component is read-only. */
|
|
1875
1875
|
readOnly: PropTypes.bool,
|
|
1876
|
-
/** Function used for custom rendering of items.<br/>
|
|
1877
|
-
* Example: `(data, index) => data.name + ' - ' + data.role`<br/>
|
|
1878
|
-
* This can be used as an alternative to `displayExpr`
|
|
1876
|
+
/** Function used for custom rendering of items.<br/>
|
|
1877
|
+
* Example: `(data, index) => data.name + ' - ' + data.role`<br/>
|
|
1878
|
+
* This can be used as an alternative to `displayExpr`
|
|
1879
1879
|
*/
|
|
1880
1880
|
renderItem: PropTypes.func,
|
|
1881
|
-
/** Function or field name used to display selected items.<br/>
|
|
1882
|
-
* Example: `(data, index) => index + ' - ' + data.name`<br/>
|
|
1881
|
+
/** Function or field name used to display selected items.<br/>
|
|
1882
|
+
* Example: `(data, index) => index + ' - ' + data.name`<br/>
|
|
1883
1883
|
*/
|
|
1884
1884
|
renderSelectedItem: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
|
1885
1885
|
/** If `true`, the label will indicate that the input is required. */
|
|
1886
1886
|
required: PropTypes.bool,
|
|
1887
|
-
/**
|
|
1888
|
-
* Duration to wait after entering search content before triggering a search.<br/>
|
|
1889
|
-
* Example: 700 -> 700ms, '700ms' -> 700ms, '0.7s' -> 700ms, '1m' -> 60000ms
|
|
1890
|
-
* If `true`, the default delayOnInput will be used.
|
|
1887
|
+
/**
|
|
1888
|
+
* Duration to wait after entering search content before triggering a search.<br/>
|
|
1889
|
+
* Example: 700 -> 700ms, '700ms' -> 700ms, '0.7s' -> 700ms, '1m' -> 60000ms
|
|
1890
|
+
* If `true`, the default delayOnInput will be used.
|
|
1891
1891
|
*/
|
|
1892
1892
|
searchDelayTime: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.bool]),
|
|
1893
1893
|
/** Specifies the field name or expression used to compare values with the search string. */
|
|
@@ -1920,19 +1920,19 @@ Dropdown.propTypes = {
|
|
|
1920
1920
|
viewType: PropTypes.oneOf(['underlined', 'outlined', 'none']),
|
|
1921
1921
|
/** Custom icon to override the default arrow icon. */
|
|
1922
1922
|
endIcon: PropTypes.string
|
|
1923
|
-
/**
|
|
1924
|
-
* ref methods
|
|
1925
|
-
*
|
|
1926
|
-
* how to get component element? ref.current
|
|
1927
|
-
*
|
|
1928
|
-
* how to call method? ref.current.instance.{method}
|
|
1929
|
-
*
|
|
1930
|
-
* * showDropdown(): Show dropdown
|
|
1931
|
-
* * closeDropdown(): Close dropdown
|
|
1932
|
-
* * onClear(): Clear selected value
|
|
1933
|
-
* * setPreviousValue(): Set value to previous value
|
|
1934
|
-
* * setValue(value): Set value of dropdown
|
|
1935
|
-
* * @param {value} - string || number || array
|
|
1923
|
+
/**
|
|
1924
|
+
* ref methods
|
|
1925
|
+
*
|
|
1926
|
+
* how to get component element? ref.current
|
|
1927
|
+
*
|
|
1928
|
+
* how to call method? ref.current.instance.{method}
|
|
1929
|
+
*
|
|
1930
|
+
* * showDropdown(): Show dropdown
|
|
1931
|
+
* * closeDropdown(): Close dropdown
|
|
1932
|
+
* * onClear(): Clear selected value
|
|
1933
|
+
* * setPreviousValue(): Set value to previous value
|
|
1934
|
+
* * setValue(value): Set value of dropdown
|
|
1935
|
+
* * @param {value} - string || number || array
|
|
1936
1936
|
*/
|
|
1937
1937
|
};
|
|
1938
1938
|
export default Dropdown;
|
|
@@ -1,13 +1,15 @@
|
|
|
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 regexBetween = /[^{}]+(?=})/g;
|
|
12
|
+
const regexInclude = /{|}/g;
|
|
11
13
|
const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
12
14
|
if (!reference) reference = useRef(null);
|
|
13
15
|
const theme = useTheme();
|
|
@@ -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;
|
|
@@ -404,13 +404,7 @@ const MoneyInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
|
|
|
404
404
|
}
|
|
405
405
|
const v = getValueWithDecimal(number.toString().replace('.', decimalSymbol));
|
|
406
406
|
if (convertToWords && !decimalDigit && (disabled || readOnly)) {
|
|
407
|
-
|
|
408
|
-
if (Number.isInteger(number)) {
|
|
409
|
-
const currentLocale = locale.get();
|
|
410
|
-
const converter = converters[currentLocale] || num2WordsVi; // fallback VN
|
|
411
|
-
valueConverted = converter.convert(number);
|
|
412
|
-
}
|
|
413
|
-
inputRef.current.value = parseValueWithFix(valueConverted);
|
|
407
|
+
inputRef.current.value = convertNumToWords(value);
|
|
414
408
|
} else {
|
|
415
409
|
inputRef.current.value = parseValueWithFix(thousandSeparator ? getThousandSeparator(v) : v);
|
|
416
410
|
}
|
|
@@ -427,13 +421,23 @@ const MoneyInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
|
|
|
427
421
|
useImperativeHandle(reference, () => {
|
|
428
422
|
const currentRef = ref.current || {};
|
|
429
423
|
const _instance = {
|
|
430
|
-
getThousandSeparator: getThousandSeparator
|
|
424
|
+
getThousandSeparator: getThousandSeparator,
|
|
425
|
+
convertNumToWords
|
|
431
426
|
}; // methods
|
|
432
427
|
_instance.__proto__ = {}; // hidden methods
|
|
433
428
|
currentRef.instance = _instance;
|
|
434
429
|
currentRef.getThousandSeparator = getThousandSeparator;
|
|
435
430
|
return currentRef;
|
|
436
431
|
});
|
|
432
|
+
const convertNumToWords = number => {
|
|
433
|
+
let valueConverted = getGlobal('helperInvalid');
|
|
434
|
+
if (Number.isInteger(number)) {
|
|
435
|
+
const currentLocale = locale.get();
|
|
436
|
+
const converter = converters[currentLocale] || num2WordsVi; // fallback VN
|
|
437
|
+
valueConverted = Object.hasOwn(converter, 'convert') ? converter.convert(number) : converter(number);
|
|
438
|
+
}
|
|
439
|
+
return valueConverted;
|
|
440
|
+
};
|
|
437
441
|
const validateResult = validates && onValidate(value, validates, true);
|
|
438
442
|
return jsx("div", {
|
|
439
443
|
ref: ref,
|
|
@@ -543,6 +547,8 @@ MoneyInput.propTypes = {
|
|
|
543
547
|
required: PropTypes.bool,
|
|
544
548
|
/** Convert money from number to words when readOnly || disabled */
|
|
545
549
|
convertToWords: PropTypes.bool,
|
|
550
|
+
/** Convert number to words function */
|
|
551
|
+
convertNumToWords: PropTypes.number,
|
|
546
552
|
/** Add a string to first of value when convertToWords. */
|
|
547
553
|
prefix: PropTypes.string,
|
|
548
554
|
/** Add a string to last of value when convertToWords. */
|
|
@@ -551,10 +557,10 @@ MoneyInput.propTypes = {
|
|
|
551
557
|
inputProps: PropTypes.object,
|
|
552
558
|
/** style inline of input in MoneyInput component */
|
|
553
559
|
inputStyle: PropTypes.object,
|
|
554
|
-
/** validation value, argument can:<br/>
|
|
555
|
-
* * string: the validation rule. Example required.<br/>
|
|
556
|
-
* * object: the validation rule insist name, property, message. Example {name: 'min', compareValue: 9, message: 'Error'} or {max: 99}<br/>
|
|
557
|
-
* * array: the validation rule list, insist object/string
|
|
560
|
+
/** validation value, argument can:<br/>
|
|
561
|
+
* * string: the validation rule. Example required.<br/>
|
|
562
|
+
* * object: the validation rule insist name, property, message. Example {name: 'min', compareValue: 9, message: 'Error'} or {max: 99}<br/>
|
|
563
|
+
* * array: the validation rule list, insist object/string
|
|
558
564
|
*/
|
|
559
565
|
validates: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.array, PropTypes.func]),
|
|
560
566
|
/** on key down function */
|
|
@@ -563,13 +569,13 @@ MoneyInput.propTypes = {
|
|
|
563
569
|
onKeyUp: PropTypes.func,
|
|
564
570
|
/** on input function */
|
|
565
571
|
onInput: PropTypes.func,
|
|
566
|
-
/**
|
|
567
|
-
* on change function, return an object:<br/>
|
|
568
|
-
* {<br/>
|
|
569
|
-
* value: is a number or null value<br/>
|
|
570
|
-
* target.value: value of input<br/>
|
|
571
|
-
* ...element<br/>
|
|
572
|
-
* }
|
|
572
|
+
/**
|
|
573
|
+
* on change function, return an object:<br/>
|
|
574
|
+
* {<br/>
|
|
575
|
+
* value: is a number or null value<br/>
|
|
576
|
+
* target.value: value of input<br/>
|
|
577
|
+
* ...element<br/>
|
|
578
|
+
* }
|
|
573
579
|
*/
|
|
574
580
|
onChange: PropTypes.func,
|
|
575
581
|
/** on blur function */
|
|
@@ -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({});
|
|
@@ -36,6 +36,7 @@ const Popup = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
36
36
|
type,
|
|
37
37
|
width,
|
|
38
38
|
yesText,
|
|
39
|
+
showFullContent,
|
|
39
40
|
...props
|
|
40
41
|
}, reference) => {
|
|
41
42
|
if (!reference) reference = useRef(null);
|
|
@@ -43,7 +44,7 @@ const Popup = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
43
44
|
const statusAction = useRef('');
|
|
44
45
|
const [openState, setOpenState] = useState(open);
|
|
45
46
|
const [custom, setCustom] = useState(null);
|
|
46
|
-
const [showMoreDescription, setShowMoreDescription] = useState(
|
|
47
|
+
const [showMoreDescription, setShowMoreDescription] = useState(!showFullContent);
|
|
47
48
|
const [descriptionLines, setDescriptionLines] = useState(0);
|
|
48
49
|
const showPopup = useDelayUnmount(openState, 200);
|
|
49
50
|
const theme = useTheme();
|
|
@@ -100,7 +101,7 @@ const Popup = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
100
101
|
const onRefChange = useCallback(node => {
|
|
101
102
|
if (node) {
|
|
102
103
|
setDescriptionLines(Math.round((node === null || node === void 0 ? void 0 : node.offsetHeight) / 18)); //18 is line-height of Typography p2
|
|
103
|
-
setShowMoreDescription(
|
|
104
|
+
setShowMoreDescription(!showFullContent);
|
|
104
105
|
}
|
|
105
106
|
}, []);
|
|
106
107
|
useEffect(() => {
|
|
@@ -175,7 +176,7 @@ const Popup = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
175
176
|
ref: onRefChange,
|
|
176
177
|
type: 'p2',
|
|
177
178
|
className: 'DGN-UI-Popup-Body-Detail'
|
|
178
|
-
}, description), subtitle && descriptionLines > 1 || descriptionLines > 3 ? jsx("span", {
|
|
179
|
+
}, description), (subtitle && descriptionLines > 1 || descriptionLines > 3) && showFullContent ? jsx("span", {
|
|
179
180
|
className: 'DGN-More-Action',
|
|
180
181
|
onClick: () => setShowMoreDescription(!showMoreDescription)
|
|
181
182
|
}, getGlobal(showMoreDescription ? 'showLess' : 'showMore')) : null)));
|
|
@@ -343,7 +344,8 @@ Popup.defaultProps = {
|
|
|
343
344
|
style: {},
|
|
344
345
|
top: 56,
|
|
345
346
|
type: 'info',
|
|
346
|
-
width: 480
|
|
347
|
+
width: 480,
|
|
348
|
+
showFullContent: true
|
|
347
349
|
};
|
|
348
350
|
Popup.propTypes = {
|
|
349
351
|
/** If `true`, the component is shown. */
|
|
@@ -379,20 +381,22 @@ Popup.propTypes = {
|
|
|
379
381
|
/** Width of the component. */
|
|
380
382
|
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
381
383
|
/** Label of confirm button. */
|
|
382
|
-
yesText: PropTypes.string
|
|
383
|
-
/**
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
*
|
|
387
|
-
*
|
|
388
|
-
* how to
|
|
389
|
-
*
|
|
390
|
-
*
|
|
391
|
-
*
|
|
392
|
-
*
|
|
393
|
-
* * @param {
|
|
394
|
-
* *
|
|
395
|
-
*
|
|
384
|
+
yesText: PropTypes.string,
|
|
385
|
+
/** If `true`, show full content in popup */
|
|
386
|
+
showFullContent: PropTypes.bool
|
|
387
|
+
/**
|
|
388
|
+
* ref methods
|
|
389
|
+
*
|
|
390
|
+
* how to get component element? ref.current
|
|
391
|
+
*
|
|
392
|
+
* how to call method? ref.current.instance.{method}
|
|
393
|
+
*
|
|
394
|
+
* * show(options, callback): Show popup
|
|
395
|
+
* * @param {options} - object
|
|
396
|
+
* * {type, title, icon, yesNo, description, confirmProps, cancelProps, onCancel, onConfirm}
|
|
397
|
+
* * @param {callback} - func
|
|
398
|
+
* * Callback fired after click on button (callback(true) with confirm Button and callback(false) with cancel Button). Alternate both onCancel, onConfirm methods of options
|
|
399
|
+
* * close(): Close popup
|
|
396
400
|
*/
|
|
397
401
|
};
|
|
398
402
|
export default Popup;
|
package/global/index.js
CHANGED
|
@@ -245,7 +245,8 @@ const globalObject = {
|
|
|
245
245
|
dropdownPlaceholder: '请选择'
|
|
246
246
|
},
|
|
247
247
|
//Global variable
|
|
248
|
-
delayOnInput:
|
|
248
|
+
delayOnInput: 500,
|
|
249
|
+
delayOnSearchInput: 1200,
|
|
249
250
|
maxSizeUpload: Infinity
|
|
250
251
|
};
|
|
251
252
|
export const getGlobal = (key, language = locale.get()) => {
|
package/icons/basic.js
CHANGED
|
@@ -4679,6 +4679,34 @@ export const OneSquare = /*#__PURE__*/memo(({
|
|
|
4679
4679
|
fill: fillColor(color)
|
|
4680
4680
|
}));
|
|
4681
4681
|
});
|
|
4682
|
+
export const OpenNew = /*#__PURE__*/memo(({
|
|
4683
|
+
width,
|
|
4684
|
+
height,
|
|
4685
|
+
color = 'system/rest',
|
|
4686
|
+
viewBox = false
|
|
4687
|
+
}) => {
|
|
4688
|
+
return viewBox ? /*#__PURE__*/React.createElement("svg", {
|
|
4689
|
+
width: width || 24,
|
|
4690
|
+
height: height || 24,
|
|
4691
|
+
viewBox: "0 0 24 24",
|
|
4692
|
+
fill: "none"
|
|
4693
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
4694
|
+
fillRule: "evenodd",
|
|
4695
|
+
clipRule: "evenodd",
|
|
4696
|
+
d: "M12 3V5H5V19H19V12H21V19C21 20.1 20.1 21 19 21H5C3.89 21 3 20.1 3 19V5C3 3.9 3.89 3 5 3H12ZM21 3V10H19V6.41016L9.16992 16.2402L7.75977 14.8301L17.5898 5H14V3H21Z",
|
|
4697
|
+
fill: fillColor(color)
|
|
4698
|
+
})) : /*#__PURE__*/React.createElement("svg", {
|
|
4699
|
+
width: width || 18,
|
|
4700
|
+
height: height || 18,
|
|
4701
|
+
viewBox: "0 0 18 18",
|
|
4702
|
+
fill: "none"
|
|
4703
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
4704
|
+
fillRule: "evenodd",
|
|
4705
|
+
clipRule: "evenodd",
|
|
4706
|
+
d: "M9 0V2H2V16H16V9H18V16C18 17.1 17.1 18 16 18H2C0.89 18 0 17.1 0 16V2C0 0.9 0.89 0 2 0H9ZM18 0V7H16V3.41016L6.16992 13.2402L4.75977 11.8301L14.5898 2H11V0H18Z",
|
|
4707
|
+
fill: fillColor(color)
|
|
4708
|
+
}));
|
|
4709
|
+
});
|
|
4682
4710
|
export const Undo = /*#__PURE__*/memo(({
|
|
4683
4711
|
width,
|
|
4684
4712
|
height,
|
|
@@ -7284,6 +7312,44 @@ export const Inheritance = /*#__PURE__*/memo(({
|
|
|
7284
7312
|
fill: fillColor(color)
|
|
7285
7313
|
}));
|
|
7286
7314
|
});
|
|
7315
|
+
export const Import = /*#__PURE__*/memo(({
|
|
7316
|
+
width,
|
|
7317
|
+
height,
|
|
7318
|
+
color = 'system/rest',
|
|
7319
|
+
viewBox = false
|
|
7320
|
+
}) => {
|
|
7321
|
+
return viewBox ? /*#__PURE__*/React.createElement("svg", {
|
|
7322
|
+
width: width || 24,
|
|
7323
|
+
height: height || 24,
|
|
7324
|
+
viewBox: "0 0 24 24",
|
|
7325
|
+
fill: "none"
|
|
7326
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
7327
|
+
fillRule: "evenodd",
|
|
7328
|
+
clipRule: "evenodd",
|
|
7329
|
+
d: "M13 8.62059L8.28283 3.2307V6.41849L7.94949 6.39752L7.47475 6.36606C6.12121 6.28217 4.9697 5.97807 3.94949 5.43279C2.89899 4.87703 2 4.08008 1.23232 3L1 3.09438C1.41414 5.03432 2.24242 7.18398 3.85859 8.75691C4.81818 9.70067 6.07071 10.4452 7.68687 10.8122L7.86869 10.8541L8.28283 10.9485V14L13 8.62059Z",
|
|
7330
|
+
fill: fillColor(color)
|
|
7331
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
7332
|
+
fillRule: "evenodd",
|
|
7333
|
+
clipRule: "evenodd",
|
|
7334
|
+
d: "M5 11.4316V19C5 20.1046 5.89543 21 7 21H19C20.1046 21 21 20.1046 21 19V7C21 5.89543 20.1046 5 19 5H11.9165L13.6738 7H19V19H7V12.2796C6.54269 12.2796 5 11.5 5 11.4316Z",
|
|
7335
|
+
fill: fillColor(color)
|
|
7336
|
+
})) : /*#__PURE__*/React.createElement("svg", {
|
|
7337
|
+
width: width || 20,
|
|
7338
|
+
height: height || 18,
|
|
7339
|
+
viewBox: "0 0 20 18",
|
|
7340
|
+
fill: "none"
|
|
7341
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
7342
|
+
fillRule: "evenodd",
|
|
7343
|
+
clipRule: "evenodd",
|
|
7344
|
+
d: "M12 5.62059L7.28283 0.230696V3.41849L6.94949 3.39752L6.47475 3.36606C5.12121 3.28217 3.9697 2.97807 2.94949 2.43279C1.89899 1.87703 1 1.08008 0.232323 0L0 0.0943766C0.414141 2.03432 1.24242 4.18398 2.85859 5.75691C3.81818 6.70067 5.07071 7.44519 6.68687 7.8122L6.86869 7.85415L7.28283 7.94852V11L12 5.62059Z",
|
|
7345
|
+
fill: fillColor(color)
|
|
7346
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
7347
|
+
fillRule: "evenodd",
|
|
7348
|
+
clipRule: "evenodd",
|
|
7349
|
+
d: "M4 8.43156V16C4 17.1046 4.89543 18 6 18H18C19.1046 18 20 17.1046 20 16V4C20 2.89543 19.1046 2 18 2H10.9165L12.6738 4H18V16H6V9.27963C5.54269 9.27963 4 8.5 4 8.43156Z",
|
|
7350
|
+
fill: fillColor(color)
|
|
7351
|
+
}));
|
|
7352
|
+
});
|
|
7287
7353
|
export const Warning = /*#__PURE__*/memo(({
|
|
7288
7354
|
width,
|
|
7289
7355
|
height,
|
package/icons/menu/v2/index.js
CHANGED
|
@@ -61,8 +61,8 @@ IconMenu.propTypes = {
|
|
|
61
61
|
height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
62
62
|
/** Name of icon. */
|
|
63
63
|
name: PropTypes.string,
|
|
64
|
-
/** Menu type (DHR || ERP || BEM). */
|
|
65
|
-
type: PropTypes.oneOf(['dhr', 'erp', 'bem', 'eo']),
|
|
64
|
+
/** Menu type (DHR || ERP || BEM || INVOICE). */
|
|
65
|
+
type: PropTypes.oneOf(['dhr', 'erp', 'bem', 'eo', 'invoice']),
|
|
66
66
|
/** Width of icon. */
|
|
67
67
|
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
68
68
|
/** Style inline of component. */
|