@eturnity/eturnity_reusable_components 1.2.37 → 1.2.39-EPDM-5626
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
@@ -1,8 +1,9 @@
|
|
1
1
|
<template>
|
2
2
|
<page-container>
|
3
3
|
<button-container
|
4
|
-
:isDisabled="isDisabled"
|
5
4
|
:type="type"
|
5
|
+
:minWidth="minWidth"
|
6
|
+
:isDisabled="isDisabled"
|
6
7
|
:customColor="customColor"
|
7
8
|
>
|
8
9
|
{{ text }}
|
@@ -14,37 +15,39 @@
|
|
14
15
|
// To use:
|
15
16
|
// import MainButton from "@eturnity/eturnity_reusable_components/src/components/buttons/mainButton"
|
16
17
|
// <main-button
|
17
|
-
// type="secondary" // primary, secondary, cancel
|
18
|
-
// :isDisabled="true"
|
19
18
|
// text="Click Me"
|
20
19
|
// customColor="#ab5348"
|
20
|
+
// type="secondary" // primary, secondary, cancel
|
21
|
+
// :isDisabled="true"
|
22
|
+
// :minWidth="minWidth"
|
21
23
|
// />
|
22
24
|
|
23
25
|
import styled from "vue-styled-components"
|
24
26
|
|
25
27
|
const PageContainer = styled.div``
|
26
28
|
|
27
|
-
const ButtonAttrs = { type: String, isDisabled: Boolean, customColor: String }
|
29
|
+
const ButtonAttrs = { type: String, isDisabled: Boolean, minWidth: String, customColor: String }
|
28
30
|
const ButtonContainer = styled("div", ButtonAttrs)`
|
29
31
|
padding: 7px 15px;
|
30
32
|
font-size: 13px;
|
31
33
|
color: ${(props) => props.theme.colors.white};
|
32
34
|
background-color: ${(props) =>
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
35
|
+
props.isDisabled
|
36
|
+
? props.theme.colors.disabled
|
37
|
+
: props.customColor
|
38
|
+
? props.customColor
|
39
|
+
: props.type === "primary"
|
40
|
+
? props.theme.colors.black
|
41
|
+
: props.type === "secondary"
|
42
|
+
? props.theme.colors.grey3
|
43
|
+
: props.type === "cancel"
|
44
|
+
? props.theme.colors.red
|
45
|
+
: props.theme.colors.black};
|
44
46
|
border-radius: 4px;
|
45
47
|
text-align: center;
|
46
48
|
cursor: ${(props) => (props.isDisabled ? "not-allowed" : "pointer")};
|
47
49
|
user-select: none;
|
50
|
+
${(props) => (props.minWidth ? `min-width: ${props.minWidth};` : '')};
|
48
51
|
|
49
52
|
&:hover {
|
50
53
|
opacity: ${(props) => (props.isDisabled ? "1" : "0.8")};
|
@@ -77,6 +80,10 @@ export default {
|
|
77
80
|
required: false,
|
78
81
|
default: null,
|
79
82
|
},
|
83
|
+
minWidth: {
|
84
|
+
required: false,
|
85
|
+
default: null
|
86
|
+
}
|
80
87
|
},
|
81
88
|
}
|
82
89
|
</script>
|
@@ -1,9 +1,13 @@
|
|
1
1
|
<template>
|
2
2
|
<container :inputWidth="inputWidth" :alignItems="alignItems">
|
3
|
-
<label-slot-wrapper
|
3
|
+
<label-slot-wrapper
|
4
|
+
v-if="hasLabelSlot"
|
5
|
+
:isInteractive="isInteractive"
|
6
|
+
@mousedown="initInteraction"
|
7
|
+
>
|
4
8
|
<slot name="label"></slot>
|
5
9
|
</label-slot-wrapper>
|
6
|
-
|
10
|
+
|
7
11
|
<label-wrapper v-if="labelText">
|
8
12
|
<label-text :labelFontColor="labelFontColor">
|
9
13
|
{{ labelText }}
|
@@ -108,23 +112,23 @@ const inputProps = {
|
|
108
112
|
textAlign: String,
|
109
113
|
fontSize: String,
|
110
114
|
fontColor: String,
|
111
|
-
backgroundColor:String,
|
115
|
+
backgroundColor: String,
|
112
116
|
hasSlot: Boolean,
|
113
117
|
hasLabelSlot: Boolean,
|
114
118
|
slotSize: String,
|
115
|
-
inputHeight:String,
|
116
|
-
isInteractive:Boolean,
|
117
|
-
alignItems:String,
|
118
|
-
labelFontColor:String,
|
119
|
-
borderColor:String
|
119
|
+
inputHeight: String,
|
120
|
+
isInteractive: Boolean,
|
121
|
+
alignItems: String,
|
122
|
+
labelFontColor: String,
|
123
|
+
borderColor: String
|
120
124
|
}
|
121
125
|
|
122
126
|
const Container = styled('div', inputProps)`
|
123
127
|
width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
|
124
128
|
position: relative;
|
125
|
-
display:grid;
|
129
|
+
display: grid;
|
126
130
|
grid-template-columns: ${(props) =>
|
127
|
-
props.alignItems ===
|
131
|
+
props.alignItems === 'vertical' ? '1fr' : 'auto 1fr'};
|
128
132
|
`
|
129
133
|
|
130
134
|
const InputContainer = styled('input', inputProps)`
|
@@ -133,18 +137,16 @@ const InputContainer = styled('input', inputProps)`
|
|
133
137
|
? '1px solid ' + props.theme.colors.red
|
134
138
|
: props.noBorder
|
135
139
|
? 'none'
|
136
|
-
: props.borderColor
|
137
|
-
props.theme.colors[props.borderColor]
|
138
|
-
|
139
|
-
|
140
|
+
: props.borderColor
|
141
|
+
? props.theme.colors[props.borderColor]
|
142
|
+
? '1px solid ' + props.theme.colors[props.borderColor]
|
143
|
+
: '1px solid ' + props.borderColor
|
140
144
|
: '1px solid ' + props.theme.colors.grey4};
|
141
145
|
padding-top: 11px;
|
142
146
|
padding-bottom: 11px;
|
143
147
|
padding-left: 10px;
|
144
148
|
padding-right: ${(props) =>
|
145
|
-
props.slotSize
|
146
|
-
? 'calc(' + props.slotSize + ' + 10px)'
|
147
|
-
: '5px'};
|
149
|
+
props.slotSize ? 'calc(' + props.slotSize + ' + 10px)' : '5px'};
|
148
150
|
border-radius: 4px;
|
149
151
|
text-align: ${(props) => props.textAlign};
|
150
152
|
cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'auto')};
|
@@ -157,10 +159,12 @@ const InputContainer = styled('input', inputProps)`
|
|
157
159
|
: props.fontColor
|
158
160
|
? props.fontColor + ' !important'
|
159
161
|
: props.theme.colors.black};
|
160
|
-
background-color
|
161
|
-
|
162
|
-
|
163
|
-
|
162
|
+
background-color: ${(props) =>
|
163
|
+
props.backgroundColor
|
164
|
+
? props.backgroundColor + ' !important'
|
165
|
+
: props.theme.colors.white};
|
166
|
+
width: ${(props) =>
|
167
|
+
props.inputWidth && !props.hasLabelSlot ? props.inputWidth : '100%'};
|
164
168
|
min-width: ${(props) => (props.minWidth ? props.minWidth : 'unset')};
|
165
169
|
background-color: ${(props) =>
|
166
170
|
props.isDisabled ? props.theme.colors.grey5 : '#fff'};
|
@@ -198,7 +202,7 @@ const UnitContainer = styled('span', inputProps)`
|
|
198
202
|
: props.theme.colors.mediumGray};
|
199
203
|
position: absolute;
|
200
204
|
right: 10px;
|
201
|
-
top:
|
205
|
+
top: 10px;
|
202
206
|
padding-left: 10px;
|
203
207
|
text-align: right;
|
204
208
|
color: ${(props) =>
|
@@ -222,7 +226,7 @@ const SlotContainer = styled('span', inputProps)`
|
|
222
226
|
width: ${(props) =>
|
223
227
|
props.slotSize ? 'calc(' + props.slotSize + ' - 10px)' : 'fit-content'};
|
224
228
|
right: 10px;
|
225
|
-
top:
|
229
|
+
top: 10px;
|
226
230
|
padding-left: 10px;
|
227
231
|
color: ${(props) =>
|
228
232
|
props.isError
|
@@ -232,23 +236,26 @@ const SlotContainer = styled('span', inputProps)`
|
|
232
236
|
: props.theme.colors.mediumGray};
|
233
237
|
`
|
234
238
|
|
235
|
-
const LabelWrapper = styled('div',inputProps)`
|
239
|
+
const LabelWrapper = styled('div', inputProps)`
|
236
240
|
display: flex;
|
237
241
|
align-items: center;
|
238
242
|
gap: 10px;
|
239
243
|
margin-bottom: 8px;
|
240
|
-
cursor: ${(props) => (props.isInteractive?'ew-resize':'auto')};
|
244
|
+
cursor: ${(props) => (props.isInteractive ? 'ew-resize' : 'auto')};
|
241
245
|
`
|
242
|
-
const LabelSlotWrapper = styled('div',inputProps)`
|
246
|
+
const LabelSlotWrapper = styled('div', inputProps)`
|
243
247
|
display: flex;
|
244
248
|
gap: 10px;
|
245
|
-
align-items:center;
|
246
|
-
cursor: ${(props) => (props.isInteractive?'ew-resize':'auto')};
|
249
|
+
align-items: center;
|
250
|
+
cursor: ${(props) => (props.isInteractive ? 'ew-resize' : 'auto')};
|
247
251
|
`
|
248
252
|
|
249
|
-
const LabelText = styled('div',inputProps)`
|
253
|
+
const LabelText = styled('div', inputProps)`
|
250
254
|
font-size: 13px;
|
251
|
-
color: ${(props) =>
|
255
|
+
color: ${(props) =>
|
256
|
+
props.theme.colors[props.labelFontColor]
|
257
|
+
? props.theme.colors[props.labelFontColor]
|
258
|
+
: props.labelFontColor};
|
252
259
|
font-weight: 700;
|
253
260
|
`
|
254
261
|
|
@@ -265,7 +272,7 @@ export default {
|
|
265
272
|
LabelText,
|
266
273
|
InfoText,
|
267
274
|
Icon,
|
268
|
-
SlotContainer
|
275
|
+
SlotContainer
|
269
276
|
},
|
270
277
|
inheritAttrs: false,
|
271
278
|
data() {
|
@@ -306,7 +313,7 @@ export default {
|
|
306
313
|
},
|
307
314
|
alignItems: {
|
308
315
|
required: false,
|
309
|
-
default:
|
316
|
+
default: 'vertical'
|
310
317
|
},
|
311
318
|
errorMessage: {
|
312
319
|
required: false,
|
@@ -332,8 +339,8 @@ export default {
|
|
332
339
|
required: false,
|
333
340
|
default: false
|
334
341
|
},
|
335
|
-
borderColor:{
|
336
|
-
required:false
|
342
|
+
borderColor: {
|
343
|
+
required: false
|
337
344
|
},
|
338
345
|
textAlign: {
|
339
346
|
required: false,
|
@@ -347,9 +354,9 @@ export default {
|
|
347
354
|
required: false,
|
348
355
|
default: false
|
349
356
|
},
|
350
|
-
interactionStep:{
|
351
|
-
required:false,
|
352
|
-
default:1
|
357
|
+
interactionStep: {
|
358
|
+
required: false,
|
359
|
+
default: 1
|
353
360
|
},
|
354
361
|
labelText: {
|
355
362
|
required: false,
|
@@ -401,9 +408,9 @@ export default {
|
|
401
408
|
slotSize: {
|
402
409
|
required: false
|
403
410
|
},
|
404
|
-
labelFontColor:{
|
405
|
-
required:false,
|
406
|
-
default:'eturnityGrey'
|
411
|
+
labelFontColor: {
|
412
|
+
required: false,
|
413
|
+
default: 'eturnityGrey'
|
407
414
|
}
|
408
415
|
},
|
409
416
|
computed: {
|
@@ -414,9 +421,9 @@ export default {
|
|
414
421
|
hasSlot() {
|
415
422
|
return !!this.$slots.default
|
416
423
|
},
|
417
|
-
hasLabelSlot(){
|
424
|
+
hasLabelSlot() {
|
418
425
|
return !!this.$slots.label
|
419
|
-
}
|
426
|
+
}
|
420
427
|
},
|
421
428
|
methods: {
|
422
429
|
onChangeHandler(event) {
|
@@ -465,13 +472,13 @@ export default {
|
|
465
472
|
}
|
466
473
|
return evaluated
|
467
474
|
},
|
468
|
-
onInput(value){
|
475
|
+
onInput(value) {
|
469
476
|
let evaluatedVal
|
470
|
-
try{
|
471
|
-
|
472
|
-
}finally {
|
473
|
-
if(evaluatedVal){
|
474
|
-
|
477
|
+
try {
|
478
|
+
evaluatedVal = this.onEvaluateCode(value)
|
479
|
+
} finally {
|
480
|
+
if (evaluatedVal) {
|
481
|
+
this.$emit('on-input', evaluatedVal)
|
475
482
|
}
|
476
483
|
}
|
477
484
|
},
|
@@ -543,31 +550,30 @@ export default {
|
|
543
550
|
}
|
544
551
|
},
|
545
552
|
initInteraction(e) {
|
546
|
-
window.addEventListener('mousemove', this.interact, false)
|
547
|
-
window.addEventListener('mouseup', this.stopInteract, false)
|
548
|
-
e.preventDefault()
|
553
|
+
window.addEventListener('mousemove', this.interact, false)
|
554
|
+
window.addEventListener('mouseup', this.stopInteract, false)
|
555
|
+
e.preventDefault()
|
549
556
|
this.focusInput()
|
550
557
|
},
|
551
558
|
interact(e) {
|
552
|
-
e.preventDefault()
|
553
|
-
let value=parseFloat(this.value || 0)
|
554
|
-
console.log(
|
555
|
-
value+=parseFloat(this.interactionStep)*parseInt(e.movementX)
|
556
|
-
this.$emit('on-input',value)
|
559
|
+
e.preventDefault()
|
560
|
+
let value = parseFloat(this.value || 0)
|
561
|
+
console.log('value', value)
|
562
|
+
value += parseFloat(this.interactionStep) * parseInt(e.movementX)
|
563
|
+
this.$emit('on-input', value)
|
557
564
|
|
558
|
-
this.textInput=numberToString({
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
})
|
565
|
+
this.textInput = numberToString({
|
566
|
+
value: value && value.length ? value : this.minNumber,
|
567
|
+
numberPrecision: this.numberPrecision
|
568
|
+
})
|
563
569
|
//this.value=value
|
564
570
|
},
|
565
571
|
stopInteract(e) {
|
566
|
-
e.preventDefault()
|
567
|
-
window.removeEventListener('mousemove', this.interact, false)
|
568
|
-
window.removeEventListener('mouseup', this.stopInteract, false)
|
572
|
+
e.preventDefault()
|
573
|
+
window.removeEventListener('mousemove', this.interact, false)
|
574
|
+
window.removeEventListener('mouseup', this.stopInteract, false)
|
569
575
|
this.blurInput()
|
570
|
-
}
|
576
|
+
}
|
571
577
|
},
|
572
578
|
created() {
|
573
579
|
if (this.value) {
|