@momo-kits/foundation 0.168.1-beta.5 → 0.168.1-beta.6
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/Input/InputMoney.tsx +2 -3
- package/package.json +1 -1
package/Input/InputMoney.tsx
CHANGED
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
} from './common';
|
|
33
33
|
import { InputMoneyProps } from './index';
|
|
34
34
|
import styles from './styles';
|
|
35
|
+
import { formatNumberToMoney } from './utils';
|
|
35
36
|
import SystemTextInput from './SystemTextInput';
|
|
36
37
|
|
|
37
38
|
// Finds the common prefix and suffix of `old` and `text`; `size` counts the
|
|
@@ -137,9 +138,7 @@ const InputMoney = forwardRef(
|
|
|
137
138
|
}, [caretSelection]);
|
|
138
139
|
|
|
139
140
|
const updateDisplayValue = (numeric: string) => {
|
|
140
|
-
|
|
141
|
-
// digits and switches to "1e+21" notation past 20.
|
|
142
|
-
const formatted = numeric.replace(/\B(?=(\d{3})+(?!\d))/g, '.');
|
|
141
|
+
const formatted = numeric ? formatNumberToMoney(Number(numeric)) : '';
|
|
143
142
|
const next = formatted ? `${formatted}${currency}` : '';
|
|
144
143
|
setDisplayValue(next);
|
|
145
144
|
|