@devix-tecnologia/timeline-vue 1.0.2 → 1.1.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.
Files changed (34) hide show
  1. package/README.md +138 -11
  2. package/dist/style.css +1 -1
  3. package/dist/timeline-vue.es.js +293 -256
  4. package/dist/types/components/timeline/atomos/AvatarTimeline.vue.d.ts +0 -1
  5. package/dist/types/components/timeline/atomos/BoxData.vue.d.ts +0 -1
  6. package/dist/types/components/timeline/atomos/Destaque.vue.d.ts +0 -1
  7. package/dist/types/components/timeline/atomos/Hora.vue.d.ts +0 -2
  8. package/dist/types/components/timeline/atomos/IconeCategoria.vue.d.ts +2 -3
  9. package/dist/types/components/timeline/atomos/IconeStatus.vue.d.ts +0 -1
  10. package/dist/types/components/timeline/atomos/SubtituloEvento.vue.d.ts +0 -1
  11. package/dist/types/components/timeline/atomos/TituloEvento.vue.d.ts +0 -1
  12. package/dist/types/components/timeline/moleculas/DescricaoEvento.vue.d.ts +0 -1
  13. package/dist/types/components/timeline/moleculas/EventoTimeline.vue.d.ts +84 -5
  14. package/dist/types/components/timeline/moleculas/HoraEvento.vue.d.ts +5 -3
  15. package/dist/types/components/timeline/moleculas/PerfilTimeline.vue.d.ts +0 -2
  16. package/dist/types/components/timeline/moleculas/SeparadorPeriodo.vue.d.ts +3 -7
  17. package/dist/types/components/timeline/moleculas/Topo.vue.d.ts +0 -1
  18. package/dist/types/components/timeline/organismos/Timeline.vue.d.ts +2 -5
  19. package/dist/types/components/timeline/type.d.ts +10 -7
  20. package/package.json +1 -1
  21. package/src/components/timeline/atomos/Destaque.vue +3 -3
  22. package/src/components/timeline/atomos/Hora.vue +7 -10
  23. package/src/components/timeline/atomos/IconeCategoria.vue +6 -6
  24. package/src/components/timeline/atomos/IconeStatus.vue +17 -16
  25. package/src/components/timeline/moleculas/DescricaoEvento.vue +5 -5
  26. package/src/components/timeline/moleculas/EventoTimeline.stories.ts +49 -49
  27. package/src/components/timeline/moleculas/EventoTimeline.vue +82 -26
  28. package/src/components/timeline/moleculas/HoraEvento.vue +5 -4
  29. package/src/components/timeline/moleculas/PerfilTimeline.vue +2 -3
  30. package/src/components/timeline/moleculas/SeparadorPeriodo.vue +26 -27
  31. package/src/components/timeline/organismos/Timeline.mock.ts +87 -57
  32. package/src/components/timeline/organismos/Timeline.stories.ts +22 -5
  33. package/src/components/timeline/organismos/Timeline.vue +97 -73
  34. package/src/components/timeline/type.ts +11 -7
@@ -1,41 +1,74 @@
1
1
  <template>
2
2
  <article
3
3
  class="eventoTimeline"
4
- :class="[
5
- dadosEvento.valor.status,
6
- 'criticidade-' + dadosEvento.valor.criticidade,
7
- eventoSelecionado,
8
- ]"
4
+ :class="[status, 'criticidade-' + criticidade, eventoSelecionado, clicavel]"
5
+ :onclick="aoCLicar"
9
6
  >
10
- <IconeStatus :status="dadosEvento.valor.status" />
11
- <HoraEvento
12
- :horaPrevista="dadosEvento.valor.previsto"
13
- :horaRealizada="dadosEvento.valor.realizado"
14
- />
7
+ <IconeStatus :status="status" />
8
+ <HoraEvento :horaPrevista="previsto" :horaRealizada="realizado" />
15
9
  <IconeCategoria
16
- :iconeCategoria="dadosEvento.valor.categoria.icone"
17
- :categoria="dadosEvento.valor.categoria.nome"
18
- />
19
- <DescricaoEvento
20
- :titulo="dadosEvento.valor.titulo"
21
- :subtitulo="dadosEvento.valor.subtitulo"
10
+ :iconeCategoria="categoria.icone"
11
+ :categoria="categoria.nome"
22
12
  />
23
- <Destaque :destaque="dadosEvento.valor.destaque" />
13
+ <DescricaoEvento :titulo="titulo" :subtitulo="subtitulo" />
14
+ <Destaque :destaque="destaque" />
24
15
  </article>
25
16
  </template>
26
17
  <script lang="ts">
27
- import { defineComponent, computed } from "vue";
18
+ import { defineComponent, computed, PropType } from "vue";
28
19
  import IconeCategoria from "../atomos/IconeCategoria.vue";
29
20
  import IconeStatus from "../atomos/IconeStatus.vue";
30
21
  import DescricaoEvento from "./DescricaoEvento.vue";
31
22
  import HoraEvento from "./HoraEvento.vue";
32
23
  import Destaque from "../atomos/Destaque.vue";
24
+ // import { Evento, Categoria } from "../type";
25
+
26
+ interface Categoria {
27
+ nome: string;
28
+ icone: string;
29
+ }
33
30
 
34
31
  export default defineComponent({
35
32
  props: {
36
- dadosEvento: {
33
+ status: {
34
+ required: true,
35
+ type: String,
36
+ },
37
+ criticidade: {
38
+ required: true,
39
+ type: String,
40
+ },
41
+ ehAtual: {
37
42
  required: true,
38
- type: Object,
43
+ type: Boolean,
44
+ },
45
+ previsto: {
46
+ required: true,
47
+ type: Date,
48
+ },
49
+ realizado: {
50
+ required: false,
51
+ type: Date as PropType<Date | null>,
52
+ },
53
+ categoria: {
54
+ required: true,
55
+ type: Object as () => Categoria,
56
+ },
57
+ titulo: {
58
+ required: true,
59
+ type: String,
60
+ },
61
+ subtitulo: {
62
+ required: true,
63
+ type: String,
64
+ },
65
+ destaque: {
66
+ required: true,
67
+ type: String,
68
+ },
69
+ aoCLicar: {
70
+ required: false,
71
+ type: Function as PropType<VoidFunction>,
39
72
  },
40
73
  },
41
74
  components: {
@@ -48,8 +81,11 @@ export default defineComponent({
48
81
  setup(props) {
49
82
  return {
50
83
  eventoSelecionado: computed(() => ({
51
- atual: props.dadosEvento.atual == true,
52
- padrao: props.dadosEvento.atual == false,
84
+ atual: props.ehAtual,
85
+ padrao: props.ehAtual,
86
+ })),
87
+ clicavel: computed(() => ({
88
+ clicavel: props.aoCLicar !== undefined,
53
89
  })),
54
90
  };
55
91
  },
@@ -64,6 +100,10 @@ export default defineComponent({
64
100
  border-radius: 1rem;
65
101
  }
66
102
 
103
+ .clicavel {
104
+ cursor: pointer;
105
+ }
106
+
67
107
  .eventoTimeline:hover {
68
108
  background: #f9f9f9;
69
109
  }
@@ -85,8 +125,8 @@ export default defineComponent({
85
125
  position: absolute;
86
126
  width: 2px;
87
127
  top: 0;
88
- height: 1.5rem;
89
- left: 11.7rem;
128
+ height: 2.5rem;
129
+ left: 11.9rem;
90
130
  }
91
131
 
92
132
  .eventoTimeline:after {
@@ -95,8 +135,24 @@ export default defineComponent({
95
135
  display: block;
96
136
  position: absolute;
97
137
  width: 2px;
98
- top: 5.1rem;
138
+ top: 6.1rem;
99
139
  bottom: 0;
100
- left: 11.7rem;
140
+ left: 11.9rem;
141
+ }
142
+
143
+ .eventoTimeline.atrasado:before {
144
+ background: var(--cor-alerta);
145
+ }
146
+
147
+ .eventoTimeline.atrasado:after {
148
+ background: var(--cor-alerta);
149
+ }
150
+
151
+ .eventoTimeline.atrasado:before {
152
+ background: var(--cor-alerta);
153
+ }
154
+
155
+ .eventoTimeline.atrasado:after {
156
+ background: var(--cor-alerta);
101
157
  }
102
158
  </style>
@@ -23,8 +23,8 @@
23
23
  </div>
24
24
  </template>
25
25
  <script lang="ts">
26
- import { defineComponent } from 'vue';
27
- import Hora from '../atomos/Hora.vue';
26
+ import { defineComponent, PropType } from "vue";
27
+ import Hora from "../atomos/Hora.vue";
28
28
 
29
29
  export default defineComponent({
30
30
  props: {
@@ -33,7 +33,8 @@ export default defineComponent({
33
33
  required: true,
34
34
  },
35
35
  horaRealizada: {
36
- type: Date,
36
+ required: false,
37
+ type: Date as PropType<Date | null>,
37
38
  },
38
39
  // aparencia: {
39
40
  // type: String,
@@ -56,7 +57,7 @@ export default defineComponent({
56
57
  display: table-cell;
57
58
  vertical-align: top;
58
59
  text-align: right;
59
- padding: 1.4rem 0;
60
+ padding: 2.4rem 0;
60
61
  }
61
62
  .horaEvento {
62
63
  line-height: 1.4rem;
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div
2
+ <section
3
3
  class="perfilTimeline"
4
4
  ref="elementoFixo"
5
5
  :style="style"
@@ -9,7 +9,7 @@
9
9
  <AvatarTimeline v-if="imagemPerfil" :imagem="imagemPerfil" />
10
10
  <AvatarTimeline v-else-if="iconePerfil" :icone="iconePerfil" />
11
11
  <h2 class="nome">{{ nomePerfil }}</h2>
12
- </div>
12
+ </section>
13
13
  </template>
14
14
 
15
15
  <script lang="ts">
@@ -68,7 +68,6 @@ export default defineComponent({
68
68
 
69
69
  return {
70
70
  style,
71
- elementoFixo,
72
71
  isFixed,
73
72
  };
74
73
  },
@@ -1,14 +1,17 @@
1
1
  <template>
2
2
  <div class="separadorPeriodo">
3
3
  <div class="areaData">
4
- <BoxData :dataNumero="dia" :aparencia="aparencia" />
4
+ <BoxData :dataNumero="dataSeparador.getDate()" :aparencia="aparencia" />
5
5
  </div>
6
- <h3 class="titulo" :class="aparencia">{{ mes }} de {{ ano }}</h3>
6
+ <h3 class="titulo" :class="aparencia">
7
+ {{ mesCorrente(dataSeparador.getMonth()) }} de
8
+ {{ dataSeparador.getFullYear() }}
9
+ </h3>
7
10
  </div>
8
11
  </template>
9
12
 
10
13
  <script lang="ts">
11
- import { defineComponent } from "vue";
14
+ import { defineComponent, ref } from "vue";
12
15
  import BoxData from "../atomos/BoxData.vue";
13
16
 
14
17
  export default defineComponent({
@@ -16,7 +19,7 @@ export default defineComponent({
16
19
  props: {
17
20
  dataSeparador: {
18
21
  required: true,
19
- type: String,
22
+ type: Date,
20
23
  },
21
24
  aparencia: {
22
25
  type: String,
@@ -24,28 +27,24 @@ export default defineComponent({
24
27
  },
25
28
  components: { BoxData },
26
29
  setup(props) {
27
- const numeroMes = [
28
- "janeiro",
29
- "fevereiro",
30
- "março",
31
- "abril",
32
- "maio",
33
- "junho",
34
- "julho",
35
- "agosto",
36
- "setembro",
37
- "outubro",
38
- "novembro",
39
- "dezembro",
40
- ];
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";
41
43
 
42
- // eslint-disable-next-line vue/no-setup-props-destructure
43
- const dataRecebida = props.dataSeparador;
44
- const data = new Date(dataRecebida);
45
- const ano = data.getFullYear();
46
- const mes = numeroMes[data.getMonth()];
47
- const dia = data.getDate();
48
- return { dataRecebida, ano, mes, dia };
44
+ const mesCorrente = (mes: number) => {
45
+ return arrayMes[mes];
46
+ };
47
+ return { mesCorrente };
49
48
  },
50
49
  });
51
50
  </script>
@@ -75,7 +74,7 @@ export default defineComponent({
75
74
  width: 2px;
76
75
  height: 2.5rem;
77
76
  top: 0;
78
- left: 11.7rem;
77
+ left: 11.9rem;
79
78
  }
80
79
 
81
80
  .areaData:after {
@@ -86,7 +85,7 @@ export default defineComponent({
86
85
  width: 2px;
87
86
  height: 2.5rem;
88
87
  bottom: 0;
89
- left: 11.7rem;
88
+ left: 11.9rem;
90
89
  }
91
90
 
92
91
  .separadorPeriodo .titulo {
@@ -14,7 +14,7 @@ export const dadosEventos: Evento[] = [
14
14
  previsto: new Date("2023-04-26T19:00Z"),
15
15
  realizado: new Date("2023-04-26T19:30Z"),
16
16
  duracao: null,
17
- tolerancia: null,
17
+ tolerancia: 10,
18
18
  titulo: "Vacina da Covid",
19
19
  subtitulo: "Posto de saúde do bairro",
20
20
  destaque: "",
@@ -24,7 +24,9 @@ export const dadosEventos: Evento[] = [
24
24
  },
25
25
  status: "realizado",
26
26
  criticidade: "media",
27
- acao: false,
27
+
28
+ atual: false,
29
+ scroll: false,
28
30
  },
29
31
  {
30
32
  id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f2",
@@ -32,7 +34,7 @@ export const dadosEventos: Evento[] = [
32
34
  previsto: new Date("2023-04-26T18:10Z"),
33
35
  realizado: new Date("2023-04-26T18:15Z"),
34
36
  duracao: null,
35
- tolerancia: null,
37
+ tolerancia: 10,
36
38
  titulo: "Vacina da gripe",
37
39
  subtitulo: "Posto de saúde do bairro",
38
40
  destaque: "",
@@ -42,15 +44,17 @@ export const dadosEventos: Evento[] = [
42
44
  },
43
45
  status: "cancelado",
44
46
  criticidade: "baixa",
45
- acao: false,
47
+
48
+ atual: false,
49
+ scroll: false,
46
50
  },
47
51
  {
48
52
  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"),
53
+ data: new Date("2023-05-03T11:00Z"),
54
+ previsto: new Date("2023-05-03T11:00Z"),
55
+ realizado: null,
52
56
  duracao: null,
53
- tolerancia: null,
57
+ tolerancia: 10,
54
58
  titulo: "Ligar para médica",
55
59
  subtitulo: "",
56
60
  destaque: "",
@@ -60,15 +64,17 @@ export const dadosEventos: Evento[] = [
60
64
  },
61
65
  status: "planejado",
62
66
  criticidade: "baixa",
63
- acao: true,
67
+
68
+ atual: false,
69
+ scroll: false,
64
70
  },
65
71
  {
66
72
  id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f4",
67
- data: new Date("2023-05-03T10:00Z"),
68
- previsto: new Date("2023-05-03T10:00Z"),
73
+ data: new Date("2023-05-03T15:00Z"),
74
+ previsto: new Date("2023-05-03T15:00Z"),
69
75
  realizado: null,
70
76
  duracao: null,
71
- tolerancia: null,
77
+ tolerancia: 10,
72
78
  titulo: "Passeio no parque",
73
79
  subtitulo: "",
74
80
  destaque: "",
@@ -78,15 +84,17 @@ export const dadosEventos: Evento[] = [
78
84
  },
79
85
  status: "planejado",
80
86
  criticidade: "baixa",
81
- acao: false,
87
+
88
+ atual: false,
89
+ scroll: false,
82
90
  },
83
91
  {
84
92
  id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f5",
85
- data: new Date("2023-05-03T11:00Z"),
86
- previsto: new Date("2023-05-03T11:00Z"),
93
+ data: new Date("2023-05-03T20:00Z"),
94
+ previsto: new Date("2023-05-03T20:00Z"),
87
95
  realizado: null,
88
96
  duracao: null,
89
- tolerancia: null,
97
+ tolerancia: 10,
90
98
  titulo: "Exames do coração",
91
99
  subtitulo: "Hospital do Coração",
92
100
  destaque: "",
@@ -96,15 +104,17 @@ export const dadosEventos: Evento[] = [
96
104
  },
97
105
  status: "planejado",
98
106
  criticidade: "media",
99
- acao: true,
107
+
108
+ atual: false,
109
+ scroll: false,
100
110
  },
101
111
  {
102
112
  id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f6",
103
- data: new Date("2023-05-01T12:00Z"),
104
- previsto: new Date("2023-05-01T12:00Z"),
113
+ data: new Date("2023-04-01T12:00Z"),
114
+ previsto: new Date("2023-04-01T12:00Z"),
105
115
  realizado: null,
106
116
  duracao: null,
107
- tolerancia: null,
117
+ tolerancia: 10,
108
118
  titulo: "Consulta",
109
119
  subtitulo: "Posto de saúde",
110
120
  destaque: "Remarcado",
@@ -114,15 +124,17 @@ export const dadosEventos: Evento[] = [
114
124
  },
115
125
  status: "adiado",
116
126
  criticidade: "baixa",
117
- acao: false,
127
+
128
+ atual: false,
129
+ scroll: false,
118
130
  },
119
131
  {
120
132
  id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f7",
121
- data: new Date("2023-05-01T13:00Z"),
122
- previsto: new Date("2023-05-01T13:00Z"),
133
+ data: new Date("2023-04-01T13:00Z"),
134
+ previsto: new Date("2023-04-01T13:00Z"),
123
135
  realizado: null,
124
136
  duracao: null,
125
- tolerancia: null,
137
+ tolerancia: 10,
126
138
  titulo: "Consulta cardiologista",
127
139
  subtitulo: "Posto de saúde do bairro",
128
140
  destaque: "",
@@ -132,15 +144,17 @@ export const dadosEventos: Evento[] = [
132
144
  },
133
145
  status: "realizado",
134
146
  criticidade: "alta",
135
- acao: true,
147
+
148
+ atual: false,
149
+ scroll: false,
136
150
  },
137
151
  {
138
152
  id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f8",
139
- data: new Date("2023-05-03T12:30Z"),
140
- previsto: new Date("2023-05-03T12:30Z"),
153
+ data: new Date("2023-05-03T12:00Z"),
154
+ previsto: new Date("2023-05-03T12:00Z"),
141
155
  realizado: null,
142
156
  duracao: null,
143
- tolerancia: null,
157
+ tolerancia: 10,
144
158
  titulo: "Dentista",
145
159
  subtitulo: "Reta da Penha",
146
160
  destaque: "",
@@ -150,15 +164,17 @@ export const dadosEventos: Evento[] = [
150
164
  },
151
165
  status: "planejado",
152
166
  criticidade: "baixa",
153
- acao: false,
167
+
168
+ atual: false,
169
+ scroll: false,
154
170
  },
155
171
  {
156
172
  id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f9",
157
- data: new Date("2023-05-03T14:30Z"),
158
- previsto: new Date("2023-05-03T14:30Z"),
173
+ data: new Date("2023-05-03T13:00Z"),
174
+ previsto: new Date("2023-05-03T13:00Z"),
159
175
  realizado: null,
160
176
  duracao: null,
161
- tolerancia: null,
177
+ tolerancia: 10,
162
178
  titulo: "Consulta",
163
179
  subtitulo: "Hospital central",
164
180
  destaque: "",
@@ -168,15 +184,17 @@ export const dadosEventos: Evento[] = [
168
184
  },
169
185
  status: "planejado",
170
186
  criticidade: "alta",
171
- acao: true,
187
+
188
+ atual: false,
189
+ scroll: false,
172
190
  },
173
191
  {
174
192
  id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f10",
175
- data: new Date("2023-05-03T15:30Z"),
176
- previsto: new Date("2023-05-03T15:30Z"),
193
+ data: new Date("2023-05-03T14:27Z"),
194
+ previsto: new Date("2023-05-03T14:27Z"),
177
195
  realizado: null,
178
196
  duracao: null,
179
- tolerancia: null,
197
+ tolerancia: 10,
180
198
  titulo: "Remédio de pressão",
181
199
  subtitulo: "Aferir a pressão",
182
200
  destaque: "",
@@ -186,15 +204,17 @@ export const dadosEventos: Evento[] = [
186
204
  },
187
205
  status: "planejado",
188
206
  criticidade: "alta",
189
- acao: false,
207
+
208
+ atual: false,
209
+ scroll: false,
190
210
  },
191
211
  {
192
212
  id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f11",
193
- data: new Date("2023-05-03T16:00Z"),
194
- previsto: new Date("2023-05-03T16:00Z"),
213
+ data: new Date("2023-05-03T15:00Z"),
214
+ previsto: new Date("2023-05-03T15:00Z"),
195
215
  realizado: null,
196
216
  duracao: null,
197
- tolerancia: null,
217
+ tolerancia: 10,
198
218
  titulo: "Checar temperatura",
199
219
  subtitulo: "",
200
220
  destaque: "",
@@ -204,15 +224,17 @@ export const dadosEventos: Evento[] = [
204
224
  },
205
225
  status: "planejado",
206
226
  criticidade: "baixa",
207
- acao: true,
227
+
228
+ atual: false,
229
+ scroll: false,
208
230
  },
209
231
  {
210
232
  id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f12",
211
- data: new Date("2023-05-03T17:00Z"),
212
- previsto: new Date("2023-05-03T17:00Z"),
233
+ data: new Date("2023-05-08T16:00Z"),
234
+ previsto: new Date("2023-05-08T16:00Z"),
213
235
  realizado: null,
214
236
  duracao: null,
215
- tolerancia: null,
237
+ tolerancia: 10,
216
238
  titulo: "Avaliação Física",
217
239
  subtitulo: "",
218
240
  destaque: "IMC: 28,4",
@@ -222,15 +244,17 @@ export const dadosEventos: Evento[] = [
222
244
  },
223
245
  status: "planejado",
224
246
  criticidade: "baixa",
225
- acao: false,
247
+
248
+ atual: false,
249
+ scroll: false,
226
250
  },
227
251
  {
228
252
  id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f13",
229
- data: new Date("2023-05-03T18:00Z"),
230
- previsto: new Date("2023-05-03T18:00Z"),
253
+ data: new Date("2023-05-09T19:00Z"),
254
+ previsto: new Date("2023-05-09T19:00Z"),
231
255
  realizado: null,
232
256
  duracao: null,
233
- tolerancia: null,
257
+ tolerancia: 10,
234
258
  titulo: "Vacina da gripe",
235
259
  subtitulo: "Posto de saúde do bairro",
236
260
  destaque: "",
@@ -240,15 +264,17 @@ export const dadosEventos: Evento[] = [
240
264
  },
241
265
  status: "planejado",
242
266
  criticidade: "baixa",
243
- acao: true,
267
+
268
+ atual: false,
269
+ scroll: false,
244
270
  },
245
271
  {
246
272
  id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f14",
247
- data: new Date("2023-05-03T19:00Z"),
248
- previsto: new Date("2023-05-03T19:00Z"),
273
+ data: new Date("2023-05-09T17:00Z"),
274
+ previsto: new Date("2023-05-09T17:00Z"),
249
275
  realizado: null,
250
276
  duracao: null,
251
- tolerancia: null,
277
+ tolerancia: 10,
252
278
  titulo: "Vitamina D",
253
279
  subtitulo: "2 comprimidos",
254
280
  destaque: "",
@@ -258,15 +284,17 @@ export const dadosEventos: Evento[] = [
258
284
  },
259
285
  status: "planejado",
260
286
  criticidade: "baixa",
261
- acao: false,
287
+ aoCLicar: () => alert("Olá, mundo!"),
288
+ atual: false,
289
+ scroll: false,
262
290
  },
263
291
  {
264
292
  id: "15ea7863-2402-4b84-8a8d-10a00ba07e2f15",
265
- data: new Date("2023-05-03T20:00Z"),
266
- previsto: new Date("2023-05-03T20:00Z"),
293
+ data: new Date("2023-05-09T18:01Z"),
294
+ previsto: new Date("2023-05-09T18:00Z"),
267
295
  realizado: null,
268
296
  duracao: null,
269
- tolerancia: null,
297
+ tolerancia: 10,
270
298
  titulo: "Fisioterapia",
271
299
  subtitulo: "",
272
300
  destaque: "",
@@ -276,6 +304,8 @@ export const dadosEventos: Evento[] = [
276
304
  },
277
305
  status: "planejado",
278
306
  criticidade: "baixa",
279
- acao: true,
307
+
308
+ atual: false,
309
+ scroll: false,
280
310
  },
281
311
  ];
@@ -1,12 +1,13 @@
1
- import Timeline from './Timeline.vue';
2
- import { Meta, StoryFn } from '@storybook/vue3';
3
- import { dadosEventos, dadosPerfil } from './Timeline.mock';
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";
4
5
 
5
6
  export default {
6
- title: 'Devix/Timeline/Organismos/Timeline',
7
+ title: "Devix/Timeline/Organismos/Timeline",
7
8
  component: Timeline,
8
9
  parameters: {
9
- componentSubtitle: 'Linha do tempo padrão com identidade da Devix',
10
+ componentSubtitle: "Linha do tempo padrão com identidade da Devix",
10
11
  },
11
12
  argTypes: {},
12
13
  } as Meta<typeof Timeline>;
@@ -15,6 +16,22 @@ const perfilMock = dadosPerfil;
15
16
 
16
17
  const eventosPorDataMock = dadosEventos;
17
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
+
18
35
  const Template: StoryFn<typeof Timeline> = (args) => ({
19
36
  components: { Timeline: Timeline },
20
37
  setup() {