@modul/mbui 0.0.1-beta-pv-50560-03649539 → 0.0.1-beta-pv-50560-3e5e7e6f
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/package.json
CHANGED
|
@@ -14,13 +14,16 @@ accounting.settings = {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
interface IAmountInput extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
17
|
-
value
|
|
17
|
+
value?: string | number
|
|
18
18
|
precision?: number
|
|
19
|
-
onChange
|
|
19
|
+
onChange?: CombinedChangeEventHandler
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
const AmountInput = forwardRef<HTMLInputElement, IAmountInput>(
|
|
23
|
-
(
|
|
23
|
+
(
|
|
24
|
+
{ onChange, precision = 2, value, type = 'text', ...props }: IAmountInput,
|
|
25
|
+
ref: ForwardedRef<HTMLInputElement>
|
|
26
|
+
) => {
|
|
24
27
|
const innerRef = useForwardedRef(ref)
|
|
25
28
|
//Состояния для отслеживания текущего значения и позиции курсора
|
|
26
29
|
const [viewValue, setViewValue] = useState<string>('')
|
|
@@ -110,11 +113,12 @@ const AmountInput = forwardRef<HTMLInputElement, IAmountInput>(
|
|
|
110
113
|
|
|
111
114
|
return (
|
|
112
115
|
<input
|
|
113
|
-
{
|
|
116
|
+
type={type}
|
|
114
117
|
ref={innerRef}
|
|
115
118
|
value={viewValue}
|
|
116
119
|
onKeyDown={handleKeyDown}
|
|
117
120
|
onChange={handleChange}
|
|
121
|
+
{...props}
|
|
118
122
|
/>
|
|
119
123
|
)
|
|
120
124
|
}
|
|
@@ -7,7 +7,9 @@ interface CurrencySymbolProps {
|
|
|
7
7
|
|
|
8
8
|
const CurrencySymbol: React.FC<CurrencySymbolProps> = ({ value }) => {
|
|
9
9
|
const symbol = currencySymbols[value] || value
|
|
10
|
-
|
|
10
|
+
const currencyClass = currencySymbols[value] ? 'currency-iso' : ''
|
|
11
|
+
|
|
12
|
+
return <span className={currencyClass}>{symbol}</span>
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
export default CurrencySymbol
|