@eturnity/eturnity_reusable_components 1.2.70-EPDM-7253.1 → 1.2.70
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
CHANGED
@@ -5,9 +5,7 @@
|
|
5
5
|
:alignItems="alignItems"
|
6
6
|
>
|
7
7
|
<label-wrapper v-if="label">
|
8
|
-
<input-label :labelFontColor="labelFontColor" :fontSize="fontSize">{{
|
9
|
-
label
|
10
|
-
}}</input-label>
|
8
|
+
<input-label :labelFontColor="labelFontColor" :fontSize="fontSize">{{ label }}</input-label>
|
11
9
|
<info-text
|
12
10
|
v-if="infoTextMessage"
|
13
11
|
:text="infoTextMessage"
|
@@ -19,6 +17,7 @@
|
|
19
17
|
<input-error-wrapper>
|
20
18
|
<icon-container>
|
21
19
|
<input-container
|
20
|
+
ref="inputElement"
|
22
21
|
:placeholder="placeholder"
|
23
22
|
:isError="isError"
|
24
23
|
:inputWidth="inputWidth"
|
@@ -34,6 +33,7 @@
|
|
34
33
|
:inputType="inputType"
|
35
34
|
:type="inputTypeData"
|
36
35
|
:fontColor="fontColor"
|
36
|
+
:hasFocus="hasFocus"
|
37
37
|
:backgroundColor="backgroundColor"
|
38
38
|
:disabledBackgroundColor="disabledBackgroundColor"
|
39
39
|
/>
|
@@ -67,17 +67,17 @@ const Container = styled.div`
|
|
67
67
|
position: relative;
|
68
68
|
`
|
69
69
|
|
70
|
-
const labelAttrs = { fontSize: String,
|
70
|
+
const labelAttrs = { fontSize: String,labelFontColor:String, }
|
71
71
|
const InputLabel = styled('div', labelAttrs)`
|
72
|
-
color: ${(props) =>
|
73
|
-
props.theme.colors[props.labelFontColor]
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
72
|
+
color: ${(props) => props.theme.colors[props.labelFontColor]?
|
73
|
+
props.theme.colors[props.labelFontColor]:
|
74
|
+
props.labelFontColor?
|
75
|
+
props.labelFontColor:
|
76
|
+
props.theme.colors.eturnityGrey
|
77
|
+
};
|
78
78
|
|
79
79
|
font-size: ${(props) => (props.fontSize ? props.fontSize : '13px')};
|
80
|
-
font-
|
80
|
+
font-family: 'Lato-Bold', Arial;
|
81
81
|
`
|
82
82
|
|
83
83
|
const LabelWrapper = styled.div`
|
@@ -104,21 +104,21 @@ const inputProps = {
|
|
104
104
|
fontSize: String,
|
105
105
|
inputType: String,
|
106
106
|
fontColor: String,
|
107
|
-
backgroundColor:
|
108
|
-
borderColor:
|
109
|
-
inputHeight:
|
110
|
-
disabledBackgroundColor:
|
107
|
+
backgroundColor:String,
|
108
|
+
borderColor:String,
|
109
|
+
inputHeight:String,
|
110
|
+
disabledBackgroundColor:String
|
111
111
|
}
|
112
112
|
const InputContainer = styled('input', inputProps)`
|
113
113
|
border: ${(props) =>
|
114
|
-
|
114
|
+
props.isError
|
115
115
|
? '1px solid ' + props.theme.colors.red
|
116
116
|
: props.noBorder
|
117
117
|
? 'none'
|
118
|
-
: props.borderColor
|
119
|
-
|
120
|
-
|
121
|
-
|
118
|
+
: props.borderColor ?
|
119
|
+
props.theme.colors[props.borderColor]
|
120
|
+
? '1px solid ' + props.theme.colors[props.borderColor]
|
121
|
+
: '1px solid ' + props.borderColor
|
122
122
|
: '1px solid ' + props.theme.colors.grey4};
|
123
123
|
padding: ${(props) =>
|
124
124
|
props.isError
|
@@ -137,21 +137,19 @@ const InputContainer = styled('input', inputProps)`
|
|
137
137
|
: props.fontColor
|
138
138
|
? props.fontColor + ' !important'
|
139
139
|
: props.theme.colors.black};
|
140
|
-
|
140
|
+
|
141
141
|
width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
|
142
142
|
min-width: ${(props) => (props.minWidth ? props.minWidth : 'unset')};
|
143
143
|
max-height: ${(props) => props.inputHeight};
|
144
144
|
box-sizing: border-box; // to allow width of 100% with padding
|
145
145
|
font-weight: 400;
|
146
146
|
cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'auto')};
|
147
|
-
background-color: ${(props) =>
|
148
|
-
props.isDisabled
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
? props.backgroundColor + ' !important'
|
154
|
-
: props.theme.colors.white};
|
147
|
+
background-color: ${(props) =>
|
148
|
+
props.isDisabled ?
|
149
|
+
(props.disabledBackgroundColor ? props.disabledBackgroundColor+' !important'
|
150
|
+
: props.theme.colors.grey5) :
|
151
|
+
props.backgroundColor ? props.backgroundColor+' !important' :
|
152
|
+
props.theme.colors.white};
|
155
153
|
&::placeholder {
|
156
154
|
color: ${(props) => props.theme.colors.grey2};
|
157
155
|
}
|
@@ -280,24 +278,28 @@ export default {
|
|
280
278
|
required: false,
|
281
279
|
default: 'text'
|
282
280
|
},
|
283
|
-
labelFontColor:
|
284
|
-
required:
|
285
|
-
default:
|
281
|
+
labelFontColor:{
|
282
|
+
required:false,
|
283
|
+
default:'black'
|
286
284
|
},
|
287
|
-
backgroundColor:
|
288
|
-
required:
|
289
|
-
default:
|
285
|
+
backgroundColor:{
|
286
|
+
required:false,
|
287
|
+
default:'white'
|
290
288
|
},
|
291
|
-
disabledBackgroundColor:
|
292
|
-
required:
|
293
|
-
default:
|
289
|
+
disabledBackgroundColor:{
|
290
|
+
required:false,
|
291
|
+
default:null
|
294
292
|
},
|
295
|
-
fontColor:
|
296
|
-
required:
|
297
|
-
default:
|
293
|
+
fontColor:{
|
294
|
+
required:false,
|
295
|
+
default:'black'
|
298
296
|
},
|
299
|
-
borderColor:
|
300
|
-
required:
|
297
|
+
borderColor:{
|
298
|
+
required:false,
|
299
|
+
},
|
300
|
+
hasFocus: {
|
301
|
+
required: false,
|
302
|
+
default: false
|
301
303
|
}
|
302
304
|
},
|
303
305
|
methods: {
|
@@ -314,6 +316,15 @@ export default {
|
|
314
316
|
},
|
315
317
|
created() {
|
316
318
|
this.inputTypeData = this.inputType
|
319
|
+
},
|
320
|
+
watch: {
|
321
|
+
hasFocus(newVal) {
|
322
|
+
if (newVal) {
|
323
|
+
this.$nextTick(() => {
|
324
|
+
this.$refs.inputElement.$el.focus();
|
325
|
+
});
|
326
|
+
}
|
327
|
+
}
|
317
328
|
}
|
318
329
|
}
|
319
330
|
</script>
|
@@ -1,260 +1,244 @@
|
|
1
1
|
<template>
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
:label="label"
|
8
|
-
>
|
9
|
-
<label-container
|
10
|
-
v-if="label && labelAlign === 'left'"
|
11
|
-
:hasInfoMessage="!!infoTextMessage"
|
12
|
-
:colorMode="colorMode"
|
13
|
-
>
|
14
|
-
<label-text :size="size">{{ label }}</label-text>
|
15
|
-
<info-text
|
16
|
-
v-if="infoTextMessage"
|
17
|
-
:text="infoTextMessage"
|
18
|
-
borderColor="#ccc"
|
19
|
-
size="14px"
|
20
|
-
:alignText="infoTextAlign"
|
21
|
-
/>
|
22
|
-
</label-container>
|
23
|
-
|
24
|
-
<switch-wrapper
|
25
|
-
:size="size"
|
26
|
-
:disabled="disabled"
|
27
|
-
:backgroundColor="backgroundColor"
|
28
|
-
>
|
29
|
-
<switchOption
|
30
|
-
v-for="(item, index) in options"
|
31
|
-
:key="index"
|
32
|
-
@click="selectItem(item.value)"
|
33
|
-
:isActive="selectedValue == item.value"
|
2
|
+
<container>
|
3
|
+
<flex-wrapper :size="size" :disabled="disabled" :alignItems="alignItems" :label="label">
|
4
|
+
<label-container
|
5
|
+
v-if="label && labelAlign === 'left'"
|
6
|
+
:hasInfoMessage="!!infoTextMessage"
|
34
7
|
:colorMode="colorMode"
|
35
|
-
:primaryColor="primaryColor"
|
36
|
-
:secondaryColor="secondaryColor"
|
37
|
-
:inactiveColor="inactiveColor"
|
38
8
|
>
|
39
|
-
{{
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
:
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
9
|
+
<label-text :size="size">{{ label }}</label-text>
|
10
|
+
<info-text
|
11
|
+
v-if="infoTextMessage"
|
12
|
+
:text="infoTextMessage"
|
13
|
+
borderColor="#ccc"
|
14
|
+
size="14px"
|
15
|
+
:alignText="infoTextAlign"
|
16
|
+
/>
|
17
|
+
</label-container>
|
18
|
+
|
19
|
+
<switch-wrapper
|
20
|
+
:size="size"
|
21
|
+
:disabled="disabled"
|
22
|
+
:backgroundColor="backgroundColor"
|
23
|
+
>
|
24
|
+
<switchOption
|
25
|
+
v-for="(item,index) in options"
|
26
|
+
:key="index"
|
27
|
+
@click="selectItem(item.value)"
|
28
|
+
:isActive="selectedValue==item.value"
|
29
|
+
:colorMode="colorMode"
|
30
|
+
:primaryColor="primaryColor"
|
31
|
+
:secondaryColor="secondaryColor"
|
32
|
+
:inactiveColor="inactiveColor"
|
33
|
+
>
|
34
|
+
{{ item.content }}
|
35
|
+
</switchOption>
|
36
|
+
</switch-wrapper>
|
37
|
+
<label-container
|
38
|
+
v-if="label && labelAlign === 'right'"
|
39
|
+
:hasInfoMessage="!!infoTextMessage"
|
40
|
+
>
|
41
|
+
<label-text :size="size" :fontColor="fontColor">{{ label }}</label-text>
|
42
|
+
<info-text
|
43
|
+
@click.native.stop
|
44
|
+
v-if="infoTextMessage"
|
45
|
+
:text="infoTextMessage"
|
46
|
+
borderColor="#ccc"
|
47
|
+
size="14px"
|
48
|
+
:alignText="infoTextAlign"
|
49
|
+
/>
|
50
|
+
</label-container>
|
51
|
+
</flex-wrapper>
|
52
|
+
</container>
|
53
|
+
</template>
|
54
|
+
|
55
|
+
<script>
|
56
|
+
// import Toggle from "@eturnity/eturnity_reusable_components/src/components/inputs/toggle"
|
57
|
+
// To use:
|
58
|
+
// <SwitchField
|
59
|
+
// @on-switch-change="onInputChange($event)"
|
60
|
+
// :options="[{value:0,content:'zero'},{value:1,content:'one'},{value:2,content:'two'}]"
|
61
|
+
// :value="1"
|
62
|
+
// label="label"
|
63
|
+
// toggleColor="red"
|
64
|
+
// size="large"
|
65
|
+
// backgroundColor="blue"
|
66
|
+
// labelAlign="left"
|
67
|
+
// fontColor="black"
|
68
|
+
// :disabled="false"
|
69
|
+
// />
|
70
|
+
|
71
|
+
import styled from "vue-styled-components"
|
72
|
+
import InfoText from "../../infoText"
|
73
|
+
import theme from "../../../assets/theme"
|
74
|
+
const Container = styled.div``
|
75
|
+
|
76
|
+
const flexAttrs = { label:String,size: String, disabled: Boolean,alignItems: String }
|
77
|
+
const FlexWrapper = styled("div", flexAttrs)`
|
78
|
+
display: grid;
|
79
|
+
grid-template-columns: auto 1fr;
|
80
|
+
grid-gap: 10px;
|
81
|
+
align-items: center;
|
82
|
+
cursor: ${(props) => (props.disabled ? "not-allowed" : "pointer")};
|
83
|
+
grid-template-columns: ${(props) =>
|
94
84
|
props.alignItems === 'vertical' || !props.label ? '1fr' : 'auto 1fr'};
|
95
|
-
`
|
96
|
-
|
97
|
-
const toggleAttrs = {
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
}
|
104
|
-
const LabelText = styled('div', toggleAttrs)`
|
105
|
-
color: white;
|
106
|
-
font-size: 13px;
|
107
|
-
font-weight: 700;
|
108
|
-
`
|
109
|
-
|
110
|
-
const SwitchWrapper = styled('span', toggleAttrs)`
|
111
|
-
display: flex;
|
112
|
-
position: relative;
|
113
|
-
cursor: ${(props) => (props.disabled ? 'not-allowed' : 'pointer')};
|
114
|
-
height: ${(props) =>
|
115
|
-
props.size === 'medium'
|
116
|
-
? '24px'
|
117
|
-
: props.size === 'small'
|
118
|
-
? '16px'
|
119
|
-
: '24px'};
|
120
|
-
`
|
121
|
-
const optionAttrs = {
|
122
|
-
isActive: Boolean,
|
123
|
-
primaryColor: String,
|
124
|
-
secondaryColor: String,
|
125
|
-
inactiveColor: String
|
126
|
-
}
|
127
|
-
const switchOption = styled('div', optionAttrs)`
|
128
|
-
color: ${(props) =>
|
129
|
-
props.isActive ? props.primaryColor : props.inactiveColor};
|
130
|
-
background-color: ${(props) =>
|
131
|
-
props.isActive ? props.secondaryColor : 'transparent'};
|
132
|
-
border: 1px solid
|
133
|
-
${(props) => (props.isActive ? props.secondaryColor : props.inactiveColor)};
|
134
|
-
display: flex;
|
135
|
-
align-items: center;
|
136
|
-
justify-content: center;
|
137
|
-
flex-grow: 1;
|
138
|
-
font-size: 13px;
|
139
|
-
line-height: 1;
|
140
|
-
text-align: center;
|
141
|
-
padding: 10px;
|
142
|
-
margin-right: -1px;
|
143
|
-
transition: all 0.1s ease-in-out;
|
144
|
-
overflow: hidden;
|
145
|
-
& :hover {
|
146
|
-
cursor: pointer;
|
147
|
-
}
|
148
|
-
&:first-child {
|
149
|
-
border-radius: 4px 0 0 4px;
|
150
|
-
}
|
151
|
-
&:last-child {
|
152
|
-
border-radius: 0 4px 4px 0;
|
85
|
+
`
|
86
|
+
|
87
|
+
const toggleAttrs = {
|
88
|
+
size: String,
|
89
|
+
fontColor: String,
|
90
|
+
disabled: Boolean,
|
91
|
+
backgroundColor: String,
|
92
|
+
isChecked: Boolean,
|
153
93
|
}
|
154
|
-
`
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
94
|
+
const LabelText = styled("div", toggleAttrs)`
|
95
|
+
color: white;
|
96
|
+
font-size: 13px;
|
97
|
+
font-family: 'Lato-Bold',Arial;
|
98
|
+
`
|
99
|
+
|
100
|
+
const SwitchWrapper = styled("span", toggleAttrs)`
|
101
|
+
display: flex;
|
102
|
+
position: relative;
|
103
|
+
cursor: ${(props) => (props.disabled ? "not-allowed" : "pointer")};
|
104
|
+
height: ${(props) =>
|
105
|
+
props.size === "medium"
|
106
|
+
? "24px"
|
107
|
+
: props.size === "small"
|
108
|
+
? "16px"
|
109
|
+
: "24px"};
|
110
|
+
`
|
111
|
+
const optionAttrs={isActive:Boolean,primaryColor:String,secondaryColor:String,inactiveColor:String}
|
112
|
+
const switchOption=styled('div',optionAttrs)`
|
113
|
+
color:${props=>props.isActive?props.primaryColor:props.inactiveColor};
|
114
|
+
background-color:${props=>props.isActive?props.secondaryColor:"transparent"};
|
115
|
+
border:1px solid ${props=>props.isActive?props.secondaryColor:props.inactiveColor};
|
116
|
+
display:flex;
|
117
|
+
align-items:center;
|
118
|
+
justify-content: center;
|
119
|
+
flex-grow:1;
|
120
|
+
font-size: 13px;
|
121
|
+
line-height: 1;
|
122
|
+
text-align: center;
|
123
|
+
padding: 10px;
|
124
|
+
margin-right: -1px;
|
125
|
+
transition: all 0.1s ease-in-out;
|
126
|
+
overflow:hidden;
|
127
|
+
& :hover{
|
128
|
+
cursor: pointer;
|
129
|
+
}
|
130
|
+
&:first-child {
|
131
|
+
border-radius: 4px 0 0 4px;
|
132
|
+
}
|
133
|
+
&:last-child {
|
134
|
+
border-radius: 0 4px 4px 0;
|
135
|
+
}
|
164
136
|
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
},
|
187
|
-
size: {
|
188
|
-
required: false,
|
189
|
-
default: 'small'
|
190
|
-
},
|
191
|
-
labelAlign: {
|
192
|
-
required: false,
|
193
|
-
default: 'left'
|
194
|
-
},
|
195
|
-
fontColor: {
|
196
|
-
required: false
|
197
|
-
},
|
198
|
-
disabled: {
|
199
|
-
required: false,
|
200
|
-
default: false
|
137
|
+
`
|
138
|
+
|
139
|
+
const labelAttrs = { hasInfoMessage: Boolean }
|
140
|
+
const LabelContainer = styled("div", labelAttrs)`
|
141
|
+
display: inline-grid;
|
142
|
+
grid-template-columns: ${(props) =>
|
143
|
+
props.hasInfoMessage ? "auto 1fr" : "auto"};
|
144
|
+
grid-gap: 12px;
|
145
|
+
align-items: center;
|
146
|
+
`
|
147
|
+
|
148
|
+
export default {
|
149
|
+
name: "switchField",
|
150
|
+
components: {
|
151
|
+
Container,
|
152
|
+
SwitchWrapper,
|
153
|
+
FlexWrapper,
|
154
|
+
LabelText,
|
155
|
+
InfoText,
|
156
|
+
LabelContainer,
|
157
|
+
switchOption,
|
201
158
|
},
|
202
|
-
|
203
|
-
|
159
|
+
props: {
|
160
|
+
label: {
|
161
|
+
required: false,
|
162
|
+
default: "",
|
163
|
+
},
|
164
|
+
toggleColor: {
|
165
|
+
required: false,
|
166
|
+
},
|
167
|
+
backgroundColor: {
|
168
|
+
required: false,
|
169
|
+
},
|
170
|
+
size: {
|
171
|
+
required: false,
|
172
|
+
default: "small",
|
173
|
+
},
|
174
|
+
labelAlign: {
|
175
|
+
required: false,
|
176
|
+
default: "left",
|
177
|
+
},
|
178
|
+
fontColor: {
|
179
|
+
required: false,
|
180
|
+
},
|
181
|
+
disabled: {
|
182
|
+
required: false,
|
183
|
+
default: false,
|
184
|
+
},
|
185
|
+
infoTextMessage: {
|
186
|
+
required: false,
|
187
|
+
},
|
188
|
+
infoTextAlign: {
|
189
|
+
required: false,
|
190
|
+
},
|
191
|
+
colorMode: {
|
192
|
+
required: false,
|
193
|
+
default:'light'
|
194
|
+
},
|
195
|
+
alignItems:{
|
196
|
+
required: false,
|
197
|
+
default: 'horizontal'
|
198
|
+
},
|
199
|
+
options:{
|
200
|
+
required:true
|
201
|
+
},
|
202
|
+
value:{
|
203
|
+
required:false,
|
204
|
+
default:null
|
205
|
+
},
|
204
206
|
},
|
205
|
-
|
206
|
-
|
207
|
+
data() {
|
208
|
+
return {
|
209
|
+
selectedValue:null,
|
210
|
+
primaryColor:"white",
|
211
|
+
secondaryColor:"black",
|
212
|
+
inactiveColor:"grey6"
|
213
|
+
}
|
207
214
|
},
|
208
|
-
|
209
|
-
|
210
|
-
|
215
|
+
created(){
|
216
|
+
this.selectedValue=this.value
|
217
|
+
|
218
|
+
if(this.colorMode=='dark'){
|
219
|
+
this.primaryColor=theme.colors.black
|
220
|
+
this.secondaryColor=theme.colors.white
|
221
|
+
this.inactiveColor=theme.colors.grey6
|
222
|
+
}else{
|
223
|
+
this.primaryColor=theme.colors.white
|
224
|
+
this.secondaryColor=theme.colors.black
|
225
|
+
this.inactiveColor=theme.colors.grey6
|
226
|
+
}
|
211
227
|
},
|
212
|
-
|
213
|
-
|
214
|
-
|
228
|
+
methods: {
|
229
|
+
selectItem(value){
|
230
|
+
if (this.disabled) {
|
231
|
+
return
|
232
|
+
}
|
233
|
+
this.selectedValue=value
|
234
|
+
this.$emit("on-switch-change", this.selectedValue)
|
235
|
+
},
|
215
236
|
},
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
value: {
|
220
|
-
required: false,
|
221
|
-
default: null
|
222
|
-
}
|
223
|
-
},
|
224
|
-
data() {
|
225
|
-
return {
|
226
|
-
selectedValue: null,
|
227
|
-
primaryColor: 'white',
|
228
|
-
secondaryColor: 'black',
|
229
|
-
inactiveColor: 'grey6'
|
230
|
-
}
|
231
|
-
},
|
232
|
-
created() {
|
233
|
-
this.selectedValue = this.value
|
234
|
-
|
235
|
-
if (this.colorMode == 'dark') {
|
236
|
-
this.primaryColor = theme.colors.black
|
237
|
-
this.secondaryColor = theme.colors.white
|
238
|
-
this.inactiveColor = theme.colors.grey6
|
239
|
-
} else {
|
240
|
-
this.primaryColor = theme.colors.white
|
241
|
-
this.secondaryColor = theme.colors.black
|
242
|
-
this.inactiveColor = theme.colors.grey6
|
243
|
-
}
|
244
|
-
},
|
245
|
-
methods: {
|
246
|
-
selectItem(value) {
|
247
|
-
if (this.disabled) {
|
248
|
-
return
|
237
|
+
watch:{
|
238
|
+
value(val){
|
239
|
+
this.selectedValue=val
|
249
240
|
}
|
250
|
-
this.selectedValue = value
|
251
|
-
this.$emit('on-switch-change', this.selectedValue)
|
252
|
-
}
|
253
|
-
},
|
254
|
-
watch: {
|
255
|
-
value(val) {
|
256
|
-
this.selectedValue = val
|
257
241
|
}
|
258
242
|
}
|
259
|
-
|
260
|
-
|
243
|
+
</script>
|
244
|
+
|
@@ -45,9 +45,9 @@
|
|
45
45
|
// This is a read only table. Pass it data, and it displays it
|
46
46
|
// ToDo: add this to storybook
|
47
47
|
// import ViewTable from "@eturnity/eturnity_reusable_components/src/components/tables/viewTable"
|
48
|
-
import styled from
|
49
|
-
import DeleteIcon from
|
50
|
-
import Spinner from
|
48
|
+
import styled from "vue-styled-components"
|
49
|
+
import DeleteIcon from "../../deleteIcon"
|
50
|
+
import Spinner from "../../spinner"
|
51
51
|
|
52
52
|
const TableScroll = styled.div`
|
53
53
|
position: relative;
|
@@ -55,8 +55,8 @@ const TableScroll = styled.div`
|
|
55
55
|
`
|
56
56
|
|
57
57
|
const wrapperAttrs = { fullWidth: Boolean }
|
58
|
-
const TableWrapper = styled(
|
59
|
-
width: ${(props) => (props.fullWidth ?
|
58
|
+
const TableWrapper = styled("div", wrapperAttrs)`
|
59
|
+
width: ${(props) => (props.fullWidth ? "100%" : "fit-content")};
|
60
60
|
max-width: 100%;
|
61
61
|
overflow: auto;
|
62
62
|
|
@@ -89,7 +89,7 @@ const TableItem = styled.td`
|
|
89
89
|
|
90
90
|
const TableHeader = styled(TableItem)`
|
91
91
|
background-color: #e6e8ee;
|
92
|
-
font-
|
92
|
+
font-family: "Lato-Bold", Arial;
|
93
93
|
text-align: left;
|
94
94
|
`
|
95
95
|
|
@@ -101,7 +101,7 @@ const TableRow = styled.tr`
|
|
101
101
|
`
|
102
102
|
|
103
103
|
const TitleText = styled.div`
|
104
|
-
font-
|
104
|
+
font-family: "Lato-Bold", Arial;
|
105
105
|
margin-bottom: 6px;
|
106
106
|
`
|
107
107
|
|
@@ -141,7 +141,7 @@ const EmptyTd = styled.td`
|
|
141
141
|
`
|
142
142
|
|
143
143
|
export default {
|
144
|
-
name:
|
144
|
+
name: "view-table",
|
145
145
|
components: {
|
146
146
|
TableScroll,
|
147
147
|
TableWrapper,
|
@@ -156,40 +156,40 @@ export default {
|
|
156
156
|
Spinner,
|
157
157
|
SpinnerWrapper,
|
158
158
|
EmptyContainer,
|
159
|
-
EmptyTd
|
159
|
+
EmptyTd,
|
160
160
|
},
|
161
161
|
props: {
|
162
162
|
headerItems: {
|
163
|
-
required: true
|
163
|
+
required: true,
|
164
164
|
},
|
165
165
|
tableItems: {
|
166
|
-
required: true
|
166
|
+
required: true,
|
167
167
|
},
|
168
168
|
fullWidth: {
|
169
169
|
required: false,
|
170
|
-
default: true
|
170
|
+
default: true,
|
171
171
|
},
|
172
172
|
tableTitle: {
|
173
173
|
required: false,
|
174
|
-
default: null
|
174
|
+
default: null,
|
175
175
|
},
|
176
176
|
showDeleteButton: {
|
177
177
|
required: false,
|
178
|
-
default: false
|
178
|
+
default: false,
|
179
179
|
},
|
180
180
|
isLoading: {
|
181
181
|
required: false,
|
182
|
-
default: false
|
182
|
+
default: false,
|
183
183
|
},
|
184
184
|
emptyText: {
|
185
185
|
required: false,
|
186
|
-
default:
|
187
|
-
}
|
186
|
+
default: "There are no items",
|
187
|
+
},
|
188
188
|
},
|
189
189
|
computed: {
|
190
190
|
showIconsContainer() {
|
191
191
|
return this.showDeleteButton
|
192
|
-
}
|
193
|
-
}
|
192
|
+
},
|
193
|
+
},
|
194
194
|
}
|
195
195
|
</script>
|