@coolon/angular-ui-powerups 0.0.43 → 0.0.44

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 (131) hide show
  1. package/bundles/coolon-angular-ui-powerups.umd.js +1165 -1181
  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 +16 -15
  6. package/coolon-angular-ui-powerups.metadata.json +1 -1
  7. package/esm2015/coolon-angular-ui-powerups.js +16 -15
  8. package/esm2015/index.js +2 -2
  9. package/esm2015/lib/components/disposable-component.js +1 -1
  10. package/esm2015/lib/components/forms/number-input/number-input.component.js +1 -1
  11. package/esm2015/lib/components/forms/password-input/password-input.component.js +1 -1
  12. package/esm2015/lib/components/forms/string-input/string-input.component.js +1 -1
  13. package/esm2015/lib/components/resize-aware.component.js +1 -1
  14. package/esm2015/lib/components/types/bounds.class.js +1 -1
  15. package/esm2015/lib/components/types/dimension.class.js +1 -1
  16. package/esm2015/lib/components/types/point.class.js +1 -1
  17. package/esm2015/lib/directives/command.directive.js +1 -1
  18. package/esm2015/lib/directives/focus-binding.directive.js +2 -2
  19. package/esm2015/lib/interaction/alert.js +1 -1
  20. package/esm2015/lib/interaction/components/activity-container/activity-container.component.js +2 -2
  21. package/esm2015/lib/interaction/components/activity-outlet/activity-outlet.component.js +6 -1
  22. package/esm2015/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.js +2 -2
  23. package/esm2015/lib/interaction/confirm.js +1 -1
  24. package/esm2015/lib/interaction/interaction.module.js +2 -2
  25. package/esm2015/lib/interaction/result.js +1 -1
  26. package/esm2015/lib/interaction/services/dialog-interaction.service.js +2 -2
  27. package/esm2015/lib/place/components/abstract-place-navigation.component.js +3 -2
  28. package/esm2015/lib/place/components/place-outlet/place-outlet.component.js +132 -86
  29. package/esm2015/lib/place/components/place-outlet/route-animations.js +2 -2
  30. package/esm2015/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.js +1 -1
  31. package/esm2015/lib/place/guards/leave-place.guard.js +12 -10
  32. package/esm2015/lib/place/guards/place-route.guard.js +40 -33
  33. package/esm2015/lib/place/index.js +5 -5
  34. package/esm2015/lib/place/nav-item.js +1 -1
  35. package/esm2015/lib/place/place-component.js +38 -168
  36. package/esm2015/lib/place/place-definition.js +79 -0
  37. package/esm2015/lib/place/place-history.js +54 -0
  38. package/esm2015/lib/place/place-router.js +83 -0
  39. package/esm2015/lib/place/place.decorator.js +30 -3
  40. package/esm2015/lib/place/place.module.js +2 -5
  41. package/esm2015/lib/place/route/default-parameter-sanitiser.js +10 -22
  42. package/esm2015/lib/place/route/json-types.js +1 -1
  43. package/esm2015/lib/place/route/parameter-decorators.js +7 -60
  44. package/esm2015/lib/place/route/parameter-definition.class.js +103 -8
  45. package/esm2015/lib/place/route/parameter-sanitiser.js +1 -15
  46. package/esm2015/lib/place/route/parameter-snapshot.js +13 -55
  47. package/esm2015/lib/place/route/parameter-type.js +2 -2
  48. package/esm2015/lib/place/route/route-parameter-sanitiser.js +6 -20
  49. package/esm2015/lib/place/visit.js +1 -1
  50. package/esm2015/public_api.js +2 -2
  51. package/esm5/coolon-angular-ui-powerups.js +16 -15
  52. package/esm5/index.js +2 -2
  53. package/esm5/lib/components/disposable-component.js +1 -1
  54. package/esm5/lib/components/forms/number-input/number-input.component.js +1 -1
  55. package/esm5/lib/components/forms/password-input/password-input.component.js +1 -1
  56. package/esm5/lib/components/forms/string-input/string-input.component.js +1 -1
  57. package/esm5/lib/components/resize-aware.component.js +1 -1
  58. package/esm5/lib/components/types/bounds.class.js +1 -1
  59. package/esm5/lib/components/types/dimension.class.js +1 -1
  60. package/esm5/lib/components/types/point.class.js +1 -1
  61. package/esm5/lib/directives/command.directive.js +1 -1
  62. package/esm5/lib/directives/focus-binding.directive.js +2 -2
  63. package/esm5/lib/interaction/alert.js +1 -1
  64. package/esm5/lib/interaction/components/activity-container/activity-container.component.js +2 -2
  65. package/esm5/lib/interaction/components/activity-outlet/activity-outlet.component.js +6 -1
  66. package/esm5/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.js +2 -2
  67. package/esm5/lib/interaction/confirm.js +1 -1
  68. package/esm5/lib/interaction/interaction.module.js +2 -2
  69. package/esm5/lib/interaction/result.js +1 -1
  70. package/esm5/lib/interaction/services/dialog-interaction.service.js +2 -2
  71. package/esm5/lib/place/components/abstract-place-navigation.component.js +3 -2
  72. package/esm5/lib/place/components/place-outlet/place-outlet.component.js +150 -115
  73. package/esm5/lib/place/components/place-outlet/route-animations.js +2 -2
  74. package/esm5/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.js +1 -1
  75. package/esm5/lib/place/guards/leave-place.guard.js +12 -10
  76. package/esm5/lib/place/guards/place-route.guard.js +40 -32
  77. package/esm5/lib/place/index.js +5 -5
  78. package/esm5/lib/place/nav-item.js +1 -1
  79. package/esm5/lib/place/place-component.js +52 -198
  80. package/esm5/lib/place/place-definition.js +88 -0
  81. package/esm5/lib/place/place-history.js +57 -0
  82. package/esm5/lib/place/place-router.js +101 -0
  83. package/esm5/lib/place/place.decorator.js +30 -3
  84. package/esm5/lib/place/place.module.js +2 -5
  85. package/esm5/lib/place/route/default-parameter-sanitiser.js +8 -20
  86. package/esm5/lib/place/route/json-types.js +1 -1
  87. package/esm5/lib/place/route/parameter-decorators.js +7 -60
  88. package/esm5/lib/place/route/parameter-definition.class.js +131 -8
  89. package/esm5/lib/place/route/parameter-sanitiser.js +1 -15
  90. package/esm5/lib/place/route/parameter-snapshot.js +25 -63
  91. package/esm5/lib/place/route/parameter-type.js +2 -2
  92. package/esm5/lib/place/route/route-parameter-sanitiser.js +6 -19
  93. package/esm5/lib/place/visit.js +1 -1
  94. package/esm5/public_api.js +2 -2
  95. package/fesm2015/coolon-angular-ui-powerups.js +944 -959
  96. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  97. package/fesm5/coolon-angular-ui-powerups.js +1147 -1167
  98. package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
  99. package/index.d.ts +1 -1
  100. package/lib/interaction/components/activity-outlet/activity-outlet.component.d.ts +7 -0
  101. package/lib/place/components/abstract-place-navigation.component.d.ts +3 -2
  102. package/lib/place/components/place-outlet/place-outlet.component.d.ts +31 -19
  103. package/lib/place/guards/place-route.guard.d.ts +7 -6
  104. package/lib/place/index.d.ts +3 -3
  105. package/lib/place/place-component.d.ts +13 -41
  106. package/lib/place/place-definition.d.ts +20 -0
  107. package/lib/place/place-history.d.ts +10 -0
  108. package/lib/place/place-router.d.ts +9 -0
  109. package/lib/place/place.decorator.d.ts +13 -1
  110. package/lib/place/route/default-parameter-sanitiser.d.ts +3 -5
  111. package/lib/place/route/parameter-decorators.d.ts +0 -4
  112. package/lib/place/route/parameter-definition.class.d.ts +29 -6
  113. package/lib/place/route/parameter-sanitiser.d.ts +0 -6
  114. package/lib/place/route/parameter-snapshot.d.ts +7 -7
  115. package/lib/place/route/route-parameter-sanitiser.d.ts +1 -3
  116. package/lib/place/visit.d.ts +2 -2
  117. package/package.json +1 -1
  118. package/schematics/place-routes/index.js.map +1 -1
  119. package/schematics/place-routes/place-def.js +1 -1
  120. package/schematics/place-routes/place-def.js.map +1 -1
  121. package/schematics/place-routes/templates/place-destinations.ts.template +21 -0
  122. package/schematics/place-routes/templates/{places.ts.template → place-routes.ts.template} +1 -13
  123. package/esm2015/lib/place/place-component-like.js +0 -17
  124. package/esm2015/lib/place/place-updates-service.js +0 -16
  125. package/esm2015/lib/place/place.service.js +0 -102
  126. package/esm5/lib/place/place-component-like.js +0 -17
  127. package/esm5/lib/place/place-updates-service.js +0 -16
  128. package/esm5/lib/place/place.service.js +0 -136
  129. package/lib/place/place-component-like.d.ts +0 -5
  130. package/lib/place/place-updates-service.d.ts +0 -10
  131. package/lib/place/place.service.d.ts +0 -22
@@ -5,7 +5,7 @@ import { MatDialog, MatButtonModule, MatDialogModule, MatTabsModule, MatProgress
5
5
  import { MatTabsModule as MatTabsModule$1 } from '@angular/material/tabs';
6
6
  import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
7
7
  import { __decorate, __metadata, __awaiter } from 'tslib';
8
- import { GarbageCollector, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, assert, UnaryCommand, lang, Dsl, Logger, EventListenerList, DelegatingValueModel, Trace, MutableListModel, StoreInValueModel, MutableValueModel, Binding, OptionsHelper, ValueHolder } from '@coolon/pectin';
8
+ import { GarbageCollector, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, assert, UnaryCommand, lang, Dsl, Logger, EventListenerList, DelegatingValueModel, Trace, MutableListModel, StoreInValueModel, Binding, Guard, MutableValueModel, OptionsHelper, ValueHolder } from '@coolon/pectin';
9
9
  import { PortalModule } from '@angular/cdk/portal';
10
10
  import { Deferred } from '@coolon/pectin/lib/promise/deferred.class';
11
11
  import { assert as assert$1, Klass, Opts } from '@coolon/typescript-utilities';
@@ -13,11 +13,11 @@ import { MatDialog as MatDialog$1 } from '@angular/material/dialog';
13
13
  import { MatIconModule } from '@angular/material/icon';
14
14
  import { MatListModule } from '@angular/material/list';
15
15
  import { MatTooltipModule } from '@angular/material/tooltip';
16
- import { Router, ActivatedRoute, RouterOutlet, RouterModule, PRIMARY_OUTLET } from '@angular/router';
17
- import { Memoize } from '@typescript-plus/fast-memoize-decorator/dist/src';
18
- import { Memoize as Memoize$1 } from '@typescript-plus/fast-memoize-decorator';
19
- import { isNil, isEqual, isEmpty, isFunction } from 'lodash';
16
+ import { Router, RouterModule } from '@angular/router';
17
+ import { Memoize as Memoize$1 } from '@typescript-plus/fast-memoize-decorator/dist/src';
18
+ import { Memoize } from '@typescript-plus/fast-memoize-decorator';
20
19
  import 'reflect-metadata';
20
+ import ___default, { isNil } from 'lodash';
21
21
  import { style, query, group, animate, trigger, transition } from '@angular/animations';
22
22
  import ResizeObserver from 'resize-observer-polyfill';
23
23
 
@@ -529,7 +529,7 @@ class FocusBindingDirective extends DisposableComponent {
529
529
  }));
530
530
  }
531
531
  else {
532
- Logger.get(this).warn("pectinFocusBinding was nil");
532
+ Logger.get(this).warn('pectinFocusBinding was nil');
533
533
  }
534
534
  }
535
535
  /**
@@ -713,6 +713,11 @@ if (false) {
713
713
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
714
714
  */
715
715
  /**
716
+ * ActivityOutletComponent creates and displays an activity and delegates the interaction context functionality to an
717
+ * external service.
718
+ *
719
+ * It might be nice to have wrapper component that allows more declarative use, i.e.
720
+ * <activity-view [activityClass]="...", [activityData]="..." (done)=".." (cancel)="..."></activity-view>
716
721
  * @template D, R, E
717
722
  */
718
723
  class ActivityOutletComponent {
@@ -1081,7 +1086,7 @@ class ConfirmationDialogComponent extends AbstractActivity {
1081
1086
  ConfirmationDialogComponent.decorators = [
1082
1087
  { type: Component, args: [{
1083
1088
  selector: 'angular-ui-powerups-confirmation-dialog',
1084
- 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'\" (click)=\"done(true)\">{{confirm.ok()}}</button>\n</p>\n\n",
1089
+ 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(true)\">{{confirm.ok()}}</button>\n</p>\n\n",
1085
1090
  styles: [":host{display:block;padding:var(--angular-ui-powerups-default-padding)}.mat-dialog-actions{justify-content:flex-end}"]
1086
1091
  }] }
1087
1092
  ];
@@ -1188,7 +1193,7 @@ class ActivityContainerComponent extends DisposableComponent {
1188
1193
  ActivityContainerComponent.decorators = [
1189
1194
  { type: Component, args: [{
1190
1195
  selector: 'angular-ui-powerups-activity-container',
1191
- template: "<mat-tab-group #tabs no-tab-header [dynamicHeight]=\"true\">\n <mat-tab>\n <angular-ui-powerups-activity-outlet [interactionContext]=\"this\" [activityContext]=\"initialActivityOutlet\"></angular-ui-powerups-activity-outlet>\n </mat-tab>\n <mat-tab *ngFor=\"let tab of activityOutletTabs.value\">\n <angular-ui-powerups-activity-outlet [interactionContext]=\"this\" [activityContext]=\"tab\"></angular-ui-powerups-activity-outlet>\n </mat-tab>\n</mat-tab-group>\n",
1196
+ template: "<mat-tab-group #tabs no-tab-header [dynamicHeight]=\"true\">\n <mat-tab>\n <angular-ui-powerups-activity-outlet [interactionContext]=\"this\"\n [activityContext]=\"initialActivityOutlet\"></angular-ui-powerups-activity-outlet>\n </mat-tab>\n <mat-tab *ngFor=\"let tab of activityOutletTabs.value\">\n <angular-ui-powerups-activity-outlet [interactionContext]=\"this\"\n [activityContext]=\"tab\"></angular-ui-powerups-activity-outlet>\n </mat-tab>\n</mat-tab-group>\n",
1192
1197
  styles: [":host{display:block}"]
1193
1198
  }] }
1194
1199
  ];
@@ -1450,851 +1455,907 @@ EmptyStateComponent.decorators = [
1450
1455
  /** @nocollapse */
1451
1456
  EmptyStateComponent.ctorParameters = () => [];
1452
1457
 
1453
- var _a;
1454
- // TODO: there are really two types of snapshot, ones with id's and ones without.
1455
- // Id snapshot are repesented by 2 url segments
1456
- // ID => [{'/basePath', params}, {'id', params}]
1457
- // NO ID => [{'/basePath', params}]
1458
- class ParameterSnapshot {
1458
+ /**
1459
+ * @fileoverview added by tsickle
1460
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1461
+ */
1462
+ class PlaceDefinition {
1459
1463
  /**
1460
- * @param {?} placeDefinition
1461
- * @param {?} resolved
1464
+ * @param {?} component
1465
+ * @param {?} path
1466
+ * @param {?} authenticate
1467
+ * @param {?} order
1468
+ * @param {?} data
1469
+ * @param {?} routeParameters
1470
+ * @param {?} children
1462
1471
  */
1463
- constructor(placeDefinition, resolved) {
1464
- this.placeDefinition = placeDefinition;
1465
- this.resolved = resolved;
1472
+ constructor(component, path, authenticate, order, data, routeParameters, children) {
1473
+ this.component = component;
1474
+ this.path = path;
1475
+ this.authenticate = authenticate;
1476
+ this.order = order;
1477
+ this.data = data;
1478
+ this.routeParameters = routeParameters;
1479
+ this.children = children;
1466
1480
  }
1467
1481
  /**
1468
- * @param {?} other
1469
1482
  * @return {?}
1470
1483
  */
1471
- hasChanged(other) {
1472
- /** @type {?} */
1473
- const changed = this.resolved.find((/**
1474
- * @param {?} r
1475
- * @return {?}
1476
- */
1477
- (r) => {
1478
- return !r.isSame(other.getResolvedParameterValue(r.parameterDef));
1479
- }));
1480
- if (changed) {
1481
- console.log({ mine: changed, theirs: other.getResolvedParameter(changed.parameterDef) });
1482
- }
1483
- return !!changed;
1484
+ getRouteParameters() {
1485
+ return this.routeParameters;
1484
1486
  }
1485
1487
  /**
1486
- * @param {?} other
1488
+ * @template T
1489
+ * @param {?} key
1490
+ * @param {?=} defaultValue
1487
1491
  * @return {?}
1488
1492
  */
1489
- asUrlSegment(other) {
1490
- assert.isTruthy(this.hasChanged(other));
1491
- /** @type {?} */
1492
- const routeParts = [];
1493
- /** @type {?} */
1494
- const gainedId = this.getFormattedRouteId() && !other.getFormattedRouteId();
1495
- /** @type {?} */
1496
- const sameId = this.getFormattedRouteId() === other.getFormattedRouteId();
1497
- /** @type {?} */
1498
- const lostId = (!this.getFormattedRouteId() && other.getFormattedRouteId());
1499
- /** @type {?} */
1500
- const changedId = (this.getFormattedRouteId() !== other.getFormattedRouteId());
1501
- if (lostId || changedId) {
1502
- routeParts.push('..');
1503
- if (changedId) {
1504
- routeParts.push(this.getFormattedRouteId());
1505
- }
1493
+ getData(key, defaultValue) {
1494
+ return this.data ?
1495
+ ___default.isNil(this.data[key]) ? defaultValue : this.data[key] :
1496
+ defaultValue;
1497
+ }
1498
+ /**
1499
+ * @template T
1500
+ * @param {?} keys
1501
+ * @param {?=} defaultValue
1502
+ * @return {?}
1503
+ */
1504
+ searchData(keys, defaultValue) {
1505
+ if (this.data) {
1506
+ /** @type {?} */
1507
+ const found = keys.find((/**
1508
+ * @param {?} key
1509
+ * @return {?}
1510
+ */
1511
+ key => !___default.isNil(this.data[key])));
1512
+ return found ? this.data[found] : defaultValue;
1506
1513
  }
1507
1514
  else {
1508
- routeParts.push('.');
1515
+ return defaultValue;
1509
1516
  }
1510
- routeParts.push(this.getFormattedParameters());
1511
- return routeParts;
1517
+ }
1518
+ }
1519
+ if (false) {
1520
+ /** @type {?} */
1521
+ PlaceDefinition.prototype.component;
1522
+ /** @type {?} */
1523
+ PlaceDefinition.prototype.path;
1524
+ /** @type {?} */
1525
+ PlaceDefinition.prototype.authenticate;
1526
+ /** @type {?} */
1527
+ PlaceDefinition.prototype.order;
1528
+ /** @type {?} */
1529
+ PlaceDefinition.prototype.data;
1530
+ /** @type {?} */
1531
+ PlaceDefinition.prototype.routeParameters;
1532
+ /** @type {?} */
1533
+ PlaceDefinition.prototype.children;
1534
+ }
1535
+
1536
+ /**
1537
+ * @fileoverview added by tsickle
1538
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1539
+ */
1540
+ // RAKE: making this Symbol(...) broke things.
1541
+ /** @type {?} */
1542
+ const DEFINITION_META_DATA_KEY = 'PLACE_DEFINITION_OPTIONS';
1543
+ // this one seems ok.
1544
+ /** @type {?} */
1545
+ const ROUTE_PARAMETER_LIST_KEY = Symbol('place:route:parameters');
1546
+ class PlaceComponent extends DisposableComponent {
1547
+ constructor() {
1548
+ super();
1512
1549
  }
1513
1550
  /**
1514
- * @template T, S
1515
- * @param {?} parameterDef
1551
+ * @param {?} resolvedParameters
1516
1552
  * @return {?}
1517
1553
  */
1518
- getResolvedParameter(parameterDef) {
1519
- return this.resolved.find((/**
1520
- * @param {?} r
1554
+ initialiseBindings(resolvedParameters) {
1555
+ assert.isNil(this.resolvedParameters);
1556
+ this.resolvedParameters = resolvedParameters;
1557
+ this.placeDefinition.getRouteParameters().forEach((/**
1558
+ * @param {?} parameterDef
1521
1559
  * @return {?}
1522
1560
  */
1523
- r => r.parameterDef === parameterDef));
1561
+ parameterDef => {
1562
+ this.installBinding(parameterDef);
1563
+ }));
1524
1564
  }
1525
1565
  /**
1566
+ * @private
1526
1567
  * @template T, S
1527
1568
  * @param {?} parameterDef
1528
1569
  * @return {?}
1529
1570
  */
1530
- getResolvedParameterValue(parameterDef) {
1571
+ installBinding(parameterDef) {
1531
1572
  /** @type {?} */
1532
- const resolvedParameter = this.getResolvedParameter(parameterDef);
1533
- return resolvedParameter ? resolvedParameter.value : null;
1573
+ const model = (/** @type {?} */ (this[parameterDef.propertyName]));
1574
+ // this.txo.observe(parameterDef.propertyName, model);
1575
+ this.registerDisposable(new Binding(this.resolvedParameters, model, {
1576
+ /**
1577
+ * @param {?} parameters
1578
+ * @return {?}
1579
+ */
1580
+ toRight(parameters) {
1581
+ return parameters.getResolvedParameterValue(parameterDef);
1582
+ },
1583
+ /**
1584
+ * @param {?} value
1585
+ * @param {?=} currentParameters
1586
+ * @return {?}
1587
+ */
1588
+ toLeft(value, currentParameters) {
1589
+ return currentParameters.replace(parameterDef, value);
1590
+ }
1591
+ }));
1534
1592
  }
1535
1593
  /**
1536
1594
  * @return {?}
1537
1595
  */
1538
- getRouteId() {
1539
- return this.getResolvedRouteId() ? this.getResolvedRouteId().value : null;
1596
+ get placeDefinition() {
1597
+ return PlaceComponent.getDefinition((/** @type {?} */ ((/** @type {?} */ (this.constructor)))));
1540
1598
  }
1541
1599
  /**
1542
- * @param {?} name
1543
1600
  * @return {?}
1544
1601
  */
1545
- getRouteParameter(name) {
1546
- /** @type {?} */
1547
- const resolvedParameter = this.resolved.find((/**
1548
- * @param {?} r
1602
+ get childPlaces() {
1603
+ return this.placeDefinition.children.map((/**
1604
+ * @param {?} d
1549
1605
  * @return {?}
1550
1606
  */
1551
- r => r.parameterDef.name === name));
1552
- return resolvedParameter ? resolvedParameter.value : null;
1607
+ d => d.component));
1608
+ }
1609
+ /**
1610
+ * @return {?}
1611
+ */
1612
+ canDeactivate() {
1613
+ return true;
1614
+ }
1615
+ /**
1616
+ * @return {?}
1617
+ */
1618
+ onPlaceReady() {
1553
1619
  }
1620
+ }
1621
+ __decorate([
1622
+ Memoize(),
1623
+ __metadata("design:type", PlaceDefinition),
1624
+ __metadata("design:paramtypes", [])
1625
+ ], PlaceComponent.prototype, "placeDefinition", null);
1626
+ if (false) {
1554
1627
  /**
1628
+ * @type {?}
1555
1629
  * @private
1630
+ */
1631
+ PlaceComponent.prototype.resolvedParameters;
1632
+ }
1633
+ (function (PlaceComponent) {
1634
+ /**
1635
+ * @param {?} target
1556
1636
  * @return {?}
1557
1637
  */
1558
- getResolvedRouteId() {
1559
- // RouteId's are never arrays: see parameter-decorators.ts createDefinition methods. It would be nice to
1560
- // capture this in the type system though
1561
- return (/** @type {?} */ (this.resolved.find((/**
1562
- * @param {?} p
1563
- * @return {?}
1564
- */
1565
- p => p.parameterDef.isRouteId))));
1638
+ function isPlaceComponentConstructor(target) {
1639
+ return lang.constructorChain((/** @type {?} */ (target))).includes(PlaceComponent);
1566
1640
  }
1641
+ PlaceComponent.isPlaceComponentConstructor = isPlaceComponentConstructor;
1567
1642
  /**
1643
+ * @param {?} klass
1568
1644
  * @return {?}
1569
1645
  */
1570
- hasRouteId() {
1571
- return !!this.getResolvedRouteId();
1646
+ function getRouteParameters(klass) {
1647
+ return Klass.get(klass).getMetadataList(ROUTE_PARAMETER_LIST_KEY);
1572
1648
  }
1649
+ PlaceComponent.getRouteParameters = getRouteParameters;
1573
1650
  /**
1651
+ * @param {?} klass
1574
1652
  * @return {?}
1575
1653
  */
1576
- getFormattedRouteId() {
1577
- /** @type {?} */
1578
- const routeIdParam = this.getResolvedRouteId();
1579
- return routeIdParam ? routeIdParam.formattedValue() : null;
1654
+ function getDefinition(klass) {
1655
+ return Reflect.getMetadata(DEFINITION_META_DATA_KEY, klass);
1580
1656
  }
1657
+ PlaceComponent.getDefinition = getDefinition;
1581
1658
  /**
1659
+ * @param {?} klass
1660
+ * @param {?} definition
1582
1661
  * @return {?}
1583
1662
  */
1584
- getFormattedParameters() {
1585
- /** @type {?} */
1586
- const params = {};
1587
- /** @type {?} */
1588
- const routeIdParam = this.resolved.filter((/**
1589
- * @param {?} p
1590
- * @return {?}
1591
- */
1592
- p => !p.parameterDef.isRouteId)).forEach((/**
1593
- * @param {?} p
1663
+ function injectDefinition(klass, definition) {
1664
+ Reflect.defineMetadata(DEFINITION_META_DATA_KEY, definition, klass);
1665
+ }
1666
+ PlaceComponent.injectDefinition = injectDefinition;
1667
+ })(PlaceComponent || (PlaceComponent = {}));
1668
+
1669
+ /**
1670
+ * @fileoverview added by tsickle
1671
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1672
+ */
1673
+ class AbstractPlaceNavigationComponent extends DisposableComponent {
1674
+ constructor() {
1675
+ super();
1676
+ const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
1677
+ this.placeDefinitions = chain(this.placesModel).map((/**
1678
+ * @param {?} c
1594
1679
  * @return {?}
1595
1680
  */
1596
- p => {
1597
- params[p.parameterDef.name] = p.formattedValue();
1598
- }));
1599
- return params;
1681
+ c => PlaceComponent.getDefinition(c)));
1600
1682
  }
1601
1683
  /**
1602
- * @template T, S
1603
- * @param {?} parameter
1604
- * @param {?} value
1684
+ * @param {?} placeDef
1605
1685
  * @return {?}
1606
1686
  */
1607
- replace(parameter, value) {
1608
- return new ParameterSnapshot(this.placeDefinition, this.resolved.map((/**
1609
- * @param {?} p
1610
- * @return {?}
1611
- */
1612
- p => {
1613
- return p.parameterDef === parameter ? p.replace(value) : p;
1614
- })));
1687
+ getNav(placeDef) {
1688
+ /** @type {?} */
1689
+ const navItem = (/** @type {?} */ (placeDef.getData('nav')));
1690
+ return {
1691
+ title: (/**
1692
+ * @return {?}
1693
+ */
1694
+ () => navItem ? navItem.title() : placeDef.searchData(['navTitle', 'title'])),
1695
+ tooltip: (/**
1696
+ * @return {?}
1697
+ */
1698
+ () => navItem && navItem.tooltip ? navItem.tooltip() : placeDef.getData('navTooltip', null)),
1699
+ icon: (/**
1700
+ * @return {?}
1701
+ */
1702
+ () => navItem && navItem.icon ? navItem.icon() : placeDef.getData('navIcon', null))
1703
+ };
1615
1704
  }
1616
1705
  /**
1617
- * @param {?} url
1618
1706
  * @return {?}
1619
1707
  */
1620
- updateUrl(url) {
1621
- return url;
1708
+ ngOnInit() {
1622
1709
  }
1623
1710
  }
1711
+ AbstractPlaceNavigationComponent.propDecorators = {
1712
+ places: [{ type: Input }],
1713
+ placesModel: [{ type: Input }]
1714
+ };
1624
1715
  __decorate([
1625
- Memoize(),
1626
- __metadata("design:type", Function),
1627
- __metadata("design:paramtypes", [Object]),
1628
- __metadata("design:returntype", ParameterSnapshot.ResolvedParameter)
1629
- ], ParameterSnapshot.prototype, "getResolvedParameter", null);
1716
+ StoreInListModel('placesModel'),
1717
+ __metadata("design:type", Array)
1718
+ ], AbstractPlaceNavigationComponent.prototype, "places", void 0);
1630
1719
  __decorate([
1631
- Memoize(),
1632
- __metadata("design:type", Function),
1633
- __metadata("design:paramtypes", [Object]),
1634
- __metadata("design:returntype", typeof (_a = typeof S !== "undefined" && S) === "function" ? _a : Object)
1635
- ], ParameterSnapshot.prototype, "getResolvedParameterValue", null);
1720
+ UseDelegate(),
1721
+ __metadata("design:type", ListModel)
1722
+ ], AbstractPlaceNavigationComponent.prototype, "placesModel", void 0);
1636
1723
  __decorate([
1637
- Memoize(),
1724
+ Memoize$1(),
1638
1725
  __metadata("design:type", Function),
1639
- __metadata("design:paramtypes", [String]),
1726
+ __metadata("design:paramtypes", [PlaceDefinition]),
1640
1727
  __metadata("design:returntype", Object)
1641
- ], ParameterSnapshot.prototype, "getRouteParameter", null);
1642
- __decorate([
1643
- Memoize(),
1644
- __metadata("design:type", Function),
1645
- __metadata("design:paramtypes", []),
1646
- __metadata("design:returntype", ParameterSnapshot.ResolvedValueParameter)
1647
- ], ParameterSnapshot.prototype, "getResolvedRouteId", null);
1728
+ ], AbstractPlaceNavigationComponent.prototype, "getNav", null);
1648
1729
  if (false) {
1649
1730
  /** @type {?} */
1650
- ParameterSnapshot.prototype.placeDefinition;
1651
- /**
1652
- * @type {?}
1653
- * @private
1654
- */
1655
- ParameterSnapshot.prototype.resolved;
1731
+ AbstractPlaceNavigationComponent.prototype.places;
1732
+ /** @type {?} */
1733
+ AbstractPlaceNavigationComponent.prototype.placesModel;
1734
+ /** @type {?} */
1735
+ AbstractPlaceNavigationComponent.prototype.placeDefinitions;
1656
1736
  }
1657
- (function (ParameterSnapshot) {
1658
- /**
1659
- * @param {?} placeDef
1660
- * @param {?} paramMap
1661
- * @return {?}
1662
- */
1663
- function create(placeDef, paramMap) {
1664
- /** @type {?} */
1665
- const resolvedParameters = placeDef.getRouteParameters()
1666
- .map((/**
1667
- * @param {?} def
1668
- * @return {?}
1669
- */
1670
- def => {
1671
- if (def.isArray) {
1672
- /** @type {?} */
1673
- const value = paramMap.has(def.name) ? paramMap.getAll(def.name).map((/**
1674
- * @param {?} raw
1675
- * @return {?}
1676
- */
1677
- raw => def.type.parse(raw))) : null;
1678
- return new ResolvedArrayParameter(def, value);
1679
- }
1680
- else {
1681
- /** @type {?} */
1682
- const value = paramMap.has(def.name) ? def.type.parse(paramMap.get(def.name)) : null;
1683
- return new ResolvedValueParameter(def, value);
1684
- }
1685
- }));
1686
- return new ParameterSnapshot(placeDef, resolvedParameters);
1737
+
1738
+ /**
1739
+ * @fileoverview added by tsickle
1740
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1741
+ */
1742
+ class ListPlaceNavComponent extends AbstractPlaceNavigationComponent {
1743
+ constructor() {
1744
+ super();
1745
+ this.expanded = true;
1687
1746
  }
1688
- ParameterSnapshot.create = create;
1689
1747
  /**
1690
- * @abstract
1691
- * @template T, S
1748
+ * @return {?}
1692
1749
  */
1693
- class ResolvedParameter {
1694
- /**
1695
- * @param {?} parameterDef
1696
- * @param {?} value
1697
- */
1698
- constructor(parameterDef, value) {
1699
- this.parameterDef = parameterDef;
1700
- this.value = value;
1701
- }
1702
- /**
1703
- * @return {?}
1704
- */
1705
- isRouteId() {
1706
- return this.parameterDef.isRouteId;
1707
- }
1708
- }
1709
- ParameterSnapshot.ResolvedParameter = ResolvedParameter;
1710
- if (false) {
1711
- /** @type {?} */
1712
- ResolvedParameter.prototype.parameterDef;
1713
- /** @type {?} */
1714
- ResolvedParameter.prototype.value;
1715
- /**
1716
- * @abstract
1717
- * @param {?} dest
1718
- * @return {?}
1719
- */
1720
- ResolvedParameter.prototype.injectRouteParam = function (dest) { };
1721
- /**
1722
- * @abstract
1723
- * @param {?} otherValue
1724
- * @return {?}
1725
- */
1726
- ResolvedParameter.prototype.isSame = function (otherValue) { };
1727
- /**
1728
- * @abstract
1729
- * @return {?}
1730
- */
1731
- ResolvedParameter.prototype.formattedValue = function () { };
1732
- /**
1733
- * @abstract
1734
- * @param {?} value
1735
- * @return {?}
1736
- */
1737
- ResolvedParameter.prototype.replace = function (value) { };
1750
+ expandMenu() {
1751
+ this.expanded = true;
1738
1752
  }
1739
1753
  /**
1740
- * @template T
1754
+ * @return {?}
1741
1755
  */
1742
- class ResolvedValueParameter extends ResolvedParameter {
1743
- /**
1744
- * @param {?} otherValue
1745
- * @return {?}
1746
- */
1747
- isSame(otherValue) {
1748
- return this.value === otherValue;
1749
- }
1750
- /**
1751
- * @param {?} dest
1752
- * @return {?}
1753
- */
1754
- injectRouteParam(dest) {
1755
- dest[this.parameterDef.name] = this.parameterDef.type.format(this.value);
1756
- }
1757
- /**
1758
- * @param {?} value
1759
- * @return {?}
1760
- */
1761
- replace(value) {
1762
- return new ResolvedValueParameter(this.parameterDef, value);
1763
- }
1764
- /**
1765
- * @return {?}
1766
- */
1767
- formattedValue() {
1768
- return !isNil(this.value) ? this.parameterDef.type.format(this.value) : null;
1769
- }
1756
+ collapseMenu() {
1757
+ this.expanded = false;
1770
1758
  }
1771
- __decorate([
1772
- Trace(),
1773
- __metadata("design:type", Function),
1774
- __metadata("design:paramtypes", [Object]),
1775
- __metadata("design:returntype", Boolean)
1776
- ], ResolvedValueParameter.prototype, "isSame", null);
1777
- ParameterSnapshot.ResolvedValueParameter = ResolvedValueParameter;
1778
1759
  /**
1779
- * @template T
1760
+ * @return {?}
1780
1761
  */
1781
- class ResolvedArrayParameter extends ResolvedParameter {
1782
- /**
1783
- * @param {?} otherValue
1784
- * @return {?}
1785
- */
1786
- isSame(otherValue) {
1787
- return isEqual(this.value, otherValue);
1788
- }
1789
- /**
1790
- * @param {?} dest
1791
- * @return {?}
1792
- */
1793
- injectRouteParam(dest) {
1794
- dest[this.parameterDef.name] = this.value.map((/**
1795
- * @param {?} v
1796
- * @return {?}
1797
- */
1798
- v => this.parameterDef.type.format(v)));
1799
- }
1800
- /**
1801
- * @param {?} value
1802
- * @return {?}
1803
- */
1804
- replace(value) {
1805
- return new ResolvedArrayParameter(this.parameterDef, value);
1806
- }
1807
- /**
1808
- * @return {?}
1809
- */
1810
- formattedValue() {
1811
- return this.value ? this.value.map((/**
1812
- * @param {?} v
1813
- * @return {?}
1814
- */
1815
- v => this.parameterDef.type.format(v))) : [];
1816
- }
1762
+ toggleMenu() {
1763
+ this.expanded = !this.expanded;
1817
1764
  }
1818
- __decorate([
1819
- Trace(),
1820
- __metadata("design:type", Function),
1821
- __metadata("design:paramtypes", [Array]),
1822
- __metadata("design:returntype", Boolean)
1823
- ], ResolvedArrayParameter.prototype, "isSame", null);
1824
- ParameterSnapshot.ResolvedArrayParameter = ResolvedArrayParameter;
1825
- })(ParameterSnapshot || (ParameterSnapshot = {}));
1765
+ }
1766
+ ListPlaceNavComponent.decorators = [
1767
+ { type: Component, args: [{
1768
+ selector: 'angular-ui-powerups-list-place-nav',
1769
+ 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",
1770
+ 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}"]
1771
+ }] }
1772
+ ];
1773
+ /** @nocollapse */
1774
+ ListPlaceNavComponent.ctorParameters = () => [];
1775
+ ListPlaceNavComponent.propDecorators = {
1776
+ expanded: [{ type: HostBinding, args: ['class.expanded',] }]
1777
+ };
1778
+ if (false) {
1779
+ /** @type {?} */
1780
+ ListPlaceNavComponent.prototype.expanded;
1781
+ }
1826
1782
 
1827
1783
  /**
1828
1784
  * @fileoverview added by tsickle
1829
1785
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1830
1786
  */
1831
- // RAKE: making this Symbol(...) broke things.
1832
- /** @type {?} */
1833
- const DEFINITION_META_DATA_KEY = 'PLACE_DEFINITION_OPTIONS';
1834
- // this one seems ok.
1835
- /** @type {?} */
1836
- const ROUTE_PARAMETER_LIST_KEY = Symbol('place:route:parameters');
1837
- class PlaceComponent extends DisposableComponent {
1787
+ class PlaceHistory {
1838
1788
  /**
1839
- * @param {?} activatedRoute
1840
- * @param {?} placeService
1789
+ * @param {?} router
1841
1790
  */
1842
- constructor(activatedRoute, placeService) {
1843
- super();
1844
- this.activatedRoute = activatedRoute;
1845
- this._incomingRouteChange = new MutableValueModel(false);
1846
- this.resolvedParameters = new MutableValueModel();
1847
- const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
1848
- this.placeDefinition.getRouteParameters().forEach((/**
1849
- * @param {?} p
1850
- * @return {?}
1851
- */
1852
- p => this.installBinding(p)));
1853
- observe.valuesFrom(activatedRoute.paramMap)
1854
- .last()
1855
- .map((/**
1856
- * @param {?} params
1857
- * @return {?}
1858
- */
1859
- params => ParameterSnapshot.create(this.placeDefinition, params)))
1860
- .subscribe((/**
1861
- * @param {?} resolvedParameters
1862
- * @return {?}
1863
- */
1864
- resolvedParameters => {
1865
- this._incomingRouteChange.value = true;
1866
- this.resolvedParameters.value = resolvedParameters;
1867
- this._incomingRouteChange.value = false;
1868
- }));
1869
- when.valueOf(this.resolvedParameters).changes((/**
1870
- * @param {?} params
1871
- * @param {?} previous
1872
- * @return {?}
1873
- */
1874
- (params, previous) => {
1875
- placeService.notifyRouteParametersChanged({
1876
- activatedRoute: this.activatedRoute,
1877
- next: params,
1878
- previous: previous,
1879
- updateRoute: !this.incomingRouteChange.value // we update the route if it's a component triggered change.
1880
- });
1881
- }));
1791
+ constructor(router) {
1792
+ this.router = router;
1793
+ this._history = [];
1882
1794
  }
1883
1795
  /**
1796
+ * @param {?} state
1884
1797
  * @return {?}
1885
1798
  */
1886
- get incomingRouteChange() {
1887
- return this._incomingRouteChange.readonly;
1799
+ add(state) {
1800
+ /** @type {?} */
1801
+ const previousState = ___default.last(this._history);
1802
+ if (!previousState || state.hasChanged(previousState)) {
1803
+ this._history.push(state);
1804
+ // limit our history to 100 visits
1805
+ this._history = this._history.slice(-100);
1806
+ }
1888
1807
  }
1808
+ }
1809
+ PlaceHistory.decorators = [
1810
+ { type: Injectable, args: [{
1811
+ providedIn: 'root'
1812
+ },] }
1813
+ ];
1814
+ /** @nocollapse */
1815
+ PlaceHistory.ctorParameters = () => [
1816
+ { type: Router }
1817
+ ];
1818
+ /** @nocollapse */ PlaceHistory.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceHistory_Factory() { return new PlaceHistory(ɵɵinject(Router)); }, token: PlaceHistory, providedIn: "root" });
1819
+ if (false) {
1889
1820
  /**
1821
+ * @type {?}
1890
1822
  * @private
1891
- * @template T, S
1892
- * @param {?} parameterDef
1893
- * @return {?}
1894
1823
  */
1895
- installBinding(parameterDef) {
1896
- /** @type {?} */
1897
- const model = (/** @type {?} */ (this[parameterDef.propertyName]));
1898
- // this.txo.observe(parameterDef.propertyName, model);
1899
- this.registerDisposable(new Binding(this.resolvedParameters, model, {
1900
- /**
1901
- * @param {?} parameters
1902
- * @return {?}
1903
- */
1904
- toRight(parameters) {
1905
- return parameters.getResolvedParameterValue(parameterDef);
1906
- },
1907
- /**
1908
- * @param {?} value
1909
- * @param {?=} currentParameters
1910
- * @return {?}
1911
- */
1912
- toLeft(value, currentParameters) {
1913
- return currentParameters.replace(parameterDef, value);
1914
- }
1915
- }));
1824
+ PlaceHistory.prototype._history;
1825
+ /**
1826
+ * @type {?}
1827
+ * @private
1828
+ */
1829
+ PlaceHistory.prototype.router;
1830
+ }
1831
+
1832
+ /**
1833
+ * @fileoverview added by tsickle
1834
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1835
+ */
1836
+ class PlaceRouter {
1837
+ /**
1838
+ * @param {?} router
1839
+ */
1840
+ constructor(router) {
1841
+ this.router = router;
1916
1842
  }
1917
1843
  /**
1844
+ * @param {?} activatedRoute
1845
+ * @param {?} previous
1846
+ * @param {?} next
1918
1847
  * @return {?}
1919
1848
  */
1920
- get placeDefinition() {
1921
- return PlaceComponent.getDefinition((/** @type {?} */ ((/** @type {?} */ (this.constructor)))));
1849
+ pushParameterChangesToRoute(activatedRoute, previous, next) {
1850
+ this.router.navigate(this.redirect(activatedRoute.snapshot, previous, next), {
1851
+ relativeTo: activatedRoute
1852
+ });
1922
1853
  }
1923
1854
  /**
1855
+ * @param {?} activatedRoute
1856
+ * @param {?} sanitised
1857
+ * @param {?} snapshot
1924
1858
  * @return {?}
1925
1859
  */
1926
- canDeactivate() {
1927
- return true;
1860
+ createUrlTree(activatedRoute, sanitised, snapshot) {
1861
+ return this.router.createUrlTree(this.redirect(activatedRoute, snapshot, sanitised));
1928
1862
  }
1929
- // @Trace()
1930
1863
  /**
1864
+ * @protected
1865
+ * @param {?} activatedRoute
1866
+ * @param {?} previous
1867
+ * @param {?} next
1931
1868
  * @return {?}
1932
1869
  */
1933
- onPlaceReady() {
1870
+ redirect(activatedRoute, previous, next) {
1871
+ /** @type {?} */
1872
+ const childSegments = ___default.flatten(activatedRoute.children.map((/**
1873
+ * @param {?} child
1874
+ * @return {?}
1875
+ */
1876
+ child => child.url)));
1877
+ /** @type {?} */
1878
+ const relativePath = !!previous.hasRouteId() ? '..' : '.';
1879
+ /** @type {?} */
1880
+ const routeId = next.getFormattedRouteId();
1881
+ /** @type {?} */
1882
+ const path = routeId ?
1883
+ [relativePath, routeId, next.getFormattedParameters()] :
1884
+ [relativePath, next.getFormattedParameters()];
1885
+ return path.concat(childSegments.map((/**
1886
+ * @param {?} s
1887
+ * @return {?}
1888
+ */
1889
+ s => s.path)));
1934
1890
  }
1935
1891
  }
1936
- __decorate([
1937
- Memoize$1(),
1938
- __metadata("design:type", PlaceComponent.Definition),
1939
- __metadata("design:paramtypes", [])
1940
- ], PlaceComponent.prototype, "placeDefinition", null);
1892
+ PlaceRouter.decorators = [
1893
+ { type: Injectable, args: [{
1894
+ providedIn: 'root'
1895
+ },] }
1896
+ ];
1897
+ /** @nocollapse */
1898
+ PlaceRouter.ctorParameters = () => [
1899
+ { type: Router }
1900
+ ];
1901
+ /** @nocollapse */ PlaceRouter.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(ɵɵinject(Router)); }, token: PlaceRouter, providedIn: "root" });
1941
1902
  if (false) {
1942
- /** @type {?} */
1943
- PlaceComponent.prototype._incomingRouteChange;
1944
1903
  /**
1945
1904
  * @type {?}
1946
1905
  * @private
1947
1906
  */
1948
- PlaceComponent.prototype.resolvedParameters;
1907
+ PlaceRouter.prototype.router;
1908
+ }
1909
+
1910
+ /**
1911
+ * @fileoverview added by tsickle
1912
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1913
+ */
1914
+ /**
1915
+ * @abstract
1916
+ * @template T, S
1917
+ */
1918
+ class ParameterDefinition {
1919
+ /**
1920
+ * @param {?} propertyName
1921
+ * @param {?} type
1922
+ * @param {?} options
1923
+ */
1924
+ constructor(propertyName, type, options) {
1925
+ this.propertyName = propertyName;
1926
+ this.type = type;
1927
+ /** @type {?} */
1928
+ const opts = Opts.get(options);
1929
+ this.name = opts.getOptional('as', propertyName);
1930
+ // this.sanitiser = new DefaultParameterSanitiser(
1931
+ // this,
1932
+ // opts.getOptional('remember', false),
1933
+ // opts.getOptional('defaultValue', null)
1934
+ // );
1935
+ }
1936
+ /**
1937
+ * @param {?} injector
1938
+ * @return {?}
1939
+ */
1940
+ getSanitiser(injector) {
1941
+ return this.sanitiser;
1942
+ }
1943
+ }
1944
+ if (false) {
1945
+ /** @type {?} */
1946
+ ParameterDefinition.prototype.isRouteId;
1947
+ /** @type {?} */
1948
+ ParameterDefinition.prototype.isArray;
1949
+ /** @type {?} */
1950
+ ParameterDefinition.prototype.name;
1949
1951
  /** @type {?} */
1950
- PlaceComponent.prototype.activatedRoute;
1952
+ ParameterDefinition.prototype.sanitiser;
1953
+ /** @type {?} */
1954
+ ParameterDefinition.prototype.propertyName;
1955
+ /** @type {?} */
1956
+ ParameterDefinition.prototype.type;
1951
1957
  }
1952
- (function (PlaceComponent) {
1953
- class Definition {
1954
- /**
1955
- * @param {?} component
1956
- * @param {?} options
1957
- */
1958
- constructor(component, options) {
1959
- this.component = component;
1960
- assert.notNil(options);
1961
- this.path = options.path;
1962
- this.order = options.order;
1963
- this.data = options.data;
1964
- this.authenticate = isNil(options.authenticate) || options.authenticate;
1965
- this.children = (options.children || []).map((/**
1966
- * @param {?} c
1967
- * @return {?}
1968
- */
1969
- c => PlaceComponent.getDefinition(c).component));
1970
- }
1971
- /**
1972
- * @return {?}
1973
- */
1974
- getRouteParameters() {
1975
- return Klass.get(this.component).getMetadataList(ROUTE_PARAMETER_LIST_KEY);
1976
- }
1977
- /**
1978
- * @param {?} constructable
1979
- * @return {?}
1980
- */
1981
- isDescriptorForType(constructable) {
1982
- return lang.constructorChain(constructable).includes(PlaceComponent);
1983
- }
1984
- /**
1985
- * @param {?} placeComponent
1986
- * @return {?}
1987
- */
1988
- isDescriptorFor(placeComponent) {
1989
- return placeComponent.constructor === this.component;
1990
- }
1991
- /**
1992
- * @template T
1993
- * @param {?} key
1994
- * @param {?=} defaultValue
1995
- * @return {?}
1996
- */
1997
- getData(key, defaultValue) {
1998
- return this.data ?
1999
- isNil(this.data[key]) ? defaultValue : this.data[key] :
2000
- defaultValue;
2001
- }
2002
- /**
2003
- * @template T
2004
- * @param {?} keys
2005
- * @param {?=} defaultValue
2006
- * @return {?}
2007
- */
2008
- searchData(keys, defaultValue) {
2009
- if (this.data) {
2010
- /** @type {?} */
2011
- const found = keys.find((/**
2012
- * @param {?} key
2013
- * @return {?}
2014
- */
2015
- key => !isNil(this.data[key])));
2016
- return found ? this.data[found] : defaultValue;
2017
- }
2018
- else {
2019
- return defaultValue;
2020
- }
1958
+ (function (ParameterDefinition) {
1959
+ /**
1960
+ * @record
1961
+ * @template T
1962
+ */
1963
+ function Options() { }
1964
+ ParameterDefinition.Options = Options;
1965
+ if (false) {
1966
+ /** @type {?|undefined} */
1967
+ Options.prototype.as;
1968
+ /** @type {?|undefined} */
1969
+ Options.prototype.optional;
1970
+ /** @type {?|undefined} */
1971
+ Options.prototype.remember;
1972
+ /** @type {?|undefined} */
1973
+ Options.prototype.defaultValue;
1974
+ }
1975
+ /**
1976
+ * @template T
1977
+ */
1978
+ class RouteId extends ParameterDefinition {
1979
+ constructor() {
1980
+ super(...arguments);
1981
+ this.isRouteId = true;
1982
+ this.isArray = false;
2021
1983
  }
2022
1984
  }
2023
- __decorate([
2024
- Memoize$1(),
2025
- __metadata("design:type", Function),
2026
- __metadata("design:paramtypes", []),
2027
- __metadata("design:returntype", Array)
2028
- ], Definition.prototype, "getRouteParameters", null);
2029
- PlaceComponent.Definition = Definition;
1985
+ ParameterDefinition.RouteId = RouteId;
2030
1986
  if (false) {
2031
1987
  /** @type {?} */
2032
- Definition.prototype.path;
2033
- /** @type {?} */
2034
- Definition.prototype.authenticate;
2035
- /** @type {?} */
2036
- Definition.prototype.order;
2037
- /** @type {?} */
2038
- Definition.prototype.data;
2039
- /** @type {?} */
2040
- Definition.prototype.children;
1988
+ RouteId.prototype.isRouteId;
2041
1989
  /** @type {?} */
2042
- Definition.prototype.component;
1990
+ RouteId.prototype.isArray;
2043
1991
  }
2044
1992
  /**
2045
- * @record
1993
+ * @template T
2046
1994
  */
2047
- function Options() { }
2048
- PlaceComponent.Options = Options;
1995
+ class ValueParameter extends ParameterDefinition {
1996
+ constructor() {
1997
+ super(...arguments);
1998
+ this.isRouteId = false;
1999
+ this.isArray = false;
2000
+ }
2001
+ }
2002
+ ParameterDefinition.ValueParameter = ValueParameter;
2049
2003
  if (false) {
2050
2004
  /** @type {?} */
2051
- Options.prototype.path;
2005
+ ValueParameter.prototype.isRouteId;
2052
2006
  /** @type {?} */
2053
- Options.prototype.order;
2054
- /** @type {?|undefined} */
2055
- Options.prototype.data;
2056
- /** @type {?|undefined} */
2057
- Options.prototype.authenticate;
2058
- /** @type {?|undefined} */
2059
- Options.prototype.children;
2007
+ ValueParameter.prototype.isArray;
2060
2008
  }
2061
2009
  /**
2062
- * @record
2010
+ * @template T
2063
2011
  */
2064
- function ChildOptions() { }
2065
- PlaceComponent.ChildOptions = ChildOptions;
2012
+ class ArrayParameter extends ParameterDefinition {
2013
+ constructor() {
2014
+ super(...arguments);
2015
+ this.isRouteId = false;
2016
+ this.isArray = true;
2017
+ }
2018
+ }
2019
+ ParameterDefinition.ArrayParameter = ArrayParameter;
2066
2020
  if (false) {
2067
2021
  /** @type {?} */
2068
- ChildOptions.prototype.parent;
2022
+ ArrayParameter.prototype.isRouteId;
2023
+ /** @type {?} */
2024
+ ArrayParameter.prototype.isArray;
2069
2025
  }
2026
+ })(ParameterDefinition || (ParameterDefinition = {}));
2027
+
2028
+ var _a;
2029
+ class ParameterSnapshot {
2070
2030
  /**
2071
- * @param {?} klass
2072
- * @return {?}
2031
+ * @param {?} placeDefinition
2032
+ * @param {?} resolved
2073
2033
  */
2074
- function getDefinition(klass) {
2075
- return Reflect.getMetadata(DEFINITION_META_DATA_KEY, klass);
2034
+ constructor(placeDefinition, resolved) {
2035
+ this.placeDefinition = placeDefinition;
2036
+ this.resolved = resolved;
2076
2037
  }
2077
- PlaceComponent.getDefinition = getDefinition;
2078
2038
  /**
2079
- * @param {?} klass
2080
- * @param {?} options
2039
+ * @param {?} other
2081
2040
  * @return {?}
2082
2041
  */
2083
- function injectDefinition(klass, options) {
2084
- Reflect.defineMetadata(DEFINITION_META_DATA_KEY, new Definition(klass, options), klass);
2042
+ hasChanged(other) {
2043
+ /** @type {?} */
2044
+ const changed = this.resolved.find((/**
2045
+ * @param {?} r
2046
+ * @return {?}
2047
+ */
2048
+ (r) => {
2049
+ return !r.isSame(other.getResolvedParameterValue(r.parameterDef));
2050
+ }));
2051
+ // if (changed) {
2052
+ // console.log({ mine: changed, theirs: other.getResolvedParameter(changed.parameterDef) });
2053
+ // }
2054
+ return !!changed;
2085
2055
  }
2086
- PlaceComponent.injectDefinition = injectDefinition;
2087
- })(PlaceComponent || (PlaceComponent = {}));
2088
-
2089
- /**
2090
- * @fileoverview added by tsickle
2091
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2092
- */
2093
- class AbstractPlaceNavigationComponent extends DisposableComponent {
2094
- constructor() {
2095
- super();
2096
- const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
2097
- this.placeDefinitions = chain(this.placesModel).map((/**
2098
- * @param {?} c
2056
+ /**
2057
+ * @template T, S
2058
+ * @param {?} parameterDef
2059
+ * @return {?}
2060
+ */
2061
+ getResolvedParameter(parameterDef) {
2062
+ return this.resolved.find((/**
2063
+ * @param {?} r
2099
2064
  * @return {?}
2100
2065
  */
2101
- c => PlaceComponent.getDefinition(c)));
2066
+ r => r.parameterDef === parameterDef));
2102
2067
  }
2103
2068
  /**
2104
- * @param {?} placeDef
2069
+ * @template T, S
2070
+ * @param {?} parameterDef
2105
2071
  * @return {?}
2106
2072
  */
2107
- getNav(placeDef) {
2073
+ getResolvedParameterValue(parameterDef) {
2108
2074
  /** @type {?} */
2109
- const navItem = (/** @type {?} */ (placeDef.getData('nav')));
2110
- return {
2111
- title: (/**
2112
- * @return {?}
2113
- */
2114
- () => navItem ? navItem.title() : placeDef.searchData(['navTitle', 'title'])),
2115
- tooltip: (/**
2116
- * @return {?}
2117
- */
2118
- () => navItem && navItem.tooltip ? navItem.tooltip() : placeDef.getData('navTooltip', null)),
2119
- icon: (/**
2120
- * @return {?}
2121
- */
2122
- () => navItem && navItem.icon ? navItem.icon() : placeDef.getData('navIcon', null))
2123
- };
2075
+ const resolvedParameter = this.getResolvedParameter(parameterDef);
2076
+ return resolvedParameter ? resolvedParameter.value : null;
2124
2077
  }
2125
2078
  /**
2126
2079
  * @return {?}
2127
2080
  */
2128
- ngOnInit() {
2081
+ getRouteId() {
2082
+ return this.getResolvedRouteId() ? this.getResolvedRouteId().value : null;
2129
2083
  }
2130
- }
2131
- AbstractPlaceNavigationComponent.propDecorators = {
2132
- places: [{ type: Input }],
2133
- placesModel: [{ type: Input }]
2134
- };
2135
- __decorate([
2136
- StoreInListModel('placesModel'),
2137
- __metadata("design:type", Array)
2138
- ], AbstractPlaceNavigationComponent.prototype, "places", void 0);
2139
- __decorate([
2140
- UseDelegate(),
2141
- __metadata("design:type", ListModel)
2142
- ], AbstractPlaceNavigationComponent.prototype, "placesModel", void 0);
2143
- __decorate([
2144
- Memoize(),
2145
- __metadata("design:type", Function),
2146
- __metadata("design:paramtypes", [PlaceComponent.Definition]),
2147
- __metadata("design:returntype", Object)
2148
- ], AbstractPlaceNavigationComponent.prototype, "getNav", null);
2149
- if (false) {
2150
- /** @type {?} */
2151
- AbstractPlaceNavigationComponent.prototype.places;
2152
- /** @type {?} */
2153
- AbstractPlaceNavigationComponent.prototype.placesModel;
2154
- /** @type {?} */
2155
- AbstractPlaceNavigationComponent.prototype.placeDefinitions;
2156
- }
2157
-
2158
- /**
2159
- * @fileoverview added by tsickle
2160
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2161
- */
2162
- class ListPlaceNavComponent extends AbstractPlaceNavigationComponent {
2163
- constructor() {
2164
- super();
2165
- this.expanded = true;
2084
+ /**
2085
+ * @param {?} name
2086
+ * @return {?}
2087
+ */
2088
+ getRouteParameter(name) {
2089
+ /** @type {?} */
2090
+ const resolvedParameter = this.resolved.find((/**
2091
+ * @param {?} r
2092
+ * @return {?}
2093
+ */
2094
+ r => r.parameterDef.name === name));
2095
+ return resolvedParameter ? resolvedParameter.value : null;
2096
+ }
2097
+ /**
2098
+ * @private
2099
+ * @return {?}
2100
+ */
2101
+ getResolvedRouteId() {
2102
+ // RouteId's are never arrays: see parameter-decorators.ts createDefinition methods. It would be nice to
2103
+ // capture this in the type system though
2104
+ return (/** @type {?} */ (this.resolved.find((/**
2105
+ * @param {?} p
2106
+ * @return {?}
2107
+ */
2108
+ p => p.parameterDef.isRouteId))));
2166
2109
  }
2167
2110
  /**
2168
2111
  * @return {?}
2169
2112
  */
2170
- expandMenu() {
2171
- this.expanded = true;
2113
+ hasRouteId() {
2114
+ return !!this.getResolvedRouteId();
2172
2115
  }
2173
2116
  /**
2174
2117
  * @return {?}
2175
2118
  */
2176
- collapseMenu() {
2177
- this.expanded = false;
2119
+ getFormattedRouteId() {
2120
+ /** @type {?} */
2121
+ const routeIdParam = this.getResolvedRouteId();
2122
+ return routeIdParam ? routeIdParam.formattedValue() : null;
2178
2123
  }
2179
2124
  /**
2180
2125
  * @return {?}
2181
2126
  */
2182
- toggleMenu() {
2183
- this.expanded = !this.expanded;
2127
+ getFormattedParameters() {
2128
+ /** @type {?} */
2129
+ const params = {};
2130
+ /** @type {?} */
2131
+ const routeIdParam = this.resolved.filter((/**
2132
+ * @param {?} p
2133
+ * @return {?}
2134
+ */
2135
+ p => !p.parameterDef.isRouteId)).forEach((/**
2136
+ * @param {?} p
2137
+ * @return {?}
2138
+ */
2139
+ p => {
2140
+ params[p.parameterDef.name] = p.formattedValue();
2141
+ }));
2142
+ return params;
2184
2143
  }
2185
- }
2186
- ListPlaceNavComponent.decorators = [
2187
- { type: Component, args: [{
2188
- selector: 'angular-ui-powerups-list-place-nav',
2189
- 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",
2190
- 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}"]
2191
- }] }
2192
- ];
2193
- /** @nocollapse */
2194
- ListPlaceNavComponent.ctorParameters = () => [];
2195
- ListPlaceNavComponent.propDecorators = {
2196
- expanded: [{ type: HostBinding, args: ['class.expanded',] }]
2197
- };
2198
- if (false) {
2199
- /** @type {?} */
2200
- ListPlaceNavComponent.prototype.expanded;
2201
- }
2202
-
2203
- /**
2204
- * @fileoverview added by tsickle
2205
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2206
- */
2207
- class PlaceService extends GarbageCollector {
2208
2144
  /**
2209
- * @param {?} router
2210
- * @param {?} injector
2145
+ * @template T, S
2146
+ * @param {?} parameter
2147
+ * @param {?} value
2148
+ * @return {?}
2211
2149
  */
2212
- constructor(router, injector) {
2213
- super();
2214
- this.router = router;
2215
- this.injector = injector;
2216
- this._activePlaces = new MutableListModel();
2150
+ replace(parameter, value) {
2151
+ return new ParameterSnapshot(this.placeDefinition, this.resolved.map((/**
2152
+ * @param {?} p
2153
+ * @return {?}
2154
+ */
2155
+ p => {
2156
+ return p.parameterDef === parameter ? p.replace(value) : p;
2157
+ })));
2217
2158
  }
2218
2159
  /**
2160
+ * @param {?} injector
2219
2161
  * @return {?}
2220
2162
  */
2221
- get activePlaces() {
2222
- return this._activePlaces.readonly;
2163
+ sanitise(injector) {
2164
+ return __awaiter(this, void 0, void 0, function* () {
2165
+ return this;
2166
+ });
2223
2167
  }
2224
- // @Trace()
2168
+ }
2169
+ __decorate([
2170
+ Memoize$1(),
2171
+ __metadata("design:type", Function),
2172
+ __metadata("design:paramtypes", [ParameterDefinition]),
2173
+ __metadata("design:returntype", ParameterSnapshot.ResolvedParameter)
2174
+ ], ParameterSnapshot.prototype, "getResolvedParameter", null);
2175
+ __decorate([
2176
+ Memoize$1(),
2177
+ __metadata("design:type", Function),
2178
+ __metadata("design:paramtypes", [ParameterDefinition]),
2179
+ __metadata("design:returntype", typeof (_a = typeof S !== "undefined" && S) === "function" ? _a : Object)
2180
+ ], ParameterSnapshot.prototype, "getResolvedParameterValue", null);
2181
+ __decorate([
2182
+ Memoize$1(),
2183
+ __metadata("design:type", Function),
2184
+ __metadata("design:paramtypes", [String]),
2185
+ __metadata("design:returntype", Object)
2186
+ ], ParameterSnapshot.prototype, "getRouteParameter", null);
2187
+ __decorate([
2188
+ Memoize$1(),
2189
+ __metadata("design:type", Function),
2190
+ __metadata("design:paramtypes", []),
2191
+ __metadata("design:returntype", ParameterSnapshot.ResolvedValueParameter)
2192
+ ], ParameterSnapshot.prototype, "getResolvedRouteId", null);
2193
+ if (false) {
2194
+ /** @type {?} */
2195
+ ParameterSnapshot.prototype.placeDefinition;
2225
2196
  /**
2226
- * @param {?} place
2197
+ * @type {?}
2198
+ * @private
2199
+ */
2200
+ ParameterSnapshot.prototype.resolved;
2201
+ }
2202
+ (function (ParameterSnapshot) {
2203
+ /**
2204
+ * @param {?} placeDef
2205
+ * @param {?} paramMap
2227
2206
  * @return {?}
2228
2207
  */
2229
- onActivate(place) {
2230
- this._activePlaces.push(place);
2208
+ function create(placeDef, paramMap) {
2209
+ /** @type {?} */
2210
+ const resolvedParameters = placeDef.getRouteParameters()
2211
+ .map((/**
2212
+ * @param {?} def
2213
+ * @return {?}
2214
+ */
2215
+ def => {
2216
+ if (def.isArray) {
2217
+ /** @type {?} */
2218
+ const value = paramMap.has(def.name) ? paramMap.getAll(def.name).map((/**
2219
+ * @param {?} raw
2220
+ * @return {?}
2221
+ */
2222
+ raw => def.type.parse(raw))) : null;
2223
+ return new ResolvedArrayParameter(def, value);
2224
+ }
2225
+ else {
2226
+ /** @type {?} */
2227
+ const value = paramMap.has(def.name) ? def.type.parse(paramMap.get(def.name)) : null;
2228
+ return new ResolvedValueParameter(def, value);
2229
+ }
2230
+ }));
2231
+ return new ParameterSnapshot(placeDef, resolvedParameters);
2231
2232
  }
2232
- // @Trace()
2233
+ ParameterSnapshot.create = create;
2233
2234
  /**
2234
- * @param {?} place
2235
- * @return {?}
2235
+ * @abstract
2236
+ * @template T, S
2236
2237
  */
2237
- onDeactivate(place) {
2238
- this._activePlaces.remove(place);
2238
+ class ResolvedParameter {
2239
+ /**
2240
+ * @param {?} parameterDef
2241
+ * @param {?} value
2242
+ */
2243
+ constructor(parameterDef, value) {
2244
+ this.parameterDef = parameterDef;
2245
+ this.value = value;
2246
+ }
2247
+ /**
2248
+ * @return {?}
2249
+ */
2250
+ isRouteId() {
2251
+ return this.parameterDef.isRouteId;
2252
+ }
2253
+ }
2254
+ ParameterSnapshot.ResolvedParameter = ResolvedParameter;
2255
+ if (false) {
2256
+ /** @type {?} */
2257
+ ResolvedParameter.prototype.parameterDef;
2258
+ /** @type {?} */
2259
+ ResolvedParameter.prototype.value;
2260
+ /**
2261
+ * @abstract
2262
+ * @param {?} dest
2263
+ * @return {?}
2264
+ */
2265
+ ResolvedParameter.prototype.injectRouteParam = function (dest) { };
2266
+ /**
2267
+ * @abstract
2268
+ * @param {?} otherValue
2269
+ * @return {?}
2270
+ */
2271
+ ResolvedParameter.prototype.isSame = function (otherValue) { };
2272
+ /**
2273
+ * @abstract
2274
+ * @return {?}
2275
+ */
2276
+ ResolvedParameter.prototype.formattedValue = function () { };
2277
+ /**
2278
+ * @abstract
2279
+ * @param {?} value
2280
+ * @return {?}
2281
+ */
2282
+ ResolvedParameter.prototype.replace = function (value) { };
2239
2283
  }
2240
- // @Trace()
2241
2284
  /**
2242
- * @param {?} params
2243
- * @return {?}
2285
+ * @template T
2244
2286
  */
2245
- notifyRouteParametersChanged(params) {
2246
- // We update the router state...
2247
- if (params.updateRoute) {
2248
- /** @type {?} */
2249
- const routeId = params.next.getFormattedRouteId();
2250
- /** @type {?} */
2251
- const relativePath = !!params.previous.hasRouteId() ? '..' : '.';
2252
- /** @type {?} */
2253
- const path = routeId ? [relativePath, routeId, params.next.getFormattedParameters()] : [relativePath, params.next.getFormattedParameters()];
2254
- this.router.navigate(path, {
2255
- relativeTo: params.activatedRoute
2256
- });
2287
+ class ResolvedValueParameter extends ResolvedParameter {
2288
+ /**
2289
+ * @param {?} otherValue
2290
+ * @return {?}
2291
+ */
2292
+ isSame(otherValue) {
2293
+ return this.value === otherValue;
2294
+ }
2295
+ /**
2296
+ * @param {?} dest
2297
+ * @return {?}
2298
+ */
2299
+ injectRouteParam(dest) {
2300
+ dest[this.parameterDef.name] = this.parameterDef.type.format(this.value);
2301
+ }
2302
+ /**
2303
+ * @param {?} value
2304
+ * @return {?}
2305
+ */
2306
+ replace(value) {
2307
+ return new ResolvedValueParameter(this.parameterDef, value);
2308
+ }
2309
+ /**
2310
+ * @return {?}
2311
+ */
2312
+ formattedValue() {
2313
+ return !___default.isNil(this.value) ? this.parameterDef.type.format(this.value) : null;
2257
2314
  }
2258
2315
  }
2259
- // @Trace()
2316
+ ParameterSnapshot.ResolvedValueParameter = ResolvedValueParameter;
2260
2317
  /**
2261
- * @param {?} snapshot
2262
- * @return {?}
2318
+ * @template T
2263
2319
  */
2264
- sanitise(snapshot) {
2265
- return __awaiter(this, void 0, void 0, function* () {
2266
- return snapshot;
2267
- });
2320
+ class ResolvedArrayParameter extends ResolvedParameter {
2321
+ /**
2322
+ * @param {?} otherValue
2323
+ * @return {?}
2324
+ */
2325
+ isSame(otherValue) {
2326
+ return ___default.isEqual(this.value, otherValue);
2327
+ }
2328
+ /**
2329
+ * @param {?} dest
2330
+ * @return {?}
2331
+ */
2332
+ injectRouteParam(dest) {
2333
+ dest[this.parameterDef.name] = this.value.map((/**
2334
+ * @param {?} v
2335
+ * @return {?}
2336
+ */
2337
+ v => this.parameterDef.type.format(v)));
2338
+ }
2339
+ /**
2340
+ * @param {?} value
2341
+ * @return {?}
2342
+ */
2343
+ replace(value) {
2344
+ return new ResolvedArrayParameter(this.parameterDef, value);
2345
+ }
2346
+ /**
2347
+ * @return {?}
2348
+ */
2349
+ formattedValue() {
2350
+ return this.value ? this.value.map((/**
2351
+ * @param {?} v
2352
+ * @return {?}
2353
+ */
2354
+ v => this.parameterDef.type.format(v))) : [];
2355
+ }
2268
2356
  }
2269
- }
2270
- PlaceService.decorators = [
2271
- { type: Injectable, args: [{
2272
- providedIn: 'root'
2273
- },] }
2274
- ];
2275
- /** @nocollapse */
2276
- PlaceService.ctorParameters = () => [
2277
- { type: Router },
2278
- { type: Injector }
2279
- ];
2280
- /** @nocollapse */ PlaceService.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceService_Factory() { return new PlaceService(ɵɵinject(Router), ɵɵinject(INJECTOR)); }, token: PlaceService, providedIn: "root" });
2281
- if (false) {
2282
- /**
2283
- * @type {?}
2284
- * @private
2285
- */
2286
- PlaceService.prototype._activePlaces;
2287
- /**
2288
- * @type {?}
2289
- * @protected
2290
- */
2291
- PlaceService.prototype.router;
2292
- /**
2293
- * @type {?}
2294
- * @protected
2295
- */
2296
- PlaceService.prototype.injector;
2297
- }
2357
+ ParameterSnapshot.ResolvedArrayParameter = ResolvedArrayParameter;
2358
+ })(ParameterSnapshot || (ParameterSnapshot = {}));
2298
2359
 
2299
2360
  /**
2300
2361
  * @fileoverview added by tsickle
@@ -2347,105 +2408,130 @@ function leftRightPlaceAnimation(duration) {
2347
2408
  ]);
2348
2409
  }
2349
2410
  /** @type {?} */
2350
- const LEFT_RIGHT_PLACE_ANIMATION = leftRightPlaceAnimation("0.3s");
2411
+ const LEFT_RIGHT_PLACE_ANIMATION = leftRightPlaceAnimation('0.3s');
2351
2412
 
2352
2413
  /**
2353
2414
  * @fileoverview added by tsickle
2354
2415
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2355
2416
  */
2417
+ /**
2418
+ * @record
2419
+ */
2420
+ function PlaceRef() { }
2421
+ if (false) {
2422
+ /** @type {?} */
2423
+ PlaceRef.prototype.placeDefinition;
2424
+ /**
2425
+ * @param {?} param
2426
+ * @return {?}
2427
+ */
2428
+ PlaceRef.prototype.initialiseBindings = function (param) { };
2429
+ /**
2430
+ * @return {?}
2431
+ */
2432
+ PlaceRef.prototype.onPlaceReady = function () { };
2433
+ }
2356
2434
  class PlaceOutletComponent extends DisposableComponent {
2357
2435
  /**
2358
- * @param {?} placeService
2359
- * @param {?} activatedRoute
2436
+ * @param {?} router
2437
+ * @param {?} placeHistory
2360
2438
  */
2361
- constructor(placeService, activatedRoute) {
2439
+ constructor(router, placeHistory) {
2362
2440
  super();
2363
- this.placeService = placeService;
2364
- this.activatedRoute = activatedRoute;
2441
+ this.router = router;
2442
+ this.placeHistory = placeHistory;
2365
2443
  this.animate = true;
2366
- this.outletUrlSegment = new MutableListModel();
2444
+ this._incomingRouteChange = new Guard();
2445
+ this._inOutletUpdate = new Guard();
2446
+ this._activatedRouteModel = new MutableValueModel();
2447
+ this._placeDefinition = new MutableValueModel();
2448
+ this._resolvedParameters = new MutableValueModel();
2367
2449
  const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
2368
- this.myPath = observe.listsFrom(activatedRoute.url).last().map((/**
2369
- * @param {?} s
2370
- * @return {?}
2371
- */
2372
- s => s.toString())).reduce((/**
2373
- * @param {?} bits
2374
- * @return {?}
2375
- */
2376
- bits => bits.join(',')));
2377
- console.log(`new outlet@(${this.myPath.value})`);
2378
- this.outletChildPath = chain(this.outletUrlSegment).map((/**
2379
- * @param {?} s
2450
+ this._paramMap = chain(this._activatedRouteModel).pullObservableValue((/**
2451
+ * @param {?} ar
2380
2452
  * @return {?}
2381
2453
  */
2382
- s => s.toString())).reduce((/**
2383
- * @param {?} bits
2384
- * @return {?}
2385
- */
2386
- bits => bits.join(",")));
2387
- this.state = chain(this.myPath).map((/**
2388
- * @param {?} path
2454
+ ar => ar.paramMap));
2455
+ this.placeConfigured = valueOf.all(chain(this._inOutletUpdate).isFalsey(), this._placeDefinition, this._paramMap).areTruthy();
2456
+ when.valueOf(this._paramMap).changes((/**
2457
+ * @param {?} params
2389
2458
  * @return {?}
2390
2459
  */
2391
- path => {
2392
- return `outlet@(${path}), child path->${this.outletChildPath.value}`;
2393
- }), { dependsOn: this.outletChildPath });
2394
- when.valueOf(this.state).changes((/**
2395
- * @param {?} debug
2460
+ (params) => {
2461
+ /** @type {?} */
2462
+ const snapshot = ParameterSnapshot.create(this._placeDefinition.value, params);
2463
+ this._incomingRouteChange.whileTrue((/**
2464
+ * @return {?}
2465
+ */
2466
+ () => {
2467
+ this._resolvedParameters.value = snapshot;
2468
+ this.placeHistory.add(snapshot);
2469
+ }));
2470
+ }), {
2471
+ postponeUntil: this.placeConfigured
2472
+ });
2473
+ when.valueOf(this._resolvedParameters).changes((/**
2474
+ * @param {?} next
2475
+ * @param {?} previous
2396
2476
  * @return {?}
2397
2477
  */
2398
- debug => {
2399
- console.log(`Outlet Changed -> ${debug}`);
2400
- }));
2401
- }
2402
- /**
2403
- * @return {?}
2404
- */
2405
- ngOnInit() {
2478
+ (next, previous) => {
2479
+ this.pushChangesToRoute(next, previous);
2480
+ 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.
2481
+ }), {
2482
+ unless: this.incomingRouteChange
2483
+ });
2406
2484
  }
2407
2485
  /**
2408
2486
  * @return {?}
2409
2487
  */
2410
- ngAfterViewInit() {
2411
- // this.routerOutLetQuery.changes.subscribe(() => {
2412
- // this.updateRouterOutlet(this.routerOutLetQuery.first);
2413
- // });
2488
+ get incomingRouteChange() {
2489
+ return this._incomingRouteChange;
2414
2490
  }
2415
2491
  /**
2416
2492
  * @return {?}
2417
2493
  */
2418
- ngAfterViewChecked() {
2419
- // console.log(`@AfterViewChecked: ${this.state.value}`);
2420
- this.updateRouterOutlet(this.routerOutLetQuery.first);
2494
+ ngOnInit() {
2421
2495
  }
2422
- // @Trace()
2423
- // ngOnDestroy(): void {
2424
- // console.log('outletSegments', this.outletUrlSegment.value);
2425
- // console.log('mySegments', this.myPath.value);
2426
- // super.ngOnDestroy();
2427
- // }
2428
- // @Trace()
2429
2496
  /**
2430
- * @param {?} $event
2497
+ * @param {?} routerOutlet
2498
+ * @param {?} place
2431
2499
  * @return {?}
2432
2500
  */
2433
- onOutletActivated($event) {
2434
- // console.log(this.routerOutLet.activatedRoute.snapshot.url);
2435
- this.currentPlace = $event;
2436
- this.placeService.onActivate($event);
2501
+ onOutletActivated(routerOutlet, place) {
2502
+ this._inOutletUpdate.whileTrue((/**
2503
+ * @return {?}
2504
+ */
2505
+ () => {
2506
+ try {
2507
+ this._currentPlace = place;
2508
+ this._activatedRouteModel.value = routerOutlet.activatedRoute;
2509
+ this._placeDefinition.value = place.placeDefinition;
2510
+ place.initialiseBindings(this._resolvedParameters);
2511
+ }
2512
+ catch (error) {
2513
+ console.error(error);
2514
+ }
2515
+ }));
2437
2516
  if (!this.animate) {
2438
2517
  // we're not animating so trigger any post animation callbacks now.
2439
2518
  this.animationDone();
2440
2519
  }
2441
2520
  }
2442
2521
  /**
2522
+ * @param {?} routerOutlet
2443
2523
  * @param {?} $event
2444
2524
  * @return {?}
2445
2525
  */
2446
- onOutletDeactivated($event) {
2447
- this.currentPlace = null;
2448
- this.placeService.onDeactivate($event);
2526
+ onOutletDeactivated(routerOutlet, $event) {
2527
+ this._inOutletUpdate.whileTrue((/**
2528
+ * @return {?}
2529
+ */
2530
+ () => {
2531
+ this._currentPlace = null;
2532
+ this._activatedRouteModel.value = null;
2533
+ this._placeDefinition.value = null;
2534
+ }));
2449
2535
  }
2450
2536
  /**
2451
2537
  * @param {?} outlet
@@ -2458,79 +2544,98 @@ class PlaceOutletComponent extends DisposableComponent {
2458
2544
  * @return {?}
2459
2545
  */
2460
2546
  animationDone() {
2461
- if (this.currentPlace) {
2462
- this.currentPlace.onPlaceReady();
2547
+ if (this._currentPlace) {
2548
+ this._currentPlace.onPlaceReady();
2463
2549
  }
2464
2550
  }
2465
- // @Trace()
2466
2551
  /**
2467
- * @private
2468
- * @param {?} first
2552
+ * @param {?} next
2553
+ * @param {?} previous
2469
2554
  * @return {?}
2470
2555
  */
2471
- updateRouterOutlet(first) {
2472
- if (first.isActivated) {
2473
- this.outletUrlSegment.value = first.activatedRoute.snapshot.url;
2474
- }
2556
+ pushChangesToRoute(next, previous) {
2557
+ /** @type {?} */
2558
+ const activatedRoute = this._activatedRouteModel.value;
2559
+ this.router.pushParameterChangesToRoute(activatedRoute, previous, next);
2560
+ }
2561
+ /**
2562
+ * @param {?} snapshot
2563
+ * @param {?} callback
2564
+ * @return {?}
2565
+ */
2566
+ sanitise(snapshot, callback) {
2567
+ return snapshot;
2475
2568
  }
2476
2569
  }
2477
2570
  PlaceOutletComponent.decorators = [
2478
2571
  { type: Component, args: [{
2479
2572
  selector: 'angular-ui-powerups-place-outlet',
2480
- template: "<div class=\"router-outlet-container\"\n [@routeAnimations]=\"getPlaceOrder(routerOutlet)\"\n (@routeAnimations.done)=\"animationDone()\"\n>\n <router-outlet #routerOutlet=\"outlet\"\n (activate)=\"onOutletActivated($event)\"\n (deactivate)=\"onOutletDeactivated($event)\">\n </router-outlet>\n</div>\n\n",
2573
+ template: "<div class=\"router-outlet-container\"\n [@routeAnimations]=\"getPlaceOrder(routerOutlet)\"\n (@routeAnimations.done)=\"animationDone()\"\n>\n <router-outlet #routerOutlet=\"outlet\"\n (activate)=\"onOutletActivated(routerOutlet, $event)\"\n (deactivate)=\"onOutletDeactivated(routerOutlet, $event)\">\n </router-outlet>\n</div>\n\n",
2481
2574
  animations: [LEFT_RIGHT_PLACE_ANIMATION],
2482
2575
  styles: [":host{display:flex;flex-direction:column;min-height:0}.router-outlet-container{flex:1;display:block;position:relative;min-height:0}router-outlet{display:none}"]
2483
2576
  }] }
2484
2577
  ];
2485
2578
  /** @nocollapse */
2486
2579
  PlaceOutletComponent.ctorParameters = () => [
2487
- { type: PlaceService },
2488
- { type: ActivatedRoute }
2580
+ { type: PlaceRouter },
2581
+ { type: PlaceHistory }
2489
2582
  ];
2490
2583
  PlaceOutletComponent.propDecorators = {
2491
2584
  animate: [{ type: Input }],
2492
- routerOutLetQuery: [{ type: ViewChildren, args: [RouterOutlet,] }]
2585
+ routerOut: [{ type: ViewChild, args: ['routeOutlet', { static: true },] }]
2493
2586
  };
2494
2587
  if (false) {
2495
2588
  /** @type {?} */
2496
2589
  PlaceOutletComponent.prototype.animate;
2497
2590
  /** @type {?} */
2498
- PlaceOutletComponent.prototype.routerOutLetQuery;
2591
+ PlaceOutletComponent.prototype.routerOut;
2592
+ /**
2593
+ * @type {?}
2594
+ * @private
2595
+ */
2596
+ PlaceOutletComponent.prototype._currentPlace;
2597
+ /**
2598
+ * @type {?}
2599
+ * @private
2600
+ */
2601
+ PlaceOutletComponent.prototype._incomingRouteChange;
2499
2602
  /**
2500
2603
  * @type {?}
2501
2604
  * @private
2502
2605
  */
2503
- PlaceOutletComponent.prototype.currentPlace;
2606
+ PlaceOutletComponent.prototype._inOutletUpdate;
2504
2607
  /**
2505
2608
  * @type {?}
2506
2609
  * @private
2507
2610
  */
2508
- PlaceOutletComponent.prototype.myPath;
2611
+ PlaceOutletComponent.prototype._activatedRouteModel;
2509
2612
  /**
2510
2613
  * @type {?}
2511
2614
  * @private
2512
2615
  */
2513
- PlaceOutletComponent.prototype.outletUrlSegment;
2616
+ PlaceOutletComponent.prototype._placeDefinition;
2514
2617
  /**
2515
2618
  * @type {?}
2516
2619
  * @private
2517
2620
  */
2518
- PlaceOutletComponent.prototype.outletChildPath;
2621
+ PlaceOutletComponent.prototype._paramMap;
2622
+ /** @type {?} */
2623
+ PlaceOutletComponent.prototype._resolvedParameters;
2519
2624
  /**
2520
2625
  * @type {?}
2521
2626
  * @private
2522
2627
  */
2523
- PlaceOutletComponent.prototype.state;
2628
+ PlaceOutletComponent.prototype.placeConfigured;
2524
2629
  /**
2525
2630
  * @type {?}
2526
2631
  * @private
2527
2632
  */
2528
- PlaceOutletComponent.prototype.placeService;
2633
+ PlaceOutletComponent.prototype.router;
2529
2634
  /**
2530
2635
  * @type {?}
2531
2636
  * @private
2532
2637
  */
2533
- PlaceOutletComponent.prototype.activatedRoute;
2638
+ PlaceOutletComponent.prototype.placeHistory;
2534
2639
  }
2535
2640
 
2536
2641
  /**
@@ -2585,9 +2690,7 @@ PlaceModule.decorators = [
2585
2690
  TabbedPlaceNavigationComponent,
2586
2691
  ListPlaceNavComponent
2587
2692
  ],
2588
- providers: [
2589
- PlaceService
2590
- ]
2693
+ providers: []
2591
2694
  },] }
2592
2695
  ];
2593
2696
 
@@ -2991,39 +3094,6 @@ if (false) {
2991
3094
  NavItem.prototype.tooltip = function () { };
2992
3095
  }
2993
3096
 
2994
- /**
2995
- * @fileoverview added by tsickle
2996
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2997
- */
2998
- /**
2999
- * @record
3000
- */
3001
- function PlaceComponentLike() { }
3002
- if (false) {
3003
- /** @type {?} */
3004
- PlaceComponentLike.prototype.activatedRoute;
3005
- /**
3006
- * @return {?}
3007
- */
3008
- PlaceComponentLike.prototype.onPlaceReady = function () { };
3009
- }
3010
-
3011
- /**
3012
- * @fileoverview added by tsickle
3013
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3014
- */
3015
- /**
3016
- * @record
3017
- */
3018
- function PlaceUpdatesService() { }
3019
- if (false) {
3020
- /**
3021
- * @param {?} params
3022
- * @return {?}
3023
- */
3024
- PlaceUpdatesService.prototype.notifyRouteParametersChanged = function (params) { };
3025
- }
3026
-
3027
3097
  /**
3028
3098
  * @fileoverview added by tsickle
3029
3099
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
@@ -3038,12 +3108,37 @@ function Place(options) {
3038
3108
  * @return {?}
3039
3109
  */
3040
3110
  (target) => {
3041
- if (!lang.constructorChain((/** @type {?} */ (target))).includes(PlaceComponent)) {
3111
+ if (PlaceComponent.isPlaceComponentConstructor(target)) {
3112
+ PlaceComponent.injectDefinition(target, new PlaceDefinition(target, options.path, isNil(options.authenticate) ? false : options.authenticate, options.order, options.data, PlaceComponent.getRouteParameters(target), (options.children || []).map((/**
3113
+ * @param {?} c
3114
+ * @return {?}
3115
+ */
3116
+ c => PlaceComponent.getDefinition(c)))));
3117
+ }
3118
+ else {
3042
3119
  lang.illegalState(`${target} must extend PlaceComponent to use the @Place decorator`);
3043
3120
  }
3044
- PlaceComponent.injectDefinition((/** @type {?} */ (target)), options);
3045
3121
  });
3046
3122
  }
3123
+ (function (Place) {
3124
+ /**
3125
+ * @record
3126
+ */
3127
+ function Options() { }
3128
+ Place.Options = Options;
3129
+ if (false) {
3130
+ /** @type {?} */
3131
+ Options.prototype.path;
3132
+ /** @type {?} */
3133
+ Options.prototype.order;
3134
+ /** @type {?|undefined} */
3135
+ Options.prototype.data;
3136
+ /** @type {?|undefined} */
3137
+ Options.prototype.authenticate;
3138
+ /** @type {?|undefined} */
3139
+ Options.prototype.children;
3140
+ }
3141
+ })(Place || (Place = {}));
3047
3142
 
3048
3143
  /**
3049
3144
  * @fileoverview added by tsickle
@@ -3091,14 +3186,16 @@ class LeavePlaceGuard {
3091
3186
  // HACK: this will break with child routes...
3092
3187
  /** @type {?} */
3093
3188
  const path = `/${component.placeDefinition.path}`;
3094
- console.log({
3095
- placePath: path,
3096
- currentRoute: currentRoute.toString(),
3097
- currentStateUrl: currentState.url,
3098
- nextStateUrl: nextState.url,
3099
- currentStateUrlTree: this.router.parseUrl(currentState.url).root.children[PRIMARY_OUTLET].segments,
3100
- nextStateUrlTree: this.router.parseUrl(nextState.url).root.children[PRIMARY_OUTLET].segments
3101
- });
3189
+ // let thisTree = this.router.parseUrl(currentState.url);
3190
+ // let nextTree = this.router.parseUrl(nextState.url);
3191
+ // console.log({
3192
+ // placePath: path,
3193
+ // currentRoute: currentRoute.toString(),
3194
+ // currentStateUrl: currentState.url,
3195
+ // nextStateUrl: nextState.url,
3196
+ // currentStateUrlTree: thisTree.root.children[PRIMARY_OUTLET].segments,
3197
+ // nextStateUrlTree: nextTree.root.children[PRIMARY_OUTLET].segments
3198
+ // });
3102
3199
  // nextState is the full path...
3103
3200
  if (!nextState.url.startsWith(path)) {
3104
3201
  return component.canDeactivate();
@@ -3138,34 +3235,40 @@ if (false) {
3138
3235
  */
3139
3236
  class PlaceRouteGuard {
3140
3237
  /**
3141
- * @param {?} placeService
3142
- * @param {?} router
3238
+ * @param {?} placeRouter
3239
+ * @param {?} injector
3143
3240
  */
3144
- constructor(placeService, router) {
3145
- this.placeService = placeService;
3146
- this.router = router;
3241
+ constructor(placeRouter, injector) {
3242
+ this.placeRouter = placeRouter;
3243
+ this.injector = injector;
3147
3244
  }
3148
3245
  /**
3149
- * @param {?} route
3246
+ * @param {?} activatedRoute
3150
3247
  * @param {?} state
3151
3248
  * @return {?}
3152
3249
  */
3153
- canActivate(route, state) {
3154
- // Implement this when adding child routes.
3155
- // TODO: there are really two types of snapshot, ones with id's and ones without.
3156
- // Id snapshot are repesented by 2 url segments
3157
- // ID => [{'/basePath', params}, {'id', params}]
3158
- // NO ID => [{'/basePath', params}]
3159
- // console.log({urlSegments: route.url});
3160
- // const snapshot = ParameterSnapshot.create(PlaceComponent.getDefinition(route.component as Constructable<PlaceComponent>), route.paramMap);
3161
- // return this.placeService.sanitise(snapshot).then(sanitised => {
3162
- // if (sanitised.hasChanged(snapshot)) {
3163
- // return this.router.createUrlTree(snapshot.updateUrl(route.url))
3164
- // } else {
3165
- // return true;
3166
- // }
3167
- // });
3168
- return true;
3250
+ canActivate(activatedRoute, state) {
3251
+ if (PlaceComponent.isPlaceComponentConstructor(activatedRoute.component)) {
3252
+ /** @type {?} */
3253
+ const placeDefinition = PlaceComponent.getDefinition(activatedRoute.component);
3254
+ /** @type {?} */
3255
+ const snapshot = ParameterSnapshot.create(placeDefinition, activatedRoute.paramMap);
3256
+ return snapshot.sanitise(this.injector).then((/**
3257
+ * @param {?} sanitised
3258
+ * @return {?}
3259
+ */
3260
+ sanitised => {
3261
+ if (sanitised.hasChanged(snapshot)) {
3262
+ return this.placeRouter.createUrlTree(activatedRoute, snapshot, sanitised);
3263
+ }
3264
+ else {
3265
+ return true;
3266
+ }
3267
+ }));
3268
+ }
3269
+ else {
3270
+ return lang.illegalState(`expected component to be an instance of PlaceComponent, got ${activatedRoute.component}`);
3271
+ }
3169
3272
  }
3170
3273
  }
3171
3274
  PlaceRouteGuard.decorators = [
@@ -3175,21 +3278,21 @@ PlaceRouteGuard.decorators = [
3175
3278
  ];
3176
3279
  /** @nocollapse */
3177
3280
  PlaceRouteGuard.ctorParameters = () => [
3178
- { type: PlaceService },
3179
- { type: Router }
3281
+ { type: PlaceRouter },
3282
+ { type: Injector }
3180
3283
  ];
3181
- /** @nocollapse */ PlaceRouteGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceRouteGuard_Factory() { return new PlaceRouteGuard(ɵɵinject(PlaceService), ɵɵinject(Router)); }, token: PlaceRouteGuard, providedIn: "root" });
3284
+ /** @nocollapse */ PlaceRouteGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceRouteGuard_Factory() { return new PlaceRouteGuard(ɵɵinject(PlaceRouter), ɵɵinject(INJECTOR)); }, token: PlaceRouteGuard, providedIn: "root" });
3182
3285
  if (false) {
3183
3286
  /**
3184
3287
  * @type {?}
3185
3288
  * @private
3186
3289
  */
3187
- PlaceRouteGuard.prototype.placeService;
3290
+ PlaceRouteGuard.prototype.placeRouter;
3188
3291
  /**
3189
3292
  * @type {?}
3190
3293
  * @private
3191
3294
  */
3192
- PlaceRouteGuard.prototype.router;
3295
+ PlaceRouteGuard.prototype.injector;
3193
3296
  }
3194
3297
 
3195
3298
  /**
@@ -3202,14 +3305,13 @@ if (false) {
3202
3305
  class DefaultParameterSanitiser {
3203
3306
  /**
3204
3307
  * @param {?} def
3205
- * @param {?} placeService
3206
- * @param {?} options
3308
+ * @param {?} remember
3309
+ * @param {?} defaultValue
3207
3310
  */
3208
- constructor(def, placeService, options) {
3311
+ constructor(def, remember, defaultValue) {
3209
3312
  this.def = def;
3210
- this.placeService = placeService;
3211
- this.remember = isNil(options.remember) ? false : options.remember;
3212
- this.defaultValue = isNil(options.defaultValue) ? null : options.defaultValue;
3313
+ this.remember = remember;
3314
+ this.defaultValue = defaultValue;
3213
3315
  }
3214
3316
  /**
3215
3317
  * @param {?} value
@@ -3221,7 +3323,7 @@ class DefaultParameterSanitiser {
3221
3323
  if (this.remember) {
3222
3324
  // value = null;
3223
3325
  }
3224
- return this.isBlank(value) && !isNil(this.defaultValue) ? this.defaultValue : value;
3326
+ return this.isBlank(value) && !___default.isNil(this.defaultValue) ? this.defaultValue : value;
3225
3327
  }
3226
3328
  else {
3227
3329
  return value;
@@ -3234,8 +3336,8 @@ class DefaultParameterSanitiser {
3234
3336
  */
3235
3337
  isBlank(value) {
3236
3338
  /** @type {?} */
3237
- const isNil$1 = isNil(value);
3238
- return this.def.isArray ? !isNil$1 || value['length'] < 1 : isNil$1;
3339
+ const isNil = ___default.isNil(value);
3340
+ return this.def.isArray ? !isNil || value['length'] < 1 : isNil;
3239
3341
  }
3240
3342
  }
3241
3343
  __decorate([
@@ -3249,22 +3351,11 @@ if (false) {
3249
3351
  * @type {?}
3250
3352
  * @private
3251
3353
  */
3354
+ DefaultParameterSanitiser.prototype.def;
3355
+ /** @type {?} */
3252
3356
  DefaultParameterSanitiser.prototype.remember;
3253
- /**
3254
- * @type {?}
3255
- * @private
3256
- */
3357
+ /** @type {?} */
3257
3358
  DefaultParameterSanitiser.prototype.defaultValue;
3258
- /**
3259
- * @type {?}
3260
- * @private
3261
- */
3262
- DefaultParameterSanitiser.prototype.def;
3263
- /**
3264
- * @type {?}
3265
- * @private
3266
- */
3267
- DefaultParameterSanitiser.prototype.placeService;
3268
3359
  }
3269
3360
 
3270
3361
  /**
@@ -3298,8 +3389,6 @@ if (false) {
3298
3389
  ParameterOptions.prototype.remember;
3299
3390
  /** @type {?|undefined} */
3300
3391
  ParameterOptions.prototype.defaultValue;
3301
- /** @type {?|undefined} */
3302
- ParameterOptions.prototype.sanitiser;
3303
3392
  }
3304
3393
  /**
3305
3394
  * @record
@@ -3315,8 +3404,6 @@ if (false) {
3315
3404
  ListParameterOptions.prototype.remember;
3316
3405
  /** @type {?|undefined} */
3317
3406
  ListParameterOptions.prototype.defaultValue;
3318
- /** @type {?|undefined} */
3319
- ListParameterOptions.prototype.sanitiser;
3320
3407
  }
3321
3408
  /**
3322
3409
  * @template T
@@ -3325,7 +3412,6 @@ if (false) {
3325
3412
  * @return {?}
3326
3413
  */
3327
3414
  function RouteId(type, options) {
3328
- // assert.isTruthy(type.isValid());
3329
3415
  return (/**
3330
3416
  * @param {?} prototype
3331
3417
  * @param {?} propertyKey
@@ -3333,7 +3419,7 @@ function RouteId(type, options) {
3333
3419
  */
3334
3420
  (prototype, propertyKey) => {
3335
3421
  /** @type {?} */
3336
- const param = createDefinition(propertyKey, type, options, true);
3422
+ const param = new ParameterDefinition.RouteId(propertyKey.toString(), type, options);
3337
3423
  Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
3338
3424
  UseDelegate()(prototype, propertyKey);
3339
3425
  });
@@ -3345,7 +3431,6 @@ function RouteId(type, options) {
3345
3431
  * @return {?}
3346
3432
  */
3347
3433
  function RouteParameter(type, options) {
3348
- // assert.isTruthy(type.isValid());
3349
3434
  return (/**
3350
3435
  * @param {?} prototype
3351
3436
  * @param {?} propertyKey
@@ -3353,7 +3438,7 @@ function RouteParameter(type, options) {
3353
3438
  */
3354
3439
  (prototype, propertyKey) => {
3355
3440
  /** @type {?} */
3356
- const param = createDefinition(propertyKey, type, options, false);
3441
+ const param = new ParameterDefinition.ValueParameter(propertyKey.toString(), type, options);
3357
3442
  Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
3358
3443
  UseDelegate()(prototype, propertyKey);
3359
3444
  });
@@ -3365,7 +3450,6 @@ function RouteParameter(type, options) {
3365
3450
  * @return {?}
3366
3451
  */
3367
3452
  function RouteParameterList(elementType, options) {
3368
- // assert.isTruthy(type.isValid());
3369
3453
  return (/**
3370
3454
  * @param {?} prototype
3371
3455
  * @param {?} propertyKey
@@ -3373,82 +3457,11 @@ function RouteParameterList(elementType, options) {
3373
3457
  */
3374
3458
  (prototype, propertyKey) => {
3375
3459
  /** @type {?} */
3376
- const param = createArrayDefinition(propertyKey, elementType, options);
3460
+ const param = new ParameterDefinition.ArrayParameter(propertyKey.toString(), elementType, options);
3377
3461
  Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
3378
3462
  UseDelegate()(prototype, propertyKey);
3379
3463
  });
3380
3464
  }
3381
- /**
3382
- * @template T
3383
- * @param {?} propertyName
3384
- * @param {?} type
3385
- * @param {?} options
3386
- * @param {?} routeId
3387
- * @return {?}
3388
- */
3389
- function createDefinition(propertyName, type, options, routeId) {
3390
- /** @type {?} */
3391
- const opts = Opts.get(options);
3392
- /** @type {?} */
3393
- const propertyNameAsString = assert.notNil(propertyName).toString();
3394
- /** @type {?} */
3395
- const def = {
3396
- name: opts.getOptional('as', propertyNameAsString),
3397
- propertyName: propertyNameAsString,
3398
- type: assert.notNil(type),
3399
- sanitiser: opts.getOptional('sanitiser', null),
3400
- isRouteId: routeId,
3401
- isArray: false
3402
- };
3403
- return def;
3404
- }
3405
- /**
3406
- * @template T
3407
- * @param {?} propertyName
3408
- * @param {?} type
3409
- * @param {?} options
3410
- * @return {?}
3411
- */
3412
- function createArrayDefinition(propertyName, type, options) {
3413
- /** @type {?} */
3414
- const opts = Opts.get(options);
3415
- /** @type {?} */
3416
- const propertyNameAsString = assert.notNil(propertyName).toString();
3417
- /** @type {?} */
3418
- const def = {
3419
- name: opts.getOptional('as', propertyNameAsString),
3420
- propertyName: propertyNameAsString,
3421
- type: assert.notNil(type),
3422
- sanitiser: opts.getOptional('sanitiser', null),
3423
- isRouteId: false,
3424
- isArray: true
3425
- };
3426
- return def;
3427
- }
3428
-
3429
- /**
3430
- * @fileoverview added by tsickle
3431
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3432
- */
3433
- /**
3434
- * @record
3435
- * @template T, S
3436
- */
3437
- function ParameterDefinition() { }
3438
- if (false) {
3439
- /** @type {?} */
3440
- ParameterDefinition.prototype.name;
3441
- /** @type {?} */
3442
- ParameterDefinition.prototype.propertyName;
3443
- /** @type {?} */
3444
- ParameterDefinition.prototype.type;
3445
- /** @type {?} */
3446
- ParameterDefinition.prototype.sanitiser;
3447
- /** @type {?} */
3448
- ParameterDefinition.prototype.isRouteId;
3449
- /** @type {?} */
3450
- ParameterDefinition.prototype.isArray;
3451
- }
3452
3465
 
3453
3466
  /**
3454
3467
  * @fileoverview added by tsickle
@@ -3467,20 +3480,6 @@ if (false) {
3467
3480
  */
3468
3481
  ParameterSanitiser.prototype.sanitise = function (value, visit) { };
3469
3482
  }
3470
- (function (ParameterSanitiser) {
3471
- /**
3472
- * @record
3473
- * @template T
3474
- */
3475
- function Options() { }
3476
- ParameterSanitiser.Options = Options;
3477
- if (false) {
3478
- /** @type {?|undefined} */
3479
- Options.prototype.remember;
3480
- /** @type {?|undefined} */
3481
- Options.prototype.defaultValue;
3482
- }
3483
- })(ParameterSanitiser || (ParameterSanitiser = {}));
3484
3483
 
3485
3484
  /**
3486
3485
  * @fileoverview added by tsickle
@@ -3518,7 +3517,7 @@ var ParameterType;
3518
3517
  * @return {?}
3519
3518
  */
3520
3519
  parse(value) {
3521
- return isNil(value) || isEmpty(value) ? null : +value;
3520
+ return ___default.isNil(value) || ___default.isEmpty(value) ? null : +value;
3522
3521
  }
3523
3522
  }
3524
3523
  class BooleanType {
@@ -3570,7 +3569,7 @@ class Sanitiser {
3570
3569
  * @return {?}
3571
3570
  */
3572
3571
  get valueChanged() {
3573
- return !isNil(this.initialValue) && this.hasChanged(this.initialValue, this.sanitisedValue);
3572
+ return !___default.isNil(this.initialValue) && this.hasChanged(this.initialValue, this.sanitisedValue);
3574
3573
  }
3575
3574
  /**
3576
3575
  * @return {?}
@@ -3640,13 +3639,11 @@ class RouteParameterSanitiser {
3640
3639
  /**
3641
3640
  * @param {?} parameterDefs
3642
3641
  * @param {?} snapshot
3643
- * @param {?} placeService
3644
3642
  * @param {?} injector
3645
3643
  */
3646
- constructor(parameterDefs, snapshot, placeService, injector) {
3644
+ constructor(parameterDefs, snapshot, injector) {
3647
3645
  this.parameterDefs = parameterDefs;
3648
3646
  this.snapshot = snapshot;
3649
- this.placeService = placeService;
3650
3647
  this.injector = injector;
3651
3648
  this.parameterSanitisers = [];
3652
3649
  /** @type {?} */
@@ -3700,17 +3697,7 @@ class RouteParameterSanitiser {
3700
3697
  * @return {?}
3701
3698
  */
3702
3699
  getSanitiser(def) {
3703
- if (def.sanitiser) {
3704
- if (this.isSanitiserContructor(def.sanitiser)) {
3705
- return this.injector.get(def.sanitiser, new def.sanitiser());
3706
- }
3707
- else {
3708
- return new DefaultParameterSanitiser(def, this.placeService, def.sanitiser);
3709
- }
3710
- }
3711
- else {
3712
- return null;
3713
- }
3700
+ return def.getSanitiser(this.injector);
3714
3701
  }
3715
3702
  /**
3716
3703
  * @return {?}
@@ -3744,13 +3731,13 @@ class RouteParameterSanitiser {
3744
3731
  * @return {?}
3745
3732
  */
3746
3733
  isSanitiserContructor(value) {
3747
- return isFunction(value) && lang.constructorChain((/** @type {?} */ ((/** @type {?} */ (value))))).includes(Sanitiser);
3734
+ return ___default.isFunction(value) && lang.constructorChain((/** @type {?} */ ((/** @type {?} */ (value))))).includes(Sanitiser);
3748
3735
  }
3749
3736
  }
3750
3737
  __decorate([
3751
- Memoize(),
3738
+ Memoize$1(),
3752
3739
  __metadata("design:type", Function),
3753
- __metadata("design:paramtypes", [Object]),
3740
+ __metadata("design:paramtypes", [ParameterDefinition]),
3754
3741
  __metadata("design:returntype", Object)
3755
3742
  ], RouteParameterSanitiser.prototype, "getSanitiser", null);
3756
3743
  __decorate([
@@ -3775,8 +3762,6 @@ if (false) {
3775
3762
  /** @type {?} */
3776
3763
  RouteParameterSanitiser.prototype.snapshot;
3777
3764
  /** @type {?} */
3778
- RouteParameterSanitiser.prototype.placeService;
3779
- /** @type {?} */
3780
3765
  RouteParameterSanitiser.prototype.injector;
3781
3766
  }
3782
3767
  (function (Sanitiser) {
@@ -3872,5 +3857,5 @@ if (false) {
3872
3857
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3873
3858
  */
3874
3859
 
3875
- export { ACTIVITY_DATA, AbstractActivity, AbstractInputComponent, AbstractPlaceNavigationComponent, ActivityContainerComponent, ActivityOutletComponent, AlertDialogComponent, AngularUiPowerupsModule, Bounds, BusyOverlayComponent, CommandDirective, ConfirmationDialogComponent, DEFINITION_META_DATA_KEY, DefaultParameterSanitiser, DialogInteractionService, Dimension, DisposableComponent, EmptyStateComponent, FocusBindingDirective, INTERACTION_CONTEXT, InteractionContext, InteractionModule, LEFT_RIGHT_PLACE_ANIMATION, LeavePlaceGuard, ListPlaceNavComponent, NumberInputComponent, ParameterSnapshot, ParameterType, PasswordInputComponent, Place, PlaceComponent, PlaceModule, PlaceOutletComponent, PlaceRouteGuard, PlaceService, Point, ROUTE_PARAMETER_LIST_KEY, ResizeAwareComponent, RouteId, RouteParameter, RouteParameterList, RouteParameterSanitiser, Sanitiser, SelectInputComponent, StringInputComponent, TabbedPlaceNavigationComponent, leftRightPlaceAnimation, slideDownAndUpAnimation, CommandDirective as ɵa, FocusBindingDirective as ɵb, DialogInteractionService as ɵbb, InteractionContext as ɵbc, DisposableComponent as ɵc, NumberInputComponent as ɵd, AbstractInputComponent as ɵe, StringInputComponent as ɵf, PasswordInputComponent as ɵg, SelectInputComponent as ɵh, PlaceModule as ɵi, EmptyStateComponent as ɵj, BusyOverlayComponent as ɵk, PlaceOutletComponent as ɵl, leftRightPlaceAnimation as ɵm, LEFT_RIGHT_PLACE_ANIMATION as ɵn, PlaceService as ɵo, TabbedPlaceNavigationComponent as ɵp, AbstractPlaceNavigationComponent as ɵq, ListPlaceNavComponent as ɵr, InteractionModule as ɵs, ActivityContainerComponent as ɵt, ActivityOutletComponent as ɵu, ConfirmationDialogComponent as ɵv, AbstractActivity as ɵw, ACTIVITY_DATA as ɵx, AlertDialogComponent as ɵz };
3860
+ export { ACTIVITY_DATA, AbstractActivity, AbstractInputComponent, AbstractPlaceNavigationComponent, ActivityContainerComponent, ActivityOutletComponent, AlertDialogComponent, AngularUiPowerupsModule, Bounds, BusyOverlayComponent, CommandDirective, ConfirmationDialogComponent, DEFINITION_META_DATA_KEY, DefaultParameterSanitiser, DialogInteractionService, Dimension, DisposableComponent, EmptyStateComponent, FocusBindingDirective, INTERACTION_CONTEXT, InteractionContext, InteractionModule, LEFT_RIGHT_PLACE_ANIMATION, LeavePlaceGuard, ListPlaceNavComponent, NumberInputComponent, ParameterDefinition, ParameterSnapshot, ParameterType, PasswordInputComponent, Place, PlaceComponent, PlaceDefinition, PlaceHistory, PlaceModule, PlaceOutletComponent, PlaceRouteGuard, PlaceRouter, Point, ROUTE_PARAMETER_LIST_KEY, ResizeAwareComponent, RouteId, RouteParameter, RouteParameterList, RouteParameterSanitiser, Sanitiser, SelectInputComponent, StringInputComponent, TabbedPlaceNavigationComponent, leftRightPlaceAnimation, slideDownAndUpAnimation, CommandDirective as ɵa, FocusBindingDirective as ɵb, AlertDialogComponent as ɵba, DialogInteractionService as ɵbc, InteractionContext as ɵbd, DisposableComponent as ɵc, NumberInputComponent as ɵd, AbstractInputComponent as ɵe, StringInputComponent as ɵf, PasswordInputComponent as ɵg, SelectInputComponent as ɵh, PlaceModule as ɵi, EmptyStateComponent as ɵj, BusyOverlayComponent as ɵk, PlaceOutletComponent as ɵl, leftRightPlaceAnimation as ɵm, LEFT_RIGHT_PLACE_ANIMATION as ɵn, PlaceRouter as ɵo, PlaceHistory as ɵp, TabbedPlaceNavigationComponent as ɵq, AbstractPlaceNavigationComponent as ɵr, ListPlaceNavComponent as ɵs, InteractionModule as ɵt, ActivityContainerComponent as ɵu, ActivityOutletComponent as ɵv, ConfirmationDialogComponent as ɵw, AbstractActivity as ɵx, ACTIVITY_DATA as ɵy };
3876
3861
  //# sourceMappingURL=coolon-angular-ui-powerups.js.map