@eturnity/eturnity_reusable_components 1.2.51 → 1.2.53
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
@@ -371,6 +371,10 @@ export default {
|
|
371
371
|
required: false,
|
372
372
|
default: 'left'
|
373
373
|
},
|
374
|
+
defaultNumber:{
|
375
|
+
required:false,
|
376
|
+
default:null
|
377
|
+
},
|
374
378
|
minNumber: {
|
375
379
|
required: false,
|
376
380
|
default: null
|
@@ -402,6 +406,7 @@ export default {
|
|
402
406
|
computed: {
|
403
407
|
displayedPlaceholder() {
|
404
408
|
if (this.placeholder) return this.placeholder
|
409
|
+
if (this.defaultNumber) return `${this.defaultNumber} ${this.unitName ? this.unitName : ''}`
|
405
410
|
return `${this.minNumber || 0} ${this.unitName ? this.unitName : ''}`
|
406
411
|
},
|
407
412
|
hasSlot() {
|
@@ -413,8 +418,13 @@ export default {
|
|
413
418
|
},
|
414
419
|
methods: {
|
415
420
|
onChangeHandler(event) {
|
416
|
-
if (isNaN(event) || event
|
417
|
-
|
421
|
+
if (isNaN(event) || event === '') {
|
422
|
+
|
423
|
+
event = this.defaultNumber
|
424
|
+
?this.defaultNumber
|
425
|
+
:this.minNumber || this.minNumber === 0
|
426
|
+
? this.minNumber
|
427
|
+
: event
|
418
428
|
}
|
419
429
|
if (!this.allowNegative) {
|
420
430
|
event = Math.abs(event)
|
@@ -479,13 +489,16 @@ export default {
|
|
479
489
|
if ((evaluatedInput && value.length) || this.minNumber !== null) {
|
480
490
|
this.textInput = numberToString({
|
481
491
|
value:
|
482
|
-
evaluatedInput && value.length ? evaluatedInput :
|
492
|
+
evaluatedInput && value.length ? evaluatedInput :
|
493
|
+
this.defaultNumber?this.defaultNumber:this.minNumber,
|
483
494
|
numberPrecision: this.numberPrecision
|
484
495
|
})
|
485
496
|
}
|
486
497
|
let adjustedMinValue =
|
487
498
|
evaluatedInput && evaluatedInput.length
|
488
|
-
? evaluatedInput
|
499
|
+
? evaluatedInput
|
500
|
+
: this.defaultNumber
|
501
|
+
? this.defaultNumber
|
489
502
|
: this.minNumber || this.minNumber === 0
|
490
503
|
? this.minNumber
|
491
504
|
: ''
|
@@ -514,6 +527,8 @@ export default {
|
|
514
527
|
let adjustedMinValue =
|
515
528
|
value || value === 0
|
516
529
|
? value
|
530
|
+
: this.defaultNumber
|
531
|
+
? this.defaultNumber
|
517
532
|
: this.minNumber || this.minNumber === 0
|
518
533
|
? this.minNumber
|
519
534
|
: ''
|
@@ -569,6 +584,11 @@ export default {
|
|
569
584
|
value: this.value,
|
570
585
|
numberPrecision: this.numberPrecision
|
571
586
|
})
|
587
|
+
} else if (this.defaultNumber !== null) {
|
588
|
+
this.textInput = numberToString({
|
589
|
+
value: this.defaultNumber,
|
590
|
+
numberPrecision: this.numberPrecision
|
591
|
+
})
|
572
592
|
} else if (this.minNumber !== null) {
|
573
593
|
this.textInput = numberToString({
|
574
594
|
value: this.minNumber,
|
@@ -33,6 +33,7 @@
|
|
33
33
|
:type="inputTypeData"
|
34
34
|
:fontColor="fontColor"
|
35
35
|
:backgroundColor="backgroundColor"
|
36
|
+
:disabledBackgroundColor="disabledBackgroundColor"
|
36
37
|
/>
|
37
38
|
<icon-wrapper
|
38
39
|
v-if="inputType === 'password' && !isError"
|
@@ -104,6 +105,7 @@ const inputProps = {
|
|
104
105
|
backgroundColor:String,
|
105
106
|
borderColor:String,
|
106
107
|
inputHeight:String,
|
108
|
+
disabledBackgroundColor:String
|
107
109
|
}
|
108
110
|
const InputContainer = styled('input', inputProps)`
|
109
111
|
border: ${(props) =>
|
@@ -141,8 +143,10 @@ const InputContainer = styled('input', inputProps)`
|
|
141
143
|
font-weight: 400;
|
142
144
|
cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'auto')};
|
143
145
|
background-color: ${(props) =>
|
146
|
+
props.isDisabled ?
|
147
|
+
(props.disabledBackgroundColor ? props.disabledBackgroundColor+' !important'
|
148
|
+
: props.theme.colors.grey5) :
|
144
149
|
props.backgroundColor ? props.backgroundColor+' !important' :
|
145
|
-
props.isDisabled ? props.theme.colors.grey5 :
|
146
150
|
props.theme.colors.white};
|
147
151
|
&::placeholder {
|
148
152
|
color: ${(props) => props.theme.colors.grey2};
|
@@ -280,6 +284,10 @@ export default {
|
|
280
284
|
required:false,
|
281
285
|
default:'white'
|
282
286
|
},
|
287
|
+
disabledBackgroundColor:{
|
288
|
+
required:false,
|
289
|
+
default:null
|
290
|
+
},
|
283
291
|
fontColor:{
|
284
292
|
required:false,
|
285
293
|
default:'black'
|