@eturnity/eturnity_reusable_components 1.2.2-EPDM-5243.6 → 1.2.2-EPDM-3412.0
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 +2 -3
- package/src/App.vue +54 -71
- package/src/assets/icons/error_icon copy.png +0 -0
- package/src/components/errorMessage/index.vue +62 -0
- package/src/components/inputs/inputNumber/index.vue +108 -74
- package/src/assets/icons/warning_icon.svg +0 -3
- package/src/assets/svgIcons/2d_active.svg +0 -7
- package/src/assets/svgIcons/2d_inactive.svg +0 -8
- package/src/assets/svgIcons/3d_active.svg +0 -7
- package/src/assets/svgIcons/3d_inactive.svg +0 -8
- package/src/assets/svgIcons/accept.svg +0 -5
- package/src/assets/svgIcons/activate_panels_active.svg +0 -22
- package/src/assets/svgIcons/activate_panels_inactive.svg +0 -20
- package/src/assets/svgIcons/add_icon-1.svg +0 -3
- package/src/assets/svgIcons/add_icon.svg +0 -4
- package/src/assets/svgIcons/address_book.svg +0 -3
- package/src/assets/svgIcons/after_sale_as_a_service.svg +0 -6
- package/src/assets/svgIcons/all_good.svg +0 -3
- package/src/assets/svgIcons/angle_active.svg +0 -5
- package/src/assets/svgIcons/angle_inactive.svg +0 -4
- package/src/assets/svgIcons/area_active.svg +0 -11
- package/src/assets/svgIcons/area_inactive.svg +0 -26
- package/src/assets/svgIcons/arrow_down.svg +0 -3
- package/src/assets/svgIcons/arrow_left.svg +0 -4
- package/src/assets/svgIcons/arrow_right.svg +0 -4
- package/src/assets/svgIcons/arrow_up.svg +0 -3
- package/src/assets/svgIcons/attachment.svg +0 -3
- package/src/assets/svgIcons/battery.svg +0 -3
- package/src/assets/svgIcons/bell.svg +0 -3
- package/src/assets/svgIcons/bold.svg +0 -3
- package/src/assets/svgIcons/bom.svg +0 -3
- package/src/assets/svgIcons/bom_generation.svg +0 -10
- package/src/assets/svgIcons/bubble.svg +0 -3
- package/src/assets/svgIcons/bullet_list.svg +0 -8
- package/src/assets/svgIcons/calendar.svg +0 -7
- package/src/assets/svgIcons/calendar_icon.svg +0 -7
- package/src/assets/svgIcons/call.svg +0 -3
- package/src/assets/svgIcons/camera.svg +0 -3
- package/src/assets/svgIcons/car.svg +0 -3
- package/src/assets/svgIcons/cart.svg +0 -3
- package/src/assets/svgIcons/checkbox.svg +0 -3
- package/src/assets/svgIcons/clear_formatting.svg +0 -7
- package/src/assets/svgIcons/clickable_info.svg +0 -4
- package/src/assets/svgIcons/clip.svg +0 -3
- package/src/assets/svgIcons/clock.svg +0 -4
- package/src/assets/svgIcons/close_for_modals,_tool_tips.svg +0 -4
- package/src/assets/svgIcons/collapse.svg +0 -4
- package/src/assets/svgIcons/component_library.svg +0 -7
- package/src/assets/svgIcons/context_menu-1.svg +0 -6
- package/src/assets/svgIcons/context_menu-2.svg +0 -5
- package/src/assets/svgIcons/context_menu.svg +0 -5
- package/src/assets/svgIcons/context_menu_tabs.svg +0 -5
- package/src/assets/svgIcons/current_variant.svg +0 -4
- package/src/assets/svgIcons/deadline.svg +0 -4
- package/src/assets/svgIcons/delete.svg +0 -4
- package/src/assets/svgIcons/delete_area_active.svg +0 -16
- package/src/assets/svgIcons/delete_area_inactive.svg +0 -15
- package/src/assets/svgIcons/direction_active-1.svg +0 -12
- package/src/assets/svgIcons/direction_active.svg +0 -5
- package/src/assets/svgIcons/direction_inactive.svg +0 -4
- package/src/assets/svgIcons/distances_active.svg +0 -9
- package/src/assets/svgIcons/distances_inactive.svg +0 -8
- package/src/assets/svgIcons/document.svg +0 -3
- package/src/assets/svgIcons/downarrow.svg +0 -3
- package/src/assets/svgIcons/download.svg +0 -4
- package/src/assets/svgIcons/duplicate-1.svg +0 -8
- package/src/assets/svgIcons/duplicate-2.svg +0 -5
- package/src/assets/svgIcons/duplicate-3.svg +0 -3
- package/src/assets/svgIcons/duplicate.svg +0 -4
- package/src/assets/svgIcons/e-mobility_configurator.svg +0 -6
- package/src/assets/svgIcons/edit_button.svg +0 -3
- package/src/assets/svgIcons/email.svg +0 -3
- package/src/assets/svgIcons/ems-1.svg +0 -3
- package/src/assets/svgIcons/ems.svg +0 -3
- package/src/assets/svgIcons/end_of_the_list.svg +0 -5
- package/src/assets/svgIcons/erase.svg +0 -4
- package/src/assets/svgIcons/fav_icon.svg +0 -4
- package/src/assets/svgIcons/financing_for_pv-1.svg +0 -5
- package/src/assets/svgIcons/financing_for_pv-2.svg +0 -3
- package/src/assets/svgIcons/financing_for_pv.svg +0 -6
- package/src/assets/svgIcons/finish-1.svg +0 -4
- package/src/assets/svgIcons/finish.svg +0 -3
- package/src/assets/svgIcons/folder.svg +0 -3
- package/src/assets/svgIcons/heat_calc.svg +0 -7
- package/src/assets/svgIcons/house.svg +0 -3
- package/src/assets/svgIcons/initial_situation.svg +0 -3
- package/src/assets/svgIcons/intro-tour-1.svg +0 -3
- package/src/assets/svgIcons/intro-tour.svg +0 -3
- package/src/assets/svgIcons/inverter-1.svg +0 -5
- package/src/assets/svgIcons/inverter.svg +0 -3
- package/src/assets/svgIcons/italic.svg +0 -3
- package/src/assets/svgIcons/key.svg +0 -3
- package/src/assets/svgIcons/lead_marketplace.svg +0 -6
- package/src/assets/svgIcons/lead_provider.svg +0 -4
- package/src/assets/svgIcons/length_in_2d_active.svg +0 -12
- package/src/assets/svgIcons/length_in_2d_inctive.svg +0 -13
- package/src/assets/svgIcons/light_bulb.svg +0 -3
- package/src/assets/svgIcons/line_graph.svg +0 -3
- package/src/assets/svgIcons/local_subsidies.svg +0 -18
- package/src/assets/svgIcons/location.svg +0 -3
- package/src/assets/svgIcons/lock.svg +0 -3
- package/src/assets/svgIcons/loop.svg +0 -3
- package/src/assets/svgIcons/lunch.svg +0 -4
- package/src/assets/svgIcons/map_icon.svg +0 -3
- package/src/assets/svgIcons/meeting.svg +0 -6
- package/src/assets/svgIcons/move_copy.svg +0 -4
- package/src/assets/svgIcons/new_area_inactive.svg +0 -11
- package/src/assets/svgIcons/next.svg +0 -4
- package/src/assets/svgIcons/not_equal_to.svg +0 -3
- package/src/assets/svgIcons/numbered_list.svg +0 -6
- package/src/assets/svgIcons/obstacle_tool.svg +0 -13
- package/src/assets/svgIcons/pan_tool.svg +0 -12
- package/src/assets/svgIcons/panels_tool.svg +0 -8
- package/src/assets/svgIcons/pen_tool.svg +0 -4
- package/src/assets/svgIcons/picker_tool.svg +0 -4
- package/src/assets/svgIcons/picture.svg +0 -3
- package/src/assets/svgIcons/pin.svg +0 -5
- package/src/assets/svgIcons/presentation.svg +0 -3
- package/src/assets/svgIcons/previous.svg +0 -4
- package/src/assets/svgIcons/profile-1.svg +0 -4
- package/src/assets/svgIcons/profile.svg +0 -4
- package/src/assets/svgIcons/profitability.svg +0 -3
- package/src/assets/svgIcons/project_analysis.svg +0 -4
- package/src/assets/svgIcons/project_settings.svg +0 -4
- package/src/assets/svgIcons/pv.svg +0 -3
- package/src/assets/svgIcons/quotations.svg +0 -6
- package/src/assets/svgIcons/rotate_view.svg +0 -5
- package/src/assets/svgIcons/run_simulation.svg +0 -3
- package/src/assets/svgIcons/scaling_tool.svg +0 -8
- package/src/assets/svgIcons/search.svg +0 -3
- package/src/assets/svgIcons/security.svg +0 -3
- package/src/assets/svgIcons/settings.svg +0 -3
- package/src/assets/svgIcons/show_in_a_new_tab.svg +0 -12
- package/src/assets/svgIcons/smartphone.svg +0 -4
- package/src/assets/svgIcons/solar_calc.svg +0 -13
- package/src/assets/svgIcons/sorting.svg +0 -4
- package/src/assets/svgIcons/start_of_the_list.svg +0 -5
- package/src/assets/svgIcons/strikethrough.svg +0 -4
- package/src/assets/svgIcons/subsidies-1.svg +0 -5
- package/src/assets/svgIcons/subsidies-2.svg +0 -3
- package/src/assets/svgIcons/subsidies.svg +0 -3
- package/src/assets/svgIcons/subtract_icon.svg +0 -3
- package/src/assets/svgIcons/suitcase.svg +0 -3
- package/src/assets/svgIcons/template_icon_not_clickable.svg +0 -6
- package/src/assets/svgIcons/truck.svg +0 -3
- package/src/assets/svgIcons/underlined.svg +0 -3
- package/src/assets/svgIcons/uparrow.svg +0 -3
- package/src/assets/svgIcons/upload_avatar-1.svg +0 -12
- package/src/assets/svgIcons/upload_avatar.svg +0 -5
- package/src/assets/svgIcons/upload_image.svg +0 -8
- package/src/assets/svgIcons/virtual_storage.svg +0 -4
- package/src/assets/svgIcons/warning.svg +0 -4
- package/src/assets/svgIcons/way.svg +0 -5
- package/src/assets/svgIcons/wifi.svg +0 -3
- package/src/assets/svgIcons/winter.svg +0 -3
- package/src/components/icon/Icons.stories.js +0 -41
- package/src/components/icon/iconCollection.vue +0 -68
- package/src/components/icon/index.vue +0 -74
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eturnity/eturnity_reusable_components",
|
|
3
|
-
"version": "1.2.2-EPDM-
|
|
3
|
+
"version": "1.2.2-EPDM-3412.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "vue-cli-service serve",
|
|
@@ -28,8 +28,7 @@
|
|
|
28
28
|
"babel-eslint": "^10.1.0",
|
|
29
29
|
"eslint": "^6.7.2",
|
|
30
30
|
"eslint-plugin-vue": "^6.2.2",
|
|
31
|
-
"vue-template-compiler": "^2.6.11"
|
|
32
|
-
"html-loader": "^0.5.5"
|
|
31
|
+
"vue-template-compiler": "^2.6.11"
|
|
33
32
|
},
|
|
34
33
|
"eslintConfig": {
|
|
35
34
|
"root": true,
|
package/src/App.vue
CHANGED
|
@@ -56,37 +56,22 @@
|
|
|
56
56
|
:isDisabled="false"
|
|
57
57
|
/>
|
|
58
58
|
<external-button text="Click me!" minWidth="500px" />
|
|
59
|
-
<icon name="Battery" />
|
|
60
|
-
<icon name="Bubble" color="red" hoveredColor="blue" size="60px" />
|
|
61
|
-
<icon name="Call" color="red" hoveredColor="blue" size="60px" />
|
|
62
|
-
<icon name="Camera" color="yellow" hoveredColor="green" size="60px" />
|
|
63
|
-
<icon name="House" color="red" hoveredColor="blue" size="20px" />
|
|
64
|
-
<icon name="House" color="red" hoveredColor="blue" size="40px" />
|
|
65
|
-
<icon name="House" color="red" hoveredColor="blue" size="80px" />
|
|
66
|
-
<icon name="House" color="red" hoveredColor="blue" size="120px" />
|
|
67
|
-
<icon name="Area_Active" color="red" hoveredColor="blue" size="150px" />
|
|
68
|
-
<icon name="Area_Active" color="red" hoveredColor="blue" size="120px" />
|
|
69
|
-
<icon name="Area_Active" color="red" hoveredColor="blue" size="80px" />
|
|
70
|
-
<icon name="Area_Active" color="red" hoveredColor="blue" size="40px" />
|
|
71
|
-
<collection />
|
|
72
59
|
</page-container>
|
|
73
60
|
</ThemeProvider>
|
|
74
61
|
</template>
|
|
75
62
|
|
|
76
63
|
<script>
|
|
77
|
-
import { ThemeProvider } from
|
|
78
|
-
import theme from
|
|
79
|
-
import styled from
|
|
80
|
-
import MainTable from
|
|
81
|
-
import ThreeDots from
|
|
82
|
-
import Toggle from
|
|
83
|
-
import InputNumber from
|
|
84
|
-
import Checkbox from
|
|
85
|
-
import PageSubtitle from
|
|
86
|
-
import Spinner from
|
|
87
|
-
import ExternalButton from
|
|
88
|
-
import icon from '@/components/icon'
|
|
89
|
-
import collection from '@/components/icons/iconCollection'
|
|
64
|
+
import { ThemeProvider } from "vue-styled-components"
|
|
65
|
+
import theme from "./assets/theme"
|
|
66
|
+
import styled from "vue-styled-components"
|
|
67
|
+
import MainTable from "@/components/tables/mainTable"
|
|
68
|
+
import ThreeDots from "@/components/threeDots"
|
|
69
|
+
import Toggle from "@/components/inputs/toggle"
|
|
70
|
+
import InputNumber from "@/components/inputs/inputNumber"
|
|
71
|
+
import Checkbox from "@/components/inputs/checkbox"
|
|
72
|
+
import PageSubtitle from "@/components/pageSubtitle"
|
|
73
|
+
import Spinner from "@/components/spinner"
|
|
74
|
+
import ExternalButton from "@/components/buttons/externalButton"
|
|
90
75
|
// import TableDropdown from "@/components/tableDropdown"
|
|
91
76
|
|
|
92
77
|
const PageContainer = styled.div`
|
|
@@ -94,7 +79,7 @@ const PageContainer = styled.div`
|
|
|
94
79
|
`
|
|
95
80
|
|
|
96
81
|
export default {
|
|
97
|
-
name:
|
|
82
|
+
name: "App",
|
|
98
83
|
components: {
|
|
99
84
|
ThemeProvider,
|
|
100
85
|
PageContainer,
|
|
@@ -106,67 +91,65 @@ export default {
|
|
|
106
91
|
Spinner,
|
|
107
92
|
Checkbox,
|
|
108
93
|
ExternalButton,
|
|
109
|
-
collection,
|
|
110
|
-
icon
|
|
111
94
|
// TableDropdown,
|
|
112
95
|
},
|
|
113
96
|
data() {
|
|
114
97
|
return {
|
|
115
98
|
inputValue: null,
|
|
116
|
-
checkedOption:
|
|
99
|
+
checkedOption: "button_1",
|
|
117
100
|
question: {
|
|
118
101
|
number_format_precision: 4,
|
|
119
102
|
number_min_allowed: 0,
|
|
120
103
|
number_max_allowed: 10,
|
|
121
|
-
unit_short_name:
|
|
104
|
+
unit_short_name: "cm",
|
|
122
105
|
},
|
|
123
106
|
dropdownOpen: false,
|
|
124
107
|
isChecked: false,
|
|
125
108
|
listOptions: [
|
|
126
109
|
{
|
|
127
|
-
name:
|
|
128
|
-
value:
|
|
129
|
-
disabled: true
|
|
110
|
+
name: "Option 1",
|
|
111
|
+
value: "option_1",
|
|
112
|
+
disabled: true,
|
|
130
113
|
},
|
|
131
114
|
{
|
|
132
|
-
name:
|
|
133
|
-
value:
|
|
115
|
+
name: "Option 2",
|
|
116
|
+
value: "option_2",
|
|
134
117
|
},
|
|
135
118
|
{
|
|
136
|
-
name:
|
|
137
|
-
value:
|
|
119
|
+
name: "Option 3",
|
|
120
|
+
value: "option_3",
|
|
138
121
|
},
|
|
139
122
|
{
|
|
140
|
-
name:
|
|
141
|
-
value:
|
|
142
|
-
}
|
|
123
|
+
name: "Option 4",
|
|
124
|
+
value: "option_4",
|
|
125
|
+
},
|
|
143
126
|
],
|
|
144
127
|
itemOptions: [
|
|
145
128
|
{
|
|
146
|
-
display_name:
|
|
147
|
-
company_item_number:
|
|
148
|
-
model:
|
|
149
|
-
id: 1
|
|
129
|
+
display_name: "Test 1",
|
|
130
|
+
company_item_number: "123",
|
|
131
|
+
model: "BTB-2145 Long Text Long Text Long Text Long Text Long Text",
|
|
132
|
+
id: 1,
|
|
150
133
|
},
|
|
151
134
|
{
|
|
152
|
-
display_name:
|
|
153
|
-
company_item_number:
|
|
154
|
-
model:
|
|
155
|
-
id: 2
|
|
135
|
+
display_name: "Test 2",
|
|
136
|
+
company_item_number: "1234",
|
|
137
|
+
model: "BTB-123",
|
|
138
|
+
id: 2,
|
|
156
139
|
},
|
|
157
140
|
{
|
|
158
|
-
display_name:
|
|
159
|
-
company_item_number:
|
|
160
|
-
model:
|
|
161
|
-
id: 3
|
|
141
|
+
display_name: "Test 3",
|
|
142
|
+
company_item_number: "12345",
|
|
143
|
+
model: "BTB-543",
|
|
144
|
+
id: 3,
|
|
162
145
|
},
|
|
163
146
|
{
|
|
164
|
-
display_name:
|
|
165
|
-
company_item_number:
|
|
166
|
-
model:
|
|
167
|
-
id: 4
|
|
168
|
-
}
|
|
169
|
-
]
|
|
147
|
+
display_name: "Test 4",
|
|
148
|
+
company_item_number: "123456",
|
|
149
|
+
model: "BTB-4930",
|
|
150
|
+
id: 4,
|
|
151
|
+
},
|
|
152
|
+
],
|
|
170
153
|
}
|
|
171
154
|
},
|
|
172
155
|
methods: {
|
|
@@ -180,7 +163,7 @@ export default {
|
|
|
180
163
|
return this.dropdownOpen
|
|
181
164
|
},
|
|
182
165
|
onClickButton() {
|
|
183
|
-
console.log(
|
|
166
|
+
console.log("Test")
|
|
184
167
|
},
|
|
185
168
|
toggleDropdownOpen() {
|
|
186
169
|
this.dropdownOpen = !this.dropdownOpen
|
|
@@ -191,21 +174,21 @@ export default {
|
|
|
191
174
|
{
|
|
192
175
|
value: this.getComponentInfo({
|
|
193
176
|
row: this.itemOptions[0],
|
|
194
|
-
value:
|
|
195
|
-
})
|
|
177
|
+
value: "display_name",
|
|
178
|
+
}),
|
|
196
179
|
},
|
|
197
180
|
{
|
|
198
181
|
value: this.getComponentInfo({
|
|
199
182
|
row: this.itemOptions[0],
|
|
200
|
-
value:
|
|
201
|
-
})
|
|
183
|
+
value: "company_item_number",
|
|
184
|
+
}),
|
|
202
185
|
},
|
|
203
186
|
{
|
|
204
187
|
value: this.getComponentInfo({
|
|
205
188
|
row: this.itemOptions[0],
|
|
206
|
-
value:
|
|
207
|
-
})
|
|
208
|
-
}
|
|
189
|
+
value: "model",
|
|
190
|
+
}),
|
|
191
|
+
},
|
|
209
192
|
]
|
|
210
193
|
return items
|
|
211
194
|
},
|
|
@@ -216,11 +199,11 @@ export default {
|
|
|
216
199
|
} else if (row[value]) {
|
|
217
200
|
item = row[value]
|
|
218
201
|
} else {
|
|
219
|
-
item =
|
|
202
|
+
item = "-"
|
|
220
203
|
}
|
|
221
204
|
return item
|
|
222
|
-
}
|
|
223
|
-
}
|
|
205
|
+
},
|
|
206
|
+
},
|
|
224
207
|
}
|
|
225
208
|
</script>
|
|
226
209
|
|
|
@@ -230,4 +213,4 @@ body {
|
|
|
230
213
|
height: 100%;
|
|
231
214
|
margin: 0;
|
|
232
215
|
}
|
|
233
|
-
</style>
|
|
216
|
+
</style>
|
|
Binary file
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component-wrapper>
|
|
3
|
+
<text-overlay>
|
|
4
|
+
<slot></slot>
|
|
5
|
+
</text-overlay>
|
|
6
|
+
</component-wrapper>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script>
|
|
10
|
+
// import InfoText from "@eturnity/eturnity_reusable_components/src/components/infoText"
|
|
11
|
+
//To use:
|
|
12
|
+
// <error-message
|
|
13
|
+
// alignText="right" // default is left
|
|
14
|
+
// />
|
|
15
|
+
|
|
16
|
+
import styled from 'vue-styled-components'
|
|
17
|
+
|
|
18
|
+
const TextOverlay = styled.div`
|
|
19
|
+
position: absolute;
|
|
20
|
+
top: calc(100% + 13px);
|
|
21
|
+
background: ${(props) => props.theme.colors.red};
|
|
22
|
+
padding: 10px;
|
|
23
|
+
width: max-content;
|
|
24
|
+
max-width: 100%;
|
|
25
|
+
min-width: 200px;
|
|
26
|
+
font-size: 11px;
|
|
27
|
+
font-weight: 400;
|
|
28
|
+
border-radius: 4px;
|
|
29
|
+
font-family: 'Lato-Bold', Arial;
|
|
30
|
+
z-index: 99;
|
|
31
|
+
color: ${(props) => props.theme.colors.white};
|
|
32
|
+
|
|
33
|
+
:before {
|
|
34
|
+
content: '';
|
|
35
|
+
background-color: ${(props) => props.theme.colors.red};
|
|
36
|
+
position: absolute;
|
|
37
|
+
top: 2px;
|
|
38
|
+
left: 40px;
|
|
39
|
+
height: 11px;
|
|
40
|
+
width: 11px;
|
|
41
|
+
transform-origin: center center;
|
|
42
|
+
transform: translate(-2em, -0.5em) rotate(45deg);
|
|
43
|
+
}
|
|
44
|
+
`
|
|
45
|
+
|
|
46
|
+
const ComponentWrapper = styled.div`
|
|
47
|
+
display: block;
|
|
48
|
+
`
|
|
49
|
+
|
|
50
|
+
export default {
|
|
51
|
+
name: 'info-text',
|
|
52
|
+
components: {
|
|
53
|
+
TextOverlay,
|
|
54
|
+
ComponentWrapper
|
|
55
|
+
},
|
|
56
|
+
props: {},
|
|
57
|
+
methods: {},
|
|
58
|
+
data() {
|
|
59
|
+
return {}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
</script>
|
|
@@ -37,6 +37,11 @@
|
|
|
37
37
|
:isError="isError"
|
|
38
38
|
>{{ unitName }}</unit-container
|
|
39
39
|
>
|
|
40
|
+
<icon
|
|
41
|
+
v-if="(isError || inputIcon) && !showLinearUnitName"
|
|
42
|
+
:class="inputIconImageClass"
|
|
43
|
+
:src="isError ? warningIcon : inputIconImage"
|
|
44
|
+
/>
|
|
40
45
|
</input-wrapper>
|
|
41
46
|
<error-message v-if="isError">{{ errorMessage }}</error-message>
|
|
42
47
|
</container>
|
|
@@ -68,13 +73,14 @@
|
|
|
68
73
|
// :minNumber="0"
|
|
69
74
|
// fontColor="blue"
|
|
70
75
|
// />
|
|
71
|
-
import styled from
|
|
76
|
+
import styled from 'vue-styled-components'
|
|
72
77
|
import {
|
|
73
78
|
stringToNumber,
|
|
74
|
-
numberToString
|
|
75
|
-
} from
|
|
76
|
-
import InfoText from
|
|
77
|
-
|
|
79
|
+
numberToString
|
|
80
|
+
} from '../../../helpers/numberConverter'
|
|
81
|
+
import InfoText from '../../infoText'
|
|
82
|
+
import ErrorMessage from '../../errorMessage'
|
|
83
|
+
import warningIcon from '../../../assets/icons/error_icon.png'
|
|
78
84
|
const Container = styled.div`
|
|
79
85
|
width: 100%;
|
|
80
86
|
position: relative;
|
|
@@ -89,31 +95,31 @@ const inputProps = {
|
|
|
89
95
|
noBorder: Boolean,
|
|
90
96
|
textAlign: String,
|
|
91
97
|
fontSize: String,
|
|
92
|
-
fontColor: String
|
|
98
|
+
fontColor: String
|
|
93
99
|
}
|
|
94
|
-
const InputContainer = styled(
|
|
100
|
+
const InputContainer = styled('input', inputProps)`
|
|
95
101
|
border: ${(props) =>
|
|
96
102
|
props.isError
|
|
97
|
-
?
|
|
103
|
+
? '1px solid ' + props.theme.colors.red
|
|
98
104
|
: props.noBorder
|
|
99
|
-
?
|
|
100
|
-
:
|
|
105
|
+
? 'none'
|
|
106
|
+
: '1px solid ' + props.theme.colors.mediumGray};
|
|
101
107
|
padding: ${(props) =>
|
|
102
|
-
props.hasUnit ?
|
|
108
|
+
props.hasUnit ? '11px 40px 11px 10px' : '11px 5px 11px 10px'};
|
|
103
109
|
border-radius: 4px;
|
|
104
110
|
text-align: ${(props) => props.textAlign};
|
|
105
|
-
cursor: ${(props) => (props.isDisabled ?
|
|
106
|
-
font-size: ${(props) => (props.fontSize ? props.fontSize :
|
|
111
|
+
cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'auto')};
|
|
112
|
+
font-size: ${(props) => (props.fontSize ? props.fontSize : '13px')};
|
|
107
113
|
color: ${(props) =>
|
|
108
114
|
props.isError
|
|
109
115
|
? props.theme.colors.red
|
|
110
116
|
: props.fontColor
|
|
111
|
-
? props.fontColor +
|
|
117
|
+
? props.fontColor + ' !important'
|
|
112
118
|
: props.theme.colors.black};
|
|
113
|
-
width: ${(props) => (props.inputWidth ? props.inputWidth :
|
|
114
|
-
min-width: ${(props) => (props.minWidth ? props.minWidth :
|
|
119
|
+
width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
|
|
120
|
+
min-width: ${(props) => (props.minWidth ? props.minWidth : 'unset')};
|
|
115
121
|
background-color: ${(props) =>
|
|
116
|
-
props.isDisabled ? props.theme.colors.grey5 :
|
|
122
|
+
props.isDisabled ? props.theme.colors.grey5 : '#fff'};
|
|
117
123
|
box-sizing: border-box;
|
|
118
124
|
|
|
119
125
|
&::placeholder {
|
|
@@ -125,12 +131,21 @@ const InputContainer = styled("input", inputProps)`
|
|
|
125
131
|
outline: none;
|
|
126
132
|
}
|
|
127
133
|
`
|
|
134
|
+
const IconProps = {
|
|
135
|
+
inputIconHeight: String
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const Icon = styled('img', IconProps)`
|
|
139
|
+
position: absolute;
|
|
140
|
+
right: 10px;
|
|
141
|
+
top: 2px;
|
|
142
|
+
`
|
|
128
143
|
|
|
129
144
|
const InputWrapper = styled.span`
|
|
130
145
|
position: relative;
|
|
131
146
|
`
|
|
132
147
|
|
|
133
|
-
const UnitContainer = styled(
|
|
148
|
+
const UnitContainer = styled('span', inputProps)`
|
|
134
149
|
border-left: 1px solid
|
|
135
150
|
${(props) =>
|
|
136
151
|
props.isError
|
|
@@ -150,12 +165,14 @@ const UnitContainer = styled("span", inputProps)`
|
|
|
150
165
|
: props.theme.colors.mediumGray};
|
|
151
166
|
`
|
|
152
167
|
|
|
153
|
-
const ErrorMessage = styled.div`
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
168
|
+
// const ErrorMessage = styled.div`
|
|
169
|
+
// margin-top: 5px;
|
|
170
|
+
// line-height: 1;
|
|
171
|
+
// text-transform: none;
|
|
172
|
+
// font-size: 10px;
|
|
173
|
+
// color: ${(props) => props.theme.colors.red};
|
|
174
|
+
// position: absolute;
|
|
175
|
+
// `
|
|
159
176
|
|
|
160
177
|
const LabelWrapper = styled.div`
|
|
161
178
|
display: flex;
|
|
@@ -169,7 +186,7 @@ const LabelText = styled.div`
|
|
|
169
186
|
`
|
|
170
187
|
|
|
171
188
|
export default {
|
|
172
|
-
name:
|
|
189
|
+
name: 'input-number',
|
|
173
190
|
components: {
|
|
174
191
|
Container,
|
|
175
192
|
InputContainer,
|
|
@@ -179,130 +196,147 @@ export default {
|
|
|
179
196
|
LabelWrapper,
|
|
180
197
|
LabelText,
|
|
181
198
|
InfoText,
|
|
199
|
+
Icon
|
|
182
200
|
},
|
|
183
201
|
data() {
|
|
184
202
|
return {
|
|
185
|
-
textInput:
|
|
203
|
+
textInput: '',
|
|
186
204
|
isFocused: false,
|
|
205
|
+
warningIcon: warningIcon
|
|
187
206
|
}
|
|
188
207
|
},
|
|
189
208
|
props: {
|
|
190
209
|
placeholder: {
|
|
191
210
|
required: false,
|
|
192
|
-
default:
|
|
211
|
+
default: ''
|
|
193
212
|
},
|
|
194
213
|
isError: {
|
|
195
214
|
required: false,
|
|
196
|
-
default: false
|
|
215
|
+
default: false
|
|
197
216
|
},
|
|
198
217
|
inputWidth: {
|
|
199
218
|
required: false,
|
|
200
|
-
default: null
|
|
219
|
+
default: null
|
|
201
220
|
},
|
|
202
221
|
minWidth: {
|
|
203
222
|
required: false,
|
|
204
|
-
default: null
|
|
223
|
+
default: null
|
|
205
224
|
},
|
|
206
225
|
value: {
|
|
207
226
|
required: true,
|
|
208
|
-
default: null
|
|
227
|
+
default: null
|
|
209
228
|
},
|
|
210
229
|
clearInput: {
|
|
211
230
|
required: false,
|
|
212
|
-
default: false
|
|
231
|
+
default: false
|
|
213
232
|
},
|
|
214
233
|
errorMessage: {
|
|
215
234
|
required: false,
|
|
216
|
-
default:
|
|
235
|
+
default: 'Please insert a correct number'
|
|
217
236
|
},
|
|
218
237
|
numberPrecision: {
|
|
219
238
|
required: false,
|
|
220
|
-
default: 0
|
|
239
|
+
default: 0
|
|
221
240
|
},
|
|
222
241
|
unitName: {
|
|
223
242
|
required: false,
|
|
224
|
-
default:
|
|
243
|
+
default: ''
|
|
225
244
|
},
|
|
226
245
|
showLinearUnitName: {
|
|
227
246
|
required: false,
|
|
228
|
-
default: false
|
|
247
|
+
default: false
|
|
229
248
|
},
|
|
230
249
|
disabled: {
|
|
231
250
|
required: false,
|
|
232
|
-
default: false
|
|
251
|
+
default: false
|
|
233
252
|
},
|
|
234
253
|
noBorder: {
|
|
235
254
|
required: false,
|
|
236
|
-
default: false
|
|
255
|
+
default: false
|
|
237
256
|
},
|
|
238
257
|
textAlign: {
|
|
239
258
|
required: false,
|
|
240
|
-
default:
|
|
259
|
+
default: 'left'
|
|
241
260
|
},
|
|
242
261
|
fontSize: {
|
|
243
262
|
required: false,
|
|
244
|
-
default:
|
|
263
|
+
default: '13px'
|
|
245
264
|
},
|
|
246
265
|
labelText: {
|
|
247
266
|
required: false,
|
|
248
|
-
default: null
|
|
267
|
+
default: null
|
|
249
268
|
},
|
|
250
269
|
labelInfoText: {
|
|
251
270
|
required: false,
|
|
252
|
-
default: null
|
|
271
|
+
default: null
|
|
253
272
|
},
|
|
254
273
|
labelInfoAlign: {
|
|
255
274
|
required: false,
|
|
256
|
-
default:
|
|
275
|
+
default: 'right'
|
|
257
276
|
},
|
|
258
277
|
minNumber: {
|
|
259
278
|
required: false,
|
|
260
|
-
default: null
|
|
279
|
+
default: null
|
|
261
280
|
},
|
|
262
281
|
fontColor: {
|
|
263
282
|
required: false,
|
|
264
|
-
default: null
|
|
283
|
+
default: null
|
|
265
284
|
},
|
|
266
285
|
numberToStringEnabled: {
|
|
267
286
|
required: false,
|
|
268
|
-
default: true
|
|
287
|
+
default: true
|
|
269
288
|
},
|
|
289
|
+
inputIcon: {
|
|
290
|
+
require: false,
|
|
291
|
+
type: Boolean,
|
|
292
|
+
default: false
|
|
293
|
+
},
|
|
294
|
+
inputIconImage: {
|
|
295
|
+
require: false,
|
|
296
|
+
type: String,
|
|
297
|
+
default: ''
|
|
298
|
+
},
|
|
299
|
+
inputIconImageClass: {
|
|
300
|
+
require: false,
|
|
301
|
+
type: Array,
|
|
302
|
+
default: () => []
|
|
303
|
+
}
|
|
270
304
|
},
|
|
271
305
|
methods: {
|
|
272
306
|
onChangeHandler(event) {
|
|
273
307
|
if (isNaN(event)) {
|
|
274
308
|
event = this.minNumber || this.minNumber === 0 ? this.minNumber : event
|
|
275
309
|
}
|
|
276
|
-
this.$emit(
|
|
310
|
+
this.$emit('input-change', event)
|
|
277
311
|
},
|
|
278
312
|
onEvaluateCode(val) {
|
|
279
313
|
// function to perform math on the code
|
|
280
314
|
// filter the string in case of any malicious content
|
|
281
|
-
let filtered = val.replace(/[^-()\d/*+.,]/g,
|
|
315
|
+
let filtered = val.replace(/[^-()\d/*+.,]/g, '')
|
|
282
316
|
filtered = filtered.split(/([-+*/()])/)
|
|
283
317
|
let formatted = filtered.map((item) => {
|
|
284
318
|
if (
|
|
285
|
-
item ===
|
|
286
|
-
item ===
|
|
287
|
-
item ===
|
|
288
|
-
item ===
|
|
289
|
-
item ===
|
|
290
|
-
item ===
|
|
291
|
-
item ===
|
|
319
|
+
item === '+' ||
|
|
320
|
+
item === '-' ||
|
|
321
|
+
item === '*' ||
|
|
322
|
+
item === '/' ||
|
|
323
|
+
item === '(' ||
|
|
324
|
+
item === ')' ||
|
|
325
|
+
item === ''
|
|
292
326
|
) {
|
|
293
327
|
return item
|
|
294
328
|
} else {
|
|
295
329
|
let num = stringToNumber({
|
|
296
330
|
value: item,
|
|
297
|
-
numberPrecision: false
|
|
331
|
+
numberPrecision: false
|
|
298
332
|
})
|
|
299
333
|
return num
|
|
300
334
|
}
|
|
301
335
|
})
|
|
302
|
-
let evaluated = eval(formatted.join(
|
|
336
|
+
let evaluated = eval(formatted.join(''))
|
|
303
337
|
evaluated = stringToNumber({
|
|
304
338
|
value: evaluated,
|
|
305
|
-
numberPrecision: this.numberPrecision
|
|
339
|
+
numberPrecision: this.numberPrecision
|
|
306
340
|
})
|
|
307
341
|
return evaluated
|
|
308
342
|
},
|
|
@@ -315,7 +349,7 @@ export default {
|
|
|
315
349
|
this.textInput = numberToString({
|
|
316
350
|
value:
|
|
317
351
|
evaluatedInput && value.length ? evaluatedInput : this.minNumber,
|
|
318
|
-
numberPrecision: this.numberPrecision
|
|
352
|
+
numberPrecision: this.numberPrecision
|
|
319
353
|
})
|
|
320
354
|
}
|
|
321
355
|
let adjustedMinValue =
|
|
@@ -323,8 +357,8 @@ export default {
|
|
|
323
357
|
? value
|
|
324
358
|
: this.minNumber || this.minNumber === 0
|
|
325
359
|
? this.minNumber
|
|
326
|
-
:
|
|
327
|
-
this.$emit(
|
|
360
|
+
: ''
|
|
361
|
+
this.$emit('input-blur', adjustedMinValue)
|
|
328
362
|
},
|
|
329
363
|
focusInput() {
|
|
330
364
|
if (this.disabled) {
|
|
@@ -341,38 +375,38 @@ export default {
|
|
|
341
375
|
? value
|
|
342
376
|
: this.minNumber || this.minNumber === 0
|
|
343
377
|
? this.minNumber
|
|
344
|
-
:
|
|
378
|
+
: ''
|
|
345
379
|
if ((adjustedMinValue || adjustedMinValue === 0) && !this.isFocused) {
|
|
346
380
|
let input = this.numberToStringEnabled
|
|
347
381
|
? numberToString({
|
|
348
382
|
value: adjustedMinValue,
|
|
349
|
-
numberPrecision: this.numberPrecision
|
|
383
|
+
numberPrecision: this.numberPrecision
|
|
350
384
|
})
|
|
351
385
|
: adjustedMinValue
|
|
352
|
-
let unit = this.showLinearUnitName ?
|
|
353
|
-
return input +
|
|
386
|
+
let unit = this.showLinearUnitName ? '' : this.unitName
|
|
387
|
+
return input + ' ' + unit
|
|
354
388
|
} else if (!adjustedMinValue && adjustedMinValue !== 0) {
|
|
355
|
-
return
|
|
389
|
+
return ''
|
|
356
390
|
} else {
|
|
357
391
|
return this.numberToStringEnabled
|
|
358
392
|
? numberToString({
|
|
359
393
|
value: adjustedMinValue,
|
|
360
|
-
numberPrecision: this.numberPrecision
|
|
394
|
+
numberPrecision: this.numberPrecision
|
|
361
395
|
})
|
|
362
396
|
: adjustedMinValue
|
|
363
397
|
}
|
|
364
|
-
}
|
|
398
|
+
}
|
|
365
399
|
},
|
|
366
400
|
created() {
|
|
367
401
|
if (this.value) {
|
|
368
402
|
this.textInput = numberToString({
|
|
369
403
|
value: this.value,
|
|
370
|
-
numberPrecision: this.numberPrecision
|
|
404
|
+
numberPrecision: this.numberPrecision
|
|
371
405
|
})
|
|
372
406
|
} else if (this.minNumber !== null) {
|
|
373
407
|
this.textInput = numberToString({
|
|
374
408
|
value: this.minNumber,
|
|
375
|
-
numberPrecision: this.numberPrecision
|
|
409
|
+
numberPrecision: this.numberPrecision
|
|
376
410
|
})
|
|
377
411
|
}
|
|
378
412
|
},
|
|
@@ -380,9 +414,9 @@ export default {
|
|
|
380
414
|
clearInput: function (value) {
|
|
381
415
|
if (value) {
|
|
382
416
|
// If the value is typed, then we should clear the textInput on Continue
|
|
383
|
-
this.textInput =
|
|
417
|
+
this.textInput = ''
|
|
384
418
|
}
|
|
385
|
-
}
|
|
386
|
-
}
|
|
419
|
+
}
|
|
420
|
+
}
|
|
387
421
|
}
|
|
388
|
-
</script>
|
|
422
|
+
</script>
|