@devix-tecnologia/timeline-vue 1.1.0 → 1.1.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/README.md +50 -35
- package/dist/style.css +1 -1
- package/dist/timeline-vue.es.js +166 -176
- package/dist/types/components/timeline/moleculas/PerfilTimeline.vue.d.ts +0 -1
- package/dist/types/components/timeline/organismos/Timeline.vue.d.ts +1 -0
- package/package.json +2 -2
- package/src/assets/vue.svg +0 -1
- package/src/components/timeline/atomos/AvatarTimeline.stories.ts +0 -32
- package/src/components/timeline/atomos/AvatarTimeline.vue +0 -51
- package/src/components/timeline/atomos/BoxData.stories.ts +0 -41
- package/src/components/timeline/atomos/BoxData.vue +0 -57
- package/src/components/timeline/atomos/Destaque.stories.ts +0 -24
- package/src/components/timeline/atomos/Destaque.vue +0 -39
- package/src/components/timeline/atomos/Hora.stories.ts +0 -36
- package/src/components/timeline/atomos/Hora.vue +0 -50
- package/src/components/timeline/atomos/IconeCategoria.stories.ts +0 -60
- package/src/components/timeline/atomos/IconeCategoria.vue +0 -110
- package/src/components/timeline/atomos/IconeStatus.stories.ts +0 -38
- package/src/components/timeline/atomos/IconeStatus.vue +0 -73
- package/src/components/timeline/atomos/SubtituloEvento.stories.ts +0 -24
- package/src/components/timeline/atomos/SubtituloEvento.vue +0 -33
- package/src/components/timeline/atomos/TituloEvento.stories.ts +0 -24
- package/src/components/timeline/atomos/TituloEvento.vue +0 -32
- package/src/components/timeline/index.ts +0 -7
- package/src/components/timeline/moleculas/DescricaoEvento.stories.ts +0 -31
- package/src/components/timeline/moleculas/DescricaoEvento.vue +0 -59
- package/src/components/timeline/moleculas/EventoTimeline.stories.ts +0 -94
- package/src/components/timeline/moleculas/EventoTimeline.vue +0 -158
- package/src/components/timeline/moleculas/HoraEvento.stories.ts +0 -37
- package/src/components/timeline/moleculas/HoraEvento.vue +0 -74
- package/src/components/timeline/moleculas/PerfilTimeline.stories.ts +0 -40
- package/src/components/timeline/moleculas/PerfilTimeline.vue +0 -102
- package/src/components/timeline/moleculas/SeparadorPeriodo.stories.ts +0 -42
- package/src/components/timeline/moleculas/SeparadorPeriodo.vue +0 -100
- package/src/components/timeline/moleculas/Topo.vue +0 -38
- package/src/components/timeline/organismos/Timeline.mock.ts +0 -311
- package/src/components/timeline/organismos/Timeline.stories.ts +0 -48
- package/src/components/timeline/organismos/Timeline.vue +0 -212
- package/src/components/timeline/type.ts +0 -34
- package/src/global.css +0 -98
- package/src/index.ts +0 -16
- package/src/vite-env.d.ts +0 -1
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="separadorPeriodo">
|
|
3
|
-
<div class="areaData">
|
|
4
|
-
<BoxData :dataNumero="dataSeparador.getDate()" :aparencia="aparencia" />
|
|
5
|
-
</div>
|
|
6
|
-
<h3 class="titulo" :class="aparencia">
|
|
7
|
-
{{ mesCorrente(dataSeparador.getMonth()) }} de
|
|
8
|
-
{{ dataSeparador.getFullYear() }}
|
|
9
|
-
</h3>
|
|
10
|
-
</div>
|
|
11
|
-
</template>
|
|
12
|
-
|
|
13
|
-
<script lang="ts">
|
|
14
|
-
import { defineComponent, ref } from "vue";
|
|
15
|
-
import BoxData from "../atomos/BoxData.vue";
|
|
16
|
-
|
|
17
|
-
export default defineComponent({
|
|
18
|
-
name: "SeparadorPeriodo",
|
|
19
|
-
props: {
|
|
20
|
-
dataSeparador: {
|
|
21
|
-
required: true,
|
|
22
|
-
type: Date,
|
|
23
|
-
},
|
|
24
|
-
aparencia: {
|
|
25
|
-
type: String,
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
components: { BoxData },
|
|
29
|
-
setup(props) {
|
|
30
|
-
const arrayMes = new Array(12);
|
|
31
|
-
arrayMes[0] = "Janeiro";
|
|
32
|
-
arrayMes[1] = "Fevereiro";
|
|
33
|
-
arrayMes[2] = "Março";
|
|
34
|
-
arrayMes[3] = "Abril";
|
|
35
|
-
arrayMes[4] = "Maio";
|
|
36
|
-
arrayMes[5] = "Junho";
|
|
37
|
-
arrayMes[6] = "Julho";
|
|
38
|
-
arrayMes[7] = "Agosto";
|
|
39
|
-
arrayMes[8] = "Setembro";
|
|
40
|
-
arrayMes[9] = "Outubro";
|
|
41
|
-
arrayMes[10] = "Novembro";
|
|
42
|
-
arrayMes[11] = "Dezembro";
|
|
43
|
-
|
|
44
|
-
const mesCorrente = (mes: number) => {
|
|
45
|
-
return arrayMes[mes];
|
|
46
|
-
};
|
|
47
|
-
return { mesCorrente };
|
|
48
|
-
},
|
|
49
|
-
});
|
|
50
|
-
</script>
|
|
51
|
-
|
|
52
|
-
<style scoped>
|
|
53
|
-
/* SEPARADOR */
|
|
54
|
-
|
|
55
|
-
.separadorPeriodo {
|
|
56
|
-
display: table-row;
|
|
57
|
-
width: 100%;
|
|
58
|
-
position: relative;
|
|
59
|
-
background: #fff;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.areaData {
|
|
63
|
-
display: table-cell;
|
|
64
|
-
padding: 2.8rem 1.4rem;
|
|
65
|
-
padding-left: 10.1rem;
|
|
66
|
-
position: relative;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.areaData:before {
|
|
70
|
-
content: "";
|
|
71
|
-
background: var(--cor-linha);
|
|
72
|
-
display: block;
|
|
73
|
-
position: absolute;
|
|
74
|
-
width: 2px;
|
|
75
|
-
height: 2.5rem;
|
|
76
|
-
top: 0;
|
|
77
|
-
left: 11.9rem;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.areaData:after {
|
|
81
|
-
content: "";
|
|
82
|
-
background: var(--cor-linha);
|
|
83
|
-
display: block;
|
|
84
|
-
position: absolute;
|
|
85
|
-
width: 2px;
|
|
86
|
-
height: 2.5rem;
|
|
87
|
-
bottom: 0;
|
|
88
|
-
left: 11.9rem;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.separadorPeriodo .titulo {
|
|
92
|
-
text-transform: uppercase;
|
|
93
|
-
padding-bottom: 3.45rem;
|
|
94
|
-
color: var(--cor-texto);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.separadorPeriodo .titulo.claro {
|
|
98
|
-
color: var(--cor-apoio);
|
|
99
|
-
}
|
|
100
|
-
</style>
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="topo">
|
|
3
|
-
<div class="Topo">
|
|
4
|
-
<!-- iconeSeta -->
|
|
5
|
-
<span class="material-symbols-outlined"> arrow_back </span>
|
|
6
|
-
<!-- titulo -->
|
|
7
|
-
<h2 class="titulo">Linha do tempo</h2>
|
|
8
|
-
<!-- menu -->
|
|
9
|
-
<span class="material-symbols-outlined"> more_vert </span>
|
|
10
|
-
</div>
|
|
11
|
-
</div>
|
|
12
|
-
</template>
|
|
13
|
-
|
|
14
|
-
<script lang="ts">
|
|
15
|
-
import { defineComponent } from 'vue';
|
|
16
|
-
|
|
17
|
-
export default defineComponent({
|
|
18
|
-
setup() {
|
|
19
|
-
return {};
|
|
20
|
-
},
|
|
21
|
-
});
|
|
22
|
-
</script>
|
|
23
|
-
|
|
24
|
-
<style scoped>
|
|
25
|
-
/* CABEÇALHO */
|
|
26
|
-
.material-symbols-outlined {
|
|
27
|
-
font-size: 2.6rem;
|
|
28
|
-
}
|
|
29
|
-
.Topo {
|
|
30
|
-
background: var(--cor-secundaria);
|
|
31
|
-
padding: 1.4rem;
|
|
32
|
-
color: var(--cor-terciaria);
|
|
33
|
-
display: flex;
|
|
34
|
-
flex-direction: row;
|
|
35
|
-
justify-content: space-between;
|
|
36
|
-
align-items: center;
|
|
37
|
-
}
|
|
38
|
-
</style>
|
|
@@ -1,311 +0,0 @@
|
|
|
1
|
-
import { Evento, Perfil } from "../type";
|
|
2
|
-
|
|
3
|
-
export const dadosPerfil: Perfil = {
|
|
4
|
-
nome: "Maria do Socorro",
|
|
5
|
-
imagem:
|
|
6
|
-
"https://this-person-does-not-exist.com/img/avatar-gen11071f8e0802a35d66684ee9376722b2.jpg",
|
|
7
|
-
icone: "person",
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export const dadosEventos: Evento[] = [
|
|
11
|
-
{
|
|
12
|
-
id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f1",
|
|
13
|
-
data: new Date("2023-04-26T19:00Z"),
|
|
14
|
-
previsto: new Date("2023-04-26T19:00Z"),
|
|
15
|
-
realizado: new Date("2023-04-26T19:30Z"),
|
|
16
|
-
duracao: null,
|
|
17
|
-
tolerancia: 10,
|
|
18
|
-
titulo: "Vacina da Covid",
|
|
19
|
-
subtitulo: "Posto de saúde do bairro",
|
|
20
|
-
destaque: "",
|
|
21
|
-
categoria: {
|
|
22
|
-
nome: "Vacina",
|
|
23
|
-
icone: "vaccines",
|
|
24
|
-
},
|
|
25
|
-
status: "realizado",
|
|
26
|
-
criticidade: "media",
|
|
27
|
-
|
|
28
|
-
atual: false,
|
|
29
|
-
scroll: false,
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f2",
|
|
33
|
-
data: new Date("2023-04-26T18:10Z"),
|
|
34
|
-
previsto: new Date("2023-04-26T18:10Z"),
|
|
35
|
-
realizado: new Date("2023-04-26T18:15Z"),
|
|
36
|
-
duracao: null,
|
|
37
|
-
tolerancia: 10,
|
|
38
|
-
titulo: "Vacina da gripe",
|
|
39
|
-
subtitulo: "Posto de saúde do bairro",
|
|
40
|
-
destaque: "",
|
|
41
|
-
categoria: {
|
|
42
|
-
nome: "Vacina",
|
|
43
|
-
icone: "vaccines",
|
|
44
|
-
},
|
|
45
|
-
status: "cancelado",
|
|
46
|
-
criticidade: "baixa",
|
|
47
|
-
|
|
48
|
-
atual: false,
|
|
49
|
-
scroll: false,
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f3",
|
|
53
|
-
data: new Date("2023-05-03T11:00Z"),
|
|
54
|
-
previsto: new Date("2023-05-03T11:00Z"),
|
|
55
|
-
realizado: null,
|
|
56
|
-
duracao: null,
|
|
57
|
-
tolerancia: 10,
|
|
58
|
-
titulo: "Ligar para médica",
|
|
59
|
-
subtitulo: "",
|
|
60
|
-
destaque: "",
|
|
61
|
-
categoria: {
|
|
62
|
-
nome: "Ligação",
|
|
63
|
-
icone: "call",
|
|
64
|
-
},
|
|
65
|
-
status: "planejado",
|
|
66
|
-
criticidade: "baixa",
|
|
67
|
-
|
|
68
|
-
atual: false,
|
|
69
|
-
scroll: false,
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f4",
|
|
73
|
-
data: new Date("2023-05-03T15:00Z"),
|
|
74
|
-
previsto: new Date("2023-05-03T15:00Z"),
|
|
75
|
-
realizado: null,
|
|
76
|
-
duracao: null,
|
|
77
|
-
tolerancia: 10,
|
|
78
|
-
titulo: "Passeio no parque",
|
|
79
|
-
subtitulo: "",
|
|
80
|
-
destaque: "",
|
|
81
|
-
categoria: {
|
|
82
|
-
nome: "Passeio",
|
|
83
|
-
icone: "tour",
|
|
84
|
-
},
|
|
85
|
-
status: "planejado",
|
|
86
|
-
criticidade: "baixa",
|
|
87
|
-
|
|
88
|
-
atual: false,
|
|
89
|
-
scroll: false,
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f5",
|
|
93
|
-
data: new Date("2023-05-03T20:00Z"),
|
|
94
|
-
previsto: new Date("2023-05-03T20:00Z"),
|
|
95
|
-
realizado: null,
|
|
96
|
-
duracao: null,
|
|
97
|
-
tolerancia: 10,
|
|
98
|
-
titulo: "Exames do coração",
|
|
99
|
-
subtitulo: "Hospital do Coração",
|
|
100
|
-
destaque: "",
|
|
101
|
-
categoria: {
|
|
102
|
-
nome: "Cardiologista",
|
|
103
|
-
icone: "cardiology",
|
|
104
|
-
},
|
|
105
|
-
status: "planejado",
|
|
106
|
-
criticidade: "media",
|
|
107
|
-
|
|
108
|
-
atual: false,
|
|
109
|
-
scroll: false,
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f6",
|
|
113
|
-
data: new Date("2023-04-01T12:00Z"),
|
|
114
|
-
previsto: new Date("2023-04-01T12:00Z"),
|
|
115
|
-
realizado: null,
|
|
116
|
-
duracao: null,
|
|
117
|
-
tolerancia: 10,
|
|
118
|
-
titulo: "Consulta",
|
|
119
|
-
subtitulo: "Posto de saúde",
|
|
120
|
-
destaque: "Remarcado",
|
|
121
|
-
categoria: {
|
|
122
|
-
nome: "Tele consulta",
|
|
123
|
-
icone: "call",
|
|
124
|
-
},
|
|
125
|
-
status: "adiado",
|
|
126
|
-
criticidade: "baixa",
|
|
127
|
-
|
|
128
|
-
atual: false,
|
|
129
|
-
scroll: false,
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f7",
|
|
133
|
-
data: new Date("2023-04-01T13:00Z"),
|
|
134
|
-
previsto: new Date("2023-04-01T13:00Z"),
|
|
135
|
-
realizado: null,
|
|
136
|
-
duracao: null,
|
|
137
|
-
tolerancia: 10,
|
|
138
|
-
titulo: "Consulta cardiologista",
|
|
139
|
-
subtitulo: "Posto de saúde do bairro",
|
|
140
|
-
destaque: "",
|
|
141
|
-
categoria: {
|
|
142
|
-
nome: "Cardiologista",
|
|
143
|
-
icone: "cardiology",
|
|
144
|
-
},
|
|
145
|
-
status: "realizado",
|
|
146
|
-
criticidade: "alta",
|
|
147
|
-
|
|
148
|
-
atual: false,
|
|
149
|
-
scroll: false,
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f8",
|
|
153
|
-
data: new Date("2023-05-03T12:00Z"),
|
|
154
|
-
previsto: new Date("2023-05-03T12:00Z"),
|
|
155
|
-
realizado: null,
|
|
156
|
-
duracao: null,
|
|
157
|
-
tolerancia: 10,
|
|
158
|
-
titulo: "Dentista",
|
|
159
|
-
subtitulo: "Reta da Penha",
|
|
160
|
-
destaque: "",
|
|
161
|
-
categoria: {
|
|
162
|
-
nome: "Dentista",
|
|
163
|
-
icone: "dentistry",
|
|
164
|
-
},
|
|
165
|
-
status: "planejado",
|
|
166
|
-
criticidade: "baixa",
|
|
167
|
-
|
|
168
|
-
atual: false,
|
|
169
|
-
scroll: false,
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f9",
|
|
173
|
-
data: new Date("2023-05-03T13:00Z"),
|
|
174
|
-
previsto: new Date("2023-05-03T13:00Z"),
|
|
175
|
-
realizado: null,
|
|
176
|
-
duracao: null,
|
|
177
|
-
tolerancia: 10,
|
|
178
|
-
titulo: "Consulta",
|
|
179
|
-
subtitulo: "Hospital central",
|
|
180
|
-
destaque: "",
|
|
181
|
-
categoria: {
|
|
182
|
-
nome: "Consulta",
|
|
183
|
-
icone: "health_and_safety",
|
|
184
|
-
},
|
|
185
|
-
status: "planejado",
|
|
186
|
-
criticidade: "alta",
|
|
187
|
-
|
|
188
|
-
atual: false,
|
|
189
|
-
scroll: false,
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f10",
|
|
193
|
-
data: new Date("2023-05-03T14:27Z"),
|
|
194
|
-
previsto: new Date("2023-05-03T14:27Z"),
|
|
195
|
-
realizado: null,
|
|
196
|
-
duracao: null,
|
|
197
|
-
tolerancia: 10,
|
|
198
|
-
titulo: "Remédio de pressão",
|
|
199
|
-
subtitulo: "Aferir a pressão",
|
|
200
|
-
destaque: "",
|
|
201
|
-
categoria: {
|
|
202
|
-
nome: "Remédio",
|
|
203
|
-
icone: "pill",
|
|
204
|
-
},
|
|
205
|
-
status: "planejado",
|
|
206
|
-
criticidade: "alta",
|
|
207
|
-
|
|
208
|
-
atual: false,
|
|
209
|
-
scroll: false,
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f11",
|
|
213
|
-
data: new Date("2023-05-03T15:00Z"),
|
|
214
|
-
previsto: new Date("2023-05-03T15:00Z"),
|
|
215
|
-
realizado: null,
|
|
216
|
-
duracao: null,
|
|
217
|
-
tolerancia: 10,
|
|
218
|
-
titulo: "Checar temperatura",
|
|
219
|
-
subtitulo: "",
|
|
220
|
-
destaque: "",
|
|
221
|
-
categoria: {
|
|
222
|
-
nome: "Termometro",
|
|
223
|
-
icone: "thermometer_gain",
|
|
224
|
-
},
|
|
225
|
-
status: "planejado",
|
|
226
|
-
criticidade: "baixa",
|
|
227
|
-
|
|
228
|
-
atual: false,
|
|
229
|
-
scroll: false,
|
|
230
|
-
},
|
|
231
|
-
{
|
|
232
|
-
id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f12",
|
|
233
|
-
data: new Date("2023-05-08T16:00Z"),
|
|
234
|
-
previsto: new Date("2023-05-08T16:00Z"),
|
|
235
|
-
realizado: null,
|
|
236
|
-
duracao: null,
|
|
237
|
-
tolerancia: 10,
|
|
238
|
-
titulo: "Avaliação Física",
|
|
239
|
-
subtitulo: "",
|
|
240
|
-
destaque: "IMC: 28,4",
|
|
241
|
-
categoria: {
|
|
242
|
-
nome: "Avaliação Física",
|
|
243
|
-
icone: "conditions",
|
|
244
|
-
},
|
|
245
|
-
status: "planejado",
|
|
246
|
-
criticidade: "baixa",
|
|
247
|
-
|
|
248
|
-
atual: false,
|
|
249
|
-
scroll: false,
|
|
250
|
-
},
|
|
251
|
-
{
|
|
252
|
-
id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f13",
|
|
253
|
-
data: new Date("2023-05-09T19:00Z"),
|
|
254
|
-
previsto: new Date("2023-05-09T19:00Z"),
|
|
255
|
-
realizado: null,
|
|
256
|
-
duracao: null,
|
|
257
|
-
tolerancia: 10,
|
|
258
|
-
titulo: "Vacina da gripe",
|
|
259
|
-
subtitulo: "Posto de saúde do bairro",
|
|
260
|
-
destaque: "",
|
|
261
|
-
categoria: {
|
|
262
|
-
nome: "Vacina",
|
|
263
|
-
icone: "vaccines",
|
|
264
|
-
},
|
|
265
|
-
status: "planejado",
|
|
266
|
-
criticidade: "baixa",
|
|
267
|
-
|
|
268
|
-
atual: false,
|
|
269
|
-
scroll: false,
|
|
270
|
-
},
|
|
271
|
-
{
|
|
272
|
-
id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f14",
|
|
273
|
-
data: new Date("2023-05-09T17:00Z"),
|
|
274
|
-
previsto: new Date("2023-05-09T17:00Z"),
|
|
275
|
-
realizado: null,
|
|
276
|
-
duracao: null,
|
|
277
|
-
tolerancia: 10,
|
|
278
|
-
titulo: "Vitamina D",
|
|
279
|
-
subtitulo: "2 comprimidos",
|
|
280
|
-
destaque: "",
|
|
281
|
-
categoria: {
|
|
282
|
-
nome: "Remédio",
|
|
283
|
-
icone: "pill",
|
|
284
|
-
},
|
|
285
|
-
status: "planejado",
|
|
286
|
-
criticidade: "baixa",
|
|
287
|
-
aoCLicar: () => alert("Olá, mundo!"),
|
|
288
|
-
atual: false,
|
|
289
|
-
scroll: false,
|
|
290
|
-
},
|
|
291
|
-
{
|
|
292
|
-
id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f15",
|
|
293
|
-
data: new Date("2023-05-09T18:01Z"),
|
|
294
|
-
previsto: new Date("2023-05-09T18:00Z"),
|
|
295
|
-
realizado: null,
|
|
296
|
-
duracao: null,
|
|
297
|
-
tolerancia: 10,
|
|
298
|
-
titulo: "Fisioterapia",
|
|
299
|
-
subtitulo: "",
|
|
300
|
-
destaque: "",
|
|
301
|
-
categoria: {
|
|
302
|
-
nome: "Fisioterapia",
|
|
303
|
-
icone: "physical_therapy",
|
|
304
|
-
},
|
|
305
|
-
status: "planejado",
|
|
306
|
-
criticidade: "baixa",
|
|
307
|
-
|
|
308
|
-
atual: false,
|
|
309
|
-
scroll: false,
|
|
310
|
-
},
|
|
311
|
-
];
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import Timeline from "./Timeline.vue";
|
|
2
|
-
import { Meta, StoryFn } from "@storybook/vue3";
|
|
3
|
-
import { dadosEventos, dadosPerfil } from "./Timeline.mock";
|
|
4
|
-
import { Evento } from "../type";
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
title: "Devix/Timeline/Organismos/Timeline",
|
|
8
|
-
component: Timeline,
|
|
9
|
-
parameters: {
|
|
10
|
-
componentSubtitle: "Linha do tempo padrão com identidade da Devix",
|
|
11
|
-
},
|
|
12
|
-
argTypes: {},
|
|
13
|
-
} as Meta<typeof Timeline>;
|
|
14
|
-
|
|
15
|
-
const perfilMock = dadosPerfil;
|
|
16
|
-
|
|
17
|
-
const eventosPorDataMock = dadosEventos;
|
|
18
|
-
|
|
19
|
-
function atualizarDatas(eventos: Evento[]) {
|
|
20
|
-
const agora = new Date();
|
|
21
|
-
const mesAtual = agora.getMonth() + 1;
|
|
22
|
-
|
|
23
|
-
for (let i = 0; i < eventos.length; i++) {
|
|
24
|
-
const evento = eventos[i];
|
|
25
|
-
const mesEvento = evento.data.getMonth() + 1;
|
|
26
|
-
|
|
27
|
-
if (mesEvento >= mesAtual) {
|
|
28
|
-
evento.data.setMonth(agora.getMonth(), agora.getDate());
|
|
29
|
-
evento.previsto.setMonth(agora.getMonth(), agora.getDate());
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
atualizarDatas(dadosEventos);
|
|
34
|
-
|
|
35
|
-
const Template: StoryFn<typeof Timeline> = (args) => ({
|
|
36
|
-
components: { Timeline: Timeline },
|
|
37
|
-
setup() {
|
|
38
|
-
return { args };
|
|
39
|
-
},
|
|
40
|
-
template:
|
|
41
|
-
'<Timeline :perfilTimeline="args.perfilTimeline" :eventosTimeline="args.eventosTimeline" style="position: relative" />',
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
export const Padrao = Template.bind({});
|
|
45
|
-
Padrao.args = {
|
|
46
|
-
perfilTimeline: perfilMock,
|
|
47
|
-
eventosTimeline: eventosPorDataMock,
|
|
48
|
-
};
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="areaTimeline">
|
|
3
|
-
<PerfilTimeline
|
|
4
|
-
v-if="perfilTimeline !== null"
|
|
5
|
-
:nomePerfil="perfilTimeline.nome"
|
|
6
|
-
:imagemPerfil="perfilTimeline.imagem"
|
|
7
|
-
:iconePerfil="perfilTimeline.icone"
|
|
8
|
-
/>
|
|
9
|
-
<section class="timeline">
|
|
10
|
-
<!-- SEPARADOR -->
|
|
11
|
-
<div v-for="evento in eventosPorTipo" :key="evento.key">
|
|
12
|
-
<SeparadorPeriodo
|
|
13
|
-
v-if="evento.tipo === 'dia'"
|
|
14
|
-
:dataSeparador="evento.valor"
|
|
15
|
-
/>
|
|
16
|
-
<!--loop-->
|
|
17
|
-
<EventoTimeline
|
|
18
|
-
v-if="evento.tipo === 'evento'"
|
|
19
|
-
:status="evento.valor.status"
|
|
20
|
-
:criticidade="evento.valor.criticidade"
|
|
21
|
-
:previsto="evento.valor.previsto"
|
|
22
|
-
:realizado="evento.valor.realizado"
|
|
23
|
-
:categoria="evento.valor.categoria"
|
|
24
|
-
:titulo="evento.valor.titulo"
|
|
25
|
-
:subtitulo="evento.valor.subtitulo"
|
|
26
|
-
:destaque="evento.valor.destaque"
|
|
27
|
-
:ehAtual="evento.valor.atual"
|
|
28
|
-
:aoCLicar="evento.valor.aoCLicar"
|
|
29
|
-
/>
|
|
30
|
-
</div>
|
|
31
|
-
</section>
|
|
32
|
-
</div>
|
|
33
|
-
</template>
|
|
34
|
-
|
|
35
|
-
<script lang="ts">
|
|
36
|
-
import { defineComponent, computed, reactive } from "vue";
|
|
37
|
-
import EventoTimeline from "../moleculas/EventoTimeline.vue";
|
|
38
|
-
import SeparadorPeriodo from "../moleculas/SeparadorPeriodo.vue";
|
|
39
|
-
import PerfilTimeline from "../moleculas/PerfilTimeline.vue";
|
|
40
|
-
import { Evento } from "../type";
|
|
41
|
-
|
|
42
|
-
type TipoEventoTimeline =
|
|
43
|
-
| { tipo: "dia"; valor: Date; key: number }
|
|
44
|
-
| { tipo: "evento"; valor: Evento; key: number }
|
|
45
|
-
| { tipo: "eventos"; valor: Evento[]; key: number };
|
|
46
|
-
|
|
47
|
-
export default defineComponent({
|
|
48
|
-
props: {
|
|
49
|
-
perfilTimeline: {
|
|
50
|
-
required: true,
|
|
51
|
-
type: Object,
|
|
52
|
-
},
|
|
53
|
-
eventosTimeline: {
|
|
54
|
-
required: true,
|
|
55
|
-
type: Object,
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
components: {
|
|
59
|
-
PerfilTimeline,
|
|
60
|
-
SeparadorPeriodo,
|
|
61
|
-
EventoTimeline,
|
|
62
|
-
},
|
|
63
|
-
setup(props) {
|
|
64
|
-
const dadosEventosTimeline: Evento[] = reactive(
|
|
65
|
-
props.eventosTimeline as Array<Evento>
|
|
66
|
-
);
|
|
67
|
-
let dadosEventosTimelineClone: Evento[] = reactive(dadosEventosTimeline);
|
|
68
|
-
|
|
69
|
-
function carregarListaEventos() {
|
|
70
|
-
dadosEventosTimelineClone = dadosEventosTimeline;
|
|
71
|
-
const resultado: Evento[] = filtraEventoAtual(dadosEventosTimelineClone);
|
|
72
|
-
dadosEventosTimelineClone.map((resp) => {
|
|
73
|
-
if (resultado[0].id === resp.id) {
|
|
74
|
-
resp.atual = true;
|
|
75
|
-
resp.scroll = true;
|
|
76
|
-
void scrollParaItemAtual();
|
|
77
|
-
} else {
|
|
78
|
-
resp.atual = false;
|
|
79
|
-
resp.scroll = false;
|
|
80
|
-
}
|
|
81
|
-
return {
|
|
82
|
-
evento: resp,
|
|
83
|
-
};
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const atualizarEventoAtual = () => {
|
|
88
|
-
setInterval(carregarListaEventos, 60000);
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
const verifica_mesmo_dia = (a: Date, b: Date) => {
|
|
92
|
-
const mesmo_dia = a.getDay() === b.getDay();
|
|
93
|
-
const mesmo_mes = a.getMonth() === b.getMonth();
|
|
94
|
-
const mesmo_ano = a.getFullYear() === b.getFullYear();
|
|
95
|
-
return mesmo_dia && mesmo_mes && mesmo_ano;
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
//verifica qual evento está mais próximo da hora atual e coloca ele numa nova lista na primeira posição
|
|
99
|
-
const filtraEventoAtual = (eventos: Evento[]) => {
|
|
100
|
-
if (eventos) {
|
|
101
|
-
const agora = Date.now();
|
|
102
|
-
let minDiff: number | null = null;
|
|
103
|
-
let listaEventos = [];
|
|
104
|
-
for (const e of eventos) {
|
|
105
|
-
const t = e.data.getTime();
|
|
106
|
-
if (e.status === "planejado" || e.status === "atrasado") {
|
|
107
|
-
const diff: number = Math.abs(agora - e.data.getTime());
|
|
108
|
-
if (minDiff === null || (diff < minDiff && t <= agora)) {
|
|
109
|
-
minDiff = diff;
|
|
110
|
-
listaEventos.length = 0;
|
|
111
|
-
} else if (diff > minDiff) {
|
|
112
|
-
continue;
|
|
113
|
-
}
|
|
114
|
-
listaEventos.push(e);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
return listaEventos;
|
|
118
|
-
} else {
|
|
119
|
-
return [];
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
// lista de eventos por tipo
|
|
124
|
-
const eventosTimeline = computed(() => {
|
|
125
|
-
void atualizarEventoAtual();
|
|
126
|
-
|
|
127
|
-
const eventosOrdenados = dadosEventosTimelineClone.sort(
|
|
128
|
-
(a: Evento, b: Evento) => {
|
|
129
|
-
return a.data.getTime() - b.data.getTime();
|
|
130
|
-
}
|
|
131
|
-
);
|
|
132
|
-
if (eventosOrdenados) {
|
|
133
|
-
let resultado: Array<TipoEventoTimeline> = [];
|
|
134
|
-
let dataAtual: Date | null = null;
|
|
135
|
-
let idx = 0;
|
|
136
|
-
let statusEvento;
|
|
137
|
-
|
|
138
|
-
for (const evento of eventosOrdenados) {
|
|
139
|
-
const agora = new Date();
|
|
140
|
-
const dataEvento = evento.data;
|
|
141
|
-
statusEvento = evento.status;
|
|
142
|
-
const toleranciaEvento = evento.tolerancia * 60 * 1000;
|
|
143
|
-
|
|
144
|
-
//altera status para atrasado
|
|
145
|
-
if (
|
|
146
|
-
statusEvento === "planejado" &&
|
|
147
|
-
dataEvento.getTime() + toleranciaEvento < agora.getTime()
|
|
148
|
-
) {
|
|
149
|
-
evento.status = "atrasado";
|
|
150
|
-
}
|
|
151
|
-
if (!dataAtual || !verifica_mesmo_dia(dataAtual, dataEvento)) {
|
|
152
|
-
dataAtual = dataEvento;
|
|
153
|
-
resultado.push({
|
|
154
|
-
tipo: "dia",
|
|
155
|
-
valor: evento.data,
|
|
156
|
-
key: ++idx,
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
resultado.push({
|
|
160
|
-
tipo: "evento",
|
|
161
|
-
valor: evento,
|
|
162
|
-
key: ++idx,
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
return resultado;
|
|
166
|
-
} else {
|
|
167
|
-
return [];
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
const scrollParaItemAtual = () => {
|
|
172
|
-
const itemAtual = document.querySelector(".atual");
|
|
173
|
-
itemAtual?.scrollIntoView({
|
|
174
|
-
behavior: "smooth",
|
|
175
|
-
block: "center",
|
|
176
|
-
});
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
carregarListaEventos();
|
|
180
|
-
return {
|
|
181
|
-
eventosPorTipo: eventosTimeline,
|
|
182
|
-
scrollParaItemAtual,
|
|
183
|
-
};
|
|
184
|
-
},
|
|
185
|
-
mounted() {
|
|
186
|
-
// Aguardando a renderização para fazer scroll
|
|
187
|
-
this.scrollParaItemAtual();
|
|
188
|
-
},
|
|
189
|
-
});
|
|
190
|
-
</script>
|
|
191
|
-
|
|
192
|
-
<style scoped>
|
|
193
|
-
/* TIMELINE */
|
|
194
|
-
|
|
195
|
-
/* .areaTimeline {
|
|
196
|
-
max-width: 850px;
|
|
197
|
-
margin: 0 auto;
|
|
198
|
-
} */
|
|
199
|
-
|
|
200
|
-
.areaEvento {
|
|
201
|
-
display: table-row;
|
|
202
|
-
min-height: 8rem;
|
|
203
|
-
position: relative !important;
|
|
204
|
-
width: 100%;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
.timeline {
|
|
208
|
-
display: table;
|
|
209
|
-
width: 100%;
|
|
210
|
-
position: relative;
|
|
211
|
-
}
|
|
212
|
-
</style>
|