@farm-investimentos/front-mfe-components 2.4.3 → 2.4.7
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 +129 -107
- 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 +129 -107
- 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/CardContext/CardContext.scss +4 -0
- package/src/components/CardContext/CardContext.stories.js +10 -0
- package/src/components/CardContext/CardContext.vue +22 -3
- package/src/components/DataTableHeader/DataTableHeader.vue +1 -1
- package/src/components/DataTableHeader/__tests__/DataTableHeader.spec.js +6 -0
- package/src/components/Tabs/Tabs.vue +89 -86
package/package.json
CHANGED
|
@@ -32,6 +32,15 @@ export const WithLoading = () => ({
|
|
|
32
32
|
`,
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
+
export const WithLoadingLarge = () => ({
|
|
36
|
+
components: { CardContext },
|
|
37
|
+
template: `
|
|
38
|
+
<CardContext icon="mdi-currency-usd" title="Titulo do Card" isLoading largeLoading>
|
|
39
|
+
<p>Conteúdo do Card</p>
|
|
40
|
+
</CardContext>
|
|
41
|
+
`,
|
|
42
|
+
});
|
|
43
|
+
|
|
35
44
|
export const WithError = () => ({
|
|
36
45
|
components: { CardContext },
|
|
37
46
|
template: `
|
|
@@ -44,4 +53,5 @@ export const WithError = () => ({
|
|
|
44
53
|
Primary.storyName = 'Básico';
|
|
45
54
|
Secondary.storyName = 'Título em Bold';
|
|
46
55
|
WithLoading.storyName = 'Com Loading';
|
|
56
|
+
WithLoadingLarge.storyName = 'Com Loading Large';
|
|
47
57
|
WithError.storyName = 'Com Erro';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="
|
|
2
|
+
<div :class="isHeightFull">
|
|
3
3
|
<div class="card-context-header" v-if="isSuccess">
|
|
4
4
|
<IconBox :icon="icon" />
|
|
5
5
|
<div class="card-context-content">
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<slot></slot>
|
|
13
13
|
</div>
|
|
14
14
|
<div class="card-context-loding-or-error" v-if="isLoading">
|
|
15
|
-
<Loader size="
|
|
15
|
+
<Loader :size="isLargeLoading" />
|
|
16
16
|
</div>
|
|
17
17
|
<div class="card-context-loding-or-error" v-if="isError">
|
|
18
18
|
<AlertReload :label="errorLabel" @onClick="$emit('onLoad')" />
|
|
@@ -61,6 +61,10 @@ export default Vue.extend({
|
|
|
61
61
|
type: Boolean,
|
|
62
62
|
default: false,
|
|
63
63
|
},
|
|
64
|
+
largeLoading: {
|
|
65
|
+
type: Boolean,
|
|
66
|
+
default: false,
|
|
67
|
+
},
|
|
64
68
|
/**
|
|
65
69
|
* Show error alert
|
|
66
70
|
*/
|
|
@@ -75,8 +79,11 @@ export default Vue.extend({
|
|
|
75
79
|
type: String,
|
|
76
80
|
default: 'Ocorreu um erro',
|
|
77
81
|
},
|
|
82
|
+
full: {
|
|
83
|
+
type: Boolean,
|
|
84
|
+
default: false,
|
|
85
|
+
},
|
|
78
86
|
},
|
|
79
|
-
|
|
80
87
|
computed: {
|
|
81
88
|
isBold() {
|
|
82
89
|
if (this.bold) {
|
|
@@ -84,9 +91,21 @@ export default Vue.extend({
|
|
|
84
91
|
}
|
|
85
92
|
return 'card-context-title';
|
|
86
93
|
},
|
|
94
|
+
isHeightFull() {
|
|
95
|
+
if (this.full) {
|
|
96
|
+
return 'card-context height-full';
|
|
97
|
+
}
|
|
98
|
+
return 'card-context';
|
|
99
|
+
},
|
|
87
100
|
isSuccess() {
|
|
88
101
|
return !this.isLoading && !this.isError;
|
|
89
102
|
},
|
|
103
|
+
isLargeLoading() {
|
|
104
|
+
if (this.largeLoading) {
|
|
105
|
+
return 'normal';
|
|
106
|
+
}
|
|
107
|
+
return 'small';
|
|
108
|
+
},
|
|
90
109
|
},
|
|
91
110
|
});
|
|
92
111
|
</script>
|
|
@@ -25,6 +25,7 @@ describe('DataTableHeader component', () => {
|
|
|
25
25
|
],
|
|
26
26
|
selectedIndex: 0,
|
|
27
27
|
firstSelected: true,
|
|
28
|
+
value: false,
|
|
28
29
|
},
|
|
29
30
|
});
|
|
30
31
|
component = wrapper.vm;
|
|
@@ -85,5 +86,10 @@ describe('DataTableHeader component', () => {
|
|
|
85
86
|
await new Promise(r => setTimeout(r, 30));
|
|
86
87
|
expect(component.sortClick[1].show).toBeFalsy();
|
|
87
88
|
});
|
|
89
|
+
|
|
90
|
+
it('Should emit new value when selectAll checkbox is clicked', () => {
|
|
91
|
+
component.selectAll(true);
|
|
92
|
+
expect(wrapper.emitted().toggleSelectAll).toBeDefined();
|
|
93
|
+
});
|
|
88
94
|
});
|
|
89
95
|
});
|
|
@@ -1,97 +1,100 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
2
|
+
<v-tabs color="secondary" v-model="selected">
|
|
3
|
+
<v-tab
|
|
4
|
+
v-for="(tab, index) in tabs"
|
|
5
|
+
:key="index"
|
|
6
|
+
:class="{ hideCounter: !showCounter }"
|
|
7
|
+
@change="changeTab(tab, index)"
|
|
8
|
+
:disabled="!allowUserChange"
|
|
9
|
+
>
|
|
10
|
+
<div
|
|
11
|
+
v-if="showCounter"
|
|
12
|
+
: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
|
+
>
|
|
15
|
+
<span>{{ index + 1 }}</span>
|
|
16
|
+
</div>
|
|
17
|
+
<span class="black--text text-capitalize">{{ tab.name }}</span>
|
|
18
|
+
</v-tab>
|
|
19
|
+
</v-tabs>
|
|
20
20
|
</template>
|
|
21
21
|
|
|
22
22
|
<script>
|
|
23
23
|
import { VTabs, VTab } from 'vuetify/lib/components/VTabs';
|
|
24
24
|
export default {
|
|
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
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
25
|
+
data: () => ({
|
|
26
|
+
selected: 0,
|
|
27
|
+
}),
|
|
28
|
+
props: {
|
|
29
|
+
tabs: {
|
|
30
|
+
type: Array,
|
|
31
|
+
default: () => [
|
|
32
|
+
{
|
|
33
|
+
name: 'Seleção',
|
|
34
|
+
path: 'selection',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: 'Revisão',
|
|
38
|
+
path: 'review',
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
showCounter: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: true,
|
|
45
|
+
},
|
|
46
|
+
initialSelect: {
|
|
47
|
+
type: Number,
|
|
48
|
+
default: 0,
|
|
49
|
+
},
|
|
50
|
+
allowUserChange: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: true,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
methods: {
|
|
56
|
+
isSelected(index) {
|
|
57
|
+
return index === this.selected;
|
|
58
|
+
},
|
|
59
|
+
changeTab(_, index) {
|
|
60
|
+
this.$emit('update', this.tabs[index]);
|
|
61
|
+
},
|
|
62
|
+
next() {
|
|
63
|
+
this.selected = this.selected + 1;
|
|
64
|
+
this.$emit('update', this.tabs[this.selected]);
|
|
65
|
+
},
|
|
66
|
+
previous() {
|
|
67
|
+
this.selected = this.selected - 1;
|
|
68
|
+
this.$emit('update', this.tabs[this.selected]);
|
|
69
|
+
},
|
|
70
|
+
toIndex(index) {
|
|
71
|
+
this.selected = index;
|
|
72
|
+
this.$emit('update', this.tabs[index]);
|
|
73
|
+
},
|
|
74
|
+
updateTabRouting: (component, item, nextRoutePrefix) => {
|
|
75
|
+
component.currentTab = item.path;
|
|
76
|
+
const nextRoute = `${nextRoutePrefix}/${item.path}`;
|
|
77
|
+
const currentRoute = component.$router.history.current.path;
|
|
78
|
+
if (nextRoute !== currentRoute) component.$router.push(nextRoute);
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
created() {
|
|
82
|
+
this.selected = this.initialSelect;
|
|
83
|
+
},
|
|
84
|
+
components: {
|
|
85
|
+
VTabs,
|
|
86
|
+
VTab,
|
|
87
|
+
},
|
|
88
88
|
};
|
|
89
89
|
</script>
|
|
90
90
|
<style scoped lang="scss">
|
|
91
91
|
div.rounded-circle {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
92
|
+
background-color: var(--v-gray-lighten3);
|
|
93
|
+
&.is-selected {
|
|
94
|
+
background-color: var(--v-secondary-base);
|
|
95
|
+
}
|
|
96
96
|
}
|
|
97
|
-
|
|
97
|
+
.v-tab--active.v-tab--disabled {
|
|
98
|
+
opacity: 1;
|
|
99
|
+
}
|
|
100
|
+
</style>
|