@coolon/angular-ui-powerups 0.0.50 → 0.0.53

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 (38) hide show
  1. package/bundles/coolon-angular-ui-powerups.umd.js +392 -745
  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/coolon-angular-ui-powerups.metadata.json +1 -1
  6. package/esm2015/coolon-angular-ui-powerups.js +2 -2
  7. package/esm2015/index.js +2 -2
  8. package/esm2015/lib/place/components/place-outlet/place-outlet.component.js +2 -2
  9. package/esm2015/lib/place/guards/place-route.guard.js +2 -2
  10. package/esm2015/lib/place/index.js +2 -2
  11. package/esm2015/lib/place/route/parameter-definition.class.js +17 -36
  12. package/esm2015/lib/place/route/parameter-sanitiser.js +3 -4
  13. package/esm2015/lib/place/route/parameter-snapshot.js +66 -208
  14. package/esm2015/lib/place/route/route-parameter-value.js +223 -0
  15. package/esm2015/public_api.js +2 -2
  16. package/esm5/coolon-angular-ui-powerups.js +2 -2
  17. package/esm5/index.js +2 -2
  18. package/esm5/lib/place/components/place-outlet/place-outlet.component.js +2 -2
  19. package/esm5/lib/place/guards/place-route.guard.js +2 -2
  20. package/esm5/lib/place/index.js +2 -2
  21. package/esm5/lib/place/route/parameter-definition.class.js +18 -45
  22. package/esm5/lib/place/route/parameter-sanitiser.js +3 -4
  23. package/esm5/lib/place/route/parameter-snapshot.js +73 -273
  24. package/esm5/lib/place/route/route-parameter-value.js +309 -0
  25. package/esm5/public_api.js +2 -2
  26. package/fesm2015/coolon-angular-ui-powerups.js +304 -537
  27. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  28. package/fesm5/coolon-angular-ui-powerups.js +394 -746
  29. package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
  30. package/lib/place/index.d.ts +1 -1
  31. package/lib/place/route/parameter-definition.class.d.ts +2 -2
  32. package/lib/place/route/parameter-sanitiser.d.ts +2 -2
  33. package/lib/place/route/parameter-snapshot.d.ts +6 -27
  34. package/lib/place/route/route-parameter-value.d.ts +42 -0
  35. package/package.json +1 -1
  36. package/esm2015/lib/place/route/route-parameter-sanitiser.js +0 -296
  37. package/esm5/lib/place/route/route-parameter-sanitiser.js +0 -435
  38. package/lib/place/route/route-parameter-sanitiser.d.ts +0 -44
@@ -1932,6 +1932,226 @@ if (false) {
1932
1932
  PlaceRouter.prototype.router;
1933
1933
  }
1934
1934
 
1935
+ /**
1936
+ * @fileoverview added by tsickle
1937
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1938
+ */
1939
+ /**
1940
+ * @abstract
1941
+ * @template S, T, R
1942
+ */
1943
+ class RouteParameterValue {
1944
+ /**
1945
+ * @param {?} definition
1946
+ * @param {?} rawValue
1947
+ */
1948
+ constructor(definition, rawValue) {
1949
+ this.definition = definition;
1950
+ this.rawValue = rawValue;
1951
+ }
1952
+ /**
1953
+ * @return {?}
1954
+ */
1955
+ isRouteId() {
1956
+ return this.definition.isRouteId;
1957
+ }
1958
+ /**
1959
+ * @param {?} otherValue
1960
+ * @return {?}
1961
+ */
1962
+ hasChanged(otherValue) {
1963
+ return this.isEmpty() ?
1964
+ !this.isEmptyValue(otherValue) :
1965
+ this.isEmptyValue(otherValue) || !this.isSameValue(otherValue);
1966
+ }
1967
+ /**
1968
+ * Return's true if the current value is empty.
1969
+ * @return {?}
1970
+ */
1971
+ isEmpty() {
1972
+ return this.isEmptyValue(this.value);
1973
+ }
1974
+ /**
1975
+ * Returns true if the rawValue is undefined. This
1976
+ * @return {?}
1977
+ */
1978
+ isMissing() {
1979
+ return ___default.isUndefined(this.rawValue);
1980
+ }
1981
+ /**
1982
+ * @param {?} visit
1983
+ * @param {?} injector
1984
+ * @return {?}
1985
+ */
1986
+ sanitise(visit, injector) {
1987
+ return __awaiter(this, void 0, void 0, function* () {
1988
+ /** @type {?} */
1989
+ const sanitiser = this.definition.getSanitiser(injector);
1990
+ if (sanitiser) {
1991
+ return sanitiser.sanitise(this, visit);
1992
+ }
1993
+ else {
1994
+ return this.value;
1995
+ }
1996
+ });
1997
+ }
1998
+ }
1999
+ if (false) {
2000
+ /** @type {?} */
2001
+ RouteParameterValue.prototype.value;
2002
+ /** @type {?} */
2003
+ RouteParameterValue.prototype.definition;
2004
+ /**
2005
+ * @type {?}
2006
+ * @protected
2007
+ */
2008
+ RouteParameterValue.prototype.rawValue;
2009
+ /**
2010
+ * @abstract
2011
+ * @param {?} otherValue
2012
+ * @return {?}
2013
+ */
2014
+ RouteParameterValue.prototype.isSameValue = function (otherValue) { };
2015
+ /**
2016
+ * @abstract
2017
+ * @return {?}
2018
+ */
2019
+ RouteParameterValue.prototype.formattedValue = function () { };
2020
+ /**
2021
+ * @abstract
2022
+ * @param {?} value
2023
+ * @return {?}
2024
+ */
2025
+ RouteParameterValue.prototype.replace = function (value) { };
2026
+ /**
2027
+ * @abstract
2028
+ * @param {?} value
2029
+ * @return {?}
2030
+ */
2031
+ RouteParameterValue.prototype.isEmptyValue = function (value) { };
2032
+ }
2033
+ (function (RouteParameterValue) {
2034
+ /**
2035
+ * @template T
2036
+ * @param {?} def
2037
+ * @param {?} paramMap
2038
+ * @return {?}
2039
+ */
2040
+ function create(def, paramMap) {
2041
+ // NOTE: Using undefined is important as it triggers the isMissing flag which is used by defaultValue and remember flags
2042
+ return def.isArray ?
2043
+ new RouteParameterValue.Array(def, paramMap.has(def.name) ? paramMap.getAll(def.name) : undefined) :
2044
+ new RouteParameterValue.Scalar(def, paramMap.has(def.name) ? paramMap.get(def.name) : undefined);
2045
+ }
2046
+ RouteParameterValue.create = create;
2047
+ /**
2048
+ * @template T
2049
+ */
2050
+ class Scalar extends RouteParameterValue {
2051
+ /**
2052
+ * @return {?}
2053
+ */
2054
+ get value() {
2055
+ return this.definition.type.parse(this.rawValue);
2056
+ }
2057
+ /**
2058
+ * @param {?} otherValue
2059
+ * @return {?}
2060
+ */
2061
+ isSameValue(otherValue) {
2062
+ return this.value === otherValue;
2063
+ }
2064
+ /**
2065
+ * @param {?} value
2066
+ * @return {?}
2067
+ */
2068
+ replace(value) {
2069
+ return new RouteParameterValue.Scalar(this.definition, this.isEmptyValue(value) ? undefined : this.definition.type.format(value));
2070
+ }
2071
+ /**
2072
+ * @return {?}
2073
+ */
2074
+ formattedValue() {
2075
+ return this.isEmpty() ? undefined : this.definition.type.format(this.value);
2076
+ }
2077
+ /**
2078
+ * @param {?} value
2079
+ * @return {?}
2080
+ */
2081
+ isEmptyValue(value) {
2082
+ return ___default.isNil(value);
2083
+ }
2084
+ }
2085
+ __decorate([
2086
+ Memoize$1(),
2087
+ __metadata("design:type", Object),
2088
+ __metadata("design:paramtypes", [])
2089
+ ], Scalar.prototype, "value", null);
2090
+ RouteParameterValue.Scalar = Scalar;
2091
+ /**
2092
+ * @template T
2093
+ */
2094
+ class Array extends RouteParameterValue {
2095
+ /**
2096
+ * @return {?}
2097
+ */
2098
+ get value() {
2099
+ return (this.rawValue || [])
2100
+ .filter((/**
2101
+ * @param {?} s
2102
+ * @return {?}
2103
+ */
2104
+ s => !___default.isEmpty(s)))
2105
+ .map((/**
2106
+ * @param {?} raw
2107
+ * @return {?}
2108
+ */
2109
+ raw => this.definition.type.parse(raw)));
2110
+ }
2111
+ /**
2112
+ * @param {?} otherValue
2113
+ * @return {?}
2114
+ */
2115
+ isSameValue(otherValue) {
2116
+ return ___default.isEqual(this.value, otherValue);
2117
+ }
2118
+ /**
2119
+ * @param {?} value
2120
+ * @return {?}
2121
+ */
2122
+ replace(value) {
2123
+ return new RouteParameterValue.Array(this.definition, this.isEmptyValue(value) ? undefined : value.map((/**
2124
+ * @param {?} v
2125
+ * @return {?}
2126
+ */
2127
+ v => this.definition.type.format(v))));
2128
+ }
2129
+ /**
2130
+ * @return {?}
2131
+ */
2132
+ formattedValue() {
2133
+ return this.isEmpty() ? [] : this.value.map((/**
2134
+ * @param {?} v
2135
+ * @return {?}
2136
+ */
2137
+ v => this.definition.type.format(v)));
2138
+ }
2139
+ /**
2140
+ * @param {?} value
2141
+ * @return {?}
2142
+ */
2143
+ isEmptyValue(value) {
2144
+ return ___default.isNil(value) || value.length < 1;
2145
+ }
2146
+ }
2147
+ __decorate([
2148
+ Memoize$1(),
2149
+ __metadata("design:type", Array),
2150
+ __metadata("design:paramtypes", [])
2151
+ ], Array.prototype, "value", null);
2152
+ RouteParameterValue.Array = Array;
2153
+ })(RouteParameterValue || (RouteParameterValue = {}));
2154
+
1935
2155
  /**
1936
2156
  * @fileoverview added by tsickle
1937
2157
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
@@ -2073,54 +2293,34 @@ if (false) {
2073
2293
  this.placeHistory = placeHistory;
2074
2294
  }
2075
2295
  /**
2076
- * @param {?} parameterDef
2077
- * @param {?} value
2296
+ * @param {?} parameter
2078
2297
  * @param {?=} visit
2079
2298
  * @return {?}
2080
2299
  */
2081
- sanitise(parameterDef, value, visit) {
2082
- if (this.isBlank(parameterDef, value)) {
2083
- if (this.remember) {
2084
- /** @type {?} */
2085
- const visits = this.placeHistory.getHistory(visit.placeDefinition);
2086
- value = visits.map((/**
2087
- * @param {?} v
2088
- * @return {?}
2089
- */
2090
- v => v.getValueOf(parameterDef)))
2091
- .filter((/**
2092
- * @param {?} v
2093
- * @return {?}
2094
- */
2095
- v => !___default.isNil(v)))
2096
- .find((/**
2097
- * @param {?} v
2098
- * @return {?}
2099
- */
2100
- v => !this.isBlank(parameterDef, v)));
2300
+ sanitise(parameter, visit) {
2301
+ /** @type {?} */
2302
+ let value = parameter.value;
2303
+ if (parameter.isMissing()) {
2304
+ /** @type {?} */
2305
+ const previousVisit = ___default.first(this.placeHistory.getHistory(visit.placeDefinition));
2306
+ if (this.remember && previousVisit) {
2307
+ value = previousVisit.getValueOf(parameter.definition);
2101
2308
  }
2102
- return this.isBlank(parameterDef, value) ? this.defaultValue : value;
2309
+ /** @type {?} */
2310
+ const s = parameter.isEmptyValue(value) ? this.defaultValue : value;
2311
+ console.log(`missing -> ${parameter.definition.name}, returning ${s}`);
2312
+ return s;
2103
2313
  }
2104
2314
  else {
2315
+ console.log(`not missing -> ${parameter.definition.name}`);
2105
2316
  return value;
2106
2317
  }
2107
2318
  }
2108
- /**
2109
- * @private
2110
- * @param {?} def
2111
- * @param {?} value
2112
- * @return {?}
2113
- */
2114
- isBlank(def, value) {
2115
- /** @type {?} */
2116
- const isNil = ___default.isNil(value);
2117
- return isNil ? true : def.isArray ? value['length'] < 1 : false;
2118
- }
2119
2319
  }
2120
2320
  __decorate([
2121
2321
  Trace(),
2122
2322
  __metadata("design:type", Function),
2123
- __metadata("design:paramtypes", [ParameterDefinition, Object, Object]),
2323
+ __metadata("design:paramtypes", [RouteParameterValue, Object]),
2124
2324
  __metadata("design:returntype", Object)
2125
2325
  ], DefaultParameterSanitiser.prototype, "sanitise", null);
2126
2326
  ParameterDefinition.DefaultParameterSanitiser = DefaultParameterSanitiser;
@@ -2134,15 +2334,15 @@ if (false) {
2134
2334
  }
2135
2335
  })(ParameterDefinition || (ParameterDefinition = {}));
2136
2336
 
2137
- var _a, _b;
2337
+ var _a;
2138
2338
  class ParameterSnapshot {
2139
2339
  /**
2140
2340
  * @param {?} placeDefinition
2141
- * @param {?} resolved
2341
+ * @param {?} parameters
2142
2342
  */
2143
- constructor(placeDefinition, resolved) {
2343
+ constructor(placeDefinition, parameters) {
2144
2344
  this.placeDefinition = placeDefinition;
2145
- this.resolved = resolved;
2345
+ this.parameters = parameters;
2146
2346
  }
2147
2347
  /**
2148
2348
  * @param {?} other
@@ -2151,18 +2351,18 @@ class ParameterSnapshot {
2151
2351
  */
2152
2352
  hasChanged(other, debug = false) {
2153
2353
  /** @type {?} */
2154
- const changed = this.resolved.find((/**
2354
+ const changed = this.parameters.find((/**
2155
2355
  * @param {?} r
2156
2356
  * @return {?}
2157
2357
  */
2158
2358
  (r) => {
2159
- return !r.isSame(other.getValueOf(r.parameterDef));
2359
+ return r.hasChanged(other.getValueOf(r.definition));
2160
2360
  }));
2161
2361
  if (changed && debug) {
2162
2362
  console.log({
2163
- name: changed.parameterDef.name,
2363
+ name: changed.definition.name,
2164
2364
  mine: changed.value,
2165
- theirs: other.getValueOf(changed.parameterDef)
2365
+ theirs: other.getValueOf(changed.definition)
2166
2366
  });
2167
2367
  }
2168
2368
  return !!changed;
@@ -2173,11 +2373,11 @@ class ParameterSnapshot {
2173
2373
  * @return {?}
2174
2374
  */
2175
2375
  getParameter(parameterDef) {
2176
- return this.resolved.find((/**
2376
+ return this.parameters.find((/**
2177
2377
  * @param {?} r
2178
2378
  * @return {?}
2179
2379
  */
2180
- r => r.parameterDef === parameterDef));
2380
+ r => r.definition === parameterDef));
2181
2381
  }
2182
2382
  /**
2183
2383
  * @template T, S
@@ -2201,11 +2401,11 @@ class ParameterSnapshot {
2201
2401
  */
2202
2402
  getParameterValue(name) {
2203
2403
  /** @type {?} */
2204
- const resolvedParameter = this.resolved.find((/**
2404
+ const resolvedParameter = this.parameters.find((/**
2205
2405
  * @param {?} r
2206
2406
  * @return {?}
2207
2407
  */
2208
- r => r.parameterDef.name === name));
2408
+ r => r.definition.name === name));
2209
2409
  return resolvedParameter ? resolvedParameter.value : null;
2210
2410
  }
2211
2411
  /**
@@ -2215,22 +2415,22 @@ class ParameterSnapshot {
2215
2415
  getRouteIdParameter() {
2216
2416
  // RouteId's are never arrays: see parameter-decorators.ts createDefinition methods. It would be nice to
2217
2417
  // capture this in the type system though
2218
- return (/** @type {?} */ (this.resolved.find((/**
2418
+ return (/** @type {?} */ (this.parameters.find((/**
2219
2419
  * @param {?} p
2220
2420
  * @return {?}
2221
2421
  */
2222
- p => p.parameterDef.isRouteId))));
2422
+ p => p.definition.isRouteId))));
2223
2423
  }
2224
2424
  /**
2225
2425
  * @private
2226
2426
  * @return {?}
2227
2427
  */
2228
2428
  getRouteParameters() {
2229
- return this.resolved.filter((/**
2429
+ return this.parameters.filter((/**
2230
2430
  * @param {?} r
2231
2431
  * @return {?}
2232
2432
  */
2233
- r => !r.parameterDef.isRouteId));
2433
+ r => !r.definition.isRouteId));
2234
2434
  }
2235
2435
  /**
2236
2436
  * @return {?}
@@ -2246,6 +2446,16 @@ class ParameterSnapshot {
2246
2446
  const routeIdParam = this.getRouteIdParameter();
2247
2447
  return routeIdParam ? routeIdParam.formattedValue() : null;
2248
2448
  }
2449
+ /**
2450
+ * @return {?}
2451
+ */
2452
+ getNonEmptyParameters() {
2453
+ return this.parameters.filter((/**
2454
+ * @param {?} p
2455
+ * @return {?}
2456
+ */
2457
+ p => !p.isEmpty()));
2458
+ }
2249
2459
  /**
2250
2460
  * @return {?}
2251
2461
  */
@@ -2253,32 +2463,32 @@ class ParameterSnapshot {
2253
2463
  /** @type {?} */
2254
2464
  const params = {};
2255
2465
  /** @type {?} */
2256
- const routeIdParam = this.resolved.filter((/**
2466
+ const routeIdParam = this.getNonEmptyParameters()
2467
+ .filter((/**
2257
2468
  * @param {?} p
2258
2469
  * @return {?}
2259
2470
  */
2260
- p => !p.parameterDef.isRouteId)).forEach((/**
2471
+ p => !p.definition.isRouteId))
2472
+ .forEach((/**
2261
2473
  * @param {?} p
2262
2474
  * @return {?}
2263
2475
  */
2264
- p => {
2265
- params[p.parameterDef.name] = p.formattedValue();
2266
- }));
2476
+ p => params[p.definition.name] = p.formattedValue()));
2267
2477
  return params;
2268
2478
  }
2269
2479
  /**
2270
2480
  * @return {?}
2271
2481
  */
2272
- getAllFormattedParameters() {
2482
+ getAllParameters() {
2273
2483
  /** @type {?} */
2274
2484
  const params = {};
2275
2485
  /** @type {?} */
2276
- const routeIdParam = this.resolved.forEach((/**
2486
+ const routeIdParam = this.parameters.forEach((/**
2277
2487
  * @param {?} p
2278
2488
  * @return {?}
2279
2489
  */
2280
2490
  p => {
2281
- params[p.parameterDef.name] = p.formattedValue();
2491
+ params[p.definition.name] = p.value;
2282
2492
  }));
2283
2493
  return params;
2284
2494
  }
@@ -2289,12 +2499,12 @@ class ParameterSnapshot {
2289
2499
  * @return {?}
2290
2500
  */
2291
2501
  replace(parameter, value) {
2292
- return new ParameterSnapshot(this.placeDefinition, this.resolved.map((/**
2502
+ return new ParameterSnapshot(this.placeDefinition, this.parameters.map((/**
2293
2503
  * @param {?} p
2294
2504
  * @return {?}
2295
2505
  */
2296
2506
  p => {
2297
- return p.parameterDef === parameter ? p.replace(value) : p;
2507
+ return p.definition === parameter ? p.replace(value) : p;
2298
2508
  })));
2299
2509
  }
2300
2510
  /**
@@ -2308,10 +2518,10 @@ class ParameterSnapshot {
2308
2518
  const routeId = this.getRouteIdParameter();
2309
2519
  /** @type {?} */
2310
2520
  const sanitisedValue = yield routeId.sanitise(this, injector);
2311
- if (!routeId.isSame(sanitisedValue)) {
2521
+ if (routeId.hasChanged(sanitisedValue)) {
2312
2522
  // if the route id has changed we redirect immediately as other
2313
2523
  // parameter sanitisers might use it.
2314
- return this.replace(routeId.parameterDef, sanitisedValue);
2524
+ return this.replace(routeId.definition, sanitisedValue);
2315
2525
  }
2316
2526
  }
2317
2527
  /** @type {?} */
@@ -2323,8 +2533,8 @@ class ParameterSnapshot {
2323
2533
  const routeParameter = routeParameters[i];
2324
2534
  /** @type {?} */
2325
2535
  const sanitisedValue = yield routeParameter.sanitise(this, injector);
2326
- if (!routeParameter.isSame(sanitisedValue)) {
2327
- result = this.replace(routeParameter.parameterDef, sanitisedValue);
2536
+ if (routeParameter.hasChanged(sanitisedValue)) {
2537
+ result = result.replace(routeParameter.definition, sanitisedValue);
2328
2538
  }
2329
2539
  }
2330
2540
  return result;
@@ -2335,7 +2545,7 @@ __decorate([
2335
2545
  Memoize$1(),
2336
2546
  __metadata("design:type", Function),
2337
2547
  __metadata("design:paramtypes", [ParameterDefinition]),
2338
- __metadata("design:returntype", ParameterSnapshot.ResolvedParameter)
2548
+ __metadata("design:returntype", RouteParameterValue)
2339
2549
  ], ParameterSnapshot.prototype, "getParameter", null);
2340
2550
  __decorate([
2341
2551
  Memoize$1(),
@@ -2353,7 +2563,7 @@ __decorate([
2353
2563
  Memoize$1(),
2354
2564
  __metadata("design:type", Function),
2355
2565
  __metadata("design:paramtypes", []),
2356
- __metadata("design:returntype", ParameterSnapshot.ResolvedValueParameter)
2566
+ __metadata("design:returntype", RouteParameterValue.Scalar)
2357
2567
  ], ParameterSnapshot.prototype, "getRouteIdParameter", null);
2358
2568
  __decorate([
2359
2569
  Memoize$1(),
@@ -2364,15 +2574,9 @@ __decorate([
2364
2574
  __decorate([
2365
2575
  Trace(),
2366
2576
  __metadata("design:type", Function),
2367
- __metadata("design:paramtypes", [ParameterDefinition, typeof (_b = typeof S !== "undefined" && S) === "function" ? _b : Object]),
2368
- __metadata("design:returntype", ParameterSnapshot)
2369
- ], ParameterSnapshot.prototype, "replace", null);
2370
- __decorate([
2371
- Trace(),
2372
- __metadata("design:type", Function),
2373
- __metadata("design:paramtypes", [Injector]),
2374
- __metadata("design:returntype", Promise)
2375
- ], ParameterSnapshot.prototype, "sanitise", null);
2577
+ __metadata("design:paramtypes", []),
2578
+ __metadata("design:returntype", void 0)
2579
+ ], ParameterSnapshot.prototype, "getFormattedParameters", null);
2376
2580
  if (false) {
2377
2581
  /** @type {?} */
2378
2582
  ParameterSnapshot.prototype.placeDefinition;
@@ -2380,7 +2584,7 @@ if (false) {
2380
2584
  * @type {?}
2381
2585
  * @private
2382
2586
  */
2383
- ParameterSnapshot.prototype.resolved;
2587
+ ParameterSnapshot.prototype.parameters;
2384
2588
  }
2385
2589
  (function (ParameterSnapshot) {
2386
2590
  /**
@@ -2393,31 +2597,11 @@ if (false) {
2393
2597
  /** @type {?} */
2394
2598
  const paramMap = new ConsolidatedParameterMap(params, urlSegments);
2395
2599
  /** @type {?} */
2396
- const resolvedParameters = placeDef.getRouteParameters()
2397
- .map((/**
2600
+ const resolvedParameters = placeDef.getRouteParameters().map((/**
2398
2601
  * @param {?} def
2399
2602
  * @return {?}
2400
2603
  */
2401
- def => {
2402
- if (def.isArray) {
2403
- /** @type {?} */
2404
- const value = paramMap.has(def.name) ? paramMap.getAll(def.name).filter((/**
2405
- * @param {?} s
2406
- * @return {?}
2407
- */
2408
- s => !___default.isEmpty(s))).map((/**
2409
- * @param {?} raw
2410
- * @return {?}
2411
- */
2412
- raw => def.type.parse(raw))) : null;
2413
- return new ResolvedArrayParameter(def, value);
2414
- }
2415
- else {
2416
- /** @type {?} */
2417
- const value = paramMap.has(def.name) ? def.type.parse(paramMap.get(def.name)) : null;
2418
- return new ResolvedValueParameter(def, value);
2419
- }
2420
- }));
2604
+ def => RouteParameterValue.create(def, paramMap)));
2421
2605
  return new ParameterSnapshot(placeDef, resolvedParameters);
2422
2606
  }
2423
2607
  ParameterSnapshot.create = create;
@@ -2475,7 +2659,23 @@ if (false) {
2475
2659
  */
2476
2660
  m => m.has(name)));
2477
2661
  }
2662
+ /**
2663
+ * @return {?}
2664
+ */
2665
+ get keys() {
2666
+ return this.paramMaps.reduce((/**
2667
+ * @param {?} result
2668
+ * @param {?} params
2669
+ * @return {?}
2670
+ */
2671
+ (result, params) => result.concat(params.keys)), []);
2672
+ }
2478
2673
  }
2674
+ __decorate([
2675
+ Memoize$1(),
2676
+ __metadata("design:type", Array),
2677
+ __metadata("design:paramtypes", [])
2678
+ ], ConsolidatedParameterMap.prototype, "keys", null);
2479
2679
  if (false) {
2480
2680
  /**
2481
2681
  * @type {?}
@@ -2527,147 +2727,6 @@ if (false) {
2527
2727
  */
2528
2728
  ParamMapAdapter.prototype.params;
2529
2729
  }
2530
- /**
2531
- * @abstract
2532
- * @template T, S
2533
- */
2534
- class ResolvedParameter {
2535
- /**
2536
- * @param {?} parameterDef
2537
- * @param {?} value
2538
- */
2539
- constructor(parameterDef, value) {
2540
- this.parameterDef = parameterDef;
2541
- this.value = value;
2542
- }
2543
- /**
2544
- * @return {?}
2545
- */
2546
- isRouteId() {
2547
- return this.parameterDef.isRouteId;
2548
- }
2549
- /**
2550
- * @param {?} visit
2551
- * @param {?} injector
2552
- * @return {?}
2553
- */
2554
- sanitise(visit, injector) {
2555
- return __awaiter(this, void 0, void 0, function* () {
2556
- /** @type {?} */
2557
- const sanitiser = this.parameterDef.getSanitiser(injector);
2558
- if (sanitiser) {
2559
- return sanitiser.sanitise(this.parameterDef, this.value, visit);
2560
- }
2561
- else {
2562
- return this.value;
2563
- }
2564
- });
2565
- }
2566
- }
2567
- ParameterSnapshot.ResolvedParameter = ResolvedParameter;
2568
- if (false) {
2569
- /** @type {?} */
2570
- ResolvedParameter.prototype.parameterDef;
2571
- /** @type {?} */
2572
- ResolvedParameter.prototype.value;
2573
- /**
2574
- * @abstract
2575
- * @param {?} dest
2576
- * @return {?}
2577
- */
2578
- ResolvedParameter.prototype.injectRouteParam = function (dest) { };
2579
- /**
2580
- * @abstract
2581
- * @param {?} otherValue
2582
- * @return {?}
2583
- */
2584
- ResolvedParameter.prototype.isSame = function (otherValue) { };
2585
- /**
2586
- * @abstract
2587
- * @return {?}
2588
- */
2589
- ResolvedParameter.prototype.formattedValue = function () { };
2590
- /**
2591
- * @abstract
2592
- * @param {?} value
2593
- * @return {?}
2594
- */
2595
- ResolvedParameter.prototype.replace = function (value) { };
2596
- }
2597
- /**
2598
- * @template T
2599
- */
2600
- class ResolvedValueParameter extends ResolvedParameter {
2601
- /**
2602
- * @param {?} otherValue
2603
- * @return {?}
2604
- */
2605
- isSame(otherValue) {
2606
- return this.value === otherValue;
2607
- }
2608
- /**
2609
- * @param {?} dest
2610
- * @return {?}
2611
- */
2612
- injectRouteParam(dest) {
2613
- dest[this.parameterDef.name] = this.parameterDef.type.format(this.value);
2614
- }
2615
- /**
2616
- * @param {?} value
2617
- * @return {?}
2618
- */
2619
- replace(value) {
2620
- return new ResolvedValueParameter(this.parameterDef, value);
2621
- }
2622
- /**
2623
- * @return {?}
2624
- */
2625
- formattedValue() {
2626
- return !___default.isNil(this.value) ? this.parameterDef.type.format(this.value) : null;
2627
- }
2628
- }
2629
- ParameterSnapshot.ResolvedValueParameter = ResolvedValueParameter;
2630
- /**
2631
- * @template T
2632
- */
2633
- class ResolvedArrayParameter extends ResolvedParameter {
2634
- /**
2635
- * @param {?} otherValue
2636
- * @return {?}
2637
- */
2638
- isSame(otherValue) {
2639
- return ___default.isEqual(this.value, otherValue);
2640
- }
2641
- /**
2642
- * @param {?} dest
2643
- * @return {?}
2644
- */
2645
- injectRouteParam(dest) {
2646
- dest[this.parameterDef.name] = this.value.map((/**
2647
- * @param {?} v
2648
- * @return {?}
2649
- */
2650
- v => this.parameterDef.type.format(v)));
2651
- }
2652
- /**
2653
- * @param {?} value
2654
- * @return {?}
2655
- */
2656
- replace(value) {
2657
- return new ResolvedArrayParameter(this.parameterDef, value);
2658
- }
2659
- /**
2660
- * @return {?}
2661
- */
2662
- formattedValue() {
2663
- return this.value ? this.value.map((/**
2664
- * @param {?} v
2665
- * @return {?}
2666
- */
2667
- v => this.parameterDef.type.format(v))) : [];
2668
- }
2669
- }
2670
- ParameterSnapshot.ResolvedArrayParameter = ResolvedArrayParameter;
2671
2730
  })(ParameterSnapshot || (ParameterSnapshot = {}));
2672
2731
 
2673
2732
  /**
@@ -2796,8 +2855,8 @@ class PlaceOutletComponent extends DisposableComponent {
2796
2855
  * @return {?}
2797
2856
  */
2798
2857
  (next, previous) => {
2799
- this.pushChangesToRoute(next, previous);
2800
2858
  this.placeHistory.add(next); // the above route change doesn't seem to propagate back in, so I'm add the state to the history manually for now.
2859
+ this.pushChangesToRoute(next, previous);
2801
2860
  }), {
2802
2861
  unless: this.incomingRouteChange
2803
2862
  });
@@ -3583,7 +3642,7 @@ class PlaceRouteGuard {
3583
3642
  * @return {?}
3584
3643
  */
3585
3644
  sanitised => {
3586
- Logger.get(this).info("ParameterSnapshot.sanitise", { sanitised });
3645
+ Logger.get(this).info("ParameterSnapshot.sanitise ->", sanitised.getAllParameters());
3587
3646
  if (sanitised.hasChanged(snapshot, true)) {
3588
3647
  return this.placeRouter.getRedirectUrlTree(activatedRoute, sanitised);
3589
3648
  }
@@ -3737,12 +3796,11 @@ function RouteParameterList(elementType, options) {
3737
3796
  function ParameterSanitiser() { }
3738
3797
  if (false) {
3739
3798
  /**
3740
- * @param {?} parameterDef
3741
- * @param {?} value
3799
+ * @param {?} paramter
3742
3800
  * @param {?=} visit
3743
3801
  * @return {?}
3744
3802
  */
3745
- ParameterSanitiser.prototype.sanitise = function (parameterDef, value, visit) { };
3803
+ ParameterSanitiser.prototype.sanitise = function (paramter, visit) { };
3746
3804
  }
3747
3805
 
3748
3806
  /**
@@ -3805,297 +3863,6 @@ var ParameterType;
3805
3863
  ParameterType.BOOLEAN = new BooleanType();
3806
3864
  })(ParameterType || (ParameterType = {}));
3807
3865
 
3808
- /**
3809
- * @fileoverview added by tsickle
3810
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3811
- */
3812
- /**
3813
- * @template T, S
3814
- */
3815
- class Sanitiser {
3816
- /**
3817
- * @param {?} parameterDef
3818
- * @param {?} snapshot
3819
- * @param {?} sanitiser
3820
- */
3821
- constructor(parameterDef, snapshot, sanitiser) {
3822
- this.parameterDef = parameterDef;
3823
- this.snapshot = snapshot;
3824
- this.sanitiser = sanitiser;
3825
- }
3826
- /**
3827
- * @return {?}
3828
- */
3829
- isRouteId() {
3830
- return this.parameterDef.isRouteId;
3831
- }
3832
- /**
3833
- * @return {?}
3834
- */
3835
- get valueChanged() {
3836
- return !___default.isNil(this.initialValue) && this.hasChanged(this.initialValue, this.sanitisedValue);
3837
- }
3838
- /**
3839
- * @return {?}
3840
- */
3841
- get sanitisedValue() {
3842
- return this._sanitisedValue;
3843
- }
3844
- /**
3845
- * @protected
3846
- * @param {?} snapshot
3847
- * @return {?}
3848
- */
3849
- readFrom(snapshot) {
3850
- return lang.abstractMethod(this.constructor);
3851
- }
3852
- /**
3853
- * @protected
3854
- * @param {?} initialValue
3855
- * @param {?} sanitisedValue
3856
- * @return {?}
3857
- */
3858
- hasChanged(initialValue, sanitisedValue) {
3859
- return lang.abstractMethod(this.constructor);
3860
- }
3861
- /**
3862
- * @param {?} dest
3863
- * @return {?}
3864
- */
3865
- injectRouteParam(dest) {
3866
- lang.abstractMethod(this.constructor);
3867
- }
3868
- /**
3869
- * @return {?}
3870
- */
3871
- sanitize() {
3872
- return __awaiter(this, void 0, void 0, function* () {
3873
- if (this.sanitiser) {
3874
- this.initialValue = this.readFrom(this.snapshot);
3875
- this._sanitisedValue = yield this.sanitiser.sanitise(null, this.initialValue);
3876
- if (this.initialValue !== this._sanitisedValue) {
3877
- return false;
3878
- }
3879
- }
3880
- return true;
3881
- });
3882
- }
3883
- }
3884
- if (false) {
3885
- /**
3886
- * @type {?}
3887
- * @private
3888
- */
3889
- Sanitiser.prototype.initialValue;
3890
- /**
3891
- * @type {?}
3892
- * @private
3893
- */
3894
- Sanitiser.prototype._sanitisedValue;
3895
- /** @type {?} */
3896
- Sanitiser.prototype.parameterDef;
3897
- /** @type {?} */
3898
- Sanitiser.prototype.snapshot;
3899
- /** @type {?} */
3900
- Sanitiser.prototype.sanitiser;
3901
- }
3902
- class RouteParameterSanitiser {
3903
- /**
3904
- * @param {?} parameterDefs
3905
- * @param {?} snapshot
3906
- * @param {?} injector
3907
- */
3908
- constructor(parameterDefs, snapshot, injector) {
3909
- this.parameterDefs = parameterDefs;
3910
- this.snapshot = snapshot;
3911
- this.injector = injector;
3912
- this.parameterSanitisers = [];
3913
- /** @type {?} */
3914
- const sanitisers = parameterDefs.map((/**
3915
- * @param {?} def
3916
- * @return {?}
3917
- */
3918
- def => {
3919
- return def.isArray ?
3920
- new Sanitiser.Array(def, snapshot, this.getSanitiser(def)) :
3921
- new Sanitiser.Value(def, snapshot, this.getSanitiser(def));
3922
- }));
3923
- this.routeIdSanitiser = sanitisers.find((/**
3924
- * @param {?} p
3925
- * @return {?}
3926
- */
3927
- p => p.isRouteId()));
3928
- this.parameterSanitisers = sanitisers.filter((/**
3929
- * @param {?} p
3930
- * @return {?}
3931
- */
3932
- p => !p.isRouteId()));
3933
- }
3934
- /**
3935
- * @return {?}
3936
- */
3937
- sanitise() {
3938
- return __awaiter(this, void 0, void 0, function* () {
3939
- if (this.routeIdSanitiser) {
3940
- yield this.routeIdSanitiser.sanitize();
3941
- if (this.routeIdSanitiser.valueChanged) {
3942
- // if the route id isn't ok we redirect immediately as the query params may need to be sanitised in the
3943
- // context of the route id.
3944
- return false;
3945
- }
3946
- }
3947
- for (const sanitiser of this.parameterSanitisers) {
3948
- yield sanitiser.sanitize();
3949
- }
3950
- return !this.parameterSanitisers.find((/**
3951
- * @param {?} s
3952
- * @return {?}
3953
- */
3954
- s => s.valueChanged));
3955
- });
3956
- }
3957
- /**
3958
- * @private
3959
- * @template T, S
3960
- * @param {?} def
3961
- * @return {?}
3962
- */
3963
- getSanitiser(def) {
3964
- return def.getSanitiser(this.injector);
3965
- }
3966
- /**
3967
- * @return {?}
3968
- */
3969
- routeIdHasChanged() {
3970
- assert.isTruthy(this.parameterSanitisers.length !== 0);
3971
- return this.routeIdSanitiser && this.routeIdSanitiser.valueChanged;
3972
- }
3973
- // @Trace()
3974
- /**
3975
- * @return {?}
3976
- */
3977
- getRedirectParams() {
3978
- if (this.routeIdHasChanged()) {
3979
- return [this.routeIdSanitiser.sanitisedValue];
3980
- }
3981
- else {
3982
- /** @type {?} */
3983
- const routeParams = {};
3984
- this.parameterSanitisers.forEach((/**
3985
- * @param {?} s
3986
- * @return {?}
3987
- */
3988
- s => s.injectRouteParam(routeParams)));
3989
- return [routeParams];
3990
- }
3991
- }
3992
- /**
3993
- * @private
3994
- * @template S
3995
- * @param {?} value
3996
- * @return {?}
3997
- */
3998
- isSanitiserContructor(value) {
3999
- return ___default.isFunction(value) && lang.constructorChain((/** @type {?} */ ((/** @type {?} */ (value))))).includes(Sanitiser);
4000
- }
4001
- }
4002
- __decorate([
4003
- Memoize$1(),
4004
- __metadata("design:type", Function),
4005
- __metadata("design:paramtypes", [ParameterDefinition]),
4006
- __metadata("design:returntype", Object)
4007
- ], RouteParameterSanitiser.prototype, "getSanitiser", null);
4008
- if (false) {
4009
- /**
4010
- * @type {?}
4011
- * @private
4012
- */
4013
- RouteParameterSanitiser.prototype.routeIdSanitiser;
4014
- /**
4015
- * @type {?}
4016
- * @private
4017
- */
4018
- RouteParameterSanitiser.prototype.parameterSanitisers;
4019
- /** @type {?} */
4020
- RouteParameterSanitiser.prototype.parameterDefs;
4021
- /** @type {?} */
4022
- RouteParameterSanitiser.prototype.snapshot;
4023
- /** @type {?} */
4024
- RouteParameterSanitiser.prototype.injector;
4025
- }
4026
- (function (Sanitiser) {
4027
- /**
4028
- * @template T
4029
- */
4030
- class Value extends Sanitiser {
4031
- /**
4032
- * @param {?} snapshot
4033
- * @return {?}
4034
- */
4035
- readFrom(snapshot) {
4036
- /** @type {?} */
4037
- const rawValue = snapshot.paramMap.get(this.parameterDef.name);
4038
- return this.parameterDef.type.parse(rawValue);
4039
- }
4040
- /**
4041
- * @protected
4042
- * @param {?} initialValue
4043
- * @param {?} sanitisedValue
4044
- * @return {?}
4045
- */
4046
- hasChanged(initialValue, sanitisedValue) {
4047
- return initialValue !== sanitisedValue;
4048
- }
4049
- /**
4050
- * @param {?} dest
4051
- * @return {?}
4052
- */
4053
- injectRouteParam(dest) {
4054
- dest[this.parameterDef.name] = this.parameterDef.type.format(this.sanitisedValue);
4055
- }
4056
- }
4057
- Sanitiser.Value = Value;
4058
- /**
4059
- * @template T
4060
- */
4061
- class Array extends Sanitiser {
4062
- /**
4063
- * @param {?} snapshot
4064
- * @return {?}
4065
- */
4066
- readFrom(snapshot) {
4067
- /** @type {?} */
4068
- const rawValues = snapshot.paramMap.getAll(this.parameterDef.name);
4069
- return rawValues.map((/**
4070
- * @param {?} value
4071
- * @return {?}
4072
- */
4073
- value => this.parameterDef.type.parse(value)));
4074
- }
4075
- /**
4076
- * @protected
4077
- * @param {?} initialValue
4078
- * @param {?} sanitisedValue
4079
- * @return {?}
4080
- */
4081
- hasChanged(initialValue, sanitisedValue) {
4082
- return initialValue !== sanitisedValue;
4083
- }
4084
- /**
4085
- * @param {?} dest
4086
- * @return {?}
4087
- */
4088
- injectRouteParam(dest) {
4089
- dest[this.parameterDef.name] = this.sanitisedValue.map((/**
4090
- * @param {?} v
4091
- * @return {?}
4092
- */
4093
- v => this.parameterDef.type.format(v)));
4094
- }
4095
- }
4096
- Sanitiser.Array = Array;
4097
- })(Sanitiser || (Sanitiser = {}));
4098
-
4099
3866
  /**
4100
3867
  * @fileoverview added by tsickle
4101
3868
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
@@ -4116,5 +3883,5 @@ if (false) {
4116
3883
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4117
3884
  */
4118
3885
 
4119
- 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 };
3886
+ 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, RouteParameterValue, 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 };
4120
3887
  //# sourceMappingURL=coolon-angular-ui-powerups.js.map