@farm-investimentos/front-mfe-components 11.1.0 → 11.1.1
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/dist/front-mfe-components.common.js +358 -285
- package/dist/front-mfe-components.common.js.map +1 -1
- package/dist/front-mfe-components.css +1 -1
- package/dist/front-mfe-components.umd.js +358 -285
- package/dist/front-mfe-components.umd.js.map +1 -1
- package/dist/front-mfe-components.umd.min.js +1 -1
- package/dist/front-mfe-components.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Checkbox/Checkbox.scss +10 -0
- package/src/components/Checkbox/Checkbox.stories.js +15 -1
- package/src/components/Checkbox/Checkbox.vue +9 -1
- package/src/components/DataTableHeader/DataTableHeader.scss +9 -1
- package/src/components/DataTableHeader/DataTableHeader.stories.js +48 -24
- package/src/components/DataTableHeader/DataTableHeader.vue +7 -11
- package/src/components/DatePicker/DatePicker.vue +6 -0
- package/src/components/DialogHeader/DialogHeader.stories.js +11 -0
- package/src/components/DialogHeader/DialogHeader.vue +8 -9
- package/src/components/Form/Form.stories.js +41 -0
- package/src/components/Form/Form.vue +2 -0
- package/src/components/IconBox/IconBox.vue +1 -1
- package/src/components/IdCaption/IdCaption.stories.js +18 -0
- package/src/components/IdCaption/IdCaption.vue +21 -2
- package/src/components/RangeDatePicker/RangeDatePicker.vue +6 -0
- package/src/components/Switcher/Switcher.scss +6 -0
- package/src/components/Switcher/Switcher.stories.js +28 -0
- package/src/components/Switcher/Switcher.vue +27 -2
- package/src/helpers/date.js +3 -0
- package/src/components/Switcher/Switcher.api.stories.js +0 -20
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
@import '../../configurations/theme-colors';
|
|
2
|
+
@import '../../configurations/variables';
|
|
2
3
|
|
|
3
4
|
.farm-checkbox__container {
|
|
4
5
|
display: flex;
|
|
@@ -46,6 +47,7 @@
|
|
|
46
47
|
&--disabled {
|
|
47
48
|
border-color: #dadada;
|
|
48
49
|
cursor: default;
|
|
50
|
+
opacity: 0.6;
|
|
49
51
|
|
|
50
52
|
&.farm-checkbox--checked {
|
|
51
53
|
background-color: #dadada;
|
|
@@ -56,4 +58,12 @@
|
|
|
56
58
|
color: white;
|
|
57
59
|
}
|
|
58
60
|
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@each $size,
|
|
64
|
+
$value in $sizes {
|
|
65
|
+
#{'.farm-checkbox[size=' + $size +']'} {
|
|
66
|
+
width: $value;
|
|
67
|
+
height: $value;
|
|
68
|
+
}
|
|
59
69
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Checkbox from './Checkbox';
|
|
2
2
|
import baseThemeColors from '../../configurations/_theme-colors-base.scss';
|
|
3
|
-
|
|
3
|
+
import sizes from '../../configurations/sizes';
|
|
4
4
|
const colors = Object.keys(baseThemeColors);
|
|
5
5
|
const variations = ['', 'darken', 'lighten'];
|
|
6
6
|
|
|
@@ -92,3 +92,17 @@ export const Colors = () => ({
|
|
|
92
92
|
</div>
|
|
93
93
|
</div>`,
|
|
94
94
|
});
|
|
95
|
+
|
|
96
|
+
export const Sizes = () => ({
|
|
97
|
+
data() {
|
|
98
|
+
return {
|
|
99
|
+
sizes,
|
|
100
|
+
isChecked: true,
|
|
101
|
+
};
|
|
102
|
+
},
|
|
103
|
+
template: `<div style="display: flex; flex-direction: column; flex-wrap: wrap;">
|
|
104
|
+
<div v-for="size of sizes">
|
|
105
|
+
<farm-checkbox v-model="isChecked" :size="size" :label="size" /><br />
|
|
106
|
+
</div>
|
|
107
|
+
</div>`,
|
|
108
|
+
});
|
|
@@ -8,9 +8,10 @@
|
|
|
8
8
|
'farm-checkbox--lighten': variation === 'lighten',
|
|
9
9
|
'farm-checkbox--darken': variation === 'darken',
|
|
10
10
|
}"
|
|
11
|
+
:size="$props.size"
|
|
11
12
|
@click="toggleValue"
|
|
12
13
|
>
|
|
13
|
-
<farm-icon size="
|
|
14
|
+
<farm-icon :size="$props.size" v-if="innerValue">check</farm-icon>
|
|
14
15
|
</span>
|
|
15
16
|
<farm-label v-if="label">
|
|
16
17
|
{{ label }}
|
|
@@ -57,6 +58,13 @@ export default Vue.extend({
|
|
|
57
58
|
type: Array as PropType<Array<Function>>,
|
|
58
59
|
default: () => [],
|
|
59
60
|
},
|
|
61
|
+
/**
|
|
62
|
+
* Size
|
|
63
|
+
*/
|
|
64
|
+
size: {
|
|
65
|
+
type: String as PropType<'xs' | 'sm' | 'md' | 'lg' | 'xl'>,
|
|
66
|
+
default: 'md',
|
|
67
|
+
},
|
|
60
68
|
},
|
|
61
69
|
setup(props, { emit }) {
|
|
62
70
|
const innerValue = ref(props.value);
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
position: relative;
|
|
3
3
|
color: var(--v-primary-base);
|
|
4
4
|
font-size: 12px;
|
|
5
|
+
|
|
5
6
|
.farm-icon {
|
|
6
7
|
position: absolute;
|
|
7
8
|
right: -20px;
|
|
@@ -17,11 +18,18 @@
|
|
|
17
18
|
|
|
18
19
|
th.sortable {
|
|
19
20
|
cursor: pointer;
|
|
21
|
+
|
|
20
22
|
&:not(.active) {
|
|
21
23
|
&:hover {
|
|
22
|
-
.
|
|
24
|
+
.farm-icon {
|
|
23
25
|
opacity: 0.5 !important;
|
|
24
26
|
}
|
|
25
27
|
}
|
|
26
28
|
}
|
|
27
29
|
}
|
|
30
|
+
|
|
31
|
+
th span.span-checkbox {
|
|
32
|
+
display: flex;
|
|
33
|
+
justify-content: start;
|
|
34
|
+
padding-left: 4px;
|
|
35
|
+
}
|
|
@@ -1,40 +1,64 @@
|
|
|
1
|
+
import { withDesign } from 'storybook-addon-designs';
|
|
1
2
|
import DataTableHeader from './DataTableHeader.vue';
|
|
2
3
|
|
|
3
4
|
export default {
|
|
4
5
|
title: 'Display/Table/DataTableHeader',
|
|
5
6
|
component: DataTableHeader,
|
|
7
|
+
decorators: [withDesign],
|
|
8
|
+
parameters: {
|
|
9
|
+
docs: {
|
|
10
|
+
description: {
|
|
11
|
+
component: `DataTable Header<br />
|
|
12
|
+
selector: <em>farm-datatable-header</em><br />
|
|
13
|
+
<span style="color: var(--farm-primary-base);">ready for use</span>
|
|
14
|
+
`,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
viewMode: 'docs',
|
|
18
|
+
},
|
|
6
19
|
};
|
|
7
20
|
|
|
8
21
|
export const Primary = () => ({
|
|
9
22
|
data() {
|
|
10
23
|
return {
|
|
11
|
-
headers
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
width: 320,
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
text: 'Disponível',
|
|
27
|
-
sortable: false,
|
|
28
|
-
value: 'availableAmount',
|
|
29
|
-
align: 'center',
|
|
30
|
-
width: 160,
|
|
31
|
-
},
|
|
32
|
-
],
|
|
24
|
+
headers,
|
|
25
|
+
sortClick: [],
|
|
26
|
+
firstSelected: false,
|
|
27
|
+
};
|
|
28
|
+
},
|
|
29
|
+
template: `<farm-datatable-header :headers="headers" :sortClick="sortClick" :firstSelected="firstSelected" />`,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export const CheckBox = () => ({
|
|
33
|
+
data() {
|
|
34
|
+
return {
|
|
35
|
+
headers,
|
|
33
36
|
sortClick: [],
|
|
34
37
|
firstSelected: false,
|
|
35
38
|
};
|
|
36
39
|
},
|
|
37
|
-
template: `<
|
|
40
|
+
template: `<farm-datatable-header :headers="headers" :sortClick="sortClick" :firstSelected="firstSelected" :showCheckbox="true" :selectedIndex="1" />`,
|
|
38
41
|
});
|
|
39
42
|
|
|
40
|
-
|
|
43
|
+
const headers = [
|
|
44
|
+
{
|
|
45
|
+
text: 'Grupo',
|
|
46
|
+
sortable: true,
|
|
47
|
+
value: 'name',
|
|
48
|
+
align: 'left',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
text: 'Aprovado',
|
|
52
|
+
sortable: true,
|
|
53
|
+
value: 'approvedAmount',
|
|
54
|
+
align: 'center',
|
|
55
|
+
width: 320,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
text: 'Disponível',
|
|
59
|
+
sortable: false,
|
|
60
|
+
value: 'availableAmount',
|
|
61
|
+
align: 'center',
|
|
62
|
+
width: 160,
|
|
63
|
+
},
|
|
64
|
+
];
|
|
@@ -33,31 +33,26 @@
|
|
|
33
33
|
</farm-icon>
|
|
34
34
|
</span>
|
|
35
35
|
|
|
36
|
-
<span v-if="isTHDataTableSelect(item) && showCheckbox">
|
|
37
|
-
|
|
36
|
+
<span v-if="isTHDataTableSelect(item) && showCheckbox" class="span-checkbox">
|
|
37
|
+
<!--
|
|
38
38
|
:indeterminate="headerProps.someItems && !headerProps.everyItem"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
></v-simple-checkbox>
|
|
39
|
+
-->
|
|
40
|
+
<farm-checkbox size="sm" v-model="inputVal" @input="selectAll" />
|
|
42
41
|
</span>
|
|
43
42
|
</th>
|
|
44
43
|
</tr>
|
|
45
44
|
</thead>
|
|
46
45
|
</template>
|
|
47
46
|
|
|
48
|
-
<script>
|
|
47
|
+
<script lang="ts">
|
|
49
48
|
/* eslint-disable */
|
|
50
49
|
import Vue from 'vue';
|
|
51
|
-
import VSimpleCheckbox from 'vuetify/lib/components/VCheckbox/VSimpleCheckbox';
|
|
52
50
|
|
|
53
51
|
export default Vue.extend({
|
|
54
52
|
name: 'farm-datatable-header',
|
|
55
|
-
components: {
|
|
56
|
-
VSimpleCheckbox,
|
|
57
|
-
},
|
|
58
53
|
props: {
|
|
59
54
|
/**
|
|
60
|
-
*
|
|
55
|
+
* Headers
|
|
61
56
|
*/
|
|
62
57
|
headers: {
|
|
63
58
|
type: Array,
|
|
@@ -100,6 +95,7 @@ export default Vue.extend({
|
|
|
100
95
|
* Hide/show checkbox
|
|
101
96
|
*/
|
|
102
97
|
showCheckbox: {
|
|
98
|
+
type: Boolean,
|
|
103
99
|
default: true,
|
|
104
100
|
},
|
|
105
101
|
},
|
|
@@ -143,6 +143,12 @@ export default Vue.extend({
|
|
|
143
143
|
this.dateField = newValue;
|
|
144
144
|
this.fieldRange = this.formatDateRange(newValue);
|
|
145
145
|
},
|
|
146
|
+
fieldRange(newValue) {
|
|
147
|
+
if (!newValue) {
|
|
148
|
+
this.dateField = '';
|
|
149
|
+
this.save();
|
|
150
|
+
}
|
|
151
|
+
},
|
|
146
152
|
},
|
|
147
153
|
methods: {
|
|
148
154
|
formatDateRange(date) {
|
|
@@ -3,6 +3,17 @@ import DialogHeader from './DialogHeader.vue';
|
|
|
3
3
|
export default {
|
|
4
4
|
title: 'Display/Dialog/DialogHeader',
|
|
5
5
|
component: DialogHeader,
|
|
6
|
+
parameters: {
|
|
7
|
+
docs: {
|
|
8
|
+
description: {
|
|
9
|
+
component: `Dialog Header<br />
|
|
10
|
+
selector: <em>farm-dialog-header</em><br />
|
|
11
|
+
<span style="color: var(--farm-primary-base);">ready for use</span>
|
|
12
|
+
`,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
viewMode: 'docs',
|
|
16
|
+
},
|
|
6
17
|
};
|
|
7
18
|
|
|
8
19
|
export const Primary = () => ({
|
|
@@ -7,16 +7,15 @@
|
|
|
7
7
|
|
|
8
8
|
<slot></slot>
|
|
9
9
|
|
|
10
|
-
<farm-
|
|
10
|
+
<farm-btn
|
|
11
11
|
v-if="hasCloseIcon"
|
|
12
|
-
|
|
13
|
-
title="Fechar"
|
|
12
|
+
icon
|
|
14
13
|
class="farm-dialog-header__close"
|
|
15
|
-
|
|
14
|
+
title="Fechar"
|
|
16
15
|
@click="onClose"
|
|
17
16
|
>
|
|
18
|
-
close-thick
|
|
19
|
-
</farm-
|
|
17
|
+
<farm-icon role="button"> close-thick </farm-icon>
|
|
18
|
+
</farm-btn>
|
|
20
19
|
</header>
|
|
21
20
|
</template>
|
|
22
21
|
<script lang="ts">
|
|
@@ -28,21 +27,21 @@ export default Vue.extend({
|
|
|
28
27
|
name: 'farm-dialog-header',
|
|
29
28
|
props: {
|
|
30
29
|
/**
|
|
31
|
-
*
|
|
30
|
+
* Title
|
|
32
31
|
*/
|
|
33
32
|
title: {
|
|
34
33
|
type: String,
|
|
35
34
|
default: '',
|
|
36
35
|
},
|
|
37
36
|
/**
|
|
38
|
-
*
|
|
37
|
+
* Icon
|
|
39
38
|
*/
|
|
40
39
|
iconTitle: {
|
|
41
40
|
type: String,
|
|
42
41
|
default: null,
|
|
43
42
|
},
|
|
44
43
|
/**
|
|
45
|
-
*
|
|
44
|
+
* Has close icon?
|
|
46
45
|
*/
|
|
47
46
|
hasCloseIcon: {
|
|
48
47
|
type: Boolean,
|
|
@@ -54,6 +54,7 @@ export const Primary = () => ({
|
|
|
54
54
|
<farm-label :required="true">True/false</farm-label>
|
|
55
55
|
<farm-checkbox v-model="form.checkbox" :rules="[rules.checked]" />
|
|
56
56
|
|
|
57
|
+
|
|
57
58
|
<div class="footer" :style="[styles.footer]">
|
|
58
59
|
<farm-btn color="secondary" outlined @click="$refs.form.reset()" class="mr-3">Reset</farm-btn>
|
|
59
60
|
<farm-btn color="secondary" :disabled="!validForm">Salvar</farm-btn>
|
|
@@ -169,3 +170,43 @@ export const RadioGroupReset = () => ({
|
|
|
169
170
|
</farm-form>
|
|
170
171
|
`,
|
|
171
172
|
});
|
|
173
|
+
|
|
174
|
+
export const DatePickers = () => ({
|
|
175
|
+
data() {
|
|
176
|
+
return {
|
|
177
|
+
birthDate: '',
|
|
178
|
+
rangeDate: [],
|
|
179
|
+
validForm: false,
|
|
180
|
+
styles,
|
|
181
|
+
};
|
|
182
|
+
},
|
|
183
|
+
template: `
|
|
184
|
+
<farm-form v-model="validForm" :style="[styles.vForm]" ref="form">
|
|
185
|
+
|
|
186
|
+
<farm-label :required="true">Birthdate: {{ birthDate }}</farm-label>
|
|
187
|
+
<DatePicker
|
|
188
|
+
ref="birthDate"
|
|
189
|
+
inputId="form-pf-birthDate"
|
|
190
|
+
class="mt-4"
|
|
191
|
+
v-model="birthDate"
|
|
192
|
+
:readonly="true"
|
|
193
|
+
:required="true"
|
|
194
|
+
/>
|
|
195
|
+
|
|
196
|
+
<farm-label :required="true">Range: {{ rangeDate }}</farm-label>
|
|
197
|
+
<RangeDatePicker
|
|
198
|
+
ref="rangeDate"
|
|
199
|
+
inputId="form-pf-rangeDate"
|
|
200
|
+
class="mt-4"
|
|
201
|
+
v-model="rangeDate"
|
|
202
|
+
:readonly="true"
|
|
203
|
+
:required="true"
|
|
204
|
+
/>
|
|
205
|
+
|
|
206
|
+
<div class="footer" :style="[styles.footer]">
|
|
207
|
+
<farm-btn color="secondary" outlined @click="$refs.form.reset()" class="mr-3">Reset</farm-btn>
|
|
208
|
+
<farm-btn color="secondary" :disabled="!validForm">Salvar</farm-btn>
|
|
209
|
+
</div>
|
|
210
|
+
</farm-form>
|
|
211
|
+
`,
|
|
212
|
+
});
|
|
@@ -114,3 +114,21 @@ export const NoTextToClip = () => ({
|
|
|
114
114
|
</farm-idcaption>
|
|
115
115
|
`,
|
|
116
116
|
});
|
|
117
|
+
|
|
118
|
+
export const IconBoxCustomColor = () => ({
|
|
119
|
+
template: `
|
|
120
|
+
<farm-idcaption
|
|
121
|
+
icon="account-box-outline"
|
|
122
|
+
copyText="texto a copiar"
|
|
123
|
+
iconBoxColor="error"
|
|
124
|
+
:link="true"
|
|
125
|
+
>
|
|
126
|
+
<template v-slot:title>
|
|
127
|
+
Upper Line Text
|
|
128
|
+
</template>
|
|
129
|
+
<template v-slot:subtitle>
|
|
130
|
+
Lower: Line Text Line Text Line Text
|
|
131
|
+
</template>
|
|
132
|
+
</farm-idcaption>
|
|
133
|
+
`,
|
|
134
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="idcaption">
|
|
3
|
-
<farm-icon-box v-if="icon" :icon="icon" size="md" />
|
|
3
|
+
<farm-icon-box v-if="icon" :icon="icon" :color="iconBoxColor" size="md" />
|
|
4
4
|
<div
|
|
5
5
|
:class="{ idcaption__body: true, 'idcaption__body--single': !hasTitle || !hasSubtitle }"
|
|
6
6
|
>
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
</template>
|
|
25
25
|
|
|
26
26
|
<script lang="ts">
|
|
27
|
-
import Vue, { computed } from 'vue';
|
|
27
|
+
import Vue, { computed, PropType } from 'vue';
|
|
28
28
|
export default Vue.extend({
|
|
29
29
|
name: 'farm-idcaption',
|
|
30
30
|
props: {
|
|
@@ -34,6 +34,25 @@ export default Vue.extend({
|
|
|
34
34
|
icon: {
|
|
35
35
|
type: String,
|
|
36
36
|
},
|
|
37
|
+
/**
|
|
38
|
+
* IconBox Color
|
|
39
|
+
*/
|
|
40
|
+
iconBoxColor: {
|
|
41
|
+
type: String as PropType<
|
|
42
|
+
| 'primary'
|
|
43
|
+
| 'secondary'
|
|
44
|
+
| 'neutral'
|
|
45
|
+
| 'info'
|
|
46
|
+
| 'success'
|
|
47
|
+
| 'error'
|
|
48
|
+
| 'warning'
|
|
49
|
+
| 'success'
|
|
50
|
+
| 'extra-1'
|
|
51
|
+
| 'extra-2'
|
|
52
|
+
| 'gray'
|
|
53
|
+
>,
|
|
54
|
+
default: 'primary',
|
|
55
|
+
},
|
|
37
56
|
/**
|
|
38
57
|
* copy to clipboard
|
|
39
58
|
*/
|
|
@@ -116,6 +116,12 @@ export default Vue.extend({
|
|
|
116
116
|
this.dateField = newValue;
|
|
117
117
|
this.fieldRange = this.formatDateRange(newValue);
|
|
118
118
|
},
|
|
119
|
+
fieldRange(newValue) {
|
|
120
|
+
if (!newValue) {
|
|
121
|
+
this.dateField = [];
|
|
122
|
+
this.save();
|
|
123
|
+
}
|
|
124
|
+
},
|
|
119
125
|
},
|
|
120
126
|
methods: {
|
|
121
127
|
formatDateRange(date) {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import Switch from './Switcher';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Form/Switcher',
|
|
5
|
+
component: Switch,
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const Primary = () => ({
|
|
9
|
+
data() {
|
|
10
|
+
return {
|
|
11
|
+
selectedValue: false,
|
|
12
|
+
};
|
|
13
|
+
},
|
|
14
|
+
template: `<div>
|
|
15
|
+
<farm-switcher v-model="selectedValue" block />
|
|
16
|
+
</div>`,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export const Disabled = () => ({
|
|
20
|
+
data() {
|
|
21
|
+
return {
|
|
22
|
+
selectedValue: false,
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
template: `<div>
|
|
26
|
+
<farm-switcher v-model="selectedValue" block :disabled="true" />
|
|
27
|
+
</div>`,
|
|
28
|
+
});
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div
|
|
3
|
+
:class="{ 'farm-switch': true, 'farm-switch--disabled': isDisabled }"
|
|
4
|
+
role="checkbox"
|
|
5
|
+
@click="toggle"
|
|
6
|
+
@keydown.space.prevent="toggle"
|
|
7
|
+
>
|
|
3
8
|
<span class="farm-switch__background" :class="backgroundStyles" />
|
|
4
9
|
<span class="farm-switch__indicator" :style="indicatorStyles" />
|
|
5
10
|
</div>
|
|
@@ -10,10 +15,22 @@ import Vue from 'vue';
|
|
|
10
15
|
export default Vue.extend({
|
|
11
16
|
name: 'farm-switcher',
|
|
12
17
|
props: {
|
|
18
|
+
/**
|
|
19
|
+
* v-model binding
|
|
20
|
+
*/
|
|
13
21
|
value: {
|
|
14
22
|
type: Boolean,
|
|
15
23
|
required: true,
|
|
16
24
|
},
|
|
25
|
+
/**
|
|
26
|
+
* Is disabled?
|
|
27
|
+
*/
|
|
28
|
+
disabled: { type: Boolean, default: false },
|
|
29
|
+
},
|
|
30
|
+
data() {
|
|
31
|
+
return {
|
|
32
|
+
isDisabled: this.disabled,
|
|
33
|
+
};
|
|
17
34
|
},
|
|
18
35
|
computed: {
|
|
19
36
|
backgroundStyles() {
|
|
@@ -26,13 +43,21 @@ export default Vue.extend({
|
|
|
26
43
|
return { transform: this.value ? 'translateX(16px)' : 'translateX(0)' };
|
|
27
44
|
},
|
|
28
45
|
},
|
|
46
|
+
watch: {
|
|
47
|
+
disabled(newValue: boolean) {
|
|
48
|
+
this.isDisabled = newValue;
|
|
49
|
+
},
|
|
50
|
+
},
|
|
29
51
|
methods: {
|
|
30
52
|
toggle() {
|
|
53
|
+
if (this.isDisabled) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
31
56
|
this.$emit('input', !this.value);
|
|
32
57
|
},
|
|
33
58
|
},
|
|
34
59
|
});
|
|
35
60
|
</script>
|
|
36
61
|
<style lang="scss" scoped>
|
|
37
|
-
@import 'Switcher
|
|
62
|
+
@import 'Switcher';
|
|
38
63
|
</style>
|
package/src/helpers/date.js
CHANGED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import Switch from './Switcher';
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: 'Form/Switcher',
|
|
5
|
-
component: Switch,
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export const Primary = () => ({
|
|
9
|
-
components: { 'farm-switch': Switch },
|
|
10
|
-
data() {
|
|
11
|
-
return {
|
|
12
|
-
selectedValue: false,
|
|
13
|
-
};
|
|
14
|
-
},
|
|
15
|
-
template: `<div>
|
|
16
|
-
<farm-switch v-model="selectedValue" block />
|
|
17
|
-
</div>`,
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
Primary.storyName = 'Basic';
|