@coolon/angular-ui-powerups 0.0.70 → 0.0.72

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 (27) hide show
  1. package/bundles/coolon-angular-ui-powerups.umd.js +197 -142
  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.metadata.json +1 -1
  6. package/esm2015/lib/place/components/place-outlet/place-outlet.component.js +50 -24
  7. package/esm2015/lib/place/place-router.js +42 -27
  8. package/esm2015/lib/place/place.decorator.js +3 -1
  9. package/esm5/lib/place/components/place-outlet/place-outlet.component.js +56 -27
  10. package/esm5/lib/place/place-router.js +57 -32
  11. package/esm5/lib/place/place.decorator.js +3 -1
  12. package/fesm2015/coolon-angular-ui-powerups.js +162 -121
  13. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  14. package/fesm5/coolon-angular-ui-powerups.js +200 -145
  15. package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
  16. package/lib/place/components/place-outlet/place-outlet.component.d.ts +5 -5
  17. package/lib/place/place-router.d.ts +5 -2
  18. package/lib/place/place.decorator.d.ts +1 -0
  19. package/package.json +1 -1
  20. package/schematics/place-routes/place-builder.js +1 -0
  21. package/schematics/place-routes/place-builder.js.map +1 -1
  22. package/schematics/place-routes/place-class-scanner.d.ts +1 -0
  23. package/schematics/place-routes/place-class-scanner.js +7 -1
  24. package/schematics/place-routes/place-class-scanner.js.map +1 -1
  25. package/schematics/place-routes/place-def.d.ts +4 -1
  26. package/schematics/place-routes/place-def.js +33 -19
  27. package/schematics/place-routes/place-def.js.map +1 -1
@@ -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.extractChildPath(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,51 +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
- parameterCommands = visit.hasRouteId() ?
4040
- [def.getFormattedRouteId(visit), def.getFormattedRouteParameters(visit)] :
4041
- [def.getFormattedRouteParameters(visit)];
4042
- commands = [def.path].concat(parameterCommands);
4043
- console.log('_doNavigation', visit, commands);
4044
- return [4 /*yield*/, this.router.navigate(commands)];
4045
- case 4:
4046
- _a.sent();
4047
- _a.label = 5;
4048
- case 5: return [3 /*break*/, 7];
4049
- case 6:
4050
4052
  if (this.navigationSession && !this.router.getCurrentNavigation()) {
4051
4053
  this.onAngularRouterFinished();
4052
4054
  }
4053
4055
  return [7 /*endfinally*/];
4054
- case 7: return [2 /*return*/];
4056
+ case 4: return [2 /*return*/];
4055
4057
  }
4056
4058
  });
4057
4059
  });
4058
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
+ };
4059
4078
  // @Trace()
4060
4079
  // @Trace()
4061
4080
  /**
@@ -4139,6 +4158,12 @@
4139
4158
  { type: PlaceHistory }
4140
4159
  ]; };
4141
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);
4142
4167
  __decorate([
4143
4168
  pectin.Trace(),
4144
4169
  __metadata("design:type", Function),
@@ -4254,11 +4279,11 @@
4254
4279
  }
4255
4280
  var PlaceOutletComponent = /** @class */ (function (_super) {
4256
4281
  __extends(PlaceOutletComponent, _super);
4257
- function PlaceOutletComponent(router, placeRouter, placeHistory) {
4282
+ function PlaceOutletComponent(router, placeRouter, parentOutlet) {
4258
4283
  var _this = _super.call(this) || this;
4259
4284
  _this.router = router;
4260
4285
  _this.placeRouter = placeRouter;
4261
- _this.placeHistory = placeHistory;
4286
+ _this.parentOutlet = parentOutlet;
4262
4287
  _this.animate = true;
4263
4288
  _this.placeChanged = new core.EventEmitter();
4264
4289
  _this._activePlace = new pectin.MutableValueModel();
@@ -4270,17 +4295,17 @@
4270
4295
  */
4271
4296
  _this._placeVisit = new pectin.MutableValueModel();
4272
4297
  var _a = pectin.Dsl.disposeWith(_this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
4273
- // Handle incoming route changes.
4274
- /** @type {?} */
4275
- var inRouteVisitUpdate = new pectin.Guard();
4298
+ // Push incoming changes into the component
4276
4299
  /** @type {?} */
4277
4300
  var routeVisit = chain(_this._activePlace).pluck('placeDefinition').findIn(placeRouter.activeVisitIndex);
4301
+ /** @type {?} */
4302
+ var inRouteVisitUpdate = new pectin.Guard();
4278
4303
  when.valueOf(routeVisit).changes((/**
4279
4304
  * @param {?} visit
4280
4305
  * @return {?}
4281
4306
  */
4282
4307
  function (visit) {
4283
- if (visit) {
4308
+ if (visit) { // can be null while the place and index sync up
4284
4309
  inRouteVisitUpdate.whileTrue((/**
4285
4310
  * @return {?}
4286
4311
  */
@@ -4319,6 +4344,20 @@
4319
4344
  */
4320
4345
  function () {
4321
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
+ };
4322
4361
  /**
4323
4362
  * @param {?} next
4324
4363
  * @param {?} previous
@@ -4344,6 +4383,16 @@
4344
4383
  enumerable: true,
4345
4384
  configurable: true
4346
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
+ });
4347
4396
  /**
4348
4397
  * @param {?} routerOutlet
4349
4398
  * @param {?} place
@@ -4418,17 +4467,6 @@
4418
4467
  this._activePlace.value.onPlaceReady();
4419
4468
  }
4420
4469
  };
4421
- /**
4422
- * @param {?} placeDestination
4423
- * @return {?}
4424
- */
4425
- PlaceOutletComponent.prototype.activate = /**
4426
- * @param {?} placeDestination
4427
- * @return {?}
4428
- */
4429
- function (placeDestination) {
4430
- // this.router.
4431
- };
4432
4470
  PlaceOutletComponent.decorators = [
4433
4471
  { type: core.Component, args: [{
4434
4472
  selector: 'angular-ui-powerups-place-outlet',
@@ -4441,13 +4479,31 @@
4441
4479
  PlaceOutletComponent.ctorParameters = function () { return [
4442
4480
  { type: router.Router },
4443
4481
  { type: PlaceRouter },
4444
- { type: PlaceHistory }
4482
+ { type: PlaceOutletComponent, decorators: [{ type: core.SkipSelf }, { type: core.Optional }] }
4445
4483
  ]; };
4446
4484
  PlaceOutletComponent.propDecorators = {
4447
4485
  animate: [{ type: core.Input }],
4448
4486
  placeChanged: [{ type: core.Output }],
4449
4487
  routerOut: [{ type: core.ViewChild, args: ['routeOutlet', { static: true },] }]
4450
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);
4451
4507
  return PlaceOutletComponent;
4452
4508
  }(DisposableComponent));
4453
4509
  if (false) {
@@ -4492,11 +4548,8 @@
4492
4548
  * @private
4493
4549
  */
4494
4550
  PlaceOutletComponent.prototype.placeRouter;
4495
- /**
4496
- * @type {?}
4497
- * @private
4498
- */
4499
- PlaceOutletComponent.prototype.placeHistory;
4551
+ /** @type {?} */
4552
+ PlaceOutletComponent.prototype.parentOutlet;
4500
4553
  }
4501
4554
 
4502
4555
  /**
@@ -5121,6 +5174,8 @@
5121
5174
  Options.prototype.authenticate;
5122
5175
  /** @type {?|undefined} */
5123
5176
  Options.prototype.children;
5177
+ /** @type {?|undefined} */
5178
+ Options.prototype.defaultChild;
5124
5179
  }
5125
5180
  })(Place || (Place = {}));
5126
5181