@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.
- package/bundles/coolon-angular-ui-powerups.umd.js +31 -17
- package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
- package/bundles/coolon-angular-ui-powerups.umd.min.js +1 -1
- package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -1
- package/coolon-angular-ui-powerups.metadata.json +1 -1
- package/esm2015/lib/place/place-definition.js +12 -2
- package/esm2015/lib/place/place-router.js +6 -6
- package/esm2015/lib/place/route/guards/place-route.guard.js +8 -8
- package/esm2015/lib/place/route/parameter-decorators.js +8 -4
- package/esm2015/lib/place/route/parameter-definition.class.js +2 -2
- package/esm5/lib/place/place-definition.js +12 -2
- package/esm5/lib/place/place-router.js +6 -6
- package/esm5/lib/place/route/guards/place-route.guard.js +9 -9
- package/esm5/lib/place/route/parameter-decorators.js +8 -4
- package/esm5/lib/place/route/parameter-definition.class.js +2 -2
- package/fesm2015/coolon-angular-ui-powerups.js +30 -16
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +31 -17
- package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/place/place-router.d.ts +1 -1
- package/package.json +1 -1
|
@@ -2389,7 +2389,7 @@ ParameterDefinition = /** @class */ (function () {
|
|
|
2389
2389
|
* @return {?}
|
|
2390
2390
|
*/
|
|
2391
2391
|
function (visit) {
|
|
2392
|
-
return !visit.hasParameter(this.name)
|
|
2392
|
+
return !visit.hasParameter(this.name);
|
|
2393
2393
|
};
|
|
2394
2394
|
return ParameterDefinition;
|
|
2395
2395
|
}());
|
|
@@ -2856,7 +2856,17 @@ var PlaceDefinition = /** @class */ (function () {
|
|
|
2856
2856
|
function (v) { return def.urlFormat.parse(v); }));
|
|
2857
2857
|
}
|
|
2858
2858
|
else {
|
|
2859
|
-
|
|
2859
|
+
/** @type {?} */
|
|
2860
|
+
var value = def.urlFormat.parse(params.get(def.name));
|
|
2861
|
+
// because our id routes redirect if the id isn't pressent we always have a id
|
|
2862
|
+
// parameter in our params. This will bugger our remember and defaultvalue sanitisation
|
|
2863
|
+
// as it'll see that the id is present (event thought its null). The sanitisation can't
|
|
2864
|
+
// check for null as that's a valid value for the id.
|
|
2865
|
+
/** @type {?} */
|
|
2866
|
+
var isEmptyRouteId = def.isRouteId && def.isEmptyValue(value);
|
|
2867
|
+
if (!isEmptyRouteId) {
|
|
2868
|
+
result[def.name] = value;
|
|
2869
|
+
}
|
|
2860
2870
|
}
|
|
2861
2871
|
}
|
|
2862
2872
|
}));
|
|
@@ -3786,6 +3796,9 @@ var PlaceRouter = /** @class */ (function (_super) {
|
|
|
3786
3796
|
return __awaiter(this, void 0, void 0, function () {
|
|
3787
3797
|
var _this = this;
|
|
3788
3798
|
return __generator(this, function (_a) {
|
|
3799
|
+
// we have to push to history so our remember sanitisers don't pick up the previous value
|
|
3800
|
+
// when it's been cleared by the user.
|
|
3801
|
+
this.placeHistory.add(next);
|
|
3789
3802
|
// FIXME: no route id -> route id duplicates route parameters
|
|
3790
3803
|
if (next.hasRoutingChangedFrom(previous)) {
|
|
3791
3804
|
return [2 /*return*/, this.doNavigation(next, (/**
|
|
@@ -3802,16 +3815,13 @@ var PlaceRouter = /** @class */ (function (_super) {
|
|
|
3802
3815
|
[def.getFormattedRouteId(next), def.getFormattedRouteParameters(next)] :
|
|
3803
3816
|
[def.getFormattedRouteParameters(next)];
|
|
3804
3817
|
/** @type {?} */
|
|
3805
|
-
var commands = [relativePath].concat(params, _this.
|
|
3818
|
+
var commands = [relativePath].concat(params, _this.extractChildPath(activatedRoute.snapshot));
|
|
3806
3819
|
console.log('### Redirect', commands);
|
|
3807
3820
|
return router.navigate(commands, {
|
|
3808
3821
|
relativeTo: activatedRoute
|
|
3809
3822
|
});
|
|
3810
3823
|
}))];
|
|
3811
3824
|
}
|
|
3812
|
-
else {
|
|
3813
|
-
this.placeHistory.add(next);
|
|
3814
|
-
}
|
|
3815
3825
|
return [2 /*return*/];
|
|
3816
3826
|
});
|
|
3817
3827
|
});
|
|
@@ -3923,7 +3933,7 @@ var PlaceRouter = /** @class */ (function (_super) {
|
|
|
3923
3933
|
* @param {?} activatedRoute
|
|
3924
3934
|
* @return {?}
|
|
3925
3935
|
*/
|
|
3926
|
-
PlaceRouter.prototype.
|
|
3936
|
+
PlaceRouter.prototype.extractChildPath = /**
|
|
3927
3937
|
* @param {?} activatedRoute
|
|
3928
3938
|
* @return {?}
|
|
3929
3939
|
*/
|
|
@@ -5117,6 +5127,8 @@ function RouteId(type, options) {
|
|
|
5117
5127
|
* @return {?}
|
|
5118
5128
|
*/
|
|
5119
5129
|
function VisitParameter(options) {
|
|
5130
|
+
/** @type {?} */
|
|
5131
|
+
var opts = Opts.get(options);
|
|
5120
5132
|
return (/**
|
|
5121
5133
|
* @param {?} prototype
|
|
5122
5134
|
* @param {?} propertyKey
|
|
@@ -5124,7 +5136,7 @@ function VisitParameter(options) {
|
|
|
5124
5136
|
*/
|
|
5125
5137
|
function (prototype, propertyKey) {
|
|
5126
5138
|
/** @type {?} */
|
|
5127
|
-
var param = new ParameterDefinition.ValueParameter(propertyKey.toString(), options,
|
|
5139
|
+
var param = new ParameterDefinition.ValueParameter(propertyKey.toString(), options, opts.getOptional("storeInUrl", null));
|
|
5128
5140
|
Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
|
|
5129
5141
|
UseDelegate()(prototype, propertyKey);
|
|
5130
5142
|
});
|
|
@@ -5135,6 +5147,8 @@ function VisitParameter(options) {
|
|
|
5135
5147
|
* @return {?}
|
|
5136
5148
|
*/
|
|
5137
5149
|
function VisitParameterList(options) {
|
|
5150
|
+
/** @type {?} */
|
|
5151
|
+
var opts = Opts.get(options);
|
|
5138
5152
|
return (/**
|
|
5139
5153
|
* @param {?} prototype
|
|
5140
5154
|
* @param {?} propertyKey
|
|
@@ -5142,7 +5156,7 @@ function VisitParameterList(options) {
|
|
|
5142
5156
|
*/
|
|
5143
5157
|
function (prototype, propertyKey) {
|
|
5144
5158
|
/** @type {?} */
|
|
5145
|
-
var param = new ParameterDefinition.ArrayParameter(propertyKey.toString(), options,
|
|
5159
|
+
var param = new ParameterDefinition.ArrayParameter(propertyKey.toString(), options, opts.getOptional("storeInUrl", null));
|
|
5146
5160
|
Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
|
|
5147
5161
|
UseDelegate()(prototype, propertyKey);
|
|
5148
5162
|
});
|
|
@@ -5451,7 +5465,7 @@ var PlaceRouteGuard = /** @class */ (function () {
|
|
|
5451
5465
|
*/
|
|
5452
5466
|
function (activatedRoute, state) {
|
|
5453
5467
|
return __awaiter(this, void 0, void 0, function () {
|
|
5454
|
-
var placeDefinition, params, parsedParams, initialVisit, sanitiser,
|
|
5468
|
+
var placeDefinition, params, parsedParams, initialVisit, sanitiser, sanitisedVisit, parameterCommands, commands;
|
|
5455
5469
|
return __generator(this, function (_a) {
|
|
5456
5470
|
switch (_a.label) {
|
|
5457
5471
|
case 0:
|
|
@@ -5464,14 +5478,14 @@ var PlaceRouteGuard = /** @class */ (function () {
|
|
|
5464
5478
|
sanitiser = new VisitSanitiser(activatedRoute, this.router, this.placeHistory, this.injector);
|
|
5465
5479
|
return [4 /*yield*/, sanitiser.sanitise(initialVisit.mergeRouteParameters(parsedParams))];
|
|
5466
5480
|
case 1:
|
|
5467
|
-
|
|
5481
|
+
sanitisedVisit = _a.sent();
|
|
5468
5482
|
// Save the visit with any updated parameters. We need to save it so we remember any non route parameters
|
|
5469
|
-
this.placeRouter.navigationSession.storeVisit(
|
|
5470
|
-
if (initialVisit.hasRoutingChangedFrom(
|
|
5471
|
-
parameterCommands =
|
|
5472
|
-
[placeDefinition.getFormattedRouteId(
|
|
5473
|
-
[placeDefinition.getFormattedRouteParameters(
|
|
5474
|
-
commands = [(activatedRoute.url[0].path)].concat(parameterCommands, this.placeRouter.
|
|
5483
|
+
this.placeRouter.navigationSession.storeVisit(sanitisedVisit);
|
|
5484
|
+
if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {
|
|
5485
|
+
parameterCommands = sanitisedVisit.hasRouteId() ?
|
|
5486
|
+
[placeDefinition.getFormattedRouteId(sanitisedVisit), placeDefinition.getFormattedRouteParameters(sanitisedVisit)] :
|
|
5487
|
+
[placeDefinition.getFormattedRouteParameters(sanitisedVisit)];
|
|
5488
|
+
commands = [(activatedRoute.url[0].path)].concat(parameterCommands, this.placeRouter.extractChildPath(activatedRoute));
|
|
5475
5489
|
console.log('##### Redirect', commands);
|
|
5476
5490
|
return [2 /*return*/, this.router.createUrlTree(commands, {
|
|
5477
5491
|
replaceUrl: true,
|