@devix-tecnologia/timeline-vue 1.0.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/README.md +18 -0
- package/dist/style.css +1 -0
- package/dist/timeline-vue.es.js +557 -0
- package/dist/types/components/timeline/atomos/AvatarTimeline.vue.d.ts +17 -0
- package/dist/types/components/timeline/atomos/BoxData.vue.d.ts +23 -0
- package/dist/types/components/timeline/atomos/Destaque.vue.d.ts +11 -0
- package/dist/types/components/timeline/atomos/Hora.vue.d.ts +24 -0
- package/dist/types/components/timeline/atomos/IconeCategoria.vue.d.ts +57 -0
- package/dist/types/components/timeline/atomos/IconeStatus.vue.d.ts +17 -0
- package/dist/types/components/timeline/atomos/SubtituloEvento.vue.d.ts +13 -0
- package/dist/types/components/timeline/atomos/TituloEvento.vue.d.ts +13 -0
- package/dist/types/components/timeline/index.d.ts +3 -0
- package/dist/types/components/timeline/moleculas/DescricaoEvento.vue.d.ts +21 -0
- package/dist/types/components/timeline/moleculas/EventoTimeline.vue.d.ts +18 -0
- package/dist/types/components/timeline/moleculas/HoraEvento.vue.d.ts +19 -0
- package/dist/types/components/timeline/moleculas/PerfilTimeline.vue.d.ts +39 -0
- package/dist/types/components/timeline/moleculas/SeparadorPeriodo.vue.d.ts +24 -0
- package/dist/types/components/timeline/moleculas/Topo.vue.d.ts +3 -0
- package/dist/types/components/timeline/organismos/Timeline.mock.d.ts +3 -0
- package/dist/types/components/timeline/organismos/Timeline.vue.d.ts +40 -0
- package/dist/types/components/timeline/type.d.ts +23 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/vite.svg +1 -0
- package/package.json +53 -0
- package/src/assets/vue.svg +1 -0
- package/src/components/timeline/atomos/AvatarTimeline.stories.ts +32 -0
- package/src/components/timeline/atomos/AvatarTimeline.vue +51 -0
- package/src/components/timeline/atomos/BoxData.stories.ts +41 -0
- package/src/components/timeline/atomos/BoxData.vue +57 -0
- package/src/components/timeline/atomos/Destaque.stories.ts +24 -0
- package/src/components/timeline/atomos/Destaque.vue +39 -0
- package/src/components/timeline/atomos/Hora.stories.ts +36 -0
- package/src/components/timeline/atomos/Hora.vue +53 -0
- package/src/components/timeline/atomos/IconeCategoria.stories.ts +60 -0
- package/src/components/timeline/atomos/IconeCategoria.vue +110 -0
- package/src/components/timeline/atomos/IconeStatus.stories.ts +38 -0
- package/src/components/timeline/atomos/IconeStatus.vue +72 -0
- package/src/components/timeline/atomos/SubtituloEvento.stories.ts +24 -0
- package/src/components/timeline/atomos/SubtituloEvento.vue +33 -0
- package/src/components/timeline/atomos/TituloEvento.stories.ts +24 -0
- package/src/components/timeline/atomos/TituloEvento.vue +32 -0
- package/src/components/timeline/index.ts +7 -0
- package/src/components/timeline/moleculas/DescricaoEvento.stories.ts +31 -0
- package/src/components/timeline/moleculas/DescricaoEvento.vue +59 -0
- package/src/components/timeline/moleculas/EventoTimeline.stories.ts +94 -0
- package/src/components/timeline/moleculas/EventoTimeline.vue +102 -0
- package/src/components/timeline/moleculas/HoraEvento.stories.ts +37 -0
- package/src/components/timeline/moleculas/HoraEvento.vue +73 -0
- package/src/components/timeline/moleculas/PerfilTimeline.stories.ts +40 -0
- package/src/components/timeline/moleculas/PerfilTimeline.vue +103 -0
- package/src/components/timeline/moleculas/SeparadorPeriodo.stories.ts +42 -0
- package/src/components/timeline/moleculas/SeparadorPeriodo.vue +101 -0
- package/src/components/timeline/moleculas/Topo.vue +38 -0
- package/src/components/timeline/organismos/Timeline.mock.ts +281 -0
- package/src/components/timeline/organismos/Timeline.stories.ts +31 -0
- package/src/components/timeline/organismos/Timeline.vue +188 -0
- package/src/components/timeline/type.ts +30 -0
- package/src/global.css +98 -0
- package/src/index.ts +16 -0
- package/src/vite-env.d.ts +1 -0
|
@@ -0,0 +1,281 @@
|
|
|
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: null,
|
|
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
|
+
acao: false,
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f2",
|
|
31
|
+
data: new Date("2023-04-26T18:10Z"),
|
|
32
|
+
previsto: new Date("2023-04-26T18:10Z"),
|
|
33
|
+
realizado: new Date("2023-04-26T18:15Z"),
|
|
34
|
+
duracao: null,
|
|
35
|
+
tolerancia: null,
|
|
36
|
+
titulo: "Vacina da gripe",
|
|
37
|
+
subtitulo: "Posto de saúde do bairro",
|
|
38
|
+
destaque: "",
|
|
39
|
+
categoria: {
|
|
40
|
+
nome: "Vacina",
|
|
41
|
+
icone: "vaccines",
|
|
42
|
+
},
|
|
43
|
+
status: "cancelado",
|
|
44
|
+
criticidade: "baixa",
|
|
45
|
+
acao: false,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f3",
|
|
49
|
+
data: new Date("2023-05-03T09:00Z"),
|
|
50
|
+
previsto: new Date("2023-05-03T09:00Z"),
|
|
51
|
+
realizado: new Date("2023-05-03T09:00Z"),
|
|
52
|
+
duracao: null,
|
|
53
|
+
tolerancia: null,
|
|
54
|
+
titulo: "Ligar para médica",
|
|
55
|
+
subtitulo: "",
|
|
56
|
+
destaque: "",
|
|
57
|
+
categoria: {
|
|
58
|
+
nome: "Ligação",
|
|
59
|
+
icone: "call",
|
|
60
|
+
},
|
|
61
|
+
status: "planejado",
|
|
62
|
+
criticidade: "baixa",
|
|
63
|
+
acao: true,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f4",
|
|
67
|
+
data: new Date("2023-05-03T10:00Z"),
|
|
68
|
+
previsto: new Date("2023-05-03T10:00Z"),
|
|
69
|
+
realizado: null,
|
|
70
|
+
duracao: null,
|
|
71
|
+
tolerancia: null,
|
|
72
|
+
titulo: "Passeio no parque",
|
|
73
|
+
subtitulo: "",
|
|
74
|
+
destaque: "",
|
|
75
|
+
categoria: {
|
|
76
|
+
nome: "Passeio",
|
|
77
|
+
icone: "tour",
|
|
78
|
+
},
|
|
79
|
+
status: "planejado",
|
|
80
|
+
criticidade: "baixa",
|
|
81
|
+
acao: false,
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f5",
|
|
85
|
+
data: new Date("2023-05-03T11:00Z"),
|
|
86
|
+
previsto: new Date("2023-05-03T11:00Z"),
|
|
87
|
+
realizado: null,
|
|
88
|
+
duracao: null,
|
|
89
|
+
tolerancia: null,
|
|
90
|
+
titulo: "Exames do coração",
|
|
91
|
+
subtitulo: "Hospital do Coração",
|
|
92
|
+
destaque: "",
|
|
93
|
+
categoria: {
|
|
94
|
+
nome: "Cardiologista",
|
|
95
|
+
icone: "cardiology",
|
|
96
|
+
},
|
|
97
|
+
status: "planejado",
|
|
98
|
+
criticidade: "media",
|
|
99
|
+
acao: true,
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f6",
|
|
103
|
+
data: new Date("2023-05-01T12:00Z"),
|
|
104
|
+
previsto: new Date("2023-05-01T12:00Z"),
|
|
105
|
+
realizado: null,
|
|
106
|
+
duracao: null,
|
|
107
|
+
tolerancia: null,
|
|
108
|
+
titulo: "Consulta",
|
|
109
|
+
subtitulo: "Posto de saúde",
|
|
110
|
+
destaque: "Remarcado",
|
|
111
|
+
categoria: {
|
|
112
|
+
nome: "Tele consulta",
|
|
113
|
+
icone: "call",
|
|
114
|
+
},
|
|
115
|
+
status: "adiado",
|
|
116
|
+
criticidade: "baixa",
|
|
117
|
+
acao: false,
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f7",
|
|
121
|
+
data: new Date("2023-05-01T13:00Z"),
|
|
122
|
+
previsto: new Date("2023-05-01T13:00Z"),
|
|
123
|
+
realizado: null,
|
|
124
|
+
duracao: null,
|
|
125
|
+
tolerancia: null,
|
|
126
|
+
titulo: "Consulta cardiologista",
|
|
127
|
+
subtitulo: "Posto de saúde do bairro",
|
|
128
|
+
destaque: "",
|
|
129
|
+
categoria: {
|
|
130
|
+
nome: "Cardiologista",
|
|
131
|
+
icone: "cardiology",
|
|
132
|
+
},
|
|
133
|
+
status: "realizado",
|
|
134
|
+
criticidade: "alta",
|
|
135
|
+
acao: true,
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f8",
|
|
139
|
+
data: new Date("2023-05-03T12:30Z"),
|
|
140
|
+
previsto: new Date("2023-05-03T12:30Z"),
|
|
141
|
+
realizado: null,
|
|
142
|
+
duracao: null,
|
|
143
|
+
tolerancia: null,
|
|
144
|
+
titulo: "Dentista",
|
|
145
|
+
subtitulo: "Reta da Penha",
|
|
146
|
+
destaque: "",
|
|
147
|
+
categoria: {
|
|
148
|
+
nome: "Dentista",
|
|
149
|
+
icone: "dentistry",
|
|
150
|
+
},
|
|
151
|
+
status: "planejado",
|
|
152
|
+
criticidade: "baixa",
|
|
153
|
+
acao: false,
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f9",
|
|
157
|
+
data: new Date("2023-05-03T14:30Z"),
|
|
158
|
+
previsto: new Date("2023-05-03T14:30Z"),
|
|
159
|
+
realizado: null,
|
|
160
|
+
duracao: null,
|
|
161
|
+
tolerancia: null,
|
|
162
|
+
titulo: "Consulta",
|
|
163
|
+
subtitulo: "Hospital central",
|
|
164
|
+
destaque: "",
|
|
165
|
+
categoria: {
|
|
166
|
+
nome: "Consulta",
|
|
167
|
+
icone: "health_and_safety",
|
|
168
|
+
},
|
|
169
|
+
status: "planejado",
|
|
170
|
+
criticidade: "alta",
|
|
171
|
+
acao: true,
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f10",
|
|
175
|
+
data: new Date("2023-05-03T15:30Z"),
|
|
176
|
+
previsto: new Date("2023-05-03T15:30Z"),
|
|
177
|
+
realizado: null,
|
|
178
|
+
duracao: null,
|
|
179
|
+
tolerancia: null,
|
|
180
|
+
titulo: "Remédio de pressão",
|
|
181
|
+
subtitulo: "Aferir a pressão",
|
|
182
|
+
destaque: "",
|
|
183
|
+
categoria: {
|
|
184
|
+
nome: "Remédio",
|
|
185
|
+
icone: "pill",
|
|
186
|
+
},
|
|
187
|
+
status: "planejado",
|
|
188
|
+
criticidade: "alta",
|
|
189
|
+
acao: false,
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f11",
|
|
193
|
+
data: new Date("2023-05-03T16:00Z"),
|
|
194
|
+
previsto: new Date("2023-05-03T16:00Z"),
|
|
195
|
+
realizado: null,
|
|
196
|
+
duracao: null,
|
|
197
|
+
tolerancia: null,
|
|
198
|
+
titulo: "Checar temperatura",
|
|
199
|
+
subtitulo: "",
|
|
200
|
+
destaque: "",
|
|
201
|
+
categoria: {
|
|
202
|
+
nome: "Termometro",
|
|
203
|
+
icone: "thermometer_gain",
|
|
204
|
+
},
|
|
205
|
+
status: "planejado",
|
|
206
|
+
criticidade: "baixa",
|
|
207
|
+
acao: true,
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f12",
|
|
211
|
+
data: new Date("2023-05-03T17:30Z"),
|
|
212
|
+
previsto: new Date("2023-05-03T17:30Z"),
|
|
213
|
+
realizado: null,
|
|
214
|
+
duracao: null,
|
|
215
|
+
tolerancia: null,
|
|
216
|
+
titulo: "Avaliação Física",
|
|
217
|
+
subtitulo: "",
|
|
218
|
+
destaque: "IMC: 28,4",
|
|
219
|
+
categoria: {
|
|
220
|
+
nome: "Avaliação Física",
|
|
221
|
+
icone: "conditions",
|
|
222
|
+
},
|
|
223
|
+
status: "planejado",
|
|
224
|
+
criticidade: "baixa",
|
|
225
|
+
acao: false,
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f13",
|
|
229
|
+
data: new Date("2023-05-03T18:00Z"),
|
|
230
|
+
previsto: new Date("2023-05-03T18:00Z"),
|
|
231
|
+
realizado: null,
|
|
232
|
+
duracao: null,
|
|
233
|
+
tolerancia: null,
|
|
234
|
+
titulo: "Vacina da gripe",
|
|
235
|
+
subtitulo: "Posto de saúde do bairro",
|
|
236
|
+
destaque: "",
|
|
237
|
+
categoria: {
|
|
238
|
+
nome: "Vacina",
|
|
239
|
+
icone: "vaccines",
|
|
240
|
+
},
|
|
241
|
+
status: "planejado",
|
|
242
|
+
criticidade: "baixa",
|
|
243
|
+
acao: true,
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f14",
|
|
247
|
+
data: new Date("2023-05-03T19:00Z"),
|
|
248
|
+
previsto: new Date("2023-05-03T19:00Z"),
|
|
249
|
+
realizado: null,
|
|
250
|
+
duracao: null,
|
|
251
|
+
tolerancia: null,
|
|
252
|
+
titulo: "Vitamina D",
|
|
253
|
+
subtitulo: "2 comprimidos",
|
|
254
|
+
destaque: "",
|
|
255
|
+
categoria: {
|
|
256
|
+
nome: "Remédio",
|
|
257
|
+
icone: "pill",
|
|
258
|
+
},
|
|
259
|
+
status: "planejado",
|
|
260
|
+
criticidade: "baixa",
|
|
261
|
+
acao: false,
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f15",
|
|
265
|
+
data: new Date("2023-05-03T20:00Z"),
|
|
266
|
+
previsto: new Date("2023-05-03T20:00Z"),
|
|
267
|
+
realizado: null,
|
|
268
|
+
duracao: null,
|
|
269
|
+
tolerancia: null,
|
|
270
|
+
titulo: "Fisioterapia",
|
|
271
|
+
subtitulo: "",
|
|
272
|
+
destaque: "",
|
|
273
|
+
categoria: {
|
|
274
|
+
nome: "Fisioterapia",
|
|
275
|
+
icone: "physical_therapy",
|
|
276
|
+
},
|
|
277
|
+
status: "planejado",
|
|
278
|
+
criticidade: "baixa",
|
|
279
|
+
acao: true,
|
|
280
|
+
},
|
|
281
|
+
];
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import Timeline from './Timeline.vue';
|
|
2
|
+
import { Meta, StoryFn } from '@storybook/vue3';
|
|
3
|
+
import { dadosEventos, dadosPerfil } from './Timeline.mock';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Devix/Timeline/Organismos/Timeline',
|
|
7
|
+
component: Timeline,
|
|
8
|
+
parameters: {
|
|
9
|
+
componentSubtitle: 'Linha do tempo padrão com identidade da Devix',
|
|
10
|
+
},
|
|
11
|
+
argTypes: {},
|
|
12
|
+
} as Meta<typeof Timeline>;
|
|
13
|
+
|
|
14
|
+
const perfilMock = dadosPerfil;
|
|
15
|
+
|
|
16
|
+
const eventosPorDataMock = dadosEventos;
|
|
17
|
+
|
|
18
|
+
const Template: StoryFn<typeof Timeline> = (args) => ({
|
|
19
|
+
components: { Timeline: Timeline },
|
|
20
|
+
setup() {
|
|
21
|
+
return { args };
|
|
22
|
+
},
|
|
23
|
+
template:
|
|
24
|
+
'<Timeline :perfilTimeline="args.perfilTimeline" :eventosTimeline="args.eventosTimeline" style="position: relative" />',
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export const Padrao = Template.bind({});
|
|
28
|
+
Padrao.args = {
|
|
29
|
+
perfilTimeline: perfilMock,
|
|
30
|
+
eventosTimeline: eventosPorDataMock,
|
|
31
|
+
};
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div>
|
|
4
|
+
<PerfilTimeline
|
|
5
|
+
v-if="perfilTimeline !== null"
|
|
6
|
+
:nomePerfil="perfilTimeline.nome"
|
|
7
|
+
:imagemPerfil="perfilTimeline.imagem"
|
|
8
|
+
:iconePerfil="perfilTimeline.icone"
|
|
9
|
+
/>
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
<div
|
|
13
|
+
v-for="evento in eventosPorTipo"
|
|
14
|
+
:key="evento.key"
|
|
15
|
+
class="areaTimeline"
|
|
16
|
+
>
|
|
17
|
+
<!-- SEPARADOR -->
|
|
18
|
+
<div v-if="evento.tipo === 'dia'">
|
|
19
|
+
<SeparadorPeriodo :dataSeparador="evento.valor.toDateString()" />
|
|
20
|
+
</div>
|
|
21
|
+
<div v-if="evento.tipo === 'evento'">
|
|
22
|
+
<section class="timeline">
|
|
23
|
+
<!--loop-->
|
|
24
|
+
<EventoTimeline :dadosEvento="evento" />
|
|
25
|
+
</section>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<script lang="ts">
|
|
32
|
+
import { defineComponent, computed, reactive } from "vue";
|
|
33
|
+
import EventoTimeline from "../moleculas/EventoTimeline.vue";
|
|
34
|
+
import SeparadorPeriodo from "../moleculas/SeparadorPeriodo.vue";
|
|
35
|
+
import PerfilTimeline from "../moleculas/PerfilTimeline.vue";
|
|
36
|
+
import { Evento } from "../type";
|
|
37
|
+
|
|
38
|
+
type TipoEventoTimeline =
|
|
39
|
+
| { tipo: "dia"; valor: Date; key: number }
|
|
40
|
+
| { tipo: "evento"; valor: Evento; key: number; atual: boolean }
|
|
41
|
+
| { tipo: "eventos"; valor: Evento[]; key: number };
|
|
42
|
+
|
|
43
|
+
// type Ordem = 'ascendente' | 'descendente';
|
|
44
|
+
|
|
45
|
+
export default defineComponent({
|
|
46
|
+
props: {
|
|
47
|
+
perfilTimeline: {
|
|
48
|
+
required: true,
|
|
49
|
+
type: Object,
|
|
50
|
+
},
|
|
51
|
+
eventosTimeline: {
|
|
52
|
+
required: true,
|
|
53
|
+
type: Object,
|
|
54
|
+
},
|
|
55
|
+
// ordem: {
|
|
56
|
+
// required: false,
|
|
57
|
+
// type: Ordem,
|
|
58
|
+
// },
|
|
59
|
+
},
|
|
60
|
+
components: {
|
|
61
|
+
PerfilTimeline,
|
|
62
|
+
SeparadorPeriodo,
|
|
63
|
+
EventoTimeline,
|
|
64
|
+
},
|
|
65
|
+
setup(props) {
|
|
66
|
+
const dadosEventosTimeline: Evento[] = reactive(
|
|
67
|
+
props.eventosTimeline as Array<Evento>
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
const eventosOrdenados = dadosEventosTimeline.sort(
|
|
71
|
+
(a: Evento, b: Evento) => {
|
|
72
|
+
return a.data.getTime() - b.data.getTime();
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
const verifica_mesmo_dia = (a: Date, b: Date) => {
|
|
77
|
+
const mesmo_dia = a.getDay() === b.getDay();
|
|
78
|
+
const mesmo_mes = a.getMonth() === b.getMonth();
|
|
79
|
+
const mesmo_ano = a.getFullYear() === b.getFullYear();
|
|
80
|
+
return mesmo_dia && mesmo_mes && mesmo_ano;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
//verifica qual evento está mais próximo da hora atual e coloca ele numa nova lista na primeira posição
|
|
84
|
+
function filtraEventoAtual(eventos: Evento[]) {
|
|
85
|
+
if (eventos) {
|
|
86
|
+
const agora = Date.now();
|
|
87
|
+
let minDiff = null;
|
|
88
|
+
let listaEventos = [];
|
|
89
|
+
for (const e of eventos) {
|
|
90
|
+
const t = e.data.getTime();
|
|
91
|
+
const diff = Math.abs(agora - t);
|
|
92
|
+
if (minDiff === null || diff < minDiff) {
|
|
93
|
+
minDiff = diff;
|
|
94
|
+
listaEventos.length = 0;
|
|
95
|
+
}
|
|
96
|
+
//se o evento já estiver marcado como realizado, cancelado ou adiado, ele pula para o próximo da lista.
|
|
97
|
+
if (e.status === "planejado" || e.status === "atrasado") {
|
|
98
|
+
listaEventos.push(e);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return listaEventos;
|
|
102
|
+
} else {
|
|
103
|
+
console.log("vazio.. ", []);
|
|
104
|
+
return [];
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
const eventosFiltrados: Evento[] = filtraEventoAtual(eventosOrdenados);
|
|
108
|
+
const eventoAtual = eventosFiltrados[0]
|
|
109
|
+
? (eventosFiltrados[0] as Evento)
|
|
110
|
+
: null;
|
|
111
|
+
|
|
112
|
+
//lista de eventos
|
|
113
|
+
const eventosPorTipo = computed(() => {
|
|
114
|
+
if (dadosEventosTimeline) {
|
|
115
|
+
let result: Array<TipoEventoTimeline> = [];
|
|
116
|
+
let dataAtual: Date | null = null;
|
|
117
|
+
let idx = 0;
|
|
118
|
+
|
|
119
|
+
for (const evento of eventosOrdenados) {
|
|
120
|
+
const dataEvento = evento.data;
|
|
121
|
+
|
|
122
|
+
if (!dataAtual || !verifica_mesmo_dia(dataAtual, dataEvento)) {
|
|
123
|
+
dataAtual = dataEvento;
|
|
124
|
+
result.push({
|
|
125
|
+
tipo: "dia",
|
|
126
|
+
valor: evento.data,
|
|
127
|
+
key: ++idx,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
result.push({
|
|
132
|
+
tipo: "evento",
|
|
133
|
+
valor: evento,
|
|
134
|
+
key: ++idx,
|
|
135
|
+
atual:
|
|
136
|
+
eventoAtual === null
|
|
137
|
+
? false
|
|
138
|
+
: evento.id === eventoAtual.id
|
|
139
|
+
? true
|
|
140
|
+
: false,
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
return result;
|
|
144
|
+
} else {
|
|
145
|
+
return [];
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
return {
|
|
150
|
+
eventosPorTipo,
|
|
151
|
+
};
|
|
152
|
+
},
|
|
153
|
+
methods: {
|
|
154
|
+
scrollParaItemAtual() {
|
|
155
|
+
const itemAtual = document.querySelector(".atual");
|
|
156
|
+
itemAtual?.scrollIntoView({
|
|
157
|
+
behavior: "smooth",
|
|
158
|
+
block: "center",
|
|
159
|
+
});
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
mounted() {
|
|
163
|
+
this.scrollParaItemAtual();
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
</script>
|
|
167
|
+
|
|
168
|
+
<style scoped>
|
|
169
|
+
/* TIMELINE */
|
|
170
|
+
|
|
171
|
+
/* .areaTimeline {
|
|
172
|
+
max-width: 850px;
|
|
173
|
+
margin: 0 auto;
|
|
174
|
+
} */
|
|
175
|
+
|
|
176
|
+
.areaEvento {
|
|
177
|
+
display: table-row;
|
|
178
|
+
min-height: 8rem;
|
|
179
|
+
position: relative !important;
|
|
180
|
+
width: 100%;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.timeline {
|
|
184
|
+
display: table;
|
|
185
|
+
width: 100%;
|
|
186
|
+
position: relative;
|
|
187
|
+
}
|
|
188
|
+
</style>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type Perfil = {
|
|
2
|
+
nome: string;
|
|
3
|
+
imagem: string | null;
|
|
4
|
+
icone: string | null;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export type Evento = {
|
|
8
|
+
id: string;
|
|
9
|
+
data: Date;
|
|
10
|
+
previsto: Date;
|
|
11
|
+
duracao: number | null;
|
|
12
|
+
realizado: Date | null;
|
|
13
|
+
tolerancia: number | null;
|
|
14
|
+
titulo: string;
|
|
15
|
+
subtitulo: string;
|
|
16
|
+
destaque: string;
|
|
17
|
+
categoria: {
|
|
18
|
+
nome: string;
|
|
19
|
+
icone: string;
|
|
20
|
+
};
|
|
21
|
+
status:
|
|
22
|
+
| "atrasado"
|
|
23
|
+
| "adiantado"
|
|
24
|
+
| "adiado"
|
|
25
|
+
| "realizado"
|
|
26
|
+
| "planejado"
|
|
27
|
+
| "cancelado";
|
|
28
|
+
criticidade: string;
|
|
29
|
+
acao: boolean;
|
|
30
|
+
};
|
package/src/global.css
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/* GERAIS */
|
|
2
|
+
* {
|
|
3
|
+
margin: 0;
|
|
4
|
+
padding: 0;
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
-webkit-font-smoothing: antialiased;
|
|
7
|
+
-moz-osx-font-smoothing: grayscale;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
*:focus {
|
|
11
|
+
outline: none;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
:root {
|
|
15
|
+
--fonte: 'Work Sans', sans-serif;
|
|
16
|
+
font-size: 62.5%;
|
|
17
|
+
|
|
18
|
+
--cor-primaria: #00e01d;
|
|
19
|
+
--cor-secundaria: #1b2f39;
|
|
20
|
+
--cor-terciaria: #ebf1f2;
|
|
21
|
+
|
|
22
|
+
--cor-fundo: #fff;
|
|
23
|
+
|
|
24
|
+
--cor-selecao: #ccf9d2;
|
|
25
|
+
--cor-texto-selecao: #1b2f39;
|
|
26
|
+
--cor-texto: #1b2f39;
|
|
27
|
+
|
|
28
|
+
--cor-apoio: #57676f;
|
|
29
|
+
--cor-linha: #e9eaeb;
|
|
30
|
+
|
|
31
|
+
--cor-importante: #bb0202;
|
|
32
|
+
--cor-alerta: #f0cc0d;
|
|
33
|
+
--cor-sucesso: #00a816;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
:root .tema-escuro {
|
|
38
|
+
--fonte: 'Work Sans', sans-serif;
|
|
39
|
+
font-size: 62.5%;
|
|
40
|
+
|
|
41
|
+
--cor-primaria: #00e01d;
|
|
42
|
+
--cor-secundaria: #ebf1f2;
|
|
43
|
+
--cor-terciaria: #1b2f39;
|
|
44
|
+
|
|
45
|
+
--cor-fundo: #1b2f39;
|
|
46
|
+
|
|
47
|
+
--cor-selecao: #ccf9d2;
|
|
48
|
+
--cor-texto-selecao: #1b2f39;
|
|
49
|
+
--cor-texto: #f9f9f9;
|
|
50
|
+
|
|
51
|
+
--cor-apoio: #57676f;
|
|
52
|
+
--cor-linha: #e9eaeb;
|
|
53
|
+
|
|
54
|
+
--cor-importante: #bb0202;
|
|
55
|
+
--cor-alerta: #f0cc0d;
|
|
56
|
+
--cor-sucesso: #00a816;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
body {
|
|
60
|
+
font-family: var(--fonte);
|
|
61
|
+
font-size: 1.6rem;
|
|
62
|
+
font-weight: 300;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
h1 {
|
|
66
|
+
font-size: 2.4rem;
|
|
67
|
+
font-weight: 600;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
h2 {
|
|
71
|
+
font-size: 1.8rem;
|
|
72
|
+
font-weight: 600;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
h3 {
|
|
76
|
+
font-size: 1.4rem;
|
|
77
|
+
font-weight: 600;
|
|
78
|
+
margin: 0;
|
|
79
|
+
padding: 0;
|
|
80
|
+
line-height: 1em;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
h4 {
|
|
84
|
+
font-size: 1.2rem;
|
|
85
|
+
font-weight: 300;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.texto-pequeno {
|
|
89
|
+
font-size: 1rem;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.texto-medio {
|
|
93
|
+
font-size: 1.2rem;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.texto-grande {
|
|
97
|
+
font-size: 1.4rem;
|
|
98
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Plugin } from "vue";
|
|
2
|
+
import * as components from "./components/timeline";
|
|
3
|
+
import "./global.css";
|
|
4
|
+
|
|
5
|
+
const Timeline: Plugin = {
|
|
6
|
+
install(app, ...options) {
|
|
7
|
+
for (const key in components) {
|
|
8
|
+
// @ts-expect-error
|
|
9
|
+
app.component(key, components[key]);
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default Timeline;
|
|
15
|
+
|
|
16
|
+
export * from "./components/timeline";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|