@eturnity/eturnity_reusable_components 1.2.82-EPDM-7153.0 → 1.2.82-EPDM-7153.2
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 +1 -1
- package/src/components/errorMessage/index.vue +0 -1
- package/src/components/inputs/inputNumber/index.vue +7 -7
- package/src/components/inputs/inputText/index.vue +45 -42
- package/src/components/inputs/select/index.vue +3 -2
- package/src/components/inputs/switchField/index.vue +246 -230
- package/src/components/tables/viewTable/index.vue +19 -19
package/package.json
CHANGED
@@ -149,9 +149,9 @@ const InputContainer = styled('input', inputProps)`
|
|
149
149
|
? '1px solid ' + props.theme.colors[props.borderColor]
|
150
150
|
: '1px solid ' + props.borderColor
|
151
151
|
: '1px solid ' + props.theme.colors.grey4};
|
152
|
-
|
153
|
-
|
154
|
-
padding
|
152
|
+
height: ${(props) => props.inputHeight};
|
153
|
+
max-height: ${(props) => props.inputHeight};
|
154
|
+
padding: 0 10px;
|
155
155
|
padding-right: ${({ slotSize, isError, showLinearUnitName }) =>
|
156
156
|
slotSize
|
157
157
|
? isError && !showLinearUnitName
|
@@ -182,7 +182,7 @@ const InputContainer = styled('input', inputProps)`
|
|
182
182
|
background-color: ${(props) =>
|
183
183
|
props.isDisabled ? props.theme.colors.grey5 : '#fff'};
|
184
184
|
box-sizing: border-box;
|
185
|
-
|
185
|
+
|
186
186
|
&::placeholder {
|
187
187
|
color: ${(props) => props.theme.colors.grey2};
|
188
188
|
}
|
@@ -253,8 +253,8 @@ const LabelSlotWrapper = styled('div', inputProps)`
|
|
253
253
|
align-items: center;
|
254
254
|
cursor: ${(props) => (props.isInteractive ? 'ew-resize' : 'auto')};
|
255
255
|
border: ${(props) =>
|
256
|
-
props.alignItems=="vertical"
|
257
|
-
? "none"
|
256
|
+
props.alignItems=="vertical"
|
257
|
+
? "none"
|
258
258
|
: props.isError
|
259
259
|
? '1px solid ' + props.theme.colors.red
|
260
260
|
: props.noBorder
|
@@ -330,7 +330,7 @@ export default {
|
|
330
330
|
},
|
331
331
|
inputHeight: {
|
332
332
|
required: false,
|
333
|
-
default:
|
333
|
+
default: '40px'
|
334
334
|
},
|
335
335
|
value: {
|
336
336
|
required: true,
|
@@ -5,7 +5,9 @@
|
|
5
5
|
:alignItems="alignItems"
|
6
6
|
>
|
7
7
|
<label-wrapper v-if="label">
|
8
|
-
<input-label :labelFontColor="labelFontColor" :fontSize="fontSize">{{
|
8
|
+
<input-label :labelFontColor="labelFontColor" :fontSize="fontSize">{{
|
9
|
+
label
|
10
|
+
}}</input-label>
|
9
11
|
<info-text
|
10
12
|
v-if="infoTextMessage"
|
11
13
|
:text="infoTextMessage"
|
@@ -67,17 +69,17 @@ const Container = styled.div`
|
|
67
69
|
position: relative;
|
68
70
|
`
|
69
71
|
|
70
|
-
const labelAttrs = { fontSize: String,labelFontColor:String
|
72
|
+
const labelAttrs = { fontSize: String, labelFontColor: String }
|
71
73
|
const InputLabel = styled('div', labelAttrs)`
|
72
|
-
color: ${(props) =>
|
73
|
-
props.theme.colors[props.labelFontColor]
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
74
|
+
color: ${(props) =>
|
75
|
+
props.theme.colors[props.labelFontColor]
|
76
|
+
? props.theme.colors[props.labelFontColor]
|
77
|
+
: props.labelFontColor
|
78
|
+
? props.labelFontColor
|
79
|
+
: props.theme.colors.eturnityGrey};
|
78
80
|
|
79
81
|
font-size: ${(props) => (props.fontSize ? props.fontSize : '13px')};
|
80
|
-
font-
|
82
|
+
font-weight: 700;
|
81
83
|
`
|
82
84
|
|
83
85
|
const LabelWrapper = styled.div`
|
@@ -104,21 +106,21 @@ const inputProps = {
|
|
104
106
|
fontSize: String,
|
105
107
|
inputType: String,
|
106
108
|
fontColor: String,
|
107
|
-
backgroundColor:String,
|
108
|
-
borderColor:String,
|
109
|
-
inputHeight:String,
|
110
|
-
disabledBackgroundColor:String
|
109
|
+
backgroundColor: String,
|
110
|
+
borderColor: String,
|
111
|
+
inputHeight: String,
|
112
|
+
disabledBackgroundColor: String
|
111
113
|
}
|
112
114
|
const InputContainer = styled('input', inputProps)`
|
113
115
|
border: ${(props) =>
|
114
|
-
|
116
|
+
props.isError
|
115
117
|
? '1px solid ' + props.theme.colors.red
|
116
118
|
: props.noBorder
|
117
119
|
? 'none'
|
118
|
-
: props.borderColor
|
119
|
-
props.theme.colors[props.borderColor]
|
120
|
-
|
121
|
-
|
120
|
+
: props.borderColor
|
121
|
+
? props.theme.colors[props.borderColor]
|
122
|
+
? '1px solid ' + props.theme.colors[props.borderColor]
|
123
|
+
: '1px solid ' + props.borderColor
|
122
124
|
: '1px solid ' + props.theme.colors.grey4};
|
123
125
|
padding: ${(props) =>
|
124
126
|
props.isError
|
@@ -137,19 +139,21 @@ const InputContainer = styled('input', inputProps)`
|
|
137
139
|
: props.fontColor
|
138
140
|
? props.fontColor + ' !important'
|
139
141
|
: props.theme.colors.black};
|
140
|
-
|
142
|
+
|
141
143
|
width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
|
142
144
|
min-width: ${(props) => (props.minWidth ? props.minWidth : 'unset')};
|
143
145
|
max-height: ${(props) => props.inputHeight};
|
144
146
|
box-sizing: border-box; // to allow width of 100% with padding
|
145
147
|
font-weight: 400;
|
146
148
|
cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'auto')};
|
147
|
-
background-color: ${(props) =>
|
148
|
-
props.isDisabled
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
149
|
+
background-color: ${(props) =>
|
150
|
+
props.isDisabled
|
151
|
+
? props.disabledBackgroundColor
|
152
|
+
? props.disabledBackgroundColor + ' !important'
|
153
|
+
: props.theme.colors.grey5
|
154
|
+
: props.backgroundColor
|
155
|
+
? props.backgroundColor + ' !important'
|
156
|
+
: props.theme.colors.white};
|
153
157
|
&::placeholder {
|
154
158
|
color: ${(props) => props.theme.colors.grey2};
|
155
159
|
}
|
@@ -278,28 +282,27 @@ export default {
|
|
278
282
|
required: false,
|
279
283
|
default: 'text'
|
280
284
|
},
|
281
|
-
labelFontColor:{
|
282
|
-
required:false,
|
283
|
-
default:'black'
|
284
|
-
},
|
285
|
-
backgroundColor:{
|
286
|
-
required:false,
|
287
|
-
default:'white'
|
285
|
+
labelFontColor: {
|
286
|
+
required: false,
|
287
|
+
default: 'black'
|
288
288
|
},
|
289
|
-
|
290
|
-
required:false
|
291
|
-
default:null
|
289
|
+
backgroundColor: {
|
290
|
+
required: false
|
292
291
|
},
|
293
|
-
|
294
|
-
required:false,
|
295
|
-
default:
|
292
|
+
disabledBackgroundColor: {
|
293
|
+
required: false,
|
294
|
+
default: null
|
296
295
|
},
|
297
|
-
|
298
|
-
required:false,
|
296
|
+
fontColor: {
|
297
|
+
required: false,
|
298
|
+
default: 'black'
|
299
299
|
},
|
300
300
|
hasFocus: {
|
301
301
|
required: false,
|
302
302
|
default: false
|
303
|
+
},
|
304
|
+
borderColor: {
|
305
|
+
required: false
|
303
306
|
}
|
304
307
|
},
|
305
308
|
methods: {
|
@@ -321,8 +324,8 @@ export default {
|
|
321
324
|
hasFocus(newVal) {
|
322
325
|
if (newVal) {
|
323
326
|
this.$nextTick(() => {
|
324
|
-
this.$refs.inputElement.$el.focus()
|
325
|
-
})
|
327
|
+
this.$refs.inputElement.$el.focus()
|
328
|
+
})
|
326
329
|
}
|
327
330
|
}
|
328
331
|
}
|
@@ -176,7 +176,7 @@ const SelectButtonWrapperAttrs = {
|
|
176
176
|
disabled: Boolean
|
177
177
|
}
|
178
178
|
const SelectButtonWrapper = styled('div', SelectButtonWrapperAttrs)`
|
179
|
-
${(props) => (props.disabled ? 'cursor: not-allowed' : '')};
|
179
|
+
${(props) => (props.disabled ? 'cursor: not-allowed' : 'cursor: pointer')};
|
180
180
|
`
|
181
181
|
|
182
182
|
const selectButtonAttrs = {
|
@@ -192,7 +192,8 @@ const selectButton = styled('div', selectButtonAttrs)`
|
|
192
192
|
position: relative;
|
193
193
|
box-sizing: border-box;
|
194
194
|
border-radius: 4px;
|
195
|
-
padding: ${(props) =>
|
195
|
+
padding: ${(props) =>
|
196
|
+
props.isSearchBarVisible ? '0 10px 0 0' : '0px 10px 0 15px'};
|
196
197
|
text-align: left;
|
197
198
|
border-radius: 4px;
|
198
199
|
min-height: 36px;
|
@@ -1,244 +1,260 @@
|
|
1
1
|
<template>
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
<container>
|
3
|
+
<flex-wrapper
|
4
|
+
:size="size"
|
5
|
+
:disabled="disabled"
|
6
|
+
:alignItems="alignItems"
|
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"
|
7
34
|
:colorMode="colorMode"
|
35
|
+
:primaryColor="primaryColor"
|
36
|
+
:secondaryColor="secondaryColor"
|
37
|
+
:inactiveColor="inactiveColor"
|
8
38
|
>
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
:
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
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
|
-
// 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) =>
|
39
|
+
{{ item.content }}
|
40
|
+
</switchOption>
|
41
|
+
</switch-wrapper>
|
42
|
+
<label-container
|
43
|
+
v-if="label && labelAlign === 'right'"
|
44
|
+
:hasInfoMessage="!!infoTextMessage"
|
45
|
+
>
|
46
|
+
<label-text :size="size" :fontColor="fontColor">{{ label }}</label-text>
|
47
|
+
<info-text
|
48
|
+
@click.native.stop
|
49
|
+
v-if="infoTextMessage"
|
50
|
+
:text="infoTextMessage"
|
51
|
+
borderColor="#ccc"
|
52
|
+
size="14px"
|
53
|
+
:alignText="infoTextAlign"
|
54
|
+
/>
|
55
|
+
</label-container>
|
56
|
+
</flex-wrapper>
|
57
|
+
</container>
|
58
|
+
</template>
|
59
|
+
|
60
|
+
<script>
|
61
|
+
// import Toggle from "@eturnity/eturnity_reusable_components/src/components/inputs/toggle"
|
62
|
+
// To use:
|
63
|
+
// <SwitchField
|
64
|
+
// @on-switch-change="onInputChange($event)"
|
65
|
+
// :options="[{value:0,content:'zero'},{value:1,content:'one'},{value:2,content:'two'}]"
|
66
|
+
// :value="1"
|
67
|
+
// label="label"
|
68
|
+
// toggleColor="red"
|
69
|
+
// size="large"
|
70
|
+
// backgroundColor="blue"
|
71
|
+
// labelAlign="left"
|
72
|
+
// fontColor="black"
|
73
|
+
// :disabled="false"
|
74
|
+
// />
|
75
|
+
|
76
|
+
import styled from 'vue-styled-components'
|
77
|
+
import InfoText from '../../infoText'
|
78
|
+
import theme from '../../../assets/theme'
|
79
|
+
const Container = styled.div``
|
80
|
+
|
81
|
+
const flexAttrs = {
|
82
|
+
label: String,
|
83
|
+
size: String,
|
84
|
+
disabled: Boolean,
|
85
|
+
alignItems: String
|
86
|
+
}
|
87
|
+
const FlexWrapper = styled('div', flexAttrs)`
|
88
|
+
display: grid;
|
89
|
+
grid-template-columns: auto 1fr;
|
90
|
+
grid-gap: 10px;
|
91
|
+
align-items: center;
|
92
|
+
cursor: ${(props) => (props.disabled ? 'not-allowed' : 'pointer')};
|
93
|
+
grid-template-columns: ${(props) =>
|
84
94
|
props.alignItems === 'vertical' || !props.label ? '1fr' : 'auto 1fr'};
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
95
|
+
`
|
96
|
+
|
97
|
+
const toggleAttrs = {
|
98
|
+
size: String,
|
99
|
+
fontColor: String,
|
100
|
+
disabled: Boolean,
|
101
|
+
backgroundColor: String,
|
102
|
+
isChecked: Boolean
|
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;
|
93
147
|
}
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
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
|
-
}
|
148
|
+
&:first-child {
|
149
|
+
border-radius: 4px 0 0 4px;
|
150
|
+
}
|
151
|
+
&:last-child {
|
152
|
+
border-radius: 0 4px 4px 0;
|
153
|
+
}
|
154
|
+
`
|
136
155
|
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
156
|
+
const labelAttrs = { hasInfoMessage: Boolean }
|
157
|
+
const LabelContainer = styled('div', labelAttrs)`
|
158
|
+
display: inline-grid;
|
159
|
+
grid-template-columns: ${(props) =>
|
160
|
+
props.hasInfoMessage ? 'auto 1fr' : 'auto'};
|
161
|
+
grid-gap: 12px;
|
162
|
+
align-items: center;
|
163
|
+
`
|
164
|
+
|
165
|
+
export default {
|
166
|
+
name: 'switchField',
|
167
|
+
components: {
|
168
|
+
Container,
|
169
|
+
SwitchWrapper,
|
170
|
+
FlexWrapper,
|
171
|
+
LabelText,
|
172
|
+
InfoText,
|
173
|
+
LabelContainer,
|
174
|
+
switchOption
|
175
|
+
},
|
176
|
+
props: {
|
177
|
+
label: {
|
178
|
+
required: false,
|
179
|
+
default: ''
|
180
|
+
},
|
181
|
+
toggleColor: {
|
182
|
+
required: false
|
183
|
+
},
|
184
|
+
backgroundColor: {
|
185
|
+
required: false
|
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
|
158
201
|
},
|
159
|
-
|
160
|
-
|
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
|
-
},
|
202
|
+
infoTextMessage: {
|
203
|
+
required: false
|
206
204
|
},
|
207
|
-
|
208
|
-
|
209
|
-
selectedValue:null,
|
210
|
-
primaryColor:"white",
|
211
|
-
secondaryColor:"black",
|
212
|
-
inactiveColor:"grey6"
|
213
|
-
}
|
205
|
+
infoTextAlign: {
|
206
|
+
required: false
|
214
207
|
},
|
215
|
-
|
216
|
-
|
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
|
-
}
|
208
|
+
colorMode: {
|
209
|
+
required: false,
|
210
|
+
default: 'light'
|
227
211
|
},
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
return
|
232
|
-
}
|
233
|
-
this.selectedValue=value
|
234
|
-
this.$emit("on-switch-change", this.selectedValue)
|
235
|
-
},
|
212
|
+
alignItems: {
|
213
|
+
required: false,
|
214
|
+
default: 'horizontal'
|
236
215
|
},
|
237
|
-
|
238
|
-
|
239
|
-
|
216
|
+
options: {
|
217
|
+
required: true
|
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
|
240
249
|
}
|
250
|
+
this.selectedValue = value
|
251
|
+
this.$emit('on-switch-change', this.selectedValue)
|
252
|
+
}
|
253
|
+
},
|
254
|
+
watch: {
|
255
|
+
value(val) {
|
256
|
+
this.selectedValue = val
|
241
257
|
}
|
242
258
|
}
|
243
|
-
|
244
|
-
|
259
|
+
}
|
260
|
+
</script>
|
@@ -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-weight: 700;
|
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-weight: 700;
|
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>
|