@eturnity/eturnity_reusable_components 1.0.32 → 1.0.36
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
|
@@ -18,11 +18,17 @@
|
|
|
18
18
|
<td class="text">Body 3</td>
|
|
19
19
|
<td class="text">Body 4</td>
|
|
20
20
|
<div class="icons-container">
|
|
21
|
-
<three-dots :options="listOptions" />
|
|
21
|
+
<three-dots :options="listOptions" :isLoading="false" />
|
|
22
22
|
</div>
|
|
23
23
|
</tr>
|
|
24
24
|
</tbody>
|
|
25
25
|
</main-table>
|
|
26
|
+
<checkbox
|
|
27
|
+
:isChecked="false"
|
|
28
|
+
@on-event-handler="onInputChange($event)"
|
|
29
|
+
size="small"
|
|
30
|
+
:isDisabled="false"
|
|
31
|
+
/>
|
|
26
32
|
</page-container>
|
|
27
33
|
</ThemeProvider>
|
|
28
34
|
</template>
|
|
@@ -33,6 +39,7 @@ import theme from "./assets/theme"
|
|
|
33
39
|
import styled from "vue-styled-components"
|
|
34
40
|
import MainTable from "@/components/tables/mainTable"
|
|
35
41
|
import ThreeDots from "@/components/threeDots"
|
|
42
|
+
import Checkbox from "@/components/inputs/checkbox"
|
|
36
43
|
|
|
37
44
|
const PageContainer = styled.div`
|
|
38
45
|
padding: 40px;
|
|
@@ -45,6 +52,7 @@ export default {
|
|
|
45
52
|
PageContainer,
|
|
46
53
|
MainTable,
|
|
47
54
|
ThreeDots,
|
|
55
|
+
Checkbox,
|
|
48
56
|
},
|
|
49
57
|
data() {
|
|
50
58
|
return {
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
:hasLabel="!!label.length"
|
|
7
7
|
:backgroundColor="backgroundColor"
|
|
8
8
|
:isChecked="isChecked"
|
|
9
|
+
:isDisabled="isDisabled"
|
|
9
10
|
>{{ label }}
|
|
10
11
|
<input-checkbox
|
|
11
12
|
type="checkbox"
|
|
@@ -40,6 +41,7 @@ const containerAttrs = {
|
|
|
40
41
|
hasLabel: Boolean,
|
|
41
42
|
backgroundColor: String,
|
|
42
43
|
isChecked: Boolean,
|
|
44
|
+
isDisabled: Boolean,
|
|
43
45
|
}
|
|
44
46
|
const Container = styled("label", containerAttrs)`
|
|
45
47
|
display: grid;
|
|
@@ -49,7 +51,7 @@ const Container = styled("label", containerAttrs)`
|
|
|
49
51
|
position: relative;
|
|
50
52
|
padding-left: 42px;
|
|
51
53
|
margin-bottom: 12px;
|
|
52
|
-
cursor: pointer;
|
|
54
|
+
cursor: ${(props) => (props.isDisabled ? "not-allowed" : "pointer")};
|
|
53
55
|
font-size: 16px;
|
|
54
56
|
user-select: none;
|
|
55
57
|
|
|
@@ -70,7 +72,9 @@ const Container = styled("label", containerAttrs)`
|
|
|
70
72
|
? "16px"
|
|
71
73
|
: "25px"};
|
|
72
74
|
background-color: ${(props) =>
|
|
73
|
-
|
|
75
|
+
props.isDisabled
|
|
76
|
+
? props.theme.colors.lightGray
|
|
77
|
+
: !props.isChecked
|
|
74
78
|
? "#fff"
|
|
75
79
|
: props.backgroundColor
|
|
76
80
|
? props.backgroundColor
|
|
@@ -87,7 +91,7 @@ const Container = styled("label", containerAttrs)`
|
|
|
87
91
|
&:after {
|
|
88
92
|
content: "";
|
|
89
93
|
position: absolute;
|
|
90
|
-
display: none;
|
|
94
|
+
display: ${(props) => (props.isChecked ? "block" : "none")};
|
|
91
95
|
}
|
|
92
96
|
}
|
|
93
97
|
|
|
@@ -124,10 +128,6 @@ const InputCheckbox = styled.input`
|
|
|
124
128
|
cursor: pointer;
|
|
125
129
|
height: 0;
|
|
126
130
|
width: 0;
|
|
127
|
-
|
|
128
|
-
&:checked ~ .checkmark:after {
|
|
129
|
-
display: block;
|
|
130
|
-
}
|
|
131
131
|
`
|
|
132
132
|
|
|
133
133
|
export default {
|
|
@@ -156,9 +156,16 @@ export default {
|
|
|
156
156
|
backgroundColor: {
|
|
157
157
|
required: false,
|
|
158
158
|
},
|
|
159
|
+
isDisabled: {
|
|
160
|
+
required: false,
|
|
161
|
+
default: false,
|
|
162
|
+
},
|
|
159
163
|
},
|
|
160
164
|
methods: {
|
|
161
165
|
onChangeHandler(value) {
|
|
166
|
+
if (this.isDisabled) {
|
|
167
|
+
return
|
|
168
|
+
}
|
|
162
169
|
this.$emit("on-event-handler", value)
|
|
163
170
|
},
|
|
164
171
|
},
|
|
@@ -6,23 +6,26 @@
|
|
|
6
6
|
<dot-item />
|
|
7
7
|
</button-container>
|
|
8
8
|
<dropdown-container v-if="isOpen">
|
|
9
|
+
<loading-container v-if="isLoading">
|
|
10
|
+
<spinner />
|
|
11
|
+
</loading-container>
|
|
9
12
|
<children-container
|
|
10
13
|
class="child"
|
|
11
14
|
:isOpen="hoverItem !== null"
|
|
12
|
-
v-if="hoverItem !== null"
|
|
15
|
+
v-if="hoverItem !== null && !isLoading"
|
|
13
16
|
>
|
|
14
17
|
<option-child
|
|
15
18
|
v-for="child in childOpen"
|
|
16
19
|
:key="child.value"
|
|
17
20
|
@click.stop="
|
|
18
21
|
onSelect({
|
|
19
|
-
|
|
22
|
+
item: child,
|
|
20
23
|
hasChildren: hasChildren(child),
|
|
21
24
|
})
|
|
22
25
|
"
|
|
23
26
|
@keyup.enter.stop="
|
|
24
27
|
onSelect({
|
|
25
|
-
|
|
28
|
+
item: child,
|
|
26
29
|
hasChildren: hasChildren(child),
|
|
27
30
|
})
|
|
28
31
|
"
|
|
@@ -30,16 +33,14 @@
|
|
|
30
33
|
{{ child.name }}
|
|
31
34
|
</option-child>
|
|
32
35
|
</children-container>
|
|
33
|
-
<options-container>
|
|
36
|
+
<options-container v-if="!isLoading">
|
|
34
37
|
<option-item
|
|
35
38
|
v-for="(item, index) in options"
|
|
36
39
|
:key="item.value"
|
|
37
40
|
tabindex="0"
|
|
38
|
-
@click="
|
|
39
|
-
onSelect({ value: item.value, hasChildren: hasChildren(item) })
|
|
40
|
-
"
|
|
41
|
+
@click="onSelect({ item: item, hasChildren: hasChildren(item) })"
|
|
41
42
|
@keyup.enter="
|
|
42
|
-
onSelect({
|
|
43
|
+
onSelect({ item: item, hasChildren: hasChildren(item) })
|
|
43
44
|
"
|
|
44
45
|
@mouseover="onItemHover({ index, item })"
|
|
45
46
|
>
|
|
@@ -59,6 +60,7 @@
|
|
|
59
60
|
// <three-dots
|
|
60
61
|
// :options="listOptions"
|
|
61
62
|
// @on-select="onSelect($event)"
|
|
63
|
+
// :isLoading="true"
|
|
62
64
|
// />
|
|
63
65
|
// options to pass:
|
|
64
66
|
// listOptions: [
|
|
@@ -109,6 +111,7 @@
|
|
|
109
111
|
// ],
|
|
110
112
|
|
|
111
113
|
import styled from "vue-styled-components"
|
|
114
|
+
import Spinner from "../spinner"
|
|
112
115
|
|
|
113
116
|
const PageContainer = styled.div`
|
|
114
117
|
display: grid;
|
|
@@ -149,6 +152,17 @@ const DropdownContainer = styled.div`
|
|
|
149
152
|
grid-template-columns: auto auto;
|
|
150
153
|
`
|
|
151
154
|
|
|
155
|
+
const LoadingContainer = styled.div`
|
|
156
|
+
border: 1px solid ${(props) => props.theme.colors.grey3};
|
|
157
|
+
display: grid;
|
|
158
|
+
grid-template-columns: 1fr;
|
|
159
|
+
min-width: 200px;
|
|
160
|
+
height: 200px;
|
|
161
|
+
align-items: center;
|
|
162
|
+
justify-items: center;
|
|
163
|
+
background: #fff;
|
|
164
|
+
`
|
|
165
|
+
|
|
152
166
|
const OptionsContainer = styled.div`
|
|
153
167
|
border: 1px solid ${(props) => props.theme.colors.grey3};
|
|
154
168
|
display: grid;
|
|
@@ -217,6 +231,7 @@ const ChildrenContainer = styled("div", childAttrs)`
|
|
|
217
231
|
background-color: #fff;
|
|
218
232
|
margin-right: -1px;
|
|
219
233
|
height: max-content;
|
|
234
|
+
max-height: 200px;
|
|
220
235
|
overflow: auto;
|
|
221
236
|
`
|
|
222
237
|
|
|
@@ -232,11 +247,17 @@ export default {
|
|
|
232
247
|
OptionChild,
|
|
233
248
|
ArrowLeft,
|
|
234
249
|
DropdownContainer,
|
|
250
|
+
Spinner,
|
|
251
|
+
LoadingContainer,
|
|
235
252
|
},
|
|
236
253
|
props: {
|
|
237
254
|
options: {
|
|
238
255
|
required: true,
|
|
239
256
|
},
|
|
257
|
+
isLoading: {
|
|
258
|
+
required: false,
|
|
259
|
+
default: false,
|
|
260
|
+
},
|
|
240
261
|
},
|
|
241
262
|
data() {
|
|
242
263
|
return {
|
|
@@ -263,11 +284,11 @@ export default {
|
|
|
263
284
|
this.childOpen =
|
|
264
285
|
item.children && item.children.length ? item.children : null
|
|
265
286
|
},
|
|
266
|
-
onSelect({
|
|
287
|
+
onSelect({ item, hasChildren }) {
|
|
267
288
|
if (hasChildren) {
|
|
268
289
|
return
|
|
269
290
|
}
|
|
270
|
-
this.$emit("on-select",
|
|
291
|
+
this.$emit("on-select", item)
|
|
271
292
|
this.isOpen = false
|
|
272
293
|
},
|
|
273
294
|
clickOutside(event) {
|