keevo-components 1.5.222 → 1.5.223

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.
@@ -3085,19 +3085,6 @@ class MenuComponent {
3085
3085
  const cpfcnpjLimpo = cpfcnpj.replace(/\D/g, '');
3086
3086
  return cpfcnpjLimpo.replace(/^(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})$/, '$1.$2.$3/$4-$5');
3087
3087
  }
3088
- definirMenusPorSistema(idsistema) {
3089
- this.menus =
3090
- this.menuCompleto.find((x) => x.sistema.idsistema == idsistema)?.menus ||
3091
- [];
3092
- if (this.menus[0].menupai) {
3093
- var filhos = this.retornarMenuFilhos(this.menus[0].idsistema, this.menus[0].idmenu);
3094
- if (filhos != undefined)
3095
- this.callRoute(filhos[0].link, true);
3096
- }
3097
- else
3098
- this.callRoute(this.menus[0].link, true);
3099
- this.sistemasPanel.hide();
3100
- }
3101
3088
  retornarMenuFilhos(idsistema, idmenu) {
3102
3089
  return this.menuCompleto
3103
3090
  .find((x) => x.sistema.idsistema == idsistema)
@@ -3121,8 +3108,44 @@ class MenuComponent {
3121
3108
  this.licencaSelecionada = licenca;
3122
3109
  this.visibleDialogLicenca = false;
3123
3110
  this.licencaChange.emit(this.licencaSelecionada);
3124
- if (this.router.url == '/')
3125
- this.definirMenusPorSistema(this.menuCompleto[0]?.sistema.idsistema);
3111
+ this.definirMenusPorSistema(this.menuCompleto[0]?.sistema.idsistema);
3112
+ }
3113
+ definirMenusPorSistema(idsistema) {
3114
+ this.menus =
3115
+ this.menuCompleto.find((x) => x.sistema.idsistema == idsistema)?.menus ||
3116
+ [];
3117
+ if (this.router.url === '/')
3118
+ this.navigateToFirstMenu();
3119
+ else {
3120
+ const menuSelecionado = this.menus.find((menu) => menu.link.includes(this.router.url.slice(1)));
3121
+ if (menuSelecionado) {
3122
+ this.navigateToMenu(menuSelecionado);
3123
+ }
3124
+ }
3125
+ this.sistemasPanel.hide();
3126
+ }
3127
+ navigateToFirstMenu() {
3128
+ const firstMenu = this.menus[0];
3129
+ if (firstMenu.menupai) {
3130
+ const filhos = this.retornarMenuFilhos(firstMenu.idsistema, firstMenu.idmenu);
3131
+ if (filhos) {
3132
+ this.callRoute(filhos[0].link, true);
3133
+ }
3134
+ }
3135
+ else {
3136
+ this.callRoute(firstMenu.link, true);
3137
+ }
3138
+ }
3139
+ navigateToMenu(menu) {
3140
+ if (menu.menupai) {
3141
+ const filhos = this.retornarMenuFilhos(menu.idsistema, menu.idmenu);
3142
+ if (filhos) {
3143
+ this.callRoute(filhos[0].link, true);
3144
+ }
3145
+ }
3146
+ else {
3147
+ this.callRoute(menu.link, true);
3148
+ }
3126
3149
  }
3127
3150
  gerenciarKeePass(event) {
3128
3151
  this.sistemasPanel.hide();