mediacube-ui 0.1.129 → 0.1.130
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/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.1.130](https://github.com/MediaCubeCo/mcui/compare/v0.1.129...v0.1.130) (2023-09-04)
|
|
6
|
+
|
|
5
7
|
### [0.1.129](https://github.com/MediaCubeCo/mcui/compare/v0.1.128...v0.1.129) (2023-08-31)
|
|
6
8
|
|
|
7
9
|
### [0.1.128](https://github.com/MediaCubeCo/mcui/compare/v0.1.127...v0.1.128) (2023-08-30)
|
package/package.json
CHANGED
|
@@ -532,22 +532,34 @@ export default {
|
|
|
532
532
|
}
|
|
533
533
|
return val
|
|
534
534
|
},
|
|
535
|
+
/**
|
|
536
|
+
* Remove leading zero from input if length > 1 && number isn't decimal
|
|
537
|
+
* */
|
|
538
|
+
removeLeadingZero(val) {
|
|
539
|
+
let result = val
|
|
540
|
+
const [first_char] = val || []
|
|
541
|
+
if (val.length > 1 && +first_char === 0 && val.indexOf('.') === -1) result = val.slice(1)
|
|
542
|
+
return result
|
|
543
|
+
},
|
|
535
544
|
prepareHandleInput(e) {
|
|
536
545
|
let value = e.target.value
|
|
537
546
|
switch (this.type) {
|
|
538
547
|
case 'num':
|
|
539
548
|
let [num] = /-?\d*[\.]?\d*/.exec(String(value)) || []
|
|
540
549
|
num = this.setDecimalsLimit(num)
|
|
550
|
+
num = this.removeLeadingZero(num)
|
|
541
551
|
value = num
|
|
542
552
|
e.target.value = num
|
|
543
553
|
break
|
|
544
554
|
case 'int':
|
|
545
|
-
|
|
555
|
+
let [int] = /-?\d*/.exec(String(e.target.value)) || []
|
|
556
|
+
int = this.removeLeadingZero(int)
|
|
546
557
|
value = int
|
|
547
558
|
e.target.value = int
|
|
548
559
|
break
|
|
549
560
|
case 'amount_format':
|
|
550
561
|
value = this.setDecimalsLimit(value)
|
|
562
|
+
value = this.removeLeadingZero(value)
|
|
551
563
|
const cursor_position = this.getCaretPos(e.target)?.start
|
|
552
564
|
const prepared_value = this.formattedToNumber(value)
|
|
553
565
|
|