@farm-investimentos/front-mfe-components-vue3 0.6.0 → 0.6.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 +158 -79
- 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 +158 -79
- 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 +5 -2
- package/src/components/Chip/Chip.vue +1 -2
- package/src/components/Chip/__tests__/Chip.spec.js +3 -1
- package/src/components/Collapsible/Collapsible.scss +16 -0
- package/src/components/Collapsible/Collapsible.stories.js +239 -9
- package/src/components/Collapsible/Collapsible.vue +103 -15
- package/src/components/Collapsible/__tests__/Collapsible.spec.js +8 -0
- package/src/components/DatePicker/DatePicker.stories.js +2 -2
- package/src/components/MainFilter/MainFilter.stories.js +27 -2
- package/src/components/MainFilter/MainFilter.vue +36 -22
- package/src/components/MainFilter/__tests__/MainFilter.spec.js +2 -2
- package/src/components/Switcher/__tests__/Switcher.spec.js +1 -1
- package/src/components/TextArea/TextArea.scss +7 -0
- package/src/components/TextArea/TextArea.stories.js +8 -6
- package/src/components/TextFieldV2/TextFieldV2.stories.js +3 -3
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<farm-row :class="{ 'justify-end': justifyEnd === true }">
|
|
3
|
-
<farm-col
|
|
3
|
+
<farm-col
|
|
4
|
+
v-if="hasInitialInput"
|
|
5
|
+
:md="fullWidth ? 12 : 6"
|
|
6
|
+
>
|
|
4
7
|
<farm-label :for="elementId">
|
|
5
8
|
{{ !hasSlotData ? label : '' }}
|
|
6
9
|
<slot v-if="hasSlotData"></slot>
|
|
@@ -9,11 +12,19 @@
|
|
|
9
12
|
{{ tooltip }}
|
|
10
13
|
</farm-caption>
|
|
11
14
|
<template v-slot:activator>
|
|
12
|
-
<farm-icon
|
|
15
|
+
<farm-icon
|
|
16
|
+
size="sm"
|
|
17
|
+
color="gray"
|
|
18
|
+
>help-circle</farm-icon
|
|
19
|
+
>
|
|
13
20
|
</template>
|
|
14
21
|
</farm-tooltip>
|
|
15
22
|
</farm-label>
|
|
16
|
-
<farm-textfield-v2
|
|
23
|
+
<farm-textfield-v2
|
|
24
|
+
v-model="inputValue"
|
|
25
|
+
:id="elementId"
|
|
26
|
+
@keyup="onKeyUp"
|
|
27
|
+
/>
|
|
17
28
|
</farm-col>
|
|
18
29
|
<farm-btn
|
|
19
30
|
v-if="hasExtraFilters"
|
|
@@ -28,7 +39,7 @@
|
|
|
28
39
|
</template>
|
|
29
40
|
|
|
30
41
|
<script lang="ts">
|
|
31
|
-
|
|
42
|
+
import { computed, ref, toRefs, getCurrentInstance } from 'vue';
|
|
32
43
|
|
|
33
44
|
export default {
|
|
34
45
|
name: 'farm-form-mainfilter',
|
|
@@ -88,34 +99,37 @@ export default {
|
|
|
88
99
|
default: false,
|
|
89
100
|
},
|
|
90
101
|
},
|
|
102
|
+
setup(props) {
|
|
103
|
+
const { showFilters, initialValue } = toRefs(props);
|
|
104
|
+
|
|
105
|
+
const internalInstance = getCurrentInstance().proxy;
|
|
106
|
+
|
|
107
|
+
const timer = ref<Number>(null);
|
|
108
|
+
|
|
109
|
+
const inputValue = ref(initialValue.value);
|
|
110
|
+
|
|
111
|
+
const extraFiltersBtnIcon = computed(() =>
|
|
112
|
+
showFilters.value ? 'filter-off-outline' : 'filter-outline'
|
|
113
|
+
);
|
|
114
|
+
const extraFiltersBtnLabel = computed(
|
|
115
|
+
() => `${showFilters.value ? 'Esconder' : 'Ver'} Filtros`
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
const hasSlotData = computed(() => internalInstance.$slots.default);
|
|
119
|
+
|
|
120
|
+
return { inputValue, extraFiltersBtnIcon, extraFiltersBtnLabel, timer, hasSlotData };
|
|
121
|
+
},
|
|
91
122
|
|
|
92
123
|
watch: {
|
|
93
124
|
initialValue(newValue: string) {
|
|
94
125
|
this.inputValue = newValue;
|
|
95
126
|
},
|
|
96
127
|
},
|
|
97
|
-
computed: {
|
|
98
|
-
hasSlotData() {
|
|
99
|
-
return this.$slots.default;
|
|
100
|
-
},
|
|
101
|
-
extraFiltersBtnLabel() {
|
|
102
|
-
return `${this.showFilters ? 'Esconder' : 'Ver'} Filtros`;
|
|
103
|
-
},
|
|
104
|
-
extraFiltersBtnIcon() {
|
|
105
|
-
return this.showFilters ? 'filter-off' : 'filter';
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
data() {
|
|
109
|
-
return {
|
|
110
|
-
timer: null,
|
|
111
|
-
inputValue: this.initialValue,
|
|
112
|
-
};
|
|
113
|
-
},
|
|
114
128
|
methods: {
|
|
115
129
|
onFilterClick() {
|
|
116
130
|
this.$emit('onClick');
|
|
117
131
|
},
|
|
118
|
-
isInvalidKey(keyCode:
|
|
132
|
+
isInvalidKey(keyCode: number) {
|
|
119
133
|
return (
|
|
120
134
|
(keyCode < 48 && keyCode !== 8 && keyCode !== 46) ||
|
|
121
135
|
(keyCode > 90 && keyCode < 96 && keyCode !== 91) ||
|
|
@@ -36,11 +36,11 @@ describe('MainFilter component', () => {
|
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
it('get extraFiltersBtnIcon', async () => {
|
|
39
|
-
expect(component.extraFiltersBtnIcon).toEqual('filter');
|
|
39
|
+
expect(component.extraFiltersBtnIcon).toEqual('filter-outline');
|
|
40
40
|
await wrapper.setProps({
|
|
41
41
|
showFilters: true,
|
|
42
42
|
});
|
|
43
|
-
expect(component.extraFiltersBtnIcon).toEqual('filter-off');
|
|
43
|
+
expect(component.extraFiltersBtnIcon).toEqual('filter-off-outline');
|
|
44
44
|
});
|
|
45
45
|
});
|
|
46
46
|
});
|
|
@@ -36,7 +36,14 @@
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
&--disabled {
|
|
39
|
+
.farm-textarea--textarea {
|
|
40
|
+
background-color: var(--farm-neutral-lighten);
|
|
41
|
+
border-color: var(--farm-gray-lighten);
|
|
42
|
+
color: var(--farm-bw-black-30);
|
|
43
|
+
}
|
|
39
44
|
textarea {
|
|
45
|
+
background-color: var(--farm-neutral-lighten);
|
|
46
|
+
border-color: var(--farm-gray-lighten);
|
|
40
47
|
color: var(--farm-bw-black-30);
|
|
41
48
|
}
|
|
42
49
|
}
|
|
@@ -52,9 +52,11 @@ export const Disabled = () => ({
|
|
|
52
52
|
v: 'input text',
|
|
53
53
|
};
|
|
54
54
|
},
|
|
55
|
-
template: `<
|
|
55
|
+
template: `<farm-row>
|
|
56
|
+
<farm-col md="4">
|
|
56
57
|
<farm-textarea v-model="v" disabled />
|
|
57
|
-
|
|
58
|
+
</farm-col>
|
|
59
|
+
</farm-row>`,
|
|
58
60
|
});
|
|
59
61
|
|
|
60
62
|
export const Readonly = () => ({
|
|
@@ -133,8 +135,8 @@ export const Reset = () => ({
|
|
|
133
135
|
this.$refs.inputValidatable.reset();
|
|
134
136
|
},
|
|
135
137
|
},
|
|
136
|
-
template: `<
|
|
137
|
-
|
|
138
|
+
template: `<farm-row>
|
|
139
|
+
<farm-col md="4">
|
|
138
140
|
<farm-label>Not Required</farm-label>
|
|
139
141
|
<farm-textarea v-model="v" ref="input" />
|
|
140
142
|
|
|
@@ -142,6 +144,6 @@ export const Reset = () => ({
|
|
|
142
144
|
<farm-textarea v-model="v" ref="inputValidatable" :rules="[rules.required]" />
|
|
143
145
|
|
|
144
146
|
<farm-btn @click="reset">reset</farm-btn>
|
|
145
|
-
|
|
146
|
-
</
|
|
147
|
+
</farm-col>
|
|
148
|
+
</farm-row>`,
|
|
147
149
|
});
|
|
@@ -46,7 +46,7 @@ export const Primary = () => ({
|
|
|
46
46
|
</farm-label>
|
|
47
47
|
<farm-textfield-v2 id="input-primary" v-model="v" />
|
|
48
48
|
v-model: {{ v }}
|
|
49
|
-
|
|
49
|
+
</farm-col>
|
|
50
50
|
</farm-row>`,
|
|
51
51
|
});
|
|
52
52
|
|
|
@@ -257,7 +257,7 @@ export const Uppercase = () => ({
|
|
|
257
257
|
template: `<farm-row>
|
|
258
258
|
<farm-col md="4">
|
|
259
259
|
<farm-textfield-v2 id="input-uppercase" v-model="v" uppercase/>
|
|
260
|
-
|
|
260
|
+
</farm-col>
|
|
261
261
|
</farm-row>`,
|
|
262
262
|
});
|
|
263
263
|
|
|
@@ -271,6 +271,6 @@ export const Ellipsed = () => ({
|
|
|
271
271
|
<farm-col md="2">
|
|
272
272
|
<farm-textfield-v2 id="input-primary-ellipsed" v-model="v" ellipsed />
|
|
273
273
|
v-model: {{ v }}
|
|
274
|
-
|
|
274
|
+
</farm-col>
|
|
275
275
|
</farm-row>`,
|
|
276
276
|
});
|