@eturnity/eturnity_reusable_components 1.2.12 → 1.2.14-QA03-20-9-2022.1
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/App.vue +88 -89
- package/src/assets/icons/warning_icon.svg +3 -0
- package/src/assets/svgIcons/2d_active.svg +7 -0
- package/src/assets/svgIcons/2d_inactive.svg +8 -0
- package/src/assets/svgIcons/3d_active.svg +7 -0
- package/src/assets/svgIcons/3d_inactive.svg +8 -0
- package/src/assets/svgIcons/accept.svg +5 -0
- package/src/assets/svgIcons/activate_panels_active.svg +22 -0
- package/src/assets/svgIcons/activate_panels_inactive.svg +20 -0
- package/src/assets/svgIcons/add_icon-1.svg +3 -0
- package/src/assets/svgIcons/add_icon.svg +4 -0
- package/src/assets/svgIcons/address_book.svg +3 -0
- package/src/assets/svgIcons/after_sale_as_a_service.svg +6 -0
- package/src/assets/svgIcons/all_good.svg +3 -0
- package/src/assets/svgIcons/angle_active.svg +5 -0
- package/src/assets/svgIcons/angle_inactive.svg +4 -0
- package/src/assets/svgIcons/area_active.svg +11 -0
- package/src/assets/svgIcons/area_inactive.svg +26 -0
- package/src/assets/svgIcons/arrow_down.svg +3 -0
- package/src/assets/svgIcons/arrow_left.svg +4 -0
- package/src/assets/svgIcons/arrow_right.svg +4 -0
- package/src/assets/svgIcons/arrow_up.svg +3 -0
- package/src/assets/svgIcons/attachment.svg +3 -0
- package/src/assets/svgIcons/battery.svg +3 -0
- package/src/assets/svgIcons/bell.svg +3 -0
- package/src/assets/svgIcons/bold.svg +3 -0
- package/src/assets/svgIcons/bom.svg +3 -0
- package/src/assets/svgIcons/bom_generation.svg +10 -0
- package/src/assets/svgIcons/bubble.svg +3 -0
- package/src/assets/svgIcons/bullet_list.svg +8 -0
- package/src/assets/svgIcons/calendar.svg +7 -0
- package/src/assets/svgIcons/calendar_icon.svg +7 -0
- package/src/assets/svgIcons/call.svg +3 -0
- package/src/assets/svgIcons/camera.svg +3 -0
- package/src/assets/svgIcons/car.svg +3 -0
- package/src/assets/svgIcons/cart.svg +3 -0
- package/src/assets/svgIcons/checkbox.svg +3 -0
- package/src/assets/svgIcons/clear_formatting.svg +7 -0
- package/src/assets/svgIcons/clickable_info.svg +4 -0
- package/src/assets/svgIcons/clip.svg +3 -0
- package/src/assets/svgIcons/clock.svg +4 -0
- package/src/assets/svgIcons/close_for_modals,_tool_tips.svg +4 -0
- package/src/assets/svgIcons/collapse.svg +4 -0
- package/src/assets/svgIcons/component_library.svg +7 -0
- package/src/assets/svgIcons/context_menu-1.svg +6 -0
- package/src/assets/svgIcons/context_menu-2.svg +5 -0
- package/src/assets/svgIcons/context_menu.svg +5 -0
- package/src/assets/svgIcons/context_menu_tabs.svg +5 -0
- package/src/assets/svgIcons/current_variant.svg +4 -0
- package/src/assets/svgIcons/deadline.svg +4 -0
- package/src/assets/svgIcons/delete.svg +4 -0
- package/src/assets/svgIcons/delete_area_active.svg +16 -0
- package/src/assets/svgIcons/delete_area_inactive.svg +15 -0
- package/src/assets/svgIcons/direction_active-1.svg +12 -0
- package/src/assets/svgIcons/direction_active.svg +5 -0
- package/src/assets/svgIcons/direction_inactive.svg +4 -0
- package/src/assets/svgIcons/distances_active.svg +9 -0
- package/src/assets/svgIcons/distances_inactive.svg +8 -0
- package/src/assets/svgIcons/document.svg +3 -0
- package/src/assets/svgIcons/downarrow.svg +3 -0
- package/src/assets/svgIcons/download.svg +4 -0
- package/src/assets/svgIcons/duplicate-1.svg +8 -0
- package/src/assets/svgIcons/duplicate-2.svg +5 -0
- package/src/assets/svgIcons/duplicate-3.svg +3 -0
- package/src/assets/svgIcons/duplicate.svg +4 -0
- package/src/assets/svgIcons/e-mobility_configurator.svg +6 -0
- package/src/assets/svgIcons/edit_button.svg +3 -0
- package/src/assets/svgIcons/email.svg +3 -0
- package/src/assets/svgIcons/ems-1.svg +3 -0
- package/src/assets/svgIcons/ems.svg +3 -0
- package/src/assets/svgIcons/end_of_the_list.svg +5 -0
- package/src/assets/svgIcons/erase.svg +4 -0
- package/src/assets/svgIcons/fav_icon.svg +4 -0
- package/src/assets/svgIcons/financing_for_pv-1.svg +5 -0
- package/src/assets/svgIcons/financing_for_pv-2.svg +3 -0
- package/src/assets/svgIcons/financing_for_pv.svg +6 -0
- package/src/assets/svgIcons/finish-1.svg +4 -0
- package/src/assets/svgIcons/finish.svg +3 -0
- package/src/assets/svgIcons/folder.svg +3 -0
- package/src/assets/svgIcons/heat_calc.svg +7 -0
- package/src/assets/svgIcons/house.svg +3 -0
- package/src/assets/svgIcons/initial_situation.svg +3 -0
- package/src/assets/svgIcons/intro-tour-1.svg +3 -0
- package/src/assets/svgIcons/intro-tour.svg +3 -0
- package/src/assets/svgIcons/inverter-1.svg +5 -0
- package/src/assets/svgIcons/inverter.svg +3 -0
- package/src/assets/svgIcons/italic.svg +3 -0
- package/src/assets/svgIcons/key.svg +3 -0
- package/src/assets/svgIcons/lead_marketplace.svg +6 -0
- package/src/assets/svgIcons/lead_provider.svg +4 -0
- package/src/assets/svgIcons/length_in_2d_active.svg +12 -0
- package/src/assets/svgIcons/length_in_2d_inctive.svg +13 -0
- package/src/assets/svgIcons/light_bulb.svg +3 -0
- package/src/assets/svgIcons/line_graph.svg +3 -0
- package/src/assets/svgIcons/local_subsidies.svg +18 -0
- package/src/assets/svgIcons/location.svg +3 -0
- package/src/assets/svgIcons/lock.svg +3 -0
- package/src/assets/svgIcons/loop.svg +3 -0
- package/src/assets/svgIcons/lunch.svg +4 -0
- package/src/assets/svgIcons/map_icon.svg +3 -0
- package/src/assets/svgIcons/meeting.svg +6 -0
- package/src/assets/svgIcons/move_copy.svg +4 -0
- package/src/assets/svgIcons/new_area_inactive.svg +11 -0
- package/src/assets/svgIcons/next.svg +4 -0
- package/src/assets/svgIcons/not_equal_to.svg +3 -0
- package/src/assets/svgIcons/numbered_list.svg +6 -0
- package/src/assets/svgIcons/obstacle_tool.svg +13 -0
- package/src/assets/svgIcons/pan_tool.svg +12 -0
- package/src/assets/svgIcons/panels_tool.svg +8 -0
- package/src/assets/svgIcons/pen_tool.svg +4 -0
- package/src/assets/svgIcons/picker_tool.svg +4 -0
- package/src/assets/svgIcons/picture.svg +3 -0
- package/src/assets/svgIcons/pin.svg +5 -0
- package/src/assets/svgIcons/presentation.svg +3 -0
- package/src/assets/svgIcons/previous.svg +4 -0
- package/src/assets/svgIcons/profile-1.svg +4 -0
- package/src/assets/svgIcons/profile.svg +4 -0
- package/src/assets/svgIcons/profitability.svg +3 -0
- package/src/assets/svgIcons/project_analysis.svg +4 -0
- package/src/assets/svgIcons/project_settings.svg +4 -0
- package/src/assets/svgIcons/pv.svg +3 -0
- package/src/assets/svgIcons/quotations.svg +6 -0
- package/src/assets/svgIcons/rotate_view.svg +5 -0
- package/src/assets/svgIcons/run_simulation.svg +3 -0
- package/src/assets/svgIcons/scaling_tool.svg +8 -0
- package/src/assets/svgIcons/search.svg +3 -0
- package/src/assets/svgIcons/security.svg +3 -0
- package/src/assets/svgIcons/settings.svg +3 -0
- package/src/assets/svgIcons/show_in_a_new_tab.svg +12 -0
- package/src/assets/svgIcons/smartphone.svg +4 -0
- package/src/assets/svgIcons/solar_calc.svg +13 -0
- package/src/assets/svgIcons/sorting.svg +4 -0
- package/src/assets/svgIcons/start_of_the_list.svg +5 -0
- package/src/assets/svgIcons/strikethrough.svg +4 -0
- package/src/assets/svgIcons/subsidies-1.svg +5 -0
- package/src/assets/svgIcons/subsidies-2.svg +3 -0
- package/src/assets/svgIcons/subsidies.svg +3 -0
- package/src/assets/svgIcons/subtract_icon.svg +3 -0
- package/src/assets/svgIcons/suitcase.svg +3 -0
- package/src/assets/svgIcons/template_icon_not_clickable.svg +6 -0
- package/src/assets/svgIcons/truck.svg +3 -0
- package/src/assets/svgIcons/underlined.svg +3 -0
- package/src/assets/svgIcons/uparrow.svg +3 -0
- package/src/assets/svgIcons/upload_avatar-1.svg +12 -0
- package/src/assets/svgIcons/upload_avatar.svg +5 -0
- package/src/assets/svgIcons/upload_image.svg +8 -0
- package/src/assets/svgIcons/virtual_storage.svg +4 -0
- package/src/assets/svgIcons/warning.svg +4 -0
- package/src/assets/svgIcons/way.svg +5 -0
- package/src/assets/svgIcons/wifi.svg +3 -0
- package/src/assets/svgIcons/winter.svg +3 -0
- package/src/components/icon/Icons.stories.js +41 -0
- package/src/components/icon/iconCollection.vue +68 -0
- package/src/components/icon/index.vue +76 -0
- package/src/components/inputs/inputNumber/index.vue +80 -71
- package/src/components/inputs/textAreaInput/index.vue +39 -37
- package/src/components/modals/modal/index.vue +22 -6
- package/src/components/modals/modal/modal.stories.js +2 -1
- package/src/components/spinner/index.vue +20 -13
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<wrapper :isDisabled="isDisabled" :size="size">
|
|
3
|
+
<icon-image
|
|
4
|
+
:size="size"
|
|
5
|
+
:color="color"
|
|
6
|
+
:hoveredColor="hoveredColor"
|
|
7
|
+
v-html="
|
|
8
|
+
require(`!html-loader!./../../assets/svgIcons/${name.toLowerCase()}.svg`)
|
|
9
|
+
"
|
|
10
|
+
></icon-image>
|
|
11
|
+
</wrapper>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script>
|
|
15
|
+
// import Icon from "@eturnity/eturnity_reusable_components/src/components/icon"
|
|
16
|
+
// How to use:
|
|
17
|
+
//<icon
|
|
18
|
+
// name="House" //required. a svg file named [name].svg should be present in /assets/svgIcons
|
|
19
|
+
// color="red"
|
|
20
|
+
// hoveredColor="blue"
|
|
21
|
+
// size="60px" by default, this is 30px
|
|
22
|
+
// />
|
|
23
|
+
|
|
24
|
+
import styled from 'vue-styled-components'
|
|
25
|
+
|
|
26
|
+
const wrapperAttrs = { isDisabled: Boolean, size: String }
|
|
27
|
+
const Wrapper = styled('div', wrapperAttrs)`
|
|
28
|
+
display: inline-block;
|
|
29
|
+
width: ${(props) => props.size};
|
|
30
|
+
height: ${(props) => props.size};
|
|
31
|
+
cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'pointer')};
|
|
32
|
+
`
|
|
33
|
+
const IconImageProps = { color: String, hoveredColor: String, size: String }
|
|
34
|
+
const IconImage = styled('div', IconImageProps)`
|
|
35
|
+
svg {
|
|
36
|
+
width: ${(props) => props.size};
|
|
37
|
+
height: ${(props) => props.size};
|
|
38
|
+
}
|
|
39
|
+
svg > path {
|
|
40
|
+
${(props) => props.color && `fill: ${props.color};`}
|
|
41
|
+
}
|
|
42
|
+
&:hover > svg > path {
|
|
43
|
+
${(props) => props.hoveredColor && `fill: ${props.hoveredColor};`}
|
|
44
|
+
}
|
|
45
|
+
`
|
|
46
|
+
|
|
47
|
+
export default {
|
|
48
|
+
name: 'icon',
|
|
49
|
+
components: {
|
|
50
|
+
Wrapper,
|
|
51
|
+
IconImage
|
|
52
|
+
},
|
|
53
|
+
props: {
|
|
54
|
+
isDisabled: {
|
|
55
|
+
required: false,
|
|
56
|
+
default: false
|
|
57
|
+
},
|
|
58
|
+
name: {
|
|
59
|
+
required: true
|
|
60
|
+
},
|
|
61
|
+
color: {
|
|
62
|
+
required: false
|
|
63
|
+
},
|
|
64
|
+
hoveredColor: {
|
|
65
|
+
required: false
|
|
66
|
+
},
|
|
67
|
+
size: {
|
|
68
|
+
required: false,
|
|
69
|
+
default: '30px'
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
data() {
|
|
73
|
+
return {}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
</script>
|
|
@@ -14,9 +14,10 @@
|
|
|
14
14
|
</label-wrapper>
|
|
15
15
|
<input-wrapper>
|
|
16
16
|
<input-container
|
|
17
|
+
v-bind="$attrs"
|
|
17
18
|
ref="inputField1"
|
|
18
19
|
:hasUnit="unitName && !!unitName.length"
|
|
19
|
-
:placeholder="
|
|
20
|
+
:placeholder="displayedPlaceholder"
|
|
20
21
|
:isError="isError"
|
|
21
22
|
:inputWidth="inputWidth"
|
|
22
23
|
:minWidth="minWidth"
|
|
@@ -30,6 +31,7 @@
|
|
|
30
31
|
:textAlign="textAlign"
|
|
31
32
|
:fontSize="fontSize"
|
|
32
33
|
:fontColor="fontColor"
|
|
34
|
+
v-on="$listeners"
|
|
33
35
|
/>
|
|
34
36
|
<unit-container
|
|
35
37
|
v-if="unitName && showLinearUnitName"
|
|
@@ -68,12 +70,12 @@
|
|
|
68
70
|
// :minNumber="0"
|
|
69
71
|
// fontColor="blue"
|
|
70
72
|
// />
|
|
71
|
-
import styled from
|
|
73
|
+
import styled from 'vue-styled-components'
|
|
72
74
|
import {
|
|
73
75
|
stringToNumber,
|
|
74
|
-
numberToString
|
|
75
|
-
} from
|
|
76
|
-
import InfoText from
|
|
76
|
+
numberToString
|
|
77
|
+
} from '../../../helpers/numberConverter'
|
|
78
|
+
import InfoText from '../../infoText'
|
|
77
79
|
|
|
78
80
|
const Container = styled.div`
|
|
79
81
|
width: 100%;
|
|
@@ -89,31 +91,31 @@ const inputProps = {
|
|
|
89
91
|
noBorder: Boolean,
|
|
90
92
|
textAlign: String,
|
|
91
93
|
fontSize: String,
|
|
92
|
-
fontColor: String
|
|
94
|
+
fontColor: String
|
|
93
95
|
}
|
|
94
|
-
const InputContainer = styled(
|
|
96
|
+
const InputContainer = styled('input', inputProps)`
|
|
95
97
|
border: ${(props) =>
|
|
96
98
|
props.isError
|
|
97
|
-
?
|
|
99
|
+
? '1px solid ' + props.theme.colors.red
|
|
98
100
|
: props.noBorder
|
|
99
|
-
?
|
|
100
|
-
:
|
|
101
|
+
? 'none'
|
|
102
|
+
: '1px solid ' + props.theme.colors.mediumGray};
|
|
101
103
|
padding: ${(props) =>
|
|
102
|
-
props.hasUnit ?
|
|
104
|
+
props.hasUnit ? '11px 40px 11px 10px' : '11px 5px 11px 10px'};
|
|
103
105
|
border-radius: 4px;
|
|
104
106
|
text-align: ${(props) => props.textAlign};
|
|
105
|
-
cursor: ${(props) => (props.isDisabled ?
|
|
106
|
-
font-size: ${(props) => (props.fontSize ? props.fontSize :
|
|
107
|
+
cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'auto')};
|
|
108
|
+
font-size: ${(props) => (props.fontSize ? props.fontSize : '13px')};
|
|
107
109
|
color: ${(props) =>
|
|
108
110
|
props.isError
|
|
109
111
|
? props.theme.colors.red
|
|
110
112
|
: props.fontColor
|
|
111
|
-
? props.fontColor +
|
|
113
|
+
? props.fontColor + ' !important'
|
|
112
114
|
: props.theme.colors.black};
|
|
113
|
-
width: ${(props) => (props.inputWidth ? props.inputWidth :
|
|
114
|
-
min-width: ${(props) => (props.minWidth ? props.minWidth :
|
|
115
|
+
width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
|
|
116
|
+
min-width: ${(props) => (props.minWidth ? props.minWidth : 'unset')};
|
|
115
117
|
background-color: ${(props) =>
|
|
116
|
-
props.isDisabled ? props.theme.colors.grey5 :
|
|
118
|
+
props.isDisabled ? props.theme.colors.grey5 : '#fff'};
|
|
117
119
|
box-sizing: border-box;
|
|
118
120
|
|
|
119
121
|
&::placeholder {
|
|
@@ -130,7 +132,7 @@ const InputWrapper = styled.span`
|
|
|
130
132
|
position: relative;
|
|
131
133
|
`
|
|
132
134
|
|
|
133
|
-
const UnitContainer = styled(
|
|
135
|
+
const UnitContainer = styled('span', inputProps)`
|
|
134
136
|
border-left: 1px solid
|
|
135
137
|
${(props) =>
|
|
136
138
|
props.isError
|
|
@@ -169,7 +171,7 @@ const LabelText = styled.div`
|
|
|
169
171
|
`
|
|
170
172
|
|
|
171
173
|
export default {
|
|
172
|
-
name:
|
|
174
|
+
name: 'input-number',
|
|
173
175
|
components: {
|
|
174
176
|
Container,
|
|
175
177
|
InputContainer,
|
|
@@ -178,131 +180,138 @@ export default {
|
|
|
178
180
|
ErrorMessage,
|
|
179
181
|
LabelWrapper,
|
|
180
182
|
LabelText,
|
|
181
|
-
InfoText
|
|
183
|
+
InfoText
|
|
182
184
|
},
|
|
185
|
+
inheritAttrs: false,
|
|
183
186
|
data() {
|
|
184
187
|
return {
|
|
185
|
-
textInput:
|
|
186
|
-
isFocused: false
|
|
188
|
+
textInput: '',
|
|
189
|
+
isFocused: false
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
computed: {
|
|
193
|
+
displayedPlaceholder() {
|
|
194
|
+
if (this.placeholder) return this.placeholder
|
|
195
|
+
return `${this.minNumber || 0} ${this.unitName ? this.unitName : ''}`
|
|
187
196
|
}
|
|
188
197
|
},
|
|
189
198
|
props: {
|
|
190
199
|
placeholder: {
|
|
191
200
|
required: false,
|
|
192
|
-
default:
|
|
201
|
+
default: ''
|
|
193
202
|
},
|
|
194
203
|
isError: {
|
|
195
204
|
required: false,
|
|
196
|
-
default: false
|
|
205
|
+
default: false
|
|
197
206
|
},
|
|
198
207
|
inputWidth: {
|
|
199
208
|
required: false,
|
|
200
|
-
default: null
|
|
209
|
+
default: null
|
|
201
210
|
},
|
|
202
211
|
minWidth: {
|
|
203
212
|
required: false,
|
|
204
|
-
default: null
|
|
213
|
+
default: null
|
|
205
214
|
},
|
|
206
215
|
value: {
|
|
207
216
|
required: true,
|
|
208
|
-
default: null
|
|
217
|
+
default: null
|
|
209
218
|
},
|
|
210
219
|
clearInput: {
|
|
211
220
|
required: false,
|
|
212
|
-
default: false
|
|
221
|
+
default: false
|
|
213
222
|
},
|
|
214
223
|
errorMessage: {
|
|
215
224
|
required: false,
|
|
216
|
-
default:
|
|
225
|
+
default: 'Please insert a correct number'
|
|
217
226
|
},
|
|
218
227
|
numberPrecision: {
|
|
219
228
|
required: false,
|
|
220
|
-
default: 0
|
|
229
|
+
default: 0
|
|
221
230
|
},
|
|
222
231
|
unitName: {
|
|
223
232
|
required: false,
|
|
224
|
-
default:
|
|
233
|
+
default: ''
|
|
225
234
|
},
|
|
226
235
|
showLinearUnitName: {
|
|
227
236
|
required: false,
|
|
228
|
-
default: false
|
|
237
|
+
default: false
|
|
229
238
|
},
|
|
230
239
|
disabled: {
|
|
231
240
|
required: false,
|
|
232
|
-
default: false
|
|
241
|
+
default: false
|
|
233
242
|
},
|
|
234
243
|
noBorder: {
|
|
235
244
|
required: false,
|
|
236
|
-
default: false
|
|
245
|
+
default: false
|
|
237
246
|
},
|
|
238
247
|
textAlign: {
|
|
239
248
|
required: false,
|
|
240
|
-
default:
|
|
249
|
+
default: 'left'
|
|
241
250
|
},
|
|
242
251
|
fontSize: {
|
|
243
252
|
required: false,
|
|
244
|
-
default:
|
|
253
|
+
default: '13px'
|
|
245
254
|
},
|
|
246
255
|
labelText: {
|
|
247
256
|
required: false,
|
|
248
|
-
default: null
|
|
257
|
+
default: null
|
|
249
258
|
},
|
|
250
259
|
labelInfoText: {
|
|
251
260
|
required: false,
|
|
252
|
-
default: null
|
|
261
|
+
default: null
|
|
253
262
|
},
|
|
254
263
|
labelInfoAlign: {
|
|
255
264
|
required: false,
|
|
256
|
-
default:
|
|
265
|
+
default: 'right'
|
|
257
266
|
},
|
|
258
267
|
minNumber: {
|
|
259
268
|
required: false,
|
|
260
|
-
default: null
|
|
269
|
+
default: null
|
|
261
270
|
},
|
|
262
271
|
fontColor: {
|
|
263
272
|
required: false,
|
|
264
|
-
default: null
|
|
273
|
+
default: null
|
|
265
274
|
},
|
|
266
275
|
numberToStringEnabled: {
|
|
267
276
|
required: false,
|
|
268
|
-
default: true
|
|
269
|
-
}
|
|
277
|
+
default: true
|
|
278
|
+
}
|
|
270
279
|
},
|
|
271
280
|
methods: {
|
|
272
281
|
onChangeHandler(event) {
|
|
273
282
|
if (isNaN(event)) {
|
|
274
283
|
event = this.minNumber || this.minNumber === 0 ? this.minNumber : event
|
|
275
284
|
}
|
|
276
|
-
this.$emit(
|
|
285
|
+
this.$emit('input-change', event)
|
|
277
286
|
},
|
|
278
287
|
onEvaluateCode(val) {
|
|
279
288
|
// function to perform math on the code
|
|
280
289
|
// filter the string in case of any malicious content
|
|
281
|
-
let filtered = val.replace(/[^-()\d/*+.,]/g,
|
|
290
|
+
let filtered = val.replace(/[^-()\d/*+.,]/g, '')
|
|
282
291
|
filtered = filtered.split(/([-+*/()])/)
|
|
283
292
|
let formatted = filtered.map((item) => {
|
|
284
293
|
if (
|
|
285
|
-
item ===
|
|
286
|
-
item ===
|
|
287
|
-
item ===
|
|
288
|
-
item ===
|
|
289
|
-
item ===
|
|
290
|
-
item ===
|
|
291
|
-
item ===
|
|
294
|
+
item === '+' ||
|
|
295
|
+
item === '-' ||
|
|
296
|
+
item === '*' ||
|
|
297
|
+
item === '/' ||
|
|
298
|
+
item === '(' ||
|
|
299
|
+
item === ')' ||
|
|
300
|
+
item === ''
|
|
292
301
|
) {
|
|
293
302
|
return item
|
|
294
303
|
} else {
|
|
295
304
|
let num = stringToNumber({
|
|
296
305
|
value: item,
|
|
297
|
-
numberPrecision: false
|
|
306
|
+
numberPrecision: false
|
|
298
307
|
})
|
|
299
308
|
return num
|
|
300
309
|
}
|
|
301
310
|
})
|
|
302
|
-
let evaluated = eval(formatted.join(
|
|
311
|
+
let evaluated = eval(formatted.join('')) || ''
|
|
303
312
|
evaluated = stringToNumber({
|
|
304
313
|
value: evaluated,
|
|
305
|
-
numberPrecision: this.numberPrecision
|
|
314
|
+
numberPrecision: this.numberPrecision
|
|
306
315
|
})
|
|
307
316
|
return evaluated
|
|
308
317
|
},
|
|
@@ -315,7 +324,7 @@ export default {
|
|
|
315
324
|
this.textInput = numberToString({
|
|
316
325
|
value:
|
|
317
326
|
evaluatedInput && value.length ? evaluatedInput : this.minNumber,
|
|
318
|
-
numberPrecision: this.numberPrecision
|
|
327
|
+
numberPrecision: this.numberPrecision
|
|
319
328
|
})
|
|
320
329
|
}
|
|
321
330
|
let adjustedMinValue =
|
|
@@ -323,8 +332,8 @@ export default {
|
|
|
323
332
|
? value
|
|
324
333
|
: this.minNumber || this.minNumber === 0
|
|
325
334
|
? this.minNumber
|
|
326
|
-
:
|
|
327
|
-
this.$emit(
|
|
335
|
+
: ''
|
|
336
|
+
this.$emit('input-blur', adjustedMinValue)
|
|
328
337
|
},
|
|
329
338
|
focusInput() {
|
|
330
339
|
if (this.disabled) {
|
|
@@ -341,38 +350,38 @@ export default {
|
|
|
341
350
|
? value
|
|
342
351
|
: this.minNumber || this.minNumber === 0
|
|
343
352
|
? this.minNumber
|
|
344
|
-
:
|
|
353
|
+
: ''
|
|
345
354
|
if ((adjustedMinValue || adjustedMinValue === 0) && !this.isFocused) {
|
|
346
355
|
let input = this.numberToStringEnabled
|
|
347
356
|
? numberToString({
|
|
348
357
|
value: adjustedMinValue,
|
|
349
|
-
numberPrecision: this.numberPrecision
|
|
358
|
+
numberPrecision: this.numberPrecision
|
|
350
359
|
})
|
|
351
360
|
: adjustedMinValue
|
|
352
|
-
let unit = this.showLinearUnitName ?
|
|
353
|
-
return input +
|
|
361
|
+
let unit = this.showLinearUnitName ? '' : this.unitName
|
|
362
|
+
return input + ' ' + unit
|
|
354
363
|
} else if (!adjustedMinValue && adjustedMinValue !== 0) {
|
|
355
|
-
return
|
|
364
|
+
return ''
|
|
356
365
|
} else {
|
|
357
366
|
return this.numberToStringEnabled
|
|
358
367
|
? numberToString({
|
|
359
368
|
value: adjustedMinValue,
|
|
360
|
-
numberPrecision: this.numberPrecision
|
|
369
|
+
numberPrecision: this.numberPrecision
|
|
361
370
|
})
|
|
362
371
|
: adjustedMinValue
|
|
363
372
|
}
|
|
364
|
-
}
|
|
373
|
+
}
|
|
365
374
|
},
|
|
366
375
|
created() {
|
|
367
376
|
if (this.value) {
|
|
368
377
|
this.textInput = numberToString({
|
|
369
378
|
value: this.value,
|
|
370
|
-
numberPrecision: this.numberPrecision
|
|
379
|
+
numberPrecision: this.numberPrecision
|
|
371
380
|
})
|
|
372
381
|
} else if (this.minNumber !== null) {
|
|
373
382
|
this.textInput = numberToString({
|
|
374
383
|
value: this.minNumber,
|
|
375
|
-
numberPrecision: this.numberPrecision
|
|
384
|
+
numberPrecision: this.numberPrecision
|
|
376
385
|
})
|
|
377
386
|
}
|
|
378
387
|
},
|
|
@@ -380,9 +389,9 @@ export default {
|
|
|
380
389
|
clearInput: function (value) {
|
|
381
390
|
if (value) {
|
|
382
391
|
// If the value is typed, then we should clear the textInput on Continue
|
|
383
|
-
this.textInput =
|
|
392
|
+
this.textInput = ''
|
|
384
393
|
}
|
|
385
|
-
}
|
|
386
|
-
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
387
396
|
}
|
|
388
|
-
</script>
|
|
397
|
+
</script>
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
:hasLabel="label && label.length > 0"
|
|
6
6
|
>
|
|
7
7
|
<label-wrapper v-if="label">
|
|
8
|
-
<input-label>{{ label }}</input-label>
|
|
8
|
+
<input-label :fontSize="fontSize">{{ label }}</input-label>
|
|
9
9
|
<info-text
|
|
10
10
|
v-if="infoTextMessage"
|
|
11
11
|
:text="infoTextMessage"
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
// alignItems="horizontal" // horizontal, vertical
|
|
46
46
|
// :isDisabled="true"
|
|
47
47
|
// />
|
|
48
|
-
import styled from
|
|
49
|
-
import InfoText from
|
|
48
|
+
import styled from 'vue-styled-components'
|
|
49
|
+
import InfoText from '../../infoText'
|
|
50
50
|
|
|
51
51
|
const containerProps = { inputWidth: String }
|
|
52
|
-
const Container = styled(
|
|
53
|
-
width: ${(props) => (props.inputWidth ? props.inputWidth :
|
|
52
|
+
const Container = styled('div', containerProps)`
|
|
53
|
+
width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
|
|
54
54
|
position: relative;
|
|
55
55
|
margin-bottom: 20px;
|
|
56
56
|
`
|
|
@@ -66,22 +66,22 @@ const inputProps = {
|
|
|
66
66
|
isError: Boolean,
|
|
67
67
|
disabled: Boolean,
|
|
68
68
|
fontSize: String,
|
|
69
|
-
inputWidth: String
|
|
69
|
+
inputWidth: String
|
|
70
70
|
}
|
|
71
|
-
const InputContainer = styled(
|
|
71
|
+
const InputContainer = styled('textarea', inputProps)`
|
|
72
72
|
border: ${(props) =>
|
|
73
73
|
props.isError
|
|
74
|
-
?
|
|
75
|
-
:
|
|
74
|
+
? '1px solid ' + props.theme.colors.red
|
|
75
|
+
: '1px solid ' + props.theme.colors.mediumGray};
|
|
76
76
|
padding: ${(props) =>
|
|
77
|
-
props.hasUnit ?
|
|
77
|
+
props.hasUnit ? '11px 40px 11px 10px' : '11px 5px 11px 10px'};
|
|
78
78
|
border-radius: 4px;
|
|
79
|
-
font-size: ${(props) => (props.fontSize ? props.fontSize :
|
|
79
|
+
font-size: ${(props) => (props.fontSize ? props.fontSize : '16px')};
|
|
80
80
|
color: ${(props) => props.theme.colors.black};
|
|
81
|
-
width: ${(props) => (props.inputWidth ? props.inputWidth :
|
|
81
|
+
width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
|
|
82
82
|
max-width: 100%;
|
|
83
83
|
box-sizing: border-box; // to allow width of 100% with padding
|
|
84
|
-
cursor: ${(props) => (props.disabled ?
|
|
84
|
+
cursor: ${(props) => (props.disabled ? 'not-allowed' : 'inherit')};
|
|
85
85
|
|
|
86
86
|
&::placeholder {
|
|
87
87
|
color: ${(props) =>
|
|
@@ -94,17 +94,17 @@ const InputContainer = styled("textarea", inputProps)`
|
|
|
94
94
|
`
|
|
95
95
|
|
|
96
96
|
const inputAttrs = { alignItems: String, hasLabel: Boolean }
|
|
97
|
-
const InputWrapper = styled(
|
|
97
|
+
const InputWrapper = styled('div', inputAttrs)`
|
|
98
98
|
position: relative;
|
|
99
99
|
display: grid;
|
|
100
100
|
align-items: center;
|
|
101
101
|
gap: 8px;
|
|
102
102
|
grid-template-columns: ${(props) =>
|
|
103
103
|
!props.hasLabel
|
|
104
|
-
?
|
|
105
|
-
: props.alignItems ===
|
|
106
|
-
?
|
|
107
|
-
:
|
|
104
|
+
? '1fr'
|
|
105
|
+
: props.alignItems === 'vertical'
|
|
106
|
+
? '1fr'
|
|
107
|
+
: 'auto 1fr'};
|
|
108
108
|
`
|
|
109
109
|
|
|
110
110
|
const ErrorMessage = styled.div`
|
|
@@ -114,12 +114,14 @@ const ErrorMessage = styled.div`
|
|
|
114
114
|
top: calc(100% + 1px);
|
|
115
115
|
`
|
|
116
116
|
|
|
117
|
-
const
|
|
117
|
+
const labelAttrs = { fontSize: String }
|
|
118
|
+
const InputLabel = styled('div', labelAttrs)`
|
|
118
119
|
font-weight: bold;
|
|
120
|
+
font-size: ${(props) => (props.fontSize ? props.fontSize : '16px')};
|
|
119
121
|
`
|
|
120
122
|
|
|
121
123
|
export default {
|
|
122
|
-
name:
|
|
124
|
+
name: 'text-area-input',
|
|
123
125
|
components: {
|
|
124
126
|
Container,
|
|
125
127
|
InputContainer,
|
|
@@ -127,61 +129,61 @@ export default {
|
|
|
127
129
|
ErrorMessage,
|
|
128
130
|
InfoText,
|
|
129
131
|
LabelWrapper,
|
|
130
|
-
InputLabel
|
|
132
|
+
InputLabel
|
|
131
133
|
},
|
|
132
134
|
props: {
|
|
133
135
|
placeholder: {
|
|
134
136
|
required: false,
|
|
135
|
-
default:
|
|
137
|
+
default: ''
|
|
136
138
|
},
|
|
137
139
|
isError: {
|
|
138
140
|
required: false,
|
|
139
|
-
default: false
|
|
141
|
+
default: false
|
|
140
142
|
},
|
|
141
143
|
rowHeight: {
|
|
142
144
|
required: false,
|
|
143
|
-
default:
|
|
145
|
+
default: '2'
|
|
144
146
|
},
|
|
145
147
|
value: {
|
|
146
148
|
required: true,
|
|
147
|
-
default: null
|
|
149
|
+
default: null
|
|
148
150
|
},
|
|
149
151
|
errorText: {
|
|
150
|
-
required: false
|
|
152
|
+
required: false
|
|
151
153
|
},
|
|
152
154
|
isDisabled: {
|
|
153
155
|
required: false,
|
|
154
|
-
default: false
|
|
156
|
+
default: false
|
|
155
157
|
},
|
|
156
158
|
alignItems: {
|
|
157
159
|
required: false,
|
|
158
|
-
default:
|
|
160
|
+
default: 'horizontal'
|
|
159
161
|
},
|
|
160
162
|
infoTextMessage: {
|
|
161
|
-
required: false
|
|
163
|
+
required: false
|
|
162
164
|
},
|
|
163
165
|
infoTextAlign: {
|
|
164
|
-
required: false
|
|
166
|
+
required: false
|
|
165
167
|
},
|
|
166
168
|
label: {
|
|
167
|
-
required: false
|
|
169
|
+
required: false
|
|
168
170
|
},
|
|
169
171
|
fontSize: {
|
|
170
172
|
required: false,
|
|
171
|
-
default:
|
|
173
|
+
default: '16px'
|
|
172
174
|
},
|
|
173
175
|
inputWidth: {
|
|
174
176
|
required: false,
|
|
175
|
-
default: null
|
|
176
|
-
}
|
|
177
|
+
default: null
|
|
178
|
+
}
|
|
177
179
|
},
|
|
178
180
|
methods: {
|
|
179
181
|
onChangeHandler($event) {
|
|
180
182
|
if (this.isDisabled) {
|
|
181
183
|
return
|
|
182
184
|
}
|
|
183
|
-
this.$emit(
|
|
184
|
-
}
|
|
185
|
-
}
|
|
185
|
+
this.$emit('input-change', $event)
|
|
186
|
+
}
|
|
187
|
+
}
|
|
186
188
|
}
|
|
187
189
|
</script>
|
|
@@ -3,15 +3,18 @@
|
|
|
3
3
|
:isOpen="isOpen"
|
|
4
4
|
:class="{ visible: isOpen, hidden: !isOpen }"
|
|
5
5
|
@click.native="onOutsideClose()"
|
|
6
|
+
:backdrop="backdrop"
|
|
6
7
|
>
|
|
7
8
|
<modal-container @click.stop>
|
|
8
|
-
<spinner v-if="isLoading" size="50px" :
|
|
9
|
+
<spinner v-if="isLoading" size="50px" :limitedToModal="true" />
|
|
10
|
+
<content-container :visible="!isLoading">
|
|
11
|
+
<slot />
|
|
12
|
+
</content-container>
|
|
9
13
|
<close-button
|
|
10
14
|
v-if="!hideClose"
|
|
11
15
|
@click.native="onCloseModal()"
|
|
12
16
|
class="close"
|
|
13
17
|
/>
|
|
14
|
-
<slot />
|
|
15
18
|
</modal-container>
|
|
16
19
|
</page-wrapper>
|
|
17
20
|
</template>
|
|
@@ -28,7 +31,12 @@ import styled from 'vue-styled-components'
|
|
|
28
31
|
import CloseButton from '../../buttons/closeButton'
|
|
29
32
|
import Spinner from '../../spinner'
|
|
30
33
|
|
|
31
|
-
const
|
|
34
|
+
const contentAttrs = { visible: Boolean }
|
|
35
|
+
const ContentContainer = styled('div', contentAttrs)`
|
|
36
|
+
visibility: ${(props) => (props.visible ? 'inherit' : 'hidden')};
|
|
37
|
+
`
|
|
38
|
+
|
|
39
|
+
const pageAttrs = { isOpen: Boolean, backdrop: String }
|
|
32
40
|
const PageWrapper = styled('div', pageAttrs)`
|
|
33
41
|
position: fixed;
|
|
34
42
|
display: grid;
|
|
@@ -36,7 +44,10 @@ const PageWrapper = styled('div', pageAttrs)`
|
|
|
36
44
|
left: 0;
|
|
37
45
|
width: 100%;
|
|
38
46
|
height: 100%;
|
|
39
|
-
background-color:
|
|
47
|
+
background-color: ${(props) =>
|
|
48
|
+
props.backdrop == 'dark'
|
|
49
|
+
? 'rgba(0, 0, 0, 0.4)'
|
|
50
|
+
: 'rgba(255, 255, 255, 0.9)'};
|
|
40
51
|
z-index: 99999;
|
|
41
52
|
overflow: auto;
|
|
42
53
|
|
|
@@ -98,7 +109,8 @@ export default {
|
|
|
98
109
|
PageWrapper,
|
|
99
110
|
ModalContainer,
|
|
100
111
|
CloseButton,
|
|
101
|
-
Spinner
|
|
112
|
+
Spinner,
|
|
113
|
+
ContentContainer
|
|
102
114
|
},
|
|
103
115
|
props: {
|
|
104
116
|
isOpen: {
|
|
@@ -116,6 +128,10 @@ export default {
|
|
|
116
128
|
hideClose: {
|
|
117
129
|
required: false,
|
|
118
130
|
default: false
|
|
131
|
+
},
|
|
132
|
+
backdrop: {
|
|
133
|
+
required: false,
|
|
134
|
+
default: 'white'
|
|
119
135
|
}
|
|
120
136
|
},
|
|
121
137
|
methods: {
|
|
@@ -135,4 +151,4 @@ export default {
|
|
|
135
151
|
}
|
|
136
152
|
}
|
|
137
153
|
}
|
|
138
|
-
</script>
|
|
154
|
+
</script>
|