@coolon/angular-ui-powerups 0.0.66 → 0.0.68

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/bundles/coolon-angular-ui-powerups.umd.js +2207 -1737
  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 +24 -22
  6. package/coolon-angular-ui-powerups.metadata.json +1 -1
  7. package/esm2015/coolon-angular-ui-powerups.js +24 -22
  8. package/esm2015/index.js +2 -2
  9. package/esm2015/lib/angular-ui-powerups.module.js +6 -3
  10. package/esm2015/lib/components/index.js +2 -1
  11. package/esm2015/lib/components/noop/noop.component.js +19 -0
  12. package/esm2015/lib/interaction/components/alert-dialog/alert-dialog.component.js +2 -2
  13. package/esm2015/lib/interaction/components/confirm-then-dialog/confirm-then-dialog.component.js +2 -2
  14. package/esm2015/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.js +2 -2
  15. package/esm2015/lib/interaction/components/interaction-outlet/interaction-outlet.component.js +19 -0
  16. package/esm2015/lib/interaction/guards/interaction-guard.service.js +85 -0
  17. package/esm2015/lib/interaction/index.js +3 -2
  18. package/esm2015/lib/interaction/interaction.module.js +8 -3
  19. package/esm2015/lib/interaction/services/dialog-interaction.service.js +30 -5
  20. package/esm2015/lib/place/components/abstract-place-navigation.component.js +5 -5
  21. package/esm2015/lib/place/components/list-place-nav/list-place-nav.component.js +2 -2
  22. package/esm2015/lib/place/components/place-outlet/place-outlet.component.js +60 -66
  23. package/esm2015/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.js +2 -2
  24. package/esm2015/lib/place/index.js +9 -8
  25. package/esm2015/lib/place/navigation-session.js +147 -0
  26. package/esm2015/lib/place/place-component.js +18 -14
  27. package/esm2015/lib/place/place-definition.js +197 -5
  28. package/esm2015/lib/place/place-history.js +3 -2
  29. package/esm2015/lib/place/place-router.js +186 -89
  30. package/esm2015/lib/place/route/formatter.js +63 -0
  31. package/esm2015/lib/place/route/guards/leave-place.guard.js +193 -0
  32. package/esm2015/lib/place/route/guards/place-route.guard.js +243 -0
  33. package/esm2015/lib/place/route/parameter-decorators.js +35 -18
  34. package/esm2015/lib/place/route/parameter-definition.class.js +123 -67
  35. package/esm2015/lib/place/route/parameter-sanitiser.js +4 -3
  36. package/esm2015/lib/place/route/parameter-snapshot.js +11 -388
  37. package/esm2015/lib/place/route/visit-sanitiser.js +88 -0
  38. package/esm2015/lib/place/visit.js +107 -8
  39. package/esm2015/public_api.js +4 -4
  40. package/esm5/coolon-angular-ui-powerups.js +24 -22
  41. package/esm5/index.js +2 -2
  42. package/esm5/lib/angular-ui-powerups.module.js +6 -3
  43. package/esm5/lib/components/index.js +2 -1
  44. package/esm5/lib/components/noop/noop.component.js +21 -0
  45. package/esm5/lib/interaction/components/alert-dialog/alert-dialog.component.js +2 -2
  46. package/esm5/lib/interaction/components/confirm-then-dialog/confirm-then-dialog.component.js +2 -2
  47. package/esm5/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.js +2 -2
  48. package/esm5/lib/interaction/components/interaction-outlet/interaction-outlet.component.js +21 -0
  49. package/esm5/lib/interaction/guards/interaction-guard.service.js +94 -0
  50. package/esm5/lib/interaction/index.js +3 -2
  51. package/esm5/lib/interaction/interaction.module.js +8 -3
  52. package/esm5/lib/interaction/services/dialog-interaction.service.js +28 -5
  53. package/esm5/lib/place/components/abstract-place-navigation.component.js +5 -5
  54. package/esm5/lib/place/components/list-place-nav/list-place-nav.component.js +2 -2
  55. package/esm5/lib/place/components/place-outlet/place-outlet.component.js +70 -82
  56. package/esm5/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.js +2 -2
  57. package/esm5/lib/place/index.js +9 -8
  58. package/esm5/lib/place/navigation-session.js +193 -0
  59. package/esm5/lib/place/place-component.js +19 -15
  60. package/esm5/lib/place/place-definition.js +253 -5
  61. package/esm5/lib/place/place-history.js +7 -3
  62. package/esm5/lib/place/place-router.js +242 -107
  63. package/esm5/lib/place/route/formatter.js +96 -0
  64. package/esm5/lib/place/route/guards/leave-place.guard.js +152 -0
  65. package/esm5/lib/place/route/guards/place-route.guard.js +273 -0
  66. package/esm5/lib/place/route/parameter-decorators.js +35 -18
  67. package/esm5/lib/place/route/parameter-definition.class.js +179 -76
  68. package/esm5/lib/place/route/parameter-sanitiser.js +4 -3
  69. package/esm5/lib/place/route/parameter-snapshot.js +11 -480
  70. package/esm5/lib/place/route/visit-sanitiser.js +99 -0
  71. package/esm5/lib/place/visit.js +160 -8
  72. package/esm5/public_api.js +4 -4
  73. package/fesm2015/coolon-angular-ui-powerups.js +1493 -1124
  74. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  75. package/fesm5/coolon-angular-ui-powerups.js +2166 -1700
  76. package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
  77. package/lib/components/index.d.ts +1 -0
  78. package/lib/components/noop/noop.component.d.ts +3 -0
  79. package/lib/interaction/components/interaction-outlet/interaction-outlet.component.d.ts +3 -0
  80. package/lib/interaction/guards/interaction-guard.service.d.ts +13 -0
  81. package/lib/interaction/index.d.ts +2 -1
  82. package/lib/interaction/services/dialog-interaction.service.d.ts +5 -1
  83. package/lib/place/components/place-outlet/place-outlet.component.d.ts +12 -12
  84. package/lib/place/index.d.ts +5 -4
  85. package/lib/place/navigation-session.d.ts +26 -0
  86. package/lib/place/place-component.d.ts +3 -3
  87. package/lib/place/place-definition.d.ts +30 -3
  88. package/lib/place/place-history.d.ts +3 -3
  89. package/lib/place/place-router.d.ts +26 -19
  90. package/lib/place/route/{parameter-type.d.ts → formatter.d.ts} +5 -5
  91. package/lib/place/{guards → route/guards}/leave-place.guard.d.ts +4 -3
  92. package/lib/place/route/guards/place-route.guard.d.ts +27 -0
  93. package/lib/place/route/parameter-decorators.d.ts +14 -6
  94. package/lib/place/route/parameter-definition.class.d.ts +21 -17
  95. package/lib/place/route/parameter-sanitiser.d.ts +3 -2
  96. package/lib/place/route/parameter-snapshot.d.ts +4 -26
  97. package/lib/place/route/visit-sanitiser.d.ts +12 -0
  98. package/lib/place/visit.d.ts +24 -3
  99. package/package.json +1 -1
  100. package/schematics/place-routes/place-class-scanner.d.ts +2 -2
  101. package/schematics/place-routes/place-class-scanner.js +7 -7
  102. package/schematics/place-routes/place-class-scanner.js.map +1 -1
  103. package/schematics/place-routes/place-def.d.ts +3 -2
  104. package/schematics/place-routes/place-def.js +21 -12
  105. package/schematics/place-routes/place-def.js.map +1 -1
  106. package/schematics/place-routes/templates/place-destinations.ts.template +5 -3
  107. package/schematics/place-routes/templates/place-routes.ts.template +10 -1
  108. package/schematics/place-routes/templates/place-visits.ts.template +21 -0
  109. package/esm2015/lib/interaction/guards/close-interaction.guard.js +0 -62
  110. package/esm2015/lib/place/guards/leave-place.guard.js +0 -159
  111. package/esm2015/lib/place/guards/place-route.guard.js +0 -74
  112. package/esm2015/lib/place/route/parameter-type.js +0 -61
  113. package/esm2015/lib/place/route/route-parameter-value.js +0 -230
  114. package/esm5/lib/interaction/guards/close-interaction.guard.js +0 -66
  115. package/esm5/lib/place/guards/leave-place.guard.js +0 -117
  116. package/esm5/lib/place/guards/place-route.guard.js +0 -78
  117. package/esm5/lib/place/route/parameter-type.js +0 -94
  118. package/esm5/lib/place/route/route-parameter-value.js +0 -316
  119. package/lib/interaction/guards/close-interaction.guard.d.ts +0 -12
  120. package/lib/place/guards/place-route.guard.d.ts +0 -10
  121. package/lib/place/route/route-parameter-value.d.ts +0 -42
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@angular/forms'), require('@angular/material'), require('@angular/material/tabs'), require('@angular/platform-browser/animations'), require('@coolon/pectin'), require('@angular/cdk/portal'), require('lodash'), require('@coolon/typescript-utilities'), require('@angular/material/dialog'), require('uuid'), require('@angular/material/icon'), require('@angular/material/list'), require('@angular/material/tooltip'), require('@angular/router'), require('@typescript-plus/fast-memoize-decorator/dist/src'), require('@typescript-plus/fast-memoize-decorator'), require('reflect-metadata'), require('@angular/animations'), require('resize-observer-polyfill')) :
3
- typeof define === 'function' && define.amd ? define('@coolon/angular-ui-powerups', ['exports', '@angular/common', '@angular/core', '@angular/forms', '@angular/material', '@angular/material/tabs', '@angular/platform-browser/animations', '@coolon/pectin', '@angular/cdk/portal', 'lodash', '@coolon/typescript-utilities', '@angular/material/dialog', 'uuid', '@angular/material/icon', '@angular/material/list', '@angular/material/tooltip', '@angular/router', '@typescript-plus/fast-memoize-decorator/dist/src', '@typescript-plus/fast-memoize-decorator', 'reflect-metadata', '@angular/animations', 'resize-observer-polyfill'], factory) :
4
- (global = global || self, factory((global.coolon = global.coolon || {}, global.coolon['angular-ui-powerups'] = {}), global.ng.common, global.ng.core, global.ng.forms, global.ng.material, global.ng.material.tabs, global.ng.platformBrowser.animations, global.pectin, global.ng.cdk.portal, global.___default, global.typescriptUtilities, global.ng.material.dialog, global.uuid, global.ng.material.icon, global.ng.material.list, global.ng.material.tooltip, global.ng.router, global.src, global.fastMemoizeDecorator, null, global.ng.animations, global.ResizeObserver));
5
- }(this, function (exports, common, core, forms, material, tabs, animations, pectin, portal, ___default, typescriptUtilities, dialog, uuid, icon, list, tooltip, router, src, fastMemoizeDecorator, reflectMetadata, animations$1, ResizeObserver) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@angular/forms'), require('@angular/material'), require('@angular/material/tabs'), require('@angular/platform-browser/animations'), require('@coolon/pectin'), require('@angular/cdk/portal'), require('@angular/router'), require('lodash'), require('@coolon/typescript-utilities'), require('@angular/material/dialog'), require('uuid'), require('@angular/material/icon'), require('@angular/material/list'), require('@angular/material/tooltip'), require('@typescript-plus/fast-memoize-decorator/dist/src'), require('@typescript-plus/fast-memoize-decorator'), require('reflect-metadata'), require('@angular/animations'), require('resize-observer-polyfill')) :
3
+ typeof define === 'function' && define.amd ? define('@coolon/angular-ui-powerups', ['exports', '@angular/common', '@angular/core', '@angular/forms', '@angular/material', '@angular/material/tabs', '@angular/platform-browser/animations', '@coolon/pectin', '@angular/cdk/portal', '@angular/router', 'lodash', '@coolon/typescript-utilities', '@angular/material/dialog', 'uuid', '@angular/material/icon', '@angular/material/list', '@angular/material/tooltip', '@typescript-plus/fast-memoize-decorator/dist/src', '@typescript-plus/fast-memoize-decorator', 'reflect-metadata', '@angular/animations', 'resize-observer-polyfill'], factory) :
4
+ (global = global || self, factory((global.coolon = global.coolon || {}, global.coolon['angular-ui-powerups'] = {}), global.ng.common, global.ng.core, global.ng.forms, global.ng.material, global.ng.material.tabs, global.ng.platformBrowser.animations, global.pectin, global.ng.cdk.portal, global.ng.router, global.___default, global.typescriptUtilities, global.ng.material.dialog, global.uuid, global.ng.material.icon, global.ng.material.list, global.ng.material.tooltip, global.src, global.fastMemoizeDecorator, null, global.ng.animations, global.ResizeObserver));
5
+ }(this, function (exports, common, core, forms, material, tabs, animations, pectin, portal, router, ___default, typescriptUtilities, dialog, uuid, icon, list, tooltip, src, fastMemoizeDecorator, reflectMetadata, animations$1, ResizeObserver) { 'use strict';
6
6
 
7
7
  var ___default__default = 'default' in ___default ? ___default['default'] : ___default;
8
8
  ResizeObserver = ResizeObserver && ResizeObserver.hasOwnProperty('default') ? ResizeObserver['default'] : ResizeObserver;
@@ -600,6 +600,25 @@
600
600
  return StringInputComponent;
601
601
  }(AbstractInputComponent));
602
602
 
603
+ /**
604
+ * @fileoverview added by tsickle
605
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
606
+ */
607
+ var NoopComponent = /** @class */ (function () {
608
+ function NoopComponent() {
609
+ }
610
+ NoopComponent.decorators = [
611
+ { type: core.Component, args: [{
612
+ selector: 'angular-ui-powerups-noop',
613
+ template: "",
614
+ styles: [":host{display:block}"]
615
+ }] }
616
+ ];
617
+ /** @nocollapse */
618
+ NoopComponent.ctorParameters = function () { return []; };
619
+ return NoopComponent;
620
+ }());
621
+
603
622
  /**
604
623
  * @fileoverview added by tsickle
605
624
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
@@ -1068,7 +1087,7 @@
1068
1087
  * @abstract
1069
1088
  * @template D, R, E
1070
1089
  */
1071
- exports.ɵba = /** @class */ (function (_super) {
1090
+ exports.ɵbb = /** @class */ (function (_super) {
1072
1091
  __extends(Activity, _super);
1073
1092
  function Activity() {
1074
1093
  var _this = _super !== null && _super.apply(this, arguments) || this;
@@ -1158,12 +1177,12 @@
1158
1177
  * @type {?}
1159
1178
  * @private
1160
1179
  */
1161
- exports.ɵba.prototype._busyModel;
1180
+ exports.ɵbb.prototype._busyModel;
1162
1181
  /**
1163
1182
  * @type {?}
1164
1183
  * @private
1165
1184
  */
1166
- exports.ɵba.prototype._activityContext;
1185
+ exports.ɵbb.prototype._activityContext;
1167
1186
  }
1168
1187
  (function (Activity) {
1169
1188
  /**
@@ -1178,7 +1197,7 @@
1178
1197
  /** @type {?} */
1179
1198
  Callbacks.prototype.onCancel;
1180
1199
  }
1181
- })(exports.ɵba || (exports.ɵba = {}));
1200
+ })(exports.ɵbb || (exports.ɵbb = {}));
1182
1201
 
1183
1202
  /**
1184
1203
  * @fileoverview added by tsickle
@@ -1335,7 +1354,7 @@
1335
1354
  return _super !== null && _super.apply(this, arguments) || this;
1336
1355
  }
1337
1356
  return AbstractActivity;
1338
- }(exports.ɵba));
1357
+ }(exports.ɵbb));
1339
1358
 
1340
1359
  /**
1341
1360
  * @fileoverview added by tsickle
@@ -1359,7 +1378,7 @@
1359
1378
  AlertDialogComponent.decorators = [
1360
1379
  { type: core.Component, args: [{
1361
1380
  selector: 'angular-ui-powerups-alert-dialog',
1362
- template: "<h3 matDialogTitle *ngIf=\"alert.title\">{{alert.title()}}</h3>\n<div matDialogContent>\n <p *ngFor=\"let line of alert.content()\">{{line}}</p>\n</div>\n<p matDialogActions>\n <button mat-raised-button color=\"primary\" (click)=\"done()\">{{alert.ok()}}</button>\n</p>\n",
1381
+ template: "<h3 matDialogTitle *ngIf=\"alert.title\">{{alert.title()}}</h3>\n<div matDialogContent>\n <p *ngFor=\"let line of alert.content()\">{{line}}</p>\n</div>\n<p matDialogActions>\n <button mat-raised-button color=\"primary\" (click)=\"done()\" data-cy=\"close-button\">{{alert.ok()}}</button>\n</p>\n",
1363
1382
  styles: [":host{display:block;padding:var(--angular-ui-powerups-default-padding)}.mat-dialog-actions{justify-content:flex-end}"]
1364
1383
  }] }
1365
1384
  ];
@@ -1381,7 +1400,7 @@
1381
1400
  /**
1382
1401
  * @template D, R, E
1383
1402
  */
1384
- exports.ɵbc = /** @class */ (function (_super) {
1403
+ exports.ɵbd = /** @class */ (function (_super) {
1385
1404
  __extends(ConfirmThenDialogComponent, _super);
1386
1405
  function ConfirmThenDialogComponent(config, interactionContext) {
1387
1406
  var _this = _super.call(this) || this;
@@ -1440,7 +1459,7 @@
1440
1459
  ConfirmThenDialogComponent.decorators = [
1441
1460
  { type: core.Component, args: [{
1442
1461
  selector: 'angular-ui-powerups-confirmation-dialog',
1443
- template: "<h3 matDialogTitle *ngIf=\"confirm.title\">{{confirm.title()}}</h3>\n<div matDialogContent>\n <p *ngFor=\"let line of confirm.content()\">{{line}}</p>\n</div>\n<p matDialogActions>\n <button mat-button (click)=\"cancel()\">{{confirm.cancel()}}</button>\n <button mat-raised-button [color]=\"isDestructive() ? 'warn' : 'primary'\"\n (click)=\"onConfirm()\">{{confirm.ok()}}</button>\n</p>\n\n",
1462
+ template: "<h3 matDialogTitle *ngIf=\"confirm.title\">{{confirm.title()}}</h3>\n<div matDialogContent>\n <p *ngFor=\"let line of confirm.content()\">{{line}}</p>\n</div>\n<p matDialogActions>\n <button mat-button (click)=\"cancel()\" data-cy=\"cancel-button\">{{confirm.cancel()}}</button>\n <button mat-raised-button [color]=\"isDestructive() ? 'warn' : 'primary'\"\n (click)=\"onConfirm()\" data-cy=\"confirm-button\">{{confirm.ok()}}</button>\n</p>\n\n",
1444
1463
  styles: [":host{display:block;padding:var(--angular-ui-powerups-default-padding)}.mat-dialog-actions{justify-content:flex-end}"]
1445
1464
  }] }
1446
1465
  ];
@@ -1453,9 +1472,9 @@
1453
1472
  }(AbstractActivity));
1454
1473
  if (false) {
1455
1474
  /** @type {?} */
1456
- exports.ɵbc.prototype.config;
1475
+ exports.ɵbd.prototype.config;
1457
1476
  /** @type {?} */
1458
- exports.ɵbc.prototype.interactionContext;
1477
+ exports.ɵbd.prototype.interactionContext;
1459
1478
  }
1460
1479
  (function (ConfirmThenDialogComponent) {
1461
1480
  /**
@@ -1472,7 +1491,7 @@
1472
1491
  /** @type {?} */
1473
1492
  Data.prototype.data;
1474
1493
  }
1475
- })(exports.ɵbc || (exports.ɵbc = {}));
1494
+ })(exports.ɵbd || (exports.ɵbd = {}));
1476
1495
 
1477
1496
  /**
1478
1497
  * @fileoverview added by tsickle
@@ -1506,7 +1525,7 @@
1506
1525
  ConfirmationDialogComponent.decorators = [
1507
1526
  { type: core.Component, args: [{
1508
1527
  selector: 'angular-ui-powerups-confirmation-dialog',
1509
- template: "<h3 matDialogTitle *ngIf=\"confirm.title\">{{confirm.title()}}</h3>\n<div matDialogContent>\n <p *ngFor=\"let line of confirm.content()\">{{line}}</p>\n</div>\n<p matDialogActions>\n <button mat-button (click)=\"cancel()\">{{confirm.cancel()}}</button>\n <button mat-raised-button [color]=\"isDestructive() ? 'warn' : 'primary'\"\n (click)=\"done()\">{{confirm.ok()}}</button>\n</p>\n\n",
1528
+ template: "<h3 matDialogTitle *ngIf=\"confirm.title\">{{confirm.title()}}</h3>\n<div matDialogContent>\n <p *ngFor=\"let line of confirm.content()\">{{line}}</p>\n</div>\n<p matDialogActions>\n <button mat-button (click)=\"cancel()\" data-cy=\"cancel-button\">{{confirm.cancel()}}</button>\n <button mat-raised-button [color]=\"isDestructive() ? 'warn' : 'primary'\"\n (click)=\"done()\" data-cy=\"confirm-button\">{{confirm.ok()}}</button>\n</p>\n\n",
1510
1529
  styles: [":host{display:block;padding:var(--angular-ui-powerups-default-padding)}.mat-dialog-actions{justify-content:flex-end}"]
1511
1530
  }] }
1512
1531
  ];
@@ -1824,7 +1843,7 @@
1824
1843
  * @return {?}
1825
1844
  */
1826
1845
  function (confirm, activityType, data) {
1827
- return this.startActivity(exports.ɵbc, {
1846
+ return this.startActivity(exports.ɵbd, {
1828
1847
  confirm: confirm,
1829
1848
  activityType: activityType,
1830
1849
  data: data
@@ -1994,6 +2013,25 @@
1994
2013
  ActivityContainerComponent.prototype._activityList;
1995
2014
  }
1996
2015
 
2016
+ /**
2017
+ * @fileoverview added by tsickle
2018
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2019
+ */
2020
+ var InteractionOutletComponent = /** @class */ (function () {
2021
+ function InteractionOutletComponent() {
2022
+ }
2023
+ InteractionOutletComponent.decorators = [
2024
+ { type: core.Component, args: [{
2025
+ selector: 'angular-ui-powerups-interaction-outlet',
2026
+ template: "<router-outlet name=\"interaction-context\"></router-outlet>\n",
2027
+ styles: [":host{display:block}"]
2028
+ }] }
2029
+ ];
2030
+ /** @nocollapse */
2031
+ InteractionOutletComponent.ctorParameters = function () { return []; };
2032
+ return InteractionOutletComponent;
2033
+ }());
2034
+
1997
2035
  /**
1998
2036
  * @fileoverview added by tsickle
1999
2037
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
@@ -2054,9 +2092,11 @@
2054
2092
  }(pectin.ValueModel));
2055
2093
  var DialogInteractionService = /** @class */ (function (_super) {
2056
2094
  __extends(DialogInteractionService, _super);
2057
- function DialogInteractionService(dialogService, dialogServiceDefaults, matDialogDefaultConfig) {
2095
+ function DialogInteractionService(dialogService, location, router, dialogServiceDefaults, matDialogDefaultConfig) {
2058
2096
  var _this = _super.call(this) || this;
2059
2097
  _this.dialogService = dialogService;
2098
+ _this.location = location;
2099
+ _this.router = router;
2060
2100
  _this.dialogServiceDefaults = dialogServiceDefaults;
2061
2101
  _this.matDialogDefaultConfig = matDialogDefaultConfig;
2062
2102
  _this._activityList = new pectin.DelegatingListModel();
@@ -2138,6 +2178,7 @@
2138
2178
  */
2139
2179
  function () {
2140
2180
  _this.currentActivityId = uuid.v1();
2181
+ // this.location.go(this.router.routerState.snapshot.url, "aup");
2141
2182
  /** @type {?} */
2142
2183
  var self = _this;
2143
2184
  /** @type {?} */
@@ -2167,7 +2208,7 @@
2167
2208
  */
2168
2209
  function (result) {
2169
2210
  resolve(result);
2170
- matDialogRef.close(result);
2211
+ matDialogRef.close(true); // return true to let the after close listener know we've already handled it.
2171
2212
  },
2172
2213
  onCancel: /**
2173
2214
  * @param {?} error
@@ -2175,9 +2216,18 @@
2175
2216
  */
2176
2217
  function (error) {
2177
2218
  reject(error);
2178
- matDialogRef.close(error);
2219
+ matDialogRef.close(true); // return true to let the after close listener know we've already handled it.
2179
2220
  }
2180
2221
  };
2222
+ matDialogRef.afterClosed().subscribe((/**
2223
+ * @param {?} promiseAlreadyFinished
2224
+ * @return {?}
2225
+ */
2226
+ function (promiseAlreadyFinished) {
2227
+ if (!promiseAlreadyFinished) {
2228
+ reject("auto-closed");
2229
+ }
2230
+ }));
2181
2231
  matDialogRef.updateSize();
2182
2232
  })).finally((/**
2183
2233
  * @return {?}
@@ -2218,6 +2268,7 @@
2218
2268
  * @return {?}
2219
2269
  */
2220
2270
  function (alert) {
2271
+ // TODO: Test disableClose === false
2221
2272
  return this._startActivity(AlertDialogComponent, alert, false);
2222
2273
  };
2223
2274
  /**
@@ -2246,7 +2297,7 @@
2246
2297
  * @return {?}
2247
2298
  */
2248
2299
  function (confirm, activityType, data) {
2249
- return this._startActivity(exports.ɵbc, {
2300
+ return this._startActivity(exports.ɵbd, {
2250
2301
  confirm: confirm,
2251
2302
  activityType: activityType,
2252
2303
  data: data
@@ -2260,10 +2311,12 @@
2260
2311
  /** @nocollapse */
2261
2312
  DialogInteractionService.ctorParameters = function () { return [
2262
2313
  { type: material.MatDialog },
2314
+ { type: common.Location },
2315
+ { type: router.Router },
2263
2316
  { type: dialog.MatDialogConfig, decorators: [{ type: core.Optional }, { type: core.Inject, args: [DIALOG_INTERACTION_SERVICE_DEFAULTS,] }] },
2264
2317
  { type: dialog.MatDialogConfig, decorators: [{ type: core.Optional }, { type: core.Inject, args: [dialog.MAT_DIALOG_DEFAULT_OPTIONS,] }] }
2265
2318
  ]; };
2266
- /** @nocollapse */ DialogInteractionService.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function DialogInteractionService_Factory() { return new DialogInteractionService(core.ɵɵinject(dialog.MatDialog), core.ɵɵinject(DIALOG_INTERACTION_SERVICE_DEFAULTS, 8), core.ɵɵinject(dialog.MAT_DIALOG_DEFAULT_OPTIONS, 8)); }, token: DialogInteractionService, providedIn: "root" });
2319
+ /** @nocollapse */ DialogInteractionService.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function DialogInteractionService_Factory() { return new DialogInteractionService(core.ɵɵinject(dialog.MatDialog), core.ɵɵinject(common.Location), core.ɵɵinject(router.Router), core.ɵɵinject(DIALOG_INTERACTION_SERVICE_DEFAULTS, 8), core.ɵɵinject(dialog.MAT_DIALOG_DEFAULT_OPTIONS, 8)); }, token: DialogInteractionService, providedIn: "root" });
2267
2320
  return DialogInteractionService;
2268
2321
  }(InteractionContext));
2269
2322
  if (false) {
@@ -2288,6 +2341,10 @@
2288
2341
  */
2289
2342
  DialogInteractionService.prototype.dialogService;
2290
2343
  /** @type {?} */
2344
+ DialogInteractionService.prototype.location;
2345
+ /** @type {?} */
2346
+ DialogInteractionService.prototype.router;
2347
+ /** @type {?} */
2291
2348
  DialogInteractionService.prototype.dialogServiceDefaults;
2292
2349
  /** @type {?} */
2293
2350
  DialogInteractionService.prototype.matDialogDefaultConfig;
@@ -2307,23 +2364,26 @@
2307
2364
  material.MatButtonModule,
2308
2365
  material.MatDialogModule,
2309
2366
  material.MatTabsModule,
2310
- portal.PortalModule
2367
+ portal.PortalModule,
2368
+ router.RouterModule
2311
2369
  ],
2312
2370
  declarations: [
2313
2371
  ActivityContainerComponent,
2314
2372
  ConfirmationDialogComponent,
2315
- exports.ɵbc,
2373
+ exports.ɵbd,
2316
2374
  AlertDialogComponent,
2317
- ActivityOutletComponent
2375
+ ActivityOutletComponent,
2376
+ InteractionOutletComponent
2318
2377
  ],
2319
2378
  exports: [
2320
2379
  ActivityContainerComponent,
2321
2380
  ActivityOutletComponent,
2381
+ InteractionOutletComponent
2322
2382
  ],
2323
2383
  entryComponents: [
2324
2384
  ActivityContainerComponent,
2325
2385
  ConfirmationDialogComponent,
2326
- exports.ɵbc,
2386
+ exports.ɵbd,
2327
2387
  AlertDialogComponent
2328
2388
  ],
2329
2389
  providers: [
@@ -2410,859 +2470,1020 @@
2410
2470
  * @fileoverview added by tsickle
2411
2471
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2412
2472
  */
2413
- var PlaceDefinition = /** @class */ (function () {
2414
- function PlaceDefinition(component, path, authenticate, order, data, routeParameters, children) {
2415
- this.component = component;
2416
- this.path = path;
2417
- this.authenticate = authenticate;
2418
- this.order = order;
2419
- this.data = data;
2420
- this.routeParameters = routeParameters;
2421
- this.children = children;
2422
- }
2423
- /**
2424
- * @return {?}
2425
- */
2426
- PlaceDefinition.prototype.getRouteParameters = /**
2427
- * @return {?}
2428
- */
2429
- function () {
2430
- return this.routeParameters;
2431
- };
2432
- /**
2433
- * @template T
2434
- * @param {?} key
2435
- * @param {?=} defaultValue
2436
- * @return {?}
2437
- */
2438
- PlaceDefinition.prototype.getData = /**
2439
- * @template T
2440
- * @param {?} key
2441
- * @param {?=} defaultValue
2442
- * @return {?}
2443
- */
2444
- function (key, defaultValue) {
2445
- return this.data ?
2446
- ___default__default.isNil(this.data[key]) ? defaultValue : this.data[key] :
2447
- defaultValue;
2448
- };
2449
- /**
2450
- * @template T
2451
- * @param {?} keys
2452
- * @param {?=} defaultValue
2453
- * @return {?}
2454
- */
2455
- PlaceDefinition.prototype.searchData = /**
2456
- * @template T
2457
- * @param {?} keys
2458
- * @param {?=} defaultValue
2459
- * @return {?}
2460
- */
2461
- function (keys, defaultValue) {
2462
- var _this = this;
2463
- if (this.data) {
2464
- /** @type {?} */
2465
- var found = keys.find((/**
2466
- * @param {?} key
2467
- * @return {?}
2468
- */
2469
- function (key) { return !___default__default.isNil(_this.data[key]); }));
2470
- return found ? this.data[found] : defaultValue;
2471
- }
2472
- else {
2473
- return defaultValue;
2474
- }
2475
- };
2476
- return PlaceDefinition;
2477
- }());
2478
- if (false) {
2479
- /** @type {?} */
2480
- PlaceDefinition.prototype.component;
2481
- /** @type {?} */
2482
- PlaceDefinition.prototype.path;
2483
- /** @type {?} */
2484
- PlaceDefinition.prototype.authenticate;
2485
- /** @type {?} */
2486
- PlaceDefinition.prototype.order;
2487
- /** @type {?} */
2488
- PlaceDefinition.prototype.data;
2489
- /** @type {?} */
2490
- PlaceDefinition.prototype.routeParameters;
2491
- /** @type {?} */
2492
- PlaceDefinition.prototype.children;
2493
- }
2494
-
2495
2473
  /**
2496
- * @fileoverview added by tsickle
2497
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2474
+ * @abstract
2475
+ * @template T, E
2498
2476
  */
2499
- // RAKE: making this Symbol(...) broke things.
2500
- /** @type {?} */
2501
- var DEFINITION_META_DATA_KEY = 'PLACE_DEFINITION_OPTIONS';
2502
- // this one seems ok.
2503
- /** @type {?} */
2504
- var ROUTE_PARAMETER_LIST_KEY = Symbol('place:route:parameters');
2505
- exports.PlaceComponent = /** @class */ (function (_super) {
2506
- __extends(PlaceComponent, _super);
2507
- function PlaceComponent() {
2508
- return _super.call(this) || this;
2477
+ /**
2478
+ * @abstract
2479
+ * @template T, E
2480
+ */
2481
+ exports.ParameterDefinition = /** @class */ (function () {
2482
+ function ParameterDefinition(propertyName, options, urlFormat) {
2483
+ this.propertyName = propertyName;
2484
+ this.urlFormat = urlFormat;
2485
+ this.options = typescriptUtilities.Opts.get(options);
2486
+ this.remember = this.options.getOptional('remember', false);
2487
+ this.defaultValue = this.options.getOptional('defaultValue', null);
2509
2488
  }
2510
- /**
2511
- * @param {?} resolvedParameters
2512
- * @return {?}
2513
- */
2514
- PlaceComponent.prototype.initialiseBindings = /**
2515
- * @param {?} resolvedParameters
2516
- * @return {?}
2517
- */
2518
- function (resolvedParameters) {
2519
- var _this = this;
2520
- pectin.assert.isNil(this.resolvedParameters);
2521
- this.resolvedParameters = resolvedParameters;
2522
- this.placeDefinition.getRouteParameters().forEach((/**
2523
- * @param {?} parameterDef
2524
- * @return {?}
2525
- */
2526
- function (parameterDef) {
2527
- _this.installBinding(parameterDef);
2528
- }));
2529
- };
2530
- /**
2531
- * @private
2532
- * @template T, S
2533
- * @param {?} parameterDef
2534
- * @return {?}
2535
- */
2536
- PlaceComponent.prototype.installBinding = /**
2537
- * @private
2538
- * @template T, S
2539
- * @param {?} parameterDef
2540
- * @return {?}
2541
- */
2542
- function (parameterDef) {
2543
- /** @type {?} */
2544
- var model = (/** @type {?} */ (this[parameterDef.propertyName]));
2545
- // this.txo.observe(parameterDef.propertyName, model);
2546
- this.registerDisposable(new pectin.Binding(this.resolvedParameters, model, {
2547
- toRight: /**
2548
- * @param {?} parameters
2549
- * @return {?}
2550
- */
2551
- function (parameters) {
2552
- return parameters.getValueOf(parameterDef);
2553
- },
2554
- toLeft: /**
2555
- * @param {?} value
2556
- * @param {?=} currentParameters
2557
- * @return {?}
2558
- */
2559
- function (value, currentParameters) {
2560
- return currentParameters.replace(parameterDef, value);
2561
- }
2562
- }));
2563
- };
2564
- Object.defineProperty(PlaceComponent.prototype, "placeDefinition", {
2489
+ Object.defineProperty(ParameterDefinition.prototype, "name", {
2565
2490
  get: /**
2566
2491
  * @return {?}
2567
2492
  */
2568
2493
  function () {
2569
- return PlaceComponent.getDefinition((/** @type {?} */ ((/** @type {?} */ (this.constructor)))));
2494
+ return this.options.getOptional('as', this.propertyName);
2570
2495
  },
2571
2496
  enumerable: true,
2572
2497
  configurable: true
2573
2498
  });
2574
- Object.defineProperty(PlaceComponent.prototype, "childPlaces", {
2575
- get: /**
2499
+ Object.defineProperty(ParameterDefinition.prototype, "isRouteParameter", {
2500
+ // @Trace()
2501
+ get:
2502
+ // @Trace()
2503
+ /**
2576
2504
  * @return {?}
2577
2505
  */
2578
2506
  function () {
2579
- return this.placeDefinition.children.map((/**
2580
- * @param {?} d
2581
- * @return {?}
2582
- */
2583
- function (d) { return d.component; }));
2507
+ return !!this.urlFormat;
2584
2508
  },
2585
2509
  enumerable: true,
2586
2510
  configurable: true
2587
2511
  });
2588
2512
  /**
2513
+ * @protected
2514
+ * @template K
2515
+ * @param {?} key
2589
2516
  * @return {?}
2590
2517
  */
2591
- PlaceComponent.prototype.canDeactivate = /**
2518
+ ParameterDefinition.prototype.getOptionValue = /**
2519
+ * @protected
2520
+ * @template K
2521
+ * @param {?} key
2592
2522
  * @return {?}
2593
2523
  */
2594
- function () {
2595
- return true;
2524
+ function (key) {
2525
+ return this.options.getOptional(key, null);
2596
2526
  };
2527
+ // @Trace()
2528
+ // @Trace()
2597
2529
  /**
2530
+ * @param {?} value
2531
+ * @param {?} visit
2532
+ * @param {?} placeHistory
2533
+ * @param {?} injector
2598
2534
  * @return {?}
2599
2535
  */
2600
- PlaceComponent.prototype.onPlaceReady = /**
2536
+ ParameterDefinition.prototype.sanitise =
2537
+ // @Trace()
2538
+ /**
2539
+ * @param {?} value
2540
+ * @param {?} visit
2541
+ * @param {?} placeHistory
2542
+ * @param {?} injector
2601
2543
  * @return {?}
2602
2544
  */
2603
- function () {
2545
+ function (value, visit, placeHistory, injector) {
2546
+ return __awaiter(this, void 0, void 0, function () {
2547
+ var previousVisit;
2548
+ return __generator(this, function (_a) {
2549
+ if (this.isMissingFrom(visit)) {
2550
+ previousVisit = ___default__default.first(placeHistory.getHistory(visit.placeDefinition));
2551
+ if (this.remember && previousVisit) {
2552
+ value = previousVisit.getParameter(this.name);
2553
+ }
2554
+ return [2 /*return*/, this.isEmptyValue(value) ? this.defaultValue : value];
2555
+ }
2556
+ else {
2557
+ // todo: add custom sanitiser
2558
+ return [2 /*return*/, value];
2559
+ }
2560
+ return [2 /*return*/];
2561
+ });
2562
+ });
2604
2563
  };
2605
- __decorate([
2606
- fastMemoizeDecorator.Memoize(),
2607
- __metadata("design:type", PlaceDefinition),
2608
- __metadata("design:paramtypes", [])
2609
- ], PlaceComponent.prototype, "placeDefinition", null);
2610
- return PlaceComponent;
2611
- }(DisposableComponent));
2612
- if (false) {
2613
2564
  /**
2614
- * @type {?}
2615
2565
  * @private
2566
+ * @param {?} visit
2567
+ * @return {?}
2616
2568
  */
2617
- exports.PlaceComponent.prototype.resolvedParameters;
2618
- }
2619
- (function (PlaceComponent) {
2620
- /**
2621
- * @param {?} target
2569
+ ParameterDefinition.prototype.isMissingFrom = /**
2570
+ * @private
2571
+ * @param {?} visit
2622
2572
  * @return {?}
2623
2573
  */
2624
- function isPlaceComponentConstructor(target) {
2625
- return pectin.lang.constructorChain((/** @type {?} */ (target))).includes(PlaceComponent);
2626
- }
2627
- PlaceComponent.isPlaceComponentConstructor = isPlaceComponentConstructor;
2574
+ function (visit) {
2575
+ return !visit.hasParameter(this.name) || (this.isRouteId && !visit.hasRouteId());
2576
+ };
2577
+ return ParameterDefinition;
2578
+ }());
2579
+ if (false) {
2580
+ /** @type {?} */
2581
+ exports.ParameterDefinition.prototype.isRouteId;
2582
+ /** @type {?} */
2583
+ exports.ParameterDefinition.prototype.isArray;
2584
+ /** @type {?} */
2585
+ exports.ParameterDefinition.prototype.remember;
2586
+ /** @type {?} */
2587
+ exports.ParameterDefinition.prototype.defaultValue;
2628
2588
  /**
2629
- * @param {?} klass
2630
- * @return {?}
2589
+ * @type {?}
2590
+ * @private
2631
2591
  */
2632
- function getRouteParameters(klass) {
2633
- return typescriptUtilities.Klass.get(klass).getMetadataList(ROUTE_PARAMETER_LIST_KEY);
2634
- }
2635
- PlaceComponent.getRouteParameters = getRouteParameters;
2592
+ exports.ParameterDefinition.prototype.options;
2593
+ /** @type {?} */
2594
+ exports.ParameterDefinition.prototype.propertyName;
2595
+ /** @type {?} */
2596
+ exports.ParameterDefinition.prototype.urlFormat;
2636
2597
  /**
2637
- * @param {?} klass
2598
+ * @abstract
2599
+ * @param {?} value
2638
2600
  * @return {?}
2639
2601
  */
2640
- function getDefinition(klass) {
2641
- return Reflect.getMetadata(DEFINITION_META_DATA_KEY, klass);
2642
- }
2643
- PlaceComponent.getDefinition = getDefinition;
2602
+ exports.ParameterDefinition.prototype.isEmptyValue = function (value) { };
2644
2603
  /**
2645
- * @param {?} klass
2646
- * @param {?} definition
2604
+ * @abstract
2605
+ * @param {?} a
2606
+ * @param {?} b
2647
2607
  * @return {?}
2648
2608
  */
2649
- function injectDefinition(klass, definition) {
2650
- Reflect.defineMetadata(DEFINITION_META_DATA_KEY, definition, klass);
2651
- }
2652
- PlaceComponent.injectDefinition = injectDefinition;
2653
- })(exports.PlaceComponent || (exports.PlaceComponent = {}));
2654
-
2655
- /**
2656
- * @fileoverview added by tsickle
2657
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2658
- */
2659
- var AbstractPlaceNavigationComponent = /** @class */ (function (_super) {
2660
- __extends(AbstractPlaceNavigationComponent, _super);
2661
- function AbstractPlaceNavigationComponent() {
2662
- var _this = _super.call(this) || this;
2663
- 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;
2664
- _this.placeDefinitions = chain(_this.placesModel).map((/**
2665
- * @param {?} c
2609
+ exports.ParameterDefinition.prototype.hasChanged = function (a, b) { };
2610
+ }
2611
+ (function (ParameterDefinition) {
2612
+ /**
2613
+ * @record
2614
+ * @template T
2615
+ */
2616
+ function Options() { }
2617
+ ParameterDefinition.Options = Options;
2618
+ if (false) {
2619
+ /** @type {?|undefined} */
2620
+ Options.prototype.as;
2621
+ /** @type {?|undefined} */
2622
+ Options.prototype.optional;
2623
+ /** @type {?|undefined} */
2624
+ Options.prototype.remember;
2625
+ /** @type {?|undefined} */
2626
+ Options.prototype.defaultValue;
2627
+ }
2628
+ /**
2629
+ * @template T
2630
+ */
2631
+ var /**
2632
+ * @template T
2633
+ */
2634
+ RouteId = /** @class */ (function (_super) {
2635
+ __extends(RouteId, _super);
2636
+ function RouteId() {
2637
+ var _this = _super !== null && _super.apply(this, arguments) || this;
2638
+ _this.isRouteId = true;
2639
+ _this.isArray = false;
2640
+ return _this;
2641
+ }
2642
+ /**
2643
+ * @param {?} value
2666
2644
  * @return {?}
2667
2645
  */
2668
- function (c) { return exports.PlaceComponent.getDefinition(c); }));
2669
- return _this;
2646
+ RouteId.prototype.isEmptyValue = /**
2647
+ * @param {?} value
2648
+ * @return {?}
2649
+ */
2650
+ function (value) {
2651
+ return ___default__default.isNil(value);
2652
+ };
2653
+ /**
2654
+ * @param {?} a
2655
+ * @param {?} b
2656
+ * @return {?}
2657
+ */
2658
+ RouteId.prototype.hasChanged = /**
2659
+ * @param {?} a
2660
+ * @param {?} b
2661
+ * @return {?}
2662
+ */
2663
+ function (a, b) {
2664
+ return a !== b;
2665
+ };
2666
+ return RouteId;
2667
+ }(ParameterDefinition));
2668
+ ParameterDefinition.RouteId = RouteId;
2669
+ if (false) {
2670
+ /** @type {?} */
2671
+ RouteId.prototype.isRouteId;
2672
+ /** @type {?} */
2673
+ RouteId.prototype.isArray;
2670
2674
  }
2671
2675
  /**
2672
- * @param {?} placeDef
2673
- * @return {?}
2676
+ * @template T
2674
2677
  */
2675
- AbstractPlaceNavigationComponent.prototype.getNav = /**
2676
- * @param {?} placeDef
2677
- * @return {?}
2678
+ var /**
2679
+ * @template T
2678
2680
  */
2679
- function (placeDef) {
2680
- /** @type {?} */
2681
- var navItem = (/** @type {?} */ (placeDef.getData('nav')));
2682
- return {
2683
- title: (/**
2684
- * @return {?}
2685
- */
2686
- function () { return navItem ? navItem.title() : placeDef.searchData(['navTitle', 'title']); }),
2687
- tooltip: (/**
2688
- * @return {?}
2689
- */
2690
- function () { return navItem && navItem.tooltip ? navItem.tooltip() : placeDef.getData('navTooltip', null); }),
2691
- icon: (/**
2692
- * @return {?}
2693
- */
2694
- function () { return navItem && navItem.icon ? navItem.icon() : placeDef.getData('navIcon', null); })
2681
+ ValueParameter = /** @class */ (function (_super) {
2682
+ __extends(ValueParameter, _super);
2683
+ function ValueParameter() {
2684
+ var _this = _super !== null && _super.apply(this, arguments) || this;
2685
+ _this.isRouteId = false;
2686
+ _this.isArray = false;
2687
+ return _this;
2688
+ }
2689
+ /**
2690
+ * @param {?} value
2691
+ * @return {?}
2692
+ */
2693
+ ValueParameter.prototype.isEmptyValue = /**
2694
+ * @param {?} value
2695
+ * @return {?}
2696
+ */
2697
+ function (value) {
2698
+ return ___default__default.isNil(value);
2695
2699
  };
2696
- };
2700
+ /**
2701
+ * @param {?} a
2702
+ * @param {?} b
2703
+ * @return {?}
2704
+ */
2705
+ ValueParameter.prototype.hasChanged = /**
2706
+ * @param {?} a
2707
+ * @param {?} b
2708
+ * @return {?}
2709
+ */
2710
+ function (a, b) {
2711
+ return a !== b;
2712
+ };
2713
+ return ValueParameter;
2714
+ }(ParameterDefinition));
2715
+ ParameterDefinition.ValueParameter = ValueParameter;
2716
+ if (false) {
2717
+ /** @type {?} */
2718
+ ValueParameter.prototype.isRouteId;
2719
+ /** @type {?} */
2720
+ ValueParameter.prototype.isArray;
2721
+ }
2697
2722
  /**
2698
- * @return {?}
2723
+ * @template T
2699
2724
  */
2700
- AbstractPlaceNavigationComponent.prototype.ngOnInit = /**
2701
- * @return {?}
2725
+ var /**
2726
+ * @template T
2702
2727
  */
2703
- function () {
2704
- };
2705
- AbstractPlaceNavigationComponent.propDecorators = {
2706
- places: [{ type: core.Input }],
2707
- placesModel: [{ type: core.Input }]
2708
- };
2709
- __decorate([
2710
- pectin.StoreInListModel('placesModel'),
2711
- __metadata("design:type", Array)
2712
- ], AbstractPlaceNavigationComponent.prototype, "places", void 0);
2713
- __decorate([
2714
- pectin.UseDelegate(),
2715
- __metadata("design:type", pectin.ListModel)
2716
- ], AbstractPlaceNavigationComponent.prototype, "placesModel", void 0);
2717
- __decorate([
2718
- src.Memoize(),
2719
- __metadata("design:type", Function),
2720
- __metadata("design:paramtypes", [PlaceDefinition]),
2721
- __metadata("design:returntype", Object)
2722
- ], AbstractPlaceNavigationComponent.prototype, "getNav", null);
2723
- return AbstractPlaceNavigationComponent;
2724
- }(DisposableComponent));
2725
- if (false) {
2726
- /** @type {?} */
2727
- AbstractPlaceNavigationComponent.prototype.places;
2728
- /** @type {?} */
2729
- AbstractPlaceNavigationComponent.prototype.placesModel;
2730
- /** @type {?} */
2731
- AbstractPlaceNavigationComponent.prototype.placeDefinitions;
2732
- }
2728
+ ArrayParameter = /** @class */ (function (_super) {
2729
+ __extends(ArrayParameter, _super);
2730
+ function ArrayParameter(parameterName, options, urlFormat) {
2731
+ var _this = _super.call(this, parameterName, options, urlFormat) || this;
2732
+ _this.isRouteId = false;
2733
+ _this.isArray = true;
2734
+ return _this;
2735
+ }
2736
+ /**
2737
+ * @param {?} value
2738
+ * @return {?}
2739
+ */
2740
+ ArrayParameter.prototype.isEmptyValue = /**
2741
+ * @param {?} value
2742
+ * @return {?}
2743
+ */
2744
+ function (value) {
2745
+ return ___default__default.isNil(value) || value.length < 1;
2746
+ };
2747
+ /**
2748
+ * @param {?} a
2749
+ * @param {?} b
2750
+ * @return {?}
2751
+ */
2752
+ ArrayParameter.prototype.hasChanged = /**
2753
+ * @param {?} a
2754
+ * @param {?} b
2755
+ * @return {?}
2756
+ */
2757
+ function (a, b) {
2758
+ return !___default__default.isEqual(a, b);
2759
+ };
2760
+ return ArrayParameter;
2761
+ }(ParameterDefinition));
2762
+ ParameterDefinition.ArrayParameter = ArrayParameter;
2763
+ if (false) {
2764
+ /** @type {?} */
2765
+ ArrayParameter.prototype.isRouteId;
2766
+ /** @type {?} */
2767
+ ArrayParameter.prototype.isArray;
2768
+ }
2769
+ })(exports.ParameterDefinition || (exports.ParameterDefinition = {}));
2733
2770
 
2734
2771
  /**
2735
2772
  * @fileoverview added by tsickle
2736
2773
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2737
2774
  */
2738
- var ListPlaceNavComponent = /** @class */ (function (_super) {
2739
- __extends(ListPlaceNavComponent, _super);
2740
- function ListPlaceNavComponent() {
2741
- var _this = _super.call(this) || this;
2742
- _this.expanded = true;
2743
- return _this;
2775
+ exports.PlaceDefinition = /** @class */ (function () {
2776
+ function PlaceDefinition(component, path, authenticate, order, data, routeParameters, children) {
2777
+ this.component = component;
2778
+ this.path = path;
2779
+ this.authenticate = authenticate;
2780
+ this.order = order;
2781
+ this.data = data;
2782
+ this.routeParameters = routeParameters;
2783
+ this.children = children;
2744
2784
  }
2745
2785
  /**
2746
2786
  * @return {?}
2747
2787
  */
2748
- ListPlaceNavComponent.prototype.expandMenu = /**
2788
+ PlaceDefinition.prototype.hasRouteId = /**
2749
2789
  * @return {?}
2750
2790
  */
2751
2791
  function () {
2752
- this.expanded = true;
2792
+ return !!this.getRouteIdParameterDef();
2753
2793
  };
2754
2794
  /**
2755
2795
  * @return {?}
2756
2796
  */
2757
- ListPlaceNavComponent.prototype.collapseMenu = /**
2797
+ PlaceDefinition.prototype.getRouteIdParameterDef = /**
2758
2798
  * @return {?}
2759
2799
  */
2760
2800
  function () {
2761
- this.expanded = false;
2801
+ return this.routeParameters.find((/**
2802
+ * @param {?} p
2803
+ * @return {?}
2804
+ */
2805
+ function (p) { return p.isRouteId; }));
2762
2806
  };
2763
2807
  /**
2808
+ * @param {?=} includeRouteId
2764
2809
  * @return {?}
2765
2810
  */
2766
- ListPlaceNavComponent.prototype.toggleMenu = /**
2811
+ PlaceDefinition.prototype.getRouteParameterDefs = /**
2812
+ * @param {?=} includeRouteId
2767
2813
  * @return {?}
2768
2814
  */
2769
- function () {
2770
- this.expanded = !this.expanded;
2771
- };
2772
- ListPlaceNavComponent.decorators = [
2773
- { type: core.Component, args: [{
2774
- selector: 'angular-ui-powerups-list-place-nav',
2775
- template: "<mat-nav-list class=\"app-menu\">\n <a mat-list-item *ngFor=\"let place of placeDefinitions.value\"\n [routerLink]='place.path'\n routerLinkActive #rla=\"routerLinkActive\"\n [matTooltip]=\"getNav(place).tooltip()\">\n <mat-icon *ngIf=\"getNav(place).icon()\">{{getNav(place).icon()}}</mat-icon>\n <span class=\"expanded-only\">{{getNav(place).title()}}</span>\n </a>\n</mat-nav-list>\n",
2776
- styles: [":host{display:flex;flex-direction:column;--expanded-width:235px;--nav-item-width:var(--nav-bar-height);width:var(--nav-item-width);transition:width 125ms linear}:host.expanded{width:var(--expanded-width);max-width:var(--expanded-width)}.expanded-only{max-width:0;overflow:hidden}.collapsed-only{max-width:100%;overflow:hidden}.header{display:flex;flex-direction:row;justify-content:flex-end;align-items:center;height:var(--nav-bar-height);border-bottom:var(--pinstripe-border);cursor:pointer}.header .menu{flex:1}.header button{color:inherit;width:var(--nav-item-width);height:var(--nav-bar-height)}mat-nav-list{flex:1;display:flex;flex-direction:column}.mat-list-item{width:var(--nav-item-width);height:var(--nav-bar-height);color:inherit}mat-icon{color:inherit}mat-icon.flip-horizontal{transform:scaleX(-1)}:host-context(.expanded) .expanded-only{max-width:100%}:host-context(.expanded) .collapsed-only{max-width:0}:host-context(.expanded) .mat-list-item mat-icon{margin-right:12px}:host-context(.expanded) .mat-list-item span{text-wrap:none;white-space:nowrap}a[ng-reflect-router-link=manage-instruments] mat-icon{transform:rotate(90deg)}.app-menu{padding-top:0}"]
2777
- }] }
2778
- ];
2779
- /** @nocollapse */
2780
- ListPlaceNavComponent.ctorParameters = function () { return []; };
2781
- ListPlaceNavComponent.propDecorators = {
2782
- expanded: [{ type: core.HostBinding, args: ['class.expanded',] }]
2815
+ function (includeRouteId) {
2816
+ if (includeRouteId === void 0) { includeRouteId = false; }
2817
+ return this.getVisitParameterDefs({ includeRouteId: includeRouteId, includeRouteParameters: true });
2783
2818
  };
2784
- return ListPlaceNavComponent;
2785
- }(AbstractPlaceNavigationComponent));
2786
- if (false) {
2787
- /** @type {?} */
2788
- ListPlaceNavComponent.prototype.expanded;
2789
- }
2790
-
2791
- /**
2792
- * @fileoverview added by tsickle
2793
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2794
- */
2795
- var PlaceHistory = /** @class */ (function () {
2796
- function PlaceHistory(router) {
2797
- this.router = router;
2798
- this._history = new Map();
2799
- }
2800
2819
  /**
2801
- * @param {?} state
2820
+ * @param {?=} include
2802
2821
  * @return {?}
2803
2822
  */
2804
- PlaceHistory.prototype.add = /**
2805
- * @param {?} state
2823
+ PlaceDefinition.prototype.getVisitParameterDefs = /**
2824
+ * @param {?=} include
2806
2825
  * @return {?}
2807
2826
  */
2808
- function (state) {
2827
+ function (include) {
2809
2828
  /** @type {?} */
2810
- var history = this.getHistory(state.placeDefinition);
2829
+ var opts = typescriptUtilities.Opts.get(include);
2830
+ // includes
2811
2831
  /** @type {?} */
2812
- var previousState = ___default__default.last(history);
2813
- if (!previousState || state.hasChanged(previousState)) {
2814
- history.unshift(state); // LIFO
2815
- this.setHistory(state.placeDefinition, history.slice(0, 3)); // limit our history to 4 visits
2816
- }
2832
+ var includeRouteId = !include || opts.getOptional('includeRouteId', false);
2833
+ /** @type {?} */
2834
+ var includeRouteParameters = !include || opts.getOptional('includeRouteParameters', false);
2835
+ /** @type {?} */
2836
+ var includeNonRouteParameters = !include || opts.getOptional('includeNonRouteParameters', false);
2837
+ return this.routeParameters.filter((/**
2838
+ * @param {?} p
2839
+ * @return {?}
2840
+ */
2841
+ function (p) {
2842
+ return (includeRouteId && p.isRouteId)
2843
+ || (includeRouteParameters && p.isRouteParameter && !p.isRouteId) // route id is included in the line above
2844
+ || (includeNonRouteParameters && !p.isRouteParameter);
2845
+ }));
2817
2846
  };
2818
2847
  /**
2819
- * @param {?} placeDef
2848
+ * @template T
2849
+ * @param {?} key
2850
+ * @param {?=} defaultValue
2820
2851
  * @return {?}
2821
2852
  */
2822
- PlaceHistory.prototype.getHistory = /**
2823
- * @param {?} placeDef
2853
+ PlaceDefinition.prototype.getPlaceData = /**
2854
+ * @template T
2855
+ * @param {?} key
2856
+ * @param {?=} defaultValue
2824
2857
  * @return {?}
2825
2858
  */
2826
- function (placeDef) {
2827
- /** @type {?} */
2828
- var history = this._history.get(placeDef);
2829
- if (!history) {
2830
- history = [];
2831
- this.setHistory(placeDef, history);
2832
- }
2833
- return history;
2859
+ function (key, defaultValue) {
2860
+ return this.data ?
2861
+ ___default__default.isNil(this.data[key]) ? defaultValue : this.data[key] :
2862
+ defaultValue;
2834
2863
  };
2835
2864
  /**
2836
- * @private
2837
- * @param {?} placeDef
2838
- * @param {?} history
2865
+ * @template T
2866
+ * @param {?} keys
2867
+ * @param {?=} defaultValue
2839
2868
  * @return {?}
2840
2869
  */
2841
- PlaceHistory.prototype.setHistory = /**
2842
- * @private
2843
- * @param {?} placeDef
2844
- * @param {?} history
2870
+ PlaceDefinition.prototype.searchPlaceData = /**
2871
+ * @template T
2872
+ * @param {?} keys
2873
+ * @param {?=} defaultValue
2845
2874
  * @return {?}
2846
2875
  */
2847
- function (placeDef, history) {
2848
- this._history.set(placeDef, history);
2876
+ function (keys, defaultValue) {
2877
+ var _this = this;
2878
+ if (this.data) {
2879
+ /** @type {?} */
2880
+ var found = keys.find((/**
2881
+ * @param {?} key
2882
+ * @return {?}
2883
+ */
2884
+ function (key) { return !___default__default.isNil(_this.data[key]); }));
2885
+ return found ? this.data[found] : defaultValue;
2886
+ }
2887
+ else {
2888
+ return defaultValue;
2889
+ }
2849
2890
  };
2850
- PlaceHistory.decorators = [
2851
- { type: core.Injectable, args: [{
2852
- providedIn: 'root'
2853
- },] }
2854
- ];
2855
- /** @nocollapse */
2856
- PlaceHistory.ctorParameters = function () { return [
2857
- { type: router.Router }
2858
- ]; };
2859
- /** @nocollapse */ PlaceHistory.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function PlaceHistory_Factory() { return new PlaceHistory(core.ɵɵinject(router.Router)); }, token: PlaceHistory, providedIn: "root" });
2860
- return PlaceHistory;
2861
- }());
2862
- if (false) {
2863
2891
  /**
2864
- * @type {?}
2865
- * @private
2892
+ * @param {?} visit
2893
+ * @return {?}
2866
2894
  */
2867
- PlaceHistory.prototype._history;
2895
+ PlaceDefinition.prototype.getRouteIdFrom = /**
2896
+ * @param {?} visit
2897
+ * @return {?}
2898
+ */
2899
+ function (visit) {
2900
+ /** @type {?} */
2901
+ var routeIdParameterDef = this.getRouteIdParameterDef();
2902
+ return routeIdParameterDef ? visit.getParameter(routeIdParameterDef.name) : null;
2903
+ };
2868
2904
  /**
2869
- * @type {?}
2870
- * @private
2905
+ * Returns angular router commands that specify the route id and any route parameters. The result does
2906
+ * not include any path information.
2871
2907
  */
2872
- PlaceHistory.prototype.router;
2873
- }
2874
-
2875
- /**
2876
- * @fileoverview added by tsickle
2877
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2878
- */
2879
- var NavigationSession = /** @class */ (function () {
2880
- function NavigationSession(isPopState, initialUrl) {
2881
- this.isPopState = isPopState;
2882
- this.initialUrl = initialUrl;
2883
- this._alreadyAccepted = [];
2884
- console.log('NavigationSession', { isPopState: isPopState, initialUrl: initialUrl });
2885
- }
2908
+ // getFormattedRouterCommands(visit: Visit): any[] {
2909
+ // return this.hasRouteId() ?
2910
+ // [this.getFormattedRouteId(visit), this.getFormattedRouteParameters(visit)] :
2911
+ // [this.getFormattedRouteParameters(visit)];
2912
+ // }
2886
2913
  /**
2887
- * @param {?} placeComponent
2914
+ * Returns angular router commands that specify the route id and any route parameters. The result does
2915
+ * not include any path information.
2916
+ * @param {?} visit
2888
2917
  * @return {?}
2889
2918
  */
2890
- NavigationSession.prototype.alreadyAccepted = /**
2891
- * @param {?} placeComponent
2919
+ // getFormattedRouterCommands(visit: Visit): any[] {
2920
+ // return this.hasRouteId() ?
2921
+ // [this.getFormattedRouteId(visit), this.getFormattedRouteParameters(visit)] :
2922
+ // [this.getFormattedRouteParameters(visit)];
2923
+ // }
2924
+ PlaceDefinition.prototype.getFormattedRouteId = /**
2925
+ * Returns angular router commands that specify the route id and any route parameters. The result does
2926
+ * not include any path information.
2927
+ * @param {?} visit
2892
2928
  * @return {?}
2893
2929
  */
2894
- function (placeComponent) {
2895
- return this._alreadyAccepted.includes(placeComponent);
2930
+ // getFormattedRouterCommands(visit: Visit): any[] {
2931
+ // return this.hasRouteId() ?
2932
+ // [this.getFormattedRouteId(visit), this.getFormattedRouteParameters(visit)] :
2933
+ // [this.getFormattedRouteParameters(visit)];
2934
+ // }
2935
+ function (visit) {
2936
+ return visit.hasRouteId() ? this.getRouteIdParameterDef().urlFormat.format(visit.getRouteId()) : null;
2896
2937
  };
2938
+ // @Trace()
2939
+ // @Trace()
2897
2940
  /**
2898
- * @param {?} component
2899
- * @return {?}
2900
- */
2901
- NavigationSession.prototype.rememberAcceptanceOf = /**
2902
- * @param {?} component
2941
+ * @param {?} visit
2942
+ * @param {?=} includeRouteId
2903
2943
  * @return {?}
2904
2944
  */
2905
- function (component) {
2906
- this._alreadyAccepted.push(component);
2907
- };
2908
- return NavigationSession;
2909
- }());
2910
- if (false) {
2945
+ PlaceDefinition.prototype.getFormattedRouteParameters =
2946
+ // @Trace()
2911
2947
  /**
2912
- * @type {?}
2913
- * @private
2948
+ * @param {?} visit
2949
+ * @param {?=} includeRouteId
2950
+ * @return {?}
2914
2951
  */
2915
- NavigationSession.prototype._alreadyAccepted;
2916
- /** @type {?} */
2917
- NavigationSession.prototype.isPopState;
2918
- /** @type {?} */
2919
- NavigationSession.prototype.initialUrl;
2920
- }
2921
- var PlaceRouter = /** @class */ (function () {
2922
- function PlaceRouter(router$1, angularLocation) {
2923
- var _this = this;
2924
- this.router = router$1;
2925
- this._navigationSession = new pectin.MutableValueModel();
2926
- angularLocation.onUrlChange((/**
2927
- * @param {?} url
2928
- * @return {?}
2929
- */
2930
- function (url) {
2931
- console.log("### " + url);
2932
- }));
2933
- this.router.events.subscribe((/**
2934
- * @param {?} event
2952
+ function (visit, includeRouteId) {
2953
+ if (includeRouteId === void 0) { includeRouteId = false; }
2954
+ /** @type {?} */
2955
+ var result = {};
2956
+ this.getVisitParameterDefs({
2957
+ includeRouteId: includeRouteId, includeRouteParameters: true
2958
+ }).forEach((/**
2959
+ * @param {?} def
2935
2960
  * @return {?}
2936
2961
  */
2937
- function (event) {
2938
- // console.log(`${event.constructor.name}`, location.pathname, angularLocation.getState());
2939
- // NavigationStart -> .... -> NavigationCancel === redirect (so don't ask again)
2940
- // NavigationStart -> .... -> NavigationEnd === navigated (so ask next time)
2941
- // NavigationStart -> .... -> NavigationError === canceled (guard cancelled so ask next time)
2942
- if (event instanceof router.NavigationStart && !_this.navigationSession) {
2943
- _this._navigationSession.value = new NavigationSession(event.navigationTrigger === 'popstate', _this.router.routerState.snapshot.url);
2944
- }
2945
- if (event instanceof router.NavigationEnd) {
2946
- console.log('navigation ended');
2947
- _this._navigationSession.value = null;
2948
- }
2949
- if (event instanceof router.NavigationError) {
2950
- console.log('navigation errored');
2951
- _this._navigationSession.value = null;
2962
+ function (def) {
2963
+ /** @type {?} */
2964
+ var value = visit.getParameter(def.name);
2965
+ if (!def.isEmptyValue(value)) {
2966
+ if (def.isArray) {
2967
+ pectin.assert.isArray(value);
2968
+ result[def.name] = value.map((/**
2969
+ * @param {?} v
2970
+ * @return {?}
2971
+ */
2972
+ function (v) { return def.urlFormat.format(v); }));
2973
+ }
2974
+ else {
2975
+ pectin.assert.isFalsey(Array.isArray(value));
2976
+ result[def.name] = def.urlFormat.format(value);
2977
+ }
2952
2978
  }
2953
2979
  }));
2954
- }
2955
- Object.defineProperty(PlaceRouter.prototype, "navigationSession", {
2956
- get: /**
2957
- * @return {?}
2958
- */
2959
- function () {
2960
- return this._navigationSession.value;
2961
- },
2962
- enumerable: true,
2963
- configurable: true
2964
- });
2980
+ return result;
2981
+ };
2965
2982
  /**
2966
- * @param {?} activatedRoute
2967
- * @param {?} previous
2968
- * @param {?} next
2983
+ * @param {?} visit
2969
2984
  * @return {?}
2970
2985
  */
2971
- PlaceRouter.prototype.pushParameterChangesToRoute = /**
2972
- * @param {?} activatedRoute
2973
- * @param {?} previous
2974
- * @param {?} next
2986
+ PlaceDefinition.prototype.getNonRouteParameters = /**
2987
+ * @param {?} visit
2975
2988
  * @return {?}
2976
2989
  */
2977
- function (activatedRoute, previous, next) {
2990
+ function (visit) {
2978
2991
  /** @type {?} */
2979
- var relativePath = !!previous.hasRouteId() ? '..' : '.';
2980
- this.router.navigate([relativePath].concat(this.createRouteParameters(next), this.getChildPath(activatedRoute.snapshot)), {
2981
- relativeTo: activatedRoute
2982
- });
2992
+ var result = {};
2993
+ this.getVisitParameterDefs({ includeNonRouteParameters: true }).forEach((/**
2994
+ * @param {?} def
2995
+ * @return {?}
2996
+ */
2997
+ function (def) {
2998
+ /** @type {?} */
2999
+ var value = visit.getParameter(def.name);
3000
+ if (!def.isEmptyValue(value)) {
3001
+ result[def.name] = value;
3002
+ }
3003
+ }));
3004
+ return result;
2983
3005
  };
2984
3006
  // @Trace()
2985
3007
  // @Trace()
2986
3008
  /**
2987
- * @param {?} activatedRoute
2988
- * @param {?} sanitised
3009
+ * @param {?} params
2989
3010
  * @return {?}
2990
3011
  */
2991
- PlaceRouter.prototype.getRedirectUrlTree =
3012
+ PlaceDefinition.prototype.parseRouteParams =
2992
3013
  // @Trace()
2993
3014
  /**
2994
- * @param {?} activatedRoute
2995
- * @param {?} sanitised
3015
+ * @param {?} params
2996
3016
  * @return {?}
2997
3017
  */
2998
- function (activatedRoute, sanitised) {
3018
+ function (params) {
2999
3019
  /** @type {?} */
3000
- var urlSegments = activatedRoute.url;
3001
- /** @type {?} */
3002
- var weHaveARouteId = sanitised.hasRouteId() && sanitised.getFormattedRouteId();
3003
- /** @type {?} */
3004
- var commands = (weHaveARouteId) ?
3005
- [urlSegments[0].path, sanitised.getFormattedRouteId(), sanitised.getFormattedParameters()] :
3006
- [urlSegments[0].path, sanitised.getFormattedParameters()];
3007
- return this.router.createUrlTree(commands);
3020
+ var result = {};
3021
+ this.getVisitParameterDefs({
3022
+ includeRouteId: true,
3023
+ includeRouteParameters: true,
3024
+ includeNonRouteParameters: false
3025
+ }).forEach((/**
3026
+ * @param {?} def
3027
+ * @return {?}
3028
+ */
3029
+ function (def) {
3030
+ // params will return null for non existent names
3031
+ if (params.has(def.name)) {
3032
+ if (def.isArray) {
3033
+ /** @type {?} */
3034
+ var values = params.getAll(def.name);
3035
+ result[def.name] = values.map((/**
3036
+ * @param {?} v
3037
+ * @return {?}
3038
+ */
3039
+ function (v) { return def.urlFormat.parse(v); }));
3040
+ }
3041
+ else {
3042
+ result[def.name] = def.urlFormat.parse(params.get(def.name));
3043
+ }
3044
+ }
3045
+ }));
3046
+ return result;
3008
3047
  };
3048
+ __decorate([
3049
+ src.Memoize(),
3050
+ __metadata("design:type", Function),
3051
+ __metadata("design:paramtypes", []),
3052
+ __metadata("design:returntype", exports.ParameterDefinition)
3053
+ ], PlaceDefinition.prototype, "getRouteIdParameterDef", null);
3054
+ __decorate([
3055
+ src.Memoize(),
3056
+ __metadata("design:type", Function),
3057
+ __metadata("design:paramtypes", [Object]),
3058
+ __metadata("design:returntype", Array)
3059
+ ], PlaceDefinition.prototype, "getRouteParameterDefs", null);
3060
+ __decorate([
3061
+ src.Memoize(),
3062
+ __metadata("design:type", Function),
3063
+ __metadata("design:paramtypes", [Object]),
3064
+ __metadata("design:returntype", Array)
3065
+ ], PlaceDefinition.prototype, "getVisitParameterDefs", null);
3066
+ return PlaceDefinition;
3067
+ }());
3068
+ if (false) {
3069
+ /** @type {?} */
3070
+ exports.PlaceDefinition.prototype.component;
3071
+ /** @type {?} */
3072
+ exports.PlaceDefinition.prototype.path;
3073
+ /** @type {?} */
3074
+ exports.PlaceDefinition.prototype.authenticate;
3075
+ /** @type {?} */
3076
+ exports.PlaceDefinition.prototype.order;
3077
+ /** @type {?} */
3078
+ exports.PlaceDefinition.prototype.data;
3079
+ /** @type {?} */
3080
+ exports.PlaceDefinition.prototype.routeParameters;
3081
+ /** @type {?} */
3082
+ exports.PlaceDefinition.prototype.children;
3083
+ }
3084
+ (function (PlaceDefinition) {
3009
3085
  /**
3010
- * @protected
3011
- * @param {?} activatedRoute
3086
+ * @record
3087
+ */
3088
+ function ParameterOptions() { }
3089
+ PlaceDefinition.ParameterOptions = ParameterOptions;
3090
+ if (false) {
3091
+ /** @type {?|undefined} */
3092
+ ParameterOptions.prototype.includeRouteId;
3093
+ /** @type {?|undefined} */
3094
+ ParameterOptions.prototype.includeRouteParameters;
3095
+ /** @type {?|undefined} */
3096
+ ParameterOptions.prototype.includeNonRouteParameters;
3097
+ }
3098
+ })(exports.PlaceDefinition || (exports.PlaceDefinition = {}));
3099
+
3100
+ /**
3101
+ * @fileoverview added by tsickle
3102
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3103
+ */
3104
+ // RAKE: making this Symbol(...) broke things.
3105
+ /** @type {?} */
3106
+ var DEFINITION_META_DATA_KEY = 'PLACE_DEFINITION_OPTIONS';
3107
+ // this one seems ok.
3108
+ /** @type {?} */
3109
+ var ROUTE_PARAMETER_LIST_KEY = Symbol('place:route:parameters');
3110
+ exports.PlaceComponent = /** @class */ (function (_super) {
3111
+ __extends(PlaceComponent, _super);
3112
+ function PlaceComponent() {
3113
+ return _super.call(this) || this;
3114
+ }
3115
+ /**
3116
+ * @param {?} visit
3012
3117
  * @return {?}
3013
3118
  */
3014
- PlaceRouter.prototype.getChildPath = /**
3015
- * @protected
3016
- * @param {?} activatedRoute
3119
+ PlaceComponent.prototype.initialiseBindings = /**
3120
+ * @param {?} visit
3017
3121
  * @return {?}
3018
3122
  */
3019
- function (activatedRoute) {
3020
- return ___default__default.flatten(activatedRoute.children.map((/**
3021
- * @param {?} child
3123
+ function (visit) {
3124
+ var _this = this;
3125
+ pectin.assert.isNil(this.visit);
3126
+ this.visit = visit;
3127
+ this.placeDefinition.getVisitParameterDefs().forEach((/**
3128
+ * @param {?} parameterDef
3022
3129
  * @return {?}
3023
3130
  */
3024
- function (child) { return child.url; })));
3131
+ function (parameterDef) {
3132
+ _this.installBinding(parameterDef);
3133
+ }));
3025
3134
  };
3026
3135
  /**
3027
- * @protected
3028
- * @param {?} parameters
3136
+ * @private
3137
+ * @template T, S
3138
+ * @param {?} parameterDef
3029
3139
  * @return {?}
3030
3140
  */
3031
- PlaceRouter.prototype.createRouteParameters = /**
3032
- * @protected
3033
- * @param {?} parameters
3141
+ PlaceComponent.prototype.installBinding = /**
3142
+ * @private
3143
+ * @template T, S
3144
+ * @param {?} parameterDef
3034
3145
  * @return {?}
3035
3146
  */
3036
- function (parameters) {
3147
+ function (parameterDef) {
3037
3148
  /** @type {?} */
3038
- var routeId = parameters.getFormattedRouteId();
3039
- return routeId ?
3040
- [routeId, parameters.getFormattedParameters()] :
3041
- [parameters.getFormattedParameters()];
3042
- };
3043
- PlaceRouter.decorators = [
3044
- { type: core.Injectable, args: [{
3045
- providedIn: 'root'
3046
- },] }
3047
- ];
3048
- /** @nocollapse */
3049
- PlaceRouter.ctorParameters = function () { return [
3050
- { type: router.Router },
3051
- { type: common.Location }
3052
- ]; };
3053
- /** @nocollapse */ PlaceRouter.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(core.ɵɵinject(router.Router), core.ɵɵinject(common.Location)); }, token: PlaceRouter, providedIn: "root" });
3054
- return PlaceRouter;
3055
- }());
3056
- if (false) {
3149
+ var model = (/** @type {?} */ (this[parameterDef.propertyName]));
3150
+ // this.txo.observe(parameterDef.propertyName, model);
3151
+ this.registerDisposable(new pectin.Binding(this.visit, model, {
3152
+ toRight: /**
3153
+ * @param {?} visit
3154
+ * @return {?}
3155
+ */
3156
+ function (visit) {
3157
+ /** @type {?} */
3158
+ var value = visit.getParameter(parameterDef.name);
3159
+ // console.log('push to component', {name:parameterDef.name, value, visit});
3160
+ return value;
3161
+ },
3162
+ toLeft: /**
3163
+ * @param {?} value
3164
+ * @param {?=} currentVisit
3165
+ * @return {?}
3166
+ */
3167
+ function (value, currentVisit) {
3168
+ console.log('push to route', { name: parameterDef.name, value: value, currentVisit: currentVisit });
3169
+ return currentVisit.replace(parameterDef, value);
3170
+ }
3171
+ }));
3172
+ };
3173
+ Object.defineProperty(PlaceComponent.prototype, "placeDefinition", {
3174
+ get: /**
3175
+ * @return {?}
3176
+ */
3177
+ function () {
3178
+ return PlaceComponent.getDefinition((/** @type {?} */ ((/** @type {?} */ (this.constructor)))));
3179
+ },
3180
+ enumerable: true,
3181
+ configurable: true
3182
+ });
3183
+ Object.defineProperty(PlaceComponent.prototype, "childPlaces", {
3184
+ get: /**
3185
+ * @return {?}
3186
+ */
3187
+ function () {
3188
+ return this.placeDefinition.children.map((/**
3189
+ * @param {?} d
3190
+ * @return {?}
3191
+ */
3192
+ function (d) { return d.component; }));
3193
+ },
3194
+ enumerable: true,
3195
+ configurable: true
3196
+ });
3057
3197
  /**
3058
- * @type {?}
3059
- * @private
3198
+ * @return {?}
3199
+ */
3200
+ PlaceComponent.prototype.canDeactivate = /**
3201
+ * @return {?}
3060
3202
  */
3061
- PlaceRouter.prototype._navigationSession;
3203
+ function () {
3204
+ return true;
3205
+ };
3206
+ /**
3207
+ * @return {?}
3208
+ */
3209
+ PlaceComponent.prototype.onPlaceReady = /**
3210
+ * @return {?}
3211
+ */
3212
+ function () {
3213
+ };
3214
+ __decorate([
3215
+ fastMemoizeDecorator.Memoize(),
3216
+ __metadata("design:type", exports.PlaceDefinition),
3217
+ __metadata("design:paramtypes", [])
3218
+ ], PlaceComponent.prototype, "placeDefinition", null);
3219
+ return PlaceComponent;
3220
+ }(DisposableComponent));
3221
+ if (false) {
3062
3222
  /**
3063
3223
  * @type {?}
3064
3224
  * @private
3065
3225
  */
3066
- PlaceRouter.prototype.router;
3226
+ exports.PlaceComponent.prototype.visit;
3067
3227
  }
3228
+ (function (PlaceComponent) {
3229
+ /**
3230
+ * @param {?} target
3231
+ * @return {?}
3232
+ */
3233
+ function isPlaceComponentConstructor(target) {
3234
+ return pectin.lang.constructorChain((/** @type {?} */ (target))).includes(PlaceComponent);
3235
+ }
3236
+ PlaceComponent.isPlaceComponentConstructor = isPlaceComponentConstructor;
3237
+ /**
3238
+ * @param {?} klass
3239
+ * @return {?}
3240
+ */
3241
+ function getRouteParameters(klass) {
3242
+ return typescriptUtilities.Klass.get(klass).getMetadataList(ROUTE_PARAMETER_LIST_KEY);
3243
+ }
3244
+ PlaceComponent.getRouteParameters = getRouteParameters;
3245
+ /**
3246
+ * @param {?} klass
3247
+ * @return {?}
3248
+ */
3249
+ function getDefinition(klass) {
3250
+ return Reflect.getMetadata(DEFINITION_META_DATA_KEY, klass);
3251
+ }
3252
+ PlaceComponent.getDefinition = getDefinition;
3253
+ /**
3254
+ * @param {?} klass
3255
+ * @param {?} definition
3256
+ * @return {?}
3257
+ */
3258
+ function injectDefinition(klass, definition) {
3259
+ Reflect.defineMetadata(DEFINITION_META_DATA_KEY, definition, klass);
3260
+ }
3261
+ PlaceComponent.injectDefinition = injectDefinition;
3262
+ })(exports.PlaceComponent || (exports.PlaceComponent = {}));
3068
3263
 
3069
3264
  /**
3070
3265
  * @fileoverview added by tsickle
3071
3266
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3072
3267
  */
3073
- /**
3074
- * @abstract
3075
- * @template T, S
3076
- */
3077
- /**
3078
- * @abstract
3079
- * @template T, S
3080
- */
3081
- exports.ParameterDefinition = /** @class */ (function () {
3082
- function ParameterDefinition(propertyName, type, options) {
3083
- this.propertyName = propertyName;
3084
- this.type = type;
3085
- /** @type {?} */
3086
- var opts = typescriptUtilities.Opts.get(options);
3087
- this.name = opts.getOptional('as', propertyName);
3088
- this.remember = opts.getOptional('remember', false);
3089
- this.defaultValue = opts.getOptional('defaultValue', null);
3268
+ var AbstractPlaceNavigationComponent = /** @class */ (function (_super) {
3269
+ __extends(AbstractPlaceNavigationComponent, _super);
3270
+ function AbstractPlaceNavigationComponent() {
3271
+ var _this = _super.call(this) || this;
3272
+ 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;
3273
+ _this.placeDefinitions = chain(_this.placesModel).map((/**
3274
+ * @param {?} c
3275
+ * @return {?}
3276
+ */
3277
+ function (c) { return exports.PlaceComponent.getDefinition(c); }));
3278
+ return _this;
3090
3279
  }
3091
3280
  /**
3092
- * @param {?} injector
3281
+ * @param {?} placeDef
3093
3282
  * @return {?}
3094
3283
  */
3095
- ParameterDefinition.prototype.getSanitiser = /**
3096
- * @param {?} injector
3284
+ AbstractPlaceNavigationComponent.prototype.getNav = /**
3285
+ * @param {?} placeDef
3097
3286
  * @return {?}
3098
3287
  */
3099
- function (injector) {
3100
- if (this.remember || !___default__default.isNil(this.defaultValue)) {
3101
- return new ParameterDefinition.DefaultParameterSanitiser(this.remember, this.defaultValue, injector.get(PlaceHistory));
3102
- }
3103
- else {
3104
- return null;
3105
- }
3288
+ function (placeDef) {
3289
+ /** @type {?} */
3290
+ var navItem = (/** @type {?} */ (placeDef.getPlaceData('nav')));
3291
+ return {
3292
+ title: (/**
3293
+ * @return {?}
3294
+ */
3295
+ function () { return navItem ? navItem.title() : placeDef.searchPlaceData(['navTitle', 'title']); }),
3296
+ tooltip: (/**
3297
+ * @return {?}
3298
+ */
3299
+ function () { return navItem && navItem.tooltip ? navItem.tooltip() : placeDef.getPlaceData('navTooltip', null); }),
3300
+ icon: (/**
3301
+ * @return {?}
3302
+ */
3303
+ function () { return navItem && navItem.icon ? navItem.icon() : placeDef.getPlaceData('navIcon', null); })
3304
+ };
3106
3305
  };
3107
- return ParameterDefinition;
3108
- }());
3306
+ /**
3307
+ * @return {?}
3308
+ */
3309
+ AbstractPlaceNavigationComponent.prototype.ngOnInit = /**
3310
+ * @return {?}
3311
+ */
3312
+ function () {
3313
+ };
3314
+ AbstractPlaceNavigationComponent.propDecorators = {
3315
+ places: [{ type: core.Input }],
3316
+ placesModel: [{ type: core.Input }]
3317
+ };
3318
+ __decorate([
3319
+ pectin.StoreInListModel('placesModel'),
3320
+ __metadata("design:type", Array)
3321
+ ], AbstractPlaceNavigationComponent.prototype, "places", void 0);
3322
+ __decorate([
3323
+ pectin.UseDelegate(),
3324
+ __metadata("design:type", pectin.ListModel)
3325
+ ], AbstractPlaceNavigationComponent.prototype, "placesModel", void 0);
3326
+ __decorate([
3327
+ src.Memoize(),
3328
+ __metadata("design:type", Function),
3329
+ __metadata("design:paramtypes", [exports.PlaceDefinition]),
3330
+ __metadata("design:returntype", Object)
3331
+ ], AbstractPlaceNavigationComponent.prototype, "getNav", null);
3332
+ return AbstractPlaceNavigationComponent;
3333
+ }(DisposableComponent));
3109
3334
  if (false) {
3110
3335
  /** @type {?} */
3111
- exports.ParameterDefinition.prototype.isRouteId;
3336
+ AbstractPlaceNavigationComponent.prototype.places;
3112
3337
  /** @type {?} */
3113
- exports.ParameterDefinition.prototype.isArray;
3338
+ AbstractPlaceNavigationComponent.prototype.placesModel;
3114
3339
  /** @type {?} */
3115
- exports.ParameterDefinition.prototype.name;
3340
+ AbstractPlaceNavigationComponent.prototype.placeDefinitions;
3341
+ }
3342
+
3343
+ /**
3344
+ * @fileoverview added by tsickle
3345
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3346
+ */
3347
+ var ListPlaceNavComponent = /** @class */ (function (_super) {
3348
+ __extends(ListPlaceNavComponent, _super);
3349
+ function ListPlaceNavComponent() {
3350
+ var _this = _super.call(this) || this;
3351
+ _this.expanded = true;
3352
+ return _this;
3353
+ }
3116
3354
  /**
3117
- * @type {?}
3118
- * @private
3355
+ * @return {?}
3119
3356
  */
3120
- exports.ParameterDefinition.prototype.remember;
3121
- /**
3122
- * @type {?}
3123
- * @private
3357
+ ListPlaceNavComponent.prototype.expandMenu = /**
3358
+ * @return {?}
3124
3359
  */
3125
- exports.ParameterDefinition.prototype.defaultValue;
3126
- /** @type {?} */
3127
- exports.ParameterDefinition.prototype.propertyName;
3128
- /** @type {?} */
3129
- exports.ParameterDefinition.prototype.type;
3130
- }
3131
- (function (ParameterDefinition) {
3360
+ function () {
3361
+ this.expanded = true;
3362
+ };
3132
3363
  /**
3133
- * @record
3134
- * @template T
3364
+ * @return {?}
3135
3365
  */
3136
- function Options() { }
3137
- ParameterDefinition.Options = Options;
3138
- if (false) {
3139
- /** @type {?|undefined} */
3140
- Options.prototype.as;
3141
- /** @type {?|undefined} */
3142
- Options.prototype.optional;
3143
- /** @type {?|undefined} */
3144
- Options.prototype.remember;
3145
- /** @type {?|undefined} */
3146
- Options.prototype.defaultValue;
3147
- }
3366
+ ListPlaceNavComponent.prototype.collapseMenu = /**
3367
+ * @return {?}
3368
+ */
3369
+ function () {
3370
+ this.expanded = false;
3371
+ };
3148
3372
  /**
3149
- * @template T
3373
+ * @return {?}
3150
3374
  */
3151
- var /**
3152
- * @template T
3375
+ ListPlaceNavComponent.prototype.toggleMenu = /**
3376
+ * @return {?}
3153
3377
  */
3154
- RouteId = /** @class */ (function (_super) {
3155
- __extends(RouteId, _super);
3156
- function RouteId() {
3157
- var _this = _super !== null && _super.apply(this, arguments) || this;
3158
- _this.isRouteId = true;
3159
- _this.isArray = false;
3160
- return _this;
3161
- }
3162
- return RouteId;
3163
- }(ParameterDefinition));
3164
- ParameterDefinition.RouteId = RouteId;
3165
- if (false) {
3166
- /** @type {?} */
3167
- RouteId.prototype.isRouteId;
3168
- /** @type {?} */
3169
- RouteId.prototype.isArray;
3378
+ function () {
3379
+ this.expanded = !this.expanded;
3380
+ };
3381
+ ListPlaceNavComponent.decorators = [
3382
+ { type: core.Component, args: [{
3383
+ selector: 'angular-ui-powerups-list-place-nav',
3384
+ template: "<mat-nav-list class=\"app-menu\">\n <a mat-list-item *ngFor=\"let place of placeDefinitions.value\"\n [routerLink]='place.path'\n [replaceUrl]=\"true\"\n routerLinkActive #rla=\"routerLinkActive\"\n [matTooltip]=\"getNav(place).tooltip()\">\n <mat-icon *ngIf=\"getNav(place).icon()\">{{getNav(place).icon()}}</mat-icon>\n <span class=\"expanded-only\">{{getNav(place).title()}}</span>\n </a>\n</mat-nav-list>\n",
3385
+ styles: [":host{display:flex;flex-direction:column;--expanded-width:235px;--nav-item-width:var(--nav-bar-height);width:var(--nav-item-width);transition:width 125ms linear}:host.expanded{width:var(--expanded-width);max-width:var(--expanded-width)}.expanded-only{max-width:0;overflow:hidden}.collapsed-only{max-width:100%;overflow:hidden}.header{display:flex;flex-direction:row;justify-content:flex-end;align-items:center;height:var(--nav-bar-height);border-bottom:var(--pinstripe-border);cursor:pointer}.header .menu{flex:1}.header button{color:inherit;width:var(--nav-item-width);height:var(--nav-bar-height)}mat-nav-list{flex:1;display:flex;flex-direction:column}.mat-list-item{width:var(--nav-item-width);height:var(--nav-bar-height);color:inherit}mat-icon{color:inherit}mat-icon.flip-horizontal{transform:scaleX(-1)}:host-context(.expanded) .expanded-only{max-width:100%}:host-context(.expanded) .collapsed-only{max-width:0}:host-context(.expanded) .mat-list-item mat-icon{margin-right:12px}:host-context(.expanded) .mat-list-item span{text-wrap:none;white-space:nowrap}a[ng-reflect-router-link=manage-instruments] mat-icon{transform:rotate(90deg)}.app-menu{padding-top:0}"]
3386
+ }] }
3387
+ ];
3388
+ /** @nocollapse */
3389
+ ListPlaceNavComponent.ctorParameters = function () { return []; };
3390
+ ListPlaceNavComponent.propDecorators = {
3391
+ expanded: [{ type: core.HostBinding, args: ['class.expanded',] }]
3392
+ };
3393
+ return ListPlaceNavComponent;
3394
+ }(AbstractPlaceNavigationComponent));
3395
+ if (false) {
3396
+ /** @type {?} */
3397
+ ListPlaceNavComponent.prototype.expanded;
3398
+ }
3399
+
3400
+ /**
3401
+ * @fileoverview added by tsickle
3402
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3403
+ */
3404
+ var PlaceHistory = /** @class */ (function () {
3405
+ function PlaceHistory(router) {
3406
+ this.router = router;
3407
+ this._history = new Map();
3170
3408
  }
3409
+ // @Trace()
3410
+ // @Trace()
3171
3411
  /**
3172
- * @template T
3412
+ * @param {?} state
3413
+ * @return {?}
3173
3414
  */
3174
- var /**
3175
- * @template T
3415
+ PlaceHistory.prototype.add =
3416
+ // @Trace()
3417
+ /**
3418
+ * @param {?} state
3419
+ * @return {?}
3176
3420
  */
3177
- ValueParameter = /** @class */ (function (_super) {
3178
- __extends(ValueParameter, _super);
3179
- function ValueParameter() {
3180
- var _this = _super !== null && _super.apply(this, arguments) || this;
3181
- _this.isRouteId = false;
3182
- _this.isArray = false;
3183
- return _this;
3184
- }
3185
- return ValueParameter;
3186
- }(ParameterDefinition));
3187
- ParameterDefinition.ValueParameter = ValueParameter;
3188
- if (false) {
3421
+ function (state) {
3189
3422
  /** @type {?} */
3190
- ValueParameter.prototype.isRouteId;
3423
+ var history = this.getHistory(state.placeDefinition);
3191
3424
  /** @type {?} */
3192
- ValueParameter.prototype.isArray;
3193
- }
3425
+ var previousState = ___default__default.last(history);
3426
+ if (!previousState || state.hasChangedFrom(previousState)) {
3427
+ history.unshift(state); // LIFO
3428
+ this.setHistory(state.placeDefinition, history.slice(0, 3)); // limit our history to 4 visits
3429
+ }
3430
+ };
3194
3431
  /**
3195
- * @template T
3432
+ * @param {?} placeDef
3433
+ * @return {?}
3196
3434
  */
3197
- var /**
3198
- * @template T
3435
+ PlaceHistory.prototype.getHistory = /**
3436
+ * @param {?} placeDef
3437
+ * @return {?}
3199
3438
  */
3200
- ArrayParameter = /** @class */ (function (_super) {
3201
- __extends(ArrayParameter, _super);
3202
- function ArrayParameter() {
3203
- var _this = _super !== null && _super.apply(this, arguments) || this;
3204
- _this.isRouteId = false;
3205
- _this.isArray = true;
3206
- return _this;
3207
- }
3208
- return ArrayParameter;
3209
- }(ParameterDefinition));
3210
- ParameterDefinition.ArrayParameter = ArrayParameter;
3211
- if (false) {
3212
- /** @type {?} */
3213
- ArrayParameter.prototype.isRouteId;
3439
+ function (placeDef) {
3214
3440
  /** @type {?} */
3215
- ArrayParameter.prototype.isArray;
3216
- }
3441
+ var history = this._history.get(placeDef);
3442
+ if (!history) {
3443
+ history = [];
3444
+ this.setHistory(placeDef, history);
3445
+ }
3446
+ return history;
3447
+ };
3217
3448
  /**
3218
- * @template T, S
3449
+ * @private
3450
+ * @param {?} placeDef
3451
+ * @param {?} history
3452
+ * @return {?}
3219
3453
  */
3220
- var /**
3221
- * @template T, S
3454
+ PlaceHistory.prototype.setHistory = /**
3455
+ * @private
3456
+ * @param {?} placeDef
3457
+ * @param {?} history
3458
+ * @return {?}
3222
3459
  */
3223
- DefaultParameterSanitiser = /** @class */ (function () {
3224
- function DefaultParameterSanitiser(remember, defaultValue, placeHistory) {
3225
- this.remember = remember;
3226
- this.defaultValue = defaultValue;
3227
- this.placeHistory = placeHistory;
3228
- }
3229
- /**
3230
- * @param {?} parameter
3231
- * @param {?=} visit
3232
- * @return {?}
3233
- */
3234
- DefaultParameterSanitiser.prototype.sanitise = /**
3235
- * @param {?} parameter
3236
- * @param {?=} visit
3237
- * @return {?}
3238
- */
3239
- function (parameter, visit) {
3240
- /** @type {?} */
3241
- var value = parameter.value;
3242
- if (parameter.isMissing()) {
3243
- /** @type {?} */
3244
- var previousVisit = ___default__default.first(this.placeHistory.getHistory(visit.placeDefinition));
3245
- if (this.remember && previousVisit) {
3246
- value = previousVisit.getValueOf(parameter.definition);
3247
- }
3248
- return parameter.isEmptyValue(value) ? this.defaultValue : value;
3249
- }
3250
- else {
3251
- return value;
3252
- }
3253
- };
3254
- return DefaultParameterSanitiser;
3255
- }());
3256
- ParameterDefinition.DefaultParameterSanitiser = DefaultParameterSanitiser;
3257
- if (false) {
3258
- /** @type {?} */
3259
- DefaultParameterSanitiser.prototype.remember;
3260
- /** @type {?} */
3261
- DefaultParameterSanitiser.prototype.defaultValue;
3262
- /** @type {?} */
3263
- DefaultParameterSanitiser.prototype.placeHistory;
3264
- }
3265
- })(exports.ParameterDefinition || (exports.ParameterDefinition = {}));
3460
+ function (placeDef, history) {
3461
+ this._history.set(placeDef, history);
3462
+ };
3463
+ PlaceHistory.decorators = [
3464
+ { type: core.Injectable, args: [{
3465
+ providedIn: 'root'
3466
+ },] }
3467
+ ];
3468
+ /** @nocollapse */
3469
+ PlaceHistory.ctorParameters = function () { return [
3470
+ { type: router.Router }
3471
+ ]; };
3472
+ /** @nocollapse */ PlaceHistory.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function PlaceHistory_Factory() { return new PlaceHistory(core.ɵɵinject(router.Router)); }, token: PlaceHistory, providedIn: "root" });
3473
+ return PlaceHistory;
3474
+ }());
3475
+ if (false) {
3476
+ /**
3477
+ * @type {?}
3478
+ * @private
3479
+ */
3480
+ PlaceHistory.prototype._history;
3481
+ /**
3482
+ * @type {?}
3483
+ * @private
3484
+ */
3485
+ PlaceHistory.prototype.router;
3486
+ }
3266
3487
 
3267
3488
  /**
3268
3489
  * @fileoverview added by tsickle
@@ -3270,791 +3491,682 @@
3270
3491
  */
3271
3492
  /**
3272
3493
  * @abstract
3273
- * @template S, T, R
3274
3494
  */
3275
3495
  /**
3276
3496
  * @abstract
3277
- * @template S, T, R
3278
3497
  */
3279
- exports.RouteParameterValue = /** @class */ (function () {
3280
- function RouteParameterValue(definition, rawValue) {
3281
- this.definition = definition;
3282
- this.rawValue = rawValue;
3498
+ exports.NavigationSession = /** @class */ (function () {
3499
+ function NavigationSession(firstNavigation) {
3500
+ this.firstNavigation = firstNavigation;
3501
+ this._alreadyAccepted = [];
3502
+ this._visits = new Map();
3283
3503
  }
3284
3504
  /**
3505
+ * @param {?} visit
3285
3506
  * @return {?}
3286
3507
  */
3287
- RouteParameterValue.prototype.isRouteId = /**
3508
+ NavigationSession.prototype.storeVisit = /**
3509
+ * @param {?} visit
3288
3510
  * @return {?}
3289
3511
  */
3290
- function () {
3291
- return this.definition.isRouteId;
3512
+ function (visit) {
3513
+ this._visits.set(visit.placeDefinition, visit);
3292
3514
  };
3293
3515
  /**
3294
- * @param {?} otherValue
3516
+ * @param {?} placeDef
3295
3517
  * @return {?}
3296
3518
  */
3297
- RouteParameterValue.prototype.hasChanged = /**
3298
- * @param {?} otherValue
3519
+ NavigationSession.prototype.getVisitFor = /**
3520
+ * @param {?} placeDef
3299
3521
  * @return {?}
3300
3522
  */
3301
- function (otherValue) {
3302
- return this.isEmpty() ?
3303
- !this.isEmptyValue(otherValue) :
3304
- this.isEmptyValue(otherValue) || !this.isSameValue(otherValue);
3523
+ function (placeDef) {
3524
+ return this._visits.get(placeDef);
3305
3525
  };
3306
3526
  /**
3307
- * Return's true if the current value is empty.
3527
+ * @param {?} params
3528
+ * @return {?}
3529
+ */
3530
+ NavigationSession.prototype.mergePrivatePlaceParameters = /**
3531
+ * @param {?} params
3532
+ * @return {?}
3308
3533
  */
3534
+ function (params) {
3535
+ return null;
3536
+ };
3537
+ // @Trace()
3538
+ // @Trace()
3309
3539
  /**
3310
- * Return's true if the current value is empty.
3540
+ * @param {?} placeComponent
3311
3541
  * @return {?}
3312
3542
  */
3313
- RouteParameterValue.prototype.isEmpty = /**
3314
- * Return's true if the current value is empty.
3543
+ NavigationSession.prototype.alreadyAccepted =
3544
+ // @Trace()
3545
+ /**
3546
+ * @param {?} placeComponent
3315
3547
  * @return {?}
3316
3548
  */
3317
- function () {
3318
- return this.isEmptyValue(this.value);
3549
+ function (placeComponent) {
3550
+ return this._alreadyAccepted.includes(placeComponent);
3319
3551
  };
3552
+ // @Trace()
3553
+ // @Trace()
3320
3554
  /**
3321
- * Returns true if the rawValue is undefined. This
3555
+ * @param {?} component
3556
+ * @return {?}
3557
+ */
3558
+ NavigationSession.prototype.rememberAcceptanceOf =
3559
+ // @Trace()
3560
+ /**
3561
+ * @param {?} component
3562
+ * @return {?}
3322
3563
  */
3564
+ function (component) {
3565
+ this._alreadyAccepted.push(component);
3566
+ };
3323
3567
  /**
3324
- * Returns true if the rawValue is undefined. This
3568
+ * @param {?} url
3325
3569
  * @return {?}
3326
3570
  */
3327
- RouteParameterValue.prototype.isMissing = /**
3328
- * Returns true if the rawValue is undefined. This
3571
+ NavigationSession.prototype.setPopstateReturn = /**
3572
+ * @param {?} url
3329
3573
  * @return {?}
3330
3574
  */
3331
- function () {
3332
- return ___default__default.isUndefined(this.rawValue);
3575
+ function (url) {
3576
+ this._popStateReturnUrl = url;
3333
3577
  };
3578
+ Object.defineProperty(NavigationSession.prototype, "isPopState", {
3579
+ get: /**
3580
+ * @return {?}
3581
+ */
3582
+ function () {
3583
+ return !!this._popStateReturnUrl;
3584
+ },
3585
+ enumerable: true,
3586
+ configurable: true
3587
+ });
3588
+ Object.defineProperty(NavigationSession.prototype, "popStateReturnUrl", {
3589
+ get: /**
3590
+ * @return {?}
3591
+ */
3592
+ function () {
3593
+ return this._popStateReturnUrl;
3594
+ },
3595
+ enumerable: true,
3596
+ configurable: true
3597
+ });
3334
3598
  /**
3335
- * @param {?} visit
3336
- * @param {?} injector
3337
3599
  * @return {?}
3338
3600
  */
3339
- RouteParameterValue.prototype.sanitise = /**
3340
- * @param {?} visit
3341
- * @param {?} injector
3601
+ NavigationSession.prototype.getVisits = /**
3342
3602
  * @return {?}
3343
3603
  */
3344
- function (visit, injector) {
3345
- return __awaiter(this, void 0, void 0, function () {
3346
- var sanitiser;
3347
- return __generator(this, function (_a) {
3348
- sanitiser = this.definition.getSanitiser(injector);
3349
- if (sanitiser) {
3350
- return [2 /*return*/, sanitiser.sanitise(this, visit)];
3351
- }
3352
- else {
3353
- return [2 /*return*/, this.value];
3354
- }
3355
- return [2 /*return*/];
3356
- });
3357
- });
3604
+ function () {
3605
+ return Array.from(this._visits.values());
3358
3606
  };
3359
- return RouteParameterValue;
3607
+ return NavigationSession;
3360
3608
  }());
3361
3609
  if (false) {
3362
- /** @type {?} */
3363
- exports.RouteParameterValue.prototype.value;
3364
- /** @type {?} */
3365
- exports.RouteParameterValue.prototype.definition;
3366
3610
  /**
3367
3611
  * @type {?}
3368
- * @protected
3369
- */
3370
- exports.RouteParameterValue.prototype.rawValue;
3371
- /**
3372
- * @abstract
3373
- * @param {?} otherValue
3374
- * @return {?}
3375
- */
3376
- exports.RouteParameterValue.prototype.isSameValue = function (otherValue) { };
3377
- /**
3378
- * @abstract
3379
- * @return {?}
3612
+ * @private
3380
3613
  */
3381
- exports.RouteParameterValue.prototype.formattedValue = function () { };
3614
+ exports.NavigationSession.prototype._alreadyAccepted;
3382
3615
  /**
3383
- * @abstract
3384
- * @param {?} value
3385
- * @return {?}
3616
+ * @type {?}
3617
+ * @private
3386
3618
  */
3387
- exports.RouteParameterValue.prototype.replace = function (value) { };
3619
+ exports.NavigationSession.prototype._visits;
3388
3620
  /**
3389
- * @abstract
3390
- * @param {?} value
3391
- * @return {?}
3621
+ * @type {?}
3622
+ * @private
3392
3623
  */
3393
- exports.RouteParameterValue.prototype.isEmptyValue = function (value) { };
3624
+ exports.NavigationSession.prototype._popStateReturnUrl;
3625
+ /** @type {?} */
3626
+ exports.NavigationSession.prototype.isExternal;
3627
+ /** @type {?} */
3628
+ exports.NavigationSession.prototype.firstNavigation;
3394
3629
  }
3395
- (function (RouteParameterValue) {
3396
- /**
3397
- * @template T
3398
- * @param {?} def
3399
- * @param {?} paramMap
3400
- * @return {?}
3401
- */
3402
- function create(def, paramMap) {
3403
- // NOTE: Using undefined is important as it triggers the isMissing flag which is used by defaultValue and remember flags
3404
- if (def.isArray) {
3405
- return new RouteParameterValue.Array(def, paramMap.has(def.name) ? paramMap.getAll(def.name) : undefined);
3630
+ (function (NavigationSession) {
3631
+ var External = /** @class */ (function (_super) {
3632
+ __extends(External, _super);
3633
+ function External(isFirstTime) {
3634
+ var _this = _super.call(this, isFirstTime) || this;
3635
+ _this.isExternal = true;
3636
+ return _this;
3406
3637
  }
3407
- else {
3408
- /** @type {?} */
3409
- var rawValue = paramMap.has(def.name) ? paramMap.get(def.name) : undefined;
3410
- // route ids are always present so we have to check if it's empty to flag it as missing..
3411
- rawValue = def.isRouteId && ___default__default.isEmpty(rawValue) ? undefined : rawValue;
3412
- return new RouteParameterValue.Scalar(def, rawValue);
3638
+ return External;
3639
+ }(NavigationSession));
3640
+ if (false) {
3641
+ /** @type {?} */
3642
+ External.prototype.isExternal;
3643
+ }
3644
+ var Internal = /** @class */ (function (_super) {
3645
+ __extends(Internal, _super);
3646
+ function Internal(visit) {
3647
+ var _this = _super.call(this, false) || this;
3648
+ _this.isExternal = false;
3649
+ _this.storeVisit(visit);
3650
+ return _this;
3413
3651
  }
3652
+ return Internal;
3653
+ }(NavigationSession));
3654
+ if (false) {
3655
+ /** @type {?} */
3656
+ Internal.prototype.isExternal;
3414
3657
  }
3415
- RouteParameterValue.create = create;
3416
3658
  /**
3417
- * @template T
3659
+ * @param {?} visit
3660
+ * @return {?}
3418
3661
  */
3419
- var Scalar = /** @class */ (function (_super) {
3420
- __extends(Scalar, _super);
3421
- function Scalar() {
3422
- return _super !== null && _super.apply(this, arguments) || this;
3423
- }
3424
- Object.defineProperty(Scalar.prototype, "value", {
3425
- get: /**
3426
- * @return {?}
3427
- */
3428
- function () {
3429
- return this.definition.type.parse(this.rawValue);
3430
- },
3431
- enumerable: true,
3432
- configurable: true
3433
- });
3434
- /**
3435
- * @param {?} otherValue
3436
- * @return {?}
3437
- */
3438
- Scalar.prototype.isSameValue = /**
3439
- * @param {?} otherValue
3440
- * @return {?}
3441
- */
3442
- function (otherValue) {
3443
- return this.value === otherValue;
3444
- };
3445
- /**
3446
- * @param {?} value
3447
- * @return {?}
3448
- */
3449
- Scalar.prototype.replace = /**
3450
- * @param {?} value
3451
- * @return {?}
3452
- */
3453
- function (value) {
3454
- return new RouteParameterValue.Scalar(this.definition, this.isEmptyValue(value) ? undefined : this.definition.type.format(value));
3455
- };
3456
- /**
3457
- * @return {?}
3458
- */
3459
- Scalar.prototype.formattedValue = /**
3460
- * @return {?}
3461
- */
3462
- function () {
3463
- return this.isEmpty() ? undefined : this.definition.type.format(this.value);
3464
- };
3465
- /**
3466
- * @param {?} value
3467
- * @return {?}
3468
- */
3469
- Scalar.prototype.isEmptyValue = /**
3470
- * @param {?} value
3471
- * @return {?}
3472
- */
3473
- function (value) {
3474
- return ___default__default.isNil(value);
3475
- };
3476
- __decorate([
3477
- src.Memoize(),
3478
- __metadata("design:type", Object),
3479
- __metadata("design:paramtypes", [])
3480
- ], Scalar.prototype, "value", null);
3481
- return Scalar;
3482
- }(RouteParameterValue));
3483
- RouteParameterValue.Scalar = Scalar;
3662
+ function createInternal(visit) {
3663
+ return new Internal(visit);
3664
+ }
3665
+ NavigationSession.createInternal = createInternal;
3484
3666
  /**
3485
- * @template T
3667
+ * @param {?} firstTimeRoute
3668
+ * @return {?}
3486
3669
  */
3487
- var Array = /** @class */ (function (_super) {
3488
- __extends(Array, _super);
3489
- function Array() {
3490
- return _super !== null && _super.apply(this, arguments) || this;
3491
- }
3492
- Object.defineProperty(Array.prototype, "value", {
3493
- get: /**
3494
- * @return {?}
3495
- */
3496
- function () {
3497
- var _this = this;
3498
- return (this.rawValue || [])
3499
- .filter((/**
3500
- * @param {?} s
3501
- * @return {?}
3502
- */
3503
- function (s) { return !___default__default.isEmpty(s); }))
3504
- .map((/**
3505
- * @param {?} raw
3506
- * @return {?}
3507
- */
3508
- function (raw) { return _this.definition.type.parse(raw); }));
3509
- },
3510
- enumerable: true,
3511
- configurable: true
3512
- });
3513
- /**
3514
- * @param {?} otherValue
3515
- * @return {?}
3516
- */
3517
- Array.prototype.isSameValue = /**
3518
- * @param {?} otherValue
3519
- * @return {?}
3520
- */
3521
- function (otherValue) {
3522
- return ___default__default.isEqual(this.value, otherValue);
3523
- };
3524
- /**
3525
- * @param {?} value
3526
- * @return {?}
3527
- */
3528
- Array.prototype.replace = /**
3529
- * @param {?} value
3530
- * @return {?}
3531
- */
3532
- function (value) {
3533
- var _this = this;
3534
- return new RouteParameterValue.Array(this.definition, this.isEmptyValue(value) ? undefined : value.map((/**
3535
- * @param {?} v
3536
- * @return {?}
3537
- */
3538
- function (v) { return _this.definition.type.format(v); })));
3539
- };
3540
- /**
3541
- * @return {?}
3542
- */
3543
- Array.prototype.formattedValue = /**
3544
- * @return {?}
3545
- */
3546
- function () {
3547
- var _this = this;
3548
- return this.isEmpty() ? [] : this.value.map((/**
3549
- * @param {?} v
3550
- * @return {?}
3551
- */
3552
- function (v) { return _this.definition.type.format(v); }));
3553
- };
3554
- /**
3555
- * @param {?} value
3556
- * @return {?}
3557
- */
3558
- Array.prototype.isEmptyValue = /**
3559
- * @param {?} value
3560
- * @return {?}
3561
- */
3562
- function (value) {
3563
- return ___default__default.isNil(value) || value.length < 1;
3564
- };
3565
- __decorate([
3566
- src.Memoize(),
3567
- __metadata("design:type", Array),
3568
- __metadata("design:paramtypes", [])
3569
- ], Array.prototype, "value", null);
3570
- return Array;
3571
- }(RouteParameterValue));
3572
- RouteParameterValue.Array = Array;
3573
- })(exports.RouteParameterValue || (exports.RouteParameterValue = {}));
3670
+ function createExternal(firstTimeRoute) {
3671
+ return new External(firstTimeRoute);
3672
+ }
3673
+ NavigationSession.createExternal = createExternal;
3674
+ })(exports.NavigationSession || (exports.NavigationSession = {}));
3574
3675
 
3575
3676
  /**
3576
3677
  * @fileoverview added by tsickle
3577
3678
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3578
3679
  */
3579
- exports.ParameterSnapshot = /** @class */ (function () {
3580
- function ParameterSnapshot(placeDefinition, parameters) {
3680
+ /**
3681
+ * @record
3682
+ */
3683
+ function Params() { }
3684
+ var Visit = /** @class */ (function () {
3685
+ function Visit(placeDefinition, visitParameters) {
3686
+ if (visitParameters === void 0) { visitParameters = {}; }
3581
3687
  this.placeDefinition = placeDefinition;
3582
- this.parameters = parameters;
3688
+ this.visitParameters = visitParameters;
3583
3689
  }
3690
+ // @Trace()
3691
+ // @Trace()
3584
3692
  /**
3585
- * @param {?} other
3586
- * @param {?=} debug
3587
- * @return {?}
3588
- */
3589
- ParameterSnapshot.prototype.hasChanged = /**
3590
- * @param {?} other
3591
- * @param {?=} debug
3592
- * @return {?}
3593
- */
3594
- function (other, debug) {
3595
- if (debug === void 0) { debug = false; }
3596
- /** @type {?} */
3597
- var changed = this.parameters.find((/**
3598
- * @param {?} r
3599
- * @return {?}
3600
- */
3601
- function (r) {
3602
- return r.hasChanged(other.getValueOf(r.definition));
3603
- }));
3604
- if (changed && debug) {
3605
- console.log({
3606
- name: changed.definition.name,
3607
- mine: changed.value,
3608
- theirs: other.getValueOf(changed.definition)
3609
- });
3610
- }
3611
- return !!changed;
3612
- };
3613
- /**
3614
- * @template T, S
3615
- * @param {?} parameterDef
3616
- * @return {?}
3617
- */
3618
- ParameterSnapshot.prototype.getParameter = /**
3619
- * @template T, S
3620
- * @param {?} parameterDef
3621
- * @return {?}
3622
- */
3623
- function (parameterDef) {
3624
- return this.parameters.find((/**
3625
- * @param {?} r
3626
- * @return {?}
3627
- */
3628
- function (r) { return r.definition === parameterDef; }));
3629
- };
3630
- /**
3631
- * @template T, S
3632
- * @param {?} parameterDef
3633
3693
  * @return {?}
3634
3694
  */
3635
- ParameterSnapshot.prototype.getValueOf = /**
3636
- * @template T, S
3637
- * @param {?} parameterDef
3695
+ Visit.prototype.getRouteId =
3696
+ // @Trace()
3697
+ /**
3638
3698
  * @return {?}
3639
3699
  */
3640
- function (parameterDef) {
3641
- /** @type {?} */
3642
- var resolvedParameter = this.getParameter(parameterDef);
3643
- return resolvedParameter ? resolvedParameter.value : null;
3700
+ function () {
3701
+ return this.placeDefinition.getRouteIdFrom(this);
3644
3702
  };
3703
+ // @Trace()
3704
+ // @Trace()
3645
3705
  /**
3646
3706
  * @return {?}
3647
3707
  */
3648
- ParameterSnapshot.prototype.getRouteIdValue = /**
3708
+ Visit.prototype.hasRouteId =
3709
+ // @Trace()
3710
+ /**
3649
3711
  * @return {?}
3650
3712
  */
3651
3713
  function () {
3652
- return this.getRouteIdParameter() ? this.getRouteIdParameter().value : null;
3714
+ return !___default.isNil(this.getRouteId());
3653
3715
  };
3654
3716
  /**
3655
- * @param {?} name
3656
- * @return {?}
3657
- */
3658
- ParameterSnapshot.prototype.getParameterValue = /**
3659
- * @param {?} name
3660
- * @return {?}
3717
+ * Returns the value of the place parameter with the specified name. The parameter
3718
+ * name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the
3719
+ * same as the the ValueModel property name.
3720
+ * @param parameterName the field name of the property model or the `as` option if specified.
3661
3721
  */
3662
- function (name) {
3663
- /** @type {?} */
3664
- var resolvedParameter = this.parameters.find((/**
3665
- * @param {?} r
3666
- * @return {?}
3667
- */
3668
- function (r) { return r.definition.name === name; }));
3669
- return resolvedParameter ? resolvedParameter.value : null;
3670
- };
3671
3722
  /**
3672
- * @private
3723
+ * Returns the value of the place parameter with the specified name. The parameter
3724
+ * name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the
3725
+ * same as the the ValueModel property name.
3726
+ * @param {?} parameterName the field name of the property model or the `as` option if specified.
3673
3727
  * @return {?}
3674
3728
  */
3675
- ParameterSnapshot.prototype.getRouteIdParameter = /**
3676
- * @private
3729
+ Visit.prototype.getParameter = /**
3730
+ * Returns the value of the place parameter with the specified name. The parameter
3731
+ * name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the
3732
+ * same as the the ValueModel property name.
3733
+ * @param {?} parameterName the field name of the property model or the `as` option if specified.
3677
3734
  * @return {?}
3678
3735
  */
3679
- function () {
3680
- // RouteId's are never arrays: see parameter-decorators.ts createDefinition methods. It would be nice to
3681
- // capture this in the type system though
3682
- return (/** @type {?} */ (this.parameters.find((/**
3683
- * @param {?} p
3684
- * @return {?}
3685
- */
3686
- function (p) { return p.definition.isRouteId; }))));
3736
+ function (parameterName) {
3737
+ return this.visitParameters[parameterName];
3687
3738
  };
3739
+ // @Trace()
3740
+ // @Trace()
3688
3741
  /**
3689
- * @private
3742
+ * @param {?} parameterName
3690
3743
  * @return {?}
3691
3744
  */
3692
- ParameterSnapshot.prototype.getRouteParameters = /**
3693
- * @private
3745
+ Visit.prototype.hasParameter =
3746
+ // @Trace()
3747
+ /**
3748
+ * @param {?} parameterName
3694
3749
  * @return {?}
3695
3750
  */
3696
- function () {
3697
- return this.parameters.filter((/**
3698
- * @param {?} r
3699
- * @return {?}
3700
- */
3701
- function (r) { return !r.definition.isRouteId; }));
3751
+ function (parameterName) {
3752
+ return Object.keys(this.visitParameters).includes(parameterName);
3702
3753
  };
3703
3754
  /**
3755
+ * @template S
3756
+ * @param {?} parameter
3757
+ * @param {?} value
3704
3758
  * @return {?}
3705
3759
  */
3706
- ParameterSnapshot.prototype.hasRouteId = /**
3760
+ Visit.prototype.replace = /**
3761
+ * @template S
3762
+ * @param {?} parameter
3763
+ * @param {?} value
3707
3764
  * @return {?}
3708
3765
  */
3709
- function () {
3710
- return !!this.getRouteIdParameter();
3766
+ function (parameter, value) {
3767
+ var _a;
3768
+ return new Visit(this.placeDefinition, __assign({}, this.visitParameters, (_a = {}, _a[parameter.name] = value, _a)));
3711
3769
  };
3712
3770
  /**
3771
+ * @template S
3772
+ * @param {?} routeParams
3713
3773
  * @return {?}
3714
3774
  */
3715
- ParameterSnapshot.prototype.getFormattedRouteId = /**
3775
+ Visit.prototype.mergeRouteParameters = /**
3776
+ * @template S
3777
+ * @param {?} routeParams
3716
3778
  * @return {?}
3717
3779
  */
3718
- function () {
3780
+ function (routeParams) {
3781
+ var _this = this;
3782
+ // todo: whitelist parameters.
3783
+ /** @type {?} */
3784
+ var routeParameterKeys = Object.keys(routeParams);
3719
3785
  /** @type {?} */
3720
- var routeIdParam = this.getRouteIdParameter();
3721
- return routeIdParam ? routeIdParam.formattedValue() : null;
3786
+ var params = {};
3787
+ this.placeDefinition.getVisitParameterDefs().forEach((/**
3788
+ * @param {?} def
3789
+ * @return {?}
3790
+ */
3791
+ function (def) {
3792
+ if (def.isRouteId || def.isRouteParameter) {
3793
+ if (routeParameterKeys.includes(def.name)) {
3794
+ params[def.name] = routeParams[def.name];
3795
+ }
3796
+ }
3797
+ else {
3798
+ // copy non route params as is, but only if they already exist otherwise we'll inject nil values and break the
3799
+ // defaults and remember sanitisation process.
3800
+ if (_this.hasParameter(def.name)) {
3801
+ params[def.name] = _this.getParameter(def.name);
3802
+ }
3803
+ }
3804
+ }));
3805
+ return new Visit(this.placeDefinition, params);
3722
3806
  };
3723
3807
  /**
3808
+ * @param {?} other
3724
3809
  * @return {?}
3725
3810
  */
3726
- ParameterSnapshot.prototype.getNonEmptyParameters = /**
3811
+ Visit.prototype.hasRoutingChangedFrom = /**
3812
+ * @param {?} other
3727
3813
  * @return {?}
3728
3814
  */
3729
- function () {
3730
- return this.parameters.filter((/**
3731
- * @param {?} p
3732
- * @return {?}
3733
- */
3734
- function (p) { return !p.isEmpty(); }));
3815
+ function (other) {
3816
+ /** @type {?} */
3817
+ var samePlace = other.placeDefinition === this.placeDefinition;
3818
+ /** @type {?} */
3819
+ var sameRouteParameters = ___default.isEqual(this.placeDefinition.getFormattedRouteParameters(this, true), this.placeDefinition.getFormattedRouteParameters(other, true));
3820
+ return !samePlace || !sameRouteParameters;
3735
3821
  };
3736
3822
  /**
3823
+ * @param {?} other
3737
3824
  * @return {?}
3738
3825
  */
3739
- ParameterSnapshot.prototype.getFormattedParameters = /**
3826
+ Visit.prototype.hasChangedFrom = /**
3827
+ * @param {?} other
3740
3828
  * @return {?}
3741
3829
  */
3742
- function () {
3743
- /** @type {?} */
3744
- var params = {};
3830
+ function (other) {
3745
3831
  /** @type {?} */
3746
- var routeIdParam = this.getNonEmptyParameters()
3747
- .filter((/**
3748
- * @param {?} p
3832
+ var sameNonRouteParameters = ___default.isEqual(this.placeDefinition.getNonRouteParameters(this), this.placeDefinition.getNonRouteParameters(other));
3833
+ return !sameNonRouteParameters || this.hasRoutingChangedFrom(other);
3834
+ };
3835
+ return Visit;
3836
+ }());
3837
+ if (false) {
3838
+ /** @type {?} */
3839
+ Visit.prototype.placeDefinition;
3840
+ /**
3841
+ * @type {?}
3842
+ * @private
3843
+ */
3844
+ Visit.prototype.visitParameters;
3845
+ }
3846
+
3847
+ /**
3848
+ * @fileoverview added by tsickle
3849
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3850
+ */
3851
+ var PlaceRouter = /** @class */ (function (_super) {
3852
+ __extends(PlaceRouter, _super);
3853
+ function PlaceRouter(router$1, angularLocation, placeHistory) {
3854
+ var _this = _super.call(this) || this;
3855
+ _this.router = router$1;
3856
+ _this.angularLocation = angularLocation;
3857
+ _this.placeHistory = placeHistory;
3858
+ _this.firstRoute = true;
3859
+ _this._navigationSessionModel = new pectin.MutableValueModel();
3860
+ _this._activeVisits = new pectin.MutableListModel();
3861
+ 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;
3862
+ _this.activeVisitIndex = chain(_this._activeVisits).indexBy('placeDefinition');
3863
+ angularLocation.onUrlChange((/**
3864
+ * @param {?} url
3749
3865
  * @return {?}
3750
3866
  */
3751
- function (p) { return !p.definition.isRouteId; }))
3752
- .forEach((/**
3753
- * @param {?} p
3867
+ function (url) {
3868
+ console.log("location.onUrlChange -> " + url);
3869
+ }));
3870
+ // TODO: make setup the callbacks in during module initiation to make this testable.
3871
+ _this.router.events.subscribe((/**
3872
+ * @param {?} event
3754
3873
  * @return {?}
3755
3874
  */
3756
- function (p) { return params[p.definition.name] = p.formattedValue(); }));
3757
- return params;
3758
- };
3875
+ function (event) {
3876
+ // Routing event sequence
3877
+ // ======================
3878
+ // NavigationStart -> .... -> NavigationCancel --> redirect, go around again in the same session
3879
+ // NavigationStart -> .... -> NavigationEnd --> navigation complete, end session.
3880
+ // NavigationStart -> .... -> NavigationError --> navigation canceled, end session.
3881
+ // =======================
3882
+ if (event instanceof router.NavigationStart) {
3883
+ _this.onAngularRouterStarted(event);
3884
+ }
3885
+ if (event instanceof router.NavigationEnd || event instanceof router.NavigationError) {
3886
+ _this.onAngularRouterFinished();
3887
+ }
3888
+ }));
3889
+ _this.navigationSessionActive = chain(_this.navigationSessionModel).isNotNil();
3890
+ _this.navigationSessionActive.subscribe((/**
3891
+ * @param {?} active
3892
+ * @return {?}
3893
+ */
3894
+ function (active) {
3895
+ console.log('navigationSessionActive', active);
3896
+ }));
3897
+ return _this;
3898
+ // const txo = new TransactionObserver().onEvent(e => console.log(e.toString()));
3899
+ // txo.observe('this.navigationSessionModel', this.navigationSessionModel);
3900
+ }
3901
+ Object.defineProperty(PlaceRouter.prototype, "navigationSession", {
3902
+ get: /**
3903
+ * @return {?}
3904
+ */
3905
+ function () {
3906
+ return this._navigationSessionModel.value;
3907
+ },
3908
+ enumerable: true,
3909
+ configurable: true
3910
+ });
3911
+ Object.defineProperty(PlaceRouter.prototype, "navigationSessionModel", {
3912
+ get: /**
3913
+ * @return {?}
3914
+ */
3915
+ function () {
3916
+ return this._navigationSessionModel.readonly;
3917
+ },
3918
+ enumerable: true,
3919
+ configurable: true
3920
+ });
3921
+ Object.defineProperty(PlaceRouter.prototype, "activeVisits", {
3922
+ get: /**
3923
+ * @return {?}
3924
+ */
3925
+ function () {
3926
+ return this._activeVisits.readonly;
3927
+ },
3928
+ enumerable: true,
3929
+ configurable: true
3930
+ });
3759
3931
  /**
3932
+ * placeRouter.navigate(placeDestinations.somePlace.createVisit(routeId, ...visitParams));
3933
+ * @param visit
3934
+ */
3935
+ // @Trace()
3936
+ /**
3937
+ * placeRouter.navigate(placeDestinations.somePlace.createVisit(routeId, ...visitParams));
3938
+ * @param {?} visit
3760
3939
  * @return {?}
3761
3940
  */
3762
- ParameterSnapshot.prototype.getAllParameters = /**
3941
+ // @Trace()
3942
+ PlaceRouter.prototype.navigate = /**
3943
+ * placeRouter.navigate(placeDestinations.somePlace.createVisit(routeId, ...visitParams));
3944
+ * @param {?} visit
3763
3945
  * @return {?}
3764
3946
  */
3765
- function () {
3766
- /** @type {?} */
3767
- var params = {};
3768
- /** @type {?} */
3769
- var routeIdParam = this.parameters.forEach((/**
3770
- * @param {?} p
3771
- * @return {?}
3772
- */
3773
- function (p) {
3774
- params[p.definition.name] = p.value;
3775
- }));
3776
- return params;
3947
+ // @Trace()
3948
+ function (visit) {
3949
+ return __awaiter(this, void 0, void 0, function () {
3950
+ return __generator(this, function (_a) {
3951
+ this.doNavigation(visit);
3952
+ return [2 /*return*/];
3953
+ });
3954
+ });
3777
3955
  };
3778
3956
  /**
3779
- * @template T, S
3780
- * @param {?} parameter
3781
- * @param {?} value
3957
+ * @param {?} activatedRoute
3958
+ * @param {?} previous
3959
+ * @param {?} next
3782
3960
  * @return {?}
3783
3961
  */
3784
- ParameterSnapshot.prototype.replace = /**
3785
- * @template T, S
3786
- * @param {?} parameter
3787
- * @param {?} value
3962
+ PlaceRouter.prototype.pushVisitChangesToRoute = /**
3963
+ * @param {?} activatedRoute
3964
+ * @param {?} previous
3965
+ * @param {?} next
3788
3966
  * @return {?}
3789
3967
  */
3790
- function (parameter, value) {
3791
- return new ParameterSnapshot(this.placeDefinition, this.parameters.map((/**
3792
- * @param {?} p
3793
- * @return {?}
3794
- */
3795
- function (p) {
3796
- return p.definition === parameter ? p.replace(value) : p;
3797
- })));
3968
+ function (activatedRoute, previous, next) {
3969
+ return __awaiter(this, void 0, void 0, function () {
3970
+ var _this = this;
3971
+ return __generator(this, function (_a) {
3972
+ // FIXME: no route id -> route id duplicates route parameters
3973
+ if (next.hasRoutingChangedFrom(previous)) {
3974
+ return [2 /*return*/, this.doNavigation(next, (/**
3975
+ * @param {?} router
3976
+ * @return {?}
3977
+ */
3978
+ function (router) {
3979
+ /** @type {?} */
3980
+ var relativePath = !!previous.placeDefinition.hasRouteId() ? '..' : '.';
3981
+ /** @type {?} */
3982
+ var def = next.placeDefinition;
3983
+ /** @type {?} */
3984
+ var params = next.hasRouteId() ?
3985
+ [def.getFormattedRouteId(next), def.getFormattedRouteParameters(next)] :
3986
+ [def.getFormattedRouteParameters(next)];
3987
+ /** @type {?} */
3988
+ var commands = [relativePath].concat(params, _this.getChildPath(activatedRoute.snapshot));
3989
+ console.log('### Redirect', commands);
3990
+ return router.navigate(commands, {
3991
+ relativeTo: activatedRoute
3992
+ });
3993
+ }))];
3994
+ }
3995
+ else {
3996
+ this.placeHistory.add(next);
3997
+ }
3998
+ return [2 /*return*/];
3999
+ });
4000
+ });
3798
4001
  };
3799
4002
  /**
3800
- * @param {?} injector
4003
+ * @param {?} visit
4004
+ * @param {?=} customNavigation
3801
4005
  * @return {?}
3802
4006
  */
3803
- ParameterSnapshot.prototype.sanitise = /**
3804
- * @param {?} injector
4007
+ PlaceRouter.prototype.doNavigation = /**
4008
+ * @param {?} visit
4009
+ * @param {?=} customNavigation
3805
4010
  * @return {?}
3806
4011
  */
3807
- function (injector) {
4012
+ function (visit, customNavigation) {
3808
4013
  return __awaiter(this, void 0, void 0, function () {
3809
- var routeId, sanitisedValue, result, routeParameters, i, routeParameter, sanitisedValue;
4014
+ var def, parameterCommands, commands;
3810
4015
  return __generator(this, function (_a) {
3811
4016
  switch (_a.label) {
3812
4017
  case 0:
3813
- if (!this.hasRouteId()) return [3 /*break*/, 2];
3814
- routeId = this.getRouteIdParameter();
3815
- return [4 /*yield*/, routeId.sanitise(this, injector)];
4018
+ this._navigationSessionModel.value = exports.NavigationSession.createInternal(visit);
4019
+ _a.label = 1;
3816
4020
  case 1:
3817
- sanitisedValue = _a.sent();
3818
- if (routeId.hasChanged(sanitisedValue)) {
3819
- // if the route id has changed we redirect immediately as other
3820
- // parameter sanitisers might use it.
3821
- return [2 /*return*/, this.replace(routeId.definition, sanitisedValue)];
3822
- }
3823
- _a.label = 2;
4021
+ _a.trys.push([1, , 6, 7]);
4022
+ if (!customNavigation) return [3 /*break*/, 3];
4023
+ return [4 /*yield*/, customNavigation(this.router)];
3824
4024
  case 2:
3825
- result = this;
3826
- routeParameters = this.getRouteParameters();
3827
- i = 0;
3828
- _a.label = 3;
4025
+ _a.sent();
4026
+ return [3 /*break*/, 5];
3829
4027
  case 3:
3830
- if (!(i < routeParameters.length)) return [3 /*break*/, 6];
3831
- routeParameter = routeParameters[i];
3832
- return [4 /*yield*/, routeParameter.sanitise(this, injector)];
4028
+ def = visit.placeDefinition;
4029
+ parameterCommands = visit.hasRouteId() ?
4030
+ [def.getFormattedRouteId(visit), def.getFormattedRouteParameters(visit)] :
4031
+ [def.getFormattedRouteParameters(visit)];
4032
+ commands = [def.path].concat(parameterCommands);
4033
+ console.log('_doNavigation', visit, commands);
4034
+ return [4 /*yield*/, this.router.navigate(commands)];
3833
4035
  case 4:
3834
- sanitisedValue = _a.sent();
3835
- if (routeParameter.hasChanged(sanitisedValue)) {
3836
- result = result.replace(routeParameter.definition, sanitisedValue);
3837
- }
4036
+ _a.sent();
3838
4037
  _a.label = 5;
3839
- case 5:
3840
- i++;
3841
- return [3 /*break*/, 3];
3842
- case 6: return [2 /*return*/, result];
4038
+ case 5: return [3 /*break*/, 7];
4039
+ case 6:
4040
+ if (this.navigationSession && !this.router.getCurrentNavigation()) {
4041
+ this.onAngularRouterFinished();
4042
+ }
4043
+ return [7 /*endfinally*/];
4044
+ case 7: return [2 /*return*/];
3843
4045
  }
3844
4046
  });
3845
4047
  });
3846
4048
  };
3847
- var _a;
3848
- __decorate([
3849
- src.Memoize(),
3850
- __metadata("design:type", Function),
3851
- __metadata("design:paramtypes", [exports.ParameterDefinition]),
3852
- __metadata("design:returntype", exports.RouteParameterValue)
3853
- ], ParameterSnapshot.prototype, "getParameter", null);
3854
- __decorate([
3855
- src.Memoize(),
3856
- __metadata("design:type", Function),
3857
- __metadata("design:paramtypes", [exports.ParameterDefinition]),
3858
- __metadata("design:returntype", typeof (_a = typeof S !== "undefined" && S) === "function" ? _a : Object)
3859
- ], ParameterSnapshot.prototype, "getValueOf", null);
3860
- __decorate([
3861
- src.Memoize(),
3862
- __metadata("design:type", Function),
3863
- __metadata("design:paramtypes", [String]),
3864
- __metadata("design:returntype", Object)
3865
- ], ParameterSnapshot.prototype, "getParameterValue", null);
3866
- __decorate([
3867
- src.Memoize(),
3868
- __metadata("design:type", Function),
3869
- __metadata("design:paramtypes", []),
3870
- __metadata("design:returntype", exports.RouteParameterValue.Scalar)
3871
- ], ParameterSnapshot.prototype, "getRouteIdParameter", null);
4049
+ // @Trace()
4050
+ // @Trace()
4051
+ /**
4052
+ * @private
4053
+ * @param {?} event
4054
+ * @return {?}
4055
+ */
4056
+ PlaceRouter.prototype.onAngularRouterStarted =
4057
+ // @Trace()
4058
+ /**
4059
+ * @private
4060
+ * @param {?} event
4061
+ * @return {?}
4062
+ */
4063
+ function (event) {
4064
+ if (!this.navigationSession) { // We been activated by an external route rather than placeRouter.go(visit)
4065
+ console.log('navigation started', { firstTime: this.firstRoute });
4066
+ /** @type {?} */
4067
+ var session = exports.NavigationSession.createExternal(this.firstRoute);
4068
+ if (event.navigationTrigger === 'popstate') {
4069
+ session.setPopstateReturn(this.router.routerState.snapshot.url);
4070
+ }
4071
+ this._navigationSessionModel.value = session;
4072
+ }
4073
+ this.firstRoute = false;
4074
+ };
4075
+ // @Trace()
4076
+ // @Trace()
4077
+ /**
4078
+ * @private
4079
+ * @return {?}
4080
+ */
4081
+ PlaceRouter.prototype.onAngularRouterFinished =
4082
+ // @Trace()
4083
+ /**
4084
+ * @private
4085
+ * @return {?}
4086
+ */
4087
+ function () {
4088
+ var _this = this;
4089
+ /** @type {?} */
4090
+ var session = this._navigationSessionModel.value;
4091
+ // Update visits before we end the navigation session. This allows the place out let to
4092
+ // gate ignore changes that occur while the visit is active
4093
+ /** @type {?} */
4094
+ var visits = session.getVisits();
4095
+ visits.forEach((/**
4096
+ * @param {?} v
4097
+ * @return {?}
4098
+ */
4099
+ function (v) {
4100
+ _this.placeHistory.add(v);
4101
+ }));
4102
+ this._activeVisits.value = visits;
4103
+ this._navigationSessionModel.value = null;
4104
+ };
4105
+ /**
4106
+ * @param {?} activatedRoute
4107
+ * @return {?}
4108
+ */
4109
+ PlaceRouter.prototype.getChildPath = /**
4110
+ * @param {?} activatedRoute
4111
+ * @return {?}
4112
+ */
4113
+ function (activatedRoute) {
4114
+ return ___default__default.flatten(activatedRoute.children.map((/**
4115
+ * @param {?} child
4116
+ * @return {?}
4117
+ */
4118
+ function (child) { return child.url; })));
4119
+ };
4120
+ PlaceRouter.decorators = [
4121
+ { type: core.Injectable, args: [{
4122
+ providedIn: 'root'
4123
+ },] }
4124
+ ];
4125
+ /** @nocollapse */
4126
+ PlaceRouter.ctorParameters = function () { return [
4127
+ { type: router.Router },
4128
+ { type: common.Location },
4129
+ { type: PlaceHistory }
4130
+ ]; };
4131
+ /** @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" });
3872
4132
  __decorate([
3873
- src.Memoize(),
4133
+ pectin.Trace(),
3874
4134
  __metadata("design:type", Function),
3875
- __metadata("design:paramtypes", []),
3876
- __metadata("design:returntype", Array)
3877
- ], ParameterSnapshot.prototype, "getRouteParameters", null);
3878
- return ParameterSnapshot;
3879
- }());
4135
+ __metadata("design:paramtypes", [router.ActivatedRoute, Visit, Visit]),
4136
+ __metadata("design:returntype", Promise)
4137
+ ], PlaceRouter.prototype, "pushVisitChangesToRoute", null);
4138
+ return PlaceRouter;
4139
+ }(pectin.GarbageCollector));
3880
4140
  if (false) {
3881
- /** @type {?} */
3882
- exports.ParameterSnapshot.prototype.placeDefinition;
3883
4141
  /**
3884
4142
  * @type {?}
3885
4143
  * @private
3886
4144
  */
3887
- exports.ParameterSnapshot.prototype.parameters;
3888
- }
3889
- (function (ParameterSnapshot) {
4145
+ PlaceRouter.prototype.firstRoute;
3890
4146
  /**
3891
- * @param {?} placeDef
3892
- * @param {?} params
3893
- * @param {?} urlSegments
3894
- * @return {?}
4147
+ * @type {?}
4148
+ * @private
3895
4149
  */
3896
- function create(placeDef, params, urlSegments) {
3897
- /** @type {?} */
3898
- var paramMap = new ConsolidatedParameterMap(params, urlSegments);
3899
- /** @type {?} */
3900
- var resolvedParameters = placeDef.getRouteParameters().map((/**
3901
- * @param {?} def
3902
- * @return {?}
3903
- */
3904
- function (def) { return exports.RouteParameterValue.create(def, paramMap); }));
3905
- return new ParameterSnapshot(placeDef, resolvedParameters);
3906
- }
3907
- ParameterSnapshot.create = create;
4150
+ PlaceRouter.prototype._navigationSessionModel;
3908
4151
  /**
3909
- * This a work around for the fact that an activated route with multiple segments doesn't
3910
- * include the segment params in the paramMap as well as each segment returns an empty
3911
- * param map even when `parameter`s has content.
4152
+ * @type {?}
4153
+ * @private
3912
4154
  */
3913
- var ConsolidatedParameterMap = /** @class */ (function () {
3914
- function ConsolidatedParameterMap(paramMap, urlSegments) {
3915
- this.paramMaps = [paramMap].concat((urlSegments || []).map((/**
3916
- * @param {?} s
3917
- * @return {?}
3918
- */
3919
- function (s) { return new ParamMapAdapter(s.parameters); }))).filter((/**
3920
- * @param {?} m
3921
- * @return {?}
3922
- */
3923
- function (m) { return !!m; })); // the activated route param map can be null
3924
- }
3925
- /**
3926
- * @param {?} name
3927
- * @return {?}
3928
- */
3929
- ConsolidatedParameterMap.prototype.get = /**
3930
- * @param {?} name
3931
- * @return {?}
3932
- */
3933
- function (name) {
3934
- return this.paramMaps.find((/**
3935
- * @param {?} m
3936
- * @return {?}
3937
- */
3938
- function (m) { return m.has(name); })).get(name);
3939
- };
3940
- /**
3941
- * @param {?} name
3942
- * @return {?}
3943
- */
3944
- ConsolidatedParameterMap.prototype.getAll = /**
3945
- * @param {?} name
3946
- * @return {?}
3947
- */
3948
- function (name) {
3949
- return this.paramMaps.find((/**
3950
- * @param {?} m
3951
- * @return {?}
3952
- */
3953
- function (m) { return m.has(name); })).getAll(name);
3954
- };
3955
- /**
3956
- * @param {?} name
3957
- * @return {?}
3958
- */
3959
- ConsolidatedParameterMap.prototype.has = /**
3960
- * @param {?} name
3961
- * @return {?}
3962
- */
3963
- function (name) {
3964
- return !!this.paramMaps.find((/**
3965
- * @param {?} m
3966
- * @return {?}
3967
- */
3968
- function (m) { return m.has(name); }));
3969
- };
3970
- Object.defineProperty(ConsolidatedParameterMap.prototype, "keys", {
3971
- get: /**
3972
- * @return {?}
3973
- */
3974
- function () {
3975
- return this.paramMaps.reduce((/**
3976
- * @param {?} result
3977
- * @param {?} params
3978
- * @return {?}
3979
- */
3980
- function (result, params) { return result.concat(params.keys); }), []);
3981
- },
3982
- enumerable: true,
3983
- configurable: true
3984
- });
3985
- __decorate([
3986
- src.Memoize(),
3987
- __metadata("design:type", Array),
3988
- __metadata("design:paramtypes", [])
3989
- ], ConsolidatedParameterMap.prototype, "keys", null);
3990
- return ConsolidatedParameterMap;
3991
- }());
3992
- if (false) {
3993
- /**
3994
- * @type {?}
3995
- * @private
3996
- */
3997
- ConsolidatedParameterMap.prototype.paramMaps;
3998
- }
3999
- var ParamMapAdapter = /** @class */ (function () {
4000
- function ParamMapAdapter(params) {
4001
- this.params = params;
4002
- }
4003
- /**
4004
- * @param {?} name
4005
- * @return {?}
4006
- */
4007
- ParamMapAdapter.prototype.get = /**
4008
- * @param {?} name
4009
- * @return {?}
4010
- */
4011
- function (name) {
4012
- return this.params[name];
4013
- };
4014
- /**
4015
- * @param {?} name
4016
- * @return {?}
4017
- */
4018
- ParamMapAdapter.prototype.getAll = /**
4019
- * @param {?} name
4020
- * @return {?}
4021
- */
4022
- function (name) {
4023
- /** @type {?} */
4024
- var value = this.get(name);
4025
- return Array.isArray(value) ? value : [value];
4026
- };
4027
- /**
4028
- * @param {?} name
4029
- * @return {?}
4030
- */
4031
- ParamMapAdapter.prototype.has = /**
4032
- * @param {?} name
4033
- * @return {?}
4034
- */
4035
- function (name) {
4036
- return this.keys.includes(name);
4037
- };
4038
- Object.defineProperty(ParamMapAdapter.prototype, "keys", {
4039
- get: /**
4040
- * @return {?}
4041
- */
4042
- function () {
4043
- return Object.keys(this.params);
4044
- },
4045
- enumerable: true,
4046
- configurable: true
4047
- });
4048
- return ParamMapAdapter;
4049
- }());
4050
- if (false) {
4051
- /**
4052
- * @type {?}
4053
- * @private
4054
- */
4055
- ParamMapAdapter.prototype.params;
4056
- }
4057
- })(exports.ParameterSnapshot || (exports.ParameterSnapshot = {}));
4155
+ PlaceRouter.prototype._activeVisits;
4156
+ /** @type {?} */
4157
+ PlaceRouter.prototype.navigationSessionActive;
4158
+ /** @type {?} */
4159
+ PlaceRouter.prototype.activeVisitIndex;
4160
+ /**
4161
+ * @type {?}
4162
+ * @private
4163
+ */
4164
+ PlaceRouter.prototype.router;
4165
+ /** @type {?} */
4166
+ PlaceRouter.prototype.angularLocation;
4167
+ /** @type {?} */
4168
+ PlaceRouter.prototype.placeHistory;
4169
+ }
4058
4170
 
4059
4171
  /**
4060
4172
  * @fileoverview added by tsickle
@@ -4132,63 +4244,62 @@
4132
4244
  }
4133
4245
  var PlaceOutletComponent = /** @class */ (function (_super) {
4134
4246
  __extends(PlaceOutletComponent, _super);
4135
- function PlaceOutletComponent(router, placeHistory) {
4247
+ function PlaceOutletComponent(router, placeRouter, placeHistory) {
4136
4248
  var _this = _super.call(this) || this;
4137
4249
  _this.router = router;
4250
+ _this.placeRouter = placeRouter;
4138
4251
  _this.placeHistory = placeHistory;
4139
4252
  _this.animate = true;
4253
+ _this.placeChanged = new core.EventEmitter();
4140
4254
  _this._activePlace = new pectin.MutableValueModel();
4141
- _this._incomingRouteChange = new pectin.Guard();
4142
4255
  _this._inOutletUpdate = new pectin.Guard();
4143
4256
  _this._activatedRouteModel = new pectin.MutableValueModel();
4144
4257
  _this._placeDefinition = new pectin.MutableValueModel();
4145
- _this._resolvedParameters = new pectin.MutableValueModel();
4258
+ /**
4259
+ * TODO: This is now really a visit
4260
+ */
4261
+ _this._placeVisit = new pectin.MutableValueModel();
4146
4262
  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;
4263
+ // Handle incoming route changes.
4147
4264
  /** @type {?} */
4148
- var paramMap = chain(_this._activatedRouteModel).pullObservableValue((/**
4149
- * @param {?} ar
4150
- * @return {?}
4151
- */
4152
- function (ar) { return ar.paramMap; }));
4265
+ var inRouteVisitUpdate = new pectin.Guard();
4153
4266
  /** @type {?} */
4154
- var urls = chain(_this._activatedRouteModel).pullObservableValue((/**
4155
- * @param {?} ar
4267
+ var routeVisit = chain(_this._activePlace).pluck('placeDefinition').findIn(placeRouter.activeVisitIndex);
4268
+ when.valueOf(routeVisit).changes((/**
4269
+ * @param {?} visit
4156
4270
  * @return {?}
4157
4271
  */
4158
- function (ar) { return ar.url; }));
4159
- _this.placeConfigured = valueOf.all(chain(_this._inOutletUpdate).isFalsey(), _this._placeDefinition, paramMap, urls).areTruthy();
4160
- when.anyOf(paramMap, urls).changes((/**
4161
- * @return {?}
4162
- */
4163
- function () {
4164
- /** @type {?} */
4165
- var snapshot = exports.ParameterSnapshot.create(_this._placeDefinition.value, paramMap.value, urls.value);
4166
- _this._incomingRouteChange.whileTrue((/**
4167
- * @return {?}
4168
- */
4169
- function () {
4170
- _this._resolvedParameters.value = snapshot;
4171
- _this.placeHistory.add(snapshot);
4172
- }));
4173
- }), {
4174
- postponeUntil: _this.placeConfigured
4175
- });
4176
- when.valueOf(_this._resolvedParameters).changes((/**
4272
+ function (visit) {
4273
+ if (visit) {
4274
+ inRouteVisitUpdate.whileTrue((/**
4275
+ * @return {?}
4276
+ */
4277
+ function () {
4278
+ _this._placeVisit.value = visit;
4279
+ }));
4280
+ }
4281
+ }));
4282
+ // Handle component based changes
4283
+ when.valueOf(_this._placeVisit).changes((/**
4177
4284
  * @param {?} next
4178
4285
  * @param {?} previous
4179
4286
  * @return {?}
4180
4287
  */
4181
4288
  function (next, previous) {
4182
- _this.placeHistory.add(next); // the above route change doesn't seem to propagate back in, so I'm add the state to the history manually for now.
4183
- _this.pushChangesToRoute(next, previous);
4289
+ _this.pushVisitChangesToRoute(next, previous);
4184
4290
  }), {
4185
- unless: _this.incomingRouteChange
4291
+ unless: inRouteVisitUpdate
4186
4292
  });
4293
+ chain(_this._activePlace)
4294
+ .postponeWhile(placeRouter.navigationSessionActive)
4295
+ .subscribe((/**
4296
+ * @param {?} place
4297
+ * @return {?}
4298
+ */
4299
+ function (place) { return _this.placeChanged.emit(place); }));
4187
4300
  return _this;
4188
4301
  // const txo = new TransactionObserver().onEvent(e => console.log(e.toString()));
4189
- // txo.observe('paramMap', paramMap);
4190
- // txo.observe('urls', urls);
4191
- // txo.observe('this._resolvedParameters', this._resolvedParameters);
4302
+ // txo.observe('inRouteVisitUpdate', inRouteVisitUpdate);
4192
4303
  }
4193
4304
  /**
4194
4305
  * @return {?}
@@ -4198,17 +4309,22 @@
4198
4309
  */
4199
4310
  function () {
4200
4311
  };
4201
- Object.defineProperty(PlaceOutletComponent.prototype, "incomingRouteChange", {
4202
- get: /**
4203
- * @return {?}
4204
- */
4205
- function () {
4206
- return this._incomingRouteChange;
4207
- },
4208
- enumerable: true,
4209
- configurable: true
4210
- });
4211
- Object.defineProperty(PlaceOutletComponent.prototype, "activePlace", {
4312
+ /**
4313
+ * @param {?} next
4314
+ * @param {?} previous
4315
+ * @return {?}
4316
+ */
4317
+ PlaceOutletComponent.prototype.pushVisitChangesToRoute = /**
4318
+ * @param {?} next
4319
+ * @param {?} previous
4320
+ * @return {?}
4321
+ */
4322
+ function (next, previous) {
4323
+ /** @type {?} */
4324
+ var activatedRoute = this._activatedRouteModel.value;
4325
+ this.placeRouter.pushVisitChangesToRoute(activatedRoute, previous, next);
4326
+ };
4327
+ Object.defineProperty(PlaceOutletComponent.prototype, "activePlaceModel", {
4212
4328
  get: /**
4213
4329
  * @return {?}
4214
4330
  */
@@ -4238,7 +4354,7 @@
4238
4354
  _this._activePlace.value = place;
4239
4355
  _this._activatedRouteModel.value = routerOutlet.activatedRoute;
4240
4356
  _this._placeDefinition.value = place.placeDefinition;
4241
- place.initialiseBindings(_this._resolvedParameters);
4357
+ place.initialiseBindings(_this._placeVisit);
4242
4358
  }
4243
4359
  catch (error) {
4244
4360
  console.error(error);
@@ -4293,32 +4409,15 @@
4293
4409
  }
4294
4410
  };
4295
4411
  /**
4296
- * @param {?} next
4297
- * @param {?} previous
4298
- * @return {?}
4299
- */
4300
- PlaceOutletComponent.prototype.pushChangesToRoute = /**
4301
- * @param {?} next
4302
- * @param {?} previous
4303
- * @return {?}
4304
- */
4305
- function (next, previous) {
4306
- /** @type {?} */
4307
- var activatedRoute = this._activatedRouteModel.value;
4308
- this.router.pushParameterChangesToRoute(activatedRoute, previous, next);
4309
- };
4310
- /**
4311
- * @param {?} snapshot
4312
- * @param {?} callback
4412
+ * @param {?} placeDestination
4313
4413
  * @return {?}
4314
4414
  */
4315
- PlaceOutletComponent.prototype.sanitise = /**
4316
- * @param {?} snapshot
4317
- * @param {?} callback
4415
+ PlaceOutletComponent.prototype.activate = /**
4416
+ * @param {?} placeDestination
4318
4417
  * @return {?}
4319
4418
  */
4320
- function (snapshot, callback) {
4321
- return snapshot;
4419
+ function (placeDestination) {
4420
+ // this.router.
4322
4421
  };
4323
4422
  PlaceOutletComponent.decorators = [
4324
4423
  { type: core.Component, args: [{
@@ -4330,11 +4429,13 @@
4330
4429
  ];
4331
4430
  /** @nocollapse */
4332
4431
  PlaceOutletComponent.ctorParameters = function () { return [
4432
+ { type: router.Router },
4333
4433
  { type: PlaceRouter },
4334
4434
  { type: PlaceHistory }
4335
4435
  ]; };
4336
4436
  PlaceOutletComponent.propDecorators = {
4337
4437
  animate: [{ type: core.Input }],
4438
+ placeChanged: [{ type: core.Output }],
4338
4439
  routerOut: [{ type: core.ViewChild, args: ['routeOutlet', { static: true },] }]
4339
4440
  };
4340
4441
  return PlaceOutletComponent;
@@ -4343,17 +4444,14 @@
4343
4444
  /** @type {?} */
4344
4445
  PlaceOutletComponent.prototype.animate;
4345
4446
  /** @type {?} */
4447
+ PlaceOutletComponent.prototype.placeChanged;
4448
+ /** @type {?} */
4346
4449
  PlaceOutletComponent.prototype.routerOut;
4347
4450
  /**
4348
4451
  * @type {?}
4349
4452
  * @private
4350
4453
  */
4351
4454
  PlaceOutletComponent.prototype._activePlace;
4352
- /**
4353
- * @type {?}
4354
- * @private
4355
- */
4356
- PlaceOutletComponent.prototype._incomingRouteChange;
4357
4455
  /**
4358
4456
  * @type {?}
4359
4457
  * @private
@@ -4369,18 +4467,21 @@
4369
4467
  * @private
4370
4468
  */
4371
4469
  PlaceOutletComponent.prototype._placeDefinition;
4372
- /** @type {?} */
4373
- PlaceOutletComponent.prototype._resolvedParameters;
4374
4470
  /**
4471
+ * TODO: This is now really a visit
4375
4472
  * @type {?}
4376
- * @private
4377
4473
  */
4378
- PlaceOutletComponent.prototype.placeConfigured;
4474
+ PlaceOutletComponent.prototype._placeVisit;
4379
4475
  /**
4380
4476
  * @type {?}
4381
4477
  * @private
4382
4478
  */
4383
4479
  PlaceOutletComponent.prototype.router;
4480
+ /**
4481
+ * @type {?}
4482
+ * @private
4483
+ */
4484
+ PlaceOutletComponent.prototype.placeRouter;
4384
4485
  /**
4385
4486
  * @type {?}
4386
4487
  * @private
@@ -4400,7 +4501,7 @@
4400
4501
  TabbedPlaceNavigationComponent.decorators = [
4401
4502
  { type: core.Component, args: [{
4402
4503
  selector: 'angular-ui-powerups-tabbed-place-navigation',
4403
- template: "<nav mat-tab-nav-bar>\n <a mat-tab-link *ngFor=\"let place of placeDefinitions.value\"\n [routerLink]='place.path'\n routerLinkActive #rla=\"routerLinkActive\"\n [active]=\"rla.isActive\"\n [matTooltip]=\"getNav(place).tooltip()\">\n <mat-icon *ngIf=\"getNav(place).icon()\">{{getNav(place).icon()}}</mat-icon>\n <span>{{getNav(place).title()}}</span>\n </a>\n</nav>\n",
4504
+ template: "<nav mat-tab-nav-bar>\n <a mat-tab-link *ngFor=\"let place of placeDefinitions.value\"\n [routerLink]='place.path'\n [replaceUrl]=\"true\"\n routerLinkActive #rla=\"routerLinkActive\"\n [active]=\"rla.isActive\"\n [matTooltip]=\"getNav(place).tooltip()\">\n <mat-icon *ngIf=\"getNav(place).icon()\">{{getNav(place).icon()}}</mat-icon>\n <span>{{getNav(place).title()}}</span>\n </a>\n</nav>\n",
4404
4505
  styles: [""]
4405
4506
  }] }
4406
4507
  ];
@@ -4464,7 +4565,8 @@
4464
4565
  NumberInputComponent,
4465
4566
  StringInputComponent,
4466
4567
  PasswordInputComponent,
4467
- SelectInputComponent
4568
+ SelectInputComponent,
4569
+ NoopComponent
4468
4570
  ],
4469
4571
  imports: [
4470
4572
  common.CommonModule,
@@ -4485,7 +4587,8 @@
4485
4587
  PasswordInputComponent,
4486
4588
  SelectInputComponent,
4487
4589
  InteractionModule,
4488
- PlaceModule
4590
+ PlaceModule,
4591
+ NoopComponent
4489
4592
  ]
4490
4593
  },] }
4491
4594
  ];
@@ -4857,12 +4960,25 @@
4857
4960
  * @fileoverview added by tsickle
4858
4961
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4859
4962
  */
4860
- var CloseInteractionGuard = /** @class */ (function () {
4861
- function CloseInteractionGuard(router, injector, interactionContext) {
4963
+ var InteractionGuard = /** @class */ (function () {
4964
+ function InteractionGuard(router, injector, interactionContext) {
4862
4965
  this.router = router;
4863
4966
  this.injector = injector;
4864
4967
  this.interactionContext = interactionContext;
4865
4968
  }
4969
+ /**
4970
+ * @param {?} route
4971
+ * @param {?} state
4972
+ * @return {?}
4973
+ */
4974
+ InteractionGuard.prototype.canActivate = /**
4975
+ * @param {?} route
4976
+ * @param {?} state
4977
+ * @return {?}
4978
+ */
4979
+ function (route, state) {
4980
+ return true;
4981
+ };
4866
4982
  /**
4867
4983
  * @param {?} component
4868
4984
  * @param {?} currentRoute
@@ -4870,7 +4986,7 @@
4870
4986
  * @param {?=} nextState
4871
4987
  * @return {?}
4872
4988
  */
4873
- CloseInteractionGuard.prototype.canDeactivate = /**
4989
+ InteractionGuard.prototype.canDeactivate = /**
4874
4990
  * @param {?} component
4875
4991
  * @param {?} currentRoute
4876
4992
  * @param {?} currentState
@@ -4880,36 +4996,48 @@
4880
4996
  function (component, currentRoute, currentState, nextState) {
4881
4997
  return !this.interactionContext.isActive();
4882
4998
  };
4883
- CloseInteractionGuard.decorators = [
4999
+ InteractionGuard.decorators = [
4884
5000
  { type: core.Injectable, args: [{
4885
5001
  providedIn: 'root'
4886
5002
  },] }
4887
5003
  ];
4888
5004
  /** @nocollapse */
4889
- CloseInteractionGuard.ctorParameters = function () { return [
5005
+ InteractionGuard.ctorParameters = function () { return [
4890
5006
  { type: router.Router },
4891
5007
  { type: core.Injector },
4892
5008
  { type: InteractionContext }
4893
5009
  ]; };
4894
- /** @nocollapse */ CloseInteractionGuard.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function CloseInteractionGuard_Factory() { return new CloseInteractionGuard(core.ɵɵinject(router.Router), core.ɵɵinject(core.INJECTOR), core.ɵɵinject(InteractionContext)); }, token: CloseInteractionGuard, providedIn: "root" });
4895
- return CloseInteractionGuard;
5010
+ /** @nocollapse */ InteractionGuard.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function InteractionGuard_Factory() { return new InteractionGuard(core.ɵɵinject(router.Router), core.ɵɵinject(core.INJECTOR), core.ɵɵinject(InteractionContext)); }, token: InteractionGuard, providedIn: "root" });
5011
+ __decorate([
5012
+ pectin.Trace(),
5013
+ __metadata("design:type", Function),
5014
+ __metadata("design:paramtypes", [router.ActivatedRouteSnapshot, router.RouterStateSnapshot]),
5015
+ __metadata("design:returntype", Object)
5016
+ ], InteractionGuard.prototype, "canActivate", null);
5017
+ __decorate([
5018
+ pectin.Trace(),
5019
+ __metadata("design:type", Function),
5020
+ __metadata("design:paramtypes", [NoopComponent, router.ActivatedRouteSnapshot, router.RouterStateSnapshot, router.RouterStateSnapshot]),
5021
+ __metadata("design:returntype", Object)
5022
+ ], InteractionGuard.prototype, "canDeactivate", null);
5023
+ return InteractionGuard;
4896
5024
  }());
4897
5025
  if (false) {
4898
5026
  /**
4899
5027
  * @type {?}
4900
5028
  * @private
4901
5029
  */
4902
- CloseInteractionGuard.prototype.router;
5030
+ InteractionGuard.prototype.router;
4903
5031
  /**
4904
5032
  * @type {?}
4905
5033
  * @private
4906
5034
  */
4907
- CloseInteractionGuard.prototype.injector;
5035
+ InteractionGuard.prototype.injector;
4908
5036
  /**
4909
5037
  * @type {?}
4910
5038
  * @private
4911
5039
  */
4912
- CloseInteractionGuard.prototype.interactionContext;
5040
+ InteractionGuard.prototype.interactionContext;
4913
5041
  }
4914
5042
 
4915
5043
  /**
@@ -4937,7 +5065,289 @@
4937
5065
  /**
4938
5066
  * @return {?}
4939
5067
  */
4940
- NavItem.prototype.tooltip = function () { };
5068
+ NavItem.prototype.tooltip = function () { };
5069
+ }
5070
+
5071
+ /**
5072
+ * @fileoverview added by tsickle
5073
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5074
+ */
5075
+ /**
5076
+ * @param {?} options
5077
+ * @return {?}
5078
+ */
5079
+ function Place(options) {
5080
+ return (/**
5081
+ * @param {?} target
5082
+ * @return {?}
5083
+ */
5084
+ function (target) {
5085
+ if (exports.PlaceComponent.isPlaceComponentConstructor(target)) {
5086
+ exports.PlaceComponent.injectDefinition(target, new exports.PlaceDefinition(target, options.path, ___default.isNil(options.authenticate) ? false : options.authenticate, options.order, options.data, exports.PlaceComponent.getRouteParameters(target), (options.children || []).map((/**
5087
+ * @param {?} c
5088
+ * @return {?}
5089
+ */
5090
+ function (c) { return exports.PlaceComponent.getDefinition(c); }))));
5091
+ }
5092
+ else {
5093
+ pectin.lang.illegalState(target + " must extend PlaceComponent to use the @Place decorator");
5094
+ }
5095
+ });
5096
+ }
5097
+ (function (Place) {
5098
+ /**
5099
+ * @record
5100
+ */
5101
+ function Options() { }
5102
+ Place.Options = Options;
5103
+ if (false) {
5104
+ /** @type {?} */
5105
+ Options.prototype.path;
5106
+ /** @type {?} */
5107
+ Options.prototype.order;
5108
+ /** @type {?|undefined} */
5109
+ Options.prototype.data;
5110
+ /** @type {?|undefined} */
5111
+ Options.prototype.authenticate;
5112
+ /** @type {?|undefined} */
5113
+ Options.prototype.children;
5114
+ }
5115
+ })(Place || (Place = {}));
5116
+
5117
+ /**
5118
+ * @fileoverview added by tsickle
5119
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5120
+ */
5121
+ // WARNING: interface has both a type and a value, skipping emit
5122
+
5123
+ (function (Formatter) {
5124
+ var StringType = /** @class */ (function () {
5125
+ function StringType() {
5126
+ }
5127
+ /**
5128
+ * @param {?} value
5129
+ * @return {?}
5130
+ */
5131
+ StringType.prototype.format = /**
5132
+ * @param {?} value
5133
+ * @return {?}
5134
+ */
5135
+ function (value) {
5136
+ return value;
5137
+ };
5138
+ /**
5139
+ * @param {?} value
5140
+ * @return {?}
5141
+ */
5142
+ StringType.prototype.parse = /**
5143
+ * @param {?} value
5144
+ * @return {?}
5145
+ */
5146
+ function (value) {
5147
+ return value;
5148
+ };
5149
+ return StringType;
5150
+ }());
5151
+ var NumberType = /** @class */ (function () {
5152
+ function NumberType() {
5153
+ }
5154
+ /**
5155
+ * @param {?} value
5156
+ * @return {?}
5157
+ */
5158
+ NumberType.prototype.format = /**
5159
+ * @param {?} value
5160
+ * @return {?}
5161
+ */
5162
+ function (value) {
5163
+ return ___default__default.isNumber(value) && !___default__default.isNaN(value) ? "" + value : null;
5164
+ };
5165
+ /**
5166
+ * @param {?} value
5167
+ * @return {?}
5168
+ */
5169
+ NumberType.prototype.parse = /**
5170
+ * @param {?} value
5171
+ * @return {?}
5172
+ */
5173
+ function (value) {
5174
+ /** @type {?} */
5175
+ var parsed = Number.parseFloat(value);
5176
+ return ___default__default.isNaN(parsed) ? null : parsed;
5177
+ };
5178
+ return NumberType;
5179
+ }());
5180
+ var BooleanType = /** @class */ (function () {
5181
+ function BooleanType() {
5182
+ }
5183
+ /**
5184
+ * @param {?} value
5185
+ * @return {?}
5186
+ */
5187
+ BooleanType.prototype.format = /**
5188
+ * @param {?} value
5189
+ * @return {?}
5190
+ */
5191
+ function (value) {
5192
+ return value ? 'true' : 'false';
5193
+ };
5194
+ /**
5195
+ * @param {?} value
5196
+ * @return {?}
5197
+ */
5198
+ BooleanType.prototype.parse = /**
5199
+ * @param {?} value
5200
+ * @return {?}
5201
+ */
5202
+ function (value) {
5203
+ return value === 'true';
5204
+ };
5205
+ return BooleanType;
5206
+ }());
5207
+ Formatter.STRING = new StringType();
5208
+ Formatter.NUMBER = new NumberType();
5209
+ Formatter.BOOLEAN = new BooleanType();
5210
+ })(exports.Formatter || (exports.Formatter = {}));
5211
+
5212
+ /**
5213
+ * @fileoverview added by tsickle
5214
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5215
+ */
5216
+ /**
5217
+ * @record
5218
+ */
5219
+ function JsonArray() { }
5220
+ /**
5221
+ * @record
5222
+ */
5223
+ function JsonMap() { }
5224
+
5225
+ /**
5226
+ * @fileoverview added by tsickle
5227
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5228
+ */
5229
+ /**
5230
+ * @record
5231
+ * @template T
5232
+ */
5233
+ function RouteIdOptions() { }
5234
+ if (false) {
5235
+ /** @type {?|undefined} */
5236
+ RouteIdOptions.prototype.as;
5237
+ /** @type {?|undefined} */
5238
+ RouteIdOptions.prototype.optional;
5239
+ /** @type {?|undefined} */
5240
+ RouteIdOptions.prototype.remember;
5241
+ /** @type {?|undefined} */
5242
+ RouteIdOptions.prototype.defaultValue;
5243
+ }
5244
+ /**
5245
+ * @record
5246
+ * @template T
5247
+ */
5248
+ function RouteParameterOptions() { }
5249
+ if (false) {
5250
+ /** @type {?|undefined} */
5251
+ RouteParameterOptions.prototype.as;
5252
+ /** @type {?|undefined} */
5253
+ RouteParameterOptions.prototype.optional;
5254
+ /** @type {?|undefined} */
5255
+ RouteParameterOptions.prototype.remember;
5256
+ /** @type {?|undefined} */
5257
+ RouteParameterOptions.prototype.defaultValue;
5258
+ /** @type {?|undefined} */
5259
+ RouteParameterOptions.prototype.storeInUrl;
5260
+ }
5261
+ /**
5262
+ * @record
5263
+ * @template T
5264
+ */
5265
+ function RouteListParameterOptions() { }
5266
+ if (false) {
5267
+ /** @type {?|undefined} */
5268
+ RouteListParameterOptions.prototype.as;
5269
+ /** @type {?|undefined} */
5270
+ RouteListParameterOptions.prototype.optional;
5271
+ /** @type {?|undefined} */
5272
+ RouteListParameterOptions.prototype.remember;
5273
+ /** @type {?|undefined} */
5274
+ RouteListParameterOptions.prototype.defaultValue;
5275
+ /** @type {?|undefined} */
5276
+ RouteListParameterOptions.prototype.storeInUrl;
5277
+ }
5278
+ /**
5279
+ * @template T
5280
+ * @param {?} type
5281
+ * @param {?=} options
5282
+ * @return {?}
5283
+ */
5284
+ function RouteId(type, options) {
5285
+ return (/**
5286
+ * @param {?} prototype
5287
+ * @param {?} propertyKey
5288
+ * @return {?}
5289
+ */
5290
+ function (prototype, propertyKey) {
5291
+ /** @type {?} */
5292
+ var param = new exports.ParameterDefinition.RouteId(propertyKey.toString(), options, type);
5293
+ typescriptUtilities.Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
5294
+ pectin.UseDelegate()(prototype, propertyKey);
5295
+ });
5296
+ }
5297
+ /**
5298
+ * @template T
5299
+ * @param {?=} options
5300
+ * @return {?}
5301
+ */
5302
+ function VisitParameter(options) {
5303
+ return (/**
5304
+ * @param {?} prototype
5305
+ * @param {?} propertyKey
5306
+ * @return {?}
5307
+ */
5308
+ function (prototype, propertyKey) {
5309
+ /** @type {?} */
5310
+ var param = new exports.ParameterDefinition.ValueParameter(propertyKey.toString(), options, options.storeInUrl);
5311
+ typescriptUtilities.Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
5312
+ pectin.UseDelegate()(prototype, propertyKey);
5313
+ });
5314
+ }
5315
+ /**
5316
+ * @template E
5317
+ * @param {?=} options
5318
+ * @return {?}
5319
+ */
5320
+ function VisitParameterList(options) {
5321
+ return (/**
5322
+ * @param {?} prototype
5323
+ * @param {?} propertyKey
5324
+ * @return {?}
5325
+ */
5326
+ function (prototype, propertyKey) {
5327
+ /** @type {?} */
5328
+ var param = new exports.ParameterDefinition.ArrayParameter(propertyKey.toString(), options, options.storeInUrl);
5329
+ typescriptUtilities.Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
5330
+ pectin.UseDelegate()(prototype, propertyKey);
5331
+ });
5332
+ }
5333
+
5334
+ /**
5335
+ * @fileoverview added by tsickle
5336
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5337
+ */
5338
+ /**
5339
+ * @record
5340
+ * @template S
5341
+ */
5342
+ function ParameterSanitiser() { }
5343
+ if (false) {
5344
+ /**
5345
+ * @param {?} parameterValue
5346
+ * @param {?=} visit
5347
+ * @param {?=} injector
5348
+ * @return {?}
5349
+ */
5350
+ ParameterSanitiser.prototype.sanitise = function (parameterValue, visit, injector) { };
4941
5351
  }
4942
5352
 
4943
5353
  /**
@@ -4945,67 +5355,116 @@
4945
5355
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4946
5356
  */
4947
5357
  /**
4948
- * @param {?} options
4949
- * @return {?}
5358
+ * @record
5359
+ * @template T
4950
5360
  */
4951
- function Place(options) {
4952
- return (/**
4953
- * @param {?} target
5361
+ function ParameterSnapshot() { }
5362
+ if (false) {
5363
+ /** @type {?} */
5364
+ ParameterSnapshot.prototype.definition;
5365
+ /** @type {?} */
5366
+ ParameterSnapshot.prototype.value;
5367
+ /**
4954
5368
  * @return {?}
4955
5369
  */
4956
- function (target) {
4957
- if (exports.PlaceComponent.isPlaceComponentConstructor(target)) {
4958
- exports.PlaceComponent.injectDefinition(target, new PlaceDefinition(target, options.path, ___default.isNil(options.authenticate) ? false : options.authenticate, options.order, options.data, exports.PlaceComponent.getRouteParameters(target), (options.children || []).map((/**
4959
- * @param {?} c
4960
- * @return {?}
4961
- */
4962
- function (c) { return exports.PlaceComponent.getDefinition(c); }))));
4963
- }
4964
- else {
4965
- pectin.lang.illegalState(target + " must extend PlaceComponent to use the @Place decorator");
4966
- }
4967
- });
5370
+ ParameterSnapshot.prototype.isMissing = function () { };
4968
5371
  }
4969
- (function (Place) {
4970
- /**
4971
- * @record
4972
- */
4973
- function Options() { }
4974
- Place.Options = Options;
4975
- if (false) {
4976
- /** @type {?} */
4977
- Options.prototype.path;
4978
- /** @type {?} */
4979
- Options.prototype.order;
4980
- /** @type {?|undefined} */
4981
- Options.prototype.data;
4982
- /** @type {?|undefined} */
4983
- Options.prototype.authenticate;
4984
- /** @type {?|undefined} */
4985
- Options.prototype.children;
4986
- }
4987
- })(Place || (Place = {}));
4988
5372
 
4989
5373
  /**
4990
5374
  * @fileoverview added by tsickle
4991
5375
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4992
5376
  */
4993
- /**
4994
- * @record
4995
- */
4996
- function Visit() { }
4997
- if (false) {
4998
- /** @type {?} */
4999
- Visit.prototype.placeDefinition;
5377
+ var VisitSanitiser = /** @class */ (function () {
5378
+ function VisitSanitiser(activatedRoute, router, placeHistory, injector) {
5379
+ this.activatedRoute = activatedRoute;
5380
+ this.router = router;
5381
+ this.placeHistory = placeHistory;
5382
+ this.injector = injector;
5383
+ }
5384
+ // @Trace()
5385
+ // @Trace()
5000
5386
  /**
5387
+ * @param {?} visit
5001
5388
  * @return {?}
5002
5389
  */
5003
- Visit.prototype.getRouteIdValue = function () { };
5390
+ VisitSanitiser.prototype.sanitise =
5391
+ // @Trace()
5004
5392
  /**
5005
- * @param {?} name
5393
+ * @param {?} visit
5006
5394
  * @return {?}
5007
5395
  */
5008
- Visit.prototype.getParameterValue = function (name) { };
5396
+ function (visit) {
5397
+ return __awaiter(this, void 0, void 0, function () {
5398
+ var placeDef, routeIdDef, routeId, sanitisedValue, parameterDefs, sanitisedVisit, i, def, value, sanitisedValue;
5399
+ return __generator(this, function (_a) {
5400
+ switch (_a.label) {
5401
+ case 0:
5402
+ placeDef = visit.placeDefinition;
5403
+ if (!placeDef.hasRouteId()) return [3 /*break*/, 2];
5404
+ routeIdDef = placeDef.getRouteIdParameterDef();
5405
+ routeId = visit.getRouteId();
5406
+ return [4 /*yield*/, routeIdDef.sanitise(routeId, visit, this.placeHistory, this.injector)];
5407
+ case 1:
5408
+ sanitisedValue = _a.sent();
5409
+ console.log({ routeId: routeId, sanitisedValue: sanitisedValue });
5410
+ // ###------- EARLY EXIT --------###
5411
+ if (routeIdDef.hasChanged(routeId, sanitisedValue)) {
5412
+ // if the route id has changed we redirect immediately as other
5413
+ // parameter sanitisers might use it.
5414
+ return [2 /*return*/, visit.replace(routeIdDef, sanitisedValue)];
5415
+ }
5416
+ _a.label = 2;
5417
+ case 2:
5418
+ // if we didn't replace the routeId we continue the url present parameters.
5419
+ parameterDefs = placeDef.getVisitParameterDefs({
5420
+ includeRouteParameters: true,
5421
+ includeNonRouteParameters: true
5422
+ });
5423
+ sanitisedVisit = visit;
5424
+ i = 0;
5425
+ _a.label = 3;
5426
+ case 3:
5427
+ if (!(i < parameterDefs.length)) return [3 /*break*/, 6];
5428
+ def = parameterDefs[i];
5429
+ value = visit.getParameter(def.name);
5430
+ return [4 /*yield*/, def.sanitise(value, sanitisedVisit, this.placeHistory, this.injector)];
5431
+ case 4:
5432
+ sanitisedValue = _a.sent();
5433
+ if (def.hasChanged(value, sanitisedValue)) {
5434
+ sanitisedVisit = sanitisedVisit.replace(def, sanitisedValue);
5435
+ }
5436
+ _a.label = 5;
5437
+ case 5:
5438
+ i++;
5439
+ return [3 /*break*/, 3];
5440
+ case 6: return [2 /*return*/, sanitisedVisit.hasChangedFrom(visit) ? sanitisedVisit : visit];
5441
+ }
5442
+ });
5443
+ });
5444
+ };
5445
+ return VisitSanitiser;
5446
+ }());
5447
+ if (false) {
5448
+ /**
5449
+ * @type {?}
5450
+ * @private
5451
+ */
5452
+ VisitSanitiser.prototype.activatedRoute;
5453
+ /**
5454
+ * @type {?}
5455
+ * @private
5456
+ */
5457
+ VisitSanitiser.prototype.router;
5458
+ /**
5459
+ * @type {?}
5460
+ * @private
5461
+ */
5462
+ VisitSanitiser.prototype.placeHistory;
5463
+ /**
5464
+ * @type {?}
5465
+ * @private
5466
+ */
5467
+ VisitSanitiser.prototype.injector;
5009
5468
  }
5010
5469
 
5011
5470
  /**
@@ -5020,6 +5479,22 @@
5020
5479
  this.interactionContext = interactionContext;
5021
5480
  this.angularLocation = angularLocation;
5022
5481
  }
5482
+ /**
5483
+ * @private
5484
+ * @param {?} nextState
5485
+ * @param {?} placeDefinitionPath
5486
+ * @return {?}
5487
+ */
5488
+ LeavePlaceGuard.prototype.isLeavingTheCurrentPlace = /**
5489
+ * @private
5490
+ * @param {?} nextState
5491
+ * @param {?} placeDefinitionPath
5492
+ * @return {?}
5493
+ */
5494
+ function (nextState, placeDefinitionPath) {
5495
+ // TODO: this will break with child routes... need to examine the router states properly.
5496
+ return !nextState.url.startsWith(placeDefinitionPath);
5497
+ };
5023
5498
  /**
5024
5499
  * @param {?} component
5025
5500
  * @param {?} currentRoute
@@ -5042,23 +5517,43 @@
5042
5517
  case 0:
5043
5518
  placeDefinitionPath = "/" + component.placeDefinition.path;
5044
5519
  if (!this.placeRouter.navigationSession.alreadyAccepted(component)) return [3 /*break*/, 1];
5520
+ // We'll get called multiple times if there's any parameter sanitisation so
5521
+ // we always return true if we accepted on a previous cycle of the current
5522
+ // navigation session.
5045
5523
  return [2 /*return*/, true];
5046
5524
  case 1:
5047
- if (!!nextState.url.startsWith(placeDefinitionPath)) return [3 /*break*/, 3];
5048
5525
  self_1 = this;
5526
+ canLeave = true;
5527
+ if (!this.isLeavingTheCurrentPlace(nextState, placeDefinitionPath)) return [3 /*break*/, 4];
5528
+ // we check the interaction first, so that components that don't need to check if they're in an
5529
+ // interaction during the canDeactivate cycle.
5530
+ // TODO: Add tests: show dialog -> hit back -> same route
5531
+ if (this.interactionContext.isActive()) {
5532
+ canLeave = false;
5533
+ console.log('cancelling', { activity: this.interactionContext.currentActivity });
5534
+ this.interactionContext.currentActivity.cancel(null);
5535
+ }
5536
+ if (!canLeave) return [3 /*break*/, 3];
5049
5537
  return [4 /*yield*/, component.canDeactivate()];
5050
5538
  case 2:
5539
+ // TODO: Add tests: hit back -> confirm leave dialog -> hit back -> close dialog -> hit back -> confirm leave dialog.
5051
5540
  canLeave = _a.sent();
5052
- // component is happy to leave but we need to check if it's left an interaction
5053
- // open. If so we close and stay where we are.
5054
- if (canLeave && this.interactionContext.isActive()) {
5055
- canLeave = false;
5056
- console.log("cancelling", { activity: this.interactionContext.currentActivity });
5541
+ _a.label = 3;
5542
+ case 3: return [3 /*break*/, 5];
5543
+ case 4:
5544
+ if (this.interactionContext.isActive()) {
5545
+ console.log('cancelling', { activity: this.interactionContext.currentActivity });
5057
5546
  this.interactionContext.currentActivity.cancel(null);
5547
+ canLeave = false;
5548
+ }
5549
+ else {
5550
+ canLeave = true;
5058
5551
  }
5059
- // If we're still leaving then remember it since angular will call this method multiple
5060
- // times if any route parameters are changed along the way.
5552
+ _a.label = 5;
5553
+ case 5:
5061
5554
  if (canLeave) {
5555
+ // We'll get called multiple times if there's any parameter sanitisation so
5556
+ // we remember the acceptance for the duration of the current navigation session.
5062
5557
  self_1.placeRouter.navigationSession.rememberAcceptanceOf(component);
5063
5558
  }
5064
5559
  else {
@@ -5066,11 +5561,10 @@
5066
5561
  // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
5067
5562
  if (this.placeRouter.navigationSession.isPopState) {
5068
5563
  console.log('cancelled during popstate');
5069
- this.angularLocation.go(this.placeRouter.navigationSession.initialUrl);
5564
+ this.angularLocation.go(this.placeRouter.navigationSession.popStateReturnUrl);
5070
5565
  }
5071
5566
  }
5072
5567
  return [2 /*return*/, canLeave];
5073
- case 3: return [2 /*return*/, true];
5074
5568
  }
5075
5569
  });
5076
5570
  });
@@ -5097,321 +5591,292 @@
5097
5591
  * @private
5098
5592
  */
5099
5593
  LeavePlaceGuard.prototype.router;
5100
- /**
5101
- * @type {?}
5102
- * @private
5103
- */
5104
- LeavePlaceGuard.prototype.injector;
5105
- /**
5106
- * @type {?}
5107
- * @private
5108
- */
5109
- LeavePlaceGuard.prototype.placeRouter;
5110
- /** @type {?} */
5111
- LeavePlaceGuard.prototype.interactionContext;
5112
- /** @type {?} */
5113
- LeavePlaceGuard.prototype.angularLocation;
5114
- }
5115
-
5116
- /**
5117
- * @fileoverview added by tsickle
5118
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5119
- */
5120
- var PlaceRouteGuard = /** @class */ (function () {
5121
- function PlaceRouteGuard(placeRouter, injector) {
5122
- this.placeRouter = placeRouter;
5123
- this.injector = injector;
5124
- }
5125
- /**
5126
- * @param {?} activatedRoute
5127
- * @param {?} state
5128
- * @return {?}
5129
- */
5130
- PlaceRouteGuard.prototype.canActivate = /**
5131
- * @param {?} activatedRoute
5132
- * @param {?} state
5133
- * @return {?}
5134
- */
5135
- function (activatedRoute, state) {
5136
- var _this = this;
5137
- if (exports.PlaceComponent.isPlaceComponentConstructor(activatedRoute.component)) {
5138
- /** @type {?} */
5139
- var placeDefinition = exports.PlaceComponent.getDefinition(activatedRoute.component);
5140
- /** @type {?} */
5141
- var snapshot_1 = exports.ParameterSnapshot.create(placeDefinition, activatedRoute.paramMap, activatedRoute.url);
5142
- return snapshot_1.sanitise(this.injector).then((/**
5143
- * @param {?} sanitised
5144
- * @return {?}
5145
- */
5146
- function (sanitised) {
5147
- pectin.Logger.get(_this).info("ParameterSnapshot.sanitise ->", sanitised.getAllParameters());
5148
- if (sanitised.hasChanged(snapshot_1, true)) {
5149
- return _this.placeRouter.getRedirectUrlTree(activatedRoute, sanitised);
5150
- }
5151
- else {
5152
- return true;
5153
- }
5154
- }));
5155
- }
5156
- else {
5157
- return pectin.lang.illegalState("expected component to be an instance of PlaceComponent, got " + activatedRoute.component);
5158
- }
5159
- };
5160
- PlaceRouteGuard.decorators = [
5161
- { type: core.Injectable, args: [{
5162
- providedIn: 'root'
5163
- },] }
5164
- ];
5165
- /** @nocollapse */
5166
- PlaceRouteGuard.ctorParameters = function () { return [
5167
- { type: PlaceRouter },
5168
- { type: core.Injector }
5169
- ]; };
5170
- /** @nocollapse */ PlaceRouteGuard.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function PlaceRouteGuard_Factory() { return new PlaceRouteGuard(core.ɵɵinject(PlaceRouter), core.ɵɵinject(core.INJECTOR)); }, token: PlaceRouteGuard, providedIn: "root" });
5171
- return PlaceRouteGuard;
5172
- }());
5173
- if (false) {
5174
- /**
5175
- * @type {?}
5176
- * @private
5177
- */
5178
- PlaceRouteGuard.prototype.placeRouter;
5179
- /**
5180
- * @type {?}
5181
- * @private
5182
- */
5183
- PlaceRouteGuard.prototype.injector;
5184
- }
5185
-
5186
- /**
5187
- * @fileoverview added by tsickle
5188
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5189
- */
5190
- /**
5191
- * @record
5192
- */
5193
- function JsonArray() { }
5194
- /**
5195
- * @record
5196
- */
5197
- function JsonMap() { }
5198
-
5199
- /**
5200
- * @fileoverview added by tsickle
5201
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5202
- */
5203
- /**
5204
- * @record
5205
- * @template T
5206
- */
5207
- function ParameterOptions() { }
5208
- if (false) {
5209
- /** @type {?|undefined} */
5210
- ParameterOptions.prototype.as;
5211
- /** @type {?|undefined} */
5212
- ParameterOptions.prototype.optional;
5213
- /** @type {?|undefined} */
5214
- ParameterOptions.prototype.remember;
5215
- /** @type {?|undefined} */
5216
- ParameterOptions.prototype.defaultValue;
5217
- }
5218
- /**
5219
- * @record
5220
- * @template T
5221
- */
5222
- function ListParameterOptions() { }
5223
- if (false) {
5224
- /** @type {?|undefined} */
5225
- ListParameterOptions.prototype.as;
5226
- /** @type {?|undefined} */
5227
- ListParameterOptions.prototype.optional;
5228
- /** @type {?|undefined} */
5229
- ListParameterOptions.prototype.remember;
5230
- /** @type {?|undefined} */
5231
- ListParameterOptions.prototype.defaultValue;
5232
- }
5233
- /**
5234
- * @template T
5235
- * @param {?} type
5236
- * @param {?=} options
5237
- * @return {?}
5238
- */
5239
- function RouteId(type, options) {
5240
- return (/**
5241
- * @param {?} prototype
5242
- * @param {?} propertyKey
5243
- * @return {?}
5244
- */
5245
- function (prototype, propertyKey) {
5246
- /** @type {?} */
5247
- var param = new exports.ParameterDefinition.RouteId(propertyKey.toString(), type, options);
5248
- typescriptUtilities.Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
5249
- pectin.UseDelegate()(prototype, propertyKey);
5250
- });
5251
- }
5252
- /**
5253
- * @template T
5254
- * @param {?} type
5255
- * @param {?=} options
5256
- * @return {?}
5257
- */
5258
- function RouteParameter(type, options) {
5259
- return (/**
5260
- * @param {?} prototype
5261
- * @param {?} propertyKey
5262
- * @return {?}
5594
+ /**
5595
+ * @type {?}
5596
+ * @private
5263
5597
  */
5264
- function (prototype, propertyKey) {
5265
- /** @type {?} */
5266
- var param = new exports.ParameterDefinition.ValueParameter(propertyKey.toString(), type, options);
5267
- typescriptUtilities.Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
5268
- pectin.UseDelegate()(prototype, propertyKey);
5269
- });
5270
- }
5271
- /**
5272
- * @template E
5273
- * @param {?} elementType
5274
- * @param {?=} options
5275
- * @return {?}
5276
- */
5277
- function RouteParameterList(elementType, options) {
5278
- return (/**
5279
- * @param {?} prototype
5280
- * @param {?} propertyKey
5281
- * @return {?}
5598
+ LeavePlaceGuard.prototype.injector;
5599
+ /**
5600
+ * @type {?}
5601
+ * @private
5282
5602
  */
5283
- function (prototype, propertyKey) {
5284
- /** @type {?} */
5285
- var param = new exports.ParameterDefinition.ArrayParameter(propertyKey.toString(), elementType, options);
5286
- typescriptUtilities.Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
5287
- pectin.UseDelegate()(prototype, propertyKey);
5288
- });
5603
+ LeavePlaceGuard.prototype.placeRouter;
5604
+ /** @type {?} */
5605
+ LeavePlaceGuard.prototype.interactionContext;
5606
+ /** @type {?} */
5607
+ LeavePlaceGuard.prototype.angularLocation;
5289
5608
  }
5290
5609
 
5291
5610
  /**
5292
5611
  * @fileoverview added by tsickle
5293
5612
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5294
5613
  */
5295
- /**
5296
- * @record
5297
- * @template S
5298
- */
5299
- function ParameterSanitiser() { }
5300
- if (false) {
5614
+ exports.PlaceRouteGuard = /** @class */ (function () {
5615
+ function PlaceRouteGuard(router, placeRouter, placeHistory, injector) {
5616
+ this.router = router;
5617
+ this.placeRouter = placeRouter;
5618
+ this.placeHistory = placeHistory;
5619
+ this.injector = injector;
5620
+ }
5621
+ // @Trace()
5622
+ // @Trace()
5301
5623
  /**
5302
- * @param {?} paramter
5303
- * @param {?=} visit
5624
+ * @param {?} activatedRoute
5625
+ * @param {?} state
5626
+ * @return {?}
5627
+ */
5628
+ PlaceRouteGuard.prototype.canActivate =
5629
+ // @Trace()
5630
+ /**
5631
+ * @param {?} activatedRoute
5632
+ * @param {?} state
5304
5633
  * @return {?}
5305
5634
  */
5306
- ParameterSanitiser.prototype.sanitise = function (paramter, visit) { };
5635
+ function (activatedRoute, state) {
5636
+ return __awaiter(this, void 0, void 0, function () {
5637
+ var placeDefinition, params, parsedParams, initialVisit, sanitiser, updatedVisit, parameterCommands, commands;
5638
+ return __generator(this, function (_a) {
5639
+ switch (_a.label) {
5640
+ case 0:
5641
+ if (!exports.PlaceComponent.isPlaceComponentConstructor(activatedRoute.component)) return [3 /*break*/, 2];
5642
+ placeDefinition = exports.PlaceComponent.getDefinition(activatedRoute.component);
5643
+ // Parse our route params.
5644
+ params = new PlaceRouteGuard.ConsolidatedParameterMap(activatedRoute.paramMap, activatedRoute.url);
5645
+ parsedParams = placeDefinition.parseRouteParams(params);
5646
+ initialVisit = this.placeRouter.navigationSession.getVisitFor(placeDefinition) || new Visit(placeDefinition, parsedParams);
5647
+ sanitiser = new VisitSanitiser(activatedRoute, this.router, this.placeHistory, this.injector);
5648
+ return [4 /*yield*/, sanitiser.sanitise(initialVisit.mergeRouteParameters(parsedParams))];
5649
+ case 1:
5650
+ updatedVisit = _a.sent();
5651
+ // Save the visit with any updated parameters. We need to save it so we remember any non route parameters
5652
+ this.placeRouter.navigationSession.storeVisit(updatedVisit);
5653
+ if (initialVisit.hasRoutingChangedFrom(updatedVisit)) {
5654
+ parameterCommands = updatedVisit.hasRouteId() ?
5655
+ [placeDefinition.getFormattedRouteId(updatedVisit), placeDefinition.getFormattedRouteParameters(updatedVisit)] :
5656
+ [placeDefinition.getFormattedRouteParameters(updatedVisit)];
5657
+ commands = [(activatedRoute.url[0].path)].concat(parameterCommands, this.placeRouter.getChildPath(activatedRoute));
5658
+ console.log('##### Redirect', commands);
5659
+ return [2 /*return*/, this.router.createUrlTree(commands, {
5660
+ replaceUrl: true,
5661
+ skipLocationChange: false
5662
+ })];
5663
+ }
5664
+ else {
5665
+ return [2 /*return*/, true];
5666
+ }
5667
+ return [3 /*break*/, 3];
5668
+ case 2: return [2 /*return*/, pectin.lang.illegalState("expected component to be an instance of PlaceComponent, got " + activatedRoute.component)];
5669
+ case 3: return [2 /*return*/];
5670
+ }
5671
+ });
5672
+ });
5673
+ };
5674
+ PlaceRouteGuard.decorators = [
5675
+ { type: core.Injectable, args: [{
5676
+ providedIn: 'root'
5677
+ },] }
5678
+ ];
5679
+ /** @nocollapse */
5680
+ PlaceRouteGuard.ctorParameters = function () { return [
5681
+ { type: router.Router },
5682
+ { type: PlaceRouter },
5683
+ { type: PlaceHistory },
5684
+ { type: core.Injector }
5685
+ ]; };
5686
+ /** @nocollapse */ PlaceRouteGuard.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function PlaceRouteGuard_Factory() { return new PlaceRouteGuard(core.ɵɵinject(router.Router), core.ɵɵinject(PlaceRouter), core.ɵɵinject(PlaceHistory), core.ɵɵinject(core.INJECTOR)); }, token: PlaceRouteGuard, providedIn: "root" });
5687
+ return PlaceRouteGuard;
5688
+ }());
5689
+ if (false) {
5690
+ /**
5691
+ * @type {?}
5692
+ * @private
5693
+ */
5694
+ exports.PlaceRouteGuard.prototype.router;
5695
+ /**
5696
+ * @type {?}
5697
+ * @private
5698
+ */
5699
+ exports.PlaceRouteGuard.prototype.placeRouter;
5700
+ /**
5701
+ * @type {?}
5702
+ * @private
5703
+ */
5704
+ exports.PlaceRouteGuard.prototype.placeHistory;
5705
+ /**
5706
+ * @type {?}
5707
+ * @private
5708
+ */
5709
+ exports.PlaceRouteGuard.prototype.injector;
5307
5710
  }
5308
-
5309
- /**
5310
- * @fileoverview added by tsickle
5311
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5312
- */
5313
- // WARNING: interface has both a type and a value, skipping emit
5314
-
5315
- (function (ParameterType) {
5316
- var StringType = /** @class */ (function () {
5317
- function StringType() {
5711
+ (function (PlaceRouteGuard) {
5712
+ /**
5713
+ * This a work around for the fact that an activated route with multiple segments doesn't
5714
+ * include the segment params in the paramMap as well as each segment returns an empty
5715
+ * param map even when `parameter`s has content.
5716
+ */
5717
+ var ConsolidatedParameterMap = /** @class */ (function () {
5718
+ function ConsolidatedParameterMap(paramMap, urlSegments) {
5719
+ this.paramMaps = [paramMap].concat((urlSegments || []).map((/**
5720
+ * @param {?} s
5721
+ * @return {?}
5722
+ */
5723
+ function (s) { return new ParamMapAdapter(s.parameters); }))).filter((/**
5724
+ * @param {?} m
5725
+ * @return {?}
5726
+ */
5727
+ function (m) { return !!m; })); // the activated route param map can be null
5318
5728
  }
5319
5729
  /**
5320
- * @param {?} value
5730
+ * @param {?} name
5321
5731
  * @return {?}
5322
5732
  */
5323
- StringType.prototype.format = /**
5324
- * @param {?} value
5733
+ ConsolidatedParameterMap.prototype.get = /**
5734
+ * @param {?} name
5325
5735
  * @return {?}
5326
5736
  */
5327
- function (value) {
5328
- return value;
5737
+ function (name) {
5738
+ /** @type {?} */
5739
+ var paramMap = this.paramMaps.find((/**
5740
+ * @param {?} m
5741
+ * @return {?}
5742
+ */
5743
+ function (m) { return m.has(name); }));
5744
+ return paramMap.get(name);
5329
5745
  };
5330
5746
  /**
5331
- * @param {?} value
5747
+ * @param {?} name
5332
5748
  * @return {?}
5333
5749
  */
5334
- StringType.prototype.parse = /**
5335
- * @param {?} value
5750
+ ConsolidatedParameterMap.prototype.getAll = /**
5751
+ * @param {?} name
5336
5752
  * @return {?}
5337
5753
  */
5338
- function (value) {
5339
- return value;
5754
+ function (name) {
5755
+ /** @type {?} */
5756
+ var paramMap = this.paramMaps.find((/**
5757
+ * @param {?} m
5758
+ * @return {?}
5759
+ */
5760
+ function (m) { return m.has(name); }));
5761
+ return paramMap.getAll(name);
5340
5762
  };
5341
- return StringType;
5342
- }());
5343
- var NumberType = /** @class */ (function () {
5344
- function NumberType() {
5345
- }
5346
5763
  /**
5347
- * @param {?} value
5764
+ * @param {?} name
5348
5765
  * @return {?}
5349
5766
  */
5350
- NumberType.prototype.format = /**
5351
- * @param {?} value
5767
+ ConsolidatedParameterMap.prototype.has = /**
5768
+ * @param {?} name
5352
5769
  * @return {?}
5353
5770
  */
5354
- function (value) {
5355
- return "" + value;
5771
+ function (name) {
5772
+ return !!this.paramMaps.find((/**
5773
+ * @param {?} m
5774
+ * @return {?}
5775
+ */
5776
+ function (m) { return m.has(name); }));
5356
5777
  };
5778
+ Object.defineProperty(ConsolidatedParameterMap.prototype, "keys", {
5779
+ get: /**
5780
+ * @return {?}
5781
+ */
5782
+ function () {
5783
+ return this.paramMaps.reduce((/**
5784
+ * @param {?} result
5785
+ * @param {?} params
5786
+ * @return {?}
5787
+ */
5788
+ function (result, params) { return result.concat(params.keys); }), []);
5789
+ },
5790
+ enumerable: true,
5791
+ configurable: true
5792
+ });
5793
+ __decorate([
5794
+ src.Memoize(),
5795
+ __metadata("design:type", Array),
5796
+ __metadata("design:paramtypes", [])
5797
+ ], ConsolidatedParameterMap.prototype, "keys", null);
5798
+ return ConsolidatedParameterMap;
5799
+ }());
5800
+ PlaceRouteGuard.ConsolidatedParameterMap = ConsolidatedParameterMap;
5801
+ if (false) {
5357
5802
  /**
5358
- * @param {?} value
5803
+ * @type {?}
5804
+ * @private
5805
+ */
5806
+ ConsolidatedParameterMap.prototype.paramMaps;
5807
+ }
5808
+ var ParamMapAdapter = /** @class */ (function () {
5809
+ function ParamMapAdapter(params) {
5810
+ this.params = params;
5811
+ }
5812
+ /**
5813
+ * @param {?} name
5359
5814
  * @return {?}
5360
5815
  */
5361
- NumberType.prototype.parse = /**
5362
- * @param {?} value
5816
+ ParamMapAdapter.prototype.get = /**
5817
+ * @param {?} name
5363
5818
  * @return {?}
5364
5819
  */
5365
- function (value) {
5366
- return ___default__default.isNil(value) || ___default__default.isEmpty(value) ? null : +value;
5820
+ function (name) {
5821
+ return this.params[name];
5367
5822
  };
5368
- return NumberType;
5369
- }());
5370
- var BooleanType = /** @class */ (function () {
5371
- function BooleanType() {
5372
- }
5373
5823
  /**
5374
- * @param {?} value
5824
+ * @param {?} name
5375
5825
  * @return {?}
5376
5826
  */
5377
- BooleanType.prototype.format = /**
5378
- * @param {?} value
5827
+ ParamMapAdapter.prototype.getAll = /**
5828
+ * @param {?} name
5379
5829
  * @return {?}
5380
5830
  */
5381
- function (value) {
5382
- return value ? 'true' : 'false';
5831
+ function (name) {
5832
+ /** @type {?} */
5833
+ var value = this.get(name);
5834
+ return Array.isArray(value) ? value : [value];
5383
5835
  };
5384
5836
  /**
5385
- * @param {?} value
5837
+ * @param {?} name
5386
5838
  * @return {?}
5387
5839
  */
5388
- BooleanType.prototype.parse = /**
5389
- * @param {?} value
5840
+ ParamMapAdapter.prototype.has = /**
5841
+ * @param {?} name
5390
5842
  * @return {?}
5391
5843
  */
5392
- function (value) {
5393
- return value === 'true';
5844
+ function (name) {
5845
+ return this.keys.includes(name);
5394
5846
  };
5395
- return BooleanType;
5847
+ Object.defineProperty(ParamMapAdapter.prototype, "keys", {
5848
+ get: /**
5849
+ * @return {?}
5850
+ */
5851
+ function () {
5852
+ return Object.keys(this.params);
5853
+ },
5854
+ enumerable: true,
5855
+ configurable: true
5856
+ });
5857
+ return ParamMapAdapter;
5396
5858
  }());
5397
- ParameterType.STRING = new StringType();
5398
- ParameterType.NUMBER = new NumberType();
5399
- ParameterType.BOOLEAN = new BooleanType();
5400
- })(exports.ParameterType || (exports.ParameterType = {}));
5859
+ if (false) {
5860
+ /**
5861
+ * @type {?}
5862
+ * @private
5863
+ */
5864
+ ParamMapAdapter.prototype.params;
5865
+ }
5866
+ })(exports.PlaceRouteGuard || (exports.PlaceRouteGuard = {}));
5401
5867
 
5402
5868
  exports.ACTIVITY_DATA = ACTIVITY_DATA;
5403
5869
  exports.AbstractActivity = AbstractActivity;
5404
5870
  exports.AbstractInputComponent = AbstractInputComponent;
5405
5871
  exports.AbstractPlaceNavigationComponent = AbstractPlaceNavigationComponent;
5406
- exports.Activity = exports.ɵba;
5872
+ exports.Activity = exports.ɵbb;
5407
5873
  exports.ActivityContainerComponent = ActivityContainerComponent;
5408
5874
  exports.ActivityOutletComponent = ActivityOutletComponent;
5409
5875
  exports.AlertDialogComponent = AlertDialogComponent;
5410
5876
  exports.AngularUiPowerupsModule = AngularUiPowerupsModule;
5411
5877
  exports.BusyOverlayComponent = BusyOverlayComponent;
5412
- exports.CloseInteractionGuard = CloseInteractionGuard;
5413
5878
  exports.CommandDirective = CommandDirective;
5414
- exports.ConfirmThenDialogComponent = exports.ɵbc;
5879
+ exports.ConfirmThenDialogComponent = exports.ɵbd;
5415
5880
  exports.ConfirmationDialogComponent = ConfirmationDialogComponent;
5416
5881
  exports.DEFINITION_META_DATA_KEY = DEFINITION_META_DATA_KEY;
5417
5882
  exports.DIALOG_INTERACTION_SERVICE_DEFAULTS = DIALOG_INTERACTION_SERVICE_DEFAULTS;
@@ -5421,59 +5886,64 @@
5421
5886
  exports.EmptyStateComponent = EmptyStateComponent;
5422
5887
  exports.FocusBindingDirective = FocusBindingDirective;
5423
5888
  exports.InteractionContext = InteractionContext;
5889
+ exports.InteractionGuard = InteractionGuard;
5424
5890
  exports.InteractionModule = InteractionModule;
5891
+ exports.InteractionOutletComponent = InteractionOutletComponent;
5425
5892
  exports.LEFT_RIGHT_PLACE_ANIMATION = LEFT_RIGHT_PLACE_ANIMATION;
5426
5893
  exports.LeavePlaceGuard = LeavePlaceGuard;
5427
5894
  exports.ListPlaceNavComponent = ListPlaceNavComponent;
5895
+ exports.NoopComponent = NoopComponent;
5428
5896
  exports.NumberInputComponent = NumberInputComponent;
5429
5897
  exports.PasswordInputComponent = PasswordInputComponent;
5430
5898
  exports.Place = Place;
5431
- exports.PlaceDefinition = PlaceDefinition;
5432
5899
  exports.PlaceHistory = PlaceHistory;
5433
5900
  exports.PlaceModule = PlaceModule;
5434
5901
  exports.PlaceOutletComponent = PlaceOutletComponent;
5435
- exports.PlaceRouteGuard = PlaceRouteGuard;
5436
5902
  exports.PlaceRouter = PlaceRouter;
5437
5903
  exports.Point = Point;
5438
5904
  exports.ROUTE_PARAMETER_LIST_KEY = ROUTE_PARAMETER_LIST_KEY;
5439
5905
  exports.ResizeAwareComponent = ResizeAwareComponent;
5440
5906
  exports.RouteId = RouteId;
5441
- exports.RouteParameter = RouteParameter;
5442
- exports.RouteParameterList = RouteParameterList;
5443
5907
  exports.SelectInputComponent = SelectInputComponent;
5444
5908
  exports.StringInputComponent = StringInputComponent;
5445
5909
  exports.TabbedPlaceNavigationComponent = TabbedPlaceNavigationComponent;
5910
+ exports.Visit = Visit;
5911
+ exports.VisitParameter = VisitParameter;
5912
+ exports.VisitParameterList = VisitParameterList;
5913
+ exports.VisitSanitiser = VisitSanitiser;
5446
5914
  exports.leftRightPlaceAnimation = leftRightPlaceAnimation;
5447
5915
  exports.slideDownAndUpAnimation = slideDownAndUpAnimation;
5448
5916
  exports.ɵa = CommandDirective;
5449
5917
  exports.ɵb = FocusBindingDirective;
5450
- exports.ɵbd = AlertDialogComponent;
5451
- exports.ɵbf = DIALOG_INTERACTION_SERVICE_DEFAULTS;
5452
- exports.ɵbg = DialogInteractionService;
5918
+ exports.ɵba = ACTIVITY_DATA;
5919
+ exports.ɵbe = AlertDialogComponent;
5920
+ exports.ɵbg = InteractionOutletComponent;
5921
+ exports.ɵbh = DIALOG_INTERACTION_SERVICE_DEFAULTS;
5922
+ exports.ɵbi = DialogInteractionService;
5453
5923
  exports.ɵc = DisposableComponent;
5454
5924
  exports.ɵd = NumberInputComponent;
5455
5925
  exports.ɵe = AbstractInputComponent;
5456
5926
  exports.ɵf = StringInputComponent;
5457
5927
  exports.ɵg = PasswordInputComponent;
5458
5928
  exports.ɵh = SelectInputComponent;
5459
- exports.ɵi = PlaceModule;
5460
- exports.ɵj = EmptyStateComponent;
5461
- exports.ɵk = BusyOverlayComponent;
5462
- exports.ɵl = PlaceOutletComponent;
5463
- exports.ɵm = leftRightPlaceAnimation;
5464
- exports.ɵn = LEFT_RIGHT_PLACE_ANIMATION;
5465
- exports.ɵo = PlaceRouter;
5466
- exports.ɵp = PlaceHistory;
5467
- exports.ɵq = TabbedPlaceNavigationComponent;
5468
- exports.ɵr = AbstractPlaceNavigationComponent;
5469
- exports.ɵs = ListPlaceNavComponent;
5470
- exports.ɵt = InteractionModule;
5471
- exports.ɵu = ActivityContainerComponent;
5472
- exports.ɵv = InteractionContext;
5473
- exports.ɵw = ActivityOutletComponent;
5474
- exports.ɵx = ConfirmationDialogComponent;
5475
- exports.ɵy = AbstractActivity;
5476
- exports.ɵz = ACTIVITY_DATA;
5929
+ exports.ɵi = NoopComponent;
5930
+ exports.ɵj = PlaceModule;
5931
+ exports.ɵk = EmptyStateComponent;
5932
+ exports.ɵl = BusyOverlayComponent;
5933
+ exports.ɵm = PlaceOutletComponent;
5934
+ exports.ɵn = leftRightPlaceAnimation;
5935
+ exports.ɵo = LEFT_RIGHT_PLACE_ANIMATION;
5936
+ exports.ɵp = PlaceRouter;
5937
+ exports.ɵq = PlaceHistory;
5938
+ exports.ɵr = TabbedPlaceNavigationComponent;
5939
+ exports.ɵs = AbstractPlaceNavigationComponent;
5940
+ exports.ɵt = ListPlaceNavComponent;
5941
+ exports.ɵu = InteractionModule;
5942
+ exports.ɵv = ActivityContainerComponent;
5943
+ exports.ɵw = InteractionContext;
5944
+ exports.ɵx = ActivityOutletComponent;
5945
+ exports.ɵy = ConfirmationDialogComponent;
5946
+ exports.ɵz = AbstractActivity;
5477
5947
 
5478
5948
  Object.defineProperty(exports, '__esModule', { value: true });
5479
5949