@coolon/angular-ui-powerups 3.5.3 → 3.7.0-alpha.0

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/CHANGELOG.md +14 -0
  2. package/bundles/coolon-angular-ui-powerups-cypress.umd.js +41 -1
  3. package/bundles/coolon-angular-ui-powerups-cypress.umd.js.map +1 -1
  4. package/bundles/coolon-angular-ui-powerups-cypress.umd.min.js +1 -1
  5. package/bundles/coolon-angular-ui-powerups-cypress.umd.min.js.map +1 -1
  6. package/bundles/coolon-angular-ui-powerups.umd.js +248 -191
  7. package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
  8. package/bundles/coolon-angular-ui-powerups.umd.min.js +1 -1
  9. package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -1
  10. package/coolon-angular-ui-powerups.metadata.json +1 -1
  11. package/cypress/components/aup-navigation.d.ts +9 -0
  12. package/cypress/coolon-angular-ui-powerups-cypress.metadata.json +1 -1
  13. package/cypress/exports.d.ts +1 -0
  14. package/cypress/package.json +2 -1
  15. package/cypress/page.d.ts +3 -0
  16. package/cypress/section.d.ts +5 -0
  17. package/esm2015/cypress/components/aup-navigation.js +21 -0
  18. package/esm2015/cypress/components/aup-navigation.js.map +1 -0
  19. package/esm2015/cypress/components/aup-navigation.metadata.json +1 -0
  20. package/esm2015/cypress/exports.js +1 -0
  21. package/esm2015/cypress/exports.js.map +1 -1
  22. package/esm2015/cypress/exports.metadata.json +1 -1
  23. package/esm2015/cypress/page.js +10 -1
  24. package/esm2015/cypress/page.js.map +1 -1
  25. package/esm2015/cypress/page.metadata.json +1 -1
  26. package/esm2015/cypress/section.js +7 -0
  27. package/esm2015/cypress/section.js.map +1 -1
  28. package/esm2015/lib/components/components.module.ngfactory.js.map +1 -1
  29. package/esm2015/lib/components/forms/number-input/number-input.component.js +2 -3
  30. package/esm2015/lib/components/forms/number-input/number-input.component.js.map +1 -1
  31. package/esm2015/lib/components/forms/number-input/number-input.component.metadata.json +1 -1
  32. package/esm2015/lib/components/forms/password-input/password-input.component.js +5 -4
  33. package/esm2015/lib/components/forms/password-input/password-input.component.js.map +1 -1
  34. package/esm2015/lib/components/forms/password-input/password-input.component.metadata.json +1 -1
  35. package/esm2015/lib/components/forms/select-input/select-input.component.js.map +1 -1
  36. package/esm2015/lib/components/forms/select-input/select-input.component.metadata.json +1 -1
  37. package/esm2015/lib/components/forms/string-input/string-input.component.js +2 -1
  38. package/esm2015/lib/components/forms/string-input/string-input.component.js.map +1 -1
  39. package/esm2015/lib/components/forms/string-input/string-input.component.metadata.json +1 -1
  40. package/esm2015/lib/interaction/components/inplace-interaction-context/in-place-interaction-context.component.js +12 -0
  41. package/esm2015/lib/interaction/components/inplace-interaction-context/in-place-interaction-context.component.js.map +1 -1
  42. package/esm2015/lib/interaction/components/inplace-interaction-context/in-place-interaction-context.component.metadata.json +1 -1
  43. package/esm2015/lib/place/components/abstract-place-navigation.component.js +7 -5
  44. package/esm2015/lib/place/components/abstract-place-navigation.component.js.map +1 -1
  45. package/esm2015/lib/place/components/abstract-place-navigation.component.metadata.json +1 -1
  46. package/esm2015/lib/place/components/list-place-nav/list-place-nav.component.js +6 -6
  47. package/esm2015/lib/place/components/list-place-nav/list-place-nav.component.js.map +1 -1
  48. package/esm2015/lib/place/components/list-place-nav/list-place-nav.component.metadata.json +1 -1
  49. package/esm2015/lib/place/components/side-place-navigation/side-place-navigation.component.js +5 -5
  50. package/esm2015/lib/place/components/side-place-navigation/side-place-navigation.component.js.map +1 -1
  51. package/esm2015/lib/place/components/side-place-navigation/side-place-navigation.component.metadata.json +1 -1
  52. package/esm2015/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.js +5 -5
  53. package/esm2015/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.js.map +1 -1
  54. package/esm2015/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.metadata.json +1 -1
  55. package/esm2015/lib/place/exports.js +1 -0
  56. package/esm2015/lib/place/exports.js.map +1 -1
  57. package/esm2015/lib/place/exports.metadata.json +1 -1
  58. package/esm2015/lib/place/guards/place.guard.js +94 -43
  59. package/esm2015/lib/place/guards/place.guard.js.map +1 -1
  60. package/esm2015/lib/place/guards/place.guard.metadata.json +1 -1
  61. package/esm2015/lib/place/guards/place.guard.ngfactory.js.map +1 -0
  62. package/esm2015/lib/place/place-auth-service.js +3 -0
  63. package/esm2015/lib/place/place-auth-service.js.map +1 -0
  64. package/esm2015/lib/place/place-auth-service.metadata.json +1 -0
  65. package/esm2015/lib/place/place-component.js +12 -2
  66. package/esm2015/lib/place/place-component.js.map +1 -1
  67. package/esm2015/lib/place/place-component.metadata.json +1 -1
  68. package/esm2015/lib/place/place-definition.js +2 -1
  69. package/esm2015/lib/place/place-definition.js.map +1 -1
  70. package/esm2015/lib/place/place-definition.metadata.json +1 -1
  71. package/esm2015/lib/place/place-router.js +6 -0
  72. package/esm2015/lib/place/place-router.js.map +1 -1
  73. package/esm2015/lib/place/place-router.metadata.json +1 -1
  74. package/esm2015/lib/place/place.decorator.js +1 -1
  75. package/esm2015/lib/place/place.decorator.js.map +1 -1
  76. package/fesm2015/coolon-angular-ui-powerups-cypress.js +36 -2
  77. package/fesm2015/coolon-angular-ui-powerups-cypress.js.map +1 -1
  78. package/fesm2015/coolon-angular-ui-powerups.js +205 -135
  79. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  80. package/lib/components/forms/number-input/number-input.component.d.ts +1 -0
  81. package/lib/components/forms/password-input/password-input.component.d.ts +1 -0
  82. package/lib/components/forms/string-input/string-input.component.d.ts +1 -0
  83. package/lib/interaction/components/inplace-interaction-context/in-place-interaction-context.component.d.ts +12 -0
  84. package/lib/place/components/abstract-place-navigation.component.d.ts +2 -2
  85. package/lib/place/components/list-place-nav/list-place-nav.component.d.ts +2 -2
  86. package/lib/place/components/side-place-navigation/side-place-navigation.component.d.ts +2 -2
  87. package/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.d.ts +2 -2
  88. package/lib/place/exports.d.ts +1 -0
  89. package/lib/place/guards/place.guard.d.ts +5 -7
  90. package/lib/place/place-auth-service.d.ts +36 -0
  91. package/lib/place/place-component.d.ts +2 -1
  92. package/lib/place/place-definition.d.ts +2 -1
  93. package/lib/place/place-router.d.ts +1 -0
  94. package/lib/place/place.decorator.d.ts +1 -0
  95. package/package.json +1 -1
  96. package/schematics/bootstrap-app/index.js +4 -0
  97. package/schematics/bootstrap-app/index.js.map +1 -1
  98. package/schematics/bootstrap-app/templates/app/app.module.ts.template +4 -2
  99. package/schematics/bootstrap-app/templates/app/auth/place-auth.service.ts.template +41 -0
  100. package/schematics/collection.json +5 -0
  101. package/schematics/ng-add/index.js +1 -1
  102. package/schematics/ng-add/index.js.map +1 -1
  103. package/schematics/place-add/index.js +2 -1
  104. package/schematics/place-add/index.js.map +1 -1
  105. package/schematics/place-add/templates/component/__name@dasherize__.component.scss.template +1 -0
  106. package/schematics/place-bootstrap/index.d.ts +3 -0
  107. package/schematics/place-bootstrap/index.js +21 -0
  108. package/schematics/place-bootstrap/index.js.map +1 -0
  109. package/schematics/place-bootstrap/schema.d.ts +4 -0
  110. package/schematics/place-bootstrap/schema.js +3 -0
  111. package/schematics/place-bootstrap/schema.js.map +1 -0
  112. package/schematics/place-bootstrap/schema.json +28 -0
  113. package/schematics/place-routes/place-builder.d.ts +0 -1
  114. package/schematics/place-routes/place-builder.js +34 -24
  115. package/schematics/place-routes/place-builder.js.map +1 -1
  116. package/schematics/place-routes/place-class-scanner.js +2 -1
  117. package/schematics/place-routes/place-class-scanner.js.map +1 -1
  118. package/schematics/place-routes/place-def.d.ts +1 -0
  119. package/schematics/place-routes/place-def.js +2 -2
  120. package/schematics/place-routes/place-def.js.map +1 -1
  121. package/schematics/place-routes/schema.d.ts +1 -4
  122. package/schematics/place-routes/schema.json +9 -1
  123. package/schematics/place-routes/templates/place-destinations.ts.template +1 -9
  124. package/schematics/place-routes/templates/place-routes.ts.template +3 -39
  125. package/schematics/place-routes/templates/place-visits.ts.template +1 -10
  126. package/schematics/bootstrap-app/templates/app/auth/auth.guard.ts.template +0 -23
  127. package/schematics/bootstrap-app/templates/app/auth/auth.module.ts.template +0 -13
  128. package/schematics/bootstrap-app/templates/app/auth/auth.service.ts.template +0 -13
  129. package/schematics/bootstrap-app/templates/app/places/places.json5.template +0 -3
  130. /package/schematics/{bootstrap-app/templates/app/places → place-bootstrap/templates/__name@dasherize__}/place-routes.ts.template +0 -0
  131. /package/schematics/{bootstrap-app/templates/app/places → place-bootstrap/templates/__name@dasherize__}/places.module.ts.template +0 -0
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@angular/forms'), require('@angular/material/form-field'), require('@angular/material/input'), require('@angular/material/select'), require('@angular/material/tabs'), require('@angular/platform-browser/animations'), require('@angular/cdk/portal'), require('@angular/cdk/scrolling'), require('@angular/material/autocomplete'), require('@angular/material/button'), require('@angular/material/checkbox'), require('@angular/material/divider'), require('@angular/material/icon'), require('@angular/material/menu'), require('@angular/material/table'), require('@angular/material/tooltip'), require('@fortawesome/angular-fontawesome'), require('@fortawesome/free-solid-svg-icons'), require('@coolon/pectin'), require('@typescript-plus/fast-memoize-decorator/dist/src'), require('lodash'), require('typescript-string-enums'), require('@coolon/typescript-utilities'), require('immer'), require('@angular/flex-layout'), require('@angular/material/dialog'), require('@angular/router'), require('@angular/cdk/overlay'), require('resize-observer-polyfill'), require('@angular/material/list'), require('@angular/material/progress-spinner'), require('@typescript-plus/fast-memoize-decorator'), require('reflect-metadata'), require('@angular/animations'), require('rxjs')) :
3
- typeof define === 'function' && define.amd ? define('@coolon/angular-ui-powerups', ['exports', '@angular/common', '@angular/core', '@angular/forms', '@angular/material/form-field', '@angular/material/input', '@angular/material/select', '@angular/material/tabs', '@angular/platform-browser/animations', '@angular/cdk/portal', '@angular/cdk/scrolling', '@angular/material/autocomplete', '@angular/material/button', '@angular/material/checkbox', '@angular/material/divider', '@angular/material/icon', '@angular/material/menu', '@angular/material/table', '@angular/material/tooltip', '@fortawesome/angular-fontawesome', '@fortawesome/free-solid-svg-icons', '@coolon/pectin', '@typescript-plus/fast-memoize-decorator/dist/src', 'lodash', 'typescript-string-enums', '@coolon/typescript-utilities', 'immer', '@angular/flex-layout', '@angular/material/dialog', '@angular/router', '@angular/cdk/overlay', 'resize-observer-polyfill', '@angular/material/list', '@angular/material/progress-spinner', '@typescript-plus/fast-memoize-decorator', 'reflect-metadata', '@angular/animations', 'rxjs'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.coolon = global.coolon || {}, global.coolon['angular-ui-powerups'] = {}), global.ng.common, global.ng.core, global.ng.forms, global.ng.material.formField, global.ng.material.input, global.ng.material.select, global.ng.material.tabs, global.ng.platformBrowser.animations, global.ng.cdk.portal, global.ng.cdk.scrolling, global.ng.material.autocomplete, global.ng.material.button, global.ng.material.checkbox, global.ng.material.divider, global.ng.material.icon, global.ng.material.menu, global.ng.material.table, global.ng.material.tooltip, global.angularFontawesome, global.freeSolidSvgIcons, global.pectin, global.src, global._, global.typescriptStringEnums, global.typescriptUtilities, global.produce, global.ng.flexLayout, global.ng.material.dialog, global.ng.router, global.ng.cdk.overlay, global.ResizeObserver, global.ng.material.list, global.ng.material.progressSpinner, global.fastMemoizeDecorator, null, global.ng.animations, global.rxjs));
5
- }(this, (function (exports, i2, i0, forms, formField, input, select, tabs, animations, portal, scrolling, autocomplete, button, checkbox, divider, icon, menu, table, tooltip, angularFontawesome, freeSolidSvgIcons, pectin, src, _, typescriptStringEnums, typescriptUtilities, produce, flexLayout, i1, i1$1, overlay, ResizeObserver, list, progressSpinner, fastMemoizeDecorator, reflectMetadata, animations$1, rxjs) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@angular/forms'), require('@angular/material/form-field'), require('@angular/material/input'), require('@angular/material/select'), require('@angular/material/tabs'), require('@angular/platform-browser/animations'), require('@angular/cdk/portal'), require('@angular/cdk/scrolling'), require('@angular/material/autocomplete'), require('@angular/material/button'), require('@angular/material/checkbox'), require('@angular/material/divider'), require('@angular/material/icon'), require('@angular/material/menu'), require('@angular/material/table'), require('@angular/material/tooltip'), require('@fortawesome/angular-fontawesome'), require('@fortawesome/free-solid-svg-icons'), require('@coolon/pectin'), require('@typescript-plus/fast-memoize-decorator/dist/src'), require('lodash'), require('typescript-string-enums'), require('@coolon/typescript-utilities'), require('immer'), require('@angular/flex-layout'), require('@angular/material/dialog'), require('@angular/router'), require('@angular/cdk/overlay'), require('resize-observer-polyfill'), require('@angular/material/list'), require('@angular/material/progress-spinner'), require('@typescript-plus/fast-memoize-decorator'), require('reflect-metadata'), require('@angular/animations')) :
3
+ typeof define === 'function' && define.amd ? define('@coolon/angular-ui-powerups', ['exports', '@angular/common', '@angular/core', '@angular/forms', '@angular/material/form-field', '@angular/material/input', '@angular/material/select', '@angular/material/tabs', '@angular/platform-browser/animations', '@angular/cdk/portal', '@angular/cdk/scrolling', '@angular/material/autocomplete', '@angular/material/button', '@angular/material/checkbox', '@angular/material/divider', '@angular/material/icon', '@angular/material/menu', '@angular/material/table', '@angular/material/tooltip', '@fortawesome/angular-fontawesome', '@fortawesome/free-solid-svg-icons', '@coolon/pectin', '@typescript-plus/fast-memoize-decorator/dist/src', 'lodash', 'typescript-string-enums', '@coolon/typescript-utilities', 'immer', '@angular/flex-layout', '@angular/material/dialog', '@angular/router', '@angular/cdk/overlay', 'resize-observer-polyfill', '@angular/material/list', '@angular/material/progress-spinner', '@typescript-plus/fast-memoize-decorator', 'reflect-metadata', '@angular/animations'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.coolon = global.coolon || {}, global.coolon['angular-ui-powerups'] = {}), global.ng.common, global.ng.core, global.ng.forms, global.ng.material.formField, global.ng.material.input, global.ng.material.select, global.ng.material.tabs, global.ng.platformBrowser.animations, global.ng.cdk.portal, global.ng.cdk.scrolling, global.ng.material.autocomplete, global.ng.material.button, global.ng.material.checkbox, global.ng.material.divider, global.ng.material.icon, global.ng.material.menu, global.ng.material.table, global.ng.material.tooltip, global.angularFontawesome, global.freeSolidSvgIcons, global.pectin, global.src, global._, global.typescriptStringEnums, global.typescriptUtilities, global.produce, global.ng.flexLayout, global.ng.material.dialog, global.ng.router, global.ng.cdk.overlay, global.ResizeObserver, global.ng.material.list, global.ng.material.progressSpinner, global.fastMemoizeDecorator, null, global.ng.animations));
5
+ }(this, (function (exports, i2, i0, forms, formField, input, select, tabs, animations, portal, scrolling, autocomplete, button, checkbox, divider, icon, menu, table, tooltip, angularFontawesome, freeSolidSvgIcons, pectin, src, _, typescriptStringEnums, typescriptUtilities, produce, flexLayout, i1, i1$1, overlay, ResizeObserver, list, progressSpinner, fastMemoizeDecorator, reflectMetadata, animations$1) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -2134,8 +2134,6 @@
2134
2134
  __extends(NumberInputComponent, _super);
2135
2135
  function NumberInputComponent() {
2136
2136
  var _this = _super.call(this) || this;
2137
- // @Input() @TrackExternal({ delegateTo: 'inputModel' })
2138
- // valueModel: Form.ValueModelBase<number> | MutableValueModel<number>;
2139
2137
  _this.min = Number.MIN_SAFE_INTEGER;
2140
2138
  _this.max = Number.MAX_SAFE_INTEGER;
2141
2139
  return _this;
@@ -2147,20 +2145,19 @@
2147
2145
  NumberInputComponent.decorators = [
2148
2146
  { type: i0.Component, args: [{
2149
2147
  selector: 'aup-number-input',
2150
- template: "<mat-form-field appearance=\"standard\" [floatLabel]=\"floatLabel\">\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\n <input type=\"number\"\n matInput\n placeholder=\"{{placeholder}}\"\n [(ngModel)]=\"componentValueModel.value\"\n [disabled]=\"!enabled.value\"\n (keydown.enter)=\"notifyEnterKey()\"\n (keydown.escape)=\"notifyEscapeKey()\"\n [pectinFocusBinding]=\"focusContext\"\n [errorStateMatcher]=\"errorStateMatcher\"\n [min]=\"min\"\n [max]=\"max\"\n >\n <mat-hint *ngIf=\"hint && !dense\" >{{hint}}</mat-hint>\n <mat-error *ngIf=\"hasErrors\">{{firstError}}</mat-error>\n</mat-form-field>\n",
2148
+ template: "<mat-form-field appearance=\"standard\" [floatLabel]=\"floatLabel\">\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\n <input type=\"number\"\n matInput\n placeholder=\"{{placeholder}}\"\n [attr.autocomplete]=\"autocomplete\"\n [(ngModel)]=\"componentValueModel.value\"\n [disabled]=\"!enabled.value\"\n (keydown.enter)=\"notifyEnterKey()\"\n (keydown.escape)=\"notifyEscapeKey()\"\n [pectinFocusBinding]=\"focusContext\"\n [errorStateMatcher]=\"errorStateMatcher\"\n [min]=\"min\"\n [max]=\"max\"\n >\n <mat-hint *ngIf=\"hint && !dense\" >{{hint}}</mat-hint>\n <mat-error *ngIf=\"hasErrors\">{{firstError}}</mat-error>\n</mat-form-field>\n",
2151
2149
  styles: [""]
2152
2150
  },] }
2153
2151
  ];
2154
2152
  NumberInputComponent.ctorParameters = function () { return []; };
2155
2153
  NumberInputComponent.propDecorators = {
2154
+ autocomplete: [{ type: i0.Input }],
2156
2155
  min: [{ type: i0.Input }],
2157
2156
  max: [{ type: i0.Input }]
2158
2157
  };
2159
2158
 
2160
2159
  var PasswordInputComponent = /** @class */ (function (_super) {
2161
2160
  __extends(PasswordInputComponent, _super);
2162
- // @Input() @TrackExternal({ delegateTo: 'inputModel' })
2163
- // valueModel: Form.ValueModelBase<string> | MutableValueModel<string>;
2164
2161
  function PasswordInputComponent() {
2165
2162
  return _super.call(this) || this;
2166
2163
  }
@@ -2171,11 +2168,14 @@
2171
2168
  PasswordInputComponent.decorators = [
2172
2169
  { type: i0.Component, args: [{
2173
2170
  selector: 'aup-password-input',
2174
- template: "<mat-form-field appearance=\"standard\" [floatLabel]=\"floatLabel\">\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\n <input type=\"password\"\n matInput\n placeholder=\"{{placeholder}}\"\n [(ngModel)]=\"componentValueModel.value\"\n [disabled]=\"!enabled.value\"\n (keydown.enter)=\"notifyEnterKey()\"\n (keydown.escape)=\"notifyEscapeKey()\"\n [pectinFocusBinding]=\"focusContext\"\n [errorStateMatcher]=\"errorStateMatcher\"\n >\n <mat-hint *ngIf=\"showHint\">{{hint}}</mat-hint>\n <mat-error *ngIf=\"hasErrors\">{{firstError}}</mat-error>\n</mat-form-field>\n\n",
2171
+ template: "<mat-form-field appearance=\"standard\" [floatLabel]=\"floatLabel\">\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\n <input type=\"password\"\n matInput\n placeholder=\"{{placeholder}}\"\n [attr.autocomplete]=\"autocomplete\"\n [(ngModel)]=\"componentValueModel.value\"\n [disabled]=\"!enabled.value\"\n (keydown.enter)=\"notifyEnterKey()\"\n (keydown.escape)=\"notifyEscapeKey()\"\n [pectinFocusBinding]=\"focusContext\"\n [errorStateMatcher]=\"errorStateMatcher\"\n >\n <mat-hint *ngIf=\"showHint\">{{hint}}</mat-hint>\n <mat-error *ngIf=\"hasErrors\">{{firstError}}</mat-error>\n</mat-form-field>\n\n",
2175
2172
  styles: [""]
2176
2173
  },] }
2177
2174
  ];
2178
2175
  PasswordInputComponent.ctorParameters = function () { return []; };
2176
+ PasswordInputComponent.propDecorators = {
2177
+ autocomplete: [{ type: i0.Input }]
2178
+ };
2179
2179
 
2180
2180
  /**
2181
2181
  * Using templates:
@@ -2239,12 +2239,13 @@
2239
2239
  StringInputComponent.decorators = [
2240
2240
  { type: i0.Component, args: [{
2241
2241
  selector: 'aup-string-input',
2242
- template: "<mat-form-field appearance=\"standard\" [floatLabel]=\"floatLabel\">\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\n <input matInput\n placeholder=\"{{placeholder}}\"\n [(ngModel)]=\"componentValueModel.value\"\n [disabled]=\"!enabled.value\"\n (keydown.enter)=\"notifyEnterKey()\"\n (keydown.escape)=\"notifyEscapeKey()\"\n [pectinFocusBinding]=\"focusContext\"\n [errorStateMatcher]=\"errorStateMatcher\"\n >\n <mat-hint *ngIf=\"showHint\">{{hint}}</mat-hint>\n <mat-error *ngIf=\"hasErrors\">{{firstError}}</mat-error>\n <button mat-button mat-icon-button matSuffix *ngIf=\"enableClear\" [pectinCommand]=\"clearCommand\">\n <aup-icon icon=\"mat:close\"></aup-icon>\n </button>\n</mat-form-field>\n\n",
2242
+ template: "<mat-form-field appearance=\"standard\" [floatLabel]=\"floatLabel\">\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\n <input matInput\n placeholder=\"{{placeholder}}\"\n [attr.autocomplete]=\"autocomplete\"\n [(ngModel)]=\"componentValueModel.value\"\n [disabled]=\"!enabled.value\"\n (keydown.enter)=\"notifyEnterKey()\"\n (keydown.escape)=\"notifyEscapeKey()\"\n [pectinFocusBinding]=\"focusContext\"\n [errorStateMatcher]=\"errorStateMatcher\"\n >\n <mat-hint *ngIf=\"showHint\">{{hint}}</mat-hint>\n <mat-error *ngIf=\"hasErrors\">{{firstError}}</mat-error>\n <button mat-button mat-icon-button matSuffix *ngIf=\"enableClear\" [pectinCommand]=\"clearCommand\">\n <aup-icon icon=\"mat:close\"></aup-icon>\n </button>\n</mat-form-field>\n\n",
2243
2243
  styles: ["button[disabled]{visibility:hidden}"]
2244
2244
  },] }
2245
2245
  ];
2246
2246
  StringInputComponent.ctorParameters = function () { return []; };
2247
2247
  StringInputComponent.propDecorators = {
2248
+ autocomplete: [{ type: i0.Input }],
2248
2249
  enableClearModel: [{ type: i0.Input }],
2249
2250
  enableClear: [{ type: i0.Input }]
2250
2251
  };
@@ -4603,6 +4604,18 @@
4603
4604
  InteractionService.ApiAdapter = ApiAdapter;
4604
4605
  })(exports.InteractionService || (exports.InteractionService = {}));
4605
4606
 
4607
+ /**
4608
+ * @example
4609
+ * <aup-in-place-interaction-context #inPlaceInteractionContext>
4610
+ *
4611
+ * </aup-in-place-interaction-context>
4612
+ *
4613
+ * in your component
4614
+ * @ViewChild('inPlaceInteractionContext', { static: true })
4615
+ * interactionContext: InteractionContext;
4616
+ *
4617
+ *
4618
+ */
4606
4619
  var InPlaceInteractionContextComponent = /** @class */ (function (_super) {
4607
4620
  __extends(InPlaceInteractionContextComponent, _super);
4608
4621
  function InPlaceInteractionContextComponent(interactionService, tabConfig) {
@@ -5161,6 +5174,8 @@
5161
5174
  },] }
5162
5175
  ];
5163
5176
 
5177
+ var PLACE_AUTH_SERVICE = new i0.InjectionToken("PlaceAuthService");
5178
+
5164
5179
  exports.ParameterDefinition = /** @class */ (function () {
5165
5180
  function ParameterDefinition(propertyName, options, urlFormat) {
5166
5181
  this.propertyName = propertyName;
@@ -5267,10 +5282,11 @@
5267
5282
  })(exports.ParameterDefinition || (exports.ParameterDefinition = {}));
5268
5283
 
5269
5284
  var PlaceDefinition = /** @class */ (function () {
5270
- function PlaceDefinition(component, path, authenticate, data, routeParameters, children) {
5285
+ function PlaceDefinition(component, path, authenticate, roles, data, routeParameters, children) {
5271
5286
  this.component = component;
5272
5287
  this.path = path;
5273
5288
  this.authenticate = authenticate;
5289
+ this.roles = roles;
5274
5290
  this.data = data;
5275
5291
  this.routeParameters = routeParameters;
5276
5292
  this.children = children;
@@ -5512,8 +5528,17 @@
5512
5528
  return typescriptUtilities.Klass.get(klass).getMetadataList(ROUTE_PARAMETER_LIST_KEY);
5513
5529
  }
5514
5530
  PlaceComponent.getRouteParameters = getRouteParameters;
5515
- function getDefinition(klass) {
5516
- return Reflect.getMetadata(DEFINITION_META_DATA_KEY, klass);
5531
+ function getDefinition(snapshotOrConstructor) {
5532
+ if (snapshotOrConstructor instanceof i1$1.ActivatedRouteSnapshot) {
5533
+ var component = snapshotOrConstructor.component;
5534
+ if (!isPlaceComponentConstructor(component)) {
5535
+ throw new Error("ActivatedRouteSnapshot component is not a PlaceComponent, got " + component);
5536
+ }
5537
+ return Reflect.getMetadata(DEFINITION_META_DATA_KEY, component);
5538
+ }
5539
+ else {
5540
+ return Reflect.getMetadata(DEFINITION_META_DATA_KEY, snapshotOrConstructor);
5541
+ }
5517
5542
  }
5518
5543
  PlaceComponent.getDefinition = getDefinition;
5519
5544
  function injectDefinition(klass, definition) {
@@ -5522,6 +5547,77 @@
5522
5547
  PlaceComponent.injectDefinition = injectDefinition;
5523
5548
  })(exports.PlaceComponent || (exports.PlaceComponent = {}));
5524
5549
 
5550
+ var Visit = /** @class */ (function () {
5551
+ function Visit(placeDefinition, visitParameters) {
5552
+ if (visitParameters === void 0) { visitParameters = {}; }
5553
+ this.placeDefinition = placeDefinition;
5554
+ this.visitParameters = visitParameters;
5555
+ }
5556
+ // @Trace()
5557
+ Visit.prototype.getRouteId = function () {
5558
+ return this.placeDefinition.getRouteIdFrom(this);
5559
+ };
5560
+ // @Trace()
5561
+ Visit.prototype.hasRouteId = function () {
5562
+ return !_.isNil(this.getRouteId());
5563
+ };
5564
+ /**
5565
+ * Returns the value of the place parameter with the specified name. The parameter
5566
+ * name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the
5567
+ * same as the the ValueModel property name.
5568
+ * @param parameterName the field name of the property model or the `as` option if specified.
5569
+ */
5570
+ Visit.prototype.getParameter = function (parameterName) {
5571
+ return this.visitParameters[parameterName];
5572
+ };
5573
+ // @Trace()
5574
+ Visit.prototype.hasParameter = function (parameterName) {
5575
+ return Object.keys(this.visitParameters).includes(parameterName);
5576
+ };
5577
+ Visit.prototype.replace = function (parameter, value) {
5578
+ var _a;
5579
+ return new Visit(this.placeDefinition, Object.assign(Object.assign({}, this.visitParameters), (_a = {}, _a[parameter.name] = value, _a)));
5580
+ };
5581
+ Visit.prototype.mergeRouteParameters = function (routeParams) {
5582
+ var _this = this;
5583
+ // todo: whitelist parameters.
5584
+ var routeParameterKeys = Object.keys(routeParams);
5585
+ var params = {};
5586
+ this.placeDefinition.getVisitParameterDefs().forEach(function (def) {
5587
+ if (def.isRouteId || def.isRouteParameter) {
5588
+ if (routeParameterKeys.includes(def.name)) {
5589
+ params[def.name] = routeParams[def.name];
5590
+ }
5591
+ }
5592
+ else {
5593
+ // copy non route params as is, but only if they already exist otherwise we'll inject nil values and break the
5594
+ // defaults and remember sanitisation process.
5595
+ var value = _this.getParameter(def.name);
5596
+ if (_this.hasParameter(def.name)) {
5597
+ params[def.name] = value;
5598
+ }
5599
+ }
5600
+ });
5601
+ return new Visit(this.placeDefinition, params);
5602
+ };
5603
+ Visit.prototype.hasRoutingChangedFrom = function (other) {
5604
+ var samePlace = other.placeDefinition === this.placeDefinition;
5605
+ var sameRouteParameters = _.isEqual(this.placeDefinition.getFormattedRouteParameters(this, true), this.placeDefinition.getFormattedRouteParameters(other, true));
5606
+ return !samePlace || !sameRouteParameters;
5607
+ };
5608
+ Visit.prototype.hasChangedFrom = function (other) {
5609
+ var sameNonRouteParameters = _.isEqual(this.placeDefinition.getNonRouteParameters(this), this.placeDefinition.getNonRouteParameters(other));
5610
+ return !sameNonRouteParameters || this.hasRoutingChangedFrom(other);
5611
+ };
5612
+ Visit.prototype.toDebugString = function () {
5613
+ var _this = this;
5614
+ return Object.keys(this.visitParameters).map(function (k) { return k + "=" + _this.visitParameters[k]; }).join(",");
5615
+ };
5616
+ return Visit;
5617
+ }());
5618
+
5619
+ var AUP_PLACE_CONFIG = new i0.InjectionToken('AUP_PLACE_CONFIG');
5620
+
5525
5621
  /**
5526
5622
  * This class handles the logic around canDeactivate for a given router state transition. It's core responsibilities are:
5527
5623
  * 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.)
@@ -6696,6 +6792,9 @@
6696
6792
  _this.navigationSessionModel = new pectin.MutableValueModel();
6697
6793
  _this._activeVisits = new pectin.MutableListModel();
6698
6794
  _this.sessionFinishedJobs = [];
6795
+ if (window['Cypress']) {
6796
+ window['aup.PlaceRouter'] = _this;
6797
+ }
6699
6798
  _this.routerInteractionAdapter = interactionService.registerPlaceRouter(_this);
6700
6799
  // TODO: Make this an interface and use 'this' instead.
6701
6800
  _this.navigationContext = new exports.NavigationContext.Impl(_this.urlService, _this.routerInteractionAdapter, function (urlSnapshot, options) {
@@ -6766,6 +6865,9 @@
6766
6865
  enumerable: false,
6767
6866
  configurable: true
6768
6867
  });
6868
+ PlaceRouter.prototype.isNavigating = function () {
6869
+ return this.navigationInProgress.value;
6870
+ };
6769
6871
  // @Trace()
6770
6872
  PlaceRouter.prototype.onPopState = function (event) {
6771
6873
  pectin.assert.isTruthy(event.navigationTrigger === 'popstate');
@@ -6988,77 +7090,6 @@
6988
7090
  { type: exports.PlaceHistory }
6989
7091
  ]; };
6990
7092
 
6991
- var Visit = /** @class */ (function () {
6992
- function Visit(placeDefinition, visitParameters) {
6993
- if (visitParameters === void 0) { visitParameters = {}; }
6994
- this.placeDefinition = placeDefinition;
6995
- this.visitParameters = visitParameters;
6996
- }
6997
- // @Trace()
6998
- Visit.prototype.getRouteId = function () {
6999
- return this.placeDefinition.getRouteIdFrom(this);
7000
- };
7001
- // @Trace()
7002
- Visit.prototype.hasRouteId = function () {
7003
- return !_.isNil(this.getRouteId());
7004
- };
7005
- /**
7006
- * Returns the value of the place parameter with the specified name. The parameter
7007
- * name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the
7008
- * same as the the ValueModel property name.
7009
- * @param parameterName the field name of the property model or the `as` option if specified.
7010
- */
7011
- Visit.prototype.getParameter = function (parameterName) {
7012
- return this.visitParameters[parameterName];
7013
- };
7014
- // @Trace()
7015
- Visit.prototype.hasParameter = function (parameterName) {
7016
- return Object.keys(this.visitParameters).includes(parameterName);
7017
- };
7018
- Visit.prototype.replace = function (parameter, value) {
7019
- var _a;
7020
- return new Visit(this.placeDefinition, Object.assign(Object.assign({}, this.visitParameters), (_a = {}, _a[parameter.name] = value, _a)));
7021
- };
7022
- Visit.prototype.mergeRouteParameters = function (routeParams) {
7023
- var _this = this;
7024
- // todo: whitelist parameters.
7025
- var routeParameterKeys = Object.keys(routeParams);
7026
- var params = {};
7027
- this.placeDefinition.getVisitParameterDefs().forEach(function (def) {
7028
- if (def.isRouteId || def.isRouteParameter) {
7029
- if (routeParameterKeys.includes(def.name)) {
7030
- params[def.name] = routeParams[def.name];
7031
- }
7032
- }
7033
- else {
7034
- // copy non route params as is, but only if they already exist otherwise we'll inject nil values and break the
7035
- // defaults and remember sanitisation process.
7036
- var value = _this.getParameter(def.name);
7037
- if (_this.hasParameter(def.name)) {
7038
- params[def.name] = value;
7039
- }
7040
- }
7041
- });
7042
- return new Visit(this.placeDefinition, params);
7043
- };
7044
- Visit.prototype.hasRoutingChangedFrom = function (other) {
7045
- var samePlace = other.placeDefinition === this.placeDefinition;
7046
- var sameRouteParameters = _.isEqual(this.placeDefinition.getFormattedRouteParameters(this, true), this.placeDefinition.getFormattedRouteParameters(other, true));
7047
- return !samePlace || !sameRouteParameters;
7048
- };
7049
- Visit.prototype.hasChangedFrom = function (other) {
7050
- var sameNonRouteParameters = _.isEqual(this.placeDefinition.getNonRouteParameters(this), this.placeDefinition.getNonRouteParameters(other));
7051
- return !sameNonRouteParameters || this.hasRoutingChangedFrom(other);
7052
- };
7053
- Visit.prototype.toDebugString = function () {
7054
- var _this = this;
7055
- return Object.keys(this.visitParameters).map(function (k) { return k + "=" + _this.visitParameters[k]; }).join(",");
7056
- };
7057
- return Visit;
7058
- }());
7059
-
7060
- var AUP_PLACE_CONFIG = new i0.InjectionToken('AUP_PLACE_CONFIG');
7061
-
7062
7093
  // Freezes the state of the components at the start of the animation.
7063
7094
  var animationStartStyle = animations$1.style({ position: 'absolute', top: '0', left: '0', bottom: '0', right: '0' });
7064
7095
  var left = [
@@ -7336,11 +7367,13 @@
7336
7367
 
7337
7368
  var AbstractPlaceNavigationComponent = /** @class */ (function (_super) {
7338
7369
  __extends(AbstractPlaceNavigationComponent, _super);
7339
- function AbstractPlaceNavigationComponent(placeRouter) {
7370
+ function AbstractPlaceNavigationComponent(authService) {
7340
7371
  var _this = _super.call(this) || this;
7341
7372
  _this._activePlaceComponent = new pectin.DelegatingValueModel();
7342
7373
  var _a = pectin.Dsl.disposeWith(_this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
7343
- _this.placeDefinitions = chain(_this.placesModel).map(function (c) { return exports.PlaceComponent.getDefinition(c); });
7374
+ _this.placeDefinitions = chain(_this.placesModel)
7375
+ .map(function (c) { return exports.PlaceComponent.getDefinition(c); })
7376
+ .select(function (d) { return authService.authoriserModel.value(d); }, { dependsOn: authService.authoriserModel });
7344
7377
  _this.commandFactory = pectin.Command.createFactory(function (placeDefinition) {
7345
7378
  _this.placeOutlet.navigate(new Visit(placeDefinition));
7346
7379
  });
@@ -7374,7 +7407,7 @@
7374
7407
  },] }
7375
7408
  ];
7376
7409
  AbstractPlaceNavigationComponent.ctorParameters = function () { return [
7377
- { type: PlaceRouter }
7410
+ { type: undefined, decorators: [{ type: i0.Inject, args: [PLACE_AUTH_SERVICE,] }] }
7378
7411
  ]; };
7379
7412
  AbstractPlaceNavigationComponent.propDecorators = {
7380
7413
  places: [{ type: i0.Input }],
@@ -7451,8 +7484,8 @@
7451
7484
 
7452
7485
  var ListPlaceNavComponent = /** @class */ (function (_super) {
7453
7486
  __extends(ListPlaceNavComponent, _super);
7454
- function ListPlaceNavComponent(placeRouter) {
7455
- return _super.call(this, placeRouter) || this;
7487
+ function ListPlaceNavComponent(authService) {
7488
+ return _super.call(this, authService) || this;
7456
7489
  }
7457
7490
  return ListPlaceNavComponent;
7458
7491
  }(AbstractPlaceNavigationComponent));
@@ -7460,11 +7493,11 @@
7460
7493
  { type: i0.Component, args: [{
7461
7494
  selector: 'aup-list-place-nav',
7462
7495
  template: "<mat-nav-list fxFlex>\n <a mat-list-item *ngFor=\"let placeDefinition of placeDefinitions.value\"\n [pectinCommand]=\"commandFactory.create(placeDefinition)\"\n [class.active]=\"isActive(placeDefinition)\"\n [matTooltip]=\"getNavigationFace(placeDefinition).tooltip()\">\n <aup-command-face [faces]=\"[getNavigationFace(placeDefinition)]\"></aup-command-face>\n </a>\n</mat-nav-list>\n",
7463
- styles: [":host{--selected-background:#f1f1f1;--selected-border-color:#838383;--selected-color:inherit;display:flex;flex-direction:column}mat-nav-list{padding-top:0}a.active{background:var(--selected-background);border-right:2px solid var(--selected-border-color);color:var(--selected-color)}"]
7496
+ styles: [":host{--selected-background:#f1f1f1;--selected-border-color:#838383;--selected-color:inherit;display:flex;flex-direction:column}mat-nav-list{padding-top:0}a{border-right:2px solid transparent}a.active{background:var(--selected-background);border-right:2px solid var(--selected-border-color);color:var(--selected-color)}"]
7464
7497
  },] }
7465
7498
  ];
7466
7499
  ListPlaceNavComponent.ctorParameters = function () { return [
7467
- { type: PlaceRouter }
7500
+ { type: undefined, decorators: [{ type: i0.Inject, args: [PLACE_AUTH_SERVICE,] }] }
7468
7501
  ]; };
7469
7502
 
7470
7503
  /**
@@ -7511,8 +7544,8 @@
7511
7544
  */
7512
7545
  var SidePlaceNavigationComponent = /** @class */ (function (_super) {
7513
7546
  __extends(SidePlaceNavigationComponent, _super);
7514
- function SidePlaceNavigationComponent(router, placeRouter) {
7515
- var _this = _super.call(this, placeRouter) || this;
7547
+ function SidePlaceNavigationComponent(router, authService) {
7548
+ var _this = _super.call(this, authService) || this;
7516
7549
  _this.router = router;
7517
7550
  _this.expanded = false;
7518
7551
  return _this;
@@ -7537,7 +7570,7 @@
7537
7570
  ];
7538
7571
  SidePlaceNavigationComponent.ctorParameters = function () { return [
7539
7572
  { type: i1$1.Router },
7540
- { type: PlaceRouter }
7573
+ { type: undefined, decorators: [{ type: i0.Inject, args: [PLACE_AUTH_SERVICE,] }] }
7541
7574
  ]; };
7542
7575
  SidePlaceNavigationComponent.propDecorators = {
7543
7576
  expanded: [{ type: i0.HostBinding, args: ['class.expanded',] }],
@@ -7546,8 +7579,8 @@
7546
7579
 
7547
7580
  var TabbedPlaceNavigationComponent = /** @class */ (function (_super) {
7548
7581
  __extends(TabbedPlaceNavigationComponent, _super);
7549
- function TabbedPlaceNavigationComponent(placeRouter) {
7550
- return _super.call(this, placeRouter) || this;
7582
+ function TabbedPlaceNavigationComponent(authService) {
7583
+ return _super.call(this, authService) || this;
7551
7584
  }
7552
7585
  return TabbedPlaceNavigationComponent;
7553
7586
  }(AbstractPlaceNavigationComponent));
@@ -7559,7 +7592,7 @@
7559
7592
  },] }
7560
7593
  ];
7561
7594
  TabbedPlaceNavigationComponent.ctorParameters = function () { return [
7562
- { type: PlaceRouter }
7595
+ { type: undefined, decorators: [{ type: i0.Inject, args: [PLACE_AUTH_SERVICE,] }] }
7563
7596
  ]; };
7564
7597
 
7565
7598
  var PlaceModule = /** @class */ (function () {
@@ -7765,7 +7798,7 @@
7765
7798
  function Place(options) {
7766
7799
  return function (target) {
7767
7800
  if (exports.PlaceComponent.isPlaceComponentConstructor(target)) {
7768
- exports.PlaceComponent.injectDefinition(target, new PlaceDefinition(target, options.path, _.isNil(options.authenticate) ? true : options.authenticate, options.data, exports.PlaceComponent.getRouteParameters(target), (options.children || []).map(function (c) { return exports.PlaceComponent.getDefinition(c); })));
7801
+ exports.PlaceComponent.injectDefinition(target, new PlaceDefinition(target, options.path, _.isNil(options.authenticate) ? true : options.authenticate, _.isNil(options.roles) ? [] : options.roles, options.data, exports.PlaceComponent.getRouteParameters(target), (options.children || []).map(function (c) { return exports.PlaceComponent.getDefinition(c); })));
7769
7802
  }
7770
7803
  else {
7771
7804
  pectin.lang.illegalState(target + " must extend PlaceComponent to use the @Place decorator");
@@ -7912,63 +7945,74 @@
7912
7945
  }());
7913
7946
 
7914
7947
  var PlaceGuard = /** @class */ (function () {
7915
- function PlaceGuard(router, urlService, placeRouter, placeHistory, interactionService, injector) {
7948
+ function PlaceGuard(router, urlService, placeRouter, placeHistory, placeAuthService, interactionService, injector) {
7916
7949
  this.router = router;
7917
7950
  this.urlService = urlService;
7918
7951
  this.placeRouter = placeRouter;
7919
7952
  this.placeHistory = placeHistory;
7953
+ this.placeAuthService = placeAuthService;
7920
7954
  this.interactionService = interactionService;
7921
7955
  this.injector = injector;
7922
7956
  }
7923
- // @Trace()
7924
7957
  PlaceGuard.prototype.canActivate = function (activatedRoute, state) {
7925
7958
  return __awaiter(this, void 0, void 0, function () {
7959
+ var placeDefinition_1, needsAuth, proceed, _a, result;
7926
7960
  var _this = this;
7927
- return __generator(this, function (_a) {
7928
- // TODO: this is ugly now that I'm return UrlSnapshots and not UrlTrees. It'd be better if the functions
7929
- // weren't nested or if I implemented a handler chain.
7930
- return [2 /*return*/, this.authorisePlaceThen(activatedRoute, state, function (placeDefinition) { return __awaiter(_this, void 0, void 0, function () {
7931
- var result;
7932
- var _this = this;
7933
- return __generator(this, function (_a) {
7934
- switch (_a.label) {
7935
- case 0: return [4 /*yield*/, this.cleanInteractionState(activatedRoute, state, function () { return __awaiter(_this, void 0, void 0, function () {
7936
- var params, parsedParams, navigationSession, initialVisit, sanitiser, sanitisedVisit, urlSnapshot;
7937
- return __generator(this, function (_a) {
7938
- switch (_a.label) {
7939
- case 0:
7940
- params = new ConsolidatedParameterMap(activatedRoute.paramMap, activatedRoute.url);
7941
- parsedParams = placeDefinition.parseRouteParams(params);
7942
- navigationSession = this.placeRouter.navigationSession;
7943
- initialVisit = navigationSession.getVisitFor(placeDefinition) || new Visit(placeDefinition, parsedParams);
7944
- sanitiser = new VisitSanitiser(navigationSession, activatedRoute, this.router, this.placeHistory, this.injector);
7945
- return [4 /*yield*/, sanitiser.sanitise(initialVisit.mergeRouteParameters(parsedParams))];
7946
- case 1:
7947
- sanitisedVisit = _a.sent();
7948
- // Save the visit with any updated parameters. We need to save it so we remember any non route parameters
7949
- navigationSession.storeVisit(sanitisedVisit);
7950
- if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {
7951
- urlSnapshot = this.urlService.parseUrl(state.url).updateVisitSegments(sanitisedVisit);
7952
- // console.log('##### Place Guard Redirect', urlSnapshot);
7953
- return [2 /*return*/, urlSnapshot];
7954
- }
7955
- else {
7956
- return [2 /*return*/, true];
7957
- }
7958
- return [2 /*return*/];
7961
+ return __generator(this, function (_b) {
7962
+ switch (_b.label) {
7963
+ case 0:
7964
+ if (!exports.PlaceComponent.isPlaceComponentConstructor(activatedRoute.component)) return [3 /*break*/, 4];
7965
+ placeDefinition_1 = exports.PlaceComponent.getDefinition(activatedRoute.component);
7966
+ needsAuth = placeDefinition_1.authenticate;
7967
+ _a = !needsAuth;
7968
+ if (_a) return [3 /*break*/, 2];
7969
+ return [4 /*yield*/, this.placeAuthService.isAuthenticated()];
7970
+ case 1:
7971
+ _a = (_b.sent());
7972
+ _b.label = 2;
7973
+ case 2:
7974
+ proceed = _a;
7975
+ if (!proceed) {
7976
+ return [2 /*return*/, this.handleGuardResult(this.placeAuthService.handleNotAuthenticated(activatedRoute, state))];
7977
+ }
7978
+ if (!this.placeAuthService.isAuthorised(placeDefinition_1)) {
7979
+ return [2 /*return*/, this.handleGuardResult(this.placeAuthService.handleNotAuthorisation(activatedRoute, state))];
7980
+ }
7981
+ return [4 /*yield*/, this.cleanInteractionState(activatedRoute, state, function () { return __awaiter(_this, void 0, void 0, function () {
7982
+ var params, parsedParams, navigationSession, initialVisit, sanitiser, sanitisedVisit, urlSnapshot;
7983
+ return __generator(this, function (_a) {
7984
+ switch (_a.label) {
7985
+ case 0:
7986
+ params = new ConsolidatedParameterMap(activatedRoute.paramMap, activatedRoute.url);
7987
+ parsedParams = placeDefinition_1.parseRouteParams(params);
7988
+ navigationSession = this.placeRouter.navigationSession;
7989
+ initialVisit = navigationSession.getVisitFor(placeDefinition_1) || new Visit(placeDefinition_1, parsedParams);
7990
+ sanitiser = new VisitSanitiser(navigationSession, activatedRoute, this.router, this.placeHistory, this.injector);
7991
+ return [4 /*yield*/, sanitiser.sanitise(initialVisit.mergeRouteParameters(parsedParams))];
7992
+ case 1:
7993
+ sanitisedVisit = _a.sent();
7994
+ // Save the visit with any updated parameters. We need to save it so we remember any non route parameters
7995
+ navigationSession.storeVisit(sanitisedVisit);
7996
+ if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {
7997
+ urlSnapshot = this.urlService.parseUrl(state.url).updateVisitSegments(sanitisedVisit);
7998
+ // console.log('##### Place Guard Redirect', urlSnapshot);
7999
+ return [2 /*return*/, urlSnapshot];
7959
8000
  }
7960
- });
7961
- }); })];
7962
- case 1:
7963
- result = _a.sent();
7964
- return [2 /*return*/, this.handleGuardResult(result)];
7965
- }
7966
- });
7967
- }); })];
8001
+ else {
8002
+ return [2 /*return*/, true];
8003
+ }
8004
+ return [2 /*return*/];
8005
+ }
8006
+ });
8007
+ }); })];
8008
+ case 3:
8009
+ result = _b.sent();
8010
+ return [2 /*return*/, result instanceof exports.UrlSnapshot ? result.urlTree : result];
8011
+ case 4: return [2 /*return*/, pectin.lang.illegalState("expected component to be an instance of PlaceComponent, got " + activatedRoute.component)];
8012
+ }
7968
8013
  });
7969
8014
  });
7970
8015
  };
7971
- // @Trace()
7972
8016
  PlaceGuard.prototype.canDeactivate = function (component, currentRoute, currentState, nextState) {
7973
8017
  return __awaiter(this, void 0, void 0, function () {
7974
8018
  var currentUrl, nextUrl, result;
@@ -7980,66 +8024,41 @@
7980
8024
  return [4 /*yield*/, this.placeRouter.navigationSession.canDeactivatePlace(component, currentUrl, nextUrl)];
7981
8025
  case 1:
7982
8026
  result = _a.sent();
7983
- return [2 /*return*/, this.handleGuardResult(result)];
8027
+ return [2 /*return*/, result instanceof exports.UrlSnapshot ? result.urlTree : result];
7984
8028
  }
7985
8029
  });
7986
8030
  });
7987
8031
  };
7988
- // @Trace()
7989
8032
  PlaceGuard.prototype.handleGuardResult = function (result) {
7990
8033
  if (result instanceof exports.UrlSnapshot) {
7991
8034
  return result.urlTree;
7992
8035
  }
7993
8036
  else {
7994
- return result;
8037
+ return this.urlService.createUrlSnapshot(result).urlTree;
7995
8038
  }
7996
8039
  };
8040
+ // protected async ensureAuthenticatedThen(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot, next: (placeDefinition: PlaceDefinition) => Promise<boolean | UrlTree>): Promise<boolean | UrlTree> {
8041
+ // const authoriseResult = placeDefinition.authenticate ? await this.isAuthorised(activatedRoute, state) : true;
8042
+ // if (authoriseResult === true) {
8043
+ // // we're authorised, now run the place guards.
8044
+ // return next(placeDefinition);
8045
+ // } else {
8046
+ // console.log('not authorised result', authoriseResult);
8047
+ // return authoriseResult;
8048
+ // }
8049
+ // }
8050
+ //
8051
+ // // @Trace()
8052
+ // protected async ensureAuthorisedThen(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot, next: (placeDefinition: PlaceDefinition) => Promise<boolean | UrlTree>): Promise<boolean | UrlTree> {
8053
+ //
8054
+ // }
7997
8055
  // @Trace()
7998
- PlaceGuard.prototype.authorisePlaceThen = function (activatedRoute, state, runPlaceGuards) {
7999
- return __awaiter(this, void 0, void 0, function () {
8000
- var placeDefinition, authoriseResult, _a;
8001
- return __generator(this, function (_b) {
8002
- switch (_b.label) {
8003
- case 0:
8004
- if (!exports.PlaceComponent.isPlaceComponentConstructor(activatedRoute.component)) return [3 /*break*/, 4];
8005
- placeDefinition = exports.PlaceComponent.getDefinition(activatedRoute.component);
8006
- if (!placeDefinition.authenticate) return [3 /*break*/, 2];
8007
- return [4 /*yield*/, this.isAuthorised(activatedRoute, state)];
8008
- case 1:
8009
- _a = _b.sent();
8010
- return [3 /*break*/, 3];
8011
- case 2:
8012
- _a = true;
8013
- _b.label = 3;
8014
- case 3:
8015
- authoriseResult = _a;
8016
- if (authoriseResult === true) {
8017
- // we're authorised, now run the place guards.
8018
- return [2 /*return*/, runPlaceGuards(placeDefinition)];
8019
- }
8020
- else {
8021
- console.log('not authorised result', authoriseResult);
8022
- return [2 /*return*/, authoriseResult];
8023
- }
8024
- return [3 /*break*/, 5];
8025
- case 4: return [2 /*return*/, pectin.lang.illegalState("expected component to be an instance of PlaceComponent, got " + activatedRoute.component)];
8026
- case 5: return [2 /*return*/];
8027
- }
8028
- });
8029
- });
8030
- };
8031
- // @Trace()
8032
- PlaceGuard.prototype.isAuthorised = function (activatedRoute, state) {
8033
- return __awaiter(this, void 0, void 0, function () {
8034
- var authorised;
8035
- return __generator(this, function (_a) {
8036
- authorised = this.getAuthGuard(this.injector).canActivate(activatedRoute, state);
8037
- return [2 /*return*/, (authorised instanceof rxjs.Observable) ? authorised.toPromise() : authorised];
8038
- });
8039
- });
8040
- };
8041
- // @Trace()
8042
- PlaceGuard.prototype.cleanInteractionState = function (route, state, then) {
8056
+ // async isAuthorised(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean | UrlTree> {
8057
+ // const authorised = this.getAuthGuard(this.injector).canActivate(activatedRoute, state);
8058
+ // return (authorised instanceof Observable) ? authorised.toPromise() : authorised;
8059
+ // }
8060
+ // abstract getAuthGuard(injector: Injector): CanActivate;
8061
+ PlaceGuard.prototype.cleanInteractionState = function (route, state, next) {
8043
8062
  return __awaiter(this, void 0, void 0, function () {
8044
8063
  var url;
8045
8064
  return __generator(this, function (_a) {
@@ -8050,7 +8069,7 @@
8050
8069
  return [2 /*return*/, url.removeInteractionIds()];
8051
8070
  }
8052
8071
  else {
8053
- return [2 /*return*/, then()];
8072
+ return [2 /*return*/, next()];
8054
8073
  }
8055
8074
  return [2 /*return*/];
8056
8075
  });
@@ -8058,6 +8077,43 @@
8058
8077
  };
8059
8078
  return PlaceGuard;
8060
8079
  }());
8080
+ PlaceGuard.ɵprov = i0.ɵɵdefineInjectable({ factory: function PlaceGuard_Factory() { return new PlaceGuard(i0.ɵɵinject(i1$1.Router), i0.ɵɵinject(UrlService), i0.ɵɵinject(PlaceRouter), i0.ɵɵinject(exports.PlaceHistory), i0.ɵɵinject(PLACE_AUTH_SERVICE), i0.ɵɵinject(exports.InteractionService), i0.ɵɵinject(i0.INJECTOR)); }, token: PlaceGuard, providedIn: "root" });
8081
+ PlaceGuard.decorators = [
8082
+ { type: i0.Injectable, args: [{ providedIn: 'root' },] }
8083
+ ];
8084
+ PlaceGuard.ctorParameters = function () { return [
8085
+ { type: i1$1.Router },
8086
+ { type: UrlService },
8087
+ { type: PlaceRouter },
8088
+ { type: exports.PlaceHistory },
8089
+ { type: undefined, decorators: [{ type: i0.Inject, args: [PLACE_AUTH_SERVICE,] }] },
8090
+ { type: exports.InteractionService },
8091
+ { type: i0.Injector }
8092
+ ]; };
8093
+ __decorate([
8094
+ pectin.Trace(),
8095
+ __metadata("design:type", Function),
8096
+ __metadata("design:paramtypes", [i1$1.ActivatedRouteSnapshot, i1$1.RouterStateSnapshot]),
8097
+ __metadata("design:returntype", Promise)
8098
+ ], PlaceGuard.prototype, "canActivate", null);
8099
+ __decorate([
8100
+ pectin.Trace(),
8101
+ __metadata("design:type", Function),
8102
+ __metadata("design:paramtypes", [exports.PlaceComponent, i1$1.ActivatedRouteSnapshot, i1$1.RouterStateSnapshot, i1$1.RouterStateSnapshot]),
8103
+ __metadata("design:returntype", Promise)
8104
+ ], PlaceGuard.prototype, "canDeactivate", null);
8105
+ __decorate([
8106
+ pectin.Trace(),
8107
+ __metadata("design:type", Function),
8108
+ __metadata("design:paramtypes", [Object]),
8109
+ __metadata("design:returntype", void 0)
8110
+ ], PlaceGuard.prototype, "handleGuardResult", null);
8111
+ __decorate([
8112
+ pectin.Trace(),
8113
+ __metadata("design:type", Function),
8114
+ __metadata("design:paramtypes", [i1$1.ActivatedRouteSnapshot, i1$1.RouterStateSnapshot, Function]),
8115
+ __metadata("design:returntype", Promise)
8116
+ ], PlaceGuard.prototype, "cleanInteractionState", null);
8061
8117
 
8062
8118
  (function (Formatter) {
8063
8119
  var StringType = /** @class */ (function () {
@@ -8246,6 +8302,7 @@
8246
8302
  exports.NoopAuthGuard = NoopAuthGuard;
8247
8303
  exports.NoopComponent = NoopComponent;
8248
8304
  exports.NumberInputComponent = NumberInputComponent;
8305
+ exports.PLACE_AUTH_SERVICE = PLACE_AUTH_SERVICE;
8249
8306
  exports.PORTAL_EDITOR_COMPONENT = PORTAL_EDITOR_COMPONENT;
8250
8307
  exports.PORTAL_RENDERER_COMPONENT = PORTAL_RENDERER_COMPONENT;
8251
8308
  exports.PasswordInputComponent = PasswordInputComponent;