@coolon/angular-ui-powerups 0.0.67 → 0.0.69
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/bundles/coolon-angular-ui-powerups.umd.js +2723 -2285
- package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
- package/bundles/coolon-angular-ui-powerups.umd.min.js +1 -1
- package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -1
- package/coolon-angular-ui-powerups.d.ts +24 -22
- package/coolon-angular-ui-powerups.metadata.json +1 -1
- package/esm2015/coolon-angular-ui-powerups.js +24 -22
- package/esm2015/index.js +2 -2
- package/esm2015/lib/angular-ui-powerups.module.js +6 -3
- package/esm2015/lib/components/index.js +2 -1
- package/esm2015/lib/components/noop/noop.component.js +19 -0
- package/esm2015/lib/interaction/components/alert-dialog/alert-dialog.component.js +2 -2
- package/esm2015/lib/interaction/components/confirm-then-dialog/confirm-then-dialog.component.js +2 -2
- package/esm2015/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.js +2 -2
- package/esm2015/lib/interaction/components/interaction-outlet/interaction-outlet.component.js +19 -0
- package/esm2015/lib/interaction/guards/interaction-guard.service.js +85 -0
- package/esm2015/lib/interaction/index.js +3 -2
- package/esm2015/lib/interaction/interaction.module.js +8 -3
- package/esm2015/lib/interaction/services/dialog-interaction.service.js +30 -5
- package/esm2015/lib/place/components/abstract-place-navigation.component.js +5 -5
- package/esm2015/lib/place/components/list-place-nav/list-place-nav.component.js +2 -2
- package/esm2015/lib/place/components/place-outlet/place-outlet.component.js +60 -66
- package/esm2015/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.js +2 -2
- package/esm2015/lib/place/index.js +9 -8
- package/esm2015/lib/place/navigation-session.js +147 -0
- package/esm2015/lib/place/place-component.js +18 -14
- package/esm2015/lib/place/place-definition.js +207 -5
- package/esm2015/lib/place/place-history.js +3 -2
- package/esm2015/lib/place/place-router.js +184 -89
- package/esm2015/lib/place/route/formatter.js +63 -0
- package/esm2015/lib/place/route/guards/leave-place.guard.js +193 -0
- package/esm2015/lib/place/route/guards/place-route.guard.js +243 -0
- package/esm2015/lib/place/route/parameter-decorators.js +35 -18
- package/esm2015/lib/place/route/parameter-definition.class.js +123 -67
- package/esm2015/lib/place/route/parameter-sanitiser.js +4 -3
- package/esm2015/lib/place/route/parameter-snapshot.js +11 -388
- package/esm2015/lib/place/route/visit-sanitiser.js +88 -0
- package/esm2015/lib/place/visit.js +107 -8
- package/esm2015/public_api.js +4 -4
- package/esm5/coolon-angular-ui-powerups.js +24 -22
- package/esm5/index.js +2 -2
- package/esm5/lib/angular-ui-powerups.module.js +6 -3
- package/esm5/lib/components/index.js +2 -1
- package/esm5/lib/components/noop/noop.component.js +21 -0
- package/esm5/lib/interaction/components/alert-dialog/alert-dialog.component.js +2 -2
- package/esm5/lib/interaction/components/confirm-then-dialog/confirm-then-dialog.component.js +2 -2
- package/esm5/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.js +2 -2
- package/esm5/lib/interaction/components/interaction-outlet/interaction-outlet.component.js +21 -0
- package/esm5/lib/interaction/guards/interaction-guard.service.js +94 -0
- package/esm5/lib/interaction/index.js +3 -2
- package/esm5/lib/interaction/interaction.module.js +8 -3
- package/esm5/lib/interaction/services/dialog-interaction.service.js +28 -5
- package/esm5/lib/place/components/abstract-place-navigation.component.js +5 -5
- package/esm5/lib/place/components/list-place-nav/list-place-nav.component.js +2 -2
- package/esm5/lib/place/components/place-outlet/place-outlet.component.js +70 -82
- package/esm5/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.js +2 -2
- package/esm5/lib/place/index.js +9 -8
- package/esm5/lib/place/navigation-session.js +193 -0
- package/esm5/lib/place/place-component.js +19 -15
- package/esm5/lib/place/place-definition.js +263 -5
- package/esm5/lib/place/place-history.js +7 -3
- package/esm5/lib/place/place-router.js +241 -108
- package/esm5/lib/place/route/formatter.js +96 -0
- package/esm5/lib/place/route/guards/leave-place.guard.js +152 -0
- package/esm5/lib/place/route/guards/place-route.guard.js +273 -0
- package/esm5/lib/place/route/parameter-decorators.js +35 -18
- package/esm5/lib/place/route/parameter-definition.class.js +179 -76
- package/esm5/lib/place/route/parameter-sanitiser.js +4 -3
- package/esm5/lib/place/route/parameter-snapshot.js +11 -480
- package/esm5/lib/place/route/visit-sanitiser.js +99 -0
- package/esm5/lib/place/visit.js +160 -8
- package/esm5/public_api.js +4 -4
- package/fesm2015/coolon-angular-ui-powerups.js +1452 -1108
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +2715 -2281
- package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/components/index.d.ts +1 -0
- package/lib/components/noop/noop.component.d.ts +3 -0
- package/lib/interaction/components/interaction-outlet/interaction-outlet.component.d.ts +3 -0
- package/lib/interaction/guards/interaction-guard.service.d.ts +13 -0
- package/lib/interaction/index.d.ts +2 -1
- package/lib/interaction/services/dialog-interaction.service.d.ts +5 -1
- package/lib/place/components/place-outlet/place-outlet.component.d.ts +12 -12
- package/lib/place/index.d.ts +5 -4
- package/lib/place/navigation-session.d.ts +26 -0
- package/lib/place/place-component.d.ts +3 -3
- package/lib/place/place-definition.d.ts +30 -3
- package/lib/place/place-history.d.ts +3 -3
- package/lib/place/place-router.d.ts +25 -19
- package/lib/place/route/{parameter-type.d.ts → formatter.d.ts} +5 -5
- package/lib/place/{guards → route/guards}/leave-place.guard.d.ts +3 -3
- package/lib/place/route/guards/place-route.guard.d.ts +27 -0
- package/lib/place/route/parameter-decorators.d.ts +14 -6
- package/lib/place/route/parameter-definition.class.d.ts +21 -17
- package/lib/place/route/parameter-sanitiser.d.ts +3 -2
- package/lib/place/route/parameter-snapshot.d.ts +4 -26
- package/lib/place/route/visit-sanitiser.d.ts +12 -0
- package/lib/place/visit.d.ts +24 -3
- package/package.json +1 -1
- package/schematics/place-routes/place-class-scanner.d.ts +2 -2
- package/schematics/place-routes/place-class-scanner.js +7 -7
- package/schematics/place-routes/place-class-scanner.js.map +1 -1
- package/schematics/place-routes/place-def.d.ts +3 -2
- package/schematics/place-routes/place-def.js +21 -12
- package/schematics/place-routes/place-def.js.map +1 -1
- package/schematics/place-routes/templates/place-destinations.ts.template +5 -3
- package/schematics/place-routes/templates/place-routes.ts.template +10 -1
- package/schematics/place-routes/templates/place-visits.ts.template +21 -0
- package/esm2015/lib/interaction/guards/close-interaction.guard.js +0 -62
- package/esm2015/lib/place/guards/leave-place.guard.js +0 -194
- package/esm2015/lib/place/guards/place-route.guard.js +0 -74
- package/esm2015/lib/place/route/parameter-type.js +0 -61
- package/esm2015/lib/place/route/route-parameter-value.js +0 -230
- package/esm5/lib/interaction/guards/close-interaction.guard.js +0 -66
- package/esm5/lib/place/guards/leave-place.guard.js +0 -159
- package/esm5/lib/place/guards/place-route.guard.js +0 -78
- package/esm5/lib/place/route/parameter-type.js +0 -94
- package/esm5/lib/place/route/route-parameter-value.js +0 -316
- package/lib/interaction/guards/close-interaction.guard.d.ts +0 -12
- package/lib/place/guards/place-route.guard.d.ts +0 -10
- package/lib/place/route/route-parameter-value.d.ts +0 -42
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { DOCUMENT,
|
|
1
|
+
import { DOCUMENT, Location, CommonModule } from '@angular/common';
|
|
2
2
|
import { EventEmitter, Input, Output, HostListener, Component, Directive, ElementRef, Inject, NgZone, InjectionToken, Injector, ComponentFactoryResolver, ViewContainerRef, ViewChild, ViewChildren, Injectable, Optional, ɵɵdefineInjectable, ɵɵinject, NgModule, HostBinding, INJECTOR } from '@angular/core';
|
|
3
3
|
import { FormsModule } from '@angular/forms';
|
|
4
4
|
import { MatDialog, MatButtonModule, MatDialogModule, MatTabsModule, MatProgressSpinnerModule, MatInputModule, MatFormFieldModule, MatSelectModule } from '@angular/material';
|
|
5
5
|
import { MatTabsModule as MatTabsModule$1 } from '@angular/material/tabs';
|
|
6
6
|
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
7
7
|
import { __decorate, __metadata, __awaiter } from 'tslib';
|
|
8
|
-
import { GarbageCollector, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, assert, UnaryCommand, lang, Dsl, Logger, DelegatingValueModel, MutableStream, MutableListModel, DelegatingListModel, StoreInValueModel, Binding, MutableValueModel, Guard as Guard$1, OptionsHelper, ValueHolder
|
|
8
|
+
import { GarbageCollector, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, assert, UnaryCommand, lang, Dsl, Logger, DelegatingValueModel, MutableStream, MutableListModel, DelegatingListModel, StoreInValueModel, Binding, MutableValueModel, Trace, Guard as Guard$1, OptionsHelper, ValueHolder } from '@coolon/pectin';
|
|
9
9
|
import { PortalModule } from '@angular/cdk/portal';
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
10
|
+
import { Router, RouterModule, NavigationStart, NavigationEnd, NavigationError, ActivatedRoute, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
|
|
11
|
+
import ___default, { last, isNil, isEqual } from 'lodash';
|
|
12
|
+
import { assert as assert$1, Opts, Klass } from '@coolon/typescript-utilities';
|
|
12
13
|
import { MatDialogConfig, MAT_DIALOG_DEFAULT_OPTIONS, MatDialog as MatDialog$1 } from '@angular/material/dialog';
|
|
13
14
|
import { v1 } from 'uuid';
|
|
14
15
|
import { MatIconModule } from '@angular/material/icon';
|
|
15
16
|
import { MatListModule } from '@angular/material/list';
|
|
16
17
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
17
|
-
import {
|
|
18
|
-
import { Memoize as Memoize$1 } from '@typescript-plus/fast-memoize-decorator
|
|
19
|
-
import { Memoize } from '@typescript-plus/fast-memoize-decorator';
|
|
18
|
+
import { Memoize } from '@typescript-plus/fast-memoize-decorator/dist/src';
|
|
19
|
+
import { Memoize as Memoize$1 } from '@typescript-plus/fast-memoize-decorator';
|
|
20
20
|
import 'reflect-metadata';
|
|
21
21
|
import { style, query, group, animate, trigger, transition } from '@angular/animations';
|
|
22
22
|
import ResizeObserver from 'resize-observer-polyfill';
|
|
@@ -340,6 +340,24 @@ StringInputComponent.decorators = [
|
|
|
340
340
|
/** @nocollapse */
|
|
341
341
|
StringInputComponent.ctorParameters = () => [];
|
|
342
342
|
|
|
343
|
+
/**
|
|
344
|
+
* @fileoverview added by tsickle
|
|
345
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
346
|
+
*/
|
|
347
|
+
class NoopComponent {
|
|
348
|
+
constructor() {
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
NoopComponent.decorators = [
|
|
352
|
+
{ type: Component, args: [{
|
|
353
|
+
selector: 'angular-ui-powerups-noop',
|
|
354
|
+
template: "",
|
|
355
|
+
styles: [":host{display:block}"]
|
|
356
|
+
}] }
|
|
357
|
+
];
|
|
358
|
+
/** @nocollapse */
|
|
359
|
+
NoopComponent.ctorParameters = () => [];
|
|
360
|
+
|
|
343
361
|
/**
|
|
344
362
|
* @fileoverview added by tsickle
|
|
345
363
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -963,7 +981,7 @@ class AlertDialogComponent extends AbstractActivity {
|
|
|
963
981
|
AlertDialogComponent.decorators = [
|
|
964
982
|
{ type: Component, args: [{
|
|
965
983
|
selector: 'angular-ui-powerups-alert-dialog',
|
|
966
|
-
template: "<h3 matDialogTitle *ngIf=\"alert.title\">{{alert.title()}}</h3>\n<div matDialogContent>\n <p *ngFor=\"let line of alert.content()\">{{line}}</p>\n</div>\n<p matDialogActions>\n <button mat-raised-button color=\"primary\" (click)=\"done()\">{{alert.ok()}}</button>\n</p>\n",
|
|
984
|
+
template: "<h3 matDialogTitle *ngIf=\"alert.title\">{{alert.title()}}</h3>\n<div matDialogContent>\n <p *ngFor=\"let line of alert.content()\">{{line}}</p>\n</div>\n<p matDialogActions>\n <button mat-raised-button color=\"primary\" (click)=\"done()\" data-cy=\"close-button\">{{alert.ok()}}</button>\n</p>\n",
|
|
967
985
|
styles: [":host{display:block;padding:var(--angular-ui-powerups-default-padding)}.mat-dialog-actions{justify-content:flex-end}"]
|
|
968
986
|
}] }
|
|
969
987
|
];
|
|
@@ -1031,7 +1049,7 @@ class ConfirmThenDialogComponent extends AbstractActivity {
|
|
|
1031
1049
|
ConfirmThenDialogComponent.decorators = [
|
|
1032
1050
|
{ type: Component, args: [{
|
|
1033
1051
|
selector: 'angular-ui-powerups-confirmation-dialog',
|
|
1034
|
-
template: "<h3 matDialogTitle *ngIf=\"confirm.title\">{{confirm.title()}}</h3>\n<div matDialogContent>\n <p *ngFor=\"let line of confirm.content()\">{{line}}</p>\n</div>\n<p matDialogActions>\n <button mat-button (click)=\"cancel()\">{{confirm.cancel()}}</button>\n <button mat-raised-button [color]=\"isDestructive() ? 'warn' : 'primary'\"\n (click)=\"onConfirm()\">{{confirm.ok()}}</button>\n</p>\n\n",
|
|
1052
|
+
template: "<h3 matDialogTitle *ngIf=\"confirm.title\">{{confirm.title()}}</h3>\n<div matDialogContent>\n <p *ngFor=\"let line of confirm.content()\">{{line}}</p>\n</div>\n<p matDialogActions>\n <button mat-button (click)=\"cancel()\" data-cy=\"cancel-button\">{{confirm.cancel()}}</button>\n <button mat-raised-button [color]=\"isDestructive() ? 'warn' : 'primary'\"\n (click)=\"onConfirm()\" data-cy=\"confirm-button\">{{confirm.ok()}}</button>\n</p>\n\n",
|
|
1035
1053
|
styles: [":host{display:block;padding:var(--angular-ui-powerups-default-padding)}.mat-dialog-actions{justify-content:flex-end}"]
|
|
1036
1054
|
}] }
|
|
1037
1055
|
];
|
|
@@ -1091,7 +1109,7 @@ class ConfirmationDialogComponent extends AbstractActivity {
|
|
|
1091
1109
|
ConfirmationDialogComponent.decorators = [
|
|
1092
1110
|
{ type: Component, args: [{
|
|
1093
1111
|
selector: 'angular-ui-powerups-confirmation-dialog',
|
|
1094
|
-
template: "<h3 matDialogTitle *ngIf=\"confirm.title\">{{confirm.title()}}</h3>\n<div matDialogContent>\n <p *ngFor=\"let line of confirm.content()\">{{line}}</p>\n</div>\n<p matDialogActions>\n <button mat-button (click)=\"cancel()\">{{confirm.cancel()}}</button>\n <button mat-raised-button [color]=\"isDestructive() ? 'warn' : 'primary'\"\n (click)=\"done()\">{{confirm.ok()}}</button>\n</p>\n\n",
|
|
1112
|
+
template: "<h3 matDialogTitle *ngIf=\"confirm.title\">{{confirm.title()}}</h3>\n<div matDialogContent>\n <p *ngFor=\"let line of confirm.content()\">{{line}}</p>\n</div>\n<p matDialogActions>\n <button mat-button (click)=\"cancel()\" data-cy=\"cancel-button\">{{confirm.cancel()}}</button>\n <button mat-raised-button [color]=\"isDestructive() ? 'warn' : 'primary'\"\n (click)=\"done()\" data-cy=\"confirm-button\">{{confirm.ok()}}</button>\n</p>\n\n",
|
|
1095
1113
|
styles: [":host{display:block;padding:var(--angular-ui-powerups-default-padding)}.mat-dialog-actions{justify-content:flex-end}"]
|
|
1096
1114
|
}] }
|
|
1097
1115
|
];
|
|
@@ -1464,6 +1482,24 @@ if (false) {
|
|
|
1464
1482
|
ActivityContainerComponent.prototype._activityList;
|
|
1465
1483
|
}
|
|
1466
1484
|
|
|
1485
|
+
/**
|
|
1486
|
+
* @fileoverview added by tsickle
|
|
1487
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1488
|
+
*/
|
|
1489
|
+
class InteractionOutletComponent {
|
|
1490
|
+
constructor() {
|
|
1491
|
+
}
|
|
1492
|
+
}
|
|
1493
|
+
InteractionOutletComponent.decorators = [
|
|
1494
|
+
{ type: Component, args: [{
|
|
1495
|
+
selector: 'angular-ui-powerups-interaction-outlet',
|
|
1496
|
+
template: "<router-outlet name=\"interaction-context\"></router-outlet>\n",
|
|
1497
|
+
styles: [":host{display:block}"]
|
|
1498
|
+
}] }
|
|
1499
|
+
];
|
|
1500
|
+
/** @nocollapse */
|
|
1501
|
+
InteractionOutletComponent.ctorParameters = () => [];
|
|
1502
|
+
|
|
1467
1503
|
/**
|
|
1468
1504
|
* @fileoverview added by tsickle
|
|
1469
1505
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -1507,12 +1543,16 @@ class Guard extends ValueModel {
|
|
|
1507
1543
|
class DialogInteractionService extends InteractionContext {
|
|
1508
1544
|
/**
|
|
1509
1545
|
* @param {?} dialogService
|
|
1546
|
+
* @param {?} location
|
|
1547
|
+
* @param {?} router
|
|
1510
1548
|
* @param {?} dialogServiceDefaults
|
|
1511
1549
|
* @param {?} matDialogDefaultConfig
|
|
1512
1550
|
*/
|
|
1513
|
-
constructor(dialogService, dialogServiceDefaults, matDialogDefaultConfig) {
|
|
1551
|
+
constructor(dialogService, location, router, dialogServiceDefaults, matDialogDefaultConfig) {
|
|
1514
1552
|
super();
|
|
1515
1553
|
this.dialogService = dialogService;
|
|
1554
|
+
this.location = location;
|
|
1555
|
+
this.router = router;
|
|
1516
1556
|
this.dialogServiceDefaults = dialogServiceDefaults;
|
|
1517
1557
|
this.matDialogDefaultConfig = matDialogDefaultConfig;
|
|
1518
1558
|
this._activityList = new DelegatingListModel();
|
|
@@ -1567,6 +1607,7 @@ class DialogInteractionService extends InteractionContext {
|
|
|
1567
1607
|
*/
|
|
1568
1608
|
() => {
|
|
1569
1609
|
this.currentActivityId = v1();
|
|
1610
|
+
// this.location.go(this.router.routerState.snapshot.url, "aup");
|
|
1570
1611
|
/** @type {?} */
|
|
1571
1612
|
const self = this;
|
|
1572
1613
|
/** @type {?} */
|
|
@@ -1596,7 +1637,7 @@ class DialogInteractionService extends InteractionContext {
|
|
|
1596
1637
|
*/
|
|
1597
1638
|
onDone(result) {
|
|
1598
1639
|
resolve(result);
|
|
1599
|
-
matDialogRef.close(
|
|
1640
|
+
matDialogRef.close(true); // return true to let the after close listener know we've already handled it.
|
|
1600
1641
|
},
|
|
1601
1642
|
/**
|
|
1602
1643
|
* @param {?} error
|
|
@@ -1604,9 +1645,18 @@ class DialogInteractionService extends InteractionContext {
|
|
|
1604
1645
|
*/
|
|
1605
1646
|
onCancel(error) {
|
|
1606
1647
|
reject(error);
|
|
1607
|
-
matDialogRef.close(
|
|
1648
|
+
matDialogRef.close(true); // return true to let the after close listener know we've already handled it.
|
|
1608
1649
|
}
|
|
1609
1650
|
};
|
|
1651
|
+
matDialogRef.afterClosed().subscribe((/**
|
|
1652
|
+
* @param {?} promiseAlreadyFinished
|
|
1653
|
+
* @return {?}
|
|
1654
|
+
*/
|
|
1655
|
+
promiseAlreadyFinished => {
|
|
1656
|
+
if (!promiseAlreadyFinished) {
|
|
1657
|
+
reject("auto-closed");
|
|
1658
|
+
}
|
|
1659
|
+
}));
|
|
1610
1660
|
matDialogRef.updateSize();
|
|
1611
1661
|
})).finally((/**
|
|
1612
1662
|
* @return {?}
|
|
@@ -1633,6 +1683,7 @@ class DialogInteractionService extends InteractionContext {
|
|
|
1633
1683
|
* @return {?}
|
|
1634
1684
|
*/
|
|
1635
1685
|
alert(alert) {
|
|
1686
|
+
// TODO: Test disableClose === false
|
|
1636
1687
|
return this._startActivity(AlertDialogComponent, alert, false);
|
|
1637
1688
|
}
|
|
1638
1689
|
/**
|
|
@@ -1665,10 +1716,12 @@ DialogInteractionService.decorators = [
|
|
|
1665
1716
|
/** @nocollapse */
|
|
1666
1717
|
DialogInteractionService.ctorParameters = () => [
|
|
1667
1718
|
{ type: MatDialog },
|
|
1719
|
+
{ type: Location },
|
|
1720
|
+
{ type: Router },
|
|
1668
1721
|
{ type: MatDialogConfig, decorators: [{ type: Optional }, { type: Inject, args: [DIALOG_INTERACTION_SERVICE_DEFAULTS,] }] },
|
|
1669
1722
|
{ type: MatDialogConfig, decorators: [{ type: Optional }, { type: Inject, args: [MAT_DIALOG_DEFAULT_OPTIONS,] }] }
|
|
1670
1723
|
];
|
|
1671
|
-
/** @nocollapse */ DialogInteractionService.ngInjectableDef = ɵɵdefineInjectable({ factory: function DialogInteractionService_Factory() { return new DialogInteractionService(ɵɵinject(MatDialog$1), ɵɵinject(DIALOG_INTERACTION_SERVICE_DEFAULTS, 8), ɵɵinject(MAT_DIALOG_DEFAULT_OPTIONS, 8)); }, token: DialogInteractionService, providedIn: "root" });
|
|
1724
|
+
/** @nocollapse */ DialogInteractionService.ngInjectableDef = ɵɵdefineInjectable({ factory: function DialogInteractionService_Factory() { return new DialogInteractionService(ɵɵinject(MatDialog$1), ɵɵinject(Location), ɵɵinject(Router), ɵɵinject(DIALOG_INTERACTION_SERVICE_DEFAULTS, 8), ɵɵinject(MAT_DIALOG_DEFAULT_OPTIONS, 8)); }, token: DialogInteractionService, providedIn: "root" });
|
|
1672
1725
|
if (false) {
|
|
1673
1726
|
/**
|
|
1674
1727
|
* @type {?}
|
|
@@ -1691,6 +1744,10 @@ if (false) {
|
|
|
1691
1744
|
*/
|
|
1692
1745
|
DialogInteractionService.prototype.dialogService;
|
|
1693
1746
|
/** @type {?} */
|
|
1747
|
+
DialogInteractionService.prototype.location;
|
|
1748
|
+
/** @type {?} */
|
|
1749
|
+
DialogInteractionService.prototype.router;
|
|
1750
|
+
/** @type {?} */
|
|
1694
1751
|
DialogInteractionService.prototype.dialogServiceDefaults;
|
|
1695
1752
|
/** @type {?} */
|
|
1696
1753
|
DialogInteractionService.prototype.matDialogDefaultConfig;
|
|
@@ -1709,18 +1766,21 @@ InteractionModule.decorators = [
|
|
|
1709
1766
|
MatButtonModule,
|
|
1710
1767
|
MatDialogModule,
|
|
1711
1768
|
MatTabsModule,
|
|
1712
|
-
PortalModule
|
|
1769
|
+
PortalModule,
|
|
1770
|
+
RouterModule
|
|
1713
1771
|
],
|
|
1714
1772
|
declarations: [
|
|
1715
1773
|
ActivityContainerComponent,
|
|
1716
1774
|
ConfirmationDialogComponent,
|
|
1717
1775
|
ConfirmThenDialogComponent,
|
|
1718
1776
|
AlertDialogComponent,
|
|
1719
|
-
ActivityOutletComponent
|
|
1777
|
+
ActivityOutletComponent,
|
|
1778
|
+
InteractionOutletComponent
|
|
1720
1779
|
],
|
|
1721
1780
|
exports: [
|
|
1722
1781
|
ActivityContainerComponent,
|
|
1723
1782
|
ActivityOutletComponent,
|
|
1783
|
+
InteractionOutletComponent
|
|
1724
1784
|
],
|
|
1725
1785
|
entryComponents: [
|
|
1726
1786
|
ActivityContainerComponent,
|
|
@@ -1802,6 +1862,234 @@ EmptyStateComponent.decorators = [
|
|
|
1802
1862
|
/** @nocollapse */
|
|
1803
1863
|
EmptyStateComponent.ctorParameters = () => [];
|
|
1804
1864
|
|
|
1865
|
+
/**
|
|
1866
|
+
* @fileoverview added by tsickle
|
|
1867
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1868
|
+
*/
|
|
1869
|
+
/**
|
|
1870
|
+
* @abstract
|
|
1871
|
+
* @template T, E
|
|
1872
|
+
*/
|
|
1873
|
+
class ParameterDefinition {
|
|
1874
|
+
/**
|
|
1875
|
+
* @param {?} propertyName
|
|
1876
|
+
* @param {?} options
|
|
1877
|
+
* @param {?=} urlFormat
|
|
1878
|
+
*/
|
|
1879
|
+
constructor(propertyName, options, urlFormat) {
|
|
1880
|
+
this.propertyName = propertyName;
|
|
1881
|
+
this.urlFormat = urlFormat;
|
|
1882
|
+
this.options = Opts.get(options);
|
|
1883
|
+
this.remember = this.options.getOptional('remember', false);
|
|
1884
|
+
this.defaultValue = this.options.getOptional('defaultValue', null);
|
|
1885
|
+
}
|
|
1886
|
+
/**
|
|
1887
|
+
* @return {?}
|
|
1888
|
+
*/
|
|
1889
|
+
get name() {
|
|
1890
|
+
return this.options.getOptional('as', this.propertyName);
|
|
1891
|
+
}
|
|
1892
|
+
// @Trace()
|
|
1893
|
+
/**
|
|
1894
|
+
* @return {?}
|
|
1895
|
+
*/
|
|
1896
|
+
get isRouteParameter() {
|
|
1897
|
+
return !!this.urlFormat;
|
|
1898
|
+
}
|
|
1899
|
+
/**
|
|
1900
|
+
* @protected
|
|
1901
|
+
* @template K
|
|
1902
|
+
* @param {?} key
|
|
1903
|
+
* @return {?}
|
|
1904
|
+
*/
|
|
1905
|
+
getOptionValue(key) {
|
|
1906
|
+
return this.options.getOptional(key, null);
|
|
1907
|
+
}
|
|
1908
|
+
// @Trace()
|
|
1909
|
+
/**
|
|
1910
|
+
* @param {?} value
|
|
1911
|
+
* @param {?} visit
|
|
1912
|
+
* @param {?} placeHistory
|
|
1913
|
+
* @param {?} injector
|
|
1914
|
+
* @return {?}
|
|
1915
|
+
*/
|
|
1916
|
+
sanitise(value, visit, placeHistory, injector) {
|
|
1917
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1918
|
+
if (this.isMissingFrom(visit)) {
|
|
1919
|
+
/** @type {?} */
|
|
1920
|
+
const previousVisit = ___default.first(placeHistory.getHistory(visit.placeDefinition));
|
|
1921
|
+
if (this.remember && previousVisit) {
|
|
1922
|
+
value = previousVisit.getParameter(this.name);
|
|
1923
|
+
}
|
|
1924
|
+
return this.isEmptyValue(value) ? this.defaultValue : value;
|
|
1925
|
+
}
|
|
1926
|
+
else {
|
|
1927
|
+
// todo: add custom sanitiser
|
|
1928
|
+
return value;
|
|
1929
|
+
}
|
|
1930
|
+
});
|
|
1931
|
+
}
|
|
1932
|
+
/**
|
|
1933
|
+
* @private
|
|
1934
|
+
* @param {?} visit
|
|
1935
|
+
* @return {?}
|
|
1936
|
+
*/
|
|
1937
|
+
isMissingFrom(visit) {
|
|
1938
|
+
return !visit.hasParameter(this.name);
|
|
1939
|
+
}
|
|
1940
|
+
}
|
|
1941
|
+
if (false) {
|
|
1942
|
+
/** @type {?} */
|
|
1943
|
+
ParameterDefinition.prototype.isRouteId;
|
|
1944
|
+
/** @type {?} */
|
|
1945
|
+
ParameterDefinition.prototype.isArray;
|
|
1946
|
+
/** @type {?} */
|
|
1947
|
+
ParameterDefinition.prototype.remember;
|
|
1948
|
+
/** @type {?} */
|
|
1949
|
+
ParameterDefinition.prototype.defaultValue;
|
|
1950
|
+
/**
|
|
1951
|
+
* @type {?}
|
|
1952
|
+
* @private
|
|
1953
|
+
*/
|
|
1954
|
+
ParameterDefinition.prototype.options;
|
|
1955
|
+
/** @type {?} */
|
|
1956
|
+
ParameterDefinition.prototype.propertyName;
|
|
1957
|
+
/** @type {?} */
|
|
1958
|
+
ParameterDefinition.prototype.urlFormat;
|
|
1959
|
+
/**
|
|
1960
|
+
* @abstract
|
|
1961
|
+
* @param {?} value
|
|
1962
|
+
* @return {?}
|
|
1963
|
+
*/
|
|
1964
|
+
ParameterDefinition.prototype.isEmptyValue = function (value) { };
|
|
1965
|
+
/**
|
|
1966
|
+
* @abstract
|
|
1967
|
+
* @param {?} a
|
|
1968
|
+
* @param {?} b
|
|
1969
|
+
* @return {?}
|
|
1970
|
+
*/
|
|
1971
|
+
ParameterDefinition.prototype.hasChanged = function (a, b) { };
|
|
1972
|
+
}
|
|
1973
|
+
(function (ParameterDefinition) {
|
|
1974
|
+
/**
|
|
1975
|
+
* @record
|
|
1976
|
+
* @template T
|
|
1977
|
+
*/
|
|
1978
|
+
function Options() { }
|
|
1979
|
+
ParameterDefinition.Options = Options;
|
|
1980
|
+
if (false) {
|
|
1981
|
+
/** @type {?|undefined} */
|
|
1982
|
+
Options.prototype.as;
|
|
1983
|
+
/** @type {?|undefined} */
|
|
1984
|
+
Options.prototype.optional;
|
|
1985
|
+
/** @type {?|undefined} */
|
|
1986
|
+
Options.prototype.remember;
|
|
1987
|
+
/** @type {?|undefined} */
|
|
1988
|
+
Options.prototype.defaultValue;
|
|
1989
|
+
}
|
|
1990
|
+
/**
|
|
1991
|
+
* @template T
|
|
1992
|
+
*/
|
|
1993
|
+
class RouteId extends ParameterDefinition {
|
|
1994
|
+
constructor() {
|
|
1995
|
+
super(...arguments);
|
|
1996
|
+
this.isRouteId = true;
|
|
1997
|
+
this.isArray = false;
|
|
1998
|
+
}
|
|
1999
|
+
/**
|
|
2000
|
+
* @param {?} value
|
|
2001
|
+
* @return {?}
|
|
2002
|
+
*/
|
|
2003
|
+
isEmptyValue(value) {
|
|
2004
|
+
return ___default.isNil(value);
|
|
2005
|
+
}
|
|
2006
|
+
/**
|
|
2007
|
+
* @param {?} a
|
|
2008
|
+
* @param {?} b
|
|
2009
|
+
* @return {?}
|
|
2010
|
+
*/
|
|
2011
|
+
hasChanged(a, b) {
|
|
2012
|
+
return a !== b;
|
|
2013
|
+
}
|
|
2014
|
+
}
|
|
2015
|
+
ParameterDefinition.RouteId = RouteId;
|
|
2016
|
+
if (false) {
|
|
2017
|
+
/** @type {?} */
|
|
2018
|
+
RouteId.prototype.isRouteId;
|
|
2019
|
+
/** @type {?} */
|
|
2020
|
+
RouteId.prototype.isArray;
|
|
2021
|
+
}
|
|
2022
|
+
/**
|
|
2023
|
+
* @template T
|
|
2024
|
+
*/
|
|
2025
|
+
class ValueParameter extends ParameterDefinition {
|
|
2026
|
+
constructor() {
|
|
2027
|
+
super(...arguments);
|
|
2028
|
+
this.isRouteId = false;
|
|
2029
|
+
this.isArray = false;
|
|
2030
|
+
}
|
|
2031
|
+
/**
|
|
2032
|
+
* @param {?} value
|
|
2033
|
+
* @return {?}
|
|
2034
|
+
*/
|
|
2035
|
+
isEmptyValue(value) {
|
|
2036
|
+
return ___default.isNil(value);
|
|
2037
|
+
}
|
|
2038
|
+
/**
|
|
2039
|
+
* @param {?} a
|
|
2040
|
+
* @param {?} b
|
|
2041
|
+
* @return {?}
|
|
2042
|
+
*/
|
|
2043
|
+
hasChanged(a, b) {
|
|
2044
|
+
return a !== b;
|
|
2045
|
+
}
|
|
2046
|
+
}
|
|
2047
|
+
ParameterDefinition.ValueParameter = ValueParameter;
|
|
2048
|
+
if (false) {
|
|
2049
|
+
/** @type {?} */
|
|
2050
|
+
ValueParameter.prototype.isRouteId;
|
|
2051
|
+
/** @type {?} */
|
|
2052
|
+
ValueParameter.prototype.isArray;
|
|
2053
|
+
}
|
|
2054
|
+
/**
|
|
2055
|
+
* @template T
|
|
2056
|
+
*/
|
|
2057
|
+
class ArrayParameter extends ParameterDefinition {
|
|
2058
|
+
/**
|
|
2059
|
+
* @param {?} parameterName
|
|
2060
|
+
* @param {?} options
|
|
2061
|
+
* @param {?} urlFormat
|
|
2062
|
+
*/
|
|
2063
|
+
constructor(parameterName, options, urlFormat) {
|
|
2064
|
+
super(parameterName, options, urlFormat);
|
|
2065
|
+
this.isRouteId = false;
|
|
2066
|
+
this.isArray = true;
|
|
2067
|
+
}
|
|
2068
|
+
/**
|
|
2069
|
+
* @param {?} value
|
|
2070
|
+
* @return {?}
|
|
2071
|
+
*/
|
|
2072
|
+
isEmptyValue(value) {
|
|
2073
|
+
return ___default.isNil(value) || value.length < 1;
|
|
2074
|
+
}
|
|
2075
|
+
/**
|
|
2076
|
+
* @param {?} a
|
|
2077
|
+
* @param {?} b
|
|
2078
|
+
* @return {?}
|
|
2079
|
+
*/
|
|
2080
|
+
hasChanged(a, b) {
|
|
2081
|
+
return !___default.isEqual(a, b);
|
|
2082
|
+
}
|
|
2083
|
+
}
|
|
2084
|
+
ParameterDefinition.ArrayParameter = ArrayParameter;
|
|
2085
|
+
if (false) {
|
|
2086
|
+
/** @type {?} */
|
|
2087
|
+
ArrayParameter.prototype.isRouteId;
|
|
2088
|
+
/** @type {?} */
|
|
2089
|
+
ArrayParameter.prototype.isArray;
|
|
2090
|
+
}
|
|
2091
|
+
})(ParameterDefinition || (ParameterDefinition = {}));
|
|
2092
|
+
|
|
1805
2093
|
/**
|
|
1806
2094
|
* @fileoverview added by tsickle
|
|
1807
2095
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -1828,8 +2116,49 @@ class PlaceDefinition {
|
|
|
1828
2116
|
/**
|
|
1829
2117
|
* @return {?}
|
|
1830
2118
|
*/
|
|
1831
|
-
|
|
1832
|
-
return this.
|
|
2119
|
+
hasRouteId() {
|
|
2120
|
+
return !!this.getRouteIdParameterDef();
|
|
2121
|
+
}
|
|
2122
|
+
/**
|
|
2123
|
+
* @return {?}
|
|
2124
|
+
*/
|
|
2125
|
+
getRouteIdParameterDef() {
|
|
2126
|
+
return this.routeParameters.find((/**
|
|
2127
|
+
* @param {?} p
|
|
2128
|
+
* @return {?}
|
|
2129
|
+
*/
|
|
2130
|
+
p => p.isRouteId));
|
|
2131
|
+
}
|
|
2132
|
+
/**
|
|
2133
|
+
* @param {?=} includeRouteId
|
|
2134
|
+
* @return {?}
|
|
2135
|
+
*/
|
|
2136
|
+
getRouteParameterDefs(includeRouteId = false) {
|
|
2137
|
+
return this.getVisitParameterDefs({ includeRouteId, includeRouteParameters: true });
|
|
2138
|
+
}
|
|
2139
|
+
/**
|
|
2140
|
+
* @param {?=} include
|
|
2141
|
+
* @return {?}
|
|
2142
|
+
*/
|
|
2143
|
+
getVisitParameterDefs(include) {
|
|
2144
|
+
/** @type {?} */
|
|
2145
|
+
const opts = Opts.get(include);
|
|
2146
|
+
// includes
|
|
2147
|
+
/** @type {?} */
|
|
2148
|
+
const includeRouteId = !include || opts.getOptional('includeRouteId', false);
|
|
2149
|
+
/** @type {?} */
|
|
2150
|
+
const includeRouteParameters = !include || opts.getOptional('includeRouteParameters', false);
|
|
2151
|
+
/** @type {?} */
|
|
2152
|
+
const includeNonRouteParameters = !include || opts.getOptional('includeNonRouteParameters', false);
|
|
2153
|
+
return this.routeParameters.filter((/**
|
|
2154
|
+
* @param {?} p
|
|
2155
|
+
* @return {?}
|
|
2156
|
+
*/
|
|
2157
|
+
p => {
|
|
2158
|
+
return (includeRouteId && p.isRouteId)
|
|
2159
|
+
|| (includeRouteParameters && p.isRouteParameter && !p.isRouteId) // route id is included in the line above
|
|
2160
|
+
|| (includeNonRouteParameters && !p.isRouteParameter);
|
|
2161
|
+
}));
|
|
1833
2162
|
}
|
|
1834
2163
|
/**
|
|
1835
2164
|
* @template T
|
|
@@ -1837,7 +2166,7 @@ class PlaceDefinition {
|
|
|
1837
2166
|
* @param {?=} defaultValue
|
|
1838
2167
|
* @return {?}
|
|
1839
2168
|
*/
|
|
1840
|
-
|
|
2169
|
+
getPlaceData(key, defaultValue) {
|
|
1841
2170
|
return this.data ?
|
|
1842
2171
|
___default.isNil(this.data[key]) ? defaultValue : this.data[key] :
|
|
1843
2172
|
defaultValue;
|
|
@@ -1848,7 +2177,7 @@ class PlaceDefinition {
|
|
|
1848
2177
|
* @param {?=} defaultValue
|
|
1849
2178
|
* @return {?}
|
|
1850
2179
|
*/
|
|
1851
|
-
|
|
2180
|
+
searchPlaceData(keys, defaultValue) {
|
|
1852
2181
|
if (this.data) {
|
|
1853
2182
|
/** @type {?} */
|
|
1854
2183
|
const found = keys.find((/**
|
|
@@ -1862,23 +2191,179 @@ class PlaceDefinition {
|
|
|
1862
2191
|
return defaultValue;
|
|
1863
2192
|
}
|
|
1864
2193
|
}
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
2194
|
+
/**
|
|
2195
|
+
* @param {?} visit
|
|
2196
|
+
* @return {?}
|
|
2197
|
+
*/
|
|
2198
|
+
getRouteIdFrom(visit) {
|
|
2199
|
+
/** @type {?} */
|
|
2200
|
+
const routeIdParameterDef = this.getRouteIdParameterDef();
|
|
2201
|
+
return routeIdParameterDef ? visit.getParameter(routeIdParameterDef.name) : null;
|
|
2202
|
+
}
|
|
2203
|
+
/**
|
|
2204
|
+
* Returns angular router commands that specify the route id and any route parameters. The result does
|
|
2205
|
+
* not include any path information.
|
|
2206
|
+
* @param {?} visit
|
|
2207
|
+
* @return {?}
|
|
2208
|
+
*/
|
|
2209
|
+
// getFormattedRouterCommands(visit: Visit): any[] {
|
|
2210
|
+
// return this.hasRouteId() ?
|
|
2211
|
+
// [this.getFormattedRouteId(visit), this.getFormattedRouteParameters(visit)] :
|
|
2212
|
+
// [this.getFormattedRouteParameters(visit)];
|
|
2213
|
+
// }
|
|
2214
|
+
getFormattedRouteId(visit) {
|
|
2215
|
+
return visit.hasRouteId() ? this.getRouteIdParameterDef().urlFormat.format(visit.getRouteId()) : null;
|
|
2216
|
+
}
|
|
2217
|
+
// @Trace()
|
|
2218
|
+
/**
|
|
2219
|
+
* @param {?} visit
|
|
2220
|
+
* @param {?=} includeRouteId
|
|
2221
|
+
* @return {?}
|
|
2222
|
+
*/
|
|
2223
|
+
getFormattedRouteParameters(visit, includeRouteId = false) {
|
|
2224
|
+
/** @type {?} */
|
|
2225
|
+
const result = {};
|
|
2226
|
+
this.getVisitParameterDefs({
|
|
2227
|
+
includeRouteId, includeRouteParameters: true
|
|
2228
|
+
}).forEach((/**
|
|
2229
|
+
* @param {?} def
|
|
2230
|
+
* @return {?}
|
|
2231
|
+
*/
|
|
2232
|
+
def => {
|
|
2233
|
+
/** @type {?} */
|
|
2234
|
+
const value = visit.getParameter(def.name);
|
|
2235
|
+
if (!def.isEmptyValue(value)) {
|
|
2236
|
+
if (def.isArray) {
|
|
2237
|
+
assert.isArray(value);
|
|
2238
|
+
result[def.name] = value.map((/**
|
|
2239
|
+
* @param {?} v
|
|
2240
|
+
* @return {?}
|
|
2241
|
+
*/
|
|
2242
|
+
v => def.urlFormat.format(v)));
|
|
2243
|
+
}
|
|
2244
|
+
else {
|
|
2245
|
+
assert.isFalsey(Array.isArray(value));
|
|
2246
|
+
result[def.name] = def.urlFormat.format(value);
|
|
2247
|
+
}
|
|
2248
|
+
}
|
|
2249
|
+
}));
|
|
2250
|
+
return result;
|
|
2251
|
+
}
|
|
2252
|
+
/**
|
|
2253
|
+
* @param {?} visit
|
|
2254
|
+
* @return {?}
|
|
2255
|
+
*/
|
|
2256
|
+
getNonRouteParameters(visit) {
|
|
2257
|
+
/** @type {?} */
|
|
2258
|
+
const result = {};
|
|
2259
|
+
this.getVisitParameterDefs({ includeNonRouteParameters: true }).forEach((/**
|
|
2260
|
+
* @param {?} def
|
|
2261
|
+
* @return {?}
|
|
2262
|
+
*/
|
|
2263
|
+
def => {
|
|
2264
|
+
/** @type {?} */
|
|
2265
|
+
const value = visit.getParameter(def.name);
|
|
2266
|
+
if (!def.isEmptyValue(value)) {
|
|
2267
|
+
result[def.name] = value;
|
|
2268
|
+
}
|
|
2269
|
+
}));
|
|
2270
|
+
return result;
|
|
2271
|
+
}
|
|
2272
|
+
// @Trace()
|
|
2273
|
+
/**
|
|
2274
|
+
* @param {?} params
|
|
2275
|
+
* @return {?}
|
|
2276
|
+
*/
|
|
2277
|
+
parseRouteParams(params) {
|
|
2278
|
+
/** @type {?} */
|
|
2279
|
+
const result = {};
|
|
2280
|
+
this.getVisitParameterDefs({
|
|
2281
|
+
includeRouteId: true,
|
|
2282
|
+
includeRouteParameters: true,
|
|
2283
|
+
includeNonRouteParameters: false
|
|
2284
|
+
}).forEach((/**
|
|
2285
|
+
* @param {?} def
|
|
2286
|
+
* @return {?}
|
|
2287
|
+
*/
|
|
2288
|
+
def => {
|
|
2289
|
+
// params will return null for non existent names
|
|
2290
|
+
if (params.has(def.name)) {
|
|
2291
|
+
if (def.isArray) {
|
|
2292
|
+
/** @type {?} */
|
|
2293
|
+
const values = params.getAll(def.name);
|
|
2294
|
+
result[def.name] = values.map((/**
|
|
2295
|
+
* @param {?} v
|
|
2296
|
+
* @return {?}
|
|
2297
|
+
*/
|
|
2298
|
+
v => def.urlFormat.parse(v)));
|
|
2299
|
+
}
|
|
2300
|
+
else {
|
|
2301
|
+
/** @type {?} */
|
|
2302
|
+
const value = def.urlFormat.parse(params.get(def.name));
|
|
2303
|
+
// because our id routes redirect if the id isn't pressent we always have a id
|
|
2304
|
+
// parameter in our params. This will bugger our remember and defaultvalue sanitisation
|
|
2305
|
+
// as it'll see that the id is present (event thought its null). The sanitisation can't
|
|
2306
|
+
// check for null as that's a valid value for the id.
|
|
2307
|
+
/** @type {?} */
|
|
2308
|
+
const isEmptyRouteId = def.isRouteId && def.isEmptyValue(value);
|
|
2309
|
+
if (!isEmptyRouteId) {
|
|
2310
|
+
result[def.name] = value;
|
|
2311
|
+
}
|
|
2312
|
+
}
|
|
2313
|
+
}
|
|
2314
|
+
}));
|
|
2315
|
+
return result;
|
|
2316
|
+
}
|
|
2317
|
+
}
|
|
2318
|
+
__decorate([
|
|
2319
|
+
Memoize(),
|
|
2320
|
+
__metadata("design:type", Function),
|
|
2321
|
+
__metadata("design:paramtypes", []),
|
|
2322
|
+
__metadata("design:returntype", ParameterDefinition)
|
|
2323
|
+
], PlaceDefinition.prototype, "getRouteIdParameterDef", null);
|
|
2324
|
+
__decorate([
|
|
2325
|
+
Memoize(),
|
|
2326
|
+
__metadata("design:type", Function),
|
|
2327
|
+
__metadata("design:paramtypes", [Object]),
|
|
2328
|
+
__metadata("design:returntype", Array)
|
|
2329
|
+
], PlaceDefinition.prototype, "getRouteParameterDefs", null);
|
|
2330
|
+
__decorate([
|
|
2331
|
+
Memoize(),
|
|
2332
|
+
__metadata("design:type", Function),
|
|
2333
|
+
__metadata("design:paramtypes", [Object]),
|
|
2334
|
+
__metadata("design:returntype", Array)
|
|
2335
|
+
], PlaceDefinition.prototype, "getVisitParameterDefs", null);
|
|
2336
|
+
if (false) {
|
|
2337
|
+
/** @type {?} */
|
|
2338
|
+
PlaceDefinition.prototype.component;
|
|
2339
|
+
/** @type {?} */
|
|
2340
|
+
PlaceDefinition.prototype.path;
|
|
2341
|
+
/** @type {?} */
|
|
2342
|
+
PlaceDefinition.prototype.authenticate;
|
|
2343
|
+
/** @type {?} */
|
|
2344
|
+
PlaceDefinition.prototype.order;
|
|
2345
|
+
/** @type {?} */
|
|
2346
|
+
PlaceDefinition.prototype.data;
|
|
2347
|
+
/** @type {?} */
|
|
1878
2348
|
PlaceDefinition.prototype.routeParameters;
|
|
1879
2349
|
/** @type {?} */
|
|
1880
2350
|
PlaceDefinition.prototype.children;
|
|
1881
2351
|
}
|
|
2352
|
+
(function (PlaceDefinition) {
|
|
2353
|
+
/**
|
|
2354
|
+
* @record
|
|
2355
|
+
*/
|
|
2356
|
+
function ParameterOptions() { }
|
|
2357
|
+
PlaceDefinition.ParameterOptions = ParameterOptions;
|
|
2358
|
+
if (false) {
|
|
2359
|
+
/** @type {?|undefined} */
|
|
2360
|
+
ParameterOptions.prototype.includeRouteId;
|
|
2361
|
+
/** @type {?|undefined} */
|
|
2362
|
+
ParameterOptions.prototype.includeRouteParameters;
|
|
2363
|
+
/** @type {?|undefined} */
|
|
2364
|
+
ParameterOptions.prototype.includeNonRouteParameters;
|
|
2365
|
+
}
|
|
2366
|
+
})(PlaceDefinition || (PlaceDefinition = {}));
|
|
1882
2367
|
|
|
1883
2368
|
/**
|
|
1884
2369
|
* @fileoverview added by tsickle
|
|
@@ -1895,13 +2380,13 @@ class PlaceComponent extends DisposableComponent {
|
|
|
1895
2380
|
super();
|
|
1896
2381
|
}
|
|
1897
2382
|
/**
|
|
1898
|
-
* @param {?}
|
|
2383
|
+
* @param {?} visit
|
|
1899
2384
|
* @return {?}
|
|
1900
2385
|
*/
|
|
1901
|
-
initialiseBindings(
|
|
1902
|
-
assert.isNil(this.
|
|
1903
|
-
this.
|
|
1904
|
-
this.placeDefinition.
|
|
2386
|
+
initialiseBindings(visit) {
|
|
2387
|
+
assert.isNil(this.visit);
|
|
2388
|
+
this.visit = visit;
|
|
2389
|
+
this.placeDefinition.getVisitParameterDefs().forEach((/**
|
|
1905
2390
|
* @param {?} parameterDef
|
|
1906
2391
|
* @return {?}
|
|
1907
2392
|
*/
|
|
@@ -1919,21 +2404,25 @@ class PlaceComponent extends DisposableComponent {
|
|
|
1919
2404
|
/** @type {?} */
|
|
1920
2405
|
const model = (/** @type {?} */ (this[parameterDef.propertyName]));
|
|
1921
2406
|
// this.txo.observe(parameterDef.propertyName, model);
|
|
1922
|
-
this.registerDisposable(new Binding(this.
|
|
2407
|
+
this.registerDisposable(new Binding(this.visit, model, {
|
|
1923
2408
|
/**
|
|
1924
|
-
* @param {?}
|
|
2409
|
+
* @param {?} visit
|
|
1925
2410
|
* @return {?}
|
|
1926
2411
|
*/
|
|
1927
|
-
toRight(
|
|
1928
|
-
|
|
2412
|
+
toRight(visit) {
|
|
2413
|
+
/** @type {?} */
|
|
2414
|
+
const value = visit.getParameter(parameterDef.name);
|
|
2415
|
+
// console.log('push to component', {name:parameterDef.name, value, visit});
|
|
2416
|
+
return value;
|
|
1929
2417
|
},
|
|
1930
2418
|
/**
|
|
1931
2419
|
* @param {?} value
|
|
1932
|
-
* @param {?=}
|
|
2420
|
+
* @param {?=} currentVisit
|
|
1933
2421
|
* @return {?}
|
|
1934
2422
|
*/
|
|
1935
|
-
toLeft(value,
|
|
1936
|
-
|
|
2423
|
+
toLeft(value, currentVisit) {
|
|
2424
|
+
console.log('push to route', { name: parameterDef.name, value, currentVisit });
|
|
2425
|
+
return currentVisit.replace(parameterDef, value);
|
|
1937
2426
|
}
|
|
1938
2427
|
}));
|
|
1939
2428
|
}
|
|
@@ -1966,7 +2455,7 @@ class PlaceComponent extends DisposableComponent {
|
|
|
1966
2455
|
}
|
|
1967
2456
|
}
|
|
1968
2457
|
__decorate([
|
|
1969
|
-
Memoize(),
|
|
2458
|
+
Memoize$1(),
|
|
1970
2459
|
__metadata("design:type", PlaceDefinition),
|
|
1971
2460
|
__metadata("design:paramtypes", [])
|
|
1972
2461
|
], PlaceComponent.prototype, "placeDefinition", null);
|
|
@@ -1975,7 +2464,7 @@ if (false) {
|
|
|
1975
2464
|
* @type {?}
|
|
1976
2465
|
* @private
|
|
1977
2466
|
*/
|
|
1978
|
-
PlaceComponent.prototype.
|
|
2467
|
+
PlaceComponent.prototype.visit;
|
|
1979
2468
|
}
|
|
1980
2469
|
(function (PlaceComponent) {
|
|
1981
2470
|
/**
|
|
@@ -2033,20 +2522,20 @@ class AbstractPlaceNavigationComponent extends DisposableComponent {
|
|
|
2033
2522
|
*/
|
|
2034
2523
|
getNav(placeDef) {
|
|
2035
2524
|
/** @type {?} */
|
|
2036
|
-
const navItem = (/** @type {?} */ (placeDef.
|
|
2525
|
+
const navItem = (/** @type {?} */ (placeDef.getPlaceData('nav')));
|
|
2037
2526
|
return {
|
|
2038
2527
|
title: (/**
|
|
2039
2528
|
* @return {?}
|
|
2040
2529
|
*/
|
|
2041
|
-
() => navItem ? navItem.title() : placeDef.
|
|
2530
|
+
() => navItem ? navItem.title() : placeDef.searchPlaceData(['navTitle', 'title'])),
|
|
2042
2531
|
tooltip: (/**
|
|
2043
2532
|
* @return {?}
|
|
2044
2533
|
*/
|
|
2045
|
-
() => navItem && navItem.tooltip ? navItem.tooltip() : placeDef.
|
|
2534
|
+
() => navItem && navItem.tooltip ? navItem.tooltip() : placeDef.getPlaceData('navTooltip', null)),
|
|
2046
2535
|
icon: (/**
|
|
2047
2536
|
* @return {?}
|
|
2048
2537
|
*/
|
|
2049
|
-
() => navItem && navItem.icon ? navItem.icon() : placeDef.
|
|
2538
|
+
() => navItem && navItem.icon ? navItem.icon() : placeDef.getPlaceData('navIcon', null))
|
|
2050
2539
|
};
|
|
2051
2540
|
}
|
|
2052
2541
|
/**
|
|
@@ -2068,7 +2557,7 @@ __decorate([
|
|
|
2068
2557
|
__metadata("design:type", ListModel)
|
|
2069
2558
|
], AbstractPlaceNavigationComponent.prototype, "placesModel", void 0);
|
|
2070
2559
|
__decorate([
|
|
2071
|
-
Memoize
|
|
2560
|
+
Memoize(),
|
|
2072
2561
|
__metadata("design:type", Function),
|
|
2073
2562
|
__metadata("design:paramtypes", [PlaceDefinition]),
|
|
2074
2563
|
__metadata("design:returntype", Object)
|
|
@@ -2113,7 +2602,7 @@ class ListPlaceNavComponent extends AbstractPlaceNavigationComponent {
|
|
|
2113
2602
|
ListPlaceNavComponent.decorators = [
|
|
2114
2603
|
{ type: Component, args: [{
|
|
2115
2604
|
selector: 'angular-ui-powerups-list-place-nav',
|
|
2116
|
-
template: "<mat-nav-list class=\"app-menu\">\n <a mat-list-item *ngFor=\"let place of placeDefinitions.value\"\n [routerLink]='place.path'\n routerLinkActive #rla=\"routerLinkActive\"\n [matTooltip]=\"getNav(place).tooltip()\">\n <mat-icon *ngIf=\"getNav(place).icon()\">{{getNav(place).icon()}}</mat-icon>\n <span class=\"expanded-only\">{{getNav(place).title()}}</span>\n </a>\n</mat-nav-list>\n",
|
|
2605
|
+
template: "<mat-nav-list class=\"app-menu\">\n <a mat-list-item *ngFor=\"let place of placeDefinitions.value\"\n [routerLink]='place.path'\n [replaceUrl]=\"true\"\n routerLinkActive #rla=\"routerLinkActive\"\n [matTooltip]=\"getNav(place).tooltip()\">\n <mat-icon *ngIf=\"getNav(place).icon()\">{{getNav(place).icon()}}</mat-icon>\n <span class=\"expanded-only\">{{getNav(place).title()}}</span>\n </a>\n</mat-nav-list>\n",
|
|
2117
2606
|
styles: [":host{display:flex;flex-direction:column;--expanded-width:235px;--nav-item-width:var(--nav-bar-height);width:var(--nav-item-width);transition:width 125ms linear}:host.expanded{width:var(--expanded-width);max-width:var(--expanded-width)}.expanded-only{max-width:0;overflow:hidden}.collapsed-only{max-width:100%;overflow:hidden}.header{display:flex;flex-direction:row;justify-content:flex-end;align-items:center;height:var(--nav-bar-height);border-bottom:var(--pinstripe-border);cursor:pointer}.header .menu{flex:1}.header button{color:inherit;width:var(--nav-item-width);height:var(--nav-bar-height)}mat-nav-list{flex:1;display:flex;flex-direction:column}.mat-list-item{width:var(--nav-item-width);height:var(--nav-bar-height);color:inherit}mat-icon{color:inherit}mat-icon.flip-horizontal{transform:scaleX(-1)}:host-context(.expanded) .expanded-only{max-width:100%}:host-context(.expanded) .collapsed-only{max-width:0}:host-context(.expanded) .mat-list-item mat-icon{margin-right:12px}:host-context(.expanded) .mat-list-item span{text-wrap:none;white-space:nowrap}a[ng-reflect-router-link=manage-instruments] mat-icon{transform:rotate(90deg)}.app-menu{padding-top:0}"]
|
|
2118
2607
|
}] }
|
|
2119
2608
|
];
|
|
@@ -2139,6 +2628,7 @@ class PlaceHistory {
|
|
|
2139
2628
|
this.router = router;
|
|
2140
2629
|
this._history = new Map();
|
|
2141
2630
|
}
|
|
2631
|
+
// @Trace()
|
|
2142
2632
|
/**
|
|
2143
2633
|
* @param {?} state
|
|
2144
2634
|
* @return {?}
|
|
@@ -2148,7 +2638,7 @@ class PlaceHistory {
|
|
|
2148
2638
|
const history = this.getHistory(state.placeDefinition);
|
|
2149
2639
|
/** @type {?} */
|
|
2150
2640
|
const previousState = ___default.last(history);
|
|
2151
|
-
if (!previousState || state.
|
|
2641
|
+
if (!previousState || state.hasChangedFrom(previousState)) {
|
|
2152
2642
|
history.unshift(state); // LIFO
|
|
2153
2643
|
this.setHistory(state.placeDefinition, history.slice(0, 3)); // limit our history to 4 visits
|
|
2154
2644
|
}
|
|
@@ -2203,955 +2693,524 @@ if (false) {
|
|
|
2203
2693
|
* @fileoverview added by tsickle
|
|
2204
2694
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2205
2695
|
*/
|
|
2696
|
+
/**
|
|
2697
|
+
* @abstract
|
|
2698
|
+
*/
|
|
2206
2699
|
class NavigationSession {
|
|
2207
2700
|
/**
|
|
2208
|
-
* @
|
|
2209
|
-
* @param {?}
|
|
2701
|
+
* @protected
|
|
2702
|
+
* @param {?} firstNavigation
|
|
2210
2703
|
*/
|
|
2211
|
-
constructor(
|
|
2212
|
-
this.
|
|
2213
|
-
this.initialUrl = initialUrl;
|
|
2704
|
+
constructor(firstNavigation) {
|
|
2705
|
+
this.firstNavigation = firstNavigation;
|
|
2214
2706
|
this._alreadyAccepted = [];
|
|
2215
|
-
|
|
2707
|
+
this._visits = new Map();
|
|
2216
2708
|
}
|
|
2217
2709
|
/**
|
|
2218
|
-
* @param {?}
|
|
2710
|
+
* @param {?} visit
|
|
2219
2711
|
* @return {?}
|
|
2220
2712
|
*/
|
|
2221
|
-
|
|
2222
|
-
|
|
2713
|
+
storeVisit(visit) {
|
|
2714
|
+
this._visits.set(visit.placeDefinition, visit);
|
|
2223
2715
|
}
|
|
2224
2716
|
/**
|
|
2225
|
-
* @param {?}
|
|
2717
|
+
* @param {?} placeDef
|
|
2226
2718
|
* @return {?}
|
|
2227
2719
|
*/
|
|
2228
|
-
|
|
2229
|
-
this.
|
|
2720
|
+
getVisitFor(placeDef) {
|
|
2721
|
+
return this._visits.get(placeDef);
|
|
2230
2722
|
}
|
|
2231
|
-
}
|
|
2232
|
-
if (false) {
|
|
2233
2723
|
/**
|
|
2234
|
-
* @
|
|
2235
|
-
* @
|
|
2724
|
+
* @param {?} params
|
|
2725
|
+
* @return {?}
|
|
2236
2726
|
*/
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
NavigationSession.prototype.initialUrl;
|
|
2242
|
-
}
|
|
2243
|
-
class PlaceRouter {
|
|
2727
|
+
mergePrivatePlaceParameters(params) {
|
|
2728
|
+
return null;
|
|
2729
|
+
}
|
|
2730
|
+
// @Trace()
|
|
2244
2731
|
/**
|
|
2245
|
-
* @param {?}
|
|
2246
|
-
* @
|
|
2732
|
+
* @param {?} placeComponent
|
|
2733
|
+
* @return {?}
|
|
2247
2734
|
*/
|
|
2248
|
-
|
|
2249
|
-
this.
|
|
2250
|
-
this.angularLocation = angularLocation;
|
|
2251
|
-
this._navigationSession = new MutableValueModel();
|
|
2252
|
-
angularLocation.onUrlChange((/**
|
|
2253
|
-
* @param {?} url
|
|
2254
|
-
* @return {?}
|
|
2255
|
-
*/
|
|
2256
|
-
url => {
|
|
2257
|
-
console.log(`### ${url}`);
|
|
2258
|
-
}));
|
|
2259
|
-
this.router.events.subscribe((/**
|
|
2260
|
-
* @param {?} event
|
|
2261
|
-
* @return {?}
|
|
2262
|
-
*/
|
|
2263
|
-
event => {
|
|
2264
|
-
// console.log(`${event.constructor.name}`, location.pathname, angularLocation.getState());
|
|
2265
|
-
// NavigationStart -> .... -> NavigationCancel === redirect (so don't ask again)
|
|
2266
|
-
// NavigationStart -> .... -> NavigationEnd === navigated (so ask next time)
|
|
2267
|
-
// NavigationStart -> .... -> NavigationError === canceled (guard cancelled so ask next time)
|
|
2268
|
-
if (event instanceof NavigationStart && !this.navigationSession) {
|
|
2269
|
-
this._navigationSession.value = new NavigationSession(event.navigationTrigger === 'popstate', this.router.routerState.snapshot.url);
|
|
2270
|
-
}
|
|
2271
|
-
if (event instanceof NavigationEnd) {
|
|
2272
|
-
console.log('navigation ended');
|
|
2273
|
-
this._navigationSession.value = null;
|
|
2274
|
-
}
|
|
2275
|
-
if (event instanceof NavigationError) {
|
|
2276
|
-
console.log('navigation errored');
|
|
2277
|
-
this._navigationSession.value = null;
|
|
2278
|
-
}
|
|
2279
|
-
}));
|
|
2735
|
+
alreadyAccepted(placeComponent) {
|
|
2736
|
+
return this._alreadyAccepted.includes(placeComponent);
|
|
2280
2737
|
}
|
|
2738
|
+
// @Trace()
|
|
2281
2739
|
/**
|
|
2740
|
+
* @param {?} component
|
|
2282
2741
|
* @return {?}
|
|
2283
2742
|
*/
|
|
2284
|
-
|
|
2285
|
-
|
|
2743
|
+
rememberAcceptanceOf(component) {
|
|
2744
|
+
this._alreadyAccepted.push(component);
|
|
2286
2745
|
}
|
|
2287
2746
|
/**
|
|
2288
|
-
* @param {?}
|
|
2289
|
-
* @param {?} previous
|
|
2290
|
-
* @param {?} next
|
|
2747
|
+
* @param {?} url
|
|
2291
2748
|
* @return {?}
|
|
2292
2749
|
*/
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
const relativePath = !!previous.hasRouteId() ? '..' : '.';
|
|
2296
|
-
this.router.navigate([relativePath].concat(this.createRouteParameters(next), this.getChildPath(activatedRoute.snapshot)), {
|
|
2297
|
-
relativeTo: activatedRoute
|
|
2298
|
-
});
|
|
2750
|
+
setPopstateReturn(url) {
|
|
2751
|
+
this._popStateReturnUrl = url;
|
|
2299
2752
|
}
|
|
2300
|
-
// @Trace()
|
|
2301
2753
|
/**
|
|
2302
|
-
* @param {?} activatedRoute
|
|
2303
|
-
* @param {?} sanitised
|
|
2304
2754
|
* @return {?}
|
|
2305
2755
|
*/
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
const urlSegments = activatedRoute.url;
|
|
2309
|
-
/** @type {?} */
|
|
2310
|
-
const weHaveARouteId = sanitised.hasRouteId() && sanitised.getFormattedRouteId();
|
|
2311
|
-
/** @type {?} */
|
|
2312
|
-
const commands = (weHaveARouteId) ?
|
|
2313
|
-
[urlSegments[0].path, sanitised.getFormattedRouteId(), sanitised.getFormattedParameters()] :
|
|
2314
|
-
[urlSegments[0].path, sanitised.getFormattedParameters()];
|
|
2315
|
-
return this.router.createUrlTree(commands);
|
|
2756
|
+
get isPopState() {
|
|
2757
|
+
return !!this._popStateReturnUrl;
|
|
2316
2758
|
}
|
|
2317
2759
|
/**
|
|
2318
|
-
* @protected
|
|
2319
|
-
* @param {?} activatedRoute
|
|
2320
2760
|
* @return {?}
|
|
2321
2761
|
*/
|
|
2322
|
-
|
|
2323
|
-
return
|
|
2324
|
-
* @param {?} child
|
|
2325
|
-
* @return {?}
|
|
2326
|
-
*/
|
|
2327
|
-
child => child.url)));
|
|
2762
|
+
get popStateReturnUrl() {
|
|
2763
|
+
return this._popStateReturnUrl;
|
|
2328
2764
|
}
|
|
2329
2765
|
/**
|
|
2330
|
-
* @protected
|
|
2331
|
-
* @param {?} parameters
|
|
2332
2766
|
* @return {?}
|
|
2333
2767
|
*/
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
const routeId = parameters.getFormattedRouteId();
|
|
2337
|
-
return routeId ?
|
|
2338
|
-
[routeId, parameters.getFormattedParameters()] :
|
|
2339
|
-
[parameters.getFormattedParameters()];
|
|
2768
|
+
getVisits() {
|
|
2769
|
+
return Array.from(this._visits.values());
|
|
2340
2770
|
}
|
|
2341
2771
|
}
|
|
2342
|
-
PlaceRouter.decorators = [
|
|
2343
|
-
{ type: Injectable, args: [{
|
|
2344
|
-
providedIn: 'root'
|
|
2345
|
-
},] }
|
|
2346
|
-
];
|
|
2347
|
-
/** @nocollapse */
|
|
2348
|
-
PlaceRouter.ctorParameters = () => [
|
|
2349
|
-
{ type: Router },
|
|
2350
|
-
{ type: Location }
|
|
2351
|
-
];
|
|
2352
|
-
/** @nocollapse */ PlaceRouter.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(ɵɵinject(Router), ɵɵinject(Location)); }, token: PlaceRouter, providedIn: "root" });
|
|
2353
2772
|
if (false) {
|
|
2354
2773
|
/**
|
|
2355
2774
|
* @type {?}
|
|
2356
2775
|
* @private
|
|
2357
2776
|
*/
|
|
2358
|
-
|
|
2777
|
+
NavigationSession.prototype._alreadyAccepted;
|
|
2359
2778
|
/**
|
|
2360
2779
|
* @type {?}
|
|
2361
2780
|
* @private
|
|
2362
2781
|
*/
|
|
2363
|
-
|
|
2782
|
+
NavigationSession.prototype._visits;
|
|
2783
|
+
/**
|
|
2784
|
+
* @type {?}
|
|
2785
|
+
* @private
|
|
2786
|
+
*/
|
|
2787
|
+
NavigationSession.prototype._popStateReturnUrl;
|
|
2364
2788
|
/** @type {?} */
|
|
2365
|
-
|
|
2789
|
+
NavigationSession.prototype.isExternal;
|
|
2790
|
+
/** @type {?} */
|
|
2791
|
+
NavigationSession.prototype.firstNavigation;
|
|
2366
2792
|
}
|
|
2793
|
+
(function (NavigationSession) {
|
|
2794
|
+
class External extends NavigationSession {
|
|
2795
|
+
/**
|
|
2796
|
+
* @param {?} isFirstTime
|
|
2797
|
+
*/
|
|
2798
|
+
constructor(isFirstTime) {
|
|
2799
|
+
super(isFirstTime);
|
|
2800
|
+
this.isExternal = true;
|
|
2801
|
+
}
|
|
2802
|
+
}
|
|
2803
|
+
if (false) {
|
|
2804
|
+
/** @type {?} */
|
|
2805
|
+
External.prototype.isExternal;
|
|
2806
|
+
}
|
|
2807
|
+
class Internal extends NavigationSession {
|
|
2808
|
+
/**
|
|
2809
|
+
* @param {?} visit
|
|
2810
|
+
*/
|
|
2811
|
+
constructor(visit) {
|
|
2812
|
+
super(false);
|
|
2813
|
+
this.isExternal = false;
|
|
2814
|
+
this.storeVisit(visit);
|
|
2815
|
+
}
|
|
2816
|
+
}
|
|
2817
|
+
if (false) {
|
|
2818
|
+
/** @type {?} */
|
|
2819
|
+
Internal.prototype.isExternal;
|
|
2820
|
+
}
|
|
2821
|
+
/**
|
|
2822
|
+
* @param {?} visit
|
|
2823
|
+
* @return {?}
|
|
2824
|
+
*/
|
|
2825
|
+
function createInternal(visit) {
|
|
2826
|
+
return new Internal(visit);
|
|
2827
|
+
}
|
|
2828
|
+
NavigationSession.createInternal = createInternal;
|
|
2829
|
+
/**
|
|
2830
|
+
* @param {?} firstTimeRoute
|
|
2831
|
+
* @return {?}
|
|
2832
|
+
*/
|
|
2833
|
+
function createExternal(firstTimeRoute) {
|
|
2834
|
+
return new External(firstTimeRoute);
|
|
2835
|
+
}
|
|
2836
|
+
NavigationSession.createExternal = createExternal;
|
|
2837
|
+
})(NavigationSession || (NavigationSession = {}));
|
|
2367
2838
|
|
|
2368
2839
|
/**
|
|
2369
2840
|
* @fileoverview added by tsickle
|
|
2370
2841
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2371
2842
|
*/
|
|
2372
2843
|
/**
|
|
2373
|
-
* @
|
|
2374
|
-
* @template T, S
|
|
2844
|
+
* @record
|
|
2375
2845
|
*/
|
|
2376
|
-
|
|
2846
|
+
function Params() { }
|
|
2847
|
+
class Visit {
|
|
2377
2848
|
/**
|
|
2378
|
-
* @param {?}
|
|
2379
|
-
* @param {
|
|
2380
|
-
* @param {?} options
|
|
2849
|
+
* @param {?} placeDefinition
|
|
2850
|
+
* @param {?=} visitParameters
|
|
2381
2851
|
*/
|
|
2382
|
-
constructor(
|
|
2383
|
-
this.
|
|
2384
|
-
this.
|
|
2385
|
-
/** @type {?} */
|
|
2386
|
-
const opts = Opts.get(options);
|
|
2387
|
-
this.name = opts.getOptional('as', propertyName);
|
|
2388
|
-
this.remember = opts.getOptional('remember', false);
|
|
2389
|
-
this.defaultValue = opts.getOptional('defaultValue', null);
|
|
2852
|
+
constructor(placeDefinition, visitParameters = {}) {
|
|
2853
|
+
this.placeDefinition = placeDefinition;
|
|
2854
|
+
this.visitParameters = visitParameters;
|
|
2390
2855
|
}
|
|
2856
|
+
// @Trace()
|
|
2391
2857
|
/**
|
|
2392
|
-
* @param {?} injector
|
|
2393
2858
|
* @return {?}
|
|
2394
2859
|
*/
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
return new ParameterDefinition.DefaultParameterSanitiser(this.remember, this.defaultValue, injector.get(PlaceHistory));
|
|
2398
|
-
}
|
|
2399
|
-
else {
|
|
2400
|
-
return null;
|
|
2401
|
-
}
|
|
2860
|
+
getRouteId() {
|
|
2861
|
+
return this.placeDefinition.getRouteIdFrom(this);
|
|
2402
2862
|
}
|
|
2403
|
-
|
|
2404
|
-
if (false) {
|
|
2405
|
-
/** @type {?} */
|
|
2406
|
-
ParameterDefinition.prototype.isRouteId;
|
|
2407
|
-
/** @type {?} */
|
|
2408
|
-
ParameterDefinition.prototype.isArray;
|
|
2409
|
-
/** @type {?} */
|
|
2410
|
-
ParameterDefinition.prototype.name;
|
|
2863
|
+
// @Trace()
|
|
2411
2864
|
/**
|
|
2412
|
-
* @
|
|
2413
|
-
* @private
|
|
2865
|
+
* @return {?}
|
|
2414
2866
|
*/
|
|
2415
|
-
|
|
2867
|
+
hasRouteId() {
|
|
2868
|
+
return !isNil(this.getRouteId());
|
|
2869
|
+
}
|
|
2416
2870
|
/**
|
|
2417
|
-
*
|
|
2418
|
-
*
|
|
2871
|
+
* Returns the value of the place parameter with the specified name. The parameter
|
|
2872
|
+
* name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the
|
|
2873
|
+
* same as the the ValueModel property name.
|
|
2874
|
+
* @param {?} parameterName the field name of the property model or the `as` option if specified.
|
|
2875
|
+
* @return {?}
|
|
2419
2876
|
*/
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
ParameterDefinition.prototype.type;
|
|
2425
|
-
}
|
|
2426
|
-
(function (ParameterDefinition) {
|
|
2877
|
+
getParameter(parameterName) {
|
|
2878
|
+
return this.visitParameters[parameterName];
|
|
2879
|
+
}
|
|
2880
|
+
// @Trace()
|
|
2427
2881
|
/**
|
|
2428
|
-
* @
|
|
2429
|
-
* @
|
|
2882
|
+
* @param {?} parameterName
|
|
2883
|
+
* @return {?}
|
|
2430
2884
|
*/
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
if (false) {
|
|
2434
|
-
/** @type {?|undefined} */
|
|
2435
|
-
Options.prototype.as;
|
|
2436
|
-
/** @type {?|undefined} */
|
|
2437
|
-
Options.prototype.optional;
|
|
2438
|
-
/** @type {?|undefined} */
|
|
2439
|
-
Options.prototype.remember;
|
|
2440
|
-
/** @type {?|undefined} */
|
|
2441
|
-
Options.prototype.defaultValue;
|
|
2442
|
-
}
|
|
2443
|
-
/**
|
|
2444
|
-
* @template T
|
|
2445
|
-
*/
|
|
2446
|
-
class RouteId extends ParameterDefinition {
|
|
2447
|
-
constructor() {
|
|
2448
|
-
super(...arguments);
|
|
2449
|
-
this.isRouteId = true;
|
|
2450
|
-
this.isArray = false;
|
|
2451
|
-
}
|
|
2452
|
-
}
|
|
2453
|
-
ParameterDefinition.RouteId = RouteId;
|
|
2454
|
-
if (false) {
|
|
2455
|
-
/** @type {?} */
|
|
2456
|
-
RouteId.prototype.isRouteId;
|
|
2457
|
-
/** @type {?} */
|
|
2458
|
-
RouteId.prototype.isArray;
|
|
2885
|
+
hasParameter(parameterName) {
|
|
2886
|
+
return Object.keys(this.visitParameters).includes(parameterName);
|
|
2459
2887
|
}
|
|
2460
2888
|
/**
|
|
2461
|
-
* @template
|
|
2889
|
+
* @template S
|
|
2890
|
+
* @param {?} parameter
|
|
2891
|
+
* @param {?} value
|
|
2892
|
+
* @return {?}
|
|
2462
2893
|
*/
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
super(...arguments);
|
|
2466
|
-
this.isRouteId = false;
|
|
2467
|
-
this.isArray = false;
|
|
2468
|
-
}
|
|
2469
|
-
}
|
|
2470
|
-
ParameterDefinition.ValueParameter = ValueParameter;
|
|
2471
|
-
if (false) {
|
|
2472
|
-
/** @type {?} */
|
|
2473
|
-
ValueParameter.prototype.isRouteId;
|
|
2474
|
-
/** @type {?} */
|
|
2475
|
-
ValueParameter.prototype.isArray;
|
|
2894
|
+
replace(parameter, value) {
|
|
2895
|
+
return new Visit(this.placeDefinition, Object.assign({}, this.visitParameters, { [parameter.name]: value }));
|
|
2476
2896
|
}
|
|
2477
2897
|
/**
|
|
2478
|
-
* @template
|
|
2898
|
+
* @template S
|
|
2899
|
+
* @param {?} routeParams
|
|
2900
|
+
* @return {?}
|
|
2479
2901
|
*/
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
super(...arguments);
|
|
2483
|
-
this.isRouteId = false;
|
|
2484
|
-
this.isArray = true;
|
|
2485
|
-
}
|
|
2486
|
-
}
|
|
2487
|
-
ParameterDefinition.ArrayParameter = ArrayParameter;
|
|
2488
|
-
if (false) {
|
|
2902
|
+
mergeRouteParameters(routeParams) {
|
|
2903
|
+
// todo: whitelist parameters.
|
|
2489
2904
|
/** @type {?} */
|
|
2490
|
-
|
|
2905
|
+
const routeParameterKeys = Object.keys(routeParams);
|
|
2491
2906
|
/** @type {?} */
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
* @template T, S
|
|
2496
|
-
*/
|
|
2497
|
-
class DefaultParameterSanitiser {
|
|
2498
|
-
/**
|
|
2499
|
-
* @param {?} remember
|
|
2500
|
-
* @param {?} defaultValue
|
|
2501
|
-
* @param {?} placeHistory
|
|
2502
|
-
*/
|
|
2503
|
-
constructor(remember, defaultValue, placeHistory) {
|
|
2504
|
-
this.remember = remember;
|
|
2505
|
-
this.defaultValue = defaultValue;
|
|
2506
|
-
this.placeHistory = placeHistory;
|
|
2507
|
-
}
|
|
2508
|
-
/**
|
|
2509
|
-
* @param {?} parameter
|
|
2510
|
-
* @param {?=} visit
|
|
2907
|
+
const params = {};
|
|
2908
|
+
this.placeDefinition.getVisitParameterDefs().forEach((/**
|
|
2909
|
+
* @param {?} def
|
|
2511
2910
|
* @return {?}
|
|
2512
2911
|
*/
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
/** @type {?} */
|
|
2518
|
-
const previousVisit = ___default.first(this.placeHistory.getHistory(visit.placeDefinition));
|
|
2519
|
-
if (this.remember && previousVisit) {
|
|
2520
|
-
value = previousVisit.getValueOf(parameter.definition);
|
|
2912
|
+
def => {
|
|
2913
|
+
if (def.isRouteId || def.isRouteParameter) {
|
|
2914
|
+
if (routeParameterKeys.includes(def.name)) {
|
|
2915
|
+
params[def.name] = routeParams[def.name];
|
|
2521
2916
|
}
|
|
2522
|
-
return parameter.isEmptyValue(value) ? this.defaultValue : value;
|
|
2523
2917
|
}
|
|
2524
2918
|
else {
|
|
2525
|
-
|
|
2919
|
+
// copy non route params as is, but only if they already exist otherwise we'll inject nil values and break the
|
|
2920
|
+
// defaults and remember sanitisation process.
|
|
2921
|
+
if (this.hasParameter(def.name)) {
|
|
2922
|
+
params[def.name] = this.getParameter(def.name);
|
|
2923
|
+
}
|
|
2526
2924
|
}
|
|
2527
|
-
}
|
|
2528
|
-
|
|
2529
|
-
ParameterDefinition.DefaultParameterSanitiser = DefaultParameterSanitiser;
|
|
2530
|
-
if (false) {
|
|
2531
|
-
/** @type {?} */
|
|
2532
|
-
DefaultParameterSanitiser.prototype.remember;
|
|
2533
|
-
/** @type {?} */
|
|
2534
|
-
DefaultParameterSanitiser.prototype.defaultValue;
|
|
2535
|
-
/** @type {?} */
|
|
2536
|
-
DefaultParameterSanitiser.prototype.placeHistory;
|
|
2537
|
-
}
|
|
2538
|
-
})(ParameterDefinition || (ParameterDefinition = {}));
|
|
2539
|
-
|
|
2540
|
-
/**
|
|
2541
|
-
* @fileoverview added by tsickle
|
|
2542
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2543
|
-
*/
|
|
2544
|
-
/**
|
|
2545
|
-
* @abstract
|
|
2546
|
-
* @template S, T, R
|
|
2547
|
-
*/
|
|
2548
|
-
class RouteParameterValue {
|
|
2549
|
-
/**
|
|
2550
|
-
* @param {?} definition
|
|
2551
|
-
* @param {?} rawValue
|
|
2552
|
-
*/
|
|
2553
|
-
constructor(definition, rawValue) {
|
|
2554
|
-
this.definition = definition;
|
|
2555
|
-
this.rawValue = rawValue;
|
|
2556
|
-
}
|
|
2557
|
-
/**
|
|
2558
|
-
* @return {?}
|
|
2559
|
-
*/
|
|
2560
|
-
isRouteId() {
|
|
2561
|
-
return this.definition.isRouteId;
|
|
2562
|
-
}
|
|
2563
|
-
/**
|
|
2564
|
-
* @param {?} otherValue
|
|
2565
|
-
* @return {?}
|
|
2566
|
-
*/
|
|
2567
|
-
hasChanged(otherValue) {
|
|
2568
|
-
return this.isEmpty() ?
|
|
2569
|
-
!this.isEmptyValue(otherValue) :
|
|
2570
|
-
this.isEmptyValue(otherValue) || !this.isSameValue(otherValue);
|
|
2571
|
-
}
|
|
2572
|
-
/**
|
|
2573
|
-
* Return's true if the current value is empty.
|
|
2574
|
-
* @return {?}
|
|
2575
|
-
*/
|
|
2576
|
-
isEmpty() {
|
|
2577
|
-
return this.isEmptyValue(this.value);
|
|
2925
|
+
}));
|
|
2926
|
+
return new Visit(this.placeDefinition, params);
|
|
2578
2927
|
}
|
|
2579
2928
|
/**
|
|
2580
|
-
*
|
|
2929
|
+
* @param {?} other
|
|
2581
2930
|
* @return {?}
|
|
2582
2931
|
*/
|
|
2583
|
-
|
|
2584
|
-
|
|
2932
|
+
hasRoutingChangedFrom(other) {
|
|
2933
|
+
/** @type {?} */
|
|
2934
|
+
const samePlace = other.placeDefinition === this.placeDefinition;
|
|
2935
|
+
/** @type {?} */
|
|
2936
|
+
const sameRouteParameters = isEqual(this.placeDefinition.getFormattedRouteParameters(this, true), this.placeDefinition.getFormattedRouteParameters(other, true));
|
|
2937
|
+
return !samePlace || !sameRouteParameters;
|
|
2585
2938
|
}
|
|
2586
2939
|
/**
|
|
2587
|
-
* @param {?}
|
|
2588
|
-
* @param {?} injector
|
|
2940
|
+
* @param {?} other
|
|
2589
2941
|
* @return {?}
|
|
2590
2942
|
*/
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
if (sanitiser) {
|
|
2596
|
-
return sanitiser.sanitise(this, visit);
|
|
2597
|
-
}
|
|
2598
|
-
else {
|
|
2599
|
-
return this.value;
|
|
2600
|
-
}
|
|
2601
|
-
});
|
|
2943
|
+
hasChangedFrom(other) {
|
|
2944
|
+
/** @type {?} */
|
|
2945
|
+
const sameNonRouteParameters = isEqual(this.placeDefinition.getNonRouteParameters(this), this.placeDefinition.getNonRouteParameters(other));
|
|
2946
|
+
return !sameNonRouteParameters || this.hasRoutingChangedFrom(other);
|
|
2602
2947
|
}
|
|
2603
2948
|
}
|
|
2604
2949
|
if (false) {
|
|
2605
2950
|
/** @type {?} */
|
|
2606
|
-
|
|
2607
|
-
/** @type {?} */
|
|
2608
|
-
RouteParameterValue.prototype.definition;
|
|
2951
|
+
Visit.prototype.placeDefinition;
|
|
2609
2952
|
/**
|
|
2610
2953
|
* @type {?}
|
|
2611
|
-
* @
|
|
2612
|
-
*/
|
|
2613
|
-
RouteParameterValue.prototype.rawValue;
|
|
2614
|
-
/**
|
|
2615
|
-
* @abstract
|
|
2616
|
-
* @param {?} otherValue
|
|
2617
|
-
* @return {?}
|
|
2618
|
-
*/
|
|
2619
|
-
RouteParameterValue.prototype.isSameValue = function (otherValue) { };
|
|
2620
|
-
/**
|
|
2621
|
-
* @abstract
|
|
2622
|
-
* @return {?}
|
|
2623
|
-
*/
|
|
2624
|
-
RouteParameterValue.prototype.formattedValue = function () { };
|
|
2625
|
-
/**
|
|
2626
|
-
* @abstract
|
|
2627
|
-
* @param {?} value
|
|
2628
|
-
* @return {?}
|
|
2629
|
-
*/
|
|
2630
|
-
RouteParameterValue.prototype.replace = function (value) { };
|
|
2631
|
-
/**
|
|
2632
|
-
* @abstract
|
|
2633
|
-
* @param {?} value
|
|
2634
|
-
* @return {?}
|
|
2954
|
+
* @private
|
|
2635
2955
|
*/
|
|
2636
|
-
|
|
2956
|
+
Visit.prototype.visitParameters;
|
|
2637
2957
|
}
|
|
2638
|
-
(function (RouteParameterValue) {
|
|
2639
|
-
/**
|
|
2640
|
-
* @template T
|
|
2641
|
-
* @param {?} def
|
|
2642
|
-
* @param {?} paramMap
|
|
2643
|
-
* @return {?}
|
|
2644
|
-
*/
|
|
2645
|
-
function create(def, paramMap) {
|
|
2646
|
-
// NOTE: Using undefined is important as it triggers the isMissing flag which is used by defaultValue and remember flags
|
|
2647
|
-
if (def.isArray) {
|
|
2648
|
-
return new RouteParameterValue.Array(def, paramMap.has(def.name) ? paramMap.getAll(def.name) : undefined);
|
|
2649
|
-
}
|
|
2650
|
-
else {
|
|
2651
|
-
/** @type {?} */
|
|
2652
|
-
let rawValue = paramMap.has(def.name) ? paramMap.get(def.name) : undefined;
|
|
2653
|
-
// route ids are always present so we have to check if it's empty to flag it as missing..
|
|
2654
|
-
rawValue = def.isRouteId && ___default.isEmpty(rawValue) ? undefined : rawValue;
|
|
2655
|
-
return new RouteParameterValue.Scalar(def, rawValue);
|
|
2656
|
-
}
|
|
2657
|
-
}
|
|
2658
|
-
RouteParameterValue.create = create;
|
|
2659
|
-
/**
|
|
2660
|
-
* @template T
|
|
2661
|
-
*/
|
|
2662
|
-
class Scalar extends RouteParameterValue {
|
|
2663
|
-
/**
|
|
2664
|
-
* @return {?}
|
|
2665
|
-
*/
|
|
2666
|
-
get value() {
|
|
2667
|
-
return this.definition.type.parse(this.rawValue);
|
|
2668
|
-
}
|
|
2669
|
-
/**
|
|
2670
|
-
* @param {?} otherValue
|
|
2671
|
-
* @return {?}
|
|
2672
|
-
*/
|
|
2673
|
-
isSameValue(otherValue) {
|
|
2674
|
-
return this.value === otherValue;
|
|
2675
|
-
}
|
|
2676
|
-
/**
|
|
2677
|
-
* @param {?} value
|
|
2678
|
-
* @return {?}
|
|
2679
|
-
*/
|
|
2680
|
-
replace(value) {
|
|
2681
|
-
return new RouteParameterValue.Scalar(this.definition, this.isEmptyValue(value) ? undefined : this.definition.type.format(value));
|
|
2682
|
-
}
|
|
2683
|
-
/**
|
|
2684
|
-
* @return {?}
|
|
2685
|
-
*/
|
|
2686
|
-
formattedValue() {
|
|
2687
|
-
return this.isEmpty() ? undefined : this.definition.type.format(this.value);
|
|
2688
|
-
}
|
|
2689
|
-
/**
|
|
2690
|
-
* @param {?} value
|
|
2691
|
-
* @return {?}
|
|
2692
|
-
*/
|
|
2693
|
-
isEmptyValue(value) {
|
|
2694
|
-
return ___default.isNil(value);
|
|
2695
|
-
}
|
|
2696
|
-
}
|
|
2697
|
-
__decorate([
|
|
2698
|
-
Memoize$1(),
|
|
2699
|
-
__metadata("design:type", Object),
|
|
2700
|
-
__metadata("design:paramtypes", [])
|
|
2701
|
-
], Scalar.prototype, "value", null);
|
|
2702
|
-
RouteParameterValue.Scalar = Scalar;
|
|
2703
|
-
/**
|
|
2704
|
-
* @template T
|
|
2705
|
-
*/
|
|
2706
|
-
class Array extends RouteParameterValue {
|
|
2707
|
-
/**
|
|
2708
|
-
* @return {?}
|
|
2709
|
-
*/
|
|
2710
|
-
get value() {
|
|
2711
|
-
return (this.rawValue || [])
|
|
2712
|
-
.filter((/**
|
|
2713
|
-
* @param {?} s
|
|
2714
|
-
* @return {?}
|
|
2715
|
-
*/
|
|
2716
|
-
s => !___default.isEmpty(s)))
|
|
2717
|
-
.map((/**
|
|
2718
|
-
* @param {?} raw
|
|
2719
|
-
* @return {?}
|
|
2720
|
-
*/
|
|
2721
|
-
raw => this.definition.type.parse(raw)));
|
|
2722
|
-
}
|
|
2723
|
-
/**
|
|
2724
|
-
* @param {?} otherValue
|
|
2725
|
-
* @return {?}
|
|
2726
|
-
*/
|
|
2727
|
-
isSameValue(otherValue) {
|
|
2728
|
-
return ___default.isEqual(this.value, otherValue);
|
|
2729
|
-
}
|
|
2730
|
-
/**
|
|
2731
|
-
* @param {?} value
|
|
2732
|
-
* @return {?}
|
|
2733
|
-
*/
|
|
2734
|
-
replace(value) {
|
|
2735
|
-
return new RouteParameterValue.Array(this.definition, this.isEmptyValue(value) ? undefined : value.map((/**
|
|
2736
|
-
* @param {?} v
|
|
2737
|
-
* @return {?}
|
|
2738
|
-
*/
|
|
2739
|
-
v => this.definition.type.format(v))));
|
|
2740
|
-
}
|
|
2741
|
-
/**
|
|
2742
|
-
* @return {?}
|
|
2743
|
-
*/
|
|
2744
|
-
formattedValue() {
|
|
2745
|
-
return this.isEmpty() ? [] : this.value.map((/**
|
|
2746
|
-
* @param {?} v
|
|
2747
|
-
* @return {?}
|
|
2748
|
-
*/
|
|
2749
|
-
v => this.definition.type.format(v)));
|
|
2750
|
-
}
|
|
2751
|
-
/**
|
|
2752
|
-
* @param {?} value
|
|
2753
|
-
* @return {?}
|
|
2754
|
-
*/
|
|
2755
|
-
isEmptyValue(value) {
|
|
2756
|
-
return ___default.isNil(value) || value.length < 1;
|
|
2757
|
-
}
|
|
2758
|
-
}
|
|
2759
|
-
__decorate([
|
|
2760
|
-
Memoize$1(),
|
|
2761
|
-
__metadata("design:type", Array),
|
|
2762
|
-
__metadata("design:paramtypes", [])
|
|
2763
|
-
], Array.prototype, "value", null);
|
|
2764
|
-
RouteParameterValue.Array = Array;
|
|
2765
|
-
})(RouteParameterValue || (RouteParameterValue = {}));
|
|
2766
2958
|
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
*/
|
|
2773
|
-
constructor(placeDefinition, parameters) {
|
|
2774
|
-
this.placeDefinition = placeDefinition;
|
|
2775
|
-
this.parameters = parameters;
|
|
2776
|
-
}
|
|
2959
|
+
/**
|
|
2960
|
+
* @fileoverview added by tsickle
|
|
2961
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2962
|
+
*/
|
|
2963
|
+
class PlaceRouter extends GarbageCollector {
|
|
2777
2964
|
/**
|
|
2778
|
-
* @param {?}
|
|
2779
|
-
* @param {
|
|
2780
|
-
* @
|
|
2965
|
+
* @param {?} router
|
|
2966
|
+
* @param {?} angularLocation
|
|
2967
|
+
* @param {?} placeHistory
|
|
2781
2968
|
*/
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2969
|
+
constructor(router, angularLocation, placeHistory) {
|
|
2970
|
+
super();
|
|
2971
|
+
this.router = router;
|
|
2972
|
+
this.angularLocation = angularLocation;
|
|
2973
|
+
this.placeHistory = placeHistory;
|
|
2974
|
+
this.firstRoute = true;
|
|
2975
|
+
this._navigationSessionModel = new MutableValueModel();
|
|
2976
|
+
this._activeVisits = new MutableListModel();
|
|
2977
|
+
const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
|
|
2978
|
+
this.activeVisitIndex = chain(this._activeVisits).indexBy('placeDefinition');
|
|
2979
|
+
angularLocation.onUrlChange((/**
|
|
2980
|
+
* @param {?} url
|
|
2786
2981
|
* @return {?}
|
|
2787
2982
|
*/
|
|
2788
|
-
|
|
2789
|
-
|
|
2983
|
+
url => {
|
|
2984
|
+
console.log(`location.onUrlChange -> ${url}`);
|
|
2790
2985
|
}));
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
mine: changed.value,
|
|
2795
|
-
theirs: other.getValueOf(changed.definition)
|
|
2796
|
-
});
|
|
2797
|
-
}
|
|
2798
|
-
return !!changed;
|
|
2799
|
-
}
|
|
2800
|
-
/**
|
|
2801
|
-
* @template T, S
|
|
2802
|
-
* @param {?} parameterDef
|
|
2803
|
-
* @return {?}
|
|
2804
|
-
*/
|
|
2805
|
-
getParameter(parameterDef) {
|
|
2806
|
-
return this.parameters.find((/**
|
|
2807
|
-
* @param {?} r
|
|
2986
|
+
// TODO: make setup the callbacks in during module initiation to make this testable.
|
|
2987
|
+
this.router.events.subscribe((/**
|
|
2988
|
+
* @param {?} event
|
|
2808
2989
|
* @return {?}
|
|
2809
2990
|
*/
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
}
|
|
2828
|
-
/**
|
|
2829
|
-
* @param {?} name
|
|
2830
|
-
* @return {?}
|
|
2831
|
-
*/
|
|
2832
|
-
getParameterValue(name) {
|
|
2833
|
-
/** @type {?} */
|
|
2834
|
-
const resolvedParameter = this.parameters.find((/**
|
|
2835
|
-
* @param {?} r
|
|
2991
|
+
event => {
|
|
2992
|
+
// Routing event sequence
|
|
2993
|
+
// ======================
|
|
2994
|
+
// NavigationStart -> .... -> NavigationCancel --> redirect, go around again in the same session
|
|
2995
|
+
// NavigationStart -> .... -> NavigationEnd --> navigation complete, end session.
|
|
2996
|
+
// NavigationStart -> .... -> NavigationError --> navigation canceled, end session.
|
|
2997
|
+
// =======================
|
|
2998
|
+
if (event instanceof NavigationStart) {
|
|
2999
|
+
this.onAngularRouterStarted(event);
|
|
3000
|
+
}
|
|
3001
|
+
if (event instanceof NavigationEnd || event instanceof NavigationError) {
|
|
3002
|
+
this.onAngularRouterFinished();
|
|
3003
|
+
}
|
|
3004
|
+
}));
|
|
3005
|
+
this.navigationSessionActive = chain(this.navigationSessionModel).isNotNil();
|
|
3006
|
+
this.navigationSessionActive.subscribe((/**
|
|
3007
|
+
* @param {?} active
|
|
2836
3008
|
* @return {?}
|
|
2837
3009
|
*/
|
|
2838
|
-
|
|
2839
|
-
|
|
3010
|
+
active => {
|
|
3011
|
+
console.log('navigationSessionActive', active);
|
|
3012
|
+
}));
|
|
3013
|
+
// const txo = new TransactionObserver().onEvent(e => console.log(e.toString()));
|
|
3014
|
+
// txo.observe('this.navigationSessionModel', this.navigationSessionModel);
|
|
2840
3015
|
}
|
|
2841
3016
|
/**
|
|
2842
|
-
* @private
|
|
2843
3017
|
* @return {?}
|
|
2844
3018
|
*/
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
// capture this in the type system though
|
|
2848
|
-
return (/** @type {?} */ (this.parameters.find((/**
|
|
2849
|
-
* @param {?} p
|
|
2850
|
-
* @return {?}
|
|
2851
|
-
*/
|
|
2852
|
-
p => p.definition.isRouteId))));
|
|
3019
|
+
get navigationSession() {
|
|
3020
|
+
return this._navigationSessionModel.value;
|
|
2853
3021
|
}
|
|
2854
3022
|
/**
|
|
2855
|
-
* @private
|
|
2856
3023
|
* @return {?}
|
|
2857
3024
|
*/
|
|
2858
|
-
|
|
2859
|
-
return this.
|
|
2860
|
-
* @param {?} r
|
|
2861
|
-
* @return {?}
|
|
2862
|
-
*/
|
|
2863
|
-
r => !r.definition.isRouteId));
|
|
3025
|
+
get navigationSessionModel() {
|
|
3026
|
+
return this._navigationSessionModel.readonly;
|
|
2864
3027
|
}
|
|
2865
3028
|
/**
|
|
2866
3029
|
* @return {?}
|
|
2867
3030
|
*/
|
|
2868
|
-
|
|
2869
|
-
return
|
|
3031
|
+
get activeVisits() {
|
|
3032
|
+
return this._activeVisits.readonly;
|
|
2870
3033
|
}
|
|
2871
3034
|
/**
|
|
3035
|
+
* placeRouter.navigate(placeDestinations.somePlace.createVisit(routeId, ...visitParams));
|
|
3036
|
+
* @param {?} visit
|
|
2872
3037
|
* @return {?}
|
|
2873
3038
|
*/
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
3039
|
+
// @Trace()
|
|
3040
|
+
navigate(visit) {
|
|
3041
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3042
|
+
this.doNavigation(visit);
|
|
3043
|
+
});
|
|
2878
3044
|
}
|
|
2879
3045
|
/**
|
|
3046
|
+
* @param {?} activatedRoute
|
|
3047
|
+
* @param {?} previous
|
|
3048
|
+
* @param {?} next
|
|
2880
3049
|
* @return {?}
|
|
2881
3050
|
*/
|
|
2882
|
-
|
|
2883
|
-
return this
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
3051
|
+
pushVisitChangesToRoute(activatedRoute, previous, next) {
|
|
3052
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3053
|
+
// we have to push to history so our remember sanitisers don't pick up the previous value
|
|
3054
|
+
// when it's been cleared by the user.
|
|
3055
|
+
this.placeHistory.add(next);
|
|
3056
|
+
// FIXME: no route id -> route id duplicates route parameters
|
|
3057
|
+
if (next.hasRoutingChangedFrom(previous)) {
|
|
3058
|
+
return this.doNavigation(next, (/**
|
|
3059
|
+
* @param {?} router
|
|
3060
|
+
* @return {?}
|
|
3061
|
+
*/
|
|
3062
|
+
router => {
|
|
3063
|
+
/** @type {?} */
|
|
3064
|
+
const relativePath = !!previous.placeDefinition.hasRouteId() ? '..' : '.';
|
|
3065
|
+
/** @type {?} */
|
|
3066
|
+
const def = next.placeDefinition;
|
|
3067
|
+
/** @type {?} */
|
|
3068
|
+
const params = next.hasRouteId() ?
|
|
3069
|
+
[def.getFormattedRouteId(next), def.getFormattedRouteParameters(next)] :
|
|
3070
|
+
[def.getFormattedRouteParameters(next)];
|
|
3071
|
+
/** @type {?} */
|
|
3072
|
+
const commands = [relativePath].concat(params, this.getChildPath(activatedRoute.snapshot));
|
|
3073
|
+
console.log('### Redirect', commands);
|
|
3074
|
+
return router.navigate(commands, {
|
|
3075
|
+
relativeTo: activatedRoute
|
|
3076
|
+
});
|
|
3077
|
+
}));
|
|
3078
|
+
}
|
|
3079
|
+
});
|
|
2888
3080
|
}
|
|
2889
3081
|
/**
|
|
3082
|
+
* @param {?} visit
|
|
3083
|
+
* @param {?=} customNavigation
|
|
2890
3084
|
* @return {?}
|
|
2891
3085
|
*/
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
3086
|
+
doNavigation(visit, customNavigation) {
|
|
3087
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3088
|
+
this._navigationSessionModel.value = NavigationSession.createInternal(visit);
|
|
3089
|
+
try {
|
|
3090
|
+
if (customNavigation) {
|
|
3091
|
+
yield customNavigation(this.router);
|
|
3092
|
+
}
|
|
3093
|
+
else {
|
|
3094
|
+
/** @type {?} */
|
|
3095
|
+
const def = visit.placeDefinition;
|
|
3096
|
+
// @see https://coolon.atlassian.net/browse/AUP-41
|
|
3097
|
+
/** @type {?} */
|
|
3098
|
+
const parameterCommands = visit.hasRouteId() ?
|
|
3099
|
+
[def.getFormattedRouteId(visit), def.getFormattedRouteParameters(visit)] :
|
|
3100
|
+
[def.getFormattedRouteParameters(visit)];
|
|
3101
|
+
/** @type {?} */
|
|
3102
|
+
const commands = [def.path].concat(parameterCommands);
|
|
3103
|
+
console.log('_doNavigation', visit, commands);
|
|
3104
|
+
yield this.router.navigate(commands);
|
|
3105
|
+
}
|
|
3106
|
+
}
|
|
3107
|
+
finally {
|
|
3108
|
+
if (this.navigationSession && !this.router.getCurrentNavigation()) {
|
|
3109
|
+
this.onAngularRouterFinished();
|
|
3110
|
+
}
|
|
3111
|
+
}
|
|
3112
|
+
});
|
|
2908
3113
|
}
|
|
3114
|
+
// @Trace()
|
|
3115
|
+
/**
|
|
3116
|
+
* @private
|
|
3117
|
+
* @param {?} event
|
|
3118
|
+
* @return {?}
|
|
3119
|
+
*/
|
|
3120
|
+
onAngularRouterStarted(event) {
|
|
3121
|
+
if (!this.navigationSession) { // We been activated by an external route rather than placeRouter.go(visit)
|
|
3122
|
+
console.log('navigation started', { firstTime: this.firstRoute });
|
|
3123
|
+
/** @type {?} */
|
|
3124
|
+
const session = NavigationSession.createExternal(this.firstRoute);
|
|
3125
|
+
if (event.navigationTrigger === 'popstate') {
|
|
3126
|
+
session.setPopstateReturn(this.router.routerState.snapshot.url);
|
|
3127
|
+
}
|
|
3128
|
+
this._navigationSessionModel.value = session;
|
|
3129
|
+
}
|
|
3130
|
+
this.firstRoute = false;
|
|
3131
|
+
}
|
|
3132
|
+
// @Trace()
|
|
2909
3133
|
/**
|
|
3134
|
+
* @private
|
|
2910
3135
|
* @return {?}
|
|
2911
3136
|
*/
|
|
2912
|
-
|
|
3137
|
+
onAngularRouterFinished() {
|
|
2913
3138
|
/** @type {?} */
|
|
2914
|
-
const
|
|
3139
|
+
const session = this._navigationSessionModel.value;
|
|
3140
|
+
// Update visits before we end the navigation session. This allows the place out let to
|
|
3141
|
+
// gate ignore changes that occur while the visit is active
|
|
2915
3142
|
/** @type {?} */
|
|
2916
|
-
const
|
|
2917
|
-
|
|
3143
|
+
const visits = session.getVisits();
|
|
3144
|
+
visits.forEach((/**
|
|
3145
|
+
* @param {?} v
|
|
2918
3146
|
* @return {?}
|
|
2919
3147
|
*/
|
|
2920
|
-
|
|
2921
|
-
|
|
3148
|
+
v => {
|
|
3149
|
+
this.placeHistory.add(v);
|
|
2922
3150
|
}));
|
|
2923
|
-
|
|
3151
|
+
this._activeVisits.value = visits;
|
|
3152
|
+
this._navigationSessionModel.value = null;
|
|
2924
3153
|
}
|
|
2925
3154
|
/**
|
|
2926
|
-
* @
|
|
2927
|
-
* @param {?} parameter
|
|
2928
|
-
* @param {?} value
|
|
3155
|
+
* @param {?} activatedRoute
|
|
2929
3156
|
* @return {?}
|
|
2930
3157
|
*/
|
|
2931
|
-
|
|
2932
|
-
return
|
|
2933
|
-
* @param {?}
|
|
3158
|
+
getChildPath(activatedRoute) {
|
|
3159
|
+
return ___default.flatten(activatedRoute.children.map((/**
|
|
3160
|
+
* @param {?} child
|
|
2934
3161
|
* @return {?}
|
|
2935
3162
|
*/
|
|
2936
|
-
|
|
2937
|
-
return p.definition === parameter ? p.replace(value) : p;
|
|
2938
|
-
})));
|
|
2939
|
-
}
|
|
2940
|
-
/**
|
|
2941
|
-
* @param {?} injector
|
|
2942
|
-
* @return {?}
|
|
2943
|
-
*/
|
|
2944
|
-
sanitise(injector) {
|
|
2945
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2946
|
-
if (this.hasRouteId()) {
|
|
2947
|
-
/** @type {?} */
|
|
2948
|
-
const routeId = this.getRouteIdParameter();
|
|
2949
|
-
/** @type {?} */
|
|
2950
|
-
const sanitisedValue = yield routeId.sanitise(this, injector);
|
|
2951
|
-
if (routeId.hasChanged(sanitisedValue)) {
|
|
2952
|
-
// if the route id has changed we redirect immediately as other
|
|
2953
|
-
// parameter sanitisers might use it.
|
|
2954
|
-
return this.replace(routeId.definition, sanitisedValue);
|
|
2955
|
-
}
|
|
2956
|
-
}
|
|
2957
|
-
/** @type {?} */
|
|
2958
|
-
let result = this;
|
|
2959
|
-
/** @type {?} */
|
|
2960
|
-
const routeParameters = this.getRouteParameters();
|
|
2961
|
-
for (let i = 0; i < routeParameters.length; i++) {
|
|
2962
|
-
/** @type {?} */
|
|
2963
|
-
const routeParameter = routeParameters[i];
|
|
2964
|
-
/** @type {?} */
|
|
2965
|
-
const sanitisedValue = yield routeParameter.sanitise(this, injector);
|
|
2966
|
-
if (routeParameter.hasChanged(sanitisedValue)) {
|
|
2967
|
-
result = result.replace(routeParameter.definition, sanitisedValue);
|
|
2968
|
-
}
|
|
2969
|
-
}
|
|
2970
|
-
return result;
|
|
2971
|
-
});
|
|
3163
|
+
child => child.url)));
|
|
2972
3164
|
}
|
|
2973
3165
|
}
|
|
3166
|
+
PlaceRouter.decorators = [
|
|
3167
|
+
{ type: Injectable, args: [{
|
|
3168
|
+
providedIn: 'root'
|
|
3169
|
+
},] }
|
|
3170
|
+
];
|
|
3171
|
+
/** @nocollapse */
|
|
3172
|
+
PlaceRouter.ctorParameters = () => [
|
|
3173
|
+
{ type: Router },
|
|
3174
|
+
{ type: Location },
|
|
3175
|
+
{ type: PlaceHistory }
|
|
3176
|
+
];
|
|
3177
|
+
/** @nocollapse */ PlaceRouter.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(ɵɵinject(Router), ɵɵinject(Location), ɵɵinject(PlaceHistory)); }, token: PlaceRouter, providedIn: "root" });
|
|
2974
3178
|
__decorate([
|
|
2975
|
-
|
|
2976
|
-
__metadata("design:type", Function),
|
|
2977
|
-
__metadata("design:paramtypes", [ParameterDefinition]),
|
|
2978
|
-
__metadata("design:returntype", RouteParameterValue)
|
|
2979
|
-
], ParameterSnapshot.prototype, "getParameter", null);
|
|
2980
|
-
__decorate([
|
|
2981
|
-
Memoize$1(),
|
|
2982
|
-
__metadata("design:type", Function),
|
|
2983
|
-
__metadata("design:paramtypes", [ParameterDefinition]),
|
|
2984
|
-
__metadata("design:returntype", typeof (_a = typeof S !== "undefined" && S) === "function" ? _a : Object)
|
|
2985
|
-
], ParameterSnapshot.prototype, "getValueOf", null);
|
|
2986
|
-
__decorate([
|
|
2987
|
-
Memoize$1(),
|
|
2988
|
-
__metadata("design:type", Function),
|
|
2989
|
-
__metadata("design:paramtypes", [String]),
|
|
2990
|
-
__metadata("design:returntype", Object)
|
|
2991
|
-
], ParameterSnapshot.prototype, "getParameterValue", null);
|
|
2992
|
-
__decorate([
|
|
2993
|
-
Memoize$1(),
|
|
2994
|
-
__metadata("design:type", Function),
|
|
2995
|
-
__metadata("design:paramtypes", []),
|
|
2996
|
-
__metadata("design:returntype", RouteParameterValue.Scalar)
|
|
2997
|
-
], ParameterSnapshot.prototype, "getRouteIdParameter", null);
|
|
2998
|
-
__decorate([
|
|
2999
|
-
Memoize$1(),
|
|
3179
|
+
Trace(),
|
|
3000
3180
|
__metadata("design:type", Function),
|
|
3001
|
-
__metadata("design:paramtypes", []),
|
|
3002
|
-
__metadata("design:returntype",
|
|
3003
|
-
],
|
|
3181
|
+
__metadata("design:paramtypes", [ActivatedRoute, Visit, Visit]),
|
|
3182
|
+
__metadata("design:returntype", Promise)
|
|
3183
|
+
], PlaceRouter.prototype, "pushVisitChangesToRoute", null);
|
|
3004
3184
|
if (false) {
|
|
3005
|
-
/** @type {?} */
|
|
3006
|
-
ParameterSnapshot.prototype.placeDefinition;
|
|
3007
3185
|
/**
|
|
3008
3186
|
* @type {?}
|
|
3009
3187
|
* @private
|
|
3010
3188
|
*/
|
|
3011
|
-
|
|
3012
|
-
}
|
|
3013
|
-
(function (ParameterSnapshot) {
|
|
3189
|
+
PlaceRouter.prototype.firstRoute;
|
|
3014
3190
|
/**
|
|
3015
|
-
* @
|
|
3016
|
-
* @
|
|
3017
|
-
* @param {?} urlSegments
|
|
3018
|
-
* @return {?}
|
|
3191
|
+
* @type {?}
|
|
3192
|
+
* @private
|
|
3019
3193
|
*/
|
|
3020
|
-
|
|
3021
|
-
/** @type {?} */
|
|
3022
|
-
const paramMap = new ConsolidatedParameterMap(params, urlSegments);
|
|
3023
|
-
/** @type {?} */
|
|
3024
|
-
const resolvedParameters = placeDef.getRouteParameters().map((/**
|
|
3025
|
-
* @param {?} def
|
|
3026
|
-
* @return {?}
|
|
3027
|
-
*/
|
|
3028
|
-
def => RouteParameterValue.create(def, paramMap)));
|
|
3029
|
-
return new ParameterSnapshot(placeDef, resolvedParameters);
|
|
3030
|
-
}
|
|
3031
|
-
ParameterSnapshot.create = create;
|
|
3194
|
+
PlaceRouter.prototype._navigationSessionModel;
|
|
3032
3195
|
/**
|
|
3033
|
-
*
|
|
3034
|
-
*
|
|
3035
|
-
* param map even when `parameter`s has content.
|
|
3196
|
+
* @type {?}
|
|
3197
|
+
* @private
|
|
3036
3198
|
*/
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
}
|
|
3053
|
-
/**
|
|
3054
|
-
* @param {?} name
|
|
3055
|
-
* @return {?}
|
|
3056
|
-
*/
|
|
3057
|
-
get(name) {
|
|
3058
|
-
return this.paramMaps.find((/**
|
|
3059
|
-
* @param {?} m
|
|
3060
|
-
* @return {?}
|
|
3061
|
-
*/
|
|
3062
|
-
m => m.has(name))).get(name);
|
|
3063
|
-
}
|
|
3064
|
-
/**
|
|
3065
|
-
* @param {?} name
|
|
3066
|
-
* @return {?}
|
|
3067
|
-
*/
|
|
3068
|
-
getAll(name) {
|
|
3069
|
-
return this.paramMaps.find((/**
|
|
3070
|
-
* @param {?} m
|
|
3071
|
-
* @return {?}
|
|
3072
|
-
*/
|
|
3073
|
-
m => m.has(name))).getAll(name);
|
|
3074
|
-
}
|
|
3075
|
-
/**
|
|
3076
|
-
* @param {?} name
|
|
3077
|
-
* @return {?}
|
|
3078
|
-
*/
|
|
3079
|
-
has(name) {
|
|
3080
|
-
return !!this.paramMaps.find((/**
|
|
3081
|
-
* @param {?} m
|
|
3082
|
-
* @return {?}
|
|
3083
|
-
*/
|
|
3084
|
-
m => m.has(name)));
|
|
3085
|
-
}
|
|
3086
|
-
/**
|
|
3087
|
-
* @return {?}
|
|
3088
|
-
*/
|
|
3089
|
-
get keys() {
|
|
3090
|
-
return this.paramMaps.reduce((/**
|
|
3091
|
-
* @param {?} result
|
|
3092
|
-
* @param {?} params
|
|
3093
|
-
* @return {?}
|
|
3094
|
-
*/
|
|
3095
|
-
(result, params) => result.concat(params.keys)), []);
|
|
3096
|
-
}
|
|
3097
|
-
}
|
|
3098
|
-
__decorate([
|
|
3099
|
-
Memoize$1(),
|
|
3100
|
-
__metadata("design:type", Array),
|
|
3101
|
-
__metadata("design:paramtypes", [])
|
|
3102
|
-
], ConsolidatedParameterMap.prototype, "keys", null);
|
|
3103
|
-
if (false) {
|
|
3104
|
-
/**
|
|
3105
|
-
* @type {?}
|
|
3106
|
-
* @private
|
|
3107
|
-
*/
|
|
3108
|
-
ConsolidatedParameterMap.prototype.paramMaps;
|
|
3109
|
-
}
|
|
3110
|
-
class ParamMapAdapter {
|
|
3111
|
-
/**
|
|
3112
|
-
* @param {?} params
|
|
3113
|
-
*/
|
|
3114
|
-
constructor(params) {
|
|
3115
|
-
this.params = params;
|
|
3116
|
-
}
|
|
3117
|
-
/**
|
|
3118
|
-
* @param {?} name
|
|
3119
|
-
* @return {?}
|
|
3120
|
-
*/
|
|
3121
|
-
get(name) {
|
|
3122
|
-
return this.params[name];
|
|
3123
|
-
}
|
|
3124
|
-
/**
|
|
3125
|
-
* @param {?} name
|
|
3126
|
-
* @return {?}
|
|
3127
|
-
*/
|
|
3128
|
-
getAll(name) {
|
|
3129
|
-
/** @type {?} */
|
|
3130
|
-
const value = this.get(name);
|
|
3131
|
-
return Array.isArray(value) ? value : [value];
|
|
3132
|
-
}
|
|
3133
|
-
/**
|
|
3134
|
-
* @param {?} name
|
|
3135
|
-
* @return {?}
|
|
3136
|
-
*/
|
|
3137
|
-
has(name) {
|
|
3138
|
-
return this.keys.includes(name);
|
|
3139
|
-
}
|
|
3140
|
-
/**
|
|
3141
|
-
* @return {?}
|
|
3142
|
-
*/
|
|
3143
|
-
get keys() {
|
|
3144
|
-
return Object.keys(this.params);
|
|
3145
|
-
}
|
|
3146
|
-
}
|
|
3147
|
-
if (false) {
|
|
3148
|
-
/**
|
|
3149
|
-
* @type {?}
|
|
3150
|
-
* @private
|
|
3151
|
-
*/
|
|
3152
|
-
ParamMapAdapter.prototype.params;
|
|
3153
|
-
}
|
|
3154
|
-
})(ParameterSnapshot || (ParameterSnapshot = {}));
|
|
3199
|
+
PlaceRouter.prototype._activeVisits;
|
|
3200
|
+
/** @type {?} */
|
|
3201
|
+
PlaceRouter.prototype.navigationSessionActive;
|
|
3202
|
+
/** @type {?} */
|
|
3203
|
+
PlaceRouter.prototype.activeVisitIndex;
|
|
3204
|
+
/**
|
|
3205
|
+
* @type {?}
|
|
3206
|
+
* @private
|
|
3207
|
+
*/
|
|
3208
|
+
PlaceRouter.prototype.router;
|
|
3209
|
+
/** @type {?} */
|
|
3210
|
+
PlaceRouter.prototype.angularLocation;
|
|
3211
|
+
/** @type {?} */
|
|
3212
|
+
PlaceRouter.prototype.placeHistory;
|
|
3213
|
+
}
|
|
3155
3214
|
|
|
3156
3215
|
/**
|
|
3157
3216
|
* @fileoverview added by tsickle
|
|
@@ -3230,64 +3289,64 @@ if (false) {
|
|
|
3230
3289
|
class PlaceOutletComponent extends DisposableComponent {
|
|
3231
3290
|
/**
|
|
3232
3291
|
* @param {?} router
|
|
3292
|
+
* @param {?} placeRouter
|
|
3233
3293
|
* @param {?} placeHistory
|
|
3234
3294
|
*/
|
|
3235
|
-
constructor(router, placeHistory) {
|
|
3295
|
+
constructor(router, placeRouter, placeHistory) {
|
|
3236
3296
|
super();
|
|
3237
3297
|
this.router = router;
|
|
3298
|
+
this.placeRouter = placeRouter;
|
|
3238
3299
|
this.placeHistory = placeHistory;
|
|
3239
3300
|
this.animate = true;
|
|
3301
|
+
this.placeChanged = new EventEmitter();
|
|
3240
3302
|
this._activePlace = new MutableValueModel();
|
|
3241
|
-
this._incomingRouteChange = new Guard$1();
|
|
3242
3303
|
this._inOutletUpdate = new Guard$1();
|
|
3243
3304
|
this._activatedRouteModel = new MutableValueModel();
|
|
3244
3305
|
this._placeDefinition = new MutableValueModel();
|
|
3245
|
-
|
|
3306
|
+
/**
|
|
3307
|
+
* TODO: This is now really a visit
|
|
3308
|
+
*/
|
|
3309
|
+
this._placeVisit = new MutableValueModel();
|
|
3246
3310
|
const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
|
|
3311
|
+
// Handle incoming route changes.
|
|
3247
3312
|
/** @type {?} */
|
|
3248
|
-
const
|
|
3249
|
-
* @param {?} ar
|
|
3250
|
-
* @return {?}
|
|
3251
|
-
*/
|
|
3252
|
-
ar => ar.paramMap));
|
|
3313
|
+
const inRouteVisitUpdate = new Guard$1();
|
|
3253
3314
|
/** @type {?} */
|
|
3254
|
-
const
|
|
3255
|
-
|
|
3315
|
+
const routeVisit = chain(this._activePlace).pluck('placeDefinition').findIn(placeRouter.activeVisitIndex);
|
|
3316
|
+
when.valueOf(routeVisit).changes((/**
|
|
3317
|
+
* @param {?} visit
|
|
3256
3318
|
* @return {?}
|
|
3257
3319
|
*/
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
this._resolvedParameters.value = snapshot;
|
|
3271
|
-
this.placeHistory.add(snapshot);
|
|
3272
|
-
}));
|
|
3273
|
-
}), {
|
|
3274
|
-
postponeUntil: this.placeConfigured
|
|
3275
|
-
});
|
|
3276
|
-
when.valueOf(this._resolvedParameters).changes((/**
|
|
3320
|
+
(visit) => {
|
|
3321
|
+
if (visit) {
|
|
3322
|
+
inRouteVisitUpdate.whileTrue((/**
|
|
3323
|
+
* @return {?}
|
|
3324
|
+
*/
|
|
3325
|
+
() => {
|
|
3326
|
+
this._placeVisit.value = visit;
|
|
3327
|
+
}));
|
|
3328
|
+
}
|
|
3329
|
+
}));
|
|
3330
|
+
// Handle component based changes
|
|
3331
|
+
when.valueOf(this._placeVisit).changes((/**
|
|
3277
3332
|
* @param {?} next
|
|
3278
3333
|
* @param {?} previous
|
|
3279
3334
|
* @return {?}
|
|
3280
3335
|
*/
|
|
3281
3336
|
(next, previous) => {
|
|
3282
|
-
this.
|
|
3283
|
-
this.pushChangesToRoute(next, previous);
|
|
3337
|
+
this.pushVisitChangesToRoute(next, previous);
|
|
3284
3338
|
}), {
|
|
3285
|
-
unless:
|
|
3339
|
+
unless: inRouteVisitUpdate
|
|
3286
3340
|
});
|
|
3341
|
+
chain(this._activePlace)
|
|
3342
|
+
.postponeWhile(placeRouter.navigationSessionActive)
|
|
3343
|
+
.subscribe((/**
|
|
3344
|
+
* @param {?} place
|
|
3345
|
+
* @return {?}
|
|
3346
|
+
*/
|
|
3347
|
+
place => this.placeChanged.emit(place)));
|
|
3287
3348
|
// const txo = new TransactionObserver().onEvent(e => console.log(e.toString()));
|
|
3288
|
-
// txo.observe('
|
|
3289
|
-
// txo.observe('urls', urls);
|
|
3290
|
-
// txo.observe('this._resolvedParameters', this._resolvedParameters);
|
|
3349
|
+
// txo.observe('inRouteVisitUpdate', inRouteVisitUpdate);
|
|
3291
3350
|
}
|
|
3292
3351
|
/**
|
|
3293
3352
|
* @return {?}
|
|
@@ -3295,15 +3354,19 @@ class PlaceOutletComponent extends DisposableComponent {
|
|
|
3295
3354
|
ngOnInit() {
|
|
3296
3355
|
}
|
|
3297
3356
|
/**
|
|
3357
|
+
* @param {?} next
|
|
3358
|
+
* @param {?} previous
|
|
3298
3359
|
* @return {?}
|
|
3299
3360
|
*/
|
|
3300
|
-
|
|
3301
|
-
|
|
3361
|
+
pushVisitChangesToRoute(next, previous) {
|
|
3362
|
+
/** @type {?} */
|
|
3363
|
+
const activatedRoute = this._activatedRouteModel.value;
|
|
3364
|
+
this.placeRouter.pushVisitChangesToRoute(activatedRoute, previous, next);
|
|
3302
3365
|
}
|
|
3303
3366
|
/**
|
|
3304
3367
|
* @return {?}
|
|
3305
3368
|
*/
|
|
3306
|
-
get
|
|
3369
|
+
get activePlaceModel() {
|
|
3307
3370
|
return this._activePlace.readonly;
|
|
3308
3371
|
}
|
|
3309
3372
|
/**
|
|
@@ -3320,7 +3383,7 @@ class PlaceOutletComponent extends DisposableComponent {
|
|
|
3320
3383
|
this._activePlace.value = place;
|
|
3321
3384
|
this._activatedRouteModel.value = routerOutlet.activatedRoute;
|
|
3322
3385
|
this._placeDefinition.value = place.placeDefinition;
|
|
3323
|
-
place.initialiseBindings(this.
|
|
3386
|
+
place.initialiseBindings(this._placeVisit);
|
|
3324
3387
|
}
|
|
3325
3388
|
catch (error) {
|
|
3326
3389
|
console.error(error);
|
|
@@ -3362,22 +3425,11 @@ class PlaceOutletComponent extends DisposableComponent {
|
|
|
3362
3425
|
}
|
|
3363
3426
|
}
|
|
3364
3427
|
/**
|
|
3365
|
-
* @param {?}
|
|
3366
|
-
* @param {?} previous
|
|
3367
|
-
* @return {?}
|
|
3368
|
-
*/
|
|
3369
|
-
pushChangesToRoute(next, previous) {
|
|
3370
|
-
/** @type {?} */
|
|
3371
|
-
const activatedRoute = this._activatedRouteModel.value;
|
|
3372
|
-
this.router.pushParameterChangesToRoute(activatedRoute, previous, next);
|
|
3373
|
-
}
|
|
3374
|
-
/**
|
|
3375
|
-
* @param {?} snapshot
|
|
3376
|
-
* @param {?} callback
|
|
3428
|
+
* @param {?} placeDestination
|
|
3377
3429
|
* @return {?}
|
|
3378
3430
|
*/
|
|
3379
|
-
|
|
3380
|
-
|
|
3431
|
+
activate(placeDestination) {
|
|
3432
|
+
// this.router.
|
|
3381
3433
|
}
|
|
3382
3434
|
}
|
|
3383
3435
|
PlaceOutletComponent.decorators = [
|
|
@@ -3390,28 +3442,27 @@ PlaceOutletComponent.decorators = [
|
|
|
3390
3442
|
];
|
|
3391
3443
|
/** @nocollapse */
|
|
3392
3444
|
PlaceOutletComponent.ctorParameters = () => [
|
|
3445
|
+
{ type: Router },
|
|
3393
3446
|
{ type: PlaceRouter },
|
|
3394
3447
|
{ type: PlaceHistory }
|
|
3395
3448
|
];
|
|
3396
3449
|
PlaceOutletComponent.propDecorators = {
|
|
3397
3450
|
animate: [{ type: Input }],
|
|
3451
|
+
placeChanged: [{ type: Output }],
|
|
3398
3452
|
routerOut: [{ type: ViewChild, args: ['routeOutlet', { static: true },] }]
|
|
3399
3453
|
};
|
|
3400
3454
|
if (false) {
|
|
3401
3455
|
/** @type {?} */
|
|
3402
3456
|
PlaceOutletComponent.prototype.animate;
|
|
3403
3457
|
/** @type {?} */
|
|
3404
|
-
PlaceOutletComponent.prototype.
|
|
3405
|
-
/**
|
|
3406
|
-
|
|
3407
|
-
* @private
|
|
3408
|
-
*/
|
|
3409
|
-
PlaceOutletComponent.prototype._activePlace;
|
|
3458
|
+
PlaceOutletComponent.prototype.placeChanged;
|
|
3459
|
+
/** @type {?} */
|
|
3460
|
+
PlaceOutletComponent.prototype.routerOut;
|
|
3410
3461
|
/**
|
|
3411
3462
|
* @type {?}
|
|
3412
3463
|
* @private
|
|
3413
3464
|
*/
|
|
3414
|
-
PlaceOutletComponent.prototype.
|
|
3465
|
+
PlaceOutletComponent.prototype._activePlace;
|
|
3415
3466
|
/**
|
|
3416
3467
|
* @type {?}
|
|
3417
3468
|
* @private
|
|
@@ -3427,18 +3478,21 @@ if (false) {
|
|
|
3427
3478
|
* @private
|
|
3428
3479
|
*/
|
|
3429
3480
|
PlaceOutletComponent.prototype._placeDefinition;
|
|
3430
|
-
/** @type {?} */
|
|
3431
|
-
PlaceOutletComponent.prototype._resolvedParameters;
|
|
3432
3481
|
/**
|
|
3482
|
+
* TODO: This is now really a visit
|
|
3433
3483
|
* @type {?}
|
|
3434
|
-
* @private
|
|
3435
3484
|
*/
|
|
3436
|
-
PlaceOutletComponent.prototype.
|
|
3485
|
+
PlaceOutletComponent.prototype._placeVisit;
|
|
3437
3486
|
/**
|
|
3438
3487
|
* @type {?}
|
|
3439
3488
|
* @private
|
|
3440
3489
|
*/
|
|
3441
3490
|
PlaceOutletComponent.prototype.router;
|
|
3491
|
+
/**
|
|
3492
|
+
* @type {?}
|
|
3493
|
+
* @private
|
|
3494
|
+
*/
|
|
3495
|
+
PlaceOutletComponent.prototype.placeRouter;
|
|
3442
3496
|
/**
|
|
3443
3497
|
* @type {?}
|
|
3444
3498
|
* @private
|
|
@@ -3458,7 +3512,7 @@ class TabbedPlaceNavigationComponent extends AbstractPlaceNavigationComponent {
|
|
|
3458
3512
|
TabbedPlaceNavigationComponent.decorators = [
|
|
3459
3513
|
{ type: Component, args: [{
|
|
3460
3514
|
selector: 'angular-ui-powerups-tabbed-place-navigation',
|
|
3461
|
-
template: "<nav mat-tab-nav-bar>\n <a mat-tab-link *ngFor=\"let place of placeDefinitions.value\"\n [routerLink]='place.path'\n routerLinkActive #rla=\"routerLinkActive\"\n [active]=\"rla.isActive\"\n [matTooltip]=\"getNav(place).tooltip()\">\n <mat-icon *ngIf=\"getNav(place).icon()\">{{getNav(place).icon()}}</mat-icon>\n <span>{{getNav(place).title()}}</span>\n </a>\n</nav>\n",
|
|
3515
|
+
template: "<nav mat-tab-nav-bar>\n <a mat-tab-link *ngFor=\"let place of placeDefinitions.value\"\n [routerLink]='place.path'\n [replaceUrl]=\"true\"\n routerLinkActive #rla=\"routerLinkActive\"\n [active]=\"rla.isActive\"\n [matTooltip]=\"getNav(place).tooltip()\">\n <mat-icon *ngIf=\"getNav(place).icon()\">{{getNav(place).icon()}}</mat-icon>\n <span>{{getNav(place).title()}}</span>\n </a>\n</nav>\n",
|
|
3462
3516
|
styles: [""]
|
|
3463
3517
|
}] }
|
|
3464
3518
|
];
|
|
@@ -3516,7 +3570,8 @@ AngularUiPowerupsModule.decorators = [
|
|
|
3516
3570
|
NumberInputComponent,
|
|
3517
3571
|
StringInputComponent,
|
|
3518
3572
|
PasswordInputComponent,
|
|
3519
|
-
SelectInputComponent
|
|
3573
|
+
SelectInputComponent,
|
|
3574
|
+
NoopComponent
|
|
3520
3575
|
],
|
|
3521
3576
|
imports: [
|
|
3522
3577
|
CommonModule,
|
|
@@ -3537,7 +3592,8 @@ AngularUiPowerupsModule.decorators = [
|
|
|
3537
3592
|
PasswordInputComponent,
|
|
3538
3593
|
SelectInputComponent,
|
|
3539
3594
|
InteractionModule,
|
|
3540
|
-
PlaceModule
|
|
3595
|
+
PlaceModule,
|
|
3596
|
+
NoopComponent
|
|
3541
3597
|
]
|
|
3542
3598
|
},] }
|
|
3543
3599
|
];
|
|
@@ -3877,7 +3933,7 @@ if (false) {
|
|
|
3877
3933
|
* @fileoverview added by tsickle
|
|
3878
3934
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
3879
3935
|
*/
|
|
3880
|
-
class
|
|
3936
|
+
class InteractionGuard {
|
|
3881
3937
|
/**
|
|
3882
3938
|
* @param {?} router
|
|
3883
3939
|
* @param {?} injector
|
|
@@ -3888,6 +3944,14 @@ class CloseInteractionGuard {
|
|
|
3888
3944
|
this.injector = injector;
|
|
3889
3945
|
this.interactionContext = interactionContext;
|
|
3890
3946
|
}
|
|
3947
|
+
/**
|
|
3948
|
+
* @param {?} route
|
|
3949
|
+
* @param {?} state
|
|
3950
|
+
* @return {?}
|
|
3951
|
+
*/
|
|
3952
|
+
canActivate(route, state) {
|
|
3953
|
+
return true;
|
|
3954
|
+
}
|
|
3891
3955
|
/**
|
|
3892
3956
|
* @param {?} component
|
|
3893
3957
|
* @param {?} currentRoute
|
|
@@ -3899,34 +3963,46 @@ class CloseInteractionGuard {
|
|
|
3899
3963
|
return !this.interactionContext.isActive();
|
|
3900
3964
|
}
|
|
3901
3965
|
}
|
|
3902
|
-
|
|
3966
|
+
InteractionGuard.decorators = [
|
|
3903
3967
|
{ type: Injectable, args: [{
|
|
3904
3968
|
providedIn: 'root'
|
|
3905
3969
|
},] }
|
|
3906
3970
|
];
|
|
3907
3971
|
/** @nocollapse */
|
|
3908
|
-
|
|
3972
|
+
InteractionGuard.ctorParameters = () => [
|
|
3909
3973
|
{ type: Router },
|
|
3910
3974
|
{ type: Injector },
|
|
3911
3975
|
{ type: InteractionContext }
|
|
3912
3976
|
];
|
|
3913
|
-
/** @nocollapse */
|
|
3977
|
+
/** @nocollapse */ InteractionGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function InteractionGuard_Factory() { return new InteractionGuard(ɵɵinject(Router), ɵɵinject(INJECTOR), ɵɵinject(InteractionContext)); }, token: InteractionGuard, providedIn: "root" });
|
|
3978
|
+
__decorate([
|
|
3979
|
+
Trace(),
|
|
3980
|
+
__metadata("design:type", Function),
|
|
3981
|
+
__metadata("design:paramtypes", [ActivatedRouteSnapshot, RouterStateSnapshot]),
|
|
3982
|
+
__metadata("design:returntype", Object)
|
|
3983
|
+
], InteractionGuard.prototype, "canActivate", null);
|
|
3984
|
+
__decorate([
|
|
3985
|
+
Trace(),
|
|
3986
|
+
__metadata("design:type", Function),
|
|
3987
|
+
__metadata("design:paramtypes", [NoopComponent, ActivatedRouteSnapshot, RouterStateSnapshot, RouterStateSnapshot]),
|
|
3988
|
+
__metadata("design:returntype", Object)
|
|
3989
|
+
], InteractionGuard.prototype, "canDeactivate", null);
|
|
3914
3990
|
if (false) {
|
|
3915
3991
|
/**
|
|
3916
3992
|
* @type {?}
|
|
3917
3993
|
* @private
|
|
3918
3994
|
*/
|
|
3919
|
-
|
|
3995
|
+
InteractionGuard.prototype.router;
|
|
3920
3996
|
/**
|
|
3921
3997
|
* @type {?}
|
|
3922
3998
|
* @private
|
|
3923
3999
|
*/
|
|
3924
|
-
|
|
4000
|
+
InteractionGuard.prototype.injector;
|
|
3925
4001
|
/**
|
|
3926
4002
|
* @type {?}
|
|
3927
4003
|
* @private
|
|
3928
4004
|
*/
|
|
3929
|
-
|
|
4005
|
+
InteractionGuard.prototype.interactionContext;
|
|
3930
4006
|
}
|
|
3931
4007
|
|
|
3932
4008
|
/**
|
|
@@ -4003,26 +4079,314 @@ function Place(options) {
|
|
|
4003
4079
|
}
|
|
4004
4080
|
})(Place || (Place = {}));
|
|
4005
4081
|
|
|
4082
|
+
/**
|
|
4083
|
+
* @fileoverview added by tsickle
|
|
4084
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4085
|
+
*/
|
|
4086
|
+
// WARNING: interface has both a type and a value, skipping emit
|
|
4087
|
+
var Formatter;
|
|
4088
|
+
(function (Formatter) {
|
|
4089
|
+
class StringType {
|
|
4090
|
+
/**
|
|
4091
|
+
* @param {?} value
|
|
4092
|
+
* @return {?}
|
|
4093
|
+
*/
|
|
4094
|
+
format(value) {
|
|
4095
|
+
return value;
|
|
4096
|
+
}
|
|
4097
|
+
/**
|
|
4098
|
+
* @param {?} value
|
|
4099
|
+
* @return {?}
|
|
4100
|
+
*/
|
|
4101
|
+
parse(value) {
|
|
4102
|
+
return value;
|
|
4103
|
+
}
|
|
4104
|
+
}
|
|
4105
|
+
class NumberType {
|
|
4106
|
+
/**
|
|
4107
|
+
* @param {?} value
|
|
4108
|
+
* @return {?}
|
|
4109
|
+
*/
|
|
4110
|
+
format(value) {
|
|
4111
|
+
return ___default.isNumber(value) && !___default.isNaN(value) ? `${value}` : null;
|
|
4112
|
+
}
|
|
4113
|
+
/**
|
|
4114
|
+
* @param {?} value
|
|
4115
|
+
* @return {?}
|
|
4116
|
+
*/
|
|
4117
|
+
parse(value) {
|
|
4118
|
+
/** @type {?} */
|
|
4119
|
+
const parsed = Number.parseFloat(value);
|
|
4120
|
+
return ___default.isNaN(parsed) ? null : parsed;
|
|
4121
|
+
}
|
|
4122
|
+
}
|
|
4123
|
+
class BooleanType {
|
|
4124
|
+
/**
|
|
4125
|
+
* @param {?} value
|
|
4126
|
+
* @return {?}
|
|
4127
|
+
*/
|
|
4128
|
+
format(value) {
|
|
4129
|
+
return value ? 'true' : 'false';
|
|
4130
|
+
}
|
|
4131
|
+
/**
|
|
4132
|
+
* @param {?} value
|
|
4133
|
+
* @return {?}
|
|
4134
|
+
*/
|
|
4135
|
+
parse(value) {
|
|
4136
|
+
return value === 'true';
|
|
4137
|
+
}
|
|
4138
|
+
}
|
|
4139
|
+
Formatter.STRING = new StringType();
|
|
4140
|
+
Formatter.NUMBER = new NumberType();
|
|
4141
|
+
Formatter.BOOLEAN = new BooleanType();
|
|
4142
|
+
})(Formatter || (Formatter = {}));
|
|
4143
|
+
|
|
4144
|
+
/**
|
|
4145
|
+
* @fileoverview added by tsickle
|
|
4146
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4147
|
+
*/
|
|
4148
|
+
/**
|
|
4149
|
+
* @record
|
|
4150
|
+
*/
|
|
4151
|
+
function JsonArray() { }
|
|
4152
|
+
/**
|
|
4153
|
+
* @record
|
|
4154
|
+
*/
|
|
4155
|
+
function JsonMap() { }
|
|
4156
|
+
|
|
4157
|
+
/**
|
|
4158
|
+
* @fileoverview added by tsickle
|
|
4159
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4160
|
+
*/
|
|
4161
|
+
/**
|
|
4162
|
+
* @record
|
|
4163
|
+
* @template T
|
|
4164
|
+
*/
|
|
4165
|
+
function RouteIdOptions() { }
|
|
4166
|
+
if (false) {
|
|
4167
|
+
/** @type {?|undefined} */
|
|
4168
|
+
RouteIdOptions.prototype.as;
|
|
4169
|
+
/** @type {?|undefined} */
|
|
4170
|
+
RouteIdOptions.prototype.optional;
|
|
4171
|
+
/** @type {?|undefined} */
|
|
4172
|
+
RouteIdOptions.prototype.remember;
|
|
4173
|
+
/** @type {?|undefined} */
|
|
4174
|
+
RouteIdOptions.prototype.defaultValue;
|
|
4175
|
+
}
|
|
4176
|
+
/**
|
|
4177
|
+
* @record
|
|
4178
|
+
* @template T
|
|
4179
|
+
*/
|
|
4180
|
+
function RouteParameterOptions() { }
|
|
4181
|
+
if (false) {
|
|
4182
|
+
/** @type {?|undefined} */
|
|
4183
|
+
RouteParameterOptions.prototype.as;
|
|
4184
|
+
/** @type {?|undefined} */
|
|
4185
|
+
RouteParameterOptions.prototype.optional;
|
|
4186
|
+
/** @type {?|undefined} */
|
|
4187
|
+
RouteParameterOptions.prototype.remember;
|
|
4188
|
+
/** @type {?|undefined} */
|
|
4189
|
+
RouteParameterOptions.prototype.defaultValue;
|
|
4190
|
+
/** @type {?|undefined} */
|
|
4191
|
+
RouteParameterOptions.prototype.storeInUrl;
|
|
4192
|
+
}
|
|
4193
|
+
/**
|
|
4194
|
+
* @record
|
|
4195
|
+
* @template T
|
|
4196
|
+
*/
|
|
4197
|
+
function RouteListParameterOptions() { }
|
|
4198
|
+
if (false) {
|
|
4199
|
+
/** @type {?|undefined} */
|
|
4200
|
+
RouteListParameterOptions.prototype.as;
|
|
4201
|
+
/** @type {?|undefined} */
|
|
4202
|
+
RouteListParameterOptions.prototype.optional;
|
|
4203
|
+
/** @type {?|undefined} */
|
|
4204
|
+
RouteListParameterOptions.prototype.remember;
|
|
4205
|
+
/** @type {?|undefined} */
|
|
4206
|
+
RouteListParameterOptions.prototype.defaultValue;
|
|
4207
|
+
/** @type {?|undefined} */
|
|
4208
|
+
RouteListParameterOptions.prototype.storeInUrl;
|
|
4209
|
+
}
|
|
4210
|
+
/**
|
|
4211
|
+
* @template T
|
|
4212
|
+
* @param {?} type
|
|
4213
|
+
* @param {?=} options
|
|
4214
|
+
* @return {?}
|
|
4215
|
+
*/
|
|
4216
|
+
function RouteId(type, options) {
|
|
4217
|
+
return (/**
|
|
4218
|
+
* @param {?} prototype
|
|
4219
|
+
* @param {?} propertyKey
|
|
4220
|
+
* @return {?}
|
|
4221
|
+
*/
|
|
4222
|
+
(prototype, propertyKey) => {
|
|
4223
|
+
/** @type {?} */
|
|
4224
|
+
const param = new ParameterDefinition.RouteId(propertyKey.toString(), options, type);
|
|
4225
|
+
Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
|
|
4226
|
+
UseDelegate()(prototype, propertyKey);
|
|
4227
|
+
});
|
|
4228
|
+
}
|
|
4229
|
+
/**
|
|
4230
|
+
* @template T
|
|
4231
|
+
* @param {?=} options
|
|
4232
|
+
* @return {?}
|
|
4233
|
+
*/
|
|
4234
|
+
function VisitParameter(options) {
|
|
4235
|
+
return (/**
|
|
4236
|
+
* @param {?} prototype
|
|
4237
|
+
* @param {?} propertyKey
|
|
4238
|
+
* @return {?}
|
|
4239
|
+
*/
|
|
4240
|
+
(prototype, propertyKey) => {
|
|
4241
|
+
/** @type {?} */
|
|
4242
|
+
const param = new ParameterDefinition.ValueParameter(propertyKey.toString(), options, options.storeInUrl);
|
|
4243
|
+
Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
|
|
4244
|
+
UseDelegate()(prototype, propertyKey);
|
|
4245
|
+
});
|
|
4246
|
+
}
|
|
4247
|
+
/**
|
|
4248
|
+
* @template E
|
|
4249
|
+
* @param {?=} options
|
|
4250
|
+
* @return {?}
|
|
4251
|
+
*/
|
|
4252
|
+
function VisitParameterList(options) {
|
|
4253
|
+
return (/**
|
|
4254
|
+
* @param {?} prototype
|
|
4255
|
+
* @param {?} propertyKey
|
|
4256
|
+
* @return {?}
|
|
4257
|
+
*/
|
|
4258
|
+
(prototype, propertyKey) => {
|
|
4259
|
+
/** @type {?} */
|
|
4260
|
+
const param = new ParameterDefinition.ArrayParameter(propertyKey.toString(), options, options.storeInUrl);
|
|
4261
|
+
Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
|
|
4262
|
+
UseDelegate()(prototype, propertyKey);
|
|
4263
|
+
});
|
|
4264
|
+
}
|
|
4265
|
+
|
|
4266
|
+
/**
|
|
4267
|
+
* @fileoverview added by tsickle
|
|
4268
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4269
|
+
*/
|
|
4270
|
+
/**
|
|
4271
|
+
* @record
|
|
4272
|
+
* @template S
|
|
4273
|
+
*/
|
|
4274
|
+
function ParameterSanitiser() { }
|
|
4275
|
+
if (false) {
|
|
4276
|
+
/**
|
|
4277
|
+
* @param {?} parameterValue
|
|
4278
|
+
* @param {?=} visit
|
|
4279
|
+
* @param {?=} injector
|
|
4280
|
+
* @return {?}
|
|
4281
|
+
*/
|
|
4282
|
+
ParameterSanitiser.prototype.sanitise = function (parameterValue, visit, injector) { };
|
|
4283
|
+
}
|
|
4284
|
+
|
|
4006
4285
|
/**
|
|
4007
4286
|
* @fileoverview added by tsickle
|
|
4008
4287
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4009
4288
|
*/
|
|
4010
4289
|
/**
|
|
4011
4290
|
* @record
|
|
4291
|
+
* @template T
|
|
4012
4292
|
*/
|
|
4013
|
-
function
|
|
4293
|
+
function ParameterSnapshot() { }
|
|
4014
4294
|
if (false) {
|
|
4015
4295
|
/** @type {?} */
|
|
4016
|
-
|
|
4296
|
+
ParameterSnapshot.prototype.definition;
|
|
4297
|
+
/** @type {?} */
|
|
4298
|
+
ParameterSnapshot.prototype.value;
|
|
4017
4299
|
/**
|
|
4018
4300
|
* @return {?}
|
|
4019
4301
|
*/
|
|
4020
|
-
|
|
4302
|
+
ParameterSnapshot.prototype.isMissing = function () { };
|
|
4303
|
+
}
|
|
4304
|
+
|
|
4305
|
+
/**
|
|
4306
|
+
* @fileoverview added by tsickle
|
|
4307
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4308
|
+
*/
|
|
4309
|
+
class VisitSanitiser {
|
|
4310
|
+
/**
|
|
4311
|
+
* @param {?} activatedRoute
|
|
4312
|
+
* @param {?} router
|
|
4313
|
+
* @param {?} placeHistory
|
|
4314
|
+
* @param {?} injector
|
|
4315
|
+
*/
|
|
4316
|
+
constructor(activatedRoute, router, placeHistory, injector) {
|
|
4317
|
+
this.activatedRoute = activatedRoute;
|
|
4318
|
+
this.router = router;
|
|
4319
|
+
this.placeHistory = placeHistory;
|
|
4320
|
+
this.injector = injector;
|
|
4321
|
+
}
|
|
4322
|
+
// @Trace()
|
|
4021
4323
|
/**
|
|
4022
|
-
* @param {?}
|
|
4324
|
+
* @param {?} visit
|
|
4023
4325
|
* @return {?}
|
|
4024
4326
|
*/
|
|
4025
|
-
|
|
4327
|
+
sanitise(visit) {
|
|
4328
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4329
|
+
/** @type {?} */
|
|
4330
|
+
const placeDef = visit.placeDefinition;
|
|
4331
|
+
if (placeDef.hasRouteId()) {
|
|
4332
|
+
/** @type {?} */
|
|
4333
|
+
const routeIdDef = placeDef.getRouteIdParameterDef();
|
|
4334
|
+
/** @type {?} */
|
|
4335
|
+
const routeId = visit.getRouteId();
|
|
4336
|
+
/** @type {?} */
|
|
4337
|
+
const sanitisedValue = yield routeIdDef.sanitise(routeId, visit, this.placeHistory, this.injector);
|
|
4338
|
+
console.log({ routeId, sanitisedValue });
|
|
4339
|
+
// ###------- EARLY EXIT --------###
|
|
4340
|
+
if (routeIdDef.hasChanged(routeId, sanitisedValue)) {
|
|
4341
|
+
// if the route id has changed we redirect immediately as other
|
|
4342
|
+
// parameter sanitisers might use it.
|
|
4343
|
+
return visit.replace(routeIdDef, sanitisedValue);
|
|
4344
|
+
}
|
|
4345
|
+
}
|
|
4346
|
+
// if we didn't replace the routeId we continue the url present parameters.
|
|
4347
|
+
/** @type {?} */
|
|
4348
|
+
const parameterDefs = placeDef.getVisitParameterDefs({
|
|
4349
|
+
includeRouteParameters: true,
|
|
4350
|
+
includeNonRouteParameters: true
|
|
4351
|
+
});
|
|
4352
|
+
/** @type {?} */
|
|
4353
|
+
let sanitisedVisit = visit;
|
|
4354
|
+
for (let i = 0; i < parameterDefs.length; i++) {
|
|
4355
|
+
/** @type {?} */
|
|
4356
|
+
const def = parameterDefs[i];
|
|
4357
|
+
/** @type {?} */
|
|
4358
|
+
const value = visit.getParameter(def.name);
|
|
4359
|
+
/** @type {?} */
|
|
4360
|
+
const sanitisedValue = yield def.sanitise(value, sanitisedVisit, this.placeHistory, this.injector);
|
|
4361
|
+
if (def.hasChanged(value, sanitisedValue)) {
|
|
4362
|
+
sanitisedVisit = sanitisedVisit.replace(def, sanitisedValue);
|
|
4363
|
+
}
|
|
4364
|
+
}
|
|
4365
|
+
return sanitisedVisit.hasChangedFrom(visit) ? sanitisedVisit : visit;
|
|
4366
|
+
});
|
|
4367
|
+
}
|
|
4368
|
+
}
|
|
4369
|
+
if (false) {
|
|
4370
|
+
/**
|
|
4371
|
+
* @type {?}
|
|
4372
|
+
* @private
|
|
4373
|
+
*/
|
|
4374
|
+
VisitSanitiser.prototype.activatedRoute;
|
|
4375
|
+
/**
|
|
4376
|
+
* @type {?}
|
|
4377
|
+
* @private
|
|
4378
|
+
*/
|
|
4379
|
+
VisitSanitiser.prototype.router;
|
|
4380
|
+
/**
|
|
4381
|
+
* @type {?}
|
|
4382
|
+
* @private
|
|
4383
|
+
*/
|
|
4384
|
+
VisitSanitiser.prototype.placeHistory;
|
|
4385
|
+
/**
|
|
4386
|
+
* @type {?}
|
|
4387
|
+
* @private
|
|
4388
|
+
*/
|
|
4389
|
+
VisitSanitiser.prototype.injector;
|
|
4026
4390
|
}
|
|
4027
4391
|
|
|
4028
4392
|
/**
|
|
@@ -4108,6 +4472,7 @@ class LeavePlaceGuard {
|
|
|
4108
4472
|
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
4109
4473
|
// nextStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c"
|
|
4110
4474
|
// }
|
|
4475
|
+
// TODO: Add tests
|
|
4111
4476
|
if (this.placeRouter.navigationSession.alreadyAccepted(component)) {
|
|
4112
4477
|
// We'll get called multiple times if there's any parameter sanitisation so
|
|
4113
4478
|
// we always return true if we accepted on a previous cycle of the current
|
|
@@ -4122,9 +4487,10 @@ class LeavePlaceGuard {
|
|
|
4122
4487
|
if (this.isLeavingTheCurrentPlace(nextState, placeDefinitionPath)) {
|
|
4123
4488
|
// we check the interaction first, so that components that don't need to check if they're in an
|
|
4124
4489
|
// interaction during the canDeactivate cycle.
|
|
4490
|
+
// TODO: Add tests: show dialog -> hit back -> same route
|
|
4125
4491
|
if (this.interactionContext.isActive()) {
|
|
4126
4492
|
canLeave = false;
|
|
4127
|
-
console.log(
|
|
4493
|
+
console.log('cancelling', { activity: this.interactionContext.currentActivity });
|
|
4128
4494
|
this.interactionContext.currentActivity.cancel(null);
|
|
4129
4495
|
}
|
|
4130
4496
|
// No interaction in progress, so ask the component .
|
|
@@ -4132,13 +4498,18 @@ class LeavePlaceGuard {
|
|
|
4132
4498
|
// the user clicks back again, we'll re-enter here and go bang when the component tries to open another
|
|
4133
4499
|
// dialog.
|
|
4134
4500
|
if (canLeave) {
|
|
4501
|
+
// TODO: Add tests: hit back -> confirm leave dialog -> hit back -> close dialog -> hit back -> confirm leave dialog.
|
|
4135
4502
|
canLeave = yield component.canDeactivate();
|
|
4136
4503
|
}
|
|
4504
|
+
// We also block back button parameter changes while the dialog is open.
|
|
4505
|
+
// NOTE: Now that I'm catching parameter changes I could possibly retry using a fragment or
|
|
4506
|
+
// query parameter to track the dialog being open. Previously I was just checking this on
|
|
4507
|
+
// path changes... if that worked it'd fix the case where the back button breaks with an activity
|
|
4508
|
+
// open on the first page: https://coolon.atlassian.net/browse/AUP-33
|
|
4137
4509
|
}
|
|
4138
4510
|
else {
|
|
4139
|
-
// this is a parameter change.
|
|
4140
4511
|
if (this.interactionContext.isActive()) {
|
|
4141
|
-
console.log(
|
|
4512
|
+
console.log('cancelling', { activity: this.interactionContext.currentActivity });
|
|
4142
4513
|
this.interactionContext.currentActivity.cancel(null);
|
|
4143
4514
|
canLeave = false;
|
|
4144
4515
|
}
|
|
@@ -4148,7 +4519,7 @@ class LeavePlaceGuard {
|
|
|
4148
4519
|
}
|
|
4149
4520
|
if (canLeave) {
|
|
4150
4521
|
// We'll get called multiple times if there's any parameter sanitisation so
|
|
4151
|
-
// we remember the acceptance for the duration of the current
|
|
4522
|
+
// we remember the acceptance for the duration of the current navigation session.
|
|
4152
4523
|
self.placeRouter.navigationSession.rememberAcceptanceOf(component);
|
|
4153
4524
|
}
|
|
4154
4525
|
else {
|
|
@@ -4156,7 +4527,7 @@ class LeavePlaceGuard {
|
|
|
4156
4527
|
// See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
4157
4528
|
if (this.placeRouter.navigationSession.isPopState) {
|
|
4158
4529
|
console.log('cancelled during popstate');
|
|
4159
|
-
this.angularLocation.go(this.placeRouter.navigationSession.
|
|
4530
|
+
this.angularLocation.go(this.placeRouter.navigationSession.popStateReturnUrl);
|
|
4160
4531
|
}
|
|
4161
4532
|
}
|
|
4162
4533
|
return canLeave;
|
|
@@ -4177,13 +4548,7 @@ LeavePlaceGuard.ctorParameters = () => [
|
|
|
4177
4548
|
{ type: InteractionContext },
|
|
4178
4549
|
{ type: Location }
|
|
4179
4550
|
];
|
|
4180
|
-
/** @nocollapse */ LeavePlaceGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function LeavePlaceGuard_Factory() { return new LeavePlaceGuard(ɵɵinject(Router), ɵɵinject(INJECTOR), ɵɵinject(PlaceRouter), ɵɵinject(InteractionContext), ɵɵinject(Location)); }, token: LeavePlaceGuard, providedIn: "root" });
|
|
4181
|
-
__decorate([
|
|
4182
|
-
Trace(),
|
|
4183
|
-
__metadata("design:type", Function),
|
|
4184
|
-
__metadata("design:paramtypes", [PlaceComponent, ActivatedRouteSnapshot, RouterStateSnapshot, RouterStateSnapshot]),
|
|
4185
|
-
__metadata("design:returntype", Promise)
|
|
4186
|
-
], LeavePlaceGuard.prototype, "canDeactivate", null);
|
|
4551
|
+
/** @nocollapse */ LeavePlaceGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function LeavePlaceGuard_Factory() { return new LeavePlaceGuard(ɵɵinject(Router), ɵɵinject(INJECTOR), ɵɵinject(PlaceRouter), ɵɵinject(InteractionContext), ɵɵinject(Location)); }, token: LeavePlaceGuard, providedIn: "root" });
|
|
4187
4552
|
if (false) {
|
|
4188
4553
|
/**
|
|
4189
4554
|
* @type {?}
|
|
@@ -4212,41 +4577,62 @@ if (false) {
|
|
|
4212
4577
|
*/
|
|
4213
4578
|
class PlaceRouteGuard {
|
|
4214
4579
|
/**
|
|
4580
|
+
* @param {?} router
|
|
4215
4581
|
* @param {?} placeRouter
|
|
4582
|
+
* @param {?} placeHistory
|
|
4216
4583
|
* @param {?} injector
|
|
4217
4584
|
*/
|
|
4218
|
-
constructor(placeRouter, injector) {
|
|
4585
|
+
constructor(router, placeRouter, placeHistory, injector) {
|
|
4586
|
+
this.router = router;
|
|
4219
4587
|
this.placeRouter = placeRouter;
|
|
4588
|
+
this.placeHistory = placeHistory;
|
|
4220
4589
|
this.injector = injector;
|
|
4221
4590
|
}
|
|
4591
|
+
// @Trace()
|
|
4222
4592
|
/**
|
|
4223
4593
|
* @param {?} activatedRoute
|
|
4224
4594
|
* @param {?} state
|
|
4225
4595
|
* @return {?}
|
|
4226
4596
|
*/
|
|
4227
4597
|
canActivate(activatedRoute, state) {
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4598
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4599
|
+
if (PlaceComponent.isPlaceComponentConstructor(activatedRoute.component)) {
|
|
4600
|
+
/** @type {?} */
|
|
4601
|
+
const placeDefinition = PlaceComponent.getDefinition(activatedRoute.component);
|
|
4602
|
+
// Parse our route params.
|
|
4603
|
+
/** @type {?} */
|
|
4604
|
+
const params = new PlaceRouteGuard.ConsolidatedParameterMap(activatedRoute.paramMap, activatedRoute.url);
|
|
4605
|
+
/** @type {?} */
|
|
4606
|
+
const parsedParams = placeDefinition.parseRouteParams(params);
|
|
4607
|
+
/** @type {?} */
|
|
4608
|
+
const initialVisit = this.placeRouter.navigationSession.getVisitFor(placeDefinition) || new Visit(placeDefinition, parsedParams);
|
|
4609
|
+
/** @type {?} */
|
|
4610
|
+
const sanitiser = new VisitSanitiser(activatedRoute, this.router, this.placeHistory, this.injector);
|
|
4611
|
+
/** @type {?} */
|
|
4612
|
+
const updatedVisit = yield sanitiser.sanitise(initialVisit.mergeRouteParameters(parsedParams));
|
|
4613
|
+
// Save the visit with any updated parameters. We need to save it so we remember any non route parameters
|
|
4614
|
+
this.placeRouter.navigationSession.storeVisit(updatedVisit);
|
|
4615
|
+
if (initialVisit.hasRoutingChangedFrom(updatedVisit)) {
|
|
4616
|
+
/** @type {?} */
|
|
4617
|
+
const parameterCommands = updatedVisit.hasRouteId() ?
|
|
4618
|
+
[placeDefinition.getFormattedRouteId(updatedVisit), placeDefinition.getFormattedRouteParameters(updatedVisit)] :
|
|
4619
|
+
[placeDefinition.getFormattedRouteParameters(updatedVisit)];
|
|
4620
|
+
/** @type {?} */
|
|
4621
|
+
const commands = [(activatedRoute.url[0].path)].concat(parameterCommands, this.placeRouter.getChildPath(activatedRoute));
|
|
4622
|
+
console.log('##### Redirect', commands);
|
|
4623
|
+
return this.router.createUrlTree(commands, {
|
|
4624
|
+
replaceUrl: true,
|
|
4625
|
+
skipLocationChange: false
|
|
4626
|
+
});
|
|
4241
4627
|
}
|
|
4242
4628
|
else {
|
|
4243
4629
|
return true;
|
|
4244
4630
|
}
|
|
4245
|
-
}
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
}
|
|
4631
|
+
}
|
|
4632
|
+
else {
|
|
4633
|
+
return lang.illegalState(`expected component to be an instance of PlaceComponent, got ${activatedRoute.component}`);
|
|
4634
|
+
}
|
|
4635
|
+
});
|
|
4250
4636
|
}
|
|
4251
4637
|
}
|
|
4252
4638
|
PlaceRouteGuard.decorators = [
|
|
@@ -4256,205 +4642,163 @@ PlaceRouteGuard.decorators = [
|
|
|
4256
4642
|
];
|
|
4257
4643
|
/** @nocollapse */
|
|
4258
4644
|
PlaceRouteGuard.ctorParameters = () => [
|
|
4645
|
+
{ type: Router },
|
|
4259
4646
|
{ type: PlaceRouter },
|
|
4647
|
+
{ type: PlaceHistory },
|
|
4260
4648
|
{ type: Injector }
|
|
4261
4649
|
];
|
|
4262
|
-
/** @nocollapse */ PlaceRouteGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceRouteGuard_Factory() { return new PlaceRouteGuard(ɵɵinject(PlaceRouter), ɵɵinject(INJECTOR)); }, token: PlaceRouteGuard, providedIn: "root" });
|
|
4650
|
+
/** @nocollapse */ PlaceRouteGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceRouteGuard_Factory() { return new PlaceRouteGuard(ɵɵinject(Router), ɵɵinject(PlaceRouter), ɵɵinject(PlaceHistory), ɵɵinject(INJECTOR)); }, token: PlaceRouteGuard, providedIn: "root" });
|
|
4263
4651
|
if (false) {
|
|
4264
4652
|
/**
|
|
4265
4653
|
* @type {?}
|
|
4266
4654
|
* @private
|
|
4267
4655
|
*/
|
|
4268
|
-
PlaceRouteGuard.prototype.
|
|
4656
|
+
PlaceRouteGuard.prototype.router;
|
|
4269
4657
|
/**
|
|
4270
4658
|
* @type {?}
|
|
4271
4659
|
* @private
|
|
4272
4660
|
*/
|
|
4273
|
-
PlaceRouteGuard.prototype.
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
* @fileoverview added by tsickle
|
|
4278
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4279
|
-
*/
|
|
4280
|
-
/**
|
|
4281
|
-
* @record
|
|
4282
|
-
*/
|
|
4283
|
-
function JsonArray() { }
|
|
4284
|
-
/**
|
|
4285
|
-
* @record
|
|
4286
|
-
*/
|
|
4287
|
-
function JsonMap() { }
|
|
4288
|
-
|
|
4289
|
-
/**
|
|
4290
|
-
* @fileoverview added by tsickle
|
|
4291
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4292
|
-
*/
|
|
4293
|
-
/**
|
|
4294
|
-
* @record
|
|
4295
|
-
* @template T
|
|
4296
|
-
*/
|
|
4297
|
-
function ParameterOptions() { }
|
|
4298
|
-
if (false) {
|
|
4299
|
-
/** @type {?|undefined} */
|
|
4300
|
-
ParameterOptions.prototype.as;
|
|
4301
|
-
/** @type {?|undefined} */
|
|
4302
|
-
ParameterOptions.prototype.optional;
|
|
4303
|
-
/** @type {?|undefined} */
|
|
4304
|
-
ParameterOptions.prototype.remember;
|
|
4305
|
-
/** @type {?|undefined} */
|
|
4306
|
-
ParameterOptions.prototype.defaultValue;
|
|
4307
|
-
}
|
|
4308
|
-
/**
|
|
4309
|
-
* @record
|
|
4310
|
-
* @template T
|
|
4311
|
-
*/
|
|
4312
|
-
function ListParameterOptions() { }
|
|
4313
|
-
if (false) {
|
|
4314
|
-
/** @type {?|undefined} */
|
|
4315
|
-
ListParameterOptions.prototype.as;
|
|
4316
|
-
/** @type {?|undefined} */
|
|
4317
|
-
ListParameterOptions.prototype.optional;
|
|
4318
|
-
/** @type {?|undefined} */
|
|
4319
|
-
ListParameterOptions.prototype.remember;
|
|
4320
|
-
/** @type {?|undefined} */
|
|
4321
|
-
ListParameterOptions.prototype.defaultValue;
|
|
4322
|
-
}
|
|
4323
|
-
/**
|
|
4324
|
-
* @template T
|
|
4325
|
-
* @param {?} type
|
|
4326
|
-
* @param {?=} options
|
|
4327
|
-
* @return {?}
|
|
4328
|
-
*/
|
|
4329
|
-
function RouteId(type, options) {
|
|
4330
|
-
return (/**
|
|
4331
|
-
* @param {?} prototype
|
|
4332
|
-
* @param {?} propertyKey
|
|
4333
|
-
* @return {?}
|
|
4334
|
-
*/
|
|
4335
|
-
(prototype, propertyKey) => {
|
|
4336
|
-
/** @type {?} */
|
|
4337
|
-
const param = new ParameterDefinition.RouteId(propertyKey.toString(), type, options);
|
|
4338
|
-
Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
|
|
4339
|
-
UseDelegate()(prototype, propertyKey);
|
|
4340
|
-
});
|
|
4341
|
-
}
|
|
4342
|
-
/**
|
|
4343
|
-
* @template T
|
|
4344
|
-
* @param {?} type
|
|
4345
|
-
* @param {?=} options
|
|
4346
|
-
* @return {?}
|
|
4347
|
-
*/
|
|
4348
|
-
function RouteParameter(type, options) {
|
|
4349
|
-
return (/**
|
|
4350
|
-
* @param {?} prototype
|
|
4351
|
-
* @param {?} propertyKey
|
|
4352
|
-
* @return {?}
|
|
4661
|
+
PlaceRouteGuard.prototype.placeRouter;
|
|
4662
|
+
/**
|
|
4663
|
+
* @type {?}
|
|
4664
|
+
* @private
|
|
4353
4665
|
*/
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
UseDelegate()(prototype, propertyKey);
|
|
4359
|
-
});
|
|
4360
|
-
}
|
|
4361
|
-
/**
|
|
4362
|
-
* @template E
|
|
4363
|
-
* @param {?} elementType
|
|
4364
|
-
* @param {?=} options
|
|
4365
|
-
* @return {?}
|
|
4366
|
-
*/
|
|
4367
|
-
function RouteParameterList(elementType, options) {
|
|
4368
|
-
return (/**
|
|
4369
|
-
* @param {?} prototype
|
|
4370
|
-
* @param {?} propertyKey
|
|
4371
|
-
* @return {?}
|
|
4666
|
+
PlaceRouteGuard.prototype.placeHistory;
|
|
4667
|
+
/**
|
|
4668
|
+
* @type {?}
|
|
4669
|
+
* @private
|
|
4372
4670
|
*/
|
|
4373
|
-
|
|
4374
|
-
/** @type {?} */
|
|
4375
|
-
const param = new ParameterDefinition.ArrayParameter(propertyKey.toString(), elementType, options);
|
|
4376
|
-
Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
|
|
4377
|
-
UseDelegate()(prototype, propertyKey);
|
|
4378
|
-
});
|
|
4671
|
+
PlaceRouteGuard.prototype.injector;
|
|
4379
4672
|
}
|
|
4380
|
-
|
|
4381
|
-
/**
|
|
4382
|
-
* @fileoverview added by tsickle
|
|
4383
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4384
|
-
*/
|
|
4385
|
-
/**
|
|
4386
|
-
* @record
|
|
4387
|
-
* @template S
|
|
4388
|
-
*/
|
|
4389
|
-
function ParameterSanitiser() { }
|
|
4390
|
-
if (false) {
|
|
4673
|
+
(function (PlaceRouteGuard) {
|
|
4391
4674
|
/**
|
|
4392
|
-
*
|
|
4393
|
-
*
|
|
4394
|
-
*
|
|
4675
|
+
* This a work around for the fact that an activated route with multiple segments doesn't
|
|
4676
|
+
* include the segment params in the paramMap as well as each segment returns an empty
|
|
4677
|
+
* param map even when `parameter`s has content.
|
|
4395
4678
|
*/
|
|
4396
|
-
|
|
4397
|
-
}
|
|
4398
|
-
|
|
4399
|
-
/**
|
|
4400
|
-
* @fileoverview added by tsickle
|
|
4401
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4402
|
-
*/
|
|
4403
|
-
// WARNING: interface has both a type and a value, skipping emit
|
|
4404
|
-
var ParameterType;
|
|
4405
|
-
(function (ParameterType) {
|
|
4406
|
-
class StringType {
|
|
4679
|
+
class ConsolidatedParameterMap {
|
|
4407
4680
|
/**
|
|
4408
|
-
* @param {?}
|
|
4681
|
+
* @param {?} paramMap
|
|
4682
|
+
* @param {?} urlSegments
|
|
4683
|
+
*/
|
|
4684
|
+
constructor(paramMap, urlSegments) {
|
|
4685
|
+
this.paramMaps = [paramMap].concat((urlSegments || []).map((/**
|
|
4686
|
+
* @param {?} s
|
|
4687
|
+
* @return {?}
|
|
4688
|
+
*/
|
|
4689
|
+
s => new ParamMapAdapter(s.parameters)))).filter((/**
|
|
4690
|
+
* @param {?} m
|
|
4691
|
+
* @return {?}
|
|
4692
|
+
*/
|
|
4693
|
+
m => !!m)); // the activated route param map can be null
|
|
4694
|
+
}
|
|
4695
|
+
/**
|
|
4696
|
+
* @param {?} name
|
|
4409
4697
|
* @return {?}
|
|
4410
4698
|
*/
|
|
4411
|
-
|
|
4412
|
-
|
|
4699
|
+
get(name) {
|
|
4700
|
+
/** @type {?} */
|
|
4701
|
+
const paramMap = this.paramMaps.find((/**
|
|
4702
|
+
* @param {?} m
|
|
4703
|
+
* @return {?}
|
|
4704
|
+
*/
|
|
4705
|
+
m => m.has(name)));
|
|
4706
|
+
return paramMap.get(name);
|
|
4413
4707
|
}
|
|
4414
4708
|
/**
|
|
4415
|
-
* @param {?}
|
|
4709
|
+
* @param {?} name
|
|
4416
4710
|
* @return {?}
|
|
4417
4711
|
*/
|
|
4418
|
-
|
|
4419
|
-
|
|
4712
|
+
getAll(name) {
|
|
4713
|
+
/** @type {?} */
|
|
4714
|
+
const paramMap = this.paramMaps.find((/**
|
|
4715
|
+
* @param {?} m
|
|
4716
|
+
* @return {?}
|
|
4717
|
+
*/
|
|
4718
|
+
m => m.has(name)));
|
|
4719
|
+
return paramMap.getAll(name);
|
|
4420
4720
|
}
|
|
4421
|
-
}
|
|
4422
|
-
class NumberType {
|
|
4423
4721
|
/**
|
|
4424
|
-
* @param {?}
|
|
4722
|
+
* @param {?} name
|
|
4425
4723
|
* @return {?}
|
|
4426
4724
|
*/
|
|
4427
|
-
|
|
4428
|
-
return
|
|
4725
|
+
has(name) {
|
|
4726
|
+
return !!this.paramMaps.find((/**
|
|
4727
|
+
* @param {?} m
|
|
4728
|
+
* @return {?}
|
|
4729
|
+
*/
|
|
4730
|
+
m => m.has(name)));
|
|
4429
4731
|
}
|
|
4430
4732
|
/**
|
|
4431
|
-
* @param {?} value
|
|
4432
4733
|
* @return {?}
|
|
4433
4734
|
*/
|
|
4434
|
-
|
|
4435
|
-
return
|
|
4735
|
+
get keys() {
|
|
4736
|
+
return this.paramMaps.reduce((/**
|
|
4737
|
+
* @param {?} result
|
|
4738
|
+
* @param {?} params
|
|
4739
|
+
* @return {?}
|
|
4740
|
+
*/
|
|
4741
|
+
(result, params) => result.concat(params.keys)), []);
|
|
4436
4742
|
}
|
|
4437
4743
|
}
|
|
4438
|
-
|
|
4744
|
+
__decorate([
|
|
4745
|
+
Memoize(),
|
|
4746
|
+
__metadata("design:type", Array),
|
|
4747
|
+
__metadata("design:paramtypes", [])
|
|
4748
|
+
], ConsolidatedParameterMap.prototype, "keys", null);
|
|
4749
|
+
PlaceRouteGuard.ConsolidatedParameterMap = ConsolidatedParameterMap;
|
|
4750
|
+
if (false) {
|
|
4439
4751
|
/**
|
|
4440
|
-
* @
|
|
4752
|
+
* @type {?}
|
|
4753
|
+
* @private
|
|
4754
|
+
*/
|
|
4755
|
+
ConsolidatedParameterMap.prototype.paramMaps;
|
|
4756
|
+
}
|
|
4757
|
+
class ParamMapAdapter {
|
|
4758
|
+
/**
|
|
4759
|
+
* @param {?} params
|
|
4760
|
+
*/
|
|
4761
|
+
constructor(params) {
|
|
4762
|
+
this.params = params;
|
|
4763
|
+
}
|
|
4764
|
+
/**
|
|
4765
|
+
* @param {?} name
|
|
4441
4766
|
* @return {?}
|
|
4442
4767
|
*/
|
|
4443
|
-
|
|
4444
|
-
return
|
|
4768
|
+
get(name) {
|
|
4769
|
+
return this.params[name];
|
|
4445
4770
|
}
|
|
4446
4771
|
/**
|
|
4447
|
-
* @param {?}
|
|
4772
|
+
* @param {?} name
|
|
4448
4773
|
* @return {?}
|
|
4449
4774
|
*/
|
|
4450
|
-
|
|
4451
|
-
|
|
4775
|
+
getAll(name) {
|
|
4776
|
+
/** @type {?} */
|
|
4777
|
+
const value = this.get(name);
|
|
4778
|
+
return Array.isArray(value) ? value : [value];
|
|
4779
|
+
}
|
|
4780
|
+
/**
|
|
4781
|
+
* @param {?} name
|
|
4782
|
+
* @return {?}
|
|
4783
|
+
*/
|
|
4784
|
+
has(name) {
|
|
4785
|
+
return this.keys.includes(name);
|
|
4786
|
+
}
|
|
4787
|
+
/**
|
|
4788
|
+
* @return {?}
|
|
4789
|
+
*/
|
|
4790
|
+
get keys() {
|
|
4791
|
+
return Object.keys(this.params);
|
|
4452
4792
|
}
|
|
4453
4793
|
}
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4794
|
+
if (false) {
|
|
4795
|
+
/**
|
|
4796
|
+
* @type {?}
|
|
4797
|
+
* @private
|
|
4798
|
+
*/
|
|
4799
|
+
ParamMapAdapter.prototype.params;
|
|
4800
|
+
}
|
|
4801
|
+
})(PlaceRouteGuard || (PlaceRouteGuard = {}));
|
|
4458
4802
|
|
|
4459
4803
|
/**
|
|
4460
4804
|
* @fileoverview added by tsickle
|
|
@@ -4476,5 +4820,5 @@ var ParameterType;
|
|
|
4476
4820
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4477
4821
|
*/
|
|
4478
4822
|
|
|
4479
|
-
export { ACTIVITY_DATA, AbstractActivity, AbstractInputComponent, AbstractPlaceNavigationComponent, Activity, ActivityContainerComponent, ActivityOutletComponent, AlertDialogComponent, AngularUiPowerupsModule, Bounds, BusyOverlayComponent,
|
|
4823
|
+
export { ACTIVITY_DATA, AbstractActivity, AbstractInputComponent, AbstractPlaceNavigationComponent, Activity, ActivityContainerComponent, ActivityOutletComponent, AlertDialogComponent, AngularUiPowerupsModule, Bounds, BusyOverlayComponent, CommandDirective, ConfirmThenDialogComponent, ConfirmationDialogComponent, DEFINITION_META_DATA_KEY, DIALOG_INTERACTION_SERVICE_DEFAULTS, DialogInteractionService, Dimension, DisposableComponent, EmptyStateComponent, FocusBindingDirective, Formatter, InteractionContext, InteractionGuard, InteractionModule, InteractionOutletComponent, LEFT_RIGHT_PLACE_ANIMATION, LeavePlaceGuard, ListPlaceNavComponent, NavigationSession, NoopComponent, NumberInputComponent, ParameterDefinition, PasswordInputComponent, Place, PlaceComponent, PlaceDefinition, PlaceHistory, PlaceModule, PlaceOutletComponent, PlaceRouteGuard, PlaceRouter, Point, ROUTE_PARAMETER_LIST_KEY, ResizeAwareComponent, RouteId, SelectInputComponent, StringInputComponent, TabbedPlaceNavigationComponent, Visit, VisitParameter, VisitParameterList, VisitSanitiser, leftRightPlaceAnimation, slideDownAndUpAnimation, CommandDirective as ɵa, FocusBindingDirective as ɵb, ACTIVITY_DATA as ɵba, Activity as ɵbb, ConfirmThenDialogComponent as ɵbd, AlertDialogComponent as ɵbe, InteractionOutletComponent as ɵbg, DIALOG_INTERACTION_SERVICE_DEFAULTS as ɵbh, DialogInteractionService as ɵbi, DisposableComponent as ɵc, NumberInputComponent as ɵd, AbstractInputComponent as ɵe, StringInputComponent as ɵf, PasswordInputComponent as ɵg, SelectInputComponent as ɵh, NoopComponent as ɵi, PlaceModule as ɵj, EmptyStateComponent as ɵk, BusyOverlayComponent as ɵl, PlaceOutletComponent as ɵm, leftRightPlaceAnimation as ɵn, LEFT_RIGHT_PLACE_ANIMATION as ɵo, PlaceRouter as ɵp, PlaceHistory as ɵq, TabbedPlaceNavigationComponent as ɵr, AbstractPlaceNavigationComponent as ɵs, ListPlaceNavComponent as ɵt, InteractionModule as ɵu, ActivityContainerComponent as ɵv, InteractionContext as ɵw, ActivityOutletComponent as ɵx, ConfirmationDialogComponent as ɵy, AbstractActivity as ɵz };
|
|
4480
4824
|
//# sourceMappingURL=coolon-angular-ui-powerups.js.map
|