@farm-investimentos/front-mfe-components 14.2.0 → 14.2.2
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 +5280 -6611
- package/dist/front-mfe-components.common.js.map +1 -1
- package/dist/front-mfe-components.css +2 -2
- package/dist/front-mfe-components.umd.js +5280 -6611
- 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/Buttons/DefaultButton/DefaultButton.scss +22 -9
- package/src/components/Buttons/DefaultButton/DefaultButton.stories.js +45 -12
- package/src/components/Buttons/DefaultButton/DefaultButton.vue +1 -1
- package/src/components/Buttons/ExportButton/ExportButton.vue +2 -1
- package/src/components/ContextMenu/ContextMenu.stories.js +39 -26
- package/src/components/ContextMenu/ContextMenu.vue +8 -1
- package/src/components/DataTableHeader/DataTableHeader.scss +5 -3
- package/src/components/DataTableHeader/DataTableHeader.vue +2 -1
- package/src/components/DatePicker/DatePicker.vue +2 -3
- package/src/components/DatePicker/__tests__/DatePicker.spec.js +1 -1
- package/src/components/ListItem/ListItem.stories.js +24 -13
- package/src/components/RangeDatePicker/RangeDatePicker.vue +0 -2
- package/src/components/Select/Select.vue +5 -1
- package/src/components/Stepper/StepperHeader/StepperHeader.vue +35 -36
- package/src/components/TableContextMenu/TableContextMenu.vue +2 -1
- package/src/components/Tabs/Tabs.scss +58 -0
- package/src/components/Tabs/Tabs.stories.js +51 -4
- package/src/components/Tabs/Tabs.vue +30 -24
- package/src/components/Tabs/__tests__/Tabs.spec.js +54 -54
- package/src/components/Tabs/index.ts +1 -0
- package/src/main.ts +1 -2
- package/src/scss/Sticky-table.scss +20 -3
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import Tabs from './Tabs.vue';
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
title: 'Display/Tabs',
|
|
5
|
+
component: Tabs,
|
|
6
|
+
parameters: {
|
|
7
7
|
docs: {
|
|
8
8
|
description: {
|
|
9
9
|
component: `Tabs<br />
|
|
@@ -17,5 +17,52 @@ export default {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
export const Primary = () => ({
|
|
20
|
-
|
|
20
|
+
data() {
|
|
21
|
+
return {
|
|
22
|
+
v: 'Seleção',
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
methods: {
|
|
26
|
+
updateValue(value) {
|
|
27
|
+
this.v = value.name;
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
template: `<div>
|
|
31
|
+
<farm-tabs @update="updateValue" />
|
|
32
|
+
<p class="mt-2">selected: {{v}}</p>
|
|
33
|
+
</div>`,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export const WithoutCounter = () => ({
|
|
37
|
+
data() {
|
|
38
|
+
return {
|
|
39
|
+
v: 'Seleção',
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
methods: {
|
|
43
|
+
updateValue(value) {
|
|
44
|
+
this.v = value.name;
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
template: `<div>
|
|
48
|
+
<farm-tabs :showCounter="false" @update="updateValue" />
|
|
49
|
+
<p class="mt-2">selected: {{v}}</p>
|
|
50
|
+
</div>`,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export const Disabled = () => ({
|
|
54
|
+
data() {
|
|
55
|
+
return {
|
|
56
|
+
v: 'Seleção',
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
methods: {
|
|
60
|
+
updateValue(value) {
|
|
61
|
+
this.v = value.name;
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
template: `<div>
|
|
65
|
+
<farm-tabs :showCounter="false" :allow-user-change="false" @update="updateValue" />
|
|
66
|
+
<p class="mt-2">selected: {{v}}</p>
|
|
67
|
+
</div>`,
|
|
21
68
|
});
|
|
@@ -1,27 +1,40 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
2
|
+
<div class="tabs" :class="{ 'tabs--disabled': !allowUserChange }">
|
|
3
|
+
<div
|
|
4
4
|
v-for="(tab, index) in tabs"
|
|
5
|
+
class="tabs__tab"
|
|
5
6
|
:key="index"
|
|
6
|
-
:class="{ hideCounter: !showCounter }"
|
|
7
|
-
@
|
|
8
|
-
:disabled="!allowUserChange"
|
|
7
|
+
:class="{ hideCounter: !showCounter, 'tabs__tab--selected': isSelected(index) }"
|
|
8
|
+
@click="changeTab(tab, index)"
|
|
9
9
|
>
|
|
10
10
|
<div
|
|
11
11
|
v-if="showCounter"
|
|
12
|
+
class="mr-2 rounded-circle d-inline-flex align-center justify-center white--text"
|
|
12
13
|
:class="{ 'is-selected': isSelected(index) }"
|
|
13
|
-
class="pl-3 pr-3 pt-2 pb-2 mr-2 rounded-circle d-inline-block white--text"
|
|
14
14
|
>
|
|
15
|
-
<
|
|
15
|
+
<farm-subtitle
|
|
16
|
+
color="white"
|
|
17
|
+
tag="span"
|
|
18
|
+
:type="2"
|
|
19
|
+
:color-variation="isSelected(index) ? 'base' : 'darken'"
|
|
20
|
+
>
|
|
21
|
+
{{ index + 1 }}
|
|
22
|
+
</farm-subtitle>
|
|
16
23
|
</div>
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
24
|
+
<farm-subtitle
|
|
25
|
+
tag="span"
|
|
26
|
+
:type="2"
|
|
27
|
+
:color="isSelected(index) ? 'primary' : 'gray'"
|
|
28
|
+
:color-variation="isSelected(index) ? 'base' : 'darken'"
|
|
29
|
+
>
|
|
30
|
+
{{ tab.name }}
|
|
31
|
+
</farm-subtitle>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
20
34
|
</template>
|
|
21
35
|
|
|
22
36
|
<script lang="ts">
|
|
23
37
|
import Vue from 'vue';
|
|
24
|
-
import { VTabs, VTab } from 'vuetify/lib/components/VTabs';
|
|
25
38
|
export default Vue.extend({
|
|
26
39
|
name: 'farm-tabs',
|
|
27
40
|
data: () => ({
|
|
@@ -59,13 +72,18 @@ export default Vue.extend({
|
|
|
59
72
|
return index === this.selected;
|
|
60
73
|
},
|
|
61
74
|
changeTab(_, index) {
|
|
75
|
+
if (!this.allowUserChange) return;
|
|
76
|
+
this.selected = index;
|
|
62
77
|
this.$emit('update', this.tabs[index]);
|
|
63
78
|
},
|
|
64
79
|
next() {
|
|
80
|
+
if (this.tabs.length - 1 > this.selected + 1)
|
|
81
|
+
return this.$emit('update', this.tabs[this.selected]);
|
|
65
82
|
this.selected = this.selected + 1;
|
|
66
83
|
this.$emit('update', this.tabs[this.selected]);
|
|
67
84
|
},
|
|
68
85
|
previous() {
|
|
86
|
+
if (this.selected - 1 < 0) return this.$emit('update', this.tabs[this.selected]);
|
|
69
87
|
this.selected = this.selected - 1;
|
|
70
88
|
this.$emit('update', this.tabs[this.selected]);
|
|
71
89
|
},
|
|
@@ -83,20 +101,8 @@ export default Vue.extend({
|
|
|
83
101
|
created() {
|
|
84
102
|
this.selected = this.initialSelect;
|
|
85
103
|
},
|
|
86
|
-
components: {
|
|
87
|
-
VTabs,
|
|
88
|
-
VTab,
|
|
89
|
-
},
|
|
90
104
|
});
|
|
91
105
|
</script>
|
|
92
106
|
<style scoped lang="scss">
|
|
93
|
-
|
|
94
|
-
background-color: var(--v-gray-lighten3);
|
|
95
|
-
&.is-selected {
|
|
96
|
-
background-color: var(--v-secondary-base);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
.v-tab--active.v-tab--disabled {
|
|
100
|
-
opacity: 1;
|
|
101
|
-
}
|
|
107
|
+
@import './Tabs.scss';
|
|
102
108
|
</style>
|
|
@@ -2,58 +2,58 @@ import { shallowMount } from '@vue/test-utils';
|
|
|
2
2
|
import Tabs from '../Tabs';
|
|
3
3
|
|
|
4
4
|
describe('Tabs component', () => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
5
|
+
let wrapper;
|
|
6
|
+
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
wrapper = shallowMount(Tabs);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
test('Created hook', () => {
|
|
12
|
+
expect(wrapper).toBeDefined();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
describe('methods', () => {
|
|
16
|
+
it('Should check isSelected', () => {
|
|
17
|
+
expect(wrapper.vm.isSelected(1)).toBeFalsy();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('Should emit event when tab is changed', () => {
|
|
21
|
+
wrapper.vm.changeTab();
|
|
22
|
+
expect(wrapper.emitted().update).toBeTruthy();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('Should emit event when next is triggeredx', () => {
|
|
26
|
+
wrapper.vm.next();
|
|
27
|
+
expect(wrapper.emitted().update).toBeTruthy();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('Should emit event when previous is triggered', () => {
|
|
31
|
+
wrapper.vm.previous();
|
|
32
|
+
expect(wrapper.emitted().update).toBeTruthy();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('Should emit event when toIndex is triggered', () => {
|
|
36
|
+
wrapper.vm.toIndex(1);
|
|
37
|
+
expect(wrapper.vm.selected).toEqual(1);
|
|
38
|
+
expect(wrapper.emitted().update).toBeTruthy();
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('Should updateTab in parent and route', () => {
|
|
42
|
+
const _component = {
|
|
43
|
+
currentTab: '',
|
|
44
|
+
$router: {
|
|
45
|
+
history: {
|
|
46
|
+
current: {
|
|
47
|
+
path: 'some',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
push: () => {},
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
const spyObj = jest.spyOn(_component.$router, 'push');
|
|
54
|
+
wrapper.vm.updateTabRouting(_component, { path: 'desembolso' }, 'nextRoutePrefix');
|
|
55
|
+
expect(_component.currentTab).toEqual('desembolso');
|
|
56
|
+
expect(spyObj).toHaveBeenCalled();
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
59
|
});
|
package/src/main.ts
CHANGED
|
@@ -6,7 +6,6 @@ import MainFilter from './components/MainFilter';
|
|
|
6
6
|
import Loader from './components/Loader';
|
|
7
7
|
import FilePicker from './components/FilePicker';
|
|
8
8
|
import MultipleFilePicker from './components/MultipleFilePicker';
|
|
9
|
-
import Tabs from './components/Tabs';
|
|
10
9
|
import DialogHeader from './components/DialogHeader';
|
|
11
10
|
import DialogFooter from './components/DialogFooter';
|
|
12
11
|
import RangeDatePicker from './components/RangeDatePicker';
|
|
@@ -32,7 +31,6 @@ export {
|
|
|
32
31
|
Loader,
|
|
33
32
|
FilePicker,
|
|
34
33
|
MultipleFilePicker,
|
|
35
|
-
Tabs,
|
|
36
34
|
DialogHeader,
|
|
37
35
|
DialogFooter,
|
|
38
36
|
RangeDatePicker,
|
|
@@ -85,6 +83,7 @@ export * from './components/RadioGroup';
|
|
|
85
83
|
export * from './components/Select';
|
|
86
84
|
export * from './components/Stepper';
|
|
87
85
|
export * from './components/Switcher';
|
|
86
|
+
export * from './components/Tabs';
|
|
88
87
|
export * from './components/TextArea';
|
|
89
88
|
export * from './components/TextField';
|
|
90
89
|
export * from './components/TextFieldV2';
|
|
@@ -2,7 +2,7 @@ $defaultLefts: 0, 4rem, 4rem;
|
|
|
2
2
|
@mixin stickytable($selector, $columns: 1, $lefts: $defaultLefts) {
|
|
3
3
|
#{$selector} {
|
|
4
4
|
tbody {
|
|
5
|
-
font-size:
|
|
5
|
+
font-size: 12px;
|
|
6
6
|
}
|
|
7
7
|
tbody tr:nth-of-type(odd) td {
|
|
8
8
|
background-color: var(--farm-neutral-lighten);
|
|
@@ -30,6 +30,11 @@ $defaultLefts: 0, 4rem, 4rem;
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
&.v-data-table > .v-data-table__wrapper > table > tbody > tr > td:first-child,
|
|
34
|
+
&.v-data-table > .v-data-table__wrapper > table > thead > tr > th:first-child {
|
|
35
|
+
padding-left: 24px;
|
|
36
|
+
}
|
|
37
|
+
|
|
33
38
|
@if $columns > 0 {
|
|
34
39
|
@for $i from 1 through $columns {
|
|
35
40
|
tr td:nth-child(#{$i}),
|
|
@@ -48,6 +53,10 @@ $defaultLefts: 0, 4rem, 4rem;
|
|
|
48
53
|
}
|
|
49
54
|
}
|
|
50
55
|
|
|
56
|
+
tr td:first-child, tr th:first-child {
|
|
57
|
+
padding-left: 24px;
|
|
58
|
+
}
|
|
59
|
+
|
|
51
60
|
.v-chip {
|
|
52
61
|
font-size: 0.75rem;
|
|
53
62
|
padding: 0 1.5rem;
|
|
@@ -81,6 +90,7 @@ $defaultLefts: 0, 4rem, 4rem;
|
|
|
81
90
|
|
|
82
91
|
th[role='columnheader']:has(> .v-data-table__checkbox) {
|
|
83
92
|
max-width: 71px !important;
|
|
93
|
+
padding-left: 24px;
|
|
84
94
|
}
|
|
85
95
|
|
|
86
96
|
.v-data-table-header tr th {
|
|
@@ -95,8 +105,15 @@ $defaultLefts: 0, 4rem, 4rem;
|
|
|
95
105
|
}
|
|
96
106
|
|
|
97
107
|
.v-data-table__checkbox .mdi {
|
|
98
|
-
margin-left:
|
|
99
|
-
font-size:
|
|
108
|
+
margin-left: 0;
|
|
109
|
+
font-size: 20px;
|
|
110
|
+
margin-left: -2px;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.v-input--selection-controls__input {
|
|
114
|
+
width: 20px;
|
|
115
|
+
height: 20px;
|
|
116
|
+
margin-right: 0 !important;
|
|
100
117
|
}
|
|
101
118
|
}
|
|
102
119
|
}
|