@coolon/angular-ui-powerups 0.0.83 → 0.0.85

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.
@@ -7,7 +7,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
7
7
  import { __extends, __decorate, __metadata, __assign, __awaiter, __generator, __spread } from 'tslib';
8
8
  import { assert, UnaryCommand, lang, Dsl, GarbageCollector, Logger, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, DelegatingValueModel, MutableStream, MutableListModel, DelegatingListModel, StoreInValueModel, Binding, MutableValueModel, Trace, Guard as Guard$1, Command, OptionsHelper, ValueHolder } from '@coolon/pectin';
9
9
  import { PortalModule } from '@angular/cdk/portal';
10
- import { Router, RouterModule, UrlSegment, NavigationStart, NavigationEnd, NavigationError, RouterOutlet, ActivatedRouteSnapshot, RouterStateSnapshot, UrlSerializer } from '@angular/router';
10
+ import { Router, RouterModule, UrlSegment, NavigationStart, NavigationEnd, NavigationError, ActivatedRouteSnapshot, RouterStateSnapshot, UrlSerializer } from '@angular/router';
11
11
  import ___default, { last, isNil, isEqual } from 'lodash';
12
12
  import { assert as assert$1, Opts, Klass } from '@coolon/typescript-utilities';
13
13
  import { MatDialogConfig, MAT_DIALOG_DEFAULT_OPTIONS, MatDialog as MatDialog$1 } from '@angular/material/dialog';
@@ -4070,16 +4070,12 @@ var PlaceRouter = /** @class */ (function (_super) {
4070
4070
  [def.getFormattedRouteId(visit), def.getFormattedRouteParameters(visit)] :
4071
4071
  [def.getFormattedRouteParameters(visit)];
4072
4072
  };
4073
- // @Trace()
4074
- // @Trace()
4075
4073
  /**
4076
4074
  * @private
4077
4075
  * @param {?} event
4078
4076
  * @return {?}
4079
4077
  */
4080
- PlaceRouter.prototype.onAngularRouterStarted =
4081
- // @Trace()
4082
- /**
4078
+ PlaceRouter.prototype.onAngularRouterStarted = /**
4083
4079
  * @private
4084
4080
  * @param {?} event
4085
4081
  * @return {?}
@@ -4096,15 +4092,11 @@ var PlaceRouter = /** @class */ (function (_super) {
4096
4092
  }
4097
4093
  this.firstRoute = false;
4098
4094
  };
4099
- // @Trace()
4100
- // @Trace()
4101
4095
  /**
4102
4096
  * @private
4103
4097
  * @return {?}
4104
4098
  */
4105
- PlaceRouter.prototype.onAngularRouterFinished =
4106
- // @Trace()
4107
- /**
4099
+ PlaceRouter.prototype.onAngularRouterFinished = /**
4108
4100
  * @private
4109
4101
  * @return {?}
4110
4102
  */
@@ -4159,6 +4151,18 @@ var PlaceRouter = /** @class */ (function (_super) {
4159
4151
  __metadata("design:paramtypes", [Visit, Object]),
4160
4152
  __metadata("design:returntype", Promise)
4161
4153
  ], PlaceRouter.prototype, "navigate", null);
4154
+ __decorate([
4155
+ Trace(),
4156
+ __metadata("design:type", Function),
4157
+ __metadata("design:paramtypes", [NavigationStart]),
4158
+ __metadata("design:returntype", void 0)
4159
+ ], PlaceRouter.prototype, "onAngularRouterStarted", null);
4160
+ __decorate([
4161
+ Trace(),
4162
+ __metadata("design:type", Function),
4163
+ __metadata("design:paramtypes", []),
4164
+ __metadata("design:returntype", void 0)
4165
+ ], PlaceRouter.prototype, "onAngularRouterFinished", null);
4162
4166
  return PlaceRouter;
4163
4167
  }(GarbageCollector));
4164
4168
  if (false) {
@@ -4280,13 +4284,16 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
4280
4284
  _this.placeChanged = new EventEmitter();
4281
4285
  _this._activePlace = new MutableValueModel();
4282
4286
  _this._activePlaceVisitModel = new DelegatingValueModel();
4283
- _this._inOutletUpdate = new Guard$1();
4287
+ _this._inOutletActivation = new Guard$1();
4288
+ _this._inOutletDeactivation = new Guard$1();
4289
+ _this._inRouteVisitUpdate = new Guard$1();
4284
4290
  _this._activatedRouteModel = new MutableValueModel();
4285
4291
  _this._placeDefinition = new MutableValueModel();
4286
- _this.isOnInitialPlace = true;
4292
+ _this.initialPlaceIndex = null;
4287
4293
  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;
4288
4294
  _this.parentOutletModel = new MutableValueModel(parentOutlet);
4289
4295
  _this._activePlaceVisitModel.setDelegate(new MutableValueModel());
4296
+ _this._inOutletUpdate = valueOf.any(_this._inOutletDeactivation, _this._inOutletActivation).areTruthy();
4290
4297
  /** @type {?} */
4291
4298
  var defaultPlaceAnimationOrder = chain(_this.parentOutletModel)
4292
4299
  .pullValueModel((/**
@@ -4305,37 +4312,31 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
4305
4312
  function (p) { return (/** @type {?} */ (p.constructor)); }));
4306
4313
  _this.placeAnimationOrder = chain(_this.customPlaceAnimationOrderModel)
4307
4314
  .otherwise(defaultPlaceAnimationOrder)
4308
- .indexOf(activatePlaceType)
4309
- .map((/**
4310
- * @param {?} order
4315
+ .reduce((/**
4316
+ * @param {?} placesInOrder
4311
4317
  * @return {?}
4312
4318
  */
4313
- function (order) {
4314
- // we get -1 on the first load which triggers an animation to the first page, so alway pin it to 0
4315
- // if we're animating.
4316
- return _this.isOnInitialPlace ? 0 :
4317
- _this.animate ? Math.max(order, 0) : 0;
4318
- }));
4319
+ function (placesInOrder) {
4320
+ /** @type {?} */
4321
+ var placeIndex = 0;
4322
+ if (activatePlaceType.value) {
4323
+ placeIndex = placesInOrder.indexOf(activatePlaceType.value);
4324
+ if (isNil(_this.initialPlaceIndex)) {
4325
+ _this.initialPlaceIndex = placeIndex;
4326
+ }
4327
+ }
4328
+ return isNil(_this.initialPlaceIndex) ? 0 : placeIndex - _this.initialPlaceIndex;
4329
+ }), { dependsOn: activatePlaceType });
4319
4330
  // Push incoming changes into the component
4320
- /** @type {?} */
4321
- var routeVisit = chain(_this._activePlace).pluck('placeDefinition').findIn(placeRouter.activeVisitIndex);
4322
- /** @type {?} */
4323
- var inRouteVisitUpdate = new Guard$1();
4324
- when.valueOf(routeVisit).changes((/**
4325
- * @param {?} visit
4331
+ _this.routerVisit = chain(_this._activePlace).pluck('placeDefinition').findIn(placeRouter.activeVisitIndex);
4332
+ // Our router visit will change when our active is nullified during deactivation, which will push a null visit
4333
+ // the the deactivated component, which will nuke it's view before the animations have finished.
4334
+ // The visit will alway updated after the router session is finsised (when the new visits are registered) so
4335
+ // we can safely ignore it during outlet changes as these always happen before the router session ends.
4336
+ when.valueOf(_this.routerVisit).changes((/**
4326
4337
  * @return {?}
4327
4338
  */
4328
- function (visit) {
4329
- console.log("### Route visit changed");
4330
- if (visit) { // can be null while the place and index sync up
4331
- inRouteVisitUpdate.whileTrue((/**
4332
- * @return {?}
4333
- */
4334
- function () {
4335
- _this._activePlaceVisitModel.value = visit;
4336
- }));
4337
- }
4338
- }));
4339
+ function () { return _this.pushRouteChangesToVisit(); }), { unless: _this._inOutletUpdate });
4339
4340
  // Handle component based changes
4340
4341
  when.valueOf(_this._activePlaceVisitModel).changes((/**
4341
4342
  * @param {?} next
@@ -4345,7 +4346,7 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
4345
4346
  function (next, previous) {
4346
4347
  _this.pushVisitChangesToRoute(next, previous);
4347
4348
  }), {
4348
- unless: valueOf.any(_this._inOutletUpdate, inRouteVisitUpdate).areTruthy()
4349
+ unless: _this.placeRouter.navigationSessionActive
4349
4350
  });
4350
4351
  chain(_this._activePlace)
4351
4352
  .postponeWhile(placeRouter.navigationSessionActive)
@@ -4366,6 +4367,19 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
4366
4367
  */
4367
4368
  function () {
4368
4369
  };
4370
+ // @Trace()
4371
+ // @Trace()
4372
+ /**
4373
+ * @return {?}
4374
+ */
4375
+ PlaceOutletComponent.prototype.getAnimationOrder =
4376
+ // @Trace()
4377
+ /**
4378
+ * @return {?}
4379
+ */
4380
+ function () {
4381
+ return this.placeAnimationOrder.value;
4382
+ };
4369
4383
  Object.defineProperty(PlaceOutletComponent.prototype, "animationDuration", {
4370
4384
  get: /**
4371
4385
  * @return {?}
@@ -4376,16 +4390,20 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
4376
4390
  enumerable: true,
4377
4391
  configurable: true
4378
4392
  });
4393
+ // @Trace()
4394
+ // @Trace()
4379
4395
  /**
4380
4396
  * @param {?} visit
4381
4397
  * @return {?}
4382
4398
  */
4383
- PlaceOutletComponent.prototype.navigate = /**
4399
+ PlaceOutletComponent.prototype.navigate =
4400
+ // @Trace()
4401
+ /**
4384
4402
  * @param {?} visit
4385
4403
  * @return {?}
4386
4404
  */
4387
4405
  function (visit) {
4388
- console.log({ activatedRoute: this._activatedRouteModel.value });
4406
+ // console.log({ activatedRoute: this._activatedRouteModel.value });
4389
4407
  this.placeRouter.navigate(visit, {
4390
4408
  relativeTo: this.parentOutlet ? this.parentOutlet.activatedRouteModel.value : null
4391
4409
  });
@@ -4400,6 +4418,35 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
4400
4418
  enumerable: true,
4401
4419
  configurable: true
4402
4420
  });
4421
+ // @Trace()
4422
+ // @Trace()
4423
+ /**
4424
+ * @return {?}
4425
+ */
4426
+ PlaceOutletComponent.prototype.pushRouteChangesToVisit =
4427
+ // @Trace()
4428
+ /**
4429
+ * @return {?}
4430
+ */
4431
+ function () {
4432
+ var _this = this;
4433
+ /** @type {?} */
4434
+ var visit = this.routerVisit.value;
4435
+ console.log({
4436
+ visit: visit,
4437
+ place: visit ? visit.placeDefinition.component : null,
4438
+ inOutletActivation: this._inOutletActivation.value,
4439
+ inRoutingSession: this.placeRouter.navigationSessionActive.value
4440
+ });
4441
+ if (visit) { // can be null while the place and index sync up
4442
+ this._inRouteVisitUpdate.whileTrue((/**
4443
+ * @return {?}
4444
+ */
4445
+ function () {
4446
+ _this._activePlaceVisitModel.value = visit;
4447
+ }));
4448
+ }
4449
+ };
4403
4450
  /**
4404
4451
  * @param {?} next
4405
4452
  * @param {?} previous
@@ -4435,19 +4482,23 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
4435
4482
  enumerable: true,
4436
4483
  configurable: true
4437
4484
  });
4485
+ // @Trace()
4486
+ // @Trace()
4438
4487
  /**
4439
4488
  * @param {?} routerOutlet
4440
4489
  * @param {?} place
4441
4490
  * @return {?}
4442
4491
  */
4443
- PlaceOutletComponent.prototype.onOutletActivated = /**
4492
+ PlaceOutletComponent.prototype.onOutletActivated =
4493
+ // @Trace()
4494
+ /**
4444
4495
  * @param {?} routerOutlet
4445
4496
  * @param {?} place
4446
4497
  * @return {?}
4447
4498
  */
4448
4499
  function (routerOutlet, place) {
4449
4500
  var _this = this;
4450
- this._inOutletUpdate.whileTrue((/**
4501
+ this._inOutletActivation.whileTrue((/**
4451
4502
  * @return {?}
4452
4503
  */
4453
4504
  function () {
@@ -4469,38 +4520,49 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
4469
4520
  this.animationDone();
4470
4521
  }
4471
4522
  };
4523
+ // @Trace()
4524
+ // @Trace()
4472
4525
  /**
4473
4526
  * @return {?}
4474
4527
  */
4475
- PlaceOutletComponent.prototype.onOutletDeactivated = /**
4528
+ PlaceOutletComponent.prototype.onOutletDeactivated =
4529
+ // @Trace()
4530
+ /**
4476
4531
  * @return {?}
4477
4532
  */
4478
4533
  function () {
4479
4534
  var _this = this;
4480
- this._inOutletUpdate.whileTrue((/**
4535
+ this._inOutletDeactivation.whileTrue((/**
4481
4536
  * @return {?}
4482
4537
  */
4483
4538
  function () {
4484
- _this._activePlaceVisitModel.setDelegate(null);
4485
- _this.isOnInitialPlace = false;
4486
4539
  _this._activePlace.value = null;
4487
4540
  _this._activatedRouteModel.value = null;
4488
4541
  _this._placeDefinition.value = null;
4542
+ _this._activePlaceVisitModel.setDelegate(null);
4489
4543
  }));
4490
4544
  };
4545
+ // @Trace()
4546
+ // @Trace()
4491
4547
  /**
4492
4548
  * @return {?}
4493
4549
  */
4494
- PlaceOutletComponent.prototype.animationStarted = /**
4550
+ PlaceOutletComponent.prototype.animationStarted =
4551
+ // @Trace()
4552
+ /**
4495
4553
  * @return {?}
4496
4554
  */
4497
4555
  function () {
4498
4556
  console.log({ activePlace: this._activePlace.value });
4499
4557
  };
4558
+ // @Trace()
4559
+ // @Trace()
4500
4560
  /**
4501
4561
  * @return {?}
4502
4562
  */
4503
- PlaceOutletComponent.prototype.animationDone = /**
4563
+ PlaceOutletComponent.prototype.animationDone =
4564
+ // @Trace()
4565
+ /**
4504
4566
  * @return {?}
4505
4567
  */
4506
4568
  function () {
@@ -4511,7 +4573,7 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
4511
4573
  PlaceOutletComponent.decorators = [
4512
4574
  { type: Component, args: [{
4513
4575
  selector: 'aup-place-outlet',
4514
- template: "<div class=\"router-outlet-container\"\n [@routeAnimations]=\"{value: placeAnimationOrder.value, 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",
4576
+ 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",
4515
4577
  animations: [LEFT_RIGHT_PLACE_ANIMATION],
4516
4578
  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}"]
4517
4579
  }] }
@@ -4538,36 +4600,6 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
4538
4600
  StoreInListModel('customPlaceAnimationOrderModel'),
4539
4601
  __metadata("design:type", Array)
4540
4602
  ], PlaceOutletComponent.prototype, "customPlaceAnimationOrder", void 0);
4541
- __decorate([
4542
- Trace(),
4543
- __metadata("design:type", Function),
4544
- __metadata("design:paramtypes", [Visit]),
4545
- __metadata("design:returntype", void 0)
4546
- ], PlaceOutletComponent.prototype, "navigate", null);
4547
- __decorate([
4548
- Trace(),
4549
- __metadata("design:type", Function),
4550
- __metadata("design:paramtypes", [RouterOutlet, PlaceComponent]),
4551
- __metadata("design:returntype", void 0)
4552
- ], PlaceOutletComponent.prototype, "onOutletActivated", null);
4553
- __decorate([
4554
- Trace(),
4555
- __metadata("design:type", Function),
4556
- __metadata("design:paramtypes", []),
4557
- __metadata("design:returntype", void 0)
4558
- ], PlaceOutletComponent.prototype, "onOutletDeactivated", null);
4559
- __decorate([
4560
- Trace(),
4561
- __metadata("design:type", Function),
4562
- __metadata("design:paramtypes", []),
4563
- __metadata("design:returntype", void 0)
4564
- ], PlaceOutletComponent.prototype, "animationStarted", null);
4565
- __decorate([
4566
- Trace(),
4567
- __metadata("design:type", Function),
4568
- __metadata("design:paramtypes", []),
4569
- __metadata("design:returntype", void 0)
4570
- ], PlaceOutletComponent.prototype, "animationDone", null);
4571
4603
  return PlaceOutletComponent;
4572
4604
  }(DisposableComponent));
4573
4605
  if (false) {
@@ -4591,11 +4623,26 @@ if (false) {
4591
4623
  * @private
4592
4624
  */
4593
4625
  PlaceOutletComponent.prototype._activePlaceVisitModel;
4626
+ /**
4627
+ * @type {?}
4628
+ * @private
4629
+ */
4630
+ PlaceOutletComponent.prototype._inOutletActivation;
4631
+ /**
4632
+ * @type {?}
4633
+ * @private
4634
+ */
4635
+ PlaceOutletComponent.prototype._inOutletDeactivation;
4594
4636
  /**
4595
4637
  * @type {?}
4596
4638
  * @private
4597
4639
  */
4598
4640
  PlaceOutletComponent.prototype._inOutletUpdate;
4641
+ /**
4642
+ * @type {?}
4643
+ * @private
4644
+ */
4645
+ PlaceOutletComponent.prototype._inRouteVisitUpdate;
4599
4646
  /**
4600
4647
  * @type {?}
4601
4648
  * @private
@@ -4617,7 +4664,12 @@ if (false) {
4617
4664
  * @type {?}
4618
4665
  * @private
4619
4666
  */
4620
- PlaceOutletComponent.prototype.isOnInitialPlace;
4667
+ PlaceOutletComponent.prototype.initialPlaceIndex;
4668
+ /**
4669
+ * @type {?}
4670
+ * @private
4671
+ */
4672
+ PlaceOutletComponent.prototype.routerVisit;
4621
4673
  /**
4622
4674
  * @type {?}
4623
4675
  * @private
@@ -4834,7 +4886,6 @@ var TabbedPlaceNavigationComponent = /** @class */ (function (_super) {
4834
4886
  * @fileoverview added by tsickle
4835
4887
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4836
4888
  */
4837
- var ɵ0 = { animationDuration: "2000ms" };
4838
4889
  var PlaceModule = /** @class */ (function () {
4839
4890
  function PlaceModule() {
4840
4891
  }
@@ -4867,7 +4918,7 @@ var PlaceModule = /** @class */ (function () {
4867
4918
  ListPlaceNavComponent
4868
4919
  ],
4869
4920
  providers: [
4870
- { provide: AUP_PLACE_CONFIG, useValue: ɵ0 }
4921
+ // {provide: AUP_PLACE_CONFIG, useValue: {animationDuration: "2000ms"}}
4871
4922
  ]
4872
4923
  },] }
4873
4924
  ];