diginet-core-ui 1.4.53-beta.5 → 1.4.53-beta.7
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/index.js +1 -1
- 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-input/useDateInputState.js +3 -5
- package/components/form-control/date-picker/index.js +28 -8
- package/components/form-control/date-range-picker/index.js +7 -7
- package/components/form-control/dropdown/index.js +44 -44
- package/components/form-control/dropdown-box/index.js +1 -1
- 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 +61 -3
- 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 +6 -6
- package/components/typography/index.js +1 -1
- package/icons/effect.js +1 -1
- package/icons/menu/v2/index.js +1 -1
- package/locale/index.js +1 -1
- package/package.json +1 -1
- package/theme/settings.js +4 -3
- package/utils/getLang.js +69 -0
- package/utils/index.js +1 -0
|
@@ -65,7 +65,7 @@ const isAfter = (max, time) => {
|
|
|
65
65
|
const parseDate = day => {
|
|
66
66
|
return Date.parse(new Date(day));
|
|
67
67
|
};
|
|
68
|
-
const DateRangePicker = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
68
|
+
const DateRangePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
69
69
|
// props priority: `inProps` > `themeDefaultProps`
|
|
70
70
|
const props = useThemeProps({
|
|
71
71
|
props: inProps,
|
|
@@ -262,8 +262,8 @@ const DateRangePicker = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, refe
|
|
|
262
262
|
tableData = [],
|
|
263
263
|
weekDateFirst = getDateOfWeek(firstDay),
|
|
264
264
|
weekDateLast = getDateOfWeek(lastDay);
|
|
265
|
-
/**
|
|
266
|
-
* days of previous month
|
|
265
|
+
/**
|
|
266
|
+
* days of previous month
|
|
267
267
|
*/
|
|
268
268
|
for (let i = weekDateFirst; i > 0; i--) {
|
|
269
269
|
const day = Date.parse(new Date(time.getFullYear(), time.getMonth(), 1));
|
|
@@ -275,8 +275,8 @@ const DateRangePicker = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, refe
|
|
|
275
275
|
className: unique.day.day
|
|
276
276
|
})));
|
|
277
277
|
}
|
|
278
|
-
/**
|
|
279
|
-
* days of current month
|
|
278
|
+
/**
|
|
279
|
+
* days of current month
|
|
280
280
|
*/
|
|
281
281
|
for (let i = 0; i < lastDate; i++) {
|
|
282
282
|
const day = new Date(time.getFullYear(), time.getMonth(), i + 1);
|
|
@@ -302,8 +302,8 @@ const DateRangePicker = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, refe
|
|
|
302
302
|
type: 'h6'
|
|
303
303
|
}, i + 1)));
|
|
304
304
|
}
|
|
305
|
-
/**
|
|
306
|
-
* days of next month
|
|
305
|
+
/**
|
|
306
|
+
* days of next month
|
|
307
307
|
*/
|
|
308
308
|
for (let i = 0; i < 13 - weekDateLast; i++) {
|
|
309
309
|
const day = Date.parse(new Date(time.getFullYear(), time.getMonth() + 1, 0));
|
|
@@ -47,7 +47,7 @@ const uniqBy = (arr, iteratee) => {
|
|
|
47
47
|
return true;
|
|
48
48
|
});
|
|
49
49
|
};
|
|
50
|
-
const Dropdown = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
50
|
+
const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
51
51
|
if (!reference) reference = useRef(null);
|
|
52
52
|
const theme = useTheme();
|
|
53
53
|
const {
|
|
@@ -288,10 +288,10 @@ const Dropdown = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference)
|
|
|
288
288
|
});
|
|
289
289
|
};
|
|
290
290
|
|
|
291
|
-
/**
|
|
292
|
-
* So sánh text đầu vào cáo map với txtSearch
|
|
293
|
-
* @param text
|
|
294
|
-
* @return {boolean}
|
|
291
|
+
/**
|
|
292
|
+
* So sánh text đầu vào cáo map với txtSearch
|
|
293
|
+
* @param text
|
|
294
|
+
* @return {boolean}
|
|
295
295
|
*/
|
|
296
296
|
const handleRenderBySearch = (text = '') => {
|
|
297
297
|
if (typeof text !== 'string') text = text.toString();
|
|
@@ -303,10 +303,10 @@ const Dropdown = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference)
|
|
|
303
303
|
} else return text.toLowerCase().includes(txtSearch.toLowerCase());
|
|
304
304
|
};
|
|
305
305
|
|
|
306
|
-
/**
|
|
307
|
-
* 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
|
|
308
|
-
* @param data {object} rowData of dataSource
|
|
309
|
-
* @return {string}
|
|
306
|
+
/**
|
|
307
|
+
* 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
|
|
308
|
+
* @param data {object} rowData of dataSource
|
|
309
|
+
* @return {string}
|
|
310
310
|
*/
|
|
311
311
|
const displayValue = data => {
|
|
312
312
|
let text = '';
|
|
@@ -1721,9 +1721,9 @@ Dropdown.propTypes = {
|
|
|
1721
1721
|
defaultValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.array]),
|
|
1722
1722
|
/** If `true`, the component is disabled. */
|
|
1723
1723
|
disabled: PropTypes.bool,
|
|
1724
|
-
/** The field name used for displaying text in the dropdown list.<br/>
|
|
1725
|
-
* Examples: 'name', '{id} - {name}', '{age} age(s)'<br/>
|
|
1726
|
-
* Note: Do not use 'id - name', as it will return undefined.
|
|
1724
|
+
/** The field name used for displaying text in the dropdown list.<br/>
|
|
1725
|
+
* Examples: 'name', '{id} - {name}', '{age} age(s)'<br/>
|
|
1726
|
+
* Note: Do not use 'id - name', as it will return undefined.
|
|
1727
1727
|
*/
|
|
1728
1728
|
displayExpr: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.array]),
|
|
1729
1729
|
/** Inline style for dropdown items. */
|
|
@@ -1732,14 +1732,14 @@ Dropdown.propTypes = {
|
|
|
1732
1732
|
error: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
1733
1733
|
/** Props applied to the [HelperText](https://core.diginet.com.vn/ui/?path=/story/form-control-text-helpertext) element. */
|
|
1734
1734
|
helperTextProps: PropTypes.object,
|
|
1735
|
-
/** The field name used for displaying icons.<br/>
|
|
1736
|
-
* Example:<br/>
|
|
1737
|
-
* string: 'icon'<br/>
|
|
1738
|
-
* object: {<br/>
|
|
1739
|
-
* key: 'icon',<br/>
|
|
1740
|
-
* prefix: 'https://imglink.com',<br/>
|
|
1741
|
-
* suffix: '.jpg'<br/>
|
|
1742
|
-
* }
|
|
1735
|
+
/** The field name used for displaying icons.<br/>
|
|
1736
|
+
* Example:<br/>
|
|
1737
|
+
* string: 'icon'<br/>
|
|
1738
|
+
* object: {<br/>
|
|
1739
|
+
* key: 'icon',<br/>
|
|
1740
|
+
* prefix: 'https://imglink.com',<br/>
|
|
1741
|
+
* suffix: '.jpg'<br/>
|
|
1742
|
+
* }
|
|
1743
1743
|
*/
|
|
1744
1744
|
iconExpr: PropTypes.oneOfType([PropTypes.string, PropTypes.shape({
|
|
1745
1745
|
key: PropTypes.string,
|
|
@@ -1773,8 +1773,8 @@ Dropdown.propTypes = {
|
|
|
1773
1773
|
onChange: PropTypes.func,
|
|
1774
1774
|
/** Callback function fired when the dropdown is closed. */
|
|
1775
1775
|
onClosed: PropTypes.func,
|
|
1776
|
-
/** Callback function fired when the input value changes.<br/>
|
|
1777
|
-
* If undefined, the filter function will run (default behavior).
|
|
1776
|
+
/** Callback function fired when the input value changes.<br/>
|
|
1777
|
+
* If undefined, the filter function will run (default behavior).
|
|
1778
1778
|
*/
|
|
1779
1779
|
onInput: PropTypes.func,
|
|
1780
1780
|
/** Callback function fired when a key is pressed down in the input. */
|
|
@@ -1787,21 +1787,21 @@ Dropdown.propTypes = {
|
|
|
1787
1787
|
placeholder: PropTypes.string,
|
|
1788
1788
|
/** If `true`, the component is read-only. */
|
|
1789
1789
|
readOnly: PropTypes.bool,
|
|
1790
|
-
/** Function used for custom rendering of items.<br/>
|
|
1791
|
-
* Example: `(data, index) => data.name + ' - ' + data.role`<br/>
|
|
1792
|
-
* This can be used as an alternative to `displayExpr`
|
|
1790
|
+
/** Function used for custom rendering of items.<br/>
|
|
1791
|
+
* Example: `(data, index) => data.name + ' - ' + data.role`<br/>
|
|
1792
|
+
* This can be used as an alternative to `displayExpr`
|
|
1793
1793
|
*/
|
|
1794
1794
|
renderItem: PropTypes.func,
|
|
1795
|
-
/** Function or field name used to display selected items.<br/>
|
|
1796
|
-
* Example: `(data, index) => index + ' - ' + data.name`<br/>
|
|
1795
|
+
/** Function or field name used to display selected items.<br/>
|
|
1796
|
+
* Example: `(data, index) => index + ' - ' + data.name`<br/>
|
|
1797
1797
|
*/
|
|
1798
1798
|
renderSelectedItem: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
|
1799
1799
|
/** If `true`, the label will indicate that the input is required. */
|
|
1800
1800
|
required: PropTypes.bool,
|
|
1801
|
-
/**
|
|
1802
|
-
* Duration to wait after entering search content before triggering a search.<br/>
|
|
1803
|
-
* Example: 700 -> 700ms, '700ms' -> 700ms, '0.7s' -> 700ms, '1m' -> 60000ms
|
|
1804
|
-
* If `true`, the default delayOnInput will be used.
|
|
1801
|
+
/**
|
|
1802
|
+
* Duration to wait after entering search content before triggering a search.<br/>
|
|
1803
|
+
* Example: 700 -> 700ms, '700ms' -> 700ms, '0.7s' -> 700ms, '1m' -> 60000ms
|
|
1804
|
+
* If `true`, the default delayOnInput will be used.
|
|
1805
1805
|
*/
|
|
1806
1806
|
searchDelayTime: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.bool]),
|
|
1807
1807
|
/** Specifies the field name or expression used to compare values with the search string. */
|
|
@@ -1828,19 +1828,19 @@ Dropdown.propTypes = {
|
|
|
1828
1828
|
valueObjectDefault: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
|
|
1829
1829
|
/** The variant to use. */
|
|
1830
1830
|
viewType: PropTypes.oneOf(['underlined', 'outlined', 'none'])
|
|
1831
|
-
/**
|
|
1832
|
-
* ref methods
|
|
1833
|
-
*
|
|
1834
|
-
* how to get component element? ref.current
|
|
1835
|
-
*
|
|
1836
|
-
* how to call method? ref.current.instance.{method}
|
|
1837
|
-
*
|
|
1838
|
-
* * showDropdown(): Show dropdown
|
|
1839
|
-
* * closeDropdown(): Close dropdown
|
|
1840
|
-
* * onClear(): Clear selected value
|
|
1841
|
-
* * setPreviousValue(): Set value to previous value
|
|
1842
|
-
* * setValue(value): Set value of dropdown
|
|
1843
|
-
* * @param {value} - string || number || array
|
|
1831
|
+
/**
|
|
1832
|
+
* ref methods
|
|
1833
|
+
*
|
|
1834
|
+
* how to get component element? ref.current
|
|
1835
|
+
*
|
|
1836
|
+
* how to call method? ref.current.instance.{method}
|
|
1837
|
+
*
|
|
1838
|
+
* * showDropdown(): Show dropdown
|
|
1839
|
+
* * closeDropdown(): Close dropdown
|
|
1840
|
+
* * onClear(): Clear selected value
|
|
1841
|
+
* * setPreviousValue(): Set value to previous value
|
|
1842
|
+
* * setValue(value): Set value of dropdown
|
|
1843
|
+
* * @param {value} - string || number || array
|
|
1844
1844
|
*/
|
|
1845
1845
|
};
|
|
1846
1846
|
export default Dropdown;
|
|
@@ -10,7 +10,7 @@ import useThemeProps from "../../../theme/utils/useThemeProps";
|
|
|
10
10
|
import { classNames, getProp } from "../../../utils";
|
|
11
11
|
const regexBetween = /[^{}]+(?=})/g;
|
|
12
12
|
const regexInclude = /{|}/g;
|
|
13
|
-
const DropdownBox = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
13
|
+
const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
14
14
|
if (!reference) reference = useRef(null);
|
|
15
15
|
const theme = useTheme();
|
|
16
16
|
const {
|
|
@@ -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(/*#__PURE__*/forwardRef(({
|
|
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(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
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(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
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(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
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(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
12
|
+
const Label = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
13
13
|
if (!reference) reference = useRef(null);
|
|
14
14
|
const theme = useTheme();
|
|
15
15
|
const {
|
|
@@ -10,6 +10,7 @@ import { forwardRef, memo, useEffect, useImperativeHandle, useRef } from 'react'
|
|
|
10
10
|
import { displayBlock, positionRelative } from "../../../styles/general";
|
|
11
11
|
import useThemeProps from "../../../theme/utils/useThemeProps";
|
|
12
12
|
import { onValidate } from "../../../utils";
|
|
13
|
+
import { getThousandSeparatorByCountry } from "../../../utils/getLang";
|
|
13
14
|
const num2WordsVi = function () {
|
|
14
15
|
let t = ['không', 'một', 'hai', 'ba', 'bốn', 'năm', 'sáu', 'bảy', 'tám', 'chín'],
|
|
15
16
|
r = function (r, n) {
|
|
@@ -72,7 +73,62 @@ const num2WordsEn = n => {
|
|
|
72
73
|
if (n === '0') return 'zero';
|
|
73
74
|
return comp(chunk(3))(reverse)(arr(n)).map(makeGroup).map(thousand).filter(comp(not)(isEmpty)).reverse().join(' ');
|
|
74
75
|
};
|
|
75
|
-
const
|
|
76
|
+
const num2WordsZh = (() => {
|
|
77
|
+
const t = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九'];
|
|
78
|
+
const units = ['', '十', '百', '千'];
|
|
79
|
+
const bigUnits = ['', '万', '亿', '兆'];
|
|
80
|
+
const readSection = num => {
|
|
81
|
+
let str = '';
|
|
82
|
+
let zero = true;
|
|
83
|
+
for (let i = 0; i < 4 && num > 0; i++) {
|
|
84
|
+
const digit = num % 10;
|
|
85
|
+
if (digit === 0) {
|
|
86
|
+
if (!zero) {
|
|
87
|
+
zero = true;
|
|
88
|
+
str = t[0] + str;
|
|
89
|
+
}
|
|
90
|
+
} else {
|
|
91
|
+
zero = false;
|
|
92
|
+
str = t[digit] + units[i] + str;
|
|
93
|
+
}
|
|
94
|
+
num = Math.floor(num / 10);
|
|
95
|
+
}
|
|
96
|
+
return str;
|
|
97
|
+
};
|
|
98
|
+
return {
|
|
99
|
+
convert: num => {
|
|
100
|
+
if (num === 0) return t[0];
|
|
101
|
+
let str = '';
|
|
102
|
+
let unitPos = 0;
|
|
103
|
+
let needZero = false;
|
|
104
|
+
while (num > 0) {
|
|
105
|
+
const section = num % 10000;
|
|
106
|
+
if (section === 0) {
|
|
107
|
+
if (needZero) {
|
|
108
|
+
str = t[0] + str;
|
|
109
|
+
needZero = false;
|
|
110
|
+
}
|
|
111
|
+
} else {
|
|
112
|
+
const sectionStr = readSection(section) + bigUnits[unitPos];
|
|
113
|
+
str = sectionStr + str;
|
|
114
|
+
needZero = true;
|
|
115
|
+
}
|
|
116
|
+
num = Math.floor(num / 10000);
|
|
117
|
+
unitPos++;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Special cases
|
|
121
|
+
str = str.replace(/^一十/, '十'); // "一十X" => "十X"
|
|
122
|
+
return str;
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
})();
|
|
126
|
+
const converters = {
|
|
127
|
+
vi: num2WordsVi,
|
|
128
|
+
en: num2WordsEn,
|
|
129
|
+
zh: num2WordsZh
|
|
130
|
+
};
|
|
131
|
+
const MoneyInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
76
132
|
if (!reference) reference = useRef(null);
|
|
77
133
|
|
|
78
134
|
// props priority: `inProps` > `themeDefaultProps`
|
|
@@ -126,7 +182,7 @@ const MoneyInput = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference
|
|
|
126
182
|
isPaste: false,
|
|
127
183
|
clipboardText: ''
|
|
128
184
|
});
|
|
129
|
-
const separatorSymbol = typeof thousandSeparator === 'string' ? thousandSeparator : locale.get()
|
|
185
|
+
const separatorSymbol = typeof thousandSeparator === 'string' ? thousandSeparator : getThousandSeparatorByCountry(locale.get());
|
|
130
186
|
const decimalSymbol = separatorSymbol === '.' ? ',' : '.';
|
|
131
187
|
const thousandSeparatorPattern = new RegExp(`[0-9]|Backspace|Delete|Arrow|Home|End|Tab${decimalDigit === 0 ? '' : '|\\' + decimalSymbol}${disabledNegative ? '' : '|-'}`);
|
|
132
188
|
const isError = !!error && !value && value !== 0;
|
|
@@ -350,7 +406,9 @@ const MoneyInput = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference
|
|
|
350
406
|
if (convertToWords && !decimalDigit && (disabled || readOnly)) {
|
|
351
407
|
let valueConverted = getGlobal('helperInvalid');
|
|
352
408
|
if (Number.isInteger(number)) {
|
|
353
|
-
|
|
409
|
+
const currentLocale = locale.get();
|
|
410
|
+
const converter = converters[currentLocale] || num2WordsVi; // fallback VN
|
|
411
|
+
valueConverted = converter.convert(number);
|
|
354
412
|
}
|
|
355
413
|
inputRef.current.value = parseValueWithFix(valueConverted);
|
|
356
414
|
} else {
|
|
@@ -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(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
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(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
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(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
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(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
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(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
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(/*#__PURE__*/forwardRef(({
|
|
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(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
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(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
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(/*#__PURE__*/forwardRef(({
|
|
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(/*#__PURE__*/forwardRef(({
|
|
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(/*#__PURE__*/forwardRef(({
|
|
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(/*#__PURE__*/forwardRef(({
|
|
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(/*#__PURE__*/forwardRef(({
|
|
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(/*#__PURE__*/forwardRef(({
|
|
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(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
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(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
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(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
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(/*#__PURE__*/forwardRef(({
|
|
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(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
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(/*#__PURE__*/forwardRef((props, ref) => {
|
|
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') {
|