@coolon/angular-ui-powerups 0.0.69 → 0.0.71

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.
@@ -3407,94 +3407,6 @@
3407
3407
  ListPlaceNavComponent.prototype.expanded;
3408
3408
  }
3409
3409
 
3410
- /**
3411
- * @fileoverview added by tsickle
3412
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3413
- */
3414
- var PlaceHistory = /** @class */ (function () {
3415
- function PlaceHistory(router) {
3416
- this.router = router;
3417
- this._history = new Map();
3418
- }
3419
- // @Trace()
3420
- // @Trace()
3421
- /**
3422
- * @param {?} state
3423
- * @return {?}
3424
- */
3425
- PlaceHistory.prototype.add =
3426
- // @Trace()
3427
- /**
3428
- * @param {?} state
3429
- * @return {?}
3430
- */
3431
- function (state) {
3432
- /** @type {?} */
3433
- var history = this.getHistory(state.placeDefinition);
3434
- /** @type {?} */
3435
- var previousState = ___default__default.last(history);
3436
- if (!previousState || state.hasChangedFrom(previousState)) {
3437
- history.unshift(state); // LIFO
3438
- this.setHistory(state.placeDefinition, history.slice(0, 3)); // limit our history to 4 visits
3439
- }
3440
- };
3441
- /**
3442
- * @param {?} placeDef
3443
- * @return {?}
3444
- */
3445
- PlaceHistory.prototype.getHistory = /**
3446
- * @param {?} placeDef
3447
- * @return {?}
3448
- */
3449
- function (placeDef) {
3450
- /** @type {?} */
3451
- var history = this._history.get(placeDef);
3452
- if (!history) {
3453
- history = [];
3454
- this.setHistory(placeDef, history);
3455
- }
3456
- return history;
3457
- };
3458
- /**
3459
- * @private
3460
- * @param {?} placeDef
3461
- * @param {?} history
3462
- * @return {?}
3463
- */
3464
- PlaceHistory.prototype.setHistory = /**
3465
- * @private
3466
- * @param {?} placeDef
3467
- * @param {?} history
3468
- * @return {?}
3469
- */
3470
- function (placeDef, history) {
3471
- this._history.set(placeDef, history);
3472
- };
3473
- PlaceHistory.decorators = [
3474
- { type: core.Injectable, args: [{
3475
- providedIn: 'root'
3476
- },] }
3477
- ];
3478
- /** @nocollapse */
3479
- PlaceHistory.ctorParameters = function () { return [
3480
- { type: router.Router }
3481
- ]; };
3482
- /** @nocollapse */ PlaceHistory.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function PlaceHistory_Factory() { return new PlaceHistory(core.ɵɵinject(router.Router)); }, token: PlaceHistory, providedIn: "root" });
3483
- return PlaceHistory;
3484
- }());
3485
- if (false) {
3486
- /**
3487
- * @type {?}
3488
- * @private
3489
- */
3490
- PlaceHistory.prototype._history;
3491
- /**
3492
- * @type {?}
3493
- * @private
3494
- */
3495
- PlaceHistory.prototype.router;
3496
- }
3497
-
3498
3410
  /**
3499
3411
  * @fileoverview added by tsickle
3500
3412
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
@@ -3683,6 +3595,94 @@
3683
3595
  NavigationSession.createExternal = createExternal;
3684
3596
  })(exports.NavigationSession || (exports.NavigationSession = {}));
3685
3597
 
3598
+ /**
3599
+ * @fileoverview added by tsickle
3600
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3601
+ */
3602
+ var PlaceHistory = /** @class */ (function () {
3603
+ function PlaceHistory(router) {
3604
+ this.router = router;
3605
+ this._history = new Map();
3606
+ }
3607
+ // @Trace()
3608
+ // @Trace()
3609
+ /**
3610
+ * @param {?} state
3611
+ * @return {?}
3612
+ */
3613
+ PlaceHistory.prototype.add =
3614
+ // @Trace()
3615
+ /**
3616
+ * @param {?} state
3617
+ * @return {?}
3618
+ */
3619
+ function (state) {
3620
+ /** @type {?} */
3621
+ var history = this.getHistory(state.placeDefinition);
3622
+ /** @type {?} */
3623
+ var previousState = ___default__default.last(history);
3624
+ if (!previousState || state.hasChangedFrom(previousState)) {
3625
+ history.unshift(state); // LIFO
3626
+ this.setHistory(state.placeDefinition, history.slice(0, 3)); // limit our history to 4 visits
3627
+ }
3628
+ };
3629
+ /**
3630
+ * @param {?} placeDef
3631
+ * @return {?}
3632
+ */
3633
+ PlaceHistory.prototype.getHistory = /**
3634
+ * @param {?} placeDef
3635
+ * @return {?}
3636
+ */
3637
+ function (placeDef) {
3638
+ /** @type {?} */
3639
+ var history = this._history.get(placeDef);
3640
+ if (!history) {
3641
+ history = [];
3642
+ this.setHistory(placeDef, history);
3643
+ }
3644
+ return history;
3645
+ };
3646
+ /**
3647
+ * @private
3648
+ * @param {?} placeDef
3649
+ * @param {?} history
3650
+ * @return {?}
3651
+ */
3652
+ PlaceHistory.prototype.setHistory = /**
3653
+ * @private
3654
+ * @param {?} placeDef
3655
+ * @param {?} history
3656
+ * @return {?}
3657
+ */
3658
+ function (placeDef, history) {
3659
+ this._history.set(placeDef, history);
3660
+ };
3661
+ PlaceHistory.decorators = [
3662
+ { type: core.Injectable, args: [{
3663
+ providedIn: 'root'
3664
+ },] }
3665
+ ];
3666
+ /** @nocollapse */
3667
+ PlaceHistory.ctorParameters = function () { return [
3668
+ { type: router.Router }
3669
+ ]; };
3670
+ /** @nocollapse */ PlaceHistory.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function PlaceHistory_Factory() { return new PlaceHistory(core.ɵɵinject(router.Router)); }, token: PlaceHistory, providedIn: "root" });
3671
+ return PlaceHistory;
3672
+ }());
3673
+ if (false) {
3674
+ /**
3675
+ * @type {?}
3676
+ * @private
3677
+ */
3678
+ PlaceHistory.prototype._history;
3679
+ /**
3680
+ * @type {?}
3681
+ * @private
3682
+ */
3683
+ PlaceHistory.prototype.router;
3684
+ }
3685
+
3686
3686
  /**
3687
3687
  * @fileoverview added by tsickle
3688
3688
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
@@ -3942,23 +3942,43 @@
3942
3942
  * placeRouter.navigate(placeDestinations.somePlace.createVisit(routeId, ...visitParams));
3943
3943
  * @param visit
3944
3944
  */
3945
- // @Trace()
3946
3945
  /**
3947
3946
  * placeRouter.navigate(placeDestinations.somePlace.createVisit(routeId, ...visitParams));
3948
3947
  * @param {?} visit
3948
+ * @param {?=} options
3949
3949
  * @return {?}
3950
3950
  */
3951
- // @Trace()
3952
3951
  PlaceRouter.prototype.navigate = /**
3953
3952
  * placeRouter.navigate(placeDestinations.somePlace.createVisit(routeId, ...visitParams));
3954
3953
  * @param {?} visit
3954
+ * @param {?=} options
3955
3955
  * @return {?}
3956
3956
  */
3957
- // @Trace()
3958
- function (visit) {
3957
+ function (visit, options) {
3959
3958
  return __awaiter(this, void 0, void 0, function () {
3959
+ var _this = this;
3960
3960
  return __generator(this, function (_a) {
3961
- this.doNavigation(visit);
3961
+ this.doNavigation(visit, (/**
3962
+ * @param {?} router
3963
+ * @return {?}
3964
+ */
3965
+ function (router) { return __awaiter(_this, void 0, void 0, function () {
3966
+ var commands;
3967
+ return __generator(this, function (_a) {
3968
+ switch (_a.label) {
3969
+ case 0:
3970
+ commands = __spread([
3971
+ visit.placeDefinition.path
3972
+ ], this.createRouteParameters(visit));
3973
+ return [4 /*yield*/, this.router.navigate(commands, {
3974
+ relativeTo: options ? options.relativeTo : null
3975
+ })];
3976
+ case 1:
3977
+ _a.sent();
3978
+ return [2 /*return*/];
3979
+ }
3980
+ });
3981
+ }); }));
3962
3982
  return [2 /*return*/];
3963
3983
  });
3964
3984
  });
@@ -3992,13 +4012,9 @@
3992
4012
  /** @type {?} */
3993
4013
  var relativePath = !!previous.placeDefinition.hasRouteId() ? '..' : '.';
3994
4014
  /** @type {?} */
3995
- var def = next.placeDefinition;
3996
- /** @type {?} */
3997
- var params = next.hasRouteId() ?
3998
- [def.getFormattedRouteId(next), def.getFormattedRouteParameters(next)] :
3999
- [def.getFormattedRouteParameters(next)];
4000
- /** @type {?} */
4001
- var commands = [relativePath].concat(params, _this.getChildPath(activatedRoute.snapshot));
4015
+ var commands = __spread([
4016
+ relativePath
4017
+ ], _this.createRouteParameters(next), _this.extractChildPath(activatedRoute.snapshot));
4002
4018
  console.log('### Redirect', commands);
4003
4019
  return router.navigate(commands, {
4004
4020
  relativeTo: activatedRoute
@@ -4011,52 +4027,54 @@
4011
4027
  };
4012
4028
  /**
4013
4029
  * @param {?} visit
4014
- * @param {?=} customNavigation
4030
+ * @param {?} customNavigation
4015
4031
  * @return {?}
4016
4032
  */
4017
4033
  PlaceRouter.prototype.doNavigation = /**
4018
4034
  * @param {?} visit
4019
- * @param {?=} customNavigation
4035
+ * @param {?} customNavigation
4020
4036
  * @return {?}
4021
4037
  */
4022
4038
  function (visit, customNavigation) {
4023
4039
  return __awaiter(this, void 0, void 0, function () {
4024
- var def, parameterCommands, commands;
4025
4040
  return __generator(this, function (_a) {
4026
4041
  switch (_a.label) {
4027
4042
  case 0:
4028
4043
  this._navigationSessionModel.value = exports.NavigationSession.createInternal(visit);
4029
4044
  _a.label = 1;
4030
4045
  case 1:
4031
- _a.trys.push([1, , 6, 7]);
4032
- if (!customNavigation) return [3 /*break*/, 3];
4046
+ _a.trys.push([1, , 3, 4]);
4033
4047
  return [4 /*yield*/, customNavigation(this.router)];
4034
4048
  case 2:
4035
4049
  _a.sent();
4036
- return [3 /*break*/, 5];
4050
+ return [3 /*break*/, 4];
4037
4051
  case 3:
4038
- def = visit.placeDefinition;
4039
- // @see https://coolon.atlassian.net/browse/AUP-41
4040
- parameterCommands = visit.hasRouteId() ?
4041
- [def.getFormattedRouteId(visit), def.getFormattedRouteParameters(visit)] :
4042
- [def.getFormattedRouteParameters(visit)];
4043
- commands = [def.path].concat(parameterCommands);
4044
- console.log('_doNavigation', visit, commands);
4045
- return [4 /*yield*/, this.router.navigate(commands)];
4046
- case 4:
4047
- _a.sent();
4048
- _a.label = 5;
4049
- case 5: return [3 /*break*/, 7];
4050
- case 6:
4051
4052
  if (this.navigationSession && !this.router.getCurrentNavigation()) {
4052
4053
  this.onAngularRouterFinished();
4053
4054
  }
4054
4055
  return [7 /*endfinally*/];
4055
- case 7: return [2 /*return*/];
4056
+ case 4: return [2 /*return*/];
4056
4057
  }
4057
4058
  });
4058
4059
  });
4059
4060
  };
4061
+ /**
4062
+ * @private
4063
+ * @param {?} visit
4064
+ * @return {?}
4065
+ */
4066
+ PlaceRouter.prototype.createRouteParameters = /**
4067
+ * @private
4068
+ * @param {?} visit
4069
+ * @return {?}
4070
+ */
4071
+ function (visit) {
4072
+ /** @type {?} */
4073
+ var def = visit.placeDefinition;
4074
+ return visit.hasRouteId() ?
4075
+ [def.getFormattedRouteId(visit), def.getFormattedRouteParameters(visit)] :
4076
+ [def.getFormattedRouteParameters(visit)];
4077
+ };
4060
4078
  // @Trace()
4061
4079
  // @Trace()
4062
4080
  /**
@@ -4117,7 +4135,7 @@
4117
4135
  * @param {?} activatedRoute
4118
4136
  * @return {?}
4119
4137
  */
4120
- PlaceRouter.prototype.getChildPath = /**
4138
+ PlaceRouter.prototype.extractChildPath = /**
4121
4139
  * @param {?} activatedRoute
4122
4140
  * @return {?}
4123
4141
  */
@@ -4140,6 +4158,12 @@
4140
4158
  { type: PlaceHistory }
4141
4159
  ]; };
4142
4160
  /** @nocollapse */ PlaceRouter.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(core.ɵɵinject(router.Router), core.ɵɵinject(common.Location), core.ɵɵinject(PlaceHistory)); }, token: PlaceRouter, providedIn: "root" });
4161
+ __decorate([
4162
+ pectin.Trace(),
4163
+ __metadata("design:type", Function),
4164
+ __metadata("design:paramtypes", [Visit, Object]),
4165
+ __metadata("design:returntype", Promise)
4166
+ ], PlaceRouter.prototype, "navigate", null);
4143
4167
  __decorate([
4144
4168
  pectin.Trace(),
4145
4169
  __metadata("design:type", Function),
@@ -4255,11 +4279,11 @@
4255
4279
  }
4256
4280
  var PlaceOutletComponent = /** @class */ (function (_super) {
4257
4281
  __extends(PlaceOutletComponent, _super);
4258
- function PlaceOutletComponent(router, placeRouter, placeHistory) {
4282
+ function PlaceOutletComponent(router, placeRouter, parentOutlet) {
4259
4283
  var _this = _super.call(this) || this;
4260
4284
  _this.router = router;
4261
4285
  _this.placeRouter = placeRouter;
4262
- _this.placeHistory = placeHistory;
4286
+ _this.parentOutlet = parentOutlet;
4263
4287
  _this.animate = true;
4264
4288
  _this.placeChanged = new core.EventEmitter();
4265
4289
  _this._activePlace = new pectin.MutableValueModel();
@@ -4320,6 +4344,20 @@
4320
4344
  */
4321
4345
  function () {
4322
4346
  };
4347
+ /**
4348
+ * @param {?} visit
4349
+ * @return {?}
4350
+ */
4351
+ PlaceOutletComponent.prototype.navigate = /**
4352
+ * @param {?} visit
4353
+ * @return {?}
4354
+ */
4355
+ function (visit) {
4356
+ console.log({ activatedRoute: this._activatedRouteModel.value });
4357
+ this.placeRouter.navigate(visit, {
4358
+ relativeTo: this.parentOutlet ? this.parentOutlet.activatedRouteModel.value : null
4359
+ });
4360
+ };
4323
4361
  /**
4324
4362
  * @param {?} next
4325
4363
  * @param {?} previous
@@ -4345,6 +4383,16 @@
4345
4383
  enumerable: true,
4346
4384
  configurable: true
4347
4385
  });
4386
+ Object.defineProperty(PlaceOutletComponent.prototype, "activatedRouteModel", {
4387
+ get: /**
4388
+ * @return {?}
4389
+ */
4390
+ function () {
4391
+ return this._activatedRouteModel.readonly;
4392
+ },
4393
+ enumerable: true,
4394
+ configurable: true
4395
+ });
4348
4396
  /**
4349
4397
  * @param {?} routerOutlet
4350
4398
  * @param {?} place
@@ -4419,17 +4467,6 @@
4419
4467
  this._activePlace.value.onPlaceReady();
4420
4468
  }
4421
4469
  };
4422
- /**
4423
- * @param {?} placeDestination
4424
- * @return {?}
4425
- */
4426
- PlaceOutletComponent.prototype.activate = /**
4427
- * @param {?} placeDestination
4428
- * @return {?}
4429
- */
4430
- function (placeDestination) {
4431
- // this.router.
4432
- };
4433
4470
  PlaceOutletComponent.decorators = [
4434
4471
  { type: core.Component, args: [{
4435
4472
  selector: 'angular-ui-powerups-place-outlet',
@@ -4442,13 +4479,31 @@
4442
4479
  PlaceOutletComponent.ctorParameters = function () { return [
4443
4480
  { type: router.Router },
4444
4481
  { type: PlaceRouter },
4445
- { type: PlaceHistory }
4482
+ { type: PlaceOutletComponent, decorators: [{ type: core.SkipSelf }, { type: core.Optional }] }
4446
4483
  ]; };
4447
4484
  PlaceOutletComponent.propDecorators = {
4448
4485
  animate: [{ type: core.Input }],
4449
4486
  placeChanged: [{ type: core.Output }],
4450
4487
  routerOut: [{ type: core.ViewChild, args: ['routeOutlet', { static: true },] }]
4451
4488
  };
4489
+ __decorate([
4490
+ pectin.Trace(),
4491
+ __metadata("design:type", Function),
4492
+ __metadata("design:paramtypes", [Visit]),
4493
+ __metadata("design:returntype", void 0)
4494
+ ], PlaceOutletComponent.prototype, "navigate", null);
4495
+ __decorate([
4496
+ pectin.Trace(),
4497
+ __metadata("design:type", Function),
4498
+ __metadata("design:paramtypes", [router.RouterOutlet, exports.PlaceComponent]),
4499
+ __metadata("design:returntype", void 0)
4500
+ ], PlaceOutletComponent.prototype, "onOutletActivated", null);
4501
+ __decorate([
4502
+ pectin.Trace(),
4503
+ __metadata("design:type", Function),
4504
+ __metadata("design:paramtypes", [router.RouterOutlet, Object]),
4505
+ __metadata("design:returntype", void 0)
4506
+ ], PlaceOutletComponent.prototype, "onOutletDeactivated", null);
4452
4507
  return PlaceOutletComponent;
4453
4508
  }(DisposableComponent));
4454
4509
  if (false) {
@@ -4493,11 +4548,8 @@
4493
4548
  * @private
4494
4549
  */
4495
4550
  PlaceOutletComponent.prototype.placeRouter;
4496
- /**
4497
- * @type {?}
4498
- * @private
4499
- */
4500
- PlaceOutletComponent.prototype.placeHistory;
4551
+ /** @type {?} */
4552
+ PlaceOutletComponent.prototype.parentOutlet;
4501
4553
  }
4502
4554
 
4503
4555
  /**
@@ -5311,6 +5363,8 @@
5311
5363
  * @return {?}
5312
5364
  */
5313
5365
  function VisitParameter(options) {
5366
+ /** @type {?} */
5367
+ var opts = typescriptUtilities.Opts.get(options);
5314
5368
  return (/**
5315
5369
  * @param {?} prototype
5316
5370
  * @param {?} propertyKey
@@ -5318,7 +5372,7 @@
5318
5372
  */
5319
5373
  function (prototype, propertyKey) {
5320
5374
  /** @type {?} */
5321
- var param = new exports.ParameterDefinition.ValueParameter(propertyKey.toString(), options, options.storeInUrl);
5375
+ var param = new exports.ParameterDefinition.ValueParameter(propertyKey.toString(), options, opts.getOptional("storeInUrl", null));
5322
5376
  typescriptUtilities.Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
5323
5377
  pectin.UseDelegate()(prototype, propertyKey);
5324
5378
  });
@@ -5329,6 +5383,8 @@
5329
5383
  * @return {?}
5330
5384
  */
5331
5385
  function VisitParameterList(options) {
5386
+ /** @type {?} */
5387
+ var opts = typescriptUtilities.Opts.get(options);
5332
5388
  return (/**
5333
5389
  * @param {?} prototype
5334
5390
  * @param {?} propertyKey
@@ -5336,7 +5392,7 @@
5336
5392
  */
5337
5393
  function (prototype, propertyKey) {
5338
5394
  /** @type {?} */
5339
- var param = new exports.ParameterDefinition.ArrayParameter(propertyKey.toString(), options, options.storeInUrl);
5395
+ var param = new exports.ParameterDefinition.ArrayParameter(propertyKey.toString(), options, opts.getOptional("storeInUrl", null));
5340
5396
  typescriptUtilities.Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
5341
5397
  pectin.UseDelegate()(prototype, propertyKey);
5342
5398
  });
@@ -5645,7 +5701,7 @@
5645
5701
  */
5646
5702
  function (activatedRoute, state) {
5647
5703
  return __awaiter(this, void 0, void 0, function () {
5648
- var placeDefinition, params, parsedParams, initialVisit, sanitiser, updatedVisit, parameterCommands, commands;
5704
+ var placeDefinition, params, parsedParams, initialVisit, sanitiser, sanitisedVisit, parameterCommands, commands;
5649
5705
  return __generator(this, function (_a) {
5650
5706
  switch (_a.label) {
5651
5707
  case 0:
@@ -5658,14 +5714,14 @@
5658
5714
  sanitiser = new VisitSanitiser(activatedRoute, this.router, this.placeHistory, this.injector);
5659
5715
  return [4 /*yield*/, sanitiser.sanitise(initialVisit.mergeRouteParameters(parsedParams))];
5660
5716
  case 1:
5661
- updatedVisit = _a.sent();
5717
+ sanitisedVisit = _a.sent();
5662
5718
  // Save the visit with any updated parameters. We need to save it so we remember any non route parameters
5663
- this.placeRouter.navigationSession.storeVisit(updatedVisit);
5664
- if (initialVisit.hasRoutingChangedFrom(updatedVisit)) {
5665
- parameterCommands = updatedVisit.hasRouteId() ?
5666
- [placeDefinition.getFormattedRouteId(updatedVisit), placeDefinition.getFormattedRouteParameters(updatedVisit)] :
5667
- [placeDefinition.getFormattedRouteParameters(updatedVisit)];
5668
- commands = [(activatedRoute.url[0].path)].concat(parameterCommands, this.placeRouter.getChildPath(activatedRoute));
5719
+ this.placeRouter.navigationSession.storeVisit(sanitisedVisit);
5720
+ if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {
5721
+ parameterCommands = sanitisedVisit.hasRouteId() ?
5722
+ [placeDefinition.getFormattedRouteId(sanitisedVisit), placeDefinition.getFormattedRouteParameters(sanitisedVisit)] :
5723
+ [placeDefinition.getFormattedRouteParameters(sanitisedVisit)];
5724
+ commands = [(activatedRoute.url[0].path)].concat(parameterCommands, this.placeRouter.extractChildPath(activatedRoute));
5669
5725
  console.log('##### Redirect', commands);
5670
5726
  return [2 /*return*/, this.router.createUrlTree(commands, {
5671
5727
  replaceUrl: true,