@eturnity/eturnity_reusable_components 1.2.14-QA03-2092022.4 → 1.2.15-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 +4 -4
- package/src/App.vue +38 -65
- package/src/assets/theme.js +26 -26
- package/src/components/icon/index.vue +7 -2
- package/src/components/infoText/index.vue +40 -49
- package/src/components/inputs/inputNumber/index.vue +65 -22
- 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/src/helpers/numberConverter.js +3 -0
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.15-0",
|
|
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
|
@@ -2,54 +2,37 @@
|
|
|
2
2
|
<ThemeProvider :theme="getTheme()" :style="{ height: '100%' }">
|
|
3
3
|
<page-container>
|
|
4
4
|
<br />
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
<td>Test</td>
|
|
27
|
-
<div class="icons-container">
|
|
28
|
-
<three-dots :options="listOptions" :isLoading="false" />
|
|
29
|
-
</div>
|
|
30
|
-
</tr>
|
|
31
|
-
</tbody>
|
|
32
|
-
</main-table>
|
|
33
|
-
</modal>
|
|
5
|
+
<input-number
|
|
6
|
+
:value="inputValue"
|
|
7
|
+
@input-change="inputValue = $event"
|
|
8
|
+
inputWidth="250px"
|
|
9
|
+
slotSize="50%"
|
|
10
|
+
><InputAnnexContainer>
|
|
11
|
+
<span>123m2</span>
|
|
12
|
+
<info-text size="10" text="infoText ceci est le text"></info-text>
|
|
13
|
+
</InputAnnexContainer>
|
|
14
|
+
</input-number>
|
|
15
|
+
<input-number
|
|
16
|
+
:value="inputValue"
|
|
17
|
+
@input-change="inputValue = $event"
|
|
18
|
+
inputWidth="250px"
|
|
19
|
+
slotSize="50%"
|
|
20
|
+
:isError="true"
|
|
21
|
+
><InputAnnexContainer>
|
|
22
|
+
<span>123m2</span>
|
|
23
|
+
<info-text size="15" text="infoText ceci est le text"></info-text>
|
|
24
|
+
</InputAnnexContainer>
|
|
25
|
+
</input-number>
|
|
34
26
|
<br />
|
|
35
|
-
<toggle
|
|
36
|
-
@on-toggle-change="onInputChange($event)"
|
|
37
|
-
:isChecked="inputValue"
|
|
38
|
-
label="My Label Text"
|
|
39
|
-
infoTextMessage="This is my test message"
|
|
40
|
-
infoTextAlign="right"
|
|
41
|
-
labelAlign="right"
|
|
42
|
-
:disabled="false"
|
|
43
|
-
/>
|
|
44
27
|
<br />
|
|
45
28
|
<input-number
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
/>
|
|
29
|
+
placeholder="Enter distance"
|
|
30
|
+
:numberPrecision="2"
|
|
31
|
+
:value="inputValue"
|
|
32
|
+
@input-change="onInputChange($event)"
|
|
33
|
+
>unit</input-number
|
|
34
|
+
>
|
|
35
|
+
<br />
|
|
53
36
|
</page-container>
|
|
54
37
|
</ThemeProvider>
|
|
55
38
|
</template>
|
|
@@ -58,16 +41,15 @@
|
|
|
58
41
|
import { ThemeProvider } from 'vue-styled-components'
|
|
59
42
|
import theme from './assets/theme'
|
|
60
43
|
import styled from 'vue-styled-components'
|
|
61
|
-
|
|
62
|
-
import ThreeDots from '@/components/threeDots'
|
|
63
|
-
import Toggle from '@/components/inputs/toggle'
|
|
44
|
+
|
|
64
45
|
import InputNumber from '@/components/inputs/inputNumber'
|
|
65
|
-
import
|
|
66
|
-
import PageSubtitle from '@/components/pageSubtitle'
|
|
67
|
-
import Spinner from '@/components/spinner'
|
|
68
|
-
import ExternalButton from '@/components/buttons/externalButton'
|
|
69
|
-
import Modal from '@/components/modals/modal'
|
|
46
|
+
import infoText from '@/components/infoText'
|
|
70
47
|
// import TableDropdown from "@/components/tableDropdown"
|
|
48
|
+
const InputAnnexContainer = styled.div`
|
|
49
|
+
display: grid;
|
|
50
|
+
grid-template-columns: auto auto;
|
|
51
|
+
grid-gap: 10px;
|
|
52
|
+
`
|
|
71
53
|
|
|
72
54
|
const PageContainer = styled.div`
|
|
73
55
|
padding: 40px;
|
|
@@ -78,19 +60,13 @@ export default {
|
|
|
78
60
|
components: {
|
|
79
61
|
ThemeProvider,
|
|
80
62
|
PageContainer,
|
|
81
|
-
MainTable,
|
|
82
|
-
ThreeDots,
|
|
83
|
-
Toggle,
|
|
84
63
|
InputNumber,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
ExternalButton,
|
|
89
|
-
Modal
|
|
64
|
+
infoText,
|
|
65
|
+
InputAnnexContainer
|
|
66
|
+
// TableDropdown,
|
|
90
67
|
},
|
|
91
68
|
data() {
|
|
92
69
|
return {
|
|
93
|
-
num: 42,
|
|
94
70
|
inputValue: null,
|
|
95
71
|
checkedOption: 'button_1',
|
|
96
72
|
question: {
|
|
@@ -149,9 +125,6 @@ export default {
|
|
|
149
125
|
}
|
|
150
126
|
},
|
|
151
127
|
methods: {
|
|
152
|
-
keydownHandler(e) {
|
|
153
|
-
console.log('test', e)
|
|
154
|
-
},
|
|
155
128
|
getTheme() {
|
|
156
129
|
return theme
|
|
157
130
|
},
|
package/src/assets/theme.js
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
const theme = {
|
|
2
2
|
colors: {
|
|
3
|
-
primary:
|
|
4
|
-
secondary:
|
|
5
|
-
tertiary:
|
|
6
|
-
black:
|
|
7
|
-
yellow:
|
|
8
|
-
darkGray:
|
|
9
|
-
gray1:
|
|
10
|
-
mediumGray:
|
|
11
|
-
lightGray:
|
|
12
|
-
white:
|
|
13
|
-
blue:
|
|
14
|
-
red:
|
|
15
|
-
blue1:
|
|
16
|
-
grey1:
|
|
17
|
-
grey2:
|
|
18
|
-
grey3:
|
|
19
|
-
grey4:
|
|
20
|
-
grey5:
|
|
21
|
-
green:
|
|
22
|
-
disabled:
|
|
3
|
+
primary: "#48a2d0",
|
|
4
|
+
secondary: "#fdb813",
|
|
5
|
+
tertiary: "#d5d5d5",
|
|
6
|
+
black: "#353535",
|
|
7
|
+
yellow: "#fdb813",
|
|
8
|
+
darkGray: "#818181",
|
|
9
|
+
gray1: "#666",
|
|
10
|
+
mediumGray: "#d5d5d5",
|
|
11
|
+
lightGray: "#f2f2f2",
|
|
12
|
+
white: "#fff",
|
|
13
|
+
blue: "#48a2d0",
|
|
14
|
+
red: "#ff5656",
|
|
15
|
+
blue1: "#e4efff",
|
|
16
|
+
grey1: "#666",
|
|
17
|
+
grey2: "#c4c4c4",
|
|
18
|
+
grey3: "#b2b9c5",
|
|
19
|
+
grey4: "#ebeef4",
|
|
20
|
+
grey5: "#fafafa",
|
|
21
|
+
green: "#99db0c",
|
|
22
|
+
disabled: "#dfe1e1",
|
|
23
23
|
},
|
|
24
24
|
screen: {
|
|
25
|
-
mobileSmall:
|
|
26
|
-
mobile:
|
|
27
|
-
mobileLarge:
|
|
28
|
-
tablet:
|
|
29
|
-
tabletLarge:
|
|
25
|
+
mobileSmall: "345px",
|
|
26
|
+
mobile: "425px",
|
|
27
|
+
mobileLarge: "530px",
|
|
28
|
+
tablet: "768px",
|
|
29
|
+
tabletLarge: "950px",
|
|
30
30
|
},
|
|
31
|
-
borderRadius:
|
|
31
|
+
borderRadius: "4px",
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
export default theme
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<wrapper :size="size">
|
|
2
|
+
<wrapper :isDisabled="isDisabled" :size="size">
|
|
3
3
|
<icon-image
|
|
4
4
|
:size="size"
|
|
5
5
|
:color="color"
|
|
@@ -23,11 +23,12 @@
|
|
|
23
23
|
|
|
24
24
|
import styled from 'vue-styled-components'
|
|
25
25
|
|
|
26
|
-
const wrapperAttrs = { size: String }
|
|
26
|
+
const wrapperAttrs = { isDisabled: Boolean, size: String }
|
|
27
27
|
const Wrapper = styled('div', wrapperAttrs)`
|
|
28
28
|
display: inline-block;
|
|
29
29
|
width: ${(props) => props.size};
|
|
30
30
|
height: ${(props) => props.size};
|
|
31
|
+
cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'pointer')};
|
|
31
32
|
`
|
|
32
33
|
const IconImageProps = { color: String, hoveredColor: String, size: String }
|
|
33
34
|
const IconImage = styled('div', IconImageProps)`
|
|
@@ -50,6 +51,10 @@ export default {
|
|
|
50
51
|
IconImage
|
|
51
52
|
},
|
|
52
53
|
props: {
|
|
54
|
+
isDisabled: {
|
|
55
|
+
required: false,
|
|
56
|
+
default: false
|
|
57
|
+
},
|
|
53
58
|
name: {
|
|
54
59
|
required: true
|
|
55
60
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<component-wrapper>
|
|
3
|
-
<icon-wrapper>
|
|
3
|
+
<icon-wrapper :size="size">
|
|
4
4
|
<icon-img
|
|
5
5
|
:isActive="showInfo"
|
|
6
6
|
:size="size"
|
|
@@ -9,20 +9,7 @@
|
|
|
9
9
|
@mouseenter="toggleShowInfo()"
|
|
10
10
|
@mouseleave="toggleShowInfo()"
|
|
11
11
|
>
|
|
12
|
-
<
|
|
13
|
-
class="img-icon"
|
|
14
|
-
:width="size"
|
|
15
|
-
:height="size"
|
|
16
|
-
viewBox="0 0 24 24"
|
|
17
|
-
fill="none"
|
|
18
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
19
|
-
>
|
|
20
|
-
<path
|
|
21
|
-
class="img-icon"
|
|
22
|
-
d="M20.4853 3.51469C18.2188 1.24823 15.2053 0 12 0C8.79469 0 5.78123 1.24823 3.51469 3.51469C1.24823 5.78123 0 8.79469 0 12C0 15.2053 1.24823 18.2188 3.51469 20.4853C5.78123 22.7518 8.79469 24 12 24C15.2053 24 18.2188 22.7518 20.4853 20.4853C22.7518 18.2188 24 15.2053 24 12C24 8.79469 22.7518 5.78123 20.4853 3.51469ZM12 3.28125C13.4216 3.28125 14.5781 4.4378 14.5781 5.85938C14.5781 7.28095 13.4216 8.4375 12 8.4375C10.5784 8.4375 9.42188 7.28095 9.42188 5.85938C9.42188 4.4378 10.5784 3.28125 12 3.28125ZM15.2812 19.6875H8.71875V18.2812H10.125V11.9167H8.71875V10.5104H13.875V18.2812H15.2812V19.6875Z"
|
|
23
|
-
fill="#D5D5D5"
|
|
24
|
-
/>
|
|
25
|
-
</svg>
|
|
12
|
+
<icon :size="size + 'px'" name="info" :color="iconColor" />
|
|
26
13
|
</icon-img>
|
|
27
14
|
<text-overlay
|
|
28
15
|
v-if="showInfo"
|
|
@@ -44,19 +31,16 @@
|
|
|
44
31
|
// size="20"
|
|
45
32
|
// alignText="right" // default is left
|
|
46
33
|
// />
|
|
47
|
-
|
|
48
|
-
import styled from
|
|
49
|
-
|
|
50
|
-
const IconWrapper = styled.div`
|
|
51
|
-
position: relative;
|
|
52
|
-
`
|
|
34
|
+
import theme from '@/assets/theme.js'
|
|
35
|
+
import styled from 'vue-styled-components'
|
|
36
|
+
import icon from '../icon'
|
|
53
37
|
|
|
54
38
|
const textAttrs = { borderColor: String, alignText: String }
|
|
55
|
-
const TextOverlay = styled(
|
|
39
|
+
const TextOverlay = styled('div', textAttrs)`
|
|
56
40
|
position: absolute;
|
|
57
41
|
top: 26px;
|
|
58
|
-
right: ${(props) => (props.alignText ===
|
|
59
|
-
left: ${(props) => (props.alignText ===
|
|
42
|
+
right: ${(props) => (props.alignText === 'left' ? '-10px' : 'inherit')};
|
|
43
|
+
left: ${(props) => (props.alignText === 'left' ? 'inherit' : '-10px')};
|
|
60
44
|
background: ${(props) => props.theme.colors.black};
|
|
61
45
|
padding: 10px;
|
|
62
46
|
width: max-content;
|
|
@@ -68,12 +52,12 @@ const TextOverlay = styled("div", textAttrs)`
|
|
|
68
52
|
color: ${(props) => props.theme.colors.white};
|
|
69
53
|
|
|
70
54
|
:before {
|
|
71
|
-
content:
|
|
55
|
+
content: '';
|
|
72
56
|
background-color: ${(props) => props.theme.colors.black};
|
|
73
57
|
position: absolute;
|
|
74
58
|
top: 2px;
|
|
75
|
-
right: ${(props) => (props.alignText ===
|
|
76
|
-
left: ${(props) => (props.alignText ===
|
|
59
|
+
right: ${(props) => (props.alignText === 'left' ? '-12px' : 'inherit')};
|
|
60
|
+
left: ${(props) => (props.alignText === 'left' ? 'inherit' : '40px')};
|
|
77
61
|
height: 8px;
|
|
78
62
|
width: 8px;
|
|
79
63
|
transform-origin: center center;
|
|
@@ -82,18 +66,15 @@ const TextOverlay = styled("div", textAttrs)`
|
|
|
82
66
|
`
|
|
83
67
|
|
|
84
68
|
const iconAttrs = { isActive: Boolean, size: String, borderColor: String }
|
|
85
|
-
const IconImg = styled("div", iconAttrs)`
|
|
86
|
-
cursor: pointer;
|
|
87
|
-
height: ${(props) => props.size + "px"};
|
|
88
69
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
70
|
+
const IconWrapper = styled('div', iconAttrs)`
|
|
71
|
+
position: relative;
|
|
72
|
+
top: 1px;
|
|
73
|
+
height: ${(props) => props.size}px;
|
|
74
|
+
`
|
|
75
|
+
const IconImg = styled('div', iconAttrs)`
|
|
76
|
+
cursor: pointer;
|
|
77
|
+
height: ${(props) => props.size}px;
|
|
97
78
|
`
|
|
98
79
|
|
|
99
80
|
const ComponentWrapper = styled.div`
|
|
@@ -101,38 +82,39 @@ const ComponentWrapper = styled.div`
|
|
|
101
82
|
`
|
|
102
83
|
|
|
103
84
|
export default {
|
|
104
|
-
name:
|
|
85
|
+
name: 'info-text',
|
|
105
86
|
components: {
|
|
106
87
|
IconWrapper,
|
|
107
88
|
TextOverlay,
|
|
108
89
|
ComponentWrapper,
|
|
109
90
|
IconImg,
|
|
91
|
+
icon
|
|
110
92
|
},
|
|
111
93
|
props: {
|
|
112
94
|
text: {
|
|
113
|
-
required: true
|
|
95
|
+
required: true
|
|
114
96
|
},
|
|
115
97
|
borderColor: {
|
|
116
98
|
required: false,
|
|
117
|
-
default: null
|
|
99
|
+
default: null
|
|
118
100
|
},
|
|
119
101
|
size: {
|
|
120
102
|
required: false,
|
|
121
|
-
default:
|
|
103
|
+
default: '14'
|
|
122
104
|
},
|
|
123
105
|
alignText: {
|
|
124
106
|
required: false,
|
|
125
|
-
default:
|
|
126
|
-
}
|
|
107
|
+
default: 'left' // "left" or "right"
|
|
108
|
+
}
|
|
127
109
|
},
|
|
128
110
|
methods: {
|
|
129
111
|
toggleShowInfo() {
|
|
130
112
|
this.showInfo = !this.showInfo
|
|
131
113
|
|
|
132
114
|
if (this.showInfo) {
|
|
133
|
-
document.addEventListener(
|
|
115
|
+
document.addEventListener('click', this.clickOutside)
|
|
134
116
|
} else {
|
|
135
|
-
document.removeEventListener(
|
|
117
|
+
document.removeEventListener('click', this.clickOutside)
|
|
136
118
|
}
|
|
137
119
|
},
|
|
138
120
|
clickOutside(event) {
|
|
@@ -140,12 +122,21 @@ export default {
|
|
|
140
122
|
return
|
|
141
123
|
}
|
|
142
124
|
this.toggleShowInfo()
|
|
143
|
-
}
|
|
125
|
+
}
|
|
144
126
|
},
|
|
145
127
|
data() {
|
|
146
128
|
return {
|
|
147
|
-
showInfo: false
|
|
129
|
+
showInfo: false
|
|
148
130
|
}
|
|
149
131
|
},
|
|
132
|
+
computed: {
|
|
133
|
+
iconColor() {
|
|
134
|
+
return this.isActive
|
|
135
|
+
? this.borderColor
|
|
136
|
+
? this.borderColor
|
|
137
|
+
: theme.colors.secondary
|
|
138
|
+
: theme.colors.mediumGray
|
|
139
|
+
}
|
|
140
|
+
}
|
|
150
141
|
}
|
|
151
|
-
</script>
|
|
142
|
+
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<container>
|
|
2
|
+
<container :inputWidth="inputWidth">
|
|
3
3
|
<label-wrapper v-if="labelText">
|
|
4
4
|
<label-text>
|
|
5
5
|
{{ labelText }}
|
|
@@ -8,16 +8,15 @@
|
|
|
8
8
|
v-if="labelInfoText"
|
|
9
9
|
:text="labelInfoText"
|
|
10
10
|
borderColor="#ccc"
|
|
11
|
-
size="
|
|
11
|
+
size="14"
|
|
12
12
|
:alignText="labelInfoAlign"
|
|
13
13
|
/>
|
|
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,10 +30,15 @@
|
|
|
31
30
|
:textAlign="textAlign"
|
|
32
31
|
:fontSize="fontSize"
|
|
33
32
|
:fontColor="fontColor"
|
|
34
|
-
|
|
33
|
+
:hasSlot="hasSlot"
|
|
34
|
+
:slotSize="slotSize"
|
|
35
35
|
/>
|
|
36
|
+
<slot-container v-if="hasSlot" :slotSize="slotSize" :isError="isError">
|
|
37
|
+
<slot></slot>
|
|
38
|
+
</slot-container>
|
|
39
|
+
|
|
36
40
|
<unit-container
|
|
37
|
-
v-if="unitName && showLinearUnitName"
|
|
41
|
+
v-if="unitName && showLinearUnitName && !hasSlot"
|
|
38
42
|
:hasLength="!!textInput.length"
|
|
39
43
|
:isError="isError"
|
|
40
44
|
>{{ unitName }}</unit-container
|
|
@@ -77,11 +81,6 @@ import {
|
|
|
77
81
|
} from '../../../helpers/numberConverter'
|
|
78
82
|
import InfoText from '../../infoText'
|
|
79
83
|
|
|
80
|
-
const Container = styled.div`
|
|
81
|
-
width: 100%;
|
|
82
|
-
position: relative;
|
|
83
|
-
`
|
|
84
|
-
|
|
85
84
|
const inputProps = {
|
|
86
85
|
isError: Boolean,
|
|
87
86
|
hasUnit: Boolean,
|
|
@@ -91,8 +90,16 @@ const inputProps = {
|
|
|
91
90
|
noBorder: Boolean,
|
|
92
91
|
textAlign: String,
|
|
93
92
|
fontSize: String,
|
|
94
|
-
fontColor: String
|
|
93
|
+
fontColor: String,
|
|
94
|
+
hasSlot: Boolean,
|
|
95
|
+
slotSize: String
|
|
95
96
|
}
|
|
97
|
+
|
|
98
|
+
const Container = styled('div', inputProps)`
|
|
99
|
+
width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
|
|
100
|
+
position: relative;
|
|
101
|
+
`
|
|
102
|
+
|
|
96
103
|
const InputContainer = styled('input', inputProps)`
|
|
97
104
|
border: ${(props) =>
|
|
98
105
|
props.isError
|
|
@@ -100,8 +107,15 @@ const InputContainer = styled('input', inputProps)`
|
|
|
100
107
|
: props.noBorder
|
|
101
108
|
? 'none'
|
|
102
109
|
: '1px solid ' + props.theme.colors.mediumGray};
|
|
103
|
-
padding:
|
|
104
|
-
|
|
110
|
+
padding-top: 11px;
|
|
111
|
+
padding-bottom: 11px;
|
|
112
|
+
padding-left: 10px;
|
|
113
|
+
padding-right: ${(props) =>
|
|
114
|
+
props.slotSize
|
|
115
|
+
? 'calc(' + props.slotSize + ' + 10px)'
|
|
116
|
+
: props.hasUnit
|
|
117
|
+
? '40px'
|
|
118
|
+
: '5px'};
|
|
105
119
|
border-radius: 4px;
|
|
106
120
|
text-align: ${(props) => props.textAlign};
|
|
107
121
|
cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'auto')};
|
|
@@ -144,6 +158,7 @@ const UnitContainer = styled('span', inputProps)`
|
|
|
144
158
|
right: 10px;
|
|
145
159
|
top: 0;
|
|
146
160
|
padding-left: 10px;
|
|
161
|
+
text-align: right;
|
|
147
162
|
color: ${(props) =>
|
|
148
163
|
props.isError
|
|
149
164
|
? props.theme.colors.red
|
|
@@ -152,6 +167,28 @@ const UnitContainer = styled('span', inputProps)`
|
|
|
152
167
|
: props.theme.colors.mediumGray};
|
|
153
168
|
`
|
|
154
169
|
|
|
170
|
+
const SlotContainer = styled('span', inputProps)`
|
|
171
|
+
text-align: right;
|
|
172
|
+
border-left: 1px solid
|
|
173
|
+
${(props) =>
|
|
174
|
+
props.isError
|
|
175
|
+
? props.theme.colors.red
|
|
176
|
+
: props.hasLength
|
|
177
|
+
? props.theme.colors.black
|
|
178
|
+
: props.theme.colors.mediumGray};
|
|
179
|
+
position: absolute;
|
|
180
|
+
width: ${(props) =>
|
|
181
|
+
props.slotSize ? 'calc(' + props.slotSize + ' - 10px)' : 'fit-content'};
|
|
182
|
+
right: 10px;
|
|
183
|
+
top: 0;
|
|
184
|
+
padding-left: 10px;
|
|
185
|
+
color: ${(props) =>
|
|
186
|
+
props.isError
|
|
187
|
+
? props.theme.colors.red
|
|
188
|
+
: props.hasLength
|
|
189
|
+
? props.theme.colors.black
|
|
190
|
+
: props.theme.colors.mediumGray};
|
|
191
|
+
`
|
|
155
192
|
const ErrorMessage = styled.div`
|
|
156
193
|
font-size: 14px;
|
|
157
194
|
color: ${(props) => props.theme.colors.red};
|
|
@@ -180,21 +217,15 @@ export default {
|
|
|
180
217
|
ErrorMessage,
|
|
181
218
|
LabelWrapper,
|
|
182
219
|
LabelText,
|
|
220
|
+
SlotContainer,
|
|
183
221
|
InfoText
|
|
184
222
|
},
|
|
185
|
-
inheritAttrs: false,
|
|
186
223
|
data() {
|
|
187
224
|
return {
|
|
188
225
|
textInput: '',
|
|
189
226
|
isFocused: false
|
|
190
227
|
}
|
|
191
228
|
},
|
|
192
|
-
computed: {
|
|
193
|
-
displayedPlaceholder() {
|
|
194
|
-
if (this.placeholder) return this.placeholder
|
|
195
|
-
return `${this.minNumber || 0} ${this.unitName ? this.unitName : ''}`
|
|
196
|
-
}
|
|
197
|
-
},
|
|
198
229
|
props: {
|
|
199
230
|
placeholder: {
|
|
200
231
|
required: false,
|
|
@@ -275,6 +306,18 @@ export default {
|
|
|
275
306
|
numberToStringEnabled: {
|
|
276
307
|
required: false,
|
|
277
308
|
default: true
|
|
309
|
+
},
|
|
310
|
+
slotSize: {
|
|
311
|
+
required: false
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
computed: {
|
|
315
|
+
hasSlot() {
|
|
316
|
+
console.log(this.$slots.default)
|
|
317
|
+
return !!this.$slots.default
|
|
318
|
+
},
|
|
319
|
+
computedSlotSize() {
|
|
320
|
+
return this.slotSize || this.$slots['default'][0].elm.clientWidth
|
|
278
321
|
}
|
|
279
322
|
},
|
|
280
323
|
methods: {
|
|
@@ -308,7 +351,7 @@ export default {
|
|
|
308
351
|
return num
|
|
309
352
|
}
|
|
310
353
|
})
|
|
311
|
-
let evaluated = eval(formatted.join(''))
|
|
354
|
+
let evaluated = eval(formatted.join(''))
|
|
312
355
|
evaluated = stringToNumber({
|
|
313
356
|
value: evaluated,
|
|
314
357
|
numberPrecision: this.numberPrecision
|
|
@@ -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>
|
|
@@ -4,6 +4,9 @@ export const stringToNumber = ({
|
|
|
4
4
|
allowNegative
|
|
5
5
|
}) => {
|
|
6
6
|
// This is for saving. It converts our input string to a readable number
|
|
7
|
+
if (value === undefined) {
|
|
8
|
+
value = ''
|
|
9
|
+
}
|
|
7
10
|
let newVal = value.toString()
|
|
8
11
|
const selectedLang = localStorage.getItem('lang')
|
|
9
12
|
// The first replace will replace not allowed characters with a blank
|