@eturnity/eturnity_reusable_components 1.0.25 → 1.0.29
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,38 @@ 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
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: "Option 4",
|
|
89
|
+
value: "option_4",
|
|
90
|
+
},
|
|
91
|
+
],
|
|
62
92
|
}
|
|
63
93
|
},
|
|
64
94
|
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) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<container>
|
|
3
|
-
<flex-wrapper>
|
|
3
|
+
<flex-wrapper :size="size">
|
|
4
4
|
<label-text v-if="labelAlign === 'left'" :size="size">{{
|
|
5
5
|
label
|
|
6
6
|
}}</label-text>
|
|
@@ -19,9 +19,12 @@
|
|
|
19
19
|
:size="size"
|
|
20
20
|
/>
|
|
21
21
|
</toggle-wrapper>
|
|
22
|
-
<label-text
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
<label-text
|
|
23
|
+
v-if="labelAlign === 'right'"
|
|
24
|
+
:size="size"
|
|
25
|
+
:fontColor="fontColor"
|
|
26
|
+
>{{ label }}</label-text
|
|
27
|
+
>
|
|
25
28
|
</flex-wrapper>
|
|
26
29
|
</container>
|
|
27
30
|
</template>
|
|
@@ -37,6 +40,7 @@
|
|
|
37
40
|
// size="small" // small, medium
|
|
38
41
|
// backgroundColor="blue"
|
|
39
42
|
// labelAlign="right"
|
|
43
|
+
// fontColor="black"
|
|
40
44
|
// />
|
|
41
45
|
|
|
42
46
|
import styled from "vue-styled-components"
|
|
@@ -45,16 +49,23 @@ const Container = styled.div`
|
|
|
45
49
|
display: inline-block;
|
|
46
50
|
`
|
|
47
51
|
|
|
48
|
-
const
|
|
52
|
+
const flexAttrs = { size: String }
|
|
53
|
+
const FlexWrapper = styled("div", flexAttrs)`
|
|
49
54
|
display: grid;
|
|
50
55
|
grid-template-columns: auto 1fr;
|
|
51
|
-
grid-gap:
|
|
56
|
+
grid-gap: ${(props) =>
|
|
57
|
+
props.size === "medium"
|
|
58
|
+
? "20px"
|
|
59
|
+
: props.size === "small"
|
|
60
|
+
? "10px"
|
|
61
|
+
: "20px"};
|
|
52
62
|
align-items: center;
|
|
53
63
|
`
|
|
54
64
|
|
|
55
|
-
const toggleAttrs = { size: String }
|
|
65
|
+
const toggleAttrs = { size: String, fontColor: String }
|
|
56
66
|
const LabelText = styled("div", toggleAttrs)`
|
|
57
|
-
color: ${(props) =>
|
|
67
|
+
color: ${(props) =>
|
|
68
|
+
props.fontColor ? props.fontColor : props.theme.colors.darkGray};
|
|
58
69
|
font-size: ${(props) =>
|
|
59
70
|
props.size === "medium"
|
|
60
71
|
? "16px"
|
|
@@ -181,6 +192,9 @@ export default {
|
|
|
181
192
|
required: false,
|
|
182
193
|
default: "right",
|
|
183
194
|
},
|
|
195
|
+
fontColor: {
|
|
196
|
+
required: false,
|
|
197
|
+
},
|
|
184
198
|
},
|
|
185
199
|
methods: {
|
|
186
200
|
onToggleChange() {
|
|
@@ -7,13 +7,22 @@
|
|
|
7
7
|
</button-container>
|
|
8
8
|
<options-container v-if="isOpen">
|
|
9
9
|
<option-item
|
|
10
|
-
v-for="item in options"
|
|
10
|
+
v-for="(item, index) in options"
|
|
11
11
|
:key="item.value"
|
|
12
12
|
tabindex="0"
|
|
13
13
|
@click="onSelect(item.value)"
|
|
14
14
|
@keyup.enter="onSelect(item.value)"
|
|
15
|
+
@mouseover="onItemHover(index)"
|
|
15
16
|
>
|
|
16
17
|
{{ item.name }}
|
|
18
|
+
<children-container
|
|
19
|
+
class="child"
|
|
20
|
+
v-if="item.children && item.children.length && hoverItem === index"
|
|
21
|
+
>
|
|
22
|
+
<option-child v-for="child in item.children" :key="child.value">
|
|
23
|
+
{{ child.name }}
|
|
24
|
+
</option-child>
|
|
25
|
+
</children-container>
|
|
17
26
|
</option-item>
|
|
18
27
|
</options-container>
|
|
19
28
|
</page-container>
|
|
@@ -82,11 +91,9 @@ const DotItem = styled.div`
|
|
|
82
91
|
|
|
83
92
|
const OptionsContainer = styled.div`
|
|
84
93
|
z-index: 99;
|
|
85
|
-
position:
|
|
86
|
-
right:
|
|
87
|
-
border: 1px solid
|
|
88
|
-
${(props) =>
|
|
89
|
-
props.buttonColor ? props.buttonColor : props.theme.colors.grey3};
|
|
94
|
+
position: fixed;
|
|
95
|
+
right: 60px;
|
|
96
|
+
border: 1px solid ${(props) => props.theme.colors.grey3};
|
|
90
97
|
display: grid;
|
|
91
98
|
grid-template-columns: 1fr;
|
|
92
99
|
min-width: 200px;
|
|
@@ -102,6 +109,7 @@ const OptionItem = styled.div`
|
|
|
102
109
|
padding: 12px;
|
|
103
110
|
cursor: pointer;
|
|
104
111
|
font-size: 13px;
|
|
112
|
+
position: relative;
|
|
105
113
|
|
|
106
114
|
&:hover {
|
|
107
115
|
background-color: #ebeef4;
|
|
@@ -112,6 +120,37 @@ const OptionItem = styled.div`
|
|
|
112
120
|
background-color: #ebeef4;
|
|
113
121
|
}
|
|
114
122
|
`
|
|
123
|
+
const OptionChild = styled.div`
|
|
124
|
+
padding: 12px;
|
|
125
|
+
cursor: pointer;
|
|
126
|
+
font-size: 13px;
|
|
127
|
+
position: relative;
|
|
128
|
+
|
|
129
|
+
&:hover {
|
|
130
|
+
background-color: #ebeef4;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
&:focus-visible {
|
|
134
|
+
outline: none;
|
|
135
|
+
background-color: #ebeef4;
|
|
136
|
+
}
|
|
137
|
+
`
|
|
138
|
+
|
|
139
|
+
const ChildrenContainer = styled.div`
|
|
140
|
+
position: fixed;
|
|
141
|
+
right: 262px;
|
|
142
|
+
border: 1px solid ${(props) => props.theme.colors.grey3};
|
|
143
|
+
border-right: none;
|
|
144
|
+
display: grid;
|
|
145
|
+
grid-template-columns: 1fr;
|
|
146
|
+
min-width: 200px;
|
|
147
|
+
width: max-content;
|
|
148
|
+
border-radius: 4px;
|
|
149
|
+
background-color: #fff;
|
|
150
|
+
margin-top: 8px;
|
|
151
|
+
max-height: 220px;
|
|
152
|
+
overflow: auto;
|
|
153
|
+
`
|
|
115
154
|
|
|
116
155
|
export default {
|
|
117
156
|
name: "three-dots",
|
|
@@ -121,6 +160,8 @@ export default {
|
|
|
121
160
|
DotItem,
|
|
122
161
|
OptionsContainer,
|
|
123
162
|
OptionItem,
|
|
163
|
+
ChildrenContainer,
|
|
164
|
+
OptionChild,
|
|
124
165
|
},
|
|
125
166
|
props: {
|
|
126
167
|
options: {
|
|
@@ -130,6 +171,7 @@ export default {
|
|
|
130
171
|
data() {
|
|
131
172
|
return {
|
|
132
173
|
isOpen: false,
|
|
174
|
+
hoverItem: null,
|
|
133
175
|
}
|
|
134
176
|
},
|
|
135
177
|
methods: {
|
|
@@ -142,6 +184,10 @@ export default {
|
|
|
142
184
|
document.removeEventListener("click", this.clickOutside)
|
|
143
185
|
}
|
|
144
186
|
},
|
|
187
|
+
onItemHover(index) {
|
|
188
|
+
debugger // eslint-disable-line
|
|
189
|
+
this.hoverItem = index
|
|
190
|
+
},
|
|
145
191
|
onSelect(value) {
|
|
146
192
|
this.$emit("on-select", value)
|
|
147
193
|
this.isOpen = false
|