@farm-investimentos/front-mfe-components-vue3 0.0.7 → 0.0.9
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 +99 -86
- 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 +99 -86
- 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/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/Modal/__tests__/Modal.spec.js +1 -1
- package/src/components/ModalPromptUser/ModalPromptUser.vue +12 -4
- package/src/components/TextArea/TextArea.vue +12 -8
- package/src/components/TextArea/__tests__/TextArea.spec.js +13 -0
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.9",
|
|
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",
|
|
@@ -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
|
});
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<farm-modal
|
|
2
|
+
<farm-modal
|
|
3
|
+
v-model="inputVal"
|
|
4
|
+
size="sm"
|
|
5
|
+
:offsetTop="48"
|
|
6
|
+
:offsetBottom="68"
|
|
7
|
+
>
|
|
3
8
|
<template v-slot:header>
|
|
4
|
-
<farm-dialog-header
|
|
9
|
+
<farm-dialog-header
|
|
10
|
+
:title="title"
|
|
11
|
+
@onClose="close"
|
|
12
|
+
/>
|
|
5
13
|
</template>
|
|
6
14
|
<template v-slot:content>
|
|
7
15
|
<section class="modal-content">
|
|
@@ -39,7 +47,7 @@ export default {
|
|
|
39
47
|
/**
|
|
40
48
|
* Open/close modal
|
|
41
49
|
*/
|
|
42
|
-
|
|
50
|
+
modelValue: {
|
|
43
51
|
required: true,
|
|
44
52
|
},
|
|
45
53
|
/**
|
|
@@ -110,7 +118,7 @@ export default {
|
|
|
110
118
|
return this.value;
|
|
111
119
|
},
|
|
112
120
|
set(val) {
|
|
113
|
-
this.$emit('
|
|
121
|
+
this.$emit('update:modelValue', val);
|
|
114
122
|
},
|
|
115
123
|
},
|
|
116
124
|
},
|
|
@@ -31,7 +31,11 @@
|
|
|
31
31
|
@focusout="onFocus(false)"
|
|
32
32
|
/>
|
|
33
33
|
</div>
|
|
34
|
-
<farm-caption
|
|
34
|
+
<farm-caption
|
|
35
|
+
v-if="showErrorText"
|
|
36
|
+
color="error"
|
|
37
|
+
variation="regular"
|
|
38
|
+
>
|
|
35
39
|
{{ errorBucket[0] }}
|
|
36
40
|
</farm-caption>
|
|
37
41
|
<farm-caption
|
|
@@ -49,7 +53,7 @@
|
|
|
49
53
|
</template>
|
|
50
54
|
|
|
51
55
|
<script lang="ts">
|
|
52
|
-
import {
|
|
56
|
+
import { computed, onBeforeMount, PropType, ref, toRefs, watch } from 'vue';
|
|
53
57
|
|
|
54
58
|
import deepEqual from '../../composition/deepEqual';
|
|
55
59
|
import validateFormFieldBuilder from '../../composition/validateFormFieldBuilder';
|
|
@@ -64,7 +68,7 @@ export default {
|
|
|
64
68
|
/**
|
|
65
69
|
* v-model binding
|
|
66
70
|
*/
|
|
67
|
-
|
|
71
|
+
modelValue: { type: [String, Number], default: '' },
|
|
68
72
|
/**
|
|
69
73
|
* Show hint text
|
|
70
74
|
*/
|
|
@@ -126,7 +130,7 @@ export default {
|
|
|
126
130
|
},
|
|
127
131
|
setup(props, { emit }) {
|
|
128
132
|
const { rules } = toRefs(props);
|
|
129
|
-
const innerValue = ref(props.
|
|
133
|
+
const innerValue = ref(props.modelValue);
|
|
130
134
|
const isTouched = ref(false);
|
|
131
135
|
const isFocus = ref(false);
|
|
132
136
|
const isBlured = ref(false);
|
|
@@ -143,9 +147,9 @@ export default {
|
|
|
143
147
|
const showErrorText = computed(() => hasError.value && isTouched.value);
|
|
144
148
|
|
|
145
149
|
watch(
|
|
146
|
-
() => props.
|
|
150
|
+
() => props.modelValue,
|
|
147
151
|
() => {
|
|
148
|
-
innerValue.value = props.
|
|
152
|
+
innerValue.value = props.modelValue;
|
|
149
153
|
validate(innerValue.value);
|
|
150
154
|
}
|
|
151
155
|
);
|
|
@@ -153,7 +157,7 @@ export default {
|
|
|
153
157
|
watch(
|
|
154
158
|
() => innerValue.value,
|
|
155
159
|
() => {
|
|
156
|
-
emit('
|
|
160
|
+
emit('update:modelValue', innerValue.value);
|
|
157
161
|
emit('change', innerValue.value);
|
|
158
162
|
}
|
|
159
163
|
);
|
|
@@ -191,7 +195,7 @@ export default {
|
|
|
191
195
|
const reset = () => {
|
|
192
196
|
innerValue.value = '';
|
|
193
197
|
isTouched.value = true;
|
|
194
|
-
emit('
|
|
198
|
+
emit('update:modelValue', innerValue.value);
|
|
195
199
|
};
|
|
196
200
|
|
|
197
201
|
const makePristine = () => {
|
|
@@ -46,4 +46,17 @@ describe('TextArea component', () => {
|
|
|
46
46
|
expect(component.isBlured).toBeFalsy();
|
|
47
47
|
});
|
|
48
48
|
});
|
|
49
|
+
|
|
50
|
+
describe('computed properties', () => {
|
|
51
|
+
it('hasError', () => {
|
|
52
|
+
expect(component.hasError).toBeFalsy();
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
describe('watchers', () => {
|
|
57
|
+
it('props.rules', async () => {
|
|
58
|
+
await wrapper.setProps({ rules: [() => false] });
|
|
59
|
+
expect(component.hasError).toBeTruthy();
|
|
60
|
+
});
|
|
61
|
+
});
|
|
49
62
|
});
|