@farm-investimentos/front-mfe-components-vue3 0.6.0 → 0.6.5
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 +376 -207
- 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 +376 -207
- 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/ChipInviteStatus/keys.ts +9 -9
- 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/ContextMenu/ContextMenu.stories.js +0 -4
- package/src/components/DatePicker/DatePicker.stories.js +2 -2
- package/src/components/DatePicker/DatePicker.vue +3 -1
- package/src/components/InputDecimalFormatter/__tests__/InputMoney.spec.js +6 -3
- package/src/components/ListItem/ListItem.scss +54 -8
- package/src/components/ListItem/ListItem.vue +2 -2
- package/src/components/MainFilter/MainFilter.stories.js +27 -2
- package/src/components/MainFilter/MainFilter.vue +37 -22
- package/src/components/MainFilter/__tests__/MainFilter.spec.js +2 -2
- package/src/components/Modal/Modal.vue +6 -10
- package/src/components/Modal/__tests__/Modal.spec.js +10 -0
- package/src/components/ModalPromptUser/ModalPromptUser.vue +1 -1
- package/src/components/ModalPromptUser/__tests__/ModalPromptUser.spec.js +1 -1
- package/src/components/RadioGroup/__tests__/RadioGroup.spec.js +1 -1
- package/src/components/Select/Select.scss +5 -5
- package/src/components/Select/Select.stories.js +74 -0
- package/src/components/Select/Select.vue +166 -64
- package/src/components/Select/__tests__/Select.spec.js +62 -1
- package/src/components/Select/__tests__/selectItemHandler.spec.js +93 -0
- package/src/components/Select/composition/buildData.ts +2 -0
- package/src/components/Select/composition/index.ts +3 -1
- package/src/components/Select/composition/selectItemHandler.ts +60 -0
- package/src/components/Select/composition/watchAllChecked.ts +23 -0
- package/src/components/SelectAutoComplete/SelectAutoComplete.vue +1 -1
- package/src/components/SelectAutoComplete/__tests__/SelectAutoComplete.spec.js +1 -1
- 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/TextArea/__tests__/TextArea.spec.js +5 -1
- package/src/components/TextFieldV2/TextFieldV2.stories.js +3 -3
- package/src/interfaces/ISelectItem.ts +5 -0
- package/src/scss/Sticky-table.scss +13 -10
|
@@ -8,10 +8,24 @@
|
|
|
8
8
|
display: flex;
|
|
9
9
|
align-items: center;
|
|
10
10
|
|
|
11
|
+
.farm-icon,
|
|
12
|
+
.farm-typography {
|
|
13
|
+
color: var(--farm-neutral-darken);
|
|
14
|
+
}
|
|
15
|
+
|
|
11
16
|
&--clickable {
|
|
12
17
|
cursor: pointer;
|
|
13
18
|
}
|
|
14
19
|
|
|
20
|
+
&--disabled {
|
|
21
|
+
cursor: default;
|
|
22
|
+
|
|
23
|
+
.farm-icon,
|
|
24
|
+
.farm-typography {
|
|
25
|
+
color: var(--farm-stroke-disabled);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
15
29
|
> a {
|
|
16
30
|
text-decoration: none;
|
|
17
31
|
}
|
|
@@ -20,17 +34,49 @@
|
|
|
20
34
|
&:focus {
|
|
21
35
|
border-radius: 5px;
|
|
22
36
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
37
|
+
&:not(.farm-listitem--disabled) {
|
|
38
|
+
@each $color in $theme-colors-list {
|
|
39
|
+
&#{'.farm-listitem--' + $color + '-base'} {
|
|
40
|
+
background-color: rgba(themeColor($color), 0.27);
|
|
41
|
+
.farm-icon,
|
|
42
|
+
.farm-typography {
|
|
43
|
+
color: rgba(themeColor($color), 1);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&#{'.farm-listitem--' + $color + '-lighten'} {
|
|
48
|
+
background-color: rgba(themeColor($color, 'lighten'), 0.27);
|
|
49
|
+
.farm-icon,
|
|
50
|
+
.farm-typography {
|
|
51
|
+
color: rgba(themeColor($color), 1);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
27
54
|
|
|
28
|
-
|
|
29
|
-
|
|
55
|
+
&#{'.farm-listitem--' + $color + '-darken'} {
|
|
56
|
+
background-color: rgba(themeColor($color, 'darken'), 0.27);
|
|
57
|
+
.farm-icon,
|
|
58
|
+
.farm-typography {
|
|
59
|
+
color: rgba(themeColor($color), 1);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
30
62
|
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&:active {
|
|
67
|
+
&:not(.farm-listitem--disabled) {
|
|
68
|
+
@each $color in $theme-colors-list {
|
|
69
|
+
&#{'.farm-listitem--' + $color + '-base'} {
|
|
70
|
+
background-color: rgba(themeColor($color), 0.8);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&#{'.farm-listitem--' + $color + '-lighten'} {
|
|
74
|
+
background-color: rgba(themeColor($color, 'lighten'), 0.8);
|
|
75
|
+
}
|
|
31
76
|
|
|
32
|
-
|
|
33
|
-
|
|
77
|
+
&#{'.farm-listitem--' + $color + '-darken'} {
|
|
78
|
+
background-color: rgba(themeColor($color, 'darken'), 0.8);
|
|
79
|
+
}
|
|
34
80
|
}
|
|
35
81
|
}
|
|
36
82
|
}
|
|
@@ -78,7 +78,32 @@ export const Application = () => ({
|
|
|
78
78
|
|
|
79
79
|
export const FullWidth = () => ({
|
|
80
80
|
template: `
|
|
81
|
-
<
|
|
81
|
+
<farm-box>
|
|
82
82
|
<farm-form-mainfilter label="Label" fullWidth :hasExtraFilters="false"/>
|
|
83
|
-
</
|
|
83
|
+
</farm-box>`,
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
export const InitialValue = () => ({
|
|
87
|
+
template: `
|
|
88
|
+
<farm-row>
|
|
89
|
+
<farm-col md="4">
|
|
90
|
+
<farm-form-mainfilter label="Label" initialValue="with initial value" />
|
|
91
|
+
</farm-col>
|
|
92
|
+
</farm-row>`,
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
export const onInputChange = () => ({
|
|
96
|
+
setup() {
|
|
97
|
+
function handler(value) {
|
|
98
|
+
alert(`onInputChange: ${value}`);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return { handler };
|
|
102
|
+
},
|
|
103
|
+
template: `
|
|
104
|
+
<farm-row>
|
|
105
|
+
<farm-col md="4">
|
|
106
|
+
<farm-form-mainfilter label="Label" @onInputChange="handler" />
|
|
107
|
+
</farm-col>
|
|
108
|
+
</farm-row>`,
|
|
84
109
|
});
|
|
@@ -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,15 +12,24 @@
|
|
|
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"
|
|
20
31
|
class="farm-btn__cta"
|
|
32
|
+
outlined
|
|
21
33
|
:title="extraFiltersBtnLabel"
|
|
22
34
|
@click="onFilterClick"
|
|
23
35
|
>
|
|
@@ -28,7 +40,7 @@
|
|
|
28
40
|
</template>
|
|
29
41
|
|
|
30
42
|
<script lang="ts">
|
|
31
|
-
|
|
43
|
+
import { computed, ref, toRefs, getCurrentInstance } from 'vue';
|
|
32
44
|
|
|
33
45
|
export default {
|
|
34
46
|
name: 'farm-form-mainfilter',
|
|
@@ -88,34 +100,37 @@ export default {
|
|
|
88
100
|
default: false,
|
|
89
101
|
},
|
|
90
102
|
},
|
|
103
|
+
setup(props) {
|
|
104
|
+
const { showFilters, initialValue } = toRefs(props);
|
|
105
|
+
|
|
106
|
+
const internalInstance = getCurrentInstance().proxy;
|
|
107
|
+
|
|
108
|
+
const timer = ref<Number>(null);
|
|
109
|
+
|
|
110
|
+
const inputValue = ref(initialValue.value);
|
|
111
|
+
|
|
112
|
+
const extraFiltersBtnIcon = computed(() =>
|
|
113
|
+
showFilters.value ? 'filter-off-outline' : 'filter-outline'
|
|
114
|
+
);
|
|
115
|
+
const extraFiltersBtnLabel = computed(
|
|
116
|
+
() => `${showFilters.value ? 'Esconder' : 'Ver'} Filtros`
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
const hasSlotData = computed(() => internalInstance.$slots.default);
|
|
120
|
+
|
|
121
|
+
return { inputValue, extraFiltersBtnIcon, extraFiltersBtnLabel, timer, hasSlotData };
|
|
122
|
+
},
|
|
91
123
|
|
|
92
124
|
watch: {
|
|
93
125
|
initialValue(newValue: string) {
|
|
94
126
|
this.inputValue = newValue;
|
|
95
127
|
},
|
|
96
128
|
},
|
|
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
129
|
methods: {
|
|
115
130
|
onFilterClick() {
|
|
116
131
|
this.$emit('onClick');
|
|
117
132
|
},
|
|
118
|
-
isInvalidKey(keyCode:
|
|
133
|
+
isInvalidKey(keyCode: number) {
|
|
119
134
|
return (
|
|
120
135
|
(keyCode < 48 && keyCode !== 8 && keyCode !== 46) ||
|
|
121
136
|
(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
|
});
|
|
@@ -21,21 +21,16 @@
|
|
|
21
21
|
<slot name="footer"></slot>
|
|
22
22
|
</div>
|
|
23
23
|
</div>
|
|
24
|
-
<div
|
|
24
|
+
<div
|
|
25
|
+
class="farm-modal--overlay"
|
|
26
|
+
@click="close()"
|
|
27
|
+
></div>
|
|
25
28
|
</div>
|
|
26
29
|
</transition>
|
|
27
30
|
</template>
|
|
28
31
|
|
|
29
32
|
<script lang="ts">
|
|
30
|
-
import {
|
|
31
|
-
onBeforeUnmount,
|
|
32
|
-
onMounted,
|
|
33
|
-
PropType,
|
|
34
|
-
reactive,
|
|
35
|
-
ref,
|
|
36
|
-
toRefs,
|
|
37
|
-
watch,
|
|
38
|
-
} from 'vue';
|
|
33
|
+
import { onBeforeUnmount, onMounted, PropType, reactive, ref, toRefs, watch } from 'vue';
|
|
39
34
|
|
|
40
35
|
import { calculateMainZindex } from '../../helpers';
|
|
41
36
|
|
|
@@ -87,6 +82,7 @@ export default {
|
|
|
87
82
|
window.removeEventListener('keyup', escHandler);
|
|
88
83
|
inputValue.value = false;
|
|
89
84
|
emit('update:modelValue', false);
|
|
85
|
+
emit('onClose');
|
|
90
86
|
};
|
|
91
87
|
|
|
92
88
|
watch(
|
|
@@ -4,6 +4,7 @@ import Modal from '../index';
|
|
|
4
4
|
|
|
5
5
|
describe('Modal component', () => {
|
|
6
6
|
let wrapper;
|
|
7
|
+
let component;
|
|
7
8
|
|
|
8
9
|
beforeEach(() => {
|
|
9
10
|
wrapper = shallowMount(Modal, {
|
|
@@ -11,9 +12,18 @@ describe('Modal component', () => {
|
|
|
11
12
|
modelValue: false,
|
|
12
13
|
},
|
|
13
14
|
});
|
|
15
|
+
component = wrapper.vm;
|
|
14
16
|
});
|
|
15
17
|
|
|
16
18
|
test('Modal created', () => {
|
|
17
19
|
expect(wrapper).toBeDefined();
|
|
18
20
|
});
|
|
21
|
+
|
|
22
|
+
describe('Methods', () => {
|
|
23
|
+
it('Should emit events when call close function', () => {
|
|
24
|
+
component.close();
|
|
25
|
+
expect(wrapper.emitted()['update:modelValue']).toBeDefined();
|
|
26
|
+
expect(wrapper.emitted()['onClose']).toBeDefined();
|
|
27
|
+
});
|
|
28
|
+
});
|
|
19
29
|
});
|
|
@@ -28,22 +28,22 @@
|
|
|
28
28
|
margin-right: 8px;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
:deep(.farm-listitem:hover .farm-typography) {
|
|
31
|
+
:deep(.farm-listitem:not(.farm-listitem--disabled):hover .farm-typography) {
|
|
32
32
|
color: var(--farm-primary-base);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
:deep(.farm-listitem:focus .farm-typography) {
|
|
35
|
+
:deep(.farm-listitem:not(.farm-listitem--disabled):focus .farm-typography) {
|
|
36
36
|
color: var(--farm-primary-base);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
:deep(.farm-listitem:hover .farm-checkbox .farm-icon) {
|
|
39
|
+
:deep(.farm-listitem:not(.farm-listitem--disabled):hover .farm-checkbox .farm-icon) {
|
|
40
40
|
color: var(--farm-primary-lighten);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
:deep(.farm-listitem:focus .farm-checkbox .farm-icon) {
|
|
43
|
+
:deep(.farm-listitem:not(.farm-listitem--disabled):focus .farm-checkbox .farm-icon) {
|
|
44
44
|
color: var(--farm-primary-lighten);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
:deep(.farm-listitem:hover .farm-checkbox.farm-checkbox--checked .farm-icon) {
|
|
48
48
|
color: white;
|
|
49
|
-
}
|
|
49
|
+
}
|
|
@@ -251,6 +251,42 @@ export const Multiple = () => ({
|
|
|
251
251
|
</div>`,
|
|
252
252
|
});
|
|
253
253
|
|
|
254
|
+
export const MultipleSelectAll = () => ({
|
|
255
|
+
data() {
|
|
256
|
+
return {
|
|
257
|
+
v: null,
|
|
258
|
+
items: [
|
|
259
|
+
{ value: 0, text: 'value 0' },
|
|
260
|
+
{ value: 1, text: 'value 1' },
|
|
261
|
+
{ value: 2, text: 'value 2' },
|
|
262
|
+
{ value: 3, text: 'value 3' },
|
|
263
|
+
],
|
|
264
|
+
};
|
|
265
|
+
},
|
|
266
|
+
template: `<div style="width: 400px">
|
|
267
|
+
<farm-select v-model="v" :items="items" multiple has-all-option />
|
|
268
|
+
v-model: {{ v }}
|
|
269
|
+
</div>`,
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
export const MultipleWithAllOptionAndDisabledItems = () => ({
|
|
273
|
+
data() {
|
|
274
|
+
return {
|
|
275
|
+
v: null,
|
|
276
|
+
items: [
|
|
277
|
+
{ value: 0, text: 'value 0' },
|
|
278
|
+
{ value: 1, text: 'value 1', disabled: true },
|
|
279
|
+
{ value: 2, text: 'value 2' },
|
|
280
|
+
{ value: 3, text: 'value 3', disabled: true },
|
|
281
|
+
],
|
|
282
|
+
};
|
|
283
|
+
},
|
|
284
|
+
template: `<div style="width: 400px">
|
|
285
|
+
<farm-select v-model="v" :items="items" multiple has-all-option />
|
|
286
|
+
v-model: {{ v }}
|
|
287
|
+
</div>`,
|
|
288
|
+
});
|
|
289
|
+
|
|
254
290
|
export const MultipleInitValue = () => ({
|
|
255
291
|
data() {
|
|
256
292
|
return {
|
|
@@ -344,3 +380,41 @@ export const ChangeEvent = () => ({
|
|
|
344
380
|
|
|
345
381
|
</div>`,
|
|
346
382
|
});
|
|
383
|
+
|
|
384
|
+
export const DisabledKeys = () => ({
|
|
385
|
+
data() {
|
|
386
|
+
return {
|
|
387
|
+
v: null,
|
|
388
|
+
items: [
|
|
389
|
+
{ value: 1, text: ' value 1', disabled: true },
|
|
390
|
+
{ value: 2, text: ' value 2', disabled: true },
|
|
391
|
+
{ value: 3, text: ' value 3' },
|
|
392
|
+
],
|
|
393
|
+
};
|
|
394
|
+
},
|
|
395
|
+
methods: {
|
|
396
|
+
allowAllOptions() {
|
|
397
|
+
this.items = [
|
|
398
|
+
{ value: 1, text: ' value 1' },
|
|
399
|
+
{ value: 2, text: ' value 2' },
|
|
400
|
+
{ value: 3, text: ' value 3' },
|
|
401
|
+
];
|
|
402
|
+
},
|
|
403
|
+
reset() {
|
|
404
|
+
this.items = [
|
|
405
|
+
{ value: 1, text: ' value 1', disabled: true },
|
|
406
|
+
{ value: 2, text: ' value 2', disabled: true },
|
|
407
|
+
{ value: 3, text: ' value 3' },
|
|
408
|
+
];
|
|
409
|
+
this.v = null;
|
|
410
|
+
},
|
|
411
|
+
},
|
|
412
|
+
template: `<farm-row>
|
|
413
|
+
<farm-col md="4">
|
|
414
|
+
<farm-select v-model="v" :items="items" />
|
|
415
|
+
v-model: {{ v }}
|
|
416
|
+
<farm-btn @click="allowAllOptions">Habilitar todos itens</farm-btn>
|
|
417
|
+
<farm-btn @click="reset">Resetar</farm-btn>
|
|
418
|
+
</farm-col>
|
|
419
|
+
</farm-row>`,
|
|
420
|
+
});
|