@coolon/angular-ui-powerups 0.0.92 → 0.0.94

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 (59) hide show
  1. package/bundles/coolon-angular-ui-powerups.umd.js +2079 -1788
  2. package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
  3. package/bundles/coolon-angular-ui-powerups.umd.min.js +1 -1
  4. package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -1
  5. package/coolon-angular-ui-powerups.d.ts +18 -13
  6. package/coolon-angular-ui-powerups.metadata.json +1 -1
  7. package/esm2015/coolon-angular-ui-powerups.js +18 -13
  8. package/esm2015/index.js +2 -2
  9. package/esm2015/lib/interaction/services/dialog-interaction.service.js +3 -3
  10. package/esm2015/lib/place/components/place-outlet/place-outlet.component.js +52 -10
  11. package/esm2015/lib/place/guards/abstract-enter-place.guard.js +296 -0
  12. package/esm2015/lib/place/guards/leave-place.guard.js +47 -0
  13. package/esm2015/lib/place/guards/noop-auth-guard.service.js +30 -0
  14. package/esm2015/lib/place/index.js +5 -3
  15. package/esm2015/lib/place/place-router.js +46 -2
  16. package/esm2015/lib/place/place.decorator.js +1 -1
  17. package/esm2015/lib/place/place.module.js +4 -2
  18. package/esm2015/lib/place/places/noop-gateway-place.component.js +58 -0
  19. package/esm2015/public_api.js +2 -2
  20. package/esm5/coolon-angular-ui-powerups.js +18 -13
  21. package/esm5/index.js +2 -2
  22. package/esm5/lib/interaction/services/dialog-interaction.service.js +3 -3
  23. package/esm5/lib/place/components/place-outlet/place-outlet.component.js +52 -10
  24. package/esm5/lib/place/guards/abstract-enter-place.guard.js +372 -0
  25. package/esm5/lib/place/guards/leave-place.guard.js +55 -0
  26. package/esm5/lib/place/guards/noop-auth-guard.service.js +39 -0
  27. package/esm5/lib/place/index.js +5 -3
  28. package/esm5/lib/place/place-router.js +61 -2
  29. package/esm5/lib/place/place.decorator.js +1 -1
  30. package/esm5/lib/place/place.module.js +4 -2
  31. package/esm5/lib/place/places/noop-gateway-place.component.js +61 -0
  32. package/esm5/public_api.js +2 -2
  33. package/fesm2015/coolon-angular-ui-powerups.js +643 -427
  34. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  35. package/fesm5/coolon-angular-ui-powerups.js +2035 -1750
  36. package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
  37. package/lib/place/components/place-outlet/place-outlet.component.d.ts +6 -2
  38. package/lib/place/{route/guards/enter-place-guard.service.d.ts → guards/abstract-enter-place.guard.d.ts} +9 -4
  39. package/lib/place/{route/guards → guards}/leave-place.guard.d.ts +2 -2
  40. package/lib/place/guards/noop-auth-guard.service.d.ts +5 -0
  41. package/lib/place/index.d.ts +4 -2
  42. package/lib/place/place-router.d.ts +4 -0
  43. package/lib/place/places/noop-gateway-place.component.d.ts +10 -0
  44. package/package.json +1 -1
  45. package/schematics/place-routes/place-builder.d.ts +2 -1
  46. package/schematics/place-routes/place-builder.js +11 -3
  47. package/schematics/place-routes/place-builder.js.map +1 -1
  48. package/schematics/place-routes/place-class-scanner.js +1 -0
  49. package/schematics/place-routes/place-class-scanner.js.map +1 -1
  50. package/schematics/place-routes/place-def.d.ts +0 -1
  51. package/schematics/place-routes/place-def.js +1 -14
  52. package/schematics/place-routes/place-def.js.map +1 -1
  53. package/schematics/place-routes/templates/place-destinations.ts.template +3 -2
  54. package/schematics/place-routes/templates/place-routes.ts.template +29 -4
  55. package/schematics/place-routes/templates/place-visits.ts.template +2 -1
  56. package/esm2015/lib/place/route/guards/enter-place-guard.service.js +0 -248
  57. package/esm2015/lib/place/route/guards/leave-place.guard.js +0 -47
  58. package/esm5/lib/place/route/guards/enter-place-guard.service.js +0 -278
  59. package/esm5/lib/place/route/guards/leave-place.guard.js +0 -55
@@ -4,7 +4,7 @@ import { FormsModule } from '@angular/forms';
4
4
  import { MatInputModule, MatFormFieldModule, MatSelectModule, MatDialog, MatButtonModule, MatDialogModule, MatTabsModule as MatTabsModule$1, MatProgressSpinnerModule } from '@angular/material';
5
5
  import { MatTabsModule } from '@angular/material/tabs';
6
6
  import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
7
- import { GarbageCollector, DelegatingValueModel, assert, UnaryCommand, lang, Dsl, Logger, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, DelegatingListModel, Deferred, MutableStream, MutableListModel, MutableValueModel, Binding, Trace, Guard as Guard$1, Command, StoreInValueModel, OptionsHelper, ValueHolder } from '@coolon/pectin';
7
+ import { GarbageCollector, DelegatingValueModel, assert, UnaryCommand, lang, Dsl, Logger, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, DelegatingListModel, Deferred, MutableStream, MutableListModel, MutableValueModel, Binding, Trace, Guard as Guard$1, StoreInValueModel, Command, OptionsHelper, ValueHolder } from '@coolon/pectin';
8
8
  import { __decorate, __metadata, __awaiter } from 'tslib';
9
9
  import { PortalModule } from '@angular/cdk/portal';
10
10
  import { Router, RouterModule, NavigationStart, NavigationEnd, NavigationError, UrlSerializer, UrlSegment, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
@@ -19,6 +19,7 @@ import { Memoize as Memoize$1 } from '@typescript-plus/fast-memoize-decorator';
19
19
  import 'reflect-metadata';
20
20
  import { style, query, group, animate, trigger, transition } from '@angular/animations';
21
21
  import ResizeObserver from 'resize-observer-polyfill';
22
+ import { Observable } from 'rxjs';
22
23
 
23
24
  /**
24
25
  * @fileoverview added by tsickle
@@ -1891,7 +1892,7 @@ class DialogInteractionService extends InteractionContext {
1891
1892
  * @return {?}
1892
1893
  */
1893
1894
  () => {
1894
- console.log('###### STARTING');
1895
+ // console.log('###### STARTING');
1895
1896
  this._inActivityPromise.value = true;
1896
1897
  // this.currentActivityId = uuid.v1();
1897
1898
  // this.location.go(this.router.routerState.snapshot.url, "aup");
@@ -1952,7 +1953,7 @@ class DialogInteractionService extends InteractionContext {
1952
1953
  */
1953
1954
  () => {
1954
1955
  this._inActivityPromise.value = false;
1955
- console.log('###### FINISHED');
1956
+ // console.log('###### FINISHED');
1956
1957
  // this.currentActivityId = null;
1957
1958
  self.safelyUpdateActivityListDelegate(null);
1958
1959
  }));
@@ -3192,6 +3193,278 @@ if (false) {
3192
3193
  * @fileoverview added by tsickle
3193
3194
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3194
3195
  */
3196
+ /**
3197
+ * @param {?} options
3198
+ * @return {?}
3199
+ */
3200
+ function Place(options) {
3201
+ return (/**
3202
+ * @param {?} target
3203
+ * @return {?}
3204
+ */
3205
+ (target) => {
3206
+ if (PlaceComponent.isPlaceComponentConstructor(target)) {
3207
+ PlaceComponent.injectDefinition(target, new PlaceDefinition(target, options.path, isNil(options.authenticate) ? false : options.authenticate, options.data, PlaceComponent.getRouteParameters(target), (options.children || []).map((/**
3208
+ * @param {?} c
3209
+ * @return {?}
3210
+ */
3211
+ c => PlaceComponent.getDefinition(c)))));
3212
+ }
3213
+ else {
3214
+ lang.illegalState(`${target} must extend PlaceComponent to use the @Place decorator`);
3215
+ }
3216
+ });
3217
+ }
3218
+ (function (Place) {
3219
+ /**
3220
+ * @record
3221
+ */
3222
+ function Options() { }
3223
+ Place.Options = Options;
3224
+ if (false) {
3225
+ /** @type {?} */
3226
+ Options.prototype.path;
3227
+ /** @type {?|undefined} */
3228
+ Options.prototype.data;
3229
+ /** @type {?|undefined} */
3230
+ Options.prototype.authenticate;
3231
+ /** @type {?|undefined} */
3232
+ Options.prototype.children;
3233
+ /** @type {?|undefined} */
3234
+ Options.prototype.defaultChild;
3235
+ }
3236
+ })(Place || (Place = {}));
3237
+
3238
+ /**
3239
+ * @fileoverview added by tsickle
3240
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3241
+ */
3242
+ // WARNING: interface has both a type and a value, skipping emit
3243
+ var Formatter;
3244
+ (function (Formatter) {
3245
+ class StringType {
3246
+ /**
3247
+ * @param {?} value
3248
+ * @return {?}
3249
+ */
3250
+ format(value) {
3251
+ return value;
3252
+ }
3253
+ /**
3254
+ * @param {?} value
3255
+ * @return {?}
3256
+ */
3257
+ parse(value) {
3258
+ return value;
3259
+ }
3260
+ }
3261
+ class NumberType {
3262
+ /**
3263
+ * @param {?} value
3264
+ * @return {?}
3265
+ */
3266
+ format(value) {
3267
+ return ___default.isNumber(value) && !___default.isNaN(value) ? `${value}` : null;
3268
+ }
3269
+ /**
3270
+ * @param {?} value
3271
+ * @return {?}
3272
+ */
3273
+ parse(value) {
3274
+ /** @type {?} */
3275
+ const parsed = Number.parseFloat(value);
3276
+ return ___default.isNaN(parsed) ? null : parsed;
3277
+ }
3278
+ }
3279
+ class BooleanType {
3280
+ /**
3281
+ * @param {?} value
3282
+ * @return {?}
3283
+ */
3284
+ format(value) {
3285
+ return value ? 'true' : 'false';
3286
+ }
3287
+ /**
3288
+ * @param {?} value
3289
+ * @return {?}
3290
+ */
3291
+ parse(value) {
3292
+ return value === 'true';
3293
+ }
3294
+ }
3295
+ Formatter.STRING = new StringType();
3296
+ Formatter.NUMBER = new NumberType();
3297
+ Formatter.BOOLEAN = new BooleanType();
3298
+ })(Formatter || (Formatter = {}));
3299
+
3300
+ /**
3301
+ * @fileoverview added by tsickle
3302
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3303
+ */
3304
+ /**
3305
+ * @record
3306
+ * @template T
3307
+ */
3308
+ function RouteIdOptions() { }
3309
+ if (false) {
3310
+ /** @type {?|undefined} */
3311
+ RouteIdOptions.prototype.as;
3312
+ /** @type {?|undefined} */
3313
+ RouteIdOptions.prototype.optional;
3314
+ /** @type {?|undefined} */
3315
+ RouteIdOptions.prototype.remember;
3316
+ /** @type {?|undefined} */
3317
+ RouteIdOptions.prototype.defaultValue;
3318
+ }
3319
+ /**
3320
+ * @record
3321
+ * @template T
3322
+ */
3323
+ function RouteParameterOptions() { }
3324
+ if (false) {
3325
+ /** @type {?|undefined} */
3326
+ RouteParameterOptions.prototype.as;
3327
+ /** @type {?|undefined} */
3328
+ RouteParameterOptions.prototype.optional;
3329
+ /** @type {?|undefined} */
3330
+ RouteParameterOptions.prototype.remember;
3331
+ /** @type {?|undefined} */
3332
+ RouteParameterOptions.prototype.defaultValue;
3333
+ /** @type {?|undefined} */
3334
+ RouteParameterOptions.prototype.storeInUrl;
3335
+ }
3336
+ /**
3337
+ * @record
3338
+ * @template T
3339
+ */
3340
+ function RouteListParameterOptions() { }
3341
+ if (false) {
3342
+ /** @type {?|undefined} */
3343
+ RouteListParameterOptions.prototype.as;
3344
+ /** @type {?|undefined} */
3345
+ RouteListParameterOptions.prototype.optional;
3346
+ /** @type {?|undefined} */
3347
+ RouteListParameterOptions.prototype.remember;
3348
+ /** @type {?|undefined} */
3349
+ RouteListParameterOptions.prototype.defaultValue;
3350
+ /** @type {?|undefined} */
3351
+ RouteListParameterOptions.prototype.storeInUrl;
3352
+ }
3353
+ /**
3354
+ * @template T
3355
+ * @param {?} type
3356
+ * @param {?=} options
3357
+ * @return {?}
3358
+ */
3359
+ function RouteId(type, options) {
3360
+ return (/**
3361
+ * @param {?} prototype
3362
+ * @param {?} propertyKey
3363
+ * @return {?}
3364
+ */
3365
+ (prototype, propertyKey) => {
3366
+ /** @type {?} */
3367
+ const param = new ParameterDefinition.RouteId(propertyKey.toString(), options, type);
3368
+ Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
3369
+ UseDelegate()(prototype, propertyKey);
3370
+ });
3371
+ }
3372
+ /**
3373
+ * @template T
3374
+ * @param {?=} options
3375
+ * @return {?}
3376
+ */
3377
+ function VisitParameter(options) {
3378
+ /** @type {?} */
3379
+ const opts = Opts.get(options);
3380
+ return (/**
3381
+ * @param {?} prototype
3382
+ * @param {?} propertyKey
3383
+ * @return {?}
3384
+ */
3385
+ (prototype, propertyKey) => {
3386
+ /** @type {?} */
3387
+ const param = new ParameterDefinition.ValueParameter(propertyKey.toString(), options, opts.getOptional("storeInUrl", null));
3388
+ Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
3389
+ UseDelegate()(prototype, propertyKey);
3390
+ });
3391
+ }
3392
+ /**
3393
+ * @template E
3394
+ * @param {?=} options
3395
+ * @return {?}
3396
+ */
3397
+ function VisitParameterList(options) {
3398
+ /** @type {?} */
3399
+ const opts = Opts.get(options);
3400
+ return (/**
3401
+ * @param {?} prototype
3402
+ * @param {?} propertyKey
3403
+ * @return {?}
3404
+ */
3405
+ (prototype, propertyKey) => {
3406
+ /** @type {?} */
3407
+ const param = new ParameterDefinition.ArrayParameter(propertyKey.toString(), options, opts.getOptional("storeInUrl", null));
3408
+ Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
3409
+ UseDelegate()(prototype, propertyKey);
3410
+ });
3411
+ }
3412
+
3413
+ /**
3414
+ * @fileoverview added by tsickle
3415
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3416
+ */
3417
+ let NoopGatewayPlace = class NoopGatewayPlace extends PlaceComponent {
3418
+ /**
3419
+ * @param {?} router
3420
+ */
3421
+ constructor(router) {
3422
+ super();
3423
+ this.router = router;
3424
+ }
3425
+ /**
3426
+ * @return {?}
3427
+ */
3428
+ ngOnInit() {
3429
+ this.router.navigateByUrl(this.returnUrl.value);
3430
+ }
3431
+ };
3432
+ NoopGatewayPlace.ctorParameters = () => [
3433
+ { type: Router }
3434
+ ];
3435
+ NoopGatewayPlace.decorators = [
3436
+ { type: Component, args: [{
3437
+ template: ''
3438
+ }] }
3439
+ ];
3440
+ /** @nocollapse */
3441
+ NoopGatewayPlace.ctorParameters = () => [
3442
+ { type: Router }
3443
+ ];
3444
+ __decorate([
3445
+ VisitParameter({ storeInUrl: Formatter.STRING }),
3446
+ __metadata("design:type", MutableValueModel)
3447
+ ], NoopGatewayPlace.prototype, "returnUrl", void 0);
3448
+ NoopGatewayPlace = __decorate([
3449
+ Place({
3450
+ path: 'aup-gateway-route',
3451
+ authenticate: false
3452
+ }),
3453
+ __metadata("design:paramtypes", [Router])
3454
+ ], NoopGatewayPlace);
3455
+ if (false) {
3456
+ /** @type {?} */
3457
+ NoopGatewayPlace.prototype.returnUrl;
3458
+ /** @type {?} */
3459
+ NoopGatewayPlace.prototype.router;
3460
+ }
3461
+
3462
+ /**
3463
+ * @fileoverview added by tsickle
3464
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3465
+ */
3466
+ /** @type {?} */
3467
+ const noopPlaceDef = PlaceComponent.getDefinition(NoopGatewayPlace);
3195
3468
  class PlaceRouter extends GarbageCollector {
3196
3469
  /**
3197
3470
  * @param {?} router
@@ -3210,6 +3483,8 @@ class PlaceRouter extends GarbageCollector {
3210
3483
  this.firstRoute = true;
3211
3484
  this._navigationSessionModel = new MutableValueModel();
3212
3485
  this._activeVisits = new MutableListModel();
3486
+ this.initialRedirectStarted = false;
3487
+ this.initialRedirectFinished = false;
3213
3488
  const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
3214
3489
  this.activeVisitIndex = chain(this._activeVisits).indexBy('placeDefinition');
3215
3490
  this.navigationSessionFactory = new NavigationSession.Factory(interactionContext);
@@ -3430,11 +3705,39 @@ class PlaceRouter extends GarbageCollector {
3430
3705
  parseUrl(snapshot) {
3431
3706
  return new PlaceRouter.UrlHelper(this.urlSerializer.parse(snapshot.url));
3432
3707
  }
3433
- }
3434
- PlaceRouter.decorators = [
3435
- { type: Injectable, args: [{
3436
- providedIn: 'root'
3437
- },] }
3708
+ // TODO: this all only sort of works. Opening dialogs and clicking back multiple times breaks things.
3709
+ // TODO: next stage is to investigate tracking dialog state in a different placeoutlet and keeping those
3710
+ // TODO: urls out of the history.
3711
+ /**
3712
+ * @param {?} activatedRoute
3713
+ * @param {?} state
3714
+ * @return {?}
3715
+ */
3716
+ performInitialNavigationIntercept(activatedRoute, state) {
3717
+ assert.isTruthy(this.isInitialNavigation());
3718
+ Logger.get(this).info(`Redirecting to: ${noopPlaceDef.path}`, { returnUrl: state.url });
3719
+ if (!this.initialRedirectFinished) {
3720
+ this.initialRedirectFinished = true;
3721
+ return this.router.createUrlTree([noopPlaceDef.path, {
3722
+ returnUrl: state.url
3723
+ }], {
3724
+ replaceUrl: true,
3725
+ // make sure we update our history
3726
+ skipLocationChange: false
3727
+ });
3728
+ }
3729
+ }
3730
+ /**
3731
+ * @return {?}
3732
+ */
3733
+ isInitialNavigation() {
3734
+ return this.navigationSession.firstNavigation && !this.initialRedirectFinished;
3735
+ }
3736
+ }
3737
+ PlaceRouter.decorators = [
3738
+ { type: Injectable, args: [{
3739
+ providedIn: 'root'
3740
+ },] }
3438
3741
  ];
3439
3742
  /** @nocollapse */
3440
3743
  PlaceRouter.ctorParameters = () => [
@@ -3476,6 +3779,16 @@ if (false) {
3476
3779
  * @private
3477
3780
  */
3478
3781
  PlaceRouter.prototype.navigationSessionFactory;
3782
+ /**
3783
+ * @type {?}
3784
+ * @private
3785
+ */
3786
+ PlaceRouter.prototype.initialRedirectStarted;
3787
+ /**
3788
+ * @type {?}
3789
+ * @private
3790
+ */
3791
+ PlaceRouter.prototype.initialRedirectFinished;
3479
3792
  /**
3480
3793
  * @type {?}
3481
3794
  * @private
@@ -3688,9 +4001,9 @@ class PlaceOutletComponent extends DisposableComponent {
3688
4001
  this.router = router;
3689
4002
  this.placeRouter = placeRouter;
3690
4003
  this.placeConfig = placeConfig;
3691
- this.animate = true;
3692
4004
  this.placeChanged = new EventEmitter();
3693
4005
  this._activePlace = new MutableValueModel();
4006
+ this._previousPlace = new MutableValueModel();
3694
4007
  this._activePlaceVisitModel = new DelegatingValueModel();
3695
4008
  this._inOutletActivation = new Guard$1();
3696
4009
  this._inOutletDeactivation = new Guard$1();
@@ -3712,12 +4025,32 @@ class PlaceOutletComponent extends DisposableComponent {
3712
4025
  .pluck('placeDefinition')
3713
4026
  .pluckList('children')
3714
4027
  .pluck('component');
4028
+ // TODO: This is a hack to prevent animation during the NoopGatewayPlace
3715
4029
  /** @type {?} */
3716
- const activatePlaceType = chain(this.activePlaceModel).map((/**
4030
+ const activePlaceType = chain(this._activePlace).map((/**
4031
+ * @param {?} p
4032
+ * @return {?}
4033
+ */
4034
+ p => {
4035
+ return (/** @type {?} */ (p.constructor));
4036
+ }), {
4037
+ postponeWhile: chain(this.activePlaceModel).isNil()
4038
+ });
4039
+ /** @type {?} */
4040
+ const previousPlaceType = chain(this._previousPlace).map((/**
3717
4041
  * @param {?} p
3718
4042
  * @return {?}
3719
4043
  */
3720
4044
  p => (/** @type {?} */ (p.constructor))));
4045
+ this.ready = chain.reduce(activePlaceType, previousPlaceType, (/**
4046
+ * @param {?} current
4047
+ * @param {?} previous
4048
+ * @return {?}
4049
+ */
4050
+ (current, previous) => {
4051
+ return !!current && current !== NoopGatewayPlace && previous !== NoopGatewayPlace;
4052
+ }));
4053
+ this.enableAnimation = valueOf.all(this.ready, this.animateModel).areTruthy();
3721
4054
  this.placeAnimationOrder = chain(this.customPlaceAnimationOrderModel)
3722
4055
  .otherwise(defaultPlaceAnimationOrder)
3723
4056
  .reduce((/**
@@ -3727,14 +4060,14 @@ class PlaceOutletComponent extends DisposableComponent {
3727
4060
  (placesInOrder) => {
3728
4061
  /** @type {?} */
3729
4062
  let placeIndex = 0;
3730
- if (activatePlaceType.value) {
3731
- placeIndex = placesInOrder.indexOf(activatePlaceType.value);
3732
- if (isNil(this.initialPlaceIndex)) {
4063
+ if (activePlaceType.value) {
4064
+ placeIndex = placesInOrder.indexOf(activePlaceType.value);
4065
+ if (isNil(this.initialPlaceIndex && placeIndex >= 0)) {
3733
4066
  this.initialPlaceIndex = placeIndex;
3734
4067
  }
3735
4068
  }
3736
4069
  return isNil(this.initialPlaceIndex) ? 0 : placeIndex - this.initialPlaceIndex;
3737
- }), { dependsOn: activatePlaceType });
4070
+ }), { dependsOn: activePlaceType });
3738
4071
  // Push incoming changes into the component
3739
4072
  this.routerVisit = chain(this._activePlace).pluck('placeDefinition').findIn(placeRouter.activeVisitIndex);
3740
4073
  // Our router visit will change when our active is nullified during deactivation, which will push a null visit
@@ -3869,7 +4202,7 @@ class PlaceOutletComponent extends DisposableComponent {
3869
4202
  console.error(error);
3870
4203
  }
3871
4204
  }));
3872
- if (!this.animate) {
4205
+ if (!this.enableAnimation.value) {
3873
4206
  // we're not animating so trigger any post animation callbacks now.
3874
4207
  this.animationDone();
3875
4208
  }
@@ -3883,6 +4216,7 @@ class PlaceOutletComponent extends DisposableComponent {
3883
4216
  * @return {?}
3884
4217
  */
3885
4218
  () => {
4219
+ this._previousPlace.value = this._activePlace.value;
3886
4220
  this._activePlace.value = null;
3887
4221
  this._activatedRouteModel.value = null;
3888
4222
  this._placeDefinition.value = null;
@@ -3909,7 +4243,7 @@ class PlaceOutletComponent extends DisposableComponent {
3909
4243
  PlaceOutletComponent.decorators = [
3910
4244
  { type: Component, args: [{
3911
4245
  selector: 'aup-place-outlet',
3912
- template: "<div class=\"router-outlet-container\"\n [@routeAnimations]=\"{value: getAnimationOrder(), params:{duration: animationDuration}}\"\n (@routeAnimations.start)=\"animationStarted()\"\n (@routeAnimations.done)=\"animationDone()\"\n>\n <router-outlet #routerOutlet=\"outlet\"\n (activate)=\"onOutletActivated(routerOutlet, $event)\"\n (deactivate)=\"onOutletDeactivated()\">\n </router-outlet>\n</div>\n\n",
4246
+ template: "<div class=\"router-outlet-container\"\n [@routeAnimations]=\"{value: getAnimationOrder(), params:{duration: animationDuration}}\"\n [@.disabled]=\"!enableAnimation.value\"\n (@routeAnimations.start)=\"animationStarted()\"\n (@routeAnimations.done)=\"animationDone()\"\n>\n <router-outlet #routerOutlet=\"outlet\"\n (activate)=\"onOutletActivated(routerOutlet, $event)\"\n (deactivate)=\"onOutletDeactivated()\">\n </router-outlet>\n</div>\n\n",
3913
4247
  animations: [LEFT_RIGHT_PLACE_ANIMATION],
3914
4248
  styles: [":host{display:flex;flex-direction:column;min-height:0;overflow-x:hidden}.router-outlet-container{flex:1;display:block;position:relative;min-height:0}router-outlet{display:none}"]
3915
4249
  }] }
@@ -3923,11 +4257,20 @@ PlaceOutletComponent.ctorParameters = () => [
3923
4257
  ];
3924
4258
  PlaceOutletComponent.propDecorators = {
3925
4259
  animate: [{ type: Input }],
4260
+ animateModel: [{ type: Input, args: ['animateModel',] }],
3926
4261
  customPlaceAnimationOrderModel: [{ type: Input, args: ['placeAnimationOrderModel',] }],
3927
4262
  customPlaceAnimationOrder: [{ type: Input, args: ['placeAnimationOrder',] }],
3928
4263
  placeChanged: [{ type: Output }],
3929
4264
  routerOut: [{ type: ViewChild, args: ['routeOutlet', { static: true },] }]
3930
4265
  };
4266
+ __decorate([
4267
+ StoreInValueModel('animateModel'),
4268
+ __metadata("design:type", Boolean)
4269
+ ], PlaceOutletComponent.prototype, "animate", void 0);
4270
+ __decorate([
4271
+ UseDelegate({ defaultValue: true }),
4272
+ __metadata("design:type", ValueModel)
4273
+ ], PlaceOutletComponent.prototype, "animateModel", void 0);
3931
4274
  __decorate([
3932
4275
  UseDelegate(),
3933
4276
  __metadata("design:type", ListModel)
@@ -3940,6 +4283,8 @@ if (false) {
3940
4283
  /** @type {?} */
3941
4284
  PlaceOutletComponent.prototype.animate;
3942
4285
  /** @type {?} */
4286
+ PlaceOutletComponent.prototype.animateModel;
4287
+ /** @type {?} */
3943
4288
  PlaceOutletComponent.prototype.customPlaceAnimationOrderModel;
3944
4289
  /** @type {?} */
3945
4290
  PlaceOutletComponent.prototype.customPlaceAnimationOrder;
@@ -3952,6 +4297,11 @@ if (false) {
3952
4297
  * @private
3953
4298
  */
3954
4299
  PlaceOutletComponent.prototype._activePlace;
4300
+ /**
4301
+ * @type {?}
4302
+ * @private
4303
+ */
4304
+ PlaceOutletComponent.prototype._previousPlace;
3955
4305
  /**
3956
4306
  * @type {?}
3957
4307
  * @private
@@ -4004,6 +4354,10 @@ if (false) {
4004
4354
  * @private
4005
4355
  */
4006
4356
  PlaceOutletComponent.prototype.routerVisit;
4357
+ /** @type {?} */
4358
+ PlaceOutletComponent.prototype.ready;
4359
+ /** @type {?} */
4360
+ PlaceOutletComponent.prototype.enableAnimation;
4007
4361
  /**
4008
4362
  * @type {?}
4009
4363
  * @private
@@ -4288,7 +4642,8 @@ PlaceModule.decorators = [
4288
4642
  PlaceOutletComponent,
4289
4643
  TabbedPlaceNavigationComponent,
4290
4644
  ListPlaceNavComponent,
4291
- AbstractPlaceNavigationComponent
4645
+ AbstractPlaceNavigationComponent,
4646
+ NoopGatewayPlace
4292
4647
  ],
4293
4648
  entryComponents: [BusyOverlayComponent],
4294
4649
  exports: [
@@ -4658,391 +5013,118 @@ function Result() { }
4658
5013
  function ActivityOutletContext() { }
4659
5014
  if (false) {
4660
5015
  /** @type {?} */
4661
- ActivityOutletContext.prototype.activityClass;
4662
- /** @type {?} */
4663
- ActivityOutletContext.prototype.activityData;
4664
- /**
4665
- * @param {?} component
4666
- * @return {?}
4667
- */
4668
- ActivityOutletContext.prototype.componentReady = function (component) { };
4669
- }
4670
-
4671
- /**
4672
- * @fileoverview added by tsickle
4673
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4674
- */
4675
- class InteractionGuard {
4676
- /**
4677
- * @param {?} router
4678
- * @param {?} injector
4679
- * @param {?} interactionContext
4680
- */
4681
- constructor(router, injector, interactionContext) {
4682
- this.router = router;
4683
- this.injector = injector;
4684
- this.interactionContext = interactionContext;
4685
- }
4686
- /**
4687
- * @param {?} route
4688
- * @param {?} state
4689
- * @return {?}
4690
- */
4691
- canActivate(route, state) {
4692
- return true;
4693
- }
4694
- /**
4695
- * @param {?} component
4696
- * @param {?} currentRoute
4697
- * @param {?} currentState
4698
- * @param {?=} nextState
4699
- * @return {?}
4700
- */
4701
- canDeactivate(component, currentRoute, currentState, nextState) {
4702
- return !this.interactionContext.isActive();
4703
- }
4704
- }
4705
- InteractionGuard.decorators = [
4706
- { type: Injectable, args: [{
4707
- providedIn: 'root'
4708
- },] }
4709
- ];
4710
- /** @nocollapse */
4711
- InteractionGuard.ctorParameters = () => [
4712
- { type: Router },
4713
- { type: Injector },
4714
- { type: InteractionContext }
4715
- ];
4716
- /** @nocollapse */ InteractionGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function InteractionGuard_Factory() { return new InteractionGuard(ɵɵinject(Router), ɵɵinject(INJECTOR), ɵɵinject(InteractionContext)); }, token: InteractionGuard, providedIn: "root" });
4717
- __decorate([
4718
- Trace(),
4719
- __metadata("design:type", Function),
4720
- __metadata("design:paramtypes", [ActivatedRouteSnapshot, RouterStateSnapshot]),
4721
- __metadata("design:returntype", Object)
4722
- ], InteractionGuard.prototype, "canActivate", null);
4723
- __decorate([
4724
- Trace(),
4725
- __metadata("design:type", Function),
4726
- __metadata("design:paramtypes", [NoopComponent, ActivatedRouteSnapshot, RouterStateSnapshot, RouterStateSnapshot]),
4727
- __metadata("design:returntype", Object)
4728
- ], InteractionGuard.prototype, "canDeactivate", null);
4729
- if (false) {
4730
- /**
4731
- * @type {?}
4732
- * @private
4733
- */
4734
- InteractionGuard.prototype.router;
4735
- /**
4736
- * @type {?}
4737
- * @private
4738
- */
4739
- InteractionGuard.prototype.injector;
4740
- /**
4741
- * @type {?}
4742
- * @private
4743
- */
4744
- InteractionGuard.prototype.interactionContext;
4745
- }
4746
-
4747
- /**
4748
- * @fileoverview added by tsickle
4749
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4750
- */
4751
-
4752
- /**
4753
- * @fileoverview added by tsickle
4754
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4755
- */
4756
- /**
4757
- * @record
4758
- */
4759
- function NavItem() { }
4760
- if (false) {
4761
- /**
4762
- * @return {?}
4763
- */
4764
- NavItem.prototype.title = function () { };
4765
- /**
4766
- * @return {?}
4767
- */
4768
- NavItem.prototype.icon = function () { };
4769
- /**
4770
- * @return {?}
4771
- */
4772
- NavItem.prototype.tooltip = function () { };
4773
- }
4774
-
4775
- /**
4776
- * @fileoverview added by tsickle
4777
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4778
- */
4779
- /**
4780
- * @param {?} options
4781
- * @return {?}
4782
- */
4783
- function Place(options) {
4784
- return (/**
4785
- * @param {?} target
4786
- * @return {?}
4787
- */
4788
- (target) => {
4789
- if (PlaceComponent.isPlaceComponentConstructor(target)) {
4790
- PlaceComponent.injectDefinition(target, new PlaceDefinition(target, options.path, isNil(options.authenticate) ? false : options.authenticate, options.data, PlaceComponent.getRouteParameters(target), (options.children || []).map((/**
4791
- * @param {?} c
4792
- * @return {?}
4793
- */
4794
- c => PlaceComponent.getDefinition(c)))));
4795
- }
4796
- else {
4797
- lang.illegalState(`${target} must extend PlaceComponent to use the @Place decorator`);
4798
- }
4799
- });
4800
- }
4801
- (function (Place) {
4802
- /**
4803
- * @record
4804
- */
4805
- function Options() { }
4806
- Place.Options = Options;
4807
- if (false) {
4808
- /** @type {?} */
4809
- Options.prototype.path;
4810
- /** @type {?|undefined} */
4811
- Options.prototype.data;
4812
- /** @type {?|undefined} */
4813
- Options.prototype.authenticate;
4814
- /** @type {?|undefined} */
4815
- Options.prototype.children;
4816
- /** @type {?|undefined} */
4817
- Options.prototype.defaultChild;
4818
- }
4819
- })(Place || (Place = {}));
4820
-
4821
- /**
4822
- * @fileoverview added by tsickle
4823
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4824
- */
4825
- // WARNING: interface has both a type and a value, skipping emit
4826
- var Formatter;
4827
- (function (Formatter) {
4828
- class StringType {
4829
- /**
4830
- * @param {?} value
4831
- * @return {?}
4832
- */
4833
- format(value) {
4834
- return value;
4835
- }
4836
- /**
4837
- * @param {?} value
4838
- * @return {?}
4839
- */
4840
- parse(value) {
4841
- return value;
4842
- }
4843
- }
4844
- class NumberType {
4845
- /**
4846
- * @param {?} value
4847
- * @return {?}
4848
- */
4849
- format(value) {
4850
- return ___default.isNumber(value) && !___default.isNaN(value) ? `${value}` : null;
4851
- }
4852
- /**
4853
- * @param {?} value
4854
- * @return {?}
4855
- */
4856
- parse(value) {
4857
- /** @type {?} */
4858
- const parsed = Number.parseFloat(value);
4859
- return ___default.isNaN(parsed) ? null : parsed;
4860
- }
4861
- }
4862
- class BooleanType {
4863
- /**
4864
- * @param {?} value
4865
- * @return {?}
4866
- */
4867
- format(value) {
4868
- return value ? 'true' : 'false';
4869
- }
4870
- /**
4871
- * @param {?} value
4872
- * @return {?}
4873
- */
4874
- parse(value) {
4875
- return value === 'true';
4876
- }
4877
- }
4878
- Formatter.STRING = new StringType();
4879
- Formatter.NUMBER = new NumberType();
4880
- Formatter.BOOLEAN = new BooleanType();
4881
- })(Formatter || (Formatter = {}));
4882
-
4883
- /**
4884
- * @fileoverview added by tsickle
4885
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4886
- */
4887
- /**
4888
- * @record
4889
- */
4890
- function JsonArray() { }
4891
- /**
4892
- * @record
4893
- */
4894
- function JsonMap() { }
4895
-
4896
- /**
4897
- * @fileoverview added by tsickle
4898
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4899
- */
4900
- /**
4901
- * @record
4902
- * @template T
4903
- */
4904
- function RouteIdOptions() { }
4905
- if (false) {
4906
- /** @type {?|undefined} */
4907
- RouteIdOptions.prototype.as;
4908
- /** @type {?|undefined} */
4909
- RouteIdOptions.prototype.optional;
4910
- /** @type {?|undefined} */
4911
- RouteIdOptions.prototype.remember;
4912
- /** @type {?|undefined} */
4913
- RouteIdOptions.prototype.defaultValue;
4914
- }
4915
- /**
4916
- * @record
4917
- * @template T
4918
- */
4919
- function RouteParameterOptions() { }
4920
- if (false) {
4921
- /** @type {?|undefined} */
4922
- RouteParameterOptions.prototype.as;
4923
- /** @type {?|undefined} */
4924
- RouteParameterOptions.prototype.optional;
4925
- /** @type {?|undefined} */
4926
- RouteParameterOptions.prototype.remember;
4927
- /** @type {?|undefined} */
4928
- RouteParameterOptions.prototype.defaultValue;
4929
- /** @type {?|undefined} */
4930
- RouteParameterOptions.prototype.storeInUrl;
4931
- }
4932
- /**
4933
- * @record
4934
- * @template T
4935
- */
4936
- function RouteListParameterOptions() { }
4937
- if (false) {
4938
- /** @type {?|undefined} */
4939
- RouteListParameterOptions.prototype.as;
4940
- /** @type {?|undefined} */
4941
- RouteListParameterOptions.prototype.optional;
4942
- /** @type {?|undefined} */
4943
- RouteListParameterOptions.prototype.remember;
4944
- /** @type {?|undefined} */
4945
- RouteListParameterOptions.prototype.defaultValue;
4946
- /** @type {?|undefined} */
4947
- RouteListParameterOptions.prototype.storeInUrl;
4948
- }
4949
- /**
4950
- * @template T
4951
- * @param {?} type
4952
- * @param {?=} options
4953
- * @return {?}
4954
- */
4955
- function RouteId(type, options) {
4956
- return (/**
4957
- * @param {?} prototype
4958
- * @param {?} propertyKey
4959
- * @return {?}
4960
- */
4961
- (prototype, propertyKey) => {
4962
- /** @type {?} */
4963
- const param = new ParameterDefinition.RouteId(propertyKey.toString(), options, type);
4964
- Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
4965
- UseDelegate()(prototype, propertyKey);
4966
- });
4967
- }
4968
- /**
4969
- * @template T
4970
- * @param {?=} options
4971
- * @return {?}
4972
- */
4973
- function VisitParameter(options) {
4974
- /** @type {?} */
4975
- const opts = Opts.get(options);
4976
- return (/**
4977
- * @param {?} prototype
4978
- * @param {?} propertyKey
4979
- * @return {?}
4980
- */
4981
- (prototype, propertyKey) => {
4982
- /** @type {?} */
4983
- const param = new ParameterDefinition.ValueParameter(propertyKey.toString(), options, opts.getOptional("storeInUrl", null));
4984
- Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
4985
- UseDelegate()(prototype, propertyKey);
4986
- });
4987
- }
4988
- /**
4989
- * @template E
4990
- * @param {?=} options
4991
- * @return {?}
4992
- */
4993
- function VisitParameterList(options) {
4994
- /** @type {?} */
4995
- const opts = Opts.get(options);
4996
- return (/**
4997
- * @param {?} prototype
4998
- * @param {?} propertyKey
5016
+ ActivityOutletContext.prototype.activityClass;
5017
+ /** @type {?} */
5018
+ ActivityOutletContext.prototype.activityData;
5019
+ /**
5020
+ * @param {?} component
4999
5021
  * @return {?}
5000
5022
  */
5001
- (prototype, propertyKey) => {
5002
- /** @type {?} */
5003
- const param = new ParameterDefinition.ArrayParameter(propertyKey.toString(), options, opts.getOptional("storeInUrl", null));
5004
- Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
5005
- UseDelegate()(prototype, propertyKey);
5006
- });
5023
+ ActivityOutletContext.prototype.componentReady = function (component) { };
5007
5024
  }
5008
5025
 
5009
5026
  /**
5010
5027
  * @fileoverview added by tsickle
5011
5028
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5012
5029
  */
5013
- /**
5014
- * @record
5015
- * @template S
5016
- */
5017
- function ParameterSanitiser() { }
5018
- if (false) {
5030
+ class InteractionGuard {
5019
5031
  /**
5020
- * @param {?} parameterValue
5021
- * @param {?=} visit
5022
- * @param {?=} injector
5032
+ * @param {?} router
5033
+ * @param {?} injector
5034
+ * @param {?} interactionContext
5035
+ */
5036
+ constructor(router, injector, interactionContext) {
5037
+ this.router = router;
5038
+ this.injector = injector;
5039
+ this.interactionContext = interactionContext;
5040
+ }
5041
+ /**
5042
+ * @param {?} route
5043
+ * @param {?} state
5023
5044
  * @return {?}
5024
5045
  */
5025
- ParameterSanitiser.prototype.sanitise = function (parameterValue, visit, injector) { };
5046
+ canActivate(route, state) {
5047
+ return true;
5048
+ }
5049
+ /**
5050
+ * @param {?} component
5051
+ * @param {?} currentRoute
5052
+ * @param {?} currentState
5053
+ * @param {?=} nextState
5054
+ * @return {?}
5055
+ */
5056
+ canDeactivate(component, currentRoute, currentState, nextState) {
5057
+ return !this.interactionContext.isActive();
5058
+ }
5059
+ }
5060
+ InteractionGuard.decorators = [
5061
+ { type: Injectable, args: [{
5062
+ providedIn: 'root'
5063
+ },] }
5064
+ ];
5065
+ /** @nocollapse */
5066
+ InteractionGuard.ctorParameters = () => [
5067
+ { type: Router },
5068
+ { type: Injector },
5069
+ { type: InteractionContext }
5070
+ ];
5071
+ /** @nocollapse */ InteractionGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function InteractionGuard_Factory() { return new InteractionGuard(ɵɵinject(Router), ɵɵinject(INJECTOR), ɵɵinject(InteractionContext)); }, token: InteractionGuard, providedIn: "root" });
5072
+ __decorate([
5073
+ Trace(),
5074
+ __metadata("design:type", Function),
5075
+ __metadata("design:paramtypes", [ActivatedRouteSnapshot, RouterStateSnapshot]),
5076
+ __metadata("design:returntype", Object)
5077
+ ], InteractionGuard.prototype, "canActivate", null);
5078
+ __decorate([
5079
+ Trace(),
5080
+ __metadata("design:type", Function),
5081
+ __metadata("design:paramtypes", [NoopComponent, ActivatedRouteSnapshot, RouterStateSnapshot, RouterStateSnapshot]),
5082
+ __metadata("design:returntype", Object)
5083
+ ], InteractionGuard.prototype, "canDeactivate", null);
5084
+ if (false) {
5085
+ /**
5086
+ * @type {?}
5087
+ * @private
5088
+ */
5089
+ InteractionGuard.prototype.router;
5090
+ /**
5091
+ * @type {?}
5092
+ * @private
5093
+ */
5094
+ InteractionGuard.prototype.injector;
5095
+ /**
5096
+ * @type {?}
5097
+ * @private
5098
+ */
5099
+ InteractionGuard.prototype.interactionContext;
5026
5100
  }
5027
5101
 
5102
+ /**
5103
+ * @fileoverview added by tsickle
5104
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5105
+ */
5106
+
5028
5107
  /**
5029
5108
  * @fileoverview added by tsickle
5030
5109
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5031
5110
  */
5032
5111
  /**
5033
5112
  * @record
5034
- * @template T
5035
5113
  */
5036
- function ParameterSnapshot() { }
5114
+ function NavItem() { }
5037
5115
  if (false) {
5038
- /** @type {?} */
5039
- ParameterSnapshot.prototype.definition;
5040
- /** @type {?} */
5041
- ParameterSnapshot.prototype.value;
5042
5116
  /**
5043
5117
  * @return {?}
5044
5118
  */
5045
- ParameterSnapshot.prototype.isMissing = function () { };
5119
+ NavItem.prototype.title = function () { };
5120
+ /**
5121
+ * @return {?}
5122
+ */
5123
+ NavItem.prototype.icon = function () { };
5124
+ /**
5125
+ * @return {?}
5126
+ */
5127
+ NavItem.prototype.tooltip = function () { };
5046
5128
  }
5047
5129
 
5048
5130
  /**
@@ -5136,7 +5218,10 @@ if (false) {
5136
5218
  * @fileoverview added by tsickle
5137
5219
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5138
5220
  */
5139
- class EnterPlaceGuard {
5221
+ /**
5222
+ * @abstract
5223
+ */
5224
+ class AbstractEnterPlaceGuard {
5140
5225
  /**
5141
5226
  * @param {?} router
5142
5227
  * @param {?} urlSerializer
@@ -5158,85 +5243,137 @@ class EnterPlaceGuard {
5158
5243
  * @return {?}
5159
5244
  */
5160
5245
  canActivate(activatedRoute, state) {
5246
+ return __awaiter(this, void 0, void 0, function* () {
5247
+ return this.interceptInitialRouteOtherwise(activatedRoute, state, (/**
5248
+ * @return {?}
5249
+ */
5250
+ () => {
5251
+ return this.authorisePlaceThen(activatedRoute, state, (/**
5252
+ * @param {?} placeDefinition
5253
+ * @return {?}
5254
+ */
5255
+ (placeDefinition) => __awaiter(this, void 0, void 0, function* () {
5256
+ // Parse our route params.
5257
+ /** @type {?} */
5258
+ const params = new AbstractEnterPlaceGuard.ConsolidatedParameterMap(activatedRoute.paramMap, activatedRoute.url);
5259
+ /** @type {?} */
5260
+ const parsedParams = placeDefinition.parseRouteParams(params);
5261
+ /** @type {?} */
5262
+ const initialVisit = this.placeRouter.navigationSession.getVisitFor(placeDefinition) || new Visit(placeDefinition, parsedParams);
5263
+ /** @type {?} */
5264
+ const sanitiser = new VisitSanitiser(activatedRoute, this.router, this.placeHistory, this.injector);
5265
+ /** @type {?} */
5266
+ const sanitisedVisit = yield sanitiser.sanitise(initialVisit.mergeRouteParameters(parsedParams));
5267
+ // Save the visit with any updated parameters. We need to save it so we remember any non route parameters
5268
+ this.placeRouter.navigationSession.storeVisit(sanitisedVisit);
5269
+ if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {
5270
+ // Regenerate the url
5271
+ /** @type {?} */
5272
+ const commands = this.placeRouter.parseUrl(state).createRedirectCommandsFor(sanitisedVisit);
5273
+ console.log('##### Place Guard Redirect', commands);
5274
+ return this.router.createUrlTree(commands, {
5275
+ replaceUrl: true,
5276
+ skipLocationChange: false
5277
+ });
5278
+ }
5279
+ else {
5280
+ return true;
5281
+ }
5282
+ })));
5283
+ }));
5284
+ });
5285
+ }
5286
+ /**
5287
+ * @protected
5288
+ * @param {?} activatedRoute
5289
+ * @param {?} state
5290
+ * @param {?} canActivate
5291
+ * @return {?}
5292
+ */
5293
+ authorisePlaceThen(activatedRoute, state, canActivate) {
5161
5294
  return __awaiter(this, void 0, void 0, function* () {
5162
5295
  if (PlaceComponent.isPlaceComponentConstructor(activatedRoute.component)) {
5163
5296
  /** @type {?} */
5164
5297
  const placeDefinition = PlaceComponent.getDefinition(activatedRoute.component);
5165
- // Parse our route params.
5166
- /** @type {?} */
5167
- const params = new EnterPlaceGuard.ConsolidatedParameterMap(activatedRoute.paramMap, activatedRoute.url);
5168
- /** @type {?} */
5169
- const parsedParams = placeDefinition.parseRouteParams(params);
5170
- /** @type {?} */
5171
- const initialVisit = this.placeRouter.navigationSession.getVisitFor(placeDefinition) || new Visit(placeDefinition, parsedParams);
5172
5298
  /** @type {?} */
5173
- const sanitiser = new VisitSanitiser(activatedRoute, this.router, this.placeHistory, this.injector);
5174
- /** @type {?} */
5175
- const sanitisedVisit = yield sanitiser.sanitise(initialVisit.mergeRouteParameters(parsedParams));
5176
- // Save the visit with any updated parameters. We need to save it so we remember any non route parameters
5177
- this.placeRouter.navigationSession.storeVisit(sanitisedVisit);
5178
- if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {
5179
- // Regenerate the url
5180
- /** @type {?} */
5181
- const commands = this.placeRouter.parseUrl(state).createRedirectCommandsFor(sanitisedVisit);
5182
- console.log('##### Place Guard Redirect', commands);
5183
- return this.router.createUrlTree(commands, {
5184
- replaceUrl: true,
5185
- skipLocationChange: false
5186
- });
5187
- }
5188
- else {
5189
- return true;
5190
- }
5299
+ const authorised = placeDefinition.authenticate ? yield this.isAuthorised(activatedRoute, state) : true;
5300
+ return authorised === true ? canActivate(placeDefinition) : authorised;
5191
5301
  }
5192
5302
  else {
5193
5303
  return lang.illegalState(`expected component to be an instance of PlaceComponent, got ${activatedRoute.component}`);
5194
5304
  }
5195
5305
  });
5196
5306
  }
5307
+ /**
5308
+ * @protected
5309
+ * @param {?} activatedRoute
5310
+ * @param {?} state
5311
+ * @param {?} canActivate
5312
+ * @return {?}
5313
+ */
5314
+ interceptInitialRouteOtherwise(activatedRoute, state, canActivate) {
5315
+ return __awaiter(this, void 0, void 0, function* () {
5316
+ // TODO: this all only sort of works. Opening dialogs and clicking back multiple times breaks things.
5317
+ // TODO: next stage is to investigate tracking dialog state in a different placeoutlet and keeping those
5318
+ // TODO: urls out of the history.
5319
+ if (this.placeRouter.isInitialNavigation()) {
5320
+ // This is the very first entry into our app so we redirect to a dummy place so we can get bump our
5321
+ // history by one. This ensures that we can capture back button presses on the initial page without
5322
+ // leaving our app.
5323
+ return this.placeRouter.performInitialNavigationIntercept(activatedRoute, state);
5324
+ }
5325
+ else {
5326
+ return canActivate();
5327
+ }
5328
+ });
5329
+ }
5330
+ /**
5331
+ * @param {?} activatedRoute
5332
+ * @param {?} state
5333
+ * @return {?}
5334
+ */
5335
+ isAuthorised(activatedRoute, state) {
5336
+ return __awaiter(this, void 0, void 0, function* () {
5337
+ /** @type {?} */
5338
+ const authorised = this.getAuthGuard(this.injector).canActivate(activatedRoute, state);
5339
+ return (authorised instanceof Observable) ? authorised.toPromise() : authorised;
5340
+ });
5341
+ }
5197
5342
  }
5198
- EnterPlaceGuard.decorators = [
5199
- { type: Injectable, args: [{
5200
- providedIn: 'root'
5201
- },] }
5202
- ];
5203
- /** @nocollapse */
5204
- EnterPlaceGuard.ctorParameters = () => [
5205
- { type: Router },
5206
- { type: UrlSerializer },
5207
- { type: PlaceRouter },
5208
- { type: PlaceHistory },
5209
- { type: Injector }
5210
- ];
5211
- /** @nocollapse */ EnterPlaceGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function EnterPlaceGuard_Factory() { return new EnterPlaceGuard(ɵɵinject(Router), ɵɵinject(UrlSerializer), ɵɵinject(PlaceRouter), ɵɵinject(PlaceHistory), ɵɵinject(INJECTOR)); }, token: EnterPlaceGuard, providedIn: "root" });
5212
5343
  if (false) {
5213
5344
  /**
5214
5345
  * @type {?}
5215
5346
  * @private
5216
5347
  */
5217
- EnterPlaceGuard.prototype.router;
5348
+ AbstractEnterPlaceGuard.prototype.router;
5218
5349
  /**
5219
5350
  * @type {?}
5220
5351
  * @private
5221
5352
  */
5222
- EnterPlaceGuard.prototype.urlSerializer;
5353
+ AbstractEnterPlaceGuard.prototype.urlSerializer;
5223
5354
  /**
5224
5355
  * @type {?}
5225
5356
  * @private
5226
5357
  */
5227
- EnterPlaceGuard.prototype.placeRouter;
5358
+ AbstractEnterPlaceGuard.prototype.placeRouter;
5228
5359
  /**
5229
5360
  * @type {?}
5230
5361
  * @private
5231
5362
  */
5232
- EnterPlaceGuard.prototype.placeHistory;
5363
+ AbstractEnterPlaceGuard.prototype.placeHistory;
5233
5364
  /**
5234
5365
  * @type {?}
5235
5366
  * @private
5236
5367
  */
5237
- EnterPlaceGuard.prototype.injector;
5368
+ AbstractEnterPlaceGuard.prototype.injector;
5369
+ /**
5370
+ * @abstract
5371
+ * @param {?} injector
5372
+ * @return {?}
5373
+ */
5374
+ AbstractEnterPlaceGuard.prototype.getAuthGuard = function (injector) { };
5238
5375
  }
5239
- (function (EnterPlaceGuard) {
5376
+ (function (AbstractEnterPlaceGuard) {
5240
5377
  /**
5241
5378
  * This a work around for the fact that an activated route with multiple segments doesn't
5242
5379
  * include the segment params in the paramMap as well as each segment returns an empty
@@ -5312,7 +5449,7 @@ if (false) {
5312
5449
  __metadata("design:type", Array),
5313
5450
  __metadata("design:paramtypes", [])
5314
5451
  ], ConsolidatedParameterMap.prototype, "keys", null);
5315
- EnterPlaceGuard.ConsolidatedParameterMap = ConsolidatedParameterMap;
5452
+ AbstractEnterPlaceGuard.ConsolidatedParameterMap = ConsolidatedParameterMap;
5316
5453
  if (false) {
5317
5454
  /**
5318
5455
  * @type {?}
@@ -5364,7 +5501,7 @@ if (false) {
5364
5501
  */
5365
5502
  ParamMapAdapter.prototype.params;
5366
5503
  }
5367
- })(EnterPlaceGuard || (EnterPlaceGuard = {}));
5504
+ })(AbstractEnterPlaceGuard || (AbstractEnterPlaceGuard = {}));
5368
5505
 
5369
5506
  /**
5370
5507
  * @fileoverview added by tsickle
@@ -5408,6 +5545,85 @@ if (false) {
5408
5545
  LeavePlaceGuard.prototype.placeRouter;
5409
5546
  }
5410
5547
 
5548
+ /**
5549
+ * @fileoverview added by tsickle
5550
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5551
+ */
5552
+ class NoopAuthGuard {
5553
+ constructor() {
5554
+ }
5555
+ /**
5556
+ * @param {?} activatedRoute
5557
+ * @param {?} state
5558
+ * @return {?}
5559
+ */
5560
+ canActivate(activatedRoute, state) {
5561
+ return __awaiter(this, void 0, void 0, function* () {
5562
+ return true;
5563
+ });
5564
+ }
5565
+ }
5566
+ NoopAuthGuard.decorators = [
5567
+ { type: Injectable, args: [{
5568
+ providedIn: 'root'
5569
+ },] }
5570
+ ];
5571
+ /** @nocollapse */
5572
+ NoopAuthGuard.ctorParameters = () => [];
5573
+ /** @nocollapse */ NoopAuthGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function NoopAuthGuard_Factory() { return new NoopAuthGuard(); }, token: NoopAuthGuard, providedIn: "root" });
5574
+
5575
+ /**
5576
+ * @fileoverview added by tsickle
5577
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5578
+ */
5579
+ /**
5580
+ * @record
5581
+ */
5582
+ function JsonArray() { }
5583
+ /**
5584
+ * @record
5585
+ */
5586
+ function JsonMap() { }
5587
+
5588
+ /**
5589
+ * @fileoverview added by tsickle
5590
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5591
+ */
5592
+ /**
5593
+ * @record
5594
+ * @template S
5595
+ */
5596
+ function ParameterSanitiser() { }
5597
+ if (false) {
5598
+ /**
5599
+ * @param {?} parameterValue
5600
+ * @param {?=} visit
5601
+ * @param {?=} injector
5602
+ * @return {?}
5603
+ */
5604
+ ParameterSanitiser.prototype.sanitise = function (parameterValue, visit, injector) { };
5605
+ }
5606
+
5607
+ /**
5608
+ * @fileoverview added by tsickle
5609
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5610
+ */
5611
+ /**
5612
+ * @record
5613
+ * @template T
5614
+ */
5615
+ function ParameterSnapshot() { }
5616
+ if (false) {
5617
+ /** @type {?} */
5618
+ ParameterSnapshot.prototype.definition;
5619
+ /** @type {?} */
5620
+ ParameterSnapshot.prototype.value;
5621
+ /**
5622
+ * @return {?}
5623
+ */
5624
+ ParameterSnapshot.prototype.isMissing = function () { };
5625
+ }
5626
+
5411
5627
  /**
5412
5628
  * @fileoverview added by tsickle
5413
5629
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
@@ -5428,5 +5644,5 @@ if (false) {
5428
5644
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5429
5645
  */
5430
5646
 
5431
- export { ACTIVITY_DATA, AUP_PLACE_CONFIG, AbstractActivity, AbstractInputComponent, AbstractPlaceNavigationComponent, Activity, ActivityContainerComponent, ActivityOutletComponent, AlertDialogComponent, AngularUiPowerupsModule, Bounds, BusyOverlayComponent, CommandDirective, ComponentsModule, ConfirmThenDialogComponent, ConfirmationDialogComponent, DEFINITION_META_DATA_KEY, DIALOG_INTERACTION_SERVICE_DEFAULTS, DialogInteractionService, Dimension, DirectivesModule, DisposableComponent, EmptyStateComponent, EnterPlaceGuard, FocusBindingDirective, Formatter, InplaceInteractionContextComponent, InteractionContext, InteractionGuard, InteractionModule, InteractionOutletComponent, LEFT_RIGHT_PLACE_ANIMATION, LeavePlaceGuard, ListPlaceNavComponent, NavigationSession, NoopComponent, NumberInputComponent, ParameterDefinition, PasswordInputComponent, Place, PlaceComponent, PlaceDefinition, PlaceHistory, PlaceModule, PlaceOutletComponent, PlaceRouter, Point, ROUTE_PARAMETER_LIST_KEY, ResizeAwareComponent, RouteId, SelectInputComponent, StringInputComponent, TabbedPlaceNavigationComponent, Visit, VisitParameter, VisitParameterList, VisitSanitiser, leftRightPlaceAnimation, slideDownAndUpAnimation, DirectivesModule as ɵa, CommandDirective as ɵb, ActivityContainerComponent as ɵba, ActivityOutletComponent as ɵbb, ConfirmationDialogComponent as ɵbc, AbstractActivity as ɵbd, ACTIVITY_DATA as ɵbe, Activity as ɵbf, ConfirmThenDialogComponent as ɵbh, AlertDialogComponent as ɵbi, InteractionOutletComponent as ɵbk, InplaceInteractionContextComponent as ɵbl, DIALOG_INTERACTION_SERVICE_DEFAULTS as ɵbm, DialogInteractionService as ɵbn, FocusBindingDirective as ɵc, DisposableComponent as ɵd, ComponentsModule as ɵe, NumberInputComponent as ɵf, AbstractInputComponent as ɵg, StringInputComponent as ɵh, PasswordInputComponent as ɵi, SelectInputComponent as ɵj, NoopComponent as ɵk, PlaceModule as ɵl, EmptyStateComponent as ɵm, BusyOverlayComponent as ɵn, PlaceOutletComponent as ɵo, leftRightPlaceAnimation as ɵp, LEFT_RIGHT_PLACE_ANIMATION as ɵq, AUP_PLACE_CONFIG as ɵr, PlaceRouter as ɵt, InteractionContext as ɵu, PlaceHistory as ɵv, TabbedPlaceNavigationComponent as ɵw, AbstractPlaceNavigationComponent as ɵx, ListPlaceNavComponent as ɵy, InteractionModule as ɵz };
5647
+ export { ACTIVITY_DATA, AUP_PLACE_CONFIG, AbstractActivity, AbstractEnterPlaceGuard, AbstractInputComponent, AbstractPlaceNavigationComponent, Activity, ActivityContainerComponent, ActivityOutletComponent, AlertDialogComponent, AngularUiPowerupsModule, Bounds, BusyOverlayComponent, CommandDirective, ComponentsModule, ConfirmThenDialogComponent, ConfirmationDialogComponent, DEFINITION_META_DATA_KEY, DIALOG_INTERACTION_SERVICE_DEFAULTS, DialogInteractionService, Dimension, DirectivesModule, DisposableComponent, EmptyStateComponent, FocusBindingDirective, Formatter, InplaceInteractionContextComponent, InteractionContext, InteractionGuard, InteractionModule, InteractionOutletComponent, LEFT_RIGHT_PLACE_ANIMATION, LeavePlaceGuard, ListPlaceNavComponent, NavigationSession, NoopAuthGuard, NoopComponent, NoopGatewayPlace, NumberInputComponent, ParameterDefinition, PasswordInputComponent, Place, PlaceComponent, PlaceDefinition, PlaceHistory, PlaceModule, PlaceOutletComponent, PlaceRouter, Point, ROUTE_PARAMETER_LIST_KEY, ResizeAwareComponent, RouteId, SelectInputComponent, StringInputComponent, TabbedPlaceNavigationComponent, Visit, VisitParameter, VisitParameterList, VisitSanitiser, leftRightPlaceAnimation, slideDownAndUpAnimation, DirectivesModule as ɵa, CommandDirective as ɵb, PlaceComponent as ɵba, Place as ɵbb, VisitParameter as ɵbc, Formatter as ɵbd, InteractionModule as ɵbe, ActivityContainerComponent as ɵbf, ActivityOutletComponent as ɵbg, ConfirmationDialogComponent as ɵbh, AbstractActivity as ɵbi, ACTIVITY_DATA as ɵbj, Activity as ɵbk, ConfirmThenDialogComponent as ɵbm, AlertDialogComponent as ɵbn, InteractionOutletComponent as ɵbp, InplaceInteractionContextComponent as ɵbq, DIALOG_INTERACTION_SERVICE_DEFAULTS as ɵbr, DialogInteractionService as ɵbs, FocusBindingDirective as ɵc, DisposableComponent as ɵd, ComponentsModule as ɵe, NumberInputComponent as ɵf, AbstractInputComponent as ɵg, StringInputComponent as ɵh, PasswordInputComponent as ɵi, SelectInputComponent as ɵj, NoopComponent as ɵk, PlaceModule as ɵl, EmptyStateComponent as ɵm, BusyOverlayComponent as ɵn, PlaceOutletComponent as ɵo, leftRightPlaceAnimation as ɵp, LEFT_RIGHT_PLACE_ANIMATION as ɵq, AUP_PLACE_CONFIG as ɵr, PlaceRouter as ɵt, InteractionContext as ɵu, PlaceHistory as ɵv, TabbedPlaceNavigationComponent as ɵw, AbstractPlaceNavigationComponent as ɵx, ListPlaceNavComponent as ɵy, NoopGatewayPlace as ɵz };
5432
5648
  //# sourceMappingURL=coolon-angular-ui-powerups.js.map