@wizishop/angular-components 14.4.46 → 14.4.49
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/esm2020/lib/components/header-page/header-page.component.mjs +8 -36
- package/esm2020/lib/services/history.service.mjs +52 -0
- package/fesm2015/wizishop-angular-components.mjs +41 -21
- package/fesm2015/wizishop-angular-components.mjs.map +1 -1
- package/fesm2020/wizishop-angular-components.mjs +41 -21
- package/fesm2020/wizishop-angular-components.mjs.map +1 -1
- package/lib/components/header-page/header-page.component.d.ts +4 -10
- package/lib/services/history.service.d.ts +16 -0
- package/package.json +1 -1
- package/wizishop-angular-components-14.4.49.tgz +0 -0
- package/wizishop-angular-components-14.4.46.tgz +0 -0
|
@@ -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
|
|
2570
|
+
class HistoryService {
|
|
2571
2571
|
constructor(router, location) {
|
|
2572
2572
|
this.router = router;
|
|
2573
2573
|
this.location = location;
|
|
2574
2574
|
this.history = [];
|
|
2575
|
-
|
|
2576
|
-
|
|
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);
|
|
2580
|
+
console.log('history', this.history);
|
|
2581
2581
|
}
|
|
2582
2582
|
});
|
|
2583
2583
|
}
|
|
2584
|
-
|
|
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 (
|
|
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 =
|
|
2601
|
+
redirectToExternalLink(link) {
|
|
2602
|
+
window.location.href = link[0];
|
|
2603
|
+
}
|
|
2604
|
+
redirectToInternalLink(link) {
|
|
2605
|
+
this.router.navigate(link);
|
|
2608
2606
|
}
|
|
2609
|
-
|
|
2610
|
-
|
|
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;
|
|
2624
|
+
}
|
|
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:
|
|
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:
|
|
2638
|
+
}], ctorParameters: function () { return [{ type: HistoryService }, { type: i1.Location }]; }, propDecorators: { title: [{
|
|
2619
2639
|
type: Input
|
|
2620
2640
|
}], linkBack: [{
|
|
2621
2641
|
type: Input
|