@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
@@ -5,7 +5,7 @@ import { MatInputModule, MatFormFieldModule, MatSelectModule, MatDialog, MatButt
5
5
  import { MatTabsModule } from '@angular/material/tabs';
6
6
  import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
7
7
  import { __extends, __decorate, __metadata, __awaiter, __generator, __assign, __spread } from 'tslib';
8
- import { DelegatingValueModel, assert, UnaryCommand, lang, Dsl, GarbageCollector, Logger, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, DelegatingListModel, Deferred, MutableStream, MutableListModel, MutableValueModel, Binding, Trace, Guard as Guard$1, Command, StoreInValueModel, OptionsHelper, ValueHolder } from '@coolon/pectin';
8
+ import { DelegatingValueModel, assert, UnaryCommand, lang, Dsl, GarbageCollector, Logger, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, DelegatingListModel, Deferred, MutableStream, MutableListModel, MutableValueModel, Binding, Trace, Guard as Guard$1, StoreInValueModel, Command, OptionsHelper, ValueHolder } from '@coolon/pectin';
9
9
  import { PortalModule } from '@angular/cdk/portal';
10
10
  import { Router, RouterModule, NavigationStart, NavigationEnd, NavigationError, UrlSerializer, UrlSegment, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
11
11
  import ___default, { last, isNil, isEqual } from 'lodash';
@@ -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
@@ -2344,7 +2345,7 @@ var DialogInteractionService = /** @class */ (function (_super) {
2344
2345
  * @return {?}
2345
2346
  */
2346
2347
  function () {
2347
- console.log('###### STARTING');
2348
+ // console.log('###### STARTING');
2348
2349
  _this._inActivityPromise.value = true;
2349
2350
  // this.currentActivityId = uuid.v1();
2350
2351
  // this.location.go(this.router.routerState.snapshot.url, "aup");
@@ -2405,7 +2406,7 @@ var DialogInteractionService = /** @class */ (function (_super) {
2405
2406
  */
2406
2407
  function () {
2407
2408
  _this._inActivityPromise.value = false;
2408
- console.log('###### FINISHED');
2409
+ // console.log('###### FINISHED');
2409
2410
  // this.currentActivityId = null;
2410
2411
  self.safelyUpdateActivityListDelegate(null);
2411
2412
  }));
@@ -3957,1993 +3958,2070 @@ if (false) {
3957
3958
  * @fileoverview added by tsickle
3958
3959
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3959
3960
  */
3960
- var PlaceRouter = /** @class */ (function (_super) {
3961
- __extends(PlaceRouter, _super);
3962
- function PlaceRouter(router, urlSerializer, interactionContext, angularLocation, placeHistory) {
3963
- var _this = _super.call(this) || this;
3964
- _this.router = router;
3965
- _this.urlSerializer = urlSerializer;
3966
- _this.interactionContext = interactionContext;
3967
- _this.angularLocation = angularLocation;
3968
- _this.placeHistory = placeHistory;
3969
- _this.firstRoute = true;
3970
- _this._navigationSessionModel = new MutableValueModel();
3971
- _this._activeVisits = new MutableListModel();
3972
- var _a = Dsl.disposeWith(_this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
3973
- _this.activeVisitIndex = chain(_this._activeVisits).indexBy('placeDefinition');
3974
- _this.navigationSessionFactory = new NavigationSession.Factory(interactionContext);
3975
- angularLocation.onUrlChange((/**
3976
- * @param {?} url
3977
- * @return {?}
3978
- */
3979
- function (url) {
3980
- console.log("location.onUrlChange -> " + url);
3981
- }));
3982
- // TODO: make setup the callbacks in during module initiation to make this testable.
3983
- _this.router.events.subscribe((/**
3984
- * @param {?} event
3985
- * @return {?}
3986
- */
3987
- function (event) {
3988
- // Routing event sequence
3989
- // ======================
3990
- // NavigationStart -> .... -> NavigationCancel --> redirect, go around again in the same session
3991
- // NavigationStart -> .... -> NavigationEnd --> navigation complete, end session.
3992
- // NavigationStart -> .... -> NavigationError --> navigation canceled, end session.
3993
- // =======================
3994
- if (event instanceof NavigationStart) {
3995
- _this.onAngularRouterStarted(event);
3996
- }
3997
- if (event instanceof NavigationEnd) {
3998
- _this.onAngularRouterFinished(false);
3999
- }
4000
- if (event instanceof NavigationError) {
4001
- _this.onAngularRouterFinished(true);
4002
- }
4003
- }));
4004
- _this.navigationSessionActive = chain(_this.navigationSessionModel).isNotNil();
4005
- _this.navigationSessionActive.subscribe((/**
4006
- * @param {?} active
4007
- * @return {?}
4008
- */
4009
- function (active) {
4010
- console.log('navigationSessionActive', active);
4011
- }));
4012
- return _this;
4013
- // const txo = new TransactionObserver().onEvent(e => console.log(e.toString()));
4014
- // txo.observe('this.navigationSessionModel', this.navigationSessionModel);
4015
- }
4016
- Object.defineProperty(PlaceRouter.prototype, "navigationSession", {
4017
- get: /**
4018
- * @return {?}
4019
- */
4020
- function () {
4021
- return this._navigationSessionModel.value;
4022
- },
4023
- enumerable: true,
4024
- configurable: true
4025
- });
4026
- Object.defineProperty(PlaceRouter.prototype, "navigationSessionModel", {
4027
- get: /**
4028
- * @return {?}
4029
- */
4030
- function () {
4031
- return this._navigationSessionModel.readonly;
4032
- },
4033
- enumerable: true,
4034
- configurable: true
4035
- });
4036
- Object.defineProperty(PlaceRouter.prototype, "activeVisits", {
4037
- get: /**
4038
- * @return {?}
4039
- */
4040
- function () {
4041
- return this._activeVisits.readonly;
4042
- },
4043
- enumerable: true,
4044
- configurable: true
4045
- });
4046
- /**
4047
- * placeRouter.navigate(placeDestinations.somePlace.createVisit(routeId, ...visitParams));
4048
- * @param visit
4049
- */
4050
- /**
4051
- * placeRouter.navigate(placeDestinations.somePlace.createVisit(routeId, ...visitParams));
4052
- * @param {?} visit
4053
- * @param {?=} options
4054
- * @return {?}
4055
- */
4056
- PlaceRouter.prototype.navigate = /**
4057
- * placeRouter.navigate(placeDestinations.somePlace.createVisit(routeId, ...visitParams));
4058
- * @param {?} visit
4059
- * @param {?=} options
4060
- * @return {?}
4061
- */
4062
- function (visit, options) {
4063
- return __awaiter(this, void 0, void 0, function () {
4064
- var _this = this;
4065
- return __generator(this, function (_a) {
4066
- this.doNavigation(visit, (/**
4067
- * @param {?} router
4068
- * @return {?}
4069
- */
4070
- function (router) { return __awaiter(_this, void 0, void 0, function () {
4071
- var commands;
4072
- return __generator(this, function (_a) {
4073
- switch (_a.label) {
4074
- case 0:
4075
- commands = __spread([
4076
- visit.placeDefinition.path
4077
- ], this.createRouteParameters(visit));
4078
- return [4 /*yield*/, this.router.navigate(commands, {
4079
- relativeTo: options ? options.relativeTo : null
4080
- })];
4081
- case 1:
4082
- _a.sent();
4083
- return [2 /*return*/];
4084
- }
4085
- });
4086
- }); }));
4087
- return [2 /*return*/];
4088
- });
4089
- });
4090
- };
4091
- // @Trace()
4092
- // @Trace()
4093
- /**
4094
- * @param {?} activatedRoute
4095
- * @param {?} previous
4096
- * @param {?} next
4097
- * @return {?}
4098
- */
4099
- PlaceRouter.prototype.pushVisitChangesToRoute =
4100
- // @Trace()
4101
- /**
4102
- * @param {?} activatedRoute
4103
- * @param {?} previous
4104
- * @param {?} next
4105
- * @return {?}
4106
- */
4107
- function (activatedRoute, previous, next) {
4108
- return __awaiter(this, void 0, void 0, function () {
4109
- var _this = this;
4110
- return __generator(this, function (_a) {
4111
- // we have to push to history so our remember sanitisers don't pick up the previous value
4112
- // when it's been cleared by the user.
4113
- this.placeHistory.add(next);
4114
- // FIXME: no route id -> route id duplicates route parameters
4115
- if (next.hasRoutingChangedFrom(previous)) {
4116
- return [2 /*return*/, this.doNavigation(next, (/**
4117
- * @param {?} router
4118
- * @return {?}
4119
- */
4120
- function (router) {
4121
- /** @type {?} */
4122
- var commands = _this.parseUrl(_this.router.routerState.snapshot).createRedirectCommandsFor(next);
4123
- // // we have to to use the definition for route id as our redirection always includes
4124
- // // the id in the url segements (but leaves it blank when there's no id). I.e. in the
4125
- // // no id case we're doing the following redirect [<placePath>, ""] -> ["..", <id>]
4126
- // const relativePath = !!previous.placeDefinition.hasRouteId() ? '..' : '.';
4127
- // const commands = [
4128
- // relativePath,
4129
- // ...this.createRouteParameters(next),
4130
- // ...this.extractChildPath(activatedRoute.snapshot)
4131
- // ];
4132
- console.log('### Push Changes to route Redirect', { commands: commands });
4133
- return router.navigate(commands);
4134
- }))];
4135
- }
4136
- return [2 /*return*/];
4137
- });
4138
- });
4139
- };
4140
- /**
4141
- * @param {?} visit
4142
- * @param {?} customNavigation
4143
- * @return {?}
4144
- */
4145
- PlaceRouter.prototype.doNavigation = /**
4146
- * @param {?} visit
4147
- * @param {?} customNavigation
4148
- * @return {?}
4149
- */
4150
- function (visit, customNavigation) {
4151
- return __awaiter(this, void 0, void 0, function () {
4152
- return __generator(this, function (_a) {
4153
- switch (_a.label) {
4154
- case 0:
4155
- this._navigationSessionModel.value = this.navigationSessionFactory.createInternal(visit);
4156
- _a.label = 1;
4157
- case 1:
4158
- _a.trys.push([1, , 3, 4]);
4159
- return [4 /*yield*/, customNavigation(this.router)];
4160
- case 2:
4161
- _a.sent();
4162
- return [3 /*break*/, 4];
4163
- case 3:
4164
- // Router has finished (since there was no router change required) so we
4165
- // need to end the navigation session.
4166
- if (this.navigationSession && !this.router.getCurrentNavigation()) {
4167
- this.onAngularRouterFinished(false);
4168
- }
4169
- return [7 /*endfinally*/];
4170
- case 4: return [2 /*return*/];
4171
- }
4172
- });
4173
- });
4174
- };
4175
- /**
4176
- * @private
4177
- * @param {?} visit
4178
- * @return {?}
4179
- */
4180
- PlaceRouter.prototype.createRouteParameters = /**
4181
- * @private
4182
- * @param {?} visit
4183
- * @return {?}
4184
- */
4185
- function (visit) {
4186
- /** @type {?} */
4187
- var def = visit.placeDefinition;
4188
- return visit.hasRouteId() ?
4189
- [def.getFormattedRouteId(visit), def.getFormattedRouteParameters(visit)] :
4190
- [def.getFormattedRouteParameters(visit)];
4191
- };
4192
- // @Trace()
4193
- // @Trace()
4194
- /**
4195
- * @private
4196
- * @param {?} event
4197
- * @return {?}
4198
- */
4199
- PlaceRouter.prototype.onAngularRouterStarted =
4200
- // @Trace()
4201
- /**
4202
- * @private
4203
- * @param {?} event
4204
- * @return {?}
4205
- */
4206
- function (event) {
4207
- if (!this.navigationSession) { // We been activated by an external route rather than placeRouter.go(visit)
4208
- console.log('navigation started', { firstTime: this.firstRoute });
4209
- /** @type {?} */
4210
- var session = this.navigationSessionFactory.createExternal(this.firstRoute);
4211
- if (event.navigationTrigger === 'popstate') {
4212
- session.setPopstateReturnUrl(this.router.routerState.snapshot.url);
4213
- }
4214
- this._navigationSessionModel.value = session;
4215
- }
4216
- this.firstRoute = false;
4217
- };
4218
- // @Trace()
4219
- // @Trace()
4220
- /**
4221
- * @private
4222
- * @param {?} cancelled
4223
- * @return {?}
4224
- */
4225
- PlaceRouter.prototype.onAngularRouterFinished =
4226
- // @Trace()
4227
- /**
4228
- * @private
4229
- * @param {?} cancelled
3961
+ /**
3962
+ * @param {?} options
3963
+ * @return {?}
3964
+ */
3965
+ function Place(options) {
3966
+ return (/**
3967
+ * @param {?} target
4230
3968
  * @return {?}
4231
3969
  */
4232
- function (cancelled) {
4233
- var _this = this;
4234
- /** @type {?} */
4235
- var session = this._navigationSessionModel.value;
4236
- if (!cancelled) {
4237
- // Update visits before we end the navigation session. This allows the placeOutets to
4238
- // ignore visit changes that occur while the navigation is in progress
4239
- /** @type {?} */
4240
- var visits = session.getVisits();
4241
- visits.forEach((/**
4242
- * @param {?} v
3970
+ function (target) {
3971
+ if (PlaceComponent.isPlaceComponentConstructor(target)) {
3972
+ PlaceComponent.injectDefinition(target, new PlaceDefinition(target, options.path, isNil(options.authenticate) ? false : options.authenticate, options.data, PlaceComponent.getRouteParameters(target), (options.children || []).map((/**
3973
+ * @param {?} c
4243
3974
  * @return {?}
4244
3975
  */
4245
- function (v) { return _this.placeHistory.add(v); }));
4246
- this._activeVisits.value = visits;
3976
+ function (c) { return PlaceComponent.getDefinition(c); }))));
4247
3977
  }
4248
3978
  else {
4249
- // Angular doesn't preserve the url when a guard cancels the back button.
4250
- // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
4251
- if (session.isPopState) {
4252
- console.log('cancelled during popstate');
4253
- this.angularLocation.go(session.popStateReturnUrl);
4254
- }
3979
+ lang.illegalState(target + " must extend PlaceComponent to use the @Place decorator");
4255
3980
  }
4256
- this._navigationSessionModel.value = null;
4257
- };
4258
- /**
4259
- * @param {?} activatedRoute
4260
- * @return {?}
4261
- */
4262
- PlaceRouter.prototype.extractChildPath = /**
4263
- * @param {?} activatedRoute
4264
- * @return {?}
4265
- */
4266
- function (activatedRoute) {
4267
- return ___default.flatten(activatedRoute.children.map((/**
4268
- * @param {?} child
4269
- * @return {?}
4270
- */
4271
- function (child) { return child.url; })));
4272
- };
4273
- /**
4274
- * @param {?} snapshot
4275
- * @return {?}
4276
- */
4277
- PlaceRouter.prototype.parseUrl = /**
4278
- * @param {?} snapshot
4279
- * @return {?}
4280
- */
4281
- function (snapshot) {
4282
- return new PlaceRouter.UrlHelper(this.urlSerializer.parse(snapshot.url));
4283
- };
4284
- PlaceRouter.decorators = [
4285
- { type: Injectable, args: [{
4286
- providedIn: 'root'
4287
- },] }
4288
- ];
4289
- /** @nocollapse */
4290
- PlaceRouter.ctorParameters = function () { return [
4291
- { type: Router },
4292
- { type: UrlSerializer },
4293
- { type: InteractionContext },
4294
- { type: Location },
4295
- { type: PlaceHistory }
4296
- ]; };
4297
- /** @nocollapse */ PlaceRouter.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(ɵɵinject(Router), ɵɵinject(UrlSerializer), ɵɵinject(InteractionContext), ɵɵinject(Location), ɵɵinject(PlaceHistory)); }, token: PlaceRouter, providedIn: "root" });
4298
- __decorate([
4299
- Trace(),
4300
- __metadata("design:type", Function),
4301
- __metadata("design:paramtypes", [Visit, Object]),
4302
- __metadata("design:returntype", Promise)
4303
- ], PlaceRouter.prototype, "navigate", null);
4304
- return PlaceRouter;
4305
- }(GarbageCollector));
4306
- if (false) {
4307
- /**
4308
- * @type {?}
4309
- * @private
4310
- */
4311
- PlaceRouter.prototype.firstRoute;
4312
- /**
4313
- * @type {?}
4314
- * @private
4315
- */
4316
- PlaceRouter.prototype._navigationSessionModel;
4317
- /**
4318
- * @type {?}
4319
- * @private
4320
- */
4321
- PlaceRouter.prototype._activeVisits;
4322
- /** @type {?} */
4323
- PlaceRouter.prototype.navigationSessionActive;
4324
- /** @type {?} */
4325
- PlaceRouter.prototype.activeVisitIndex;
4326
- /**
4327
- * @type {?}
4328
- * @private
4329
- */
4330
- PlaceRouter.prototype.navigationSessionFactory;
4331
- /**
4332
- * @type {?}
4333
- * @private
4334
- */
4335
- PlaceRouter.prototype.router;
4336
- /**
4337
- * @type {?}
4338
- * @private
4339
- */
4340
- PlaceRouter.prototype.urlSerializer;
3981
+ });
3982
+ }
3983
+ (function (Place) {
4341
3984
  /**
4342
- * @type {?}
4343
- * @private
3985
+ * @record
4344
3986
  */
4345
- PlaceRouter.prototype.interactionContext;
4346
- /** @type {?} */
4347
- PlaceRouter.prototype.angularLocation;
4348
- /** @type {?} */
4349
- PlaceRouter.prototype.placeHistory;
4350
- }
4351
- (function (PlaceRouter) {
4352
- var UrlHelper = /** @class */ (function () {
4353
- function UrlHelper(urlTree) {
4354
- this.urlTree = urlTree;
4355
- console.log({ segments: this.urlTree.root.children.primary.segments });
3987
+ function Options() { }
3988
+ Place.Options = Options;
3989
+ if (false) {
3990
+ /** @type {?} */
3991
+ Options.prototype.path;
3992
+ /** @type {?|undefined} */
3993
+ Options.prototype.data;
3994
+ /** @type {?|undefined} */
3995
+ Options.prototype.authenticate;
3996
+ /** @type {?|undefined} */
3997
+ Options.prototype.children;
3998
+ /** @type {?|undefined} */
3999
+ Options.prototype.defaultChild;
4000
+ }
4001
+ })(Place || (Place = {}));
4002
+
4003
+ /**
4004
+ * @fileoverview added by tsickle
4005
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4006
+ */
4007
+ // WARNING: interface has both a type and a value, skipping emit
4008
+ var Formatter;
4009
+ (function (Formatter) {
4010
+ var StringType = /** @class */ (function () {
4011
+ function StringType() {
4356
4012
  }
4357
4013
  /**
4014
+ * @param {?} value
4358
4015
  * @return {?}
4359
4016
  */
4360
- UrlHelper.prototype.cloneUrlSegmentList = /**
4017
+ StringType.prototype.format = /**
4018
+ * @param {?} value
4361
4019
  * @return {?}
4362
4020
  */
4363
- function () {
4364
- return __spread(this.urlTree.root.children.primary.segments);
4021
+ function (value) {
4022
+ return value;
4365
4023
  };
4366
4024
  /**
4367
- * @param {?} visit
4025
+ * @param {?} value
4368
4026
  * @return {?}
4369
4027
  */
4370
- UrlHelper.prototype.updateVisitSegments = /**
4371
- * @param {?} visit
4028
+ StringType.prototype.parse = /**
4029
+ * @param {?} value
4372
4030
  * @return {?}
4373
4031
  */
4374
- function (visit) {
4375
- // Ugly, but it works for now.
4376
- /** @type {?} */
4377
- var segments = this.cloneUrlSegmentList();
4378
- /** @type {?} */
4379
- var visitSegments = this.convertToUrlSegments(visit);
4380
- /** @type {?} */
4381
- var replaceAt = segments.findIndex((/**
4382
- * @param {?} segment
4383
- * @return {?}
4384
- */
4385
- function (segment) { return segment.path === visitSegments[0].path; }));
4386
- // do not use the return value, it's the items that were removed!
4387
- segments.splice.apply(segments, __spread([replaceAt, visitSegments.length], visitSegments));
4388
- return segments;
4032
+ function (value) {
4033
+ return value;
4389
4034
  };
4035
+ return StringType;
4036
+ }());
4037
+ var NumberType = /** @class */ (function () {
4038
+ function NumberType() {
4039
+ }
4390
4040
  /**
4391
- * Converts the visit into segments. Please not that these segments are not e
4392
- * @param visit
4393
- */
4394
- /**
4395
- * Converts the visit into segments. Please not that these segments are not e
4396
- * @param {?} visit
4041
+ * @param {?} value
4397
4042
  * @return {?}
4398
4043
  */
4399
- UrlHelper.prototype.convertToUrlSegments = /**
4400
- * Converts the visit into segments. Please not that these segments are not e
4401
- * @param {?} visit
4044
+ NumberType.prototype.format = /**
4045
+ * @param {?} value
4402
4046
  * @return {?}
4403
4047
  */
4404
- function (visit) {
4405
- return visit.placeDefinition.hasRouteId() ?
4406
- [
4407
- // NOTE:
4408
- // It's important to attach the params to the root path and not the id. If we attach them
4409
- // to an empty id then the angular router won't match the pattern.
4410
- new UrlSegment(visit.placeDefinition.path, visit.placeDefinition.getFormattedRouteParameters(visit)),
4411
- new UrlSegment(visit.placeDefinition.getFormattedRouteId(visit), {})
4412
- ]
4413
- :
4414
- [
4415
- new UrlSegment(visit.placeDefinition.path, visit.placeDefinition.getFormattedRouteParameters(visit))
4416
- ];
4048
+ function (value) {
4049
+ return ___default.isNumber(value) && !___default.isNaN(value) ? "" + value : null;
4417
4050
  };
4418
4051
  /**
4419
- * @param {?} visit
4052
+ * @param {?} value
4420
4053
  * @return {?}
4421
4054
  */
4422
- UrlHelper.prototype.createRedirectCommandsFor = /**
4423
- * @param {?} visit
4055
+ NumberType.prototype.parse = /**
4056
+ * @param {?} value
4424
4057
  * @return {?}
4425
4058
  */
4426
- function (visit) {
4427
- /** @type {?} */
4428
- var segments = this.updateVisitSegments(visit);
4059
+ function (value) {
4429
4060
  /** @type {?} */
4430
- var commands = [];
4431
- segments.forEach((/**
4432
- * @param {?} s
4433
- * @return {?}
4434
- */
4435
- function (s) {
4436
- commands.push(s.path);
4437
- if (s.parameterMap.keys.length > 0) {
4438
- commands.push(s.parameters);
4439
- }
4440
- }));
4441
- return commands;
4061
+ var parsed = Number.parseFloat(value);
4062
+ return ___default.isNaN(parsed) ? null : parsed;
4442
4063
  };
4064
+ return NumberType;
4065
+ }());
4066
+ var BooleanType = /** @class */ (function () {
4067
+ function BooleanType() {
4068
+ }
4443
4069
  /**
4444
- * @param {?} placeDef
4070
+ * @param {?} value
4445
4071
  * @return {?}
4446
4072
  */
4447
- UrlHelper.prototype.includesPathOf = /**
4448
- * @param {?} placeDef
4073
+ BooleanType.prototype.format = /**
4074
+ * @param {?} value
4449
4075
  * @return {?}
4450
4076
  */
4451
- function (placeDef) {
4452
- return this.cloneUrlSegmentList().find((/**
4453
- * @param {?} s
4454
- * @return {?}
4455
- */
4456
- function (s) { return s.path === placeDef.path; }));
4077
+ function (value) {
4078
+ return value ? 'true' : 'false';
4457
4079
  };
4458
- __decorate([
4459
- Trace(),
4460
- __metadata("design:type", Function),
4461
- __metadata("design:paramtypes", [Visit]),
4462
- __metadata("design:returntype", Array)
4463
- ], UrlHelper.prototype, "createRedirectCommandsFor", null);
4464
- return UrlHelper;
4465
- }());
4466
- PlaceRouter.UrlHelper = UrlHelper;
4467
- if (false) {
4468
4080
  /**
4469
- * @type {?}
4470
- * @private
4081
+ * @param {?} value
4082
+ * @return {?}
4471
4083
  */
4472
- UrlHelper.prototype.urlTree;
4473
- }
4474
- })(PlaceRouter || (PlaceRouter = {}));
4084
+ BooleanType.prototype.parse = /**
4085
+ * @param {?} value
4086
+ * @return {?}
4087
+ */
4088
+ function (value) {
4089
+ return value === 'true';
4090
+ };
4091
+ return BooleanType;
4092
+ }());
4093
+ Formatter.STRING = new StringType();
4094
+ Formatter.NUMBER = new NumberType();
4095
+ Formatter.BOOLEAN = new BooleanType();
4096
+ })(Formatter || (Formatter = {}));
4475
4097
 
4476
4098
  /**
4477
4099
  * @fileoverview added by tsickle
4478
4100
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4479
4101
  */
4480
- // Freezes the state of the components at the start of the animation.
4481
- /** @type {?} */
4482
- var animationStartStyle = style({ position: 'absolute', top: '0', left: '0', bottom: '0', right: '0' });
4483
- /** @type {?} */
4484
- var left = [
4485
- query(':enter, :leave', animationStartStyle, { optional: true }),
4486
- group([
4487
- query(':enter', [
4488
- style({ transform: 'translateX(-100%)' }),
4489
- animate('{{duration}} ease-out', style({ transform: 'translateX(0%)' }))
4490
- ], {
4491
- optional: true
4492
- }),
4493
- query(':leave', [
4494
- style({ transform: 'translateX(0%)' }),
4495
- animate('{{duration}} ease-out', style({ transform: 'translateX(100%)' }))
4496
- ], {
4497
- optional: true
4498
- })
4499
- ])
4500
- ];
4501
- /** @type {?} */
4502
- var right = [
4503
- query(':enter, :leave', animationStartStyle, { optional: true }),
4504
- group([
4505
- query(':enter', [
4506
- style({ transform: 'translateX(100%)', minHeight: '1px' }),
4507
- animate('{{duration}} ease-out', style({ transform: 'translateX(0%)' }))
4508
- ], {
4509
- optional: true
4510
- }),
4511
- query(':leave', [style({ transform: 'translateX(0%)' }), animate('{{duration}} ease-out', style({
4512
- transform: 'translateX(-100%)',
4513
- minHeight: '1px'
4514
- }))], {
4515
- optional: true
4516
- })
4517
- ])
4518
- ];
4519
4102
  /**
4520
- * @param {?} duration
4521
- * @return {?}
4103
+ * @record
4104
+ * @template T
4522
4105
  */
4523
- function leftRightPlaceAnimation(duration) {
4524
- return trigger('routeAnimations', [
4525
- transition(':increment', right, { params: { duration: duration } }),
4526
- transition(':decrement', left, { params: { duration: duration } })
4527
- ]);
4106
+ function RouteIdOptions() { }
4107
+ if (false) {
4108
+ /** @type {?|undefined} */
4109
+ RouteIdOptions.prototype.as;
4110
+ /** @type {?|undefined} */
4111
+ RouteIdOptions.prototype.optional;
4112
+ /** @type {?|undefined} */
4113
+ RouteIdOptions.prototype.remember;
4114
+ /** @type {?|undefined} */
4115
+ RouteIdOptions.prototype.defaultValue;
4528
4116
  }
4529
- /** @type {?} */
4530
- var LEFT_RIGHT_PLACE_ANIMATION = leftRightPlaceAnimation('0.3s');
4531
-
4532
4117
  /**
4533
- * @fileoverview added by tsickle
4534
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4118
+ * @record
4119
+ * @template T
4535
4120
  */
4121
+ function RouteParameterOptions() { }
4122
+ if (false) {
4123
+ /** @type {?|undefined} */
4124
+ RouteParameterOptions.prototype.as;
4125
+ /** @type {?|undefined} */
4126
+ RouteParameterOptions.prototype.optional;
4127
+ /** @type {?|undefined} */
4128
+ RouteParameterOptions.prototype.remember;
4129
+ /** @type {?|undefined} */
4130
+ RouteParameterOptions.prototype.defaultValue;
4131
+ /** @type {?|undefined} */
4132
+ RouteParameterOptions.prototype.storeInUrl;
4133
+ }
4536
4134
  /**
4537
4135
  * @record
4136
+ * @template T
4538
4137
  */
4539
- function PlaceRef() { }
4138
+ function RouteListParameterOptions() { }
4540
4139
  if (false) {
4140
+ /** @type {?|undefined} */
4141
+ RouteListParameterOptions.prototype.as;
4142
+ /** @type {?|undefined} */
4143
+ RouteListParameterOptions.prototype.optional;
4144
+ /** @type {?|undefined} */
4145
+ RouteListParameterOptions.prototype.remember;
4146
+ /** @type {?|undefined} */
4147
+ RouteListParameterOptions.prototype.defaultValue;
4148
+ /** @type {?|undefined} */
4149
+ RouteListParameterOptions.prototype.storeInUrl;
4150
+ }
4151
+ /**
4152
+ * @template T
4153
+ * @param {?} type
4154
+ * @param {?=} options
4155
+ * @return {?}
4156
+ */
4157
+ function RouteId(type, options) {
4158
+ return (/**
4159
+ * @param {?} prototype
4160
+ * @param {?} propertyKey
4161
+ * @return {?}
4162
+ */
4163
+ function (prototype, propertyKey) {
4164
+ /** @type {?} */
4165
+ var param = new ParameterDefinition.RouteId(propertyKey.toString(), options, type);
4166
+ Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
4167
+ UseDelegate()(prototype, propertyKey);
4168
+ });
4169
+ }
4170
+ /**
4171
+ * @template T
4172
+ * @param {?=} options
4173
+ * @return {?}
4174
+ */
4175
+ function VisitParameter(options) {
4541
4176
  /** @type {?} */
4542
- PlaceRef.prototype.placeDefinition;
4543
- /**
4544
- * @param {?} param
4177
+ var opts = Opts.get(options);
4178
+ return (/**
4179
+ * @param {?} prototype
4180
+ * @param {?} propertyKey
4545
4181
  * @return {?}
4546
4182
  */
4547
- PlaceRef.prototype.initialiseBindings = function (param) { };
4548
- /**
4183
+ function (prototype, propertyKey) {
4184
+ /** @type {?} */
4185
+ var param = new ParameterDefinition.ValueParameter(propertyKey.toString(), options, opts.getOptional("storeInUrl", null));
4186
+ Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
4187
+ UseDelegate()(prototype, propertyKey);
4188
+ });
4189
+ }
4190
+ /**
4191
+ * @template E
4192
+ * @param {?=} options
4193
+ * @return {?}
4194
+ */
4195
+ function VisitParameterList(options) {
4196
+ /** @type {?} */
4197
+ var opts = Opts.get(options);
4198
+ return (/**
4199
+ * @param {?} prototype
4200
+ * @param {?} propertyKey
4549
4201
  * @return {?}
4550
4202
  */
4551
- PlaceRef.prototype.onPlaceReady = function () { };
4203
+ function (prototype, propertyKey) {
4204
+ /** @type {?} */
4205
+ var param = new ParameterDefinition.ArrayParameter(propertyKey.toString(), options, opts.getOptional("storeInUrl", null));
4206
+ Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
4207
+ UseDelegate()(prototype, propertyKey);
4208
+ });
4552
4209
  }
4553
- var PlaceOutletComponent = /** @class */ (function (_super) {
4554
- __extends(PlaceOutletComponent, _super);
4555
- function PlaceOutletComponent(router, placeRouter, placeConfig, parentOutlet) {
4210
+
4211
+ /**
4212
+ * @fileoverview added by tsickle
4213
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4214
+ */
4215
+ var NoopGatewayPlace = /** @class */ (function (_super) {
4216
+ __extends(NoopGatewayPlace, _super);
4217
+ function NoopGatewayPlace(router) {
4218
+ var _this = _super.call(this) || this;
4219
+ _this.router = router;
4220
+ return _this;
4221
+ }
4222
+ /**
4223
+ * @return {?}
4224
+ */
4225
+ NoopGatewayPlace.prototype.ngOnInit = /**
4226
+ * @return {?}
4227
+ */
4228
+ function () {
4229
+ this.router.navigateByUrl(this.returnUrl.value);
4230
+ };
4231
+ NoopGatewayPlace.ctorParameters = function () { return [
4232
+ { type: Router }
4233
+ ]; };
4234
+ NoopGatewayPlace.decorators = [
4235
+ { type: Component, args: [{
4236
+ template: ''
4237
+ }] }
4238
+ ];
4239
+ /** @nocollapse */
4240
+ NoopGatewayPlace.ctorParameters = function () { return [
4241
+ { type: Router }
4242
+ ]; };
4243
+ __decorate([
4244
+ VisitParameter({ storeInUrl: Formatter.STRING }),
4245
+ __metadata("design:type", MutableValueModel)
4246
+ ], NoopGatewayPlace.prototype, "returnUrl", void 0);
4247
+ NoopGatewayPlace = __decorate([
4248
+ Place({
4249
+ path: 'aup-gateway-route',
4250
+ authenticate: false
4251
+ }),
4252
+ __metadata("design:paramtypes", [Router])
4253
+ ], NoopGatewayPlace);
4254
+ return NoopGatewayPlace;
4255
+ }(PlaceComponent));
4256
+ if (false) {
4257
+ /** @type {?} */
4258
+ NoopGatewayPlace.prototype.returnUrl;
4259
+ /** @type {?} */
4260
+ NoopGatewayPlace.prototype.router;
4261
+ }
4262
+
4263
+ /**
4264
+ * @fileoverview added by tsickle
4265
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4266
+ */
4267
+ /** @type {?} */
4268
+ var noopPlaceDef = PlaceComponent.getDefinition(NoopGatewayPlace);
4269
+ var PlaceRouter = /** @class */ (function (_super) {
4270
+ __extends(PlaceRouter, _super);
4271
+ function PlaceRouter(router, urlSerializer, interactionContext, angularLocation, placeHistory) {
4556
4272
  var _this = _super.call(this) || this;
4557
4273
  _this.router = router;
4558
- _this.placeRouter = placeRouter;
4559
- _this.placeConfig = placeConfig;
4560
- _this.animate = true;
4561
- _this.placeChanged = new EventEmitter();
4562
- _this._activePlace = new MutableValueModel();
4563
- _this._activePlaceVisitModel = new DelegatingValueModel();
4564
- _this._inOutletActivation = new Guard$1();
4565
- _this._inOutletDeactivation = new Guard$1();
4566
- _this._inRouteVisitUpdate = new Guard$1();
4567
- _this._activatedRouteModel = new MutableValueModel();
4568
- _this._placeDefinition = new MutableValueModel();
4569
- _this.initialPlaceIndex = null;
4274
+ _this.urlSerializer = urlSerializer;
4275
+ _this.interactionContext = interactionContext;
4276
+ _this.angularLocation = angularLocation;
4277
+ _this.placeHistory = placeHistory;
4278
+ _this.firstRoute = true;
4279
+ _this._navigationSessionModel = new MutableValueModel();
4280
+ _this._activeVisits = new MutableListModel();
4281
+ _this.initialRedirectStarted = false;
4282
+ _this.initialRedirectFinished = false;
4570
4283
  var _a = Dsl.disposeWith(_this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
4571
- _this.parentOutletModel = new MutableValueModel(parentOutlet);
4572
- _this._activePlaceVisitModel.setDelegate(new MutableValueModel());
4573
- _this._inOutletUpdate = valueOf.any(_this._inOutletDeactivation, _this._inOutletActivation).areTruthy();
4574
- /** @type {?} */
4575
- var defaultPlaceAnimationOrder = chain(_this.parentOutletModel)
4576
- .pullValueModel((/**
4577
- * @param {?} o
4284
+ _this.activeVisitIndex = chain(_this._activeVisits).indexBy('placeDefinition');
4285
+ _this.navigationSessionFactory = new NavigationSession.Factory(interactionContext);
4286
+ angularLocation.onUrlChange((/**
4287
+ * @param {?} url
4578
4288
  * @return {?}
4579
4289
  */
4580
- function (o) { return o.activePlaceModel; }))
4581
- .pluck('placeDefinition')
4582
- .pluckList('children')
4583
- .pluck('component');
4584
- /** @type {?} */
4585
- var activatePlaceType = chain(_this.activePlaceModel).map((/**
4586
- * @param {?} p
4290
+ function (url) {
4291
+ console.log("location.onUrlChange -> " + url);
4292
+ }));
4293
+ // TODO: make setup the callbacks in during module initiation to make this testable.
4294
+ _this.router.events.subscribe((/**
4295
+ * @param {?} event
4587
4296
  * @return {?}
4588
4297
  */
4589
- function (p) { return (/** @type {?} */ (p.constructor)); }));
4590
- _this.placeAnimationOrder = chain(_this.customPlaceAnimationOrderModel)
4591
- .otherwise(defaultPlaceAnimationOrder)
4592
- .reduce((/**
4593
- * @param {?} placesInOrder
4298
+ function (event) {
4299
+ // Routing event sequence
4300
+ // ======================
4301
+ // NavigationStart -> .... -> NavigationCancel --> redirect, go around again in the same session
4302
+ // NavigationStart -> .... -> NavigationEnd --> navigation complete, end session.
4303
+ // NavigationStart -> .... -> NavigationError --> navigation canceled, end session.
4304
+ // =======================
4305
+ if (event instanceof NavigationStart) {
4306
+ _this.onAngularRouterStarted(event);
4307
+ }
4308
+ if (event instanceof NavigationEnd) {
4309
+ _this.onAngularRouterFinished(false);
4310
+ }
4311
+ if (event instanceof NavigationError) {
4312
+ _this.onAngularRouterFinished(true);
4313
+ }
4314
+ }));
4315
+ _this.navigationSessionActive = chain(_this.navigationSessionModel).isNotNil();
4316
+ _this.navigationSessionActive.subscribe((/**
4317
+ * @param {?} active
4594
4318
  * @return {?}
4595
4319
  */
4596
- function (placesInOrder) {
4597
- /** @type {?} */
4598
- var placeIndex = 0;
4599
- if (activatePlaceType.value) {
4600
- placeIndex = placesInOrder.indexOf(activatePlaceType.value);
4601
- if (isNil(_this.initialPlaceIndex)) {
4602
- _this.initialPlaceIndex = placeIndex;
4603
- }
4604
- }
4605
- return isNil(_this.initialPlaceIndex) ? 0 : placeIndex - _this.initialPlaceIndex;
4606
- }), { dependsOn: activatePlaceType });
4607
- // Push incoming changes into the component
4608
- _this.routerVisit = chain(_this._activePlace).pluck('placeDefinition').findIn(placeRouter.activeVisitIndex);
4609
- // Our router visit will change when our active is nullified during deactivation, which will push a null visit
4610
- // the the deactivated component, which will nuke it's view before the animations have finished.
4611
- // The visit will alway updated after the router session is finsised (when the new visits are registered) so
4612
- // we can safely ignore it during outlet changes as these always happen before the router session ends.
4613
- when.valueOf(_this.routerVisit).changes((/**
4320
+ function (active) {
4321
+ console.log('navigationSessionActive', active);
4322
+ }));
4323
+ return _this;
4324
+ // const txo = new TransactionObserver().onEvent(e => console.log(e.toString()));
4325
+ // txo.observe('this.navigationSessionModel', this.navigationSessionModel);
4326
+ }
4327
+ Object.defineProperty(PlaceRouter.prototype, "navigationSession", {
4328
+ get: /**
4614
4329
  * @return {?}
4615
4330
  */
4616
- function () { return _this.pushRouteChangesToVisit(); }), { unless: _this._inOutletUpdate });
4617
- // Handle component based changes
4618
- when.valueOf(_this._activePlaceVisitModel).changes((/**
4619
- * @param {?} next
4620
- * @param {?} previous
4331
+ function () {
4332
+ return this._navigationSessionModel.value;
4333
+ },
4334
+ enumerable: true,
4335
+ configurable: true
4336
+ });
4337
+ Object.defineProperty(PlaceRouter.prototype, "navigationSessionModel", {
4338
+ get: /**
4621
4339
  * @return {?}
4622
4340
  */
4623
- function (next, previous) {
4624
- _this.pushVisitChangesToRoute(next, previous);
4625
- }), {
4626
- unless: _this.placeRouter.navigationSessionActive
4627
- });
4628
- chain(_this._activePlace)
4629
- .postponeWhile(placeRouter.navigationSessionActive)
4630
- .subscribe((/**
4631
- * @param {?} place
4341
+ function () {
4342
+ return this._navigationSessionModel.readonly;
4343
+ },
4344
+ enumerable: true,
4345
+ configurable: true
4346
+ });
4347
+ Object.defineProperty(PlaceRouter.prototype, "activeVisits", {
4348
+ get: /**
4632
4349
  * @return {?}
4633
4350
  */
4634
- function (place) { return _this.placeChanged.emit(place); }));
4635
- return _this;
4636
- // const txo = new TransactionObserver().onEvent(e => console.log(e.toString()));
4637
- // txo.observe('inRouteVisitUpdate', inRouteVisitUpdate);
4638
- }
4351
+ function () {
4352
+ return this._activeVisits.readonly;
4353
+ },
4354
+ enumerable: true,
4355
+ configurable: true
4356
+ });
4357
+ /**
4358
+ * placeRouter.navigate(placeDestinations.somePlace.createVisit(routeId, ...visitParams));
4359
+ * @param visit
4360
+ */
4639
4361
  /**
4362
+ * placeRouter.navigate(placeDestinations.somePlace.createVisit(routeId, ...visitParams));
4363
+ * @param {?} visit
4364
+ * @param {?=} options
4640
4365
  * @return {?}
4641
4366
  */
4642
- PlaceOutletComponent.prototype.ngOnInit = /**
4367
+ PlaceRouter.prototype.navigate = /**
4368
+ * placeRouter.navigate(placeDestinations.somePlace.createVisit(routeId, ...visitParams));
4369
+ * @param {?} visit
4370
+ * @param {?=} options
4643
4371
  * @return {?}
4644
4372
  */
4645
- function () {
4373
+ function (visit, options) {
4374
+ return __awaiter(this, void 0, void 0, function () {
4375
+ var _this = this;
4376
+ return __generator(this, function (_a) {
4377
+ this.doNavigation(visit, (/**
4378
+ * @param {?} router
4379
+ * @return {?}
4380
+ */
4381
+ function (router) { return __awaiter(_this, void 0, void 0, function () {
4382
+ var commands;
4383
+ return __generator(this, function (_a) {
4384
+ switch (_a.label) {
4385
+ case 0:
4386
+ commands = __spread([
4387
+ visit.placeDefinition.path
4388
+ ], this.createRouteParameters(visit));
4389
+ return [4 /*yield*/, this.router.navigate(commands, {
4390
+ relativeTo: options ? options.relativeTo : null
4391
+ })];
4392
+ case 1:
4393
+ _a.sent();
4394
+ return [2 /*return*/];
4395
+ }
4396
+ });
4397
+ }); }));
4398
+ return [2 /*return*/];
4399
+ });
4400
+ });
4646
4401
  };
4647
4402
  // @Trace()
4648
4403
  // @Trace()
4649
4404
  /**
4405
+ * @param {?} activatedRoute
4406
+ * @param {?} previous
4407
+ * @param {?} next
4650
4408
  * @return {?}
4651
4409
  */
4652
- PlaceOutletComponent.prototype.getAnimationOrder =
4410
+ PlaceRouter.prototype.pushVisitChangesToRoute =
4653
4411
  // @Trace()
4654
4412
  /**
4413
+ * @param {?} activatedRoute
4414
+ * @param {?} previous
4415
+ * @param {?} next
4655
4416
  * @return {?}
4656
4417
  */
4657
- function () {
4658
- return this.placeAnimationOrder.value;
4418
+ function (activatedRoute, previous, next) {
4419
+ return __awaiter(this, void 0, void 0, function () {
4420
+ var _this = this;
4421
+ return __generator(this, function (_a) {
4422
+ // we have to push to history so our remember sanitisers don't pick up the previous value
4423
+ // when it's been cleared by the user.
4424
+ this.placeHistory.add(next);
4425
+ // FIXME: no route id -> route id duplicates route parameters
4426
+ if (next.hasRoutingChangedFrom(previous)) {
4427
+ return [2 /*return*/, this.doNavigation(next, (/**
4428
+ * @param {?} router
4429
+ * @return {?}
4430
+ */
4431
+ function (router) {
4432
+ /** @type {?} */
4433
+ var commands = _this.parseUrl(_this.router.routerState.snapshot).createRedirectCommandsFor(next);
4434
+ // // we have to to use the definition for route id as our redirection always includes
4435
+ // // the id in the url segements (but leaves it blank when there's no id). I.e. in the
4436
+ // // no id case we're doing the following redirect [<placePath>, ""] -> ["..", <id>]
4437
+ // const relativePath = !!previous.placeDefinition.hasRouteId() ? '..' : '.';
4438
+ // const commands = [
4439
+ // relativePath,
4440
+ // ...this.createRouteParameters(next),
4441
+ // ...this.extractChildPath(activatedRoute.snapshot)
4442
+ // ];
4443
+ console.log('### Push Changes to route Redirect', { commands: commands });
4444
+ return router.navigate(commands);
4445
+ }))];
4446
+ }
4447
+ return [2 /*return*/];
4448
+ });
4449
+ });
4450
+ };
4451
+ /**
4452
+ * @param {?} visit
4453
+ * @param {?} customNavigation
4454
+ * @return {?}
4455
+ */
4456
+ PlaceRouter.prototype.doNavigation = /**
4457
+ * @param {?} visit
4458
+ * @param {?} customNavigation
4459
+ * @return {?}
4460
+ */
4461
+ function (visit, customNavigation) {
4462
+ return __awaiter(this, void 0, void 0, function () {
4463
+ return __generator(this, function (_a) {
4464
+ switch (_a.label) {
4465
+ case 0:
4466
+ this._navigationSessionModel.value = this.navigationSessionFactory.createInternal(visit);
4467
+ _a.label = 1;
4468
+ case 1:
4469
+ _a.trys.push([1, , 3, 4]);
4470
+ return [4 /*yield*/, customNavigation(this.router)];
4471
+ case 2:
4472
+ _a.sent();
4473
+ return [3 /*break*/, 4];
4474
+ case 3:
4475
+ // Router has finished (since there was no router change required) so we
4476
+ // need to end the navigation session.
4477
+ if (this.navigationSession && !this.router.getCurrentNavigation()) {
4478
+ this.onAngularRouterFinished(false);
4479
+ }
4480
+ return [7 /*endfinally*/];
4481
+ case 4: return [2 /*return*/];
4482
+ }
4483
+ });
4484
+ });
4659
4485
  };
4660
- Object.defineProperty(PlaceOutletComponent.prototype, "animationDuration", {
4661
- get: /**
4662
- * @return {?}
4663
- */
4664
- function () {
4665
- return this.placeConfig && this.placeConfig.animationDuration ? this.placeConfig.animationDuration : '500ms';
4666
- },
4667
- enumerable: true,
4668
- configurable: true
4669
- });
4670
- // @Trace()
4671
- // @Trace()
4672
4486
  /**
4487
+ * @private
4673
4488
  * @param {?} visit
4674
4489
  * @return {?}
4675
4490
  */
4676
- PlaceOutletComponent.prototype.navigate =
4677
- // @Trace()
4678
- /**
4491
+ PlaceRouter.prototype.createRouteParameters = /**
4492
+ * @private
4679
4493
  * @param {?} visit
4680
4494
  * @return {?}
4681
4495
  */
4682
4496
  function (visit) {
4683
- // console.log({ activatedRoute: this._activatedRouteModel.value });
4684
- this.placeRouter.navigate(visit, {
4685
- relativeTo: this.parentOutlet ? this.parentOutlet.activatedRouteModel.value : null
4686
- });
4497
+ /** @type {?} */
4498
+ var def = visit.placeDefinition;
4499
+ return visit.hasRouteId() ?
4500
+ [def.getFormattedRouteId(visit), def.getFormattedRouteParameters(visit)] :
4501
+ [def.getFormattedRouteParameters(visit)];
4687
4502
  };
4688
- Object.defineProperty(PlaceOutletComponent.prototype, "parentOutlet", {
4689
- get: /**
4690
- * @return {?}
4691
- */
4692
- function () {
4693
- return this.parentOutletModel.value;
4694
- },
4695
- enumerable: true,
4696
- configurable: true
4697
- });
4698
4503
  // @Trace()
4699
4504
  // @Trace()
4700
4505
  /**
4506
+ * @private
4507
+ * @param {?} event
4701
4508
  * @return {?}
4702
4509
  */
4703
- PlaceOutletComponent.prototype.pushRouteChangesToVisit =
4510
+ PlaceRouter.prototype.onAngularRouterStarted =
4704
4511
  // @Trace()
4705
4512
  /**
4513
+ * @private
4514
+ * @param {?} event
4706
4515
  * @return {?}
4707
4516
  */
4708
- function () {
4709
- var _this = this;
4710
- /** @type {?} */
4711
- var visit = this.routerVisit.value;
4712
- // console.log({
4713
- // visit,
4714
- // place: visit ? visit.placeDefinition.component : null,
4715
- // inOutletActivation: this._inOutletActivation.value,
4716
- // inRoutingSession: this.placeRouter.navigationSessionActive.value
4717
- // });
4718
- if (visit) { // can be null while the place and index sync up
4719
- this._inRouteVisitUpdate.whileTrue((/**
4720
- * @return {?}
4721
- */
4722
- function () {
4723
- _this._activePlaceVisitModel.value = visit;
4724
- }));
4517
+ function (event) {
4518
+ if (!this.navigationSession) { // We been activated by an external route rather than placeRouter.go(visit)
4519
+ console.log('navigation started', { firstTime: this.firstRoute });
4520
+ /** @type {?} */
4521
+ var session = this.navigationSessionFactory.createExternal(this.firstRoute);
4522
+ if (event.navigationTrigger === 'popstate') {
4523
+ session.setPopstateReturnUrl(this.router.routerState.snapshot.url);
4524
+ }
4525
+ this._navigationSessionModel.value = session;
4725
4526
  }
4527
+ this.firstRoute = false;
4726
4528
  };
4727
- /**
4728
- * @param {?} next
4729
- * @param {?} previous
4730
- * @return {?}
4731
- */
4732
- PlaceOutletComponent.prototype.pushVisitChangesToRoute = /**
4733
- * @param {?} next
4734
- * @param {?} previous
4735
- * @return {?}
4736
- */
4737
- function (next, previous) {
4738
- /** @type {?} */
4739
- var activatedRoute = this._activatedRouteModel.value;
4740
- this.placeRouter.pushVisitChangesToRoute(activatedRoute, previous, next);
4741
- };
4742
- Object.defineProperty(PlaceOutletComponent.prototype, "activePlaceModel", {
4743
- get: /**
4744
- * @return {?}
4745
- */
4746
- function () {
4747
- return this._activePlace.readonly;
4748
- },
4749
- enumerable: true,
4750
- configurable: true
4751
- });
4752
- Object.defineProperty(PlaceOutletComponent.prototype, "activatedRouteModel", {
4753
- get: /**
4754
- * @return {?}
4755
- */
4756
- function () {
4757
- return this._activatedRouteModel.readonly;
4758
- },
4759
- enumerable: true,
4760
- configurable: true
4761
- });
4762
4529
  // @Trace()
4763
4530
  // @Trace()
4764
4531
  /**
4765
- * @param {?} routerOutlet
4766
- * @param {?} place
4532
+ * @private
4533
+ * @param {?} cancelled
4767
4534
  * @return {?}
4768
4535
  */
4769
- PlaceOutletComponent.prototype.onOutletActivated =
4536
+ PlaceRouter.prototype.onAngularRouterFinished =
4770
4537
  // @Trace()
4771
4538
  /**
4772
- * @param {?} routerOutlet
4773
- * @param {?} place
4539
+ * @private
4540
+ * @param {?} cancelled
4774
4541
  * @return {?}
4775
4542
  */
4776
- function (routerOutlet, place) {
4543
+ function (cancelled) {
4777
4544
  var _this = this;
4778
- this._inOutletActivation.whileTrue((/**
4779
- * @return {?}
4780
- */
4781
- function () {
4782
- try {
4783
- _this._activePlace.value = place;
4784
- _this._activatedRouteModel.value = routerOutlet.activatedRoute;
4785
- _this._placeDefinition.value = place.placeDefinition;
4786
- /** @type {?} */
4787
- var visitModel = new MutableValueModel();
4788
- _this._activePlaceVisitModel.setDelegate(visitModel);
4789
- place.initialiseBindings(visitModel);
4790
- }
4791
- catch (error) {
4792
- console.error(error);
4545
+ /** @type {?} */
4546
+ var session = this._navigationSessionModel.value;
4547
+ if (!cancelled) {
4548
+ // Update visits before we end the navigation session. This allows the placeOutets to
4549
+ // ignore visit changes that occur while the navigation is in progress
4550
+ /** @type {?} */
4551
+ var visits = session.getVisits();
4552
+ visits.forEach((/**
4553
+ * @param {?} v
4554
+ * @return {?}
4555
+ */
4556
+ function (v) { return _this.placeHistory.add(v); }));
4557
+ this._activeVisits.value = visits;
4558
+ }
4559
+ else {
4560
+ // Angular doesn't preserve the url when a guard cancels the back button.
4561
+ // See https://github.com/angular/angular/issues/13586#issuecomment-432795720
4562
+ if (session.isPopState) {
4563
+ console.log('cancelled during popstate');
4564
+ this.angularLocation.go(session.popStateReturnUrl);
4793
4565
  }
4794
- }));
4795
- if (!this.animate) {
4796
- // we're not animating so trigger any post animation callbacks now.
4797
- this.animationDone();
4798
4566
  }
4567
+ this._navigationSessionModel.value = null;
4799
4568
  };
4800
- // @Trace()
4801
- // @Trace()
4802
4569
  /**
4570
+ * @param {?} activatedRoute
4803
4571
  * @return {?}
4804
4572
  */
4805
- PlaceOutletComponent.prototype.onOutletDeactivated =
4806
- // @Trace()
4807
- /**
4573
+ PlaceRouter.prototype.extractChildPath = /**
4574
+ * @param {?} activatedRoute
4808
4575
  * @return {?}
4809
4576
  */
4810
- function () {
4811
- var _this = this;
4812
- this._inOutletDeactivation.whileTrue((/**
4577
+ function (activatedRoute) {
4578
+ return ___default.flatten(activatedRoute.children.map((/**
4579
+ * @param {?} child
4813
4580
  * @return {?}
4814
4581
  */
4815
- function () {
4816
- _this._activePlace.value = null;
4817
- _this._activatedRouteModel.value = null;
4818
- _this._placeDefinition.value = null;
4819
- _this._activePlaceVisitModel.setDelegate(null);
4820
- }));
4582
+ function (child) { return child.url; })));
4821
4583
  };
4822
- // @Trace()
4823
- // @Trace()
4824
4584
  /**
4585
+ * @param {?} snapshot
4825
4586
  * @return {?}
4826
4587
  */
4827
- PlaceOutletComponent.prototype.animationStarted =
4828
- // @Trace()
4829
- /**
4588
+ PlaceRouter.prototype.parseUrl = /**
4589
+ * @param {?} snapshot
4830
4590
  * @return {?}
4831
4591
  */
4832
- function () {
4833
- // console.log({ activePlace: this._activePlace.value });
4592
+ function (snapshot) {
4593
+ return new PlaceRouter.UrlHelper(this.urlSerializer.parse(snapshot.url));
4834
4594
  };
4835
- // @Trace()
4836
- // @Trace()
4837
- /**
4838
- * @return {?}
4839
- */
4840
- PlaceOutletComponent.prototype.animationDone =
4841
- // @Trace()
4595
+ // TODO: this all only sort of works. Opening dialogs and clicking back multiple times breaks things.
4596
+ // TODO: next stage is to investigate tracking dialog state in a different placeoutlet and keeping those
4597
+ // TODO: urls out of the history.
4598
+ // TODO: this all only sort of works. Opening dialogs and clicking back multiple times breaks things.
4599
+ // TODO: next stage is to investigate tracking dialog state in a different placeoutlet and keeping those
4600
+ // TODO: urls out of the history.
4842
4601
  /**
4602
+ * @param {?} activatedRoute
4603
+ * @param {?} state
4843
4604
  * @return {?}
4844
4605
  */
4845
- function () {
4846
- if (this._activePlace.value) {
4847
- this._activePlace.value.onPlaceReady();
4848
- }
4849
- };
4850
- PlaceOutletComponent.decorators = [
4851
- { type: Component, args: [{
4852
- selector: 'aup-place-outlet',
4853
- 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",
4854
- animations: [LEFT_RIGHT_PLACE_ANIMATION],
4855
- 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}"]
4856
- }] }
4857
- ];
4858
- /** @nocollapse */
4859
- PlaceOutletComponent.ctorParameters = function () { return [
4860
- { type: Router },
4861
- { type: PlaceRouter },
4862
- { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [AUP_PLACE_CONFIG,] }] },
4863
- { type: PlaceOutletComponent, decorators: [{ type: SkipSelf }, { type: Optional }] }
4864
- ]; };
4865
- PlaceOutletComponent.propDecorators = {
4866
- animate: [{ type: Input }],
4867
- customPlaceAnimationOrderModel: [{ type: Input, args: ['placeAnimationOrderModel',] }],
4868
- customPlaceAnimationOrder: [{ type: Input, args: ['placeAnimationOrder',] }],
4869
- placeChanged: [{ type: Output }],
4870
- routerOut: [{ type: ViewChild, args: ['routeOutlet', { static: true },] }]
4871
- };
4872
- __decorate([
4873
- UseDelegate(),
4874
- __metadata("design:type", ListModel)
4875
- ], PlaceOutletComponent.prototype, "customPlaceAnimationOrderModel", void 0);
4876
- __decorate([
4877
- StoreInListModel('customPlaceAnimationOrderModel'),
4878
- __metadata("design:type", Array)
4879
- ], PlaceOutletComponent.prototype, "customPlaceAnimationOrder", void 0);
4880
- return PlaceOutletComponent;
4881
- }(DisposableComponent));
4882
- if (false) {
4883
- /** @type {?} */
4884
- PlaceOutletComponent.prototype.animate;
4885
- /** @type {?} */
4886
- PlaceOutletComponent.prototype.customPlaceAnimationOrderModel;
4887
- /** @type {?} */
4888
- PlaceOutletComponent.prototype.customPlaceAnimationOrder;
4889
- /** @type {?} */
4890
- PlaceOutletComponent.prototype.placeChanged;
4891
- /** @type {?} */
4892
- PlaceOutletComponent.prototype.routerOut;
4893
- /**
4894
- * @type {?}
4895
- * @private
4896
- */
4897
- PlaceOutletComponent.prototype._activePlace;
4606
+ PlaceRouter.prototype.performInitialNavigationIntercept =
4607
+ // TODO: this all only sort of works. Opening dialogs and clicking back multiple times breaks things.
4608
+ // TODO: next stage is to investigate tracking dialog state in a different placeoutlet and keeping those
4609
+ // TODO: urls out of the history.
4898
4610
  /**
4899
- * @type {?}
4900
- * @private
4611
+ * @param {?} activatedRoute
4612
+ * @param {?} state
4613
+ * @return {?}
4901
4614
  */
4902
- PlaceOutletComponent.prototype._activePlaceVisitModel;
4615
+ function (activatedRoute, state) {
4616
+ assert.isTruthy(this.isInitialNavigation());
4617
+ Logger.get(this).info("Redirecting to: " + noopPlaceDef.path, { returnUrl: state.url });
4618
+ if (!this.initialRedirectFinished) {
4619
+ this.initialRedirectFinished = true;
4620
+ return this.router.createUrlTree([noopPlaceDef.path, {
4621
+ returnUrl: state.url
4622
+ }], {
4623
+ replaceUrl: true,
4624
+ // make sure we update our history
4625
+ skipLocationChange: false
4626
+ });
4627
+ }
4628
+ };
4903
4629
  /**
4904
- * @type {?}
4905
- * @private
4630
+ * @return {?}
4906
4631
  */
4907
- PlaceOutletComponent.prototype._inOutletActivation;
4908
- /**
4909
- * @type {?}
4910
- * @private
4632
+ PlaceRouter.prototype.isInitialNavigation = /**
4633
+ * @return {?}
4911
4634
  */
4912
- PlaceOutletComponent.prototype._inOutletDeactivation;
4635
+ function () {
4636
+ return this.navigationSession.firstNavigation && !this.initialRedirectFinished;
4637
+ };
4638
+ PlaceRouter.decorators = [
4639
+ { type: Injectable, args: [{
4640
+ providedIn: 'root'
4641
+ },] }
4642
+ ];
4643
+ /** @nocollapse */
4644
+ PlaceRouter.ctorParameters = function () { return [
4645
+ { type: Router },
4646
+ { type: UrlSerializer },
4647
+ { type: InteractionContext },
4648
+ { type: Location },
4649
+ { type: PlaceHistory }
4650
+ ]; };
4651
+ /** @nocollapse */ PlaceRouter.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(ɵɵinject(Router), ɵɵinject(UrlSerializer), ɵɵinject(InteractionContext), ɵɵinject(Location), ɵɵinject(PlaceHistory)); }, token: PlaceRouter, providedIn: "root" });
4652
+ __decorate([
4653
+ Trace(),
4654
+ __metadata("design:type", Function),
4655
+ __metadata("design:paramtypes", [Visit, Object]),
4656
+ __metadata("design:returntype", Promise)
4657
+ ], PlaceRouter.prototype, "navigate", null);
4658
+ return PlaceRouter;
4659
+ }(GarbageCollector));
4660
+ if (false) {
4913
4661
  /**
4914
4662
  * @type {?}
4915
4663
  * @private
4916
4664
  */
4917
- PlaceOutletComponent.prototype._inOutletUpdate;
4665
+ PlaceRouter.prototype.firstRoute;
4918
4666
  /**
4919
4667
  * @type {?}
4920
4668
  * @private
4921
4669
  */
4922
- PlaceOutletComponent.prototype._inRouteVisitUpdate;
4670
+ PlaceRouter.prototype._navigationSessionModel;
4923
4671
  /**
4924
4672
  * @type {?}
4925
4673
  * @private
4926
4674
  */
4927
- PlaceOutletComponent.prototype._activatedRouteModel;
4675
+ PlaceRouter.prototype._activeVisits;
4676
+ /** @type {?} */
4677
+ PlaceRouter.prototype.navigationSessionActive;
4678
+ /** @type {?} */
4679
+ PlaceRouter.prototype.activeVisitIndex;
4928
4680
  /**
4929
4681
  * @type {?}
4930
4682
  * @private
4931
4683
  */
4932
- PlaceOutletComponent.prototype._placeDefinition;
4684
+ PlaceRouter.prototype.navigationSessionFactory;
4933
4685
  /**
4934
4686
  * @type {?}
4935
4687
  * @private
4936
4688
  */
4937
- PlaceOutletComponent.prototype.parentOutletModel;
4938
- /** @type {?} */
4939
- PlaceOutletComponent.prototype.placeAnimationOrder;
4689
+ PlaceRouter.prototype.initialRedirectStarted;
4940
4690
  /**
4941
4691
  * @type {?}
4942
4692
  * @private
4943
4693
  */
4944
- PlaceOutletComponent.prototype.initialPlaceIndex;
4694
+ PlaceRouter.prototype.initialRedirectFinished;
4945
4695
  /**
4946
4696
  * @type {?}
4947
4697
  * @private
4948
4698
  */
4949
- PlaceOutletComponent.prototype.routerVisit;
4699
+ PlaceRouter.prototype.router;
4950
4700
  /**
4951
4701
  * @type {?}
4952
4702
  * @private
4953
4703
  */
4954
- PlaceOutletComponent.prototype.router;
4704
+ PlaceRouter.prototype.urlSerializer;
4955
4705
  /**
4956
4706
  * @type {?}
4957
4707
  * @private
4958
4708
  */
4959
- PlaceOutletComponent.prototype.placeRouter;
4709
+ PlaceRouter.prototype.interactionContext;
4960
4710
  /** @type {?} */
4961
- PlaceOutletComponent.prototype.placeConfig;
4711
+ PlaceRouter.prototype.angularLocation;
4712
+ /** @type {?} */
4713
+ PlaceRouter.prototype.placeHistory;
4962
4714
  }
4963
-
4964
- /**
4965
- * @fileoverview added by tsickle
4966
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4967
- */
4968
- var AbstractPlaceNavigationComponent = /** @class */ (function (_super) {
4969
- __extends(AbstractPlaceNavigationComponent, _super);
4970
- function AbstractPlaceNavigationComponent() {
4971
- var _this = _super.call(this) || this;
4972
- var _a = Dsl.disposeWith(_this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
4973
- _this.placeDefinitions = chain(_this.placesModel).map((/**
4974
- * @param {?} c
4715
+ (function (PlaceRouter) {
4716
+ var UrlHelper = /** @class */ (function () {
4717
+ function UrlHelper(urlTree) {
4718
+ this.urlTree = urlTree;
4719
+ console.log({ segments: this.urlTree.root.children.primary.segments });
4720
+ }
4721
+ /**
4975
4722
  * @return {?}
4976
4723
  */
4977
- function (c) { return PlaceComponent.getDefinition(c); }));
4978
- _this.commandFactory = Command.createFactory((/**
4979
- * @param {?} placeDefinition
4724
+ UrlHelper.prototype.cloneUrlSegmentList = /**
4980
4725
  * @return {?}
4981
4726
  */
4982
- function (placeDefinition) {
4983
- _this.placeOutlet.navigate(new Visit(placeDefinition));
4984
- }));
4985
- _this.activePlaceDefinition = chain(_this.placeOutletModel).pullValueModel((/**
4986
- * @param {?} o
4727
+ function () {
4728
+ return __spread(this.urlTree.root.children.primary.segments);
4729
+ };
4730
+ /**
4731
+ * @param {?} visit
4987
4732
  * @return {?}
4988
4733
  */
4989
- function (o) { return o.activePlaceModel; })).pluck("placeDefinition");
4990
- return _this;
4991
- }
4992
- /**
4993
- * @param {?} placeDef
4994
- * @return {?}
4995
- */
4996
- AbstractPlaceNavigationComponent.prototype.getNav = /**
4997
- * @param {?} placeDef
4998
- * @return {?}
4999
- */
5000
- function (placeDef) {
5001
- /** @type {?} */
5002
- var navItem = (/** @type {?} */ (placeDef.getPlaceData('nav')));
5003
- return {
5004
- title: (/**
5005
- * @return {?}
5006
- */
5007
- function () { return navItem ? navItem.title() : placeDef.searchPlaceData(['navTitle', 'title']); }),
5008
- tooltip: (/**
5009
- * @return {?}
5010
- */
5011
- function () { return navItem && navItem.tooltip ? navItem.tooltip() : placeDef.getPlaceData('navTooltip', null); }),
5012
- icon: (/**
4734
+ UrlHelper.prototype.updateVisitSegments = /**
4735
+ * @param {?} visit
4736
+ * @return {?}
4737
+ */
4738
+ function (visit) {
4739
+ // Ugly, but it works for now.
4740
+ /** @type {?} */
4741
+ var segments = this.cloneUrlSegmentList();
4742
+ /** @type {?} */
4743
+ var visitSegments = this.convertToUrlSegments(visit);
4744
+ /** @type {?} */
4745
+ var replaceAt = segments.findIndex((/**
4746
+ * @param {?} segment
5013
4747
  * @return {?}
5014
4748
  */
5015
- function () { return navItem && navItem.icon ? navItem.icon() : placeDef.getPlaceData('navIcon', null); })
4749
+ function (segment) { return segment.path === visitSegments[0].path; }));
4750
+ // do not use the return value, it's the items that were removed!
4751
+ segments.splice.apply(segments, __spread([replaceAt, visitSegments.length], visitSegments));
4752
+ return segments;
5016
4753
  };
5017
- };
5018
- /**
5019
- * @param {?} place
5020
- * @return {?}
5021
- */
5022
- AbstractPlaceNavigationComponent.prototype.isActive = /**
5023
- * @param {?} place
5024
- * @return {?}
5025
- */
5026
- function (place) {
5027
- return this.activePlaceDefinition.query().equals(place);
5028
- };
5029
- /**
5030
- * @return {?}
5031
- */
5032
- AbstractPlaceNavigationComponent.prototype.ngOnInit = /**
5033
- * @return {?}
5034
- */
5035
- function () {
5036
- };
5037
- AbstractPlaceNavigationComponent.decorators = [
5038
- { type: Component, args: [{
5039
- template: ''
5040
- }] }
5041
- ];
5042
- /** @nocollapse */
5043
- AbstractPlaceNavigationComponent.ctorParameters = function () { return []; };
5044
- AbstractPlaceNavigationComponent.propDecorators = {
5045
- places: [{ type: Input }],
5046
- placesModel: [{ type: Input }],
5047
- placeOutlet: [{ type: Input }],
5048
- placeOutletModel: [{ type: Input }]
5049
- };
5050
- __decorate([
5051
- StoreInListModel('placesModel'),
5052
- __metadata("design:type", Array)
5053
- ], AbstractPlaceNavigationComponent.prototype, "places", void 0);
5054
- __decorate([
5055
- UseDelegate(),
5056
- __metadata("design:type", ListModel)
5057
- ], AbstractPlaceNavigationComponent.prototype, "placesModel", void 0);
5058
- __decorate([
5059
- StoreInValueModel('placeOutletModel'),
5060
- __metadata("design:type", PlaceOutletComponent)
5061
- ], AbstractPlaceNavigationComponent.prototype, "placeOutlet", void 0);
5062
- __decorate([
5063
- UseDelegate(),
5064
- __metadata("design:type", ValueModel)
5065
- ], AbstractPlaceNavigationComponent.prototype, "placeOutletModel", void 0);
5066
- __decorate([
5067
- Memoize(),
5068
- __metadata("design:type", Function),
5069
- __metadata("design:paramtypes", [PlaceDefinition]),
5070
- __metadata("design:returntype", Object)
5071
- ], AbstractPlaceNavigationComponent.prototype, "getNav", null);
5072
- return AbstractPlaceNavigationComponent;
5073
- }(DisposableComponent));
5074
- if (false) {
5075
- /** @type {?} */
5076
- AbstractPlaceNavigationComponent.prototype.places;
5077
- /** @type {?} */
5078
- AbstractPlaceNavigationComponent.prototype.placesModel;
5079
- /** @type {?} */
5080
- AbstractPlaceNavigationComponent.prototype.placeOutlet;
5081
- /** @type {?} */
5082
- AbstractPlaceNavigationComponent.prototype.placeOutletModel;
5083
- /** @type {?} */
5084
- AbstractPlaceNavigationComponent.prototype.placeDefinitions;
5085
- /** @type {?} */
5086
- AbstractPlaceNavigationComponent.prototype.commandFactory;
5087
- /** @type {?} */
5088
- AbstractPlaceNavigationComponent.prototype.activePlaceDefinition;
5089
- }
4754
+ /**
4755
+ * Converts the visit into segments. Please not that these segments are not e
4756
+ * @param visit
4757
+ */
4758
+ /**
4759
+ * Converts the visit into segments. Please not that these segments are not e
4760
+ * @param {?} visit
4761
+ * @return {?}
4762
+ */
4763
+ UrlHelper.prototype.convertToUrlSegments = /**
4764
+ * Converts the visit into segments. Please not that these segments are not e
4765
+ * @param {?} visit
4766
+ * @return {?}
4767
+ */
4768
+ function (visit) {
4769
+ return visit.placeDefinition.hasRouteId() ?
4770
+ [
4771
+ // NOTE:
4772
+ // It's important to attach the params to the root path and not the id. If we attach them
4773
+ // to an empty id then the angular router won't match the pattern.
4774
+ new UrlSegment(visit.placeDefinition.path, visit.placeDefinition.getFormattedRouteParameters(visit)),
4775
+ new UrlSegment(visit.placeDefinition.getFormattedRouteId(visit), {})
4776
+ ]
4777
+ :
4778
+ [
4779
+ new UrlSegment(visit.placeDefinition.path, visit.placeDefinition.getFormattedRouteParameters(visit))
4780
+ ];
4781
+ };
4782
+ /**
4783
+ * @param {?} visit
4784
+ * @return {?}
4785
+ */
4786
+ UrlHelper.prototype.createRedirectCommandsFor = /**
4787
+ * @param {?} visit
4788
+ * @return {?}
4789
+ */
4790
+ function (visit) {
4791
+ /** @type {?} */
4792
+ var segments = this.updateVisitSegments(visit);
4793
+ /** @type {?} */
4794
+ var commands = [];
4795
+ segments.forEach((/**
4796
+ * @param {?} s
4797
+ * @return {?}
4798
+ */
4799
+ function (s) {
4800
+ commands.push(s.path);
4801
+ if (s.parameterMap.keys.length > 0) {
4802
+ commands.push(s.parameters);
4803
+ }
4804
+ }));
4805
+ return commands;
4806
+ };
4807
+ /**
4808
+ * @param {?} placeDef
4809
+ * @return {?}
4810
+ */
4811
+ UrlHelper.prototype.includesPathOf = /**
4812
+ * @param {?} placeDef
4813
+ * @return {?}
4814
+ */
4815
+ function (placeDef) {
4816
+ return this.cloneUrlSegmentList().find((/**
4817
+ * @param {?} s
4818
+ * @return {?}
4819
+ */
4820
+ function (s) { return s.path === placeDef.path; }));
4821
+ };
4822
+ __decorate([
4823
+ Trace(),
4824
+ __metadata("design:type", Function),
4825
+ __metadata("design:paramtypes", [Visit]),
4826
+ __metadata("design:returntype", Array)
4827
+ ], UrlHelper.prototype, "createRedirectCommandsFor", null);
4828
+ return UrlHelper;
4829
+ }());
4830
+ PlaceRouter.UrlHelper = UrlHelper;
4831
+ if (false) {
4832
+ /**
4833
+ * @type {?}
4834
+ * @private
4835
+ */
4836
+ UrlHelper.prototype.urlTree;
4837
+ }
4838
+ })(PlaceRouter || (PlaceRouter = {}));
5090
4839
 
5091
4840
  /**
5092
4841
  * @fileoverview added by tsickle
5093
4842
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5094
4843
  */
5095
- var BusyOverlayComponent = /** @class */ (function () {
5096
- function BusyOverlayComponent() {
5097
- }
5098
- /**
5099
- * @return {?}
5100
- */
5101
- BusyOverlayComponent.prototype.ngOnInit = /**
5102
- * @return {?}
5103
- */
5104
- function () {
5105
- };
5106
- BusyOverlayComponent.decorators = [
5107
- { type: Component, args: [{
5108
- selector: 'aup-busy-overlay',
5109
- template: "<ng-content></ng-content>\n<div class=\"busy-overlay-backdrop\" *ngIf=\"busyModel.value\">\n <mat-progress-spinner mode=\"indeterminate\" [diameter]=\"52\"></mat-progress-spinner>\n</div>\n",
5110
- styles: [":host{position:relative}div.busy-overlay-backdrop{position:absolute;background-color:rgba(0,0,0,.2);top:0;left:0;bottom:0;right:0;display:-ms-grid;display:grid;-ms-grid-columns:auto;grid-template-columns:auto;-ms-grid-rows:auto;grid-template-rows:auto;place-content:center}"]
5111
- }] }
5112
- ];
5113
- /** @nocollapse */
5114
- BusyOverlayComponent.ctorParameters = function () { return []; };
5115
- BusyOverlayComponent.propDecorators = {
5116
- busyModel: [{ type: Input }],
5117
- busy: [{ type: Input }]
5118
- };
5119
- __decorate([
5120
- UseDelegate(),
5121
- __metadata("design:type", ValueModel)
5122
- ], BusyOverlayComponent.prototype, "busyModel", void 0);
5123
- __decorate([
5124
- StoreInValueModel('busyModel'),
5125
- __metadata("design:type", Boolean)
5126
- ], BusyOverlayComponent.prototype, "busy", void 0);
5127
- return BusyOverlayComponent;
5128
- }());
5129
- if (false) {
5130
- /** @type {?} */
5131
- BusyOverlayComponent.prototype.busyModel;
5132
- /** @type {?} */
5133
- BusyOverlayComponent.prototype.busy;
4844
+ // Freezes the state of the components at the start of the animation.
4845
+ /** @type {?} */
4846
+ var animationStartStyle = style({ position: 'absolute', top: '0', left: '0', bottom: '0', right: '0' });
4847
+ /** @type {?} */
4848
+ var left = [
4849
+ query(':enter, :leave', animationStartStyle, { optional: true }),
4850
+ group([
4851
+ query(':enter', [
4852
+ style({ transform: 'translateX(-100%)' }),
4853
+ animate('{{duration}} ease-out', style({ transform: 'translateX(0%)' }))
4854
+ ], {
4855
+ optional: true
4856
+ }),
4857
+ query(':leave', [
4858
+ style({ transform: 'translateX(0%)' }),
4859
+ animate('{{duration}} ease-out', style({ transform: 'translateX(100%)' }))
4860
+ ], {
4861
+ optional: true
4862
+ })
4863
+ ])
4864
+ ];
4865
+ /** @type {?} */
4866
+ var right = [
4867
+ query(':enter, :leave', animationStartStyle, { optional: true }),
4868
+ group([
4869
+ query(':enter', [
4870
+ style({ transform: 'translateX(100%)', minHeight: '1px' }),
4871
+ animate('{{duration}} ease-out', style({ transform: 'translateX(0%)' }))
4872
+ ], {
4873
+ optional: true
4874
+ }),
4875
+ query(':leave', [style({ transform: 'translateX(0%)' }), animate('{{duration}} ease-out', style({
4876
+ transform: 'translateX(-100%)',
4877
+ minHeight: '1px'
4878
+ }))], {
4879
+ optional: true
4880
+ })
4881
+ ])
4882
+ ];
4883
+ /**
4884
+ * @param {?} duration
4885
+ * @return {?}
4886
+ */
4887
+ function leftRightPlaceAnimation(duration) {
4888
+ return trigger('routeAnimations', [
4889
+ transition(':increment', right, { params: { duration: duration } }),
4890
+ transition(':decrement', left, { params: { duration: duration } })
4891
+ ]);
5134
4892
  }
4893
+ /** @type {?} */
4894
+ var LEFT_RIGHT_PLACE_ANIMATION = leftRightPlaceAnimation('0.3s');
5135
4895
 
5136
4896
  /**
5137
4897
  * @fileoverview added by tsickle
5138
4898
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5139
4899
  */
5140
- var EmptyStateComponent = /** @class */ (function () {
5141
- function EmptyStateComponent() {
5142
- }
4900
+ /**
4901
+ * @record
4902
+ */
4903
+ function PlaceRef() { }
4904
+ if (false) {
4905
+ /** @type {?} */
4906
+ PlaceRef.prototype.placeDefinition;
5143
4907
  /**
4908
+ * @param {?} param
5144
4909
  * @return {?}
5145
4910
  */
5146
- EmptyStateComponent.prototype.ngOnInit = /**
4911
+ PlaceRef.prototype.initialiseBindings = function (param) { };
4912
+ /**
5147
4913
  * @return {?}
5148
4914
  */
5149
- function () {
5150
- };
5151
- EmptyStateComponent.decorators = [
5152
- { type: Component, args: [{
5153
- selector: 'aup-empty-state',
5154
- template: "\n <div class=\"container\">\n <ng-content></ng-content>\n </div>\n ",
5155
- styles: [":host{display:flex;flex-direction:column;justify-content:center;align-items:center}.container{padding:var(--aup-default-padding);border:2px dashed rgba(0,0,0,.2);border-radius:5px;font-size:14px;font-weight:300}"]
5156
- }] }
5157
- ];
5158
- /** @nocollapse */
5159
- EmptyStateComponent.ctorParameters = function () { return []; };
5160
- return EmptyStateComponent;
5161
- }());
5162
-
5163
- /**
5164
- * @fileoverview added by tsickle
5165
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5166
- */
5167
- var ListPlaceNavComponent = /** @class */ (function (_super) {
5168
- __extends(ListPlaceNavComponent, _super);
5169
- function ListPlaceNavComponent() {
4915
+ PlaceRef.prototype.onPlaceReady = function () { };
4916
+ }
4917
+ var PlaceOutletComponent = /** @class */ (function (_super) {
4918
+ __extends(PlaceOutletComponent, _super);
4919
+ function PlaceOutletComponent(router, placeRouter, placeConfig, parentOutlet) {
5170
4920
  var _this = _super.call(this) || this;
5171
- _this.expanded = true;
4921
+ _this.router = router;
4922
+ _this.placeRouter = placeRouter;
4923
+ _this.placeConfig = placeConfig;
4924
+ _this.placeChanged = new EventEmitter();
4925
+ _this._activePlace = new MutableValueModel();
4926
+ _this._previousPlace = new MutableValueModel();
4927
+ _this._activePlaceVisitModel = new DelegatingValueModel();
4928
+ _this._inOutletActivation = new Guard$1();
4929
+ _this._inOutletDeactivation = new Guard$1();
4930
+ _this._inRouteVisitUpdate = new Guard$1();
4931
+ _this._activatedRouteModel = new MutableValueModel();
4932
+ _this._placeDefinition = new MutableValueModel();
4933
+ _this.initialPlaceIndex = null;
4934
+ var _a = Dsl.disposeWith(_this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
4935
+ _this.parentOutletModel = new MutableValueModel(parentOutlet);
4936
+ _this._activePlaceVisitModel.setDelegate(new MutableValueModel());
4937
+ _this._inOutletUpdate = valueOf.any(_this._inOutletDeactivation, _this._inOutletActivation).areTruthy();
4938
+ /** @type {?} */
4939
+ var defaultPlaceAnimationOrder = chain(_this.parentOutletModel)
4940
+ .pullValueModel((/**
4941
+ * @param {?} o
4942
+ * @return {?}
4943
+ */
4944
+ function (o) { return o.activePlaceModel; }))
4945
+ .pluck('placeDefinition')
4946
+ .pluckList('children')
4947
+ .pluck('component');
4948
+ // TODO: This is a hack to prevent animation during the NoopGatewayPlace
4949
+ /** @type {?} */
4950
+ var activePlaceType = chain(_this._activePlace).map((/**
4951
+ * @param {?} p
4952
+ * @return {?}
4953
+ */
4954
+ function (p) {
4955
+ return (/** @type {?} */ (p.constructor));
4956
+ }), {
4957
+ postponeWhile: chain(_this.activePlaceModel).isNil()
4958
+ });
4959
+ /** @type {?} */
4960
+ var previousPlaceType = chain(_this._previousPlace).map((/**
4961
+ * @param {?} p
4962
+ * @return {?}
4963
+ */
4964
+ function (p) { return (/** @type {?} */ (p.constructor)); }));
4965
+ _this.ready = chain.reduce(activePlaceType, previousPlaceType, (/**
4966
+ * @param {?} current
4967
+ * @param {?} previous
4968
+ * @return {?}
4969
+ */
4970
+ function (current, previous) {
4971
+ return !!current && current !== NoopGatewayPlace && previous !== NoopGatewayPlace;
4972
+ }));
4973
+ _this.enableAnimation = valueOf.all(_this.ready, _this.animateModel).areTruthy();
4974
+ _this.placeAnimationOrder = chain(_this.customPlaceAnimationOrderModel)
4975
+ .otherwise(defaultPlaceAnimationOrder)
4976
+ .reduce((/**
4977
+ * @param {?} placesInOrder
4978
+ * @return {?}
4979
+ */
4980
+ function (placesInOrder) {
4981
+ /** @type {?} */
4982
+ var placeIndex = 0;
4983
+ if (activePlaceType.value) {
4984
+ placeIndex = placesInOrder.indexOf(activePlaceType.value);
4985
+ if (isNil(_this.initialPlaceIndex && placeIndex >= 0)) {
4986
+ _this.initialPlaceIndex = placeIndex;
4987
+ }
4988
+ }
4989
+ return isNil(_this.initialPlaceIndex) ? 0 : placeIndex - _this.initialPlaceIndex;
4990
+ }), { dependsOn: activePlaceType });
4991
+ // Push incoming changes into the component
4992
+ _this.routerVisit = chain(_this._activePlace).pluck('placeDefinition').findIn(placeRouter.activeVisitIndex);
4993
+ // Our router visit will change when our active is nullified during deactivation, which will push a null visit
4994
+ // the the deactivated component, which will nuke it's view before the animations have finished.
4995
+ // The visit will alway updated after the router session is finsised (when the new visits are registered) so
4996
+ // we can safely ignore it during outlet changes as these always happen before the router session ends.
4997
+ when.valueOf(_this.routerVisit).changes((/**
4998
+ * @return {?}
4999
+ */
5000
+ function () { return _this.pushRouteChangesToVisit(); }), { unless: _this._inOutletUpdate });
5001
+ // Handle component based changes
5002
+ when.valueOf(_this._activePlaceVisitModel).changes((/**
5003
+ * @param {?} next
5004
+ * @param {?} previous
5005
+ * @return {?}
5006
+ */
5007
+ function (next, previous) {
5008
+ _this.pushVisitChangesToRoute(next, previous);
5009
+ }), {
5010
+ unless: _this.placeRouter.navigationSessionActive
5011
+ });
5012
+ chain(_this._activePlace)
5013
+ .postponeWhile(placeRouter.navigationSessionActive)
5014
+ .subscribe((/**
5015
+ * @param {?} place
5016
+ * @return {?}
5017
+ */
5018
+ function (place) { return _this.placeChanged.emit(place); }));
5172
5019
  return _this;
5020
+ // const txo = new TransactionObserver().onEvent(e => console.log(e.toString()));
5021
+ // txo.observe('inRouteVisitUpdate', inRouteVisitUpdate);
5173
5022
  }
5174
5023
  /**
5175
5024
  * @return {?}
5176
5025
  */
5177
- ListPlaceNavComponent.prototype.expandMenu = /**
5026
+ PlaceOutletComponent.prototype.ngOnInit = /**
5178
5027
  * @return {?}
5179
5028
  */
5180
5029
  function () {
5181
- this.expanded = true;
5182
5030
  };
5031
+ // @Trace()
5032
+ // @Trace()
5183
5033
  /**
5184
5034
  * @return {?}
5185
5035
  */
5186
- ListPlaceNavComponent.prototype.collapseMenu = /**
5036
+ PlaceOutletComponent.prototype.getAnimationOrder =
5037
+ // @Trace()
5038
+ /**
5187
5039
  * @return {?}
5188
5040
  */
5189
5041
  function () {
5190
- this.expanded = false;
5042
+ return this.placeAnimationOrder.value;
5191
5043
  };
5044
+ Object.defineProperty(PlaceOutletComponent.prototype, "animationDuration", {
5045
+ get: /**
5046
+ * @return {?}
5047
+ */
5048
+ function () {
5049
+ return this.placeConfig && this.placeConfig.animationDuration ? this.placeConfig.animationDuration : '500ms';
5050
+ },
5051
+ enumerable: true,
5052
+ configurable: true
5053
+ });
5054
+ // @Trace()
5055
+ // @Trace()
5192
5056
  /**
5057
+ * @param {?} visit
5193
5058
  * @return {?}
5194
5059
  */
5195
- ListPlaceNavComponent.prototype.toggleMenu = /**
5060
+ PlaceOutletComponent.prototype.navigate =
5061
+ // @Trace()
5062
+ /**
5063
+ * @param {?} visit
5196
5064
  * @return {?}
5197
5065
  */
5198
- function () {
5199
- this.expanded = !this.expanded;
5066
+ function (visit) {
5067
+ // console.log({ activatedRoute: this._activatedRouteModel.value });
5068
+ this.placeRouter.navigate(visit, {
5069
+ relativeTo: this.parentOutlet ? this.parentOutlet.activatedRouteModel.value : null
5070
+ });
5200
5071
  };
5201
- ListPlaceNavComponent.decorators = [
5202
- { type: Component, args: [{
5203
- selector: 'aup-list-place-nav',
5204
- template: "<mat-nav-list class=\"app-menu\">\n <a mat-list-item *ngFor=\"let placeDefinition of placeDefinitions.value\"\n [pectinCommand]=\"commandFactory.create(placeDefinition)\"\n [class.active]=\"isActive(placeDefinition)\"\n [matTooltip]=\"getNav(placeDefinition).tooltip()\">\n <mat-icon *ngIf=\"getNav(placeDefinition).icon()\">{{getNav(placeDefinition).icon()}}</mat-icon>\n <span class=\"expanded-only\">{{getNav(placeDefinition).title()}}</span>\n </a>\n</mat-nav-list>\n",
5205
- styles: [":host{display:flex;flex-direction:column;--expanded-width:235px;--nav-item-width:var(--nav-bar-height);width:var(--nav-item-width);transition:width 125ms linear}:host.expanded{width:var(--expanded-width);max-width:var(--expanded-width)}.expanded-only{max-width:0;overflow:hidden}.collapsed-only{max-width:100%;overflow:hidden}.header{display:flex;flex-direction:row;justify-content:flex-end;align-items:center;height:var(--nav-bar-height);border-bottom:var(--pinstripe-border);cursor:pointer}.header .menu{flex:1}.header button{color:inherit;width:var(--nav-item-width);height:var(--nav-bar-height)}mat-nav-list{flex:1;display:flex;flex-direction:column}.mat-list-item{width:var(--nav-item-width);height:var(--nav-bar-height);color:rgba(0,0,0,.6)}.mat-list-item.active{background-color:rgba(0,0,0,.1);color:rgba(0,0,0,.9)}mat-icon{color:inherit}mat-icon.flip-horizontal{transform:scaleX(-1)}:host-context(.expanded) .expanded-only{max-width:100%}:host-context(.expanded) .collapsed-only{max-width:0}:host-context(.expanded) .mat-list-item mat-icon{margin-right:12px}:host-context(.expanded) .mat-list-item span{text-wrap:none;white-space:nowrap}a[ng-reflect-router-link=manage-instruments] mat-icon{transform:rotate(90deg)}.app-menu{padding-top:0}"]
5206
- }] }
5207
- ];
5208
- /** @nocollapse */
5209
- ListPlaceNavComponent.ctorParameters = function () { return []; };
5210
- ListPlaceNavComponent.propDecorators = {
5211
- expanded: [{ type: HostBinding, args: ['class.expanded',] }]
5072
+ Object.defineProperty(PlaceOutletComponent.prototype, "parentOutlet", {
5073
+ get: /**
5074
+ * @return {?}
5075
+ */
5076
+ function () {
5077
+ return this.parentOutletModel.value;
5078
+ },
5079
+ enumerable: true,
5080
+ configurable: true
5081
+ });
5082
+ // @Trace()
5083
+ // @Trace()
5084
+ /**
5085
+ * @return {?}
5086
+ */
5087
+ PlaceOutletComponent.prototype.pushRouteChangesToVisit =
5088
+ // @Trace()
5089
+ /**
5090
+ * @return {?}
5091
+ */
5092
+ function () {
5093
+ var _this = this;
5094
+ /** @type {?} */
5095
+ var visit = this.routerVisit.value;
5096
+ // console.log({
5097
+ // visit,
5098
+ // place: visit ? visit.placeDefinition.component : null,
5099
+ // inOutletActivation: this._inOutletActivation.value,
5100
+ // inRoutingSession: this.placeRouter.navigationSessionActive.value
5101
+ // });
5102
+ if (visit) { // can be null while the place and index sync up
5103
+ this._inRouteVisitUpdate.whileTrue((/**
5104
+ * @return {?}
5105
+ */
5106
+ function () {
5107
+ _this._activePlaceVisitModel.value = visit;
5108
+ }));
5109
+ }
5212
5110
  };
5213
- return ListPlaceNavComponent;
5214
- }(AbstractPlaceNavigationComponent));
5215
- if (false) {
5216
- /** @type {?} */
5217
- ListPlaceNavComponent.prototype.expanded;
5218
- }
5219
-
5220
- /**
5221
- * @fileoverview added by tsickle
5222
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5223
- */
5224
- var TabbedPlaceNavigationComponent = /** @class */ (function (_super) {
5225
- __extends(TabbedPlaceNavigationComponent, _super);
5226
- function TabbedPlaceNavigationComponent() {
5227
- return _super.call(this) || this;
5228
- }
5229
- TabbedPlaceNavigationComponent.decorators = [
5230
- { type: Component, args: [{
5231
- selector: 'aup-tabbed-place-navigation',
5232
- template: "<nav mat-tab-nav-bar>\n <a mat-tab-link *ngFor=\"let placeDefinition of placeDefinitions.value\"\n [pectinCommand]=\"commandFactory.create(placeDefinition)\"\n [active]=\"isActive(placeDefinition)\"\n [matTooltip]=\"getNav(placeDefinition).tooltip()\">\n <mat-icon *ngIf=\"getNav(placeDefinition).icon()\">{{getNav(placeDefinition).icon()}}</mat-icon>\n <span>{{getNav(placeDefinition).title()}}</span>\n </a>\n</nav>\n",
5233
- styles: [""]
5234
- }] }
5235
- ];
5236
- /** @nocollapse */
5237
- TabbedPlaceNavigationComponent.ctorParameters = function () { return []; };
5238
- return TabbedPlaceNavigationComponent;
5239
- }(AbstractPlaceNavigationComponent));
5240
-
5241
- /**
5242
- * @fileoverview added by tsickle
5243
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5244
- */
5245
- var PlaceModule = /** @class */ (function () {
5246
- function PlaceModule() {
5247
- }
5248
- PlaceModule.decorators = [
5249
- { type: NgModule, args: [{
5250
- imports: [
5251
- CommonModule,
5252
- BrowserAnimationsModule,
5253
- MatProgressSpinnerModule,
5254
- RouterModule,
5255
- MatTabsModule,
5256
- MatListModule,
5257
- MatTooltipModule,
5258
- MatIconModule,
5259
- DirectivesModule
5260
- ],
5261
- declarations: [
5262
- EmptyStateComponent,
5263
- BusyOverlayComponent,
5264
- PlaceOutletComponent,
5265
- TabbedPlaceNavigationComponent,
5266
- ListPlaceNavComponent,
5267
- AbstractPlaceNavigationComponent
5268
- ],
5269
- entryComponents: [BusyOverlayComponent],
5270
- exports: [
5271
- BusyOverlayComponent,
5272
- PlaceOutletComponent,
5273
- EmptyStateComponent,
5274
- TabbedPlaceNavigationComponent,
5275
- ListPlaceNavComponent,
5276
- AbstractPlaceNavigationComponent
5277
- ],
5278
- providers: [
5279
- // {provide: AUP_PLACE_CONFIG, useValue: {animationDuration: "2000ms"}}
5280
- ]
5281
- },] }
5282
- ];
5283
- return PlaceModule;
5284
- }());
5285
-
5286
- /**
5287
- * @fileoverview added by tsickle
5288
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5289
- */
5290
- var AngularUiPowerupsModule = /** @class */ (function () {
5291
- function AngularUiPowerupsModule() {
5292
- }
5293
- AngularUiPowerupsModule.decorators = [
5294
- { type: NgModule, args: [{
5295
- declarations: [],
5296
- imports: [
5297
- CommonModule,
5298
- BrowserAnimationsModule,
5299
- FormsModule,
5300
- MatInputModule,
5301
- MatFormFieldModule,
5302
- MatSelectModule,
5303
- MatTabsModule,
5304
- DirectivesModule,
5305
- ComponentsModule,
5306
- PlaceModule,
5307
- InteractionModule
5308
- ],
5309
- exports: [
5310
- InteractionModule,
5311
- PlaceModule,
5312
- DirectivesModule,
5313
- ComponentsModule,
5314
- NoopComponent
5315
- ]
5316
- },] }
5317
- ];
5318
- return AngularUiPowerupsModule;
5319
- }());
5320
-
5321
- /**
5322
- * @fileoverview added by tsickle
5323
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5324
- */
5325
- /** @type {?} */
5326
- var defaultHiddenStyleDef = style({
5327
- opacity: 0,
5328
- 'height': '0',
5329
- paddingTop: '0',
5330
- paddingBottom: '0'
5331
- });
5332
- /**
5333
- * @param {?} triggerName
5334
- * @param {?=} options
5335
- * @return {?}
5336
- */
5337
- function slideDownAndUpAnimation(triggerName, options) {
5338
- // SEE to fix this: https://github.com/angular/angular/issues/15587#issuecomment-351510501
5339
- /** @type {?} */
5340
- var duration = OptionsHelper.get(options).getOptional('duration', '100ms');
5341
- /** @type {?} */
5342
- var hiddenStyleDef = OptionsHelper.get(options).getOptional('hiddenStyleDef', defaultHiddenStyleDef);
5343
- return trigger(triggerName, [
5344
- transition(':enter', [hiddenStyleDef, animate('100ms')]),
5345
- transition(':leave', [animate('100ms', hiddenStyleDef)])
5346
- ]);
5347
- }
5348
-
5349
- /**
5350
- * @fileoverview added by tsickle
5351
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5352
- */
5353
-
5354
- /**
5355
- * @fileoverview added by tsickle
5356
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5357
- */
5358
- var Dimension = /** @class */ (function () {
5359
- function Dimension(width, height) {
5360
- this.width = width;
5361
- this.height = height;
5362
- }
5363
- return Dimension;
5364
- }());
5365
- if (false) {
5366
- /** @type {?} */
5367
- Dimension.prototype.width;
5368
- /** @type {?} */
5369
- Dimension.prototype.height;
5370
- }
5371
-
5372
- /**
5373
- * @fileoverview added by tsickle
5374
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5375
- */
5376
- var Point = /** @class */ (function () {
5377
- function Point(x, y) {
5378
- this.x = x;
5379
- this.y = y;
5380
- }
5381
5111
  /**
5382
- * @param {?} data
5112
+ * @param {?} next
5113
+ * @param {?} previous
5114
+ * @return {?}
5115
+ */
5116
+ PlaceOutletComponent.prototype.pushVisitChangesToRoute = /**
5117
+ * @param {?} next
5118
+ * @param {?} previous
5119
+ * @return {?}
5120
+ */
5121
+ function (next, previous) {
5122
+ /** @type {?} */
5123
+ var activatedRoute = this._activatedRouteModel.value;
5124
+ this.placeRouter.pushVisitChangesToRoute(activatedRoute, previous, next);
5125
+ };
5126
+ Object.defineProperty(PlaceOutletComponent.prototype, "activePlaceModel", {
5127
+ get: /**
5128
+ * @return {?}
5129
+ */
5130
+ function () {
5131
+ return this._activePlace.readonly;
5132
+ },
5133
+ enumerable: true,
5134
+ configurable: true
5135
+ });
5136
+ Object.defineProperty(PlaceOutletComponent.prototype, "activatedRouteModel", {
5137
+ get: /**
5138
+ * @return {?}
5139
+ */
5140
+ function () {
5141
+ return this._activatedRouteModel.readonly;
5142
+ },
5143
+ enumerable: true,
5144
+ configurable: true
5145
+ });
5146
+ // @Trace()
5147
+ // @Trace()
5148
+ /**
5149
+ * @param {?} routerOutlet
5150
+ * @param {?} place
5383
5151
  * @return {?}
5384
5152
  */
5385
- Point.from = /**
5386
- * @param {?} data
5153
+ PlaceOutletComponent.prototype.onOutletActivated =
5154
+ // @Trace()
5155
+ /**
5156
+ * @param {?} routerOutlet
5157
+ * @param {?} place
5387
5158
  * @return {?}
5388
5159
  */
5389
- function (data) {
5390
- return new Point(data.x, data.y);
5160
+ function (routerOutlet, place) {
5161
+ var _this = this;
5162
+ this._inOutletActivation.whileTrue((/**
5163
+ * @return {?}
5164
+ */
5165
+ function () {
5166
+ try {
5167
+ _this._activePlace.value = place;
5168
+ _this._activatedRouteModel.value = routerOutlet.activatedRoute;
5169
+ _this._placeDefinition.value = place.placeDefinition;
5170
+ /** @type {?} */
5171
+ var visitModel = new MutableValueModel();
5172
+ _this._activePlaceVisitModel.setDelegate(visitModel);
5173
+ place.initialiseBindings(visitModel);
5174
+ }
5175
+ catch (error) {
5176
+ console.error(error);
5177
+ }
5178
+ }));
5179
+ if (!this.enableAnimation.value) {
5180
+ // we're not animating so trigger any post animation callbacks now.
5181
+ this.animationDone();
5182
+ }
5391
5183
  };
5184
+ // @Trace()
5185
+ // @Trace()
5392
5186
  /**
5393
- * @param {?} x
5394
- * @param {?} y
5395
5187
  * @return {?}
5396
5188
  */
5397
- Point.prototype.translate = /**
5398
- * @param {?} x
5399
- * @param {?} y
5189
+ PlaceOutletComponent.prototype.onOutletDeactivated =
5190
+ // @Trace()
5191
+ /**
5400
5192
  * @return {?}
5401
5193
  */
5402
- function (x, y) {
5403
- return new Point(this.x + x, this.y + y);
5194
+ function () {
5195
+ var _this = this;
5196
+ this._inOutletDeactivation.whileTrue((/**
5197
+ * @return {?}
5198
+ */
5199
+ function () {
5200
+ _this._previousPlace.value = _this._activePlace.value;
5201
+ _this._activePlace.value = null;
5202
+ _this._activatedRouteModel.value = null;
5203
+ _this._placeDefinition.value = null;
5204
+ _this._activePlaceVisitModel.setDelegate(null);
5205
+ }));
5404
5206
  };
5405
- return Point;
5406
- }());
5407
- if (false) {
5408
- /** @type {?} */
5409
- Point.prototype.x;
5410
- /** @type {?} */
5411
- Point.prototype.y;
5412
- }
5413
-
5414
- /**
5415
- * @fileoverview added by tsickle
5416
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5417
- */
5418
- var Bounds = /** @class */ (function (_super) {
5419
- __extends(Bounds, _super);
5420
- function Bounds(top, left, width, height) {
5421
- var _this = _super.call(this, width, height) || this;
5422
- _this.top = top;
5423
- _this.left = left;
5424
- _this.width = width;
5425
- _this.height = height;
5426
- return _this;
5427
- }
5207
+ // @Trace()
5208
+ // @Trace()
5428
5209
  /**
5429
- * @param {?} point
5430
5210
  * @return {?}
5431
5211
  */
5432
- Bounds.prototype.relativePositionOf = /**
5433
- * @param {?} point
5212
+ PlaceOutletComponent.prototype.animationStarted =
5213
+ // @Trace()
5214
+ /**
5434
5215
  * @return {?}
5435
5216
  */
5436
- function (point) {
5437
- if (point instanceof MouseEvent) {
5438
- return new Point(point.clientX - this.left, point.clientY - this.top);
5439
- }
5440
- else {
5441
- return new Point(point.x - this.left, point.y - this.top);
5217
+ function () {
5218
+ // console.log({ activePlace: this._activePlace.value });
5219
+ };
5220
+ // @Trace()
5221
+ // @Trace()
5222
+ /**
5223
+ * @return {?}
5224
+ */
5225
+ PlaceOutletComponent.prototype.animationDone =
5226
+ // @Trace()
5227
+ /**
5228
+ * @return {?}
5229
+ */
5230
+ function () {
5231
+ if (this._activePlace.value) {
5232
+ this._activePlace.value.onPlaceReady();
5442
5233
  }
5443
5234
  };
5444
- return Bounds;
5445
- }(Dimension));
5235
+ PlaceOutletComponent.decorators = [
5236
+ { type: Component, args: [{
5237
+ selector: 'aup-place-outlet',
5238
+ 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",
5239
+ animations: [LEFT_RIGHT_PLACE_ANIMATION],
5240
+ 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}"]
5241
+ }] }
5242
+ ];
5243
+ /** @nocollapse */
5244
+ PlaceOutletComponent.ctorParameters = function () { return [
5245
+ { type: Router },
5246
+ { type: PlaceRouter },
5247
+ { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [AUP_PLACE_CONFIG,] }] },
5248
+ { type: PlaceOutletComponent, decorators: [{ type: SkipSelf }, { type: Optional }] }
5249
+ ]; };
5250
+ PlaceOutletComponent.propDecorators = {
5251
+ animate: [{ type: Input }],
5252
+ animateModel: [{ type: Input, args: ['animateModel',] }],
5253
+ customPlaceAnimationOrderModel: [{ type: Input, args: ['placeAnimationOrderModel',] }],
5254
+ customPlaceAnimationOrder: [{ type: Input, args: ['placeAnimationOrder',] }],
5255
+ placeChanged: [{ type: Output }],
5256
+ routerOut: [{ type: ViewChild, args: ['routeOutlet', { static: true },] }]
5257
+ };
5258
+ __decorate([
5259
+ StoreInValueModel('animateModel'),
5260
+ __metadata("design:type", Boolean)
5261
+ ], PlaceOutletComponent.prototype, "animate", void 0);
5262
+ __decorate([
5263
+ UseDelegate({ defaultValue: true }),
5264
+ __metadata("design:type", ValueModel)
5265
+ ], PlaceOutletComponent.prototype, "animateModel", void 0);
5266
+ __decorate([
5267
+ UseDelegate(),
5268
+ __metadata("design:type", ListModel)
5269
+ ], PlaceOutletComponent.prototype, "customPlaceAnimationOrderModel", void 0);
5270
+ __decorate([
5271
+ StoreInListModel('customPlaceAnimationOrderModel'),
5272
+ __metadata("design:type", Array)
5273
+ ], PlaceOutletComponent.prototype, "customPlaceAnimationOrder", void 0);
5274
+ return PlaceOutletComponent;
5275
+ }(DisposableComponent));
5446
5276
  if (false) {
5447
5277
  /** @type {?} */
5448
- Bounds.prototype.top;
5278
+ PlaceOutletComponent.prototype.animate;
5449
5279
  /** @type {?} */
5450
- Bounds.prototype.left;
5280
+ PlaceOutletComponent.prototype.animateModel;
5451
5281
  /** @type {?} */
5452
- Bounds.prototype.width;
5282
+ PlaceOutletComponent.prototype.customPlaceAnimationOrderModel;
5283
+ /** @type {?} */
5284
+ PlaceOutletComponent.prototype.customPlaceAnimationOrder;
5285
+ /** @type {?} */
5286
+ PlaceOutletComponent.prototype.placeChanged;
5287
+ /** @type {?} */
5288
+ PlaceOutletComponent.prototype.routerOut;
5289
+ /**
5290
+ * @type {?}
5291
+ * @private
5292
+ */
5293
+ PlaceOutletComponent.prototype._activePlace;
5294
+ /**
5295
+ * @type {?}
5296
+ * @private
5297
+ */
5298
+ PlaceOutletComponent.prototype._previousPlace;
5299
+ /**
5300
+ * @type {?}
5301
+ * @private
5302
+ */
5303
+ PlaceOutletComponent.prototype._activePlaceVisitModel;
5304
+ /**
5305
+ * @type {?}
5306
+ * @private
5307
+ */
5308
+ PlaceOutletComponent.prototype._inOutletActivation;
5309
+ /**
5310
+ * @type {?}
5311
+ * @private
5312
+ */
5313
+ PlaceOutletComponent.prototype._inOutletDeactivation;
5314
+ /**
5315
+ * @type {?}
5316
+ * @private
5317
+ */
5318
+ PlaceOutletComponent.prototype._inOutletUpdate;
5319
+ /**
5320
+ * @type {?}
5321
+ * @private
5322
+ */
5323
+ PlaceOutletComponent.prototype._inRouteVisitUpdate;
5324
+ /**
5325
+ * @type {?}
5326
+ * @private
5327
+ */
5328
+ PlaceOutletComponent.prototype._activatedRouteModel;
5329
+ /**
5330
+ * @type {?}
5331
+ * @private
5332
+ */
5333
+ PlaceOutletComponent.prototype._placeDefinition;
5334
+ /**
5335
+ * @type {?}
5336
+ * @private
5337
+ */
5338
+ PlaceOutletComponent.prototype.parentOutletModel;
5339
+ /** @type {?} */
5340
+ PlaceOutletComponent.prototype.placeAnimationOrder;
5341
+ /**
5342
+ * @type {?}
5343
+ * @private
5344
+ */
5345
+ PlaceOutletComponent.prototype.initialPlaceIndex;
5346
+ /**
5347
+ * @type {?}
5348
+ * @private
5349
+ */
5350
+ PlaceOutletComponent.prototype.routerVisit;
5351
+ /** @type {?} */
5352
+ PlaceOutletComponent.prototype.ready;
5453
5353
  /** @type {?} */
5454
- Bounds.prototype.height;
5455
- }
5456
- (function (Bounds) {
5354
+ PlaceOutletComponent.prototype.enableAnimation;
5457
5355
  /**
5458
- * @param {?} element
5459
- * @return {?}
5356
+ * @type {?}
5357
+ * @private
5460
5358
  */
5461
- function ofElement(element) {
5462
- /** @type {?} */
5463
- var rect = element.getBoundingClientRect();
5464
- return new Bounds(rect.top, rect.left, rect.width, rect.height);
5465
- }
5466
- Bounds.ofElement = ofElement;
5467
- })(Bounds || (Bounds = {}));
5359
+ PlaceOutletComponent.prototype.router;
5360
+ /**
5361
+ * @type {?}
5362
+ * @private
5363
+ */
5364
+ PlaceOutletComponent.prototype.placeRouter;
5365
+ /** @type {?} */
5366
+ PlaceOutletComponent.prototype.placeConfig;
5367
+ }
5468
5368
 
5469
5369
  /**
5470
5370
  * @fileoverview added by tsickle
5471
5371
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5472
5372
  */
5473
- var ResizeAwareComponent = /** @class */ (function (_super) {
5474
- __extends(ResizeAwareComponent, _super);
5475
- function ResizeAwareComponent(elementRef, ngZone) {
5373
+ var AbstractPlaceNavigationComponent = /** @class */ (function (_super) {
5374
+ __extends(AbstractPlaceNavigationComponent, _super);
5375
+ function AbstractPlaceNavigationComponent() {
5476
5376
  var _this = _super.call(this) || this;
5477
- _this.elementRef = elementRef;
5478
- _this.ngZone = ngZone;
5479
- _this._boundsModel = new ValueHolder(new Bounds(0, 0, 0, 0));
5377
+ var _a = Dsl.disposeWith(_this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
5378
+ _this.placeDefinitions = chain(_this.placesModel).map((/**
5379
+ * @param {?} c
5380
+ * @return {?}
5381
+ */
5382
+ function (c) { return PlaceComponent.getDefinition(c); }));
5383
+ _this.commandFactory = Command.createFactory((/**
5384
+ * @param {?} placeDefinition
5385
+ * @return {?}
5386
+ */
5387
+ function (placeDefinition) {
5388
+ _this.placeOutlet.navigate(new Visit(placeDefinition));
5389
+ }));
5390
+ _this.activePlaceDefinition = chain(_this.placeOutletModel).pullValueModel((/**
5391
+ * @param {?} o
5392
+ * @return {?}
5393
+ */
5394
+ function (o) { return o.activePlaceModel; })).pluck("placeDefinition");
5480
5395
  return _this;
5481
5396
  }
5482
5397
  /**
5398
+ * @param {?} placeDef
5483
5399
  * @return {?}
5484
5400
  */
5485
- ResizeAwareComponent.prototype.ngAfterViewInit = /**
5401
+ AbstractPlaceNavigationComponent.prototype.getNav = /**
5402
+ * @param {?} placeDef
5486
5403
  * @return {?}
5487
5404
  */
5488
- function () {
5489
- var _this = this;
5490
- this.updateBounds();
5491
- /** @type {?} */
5492
- var element = this.elementRef.nativeElement;
5405
+ function (placeDef) {
5493
5406
  /** @type {?} */
5494
- var ro = new ResizeObserver((/**
5495
- * @param {?} entries
5496
- * @param {?} observer
5497
- * @return {?}
5498
- */
5499
- function (entries, observer) {
5500
- _this.ngZone.run((/**
5407
+ var navItem = (/** @type {?} */ (placeDef.getPlaceData('nav')));
5408
+ return {
5409
+ title: (/**
5501
5410
  * @return {?}
5502
5411
  */
5503
- function () { return _this.updateBounds(); }));
5504
- }));
5505
- ro.observe(element);
5506
- this.onDispose((/**
5507
- * @return {?}
5508
- */
5509
- function () { return ro.disconnect(); }));
5412
+ function () { return navItem ? navItem.title() : placeDef.searchPlaceData(['navTitle', 'title']); }),
5413
+ tooltip: (/**
5414
+ * @return {?}
5415
+ */
5416
+ function () { return navItem && navItem.tooltip ? navItem.tooltip() : placeDef.getPlaceData('navTooltip', null); }),
5417
+ icon: (/**
5418
+ * @return {?}
5419
+ */
5420
+ function () { return navItem && navItem.icon ? navItem.icon() : placeDef.getPlaceData('navIcon', null); })
5421
+ };
5510
5422
  };
5511
- Object.defineProperty(ResizeAwareComponent.prototype, "boundsModel", {
5512
- get: /**
5513
- * @return {?}
5514
- */
5515
- function () {
5516
- return this._boundsModel.readonly;
5517
- },
5518
- enumerable: true,
5519
- configurable: true
5520
- });
5521
- Object.defineProperty(ResizeAwareComponent.prototype, "nativeElement", {
5522
- get: /**
5523
- * @return {?}
5524
- */
5525
- function () {
5526
- return this.elementRef.nativeElement;
5527
- },
5528
- enumerable: true,
5529
- configurable: true
5530
- });
5531
- // TODO: Make this handle body scroll
5532
- // TODO: Make this handle body scroll
5533
5423
  /**
5534
- * @param {?} point
5424
+ * @param {?} place
5535
5425
  * @return {?}
5536
5426
  */
5537
- ResizeAwareComponent.prototype.relativePositionOf =
5538
- // TODO: Make this handle body scroll
5539
- /**
5540
- * @param {?} point
5427
+ AbstractPlaceNavigationComponent.prototype.isActive = /**
5428
+ * @param {?} place
5541
5429
  * @return {?}
5542
5430
  */
5543
- function (point) {
5544
- return this.bounds.relativePositionOf(point);
5431
+ function (place) {
5432
+ return this.activePlaceDefinition.query().equals(place);
5545
5433
  };
5546
- Object.defineProperty(ResizeAwareComponent.prototype, "bounds", {
5547
- get: /**
5548
- * @return {?}
5549
- */
5550
- function () {
5551
- return this._boundsModel.value;
5552
- },
5553
- enumerable: true,
5554
- configurable: true
5555
- });
5556
5434
  /**
5557
- * @private
5558
5435
  * @return {?}
5559
5436
  */
5560
- ResizeAwareComponent.prototype.updateBounds = /**
5561
- * @private
5437
+ AbstractPlaceNavigationComponent.prototype.ngOnInit = /**
5562
5438
  * @return {?}
5563
5439
  */
5564
5440
  function () {
5565
- this._boundsModel.value = Bounds.ofElement(this.nativeElement);
5566
5441
  };
5567
- return ResizeAwareComponent;
5442
+ AbstractPlaceNavigationComponent.decorators = [
5443
+ { type: Component, args: [{
5444
+ template: ''
5445
+ }] }
5446
+ ];
5447
+ /** @nocollapse */
5448
+ AbstractPlaceNavigationComponent.ctorParameters = function () { return []; };
5449
+ AbstractPlaceNavigationComponent.propDecorators = {
5450
+ places: [{ type: Input }],
5451
+ placesModel: [{ type: Input }],
5452
+ placeOutlet: [{ type: Input }],
5453
+ placeOutletModel: [{ type: Input }]
5454
+ };
5455
+ __decorate([
5456
+ StoreInListModel('placesModel'),
5457
+ __metadata("design:type", Array)
5458
+ ], AbstractPlaceNavigationComponent.prototype, "places", void 0);
5459
+ __decorate([
5460
+ UseDelegate(),
5461
+ __metadata("design:type", ListModel)
5462
+ ], AbstractPlaceNavigationComponent.prototype, "placesModel", void 0);
5463
+ __decorate([
5464
+ StoreInValueModel('placeOutletModel'),
5465
+ __metadata("design:type", PlaceOutletComponent)
5466
+ ], AbstractPlaceNavigationComponent.prototype, "placeOutlet", void 0);
5467
+ __decorate([
5468
+ UseDelegate(),
5469
+ __metadata("design:type", ValueModel)
5470
+ ], AbstractPlaceNavigationComponent.prototype, "placeOutletModel", void 0);
5471
+ __decorate([
5472
+ Memoize(),
5473
+ __metadata("design:type", Function),
5474
+ __metadata("design:paramtypes", [PlaceDefinition]),
5475
+ __metadata("design:returntype", Object)
5476
+ ], AbstractPlaceNavigationComponent.prototype, "getNav", null);
5477
+ return AbstractPlaceNavigationComponent;
5568
5478
  }(DisposableComponent));
5569
5479
  if (false) {
5570
- /**
5571
- * @type {?}
5572
- * @private
5573
- */
5574
- ResizeAwareComponent.prototype._boundsModel;
5575
- /**
5576
- * @type {?}
5577
- * @protected
5578
- */
5579
- ResizeAwareComponent.prototype.elementRef;
5580
- /**
5581
- * @type {?}
5582
- * @protected
5583
- */
5584
- ResizeAwareComponent.prototype.ngZone;
5480
+ /** @type {?} */
5481
+ AbstractPlaceNavigationComponent.prototype.places;
5482
+ /** @type {?} */
5483
+ AbstractPlaceNavigationComponent.prototype.placesModel;
5484
+ /** @type {?} */
5485
+ AbstractPlaceNavigationComponent.prototype.placeOutlet;
5486
+ /** @type {?} */
5487
+ AbstractPlaceNavigationComponent.prototype.placeOutletModel;
5488
+ /** @type {?} */
5489
+ AbstractPlaceNavigationComponent.prototype.placeDefinitions;
5490
+ /** @type {?} */
5491
+ AbstractPlaceNavigationComponent.prototype.commandFactory;
5492
+ /** @type {?} */
5493
+ AbstractPlaceNavigationComponent.prototype.activePlaceDefinition;
5585
5494
  }
5586
5495
 
5587
5496
  /**
5588
5497
  * @fileoverview added by tsickle
5589
5498
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5590
5499
  */
5591
-
5592
- /**
5593
- * @fileoverview added by tsickle
5594
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5595
- */
5596
-
5597
- /**
5598
- * @fileoverview added by tsickle
5599
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5600
- */
5601
- /**
5602
- * @record
5603
- */
5604
- function Alert() { }
5605
- if (false) {
5606
- /**
5607
- * @return {?}
5608
- */
5609
- Alert.prototype.title = function () { };
5500
+ var BusyOverlayComponent = /** @class */ (function () {
5501
+ function BusyOverlayComponent() {
5502
+ }
5610
5503
  /**
5611
5504
  * @return {?}
5612
5505
  */
5613
- Alert.prototype.content = function () { };
5614
- /**
5506
+ BusyOverlayComponent.prototype.ngOnInit = /**
5615
5507
  * @return {?}
5616
5508
  */
5617
- Alert.prototype.ok = function () { };
5509
+ function () {
5510
+ };
5511
+ BusyOverlayComponent.decorators = [
5512
+ { type: Component, args: [{
5513
+ selector: 'aup-busy-overlay',
5514
+ template: "<ng-content></ng-content>\n<div class=\"busy-overlay-backdrop\" *ngIf=\"busyModel.value\">\n <mat-progress-spinner mode=\"indeterminate\" [diameter]=\"52\"></mat-progress-spinner>\n</div>\n",
5515
+ styles: [":host{position:relative}div.busy-overlay-backdrop{position:absolute;background-color:rgba(0,0,0,.2);top:0;left:0;bottom:0;right:0;display:-ms-grid;display:grid;-ms-grid-columns:auto;grid-template-columns:auto;-ms-grid-rows:auto;grid-template-rows:auto;place-content:center}"]
5516
+ }] }
5517
+ ];
5518
+ /** @nocollapse */
5519
+ BusyOverlayComponent.ctorParameters = function () { return []; };
5520
+ BusyOverlayComponent.propDecorators = {
5521
+ busyModel: [{ type: Input }],
5522
+ busy: [{ type: Input }]
5523
+ };
5524
+ __decorate([
5525
+ UseDelegate(),
5526
+ __metadata("design:type", ValueModel)
5527
+ ], BusyOverlayComponent.prototype, "busyModel", void 0);
5528
+ __decorate([
5529
+ StoreInValueModel('busyModel'),
5530
+ __metadata("design:type", Boolean)
5531
+ ], BusyOverlayComponent.prototype, "busy", void 0);
5532
+ return BusyOverlayComponent;
5533
+ }());
5534
+ if (false) {
5535
+ /** @type {?} */
5536
+ BusyOverlayComponent.prototype.busyModel;
5537
+ /** @type {?} */
5538
+ BusyOverlayComponent.prototype.busy;
5618
5539
  }
5619
5540
 
5620
5541
  /**
5621
5542
  * @fileoverview added by tsickle
5622
5543
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5623
5544
  */
5624
- /**
5625
- * @record
5626
- */
5627
- function Confirm() { }
5628
- if (false) {
5629
- /** @type {?|undefined} */
5630
- Confirm.prototype.destructive;
5545
+ var EmptyStateComponent = /** @class */ (function () {
5546
+ function EmptyStateComponent() {
5547
+ }
5631
5548
  /**
5632
5549
  * @return {?}
5633
5550
  */
5634
- Confirm.prototype.cancel = function () { };
5635
- }
5636
-
5637
- /**
5638
- * @fileoverview added by tsickle
5639
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5640
- */
5641
- /**
5642
- * @record
5643
- * @template R, E
5644
- */
5645
- function Result() { }
5646
- (function (Result) {
5647
- /**
5648
- * @record
5649
- * @template R, E
5551
+ EmptyStateComponent.prototype.ngOnInit = /**
5552
+ * @return {?}
5650
5553
  */
5651
- function Callback() { }
5652
- Result.Callback = Callback;
5653
- if (false) {
5654
- /** @type {?} */
5655
- Callback.prototype.then;
5656
- /** @type {?} */
5657
- Callback.prototype.catch;
5658
- }
5659
- })(Result || (Result = {}));
5554
+ function () {
5555
+ };
5556
+ EmptyStateComponent.decorators = [
5557
+ { type: Component, args: [{
5558
+ selector: 'aup-empty-state',
5559
+ template: "\n <div class=\"container\">\n <ng-content></ng-content>\n </div>\n ",
5560
+ styles: [":host{display:flex;flex-direction:column;justify-content:center;align-items:center}.container{padding:var(--aup-default-padding);border:2px dashed rgba(0,0,0,.2);border-radius:5px;font-size:14px;font-weight:300}"]
5561
+ }] }
5562
+ ];
5563
+ /** @nocollapse */
5564
+ EmptyStateComponent.ctorParameters = function () { return []; };
5565
+ return EmptyStateComponent;
5566
+ }());
5660
5567
 
5661
5568
  /**
5662
5569
  * @fileoverview added by tsickle
5663
5570
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5664
5571
  */
5665
- /**
5666
- * @record
5667
- * @template D, R, E
5668
- */
5669
- function ActivityOutletContext() { }
5670
- if (false) {
5671
- /** @type {?} */
5672
- ActivityOutletContext.prototype.activityClass;
5673
- /** @type {?} */
5674
- ActivityOutletContext.prototype.activityData;
5572
+ var ListPlaceNavComponent = /** @class */ (function (_super) {
5573
+ __extends(ListPlaceNavComponent, _super);
5574
+ function ListPlaceNavComponent() {
5575
+ var _this = _super.call(this) || this;
5576
+ _this.expanded = true;
5577
+ return _this;
5578
+ }
5675
5579
  /**
5676
- * @param {?} component
5677
5580
  * @return {?}
5678
5581
  */
5679
- ActivityOutletContext.prototype.componentReady = function (component) { };
5680
- }
5681
-
5682
- /**
5683
- * @fileoverview added by tsickle
5684
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5685
- */
5686
- var InteractionGuard = /** @class */ (function () {
5687
- function InteractionGuard(router, injector, interactionContext) {
5688
- this.router = router;
5689
- this.injector = injector;
5690
- this.interactionContext = interactionContext;
5691
- }
5582
+ ListPlaceNavComponent.prototype.expandMenu = /**
5583
+ * @return {?}
5584
+ */
5585
+ function () {
5586
+ this.expanded = true;
5587
+ };
5692
5588
  /**
5693
- * @param {?} route
5694
- * @param {?} state
5695
5589
  * @return {?}
5696
5590
  */
5697
- InteractionGuard.prototype.canActivate = /**
5698
- * @param {?} route
5699
- * @param {?} state
5591
+ ListPlaceNavComponent.prototype.collapseMenu = /**
5700
5592
  * @return {?}
5701
5593
  */
5702
- function (route, state) {
5703
- return true;
5594
+ function () {
5595
+ this.expanded = false;
5704
5596
  };
5705
5597
  /**
5706
- * @param {?} component
5707
- * @param {?} currentRoute
5708
- * @param {?} currentState
5709
- * @param {?=} nextState
5710
5598
  * @return {?}
5711
5599
  */
5712
- InteractionGuard.prototype.canDeactivate = /**
5713
- * @param {?} component
5714
- * @param {?} currentRoute
5715
- * @param {?} currentState
5716
- * @param {?=} nextState
5600
+ ListPlaceNavComponent.prototype.toggleMenu = /**
5717
5601
  * @return {?}
5718
5602
  */
5719
- function (component, currentRoute, currentState, nextState) {
5720
- return !this.interactionContext.isActive();
5603
+ function () {
5604
+ this.expanded = !this.expanded;
5721
5605
  };
5722
- InteractionGuard.decorators = [
5723
- { type: Injectable, args: [{
5724
- providedIn: 'root'
5725
- },] }
5606
+ ListPlaceNavComponent.decorators = [
5607
+ { type: Component, args: [{
5608
+ selector: 'aup-list-place-nav',
5609
+ template: "<mat-nav-list class=\"app-menu\">\n <a mat-list-item *ngFor=\"let placeDefinition of placeDefinitions.value\"\n [pectinCommand]=\"commandFactory.create(placeDefinition)\"\n [class.active]=\"isActive(placeDefinition)\"\n [matTooltip]=\"getNav(placeDefinition).tooltip()\">\n <mat-icon *ngIf=\"getNav(placeDefinition).icon()\">{{getNav(placeDefinition).icon()}}</mat-icon>\n <span class=\"expanded-only\">{{getNav(placeDefinition).title()}}</span>\n </a>\n</mat-nav-list>\n",
5610
+ styles: [":host{display:flex;flex-direction:column;--expanded-width:235px;--nav-item-width:var(--nav-bar-height);width:var(--nav-item-width);transition:width 125ms linear}:host.expanded{width:var(--expanded-width);max-width:var(--expanded-width)}.expanded-only{max-width:0;overflow:hidden}.collapsed-only{max-width:100%;overflow:hidden}.header{display:flex;flex-direction:row;justify-content:flex-end;align-items:center;height:var(--nav-bar-height);border-bottom:var(--pinstripe-border);cursor:pointer}.header .menu{flex:1}.header button{color:inherit;width:var(--nav-item-width);height:var(--nav-bar-height)}mat-nav-list{flex:1;display:flex;flex-direction:column}.mat-list-item{width:var(--nav-item-width);height:var(--nav-bar-height);color:rgba(0,0,0,.6)}.mat-list-item.active{background-color:rgba(0,0,0,.1);color:rgba(0,0,0,.9)}mat-icon{color:inherit}mat-icon.flip-horizontal{transform:scaleX(-1)}:host-context(.expanded) .expanded-only{max-width:100%}:host-context(.expanded) .collapsed-only{max-width:0}:host-context(.expanded) .mat-list-item mat-icon{margin-right:12px}:host-context(.expanded) .mat-list-item span{text-wrap:none;white-space:nowrap}a[ng-reflect-router-link=manage-instruments] mat-icon{transform:rotate(90deg)}.app-menu{padding-top:0}"]
5611
+ }] }
5726
5612
  ];
5727
5613
  /** @nocollapse */
5728
- InteractionGuard.ctorParameters = function () { return [
5729
- { type: Router },
5730
- { type: Injector },
5731
- { type: InteractionContext }
5732
- ]; };
5733
- /** @nocollapse */ InteractionGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function InteractionGuard_Factory() { return new InteractionGuard(ɵɵinject(Router), ɵɵinject(INJECTOR), ɵɵinject(InteractionContext)); }, token: InteractionGuard, providedIn: "root" });
5734
- __decorate([
5735
- Trace(),
5736
- __metadata("design:type", Function),
5737
- __metadata("design:paramtypes", [ActivatedRouteSnapshot, RouterStateSnapshot]),
5738
- __metadata("design:returntype", Object)
5739
- ], InteractionGuard.prototype, "canActivate", null);
5740
- __decorate([
5741
- Trace(),
5742
- __metadata("design:type", Function),
5743
- __metadata("design:paramtypes", [NoopComponent, ActivatedRouteSnapshot, RouterStateSnapshot, RouterStateSnapshot]),
5744
- __metadata("design:returntype", Object)
5745
- ], InteractionGuard.prototype, "canDeactivate", null);
5746
- return InteractionGuard;
5747
- }());
5614
+ ListPlaceNavComponent.ctorParameters = function () { return []; };
5615
+ ListPlaceNavComponent.propDecorators = {
5616
+ expanded: [{ type: HostBinding, args: ['class.expanded',] }]
5617
+ };
5618
+ return ListPlaceNavComponent;
5619
+ }(AbstractPlaceNavigationComponent));
5748
5620
  if (false) {
5749
- /**
5750
- * @type {?}
5751
- * @private
5752
- */
5753
- InteractionGuard.prototype.router;
5754
- /**
5755
- * @type {?}
5756
- * @private
5757
- */
5758
- InteractionGuard.prototype.injector;
5759
- /**
5760
- * @type {?}
5761
- * @private
5762
- */
5763
- InteractionGuard.prototype.interactionContext;
5621
+ /** @type {?} */
5622
+ ListPlaceNavComponent.prototype.expanded;
5764
5623
  }
5765
5624
 
5766
5625
  /**
5767
5626
  * @fileoverview added by tsickle
5768
5627
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5769
5628
  */
5629
+ var TabbedPlaceNavigationComponent = /** @class */ (function (_super) {
5630
+ __extends(TabbedPlaceNavigationComponent, _super);
5631
+ function TabbedPlaceNavigationComponent() {
5632
+ return _super.call(this) || this;
5633
+ }
5634
+ TabbedPlaceNavigationComponent.decorators = [
5635
+ { type: Component, args: [{
5636
+ selector: 'aup-tabbed-place-navigation',
5637
+ template: "<nav mat-tab-nav-bar>\n <a mat-tab-link *ngFor=\"let placeDefinition of placeDefinitions.value\"\n [pectinCommand]=\"commandFactory.create(placeDefinition)\"\n [active]=\"isActive(placeDefinition)\"\n [matTooltip]=\"getNav(placeDefinition).tooltip()\">\n <mat-icon *ngIf=\"getNav(placeDefinition).icon()\">{{getNav(placeDefinition).icon()}}</mat-icon>\n <span>{{getNav(placeDefinition).title()}}</span>\n </a>\n</nav>\n",
5638
+ styles: [""]
5639
+ }] }
5640
+ ];
5641
+ /** @nocollapse */
5642
+ TabbedPlaceNavigationComponent.ctorParameters = function () { return []; };
5643
+ return TabbedPlaceNavigationComponent;
5644
+ }(AbstractPlaceNavigationComponent));
5645
+
5646
+ /**
5647
+ * @fileoverview added by tsickle
5648
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5649
+ */
5650
+ var PlaceModule = /** @class */ (function () {
5651
+ function PlaceModule() {
5652
+ }
5653
+ PlaceModule.decorators = [
5654
+ { type: NgModule, args: [{
5655
+ imports: [
5656
+ CommonModule,
5657
+ BrowserAnimationsModule,
5658
+ MatProgressSpinnerModule,
5659
+ RouterModule,
5660
+ MatTabsModule,
5661
+ MatListModule,
5662
+ MatTooltipModule,
5663
+ MatIconModule,
5664
+ DirectivesModule
5665
+ ],
5666
+ declarations: [
5667
+ EmptyStateComponent,
5668
+ BusyOverlayComponent,
5669
+ PlaceOutletComponent,
5670
+ TabbedPlaceNavigationComponent,
5671
+ ListPlaceNavComponent,
5672
+ AbstractPlaceNavigationComponent,
5673
+ NoopGatewayPlace
5674
+ ],
5675
+ entryComponents: [BusyOverlayComponent],
5676
+ exports: [
5677
+ BusyOverlayComponent,
5678
+ PlaceOutletComponent,
5679
+ EmptyStateComponent,
5680
+ TabbedPlaceNavigationComponent,
5681
+ ListPlaceNavComponent,
5682
+ AbstractPlaceNavigationComponent
5683
+ ],
5684
+ providers: [
5685
+ // {provide: AUP_PLACE_CONFIG, useValue: {animationDuration: "2000ms"}}
5686
+ ]
5687
+ },] }
5688
+ ];
5689
+ return PlaceModule;
5690
+ }());
5691
+
5692
+ /**
5693
+ * @fileoverview added by tsickle
5694
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5695
+ */
5696
+ var AngularUiPowerupsModule = /** @class */ (function () {
5697
+ function AngularUiPowerupsModule() {
5698
+ }
5699
+ AngularUiPowerupsModule.decorators = [
5700
+ { type: NgModule, args: [{
5701
+ declarations: [],
5702
+ imports: [
5703
+ CommonModule,
5704
+ BrowserAnimationsModule,
5705
+ FormsModule,
5706
+ MatInputModule,
5707
+ MatFormFieldModule,
5708
+ MatSelectModule,
5709
+ MatTabsModule,
5710
+ DirectivesModule,
5711
+ ComponentsModule,
5712
+ PlaceModule,
5713
+ InteractionModule
5714
+ ],
5715
+ exports: [
5716
+ InteractionModule,
5717
+ PlaceModule,
5718
+ DirectivesModule,
5719
+ ComponentsModule,
5720
+ NoopComponent
5721
+ ]
5722
+ },] }
5723
+ ];
5724
+ return AngularUiPowerupsModule;
5725
+ }());
5726
+
5727
+ /**
5728
+ * @fileoverview added by tsickle
5729
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5730
+ */
5731
+ /** @type {?} */
5732
+ var defaultHiddenStyleDef = style({
5733
+ opacity: 0,
5734
+ 'height': '0',
5735
+ paddingTop: '0',
5736
+ paddingBottom: '0'
5737
+ });
5738
+ /**
5739
+ * @param {?} triggerName
5740
+ * @param {?=} options
5741
+ * @return {?}
5742
+ */
5743
+ function slideDownAndUpAnimation(triggerName, options) {
5744
+ // SEE to fix this: https://github.com/angular/angular/issues/15587#issuecomment-351510501
5745
+ /** @type {?} */
5746
+ var duration = OptionsHelper.get(options).getOptional('duration', '100ms');
5747
+ /** @type {?} */
5748
+ var hiddenStyleDef = OptionsHelper.get(options).getOptional('hiddenStyleDef', defaultHiddenStyleDef);
5749
+ return trigger(triggerName, [
5750
+ transition(':enter', [hiddenStyleDef, animate('100ms')]),
5751
+ transition(':leave', [animate('100ms', hiddenStyleDef)])
5752
+ ]);
5753
+ }
5770
5754
 
5771
5755
  /**
5772
5756
  * @fileoverview added by tsickle
5773
5757
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5774
5758
  */
5759
+
5775
5760
  /**
5776
- * @record
5761
+ * @fileoverview added by tsickle
5762
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5777
5763
  */
5778
- function NavItem() { }
5764
+ var Dimension = /** @class */ (function () {
5765
+ function Dimension(width, height) {
5766
+ this.width = width;
5767
+ this.height = height;
5768
+ }
5769
+ return Dimension;
5770
+ }());
5779
5771
  if (false) {
5772
+ /** @type {?} */
5773
+ Dimension.prototype.width;
5774
+ /** @type {?} */
5775
+ Dimension.prototype.height;
5776
+ }
5777
+
5778
+ /**
5779
+ * @fileoverview added by tsickle
5780
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5781
+ */
5782
+ var Point = /** @class */ (function () {
5783
+ function Point(x, y) {
5784
+ this.x = x;
5785
+ this.y = y;
5786
+ }
5780
5787
  /**
5788
+ * @param {?} data
5781
5789
  * @return {?}
5782
5790
  */
5783
- NavItem.prototype.title = function () { };
5784
- /**
5791
+ Point.from = /**
5792
+ * @param {?} data
5785
5793
  * @return {?}
5786
5794
  */
5787
- NavItem.prototype.icon = function () { };
5795
+ function (data) {
5796
+ return new Point(data.x, data.y);
5797
+ };
5788
5798
  /**
5799
+ * @param {?} x
5800
+ * @param {?} y
5789
5801
  * @return {?}
5790
5802
  */
5791
- NavItem.prototype.tooltip = function () { };
5803
+ Point.prototype.translate = /**
5804
+ * @param {?} x
5805
+ * @param {?} y
5806
+ * @return {?}
5807
+ */
5808
+ function (x, y) {
5809
+ return new Point(this.x + x, this.y + y);
5810
+ };
5811
+ return Point;
5812
+ }());
5813
+ if (false) {
5814
+ /** @type {?} */
5815
+ Point.prototype.x;
5816
+ /** @type {?} */
5817
+ Point.prototype.y;
5792
5818
  }
5793
5819
 
5794
5820
  /**
5795
5821
  * @fileoverview added by tsickle
5796
5822
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5797
5823
  */
5798
- /**
5799
- * @param {?} options
5800
- * @return {?}
5801
- */
5802
- function Place(options) {
5803
- return (/**
5804
- * @param {?} target
5824
+ var Bounds = /** @class */ (function (_super) {
5825
+ __extends(Bounds, _super);
5826
+ function Bounds(top, left, width, height) {
5827
+ var _this = _super.call(this, width, height) || this;
5828
+ _this.top = top;
5829
+ _this.left = left;
5830
+ _this.width = width;
5831
+ _this.height = height;
5832
+ return _this;
5833
+ }
5834
+ /**
5835
+ * @param {?} point
5805
5836
  * @return {?}
5806
5837
  */
5807
- function (target) {
5808
- if (PlaceComponent.isPlaceComponentConstructor(target)) {
5809
- PlaceComponent.injectDefinition(target, new PlaceDefinition(target, options.path, isNil(options.authenticate) ? false : options.authenticate, options.data, PlaceComponent.getRouteParameters(target), (options.children || []).map((/**
5810
- * @param {?} c
5811
- * @return {?}
5812
- */
5813
- function (c) { return PlaceComponent.getDefinition(c); }))));
5838
+ Bounds.prototype.relativePositionOf = /**
5839
+ * @param {?} point
5840
+ * @return {?}
5841
+ */
5842
+ function (point) {
5843
+ if (point instanceof MouseEvent) {
5844
+ return new Point(point.clientX - this.left, point.clientY - this.top);
5814
5845
  }
5815
5846
  else {
5816
- lang.illegalState(target + " must extend PlaceComponent to use the @Place decorator");
5847
+ return new Point(point.x - this.left, point.y - this.top);
5817
5848
  }
5818
- });
5849
+ };
5850
+ return Bounds;
5851
+ }(Dimension));
5852
+ if (false) {
5853
+ /** @type {?} */
5854
+ Bounds.prototype.top;
5855
+ /** @type {?} */
5856
+ Bounds.prototype.left;
5857
+ /** @type {?} */
5858
+ Bounds.prototype.width;
5859
+ /** @type {?} */
5860
+ Bounds.prototype.height;
5819
5861
  }
5820
- (function (Place) {
5862
+ (function (Bounds) {
5821
5863
  /**
5822
- * @record
5864
+ * @param {?} element
5865
+ * @return {?}
5823
5866
  */
5824
- function Options() { }
5825
- Place.Options = Options;
5826
- if (false) {
5867
+ function ofElement(element) {
5827
5868
  /** @type {?} */
5828
- Options.prototype.path;
5829
- /** @type {?|undefined} */
5830
- Options.prototype.data;
5831
- /** @type {?|undefined} */
5832
- Options.prototype.authenticate;
5833
- /** @type {?|undefined} */
5834
- Options.prototype.children;
5835
- /** @type {?|undefined} */
5836
- Options.prototype.defaultChild;
5869
+ var rect = element.getBoundingClientRect();
5870
+ return new Bounds(rect.top, rect.left, rect.width, rect.height);
5837
5871
  }
5838
- })(Place || (Place = {}));
5872
+ Bounds.ofElement = ofElement;
5873
+ })(Bounds || (Bounds = {}));
5839
5874
 
5840
5875
  /**
5841
5876
  * @fileoverview added by tsickle
5842
5877
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5843
5878
  */
5844
- // WARNING: interface has both a type and a value, skipping emit
5845
- var Formatter;
5846
- (function (Formatter) {
5847
- var StringType = /** @class */ (function () {
5848
- function StringType() {
5849
- }
5850
- /**
5851
- * @param {?} value
5852
- * @return {?}
5853
- */
5854
- StringType.prototype.format = /**
5855
- * @param {?} value
5856
- * @return {?}
5857
- */
5858
- function (value) {
5859
- return value;
5860
- };
5861
- /**
5862
- * @param {?} value
5863
- * @return {?}
5864
- */
5865
- StringType.prototype.parse = /**
5866
- * @param {?} value
5867
- * @return {?}
5868
- */
5869
- function (value) {
5870
- return value;
5871
- };
5872
- return StringType;
5873
- }());
5874
- var NumberType = /** @class */ (function () {
5875
- function NumberType() {
5876
- }
5877
- /**
5878
- * @param {?} value
5879
- * @return {?}
5880
- */
5881
- NumberType.prototype.format = /**
5882
- * @param {?} value
5883
- * @return {?}
5884
- */
5885
- function (value) {
5886
- return ___default.isNumber(value) && !___default.isNaN(value) ? "" + value : null;
5887
- };
5888
- /**
5889
- * @param {?} value
5890
- * @return {?}
5891
- */
5892
- NumberType.prototype.parse = /**
5893
- * @param {?} value
5879
+ var ResizeAwareComponent = /** @class */ (function (_super) {
5880
+ __extends(ResizeAwareComponent, _super);
5881
+ function ResizeAwareComponent(elementRef, ngZone) {
5882
+ var _this = _super.call(this) || this;
5883
+ _this.elementRef = elementRef;
5884
+ _this.ngZone = ngZone;
5885
+ _this._boundsModel = new ValueHolder(new Bounds(0, 0, 0, 0));
5886
+ return _this;
5887
+ }
5888
+ /**
5889
+ * @return {?}
5890
+ */
5891
+ ResizeAwareComponent.prototype.ngAfterViewInit = /**
5892
+ * @return {?}
5893
+ */
5894
+ function () {
5895
+ var _this = this;
5896
+ this.updateBounds();
5897
+ /** @type {?} */
5898
+ var element = this.elementRef.nativeElement;
5899
+ /** @type {?} */
5900
+ var ro = new ResizeObserver((/**
5901
+ * @param {?} entries
5902
+ * @param {?} observer
5894
5903
  * @return {?}
5895
5904
  */
5896
- function (value) {
5897
- /** @type {?} */
5898
- var parsed = Number.parseFloat(value);
5899
- return ___default.isNaN(parsed) ? null : parsed;
5900
- };
5901
- return NumberType;
5902
- }());
5903
- var BooleanType = /** @class */ (function () {
5904
- function BooleanType() {
5905
- }
5906
- /**
5907
- * @param {?} value
5905
+ function (entries, observer) {
5906
+ _this.ngZone.run((/**
5907
+ * @return {?}
5908
+ */
5909
+ function () { return _this.updateBounds(); }));
5910
+ }));
5911
+ ro.observe(element);
5912
+ this.onDispose((/**
5908
5913
  * @return {?}
5909
5914
  */
5910
- BooleanType.prototype.format = /**
5911
- * @param {?} value
5915
+ function () { return ro.disconnect(); }));
5916
+ };
5917
+ Object.defineProperty(ResizeAwareComponent.prototype, "boundsModel", {
5918
+ get: /**
5912
5919
  * @return {?}
5913
5920
  */
5914
- function (value) {
5915
- return value ? 'true' : 'false';
5916
- };
5917
- /**
5918
- * @param {?} value
5921
+ function () {
5922
+ return this._boundsModel.readonly;
5923
+ },
5924
+ enumerable: true,
5925
+ configurable: true
5926
+ });
5927
+ Object.defineProperty(ResizeAwareComponent.prototype, "nativeElement", {
5928
+ get: /**
5919
5929
  * @return {?}
5920
5930
  */
5921
- BooleanType.prototype.parse = /**
5922
- * @param {?} value
5931
+ function () {
5932
+ return this.elementRef.nativeElement;
5933
+ },
5934
+ enumerable: true,
5935
+ configurable: true
5936
+ });
5937
+ // TODO: Make this handle body scroll
5938
+ // TODO: Make this handle body scroll
5939
+ /**
5940
+ * @param {?} point
5941
+ * @return {?}
5942
+ */
5943
+ ResizeAwareComponent.prototype.relativePositionOf =
5944
+ // TODO: Make this handle body scroll
5945
+ /**
5946
+ * @param {?} point
5947
+ * @return {?}
5948
+ */
5949
+ function (point) {
5950
+ return this.bounds.relativePositionOf(point);
5951
+ };
5952
+ Object.defineProperty(ResizeAwareComponent.prototype, "bounds", {
5953
+ get: /**
5923
5954
  * @return {?}
5924
5955
  */
5925
- function (value) {
5926
- return value === 'true';
5927
- };
5928
- return BooleanType;
5929
- }());
5930
- Formatter.STRING = new StringType();
5931
- Formatter.NUMBER = new NumberType();
5932
- Formatter.BOOLEAN = new BooleanType();
5933
- })(Formatter || (Formatter = {}));
5956
+ function () {
5957
+ return this._boundsModel.value;
5958
+ },
5959
+ enumerable: true,
5960
+ configurable: true
5961
+ });
5962
+ /**
5963
+ * @private
5964
+ * @return {?}
5965
+ */
5966
+ ResizeAwareComponent.prototype.updateBounds = /**
5967
+ * @private
5968
+ * @return {?}
5969
+ */
5970
+ function () {
5971
+ this._boundsModel.value = Bounds.ofElement(this.nativeElement);
5972
+ };
5973
+ return ResizeAwareComponent;
5974
+ }(DisposableComponent));
5975
+ if (false) {
5976
+ /**
5977
+ * @type {?}
5978
+ * @private
5979
+ */
5980
+ ResizeAwareComponent.prototype._boundsModel;
5981
+ /**
5982
+ * @type {?}
5983
+ * @protected
5984
+ */
5985
+ ResizeAwareComponent.prototype.elementRef;
5986
+ /**
5987
+ * @type {?}
5988
+ * @protected
5989
+ */
5990
+ ResizeAwareComponent.prototype.ngZone;
5991
+ }
5934
5992
 
5935
5993
  /**
5936
5994
  * @fileoverview added by tsickle
5937
5995
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5938
5996
  */
5997
+
5939
5998
  /**
5940
- * @record
5999
+ * @fileoverview added by tsickle
6000
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
6001
+ */
6002
+
6003
+ /**
6004
+ * @fileoverview added by tsickle
6005
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5941
6006
  */
5942
- function JsonArray() { }
5943
6007
  /**
5944
6008
  * @record
5945
6009
  */
5946
- function JsonMap() { }
6010
+ function Alert() { }
6011
+ if (false) {
6012
+ /**
6013
+ * @return {?}
6014
+ */
6015
+ Alert.prototype.title = function () { };
6016
+ /**
6017
+ * @return {?}
6018
+ */
6019
+ Alert.prototype.content = function () { };
6020
+ /**
6021
+ * @return {?}
6022
+ */
6023
+ Alert.prototype.ok = function () { };
6024
+ }
5947
6025
 
5948
6026
  /**
5949
6027
  * @fileoverview added by tsickle
@@ -5951,131 +6029,150 @@ function JsonMap() { }
5951
6029
  */
5952
6030
  /**
5953
6031
  * @record
5954
- * @template T
5955
6032
  */
5956
- function RouteIdOptions() { }
6033
+ function Confirm() { }
5957
6034
  if (false) {
5958
6035
  /** @type {?|undefined} */
5959
- RouteIdOptions.prototype.as;
5960
- /** @type {?|undefined} */
5961
- RouteIdOptions.prototype.optional;
5962
- /** @type {?|undefined} */
5963
- RouteIdOptions.prototype.remember;
5964
- /** @type {?|undefined} */
5965
- RouteIdOptions.prototype.defaultValue;
6036
+ Confirm.prototype.destructive;
6037
+ /**
6038
+ * @return {?}
6039
+ */
6040
+ Confirm.prototype.cancel = function () { };
5966
6041
  }
6042
+
6043
+ /**
6044
+ * @fileoverview added by tsickle
6045
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
6046
+ */
5967
6047
  /**
5968
6048
  * @record
5969
- * @template T
6049
+ * @template R, E
6050
+ */
6051
+ function Result() { }
6052
+ (function (Result) {
6053
+ /**
6054
+ * @record
6055
+ * @template R, E
6056
+ */
6057
+ function Callback() { }
6058
+ Result.Callback = Callback;
6059
+ if (false) {
6060
+ /** @type {?} */
6061
+ Callback.prototype.then;
6062
+ /** @type {?} */
6063
+ Callback.prototype.catch;
6064
+ }
6065
+ })(Result || (Result = {}));
6066
+
6067
+ /**
6068
+ * @fileoverview added by tsickle
6069
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
5970
6070
  */
5971
- function RouteParameterOptions() { }
5972
- if (false) {
5973
- /** @type {?|undefined} */
5974
- RouteParameterOptions.prototype.as;
5975
- /** @type {?|undefined} */
5976
- RouteParameterOptions.prototype.optional;
5977
- /** @type {?|undefined} */
5978
- RouteParameterOptions.prototype.remember;
5979
- /** @type {?|undefined} */
5980
- RouteParameterOptions.prototype.defaultValue;
5981
- /** @type {?|undefined} */
5982
- RouteParameterOptions.prototype.storeInUrl;
5983
- }
5984
6071
  /**
5985
6072
  * @record
5986
- * @template T
6073
+ * @template D, R, E
5987
6074
  */
5988
- function RouteListParameterOptions() { }
6075
+ function ActivityOutletContext() { }
5989
6076
  if (false) {
5990
- /** @type {?|undefined} */
5991
- RouteListParameterOptions.prototype.as;
5992
- /** @type {?|undefined} */
5993
- RouteListParameterOptions.prototype.optional;
5994
- /** @type {?|undefined} */
5995
- RouteListParameterOptions.prototype.remember;
5996
- /** @type {?|undefined} */
5997
- RouteListParameterOptions.prototype.defaultValue;
5998
- /** @type {?|undefined} */
5999
- RouteListParameterOptions.prototype.storeInUrl;
6077
+ /** @type {?} */
6078
+ ActivityOutletContext.prototype.activityClass;
6079
+ /** @type {?} */
6080
+ ActivityOutletContext.prototype.activityData;
6081
+ /**
6082
+ * @param {?} component
6083
+ * @return {?}
6084
+ */
6085
+ ActivityOutletContext.prototype.componentReady = function (component) { };
6000
6086
  }
6087
+
6001
6088
  /**
6002
- * @template T
6003
- * @param {?} type
6004
- * @param {?=} options
6005
- * @return {?}
6089
+ * @fileoverview added by tsickle
6090
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
6006
6091
  */
6007
- function RouteId(type, options) {
6008
- return (/**
6009
- * @param {?} prototype
6010
- * @param {?} propertyKey
6092
+ var InteractionGuard = /** @class */ (function () {
6093
+ function InteractionGuard(router, injector, interactionContext) {
6094
+ this.router = router;
6095
+ this.injector = injector;
6096
+ this.interactionContext = interactionContext;
6097
+ }
6098
+ /**
6099
+ * @param {?} route
6100
+ * @param {?} state
6101
+ * @return {?}
6102
+ */
6103
+ InteractionGuard.prototype.canActivate = /**
6104
+ * @param {?} route
6105
+ * @param {?} state
6106
+ * @return {?}
6107
+ */
6108
+ function (route, state) {
6109
+ return true;
6110
+ };
6111
+ /**
6112
+ * @param {?} component
6113
+ * @param {?} currentRoute
6114
+ * @param {?} currentState
6115
+ * @param {?=} nextState
6011
6116
  * @return {?}
6012
6117
  */
6013
- function (prototype, propertyKey) {
6014
- /** @type {?} */
6015
- var param = new ParameterDefinition.RouteId(propertyKey.toString(), options, type);
6016
- Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
6017
- UseDelegate()(prototype, propertyKey);
6018
- });
6019
- }
6020
- /**
6021
- * @template T
6022
- * @param {?=} options
6023
- * @return {?}
6024
- */
6025
- function VisitParameter(options) {
6026
- /** @type {?} */
6027
- var opts = Opts.get(options);
6028
- return (/**
6029
- * @param {?} prototype
6030
- * @param {?} propertyKey
6031
- * @return {?}
6118
+ InteractionGuard.prototype.canDeactivate = /**
6119
+ * @param {?} component
6120
+ * @param {?} currentRoute
6121
+ * @param {?} currentState
6122
+ * @param {?=} nextState
6123
+ * @return {?}
6124
+ */
6125
+ function (component, currentRoute, currentState, nextState) {
6126
+ return !this.interactionContext.isActive();
6127
+ };
6128
+ InteractionGuard.decorators = [
6129
+ { type: Injectable, args: [{
6130
+ providedIn: 'root'
6131
+ },] }
6132
+ ];
6133
+ /** @nocollapse */
6134
+ InteractionGuard.ctorParameters = function () { return [
6135
+ { type: Router },
6136
+ { type: Injector },
6137
+ { type: InteractionContext }
6138
+ ]; };
6139
+ /** @nocollapse */ InteractionGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function InteractionGuard_Factory() { return new InteractionGuard(ɵɵinject(Router), ɵɵinject(INJECTOR), ɵɵinject(InteractionContext)); }, token: InteractionGuard, providedIn: "root" });
6140
+ __decorate([
6141
+ Trace(),
6142
+ __metadata("design:type", Function),
6143
+ __metadata("design:paramtypes", [ActivatedRouteSnapshot, RouterStateSnapshot]),
6144
+ __metadata("design:returntype", Object)
6145
+ ], InteractionGuard.prototype, "canActivate", null);
6146
+ __decorate([
6147
+ Trace(),
6148
+ __metadata("design:type", Function),
6149
+ __metadata("design:paramtypes", [NoopComponent, ActivatedRouteSnapshot, RouterStateSnapshot, RouterStateSnapshot]),
6150
+ __metadata("design:returntype", Object)
6151
+ ], InteractionGuard.prototype, "canDeactivate", null);
6152
+ return InteractionGuard;
6153
+ }());
6154
+ if (false) {
6155
+ /**
6156
+ * @type {?}
6157
+ * @private
6158
+ */
6159
+ InteractionGuard.prototype.router;
6160
+ /**
6161
+ * @type {?}
6162
+ * @private
6032
6163
  */
6033
- function (prototype, propertyKey) {
6034
- /** @type {?} */
6035
- var param = new ParameterDefinition.ValueParameter(propertyKey.toString(), options, opts.getOptional("storeInUrl", null));
6036
- Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
6037
- UseDelegate()(prototype, propertyKey);
6038
- });
6039
- }
6040
- /**
6041
- * @template E
6042
- * @param {?=} options
6043
- * @return {?}
6044
- */
6045
- function VisitParameterList(options) {
6046
- /** @type {?} */
6047
- var opts = Opts.get(options);
6048
- return (/**
6049
- * @param {?} prototype
6050
- * @param {?} propertyKey
6051
- * @return {?}
6164
+ InteractionGuard.prototype.injector;
6165
+ /**
6166
+ * @type {?}
6167
+ * @private
6052
6168
  */
6053
- function (prototype, propertyKey) {
6054
- /** @type {?} */
6055
- var param = new ParameterDefinition.ArrayParameter(propertyKey.toString(), options, opts.getOptional("storeInUrl", null));
6056
- Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
6057
- UseDelegate()(prototype, propertyKey);
6058
- });
6169
+ InteractionGuard.prototype.interactionContext;
6059
6170
  }
6060
6171
 
6061
6172
  /**
6062
6173
  * @fileoverview added by tsickle
6063
6174
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
6064
6175
  */
6065
- /**
6066
- * @record
6067
- * @template S
6068
- */
6069
- function ParameterSanitiser() { }
6070
- if (false) {
6071
- /**
6072
- * @param {?} parameterValue
6073
- * @param {?=} visit
6074
- * @param {?=} injector
6075
- * @return {?}
6076
- */
6077
- ParameterSanitiser.prototype.sanitise = function (parameterValue, visit, injector) { };
6078
- }
6079
6176
 
6080
6177
  /**
6081
6178
  * @fileoverview added by tsickle
@@ -6083,18 +6180,21 @@ if (false) {
6083
6180
  */
6084
6181
  /**
6085
6182
  * @record
6086
- * @template T
6087
6183
  */
6088
- function ParameterSnapshot() { }
6184
+ function NavItem() { }
6089
6185
  if (false) {
6090
- /** @type {?} */
6091
- ParameterSnapshot.prototype.definition;
6092
- /** @type {?} */
6093
- ParameterSnapshot.prototype.value;
6094
6186
  /**
6095
6187
  * @return {?}
6096
6188
  */
6097
- ParameterSnapshot.prototype.isMissing = function () { };
6189
+ NavItem.prototype.title = function () { };
6190
+ /**
6191
+ * @return {?}
6192
+ */
6193
+ NavItem.prototype.icon = function () { };
6194
+ /**
6195
+ * @return {?}
6196
+ */
6197
+ NavItem.prototype.tooltip = function () { };
6098
6198
  }
6099
6199
 
6100
6200
  /**
@@ -6198,8 +6298,14 @@ if (false) {
6198
6298
  * @fileoverview added by tsickle
6199
6299
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
6200
6300
  */
6201
- var EnterPlaceGuard = /** @class */ (function () {
6202
- function EnterPlaceGuard(router, urlSerializer, placeRouter, placeHistory, injector) {
6301
+ /**
6302
+ * @abstract
6303
+ */
6304
+ var /**
6305
+ * @abstract
6306
+ */
6307
+ AbstractEnterPlaceGuard = /** @class */ (function () {
6308
+ function AbstractEnterPlaceGuard(router, urlSerializer, placeRouter, placeHistory, injector) {
6203
6309
  this.router = router;
6204
6310
  this.urlSerializer = urlSerializer;
6205
6311
  this.placeRouter = placeRouter;
@@ -6213,7 +6319,7 @@ var EnterPlaceGuard = /** @class */ (function () {
6213
6319
  * @param {?} state
6214
6320
  * @return {?}
6215
6321
  */
6216
- EnterPlaceGuard.prototype.canActivate =
6322
+ AbstractEnterPlaceGuard.prototype.canActivate =
6217
6323
  // @Trace()
6218
6324
  /**
6219
6325
  * @param {?} activatedRoute
@@ -6222,85 +6328,177 @@ var EnterPlaceGuard = /** @class */ (function () {
6222
6328
  */
6223
6329
  function (activatedRoute, state) {
6224
6330
  return __awaiter(this, void 0, void 0, function () {
6225
- var placeDefinition, params, parsedParams, initialVisit, sanitiser, sanitisedVisit, commands;
6331
+ var _this = this;
6226
6332
  return __generator(this, function (_a) {
6227
- switch (_a.label) {
6333
+ return [2 /*return*/, this.interceptInitialRouteOtherwise(activatedRoute, state, (/**
6334
+ * @return {?}
6335
+ */
6336
+ function () {
6337
+ return _this.authorisePlaceThen(activatedRoute, state, (/**
6338
+ * @param {?} placeDefinition
6339
+ * @return {?}
6340
+ */
6341
+ function (placeDefinition) { return __awaiter(_this, void 0, void 0, function () {
6342
+ var params, parsedParams, initialVisit, sanitiser, sanitisedVisit, commands;
6343
+ return __generator(this, function (_a) {
6344
+ switch (_a.label) {
6345
+ case 0:
6346
+ // Parse our route params.
6347
+ params = new AbstractEnterPlaceGuard.ConsolidatedParameterMap(activatedRoute.paramMap, activatedRoute.url);
6348
+ parsedParams = placeDefinition.parseRouteParams(params);
6349
+ initialVisit = this.placeRouter.navigationSession.getVisitFor(placeDefinition) || new Visit(placeDefinition, parsedParams);
6350
+ sanitiser = new VisitSanitiser(activatedRoute, this.router, this.placeHistory, this.injector);
6351
+ return [4 /*yield*/, sanitiser.sanitise(initialVisit.mergeRouteParameters(parsedParams))];
6352
+ case 1:
6353
+ sanitisedVisit = _a.sent();
6354
+ // Save the visit with any updated parameters. We need to save it so we remember any non route parameters
6355
+ this.placeRouter.navigationSession.storeVisit(sanitisedVisit);
6356
+ if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {
6357
+ // Regenerate the url
6358
+ commands = this.placeRouter.parseUrl(state).createRedirectCommandsFor(sanitisedVisit);
6359
+ console.log('##### Place Guard Redirect', commands);
6360
+ return [2 /*return*/, this.router.createUrlTree(commands, {
6361
+ replaceUrl: true,
6362
+ skipLocationChange: false
6363
+ })];
6364
+ }
6365
+ else {
6366
+ return [2 /*return*/, true];
6367
+ }
6368
+ return [2 /*return*/];
6369
+ }
6370
+ });
6371
+ }); }));
6372
+ }))];
6373
+ });
6374
+ });
6375
+ };
6376
+ /**
6377
+ * @protected
6378
+ * @param {?} activatedRoute
6379
+ * @param {?} state
6380
+ * @param {?} canActivate
6381
+ * @return {?}
6382
+ */
6383
+ AbstractEnterPlaceGuard.prototype.authorisePlaceThen = /**
6384
+ * @protected
6385
+ * @param {?} activatedRoute
6386
+ * @param {?} state
6387
+ * @param {?} canActivate
6388
+ * @return {?}
6389
+ */
6390
+ function (activatedRoute, state, canActivate) {
6391
+ return __awaiter(this, void 0, void 0, function () {
6392
+ var placeDefinition, authorised, _a;
6393
+ return __generator(this, function (_b) {
6394
+ switch (_b.label) {
6228
6395
  case 0:
6229
- if (!PlaceComponent.isPlaceComponentConstructor(activatedRoute.component)) return [3 /*break*/, 2];
6396
+ if (!PlaceComponent.isPlaceComponentConstructor(activatedRoute.component)) return [3 /*break*/, 4];
6230
6397
  placeDefinition = PlaceComponent.getDefinition(activatedRoute.component);
6231
- // Parse our route params.
6232
- params = new EnterPlaceGuard.ConsolidatedParameterMap(activatedRoute.paramMap, activatedRoute.url);
6233
- parsedParams = placeDefinition.parseRouteParams(params);
6234
- initialVisit = this.placeRouter.navigationSession.getVisitFor(placeDefinition) || new Visit(placeDefinition, parsedParams);
6235
- sanitiser = new VisitSanitiser(activatedRoute, this.router, this.placeHistory, this.injector);
6236
- return [4 /*yield*/, sanitiser.sanitise(initialVisit.mergeRouteParameters(parsedParams))];
6398
+ if (!placeDefinition.authenticate) return [3 /*break*/, 2];
6399
+ return [4 /*yield*/, this.isAuthorised(activatedRoute, state)];
6237
6400
  case 1:
6238
- sanitisedVisit = _a.sent();
6239
- // Save the visit with any updated parameters. We need to save it so we remember any non route parameters
6240
- this.placeRouter.navigationSession.storeVisit(sanitisedVisit);
6241
- if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {
6242
- // Regenerate the url
6243
- commands = this.placeRouter.parseUrl(state).createRedirectCommandsFor(sanitisedVisit);
6244
- console.log('##### Place Guard Redirect', commands);
6245
- return [2 /*return*/, this.router.createUrlTree(commands, {
6246
- replaceUrl: true,
6247
- skipLocationChange: false
6248
- })];
6249
- }
6250
- else {
6251
- return [2 /*return*/, true];
6252
- }
6401
+ _a = _b.sent();
6253
6402
  return [3 /*break*/, 3];
6254
- case 2: return [2 /*return*/, lang.illegalState("expected component to be an instance of PlaceComponent, got " + activatedRoute.component)];
6255
- case 3: return [2 /*return*/];
6403
+ case 2:
6404
+ _a = true;
6405
+ _b.label = 3;
6406
+ case 3:
6407
+ authorised = _a;
6408
+ return [2 /*return*/, authorised === true ? canActivate(placeDefinition) : authorised];
6409
+ case 4: return [2 /*return*/, lang.illegalState("expected component to be an instance of PlaceComponent, got " + activatedRoute.component)];
6256
6410
  }
6257
6411
  });
6258
6412
  });
6259
6413
  };
6260
- EnterPlaceGuard.decorators = [
6261
- { type: Injectable, args: [{
6262
- providedIn: 'root'
6263
- },] }
6264
- ];
6265
- /** @nocollapse */
6266
- EnterPlaceGuard.ctorParameters = function () { return [
6267
- { type: Router },
6268
- { type: UrlSerializer },
6269
- { type: PlaceRouter },
6270
- { type: PlaceHistory },
6271
- { type: Injector }
6272
- ]; };
6273
- /** @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" });
6274
- return EnterPlaceGuard;
6414
+ /**
6415
+ * @protected
6416
+ * @param {?} activatedRoute
6417
+ * @param {?} state
6418
+ * @param {?} canActivate
6419
+ * @return {?}
6420
+ */
6421
+ AbstractEnterPlaceGuard.prototype.interceptInitialRouteOtherwise = /**
6422
+ * @protected
6423
+ * @param {?} activatedRoute
6424
+ * @param {?} state
6425
+ * @param {?} canActivate
6426
+ * @return {?}
6427
+ */
6428
+ function (activatedRoute, state, canActivate) {
6429
+ return __awaiter(this, void 0, void 0, function () {
6430
+ return __generator(this, function (_a) {
6431
+ // TODO: this all only sort of works. Opening dialogs and clicking back multiple times breaks things.
6432
+ // TODO: next stage is to investigate tracking dialog state in a different placeoutlet and keeping those
6433
+ // TODO: urls out of the history.
6434
+ if (this.placeRouter.isInitialNavigation()) {
6435
+ // This is the very first entry into our app so we redirect to a dummy place so we can get bump our
6436
+ // history by one. This ensures that we can capture back button presses on the initial page without
6437
+ // leaving our app.
6438
+ return [2 /*return*/, this.placeRouter.performInitialNavigationIntercept(activatedRoute, state)];
6439
+ }
6440
+ else {
6441
+ return [2 /*return*/, canActivate()];
6442
+ }
6443
+ return [2 /*return*/];
6444
+ });
6445
+ });
6446
+ };
6447
+ /**
6448
+ * @param {?} activatedRoute
6449
+ * @param {?} state
6450
+ * @return {?}
6451
+ */
6452
+ AbstractEnterPlaceGuard.prototype.isAuthorised = /**
6453
+ * @param {?} activatedRoute
6454
+ * @param {?} state
6455
+ * @return {?}
6456
+ */
6457
+ function (activatedRoute, state) {
6458
+ return __awaiter(this, void 0, void 0, function () {
6459
+ var authorised;
6460
+ return __generator(this, function (_a) {
6461
+ authorised = this.getAuthGuard(this.injector).canActivate(activatedRoute, state);
6462
+ return [2 /*return*/, (authorised instanceof Observable) ? authorised.toPromise() : authorised];
6463
+ });
6464
+ });
6465
+ };
6466
+ return AbstractEnterPlaceGuard;
6275
6467
  }());
6276
6468
  if (false) {
6277
6469
  /**
6278
6470
  * @type {?}
6279
6471
  * @private
6280
6472
  */
6281
- EnterPlaceGuard.prototype.router;
6473
+ AbstractEnterPlaceGuard.prototype.router;
6282
6474
  /**
6283
6475
  * @type {?}
6284
6476
  * @private
6285
6477
  */
6286
- EnterPlaceGuard.prototype.urlSerializer;
6478
+ AbstractEnterPlaceGuard.prototype.urlSerializer;
6287
6479
  /**
6288
6480
  * @type {?}
6289
6481
  * @private
6290
6482
  */
6291
- EnterPlaceGuard.prototype.placeRouter;
6483
+ AbstractEnterPlaceGuard.prototype.placeRouter;
6292
6484
  /**
6293
6485
  * @type {?}
6294
6486
  * @private
6295
6487
  */
6296
- EnterPlaceGuard.prototype.placeHistory;
6488
+ AbstractEnterPlaceGuard.prototype.placeHistory;
6297
6489
  /**
6298
6490
  * @type {?}
6299
6491
  * @private
6300
6492
  */
6301
- EnterPlaceGuard.prototype.injector;
6493
+ AbstractEnterPlaceGuard.prototype.injector;
6494
+ /**
6495
+ * @abstract
6496
+ * @param {?} injector
6497
+ * @return {?}
6498
+ */
6499
+ AbstractEnterPlaceGuard.prototype.getAuthGuard = function (injector) { };
6302
6500
  }
6303
- (function (EnterPlaceGuard) {
6501
+ (function (AbstractEnterPlaceGuard) {
6304
6502
  /**
6305
6503
  * This a work around for the fact that an activated route with multiple segments doesn't
6306
6504
  * include the segment params in the paramMap as well as each segment returns an empty
@@ -6389,7 +6587,7 @@ if (false) {
6389
6587
  ], ConsolidatedParameterMap.prototype, "keys", null);
6390
6588
  return ConsolidatedParameterMap;
6391
6589
  }());
6392
- EnterPlaceGuard.ConsolidatedParameterMap = ConsolidatedParameterMap;
6590
+ AbstractEnterPlaceGuard.ConsolidatedParameterMap = ConsolidatedParameterMap;
6393
6591
  if (false) {
6394
6592
  /**
6395
6593
  * @type {?}
@@ -6455,7 +6653,7 @@ if (false) {
6455
6653
  */
6456
6654
  ParamMapAdapter.prototype.params;
6457
6655
  }
6458
- })(EnterPlaceGuard || (EnterPlaceGuard = {}));
6656
+ })(AbstractEnterPlaceGuard || (AbstractEnterPlaceGuard = {}));
6459
6657
 
6460
6658
  /**
6461
6659
  * @fileoverview added by tsickle
@@ -6506,6 +6704,93 @@ if (false) {
6506
6704
  LeavePlaceGuard.prototype.placeRouter;
6507
6705
  }
6508
6706
 
6707
+ /**
6708
+ * @fileoverview added by tsickle
6709
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
6710
+ */
6711
+ var NoopAuthGuard = /** @class */ (function () {
6712
+ function NoopAuthGuard() {
6713
+ }
6714
+ /**
6715
+ * @param {?} activatedRoute
6716
+ * @param {?} state
6717
+ * @return {?}
6718
+ */
6719
+ NoopAuthGuard.prototype.canActivate = /**
6720
+ * @param {?} activatedRoute
6721
+ * @param {?} state
6722
+ * @return {?}
6723
+ */
6724
+ function (activatedRoute, state) {
6725
+ return __awaiter(this, void 0, void 0, function () {
6726
+ return __generator(this, function (_a) {
6727
+ return [2 /*return*/, true];
6728
+ });
6729
+ });
6730
+ };
6731
+ NoopAuthGuard.decorators = [
6732
+ { type: Injectable, args: [{
6733
+ providedIn: 'root'
6734
+ },] }
6735
+ ];
6736
+ /** @nocollapse */
6737
+ NoopAuthGuard.ctorParameters = function () { return []; };
6738
+ /** @nocollapse */ NoopAuthGuard.ngInjectableDef = ɵɵdefineInjectable({ factory: function NoopAuthGuard_Factory() { return new NoopAuthGuard(); }, token: NoopAuthGuard, providedIn: "root" });
6739
+ return NoopAuthGuard;
6740
+ }());
6741
+
6742
+ /**
6743
+ * @fileoverview added by tsickle
6744
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
6745
+ */
6746
+ /**
6747
+ * @record
6748
+ */
6749
+ function JsonArray() { }
6750
+ /**
6751
+ * @record
6752
+ */
6753
+ function JsonMap() { }
6754
+
6755
+ /**
6756
+ * @fileoverview added by tsickle
6757
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
6758
+ */
6759
+ /**
6760
+ * @record
6761
+ * @template S
6762
+ */
6763
+ function ParameterSanitiser() { }
6764
+ if (false) {
6765
+ /**
6766
+ * @param {?} parameterValue
6767
+ * @param {?=} visit
6768
+ * @param {?=} injector
6769
+ * @return {?}
6770
+ */
6771
+ ParameterSanitiser.prototype.sanitise = function (parameterValue, visit, injector) { };
6772
+ }
6773
+
6774
+ /**
6775
+ * @fileoverview added by tsickle
6776
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
6777
+ */
6778
+ /**
6779
+ * @record
6780
+ * @template T
6781
+ */
6782
+ function ParameterSnapshot() { }
6783
+ if (false) {
6784
+ /** @type {?} */
6785
+ ParameterSnapshot.prototype.definition;
6786
+ /** @type {?} */
6787
+ ParameterSnapshot.prototype.value;
6788
+ /**
6789
+ * @return {?}
6790
+ */
6791
+ ParameterSnapshot.prototype.isMissing = function () { };
6792
+ }
6793
+
6509
6794
  /**
6510
6795
  * @fileoverview added by tsickle
6511
6796
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
@@ -6526,5 +6811,5 @@ if (false) {
6526
6811
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
6527
6812
  */
6528
6813
 
6529
- 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 };
6814
+ 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 };
6530
6815
  //# sourceMappingURL=coolon-angular-ui-powerups.js.map