@devix-tecnologia/timeline-vue 1.0.1 → 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 +2 -2
  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,17 +1,17 @@
1
- import EventoTimeline from './EventoTimeline.vue';
2
- import { Meta, StoryFn } from '@storybook/vue3';
1
+ import EventoTimeline from "./EventoTimeline.vue";
2
+ import { Meta, StoryFn } from "@storybook/vue3";
3
3
 
4
4
  export default {
5
- title: 'Devix/Timeline/Moleculas/EventoTimeline',
5
+ title: "Devix/Timeline/Moleculas/EventoTimeline",
6
6
  component: EventoTimeline,
7
7
  argTypes: {
8
8
  status: {
9
- control: { type: 'select' },
10
- options: ['planejado', 'realizado', 'cancelado', 'adiado', 'atrasado'],
9
+ control: { type: "select" },
10
+ options: ["planejado", "realizado", "cancelado", "adiado", "atrasado"],
11
11
  },
12
12
  criticidade: {
13
- control: { type: 'select' },
14
- options: ['normal', 'media', 'alta'],
13
+ control: { type: "select" },
14
+ options: ["normal", "media", "alta"],
15
15
  },
16
16
  },
17
17
  } as Meta<typeof EventoTimeline>;
@@ -21,74 +21,74 @@ const Template: StoryFn<typeof EventoTimeline> = (args) => ({
21
21
  setup() {
22
22
  return { args };
23
23
  },
24
- template: '<EventoTimeline :dadosEvento="args" />',
24
+ template:
25
+ '<EventoTimeline :status="args.status" :criticidade="args.criticidade" :ehAtual="args.ehAtual" :previsto="args.previsto" :realizado="args.realizado" :categoria="args.categoria" :titulo="args.titulo" :subtitulo="args.subtitulo" :destaque="args.destaque" />',
25
26
  });
26
27
 
27
28
  export const Padrao = Template.bind({});
28
29
  Padrao.args = {
29
- previsto: '2023-04-19T11:00Z',
30
- realizado: '',
31
- tolerancia: '',
32
- titulo: 'Consulta Clinico geral',
33
- subtitulo: 'Posto de saúde do bairro',
34
- destaque: 'Estava passando mal',
30
+ previsto: new Date("2023-04-19T11:00Z"),
31
+ realizado: "",
32
+ titulo: "Consulta Clinico geral",
33
+ subtitulo: "Posto de saúde do bairro",
34
+ destaque: "Estava passando mal",
35
35
  categoria: {
36
- nome: 'Cardiologista',
37
- icone: 'cardiology',
36
+ nome: "Cardiologista",
37
+ icone: "cardiology",
38
38
  },
39
- status: 'planejado',
40
- criticidade: 'media',
39
+ status: "planejado",
40
+ criticidade: "media",
41
41
  acao: false,
42
+ ehAtual: false,
42
43
  };
43
44
 
44
45
  export const Atual = Template.bind({});
45
46
  Atual.args = {
46
- previsto: '2023-04-19T10:00Z',
47
- realizado: '',
48
- tolerancia: '',
49
- titulo: 'Consulta',
50
- subtitulo: 'Posto de saúde',
51
- destaque: '',
47
+ previsto: new Date("2023-04-19T10:00Z"),
48
+ realizado: "",
49
+ titulo: "Consulta",
50
+ subtitulo: "Posto de saúde",
51
+ destaque: "",
52
52
  categoria: {
53
- nome: 'Tele consulta',
54
- icone: 'call',
53
+ nome: "Tele consulta",
54
+ icone: "call",
55
55
  },
56
- status: 'realizado',
57
- criticidade: 'alta',
56
+ status: "realizado",
57
+ criticidade: "alta",
58
58
  acao: false,
59
- selecionado: true,
59
+ ehAtual: true,
60
60
  };
61
61
 
62
62
  export const Importante = Template.bind({});
63
63
  Importante.args = {
64
- previsto: '2023-04-19T18:00Z',
65
- realizado: '',
66
- tolerancia: '',
67
- titulo: 'Consulta cardiologista',
68
- subtitulo: 'Posto de saúde do bairro',
69
- destaque: '',
64
+ previsto: new Date("2023-04-19T18:00Z"),
65
+ realizado: "",
66
+ titulo: "Consulta cardiologista",
67
+ subtitulo: "Posto de saúde do bairro",
68
+ destaque: "",
70
69
  categoria: {
71
- nome: 'Cardiologista',
72
- icone: 'cardiology',
70
+ nome: "Cardiologista",
71
+ icone: "cardiology",
73
72
  },
74
- status: 'planejado',
75
- criticidade: 'alta',
73
+ status: "planejado",
74
+ criticidade: "alta",
76
75
  acao: false,
76
+ ehAtual: false,
77
77
  };
78
78
 
79
79
  export const Realizado = Template.bind({});
80
80
  Realizado.args = {
81
- previsto: '2023-04-20T12:30Z',
82
- realizado: '',
83
- tolerancia: '',
84
- titulo: 'Vacina da gripe',
85
- subtitulo: 'Posto de saúde do bairro',
86
- destaque: '',
81
+ previsto: new Date("2023-04-20T12:30Z"),
82
+ realizado: "",
83
+ titulo: "Vacina da gripe",
84
+ subtitulo: "Posto de saúde do bairro",
85
+ destaque: "",
87
86
  categoria: {
88
- nome: 'Vacina',
89
- icone: 'vaccines',
87
+ nome: "Vacina",
88
+ icone: "vaccines",
90
89
  },
91
- status: 'realizado',
92
- criticidade: 'media',
90
+ status: "realizado",
91
+ criticidade: "media",
93
92
  acao: true,
93
+ ehAtual: false,
94
94
  };
@@ -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 {