@eturnity/eturnity_reusable_components 1.0.27 → 1.0.31
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
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
<th>Column 2</th>
|
|
9
9
|
<th>Column 3</th>
|
|
10
10
|
<th>Column 4</th>
|
|
11
|
+
<div />
|
|
11
12
|
</tr>
|
|
12
13
|
</thead>
|
|
13
14
|
<tbody>
|
|
@@ -16,15 +17,12 @@
|
|
|
16
17
|
<td class="text">Body 2</td>
|
|
17
18
|
<td class="text">Body 3</td>
|
|
18
19
|
<td class="text">Body 4</td>
|
|
20
|
+
<div class="icons-container">
|
|
21
|
+
<three-dots :options="listOptions" />
|
|
22
|
+
</div>
|
|
19
23
|
</tr>
|
|
20
24
|
</tbody>
|
|
21
25
|
</main-table>
|
|
22
|
-
<toggle
|
|
23
|
-
@on-toggle-change="isChecked = $event"
|
|
24
|
-
:isChecked="isChecked"
|
|
25
|
-
label="My Label Text"
|
|
26
|
-
size="small"
|
|
27
|
-
/>
|
|
28
26
|
</page-container>
|
|
29
27
|
</ThemeProvider>
|
|
30
28
|
</template>
|
|
@@ -34,7 +32,7 @@ import { ThemeProvider } from "vue-styled-components"
|
|
|
34
32
|
import theme from "./assets/theme"
|
|
35
33
|
import styled from "vue-styled-components"
|
|
36
34
|
import MainTable from "@/components/tables/mainTable"
|
|
37
|
-
import
|
|
35
|
+
import ThreeDots from "@/components/threeDots"
|
|
38
36
|
|
|
39
37
|
const PageContainer = styled.div`
|
|
40
38
|
padding: 40px;
|
|
@@ -46,7 +44,7 @@ export default {
|
|
|
46
44
|
ThemeProvider,
|
|
47
45
|
PageContainer,
|
|
48
46
|
MainTable,
|
|
49
|
-
|
|
47
|
+
ThreeDots,
|
|
50
48
|
},
|
|
51
49
|
data() {
|
|
52
50
|
return {
|
|
@@ -59,6 +57,52 @@ export default {
|
|
|
59
57
|
unit_short_name: "cm",
|
|
60
58
|
},
|
|
61
59
|
isChecked: false,
|
|
60
|
+
listOptions: [
|
|
61
|
+
{
|
|
62
|
+
name: "Option 1",
|
|
63
|
+
value: "option_1",
|
|
64
|
+
children: [
|
|
65
|
+
{
|
|
66
|
+
name: "Option 1 Child",
|
|
67
|
+
value: "option_1_child",
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: "Option 2 Child",
|
|
71
|
+
value: "option_2_child",
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: "Option 3 Child",
|
|
75
|
+
value: "option_3_child",
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: "Option 2",
|
|
81
|
+
value: "option_2",
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: "Option 3",
|
|
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
|
+
],
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
name: "Option 4",
|
|
103
|
+
value: "option_4",
|
|
104
|
+
},
|
|
105
|
+
],
|
|
62
106
|
}
|
|
63
107
|
},
|
|
64
108
|
methods: {
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
:isError="isError"
|
|
7
7
|
:rows="rowHeight"
|
|
8
8
|
:value="value"
|
|
9
|
+
:disabled="isDisabled"
|
|
9
10
|
@input="onChangeHandler"
|
|
10
11
|
/>
|
|
11
12
|
</input-wrapper>
|
|
@@ -32,7 +33,7 @@ const Container = styled.div`
|
|
|
32
33
|
margin-bottom: 20px;
|
|
33
34
|
`
|
|
34
35
|
|
|
35
|
-
const inputProps = { isError: Boolean }
|
|
36
|
+
const inputProps = { isError: Boolean, disabled: Boolean }
|
|
36
37
|
const InputContainer = styled("textarea", inputProps)`
|
|
37
38
|
border: ${(props) =>
|
|
38
39
|
props.isError
|
|
@@ -46,6 +47,7 @@ const InputContainer = styled("textarea", inputProps)`
|
|
|
46
47
|
width: 100%;
|
|
47
48
|
max-width: 100%;
|
|
48
49
|
box-sizing: border-box; // to allow width of 100% with padding
|
|
50
|
+
cursor: ${(props) => (props.disabled ? "not-allowed" : "inherit")};
|
|
49
51
|
|
|
50
52
|
&::placeholder {
|
|
51
53
|
color: ${(props) =>
|
|
@@ -96,6 +98,10 @@ export default {
|
|
|
96
98
|
errorText: {
|
|
97
99
|
required: false,
|
|
98
100
|
},
|
|
101
|
+
isDisabled: {
|
|
102
|
+
required: false,
|
|
103
|
+
default: false,
|
|
104
|
+
},
|
|
99
105
|
},
|
|
100
106
|
methods: {
|
|
101
107
|
onChangeHandler($event) {
|
|
@@ -133,6 +133,8 @@ const TableContainer = styled.table`
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
tr {
|
|
136
|
+
position: relative;
|
|
137
|
+
|
|
136
138
|
&.disabled {
|
|
137
139
|
cursor: not-allowed;
|
|
138
140
|
}
|
|
@@ -154,7 +156,7 @@ const TableContainer = styled.table`
|
|
|
154
156
|
}
|
|
155
157
|
|
|
156
158
|
.icons-container {
|
|
157
|
-
width:
|
|
159
|
+
width: auto;
|
|
158
160
|
display: table-cell;
|
|
159
161
|
flex-wrap: nowrap;
|
|
160
162
|
background-color: #fff;
|
|
@@ -5,17 +5,51 @@
|
|
|
5
5
|
<dot-item />
|
|
6
6
|
<dot-item />
|
|
7
7
|
</button-container>
|
|
8
|
-
<
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
:
|
|
12
|
-
|
|
13
|
-
@click="onSelect(item.value)"
|
|
14
|
-
@keyup.enter="onSelect(item.value)"
|
|
8
|
+
<dropdown-container v-if="isOpen">
|
|
9
|
+
<children-container
|
|
10
|
+
class="child"
|
|
11
|
+
:isOpen="hoverItem !== null"
|
|
12
|
+
v-if="hoverItem !== null"
|
|
15
13
|
>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
<option-child
|
|
15
|
+
v-for="child in childOpen"
|
|
16
|
+
:key="child.value"
|
|
17
|
+
@click.stop="
|
|
18
|
+
onSelect({
|
|
19
|
+
value: child.value,
|
|
20
|
+
hasChildren: hasChildren(child),
|
|
21
|
+
})
|
|
22
|
+
"
|
|
23
|
+
@keyup.enter.stop="
|
|
24
|
+
onSelect({
|
|
25
|
+
value: child.value,
|
|
26
|
+
hasChildren: hasChildren(child),
|
|
27
|
+
})
|
|
28
|
+
"
|
|
29
|
+
>
|
|
30
|
+
{{ child.name }}
|
|
31
|
+
</option-child>
|
|
32
|
+
</children-container>
|
|
33
|
+
<options-container>
|
|
34
|
+
<option-item
|
|
35
|
+
v-for="(item, index) in options"
|
|
36
|
+
:key="item.value"
|
|
37
|
+
tabindex="0"
|
|
38
|
+
@click="
|
|
39
|
+
onSelect({ value: item.value, hasChildren: hasChildren(item) })
|
|
40
|
+
"
|
|
41
|
+
@keyup.enter="
|
|
42
|
+
onSelect({ value: item.value, hasChildren: hasChildren(item) })
|
|
43
|
+
"
|
|
44
|
+
@mouseover="onItemHover({ index, item })"
|
|
45
|
+
>
|
|
46
|
+
<arrow-left :hasChildren="hasChildren(item)" />
|
|
47
|
+
<span>
|
|
48
|
+
{{ item.name }}
|
|
49
|
+
</span>
|
|
50
|
+
</option-item>
|
|
51
|
+
</options-container>
|
|
52
|
+
</dropdown-container>
|
|
19
53
|
</page-container>
|
|
20
54
|
</template>
|
|
21
55
|
|
|
@@ -28,28 +62,55 @@
|
|
|
28
62
|
// />
|
|
29
63
|
// options to pass:
|
|
30
64
|
// listOptions: [
|
|
31
|
-
//
|
|
32
|
-
//
|
|
33
|
-
//
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
//
|
|
37
|
-
//
|
|
38
|
-
//
|
|
39
|
-
//
|
|
40
|
-
//
|
|
41
|
-
//
|
|
42
|
-
//
|
|
43
|
-
//
|
|
44
|
-
//
|
|
45
|
-
//
|
|
46
|
-
//
|
|
47
|
-
//
|
|
65
|
+
// {
|
|
66
|
+
// name: "Option 1",
|
|
67
|
+
// value: "option_1",
|
|
68
|
+
// children: [
|
|
69
|
+
// {
|
|
70
|
+
// name: "Option 1 Child",
|
|
71
|
+
// value: "option_1_child",
|
|
72
|
+
// },
|
|
73
|
+
// {
|
|
74
|
+
// name: "Option 2 Child",
|
|
75
|
+
// value: "option_2_child",
|
|
76
|
+
// },
|
|
77
|
+
// {
|
|
78
|
+
// name: "Option 3 Child",
|
|
79
|
+
// value: "option_3_child",
|
|
80
|
+
// },
|
|
81
|
+
// ],
|
|
82
|
+
// },
|
|
83
|
+
// {
|
|
84
|
+
// name: "Option 2",
|
|
85
|
+
// value: "option_2",
|
|
86
|
+
// },
|
|
87
|
+
// {
|
|
88
|
+
// name: "Option 3",
|
|
89
|
+
// value: "option_3",
|
|
90
|
+
// children: [
|
|
91
|
+
// {
|
|
92
|
+
// name: "Option 3 Child",
|
|
93
|
+
// value: "option_3_child",
|
|
94
|
+
// },
|
|
95
|
+
// {
|
|
96
|
+
// name: "Option 4 Child",
|
|
97
|
+
// value: "option_4_child",
|
|
98
|
+
// },
|
|
99
|
+
// {
|
|
100
|
+
// name: "Option 5 Child",
|
|
101
|
+
// value: "option_5_child",
|
|
102
|
+
// },
|
|
103
|
+
// ],
|
|
104
|
+
// },
|
|
105
|
+
// {
|
|
106
|
+
// name: "Option 4",
|
|
107
|
+
// value: "option_4",
|
|
108
|
+
// },
|
|
109
|
+
// ],
|
|
48
110
|
|
|
49
111
|
import styled from "vue-styled-components"
|
|
50
112
|
|
|
51
113
|
const PageContainer = styled.div`
|
|
52
|
-
position: relative;
|
|
53
114
|
display: grid;
|
|
54
115
|
align-items: center;
|
|
55
116
|
`
|
|
@@ -80,20 +141,22 @@ const DotItem = styled.div`
|
|
|
80
141
|
border-radius: 50%;
|
|
81
142
|
`
|
|
82
143
|
|
|
83
|
-
const
|
|
144
|
+
const DropdownContainer = styled.div`
|
|
84
145
|
z-index: 99;
|
|
85
|
-
position:
|
|
86
|
-
right:
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
146
|
+
position: absolute;
|
|
147
|
+
right: 20px;
|
|
148
|
+
display: grid;
|
|
149
|
+
grid-template-columns: auto auto;
|
|
150
|
+
`
|
|
151
|
+
|
|
152
|
+
const OptionsContainer = styled.div`
|
|
153
|
+
border: 1px solid ${(props) => props.theme.colors.grey3};
|
|
90
154
|
display: grid;
|
|
91
155
|
grid-template-columns: 1fr;
|
|
92
156
|
min-width: 200px;
|
|
93
157
|
width: max-content;
|
|
94
158
|
border-radius: 4px;
|
|
95
159
|
background-color: #fff;
|
|
96
|
-
margin-top: 8px;
|
|
97
160
|
max-height: 220px;
|
|
98
161
|
overflow: auto;
|
|
99
162
|
`
|
|
@@ -102,6 +165,22 @@ const OptionItem = styled.div`
|
|
|
102
165
|
padding: 12px;
|
|
103
166
|
cursor: pointer;
|
|
104
167
|
font-size: 13px;
|
|
168
|
+
position: relative;
|
|
169
|
+
|
|
170
|
+
&:hover {
|
|
171
|
+
background-color: #ebeef4;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
&:focus-visible {
|
|
175
|
+
outline: none;
|
|
176
|
+
background-color: #ebeef4;
|
|
177
|
+
}
|
|
178
|
+
`
|
|
179
|
+
const OptionChild = styled.div`
|
|
180
|
+
padding: 12px;
|
|
181
|
+
cursor: pointer;
|
|
182
|
+
font-size: 13px;
|
|
183
|
+
position: relative;
|
|
105
184
|
|
|
106
185
|
&:hover {
|
|
107
186
|
background-color: #ebeef4;
|
|
@@ -113,6 +192,33 @@ const OptionItem = styled.div`
|
|
|
113
192
|
}
|
|
114
193
|
`
|
|
115
194
|
|
|
195
|
+
const arrowAttrs = { hasChildren: Boolean }
|
|
196
|
+
const ArrowLeft = styled("span", arrowAttrs)`
|
|
197
|
+
border: solid #9f9f9f;
|
|
198
|
+
border-width: 0 1.5px 1.5px 0;
|
|
199
|
+
display: inline-block;
|
|
200
|
+
padding: 3px;
|
|
201
|
+
margin-bottom: 1px;
|
|
202
|
+
transform: rotate(135deg);
|
|
203
|
+
margin-right: 3px;
|
|
204
|
+
visibility: ${(props) => (props.hasChildren ? "visible" : "hidden")};
|
|
205
|
+
`
|
|
206
|
+
|
|
207
|
+
const childAttrs = { isOpen: Boolean }
|
|
208
|
+
const ChildrenContainer = styled("div", childAttrs)`
|
|
209
|
+
border: ${(props) =>
|
|
210
|
+
props.isOpen ? "1px solid" + props.theme.colors.grey3 : "none"};
|
|
211
|
+
display: grid;
|
|
212
|
+
grid-template-columns: 1fr;
|
|
213
|
+
min-width: 200px;
|
|
214
|
+
width: max-content;
|
|
215
|
+
border-radius: 4px;
|
|
216
|
+
background-color: #fff;
|
|
217
|
+
margin-right: -1px;
|
|
218
|
+
height: max-content;
|
|
219
|
+
overflow: auto;
|
|
220
|
+
`
|
|
221
|
+
|
|
116
222
|
export default {
|
|
117
223
|
name: "three-dots",
|
|
118
224
|
components: {
|
|
@@ -121,6 +227,10 @@ export default {
|
|
|
121
227
|
DotItem,
|
|
122
228
|
OptionsContainer,
|
|
123
229
|
OptionItem,
|
|
230
|
+
ChildrenContainer,
|
|
231
|
+
OptionChild,
|
|
232
|
+
ArrowLeft,
|
|
233
|
+
DropdownContainer,
|
|
124
234
|
},
|
|
125
235
|
props: {
|
|
126
236
|
options: {
|
|
@@ -130,6 +240,8 @@ export default {
|
|
|
130
240
|
data() {
|
|
131
241
|
return {
|
|
132
242
|
isOpen: false,
|
|
243
|
+
hoverItem: null,
|
|
244
|
+
childOpen: null,
|
|
133
245
|
}
|
|
134
246
|
},
|
|
135
247
|
methods: {
|
|
@@ -142,7 +254,18 @@ export default {
|
|
|
142
254
|
document.removeEventListener("click", this.clickOutside)
|
|
143
255
|
}
|
|
144
256
|
},
|
|
145
|
-
|
|
257
|
+
hasChildren(item) {
|
|
258
|
+
return !!item.children && !!item.children.length
|
|
259
|
+
},
|
|
260
|
+
onItemHover({ index, item }) {
|
|
261
|
+
this.hoverItem = item.children && item.children.length ? index : null
|
|
262
|
+
this.childOpen =
|
|
263
|
+
item.children && item.children.length ? item.children : null
|
|
264
|
+
},
|
|
265
|
+
onSelect({ value, hasChildren }) {
|
|
266
|
+
if (hasChildren) {
|
|
267
|
+
return
|
|
268
|
+
}
|
|
146
269
|
this.$emit("on-select", value)
|
|
147
270
|
this.isOpen = false
|
|
148
271
|
},
|