@eturnity/eturnity_reusable_components 1.2.48-EPDM-5846.5 → 1.2.48-EPDM-5846.7
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
@@ -0,0 +1 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 300" shape-rendering="geometricPrecision" text-rendering="geometricPrecision"><path d="M0 24.006v24.006l18.125-.131 18.125-.131.141-5.608.141-5.607 5.109-.143 5.109-.142.131-18.125L47.012 0H0v24.006m67.619-5.881.131 18.125h68l.131-18.125L136.012 0H67.488l.131 18.125m89 0 .131 18.125 33.875.128 33.875.129V0h-68.012l.131 18.125m89 0 .131 18.125 8.875.137 8.875.136V49.5H300V0h-54.512l.131 18.125M69 146.5V229h160V64H69v82.5M0 102.506v34.006l18.125-.131 18.125-.131.128-33.875.129-33.875H0v34.006m263.5 1.744V138H300V70.5h-36.5v33.75m-67.5 42.5v49.75h-94V97h94v49.75M0 191.006v34.006l18.125-.131 18.125-.131.128-33.875.129-33.875H0v34.006m263.5 1.744v33.75H300V159h-36.5v33.75M0 272.75V300h49.5v-36.5h-13v-18H0v27.25m263.5-17.25v8h-15V300H300v-52.5h-36.5v8m-193 26.25V300h68v-36.5h-68v18.25m89 0V300h68v-36.5h-68v18.25" fill-rule="evenodd"/></svg>
|
@@ -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)
|
@@ -459,6 +469,9 @@ export default {
|
|
459
469
|
return evaluated
|
460
470
|
},
|
461
471
|
onInput(value) {
|
472
|
+
if(value===""){
|
473
|
+
this.$emit('on-input','')
|
474
|
+
}
|
462
475
|
let evaluatedVal
|
463
476
|
try {
|
464
477
|
evaluatedVal = this.onEvaluateCode(value)
|
@@ -476,13 +489,16 @@ export default {
|
|
476
489
|
if ((evaluatedInput && value.length) || this.minNumber !== null) {
|
477
490
|
this.textInput = numberToString({
|
478
491
|
value:
|
479
|
-
evaluatedInput && value.length ? evaluatedInput :
|
492
|
+
evaluatedInput && value.length ? evaluatedInput :
|
493
|
+
this.defaultNumber?this.defaultNumber:this.minNumber,
|
480
494
|
numberPrecision: this.numberPrecision
|
481
495
|
})
|
482
496
|
}
|
483
497
|
let adjustedMinValue =
|
484
498
|
evaluatedInput && evaluatedInput.length
|
485
|
-
? evaluatedInput
|
499
|
+
? evaluatedInput
|
500
|
+
: this.defaultNumber
|
501
|
+
? this.defaultNumber
|
486
502
|
: this.minNumber || this.minNumber === 0
|
487
503
|
? this.minNumber
|
488
504
|
: ''
|
@@ -511,6 +527,8 @@ export default {
|
|
511
527
|
let adjustedMinValue =
|
512
528
|
value || value === 0
|
513
529
|
? value
|
530
|
+
: this.defaultNumber
|
531
|
+
? this.defaultNumber
|
514
532
|
: this.minNumber || this.minNumber === 0
|
515
533
|
? this.minNumber
|
516
534
|
: ''
|
@@ -544,7 +562,6 @@ export default {
|
|
544
562
|
interact(e) {
|
545
563
|
e.preventDefault()
|
546
564
|
let value = parseFloat(this.value || 0)
|
547
|
-
console.log('value', value)
|
548
565
|
value += parseFloat(this.interactionStep) * parseInt(e.movementX)
|
549
566
|
this.$emit('on-input', value)
|
550
567
|
|
@@ -567,6 +584,11 @@ export default {
|
|
567
584
|
value: this.value,
|
568
585
|
numberPrecision: this.numberPrecision
|
569
586
|
})
|
587
|
+
} else if (this.defaultNumber !== null) {
|
588
|
+
this.textInput = numberToString({
|
589
|
+
value: this.defaultNumber,
|
590
|
+
numberPrecision: this.numberPrecision
|
591
|
+
})
|
570
592
|
} else if (this.minNumber !== null) {
|
571
593
|
this.textInput = numberToString({
|
572
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) =>
|
@@ -140,8 +142,10 @@ const InputContainer = styled('input', inputProps)`
|
|
140
142
|
box-sizing: border-box; // to allow width of 100% with padding
|
141
143
|
font-weight: 400;
|
142
144
|
cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'auto')};
|
143
|
-
background-color: ${(props) =>
|
144
|
-
props.isDisabled ?
|
145
|
+
background-color: ${(props) =>
|
146
|
+
props.isDisabled ?
|
147
|
+
(props.disabledBackgroundColor ? props.disabledBackgroundColor+' !important'
|
148
|
+
: props.theme.colors.grey5) :
|
145
149
|
props.backgroundColor ? props.backgroundColor+' !important' :
|
146
150
|
props.theme.colors.white};
|
147
151
|
&::placeholder {
|
@@ -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'
|
@@ -20,7 +20,7 @@
|
|
20
20
|
:alignText="infoTextAlign"
|
21
21
|
/>
|
22
22
|
</label-wrapper>
|
23
|
-
<
|
23
|
+
<select-button-wrapper :disabled="disabled">
|
24
24
|
<selectButton
|
25
25
|
ref="select"
|
26
26
|
@click="toggleDropdown"
|
@@ -29,6 +29,7 @@
|
|
29
29
|
:fontColor="buttonFontColor || colorMode=='dark'?'white':'black'"
|
30
30
|
:hasError="hasError"
|
31
31
|
:isSearchBarVisible="isSearchBarVisible"
|
32
|
+
:disabled="disabled"
|
32
33
|
@keydown.native="onKeyDown"
|
33
34
|
>
|
34
35
|
<inputText
|
@@ -65,7 +66,7 @@
|
|
65
66
|
<slot name="dropdown"></slot>
|
66
67
|
</selectDropdown>
|
67
68
|
</DropdownWrapper>
|
68
|
-
</
|
69
|
+
</select-button-wrapper>
|
69
70
|
</input-wrapper>
|
70
71
|
</Container>
|
71
72
|
</template>
|
@@ -130,10 +131,19 @@ const LabelWrapper = styled.div`
|
|
130
131
|
align-items: center;
|
131
132
|
justify-content: start;
|
132
133
|
`
|
134
|
+
|
135
|
+
const SelectButtonWrapperAttrs = {
|
136
|
+
disabled: Boolean
|
137
|
+
}
|
138
|
+
const SelectButtonWrapper = styled('div', SelectButtonWrapperAttrs)`
|
139
|
+
${(props) => props.disabled ? 'cursor: not-allowed' : '' };
|
140
|
+
`
|
141
|
+
|
133
142
|
const selectButtonAttrs={
|
134
143
|
bgColor: String,
|
135
144
|
fontColor: String,
|
136
145
|
hasError: Boolean,
|
146
|
+
disabled: Boolean,
|
137
147
|
selectHeight: String,
|
138
148
|
isSearchBarVisible: Boolean
|
139
149
|
}
|
@@ -149,8 +159,9 @@ const selectButton = styled('div',selectButtonAttrs)`
|
|
149
159
|
align-items: center;
|
150
160
|
max-height:${props=>props.selectHeight};
|
151
161
|
border:1px solid ${(props) => props.hasError ? props.theme.colors.red : props.theme.colors.grey4}
|
152
|
-
background-color:${(props) => props.theme.colors[props.bgColor]?props.theme.colors[props.bgColor]:props.bgColor};
|
162
|
+
background-color:${(props) => props.disabled ? props.theme.colors.grey5 : props.theme.colors[props.bgColor] ? props.theme.colors[props.bgColor] : props.bgColor};
|
153
163
|
color:${(props) => props.theme.colors[props.fontColor]?props.theme.colors[props.fontColor]:props.fontColor};
|
164
|
+
${(props) => props.disabled ? 'pointer-events: none' : '' };
|
154
165
|
`
|
155
166
|
const selectDropdownAttrs={bgColor:String,fontColor:String,selectWidth: String, optionWidth: String,hoveredIndex:Number,selectedValue:Number | String}
|
156
167
|
const selectDropdown = styled('div',selectDropdownAttrs)`
|
@@ -261,6 +272,10 @@ const InputWrapper = styled('div', inputAttrs)`
|
|
261
272
|
required: false,
|
262
273
|
default: false
|
263
274
|
},
|
275
|
+
disabled: {
|
276
|
+
required: false,
|
277
|
+
default: false
|
278
|
+
},
|
264
279
|
isAutoSearch:{
|
265
280
|
required:false,
|
266
281
|
default:true
|
@@ -269,6 +284,7 @@ const InputWrapper = styled('div', inputAttrs)`
|
|
269
284
|
|
270
285
|
components: {
|
271
286
|
selectButton,
|
287
|
+
SelectButtonWrapper,
|
272
288
|
selectDropdown,
|
273
289
|
Container,
|
274
290
|
InputLabel,
|