@coolon/angular-ui-powerups 0.0.101 → 0.0.102
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 +896 -620
- 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.metadata.json +1 -1
- package/esm2015/coolon-angular-ui-powerups.js +2 -2
- package/esm2015/index.js +2 -2
- package/esm2015/lib/interaction/components/activity-container/activity-container.component.js +2 -1
- package/esm2015/lib/interaction/interaction-context-base.js +21 -8
- package/esm2015/lib/interaction/interaction-context.js +56 -3
- package/esm2015/lib/interaction/services/interaction.service.js +11 -7
- package/esm2015/lib/place/guards/navigation-state.js +216 -135
- package/esm2015/lib/place/guards/place-component-deactivation-handler.js +63 -28
- package/esm2015/lib/place/guards/place.guard.js +215 -0
- package/esm2015/lib/place/index.js +2 -3
- package/esm2015/lib/place/place-router.js +34 -36
- package/esm2015/lib/place/url-snapshot.js +69 -53
- package/esm2015/public_api.js +2 -2
- package/esm5/coolon-angular-ui-powerups.js +2 -2
- package/esm5/index.js +2 -2
- package/esm5/lib/interaction/components/activity-container/activity-container.component.js +2 -1
- package/esm5/lib/interaction/interaction-context-base.js +25 -8
- package/esm5/lib/interaction/interaction-context.js +88 -10
- package/esm5/lib/interaction/services/interaction.service.js +17 -8
- package/esm5/lib/place/guards/navigation-state.js +280 -162
- package/esm5/lib/place/guards/place-component-deactivation-handler.js +73 -27
- package/esm5/lib/place/guards/place.guard.js +300 -0
- package/esm5/lib/place/index.js +2 -3
- package/esm5/lib/place/place-router.js +52 -39
- package/esm5/lib/place/url-snapshot.js +85 -58
- package/esm5/public_api.js +2 -2
- package/fesm2015/coolon-angular-ui-powerups.js +661 -519
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +896 -619
- package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/interaction/interaction-context-base.d.ts +3 -1
- package/lib/interaction/interaction-context.d.ts +9 -2
- package/lib/interaction/services/interaction.service.d.ts +2 -2
- package/lib/place/guards/navigation-state.d.ts +44 -38
- package/lib/place/guards/place-component-deactivation-handler.d.ts +7 -4
- package/lib/place/guards/{abstract-place.guard.d.ts → place.guard.d.ts} +8 -3
- package/lib/place/index.d.ts +1 -2
- package/lib/place/place-router.d.ts +2 -0
- package/lib/place/url-snapshot.d.ts +14 -9
- package/package.json +1 -1
- package/schematics/place-routes/place-def.js +1 -0
- package/schematics/place-routes/place-def.js.map +1 -1
- package/schematics/place-routes/templates/place-routes.ts.template +10 -11
- package/esm2015/lib/place/guards/abstract-place.guard.js +0 -166
- package/esm2015/lib/place/guards/interaction.guard.js +0 -121
- package/esm5/lib/place/guards/abstract-place.guard.js +0 -213
- package/esm5/lib/place/guards/interaction.guard.js +0 -133
- package/lib/place/guards/interaction.guard.d.ts +0 -17
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { DOCUMENT, CommonModule, Location } from '@angular/common';
|
|
2
|
-
import { Directive, ElementRef, Inject, Input, HostListener, NgZone, NgModule, EventEmitter, Output, Component, InjectionToken, Injector, ComponentFactoryResolver, ViewContainerRef, ViewChild, ViewChildren, Injectable, ɵɵdefineInjectable, ɵɵinject, Optional, SkipSelf, HostBinding
|
|
2
|
+
import { Directive, ElementRef, Inject, Input, HostListener, NgZone, NgModule, EventEmitter, Output, Component, InjectionToken, Injector, ComponentFactoryResolver, ViewContainerRef, ViewChild, ViewChildren, Injectable, ɵɵdefineInjectable, ɵɵinject, Optional, SkipSelf, HostBinding } from '@angular/core';
|
|
3
3
|
import { FormsModule } from '@angular/forms';
|
|
4
4
|
import { MatInputModule, MatFormFieldModule, MatSelectModule, MatButtonModule, MatDialogModule, MatTabsModule as MatTabsModule$1, MatProgressSpinnerModule, MatDialog } from '@angular/material';
|
|
5
5
|
import { MatTabsModule } from '@angular/material/tabs';
|
|
6
6
|
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
7
|
-
import { GarbageCollector, DelegatingValueModel, assert, UnaryCommand, lang, Dsl, Logger, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, DelegatingListModel, Deferred, MutableStream, MutableValueModel, MutableListModel, Binding,
|
|
7
|
+
import { GarbageCollector, DelegatingValueModel, assert, UnaryCommand, lang, Dsl, Logger, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, Trace, DelegatingListModel, Deferred, MutableStream, MutableValueModel, MutableListModel, Binding, Guard, StoreInValueModel, Command, OptionsHelper, ValueHolder } from '@coolon/pectin';
|
|
8
8
|
import { __decorate, __metadata, __awaiter } from 'tslib';
|
|
9
9
|
import { PortalModule } from '@angular/cdk/portal';
|
|
10
|
-
import { RouterModule,
|
|
11
|
-
import ___default, { last, isNil, isEqual } from 'lodash';
|
|
10
|
+
import { RouterModule, NavigationStart, NavigationCancel, UrlSegment, NavigationEnd, NavigationError, Router, UrlSerializer } from '@angular/router';
|
|
12
11
|
import { assert as assert$1, Opts, Klass } from '@coolon/typescript-utilities';
|
|
13
12
|
import { MatIconModule } from '@angular/material/icon';
|
|
14
13
|
import { MatListModule } from '@angular/material/list';
|
|
@@ -16,6 +15,7 @@ import { MatTooltipModule } from '@angular/material/tooltip';
|
|
|
16
15
|
import { Memoize } from '@typescript-plus/fast-memoize-decorator/dist/src';
|
|
17
16
|
import { Memoize as Memoize$1 } from '@typescript-plus/fast-memoize-decorator';
|
|
18
17
|
import 'reflect-metadata';
|
|
18
|
+
import ___default, { isNil, isEqual } from 'lodash';
|
|
19
19
|
import { style, query, group, animate, trigger, transition } from '@angular/animations';
|
|
20
20
|
import ResizeObserver from 'resize-observer-polyfill';
|
|
21
21
|
import { MatDialogConfig, MAT_DIALOG_DEFAULT_OPTIONS, MatDialog as MatDialog$1 } from '@angular/material/dialog';
|
|
@@ -912,16 +912,68 @@ class InteractionContext extends GarbageCollector {
|
|
|
912
912
|
assert.isFalsey(this.isActive());
|
|
913
913
|
super.dispose();
|
|
914
914
|
}
|
|
915
|
+
/**
|
|
916
|
+
* Cancels the current activity and returns true the context is no longer active, false if
|
|
917
|
+
* there is still another activity running.
|
|
918
|
+
* @return {?}
|
|
919
|
+
*/
|
|
920
|
+
cancelCurrentActivity() {
|
|
921
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
922
|
+
const { when } = Dsl.disposeWith(this);
|
|
923
|
+
/** @type {?} */
|
|
924
|
+
const activity = yield this.getCurrentActivity();
|
|
925
|
+
return new Promise((/**
|
|
926
|
+
* @param {?} resolve
|
|
927
|
+
* @return {?}
|
|
928
|
+
*/
|
|
929
|
+
resolve => {
|
|
930
|
+
when.valueOf(this.activeActivity)
|
|
931
|
+
.changes((/**
|
|
932
|
+
* @param {?} nextActivity
|
|
933
|
+
* @return {?}
|
|
934
|
+
*/
|
|
935
|
+
nextActivity => {
|
|
936
|
+
resolve(!nextActivity);
|
|
937
|
+
}), { once: true });
|
|
938
|
+
activity.cancel();
|
|
939
|
+
}));
|
|
940
|
+
});
|
|
941
|
+
}
|
|
942
|
+
/**
|
|
943
|
+
* @return {?}
|
|
944
|
+
*/
|
|
945
|
+
abort() {
|
|
946
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
947
|
+
assert.isTruthy(this.isActive());
|
|
948
|
+
/** @type {?} */
|
|
949
|
+
let count = 1;
|
|
950
|
+
yield this.cancelCurrentActivity();
|
|
951
|
+
console.log(`aborted -> ${count++}`);
|
|
952
|
+
while (this.isActive()) {
|
|
953
|
+
yield this.cancelCurrentActivity();
|
|
954
|
+
console.log(`aborted -> ${count++}`);
|
|
955
|
+
}
|
|
956
|
+
});
|
|
957
|
+
}
|
|
915
958
|
}
|
|
959
|
+
__decorate([
|
|
960
|
+
Trace(),
|
|
961
|
+
__metadata("design:type", Function),
|
|
962
|
+
__metadata("design:paramtypes", []),
|
|
963
|
+
__metadata("design:returntype", Promise)
|
|
964
|
+
], InteractionContext.prototype, "abort", null);
|
|
916
965
|
if (false) {
|
|
966
|
+
/** @type {?} */
|
|
967
|
+
InteractionContext.prototype.active;
|
|
917
968
|
/** @type {?} */
|
|
918
969
|
InteractionContext.prototype.activityList;
|
|
919
970
|
/** @type {?} */
|
|
920
|
-
InteractionContext.prototype.
|
|
971
|
+
InteractionContext.prototype.activeActivity;
|
|
921
972
|
/**
|
|
922
973
|
* Returns the activity that is currently active.
|
|
923
974
|
* This model is only updated in the next tick after the view has been updated.
|
|
924
975
|
* @abstract
|
|
976
|
+
* @protected
|
|
925
977
|
* @return {?}
|
|
926
978
|
*/
|
|
927
979
|
InteractionContext.prototype.getCurrentActivity = function () { };
|
|
@@ -1110,13 +1162,14 @@ class InteractionContextBase extends InteractionContext {
|
|
|
1110
1162
|
*/
|
|
1111
1163
|
this._activityListDelegate = new DelegatingListModel();
|
|
1112
1164
|
const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
|
|
1113
|
-
|
|
1114
|
-
|
|
1165
|
+
this._currentActivity = chain(this.activityList).last();
|
|
1166
|
+
when.valueOf(this._currentActivity).becomesTruthy((/**
|
|
1167
|
+
* @param {?} activity
|
|
1115
1168
|
* @return {?}
|
|
1116
1169
|
*/
|
|
1117
|
-
(
|
|
1170
|
+
(activity) => {
|
|
1118
1171
|
if (this.deferredGetCurrentActivity) {
|
|
1119
|
-
this.deferredGetCurrentActivity.resolve(
|
|
1172
|
+
this.deferredGetCurrentActivity.resolve(activity);
|
|
1120
1173
|
this.deferredGetCurrentActivity = null;
|
|
1121
1174
|
}
|
|
1122
1175
|
}));
|
|
@@ -1135,6 +1188,12 @@ class InteractionContextBase extends InteractionContext {
|
|
|
1135
1188
|
get activityList() {
|
|
1136
1189
|
return this._activityListDelegate.readonly;
|
|
1137
1190
|
}
|
|
1191
|
+
/**
|
|
1192
|
+
* @return {?}
|
|
1193
|
+
*/
|
|
1194
|
+
get activeActivity() {
|
|
1195
|
+
return this._currentActivity;
|
|
1196
|
+
}
|
|
1138
1197
|
/**
|
|
1139
1198
|
* Returns the activity that is currently active.
|
|
1140
1199
|
* This model is only updated in the next tick after the view has been updated.
|
|
@@ -1151,12 +1210,14 @@ class InteractionContextBase extends InteractionContext {
|
|
|
1151
1210
|
return this.deferredGetCurrentActivity.promise;
|
|
1152
1211
|
}
|
|
1153
1212
|
else {
|
|
1154
|
-
if (this.
|
|
1213
|
+
if (!this._currentActivity.value) {
|
|
1214
|
+
// we'be been asked before we've got any activities, create a deferred promise
|
|
1215
|
+
// that we resolve when the list populates.
|
|
1155
1216
|
this.deferredGetCurrentActivity = Deferred.defer();
|
|
1156
1217
|
return this.deferredGetCurrentActivity.promise;
|
|
1157
1218
|
}
|
|
1158
1219
|
else {
|
|
1159
|
-
return
|
|
1220
|
+
return this._currentActivity.value;
|
|
1160
1221
|
}
|
|
1161
1222
|
}
|
|
1162
1223
|
}
|
|
@@ -1230,6 +1291,11 @@ if (false) {
|
|
|
1230
1291
|
* @private
|
|
1231
1292
|
*/
|
|
1232
1293
|
InteractionContextBase.prototype.deferredGetCurrentActivity;
|
|
1294
|
+
/**
|
|
1295
|
+
* @type {?}
|
|
1296
|
+
* @private
|
|
1297
|
+
*/
|
|
1298
|
+
InteractionContextBase.prototype._currentActivity;
|
|
1233
1299
|
/**
|
|
1234
1300
|
* @abstract
|
|
1235
1301
|
* @protected
|
|
@@ -1589,6 +1655,7 @@ class ActivityContainerComponent extends InteractionContextBase {
|
|
|
1589
1655
|
* @return {?}
|
|
1590
1656
|
*/
|
|
1591
1657
|
finishInitialActivity() {
|
|
1658
|
+
this.updateActivityList();
|
|
1592
1659
|
this._initialActivityOutletContext.value = null;
|
|
1593
1660
|
this.initialActivityOutletContextEvent.emit(null);
|
|
1594
1661
|
}
|
|
@@ -1778,6 +1845,12 @@ class InteractionService {
|
|
|
1778
1845
|
isActive() {
|
|
1779
1846
|
return this.active.value;
|
|
1780
1847
|
}
|
|
1848
|
+
/**
|
|
1849
|
+
* @return {?}
|
|
1850
|
+
*/
|
|
1851
|
+
isModalActive() {
|
|
1852
|
+
return this.modelInteractionActive.value;
|
|
1853
|
+
}
|
|
1781
1854
|
/**
|
|
1782
1855
|
* @param {?} disposable
|
|
1783
1856
|
* @return {?}
|
|
@@ -1795,14 +1868,13 @@ class InteractionService {
|
|
|
1795
1868
|
_registerInplaceInteractionContext(interactionContext) {
|
|
1796
1869
|
interactionContext.registerDisposable(new InteractionService.Monitor(`ip${++inplaceMonitorCount}`, interactionContext, this._activeInlineInteractionContextModel, this.exclusiveContext));
|
|
1797
1870
|
}
|
|
1871
|
+
// @Trace()
|
|
1798
1872
|
/**
|
|
1799
1873
|
* @return {?}
|
|
1800
1874
|
*/
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
return this._activeInteractionContext.value.getCurrentActivity();
|
|
1805
|
-
});
|
|
1875
|
+
getActiveContext() {
|
|
1876
|
+
assert$1.isTruthy(this.isActive());
|
|
1877
|
+
return this._activeInteractionContext.value;
|
|
1806
1878
|
}
|
|
1807
1879
|
/**
|
|
1808
1880
|
* Creates an interaction context that will prevent any other contexts from starting an
|
|
@@ -2894,57 +2966,89 @@ if (false) {
|
|
|
2894
2966
|
class PlaceComponentDeactivationHandler {
|
|
2895
2967
|
/**
|
|
2896
2968
|
* @param {?} component
|
|
2897
|
-
* @param {?}
|
|
2969
|
+
* @param {?} navigationState
|
|
2970
|
+
* @param {?} isPrimaryComponent
|
|
2898
2971
|
*/
|
|
2899
|
-
constructor(component,
|
|
2972
|
+
constructor(component, navigationState, isPrimaryComponent) {
|
|
2900
2973
|
this.component = component;
|
|
2901
|
-
this.
|
|
2974
|
+
this.navigationState = navigationState;
|
|
2975
|
+
this.isPrimaryComponent = isPrimaryComponent;
|
|
2976
|
+
}
|
|
2977
|
+
/**
|
|
2978
|
+
* @return {?}
|
|
2979
|
+
*/
|
|
2980
|
+
get interactionService() {
|
|
2981
|
+
return this.navigationState.interactionService;
|
|
2982
|
+
}
|
|
2983
|
+
/**
|
|
2984
|
+
* @return {?}
|
|
2985
|
+
*/
|
|
2986
|
+
get placeRouter() {
|
|
2987
|
+
return this.navigationState.placeRouter;
|
|
2902
2988
|
}
|
|
2903
2989
|
/**
|
|
2990
|
+
* @param {?} currentUrl
|
|
2904
2991
|
* @param {?} nextState
|
|
2905
2992
|
* @return {?}
|
|
2906
2993
|
*/
|
|
2907
|
-
canDeactivate(nextState) {
|
|
2994
|
+
canDeactivate(currentUrl, nextState) {
|
|
2908
2995
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2909
2996
|
// We'll get called multiple times if there's any parameter sanitisation so
|
|
2910
2997
|
// we always return true if we accepted promise from a previous cycle of the current
|
|
2911
2998
|
// navigation session.
|
|
2912
2999
|
if (!this.canDeactivatePromise) {
|
|
2913
|
-
|
|
3000
|
+
console.log(`creating deactivate promise for -> ${this.component.constructor.name}`);
|
|
3001
|
+
this.canDeactivatePromise = this.canDeactivateComponent(currentUrl, nextState);
|
|
2914
3002
|
}
|
|
2915
3003
|
return this.canDeactivatePromise;
|
|
2916
3004
|
});
|
|
2917
3005
|
}
|
|
3006
|
+
// @Trace()
|
|
2918
3007
|
/**
|
|
2919
3008
|
* @protected
|
|
3009
|
+
* @param {?} currentUrl
|
|
2920
3010
|
* @param {?} nextState
|
|
2921
3011
|
* @return {?}
|
|
2922
3012
|
*/
|
|
2923
|
-
canDeactivateComponent(nextState) {
|
|
3013
|
+
canDeactivateComponent(currentUrl, nextState) {
|
|
2924
3014
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3015
|
+
console.log(this.navigationState.toString());
|
|
2925
3016
|
// Automatically cancel any active activities if the navigation session was triggered by the back button.
|
|
2926
|
-
//
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
3017
|
+
// If we handled more than just the pop state then it leads to the UI ignoring clicks and just cancelling things which is deeply disconcerting.
|
|
3018
|
+
if (this.navigationState.isPopState) {
|
|
3019
|
+
if (this.isPrimaryComponent && this.interactionService.isModalActive()) {
|
|
3020
|
+
/** @type {?} */
|
|
3021
|
+
const routeIds = this.placeRouter.getActiveInteractionIdsFromUrl(nextState.url);
|
|
3022
|
+
/** @type {?} */
|
|
3023
|
+
const currentIds = this.interactionService.activeInteractionContextIds.value;
|
|
3024
|
+
if (!isEqual(currentIds, routeIds)) {
|
|
3025
|
+
yield this.interactionService.getActiveContext().cancelCurrentActivity();
|
|
3026
|
+
return currentUrl.updateInteractionIds(this.interactionService.activeInteractionContextIds.value);
|
|
3027
|
+
}
|
|
3028
|
+
}
|
|
3029
|
+
else {
|
|
3030
|
+
// check if the component has an in place interaction
|
|
3031
|
+
if (this.component.interactionContext && this.component.interactionContext.isActive()) {
|
|
3032
|
+
yield this.component.interactionContext.cancelCurrentActivity();
|
|
3033
|
+
return currentUrl
|
|
3034
|
+
.updateInteractionIds(this.interactionService.activeInteractionContextIds.value);
|
|
3035
|
+
}
|
|
3036
|
+
}
|
|
2941
3037
|
}
|
|
2942
3038
|
// Ok, so now we're really leaving, so we ask the component if we should.;
|
|
2943
|
-
if (this.isNotJustAChangeInRouteId(nextState)
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
3039
|
+
if (this.isNotJustAChangeInRouteId(nextState)) {
|
|
3040
|
+
if (this.component.canDeactivate) {
|
|
3041
|
+
// No interaction in progress, so ask the component .
|
|
3042
|
+
// This may start an interaction, hence checking the interaction context before now. I.e. if the place pops up the dialog, and
|
|
3043
|
+
// the user clicks back again, we'll re-enter here and go bang when the component tries to open another dialog.
|
|
3044
|
+
return this.component.canDeactivate(this.navigationState.interactionContext);
|
|
3045
|
+
}
|
|
3046
|
+
// The component has an active interaction but no deactivation hook. Rather than guessing what to do
|
|
3047
|
+
// we'll just cancel the navigation and print a warning.
|
|
3048
|
+
if (this.component.interactionContext && this.component.interactionContext.isActive()) {
|
|
3049
|
+
console.warn('Route changed while component has active interaction, cancelling navigation');
|
|
3050
|
+
return false;
|
|
3051
|
+
}
|
|
2948
3052
|
}
|
|
2949
3053
|
return true;
|
|
2950
3054
|
});
|
|
@@ -2970,7 +3074,9 @@ if (false) {
|
|
|
2970
3074
|
/** @type {?} */
|
|
2971
3075
|
PlaceComponentDeactivationHandler.prototype.component;
|
|
2972
3076
|
/** @type {?} */
|
|
2973
|
-
PlaceComponentDeactivationHandler.prototype.
|
|
3077
|
+
PlaceComponentDeactivationHandler.prototype.navigationState;
|
|
3078
|
+
/** @type {?} */
|
|
3079
|
+
PlaceComponentDeactivationHandler.prototype.isPrimaryComponent;
|
|
2974
3080
|
}
|
|
2975
3081
|
|
|
2976
3082
|
/**
|
|
@@ -2989,6 +3095,12 @@ class NavigationState extends GarbageCollector {
|
|
|
2989
3095
|
this.context = context;
|
|
2990
3096
|
this._visits = new Map();
|
|
2991
3097
|
}
|
|
3098
|
+
/**
|
|
3099
|
+
* @return {?}
|
|
3100
|
+
*/
|
|
3101
|
+
get name() {
|
|
3102
|
+
return this.constructor.name;
|
|
3103
|
+
}
|
|
2992
3104
|
/**
|
|
2993
3105
|
* @return {?}
|
|
2994
3106
|
*/
|
|
@@ -3027,6 +3139,14 @@ class NavigationState extends GarbageCollector {
|
|
|
3027
3139
|
getVisitFor(placeDef) {
|
|
3028
3140
|
return this._visits.get(placeDef);
|
|
3029
3141
|
}
|
|
3142
|
+
/**
|
|
3143
|
+
* @param {?} visit
|
|
3144
|
+
* @param {?} initialUrl
|
|
3145
|
+
* @return {?}
|
|
3146
|
+
*/
|
|
3147
|
+
onPlaceNavigationStart(visit, initialUrl) {
|
|
3148
|
+
return this.illegalTransition('onPlaceNavigationStart');
|
|
3149
|
+
}
|
|
3030
3150
|
/**
|
|
3031
3151
|
* @param {?} event
|
|
3032
3152
|
* @return {?}
|
|
@@ -3038,28 +3158,28 @@ class NavigationState extends GarbageCollector {
|
|
|
3038
3158
|
* @param {?} event
|
|
3039
3159
|
* @return {?}
|
|
3040
3160
|
*/
|
|
3041
|
-
|
|
3161
|
+
onRouterStarted(event) {
|
|
3042
3162
|
return this.illegalTransition(event);
|
|
3043
3163
|
}
|
|
3044
3164
|
/**
|
|
3045
3165
|
* @param {?} event
|
|
3046
3166
|
* @return {?}
|
|
3047
3167
|
*/
|
|
3048
|
-
|
|
3168
|
+
onRouterCancelled(event) {
|
|
3049
3169
|
return this.illegalTransition(event);
|
|
3050
3170
|
}
|
|
3051
3171
|
/**
|
|
3052
3172
|
* @param {?} event
|
|
3053
3173
|
* @return {?}
|
|
3054
3174
|
*/
|
|
3055
|
-
|
|
3175
|
+
onRouterError(event) {
|
|
3056
3176
|
return this.illegalTransition(event);
|
|
3057
3177
|
}
|
|
3058
3178
|
/**
|
|
3059
3179
|
* @param {?} event
|
|
3060
3180
|
* @return {?}
|
|
3061
3181
|
*/
|
|
3062
|
-
|
|
3182
|
+
onRouterEnd(event) {
|
|
3063
3183
|
return this.illegalTransition(event);
|
|
3064
3184
|
}
|
|
3065
3185
|
/**
|
|
@@ -3071,10 +3191,11 @@ class NavigationState extends GarbageCollector {
|
|
|
3071
3191
|
}
|
|
3072
3192
|
/**
|
|
3073
3193
|
* @param {?} component
|
|
3074
|
-
* @param {?}
|
|
3194
|
+
* @param {?} currentUrl
|
|
3195
|
+
* @param {?} nextUrl
|
|
3075
3196
|
* @return {?}
|
|
3076
3197
|
*/
|
|
3077
|
-
canDeactivatePlace(component,
|
|
3198
|
+
canDeactivatePlace(component, currentUrl, nextUrl) {
|
|
3078
3199
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3079
3200
|
return this.illegalTransition('canDeactivatePlace');
|
|
3080
3201
|
});
|
|
@@ -3107,23 +3228,32 @@ class NavigationState extends GarbageCollector {
|
|
|
3107
3228
|
* @return {?}
|
|
3108
3229
|
*/
|
|
3109
3230
|
createTransitionStateFor(event) {
|
|
3110
|
-
// TODO: check if the event is purely for interaction context changes.
|
|
3111
3231
|
/** @type {?} */
|
|
3112
3232
|
const popstate = event.navigationTrigger === 'popstate';
|
|
3113
3233
|
return popstate ?
|
|
3114
|
-
|
|
3115
|
-
|
|
3234
|
+
this.interactionService.isActive() ?
|
|
3235
|
+
new NavigationState.InteractionPopStateTransition(this.context, this.currentRouterUrl()) :
|
|
3236
|
+
new NavigationState.PopStateTransition(this.context, this.currentRouterUrl())
|
|
3237
|
+
:
|
|
3238
|
+
this.interactionService.isActive() ?
|
|
3239
|
+
new NavigationState.InteractionTransition(this.context, this.currentRouterUrl()) :
|
|
3240
|
+
new NavigationState.NavigationTransition(this.context, this.currentRouterUrl());
|
|
3241
|
+
}
|
|
3242
|
+
/**
|
|
3243
|
+
* @protected
|
|
3244
|
+
* @return {?}
|
|
3245
|
+
*/
|
|
3246
|
+
createIdleState() {
|
|
3247
|
+
return this.interactionService.isActive() ?
|
|
3248
|
+
new NavigationState.IdleDuringInteraction(this.context, this.currentRouterUrl()) :
|
|
3249
|
+
new NavigationState.Idle(this.context);
|
|
3116
3250
|
}
|
|
3117
3251
|
/**
|
|
3118
3252
|
* @param {?} url
|
|
3119
3253
|
* @return {?}
|
|
3120
3254
|
*/
|
|
3121
3255
|
resetBrowserLocation(url) {
|
|
3122
|
-
|
|
3123
|
-
setTimeout((/**
|
|
3124
|
-
* @return {?}
|
|
3125
|
-
*/
|
|
3126
|
-
() => this.placeRouter.resetBrowserLocation(url)));
|
|
3256
|
+
this.placeRouter.resetBrowserLocation(url);
|
|
3127
3257
|
}
|
|
3128
3258
|
/**
|
|
3129
3259
|
* @return {?}
|
|
@@ -3182,11 +3312,22 @@ if (false) {
|
|
|
3182
3312
|
this.startingUrl = null;
|
|
3183
3313
|
this.isPopState = false;
|
|
3184
3314
|
}
|
|
3315
|
+
/**
|
|
3316
|
+
* @param {?} visit
|
|
3317
|
+
* @param {?} initialUrl
|
|
3318
|
+
* @return {?}
|
|
3319
|
+
*/
|
|
3320
|
+
onPlaceNavigationStart(visit, initialUrl) {
|
|
3321
|
+
/** @type {?} */
|
|
3322
|
+
const navigationTransition = new NavigationTransition(this.context, initialUrl);
|
|
3323
|
+
navigationTransition.storeVisit(visit);
|
|
3324
|
+
return navigationTransition;
|
|
3325
|
+
}
|
|
3185
3326
|
/**
|
|
3186
3327
|
* @param {?} event
|
|
3187
3328
|
* @return {?}
|
|
3188
3329
|
*/
|
|
3189
|
-
|
|
3330
|
+
onRouterStarted(event) {
|
|
3190
3331
|
// calling angularLocation.go() to clear back state can trigger router cycles to the current url if we don't ignore them
|
|
3191
3332
|
if (event.url === this.currentRouterUrl()) {
|
|
3192
3333
|
Logger.get(this).info(`navigation started to same url -> ${event.url}`);
|
|
@@ -3223,12 +3364,10 @@ if (false) {
|
|
|
3223
3364
|
class AbstractNavigationTransition extends NavigationState {
|
|
3224
3365
|
/**
|
|
3225
3366
|
* @param {?} context
|
|
3226
|
-
* @param {?} isPopState
|
|
3227
3367
|
* @param {?} startingUrl
|
|
3228
3368
|
*/
|
|
3229
|
-
constructor(context,
|
|
3369
|
+
constructor(context, startingUrl) {
|
|
3230
3370
|
super(context);
|
|
3231
|
-
this.isPopState = isPopState;
|
|
3232
3371
|
this.startingUrl = startingUrl;
|
|
3233
3372
|
this.isTransitional = true;
|
|
3234
3373
|
this.componentDeactivationHandlers = new Map();
|
|
@@ -3256,7 +3395,7 @@ if (false) {
|
|
|
3256
3395
|
* @param {?} event
|
|
3257
3396
|
* @return {?}
|
|
3258
3397
|
*/
|
|
3259
|
-
|
|
3398
|
+
onRouterStarted(event) {
|
|
3260
3399
|
// active sessions can have many cancel start cycles due
|
|
3261
3400
|
// to place guard redirects
|
|
3262
3401
|
return this;
|
|
@@ -3265,7 +3404,7 @@ if (false) {
|
|
|
3265
3404
|
* @param {?} event
|
|
3266
3405
|
* @return {?}
|
|
3267
3406
|
*/
|
|
3268
|
-
|
|
3407
|
+
onRouterEnd(event) {
|
|
3269
3408
|
// navigation succeeded
|
|
3270
3409
|
this.context.notifySuccess(this);
|
|
3271
3410
|
return new Idle(this.context);
|
|
@@ -3275,32 +3414,29 @@ if (false) {
|
|
|
3275
3414
|
* @return {?}
|
|
3276
3415
|
*/
|
|
3277
3416
|
onBackClickedDuringNavigationInteraction(locationTriggerUrl) {
|
|
3278
|
-
|
|
3279
|
-
// has completed.
|
|
3417
|
+
Logger.get(this).info(`back button pressed during navigation session interaction promise`);
|
|
3418
|
+
// detach the interaction from the session so it doesn't get disposed until the activity has completed.
|
|
3280
3419
|
/** @type {?} */
|
|
3281
|
-
const
|
|
3282
|
-
const { when } = Dsl.disposeWith(
|
|
3420
|
+
const navigationInteraction = this.detachInteractionContext();
|
|
3421
|
+
const { when } = Dsl.disposeWith(navigationInteraction);
|
|
3283
3422
|
// TODO: I need to make the exclusive interaction context disallow nested activities or
|
|
3284
|
-
// that would mess things up entirely.
|
|
3285
|
-
|
|
3286
|
-
* @param {?} activity
|
|
3423
|
+
// that would mess things up entirely. Or, can I do a context.abortAll().then(..)
|
|
3424
|
+
navigationInteraction.cancelCurrentActivity().then((/**
|
|
3287
3425
|
* @return {?}
|
|
3288
3426
|
*/
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
* @return {?}
|
|
3292
|
-
*/
|
|
3293
|
-
() => context.dispose()), { once: true });
|
|
3294
|
-
activity.cancel(null);
|
|
3427
|
+
() => {
|
|
3428
|
+
navigationInteraction.dispose();
|
|
3295
3429
|
}));
|
|
3296
|
-
return new CancelledDuringNavigationInteraction(this.context, this.startingUrl, locationTriggerUrl);
|
|
3430
|
+
return new CancelledDuringNavigationInteraction(this.context, this.startingUrl, this.isPopState, locationTriggerUrl);
|
|
3297
3431
|
}
|
|
3432
|
+
// @Trace()
|
|
3298
3433
|
/**
|
|
3299
3434
|
* @param {?} component
|
|
3300
|
-
* @param {?}
|
|
3435
|
+
* @param {?} currentUrl
|
|
3436
|
+
* @param {?} nextUrl
|
|
3301
3437
|
* @return {?}
|
|
3302
3438
|
*/
|
|
3303
|
-
canDeactivatePlace(component,
|
|
3439
|
+
canDeactivatePlace(component, currentUrl, nextUrl) {
|
|
3304
3440
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3305
3441
|
// lookup the handler and create it if we've not seen it yet
|
|
3306
3442
|
/** @type {?} */
|
|
@@ -3308,10 +3444,10 @@ if (false) {
|
|
|
3308
3444
|
if (!handler) {
|
|
3309
3445
|
/** @type {?} */
|
|
3310
3446
|
const isPrimaryHandler = this.componentDeactivationHandlers.size === 0;
|
|
3311
|
-
handler = new PlaceComponentDeactivationHandler(component, this);
|
|
3447
|
+
handler = new PlaceComponentDeactivationHandler(component, this, isPrimaryHandler);
|
|
3312
3448
|
this.componentDeactivationHandlers.set(component, handler);
|
|
3313
3449
|
}
|
|
3314
|
-
return handler.canDeactivate(
|
|
3450
|
+
return handler.canDeactivate(currentUrl, nextUrl);
|
|
3315
3451
|
});
|
|
3316
3452
|
}
|
|
3317
3453
|
/**
|
|
@@ -3340,8 +3476,6 @@ if (false) {
|
|
|
3340
3476
|
*/
|
|
3341
3477
|
AbstractNavigationTransition.prototype._interactionContext;
|
|
3342
3478
|
/** @type {?} */
|
|
3343
|
-
AbstractNavigationTransition.prototype.isPopState;
|
|
3344
|
-
/** @type {?} */
|
|
3345
3479
|
AbstractNavigationTransition.prototype.startingUrl;
|
|
3346
3480
|
}
|
|
3347
3481
|
class NavigationTransition extends AbstractNavigationTransition {
|
|
@@ -3353,32 +3487,14 @@ if (false) {
|
|
|
3353
3487
|
* @param {?} event
|
|
3354
3488
|
* @return {?}
|
|
3355
3489
|
*/
|
|
3356
|
-
|
|
3357
|
-
// active sessions can have many cancel start cycles due
|
|
3358
|
-
// to place guard redirects
|
|
3490
|
+
onRouterCancelled(event) {
|
|
3359
3491
|
return this;
|
|
3360
3492
|
}
|
|
3361
3493
|
/**
|
|
3362
3494
|
* @param {?} event
|
|
3363
3495
|
* @return {?}
|
|
3364
3496
|
*/
|
|
3365
|
-
|
|
3366
|
-
// navigation succeeded
|
|
3367
|
-
this.context.notifySuccess(this);
|
|
3368
|
-
return new Idle(this.context);
|
|
3369
|
-
}
|
|
3370
|
-
/**
|
|
3371
|
-
* @param {?} event
|
|
3372
|
-
* @return {?}
|
|
3373
|
-
*/
|
|
3374
|
-
onCancel(event) {
|
|
3375
|
-
return new Idle(this.context);
|
|
3376
|
-
}
|
|
3377
|
-
/**
|
|
3378
|
-
* @param {?} event
|
|
3379
|
-
* @return {?}
|
|
3380
|
-
*/
|
|
3381
|
-
onError(event) {
|
|
3497
|
+
onRouterError(event) {
|
|
3382
3498
|
// navigation was aborted.
|
|
3383
3499
|
return new Idle(this.context);
|
|
3384
3500
|
}
|
|
@@ -3394,7 +3510,7 @@ if (false) {
|
|
|
3394
3510
|
/** @type {?} */
|
|
3395
3511
|
NavigationTransition.prototype.isPopState;
|
|
3396
3512
|
}
|
|
3397
|
-
class
|
|
3513
|
+
class PopStateTransition extends AbstractNavigationTransition {
|
|
3398
3514
|
constructor() {
|
|
3399
3515
|
super(...arguments);
|
|
3400
3516
|
this.isPopState = true;
|
|
@@ -3403,7 +3519,7 @@ if (false) {
|
|
|
3403
3519
|
* @param {?} event
|
|
3404
3520
|
* @return {?}
|
|
3405
3521
|
*/
|
|
3406
|
-
|
|
3522
|
+
onRouterCancelled(event) {
|
|
3407
3523
|
// Angular doesn't preserve the url when a guard cancels the back button.
|
|
3408
3524
|
// See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
3409
3525
|
Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
|
|
@@ -3414,7 +3530,7 @@ if (false) {
|
|
|
3414
3530
|
* @param {?} event
|
|
3415
3531
|
* @return {?}
|
|
3416
3532
|
*/
|
|
3417
|
-
|
|
3533
|
+
onRouterError(event) {
|
|
3418
3534
|
// navigation was aborted.
|
|
3419
3535
|
if (this.currentRouterUrl() !== this.startingUrl) {
|
|
3420
3536
|
// Angular doesn't preserve the url when a guard cancels the back button.
|
|
@@ -3425,15 +3541,12 @@ if (false) {
|
|
|
3425
3541
|
return new Idle(this.context);
|
|
3426
3542
|
}
|
|
3427
3543
|
}
|
|
3428
|
-
NavigationState.
|
|
3544
|
+
NavigationState.PopStateTransition = PopStateTransition;
|
|
3429
3545
|
if (false) {
|
|
3430
3546
|
/** @type {?} */
|
|
3431
|
-
|
|
3547
|
+
PopStateTransition.prototype.isPopState;
|
|
3432
3548
|
}
|
|
3433
|
-
|
|
3434
|
-
* @abstract
|
|
3435
|
-
*/
|
|
3436
|
-
class AbstractInteractionTransition extends NavigationState {
|
|
3549
|
+
class IdleDuringInteraction extends NavigationState {
|
|
3437
3550
|
/**
|
|
3438
3551
|
* @param {?} context
|
|
3439
3552
|
* @param {?} startingUrl
|
|
@@ -3441,18 +3554,68 @@ if (false) {
|
|
|
3441
3554
|
constructor(context, startingUrl) {
|
|
3442
3555
|
super(context);
|
|
3443
3556
|
this.startingUrl = startingUrl;
|
|
3444
|
-
this.isTransitional =
|
|
3557
|
+
this.isTransitional = false;
|
|
3558
|
+
this.isPopState = false;
|
|
3445
3559
|
}
|
|
3446
3560
|
/**
|
|
3447
|
-
* @
|
|
3561
|
+
* @param {?} visit
|
|
3562
|
+
* @param {?} initialUrl
|
|
3448
3563
|
* @return {?}
|
|
3449
3564
|
*/
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3565
|
+
onPlaceNavigationStart(visit, initialUrl) {
|
|
3566
|
+
/** @type {?} */
|
|
3567
|
+
const navigationTransition = new InteractionTransition(this.context, initialUrl);
|
|
3568
|
+
navigationTransition.storeVisit(visit);
|
|
3569
|
+
return navigationTransition;
|
|
3570
|
+
}
|
|
3571
|
+
/**
|
|
3572
|
+
* @param {?} event
|
|
3573
|
+
* @return {?}
|
|
3574
|
+
*/
|
|
3575
|
+
onRouterStarted(event) {
|
|
3576
|
+
return new InteractionTransition(this.context, event.url);
|
|
3577
|
+
}
|
|
3578
|
+
/**
|
|
3579
|
+
* @param {?} event
|
|
3580
|
+
* @return {?}
|
|
3581
|
+
*/
|
|
3582
|
+
onPopState(event) {
|
|
3583
|
+
return new InteractionPopStateTransition(this.context, event.url);
|
|
3584
|
+
}
|
|
3585
|
+
}
|
|
3586
|
+
__decorate([
|
|
3587
|
+
Trace(),
|
|
3588
|
+
__metadata("design:type", Function),
|
|
3589
|
+
__metadata("design:paramtypes", [NavigationStart]),
|
|
3590
|
+
__metadata("design:returntype", NavigationState)
|
|
3591
|
+
], IdleDuringInteraction.prototype, "onRouterStarted", null);
|
|
3592
|
+
__decorate([
|
|
3593
|
+
Trace(),
|
|
3594
|
+
__metadata("design:type", Function),
|
|
3595
|
+
__metadata("design:paramtypes", [NavigationStart]),
|
|
3596
|
+
__metadata("design:returntype", NavigationState)
|
|
3597
|
+
], IdleDuringInteraction.prototype, "onPopState", null);
|
|
3598
|
+
NavigationState.IdleDuringInteraction = IdleDuringInteraction;
|
|
3599
|
+
if (false) {
|
|
3600
|
+
/** @type {?} */
|
|
3601
|
+
IdleDuringInteraction.prototype.isTransitional;
|
|
3602
|
+
/** @type {?} */
|
|
3603
|
+
IdleDuringInteraction.prototype.isPopState;
|
|
3604
|
+
/** @type {?} */
|
|
3605
|
+
IdleDuringInteraction.prototype.startingUrl;
|
|
3606
|
+
}
|
|
3607
|
+
/**
|
|
3608
|
+
* @abstract
|
|
3609
|
+
*/
|
|
3610
|
+
class AbstractInteractionTransition extends AbstractNavigationTransition {
|
|
3611
|
+
/**
|
|
3612
|
+
* @param {?} context
|
|
3613
|
+
* @param {?} startingUrl
|
|
3614
|
+
*/
|
|
3615
|
+
constructor(context, startingUrl) {
|
|
3616
|
+
super(context, startingUrl);
|
|
3617
|
+
this.startingUrl = startingUrl;
|
|
3618
|
+
this.isTransitional = true;
|
|
3456
3619
|
}
|
|
3457
3620
|
}
|
|
3458
3621
|
NavigationState.AbstractInteractionTransition = AbstractInteractionTransition;
|
|
@@ -3475,9 +3638,31 @@ if (false) {
|
|
|
3475
3638
|
* @param {?} event
|
|
3476
3639
|
* @return {?}
|
|
3477
3640
|
*/
|
|
3478
|
-
|
|
3641
|
+
onRouterCancelled(event) {
|
|
3642
|
+
if (this.context.interactionService.isActive()) {
|
|
3643
|
+
/** @type {?} */
|
|
3644
|
+
const interactionIds = this.interactionService.activeInteractionContextIds.value;
|
|
3645
|
+
this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);
|
|
3646
|
+
return new IdleDuringInteraction(this.context, this.startingUrl);
|
|
3647
|
+
}
|
|
3648
|
+
else {
|
|
3649
|
+
return new Idle(this.context);
|
|
3650
|
+
}
|
|
3651
|
+
}
|
|
3652
|
+
/**
|
|
3653
|
+
* @param {?} event
|
|
3654
|
+
* @return {?}
|
|
3655
|
+
*/
|
|
3656
|
+
onRouterError(event) {
|
|
3657
|
+
// navigation was aborted.
|
|
3658
|
+
return new IdleDuringInteraction(this.context, this.startingUrl);
|
|
3659
|
+
}
|
|
3660
|
+
/**
|
|
3661
|
+
* @param {?} event
|
|
3662
|
+
* @return {?}
|
|
3663
|
+
*/
|
|
3664
|
+
onRouterEnd(event) {
|
|
3479
3665
|
if (this.context.interactionService.isActive()) {
|
|
3480
|
-
this.reinstateInteractionRoute();
|
|
3481
3666
|
return new IdleDuringInteraction(this.context, this.startingUrl);
|
|
3482
3667
|
}
|
|
3483
3668
|
else {
|
|
@@ -3494,7 +3679,7 @@ if (false) {
|
|
|
3494
3679
|
* This state exists to handle all events while any kind of navigation is in progress. That way all other states can
|
|
3495
3680
|
* happily ignore interaction contexts.
|
|
3496
3681
|
*/
|
|
3497
|
-
class
|
|
3682
|
+
class InteractionPopStateTransition extends AbstractInteractionTransition {
|
|
3498
3683
|
constructor() {
|
|
3499
3684
|
super(...arguments);
|
|
3500
3685
|
this.isPopState = true;
|
|
@@ -3503,107 +3688,87 @@ if (false) {
|
|
|
3503
3688
|
* @param {?} event
|
|
3504
3689
|
* @return {?}
|
|
3505
3690
|
*/
|
|
3506
|
-
|
|
3691
|
+
onRouterCancelled(event) {
|
|
3507
3692
|
if (this.interactionService.isActive()) {
|
|
3508
|
-
|
|
3693
|
+
/** @type {?} */
|
|
3694
|
+
const interactionIds = this.interactionService.activeInteractionContextIds.value;
|
|
3695
|
+
this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);
|
|
3509
3696
|
return new IdleDuringInteraction(this.context, this.startingUrl);
|
|
3510
3697
|
}
|
|
3511
3698
|
else {
|
|
3512
3699
|
return new Idle(this.context);
|
|
3513
3700
|
}
|
|
3514
3701
|
}
|
|
3515
|
-
}
|
|
3516
|
-
NavigationState.InteractionBackTransition = InteractionBackTransition;
|
|
3517
|
-
if (false) {
|
|
3518
|
-
/** @type {?} */
|
|
3519
|
-
InteractionBackTransition.prototype.isPopState;
|
|
3520
|
-
}
|
|
3521
|
-
class IdleDuringInteraction extends NavigationState {
|
|
3522
|
-
/**
|
|
3523
|
-
* @param {?} context
|
|
3524
|
-
* @param {?} startingUrl
|
|
3525
|
-
*/
|
|
3526
|
-
constructor(context, startingUrl) {
|
|
3527
|
-
super(context);
|
|
3528
|
-
this.startingUrl = startingUrl;
|
|
3529
|
-
this.isTransitional = false;
|
|
3530
|
-
this.isPopState = false;
|
|
3531
|
-
}
|
|
3532
|
-
/**
|
|
3533
|
-
* @param {?} event
|
|
3534
|
-
* @return {?}
|
|
3535
|
-
*/
|
|
3536
|
-
onStart(event) {
|
|
3537
|
-
return new InteractionTransition(this.context, event.url);
|
|
3538
|
-
}
|
|
3539
3702
|
/**
|
|
3540
3703
|
* @param {?} event
|
|
3541
3704
|
* @return {?}
|
|
3542
3705
|
*/
|
|
3543
|
-
|
|
3544
|
-
|
|
3706
|
+
onRouterEnd(event) {
|
|
3707
|
+
if (this.context.interactionService.isActive()) {
|
|
3708
|
+
return new IdleDuringInteraction(this.context, this.startingUrl);
|
|
3709
|
+
}
|
|
3710
|
+
else {
|
|
3711
|
+
return new Idle(this.context);
|
|
3712
|
+
}
|
|
3545
3713
|
}
|
|
3546
3714
|
}
|
|
3547
|
-
NavigationState.
|
|
3715
|
+
NavigationState.InteractionPopStateTransition = InteractionPopStateTransition;
|
|
3548
3716
|
if (false) {
|
|
3549
3717
|
/** @type {?} */
|
|
3550
|
-
|
|
3551
|
-
/** @type {?} */
|
|
3552
|
-
IdleDuringInteraction.prototype.isPopState;
|
|
3553
|
-
/** @type {?} */
|
|
3554
|
-
IdleDuringInteraction.prototype.startingUrl;
|
|
3718
|
+
InteractionPopStateTransition.prototype.isPopState;
|
|
3555
3719
|
}
|
|
3556
3720
|
class CancelledDuringNavigationInteraction extends NavigationState {
|
|
3557
3721
|
/**
|
|
3558
3722
|
* @param {?} context
|
|
3559
3723
|
* @param {?} startingUrl
|
|
3724
|
+
* @param {?} startingEventWasAPopState
|
|
3560
3725
|
* @param {?} locationChangeTriggerUrl
|
|
3561
3726
|
*/
|
|
3562
|
-
constructor(context, startingUrl, locationChangeTriggerUrl) {
|
|
3727
|
+
constructor(context, startingUrl, startingEventWasAPopState, locationChangeTriggerUrl) {
|
|
3563
3728
|
super(context);
|
|
3564
3729
|
this.startingUrl = startingUrl;
|
|
3730
|
+
this.startingEventWasAPopState = startingEventWasAPopState;
|
|
3565
3731
|
this.locationChangeTriggerUrl = locationChangeTriggerUrl;
|
|
3566
3732
|
this.isPopState = false;
|
|
3567
|
-
this.
|
|
3733
|
+
this.gotPopStateWithLeavingUrl = false;
|
|
3568
3734
|
}
|
|
3569
3735
|
/**
|
|
3570
3736
|
* @return {?}
|
|
3571
3737
|
*/
|
|
3572
3738
|
get isTransitional() {
|
|
3573
|
-
return
|
|
3739
|
+
return true;
|
|
3574
3740
|
}
|
|
3575
3741
|
/**
|
|
3576
3742
|
* @param {?} event
|
|
3577
3743
|
* @return {?}
|
|
3578
3744
|
*/
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
this.capturedFauxRouterStart = true;
|
|
3582
|
-
return this.ignore(event, 'url matched back button location change');
|
|
3583
|
-
}
|
|
3584
|
-
else {
|
|
3585
|
-
return this.createTransitionStateFor(event);
|
|
3586
|
-
}
|
|
3745
|
+
onRouterStarted(event) {
|
|
3746
|
+
return this.ignore(event);
|
|
3587
3747
|
}
|
|
3588
3748
|
/**
|
|
3589
3749
|
* @param {?} event
|
|
3590
3750
|
* @return {?}
|
|
3591
3751
|
*/
|
|
3592
|
-
|
|
3593
|
-
|
|
3752
|
+
onRouterCancelled(event) {
|
|
3753
|
+
// Depending on the state of the router and what was done we get a different
|
|
3754
|
+
// sequence of events. I.e. If they just clicked a link we'll get a cancel
|
|
3755
|
+
// with the locationChangeTriggerUrl as the final event. However the user
|
|
3756
|
+
// started the initial navigation with a pop state then we'll get one of
|
|
3757
|
+
// those with the locationChangeTriggerUrl but no cancel event with it.
|
|
3758
|
+
return this.gotPopStateWithLeavingUrl || this.locationChangeTriggerUrl === event.url ? this.createIdleState() : this.ignore(event);
|
|
3594
3759
|
}
|
|
3595
3760
|
/**
|
|
3596
3761
|
* @param {?} event
|
|
3597
3762
|
* @return {?}
|
|
3598
3763
|
*/
|
|
3599
|
-
|
|
3764
|
+
onRouterEnd(event) {
|
|
3600
3765
|
return this.ignore(event);
|
|
3601
3766
|
}
|
|
3602
3767
|
/**
|
|
3603
3768
|
* @param {?} event
|
|
3604
3769
|
* @return {?}
|
|
3605
3770
|
*/
|
|
3606
|
-
|
|
3771
|
+
onRouterError(event) {
|
|
3607
3772
|
return this.ignore(event);
|
|
3608
3773
|
}
|
|
3609
3774
|
/**
|
|
@@ -3611,7 +3776,20 @@ if (false) {
|
|
|
3611
3776
|
* @return {?}
|
|
3612
3777
|
*/
|
|
3613
3778
|
onPopState(event) {
|
|
3614
|
-
|
|
3779
|
+
this.gotPopStateWithLeavingUrl = this.gotPopStateWithLeavingUrl || event.url === this.locationChangeTriggerUrl;
|
|
3780
|
+
return this.ignore(event);
|
|
3781
|
+
}
|
|
3782
|
+
// @Trace()
|
|
3783
|
+
/**
|
|
3784
|
+
* @param {?} component
|
|
3785
|
+
* @param {?} currentUrl
|
|
3786
|
+
* @param {?} nextUrl
|
|
3787
|
+
* @return {?}
|
|
3788
|
+
*/
|
|
3789
|
+
canDeactivatePlace(component, currentUrl, nextUrl) {
|
|
3790
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3791
|
+
return false;
|
|
3792
|
+
});
|
|
3615
3793
|
}
|
|
3616
3794
|
/**
|
|
3617
3795
|
* @param {?} event
|
|
@@ -3619,7 +3797,7 @@ if (false) {
|
|
|
3619
3797
|
* @return {?}
|
|
3620
3798
|
*/
|
|
3621
3799
|
ignore(event, reason) {
|
|
3622
|
-
reason = reason ? `
|
|
3800
|
+
reason = reason ? ` -> ${reason}` : '';
|
|
3623
3801
|
Logger.get(this).info(`ignoring router event${reason}: ${event.constructor.name} -> ${event.url}`);
|
|
3624
3802
|
return this;
|
|
3625
3803
|
}
|
|
@@ -3627,9 +3805,15 @@ if (false) {
|
|
|
3627
3805
|
* @return {?}
|
|
3628
3806
|
*/
|
|
3629
3807
|
toString() {
|
|
3630
|
-
return `${this.constructor.name}(startingUrl: ${this.startingUrl}, locationChangeTriggerUrl:${this.locationChangeTriggerUrl})`;
|
|
3808
|
+
return `${this.constructor.name}(isIdl: ${this.idle}, startingUrl: ${this.startingUrl}, locationChangeTriggerUrl:${this.locationChangeTriggerUrl})`;
|
|
3631
3809
|
}
|
|
3632
3810
|
}
|
|
3811
|
+
__decorate([
|
|
3812
|
+
Trace(),
|
|
3813
|
+
__metadata("design:type", Function),
|
|
3814
|
+
__metadata("design:paramtypes", [NavigationCancel]),
|
|
3815
|
+
__metadata("design:returntype", NavigationState)
|
|
3816
|
+
], CancelledDuringNavigationInteraction.prototype, "onRouterCancelled", null);
|
|
3633
3817
|
NavigationState.CancelledDuringNavigationInteraction = CancelledDuringNavigationInteraction;
|
|
3634
3818
|
if (false) {
|
|
3635
3819
|
/** @type {?} */
|
|
@@ -3638,10 +3822,12 @@ if (false) {
|
|
|
3638
3822
|
* @type {?}
|
|
3639
3823
|
* @private
|
|
3640
3824
|
*/
|
|
3641
|
-
CancelledDuringNavigationInteraction.prototype.
|
|
3825
|
+
CancelledDuringNavigationInteraction.prototype.gotPopStateWithLeavingUrl;
|
|
3642
3826
|
/** @type {?} */
|
|
3643
3827
|
CancelledDuringNavigationInteraction.prototype.startingUrl;
|
|
3644
3828
|
/** @type {?} */
|
|
3829
|
+
CancelledDuringNavigationInteraction.prototype.startingEventWasAPopState;
|
|
3830
|
+
/** @type {?} */
|
|
3645
3831
|
CancelledDuringNavigationInteraction.prototype.locationChangeTriggerUrl;
|
|
3646
3832
|
}
|
|
3647
3833
|
})(NavigationState || (NavigationState = {}));
|
|
@@ -3717,21 +3903,24 @@ class UrlSnapshot {
|
|
|
3717
3903
|
/**
|
|
3718
3904
|
* @param {?} urlSerializer
|
|
3719
3905
|
* @param {?} url
|
|
3906
|
+
* @param {?} options
|
|
3720
3907
|
*/
|
|
3721
|
-
constructor(urlSerializer, url) {
|
|
3908
|
+
constructor(urlSerializer, url, options) {
|
|
3722
3909
|
this.urlSerializer = urlSerializer;
|
|
3723
3910
|
this.url = url;
|
|
3911
|
+
this.options = options;
|
|
3724
3912
|
this.urlTree = urlSerializer.parse(url);
|
|
3725
3913
|
}
|
|
3726
3914
|
/**
|
|
3727
|
-
* @protected
|
|
3728
3915
|
* @param {?} visit
|
|
3729
3916
|
* @return {?}
|
|
3730
3917
|
*/
|
|
3731
|
-
|
|
3918
|
+
updateVisitSegments(visit) {
|
|
3919
|
+
/** @type {?} */
|
|
3920
|
+
const urlTree = this.urlSerializer.parse(this.url);
|
|
3732
3921
|
// Ugly, but it works for now.
|
|
3733
3922
|
/** @type {?} */
|
|
3734
|
-
const segments = [...this.getPrimarySegments()];
|
|
3923
|
+
const segments = [...this.getPrimarySegments(urlTree)];
|
|
3735
3924
|
/** @type {?} */
|
|
3736
3925
|
const visitSegments = this.getSegmentsFor(visit);
|
|
3737
3926
|
/** @type {?} */
|
|
@@ -3742,13 +3931,15 @@ class UrlSnapshot {
|
|
|
3742
3931
|
segment => segment.path === visitSegments[0].path));
|
|
3743
3932
|
// do not use the return value, it's the items that were removed!
|
|
3744
3933
|
segments.splice(replaceAt, visitSegments.length, ...visitSegments);
|
|
3745
|
-
|
|
3934
|
+
urlTree.root.children.primary.segments = segments;
|
|
3935
|
+
return new UrlSnapshot(this.urlSerializer, urlTree.toString(), this.options);
|
|
3746
3936
|
}
|
|
3747
3937
|
/**
|
|
3748
3938
|
* @private
|
|
3939
|
+
* @param {?} urlTree
|
|
3749
3940
|
* @return {?}
|
|
3750
3941
|
*/
|
|
3751
|
-
getPrimarySegments() {
|
|
3942
|
+
getPrimarySegments(urlTree) {
|
|
3752
3943
|
return this.urlTree.root.children.primary.segments;
|
|
3753
3944
|
}
|
|
3754
3945
|
/**
|
|
@@ -3771,33 +3962,12 @@ class UrlSnapshot {
|
|
|
3771
3962
|
new UrlSegment(visit.placeDefinition.path, visit.placeDefinition.getFormattedRouteParameters(visit))
|
|
3772
3963
|
];
|
|
3773
3964
|
}
|
|
3774
|
-
/**
|
|
3775
|
-
* @param {?} visit
|
|
3776
|
-
* @return {?}
|
|
3777
|
-
*/
|
|
3778
|
-
createRedirectCommandsFor(visit) {
|
|
3779
|
-
/** @type {?} */
|
|
3780
|
-
const segments = this.replaceExistingVisitSegmentsWith(visit);
|
|
3781
|
-
/** @type {?} */
|
|
3782
|
-
const commands = [];
|
|
3783
|
-
segments.forEach((/**
|
|
3784
|
-
* @param {?} s
|
|
3785
|
-
* @return {?}
|
|
3786
|
-
*/
|
|
3787
|
-
s => {
|
|
3788
|
-
commands.push(s.path);
|
|
3789
|
-
if (s.parameterMap.keys.length > 0) {
|
|
3790
|
-
commands.push(s.parameters);
|
|
3791
|
-
}
|
|
3792
|
-
}));
|
|
3793
|
-
return commands;
|
|
3794
|
-
}
|
|
3795
3965
|
/**
|
|
3796
3966
|
* @param {?} placeDef
|
|
3797
3967
|
* @return {?}
|
|
3798
3968
|
*/
|
|
3799
3969
|
includesPathOf(placeDef) {
|
|
3800
|
-
return this.getPrimarySegments().find((/**
|
|
3970
|
+
return this.getPrimarySegments(this.urlTree).find((/**
|
|
3801
3971
|
* @param {?} s
|
|
3802
3972
|
* @return {?}
|
|
3803
3973
|
*/
|
|
@@ -3808,45 +3978,77 @@ class UrlSnapshot {
|
|
|
3808
3978
|
*/
|
|
3809
3979
|
getInteractionIds() {
|
|
3810
3980
|
/** @type {?} */
|
|
3811
|
-
const
|
|
3812
|
-
if (
|
|
3813
|
-
|
|
3814
|
-
assert.isTruthy(interactionOutlet.segments[0].path === UrlSnapshot.INTERACTION_ROUTER_PATH);
|
|
3815
|
-
return UrlSnapshot.parseInteractionIds(interactionOutlet.segments[1].path);
|
|
3981
|
+
const queryParam = this.urlTree.queryParams[UrlSnapshot.INTERACTION_QUERY_PARAM];
|
|
3982
|
+
if (queryParam) {
|
|
3983
|
+
return UrlSnapshot.parseInteractionIds(queryParam);
|
|
3816
3984
|
}
|
|
3817
3985
|
else {
|
|
3818
3986
|
return [];
|
|
3819
3987
|
}
|
|
3820
3988
|
}
|
|
3821
|
-
// @Trace()
|
|
3822
3989
|
/**
|
|
3823
|
-
* @param {?} ids
|
|
3824
3990
|
* @return {?}
|
|
3825
3991
|
*/
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
const urlTree = this.urlSerializer.parse(this.url);
|
|
3829
|
-
urlTree.root.children[UrlSnapshot.INTERACTION_ROUTER_OUTLET] = new UrlSegmentGroup([
|
|
3830
|
-
new UrlSegment(UrlSnapshot.INTERACTION_ROUTER_PATH, {}),
|
|
3831
|
-
new UrlSegment(UrlSnapshot.createPathIdFor(ids), {})
|
|
3832
|
-
], {});
|
|
3833
|
-
return new UrlSnapshot(this.urlSerializer, urlTree.toString());
|
|
3992
|
+
hasInteractionIds() {
|
|
3993
|
+
return this.getInteractionIds().length > 0;
|
|
3834
3994
|
}
|
|
3835
|
-
|
|
3836
|
-
if (false) {
|
|
3995
|
+
// @Trace()
|
|
3837
3996
|
/**
|
|
3838
|
-
* @
|
|
3839
|
-
* @
|
|
3997
|
+
* @param {?} ids
|
|
3998
|
+
* @return {?}
|
|
3840
3999
|
*/
|
|
4000
|
+
updateInteractionIds(ids) {
|
|
4001
|
+
if (ids.length === 0) {
|
|
4002
|
+
return this.removeInteractionIds();
|
|
4003
|
+
}
|
|
4004
|
+
else {
|
|
4005
|
+
/** @type {?} */
|
|
4006
|
+
const urlTree = this.urlSerializer.parse(this.url);
|
|
4007
|
+
urlTree.queryParams[UrlSnapshot.INTERACTION_QUERY_PARAM] = UrlSnapshot.createPathIdFor(ids);
|
|
4008
|
+
return new UrlSnapshot(this.urlSerializer, urlTree.toString(), this.options);
|
|
4009
|
+
}
|
|
4010
|
+
}
|
|
4011
|
+
// @Trace()
|
|
4012
|
+
/**
|
|
4013
|
+
* @return {?}
|
|
4014
|
+
*/
|
|
4015
|
+
removeInteractionIds() {
|
|
4016
|
+
/** @type {?} */
|
|
4017
|
+
const urlTree = this.urlSerializer.parse(this.url);
|
|
4018
|
+
if (urlTree.queryParams && urlTree.queryParams[UrlSnapshot.INTERACTION_QUERY_PARAM]) {
|
|
4019
|
+
urlTree.queryParams = {}; //[UrlSnapshot.INTERACTION_ROUTER_OUTLET]
|
|
4020
|
+
}
|
|
4021
|
+
return new UrlSnapshot(this.urlSerializer, urlTree.toString(), this.options);
|
|
4022
|
+
}
|
|
4023
|
+
/**
|
|
4024
|
+
* @param {?} options
|
|
4025
|
+
* @return {?}
|
|
4026
|
+
*/
|
|
4027
|
+
withOptions(options) {
|
|
4028
|
+
return new UrlSnapshot(this.urlSerializer, this.url, options);
|
|
4029
|
+
}
|
|
4030
|
+
/**
|
|
4031
|
+
* @return {?}
|
|
4032
|
+
*/
|
|
4033
|
+
getNavigationExtras() {
|
|
4034
|
+
return this.options;
|
|
4035
|
+
}
|
|
4036
|
+
}
|
|
4037
|
+
if (false) {
|
|
4038
|
+
/** @type {?} */
|
|
3841
4039
|
UrlSnapshot.prototype.urlTree;
|
|
3842
4040
|
/** @type {?} */
|
|
3843
4041
|
UrlSnapshot.prototype.urlSerializer;
|
|
3844
4042
|
/** @type {?} */
|
|
3845
4043
|
UrlSnapshot.prototype.url;
|
|
4044
|
+
/**
|
|
4045
|
+
* @type {?}
|
|
4046
|
+
* @private
|
|
4047
|
+
*/
|
|
4048
|
+
UrlSnapshot.prototype.options;
|
|
3846
4049
|
}
|
|
3847
4050
|
(function (UrlSnapshot) {
|
|
3848
|
-
UrlSnapshot.
|
|
3849
|
-
UrlSnapshot.INTERACTION_ROUTER_PATH = 'active';
|
|
4051
|
+
UrlSnapshot.INTERACTION_QUERY_PARAM = 'aup-interactions';
|
|
3850
4052
|
UrlSnapshot.INTERACTION_ID_SEPARATOR = '--';
|
|
3851
4053
|
/**
|
|
3852
4054
|
* @param {?} path
|
|
@@ -3865,13 +4067,14 @@ if (false) {
|
|
|
3865
4067
|
}
|
|
3866
4068
|
UrlSnapshot.createPathIdFor = createPathIdFor;
|
|
3867
4069
|
/**
|
|
3868
|
-
* @
|
|
3869
|
-
* @return {?}
|
|
4070
|
+
* @record
|
|
3870
4071
|
*/
|
|
3871
|
-
function
|
|
3872
|
-
|
|
4072
|
+
function NavigationOptions() { }
|
|
4073
|
+
UrlSnapshot.NavigationOptions = NavigationOptions;
|
|
4074
|
+
if (false) {
|
|
4075
|
+
/** @type {?|undefined} */
|
|
4076
|
+
NavigationOptions.prototype.replaceUrl;
|
|
3873
4077
|
}
|
|
3874
|
-
UrlSnapshot.createInteractionOutletRouterCommands = createInteractionOutletRouterCommands;
|
|
3875
4078
|
})(UrlSnapshot || (UrlSnapshot = {}));
|
|
3876
4079
|
|
|
3877
4080
|
/**
|
|
@@ -3924,7 +4127,6 @@ class PlaceRouter extends GarbageCollector {
|
|
|
3924
4127
|
// NavigationStart -> .... -> NavigationError --> navigation aborted, end session.
|
|
3925
4128
|
// =======================
|
|
3926
4129
|
if (event instanceof NavigationStart) {
|
|
3927
|
-
console.log(event);
|
|
3928
4130
|
if (event.navigationTrigger === 'popstate') {
|
|
3929
4131
|
this.runStateTransition((/**
|
|
3930
4132
|
* @param {?} state
|
|
@@ -3937,7 +4139,7 @@ class PlaceRouter extends GarbageCollector {
|
|
|
3937
4139
|
* @param {?} state
|
|
3938
4140
|
* @return {?}
|
|
3939
4141
|
*/
|
|
3940
|
-
state => state.
|
|
4142
|
+
state => state.onRouterStarted(event)));
|
|
3941
4143
|
}
|
|
3942
4144
|
}
|
|
3943
4145
|
if (event instanceof NavigationEnd) {
|
|
@@ -3946,7 +4148,7 @@ class PlaceRouter extends GarbageCollector {
|
|
|
3946
4148
|
* @param {?} state
|
|
3947
4149
|
* @return {?}
|
|
3948
4150
|
*/
|
|
3949
|
-
state => state.
|
|
4151
|
+
state => state.onRouterEnd(event)));
|
|
3950
4152
|
}
|
|
3951
4153
|
if (event instanceof NavigationError) {
|
|
3952
4154
|
console.log(event);
|
|
@@ -3954,7 +4156,7 @@ class PlaceRouter extends GarbageCollector {
|
|
|
3954
4156
|
* @param {?} state
|
|
3955
4157
|
* @return {?}
|
|
3956
4158
|
*/
|
|
3957
|
-
state => state.
|
|
4159
|
+
state => state.onRouterError(event)));
|
|
3958
4160
|
}
|
|
3959
4161
|
if (event instanceof NavigationCancel) {
|
|
3960
4162
|
console.log(event);
|
|
@@ -3962,7 +4164,7 @@ class PlaceRouter extends GarbageCollector {
|
|
|
3962
4164
|
* @param {?} state
|
|
3963
4165
|
* @return {?}
|
|
3964
4166
|
*/
|
|
3965
|
-
state => state.
|
|
4167
|
+
state => state.onRouterCancelled(event)));
|
|
3966
4168
|
}
|
|
3967
4169
|
}));
|
|
3968
4170
|
// Push dialog state to the url so we can capture the back button.
|
|
@@ -3991,12 +4193,11 @@ class PlaceRouter extends GarbageCollector {
|
|
|
3991
4193
|
const navigationState = this._navigationStateModel.value;
|
|
3992
4194
|
console.log(`URLChange -> ${url}`, { state: navigationState });
|
|
3993
4195
|
urlChanges.publish({ url, state: navigationState });
|
|
3994
|
-
//
|
|
3995
|
-
if (navigationState
|
|
4196
|
+
// The url has changed while we're in a transitional state
|
|
4197
|
+
if (navigationState.isTransitional) {
|
|
3996
4198
|
/** @type {?} */
|
|
3997
4199
|
const navigationInteraction = this.navigationState.interactionContext;
|
|
3998
4200
|
if (navigationInteraction && navigationInteraction.isActive()) {
|
|
3999
|
-
Logger.get(this).info(`back button pressed during navigation session interaction promise`);
|
|
4000
4201
|
this.runStateTransition((/**
|
|
4001
4202
|
* @param {?} state
|
|
4002
4203
|
* @return {?}
|
|
@@ -4086,9 +4287,9 @@ class PlaceRouter extends GarbageCollector {
|
|
|
4086
4287
|
*/
|
|
4087
4288
|
router => {
|
|
4088
4289
|
/** @type {?} */
|
|
4089
|
-
const
|
|
4090
|
-
console.log('### Push Changes to route Redirect', { commands });
|
|
4091
|
-
return
|
|
4290
|
+
const urlSnapshot = this.parseUrl(this.router.routerState.snapshot.url).updateVisitSegments(next);
|
|
4291
|
+
console.log('### Push Changes to route Redirect', { commands: urlSnapshot.url });
|
|
4292
|
+
return this.navigateByUrl(urlSnapshot);
|
|
4092
4293
|
}));
|
|
4093
4294
|
}
|
|
4094
4295
|
});
|
|
@@ -4109,7 +4310,7 @@ class PlaceRouter extends GarbageCollector {
|
|
|
4109
4310
|
*/
|
|
4110
4311
|
current => {
|
|
4111
4312
|
/** @type {?} */
|
|
4112
|
-
const session =
|
|
4313
|
+
const session = this.navigationState.onPlaceNavigationStart(visit, this.getCurrentRouterUrl());
|
|
4113
4314
|
session.storeVisit(visit);
|
|
4114
4315
|
return session;
|
|
4115
4316
|
}));
|
|
@@ -4124,11 +4325,12 @@ class PlaceRouter extends GarbageCollector {
|
|
|
4124
4325
|
* @param {?} session
|
|
4125
4326
|
* @return {?}
|
|
4126
4327
|
*/
|
|
4127
|
-
session => session.
|
|
4328
|
+
session => session.onRouterEnd(new NavigationEnd(-1, '', ''))));
|
|
4128
4329
|
}
|
|
4129
4330
|
}
|
|
4130
4331
|
});
|
|
4131
4332
|
}
|
|
4333
|
+
// @Trace()
|
|
4132
4334
|
/**
|
|
4133
4335
|
* @protected
|
|
4134
4336
|
* @param {?} transition
|
|
@@ -4173,7 +4375,7 @@ class PlaceRouter extends GarbageCollector {
|
|
|
4173
4375
|
* @return {?}
|
|
4174
4376
|
*/
|
|
4175
4377
|
parseUrl(url) {
|
|
4176
|
-
return new UrlSnapshot(this.urlSerializer, url);
|
|
4378
|
+
return new UrlSnapshot(this.urlSerializer, url, {});
|
|
4177
4379
|
}
|
|
4178
4380
|
/**
|
|
4179
4381
|
* @param {?} url
|
|
@@ -4188,6 +4390,12 @@ class PlaceRouter extends GarbageCollector {
|
|
|
4188
4390
|
getCurrentRouterUrl() {
|
|
4189
4391
|
return this.router.routerState ? this.router.routerState.snapshot.url : null;
|
|
4190
4392
|
}
|
|
4393
|
+
/**
|
|
4394
|
+
* @return {?}
|
|
4395
|
+
*/
|
|
4396
|
+
getCurrentRouteSnapshot() {
|
|
4397
|
+
return this.parseUrl(this.getCurrentRouterUrl());
|
|
4398
|
+
}
|
|
4191
4399
|
/**
|
|
4192
4400
|
* @param {?} url
|
|
4193
4401
|
* @return {?}
|
|
@@ -4203,6 +4411,15 @@ class PlaceRouter extends GarbageCollector {
|
|
|
4203
4411
|
hasActiveInteractionIds(url) {
|
|
4204
4412
|
return this.getActiveInteractionIdsFromUrl(url).length > 0;
|
|
4205
4413
|
}
|
|
4414
|
+
// @Trace()
|
|
4415
|
+
/**
|
|
4416
|
+
* @param {?} urlSnapshot
|
|
4417
|
+
* @return {?}
|
|
4418
|
+
*/
|
|
4419
|
+
navigateByUrl(urlSnapshot) {
|
|
4420
|
+
this.router.navigateByUrl(urlSnapshot.urlTree, urlSnapshot.getNavigationExtras());
|
|
4421
|
+
}
|
|
4422
|
+
// @Trace()
|
|
4206
4423
|
/**
|
|
4207
4424
|
* @return {?}
|
|
4208
4425
|
*/
|
|
@@ -4216,22 +4433,12 @@ class PlaceRouter extends GarbageCollector {
|
|
|
4216
4433
|
}
|
|
4217
4434
|
else {
|
|
4218
4435
|
if (currentIds.length < 1) {
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
[UrlSnapshot.INTERACTION_ROUTER_OUTLET]: null
|
|
4222
|
-
}
|
|
4223
|
-
}], {
|
|
4224
|
-
replaceUrl: true // remove the interaction from the history.
|
|
4225
|
-
});
|
|
4436
|
+
// no more interactions to remove from history.
|
|
4437
|
+
this.navigateByUrl(this.getCurrentRouteSnapshot().removeInteractionIds());
|
|
4226
4438
|
}
|
|
4227
4439
|
else {
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
this.router.navigate(['.', {
|
|
4231
|
-
outlets: {
|
|
4232
|
-
[UrlSnapshot.INTERACTION_ROUTER_OUTLET]: UrlSnapshot.createInteractionOutletRouterCommands(currentIds)
|
|
4233
|
-
}
|
|
4234
|
-
}]);
|
|
4440
|
+
// todo was or is...
|
|
4441
|
+
this.navigateByUrl(this.getCurrentRouteSnapshot().updateInteractionIds(currentIds));
|
|
4235
4442
|
}
|
|
4236
4443
|
}
|
|
4237
4444
|
}
|
|
@@ -4250,12 +4457,6 @@ PlaceRouter.ctorParameters = () => [
|
|
|
4250
4457
|
{ type: InteractionService }
|
|
4251
4458
|
];
|
|
4252
4459
|
/** @nocollapse */ PlaceRouter.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(ɵɵinject(Router), ɵɵinject(UrlSerializer), ɵɵinject(Location), ɵɵinject(PlaceHistory), ɵɵinject(InteractionService)); }, token: PlaceRouter, providedIn: "root" });
|
|
4253
|
-
__decorate([
|
|
4254
|
-
Trace(),
|
|
4255
|
-
__metadata("design:type", Function),
|
|
4256
|
-
__metadata("design:paramtypes", []),
|
|
4257
|
-
__metadata("design:returntype", void 0)
|
|
4258
|
-
], PlaceRouter.prototype, "syncInteractionIdsWithRouter", null);
|
|
4259
4460
|
if (false) {
|
|
4260
4461
|
/**
|
|
4261
4462
|
* @type {?}
|
|
@@ -5654,93 +5855,6 @@ function Place(options) {
|
|
|
5654
5855
|
}
|
|
5655
5856
|
})(Place || (Place = {}));
|
|
5656
5857
|
|
|
5657
|
-
/**
|
|
5658
|
-
* @fileoverview added by tsickle
|
|
5659
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
5660
|
-
*/
|
|
5661
|
-
class VisitSanitiser {
|
|
5662
|
-
/**
|
|
5663
|
-
* @param {?} activatedRoute
|
|
5664
|
-
* @param {?} router
|
|
5665
|
-
* @param {?} placeHistory
|
|
5666
|
-
* @param {?} injector
|
|
5667
|
-
*/
|
|
5668
|
-
constructor(activatedRoute, router, placeHistory, injector) {
|
|
5669
|
-
this.activatedRoute = activatedRoute;
|
|
5670
|
-
this.router = router;
|
|
5671
|
-
this.placeHistory = placeHistory;
|
|
5672
|
-
this.injector = injector;
|
|
5673
|
-
}
|
|
5674
|
-
// @Trace()
|
|
5675
|
-
/**
|
|
5676
|
-
* @param {?} visit
|
|
5677
|
-
* @return {?}
|
|
5678
|
-
*/
|
|
5679
|
-
sanitise(visit) {
|
|
5680
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
5681
|
-
/** @type {?} */
|
|
5682
|
-
const placeDef = visit.placeDefinition;
|
|
5683
|
-
if (placeDef.hasRouteId()) {
|
|
5684
|
-
/** @type {?} */
|
|
5685
|
-
const routeIdDef = placeDef.getRouteIdParameterDef();
|
|
5686
|
-
/** @type {?} */
|
|
5687
|
-
const routeId = visit.getRouteId();
|
|
5688
|
-
/** @type {?} */
|
|
5689
|
-
const sanitisedValue = yield routeIdDef.sanitise(routeId, visit, this.placeHistory, this.injector);
|
|
5690
|
-
// console.log({routeId, sanitisedValue});
|
|
5691
|
-
// ###------- EARLY EXIT --------###
|
|
5692
|
-
if (routeIdDef.hasChanged(routeId, sanitisedValue)) {
|
|
5693
|
-
// if the route id has changed we redirect immediately as other
|
|
5694
|
-
// parameter sanitisers might use it.
|
|
5695
|
-
return visit.replace(routeIdDef, sanitisedValue);
|
|
5696
|
-
}
|
|
5697
|
-
}
|
|
5698
|
-
// if we didn't replace the routeId we continue the url present parameters.
|
|
5699
|
-
/** @type {?} */
|
|
5700
|
-
const parameterDefs = placeDef.getVisitParameterDefs({
|
|
5701
|
-
includeRouteParameters: true,
|
|
5702
|
-
includeNonRouteParameters: true
|
|
5703
|
-
});
|
|
5704
|
-
/** @type {?} */
|
|
5705
|
-
let sanitisedVisit = visit;
|
|
5706
|
-
for (let i = 0; i < parameterDefs.length; i++) {
|
|
5707
|
-
/** @type {?} */
|
|
5708
|
-
const def = parameterDefs[i];
|
|
5709
|
-
/** @type {?} */
|
|
5710
|
-
const value = visit.getParameter(def.name);
|
|
5711
|
-
/** @type {?} */
|
|
5712
|
-
const sanitisedValue = yield def.sanitise(value, sanitisedVisit, this.placeHistory, this.injector);
|
|
5713
|
-
if (def.hasChanged(value, sanitisedValue)) {
|
|
5714
|
-
sanitisedVisit = sanitisedVisit.replace(def, sanitisedValue);
|
|
5715
|
-
}
|
|
5716
|
-
}
|
|
5717
|
-
return sanitisedVisit.hasChangedFrom(visit) ? sanitisedVisit : visit;
|
|
5718
|
-
});
|
|
5719
|
-
}
|
|
5720
|
-
}
|
|
5721
|
-
if (false) {
|
|
5722
|
-
/**
|
|
5723
|
-
* @type {?}
|
|
5724
|
-
* @private
|
|
5725
|
-
*/
|
|
5726
|
-
VisitSanitiser.prototype.activatedRoute;
|
|
5727
|
-
/**
|
|
5728
|
-
* @type {?}
|
|
5729
|
-
* @private
|
|
5730
|
-
*/
|
|
5731
|
-
VisitSanitiser.prototype.router;
|
|
5732
|
-
/**
|
|
5733
|
-
* @type {?}
|
|
5734
|
-
* @private
|
|
5735
|
-
*/
|
|
5736
|
-
VisitSanitiser.prototype.placeHistory;
|
|
5737
|
-
/**
|
|
5738
|
-
* @type {?}
|
|
5739
|
-
* @private
|
|
5740
|
-
*/
|
|
5741
|
-
VisitSanitiser.prototype.injector;
|
|
5742
|
-
}
|
|
5743
|
-
|
|
5744
5858
|
/**
|
|
5745
5859
|
* @fileoverview added by tsickle
|
|
5746
5860
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -5872,6 +5986,120 @@ if (false) {
|
|
|
5872
5986
|
ParamMapAdapter.prototype.params;
|
|
5873
5987
|
}
|
|
5874
5988
|
|
|
5989
|
+
/**
|
|
5990
|
+
* @fileoverview added by tsickle
|
|
5991
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
5992
|
+
*/
|
|
5993
|
+
class NoopAuthGuard {
|
|
5994
|
+
constructor() {
|
|
5995
|
+
}
|
|
5996
|
+
/**
|
|
5997
|
+
* @param {?} activatedRoute
|
|
5998
|
+
* @param {?} state
|
|
5999
|
+
* @return {?}
|
|
6000
|
+
*/
|
|
6001
|
+
canActivate(activatedRoute, state) {
|
|
6002
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
6003
|
+
return true;
|
|
6004
|
+
});
|
|
6005
|
+
}
|
|
6006
|
+
}
|
|
6007
|
+
NoopAuthGuard.decorators = [
|
|
6008
|
+
{ type: Injectable, args: [{
|
|
6009
|
+
providedIn: 'root'
|
|
6010
|
+
},] }
|
|
6011
|
+
];
|
|
6012
|
+
/** @nocollapse */
|
|
6013
|
+
NoopAuthGuard.ctorParameters = () => [];
|
|
6014
|
+
/** @nocollapse */ NoopAuthGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function NoopAuthGuard_Factory() { return new NoopAuthGuard(); }, token: NoopAuthGuard, providedIn: "root" });
|
|
6015
|
+
|
|
6016
|
+
/**
|
|
6017
|
+
* @fileoverview added by tsickle
|
|
6018
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
6019
|
+
*/
|
|
6020
|
+
class VisitSanitiser {
|
|
6021
|
+
/**
|
|
6022
|
+
* @param {?} activatedRoute
|
|
6023
|
+
* @param {?} router
|
|
6024
|
+
* @param {?} placeHistory
|
|
6025
|
+
* @param {?} injector
|
|
6026
|
+
*/
|
|
6027
|
+
constructor(activatedRoute, router, placeHistory, injector) {
|
|
6028
|
+
this.activatedRoute = activatedRoute;
|
|
6029
|
+
this.router = router;
|
|
6030
|
+
this.placeHistory = placeHistory;
|
|
6031
|
+
this.injector = injector;
|
|
6032
|
+
}
|
|
6033
|
+
// @Trace()
|
|
6034
|
+
/**
|
|
6035
|
+
* @param {?} visit
|
|
6036
|
+
* @return {?}
|
|
6037
|
+
*/
|
|
6038
|
+
sanitise(visit) {
|
|
6039
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
6040
|
+
/** @type {?} */
|
|
6041
|
+
const placeDef = visit.placeDefinition;
|
|
6042
|
+
if (placeDef.hasRouteId()) {
|
|
6043
|
+
/** @type {?} */
|
|
6044
|
+
const routeIdDef = placeDef.getRouteIdParameterDef();
|
|
6045
|
+
/** @type {?} */
|
|
6046
|
+
const routeId = visit.getRouteId();
|
|
6047
|
+
/** @type {?} */
|
|
6048
|
+
const sanitisedValue = yield routeIdDef.sanitise(routeId, visit, this.placeHistory, this.injector);
|
|
6049
|
+
// console.log({routeId, sanitisedValue});
|
|
6050
|
+
// ###------- EARLY EXIT --------###
|
|
6051
|
+
if (routeIdDef.hasChanged(routeId, sanitisedValue)) {
|
|
6052
|
+
// if the route id has changed we redirect immediately as other
|
|
6053
|
+
// parameter sanitisers might use it.
|
|
6054
|
+
return visit.replace(routeIdDef, sanitisedValue);
|
|
6055
|
+
}
|
|
6056
|
+
}
|
|
6057
|
+
// if we didn't replace the routeId we continue the url present parameters.
|
|
6058
|
+
/** @type {?} */
|
|
6059
|
+
const parameterDefs = placeDef.getVisitParameterDefs({
|
|
6060
|
+
includeRouteParameters: true,
|
|
6061
|
+
includeNonRouteParameters: true
|
|
6062
|
+
});
|
|
6063
|
+
/** @type {?} */
|
|
6064
|
+
let sanitisedVisit = visit;
|
|
6065
|
+
for (let i = 0; i < parameterDefs.length; i++) {
|
|
6066
|
+
/** @type {?} */
|
|
6067
|
+
const def = parameterDefs[i];
|
|
6068
|
+
/** @type {?} */
|
|
6069
|
+
const value = visit.getParameter(def.name);
|
|
6070
|
+
/** @type {?} */
|
|
6071
|
+
const sanitisedValue = yield def.sanitise(value, sanitisedVisit, this.placeHistory, this.injector);
|
|
6072
|
+
if (def.hasChanged(value, sanitisedValue)) {
|
|
6073
|
+
sanitisedVisit = sanitisedVisit.replace(def, sanitisedValue);
|
|
6074
|
+
}
|
|
6075
|
+
}
|
|
6076
|
+
return sanitisedVisit.hasChangedFrom(visit) ? sanitisedVisit : visit;
|
|
6077
|
+
});
|
|
6078
|
+
}
|
|
6079
|
+
}
|
|
6080
|
+
if (false) {
|
|
6081
|
+
/**
|
|
6082
|
+
* @type {?}
|
|
6083
|
+
* @private
|
|
6084
|
+
*/
|
|
6085
|
+
VisitSanitiser.prototype.activatedRoute;
|
|
6086
|
+
/**
|
|
6087
|
+
* @type {?}
|
|
6088
|
+
* @private
|
|
6089
|
+
*/
|
|
6090
|
+
VisitSanitiser.prototype.router;
|
|
6091
|
+
/**
|
|
6092
|
+
* @type {?}
|
|
6093
|
+
* @private
|
|
6094
|
+
*/
|
|
6095
|
+
VisitSanitiser.prototype.placeHistory;
|
|
6096
|
+
/**
|
|
6097
|
+
* @type {?}
|
|
6098
|
+
* @private
|
|
6099
|
+
*/
|
|
6100
|
+
VisitSanitiser.prototype.injector;
|
|
6101
|
+
}
|
|
6102
|
+
|
|
5875
6103
|
/**
|
|
5876
6104
|
* @fileoverview added by tsickle
|
|
5877
6105
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -5879,19 +6107,21 @@ if (false) {
|
|
|
5879
6107
|
/**
|
|
5880
6108
|
* @abstract
|
|
5881
6109
|
*/
|
|
5882
|
-
class
|
|
6110
|
+
class PlaceGuard {
|
|
5883
6111
|
/**
|
|
5884
6112
|
* @param {?} router
|
|
5885
6113
|
* @param {?} urlSerializer
|
|
5886
6114
|
* @param {?} placeRouter
|
|
5887
6115
|
* @param {?} placeHistory
|
|
6116
|
+
* @param {?} interactionService
|
|
5888
6117
|
* @param {?} injector
|
|
5889
6118
|
*/
|
|
5890
|
-
constructor(router, urlSerializer, placeRouter, placeHistory, injector) {
|
|
6119
|
+
constructor(router, urlSerializer, placeRouter, placeHistory, interactionService, injector) {
|
|
5891
6120
|
this.router = router;
|
|
5892
6121
|
this.urlSerializer = urlSerializer;
|
|
5893
6122
|
this.placeRouter = placeRouter;
|
|
5894
6123
|
this.placeHistory = placeHistory;
|
|
6124
|
+
this.interactionService = interactionService;
|
|
5895
6125
|
this.injector = injector;
|
|
5896
6126
|
}
|
|
5897
6127
|
// @Trace()
|
|
@@ -5902,40 +6132,47 @@ class AbstractPlaceGuard {
|
|
|
5902
6132
|
*/
|
|
5903
6133
|
canActivate(activatedRoute, state) {
|
|
5904
6134
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6135
|
+
// TODO: this is ugly now that I'm return UrlSnapshots and not UrlTrees. It'd be better if the functions
|
|
6136
|
+
// weren't nested or if I implemented a handler chain.
|
|
5905
6137
|
return this.authorisePlaceThen(activatedRoute, state, (/**
|
|
5906
6138
|
* @param {?} placeDefinition
|
|
5907
6139
|
* @return {?}
|
|
5908
6140
|
*/
|
|
5909
6141
|
(placeDefinition) => __awaiter(this, void 0, void 0, function* () {
|
|
5910
|
-
// Parse our route params.
|
|
5911
|
-
/** @type {?} */
|
|
5912
|
-
const params = new ConsolidatedParameterMap(activatedRoute.paramMap, activatedRoute.url);
|
|
5913
6142
|
/** @type {?} */
|
|
5914
|
-
const
|
|
5915
|
-
|
|
5916
|
-
|
|
5917
|
-
|
|
5918
|
-
|
|
5919
|
-
/** @type {?} */
|
|
5920
|
-
const sanitisedVisit = yield sanitiser.sanitise(initialVisit.mergeRouteParameters(parsedParams));
|
|
5921
|
-
// Save the visit with any updated parameters. We need to save it so we remember any non route parameters
|
|
5922
|
-
this.placeRouter.navigationState.storeVisit(sanitisedVisit);
|
|
5923
|
-
if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {
|
|
5924
|
-
// Regenerate the url
|
|
6143
|
+
const result = yield this.cleanInteractionState(activatedRoute, state, (/**
|
|
6144
|
+
* @return {?}
|
|
6145
|
+
*/
|
|
6146
|
+
() => __awaiter(this, void 0, void 0, function* () {
|
|
6147
|
+
// Parse our route params.
|
|
5925
6148
|
/** @type {?} */
|
|
5926
|
-
const
|
|
5927
|
-
|
|
5928
|
-
|
|
5929
|
-
|
|
5930
|
-
|
|
5931
|
-
}
|
|
5932
|
-
|
|
5933
|
-
|
|
5934
|
-
|
|
5935
|
-
|
|
6149
|
+
const params = new ConsolidatedParameterMap(activatedRoute.paramMap, activatedRoute.url);
|
|
6150
|
+
/** @type {?} */
|
|
6151
|
+
const parsedParams = placeDefinition.parseRouteParams(params);
|
|
6152
|
+
/** @type {?} */
|
|
6153
|
+
const initialVisit = this.placeRouter.navigationState.getVisitFor(placeDefinition) || new Visit(placeDefinition, parsedParams);
|
|
6154
|
+
/** @type {?} */
|
|
6155
|
+
const sanitiser = new VisitSanitiser(activatedRoute, this.router, this.placeHistory, this.injector);
|
|
6156
|
+
/** @type {?} */
|
|
6157
|
+
const sanitisedVisit = yield sanitiser.sanitise(initialVisit.mergeRouteParameters(parsedParams));
|
|
6158
|
+
// Save the visit with any updated parameters. We need to save it so we remember any non route parameters
|
|
6159
|
+
this.placeRouter.navigationState.storeVisit(sanitisedVisit);
|
|
6160
|
+
if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {
|
|
6161
|
+
// Regenerate the url
|
|
6162
|
+
/** @type {?} */
|
|
6163
|
+
const urlSnapshot = this.placeRouter.parseUrl(state.url).updateVisitSegments(sanitisedVisit);
|
|
6164
|
+
console.log('##### Place Guard Redirect', urlSnapshot);
|
|
6165
|
+
return urlSnapshot;
|
|
6166
|
+
}
|
|
6167
|
+
else {
|
|
6168
|
+
return true;
|
|
6169
|
+
}
|
|
6170
|
+
})));
|
|
6171
|
+
return this.handleGuardResult(result);
|
|
5936
6172
|
})));
|
|
5937
6173
|
});
|
|
5938
6174
|
}
|
|
6175
|
+
// @Trace()
|
|
5939
6176
|
/**
|
|
5940
6177
|
* @param {?} component
|
|
5941
6178
|
* @param {?} currentRoute
|
|
@@ -5945,9 +6182,28 @@ class AbstractPlaceGuard {
|
|
|
5945
6182
|
*/
|
|
5946
6183
|
canDeactivate(component, currentRoute, currentState, nextState) {
|
|
5947
6184
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5948
|
-
|
|
6185
|
+
/** @type {?} */
|
|
6186
|
+
const currentUrl = this.placeRouter.parseUrl(currentState.url);
|
|
6187
|
+
/** @type {?} */
|
|
6188
|
+
const nextUrl = this.placeRouter.parseUrl(nextState.url);
|
|
6189
|
+
/** @type {?} */
|
|
6190
|
+
const result = yield this.placeRouter.navigationState.canDeactivatePlace(component, currentUrl, nextUrl);
|
|
6191
|
+
return this.handleGuardResult(result);
|
|
5949
6192
|
});
|
|
5950
6193
|
}
|
|
6194
|
+
/**
|
|
6195
|
+
* @private
|
|
6196
|
+
* @param {?} result
|
|
6197
|
+
* @return {?}
|
|
6198
|
+
*/
|
|
6199
|
+
handleGuardResult(result) {
|
|
6200
|
+
if (result instanceof UrlSnapshot) {
|
|
6201
|
+
return result.urlTree;
|
|
6202
|
+
}
|
|
6203
|
+
else {
|
|
6204
|
+
return result;
|
|
6205
|
+
}
|
|
6206
|
+
}
|
|
5951
6207
|
// @Trace()
|
|
5952
6208
|
/**
|
|
5953
6209
|
* @protected
|
|
@@ -5977,6 +6233,7 @@ class AbstractPlaceGuard {
|
|
|
5977
6233
|
}
|
|
5978
6234
|
});
|
|
5979
6235
|
}
|
|
6236
|
+
// @Trace()
|
|
5980
6237
|
/**
|
|
5981
6238
|
* @param {?} activatedRoute
|
|
5982
6239
|
* @param {?} state
|
|
@@ -5989,181 +6246,66 @@ class AbstractPlaceGuard {
|
|
|
5989
6246
|
return (authorised instanceof Observable) ? authorised.toPromise() : authorised;
|
|
5990
6247
|
});
|
|
5991
6248
|
}
|
|
5992
|
-
|
|
5993
|
-
__decorate([
|
|
5994
|
-
Trace(),
|
|
5995
|
-
__metadata("design:type", Function),
|
|
5996
|
-
__metadata("design:paramtypes", [ActivatedRouteSnapshot, RouterStateSnapshot]),
|
|
5997
|
-
__metadata("design:returntype", Promise)
|
|
5998
|
-
], AbstractPlaceGuard.prototype, "isAuthorised", null);
|
|
5999
|
-
if (false) {
|
|
6000
|
-
/**
|
|
6001
|
-
* @type {?}
|
|
6002
|
-
* @private
|
|
6003
|
-
*/
|
|
6004
|
-
AbstractPlaceGuard.prototype.router;
|
|
6005
|
-
/**
|
|
6006
|
-
* @type {?}
|
|
6007
|
-
* @private
|
|
6008
|
-
*/
|
|
6009
|
-
AbstractPlaceGuard.prototype.urlSerializer;
|
|
6010
|
-
/**
|
|
6011
|
-
* @type {?}
|
|
6012
|
-
* @private
|
|
6013
|
-
*/
|
|
6014
|
-
AbstractPlaceGuard.prototype.placeRouter;
|
|
6015
|
-
/**
|
|
6016
|
-
* @type {?}
|
|
6017
|
-
* @private
|
|
6018
|
-
*/
|
|
6019
|
-
AbstractPlaceGuard.prototype.placeHistory;
|
|
6020
|
-
/**
|
|
6021
|
-
* @type {?}
|
|
6022
|
-
* @private
|
|
6023
|
-
*/
|
|
6024
|
-
AbstractPlaceGuard.prototype.injector;
|
|
6025
|
-
/**
|
|
6026
|
-
* @abstract
|
|
6027
|
-
* @param {?} injector
|
|
6028
|
-
* @return {?}
|
|
6029
|
-
*/
|
|
6030
|
-
AbstractPlaceGuard.prototype.getAuthGuard = function (injector) { };
|
|
6031
|
-
}
|
|
6032
|
-
|
|
6033
|
-
/**
|
|
6034
|
-
* @fileoverview added by tsickle
|
|
6035
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
6036
|
-
*/
|
|
6037
|
-
class InteractionGuard {
|
|
6038
|
-
/**
|
|
6039
|
-
* @param {?} router
|
|
6040
|
-
* @param {?} injector
|
|
6041
|
-
* @param {?} placeRouter
|
|
6042
|
-
* @param {?} angularLocation
|
|
6043
|
-
* @param {?} interactionService
|
|
6044
|
-
*/
|
|
6045
|
-
constructor(router, injector, placeRouter, angularLocation, interactionService) {
|
|
6046
|
-
this.router = router;
|
|
6047
|
-
this.injector = injector;
|
|
6048
|
-
this.placeRouter = placeRouter;
|
|
6049
|
-
this.angularLocation = angularLocation;
|
|
6050
|
-
this.interactionService = interactionService;
|
|
6051
|
-
}
|
|
6249
|
+
// @Trace()
|
|
6052
6250
|
/**
|
|
6053
6251
|
* @param {?} route
|
|
6054
6252
|
* @param {?} state
|
|
6253
|
+
* @param {?} then
|
|
6055
6254
|
* @return {?}
|
|
6056
6255
|
*/
|
|
6057
|
-
|
|
6058
|
-
/** @type {?} */
|
|
6059
|
-
const url = this.router.parseUrl(state.url);
|
|
6060
|
-
if (!this.interactionService.isActive() && url.root.children[UrlSnapshot.INTERACTION_ROUTER_OUTLET]) {
|
|
6061
|
-
// This happens if we reload the page or the url was pasted as the route should only be activated
|
|
6062
|
-
// after the interaction context has become active.
|
|
6063
|
-
delete url.root.children[UrlSnapshot.INTERACTION_ROUTER_OUTLET];
|
|
6064
|
-
return url;
|
|
6065
|
-
}
|
|
6066
|
-
else {
|
|
6067
|
-
return true;
|
|
6068
|
-
}
|
|
6069
|
-
}
|
|
6070
|
-
/**
|
|
6071
|
-
* @param {?} component
|
|
6072
|
-
* @param {?} currentRoute
|
|
6073
|
-
* @param {?} currentState
|
|
6074
|
-
* @param {?=} nextState
|
|
6075
|
-
* @return {?}
|
|
6076
|
-
*/
|
|
6077
|
-
canDeactivate(component, currentRoute, currentState, nextState) {
|
|
6256
|
+
cleanInteractionState(route, state, then) {
|
|
6078
6257
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
|
|
6082
|
-
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
|
|
6088
|
-
activity.cancel();
|
|
6089
|
-
}
|
|
6258
|
+
/** @type {?} */
|
|
6259
|
+
const url = this.placeRouter.parseUrl(state.url);
|
|
6260
|
+
if (!this.interactionService.isActive() && url.hasInteractionIds()) {
|
|
6261
|
+
// This happens if we reload the page or the url was pasted as the route should only be activated
|
|
6262
|
+
// after the interaction context has become active.
|
|
6263
|
+
return url.removeInteractionIds();
|
|
6264
|
+
}
|
|
6265
|
+
else {
|
|
6266
|
+
return then();
|
|
6090
6267
|
}
|
|
6091
|
-
// IMPORTANT:
|
|
6092
|
-
// We always return true, the router state engine will redirect as required. Return false
|
|
6093
|
-
// during the guard causes all kinds of grief. It might be worth trying a redirect here
|
|
6094
|
-
// again now that our state engine is more thorough.
|
|
6095
|
-
return true;
|
|
6096
6268
|
});
|
|
6097
6269
|
}
|
|
6098
6270
|
}
|
|
6099
|
-
InteractionGuard.decorators = [
|
|
6100
|
-
{ type: Injectable, args: [{
|
|
6101
|
-
providedIn: 'root'
|
|
6102
|
-
},] }
|
|
6103
|
-
];
|
|
6104
|
-
/** @nocollapse */
|
|
6105
|
-
InteractionGuard.ctorParameters = () => [
|
|
6106
|
-
{ type: Router },
|
|
6107
|
-
{ type: Injector },
|
|
6108
|
-
{ type: PlaceRouter },
|
|
6109
|
-
{ type: Location },
|
|
6110
|
-
{ type: InteractionService }
|
|
6111
|
-
];
|
|
6112
|
-
/** @nocollapse */ InteractionGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function InteractionGuard_Factory() { return new InteractionGuard(ɵɵinject(Router), ɵɵinject(INJECTOR), ɵɵinject(PlaceRouter), ɵɵinject(Location), ɵɵinject(InteractionService)); }, token: InteractionGuard, providedIn: "root" });
|
|
6113
6271
|
if (false) {
|
|
6114
6272
|
/**
|
|
6115
6273
|
* @type {?}
|
|
6116
6274
|
* @private
|
|
6117
6275
|
*/
|
|
6118
|
-
|
|
6276
|
+
PlaceGuard.prototype.router;
|
|
6119
6277
|
/**
|
|
6120
6278
|
* @type {?}
|
|
6121
6279
|
* @private
|
|
6122
6280
|
*/
|
|
6123
|
-
|
|
6281
|
+
PlaceGuard.prototype.urlSerializer;
|
|
6124
6282
|
/**
|
|
6125
6283
|
* @type {?}
|
|
6126
6284
|
* @private
|
|
6127
6285
|
*/
|
|
6128
|
-
|
|
6286
|
+
PlaceGuard.prototype.placeRouter;
|
|
6129
6287
|
/**
|
|
6130
6288
|
* @type {?}
|
|
6131
6289
|
* @private
|
|
6132
6290
|
*/
|
|
6133
|
-
|
|
6291
|
+
PlaceGuard.prototype.placeHistory;
|
|
6134
6292
|
/**
|
|
6135
6293
|
* @type {?}
|
|
6136
6294
|
* @private
|
|
6137
6295
|
*/
|
|
6138
|
-
|
|
6139
|
-
}
|
|
6140
|
-
|
|
6141
|
-
/**
|
|
6142
|
-
* @fileoverview added by tsickle
|
|
6143
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
6144
|
-
*/
|
|
6145
|
-
class NoopAuthGuard {
|
|
6146
|
-
constructor() {
|
|
6147
|
-
}
|
|
6296
|
+
PlaceGuard.prototype.interactionService;
|
|
6148
6297
|
/**
|
|
6149
|
-
* @
|
|
6150
|
-
* @
|
|
6298
|
+
* @type {?}
|
|
6299
|
+
* @private
|
|
6300
|
+
*/
|
|
6301
|
+
PlaceGuard.prototype.injector;
|
|
6302
|
+
/**
|
|
6303
|
+
* @abstract
|
|
6304
|
+
* @param {?} injector
|
|
6151
6305
|
* @return {?}
|
|
6152
6306
|
*/
|
|
6153
|
-
|
|
6154
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
6155
|
-
return true;
|
|
6156
|
-
});
|
|
6157
|
-
}
|
|
6307
|
+
PlaceGuard.prototype.getAuthGuard = function (injector) { };
|
|
6158
6308
|
}
|
|
6159
|
-
NoopAuthGuard.decorators = [
|
|
6160
|
-
{ type: Injectable, args: [{
|
|
6161
|
-
providedIn: 'root'
|
|
6162
|
-
},] }
|
|
6163
|
-
];
|
|
6164
|
-
/** @nocollapse */
|
|
6165
|
-
NoopAuthGuard.ctorParameters = () => [];
|
|
6166
|
-
/** @nocollapse */ NoopAuthGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function NoopAuthGuard_Factory() { return new NoopAuthGuard(); }, token: NoopAuthGuard, providedIn: "root" });
|
|
6167
6309
|
|
|
6168
6310
|
/**
|
|
6169
6311
|
* @fileoverview added by tsickle
|
|
@@ -6412,5 +6554,5 @@ if (false) {
|
|
|
6412
6554
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
6413
6555
|
*/
|
|
6414
6556
|
|
|
6415
|
-
export { ACTIVITY_DATA, AUP_PLACE_CONFIG, AbstractActivity, AbstractInputComponent,
|
|
6557
|
+
export { ACTIVITY_DATA, AUP_PLACE_CONFIG, AbstractActivity, AbstractInputComponent, AbstractPlaceNavigationComponent, Activity, ActivityContainerComponent, ActivityOutletComponent, AlertDialogComponent, AngularUiPowerupsModule, Bounds, BusyOverlayComponent, CommandDirective, ComponentsModule, ConfirmThenDialogComponent, ConfirmationDialogComponent, ConsolidatedParameterMap, DEFINITION_META_DATA_KEY, DIALOG_INTERACTION_SERVICE_DEFAULTS, DialogInteractionContext, DialogInteractionContextFactory, Dimension, DirectivesModule, DisposableComponent, EmptyStateComponent, FocusBindingDirective, Formatter, InplaceInteractionContextComponent, InteractionContext, InteractionContextBase, InteractionModule, InteractionOutletComponent, InteractionService, LEFT_RIGHT_PLACE_ANIMATION, ListPlaceNavComponent, ModalInteractionContextFactory, NavigationState, NoopAuthGuard, NoopComponent, NumberInputComponent, ParameterDefinition, PasswordInputComponent, Place, PlaceComponent, PlaceComponentDeactivationHandler, PlaceDefinition, PlaceGuard, PlaceHistory, PlaceModule, PlaceOutletComponent, PlaceRouter, Point, ROUTE_PARAMETER_LIST_KEY, ResizeAwareComponent, RouteId, SelectInputComponent, StringInputComponent, TabbedPlaceNavigationComponent, UrlSnapshot, Visit, VisitParameter, VisitParameterList, VisitSanitiser, leftRightPlaceAnimation, slideDownAndUpAnimation, DirectivesModule as ɵa, CommandDirective as ɵb, InteractionModule as ɵba, ActivityContainerComponent as ɵbb, InteractionContextBase as ɵbc, InteractionContext as ɵbd, ActivityOutletComponent as ɵbe, ConfirmationDialogComponent as ɵbf, AbstractActivity as ɵbg, ACTIVITY_DATA as ɵbh, Activity as ɵbi, ConfirmThenDialogComponent as ɵbk, AlertDialogComponent as ɵbl, InteractionOutletComponent as ɵbn, InplaceInteractionContextComponent as ɵbo, FocusBindingDirective as ɵc, DisposableComponent as ɵd, ComponentsModule as ɵe, NumberInputComponent as ɵf, AbstractInputComponent as ɵg, StringInputComponent as ɵh, PasswordInputComponent as ɵi, SelectInputComponent as ɵj, NoopComponent as ɵk, PlaceModule as ɵl, EmptyStateComponent as ɵm, BusyOverlayComponent as ɵn, PlaceOutletComponent as ɵo, leftRightPlaceAnimation as ɵp, LEFT_RIGHT_PLACE_ANIMATION as ɵq, AUP_PLACE_CONFIG as ɵr, PlaceRouter as ɵt, PlaceHistory as ɵu, InteractionService as ɵv, ModalInteractionContextFactory as ɵw, TabbedPlaceNavigationComponent as ɵx, AbstractPlaceNavigationComponent as ɵy, ListPlaceNavComponent as ɵz };
|
|
6416
6558
|
//# sourceMappingURL=coolon-angular-ui-powerups.js.map
|