@wizishop/angular-components 14.4.48 → 14.4.50

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.
@@ -2567,55 +2567,75 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImpor
2567
2567
  type: Input
2568
2568
  }] } });
2569
2569
 
2570
- class HeaderPageComponent {
2570
+ class HistoryService {
2571
2571
  constructor(router, location) {
2572
2572
  this.router = router;
2573
2573
  this.location = location;
2574
2574
  this.history = [];
2575
- this.withImg = false;
2576
- this.center = false;
2577
- this.useHistory = false;
2575
+ }
2576
+ registerHistory() {
2578
2577
  this.router.events.subscribe((event) => {
2579
2578
  if (event instanceof NavigationEnd) {
2580
2579
  this.history.push(event.urlAfterRedirects);
2581
- console.log('history', this.history, 'history_state', this.useHistory);
2580
+ console.log('history', this.history);
2582
2581
  }
2583
2582
  });
2584
2583
  }
2585
- back() {
2586
- if (!this.useHistory) {
2587
- this.redirect();
2588
- return;
2589
- }
2584
+ back(link) {
2590
2585
  this.history.pop();
2591
2586
  if (this.history.length > 0) {
2592
2587
  this.location.back();
2593
2588
  }
2594
2589
  else {
2595
- this.redirect();
2590
+ this.redirect(link);
2596
2591
  }
2597
2592
  }
2598
- redirect() {
2599
- if (this.linkBack[0].indexOf('http') !== -1) {
2600
- this.redirectToExternalLink();
2593
+ redirect(link) {
2594
+ if (link[0].indexOf('http') !== -1) {
2595
+ this.redirectToExternalLink(link);
2601
2596
  }
2602
2597
  else {
2603
- this.redirectToInternalLink();
2598
+ this.redirectToInternalLink(link);
2604
2599
  }
2605
2600
  }
2606
- redirectToExternalLink() {
2607
- window.location.href = this.linkBack[0];
2601
+ redirectToExternalLink(link) {
2602
+ window.location.href = link[0];
2603
+ }
2604
+ redirectToInternalLink(link) {
2605
+ this.router.navigate(link);
2606
+ }
2607
+ }
2608
+ HistoryService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: HistoryService, deps: [{ token: i1$3.Router }, { token: i1.Location }], target: i0.ɵɵFactoryTarget.Injectable });
2609
+ HistoryService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: HistoryService, providedIn: 'root' });
2610
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: HistoryService, decorators: [{
2611
+ type: Injectable,
2612
+ args: [{
2613
+ providedIn: 'root'
2614
+ }]
2615
+ }], ctorParameters: function () { return [{ type: i1$3.Router }, { type: i1.Location }]; } });
2616
+
2617
+ class HeaderPageComponent {
2618
+ constructor(historyService, location) {
2619
+ this.historyService = historyService;
2620
+ this.location = location;
2621
+ this.withImg = false;
2622
+ this.center = false;
2623
+ this.useHistory = false;
2608
2624
  }
2609
- redirectToInternalLink() {
2610
- this.router.navigate(this.linkBack);
2625
+ back() {
2626
+ if (!this.useHistory) {
2627
+ this.historyService.redirect(this.linkBack);
2628
+ return;
2629
+ }
2630
+ this.historyService.back(this.linkBack);
2611
2631
  }
2612
2632
  }
2613
- HeaderPageComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: HeaderPageComponent, deps: [{ token: i1$3.Router }, { token: i1.Location }], target: i0.ɵɵFactoryTarget.Component });
2633
+ HeaderPageComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: HeaderPageComponent, deps: [{ token: HistoryService }, { token: i1.Location }], target: i0.ɵɵFactoryTarget.Component });
2614
2634
  HeaderPageComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.7", type: HeaderPageComponent, selector: "wac-header-page", inputs: { title: "title", linkBack: "linkBack", withImg: "withImg", center: "center", useHistory: "useHistory" }, ngImport: i0, template: "<div class=\"wac-header-page\">\n <div class=\"wac-header-page__maxWidth\">\n <div class=\"wac-header-page__maxWidth__top\" [ngClass]=\"{'center':center}\">\n <div class=\"wac-header-page__maxWidth__top__left\" [ngClass]=\"{'fullsize':center}\">\n <!-- TODO Hard to use when only want a button and not a router link -->\n <div class=\"wac-header-page__maxWidth__top__left__nowrap\">\n <a *ngIf=\"linkBack\" (click)=\"back()\"><i class=\"fas fa-chevron-left\"></i></a>\n <wac-h1 [center]=\"center\" [withImg]=\"withImg\">{{ title }}<ng-content select=\"[role=header]\"></ng-content></wac-h1>\n </div>\n <p class=\"subtitle\"><ng-content select=\"[role=subtitle]\"></ng-content></p>\n </div>\n <div class=\"wac-header-page__maxWidth__top__right\" *ngIf=\"!center\">\n <ng-content></ng-content>\n </div>\n </div>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: H1Component, selector: "wac-h1", inputs: ["annotation", "withImg", "center", "color"] }] });
2615
2635
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: HeaderPageComponent, decorators: [{
2616
2636
  type: Component,
2617
2637
  args: [{ selector: 'wac-header-page', template: "<div class=\"wac-header-page\">\n <div class=\"wac-header-page__maxWidth\">\n <div class=\"wac-header-page__maxWidth__top\" [ngClass]=\"{'center':center}\">\n <div class=\"wac-header-page__maxWidth__top__left\" [ngClass]=\"{'fullsize':center}\">\n <!-- TODO Hard to use when only want a button and not a router link -->\n <div class=\"wac-header-page__maxWidth__top__left__nowrap\">\n <a *ngIf=\"linkBack\" (click)=\"back()\"><i class=\"fas fa-chevron-left\"></i></a>\n <wac-h1 [center]=\"center\" [withImg]=\"withImg\">{{ title }}<ng-content select=\"[role=header]\"></ng-content></wac-h1>\n </div>\n <p class=\"subtitle\"><ng-content select=\"[role=subtitle]\"></ng-content></p>\n </div>\n <div class=\"wac-header-page__maxWidth__top__right\" *ngIf=\"!center\">\n <ng-content></ng-content>\n </div>\n </div>\n </div>\n</div>\n" }]
2618
- }], ctorParameters: function () { return [{ type: i1$3.Router }, { type: i1.Location }]; }, propDecorators: { title: [{
2638
+ }], ctorParameters: function () { return [{ type: HistoryService }, { type: i1.Location }]; }, propDecorators: { title: [{
2619
2639
  type: Input
2620
2640
  }], linkBack: [{
2621
2641
  type: Input
@@ -6109,7 +6129,7 @@ WiziComponentsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", ve
6109
6129
  SharedDirectives,
6110
6130
  SharedPipes,
6111
6131
  NwbAllModule], exports: [SharedComponentsModule, SharedDirectives, SharedPipes] });
6112
- WiziComponentsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: WiziComponentsModule, imports: [CommonModule,
6132
+ WiziComponentsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.7", ngImport: i0, type: WiziComponentsModule, providers: [HistoryService], imports: [CommonModule,
6113
6133
  SharedComponentsModule,
6114
6134
  SharedDirectives,
6115
6135
  SharedPipes,
@@ -6124,7 +6144,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.7", ngImpor
6124
6144
  SharedPipes,
6125
6145
  NwbAllModule
6126
6146
  ],
6127
- exports: [SharedComponentsModule, SharedDirectives, SharedPipes]
6147
+ exports: [SharedComponentsModule, SharedDirectives, SharedPipes],
6148
+ providers: [HistoryService]
6128
6149
  }]
6129
6150
  }] });
6130
6151