intelicoreact 0.0.82 → 0.0.86
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/dist/Atomic/FormElements/Input/Input.js +12 -8
- package/dist/Atomic/FormElements/Input/Input.stories.js +4 -0
- package/dist/Atomic/FormElements/InputCalendar/InputCalendar.js +34 -32
- package/dist/Atomic/FormElements/InputCalendar/InputCalendar.stories.js +29 -19
- package/dist/Atomic/FormElements/NumericInput/NumericInput.js +124 -87
- package/dist/Atomic/FormElements/NumericInput/NumericInput.stories.js +6 -10
- package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.scss +4 -4
- package/dist/Atomic/UI/Calendar/Calendar.js +6 -4
- package/dist/Atomic/UI/Calendar/Calendar.scss +19 -3
- package/dist/Functions/inputExecutor.js +1 -1
- package/package.json +2 -2
- package/src/Atomic/FormElements/Input/Input.js +13 -9
- package/src/Atomic/FormElements/Input/Input.stories.js +4 -0
- package/src/Atomic/FormElements/InputCalendar/InputCalendar.js +19 -17
- package/src/Atomic/FormElements/InputCalendar/InputCalendar.stories.js +17 -14
- package/src/Atomic/FormElements/NumericInput/NumericInput.js +106 -64
- package/src/Atomic/FormElements/NumericInput/NumericInput.stories.js +6 -22
- package/src/Atomic/FormElements/RangeCalendar/RangeCalendar.scss +4 -4
- package/src/Atomic/UI/Calendar/Calendar.js +3 -3
- package/src/Atomic/UI/Calendar/Calendar.scss +19 -3
- package/src/Functions/inputExecutor.js +6 -15
|
@@ -4,38 +4,29 @@ export const formatInput = {
|
|
|
4
4
|
value = value.toString();
|
|
5
5
|
const isFraction = value.includes('.');
|
|
6
6
|
|
|
7
|
-
const valueBeforeDot = isFraction
|
|
8
|
-
? value.slice(0, value.indexOf('.'))
|
|
9
|
-
: value;
|
|
7
|
+
const valueBeforeDot = isFraction ? value.slice(0, value.indexOf('.')) : value;
|
|
10
8
|
|
|
11
9
|
const intPart = valueBeforeDot
|
|
12
10
|
.split('')
|
|
13
11
|
.reverse()
|
|
14
|
-
.reduce(
|
|
15
|
-
(acc, item, idx) =>
|
|
16
|
-
idx % 3 === 0 && idx !== 0 ? [...acc, ',', item] : [...acc, item],
|
|
17
|
-
[]
|
|
18
|
-
)
|
|
12
|
+
.reduce((acc, item, idx) => (idx % 3 === 0 && idx !== 0 ? [...acc, ',', item] : [...acc, item]), [])
|
|
19
13
|
.reverse()
|
|
20
14
|
.join('');
|
|
21
15
|
|
|
22
16
|
return isFraction ? intPart + value.slice(value.indexOf('.')) : intPart;
|
|
23
17
|
},
|
|
24
18
|
removeComma: (value) => {
|
|
25
|
-
return
|
|
26
|
-
}
|
|
19
|
+
return parseInt(value.toString().replace(/\,/g, ''));
|
|
20
|
+
},
|
|
27
21
|
},
|
|
28
22
|
onlyNumbers: (value, isDot = false) => {
|
|
29
|
-
const val =
|
|
30
|
-
value.slice(0, 1) !== '0' && value.slice(0, 1) !== '.'
|
|
31
|
-
? value
|
|
32
|
-
: value.slice(1);
|
|
23
|
+
const val = value.slice(0, 1) !== '0' && value.slice(0, 1) !== '.' ? value : value.slice(1);
|
|
33
24
|
if (isDot) return twoDigitAfterDot(val.replace(/[^0-9.]/g, ''));
|
|
34
25
|
else return +val.toString().replace(/\D/g, '');
|
|
35
26
|
},
|
|
36
27
|
onlyString: (value) => {
|
|
37
28
|
return value.toString().replace(/[^a-z]/gi, '');
|
|
38
|
-
}
|
|
29
|
+
},
|
|
39
30
|
};
|
|
40
31
|
|
|
41
32
|
//обрезает числа после точки до 2х
|