@ngx-smz/core 21.1.5 → 21.1.7

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.
@@ -33864,11 +33864,11 @@ class SmzLoginComponent {
33864
33864
  }
33865
33865
  }
33866
33866
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: SmzLoginComponent, deps: [{ token: i1$6.Store }], target: i0.ɵɵFactoryTarget.Component });
33867
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: SmzLoginComponent, isStandalone: false, selector: "smz-ui-login", inputs: { state: "state" }, host: { properties: { "class": "this.colorClass" } }, queries: [{ propertyName: "templates", predicate: i0.forwardRef(() => PrimeTemplate) }], ngImport: i0, template: "<div [ngClass]=\"state.styleClass.card\" class=\"flex overflow-y-auto flex-col flex-nowrap items-stretch justify-center gap-3 sm:w-full md:w-2/5 lg:w-2/5 xl:w-2/4 2xl:w-2/6 h-full ml-auto mr-auto shadow-6\">\r\n\r\n @if (state.logo.customPath != null) {\r\n <img [ngClass]=\"state.logo.styleClass\" class=\"object-fill ml-auto mr-auto\" [src]=\"state.logo.customPath\" />\r\n }\r\n @if (state.logo.customPath == null) {\r\n <img [ngClass]=\"state.logo.styleClass\" class=\"object-fill ml-auto mr-auto\" [src]=\"(appLogo$ | async)[state.logo.type]\" />\r\n }\r\n\r\n @if (state.isFormVisible) {\r\n <div class=\"w-full grid grid-nogutter flex-col items-stretch justify-center gap-4 p-6\">\r\n @if (state.message) {\r\n <div class=\"ml-auto mr-auto\" [innerHtml]=\"state.message | safeHtml\"></div>\r\n }\r\n <smz-form-group #formComponent (submit)=\"login($any(formComponent.getData()))\" [config]=\"state.form\"></smz-form-group>\r\n <button pButton class=\"\" [disabled]=\"!formComponent.isValid\" type=\"button\" [label]=\"state.loginButtonLabel\" (click)=\"login($any(formComponent.getData()))\"></button>\r\n @for (action of (state.customButtons | smzFlattenMenu : null); track action) {\r\n @if (action.visible) {\r\n <button pButton type=\"button\" smzMenuItemAction [item]=\"action\" [label]=\"action.label\" [icon]=\"action.icon\" [ngClass]=\"action.styleClass\" [disabled]=\"action.disabled\"></button>\r\n }\r\n }\r\n @if (state.extraInfo) {\r\n <div class=\"text-sm ml-auto mr-auto\" [innerHtml]=\"state.extraInfo | safeHtml\"></div>\r\n }\r\n </div>\r\n }\r\n\r\n @if (extraTemplate != null) {\r\n <ng-container *ngTemplateOutlet=\"extraTemplate; context: { $implicit: state }\"></ng-container>\r\n }\r\n\r\n</div>", dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i4.ButtonDirective, selector: "[pButton]", inputs: ["ptButtonDirective", "pButtonPT", "pButtonUnstyled", "hostName", "text", "plain", "raised", "size", "outlined", "rounded", "iconPos", "loadingIcon", "fluid", "label", "icon", "loading", "buttonProps", "severity"] }, { kind: "component", type: FormGroupComponent, selector: "smz-form-group", inputs: ["config"], outputs: ["statusChanges", "initialStateChanged", "previousStateChanged", "submit"] }, { kind: "directive", type: SmzMenuItemActionsDirective, selector: "[smzMenuItemAction]", inputs: ["item", "data"], outputs: ["collapse"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "pipe", type: SafeHtmlPipe$2, name: "safeHtml" }, { kind: "pipe", type: SmzFlattenMenuPipe, name: "smzFlattenMenu" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
33867
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: SmzLoginComponent, isStandalone: false, selector: "smz-ui-login", inputs: { state: "state" }, host: { properties: { "class": "this.colorClass" } }, queries: [{ propertyName: "templates", predicate: i0.forwardRef(() => PrimeTemplate) }], ngImport: i0, template: "<div [ngClass]=\"state.styleClass.card\" class=\"flex overflow-y-auto flex-col flex-nowrap items-stretch justify-center gap-3 w-full md:max-w-md h-full mx-auto shadow-6\">\r\n\r\n @if (state.logo.customPath != null) {\r\n <img [ngClass]=\"state.logo.styleClass\" class=\"object-fill ml-auto mr-auto\" [src]=\"state.logo.customPath\" />\r\n }\r\n @if (state.logo.customPath == null) {\r\n <img [ngClass]=\"state.logo.styleClass\" class=\"object-fill ml-auto mr-auto\" [src]=\"(appLogo$ | async)[state.logo.type]\" />\r\n }\r\n\r\n @if (state.isFormVisible) {\r\n <div class=\"w-full grid grid-nogutter flex-col items-stretch justify-center gap-4 p-6\">\r\n @if (state.message) {\r\n <div class=\"ml-auto mr-auto\" [innerHtml]=\"state.message | safeHtml\"></div>\r\n }\r\n <smz-form-group #formComponent (submit)=\"login($any(formComponent.getData()))\" [config]=\"state.form\"></smz-form-group>\r\n <button pButton class=\"\" [disabled]=\"!formComponent.isValid\" type=\"button\" [label]=\"state.loginButtonLabel\" (click)=\"login($any(formComponent.getData()))\"></button>\r\n @for (action of (state.customButtons | smzFlattenMenu : null); track action) {\r\n @if (action.visible) {\r\n <button pButton type=\"button\" smzMenuItemAction [item]=\"action\" [label]=\"action.label\" [icon]=\"action.icon\" [ngClass]=\"action.styleClass\" [disabled]=\"action.disabled\"></button>\r\n }\r\n }\r\n @if (state.extraInfo) {\r\n <div class=\"text-sm ml-auto mr-auto\" [innerHtml]=\"state.extraInfo | safeHtml\"></div>\r\n }\r\n </div>\r\n }\r\n\r\n @if (extraTemplate != null) {\r\n <ng-container *ngTemplateOutlet=\"extraTemplate; context: { $implicit: state }\"></ng-container>\r\n }\r\n\r\n</div>", dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i4.ButtonDirective, selector: "[pButton]", inputs: ["ptButtonDirective", "pButtonPT", "pButtonUnstyled", "hostName", "text", "plain", "raised", "size", "outlined", "rounded", "iconPos", "loadingIcon", "fluid", "label", "icon", "loading", "buttonProps", "severity"] }, { kind: "component", type: FormGroupComponent, selector: "smz-form-group", inputs: ["config"], outputs: ["statusChanges", "initialStateChanged", "previousStateChanged", "submit"] }, { kind: "directive", type: SmzMenuItemActionsDirective, selector: "[smzMenuItemAction]", inputs: ["item", "data"], outputs: ["collapse"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "pipe", type: SafeHtmlPipe$2, name: "safeHtml" }, { kind: "pipe", type: SmzFlattenMenuPipe, name: "smzFlattenMenu" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
33868
33868
  }
33869
33869
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: SmzLoginComponent, decorators: [{
33870
33870
  type: Component,
33871
- args: [{ selector: 'smz-ui-login', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<div [ngClass]=\"state.styleClass.card\" class=\"flex overflow-y-auto flex-col flex-nowrap items-stretch justify-center gap-3 sm:w-full md:w-2/5 lg:w-2/5 xl:w-2/4 2xl:w-2/6 h-full ml-auto mr-auto shadow-6\">\r\n\r\n @if (state.logo.customPath != null) {\r\n <img [ngClass]=\"state.logo.styleClass\" class=\"object-fill ml-auto mr-auto\" [src]=\"state.logo.customPath\" />\r\n }\r\n @if (state.logo.customPath == null) {\r\n <img [ngClass]=\"state.logo.styleClass\" class=\"object-fill ml-auto mr-auto\" [src]=\"(appLogo$ | async)[state.logo.type]\" />\r\n }\r\n\r\n @if (state.isFormVisible) {\r\n <div class=\"w-full grid grid-nogutter flex-col items-stretch justify-center gap-4 p-6\">\r\n @if (state.message) {\r\n <div class=\"ml-auto mr-auto\" [innerHtml]=\"state.message | safeHtml\"></div>\r\n }\r\n <smz-form-group #formComponent (submit)=\"login($any(formComponent.getData()))\" [config]=\"state.form\"></smz-form-group>\r\n <button pButton class=\"\" [disabled]=\"!formComponent.isValid\" type=\"button\" [label]=\"state.loginButtonLabel\" (click)=\"login($any(formComponent.getData()))\"></button>\r\n @for (action of (state.customButtons | smzFlattenMenu : null); track action) {\r\n @if (action.visible) {\r\n <button pButton type=\"button\" smzMenuItemAction [item]=\"action\" [label]=\"action.label\" [icon]=\"action.icon\" [ngClass]=\"action.styleClass\" [disabled]=\"action.disabled\"></button>\r\n }\r\n }\r\n @if (state.extraInfo) {\r\n <div class=\"text-sm ml-auto mr-auto\" [innerHtml]=\"state.extraInfo | safeHtml\"></div>\r\n }\r\n </div>\r\n }\r\n\r\n @if (extraTemplate != null) {\r\n <ng-container *ngTemplateOutlet=\"extraTemplate; context: { $implicit: state }\"></ng-container>\r\n }\r\n\r\n</div>" }]
33871
+ args: [{ selector: 'smz-ui-login', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<div [ngClass]=\"state.styleClass.card\" class=\"flex overflow-y-auto flex-col flex-nowrap items-stretch justify-center gap-3 w-full md:max-w-md h-full mx-auto shadow-6\">\r\n\r\n @if (state.logo.customPath != null) {\r\n <img [ngClass]=\"state.logo.styleClass\" class=\"object-fill ml-auto mr-auto\" [src]=\"state.logo.customPath\" />\r\n }\r\n @if (state.logo.customPath == null) {\r\n <img [ngClass]=\"state.logo.styleClass\" class=\"object-fill ml-auto mr-auto\" [src]=\"(appLogo$ | async)[state.logo.type]\" />\r\n }\r\n\r\n @if (state.isFormVisible) {\r\n <div class=\"w-full grid grid-nogutter flex-col items-stretch justify-center gap-4 p-6\">\r\n @if (state.message) {\r\n <div class=\"ml-auto mr-auto\" [innerHtml]=\"state.message | safeHtml\"></div>\r\n }\r\n <smz-form-group #formComponent (submit)=\"login($any(formComponent.getData()))\" [config]=\"state.form\"></smz-form-group>\r\n <button pButton class=\"\" [disabled]=\"!formComponent.isValid\" type=\"button\" [label]=\"state.loginButtonLabel\" (click)=\"login($any(formComponent.getData()))\"></button>\r\n @for (action of (state.customButtons | smzFlattenMenu : null); track action) {\r\n @if (action.visible) {\r\n <button pButton type=\"button\" smzMenuItemAction [item]=\"action\" [label]=\"action.label\" [icon]=\"action.icon\" [ngClass]=\"action.styleClass\" [disabled]=\"action.disabled\"></button>\r\n }\r\n }\r\n @if (state.extraInfo) {\r\n <div class=\"text-sm ml-auto mr-auto\" [innerHtml]=\"state.extraInfo | safeHtml\"></div>\r\n }\r\n </div>\r\n }\r\n\r\n @if (extraTemplate != null) {\r\n <ng-container *ngTemplateOutlet=\"extraTemplate; context: { $implicit: state }\"></ng-container>\r\n }\r\n\r\n</div>" }]
33872
33872
  }], ctorParameters: () => [{ type: i1$6.Store }], propDecorators: { templates: [{
33873
33873
  type: ContentChildren,
33874
33874
  args: [forwardRef(() => PrimeTemplate)]
@@ -34423,8 +34423,9 @@ class MenuHelperService {
34423
34423
  profileCreationCallback;
34424
34424
  menuCreationData;
34425
34425
  profileCreationData;
34426
- accessMenuBehavior;
34427
- accessProfileBehavior;
34426
+ accessMenuBehavior = 'hide';
34427
+ accessProfileBehavior = 'hide';
34428
+ menuRebuildRevision = signal(0, ...(ngDevMode ? [{ debugName: "menuRebuildRevision" }] : []));
34428
34429
  constructor(actions$, store) {
34429
34430
  this.actions$ = actions$;
34430
34431
  this.store = store;
@@ -34452,6 +34453,7 @@ class MenuHelperService {
34452
34453
  else {
34453
34454
  this.setupProfile();
34454
34455
  }
34456
+ this.menuRebuildRevision.update((revision) => revision + 1);
34455
34457
  }
34456
34458
  setMenuBuild(callback) {
34457
34459
  this.menuCreationCallback = () => sortMenuItemsByLabel(callback());
@@ -34475,29 +34477,61 @@ class MenuHelperService {
34475
34477
  clearNotifications() {
34476
34478
  this.notifications = [];
34477
34479
  }
34478
- setupMenu() {
34479
- if (this.menuCreationData == null)
34480
- return;
34481
- const creationData = this.menuCreationData;
34482
- this.menu = [];
34483
- const extras = [];
34484
- if (GlobalInjector.config.rbkUtils.authorization.navigationMenu != null) {
34485
- const navigationMenu = GlobalInjector.config.rbkUtils.authorization.navigationMenu;
34486
- const withSameLabel = creationData.find(x => x.label === navigationMenu.label);
34487
- if (withSameLabel != null) {
34488
- // existe um menu com esse label criado pelo projeto
34489
- if (withSameLabel.items == null) {
34490
- withSameLabel.items = [];
34480
+ mergeNavigationMenuIntoMenuItems(sidebarItems) {
34481
+ const items = cloneDeep(sidebarItems ?? []);
34482
+ if (GlobalInjector?.config?.rbkUtils?.authorization?.navigationMenu == null) {
34483
+ return items;
34484
+ }
34485
+ const navigationMenu = GlobalInjector.config.rbkUtils.authorization.navigationMenu;
34486
+ const navigationChildCreations = navigationMenu.items ?? [];
34487
+ const withSameLabel = items.find(x => x.label === navigationMenu.label);
34488
+ if (withSameLabel != null) {
34489
+ if (withSameLabel.items == null) {
34490
+ withSameLabel.items = [];
34491
+ }
34492
+ const mergedFromNavigation = [];
34493
+ for (const creation of navigationChildCreations) {
34494
+ const subItem = this.addMenuItemRecursive(creation, this.accessMenuBehavior);
34495
+ if (subItem != null) {
34496
+ mergedFromNavigation.push(subItem);
34491
34497
  }
34492
- // Merge dos itens desse menu
34493
- withSameLabel.items = sortArrayOfObjects([...withSameLabel.items, ...navigationMenu.items], 'label', 1);
34494
34498
  }
34495
- else {
34496
- // Não existe nenhum menu com esse mesmo label no projeto
34497
- // Adicionar no extras
34498
- extras.push(navigationMenu);
34499
+ withSameLabel.items = sortArrayOfObjects([...withSameLabel.items, ...mergedFromNavigation], 'label', 1);
34500
+ }
34501
+ else {
34502
+ const item = this.addMenuItemRecursive(navigationMenu, this.accessMenuBehavior);
34503
+ if (item?.items?.length > 0 || item?.command != null || item?.routerLink != null) {
34504
+ items.push(item);
34505
+ }
34506
+ }
34507
+ return items;
34508
+ }
34509
+ applyAuthorizationNavigationMenuToMenuCreations(creationData) {
34510
+ const extras = [];
34511
+ if (GlobalInjector.config.rbkUtils.authorization.navigationMenu == null) {
34512
+ return extras;
34513
+ }
34514
+ const navigationMenu = GlobalInjector.config.rbkUtils.authorization.navigationMenu;
34515
+ const navigationItems = navigationMenu.items ?? [];
34516
+ const withSameLabel = creationData.find(x => x.label === navigationMenu.label);
34517
+ if (withSameLabel != null) {
34518
+ if (withSameLabel.items == null) {
34519
+ withSameLabel.items = [];
34499
34520
  }
34521
+ withSameLabel.items = sortArrayOfObjects([...withSameLabel.items, ...navigationItems], 'label', 1);
34522
+ }
34523
+ else {
34524
+ extras.push(navigationMenu);
34500
34525
  }
34526
+ return extras;
34527
+ }
34528
+ setupMenu() {
34529
+ if (this.menuCreationData == null) {
34530
+ return;
34531
+ }
34532
+ const creationData = this.menuCreationData;
34533
+ this.menu = [];
34534
+ const extras = this.applyAuthorizationNavigationMenuToMenuCreations(creationData);
34501
34535
  for (const creation of creationData) {
34502
34536
  const item = this.addMenuItemRecursive(creation, this.accessMenuBehavior);
34503
34537
  if (item?.items?.length > 0 || (item?.command != null || item?.routerLink != null)) {