@eturnity/eturnity_reusable_components 1.0.29 → 1.0.30
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/App.vue +14 -0
- package/src/components/threeDots/index.vue +86 -26
package/package.json
CHANGED
package/src/App.vue
CHANGED
|
@@ -83,6 +83,20 @@ export default {
|
|
|
83
83
|
{
|
|
84
84
|
name: "Option 3",
|
|
85
85
|
value: "option_3",
|
|
86
|
+
children: [
|
|
87
|
+
{
|
|
88
|
+
name: "Option 3 Child",
|
|
89
|
+
value: "option_3_child",
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
name: "Option 4 Child",
|
|
93
|
+
value: "option_4_child",
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: "Option 5 Child",
|
|
97
|
+
value: "option_5_child",
|
|
98
|
+
},
|
|
99
|
+
],
|
|
86
100
|
},
|
|
87
101
|
{
|
|
88
102
|
name: "Option 4",
|
|
@@ -10,16 +10,30 @@
|
|
|
10
10
|
v-for="(item, index) in options"
|
|
11
11
|
:key="item.value"
|
|
12
12
|
tabindex="0"
|
|
13
|
-
@click="onSelect(item.value)"
|
|
14
|
-
@keyup.enter="
|
|
13
|
+
@click="onSelect({ value: item.value, hasChildren: hasChildren(item) })"
|
|
14
|
+
@keyup.enter="
|
|
15
|
+
onSelect({ value: item.value, hasChildren: hasChildren(item) })
|
|
16
|
+
"
|
|
15
17
|
@mouseover="onItemHover(index)"
|
|
16
18
|
>
|
|
17
|
-
|
|
19
|
+
<arrow-left :hasChildren="hasChildren(item)" />
|
|
20
|
+
<span>
|
|
21
|
+
{{ item.name }}
|
|
22
|
+
</span>
|
|
18
23
|
<children-container
|
|
19
24
|
class="child"
|
|
20
|
-
v-if="item
|
|
25
|
+
v-if="hasChildren(item) && hoverItem === index"
|
|
21
26
|
>
|
|
22
|
-
<option-child
|
|
27
|
+
<option-child
|
|
28
|
+
v-for="child in item.children"
|
|
29
|
+
:key="child.value"
|
|
30
|
+
@click.stop="
|
|
31
|
+
onSelect({ value: child.value, hasChildren: hasChildren(child) })
|
|
32
|
+
"
|
|
33
|
+
@keyup.enter.stop="
|
|
34
|
+
onSelect({ value: child.value, hasChildren: hasChildren(child) })
|
|
35
|
+
"
|
|
36
|
+
>
|
|
23
37
|
{{ child.name }}
|
|
24
38
|
</option-child>
|
|
25
39
|
</children-container>
|
|
@@ -37,23 +51,51 @@
|
|
|
37
51
|
// />
|
|
38
52
|
// options to pass:
|
|
39
53
|
// listOptions: [
|
|
40
|
-
//
|
|
41
|
-
//
|
|
42
|
-
//
|
|
43
|
-
//
|
|
44
|
-
//
|
|
45
|
-
//
|
|
46
|
-
//
|
|
47
|
-
//
|
|
48
|
-
//
|
|
49
|
-
//
|
|
50
|
-
//
|
|
51
|
-
//
|
|
52
|
-
//
|
|
53
|
-
//
|
|
54
|
-
//
|
|
55
|
-
//
|
|
56
|
-
//
|
|
54
|
+
// {
|
|
55
|
+
// name: "Option 1",
|
|
56
|
+
// value: "option_1",
|
|
57
|
+
// children: [
|
|
58
|
+
// {
|
|
59
|
+
// name: "Option 1 Child",
|
|
60
|
+
// value: "option_1_child",
|
|
61
|
+
// },
|
|
62
|
+
// {
|
|
63
|
+
// name: "Option 2 Child",
|
|
64
|
+
// value: "option_2_child",
|
|
65
|
+
// },
|
|
66
|
+
// {
|
|
67
|
+
// name: "Option 3 Child",
|
|
68
|
+
// value: "option_3_child",
|
|
69
|
+
// },
|
|
70
|
+
// ],
|
|
71
|
+
// },
|
|
72
|
+
// {
|
|
73
|
+
// name: "Option 2",
|
|
74
|
+
// value: "option_2",
|
|
75
|
+
// },
|
|
76
|
+
// {
|
|
77
|
+
// name: "Option 3",
|
|
78
|
+
// value: "option_3",
|
|
79
|
+
// children: [
|
|
80
|
+
// {
|
|
81
|
+
// name: "Option 3 Child",
|
|
82
|
+
// value: "option_3_child",
|
|
83
|
+
// },
|
|
84
|
+
// {
|
|
85
|
+
// name: "Option 4 Child",
|
|
86
|
+
// value: "option_4_child",
|
|
87
|
+
// },
|
|
88
|
+
// {
|
|
89
|
+
// name: "Option 5 Child",
|
|
90
|
+
// value: "option_5_child",
|
|
91
|
+
// },
|
|
92
|
+
// ],
|
|
93
|
+
// },
|
|
94
|
+
// {
|
|
95
|
+
// name: "Option 4",
|
|
96
|
+
// value: "option_4",
|
|
97
|
+
// },
|
|
98
|
+
// ],
|
|
57
99
|
|
|
58
100
|
import styled from "vue-styled-components"
|
|
59
101
|
|
|
@@ -136,18 +178,30 @@ const OptionChild = styled.div`
|
|
|
136
178
|
}
|
|
137
179
|
`
|
|
138
180
|
|
|
181
|
+
const arrowAttrs = { hasChildren: Boolean }
|
|
182
|
+
const ArrowLeft = styled("span", arrowAttrs)`
|
|
183
|
+
border: solid #9f9f9f;
|
|
184
|
+
border-width: 0 1.5px 1.5px 0;
|
|
185
|
+
display: inline-block;
|
|
186
|
+
padding: 3px;
|
|
187
|
+
margin-bottom: 1px;
|
|
188
|
+
transform: rotate(135deg);
|
|
189
|
+
margin-right: 3px;
|
|
190
|
+
visibility: ${(props) => (props.hasChildren ? "visible" : "hidden")};
|
|
191
|
+
`
|
|
192
|
+
|
|
139
193
|
const ChildrenContainer = styled.div`
|
|
140
194
|
position: fixed;
|
|
141
195
|
right: 262px;
|
|
142
196
|
border: 1px solid ${(props) => props.theme.colors.grey3};
|
|
143
|
-
border-right: none;
|
|
144
197
|
display: grid;
|
|
145
198
|
grid-template-columns: 1fr;
|
|
146
199
|
min-width: 200px;
|
|
147
200
|
width: max-content;
|
|
148
201
|
border-radius: 4px;
|
|
149
202
|
background-color: #fff;
|
|
150
|
-
margin-top:
|
|
203
|
+
margin-top: -28px;
|
|
204
|
+
margin-right: -1px;
|
|
151
205
|
max-height: 220px;
|
|
152
206
|
overflow: auto;
|
|
153
207
|
`
|
|
@@ -162,6 +216,7 @@ export default {
|
|
|
162
216
|
OptionItem,
|
|
163
217
|
ChildrenContainer,
|
|
164
218
|
OptionChild,
|
|
219
|
+
ArrowLeft,
|
|
165
220
|
},
|
|
166
221
|
props: {
|
|
167
222
|
options: {
|
|
@@ -184,11 +239,16 @@ export default {
|
|
|
184
239
|
document.removeEventListener("click", this.clickOutside)
|
|
185
240
|
}
|
|
186
241
|
},
|
|
242
|
+
hasChildren(item) {
|
|
243
|
+
return !!item.children && !!item.children.length
|
|
244
|
+
},
|
|
187
245
|
onItemHover(index) {
|
|
188
|
-
debugger // eslint-disable-line
|
|
189
246
|
this.hoverItem = index
|
|
190
247
|
},
|
|
191
|
-
onSelect(value) {
|
|
248
|
+
onSelect({ value, hasChildren }) {
|
|
249
|
+
if (hasChildren) {
|
|
250
|
+
return
|
|
251
|
+
}
|
|
192
252
|
this.$emit("on-select", value)
|
|
193
253
|
this.isOpen = false
|
|
194
254
|
},
|