@devix-tecnologia/timeline-vue 1.1.1 → 1.2.0
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 +39 -36
- package/dist/style.css +1 -1
- package/dist/timeline-vue.es.js +230 -257
- package/dist/types/components/timeline/EventoDetalhado.mock.d.ts +4 -0
- package/dist/types/components/timeline/Templates/AdiantarHorario.vue.d.ts +35 -0
- package/dist/types/components/timeline/Templates/AdicionarObservacao.vue.d.ts +29 -0
- package/dist/types/components/timeline/Templates/EditarStatus.vue.d.ts +36 -0
- package/dist/types/components/timeline/Templates/TemplateEvento.vue.d.ts +24 -0
- package/dist/types/components/timeline/atomos/AvatarTimeline.vue.d.ts +1 -1
- package/dist/types/components/timeline/atomos/Destaque.vue.d.ts +3 -3
- package/dist/types/components/timeline/atomos/Hora.vue.d.ts +70 -1
- package/dist/types/components/timeline/atomos/IconeCategoria.vue.d.ts +1 -0
- package/dist/types/components/timeline/atomos/IconeStatus.vue.d.ts +1 -0
- package/dist/types/components/timeline/atomos/SubtituloEvento.vue.d.ts +1 -1
- package/dist/types/components/timeline/atomos/TituloEvento.vue.d.ts +1 -1
- package/dist/types/components/timeline/index.d.ts +2 -1
- package/dist/types/components/timeline/moleculas/AreaSalvamento.vue.d.ts +15 -0
- package/dist/types/components/timeline/moleculas/Botao.vue.d.ts +43 -0
- package/dist/types/components/timeline/moleculas/BotaoStatus.vue.d.ts +33 -0
- package/dist/types/components/timeline/moleculas/CabecalhoEventoDetalhado.vue.d.ts +32 -0
- package/dist/types/components/timeline/moleculas/DescricaoEvento.vue.d.ts +3 -3
- package/dist/types/components/timeline/moleculas/EventoTimeline.vue.d.ts +9 -12
- package/dist/types/components/timeline/moleculas/HoraEvento.vue.d.ts +1 -1
- package/dist/types/components/timeline/moleculas/Observacoes.vue.d.ts +30 -0
- package/dist/types/components/timeline/moleculas/PerfilTimeline.vue.d.ts +11 -9
- package/dist/types/components/timeline/moleculas/SeparadorPeriodo.vue.d.ts +0 -6
- package/dist/types/components/timeline/moleculas/StatusEvento.vue.d.ts +29 -0
- package/dist/types/components/timeline/moleculas/Topo.vue.d.ts +28 -1
- package/dist/types/components/timeline/organismos/EditarEvento.vue.d.ts +28 -0
- package/dist/types/components/timeline/organismos/EventoDetalhado.vue.d.ts +24 -0
- package/dist/types/components/timeline/organismos/Timeline.vue.d.ts +3 -2
- package/dist/types/components/timeline/type.d.ts +2 -2
- package/dist/types/components/timeline/typeDetalhado.d.ts +15 -0
- package/package.json +3 -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 -76
- 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 -217
- 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,217 +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
|
-
|
|
10
|
-
<section class="timeline" :class="{ marginTop: perfilTimeline !== null }">
|
|
11
|
-
<!-- SEPARADOR -->
|
|
12
|
-
<div v-for="evento in eventosPorTipo" :key="evento.key">
|
|
13
|
-
<SeparadorPeriodo
|
|
14
|
-
v-if="evento.tipo === 'dia'"
|
|
15
|
-
:dataSeparador="evento.valor"
|
|
16
|
-
/>
|
|
17
|
-
<!--loop-->
|
|
18
|
-
<EventoTimeline
|
|
19
|
-
v-if="evento.tipo === 'evento'"
|
|
20
|
-
:status="evento.valor.status"
|
|
21
|
-
:criticidade="evento.valor.criticidade"
|
|
22
|
-
:previsto="evento.valor.previsto"
|
|
23
|
-
:realizado="evento.valor.realizado"
|
|
24
|
-
:categoria="evento.valor.categoria"
|
|
25
|
-
:titulo="evento.valor.titulo"
|
|
26
|
-
:subtitulo="evento.valor.subtitulo"
|
|
27
|
-
:destaque="evento.valor.destaque"
|
|
28
|
-
:ehAtual="evento.valor.atual"
|
|
29
|
-
:aoCLicar="evento.valor.aoCLicar"
|
|
30
|
-
/>
|
|
31
|
-
</div>
|
|
32
|
-
</section>
|
|
33
|
-
</div>
|
|
34
|
-
</template>
|
|
35
|
-
|
|
36
|
-
<script lang="ts">
|
|
37
|
-
import { defineComponent, computed, reactive } from "vue";
|
|
38
|
-
import EventoTimeline from "../moleculas/EventoTimeline.vue";
|
|
39
|
-
import SeparadorPeriodo from "../moleculas/SeparadorPeriodo.vue";
|
|
40
|
-
import PerfilTimeline from "../moleculas/PerfilTimeline.vue";
|
|
41
|
-
import { Evento } from "../type";
|
|
42
|
-
|
|
43
|
-
type TipoEventoTimeline =
|
|
44
|
-
| { tipo: "dia"; valor: Date; key: number }
|
|
45
|
-
| { tipo: "evento"; valor: Evento; key: number }
|
|
46
|
-
| { tipo: "eventos"; valor: Evento[]; key: number };
|
|
47
|
-
|
|
48
|
-
export default defineComponent({
|
|
49
|
-
props: {
|
|
50
|
-
perfilTimeline: {
|
|
51
|
-
required: true,
|
|
52
|
-
type: Object,
|
|
53
|
-
},
|
|
54
|
-
eventosTimeline: {
|
|
55
|
-
required: true,
|
|
56
|
-
type: Object,
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
components: {
|
|
60
|
-
PerfilTimeline,
|
|
61
|
-
SeparadorPeriodo,
|
|
62
|
-
EventoTimeline,
|
|
63
|
-
},
|
|
64
|
-
setup(props) {
|
|
65
|
-
const dadosEventosTimeline: Evento[] = reactive(
|
|
66
|
-
props.eventosTimeline as Array<Evento>
|
|
67
|
-
);
|
|
68
|
-
let dadosEventosTimelineClone: Evento[] = reactive(dadosEventosTimeline);
|
|
69
|
-
|
|
70
|
-
function carregarListaEventos() {
|
|
71
|
-
dadosEventosTimelineClone = dadosEventosTimeline;
|
|
72
|
-
const resultado: Evento[] = filtraEventoAtual(dadosEventosTimelineClone);
|
|
73
|
-
dadosEventosTimelineClone.map((resp) => {
|
|
74
|
-
if (resultado[0].id === resp.id) {
|
|
75
|
-
resp.atual = true;
|
|
76
|
-
resp.scroll = true;
|
|
77
|
-
void scrollParaItemAtual();
|
|
78
|
-
} else {
|
|
79
|
-
resp.atual = false;
|
|
80
|
-
resp.scroll = false;
|
|
81
|
-
}
|
|
82
|
-
return {
|
|
83
|
-
evento: resp,
|
|
84
|
-
};
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const atualizarEventoAtual = () => {
|
|
89
|
-
setInterval(carregarListaEventos, 60000);
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
const verifica_mesmo_dia = (a: Date, b: Date) => {
|
|
93
|
-
const mesmo_dia = a.getDay() === b.getDay();
|
|
94
|
-
const mesmo_mes = a.getMonth() === b.getMonth();
|
|
95
|
-
const mesmo_ano = a.getFullYear() === b.getFullYear();
|
|
96
|
-
return mesmo_dia && mesmo_mes && mesmo_ano;
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
//verifica qual evento está mais próximo da hora atual e coloca ele numa nova lista na primeira posição
|
|
100
|
-
const filtraEventoAtual = (eventos: Evento[]) => {
|
|
101
|
-
if (eventos) {
|
|
102
|
-
const agora = Date.now();
|
|
103
|
-
let minDiff: number | null = null;
|
|
104
|
-
let listaEventos = [];
|
|
105
|
-
for (const e of eventos) {
|
|
106
|
-
const t = e.data.getTime();
|
|
107
|
-
if (e.status === "planejado" || e.status === "atrasado") {
|
|
108
|
-
const diff: number = Math.abs(agora - e.data.getTime());
|
|
109
|
-
if (minDiff === null || (diff < minDiff && t <= agora)) {
|
|
110
|
-
minDiff = diff;
|
|
111
|
-
listaEventos.length = 0;
|
|
112
|
-
} else if (diff > minDiff) {
|
|
113
|
-
continue;
|
|
114
|
-
}
|
|
115
|
-
listaEventos.push(e);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
return listaEventos;
|
|
119
|
-
} else {
|
|
120
|
-
return [];
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
// lista de eventos por tipo
|
|
125
|
-
const eventosTimeline = computed(() => {
|
|
126
|
-
void atualizarEventoAtual();
|
|
127
|
-
|
|
128
|
-
const eventosOrdenados = dadosEventosTimelineClone.sort(
|
|
129
|
-
(a: Evento, b: Evento) => {
|
|
130
|
-
return a.data.getTime() - b.data.getTime();
|
|
131
|
-
}
|
|
132
|
-
);
|
|
133
|
-
if (eventosOrdenados) {
|
|
134
|
-
let resultado: Array<TipoEventoTimeline> = [];
|
|
135
|
-
let dataAtual: Date | null = null;
|
|
136
|
-
let idx = 0;
|
|
137
|
-
let statusEvento;
|
|
138
|
-
|
|
139
|
-
for (const evento of eventosOrdenados) {
|
|
140
|
-
const agora = new Date();
|
|
141
|
-
const dataEvento = evento.data;
|
|
142
|
-
statusEvento = evento.status;
|
|
143
|
-
const toleranciaEvento = evento.tolerancia * 60 * 1000;
|
|
144
|
-
|
|
145
|
-
//altera status para atrasado
|
|
146
|
-
if (
|
|
147
|
-
statusEvento === "planejado" &&
|
|
148
|
-
dataEvento.getTime() + toleranciaEvento < agora.getTime()
|
|
149
|
-
) {
|
|
150
|
-
evento.status = "atrasado";
|
|
151
|
-
}
|
|
152
|
-
if (!dataAtual || !verifica_mesmo_dia(dataAtual, dataEvento)) {
|
|
153
|
-
dataAtual = dataEvento;
|
|
154
|
-
resultado.push({
|
|
155
|
-
tipo: "dia",
|
|
156
|
-
valor: evento.data,
|
|
157
|
-
key: ++idx,
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
resultado.push({
|
|
161
|
-
tipo: "evento",
|
|
162
|
-
valor: evento,
|
|
163
|
-
key: ++idx,
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
return resultado;
|
|
167
|
-
} else {
|
|
168
|
-
return [];
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
const scrollParaItemAtual = () => {
|
|
173
|
-
const itemAtual = document.querySelector(".atual");
|
|
174
|
-
itemAtual?.scrollIntoView({
|
|
175
|
-
behavior: "smooth",
|
|
176
|
-
block: "center",
|
|
177
|
-
});
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
carregarListaEventos();
|
|
181
|
-
return {
|
|
182
|
-
eventosPorTipo: eventosTimeline,
|
|
183
|
-
scrollParaItemAtual,
|
|
184
|
-
};
|
|
185
|
-
},
|
|
186
|
-
mounted() {
|
|
187
|
-
// Aguardando a renderização para fazer scroll
|
|
188
|
-
this.scrollParaItemAtual();
|
|
189
|
-
},
|
|
190
|
-
});
|
|
191
|
-
</script>
|
|
192
|
-
|
|
193
|
-
<style scoped>
|
|
194
|
-
/* TIMELINE */
|
|
195
|
-
|
|
196
|
-
/* .areaTimeline {
|
|
197
|
-
max-width: 850px;
|
|
198
|
-
margin: 0 auto;
|
|
199
|
-
} */
|
|
200
|
-
|
|
201
|
-
.areaEvento {
|
|
202
|
-
display: table-row;
|
|
203
|
-
min-height: 8rem;
|
|
204
|
-
position: relative !important;
|
|
205
|
-
width: 100%;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
.timeline {
|
|
209
|
-
display: table;
|
|
210
|
-
width: 100%;
|
|
211
|
-
position: relative;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
.marginTop {
|
|
215
|
-
margin-top: 8rem;
|
|
216
|
-
}
|
|
217
|
-
</style>
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export type Perfil = {
|
|
2
|
-
nome: string;
|
|
3
|
-
imagem: string | null;
|
|
4
|
-
icone: string | null;
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export type Categoria = {
|
|
8
|
-
nome: string;
|
|
9
|
-
icone: string;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export type Evento = {
|
|
13
|
-
id: string;
|
|
14
|
-
data: Date;
|
|
15
|
-
previsto: Date;
|
|
16
|
-
duracao: number | null;
|
|
17
|
-
realizado: Date | null;
|
|
18
|
-
tolerancia: number;
|
|
19
|
-
titulo: string;
|
|
20
|
-
subtitulo: string;
|
|
21
|
-
destaque: string;
|
|
22
|
-
categoria: Categoria;
|
|
23
|
-
status:
|
|
24
|
-
| "atrasado"
|
|
25
|
-
| "adiantado"
|
|
26
|
-
| "adiado"
|
|
27
|
-
| "realizado"
|
|
28
|
-
| "planejado"
|
|
29
|
-
| "cancelado";
|
|
30
|
-
criticidade: "baixa" | "media" | "alta";
|
|
31
|
-
aoCLicar?: VoidFunction;
|
|
32
|
-
atual: boolean;
|
|
33
|
-
scroll: boolean;
|
|
34
|
-
};
|
package/src/global.css
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
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";
|
package/src/vite-env.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/// <reference types="vite/client" />
|