@eturnity/eturnity_reusable_components 1.2.15-QA03-2092022.0 → 1.2.16
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 +4 -4
- package/src/App.vue +37 -41
- package/src/components/icon/index.vue +2 -1
- package/src/components/inputs/checkbox/index.vue +44 -45
- package/src/components/inputs/inputNumber/index.vue +71 -80
- package/src/components/modals/modal/index.vue +6 -22
- package/src/components/modals/modal/modal.stories.js +1 -2
- package/src/components/spinner/index.vue +13 -20
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eturnity/eturnity_reusable_components",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.16",
|
|
4
4
|
"private": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "vue-cli-service serve",
|
|
@@ -13,8 +13,7 @@
|
|
|
13
13
|
"@vueform/slider": "1.0.5",
|
|
14
14
|
"core-js": "^3.6.5",
|
|
15
15
|
"vue": "^2.6.11",
|
|
16
|
-
"vue-styled-components": "^1.6.0"
|
|
17
|
-
"html-loader": "^0.5.5"
|
|
16
|
+
"vue-styled-components": "^1.6.0"
|
|
18
17
|
},
|
|
19
18
|
"devDependencies": {
|
|
20
19
|
"@storybook/addon-actions": "^6.2.8",
|
|
@@ -29,7 +28,8 @@
|
|
|
29
28
|
"babel-eslint": "^10.1.0",
|
|
30
29
|
"eslint": "^6.7.2",
|
|
31
30
|
"eslint-plugin-vue": "^6.2.2",
|
|
32
|
-
"vue-template-compiler": "^2.6.11"
|
|
31
|
+
"vue-template-compiler": "^2.6.11",
|
|
32
|
+
"html-loader": "^0.5.5"
|
|
33
33
|
},
|
|
34
34
|
"eslintConfig": {
|
|
35
35
|
"root": true,
|
package/src/App.vue
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<ThemeProvider :theme="getTheme()" :style="{ height: '100%' }">
|
|
3
3
|
<page-container>
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<tr>
|
|
17
|
-
<!-- <table-dropdown
|
|
4
|
+
<main-table titleText="My Table">
|
|
5
|
+
<thead>
|
|
6
|
+
<tr>
|
|
7
|
+
<th>Column 1</th>
|
|
8
|
+
<th>Column 2</th>
|
|
9
|
+
<th>Column 3</th>
|
|
10
|
+
<div />
|
|
11
|
+
</tr>
|
|
12
|
+
</thead>
|
|
13
|
+
<tbody>
|
|
14
|
+
<tr>
|
|
15
|
+
<!-- <table-dropdown
|
|
18
16
|
:colSpan="3"
|
|
19
17
|
:tableItems="getDropdownValues()"
|
|
20
18
|
@toggle-dropdown-open="toggleDropdownOpen()"
|
|
@@ -23,14 +21,14 @@
|
|
|
23
21
|
:optionItems="itemOptions"
|
|
24
22
|
:optionsDisplay="['display_name', 'company_item_number', 'model']"
|
|
25
23
|
/> -->
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
<td>Test</td>
|
|
25
|
+
<div class="icons-container">
|
|
26
|
+
<three-dots :options="listOptions" :isLoading="false" />
|
|
27
|
+
</div>
|
|
28
|
+
</tr>
|
|
29
|
+
</tbody>
|
|
30
|
+
</main-table>
|
|
31
|
+
<br />
|
|
34
32
|
<br />
|
|
35
33
|
<toggle
|
|
36
34
|
@on-toggle-change="onInputChange($event)"
|
|
@@ -43,13 +41,17 @@
|
|
|
43
41
|
/>
|
|
44
42
|
<br />
|
|
45
43
|
<input-number
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
test="koko"
|
|
51
|
-
@keydown="keydownHandler"
|
|
44
|
+
placeholder="Enter distance"
|
|
45
|
+
:numberPrecision="2"
|
|
46
|
+
:value="inputValue"
|
|
47
|
+
@input-change="onInputChange($event)"
|
|
52
48
|
/>
|
|
49
|
+
<br />
|
|
50
|
+
|
|
51
|
+
<icon name="info" color="red" size="50px" />
|
|
52
|
+
<icon name="info" color="#F00" size="50px" />
|
|
53
|
+
<icon name="info" color="blue1" size="50px" />
|
|
54
|
+
<icon name="info" color="#00F" size="50px" />
|
|
53
55
|
</page-container>
|
|
54
56
|
</ThemeProvider>
|
|
55
57
|
</template>
|
|
@@ -58,15 +60,14 @@
|
|
|
58
60
|
import { ThemeProvider } from 'vue-styled-components'
|
|
59
61
|
import theme from './assets/theme'
|
|
60
62
|
import styled from 'vue-styled-components'
|
|
61
|
-
import
|
|
62
|
-
import ThreeDots from '@/components/threeDots'
|
|
63
|
-
import Toggle from '@/components/inputs/toggle'
|
|
63
|
+
import icon from '@/components/icon'
|
|
64
64
|
import InputNumber from '@/components/inputs/inputNumber'
|
|
65
65
|
import Checkbox from '@/components/inputs/checkbox'
|
|
66
66
|
import PageSubtitle from '@/components/pageSubtitle'
|
|
67
67
|
import Spinner from '@/components/spinner'
|
|
68
68
|
import ExternalButton from '@/components/buttons/externalButton'
|
|
69
|
-
import
|
|
69
|
+
import icon from '@/components/icon'
|
|
70
|
+
import collection from '@/components/icons/iconCollection'
|
|
70
71
|
// import TableDropdown from "@/components/tableDropdown"
|
|
71
72
|
|
|
72
73
|
const PageContainer = styled.div`
|
|
@@ -82,15 +83,13 @@ export default {
|
|
|
82
83
|
ThreeDots,
|
|
83
84
|
Toggle,
|
|
84
85
|
InputNumber,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
Modal
|
|
86
|
+
icon,
|
|
87
|
+
infoText,
|
|
88
|
+
InputAnnexContainer
|
|
89
|
+
// TableDropdown,
|
|
90
90
|
},
|
|
91
91
|
data() {
|
|
92
92
|
return {
|
|
93
|
-
num: 42,
|
|
94
93
|
inputValue: null,
|
|
95
94
|
checkedOption: 'button_1',
|
|
96
95
|
question: {
|
|
@@ -149,9 +148,6 @@ export default {
|
|
|
149
148
|
}
|
|
150
149
|
},
|
|
151
150
|
methods: {
|
|
152
|
-
keydownHandler(e) {
|
|
153
|
-
console.log('test', e)
|
|
154
|
-
},
|
|
155
151
|
getTheme() {
|
|
156
152
|
return theme
|
|
157
153
|
},
|
|
@@ -37,7 +37,8 @@ const IconImage = styled('div', IconImageProps)`
|
|
|
37
37
|
height: ${(props) => props.size};
|
|
38
38
|
}
|
|
39
39
|
svg > path {
|
|
40
|
-
${(props) =>
|
|
40
|
+
${(props) =>
|
|
41
|
+
props.color && `fill: ${props.theme.colors[props.color] || props.color};`}
|
|
41
42
|
}
|
|
42
43
|
&:hover > svg > path {
|
|
43
44
|
${(props) => props.hoveredColor && `fill: ${props.hoveredColor};`}
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
// backgroundColor="red"
|
|
34
34
|
// :isDisabled="true"
|
|
35
35
|
// />
|
|
36
|
-
import styled from
|
|
36
|
+
import styled from 'vue-styled-components'
|
|
37
37
|
|
|
38
38
|
const ComponentWrapper = styled.div`
|
|
39
39
|
min-height: 18px;
|
|
@@ -45,34 +45,33 @@ const containerAttrs = {
|
|
|
45
45
|
hasLabel: Boolean,
|
|
46
46
|
backgroundColor: String,
|
|
47
47
|
isChecked: Boolean,
|
|
48
|
-
isDisabled: Boolean
|
|
48
|
+
isDisabled: Boolean
|
|
49
49
|
}
|
|
50
|
-
const Container = styled(
|
|
50
|
+
const Container = styled('label', containerAttrs)`
|
|
51
51
|
display: grid;
|
|
52
|
-
grid-template-columns: ${(props) => (props.hasLabel ?
|
|
52
|
+
grid-template-columns: ${(props) => (props.hasLabel ? '18px auto' : '18px')};
|
|
53
53
|
grid-gap: 16px;
|
|
54
54
|
align-content: center;
|
|
55
|
-
/* align-items: center; */
|
|
56
55
|
color: ${(props) => props.theme.colors.black};
|
|
57
56
|
position: relative;
|
|
58
|
-
cursor: ${(props) => (props.isDisabled ?
|
|
57
|
+
cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'pointer')};
|
|
59
58
|
font-size: 16px;
|
|
60
59
|
user-select: none;
|
|
61
60
|
|
|
62
61
|
.checkmark {
|
|
63
62
|
position: absolute;
|
|
64
63
|
height: ${(props) =>
|
|
65
|
-
props.size ===
|
|
66
|
-
?
|
|
67
|
-
: props.size ===
|
|
68
|
-
?
|
|
69
|
-
:
|
|
64
|
+
props.size === 'medium'
|
|
65
|
+
? '25px'
|
|
66
|
+
: props.size === 'small'
|
|
67
|
+
? '16px'
|
|
68
|
+
: '25px'};
|
|
70
69
|
width: ${(props) =>
|
|
71
|
-
props.size ===
|
|
72
|
-
?
|
|
73
|
-
: props.size ===
|
|
74
|
-
?
|
|
75
|
-
:
|
|
70
|
+
props.size === 'medium'
|
|
71
|
+
? '25px'
|
|
72
|
+
: props.size === 'small'
|
|
73
|
+
? '16px'
|
|
74
|
+
: '25px'};
|
|
76
75
|
background-color: ${(props) =>
|
|
77
76
|
props.isChecked
|
|
78
77
|
? props.backgroundColor
|
|
@@ -80,7 +79,7 @@ const Container = styled("label", containerAttrs)`
|
|
|
80
79
|
: props.theme.colors.green
|
|
81
80
|
: props.isDisabled
|
|
82
81
|
? props.theme.colors.lightGray
|
|
83
|
-
:
|
|
82
|
+
: '#fff'};
|
|
84
83
|
border-radius: 4px;
|
|
85
84
|
border: 1px solid
|
|
86
85
|
${(props) =>
|
|
@@ -91,34 +90,34 @@ const Container = styled("label", containerAttrs)`
|
|
|
91
90
|
: props.theme.colors.mediumGray};
|
|
92
91
|
|
|
93
92
|
&:after {
|
|
94
|
-
content:
|
|
93
|
+
content: '';
|
|
95
94
|
position: absolute;
|
|
96
|
-
display: ${(props) => (props.isChecked ?
|
|
95
|
+
display: ${(props) => (props.isChecked ? 'block' : 'none')};
|
|
97
96
|
}
|
|
98
97
|
}
|
|
99
98
|
|
|
100
99
|
.checkmark:after {
|
|
101
100
|
left: ${(props) =>
|
|
102
|
-
props.size ===
|
|
101
|
+
props.size === 'medium' ? '9px' : props.size === 'small' ? '5px' : '9px'};
|
|
103
102
|
top: ${(props) =>
|
|
104
|
-
props.size ===
|
|
103
|
+
props.size === 'medium' ? '5px' : props.size === 'small' ? '2px' : '5px'};
|
|
105
104
|
width: ${(props) =>
|
|
106
|
-
props.size ===
|
|
105
|
+
props.size === 'medium' ? '5px' : props.size === 'small' ? '3px' : '5px'};
|
|
107
106
|
height: ${(props) =>
|
|
108
|
-
props.size ===
|
|
109
|
-
?
|
|
110
|
-
: props.size ===
|
|
111
|
-
?
|
|
112
|
-
:
|
|
107
|
+
props.size === 'medium'
|
|
108
|
+
? '10px'
|
|
109
|
+
: props.size === 'small'
|
|
110
|
+
? '6px'
|
|
111
|
+
: '10px'};
|
|
113
112
|
border: solid
|
|
114
113
|
${(props) =>
|
|
115
114
|
props.checkColor ? props.checkColor : props.theme.colors.white};
|
|
116
115
|
border-width: ${(props) =>
|
|
117
|
-
props.size ===
|
|
118
|
-
?
|
|
119
|
-
: props.size ===
|
|
120
|
-
?
|
|
121
|
-
:
|
|
116
|
+
props.size === 'medium'
|
|
117
|
+
? '0 3px 3px 0'
|
|
118
|
+
: props.size === 'small'
|
|
119
|
+
? '0 2px 2px 0'
|
|
120
|
+
: '0 3px 3px 0'};
|
|
122
121
|
transform: rotate(45deg);
|
|
123
122
|
}
|
|
124
123
|
`
|
|
@@ -135,49 +134,49 @@ const InputCheckbox = styled.input`
|
|
|
135
134
|
const LabelText = styled.div`
|
|
136
135
|
font-size: 13px;
|
|
137
136
|
display: grid;
|
|
138
|
-
align-items:
|
|
137
|
+
align-items: flex-start;
|
|
139
138
|
min-height: 18px;
|
|
140
139
|
`
|
|
141
140
|
|
|
142
141
|
export default {
|
|
143
|
-
name:
|
|
142
|
+
name: 'checkbox',
|
|
144
143
|
components: {
|
|
145
144
|
ComponentWrapper,
|
|
146
145
|
Container,
|
|
147
146
|
InputCheckbox,
|
|
148
|
-
LabelText
|
|
147
|
+
LabelText
|
|
149
148
|
},
|
|
150
149
|
props: {
|
|
151
150
|
label: {
|
|
152
151
|
required: false,
|
|
153
|
-
default:
|
|
152
|
+
default: ''
|
|
154
153
|
},
|
|
155
154
|
isChecked: {
|
|
156
155
|
required: true,
|
|
157
|
-
default: false
|
|
156
|
+
default: false
|
|
158
157
|
},
|
|
159
158
|
checkColor: {
|
|
160
|
-
required: false
|
|
159
|
+
required: false
|
|
161
160
|
},
|
|
162
161
|
size: {
|
|
163
162
|
required: false,
|
|
164
|
-
default:
|
|
163
|
+
default: 'medium' // small, medium
|
|
165
164
|
},
|
|
166
165
|
backgroundColor: {
|
|
167
|
-
required: false
|
|
166
|
+
required: false
|
|
168
167
|
},
|
|
169
168
|
isDisabled: {
|
|
170
169
|
required: false,
|
|
171
|
-
default: false
|
|
172
|
-
}
|
|
170
|
+
default: false
|
|
171
|
+
}
|
|
173
172
|
},
|
|
174
173
|
methods: {
|
|
175
174
|
onChangeHandler(value) {
|
|
176
175
|
if (this.isDisabled) {
|
|
177
176
|
return
|
|
178
177
|
}
|
|
179
|
-
this.$emit(
|
|
180
|
-
}
|
|
181
|
-
}
|
|
178
|
+
this.$emit('on-event-handler', value)
|
|
179
|
+
}
|
|
180
|
+
}
|
|
182
181
|
}
|
|
183
182
|
</script>
|
|
@@ -14,10 +14,9 @@
|
|
|
14
14
|
</label-wrapper>
|
|
15
15
|
<input-wrapper>
|
|
16
16
|
<input-container
|
|
17
|
-
v-bind="$attrs"
|
|
18
17
|
ref="inputField1"
|
|
19
18
|
:hasUnit="unitName && !!unitName.length"
|
|
20
|
-
:placeholder="
|
|
19
|
+
:placeholder="placeholder"
|
|
21
20
|
:isError="isError"
|
|
22
21
|
:inputWidth="inputWidth"
|
|
23
22
|
:minWidth="minWidth"
|
|
@@ -31,7 +30,6 @@
|
|
|
31
30
|
:textAlign="textAlign"
|
|
32
31
|
:fontSize="fontSize"
|
|
33
32
|
:fontColor="fontColor"
|
|
34
|
-
v-on="$listeners"
|
|
35
33
|
/>
|
|
36
34
|
<unit-container
|
|
37
35
|
v-if="unitName && showLinearUnitName"
|
|
@@ -70,12 +68,12 @@
|
|
|
70
68
|
// :minNumber="0"
|
|
71
69
|
// fontColor="blue"
|
|
72
70
|
// />
|
|
73
|
-
import styled from
|
|
71
|
+
import styled from "vue-styled-components"
|
|
74
72
|
import {
|
|
75
73
|
stringToNumber,
|
|
76
|
-
numberToString
|
|
77
|
-
} from
|
|
78
|
-
import InfoText from
|
|
74
|
+
numberToString,
|
|
75
|
+
} from "../../../helpers/numberConverter"
|
|
76
|
+
import InfoText from "../../infoText"
|
|
79
77
|
|
|
80
78
|
const Container = styled.div`
|
|
81
79
|
width: 100%;
|
|
@@ -91,31 +89,31 @@ const inputProps = {
|
|
|
91
89
|
noBorder: Boolean,
|
|
92
90
|
textAlign: String,
|
|
93
91
|
fontSize: String,
|
|
94
|
-
fontColor: String
|
|
92
|
+
fontColor: String,
|
|
95
93
|
}
|
|
96
|
-
const InputContainer = styled(
|
|
94
|
+
const InputContainer = styled("input", inputProps)`
|
|
97
95
|
border: ${(props) =>
|
|
98
96
|
props.isError
|
|
99
|
-
?
|
|
97
|
+
? "1px solid " + props.theme.colors.red
|
|
100
98
|
: props.noBorder
|
|
101
|
-
?
|
|
102
|
-
:
|
|
99
|
+
? "none"
|
|
100
|
+
: "1px solid " + props.theme.colors.mediumGray};
|
|
103
101
|
padding: ${(props) =>
|
|
104
|
-
props.hasUnit ?
|
|
102
|
+
props.hasUnit ? "11px 40px 11px 10px" : "11px 5px 11px 10px"};
|
|
105
103
|
border-radius: 4px;
|
|
106
104
|
text-align: ${(props) => props.textAlign};
|
|
107
|
-
cursor: ${(props) => (props.isDisabled ?
|
|
108
|
-
font-size: ${(props) => (props.fontSize ? props.fontSize :
|
|
105
|
+
cursor: ${(props) => (props.isDisabled ? "not-allowed" : "auto")};
|
|
106
|
+
font-size: ${(props) => (props.fontSize ? props.fontSize : "13px")};
|
|
109
107
|
color: ${(props) =>
|
|
110
108
|
props.isError
|
|
111
109
|
? props.theme.colors.red
|
|
112
110
|
: props.fontColor
|
|
113
|
-
? props.fontColor +
|
|
111
|
+
? props.fontColor + " !important"
|
|
114
112
|
: props.theme.colors.black};
|
|
115
|
-
width: ${(props) => (props.inputWidth ? props.inputWidth :
|
|
116
|
-
min-width: ${(props) => (props.minWidth ? props.minWidth :
|
|
113
|
+
width: ${(props) => (props.inputWidth ? props.inputWidth : "100%")};
|
|
114
|
+
min-width: ${(props) => (props.minWidth ? props.minWidth : "unset")};
|
|
117
115
|
background-color: ${(props) =>
|
|
118
|
-
props.isDisabled ? props.theme.colors.grey5 :
|
|
116
|
+
props.isDisabled ? props.theme.colors.grey5 : "#fff"};
|
|
119
117
|
box-sizing: border-box;
|
|
120
118
|
|
|
121
119
|
&::placeholder {
|
|
@@ -132,7 +130,7 @@ const InputWrapper = styled.span`
|
|
|
132
130
|
position: relative;
|
|
133
131
|
`
|
|
134
132
|
|
|
135
|
-
const UnitContainer = styled(
|
|
133
|
+
const UnitContainer = styled("span", inputProps)`
|
|
136
134
|
border-left: 1px solid
|
|
137
135
|
${(props) =>
|
|
138
136
|
props.isError
|
|
@@ -171,7 +169,7 @@ const LabelText = styled.div`
|
|
|
171
169
|
`
|
|
172
170
|
|
|
173
171
|
export default {
|
|
174
|
-
name:
|
|
172
|
+
name: "input-number",
|
|
175
173
|
components: {
|
|
176
174
|
Container,
|
|
177
175
|
InputContainer,
|
|
@@ -180,138 +178,131 @@ export default {
|
|
|
180
178
|
ErrorMessage,
|
|
181
179
|
LabelWrapper,
|
|
182
180
|
LabelText,
|
|
183
|
-
InfoText
|
|
181
|
+
InfoText,
|
|
184
182
|
},
|
|
185
|
-
inheritAttrs: false,
|
|
186
183
|
data() {
|
|
187
184
|
return {
|
|
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 : ''}`
|
|
185
|
+
textInput: "",
|
|
186
|
+
isFocused: false,
|
|
196
187
|
}
|
|
197
188
|
},
|
|
198
189
|
props: {
|
|
199
190
|
placeholder: {
|
|
200
191
|
required: false,
|
|
201
|
-
default:
|
|
192
|
+
default: "",
|
|
202
193
|
},
|
|
203
194
|
isError: {
|
|
204
195
|
required: false,
|
|
205
|
-
default: false
|
|
196
|
+
default: false,
|
|
206
197
|
},
|
|
207
198
|
inputWidth: {
|
|
208
199
|
required: false,
|
|
209
|
-
default: null
|
|
200
|
+
default: null,
|
|
210
201
|
},
|
|
211
202
|
minWidth: {
|
|
212
203
|
required: false,
|
|
213
|
-
default: null
|
|
204
|
+
default: null,
|
|
214
205
|
},
|
|
215
206
|
value: {
|
|
216
207
|
required: true,
|
|
217
|
-
default: null
|
|
208
|
+
default: null,
|
|
218
209
|
},
|
|
219
210
|
clearInput: {
|
|
220
211
|
required: false,
|
|
221
|
-
default: false
|
|
212
|
+
default: false,
|
|
222
213
|
},
|
|
223
214
|
errorMessage: {
|
|
224
215
|
required: false,
|
|
225
|
-
default:
|
|
216
|
+
default: "Please insert a correct number",
|
|
226
217
|
},
|
|
227
218
|
numberPrecision: {
|
|
228
219
|
required: false,
|
|
229
|
-
default: 0
|
|
220
|
+
default: 0,
|
|
230
221
|
},
|
|
231
222
|
unitName: {
|
|
232
223
|
required: false,
|
|
233
|
-
default:
|
|
224
|
+
default: "",
|
|
234
225
|
},
|
|
235
226
|
showLinearUnitName: {
|
|
236
227
|
required: false,
|
|
237
|
-
default: false
|
|
228
|
+
default: false,
|
|
238
229
|
},
|
|
239
230
|
disabled: {
|
|
240
231
|
required: false,
|
|
241
|
-
default: false
|
|
232
|
+
default: false,
|
|
242
233
|
},
|
|
243
234
|
noBorder: {
|
|
244
235
|
required: false,
|
|
245
|
-
default: false
|
|
236
|
+
default: false,
|
|
246
237
|
},
|
|
247
238
|
textAlign: {
|
|
248
239
|
required: false,
|
|
249
|
-
default:
|
|
240
|
+
default: "left",
|
|
250
241
|
},
|
|
251
242
|
fontSize: {
|
|
252
243
|
required: false,
|
|
253
|
-
default:
|
|
244
|
+
default: "13px",
|
|
254
245
|
},
|
|
255
246
|
labelText: {
|
|
256
247
|
required: false,
|
|
257
|
-
default: null
|
|
248
|
+
default: null,
|
|
258
249
|
},
|
|
259
250
|
labelInfoText: {
|
|
260
251
|
required: false,
|
|
261
|
-
default: null
|
|
252
|
+
default: null,
|
|
262
253
|
},
|
|
263
254
|
labelInfoAlign: {
|
|
264
255
|
required: false,
|
|
265
|
-
default:
|
|
256
|
+
default: "right",
|
|
266
257
|
},
|
|
267
258
|
minNumber: {
|
|
268
259
|
required: false,
|
|
269
|
-
default: null
|
|
260
|
+
default: null,
|
|
270
261
|
},
|
|
271
262
|
fontColor: {
|
|
272
263
|
required: false,
|
|
273
|
-
default: null
|
|
264
|
+
default: null,
|
|
274
265
|
},
|
|
275
266
|
numberToStringEnabled: {
|
|
276
267
|
required: false,
|
|
277
|
-
default: true
|
|
278
|
-
}
|
|
268
|
+
default: true,
|
|
269
|
+
},
|
|
279
270
|
},
|
|
280
271
|
methods: {
|
|
281
272
|
onChangeHandler(event) {
|
|
282
273
|
if (isNaN(event)) {
|
|
283
274
|
event = this.minNumber || this.minNumber === 0 ? this.minNumber : event
|
|
284
275
|
}
|
|
285
|
-
this.$emit(
|
|
276
|
+
this.$emit("input-change", event)
|
|
286
277
|
},
|
|
287
278
|
onEvaluateCode(val) {
|
|
288
279
|
// function to perform math on the code
|
|
289
280
|
// filter the string in case of any malicious content
|
|
290
|
-
let filtered = val.replace(/[^-()\d/*+.,]/g,
|
|
281
|
+
let filtered = val.replace(/[^-()\d/*+.,]/g, "")
|
|
291
282
|
filtered = filtered.split(/([-+*/()])/)
|
|
292
283
|
let formatted = filtered.map((item) => {
|
|
293
284
|
if (
|
|
294
|
-
item ===
|
|
295
|
-
item ===
|
|
296
|
-
item ===
|
|
297
|
-
item ===
|
|
298
|
-
item ===
|
|
299
|
-
item ===
|
|
300
|
-
item ===
|
|
285
|
+
item === "+" ||
|
|
286
|
+
item === "-" ||
|
|
287
|
+
item === "*" ||
|
|
288
|
+
item === "/" ||
|
|
289
|
+
item === "(" ||
|
|
290
|
+
item === ")" ||
|
|
291
|
+
item === ""
|
|
301
292
|
) {
|
|
302
293
|
return item
|
|
303
294
|
} else {
|
|
304
295
|
let num = stringToNumber({
|
|
305
296
|
value: item,
|
|
306
|
-
numberPrecision: false
|
|
297
|
+
numberPrecision: false,
|
|
307
298
|
})
|
|
308
299
|
return num
|
|
309
300
|
}
|
|
310
301
|
})
|
|
311
|
-
let evaluated = eval(formatted.join(
|
|
302
|
+
let evaluated = eval(formatted.join(""))
|
|
312
303
|
evaluated = stringToNumber({
|
|
313
304
|
value: evaluated,
|
|
314
|
-
numberPrecision: this.numberPrecision
|
|
305
|
+
numberPrecision: this.numberPrecision,
|
|
315
306
|
})
|
|
316
307
|
return evaluated
|
|
317
308
|
},
|
|
@@ -324,7 +315,7 @@ export default {
|
|
|
324
315
|
this.textInput = numberToString({
|
|
325
316
|
value:
|
|
326
317
|
evaluatedInput && value.length ? evaluatedInput : this.minNumber,
|
|
327
|
-
numberPrecision: this.numberPrecision
|
|
318
|
+
numberPrecision: this.numberPrecision,
|
|
328
319
|
})
|
|
329
320
|
}
|
|
330
321
|
let adjustedMinValue =
|
|
@@ -332,8 +323,8 @@ export default {
|
|
|
332
323
|
? value
|
|
333
324
|
: this.minNumber || this.minNumber === 0
|
|
334
325
|
? this.minNumber
|
|
335
|
-
:
|
|
336
|
-
this.$emit(
|
|
326
|
+
: ""
|
|
327
|
+
this.$emit("input-blur", adjustedMinValue)
|
|
337
328
|
},
|
|
338
329
|
focusInput() {
|
|
339
330
|
if (this.disabled) {
|
|
@@ -350,38 +341,38 @@ export default {
|
|
|
350
341
|
? value
|
|
351
342
|
: this.minNumber || this.minNumber === 0
|
|
352
343
|
? this.minNumber
|
|
353
|
-
:
|
|
344
|
+
: ""
|
|
354
345
|
if ((adjustedMinValue || adjustedMinValue === 0) && !this.isFocused) {
|
|
355
346
|
let input = this.numberToStringEnabled
|
|
356
347
|
? numberToString({
|
|
357
348
|
value: adjustedMinValue,
|
|
358
|
-
numberPrecision: this.numberPrecision
|
|
349
|
+
numberPrecision: this.numberPrecision,
|
|
359
350
|
})
|
|
360
351
|
: adjustedMinValue
|
|
361
|
-
let unit = this.showLinearUnitName ?
|
|
362
|
-
return input +
|
|
352
|
+
let unit = this.showLinearUnitName ? "" : this.unitName
|
|
353
|
+
return input + " " + unit
|
|
363
354
|
} else if (!adjustedMinValue && adjustedMinValue !== 0) {
|
|
364
|
-
return
|
|
355
|
+
return ""
|
|
365
356
|
} else {
|
|
366
357
|
return this.numberToStringEnabled
|
|
367
358
|
? numberToString({
|
|
368
359
|
value: adjustedMinValue,
|
|
369
|
-
numberPrecision: this.numberPrecision
|
|
360
|
+
numberPrecision: this.numberPrecision,
|
|
370
361
|
})
|
|
371
362
|
: adjustedMinValue
|
|
372
363
|
}
|
|
373
|
-
}
|
|
364
|
+
},
|
|
374
365
|
},
|
|
375
366
|
created() {
|
|
376
367
|
if (this.value) {
|
|
377
368
|
this.textInput = numberToString({
|
|
378
369
|
value: this.value,
|
|
379
|
-
numberPrecision: this.numberPrecision
|
|
370
|
+
numberPrecision: this.numberPrecision,
|
|
380
371
|
})
|
|
381
372
|
} else if (this.minNumber !== null) {
|
|
382
373
|
this.textInput = numberToString({
|
|
383
374
|
value: this.minNumber,
|
|
384
|
-
numberPrecision: this.numberPrecision
|
|
375
|
+
numberPrecision: this.numberPrecision,
|
|
385
376
|
})
|
|
386
377
|
}
|
|
387
378
|
},
|
|
@@ -389,9 +380,9 @@ export default {
|
|
|
389
380
|
clearInput: function (value) {
|
|
390
381
|
if (value) {
|
|
391
382
|
// If the value is typed, then we should clear the textInput on Continue
|
|
392
|
-
this.textInput =
|
|
383
|
+
this.textInput = ""
|
|
393
384
|
}
|
|
394
|
-
}
|
|
395
|
-
}
|
|
385
|
+
},
|
|
386
|
+
},
|
|
396
387
|
}
|
|
397
|
-
</script>
|
|
388
|
+
</script>
|
|
@@ -3,18 +3,15 @@
|
|
|
3
3
|
:isOpen="isOpen"
|
|
4
4
|
:class="{ visible: isOpen, hidden: !isOpen }"
|
|
5
5
|
@click.native="onOutsideClose()"
|
|
6
|
-
:backdrop="backdrop"
|
|
7
6
|
>
|
|
8
7
|
<modal-container @click.stop>
|
|
9
|
-
<spinner v-if="isLoading" size="50px" :
|
|
10
|
-
<content-container :visible="!isLoading">
|
|
11
|
-
<slot />
|
|
12
|
-
</content-container>
|
|
8
|
+
<spinner v-if="isLoading" size="50px" :fullWidth="true" />
|
|
13
9
|
<close-button
|
|
14
10
|
v-if="!hideClose"
|
|
15
11
|
@click.native="onCloseModal()"
|
|
16
12
|
class="close"
|
|
17
13
|
/>
|
|
14
|
+
<slot />
|
|
18
15
|
</modal-container>
|
|
19
16
|
</page-wrapper>
|
|
20
17
|
</template>
|
|
@@ -31,12 +28,7 @@ import styled from 'vue-styled-components'
|
|
|
31
28
|
import CloseButton from '../../buttons/closeButton'
|
|
32
29
|
import Spinner from '../../spinner'
|
|
33
30
|
|
|
34
|
-
const
|
|
35
|
-
const ContentContainer = styled('div', contentAttrs)`
|
|
36
|
-
visibility: ${(props) => (props.visible ? 'inherit' : 'hidden')};
|
|
37
|
-
`
|
|
38
|
-
|
|
39
|
-
const pageAttrs = { isOpen: Boolean, backdrop: String }
|
|
31
|
+
const pageAttrs = { isOpen: Boolean }
|
|
40
32
|
const PageWrapper = styled('div', pageAttrs)`
|
|
41
33
|
position: fixed;
|
|
42
34
|
display: grid;
|
|
@@ -44,10 +36,7 @@ const PageWrapper = styled('div', pageAttrs)`
|
|
|
44
36
|
left: 0;
|
|
45
37
|
width: 100%;
|
|
46
38
|
height: 100%;
|
|
47
|
-
background-color:
|
|
48
|
-
props.backdrop == 'dark'
|
|
49
|
-
? 'rgba(0, 0, 0, 0.4)'
|
|
50
|
-
: 'rgba(255, 255, 255, 0.9)'};
|
|
39
|
+
background-color: rgba(255, 255, 255, 0.9);
|
|
51
40
|
z-index: 99999;
|
|
52
41
|
overflow: auto;
|
|
53
42
|
|
|
@@ -109,8 +98,7 @@ export default {
|
|
|
109
98
|
PageWrapper,
|
|
110
99
|
ModalContainer,
|
|
111
100
|
CloseButton,
|
|
112
|
-
Spinner
|
|
113
|
-
ContentContainer
|
|
101
|
+
Spinner
|
|
114
102
|
},
|
|
115
103
|
props: {
|
|
116
104
|
isOpen: {
|
|
@@ -128,10 +116,6 @@ export default {
|
|
|
128
116
|
hideClose: {
|
|
129
117
|
required: false,
|
|
130
118
|
default: false
|
|
131
|
-
},
|
|
132
|
-
backdrop: {
|
|
133
|
-
required: false,
|
|
134
|
-
default: 'white'
|
|
135
119
|
}
|
|
136
120
|
},
|
|
137
121
|
methods: {
|
|
@@ -151,4 +135,4 @@ export default {
|
|
|
151
135
|
}
|
|
152
136
|
}
|
|
153
137
|
}
|
|
154
|
-
</script>
|
|
138
|
+
</script>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
/>
|
|
8
8
|
</container>
|
|
9
9
|
</spinner-container>
|
|
10
|
-
<container v-else
|
|
10
|
+
<container v-else>
|
|
11
11
|
<spinner-wrapper
|
|
12
12
|
:size="size"
|
|
13
13
|
:src="require('../../assets/icons/black_spinner.svg')"
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
<script>
|
|
19
19
|
// import Spinner from "@eturnity/eturnity_reusable_components/src/components/spinner"
|
|
20
20
|
// <spinner size="30px" />
|
|
21
|
-
import styled from
|
|
21
|
+
import styled from "vue-styled-components"
|
|
22
22
|
|
|
23
23
|
const SpinnerContainer = styled.div`
|
|
24
24
|
position: fixed;
|
|
@@ -32,41 +32,34 @@ const SpinnerContainer = styled.div`
|
|
|
32
32
|
justify-items: center;
|
|
33
33
|
z-index: 100;
|
|
34
34
|
`
|
|
35
|
-
|
|
36
|
-
const Container = styled
|
|
35
|
+
|
|
36
|
+
const Container = styled.div`
|
|
37
37
|
display: grid;
|
|
38
38
|
align-items: center;
|
|
39
39
|
justify-items: center;
|
|
40
|
-
position: ${(props) => (props.limitedToModal ? 'absolute' : 'inherit')};
|
|
41
|
-
height: ${(props) => (props.limitedToModal ? '100%' : 'inherit')};
|
|
42
|
-
width: ${(props) => (props.limitedToModal ? '100%' : 'inherit')};
|
|
43
40
|
`
|
|
44
41
|
|
|
45
42
|
const spinnerAttrs = { size: String }
|
|
46
|
-
const SpinnerWrapper = styled(
|
|
47
|
-
width: ${(props) => (props.size ? props.size :
|
|
43
|
+
const SpinnerWrapper = styled("img", spinnerAttrs)`
|
|
44
|
+
width: ${(props) => (props.size ? props.size : "60px")};
|
|
48
45
|
`
|
|
49
46
|
|
|
50
47
|
export default {
|
|
51
|
-
name:
|
|
48
|
+
name: "spinner",
|
|
52
49
|
components: {
|
|
53
50
|
Container,
|
|
54
51
|
SpinnerWrapper,
|
|
55
|
-
SpinnerContainer
|
|
52
|
+
SpinnerContainer,
|
|
56
53
|
},
|
|
57
54
|
props: {
|
|
58
55
|
fullWidth: {
|
|
59
56
|
required: false,
|
|
60
|
-
default: false
|
|
61
|
-
},
|
|
62
|
-
limitedToModal: {
|
|
63
|
-
required: false,
|
|
64
|
-
default: false
|
|
57
|
+
default: false,
|
|
65
58
|
},
|
|
66
59
|
size: {
|
|
67
60
|
required: false,
|
|
68
|
-
default: null
|
|
69
|
-
}
|
|
70
|
-
}
|
|
61
|
+
default: null,
|
|
62
|
+
},
|
|
63
|
+
},
|
|
71
64
|
}
|
|
72
|
-
</script>
|
|
65
|
+
</script>
|