@farm-investimentos/front-mfe-components 15.14.9 → 15.14.11
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 +215 -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 +215 -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/GanttChart/GanttChart.scss +1 -3
- package/src/components/TableContextMenu/TableContextMenu.stories.js +1 -1
- package/src/components/Tabs/Tabs.scss +61 -0
- package/src/components/Tabs/Tabs.stories.js +32 -0
- package/src/components/Tabs/Tabs.vue +95 -29
package/package.json
CHANGED
|
@@ -105,15 +105,13 @@
|
|
|
105
105
|
padding: gutter('xs') 0;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
|
|
109
|
-
|
|
110
108
|
&__bar {
|
|
111
109
|
height: 30px;
|
|
112
110
|
z-index: 2;
|
|
113
111
|
border-radius: 4px;
|
|
114
112
|
display: flex;
|
|
115
113
|
align-items: center;
|
|
116
|
-
justify-content: start;
|
|
114
|
+
justify-content: flex-start;
|
|
117
115
|
color: white;
|
|
118
116
|
font-size: fontSize('sm');
|
|
119
117
|
padding: 0 gutter('sm');
|
|
@@ -86,7 +86,7 @@ export const OnRightSide = () => ({
|
|
|
86
86
|
],
|
|
87
87
|
};
|
|
88
88
|
},
|
|
89
|
-
template: `<div style="padding-left: 80px; display: flex; justify-content: end;">
|
|
89
|
+
template: `<div style="padding-left: 80px; display: flex; justify-content: flex-end;">
|
|
90
90
|
<farm-context-menu ref="multi" :items="items" />
|
|
91
91
|
</div>`,
|
|
92
92
|
});
|
|
@@ -1,11 +1,71 @@
|
|
|
1
1
|
@import '../../configurations/theme-colors';
|
|
2
2
|
|
|
3
|
+
.farm-tabs-wrapper {
|
|
4
|
+
position: relative;
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
width: 100%;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.farm-tabs-nav {
|
|
11
|
+
position: absolute;
|
|
12
|
+
top: 50%;
|
|
13
|
+
transform: translateY(-50%);
|
|
14
|
+
z-index: 10;
|
|
15
|
+
width: 24px;
|
|
16
|
+
height: 24px;
|
|
17
|
+
border-radius: 50%;
|
|
18
|
+
border: none;
|
|
19
|
+
background-color: white;
|
|
20
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
|
21
|
+
cursor: pointer;
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
justify-content: center;
|
|
25
|
+
transition: all 0.3s ease;
|
|
26
|
+
padding: 0;
|
|
27
|
+
|
|
28
|
+
.farm-icon {
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
justify-content: center;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&:hover {
|
|
35
|
+
background-color: var(--farm-primary-base);
|
|
36
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
|
|
37
|
+
|
|
38
|
+
.farm-icon {
|
|
39
|
+
color: white !important;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&--left {
|
|
44
|
+
left: 8px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&--right {
|
|
48
|
+
right: 8px;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
3
52
|
.farm-tabs {
|
|
4
53
|
width: 100%;
|
|
54
|
+
overflow-x: auto;
|
|
55
|
+
overflow-y: hidden;
|
|
56
|
+
scroll-behavior: smooth;
|
|
57
|
+
|
|
58
|
+
scrollbar-width: none; // Firefox
|
|
59
|
+
-ms-overflow-style: none; // IE/Edge
|
|
60
|
+
|
|
61
|
+
&::-webkit-scrollbar {
|
|
62
|
+
display: none; // Chrome/Safari/Opera
|
|
63
|
+
}
|
|
5
64
|
}
|
|
6
65
|
.tabs {
|
|
7
66
|
display: flex;
|
|
8
67
|
margin-bottom: -1px;
|
|
68
|
+
min-width: min-content;
|
|
9
69
|
|
|
10
70
|
&__tab {
|
|
11
71
|
border-bottom: 1px solid var(--farm-primary-lighten);
|
|
@@ -14,6 +74,7 @@
|
|
|
14
74
|
padding: 18px 24px 14px;
|
|
15
75
|
height: 54px;
|
|
16
76
|
transition: all 0.5s ease;
|
|
77
|
+
white-space: nowrap;
|
|
17
78
|
&:hover {
|
|
18
79
|
background-color: transparentize(themeColor('primary', 'base'), 0.86);
|
|
19
80
|
|
|
@@ -66,3 +66,35 @@ export const Disabled = () => ({
|
|
|
66
66
|
<p class="mt-2">selected: {{v}}</p>
|
|
67
67
|
</div>`,
|
|
68
68
|
});
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
export const TabScroll = () => ({
|
|
72
|
+
data() {
|
|
73
|
+
return {
|
|
74
|
+
v: 'TESTE NOME GRANDE',
|
|
75
|
+
tabs: [
|
|
76
|
+
{name: 'TESTE NOME GRANDE', counter: 10, path: 'selecao'},
|
|
77
|
+
{name: 'Opções', counter: 5, path: 'opcoes'},
|
|
78
|
+
{name: 'Configurações', counter: 2, path: 'configuracoes'},
|
|
79
|
+
{name: 'Detalhes', counter: 8, path: 'detalhes'},
|
|
80
|
+
{name: 'Avançado', counter: 1, path: 'avancado'},
|
|
81
|
+
{name: 'Extras', counter: 0, path: 'extras'},
|
|
82
|
+
{name: 'Personalizado', counter: 4, path: 'personalizado'},
|
|
83
|
+
{name: 'Final', counter: 3, path: 'final'},
|
|
84
|
+
{name: 'Resumo', counter: 6, path: 'resumo'},
|
|
85
|
+
],
|
|
86
|
+
};
|
|
87
|
+
},
|
|
88
|
+
methods: {
|
|
89
|
+
updateValue(value) {
|
|
90
|
+
this.v = value.name;
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
template: `<div>
|
|
94
|
+
<farm-tabs :tabs="tabs" :showCounter="true" @update="updateValue" />
|
|
95
|
+
<div class="mt-4 pa-4" style="background-color: #f5f5f5; border-radius: 8px;">
|
|
96
|
+
<h3>Conteúdo da Tab: {{v}}</h3>
|
|
97
|
+
<p class="mt-2">Este é o conteúdo da tab selecionada.</p>
|
|
98
|
+
</div>
|
|
99
|
+
</div>`,
|
|
100
|
+
});
|
|
@@ -1,44 +1,66 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="farm-tabs">
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
>
|
|
2
|
+
<div class="farm-tabs-wrapper">
|
|
3
|
+
<button
|
|
4
|
+
class="farm-tabs-nav farm-tabs-nav--left"
|
|
5
|
+
@click="scrollLeft"
|
|
6
|
+
@mouseenter="hoverLeft = true"
|
|
7
|
+
@mouseleave="hoverLeft = false"
|
|
8
|
+
v-show="canScrollLeft || hoverLeft"
|
|
9
|
+
>
|
|
10
|
+
<farm-icon color="primary" size="24px">chevron-left</farm-icon>
|
|
11
|
+
</button>
|
|
12
|
+
|
|
13
|
+
<div class="farm-tabs" ref="tabsContainer">
|
|
14
|
+
<div class="tabs" :class="{ 'tabs--disabled': !allowUserChange }">
|
|
11
15
|
<div
|
|
12
|
-
v-
|
|
13
|
-
class="
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
align-center
|
|
18
|
-
justify-center
|
|
19
|
-
white--text
|
|
20
|
-
"
|
|
21
|
-
:class="{ 'is-selected': isSelected(index) }"
|
|
16
|
+
v-for="(tab, index) in tabs"
|
|
17
|
+
class="tabs__tab"
|
|
18
|
+
:key="index"
|
|
19
|
+
:class="{ hideCounter: !showCounter, 'tabs__tab--selected': isSelected(index) }"
|
|
20
|
+
@click="changeTab(tab, index)"
|
|
22
21
|
>
|
|
22
|
+
<div
|
|
23
|
+
v-if="showCounter"
|
|
24
|
+
class="
|
|
25
|
+
mr-2
|
|
26
|
+
rounded-circle
|
|
27
|
+
d-inline-flex
|
|
28
|
+
align-center
|
|
29
|
+
justify-center
|
|
30
|
+
white--text
|
|
31
|
+
"
|
|
32
|
+
:class="{ 'is-selected': isSelected(index) }"
|
|
33
|
+
>
|
|
34
|
+
<farm-subtitle
|
|
35
|
+
color="white"
|
|
36
|
+
tag="span"
|
|
37
|
+
:type="2"
|
|
38
|
+
:color-variation="isSelected(index) ? 'base' : 'darken'"
|
|
39
|
+
>
|
|
40
|
+
{{ index + 1 }}
|
|
41
|
+
</farm-subtitle>
|
|
42
|
+
</div>
|
|
23
43
|
<farm-subtitle
|
|
24
|
-
color="white"
|
|
25
44
|
tag="span"
|
|
26
45
|
:type="2"
|
|
46
|
+
:color="isSelected(index) ? 'primary' : 'gray'"
|
|
27
47
|
:color-variation="isSelected(index) ? 'base' : 'darken'"
|
|
28
48
|
>
|
|
29
|
-
{{
|
|
49
|
+
{{ forceUppercase ? tab.name.toUpperCase() : tab.name }}
|
|
30
50
|
</farm-subtitle>
|
|
31
51
|
</div>
|
|
32
|
-
<farm-subtitle
|
|
33
|
-
tag="span"
|
|
34
|
-
:type="2"
|
|
35
|
-
:color="isSelected(index) ? 'primary' : 'gray'"
|
|
36
|
-
:color-variation="isSelected(index) ? 'base' : 'darken'"
|
|
37
|
-
>
|
|
38
|
-
{{ forceUppercase ? tab.name.toUpperCase() : tab.name }}
|
|
39
|
-
</farm-subtitle>
|
|
40
52
|
</div>
|
|
41
53
|
</div>
|
|
54
|
+
|
|
55
|
+
<button
|
|
56
|
+
class="farm-tabs-nav farm-tabs-nav--right"
|
|
57
|
+
@click="scrollRight"
|
|
58
|
+
@mouseenter="hoverRight = true"
|
|
59
|
+
@mouseleave="hoverRight = false"
|
|
60
|
+
v-show="canScrollRight || hoverRight"
|
|
61
|
+
>
|
|
62
|
+
<farm-icon color="primary" size="24px">chevron-right</farm-icon>
|
|
63
|
+
</button>
|
|
42
64
|
</div>
|
|
43
65
|
</template>
|
|
44
66
|
|
|
@@ -50,6 +72,10 @@ export default defineComponent({
|
|
|
50
72
|
data() {
|
|
51
73
|
return {
|
|
52
74
|
selected: 0,
|
|
75
|
+
canScrollLeft: false,
|
|
76
|
+
canScrollRight: false,
|
|
77
|
+
hoverLeft: false,
|
|
78
|
+
hoverRight: false,
|
|
53
79
|
};
|
|
54
80
|
},
|
|
55
81
|
props: {
|
|
@@ -98,6 +124,29 @@ export default defineComponent({
|
|
|
98
124
|
this.selected = index;
|
|
99
125
|
this.$emit('update', this.tabs[index]);
|
|
100
126
|
},
|
|
127
|
+
scrollLeft() {
|
|
128
|
+
const container = this.$refs.tabsContainer as HTMLElement;
|
|
129
|
+
if (container) {
|
|
130
|
+
container.scrollBy({ left: -200, behavior: 'smooth' });
|
|
131
|
+
setTimeout(() => this.updateScrollButtons(), 100);
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
scrollRight() {
|
|
135
|
+
const container = this.$refs.tabsContainer as HTMLElement;
|
|
136
|
+
if (container) {
|
|
137
|
+
container.scrollBy({ left: 200, behavior: 'smooth' });
|
|
138
|
+
setTimeout(() => this.updateScrollButtons(), 100);
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
updateScrollButtons() {
|
|
142
|
+
const container = this.$refs.tabsContainer as HTMLElement;
|
|
143
|
+
if (container) {
|
|
144
|
+
const { scrollLeft, scrollWidth, clientWidth } = container;
|
|
145
|
+
|
|
146
|
+
this.canScrollLeft = scrollLeft > 0;
|
|
147
|
+
this.canScrollRight = scrollLeft < scrollWidth - clientWidth - 1;
|
|
148
|
+
}
|
|
149
|
+
},
|
|
101
150
|
next() {
|
|
102
151
|
if (this.tabs.length - 1 > this.selected + 1)
|
|
103
152
|
return this.$emit('update', this.tabs[this.selected]);
|
|
@@ -123,6 +172,23 @@ export default defineComponent({
|
|
|
123
172
|
created() {
|
|
124
173
|
this.selected = this.initialSelect;
|
|
125
174
|
},
|
|
175
|
+
mounted() {
|
|
176
|
+
this.updateScrollButtons();
|
|
177
|
+
window.addEventListener('resize', this.updateScrollButtons);
|
|
178
|
+
|
|
179
|
+
const container = this.$refs.tabsContainer as HTMLElement;
|
|
180
|
+
if (container) {
|
|
181
|
+
container.addEventListener('scroll', this.updateScrollButtons);
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
beforeUnmount() {
|
|
185
|
+
window.removeEventListener('resize', this.updateScrollButtons);
|
|
186
|
+
|
|
187
|
+
const container = this.$refs.tabsContainer as HTMLElement;
|
|
188
|
+
if (container) {
|
|
189
|
+
container.removeEventListener('scroll', this.updateScrollButtons);
|
|
190
|
+
}
|
|
191
|
+
},
|
|
126
192
|
});
|
|
127
193
|
</script>
|
|
128
194
|
<style scoped lang="scss">
|