@eturnity/eturnity_reusable_components 1.2.31-3d-master.6 → 1.2.31-3d-master.7
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
package/src/App.vue
CHANGED
|
@@ -53,6 +53,23 @@
|
|
|
53
53
|
</div>
|
|
54
54
|
</template>
|
|
55
55
|
</input-number>
|
|
56
|
+
<Select
|
|
57
|
+
hoverDropdown="true"
|
|
58
|
+
selectWidth="100%"
|
|
59
|
+
optionWidth="50%"
|
|
60
|
+
label="that is a label"
|
|
61
|
+
alignItems="vertical"
|
|
62
|
+
>
|
|
63
|
+
<template #selector="{selectedValue}">
|
|
64
|
+
value selected: {{selectedValue}}
|
|
65
|
+
</template>
|
|
66
|
+
<template #dropdown>
|
|
67
|
+
<Option value="1">value one</Option>
|
|
68
|
+
<Option value="2">value two</Option>
|
|
69
|
+
<Option value="3">value three</Option>
|
|
70
|
+
<Option value="4">value four</Option>
|
|
71
|
+
</template>
|
|
72
|
+
</Select>
|
|
56
73
|
</div>
|
|
57
74
|
</modal>
|
|
58
75
|
</page-container>
|
|
@@ -64,6 +81,8 @@ import { ThemeProvider } from "vue-styled-components"
|
|
|
64
81
|
import theme from "./assets/theme"
|
|
65
82
|
import styled from "vue-styled-components"
|
|
66
83
|
import InputNumber from "@/components/inputs/inputNumber"
|
|
84
|
+
import Select from "@/components/inputs/select"
|
|
85
|
+
import Option from "@/components/inputs/select/option"
|
|
67
86
|
import Modal from "@/components/modals/modal"
|
|
68
87
|
// import TableDropdown from "@/components/tableDropdown"
|
|
69
88
|
|
|
@@ -83,12 +102,15 @@ export default {
|
|
|
83
102
|
ThemeProvider,
|
|
84
103
|
PageContainer,
|
|
85
104
|
InputNumber,
|
|
86
|
-
Modal
|
|
105
|
+
Modal,
|
|
106
|
+
Option,
|
|
107
|
+
Select
|
|
87
108
|
},
|
|
88
109
|
data() {
|
|
89
110
|
return {
|
|
90
111
|
value:42,
|
|
91
|
-
value2:42
|
|
112
|
+
value2:42,
|
|
113
|
+
companyName:"toto"
|
|
92
114
|
}
|
|
93
115
|
},
|
|
94
116
|
methods: {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
</label-slot-wrapper>
|
|
6
6
|
|
|
7
7
|
<label-wrapper v-if="labelText">
|
|
8
|
-
<label-text>
|
|
8
|
+
<label-text :labelFontColor="labelFontColor">
|
|
9
9
|
{{ labelText }}
|
|
10
10
|
</label-text>
|
|
11
11
|
<info-text
|
|
@@ -113,7 +113,8 @@ const inputProps = {
|
|
|
113
113
|
slotSize: String,
|
|
114
114
|
inputHeight:String,
|
|
115
115
|
isInteractive:Boolean,
|
|
116
|
-
alignItems:String
|
|
116
|
+
alignItems:String,
|
|
117
|
+
labelFontColor:String
|
|
117
118
|
}
|
|
118
119
|
|
|
119
120
|
const Container = styled('div', inputProps)`
|
|
@@ -238,9 +239,9 @@ const LabelSlotWrapper = styled('div',inputProps)`
|
|
|
238
239
|
cursor: ${(props) => (props.isInteractive?'ew-resize':'auto')};
|
|
239
240
|
`
|
|
240
241
|
|
|
241
|
-
const LabelText = styled
|
|
242
|
+
const LabelText = styled('div',inputProps)`
|
|
242
243
|
font-size: 13px;
|
|
243
|
-
color: ${(props) => props.theme.colors.
|
|
244
|
+
color: ${(props) => props.theme.colors[props.labelFontColor]?props.theme.colors[props.labelFontColor]:props.labelFontColor};
|
|
244
245
|
font-weight: 700;
|
|
245
246
|
`
|
|
246
247
|
|
|
@@ -389,6 +390,10 @@ export default {
|
|
|
389
390
|
},
|
|
390
391
|
slotSize: {
|
|
391
392
|
required: false
|
|
393
|
+
},
|
|
394
|
+
labelFontColor:{
|
|
395
|
+
required:false,
|
|
396
|
+
default:'eturnityGrey'
|
|
392
397
|
}
|
|
393
398
|
},
|
|
394
399
|
computed: {
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Container :selectWidth="selectWidth" v-click-outside="closeDropdown">
|
|
3
|
+
<input-wrapper
|
|
4
|
+
:hasLabel="!!label && label.length > 0"
|
|
5
|
+
:alignItems="alignItems"
|
|
6
|
+
>
|
|
7
|
+
<label-wrapper v-if="label">
|
|
8
|
+
<input-label :fontSize="fontSize">{{ label }}</input-label>
|
|
9
|
+
<info-text
|
|
10
|
+
v-if="infoTextMessage"
|
|
11
|
+
:text="infoTextMessage"
|
|
12
|
+
borderColor="#ccc"
|
|
13
|
+
:size="fontSize ? fontSize : '16px'"
|
|
14
|
+
:alignText="infoTextAlign"
|
|
15
|
+
/>
|
|
16
|
+
</label-wrapper>
|
|
17
|
+
<div>
|
|
18
|
+
<selectButton @click="toggleDropdown" @mouseenter="mouseEnterHandler">
|
|
19
|
+
<slot name="selector" :selectedValue="selectedValue"></slot>
|
|
20
|
+
<Caret :isUp="isDropdownOpen">
|
|
21
|
+
<icon name="arrow_up" size="12px"/>
|
|
22
|
+
</Caret>
|
|
23
|
+
</selectButton>
|
|
24
|
+
<DropdownWrapper>
|
|
25
|
+
<selectDropdown
|
|
26
|
+
v-if="isDropdownOpen"
|
|
27
|
+
:optionWidth="optionWidth"
|
|
28
|
+
@option-selected="optionSelected">
|
|
29
|
+
<slot name="dropdown"></slot>
|
|
30
|
+
</selectDropdown>
|
|
31
|
+
</DropdownWrapper>
|
|
32
|
+
</div>
|
|
33
|
+
</input-wrapper>
|
|
34
|
+
</Container>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<script>
|
|
38
|
+
//How to use it
|
|
39
|
+
// <Select
|
|
40
|
+
// hoverDropdown="true"
|
|
41
|
+
// selectWidth="100%"
|
|
42
|
+
// optionWidth="50%"
|
|
43
|
+
// label="that is a label"
|
|
44
|
+
// alignItems="vertical"
|
|
45
|
+
// >
|
|
46
|
+
// <template #selector="{selectedValue}">
|
|
47
|
+
// value selected: {{selectedValue}}
|
|
48
|
+
// </template>
|
|
49
|
+
// <template #dropdown>
|
|
50
|
+
// <Option value="1">value one</Option>
|
|
51
|
+
// <Option value="2">value two</Option>
|
|
52
|
+
// <Option value="3">value three</Option>
|
|
53
|
+
// <Option value="4">value four</Option>
|
|
54
|
+
// </template>
|
|
55
|
+
// </Select>
|
|
56
|
+
|
|
57
|
+
import styled from 'vue-styled-components'
|
|
58
|
+
import InfoText from '../../infoText'
|
|
59
|
+
import icon from '@/components/icon'
|
|
60
|
+
const caretAttrs={isUp:Boolean}
|
|
61
|
+
const Caret=styled('div', caretAttrs)`
|
|
62
|
+
position:absolute;
|
|
63
|
+
display:flex;
|
|
64
|
+
align-items:center;
|
|
65
|
+
height:100%;
|
|
66
|
+
right:15px;
|
|
67
|
+
top:2px
|
|
68
|
+
transform: ${props=>!props.isUp?"rotate(180deg)":""};
|
|
69
|
+
transform-origin: 6px 17px;
|
|
70
|
+
`
|
|
71
|
+
|
|
72
|
+
const labelAttrs = { fontSize: String }
|
|
73
|
+
const InputLabel = styled('div', labelAttrs)`
|
|
74
|
+
color: ${(props) => props.theme.colors.eturnityGrey};
|
|
75
|
+
font-size: ${(props) => (props.fontSize ? props.fontSize : '13px')};
|
|
76
|
+
font-weight: 700;
|
|
77
|
+
`
|
|
78
|
+
const inputProps={selectWidth: String, optionWidth: String}
|
|
79
|
+
const Container = styled('div', inputProps)`
|
|
80
|
+
width: ${(props) => (props.selectWidth ? props.selectWidth : '100%')};
|
|
81
|
+
position: relative;
|
|
82
|
+
display: inline-block;
|
|
83
|
+
`
|
|
84
|
+
const LabelWrapper = styled.div`
|
|
85
|
+
display: inline-grid;
|
|
86
|
+
grid-template-columns: auto auto;
|
|
87
|
+
grid-gap: 12px;
|
|
88
|
+
align-items: center;
|
|
89
|
+
justify-content: start;
|
|
90
|
+
`
|
|
91
|
+
|
|
92
|
+
const selectButton = styled('div')`
|
|
93
|
+
position:relative;
|
|
94
|
+
box-sizing: border-box;
|
|
95
|
+
border:1px solid red;
|
|
96
|
+
border-radius:4px;
|
|
97
|
+
padding:10px 15px;
|
|
98
|
+
text-align:left;
|
|
99
|
+
border-radius:4px;
|
|
100
|
+
min-height:36px;
|
|
101
|
+
display: flex;
|
|
102
|
+
align-items: center;
|
|
103
|
+
border:1px solid ${(props)=>props.theme.colors.grey4}
|
|
104
|
+
|
|
105
|
+
`
|
|
106
|
+
const selectDropdown = styled('div',inputProps)`
|
|
107
|
+
box-sizing: border-box;
|
|
108
|
+
z-index: 1;
|
|
109
|
+
position:absolute
|
|
110
|
+
top:5px;
|
|
111
|
+
padding:10px;
|
|
112
|
+
border:1px solid ${(props)=>props.theme.colors.grey4}
|
|
113
|
+
border-radius:4px;
|
|
114
|
+
background-color:white;
|
|
115
|
+
display: flex;
|
|
116
|
+
flex-direction: column;
|
|
117
|
+
align-items: flex-start;
|
|
118
|
+
padding: 0px;
|
|
119
|
+
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
|
|
120
|
+
width: ${(props) => (props.optionWidth ? props.optionWidth : '100%')};
|
|
121
|
+
`
|
|
122
|
+
const DropdownWrapper=styled('div')`
|
|
123
|
+
position:relative;
|
|
124
|
+
`
|
|
125
|
+
const inputAttrs = { alignItems: String, hasLabel: Boolean }
|
|
126
|
+
const InputWrapper = styled('div', inputAttrs)`
|
|
127
|
+
position: relative;
|
|
128
|
+
display: grid;
|
|
129
|
+
align-items: center;
|
|
130
|
+
gap: 8px;
|
|
131
|
+
grid-template-columns: ${(props) =>
|
|
132
|
+
props.alignItems === 'vertical' || !props.hasLabel ? '1fr' : 'auto 1fr'};
|
|
133
|
+
`
|
|
134
|
+
export default {
|
|
135
|
+
name: 'RCselect',
|
|
136
|
+
|
|
137
|
+
props: {
|
|
138
|
+
value:{
|
|
139
|
+
required:false,
|
|
140
|
+
default: null
|
|
141
|
+
},
|
|
142
|
+
fontSize:{
|
|
143
|
+
required:false,
|
|
144
|
+
default: null
|
|
145
|
+
},
|
|
146
|
+
label:{
|
|
147
|
+
required:false
|
|
148
|
+
},
|
|
149
|
+
infoTextMessage:{
|
|
150
|
+
required:false
|
|
151
|
+
},
|
|
152
|
+
infoTextAlign:{
|
|
153
|
+
required:false
|
|
154
|
+
},
|
|
155
|
+
selectWidth: {
|
|
156
|
+
required: false,
|
|
157
|
+
default: null
|
|
158
|
+
},
|
|
159
|
+
optionWidth: {
|
|
160
|
+
required: false,
|
|
161
|
+
default: null
|
|
162
|
+
},
|
|
163
|
+
hoverDropdown: {
|
|
164
|
+
required: false,
|
|
165
|
+
default: false
|
|
166
|
+
},
|
|
167
|
+
alignItems:{
|
|
168
|
+
required: false,
|
|
169
|
+
default: 'horizontal'
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
|
|
173
|
+
components: {
|
|
174
|
+
selectButton,
|
|
175
|
+
selectDropdown,
|
|
176
|
+
Container,
|
|
177
|
+
InputLabel,
|
|
178
|
+
LabelWrapper,
|
|
179
|
+
InfoText,
|
|
180
|
+
InputWrapper,
|
|
181
|
+
DropdownWrapper,
|
|
182
|
+
icon,
|
|
183
|
+
Caret
|
|
184
|
+
},
|
|
185
|
+
|
|
186
|
+
data() {
|
|
187
|
+
return {
|
|
188
|
+
selectedValue: null,
|
|
189
|
+
isDropdownOpen:false
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
created(){
|
|
193
|
+
this.selectedValue=this.value
|
|
194
|
+
},
|
|
195
|
+
methods:{
|
|
196
|
+
toggleDropdown(){
|
|
197
|
+
this.isDropdownOpen=!this.isDropdownOpen
|
|
198
|
+
},
|
|
199
|
+
closeDropdown(){
|
|
200
|
+
this.isDropdownOpen=false
|
|
201
|
+
},
|
|
202
|
+
optionSelected(e){
|
|
203
|
+
this.selectedValue=e
|
|
204
|
+
this.closeDropdown()
|
|
205
|
+
this.$emit('input-change',e)
|
|
206
|
+
},
|
|
207
|
+
mouseEnterHandler(){
|
|
208
|
+
if(this.hoverDropdown){
|
|
209
|
+
this.isDropdownOpen=true
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
computed: {
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
</script>
|
|
217
|
+
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<optionContainer @click="clickHandler">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</optionContainer>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
// import selectButton from './selectButton'
|
|
9
|
+
// import selectDropdown from './selectDropDown'
|
|
10
|
+
import styled from 'vue-styled-components'
|
|
11
|
+
|
|
12
|
+
const optionContainer = styled('div')`
|
|
13
|
+
display:flex;
|
|
14
|
+
height:40px;
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
flex-direction: row;
|
|
17
|
+
justify-content: space-between;
|
|
18
|
+
align-items: center;
|
|
19
|
+
padding: 0px 15px;
|
|
20
|
+
gap: 14px;
|
|
21
|
+
width:100%;
|
|
22
|
+
box-sizing:inherit;
|
|
23
|
+
&:hover{
|
|
24
|
+
background-color:${(props)=>props.theme.colors.grey5};
|
|
25
|
+
}
|
|
26
|
+
`
|
|
27
|
+
|
|
28
|
+
export default {
|
|
29
|
+
name: 'RCoption',
|
|
30
|
+
|
|
31
|
+
props: {
|
|
32
|
+
value: {
|
|
33
|
+
required: true
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
components: {optionContainer},
|
|
38
|
+
|
|
39
|
+
data() {
|
|
40
|
+
return {}
|
|
41
|
+
},
|
|
42
|
+
methods:{
|
|
43
|
+
clickHandler(){
|
|
44
|
+
console.log('click from option component')
|
|
45
|
+
console.log(this.$parent)
|
|
46
|
+
console.log(this.$parent.$parent)
|
|
47
|
+
this.$parent.$emit('option-selected',this.value)
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
computed: {
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
</script>
|
|
54
|
+
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import Select from "./index.vue"
|
|
2
|
+
import Option from "./option/index.vue"
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "select",
|
|
6
|
+
component: Select,
|
|
7
|
+
// argTypes: {},
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const Template = (args, { argTypes }) => ({
|
|
11
|
+
// Components used in your story `template` are defined in the `components` object
|
|
12
|
+
components: { Select,Option },
|
|
13
|
+
// The story's `args` need to be mapped into the template through the `setup()` method
|
|
14
|
+
props: Object.keys(argTypes),
|
|
15
|
+
template: `<Select v-bind="$props">
|
|
16
|
+
<template #selector="{selectedValue}">
|
|
17
|
+
value selected: {{selectedValue}}
|
|
18
|
+
</template>
|
|
19
|
+
<template #dropdown>
|
|
20
|
+
<Option value="1">value one</Option>
|
|
21
|
+
<Option value="2">value two</Option>
|
|
22
|
+
<Option value="3">value three</Option>
|
|
23
|
+
<Option value="4">value four</Option>
|
|
24
|
+
</template>
|
|
25
|
+
</Select>`,
|
|
26
|
+
|
|
27
|
+
// import Select from "@eturnity/eturnity_reusable_components/src/components/inputs/select"
|
|
28
|
+
// import Option from "@eturnity/eturnity_reusable_components/src/components/inputs/select/option"
|
|
29
|
+
// To use:
|
|
30
|
+
// How to use it
|
|
31
|
+
// <Select
|
|
32
|
+
// hoverDropdown="true"
|
|
33
|
+
// selectWidth="100%"
|
|
34
|
+
// optionWidth="50%"
|
|
35
|
+
// label="that is a label"
|
|
36
|
+
// alignItems="vertical"
|
|
37
|
+
// >
|
|
38
|
+
// <template #selector="{selectedValue}">
|
|
39
|
+
// value selected: {{selectedValue}}
|
|
40
|
+
// </template>
|
|
41
|
+
// <template #dropdown>
|
|
42
|
+
// <Option value="1">value one</Option>
|
|
43
|
+
// <Option value="2">value two</Option>
|
|
44
|
+
// <Option value="3">value three</Option>
|
|
45
|
+
// <Option value="4">value four</Option>
|
|
46
|
+
// </template>
|
|
47
|
+
// </Select>
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
export const Default = Template.bind({})
|
|
51
|
+
Default.args = {
|
|
52
|
+
hoverDropdown="true"
|
|
53
|
+
selectWidth="100%"
|
|
54
|
+
optionWidth="50%"
|
|
55
|
+
label="that is a label"
|
|
56
|
+
alignItems="vertical"
|
|
57
|
+
value="2"
|
|
58
|
+
}
|
|
59
|
+
|