@coolon/angular-ui-powerups 3.7.1 → 3.7.3

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 (58) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/bundles/coolon-angular-ui-powerups.umd.js +176 -114
  3. package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
  4. package/bundles/coolon-angular-ui-powerups.umd.min.js +1 -1
  5. package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -1
  6. package/coolon-angular-ui-powerups.metadata.json +1 -1
  7. package/esm2015/lib/components/commands/group/popup-menu/abstract-popup-menu.component.js +2 -2
  8. package/esm2015/lib/components/commands/group/popup-menu/abstract-popup-menu.component.js.map +1 -1
  9. package/esm2015/lib/components/forms/number-input/number-input.component.js.map +1 -1
  10. package/esm2015/lib/components/table/column-model.js +8 -0
  11. package/esm2015/lib/components/table/column-model.js.map +1 -1
  12. package/esm2015/lib/components/table/column-model.metadata.json +1 -1
  13. package/esm2015/lib/components/table/table.component.js +1 -1
  14. package/esm2015/lib/components/table/table.component.metadata.json +1 -1
  15. package/esm2015/lib/place/components/abstract-place-navigation.component.js +9 -5
  16. package/esm2015/lib/place/components/abstract-place-navigation.component.js.map +1 -1
  17. package/esm2015/lib/place/components/abstract-place-navigation.component.metadata.json +1 -1
  18. package/esm2015/lib/place/components/list-place-nav/list-place-nav.component.js +5 -5
  19. package/esm2015/lib/place/components/list-place-nav/list-place-nav.component.js.map +1 -1
  20. package/esm2015/lib/place/components/list-place-nav/list-place-nav.component.metadata.json +1 -1
  21. package/esm2015/lib/place/components/place-outlet/place-outlet.component.js +6 -16
  22. package/esm2015/lib/place/components/place-outlet/place-outlet.component.js.map +1 -1
  23. package/esm2015/lib/place/components/place-outlet/place-outlet.component.metadata.json +1 -1
  24. package/esm2015/lib/place/components/side-place-navigation/side-place-navigation.component.js +5 -8
  25. package/esm2015/lib/place/components/side-place-navigation/side-place-navigation.component.js.map +1 -1
  26. package/esm2015/lib/place/components/side-place-navigation/side-place-navigation.component.metadata.json +1 -1
  27. package/esm2015/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.js +5 -5
  28. package/esm2015/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.js.map +1 -1
  29. package/esm2015/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.metadata.json +1 -1
  30. package/esm2015/lib/place/exports.js +1 -1
  31. package/esm2015/lib/place/exports.js.map +1 -1
  32. package/esm2015/lib/place/exports.metadata.json +1 -1
  33. package/esm2015/lib/place/guards/place.guard.js +9 -13
  34. package/esm2015/lib/place/guards/place.guard.js.map +1 -1
  35. package/esm2015/lib/place/guards/place.guard.metadata.json +1 -1
  36. package/esm2015/lib/place/place-access-guard.js +28 -0
  37. package/esm2015/lib/place/place-access-guard.js.map +1 -0
  38. package/esm2015/lib/place/place-access-guard.metadata.json +1 -0
  39. package/esm2015/lib/place/place-router.js +36 -2
  40. package/esm2015/lib/place/place-router.js.map +1 -1
  41. package/esm2015/lib/place/place-router.metadata.json +1 -1
  42. package/fesm2015/coolon-angular-ui-powerups.js +167 -110
  43. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  44. package/lib/components/table/column-model.d.ts +6 -0
  45. package/lib/place/components/abstract-place-navigation.component.d.ts +3 -2
  46. package/lib/place/components/list-place-nav/list-place-nav.component.d.ts +2 -2
  47. package/lib/place/components/place-outlet/place-outlet.component.d.ts +1 -3
  48. package/lib/place/components/side-place-navigation/side-place-navigation.component.d.ts +2 -4
  49. package/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.d.ts +2 -2
  50. package/lib/place/exports.d.ts +1 -1
  51. package/lib/place/guards/place.guard.d.ts +1 -3
  52. package/lib/place/place-access-guard.d.ts +11 -0
  53. package/lib/place/place-router.d.ts +18 -4
  54. package/package.json +1 -1
  55. package/esm2015/lib/place/place-auth-service.js +0 -3
  56. package/esm2015/lib/place/place-auth-service.js.map +0 -1
  57. package/esm2015/lib/place/place-auth-service.metadata.json +0 -1
  58. package/lib/place/place-auth-service.d.ts +0 -36
@@ -1 +1 @@
1
- [{"__symbolic":"module","version":4,"metadata":{"PlaceRouter":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"@coolon/pectin","name":"GarbageCollector","line":42,"character":33},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":39,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/router","name":"Router","line":55,"character":46},{"__symbolic":"reference","module":"@angular/common","name":"Location","line":56,"character":48},{"__symbolic":"reference","module":"../interaction/services/interaction.service","name":"InteractionService","line":57,"character":51},{"__symbolic":"reference","module":"./url-service","name":"UrlService","line":58,"character":43},{"__symbolic":"reference","module":"./place-history","name":"PlaceHistory","line":59,"character":45}]}],"isNavigating":[{"__symbolic":"method"}],"onPopState":[{"__symbolic":"method"}],"onRouterStarted":[{"__symbolic":"method"}],"onUrlChanged":[{"__symbolic":"method"}],"onRouterCancelled":[{"__symbolic":"method"}],"onRouterError":[{"__symbolic":"method"}],"onRouterEnd":[{"__symbolic":"method"}],"navigate":[{"__symbolic":"method"}],"doNavigation":[{"__symbolic":"method"}],"navigateByUrl":[{"__symbolic":"method"}],"pushVisitChangesToRoute":[{"__symbolic":"method"}],"createNavigationSession":[{"__symbolic":"method"}],"transitionTo":[{"__symbolic":"method"}],"routingSessionFinished":[{"__symbolic":"method"}],"runAfterRoutingSessionFinishes":[{"__symbolic":"method"}],"syncInteractionContextIdsWithRouter":[{"__symbolic":"method"}],"createRouteParameters":[{"__symbolic":"method"}]},"statics":{"ɵprov":{}}}}}]
1
+ [{"__symbolic":"module","version":4,"metadata":{"PlaceRouter":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"@coolon/pectin","name":"GarbageCollector","line":48,"character":33},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":45,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/router","name":"Router","line":68,"character":46},{"__symbolic":"reference","module":"@angular/common","name":"Location","line":69,"character":48},{"__symbolic":"reference","module":"../interaction/services/interaction.service","name":"InteractionService","line":70,"character":51},{"__symbolic":"reference","module":"./url-service","name":"UrlService","line":71,"character":43},{"__symbolic":"reference","module":"./place-history","name":"PlaceHistory","line":72,"character":45}]}],"configureAuth":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@coolon/pectin","name":"Trace","line":150,"character":3}}]}],"getAuthenticationFailureRedirect":[{"__symbolic":"method"}],"getAuthorisationFailureRedirect":[{"__symbolic":"method"}],"isNavigating":[{"__symbolic":"method"}],"onPopState":[{"__symbolic":"method"}],"onRouterStarted":[{"__symbolic":"method"}],"onUrlChanged":[{"__symbolic":"method"}],"onRouterCancelled":[{"__symbolic":"method"}],"onRouterError":[{"__symbolic":"method"}],"onRouterEnd":[{"__symbolic":"method"}],"navigate":[{"__symbolic":"method"}],"doNavigation":[{"__symbolic":"method"}],"navigateByUrl":[{"__symbolic":"method"}],"pushVisitChangesToRoute":[{"__symbolic":"method"}],"createNavigationSession":[{"__symbolic":"method"}],"transitionTo":[{"__symbolic":"method"}],"routingSessionFinished":[{"__symbolic":"method"}],"runAfterRoutingSessionFinishes":[{"__symbolic":"method"}],"syncInteractionContextIdsWithRouter":[{"__symbolic":"method"}],"createRouteParameters":[{"__symbolic":"method"}]},"statics":{"ɵprov":{}}}}}]
@@ -21,13 +21,13 @@ import { fas } from '@fortawesome/free-solid-svg-icons';
21
21
  import { GarbageCollector, DelegatingValueModel, assert, UnaryCommand, lang, Dsl, Logger, TrackExternal, Command, ValueModel, StoreInValueModel, MutableListModel, Disposable, DelegatingListModel, StoreInListModel, MutableValueModel, FocusManager, EventListenerList, Form, Guard, Binding, DebugContext, ListModel, MultipleSelectionModel, DirtyTrackingForm, DelegatingCommand, Deferred, Trace, Functions } from '@coolon/pectin';
22
22
  import { __decorate, __metadata, __awaiter } from 'tslib';
23
23
  import { Memoize } from '@typescript-plus/fast-memoize-decorator/dist/src';
24
- import _, { isNil, isEqual } from 'lodash';
24
+ import _, { isEqual, isNil } from 'lodash';
25
25
  import { Enum } from 'typescript-string-enums';
26
26
  import { assert as assert$1, Opts, lang as lang$1, Klass } from '@coolon/typescript-utilities';
27
27
  import produce from 'immer';
28
28
  import { FlexModule, GridModule } from '@angular/flex-layout';
29
29
  import { MatDialogModule, MatDialog, MAT_DIALOG_DEFAULT_OPTIONS, MatDialogConfig } from '@angular/material/dialog';
30
- import { RouterModule, ActivatedRouteSnapshot, NavigationStart, NavigationCancel, UrlSegment, Router, UrlSerializer, NavigationEnd, NavigationError, RouterOutlet } from '@angular/router';
30
+ import { RouterModule, ActivatedRouteSnapshot, NavigationStart, NavigationCancel, UrlSegment, Router, UrlSerializer, NavigationEnd, NavigationError } from '@angular/router';
31
31
  import { Overlay, CdkScrollable } from '@angular/cdk/overlay';
32
32
  import ResizeObserver from 'resize-observer-polyfill';
33
33
  import { MatListModule } from '@angular/material/list';
@@ -714,11 +714,11 @@ class AbstractPopupMenuComponent extends PopupAwareComponent {
714
714
  this._unorderedChildren.value = [...this._unorderedChildren.value];
715
715
  }
716
716
  get faceAdapter() {
717
- var _a;
717
+ var _a, _b;
718
718
  if (!this.faceAdapterModel) {
719
719
  console.error("Somehow faceAdapterModel is nil -- set a break point here and let me know what's going on");
720
720
  }
721
- return (_a = this.faceAdapterModel) === null || _a === void 0 ? void 0 : _a.value;
721
+ return (_b = (_a = this.faceAdapterModel) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : new CommandFace.Adapter(undefined);
722
722
  }
723
723
  isRoot() {
724
724
  return !this.parent;
@@ -2118,6 +2118,14 @@ class PropertyColumnModel extends ColumnModel {
2118
2118
  }));
2119
2119
  return this;
2120
2120
  }
2121
+ liveEditCellRenderer(componentType, options) {
2122
+ return this.mutableCellRenderer(componentType, options);
2123
+ }
2124
+ /**
2125
+ * Deprecated. Use #liveEditCellRenderer instead.
2126
+ * @param componentType
2127
+ * @param options
2128
+ */
2121
2129
  mutableCellRenderer(componentType, options) {
2122
2130
  this.configureCellRenderer(new ComponentCellRendererPortalRef(componentType, (component, rowData, firstTime) => {
2123
2131
  // keep a local copy most recent row value so it's available to teh
@@ -2580,7 +2588,7 @@ TableComponent.decorators = [
2580
2588
  { type: Component, args: [{
2581
2589
  selector: 'aup-table',
2582
2590
  template: "<table mat-table [dataSource]=\"tableModel.dataSource.value\" [trackBy]=\"tableModel.trackBy\">\n\n <ng-container *ngFor=\"let column of columns.value; index as index; first as first; last as last\" matColumnDef=\"{{column.columnId}}\">\n <th mat-header-cell *matHeaderCellDef>\n <aup-table-header-cell-renderer [column]=\"column\"\n [attr.column-index]=\"index\"\n [attr.column-id]=\"column.columnId\"\n [class.first-column]=\"first\"\n [class.last-column]=\"last\"\n ></aup-table-header-cell-renderer>\n </th>\n <td mat-cell *matCellDef=\"let row\" (click)=\"onCellClicked(column, row)\" [class.enable-cursor]=\"tableModel.isRowSelectionEnabledFor(column)\">\n <aup-table-cell-renderer [column]=\"column\"\n [row]=\"row\"\n [tableModel]=\"tableModel\"\n [editSession]=\"tableModel.getEditSessionFor(row)\"\n [attr.column-index]=\"index\"\n [attr.column-id]=\"column.columnId\"\n [class.first-column]=\"first\"\n [class.last-column]=\"last\"\n ></aup-table-cell-renderer>\n </td>\n </ng-container>\n\n <tr mat-header-row *matHeaderRowDef=\"columnIds.value\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: columnIds.value; let i = index\"\n [ngClass]=\"tableModel.getRowClasses(row)\" [attr.trackBy]=\"tableModel.trackBy(i, row)\"\n ></tr>\n\n</table>\n",
2583
- styles: [":host{align-items:stretch;display:flex;flex-direction:column}:host table{flex:1}"]
2591
+ styles: [":host{align-items:stretch;display:flex;flex-direction:column}:host table{flex:1;width:100%}"]
2584
2592
  },] }
2585
2593
  ];
2586
2594
  TableComponent.ctorParameters = () => [];
@@ -4192,8 +4200,6 @@ InteractionModule.decorators = [
4192
4200
  },] }
4193
4201
  ];
4194
4202
 
4195
- const PLACE_AUTH_SERVICE = new InjectionToken("PlaceAuthService");
4196
-
4197
4203
  class ParameterDefinition {
4198
4204
  constructor(propertyName, options, urlFormat) {
4199
4205
  this.propertyName = propertyName;
@@ -4522,72 +4528,6 @@ __decorate([
4522
4528
  PlaceComponent.injectDefinition = injectDefinition;
4523
4529
  })(PlaceComponent || (PlaceComponent = {}));
4524
4530
 
4525
- class Visit {
4526
- constructor(placeDefinition, visitParameters = {}) {
4527
- this.placeDefinition = placeDefinition;
4528
- this.visitParameters = visitParameters;
4529
- }
4530
- // @Trace()
4531
- getRouteId() {
4532
- return this.placeDefinition.getRouteIdFrom(this);
4533
- }
4534
- // @Trace()
4535
- hasRouteId() {
4536
- return !isNil(this.getRouteId());
4537
- }
4538
- /**
4539
- * Returns the value of the place parameter with the specified name. The parameter
4540
- * name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the
4541
- * same as the the ValueModel property name.
4542
- * @param parameterName the field name of the property model or the `as` option if specified.
4543
- */
4544
- getParameter(parameterName) {
4545
- return this.visitParameters[parameterName];
4546
- }
4547
- // @Trace()
4548
- hasParameter(parameterName) {
4549
- return Object.keys(this.visitParameters).includes(parameterName);
4550
- }
4551
- replace(parameter, value) {
4552
- return new Visit(this.placeDefinition, Object.assign(Object.assign({}, this.visitParameters), { [parameter.name]: value }));
4553
- }
4554
- mergeRouteParameters(routeParams) {
4555
- // todo: whitelist parameters.
4556
- const routeParameterKeys = Object.keys(routeParams);
4557
- const params = {};
4558
- this.placeDefinition.getVisitParameterDefs().forEach(def => {
4559
- if (def.isRouteId || def.isRouteParameter) {
4560
- if (routeParameterKeys.includes(def.name)) {
4561
- params[def.name] = routeParams[def.name];
4562
- }
4563
- }
4564
- else {
4565
- // copy non route params as is, but only if they already exist otherwise we'll inject nil values and break the
4566
- // defaults and remember sanitisation process.
4567
- const value = this.getParameter(def.name);
4568
- if (this.hasParameter(def.name)) {
4569
- params[def.name] = value;
4570
- }
4571
- }
4572
- });
4573
- return new Visit(this.placeDefinition, params);
4574
- }
4575
- hasRoutingChangedFrom(other) {
4576
- const samePlace = other.placeDefinition === this.placeDefinition;
4577
- const sameRouteParameters = isEqual(this.placeDefinition.getFormattedRouteParameters(this, true), this.placeDefinition.getFormattedRouteParameters(other, true));
4578
- return !samePlace || !sameRouteParameters;
4579
- }
4580
- hasChangedFrom(other) {
4581
- const sameNonRouteParameters = isEqual(this.placeDefinition.getNonRouteParameters(this), this.placeDefinition.getNonRouteParameters(other));
4582
- return !sameNonRouteParameters || this.hasRoutingChangedFrom(other);
4583
- }
4584
- toDebugString() {
4585
- return Object.keys(this.visitParameters).map(k => `${k}=${this.visitParameters[k]}`).join(",");
4586
- }
4587
- }
4588
-
4589
- const AUP_PLACE_CONFIG = new InjectionToken('AUP_PLACE_CONFIG');
4590
-
4591
4531
  /**
4592
4532
  * This class handles the logic around canDeactivate for a given router state transition. It's core responsibilities are:
4593
4533
  * 1. Ensure we only ask the component to deactivate once on a given navigation cycle (since visit sanitisation can result in multiple round trips to through the router.)
@@ -5357,6 +5297,31 @@ class PopStateNavigation extends AbstractPopStateNavigation {
5357
5297
  }
5358
5298
  }
5359
5299
 
5300
+ var PlaceAccessGuard;
5301
+ (function (PlaceAccessGuard) {
5302
+ class NoAuth {
5303
+ isAuthenticated() {
5304
+ return true;
5305
+ }
5306
+ isAuthorised(placeDefinition) {
5307
+ return true;
5308
+ }
5309
+ }
5310
+ __decorate([
5311
+ Trace(),
5312
+ __metadata("design:type", Function),
5313
+ __metadata("design:paramtypes", []),
5314
+ __metadata("design:returntype", Object)
5315
+ ], NoAuth.prototype, "isAuthenticated", null);
5316
+ __decorate([
5317
+ Trace(),
5318
+ __metadata("design:type", Function),
5319
+ __metadata("design:paramtypes", [PlaceDefinition]),
5320
+ __metadata("design:returntype", Boolean)
5321
+ ], NoAuth.prototype, "isAuthorised", null);
5322
+ PlaceAccessGuard.NoAuth = NoAuth;
5323
+ })(PlaceAccessGuard || (PlaceAccessGuard = {}));
5324
+
5360
5325
  class PlaceHistory {
5361
5326
  constructor() {
5362
5327
  this._archive = new Map();
@@ -5656,6 +5621,11 @@ class PlaceRouter extends GarbageCollector {
5656
5621
  this.navigationSessionModel = new MutableValueModel();
5657
5622
  this._activeVisits = new MutableListModel();
5658
5623
  this.sessionFinishedJobs = [];
5624
+ /**
5625
+ * An observable model containing the authoriser function. This allows places to react to changes
5626
+ * in permissions when any underlying auth logic changes, e.g. a role being removed from a user.
5627
+ */
5628
+ this._accessGuard = new DelegatingValueModel().withDefault(new PlaceAccessGuard.NoAuth());
5659
5629
  if (window['Cypress']) {
5660
5630
  window['aup.PlaceRouter'] = this;
5661
5631
  }
@@ -5714,6 +5684,28 @@ class PlaceRouter extends GarbageCollector {
5714
5684
  // the back button was clicked.
5715
5685
  angularLocation.onUrlChange(url => this.onUrlChanged(url));
5716
5686
  }
5687
+ get accessGuard() {
5688
+ return this._accessGuard.readonly;
5689
+ }
5690
+ configureAuth(accessGrant, redirections) {
5691
+ // We need a shitty mutable model until setDelegate is clever enough to work with readonly models.
5692
+ const hackyMutableModel = new MutableValueModel();
5693
+ const binding = new Binding(hackyMutableModel, accessGrant, {
5694
+ toRight(leftValue) {
5695
+ return lang.illegalState('hackyMutableModel is read only');
5696
+ },
5697
+ toLeft: (rightValue) => rightValue
5698
+ });
5699
+ binding.writeLeft();
5700
+ this._accessGuard.setDelegate(hackyMutableModel);
5701
+ this.redirections = redirections;
5702
+ }
5703
+ getAuthenticationFailureRedirect(activatedRoute, state) {
5704
+ return this.redirections.onAuthenticationFailure(activatedRoute, state);
5705
+ }
5706
+ getAuthorisationFailureRedirect(activatedRoute, state) {
5707
+ return this.redirections.onAuthorisationFailure(activatedRoute, state);
5708
+ }
5717
5709
  get navigationSession() {
5718
5710
  return this.navigationSessionModel.value;
5719
5711
  }
@@ -5914,6 +5906,78 @@ PlaceRouter.ctorParameters = () => [
5914
5906
  { type: UrlService },
5915
5907
  { type: PlaceHistory }
5916
5908
  ];
5909
+ __decorate([
5910
+ Trace(),
5911
+ __metadata("design:type", Function),
5912
+ __metadata("design:paramtypes", [ValueModel, Object]),
5913
+ __metadata("design:returntype", void 0)
5914
+ ], PlaceRouter.prototype, "configureAuth", null);
5915
+
5916
+ class Visit {
5917
+ constructor(placeDefinition, visitParameters = {}) {
5918
+ this.placeDefinition = placeDefinition;
5919
+ this.visitParameters = visitParameters;
5920
+ }
5921
+ // @Trace()
5922
+ getRouteId() {
5923
+ return this.placeDefinition.getRouteIdFrom(this);
5924
+ }
5925
+ // @Trace()
5926
+ hasRouteId() {
5927
+ return !isNil(this.getRouteId());
5928
+ }
5929
+ /**
5930
+ * Returns the value of the place parameter with the specified name. The parameter
5931
+ * name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the
5932
+ * same as the the ValueModel property name.
5933
+ * @param parameterName the field name of the property model or the `as` option if specified.
5934
+ */
5935
+ getParameter(parameterName) {
5936
+ return this.visitParameters[parameterName];
5937
+ }
5938
+ // @Trace()
5939
+ hasParameter(parameterName) {
5940
+ return Object.keys(this.visitParameters).includes(parameterName);
5941
+ }
5942
+ replace(parameter, value) {
5943
+ return new Visit(this.placeDefinition, Object.assign(Object.assign({}, this.visitParameters), { [parameter.name]: value }));
5944
+ }
5945
+ mergeRouteParameters(routeParams) {
5946
+ // todo: whitelist parameters.
5947
+ const routeParameterKeys = Object.keys(routeParams);
5948
+ const params = {};
5949
+ this.placeDefinition.getVisitParameterDefs().forEach(def => {
5950
+ if (def.isRouteId || def.isRouteParameter) {
5951
+ if (routeParameterKeys.includes(def.name)) {
5952
+ params[def.name] = routeParams[def.name];
5953
+ }
5954
+ }
5955
+ else {
5956
+ // copy non route params as is, but only if they already exist otherwise we'll inject nil values and break the
5957
+ // defaults and remember sanitisation process.
5958
+ const value = this.getParameter(def.name);
5959
+ if (this.hasParameter(def.name)) {
5960
+ params[def.name] = value;
5961
+ }
5962
+ }
5963
+ });
5964
+ return new Visit(this.placeDefinition, params);
5965
+ }
5966
+ hasRoutingChangedFrom(other) {
5967
+ const samePlace = other.placeDefinition === this.placeDefinition;
5968
+ const sameRouteParameters = isEqual(this.placeDefinition.getFormattedRouteParameters(this, true), this.placeDefinition.getFormattedRouteParameters(other, true));
5969
+ return !samePlace || !sameRouteParameters;
5970
+ }
5971
+ hasChangedFrom(other) {
5972
+ const sameNonRouteParameters = isEqual(this.placeDefinition.getNonRouteParameters(this), this.placeDefinition.getNonRouteParameters(other));
5973
+ return !sameNonRouteParameters || this.hasRoutingChangedFrom(other);
5974
+ }
5975
+ toDebugString() {
5976
+ return Object.keys(this.visitParameters).map(k => `${k}=${this.visitParameters[k]}`).join(",");
5977
+ }
5978
+ }
5979
+
5980
+ const AUP_PLACE_CONFIG = new InjectionToken('AUP_PLACE_CONFIG');
5917
5981
 
5918
5982
  // Freezes the state of the components at the start of the animation.
5919
5983
  const animationStartStyle = style({ position: 'absolute', top: '0', left: '0', bottom: '0', right: '0' });
@@ -5960,11 +6024,10 @@ function leftRightPlaceAnimation(duration) {
5960
6024
  const LEFT_RIGHT_PLACE_ANIMATION = leftRightPlaceAnimation('0.3s');
5961
6025
 
5962
6026
  class PlaceOutletComponent extends DisposableComponent {
5963
- constructor(router, placeRouter, placeAuthService, placeConfig, parentOutlet) {
6027
+ constructor(router, placeRouter, placeConfig, parentOutlet) {
5964
6028
  super();
5965
6029
  this.router = router;
5966
6030
  this.placeRouter = placeRouter;
5967
- this.placeAuthService = placeAuthService;
5968
6031
  this.placeConfig = placeConfig;
5969
6032
  this.placeChanged = new EventEmitter();
5970
6033
  this.outletActivated = new MutableValueModel(false);
@@ -6009,11 +6072,11 @@ class PlaceOutletComponent extends DisposableComponent {
6009
6072
  chain(this._activePlaceModel)
6010
6073
  .postponeWhile(this.navigationInProgress)
6011
6074
  .subscribe(place => this.placeChanged.emit(place));
6012
- when(placeAuthService.authoriserModel).changes(isAuthorised => {
6075
+ when(placeRouter.accessGuard).changes(guard => {
6013
6076
  const activePlace = this._activePlaceModel.value;
6014
- if (activePlace && !isAuthorised(activePlace.placeDefinition)) {
6015
- const visitOrPlace = placeAuthService.handleNotAuthorised(this._activatedRouteModel.value.snapshot, this.router.routerState.snapshot);
6016
- this.placeRouter.navigate(visitOrPlace instanceof Visit ? visitOrPlace : new Visit(PlaceComponent.getDefinition(visitOrPlace)));
6077
+ if (activePlace && !guard.isAuthorised(activePlace.placeDefinition)) {
6078
+ const visit = placeRouter.getAuthorisationFailureRedirect(this._activatedRouteModel.value.snapshot, this.router.routerState.snapshot);
6079
+ this.placeRouter.navigate(visit);
6017
6080
  }
6018
6081
  });
6019
6082
  }
@@ -6046,6 +6109,7 @@ class PlaceOutletComponent extends DisposableComponent {
6046
6109
  get activatedRouteModel() {
6047
6110
  return this._activatedRouteModel.readonly;
6048
6111
  }
6112
+ // @Trace()
6049
6113
  onOutletActivated(routerOutlet, place) {
6050
6114
  this._activatedRouteModel.value = routerOutlet.activatedRoute;
6051
6115
  this._activePlaceModel.value = place;
@@ -6137,7 +6201,6 @@ PlaceOutletComponent.decorators = [
6137
6201
  PlaceOutletComponent.ctorParameters = () => [
6138
6202
  { type: Router },
6139
6203
  { type: PlaceRouter },
6140
- { type: undefined, decorators: [{ type: Inject, args: [PLACE_AUTH_SERVICE,] }] },
6141
6204
  { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [AUP_PLACE_CONFIG,] }] },
6142
6205
  { type: PlaceOutletComponent, decorators: [{ type: SkipSelf }, { type: Optional }] }
6143
6206
  ];
@@ -6165,12 +6228,6 @@ __decorate([
6165
6228
  StoreInListModel('customPlaceAnimationOrderModel'),
6166
6229
  __metadata("design:type", Array)
6167
6230
  ], PlaceOutletComponent.prototype, "customPlaceAnimationOrder", void 0);
6168
- __decorate([
6169
- Trace(),
6170
- __metadata("design:type", Function),
6171
- __metadata("design:paramtypes", [RouterOutlet, PlaceComponent]),
6172
- __metadata("design:returntype", void 0)
6173
- ], PlaceOutletComponent.prototype, "onOutletActivated", null);
6174
6231
  __decorate([
6175
6232
  Trace(),
6176
6233
  __metadata("design:type", Function),
@@ -6179,13 +6236,17 @@ __decorate([
6179
6236
  ], PlaceOutletComponent.prototype, "onOutletDeactivated", null);
6180
6237
 
6181
6238
  class AbstractPlaceNavigationComponent extends DisposableComponent {
6182
- constructor(authService) {
6239
+ constructor(placeRouter) {
6183
6240
  super();
6241
+ this.placeRouter = placeRouter;
6184
6242
  this._activePlaceComponent = new DelegatingValueModel();
6185
6243
  const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
6186
6244
  this.placeDefinitions = chain(this.placesModel)
6187
6245
  .map(c => PlaceComponent.getDefinition(c))
6188
- .select(d => authService.authoriserModel.value(d), { dependsOn: authService.authoriserModel });
6246
+ .select(d => {
6247
+ const guard = placeRouter.accessGuard.value;
6248
+ return guard.isAuthorised(d);
6249
+ }, { dependsOn: placeRouter.accessGuard });
6189
6250
  this.commandFactory = Command.createFactory((placeDefinition) => {
6190
6251
  this.placeOutlet.navigate(new Visit(placeDefinition));
6191
6252
  });
@@ -6217,7 +6278,7 @@ AbstractPlaceNavigationComponent.decorators = [
6217
6278
  },] }
6218
6279
  ];
6219
6280
  AbstractPlaceNavigationComponent.ctorParameters = () => [
6220
- { type: undefined, decorators: [{ type: Inject, args: [PLACE_AUTH_SERVICE,] }] }
6281
+ { type: PlaceRouter }
6221
6282
  ];
6222
6283
  AbstractPlaceNavigationComponent.propDecorators = {
6223
6284
  places: [{ type: Input }],
@@ -6295,8 +6356,8 @@ EmptyStateComponent.decorators = [
6295
6356
  EmptyStateComponent.ctorParameters = () => [];
6296
6357
 
6297
6358
  class ListPlaceNavComponent extends AbstractPlaceNavigationComponent {
6298
- constructor(authService) {
6299
- super(authService);
6359
+ constructor(router) {
6360
+ super(router);
6300
6361
  }
6301
6362
  }
6302
6363
  ListPlaceNavComponent.decorators = [
@@ -6307,7 +6368,7 @@ ListPlaceNavComponent.decorators = [
6307
6368
  },] }
6308
6369
  ];
6309
6370
  ListPlaceNavComponent.ctorParameters = () => [
6310
- { type: undefined, decorators: [{ type: Inject, args: [PLACE_AUTH_SERVICE,] }] }
6371
+ { type: PlaceRouter }
6311
6372
  ];
6312
6373
 
6313
6374
  /**
@@ -6353,9 +6414,8 @@ ListPlaceNavComponent.ctorParameters = () => [
6353
6414
  * })
6354
6415
  */
6355
6416
  class SidePlaceNavigationComponent extends AbstractPlaceNavigationComponent {
6356
- constructor(router, authService) {
6357
- super(authService);
6358
- this.router = router;
6417
+ constructor(router) {
6418
+ super(router);
6359
6419
  this.expanded = false;
6360
6420
  }
6361
6421
  expandMenu() {
@@ -6376,8 +6436,7 @@ SidePlaceNavigationComponent.decorators = [
6376
6436
  },] }
6377
6437
  ];
6378
6438
  SidePlaceNavigationComponent.ctorParameters = () => [
6379
- { type: Router },
6380
- { type: undefined, decorators: [{ type: Inject, args: [PLACE_AUTH_SERVICE,] }] }
6439
+ { type: PlaceRouter }
6381
6440
  ];
6382
6441
  SidePlaceNavigationComponent.propDecorators = {
6383
6442
  expanded: [{ type: HostBinding, args: ['class.expanded',] }],
@@ -6385,8 +6444,8 @@ SidePlaceNavigationComponent.propDecorators = {
6385
6444
  };
6386
6445
 
6387
6446
  class TabbedPlaceNavigationComponent extends AbstractPlaceNavigationComponent {
6388
- constructor(authService) {
6389
- super(authService);
6447
+ constructor(router) {
6448
+ super(router);
6390
6449
  }
6391
6450
  }
6392
6451
  TabbedPlaceNavigationComponent.decorators = [
@@ -6397,7 +6456,7 @@ TabbedPlaceNavigationComponent.decorators = [
6397
6456
  },] }
6398
6457
  ];
6399
6458
  TabbedPlaceNavigationComponent.ctorParameters = () => [
6400
- { type: undefined, decorators: [{ type: Inject, args: [PLACE_AUTH_SERVICE,] }] }
6459
+ { type: PlaceRouter }
6401
6460
  ];
6402
6461
 
6403
6462
  class PlaceModule {
@@ -6707,12 +6766,11 @@ class VisitSanitiser {
6707
6766
  }
6708
6767
 
6709
6768
  class PlaceGuard {
6710
- constructor(router, urlService, placeRouter, placeHistory, placeAuthService, interactionService, injector) {
6769
+ constructor(router, urlService, placeRouter, placeHistory, interactionService, injector) {
6711
6770
  this.router = router;
6712
6771
  this.urlService = urlService;
6713
6772
  this.placeRouter = placeRouter;
6714
6773
  this.placeHistory = placeHistory;
6715
- this.placeAuthService = placeAuthService;
6716
6774
  this.interactionService = interactionService;
6717
6775
  this.injector = injector;
6718
6776
  }
@@ -6722,18 +6780,18 @@ class PlaceGuard {
6722
6780
  if (PlaceComponent.isPlaceComponentConstructor(activatedRoute.component)) {
6723
6781
  const placeDefinition = PlaceComponent.getDefinition(activatedRoute.component);
6724
6782
  if (placeDefinition.authenticate) {
6725
- if (!(yield this.placeAuthService.isAuthenticated())) {
6726
- const redirectLocation = this.placeAuthService.handleNotAuthenticated(activatedRoute, state);
6783
+ if (!(yield this.placeRouter.accessGuard.value.isAuthenticated())) {
6784
+ const redirectLocation = this.placeRouter.getAuthenticationFailureRedirect(activatedRoute, state);
6727
6785
  const nextPlaceDef = this.getPlaceDefinition(redirectLocation);
6728
6786
  if (nextPlaceDef.authenticate) {
6729
6787
  lang.illegalState(`handleNotAuthenticated hook returned place ${nextPlaceDef.component.name} that requires authentication.`);
6730
6788
  }
6731
6789
  return this.createUrlTree(redirectLocation);
6732
6790
  }
6733
- if (!this.placeAuthService.isAuthorised(placeDefinition)) {
6734
- const redirectLocation = this.placeAuthService.handleNotAuthorised(activatedRoute, state);
6791
+ if (!(this.placeRouter.accessGuard.value ? this.placeRouter.accessGuard.value.isAuthorised(placeDefinition) : true)) {
6792
+ const redirectLocation = this.placeRouter.getAuthorisationFailureRedirect(activatedRoute, state);
6735
6793
  const nextPlaceDef = this.getPlaceDefinition(redirectLocation);
6736
- if (!this.placeAuthService.isAuthorised(nextPlaceDef)) {
6794
+ if (!(this.placeRouter.accessGuard.value ? this.placeRouter.accessGuard.value.isAuthorised(nextPlaceDef) : true)) {
6737
6795
  lang.illegalState(`handleNotAuthorised hook returned place ${nextPlaceDef.component.name} that is not authorised for the current user.`);
6738
6796
  }
6739
6797
  return this.createUrlTree(redirectLocation);
@@ -6820,7 +6878,7 @@ class PlaceGuard {
6820
6878
  });
6821
6879
  }
6822
6880
  }
6823
- PlaceGuard.ɵprov = ɵɵdefineInjectable({ factory: function PlaceGuard_Factory() { return new PlaceGuard(ɵɵinject(Router), ɵɵinject(UrlService), ɵɵinject(PlaceRouter), ɵɵinject(PlaceHistory), ɵɵinject(PLACE_AUTH_SERVICE), ɵɵinject(InteractionService), ɵɵinject(INJECTOR)); }, token: PlaceGuard, providedIn: "root" });
6881
+ PlaceGuard.ɵprov = ɵɵdefineInjectable({ factory: function PlaceGuard_Factory() { return new PlaceGuard(ɵɵinject(Router), ɵɵinject(UrlService), ɵɵinject(PlaceRouter), ɵɵinject(PlaceHistory), ɵɵinject(InteractionService), ɵɵinject(INJECTOR)); }, token: PlaceGuard, providedIn: "root" });
6824
6882
  PlaceGuard.decorators = [
6825
6883
  { type: Injectable, args: [{ providedIn: 'root' },] }
6826
6884
  ];
@@ -6829,7 +6887,6 @@ PlaceGuard.ctorParameters = () => [
6829
6887
  { type: UrlService },
6830
6888
  { type: PlaceRouter },
6831
6889
  { type: PlaceHistory },
6832
- { type: undefined, decorators: [{ type: Inject, args: [PLACE_AUTH_SERVICE,] }] },
6833
6890
  { type: InteractionService },
6834
6891
  { type: Injector }
6835
6892
  ];
@@ -6934,5 +6991,5 @@ function VisitParameterList(options) {
6934
6991
  * Generated bundle index. Do not edit.
6935
6992
  */
6936
6993
 
6937
- export { ACTIVITY_DATA, AUP_PLACE_CONFIG, AbstractInputActivity, AbstractInputComponent, AbstractInteractionContext, AbstractListInputComponent, AbstractPlaceNavigationComponent, AbstractPopStateNavigation, AbstractPopupMenuComponent, AbstractValueInputComponent, Activity, ActivityActionsComponent, ActivityContainerComponent, ActivityOutletComponent, ActivityRef, AddItemInteractionContextComponent, AlertDialogComponent, AngularUiPowerupsModule, AutocompleteInputComponent, Bounds, BusyOverlayComponent, CELL_EDITOR_PORTAL, CELL_RENDERER_PORTAL, CardContainerComponent, CellEditorPortalRef, CellHeaderPortalRef, CellPortalRef, CellRendererPortalRef, CheckboxInputComponent, ColumnModel, ColumnTemplateDirective, CommandComponent, CommandContainer, CommandDirective, CommandFace, CommandFaceComponent, ComponentCellRendererPortalRef, ComponentsModule, ConfirmThenDialogComponent, ConfirmationDialogComponent, ConsolidatedParameterMap, CustomTemplateColumnModel, CustomValueColumnModel, DEFINITION_META_DATA_KEY, DIALOG_INTERACTION_SERVICE_DEFAULTS, DefaultCellRendererComponent, DefaultHeaderCellRendererComponent, DialogInteractionContext, DialogInteractionContextFactory, Dimension, DirectivesModule, DisposableComponent, EditRowControls, EditSession, EditorControlColumnModel, EmptyStateComponent, EventCleanUpSession, FlexComponent, FocusBinding, FocusBindingDirective, FocusBindingFactory, FocusContainerComponent, FocusableComponent, Formatter, HEADER_CELL_RENDERER_PORTAL, IconComponent, InPlaceInteractionContextComponent, InteractionContextTriggerFor, InteractionModule, InteractionService, InteractionServiceRoutingAdapter, LEFT_RIGHT_PLACE_ANIMATION, ListPlaceNavComponent, ListPropertyColumnModel, ModalInteractionContextFactory, MoreMenuComponent, MultipleSelectInputComponent, Navigating, NavigatingDuringInteraction, NavigationContext, NavigationSession, NoopAuthGuard, NoopComponent, NumberInputComponent, PLACE_AUTH_SERVICE, POPUP_CONTAINER, PORTAL_EDITOR_COMPONENT, PORTAL_RENDERER_COMPONENT, ParameterDefinition, PasswordInputComponent, Place, PlaceComponent, PlaceComponentDeactivationHandler, PlaceDefinition, PlaceGuard, PlaceHistory, PlaceModule, PlaceOutletComponent, PlaceRouter, Point, PopStateDuringInteractionNavigation, PopStateNavigation, PopupAwareComponent, PopupInteractionContextComponent, PopupMenuComponent, PopupMenuRendererComponent, PropertyColumnModel, ROUTE_PARAMETER_LIST_KEY, RemoveLastInteractionFromUrlNavigationSession, ResizeAwareComponent, RouteId, ScrollContainerComponent, SectionHeaderComponent, SelectCellRendererComponent, SelectHeaderCellRendererComponent, SelectInputActivity, SelectInputComponent, SelectionColumnModel, SeparatorComponent, SidePlaceNavigationComponent, StringInputActivity, StringInputComponent, SwitchCaseComponent, SwitchCaseDefaultDirective, SwitchCaseOption, SwitchCaseWhenDirective, SynchroniseInteractionContextIdsWithRoute, TabbedPlaceNavigationComponent, TableCellRendererComponent, TableComponent, TableHeaderCellRendererComponent, TableModel, TableRowMenuComponent, TemplateCellRendererPortalRef, TextInputComponent, ToolBarComponent, TrackBy, UrlService, UrlSnapshot, VerticalFocusContainerComponent, Visit, VisitParameter, VisitParameterList, VisitSanitiser, WaitUntilLeavingInteractionTransitionCancelled, WaitUntilLinkTriggeredNavigationInteractionCancellationTypeDetermined, WaitUntilPopStateDuringCanDeactivateInteractionFinishes, leftRightPlaceAnimation, slideDownOnEnterAnimation, slideRightOnEnterAnimation, ɵ0 };
6994
+ export { ACTIVITY_DATA, AUP_PLACE_CONFIG, AbstractInputActivity, AbstractInputComponent, AbstractInteractionContext, AbstractListInputComponent, AbstractPlaceNavigationComponent, AbstractPopStateNavigation, AbstractPopupMenuComponent, AbstractValueInputComponent, Activity, ActivityActionsComponent, ActivityContainerComponent, ActivityOutletComponent, ActivityRef, AddItemInteractionContextComponent, AlertDialogComponent, AngularUiPowerupsModule, AutocompleteInputComponent, Bounds, BusyOverlayComponent, CELL_EDITOR_PORTAL, CELL_RENDERER_PORTAL, CardContainerComponent, CellEditorPortalRef, CellHeaderPortalRef, CellPortalRef, CellRendererPortalRef, CheckboxInputComponent, ColumnModel, ColumnTemplateDirective, CommandComponent, CommandContainer, CommandDirective, CommandFace, CommandFaceComponent, ComponentCellRendererPortalRef, ComponentsModule, ConfirmThenDialogComponent, ConfirmationDialogComponent, ConsolidatedParameterMap, CustomTemplateColumnModel, CustomValueColumnModel, DEFINITION_META_DATA_KEY, DIALOG_INTERACTION_SERVICE_DEFAULTS, DefaultCellRendererComponent, DefaultHeaderCellRendererComponent, DialogInteractionContext, DialogInteractionContextFactory, Dimension, DirectivesModule, DisposableComponent, EditRowControls, EditSession, EditorControlColumnModel, EmptyStateComponent, EventCleanUpSession, FlexComponent, FocusBinding, FocusBindingDirective, FocusBindingFactory, FocusContainerComponent, FocusableComponent, Formatter, HEADER_CELL_RENDERER_PORTAL, IconComponent, InPlaceInteractionContextComponent, InteractionContextTriggerFor, InteractionModule, InteractionService, InteractionServiceRoutingAdapter, LEFT_RIGHT_PLACE_ANIMATION, ListPlaceNavComponent, ListPropertyColumnModel, ModalInteractionContextFactory, MoreMenuComponent, MultipleSelectInputComponent, Navigating, NavigatingDuringInteraction, NavigationContext, NavigationSession, NoopAuthGuard, NoopComponent, NumberInputComponent, POPUP_CONTAINER, PORTAL_EDITOR_COMPONENT, PORTAL_RENDERER_COMPONENT, ParameterDefinition, PasswordInputComponent, Place, PlaceAccessGuard, PlaceComponent, PlaceComponentDeactivationHandler, PlaceDefinition, PlaceGuard, PlaceHistory, PlaceModule, PlaceOutletComponent, PlaceRouter, Point, PopStateDuringInteractionNavigation, PopStateNavigation, PopupAwareComponent, PopupInteractionContextComponent, PopupMenuComponent, PopupMenuRendererComponent, PropertyColumnModel, ROUTE_PARAMETER_LIST_KEY, RemoveLastInteractionFromUrlNavigationSession, ResizeAwareComponent, RouteId, ScrollContainerComponent, SectionHeaderComponent, SelectCellRendererComponent, SelectHeaderCellRendererComponent, SelectInputActivity, SelectInputComponent, SelectionColumnModel, SeparatorComponent, SidePlaceNavigationComponent, StringInputActivity, StringInputComponent, SwitchCaseComponent, SwitchCaseDefaultDirective, SwitchCaseOption, SwitchCaseWhenDirective, SynchroniseInteractionContextIdsWithRoute, TabbedPlaceNavigationComponent, TableCellRendererComponent, TableComponent, TableHeaderCellRendererComponent, TableModel, TableRowMenuComponent, TemplateCellRendererPortalRef, TextInputComponent, ToolBarComponent, TrackBy, UrlService, UrlSnapshot, VerticalFocusContainerComponent, Visit, VisitParameter, VisitParameterList, VisitSanitiser, WaitUntilLeavingInteractionTransitionCancelled, WaitUntilLinkTriggeredNavigationInteractionCancellationTypeDetermined, WaitUntilPopStateDuringCanDeactivateInteractionFinishes, leftRightPlaceAnimation, slideDownOnEnterAnimation, slideRightOnEnterAnimation, ɵ0 };
6938
6995
  //# sourceMappingURL=coolon-angular-ui-powerups.js.map