@coolon/angular-ui-powerups 0.0.68 → 0.0.70

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.
@@ -2572,7 +2572,7 @@
2572
2572
  * @return {?}
2573
2573
  */
2574
2574
  function (visit) {
2575
- return !visit.hasParameter(this.name) || (this.isRouteId && !visit.hasRouteId());
2575
+ return !visit.hasParameter(this.name);
2576
2576
  };
2577
2577
  return ParameterDefinition;
2578
2578
  }());
@@ -3039,7 +3039,17 @@
3039
3039
  function (v) { return def.urlFormat.parse(v); }));
3040
3040
  }
3041
3041
  else {
3042
- result[def.name] = def.urlFormat.parse(params.get(def.name));
3042
+ /** @type {?} */
3043
+ var value = def.urlFormat.parse(params.get(def.name));
3044
+ // because our id routes redirect if the id isn't pressent we always have a id
3045
+ // parameter in our params. This will bugger our remember and defaultvalue sanitisation
3046
+ // as it'll see that the id is present (event thought its null). The sanitisation can't
3047
+ // check for null as that's a valid value for the id.
3048
+ /** @type {?} */
3049
+ var isEmptyRouteId = def.isRouteId && def.isEmptyValue(value);
3050
+ if (!isEmptyRouteId) {
3051
+ result[def.name] = value;
3052
+ }
3043
3053
  }
3044
3054
  }
3045
3055
  }));
@@ -3969,6 +3979,9 @@
3969
3979
  return __awaiter(this, void 0, void 0, function () {
3970
3980
  var _this = this;
3971
3981
  return __generator(this, function (_a) {
3982
+ // we have to push to history so our remember sanitisers don't pick up the previous value
3983
+ // when it's been cleared by the user.
3984
+ this.placeHistory.add(next);
3972
3985
  // FIXME: no route id -> route id duplicates route parameters
3973
3986
  if (next.hasRoutingChangedFrom(previous)) {
3974
3987
  return [2 /*return*/, this.doNavigation(next, (/**
@@ -3985,16 +3998,13 @@
3985
3998
  [def.getFormattedRouteId(next), def.getFormattedRouteParameters(next)] :
3986
3999
  [def.getFormattedRouteParameters(next)];
3987
4000
  /** @type {?} */
3988
- var commands = [relativePath].concat(params, _this.getChildPath(activatedRoute.snapshot));
4001
+ var commands = [relativePath].concat(params, _this.extractChildPath(activatedRoute.snapshot));
3989
4002
  console.log('### Redirect', commands);
3990
4003
  return router.navigate(commands, {
3991
4004
  relativeTo: activatedRoute
3992
4005
  });
3993
4006
  }))];
3994
4007
  }
3995
- else {
3996
- this.placeHistory.add(next);
3997
- }
3998
4008
  return [2 /*return*/];
3999
4009
  });
4000
4010
  });
@@ -4106,7 +4116,7 @@
4106
4116
  * @param {?} activatedRoute
4107
4117
  * @return {?}
4108
4118
  */
4109
- PlaceRouter.prototype.getChildPath = /**
4119
+ PlaceRouter.prototype.extractChildPath = /**
4110
4120
  * @param {?} activatedRoute
4111
4121
  * @return {?}
4112
4122
  */
@@ -5300,6 +5310,8 @@
5300
5310
  * @return {?}
5301
5311
  */
5302
5312
  function VisitParameter(options) {
5313
+ /** @type {?} */
5314
+ var opts = typescriptUtilities.Opts.get(options);
5303
5315
  return (/**
5304
5316
  * @param {?} prototype
5305
5317
  * @param {?} propertyKey
@@ -5307,7 +5319,7 @@
5307
5319
  */
5308
5320
  function (prototype, propertyKey) {
5309
5321
  /** @type {?} */
5310
- var param = new exports.ParameterDefinition.ValueParameter(propertyKey.toString(), options, options.storeInUrl);
5322
+ var param = new exports.ParameterDefinition.ValueParameter(propertyKey.toString(), options, opts.getOptional("storeInUrl", null));
5311
5323
  typescriptUtilities.Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
5312
5324
  pectin.UseDelegate()(prototype, propertyKey);
5313
5325
  });
@@ -5318,6 +5330,8 @@
5318
5330
  * @return {?}
5319
5331
  */
5320
5332
  function VisitParameterList(options) {
5333
+ /** @type {?} */
5334
+ var opts = typescriptUtilities.Opts.get(options);
5321
5335
  return (/**
5322
5336
  * @param {?} prototype
5323
5337
  * @param {?} propertyKey
@@ -5325,7 +5339,7 @@
5325
5339
  */
5326
5340
  function (prototype, propertyKey) {
5327
5341
  /** @type {?} */
5328
- var param = new exports.ParameterDefinition.ArrayParameter(propertyKey.toString(), options, options.storeInUrl);
5342
+ var param = new exports.ParameterDefinition.ArrayParameter(propertyKey.toString(), options, opts.getOptional("storeInUrl", null));
5329
5343
  typescriptUtilities.Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
5330
5344
  pectin.UseDelegate()(prototype, propertyKey);
5331
5345
  });
@@ -5634,7 +5648,7 @@
5634
5648
  */
5635
5649
  function (activatedRoute, state) {
5636
5650
  return __awaiter(this, void 0, void 0, function () {
5637
- var placeDefinition, params, parsedParams, initialVisit, sanitiser, updatedVisit, parameterCommands, commands;
5651
+ var placeDefinition, params, parsedParams, initialVisit, sanitiser, sanitisedVisit, parameterCommands, commands;
5638
5652
  return __generator(this, function (_a) {
5639
5653
  switch (_a.label) {
5640
5654
  case 0:
@@ -5647,14 +5661,14 @@
5647
5661
  sanitiser = new VisitSanitiser(activatedRoute, this.router, this.placeHistory, this.injector);
5648
5662
  return [4 /*yield*/, sanitiser.sanitise(initialVisit.mergeRouteParameters(parsedParams))];
5649
5663
  case 1:
5650
- updatedVisit = _a.sent();
5664
+ sanitisedVisit = _a.sent();
5651
5665
  // Save the visit with any updated parameters. We need to save it so we remember any non route parameters
5652
- this.placeRouter.navigationSession.storeVisit(updatedVisit);
5653
- if (initialVisit.hasRoutingChangedFrom(updatedVisit)) {
5654
- parameterCommands = updatedVisit.hasRouteId() ?
5655
- [placeDefinition.getFormattedRouteId(updatedVisit), placeDefinition.getFormattedRouteParameters(updatedVisit)] :
5656
- [placeDefinition.getFormattedRouteParameters(updatedVisit)];
5657
- commands = [(activatedRoute.url[0].path)].concat(parameterCommands, this.placeRouter.getChildPath(activatedRoute));
5666
+ this.placeRouter.navigationSession.storeVisit(sanitisedVisit);
5667
+ if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {
5668
+ parameterCommands = sanitisedVisit.hasRouteId() ?
5669
+ [placeDefinition.getFormattedRouteId(sanitisedVisit), placeDefinition.getFormattedRouteParameters(sanitisedVisit)] :
5670
+ [placeDefinition.getFormattedRouteParameters(sanitisedVisit)];
5671
+ commands = [(activatedRoute.url[0].path)].concat(parameterCommands, this.placeRouter.extractChildPath(activatedRoute));
5658
5672
  console.log('##### Redirect', commands);
5659
5673
  return [2 /*return*/, this.router.createUrlTree(commands, {
5660
5674
  replaceUrl: true,