@farm-investimentos/front-mfe-components 14.2.1 → 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 +5243 -6577
- 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 +5243 -6577
- 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/DatePicker/DatePicker.vue +2 -3
- package/src/components/DatePicker/__tests__/DatePicker.spec.js +1 -1
- 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 +5 -1
|
@@ -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);
|
|
@@ -53,6 +53,10 @@ $defaultLefts: 0, 4rem, 4rem;
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
tr td:first-child, tr th:first-child {
|
|
57
|
+
padding-left: 24px;
|
|
58
|
+
}
|
|
59
|
+
|
|
56
60
|
.v-chip {
|
|
57
61
|
font-size: 0.75rem;
|
|
58
62
|
padding: 0 1.5rem;
|