@farm-investimentos/front-mfe-components-vue3 0.0.8 → 0.0.10
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 +181 -168
- 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 +181 -168
- 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 +2 -2
- package/src/components/Buttons/DefaultButton/DefaultButton.scss +1 -1
- package/src/components/ContextMenu/ContextMenu.vue +1 -1
- package/src/components/DataTableHeader/DataTableHeader.vue +3 -3
- package/src/components/DialogHeader/DialogHeader.scss +2 -2
- package/src/components/DialogHeader/DialogHeader.vue +25 -9
- package/src/components/DialogHeader/__tests__/DialogHeader.spec.js +9 -2
- package/src/components/RadioGroup/RadioGroup.vue +5 -5
- package/src/components/SelectAutoComplete/SelectAutoComplete.vue +5 -5
- package/src/components/SelectAutoComplete/__tests__/SelectAutoComplete.spec.js +3 -3
- package/src/components/Switcher/Switcher.vue +16 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farm-investimentos/front-mfe-components-vue3",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"private": false,
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"react-dom": "^18.2.0",
|
|
79
79
|
"sass": "~1.32.0",
|
|
80
80
|
"sass-loader": "10.4.1",
|
|
81
|
-
"storybook": "7.5.0",
|
|
81
|
+
"storybook": "^7.5.0",
|
|
82
82
|
"ts-jest": "^29.0.0",
|
|
83
83
|
"typescript": "~4.1.5",
|
|
84
84
|
"vite": "^4.4.9",
|
|
@@ -94,7 +94,7 @@ export default {
|
|
|
94
94
|
/**
|
|
95
95
|
* v-model for data-table-select
|
|
96
96
|
*/
|
|
97
|
-
|
|
97
|
+
modelValue: {
|
|
98
98
|
default: false,
|
|
99
99
|
},
|
|
100
100
|
/**
|
|
@@ -114,10 +114,10 @@ export default {
|
|
|
114
114
|
computed: {
|
|
115
115
|
inputVal: {
|
|
116
116
|
get() {
|
|
117
|
-
return this.
|
|
117
|
+
return this.modelValue;
|
|
118
118
|
},
|
|
119
119
|
set(val) {
|
|
120
|
-
this.$emit('
|
|
120
|
+
this.$emit('update:modelValue', val);
|
|
121
121
|
},
|
|
122
122
|
},
|
|
123
123
|
},
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
.farm-dialog-header__close {
|
|
4
4
|
position: absolute;
|
|
5
5
|
margin-top: 0;
|
|
6
|
+
right: 4px;
|
|
6
7
|
font-size: 16px;
|
|
7
8
|
transition: all 0.4s;
|
|
8
|
-
right: 0;
|
|
9
9
|
&:hover {
|
|
10
10
|
opacity: 0.8;
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
header {
|
|
14
|
+
header.farm-dialog-header {
|
|
15
15
|
font-size: 12px;
|
|
16
16
|
padding: 6px 16px;
|
|
17
17
|
background-color: #fff;
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<header>
|
|
3
|
-
<farm-icon
|
|
4
|
-
|
|
2
|
+
<header class="farm-dialog-header">
|
|
3
|
+
<farm-icon
|
|
4
|
+
v-if="iconTitle"
|
|
5
|
+
size="16px"
|
|
6
|
+
color="primary"
|
|
7
|
+
class="mr-2"
|
|
8
|
+
>{{ iconTitle }}</farm-icon
|
|
9
|
+
>
|
|
10
|
+
<farm-caption
|
|
11
|
+
v-if="title"
|
|
12
|
+
variation="semiBold"
|
|
13
|
+
>
|
|
5
14
|
{{ title }}
|
|
6
15
|
</farm-caption>
|
|
7
16
|
|
|
@@ -15,12 +24,16 @@
|
|
|
15
24
|
title="Fechar"
|
|
16
25
|
@click="onClose"
|
|
17
26
|
>
|
|
18
|
-
<farm-icon
|
|
27
|
+
<farm-icon
|
|
28
|
+
role="button"
|
|
29
|
+
size="24px"
|
|
30
|
+
>
|
|
31
|
+
window-close
|
|
32
|
+
</farm-icon>
|
|
19
33
|
</farm-btn>
|
|
20
34
|
</header>
|
|
21
35
|
</template>
|
|
22
36
|
<script lang="ts">
|
|
23
|
-
|
|
24
37
|
/**
|
|
25
38
|
* Header de dialog/modal
|
|
26
39
|
*/
|
|
@@ -49,10 +62,13 @@ export default {
|
|
|
49
62
|
default: true,
|
|
50
63
|
},
|
|
51
64
|
},
|
|
52
|
-
|
|
53
|
-
onClose() {
|
|
54
|
-
|
|
55
|
-
}
|
|
65
|
+
setup(_, { emit }) {
|
|
66
|
+
const onClose = () => {
|
|
67
|
+
emit('onClose', {});
|
|
68
|
+
};
|
|
69
|
+
return {
|
|
70
|
+
onClose,
|
|
71
|
+
};
|
|
56
72
|
},
|
|
57
73
|
};
|
|
58
74
|
</script>
|
|
@@ -8,8 +8,8 @@ describe('DialogHeader component', () => {
|
|
|
8
8
|
beforeEach(() => {
|
|
9
9
|
wrapper = shallowMount(DialogHeader, {
|
|
10
10
|
propsData: {
|
|
11
|
-
title: ''
|
|
12
|
-
}
|
|
11
|
+
title: '',
|
|
12
|
+
},
|
|
13
13
|
});
|
|
14
14
|
});
|
|
15
15
|
|
|
@@ -22,4 +22,11 @@ describe('DialogHeader component', () => {
|
|
|
22
22
|
expect(wrapper.element).toBeDefined();
|
|
23
23
|
});
|
|
24
24
|
});
|
|
25
|
+
|
|
26
|
+
describe('methods', () => {
|
|
27
|
+
it('should handle close', () => {
|
|
28
|
+
wrapper.vm.onClose();
|
|
29
|
+
expect(wrapper.emitted().onClose).toBeDefined();
|
|
30
|
+
});
|
|
31
|
+
});
|
|
25
32
|
});
|
|
@@ -24,7 +24,7 @@ export default {
|
|
|
24
24
|
/**
|
|
25
25
|
* v-model
|
|
26
26
|
*/
|
|
27
|
-
|
|
27
|
+
modelValue: {
|
|
28
28
|
required: true,
|
|
29
29
|
},
|
|
30
30
|
errorMessage: String,
|
|
@@ -38,7 +38,7 @@ export default {
|
|
|
38
38
|
},
|
|
39
39
|
setup(props, { emit }) {
|
|
40
40
|
const { rules } = toRefs(props);
|
|
41
|
-
const innerValue = ref(props.
|
|
41
|
+
const innerValue = ref(props.modelValue);
|
|
42
42
|
const { errorBucket, valid, validatable } = validateFormStateBuilder();
|
|
43
43
|
const isTouched = ref(false);
|
|
44
44
|
|
|
@@ -51,10 +51,10 @@ export default {
|
|
|
51
51
|
const showErrorText = computed(() => hasError.value && isTouched.value);
|
|
52
52
|
|
|
53
53
|
watch(
|
|
54
|
-
() => props.
|
|
54
|
+
() => props.modelValue,
|
|
55
55
|
() => {
|
|
56
56
|
isTouched.value = true;
|
|
57
|
-
innerValue.value = props.
|
|
57
|
+
innerValue.value = props.modelValue;
|
|
58
58
|
validate(innerValue.value);
|
|
59
59
|
}
|
|
60
60
|
);
|
|
@@ -73,7 +73,7 @@ export default {
|
|
|
73
73
|
|
|
74
74
|
const reset = () => {
|
|
75
75
|
innerValue.value = null;
|
|
76
|
-
emit('
|
|
76
|
+
emit('update:modelValue', innerValue.value);
|
|
77
77
|
};
|
|
78
78
|
|
|
79
79
|
onBeforeMount(() => {
|
|
@@ -103,7 +103,7 @@ export default defineComponent({
|
|
|
103
103
|
/**
|
|
104
104
|
* v-model binding
|
|
105
105
|
*/
|
|
106
|
-
|
|
106
|
+
modelValue: { type: [String, Number, Array], default: '' },
|
|
107
107
|
hint: {
|
|
108
108
|
type: String,
|
|
109
109
|
default: null,
|
|
@@ -280,7 +280,7 @@ export default defineComponent({
|
|
|
280
280
|
});
|
|
281
281
|
|
|
282
282
|
watch(
|
|
283
|
-
() => props.
|
|
283
|
+
() => props.modelValue,
|
|
284
284
|
newValue => {
|
|
285
285
|
innerValue.value = newValue;
|
|
286
286
|
errorBucket.value = [];
|
|
@@ -296,7 +296,7 @@ export default defineComponent({
|
|
|
296
296
|
}
|
|
297
297
|
validate(newValue);
|
|
298
298
|
updateSelectedTextValue();
|
|
299
|
-
emit('
|
|
299
|
+
emit('update:modelValue', newValue);
|
|
300
300
|
}
|
|
301
301
|
);
|
|
302
302
|
|
|
@@ -315,7 +315,7 @@ export default defineComponent({
|
|
|
315
315
|
isTouched.value = true;
|
|
316
316
|
isBlured.value = true;
|
|
317
317
|
validate(innerValue.value);
|
|
318
|
-
emit('
|
|
318
|
+
emit('update:modelValue', innerValue.value);
|
|
319
319
|
}
|
|
320
320
|
);
|
|
321
321
|
|
|
@@ -356,7 +356,7 @@ export default defineComponent({
|
|
|
356
356
|
innerValue.value = [];
|
|
357
357
|
return;
|
|
358
358
|
}
|
|
359
|
-
emit('
|
|
359
|
+
emit('update:modelValue', innerValue.value);
|
|
360
360
|
};
|
|
361
361
|
|
|
362
362
|
const onBlur = (event: Event) => {
|
|
@@ -89,7 +89,7 @@ describe('SelectAutoComplet component', () => {
|
|
|
89
89
|
{ value: 2, text: 'value 2' },
|
|
90
90
|
{ value: 3, text: 'value 3' },
|
|
91
91
|
],
|
|
92
|
-
|
|
92
|
+
modelValue: [0],
|
|
93
93
|
});
|
|
94
94
|
|
|
95
95
|
component.addLabelToMultiple();
|
|
@@ -104,7 +104,7 @@ describe('SelectAutoComplet component', () => {
|
|
|
104
104
|
{ value: 2, text: 'value 2' },
|
|
105
105
|
{ value: 3, text: 'value 3' },
|
|
106
106
|
],
|
|
107
|
-
|
|
107
|
+
modelValue: [0, 1],
|
|
108
108
|
});
|
|
109
109
|
|
|
110
110
|
component.addLabelToMultiple();
|
|
@@ -120,7 +120,7 @@ describe('SelectAutoComplet component', () => {
|
|
|
120
120
|
{ value: 2, text: 'value 2' },
|
|
121
121
|
{ value: 3, text: 'value 3' },
|
|
122
122
|
],
|
|
123
|
-
|
|
123
|
+
modelValue: [0, 1, 2],
|
|
124
124
|
});
|
|
125
125
|
|
|
126
126
|
component.addLabelToMultiple();
|
|
@@ -6,12 +6,18 @@
|
|
|
6
6
|
@click="toggle"
|
|
7
7
|
@keydown.space.prevent="toggle"
|
|
8
8
|
>
|
|
9
|
-
<span
|
|
10
|
-
|
|
9
|
+
<span
|
|
10
|
+
class="farm-switch__background"
|
|
11
|
+
:class="backgroundStyles"
|
|
12
|
+
/>
|
|
13
|
+
<span
|
|
14
|
+
class="farm-switch__indicator"
|
|
15
|
+
:style="indicatorStyles"
|
|
16
|
+
/>
|
|
11
17
|
</div>
|
|
12
18
|
</template>
|
|
13
19
|
<script lang="ts">
|
|
14
|
-
import {
|
|
20
|
+
import { PropType, computed, ref, watch } from 'vue';
|
|
15
21
|
|
|
16
22
|
export default {
|
|
17
23
|
name: 'farm-switcher',
|
|
@@ -39,7 +45,7 @@ export default {
|
|
|
39
45
|
/**
|
|
40
46
|
* v-model binding
|
|
41
47
|
*/
|
|
42
|
-
|
|
48
|
+
modelValue: {
|
|
43
49
|
type: Boolean,
|
|
44
50
|
required: true,
|
|
45
51
|
},
|
|
@@ -61,14 +67,14 @@ export default {
|
|
|
61
67
|
const isDisabled = ref(props.disabled);
|
|
62
68
|
|
|
63
69
|
const backgroundStyles = computed(() => ({
|
|
64
|
-
'farm-switch--selected': props.
|
|
65
|
-
'farm-switch--idle': !props.
|
|
66
|
-
'farm-switch--disabled-on': props.
|
|
67
|
-
'farm-switch--disabled-off': !props.
|
|
70
|
+
'farm-switch--selected': props.modelValue && !isDisabled.value,
|
|
71
|
+
'farm-switch--idle': !props.modelValue && !isDisabled.value,
|
|
72
|
+
'farm-switch--disabled-on': props.modelValue && isDisabled.value,
|
|
73
|
+
'farm-switch--disabled-off': !props.modelValue && isDisabled.value,
|
|
68
74
|
}));
|
|
69
75
|
|
|
70
76
|
const indicatorStyles = computed(() => ({
|
|
71
|
-
transform: props.
|
|
77
|
+
transform: props.modelValue ? 'translateX(16px)' : 'translateX(0)',
|
|
72
78
|
}));
|
|
73
79
|
|
|
74
80
|
watch(
|
|
@@ -82,7 +88,7 @@ export default {
|
|
|
82
88
|
if (isDisabled.value) {
|
|
83
89
|
return false;
|
|
84
90
|
}
|
|
85
|
-
emit('
|
|
91
|
+
emit('update:modelValue', !props.modelValue);
|
|
86
92
|
};
|
|
87
93
|
|
|
88
94
|
return { isDisabled, backgroundStyles, indicatorStyles, toggle };
|