@coolon/angular-ui-powerups 0.0.51 → 0.0.54

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 +382 -746
  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 +11 -35
  12. package/esm2015/lib/place/route/parameter-sanitiser.js +3 -4
  13. package/esm2015/lib/place/route/parameter-snapshot.js +65 -209
  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 +12 -44
  22. package/esm5/lib/place/route/parameter-sanitiser.js +3 -4
  23. package/esm5/lib/place/route/parameter-snapshot.js +69 -274
  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 +298 -539
  27. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  28. package/fesm5/coolon-angular-ui-powerups.js +385 -748
  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 +5 -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
@@ -5,7 +5,7 @@ import { MatDialog, MatButtonModule, MatDialogModule, MatTabsModule, MatProgress
5
5
  import { MatTabsModule as MatTabsModule$1 } from '@angular/material/tabs';
6
6
  import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
7
7
  import { __decorate, __metadata, __awaiter } from 'tslib';
8
- import { GarbageCollector, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, assert, UnaryCommand, lang, Dsl, Logger, EventListenerList, DelegatingValueModel, MutableListModel, StoreInValueModel, Binding, MutableValueModel, Guard, OptionsHelper, ValueHolder } from '@coolon/pectin';
8
+ import { GarbageCollector, DelegatingFormValueModel, UseDelegate, ValueModel, ListModel, StoreInListModel, assert, UnaryCommand, lang, Dsl, Logger, EventListenerList, DelegatingValueModel, MutableListModel, StoreInValueModel, Binding, Trace, MutableValueModel, Guard, OptionsHelper, ValueHolder } from '@coolon/pectin';
9
9
  import { PortalModule } from '@angular/cdk/portal';
10
10
  import { Deferred } from '@coolon/pectin/lib/promise/deferred.class';
11
11
  import { assert as assert$1, Klass, Opts } from '@coolon/typescript-utilities';
@@ -2073,49 +2073,25 @@ if (false) {
2073
2073
  this.placeHistory = placeHistory;
2074
2074
  }
2075
2075
  /**
2076
- * @param {?} parameterDef
2077
- * @param {?} value
2076
+ * @param {?} parameter
2078
2077
  * @param {?=} visit
2079
2078
  * @return {?}
2080
2079
  */
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)));
2080
+ sanitise(parameter, visit) {
2081
+ /** @type {?} */
2082
+ let value = parameter.value;
2083
+ if (parameter.isMissing()) {
2084
+ /** @type {?} */
2085
+ const previousVisit = ___default.first(this.placeHistory.getHistory(visit.placeDefinition));
2086
+ if (this.remember && previousVisit) {
2087
+ value = previousVisit.getValueOf(parameter.definition);
2101
2088
  }
2102
- return this.isBlank(parameterDef, value) ? this.defaultValue : value;
2089
+ return parameter.isEmptyValue(value) ? this.defaultValue : value;
2103
2090
  }
2104
2091
  else {
2105
2092
  return value;
2106
2093
  }
2107
2094
  }
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
2095
  }
2120
2096
  ParameterDefinition.DefaultParameterSanitiser = DefaultParameterSanitiser;
2121
2097
  if (false) {
@@ -2128,15 +2104,235 @@ if (false) {
2128
2104
  }
2129
2105
  })(ParameterDefinition || (ParameterDefinition = {}));
2130
2106
 
2107
+ /**
2108
+ * @fileoverview added by tsickle
2109
+ * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
2110
+ */
2111
+ /**
2112
+ * @abstract
2113
+ * @template S, T, R
2114
+ */
2115
+ class RouteParameterValue {
2116
+ /**
2117
+ * @param {?} definition
2118
+ * @param {?} rawValue
2119
+ */
2120
+ constructor(definition, rawValue) {
2121
+ this.definition = definition;
2122
+ this.rawValue = rawValue;
2123
+ }
2124
+ /**
2125
+ * @return {?}
2126
+ */
2127
+ isRouteId() {
2128
+ return this.definition.isRouteId;
2129
+ }
2130
+ /**
2131
+ * @param {?} otherValue
2132
+ * @return {?}
2133
+ */
2134
+ hasChanged(otherValue) {
2135
+ return this.isEmpty() ?
2136
+ !this.isEmptyValue(otherValue) :
2137
+ this.isEmptyValue(otherValue) || !this.isSameValue(otherValue);
2138
+ }
2139
+ /**
2140
+ * Return's true if the current value is empty.
2141
+ * @return {?}
2142
+ */
2143
+ isEmpty() {
2144
+ return this.isEmptyValue(this.value);
2145
+ }
2146
+ /**
2147
+ * Returns true if the rawValue is undefined. This
2148
+ * @return {?}
2149
+ */
2150
+ isMissing() {
2151
+ return ___default.isUndefined(this.rawValue);
2152
+ }
2153
+ /**
2154
+ * @param {?} visit
2155
+ * @param {?} injector
2156
+ * @return {?}
2157
+ */
2158
+ sanitise(visit, injector) {
2159
+ return __awaiter(this, void 0, void 0, function* () {
2160
+ /** @type {?} */
2161
+ const sanitiser = this.definition.getSanitiser(injector);
2162
+ if (sanitiser) {
2163
+ return sanitiser.sanitise(this, visit);
2164
+ }
2165
+ else {
2166
+ return this.value;
2167
+ }
2168
+ });
2169
+ }
2170
+ }
2171
+ if (false) {
2172
+ /** @type {?} */
2173
+ RouteParameterValue.prototype.value;
2174
+ /** @type {?} */
2175
+ RouteParameterValue.prototype.definition;
2176
+ /**
2177
+ * @type {?}
2178
+ * @protected
2179
+ */
2180
+ RouteParameterValue.prototype.rawValue;
2181
+ /**
2182
+ * @abstract
2183
+ * @param {?} otherValue
2184
+ * @return {?}
2185
+ */
2186
+ RouteParameterValue.prototype.isSameValue = function (otherValue) { };
2187
+ /**
2188
+ * @abstract
2189
+ * @return {?}
2190
+ */
2191
+ RouteParameterValue.prototype.formattedValue = function () { };
2192
+ /**
2193
+ * @abstract
2194
+ * @param {?} value
2195
+ * @return {?}
2196
+ */
2197
+ RouteParameterValue.prototype.replace = function (value) { };
2198
+ /**
2199
+ * @abstract
2200
+ * @param {?} value
2201
+ * @return {?}
2202
+ */
2203
+ RouteParameterValue.prototype.isEmptyValue = function (value) { };
2204
+ }
2205
+ (function (RouteParameterValue) {
2206
+ /**
2207
+ * @template T
2208
+ * @param {?} def
2209
+ * @param {?} paramMap
2210
+ * @return {?}
2211
+ */
2212
+ function create(def, paramMap) {
2213
+ // NOTE: Using undefined is important as it triggers the isMissing flag which is used by defaultValue and remember flags
2214
+ return def.isArray ?
2215
+ new RouteParameterValue.Array(def, paramMap.has(def.name) ? paramMap.getAll(def.name) : undefined) :
2216
+ new RouteParameterValue.Scalar(def, paramMap.has(def.name) ? paramMap.get(def.name) : undefined);
2217
+ }
2218
+ RouteParameterValue.create = create;
2219
+ /**
2220
+ * @template T
2221
+ */
2222
+ class Scalar extends RouteParameterValue {
2223
+ /**
2224
+ * @return {?}
2225
+ */
2226
+ get value() {
2227
+ return this.definition.type.parse(this.rawValue);
2228
+ }
2229
+ /**
2230
+ * @param {?} otherValue
2231
+ * @return {?}
2232
+ */
2233
+ isSameValue(otherValue) {
2234
+ return this.value === otherValue;
2235
+ }
2236
+ /**
2237
+ * @param {?} value
2238
+ * @return {?}
2239
+ */
2240
+ replace(value) {
2241
+ return new RouteParameterValue.Scalar(this.definition, this.isEmptyValue(value) ? undefined : this.definition.type.format(value));
2242
+ }
2243
+ /**
2244
+ * @return {?}
2245
+ */
2246
+ formattedValue() {
2247
+ return this.isEmpty() ? undefined : this.definition.type.format(this.value);
2248
+ }
2249
+ /**
2250
+ * @param {?} value
2251
+ * @return {?}
2252
+ */
2253
+ isEmptyValue(value) {
2254
+ return ___default.isNil(value);
2255
+ }
2256
+ }
2257
+ __decorate([
2258
+ Memoize$1(),
2259
+ __metadata("design:type", Object),
2260
+ __metadata("design:paramtypes", [])
2261
+ ], Scalar.prototype, "value", null);
2262
+ RouteParameterValue.Scalar = Scalar;
2263
+ /**
2264
+ * @template T
2265
+ */
2266
+ class Array extends RouteParameterValue {
2267
+ /**
2268
+ * @return {?}
2269
+ */
2270
+ get value() {
2271
+ return (this.rawValue || [])
2272
+ .filter((/**
2273
+ * @param {?} s
2274
+ * @return {?}
2275
+ */
2276
+ s => !___default.isEmpty(s)))
2277
+ .map((/**
2278
+ * @param {?} raw
2279
+ * @return {?}
2280
+ */
2281
+ raw => this.definition.type.parse(raw)));
2282
+ }
2283
+ /**
2284
+ * @param {?} otherValue
2285
+ * @return {?}
2286
+ */
2287
+ isSameValue(otherValue) {
2288
+ return ___default.isEqual(this.value, otherValue);
2289
+ }
2290
+ /**
2291
+ * @param {?} value
2292
+ * @return {?}
2293
+ */
2294
+ replace(value) {
2295
+ return new RouteParameterValue.Array(this.definition, this.isEmptyValue(value) ? undefined : value.map((/**
2296
+ * @param {?} v
2297
+ * @return {?}
2298
+ */
2299
+ v => this.definition.type.format(v))));
2300
+ }
2301
+ /**
2302
+ * @return {?}
2303
+ */
2304
+ formattedValue() {
2305
+ return this.isEmpty() ? [] : this.value.map((/**
2306
+ * @param {?} v
2307
+ * @return {?}
2308
+ */
2309
+ v => this.definition.type.format(v)));
2310
+ }
2311
+ /**
2312
+ * @param {?} value
2313
+ * @return {?}
2314
+ */
2315
+ isEmptyValue(value) {
2316
+ return ___default.isNil(value) || value.length < 1;
2317
+ }
2318
+ }
2319
+ __decorate([
2320
+ Memoize$1(),
2321
+ __metadata("design:type", Array),
2322
+ __metadata("design:paramtypes", [])
2323
+ ], Array.prototype, "value", null);
2324
+ RouteParameterValue.Array = Array;
2325
+ })(RouteParameterValue || (RouteParameterValue = {}));
2326
+
2131
2327
  var _a;
2132
2328
  class ParameterSnapshot {
2133
2329
  /**
2134
2330
  * @param {?} placeDefinition
2135
- * @param {?} resolved
2331
+ * @param {?} parameters
2136
2332
  */
2137
- constructor(placeDefinition, resolved) {
2333
+ constructor(placeDefinition, parameters) {
2138
2334
  this.placeDefinition = placeDefinition;
2139
- this.resolved = resolved;
2335
+ this.parameters = parameters;
2140
2336
  }
2141
2337
  /**
2142
2338
  * @param {?} other
@@ -2145,18 +2341,18 @@ class ParameterSnapshot {
2145
2341
  */
2146
2342
  hasChanged(other, debug = false) {
2147
2343
  /** @type {?} */
2148
- const changed = this.resolved.find((/**
2344
+ const changed = this.parameters.find((/**
2149
2345
  * @param {?} r
2150
2346
  * @return {?}
2151
2347
  */
2152
2348
  (r) => {
2153
- return !r.isSame(other.getValueOf(r.parameterDef));
2349
+ return r.hasChanged(other.getValueOf(r.definition));
2154
2350
  }));
2155
2351
  if (changed && debug) {
2156
2352
  console.log({
2157
- name: changed.parameterDef.name,
2353
+ name: changed.definition.name,
2158
2354
  mine: changed.value,
2159
- theirs: other.getValueOf(changed.parameterDef)
2355
+ theirs: other.getValueOf(changed.definition)
2160
2356
  });
2161
2357
  }
2162
2358
  return !!changed;
@@ -2167,11 +2363,11 @@ class ParameterSnapshot {
2167
2363
  * @return {?}
2168
2364
  */
2169
2365
  getParameter(parameterDef) {
2170
- return this.resolved.find((/**
2366
+ return this.parameters.find((/**
2171
2367
  * @param {?} r
2172
2368
  * @return {?}
2173
2369
  */
2174
- r => r.parameterDef === parameterDef));
2370
+ r => r.definition === parameterDef));
2175
2371
  }
2176
2372
  /**
2177
2373
  * @template T, S
@@ -2195,11 +2391,11 @@ class ParameterSnapshot {
2195
2391
  */
2196
2392
  getParameterValue(name) {
2197
2393
  /** @type {?} */
2198
- const resolvedParameter = this.resolved.find((/**
2394
+ const resolvedParameter = this.parameters.find((/**
2199
2395
  * @param {?} r
2200
2396
  * @return {?}
2201
2397
  */
2202
- r => r.parameterDef.name === name));
2398
+ r => r.definition.name === name));
2203
2399
  return resolvedParameter ? resolvedParameter.value : null;
2204
2400
  }
2205
2401
  /**
@@ -2209,22 +2405,22 @@ class ParameterSnapshot {
2209
2405
  getRouteIdParameter() {
2210
2406
  // RouteId's are never arrays: see parameter-decorators.ts createDefinition methods. It would be nice to
2211
2407
  // capture this in the type system though
2212
- return (/** @type {?} */ (this.resolved.find((/**
2408
+ return (/** @type {?} */ (this.parameters.find((/**
2213
2409
  * @param {?} p
2214
2410
  * @return {?}
2215
2411
  */
2216
- p => p.parameterDef.isRouteId))));
2412
+ p => p.definition.isRouteId))));
2217
2413
  }
2218
2414
  /**
2219
2415
  * @private
2220
2416
  * @return {?}
2221
2417
  */
2222
2418
  getRouteParameters() {
2223
- return this.resolved.filter((/**
2419
+ return this.parameters.filter((/**
2224
2420
  * @param {?} r
2225
2421
  * @return {?}
2226
2422
  */
2227
- r => !r.parameterDef.isRouteId));
2423
+ r => !r.definition.isRouteId));
2228
2424
  }
2229
2425
  /**
2230
2426
  * @return {?}
@@ -2243,37 +2439,31 @@ class ParameterSnapshot {
2243
2439
  /**
2244
2440
  * @return {?}
2245
2441
  */
2246
- getFormattedParameters() {
2247
- /** @type {?} */
2248
- const params = {};
2249
- /** @type {?} */
2250
- const routeIdParam = this.resolved.filter((/**
2251
- * @param {?} p
2252
- * @return {?}
2253
- */
2254
- p => !p.parameterDef.isRouteId)).forEach((/**
2442
+ getNonEmptyParameters() {
2443
+ return this.parameters.filter((/**
2255
2444
  * @param {?} p
2256
2445
  * @return {?}
2257
2446
  */
2258
- p => {
2259
- params[p.parameterDef.name] = p.formattedValue();
2260
- }));
2261
- return params;
2447
+ p => !p.isEmpty()));
2262
2448
  }
2263
2449
  /**
2264
2450
  * @return {?}
2265
2451
  */
2266
- getAllFormattedParameters() {
2452
+ getFormattedParameters() {
2267
2453
  /** @type {?} */
2268
2454
  const params = {};
2269
2455
  /** @type {?} */
2270
- const routeIdParam = this.resolved.forEach((/**
2456
+ const routeIdParam = this.getNonEmptyParameters()
2457
+ .filter((/**
2271
2458
  * @param {?} p
2272
2459
  * @return {?}
2273
2460
  */
2274
- p => {
2275
- params[p.parameterDef.name] = p.formattedValue();
2276
- }));
2461
+ p => !p.definition.isRouteId))
2462
+ .forEach((/**
2463
+ * @param {?} p
2464
+ * @return {?}
2465
+ */
2466
+ p => params[p.definition.name] = p.formattedValue()));
2277
2467
  return params;
2278
2468
  }
2279
2469
  /**
@@ -2283,12 +2473,12 @@ class ParameterSnapshot {
2283
2473
  /** @type {?} */
2284
2474
  const params = {};
2285
2475
  /** @type {?} */
2286
- const routeIdParam = this.resolved.forEach((/**
2476
+ const routeIdParam = this.parameters.forEach((/**
2287
2477
  * @param {?} p
2288
2478
  * @return {?}
2289
2479
  */
2290
2480
  p => {
2291
- params[p.parameterDef.name] = p.value;
2481
+ params[p.definition.name] = p.value;
2292
2482
  }));
2293
2483
  return params;
2294
2484
  }
@@ -2299,12 +2489,12 @@ class ParameterSnapshot {
2299
2489
  * @return {?}
2300
2490
  */
2301
2491
  replace(parameter, value) {
2302
- return new ParameterSnapshot(this.placeDefinition, this.resolved.map((/**
2492
+ return new ParameterSnapshot(this.placeDefinition, this.parameters.map((/**
2303
2493
  * @param {?} p
2304
2494
  * @return {?}
2305
2495
  */
2306
2496
  p => {
2307
- return p.parameterDef === parameter ? p.replace(value) : p;
2497
+ return p.definition === parameter ? p.replace(value) : p;
2308
2498
  })));
2309
2499
  }
2310
2500
  /**
@@ -2318,10 +2508,10 @@ class ParameterSnapshot {
2318
2508
  const routeId = this.getRouteIdParameter();
2319
2509
  /** @type {?} */
2320
2510
  const sanitisedValue = yield routeId.sanitise(this, injector);
2321
- if (!routeId.isSame(sanitisedValue)) {
2511
+ if (routeId.hasChanged(sanitisedValue)) {
2322
2512
  // if the route id has changed we redirect immediately as other
2323
2513
  // parameter sanitisers might use it.
2324
- return this.replace(routeId.parameterDef, sanitisedValue);
2514
+ return this.replace(routeId.definition, sanitisedValue);
2325
2515
  }
2326
2516
  }
2327
2517
  /** @type {?} */
@@ -2333,8 +2523,8 @@ class ParameterSnapshot {
2333
2523
  const routeParameter = routeParameters[i];
2334
2524
  /** @type {?} */
2335
2525
  const sanitisedValue = yield routeParameter.sanitise(this, injector);
2336
- if (!routeParameter.isSame(sanitisedValue)) {
2337
- result = result.replace(routeParameter.parameterDef, sanitisedValue);
2526
+ if (routeParameter.hasChanged(sanitisedValue)) {
2527
+ result = result.replace(routeParameter.definition, sanitisedValue);
2338
2528
  }
2339
2529
  }
2340
2530
  return result;
@@ -2345,7 +2535,7 @@ __decorate([
2345
2535
  Memoize$1(),
2346
2536
  __metadata("design:type", Function),
2347
2537
  __metadata("design:paramtypes", [ParameterDefinition]),
2348
- __metadata("design:returntype", ParameterSnapshot.ResolvedParameter)
2538
+ __metadata("design:returntype", RouteParameterValue)
2349
2539
  ], ParameterSnapshot.prototype, "getParameter", null);
2350
2540
  __decorate([
2351
2541
  Memoize$1(),
@@ -2363,7 +2553,7 @@ __decorate([
2363
2553
  Memoize$1(),
2364
2554
  __metadata("design:type", Function),
2365
2555
  __metadata("design:paramtypes", []),
2366
- __metadata("design:returntype", ParameterSnapshot.ResolvedValueParameter)
2556
+ __metadata("design:returntype", RouteParameterValue.Scalar)
2367
2557
  ], ParameterSnapshot.prototype, "getRouteIdParameter", null);
2368
2558
  __decorate([
2369
2559
  Memoize$1(),
@@ -2371,6 +2561,12 @@ __decorate([
2371
2561
  __metadata("design:paramtypes", []),
2372
2562
  __metadata("design:returntype", Array)
2373
2563
  ], ParameterSnapshot.prototype, "getRouteParameters", null);
2564
+ __decorate([
2565
+ Trace(),
2566
+ __metadata("design:type", Function),
2567
+ __metadata("design:paramtypes", []),
2568
+ __metadata("design:returntype", void 0)
2569
+ ], ParameterSnapshot.prototype, "getFormattedParameters", null);
2374
2570
  if (false) {
2375
2571
  /** @type {?} */
2376
2572
  ParameterSnapshot.prototype.placeDefinition;
@@ -2378,7 +2574,7 @@ if (false) {
2378
2574
  * @type {?}
2379
2575
  * @private
2380
2576
  */
2381
- ParameterSnapshot.prototype.resolved;
2577
+ ParameterSnapshot.prototype.parameters;
2382
2578
  }
2383
2579
  (function (ParameterSnapshot) {
2384
2580
  /**
@@ -2391,31 +2587,11 @@ if (false) {
2391
2587
  /** @type {?} */
2392
2588
  const paramMap = new ConsolidatedParameterMap(params, urlSegments);
2393
2589
  /** @type {?} */
2394
- const resolvedParameters = placeDef.getRouteParameters()
2395
- .map((/**
2590
+ const resolvedParameters = placeDef.getRouteParameters().map((/**
2396
2591
  * @param {?} def
2397
2592
  * @return {?}
2398
2593
  */
2399
- def => {
2400
- if (def.isArray) {
2401
- /** @type {?} */
2402
- const value = paramMap.has(def.name) ? paramMap.getAll(def.name).filter((/**
2403
- * @param {?} s
2404
- * @return {?}
2405
- */
2406
- s => !___default.isEmpty(s))).map((/**
2407
- * @param {?} raw
2408
- * @return {?}
2409
- */
2410
- raw => def.type.parse(raw))) : null;
2411
- return new ResolvedArrayParameter(def, value);
2412
- }
2413
- else {
2414
- /** @type {?} */
2415
- const value = paramMap.has(def.name) ? def.type.parse(paramMap.get(def.name)) : null;
2416
- return new ResolvedValueParameter(def, value);
2417
- }
2418
- }));
2594
+ def => RouteParameterValue.create(def, paramMap)));
2419
2595
  return new ParameterSnapshot(placeDef, resolvedParameters);
2420
2596
  }
2421
2597
  ParameterSnapshot.create = create;
@@ -2473,7 +2649,23 @@ if (false) {
2473
2649
  */
2474
2650
  m => m.has(name)));
2475
2651
  }
2652
+ /**
2653
+ * @return {?}
2654
+ */
2655
+ get keys() {
2656
+ return this.paramMaps.reduce((/**
2657
+ * @param {?} result
2658
+ * @param {?} params
2659
+ * @return {?}
2660
+ */
2661
+ (result, params) => result.concat(params.keys)), []);
2662
+ }
2476
2663
  }
2664
+ __decorate([
2665
+ Memoize$1(),
2666
+ __metadata("design:type", Array),
2667
+ __metadata("design:paramtypes", [])
2668
+ ], ConsolidatedParameterMap.prototype, "keys", null);
2477
2669
  if (false) {
2478
2670
  /**
2479
2671
  * @type {?}
@@ -2525,147 +2717,6 @@ if (false) {
2525
2717
  */
2526
2718
  ParamMapAdapter.prototype.params;
2527
2719
  }
2528
- /**
2529
- * @abstract
2530
- * @template T, S
2531
- */
2532
- class ResolvedParameter {
2533
- /**
2534
- * @param {?} parameterDef
2535
- * @param {?} value
2536
- */
2537
- constructor(parameterDef, value) {
2538
- this.parameterDef = parameterDef;
2539
- this.value = value;
2540
- }
2541
- /**
2542
- * @return {?}
2543
- */
2544
- isRouteId() {
2545
- return this.parameterDef.isRouteId;
2546
- }
2547
- /**
2548
- * @param {?} visit
2549
- * @param {?} injector
2550
- * @return {?}
2551
- */
2552
- sanitise(visit, injector) {
2553
- return __awaiter(this, void 0, void 0, function* () {
2554
- /** @type {?} */
2555
- const sanitiser = this.parameterDef.getSanitiser(injector);
2556
- if (sanitiser) {
2557
- return sanitiser.sanitise(this.parameterDef, this.value, visit);
2558
- }
2559
- else {
2560
- return this.value;
2561
- }
2562
- });
2563
- }
2564
- }
2565
- ParameterSnapshot.ResolvedParameter = ResolvedParameter;
2566
- if (false) {
2567
- /** @type {?} */
2568
- ResolvedParameter.prototype.parameterDef;
2569
- /** @type {?} */
2570
- ResolvedParameter.prototype.value;
2571
- /**
2572
- * @abstract
2573
- * @param {?} dest
2574
- * @return {?}
2575
- */
2576
- ResolvedParameter.prototype.injectRouteParam = function (dest) { };
2577
- /**
2578
- * @abstract
2579
- * @param {?} otherValue
2580
- * @return {?}
2581
- */
2582
- ResolvedParameter.prototype.isSame = function (otherValue) { };
2583
- /**
2584
- * @abstract
2585
- * @return {?}
2586
- */
2587
- ResolvedParameter.prototype.formattedValue = function () { };
2588
- /**
2589
- * @abstract
2590
- * @param {?} value
2591
- * @return {?}
2592
- */
2593
- ResolvedParameter.prototype.replace = function (value) { };
2594
- }
2595
- /**
2596
- * @template T
2597
- */
2598
- class ResolvedValueParameter extends ResolvedParameter {
2599
- /**
2600
- * @param {?} otherValue
2601
- * @return {?}
2602
- */
2603
- isSame(otherValue) {
2604
- return this.value === otherValue;
2605
- }
2606
- /**
2607
- * @param {?} dest
2608
- * @return {?}
2609
- */
2610
- injectRouteParam(dest) {
2611
- dest[this.parameterDef.name] = this.parameterDef.type.format(this.value);
2612
- }
2613
- /**
2614
- * @param {?} value
2615
- * @return {?}
2616
- */
2617
- replace(value) {
2618
- return new ResolvedValueParameter(this.parameterDef, value);
2619
- }
2620
- /**
2621
- * @return {?}
2622
- */
2623
- formattedValue() {
2624
- return !___default.isNil(this.value) ? this.parameterDef.type.format(this.value) : null;
2625
- }
2626
- }
2627
- ParameterSnapshot.ResolvedValueParameter = ResolvedValueParameter;
2628
- /**
2629
- * @template T
2630
- */
2631
- class ResolvedArrayParameter extends ResolvedParameter {
2632
- /**
2633
- * @param {?} otherValue
2634
- * @return {?}
2635
- */
2636
- isSame(otherValue) {
2637
- return ___default.isEqual(this.value, otherValue);
2638
- }
2639
- /**
2640
- * @param {?} dest
2641
- * @return {?}
2642
- */
2643
- injectRouteParam(dest) {
2644
- dest[this.parameterDef.name] = this.value.map((/**
2645
- * @param {?} v
2646
- * @return {?}
2647
- */
2648
- v => this.parameterDef.type.format(v)));
2649
- }
2650
- /**
2651
- * @param {?} value
2652
- * @return {?}
2653
- */
2654
- replace(value) {
2655
- return new ResolvedArrayParameter(this.parameterDef, value);
2656
- }
2657
- /**
2658
- * @return {?}
2659
- */
2660
- formattedValue() {
2661
- return this.value ? this.value.map((/**
2662
- * @param {?} v
2663
- * @return {?}
2664
- */
2665
- v => this.parameterDef.type.format(v))) : [];
2666
- }
2667
- }
2668
- ParameterSnapshot.ResolvedArrayParameter = ResolvedArrayParameter;
2669
2720
  })(ParameterSnapshot || (ParameterSnapshot = {}));
2670
2721
 
2671
2722
  /**
@@ -2794,8 +2845,8 @@ class PlaceOutletComponent extends DisposableComponent {
2794
2845
  * @return {?}
2795
2846
  */
2796
2847
  (next, previous) => {
2797
- this.pushChangesToRoute(next, previous);
2798
2848
  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.
2849
+ this.pushChangesToRoute(next, previous);
2799
2850
  }), {
2800
2851
  unless: this.incomingRouteChange
2801
2852
  });
@@ -3581,7 +3632,7 @@ class PlaceRouteGuard {
3581
3632
  * @return {?}
3582
3633
  */
3583
3634
  sanitised => {
3584
- Logger.get(this).info("ParameterSnapshot.sanitise result", sanitised.getAllParameters());
3635
+ Logger.get(this).info("ParameterSnapshot.sanitise ->", sanitised.getAllParameters());
3585
3636
  if (sanitised.hasChanged(snapshot, true)) {
3586
3637
  return this.placeRouter.getRedirectUrlTree(activatedRoute, sanitised);
3587
3638
  }
@@ -3735,12 +3786,11 @@ function RouteParameterList(elementType, options) {
3735
3786
  function ParameterSanitiser() { }
3736
3787
  if (false) {
3737
3788
  /**
3738
- * @param {?} parameterDef
3739
- * @param {?} value
3789
+ * @param {?} paramter
3740
3790
  * @param {?=} visit
3741
3791
  * @return {?}
3742
3792
  */
3743
- ParameterSanitiser.prototype.sanitise = function (parameterDef, value, visit) { };
3793
+ ParameterSanitiser.prototype.sanitise = function (paramter, visit) { };
3744
3794
  }
3745
3795
 
3746
3796
  /**
@@ -3803,297 +3853,6 @@ var ParameterType;
3803
3853
  ParameterType.BOOLEAN = new BooleanType();
3804
3854
  })(ParameterType || (ParameterType = {}));
3805
3855
 
3806
- /**
3807
- * @fileoverview added by tsickle
3808
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
3809
- */
3810
- /**
3811
- * @template T, S
3812
- */
3813
- class Sanitiser {
3814
- /**
3815
- * @param {?} parameterDef
3816
- * @param {?} snapshot
3817
- * @param {?} sanitiser
3818
- */
3819
- constructor(parameterDef, snapshot, sanitiser) {
3820
- this.parameterDef = parameterDef;
3821
- this.snapshot = snapshot;
3822
- this.sanitiser = sanitiser;
3823
- }
3824
- /**
3825
- * @return {?}
3826
- */
3827
- isRouteId() {
3828
- return this.parameterDef.isRouteId;
3829
- }
3830
- /**
3831
- * @return {?}
3832
- */
3833
- get valueChanged() {
3834
- return !___default.isNil(this.initialValue) && this.hasChanged(this.initialValue, this.sanitisedValue);
3835
- }
3836
- /**
3837
- * @return {?}
3838
- */
3839
- get sanitisedValue() {
3840
- return this._sanitisedValue;
3841
- }
3842
- /**
3843
- * @protected
3844
- * @param {?} snapshot
3845
- * @return {?}
3846
- */
3847
- readFrom(snapshot) {
3848
- return lang.abstractMethod(this.constructor);
3849
- }
3850
- /**
3851
- * @protected
3852
- * @param {?} initialValue
3853
- * @param {?} sanitisedValue
3854
- * @return {?}
3855
- */
3856
- hasChanged(initialValue, sanitisedValue) {
3857
- return lang.abstractMethod(this.constructor);
3858
- }
3859
- /**
3860
- * @param {?} dest
3861
- * @return {?}
3862
- */
3863
- injectRouteParam(dest) {
3864
- lang.abstractMethod(this.constructor);
3865
- }
3866
- /**
3867
- * @return {?}
3868
- */
3869
- sanitize() {
3870
- return __awaiter(this, void 0, void 0, function* () {
3871
- if (this.sanitiser) {
3872
- this.initialValue = this.readFrom(this.snapshot);
3873
- this._sanitisedValue = yield this.sanitiser.sanitise(null, this.initialValue);
3874
- if (this.initialValue !== this._sanitisedValue) {
3875
- return false;
3876
- }
3877
- }
3878
- return true;
3879
- });
3880
- }
3881
- }
3882
- if (false) {
3883
- /**
3884
- * @type {?}
3885
- * @private
3886
- */
3887
- Sanitiser.prototype.initialValue;
3888
- /**
3889
- * @type {?}
3890
- * @private
3891
- */
3892
- Sanitiser.prototype._sanitisedValue;
3893
- /** @type {?} */
3894
- Sanitiser.prototype.parameterDef;
3895
- /** @type {?} */
3896
- Sanitiser.prototype.snapshot;
3897
- /** @type {?} */
3898
- Sanitiser.prototype.sanitiser;
3899
- }
3900
- class RouteParameterSanitiser {
3901
- /**
3902
- * @param {?} parameterDefs
3903
- * @param {?} snapshot
3904
- * @param {?} injector
3905
- */
3906
- constructor(parameterDefs, snapshot, injector) {
3907
- this.parameterDefs = parameterDefs;
3908
- this.snapshot = snapshot;
3909
- this.injector = injector;
3910
- this.parameterSanitisers = [];
3911
- /** @type {?} */
3912
- const sanitisers = parameterDefs.map((/**
3913
- * @param {?} def
3914
- * @return {?}
3915
- */
3916
- def => {
3917
- return def.isArray ?
3918
- new Sanitiser.Array(def, snapshot, this.getSanitiser(def)) :
3919
- new Sanitiser.Value(def, snapshot, this.getSanitiser(def));
3920
- }));
3921
- this.routeIdSanitiser = sanitisers.find((/**
3922
- * @param {?} p
3923
- * @return {?}
3924
- */
3925
- p => p.isRouteId()));
3926
- this.parameterSanitisers = sanitisers.filter((/**
3927
- * @param {?} p
3928
- * @return {?}
3929
- */
3930
- p => !p.isRouteId()));
3931
- }
3932
- /**
3933
- * @return {?}
3934
- */
3935
- sanitise() {
3936
- return __awaiter(this, void 0, void 0, function* () {
3937
- if (this.routeIdSanitiser) {
3938
- yield this.routeIdSanitiser.sanitize();
3939
- if (this.routeIdSanitiser.valueChanged) {
3940
- // if the route id isn't ok we redirect immediately as the query params may need to be sanitised in the
3941
- // context of the route id.
3942
- return false;
3943
- }
3944
- }
3945
- for (const sanitiser of this.parameterSanitisers) {
3946
- yield sanitiser.sanitize();
3947
- }
3948
- return !this.parameterSanitisers.find((/**
3949
- * @param {?} s
3950
- * @return {?}
3951
- */
3952
- s => s.valueChanged));
3953
- });
3954
- }
3955
- /**
3956
- * @private
3957
- * @template T, S
3958
- * @param {?} def
3959
- * @return {?}
3960
- */
3961
- getSanitiser(def) {
3962
- return def.getSanitiser(this.injector);
3963
- }
3964
- /**
3965
- * @return {?}
3966
- */
3967
- routeIdHasChanged() {
3968
- assert.isTruthy(this.parameterSanitisers.length !== 0);
3969
- return this.routeIdSanitiser && this.routeIdSanitiser.valueChanged;
3970
- }
3971
- // @Trace()
3972
- /**
3973
- * @return {?}
3974
- */
3975
- getRedirectParams() {
3976
- if (this.routeIdHasChanged()) {
3977
- return [this.routeIdSanitiser.sanitisedValue];
3978
- }
3979
- else {
3980
- /** @type {?} */
3981
- const routeParams = {};
3982
- this.parameterSanitisers.forEach((/**
3983
- * @param {?} s
3984
- * @return {?}
3985
- */
3986
- s => s.injectRouteParam(routeParams)));
3987
- return [routeParams];
3988
- }
3989
- }
3990
- /**
3991
- * @private
3992
- * @template S
3993
- * @param {?} value
3994
- * @return {?}
3995
- */
3996
- isSanitiserContructor(value) {
3997
- return ___default.isFunction(value) && lang.constructorChain((/** @type {?} */ ((/** @type {?} */ (value))))).includes(Sanitiser);
3998
- }
3999
- }
4000
- __decorate([
4001
- Memoize$1(),
4002
- __metadata("design:type", Function),
4003
- __metadata("design:paramtypes", [ParameterDefinition]),
4004
- __metadata("design:returntype", Object)
4005
- ], RouteParameterSanitiser.prototype, "getSanitiser", null);
4006
- if (false) {
4007
- /**
4008
- * @type {?}
4009
- * @private
4010
- */
4011
- RouteParameterSanitiser.prototype.routeIdSanitiser;
4012
- /**
4013
- * @type {?}
4014
- * @private
4015
- */
4016
- RouteParameterSanitiser.prototype.parameterSanitisers;
4017
- /** @type {?} */
4018
- RouteParameterSanitiser.prototype.parameterDefs;
4019
- /** @type {?} */
4020
- RouteParameterSanitiser.prototype.snapshot;
4021
- /** @type {?} */
4022
- RouteParameterSanitiser.prototype.injector;
4023
- }
4024
- (function (Sanitiser) {
4025
- /**
4026
- * @template T
4027
- */
4028
- class Value extends Sanitiser {
4029
- /**
4030
- * @param {?} snapshot
4031
- * @return {?}
4032
- */
4033
- readFrom(snapshot) {
4034
- /** @type {?} */
4035
- const rawValue = snapshot.paramMap.get(this.parameterDef.name);
4036
- return this.parameterDef.type.parse(rawValue);
4037
- }
4038
- /**
4039
- * @protected
4040
- * @param {?} initialValue
4041
- * @param {?} sanitisedValue
4042
- * @return {?}
4043
- */
4044
- hasChanged(initialValue, sanitisedValue) {
4045
- return initialValue !== sanitisedValue;
4046
- }
4047
- /**
4048
- * @param {?} dest
4049
- * @return {?}
4050
- */
4051
- injectRouteParam(dest) {
4052
- dest[this.parameterDef.name] = this.parameterDef.type.format(this.sanitisedValue);
4053
- }
4054
- }
4055
- Sanitiser.Value = Value;
4056
- /**
4057
- * @template T
4058
- */
4059
- class Array extends Sanitiser {
4060
- /**
4061
- * @param {?} snapshot
4062
- * @return {?}
4063
- */
4064
- readFrom(snapshot) {
4065
- /** @type {?} */
4066
- const rawValues = snapshot.paramMap.getAll(this.parameterDef.name);
4067
- return rawValues.map((/**
4068
- * @param {?} value
4069
- * @return {?}
4070
- */
4071
- value => this.parameterDef.type.parse(value)));
4072
- }
4073
- /**
4074
- * @protected
4075
- * @param {?} initialValue
4076
- * @param {?} sanitisedValue
4077
- * @return {?}
4078
- */
4079
- hasChanged(initialValue, sanitisedValue) {
4080
- return initialValue !== sanitisedValue;
4081
- }
4082
- /**
4083
- * @param {?} dest
4084
- * @return {?}
4085
- */
4086
- injectRouteParam(dest) {
4087
- dest[this.parameterDef.name] = this.sanitisedValue.map((/**
4088
- * @param {?} v
4089
- * @return {?}
4090
- */
4091
- v => this.parameterDef.type.format(v)));
4092
- }
4093
- }
4094
- Sanitiser.Array = Array;
4095
- })(Sanitiser || (Sanitiser = {}));
4096
-
4097
3856
  /**
4098
3857
  * @fileoverview added by tsickle
4099
3858
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
@@ -4114,5 +3873,5 @@ if (false) {
4114
3873
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4115
3874
  */
4116
3875
 
4117
- 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 };
3876
+ 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 };
4118
3877
  //# sourceMappingURL=coolon-angular-ui-powerups.js.map