@nixweb/nixloc-ui 0.0.54 → 0.0.57

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nixweb/nixloc-ui",
3
- "version": "0.0.54",
3
+ "version": "0.0.57",
4
4
  "description": "Componentes UI",
5
5
  "author": "Fábio Ávila <fabio@nixweb.com.br>",
6
6
  "private": false,
@@ -58,7 +58,7 @@ export default {
58
58
  </script>
59
59
  <style scoped>
60
60
  .foto-container {
61
- margin-top: -32px;
61
+ margin-top: -15px;
62
62
  padding-right: 10px;
63
63
  cursor: pointer;
64
64
  position: fixed;
@@ -1,84 +1,114 @@
1
1
  <template>
2
- <div>
3
- <sidebar-menu
4
- :menu="menu.itens"
5
- :collapsed="menu.escondeMostra"
6
- theme="white-theme"
7
- width="220px"
8
- />
2
+ <div class="menu-container">
3
+ <ul class="menu">
4
+ <li>
5
+ <a
6
+ href="#"
7
+ @click.prevent="navegarPara('dashboard')"
8
+ :class="sessaoDestaque('home')"
9
+ >
10
+ <i class="fa fa-home menu__icon" aria-hidden="true"></i>
11
+ Dashboard
12
+ </a>
13
+ </li>
14
+
15
+ <li v-for="(item, index) in menuFiltro(true)" :key="index">
16
+ <a
17
+ href="#"
18
+ @click.prevent="abrirSubMenu(item.modulo)"
19
+ :class="sessaoDestaque(item.modulo)"
20
+ >
21
+ <i :class="item.icone" class="menu__icon" aria-hidden="true"></i>
22
+ {{ item.modulo }}
23
+ <i class="fa fa-chevron-right menu__arrow-icon" aria-hidden="true"></i>
24
+ </a>
25
+ </li>
26
+ </ul>
27
+
28
+ <transition name="slide-fade">
29
+ <div class="context-menu-container" v-show="subMenuPrimeiroNivel">
30
+ <ul class="context-menu">
31
+ <li v-for="(item, index) in subMenuFiltro(false)" :key="index">
32
+ <h5 v-if="item.tipo === 'grupo'" class="context-menu__title">
33
+ <i :class="item.icone" aria-hidden="true"></i>
34
+ {{ item.grupoNome }}
35
+ <span
36
+ v-if="index === 0"
37
+ @click.prevent="fecharSubMenu"
38
+ class="context-menu__btn-close"
39
+ href="#"
40
+ >
41
+ <i class="fas fa-times-circle"></i>
42
+ </span>
43
+ </h5>
44
+
45
+ <a
46
+ v-else
47
+ href="#"
48
+ @click.prevent="navegarPara(item.nomeRota)"
49
+ :class="classeSubMenu(item.titulo)"
50
+ >
51
+ {{ item.titulo }}
52
+ </a>
53
+ </li>
54
+ </ul>
55
+ </div>
56
+ </transition>
9
57
  </div>
10
58
  </template>
11
59
 
12
60
  <script>
13
- import { SidebarMenu } from "vue-sidebar-menu";
14
- import { mapState, mapMutations } from "vuex";
61
+ import { mapState } from "vuex";
15
62
 
16
63
  export default {
17
- components: {
18
- SidebarMenu,
19
- },
64
+ name: "Menu",
20
65
  data() {
21
66
  return {
22
- tamanhoPagina: "0",
23
- windowWidth: 0,
24
- windowHeight: 0,
67
+ modulo: "",
68
+ subMenuPrimeiroNivel: false,
25
69
  };
26
70
  },
27
- created() {
28
- this.tamanhoPagina = window.innerWidth;
29
- var corpo = document.getElementsByTagName("body")[0];
30
- corpo.style = "margin-left: 220px;transition: all 0.2s ease-in-out;";
31
- },
32
- mounted() {
33
- this.esconderBotaoRodape();
34
- this.escondeMostra(false);
35
-
36
- this.$nextTick(function () {
37
- window.addEventListener("resize", this.getWindowWidth);
38
- window.addEventListener("resize", this.getWindowHeight);
39
- this.getWindowWidth();
40
- this.getWindowHeight();
41
- });
42
- },
43
- beforeDestroy() {
44
- window.removeEventListener("resize", this.getWindowWidth);
45
- window.removeEventListener("resize", this.getWindowHeight);
46
- },
47
- updated() {
48
- this.esconderBotaoRodape();
49
- },
50
71
  methods: {
51
- ...mapMutations("generic", ["escondeMostraMenu"]),
52
- escondeMostra(esconde) {
53
- var corpo = document.getElementsByTagName("body")[0];
54
- this.escondeMostraMenu(esconde);
55
- if (esconde) {
56
- corpo.style = "margin-left: 50px;transition: all 0.2s ease-in-out;";
57
- } else {
58
- corpo.style = "margin-left: 220px;transition: all 0.2s ease-in-out;";
59
- }
72
+ abrirSubMenu(modulo) {
73
+ this.subMenuPrimeiroNivel = true;
74
+ this.modulo = modulo;
60
75
  },
61
- getWindowWidth(event) {
62
- this.windowWidth = document.documentElement.clientWidth;
76
+ fecharSubMenu() {
77
+ this.subMenuPrimeiroNivel = false;
78
+ this.menuItens = [];
63
79
  },
64
- getWindowHeight(event) {
65
- this.windowHeight = document.documentElement.clientHeight;
80
+ sessaoDestaque(section) {
81
+ return {
82
+ menu__link: true,
83
+ "menu__link--active": section === this.contextSection,
84
+ };
66
85
  },
67
- esconderBotaoRodape() {
68
- var botao = document.getElementsByClassName("collapse-btn")[0];
69
- botao.style = "visibility: hidden !important;";
86
+ classeSubMenu(subMenuName) {
87
+ return {
88
+ "context-menu__link": true,
89
+ "context-menu__link--active": this.activeSubMenu === subMenuName,
90
+ };
70
91
  },
71
- },
72
- watch: {
73
- windowWidth: function () {
74
- if (this.windowWidth < 1280) {
75
- this.escondeMostra(true);
76
- } else {
77
- this.escondeMostra(false);
78
- }
92
+ navegarPara(nomeRota) {
93
+ this.$router.push({
94
+ name: nomeRota,
95
+ });
96
+ this.fecharSubMenu();
79
97
  },
80
- "menu.escondeMostra": function (value) {
81
- this.escondeMostra(value);
98
+ menuFiltro(ehModulo) {
99
+ let filtro = [];
100
+ this.menu.itens.forEach(function (obj) {
101
+ if (obj.ehModulo == ehModulo) filtro.push(obj);
102
+ });
103
+ return filtro;
104
+ },
105
+ subMenuFiltro(ehModulo) {
106
+ let filtro = [];
107
+ let self = this;
108
+ this.menu.itens.forEach(function (obj) {
109
+ if (obj.ehModulo == ehModulo && obj.modulo === self.modulo) filtro.push(obj);
110
+ });
111
+ return filtro;
82
112
  },
83
113
  },
84
114
  computed: {
@@ -86,28 +116,3 @@ export default {
86
116
  },
87
117
  };
88
118
  </script>
89
-
90
- <style>
91
- .v-sidebar-menu .vsm-title {
92
- font-size: 14px !important;
93
- font-weight: normal !important;
94
- }
95
-
96
- .v-sidebar-menu.white-theme .vsm-dropdown > .vsm-list {
97
- background-color: #fafafc !important;
98
- }
99
-
100
- .v-sidebar-menu {
101
- background-color: white !important;
102
- border-right: 1px solid #e1e1e2;
103
- }
104
-
105
- .v-sidebar-menu.white-theme .vsm-item.first-item > .vsm-link > .vsm-icon {
106
- color: #4680a5 !important;
107
- }
108
-
109
- .v-sidebar-menu .vsm-arrow:after {
110
- font-family: "Font Awesome 5 Pro" !important;
111
- content: "\f105" !important;
112
- }
113
- </style>
@@ -98,7 +98,7 @@ export default {
98
98
  <style scoped>
99
99
  .c-container {
100
100
  margin: auto;
101
- padding-left: 30px;
101
+ padding-left: 240px;
102
102
  padding-right: 30px;
103
103
  max-width: 1400px;
104
104
  }
@@ -1,14 +1,9 @@
1
1
  <template>
2
2
  <div>
3
- <div
4
- class="topo"
5
- :class="{ esconde: menu.escondeMostra, mostra: !menu.escondeMostra }"
6
- :style="'background-color:' + corTopo"
7
- >
8
- <div class="lado-a-lado" @click="mostrar = !mostrar">
9
- <span class="icone"><i class="fal fa-bars"></i></span>
3
+ <div class="topo" :style="'background-color:' + corTopo">
4
+ <div class="lado-a-lado">
5
+ <slot></slot>
10
6
  </div>
11
- <div class="lado-a-lado"><slot></slot></div>
12
7
  </div>
13
8
  <br />
14
9
  </div>
@@ -25,20 +20,6 @@ export default {
25
20
  default: "#4680A5",
26
21
  },
27
22
  },
28
- data() {
29
- return { mostrar: false };
30
- },
31
- methods: {
32
- ...mapMutations("generic", ["escondeMostraMenu"]),
33
- },
34
- computed: {
35
- ...mapState("generic", ["menu"]),
36
- },
37
- watch: {
38
- mostrar(valor) {
39
- this.escondeMostraMenu(valor);
40
- },
41
- },
42
23
  };
43
24
  </script>
44
25
 
@@ -51,18 +32,4 @@ export default {
51
32
  left: 0;
52
33
  z-index: 20;
53
34
  }
54
-
55
- .esconde {
56
- padding-left: 60px;
57
- }
58
-
59
- .mostra {
60
- padding-left: 230px;
61
- }
62
-
63
- .icone {
64
- font-size: 25px;
65
- color: white;
66
- cursor: pointer;
67
- }
68
35
  </style>
@@ -18,11 +18,11 @@ export default {
18
18
  },
19
19
  methods: {
20
20
  notifica(value) {
21
- if (value.tipo == "adicionarApiSucesso" || value.tipo == "modificarApiSucesso")
21
+ if (value.tipo == "postApi" || value.tipo == "putApi")
22
22
  this.$toasted.show("Salvo com sucesso", {
23
23
  type: "success",
24
24
  });
25
- if (value.tipo == "adicionarApiErro" || value.tipo == "modificarApiErro") {
25
+ if (value.tipo == "postApiErro" || value.tipo == "putApiErro") {
26
26
  this.$toasted.show("Ops! Algo deu errado", {
27
27
  type: "error",
28
28
  });
@@ -150,8 +150,8 @@ export default {
150
150
  },
151
151
  watch: {
152
152
  metodoExecutadoApi: function (value) {
153
- if (value != "obterTodosApi" && value != "" && value != "escolherApi") {
154
- // this.obterTodos();
153
+ if (value == "deleteAllApi") {
154
+ this.obterTodos();
155
155
  }
156
156
  },
157
157
  buscouPesquisa: function () {
@@ -7,7 +7,7 @@ export default {
7
7
  namespaced: true,
8
8
  state: {
9
9
  menu: {
10
- escondeMostra: false, itens: []
10
+ itens: []
11
11
  },
12
12
  modal: {
13
13
  nome: undefined,
@@ -77,9 +77,6 @@ export default {
77
77
  removeItensMenu: (state) => {
78
78
  state.menu.itens = [];
79
79
  },
80
- escondeMostraMenu: (state, escondeMostra) => {
81
- state.menu.escondeMostra = escondeMostra;
82
- },
83
80
  abrirModal: (state, nome) => {
84
81
  state.modal.nome = nome;
85
82
  state.modal.abrir = true;
@@ -176,14 +173,17 @@ export default {
176
173
  .then((response) => {
177
174
  if (response.data.sucesso) {
178
175
  context.commit('insereMetodoExecutadoApi', params.MetodoExecutadoApi);
179
- context.commit('insereToast', 'adicionarApiSucesso');
176
+
177
+ if (!params.naoNotificarToast)
178
+ context.commit('insereToast', 'postApi');
179
+
180
180
  context.commit('removeNotificacao');
181
181
  context.commit('validation/removeFormSujo', null, { root: true });
182
182
  return response.data;
183
183
  } else {
184
184
 
185
185
  context.commit('insereNotificacao', response.data.notificacoes)
186
- context.commit('insereToast', 'falhaGenerica');
186
+ context.commit('insereToast', 'postApiErro');
187
187
  return response.data;
188
188
  }
189
189
  }, (err) => {
@@ -199,12 +199,15 @@ export default {
199
199
  .then((response) => {
200
200
  if (response.data.sucesso) {
201
201
  context.commit('insereMetodoExecutadoApi', params.MetodoExecutadoApi);
202
- context.commit('insereToast', 'modificarApiSucesso');
202
+
203
+ if (!params.naoNotificarToast)
204
+ context.commit('insereToast', 'putApi');
205
+
203
206
  context.commit('removeNotificacao');
204
207
  context.commit('validation/removeFormSujo', null, { root: true });
205
208
  return response.data;
206
209
  } else {
207
- context.commit('insereToast', 'modificarApiErro');
210
+ context.commit('insereToast', 'putApiErro');
208
211
  context.commit('insereNotificacao', response.data.notificacoes)
209
212
  return response.data;
210
213
  }
@@ -247,7 +250,7 @@ export default {
247
250
  })
248
251
  .then((response) => {
249
252
  if (response.data.sucesso) {
250
- context.commit('insereMetodoExecutadoApi', 'deleteApi')
253
+ context.commit('insereMetodoExecutadoApi', 'deleteAllApi');
251
254
  context.commit('insereToast', 'deleteApiSucesso');
252
255
  context.commit('removeNotificacao');
253
256
  return response.data;