@coolon/angular-ui-powerups 0.0.122 → 0.0.125

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.
@@ -3311,21 +3311,10 @@ var PlaceComponent = /** @class */ (function (_super) {
3311
3311
  * @return {?}
3312
3312
  */
3313
3313
  function (visit) {
3314
+ var _this = this;
3314
3315
  assert.isNil(this.visit);
3315
3316
  this.visit = visit;
3316
3317
  DebugContext.get(this.visit).tag(this.placeDefinition.component.name + ".visit");
3317
- // this.placeDefinition.getVisitParameterDefs().forEach(parameterDef => {
3318
- // this.installBinding(parameterDef);
3319
- // });
3320
- };
3321
- /**
3322
- * @return {?}
3323
- */
3324
- PlaceComponent.prototype.ngAfterViewInit = /**
3325
- * @return {?}
3326
- */
3327
- function () {
3328
- var _this = this;
3329
3318
  this.placeDefinition.getVisitParameterDefs().forEach((/**
3330
3319
  * @param {?} parameterDef
3331
3320
  * @return {?}
@@ -8443,6 +8432,57 @@ if (false) {
8443
8432
  /** @type {?|undefined} */
8444
8433
  RouteListParameterOptions.prototype.storeInUrl;
8445
8434
  }
8435
+ /**
8436
+ * @template M
8437
+ * @param {?} prototype
8438
+ * @param {?} propertyKey
8439
+ * @param {?} backingModel
8440
+ * @param {?} tagPrefix
8441
+ * @param {?} isEmpty
8442
+ * @return {?}
8443
+ */
8444
+ function installMechanics(prototype, propertyKey, backingModel, tagPrefix, isEmpty) {
8445
+ /** @type {?} */
8446
+ var mechanics = {
8447
+ backingModel: backingModel,
8448
+ binding: (/** @type {?} */ (null))
8449
+ };
8450
+ /** @type {?} */
8451
+ var tag = tagPrefix + "(" + prototype.constructor.name + "." + propertyKey.toString() + ")";
8452
+ DebugContext.get(mechanics.backingModel).tag(tag);
8453
+ Logger.get(mechanics.backingModel).tag(tag);
8454
+ Object.defineProperty(prototype, propertyKey, {
8455
+ get: (/**
8456
+ * @return {?}
8457
+ */
8458
+ function () {
8459
+ return mechanics.backingModel;
8460
+ }),
8461
+ set: (/**
8462
+ * @param {?} userModel
8463
+ * @return {?}
8464
+ */
8465
+ function (userModel) {
8466
+ // This handles the scenario where we want to push an existing value model (such as a form model)
8467
+ // to and from the route.
8468
+ if (mechanics.binding) {
8469
+ mechanics.binding.dispose();
8470
+ }
8471
+ if (userModel) {
8472
+ mechanics.binding = new Binding(mechanics.backingModel, userModel);
8473
+ if (isEmpty(userModel)) {
8474
+ mechanics.binding.writeRight(); // push the visit into the user model;
8475
+ }
8476
+ else {
8477
+ if (!isEmpty(mechanics.backingModel)) {
8478
+ console.warn('Assigning a visit model with an existing value to a visit parameter with an existing value. Visit parameter will be overridden');
8479
+ }
8480
+ mechanics.binding.writeLeft(); // push the user model into the visit
8481
+ }
8482
+ }
8483
+ })
8484
+ });
8485
+ }
8446
8486
  /**
8447
8487
  * @template T
8448
8488
  * @param {?} type
@@ -8459,8 +8499,11 @@ function RouteId(type, options) {
8459
8499
  /** @type {?} */
8460
8500
  var param = new ParameterDefinition.RouteId(propertyKey.toString(), options, type);
8461
8501
  Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
8462
- UseDelegate({ tag: "@RouteId(" + prototype.constructor.name + "." + propertyKey.toString() + ")" })(prototype, propertyKey);
8463
- // UseDelegate()(prototype, propertyKey);
8502
+ installMechanics(prototype, propertyKey, new MutableValueModel(), "@RouteId", (/**
8503
+ * @param {?} m
8504
+ * @return {?}
8505
+ */
8506
+ function (m) { return m.query().isNil(); }));
8464
8507
  });
8465
8508
  }
8466
8509
  /**
@@ -8478,10 +8521,13 @@ function VisitParameter(options) {
8478
8521
  */
8479
8522
  function (prototype, propertyKey) {
8480
8523
  /** @type {?} */
8481
- var param = new ParameterDefinition.ValueParameter(propertyKey.toString(), options, opts.getOptional("storeInUrl", null));
8524
+ var param = new ParameterDefinition.ValueParameter(propertyKey.toString(), options, opts.getOptional('storeInUrl', null));
8482
8525
  Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
8483
- UseDelegate({ tag: "@VisitParameter(" + prototype.constructor.name + "." + propertyKey.toString() + ")" })(prototype, propertyKey);
8484
- // UseDelegate()(prototype, propertyKey);
8526
+ installMechanics(prototype, propertyKey, new MutableValueModel(), "@VisitParameter", (/**
8527
+ * @param {?} m
8528
+ * @return {?}
8529
+ */
8530
+ function (m) { return m.query().isNil(); }));
8485
8531
  });
8486
8532
  }
8487
8533
  /**
@@ -8499,10 +8545,13 @@ function VisitParameterList(options) {
8499
8545
  */
8500
8546
  function (prototype, propertyKey) {
8501
8547
  /** @type {?} */
8502
- var param = new ParameterDefinition.ArrayParameter(propertyKey.toString(), options, opts.getOptional("storeInUrl", null));
8503
- UseDelegate({ tag: "@VisitParameterList(" + prototype.constructor.name + "." + propertyKey.toString() + ")" })(prototype, propertyKey);
8504
- // UseDelegate()(prototype, propertyKey);
8548
+ var param = new ParameterDefinition.ArrayParameter(propertyKey.toString(), options, opts.getOptional('storeInUrl', null));
8505
8549
  Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
8550
+ installMechanics(prototype, propertyKey, new MutableListModel(), "@VisitParameterList", (/**
8551
+ * @param {?} m
8552
+ * @return {?}
8553
+ */
8554
+ function (m) { return m.query().isEmpty(); }));
8506
8555
  });
8507
8556
  }
8508
8557