@coolon/angular-ui-powerups 0.0.67 → 0.0.68
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 +2712 -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 +197 -5
- package/esm2015/lib/place/place-history.js +3 -2
- package/esm2015/lib/place/place-router.js +183 -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 +253 -5
- package/esm5/lib/place/place-history.js +7 -3
- package/esm5/lib/place/place-router.js +240 -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 +1441 -1108
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +2705 -2282
- 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) || (this.isRouteId && !visit.hasRouteId());
|
|
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,169 @@ 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
|
+
result[def.name] = def.urlFormat.parse(params.get(def.name));
|
|
2302
|
+
}
|
|
2303
|
+
}
|
|
2304
|
+
}));
|
|
2305
|
+
return result;
|
|
2306
|
+
}
|
|
2307
|
+
}
|
|
2308
|
+
__decorate([
|
|
2309
|
+
Memoize(),
|
|
2310
|
+
__metadata("design:type", Function),
|
|
2311
|
+
__metadata("design:paramtypes", []),
|
|
2312
|
+
__metadata("design:returntype", ParameterDefinition)
|
|
2313
|
+
], PlaceDefinition.prototype, "getRouteIdParameterDef", null);
|
|
2314
|
+
__decorate([
|
|
2315
|
+
Memoize(),
|
|
2316
|
+
__metadata("design:type", Function),
|
|
2317
|
+
__metadata("design:paramtypes", [Object]),
|
|
2318
|
+
__metadata("design:returntype", Array)
|
|
2319
|
+
], PlaceDefinition.prototype, "getRouteParameterDefs", null);
|
|
2320
|
+
__decorate([
|
|
2321
|
+
Memoize(),
|
|
2322
|
+
__metadata("design:type", Function),
|
|
2323
|
+
__metadata("design:paramtypes", [Object]),
|
|
2324
|
+
__metadata("design:returntype", Array)
|
|
2325
|
+
], PlaceDefinition.prototype, "getVisitParameterDefs", null);
|
|
2326
|
+
if (false) {
|
|
2327
|
+
/** @type {?} */
|
|
2328
|
+
PlaceDefinition.prototype.component;
|
|
2329
|
+
/** @type {?} */
|
|
2330
|
+
PlaceDefinition.prototype.path;
|
|
2331
|
+
/** @type {?} */
|
|
2332
|
+
PlaceDefinition.prototype.authenticate;
|
|
2333
|
+
/** @type {?} */
|
|
2334
|
+
PlaceDefinition.prototype.order;
|
|
2335
|
+
/** @type {?} */
|
|
2336
|
+
PlaceDefinition.prototype.data;
|
|
2337
|
+
/** @type {?} */
|
|
1878
2338
|
PlaceDefinition.prototype.routeParameters;
|
|
1879
2339
|
/** @type {?} */
|
|
1880
2340
|
PlaceDefinition.prototype.children;
|
|
1881
2341
|
}
|
|
2342
|
+
(function (PlaceDefinition) {
|
|
2343
|
+
/**
|
|
2344
|
+
* @record
|
|
2345
|
+
*/
|
|
2346
|
+
function ParameterOptions() { }
|
|
2347
|
+
PlaceDefinition.ParameterOptions = ParameterOptions;
|
|
2348
|
+
if (false) {
|
|
2349
|
+
/** @type {?|undefined} */
|
|
2350
|
+
ParameterOptions.prototype.includeRouteId;
|
|
2351
|
+
/** @type {?|undefined} */
|
|
2352
|
+
ParameterOptions.prototype.includeRouteParameters;
|
|
2353
|
+
/** @type {?|undefined} */
|
|
2354
|
+
ParameterOptions.prototype.includeNonRouteParameters;
|
|
2355
|
+
}
|
|
2356
|
+
})(PlaceDefinition || (PlaceDefinition = {}));
|
|
1882
2357
|
|
|
1883
2358
|
/**
|
|
1884
2359
|
* @fileoverview added by tsickle
|
|
@@ -1895,13 +2370,13 @@ class PlaceComponent extends DisposableComponent {
|
|
|
1895
2370
|
super();
|
|
1896
2371
|
}
|
|
1897
2372
|
/**
|
|
1898
|
-
* @param {?}
|
|
2373
|
+
* @param {?} visit
|
|
1899
2374
|
* @return {?}
|
|
1900
2375
|
*/
|
|
1901
|
-
initialiseBindings(
|
|
1902
|
-
assert.isNil(this.
|
|
1903
|
-
this.
|
|
1904
|
-
this.placeDefinition.
|
|
2376
|
+
initialiseBindings(visit) {
|
|
2377
|
+
assert.isNil(this.visit);
|
|
2378
|
+
this.visit = visit;
|
|
2379
|
+
this.placeDefinition.getVisitParameterDefs().forEach((/**
|
|
1905
2380
|
* @param {?} parameterDef
|
|
1906
2381
|
* @return {?}
|
|
1907
2382
|
*/
|
|
@@ -1919,21 +2394,25 @@ class PlaceComponent extends DisposableComponent {
|
|
|
1919
2394
|
/** @type {?} */
|
|
1920
2395
|
const model = (/** @type {?} */ (this[parameterDef.propertyName]));
|
|
1921
2396
|
// this.txo.observe(parameterDef.propertyName, model);
|
|
1922
|
-
this.registerDisposable(new Binding(this.
|
|
2397
|
+
this.registerDisposable(new Binding(this.visit, model, {
|
|
1923
2398
|
/**
|
|
1924
|
-
* @param {?}
|
|
2399
|
+
* @param {?} visit
|
|
1925
2400
|
* @return {?}
|
|
1926
2401
|
*/
|
|
1927
|
-
toRight(
|
|
1928
|
-
|
|
2402
|
+
toRight(visit) {
|
|
2403
|
+
/** @type {?} */
|
|
2404
|
+
const value = visit.getParameter(parameterDef.name);
|
|
2405
|
+
// console.log('push to component', {name:parameterDef.name, value, visit});
|
|
2406
|
+
return value;
|
|
1929
2407
|
},
|
|
1930
2408
|
/**
|
|
1931
2409
|
* @param {?} value
|
|
1932
|
-
* @param {?=}
|
|
2410
|
+
* @param {?=} currentVisit
|
|
1933
2411
|
* @return {?}
|
|
1934
2412
|
*/
|
|
1935
|
-
toLeft(value,
|
|
1936
|
-
|
|
2413
|
+
toLeft(value, currentVisit) {
|
|
2414
|
+
console.log('push to route', { name: parameterDef.name, value, currentVisit });
|
|
2415
|
+
return currentVisit.replace(parameterDef, value);
|
|
1937
2416
|
}
|
|
1938
2417
|
}));
|
|
1939
2418
|
}
|
|
@@ -1966,7 +2445,7 @@ class PlaceComponent extends DisposableComponent {
|
|
|
1966
2445
|
}
|
|
1967
2446
|
}
|
|
1968
2447
|
__decorate([
|
|
1969
|
-
Memoize(),
|
|
2448
|
+
Memoize$1(),
|
|
1970
2449
|
__metadata("design:type", PlaceDefinition),
|
|
1971
2450
|
__metadata("design:paramtypes", [])
|
|
1972
2451
|
], PlaceComponent.prototype, "placeDefinition", null);
|
|
@@ -1975,7 +2454,7 @@ if (false) {
|
|
|
1975
2454
|
* @type {?}
|
|
1976
2455
|
* @private
|
|
1977
2456
|
*/
|
|
1978
|
-
PlaceComponent.prototype.
|
|
2457
|
+
PlaceComponent.prototype.visit;
|
|
1979
2458
|
}
|
|
1980
2459
|
(function (PlaceComponent) {
|
|
1981
2460
|
/**
|
|
@@ -2033,20 +2512,20 @@ class AbstractPlaceNavigationComponent extends DisposableComponent {
|
|
|
2033
2512
|
*/
|
|
2034
2513
|
getNav(placeDef) {
|
|
2035
2514
|
/** @type {?} */
|
|
2036
|
-
const navItem = (/** @type {?} */ (placeDef.
|
|
2515
|
+
const navItem = (/** @type {?} */ (placeDef.getPlaceData('nav')));
|
|
2037
2516
|
return {
|
|
2038
2517
|
title: (/**
|
|
2039
2518
|
* @return {?}
|
|
2040
2519
|
*/
|
|
2041
|
-
() => navItem ? navItem.title() : placeDef.
|
|
2520
|
+
() => navItem ? navItem.title() : placeDef.searchPlaceData(['navTitle', 'title'])),
|
|
2042
2521
|
tooltip: (/**
|
|
2043
2522
|
* @return {?}
|
|
2044
2523
|
*/
|
|
2045
|
-
() => navItem && navItem.tooltip ? navItem.tooltip() : placeDef.
|
|
2524
|
+
() => navItem && navItem.tooltip ? navItem.tooltip() : placeDef.getPlaceData('navTooltip', null)),
|
|
2046
2525
|
icon: (/**
|
|
2047
2526
|
* @return {?}
|
|
2048
2527
|
*/
|
|
2049
|
-
() => navItem && navItem.icon ? navItem.icon() : placeDef.
|
|
2528
|
+
() => navItem && navItem.icon ? navItem.icon() : placeDef.getPlaceData('navIcon', null))
|
|
2050
2529
|
};
|
|
2051
2530
|
}
|
|
2052
2531
|
/**
|
|
@@ -2068,7 +2547,7 @@ __decorate([
|
|
|
2068
2547
|
__metadata("design:type", ListModel)
|
|
2069
2548
|
], AbstractPlaceNavigationComponent.prototype, "placesModel", void 0);
|
|
2070
2549
|
__decorate([
|
|
2071
|
-
Memoize
|
|
2550
|
+
Memoize(),
|
|
2072
2551
|
__metadata("design:type", Function),
|
|
2073
2552
|
__metadata("design:paramtypes", [PlaceDefinition]),
|
|
2074
2553
|
__metadata("design:returntype", Object)
|
|
@@ -2113,7 +2592,7 @@ class ListPlaceNavComponent extends AbstractPlaceNavigationComponent {
|
|
|
2113
2592
|
ListPlaceNavComponent.decorators = [
|
|
2114
2593
|
{ type: Component, args: [{
|
|
2115
2594
|
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",
|
|
2595
|
+
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
2596
|
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
2597
|
}] }
|
|
2119
2598
|
];
|
|
@@ -2139,6 +2618,7 @@ class PlaceHistory {
|
|
|
2139
2618
|
this.router = router;
|
|
2140
2619
|
this._history = new Map();
|
|
2141
2620
|
}
|
|
2621
|
+
// @Trace()
|
|
2142
2622
|
/**
|
|
2143
2623
|
* @param {?} state
|
|
2144
2624
|
* @return {?}
|
|
@@ -2148,7 +2628,7 @@ class PlaceHistory {
|
|
|
2148
2628
|
const history = this.getHistory(state.placeDefinition);
|
|
2149
2629
|
/** @type {?} */
|
|
2150
2630
|
const previousState = ___default.last(history);
|
|
2151
|
-
if (!previousState || state.
|
|
2631
|
+
if (!previousState || state.hasChangedFrom(previousState)) {
|
|
2152
2632
|
history.unshift(state); // LIFO
|
|
2153
2633
|
this.setHistory(state.placeDefinition, history.slice(0, 3)); // limit our history to 4 visits
|
|
2154
2634
|
}
|
|
@@ -2203,955 +2683,523 @@ if (false) {
|
|
|
2203
2683
|
* @fileoverview added by tsickle
|
|
2204
2684
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2205
2685
|
*/
|
|
2686
|
+
/**
|
|
2687
|
+
* @abstract
|
|
2688
|
+
*/
|
|
2206
2689
|
class NavigationSession {
|
|
2207
2690
|
/**
|
|
2208
|
-
* @
|
|
2209
|
-
* @param {?}
|
|
2691
|
+
* @protected
|
|
2692
|
+
* @param {?} firstNavigation
|
|
2210
2693
|
*/
|
|
2211
|
-
constructor(
|
|
2212
|
-
this.
|
|
2213
|
-
this.initialUrl = initialUrl;
|
|
2694
|
+
constructor(firstNavigation) {
|
|
2695
|
+
this.firstNavigation = firstNavigation;
|
|
2214
2696
|
this._alreadyAccepted = [];
|
|
2215
|
-
|
|
2697
|
+
this._visits = new Map();
|
|
2216
2698
|
}
|
|
2217
2699
|
/**
|
|
2218
|
-
* @param {?}
|
|
2700
|
+
* @param {?} visit
|
|
2219
2701
|
* @return {?}
|
|
2220
2702
|
*/
|
|
2221
|
-
|
|
2222
|
-
|
|
2703
|
+
storeVisit(visit) {
|
|
2704
|
+
this._visits.set(visit.placeDefinition, visit);
|
|
2223
2705
|
}
|
|
2224
2706
|
/**
|
|
2225
|
-
* @param {?}
|
|
2707
|
+
* @param {?} placeDef
|
|
2226
2708
|
* @return {?}
|
|
2227
2709
|
*/
|
|
2228
|
-
|
|
2229
|
-
this.
|
|
2710
|
+
getVisitFor(placeDef) {
|
|
2711
|
+
return this._visits.get(placeDef);
|
|
2230
2712
|
}
|
|
2231
|
-
}
|
|
2232
|
-
if (false) {
|
|
2233
2713
|
/**
|
|
2234
|
-
* @
|
|
2235
|
-
* @
|
|
2714
|
+
* @param {?} params
|
|
2715
|
+
* @return {?}
|
|
2236
2716
|
*/
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
NavigationSession.prototype.initialUrl;
|
|
2242
|
-
}
|
|
2243
|
-
class PlaceRouter {
|
|
2717
|
+
mergePrivatePlaceParameters(params) {
|
|
2718
|
+
return null;
|
|
2719
|
+
}
|
|
2720
|
+
// @Trace()
|
|
2244
2721
|
/**
|
|
2245
|
-
* @param {?}
|
|
2246
|
-
* @
|
|
2722
|
+
* @param {?} placeComponent
|
|
2723
|
+
* @return {?}
|
|
2247
2724
|
*/
|
|
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
|
-
}));
|
|
2725
|
+
alreadyAccepted(placeComponent) {
|
|
2726
|
+
return this._alreadyAccepted.includes(placeComponent);
|
|
2280
2727
|
}
|
|
2728
|
+
// @Trace()
|
|
2281
2729
|
/**
|
|
2730
|
+
* @param {?} component
|
|
2282
2731
|
* @return {?}
|
|
2283
2732
|
*/
|
|
2284
|
-
|
|
2285
|
-
|
|
2733
|
+
rememberAcceptanceOf(component) {
|
|
2734
|
+
this._alreadyAccepted.push(component);
|
|
2286
2735
|
}
|
|
2287
2736
|
/**
|
|
2288
|
-
* @param {?}
|
|
2289
|
-
* @param {?} previous
|
|
2290
|
-
* @param {?} next
|
|
2737
|
+
* @param {?} url
|
|
2291
2738
|
* @return {?}
|
|
2292
2739
|
*/
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
const relativePath = !!previous.hasRouteId() ? '..' : '.';
|
|
2296
|
-
this.router.navigate([relativePath].concat(this.createRouteParameters(next), this.getChildPath(activatedRoute.snapshot)), {
|
|
2297
|
-
relativeTo: activatedRoute
|
|
2298
|
-
});
|
|
2740
|
+
setPopstateReturn(url) {
|
|
2741
|
+
this._popStateReturnUrl = url;
|
|
2299
2742
|
}
|
|
2300
|
-
// @Trace()
|
|
2301
2743
|
/**
|
|
2302
|
-
* @param {?} activatedRoute
|
|
2303
|
-
* @param {?} sanitised
|
|
2304
2744
|
* @return {?}
|
|
2305
2745
|
*/
|
|
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);
|
|
2746
|
+
get isPopState() {
|
|
2747
|
+
return !!this._popStateReturnUrl;
|
|
2316
2748
|
}
|
|
2317
2749
|
/**
|
|
2318
|
-
* @protected
|
|
2319
|
-
* @param {?} activatedRoute
|
|
2320
2750
|
* @return {?}
|
|
2321
2751
|
*/
|
|
2322
|
-
|
|
2323
|
-
return
|
|
2324
|
-
* @param {?} child
|
|
2325
|
-
* @return {?}
|
|
2326
|
-
*/
|
|
2327
|
-
child => child.url)));
|
|
2752
|
+
get popStateReturnUrl() {
|
|
2753
|
+
return this._popStateReturnUrl;
|
|
2328
2754
|
}
|
|
2329
2755
|
/**
|
|
2330
|
-
* @protected
|
|
2331
|
-
* @param {?} parameters
|
|
2332
2756
|
* @return {?}
|
|
2333
2757
|
*/
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
const routeId = parameters.getFormattedRouteId();
|
|
2337
|
-
return routeId ?
|
|
2338
|
-
[routeId, parameters.getFormattedParameters()] :
|
|
2339
|
-
[parameters.getFormattedParameters()];
|
|
2758
|
+
getVisits() {
|
|
2759
|
+
return Array.from(this._visits.values());
|
|
2340
2760
|
}
|
|
2341
2761
|
}
|
|
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
2762
|
if (false) {
|
|
2354
2763
|
/**
|
|
2355
2764
|
* @type {?}
|
|
2356
2765
|
* @private
|
|
2357
2766
|
*/
|
|
2358
|
-
|
|
2767
|
+
NavigationSession.prototype._alreadyAccepted;
|
|
2359
2768
|
/**
|
|
2360
2769
|
* @type {?}
|
|
2361
2770
|
* @private
|
|
2362
2771
|
*/
|
|
2363
|
-
|
|
2772
|
+
NavigationSession.prototype._visits;
|
|
2773
|
+
/**
|
|
2774
|
+
* @type {?}
|
|
2775
|
+
* @private
|
|
2776
|
+
*/
|
|
2777
|
+
NavigationSession.prototype._popStateReturnUrl;
|
|
2364
2778
|
/** @type {?} */
|
|
2365
|
-
|
|
2779
|
+
NavigationSession.prototype.isExternal;
|
|
2780
|
+
/** @type {?} */
|
|
2781
|
+
NavigationSession.prototype.firstNavigation;
|
|
2366
2782
|
}
|
|
2783
|
+
(function (NavigationSession) {
|
|
2784
|
+
class External extends NavigationSession {
|
|
2785
|
+
/**
|
|
2786
|
+
* @param {?} isFirstTime
|
|
2787
|
+
*/
|
|
2788
|
+
constructor(isFirstTime) {
|
|
2789
|
+
super(isFirstTime);
|
|
2790
|
+
this.isExternal = true;
|
|
2791
|
+
}
|
|
2792
|
+
}
|
|
2793
|
+
if (false) {
|
|
2794
|
+
/** @type {?} */
|
|
2795
|
+
External.prototype.isExternal;
|
|
2796
|
+
}
|
|
2797
|
+
class Internal extends NavigationSession {
|
|
2798
|
+
/**
|
|
2799
|
+
* @param {?} visit
|
|
2800
|
+
*/
|
|
2801
|
+
constructor(visit) {
|
|
2802
|
+
super(false);
|
|
2803
|
+
this.isExternal = false;
|
|
2804
|
+
this.storeVisit(visit);
|
|
2805
|
+
}
|
|
2806
|
+
}
|
|
2807
|
+
if (false) {
|
|
2808
|
+
/** @type {?} */
|
|
2809
|
+
Internal.prototype.isExternal;
|
|
2810
|
+
}
|
|
2811
|
+
/**
|
|
2812
|
+
* @param {?} visit
|
|
2813
|
+
* @return {?}
|
|
2814
|
+
*/
|
|
2815
|
+
function createInternal(visit) {
|
|
2816
|
+
return new Internal(visit);
|
|
2817
|
+
}
|
|
2818
|
+
NavigationSession.createInternal = createInternal;
|
|
2819
|
+
/**
|
|
2820
|
+
* @param {?} firstTimeRoute
|
|
2821
|
+
* @return {?}
|
|
2822
|
+
*/
|
|
2823
|
+
function createExternal(firstTimeRoute) {
|
|
2824
|
+
return new External(firstTimeRoute);
|
|
2825
|
+
}
|
|
2826
|
+
NavigationSession.createExternal = createExternal;
|
|
2827
|
+
})(NavigationSession || (NavigationSession = {}));
|
|
2367
2828
|
|
|
2368
2829
|
/**
|
|
2369
2830
|
* @fileoverview added by tsickle
|
|
2370
2831
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2371
2832
|
*/
|
|
2372
2833
|
/**
|
|
2373
|
-
* @
|
|
2374
|
-
* @template T, S
|
|
2834
|
+
* @record
|
|
2375
2835
|
*/
|
|
2376
|
-
|
|
2836
|
+
function Params() { }
|
|
2837
|
+
class Visit {
|
|
2377
2838
|
/**
|
|
2378
|
-
* @param {?}
|
|
2379
|
-
* @param {
|
|
2380
|
-
* @param {?} options
|
|
2839
|
+
* @param {?} placeDefinition
|
|
2840
|
+
* @param {?=} visitParameters
|
|
2381
2841
|
*/
|
|
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);
|
|
2842
|
+
constructor(placeDefinition, visitParameters = {}) {
|
|
2843
|
+
this.placeDefinition = placeDefinition;
|
|
2844
|
+
this.visitParameters = visitParameters;
|
|
2390
2845
|
}
|
|
2846
|
+
// @Trace()
|
|
2391
2847
|
/**
|
|
2392
|
-
* @param {?} injector
|
|
2393
2848
|
* @return {?}
|
|
2394
2849
|
*/
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
return new ParameterDefinition.DefaultParameterSanitiser(this.remember, this.defaultValue, injector.get(PlaceHistory));
|
|
2398
|
-
}
|
|
2399
|
-
else {
|
|
2400
|
-
return null;
|
|
2401
|
-
}
|
|
2850
|
+
getRouteId() {
|
|
2851
|
+
return this.placeDefinition.getRouteIdFrom(this);
|
|
2402
2852
|
}
|
|
2403
|
-
|
|
2404
|
-
if (false) {
|
|
2405
|
-
/** @type {?} */
|
|
2406
|
-
ParameterDefinition.prototype.isRouteId;
|
|
2407
|
-
/** @type {?} */
|
|
2408
|
-
ParameterDefinition.prototype.isArray;
|
|
2409
|
-
/** @type {?} */
|
|
2410
|
-
ParameterDefinition.prototype.name;
|
|
2853
|
+
// @Trace()
|
|
2411
2854
|
/**
|
|
2412
|
-
* @
|
|
2413
|
-
* @private
|
|
2855
|
+
* @return {?}
|
|
2414
2856
|
*/
|
|
2415
|
-
|
|
2857
|
+
hasRouteId() {
|
|
2858
|
+
return !isNil(this.getRouteId());
|
|
2859
|
+
}
|
|
2416
2860
|
/**
|
|
2417
|
-
*
|
|
2418
|
-
*
|
|
2861
|
+
* Returns the value of the place parameter with the specified name. The parameter
|
|
2862
|
+
* name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the
|
|
2863
|
+
* same as the the ValueModel property name.
|
|
2864
|
+
* @param {?} parameterName the field name of the property model or the `as` option if specified.
|
|
2865
|
+
* @return {?}
|
|
2419
2866
|
*/
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
ParameterDefinition.prototype.type;
|
|
2425
|
-
}
|
|
2426
|
-
(function (ParameterDefinition) {
|
|
2867
|
+
getParameter(parameterName) {
|
|
2868
|
+
return this.visitParameters[parameterName];
|
|
2869
|
+
}
|
|
2870
|
+
// @Trace()
|
|
2427
2871
|
/**
|
|
2428
|
-
* @
|
|
2429
|
-
* @
|
|
2872
|
+
* @param {?} parameterName
|
|
2873
|
+
* @return {?}
|
|
2430
2874
|
*/
|
|
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;
|
|
2875
|
+
hasParameter(parameterName) {
|
|
2876
|
+
return Object.keys(this.visitParameters).includes(parameterName);
|
|
2459
2877
|
}
|
|
2460
2878
|
/**
|
|
2461
|
-
* @template
|
|
2879
|
+
* @template S
|
|
2880
|
+
* @param {?} parameter
|
|
2881
|
+
* @param {?} value
|
|
2882
|
+
* @return {?}
|
|
2462
2883
|
*/
|
|
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;
|
|
2884
|
+
replace(parameter, value) {
|
|
2885
|
+
return new Visit(this.placeDefinition, Object.assign({}, this.visitParameters, { [parameter.name]: value }));
|
|
2476
2886
|
}
|
|
2477
2887
|
/**
|
|
2478
|
-
* @template
|
|
2888
|
+
* @template S
|
|
2889
|
+
* @param {?} routeParams
|
|
2890
|
+
* @return {?}
|
|
2479
2891
|
*/
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
super(...arguments);
|
|
2483
|
-
this.isRouteId = false;
|
|
2484
|
-
this.isArray = true;
|
|
2485
|
-
}
|
|
2486
|
-
}
|
|
2487
|
-
ParameterDefinition.ArrayParameter = ArrayParameter;
|
|
2488
|
-
if (false) {
|
|
2892
|
+
mergeRouteParameters(routeParams) {
|
|
2893
|
+
// todo: whitelist parameters.
|
|
2489
2894
|
/** @type {?} */
|
|
2490
|
-
|
|
2895
|
+
const routeParameterKeys = Object.keys(routeParams);
|
|
2491
2896
|
/** @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
|
|
2897
|
+
const params = {};
|
|
2898
|
+
this.placeDefinition.getVisitParameterDefs().forEach((/**
|
|
2899
|
+
* @param {?} def
|
|
2511
2900
|
* @return {?}
|
|
2512
2901
|
*/
|
|
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);
|
|
2902
|
+
def => {
|
|
2903
|
+
if (def.isRouteId || def.isRouteParameter) {
|
|
2904
|
+
if (routeParameterKeys.includes(def.name)) {
|
|
2905
|
+
params[def.name] = routeParams[def.name];
|
|
2521
2906
|
}
|
|
2522
|
-
return parameter.isEmptyValue(value) ? this.defaultValue : value;
|
|
2523
2907
|
}
|
|
2524
2908
|
else {
|
|
2525
|
-
|
|
2909
|
+
// copy non route params as is, but only if they already exist otherwise we'll inject nil values and break the
|
|
2910
|
+
// defaults and remember sanitisation process.
|
|
2911
|
+
if (this.hasParameter(def.name)) {
|
|
2912
|
+
params[def.name] = this.getParameter(def.name);
|
|
2913
|
+
}
|
|
2526
2914
|
}
|
|
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);
|
|
2915
|
+
}));
|
|
2916
|
+
return new Visit(this.placeDefinition, params);
|
|
2578
2917
|
}
|
|
2579
2918
|
/**
|
|
2580
|
-
*
|
|
2919
|
+
* @param {?} other
|
|
2581
2920
|
* @return {?}
|
|
2582
2921
|
*/
|
|
2583
|
-
|
|
2584
|
-
|
|
2922
|
+
hasRoutingChangedFrom(other) {
|
|
2923
|
+
/** @type {?} */
|
|
2924
|
+
const samePlace = other.placeDefinition === this.placeDefinition;
|
|
2925
|
+
/** @type {?} */
|
|
2926
|
+
const sameRouteParameters = isEqual(this.placeDefinition.getFormattedRouteParameters(this, true), this.placeDefinition.getFormattedRouteParameters(other, true));
|
|
2927
|
+
return !samePlace || !sameRouteParameters;
|
|
2585
2928
|
}
|
|
2586
2929
|
/**
|
|
2587
|
-
* @param {?}
|
|
2588
|
-
* @param {?} injector
|
|
2930
|
+
* @param {?} other
|
|
2589
2931
|
* @return {?}
|
|
2590
2932
|
*/
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
if (sanitiser) {
|
|
2596
|
-
return sanitiser.sanitise(this, visit);
|
|
2597
|
-
}
|
|
2598
|
-
else {
|
|
2599
|
-
return this.value;
|
|
2600
|
-
}
|
|
2601
|
-
});
|
|
2933
|
+
hasChangedFrom(other) {
|
|
2934
|
+
/** @type {?} */
|
|
2935
|
+
const sameNonRouteParameters = isEqual(this.placeDefinition.getNonRouteParameters(this), this.placeDefinition.getNonRouteParameters(other));
|
|
2936
|
+
return !sameNonRouteParameters || this.hasRoutingChangedFrom(other);
|
|
2602
2937
|
}
|
|
2603
2938
|
}
|
|
2604
2939
|
if (false) {
|
|
2605
2940
|
/** @type {?} */
|
|
2606
|
-
|
|
2607
|
-
/** @type {?} */
|
|
2608
|
-
RouteParameterValue.prototype.definition;
|
|
2941
|
+
Visit.prototype.placeDefinition;
|
|
2609
2942
|
/**
|
|
2610
2943
|
* @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 {?}
|
|
2944
|
+
* @private
|
|
2635
2945
|
*/
|
|
2636
|
-
|
|
2946
|
+
Visit.prototype.visitParameters;
|
|
2637
2947
|
}
|
|
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
2948
|
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
*/
|
|
2773
|
-
constructor(placeDefinition, parameters) {
|
|
2774
|
-
this.placeDefinition = placeDefinition;
|
|
2775
|
-
this.parameters = parameters;
|
|
2776
|
-
}
|
|
2949
|
+
/**
|
|
2950
|
+
* @fileoverview added by tsickle
|
|
2951
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2952
|
+
*/
|
|
2953
|
+
class PlaceRouter extends GarbageCollector {
|
|
2777
2954
|
/**
|
|
2778
|
-
* @param {?}
|
|
2779
|
-
* @param {
|
|
2780
|
-
* @
|
|
2955
|
+
* @param {?} router
|
|
2956
|
+
* @param {?} angularLocation
|
|
2957
|
+
* @param {?} placeHistory
|
|
2781
2958
|
*/
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2959
|
+
constructor(router, angularLocation, placeHistory) {
|
|
2960
|
+
super();
|
|
2961
|
+
this.router = router;
|
|
2962
|
+
this.angularLocation = angularLocation;
|
|
2963
|
+
this.placeHistory = placeHistory;
|
|
2964
|
+
this.firstRoute = true;
|
|
2965
|
+
this._navigationSessionModel = new MutableValueModel();
|
|
2966
|
+
this._activeVisits = new MutableListModel();
|
|
2967
|
+
const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
|
|
2968
|
+
this.activeVisitIndex = chain(this._activeVisits).indexBy('placeDefinition');
|
|
2969
|
+
angularLocation.onUrlChange((/**
|
|
2970
|
+
* @param {?} url
|
|
2786
2971
|
* @return {?}
|
|
2787
2972
|
*/
|
|
2788
|
-
|
|
2789
|
-
|
|
2973
|
+
url => {
|
|
2974
|
+
console.log(`location.onUrlChange -> ${url}`);
|
|
2790
2975
|
}));
|
|
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
|
|
2976
|
+
// TODO: make setup the callbacks in during module initiation to make this testable.
|
|
2977
|
+
this.router.events.subscribe((/**
|
|
2978
|
+
* @param {?} event
|
|
2808
2979
|
* @return {?}
|
|
2809
2980
|
*/
|
|
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
|
|
2981
|
+
event => {
|
|
2982
|
+
// Routing event sequence
|
|
2983
|
+
// ======================
|
|
2984
|
+
// NavigationStart -> .... -> NavigationCancel --> redirect, go around again in the same session
|
|
2985
|
+
// NavigationStart -> .... -> NavigationEnd --> navigation complete, end session.
|
|
2986
|
+
// NavigationStart -> .... -> NavigationError --> navigation canceled, end session.
|
|
2987
|
+
// =======================
|
|
2988
|
+
if (event instanceof NavigationStart) {
|
|
2989
|
+
this.onAngularRouterStarted(event);
|
|
2990
|
+
}
|
|
2991
|
+
if (event instanceof NavigationEnd || event instanceof NavigationError) {
|
|
2992
|
+
this.onAngularRouterFinished();
|
|
2993
|
+
}
|
|
2994
|
+
}));
|
|
2995
|
+
this.navigationSessionActive = chain(this.navigationSessionModel).isNotNil();
|
|
2996
|
+
this.navigationSessionActive.subscribe((/**
|
|
2997
|
+
* @param {?} active
|
|
2836
2998
|
* @return {?}
|
|
2837
2999
|
*/
|
|
2838
|
-
|
|
2839
|
-
|
|
3000
|
+
active => {
|
|
3001
|
+
console.log('navigationSessionActive', active);
|
|
3002
|
+
}));
|
|
3003
|
+
// const txo = new TransactionObserver().onEvent(e => console.log(e.toString()));
|
|
3004
|
+
// txo.observe('this.navigationSessionModel', this.navigationSessionModel);
|
|
2840
3005
|
}
|
|
2841
3006
|
/**
|
|
2842
|
-
* @private
|
|
2843
3007
|
* @return {?}
|
|
2844
3008
|
*/
|
|
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))));
|
|
3009
|
+
get navigationSession() {
|
|
3010
|
+
return this._navigationSessionModel.value;
|
|
2853
3011
|
}
|
|
2854
3012
|
/**
|
|
2855
|
-
* @private
|
|
2856
3013
|
* @return {?}
|
|
2857
3014
|
*/
|
|
2858
|
-
|
|
2859
|
-
return this.
|
|
2860
|
-
* @param {?} r
|
|
2861
|
-
* @return {?}
|
|
2862
|
-
*/
|
|
2863
|
-
r => !r.definition.isRouteId));
|
|
3015
|
+
get navigationSessionModel() {
|
|
3016
|
+
return this._navigationSessionModel.readonly;
|
|
2864
3017
|
}
|
|
2865
3018
|
/**
|
|
2866
3019
|
* @return {?}
|
|
2867
3020
|
*/
|
|
2868
|
-
|
|
2869
|
-
return
|
|
3021
|
+
get activeVisits() {
|
|
3022
|
+
return this._activeVisits.readonly;
|
|
2870
3023
|
}
|
|
2871
3024
|
/**
|
|
3025
|
+
* placeRouter.navigate(placeDestinations.somePlace.createVisit(routeId, ...visitParams));
|
|
3026
|
+
* @param {?} visit
|
|
2872
3027
|
* @return {?}
|
|
2873
3028
|
*/
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
3029
|
+
// @Trace()
|
|
3030
|
+
navigate(visit) {
|
|
3031
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3032
|
+
this.doNavigation(visit);
|
|
3033
|
+
});
|
|
2878
3034
|
}
|
|
2879
3035
|
/**
|
|
3036
|
+
* @param {?} activatedRoute
|
|
3037
|
+
* @param {?} previous
|
|
3038
|
+
* @param {?} next
|
|
2880
3039
|
* @return {?}
|
|
2881
3040
|
*/
|
|
2882
|
-
|
|
2883
|
-
return this
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
3041
|
+
pushVisitChangesToRoute(activatedRoute, previous, next) {
|
|
3042
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3043
|
+
// FIXME: no route id -> route id duplicates route parameters
|
|
3044
|
+
if (next.hasRoutingChangedFrom(previous)) {
|
|
3045
|
+
return this.doNavigation(next, (/**
|
|
3046
|
+
* @param {?} router
|
|
3047
|
+
* @return {?}
|
|
3048
|
+
*/
|
|
3049
|
+
router => {
|
|
3050
|
+
/** @type {?} */
|
|
3051
|
+
const relativePath = !!previous.placeDefinition.hasRouteId() ? '..' : '.';
|
|
3052
|
+
/** @type {?} */
|
|
3053
|
+
const def = next.placeDefinition;
|
|
3054
|
+
/** @type {?} */
|
|
3055
|
+
const params = next.hasRouteId() ?
|
|
3056
|
+
[def.getFormattedRouteId(next), def.getFormattedRouteParameters(next)] :
|
|
3057
|
+
[def.getFormattedRouteParameters(next)];
|
|
3058
|
+
/** @type {?} */
|
|
3059
|
+
const commands = [relativePath].concat(params, this.getChildPath(activatedRoute.snapshot));
|
|
3060
|
+
console.log('### Redirect', commands);
|
|
3061
|
+
return router.navigate(commands, {
|
|
3062
|
+
relativeTo: activatedRoute
|
|
3063
|
+
});
|
|
3064
|
+
}));
|
|
3065
|
+
}
|
|
3066
|
+
else {
|
|
3067
|
+
this.placeHistory.add(next);
|
|
3068
|
+
}
|
|
3069
|
+
});
|
|
2888
3070
|
}
|
|
2889
3071
|
/**
|
|
3072
|
+
* @param {?} visit
|
|
3073
|
+
* @param {?=} customNavigation
|
|
2890
3074
|
* @return {?}
|
|
2891
3075
|
*/
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
3076
|
+
doNavigation(visit, customNavigation) {
|
|
3077
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3078
|
+
this._navigationSessionModel.value = NavigationSession.createInternal(visit);
|
|
3079
|
+
try {
|
|
3080
|
+
if (customNavigation) {
|
|
3081
|
+
yield customNavigation(this.router);
|
|
3082
|
+
}
|
|
3083
|
+
else {
|
|
3084
|
+
/** @type {?} */
|
|
3085
|
+
const def = visit.placeDefinition;
|
|
3086
|
+
/** @type {?} */
|
|
3087
|
+
const parameterCommands = visit.hasRouteId() ?
|
|
3088
|
+
[def.getFormattedRouteId(visit), def.getFormattedRouteParameters(visit)] :
|
|
3089
|
+
[def.getFormattedRouteParameters(visit)];
|
|
3090
|
+
/** @type {?} */
|
|
3091
|
+
const commands = [def.path].concat(parameterCommands);
|
|
3092
|
+
console.log('_doNavigation', visit, commands);
|
|
3093
|
+
yield this.router.navigate(commands);
|
|
3094
|
+
}
|
|
3095
|
+
}
|
|
3096
|
+
finally {
|
|
3097
|
+
if (this.navigationSession && !this.router.getCurrentNavigation()) {
|
|
3098
|
+
this.onAngularRouterFinished();
|
|
3099
|
+
}
|
|
3100
|
+
}
|
|
3101
|
+
});
|
|
2908
3102
|
}
|
|
3103
|
+
// @Trace()
|
|
3104
|
+
/**
|
|
3105
|
+
* @private
|
|
3106
|
+
* @param {?} event
|
|
3107
|
+
* @return {?}
|
|
3108
|
+
*/
|
|
3109
|
+
onAngularRouterStarted(event) {
|
|
3110
|
+
if (!this.navigationSession) { // We been activated by an external route rather than placeRouter.go(visit)
|
|
3111
|
+
console.log('navigation started', { firstTime: this.firstRoute });
|
|
3112
|
+
/** @type {?} */
|
|
3113
|
+
const session = NavigationSession.createExternal(this.firstRoute);
|
|
3114
|
+
if (event.navigationTrigger === 'popstate') {
|
|
3115
|
+
session.setPopstateReturn(this.router.routerState.snapshot.url);
|
|
3116
|
+
}
|
|
3117
|
+
this._navigationSessionModel.value = session;
|
|
3118
|
+
}
|
|
3119
|
+
this.firstRoute = false;
|
|
3120
|
+
}
|
|
3121
|
+
// @Trace()
|
|
2909
3122
|
/**
|
|
3123
|
+
* @private
|
|
2910
3124
|
* @return {?}
|
|
2911
3125
|
*/
|
|
2912
|
-
|
|
3126
|
+
onAngularRouterFinished() {
|
|
2913
3127
|
/** @type {?} */
|
|
2914
|
-
const
|
|
3128
|
+
const session = this._navigationSessionModel.value;
|
|
3129
|
+
// Update visits before we end the navigation session. This allows the place out let to
|
|
3130
|
+
// gate ignore changes that occur while the visit is active
|
|
2915
3131
|
/** @type {?} */
|
|
2916
|
-
const
|
|
2917
|
-
|
|
3132
|
+
const visits = session.getVisits();
|
|
3133
|
+
visits.forEach((/**
|
|
3134
|
+
* @param {?} v
|
|
2918
3135
|
* @return {?}
|
|
2919
3136
|
*/
|
|
2920
|
-
|
|
2921
|
-
|
|
3137
|
+
v => {
|
|
3138
|
+
this.placeHistory.add(v);
|
|
2922
3139
|
}));
|
|
2923
|
-
|
|
3140
|
+
this._activeVisits.value = visits;
|
|
3141
|
+
this._navigationSessionModel.value = null;
|
|
2924
3142
|
}
|
|
2925
3143
|
/**
|
|
2926
|
-
* @
|
|
2927
|
-
* @param {?} parameter
|
|
2928
|
-
* @param {?} value
|
|
3144
|
+
* @param {?} activatedRoute
|
|
2929
3145
|
* @return {?}
|
|
2930
3146
|
*/
|
|
2931
|
-
|
|
2932
|
-
return
|
|
2933
|
-
* @param {?}
|
|
3147
|
+
getChildPath(activatedRoute) {
|
|
3148
|
+
return ___default.flatten(activatedRoute.children.map((/**
|
|
3149
|
+
* @param {?} child
|
|
2934
3150
|
* @return {?}
|
|
2935
3151
|
*/
|
|
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
|
-
});
|
|
3152
|
+
child => child.url)));
|
|
2972
3153
|
}
|
|
2973
3154
|
}
|
|
3155
|
+
PlaceRouter.decorators = [
|
|
3156
|
+
{ type: Injectable, args: [{
|
|
3157
|
+
providedIn: 'root'
|
|
3158
|
+
},] }
|
|
3159
|
+
];
|
|
3160
|
+
/** @nocollapse */
|
|
3161
|
+
PlaceRouter.ctorParameters = () => [
|
|
3162
|
+
{ type: Router },
|
|
3163
|
+
{ type: Location },
|
|
3164
|
+
{ type: PlaceHistory }
|
|
3165
|
+
];
|
|
3166
|
+
/** @nocollapse */ PlaceRouter.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(ɵɵinject(Router), ɵɵinject(Location), ɵɵinject(PlaceHistory)); }, token: PlaceRouter, providedIn: "root" });
|
|
2974
3167
|
__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(),
|
|
3168
|
+
Trace(),
|
|
3000
3169
|
__metadata("design:type", Function),
|
|
3001
|
-
__metadata("design:paramtypes", []),
|
|
3002
|
-
__metadata("design:returntype",
|
|
3003
|
-
],
|
|
3170
|
+
__metadata("design:paramtypes", [ActivatedRoute, Visit, Visit]),
|
|
3171
|
+
__metadata("design:returntype", Promise)
|
|
3172
|
+
], PlaceRouter.prototype, "pushVisitChangesToRoute", null);
|
|
3004
3173
|
if (false) {
|
|
3005
|
-
/** @type {?} */
|
|
3006
|
-
ParameterSnapshot.prototype.placeDefinition;
|
|
3007
3174
|
/**
|
|
3008
3175
|
* @type {?}
|
|
3009
3176
|
* @private
|
|
3010
3177
|
*/
|
|
3011
|
-
|
|
3012
|
-
}
|
|
3013
|
-
(function (ParameterSnapshot) {
|
|
3178
|
+
PlaceRouter.prototype.firstRoute;
|
|
3014
3179
|
/**
|
|
3015
|
-
* @
|
|
3016
|
-
* @
|
|
3017
|
-
* @param {?} urlSegments
|
|
3018
|
-
* @return {?}
|
|
3180
|
+
* @type {?}
|
|
3181
|
+
* @private
|
|
3019
3182
|
*/
|
|
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;
|
|
3183
|
+
PlaceRouter.prototype._navigationSessionModel;
|
|
3032
3184
|
/**
|
|
3033
|
-
*
|
|
3034
|
-
*
|
|
3035
|
-
* param map even when `parameter`s has content.
|
|
3185
|
+
* @type {?}
|
|
3186
|
+
* @private
|
|
3036
3187
|
*/
|
|
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 = {}));
|
|
3188
|
+
PlaceRouter.prototype._activeVisits;
|
|
3189
|
+
/** @type {?} */
|
|
3190
|
+
PlaceRouter.prototype.navigationSessionActive;
|
|
3191
|
+
/** @type {?} */
|
|
3192
|
+
PlaceRouter.prototype.activeVisitIndex;
|
|
3193
|
+
/**
|
|
3194
|
+
* @type {?}
|
|
3195
|
+
* @private
|
|
3196
|
+
*/
|
|
3197
|
+
PlaceRouter.prototype.router;
|
|
3198
|
+
/** @type {?} */
|
|
3199
|
+
PlaceRouter.prototype.angularLocation;
|
|
3200
|
+
/** @type {?} */
|
|
3201
|
+
PlaceRouter.prototype.placeHistory;
|
|
3202
|
+
}
|
|
3155
3203
|
|
|
3156
3204
|
/**
|
|
3157
3205
|
* @fileoverview added by tsickle
|
|
@@ -3230,64 +3278,64 @@ if (false) {
|
|
|
3230
3278
|
class PlaceOutletComponent extends DisposableComponent {
|
|
3231
3279
|
/**
|
|
3232
3280
|
* @param {?} router
|
|
3281
|
+
* @param {?} placeRouter
|
|
3233
3282
|
* @param {?} placeHistory
|
|
3234
3283
|
*/
|
|
3235
|
-
constructor(router, placeHistory) {
|
|
3284
|
+
constructor(router, placeRouter, placeHistory) {
|
|
3236
3285
|
super();
|
|
3237
3286
|
this.router = router;
|
|
3287
|
+
this.placeRouter = placeRouter;
|
|
3238
3288
|
this.placeHistory = placeHistory;
|
|
3239
3289
|
this.animate = true;
|
|
3290
|
+
this.placeChanged = new EventEmitter();
|
|
3240
3291
|
this._activePlace = new MutableValueModel();
|
|
3241
|
-
this._incomingRouteChange = new Guard$1();
|
|
3242
3292
|
this._inOutletUpdate = new Guard$1();
|
|
3243
3293
|
this._activatedRouteModel = new MutableValueModel();
|
|
3244
3294
|
this._placeDefinition = new MutableValueModel();
|
|
3245
|
-
|
|
3295
|
+
/**
|
|
3296
|
+
* TODO: This is now really a visit
|
|
3297
|
+
*/
|
|
3298
|
+
this._placeVisit = new MutableValueModel();
|
|
3246
3299
|
const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
|
|
3300
|
+
// Handle incoming route changes.
|
|
3247
3301
|
/** @type {?} */
|
|
3248
|
-
const
|
|
3249
|
-
* @param {?} ar
|
|
3250
|
-
* @return {?}
|
|
3251
|
-
*/
|
|
3252
|
-
ar => ar.paramMap));
|
|
3302
|
+
const inRouteVisitUpdate = new Guard$1();
|
|
3253
3303
|
/** @type {?} */
|
|
3254
|
-
const
|
|
3255
|
-
|
|
3304
|
+
const routeVisit = chain(this._activePlace).pluck('placeDefinition').findIn(placeRouter.activeVisitIndex);
|
|
3305
|
+
when.valueOf(routeVisit).changes((/**
|
|
3306
|
+
* @param {?} visit
|
|
3256
3307
|
* @return {?}
|
|
3257
3308
|
*/
|
|
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((/**
|
|
3309
|
+
(visit) => {
|
|
3310
|
+
if (visit) {
|
|
3311
|
+
inRouteVisitUpdate.whileTrue((/**
|
|
3312
|
+
* @return {?}
|
|
3313
|
+
*/
|
|
3314
|
+
() => {
|
|
3315
|
+
this._placeVisit.value = visit;
|
|
3316
|
+
}));
|
|
3317
|
+
}
|
|
3318
|
+
}));
|
|
3319
|
+
// Handle component based changes
|
|
3320
|
+
when.valueOf(this._placeVisit).changes((/**
|
|
3277
3321
|
* @param {?} next
|
|
3278
3322
|
* @param {?} previous
|
|
3279
3323
|
* @return {?}
|
|
3280
3324
|
*/
|
|
3281
3325
|
(next, previous) => {
|
|
3282
|
-
this.
|
|
3283
|
-
this.pushChangesToRoute(next, previous);
|
|
3326
|
+
this.pushVisitChangesToRoute(next, previous);
|
|
3284
3327
|
}), {
|
|
3285
|
-
unless:
|
|
3328
|
+
unless: inRouteVisitUpdate
|
|
3286
3329
|
});
|
|
3330
|
+
chain(this._activePlace)
|
|
3331
|
+
.postponeWhile(placeRouter.navigationSessionActive)
|
|
3332
|
+
.subscribe((/**
|
|
3333
|
+
* @param {?} place
|
|
3334
|
+
* @return {?}
|
|
3335
|
+
*/
|
|
3336
|
+
place => this.placeChanged.emit(place)));
|
|
3287
3337
|
// 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);
|
|
3338
|
+
// txo.observe('inRouteVisitUpdate', inRouteVisitUpdate);
|
|
3291
3339
|
}
|
|
3292
3340
|
/**
|
|
3293
3341
|
* @return {?}
|
|
@@ -3295,15 +3343,19 @@ class PlaceOutletComponent extends DisposableComponent {
|
|
|
3295
3343
|
ngOnInit() {
|
|
3296
3344
|
}
|
|
3297
3345
|
/**
|
|
3346
|
+
* @param {?} next
|
|
3347
|
+
* @param {?} previous
|
|
3298
3348
|
* @return {?}
|
|
3299
3349
|
*/
|
|
3300
|
-
|
|
3301
|
-
|
|
3350
|
+
pushVisitChangesToRoute(next, previous) {
|
|
3351
|
+
/** @type {?} */
|
|
3352
|
+
const activatedRoute = this._activatedRouteModel.value;
|
|
3353
|
+
this.placeRouter.pushVisitChangesToRoute(activatedRoute, previous, next);
|
|
3302
3354
|
}
|
|
3303
3355
|
/**
|
|
3304
3356
|
* @return {?}
|
|
3305
3357
|
*/
|
|
3306
|
-
get
|
|
3358
|
+
get activePlaceModel() {
|
|
3307
3359
|
return this._activePlace.readonly;
|
|
3308
3360
|
}
|
|
3309
3361
|
/**
|
|
@@ -3320,7 +3372,7 @@ class PlaceOutletComponent extends DisposableComponent {
|
|
|
3320
3372
|
this._activePlace.value = place;
|
|
3321
3373
|
this._activatedRouteModel.value = routerOutlet.activatedRoute;
|
|
3322
3374
|
this._placeDefinition.value = place.placeDefinition;
|
|
3323
|
-
place.initialiseBindings(this.
|
|
3375
|
+
place.initialiseBindings(this._placeVisit);
|
|
3324
3376
|
}
|
|
3325
3377
|
catch (error) {
|
|
3326
3378
|
console.error(error);
|
|
@@ -3362,22 +3414,11 @@ class PlaceOutletComponent extends DisposableComponent {
|
|
|
3362
3414
|
}
|
|
3363
3415
|
}
|
|
3364
3416
|
/**
|
|
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
|
|
3417
|
+
* @param {?} placeDestination
|
|
3377
3418
|
* @return {?}
|
|
3378
3419
|
*/
|
|
3379
|
-
|
|
3380
|
-
|
|
3420
|
+
activate(placeDestination) {
|
|
3421
|
+
// this.router.
|
|
3381
3422
|
}
|
|
3382
3423
|
}
|
|
3383
3424
|
PlaceOutletComponent.decorators = [
|
|
@@ -3390,28 +3431,27 @@ PlaceOutletComponent.decorators = [
|
|
|
3390
3431
|
];
|
|
3391
3432
|
/** @nocollapse */
|
|
3392
3433
|
PlaceOutletComponent.ctorParameters = () => [
|
|
3434
|
+
{ type: Router },
|
|
3393
3435
|
{ type: PlaceRouter },
|
|
3394
3436
|
{ type: PlaceHistory }
|
|
3395
3437
|
];
|
|
3396
3438
|
PlaceOutletComponent.propDecorators = {
|
|
3397
3439
|
animate: [{ type: Input }],
|
|
3440
|
+
placeChanged: [{ type: Output }],
|
|
3398
3441
|
routerOut: [{ type: ViewChild, args: ['routeOutlet', { static: true },] }]
|
|
3399
3442
|
};
|
|
3400
3443
|
if (false) {
|
|
3401
3444
|
/** @type {?} */
|
|
3402
3445
|
PlaceOutletComponent.prototype.animate;
|
|
3403
3446
|
/** @type {?} */
|
|
3404
|
-
PlaceOutletComponent.prototype.
|
|
3405
|
-
/**
|
|
3406
|
-
|
|
3407
|
-
* @private
|
|
3408
|
-
*/
|
|
3409
|
-
PlaceOutletComponent.prototype._activePlace;
|
|
3447
|
+
PlaceOutletComponent.prototype.placeChanged;
|
|
3448
|
+
/** @type {?} */
|
|
3449
|
+
PlaceOutletComponent.prototype.routerOut;
|
|
3410
3450
|
/**
|
|
3411
3451
|
* @type {?}
|
|
3412
3452
|
* @private
|
|
3413
3453
|
*/
|
|
3414
|
-
PlaceOutletComponent.prototype.
|
|
3454
|
+
PlaceOutletComponent.prototype._activePlace;
|
|
3415
3455
|
/**
|
|
3416
3456
|
* @type {?}
|
|
3417
3457
|
* @private
|
|
@@ -3427,18 +3467,21 @@ if (false) {
|
|
|
3427
3467
|
* @private
|
|
3428
3468
|
*/
|
|
3429
3469
|
PlaceOutletComponent.prototype._placeDefinition;
|
|
3430
|
-
/** @type {?} */
|
|
3431
|
-
PlaceOutletComponent.prototype._resolvedParameters;
|
|
3432
3470
|
/**
|
|
3471
|
+
* TODO: This is now really a visit
|
|
3433
3472
|
* @type {?}
|
|
3434
|
-
* @private
|
|
3435
3473
|
*/
|
|
3436
|
-
PlaceOutletComponent.prototype.
|
|
3474
|
+
PlaceOutletComponent.prototype._placeVisit;
|
|
3437
3475
|
/**
|
|
3438
3476
|
* @type {?}
|
|
3439
3477
|
* @private
|
|
3440
3478
|
*/
|
|
3441
3479
|
PlaceOutletComponent.prototype.router;
|
|
3480
|
+
/**
|
|
3481
|
+
* @type {?}
|
|
3482
|
+
* @private
|
|
3483
|
+
*/
|
|
3484
|
+
PlaceOutletComponent.prototype.placeRouter;
|
|
3442
3485
|
/**
|
|
3443
3486
|
* @type {?}
|
|
3444
3487
|
* @private
|
|
@@ -3458,7 +3501,7 @@ class TabbedPlaceNavigationComponent extends AbstractPlaceNavigationComponent {
|
|
|
3458
3501
|
TabbedPlaceNavigationComponent.decorators = [
|
|
3459
3502
|
{ type: Component, args: [{
|
|
3460
3503
|
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",
|
|
3504
|
+
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
3505
|
styles: [""]
|
|
3463
3506
|
}] }
|
|
3464
3507
|
];
|
|
@@ -3516,7 +3559,8 @@ AngularUiPowerupsModule.decorators = [
|
|
|
3516
3559
|
NumberInputComponent,
|
|
3517
3560
|
StringInputComponent,
|
|
3518
3561
|
PasswordInputComponent,
|
|
3519
|
-
SelectInputComponent
|
|
3562
|
+
SelectInputComponent,
|
|
3563
|
+
NoopComponent
|
|
3520
3564
|
],
|
|
3521
3565
|
imports: [
|
|
3522
3566
|
CommonModule,
|
|
@@ -3537,7 +3581,8 @@ AngularUiPowerupsModule.decorators = [
|
|
|
3537
3581
|
PasswordInputComponent,
|
|
3538
3582
|
SelectInputComponent,
|
|
3539
3583
|
InteractionModule,
|
|
3540
|
-
PlaceModule
|
|
3584
|
+
PlaceModule,
|
|
3585
|
+
NoopComponent
|
|
3541
3586
|
]
|
|
3542
3587
|
},] }
|
|
3543
3588
|
];
|
|
@@ -3877,7 +3922,7 @@ if (false) {
|
|
|
3877
3922
|
* @fileoverview added by tsickle
|
|
3878
3923
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
3879
3924
|
*/
|
|
3880
|
-
class
|
|
3925
|
+
class InteractionGuard {
|
|
3881
3926
|
/**
|
|
3882
3927
|
* @param {?} router
|
|
3883
3928
|
* @param {?} injector
|
|
@@ -3888,6 +3933,14 @@ class CloseInteractionGuard {
|
|
|
3888
3933
|
this.injector = injector;
|
|
3889
3934
|
this.interactionContext = interactionContext;
|
|
3890
3935
|
}
|
|
3936
|
+
/**
|
|
3937
|
+
* @param {?} route
|
|
3938
|
+
* @param {?} state
|
|
3939
|
+
* @return {?}
|
|
3940
|
+
*/
|
|
3941
|
+
canActivate(route, state) {
|
|
3942
|
+
return true;
|
|
3943
|
+
}
|
|
3891
3944
|
/**
|
|
3892
3945
|
* @param {?} component
|
|
3893
3946
|
* @param {?} currentRoute
|
|
@@ -3899,34 +3952,46 @@ class CloseInteractionGuard {
|
|
|
3899
3952
|
return !this.interactionContext.isActive();
|
|
3900
3953
|
}
|
|
3901
3954
|
}
|
|
3902
|
-
|
|
3955
|
+
InteractionGuard.decorators = [
|
|
3903
3956
|
{ type: Injectable, args: [{
|
|
3904
3957
|
providedIn: 'root'
|
|
3905
3958
|
},] }
|
|
3906
3959
|
];
|
|
3907
3960
|
/** @nocollapse */
|
|
3908
|
-
|
|
3961
|
+
InteractionGuard.ctorParameters = () => [
|
|
3909
3962
|
{ type: Router },
|
|
3910
3963
|
{ type: Injector },
|
|
3911
3964
|
{ type: InteractionContext }
|
|
3912
3965
|
];
|
|
3913
|
-
/** @nocollapse */
|
|
3966
|
+
/** @nocollapse */ InteractionGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function InteractionGuard_Factory() { return new InteractionGuard(ɵɵinject(Router), ɵɵinject(INJECTOR), ɵɵinject(InteractionContext)); }, token: InteractionGuard, providedIn: "root" });
|
|
3967
|
+
__decorate([
|
|
3968
|
+
Trace(),
|
|
3969
|
+
__metadata("design:type", Function),
|
|
3970
|
+
__metadata("design:paramtypes", [ActivatedRouteSnapshot, RouterStateSnapshot]),
|
|
3971
|
+
__metadata("design:returntype", Object)
|
|
3972
|
+
], InteractionGuard.prototype, "canActivate", null);
|
|
3973
|
+
__decorate([
|
|
3974
|
+
Trace(),
|
|
3975
|
+
__metadata("design:type", Function),
|
|
3976
|
+
__metadata("design:paramtypes", [NoopComponent, ActivatedRouteSnapshot, RouterStateSnapshot, RouterStateSnapshot]),
|
|
3977
|
+
__metadata("design:returntype", Object)
|
|
3978
|
+
], InteractionGuard.prototype, "canDeactivate", null);
|
|
3914
3979
|
if (false) {
|
|
3915
3980
|
/**
|
|
3916
3981
|
* @type {?}
|
|
3917
3982
|
* @private
|
|
3918
3983
|
*/
|
|
3919
|
-
|
|
3984
|
+
InteractionGuard.prototype.router;
|
|
3920
3985
|
/**
|
|
3921
3986
|
* @type {?}
|
|
3922
3987
|
* @private
|
|
3923
3988
|
*/
|
|
3924
|
-
|
|
3989
|
+
InteractionGuard.prototype.injector;
|
|
3925
3990
|
/**
|
|
3926
3991
|
* @type {?}
|
|
3927
3992
|
* @private
|
|
3928
3993
|
*/
|
|
3929
|
-
|
|
3994
|
+
InteractionGuard.prototype.interactionContext;
|
|
3930
3995
|
}
|
|
3931
3996
|
|
|
3932
3997
|
/**
|
|
@@ -4003,26 +4068,314 @@ function Place(options) {
|
|
|
4003
4068
|
}
|
|
4004
4069
|
})(Place || (Place = {}));
|
|
4005
4070
|
|
|
4071
|
+
/**
|
|
4072
|
+
* @fileoverview added by tsickle
|
|
4073
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4074
|
+
*/
|
|
4075
|
+
// WARNING: interface has both a type and a value, skipping emit
|
|
4076
|
+
var Formatter;
|
|
4077
|
+
(function (Formatter) {
|
|
4078
|
+
class StringType {
|
|
4079
|
+
/**
|
|
4080
|
+
* @param {?} value
|
|
4081
|
+
* @return {?}
|
|
4082
|
+
*/
|
|
4083
|
+
format(value) {
|
|
4084
|
+
return value;
|
|
4085
|
+
}
|
|
4086
|
+
/**
|
|
4087
|
+
* @param {?} value
|
|
4088
|
+
* @return {?}
|
|
4089
|
+
*/
|
|
4090
|
+
parse(value) {
|
|
4091
|
+
return value;
|
|
4092
|
+
}
|
|
4093
|
+
}
|
|
4094
|
+
class NumberType {
|
|
4095
|
+
/**
|
|
4096
|
+
* @param {?} value
|
|
4097
|
+
* @return {?}
|
|
4098
|
+
*/
|
|
4099
|
+
format(value) {
|
|
4100
|
+
return ___default.isNumber(value) && !___default.isNaN(value) ? `${value}` : null;
|
|
4101
|
+
}
|
|
4102
|
+
/**
|
|
4103
|
+
* @param {?} value
|
|
4104
|
+
* @return {?}
|
|
4105
|
+
*/
|
|
4106
|
+
parse(value) {
|
|
4107
|
+
/** @type {?} */
|
|
4108
|
+
const parsed = Number.parseFloat(value);
|
|
4109
|
+
return ___default.isNaN(parsed) ? null : parsed;
|
|
4110
|
+
}
|
|
4111
|
+
}
|
|
4112
|
+
class BooleanType {
|
|
4113
|
+
/**
|
|
4114
|
+
* @param {?} value
|
|
4115
|
+
* @return {?}
|
|
4116
|
+
*/
|
|
4117
|
+
format(value) {
|
|
4118
|
+
return value ? 'true' : 'false';
|
|
4119
|
+
}
|
|
4120
|
+
/**
|
|
4121
|
+
* @param {?} value
|
|
4122
|
+
* @return {?}
|
|
4123
|
+
*/
|
|
4124
|
+
parse(value) {
|
|
4125
|
+
return value === 'true';
|
|
4126
|
+
}
|
|
4127
|
+
}
|
|
4128
|
+
Formatter.STRING = new StringType();
|
|
4129
|
+
Formatter.NUMBER = new NumberType();
|
|
4130
|
+
Formatter.BOOLEAN = new BooleanType();
|
|
4131
|
+
})(Formatter || (Formatter = {}));
|
|
4132
|
+
|
|
4133
|
+
/**
|
|
4134
|
+
* @fileoverview added by tsickle
|
|
4135
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4136
|
+
*/
|
|
4137
|
+
/**
|
|
4138
|
+
* @record
|
|
4139
|
+
*/
|
|
4140
|
+
function JsonArray() { }
|
|
4141
|
+
/**
|
|
4142
|
+
* @record
|
|
4143
|
+
*/
|
|
4144
|
+
function JsonMap() { }
|
|
4145
|
+
|
|
4146
|
+
/**
|
|
4147
|
+
* @fileoverview added by tsickle
|
|
4148
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4149
|
+
*/
|
|
4150
|
+
/**
|
|
4151
|
+
* @record
|
|
4152
|
+
* @template T
|
|
4153
|
+
*/
|
|
4154
|
+
function RouteIdOptions() { }
|
|
4155
|
+
if (false) {
|
|
4156
|
+
/** @type {?|undefined} */
|
|
4157
|
+
RouteIdOptions.prototype.as;
|
|
4158
|
+
/** @type {?|undefined} */
|
|
4159
|
+
RouteIdOptions.prototype.optional;
|
|
4160
|
+
/** @type {?|undefined} */
|
|
4161
|
+
RouteIdOptions.prototype.remember;
|
|
4162
|
+
/** @type {?|undefined} */
|
|
4163
|
+
RouteIdOptions.prototype.defaultValue;
|
|
4164
|
+
}
|
|
4165
|
+
/**
|
|
4166
|
+
* @record
|
|
4167
|
+
* @template T
|
|
4168
|
+
*/
|
|
4169
|
+
function RouteParameterOptions() { }
|
|
4170
|
+
if (false) {
|
|
4171
|
+
/** @type {?|undefined} */
|
|
4172
|
+
RouteParameterOptions.prototype.as;
|
|
4173
|
+
/** @type {?|undefined} */
|
|
4174
|
+
RouteParameterOptions.prototype.optional;
|
|
4175
|
+
/** @type {?|undefined} */
|
|
4176
|
+
RouteParameterOptions.prototype.remember;
|
|
4177
|
+
/** @type {?|undefined} */
|
|
4178
|
+
RouteParameterOptions.prototype.defaultValue;
|
|
4179
|
+
/** @type {?|undefined} */
|
|
4180
|
+
RouteParameterOptions.prototype.storeInUrl;
|
|
4181
|
+
}
|
|
4182
|
+
/**
|
|
4183
|
+
* @record
|
|
4184
|
+
* @template T
|
|
4185
|
+
*/
|
|
4186
|
+
function RouteListParameterOptions() { }
|
|
4187
|
+
if (false) {
|
|
4188
|
+
/** @type {?|undefined} */
|
|
4189
|
+
RouteListParameterOptions.prototype.as;
|
|
4190
|
+
/** @type {?|undefined} */
|
|
4191
|
+
RouteListParameterOptions.prototype.optional;
|
|
4192
|
+
/** @type {?|undefined} */
|
|
4193
|
+
RouteListParameterOptions.prototype.remember;
|
|
4194
|
+
/** @type {?|undefined} */
|
|
4195
|
+
RouteListParameterOptions.prototype.defaultValue;
|
|
4196
|
+
/** @type {?|undefined} */
|
|
4197
|
+
RouteListParameterOptions.prototype.storeInUrl;
|
|
4198
|
+
}
|
|
4199
|
+
/**
|
|
4200
|
+
* @template T
|
|
4201
|
+
* @param {?} type
|
|
4202
|
+
* @param {?=} options
|
|
4203
|
+
* @return {?}
|
|
4204
|
+
*/
|
|
4205
|
+
function RouteId(type, options) {
|
|
4206
|
+
return (/**
|
|
4207
|
+
* @param {?} prototype
|
|
4208
|
+
* @param {?} propertyKey
|
|
4209
|
+
* @return {?}
|
|
4210
|
+
*/
|
|
4211
|
+
(prototype, propertyKey) => {
|
|
4212
|
+
/** @type {?} */
|
|
4213
|
+
const param = new ParameterDefinition.RouteId(propertyKey.toString(), options, type);
|
|
4214
|
+
Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
|
|
4215
|
+
UseDelegate()(prototype, propertyKey);
|
|
4216
|
+
});
|
|
4217
|
+
}
|
|
4218
|
+
/**
|
|
4219
|
+
* @template T
|
|
4220
|
+
* @param {?=} options
|
|
4221
|
+
* @return {?}
|
|
4222
|
+
*/
|
|
4223
|
+
function VisitParameter(options) {
|
|
4224
|
+
return (/**
|
|
4225
|
+
* @param {?} prototype
|
|
4226
|
+
* @param {?} propertyKey
|
|
4227
|
+
* @return {?}
|
|
4228
|
+
*/
|
|
4229
|
+
(prototype, propertyKey) => {
|
|
4230
|
+
/** @type {?} */
|
|
4231
|
+
const param = new ParameterDefinition.ValueParameter(propertyKey.toString(), options, options.storeInUrl);
|
|
4232
|
+
Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
|
|
4233
|
+
UseDelegate()(prototype, propertyKey);
|
|
4234
|
+
});
|
|
4235
|
+
}
|
|
4236
|
+
/**
|
|
4237
|
+
* @template E
|
|
4238
|
+
* @param {?=} options
|
|
4239
|
+
* @return {?}
|
|
4240
|
+
*/
|
|
4241
|
+
function VisitParameterList(options) {
|
|
4242
|
+
return (/**
|
|
4243
|
+
* @param {?} prototype
|
|
4244
|
+
* @param {?} propertyKey
|
|
4245
|
+
* @return {?}
|
|
4246
|
+
*/
|
|
4247
|
+
(prototype, propertyKey) => {
|
|
4248
|
+
/** @type {?} */
|
|
4249
|
+
const param = new ParameterDefinition.ArrayParameter(propertyKey.toString(), options, options.storeInUrl);
|
|
4250
|
+
Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
|
|
4251
|
+
UseDelegate()(prototype, propertyKey);
|
|
4252
|
+
});
|
|
4253
|
+
}
|
|
4254
|
+
|
|
4255
|
+
/**
|
|
4256
|
+
* @fileoverview added by tsickle
|
|
4257
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4258
|
+
*/
|
|
4259
|
+
/**
|
|
4260
|
+
* @record
|
|
4261
|
+
* @template S
|
|
4262
|
+
*/
|
|
4263
|
+
function ParameterSanitiser() { }
|
|
4264
|
+
if (false) {
|
|
4265
|
+
/**
|
|
4266
|
+
* @param {?} parameterValue
|
|
4267
|
+
* @param {?=} visit
|
|
4268
|
+
* @param {?=} injector
|
|
4269
|
+
* @return {?}
|
|
4270
|
+
*/
|
|
4271
|
+
ParameterSanitiser.prototype.sanitise = function (parameterValue, visit, injector) { };
|
|
4272
|
+
}
|
|
4273
|
+
|
|
4006
4274
|
/**
|
|
4007
4275
|
* @fileoverview added by tsickle
|
|
4008
4276
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4009
4277
|
*/
|
|
4010
4278
|
/**
|
|
4011
4279
|
* @record
|
|
4280
|
+
* @template T
|
|
4012
4281
|
*/
|
|
4013
|
-
function
|
|
4282
|
+
function ParameterSnapshot() { }
|
|
4014
4283
|
if (false) {
|
|
4015
4284
|
/** @type {?} */
|
|
4016
|
-
|
|
4285
|
+
ParameterSnapshot.prototype.definition;
|
|
4286
|
+
/** @type {?} */
|
|
4287
|
+
ParameterSnapshot.prototype.value;
|
|
4017
4288
|
/**
|
|
4018
4289
|
* @return {?}
|
|
4019
4290
|
*/
|
|
4020
|
-
|
|
4291
|
+
ParameterSnapshot.prototype.isMissing = function () { };
|
|
4292
|
+
}
|
|
4293
|
+
|
|
4294
|
+
/**
|
|
4295
|
+
* @fileoverview added by tsickle
|
|
4296
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4297
|
+
*/
|
|
4298
|
+
class VisitSanitiser {
|
|
4299
|
+
/**
|
|
4300
|
+
* @param {?} activatedRoute
|
|
4301
|
+
* @param {?} router
|
|
4302
|
+
* @param {?} placeHistory
|
|
4303
|
+
* @param {?} injector
|
|
4304
|
+
*/
|
|
4305
|
+
constructor(activatedRoute, router, placeHistory, injector) {
|
|
4306
|
+
this.activatedRoute = activatedRoute;
|
|
4307
|
+
this.router = router;
|
|
4308
|
+
this.placeHistory = placeHistory;
|
|
4309
|
+
this.injector = injector;
|
|
4310
|
+
}
|
|
4311
|
+
// @Trace()
|
|
4021
4312
|
/**
|
|
4022
|
-
* @param {?}
|
|
4313
|
+
* @param {?} visit
|
|
4023
4314
|
* @return {?}
|
|
4024
4315
|
*/
|
|
4025
|
-
|
|
4316
|
+
sanitise(visit) {
|
|
4317
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4318
|
+
/** @type {?} */
|
|
4319
|
+
const placeDef = visit.placeDefinition;
|
|
4320
|
+
if (placeDef.hasRouteId()) {
|
|
4321
|
+
/** @type {?} */
|
|
4322
|
+
const routeIdDef = placeDef.getRouteIdParameterDef();
|
|
4323
|
+
/** @type {?} */
|
|
4324
|
+
const routeId = visit.getRouteId();
|
|
4325
|
+
/** @type {?} */
|
|
4326
|
+
const sanitisedValue = yield routeIdDef.sanitise(routeId, visit, this.placeHistory, this.injector);
|
|
4327
|
+
console.log({ routeId, sanitisedValue });
|
|
4328
|
+
// ###------- EARLY EXIT --------###
|
|
4329
|
+
if (routeIdDef.hasChanged(routeId, sanitisedValue)) {
|
|
4330
|
+
// if the route id has changed we redirect immediately as other
|
|
4331
|
+
// parameter sanitisers might use it.
|
|
4332
|
+
return visit.replace(routeIdDef, sanitisedValue);
|
|
4333
|
+
}
|
|
4334
|
+
}
|
|
4335
|
+
// if we didn't replace the routeId we continue the url present parameters.
|
|
4336
|
+
/** @type {?} */
|
|
4337
|
+
const parameterDefs = placeDef.getVisitParameterDefs({
|
|
4338
|
+
includeRouteParameters: true,
|
|
4339
|
+
includeNonRouteParameters: true
|
|
4340
|
+
});
|
|
4341
|
+
/** @type {?} */
|
|
4342
|
+
let sanitisedVisit = visit;
|
|
4343
|
+
for (let i = 0; i < parameterDefs.length; i++) {
|
|
4344
|
+
/** @type {?} */
|
|
4345
|
+
const def = parameterDefs[i];
|
|
4346
|
+
/** @type {?} */
|
|
4347
|
+
const value = visit.getParameter(def.name);
|
|
4348
|
+
/** @type {?} */
|
|
4349
|
+
const sanitisedValue = yield def.sanitise(value, sanitisedVisit, this.placeHistory, this.injector);
|
|
4350
|
+
if (def.hasChanged(value, sanitisedValue)) {
|
|
4351
|
+
sanitisedVisit = sanitisedVisit.replace(def, sanitisedValue);
|
|
4352
|
+
}
|
|
4353
|
+
}
|
|
4354
|
+
return sanitisedVisit.hasChangedFrom(visit) ? sanitisedVisit : visit;
|
|
4355
|
+
});
|
|
4356
|
+
}
|
|
4357
|
+
}
|
|
4358
|
+
if (false) {
|
|
4359
|
+
/**
|
|
4360
|
+
* @type {?}
|
|
4361
|
+
* @private
|
|
4362
|
+
*/
|
|
4363
|
+
VisitSanitiser.prototype.activatedRoute;
|
|
4364
|
+
/**
|
|
4365
|
+
* @type {?}
|
|
4366
|
+
* @private
|
|
4367
|
+
*/
|
|
4368
|
+
VisitSanitiser.prototype.router;
|
|
4369
|
+
/**
|
|
4370
|
+
* @type {?}
|
|
4371
|
+
* @private
|
|
4372
|
+
*/
|
|
4373
|
+
VisitSanitiser.prototype.placeHistory;
|
|
4374
|
+
/**
|
|
4375
|
+
* @type {?}
|
|
4376
|
+
* @private
|
|
4377
|
+
*/
|
|
4378
|
+
VisitSanitiser.prototype.injector;
|
|
4026
4379
|
}
|
|
4027
4380
|
|
|
4028
4381
|
/**
|
|
@@ -4108,6 +4461,7 @@ class LeavePlaceGuard {
|
|
|
4108
4461
|
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
4109
4462
|
// nextStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c"
|
|
4110
4463
|
// }
|
|
4464
|
+
// TODO: Add tests
|
|
4111
4465
|
if (this.placeRouter.navigationSession.alreadyAccepted(component)) {
|
|
4112
4466
|
// We'll get called multiple times if there's any parameter sanitisation so
|
|
4113
4467
|
// we always return true if we accepted on a previous cycle of the current
|
|
@@ -4122,9 +4476,10 @@ class LeavePlaceGuard {
|
|
|
4122
4476
|
if (this.isLeavingTheCurrentPlace(nextState, placeDefinitionPath)) {
|
|
4123
4477
|
// we check the interaction first, so that components that don't need to check if they're in an
|
|
4124
4478
|
// interaction during the canDeactivate cycle.
|
|
4479
|
+
// TODO: Add tests: show dialog -> hit back -> same route
|
|
4125
4480
|
if (this.interactionContext.isActive()) {
|
|
4126
4481
|
canLeave = false;
|
|
4127
|
-
console.log(
|
|
4482
|
+
console.log('cancelling', { activity: this.interactionContext.currentActivity });
|
|
4128
4483
|
this.interactionContext.currentActivity.cancel(null);
|
|
4129
4484
|
}
|
|
4130
4485
|
// No interaction in progress, so ask the component .
|
|
@@ -4132,13 +4487,18 @@ class LeavePlaceGuard {
|
|
|
4132
4487
|
// the user clicks back again, we'll re-enter here and go bang when the component tries to open another
|
|
4133
4488
|
// dialog.
|
|
4134
4489
|
if (canLeave) {
|
|
4490
|
+
// TODO: Add tests: hit back -> confirm leave dialog -> hit back -> close dialog -> hit back -> confirm leave dialog.
|
|
4135
4491
|
canLeave = yield component.canDeactivate();
|
|
4136
4492
|
}
|
|
4493
|
+
// We also block back button parameter changes while the dialog is open.
|
|
4494
|
+
// NOTE: Now that I'm catching parameter changes I could possibly retry using a fragment or
|
|
4495
|
+
// query parameter to track the dialog being open. Previously I was just checking this on
|
|
4496
|
+
// path changes... if that worked it'd fix the case where the back button breaks with an activity
|
|
4497
|
+
// open on the first page: https://coolon.atlassian.net/browse/AUP-33
|
|
4137
4498
|
}
|
|
4138
4499
|
else {
|
|
4139
|
-
// this is a parameter change.
|
|
4140
4500
|
if (this.interactionContext.isActive()) {
|
|
4141
|
-
console.log(
|
|
4501
|
+
console.log('cancelling', { activity: this.interactionContext.currentActivity });
|
|
4142
4502
|
this.interactionContext.currentActivity.cancel(null);
|
|
4143
4503
|
canLeave = false;
|
|
4144
4504
|
}
|
|
@@ -4148,7 +4508,7 @@ class LeavePlaceGuard {
|
|
|
4148
4508
|
}
|
|
4149
4509
|
if (canLeave) {
|
|
4150
4510
|
// We'll get called multiple times if there's any parameter sanitisation so
|
|
4151
|
-
// we remember the acceptance for the duration of the current
|
|
4511
|
+
// we remember the acceptance for the duration of the current navigation session.
|
|
4152
4512
|
self.placeRouter.navigationSession.rememberAcceptanceOf(component);
|
|
4153
4513
|
}
|
|
4154
4514
|
else {
|
|
@@ -4156,7 +4516,7 @@ class LeavePlaceGuard {
|
|
|
4156
4516
|
// See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
4157
4517
|
if (this.placeRouter.navigationSession.isPopState) {
|
|
4158
4518
|
console.log('cancelled during popstate');
|
|
4159
|
-
this.angularLocation.go(this.placeRouter.navigationSession.
|
|
4519
|
+
this.angularLocation.go(this.placeRouter.navigationSession.popStateReturnUrl);
|
|
4160
4520
|
}
|
|
4161
4521
|
}
|
|
4162
4522
|
return canLeave;
|
|
@@ -4177,13 +4537,7 @@ LeavePlaceGuard.ctorParameters = () => [
|
|
|
4177
4537
|
{ type: InteractionContext },
|
|
4178
4538
|
{ type: Location }
|
|
4179
4539
|
];
|
|
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);
|
|
4540
|
+
/** @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
4541
|
if (false) {
|
|
4188
4542
|
/**
|
|
4189
4543
|
* @type {?}
|
|
@@ -4212,41 +4566,62 @@ if (false) {
|
|
|
4212
4566
|
*/
|
|
4213
4567
|
class PlaceRouteGuard {
|
|
4214
4568
|
/**
|
|
4569
|
+
* @param {?} router
|
|
4215
4570
|
* @param {?} placeRouter
|
|
4571
|
+
* @param {?} placeHistory
|
|
4216
4572
|
* @param {?} injector
|
|
4217
4573
|
*/
|
|
4218
|
-
constructor(placeRouter, injector) {
|
|
4574
|
+
constructor(router, placeRouter, placeHistory, injector) {
|
|
4575
|
+
this.router = router;
|
|
4219
4576
|
this.placeRouter = placeRouter;
|
|
4577
|
+
this.placeHistory = placeHistory;
|
|
4220
4578
|
this.injector = injector;
|
|
4221
4579
|
}
|
|
4580
|
+
// @Trace()
|
|
4222
4581
|
/**
|
|
4223
4582
|
* @param {?} activatedRoute
|
|
4224
4583
|
* @param {?} state
|
|
4225
4584
|
* @return {?}
|
|
4226
4585
|
*/
|
|
4227
4586
|
canActivate(activatedRoute, state) {
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4587
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4588
|
+
if (PlaceComponent.isPlaceComponentConstructor(activatedRoute.component)) {
|
|
4589
|
+
/** @type {?} */
|
|
4590
|
+
const placeDefinition = PlaceComponent.getDefinition(activatedRoute.component);
|
|
4591
|
+
// Parse our route params.
|
|
4592
|
+
/** @type {?} */
|
|
4593
|
+
const params = new PlaceRouteGuard.ConsolidatedParameterMap(activatedRoute.paramMap, activatedRoute.url);
|
|
4594
|
+
/** @type {?} */
|
|
4595
|
+
const parsedParams = placeDefinition.parseRouteParams(params);
|
|
4596
|
+
/** @type {?} */
|
|
4597
|
+
const initialVisit = this.placeRouter.navigationSession.getVisitFor(placeDefinition) || new Visit(placeDefinition, parsedParams);
|
|
4598
|
+
/** @type {?} */
|
|
4599
|
+
const sanitiser = new VisitSanitiser(activatedRoute, this.router, this.placeHistory, this.injector);
|
|
4600
|
+
/** @type {?} */
|
|
4601
|
+
const updatedVisit = yield sanitiser.sanitise(initialVisit.mergeRouteParameters(parsedParams));
|
|
4602
|
+
// Save the visit with any updated parameters. We need to save it so we remember any non route parameters
|
|
4603
|
+
this.placeRouter.navigationSession.storeVisit(updatedVisit);
|
|
4604
|
+
if (initialVisit.hasRoutingChangedFrom(updatedVisit)) {
|
|
4605
|
+
/** @type {?} */
|
|
4606
|
+
const parameterCommands = updatedVisit.hasRouteId() ?
|
|
4607
|
+
[placeDefinition.getFormattedRouteId(updatedVisit), placeDefinition.getFormattedRouteParameters(updatedVisit)] :
|
|
4608
|
+
[placeDefinition.getFormattedRouteParameters(updatedVisit)];
|
|
4609
|
+
/** @type {?} */
|
|
4610
|
+
const commands = [(activatedRoute.url[0].path)].concat(parameterCommands, this.placeRouter.getChildPath(activatedRoute));
|
|
4611
|
+
console.log('##### Redirect', commands);
|
|
4612
|
+
return this.router.createUrlTree(commands, {
|
|
4613
|
+
replaceUrl: true,
|
|
4614
|
+
skipLocationChange: false
|
|
4615
|
+
});
|
|
4241
4616
|
}
|
|
4242
4617
|
else {
|
|
4243
4618
|
return true;
|
|
4244
4619
|
}
|
|
4245
|
-
}
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
}
|
|
4620
|
+
}
|
|
4621
|
+
else {
|
|
4622
|
+
return lang.illegalState(`expected component to be an instance of PlaceComponent, got ${activatedRoute.component}`);
|
|
4623
|
+
}
|
|
4624
|
+
});
|
|
4250
4625
|
}
|
|
4251
4626
|
}
|
|
4252
4627
|
PlaceRouteGuard.decorators = [
|
|
@@ -4256,205 +4631,163 @@ PlaceRouteGuard.decorators = [
|
|
|
4256
4631
|
];
|
|
4257
4632
|
/** @nocollapse */
|
|
4258
4633
|
PlaceRouteGuard.ctorParameters = () => [
|
|
4634
|
+
{ type: Router },
|
|
4259
4635
|
{ type: PlaceRouter },
|
|
4636
|
+
{ type: PlaceHistory },
|
|
4260
4637
|
{ type: Injector }
|
|
4261
4638
|
];
|
|
4262
|
-
/** @nocollapse */ PlaceRouteGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceRouteGuard_Factory() { return new PlaceRouteGuard(ɵɵinject(PlaceRouter), ɵɵinject(INJECTOR)); }, token: PlaceRouteGuard, providedIn: "root" });
|
|
4639
|
+
/** @nocollapse */ PlaceRouteGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceRouteGuard_Factory() { return new PlaceRouteGuard(ɵɵinject(Router), ɵɵinject(PlaceRouter), ɵɵinject(PlaceHistory), ɵɵinject(INJECTOR)); }, token: PlaceRouteGuard, providedIn: "root" });
|
|
4263
4640
|
if (false) {
|
|
4264
4641
|
/**
|
|
4265
4642
|
* @type {?}
|
|
4266
4643
|
* @private
|
|
4267
4644
|
*/
|
|
4268
|
-
PlaceRouteGuard.prototype.
|
|
4645
|
+
PlaceRouteGuard.prototype.router;
|
|
4269
4646
|
/**
|
|
4270
4647
|
* @type {?}
|
|
4271
4648
|
* @private
|
|
4272
4649
|
*/
|
|
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 {?}
|
|
4650
|
+
PlaceRouteGuard.prototype.placeRouter;
|
|
4651
|
+
/**
|
|
4652
|
+
* @type {?}
|
|
4653
|
+
* @private
|
|
4353
4654
|
*/
|
|
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 {?}
|
|
4655
|
+
PlaceRouteGuard.prototype.placeHistory;
|
|
4656
|
+
/**
|
|
4657
|
+
* @type {?}
|
|
4658
|
+
* @private
|
|
4372
4659
|
*/
|
|
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
|
-
});
|
|
4660
|
+
PlaceRouteGuard.prototype.injector;
|
|
4379
4661
|
}
|
|
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) {
|
|
4662
|
+
(function (PlaceRouteGuard) {
|
|
4391
4663
|
/**
|
|
4392
|
-
*
|
|
4393
|
-
*
|
|
4394
|
-
*
|
|
4664
|
+
* This a work around for the fact that an activated route with multiple segments doesn't
|
|
4665
|
+
* include the segment params in the paramMap as well as each segment returns an empty
|
|
4666
|
+
* param map even when `parameter`s has content.
|
|
4395
4667
|
*/
|
|
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 {
|
|
4668
|
+
class ConsolidatedParameterMap {
|
|
4407
4669
|
/**
|
|
4408
|
-
* @param {?}
|
|
4670
|
+
* @param {?} paramMap
|
|
4671
|
+
* @param {?} urlSegments
|
|
4672
|
+
*/
|
|
4673
|
+
constructor(paramMap, urlSegments) {
|
|
4674
|
+
this.paramMaps = [paramMap].concat((urlSegments || []).map((/**
|
|
4675
|
+
* @param {?} s
|
|
4676
|
+
* @return {?}
|
|
4677
|
+
*/
|
|
4678
|
+
s => new ParamMapAdapter(s.parameters)))).filter((/**
|
|
4679
|
+
* @param {?} m
|
|
4680
|
+
* @return {?}
|
|
4681
|
+
*/
|
|
4682
|
+
m => !!m)); // the activated route param map can be null
|
|
4683
|
+
}
|
|
4684
|
+
/**
|
|
4685
|
+
* @param {?} name
|
|
4409
4686
|
* @return {?}
|
|
4410
4687
|
*/
|
|
4411
|
-
|
|
4412
|
-
|
|
4688
|
+
get(name) {
|
|
4689
|
+
/** @type {?} */
|
|
4690
|
+
const paramMap = this.paramMaps.find((/**
|
|
4691
|
+
* @param {?} m
|
|
4692
|
+
* @return {?}
|
|
4693
|
+
*/
|
|
4694
|
+
m => m.has(name)));
|
|
4695
|
+
return paramMap.get(name);
|
|
4413
4696
|
}
|
|
4414
4697
|
/**
|
|
4415
|
-
* @param {?}
|
|
4698
|
+
* @param {?} name
|
|
4416
4699
|
* @return {?}
|
|
4417
4700
|
*/
|
|
4418
|
-
|
|
4419
|
-
|
|
4701
|
+
getAll(name) {
|
|
4702
|
+
/** @type {?} */
|
|
4703
|
+
const paramMap = this.paramMaps.find((/**
|
|
4704
|
+
* @param {?} m
|
|
4705
|
+
* @return {?}
|
|
4706
|
+
*/
|
|
4707
|
+
m => m.has(name)));
|
|
4708
|
+
return paramMap.getAll(name);
|
|
4420
4709
|
}
|
|
4421
|
-
}
|
|
4422
|
-
class NumberType {
|
|
4423
4710
|
/**
|
|
4424
|
-
* @param {?}
|
|
4711
|
+
* @param {?} name
|
|
4425
4712
|
* @return {?}
|
|
4426
4713
|
*/
|
|
4427
|
-
|
|
4428
|
-
return
|
|
4714
|
+
has(name) {
|
|
4715
|
+
return !!this.paramMaps.find((/**
|
|
4716
|
+
* @param {?} m
|
|
4717
|
+
* @return {?}
|
|
4718
|
+
*/
|
|
4719
|
+
m => m.has(name)));
|
|
4429
4720
|
}
|
|
4430
4721
|
/**
|
|
4431
|
-
* @param {?} value
|
|
4432
4722
|
* @return {?}
|
|
4433
4723
|
*/
|
|
4434
|
-
|
|
4435
|
-
return
|
|
4724
|
+
get keys() {
|
|
4725
|
+
return this.paramMaps.reduce((/**
|
|
4726
|
+
* @param {?} result
|
|
4727
|
+
* @param {?} params
|
|
4728
|
+
* @return {?}
|
|
4729
|
+
*/
|
|
4730
|
+
(result, params) => result.concat(params.keys)), []);
|
|
4436
4731
|
}
|
|
4437
4732
|
}
|
|
4438
|
-
|
|
4733
|
+
__decorate([
|
|
4734
|
+
Memoize(),
|
|
4735
|
+
__metadata("design:type", Array),
|
|
4736
|
+
__metadata("design:paramtypes", [])
|
|
4737
|
+
], ConsolidatedParameterMap.prototype, "keys", null);
|
|
4738
|
+
PlaceRouteGuard.ConsolidatedParameterMap = ConsolidatedParameterMap;
|
|
4739
|
+
if (false) {
|
|
4439
4740
|
/**
|
|
4440
|
-
* @
|
|
4741
|
+
* @type {?}
|
|
4742
|
+
* @private
|
|
4743
|
+
*/
|
|
4744
|
+
ConsolidatedParameterMap.prototype.paramMaps;
|
|
4745
|
+
}
|
|
4746
|
+
class ParamMapAdapter {
|
|
4747
|
+
/**
|
|
4748
|
+
* @param {?} params
|
|
4749
|
+
*/
|
|
4750
|
+
constructor(params) {
|
|
4751
|
+
this.params = params;
|
|
4752
|
+
}
|
|
4753
|
+
/**
|
|
4754
|
+
* @param {?} name
|
|
4441
4755
|
* @return {?}
|
|
4442
4756
|
*/
|
|
4443
|
-
|
|
4444
|
-
return
|
|
4757
|
+
get(name) {
|
|
4758
|
+
return this.params[name];
|
|
4445
4759
|
}
|
|
4446
4760
|
/**
|
|
4447
|
-
* @param {?}
|
|
4761
|
+
* @param {?} name
|
|
4448
4762
|
* @return {?}
|
|
4449
4763
|
*/
|
|
4450
|
-
|
|
4451
|
-
|
|
4764
|
+
getAll(name) {
|
|
4765
|
+
/** @type {?} */
|
|
4766
|
+
const value = this.get(name);
|
|
4767
|
+
return Array.isArray(value) ? value : [value];
|
|
4768
|
+
}
|
|
4769
|
+
/**
|
|
4770
|
+
* @param {?} name
|
|
4771
|
+
* @return {?}
|
|
4772
|
+
*/
|
|
4773
|
+
has(name) {
|
|
4774
|
+
return this.keys.includes(name);
|
|
4775
|
+
}
|
|
4776
|
+
/**
|
|
4777
|
+
* @return {?}
|
|
4778
|
+
*/
|
|
4779
|
+
get keys() {
|
|
4780
|
+
return Object.keys(this.params);
|
|
4452
4781
|
}
|
|
4453
4782
|
}
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4783
|
+
if (false) {
|
|
4784
|
+
/**
|
|
4785
|
+
* @type {?}
|
|
4786
|
+
* @private
|
|
4787
|
+
*/
|
|
4788
|
+
ParamMapAdapter.prototype.params;
|
|
4789
|
+
}
|
|
4790
|
+
})(PlaceRouteGuard || (PlaceRouteGuard = {}));
|
|
4458
4791
|
|
|
4459
4792
|
/**
|
|
4460
4793
|
* @fileoverview added by tsickle
|
|
@@ -4476,5 +4809,5 @@ var ParameterType;
|
|
|
4476
4809
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4477
4810
|
*/
|
|
4478
4811
|
|
|
4479
|
-
export { ACTIVITY_DATA, AbstractActivity, AbstractInputComponent, AbstractPlaceNavigationComponent, Activity, ActivityContainerComponent, ActivityOutletComponent, AlertDialogComponent, AngularUiPowerupsModule, Bounds, BusyOverlayComponent,
|
|
4812
|
+
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
4813
|
//# sourceMappingURL=coolon-angular-ui-powerups.js.map
|