@coolon/angular-ui-powerups 2.0.0-alpha.12 → 2.0.0-alpha.14

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 (40) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/bundles/coolon-angular-ui-powerups.umd.js +84 -93
  3. package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
  4. package/bundles/coolon-angular-ui-powerups.umd.min.js +1 -1
  5. package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -1
  6. package/coolon-angular-ui-powerups.metadata.json +1 -1
  7. package/esm2015/lib/components/forms/abstract-list-input.component.js +11 -10
  8. package/esm2015/lib/components/forms/abstract-list-input.component.js.map +1 -1
  9. package/esm2015/lib/components/forms/abstract-list-input.component.metadata.json +1 -1
  10. package/esm2015/lib/components/forms/abstract-value-input.component.js +2 -1
  11. package/esm2015/lib/components/forms/abstract-value-input.component.js.map +1 -1
  12. package/esm2015/lib/interaction/components/activity-container/activity-container.component.js +2 -7
  13. package/esm2015/lib/interaction/components/activity-container/activity-container.component.js.map +1 -1
  14. package/esm2015/lib/interaction/components/activity-container/activity-container.component.metadata.json +1 -1
  15. package/esm2015/lib/place/place-component.js +1 -1
  16. package/esm2015/lib/place/place-component.js.map +1 -1
  17. package/esm2015/lib/place/place-router.js +2 -8
  18. package/esm2015/lib/place/place-router.js.map +1 -1
  19. package/esm2015/lib/place/place-router.metadata.json +1 -1
  20. package/esm2015/lib/place/route/parameter-decorators.js +2 -3
  21. package/esm2015/lib/place/route/parameter-decorators.js.map +1 -1
  22. package/esm2015/lib/place/route/parameter-decorators.metadata.json +1 -1
  23. package/esm5/lib/components/forms/abstract-list-input.component.js +11 -10
  24. package/esm5/lib/components/forms/abstract-list-input.component.js.map +1 -1
  25. package/esm5/lib/components/forms/abstract-value-input.component.js +2 -1
  26. package/esm5/lib/components/forms/abstract-value-input.component.js.map +1 -1
  27. package/esm5/lib/interaction/components/activity-container/activity-container.component.js +2 -7
  28. package/esm5/lib/interaction/components/activity-container/activity-container.component.js.map +1 -1
  29. package/esm5/lib/place/place-component.js +1 -1
  30. package/esm5/lib/place/place-component.js.map +1 -1
  31. package/esm5/lib/place/place-router.js +2 -8
  32. package/esm5/lib/place/place-router.js.map +1 -1
  33. package/esm5/lib/place/route/parameter-decorators.js +2 -3
  34. package/esm5/lib/place/route/parameter-decorators.js.map +1 -1
  35. package/fesm2015/coolon-angular-ui-powerups.js +80 -89
  36. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  37. package/fesm5/coolon-angular-ui-powerups.js +85 -94
  38. package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
  39. package/lib/components/forms/abstract-list-input.component.d.ts +1 -1
  40. package/package.json +1 -1
@@ -17,7 +17,7 @@ import { MatTableModule } from '@angular/material/table';
17
17
  import { MatTooltipModule } from '@angular/material/tooltip';
18
18
  import { FaIconLibrary, FontAwesomeModule } from '@fortawesome/angular-fontawesome';
19
19
  import { fas } from '@fortawesome/free-solid-svg-icons';
20
- import { DelegatingValueModel, assert, UnaryCommand, lang, Dsl, GarbageCollector, Logger, TrackExternal, Command, FocusManager, Form, Guard, MutableListModel, MutableValueModel, ListModel, StoreInListModel, ValueModel, StoreInValueModel, MultipleSelectionModel, DirtyTrackingForm, DelegatingCommand, Deferred, Trace, DebugContext, Binding, Functions } from '@coolon/pectin';
20
+ import { DelegatingValueModel, assert, UnaryCommand, lang, Dsl, GarbageCollector, Logger, TrackExternal, Command, FocusManager, Form, Guard, DebugContext, MutableListModel, MutableValueModel, ListModel, StoreInListModel, ValueModel, StoreInValueModel, MultipleSelectionModel, DirtyTrackingForm, DelegatingCommand, Deferred, Binding, Functions } from '@coolon/pectin';
21
21
  import ___default, { isEqual, isNil } from 'lodash';
22
22
  import { assert as assert$1, Opts, lang as lang$1, Klass } from '@coolon/typescript-utilities';
23
23
  import { Memoize } from '@typescript-plus/fast-memoize-decorator/dist/src';
@@ -717,27 +717,28 @@ var AbstractListInputComponent = /** @class */ (function (_super) {
717
717
  */
718
718
  // We have to register it as a disposable so it ditches any listeners when we're disposed.
719
719
  _this.inputModel = _this.registerDisposable(new Form.DelegatingListModel());
720
- _this.setValueIsInitialising = new Guard();
720
+ _this.setValueIsInProgress = new Guard();
721
721
  _this.valueChange = new EventEmitter();
722
722
  var when = Dsl.disposeWith(_this).when;
723
723
  when(_this.inputModel).changes(function (value) { return _this.valueChange.emit(value); }, {
724
724
  initialValue: 'ignore',
725
- unless: _this.setValueIsInitialising
725
+ unless: _this.setValueIsInProgress
726
726
  });
727
+ DebugContext.tag(_this.inputModel, _this.constructor.name + ".inputModel");
727
728
  return _this;
728
729
  }
729
730
  Object.defineProperty(AbstractListInputComponent.prototype, "value", {
730
731
  set: function (value) {
731
732
  var _this = this;
732
- if (!this.listHolder) {
733
- this.setValueIsInitialising.whileTrue(function () {
733
+ this.setValueIsInProgress.whileTrue(function () {
734
+ if (!_this.listHolder) {
734
735
  _this.listHolder = new MutableListModel(value);
735
736
  _this.listModel = _this.listHolder;
736
- });
737
- }
738
- else {
739
- this.listHolder.value = value;
740
- }
737
+ }
738
+ else {
739
+ _this.listHolder.value = value;
740
+ }
741
+ });
741
742
  },
742
743
  enumerable: true,
743
744
  configurable: true
@@ -785,6 +786,7 @@ var AbstractValueInputComponent = /** @class */ (function (_super) {
785
786
  initialValue: 'ignore',
786
787
  unless: _this.setValueInProgress
787
788
  });
789
+ DebugContext.tag(_this.inputModel, _this.constructor.name + ".inputModel");
788
790
  return _this;
789
791
  }
790
792
  Object.defineProperty(AbstractValueInputComponent.prototype, "value", {
@@ -3050,6 +3052,7 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
3050
3052
  ActivityContainerComponent.prototype.registerDisposable = function (disposable) {
3051
3053
  return this.garbage.registerDisposable(disposable);
3052
3054
  };
3055
+ // @Trace()
3053
3056
  ActivityContainerComponent.prototype.dispose = function () {
3054
3057
  // TODO: think about auto cancelling any outstanding activity on dispose.
3055
3058
  // See NavigationState.Navigating for a use-case.
@@ -3198,12 +3201,6 @@ var ActivityContainerComponent = /** @class */ (function (_super) {
3198
3201
  ViewChildren(ActivityOutletComponent),
3199
3202
  __metadata("design:type", QueryList)
3200
3203
  ], ActivityContainerComponent.prototype, "activityOutlets", void 0);
3201
- __decorate([
3202
- Trace(),
3203
- __metadata("design:type", Function),
3204
- __metadata("design:paramtypes", []),
3205
- __metadata("design:returntype", void 0)
3206
- ], ActivityContainerComponent.prototype, "dispose", null);
3207
3204
  ActivityContainerComponent = __decorate([
3208
3205
  Component({
3209
3206
  selector: 'aup-activity-container',
@@ -4287,7 +4284,7 @@ var PlaceComponent = /** @class */ (function (_super) {
4287
4284
  assert.isNil(this.visitModel.value);
4288
4285
  var when = Dsl.disposeWith(this).when;
4289
4286
  this.visitModel.value = visit;
4290
- DebugContext.get(this.visitModel).tag(this.placeDefinition.component.name + ".visitModel");
4287
+ DebugContext.getOrCreate(this.visitModel).tag(this.placeDefinition.component.name + ".visitModel");
4291
4288
  this.placeDefinition.getVisitParameterDefs().forEach(function (parameterDef) { return _this.installBinding(parameterDef); });
4292
4289
  when.valueOf(this.visitModel).changes(function (current, previous) {
4293
4290
  notifyVisitChanged(current, previous);
@@ -5435,75 +5432,6 @@ var UrlService = /** @class */ (function () {
5435
5432
  return UrlService;
5436
5433
  }());
5437
5434
 
5438
- var Visit = /** @class */ (function () {
5439
- function Visit(placeDefinition, visitParameters) {
5440
- if (visitParameters === void 0) { visitParameters = {}; }
5441
- this.placeDefinition = placeDefinition;
5442
- this.visitParameters = visitParameters;
5443
- }
5444
- // @Trace()
5445
- Visit.prototype.getRouteId = function () {
5446
- return this.placeDefinition.getRouteIdFrom(this);
5447
- };
5448
- // @Trace()
5449
- Visit.prototype.hasRouteId = function () {
5450
- return !isNil(this.getRouteId());
5451
- };
5452
- /**
5453
- * Returns the value of the place parameter with the specified name. The parameter
5454
- * name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the
5455
- * same as the the ValueModel property name.
5456
- * @param parameterName the field name of the property model or the `as` option if specified.
5457
- */
5458
- Visit.prototype.getParameter = function (parameterName) {
5459
- return this.visitParameters[parameterName];
5460
- };
5461
- // @Trace()
5462
- Visit.prototype.hasParameter = function (parameterName) {
5463
- return Object.keys(this.visitParameters).includes(parameterName);
5464
- };
5465
- Visit.prototype.replace = function (parameter, value) {
5466
- var _a;
5467
- return new Visit(this.placeDefinition, __assign(__assign({}, this.visitParameters), (_a = {}, _a[parameter.name] = value, _a)));
5468
- };
5469
- Visit.prototype.mergeRouteParameters = function (routeParams) {
5470
- var _this = this;
5471
- // todo: whitelist parameters.
5472
- var routeParameterKeys = Object.keys(routeParams);
5473
- var params = {};
5474
- this.placeDefinition.getVisitParameterDefs().forEach(function (def) {
5475
- if (def.isRouteId || def.isRouteParameter) {
5476
- if (routeParameterKeys.includes(def.name)) {
5477
- params[def.name] = routeParams[def.name];
5478
- }
5479
- }
5480
- else {
5481
- // copy non route params as is, but only if they already exist otherwise we'll inject nil values and break the
5482
- // defaults and remember sanitisation process.
5483
- var value = _this.getParameter(def.name);
5484
- if (_this.hasParameter(def.name)) {
5485
- params[def.name] = value;
5486
- }
5487
- }
5488
- });
5489
- return new Visit(this.placeDefinition, params);
5490
- };
5491
- Visit.prototype.hasRoutingChangedFrom = function (other) {
5492
- var samePlace = other.placeDefinition === this.placeDefinition;
5493
- var sameRouteParameters = isEqual(this.placeDefinition.getFormattedRouteParameters(this, true), this.placeDefinition.getFormattedRouteParameters(other, true));
5494
- return !samePlace || !sameRouteParameters;
5495
- };
5496
- Visit.prototype.hasChangedFrom = function (other) {
5497
- var sameNonRouteParameters = isEqual(this.placeDefinition.getNonRouteParameters(this), this.placeDefinition.getNonRouteParameters(other));
5498
- return !sameNonRouteParameters || this.hasRoutingChangedFrom(other);
5499
- };
5500
- Visit.prototype.toDebugString = function () {
5501
- var _this = this;
5502
- return Object.keys(this.visitParameters).map(function (k) { return k + "=" + _this.visitParameters[k]; }).join(",");
5503
- };
5504
- return Visit;
5505
- }());
5506
-
5507
5435
  var PlaceRouter = /** @class */ (function (_super) {
5508
5436
  __extends(PlaceRouter, _super);
5509
5437
  function PlaceRouter(angularRouter, angularLocation, interactionService, urlService, placeHistory) {
@@ -5699,6 +5627,7 @@ var PlaceRouter = /** @class */ (function (_super) {
5699
5627
  enumerable: true,
5700
5628
  configurable: true
5701
5629
  });
5630
+ // @Trace()
5702
5631
  PlaceRouter.prototype.pushVisitChangesToRoute = function (previous, next) {
5703
5632
  return __awaiter(this, void 0, void 0, function () {
5704
5633
  var _this = this;
@@ -5799,12 +5728,6 @@ var PlaceRouter = /** @class */ (function (_super) {
5799
5728
  { type: PlaceHistory }
5800
5729
  ]; };
5801
5730
  PlaceRouter.ɵprov = ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(ɵɵinject(Router), ɵɵinject(Location), ɵɵinject(InteractionService), ɵɵinject(UrlService), ɵɵinject(PlaceHistory)); }, token: PlaceRouter, providedIn: "root" });
5802
- __decorate([
5803
- Trace(),
5804
- __metadata("design:type", Function),
5805
- __metadata("design:paramtypes", [Visit, Visit]),
5806
- __metadata("design:returntype", Promise)
5807
- ], PlaceRouter.prototype, "pushVisitChangesToRoute", null);
5808
5731
  PlaceRouter = __decorate([
5809
5732
  Injectable({
5810
5733
  providedIn: 'root'
@@ -5818,6 +5741,75 @@ var PlaceRouter = /** @class */ (function (_super) {
5818
5741
  return PlaceRouter;
5819
5742
  }(GarbageCollector));
5820
5743
 
5744
+ var Visit = /** @class */ (function () {
5745
+ function Visit(placeDefinition, visitParameters) {
5746
+ if (visitParameters === void 0) { visitParameters = {}; }
5747
+ this.placeDefinition = placeDefinition;
5748
+ this.visitParameters = visitParameters;
5749
+ }
5750
+ // @Trace()
5751
+ Visit.prototype.getRouteId = function () {
5752
+ return this.placeDefinition.getRouteIdFrom(this);
5753
+ };
5754
+ // @Trace()
5755
+ Visit.prototype.hasRouteId = function () {
5756
+ return !isNil(this.getRouteId());
5757
+ };
5758
+ /**
5759
+ * Returns the value of the place parameter with the specified name. The parameter
5760
+ * name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the
5761
+ * same as the the ValueModel property name.
5762
+ * @param parameterName the field name of the property model or the `as` option if specified.
5763
+ */
5764
+ Visit.prototype.getParameter = function (parameterName) {
5765
+ return this.visitParameters[parameterName];
5766
+ };
5767
+ // @Trace()
5768
+ Visit.prototype.hasParameter = function (parameterName) {
5769
+ return Object.keys(this.visitParameters).includes(parameterName);
5770
+ };
5771
+ Visit.prototype.replace = function (parameter, value) {
5772
+ var _a;
5773
+ return new Visit(this.placeDefinition, __assign(__assign({}, this.visitParameters), (_a = {}, _a[parameter.name] = value, _a)));
5774
+ };
5775
+ Visit.prototype.mergeRouteParameters = function (routeParams) {
5776
+ var _this = this;
5777
+ // todo: whitelist parameters.
5778
+ var routeParameterKeys = Object.keys(routeParams);
5779
+ var params = {};
5780
+ this.placeDefinition.getVisitParameterDefs().forEach(function (def) {
5781
+ if (def.isRouteId || def.isRouteParameter) {
5782
+ if (routeParameterKeys.includes(def.name)) {
5783
+ params[def.name] = routeParams[def.name];
5784
+ }
5785
+ }
5786
+ else {
5787
+ // copy non route params as is, but only if they already exist otherwise we'll inject nil values and break the
5788
+ // defaults and remember sanitisation process.
5789
+ var value = _this.getParameter(def.name);
5790
+ if (_this.hasParameter(def.name)) {
5791
+ params[def.name] = value;
5792
+ }
5793
+ }
5794
+ });
5795
+ return new Visit(this.placeDefinition, params);
5796
+ };
5797
+ Visit.prototype.hasRoutingChangedFrom = function (other) {
5798
+ var samePlace = other.placeDefinition === this.placeDefinition;
5799
+ var sameRouteParameters = isEqual(this.placeDefinition.getFormattedRouteParameters(this, true), this.placeDefinition.getFormattedRouteParameters(other, true));
5800
+ return !samePlace || !sameRouteParameters;
5801
+ };
5802
+ Visit.prototype.hasChangedFrom = function (other) {
5803
+ var sameNonRouteParameters = isEqual(this.placeDefinition.getNonRouteParameters(this), this.placeDefinition.getNonRouteParameters(other));
5804
+ return !sameNonRouteParameters || this.hasRoutingChangedFrom(other);
5805
+ };
5806
+ Visit.prototype.toDebugString = function () {
5807
+ var _this = this;
5808
+ return Object.keys(this.visitParameters).map(function (k) { return k + "=" + _this.visitParameters[k]; }).join(",");
5809
+ };
5810
+ return Visit;
5811
+ }());
5812
+
5821
5813
  var AUP_PLACE_CONFIG = new InjectionToken('AUP_PLACE_CONFIG');
5822
5814
 
5823
5815
  // Freezes the state of the components at the start of the animation.
@@ -6832,8 +6824,7 @@ function installMechanics(prototype, propertyKey, backingModel, tagPrefix, isEmp
6832
6824
  binding: null
6833
6825
  };
6834
6826
  var tag = tagPrefix + "(" + prototype.constructor.name + "." + propertyKey.toString() + ")";
6835
- DebugContext.get(mechanics.backingModel).tag(tag);
6836
- Logger.get(mechanics.backingModel).tag(tag);
6827
+ DebugContext.getOrCreate(mechanics.backingModel).tag(tag);
6837
6828
  Object.defineProperty(prototype, propertyKey, {
6838
6829
  get: function () {
6839
6830
  return mechanics.backingModel;