@coolon/angular-ui-powerups 0.0.119 → 0.0.120
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 +65 -161
- 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/lib/place/guards/navigation-state.js +43 -85
- package/esm2015/lib/place/guards/navigation-state.js.map +1 -1
- package/esm2015/lib/place/guards/navigation-state.metadata.json +1 -1
- package/esm2015/lib/place/place-router.js +9 -2
- package/esm2015/lib/place/place-router.js.map +1 -1
- package/esm2015/lib/place/place-router.metadata.json +1 -1
- package/esm5/lib/place/guards/navigation-state.js +52 -159
- package/esm5/lib/place/guards/navigation-state.js.map +1 -1
- package/esm5/lib/place/place-router.js +13 -2
- package/esm5/lib/place/place-router.js.map +1 -1
- package/fesm2015/coolon-angular-ui-powerups.js +52 -87
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +65 -161
- package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/place/guards/navigation-state.d.ts +4 -1
- package/lib/place/place-router.d.ts +4 -1
- package/package.json +1 -1
|
@@ -264,20 +264,19 @@ NavigationState = /** @class */ (function (_super) {
|
|
|
264
264
|
new NavigationState.IdleDuringInteraction(this.context, this.currentRouterUrl()) :
|
|
265
265
|
new NavigationState.Idle(this.context);
|
|
266
266
|
};
|
|
267
|
-
//
|
|
268
|
-
//
|
|
269
267
|
/**
|
|
270
268
|
* @param {?} url
|
|
269
|
+
* @param {?=} options
|
|
271
270
|
* @return {?}
|
|
272
271
|
*/
|
|
273
|
-
NavigationState.prototype.resetBrowserLocation =
|
|
274
|
-
//
|
|
275
|
-
/**
|
|
272
|
+
NavigationState.prototype.resetBrowserLocation = /**
|
|
276
273
|
* @param {?} url
|
|
274
|
+
* @param {?=} options
|
|
277
275
|
* @return {?}
|
|
278
276
|
*/
|
|
279
|
-
function (url) {
|
|
280
|
-
|
|
277
|
+
function (url, options) {
|
|
278
|
+
if (options === void 0) { options = { replaceCurrent: false }; }
|
|
279
|
+
this.placeRouter.resetBrowserLocation(url, options);
|
|
281
280
|
};
|
|
282
281
|
/**
|
|
283
282
|
* @param {?} event
|
|
@@ -323,6 +322,25 @@ NavigationState = /** @class */ (function (_super) {
|
|
|
323
322
|
return p + ": " + _this[p];
|
|
324
323
|
})).join(', ');
|
|
325
324
|
};
|
|
325
|
+
/**
|
|
326
|
+
* @protected
|
|
327
|
+
* @param {?} url
|
|
328
|
+
* @return {?}
|
|
329
|
+
*/
|
|
330
|
+
NavigationState.prototype.replaceBuggeredUrlAfterAngularRouterCancelled = /**
|
|
331
|
+
* @protected
|
|
332
|
+
* @param {?} url
|
|
333
|
+
* @return {?}
|
|
334
|
+
*/
|
|
335
|
+
function (url) {
|
|
336
|
+
// Angular calls _this.resetUrlToCurrentUrlTree() on cancelling and fucks our history.
|
|
337
|
+
// So this means that the top of the stack is the url we want to go back to, and not the one that was on
|
|
338
|
+
// it before the cancel event fired.
|
|
339
|
+
// So we need to:
|
|
340
|
+
// - replace the just inserted url with the one that used to be there.
|
|
341
|
+
// - push our actual url back onto the top of the stack.
|
|
342
|
+
this.resetBrowserLocation(url, { replaceCurrent: true });
|
|
343
|
+
};
|
|
326
344
|
return NavigationState;
|
|
327
345
|
}(GarbageCollector));
|
|
328
346
|
/**
|
|
@@ -660,11 +678,11 @@ if (false) {
|
|
|
660
678
|
* @return {?}
|
|
661
679
|
*/
|
|
662
680
|
function (event) {
|
|
681
|
+
this.replaceBuggeredUrlAfterAngularRouterCancelled(this.poppedHistoryUrl);
|
|
663
682
|
// Angular doesn't preserve the url when a guard cancels the back button.
|
|
664
683
|
// See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
665
684
|
Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
|
|
666
|
-
this.resetBrowserLocation(this.
|
|
667
|
-
this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.
|
|
685
|
+
this.resetBrowserLocation(this.startingUrl);
|
|
668
686
|
return new Idle(this.context);
|
|
669
687
|
};
|
|
670
688
|
/**
|
|
@@ -676,15 +694,18 @@ if (false) {
|
|
|
676
694
|
* @return {?}
|
|
677
695
|
*/
|
|
678
696
|
function (event) {
|
|
679
|
-
// navigation was aborted.
|
|
680
|
-
if (this.currentRouterUrl() !== this.startingUrl) {
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
697
|
+
// // navigation was aborted.
|
|
698
|
+
// if (this.currentRouterUrl() !== this.startingUrl) {
|
|
699
|
+
// // Angular doesn't preserve the url when a guard cancels the back button.
|
|
700
|
+
// // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
701
|
+
// Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
|
|
702
|
+
// this.restoreHistory([
|
|
703
|
+
// this.poppedHistoryUrl,
|
|
704
|
+
// this.startingUrl
|
|
705
|
+
// ]);
|
|
706
|
+
// }
|
|
707
|
+
// return new Idle(this.context);
|
|
708
|
+
return this.illegalTransition("when do I get this???");
|
|
688
709
|
};
|
|
689
710
|
/**
|
|
690
711
|
* @param {?} locationTriggerUrl
|
|
@@ -833,6 +854,7 @@ if (false) {
|
|
|
833
854
|
* @return {?}
|
|
834
855
|
*/
|
|
835
856
|
function (event) {
|
|
857
|
+
// TODO: this.replaceBuggeredUrlAfterAngularRouterCancells(...);???
|
|
836
858
|
if (this.context.interactionService.isActive()) {
|
|
837
859
|
/** @type {?} */
|
|
838
860
|
var interactionIds = this.interactionService.activeInteractionContextIds.value;
|
|
@@ -954,6 +976,7 @@ if (false) {
|
|
|
954
976
|
this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);
|
|
955
977
|
}
|
|
956
978
|
else {
|
|
979
|
+
// this.replaceBuggeredUrlAfterAngularRouterCancells(this.start)
|
|
957
980
|
this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.
|
|
958
981
|
}
|
|
959
982
|
return this.createIdleState();
|
|
@@ -1054,6 +1077,7 @@ if (false) {
|
|
|
1054
1077
|
* @return {?}
|
|
1055
1078
|
*/
|
|
1056
1079
|
function (event) {
|
|
1080
|
+
// TODO: this.replaceBuggeredUrlAfterAngularRouterCancells(...);???
|
|
1057
1081
|
if (this.interactionService.isActive()) {
|
|
1058
1082
|
/** @type {?} */
|
|
1059
1083
|
var interactionIds = this.interactionService.activeInteractionContextIds.value;
|
|
@@ -1089,7 +1113,7 @@ if (false) {
|
|
|
1089
1113
|
* @return {?}
|
|
1090
1114
|
*/
|
|
1091
1115
|
function (newUrl) {
|
|
1092
|
-
return this.illegalTransition(
|
|
1116
|
+
return this.illegalTransition('Leaving interaction after pop-state should\'t block so should never see a back button click');
|
|
1093
1117
|
};
|
|
1094
1118
|
return LeavingInteractionAfterPopStateTransition;
|
|
1095
1119
|
}(AbstractInteractionTransition));
|
|
@@ -1100,74 +1124,6 @@ if (false) {
|
|
|
1100
1124
|
/** @type {?} */
|
|
1101
1125
|
LeavingInteractionAfterPopStateTransition.prototype.poppedHistoryUrl;
|
|
1102
1126
|
}
|
|
1103
|
-
// See LeavingInteractionAfterPopStateTransition.createNavigationInteractionCancelledState(...) above.
|
|
1104
|
-
//
|
|
1105
|
-
// export class LeavingInteractionAfterPopStateCancelled extends NavigationState {
|
|
1106
|
-
//
|
|
1107
|
-
// readonly isPopState = false;
|
|
1108
|
-
// firstCancelHandled = false;
|
|
1109
|
-
// popStateHandled = false;
|
|
1110
|
-
// popStateEventUrl: string;
|
|
1111
|
-
// debugPropertyKeys = ['idle', 'startingUrl', 'poppedHistoryUrl', 'locationChangeTriggerUrl', 'popStateEventUrl', 'firstCancelHandled', 'popStateHandled'];
|
|
1112
|
-
//
|
|
1113
|
-
// constructor(context: Context,
|
|
1114
|
-
// readonly startingUrl: string,
|
|
1115
|
-
// readonly locationChangeTriggerUrl: string,
|
|
1116
|
-
// readonly poppedHistoryUrl: string) {
|
|
1117
|
-
// super(context);
|
|
1118
|
-
// }
|
|
1119
|
-
//
|
|
1120
|
-
// get isTransitional() {
|
|
1121
|
-
// return true;
|
|
1122
|
-
// }
|
|
1123
|
-
//
|
|
1124
|
-
// onRouterStarted(event: NavigationStart): NavigationState {
|
|
1125
|
-
// return this.ignore(event);
|
|
1126
|
-
// }
|
|
1127
|
-
//
|
|
1128
|
-
//
|
|
1129
|
-
// onRouterCancelled(event: NavigationCancel): NavigationState {
|
|
1130
|
-
//
|
|
1131
|
-
// // if (this.firstCancelHandled && this.popStateHandled) {
|
|
1132
|
-
// // // Angular doesn't preserve the url when a guard cancels the back button.
|
|
1133
|
-
// // // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
1134
|
-
// // Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
|
|
1135
|
-
// // this.resetBrowserLocation(this.locationChangeTriggerUrl); // put the second back click one back in.
|
|
1136
|
-
// // this.resetBrowserLocation(this.poppedHistoryUrl); // put the first back click one back in.
|
|
1137
|
-
// // if (this.interactionService.isActive()) {
|
|
1138
|
-
// // const interactionIds = this.interactionService.activeInteractionContextIds.value;
|
|
1139
|
-
// // this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);
|
|
1140
|
-
// // } else {
|
|
1141
|
-
// // this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.
|
|
1142
|
-
// // }
|
|
1143
|
-
// // return this.createIdleState();
|
|
1144
|
-
// // } else {
|
|
1145
|
-
// // this.firstCancelHandled = true;
|
|
1146
|
-
// return this.ignore(event);
|
|
1147
|
-
// // }
|
|
1148
|
-
// }
|
|
1149
|
-
//
|
|
1150
|
-
//
|
|
1151
|
-
// onRouterEnd(event: NavigationEnd): NavigationState {
|
|
1152
|
-
// return this.ignore(event);
|
|
1153
|
-
// }
|
|
1154
|
-
//
|
|
1155
|
-
//
|
|
1156
|
-
// onRouterError(event: NavigationError): NavigationState {
|
|
1157
|
-
// return this.ignore(event);
|
|
1158
|
-
// }
|
|
1159
|
-
//
|
|
1160
|
-
//
|
|
1161
|
-
// onPopState(event: NavigationStart): NavigationState {
|
|
1162
|
-
// // this.popStateHandled = true;
|
|
1163
|
-
// // this.popStateEventUrl = event.url;
|
|
1164
|
-
// return this.ignore(event);
|
|
1165
|
-
// }
|
|
1166
|
-
//
|
|
1167
|
-
// async canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot> {
|
|
1168
|
-
// return false;
|
|
1169
|
-
// }
|
|
1170
|
-
// }
|
|
1171
1127
|
/**
|
|
1172
1128
|
* This state handles the scenario where a link navigation triggered an interaction and the user clicked back a to cancel it.
|
|
1173
1129
|
* The routing event sequence is different depending on the link that was clicked.
|
|
@@ -1190,76 +1146,7 @@ if (false) {
|
|
|
1190
1146
|
* -> PopState
|
|
1191
1147
|
* -> NavigationCancel
|
|
1192
1148
|
*/
|
|
1193
|
-
var
|
|
1194
|
-
// See LeavingInteractionAfterPopStateTransition.createNavigationInteractionCancelledState(...) above.
|
|
1195
|
-
//
|
|
1196
|
-
// export class LeavingInteractionAfterPopStateCancelled extends NavigationState {
|
|
1197
|
-
//
|
|
1198
|
-
// readonly isPopState = false;
|
|
1199
|
-
// firstCancelHandled = false;
|
|
1200
|
-
// popStateHandled = false;
|
|
1201
|
-
// popStateEventUrl: string;
|
|
1202
|
-
// debugPropertyKeys = ['idle', 'startingUrl', 'poppedHistoryUrl', 'locationChangeTriggerUrl', 'popStateEventUrl', 'firstCancelHandled', 'popStateHandled'];
|
|
1203
|
-
//
|
|
1204
|
-
// constructor(context: Context,
|
|
1205
|
-
// readonly startingUrl: string,
|
|
1206
|
-
// readonly locationChangeTriggerUrl: string,
|
|
1207
|
-
// readonly poppedHistoryUrl: string) {
|
|
1208
|
-
// super(context);
|
|
1209
|
-
// }
|
|
1210
|
-
//
|
|
1211
|
-
// get isTransitional() {
|
|
1212
|
-
// return true;
|
|
1213
|
-
// }
|
|
1214
|
-
//
|
|
1215
|
-
// onRouterStarted(event: NavigationStart): NavigationState {
|
|
1216
|
-
// return this.ignore(event);
|
|
1217
|
-
// }
|
|
1218
|
-
//
|
|
1219
|
-
//
|
|
1220
|
-
// onRouterCancelled(event: NavigationCancel): NavigationState {
|
|
1221
|
-
//
|
|
1222
|
-
// // if (this.firstCancelHandled && this.popStateHandled) {
|
|
1223
|
-
// // // Angular doesn't preserve the url when a guard cancels the back button.
|
|
1224
|
-
// // // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
1225
|
-
// // Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
|
|
1226
|
-
// // this.resetBrowserLocation(this.locationChangeTriggerUrl); // put the second back click one back in.
|
|
1227
|
-
// // this.resetBrowserLocation(this.poppedHistoryUrl); // put the first back click one back in.
|
|
1228
|
-
// // if (this.interactionService.isActive()) {
|
|
1229
|
-
// // const interactionIds = this.interactionService.activeInteractionContextIds.value;
|
|
1230
|
-
// // this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);
|
|
1231
|
-
// // } else {
|
|
1232
|
-
// // this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.
|
|
1233
|
-
// // }
|
|
1234
|
-
// // return this.createIdleState();
|
|
1235
|
-
// // } else {
|
|
1236
|
-
// // this.firstCancelHandled = true;
|
|
1237
|
-
// return this.ignore(event);
|
|
1238
|
-
// // }
|
|
1239
|
-
// }
|
|
1240
|
-
//
|
|
1241
|
-
//
|
|
1242
|
-
// onRouterEnd(event: NavigationEnd): NavigationState {
|
|
1243
|
-
// return this.ignore(event);
|
|
1244
|
-
// }
|
|
1245
|
-
//
|
|
1246
|
-
//
|
|
1247
|
-
// onRouterError(event: NavigationError): NavigationState {
|
|
1248
|
-
// return this.ignore(event);
|
|
1249
|
-
// }
|
|
1250
|
-
//
|
|
1251
|
-
//
|
|
1252
|
-
// onPopState(event: NavigationStart): NavigationState {
|
|
1253
|
-
// // this.popStateHandled = true;
|
|
1254
|
-
// // this.popStateEventUrl = event.url;
|
|
1255
|
-
// return this.ignore(event);
|
|
1256
|
-
// }
|
|
1257
|
-
//
|
|
1258
|
-
// async canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot> {
|
|
1259
|
-
// return false;
|
|
1260
|
-
// }
|
|
1261
|
-
// }
|
|
1262
|
-
/**
|
|
1149
|
+
var /**
|
|
1263
1150
|
* This state handles the scenario where a link navigation triggered an interaction and the user clicked back a to cancel it.
|
|
1264
1151
|
* The routing event sequence is different depending on the link that was clicked.
|
|
1265
1152
|
*
|
|
@@ -1382,7 +1269,7 @@ if (false) {
|
|
|
1382
1269
|
*/
|
|
1383
1270
|
function () {
|
|
1384
1271
|
Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
|
|
1385
|
-
this.
|
|
1272
|
+
this.replaceBuggeredUrlAfterAngularRouterCancelled(this.clickedLinkUrl); // put the back click one back in.
|
|
1386
1273
|
if (this.interactionService.isActive()) {
|
|
1387
1274
|
/** @type {?} */
|
|
1388
1275
|
var interactionIds = this.interactionService.activeInteractionContextIds.value;
|
|
@@ -1502,7 +1389,13 @@ if (false) {
|
|
|
1502
1389
|
// Angular doesn't preserve the url when a guard cancels the back button.
|
|
1503
1390
|
// See https://github.com/angular/angular/issues/13586#issuecomment-432795720
|
|
1504
1391
|
Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');
|
|
1505
|
-
//
|
|
1392
|
+
// Angular calls _this.resetUrlToCurrentUrlTree() on cancelling and fucks our history.
|
|
1393
|
+
// So this means that the top of the stack is the url we want to go back to, and not the one that was on
|
|
1394
|
+
// it before the cancel event fired.
|
|
1395
|
+
// So we need to:
|
|
1396
|
+
// - replace the just inserted url with the one that used to be there.
|
|
1397
|
+
// - push our actual url back onto the top of the stack.
|
|
1398
|
+
this.replaceBuggeredUrlAfterAngularRouterCancelled(this.locationChangeTriggerUrl);
|
|
1506
1399
|
this.resetBrowserLocation(this.poppedHistoryUrl); // put the first back click one back in.
|
|
1507
1400
|
if (this.interactionService.isActive()) {
|
|
1508
1401
|
/** @type {?} */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation-state.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/place/guards/navigation-state.ts"],"names":[],"mappings":";;;;;AACA,OAAO,EAAE,GAAG,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,EAAS,MAAM,gBAAgB,CAAC;AAQ5E,OAAO,EAAE,iCAAiC,EAAE,MAAM,wCAAwC,CAAC;;;;AAE3F;;;;IAA8C,2CAAgB;IAS5D,yBAA+B,OAAgC;QAA/D,YACE,iBAAO,SACR;QAF8B,aAAO,GAAP,OAAO,CAAyB;QAPvD,aAAO,GAAG,IAAI,GAAG,EAA0B,CAAC;QAKpD,uBAAiB,GAAa,EAAE,CAAC;;IAIjC,CAAC;IAED,sBAAI,iCAAI;;;;QAAR;YACE,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAC/B,CAAC;;;OAAA;IAED,sBAAI,iCAAI;;;;QAAR;YACE,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC;QAC9B,CAAC;;;OAAA;IAED,sBAAI,wCAAW;;;;QAAf;YACE,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC;QAClC,CAAC;;;OAAA;IAED,sBAAI,+CAAkB;;;;QAAtB;YACE,OAAO,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC;QACzC,CAAC;;;OAAA;IAED,sBAAI,+CAAkB;;;;QAAtB;YACE,OAAO,IAAI,CAAC;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AAsB;YAC/B,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;YAC5B,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC,GAAG,CAAC;YAClC,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC5B,CAAC;;;;;;;QAEK,4EAAkB;;;;;;QAAxB,UAAyB,SAAyB,EAAE,UAAuB,EAAE,OAAoB;;;oBAC/F,sBAAO,KAAK,EAAC;;;SACd;QACH,sDAAC;IAAD,CAAC,AA7DD,CAAqE,eAAe,GA6DnF;IA7DY,+DAA+C,kDA6D3D,CAAA;;;QA3DC,qEAA4B;;QAC5B,6EAA2B;;QAC3B,0EAAwB;;QACxB,2EAAyB;;QACzB,4EAAyJ;;QAG7I,sEAA4B;;QAC5B,mFAAyC;;QACzC,2EAAiC;;AAmDjD,CAAC,EAnlBgB,eAAe,KAAf,eAAe,QAmlB/B","sourcesContent":["import { NavigationCancel, NavigationEnd, NavigationError, NavigationStart, RouterEvent } from '@angular/router';\nimport { Dsl, GarbageCollector, lang, Logger, Trace } from '@coolon/pectin';\nimport { InteractionContext } from '../../interaction/interaction-context';\nimport { InteractionService } from '../../interaction/services/interaction.service';\nimport { PlaceComponent } from '../place-component';\nimport { PlaceDefinition } from '../place-definition';\nimport { PlaceRouter } from '../place-router';\nimport { UrlSnapshot } from '../url-snapshot';\nimport { Visit } from '../visit';\nimport { PlaceComponentDeactivationHandler } from './place-component-deactivation-handler';\n\nexport abstract class NavigationState extends GarbageCollector {\n\n private _visits = new Map<PlaceDefinition, Visit>();\n\n abstract readonly isTransitional: boolean;\n abstract readonly startingUrl: string;\n abstract readonly isPopState: boolean;\n debugPropertyKeys: string[] = [];\n\n constructor(protected readonly context: NavigationState.Context) {\n super();\n }\n\n get name(): string {\n return this.constructor.name;\n }\n\n get idle() {\n return !this.isTransitional;\n }\n\n get placeRouter(): PlaceRouter {\n return this.context.placeRouter;\n }\n\n get interactionService(): InteractionService {\n return this.context.interactionService;\n }\n\n get interactionContext(): InteractionContext {\n return null;\n }\n\n storeVisit(visit: Visit) {\n this._visits.set(visit.placeDefinition, visit);\n }\n\n getVisitFor(placeDef: PlaceDefinition) {\n return this._visits.get(placeDef);\n }\n\n onPlaceNavigationStart(visit: Visit, initialUrl: string): NavigationState {\n return this.illegalTransition('onPlaceNavigationStart');\n }\n\n onPopState(event: NavigationStart): NavigationState {\n return this.illegalTransition(event);\n }\n\n onRouterStarted(event: NavigationStart): NavigationState {\n return this.illegalTransition(event);\n }\n\n onRouterCancelled(event: NavigationCancel): NavigationState {\n return this.illegalTransition(event);\n }\n\n onRouterError(event: NavigationError): NavigationState {\n return this.illegalTransition(event);\n }\n\n onRouterEnd(event: NavigationEnd): NavigationState {\n return this.illegalTransition(event);\n }\n\n onBackClickedDuringNavigationInteraction(newUrl: string): NavigationState {\n return this.illegalTransition('onBackClickedDuringNavigationInteraction');\n }\n\n async canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot> {\n return this.illegalTransition('canDeactivatePlace');\n }\n\n getVisits(): Visit[] {\n return Array.from(this._visits.values());\n }\n\n protected illegalTransition<R>(message: string | RouterEvent): R {\n return lang.illegalState(`${message.toString()} not supported by ${this.toString()}`);\n }\n\n protected currentRouterUrl(): string {\n return this.placeRouter.getCurrentRouterUrl();\n }\n\n protected createTransitionStateFor(event: NavigationStart) {\n const popstate = event.navigationTrigger === 'popstate';\n const inInteraction = this.interactionService.isActive();\n if (popstate) {\n return inInteraction ?\n new NavigationState.LeavingInteractionAfterPopStateTransition(this.context, this.currentRouterUrl(), event.url) :\n new NavigationState.PopStateTransition(this.context, this.currentRouterUrl(), event.url);\n } else {\n return inInteraction ?\n new NavigationState.StartingInteractionTransition(this.context, this.currentRouterUrl()) :\n new NavigationState.NavigationTransition(this.context, this.currentRouterUrl());\n }\n }\n\n protected createIdleState() {\n return this.interactionService.isActive() ?\n new NavigationState.IdleDuringInteraction(this.context, this.currentRouterUrl()) :\n new NavigationState.Idle(this.context);\n }\n\n //\n resetBrowserLocation(url) {\n this.placeRouter.resetBrowserLocation(url);\n }\n\n ignore(event: RouterEvent, reason?: string): NavigationState {\n reason = reason ? ` -> ${reason}` : '';\n Logger.get(this).info(`Ignoring router event${reason}: ${event.constructor.name} -> ${event.url} :: ${this.toString()}`);\n return this;\n }\n\n toString(): string {\n return `${this.constructor.name}(${this.debugState()})`;\n }\n\n protected debugState(properties?: string[]) {\n return (properties || this.debugPropertyKeys).map(p => {\n return `${p}: ${this[p]}`;\n }).join(', ');\n }\n}\n\nexport namespace NavigationState {\n\n export class Context {\n constructor(\n readonly placeRouter: PlaceRouter,\n readonly interactionService: InteractionService,\n readonly notifySuccess: (success: NavigationState) => void) {\n }\n }\n\n export class Idle extends NavigationState {\n readonly isTransitional = false;\n readonly startingUrl = null;\n readonly isPopState = false;\n\n constructor(context: Context) {\n super(context);\n }\n\n onPlaceNavigationStart(visit: Visit, initialUrl: string): NavigationState {\n const navigationTransition = new NavigationTransition(this.context, initialUrl);\n navigationTransition.storeVisit(visit);\n return navigationTransition;\n }\n\n onRouterStarted(event: NavigationStart): NavigationState {\n\n // calling angularLocation.go() to clear back state can trigger router cycles to the current url if we don't ignore them\n if (event.url === this.currentRouterUrl()) {\n Logger.get(this).info(`navigation started to same url -> ${event.url}`);\n return this;\n }\n\n if (this.placeRouter.hasActiveInteractionIds(event.url)) {\n Logger.get(this).info(`navigation started with interaction outlet -> ${event.url}`);\n return new StartingInteractionTransition(this.context, event.url);\n } else {\n return this.createTransitionStateFor(event);\n }\n }\n\n onPopState(event: NavigationStart): NavigationState {\n return this.createTransitionStateFor(event);\n }\n }\n\n export abstract class AbstractNavigationTransition extends NavigationState {\n readonly isTransitional = true;\n private componentDeactivationHandlers = new Map<PlaceComponent, PlaceComponentDeactivationHandler>();\n private _interactionContext: InteractionContext;\n\n constructor(context: Context, readonly startingUrl: string) {\n super(context);\n this._interactionContext = this.interactionService._createExclusiveModalInteractionContext();\n this.onDispose(() => {\n // the interaction context can be detached during the back button cancellation state transition\n // as the transition is synchronous and activityCancellation isn't. Otherwise dispose will be\n // called before the context has been cancelled. It might be work having the interaction context\n // automatically cancel if the context is disposed so we don't have worry about detaching etc.\n if (this._interactionContext) {\n this._interactionContext.dispose(); // or do something like cancelAndDispose?\n }\n });\n }\n\n get interactionContext(): InteractionContext {\n return this._interactionContext;\n }\n\n onRouterStarted(event: NavigationStart): NavigationState {\n // active sessions can have many cancel start cycles due\n // to place guard redirects\n return this;\n }\n\n onRouterEnd(event: NavigationEnd): NavigationState {\n // navigation succeeded\n this.context.notifySuccess(this);\n return new Idle(this.context);\n }\n\n\n onBackClickedDuringNavigationInteraction(newUrl: string): NavigationState {\n Logger.get(this).info(`back button pressed during navigation session interaction promise`);\n // detach the interaction from the session so it doesn't get disposed until the activity has completed.\n const navigationInteraction = this.detachInteractionContext();\n const { when } = Dsl.disposeWith(navigationInteraction);\n // TODO: I need to make the exclusive interaction context disallow nested activities or\n // that would mess things up entirely. Or, can I do a context.abortAll().then(..)\n Logger.get(this).info('cancelling current navigation activity..');\n navigationInteraction.cancelActiveActivity().then(() => {\n navigationInteraction.dispose();\n });\n\n return this.createNavigationInteractionCancelledState(newUrl);\n }\n\n abstract createNavigationInteractionCancelledState(newUrl: string): NavigationState\n\n async canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot> {\n // lookup the handler and create it if we've not seen it yet\n let handler = this.componentDeactivationHandlers.get(component);\n if (!handler) {\n const isPrimaryHandler = this.componentDeactivationHandlers.size === 0; // only primary handler cancels the app model interations\n handler = new PlaceComponentDeactivationHandler(component, this, isPrimaryHandler);\n this.componentDeactivationHandlers.set(component, handler);\n }\n return handler.canDeactivate(currentUrl, nextUrl);\n }\n\n protected detachInteractionContext(): InteractionContext {\n const context = this._interactionContext;\n this._interactionContext = null;\n return context;\n }\n }\n\n export class NavigationTransition extends AbstractNavigationTransition {\n readonly isPopState = false;\n debugPropertyKeys = ['startingUrl'];\n\n onRouterCancelled(event: NavigationCancel): NavigationState {\n return this;\n }\n\n onRouterError(event: NavigationError): NavigationState {\n // navigation was aborted.\n return new Idle(this.context);\n }\n\n createNavigationInteractionCancelledState(newUrl: string): NavigationState {\n return new LinkTriggeredNavigationInteractionCancelled(\n this.context,\n this.startingUrl,\n newUrl\n );\n }\n }\n\n export class PopStateTransition extends AbstractNavigationTransition {\n readonly isPopState = true;\n debugPropertyKeys = ['startingUrl', 'poppedHistoryUrl'];\n\n constructor(context: NavigationState.Context, startingUrl: string, readonly poppedHistoryUrl: string) {\n super(context, startingUrl);\n }\n\n onRouterCancelled(event: NavigationCancel): NavigationState {\n // Angular doesn't preserve the url when a guard cancels the back button.\n // See https://github.com/angular/angular/issues/13586#issuecomment-432795720\n Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');\n this.resetBrowserLocation(this.poppedHistoryUrl); // put the popped history item back in.\n this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.\n return new Idle(this.context);\n }\n\n onRouterError(event: NavigationError): NavigationState {\n // navigation was aborted.\n if (this.currentRouterUrl() !== this.startingUrl) {\n // Angular doesn't preserve the url when a guard cancels the back button.\n // See https://github.com/angular/angular/issues/13586#issuecomment-432795720\n Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');\n this.resetBrowserLocation(this.poppedHistoryUrl); // put the popped history item back in.\n this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.\n }\n return new Idle(this.context);\n }\n\n createNavigationInteractionCancelledState(locationTriggerUrl: string): NavigationState {\n return new PopStateTriggeredNavigationInteractionCancelled(this.context,\n this.startingUrl,\n locationTriggerUrl,\n this.poppedHistoryUrl);\n }\n\n }\n\n export abstract class AbstractInteractionTransition extends AbstractNavigationTransition {\n readonly isTransitional = true;\n\n constructor(context: Context, readonly startingUrl: string) {\n super(context, startingUrl);\n }\n\n }\n\n\n// The following states exist to handle all events while any kind of navigation is in progress. That way all other states can\n// happily ignore interaction contexts.\n\n /**\n * This is the non transitional (i.e. rest) state that is used whenever an interaction context is active.\n */\n export class IdleDuringInteraction extends NavigationState {\n readonly isTransitional = false;\n readonly isPopState = false;\n debugPropertyKeys = ['startingUrl'];\n\n constructor(context: Context, readonly startingUrl: string) {\n super(context);\n }\n\n onPlaceNavigationStart(visit: Visit, initialUrl: string): NavigationState {\n // we're in an interaction and the user clicked back\n const navigationTransition = new StartingInteractionTransition(this.context, initialUrl);\n navigationTransition.storeVisit(visit);\n return navigationTransition;\n }\n\n onRouterStarted(event: NavigationStart): NavigationState {\n return new StartingInteractionTransition(this.context, event.url);\n }\n\n onPopState(event: NavigationStart): NavigationState {\n // we're in an interaction and the user clicked back\n return new LeavingInteractionAfterPopStateTransition(this.context, event.url, event.url);\n }\n }\n\n /**\n * This state exists to handle all events while any kind of navigation is in progress. That way all other states can\n * happily ignore interaction contexts.\n * NOTE: This state is activated when ever an interaction is started. It might be better to split it into\n * different states for different scenarios, e.g. starting model, starting model during route guard etc.\n */\n export class StartingInteractionTransition extends AbstractInteractionTransition {\n readonly isPopState = false;\n\n\n onRouterCancelled(event: NavigationCancel): NavigationState {\n if (this.context.interactionService.isActive()) {\n const interactionIds = this.interactionService.activeInteractionContextIds.value;\n this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);\n return new IdleDuringInteraction(this.context, this.startingUrl);\n } else {\n return new Idle(this.context);\n }\n }\n\n\n onRouterError(event: NavigationError): NavigationState {\n // navigation was aborted.\n return new IdleDuringInteraction(this.context, this.startingUrl);\n }\n\n\n onRouterEnd(event: NavigationEnd): NavigationState {\n if (this.context.interactionService.isActive()) {\n return new IdleDuringInteraction(this.context, this.startingUrl);\n } else {\n return new Idle(this.context);\n }\n }\n\n createNavigationInteractionCancelledState(locationTriggerUrl: string): NavigationState {\n return new LeavingInteractionTransitionCancelled(this.context,\n this.startingUrl,\n locationTriggerUrl);\n }\n }\n\n /**\n * The sequence of router events are:\n * Error -> url = url of navigation link\n * End\n * onPopState url = current intereaction url sans the query params\n * Cancel url == same as above.\n */\n export class LeavingInteractionTransitionCancelled extends NavigationState {\n\n readonly isPopState = false;\n firstCancelHandled = false;\n popStateHandled = false;\n popStateEventUrl: string;\n debugPropertyKeys = ['idle', 'startingUrl', 'poppedHistoryUrl', 'locationChangeTriggerUrl', 'popStateEventUrl', 'firstCancelHandled', 'popStateHandled'];\n\n constructor(context: Context,\n readonly startingUrl: string,\n readonly locationChangeTriggerUrl: string) {\n super(context);\n }\n\n get isTransitional() {\n return true;\n }\n\n onRouterStarted(event: NavigationStart): NavigationState {\n return this.ignore(event);\n }\n\n onRouterCancelled(event: NavigationCancel): NavigationState {\n // Angular doesn't preserve the url when a guard cancels the back button.\n // See https://github.com/angular/angular/issues/13586#issuecomment-432795720\n Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');\n if (this.interactionService.isActive()) {\n const interactionIds = this.interactionService.activeInteractionContextIds.value;\n this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);\n } else {\n this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.\n }\n return this.createIdleState();\n }\n\n onRouterEnd(event: NavigationEnd): NavigationState {\n return this.ignore(event);\n }\n\n onRouterError(event: NavigationError): NavigationState {\n return this.ignore(event);\n }\n\n onPopState(event: NavigationStart): NavigationState {\n return this.ignore(event);\n }\n\n async canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot> {\n return false;\n }\n }\n\n\n /**\n * This state exists to handle all events while any kind of navigation is in progress. That way all other states can\n * happily ignore interaction contexts.\n */\n export class LeavingInteractionAfterPopStateTransition extends AbstractInteractionTransition {\n readonly isPopState = true;\n\n constructor(context: NavigationState.Context, startingUrl: string, readonly poppedHistoryUrl: string) {\n super(context, startingUrl);\n }\n\n\n onRouterCancelled(event: NavigationCancel): NavigationState {\n if (this.interactionService.isActive()) {\n const interactionIds = this.interactionService.activeInteractionContextIds.value;\n this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);\n return new IdleDuringInteraction(this.context, this.startingUrl);\n } else {\n return new Idle(this.context);\n }\n }\n\n\n onRouterEnd(event: NavigationEnd): NavigationState {\n if (this.context.interactionService.isActive()) {\n return new IdleDuringInteraction(this.context, this.startingUrl);\n } else {\n return new Idle(this.context);\n }\n }\n\n createNavigationInteractionCancelledState(newUrl: string): NavigationState {\n return this.illegalTransition(\"Leaving interaction after pop-state should't block so should never see a back button click\")\n }\n\n }\n\n // See LeavingInteractionAfterPopStateTransition.createNavigationInteractionCancelledState(...) above.\n //\n // export class LeavingInteractionAfterPopStateCancelled extends NavigationState {\n //\n // readonly isPopState = false;\n // firstCancelHandled = false;\n // popStateHandled = false;\n // popStateEventUrl: string;\n // debugPropertyKeys = ['idle', 'startingUrl', 'poppedHistoryUrl', 'locationChangeTriggerUrl', 'popStateEventUrl', 'firstCancelHandled', 'popStateHandled'];\n //\n // constructor(context: Context,\n // readonly startingUrl: string,\n // readonly locationChangeTriggerUrl: string,\n // readonly poppedHistoryUrl: string) {\n // super(context);\n // }\n //\n // get isTransitional() {\n // return true;\n // }\n //\n // onRouterStarted(event: NavigationStart): NavigationState {\n // return this.ignore(event);\n // }\n //\n //\n // onRouterCancelled(event: NavigationCancel): NavigationState {\n //\n // // if (this.firstCancelHandled && this.popStateHandled) {\n // // // Angular doesn't preserve the url when a guard cancels the back button.\n // // // See https://github.com/angular/angular/issues/13586#issuecomment-432795720\n // // Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');\n // // this.resetBrowserLocation(this.locationChangeTriggerUrl); // put the second back click one back in.\n // // this.resetBrowserLocation(this.poppedHistoryUrl); // put the first back click one back in.\n // // if (this.interactionService.isActive()) {\n // // const interactionIds = this.interactionService.activeInteractionContextIds.value;\n // // this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);\n // // } else {\n // // this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.\n // // }\n // // return this.createIdleState();\n // // } else {\n // // this.firstCancelHandled = true;\n // return this.ignore(event);\n // // }\n // }\n //\n //\n // onRouterEnd(event: NavigationEnd): NavigationState {\n // return this.ignore(event);\n // }\n //\n //\n // onRouterError(event: NavigationError): NavigationState {\n // return this.ignore(event);\n // }\n //\n //\n // onPopState(event: NavigationStart): NavigationState {\n // // this.popStateHandled = true;\n // // this.popStateEventUrl = event.url;\n // return this.ignore(event);\n // }\n //\n // async canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot> {\n // return false;\n // }\n // }\n\n\n /**\n * This state handles the scenario where a link navigation triggered an interaction and the user clicked back a to cancel it.\n * The routing event sequence is different depending on the link that was clicked.\n *\n * If the link was the same as the previous history location (i.e. they've gone back via a link rather than clicking back) then the sequence is:\n *\n * -> Idle -> NavigationTransition\n * -> confirm dialog shown.\n * -> click back\n * -> NavigationCancel -> clickedLinkUrl === cancel.url\n * -> NavigationEnd\n *\n * Otherwise if the link is different from teh history location then the sequence is:\n *\n * -> Idle -> NavigationTransition\n * -> confirm dialog shown.\n * -> click back\n * -> NavigationCancel -> clickedLinkUrl !== cancel.url\n * -> NavigationEnd\n * -> PopState\n * -> NavigationCancel\n */\n export class LinkTriggeredNavigationInteractionCancelled extends NavigationState {\n\n readonly isPopState = false;\n firstCancelEventUrl: string;\n popStateEventUrl: string;\n clickedLinkMatchedBackButtonUrl = false;\n debugPropertyKeys = ['idle', 'startingUrl', 'clickedLinkUrl', 'firstCancelEventUrl', 'clickedLinkMatchedBackButtonUrl', 'popStateEventUrl'];\n\n constructor(context: Context,\n readonly startingUrl: string,\n readonly clickedLinkUrl: string) {\n super(context);\n }\n\n get isTransitional() {\n return true;\n }\n\n onRouterStarted(event: NavigationStart): NavigationState {\n return this.ignore(event);\n }\n\n onRouterCancelled(event: NavigationCancel): NavigationState {\n // TODO: should really split this into two sub states in the first cancel event.\n if (!this.firstCancelEventUrl) {\n this.firstCancelEventUrl = event.url;\n this.clickedLinkMatchedBackButtonUrl = event.url === this.clickedLinkUrl;\n return this.ignore(event);\n } else {\n // we wait for our popped state to come in.\n if (!this.clickedLinkMatchedBackButtonUrl && this.popStateEventUrl) {\n return this.finaliseRouting();\n }\n }\n }\n\n onRouterEnd(event: NavigationEnd): NavigationState {\n if (this.clickedLinkMatchedBackButtonUrl) {\n return this.finaliseRouting();\n } else {\n return this.ignore(event);\n }\n }\n\n onRouterError(event: NavigationError): NavigationState {\n return this.ignore(event);\n }\n\n onPopState(event: NavigationStart): NavigationState {\n this.popStateEventUrl = event.url;\n return this.ignore(event);\n }\n\n finaliseRouting() {\n Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');\n this.resetBrowserLocation(this.clickedLinkUrl); // put the back click one back in.\n if (this.interactionService.isActive()) {\n const interactionIds = this.interactionService.activeInteractionContextIds.value;\n // Angular doesn't preserve the url when a guard cancels the back button.\n // See https://github.com/angular/angular/issues/13586#issuecomment-432795720\n this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);\n } else {\n this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.\n }\n return this.createIdleState();\n }\n\n async canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot> {\n return false;\n }\n }\n\n /**\n * This state handles the scenario where a pop state triggered and interaction and the user clickeb back a second time to cancel it.\n * The sequence of routing events/state transitions is as follows.\n * -> Idle -> PopStateTransition (poppedHistoryUrl == page to go to, startingUrl = page to stay on )\n * -> confirm dialog shown.\n * -> click back\n * -> PopStateTransition -> CancelledDuringBackButtonNavigationInteraction(trigger url is the page before the popped history url)\n * -> NavigationCancel (for the previous back)\n * -> PopState\n * -> NavigationCancel\n */\n export class PopStateTriggeredNavigationInteractionCancelled extends NavigationState {\n\n readonly isPopState = false;\n firstCancelHandled = false;\n popStateHandled = false;\n popStateEventUrl: string;\n debugPropertyKeys = ['idle', 'startingUrl', 'poppedHistoryUrl', 'locationChangeTriggerUrl', 'popStateEventUrl', 'firstCancelHandled', 'popStateHandled'];\n\n constructor(context: Context,\n readonly startingUrl: string,\n readonly locationChangeTriggerUrl: string,\n readonly poppedHistoryUrl: string) {\n super(context);\n }\n\n get isTransitional() {\n return true;\n }\n\n onRouterStarted(event: NavigationStart): NavigationState {\n return this.ignore(event);\n }\n\n onRouterCancelled(event: NavigationCancel): NavigationState {\n\n if (this.firstCancelHandled && this.popStateHandled) {\n // Angular doesn't preserve the url when a guard cancels the back button.\n // See https://github.com/angular/angular/issues/13586#issuecomment-432795720\n Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');\n // this.resetBrowserLocation(this.locationChangeTriggerUrl); // put the second back click one back in.\n this.resetBrowserLocation(this.poppedHistoryUrl); // put the first back click one back in.\n if (this.interactionService.isActive()) {\n const interactionIds = this.interactionService.activeInteractionContextIds.value;\n this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);\n } else {\n this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.\n }\n return this.createIdleState();\n } else {\n this.firstCancelHandled = true;\n return this.ignore(event);\n }\n }\n\n onRouterEnd(event: NavigationEnd): NavigationState {\n return this.ignore(event);\n }\n\n onRouterError(event: NavigationError): NavigationState {\n return this.ignore(event);\n }\n\n onPopState(event: NavigationStart): NavigationState {\n this.popStateHandled = true;\n this.popStateEventUrl = event.url;\n return this.ignore(event);\n }\n\n async canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot> {\n return false;\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"navigation-state.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/place/guards/navigation-state.ts"],"names":[],"mappings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,kDAoE3D,CAAA;;;QAlEC,qEAA4B;;QAC5B,6EAA2B;;QAC3B,0EAAwB;;QACxB,2EAAyB;;QACzB,4EAAyJ;;QAG7I,sEAA4B;;QAC5B,mFAAyC;;QACzC,2EAAiC;;AA0DjD,CAAC,EA3hBgB,eAAe,KAAf,eAAe,QA2hB/B","sourcesContent":["import { NavigationCancel, NavigationEnd, NavigationError, NavigationStart, RouterEvent } from '@angular/router';\nimport { Dsl, GarbageCollector, lang, Logger } from '@coolon/pectin';\nimport { InteractionContext } from '../../interaction/interaction-context';\nimport { InteractionService } from '../../interaction/services/interaction.service';\nimport { PlaceComponent } from '../place-component';\nimport { PlaceDefinition } from '../place-definition';\nimport { PlaceRouter } from '../place-router';\nimport { UrlSnapshot } from '../url-snapshot';\nimport { Visit } from '../visit';\nimport { PlaceComponentDeactivationHandler } from './place-component-deactivation-handler';\n\nexport abstract class NavigationState extends GarbageCollector {\n\n private _visits = new Map<PlaceDefinition, Visit>();\n\n abstract readonly isTransitional: boolean;\n abstract readonly startingUrl: string;\n abstract readonly isPopState: boolean;\n debugPropertyKeys: string[] = [];\n\n constructor(protected readonly context: NavigationState.Context) {\n super();\n }\n\n get name(): string {\n return this.constructor.name;\n }\n\n get idle() {\n return !this.isTransitional;\n }\n\n get placeRouter(): PlaceRouter {\n return this.context.placeRouter;\n }\n\n get interactionService(): InteractionService {\n return this.context.interactionService;\n }\n\n get interactionContext(): InteractionContext {\n return null;\n }\n\n storeVisit(visit: Visit) {\n this._visits.set(visit.placeDefinition, visit);\n }\n\n getVisitFor(placeDef: PlaceDefinition) {\n return this._visits.get(placeDef);\n }\n\n onPlaceNavigationStart(visit: Visit, initialUrl: string): NavigationState {\n return this.illegalTransition('onPlaceNavigationStart');\n }\n\n onPopState(event: NavigationStart): NavigationState {\n return this.illegalTransition(event);\n }\n\n onRouterStarted(event: NavigationStart): NavigationState {\n return this.illegalTransition(event);\n }\n\n onRouterCancelled(event: NavigationCancel): NavigationState {\n return this.illegalTransition(event);\n }\n\n onRouterError(event: NavigationError): NavigationState {\n return this.illegalTransition(event);\n }\n\n onRouterEnd(event: NavigationEnd): NavigationState {\n return this.illegalTransition(event);\n }\n\n onBackClickedDuringNavigationInteraction(newUrl: string): NavigationState {\n return this.illegalTransition('onBackClickedDuringNavigationInteraction');\n }\n\n async canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot> {\n return this.illegalTransition('canDeactivatePlace');\n }\n\n getVisits(): Visit[] {\n return Array.from(this._visits.values());\n }\n\n protected illegalTransition<R>(message: string | RouterEvent): R {\n return lang.illegalState(`${message.toString()} not supported by ${this.toString()}`);\n }\n\n protected currentRouterUrl(): string {\n return this.placeRouter.getCurrentRouterUrl();\n }\n\n protected createTransitionStateFor(event: NavigationStart) {\n const popstate = event.navigationTrigger === 'popstate';\n const inInteraction = this.interactionService.isActive();\n if (popstate) {\n return inInteraction ?\n new NavigationState.LeavingInteractionAfterPopStateTransition(this.context, this.currentRouterUrl(), event.url) :\n new NavigationState.PopStateTransition(this.context, this.currentRouterUrl(), event.url);\n } else {\n return inInteraction ?\n new NavigationState.StartingInteractionTransition(this.context, this.currentRouterUrl()) :\n new NavigationState.NavigationTransition(this.context, this.currentRouterUrl());\n }\n }\n\n protected createIdleState() {\n return this.interactionService.isActive() ?\n new NavigationState.IdleDuringInteraction(this.context, this.currentRouterUrl()) :\n new NavigationState.Idle(this.context);\n }\n\n\n resetBrowserLocation(url, options: {replaceCurrent: boolean} = {replaceCurrent: false}) {\n this.placeRouter.resetBrowserLocation(url, options);\n }\n\n ignore(event: RouterEvent, reason?: string): NavigationState {\n reason = reason ? ` -> ${reason}` : '';\n Logger.get(this).info(`Ignoring router event${reason}: ${event.constructor.name} -> ${event.url} :: ${this.toString()}`);\n return this;\n }\n\n toString(): string {\n return `${this.constructor.name}(${this.debugState()})`;\n }\n\n protected debugState(properties?: string[]) {\n return (properties || this.debugPropertyKeys).map(p => {\n return `${p}: ${this[p]}`;\n }).join(', ');\n }\n\n protected replaceBuggeredUrlAfterAngularRouterCancelled(url:string) {\n // Angular calls _this.resetUrlToCurrentUrlTree() on cancelling and fucks our history.\n // So this means that the top of the stack is the url we want to go back to, and not the one that was on\n // it before the cancel event fired.\n // So we need to:\n // - replace the just inserted url with the one that used to be there.\n // - push our actual url back onto the top of the stack.\n this.resetBrowserLocation(url, {replaceCurrent: true});\n }\n\n}\n\nexport namespace NavigationState {\n\n export class Context {\n constructor(\n readonly placeRouter: PlaceRouter,\n readonly interactionService: InteractionService,\n readonly notifySuccess: (success: NavigationState) => void) {\n }\n }\n\n export class Idle extends NavigationState {\n readonly isTransitional = false;\n readonly startingUrl = null;\n readonly isPopState = false;\n\n constructor(context: Context) {\n super(context);\n }\n\n onPlaceNavigationStart(visit: Visit, initialUrl: string): NavigationState {\n const navigationTransition = new NavigationTransition(this.context, initialUrl);\n navigationTransition.storeVisit(visit);\n return navigationTransition;\n }\n\n onRouterStarted(event: NavigationStart): NavigationState {\n\n // calling angularLocation.go() to clear back state can trigger router cycles to the current url if we don't ignore them\n if (event.url === this.currentRouterUrl()) {\n Logger.get(this).info(`navigation started to same url -> ${event.url}`);\n return this;\n }\n\n if (this.placeRouter.hasActiveInteractionIds(event.url)) {\n Logger.get(this).info(`navigation started with interaction outlet -> ${event.url}`);\n return new StartingInteractionTransition(this.context, event.url);\n } else {\n return this.createTransitionStateFor(event);\n }\n }\n\n onPopState(event: NavigationStart): NavigationState {\n return this.createTransitionStateFor(event);\n }\n }\n\n export abstract class AbstractNavigationTransition extends NavigationState {\n readonly isTransitional = true;\n private componentDeactivationHandlers = new Map<PlaceComponent, PlaceComponentDeactivationHandler>();\n private _interactionContext: InteractionContext;\n\n constructor(context: Context, readonly startingUrl: string) {\n super(context);\n this._interactionContext = this.interactionService._createExclusiveModalInteractionContext();\n this.onDispose(() => {\n // the interaction context can be detached during the back button cancellation state transition\n // as the transition is synchronous and activityCancellation isn't. Otherwise dispose will be\n // called before the context has been cancelled. It might be work having the interaction context\n // automatically cancel if the context is disposed so we don't have worry about detaching etc.\n if (this._interactionContext) {\n this._interactionContext.dispose(); // or do something like cancelAndDispose?\n }\n });\n }\n\n get interactionContext(): InteractionContext {\n return this._interactionContext;\n }\n\n onRouterStarted(event: NavigationStart): NavigationState {\n // active sessions can have many cancel start cycles due\n // to place guard redirects\n return this;\n }\n\n onRouterEnd(event: NavigationEnd): NavigationState {\n // navigation succeeded\n this.context.notifySuccess(this);\n return new Idle(this.context);\n }\n\n\n onBackClickedDuringNavigationInteraction(newUrl: string): NavigationState {\n Logger.get(this).info(`back button pressed during navigation session interaction promise`);\n // detach the interaction from the session so it doesn't get disposed until the activity has completed.\n const navigationInteraction = this.detachInteractionContext();\n const { when } = Dsl.disposeWith(navigationInteraction);\n // TODO: I need to make the exclusive interaction context disallow nested activities or\n // that would mess things up entirely. Or, can I do a context.abortAll().then(..)\n Logger.get(this).info('cancelling current navigation activity..');\n navigationInteraction.cancelActiveActivity().then(() => {\n navigationInteraction.dispose();\n });\n\n return this.createNavigationInteractionCancelledState(newUrl);\n }\n\n abstract createNavigationInteractionCancelledState(newUrl: string): NavigationState\n\n async canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot> {\n // lookup the handler and create it if we've not seen it yet\n let handler = this.componentDeactivationHandlers.get(component);\n if (!handler) {\n const isPrimaryHandler = this.componentDeactivationHandlers.size === 0; // only primary handler cancels the app model interations\n handler = new PlaceComponentDeactivationHandler(component, this, isPrimaryHandler);\n this.componentDeactivationHandlers.set(component, handler);\n }\n return handler.canDeactivate(currentUrl, nextUrl);\n }\n\n protected detachInteractionContext(): InteractionContext {\n const context = this._interactionContext;\n this._interactionContext = null;\n return context;\n }\n }\n\n export class NavigationTransition extends AbstractNavigationTransition {\n readonly isPopState = false;\n debugPropertyKeys = ['startingUrl'];\n\n onRouterCancelled(event: NavigationCancel): NavigationState {\n return this;\n }\n\n onRouterError(event: NavigationError): NavigationState {\n // navigation was aborted.\n return new Idle(this.context);\n }\n\n createNavigationInteractionCancelledState(newUrl: string): NavigationState {\n return new LinkTriggeredNavigationInteractionCancelled(\n this.context,\n this.startingUrl,\n newUrl\n );\n }\n\n }\n\n export class PopStateTransition extends AbstractNavigationTransition {\n readonly isPopState = true;\n debugPropertyKeys = ['startingUrl', 'poppedHistoryUrl'];\n\n constructor(context: NavigationState.Context, startingUrl: string, readonly poppedHistoryUrl: string) {\n super(context, startingUrl);\n }\n\n onRouterCancelled(event: NavigationCancel): NavigationState {\n this.replaceBuggeredUrlAfterAngularRouterCancelled(this.poppedHistoryUrl);\n // Angular doesn't preserve the url when a guard cancels the back button.\n // See https://github.com/angular/angular/issues/13586#issuecomment-432795720\n Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');\n this.resetBrowserLocation(this.startingUrl);\n return new Idle(this.context);\n }\n\n\n onRouterError(event: NavigationError): NavigationState {\n // // navigation was aborted.\n // if (this.currentRouterUrl() !== this.startingUrl) {\n // // Angular doesn't preserve the url when a guard cancels the back button.\n // // See https://github.com/angular/angular/issues/13586#issuecomment-432795720\n // Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');\n // this.restoreHistory([\n // this.poppedHistoryUrl,\n // this.startingUrl\n // ]);\n // }\n // return new Idle(this.context);\n return this.illegalTransition(\"when do I get this???\")\n }\n\n createNavigationInteractionCancelledState(locationTriggerUrl: string): NavigationState {\n return new PopStateTriggeredNavigationInteractionCancelled(this.context,\n this.startingUrl,\n locationTriggerUrl,\n this.poppedHistoryUrl);\n }\n\n }\n\n export abstract class AbstractInteractionTransition extends AbstractNavigationTransition {\n readonly isTransitional = true;\n\n constructor(context: Context, readonly startingUrl: string) {\n super(context, startingUrl);\n }\n\n }\n\n\n// The following states exist to handle all events while any kind of navigation is in progress. That way all other states can\n// happily ignore interaction contexts.\n\n /**\n * This is the non transitional (i.e. rest) state that is used whenever an interaction context is active.\n */\n export class IdleDuringInteraction extends NavigationState {\n readonly isTransitional = false;\n readonly isPopState = false;\n debugPropertyKeys = ['startingUrl'];\n\n constructor(context: Context, readonly startingUrl: string) {\n super(context);\n }\n\n onPlaceNavigationStart(visit: Visit, initialUrl: string): NavigationState {\n // we're in an interaction and the user clicked back\n const navigationTransition = new StartingInteractionTransition(this.context, initialUrl);\n navigationTransition.storeVisit(visit);\n return navigationTransition;\n }\n\n onRouterStarted(event: NavigationStart): NavigationState {\n return new StartingInteractionTransition(this.context, event.url);\n }\n\n onPopState(event: NavigationStart): NavigationState {\n // we're in an interaction and the user clicked back\n return new LeavingInteractionAfterPopStateTransition(this.context, event.url, event.url);\n }\n }\n\n /**\n * This state exists to handle all events while any kind of navigation is in progress. That way all other states can\n * happily ignore interaction contexts.\n * NOTE: This state is activated when ever an interaction is started. It might be better to split it into\n * different states for different scenarios, e.g. starting model, starting model during route guard etc.\n */\n export class StartingInteractionTransition extends AbstractInteractionTransition {\n readonly isPopState = false;\n\n\n onRouterCancelled(event: NavigationCancel): NavigationState {\n // TODO: this.replaceBuggeredUrlAfterAngularRouterCancells(...);???\n if (this.context.interactionService.isActive()) {\n const interactionIds = this.interactionService.activeInteractionContextIds.value;\n this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);\n return new IdleDuringInteraction(this.context, this.startingUrl);\n } else {\n return new Idle(this.context);\n }\n }\n\n\n onRouterError(event: NavigationError): NavigationState {\n // navigation was aborted.\n return new IdleDuringInteraction(this.context, this.startingUrl);\n }\n\n\n onRouterEnd(event: NavigationEnd): NavigationState {\n if (this.context.interactionService.isActive()) {\n return new IdleDuringInteraction(this.context, this.startingUrl);\n } else {\n return new Idle(this.context);\n }\n }\n\n createNavigationInteractionCancelledState(locationTriggerUrl: string): NavigationState {\n return new LeavingInteractionTransitionCancelled(this.context,\n this.startingUrl,\n locationTriggerUrl);\n }\n }\n\n /**\n * The sequence of router events are:\n * Error -> url = url of navigation link\n * End\n * onPopState url = current intereaction url sans the query params\n * Cancel url == same as above.\n */\n export class LeavingInteractionTransitionCancelled extends NavigationState {\n\n readonly isPopState = false;\n firstCancelHandled = false;\n popStateHandled = false;\n popStateEventUrl: string;\n debugPropertyKeys = ['idle', 'startingUrl', 'poppedHistoryUrl', 'locationChangeTriggerUrl', 'popStateEventUrl', 'firstCancelHandled', 'popStateHandled'];\n\n constructor(context: Context,\n readonly startingUrl: string,\n readonly locationChangeTriggerUrl: string) {\n super(context);\n }\n\n get isTransitional() {\n return true;\n }\n\n onRouterStarted(event: NavigationStart): NavigationState {\n return this.ignore(event);\n }\n\n onRouterCancelled(event: NavigationCancel): NavigationState {\n // Angular doesn't preserve the url when a guard cancels the back button.\n // See https://github.com/angular/angular/issues/13586#issuecomment-432795720\n Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');\n if (this.interactionService.isActive()) {\n const interactionIds = this.interactionService.activeInteractionContextIds.value;\n this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);\n } else {\n // this.replaceBuggeredUrlAfterAngularRouterCancells(this.start)\n this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.\n }\n return this.createIdleState();\n }\n\n onRouterEnd(event: NavigationEnd): NavigationState {\n return this.ignore(event);\n }\n\n onRouterError(event: NavigationError): NavigationState {\n return this.ignore(event);\n }\n\n onPopState(event: NavigationStart): NavigationState {\n return this.ignore(event);\n }\n\n async canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot> {\n return false;\n }\n }\n\n\n /**\n * This state exists to handle all events while any kind of navigation is in progress. That way all other states can\n * happily ignore interaction contexts.\n */\n export class LeavingInteractionAfterPopStateTransition extends AbstractInteractionTransition {\n readonly isPopState = true;\n\n constructor(context: NavigationState.Context, startingUrl: string, readonly poppedHistoryUrl: string) {\n super(context, startingUrl);\n }\n\n onRouterCancelled(event: NavigationCancel): NavigationState {\n // TODO: this.replaceBuggeredUrlAfterAngularRouterCancells(...);???\n if (this.interactionService.isActive()) {\n const interactionIds = this.interactionService.activeInteractionContextIds.value;\n this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);\n return new IdleDuringInteraction(this.context, this.startingUrl);\n } else {\n return new Idle(this.context);\n }\n }\n\n\n onRouterEnd(event: NavigationEnd): NavigationState {\n if (this.context.interactionService.isActive()) {\n return new IdleDuringInteraction(this.context, this.startingUrl);\n } else {\n return new Idle(this.context);\n }\n }\n\n createNavigationInteractionCancelledState(newUrl: string): NavigationState {\n return this.illegalTransition('Leaving interaction after pop-state should\\'t block so should never see a back button click');\n }\n\n }\n\n /**\n * This state handles the scenario where a link navigation triggered an interaction and the user clicked back a to cancel it.\n * The routing event sequence is different depending on the link that was clicked.\n *\n * If the link was the same as the previous history location (i.e. they've gone back via a link rather than clicking back) then the sequence is:\n *\n * -> Idle -> NavigationTransition\n * -> confirm dialog shown.\n * -> click back\n * -> NavigationCancel -> clickedLinkUrl === cancel.url\n * -> NavigationEnd\n *\n * Otherwise if the link is different from teh history location then the sequence is:\n *\n * -> Idle -> NavigationTransition\n * -> confirm dialog shown.\n * -> click back\n * -> NavigationCancel -> clickedLinkUrl !== cancel.url\n * -> NavigationEnd\n * -> PopState\n * -> NavigationCancel\n */\n export class LinkTriggeredNavigationInteractionCancelled extends NavigationState {\n\n readonly isPopState = false;\n firstCancelEventUrl: string;\n popStateEventUrl: string;\n clickedLinkMatchedBackButtonUrl = false;\n debugPropertyKeys = ['idle', 'startingUrl', 'clickedLinkUrl', 'firstCancelEventUrl', 'clickedLinkMatchedBackButtonUrl', 'popStateEventUrl'];\n\n constructor(context: Context,\n readonly startingUrl: string,\n readonly clickedLinkUrl: string) {\n super(context);\n }\n\n get isTransitional() {\n return true;\n }\n\n onRouterStarted(event: NavigationStart): NavigationState {\n return this.ignore(event);\n }\n\n onRouterCancelled(event: NavigationCancel): NavigationState {\n // TODO: should really split this into two sub states in the first cancel event.\n if (!this.firstCancelEventUrl) {\n this.firstCancelEventUrl = event.url;\n this.clickedLinkMatchedBackButtonUrl = event.url === this.clickedLinkUrl;\n return this.ignore(event);\n } else {\n // we wait for our popped state to come in.\n if (!this.clickedLinkMatchedBackButtonUrl && this.popStateEventUrl) {\n return this.finaliseRouting();\n }\n }\n }\n\n onRouterEnd(event: NavigationEnd): NavigationState {\n if (this.clickedLinkMatchedBackButtonUrl) {\n return this.finaliseRouting();\n } else {\n return this.ignore(event);\n }\n }\n\n onRouterError(event: NavigationError): NavigationState {\n return this.ignore(event);\n }\n\n onPopState(event: NavigationStart): NavigationState {\n this.popStateEventUrl = event.url;\n return this.ignore(event);\n }\n\n finaliseRouting() {\n Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');\n this.replaceBuggeredUrlAfterAngularRouterCancelled(this.clickedLinkUrl); // put the back click one back in.\n if (this.interactionService.isActive()) {\n const interactionIds = this.interactionService.activeInteractionContextIds.value;\n // Angular doesn't preserve the url when a guard cancels the back button.\n // See https://github.com/angular/angular/issues/13586#issuecomment-432795720\n this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);\n } else {\n this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.\n }\n return this.createIdleState();\n }\n\n async canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot> {\n return false;\n }\n }\n\n /**\n * This state handles the scenario where a pop state triggered and interaction and the user clickeb back a second time to cancel it.\n * The sequence of routing events/state transitions is as follows.\n * -> Idle -> PopStateTransition (poppedHistoryUrl == page to go to, startingUrl = page to stay on )\n * -> confirm dialog shown.\n * -> click back\n * -> PopStateTransition -> CancelledDuringBackButtonNavigationInteraction(trigger url is the page before the popped history url)\n * -> NavigationCancel (for the previous back)\n * -> PopState\n * -> NavigationCancel\n */\n export class PopStateTriggeredNavigationInteractionCancelled extends NavigationState {\n\n readonly isPopState = false;\n firstCancelHandled = false;\n popStateHandled = false;\n popStateEventUrl: string;\n debugPropertyKeys = ['idle', 'startingUrl', 'poppedHistoryUrl', 'locationChangeTriggerUrl', 'popStateEventUrl', 'firstCancelHandled', 'popStateHandled'];\n\n constructor(context: Context,\n readonly startingUrl: string,\n readonly locationChangeTriggerUrl: string,\n readonly poppedHistoryUrl: string) {\n super(context);\n }\n\n get isTransitional() {\n return true;\n }\n\n onRouterStarted(event: NavigationStart): NavigationState {\n return this.ignore(event);\n }\n\n onRouterCancelled(event: NavigationCancel): NavigationState {\n\n if (this.firstCancelHandled && this.popStateHandled) {\n // Angular doesn't preserve the url when a guard cancels the back button.\n // See https://github.com/angular/angular/issues/13586#issuecomment-432795720\n Logger.get(this).info('WORK-AROUND: Updating browser location after pop state - see angular issue #13586');\n\n // Angular calls _this.resetUrlToCurrentUrlTree() on cancelling and fucks our history.\n // So this means that the top of the stack is the url we want to go back to, and not the one that was on\n // it before the cancel event fired.\n // So we need to:\n // - replace the just inserted url with the one that used to be there.\n // - push our actual url back onto the top of the stack.\n this.replaceBuggeredUrlAfterAngularRouterCancelled(this.locationChangeTriggerUrl);\n this.resetBrowserLocation(this.poppedHistoryUrl); // put the first back click one back in.\n if (this.interactionService.isActive()) {\n const interactionIds = this.interactionService.activeInteractionContextIds.value;\n this.resetBrowserLocation(this.placeRouter.parseUrl(this.startingUrl).updateInteractionIds(interactionIds).url);\n } else {\n this.resetBrowserLocation(this.startingUrl); // and now put our own url back in.\n }\n return this.createIdleState();\n } else {\n this.firstCancelHandled = true;\n return this.ignore(event);\n }\n }\n\n onRouterEnd(event: NavigationEnd): NavigationState {\n return this.ignore(event);\n }\n\n onRouterError(event: NavigationError): NavigationState {\n return this.ignore(event);\n }\n\n onPopState(event: NavigationStart): NavigationState {\n this.popStateHandled = true;\n this.popStateEventUrl = event.url;\n return this.ignore(event);\n }\n\n async canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot> {\n return false;\n }\n }\n}\n"]}
|
|
@@ -399,14 +399,25 @@ var PlaceRouter = /** @class */ (function (_super) {
|
|
|
399
399
|
};
|
|
400
400
|
/**
|
|
401
401
|
* @param {?} url
|
|
402
|
+
* @param {?} options
|
|
402
403
|
* @return {?}
|
|
403
404
|
*/
|
|
404
405
|
PlaceRouter.prototype.resetBrowserLocation = /**
|
|
405
406
|
* @param {?} url
|
|
407
|
+
* @param {?} options
|
|
406
408
|
* @return {?}
|
|
407
409
|
*/
|
|
408
|
-
function (url) {
|
|
409
|
-
this.angularLocation.go(url);
|
|
410
|
+
function (url, options) {
|
|
411
|
+
options.replaceCurrent ? this.angularLocation.replaceState(url) : this.angularLocation.go(url);
|
|
412
|
+
};
|
|
413
|
+
/**
|
|
414
|
+
* @return {?}
|
|
415
|
+
*/
|
|
416
|
+
PlaceRouter.prototype.forward = /**
|
|
417
|
+
* @return {?}
|
|
418
|
+
*/
|
|
419
|
+
function () {
|
|
420
|
+
this.angularLocation.forward();
|
|
410
421
|
};
|
|
411
422
|
/**
|
|
412
423
|
* @param {...?} visits
|