@coolon/angular-ui-powerups 0.0.89 → 0.0.91

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.
Files changed (49) hide show
  1. package/bundles/coolon-angular-ui-powerups.umd.js +641 -488
  2. package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
  3. package/bundles/coolon-angular-ui-powerups.umd.min.js +1 -1
  4. package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -1
  5. package/coolon-angular-ui-powerups.d.ts +19 -18
  6. package/coolon-angular-ui-powerups.metadata.json +1 -1
  7. package/esm2015/coolon-angular-ui-powerups.js +18 -17
  8. package/esm2015/lib/directives/command.directive.js +28 -5
  9. package/esm2015/lib/interaction/components/activity-container/activity-container.component.js +3 -8
  10. package/esm2015/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.js +4 -9
  11. package/esm2015/lib/interaction/interaction-context.js +78 -6
  12. package/esm2015/lib/interaction/services/dialog-interaction.service.js +12 -20
  13. package/esm2015/lib/place/navigation-session.js +182 -39
  14. package/esm2015/lib/place/place-component.js +4 -19
  15. package/esm2015/lib/place/place-definition.js +16 -19
  16. package/esm2015/lib/place/place-router.js +177 -39
  17. package/esm2015/lib/place/route/guards/enter-place-guard.service.js +3 -38
  18. package/esm2015/lib/place/route/guards/leave-place.guard.js +7 -177
  19. package/esm2015/lib/place/visit.js +4 -11
  20. package/esm5/coolon-angular-ui-powerups.js +18 -17
  21. package/esm5/lib/directives/command.directive.js +32 -5
  22. package/esm5/lib/interaction/components/activity-container/activity-container.component.js +3 -12
  23. package/esm5/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.js +4 -13
  24. package/esm5/lib/interaction/interaction-context.js +100 -11
  25. package/esm5/lib/interaction/services/dialog-interaction.service.js +12 -23
  26. package/esm5/lib/place/navigation-session.js +225 -54
  27. package/esm5/lib/place/place-component.js +4 -35
  28. package/esm5/lib/place/place-definition.js +17 -39
  29. package/esm5/lib/place/place-router.js +202 -37
  30. package/esm5/lib/place/route/guards/enter-place-guard.service.js +3 -44
  31. package/esm5/lib/place/route/guards/leave-place.guard.js +7 -176
  32. package/esm5/lib/place/visit.js +4 -14
  33. package/fesm2015/coolon-angular-ui-powerups.js +494 -365
  34. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  35. package/fesm5/coolon-angular-ui-powerups.js +592 -439
  36. package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
  37. package/lib/directives/command.directive.d.ts +2 -0
  38. package/lib/interaction/components/activity-container/activity-container.component.d.ts +2 -3
  39. package/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.d.ts +4 -5
  40. package/lib/interaction/interaction-context.d.ts +7 -3
  41. package/lib/interaction/services/dialog-interaction.service.d.ts +4 -6
  42. package/lib/place/navigation-session.d.ts +26 -9
  43. package/lib/place/place-component.d.ts +4 -9
  44. package/lib/place/place-definition.d.ts +0 -4
  45. package/lib/place/place-router.d.ts +21 -2
  46. package/lib/place/route/guards/enter-place-guard.service.d.ts +0 -1
  47. package/lib/place/route/guards/leave-place.guard.d.ts +2 -10
  48. package/lib/place/visit.d.ts +0 -2
  49. package/package.json +1 -1
@@ -216,9 +216,28 @@
216
216
  function CommandDirective(elementRef) {
217
217
  var _this = _super.call(this) || this;
218
218
  _this.elementRef = elementRef;
219
+ _this._commandEnabled = new pectin.DelegatingValueModel().withDefault(false);
219
220
  _this._commandParameterProvided = false;
220
221
  return _this;
221
222
  }
223
+ Object.defineProperty(CommandDirective.prototype, "pectinCommand", {
224
+ get: /**
225
+ * @return {?}
226
+ */
227
+ function () {
228
+ return this._command;
229
+ },
230
+ set: /**
231
+ * @param {?} command
232
+ * @return {?}
233
+ */
234
+ function (command) {
235
+ this._command = command;
236
+ this._commandEnabled.setDelegate(command ? command.enabled : null);
237
+ },
238
+ enumerable: true,
239
+ configurable: true
240
+ });
222
241
  Object.defineProperty(CommandDirective.prototype, "commandParameter", {
223
242
  get: /**
224
243
  * @return {?}
@@ -267,7 +286,7 @@
267
286
  // for some reason mat-buttons kills the disabled host binding. It works on a regular button but for now
268
287
  // we need to do this.
269
288
  var chain = pectin.Dsl.disposeWith(this).chain;
270
- chain(this.pectinCommand.enabled).subscribe((/**
289
+ chain(this._commandEnabled).subscribe((/**
271
290
  * @param {?} enabled
272
291
  * @return {?}
273
292
  */
@@ -336,8 +355,16 @@
336
355
  return CommandDirective;
337
356
  }(pectin.GarbageCollector));
338
357
  if (false) {
339
- /** @type {?} */
340
- CommandDirective.prototype.pectinCommand;
358
+ /**
359
+ * @type {?}
360
+ * @private
361
+ */
362
+ CommandDirective.prototype._command;
363
+ /**
364
+ * @type {?}
365
+ * @private
366
+ */
367
+ CommandDirective.prototype._commandEnabled;
341
368
  /**
342
369
  * @type {?}
343
370
  * @private
@@ -1077,24 +1104,107 @@
1077
1104
  InteractionContext = /** @class */ (function (_super) {
1078
1105
  __extends(InteractionContext, _super);
1079
1106
  function InteractionContext() {
1080
- return _super.call(this) || this;
1081
- }
1082
- Object.defineProperty(InteractionContext.prototype, "currentActivity", {
1107
+ var _this = _super.call(this) || this;
1083
1108
  /**
1084
- * Returns the activity that is currently active.
1109
+ * Returns the current list of activities that are in progress.
1085
1110
  * This model is only updated in the next tick after the view has been updated.
1086
1111
  */
1112
+ _this._activityListDelegate = new pectin.DelegatingListModel();
1113
+ var _a = pectin.Dsl.disposeWith(_this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
1114
+ when.listOf(_this.activityList).becomesPopulated((/**
1115
+ * @param {?} activities
1116
+ * @return {?}
1117
+ */
1118
+ function (activities) {
1119
+ if (_this.deferredGetCurrentActivity) {
1120
+ _this.deferredGetCurrentActivity.resolve(___default.last(activities));
1121
+ _this.deferredGetCurrentActivity = null;
1122
+ }
1123
+ }));
1124
+ return _this;
1125
+ }
1126
+ /**
1127
+ * @protected
1128
+ * @param {?} activityList
1129
+ * @return {?}
1130
+ */
1131
+ InteractionContext.prototype.setActivityList = /**
1132
+ * @protected
1133
+ * @param {?} activityList
1134
+ * @return {?}
1135
+ */
1136
+ function (activityList) {
1137
+ this._activityListDelegate.setDelegate(activityList);
1138
+ };
1139
+ Object.defineProperty(InteractionContext.prototype, "activityList", {
1087
1140
  get: /**
1088
- * Returns the activity that is currently active.
1089
- * This model is only updated in the next tick after the view has been updated.
1090
1141
  * @return {?}
1091
1142
  */
1092
1143
  function () {
1093
- return ___default.last(this.activityList.value);
1144
+ return this._activityListDelegate.readonly;
1094
1145
  },
1095
1146
  enumerable: true,
1096
1147
  configurable: true
1097
1148
  });
1149
+ /**
1150
+ * Returns the activity that is currently active.
1151
+ * This model is only updated in the next tick after the view has been updated.
1152
+ */
1153
+ /**
1154
+ * Returns the activity that is currently active.
1155
+ * This model is only updated in the next tick after the view has been updated.
1156
+ * @return {?}
1157
+ */
1158
+ InteractionContext.prototype.getCurrentActivity = /**
1159
+ * Returns the activity that is currently active.
1160
+ * This model is only updated in the next tick after the view has been updated.
1161
+ * @return {?}
1162
+ */
1163
+ function () {
1164
+ return __awaiter(this, void 0, void 0, function () {
1165
+ return __generator(this, function (_a) {
1166
+ if (!this.isActive()) {
1167
+ return [2 /*return*/, Promise.reject('no activity in progress')];
1168
+ }
1169
+ else {
1170
+ if (this.deferredGetCurrentActivity) {
1171
+ // we're already waiting then just return the same promise
1172
+ return [2 /*return*/, this.deferredGetCurrentActivity.promise];
1173
+ }
1174
+ else {
1175
+ if (this.activityList.length < 1) {
1176
+ this.deferredGetCurrentActivity = pectin.Deferred.defer();
1177
+ return [2 /*return*/, this.deferredGetCurrentActivity.promise];
1178
+ }
1179
+ else {
1180
+ return [2 /*return*/, ___default.last(this.activityList.value)];
1181
+ }
1182
+ }
1183
+ }
1184
+ return [2 /*return*/];
1185
+ });
1186
+ });
1187
+ };
1188
+ /**
1189
+ * @param {?} confirm
1190
+ * @return {?}
1191
+ */
1192
+ InteractionContext.prototype.confirm = /**
1193
+ * @param {?} confirm
1194
+ * @return {?}
1195
+ */
1196
+ function (confirm) {
1197
+ // Important: we have to implement confirmOrReject as the main entry point
1198
+ // as the canDeactivation guards need to be able to cancel an interaction
1199
+ // without caring about returning a value.
1200
+ return this.confirmOrReject(confirm).then((/**
1201
+ * @return {?}
1202
+ */
1203
+ function () { return true; })).catch((/**
1204
+ * @return {?}
1205
+ */
1206
+ function () { return false; }));
1207
+ };
1098
1208
  return InteractionContext;
1099
1209
  }(pectin.GarbageCollector));
1100
1210
  if (false) {
@@ -1102,8 +1212,14 @@
1102
1212
  * Returns the current list of activities that are in progress.
1103
1213
  * This model is only updated in the next tick after the view has been updated.
1104
1214
  * @type {?}
1215
+ * @private
1216
+ */
1217
+ InteractionContext.prototype._activityListDelegate;
1218
+ /**
1219
+ * @type {?}
1220
+ * @private
1105
1221
  */
1106
- InteractionContext.prototype.activityList;
1222
+ InteractionContext.prototype.deferredGetCurrentActivity;
1107
1223
  /**
1108
1224
  * Returns true if an activity is currently running.
1109
1225
  * @abstract
@@ -1123,7 +1239,7 @@
1123
1239
  * @param {?} confirm
1124
1240
  * @return {?}
1125
1241
  */
1126
- InteractionContext.prototype.confirm = function (confirm) { };
1242
+ InteractionContext.prototype.confirmOrReject = function (confirm) { };
1127
1243
  /**
1128
1244
  * Presents the confirmation to the user and runs the activity only if the user confirms.
1129
1245
  * @abstract
@@ -1156,7 +1272,7 @@
1156
1272
  * @abstract
1157
1273
  * @template D, R, E
1158
1274
  */
1159
- exports.ɵbf = /** @class */ (function (_super) {
1275
+ exports.ɵbg = /** @class */ (function (_super) {
1160
1276
  __extends(Activity, _super);
1161
1277
  function Activity() {
1162
1278
  var _this = _super !== null && _super.apply(this, arguments) || this;
@@ -1246,12 +1362,12 @@
1246
1362
  * @type {?}
1247
1363
  * @private
1248
1364
  */
1249
- exports.ɵbf.prototype._busyModel;
1365
+ exports.ɵbg.prototype._busyModel;
1250
1366
  /**
1251
1367
  * @type {?}
1252
1368
  * @private
1253
1369
  */
1254
- exports.ɵbf.prototype._activityContext;
1370
+ exports.ɵbg.prototype._activityContext;
1255
1371
  }
1256
1372
  (function (Activity) {
1257
1373
  /**
@@ -1266,7 +1382,7 @@
1266
1382
  /** @type {?} */
1267
1383
  Callbacks.prototype.onCancel;
1268
1384
  }
1269
- })(exports.ɵbf || (exports.ɵbf = {}));
1385
+ })(exports.ɵbg || (exports.ɵbg = {}));
1270
1386
 
1271
1387
  /**
1272
1388
  * @fileoverview added by tsickle
@@ -1423,7 +1539,7 @@
1423
1539
  return _super !== null && _super.apply(this, arguments) || this;
1424
1540
  }
1425
1541
  return AbstractActivity;
1426
- }(exports.ɵbf));
1542
+ }(exports.ɵbg));
1427
1543
 
1428
1544
  /**
1429
1545
  * @fileoverview added by tsickle
@@ -1469,7 +1585,7 @@
1469
1585
  /**
1470
1586
  * @template D, R, E
1471
1587
  */
1472
- exports.ɵbh = /** @class */ (function (_super) {
1588
+ exports.ɵbi = /** @class */ (function (_super) {
1473
1589
  __extends(ConfirmThenDialogComponent, _super);
1474
1590
  function ConfirmThenDialogComponent(config, interactionContext) {
1475
1591
  var _this = _super.call(this) || this;
@@ -1541,9 +1657,9 @@
1541
1657
  }(AbstractActivity));
1542
1658
  if (false) {
1543
1659
  /** @type {?} */
1544
- exports.ɵbh.prototype.config;
1660
+ exports.ɵbi.prototype.config;
1545
1661
  /** @type {?} */
1546
- exports.ɵbh.prototype.interactionContext;
1662
+ exports.ɵbi.prototype.interactionContext;
1547
1663
  }
1548
1664
  (function (ConfirmThenDialogComponent) {
1549
1665
  /**
@@ -1560,7 +1676,7 @@
1560
1676
  /** @type {?} */
1561
1677
  Data.prototype.data;
1562
1678
  }
1563
- })(exports.ɵbh || (exports.ɵbh = {}));
1679
+ })(exports.ɵbi || (exports.ɵbi = {}));
1564
1680
 
1565
1681
  /**
1566
1682
  * @fileoverview added by tsickle
@@ -1745,6 +1861,7 @@
1745
1861
  * @return {?}
1746
1862
  */
1747
1863
  function () { return _this.onNestedActivityFinished(); }));
1864
+ _this.setActivityList(_this._activityList.readonly);
1748
1865
  return _this;
1749
1866
  }
1750
1867
  Object.defineProperty(ActivityContainerComponent.prototype, "initialActivityOutletContext", {
@@ -1800,16 +1917,6 @@
1800
1917
  function () {
1801
1918
  return !!this._initialActivityOutletContext;
1802
1919
  };
1803
- Object.defineProperty(ActivityContainerComponent.prototype, "activityList", {
1804
- get: /**
1805
- * @return {?}
1806
- */
1807
- function () {
1808
- return this._activityList.readonly;
1809
- },
1810
- enumerable: true,
1811
- configurable: true
1812
- });
1813
1920
  Object.defineProperty(ActivityContainerComponent.prototype, "isFinished", {
1814
1921
  get: /**
1815
1922
  * @return {?}
@@ -1911,7 +2018,7 @@
1911
2018
  * @param {?} confirm
1912
2019
  * @return {?}
1913
2020
  */
1914
- ActivityContainerComponent.prototype.confirm = /**
2021
+ ActivityContainerComponent.prototype.confirmOrReject = /**
1915
2022
  * @param {?} confirm
1916
2023
  * @return {?}
1917
2024
  */
@@ -1933,7 +2040,7 @@
1933
2040
  * @return {?}
1934
2041
  */
1935
2042
  function (confirm, activityType, data) {
1936
- return this.startActivity(exports.ɵbh, {
2043
+ return this.startActivity(exports.ɵbi, {
1937
2044
  confirm: confirm,
1938
2045
  activityType: activityType,
1939
2046
  data: data
@@ -2127,21 +2234,12 @@
2127
2234
  /**
2128
2235
  * @return {?}
2129
2236
  */
2130
- InplaceInteractionContextComponent.prototype.ngOnInit = /**
2237
+ InplaceInteractionContextComponent.prototype.ngAfterViewInit = /**
2131
2238
  * @return {?}
2132
2239
  */
2133
2240
  function () {
2241
+ this.setActivityList(this.interactionContext.activityList);
2134
2242
  };
2135
- Object.defineProperty(InplaceInteractionContextComponent.prototype, "activityList", {
2136
- get: /**
2137
- * @return {?}
2138
- */
2139
- function () {
2140
- return this.interactionContext.activityList;
2141
- },
2142
- enumerable: true,
2143
- configurable: true
2144
- });
2145
2243
  /**
2146
2244
  * @return {?}
2147
2245
  */
@@ -2167,7 +2265,7 @@
2167
2265
  * @param {?} confirm
2168
2266
  * @return {?}
2169
2267
  */
2170
- InplaceInteractionContextComponent.prototype.confirm = /**
2268
+ InplaceInteractionContextComponent.prototype.confirmOrReject = /**
2171
2269
  * @param {?} confirm
2172
2270
  * @return {?}
2173
2271
  */
@@ -2189,7 +2287,7 @@
2189
2287
  * @return {?}
2190
2288
  */
2191
2289
  function (confirm, activityType, data) {
2192
- return this._startActivity(exports.ɵbh, {
2290
+ return this._startActivity(exports.ɵbi, {
2193
2291
  confirm: confirm,
2194
2292
  activityType: activityType,
2195
2293
  data: data
@@ -2361,11 +2459,9 @@
2361
2459
  _this.router = router;
2362
2460
  _this.dialogServiceDefaults = dialogServiceDefaults;
2363
2461
  _this.matDialogDefaultConfig = matDialogDefaultConfig;
2364
- _this._activityList = new pectin.DelegatingListModel();
2365
2462
  _this.startingGuard = new Guard();
2463
+ _this._inActivityPromise = new pectin.MutableValueModel(false);
2366
2464
  typescriptUtilities.assert.notNil(dialogService);
2367
- var _a = pectin.Dsl.disposeWith(_this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
2368
- _this.active = chain(_this._activityList).isNotEmpty();
2369
2465
  return _this;
2370
2466
  }
2371
2467
  /**
@@ -2375,23 +2471,14 @@
2375
2471
  * @return {?}
2376
2472
  */
2377
2473
  function () {
2378
- return this.active.value;
2474
+ return this._inActivityPromise.value;
2379
2475
  };
2380
- /**
2381
- * @return {?}
2382
- */
2383
- DialogInteractionService.prototype.cancelActivity = /**
2384
- * @return {?}
2385
- */
2386
- function () {
2387
- this.currentActivity.cancel(null);
2388
- };
2389
- Object.defineProperty(DialogInteractionService.prototype, "activityList", {
2476
+ Object.defineProperty(DialogInteractionService.prototype, "active", {
2390
2477
  get: /**
2391
2478
  * @return {?}
2392
2479
  */
2393
2480
  function () {
2394
- return this._activityList.readonly;
2481
+ return this._inActivityPromise.readonly;
2395
2482
  },
2396
2483
  enumerable: true,
2397
2484
  configurable: true
@@ -2442,6 +2529,7 @@
2442
2529
  */
2443
2530
  function () {
2444
2531
  console.log('###### STARTING');
2532
+ _this._inActivityPromise.value = true;
2445
2533
  // this.currentActivityId = uuid.v1();
2446
2534
  // this.location.go(this.router.routerState.snapshot.url, "aup");
2447
2535
  /** @type {?} */
@@ -2500,6 +2588,7 @@
2500
2588
  * @return {?}
2501
2589
  */
2502
2590
  function () {
2591
+ _this._inActivityPromise.value = false;
2503
2592
  console.log('###### FINISHED');
2504
2593
  // this.currentActivityId = null;
2505
2594
  self.safelyUpdateActivityListDelegate(null);
@@ -2525,7 +2614,7 @@
2525
2614
  setTimeout((/**
2526
2615
  * @return {?}
2527
2616
  */
2528
- function () { return _this._activityList.setDelegate(delegate); }));
2617
+ function () { return _this.setActivityList(delegate); }));
2529
2618
  };
2530
2619
  /**
2531
2620
  * @param {?} alert
@@ -2543,7 +2632,7 @@
2543
2632
  * @param {?} confirm
2544
2633
  * @return {?}
2545
2634
  */
2546
- DialogInteractionService.prototype.confirm = /**
2635
+ DialogInteractionService.prototype.confirmOrReject = /**
2547
2636
  * @param {?} confirm
2548
2637
  * @return {?}
2549
2638
  */
@@ -2565,7 +2654,7 @@
2565
2654
  * @return {?}
2566
2655
  */
2567
2656
  function (confirm, activityType, data) {
2568
- return this._startActivity(exports.ɵbh, {
2657
+ return this._startActivity(exports.ɵbi, {
2569
2658
  confirm: confirm,
2570
2659
  activityType: activityType,
2571
2660
  data: data
@@ -2592,14 +2681,12 @@
2592
2681
  * @type {?}
2593
2682
  * @private
2594
2683
  */
2595
- DialogInteractionService.prototype._activityList;
2684
+ DialogInteractionService.prototype.startingGuard;
2596
2685
  /**
2597
2686
  * @type {?}
2598
2687
  * @private
2599
2688
  */
2600
- DialogInteractionService.prototype.startingGuard;
2601
- /** @type {?} */
2602
- DialogInteractionService.prototype.active;
2689
+ DialogInteractionService.prototype._inActivityPromise;
2603
2690
  /**
2604
2691
  * @type {?}
2605
2692
  * @private
@@ -2635,7 +2722,7 @@
2635
2722
  declarations: [
2636
2723
  ActivityContainerComponent,
2637
2724
  ConfirmationDialogComponent,
2638
- exports.ɵbh,
2725
+ exports.ɵbi,
2639
2726
  AlertDialogComponent,
2640
2727
  ActivityOutletComponent,
2641
2728
  InteractionOutletComponent,
@@ -2650,7 +2737,7 @@
2650
2737
  entryComponents: [
2651
2738
  ActivityContainerComponent,
2652
2739
  ConfirmationDialogComponent,
2653
- exports.ɵbh,
2740
+ exports.ɵbi,
2654
2741
  AlertDialogComponent
2655
2742
  ],
2656
2743
  providers: [
@@ -3096,49 +3183,25 @@
3096
3183
  return routeIdParameterDef ? visit.getParameter(routeIdParameterDef.name) : null;
3097
3184
  };
3098
3185
  /**
3099
- * Returns angular router commands that specify the route id and any route parameters. The result does
3100
- * not include any path information.
3101
- */
3102
- // getFormattedRouterCommands(visit: Visit): any[] {
3103
- // return this.hasRouteId() ?
3104
- // [this.getFormattedRouteId(visit), this.getFormattedRouteParameters(visit)] :
3105
- // [this.getFormattedRouteParameters(visit)];
3106
- // }
3107
- /**
3108
- * Returns angular router commands that specify the route id and any route parameters. The result does
3109
- * not include any path information.
3110
3186
  * @param {?} visit
3111
3187
  * @return {?}
3112
3188
  */
3113
- // getFormattedRouterCommands(visit: Visit): any[] {
3114
- // return this.hasRouteId() ?
3115
- // [this.getFormattedRouteId(visit), this.getFormattedRouteParameters(visit)] :
3116
- // [this.getFormattedRouteParameters(visit)];
3117
- // }
3118
3189
  PlaceDefinition.prototype.getFormattedRouteId = /**
3119
- * Returns angular router commands that specify the route id and any route parameters. The result does
3120
- * not include any path information.
3121
3190
  * @param {?} visit
3122
3191
  * @return {?}
3123
3192
  */
3124
- // getFormattedRouterCommands(visit: Visit): any[] {
3125
- // return this.hasRouteId() ?
3126
- // [this.getFormattedRouteId(visit), this.getFormattedRouteParameters(visit)] :
3127
- // [this.getFormattedRouteParameters(visit)];
3128
- // }
3129
3193
  function (visit) {
3130
- return visit.hasRouteId() ? this.getRouteIdParameterDef().urlFormat.format(visit.getRouteId()) : null;
3194
+ // Note: RouteIds are always present in the url and are just empty strings when not defined. This is
3195
+ // mandated by the fact that redirects from <path> to <path>/:id always include the id parameter as
3196
+ // an empty string.
3197
+ return visit.hasRouteId() ? this.getRouteIdParameterDef().urlFormat.format(visit.getRouteId()) : "";
3131
3198
  };
3132
- // @Trace()
3133
- // @Trace()
3134
3199
  /**
3135
3200
  * @param {?} visit
3136
3201
  * @param {?=} includeRouteId
3137
3202
  * @return {?}
3138
3203
  */
3139
- PlaceDefinition.prototype.getFormattedRouteParameters =
3140
- // @Trace()
3141
- /**
3204
+ PlaceDefinition.prototype.getFormattedRouteParameters = /**
3142
3205
  * @param {?} visit
3143
3206
  * @param {?=} includeRouteId
3144
3207
  * @return {?}
@@ -3234,15 +3297,17 @@
3234
3297
  }
3235
3298
  else {
3236
3299
  /** @type {?} */
3237
- var value = def.urlFormat.parse(params.get(def.name));
3238
- // because our id routes redirect if the id isn't pressent we always have a id
3239
- // parameter in our params. This will bugger our remember and defaultvalue sanitisation
3240
- // as it'll see that the id is present (event thought its null). The sanitisation can't
3241
- // check for null as that's a valid value for the id.
3242
- /** @type {?} */
3243
- var isEmptyRouteId = def.isRouteId && def.isEmptyValue(value);
3244
- if (!isEmptyRouteId) {
3245
- result[def.name] = value;
3300
+ var value = params.get(def.name);
3301
+ if (def.isRouteId) { // TODO: Move this to parameter def so it's a strategy pattern
3302
+ // because our id routes redirect if the id isn't present we always have a id
3303
+ // parameter in our params. This will bugger our remember and defaultvalue sanitisation
3304
+ // as it'll see that the id is present (event thought its a blank string).
3305
+ if (!___default__default.isEmpty(value)) {
3306
+ result[def.name] = def.urlFormat.parse(value);
3307
+ }
3308
+ }
3309
+ else {
3310
+ result[def.name] = def.urlFormat.parse(value);
3246
3311
  }
3247
3312
  }
3248
3313
  }
@@ -3396,15 +3461,6 @@
3396
3461
  enumerable: true,
3397
3462
  configurable: true
3398
3463
  });
3399
- /**
3400
- * @return {?}
3401
- */
3402
- PlaceComponent.prototype.canDeactivate = /**
3403
- * @return {?}
3404
- */
3405
- function () {
3406
- return true;
3407
- };
3408
3464
  /**
3409
3465
  * @return {?}
3410
3466
  */
@@ -3413,36 +3469,13 @@
3413
3469
  */
3414
3470
  function () {
3415
3471
  };
3416
- /**
3417
- * Called by the place outlet after all animations have finished. We need this instead of ngOnDestroy
3418
- * to avoid the fact that the angular router calls it before the animations have run causing the component
3419
- * to loose any pectin bindings.
3420
- */
3421
- // @Trace()
3422
- /**
3423
- * Called by the place outlet after all animations have finished. We need this instead of ngOnDestroy
3424
- * to avoid the fact that the angular router calls it before the animations have run causing the component
3425
- * to loose any pectin bindings.
3426
- * @return {?}
3427
- */
3428
- // @Trace()
3429
- PlaceComponent.prototype.onPlaceDestroyed = /**
3430
- * Called by the place outlet after all animations have finished. We need this instead of ngOnDestroy
3431
- * to avoid the fact that the angular router calls it before the animations have run causing the component
3432
- * to loose any pectin bindings.
3433
- * @return {?}
3434
- */
3435
- // @Trace()
3436
- function () {
3437
- this.dispose();
3438
- };
3439
3472
  __decorate([
3440
3473
  fastMemoizeDecorator.Memoize(),
3441
3474
  __metadata("design:type", exports.PlaceDefinition),
3442
3475
  __metadata("design:paramtypes", [])
3443
3476
  ], PlaceComponent.prototype, "placeDefinition", null);
3444
3477
  return PlaceComponent;
3445
- }(pectin.GarbageCollector));
3478
+ }(DisposableComponent));
3446
3479
  if (false) {
3447
3480
  /**
3448
3481
  * @type {?}
@@ -3612,8 +3645,10 @@
3612
3645
  else {
3613
3646
  // copy non route params as is, but only if they already exist otherwise we'll inject nil values and break the
3614
3647
  // defaults and remember sanitisation process.
3648
+ /** @type {?} */
3649
+ var value = _this.getParameter(def.name);
3615
3650
  if (_this.hasParameter(def.name)) {
3616
- params[def.name] = _this.getParameter(def.name);
3651
+ params[def.name] = value;
3617
3652
  }
3618
3653
  }
3619
3654
  }));
@@ -3647,17 +3682,6 @@
3647
3682
  var sameNonRouteParameters = ___default.isEqual(this.placeDefinition.getNonRouteParameters(this), this.placeDefinition.getNonRouteParameters(other));
3648
3683
  return !sameNonRouteParameters || this.hasRoutingChangedFrom(other);
3649
3684
  };
3650
- /**
3651
- * @return {?}
3652
- */
3653
- Visit.prototype.getUrlSegments = /**
3654
- * @return {?}
3655
- */
3656
- function () {
3657
- return this.placeDefinition.hasRouteId() ?
3658
- [new router.UrlSegment(this.placeDefinition.path, {}), new router.UrlSegment(this.placeDefinition.getFormattedRouteId(this), this.placeDefinition.getFormattedRouteParameters(this))] :
3659
- [new router.UrlSegment(this.placeDefinition.path, this.placeDefinition.getFormattedRouteParameters(this))];
3660
- };
3661
3685
  return Visit;
3662
3686
  }());
3663
3687
  if (false) {
@@ -3695,11 +3719,14 @@
3695
3719
  /**
3696
3720
  * @abstract
3697
3721
  */
3698
- exports.NavigationSession = /** @class */ (function () {
3699
- function NavigationSession(firstNavigation) {
3722
+ exports.ɵu = /** @class */ (function () {
3723
+ function NavigationSession(firstNavigation, appModalInteractionContext) {
3700
3724
  this.firstNavigation = firstNavigation;
3725
+ this.appModalInteractionContext = appModalInteractionContext;
3701
3726
  this._alreadyAccepted = [];
3702
3727
  this._visits = new Map();
3728
+ this.componentDeactivationHandlers = new Map();
3729
+ this.dialogOpenOnStart = this.appModalInteractionContext.isActive();
3703
3730
  }
3704
3731
  /**
3705
3732
  * @param {?} visit
@@ -3723,52 +3750,36 @@
3723
3750
  function (placeDef) {
3724
3751
  return this._visits.get(placeDef);
3725
3752
  };
3726
- /**
3727
- * @param {?} params
3728
- * @return {?}
3729
- */
3730
- NavigationSession.prototype.mergePrivatePlaceParameters = /**
3731
- * @param {?} params
3732
- * @return {?}
3733
- */
3734
- function (params) {
3735
- return null;
3736
- };
3737
- // @Trace()
3738
- // @Trace()
3739
- /**
3740
- * @param {?} placeComponent
3741
- * @return {?}
3742
- */
3743
- NavigationSession.prototype.alreadyAccepted =
3744
- // @Trace()
3745
- /**
3746
- * @param {?} placeComponent
3747
- * @return {?}
3748
- */
3749
- function (placeComponent) {
3750
- return this._alreadyAccepted.includes(placeComponent);
3751
- };
3752
- // @Trace()
3753
- // @Trace()
3754
3753
  /**
3755
3754
  * @param {?} component
3755
+ * @param {?} nextState
3756
3756
  * @return {?}
3757
3757
  */
3758
- NavigationSession.prototype.rememberAcceptanceOf =
3759
- // @Trace()
3760
- /**
3758
+ NavigationSession.prototype.canDeactivate = /**
3761
3759
  * @param {?} component
3760
+ * @param {?} nextState
3762
3761
  * @return {?}
3763
3762
  */
3764
- function (component) {
3765
- this._alreadyAccepted.push(component);
3763
+ function (component, nextState) {
3764
+ return __awaiter(this, void 0, void 0, function () {
3765
+ var handler, isPrimaryHandler;
3766
+ return __generator(this, function (_a) {
3767
+ // lookup the handler and create it if we've not seen it yet
3768
+ handler = this.componentDeactivationHandlers.get(component);
3769
+ if (!handler) {
3770
+ isPrimaryHandler = this.componentDeactivationHandlers.size === 0;
3771
+ handler = new NavigationSession.ComponentDeactivationHandler(component, this.appModalInteractionContext, isPrimaryHandler);
3772
+ this.componentDeactivationHandlers.set(component, handler);
3773
+ }
3774
+ return [2 /*return*/, handler.canDeactivate(nextState)];
3775
+ });
3776
+ });
3766
3777
  };
3767
3778
  /**
3768
3779
  * @param {?} url
3769
3780
  * @return {?}
3770
3781
  */
3771
- NavigationSession.prototype.setPopstateReturn = /**
3782
+ NavigationSession.prototype.setPopstateReturnUrl = /**
3772
3783
  * @param {?} url
3773
3784
  * @return {?}
3774
3785
  */
@@ -3811,27 +3822,39 @@
3811
3822
  * @type {?}
3812
3823
  * @private
3813
3824
  */
3814
- exports.NavigationSession.prototype._alreadyAccepted;
3825
+ exports.ɵu.prototype._alreadyAccepted;
3815
3826
  /**
3816
3827
  * @type {?}
3817
3828
  * @private
3818
3829
  */
3819
- exports.NavigationSession.prototype._visits;
3830
+ exports.ɵu.prototype._visits;
3820
3831
  /**
3821
3832
  * @type {?}
3822
3833
  * @private
3823
3834
  */
3824
- exports.NavigationSession.prototype._popStateReturnUrl;
3835
+ exports.ɵu.prototype._popStateReturnUrl;
3836
+ /** @type {?} */
3837
+ exports.ɵu.prototype.isExternal;
3825
3838
  /** @type {?} */
3826
- exports.NavigationSession.prototype.isExternal;
3839
+ exports.ɵu.prototype.dialogOpenOnStart;
3840
+ /**
3841
+ * @type {?}
3842
+ * @private
3843
+ */
3844
+ exports.ɵu.prototype.componentDeactivationHandlers;
3827
3845
  /** @type {?} */
3828
- exports.NavigationSession.prototype.firstNavigation;
3846
+ exports.ɵu.prototype.firstNavigation;
3847
+ /**
3848
+ * @type {?}
3849
+ * @private
3850
+ */
3851
+ exports.ɵu.prototype.appModalInteractionContext;
3829
3852
  }
3830
3853
  (function (NavigationSession) {
3831
3854
  var External = /** @class */ (function (_super) {
3832
3855
  __extends(External, _super);
3833
- function External(isFirstTime) {
3834
- var _this = _super.call(this, isFirstTime) || this;
3856
+ function External(isFirstTime, appModelInteractionContext) {
3857
+ var _this = _super.call(this, isFirstTime, appModelInteractionContext) || this;
3835
3858
  _this.isExternal = true;
3836
3859
  return _this;
3837
3860
  }
@@ -3843,8 +3866,8 @@
3843
3866
  }
3844
3867
  var Internal = /** @class */ (function (_super) {
3845
3868
  __extends(Internal, _super);
3846
- function Internal(visit) {
3847
- var _this = _super.call(this, false) || this;
3869
+ function Internal(visit, appModelInteractionContext) {
3870
+ var _this = _super.call(this, false, appModelInteractionContext) || this;
3848
3871
  _this.isExternal = false;
3849
3872
  _this.storeVisit(visit);
3850
3873
  return _this;
@@ -3855,23 +3878,193 @@
3855
3878
  /** @type {?} */
3856
3879
  Internal.prototype.isExternal;
3857
3880
  }
3858
- /**
3859
- * @param {?} visit
3860
- * @return {?}
3861
- */
3862
- function createInternal(visit) {
3863
- return new Internal(visit);
3881
+ var Factory = /** @class */ (function () {
3882
+ function Factory(appModelInteractionContext) {
3883
+ this.appModelInteractionContext = appModelInteractionContext;
3884
+ }
3885
+ /**
3886
+ * @param {?} visit
3887
+ * @return {?}
3888
+ */
3889
+ Factory.prototype.createInternal = /**
3890
+ * @param {?} visit
3891
+ * @return {?}
3892
+ */
3893
+ function (visit) {
3894
+ return new Internal(visit, this.appModelInteractionContext);
3895
+ };
3896
+ /**
3897
+ * @param {?} firstTimeRoute
3898
+ * @return {?}
3899
+ */
3900
+ Factory.prototype.createExternal = /**
3901
+ * @param {?} firstTimeRoute
3902
+ * @return {?}
3903
+ */
3904
+ function (firstTimeRoute) {
3905
+ return new External(firstTimeRoute, this.appModelInteractionContext);
3906
+ };
3907
+ Factory.decorators = [
3908
+ { type: core.Injectable, args: [{
3909
+ providedIn: 'root'
3910
+ },] },
3911
+ ];
3912
+ /** @nocollapse */
3913
+ Factory.ctorParameters = function () { return [
3914
+ { type: InteractionContext }
3915
+ ]; };
3916
+ return Factory;
3917
+ }());
3918
+ NavigationSession.Factory = Factory;
3919
+ if (false) {
3920
+ /** @type {?} */
3921
+ Factory.prototype.appModelInteractionContext;
3864
3922
  }
3865
- NavigationSession.createInternal = createInternal;
3866
- /**
3867
- * @param {?} firstTimeRoute
3868
- * @return {?}
3869
- */
3870
- function createExternal(firstTimeRoute) {
3871
- return new External(firstTimeRoute);
3923
+ var ComponentDeactivationHandler = /** @class */ (function () {
3924
+ function ComponentDeactivationHandler(component, appModelInteractionContext, primary) {
3925
+ this.component = component;
3926
+ this.appModelInteractionContext = appModelInteractionContext;
3927
+ this.primary = primary;
3928
+ this.alreadyAccepted = false;
3929
+ // super();
3930
+ }
3931
+ /**
3932
+ * @param {?} nextState
3933
+ * @return {?}
3934
+ */
3935
+ ComponentDeactivationHandler.prototype.canDeactivate = /**
3936
+ * @param {?} nextState
3937
+ * @return {?}
3938
+ */
3939
+ function (nextState) {
3940
+ return __awaiter(this, void 0, void 0, function () {
3941
+ var _a;
3942
+ return __generator(this, function (_b) {
3943
+ switch (_b.label) {
3944
+ case 0:
3945
+ console.log(this.constructor.name + ".canDeactivate", { component: this.component });
3946
+ if (!this.alreadyAccepted) return [3 /*break*/, 1];
3947
+ // We'll get called multiple times if there's any parameter sanitisation so
3948
+ // we always return true if we accepted on a previous cycle of the current
3949
+ // navigation session.
3950
+ return [2 /*return*/, true];
3951
+ case 1:
3952
+ if (!(this.primary && this.appModelInteractionContext.isActive())) return [3 /*break*/, 3];
3953
+ // We check the global interaction first
3954
+ return [4 /*yield*/, this.cancelCurrentActivityOf(this.appModelInteractionContext)];
3955
+ case 2:
3956
+ // We check the global interaction first
3957
+ _b.sent();
3958
+ return [2 /*return*/, false];
3959
+ case 3:
3960
+ _a = this;
3961
+ return [4 /*yield*/, this.canDeactivateComponent(nextState)];
3962
+ case 4:
3963
+ _a.alreadyAccepted = _b.sent();
3964
+ return [2 /*return*/, this.alreadyAccepted];
3965
+ }
3966
+ });
3967
+ });
3968
+ };
3969
+ /**
3970
+ * @protected
3971
+ * @param {?} nextState
3972
+ * @return {?}
3973
+ */
3974
+ ComponentDeactivationHandler.prototype.canDeactivateComponent = /**
3975
+ * @protected
3976
+ * @param {?} nextState
3977
+ * @return {?}
3978
+ */
3979
+ function (nextState) {
3980
+ return __awaiter(this, void 0, void 0, function () {
3981
+ var hasCustomInteractionContext;
3982
+ return __generator(this, function (_a) {
3983
+ // check if the component has an active interaction. This will handle
3984
+ // an inplace interaction contexts
3985
+ hasCustomInteractionContext = this.component.interactionContext &&
3986
+ !this.isAppModalInteractionContext(this.component.interactionContext) &&
3987
+ this.component.interactionContext.isActive();
3988
+ if (hasCustomInteractionContext) {
3989
+ this.cancelCurrentActivityOf(this.component.interactionContext);
3990
+ return [2 /*return*/, false];
3991
+ }
3992
+ if (this.isLeavingCurrentPlace(nextState) && this.component.canDeactivate) {
3993
+ // No interaction in progress, so ask the component .
3994
+ // This may start an interaction, hence checking the interaction context before now. I.e. if the place pops up the dialog, and
3995
+ // the user clicks back again, we'll re-enter here and go bang when the component tries to open another dialog.
3996
+ return [2 /*return*/, this.component.canDeactivate()];
3997
+ }
3998
+ return [2 /*return*/, true];
3999
+ });
4000
+ });
4001
+ };
4002
+ /**
4003
+ * @param {?} interactionContext
4004
+ * @return {?}
4005
+ */
4006
+ ComponentDeactivationHandler.prototype.isAppModalInteractionContext = /**
4007
+ * @param {?} interactionContext
4008
+ * @return {?}
4009
+ */
4010
+ function (interactionContext) {
4011
+ return this.appModelInteractionContext === interactionContext;
4012
+ };
4013
+ /**
4014
+ * @protected
4015
+ * @param {?} interactionContext
4016
+ * @return {?}
4017
+ */
4018
+ ComponentDeactivationHandler.prototype.cancelCurrentActivityOf = /**
4019
+ * @protected
4020
+ * @param {?} interactionContext
4021
+ * @return {?}
4022
+ */
4023
+ function (interactionContext) {
4024
+ return __awaiter(this, void 0, void 0, function () {
4025
+ var activity;
4026
+ return __generator(this, function (_a) {
4027
+ switch (_a.label) {
4028
+ case 0: return [4 /*yield*/, interactionContext.getCurrentActivity()];
4029
+ case 1:
4030
+ activity = _a.sent();
4031
+ console.log('cancelling', { activity: activity });
4032
+ activity.cancel(null);
4033
+ return [2 /*return*/];
4034
+ }
4035
+ });
4036
+ });
4037
+ };
4038
+ /**
4039
+ * @protected
4040
+ * @param {?} nextState
4041
+ * @return {?}
4042
+ */
4043
+ ComponentDeactivationHandler.prototype.isLeavingCurrentPlace = /**
4044
+ * @protected
4045
+ * @param {?} nextState
4046
+ * @return {?}
4047
+ */
4048
+ function (nextState) {
4049
+ return !nextState.includesPathOf(this.component.placeDefinition);
4050
+ };
4051
+ return ComponentDeactivationHandler;
4052
+ }());
4053
+ NavigationSession.ComponentDeactivationHandler = ComponentDeactivationHandler;
4054
+ if (false) {
4055
+ /**
4056
+ * @type {?}
4057
+ * @private
4058
+ */
4059
+ ComponentDeactivationHandler.prototype.alreadyAccepted;
4060
+ /** @type {?} */
4061
+ ComponentDeactivationHandler.prototype.component;
4062
+ /** @type {?} */
4063
+ ComponentDeactivationHandler.prototype.appModelInteractionContext;
4064
+ /** @type {?} */
4065
+ ComponentDeactivationHandler.prototype.primary;
3872
4066
  }
3873
- NavigationSession.createExternal = createExternal;
3874
- })(exports.NavigationSession || (exports.NavigationSession = {}));
4067
+ })(exports.ɵu || (exports.ɵu = {}));
3875
4068
 
3876
4069
  /**
3877
4070
  * @fileoverview added by tsickle
@@ -3957,11 +4150,13 @@
3957
4150
  * @fileoverview added by tsickle
3958
4151
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3959
4152
  */
3960
- var PlaceRouter = /** @class */ (function (_super) {
4153
+ exports.ɵt = /** @class */ (function (_super) {
3961
4154
  __extends(PlaceRouter, _super);
3962
- function PlaceRouter(router$1, angularLocation, placeHistory) {
4155
+ function PlaceRouter(router$1, urlSerializer, navigationSessionFactory, angularLocation, placeHistory) {
3963
4156
  var _this = _super.call(this) || this;
3964
4157
  _this.router = router$1;
4158
+ _this.urlSerializer = urlSerializer;
4159
+ _this.navigationSessionFactory = navigationSessionFactory;
3965
4160
  _this.angularLocation = angularLocation;
3966
4161
  _this.placeHistory = placeHistory;
3967
4162
  _this.firstRoute = true;
@@ -3991,8 +4186,11 @@
3991
4186
  if (event instanceof router.NavigationStart) {
3992
4187
  _this.onAngularRouterStarted(event);
3993
4188
  }
3994
- if (event instanceof router.NavigationEnd || event instanceof router.NavigationError) {
3995
- _this.onAngularRouterFinished();
4189
+ if (event instanceof router.NavigationEnd) {
4190
+ _this.onAngularRouterFinished(false);
4191
+ }
4192
+ if (event instanceof router.NavigationError) {
4193
+ _this.onAngularRouterFinished(true);
3996
4194
  }
3997
4195
  }));
3998
4196
  _this.navigationSessionActive = chain(_this.navigationSessionModel).isNotNil();
@@ -4112,19 +4310,19 @@
4112
4310
  * @return {?}
4113
4311
  */
4114
4312
  function (router) {
4115
- // we have to to use the definition for route id as our redirection always includes
4116
- // the id in the url segements (but leaves it blank when there's no id). I.e. in the
4117
- // no id case we're doing the following redirect [<placePath>, ""] -> ["..", <id>]
4118
4313
  /** @type {?} */
4119
- var relativePath = !!previous.placeDefinition.hasRouteId() ? '..' : '.';
4120
- /** @type {?} */
4121
- var commands = __spread([
4122
- relativePath
4123
- ], _this.createRouteParameters(next), _this.extractChildPath(activatedRoute.snapshot));
4124
- console.log('### Push Changes to route Redirect', { commands: commands, relativeTo: activatedRoute.snapshot.url });
4125
- return router.navigate(commands, {
4126
- relativeTo: activatedRoute
4127
- });
4314
+ var commands = _this.parseUrl(_this.router.routerState.snapshot).createRedirectCommandsFor(next);
4315
+ // // we have to to use the definition for route id as our redirection always includes
4316
+ // // the id in the url segements (but leaves it blank when there's no id). I.e. in the
4317
+ // // no id case we're doing the following redirect [<placePath>, ""] -> ["..", <id>]
4318
+ // const relativePath = !!previous.placeDefinition.hasRouteId() ? '..' : '.';
4319
+ // const commands = [
4320
+ // relativePath,
4321
+ // ...this.createRouteParameters(next),
4322
+ // ...this.extractChildPath(activatedRoute.snapshot)
4323
+ // ];
4324
+ console.log('### Push Changes to route Redirect', { commands: commands });
4325
+ return router.navigate(commands);
4128
4326
  }))];
4129
4327
  }
4130
4328
  return [2 /*return*/];
@@ -4146,7 +4344,7 @@
4146
4344
  return __generator(this, function (_a) {
4147
4345
  switch (_a.label) {
4148
4346
  case 0:
4149
- this._navigationSessionModel.value = exports.NavigationSession.createInternal(visit);
4347
+ this._navigationSessionModel.value = this.navigationSessionFactory.createInternal(visit);
4150
4348
  _a.label = 1;
4151
4349
  case 1:
4152
4350
  _a.trys.push([1, , 3, 4]);
@@ -4155,8 +4353,10 @@
4155
4353
  _a.sent();
4156
4354
  return [3 /*break*/, 4];
4157
4355
  case 3:
4356
+ // Router has finished (since there was no router change required) so we
4357
+ // need to end the navigation session.
4158
4358
  if (this.navigationSession && !this.router.getCurrentNavigation()) {
4159
- this.onAngularRouterFinished();
4359
+ this.onAngularRouterFinished(false);
4160
4360
  }
4161
4361
  return [7 /*endfinally*/];
4162
4362
  case 4: return [2 /*return*/];
@@ -4199,9 +4399,9 @@
4199
4399
  if (!this.navigationSession) { // We been activated by an external route rather than placeRouter.go(visit)
4200
4400
  console.log('navigation started', { firstTime: this.firstRoute });
4201
4401
  /** @type {?} */
4202
- var session = exports.NavigationSession.createExternal(this.firstRoute);
4402
+ var session = this.navigationSessionFactory.createExternal(this.firstRoute);
4203
4403
  if (event.navigationTrigger === 'popstate') {
4204
- session.setPopstateReturn(this.router.routerState.snapshot.url);
4404
+ session.setPopstateReturnUrl(this.router.routerState.snapshot.url);
4205
4405
  }
4206
4406
  this._navigationSessionModel.value = session;
4207
4407
  }
@@ -4211,30 +4411,40 @@
4211
4411
  // @Trace()
4212
4412
  /**
4213
4413
  * @private
4414
+ * @param {?} cancelled
4214
4415
  * @return {?}
4215
4416
  */
4216
4417
  PlaceRouter.prototype.onAngularRouterFinished =
4217
4418
  // @Trace()
4218
4419
  /**
4219
4420
  * @private
4421
+ * @param {?} cancelled
4220
4422
  * @return {?}
4221
4423
  */
4222
- function () {
4424
+ function (cancelled) {
4223
4425
  var _this = this;
4224
4426
  /** @type {?} */
4225
4427
  var session = this._navigationSessionModel.value;
4226
- // Update visits before we end the navigation session. This allows the place out let to
4227
- // gate ignore changes that occur while the visit is active
4228
- /** @type {?} */
4229
- var visits = session.getVisits();
4230
- visits.forEach((/**
4231
- * @param {?} v
4232
- * @return {?}
4233
- */
4234
- function (v) {
4235
- _this.placeHistory.add(v);
4236
- }));
4237
- this._activeVisits.value = visits;
4428
+ if (!cancelled) {
4429
+ // Update visits before we end the navigation session. This allows the placeOutets to
4430
+ // ignore visit changes that occur while the navigation is in progress
4431
+ /** @type {?} */
4432
+ var visits = session.getVisits();
4433
+ visits.forEach((/**
4434
+ * @param {?} v
4435
+ * @return {?}
4436
+ */
4437
+ function (v) { return _this.placeHistory.add(v); }));
4438
+ this._activeVisits.value = visits;
4439
+ }
4440
+ else {
4441
+ // Angular doesn't preserve the url when a guard cancels the back button.
4442
+ // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
4443
+ if (session.isPopState) {
4444
+ console.log('cancelled during popstate');
4445
+ this.angularLocation.go(session.popStateReturnUrl);
4446
+ }
4447
+ }
4238
4448
  this._navigationSessionModel.value = null;
4239
4449
  };
4240
4450
  /**
@@ -4252,6 +4462,17 @@
4252
4462
  */
4253
4463
  function (child) { return child.url; })));
4254
4464
  };
4465
+ /**
4466
+ * @param {?} snapshot
4467
+ * @return {?}
4468
+ */
4469
+ PlaceRouter.prototype.parseUrl = /**
4470
+ * @param {?} snapshot
4471
+ * @return {?}
4472
+ */
4473
+ function (snapshot) {
4474
+ return new PlaceRouter.UrlHelper(this.urlSerializer.parse(snapshot.url));
4475
+ };
4255
4476
  PlaceRouter.decorators = [
4256
4477
  { type: core.Injectable, args: [{
4257
4478
  providedIn: 'root'
@@ -4260,10 +4481,12 @@
4260
4481
  /** @nocollapse */
4261
4482
  PlaceRouter.ctorParameters = function () { return [
4262
4483
  { type: router.Router },
4484
+ { type: router.UrlSerializer },
4485
+ { type: exports.ɵu.Factory },
4263
4486
  { type: common.Location },
4264
4487
  { type: PlaceHistory }
4265
4488
  ]; };
4266
- /** @nocollapse */ PlaceRouter.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(core.ɵɵinject(router.Router), core.ɵɵinject(common.Location), core.ɵɵinject(PlaceHistory)); }, token: PlaceRouter, providedIn: "root" });
4489
+ /** @nocollapse */ PlaceRouter.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(core.ɵɵinject(router.Router), core.ɵɵinject(router.UrlSerializer), core.ɵɵinject(exports.ɵu.Factory), core.ɵɵinject(common.Location), core.ɵɵinject(PlaceHistory)); }, token: PlaceRouter, providedIn: "root" });
4267
4490
  __decorate([
4268
4491
  pectin.Trace(),
4269
4492
  __metadata("design:type", Function),
@@ -4277,31 +4500,165 @@
4277
4500
  * @type {?}
4278
4501
  * @private
4279
4502
  */
4280
- PlaceRouter.prototype.firstRoute;
4503
+ exports.ɵt.prototype.firstRoute;
4281
4504
  /**
4282
4505
  * @type {?}
4283
4506
  * @private
4284
4507
  */
4285
- PlaceRouter.prototype._navigationSessionModel;
4508
+ exports.ɵt.prototype._navigationSessionModel;
4286
4509
  /**
4287
4510
  * @type {?}
4288
4511
  * @private
4289
4512
  */
4290
- PlaceRouter.prototype._activeVisits;
4513
+ exports.ɵt.prototype._activeVisits;
4291
4514
  /** @type {?} */
4292
- PlaceRouter.prototype.navigationSessionActive;
4515
+ exports.ɵt.prototype.navigationSessionActive;
4293
4516
  /** @type {?} */
4294
- PlaceRouter.prototype.activeVisitIndex;
4517
+ exports.ɵt.prototype.activeVisitIndex;
4518
+ /**
4519
+ * @type {?}
4520
+ * @private
4521
+ */
4522
+ exports.ɵt.prototype.router;
4295
4523
  /**
4296
4524
  * @type {?}
4297
4525
  * @private
4298
4526
  */
4299
- PlaceRouter.prototype.router;
4527
+ exports.ɵt.prototype.urlSerializer;
4528
+ /**
4529
+ * @type {?}
4530
+ * @private
4531
+ */
4532
+ exports.ɵt.prototype.navigationSessionFactory;
4300
4533
  /** @type {?} */
4301
- PlaceRouter.prototype.angularLocation;
4534
+ exports.ɵt.prototype.angularLocation;
4302
4535
  /** @type {?} */
4303
- PlaceRouter.prototype.placeHistory;
4536
+ exports.ɵt.prototype.placeHistory;
4304
4537
  }
4538
+ (function (PlaceRouter) {
4539
+ var UrlHelper = /** @class */ (function () {
4540
+ function UrlHelper(urlTree) {
4541
+ this.urlTree = urlTree;
4542
+ console.log({ segments: this.urlTree.root.children.primary.segments });
4543
+ }
4544
+ /**
4545
+ * @return {?}
4546
+ */
4547
+ UrlHelper.prototype.cloneUrlSegmentList = /**
4548
+ * @return {?}
4549
+ */
4550
+ function () {
4551
+ return __spread(this.urlTree.root.children.primary.segments);
4552
+ };
4553
+ /**
4554
+ * @param {?} visit
4555
+ * @return {?}
4556
+ */
4557
+ UrlHelper.prototype.updateVisitSegments = /**
4558
+ * @param {?} visit
4559
+ * @return {?}
4560
+ */
4561
+ function (visit) {
4562
+ // Ugly, but it works for now.
4563
+ /** @type {?} */
4564
+ var segments = this.cloneUrlSegmentList();
4565
+ /** @type {?} */
4566
+ var visitSegments = this.convertToUrlSegments(visit);
4567
+ /** @type {?} */
4568
+ var replaceAt = segments.findIndex((/**
4569
+ * @param {?} segment
4570
+ * @return {?}
4571
+ */
4572
+ function (segment) { return segment.path === visitSegments[0].path; }));
4573
+ // do not use the return value, it's the items that were removed!
4574
+ segments.splice.apply(segments, __spread([replaceAt, visitSegments.length], visitSegments));
4575
+ return segments;
4576
+ };
4577
+ /**
4578
+ * Converts the visit into segments. Please not that these segments are not e
4579
+ * @param visit
4580
+ */
4581
+ /**
4582
+ * Converts the visit into segments. Please not that these segments are not e
4583
+ * @param {?} visit
4584
+ * @return {?}
4585
+ */
4586
+ UrlHelper.prototype.convertToUrlSegments = /**
4587
+ * Converts the visit into segments. Please not that these segments are not e
4588
+ * @param {?} visit
4589
+ * @return {?}
4590
+ */
4591
+ function (visit) {
4592
+ return visit.placeDefinition.hasRouteId() ?
4593
+ [
4594
+ // NOTE:
4595
+ // It's important to attach the params to the root path and not the id. If we attach them
4596
+ // to an empty id then the angular router won't match the pattern.
4597
+ new router.UrlSegment(visit.placeDefinition.path, visit.placeDefinition.getFormattedRouteParameters(visit)),
4598
+ new router.UrlSegment(visit.placeDefinition.getFormattedRouteId(visit), {})
4599
+ ]
4600
+ :
4601
+ [
4602
+ new router.UrlSegment(visit.placeDefinition.path, visit.placeDefinition.getFormattedRouteParameters(visit))
4603
+ ];
4604
+ };
4605
+ /**
4606
+ * @param {?} visit
4607
+ * @return {?}
4608
+ */
4609
+ UrlHelper.prototype.createRedirectCommandsFor = /**
4610
+ * @param {?} visit
4611
+ * @return {?}
4612
+ */
4613
+ function (visit) {
4614
+ /** @type {?} */
4615
+ var segments = this.updateVisitSegments(visit);
4616
+ /** @type {?} */
4617
+ var commands = [];
4618
+ segments.forEach((/**
4619
+ * @param {?} s
4620
+ * @return {?}
4621
+ */
4622
+ function (s) {
4623
+ commands.push(s.path);
4624
+ if (s.parameterMap.keys.length > 0) {
4625
+ commands.push(s.parameters);
4626
+ }
4627
+ }));
4628
+ return commands;
4629
+ };
4630
+ /**
4631
+ * @param {?} placeDef
4632
+ * @return {?}
4633
+ */
4634
+ UrlHelper.prototype.includesPathOf = /**
4635
+ * @param {?} placeDef
4636
+ * @return {?}
4637
+ */
4638
+ function (placeDef) {
4639
+ return this.cloneUrlSegmentList().find((/**
4640
+ * @param {?} s
4641
+ * @return {?}
4642
+ */
4643
+ function (s) { return s.path === placeDef.path; }));
4644
+ };
4645
+ __decorate([
4646
+ pectin.Trace(),
4647
+ __metadata("design:type", Function),
4648
+ __metadata("design:paramtypes", [Visit]),
4649
+ __metadata("design:returntype", Array)
4650
+ ], UrlHelper.prototype, "createRedirectCommandsFor", null);
4651
+ return UrlHelper;
4652
+ }());
4653
+ PlaceRouter.UrlHelper = UrlHelper;
4654
+ if (false) {
4655
+ /**
4656
+ * @type {?}
4657
+ * @private
4658
+ */
4659
+ UrlHelper.prototype.urlTree;
4660
+ }
4661
+ })(exports.ɵt || (exports.ɵt = {}));
4305
4662
 
4306
4663
  /**
4307
4664
  * @fileoverview added by tsickle
@@ -4688,7 +5045,7 @@
4688
5045
  /** @nocollapse */
4689
5046
  PlaceOutletComponent.ctorParameters = function () { return [
4690
5047
  { type: router.Router },
4691
- { type: PlaceRouter },
5048
+ { type: exports.ɵt },
4692
5049
  { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [AUP_PLACE_CONFIG,] }] },
4693
5050
  { type: PlaceOutletComponent, decorators: [{ type: core.SkipSelf }, { type: core.Optional }] }
4694
5051
  ]; };
@@ -6052,7 +6409,7 @@
6052
6409
  */
6053
6410
  function (activatedRoute, state) {
6054
6411
  return __awaiter(this, void 0, void 0, function () {
6055
- var placeDefinition, params, parsedParams, initialVisit, sanitiser, sanitisedVisit, routerStateUrlTree, commands;
6412
+ var placeDefinition, params, parsedParams, initialVisit, sanitiser, sanitisedVisit, commands;
6056
6413
  return __generator(this, function (_a) {
6057
6414
  switch (_a.label) {
6058
6415
  case 0:
@@ -6069,9 +6426,8 @@
6069
6426
  // Save the visit with any updated parameters. We need to save it so we remember any non route parameters
6070
6427
  this.placeRouter.navigationSession.storeVisit(sanitisedVisit);
6071
6428
  if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {
6072
- routerStateUrlTree = this.urlSerializer.parse(state.url);
6073
6429
  // Regenerate the url
6074
- commands = this.createRedirectCommands(sanitisedVisit, __spread(routerStateUrlTree.root.children.primary.segments)).commands;
6430
+ commands = this.placeRouter.parseUrl(state).createRedirectCommandsFor(sanitisedVisit);
6075
6431
  console.log('##### Place Guard Redirect', commands);
6076
6432
  return [2 /*return*/, this.router.createUrlTree(commands, {
6077
6433
  replaceUrl: true,
@@ -6088,46 +6444,6 @@
6088
6444
  });
6089
6445
  });
6090
6446
  };
6091
- /**
6092
- * @private
6093
- * @param {?} sanitisedVisit
6094
- * @param {?} path
6095
- * @return {?}
6096
- */
6097
- EnterPlaceGuard.prototype.createRedirectCommands = /**
6098
- * @private
6099
- * @param {?} sanitisedVisit
6100
- * @param {?} path
6101
- * @return {?}
6102
- */
6103
- function (sanitisedVisit, path) {
6104
- // Ugly, but it works for now.
6105
- /** @type {?} */
6106
- var newSegments = sanitisedVisit.getUrlSegments();
6107
- /** @type {?} */
6108
- var replaceAt = path.findIndex((/**
6109
- * @param {?} segment
6110
- * @return {?}
6111
- */
6112
- function (segment) { return segment.path === newSegments[0].path; }));
6113
- /** @type {?} */
6114
- var newPath = __spread(path);
6115
- newPath.splice.apply(newPath, __spread([replaceAt, newSegments.length], newSegments)); // do not use the return value, it's the items that were removed!
6116
- // do not use the return value, it's the items that were removed!
6117
- /** @type {?} */
6118
- var commands = [];
6119
- newPath.forEach((/**
6120
- * @param {?} s
6121
- * @return {?}
6122
- */
6123
- function (s) {
6124
- commands.push(s.path);
6125
- if (s.parameterMap.keys.length > 0) {
6126
- commands.push(s.parameters);
6127
- }
6128
- }));
6129
- return { newPath: newPath, commands: commands };
6130
- };
6131
6447
  EnterPlaceGuard.decorators = [
6132
6448
  { type: core.Injectable, args: [{
6133
6449
  providedIn: 'root'
@@ -6137,11 +6453,11 @@
6137
6453
  EnterPlaceGuard.ctorParameters = function () { return [
6138
6454
  { type: router.Router },
6139
6455
  { type: router.UrlSerializer },
6140
- { type: PlaceRouter },
6456
+ { type: exports.ɵt },
6141
6457
  { type: PlaceHistory },
6142
6458
  { type: core.Injector }
6143
6459
  ]; };
6144
- /** @nocollapse */ EnterPlaceGuard.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function EnterPlaceGuard_Factory() { return new EnterPlaceGuard(core.ɵɵinject(router.Router), core.ɵɵinject(router.UrlSerializer), core.ɵɵinject(PlaceRouter), core.ɵɵinject(PlaceHistory), core.ɵɵinject(core.INJECTOR)); }, token: EnterPlaceGuard, providedIn: "root" });
6460
+ /** @nocollapse */ EnterPlaceGuard.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function EnterPlaceGuard_Factory() { return new EnterPlaceGuard(core.ɵɵinject(router.Router), core.ɵɵinject(router.UrlSerializer), core.ɵɵinject(exports.ɵt), core.ɵɵinject(PlaceHistory), core.ɵɵinject(core.INJECTOR)); }, token: EnterPlaceGuard, providedIn: "root" });
6145
6461
  return EnterPlaceGuard;
6146
6462
  }());
6147
6463
  if (false) {
@@ -6333,90 +6649,9 @@
6333
6649
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
6334
6650
  */
6335
6651
  var LeavePlaceGuard = /** @class */ (function () {
6336
- function LeavePlaceGuard(router, injector, placeRouter, dialogInteractionContext, angularLocation) {
6337
- this.router = router;
6338
- this.injector = injector;
6652
+ function LeavePlaceGuard(placeRouter) {
6339
6653
  this.placeRouter = placeRouter;
6340
- this.dialogInteractionContext = dialogInteractionContext;
6341
- this.angularLocation = angularLocation;
6342
6654
  }
6343
- // @Trace()
6344
- // @Trace()
6345
- /**
6346
- * @private
6347
- * @param {?} nextState
6348
- * @param {?} placeDefinition
6349
- * @return {?}
6350
- */
6351
- LeavePlaceGuard.prototype.isLeavingTheCurrentPlace =
6352
- // @Trace()
6353
- /**
6354
- * @private
6355
- * @param {?} nextState
6356
- * @param {?} placeDefinition
6357
- * @return {?}
6358
- */
6359
- function (nextState, placeDefinition) {
6360
- // TODO: this will break with child routes... need to examine the router states properly.
6361
- // console.log('canDeactivate', {
6362
- // staticPath: placeDefinitionPath,
6363
- // currentStateUrl: currentState.url,
6364
- // nextStateUrl: nextState.url
6365
- // // alreadyDeclined: this._alreadyAccepted
6366
- // });
6367
- // Example of the above when navigating to a different child route.
6368
- // canDeactivate {staticPath: "/hero-details",
6369
- // currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-details",
6370
- // nextStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats"
6371
- // }
6372
- // TODO: this will break with child routes... need to examine the router states properly.
6373
- // console.log('canDeactivate', {
6374
- // staticPath: placeDefinitionPath,
6375
- // currentStateUrl: currentState.url,
6376
- // nextStateUrl: nextState.url
6377
- // // alreadyDeclined: this._alreadyAccepted
6378
- // });
6379
- // Example of the above when navigating to a different child route.
6380
- // canDeactivate {staticPath: "/hero-details",
6381
- // currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-details",
6382
- // nextStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats"
6383
- // }
6384
- // Example clicking on router tab of the parent component (de-activates the parent due to route param changes)
6385
- // canDeactivate {
6386
- // staticPath: "/hero-stats",
6387
- // currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
6388
- // nextStateUrl: "/route-parameters/"
6389
- // }
6390
- // canDeactivate {
6391
- // staticPath: "/route-parameters",
6392
- // currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
6393
- // nextStateUrl: "/route-parameters/"
6394
- // }
6395
- // logger.class.js:54 ParameterSnapshot.sanitise -> {idModel: -1, pv: undefined, pl: Array(0), dv: undefined, dl: Array(0), …}
6396
- // parameter-snapshot.ts:20 {name: "idModel", mine: -1, theirs: null}
6397
- // place-router.ts:28 redirect path (3) ["route-parameters", "-1", {…}]
6398
- // canDeactivate {
6399
- // staticPath: "/hero-stats",
6400
- // currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
6401
- // nextStateUrl: "/route-parameters/-1"
6402
- // }
6403
- // canDeactivate {
6404
- // staticPath: "/route-parameters",
6405
- // currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
6406
- // nextStateUrl: "/route-parameters/-1"
6407
- // }
6408
- // logger.class.js:54 ParameterSnapshot.sanitise -> {idModel: -1, pv: undefined, pl: Array(0), dv: "A", dl: Array(3), …}
6409
- // parameter-snapshot.ts:20 {name: "dv", mine: "A", theirs: undefined}
6410
- // place-router.ts:28 redirect path (3) ["route-parameters", "-1", {…}]
6411
- // canDeactivate {
6412
- // staticPath: "/hero-stats",
6413
- // currentStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c/hero-stats",
6414
- // nextStateUrl: "/route-parameters/-1;dv=A;dl=a,b,c;rdv=A;rdl=a,b,c"
6415
- // }
6416
- /** @type {?} */
6417
- var placeDefinitionPath = "/" + placeDefinition.path;
6418
- return !nextState.url.startsWith(placeDefinitionPath);
6419
- };
6420
6655
  /**
6421
6656
  * @param {?} component
6422
6657
  * @param {?} currentRoute
@@ -6433,72 +6668,8 @@
6433
6668
  */
6434
6669
  function (component, currentRoute, currentState, nextState) {
6435
6670
  return __awaiter(this, void 0, void 0, function () {
6436
- var self_1, canLeave;
6437
6671
  return __generator(this, function (_a) {
6438
- switch (_a.label) {
6439
- case 0:
6440
- if (!this.placeRouter.navigationSession.alreadyAccepted(component)) return [3 /*break*/, 1];
6441
- // We'll get called multiple times if there's any parameter sanitisation so
6442
- // we always return true if we accepted on a previous cycle of the current
6443
- // navigation session.
6444
- return [2 /*return*/, true];
6445
- case 1:
6446
- self_1 = this;
6447
- canLeave = true;
6448
- if (!this.isLeavingTheCurrentPlace(nextState, component.placeDefinition)) return [3 /*break*/, 4];
6449
- // we check the dialog interaction first, so that components that don't need to check if they're in an
6450
- // interaction during the canDeactivate cycle.
6451
- // TODO: Add tests: show dialog -> hit back -> same route
6452
- if (this.dialogInteractionContext.isActive()) {
6453
- console.log('cancelling', { activity: this.dialogInteractionContext.currentActivity });
6454
- this.dialogInteractionContext.currentActivity.cancel(null);
6455
- canLeave = false;
6456
- }
6457
- else {
6458
- canLeave = true;
6459
- }
6460
- if (canLeave) {
6461
- // now check if the component has an active interaction. This will handle
6462
- // an inplace interaction contexts
6463
- if (component.interactionContext && component.interactionContext.isActive()) {
6464
- canLeave = false;
6465
- console.log('cancelling', { activity: component.interactionContext.currentActivity });
6466
- component.interactionContext.currentActivity.cancel(null);
6467
- }
6468
- }
6469
- if (!canLeave) return [3 /*break*/, 3];
6470
- return [4 /*yield*/, component.canDeactivate()];
6471
- case 2:
6472
- // TODO: Add tests: hit back -> confirm leave dialog -> hit back -> close dialog -> hit back -> confirm leave dialog.
6473
- canLeave = _a.sent();
6474
- _a.label = 3;
6475
- case 3: return [3 /*break*/, 5];
6476
- case 4:
6477
- if (this.dialogInteractionContext.isActive()) {
6478
- console.log('cancelling', { activity: this.dialogInteractionContext.currentActivity });
6479
- this.dialogInteractionContext.currentActivity.cancel(null);
6480
- canLeave = false;
6481
- }
6482
- else {
6483
- canLeave = true;
6484
- }
6485
- _a.label = 5;
6486
- case 5:
6487
- if (canLeave) {
6488
- // We'll get called multiple times if there's any parameter sanitisation so
6489
- // we remember the acceptance for the duration of the current navigation session.
6490
- self_1.placeRouter.navigationSession.rememberAcceptanceOf(component);
6491
- }
6492
- else {
6493
- // Angular doesn't preserve the url when a guard cancels the back button.
6494
- // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
6495
- if (this.placeRouter.navigationSession.isPopState) {
6496
- console.log('cancelled during popstate');
6497
- this.angularLocation.go(this.placeRouter.navigationSession.popStateReturnUrl);
6498
- }
6499
- }
6500
- return [2 /*return*/, canLeave];
6501
- }
6672
+ return [2 /*return*/, this.placeRouter.navigationSession.canDeactivate(component, this.placeRouter.parseUrl(nextState))];
6502
6673
  });
6503
6674
  });
6504
6675
  };
@@ -6509,35 +6680,17 @@
6509
6680
  ];
6510
6681
  /** @nocollapse */
6511
6682
  LeavePlaceGuard.ctorParameters = function () { return [
6512
- { type: router.Router },
6513
- { type: core.Injector },
6514
- { type: PlaceRouter },
6515
- { type: InteractionContext },
6516
- { type: common.Location }
6683
+ { type: exports.ɵt }
6517
6684
  ]; };
6518
- /** @nocollapse */ LeavePlaceGuard.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function LeavePlaceGuard_Factory() { return new LeavePlaceGuard(core.ɵɵinject(router.Router), core.ɵɵinject(core.INJECTOR), core.ɵɵinject(PlaceRouter), core.ɵɵinject(InteractionContext), core.ɵɵinject(common.Location)); }, token: LeavePlaceGuard, providedIn: "root" });
6685
+ /** @nocollapse */ LeavePlaceGuard.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function LeavePlaceGuard_Factory() { return new LeavePlaceGuard(core.ɵɵinject(exports.ɵt)); }, token: LeavePlaceGuard, providedIn: "root" });
6519
6686
  return LeavePlaceGuard;
6520
6687
  }());
6521
6688
  if (false) {
6522
- /**
6523
- * @type {?}
6524
- * @private
6525
- */
6526
- LeavePlaceGuard.prototype.router;
6527
- /**
6528
- * @type {?}
6529
- * @private
6530
- */
6531
- LeavePlaceGuard.prototype.injector;
6532
6689
  /**
6533
6690
  * @type {?}
6534
6691
  * @private
6535
6692
  */
6536
6693
  LeavePlaceGuard.prototype.placeRouter;
6537
- /** @type {?} */
6538
- LeavePlaceGuard.prototype.dialogInteractionContext;
6539
- /** @type {?} */
6540
- LeavePlaceGuard.prototype.angularLocation;
6541
6694
  }
6542
6695
 
6543
6696
  exports.ACTIVITY_DATA = ACTIVITY_DATA;
@@ -6545,7 +6698,7 @@
6545
6698
  exports.AbstractActivity = AbstractActivity;
6546
6699
  exports.AbstractInputComponent = AbstractInputComponent;
6547
6700
  exports.AbstractPlaceNavigationComponent = AbstractPlaceNavigationComponent;
6548
- exports.Activity = exports.ɵbf;
6701
+ exports.Activity = exports.ɵbg;
6549
6702
  exports.ActivityContainerComponent = ActivityContainerComponent;
6550
6703
  exports.ActivityOutletComponent = ActivityOutletComponent;
6551
6704
  exports.AlertDialogComponent = AlertDialogComponent;
@@ -6553,7 +6706,7 @@
6553
6706
  exports.BusyOverlayComponent = BusyOverlayComponent;
6554
6707
  exports.CommandDirective = CommandDirective;
6555
6708
  exports.ComponentsModule = ComponentsModule;
6556
- exports.ConfirmThenDialogComponent = exports.ɵbh;
6709
+ exports.ConfirmThenDialogComponent = exports.ɵbi;
6557
6710
  exports.ConfirmationDialogComponent = ConfirmationDialogComponent;
6558
6711
  exports.DEFINITION_META_DATA_KEY = DEFINITION_META_DATA_KEY;
6559
6712
  exports.DIALOG_INTERACTION_SERVICE_DEFAULTS = DIALOG_INTERACTION_SERVICE_DEFAULTS;
@@ -6571,6 +6724,7 @@
6571
6724
  exports.LEFT_RIGHT_PLACE_ANIMATION = LEFT_RIGHT_PLACE_ANIMATION;
6572
6725
  exports.LeavePlaceGuard = LeavePlaceGuard;
6573
6726
  exports.ListPlaceNavComponent = ListPlaceNavComponent;
6727
+ exports.NavigationSession = exports.ɵu;
6574
6728
  exports.NoopComponent = NoopComponent;
6575
6729
  exports.NumberInputComponent = NumberInputComponent;
6576
6730
  exports.PasswordInputComponent = PasswordInputComponent;
@@ -6578,7 +6732,7 @@
6578
6732
  exports.PlaceHistory = PlaceHistory;
6579
6733
  exports.PlaceModule = PlaceModule;
6580
6734
  exports.PlaceOutletComponent = PlaceOutletComponent;
6581
- exports.PlaceRouter = PlaceRouter;
6735
+ exports.PlaceRouter = exports.ɵt;
6582
6736
  exports.Point = Point;
6583
6737
  exports.ROUTE_PARAMETER_LIST_KEY = ROUTE_PARAMETER_LIST_KEY;
6584
6738
  exports.ResizeAwareComponent = ResizeAwareComponent;
@@ -6594,16 +6748,17 @@
6594
6748
  exports.slideDownAndUpAnimation = slideDownAndUpAnimation;
6595
6749
  exports.ɵa = DirectivesModule;
6596
6750
  exports.ɵb = CommandDirective;
6597
- exports.ɵba = InteractionContext;
6598
- exports.ɵbb = ActivityOutletComponent;
6599
- exports.ɵbc = ConfirmationDialogComponent;
6600
- exports.ɵbd = AbstractActivity;
6601
- exports.ɵbe = ACTIVITY_DATA;
6602
- exports.ɵbi = AlertDialogComponent;
6603
- exports.ɵbk = InteractionOutletComponent;
6604
- exports.ɵbl = InplaceInteractionContextComponent;
6605
- exports.ɵbm = DIALOG_INTERACTION_SERVICE_DEFAULTS;
6606
- exports.ɵbn = DialogInteractionService;
6751
+ exports.ɵba = InteractionModule;
6752
+ exports.ɵbb = ActivityContainerComponent;
6753
+ exports.ɵbc = ActivityOutletComponent;
6754
+ exports.ɵbd = ConfirmationDialogComponent;
6755
+ exports.ɵbe = AbstractActivity;
6756
+ exports.ɵbf = ACTIVITY_DATA;
6757
+ exports.ɵbj = AlertDialogComponent;
6758
+ exports.ɵbl = InteractionOutletComponent;
6759
+ exports.ɵbm = InplaceInteractionContextComponent;
6760
+ exports.ɵbn = DIALOG_INTERACTION_SERVICE_DEFAULTS;
6761
+ exports.ɵbo = DialogInteractionService;
6607
6762
  exports.ɵc = FocusBindingDirective;
6608
6763
  exports.ɵd = DisposableComponent;
6609
6764
  exports.ɵe = ComponentsModule;
@@ -6620,13 +6775,11 @@
6620
6775
  exports.ɵp = leftRightPlaceAnimation;
6621
6776
  exports.ɵq = LEFT_RIGHT_PLACE_ANIMATION;
6622
6777
  exports.ɵr = AUP_PLACE_CONFIG;
6623
- exports.ɵt = PlaceRouter;
6624
- exports.ɵu = PlaceHistory;
6625
- exports.ɵv = TabbedPlaceNavigationComponent;
6626
- exports.ɵw = AbstractPlaceNavigationComponent;
6627
- exports.ɵx = ListPlaceNavComponent;
6628
- exports.ɵy = InteractionModule;
6629
- exports.ɵz = ActivityContainerComponent;
6778
+ exports.ɵv = InteractionContext;
6779
+ exports.ɵw = PlaceHistory;
6780
+ exports.ɵx = TabbedPlaceNavigationComponent;
6781
+ exports.ɵy = AbstractPlaceNavigationComponent;
6782
+ exports.ɵz = ListPlaceNavComponent;
6630
6783
 
6631
6784
  Object.defineProperty(exports, '__esModule', { value: true });
6632
6785