@eturnity/eturnity_reusable_components 1.0.38 → 1.0.39
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
|
@@ -23,11 +23,16 @@
|
|
|
23
23
|
</tr>
|
|
24
24
|
</tbody>
|
|
25
25
|
</main-table>
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
<toggle
|
|
27
|
+
@on-toggle-change="onInputChange($event)"
|
|
28
|
+
:isChecked="inputValue"
|
|
29
|
+
size="medium"
|
|
30
|
+
:disabled="true"
|
|
31
|
+
/>
|
|
32
|
+
<toggle
|
|
33
|
+
@on-toggle-change="onInputChange($event)"
|
|
34
|
+
:isChecked="inputValue"
|
|
29
35
|
size="small"
|
|
30
|
-
:isDisabled="false"
|
|
31
36
|
/>
|
|
32
37
|
</page-container>
|
|
33
38
|
</ThemeProvider>
|
|
@@ -39,7 +44,7 @@ import theme from "./assets/theme"
|
|
|
39
44
|
import styled from "vue-styled-components"
|
|
40
45
|
import MainTable from "@/components/tables/mainTable"
|
|
41
46
|
import ThreeDots from "@/components/threeDots"
|
|
42
|
-
import
|
|
47
|
+
import Toggle from "@/components/inputs/toggle"
|
|
43
48
|
|
|
44
49
|
const PageContainer = styled.div`
|
|
45
50
|
padding: 40px;
|
|
@@ -52,7 +57,7 @@ export default {
|
|
|
52
57
|
PageContainer,
|
|
53
58
|
MainTable,
|
|
54
59
|
ThreeDots,
|
|
55
|
-
|
|
60
|
+
Toggle,
|
|
56
61
|
},
|
|
57
62
|
data() {
|
|
58
63
|
return {
|
|
@@ -11,12 +11,14 @@
|
|
|
11
11
|
tabindex="0"
|
|
12
12
|
@click="onToggleChange"
|
|
13
13
|
@keydown.space.prevent="onToggleChange"
|
|
14
|
+
:disabled="disabled"
|
|
14
15
|
>
|
|
15
16
|
<toggle-background :backgroundColor="backgroundColor" />
|
|
16
17
|
<toggle-dot
|
|
17
18
|
:isChecked="isChecked"
|
|
18
19
|
:toggleColor="toggleColor"
|
|
19
20
|
:size="size"
|
|
21
|
+
:disabled="disabled"
|
|
20
22
|
/>
|
|
21
23
|
</toggle-wrapper>
|
|
22
24
|
<label-text
|
|
@@ -62,7 +64,7 @@ const FlexWrapper = styled("div", flexAttrs)`
|
|
|
62
64
|
align-items: center;
|
|
63
65
|
`
|
|
64
66
|
|
|
65
|
-
const toggleAttrs = { size: String, fontColor: String }
|
|
67
|
+
const toggleAttrs = { size: String, fontColor: String, disabled: Boolean }
|
|
66
68
|
const LabelText = styled("div", toggleAttrs)`
|
|
67
69
|
color: ${(props) =>
|
|
68
70
|
props.fontColor ? props.fontColor : props.theme.colors.darkGray};
|
|
@@ -77,7 +79,7 @@ const LabelText = styled("div", toggleAttrs)`
|
|
|
77
79
|
const ToggleWrapper = styled("span", toggleAttrs)`
|
|
78
80
|
display: inline-block;
|
|
79
81
|
position: relative;
|
|
80
|
-
cursor: pointer;
|
|
82
|
+
cursor: ${(props) => (props.disabled ? "not-allowed" : "pointer")};
|
|
81
83
|
width: ${(props) =>
|
|
82
84
|
props.size === "medium"
|
|
83
85
|
? "50px"
|
|
@@ -115,7 +117,12 @@ const ToggleBackground = styled("span", backroundAttrs)`
|
|
|
115
117
|
transition: 0.4s ease;
|
|
116
118
|
`
|
|
117
119
|
|
|
118
|
-
const toggleProps = {
|
|
120
|
+
const toggleProps = {
|
|
121
|
+
isChecked: Boolean,
|
|
122
|
+
toggleColor: String,
|
|
123
|
+
size: String,
|
|
124
|
+
disabled: Boolean,
|
|
125
|
+
}
|
|
119
126
|
const ToggleDot = styled("span", toggleProps)`
|
|
120
127
|
position: absolute;
|
|
121
128
|
height: ${(props) =>
|
|
@@ -134,7 +141,9 @@ const ToggleDot = styled("span", toggleProps)`
|
|
|
134
141
|
bottom: ${(props) =>
|
|
135
142
|
props.size === "medium" ? "5px" : props.size === "small" ? "3px" : "5px"};
|
|
136
143
|
background-color: ${(props) =>
|
|
137
|
-
props.
|
|
144
|
+
props.disabled
|
|
145
|
+
? props.theme.colors.disabled
|
|
146
|
+
: props.isChecked
|
|
138
147
|
? props.toggleColor
|
|
139
148
|
? props.toggleColor
|
|
140
149
|
: props.theme.colors.primary
|
|
@@ -144,17 +153,17 @@ const ToggleDot = styled("span", toggleProps)`
|
|
|
144
153
|
transform: ${(props) =>
|
|
145
154
|
props.isChecked
|
|
146
155
|
? props.size === "medium"
|
|
147
|
-
? "translateX(
|
|
156
|
+
? "translateX(25px)"
|
|
148
157
|
: props.size === "small"
|
|
149
158
|
? "translateX(10px)"
|
|
150
|
-
: "translateX(
|
|
159
|
+
: "translateX(25px)"
|
|
151
160
|
: "translateX(0)"};
|
|
152
161
|
|
|
153
162
|
@media (max-width: ${(props) => props.theme.screen.mobile}) {
|
|
154
163
|
height: 24px;
|
|
155
164
|
width: 24px;
|
|
156
165
|
transform: ${(props) =>
|
|
157
|
-
props.isChecked ? "translateX(
|
|
166
|
+
props.isChecked ? "translateX(25px)" : "translateX(0)"};
|
|
158
167
|
bottom: 8px;
|
|
159
168
|
}
|
|
160
169
|
`
|
|
@@ -195,9 +204,16 @@ export default {
|
|
|
195
204
|
fontColor: {
|
|
196
205
|
required: false,
|
|
197
206
|
},
|
|
207
|
+
disabled: {
|
|
208
|
+
required: false,
|
|
209
|
+
default: false,
|
|
210
|
+
},
|
|
198
211
|
},
|
|
199
212
|
methods: {
|
|
200
213
|
onToggleChange() {
|
|
214
|
+
if (this.disabled) {
|
|
215
|
+
return
|
|
216
|
+
}
|
|
201
217
|
this.$emit("on-toggle-change", !this.isChecked)
|
|
202
218
|
},
|
|
203
219
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<!-- This is just an example how to use mainTable with collective positioning -->
|
|
2
2
|
<!-- <template>
|
|
3
|
-
<
|
|
3
|
+
<main-table>
|
|
4
4
|
<thead>
|
|
5
5
|
<tr>
|
|
6
6
|
<div />
|
|
@@ -156,13 +156,13 @@
|
|
|
156
156
|
<td />
|
|
157
157
|
<div />
|
|
158
158
|
</tr>
|
|
159
|
-
</
|
|
159
|
+
</main-table>
|
|
160
160
|
</template>
|
|
161
161
|
|
|
162
162
|
<script>
|
|
163
163
|
import draggable from "vuedraggable"
|
|
164
164
|
import styled from "vue-styled-components"
|
|
165
|
-
import
|
|
165
|
+
import MainTable from "@/components/reusable-components/tables/MainTable"
|
|
166
166
|
import InputText from "@eturnity/eturnity_reusable_components/src/components/inputs/inputText"
|
|
167
167
|
import DeleteIcon from "@/components/reusable-components/DeleteIcon"
|
|
168
168
|
import ThreeDots from "@/components/reusable-components/ThreeDots"
|
|
@@ -190,7 +190,7 @@ export default {
|
|
|
190
190
|
components: {
|
|
191
191
|
DraggableContainer,
|
|
192
192
|
ParentContainer,
|
|
193
|
-
|
|
193
|
+
MainTable,
|
|
194
194
|
InputText,
|
|
195
195
|
ChildrenWrapper,
|
|
196
196
|
DeleteIcon,
|