@coolon/angular-ui-powerups 0.0.128 → 0.0.130

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 (24) hide show
  1. package/bundles/coolon-angular-ui-powerups.umd.js +14 -12
  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/lib/components/components.module.ngfactory.js.map +1 -1
  7. package/esm2015/lib/components/forms/select-input/select-input.component.js +11 -2
  8. package/esm2015/lib/components/forms/select-input/select-input.component.js.map +1 -1
  9. package/esm2015/lib/components/forms/select-input/select-input.component.metadata.json +1 -1
  10. package/esm2015/lib/place/place-router.js +4 -11
  11. package/esm2015/lib/place/place-router.js.map +1 -1
  12. package/esm2015/lib/place/place-router.metadata.json +1 -1
  13. package/esm5/lib/components/components.module.ngfactory.js.map +1 -1
  14. package/esm5/lib/components/forms/select-input/select-input.component.js +11 -2
  15. package/esm5/lib/components/forms/select-input/select-input.component.js.map +1 -1
  16. package/esm5/lib/place/place-router.js +4 -11
  17. package/esm5/lib/place/place-router.js.map +1 -1
  18. package/fesm2015/coolon-angular-ui-powerups.js +15 -13
  19. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  20. package/fesm5/coolon-angular-ui-powerups.js +15 -13
  21. package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
  22. package/lib/components/forms/select-input/select-input.component.d.ts +4 -1
  23. package/lib/place/place-router.d.ts +1 -1
  24. package/package.json +1 -1
@@ -3,7 +3,7 @@
3
3
  * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4
4
  */
5
5
  import * as tslib_1 from "tslib";
6
- import { Component, Input } from '@angular/core';
6
+ import { Component, ContentChild, Input, TemplateRef } from '@angular/core';
7
7
  import { ListModel, StoreInListModel, UseDelegate } from '@coolon/pectin';
8
8
  import { AbstractInputComponent } from '../abstract-input.component';
9
9
  /**
@@ -31,7 +31,7 @@ var SelectInputComponent = /** @class */ (function (_super) {
31
31
  SelectInputComponent.decorators = [
32
32
  { type: Component, args: [{
33
33
  selector: 'aup-select-input',
34
- template: "<mat-form-field appearance=\"standard\" [floatLabel]=\"floatLabel\">\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\n <mat-select placeholder=\"{{placeholder}}\"\n [(ngModel)]=\"valueModel.value\"\n [disabled]=\"!enabled.value\"\n (keydown.enter)=\"notifyEnterKey()\"\n (keydown.escape)=\"notifyEscapeKey()\"\n [pectinFocusBinding]=\"valueModel\"\n [errorStateMatcher]=\"errorStateMatcher\"\n >\n <mat-option *ngFor=\"let option of optionsModel.value\" [value]=\"option\">{{optionLabelFormat(option)}}\n </mat-option>\n </mat-select>\n <mat-hint *ngIf=\"hint\">{{hint}}</mat-hint>\n <mat-error *ngIf=\"hasErrors\">{{firstError}}</mat-error>\n</mat-form-field>\n",
34
+ template: "<mat-form-field appearance=\"standard\" [floatLabel]=\"floatLabel\">\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\n <mat-select placeholder=\"{{placeholder}}\"\n [(ngModel)]=\"valueModel.value\"\n [disabled]=\"!enabled.value\"\n (keydown.enter)=\"notifyEnterKey()\"\n (keydown.escape)=\"notifyEscapeKey()\"\n [pectinFocusBinding]=\"valueModel\"\n [errorStateMatcher]=\"errorStateMatcher\"\n >\n <mat-option *ngIf=\"allowNil\">{{placeholder}}</mat-option>\n <mat-option *ngFor=\"let option of optionsModel.value; let i = index\" [value]=\"option\">\n <ng-container *ngIf=\"!optionTemplateRef\">{{optionLabelFormat(option)}}</ng-container>\n <ng-container *ngIf=\"optionTemplateRef\"\n [ngTemplateOutlet]=\"optionTemplateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: option, index: i }\"\n >\n </ng-container>\n </mat-option>\n </mat-select>\n <mat-hint *ngIf=\"hint\">{{hint}}</mat-hint>\n <mat-error *ngIf=\"hasErrors\">{{firstError}}</mat-error>\n</mat-form-field>\n",
35
35
  styles: [":host{display:inline-block}mat-form-field{width:100%}"]
36
36
  }] }
37
37
  ];
@@ -41,6 +41,9 @@ var SelectInputComponent = /** @class */ (function (_super) {
41
41
  optionsModel: [{ type: Input }],
42
42
  options: [{ type: Input }],
43
43
  optionLabel: [{ type: Input }],
44
+ allowNil: [{ type: Input }],
45
+ optionTemplateRef: [{ type: ContentChild, args: ["optionTemplate", { static: false },] }],
46
+ nilOptionTemplateRef: [{ type: ContentChild, args: ["nilOptionTemplate", { static: false },] }],
44
47
  optionLabelFormat: [{ type: Input }]
45
48
  };
46
49
  tslib_1.__decorate([
@@ -62,6 +65,12 @@ if (false) {
62
65
  /** @type {?} */
63
66
  SelectInputComponent.prototype.optionLabel;
64
67
  /** @type {?} */
68
+ SelectInputComponent.prototype.allowNil;
69
+ /** @type {?} */
70
+ SelectInputComponent.prototype.optionTemplateRef;
71
+ /** @type {?} */
72
+ SelectInputComponent.prototype.nilOptionTemplateRef;
73
+ /** @type {?} */
65
74
  SelectInputComponent.prototype.optionLabelFormat;
66
75
  }
67
76
  //# sourceMappingURL=select-input.component.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"select-input.component.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/forms/select-input/select-input.component.ts"],"names":[],"mappings":";;;;;AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAU,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;;;;AAErE;IAKmD,gDAAyB;IAc1E;QAAA,YACE,iBAAO,SACR;QAJD,uBAAiB;;;;QAAuB,UAAC,MAAM,IAAK,OAAA,CAAC,MAAM,IAAI,KAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,MAAM,EAAhE,CAAgE,EAAC;;IAIrH,CAAC;;;;IAED,uCAAQ;;;IAAR;IACA,CAAC;;gBAxBF,SAAS,SAAC;oBACT,QAAQ,EAAE,kBAAkB;oBAC5B,+vBAA4C;;iBAE7C;;;;;+BAGE,KAAK;0BAGL,KAAK;8BAGL,KAAK;oCAGL,KAAK;;IARN;QADU,WAAW,EAAE;0CACT,SAAS;8DAAI;IAG3B;QADU,gBAAgB,CAAC,cAAc,CAAC;;yDAC7B;IAef,2BAAC;CAAA,AA1BD,CAKmD,sBAAsB,GAqBxE;SArBY,oBAAoB;;;IAE/B,4CAC2B;;IAE3B,uCACa;;IAEb,2CACqB;;IAErB,iDACqH","sourcesContent":["import { Component, Input, OnInit } from '@angular/core';\nimport { ListModel, StoreInListModel, UseDelegate } from '@coolon/pectin';\nimport { AbstractInputComponent } from '../abstract-input.component';\n\n@Component({\n selector: 'aup-select-input',\n templateUrl: './select-input.component.html',\n styleUrls: ['./select-input.component.scss']\n})\nexport class SelectInputComponent<T = any> extends AbstractInputComponent<T> implements OnInit {\n\n @Input() @UseDelegate()\n optionsModel: ListModel<T>;\n\n @Input() @StoreInListModel('optionsModel')\n options: T[];\n\n @Input()\n optionLabel: keyof T;\n\n @Input()\n optionLabelFormat: (option: T) => any = (option) => (option && this.optionLabel) ? option[this.optionLabel] : option;\n\n constructor() {\n super();\n }\n\n ngOnInit() {\n }\n\n}\n"]}
1
+ {"version":3,"file":"select-input.component.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/components/forms/select-input/select-input.component.ts"],"names":[],"mappings":";;;;;AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAU,WAAW,EAAE,MAAM,eAAe,CAAC;AACpF,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;;;;AAErE;IAKmD,gDAAyB;IAuB1E;QAAA,YACE,iBAAO,SACR;QAJD,uBAAiB;;;;QAAuB,UAAC,MAAM,IAAK,OAAA,CAAC,MAAM,IAAI,KAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,MAAM,EAAhE,CAAgE,EAAC;;IAIrH,CAAC;;;;IAED,uCAAQ;;;IAAR;IACA,CAAC;;gBAjCF,SAAS,SAAC;oBACT,QAAQ,EAAE,kBAAkB;oBAC5B,2lCAA4C;;iBAE7C;;;;;+BAGE,KAAK;0BAGL,KAAK;8BAGL,KAAK;2BAGL,KAAK;oCAGL,YAAY,SAAC,gBAAgB,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;uCAGhD,YAAY,SAAC,mBAAmB,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;oCAGnD,KAAK;;IAjBN;QADU,WAAW,EAAE;0CACT,SAAS;8DAAI;IAG3B;QADU,gBAAgB,CAAC,cAAc,CAAC;;yDAC7B;IAwBf,2BAAC;CAAA,AAnCD,CAKmD,sBAAsB,GA8BxE;SA9BY,oBAAoB;;;IAE/B,4CAC2B;;IAE3B,uCACa;;IAEb,2CACqB;;IAErB,wCACkB;;IAElB,iDACoC;;IAEpC,oDACuC;;IAEvC,iDACqH","sourcesContent":["import { Component, ContentChild, Input, OnInit, TemplateRef } from '@angular/core';\nimport { ListModel, StoreInListModel, UseDelegate } from '@coolon/pectin';\nimport { AbstractInputComponent } from '../abstract-input.component';\n\n@Component({\n selector: 'aup-select-input',\n templateUrl: './select-input.component.html',\n styleUrls: ['./select-input.component.scss']\n})\nexport class SelectInputComponent<T = any> extends AbstractInputComponent<T> implements OnInit {\n\n @Input() @UseDelegate()\n optionsModel: ListModel<T>;\n\n @Input() @StoreInListModel('optionsModel')\n options: T[];\n\n @Input()\n optionLabel: keyof T;\n\n @Input()\n allowNil: boolean;\n\n @ContentChild(\"optionTemplate\", { static: false })\n optionTemplateRef: TemplateRef<any>;\n\n @ContentChild(\"nilOptionTemplate\", { static: false })\n nilOptionTemplateRef: TemplateRef<any>;\n\n @Input()\n optionLabelFormat: (option: T) => any = (option) => (option && this.optionLabel) ? option[this.optionLabel] : option;\n\n constructor() {\n super();\n }\n\n ngOnInit() {\n }\n\n}\n"]}
@@ -484,7 +484,7 @@ var PlaceRouter = /** @class */ (function (_super) {
484
484
  * @param {?} func
485
485
  * @return {?}
486
486
  */
487
- PlaceRouter.prototype.runAfterCurrentRoutingSession = /**
487
+ PlaceRouter.prototype.runAfterRoutingSessionFinishes = /**
488
488
  * @private
489
489
  * @param {?} func
490
490
  * @return {?}
@@ -525,17 +525,13 @@ var PlaceRouter = /** @class */ (function (_super) {
525
525
  * @return {?}
526
526
  */
527
527
  function (resolve, reject) {
528
- _this.runAfterCurrentRoutingSession((/**
528
+ _this.runAfterRoutingSessionFinishes((/**
529
529
  * @return {?}
530
530
  */
531
531
  function () {
532
- // console.log(`Starting delayed sync job`);
532
+ _this.runAfterRoutingSessionFinishes(resolve);
533
533
  /** @type {?} */
534
534
  var syncSession = new SynchroniseInteractionContextIdsWithRoute(_this.navigationContext, _this.urlService.getCurrentRouterUrl(), false);
535
- syncSession.onDispose((/**
536
- * @return {?}
537
- */
538
- function () { return resolve(); }));
539
535
  _this.transitionTo(syncSession);
540
536
  }));
541
537
  }));
@@ -548,12 +544,9 @@ var PlaceRouter = /** @class */ (function (_super) {
548
544
  */
549
545
  function (resolve, reject) {
550
546
  // console.log(`No navigation in progress, starting synchronisation job`);
547
+ _this.runAfterRoutingSessionFinishes(resolve);
551
548
  /** @type {?} */
552
549
  var session = new SynchroniseInteractionContextIdsWithRoute(_this.navigationContext, _this.urlService.getCurrentRouterUrl(), false);
553
- session.onDispose((/**
554
- * @return {?}
555
- */
556
- function () { return resolve(); }));
557
550
  _this.transitionTo(session);
558
551
  })));
559
552
  }
@@ -1 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","sourcesContent":["import { Location } from '@angular/common';\nimport { DEBUG } from '@angular/compiler-cli/ngcc/src/logging/console_logger';\nimport { Injectable } from '@angular/core';\nimport {\n ActivatedRoute,\n NavigationCancel,\n NavigationEnd,\n NavigationError,\n NavigationExtras,\n NavigationStart,\n Router\n} from '@angular/router';\nimport {\n assert, DebugContext,\n Dsl,\n GarbageCollector,\n HasOneIndexChain,\n lang,\n ListModel,\n Logger,\n MutableListModel,\n MutableValueModel,\n Trace, TransactionObserver,\n ValueModelChain\n} from '@coolon/pectin';\nimport { InteractionService } from '../interaction/services/interaction.service';\nimport { InteractionServiceRoutingAdapter } from '../interaction/services/interaction-service-routing-adapter';\nimport { NavigatingDuringInteraction } from './navigation/session/interactions/navigating-during-interaction';\nimport { PopStateDuringInteractionNavigation } from './navigation/session/interactions/pop-state-during-interaction-navigation';\nimport { SynchroniseInteractionContextIdsWithRoute } from './navigation/session/interactions/synchronise-interaction-context-ids-with-route';\nimport { Navigating } from './navigation/session/navigating';\nimport { NavigationContext } from './navigation/session/navigation-context';\nimport { NavigationSession } from './navigation/session/navigation-session';\nimport { PopStateNavigation } from './navigation/session/pop-state-navigation';\nimport { PlaceHistory } from './place-history';\nimport { UrlService } from './url-service';\nimport { UrlSnapshot } from './url-snapshot';\nimport { Visit } from './visit';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class PlaceRouter extends GarbageCollector {\n\n readonly navigationSessionModel = new MutableValueModel<NavigationSession>();\n readonly navigationInProgress: ValueModelChain<boolean>;\n readonly navigationSessionName: ValueModelChain<string>; // used by tests\n\n private readonly navigationContext: NavigationContext.Impl;\n\n private readonly _activeVisits = new MutableListModel<Visit>();\n readonly activeVisitsByPlaceDefinition: HasOneIndexChain<'placeDefinition', Visit>;\n private routerInteractionAdapter: InteractionServiceRoutingAdapter;\n private sessionFinishedJobs: (() => void)[] = [];\n\n constructor(private readonly angularRouter: Router,\n private readonly angularLocation: Location,\n private readonly interactionService: InteractionService,\n private readonly urlService: UrlService,\n private readonly placeHistory: PlaceHistory) {\n super();\n\n this.routerInteractionAdapter = interactionService.registerPlaceRouter(this);\n\n // TODO: Make this an interface and use 'this' instead.\n this.navigationContext = new NavigationContext.Impl(\n this.urlService,\n this.routerInteractionAdapter,\n (urlSnapshot: UrlSnapshot, options: { replaceUrl: boolean }) => {\n return this.navigateByUrl(urlSnapshot, options);\n },\n state => {\n this.transitionTo(state);\n },\n visits => {\n this.routingSessionFinished(visits);\n });\n\n const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);\n this.navigationInProgress = chain(this.navigationSessionModel).isNotNil();\n\n const idleStateName = chain(this.interactionService.active).map(active => active ? 'IdleDuringInteraction' : 'Idle');\n this.navigationSessionName = chain(this.navigationSessionModel)\n .pluck('name')\n .otherwise(idleStateName);\n\n DebugContext.tag(this._activeVisits, \"PlaceRouter.activeVisits\");\n this.activeVisitsByPlaceDefinition = chain(this._activeVisits).indexBy('placeDefinition');\n\n // TODO: make setup the callbacks in during module initiation to make this testable.\n angularRouter.events.subscribe(event => {\n // Routing event sequence\n // ======================\n // NavigationStart -> .... -> NavigationCancel --> redirect, go around again in the same session\n // NavigationStart -> .... -> NavigationEnd --> navigation complete, end session.\n // NavigationStart -> .... -> NavigationError --> navigation aborted, end session.\n // =======================\n if (event instanceof NavigationStart) {\n // console.log(`---> NavigationStart[${event.id}]: ${event.url} (${event.navigationTrigger})`);\n if (event.navigationTrigger === 'popstate') {\n this.onPopState(event);\n } else {\n this.onRouterStarted(event);\n }\n // console.log(`<--- NavigationStart[${event.id}]: ${event.url} (${event.navigationTrigger})`);\n }\n if (event instanceof NavigationEnd) {\n // console.log(`---> NavigationEnd[${event.id}]: ${event.url}`);\n this.onRouterEnd(event);\n // console.log(`<--- NavigationEnd[${event.id}]: ${event.url}`);\n }\n if (event instanceof NavigationError) {\n // console.log(`---> NavigationError[${event.id}]: ${event.url}`);\n this.onRouterError(event);\n // console.log(`<--- NavigationError[${event.id}]: ${event.url}`);\n }\n if (event instanceof NavigationCancel) {\n // console.log(`---> NavigationCancel[${event.id}]: ${event.url}`);\n this.onRouterCancelled(event);\n // console.log(`<--- NavigationCancel[${event.id}]: ${event.url}`);\n }\n });\n\n // The router needs to know about url changes and in some cases they are the only way the router can know if\n // the back button was clicked.\n angularLocation.onUrlChange(url => this.onUrlChanged(url));\n\n }\n\n get navigationSession() {\n return this.navigationSessionModel.value;\n }\n\n get currentSession() {\n return this.navigationSessionModel.value;\n }\n\n // @Trace()\n onPopState(event: NavigationStart) {\n assert.isTruthy(event.navigationTrigger === 'popstate');\n if (this.currentSession) {\n this.currentSession.onPopState(event);\n } else {\n const poppedHistoryUrl = event.url;\n const currentRouterUrl = this.urlService.getCurrentRouterUrl();\n const session = this.interactionService.isActive() ?\n new PopStateDuringInteractionNavigation(this.navigationContext, currentRouterUrl, poppedHistoryUrl) :\n new PopStateNavigation(this.navigationContext, currentRouterUrl, poppedHistoryUrl);\n this.transitionTo(session);\n }\n }\n\n // @Trace()\n onRouterStarted(event: NavigationStart) {\n assert.isFalsey(event.navigationTrigger === 'popstate');\n const inInteraction = this.interactionService.isActive();\n if (this.currentSession) {\n this.currentSession.onRouterStarted(event);\n } else {\n this.transitionTo(this.createNavigationSession(this.urlService.getCurrentRouterUrl()));\n }\n }\n\n // @Trace()\n onUrlChanged(newUrl: string) {\n // the back button can trigger a url change without a navigation session in progress so we\n // console.log(`---> Url Changed ${newUrl}`);\n if (this.currentSession) {\n this.currentSession.onUrlChange(newUrl);\n } else {\n console.log('FYI: url changed without a navigation session in progress');\n }\n // console.log(`<--- Url Changed`);\n }\n\n // @Trace()\n onRouterCancelled(event: NavigationCancel) {\n this.currentSession.onRouterCancelled(event);\n }\n\n // @Trace()\n onRouterError(event: NavigationError) {\n this.currentSession.onRouterError(event);\n }\n\n // @Trace()\n onRouterEnd(event: NavigationEnd) {\n this.currentSession.onRouterEnd(event);\n }\n\n navigate(visit: Visit, options?: { relativeTo: ActivatedRoute }) {\n return this.doNavigation(visit, async router => {\n const commands = [\n visit.placeDefinition.path,\n ...this.createRouteParameters(visit)\n ];\n await this.angularRouter.navigate(commands, {\n relativeTo: options ? options.relativeTo : null\n });\n });\n }\n\n // @Trace()\n async doNavigation(visit: Visit, runNavigationCommands: (router: Router) => any) {\n if (this.navigationInProgress.value) {\n lang.illegalState('Navigation already in progress');\n }\n const navigation = this.createNavigationSession(this.urlService.getCurrentRouterUrl());\n navigation.storeVisit(visit);\n this.transitionTo(navigation);\n try {\n await runNavigationCommands(this.angularRouter);\n } finally {\n // Check if the router has finished (in the case where no router change required) and we're still in a\n // transient state and finish of the transition.\n if (!this.angularRouter.getCurrentNavigation() && this.currentSession) {\n this.currentSession.onRouterEnd(new NavigationEnd(-1, '', ''));\n }\n }\n }\n\n navigateByUrl(urlSnapshot: UrlSnapshot, navigationExtras?: NavigationExtras) {\n // console.log(`### navigationByUrl -> ${urlSnapshot.urlTree.toString()}`);\n return this.angularRouter.navigateByUrl(urlSnapshot.urlTree, navigationExtras);\n }\n\n get activeVisits(): ListModel<Visit> {\n return this._activeVisits.readonly;\n }\n\n // @Trace()\n async pushVisitChangesToRoute(previous: Visit, next: Visit): Promise<void> {\n // we have to push to history so our remember sanitisers don't pick up the previous value\n // when it's been cleared by the user.\n this.placeHistory.add(next);\n // FIXME: no route id -> route id duplicates route parameters\n if (next.hasRoutingChangedFrom(previous)) {\n return this.doNavigation(next, router => {\n const urlSnapshot = this.urlService.parseUrl(this.angularRouter.routerState.snapshot.url).updateVisitSegments(next);\n // console.log('### Push Changes to route Redirect', { commands: urlSnapshot.url });\n return this.navigateByUrl(urlSnapshot);\n });\n }\n }\n\n\n private createNavigationSession(currentRouterUrl: string): NavigationSession {\n const inInteraction = this.interactionService.isActive();\n return inInteraction ?\n new NavigatingDuringInteraction(this.navigationContext, currentRouterUrl) :\n new Navigating(this.navigationContext, currentRouterUrl);\n }\n\n // @Trace()\n protected transitionTo(next: NavigationSession) {\n const previous = this.navigationSessionModel.value;\n assert.isTruthy(next !== previous);\n Logger.get(this).info(`### Router State Transition: ${previous ? previous.toString() : 'null'} -> ${next.toString()}`);\n this.navigationSessionModel.value = next;\n if (!!previous) {\n previous.dispose();\n }\n next.notifyActive();\n }\n\n // @Trace()\n private routingSessionFinished(visits: Visit[]) {\n if (visits && visits.length > 0) {\n assert.isTruthy(this.navigationInProgress.value);\n visits.forEach(v => this.placeHistory.add(v));\n // We update the active visits before we finish the session so the\n // place outlets can ignore the incoming changes until things are\n // settled. TODO: can we removed the event'ness here and just do a push?\n this._activeVisits.value = visits;\n }\n const session = this.currentSession;\n session.dispose();\n this.navigationSessionModel.value = null;\n console.log(`### Router Session Finished (was ${session.toString()})`);\n this.sessionFinishedJobs.forEach(job => job());\n this.sessionFinishedJobs = [];\n }\n\n private runAfterCurrentRoutingSession(func: () => void) {\n assert.isTruthy(this.navigationInProgress);\n this.sessionFinishedJobs.push(func);\n }\n\n\n /**\n * Sync's the current interaction state with the URL. We need to push something in the URL in order\n * to be able to capture the back button on the first page. If we don't then the back click will exit\n * the app directly and we don't get to ask.\n */\n // @Trace()\n syncInteractionContextIdsWithRouter(): Promise<unknown> {\n if (this.navigationSession) {\n // console.log(`Navigation active -> ${this.navigationSession.toString()}, sync delayed until finished.`);\n const session = this.navigationSession;\n return new Promise((resolve, reject) => {\n this.runAfterCurrentRoutingSession(() => {\n // console.log(`Starting delayed sync job`);\n const syncSession = new SynchroniseInteractionContextIdsWithRoute(this.navigationContext, this.urlService.getCurrentRouterUrl(), false);\n syncSession.onDispose(() => resolve());\n this.transitionTo(syncSession);\n });\n });\n } else {\n return new Promise<unknown>(((resolve, reject) => {\n // console.log(`No navigation in progress, starting synchronisation job`);\n const session = new SynchroniseInteractionContextIdsWithRoute(this.navigationContext, this.urlService.getCurrentRouterUrl(), false);\n session.onDispose(() => resolve());\n this.transitionTo(session);\n }))\n\n }\n }\n\n\n private createRouteParameters(visit: Visit) {\n const def = visit.placeDefinition;\n return visit.hasRouteId() ?\n [def.getFormattedRouteId(visit), def.getFormattedRouteParameters(visit)] :\n [def.getFormattedRouteParameters(visit)];\n }\n\n}\n\nexport namespace NavigationStateMachine {\n export type VisitsUpdatedCallback = (visits: Visit[]) => void;\n}\n"]}
1
+ {"version":3,"file":"place-router.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/place/place-router.ts"],"names":[],"mappings":";;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAEL,gBAAgB,EAChB,aAAa,EACb,eAAe,EAEf,eAAe,EACf,MAAM,EACP,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,MAAM,EAAE,YAAY,EACpB,GAAG,EACH,gBAAgB,EAEhB,IAAI,EAEJ,MAAM,EACN,gBAAgB,EAChB,iBAAiB,EAGlB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AAEjF,OAAO,EAAE,2BAA2B,EAAE,MAAM,iEAAiE,CAAC;AAC9G,OAAO,EAAE,mCAAmC,EAAE,MAAM,2EAA2E,CAAC;AAChI,OAAO,EAAE,yCAAyC,EAAE,MAAM,kFAAkF,CAAC;AAC7I,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAE5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;;;;;;;AAI3C;IAGiC,uCAAgB;IAa/C,qBAA6B,aAAqB,EACrB,eAAyB,EACzB,kBAAsC,EACtC,UAAsB,EACtB,YAA0B;QAJvD,YAKE,iBAAO,SAmER;QAxE4B,mBAAa,GAAb,aAAa,CAAQ;QACrB,qBAAe,GAAf,eAAe,CAAU;QACzB,w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0C;;;;;IAC1C,yCAAuD;;;;;IACvD,iCAAuC;;;;;IACvC,mCAA2C","sourcesContent":["import { Location } from '@angular/common';\nimport { DEBUG } from '@angular/compiler-cli/ngcc/src/logging/console_logger';\nimport { Injectable } from '@angular/core';\nimport {\n ActivatedRoute,\n NavigationCancel,\n NavigationEnd,\n NavigationError,\n NavigationExtras,\n NavigationStart,\n Router\n} from '@angular/router';\nimport {\n assert, DebugContext,\n Dsl,\n GarbageCollector,\n HasOneIndexChain,\n lang,\n ListModel,\n Logger,\n MutableListModel,\n MutableValueModel,\n Trace, TransactionObserver,\n ValueModelChain\n} from '@coolon/pectin';\nimport { InteractionService } from '../interaction/services/interaction.service';\nimport { InteractionServiceRoutingAdapter } from '../interaction/services/interaction-service-routing-adapter';\nimport { NavigatingDuringInteraction } from './navigation/session/interactions/navigating-during-interaction';\nimport { PopStateDuringInteractionNavigation } from './navigation/session/interactions/pop-state-during-interaction-navigation';\nimport { SynchroniseInteractionContextIdsWithRoute } from './navigation/session/interactions/synchronise-interaction-context-ids-with-route';\nimport { Navigating } from './navigation/session/navigating';\nimport { NavigationContext } from './navigation/session/navigation-context';\nimport { NavigationSession } from './navigation/session/navigation-session';\nimport { PopStateNavigation } from './navigation/session/pop-state-navigation';\nimport { PlaceHistory } from './place-history';\nimport { UrlService } from './url-service';\nimport { UrlSnapshot } from './url-snapshot';\nimport { Visit } from './visit';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class PlaceRouter extends GarbageCollector {\n\n readonly navigationSessionModel = new MutableValueModel<NavigationSession>();\n readonly navigationInProgress: ValueModelChain<boolean>;\n readonly navigationSessionName: ValueModelChain<string>; // used by tests\n\n private readonly navigationContext: NavigationContext.Impl;\n\n private readonly _activeVisits = new MutableListModel<Visit>();\n readonly activeVisitsByPlaceDefinition: HasOneIndexChain<'placeDefinition', Visit>;\n private routerInteractionAdapter: InteractionServiceRoutingAdapter;\n private sessionFinishedJobs: (() => void)[] = [];\n\n constructor(private readonly angularRouter: Router,\n private readonly angularLocation: Location,\n private readonly interactionService: InteractionService,\n private readonly urlService: UrlService,\n private readonly placeHistory: PlaceHistory) {\n super();\n\n this.routerInteractionAdapter = interactionService.registerPlaceRouter(this);\n\n // TODO: Make this an interface and use 'this' instead.\n this.navigationContext = new NavigationContext.Impl(\n this.urlService,\n this.routerInteractionAdapter,\n (urlSnapshot: UrlSnapshot, options: { replaceUrl: boolean }) => {\n return this.navigateByUrl(urlSnapshot, options);\n },\n state => {\n this.transitionTo(state);\n },\n visits => {\n this.routingSessionFinished(visits);\n });\n\n const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);\n this.navigationInProgress = chain(this.navigationSessionModel).isNotNil();\n\n const idleStateName = chain(this.interactionService.active).map(active => active ? 'IdleDuringInteraction' : 'Idle');\n this.navigationSessionName = chain(this.navigationSessionModel)\n .pluck('name')\n .otherwise(idleStateName);\n\n DebugContext.tag(this._activeVisits, \"PlaceRouter.activeVisits\");\n this.activeVisitsByPlaceDefinition = chain(this._activeVisits).indexBy('placeDefinition');\n\n // TODO: make setup the callbacks in during module initiation to make this testable.\n angularRouter.events.subscribe(event => {\n // Routing event sequence\n // ======================\n // NavigationStart -> .... -> NavigationCancel --> redirect, go around again in the same session\n // NavigationStart -> .... -> NavigationEnd --> navigation complete, end session.\n // NavigationStart -> .... -> NavigationError --> navigation aborted, end session.\n // =======================\n if (event instanceof NavigationStart) {\n // console.log(`---> NavigationStart[${event.id}]: ${event.url} (${event.navigationTrigger})`);\n if (event.navigationTrigger === 'popstate') {\n this.onPopState(event);\n } else {\n this.onRouterStarted(event);\n }\n // console.log(`<--- NavigationStart[${event.id}]: ${event.url} (${event.navigationTrigger})`);\n }\n if (event instanceof NavigationEnd) {\n // console.log(`---> NavigationEnd[${event.id}]: ${event.url}`);\n this.onRouterEnd(event);\n // console.log(`<--- NavigationEnd[${event.id}]: ${event.url}`);\n }\n if (event instanceof NavigationError) {\n // console.log(`---> NavigationError[${event.id}]: ${event.url}`);\n this.onRouterError(event);\n // console.log(`<--- NavigationError[${event.id}]: ${event.url}`);\n }\n if (event instanceof NavigationCancel) {\n // console.log(`---> NavigationCancel[${event.id}]: ${event.url}`);\n this.onRouterCancelled(event);\n // console.log(`<--- NavigationCancel[${event.id}]: ${event.url}`);\n }\n });\n\n // The router needs to know about url changes and in some cases they are the only way the router can know if\n // the back button was clicked.\n angularLocation.onUrlChange(url => this.onUrlChanged(url));\n\n }\n\n get navigationSession() {\n return this.navigationSessionModel.value;\n }\n\n get currentSession() {\n return this.navigationSessionModel.value;\n }\n\n // @Trace()\n onPopState(event: NavigationStart) {\n assert.isTruthy(event.navigationTrigger === 'popstate');\n if (this.currentSession) {\n this.currentSession.onPopState(event);\n } else {\n const poppedHistoryUrl = event.url;\n const currentRouterUrl = this.urlService.getCurrentRouterUrl();\n const session = this.interactionService.isActive() ?\n new PopStateDuringInteractionNavigation(this.navigationContext, currentRouterUrl, poppedHistoryUrl) :\n new PopStateNavigation(this.navigationContext, currentRouterUrl, poppedHistoryUrl);\n this.transitionTo(session);\n }\n }\n\n // @Trace()\n onRouterStarted(event: NavigationStart) {\n assert.isFalsey(event.navigationTrigger === 'popstate');\n const inInteraction = this.interactionService.isActive();\n if (this.currentSession) {\n this.currentSession.onRouterStarted(event);\n } else {\n this.transitionTo(this.createNavigationSession(this.urlService.getCurrentRouterUrl()));\n }\n }\n\n // @Trace()\n onUrlChanged(newUrl: string) {\n // the back button can trigger a url change without a navigation session in progress so we\n // console.log(`---> Url Changed ${newUrl}`);\n if (this.currentSession) {\n this.currentSession.onUrlChange(newUrl);\n } else {\n console.log('FYI: url changed without a navigation session in progress');\n }\n // console.log(`<--- Url Changed`);\n }\n\n // @Trace()\n onRouterCancelled(event: NavigationCancel) {\n this.currentSession.onRouterCancelled(event);\n }\n\n // @Trace()\n onRouterError(event: NavigationError) {\n this.currentSession.onRouterError(event);\n }\n\n // @Trace()\n onRouterEnd(event: NavigationEnd) {\n this.currentSession.onRouterEnd(event);\n }\n\n navigate(visit: Visit, options?: { relativeTo: ActivatedRoute }) {\n return this.doNavigation(visit, async router => {\n const commands = [\n visit.placeDefinition.path,\n ...this.createRouteParameters(visit)\n ];\n await this.angularRouter.navigate(commands, {\n relativeTo: options ? options.relativeTo : null\n });\n });\n }\n\n // @Trace()\n async doNavigation(visit: Visit, runNavigationCommands: (router: Router) => any) {\n if (this.navigationInProgress.value) {\n lang.illegalState('Navigation already in progress');\n }\n const navigation = this.createNavigationSession(this.urlService.getCurrentRouterUrl());\n navigation.storeVisit(visit);\n this.transitionTo(navigation);\n try {\n await runNavigationCommands(this.angularRouter);\n } finally {\n // Check if the router has finished (in the case where no router change required) and we're still in a\n // transient state and finish of the transition.\n if (!this.angularRouter.getCurrentNavigation() && this.currentSession) {\n this.currentSession.onRouterEnd(new NavigationEnd(-1, '', ''));\n }\n }\n }\n\n navigateByUrl(urlSnapshot: UrlSnapshot, navigationExtras?: NavigationExtras) {\n // console.log(`### navigationByUrl -> ${urlSnapshot.urlTree.toString()}`);\n return this.angularRouter.navigateByUrl(urlSnapshot.urlTree, navigationExtras);\n }\n\n get activeVisits(): ListModel<Visit> {\n return this._activeVisits.readonly;\n }\n\n // @Trace()\n async pushVisitChangesToRoute(previous: Visit, next: Visit): Promise<void> {\n // we have to push to history so our remember sanitisers don't pick up the previous value\n // when it's been cleared by the user.\n this.placeHistory.add(next);\n // FIXME: no route id -> route id duplicates route parameters\n if (next.hasRoutingChangedFrom(previous)) {\n return this.doNavigation(next, router => {\n const urlSnapshot = this.urlService.parseUrl(this.angularRouter.routerState.snapshot.url).updateVisitSegments(next);\n // console.log('### Push Changes to route Redirect', { commands: urlSnapshot.url });\n return this.navigateByUrl(urlSnapshot);\n });\n }\n }\n\n\n private createNavigationSession(currentRouterUrl: string): NavigationSession {\n const inInteraction = this.interactionService.isActive();\n return inInteraction ?\n new NavigatingDuringInteraction(this.navigationContext, currentRouterUrl) :\n new Navigating(this.navigationContext, currentRouterUrl);\n }\n\n // @Trace()\n protected transitionTo(next: NavigationSession) {\n const previous = this.navigationSessionModel.value;\n assert.isTruthy(next !== previous);\n Logger.get(this).info(`### Router State Transition: ${previous ? previous.toString() : 'null'} -> ${next.toString()}`);\n this.navigationSessionModel.value = next;\n if (!!previous) {\n previous.dispose();\n }\n next.notifyActive();\n }\n\n // @Trace()\n private routingSessionFinished(visits: Visit[]) {\n if (visits && visits.length > 0) {\n assert.isTruthy(this.navigationInProgress.value);\n visits.forEach(v => this.placeHistory.add(v));\n // We update the active visits before we finish the session so the\n // place outlets can ignore the incoming changes until things are\n // settled. TODO: can we removed the event'ness here and just do a push?\n this._activeVisits.value = visits;\n }\n const session = this.currentSession;\n session.dispose();\n this.navigationSessionModel.value = null;\n console.log(`### Router Session Finished (was ${session.toString()})`);\n this.sessionFinishedJobs.forEach(job => job());\n this.sessionFinishedJobs = [];\n }\n\n private runAfterRoutingSessionFinishes(func: () => void) {\n assert.isTruthy(this.navigationInProgress);\n this.sessionFinishedJobs.push(func);\n }\n\n\n /**\n * Sync's the current interaction state with the URL. We need to push something in the URL in order\n * to be able to capture the back button on the first page. If we don't then the back click will exit\n * the app directly and we don't get to ask.\n */\n // @Trace()\n syncInteractionContextIdsWithRouter(): Promise<unknown> {\n if (this.navigationSession) {\n // console.log(`Navigation active -> ${this.navigationSession.toString()}, sync delayed until finished.`);\n const session = this.navigationSession;\n return new Promise((resolve, reject) => {\n this.runAfterRoutingSessionFinishes(() => {\n this.runAfterRoutingSessionFinishes(resolve);\n const syncSession = new SynchroniseInteractionContextIdsWithRoute(this.navigationContext, this.urlService.getCurrentRouterUrl(), false);\n this.transitionTo(syncSession);\n });\n });\n } else {\n return new Promise<unknown>(((resolve, reject) => {\n // console.log(`No navigation in progress, starting synchronisation job`);\n this.runAfterRoutingSessionFinishes(resolve);\n const session = new SynchroniseInteractionContextIdsWithRoute(this.navigationContext, this.urlService.getCurrentRouterUrl(), false);\n this.transitionTo(session);\n }))\n\n }\n }\n\n\n private createRouteParameters(visit: Visit) {\n const def = visit.placeDefinition;\n return visit.hasRouteId() ?\n [def.getFormattedRouteId(visit), def.getFormattedRouteParameters(visit)] :\n [def.getFormattedRouteParameters(visit)];\n }\n\n}\n\nexport namespace NavigationStateMachine {\n export type VisitsUpdatedCallback = (visits: Visit[]) => void;\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { DOCUMENT, CommonModule, Location } from '@angular/common';
2
- import { Directive, ElementRef, Inject, Input, HostListener, NgZone, NgModule, EventEmitter, Output, Component, InjectionToken, Injector, ComponentFactoryResolver, ViewContainerRef, ViewChild, ViewChildren, Injectable, ɵɵdefineInjectable, ɵɵinject, Optional, SkipSelf, HostBinding } from '@angular/core';
2
+ import { Directive, ElementRef, Inject, Input, HostListener, NgZone, NgModule, EventEmitter, Output, Component, ContentChild, InjectionToken, Injector, ComponentFactoryResolver, ViewContainerRef, ViewChild, ViewChildren, Injectable, ɵɵdefineInjectable, ɵɵinject, Optional, SkipSelf, HostBinding } from '@angular/core';
3
3
  import { FormsModule } from '@angular/forms';
4
4
  import { MatInputModule, MatFormFieldModule, MatSelectModule, MatButtonModule, MatDialogModule, MatTabsModule as MatTabsModule$1, MatProgressSpinnerModule, MatDialog } from '@angular/material';
5
5
  import { MatTabsModule } from '@angular/material/tabs';
@@ -644,7 +644,7 @@ class SelectInputComponent extends AbstractInputComponent {
644
644
  SelectInputComponent.decorators = [
645
645
  { type: Component, args: [{
646
646
  selector: 'aup-select-input',
647
- template: "<mat-form-field appearance=\"standard\" [floatLabel]=\"floatLabel\">\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\n <mat-select placeholder=\"{{placeholder}}\"\n [(ngModel)]=\"valueModel.value\"\n [disabled]=\"!enabled.value\"\n (keydown.enter)=\"notifyEnterKey()\"\n (keydown.escape)=\"notifyEscapeKey()\"\n [pectinFocusBinding]=\"valueModel\"\n [errorStateMatcher]=\"errorStateMatcher\"\n >\n <mat-option *ngFor=\"let option of optionsModel.value\" [value]=\"option\">{{optionLabelFormat(option)}}\n </mat-option>\n </mat-select>\n <mat-hint *ngIf=\"hint\">{{hint}}</mat-hint>\n <mat-error *ngIf=\"hasErrors\">{{firstError}}</mat-error>\n</mat-form-field>\n",
647
+ template: "<mat-form-field appearance=\"standard\" [floatLabel]=\"floatLabel\">\n <mat-label *ngIf=\"label\">{{label}}</mat-label>\n <mat-select placeholder=\"{{placeholder}}\"\n [(ngModel)]=\"valueModel.value\"\n [disabled]=\"!enabled.value\"\n (keydown.enter)=\"notifyEnterKey()\"\n (keydown.escape)=\"notifyEscapeKey()\"\n [pectinFocusBinding]=\"valueModel\"\n [errorStateMatcher]=\"errorStateMatcher\"\n >\n <mat-option *ngIf=\"allowNil\">{{placeholder}}</mat-option>\n <mat-option *ngFor=\"let option of optionsModel.value; let i = index\" [value]=\"option\">\n <ng-container *ngIf=\"!optionTemplateRef\">{{optionLabelFormat(option)}}</ng-container>\n <ng-container *ngIf=\"optionTemplateRef\"\n [ngTemplateOutlet]=\"optionTemplateRef\"\n [ngTemplateOutletContext]=\"{ $implicit: option, index: i }\"\n >\n </ng-container>\n </mat-option>\n </mat-select>\n <mat-hint *ngIf=\"hint\">{{hint}}</mat-hint>\n <mat-error *ngIf=\"hasErrors\">{{firstError}}</mat-error>\n</mat-form-field>\n",
648
648
  styles: [":host{display:inline-block}mat-form-field{width:100%}"]
649
649
  }] }
650
650
  ];
@@ -654,6 +654,9 @@ SelectInputComponent.propDecorators = {
654
654
  optionsModel: [{ type: Input }],
655
655
  options: [{ type: Input }],
656
656
  optionLabel: [{ type: Input }],
657
+ allowNil: [{ type: Input }],
658
+ optionTemplateRef: [{ type: ContentChild, args: ["optionTemplate", { static: false },] }],
659
+ nilOptionTemplateRef: [{ type: ContentChild, args: ["nilOptionTemplate", { static: false },] }],
657
660
  optionLabelFormat: [{ type: Input }]
658
661
  };
659
662
  __decorate([
@@ -672,6 +675,12 @@ if (false) {
672
675
  /** @type {?} */
673
676
  SelectInputComponent.prototype.optionLabel;
674
677
  /** @type {?} */
678
+ SelectInputComponent.prototype.allowNil;
679
+ /** @type {?} */
680
+ SelectInputComponent.prototype.optionTemplateRef;
681
+ /** @type {?} */
682
+ SelectInputComponent.prototype.nilOptionTemplateRef;
683
+ /** @type {?} */
675
684
  SelectInputComponent.prototype.optionLabelFormat;
676
685
  }
677
686
 
@@ -4917,7 +4926,7 @@ class PlaceRouter extends GarbageCollector {
4917
4926
  * @param {?} func
4918
4927
  * @return {?}
4919
4928
  */
4920
- runAfterCurrentRoutingSession(func) {
4929
+ runAfterRoutingSessionFinishes(func) {
4921
4930
  assert.isTruthy(this.navigationInProgress);
4922
4931
  this.sessionFinishedJobs.push(func);
4923
4932
  }
@@ -4939,17 +4948,13 @@ class PlaceRouter extends GarbageCollector {
4939
4948
  * @return {?}
4940
4949
  */
4941
4950
  (resolve, reject) => {
4942
- this.runAfterCurrentRoutingSession((/**
4951
+ this.runAfterRoutingSessionFinishes((/**
4943
4952
  * @return {?}
4944
4953
  */
4945
4954
  () => {
4946
- // console.log(`Starting delayed sync job`);
4955
+ this.runAfterRoutingSessionFinishes(resolve);
4947
4956
  /** @type {?} */
4948
4957
  const syncSession = new SynchroniseInteractionContextIdsWithRoute(this.navigationContext, this.urlService.getCurrentRouterUrl(), false);
4949
- syncSession.onDispose((/**
4950
- * @return {?}
4951
- */
4952
- () => resolve()));
4953
4958
  this.transitionTo(syncSession);
4954
4959
  }));
4955
4960
  }));
@@ -4962,12 +4967,9 @@ class PlaceRouter extends GarbageCollector {
4962
4967
  */
4963
4968
  (resolve, reject) => {
4964
4969
  // console.log(`No navigation in progress, starting synchronisation job`);
4970
+ this.runAfterRoutingSessionFinishes(resolve);
4965
4971
  /** @type {?} */
4966
4972
  const session = new SynchroniseInteractionContextIdsWithRoute(this.navigationContext, this.urlService.getCurrentRouterUrl(), false);
4967
- session.onDispose((/**
4968
- * @return {?}
4969
- */
4970
- () => resolve()));
4971
4973
  this.transitionTo(session);
4972
4974
  })));
4973
4975
  }