@coolon/angular-ui-powerups 0.0.66 → 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 +2207 -1737
- 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 +186 -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 +242 -107
- 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 +1493 -1124
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +2166 -1700
- 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 +26 -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 +4 -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 -159
- 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 -117
- 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 } from '@coolon/pectin';
|
|
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,952 +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._navigationSession = new MutableValueModel();
|
|
2251
|
-
angularLocation.onUrlChange((/**
|
|
2252
|
-
* @param {?} url
|
|
2253
|
-
* @return {?}
|
|
2254
|
-
*/
|
|
2255
|
-
url => {
|
|
2256
|
-
console.log(`### ${url}`);
|
|
2257
|
-
}));
|
|
2258
|
-
this.router.events.subscribe((/**
|
|
2259
|
-
* @param {?} event
|
|
2260
|
-
* @return {?}
|
|
2261
|
-
*/
|
|
2262
|
-
event => {
|
|
2263
|
-
// console.log(`${event.constructor.name}`, location.pathname, angularLocation.getState());
|
|
2264
|
-
// NavigationStart -> .... -> NavigationCancel === redirect (so don't ask again)
|
|
2265
|
-
// NavigationStart -> .... -> NavigationEnd === navigated (so ask next time)
|
|
2266
|
-
// NavigationStart -> .... -> NavigationError === canceled (guard cancelled so ask next time)
|
|
2267
|
-
if (event instanceof NavigationStart && !this.navigationSession) {
|
|
2268
|
-
this._navigationSession.value = new NavigationSession(event.navigationTrigger === 'popstate', this.router.routerState.snapshot.url);
|
|
2269
|
-
}
|
|
2270
|
-
if (event instanceof NavigationEnd) {
|
|
2271
|
-
console.log('navigation ended');
|
|
2272
|
-
this._navigationSession.value = null;
|
|
2273
|
-
}
|
|
2274
|
-
if (event instanceof NavigationError) {
|
|
2275
|
-
console.log('navigation errored');
|
|
2276
|
-
this._navigationSession.value = null;
|
|
2277
|
-
}
|
|
2278
|
-
}));
|
|
2725
|
+
alreadyAccepted(placeComponent) {
|
|
2726
|
+
return this._alreadyAccepted.includes(placeComponent);
|
|
2279
2727
|
}
|
|
2728
|
+
// @Trace()
|
|
2280
2729
|
/**
|
|
2730
|
+
* @param {?} component
|
|
2281
2731
|
* @return {?}
|
|
2282
2732
|
*/
|
|
2283
|
-
|
|
2284
|
-
|
|
2733
|
+
rememberAcceptanceOf(component) {
|
|
2734
|
+
this._alreadyAccepted.push(component);
|
|
2285
2735
|
}
|
|
2286
2736
|
/**
|
|
2287
|
-
* @param {?}
|
|
2288
|
-
* @param {?} previous
|
|
2289
|
-
* @param {?} next
|
|
2737
|
+
* @param {?} url
|
|
2290
2738
|
* @return {?}
|
|
2291
2739
|
*/
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
const relativePath = !!previous.hasRouteId() ? '..' : '.';
|
|
2295
|
-
this.router.navigate([relativePath].concat(this.createRouteParameters(next), this.getChildPath(activatedRoute.snapshot)), {
|
|
2296
|
-
relativeTo: activatedRoute
|
|
2297
|
-
});
|
|
2740
|
+
setPopstateReturn(url) {
|
|
2741
|
+
this._popStateReturnUrl = url;
|
|
2298
2742
|
}
|
|
2299
|
-
// @Trace()
|
|
2300
2743
|
/**
|
|
2301
|
-
* @param {?} activatedRoute
|
|
2302
|
-
* @param {?} sanitised
|
|
2303
2744
|
* @return {?}
|
|
2304
2745
|
*/
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
const urlSegments = activatedRoute.url;
|
|
2308
|
-
/** @type {?} */
|
|
2309
|
-
const weHaveARouteId = sanitised.hasRouteId() && sanitised.getFormattedRouteId();
|
|
2310
|
-
/** @type {?} */
|
|
2311
|
-
const commands = (weHaveARouteId) ?
|
|
2312
|
-
[urlSegments[0].path, sanitised.getFormattedRouteId(), sanitised.getFormattedParameters()] :
|
|
2313
|
-
[urlSegments[0].path, sanitised.getFormattedParameters()];
|
|
2314
|
-
return this.router.createUrlTree(commands);
|
|
2746
|
+
get isPopState() {
|
|
2747
|
+
return !!this._popStateReturnUrl;
|
|
2315
2748
|
}
|
|
2316
2749
|
/**
|
|
2317
|
-
* @protected
|
|
2318
|
-
* @param {?} activatedRoute
|
|
2319
2750
|
* @return {?}
|
|
2320
2751
|
*/
|
|
2321
|
-
|
|
2322
|
-
return
|
|
2323
|
-
* @param {?} child
|
|
2324
|
-
* @return {?}
|
|
2325
|
-
*/
|
|
2326
|
-
child => child.url)));
|
|
2752
|
+
get popStateReturnUrl() {
|
|
2753
|
+
return this._popStateReturnUrl;
|
|
2327
2754
|
}
|
|
2328
2755
|
/**
|
|
2329
|
-
* @protected
|
|
2330
|
-
* @param {?} parameters
|
|
2331
2756
|
* @return {?}
|
|
2332
2757
|
*/
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
const routeId = parameters.getFormattedRouteId();
|
|
2336
|
-
return routeId ?
|
|
2337
|
-
[routeId, parameters.getFormattedParameters()] :
|
|
2338
|
-
[parameters.getFormattedParameters()];
|
|
2758
|
+
getVisits() {
|
|
2759
|
+
return Array.from(this._visits.values());
|
|
2339
2760
|
}
|
|
2340
2761
|
}
|
|
2341
|
-
PlaceRouter.decorators = [
|
|
2342
|
-
{ type: Injectable, args: [{
|
|
2343
|
-
providedIn: 'root'
|
|
2344
|
-
},] }
|
|
2345
|
-
];
|
|
2346
|
-
/** @nocollapse */
|
|
2347
|
-
PlaceRouter.ctorParameters = () => [
|
|
2348
|
-
{ type: Router },
|
|
2349
|
-
{ type: Location }
|
|
2350
|
-
];
|
|
2351
|
-
/** @nocollapse */ PlaceRouter.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(ɵɵinject(Router), ɵɵinject(Location)); }, token: PlaceRouter, providedIn: "root" });
|
|
2352
2762
|
if (false) {
|
|
2353
2763
|
/**
|
|
2354
2764
|
* @type {?}
|
|
2355
2765
|
* @private
|
|
2356
2766
|
*/
|
|
2357
|
-
|
|
2767
|
+
NavigationSession.prototype._alreadyAccepted;
|
|
2358
2768
|
/**
|
|
2359
2769
|
* @type {?}
|
|
2360
2770
|
* @private
|
|
2361
2771
|
*/
|
|
2362
|
-
|
|
2772
|
+
NavigationSession.prototype._visits;
|
|
2773
|
+
/**
|
|
2774
|
+
* @type {?}
|
|
2775
|
+
* @private
|
|
2776
|
+
*/
|
|
2777
|
+
NavigationSession.prototype._popStateReturnUrl;
|
|
2778
|
+
/** @type {?} */
|
|
2779
|
+
NavigationSession.prototype.isExternal;
|
|
2780
|
+
/** @type {?} */
|
|
2781
|
+
NavigationSession.prototype.firstNavigation;
|
|
2363
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 = {}));
|
|
2364
2828
|
|
|
2365
2829
|
/**
|
|
2366
2830
|
* @fileoverview added by tsickle
|
|
2367
2831
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2368
2832
|
*/
|
|
2369
2833
|
/**
|
|
2370
|
-
* @
|
|
2371
|
-
* @template T, S
|
|
2834
|
+
* @record
|
|
2372
2835
|
*/
|
|
2373
|
-
|
|
2836
|
+
function Params() { }
|
|
2837
|
+
class Visit {
|
|
2374
2838
|
/**
|
|
2375
|
-
* @param {?}
|
|
2376
|
-
* @param {
|
|
2377
|
-
* @param {?} options
|
|
2839
|
+
* @param {?} placeDefinition
|
|
2840
|
+
* @param {?=} visitParameters
|
|
2378
2841
|
*/
|
|
2379
|
-
constructor(
|
|
2380
|
-
this.
|
|
2381
|
-
this.
|
|
2382
|
-
/** @type {?} */
|
|
2383
|
-
const opts = Opts.get(options);
|
|
2384
|
-
this.name = opts.getOptional('as', propertyName);
|
|
2385
|
-
this.remember = opts.getOptional('remember', false);
|
|
2386
|
-
this.defaultValue = opts.getOptional('defaultValue', null);
|
|
2842
|
+
constructor(placeDefinition, visitParameters = {}) {
|
|
2843
|
+
this.placeDefinition = placeDefinition;
|
|
2844
|
+
this.visitParameters = visitParameters;
|
|
2387
2845
|
}
|
|
2846
|
+
// @Trace()
|
|
2388
2847
|
/**
|
|
2389
|
-
* @param {?} injector
|
|
2390
2848
|
* @return {?}
|
|
2391
2849
|
*/
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
return new ParameterDefinition.DefaultParameterSanitiser(this.remember, this.defaultValue, injector.get(PlaceHistory));
|
|
2395
|
-
}
|
|
2396
|
-
else {
|
|
2397
|
-
return null;
|
|
2398
|
-
}
|
|
2850
|
+
getRouteId() {
|
|
2851
|
+
return this.placeDefinition.getRouteIdFrom(this);
|
|
2399
2852
|
}
|
|
2400
|
-
|
|
2401
|
-
if (false) {
|
|
2402
|
-
/** @type {?} */
|
|
2403
|
-
ParameterDefinition.prototype.isRouteId;
|
|
2404
|
-
/** @type {?} */
|
|
2405
|
-
ParameterDefinition.prototype.isArray;
|
|
2406
|
-
/** @type {?} */
|
|
2407
|
-
ParameterDefinition.prototype.name;
|
|
2853
|
+
// @Trace()
|
|
2408
2854
|
/**
|
|
2409
|
-
* @
|
|
2410
|
-
* @private
|
|
2855
|
+
* @return {?}
|
|
2411
2856
|
*/
|
|
2412
|
-
|
|
2857
|
+
hasRouteId() {
|
|
2858
|
+
return !isNil(this.getRouteId());
|
|
2859
|
+
}
|
|
2413
2860
|
/**
|
|
2414
|
-
*
|
|
2415
|
-
*
|
|
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 {?}
|
|
2416
2866
|
*/
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
ParameterDefinition.prototype.type;
|
|
2422
|
-
}
|
|
2423
|
-
(function (ParameterDefinition) {
|
|
2867
|
+
getParameter(parameterName) {
|
|
2868
|
+
return this.visitParameters[parameterName];
|
|
2869
|
+
}
|
|
2870
|
+
// @Trace()
|
|
2424
2871
|
/**
|
|
2425
|
-
* @
|
|
2426
|
-
* @
|
|
2872
|
+
* @param {?} parameterName
|
|
2873
|
+
* @return {?}
|
|
2427
2874
|
*/
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
if (false) {
|
|
2431
|
-
/** @type {?|undefined} */
|
|
2432
|
-
Options.prototype.as;
|
|
2433
|
-
/** @type {?|undefined} */
|
|
2434
|
-
Options.prototype.optional;
|
|
2435
|
-
/** @type {?|undefined} */
|
|
2436
|
-
Options.prototype.remember;
|
|
2437
|
-
/** @type {?|undefined} */
|
|
2438
|
-
Options.prototype.defaultValue;
|
|
2439
|
-
}
|
|
2440
|
-
/**
|
|
2441
|
-
* @template T
|
|
2442
|
-
*/
|
|
2443
|
-
class RouteId extends ParameterDefinition {
|
|
2444
|
-
constructor() {
|
|
2445
|
-
super(...arguments);
|
|
2446
|
-
this.isRouteId = true;
|
|
2447
|
-
this.isArray = false;
|
|
2448
|
-
}
|
|
2449
|
-
}
|
|
2450
|
-
ParameterDefinition.RouteId = RouteId;
|
|
2451
|
-
if (false) {
|
|
2452
|
-
/** @type {?} */
|
|
2453
|
-
RouteId.prototype.isRouteId;
|
|
2454
|
-
/** @type {?} */
|
|
2455
|
-
RouteId.prototype.isArray;
|
|
2875
|
+
hasParameter(parameterName) {
|
|
2876
|
+
return Object.keys(this.visitParameters).includes(parameterName);
|
|
2456
2877
|
}
|
|
2457
2878
|
/**
|
|
2458
|
-
* @template
|
|
2879
|
+
* @template S
|
|
2880
|
+
* @param {?} parameter
|
|
2881
|
+
* @param {?} value
|
|
2882
|
+
* @return {?}
|
|
2459
2883
|
*/
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
super(...arguments);
|
|
2463
|
-
this.isRouteId = false;
|
|
2464
|
-
this.isArray = false;
|
|
2465
|
-
}
|
|
2466
|
-
}
|
|
2467
|
-
ParameterDefinition.ValueParameter = ValueParameter;
|
|
2468
|
-
if (false) {
|
|
2469
|
-
/** @type {?} */
|
|
2470
|
-
ValueParameter.prototype.isRouteId;
|
|
2471
|
-
/** @type {?} */
|
|
2472
|
-
ValueParameter.prototype.isArray;
|
|
2884
|
+
replace(parameter, value) {
|
|
2885
|
+
return new Visit(this.placeDefinition, Object.assign({}, this.visitParameters, { [parameter.name]: value }));
|
|
2473
2886
|
}
|
|
2474
2887
|
/**
|
|
2475
|
-
* @template
|
|
2888
|
+
* @template S
|
|
2889
|
+
* @param {?} routeParams
|
|
2890
|
+
* @return {?}
|
|
2476
2891
|
*/
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
super(...arguments);
|
|
2480
|
-
this.isRouteId = false;
|
|
2481
|
-
this.isArray = true;
|
|
2482
|
-
}
|
|
2483
|
-
}
|
|
2484
|
-
ParameterDefinition.ArrayParameter = ArrayParameter;
|
|
2485
|
-
if (false) {
|
|
2892
|
+
mergeRouteParameters(routeParams) {
|
|
2893
|
+
// todo: whitelist parameters.
|
|
2486
2894
|
/** @type {?} */
|
|
2487
|
-
|
|
2895
|
+
const routeParameterKeys = Object.keys(routeParams);
|
|
2488
2896
|
/** @type {?} */
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
* @template T, S
|
|
2493
|
-
*/
|
|
2494
|
-
class DefaultParameterSanitiser {
|
|
2495
|
-
/**
|
|
2496
|
-
* @param {?} remember
|
|
2497
|
-
* @param {?} defaultValue
|
|
2498
|
-
* @param {?} placeHistory
|
|
2499
|
-
*/
|
|
2500
|
-
constructor(remember, defaultValue, placeHistory) {
|
|
2501
|
-
this.remember = remember;
|
|
2502
|
-
this.defaultValue = defaultValue;
|
|
2503
|
-
this.placeHistory = placeHistory;
|
|
2504
|
-
}
|
|
2505
|
-
/**
|
|
2506
|
-
* @param {?} parameter
|
|
2507
|
-
* @param {?=} visit
|
|
2897
|
+
const params = {};
|
|
2898
|
+
this.placeDefinition.getVisitParameterDefs().forEach((/**
|
|
2899
|
+
* @param {?} def
|
|
2508
2900
|
* @return {?}
|
|
2509
2901
|
*/
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
/** @type {?} */
|
|
2515
|
-
const previousVisit = ___default.first(this.placeHistory.getHistory(visit.placeDefinition));
|
|
2516
|
-
if (this.remember && previousVisit) {
|
|
2517
|
-
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];
|
|
2518
2906
|
}
|
|
2519
|
-
return parameter.isEmptyValue(value) ? this.defaultValue : value;
|
|
2520
2907
|
}
|
|
2521
2908
|
else {
|
|
2522
|
-
|
|
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
|
+
}
|
|
2523
2914
|
}
|
|
2524
|
-
}
|
|
2915
|
+
}));
|
|
2916
|
+
return new Visit(this.placeDefinition, params);
|
|
2525
2917
|
}
|
|
2526
|
-
|
|
2527
|
-
|
|
2918
|
+
/**
|
|
2919
|
+
* @param {?} other
|
|
2920
|
+
* @return {?}
|
|
2921
|
+
*/
|
|
2922
|
+
hasRoutingChangedFrom(other) {
|
|
2528
2923
|
/** @type {?} */
|
|
2529
|
-
|
|
2924
|
+
const samePlace = other.placeDefinition === this.placeDefinition;
|
|
2530
2925
|
/** @type {?} */
|
|
2531
|
-
|
|
2926
|
+
const sameRouteParameters = isEqual(this.placeDefinition.getFormattedRouteParameters(this, true), this.placeDefinition.getFormattedRouteParameters(other, true));
|
|
2927
|
+
return !samePlace || !sameRouteParameters;
|
|
2928
|
+
}
|
|
2929
|
+
/**
|
|
2930
|
+
* @param {?} other
|
|
2931
|
+
* @return {?}
|
|
2932
|
+
*/
|
|
2933
|
+
hasChangedFrom(other) {
|
|
2532
2934
|
/** @type {?} */
|
|
2533
|
-
|
|
2935
|
+
const sameNonRouteParameters = isEqual(this.placeDefinition.getNonRouteParameters(this), this.placeDefinition.getNonRouteParameters(other));
|
|
2936
|
+
return !sameNonRouteParameters || this.hasRoutingChangedFrom(other);
|
|
2534
2937
|
}
|
|
2535
|
-
}
|
|
2938
|
+
}
|
|
2939
|
+
if (false) {
|
|
2940
|
+
/** @type {?} */
|
|
2941
|
+
Visit.prototype.placeDefinition;
|
|
2942
|
+
/**
|
|
2943
|
+
* @type {?}
|
|
2944
|
+
* @private
|
|
2945
|
+
*/
|
|
2946
|
+
Visit.prototype.visitParameters;
|
|
2947
|
+
}
|
|
2536
2948
|
|
|
2537
2949
|
/**
|
|
2538
2950
|
* @fileoverview added by tsickle
|
|
2539
2951
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2540
2952
|
*/
|
|
2541
|
-
|
|
2542
|
-
* @abstract
|
|
2543
|
-
* @template S, T, R
|
|
2544
|
-
*/
|
|
2545
|
-
class RouteParameterValue {
|
|
2953
|
+
class PlaceRouter extends GarbageCollector {
|
|
2546
2954
|
/**
|
|
2547
|
-
* @param {?}
|
|
2548
|
-
* @param {?}
|
|
2955
|
+
* @param {?} router
|
|
2956
|
+
* @param {?} angularLocation
|
|
2957
|
+
* @param {?} placeHistory
|
|
2549
2958
|
*/
|
|
2550
|
-
constructor(
|
|
2551
|
-
|
|
2552
|
-
this.
|
|
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
|
|
2971
|
+
* @return {?}
|
|
2972
|
+
*/
|
|
2973
|
+
url => {
|
|
2974
|
+
console.log(`location.onUrlChange -> ${url}`);
|
|
2975
|
+
}));
|
|
2976
|
+
// TODO: make setup the callbacks in during module initiation to make this testable.
|
|
2977
|
+
this.router.events.subscribe((/**
|
|
2978
|
+
* @param {?} event
|
|
2979
|
+
* @return {?}
|
|
2980
|
+
*/
|
|
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
|
|
2998
|
+
* @return {?}
|
|
2999
|
+
*/
|
|
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);
|
|
2553
3005
|
}
|
|
2554
3006
|
/**
|
|
2555
3007
|
* @return {?}
|
|
2556
3008
|
*/
|
|
2557
|
-
|
|
2558
|
-
return this.
|
|
3009
|
+
get navigationSession() {
|
|
3010
|
+
return this._navigationSessionModel.value;
|
|
2559
3011
|
}
|
|
2560
3012
|
/**
|
|
2561
|
-
* @param {?} otherValue
|
|
2562
3013
|
* @return {?}
|
|
2563
3014
|
*/
|
|
2564
|
-
|
|
2565
|
-
return this.
|
|
2566
|
-
!this.isEmptyValue(otherValue) :
|
|
2567
|
-
this.isEmptyValue(otherValue) || !this.isSameValue(otherValue);
|
|
3015
|
+
get navigationSessionModel() {
|
|
3016
|
+
return this._navigationSessionModel.readonly;
|
|
2568
3017
|
}
|
|
2569
3018
|
/**
|
|
2570
|
-
* Return's true if the current value is empty.
|
|
2571
3019
|
* @return {?}
|
|
2572
3020
|
*/
|
|
2573
|
-
|
|
2574
|
-
return this.
|
|
3021
|
+
get activeVisits() {
|
|
3022
|
+
return this._activeVisits.readonly;
|
|
2575
3023
|
}
|
|
2576
3024
|
/**
|
|
2577
|
-
*
|
|
3025
|
+
* placeRouter.navigate(placeDestinations.somePlace.createVisit(routeId, ...visitParams));
|
|
3026
|
+
* @param {?} visit
|
|
2578
3027
|
* @return {?}
|
|
2579
3028
|
*/
|
|
2580
|
-
|
|
2581
|
-
|
|
3029
|
+
// @Trace()
|
|
3030
|
+
navigate(visit) {
|
|
3031
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3032
|
+
this.doNavigation(visit);
|
|
3033
|
+
});
|
|
2582
3034
|
}
|
|
2583
3035
|
/**
|
|
2584
|
-
* @param {?}
|
|
2585
|
-
* @param {?}
|
|
3036
|
+
* @param {?} activatedRoute
|
|
3037
|
+
* @param {?} previous
|
|
3038
|
+
* @param {?} next
|
|
2586
3039
|
* @return {?}
|
|
2587
3040
|
*/
|
|
2588
|
-
|
|
3041
|
+
pushVisitChangesToRoute(activatedRoute, previous, next) {
|
|
2589
3042
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
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
|
+
}));
|
|
2594
3065
|
}
|
|
2595
3066
|
else {
|
|
2596
|
-
|
|
3067
|
+
this.placeHistory.add(next);
|
|
2597
3068
|
}
|
|
2598
3069
|
});
|
|
2599
3070
|
}
|
|
2600
|
-
}
|
|
2601
|
-
if (false) {
|
|
2602
|
-
/** @type {?} */
|
|
2603
|
-
RouteParameterValue.prototype.value;
|
|
2604
|
-
/** @type {?} */
|
|
2605
|
-
RouteParameterValue.prototype.definition;
|
|
2606
|
-
/**
|
|
2607
|
-
* @type {?}
|
|
2608
|
-
* @protected
|
|
2609
|
-
*/
|
|
2610
|
-
RouteParameterValue.prototype.rawValue;
|
|
2611
|
-
/**
|
|
2612
|
-
* @abstract
|
|
2613
|
-
* @param {?} otherValue
|
|
2614
|
-
* @return {?}
|
|
2615
|
-
*/
|
|
2616
|
-
RouteParameterValue.prototype.isSameValue = function (otherValue) { };
|
|
2617
|
-
/**
|
|
2618
|
-
* @abstract
|
|
2619
|
-
* @return {?}
|
|
2620
|
-
*/
|
|
2621
|
-
RouteParameterValue.prototype.formattedValue = function () { };
|
|
2622
|
-
/**
|
|
2623
|
-
* @abstract
|
|
2624
|
-
* @param {?} value
|
|
2625
|
-
* @return {?}
|
|
2626
|
-
*/
|
|
2627
|
-
RouteParameterValue.prototype.replace = function (value) { };
|
|
2628
3071
|
/**
|
|
2629
|
-
* @
|
|
2630
|
-
* @param {
|
|
3072
|
+
* @param {?} visit
|
|
3073
|
+
* @param {?=} customNavigation
|
|
2631
3074
|
* @return {?}
|
|
2632
3075
|
*/
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
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
|
+
});
|
|
3102
|
+
}
|
|
3103
|
+
// @Trace()
|
|
2636
3104
|
/**
|
|
2637
|
-
* @
|
|
2638
|
-
* @param {?}
|
|
2639
|
-
* @param {?} paramMap
|
|
3105
|
+
* @private
|
|
3106
|
+
* @param {?} event
|
|
2640
3107
|
* @return {?}
|
|
2641
3108
|
*/
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
return new RouteParameterValue.Array(def, paramMap.has(def.name) ? paramMap.getAll(def.name) : undefined);
|
|
2646
|
-
}
|
|
2647
|
-
else {
|
|
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 });
|
|
2648
3112
|
/** @type {?} */
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
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;
|
|
2653
3118
|
}
|
|
3119
|
+
this.firstRoute = false;
|
|
2654
3120
|
}
|
|
2655
|
-
|
|
3121
|
+
// @Trace()
|
|
2656
3122
|
/**
|
|
2657
|
-
* @
|
|
3123
|
+
* @private
|
|
3124
|
+
* @return {?}
|
|
2658
3125
|
*/
|
|
2659
|
-
|
|
2660
|
-
/**
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
/**
|
|
2667
|
-
* @param {?}
|
|
2668
|
-
* @return {?}
|
|
2669
|
-
*/
|
|
2670
|
-
isSameValue(otherValue) {
|
|
2671
|
-
return this.value === otherValue;
|
|
2672
|
-
}
|
|
2673
|
-
/**
|
|
2674
|
-
* @param {?} value
|
|
2675
|
-
* @return {?}
|
|
2676
|
-
*/
|
|
2677
|
-
replace(value) {
|
|
2678
|
-
return new RouteParameterValue.Scalar(this.definition, this.isEmptyValue(value) ? undefined : this.definition.type.format(value));
|
|
2679
|
-
}
|
|
2680
|
-
/**
|
|
2681
|
-
* @return {?}
|
|
2682
|
-
*/
|
|
2683
|
-
formattedValue() {
|
|
2684
|
-
return this.isEmpty() ? undefined : this.definition.type.format(this.value);
|
|
2685
|
-
}
|
|
2686
|
-
/**
|
|
2687
|
-
* @param {?} value
|
|
3126
|
+
onAngularRouterFinished() {
|
|
3127
|
+
/** @type {?} */
|
|
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
|
|
3131
|
+
/** @type {?} */
|
|
3132
|
+
const visits = session.getVisits();
|
|
3133
|
+
visits.forEach((/**
|
|
3134
|
+
* @param {?} v
|
|
2688
3135
|
* @return {?}
|
|
2689
3136
|
*/
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
}
|
|
3137
|
+
v => {
|
|
3138
|
+
this.placeHistory.add(v);
|
|
3139
|
+
}));
|
|
3140
|
+
this._activeVisits.value = visits;
|
|
3141
|
+
this._navigationSessionModel.value = null;
|
|
2693
3142
|
}
|
|
2694
|
-
__decorate([
|
|
2695
|
-
Memoize$1(),
|
|
2696
|
-
__metadata("design:type", Object),
|
|
2697
|
-
__metadata("design:paramtypes", [])
|
|
2698
|
-
], Scalar.prototype, "value", null);
|
|
2699
|
-
RouteParameterValue.Scalar = Scalar;
|
|
2700
3143
|
/**
|
|
2701
|
-
* @
|
|
3144
|
+
* @param {?} activatedRoute
|
|
3145
|
+
* @return {?}
|
|
2702
3146
|
*/
|
|
2703
|
-
|
|
2704
|
-
/**
|
|
2705
|
-
* @
|
|
2706
|
-
*/
|
|
2707
|
-
get value() {
|
|
2708
|
-
return (this.rawValue || [])
|
|
2709
|
-
.filter((/**
|
|
2710
|
-
* @param {?} s
|
|
2711
|
-
* @return {?}
|
|
2712
|
-
*/
|
|
2713
|
-
s => !___default.isEmpty(s)))
|
|
2714
|
-
.map((/**
|
|
2715
|
-
* @param {?} raw
|
|
2716
|
-
* @return {?}
|
|
2717
|
-
*/
|
|
2718
|
-
raw => this.definition.type.parse(raw)));
|
|
2719
|
-
}
|
|
2720
|
-
/**
|
|
2721
|
-
* @param {?} otherValue
|
|
2722
|
-
* @return {?}
|
|
2723
|
-
*/
|
|
2724
|
-
isSameValue(otherValue) {
|
|
2725
|
-
return ___default.isEqual(this.value, otherValue);
|
|
2726
|
-
}
|
|
2727
|
-
/**
|
|
2728
|
-
* @param {?} value
|
|
2729
|
-
* @return {?}
|
|
2730
|
-
*/
|
|
2731
|
-
replace(value) {
|
|
2732
|
-
return new RouteParameterValue.Array(this.definition, this.isEmptyValue(value) ? undefined : value.map((/**
|
|
2733
|
-
* @param {?} v
|
|
2734
|
-
* @return {?}
|
|
2735
|
-
*/
|
|
2736
|
-
v => this.definition.type.format(v))));
|
|
2737
|
-
}
|
|
2738
|
-
/**
|
|
2739
|
-
* @return {?}
|
|
2740
|
-
*/
|
|
2741
|
-
formattedValue() {
|
|
2742
|
-
return this.isEmpty() ? [] : this.value.map((/**
|
|
2743
|
-
* @param {?} v
|
|
2744
|
-
* @return {?}
|
|
2745
|
-
*/
|
|
2746
|
-
v => this.definition.type.format(v)));
|
|
2747
|
-
}
|
|
2748
|
-
/**
|
|
2749
|
-
* @param {?} value
|
|
3147
|
+
getChildPath(activatedRoute) {
|
|
3148
|
+
return ___default.flatten(activatedRoute.children.map((/**
|
|
3149
|
+
* @param {?} child
|
|
2750
3150
|
* @return {?}
|
|
2751
3151
|
*/
|
|
2752
|
-
|
|
2753
|
-
return ___default.isNil(value) || value.length < 1;
|
|
2754
|
-
}
|
|
2755
|
-
}
|
|
2756
|
-
__decorate([
|
|
2757
|
-
Memoize$1(),
|
|
2758
|
-
__metadata("design:type", Array),
|
|
2759
|
-
__metadata("design:paramtypes", [])
|
|
2760
|
-
], Array.prototype, "value", null);
|
|
2761
|
-
RouteParameterValue.Array = Array;
|
|
2762
|
-
})(RouteParameterValue || (RouteParameterValue = {}));
|
|
2763
|
-
|
|
2764
|
-
var _a;
|
|
2765
|
-
class ParameterSnapshot {
|
|
2766
|
-
/**
|
|
2767
|
-
* @param {?} placeDefinition
|
|
2768
|
-
* @param {?} parameters
|
|
2769
|
-
*/
|
|
2770
|
-
constructor(placeDefinition, parameters) {
|
|
2771
|
-
this.placeDefinition = placeDefinition;
|
|
2772
|
-
this.parameters = parameters;
|
|
2773
|
-
}
|
|
2774
|
-
/**
|
|
2775
|
-
* @param {?} other
|
|
2776
|
-
* @param {?=} debug
|
|
2777
|
-
* @return {?}
|
|
2778
|
-
*/
|
|
2779
|
-
hasChanged(other, debug = false) {
|
|
2780
|
-
/** @type {?} */
|
|
2781
|
-
const changed = this.parameters.find((/**
|
|
2782
|
-
* @param {?} r
|
|
2783
|
-
* @return {?}
|
|
2784
|
-
*/
|
|
2785
|
-
(r) => {
|
|
2786
|
-
return r.hasChanged(other.getValueOf(r.definition));
|
|
2787
|
-
}));
|
|
2788
|
-
if (changed && debug) {
|
|
2789
|
-
console.log({
|
|
2790
|
-
name: changed.definition.name,
|
|
2791
|
-
mine: changed.value,
|
|
2792
|
-
theirs: other.getValueOf(changed.definition)
|
|
2793
|
-
});
|
|
2794
|
-
}
|
|
2795
|
-
return !!changed;
|
|
2796
|
-
}
|
|
2797
|
-
/**
|
|
2798
|
-
* @template T, S
|
|
2799
|
-
* @param {?} parameterDef
|
|
2800
|
-
* @return {?}
|
|
2801
|
-
*/
|
|
2802
|
-
getParameter(parameterDef) {
|
|
2803
|
-
return this.parameters.find((/**
|
|
2804
|
-
* @param {?} r
|
|
2805
|
-
* @return {?}
|
|
2806
|
-
*/
|
|
2807
|
-
r => r.definition === parameterDef));
|
|
2808
|
-
}
|
|
2809
|
-
/**
|
|
2810
|
-
* @template T, S
|
|
2811
|
-
* @param {?} parameterDef
|
|
2812
|
-
* @return {?}
|
|
2813
|
-
*/
|
|
2814
|
-
getValueOf(parameterDef) {
|
|
2815
|
-
/** @type {?} */
|
|
2816
|
-
const resolvedParameter = this.getParameter(parameterDef);
|
|
2817
|
-
return resolvedParameter ? resolvedParameter.value : null;
|
|
2818
|
-
}
|
|
2819
|
-
/**
|
|
2820
|
-
* @return {?}
|
|
2821
|
-
*/
|
|
2822
|
-
getRouteIdValue() {
|
|
2823
|
-
return this.getRouteIdParameter() ? this.getRouteIdParameter().value : null;
|
|
2824
|
-
}
|
|
2825
|
-
/**
|
|
2826
|
-
* @param {?} name
|
|
2827
|
-
* @return {?}
|
|
2828
|
-
*/
|
|
2829
|
-
getParameterValue(name) {
|
|
2830
|
-
/** @type {?} */
|
|
2831
|
-
const resolvedParameter = this.parameters.find((/**
|
|
2832
|
-
* @param {?} r
|
|
2833
|
-
* @return {?}
|
|
2834
|
-
*/
|
|
2835
|
-
r => r.definition.name === name));
|
|
2836
|
-
return resolvedParameter ? resolvedParameter.value : null;
|
|
3152
|
+
child => child.url)));
|
|
2837
3153
|
}
|
|
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" });
|
|
3167
|
+
__decorate([
|
|
3168
|
+
Trace(),
|
|
3169
|
+
__metadata("design:type", Function),
|
|
3170
|
+
__metadata("design:paramtypes", [ActivatedRoute, Visit, Visit]),
|
|
3171
|
+
__metadata("design:returntype", Promise)
|
|
3172
|
+
], PlaceRouter.prototype, "pushVisitChangesToRoute", null);
|
|
3173
|
+
if (false) {
|
|
2838
3174
|
/**
|
|
3175
|
+
* @type {?}
|
|
2839
3176
|
* @private
|
|
2840
|
-
* @return {?}
|
|
2841
3177
|
*/
|
|
2842
|
-
|
|
2843
|
-
// RouteId's are never arrays: see parameter-decorators.ts createDefinition methods. It would be nice to
|
|
2844
|
-
// capture this in the type system though
|
|
2845
|
-
return (/** @type {?} */ (this.parameters.find((/**
|
|
2846
|
-
* @param {?} p
|
|
2847
|
-
* @return {?}
|
|
2848
|
-
*/
|
|
2849
|
-
p => p.definition.isRouteId))));
|
|
2850
|
-
}
|
|
3178
|
+
PlaceRouter.prototype.firstRoute;
|
|
2851
3179
|
/**
|
|
3180
|
+
* @type {?}
|
|
2852
3181
|
* @private
|
|
2853
|
-
* @return {?}
|
|
2854
|
-
*/
|
|
2855
|
-
getRouteParameters() {
|
|
2856
|
-
return this.parameters.filter((/**
|
|
2857
|
-
* @param {?} r
|
|
2858
|
-
* @return {?}
|
|
2859
|
-
*/
|
|
2860
|
-
r => !r.definition.isRouteId));
|
|
2861
|
-
}
|
|
2862
|
-
/**
|
|
2863
|
-
* @return {?}
|
|
2864
|
-
*/
|
|
2865
|
-
hasRouteId() {
|
|
2866
|
-
return !!this.getRouteIdParameter();
|
|
2867
|
-
}
|
|
2868
|
-
/**
|
|
2869
|
-
* @return {?}
|
|
2870
|
-
*/
|
|
2871
|
-
getFormattedRouteId() {
|
|
2872
|
-
/** @type {?} */
|
|
2873
|
-
const routeIdParam = this.getRouteIdParameter();
|
|
2874
|
-
return routeIdParam ? routeIdParam.formattedValue() : null;
|
|
2875
|
-
}
|
|
2876
|
-
/**
|
|
2877
|
-
* @return {?}
|
|
2878
|
-
*/
|
|
2879
|
-
getNonEmptyParameters() {
|
|
2880
|
-
return this.parameters.filter((/**
|
|
2881
|
-
* @param {?} p
|
|
2882
|
-
* @return {?}
|
|
2883
|
-
*/
|
|
2884
|
-
p => !p.isEmpty()));
|
|
2885
|
-
}
|
|
2886
|
-
/**
|
|
2887
|
-
* @return {?}
|
|
2888
|
-
*/
|
|
2889
|
-
getFormattedParameters() {
|
|
2890
|
-
/** @type {?} */
|
|
2891
|
-
const params = {};
|
|
2892
|
-
/** @type {?} */
|
|
2893
|
-
const routeIdParam = this.getNonEmptyParameters()
|
|
2894
|
-
.filter((/**
|
|
2895
|
-
* @param {?} p
|
|
2896
|
-
* @return {?}
|
|
2897
|
-
*/
|
|
2898
|
-
p => !p.definition.isRouteId))
|
|
2899
|
-
.forEach((/**
|
|
2900
|
-
* @param {?} p
|
|
2901
|
-
* @return {?}
|
|
2902
|
-
*/
|
|
2903
|
-
p => params[p.definition.name] = p.formattedValue()));
|
|
2904
|
-
return params;
|
|
2905
|
-
}
|
|
2906
|
-
/**
|
|
2907
|
-
* @return {?}
|
|
2908
|
-
*/
|
|
2909
|
-
getAllParameters() {
|
|
2910
|
-
/** @type {?} */
|
|
2911
|
-
const params = {};
|
|
2912
|
-
/** @type {?} */
|
|
2913
|
-
const routeIdParam = this.parameters.forEach((/**
|
|
2914
|
-
* @param {?} p
|
|
2915
|
-
* @return {?}
|
|
2916
|
-
*/
|
|
2917
|
-
p => {
|
|
2918
|
-
params[p.definition.name] = p.value;
|
|
2919
|
-
}));
|
|
2920
|
-
return params;
|
|
2921
|
-
}
|
|
2922
|
-
/**
|
|
2923
|
-
* @template T, S
|
|
2924
|
-
* @param {?} parameter
|
|
2925
|
-
* @param {?} value
|
|
2926
|
-
* @return {?}
|
|
2927
3182
|
*/
|
|
2928
|
-
|
|
2929
|
-
return new ParameterSnapshot(this.placeDefinition, this.parameters.map((/**
|
|
2930
|
-
* @param {?} p
|
|
2931
|
-
* @return {?}
|
|
2932
|
-
*/
|
|
2933
|
-
p => {
|
|
2934
|
-
return p.definition === parameter ? p.replace(value) : p;
|
|
2935
|
-
})));
|
|
2936
|
-
}
|
|
3183
|
+
PlaceRouter.prototype._navigationSessionModel;
|
|
2937
3184
|
/**
|
|
2938
|
-
* @
|
|
2939
|
-
* @
|
|
3185
|
+
* @type {?}
|
|
3186
|
+
* @private
|
|
2940
3187
|
*/
|
|
2941
|
-
|
|
2942
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2943
|
-
if (this.hasRouteId()) {
|
|
2944
|
-
/** @type {?} */
|
|
2945
|
-
const routeId = this.getRouteIdParameter();
|
|
2946
|
-
/** @type {?} */
|
|
2947
|
-
const sanitisedValue = yield routeId.sanitise(this, injector);
|
|
2948
|
-
if (routeId.hasChanged(sanitisedValue)) {
|
|
2949
|
-
// if the route id has changed we redirect immediately as other
|
|
2950
|
-
// parameter sanitisers might use it.
|
|
2951
|
-
return this.replace(routeId.definition, sanitisedValue);
|
|
2952
|
-
}
|
|
2953
|
-
}
|
|
2954
|
-
/** @type {?} */
|
|
2955
|
-
let result = this;
|
|
2956
|
-
/** @type {?} */
|
|
2957
|
-
const routeParameters = this.getRouteParameters();
|
|
2958
|
-
for (let i = 0; i < routeParameters.length; i++) {
|
|
2959
|
-
/** @type {?} */
|
|
2960
|
-
const routeParameter = routeParameters[i];
|
|
2961
|
-
/** @type {?} */
|
|
2962
|
-
const sanitisedValue = yield routeParameter.sanitise(this, injector);
|
|
2963
|
-
if (routeParameter.hasChanged(sanitisedValue)) {
|
|
2964
|
-
result = result.replace(routeParameter.definition, sanitisedValue);
|
|
2965
|
-
}
|
|
2966
|
-
}
|
|
2967
|
-
return result;
|
|
2968
|
-
});
|
|
2969
|
-
}
|
|
2970
|
-
}
|
|
2971
|
-
__decorate([
|
|
2972
|
-
Memoize$1(),
|
|
2973
|
-
__metadata("design:type", Function),
|
|
2974
|
-
__metadata("design:paramtypes", [ParameterDefinition]),
|
|
2975
|
-
__metadata("design:returntype", RouteParameterValue)
|
|
2976
|
-
], ParameterSnapshot.prototype, "getParameter", null);
|
|
2977
|
-
__decorate([
|
|
2978
|
-
Memoize$1(),
|
|
2979
|
-
__metadata("design:type", Function),
|
|
2980
|
-
__metadata("design:paramtypes", [ParameterDefinition]),
|
|
2981
|
-
__metadata("design:returntype", typeof (_a = typeof S !== "undefined" && S) === "function" ? _a : Object)
|
|
2982
|
-
], ParameterSnapshot.prototype, "getValueOf", null);
|
|
2983
|
-
__decorate([
|
|
2984
|
-
Memoize$1(),
|
|
2985
|
-
__metadata("design:type", Function),
|
|
2986
|
-
__metadata("design:paramtypes", [String]),
|
|
2987
|
-
__metadata("design:returntype", Object)
|
|
2988
|
-
], ParameterSnapshot.prototype, "getParameterValue", null);
|
|
2989
|
-
__decorate([
|
|
2990
|
-
Memoize$1(),
|
|
2991
|
-
__metadata("design:type", Function),
|
|
2992
|
-
__metadata("design:paramtypes", []),
|
|
2993
|
-
__metadata("design:returntype", RouteParameterValue.Scalar)
|
|
2994
|
-
], ParameterSnapshot.prototype, "getRouteIdParameter", null);
|
|
2995
|
-
__decorate([
|
|
2996
|
-
Memoize$1(),
|
|
2997
|
-
__metadata("design:type", Function),
|
|
2998
|
-
__metadata("design:paramtypes", []),
|
|
2999
|
-
__metadata("design:returntype", Array)
|
|
3000
|
-
], ParameterSnapshot.prototype, "getRouteParameters", null);
|
|
3001
|
-
if (false) {
|
|
3188
|
+
PlaceRouter.prototype._activeVisits;
|
|
3002
3189
|
/** @type {?} */
|
|
3003
|
-
|
|
3190
|
+
PlaceRouter.prototype.navigationSessionActive;
|
|
3191
|
+
/** @type {?} */
|
|
3192
|
+
PlaceRouter.prototype.activeVisitIndex;
|
|
3004
3193
|
/**
|
|
3005
3194
|
* @type {?}
|
|
3006
3195
|
* @private
|
|
3007
3196
|
*/
|
|
3008
|
-
|
|
3197
|
+
PlaceRouter.prototype.router;
|
|
3198
|
+
/** @type {?} */
|
|
3199
|
+
PlaceRouter.prototype.angularLocation;
|
|
3200
|
+
/** @type {?} */
|
|
3201
|
+
PlaceRouter.prototype.placeHistory;
|
|
3009
3202
|
}
|
|
3010
|
-
(function (ParameterSnapshot) {
|
|
3011
|
-
/**
|
|
3012
|
-
* @param {?} placeDef
|
|
3013
|
-
* @param {?} params
|
|
3014
|
-
* @param {?} urlSegments
|
|
3015
|
-
* @return {?}
|
|
3016
|
-
*/
|
|
3017
|
-
function create(placeDef, params, urlSegments) {
|
|
3018
|
-
/** @type {?} */
|
|
3019
|
-
const paramMap = new ConsolidatedParameterMap(params, urlSegments);
|
|
3020
|
-
/** @type {?} */
|
|
3021
|
-
const resolvedParameters = placeDef.getRouteParameters().map((/**
|
|
3022
|
-
* @param {?} def
|
|
3023
|
-
* @return {?}
|
|
3024
|
-
*/
|
|
3025
|
-
def => RouteParameterValue.create(def, paramMap)));
|
|
3026
|
-
return new ParameterSnapshot(placeDef, resolvedParameters);
|
|
3027
|
-
}
|
|
3028
|
-
ParameterSnapshot.create = create;
|
|
3029
|
-
/**
|
|
3030
|
-
* This a work around for the fact that an activated route with multiple segments doesn't
|
|
3031
|
-
* include the segment params in the paramMap as well as each segment returns an empty
|
|
3032
|
-
* param map even when `parameter`s has content.
|
|
3033
|
-
*/
|
|
3034
|
-
class ConsolidatedParameterMap {
|
|
3035
|
-
/**
|
|
3036
|
-
* @param {?} paramMap
|
|
3037
|
-
* @param {?} urlSegments
|
|
3038
|
-
*/
|
|
3039
|
-
constructor(paramMap, urlSegments) {
|
|
3040
|
-
this.paramMaps = [paramMap].concat((urlSegments || []).map((/**
|
|
3041
|
-
* @param {?} s
|
|
3042
|
-
* @return {?}
|
|
3043
|
-
*/
|
|
3044
|
-
s => new ParamMapAdapter(s.parameters)))).filter((/**
|
|
3045
|
-
* @param {?} m
|
|
3046
|
-
* @return {?}
|
|
3047
|
-
*/
|
|
3048
|
-
m => !!m)); // the activated route param map can be null
|
|
3049
|
-
}
|
|
3050
|
-
/**
|
|
3051
|
-
* @param {?} name
|
|
3052
|
-
* @return {?}
|
|
3053
|
-
*/
|
|
3054
|
-
get(name) {
|
|
3055
|
-
return this.paramMaps.find((/**
|
|
3056
|
-
* @param {?} m
|
|
3057
|
-
* @return {?}
|
|
3058
|
-
*/
|
|
3059
|
-
m => m.has(name))).get(name);
|
|
3060
|
-
}
|
|
3061
|
-
/**
|
|
3062
|
-
* @param {?} name
|
|
3063
|
-
* @return {?}
|
|
3064
|
-
*/
|
|
3065
|
-
getAll(name) {
|
|
3066
|
-
return this.paramMaps.find((/**
|
|
3067
|
-
* @param {?} m
|
|
3068
|
-
* @return {?}
|
|
3069
|
-
*/
|
|
3070
|
-
m => m.has(name))).getAll(name);
|
|
3071
|
-
}
|
|
3072
|
-
/**
|
|
3073
|
-
* @param {?} name
|
|
3074
|
-
* @return {?}
|
|
3075
|
-
*/
|
|
3076
|
-
has(name) {
|
|
3077
|
-
return !!this.paramMaps.find((/**
|
|
3078
|
-
* @param {?} m
|
|
3079
|
-
* @return {?}
|
|
3080
|
-
*/
|
|
3081
|
-
m => m.has(name)));
|
|
3082
|
-
}
|
|
3083
|
-
/**
|
|
3084
|
-
* @return {?}
|
|
3085
|
-
*/
|
|
3086
|
-
get keys() {
|
|
3087
|
-
return this.paramMaps.reduce((/**
|
|
3088
|
-
* @param {?} result
|
|
3089
|
-
* @param {?} params
|
|
3090
|
-
* @return {?}
|
|
3091
|
-
*/
|
|
3092
|
-
(result, params) => result.concat(params.keys)), []);
|
|
3093
|
-
}
|
|
3094
|
-
}
|
|
3095
|
-
__decorate([
|
|
3096
|
-
Memoize$1(),
|
|
3097
|
-
__metadata("design:type", Array),
|
|
3098
|
-
__metadata("design:paramtypes", [])
|
|
3099
|
-
], ConsolidatedParameterMap.prototype, "keys", null);
|
|
3100
|
-
if (false) {
|
|
3101
|
-
/**
|
|
3102
|
-
* @type {?}
|
|
3103
|
-
* @private
|
|
3104
|
-
*/
|
|
3105
|
-
ConsolidatedParameterMap.prototype.paramMaps;
|
|
3106
|
-
}
|
|
3107
|
-
class ParamMapAdapter {
|
|
3108
|
-
/**
|
|
3109
|
-
* @param {?} params
|
|
3110
|
-
*/
|
|
3111
|
-
constructor(params) {
|
|
3112
|
-
this.params = params;
|
|
3113
|
-
}
|
|
3114
|
-
/**
|
|
3115
|
-
* @param {?} name
|
|
3116
|
-
* @return {?}
|
|
3117
|
-
*/
|
|
3118
|
-
get(name) {
|
|
3119
|
-
return this.params[name];
|
|
3120
|
-
}
|
|
3121
|
-
/**
|
|
3122
|
-
* @param {?} name
|
|
3123
|
-
* @return {?}
|
|
3124
|
-
*/
|
|
3125
|
-
getAll(name) {
|
|
3126
|
-
/** @type {?} */
|
|
3127
|
-
const value = this.get(name);
|
|
3128
|
-
return Array.isArray(value) ? value : [value];
|
|
3129
|
-
}
|
|
3130
|
-
/**
|
|
3131
|
-
* @param {?} name
|
|
3132
|
-
* @return {?}
|
|
3133
|
-
*/
|
|
3134
|
-
has(name) {
|
|
3135
|
-
return this.keys.includes(name);
|
|
3136
|
-
}
|
|
3137
|
-
/**
|
|
3138
|
-
* @return {?}
|
|
3139
|
-
*/
|
|
3140
|
-
get keys() {
|
|
3141
|
-
return Object.keys(this.params);
|
|
3142
|
-
}
|
|
3143
|
-
}
|
|
3144
|
-
if (false) {
|
|
3145
|
-
/**
|
|
3146
|
-
* @type {?}
|
|
3147
|
-
* @private
|
|
3148
|
-
*/
|
|
3149
|
-
ParamMapAdapter.prototype.params;
|
|
3150
|
-
}
|
|
3151
|
-
})(ParameterSnapshot || (ParameterSnapshot = {}));
|
|
3152
3203
|
|
|
3153
3204
|
/**
|
|
3154
3205
|
* @fileoverview added by tsickle
|
|
@@ -3227,64 +3278,64 @@ if (false) {
|
|
|
3227
3278
|
class PlaceOutletComponent extends DisposableComponent {
|
|
3228
3279
|
/**
|
|
3229
3280
|
* @param {?} router
|
|
3281
|
+
* @param {?} placeRouter
|
|
3230
3282
|
* @param {?} placeHistory
|
|
3231
3283
|
*/
|
|
3232
|
-
constructor(router, placeHistory) {
|
|
3284
|
+
constructor(router, placeRouter, placeHistory) {
|
|
3233
3285
|
super();
|
|
3234
3286
|
this.router = router;
|
|
3287
|
+
this.placeRouter = placeRouter;
|
|
3235
3288
|
this.placeHistory = placeHistory;
|
|
3236
3289
|
this.animate = true;
|
|
3290
|
+
this.placeChanged = new EventEmitter();
|
|
3237
3291
|
this._activePlace = new MutableValueModel();
|
|
3238
|
-
this._incomingRouteChange = new Guard$1();
|
|
3239
3292
|
this._inOutletUpdate = new Guard$1();
|
|
3240
3293
|
this._activatedRouteModel = new MutableValueModel();
|
|
3241
3294
|
this._placeDefinition = new MutableValueModel();
|
|
3242
|
-
|
|
3295
|
+
/**
|
|
3296
|
+
* TODO: This is now really a visit
|
|
3297
|
+
*/
|
|
3298
|
+
this._placeVisit = new MutableValueModel();
|
|
3243
3299
|
const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
|
|
3300
|
+
// Handle incoming route changes.
|
|
3244
3301
|
/** @type {?} */
|
|
3245
|
-
const
|
|
3246
|
-
* @param {?} ar
|
|
3247
|
-
* @return {?}
|
|
3248
|
-
*/
|
|
3249
|
-
ar => ar.paramMap));
|
|
3302
|
+
const inRouteVisitUpdate = new Guard$1();
|
|
3250
3303
|
/** @type {?} */
|
|
3251
|
-
const
|
|
3252
|
-
|
|
3253
|
-
* @
|
|
3254
|
-
*/
|
|
3255
|
-
ar => ar.url));
|
|
3256
|
-
this.placeConfigured = valueOf.all(chain(this._inOutletUpdate).isFalsey(), this._placeDefinition, paramMap, urls).areTruthy();
|
|
3257
|
-
when.anyOf(paramMap, urls).changes((/**
|
|
3304
|
+
const routeVisit = chain(this._activePlace).pluck('placeDefinition').findIn(placeRouter.activeVisitIndex);
|
|
3305
|
+
when.valueOf(routeVisit).changes((/**
|
|
3306
|
+
* @param {?} visit
|
|
3258
3307
|
* @return {?}
|
|
3259
3308
|
*/
|
|
3260
|
-
() => {
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
});
|
|
3273
|
-
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((/**
|
|
3274
3321
|
* @param {?} next
|
|
3275
3322
|
* @param {?} previous
|
|
3276
3323
|
* @return {?}
|
|
3277
3324
|
*/
|
|
3278
3325
|
(next, previous) => {
|
|
3279
|
-
this.
|
|
3280
|
-
this.pushChangesToRoute(next, previous);
|
|
3326
|
+
this.pushVisitChangesToRoute(next, previous);
|
|
3281
3327
|
}), {
|
|
3282
|
-
unless:
|
|
3328
|
+
unless: inRouteVisitUpdate
|
|
3283
3329
|
});
|
|
3330
|
+
chain(this._activePlace)
|
|
3331
|
+
.postponeWhile(placeRouter.navigationSessionActive)
|
|
3332
|
+
.subscribe((/**
|
|
3333
|
+
* @param {?} place
|
|
3334
|
+
* @return {?}
|
|
3335
|
+
*/
|
|
3336
|
+
place => this.placeChanged.emit(place)));
|
|
3284
3337
|
// const txo = new TransactionObserver().onEvent(e => console.log(e.toString()));
|
|
3285
|
-
// txo.observe('
|
|
3286
|
-
// txo.observe('urls', urls);
|
|
3287
|
-
// txo.observe('this._resolvedParameters', this._resolvedParameters);
|
|
3338
|
+
// txo.observe('inRouteVisitUpdate', inRouteVisitUpdate);
|
|
3288
3339
|
}
|
|
3289
3340
|
/**
|
|
3290
3341
|
* @return {?}
|
|
@@ -3292,15 +3343,19 @@ class PlaceOutletComponent extends DisposableComponent {
|
|
|
3292
3343
|
ngOnInit() {
|
|
3293
3344
|
}
|
|
3294
3345
|
/**
|
|
3346
|
+
* @param {?} next
|
|
3347
|
+
* @param {?} previous
|
|
3295
3348
|
* @return {?}
|
|
3296
3349
|
*/
|
|
3297
|
-
|
|
3298
|
-
|
|
3350
|
+
pushVisitChangesToRoute(next, previous) {
|
|
3351
|
+
/** @type {?} */
|
|
3352
|
+
const activatedRoute = this._activatedRouteModel.value;
|
|
3353
|
+
this.placeRouter.pushVisitChangesToRoute(activatedRoute, previous, next);
|
|
3299
3354
|
}
|
|
3300
3355
|
/**
|
|
3301
3356
|
* @return {?}
|
|
3302
3357
|
*/
|
|
3303
|
-
get
|
|
3358
|
+
get activePlaceModel() {
|
|
3304
3359
|
return this._activePlace.readonly;
|
|
3305
3360
|
}
|
|
3306
3361
|
/**
|
|
@@ -3317,7 +3372,7 @@ class PlaceOutletComponent extends DisposableComponent {
|
|
|
3317
3372
|
this._activePlace.value = place;
|
|
3318
3373
|
this._activatedRouteModel.value = routerOutlet.activatedRoute;
|
|
3319
3374
|
this._placeDefinition.value = place.placeDefinition;
|
|
3320
|
-
place.initialiseBindings(this.
|
|
3375
|
+
place.initialiseBindings(this._placeVisit);
|
|
3321
3376
|
}
|
|
3322
3377
|
catch (error) {
|
|
3323
3378
|
console.error(error);
|
|
@@ -3359,22 +3414,11 @@ class PlaceOutletComponent extends DisposableComponent {
|
|
|
3359
3414
|
}
|
|
3360
3415
|
}
|
|
3361
3416
|
/**
|
|
3362
|
-
* @param {?}
|
|
3363
|
-
* @param {?} previous
|
|
3417
|
+
* @param {?} placeDestination
|
|
3364
3418
|
* @return {?}
|
|
3365
3419
|
*/
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
const activatedRoute = this._activatedRouteModel.value;
|
|
3369
|
-
this.router.pushParameterChangesToRoute(activatedRoute, previous, next);
|
|
3370
|
-
}
|
|
3371
|
-
/**
|
|
3372
|
-
* @param {?} snapshot
|
|
3373
|
-
* @param {?} callback
|
|
3374
|
-
* @return {?}
|
|
3375
|
-
*/
|
|
3376
|
-
sanitise(snapshot, callback) {
|
|
3377
|
-
return snapshot;
|
|
3420
|
+
activate(placeDestination) {
|
|
3421
|
+
// this.router.
|
|
3378
3422
|
}
|
|
3379
3423
|
}
|
|
3380
3424
|
PlaceOutletComponent.decorators = [
|
|
@@ -3387,28 +3431,27 @@ PlaceOutletComponent.decorators = [
|
|
|
3387
3431
|
];
|
|
3388
3432
|
/** @nocollapse */
|
|
3389
3433
|
PlaceOutletComponent.ctorParameters = () => [
|
|
3434
|
+
{ type: Router },
|
|
3390
3435
|
{ type: PlaceRouter },
|
|
3391
3436
|
{ type: PlaceHistory }
|
|
3392
3437
|
];
|
|
3393
3438
|
PlaceOutletComponent.propDecorators = {
|
|
3394
3439
|
animate: [{ type: Input }],
|
|
3440
|
+
placeChanged: [{ type: Output }],
|
|
3395
3441
|
routerOut: [{ type: ViewChild, args: ['routeOutlet', { static: true },] }]
|
|
3396
3442
|
};
|
|
3397
3443
|
if (false) {
|
|
3398
3444
|
/** @type {?} */
|
|
3399
3445
|
PlaceOutletComponent.prototype.animate;
|
|
3400
3446
|
/** @type {?} */
|
|
3447
|
+
PlaceOutletComponent.prototype.placeChanged;
|
|
3448
|
+
/** @type {?} */
|
|
3401
3449
|
PlaceOutletComponent.prototype.routerOut;
|
|
3402
3450
|
/**
|
|
3403
3451
|
* @type {?}
|
|
3404
3452
|
* @private
|
|
3405
3453
|
*/
|
|
3406
3454
|
PlaceOutletComponent.prototype._activePlace;
|
|
3407
|
-
/**
|
|
3408
|
-
* @type {?}
|
|
3409
|
-
* @private
|
|
3410
|
-
*/
|
|
3411
|
-
PlaceOutletComponent.prototype._incomingRouteChange;
|
|
3412
3455
|
/**
|
|
3413
3456
|
* @type {?}
|
|
3414
3457
|
* @private
|
|
@@ -3424,18 +3467,21 @@ if (false) {
|
|
|
3424
3467
|
* @private
|
|
3425
3468
|
*/
|
|
3426
3469
|
PlaceOutletComponent.prototype._placeDefinition;
|
|
3427
|
-
/** @type {?} */
|
|
3428
|
-
PlaceOutletComponent.prototype._resolvedParameters;
|
|
3429
3470
|
/**
|
|
3471
|
+
* TODO: This is now really a visit
|
|
3430
3472
|
* @type {?}
|
|
3431
|
-
* @private
|
|
3432
3473
|
*/
|
|
3433
|
-
PlaceOutletComponent.prototype.
|
|
3474
|
+
PlaceOutletComponent.prototype._placeVisit;
|
|
3434
3475
|
/**
|
|
3435
3476
|
* @type {?}
|
|
3436
3477
|
* @private
|
|
3437
3478
|
*/
|
|
3438
3479
|
PlaceOutletComponent.prototype.router;
|
|
3480
|
+
/**
|
|
3481
|
+
* @type {?}
|
|
3482
|
+
* @private
|
|
3483
|
+
*/
|
|
3484
|
+
PlaceOutletComponent.prototype.placeRouter;
|
|
3439
3485
|
/**
|
|
3440
3486
|
* @type {?}
|
|
3441
3487
|
* @private
|
|
@@ -3455,7 +3501,7 @@ class TabbedPlaceNavigationComponent extends AbstractPlaceNavigationComponent {
|
|
|
3455
3501
|
TabbedPlaceNavigationComponent.decorators = [
|
|
3456
3502
|
{ type: Component, args: [{
|
|
3457
3503
|
selector: 'angular-ui-powerups-tabbed-place-navigation',
|
|
3458
|
-
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",
|
|
3459
3505
|
styles: [""]
|
|
3460
3506
|
}] }
|
|
3461
3507
|
];
|
|
@@ -3513,7 +3559,8 @@ AngularUiPowerupsModule.decorators = [
|
|
|
3513
3559
|
NumberInputComponent,
|
|
3514
3560
|
StringInputComponent,
|
|
3515
3561
|
PasswordInputComponent,
|
|
3516
|
-
SelectInputComponent
|
|
3562
|
+
SelectInputComponent,
|
|
3563
|
+
NoopComponent
|
|
3517
3564
|
],
|
|
3518
3565
|
imports: [
|
|
3519
3566
|
CommonModule,
|
|
@@ -3534,7 +3581,8 @@ AngularUiPowerupsModule.decorators = [
|
|
|
3534
3581
|
PasswordInputComponent,
|
|
3535
3582
|
SelectInputComponent,
|
|
3536
3583
|
InteractionModule,
|
|
3537
|
-
PlaceModule
|
|
3584
|
+
PlaceModule,
|
|
3585
|
+
NoopComponent
|
|
3538
3586
|
]
|
|
3539
3587
|
},] }
|
|
3540
3588
|
];
|
|
@@ -3874,16 +3922,24 @@ if (false) {
|
|
|
3874
3922
|
* @fileoverview added by tsickle
|
|
3875
3923
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
3876
3924
|
*/
|
|
3877
|
-
class
|
|
3925
|
+
class InteractionGuard {
|
|
3878
3926
|
/**
|
|
3879
3927
|
* @param {?} router
|
|
3880
3928
|
* @param {?} injector
|
|
3881
3929
|
* @param {?} interactionContext
|
|
3882
3930
|
*/
|
|
3883
|
-
constructor(router, injector, interactionContext) {
|
|
3884
|
-
this.router = router;
|
|
3885
|
-
this.injector = injector;
|
|
3886
|
-
this.interactionContext = interactionContext;
|
|
3931
|
+
constructor(router, injector, interactionContext) {
|
|
3932
|
+
this.router = router;
|
|
3933
|
+
this.injector = injector;
|
|
3934
|
+
this.interactionContext = interactionContext;
|
|
3935
|
+
}
|
|
3936
|
+
/**
|
|
3937
|
+
* @param {?} route
|
|
3938
|
+
* @param {?} state
|
|
3939
|
+
* @return {?}
|
|
3940
|
+
*/
|
|
3941
|
+
canActivate(route, state) {
|
|
3942
|
+
return true;
|
|
3887
3943
|
}
|
|
3888
3944
|
/**
|
|
3889
3945
|
* @param {?} component
|
|
@@ -3896,34 +3952,46 @@ class CloseInteractionGuard {
|
|
|
3896
3952
|
return !this.interactionContext.isActive();
|
|
3897
3953
|
}
|
|
3898
3954
|
}
|
|
3899
|
-
|
|
3955
|
+
InteractionGuard.decorators = [
|
|
3900
3956
|
{ type: Injectable, args: [{
|
|
3901
3957
|
providedIn: 'root'
|
|
3902
3958
|
},] }
|
|
3903
3959
|
];
|
|
3904
3960
|
/** @nocollapse */
|
|
3905
|
-
|
|
3961
|
+
InteractionGuard.ctorParameters = () => [
|
|
3906
3962
|
{ type: Router },
|
|
3907
3963
|
{ type: Injector },
|
|
3908
3964
|
{ type: InteractionContext }
|
|
3909
3965
|
];
|
|
3910
|
-
/** @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);
|
|
3911
3979
|
if (false) {
|
|
3912
3980
|
/**
|
|
3913
3981
|
* @type {?}
|
|
3914
3982
|
* @private
|
|
3915
3983
|
*/
|
|
3916
|
-
|
|
3984
|
+
InteractionGuard.prototype.router;
|
|
3917
3985
|
/**
|
|
3918
3986
|
* @type {?}
|
|
3919
3987
|
* @private
|
|
3920
3988
|
*/
|
|
3921
|
-
|
|
3989
|
+
InteractionGuard.prototype.injector;
|
|
3922
3990
|
/**
|
|
3923
3991
|
* @type {?}
|
|
3924
3992
|
* @private
|
|
3925
3993
|
*/
|
|
3926
|
-
|
|
3994
|
+
InteractionGuard.prototype.interactionContext;
|
|
3927
3995
|
}
|
|
3928
3996
|
|
|
3929
3997
|
/**
|
|
@@ -4000,26 +4068,314 @@ function Place(options) {
|
|
|
4000
4068
|
}
|
|
4001
4069
|
})(Place || (Place = {}));
|
|
4002
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
|
+
|
|
4003
4274
|
/**
|
|
4004
4275
|
* @fileoverview added by tsickle
|
|
4005
4276
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4006
4277
|
*/
|
|
4007
4278
|
/**
|
|
4008
4279
|
* @record
|
|
4280
|
+
* @template T
|
|
4009
4281
|
*/
|
|
4010
|
-
function
|
|
4282
|
+
function ParameterSnapshot() { }
|
|
4011
4283
|
if (false) {
|
|
4012
4284
|
/** @type {?} */
|
|
4013
|
-
|
|
4285
|
+
ParameterSnapshot.prototype.definition;
|
|
4286
|
+
/** @type {?} */
|
|
4287
|
+
ParameterSnapshot.prototype.value;
|
|
4014
4288
|
/**
|
|
4015
4289
|
* @return {?}
|
|
4016
4290
|
*/
|
|
4017
|
-
|
|
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()
|
|
4018
4312
|
/**
|
|
4019
|
-
* @param {?}
|
|
4313
|
+
* @param {?} visit
|
|
4020
4314
|
* @return {?}
|
|
4021
4315
|
*/
|
|
4022
|
-
|
|
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;
|
|
4023
4379
|
}
|
|
4024
4380
|
|
|
4025
4381
|
/**
|
|
@@ -4041,6 +4397,16 @@ class LeavePlaceGuard {
|
|
|
4041
4397
|
this.interactionContext = interactionContext;
|
|
4042
4398
|
this.angularLocation = angularLocation;
|
|
4043
4399
|
}
|
|
4400
|
+
/**
|
|
4401
|
+
* @private
|
|
4402
|
+
* @param {?} nextState
|
|
4403
|
+
* @param {?} placeDefinitionPath
|
|
4404
|
+
* @return {?}
|
|
4405
|
+
*/
|
|
4406
|
+
isLeavingTheCurrentPlace(nextState, placeDefinitionPath) {
|
|
4407
|
+
// TODO: this will break with child routes... need to examine the router states properly.
|
|
4408
|
+
return !nextState.url.startsWith(placeDefinitionPath);
|
|
4409
|
+
}
|
|
4044
4410
|
/**
|
|
4045
4411
|
* @param {?} component
|
|
4046
4412
|
* @param {?} currentRoute
|
|
@@ -4095,41 +4461,65 @@ class LeavePlaceGuard {
|
|
|
4095
4461
|
// currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
|
|
4096
4462
|
// nextStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c"
|
|
4097
4463
|
// }
|
|
4464
|
+
// TODO: Add tests
|
|
4098
4465
|
if (this.placeRouter.navigationSession.alreadyAccepted(component)) {
|
|
4466
|
+
// We'll get called multiple times if there's any parameter sanitisation so
|
|
4467
|
+
// we always return true if we accepted on a previous cycle of the current
|
|
4468
|
+
// navigation session.
|
|
4099
4469
|
return true;
|
|
4100
4470
|
}
|
|
4101
4471
|
else {
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
//
|
|
4109
|
-
//
|
|
4110
|
-
if (
|
|
4472
|
+
/** @type {?} */
|
|
4473
|
+
const self = this;
|
|
4474
|
+
/** @type {?} */
|
|
4475
|
+
let canLeave = true;
|
|
4476
|
+
if (this.isLeavingTheCurrentPlace(nextState, placeDefinitionPath)) {
|
|
4477
|
+
// we check the interaction first, so that components that don't need to check if they're in an
|
|
4478
|
+
// interaction during the canDeactivate cycle.
|
|
4479
|
+
// TODO: Add tests: show dialog -> hit back -> same route
|
|
4480
|
+
if (this.interactionContext.isActive()) {
|
|
4111
4481
|
canLeave = false;
|
|
4112
|
-
console.log(
|
|
4482
|
+
console.log('cancelling', { activity: this.interactionContext.currentActivity });
|
|
4113
4483
|
this.interactionContext.currentActivity.cancel(null);
|
|
4114
4484
|
}
|
|
4115
|
-
//
|
|
4116
|
-
//
|
|
4485
|
+
// No interaction in progress, so ask the component .
|
|
4486
|
+
// This may start an interaction, hence checking the interaction context above. I.e. if the place pops up the dialog, and
|
|
4487
|
+
// the user clicks back again, we'll re-enter here and go bang when the component tries to open another
|
|
4488
|
+
// dialog.
|
|
4117
4489
|
if (canLeave) {
|
|
4118
|
-
|
|
4490
|
+
// TODO: Add tests: hit back -> confirm leave dialog -> hit back -> close dialog -> hit back -> confirm leave dialog.
|
|
4491
|
+
canLeave = yield component.canDeactivate();
|
|
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
|
|
4498
|
+
}
|
|
4499
|
+
else {
|
|
4500
|
+
if (this.interactionContext.isActive()) {
|
|
4501
|
+
console.log('cancelling', { activity: this.interactionContext.currentActivity });
|
|
4502
|
+
this.interactionContext.currentActivity.cancel(null);
|
|
4503
|
+
canLeave = false;
|
|
4119
4504
|
}
|
|
4120
4505
|
else {
|
|
4121
|
-
|
|
4122
|
-
// See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
4123
|
-
if (this.placeRouter.navigationSession.isPopState) {
|
|
4124
|
-
console.log('cancelled during popstate');
|
|
4125
|
-
this.angularLocation.go(this.placeRouter.navigationSession.initialUrl);
|
|
4126
|
-
}
|
|
4506
|
+
canLeave = true;
|
|
4127
4507
|
}
|
|
4128
|
-
|
|
4508
|
+
}
|
|
4509
|
+
if (canLeave) {
|
|
4510
|
+
// We'll get called multiple times if there's any parameter sanitisation so
|
|
4511
|
+
// we remember the acceptance for the duration of the current navigation session.
|
|
4512
|
+
self.placeRouter.navigationSession.rememberAcceptanceOf(component);
|
|
4129
4513
|
}
|
|
4130
4514
|
else {
|
|
4131
|
-
|
|
4515
|
+
// Angular doesn't preserve the url when a guard cancels the back button.
|
|
4516
|
+
// See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
4517
|
+
if (this.placeRouter.navigationSession.isPopState) {
|
|
4518
|
+
console.log('cancelled during popstate');
|
|
4519
|
+
this.angularLocation.go(this.placeRouter.navigationSession.popStateReturnUrl);
|
|
4520
|
+
}
|
|
4132
4521
|
}
|
|
4522
|
+
return canLeave;
|
|
4133
4523
|
}
|
|
4134
4524
|
});
|
|
4135
4525
|
}
|
|
@@ -4176,41 +4566,62 @@ if (false) {
|
|
|
4176
4566
|
*/
|
|
4177
4567
|
class PlaceRouteGuard {
|
|
4178
4568
|
/**
|
|
4569
|
+
* @param {?} router
|
|
4179
4570
|
* @param {?} placeRouter
|
|
4571
|
+
* @param {?} placeHistory
|
|
4180
4572
|
* @param {?} injector
|
|
4181
4573
|
*/
|
|
4182
|
-
constructor(placeRouter, injector) {
|
|
4574
|
+
constructor(router, placeRouter, placeHistory, injector) {
|
|
4575
|
+
this.router = router;
|
|
4183
4576
|
this.placeRouter = placeRouter;
|
|
4577
|
+
this.placeHistory = placeHistory;
|
|
4184
4578
|
this.injector = injector;
|
|
4185
4579
|
}
|
|
4580
|
+
// @Trace()
|
|
4186
4581
|
/**
|
|
4187
4582
|
* @param {?} activatedRoute
|
|
4188
4583
|
* @param {?} state
|
|
4189
4584
|
* @return {?}
|
|
4190
4585
|
*/
|
|
4191
4586
|
canActivate(activatedRoute, state) {
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
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
|
+
});
|
|
4205
4616
|
}
|
|
4206
4617
|
else {
|
|
4207
4618
|
return true;
|
|
4208
4619
|
}
|
|
4209
|
-
}
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
}
|
|
4620
|
+
}
|
|
4621
|
+
else {
|
|
4622
|
+
return lang.illegalState(`expected component to be an instance of PlaceComponent, got ${activatedRoute.component}`);
|
|
4623
|
+
}
|
|
4624
|
+
});
|
|
4214
4625
|
}
|
|
4215
4626
|
}
|
|
4216
4627
|
PlaceRouteGuard.decorators = [
|
|
@@ -4220,205 +4631,163 @@ PlaceRouteGuard.decorators = [
|
|
|
4220
4631
|
];
|
|
4221
4632
|
/** @nocollapse */
|
|
4222
4633
|
PlaceRouteGuard.ctorParameters = () => [
|
|
4634
|
+
{ type: Router },
|
|
4223
4635
|
{ type: PlaceRouter },
|
|
4636
|
+
{ type: PlaceHistory },
|
|
4224
4637
|
{ type: Injector }
|
|
4225
4638
|
];
|
|
4226
|
-
/** @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" });
|
|
4227
4640
|
if (false) {
|
|
4228
4641
|
/**
|
|
4229
4642
|
* @type {?}
|
|
4230
4643
|
* @private
|
|
4231
4644
|
*/
|
|
4232
|
-
PlaceRouteGuard.prototype.
|
|
4645
|
+
PlaceRouteGuard.prototype.router;
|
|
4233
4646
|
/**
|
|
4234
4647
|
* @type {?}
|
|
4235
4648
|
* @private
|
|
4236
4649
|
*/
|
|
4237
|
-
PlaceRouteGuard.prototype.
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
* @fileoverview added by tsickle
|
|
4242
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4243
|
-
*/
|
|
4244
|
-
/**
|
|
4245
|
-
* @record
|
|
4246
|
-
*/
|
|
4247
|
-
function JsonArray() { }
|
|
4248
|
-
/**
|
|
4249
|
-
* @record
|
|
4250
|
-
*/
|
|
4251
|
-
function JsonMap() { }
|
|
4252
|
-
|
|
4253
|
-
/**
|
|
4254
|
-
* @fileoverview added by tsickle
|
|
4255
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4256
|
-
*/
|
|
4257
|
-
/**
|
|
4258
|
-
* @record
|
|
4259
|
-
* @template T
|
|
4260
|
-
*/
|
|
4261
|
-
function ParameterOptions() { }
|
|
4262
|
-
if (false) {
|
|
4263
|
-
/** @type {?|undefined} */
|
|
4264
|
-
ParameterOptions.prototype.as;
|
|
4265
|
-
/** @type {?|undefined} */
|
|
4266
|
-
ParameterOptions.prototype.optional;
|
|
4267
|
-
/** @type {?|undefined} */
|
|
4268
|
-
ParameterOptions.prototype.remember;
|
|
4269
|
-
/** @type {?|undefined} */
|
|
4270
|
-
ParameterOptions.prototype.defaultValue;
|
|
4271
|
-
}
|
|
4272
|
-
/**
|
|
4273
|
-
* @record
|
|
4274
|
-
* @template T
|
|
4275
|
-
*/
|
|
4276
|
-
function ListParameterOptions() { }
|
|
4277
|
-
if (false) {
|
|
4278
|
-
/** @type {?|undefined} */
|
|
4279
|
-
ListParameterOptions.prototype.as;
|
|
4280
|
-
/** @type {?|undefined} */
|
|
4281
|
-
ListParameterOptions.prototype.optional;
|
|
4282
|
-
/** @type {?|undefined} */
|
|
4283
|
-
ListParameterOptions.prototype.remember;
|
|
4284
|
-
/** @type {?|undefined} */
|
|
4285
|
-
ListParameterOptions.prototype.defaultValue;
|
|
4286
|
-
}
|
|
4287
|
-
/**
|
|
4288
|
-
* @template T
|
|
4289
|
-
* @param {?} type
|
|
4290
|
-
* @param {?=} options
|
|
4291
|
-
* @return {?}
|
|
4292
|
-
*/
|
|
4293
|
-
function RouteId(type, options) {
|
|
4294
|
-
return (/**
|
|
4295
|
-
* @param {?} prototype
|
|
4296
|
-
* @param {?} propertyKey
|
|
4297
|
-
* @return {?}
|
|
4298
|
-
*/
|
|
4299
|
-
(prototype, propertyKey) => {
|
|
4300
|
-
/** @type {?} */
|
|
4301
|
-
const param = new ParameterDefinition.RouteId(propertyKey.toString(), type, options);
|
|
4302
|
-
Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
|
|
4303
|
-
UseDelegate()(prototype, propertyKey);
|
|
4304
|
-
});
|
|
4305
|
-
}
|
|
4306
|
-
/**
|
|
4307
|
-
* @template T
|
|
4308
|
-
* @param {?} type
|
|
4309
|
-
* @param {?=} options
|
|
4310
|
-
* @return {?}
|
|
4311
|
-
*/
|
|
4312
|
-
function RouteParameter(type, options) {
|
|
4313
|
-
return (/**
|
|
4314
|
-
* @param {?} prototype
|
|
4315
|
-
* @param {?} propertyKey
|
|
4316
|
-
* @return {?}
|
|
4650
|
+
PlaceRouteGuard.prototype.placeRouter;
|
|
4651
|
+
/**
|
|
4652
|
+
* @type {?}
|
|
4653
|
+
* @private
|
|
4317
4654
|
*/
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
UseDelegate()(prototype, propertyKey);
|
|
4323
|
-
});
|
|
4324
|
-
}
|
|
4325
|
-
/**
|
|
4326
|
-
* @template E
|
|
4327
|
-
* @param {?} elementType
|
|
4328
|
-
* @param {?=} options
|
|
4329
|
-
* @return {?}
|
|
4330
|
-
*/
|
|
4331
|
-
function RouteParameterList(elementType, options) {
|
|
4332
|
-
return (/**
|
|
4333
|
-
* @param {?} prototype
|
|
4334
|
-
* @param {?} propertyKey
|
|
4335
|
-
* @return {?}
|
|
4655
|
+
PlaceRouteGuard.prototype.placeHistory;
|
|
4656
|
+
/**
|
|
4657
|
+
* @type {?}
|
|
4658
|
+
* @private
|
|
4336
4659
|
*/
|
|
4337
|
-
|
|
4338
|
-
/** @type {?} */
|
|
4339
|
-
const param = new ParameterDefinition.ArrayParameter(propertyKey.toString(), elementType, options);
|
|
4340
|
-
Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
|
|
4341
|
-
UseDelegate()(prototype, propertyKey);
|
|
4342
|
-
});
|
|
4660
|
+
PlaceRouteGuard.prototype.injector;
|
|
4343
4661
|
}
|
|
4344
|
-
|
|
4345
|
-
/**
|
|
4346
|
-
* @fileoverview added by tsickle
|
|
4347
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4348
|
-
*/
|
|
4349
|
-
/**
|
|
4350
|
-
* @record
|
|
4351
|
-
* @template S
|
|
4352
|
-
*/
|
|
4353
|
-
function ParameterSanitiser() { }
|
|
4354
|
-
if (false) {
|
|
4662
|
+
(function (PlaceRouteGuard) {
|
|
4355
4663
|
/**
|
|
4356
|
-
*
|
|
4357
|
-
*
|
|
4358
|
-
*
|
|
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.
|
|
4359
4667
|
*/
|
|
4360
|
-
|
|
4361
|
-
}
|
|
4362
|
-
|
|
4363
|
-
/**
|
|
4364
|
-
* @fileoverview added by tsickle
|
|
4365
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4366
|
-
*/
|
|
4367
|
-
// WARNING: interface has both a type and a value, skipping emit
|
|
4368
|
-
var ParameterType;
|
|
4369
|
-
(function (ParameterType) {
|
|
4370
|
-
class StringType {
|
|
4668
|
+
class ConsolidatedParameterMap {
|
|
4371
4669
|
/**
|
|
4372
|
-
* @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
|
|
4373
4686
|
* @return {?}
|
|
4374
4687
|
*/
|
|
4375
|
-
|
|
4376
|
-
|
|
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);
|
|
4377
4696
|
}
|
|
4378
4697
|
/**
|
|
4379
|
-
* @param {?}
|
|
4698
|
+
* @param {?} name
|
|
4380
4699
|
* @return {?}
|
|
4381
4700
|
*/
|
|
4382
|
-
|
|
4383
|
-
|
|
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);
|
|
4384
4709
|
}
|
|
4385
|
-
}
|
|
4386
|
-
class NumberType {
|
|
4387
4710
|
/**
|
|
4388
|
-
* @param {?}
|
|
4711
|
+
* @param {?} name
|
|
4389
4712
|
* @return {?}
|
|
4390
4713
|
*/
|
|
4391
|
-
|
|
4392
|
-
return
|
|
4714
|
+
has(name) {
|
|
4715
|
+
return !!this.paramMaps.find((/**
|
|
4716
|
+
* @param {?} m
|
|
4717
|
+
* @return {?}
|
|
4718
|
+
*/
|
|
4719
|
+
m => m.has(name)));
|
|
4393
4720
|
}
|
|
4394
4721
|
/**
|
|
4395
|
-
* @param {?} value
|
|
4396
4722
|
* @return {?}
|
|
4397
4723
|
*/
|
|
4398
|
-
|
|
4399
|
-
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)), []);
|
|
4400
4731
|
}
|
|
4401
4732
|
}
|
|
4402
|
-
|
|
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) {
|
|
4403
4740
|
/**
|
|
4404
|
-
* @
|
|
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
|
|
4405
4755
|
* @return {?}
|
|
4406
4756
|
*/
|
|
4407
|
-
|
|
4408
|
-
return
|
|
4757
|
+
get(name) {
|
|
4758
|
+
return this.params[name];
|
|
4409
4759
|
}
|
|
4410
4760
|
/**
|
|
4411
|
-
* @param {?}
|
|
4761
|
+
* @param {?} name
|
|
4412
4762
|
* @return {?}
|
|
4413
4763
|
*/
|
|
4414
|
-
|
|
4415
|
-
|
|
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);
|
|
4416
4781
|
}
|
|
4417
4782
|
}
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4783
|
+
if (false) {
|
|
4784
|
+
/**
|
|
4785
|
+
* @type {?}
|
|
4786
|
+
* @private
|
|
4787
|
+
*/
|
|
4788
|
+
ParamMapAdapter.prototype.params;
|
|
4789
|
+
}
|
|
4790
|
+
})(PlaceRouteGuard || (PlaceRouteGuard = {}));
|
|
4422
4791
|
|
|
4423
4792
|
/**
|
|
4424
4793
|
* @fileoverview added by tsickle
|
|
@@ -4440,5 +4809,5 @@ var ParameterType;
|
|
|
4440
4809
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4441
4810
|
*/
|
|
4442
4811
|
|
|
4443
|
-
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 };
|
|
4444
4813
|
//# sourceMappingURL=coolon-angular-ui-powerups.js.map
|