@coolon/angular-ui-powerups 0.0.121 → 0.0.123

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 +117 -14
  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/esm2015/lib/place/components/place-outlet/place-outlet.component.js +8 -3
  6. package/esm2015/lib/place/components/place-outlet/place-outlet.component.js.map +1 -1
  7. package/esm2015/lib/place/place-component.js +19 -5
  8. package/esm2015/lib/place/place-component.js.map +1 -1
  9. package/esm2015/lib/place/place-component.metadata.json +1 -1
  10. package/esm2015/lib/place/place-definition.js +7 -1
  11. package/esm2015/lib/place/place-definition.js.map +1 -1
  12. package/esm2015/lib/place/route/parameter-decorators.js +83 -7
  13. package/esm2015/lib/place/route/parameter-decorators.js.map +1 -1
  14. package/esm5/lib/place/components/place-outlet/place-outlet.component.js +8 -3
  15. package/esm5/lib/place/components/place-outlet/place-outlet.component.js.map +1 -1
  16. package/esm5/lib/place/place-component.js +19 -5
  17. package/esm5/lib/place/place-component.js.map +1 -1
  18. package/esm5/lib/place/place-definition.js +11 -2
  19. package/esm5/lib/place/place-definition.js.map +1 -1
  20. package/esm5/lib/place/route/parameter-decorators.js +83 -7
  21. package/esm5/lib/place/route/parameter-decorators.js.map +1 -1
  22. package/fesm2015/coolon-angular-ui-powerups.js +114 -14
  23. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  24. package/fesm5/coolon-angular-ui-powerups.js +118 -15
  25. package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
  26. package/lib/place/place-component.d.ts +1 -1
  27. package/package.json +2 -2
@@ -5,7 +5,7 @@ import { MatInputModule, MatFormFieldModule, MatSelectModule, MatButtonModule, M
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, MutableValueModel, MutableListModel, DebugContext, Binding, Guard, StoreInValueModel, Command, ValueHolder } from '@coolon/pectin';
8
+ import { DelegatingValueModel, assert, UnaryCommand, lang, Dsl, GarbageCollector, Logger, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, DelegatingListModel, Deferred, MutableStream, MutableValueModel, MutableListModel, DebugContext, Binding, Trace, Guard, StoreInValueModel, Command, ValueHolder } from '@coolon/pectin';
9
9
  import { PortalModule } from '@angular/cdk/portal';
10
10
  import { RouterModule, UrlSegment, NavigationStart, NavigationEnd, NavigationError, NavigationCancel, Router, UrlSerializer } from '@angular/router';
11
11
  import { assert as assert$1, Opts, Klass } from '@coolon/typescript-utilities';
@@ -3110,12 +3110,16 @@ var PlaceDefinition = /** @class */ (function () {
3110
3110
  // an empty string.
3111
3111
  return visit.hasRouteId() ? this.getRouteIdParameterDef().urlFormat.format(visit.getRouteId()) : "";
3112
3112
  };
3113
+ // @Trace()
3114
+ // @Trace()
3113
3115
  /**
3114
3116
  * @param {?} visit
3115
3117
  * @param {?=} includeRouteId
3116
3118
  * @return {?}
3117
3119
  */
3118
- PlaceDefinition.prototype.getFormattedRouteParameters = /**
3120
+ PlaceDefinition.prototype.getFormattedRouteParameters =
3121
+ // @Trace()
3122
+ /**
3119
3123
  * @param {?} visit
3120
3124
  * @param {?=} includeRouteId
3121
3125
  * @return {?}
@@ -3201,8 +3205,13 @@ var PlaceDefinition = /** @class */ (function () {
3201
3205
  // params will return null for non existent names
3202
3206
  if (params.has(def.name)) {
3203
3207
  if (def.isArray) {
3208
+ // const values = params.getAll(def.name); // TODO: EEEK getAll is returning ["1,2,3,4"] when we gave it ["1","2","3","4"].
3204
3209
  /** @type {?} */
3205
- var values = params.getAll(def.name);
3210
+ var values = params.get(def.name).split(',').map((/**
3211
+ * @param {?} s
3212
+ * @return {?}
3213
+ */
3214
+ function (s) { return s.trim(); }));
3206
3215
  result[def.name] = values.map((/**
3207
3216
  * @param {?} v
3208
3217
  * @return {?}
@@ -3297,7 +3306,7 @@ var PlaceComponent = /** @class */ (function (_super) {
3297
3306
  * @param {?} visit
3298
3307
  * @return {?}
3299
3308
  */
3300
- PlaceComponent.prototype.initialiseBindings = /**
3309
+ PlaceComponent.prototype.initialiseVisit = /**
3301
3310
  * @param {?} visit
3302
3311
  * @return {?}
3303
3312
  */
@@ -3329,8 +3338,9 @@ var PlaceComponent = /** @class */ (function (_super) {
3329
3338
  function (parameterDef) {
3330
3339
  /** @type {?} */
3331
3340
  var model = (/** @type {?} */ (this[parameterDef.propertyName]));
3332
- // this.txo.observe(parameterDef.propertyName, model);
3333
- this.registerDisposable(new Binding(this.visit, model, {
3341
+ DebugContext.tag(model, this.placeDefinition.component.name + "." + parameterDef.propertyName);
3342
+ /** @type {?} */
3343
+ var binding = this.registerDisposable(new Binding(this.visit, model, {
3334
3344
  toRight: /**
3335
3345
  * @param {?} visit
3336
3346
  * @return {?}
@@ -3338,7 +3348,7 @@ var PlaceComponent = /** @class */ (function (_super) {
3338
3348
  function (visit) {
3339
3349
  /** @type {?} */
3340
3350
  var value = visit.getParameter(parameterDef.name);
3341
- // console.log('push to component', {name:parameterDef.name, value, visit});
3351
+ console.log('push to component', { name: parameterDef.name, value: value, visit: visit });
3342
3352
  return value;
3343
3353
  },
3344
3354
  toLeft: /**
@@ -3351,6 +3361,12 @@ var PlaceComponent = /** @class */ (function (_super) {
3351
3361
  return currentVisit.replace(parameterDef, value);
3352
3362
  }
3353
3363
  }));
3364
+ setTimeout((/**
3365
+ * @return {?}
3366
+ */
3367
+ function () {
3368
+ binding.writeRight();
3369
+ }));
3354
3370
  };
3355
3371
  Object.defineProperty(PlaceComponent.prototype, "placeDefinition", {
3356
3372
  get: /**
@@ -3384,6 +3400,12 @@ var PlaceComponent = /** @class */ (function (_super) {
3384
3400
  */
3385
3401
  function () {
3386
3402
  };
3403
+ __decorate([
3404
+ Trace(),
3405
+ __metadata("design:type", Function),
3406
+ __metadata("design:paramtypes", [ParameterDefinition]),
3407
+ __metadata("design:returntype", void 0)
3408
+ ], PlaceComponent.prototype, "installBinding", null);
3387
3409
  __decorate([
3388
3410
  Memoize$1(),
3389
3411
  __metadata("design:type", PlaceDefinition),
@@ -6252,7 +6274,11 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
6252
6274
  _this.initialPlaceIndex = null;
6253
6275
  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;
6254
6276
  _this.parentOutletModel = new MutableValueModel(parentOutlet);
6255
- _this._activePlaceVisitModel.setDelegate(new MutableValueModel());
6277
+ /** @type {?} */
6278
+ var mutableValueModel = new MutableValueModel();
6279
+ DebugContext.tag(mutableValueModel, "PlaceOutletComponent -> mutableValueModel");
6280
+ _this._activePlaceVisitModel.setDelegate(mutableValueModel);
6281
+ DebugContext.tag(_this._activePlaceVisitModel, "PlaceOutletComponent._activePlaceVisitModel");
6256
6282
  _this._inOutletUpdate = valueOf.any(_this._inOutletDeactivation, _this._inOutletActivation).areTruthy();
6257
6283
  /** @type {?} */
6258
6284
  var defaultPlaceAnimationOrder = chain(_this.parentOutletModel)
@@ -6466,8 +6492,9 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
6466
6492
  _this._placeDefinition.value = place.placeDefinition;
6467
6493
  /** @type {?} */
6468
6494
  var visitModel = new MutableValueModel();
6495
+ DebugContext.tag(visitModel, "PlaceOutletCompeont.visitModel");
6469
6496
  _this._activePlaceVisitModel.setDelegate(visitModel);
6470
- place.initialiseBindings(visitModel);
6497
+ place.initialiseVisit(visitModel);
6471
6498
  }
6472
6499
  catch (error) {
6473
6500
  console.error(error);
@@ -8440,10 +8467,48 @@ function VisitParameter(options) {
8440
8467
  */
8441
8468
  function (prototype, propertyKey) {
8442
8469
  /** @type {?} */
8443
- var param = new ParameterDefinition.ValueParameter(propertyKey.toString(), options, opts.getOptional("storeInUrl", null));
8470
+ var param = new ParameterDefinition.ValueParameter(propertyKey.toString(), options, opts.getOptional('storeInUrl', null));
8444
8471
  Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
8445
- UseDelegate({ tag: "@VisitParameter(" + prototype.constructor.name + "." + propertyKey.toString() + ")" })(prototype, propertyKey);
8446
- // UseDelegate()(prototype, propertyKey);
8472
+ /** @type {?} */
8473
+ var mechanics = {
8474
+ backingModel: new MutableValueModel(),
8475
+ binding: (/** @type {?} */ (null))
8476
+ };
8477
+ /** @type {?} */
8478
+ var tag = "@VisitParameter(" + prototype.constructor.name + "." + propertyKey.toString() + ")";
8479
+ DebugContext.get(mechanics.backingModel).tag(tag);
8480
+ Logger.get(mechanics.backingModel).tag(tag);
8481
+ Object.defineProperty(prototype, propertyKey, {
8482
+ get: (/**
8483
+ * @return {?}
8484
+ */
8485
+ function () {
8486
+ return mechanics.backingModel;
8487
+ }),
8488
+ set: (/**
8489
+ * @param {?} userModel
8490
+ * @return {?}
8491
+ */
8492
+ function (userModel) {
8493
+ // This handles the scenario where we want to push an existing value model (such as a form model)
8494
+ // to and from the route.
8495
+ if (mechanics.binding) {
8496
+ mechanics.binding.dispose();
8497
+ }
8498
+ if (userModel) {
8499
+ mechanics.binding = new Binding(mechanics.backingModel, userModel);
8500
+ if (userModel.query().isNil()) {
8501
+ mechanics.binding.writeRight(); // push the visit into the user model;
8502
+ }
8503
+ else {
8504
+ if (!mechanics.backingModel.query().isNil()) {
8505
+ console.warn('Assigning a visit model with an existing value to a visit parameter with an existing value. Visit parameter will be overridden');
8506
+ }
8507
+ mechanics.binding.writeLeft(); // push the user model into the visit
8508
+ }
8509
+ }
8510
+ })
8511
+ });
8447
8512
  });
8448
8513
  }
8449
8514
  /**
@@ -8461,10 +8526,48 @@ function VisitParameterList(options) {
8461
8526
  */
8462
8527
  function (prototype, propertyKey) {
8463
8528
  /** @type {?} */
8464
- var param = new ParameterDefinition.ArrayParameter(propertyKey.toString(), options, opts.getOptional("storeInUrl", null));
8465
- UseDelegate({ tag: "@VisitParameterList(" + prototype.constructor.name + "." + propertyKey.toString() + ")" })(prototype, propertyKey);
8466
- // UseDelegate()(prototype, propertyKey);
8529
+ var param = new ParameterDefinition.ArrayParameter(propertyKey.toString(), options, opts.getOptional('storeInUrl', null));
8467
8530
  Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
8531
+ /** @type {?} */
8532
+ var mechanics = {
8533
+ backingModel: new MutableListModel(),
8534
+ binding: (/** @type {?} */ (null))
8535
+ };
8536
+ /** @type {?} */
8537
+ var tag = "@VisitParameterList(" + prototype.constructor.name + "." + propertyKey.toString() + ")";
8538
+ DebugContext.get(mechanics.backingModel).tag(tag);
8539
+ Logger.get(mechanics.backingModel).tag(tag);
8540
+ Object.defineProperty(prototype, propertyKey, {
8541
+ get: (/**
8542
+ * @return {?}
8543
+ */
8544
+ function () {
8545
+ return mechanics.backingModel;
8546
+ }),
8547
+ set: (/**
8548
+ * @param {?} userModel
8549
+ * @return {?}
8550
+ */
8551
+ function (userModel) {
8552
+ // This handles the scenario where we want to push an existing value model (such as a form model)
8553
+ // to and from the route.
8554
+ if (mechanics.binding) {
8555
+ mechanics.binding.dispose();
8556
+ }
8557
+ if (userModel) {
8558
+ mechanics.binding = new Binding(mechanics.backingModel, userModel);
8559
+ if (userModel.query().isEmpty()) {
8560
+ mechanics.binding.writeRight(); // push the visit into the user model;
8561
+ }
8562
+ else {
8563
+ if (!mechanics.backingModel.query().isEmpty()) {
8564
+ console.warn('Assigning a visit model with an existing value to a visit parameter with an existing value. Visit parameter will be overridden');
8565
+ }
8566
+ mechanics.binding.writeLeft(); // push the user model into the visit
8567
+ }
8568
+ }
8569
+ })
8570
+ });
8468
8571
  });
8469
8572
  }
8470
8573