@coolon/angular-ui-powerups 12.0.0-alpha.2 → 12.0.0-alpha.3

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.
@@ -21,7 +21,7 @@ import { MatTableModule } from '@angular/material/table';
21
21
  import { MatTooltipModule } from '@angular/material/tooltip';
22
22
  import { FontAwesomeModule, FaIconLibrary } from '@fortawesome/angular-fontawesome';
23
23
  import { fas } from '@fortawesome/free-solid-svg-icons';
24
- import { GarbageCollector, DelegatingValueModel, assert, UnaryCommand, lang, Dsl, Logger, TrackExternal, ValueModel, StoreInValueModel, Command, MutableListModel, StoreInListModel, Disposable, MutableValueModel, DelegatingListModel, FocusManager, EventListenerList, Form, Guard, Binding, DebugContext, ListModel, MultipleSelectionModel, DelegatingSelectionModel, AbstractComputedListModel, DirtyTrackingForm, ComputedListModel, PageController, Deferred, Trace, Functions } from '@coolon/pectin';
24
+ import { GarbageCollector, DelegatingValueModel, assert, UnaryCommand, lang, Dsl, Logger, TrackExternal, ValueModel, StoreInValueModel, Command, MutableListModel, StoreInListModel, Disposable, MutableValueModel, DelegatingListModel, FocusManager, EventListenerList, Form, Guard, Binding, DebugContext, ListModel, MultipleSelectionModel, DelegatingSelectionModel, AbstractComputedListModel, DirtyTrackingForm, ComputedListModel, PageController, Deferred, Functions } from '@coolon/pectin';
25
25
  import { __decorate, __metadata, __awaiter } from 'tslib';
26
26
  import { DomSanitizer } from '@angular/platform-browser';
27
27
  import * as _ from 'lodash';
@@ -35,7 +35,7 @@ import { FlexModule, GridModule } from '@angular/flex-layout';
35
35
  import * as i1$1 from '@angular/material/dialog';
36
36
  import { MatDialogModule, MatDialog, MatDialogConfig, MAT_DIALOG_DEFAULT_OPTIONS } from '@angular/material/dialog';
37
37
  import * as i1 from '@angular/router';
38
- import { RouterModule, ActivatedRouteSnapshot, NavigationStart, NavigationCancel, UrlSegment, Router, UrlSerializer, NavigationEnd, NavigationError } from '@angular/router';
38
+ import { RouterModule, ActivatedRouteSnapshot, UrlSegment, Router, UrlSerializer, NavigationStart, NavigationEnd, NavigationError, NavigationCancel } from '@angular/router';
39
39
  import { Overlay, CdkScrollable } from '@angular/cdk/overlay';
40
40
  import { MatListModule } from '@angular/material/list';
41
41
  import { Memoize as Memoize$1 } from '@typescript-plus/fast-memoize-decorator';
@@ -5291,204 +5291,6 @@ InteractionModule.decorators = [
5291
5291
  },] }
5292
5292
  ];
5293
5293
 
5294
- class PlaceHistory {
5295
- constructor() {
5296
- this._archive = new Map();
5297
- this.placeHistoryDepth = 4;
5298
- }
5299
- notifyNavigationStarted() {
5300
- if (this._activeVisits) {
5301
- this.archive(this._activeVisits.visits);
5302
- this._previousVisits = this._activeVisits;
5303
- }
5304
- }
5305
- notifyNavigationFinished(visits) {
5306
- this._activeVisits = new PlaceHistory.VisitRecord(visits);
5307
- }
5308
- updateVisit(visit) {
5309
- assert.isTruthy(this._activeVisits);
5310
- this._activeVisits.update(visit);
5311
- }
5312
- lastVisitIncluded(placeDef) {
5313
- var _a;
5314
- return !!((_a = this._previousVisits) === null || _a === void 0 ? void 0 : _a.getVisitFor(placeDef));
5315
- }
5316
- getMostRecentVisitFor(placeDef) {
5317
- return ___default.first(this.getHistory(placeDef));
5318
- }
5319
- getHistory(placeDef) {
5320
- let history = this._archive.get(placeDef);
5321
- if (!history) {
5322
- history = [];
5323
- this.setHistory(placeDef, history);
5324
- }
5325
- return history;
5326
- }
5327
- setHistory(placeDef, history) {
5328
- this._archive.set(placeDef, history);
5329
- }
5330
- archive(visits) {
5331
- visits.forEach(state => {
5332
- const history = this.getHistory(state.placeDefinition);
5333
- const previousState = ___default.first(history);
5334
- if (!previousState || state.hasChangedFrom(previousState)) {
5335
- history.unshift(state); // LIFO
5336
- this.setHistory(state.placeDefinition, history.slice(0, this.placeHistoryDepth));
5337
- }
5338
- });
5339
- }
5340
- }
5341
- PlaceHistory.ɵprov = i0.ɵɵdefineInjectable({ factory: function PlaceHistory_Factory() { return new PlaceHistory(); }, token: PlaceHistory, providedIn: "root" });
5342
- PlaceHistory.decorators = [
5343
- { type: Injectable, args: [{
5344
- providedIn: 'root'
5345
- },] }
5346
- ];
5347
- PlaceHistory.ctorParameters = () => [];
5348
- (function (PlaceHistory) {
5349
- class VisitRecord {
5350
- constructor(visits) {
5351
- this.visits = visits;
5352
- }
5353
- update(visit) {
5354
- this.visits = this.visits.filter(v => v.placeDefinition !== visit.placeDefinition).concat(visit);
5355
- }
5356
- getVisitFor(placeDef) {
5357
- return this.visits.find(v => v.placeDefinition === placeDef);
5358
- }
5359
- }
5360
- PlaceHistory.VisitRecord = VisitRecord;
5361
- // export class Query {
5362
- // private _history: Visit.State[];
5363
- // private _places: Place[];
5364
- // private _predicate: (visit: any) => boolean;
5365
- // private _limit: number;
5366
- //
5367
- // constructor(history, limit = history.length) {
5368
- // this._history = history;
5369
- // this._places = [];
5370
- // this._predicate = (visit => true);
5371
- // this._limit = limit;
5372
- // }
5373
- //
5374
- // to(...places:Place[]):this {
5375
- // this._places = places;
5376
- // return this;
5377
- // }
5378
- //
5379
- // with(parameters: { [parameter: string]: any }): this {
5380
- // this.matching(state => {
5381
- // return Object.keys(parameters).reduce((acc, key) => {
5382
- // const matchValue = parameters[key];
5383
- // const visitValue = state.get(key);
5384
- // const matched = matchValue === '*' ? !_.isNil(visitValue) : visitValue == matchValue;
5385
- // // Logger.get(this).info(`matched=${matched}`, parameters, visitValue);
5386
- // return acc && matched;
5387
- // }, true);
5388
- // });
5389
- // return this;
5390
- // }
5391
- //
5392
- // last(): Visit.State {
5393
- // return _.findLast(this._history, visit => this._matches(visit))
5394
- // }
5395
- //
5396
- // // @trace
5397
- // allThatMatch(): Visit.State[] {
5398
- // return _.filter(this._history, visit => this._matches(visit)).slice(-this._limit);
5399
- // }
5400
- //
5401
- // // @trace
5402
- // mostRecentValueOf<T=any>(param: string, defaultValue: T = null): T {
5403
- // const lastStateWithParam = _.findLast(this.allThatMatch(), state => !_.isNil(state.get(param)));
5404
- // return _.isNil(lastStateWithParam) ? defaultValue : lastStateWithParam.get(param);
5405
- // }
5406
- //
5407
- // limit(limit: number): this {
5408
- // this._limit = limit;
5409
- // return this;
5410
- // }
5411
- //
5412
- // matching(predicate: (visit: Visit.State) => boolean): this {
5413
- // this._predicate = predicate;
5414
- // return this;
5415
- // }
5416
- //
5417
- // _matches(visit: Visit.State) {
5418
- // return this._isPlaceMatch(visit) && this._predicate(visit);
5419
- // }
5420
- //
5421
- // _isPlaceMatch(visit: Visit.State) {
5422
- // return this._places.length < 1 || this._places.includes(visit.place)
5423
- // }
5424
- //
5425
- // }
5426
- })(PlaceHistory || (PlaceHistory = {}));
5427
-
5428
- class Visit {
5429
- constructor(placeDefinition, visitParameters = {}) {
5430
- this.placeDefinition = placeDefinition;
5431
- this.visitParameters = visitParameters;
5432
- }
5433
- // @Trace()
5434
- getRouteId() {
5435
- return this.placeDefinition.getRouteIdFrom(this);
5436
- }
5437
- // @Trace()
5438
- hasRouteId() {
5439
- return !_.isNil(this.getRouteId());
5440
- }
5441
- /**
5442
- * Returns the value of the place parameter with the specified name. The parameter
5443
- * name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the
5444
- * same as the the ValueModel property name.
5445
- * @param parameterName the field name of the property model or the `as` option if specified.
5446
- */
5447
- getParameter(parameterName) {
5448
- return this.visitParameters[parameterName];
5449
- }
5450
- // @Trace()
5451
- hasParameter(parameterName) {
5452
- return Object.keys(this.visitParameters).includes(parameterName);
5453
- }
5454
- replace(parameter, value) {
5455
- return new Visit(this.placeDefinition, Object.assign(Object.assign({}, this.visitParameters), { [parameter.name]: value }));
5456
- }
5457
- mergeRouteParameters(routeParams) {
5458
- // todo: whitelist parameters.
5459
- const routeParameterKeys = Object.keys(routeParams);
5460
- const params = {};
5461
- this.placeDefinition.getVisitParameterDefs().forEach(def => {
5462
- if (def.isRouteId || def.isRouteParameter) {
5463
- if (routeParameterKeys.includes(def.name)) {
5464
- params[def.name] = routeParams[def.name];
5465
- }
5466
- }
5467
- else {
5468
- // copy non route params as is, but only if they already exist otherwise we'll inject nil values and break the
5469
- // defaults and remember sanitisation process.
5470
- const value = this.getParameter(def.name);
5471
- if (this.hasParameter(def.name)) {
5472
- params[def.name] = value;
5473
- }
5474
- }
5475
- });
5476
- return new Visit(this.placeDefinition, params);
5477
- }
5478
- hasRoutingChangedFrom(other) {
5479
- const samePlace = other.placeDefinition === this.placeDefinition;
5480
- const sameRouteParameters = _.isEqual(this.placeDefinition.getFormattedRouteParameters(this, true), this.placeDefinition.getFormattedRouteParameters(other, true));
5481
- return !samePlace || !sameRouteParameters;
5482
- }
5483
- hasChangedFrom(other) {
5484
- const sameNonRouteParameters = _.isEqual(this.placeDefinition.getNonRouteParameters(this), this.placeDefinition.getNonRouteParameters(other));
5485
- return !sameNonRouteParameters || this.hasRoutingChangedFrom(other);
5486
- }
5487
- toDebugString() {
5488
- return Object.keys(this.visitParameters).map(k => `${k}=${this.visitParameters[k]}`).join(',');
5489
- }
5490
- }
5491
-
5492
5294
  class ParameterDefinition {
5493
5295
  constructor(propertyName, options, urlFormat) {
5494
5296
  this.propertyName = propertyName;
@@ -5507,6 +5309,7 @@ class ParameterDefinition {
5507
5309
  getOptionValue(key) {
5508
5310
  return this.options.getOptional(key, null);
5509
5311
  }
5312
+ // @Trace()
5510
5313
  sanitise(value, visit, placeHistory, injector, isPopState) {
5511
5314
  return __awaiter(this, void 0, void 0, function* () {
5512
5315
  if (this.isMissingFrom(visit)) {
@@ -5527,12 +5330,6 @@ class ParameterDefinition {
5527
5330
  return !visit.hasParameter(this.name);
5528
5331
  }
5529
5332
  }
5530
- __decorate([
5531
- Trace(),
5532
- __metadata("design:type", Function),
5533
- __metadata("design:paramtypes", [Object, Visit, PlaceHistory, Injector, Boolean]),
5534
- __metadata("design:returntype", Promise)
5535
- ], ParameterDefinition.prototype, "sanitise", null);
5536
5333
  (function (ParameterDefinition) {
5537
5334
  class RouteId extends ParameterDefinition {
5538
5335
  constructor() {
@@ -5730,6 +5527,7 @@ class PlaceComponent extends DisposableComponent {
5730
5527
  when(this._active).becomesTruthy(() => this.onPlaceReady());
5731
5528
  this.childPlaces = this.placeDefinition.children.map(d => d.component);
5732
5529
  }
5530
+ // @Trace()
5733
5531
  initialiseVisit(visit, notifyVisitChanged) {
5734
5532
  assert.isNil(this.visitModel.value);
5735
5533
  const { when } = Dsl.disposeWith(this);
@@ -5750,17 +5548,18 @@ class PlaceComponent extends DisposableComponent {
5750
5548
  isInitialised() {
5751
5549
  return !!this.visitModel.value;
5752
5550
  }
5551
+ // @Trace()
5753
5552
  installBinding(parameterDef) {
5754
5553
  const model = this[parameterDef.propertyName];
5755
5554
  DebugContext.tag(model, `${this.placeDefinition.component.name}.${parameterDef.propertyName}`);
5756
5555
  const binding = this.registerDisposable(new Binding(this.visitModel, model, {
5757
5556
  toRight(visit) {
5758
5557
  const value = visit.getParameter(parameterDef.name);
5759
- console.log('push to component', { name: parameterDef.name, value, visit });
5558
+ // console.log('push to component', { name: parameterDef.name, value, visit });
5760
5559
  return value;
5761
5560
  },
5762
5561
  toLeft(value, currentVisit) {
5763
- console.log('push to route', { name: parameterDef.name, value, currentVisit });
5562
+ // console.log('push to route', { name: parameterDef.name, value, currentVisit });
5764
5563
  return currentVisit.replace(parameterDef, value);
5765
5564
  }
5766
5565
  }));
@@ -5785,18 +5584,6 @@ PlaceComponent.decorators = [
5785
5584
  { type: Directive }
5786
5585
  ];
5787
5586
  PlaceComponent.ctorParameters = () => [];
5788
- __decorate([
5789
- Trace(),
5790
- __metadata("design:type", Function),
5791
- __metadata("design:paramtypes", [Visit, Function]),
5792
- __metadata("design:returntype", void 0)
5793
- ], PlaceComponent.prototype, "initialiseVisit", null);
5794
- __decorate([
5795
- Trace(),
5796
- __metadata("design:type", Function),
5797
- __metadata("design:paramtypes", [ParameterDefinition]),
5798
- __metadata("design:returntype", void 0)
5799
- ], PlaceComponent.prototype, "installBinding", null);
5800
5587
  __decorate([
5801
5588
  Memoize$1(),
5802
5589
  __metadata("design:type", PlaceDefinition),
@@ -6340,9 +6127,11 @@ class WaitUntilLinkTriggeredNavigationInteractionCancellationTypeDetermined exte
6340
6127
  this.clickedLinkMatchedBackButtonUrl = false;
6341
6128
  this.debugPropertyKeys = ['idle', 'startingUrl', 'clickedLinkUrl', 'firstCancelEventUrl', 'clickedLinkMatchedBackButtonUrl', 'popStateEventUrl'];
6342
6129
  }
6130
+ // @Trace()
6343
6131
  onRouterStarted(event) {
6344
6132
  this.ignore(event);
6345
6133
  }
6134
+ // @Trace()
6346
6135
  onRouterCancelled(event) {
6347
6136
  if (event.url === this.clickedLinkUrl) {
6348
6137
  this.context.transitionTo(new WaitForLinkSameAsBackToPlayOut(this.context, this.startingUrl, this.clickedLinkUrl));
@@ -6357,18 +6146,6 @@ class WaitUntilLinkTriggeredNavigationInteractionCancellationTypeDetermined exte
6357
6146
  });
6358
6147
  }
6359
6148
  }
6360
- __decorate([
6361
- Trace(),
6362
- __metadata("design:type", Function),
6363
- __metadata("design:paramtypes", [NavigationStart]),
6364
- __metadata("design:returntype", void 0)
6365
- ], WaitUntilLinkTriggeredNavigationInteractionCancellationTypeDetermined.prototype, "onRouterStarted", null);
6366
- __decorate([
6367
- Trace(),
6368
- __metadata("design:type", Function),
6369
- __metadata("design:paramtypes", [NavigationCancel]),
6370
- __metadata("design:returntype", void 0)
6371
- ], WaitUntilLinkTriggeredNavigationInteractionCancellationTypeDetermined.prototype, "onRouterCancelled", null);
6372
6149
  class WaitForLinkSameAsBackToPlayOut extends EventCleanUpSession {
6373
6150
  constructor(context, startingUrl, clickedLinkUrl) {
6374
6151
  super(context, startingUrl);
@@ -6615,6 +6392,140 @@ var PlaceAccessGuard;
6615
6392
  PlaceAccessGuard.NoAuth = NoAuth;
6616
6393
  })(PlaceAccessGuard || (PlaceAccessGuard = {}));
6617
6394
 
6395
+ class PlaceHistory {
6396
+ constructor() {
6397
+ this._archive = new Map();
6398
+ this.placeHistoryDepth = 4;
6399
+ }
6400
+ notifyNavigationStarted() {
6401
+ if (this._activeVisits) {
6402
+ this.archive(this._activeVisits.visits);
6403
+ this._previousVisits = this._activeVisits;
6404
+ }
6405
+ }
6406
+ notifyNavigationFinished(visits) {
6407
+ this._activeVisits = new PlaceHistory.VisitRecord(visits);
6408
+ }
6409
+ updateVisit(visit) {
6410
+ assert.isTruthy(this._activeVisits);
6411
+ this._activeVisits.update(visit);
6412
+ }
6413
+ lastVisitIncluded(placeDef) {
6414
+ var _a;
6415
+ return !!((_a = this._previousVisits) === null || _a === void 0 ? void 0 : _a.getVisitFor(placeDef));
6416
+ }
6417
+ getMostRecentVisitFor(placeDef) {
6418
+ return ___default.first(this.getHistory(placeDef));
6419
+ }
6420
+ getHistory(placeDef) {
6421
+ let history = this._archive.get(placeDef);
6422
+ if (!history) {
6423
+ history = [];
6424
+ this.setHistory(placeDef, history);
6425
+ }
6426
+ return history;
6427
+ }
6428
+ setHistory(placeDef, history) {
6429
+ this._archive.set(placeDef, history);
6430
+ }
6431
+ archive(visits) {
6432
+ visits.forEach(state => {
6433
+ const history = this.getHistory(state.placeDefinition);
6434
+ const previousState = ___default.first(history);
6435
+ if (!previousState || state.hasChangedFrom(previousState)) {
6436
+ history.unshift(state); // LIFO
6437
+ this.setHistory(state.placeDefinition, history.slice(0, this.placeHistoryDepth));
6438
+ }
6439
+ });
6440
+ }
6441
+ }
6442
+ PlaceHistory.ɵprov = i0.ɵɵdefineInjectable({ factory: function PlaceHistory_Factory() { return new PlaceHistory(); }, token: PlaceHistory, providedIn: "root" });
6443
+ PlaceHistory.decorators = [
6444
+ { type: Injectable, args: [{
6445
+ providedIn: 'root'
6446
+ },] }
6447
+ ];
6448
+ PlaceHistory.ctorParameters = () => [];
6449
+ (function (PlaceHistory) {
6450
+ class VisitRecord {
6451
+ constructor(visits) {
6452
+ this.visits = visits;
6453
+ }
6454
+ update(visit) {
6455
+ this.visits = this.visits.filter(v => v.placeDefinition !== visit.placeDefinition).concat(visit);
6456
+ }
6457
+ getVisitFor(placeDef) {
6458
+ return this.visits.find(v => v.placeDefinition === placeDef);
6459
+ }
6460
+ }
6461
+ PlaceHistory.VisitRecord = VisitRecord;
6462
+ // export class Query {
6463
+ // private _history: Visit.State[];
6464
+ // private _places: Place[];
6465
+ // private _predicate: (visit: any) => boolean;
6466
+ // private _limit: number;
6467
+ //
6468
+ // constructor(history, limit = history.length) {
6469
+ // this._history = history;
6470
+ // this._places = [];
6471
+ // this._predicate = (visit => true);
6472
+ // this._limit = limit;
6473
+ // }
6474
+ //
6475
+ // to(...places:Place[]):this {
6476
+ // this._places = places;
6477
+ // return this;
6478
+ // }
6479
+ //
6480
+ // with(parameters: { [parameter: string]: any }): this {
6481
+ // this.matching(state => {
6482
+ // return Object.keys(parameters).reduce((acc, key) => {
6483
+ // const matchValue = parameters[key];
6484
+ // const visitValue = state.get(key);
6485
+ // const matched = matchValue === '*' ? !_.isNil(visitValue) : visitValue == matchValue;
6486
+ // // Logger.get(this).info(`matched=${matched}`, parameters, visitValue);
6487
+ // return acc && matched;
6488
+ // }, true);
6489
+ // });
6490
+ // return this;
6491
+ // }
6492
+ //
6493
+ // last(): Visit.State {
6494
+ // return _.findLast(this._history, visit => this._matches(visit))
6495
+ // }
6496
+ //
6497
+ // // @trace
6498
+ // allThatMatch(): Visit.State[] {
6499
+ // return _.filter(this._history, visit => this._matches(visit)).slice(-this._limit);
6500
+ // }
6501
+ //
6502
+ // // @trace
6503
+ // mostRecentValueOf<T=any>(param: string, defaultValue: T = null): T {
6504
+ // const lastStateWithParam = _.findLast(this.allThatMatch(), state => !_.isNil(state.get(param)));
6505
+ // return _.isNil(lastStateWithParam) ? defaultValue : lastStateWithParam.get(param);
6506
+ // }
6507
+ //
6508
+ // limit(limit: number): this {
6509
+ // this._limit = limit;
6510
+ // return this;
6511
+ // }
6512
+ //
6513
+ // matching(predicate: (visit: Visit.State) => boolean): this {
6514
+ // this._predicate = predicate;
6515
+ // return this;
6516
+ // }
6517
+ //
6518
+ // _matches(visit: Visit.State) {
6519
+ // return this._isPlaceMatch(visit) && this._predicate(visit);
6520
+ // }
6521
+ //
6522
+ // _isPlaceMatch(visit: Visit.State) {
6523
+ // return this._places.length < 1 || this._places.includes(visit.place)
6524
+ // }
6525
+ //
6526
+ // }
6527
+ })(PlaceHistory || (PlaceHistory = {}));
6528
+
6618
6529
  class UrlSnapshot {
6619
6530
  // TODO: Update this accept a url Parser so it can be immutable and generate new trees on mutation using toString() are parseUrl.
6620
6531
  constructor(urlSerializer, url) {
@@ -7087,6 +6998,70 @@ PlaceRouter.ctorParameters = () => [
7087
6998
  PlaceRouter.State = State;
7088
6999
  })(PlaceRouter || (PlaceRouter = {}));
7089
7000
 
7001
+ class Visit {
7002
+ constructor(placeDefinition, visitParameters = {}) {
7003
+ this.placeDefinition = placeDefinition;
7004
+ this.visitParameters = visitParameters;
7005
+ }
7006
+ // @Trace()
7007
+ getRouteId() {
7008
+ return this.placeDefinition.getRouteIdFrom(this);
7009
+ }
7010
+ // @Trace()
7011
+ hasRouteId() {
7012
+ return !_.isNil(this.getRouteId());
7013
+ }
7014
+ /**
7015
+ * Returns the value of the place parameter with the specified name. The parameter
7016
+ * name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the
7017
+ * same as the the ValueModel property name.
7018
+ * @param parameterName the field name of the property model or the `as` option if specified.
7019
+ */
7020
+ getParameter(parameterName) {
7021
+ return this.visitParameters[parameterName];
7022
+ }
7023
+ // @Trace()
7024
+ hasParameter(parameterName) {
7025
+ return Object.keys(this.visitParameters).includes(parameterName);
7026
+ }
7027
+ replace(parameter, value) {
7028
+ return new Visit(this.placeDefinition, Object.assign(Object.assign({}, this.visitParameters), { [parameter.name]: value }));
7029
+ }
7030
+ mergeRouteParameters(routeParams) {
7031
+ // todo: whitelist parameters.
7032
+ const routeParameterKeys = Object.keys(routeParams);
7033
+ const params = {};
7034
+ this.placeDefinition.getVisitParameterDefs().forEach(def => {
7035
+ if (def.isRouteId || def.isRouteParameter) {
7036
+ if (routeParameterKeys.includes(def.name)) {
7037
+ params[def.name] = routeParams[def.name];
7038
+ }
7039
+ }
7040
+ else {
7041
+ // copy non route params as is, but only if they already exist otherwise we'll inject nil values and break the
7042
+ // defaults and remember sanitisation process.
7043
+ const value = this.getParameter(def.name);
7044
+ if (this.hasParameter(def.name)) {
7045
+ params[def.name] = value;
7046
+ }
7047
+ }
7048
+ });
7049
+ return new Visit(this.placeDefinition, params);
7050
+ }
7051
+ hasRoutingChangedFrom(other) {
7052
+ const samePlace = other.placeDefinition === this.placeDefinition;
7053
+ const sameRouteParameters = _.isEqual(this.placeDefinition.getFormattedRouteParameters(this, true), this.placeDefinition.getFormattedRouteParameters(other, true));
7054
+ return !samePlace || !sameRouteParameters;
7055
+ }
7056
+ hasChangedFrom(other) {
7057
+ const sameNonRouteParameters = _.isEqual(this.placeDefinition.getNonRouteParameters(this), this.placeDefinition.getNonRouteParameters(other));
7058
+ return !sameNonRouteParameters || this.hasRoutingChangedFrom(other);
7059
+ }
7060
+ toDebugString() {
7061
+ return Object.keys(this.visitParameters).map(k => `${k}=${this.visitParameters[k]}`).join(',');
7062
+ }
7063
+ }
7064
+
7090
7065
  const AUP_PLACE_CONFIG = new InjectionToken('AUP_PLACE_CONFIG');
7091
7066
 
7092
7067
  class NotAuthorisedNoticeComponent {