@eturnity/eturnity_reusable_components 8.7.5-EPDM-6306.0 → 8.7.5-EPIC-8593
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 +3 -2
- package/src/Test.vue +12 -76
- package/src/assets/svgIcons/add_plus.svg +4 -0
- package/src/assets/svgIcons/checkmark_white.svg +4 -0
- package/src/assets/svgIcons/clenergy.svg +4 -0
- package/src/assets/svgIcons/clickable_info.svg +2 -2
- package/src/assets/svgIcons/clickable_info_white.svg +5 -0
- package/src/assets/svgIcons/erase_white.svg +4 -0
- package/src/assets/svgIcons/module.svg +2 -2
- package/src/assets/svgIcons/optimizer.svg +2 -5
- package/src/assets/svgIcons/order.svg +3 -0
- package/src/assets/svgIcons/question_mark.svg +3 -0
- package/src/assets/svgIcons/question_mark_white.svg +4 -0
- package/src/assets/svgIcons/reorder_string.svg +3 -0
- package/src/assets/svgIcons/switch_polarity.svg +5 -0
- package/src/assets/svgIcons/transparent_warning.svg +4 -0
- package/src/assets/svgIcons/warning_triangle.svg +3 -0
- package/src/assets/svgIcons/warning_triangle_white.svg +5 -0
- package/src/assets/theme.js +13 -1
- package/src/components/buttons/buttonIcon/index.vue +31 -6
- package/src/components/buttons/mainButton/MainButton.stories.js +13 -0
- package/src/components/buttons/mainButton/index.vue +45 -3
- package/src/components/infoLabel/index.vue +63 -0
- package/src/components/infoText/index.vue +168 -38
- package/src/components/infoText/infoText.spec.js +1 -1
- package/src/components/inputs/checkbox/index.vue +11 -2
- package/src/components/inputs/inputNumber/index.vue +78 -64
- package/src/components/modals/modal/index.vue +23 -13
- package/src/components/panelRangeInfo/index.vue +196 -0
- package/src/components/selectedOptions/index.vue +2 -12
- package/src/components/selectedOptions/selectedOptions.spec.js +1 -1
- package/src/components/tabsHeader/index.vue +75 -61
- package/src/helpers/numberConverter.js +1 -1
- package/src/components/stringDesign/DropdownMenu/index.vue +0 -1009
- /package/src/assets/svgIcons/{close_for_modals,_tool_tips.svg → close.svg} +0 -0
@@ -1,25 +1,48 @@
|
|
1
1
|
<template>
|
2
|
-
<PageContainer
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
>
|
10
|
-
<
|
11
|
-
|
12
|
-
:
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
2
|
+
<PageContainer
|
3
|
+
ref="container"
|
4
|
+
:type="type"
|
5
|
+
@click=";(isMobile || openTrigger === 'onClick') && toggleInfo()"
|
6
|
+
@mouseenter="!isMobile && openTrigger === 'onHover' && showInfo()"
|
7
|
+
@mouseleave="!isMobile && openTrigger === 'onHover' && hideInfo()"
|
8
|
+
>
|
9
|
+
<div ref="icon" data-test-id="infoText_trigger">
|
10
|
+
<IconWrapper
|
11
|
+
:background-color="backgroundColor"
|
12
|
+
:border-radius="borderRadius"
|
13
|
+
:hovered-icon="hoveredIcon"
|
14
|
+
:is-active="isActive"
|
15
|
+
:is-disabled="isDisabled"
|
16
|
+
:padding="padding"
|
17
|
+
>
|
18
|
+
<LabelWrapper
|
19
|
+
v-if="labelText && labelAlign === 'left'"
|
20
|
+
:color="iconColor || computedIconColor"
|
21
|
+
:size="labelSize"
|
22
|
+
>
|
23
|
+
{{ labelText }}
|
24
|
+
</LabelWrapper>
|
25
|
+
<Dot
|
26
|
+
v-if="type === 'dot'"
|
27
|
+
:color="dotColor"
|
28
|
+
data-test-id="infoText_dot"
|
29
|
+
/>
|
30
|
+
<IconComponent
|
31
|
+
v-else-if="!noIcon"
|
32
|
+
:color="iconColor || computedIconColor"
|
33
|
+
:cursor="isDisabled ? 'not-allowed' : 'pointer'"
|
34
|
+
:disabled="isDisabled"
|
35
|
+
:name="iconName"
|
36
|
+
:size="size"
|
37
|
+
/>
|
38
|
+
<LabelWrapper
|
39
|
+
v-if="labelText && labelAlign === 'right'"
|
40
|
+
:color="iconColor || computedIconColor"
|
41
|
+
:size="labelSize"
|
42
|
+
>
|
43
|
+
{{ labelText }}
|
44
|
+
</LabelWrapper>
|
45
|
+
</IconWrapper>
|
23
46
|
</div>
|
24
47
|
<Teleport v-if="isVisible" to="body">
|
25
48
|
<TextWrapper :style="wrapperStyle">
|
@@ -36,13 +59,13 @@
|
|
36
59
|
:src="image"
|
37
60
|
@load="onImageLoad"
|
38
61
|
/>
|
39
|
-
<span ref="textContent" :style="textStyle">
|
62
|
+
<span v-if="!hideInfoText" ref="textContent" :style="textStyle">
|
40
63
|
<slot>
|
41
64
|
<span v-html="text"></span>
|
42
65
|
</slot>
|
43
66
|
</span>
|
44
67
|
</TextOverlay>
|
45
|
-
<Arrow :image="image" :style="arrowStyle" />
|
68
|
+
<!-- <Arrow :image="image" :style="arrowStyle" /> -->
|
46
69
|
</TextWrapper>
|
47
70
|
</Teleport>
|
48
71
|
</PageContainer>
|
@@ -63,7 +86,12 @@
|
|
63
86
|
import styled from 'vue3-styled-components'
|
64
87
|
import theme from '../../assets/theme.js'
|
65
88
|
|
66
|
-
const
|
89
|
+
const TextOverlayAttrs = {
|
90
|
+
appTheme: String,
|
91
|
+
image: Boolean,
|
92
|
+
width: Number,
|
93
|
+
}
|
94
|
+
const TextOverlay = styled('div', TextOverlayAttrs)`
|
67
95
|
background-color: ${(props) =>
|
68
96
|
props.image ? props.theme.colors.white : props.theme.colors.black};
|
69
97
|
color: ${(props) =>
|
@@ -88,16 +116,16 @@
|
|
88
116
|
}
|
89
117
|
`
|
90
118
|
|
91
|
-
const Arrow = styled('div')`
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
`
|
119
|
+
// const Arrow = styled('div')`
|
120
|
+
// position: absolute;
|
121
|
+
// width: 0;
|
122
|
+
// height: 0;
|
123
|
+
// border: 8px solid transparent;
|
124
|
+
// border-top-color: ${(props) =>
|
125
|
+
// props.image ? props.theme.colors.white : props.theme.colors.black};
|
126
|
+
// filter: ${(props) =>
|
127
|
+
// props.image ? 'drop-shadow(0 2px 2px rgba(0, 0, 0, 0.1))' : 'none'};
|
128
|
+
// `
|
101
129
|
|
102
130
|
const PageContainer = styled('div')`
|
103
131
|
display: ${(props) => (props.type === 'dot' ? 'unset' : 'inline-block')};
|
@@ -121,16 +149,57 @@
|
|
121
149
|
border-radius: 50%;
|
122
150
|
`
|
123
151
|
|
152
|
+
const IconWrapperAttrs = {
|
153
|
+
backgroundColor: String,
|
154
|
+
borderRadius: String,
|
155
|
+
padding: String,
|
156
|
+
hoveredIcon: Boolean,
|
157
|
+
isActive: Boolean,
|
158
|
+
isDisabled: Boolean,
|
159
|
+
}
|
160
|
+
const IconWrapper = styled('div', IconWrapperAttrs)`
|
161
|
+
display: flex;
|
162
|
+
align-items: center;
|
163
|
+
justify-content: center;
|
164
|
+
gap: 6px;
|
165
|
+
white-space: nowrap;
|
166
|
+
background-color: ${(props) => props.backgroundColor};
|
167
|
+
border-radius: ${(props) =>
|
168
|
+
props.hoveredIcon ? '6px' : props.borderRadius};
|
169
|
+
padding: ${(props) => props.padding};
|
170
|
+
width: ${(props) => (props.hoveredIcon ? '32px' : '')};
|
171
|
+
height: ${(props) => (props.hoveredIcon ? '32px' : '')};
|
172
|
+
cursor: pointer;
|
173
|
+
background-color: ${(props) =>
|
174
|
+
props.isActive ? props.theme.colors.transparentWhite2 : ''};
|
175
|
+
cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'pointer')};
|
176
|
+
&:hover {
|
177
|
+
background-color: ${(props) =>
|
178
|
+
props.hoveredIcon ? props.theme.colors.transparentWhite2 : ''};
|
179
|
+
}
|
180
|
+
`
|
181
|
+
|
182
|
+
const LabelWrapperAttrs = {
|
183
|
+
size: String,
|
184
|
+
color: String,
|
185
|
+
}
|
186
|
+
const LabelWrapper = styled('div', LabelWrapperAttrs)`
|
187
|
+
font-size: ${(props) => props.size};
|
188
|
+
color: ${(props) => props.color};
|
189
|
+
`
|
190
|
+
|
124
191
|
export default {
|
125
192
|
name: 'InfoText',
|
126
193
|
components: {
|
127
194
|
IconComponent,
|
128
195
|
TextOverlay,
|
129
|
-
Arrow,
|
196
|
+
// Arrow,
|
130
197
|
Dot,
|
131
198
|
PageContainer,
|
132
199
|
TextWrapper,
|
133
200
|
OverlayImage,
|
201
|
+
IconWrapper,
|
202
|
+
LabelWrapper,
|
134
203
|
},
|
135
204
|
props: {
|
136
205
|
text: {
|
@@ -138,6 +207,16 @@
|
|
138
207
|
default: '',
|
139
208
|
type: String,
|
140
209
|
},
|
210
|
+
isActive: {
|
211
|
+
required: false,
|
212
|
+
default: false,
|
213
|
+
type: Boolean,
|
214
|
+
},
|
215
|
+
labelText: {
|
216
|
+
required: false,
|
217
|
+
default: '',
|
218
|
+
type: String,
|
219
|
+
},
|
141
220
|
size: {
|
142
221
|
type: String,
|
143
222
|
default: '14px',
|
@@ -189,6 +268,51 @@
|
|
189
268
|
required: false,
|
190
269
|
default: 'info', // info, dot
|
191
270
|
},
|
271
|
+
appTheme: {
|
272
|
+
type: String,
|
273
|
+
default: 'light', // light or dark
|
274
|
+
required: false,
|
275
|
+
},
|
276
|
+
labelAlign: {
|
277
|
+
type: String,
|
278
|
+
default: 'right',
|
279
|
+
required: false,
|
280
|
+
},
|
281
|
+
backgroundColor: {
|
282
|
+
type: String,
|
283
|
+
default: '',
|
284
|
+
required: false,
|
285
|
+
},
|
286
|
+
borderRadius: {
|
287
|
+
type: String,
|
288
|
+
default: '',
|
289
|
+
required: false,
|
290
|
+
},
|
291
|
+
padding: {
|
292
|
+
type: String,
|
293
|
+
default: '',
|
294
|
+
required: false,
|
295
|
+
},
|
296
|
+
labelSize: {
|
297
|
+
type: String,
|
298
|
+
default: '12px',
|
299
|
+
required: false,
|
300
|
+
},
|
301
|
+
noIcon: {
|
302
|
+
type: Boolean,
|
303
|
+
default: false,
|
304
|
+
required: false,
|
305
|
+
},
|
306
|
+
hoveredIcon: {
|
307
|
+
type: Boolean,
|
308
|
+
default: false,
|
309
|
+
required: false,
|
310
|
+
},
|
311
|
+
hideInfoText: {
|
312
|
+
type: Boolean,
|
313
|
+
default: false,
|
314
|
+
required: false,
|
315
|
+
},
|
192
316
|
},
|
193
317
|
setup(props) {
|
194
318
|
const isVisible = ref(false)
|
@@ -206,7 +330,11 @@
|
|
206
330
|
|
207
331
|
const textStyle = computed(() => ({
|
208
332
|
fontSize: props.image ? '12px' : '13px',
|
209
|
-
color: props.image
|
333
|
+
color: props.image
|
334
|
+
? theme.colors.grey1
|
335
|
+
: props.appTheme === 'dark'
|
336
|
+
? theme.colors.black
|
337
|
+
: theme.colors.white,
|
210
338
|
textAlign: props.image ? 'right' : 'left',
|
211
339
|
}))
|
212
340
|
|
@@ -336,7 +464,9 @@
|
|
336
464
|
overflowY: 'auto',
|
337
465
|
backgroundColor: props.image
|
338
466
|
? theme.colors.white
|
339
|
-
:
|
467
|
+
: props.appTheme === 'light'
|
468
|
+
? theme.colors.black
|
469
|
+
: theme.colors.grey5,
|
340
470
|
}
|
341
471
|
}
|
342
472
|
|
@@ -408,7 +538,7 @@
|
|
408
538
|
|
409
539
|
// Calculate new width
|
410
540
|
const calculatedWidth = Math.min(
|
411
|
-
Math.max(contentWidth,
|
541
|
+
Math.max(contentWidth, 230),
|
412
542
|
parseInt(props.maxWidth, 10)
|
413
543
|
)
|
414
544
|
|
@@ -5,7 +5,7 @@ import theme from '@/assets/theme'
|
|
5
5
|
|
6
6
|
jest.mock('@/components/icon/iconCache.mjs', () => ({
|
7
7
|
// need to mock this due to how jest handles import.meta
|
8
|
-
fetchIcon: jest.fn(() => Promise.resolve('
|
8
|
+
fetchIcon: jest.fn(() => Promise.resolve('close.svg')),
|
9
9
|
}))
|
10
10
|
|
11
11
|
describe('InfoText Component', () => {
|
@@ -5,6 +5,7 @@
|
|
5
5
|
:check-color="checkColor"
|
6
6
|
:cursor-type="cursorType"
|
7
7
|
:data-test-id="dataId"
|
8
|
+
:font-color="fontColor"
|
8
9
|
:has-label="hasLabel"
|
9
10
|
:is-checked="isChecked"
|
10
11
|
:is-disabled="isDisabled"
|
@@ -63,6 +64,7 @@
|
|
63
64
|
isChecked: Boolean,
|
64
65
|
isDisabled: Boolean,
|
65
66
|
cursorType: String,
|
67
|
+
fontColor: String,
|
66
68
|
}
|
67
69
|
const Container = styled('label', containerAttrs)`
|
68
70
|
display: grid;
|
@@ -70,7 +72,10 @@
|
|
70
72
|
props.hasLabel ? '16px auto' : '16px'};
|
71
73
|
grid-gap: 16px;
|
72
74
|
align-content: center;
|
73
|
-
color: ${(props) =>
|
75
|
+
color: ${(props) =>
|
76
|
+
props.theme.colors[props.fontColor]
|
77
|
+
? props.theme.colors[props.fontColor]
|
78
|
+
: props.fontColor};
|
74
79
|
position: relative;
|
75
80
|
cursor: ${(props) => (props.isDisabled ? 'not-allowed' : props.cursorType)};
|
76
81
|
font-size: 16px;
|
@@ -176,7 +181,7 @@
|
|
176
181
|
align-items: center;
|
177
182
|
min-height: 18px;
|
178
183
|
color: ${(props) =>
|
179
|
-
props.isDisabled ? props.theme.colors.grey2 :
|
184
|
+
props.isDisabled ? props.theme.colors.grey2 : 'unset'};
|
180
185
|
`
|
181
186
|
|
182
187
|
export default {
|
@@ -193,6 +198,10 @@
|
|
193
198
|
required: false,
|
194
199
|
default: '',
|
195
200
|
},
|
201
|
+
fontColor: {
|
202
|
+
required: false,
|
203
|
+
default: 'black',
|
204
|
+
},
|
196
205
|
isChecked: {
|
197
206
|
required: true,
|
198
207
|
default: false,
|
@@ -59,7 +59,7 @@
|
|
59
59
|
:show-linear-unit-name="showLinearUnitName"
|
60
60
|
:slot-size="slotSize"
|
61
61
|
:text-align="textAlign"
|
62
|
-
:value="
|
62
|
+
:value="formatWithCurrency(value)"
|
63
63
|
@blur="onInputBlur($event)"
|
64
64
|
@focus="focusInput()"
|
65
65
|
@input="onInput($event)"
|
@@ -73,7 +73,7 @@
|
|
73
73
|
|
74
74
|
<UnitContainer
|
75
75
|
v-if="unitName && showLinearUnitName && !hasSlot"
|
76
|
-
:has-length="
|
76
|
+
:has-length="!!textInput.length"
|
77
77
|
:is-error="isError"
|
78
78
|
>{{ unitName }}</UnitContainer
|
79
79
|
>
|
@@ -90,7 +90,7 @@
|
|
90
90
|
:disabled="isSelectDisabled"
|
91
91
|
:select-width="`${selectWidth}px`"
|
92
92
|
:show-border="false"
|
93
|
-
@input-change="
|
93
|
+
@input-change="$emit('select-change', $event)"
|
94
94
|
>
|
95
95
|
<template #selector>
|
96
96
|
<SelectText>{{ getSelectValue }}</SelectText>
|
@@ -448,18 +448,8 @@
|
|
448
448
|
background-color: ${({ theme }) => theme.colors.grey4};
|
449
449
|
`
|
450
450
|
|
451
|
-
const EVENT_TYPES = {
|
452
|
-
INPUT_FOCUS: 'input-focus',
|
453
|
-
INPUT_CHANGE: 'input-change',
|
454
|
-
INPUT_BLUR: 'input-blur',
|
455
|
-
PRESS_ENTER: 'on-enter-click',
|
456
|
-
INPUT_DRAG: 'on-input-drag',
|
457
|
-
SELECT_CHANGE: 'select-change',
|
458
|
-
}
|
459
|
-
|
460
451
|
export default {
|
461
452
|
name: 'InputNumber',
|
462
|
-
emits: [...Object.values(EVENT_TYPES)],
|
463
453
|
components: {
|
464
454
|
Container,
|
465
455
|
InputContainer,
|
@@ -694,10 +684,9 @@
|
|
694
684
|
},
|
695
685
|
data() {
|
696
686
|
return {
|
687
|
+
textInput: '',
|
697
688
|
isFocused: false,
|
698
689
|
warningIcon: warningIcon,
|
699
|
-
inputValue: null,
|
700
|
-
enteredValue: null,
|
701
690
|
}
|
702
691
|
},
|
703
692
|
computed: {
|
@@ -720,14 +709,6 @@
|
|
720
709
|
|
721
710
|
return item ? item.label : '-'
|
722
711
|
},
|
723
|
-
formattedValue() {
|
724
|
-
return this.isFocused
|
725
|
-
? this.enteredValue
|
726
|
-
: this.formatWithCurrency(this.value)
|
727
|
-
},
|
728
|
-
hasLength() {
|
729
|
-
return this.formattedValue !== null && this.formattedValue.length > 0
|
730
|
-
},
|
731
712
|
},
|
732
713
|
watch: {
|
733
714
|
focus(value) {
|
@@ -738,19 +719,30 @@
|
|
738
719
|
clearInput: function (value) {
|
739
720
|
if (value) {
|
740
721
|
// If the value is typed, then we should clear the textInput on Continue
|
741
|
-
this.
|
742
|
-
this.enteredValue = ''
|
722
|
+
this.textInput = ''
|
743
723
|
}
|
744
724
|
},
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
}
|
753
|
-
}
|
725
|
+
},
|
726
|
+
created() {
|
727
|
+
if (this.value) {
|
728
|
+
this.textInput = numberToString({
|
729
|
+
value: this.value,
|
730
|
+
numberPrecision: this.numberPrecision,
|
731
|
+
minDecimals: this.minDecimals,
|
732
|
+
})
|
733
|
+
} else if (this.defaultNumber !== null) {
|
734
|
+
this.textInput = numberToString({
|
735
|
+
value: this.defaultNumber,
|
736
|
+
numberPrecision: this.numberPrecision,
|
737
|
+
minDecimals: this.minDecimals,
|
738
|
+
})
|
739
|
+
} else if (this.minNumber !== null) {
|
740
|
+
this.textInput = numberToString({
|
741
|
+
value: this.minNumber,
|
742
|
+
numberPrecision: this.numberPrecision,
|
743
|
+
minDecimals: this.minDecimals,
|
744
|
+
})
|
745
|
+
}
|
754
746
|
},
|
755
747
|
mounted() {
|
756
748
|
if (this.focus) {
|
@@ -789,28 +781,29 @@
|
|
789
781
|
}
|
790
782
|
},
|
791
783
|
onEnterPress() {
|
792
|
-
this.$emit(
|
784
|
+
this.$emit('on-enter-click')
|
793
785
|
this.$refs.inputField1.$el.blur()
|
794
786
|
},
|
795
|
-
onChangeHandler(
|
796
|
-
if (isNaN(
|
797
|
-
|
787
|
+
onChangeHandler(event) {
|
788
|
+
if (isNaN(event) || event === '') {
|
789
|
+
event = this.defaultNumber
|
798
790
|
? this.defaultNumber
|
799
791
|
: this.minNumber || this.minNumber === 0
|
800
792
|
? this.minNumber
|
801
|
-
:
|
793
|
+
: event
|
802
794
|
}
|
803
795
|
if (!this.allowNegative) {
|
804
|
-
|
796
|
+
event = Math.abs(event)
|
805
797
|
}
|
806
|
-
|
798
|
+
event = parseFloat(event)
|
807
799
|
// Need to return an integer rather than a string
|
808
|
-
|
800
|
+
this.$emit('input-change', event)
|
809
801
|
},
|
810
|
-
onEvaluateCode(
|
802
|
+
onEvaluateCode(event) {
|
811
803
|
// function to perform math on the code
|
812
804
|
// filter the string in case of any malicious content
|
813
|
-
|
805
|
+
const val = event.target.value
|
806
|
+
let filtered = val.replace('(auto)', '').replace(/[^-()\d/*+.,]/g, '')
|
814
807
|
filtered = filtered.split(/([-+*/()])/)
|
815
808
|
let formatted = filtered.map((item) => {
|
816
809
|
if (
|
@@ -868,29 +861,48 @@
|
|
868
861
|
return array
|
869
862
|
},
|
870
863
|
onInput(event) {
|
871
|
-
this.
|
872
|
-
if (!this.isFocused || this.enteredValue === this.inputValue) {
|
864
|
+
if (!this.isFocused) {
|
873
865
|
return
|
874
866
|
}
|
867
|
+
if (event.target.value === '') {
|
868
|
+
this.$emit('on-input', '')
|
869
|
+
}
|
875
870
|
let evaluatedVal
|
876
871
|
try {
|
877
|
-
evaluatedVal = this.onEvaluateCode(
|
872
|
+
evaluatedVal = this.onEvaluateCode(event)
|
878
873
|
} finally {
|
879
|
-
this.
|
880
|
-
|
881
|
-
if (this.isFocused && typeof this.enteredValue !== 'number') {
|
882
|
-
this.$emit(EVENT_TYPES.INPUT_CHANGE, this.inputValue)
|
874
|
+
if (evaluatedVal && this.value != evaluatedVal) {
|
875
|
+
this.$emit('on-input', evaluatedVal)
|
883
876
|
}
|
884
877
|
}
|
885
878
|
this.textInput = evaluatedVal
|
886
879
|
},
|
887
880
|
onInputBlur(e) {
|
888
881
|
this.isFocused = false
|
889
|
-
|
890
|
-
this
|
891
|
-
|
892
|
-
|
893
|
-
|
882
|
+
let value = e.target.value
|
883
|
+
let evaluatedInput = this.onEvaluateCode(e)
|
884
|
+
this.onChangeHandler(evaluatedInput ? evaluatedInput : value)
|
885
|
+
if ((evaluatedInput && value.length) || this.minNumber !== null) {
|
886
|
+
this.textInput = numberToString({
|
887
|
+
value:
|
888
|
+
evaluatedInput && value.length
|
889
|
+
? evaluatedInput
|
890
|
+
: this.defaultNumber
|
891
|
+
? this.defaultNumber
|
892
|
+
: this.minNumber,
|
893
|
+
numberPrecision: this.numberPrecision,
|
894
|
+
minDecimals: this.minDecimals,
|
895
|
+
})
|
896
|
+
}
|
897
|
+
let adjustedMinValue =
|
898
|
+
evaluatedInput && evaluatedInput.length
|
899
|
+
? evaluatedInput
|
900
|
+
: this.defaultNumber
|
901
|
+
? this.defaultNumber
|
902
|
+
: this.minNumber || this.minNumber === 0
|
903
|
+
? this.minNumber
|
904
|
+
: ''
|
905
|
+
this.$emit('input-blur', adjustedMinValue)
|
894
906
|
},
|
895
907
|
focusInput() {
|
896
908
|
if (this.disabled) {
|
@@ -900,7 +912,7 @@
|
|
900
912
|
this.$nextTick(() => {
|
901
913
|
this.$refs.inputField1.$el.select()
|
902
914
|
})
|
903
|
-
this.$emit(
|
915
|
+
this.$emit('input-focus')
|
904
916
|
},
|
905
917
|
blurInput() {
|
906
918
|
if (this.disabled) {
|
@@ -920,7 +932,7 @@
|
|
920
932
|
: this.minNumber || this.minNumber === 0
|
921
933
|
? this.minNumber
|
922
934
|
: ''
|
923
|
-
if (adjustedMinValue || adjustedMinValue === 0) {
|
935
|
+
if ((adjustedMinValue || adjustedMinValue === 0) && !this.isFocused) {
|
924
936
|
let input = this.numberToStringEnabled
|
925
937
|
? numberToString({
|
926
938
|
value: adjustedMinValue,
|
@@ -933,8 +945,6 @@
|
|
933
945
|
return input + ' ' + unit
|
934
946
|
} else if (!adjustedMinValue && adjustedMinValue !== 0) {
|
935
947
|
return ''
|
936
|
-
} else if (this.isFocused) {
|
937
|
-
return value
|
938
948
|
} else {
|
939
949
|
return this.numberToStringEnabled
|
940
950
|
? numberToString({
|
@@ -955,7 +965,14 @@
|
|
955
965
|
e.preventDefault()
|
956
966
|
let value = parseFloat(this.value || 0)
|
957
967
|
value += parseFloat(this.interactionStep) * parseInt(e.movementX)
|
958
|
-
this.$emit(
|
968
|
+
this.$emit('on-input-drag', value)
|
969
|
+
|
970
|
+
this.textInput = numberToString({
|
971
|
+
value: value && value.length ? value : this.minNumber,
|
972
|
+
numberPrecision: this.numberPrecision,
|
973
|
+
minDecimals: this.minDecimals,
|
974
|
+
})
|
975
|
+
//this.value=value
|
959
976
|
},
|
960
977
|
stopInteract(e) {
|
961
978
|
e.preventDefault()
|
@@ -963,9 +980,6 @@
|
|
963
980
|
window.removeEventListener('mouseup', this.stopInteract, false)
|
964
981
|
this.blurInput()
|
965
982
|
},
|
966
|
-
handleSelectChange(value) {
|
967
|
-
this.$emit(EVENT_TYPES.SELECT_CHANGE, value)
|
968
|
-
},
|
969
983
|
},
|
970
984
|
}
|
971
985
|
</script>
|
@@ -1,6 +1,7 @@
|
|
1
1
|
<template>
|
2
2
|
<PageWrapper
|
3
3
|
v-if="isOpen"
|
4
|
+
:add-padding-top="addPaddingTop"
|
4
5
|
:backdrop="backdrop"
|
5
6
|
:is-open="isOpen"
|
6
7
|
:position="position"
|
@@ -36,20 +37,25 @@
|
|
36
37
|
|
37
38
|
const ContentContainer = styled.div``
|
38
39
|
|
39
|
-
const pageAttrs = {
|
40
|
+
const pageAttrs = {
|
41
|
+
backdrop: String,
|
42
|
+
position: String,
|
43
|
+
addPaddingTop: Boolean,
|
44
|
+
}
|
40
45
|
const PageWrapper = styled('div', pageAttrs)`
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
46
|
+
position: ${(props) => props.position}
|
47
|
+
display: grid;
|
48
|
+
top: 0;
|
49
|
+
left: 0;
|
50
|
+
width: 100%;
|
51
|
+
height: 100%;
|
52
|
+
background-color: ${(props) =>
|
53
|
+
props.backdrop == 'dark'
|
54
|
+
? 'rgba(0, 0, 0, 0.4)'
|
55
|
+
: 'rgba(255, 255, 255, 0.9)'};
|
56
|
+
z-index: 99999;
|
57
|
+
overflow: auto;
|
58
|
+
padding-top: ${(props) => (props.addPaddingTop ? '80px' : '0')};
|
53
59
|
|
54
60
|
@media (max-width: 425px) {
|
55
61
|
background: white;
|
@@ -147,6 +153,10 @@
|
|
147
153
|
type: String,
|
148
154
|
default: 'auto',
|
149
155
|
},
|
156
|
+
addPaddingTop: {
|
157
|
+
type: Boolean,
|
158
|
+
default: false,
|
159
|
+
},
|
150
160
|
},
|
151
161
|
watch: {
|
152
162
|
isOpen: {
|