@coolon/angular-ui-powerups 0.0.44 → 0.0.46
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 +545 -218
- 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/coolon-angular-ui-powerups.js +2 -2
- package/esm2015/index.js +2 -2
- package/esm2015/lib/place/components/place-outlet/place-outlet.component.js +17 -12
- package/esm2015/lib/place/guards/place-route.guard.js +4 -4
- package/esm2015/lib/place/index.js +1 -2
- package/esm2015/lib/place/place-component.js +2 -2
- package/esm2015/lib/place/place-history.js +29 -6
- package/esm2015/lib/place/place-router.js +38 -23
- package/esm2015/lib/place/route/parameter-decorators.js +1 -1
- package/esm2015/lib/place/route/parameter-definition.class.js +92 -9
- package/esm2015/lib/place/route/parameter-sanitiser.js +4 -3
- package/esm2015/lib/place/route/parameter-snapshot.js +221 -23
- package/esm2015/lib/place/route/route-parameter-sanitiser.js +2 -2
- package/esm2015/lib/place/visit.js +3 -3
- package/esm2015/public_api.js +2 -2
- package/esm5/coolon-angular-ui-powerups.js +2 -2
- package/esm5/index.js +2 -2
- package/esm5/lib/place/components/place-outlet/place-outlet.component.js +17 -12
- package/esm5/lib/place/guards/place-route.guard.js +4 -4
- package/esm5/lib/place/index.js +1 -2
- package/esm5/lib/place/place-component.js +2 -2
- package/esm5/lib/place/place-history.js +39 -6
- package/esm5/lib/place/place-router.js +45 -28
- package/esm5/lib/place/route/parameter-decorators.js +1 -1
- package/esm5/lib/place/route/parameter-definition.class.js +104 -9
- package/esm5/lib/place/route/parameter-sanitiser.js +4 -3
- package/esm5/lib/place/route/parameter-snapshot.js +276 -23
- package/esm5/lib/place/route/route-parameter-sanitiser.js +2 -2
- package/esm5/lib/place/visit.js +3 -3
- package/esm5/public_api.js +2 -2
- package/fesm2015/coolon-angular-ui-powerups.js +453 -198
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +547 -219
- package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/place/components/place-outlet/place-outlet.component.d.ts +0 -1
- package/lib/place/index.d.ts +0 -1
- package/lib/place/place-history.d.ts +3 -0
- package/lib/place/place-router.d.ts +4 -3
- package/lib/place/route/parameter-definition.class.d.ts +12 -2
- package/lib/place/route/parameter-sanitiser.d.ts +3 -2
- package/lib/place/route/parameter-snapshot.d.ts +11 -8
- package/lib/place/visit.d.ts +2 -2
- package/package.json +1 -1
- package/esm2015/lib/place/route/default-parameter-sanitiser.js +0 -66
- package/esm5/lib/place/route/default-parameter-sanitiser.js +0 -73
- package/lib/place/route/default-parameter-sanitiser.d.ts +0 -11
|
@@ -13,7 +13,7 @@ import { MatDialog as MatDialog$1 } from '@angular/material/dialog';
|
|
|
13
13
|
import { MatIconModule } from '@angular/material/icon';
|
|
14
14
|
import { MatListModule } from '@angular/material/list';
|
|
15
15
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
16
|
-
import { Router, RouterModule } from '@angular/router';
|
|
16
|
+
import { Router, ActivatedRouteSnapshot, UrlTree, RouterModule } from '@angular/router';
|
|
17
17
|
import { Memoize as Memoize$1 } from '@typescript-plus/fast-memoize-decorator/dist/src';
|
|
18
18
|
import { Memoize } from '@typescript-plus/fast-memoize-decorator';
|
|
19
19
|
import 'reflect-metadata';
|
|
@@ -1902,7 +1902,7 @@ var PlaceComponent = /** @class */ (function (_super) {
|
|
|
1902
1902
|
* @return {?}
|
|
1903
1903
|
*/
|
|
1904
1904
|
function (parameters) {
|
|
1905
|
-
return parameters.
|
|
1905
|
+
return parameters.getValueOf(parameterDef);
|
|
1906
1906
|
},
|
|
1907
1907
|
toLeft: /**
|
|
1908
1908
|
* @param {?} value
|
|
@@ -2148,7 +2148,7 @@ if (false) {
|
|
|
2148
2148
|
var PlaceHistory = /** @class */ (function () {
|
|
2149
2149
|
function PlaceHistory(router) {
|
|
2150
2150
|
this.router = router;
|
|
2151
|
-
this._history =
|
|
2151
|
+
this._history = new Map();
|
|
2152
2152
|
}
|
|
2153
2153
|
/**
|
|
2154
2154
|
* @param {?} state
|
|
@@ -2160,131 +2160,69 @@ var PlaceHistory = /** @class */ (function () {
|
|
|
2160
2160
|
*/
|
|
2161
2161
|
function (state) {
|
|
2162
2162
|
/** @type {?} */
|
|
2163
|
-
var
|
|
2163
|
+
var history = this.getHistory(state.placeDefinition);
|
|
2164
|
+
/** @type {?} */
|
|
2165
|
+
var previousState = ___default.last(history);
|
|
2164
2166
|
if (!previousState || state.hasChanged(previousState)) {
|
|
2165
|
-
|
|
2166
|
-
// limit our history to
|
|
2167
|
-
this._history = this._history.slice(-100);
|
|
2167
|
+
history.unshift(state); // LIFO
|
|
2168
|
+
this.setHistory(state.placeDefinition, history.slice(-3)); // limit our history to 3 visits
|
|
2168
2169
|
}
|
|
2169
2170
|
};
|
|
2170
|
-
PlaceHistory.decorators = [
|
|
2171
|
-
{ type: Injectable, args: [{
|
|
2172
|
-
providedIn: 'root'
|
|
2173
|
-
},] }
|
|
2174
|
-
];
|
|
2175
|
-
/** @nocollapse */
|
|
2176
|
-
PlaceHistory.ctorParameters = function () { return [
|
|
2177
|
-
{ type: Router }
|
|
2178
|
-
]; };
|
|
2179
|
-
/** @nocollapse */ PlaceHistory.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceHistory_Factory() { return new PlaceHistory(ɵɵinject(Router)); }, token: PlaceHistory, providedIn: "root" });
|
|
2180
|
-
return PlaceHistory;
|
|
2181
|
-
}());
|
|
2182
|
-
if (false) {
|
|
2183
2171
|
/**
|
|
2184
|
-
* @
|
|
2185
|
-
* @private
|
|
2186
|
-
*/
|
|
2187
|
-
PlaceHistory.prototype._history;
|
|
2188
|
-
/**
|
|
2189
|
-
* @type {?}
|
|
2190
|
-
* @private
|
|
2191
|
-
*/
|
|
2192
|
-
PlaceHistory.prototype.router;
|
|
2193
|
-
}
|
|
2194
|
-
|
|
2195
|
-
/**
|
|
2196
|
-
* @fileoverview added by tsickle
|
|
2197
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
2198
|
-
*/
|
|
2199
|
-
var PlaceRouter = /** @class */ (function () {
|
|
2200
|
-
function PlaceRouter(router) {
|
|
2201
|
-
this.router = router;
|
|
2202
|
-
}
|
|
2203
|
-
/**
|
|
2204
|
-
* @param {?} activatedRoute
|
|
2205
|
-
* @param {?} previous
|
|
2206
|
-
* @param {?} next
|
|
2207
|
-
* @return {?}
|
|
2208
|
-
*/
|
|
2209
|
-
PlaceRouter.prototype.pushParameterChangesToRoute = /**
|
|
2210
|
-
* @param {?} activatedRoute
|
|
2211
|
-
* @param {?} previous
|
|
2212
|
-
* @param {?} next
|
|
2213
|
-
* @return {?}
|
|
2214
|
-
*/
|
|
2215
|
-
function (activatedRoute, previous, next) {
|
|
2216
|
-
this.router.navigate(this.redirect(activatedRoute.snapshot, previous, next), {
|
|
2217
|
-
relativeTo: activatedRoute
|
|
2218
|
-
});
|
|
2219
|
-
};
|
|
2220
|
-
/**
|
|
2221
|
-
* @param {?} activatedRoute
|
|
2222
|
-
* @param {?} sanitised
|
|
2223
|
-
* @param {?} snapshot
|
|
2172
|
+
* @param {?} placeDef
|
|
2224
2173
|
* @return {?}
|
|
2225
2174
|
*/
|
|
2226
|
-
|
|
2227
|
-
* @param {?}
|
|
2228
|
-
* @param {?} sanitised
|
|
2229
|
-
* @param {?} snapshot
|
|
2175
|
+
PlaceHistory.prototype.getHistory = /**
|
|
2176
|
+
* @param {?} placeDef
|
|
2230
2177
|
* @return {?}
|
|
2231
2178
|
*/
|
|
2232
|
-
function (
|
|
2233
|
-
|
|
2179
|
+
function (placeDef) {
|
|
2180
|
+
/** @type {?} */
|
|
2181
|
+
var history = this._history.get(placeDef);
|
|
2182
|
+
if (!history) {
|
|
2183
|
+
history = [];
|
|
2184
|
+
this.setHistory(placeDef, history);
|
|
2185
|
+
}
|
|
2186
|
+
return history;
|
|
2234
2187
|
};
|
|
2235
2188
|
/**
|
|
2236
|
-
* @
|
|
2237
|
-
* @param {?}
|
|
2238
|
-
* @param {?}
|
|
2239
|
-
* @param {?} next
|
|
2189
|
+
* @private
|
|
2190
|
+
* @param {?} placeDef
|
|
2191
|
+
* @param {?} history
|
|
2240
2192
|
* @return {?}
|
|
2241
2193
|
*/
|
|
2242
|
-
|
|
2243
|
-
* @
|
|
2244
|
-
* @param {?}
|
|
2245
|
-
* @param {?}
|
|
2246
|
-
* @param {?} next
|
|
2194
|
+
PlaceHistory.prototype.setHistory = /**
|
|
2195
|
+
* @private
|
|
2196
|
+
* @param {?} placeDef
|
|
2197
|
+
* @param {?} history
|
|
2247
2198
|
* @return {?}
|
|
2248
2199
|
*/
|
|
2249
|
-
function (
|
|
2250
|
-
|
|
2251
|
-
var childSegments = ___default.flatten(activatedRoute.children.map((/**
|
|
2252
|
-
* @param {?} child
|
|
2253
|
-
* @return {?}
|
|
2254
|
-
*/
|
|
2255
|
-
function (child) { return child.url; })));
|
|
2256
|
-
/** @type {?} */
|
|
2257
|
-
var relativePath = !!previous.hasRouteId() ? '..' : '.';
|
|
2258
|
-
/** @type {?} */
|
|
2259
|
-
var routeId = next.getFormattedRouteId();
|
|
2260
|
-
/** @type {?} */
|
|
2261
|
-
var path = routeId ?
|
|
2262
|
-
[relativePath, routeId, next.getFormattedParameters()] :
|
|
2263
|
-
[relativePath, next.getFormattedParameters()];
|
|
2264
|
-
return path.concat(childSegments.map((/**
|
|
2265
|
-
* @param {?} s
|
|
2266
|
-
* @return {?}
|
|
2267
|
-
*/
|
|
2268
|
-
function (s) { return s.path; })));
|
|
2200
|
+
function (placeDef, history) {
|
|
2201
|
+
this._history.set(placeDef, history);
|
|
2269
2202
|
};
|
|
2270
|
-
|
|
2203
|
+
PlaceHistory.decorators = [
|
|
2271
2204
|
{ type: Injectable, args: [{
|
|
2272
2205
|
providedIn: 'root'
|
|
2273
2206
|
},] }
|
|
2274
2207
|
];
|
|
2275
2208
|
/** @nocollapse */
|
|
2276
|
-
|
|
2209
|
+
PlaceHistory.ctorParameters = function () { return [
|
|
2277
2210
|
{ type: Router }
|
|
2278
2211
|
]; };
|
|
2279
|
-
/** @nocollapse */
|
|
2280
|
-
return
|
|
2212
|
+
/** @nocollapse */ PlaceHistory.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceHistory_Factory() { return new PlaceHistory(ɵɵinject(Router)); }, token: PlaceHistory, providedIn: "root" });
|
|
2213
|
+
return PlaceHistory;
|
|
2281
2214
|
}());
|
|
2282
2215
|
if (false) {
|
|
2283
2216
|
/**
|
|
2284
2217
|
* @type {?}
|
|
2285
2218
|
* @private
|
|
2286
2219
|
*/
|
|
2287
|
-
|
|
2220
|
+
PlaceHistory.prototype._history;
|
|
2221
|
+
/**
|
|
2222
|
+
* @type {?}
|
|
2223
|
+
* @private
|
|
2224
|
+
*/
|
|
2225
|
+
PlaceHistory.prototype.router;
|
|
2288
2226
|
}
|
|
2289
2227
|
|
|
2290
2228
|
/**
|
|
@@ -2306,11 +2244,8 @@ ParameterDefinition = /** @class */ (function () {
|
|
|
2306
2244
|
/** @type {?} */
|
|
2307
2245
|
var opts = Opts.get(options);
|
|
2308
2246
|
this.name = opts.getOptional('as', propertyName);
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
// opts.getOptional('remember', false),
|
|
2312
|
-
// opts.getOptional('defaultValue', null)
|
|
2313
|
-
// );
|
|
2247
|
+
this.remember = opts.getOptional('remember', false);
|
|
2248
|
+
this.defaultValue = opts.getOptional('defaultValue', null);
|
|
2314
2249
|
}
|
|
2315
2250
|
/**
|
|
2316
2251
|
* @param {?} injector
|
|
@@ -2321,7 +2256,12 @@ ParameterDefinition = /** @class */ (function () {
|
|
|
2321
2256
|
* @return {?}
|
|
2322
2257
|
*/
|
|
2323
2258
|
function (injector) {
|
|
2324
|
-
|
|
2259
|
+
if (this.remember || !___default.isNil(this.defaultValue)) {
|
|
2260
|
+
return new ParameterDefinition.DefaultParameterSanitiser(this.remember, this.defaultValue, injector.get(PlaceHistory));
|
|
2261
|
+
}
|
|
2262
|
+
else {
|
|
2263
|
+
return null;
|
|
2264
|
+
}
|
|
2325
2265
|
};
|
|
2326
2266
|
return ParameterDefinition;
|
|
2327
2267
|
}());
|
|
@@ -2332,8 +2272,16 @@ if (false) {
|
|
|
2332
2272
|
ParameterDefinition.prototype.isArray;
|
|
2333
2273
|
/** @type {?} */
|
|
2334
2274
|
ParameterDefinition.prototype.name;
|
|
2335
|
-
/**
|
|
2336
|
-
|
|
2275
|
+
/**
|
|
2276
|
+
* @type {?}
|
|
2277
|
+
* @private
|
|
2278
|
+
*/
|
|
2279
|
+
ParameterDefinition.prototype.remember;
|
|
2280
|
+
/**
|
|
2281
|
+
* @type {?}
|
|
2282
|
+
* @private
|
|
2283
|
+
*/
|
|
2284
|
+
ParameterDefinition.prototype.defaultValue;
|
|
2337
2285
|
/** @type {?} */
|
|
2338
2286
|
ParameterDefinition.prototype.propertyName;
|
|
2339
2287
|
/** @type {?} */
|
|
@@ -2425,6 +2373,89 @@ if (false) {
|
|
|
2425
2373
|
/** @type {?} */
|
|
2426
2374
|
ArrayParameter.prototype.isArray;
|
|
2427
2375
|
}
|
|
2376
|
+
/**
|
|
2377
|
+
* @template T, S
|
|
2378
|
+
*/
|
|
2379
|
+
var /**
|
|
2380
|
+
* @template T, S
|
|
2381
|
+
*/
|
|
2382
|
+
DefaultParameterSanitiser = /** @class */ (function () {
|
|
2383
|
+
function DefaultParameterSanitiser(remember, defaultValue, placeHistory) {
|
|
2384
|
+
this.remember = remember;
|
|
2385
|
+
this.defaultValue = defaultValue;
|
|
2386
|
+
this.placeHistory = placeHistory;
|
|
2387
|
+
}
|
|
2388
|
+
/**
|
|
2389
|
+
* @param {?} parameterDef
|
|
2390
|
+
* @param {?} value
|
|
2391
|
+
* @param {?=} visit
|
|
2392
|
+
* @return {?}
|
|
2393
|
+
*/
|
|
2394
|
+
DefaultParameterSanitiser.prototype.sanitise = /**
|
|
2395
|
+
* @param {?} parameterDef
|
|
2396
|
+
* @param {?} value
|
|
2397
|
+
* @param {?=} visit
|
|
2398
|
+
* @return {?}
|
|
2399
|
+
*/
|
|
2400
|
+
function (parameterDef, value, visit) {
|
|
2401
|
+
var _this = this;
|
|
2402
|
+
if (this.isBlank(parameterDef, value)) {
|
|
2403
|
+
if (this.remember) {
|
|
2404
|
+
/** @type {?} */
|
|
2405
|
+
var visits = this.placeHistory.getHistory(visit.placeDefinition);
|
|
2406
|
+
value = visits.map((/**
|
|
2407
|
+
* @param {?} v
|
|
2408
|
+
* @return {?}
|
|
2409
|
+
*/
|
|
2410
|
+
function (v) { return v.getValueOf(parameterDef); }))
|
|
2411
|
+
.filter((/**
|
|
2412
|
+
* @param {?} v
|
|
2413
|
+
* @return {?}
|
|
2414
|
+
*/
|
|
2415
|
+
function (v) { return !___default.isNil(v); }))
|
|
2416
|
+
.find((/**
|
|
2417
|
+
* @param {?} v
|
|
2418
|
+
* @return {?}
|
|
2419
|
+
*/
|
|
2420
|
+
function (v) { return !_this.isBlank(parameterDef, v); }));
|
|
2421
|
+
}
|
|
2422
|
+
value = this.isBlank(parameterDef, value) ? this.defaultValue : value;
|
|
2423
|
+
console.log(parameterDef.name + " is blank, returning: " + value);
|
|
2424
|
+
return value;
|
|
2425
|
+
}
|
|
2426
|
+
else {
|
|
2427
|
+
console.log(parameterDef.name + " is not blank");
|
|
2428
|
+
return value;
|
|
2429
|
+
}
|
|
2430
|
+
};
|
|
2431
|
+
/**
|
|
2432
|
+
* @private
|
|
2433
|
+
* @param {?} def
|
|
2434
|
+
* @param {?} value
|
|
2435
|
+
* @return {?}
|
|
2436
|
+
*/
|
|
2437
|
+
DefaultParameterSanitiser.prototype.isBlank = /**
|
|
2438
|
+
* @private
|
|
2439
|
+
* @param {?} def
|
|
2440
|
+
* @param {?} value
|
|
2441
|
+
* @return {?}
|
|
2442
|
+
*/
|
|
2443
|
+
function (def, value) {
|
|
2444
|
+
/** @type {?} */
|
|
2445
|
+
var isNil = ___default.isNil(value);
|
|
2446
|
+
return isNil ? true : def.isArray ? value['length'] < 1 : false;
|
|
2447
|
+
};
|
|
2448
|
+
return DefaultParameterSanitiser;
|
|
2449
|
+
}());
|
|
2450
|
+
ParameterDefinition.DefaultParameterSanitiser = DefaultParameterSanitiser;
|
|
2451
|
+
if (false) {
|
|
2452
|
+
/** @type {?} */
|
|
2453
|
+
DefaultParameterSanitiser.prototype.remember;
|
|
2454
|
+
/** @type {?} */
|
|
2455
|
+
DefaultParameterSanitiser.prototype.defaultValue;
|
|
2456
|
+
/** @type {?} */
|
|
2457
|
+
DefaultParameterSanitiser.prototype.placeHistory;
|
|
2458
|
+
}
|
|
2428
2459
|
})(ParameterDefinition || (ParameterDefinition = {}));
|
|
2429
2460
|
|
|
2430
2461
|
/**
|
|
@@ -2438,24 +2469,31 @@ var ParameterSnapshot = /** @class */ (function () {
|
|
|
2438
2469
|
}
|
|
2439
2470
|
/**
|
|
2440
2471
|
* @param {?} other
|
|
2472
|
+
* @param {?=} debug
|
|
2441
2473
|
* @return {?}
|
|
2442
2474
|
*/
|
|
2443
2475
|
ParameterSnapshot.prototype.hasChanged = /**
|
|
2444
2476
|
* @param {?} other
|
|
2477
|
+
* @param {?=} debug
|
|
2445
2478
|
* @return {?}
|
|
2446
2479
|
*/
|
|
2447
|
-
function (other) {
|
|
2480
|
+
function (other, debug) {
|
|
2481
|
+
if (debug === void 0) { debug = false; }
|
|
2448
2482
|
/** @type {?} */
|
|
2449
2483
|
var changed = this.resolved.find((/**
|
|
2450
2484
|
* @param {?} r
|
|
2451
2485
|
* @return {?}
|
|
2452
2486
|
*/
|
|
2453
2487
|
function (r) {
|
|
2454
|
-
return !r.isSame(other.
|
|
2488
|
+
return !r.isSame(other.getValueOf(r.parameterDef));
|
|
2455
2489
|
}));
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2490
|
+
if (changed && debug) {
|
|
2491
|
+
console.log({
|
|
2492
|
+
name: changed.parameterDef.name,
|
|
2493
|
+
mine: changed.value,
|
|
2494
|
+
theirs: other.getValueOf(changed.parameterDef)
|
|
2495
|
+
});
|
|
2496
|
+
}
|
|
2459
2497
|
return !!changed;
|
|
2460
2498
|
};
|
|
2461
2499
|
/**
|
|
@@ -2463,7 +2501,7 @@ var ParameterSnapshot = /** @class */ (function () {
|
|
|
2463
2501
|
* @param {?} parameterDef
|
|
2464
2502
|
* @return {?}
|
|
2465
2503
|
*/
|
|
2466
|
-
ParameterSnapshot.prototype.
|
|
2504
|
+
ParameterSnapshot.prototype.getParameter = /**
|
|
2467
2505
|
* @template T, S
|
|
2468
2506
|
* @param {?} parameterDef
|
|
2469
2507
|
* @return {?}
|
|
@@ -2480,30 +2518,30 @@ var ParameterSnapshot = /** @class */ (function () {
|
|
|
2480
2518
|
* @param {?} parameterDef
|
|
2481
2519
|
* @return {?}
|
|
2482
2520
|
*/
|
|
2483
|
-
ParameterSnapshot.prototype.
|
|
2521
|
+
ParameterSnapshot.prototype.getValueOf = /**
|
|
2484
2522
|
* @template T, S
|
|
2485
2523
|
* @param {?} parameterDef
|
|
2486
2524
|
* @return {?}
|
|
2487
2525
|
*/
|
|
2488
2526
|
function (parameterDef) {
|
|
2489
2527
|
/** @type {?} */
|
|
2490
|
-
var resolvedParameter = this.
|
|
2528
|
+
var resolvedParameter = this.getParameter(parameterDef);
|
|
2491
2529
|
return resolvedParameter ? resolvedParameter.value : null;
|
|
2492
2530
|
};
|
|
2493
2531
|
/**
|
|
2494
2532
|
* @return {?}
|
|
2495
2533
|
*/
|
|
2496
|
-
ParameterSnapshot.prototype.
|
|
2534
|
+
ParameterSnapshot.prototype.getRouteIdValue = /**
|
|
2497
2535
|
* @return {?}
|
|
2498
2536
|
*/
|
|
2499
2537
|
function () {
|
|
2500
|
-
return this.
|
|
2538
|
+
return this.getRouteIdParameter() ? this.getRouteIdParameter().value : null;
|
|
2501
2539
|
};
|
|
2502
2540
|
/**
|
|
2503
2541
|
* @param {?} name
|
|
2504
2542
|
* @return {?}
|
|
2505
2543
|
*/
|
|
2506
|
-
ParameterSnapshot.prototype.
|
|
2544
|
+
ParameterSnapshot.prototype.getParameterValue = /**
|
|
2507
2545
|
* @param {?} name
|
|
2508
2546
|
* @return {?}
|
|
2509
2547
|
*/
|
|
@@ -2520,7 +2558,7 @@ var ParameterSnapshot = /** @class */ (function () {
|
|
|
2520
2558
|
* @private
|
|
2521
2559
|
* @return {?}
|
|
2522
2560
|
*/
|
|
2523
|
-
ParameterSnapshot.prototype.
|
|
2561
|
+
ParameterSnapshot.prototype.getRouteIdParameter = /**
|
|
2524
2562
|
* @private
|
|
2525
2563
|
* @return {?}
|
|
2526
2564
|
*/
|
|
@@ -2533,6 +2571,21 @@ var ParameterSnapshot = /** @class */ (function () {
|
|
|
2533
2571
|
*/
|
|
2534
2572
|
function (p) { return p.parameterDef.isRouteId; }))));
|
|
2535
2573
|
};
|
|
2574
|
+
/**
|
|
2575
|
+
* @private
|
|
2576
|
+
* @return {?}
|
|
2577
|
+
*/
|
|
2578
|
+
ParameterSnapshot.prototype.getRouteParameters = /**
|
|
2579
|
+
* @private
|
|
2580
|
+
* @return {?}
|
|
2581
|
+
*/
|
|
2582
|
+
function () {
|
|
2583
|
+
return this.resolved.filter((/**
|
|
2584
|
+
* @param {?} r
|
|
2585
|
+
* @return {?}
|
|
2586
|
+
*/
|
|
2587
|
+
function (r) { return !r.parameterDef.isRouteId; }));
|
|
2588
|
+
};
|
|
2536
2589
|
/**
|
|
2537
2590
|
* @return {?}
|
|
2538
2591
|
*/
|
|
@@ -2540,7 +2593,7 @@ var ParameterSnapshot = /** @class */ (function () {
|
|
|
2540
2593
|
* @return {?}
|
|
2541
2594
|
*/
|
|
2542
2595
|
function () {
|
|
2543
|
-
return !!this.
|
|
2596
|
+
return !!this.getRouteIdParameter();
|
|
2544
2597
|
};
|
|
2545
2598
|
/**
|
|
2546
2599
|
* @return {?}
|
|
@@ -2550,7 +2603,7 @@ var ParameterSnapshot = /** @class */ (function () {
|
|
|
2550
2603
|
*/
|
|
2551
2604
|
function () {
|
|
2552
2605
|
/** @type {?} */
|
|
2553
|
-
var routeIdParam = this.
|
|
2606
|
+
var routeIdParam = this.getRouteIdParameter();
|
|
2554
2607
|
return routeIdParam ? routeIdParam.formattedValue() : null;
|
|
2555
2608
|
};
|
|
2556
2609
|
/**
|
|
@@ -2576,6 +2629,25 @@ var ParameterSnapshot = /** @class */ (function () {
|
|
|
2576
2629
|
}));
|
|
2577
2630
|
return params;
|
|
2578
2631
|
};
|
|
2632
|
+
/**
|
|
2633
|
+
* @return {?}
|
|
2634
|
+
*/
|
|
2635
|
+
ParameterSnapshot.prototype.getAllFormattedParameters = /**
|
|
2636
|
+
* @return {?}
|
|
2637
|
+
*/
|
|
2638
|
+
function () {
|
|
2639
|
+
/** @type {?} */
|
|
2640
|
+
var params = {};
|
|
2641
|
+
/** @type {?} */
|
|
2642
|
+
var routeIdParam = this.resolved.forEach((/**
|
|
2643
|
+
* @param {?} p
|
|
2644
|
+
* @return {?}
|
|
2645
|
+
*/
|
|
2646
|
+
function (p) {
|
|
2647
|
+
params[p.parameterDef.name] = p.formattedValue();
|
|
2648
|
+
}));
|
|
2649
|
+
return params;
|
|
2650
|
+
};
|
|
2579
2651
|
/**
|
|
2580
2652
|
* @template T, S
|
|
2581
2653
|
* @param {?} parameter
|
|
@@ -2607,8 +2679,40 @@ var ParameterSnapshot = /** @class */ (function () {
|
|
|
2607
2679
|
*/
|
|
2608
2680
|
function (injector) {
|
|
2609
2681
|
return __awaiter(this, void 0, void 0, function () {
|
|
2682
|
+
var routeId, sanitisedValue, result, routeParameters, i, sanitisedValue;
|
|
2610
2683
|
return __generator(this, function (_a) {
|
|
2611
|
-
|
|
2684
|
+
switch (_a.label) {
|
|
2685
|
+
case 0:
|
|
2686
|
+
if (!this.hasRouteId()) return [3 /*break*/, 2];
|
|
2687
|
+
routeId = this.getRouteIdParameter();
|
|
2688
|
+
return [4 /*yield*/, routeId.sanitise(this, injector)];
|
|
2689
|
+
case 1:
|
|
2690
|
+
sanitisedValue = _a.sent();
|
|
2691
|
+
if (!routeId.isSame(sanitisedValue)) {
|
|
2692
|
+
// if the route id has changed we redirect immediately as other
|
|
2693
|
+
// parameter sanitisers might use it.
|
|
2694
|
+
return [2 /*return*/, this.replace(routeId.parameterDef, sanitisedValue)];
|
|
2695
|
+
}
|
|
2696
|
+
_a.label = 2;
|
|
2697
|
+
case 2:
|
|
2698
|
+
result = this;
|
|
2699
|
+
routeParameters = this.getRouteParameters();
|
|
2700
|
+
i = 0;
|
|
2701
|
+
_a.label = 3;
|
|
2702
|
+
case 3:
|
|
2703
|
+
if (!(i < routeParameters.length)) return [3 /*break*/, 6];
|
|
2704
|
+
return [4 /*yield*/, routeParameters[i].sanitise(this, injector)];
|
|
2705
|
+
case 4:
|
|
2706
|
+
sanitisedValue = _a.sent();
|
|
2707
|
+
if (!routeParameters[i].isSame(sanitisedValue)) {
|
|
2708
|
+
result = this.replace(routeParameters[i].parameterDef, sanitisedValue);
|
|
2709
|
+
}
|
|
2710
|
+
_a.label = 5;
|
|
2711
|
+
case 5:
|
|
2712
|
+
i++;
|
|
2713
|
+
return [3 /*break*/, 3];
|
|
2714
|
+
case 6: return [2 /*return*/, result];
|
|
2715
|
+
}
|
|
2612
2716
|
});
|
|
2613
2717
|
});
|
|
2614
2718
|
};
|
|
@@ -2618,25 +2722,37 @@ var ParameterSnapshot = /** @class */ (function () {
|
|
|
2618
2722
|
__metadata("design:type", Function),
|
|
2619
2723
|
__metadata("design:paramtypes", [ParameterDefinition]),
|
|
2620
2724
|
__metadata("design:returntype", ParameterSnapshot.ResolvedParameter)
|
|
2621
|
-
], ParameterSnapshot.prototype, "
|
|
2725
|
+
], ParameterSnapshot.prototype, "getParameter", null);
|
|
2622
2726
|
__decorate([
|
|
2623
2727
|
Memoize$1(),
|
|
2624
2728
|
__metadata("design:type", Function),
|
|
2625
2729
|
__metadata("design:paramtypes", [ParameterDefinition]),
|
|
2626
2730
|
__metadata("design:returntype", typeof (_a = typeof S !== "undefined" && S) === "function" ? _a : Object)
|
|
2627
|
-
], ParameterSnapshot.prototype, "
|
|
2731
|
+
], ParameterSnapshot.prototype, "getValueOf", null);
|
|
2628
2732
|
__decorate([
|
|
2629
2733
|
Memoize$1(),
|
|
2630
2734
|
__metadata("design:type", Function),
|
|
2631
2735
|
__metadata("design:paramtypes", [String]),
|
|
2632
2736
|
__metadata("design:returntype", Object)
|
|
2633
|
-
], ParameterSnapshot.prototype, "
|
|
2737
|
+
], ParameterSnapshot.prototype, "getParameterValue", null);
|
|
2634
2738
|
__decorate([
|
|
2635
2739
|
Memoize$1(),
|
|
2636
2740
|
__metadata("design:type", Function),
|
|
2637
2741
|
__metadata("design:paramtypes", []),
|
|
2638
2742
|
__metadata("design:returntype", ParameterSnapshot.ResolvedValueParameter)
|
|
2639
|
-
], ParameterSnapshot.prototype, "
|
|
2743
|
+
], ParameterSnapshot.prototype, "getRouteIdParameter", null);
|
|
2744
|
+
__decorate([
|
|
2745
|
+
Memoize$1(),
|
|
2746
|
+
__metadata("design:type", Function),
|
|
2747
|
+
__metadata("design:paramtypes", []),
|
|
2748
|
+
__metadata("design:returntype", Array)
|
|
2749
|
+
], ParameterSnapshot.prototype, "getRouteParameters", null);
|
|
2750
|
+
__decorate([
|
|
2751
|
+
Trace(),
|
|
2752
|
+
__metadata("design:type", Function),
|
|
2753
|
+
__metadata("design:paramtypes", [Injector]),
|
|
2754
|
+
__metadata("design:returntype", Promise)
|
|
2755
|
+
], ParameterSnapshot.prototype, "sanitise", null);
|
|
2640
2756
|
return ParameterSnapshot;
|
|
2641
2757
|
}());
|
|
2642
2758
|
if (false) {
|
|
@@ -2651,10 +2767,13 @@ if (false) {
|
|
|
2651
2767
|
(function (ParameterSnapshot) {
|
|
2652
2768
|
/**
|
|
2653
2769
|
* @param {?} placeDef
|
|
2654
|
-
* @param {?}
|
|
2770
|
+
* @param {?} params
|
|
2771
|
+
* @param {?} urlSegments
|
|
2655
2772
|
* @return {?}
|
|
2656
2773
|
*/
|
|
2657
|
-
function create(placeDef,
|
|
2774
|
+
function create(placeDef, params, urlSegments) {
|
|
2775
|
+
/** @type {?} */
|
|
2776
|
+
var paramMap = new ConsolidatedParameterMap(params, urlSegments);
|
|
2658
2777
|
/** @type {?} */
|
|
2659
2778
|
var resolvedParameters = placeDef.getRouteParameters()
|
|
2660
2779
|
.map((/**
|
|
@@ -2664,7 +2783,11 @@ if (false) {
|
|
|
2664
2783
|
function (def) {
|
|
2665
2784
|
if (def.isArray) {
|
|
2666
2785
|
/** @type {?} */
|
|
2667
|
-
var value = paramMap.has(def.name) ? paramMap.getAll(def.name).
|
|
2786
|
+
var value = paramMap.has(def.name) ? paramMap.getAll(def.name).filter((/**
|
|
2787
|
+
* @param {?} s
|
|
2788
|
+
* @return {?}
|
|
2789
|
+
*/
|
|
2790
|
+
function (s) { return !___default.isEmpty(s); })).map((/**
|
|
2668
2791
|
* @param {?} raw
|
|
2669
2792
|
* @return {?}
|
|
2670
2793
|
*/
|
|
@@ -2680,6 +2803,140 @@ if (false) {
|
|
|
2680
2803
|
return new ParameterSnapshot(placeDef, resolvedParameters);
|
|
2681
2804
|
}
|
|
2682
2805
|
ParameterSnapshot.create = create;
|
|
2806
|
+
/**
|
|
2807
|
+
* This a work around for the fact that an activated route with multiple segments doesn't
|
|
2808
|
+
* include the segment params in the paramMap as well as each segment returns an empty
|
|
2809
|
+
* param map even when `parameter`s has content.
|
|
2810
|
+
*/
|
|
2811
|
+
var /**
|
|
2812
|
+
* This a work around for the fact that an activated route with multiple segments doesn't
|
|
2813
|
+
* include the segment params in the paramMap as well as each segment returns an empty
|
|
2814
|
+
* param map even when `parameter`s has content.
|
|
2815
|
+
*/
|
|
2816
|
+
ConsolidatedParameterMap = /** @class */ (function () {
|
|
2817
|
+
function ConsolidatedParameterMap(paramMap, urlSegments) {
|
|
2818
|
+
this.paramMaps = [paramMap].concat((urlSegments || []).map((/**
|
|
2819
|
+
* @param {?} s
|
|
2820
|
+
* @return {?}
|
|
2821
|
+
*/
|
|
2822
|
+
function (s) { return new ParamMapAdapter(s.parameters); }))).filter((/**
|
|
2823
|
+
* @param {?} m
|
|
2824
|
+
* @return {?}
|
|
2825
|
+
*/
|
|
2826
|
+
function (m) { return !!m; })); // the activated route param map can be null
|
|
2827
|
+
}
|
|
2828
|
+
/**
|
|
2829
|
+
* @param {?} name
|
|
2830
|
+
* @return {?}
|
|
2831
|
+
*/
|
|
2832
|
+
ConsolidatedParameterMap.prototype.get = /**
|
|
2833
|
+
* @param {?} name
|
|
2834
|
+
* @return {?}
|
|
2835
|
+
*/
|
|
2836
|
+
function (name) {
|
|
2837
|
+
return this.paramMaps.find((/**
|
|
2838
|
+
* @param {?} m
|
|
2839
|
+
* @return {?}
|
|
2840
|
+
*/
|
|
2841
|
+
function (m) { return m.has(name); })).get(name);
|
|
2842
|
+
};
|
|
2843
|
+
/**
|
|
2844
|
+
* @param {?} name
|
|
2845
|
+
* @return {?}
|
|
2846
|
+
*/
|
|
2847
|
+
ConsolidatedParameterMap.prototype.getAll = /**
|
|
2848
|
+
* @param {?} name
|
|
2849
|
+
* @return {?}
|
|
2850
|
+
*/
|
|
2851
|
+
function (name) {
|
|
2852
|
+
return this.paramMaps.find((/**
|
|
2853
|
+
* @param {?} m
|
|
2854
|
+
* @return {?}
|
|
2855
|
+
*/
|
|
2856
|
+
function (m) { return m.has(name); })).getAll(name);
|
|
2857
|
+
};
|
|
2858
|
+
/**
|
|
2859
|
+
* @param {?} name
|
|
2860
|
+
* @return {?}
|
|
2861
|
+
*/
|
|
2862
|
+
ConsolidatedParameterMap.prototype.has = /**
|
|
2863
|
+
* @param {?} name
|
|
2864
|
+
* @return {?}
|
|
2865
|
+
*/
|
|
2866
|
+
function (name) {
|
|
2867
|
+
return !!this.paramMaps.find((/**
|
|
2868
|
+
* @param {?} m
|
|
2869
|
+
* @return {?}
|
|
2870
|
+
*/
|
|
2871
|
+
function (m) { return m.has(name); }));
|
|
2872
|
+
};
|
|
2873
|
+
return ConsolidatedParameterMap;
|
|
2874
|
+
}());
|
|
2875
|
+
if (false) {
|
|
2876
|
+
/**
|
|
2877
|
+
* @type {?}
|
|
2878
|
+
* @private
|
|
2879
|
+
*/
|
|
2880
|
+
ConsolidatedParameterMap.prototype.paramMaps;
|
|
2881
|
+
}
|
|
2882
|
+
var ParamMapAdapter = /** @class */ (function () {
|
|
2883
|
+
function ParamMapAdapter(params) {
|
|
2884
|
+
this.params = params;
|
|
2885
|
+
}
|
|
2886
|
+
/**
|
|
2887
|
+
* @param {?} name
|
|
2888
|
+
* @return {?}
|
|
2889
|
+
*/
|
|
2890
|
+
ParamMapAdapter.prototype.get = /**
|
|
2891
|
+
* @param {?} name
|
|
2892
|
+
* @return {?}
|
|
2893
|
+
*/
|
|
2894
|
+
function (name) {
|
|
2895
|
+
return this.params[name];
|
|
2896
|
+
};
|
|
2897
|
+
/**
|
|
2898
|
+
* @param {?} name
|
|
2899
|
+
* @return {?}
|
|
2900
|
+
*/
|
|
2901
|
+
ParamMapAdapter.prototype.getAll = /**
|
|
2902
|
+
* @param {?} name
|
|
2903
|
+
* @return {?}
|
|
2904
|
+
*/
|
|
2905
|
+
function (name) {
|
|
2906
|
+
/** @type {?} */
|
|
2907
|
+
var value = this.get(name);
|
|
2908
|
+
return Array.isArray(value) ? value : [value];
|
|
2909
|
+
};
|
|
2910
|
+
/**
|
|
2911
|
+
* @param {?} name
|
|
2912
|
+
* @return {?}
|
|
2913
|
+
*/
|
|
2914
|
+
ParamMapAdapter.prototype.has = /**
|
|
2915
|
+
* @param {?} name
|
|
2916
|
+
* @return {?}
|
|
2917
|
+
*/
|
|
2918
|
+
function (name) {
|
|
2919
|
+
return this.keys.includes(name);
|
|
2920
|
+
};
|
|
2921
|
+
Object.defineProperty(ParamMapAdapter.prototype, "keys", {
|
|
2922
|
+
get: /**
|
|
2923
|
+
* @return {?}
|
|
2924
|
+
*/
|
|
2925
|
+
function () {
|
|
2926
|
+
return Object.keys(this.params);
|
|
2927
|
+
},
|
|
2928
|
+
enumerable: true,
|
|
2929
|
+
configurable: true
|
|
2930
|
+
});
|
|
2931
|
+
return ParamMapAdapter;
|
|
2932
|
+
}());
|
|
2933
|
+
if (false) {
|
|
2934
|
+
/**
|
|
2935
|
+
* @type {?}
|
|
2936
|
+
* @private
|
|
2937
|
+
*/
|
|
2938
|
+
ParamMapAdapter.prototype.params;
|
|
2939
|
+
}
|
|
2683
2940
|
/**
|
|
2684
2941
|
* @abstract
|
|
2685
2942
|
* @template T, S
|
|
@@ -2702,6 +2959,31 @@ if (false) {
|
|
|
2702
2959
|
function () {
|
|
2703
2960
|
return this.parameterDef.isRouteId;
|
|
2704
2961
|
};
|
|
2962
|
+
/**
|
|
2963
|
+
* @param {?} visit
|
|
2964
|
+
* @param {?} injector
|
|
2965
|
+
* @return {?}
|
|
2966
|
+
*/
|
|
2967
|
+
ResolvedParameter.prototype.sanitise = /**
|
|
2968
|
+
* @param {?} visit
|
|
2969
|
+
* @param {?} injector
|
|
2970
|
+
* @return {?}
|
|
2971
|
+
*/
|
|
2972
|
+
function (visit, injector) {
|
|
2973
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2974
|
+
var sanitiser;
|
|
2975
|
+
return __generator(this, function (_a) {
|
|
2976
|
+
sanitiser = this.parameterDef.getSanitiser(injector);
|
|
2977
|
+
if (sanitiser) {
|
|
2978
|
+
return [2 /*return*/, sanitiser.sanitise(this.parameterDef, this.value, visit)];
|
|
2979
|
+
}
|
|
2980
|
+
else {
|
|
2981
|
+
return [2 /*return*/, this.value];
|
|
2982
|
+
}
|
|
2983
|
+
return [2 /*return*/];
|
|
2984
|
+
});
|
|
2985
|
+
});
|
|
2986
|
+
};
|
|
2705
2987
|
return ResolvedParameter;
|
|
2706
2988
|
}());
|
|
2707
2989
|
ParameterSnapshot.ResolvedParameter = ResolvedParameter;
|
|
@@ -2858,6 +3140,115 @@ if (false) {
|
|
|
2858
3140
|
ParameterSnapshot.ResolvedArrayParameter = ResolvedArrayParameter;
|
|
2859
3141
|
})(ParameterSnapshot || (ParameterSnapshot = {}));
|
|
2860
3142
|
|
|
3143
|
+
/**
|
|
3144
|
+
* @fileoverview added by tsickle
|
|
3145
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
3146
|
+
*/
|
|
3147
|
+
var PlaceRouter = /** @class */ (function () {
|
|
3148
|
+
function PlaceRouter(router) {
|
|
3149
|
+
this.router = router;
|
|
3150
|
+
}
|
|
3151
|
+
/**
|
|
3152
|
+
* @param {?} activatedRoute
|
|
3153
|
+
* @param {?} previous
|
|
3154
|
+
* @param {?} next
|
|
3155
|
+
* @return {?}
|
|
3156
|
+
*/
|
|
3157
|
+
PlaceRouter.prototype.pushParameterChangesToRoute = /**
|
|
3158
|
+
* @param {?} activatedRoute
|
|
3159
|
+
* @param {?} previous
|
|
3160
|
+
* @param {?} next
|
|
3161
|
+
* @return {?}
|
|
3162
|
+
*/
|
|
3163
|
+
function (activatedRoute, previous, next) {
|
|
3164
|
+
/** @type {?} */
|
|
3165
|
+
var relativePath = !!previous.hasRouteId() ? '..' : '.';
|
|
3166
|
+
this.router.navigate([relativePath].concat(this.createRouteParameters(next), this.getChildPath(activatedRoute.snapshot)), {
|
|
3167
|
+
relativeTo: activatedRoute
|
|
3168
|
+
});
|
|
3169
|
+
};
|
|
3170
|
+
/**
|
|
3171
|
+
* @param {?} activatedRoute
|
|
3172
|
+
* @param {?} sanitised
|
|
3173
|
+
* @return {?}
|
|
3174
|
+
*/
|
|
3175
|
+
PlaceRouter.prototype.getRedirectUrlTree = /**
|
|
3176
|
+
* @param {?} activatedRoute
|
|
3177
|
+
* @param {?} sanitised
|
|
3178
|
+
* @return {?}
|
|
3179
|
+
*/
|
|
3180
|
+
function (activatedRoute, sanitised) {
|
|
3181
|
+
/** @type {?} */
|
|
3182
|
+
var urlSegments = activatedRoute.url;
|
|
3183
|
+
/** @type {?} */
|
|
3184
|
+
var weHaveARouteId = sanitised.hasRouteId() && sanitised.getFormattedRouteId();
|
|
3185
|
+
/** @type {?} */
|
|
3186
|
+
var commands = (weHaveARouteId) ?
|
|
3187
|
+
[urlSegments[0].path, sanitised.getFormattedRouteId(), sanitised.getFormattedParameters()] :
|
|
3188
|
+
[urlSegments[0].path, sanitised.getFormattedParameters()];
|
|
3189
|
+
console.log("redirect path", commands);
|
|
3190
|
+
return this.router.createUrlTree(commands);
|
|
3191
|
+
};
|
|
3192
|
+
/**
|
|
3193
|
+
* @protected
|
|
3194
|
+
* @param {?} activatedRoute
|
|
3195
|
+
* @return {?}
|
|
3196
|
+
*/
|
|
3197
|
+
PlaceRouter.prototype.getChildPath = /**
|
|
3198
|
+
* @protected
|
|
3199
|
+
* @param {?} activatedRoute
|
|
3200
|
+
* @return {?}
|
|
3201
|
+
*/
|
|
3202
|
+
function (activatedRoute) {
|
|
3203
|
+
return ___default.flatten(activatedRoute.children.map((/**
|
|
3204
|
+
* @param {?} child
|
|
3205
|
+
* @return {?}
|
|
3206
|
+
*/
|
|
3207
|
+
function (child) { return child.url; })));
|
|
3208
|
+
};
|
|
3209
|
+
/**
|
|
3210
|
+
* @protected
|
|
3211
|
+
* @param {?} parameters
|
|
3212
|
+
* @return {?}
|
|
3213
|
+
*/
|
|
3214
|
+
PlaceRouter.prototype.createRouteParameters = /**
|
|
3215
|
+
* @protected
|
|
3216
|
+
* @param {?} parameters
|
|
3217
|
+
* @return {?}
|
|
3218
|
+
*/
|
|
3219
|
+
function (parameters) {
|
|
3220
|
+
/** @type {?} */
|
|
3221
|
+
var routeId = parameters.getFormattedRouteId();
|
|
3222
|
+
return routeId ?
|
|
3223
|
+
[routeId, parameters.getFormattedParameters()] :
|
|
3224
|
+
[parameters.getFormattedParameters()];
|
|
3225
|
+
};
|
|
3226
|
+
PlaceRouter.decorators = [
|
|
3227
|
+
{ type: Injectable, args: [{
|
|
3228
|
+
providedIn: 'root'
|
|
3229
|
+
},] }
|
|
3230
|
+
];
|
|
3231
|
+
/** @nocollapse */
|
|
3232
|
+
PlaceRouter.ctorParameters = function () { return [
|
|
3233
|
+
{ type: Router }
|
|
3234
|
+
]; };
|
|
3235
|
+
/** @nocollapse */ PlaceRouter.ngInjectableDef = ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(ɵɵinject(Router)); }, token: PlaceRouter, providedIn: "root" });
|
|
3236
|
+
__decorate([
|
|
3237
|
+
Trace(),
|
|
3238
|
+
__metadata("design:type", Function),
|
|
3239
|
+
__metadata("design:paramtypes", [ActivatedRouteSnapshot, ParameterSnapshot]),
|
|
3240
|
+
__metadata("design:returntype", UrlTree)
|
|
3241
|
+
], PlaceRouter.prototype, "getRedirectUrlTree", null);
|
|
3242
|
+
return PlaceRouter;
|
|
3243
|
+
}());
|
|
3244
|
+
if (false) {
|
|
3245
|
+
/**
|
|
3246
|
+
* @type {?}
|
|
3247
|
+
* @private
|
|
3248
|
+
*/
|
|
3249
|
+
PlaceRouter.prototype.router;
|
|
3250
|
+
}
|
|
3251
|
+
|
|
2861
3252
|
/**
|
|
2862
3253
|
* @fileoverview added by tsickle
|
|
2863
3254
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -2945,19 +3336,25 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
|
|
|
2945
3336
|
_this._placeDefinition = new MutableValueModel();
|
|
2946
3337
|
_this._resolvedParameters = new MutableValueModel();
|
|
2947
3338
|
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;
|
|
2948
|
-
|
|
3339
|
+
/** @type {?} */
|
|
3340
|
+
var paramMap = chain(_this._activatedRouteModel).pullObservableValue((/**
|
|
2949
3341
|
* @param {?} ar
|
|
2950
3342
|
* @return {?}
|
|
2951
3343
|
*/
|
|
2952
3344
|
function (ar) { return ar.paramMap; }));
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
* @param {?}
|
|
3345
|
+
/** @type {?} */
|
|
3346
|
+
var urls = chain(_this._activatedRouteModel).pullObservableValue((/**
|
|
3347
|
+
* @param {?} ar
|
|
3348
|
+
* @return {?}
|
|
3349
|
+
*/
|
|
3350
|
+
function (ar) { return ar.url; }));
|
|
3351
|
+
_this.placeConfigured = valueOf.all(chain(_this._inOutletUpdate).isFalsey(), _this._placeDefinition, paramMap, urls).areTruthy();
|
|
3352
|
+
when.anyOf(paramMap, urls).changes((/**
|
|
2956
3353
|
* @return {?}
|
|
2957
3354
|
*/
|
|
2958
|
-
function (
|
|
3355
|
+
function () {
|
|
2959
3356
|
/** @type {?} */
|
|
2960
|
-
var snapshot = ParameterSnapshot.create(_this._placeDefinition.value,
|
|
3357
|
+
var snapshot = ParameterSnapshot.create(_this._placeDefinition.value, paramMap.value, urls.value);
|
|
2961
3358
|
_this._incomingRouteChange.whileTrue((/**
|
|
2962
3359
|
* @return {?}
|
|
2963
3360
|
*/
|
|
@@ -2980,6 +3377,10 @@ var PlaceOutletComponent = /** @class */ (function (_super) {
|
|
|
2980
3377
|
unless: _this.incomingRouteChange
|
|
2981
3378
|
});
|
|
2982
3379
|
return _this;
|
|
3380
|
+
// const txo = new TransactionObserver().onEvent(e => console.log(e.toString()));
|
|
3381
|
+
// txo.observe('paramMap', paramMap);
|
|
3382
|
+
// txo.observe('urls', urls);
|
|
3383
|
+
// txo.observe('this._resolvedParameters', this._resolvedParameters);
|
|
2983
3384
|
}
|
|
2984
3385
|
Object.defineProperty(PlaceOutletComponent.prototype, "incomingRouteChange", {
|
|
2985
3386
|
get: /**
|
|
@@ -3150,11 +3551,6 @@ if (false) {
|
|
|
3150
3551
|
* @private
|
|
3151
3552
|
*/
|
|
3152
3553
|
PlaceOutletComponent.prototype._placeDefinition;
|
|
3153
|
-
/**
|
|
3154
|
-
* @type {?}
|
|
3155
|
-
* @private
|
|
3156
|
-
*/
|
|
3157
|
-
PlaceOutletComponent.prototype._paramMap;
|
|
3158
3554
|
/** @type {?} */
|
|
3159
3555
|
PlaceOutletComponent.prototype._resolvedParameters;
|
|
3160
3556
|
/**
|
|
@@ -3728,12 +4124,12 @@ if (false) {
|
|
|
3728
4124
|
/**
|
|
3729
4125
|
* @return {?}
|
|
3730
4126
|
*/
|
|
3731
|
-
Visit.prototype.
|
|
4127
|
+
Visit.prototype.getRouteIdValue = function () { };
|
|
3732
4128
|
/**
|
|
3733
4129
|
* @param {?} name
|
|
3734
4130
|
* @return {?}
|
|
3735
4131
|
*/
|
|
3736
|
-
Visit.prototype.
|
|
4132
|
+
Visit.prototype.getParameterValue = function (name) { };
|
|
3737
4133
|
}
|
|
3738
4134
|
|
|
3739
4135
|
/**
|
|
@@ -3832,14 +4228,14 @@ var PlaceRouteGuard = /** @class */ (function () {
|
|
|
3832
4228
|
/** @type {?} */
|
|
3833
4229
|
var placeDefinition = PlaceComponent.getDefinition(activatedRoute.component);
|
|
3834
4230
|
/** @type {?} */
|
|
3835
|
-
var snapshot_1 = ParameterSnapshot.create(placeDefinition, activatedRoute.paramMap);
|
|
4231
|
+
var snapshot_1 = ParameterSnapshot.create(placeDefinition, activatedRoute.paramMap, activatedRoute.url);
|
|
3836
4232
|
return snapshot_1.sanitise(this.injector).then((/**
|
|
3837
4233
|
* @param {?} sanitised
|
|
3838
4234
|
* @return {?}
|
|
3839
4235
|
*/
|
|
3840
4236
|
function (sanitised) {
|
|
3841
|
-
if (sanitised.hasChanged(snapshot_1)) {
|
|
3842
|
-
return _this.placeRouter.
|
|
4237
|
+
if (sanitised.hasChanged(snapshot_1, true)) {
|
|
4238
|
+
return _this.placeRouter.getRedirectUrlTree(activatedRoute, sanitised);
|
|
3843
4239
|
}
|
|
3844
4240
|
else {
|
|
3845
4241
|
return true;
|
|
@@ -3876,75 +4272,6 @@ if (false) {
|
|
|
3876
4272
|
PlaceRouteGuard.prototype.injector;
|
|
3877
4273
|
}
|
|
3878
4274
|
|
|
3879
|
-
/**
|
|
3880
|
-
* @fileoverview added by tsickle
|
|
3881
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
3882
|
-
*/
|
|
3883
|
-
/**
|
|
3884
|
-
* @template T, S
|
|
3885
|
-
*/
|
|
3886
|
-
var DefaultParameterSanitiser = /** @class */ (function () {
|
|
3887
|
-
function DefaultParameterSanitiser(def, remember, defaultValue) {
|
|
3888
|
-
this.def = def;
|
|
3889
|
-
this.remember = remember;
|
|
3890
|
-
this.defaultValue = defaultValue;
|
|
3891
|
-
}
|
|
3892
|
-
/**
|
|
3893
|
-
* @param {?} value
|
|
3894
|
-
* @param {?} visit
|
|
3895
|
-
* @return {?}
|
|
3896
|
-
*/
|
|
3897
|
-
DefaultParameterSanitiser.prototype.sanitise = /**
|
|
3898
|
-
* @param {?} value
|
|
3899
|
-
* @param {?} visit
|
|
3900
|
-
* @return {?}
|
|
3901
|
-
*/
|
|
3902
|
-
function (value, visit) {
|
|
3903
|
-
if (this.isBlank(value)) {
|
|
3904
|
-
if (this.remember) {
|
|
3905
|
-
// value = null;
|
|
3906
|
-
}
|
|
3907
|
-
return this.isBlank(value) && !___default.isNil(this.defaultValue) ? this.defaultValue : value;
|
|
3908
|
-
}
|
|
3909
|
-
else {
|
|
3910
|
-
return value;
|
|
3911
|
-
}
|
|
3912
|
-
};
|
|
3913
|
-
/**
|
|
3914
|
-
* @private
|
|
3915
|
-
* @param {?} value
|
|
3916
|
-
* @return {?}
|
|
3917
|
-
*/
|
|
3918
|
-
DefaultParameterSanitiser.prototype.isBlank = /**
|
|
3919
|
-
* @private
|
|
3920
|
-
* @param {?} value
|
|
3921
|
-
* @return {?}
|
|
3922
|
-
*/
|
|
3923
|
-
function (value) {
|
|
3924
|
-
/** @type {?} */
|
|
3925
|
-
var isNil = ___default.isNil(value);
|
|
3926
|
-
return this.def.isArray ? !isNil || value['length'] < 1 : isNil;
|
|
3927
|
-
};
|
|
3928
|
-
__decorate([
|
|
3929
|
-
Trace(),
|
|
3930
|
-
__metadata("design:type", Function),
|
|
3931
|
-
__metadata("design:paramtypes", [Object, Object]),
|
|
3932
|
-
__metadata("design:returntype", Object)
|
|
3933
|
-
], DefaultParameterSanitiser.prototype, "sanitise", null);
|
|
3934
|
-
return DefaultParameterSanitiser;
|
|
3935
|
-
}());
|
|
3936
|
-
if (false) {
|
|
3937
|
-
/**
|
|
3938
|
-
* @type {?}
|
|
3939
|
-
* @private
|
|
3940
|
-
*/
|
|
3941
|
-
DefaultParameterSanitiser.prototype.def;
|
|
3942
|
-
/** @type {?} */
|
|
3943
|
-
DefaultParameterSanitiser.prototype.remember;
|
|
3944
|
-
/** @type {?} */
|
|
3945
|
-
DefaultParameterSanitiser.prototype.defaultValue;
|
|
3946
|
-
}
|
|
3947
|
-
|
|
3948
4275
|
/**
|
|
3949
4276
|
* @fileoverview added by tsickle
|
|
3950
4277
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
@@ -4056,16 +4383,17 @@ function RouteParameterList(elementType, options) {
|
|
|
4056
4383
|
*/
|
|
4057
4384
|
/**
|
|
4058
4385
|
* @record
|
|
4059
|
-
* @template
|
|
4386
|
+
* @template S
|
|
4060
4387
|
*/
|
|
4061
4388
|
function ParameterSanitiser() { }
|
|
4062
4389
|
if (false) {
|
|
4063
4390
|
/**
|
|
4391
|
+
* @param {?} parameterDef
|
|
4064
4392
|
* @param {?} value
|
|
4065
4393
|
* @param {?=} visit
|
|
4066
4394
|
* @return {?}
|
|
4067
4395
|
*/
|
|
4068
|
-
ParameterSanitiser.prototype.sanitise = function (value, visit) { };
|
|
4396
|
+
ParameterSanitiser.prototype.sanitise = function (parameterDef, value, visit) { };
|
|
4069
4397
|
}
|
|
4070
4398
|
|
|
4071
4399
|
/**
|
|
@@ -4260,7 +4588,7 @@ Sanitiser = /** @class */ (function () {
|
|
|
4260
4588
|
if (!this.sanitiser) return [3 /*break*/, 2];
|
|
4261
4589
|
this.initialValue = this.readFrom(this.snapshot);
|
|
4262
4590
|
_a = this;
|
|
4263
|
-
return [4 /*yield*/, this.sanitiser.sanitise(this.initialValue)];
|
|
4591
|
+
return [4 /*yield*/, this.sanitiser.sanitise(null, this.initialValue)];
|
|
4264
4592
|
case 1:
|
|
4265
4593
|
_a._sanitisedValue = _b.sent();
|
|
4266
4594
|
if (this.initialValue !== this._sanitisedValue) {
|
|
@@ -4608,5 +4936,5 @@ if (false) {
|
|
|
4608
4936
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4609
4937
|
*/
|
|
4610
4938
|
|
|
4611
|
-
export { ACTIVITY_DATA, AbstractActivity, AbstractInputComponent, AbstractPlaceNavigationComponent, ActivityContainerComponent, ActivityOutletComponent, AlertDialogComponent, AngularUiPowerupsModule, Bounds, BusyOverlayComponent, CommandDirective, ConfirmationDialogComponent, DEFINITION_META_DATA_KEY,
|
|
4939
|
+
export { ACTIVITY_DATA, AbstractActivity, AbstractInputComponent, AbstractPlaceNavigationComponent, ActivityContainerComponent, ActivityOutletComponent, AlertDialogComponent, AngularUiPowerupsModule, Bounds, BusyOverlayComponent, CommandDirective, ConfirmationDialogComponent, DEFINITION_META_DATA_KEY, DialogInteractionService, Dimension, DisposableComponent, EmptyStateComponent, FocusBindingDirective, INTERACTION_CONTEXT, InteractionContext, InteractionModule, LEFT_RIGHT_PLACE_ANIMATION, LeavePlaceGuard, ListPlaceNavComponent, NumberInputComponent, ParameterDefinition, ParameterSnapshot, ParameterType, PasswordInputComponent, Place, PlaceComponent, PlaceDefinition, PlaceHistory, PlaceModule, PlaceOutletComponent, PlaceRouteGuard, PlaceRouter, Point, ROUTE_PARAMETER_LIST_KEY, ResizeAwareComponent, RouteId, RouteParameter, RouteParameterList, RouteParameterSanitiser, Sanitiser, SelectInputComponent, StringInputComponent, TabbedPlaceNavigationComponent, leftRightPlaceAnimation, slideDownAndUpAnimation, CommandDirective as ɵa, FocusBindingDirective as ɵb, AlertDialogComponent as ɵba, DialogInteractionService as ɵbc, InteractionContext as ɵbd, DisposableComponent as ɵc, NumberInputComponent as ɵd, AbstractInputComponent as ɵe, StringInputComponent as ɵf, PasswordInputComponent as ɵg, SelectInputComponent as ɵh, PlaceModule as ɵi, EmptyStateComponent as ɵj, BusyOverlayComponent as ɵk, PlaceOutletComponent as ɵl, leftRightPlaceAnimation as ɵm, LEFT_RIGHT_PLACE_ANIMATION as ɵn, PlaceRouter as ɵo, PlaceHistory as ɵp, TabbedPlaceNavigationComponent as ɵq, AbstractPlaceNavigationComponent as ɵr, ListPlaceNavComponent as ɵs, InteractionModule as ɵt, ActivityContainerComponent as ɵu, ActivityOutletComponent as ɵv, ConfirmationDialogComponent as ɵw, AbstractActivity as ɵx, ACTIVITY_DATA as ɵy };
|
|
4612
4940
|
//# sourceMappingURL=coolon-angular-ui-powerups.js.map
|