@eturnity/eturnity_reusable_components 1.2.31-3d-master.4 → 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
|
@@ -3,146 +3,75 @@
|
|
|
3
3
|
<page-container>
|
|
4
4
|
<br />
|
|
5
5
|
|
|
6
|
-
<iconWrapper name="bell"/>
|
|
7
6
|
<modal backdrop="dark" :isLoading="false" :isOpen="true">
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
<main-table titleText="My Table">
|
|
12
|
-
<thead>
|
|
13
|
-
<tr>
|
|
14
|
-
<th>Column 1</th>
|
|
15
|
-
<th>Column 2</th>
|
|
16
|
-
<th>Column 3</th>
|
|
17
|
-
<div />
|
|
18
|
-
</tr>
|
|
19
|
-
</thead>
|
|
20
|
-
<tbody>
|
|
21
|
-
<tr> -->
|
|
22
|
-
<!-- <table-dropdown
|
|
23
|
-
:colSpan="3"
|
|
24
|
-
:tableItems="getDropdownValues()"
|
|
25
|
-
@toggle-dropdown-open="toggleDropdownOpen()"
|
|
26
|
-
@item-selected="onItemSelected({ item: $event, index })"
|
|
27
|
-
:isOpen="isDropdownOpen()"
|
|
28
|
-
:optionItems="itemOptions"
|
|
29
|
-
:optionsDisplay="['display_name', 'company_item_number', 'model']"
|
|
30
|
-
/> -->
|
|
31
|
-
<!-- <td>Test</td>
|
|
32
|
-
<div class="icons-container">
|
|
33
|
-
<three-dots :options="listOptions" :isLoading="false" />
|
|
34
|
-
</div>
|
|
35
|
-
</tr>
|
|
36
|
-
</tbody>
|
|
37
|
-
</main-table>
|
|
38
|
-
</modal>
|
|
39
|
-
<row-container>
|
|
40
|
-
<div v-for="(item, index) in markersArray" :key="item.index">
|
|
41
|
-
<project-marker
|
|
42
|
-
:activeLanguage="'en-us'"
|
|
43
|
-
:markerData="item"
|
|
44
|
-
:isLimitedPartner="false"
|
|
45
|
-
:isGroupSupport="false"
|
|
46
|
-
:isEditable="true"
|
|
47
|
-
:gettext="gettext"
|
|
48
|
-
:date="'23.07.2022'"
|
|
49
|
-
@editHandler="consoleLog('edit index ' + index)"
|
|
50
|
-
@deleteHandler="consoleLog('delete id ' + item.id)"
|
|
51
|
-
/>
|
|
52
|
-
</div>
|
|
53
|
-
</row-container>
|
|
54
|
-
<br />
|
|
55
|
-
<iconCollection />
|
|
56
|
-
<br />
|
|
57
|
-
<toggle
|
|
58
|
-
@on-toggle-change="onInputChange($event)"
|
|
59
|
-
:isChecked="inputValue"
|
|
60
|
-
label="My Label Text"
|
|
61
|
-
infoTextMessage="This is my test message"
|
|
62
|
-
infoTextAlign="right"
|
|
63
|
-
labelAlign="right"
|
|
64
|
-
:disabled="false"
|
|
65
|
-
/>
|
|
66
|
-
<<<<<<< HEAD
|
|
67
|
-
<br />
|
|
68
|
-
>>>>>>> EPDM-5448
|
|
69
|
-
<input-number
|
|
70
|
-
:value="inputValue"
|
|
71
|
-
@input-change="inputValue = $event"
|
|
72
|
-
inputWidth="250px"
|
|
73
|
-
slotSize="50%"
|
|
74
|
-
><InputAnnexContainer>
|
|
75
|
-
<span>123m2</span>
|
|
76
|
-
<info-text size="10px" alignArrow="right" text="infoText ceci est le text"></info-text>
|
|
77
|
-
</InputAnnexContainer>
|
|
78
|
-
</input-number>
|
|
79
|
-
<input-number
|
|
80
|
-
:value="inputValue"
|
|
81
|
-
@input-change="inputValue = $event"
|
|
82
|
-
inputWidth="250px"
|
|
83
|
-
slotSize="50%"
|
|
84
|
-
:isError="true"
|
|
85
|
-
><InputAnnexContainer>
|
|
86
|
-
<span>123m2</span>
|
|
87
|
-
<info-text :style="{'justify-self': 'end'}" size="12px" alignArrow="center" text="infoText ceci est le text">This is the tooltip text</info-text>
|
|
88
|
-
</InputAnnexContainer>
|
|
89
|
-
</input-number>
|
|
90
|
-
<br />
|
|
8
|
+
<div :style="{padding:'50px'}">
|
|
91
9
|
|
|
92
|
-
<p>InputText</p>
|
|
93
|
-
<input-text
|
|
94
|
-
placeholder="Company name"
|
|
95
|
-
:value="inputValue"
|
|
96
|
-
:isError="true"
|
|
97
|
-
errorMessage="This is my error message"
|
|
98
|
-
infoTextAlign="right"
|
|
99
|
-
infoTextMessage="My info message"
|
|
100
|
-
label="Question 5"
|
|
101
|
-
alignItems="vertical"
|
|
102
|
-
inputWidth="250px"
|
|
103
|
-
minWidth="100px"
|
|
104
|
-
/>
|
|
105
|
-
<br/>
|
|
106
10
|
<input-number
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
label="Do you accept the Terms?"
|
|
130
|
-
:isChecked="true"
|
|
131
|
-
size="small"
|
|
132
|
-
:isDisabled="false"
|
|
133
|
-
/> -->
|
|
134
|
-
<!-- <external-button text="Click me!" minWidth="500px" /> -->
|
|
135
|
-
>>>>>>> master
|
|
136
|
-
=======
|
|
11
|
+
:value="value"
|
|
12
|
+
:minNumber="0"
|
|
13
|
+
unitName="mm"
|
|
14
|
+
:numberPrecision="0"
|
|
15
|
+
backgroundColor="transparent"
|
|
16
|
+
inputHeight="34px"
|
|
17
|
+
inputWidth="420px"
|
|
18
|
+
textAlign="left"
|
|
19
|
+
:isInteractive="true"
|
|
20
|
+
:interactionStep="50"
|
|
21
|
+
alignItems="horizontal"
|
|
22
|
+
@on-input="value=$event"
|
|
23
|
+
@input-change="changeHandler"
|
|
24
|
+
@input-focus="focusHandler"
|
|
25
|
+
@input-blur="blurHandler"
|
|
26
|
+
>
|
|
27
|
+
<template v-slot:label>
|
|
28
|
+
<div>
|
|
29
|
+
Interactive Label
|
|
30
|
+
</div>
|
|
31
|
+
</template>
|
|
32
|
+
</input-number>
|
|
137
33
|
<input-number
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
34
|
+
:value="value2"
|
|
35
|
+
:minNumber="0"
|
|
36
|
+
unitName="mm"
|
|
37
|
+
:numberPrecision="0"
|
|
38
|
+
backgroundColor="transparent"
|
|
39
|
+
inputHeight="34px"
|
|
40
|
+
inputWidth="420px"
|
|
41
|
+
textAlign="left"
|
|
42
|
+
:isInteractive="true"
|
|
43
|
+
:interactionStep="50"
|
|
44
|
+
alignItems="horizontal"
|
|
45
|
+
@input-change="changeHandler"
|
|
46
|
+
@input-focus="focusHandler"
|
|
47
|
+
@input-blur="blurHandler"
|
|
48
|
+
@on-input="inputHandler"
|
|
49
|
+
>
|
|
50
|
+
<template v-slot:label>
|
|
51
|
+
<div>
|
|
52
|
+
Interactive Label
|
|
53
|
+
</div>
|
|
54
|
+
</template>
|
|
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>
|
|
73
|
+
</div>
|
|
74
|
+
</modal>
|
|
146
75
|
</page-container>
|
|
147
76
|
</ThemeProvider>
|
|
148
77
|
</template>
|
|
@@ -151,15 +80,10 @@
|
|
|
151
80
|
import { ThemeProvider } from "vue-styled-components"
|
|
152
81
|
import theme from "./assets/theme"
|
|
153
82
|
import styled from "vue-styled-components"
|
|
154
|
-
import MainTable from "@/components/tables/mainTable"
|
|
155
|
-
import ThreeDots from "@/components/threeDots"
|
|
156
|
-
import Toggle from "@/components/inputs/toggle"
|
|
157
83
|
import InputNumber from "@/components/inputs/inputNumber"
|
|
158
|
-
import
|
|
159
|
-
import
|
|
160
|
-
import
|
|
161
|
-
import ExternalButton from "@/components/buttons/externalButton"
|
|
162
|
-
import InputText from "@/components/inputs/inputText"
|
|
84
|
+
import Select from "@/components/inputs/select"
|
|
85
|
+
import Option from "@/components/inputs/select/option"
|
|
86
|
+
import Modal from "@/components/modals/modal"
|
|
163
87
|
// import TableDropdown from "@/components/tableDropdown"
|
|
164
88
|
|
|
165
89
|
const PageContainer = styled.div`
|
|
@@ -178,117 +102,31 @@ export default {
|
|
|
178
102
|
ThemeProvider,
|
|
179
103
|
PageContainer,
|
|
180
104
|
InputNumber,
|
|
181
|
-
PageSubtitle,
|
|
182
|
-
Spinner,
|
|
183
|
-
Checkbox,
|
|
184
|
-
InputText,
|
|
185
|
-
ExternalButton,
|
|
186
|
-
iconWrapper,
|
|
187
105
|
Modal,
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
RowContainer
|
|
106
|
+
Option,
|
|
107
|
+
Select
|
|
191
108
|
},
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
{
|
|
198
|
-
display_name: 'Test 1',
|
|
199
|
-
company_item_number: '123',
|
|
200
|
-
model: 'BTB-2145 Long Text Long Text Long Text Long Text Long Text',
|
|
201
|
-
id: 1
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
display_name: 'Test 2',
|
|
205
|
-
company_item_number: '1234',
|
|
206
|
-
model: 'BTB-123',
|
|
207
|
-
id: 2
|
|
208
|
-
},
|
|
209
|
-
{
|
|
210
|
-
display_name: 'Test 3',
|
|
211
|
-
company_item_number: '12345',
|
|
212
|
-
model: 'BTB-543',
|
|
213
|
-
id: 3
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
display_name: 'Test 4',
|
|
217
|
-
company_item_number: '123456',
|
|
218
|
-
model: 'BTB-4930',
|
|
219
|
-
id: 4
|
|
220
|
-
}
|
|
221
|
-
],
|
|
222
|
-
markersArray: [
|
|
223
|
-
{
|
|
224
|
-
id: 1180,
|
|
225
|
-
choice: 'project-on-hold',
|
|
226
|
-
translations: {
|
|
227
|
-
fr: { name: 'fr - Project on hold' },
|
|
228
|
-
'en-us': { name: 'Project on hold' },
|
|
229
|
-
'it-ch': { name: 'it-ch - Project on hold' },
|
|
230
|
-
'de-ch': { name: 'de-ch - Project on hold' },
|
|
231
|
-
'fr-be': { name: 'fr-be - Project on hold' }
|
|
232
|
-
},
|
|
233
|
-
color: '#D27CCA',
|
|
234
|
-
can_be_deleted: true
|
|
235
|
-
},
|
|
236
|
-
{
|
|
237
|
-
id: 266,
|
|
238
|
-
choice: 'transferred',
|
|
239
|
-
translations: {
|
|
240
|
-
'en-us': { name: 'Transferred' },
|
|
241
|
-
fr: { name: 'fr - Transferred' },
|
|
242
|
-
'de-ch': { name: 'de-ch - Transferred' },
|
|
243
|
-
'it-ch': { name: 'it-ch - Transferred' },
|
|
244
|
-
'fr-be': { name: 'fr-be - Transferred' }
|
|
245
|
-
},
|
|
246
|
-
color: '#20A4CA',
|
|
247
|
-
can_be_deleted: false
|
|
248
|
-
},
|
|
249
|
-
{
|
|
250
|
-
id: 267,
|
|
251
|
-
choice: 'sold',
|
|
252
|
-
translations: {
|
|
253
|
-
'en-us': { name: 'Sold' },
|
|
254
|
-
fr: { name: 'Vendu' },
|
|
255
|
-
'de-ch': { name: 'Verkauft' },
|
|
256
|
-
'it-ch': { name: 'Venduto' },
|
|
257
|
-
'fr-be': { name: 'Vendu' }
|
|
258
|
-
},
|
|
259
|
-
color: '#008351',
|
|
260
|
-
can_be_deleted: false
|
|
261
|
-
},
|
|
262
|
-
{
|
|
263
|
-
id: 268,
|
|
264
|
-
choice: 'lost',
|
|
265
|
-
translations: {
|
|
266
|
-
'en-us': { name: 'Lost' },
|
|
267
|
-
fr: { name: 'Perdu' },
|
|
268
|
-
'de-ch': { name: 'Verloren' },
|
|
269
|
-
'it-ch': { name: 'Perso' },
|
|
270
|
-
'fr-be': { name: 'Perdu' }
|
|
271
|
-
},
|
|
272
|
-
color: '#A52019',
|
|
273
|
-
can_be_deleted: false
|
|
274
|
-
},
|
|
275
|
-
{
|
|
276
|
-
id: 1181,
|
|
277
|
-
choice: 'project-created',
|
|
278
|
-
translations: {
|
|
279
|
-
fr: { name: 'Project created' },
|
|
280
|
-
'en-us': { name: 'Project created' },
|
|
281
|
-
'it-ch': { name: 'Project created' },
|
|
282
|
-
'de-ch': { name: 'Project created' },
|
|
283
|
-
'fr-be': { name: 'Project created' }
|
|
284
|
-
},
|
|
285
|
-
color: '#FDB813',
|
|
286
|
-
can_be_deleted: true
|
|
287
|
-
}
|
|
288
|
-
]
|
|
109
|
+
data() {
|
|
110
|
+
return {
|
|
111
|
+
value:42,
|
|
112
|
+
value2:42,
|
|
113
|
+
companyName:"toto"
|
|
289
114
|
}
|
|
290
115
|
},
|
|
291
116
|
methods: {
|
|
117
|
+
blurHandler(e){
|
|
118
|
+
console.log('blur',e)
|
|
119
|
+
},
|
|
120
|
+
changeHandler(e){
|
|
121
|
+
console.log('change',e)
|
|
122
|
+
},
|
|
123
|
+
focusHandler(e){
|
|
124
|
+
console.log('focus',e)
|
|
125
|
+
},
|
|
126
|
+
inputHandler(e){
|
|
127
|
+
this.value2=e
|
|
128
|
+
console.log('input',e)
|
|
129
|
+
},
|
|
292
130
|
keydownHandler(e) {
|
|
293
131
|
console.log('test', e)
|
|
294
132
|
},
|
|
@@ -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: {
|
|
@@ -402,9 +407,6 @@ export default {
|
|
|
402
407
|
hasLabelSlot(){
|
|
403
408
|
return !!this.$slots.label
|
|
404
409
|
},
|
|
405
|
-
computedSlotSize() {
|
|
406
|
-
return this.slotSize || this.$slots['default'][0].elm.clientWidth
|
|
407
|
-
}
|
|
408
410
|
},
|
|
409
411
|
methods: {
|
|
410
412
|
onChangeHandler(event) {
|
|
@@ -525,10 +527,10 @@ export default {
|
|
|
525
527
|
}
|
|
526
528
|
},
|
|
527
529
|
initInteraction(e) {
|
|
528
|
-
this.focusInput()
|
|
529
530
|
window.addEventListener('mousemove', this.interact, false);
|
|
530
531
|
window.addEventListener('mouseup', this.stopInteract, false);
|
|
531
532
|
e.preventDefault()
|
|
533
|
+
this.focusInput()
|
|
532
534
|
},
|
|
533
535
|
interact(e) {
|
|
534
536
|
e.preventDefault()
|
|
@@ -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
|
+
|