@farm-investimentos/front-mfe-components 15.12.1 → 15.13.1
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 +4483 -90
- 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 +4483 -90
- 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 +2 -1
- package/src/components/GanttChart/GanttChart.scss +223 -0
- package/src/components/GanttChart/GanttChart.stories.js +480 -0
- package/src/components/GanttChart/GanttChart.vue +308 -0
- package/src/components/GanttChart/__tests__/GanttChart.spec.js +561 -0
- package/src/components/GanttChart/composition/buildBarPositioning.ts +145 -0
- package/src/components/GanttChart/composition/buildGanttData.ts +61 -0
- package/src/components/GanttChart/composition/index.ts +2 -0
- package/src/components/GanttChart/index.ts +4 -0
- package/src/components/GanttChart/types/index.ts +60 -0
- package/src/components/GanttChart/utils/dateUtils.ts +98 -0
- package/src/main.ts +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farm-investimentos/front-mfe-components",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.13.1",
|
|
4
4
|
"author": "farm investimentos",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "./dist/front-mfe-components.common.js",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"core-js": "^3.6.5",
|
|
26
|
+
"date-fns": "2.29.3",
|
|
26
27
|
"vue": "2.7.10",
|
|
27
28
|
"vuetify": "^2.4.5"
|
|
28
29
|
},
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
@import '../../configurations/mixins';
|
|
2
|
+
@import '../../configurations/variables';
|
|
3
|
+
@import '../../configurations/functions';
|
|
4
|
+
@import '../../configurations/_theme-colors';
|
|
5
|
+
@import '../Tooltip/Tooltip.scss';
|
|
6
|
+
|
|
7
|
+
.farm-gantt-chart {
|
|
8
|
+
width: 100%;
|
|
9
|
+
min-height: 500px;
|
|
10
|
+
position: relative;
|
|
11
|
+
overflow-x: auto;
|
|
12
|
+
overflow-y: visible;
|
|
13
|
+
|
|
14
|
+
&__header {
|
|
15
|
+
display: flex;
|
|
16
|
+
width: fit-content;
|
|
17
|
+
min-width: 100%;
|
|
18
|
+
margin-bottom: gutter('sm');
|
|
19
|
+
position: relative;
|
|
20
|
+
z-index: 2;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&__row-label-space {
|
|
24
|
+
width: 180px;
|
|
25
|
+
min-width: 180px;
|
|
26
|
+
flex-shrink: 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&__timeline {
|
|
30
|
+
display: grid;
|
|
31
|
+
flex-grow: 1;
|
|
32
|
+
gap: 0;
|
|
33
|
+
min-height: 40px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&__month-header {
|
|
37
|
+
display: flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
justify-content: flex-start;
|
|
40
|
+
padding-right: 8px;
|
|
41
|
+
height: fit-content;
|
|
42
|
+
position: relative;
|
|
43
|
+
min-width: 0;
|
|
44
|
+
|
|
45
|
+
.farm-typography {
|
|
46
|
+
white-space: nowrap;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&::after {
|
|
50
|
+
content: '';
|
|
51
|
+
position: absolute;
|
|
52
|
+
left: 0;
|
|
53
|
+
top: 100%;
|
|
54
|
+
width: 1px;
|
|
55
|
+
height: calc(var(--gantt-content-height, 300px) + 30px);
|
|
56
|
+
border-left: 1px dashed var(--farm-stroke-base);
|
|
57
|
+
pointer-events: none;
|
|
58
|
+
z-index: 1;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&--current {
|
|
62
|
+
&::after {
|
|
63
|
+
border-left-color: var(--farm-primary-base);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&__content {
|
|
69
|
+
position: relative;
|
|
70
|
+
width: fit-content;
|
|
71
|
+
min-width: 100%;
|
|
72
|
+
display: flex;
|
|
73
|
+
flex-direction: column;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&__group {
|
|
77
|
+
display: flex;
|
|
78
|
+
width: 100%;
|
|
79
|
+
margin-bottom: gutter('lg');
|
|
80
|
+
min-height: 60px;
|
|
81
|
+
position: relative;
|
|
82
|
+
border-bottom: 1px dashed var(--farm-stroke-base);
|
|
83
|
+
padding-bottom: gutter('sm');
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&__group-label {
|
|
87
|
+
width: 180px;
|
|
88
|
+
min-width: 180px;
|
|
89
|
+
flex-shrink: 0;
|
|
90
|
+
padding: gutter('sm') gutter('sm') gutter('sm') 0;
|
|
91
|
+
font-weight: 500;
|
|
92
|
+
color: var(--farm-text-base);
|
|
93
|
+
align-self: center;
|
|
94
|
+
overflow-wrap: break-word;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
&__group-timeline {
|
|
98
|
+
flex-grow: 1;
|
|
99
|
+
display: grid;
|
|
100
|
+
position: relative;
|
|
101
|
+
min-height: 60px;
|
|
102
|
+
gap: 0;
|
|
103
|
+
grid-auto-rows: 35px;
|
|
104
|
+
align-content: start;
|
|
105
|
+
padding: gutter('xs') 0;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
&__bar {
|
|
111
|
+
height: 30px;
|
|
112
|
+
z-index: 2;
|
|
113
|
+
border-radius: 4px;
|
|
114
|
+
display: flex;
|
|
115
|
+
align-items: center;
|
|
116
|
+
justify-content: start;
|
|
117
|
+
color: white;
|
|
118
|
+
font-size: fontSize('sm');
|
|
119
|
+
padding: 0 gutter('sm');
|
|
120
|
+
@include ellipsis;
|
|
121
|
+
cursor: pointer;
|
|
122
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
|
|
123
|
+
transition: box-shadow 0.2s ease, transform 0.2s ease;
|
|
124
|
+
margin: gutter('xs') / 2;
|
|
125
|
+
|
|
126
|
+
&:hover {
|
|
127
|
+
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16);
|
|
128
|
+
transform: translateY(-2px);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
&__legend {
|
|
134
|
+
display: flex;
|
|
135
|
+
align-items: center;
|
|
136
|
+
margin-top: gutter('lg');
|
|
137
|
+
padding-top: gutter('sm');
|
|
138
|
+
flex-wrap: wrap;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
&__legend-title {
|
|
142
|
+
margin-right: gutter('md');
|
|
143
|
+
display: flex;
|
|
144
|
+
align-items: center;
|
|
145
|
+
position: relative;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
&__legend-item {
|
|
149
|
+
display: flex;
|
|
150
|
+
align-items: center;
|
|
151
|
+
margin-bottom: gutter('xs');
|
|
152
|
+
position: relative;
|
|
153
|
+
padding: 0 12px;
|
|
154
|
+
flex-shrink: 0;
|
|
155
|
+
white-space: nowrap;
|
|
156
|
+
|
|
157
|
+
&:not(:last-child)::after {
|
|
158
|
+
content: '';
|
|
159
|
+
position: absolute;
|
|
160
|
+
right: 0;
|
|
161
|
+
top: 50%;
|
|
162
|
+
transform: translateY(-50%);
|
|
163
|
+
height: 12px;
|
|
164
|
+
width: 1px;
|
|
165
|
+
background-color: var(--farm-stroke-base);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
&__legend-color {
|
|
170
|
+
width: 8px;
|
|
171
|
+
height: 8px;
|
|
172
|
+
border-radius: 50%;
|
|
173
|
+
margin-right: gutter('sm');
|
|
174
|
+
flex-shrink: 0;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
&__legend-label {
|
|
178
|
+
display: flex;
|
|
179
|
+
align-items: center;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
&__tooltip-container {
|
|
183
|
+
position: absolute;
|
|
184
|
+
z-index: 999;
|
|
185
|
+
pointer-events: none;
|
|
186
|
+
top: 0;
|
|
187
|
+
left: 0;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
&__tooltip {
|
|
191
|
+
@extend .farm-tooltip__popup;
|
|
192
|
+
@extend .farm-tooltip__popup--visible;
|
|
193
|
+
@extend .farm-tooltip__popup--fluid;
|
|
194
|
+
|
|
195
|
+
pointer-events: auto;
|
|
196
|
+
position: relative;
|
|
197
|
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
|
198
|
+
|
|
199
|
+
width: auto !important;
|
|
200
|
+
max-width: 400px !important;
|
|
201
|
+
|
|
202
|
+
.farm-tooltip__content {
|
|
203
|
+
white-space: nowrap;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.tooltip-data-row {
|
|
207
|
+
display: flex;
|
|
208
|
+
justify-content: flex-start;
|
|
209
|
+
align-items: center;
|
|
210
|
+
margin-bottom: 4px;
|
|
211
|
+
|
|
212
|
+
&:last-child {
|
|
213
|
+
margin-bottom: 0;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.tooltip-text {
|
|
218
|
+
font-weight: 500;
|
|
219
|
+
color: #ffffff;
|
|
220
|
+
white-space: nowrap;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
@@ -0,0 +1,480 @@
|
|
|
1
|
+
import { withDesign } from 'storybook-addon-designs';
|
|
2
|
+
import GanttChart from './GanttChart.vue';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Display/GanttChart',
|
|
6
|
+
component: GanttChart,
|
|
7
|
+
decorators: [withDesign],
|
|
8
|
+
parameters: {
|
|
9
|
+
docs: {
|
|
10
|
+
description: {
|
|
11
|
+
component: `Gantt Chart - Componente para visualização de cronogramas com cálculo automático de datas e legenda<br />
|
|
12
|
+
selector: <em>farm-gantt-chart</em><br />
|
|
13
|
+
<span style="color: var(--farm-primary-base);">ready for use</span>
|
|
14
|
+
|
|
15
|
+
`,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
viewMode: 'docs',
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const Primary = () => ({
|
|
23
|
+
data() {
|
|
24
|
+
return {
|
|
25
|
+
ganttData: {
|
|
26
|
+
groups: [
|
|
27
|
+
{
|
|
28
|
+
title: 'Campanha Safrinha 25',
|
|
29
|
+
bars: [
|
|
30
|
+
{
|
|
31
|
+
id: 1,
|
|
32
|
+
label: 'Vigência da Campanha',
|
|
33
|
+
start: new Date(2025, 0, 1),
|
|
34
|
+
end: new Date(2025, 5, 15),
|
|
35
|
+
color: '#7BC4F7',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: 2,
|
|
39
|
+
label: 'Vigência do Produto Comercial',
|
|
40
|
+
start: new Date(2025, 0, 15),
|
|
41
|
+
end: new Date(2025, 4, 15),
|
|
42
|
+
color: '#8BB455',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: 3,
|
|
46
|
+
label: 'Período de Desembolso',
|
|
47
|
+
start: new Date(2025, 2, 1),
|
|
48
|
+
end: new Date(2025, 4, 30),
|
|
49
|
+
color: '#FFB84D',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: 4,
|
|
53
|
+
label: 'Intervalo Vencimento',
|
|
54
|
+
start: new Date(2025, 3, 1),
|
|
55
|
+
end: new Date(2025, 4, 15),
|
|
56
|
+
color: '#F7857F',
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
title: 'Campanha Safra 25',
|
|
62
|
+
bars: [
|
|
63
|
+
{
|
|
64
|
+
id: 5,
|
|
65
|
+
label: 'Vigência da Campanha',
|
|
66
|
+
start: new Date(2025, 4, 1),
|
|
67
|
+
end: new Date(2025, 11, 31),
|
|
68
|
+
color: '#7BC4F7',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
id: 6,
|
|
72
|
+
label: 'Vigência do Produto Comercial',
|
|
73
|
+
start: new Date(2025, 4, 15),
|
|
74
|
+
end: new Date(2025, 10, 15),
|
|
75
|
+
color: '#8BB455',
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
id: 7,
|
|
79
|
+
label: 'Período de Desembolso',
|
|
80
|
+
start: new Date(2025, 5, 1),
|
|
81
|
+
end: new Date(2025, 7, 30),
|
|
82
|
+
color: '#FFB84D',
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
id: 8,
|
|
86
|
+
label: 'Intervalo Vencimento',
|
|
87
|
+
start: new Date(2025, 6, 1),
|
|
88
|
+
end: new Date(2025, 11, 15),
|
|
89
|
+
color: '#F7857F',
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
},
|
|
97
|
+
template: `<div style="width: 100%; height: 600px; padding: 20px;">
|
|
98
|
+
<farm-gantt-chart :data="ganttData" />
|
|
99
|
+
</div>`,
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
export const SingleGroup = () => ({
|
|
103
|
+
data() {
|
|
104
|
+
return {
|
|
105
|
+
ganttData: {
|
|
106
|
+
groups: [
|
|
107
|
+
{
|
|
108
|
+
title: 'Projeto de Desenvolvimento de Novos Módulos e Integrações do Sistema',
|
|
109
|
+
bars: [
|
|
110
|
+
{
|
|
111
|
+
id: 1,
|
|
112
|
+
label: 'Planejamento',
|
|
113
|
+
start: new Date(2025, 0, 1),
|
|
114
|
+
end: new Date(2025, 1, 28),
|
|
115
|
+
color: '#7BC4F7',
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
id: 2,
|
|
119
|
+
label: 'Desenvolvimento',
|
|
120
|
+
start: new Date(2025, 2, 1),
|
|
121
|
+
end: new Date(2025, 7, 31),
|
|
122
|
+
color: '#8BB455',
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
id: 3,
|
|
126
|
+
label: 'Testes',
|
|
127
|
+
start: new Date(2025, 7, 1),
|
|
128
|
+
end: new Date(2025, 8, 30),
|
|
129
|
+
color: '#FFB84D',
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
id: 4,
|
|
133
|
+
label: 'Deploy',
|
|
134
|
+
start: new Date(2025, 9, 1),
|
|
135
|
+
end: new Date(2025, 9, 15),
|
|
136
|
+
color: '#F7857F',
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
},
|
|
140
|
+
],
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
},
|
|
144
|
+
template: `<div style="width: 100%; height: 300px; padding: 20px;">
|
|
145
|
+
<farm-gantt-chart :data="ganttData" />
|
|
146
|
+
</div>`,
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
export const MultipleProjects = () => ({
|
|
150
|
+
data() {
|
|
151
|
+
return {
|
|
152
|
+
ganttData: {
|
|
153
|
+
groups: [
|
|
154
|
+
{
|
|
155
|
+
title: 'Frontend',
|
|
156
|
+
bars: [
|
|
157
|
+
{
|
|
158
|
+
id: 'fe-1',
|
|
159
|
+
label: 'Design UI/UX',
|
|
160
|
+
start: new Date(2025, 0, 1),
|
|
161
|
+
end: new Date(2025, 1, 15),
|
|
162
|
+
color: '#8E44AD',
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
id: 'fe-2',
|
|
166
|
+
label: 'Desenvolvimento',
|
|
167
|
+
start: new Date(2025, 1, 1),
|
|
168
|
+
end: new Date(2025, 3, 30),
|
|
169
|
+
color: '#16A085',
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
id: 'fe-3',
|
|
173
|
+
label: 'Testes Integração',
|
|
174
|
+
start: new Date(2025, 3, 15),
|
|
175
|
+
end: new Date(2025, 4, 30),
|
|
176
|
+
color: '#D35400',
|
|
177
|
+
},
|
|
178
|
+
],
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
title: 'Backend',
|
|
182
|
+
bars: [
|
|
183
|
+
{
|
|
184
|
+
id: 'be-1',
|
|
185
|
+
label: 'Design API',
|
|
186
|
+
start: new Date(2025, 0, 15),
|
|
187
|
+
end: new Date(2025, 2, 1),
|
|
188
|
+
color: '#2980B9',
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
id: 'be-2',
|
|
192
|
+
label: 'Setup Banco',
|
|
193
|
+
start: new Date(2025, 1, 15),
|
|
194
|
+
end: new Date(2025, 2, 30),
|
|
195
|
+
color: '#8E44AD',
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
id: 'be-3',
|
|
199
|
+
label: 'Implementação',
|
|
200
|
+
start: new Date(2025, 2, 15),
|
|
201
|
+
end: new Date(2025, 4, 15),
|
|
202
|
+
color: '#16A085',
|
|
203
|
+
},
|
|
204
|
+
],
|
|
205
|
+
},
|
|
206
|
+
],
|
|
207
|
+
},
|
|
208
|
+
};
|
|
209
|
+
},
|
|
210
|
+
template: `<div style="width: 100%; height: 400px; padding: 20px;">
|
|
211
|
+
<farm-gantt-chart :data="ganttData" />
|
|
212
|
+
</div>`,
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
export const WithStructuredTooltip = () => ({
|
|
216
|
+
data() {
|
|
217
|
+
return {
|
|
218
|
+
ganttData: {
|
|
219
|
+
groups: [
|
|
220
|
+
{
|
|
221
|
+
title: 'Campanha com Dados Detalhados',
|
|
222
|
+
bars: [
|
|
223
|
+
{
|
|
224
|
+
id: 1,
|
|
225
|
+
label: 'Vigência da Campanha',
|
|
226
|
+
start: new Date(2025, 0, 1),
|
|
227
|
+
end: new Date(2025, 5, 15),
|
|
228
|
+
color: '#7BC4F7',
|
|
229
|
+
tooltipData: {
|
|
230
|
+
'Taxa': '1,75%',
|
|
231
|
+
'Vigência Campanha': '01/01/2025 a 15/06/2025',
|
|
232
|
+
'Vigência Produto Comercial': '15/01/2025 a 15/05/2025',
|
|
233
|
+
'Desembolso Operação': '01/03/2025 a 30/05/2025',
|
|
234
|
+
'Vencimento': '01/04/2025 a 15/05/2025'
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
id: 2,
|
|
239
|
+
label: 'Produto Comercial',
|
|
240
|
+
start: new Date(2025, 0, 15),
|
|
241
|
+
end: new Date(2025, 4, 15),
|
|
242
|
+
color: '#8BB455',
|
|
243
|
+
tooltipData: {
|
|
244
|
+
'Taxa': '2,25%',
|
|
245
|
+
'Vigência': '15/01/2025 a 15/05/2025',
|
|
246
|
+
'Status': 'Aprovado'
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
]
|
|
250
|
+
}
|
|
251
|
+
]
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
},
|
|
255
|
+
template: `<div style="width: 100%; height: 400px; padding: 20px;">
|
|
256
|
+
<farm-gantt-chart :data="ganttData" />
|
|
257
|
+
</div>`,
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
export const WithCustomTooltip = () => ({
|
|
261
|
+
data() {
|
|
262
|
+
return {
|
|
263
|
+
ganttData: {
|
|
264
|
+
groups: [
|
|
265
|
+
{
|
|
266
|
+
title: 'Projeto Customizado',
|
|
267
|
+
bars: [
|
|
268
|
+
{
|
|
269
|
+
id: 1,
|
|
270
|
+
label: 'Fase Complexa',
|
|
271
|
+
start: new Date(2025, 0, 1),
|
|
272
|
+
end: new Date(2025, 3, 15),
|
|
273
|
+
color: '#8BB455',
|
|
274
|
+
tooltipData: {
|
|
275
|
+
'Orçamento': 'R$ 125.000',
|
|
276
|
+
'Equipe': '8 pessoas'
|
|
277
|
+
},
|
|
278
|
+
gerente: 'João Silva',
|
|
279
|
+
nivelRisco: 'Médio',
|
|
280
|
+
progresso: 0.65
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
id: 2,
|
|
284
|
+
label: 'Campanha Marketing',
|
|
285
|
+
start: new Date(2025, 1, 15),
|
|
286
|
+
end: new Date(2025, 4, 30),
|
|
287
|
+
color: '#FFB84D',
|
|
288
|
+
tooltipData: {
|
|
289
|
+
'Investimento': 'R$ 85.000',
|
|
290
|
+
'Público-alvo': '25-45 anos'
|
|
291
|
+
},
|
|
292
|
+
gerente: 'Maria Santos',
|
|
293
|
+
nivelRisco: 'Baixo',
|
|
294
|
+
progresso: 0.45
|
|
295
|
+
}
|
|
296
|
+
]
|
|
297
|
+
}
|
|
298
|
+
]
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
},
|
|
302
|
+
methods: {
|
|
303
|
+
formatarProgresso(taxa) {
|
|
304
|
+
return `${Math.round(taxa * 100)}%`;
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
template: `<div style="width: 100%; height: 400px; padding: 20px;">
|
|
308
|
+
<farm-gantt-chart :data="ganttData">
|
|
309
|
+
<template #tooltip="{ bar, tooltipData }">
|
|
310
|
+
<div style="padding: 12px; color: white;">
|
|
311
|
+
<div style="display: flex; align-items: center; margin-bottom: 8px;">
|
|
312
|
+
<strong>{{ bar.label }}</strong>
|
|
313
|
+
<span style="margin-left: auto; background: rgba(255,255,255,0.2); padding: 2px 6px; border-radius: 10px; font-size: 11px;">
|
|
314
|
+
ID: {{ bar.id }}
|
|
315
|
+
</span>
|
|
316
|
+
</div>
|
|
317
|
+
|
|
318
|
+
<div v-if="tooltipData" style="margin-bottom: 8px;">
|
|
319
|
+
<div v-for="(value, key) in tooltipData" :key="key" style="display: flex; justify-content: space-between; margin-bottom: 4px;">
|
|
320
|
+
<span style="opacity: 0.9;">{{ key }}:</span>
|
|
321
|
+
<span style="font-weight: 600;">{{ value }}</span>
|
|
322
|
+
</div>
|
|
323
|
+
</div>
|
|
324
|
+
|
|
325
|
+
<div style="border-top: 1px solid rgba(255,255,255,0.2); padding-top: 8px;">
|
|
326
|
+
<div style="display: flex; justify-content: space-between; margin-bottom: 4px;">
|
|
327
|
+
<span style="opacity: 0.9;">Gerente:</span>
|
|
328
|
+
<span style="font-weight: 600;">{{ bar.gerente }}</span>
|
|
329
|
+
</div>
|
|
330
|
+
<div style="display: flex; justify-content: space-between; margin-bottom: 4px;">
|
|
331
|
+
<span style="opacity: 0.9;">Risco:</span>
|
|
332
|
+
<span style="font-weight: 600; color: #FFB84D;">{{ bar.nivelRisco }}</span>
|
|
333
|
+
</div>
|
|
334
|
+
<div style="display: flex; justify-content: space-between;">
|
|
335
|
+
<span style="opacity: 0.9;">Progresso:</span>
|
|
336
|
+
<span style="font-weight: 600; color: #8BB455;">{{ formatarProgresso(bar.progresso) }}</span>
|
|
337
|
+
</div>
|
|
338
|
+
</div>
|
|
339
|
+
</div>
|
|
340
|
+
</template>
|
|
341
|
+
</farm-gantt-chart>
|
|
342
|
+
</div>`,
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
export const CustomColors = () => ({
|
|
346
|
+
data() {
|
|
347
|
+
return {
|
|
348
|
+
ganttData: {
|
|
349
|
+
groups: [
|
|
350
|
+
{
|
|
351
|
+
title: 'Projeto A',
|
|
352
|
+
bars: [
|
|
353
|
+
{
|
|
354
|
+
id: 1,
|
|
355
|
+
label: 'Fase 1',
|
|
356
|
+
start: new Date(2025, 0, 15),
|
|
357
|
+
end: new Date(2025, 2, 15),
|
|
358
|
+
color: '#8E44AD',
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
id: 2,
|
|
362
|
+
label: 'Fase 2',
|
|
363
|
+
start: new Date(2025, 2, 1),
|
|
364
|
+
end: new Date(2025, 4, 1),
|
|
365
|
+
color: '#16A085',
|
|
366
|
+
},
|
|
367
|
+
],
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
title: 'Projeto B',
|
|
371
|
+
bars: [
|
|
372
|
+
{
|
|
373
|
+
id: 3,
|
|
374
|
+
label: 'Fase 1',
|
|
375
|
+
start: new Date(2025, 1, 1),
|
|
376
|
+
end: new Date(2025, 3, 1),
|
|
377
|
+
color: '#D35400',
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
id: 4,
|
|
381
|
+
label: 'Fase 2',
|
|
382
|
+
start: new Date(2025, 3, 15),
|
|
383
|
+
end: new Date(2025, 5, 15),
|
|
384
|
+
color: '#2980B9',
|
|
385
|
+
},
|
|
386
|
+
],
|
|
387
|
+
},
|
|
388
|
+
],
|
|
389
|
+
},
|
|
390
|
+
};
|
|
391
|
+
},
|
|
392
|
+
template: `<div style="width: 100%; height: 300px; padding: 20px;">
|
|
393
|
+
<farm-gantt-chart :data="ganttData" />
|
|
394
|
+
</div>`,
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
export const ColorFallback = () => ({
|
|
398
|
+
data() {
|
|
399
|
+
return {
|
|
400
|
+
ganttData: {
|
|
401
|
+
groups: [
|
|
402
|
+
{
|
|
403
|
+
title: 'Projeto com Cores Faltantes',
|
|
404
|
+
bars: [
|
|
405
|
+
{
|
|
406
|
+
id: 1,
|
|
407
|
+
label: 'Barra com Cor',
|
|
408
|
+
start: new Date(2025, 0, 1),
|
|
409
|
+
end: new Date(2025, 1, 15),
|
|
410
|
+
color: '#8BB455',
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
id: 2,
|
|
414
|
+
label: 'Barra sem Cor (Fallback)',
|
|
415
|
+
start: new Date(2025, 1, 1),
|
|
416
|
+
end: new Date(2025, 2, 15),
|
|
417
|
+
// Sem propriedade color - deve usar var(--farm-primary-base)
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
id: 3,
|
|
421
|
+
label: 'Outra Barra com Cor',
|
|
422
|
+
start: new Date(2025, 2, 1),
|
|
423
|
+
end: new Date(2025, 3, 15),
|
|
424
|
+
color: '#FFB84D',
|
|
425
|
+
},
|
|
426
|
+
],
|
|
427
|
+
},
|
|
428
|
+
],
|
|
429
|
+
},
|
|
430
|
+
};
|
|
431
|
+
},
|
|
432
|
+
template: `<div style="width: 100%; height: 300px; padding: 20px;">
|
|
433
|
+
<h3>Fallback de Cor</h3>
|
|
434
|
+
<p>A segunda barra não possui cor definida e usa o fallback <code>var(--farm-primary-base)</code></p>
|
|
435
|
+
<farm-gantt-chart :data="ganttData" />
|
|
436
|
+
</div>`,
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
export const InvertedDates = () => ({
|
|
440
|
+
data() {
|
|
441
|
+
return {
|
|
442
|
+
ganttData: {
|
|
443
|
+
groups: [
|
|
444
|
+
{
|
|
445
|
+
title: 'Teste de Datas Invertidas',
|
|
446
|
+
bars: [
|
|
447
|
+
{
|
|
448
|
+
id: 1,
|
|
449
|
+
label: 'Data Normal (Jan-Mar)',
|
|
450
|
+
start: new Date(2025, 0, 1),
|
|
451
|
+
end: new Date(2025, 2, 15),
|
|
452
|
+
color: '#8BB455',
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
id: 2,
|
|
456
|
+
label: 'Data Invertida → Corrigida (Abr-Abr)',
|
|
457
|
+
start: new Date(2025, 3, 15), // 15 de abril
|
|
458
|
+
end: new Date(2025, 2, 15), // 15 de março (será corrigido para mesmo dia de início: 15 de abril)
|
|
459
|
+
color: '#F7857F',
|
|
460
|
+
},
|
|
461
|
+
{
|
|
462
|
+
id: 3,
|
|
463
|
+
label: 'Data Normal de Referência (Mai-Jun)',
|
|
464
|
+
start: new Date(2025, 4, 1),
|
|
465
|
+
end: new Date(2025, 5, 15),
|
|
466
|
+
color: '#7BC4F7',
|
|
467
|
+
},
|
|
468
|
+
],
|
|
469
|
+
},
|
|
470
|
+
],
|
|
471
|
+
},
|
|
472
|
+
};
|
|
473
|
+
},
|
|
474
|
+
template: `<div style="width: 100%; height: 300px; padding: 20px;">
|
|
475
|
+
<h3>Correção de Datas Invertidas</h3>
|
|
476
|
+
<p><strong>Comportamento:</strong> Quando a data de fim é anterior à data de início, ela é automaticamente corrigida para ser igual à data de início.</p>
|
|
477
|
+
<p><strong>Exemplo:</strong> A segunda barra deveria ir de 15/abril a 15/março, mas aparece apenas em 15/abril (data corrigida).</p>
|
|
478
|
+
<farm-gantt-chart :data="ganttData" />
|
|
479
|
+
</div>`,
|
|
480
|
+
});
|