@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.
- package/bundles/coolon-angular-ui-powerups.umd.js +213 -238
- package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
- package/coolon-angular-ui-powerups.metadata.json +1 -1
- package/esm2015/lib/place/navigation/session/event-cleanup/wait-until-link-triggered-navigation-interaction-cancelation-type-determined.js +3 -15
- package/esm2015/lib/place/navigation/session/event-cleanup/wait-until-link-triggered-navigation-interaction-cancelation-type-determined.js.map +1 -1
- package/esm2015/lib/place/navigation/session/event-cleanup/wait-until-link-triggered-navigation-interaction-cancelation-type-determined.metadata.json +1 -1
- package/esm2015/lib/place/place-component.js +5 -17
- package/esm2015/lib/place/place-component.js.map +1 -1
- package/esm2015/lib/place/place-component.metadata.json +1 -1
- package/esm2015/lib/place/route/parameter-definition.js +2 -11
- package/esm2015/lib/place/route/parameter-definition.js.map +1 -1
- package/esm2015/lib/place/route/parameter-definition.metadata.json +1 -1
- package/fesm2015/coolon-angular-ui-powerups.js +207 -232
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { __awaiter
|
|
2
|
-
import { NavigationCancel, NavigationStart } from '@angular/router';
|
|
3
|
-
import { Trace } from '@coolon/pectin';
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
4
2
|
import { EventCleanUpSession } from './event-clean-up-session';
|
|
5
3
|
/**
|
|
6
4
|
* This state handles the scenario where a link navigation triggered an interaction and the user clicked back a to cancel it.
|
|
@@ -20,9 +18,11 @@ export class WaitUntilLinkTriggeredNavigationInteractionCancellationTypeDetermin
|
|
|
20
18
|
this.clickedLinkMatchedBackButtonUrl = false;
|
|
21
19
|
this.debugPropertyKeys = ['idle', 'startingUrl', 'clickedLinkUrl', 'firstCancelEventUrl', 'clickedLinkMatchedBackButtonUrl', 'popStateEventUrl'];
|
|
22
20
|
}
|
|
21
|
+
// @Trace()
|
|
23
22
|
onRouterStarted(event) {
|
|
24
23
|
this.ignore(event);
|
|
25
24
|
}
|
|
25
|
+
// @Trace()
|
|
26
26
|
onRouterCancelled(event) {
|
|
27
27
|
if (event.url === this.clickedLinkUrl) {
|
|
28
28
|
this.context.transitionTo(new WaitForLinkSameAsBackToPlayOut(this.context, this.startingUrl, this.clickedLinkUrl));
|
|
@@ -37,18 +37,6 @@ export class WaitUntilLinkTriggeredNavigationInteractionCancellationTypeDetermin
|
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
__decorate([
|
|
41
|
-
Trace(),
|
|
42
|
-
__metadata("design:type", Function),
|
|
43
|
-
__metadata("design:paramtypes", [NavigationStart]),
|
|
44
|
-
__metadata("design:returntype", void 0)
|
|
45
|
-
], WaitUntilLinkTriggeredNavigationInteractionCancellationTypeDetermined.prototype, "onRouterStarted", null);
|
|
46
|
-
__decorate([
|
|
47
|
-
Trace(),
|
|
48
|
-
__metadata("design:type", Function),
|
|
49
|
-
__metadata("design:paramtypes", [NavigationCancel]),
|
|
50
|
-
__metadata("design:returntype", void 0)
|
|
51
|
-
], WaitUntilLinkTriggeredNavigationInteractionCancellationTypeDetermined.prototype, "onRouterCancelled", null);
|
|
52
40
|
class WaitForLinkSameAsBackToPlayOut extends EventCleanUpSession {
|
|
53
41
|
constructor(context, startingUrl, clickedLinkUrl) {
|
|
54
42
|
super(context, startingUrl);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wait-until-link-triggered-navigation-interaction-cancelation-type-determined.js","sourceRoot":"","sources":["../../../../../../../../../libs/angular-ui-powerups/src/lib/place/navigation/session/event-cleanup/wait-until-link-triggered-navigation-interaction-cancelation-type-determined.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAkC,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACpG,OAAO,EAAE,KA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GAAiG;AACjG,0EAA0E;AAC1E,sFAAsF;AACtF,kTAAkT;AAClT,iHAAiH;AACjH,6GAA6G;AAC7G,wCAAwC;AACxC,wCAAwC;AACxC,4FAA4F;AAC5F,uIAAuI;AACvI,yCAAyC;AACzC,wIAAwI;AACxI,kGAAkG;AAClG,yCAAyC;AACzC,wIAAwI","sourcesContent":["import { NavigationCancel, NavigationEnd, NavigationError, NavigationStart } from '@angular/router';\nimport { Trace } from '@coolon/pectin';\nimport { PlaceComponent } from '../../../place-component';\nimport { UrlSnapshot } from '../../../url-snapshot';\nimport { NavigationContext } from '../navigation-context';\nimport { EventCleanUpSession } from './event-clean-up-session';\n\n/**\n * This state handles the scenario where a link navigation triggered an interaction and the user clicked back a to cancel it.\n * The routing event sequence is different depending on the link that was clicked.\n *\n * NOTE: In angular prior to 10 the sequence of routing events was different depending on the initial link that was clicked.\n * This class used have ugle if/else code to handle it and a not that it should be split into sub states.\n * During the update to angular 10 I did this (as the tests for this scenario were failings). After doing so\n * it appears that angular now behaves the same in both cases. But rather that revert the changes I've left the\n * sub-state handling in in case it ever comes back.\n */\nexport class WaitUntilLinkTriggeredNavigationInteractionCancellationTypeDetermined extends EventCleanUpSession {\n\n readonly isPopState = false;\n firstCancelEventUrl: string;\n popStateEventUrl: string;\n clickedLinkMatchedBackButtonUrl = false;\n debugPropertyKeys = ['idle', 'startingUrl', 'clickedLinkUrl', 'firstCancelEventUrl', 'clickedLinkMatchedBackButtonUrl', 'popStateEventUrl'];\n\n constructor(context: NavigationContext,\n startingUrl: string,\n readonly clickedLinkUrl: string) {\n super(context, startingUrl);\n }\n\n @Trace()\n onRouterStarted(event: NavigationStart): void {\n this.ignore(event);\n }\n\n @Trace()\n onRouterCancelled(event: NavigationCancel): void {\n if (event.url === this.clickedLinkUrl) {\n this.context.transitionTo(new WaitForLinkSameAsBackToPlayOut(this.context, this.startingUrl, this.clickedLinkUrl));\n } else {\n this.context.transitionTo(new WaitForLinkDifferentFromBackToPlayOut(this.context, this.startingUrl, this.clickedLinkUrl));\n }\n }\n\n async canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot> {\n return false;\n }\n}\n\nclass WaitForLinkSameAsBackToPlayOut extends EventCleanUpSession {\n readonly isPopState = false;\n popStateEventUrl: string;\n debugPropertyKeys = ['idle', 'startingUrl', 'clickedLinkUrl', 'popStateEventUrl'];\n\n constructor(context: NavigationContext,\n startingUrl: string,\n readonly clickedLinkUrl: string) {\n super(context, startingUrl);\n }\n\n // @Trace()\n onRouterEnd(event: NavigationEnd): void {\n this.ignore(event);\n }\n\n // @Trace()\n onRouterError(event: NavigationError): void {\n this.ignore(event);\n }\n\n // @Trace()\n onPopState(event: NavigationStart): void {\n this.popStateEventUrl = event.url;\n this.ignore(event);\n }\n\n // @Trace()\n onRouterCancelled(event: NavigationCancel) {\n if (this.popStateEventUrl) {\n this.finaliseRouting();\n }\n }\n\n // @Trace()\n finaliseRouting() {\n this.repairBrowserHistoryAndUrlAfterGuardCancellation(this.clickedLinkUrl, this.startingUrl);\n return this.context.finishRoutingSession();\n }\n\n\n async canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot> {\n return false;\n }\n\n}\n\n// See the note above. This class is identical to the previous but I've left it here in case angular decides to\n// route differently in this scenario going forward.\nclass WaitForLinkDifferentFromBackToPlayOut extends EventCleanUpSession {\n readonly isPopState = false;\n popStateEventUrl: string;\n debugPropertyKeys = ['idle', 'startingUrl', 'clickedLinkUrl', 'popStateEventUrl'];\n\n constructor(context: NavigationContext,\n startingUrl: string,\n readonly clickedLinkUrl: string) {\n super(context, startingUrl);\n }\n\n // @Trace()\n onRouterEnd(event: NavigationEnd): void {\n this.ignore(event);\n }\n\n // @Trace()\n onRouterError(event: NavigationError): void {\n this.ignore(event);\n }\n\n // @Trace()\n onPopState(event: NavigationStart): void {\n this.popStateEventUrl = event.url;\n this.ignore(event);\n }\n\n // @Trace()\n onRouterCancelled(event: NavigationCancel) {\n if (this.popStateEventUrl) {\n this.finaliseRouting();\n }\n }\n\n // @Trace()\n finaliseRouting() {\n this.repairBrowserHistoryAndUrlAfterGuardCancellation(this.clickedLinkUrl, this.startingUrl);\n return this.context.finishRoutingSession();\n }\n\n async canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot> {\n return false;\n }\n}\n\n\n//\n// ### Router State Transition: null -> Navigating(startingUrl: /activities/dialogs;l=en, urlAfterRedirects: undefined)\n// ### ###### Router Event: NavigationStart\n// NavigationStart(id: 6, url: '/home')\n// NavigationStart {id: 6, url: \"/home\", navigationTrigger: \"imperative\", restoredState: null}\n// logger.js:39 Ignoring router event: NavigationStart -> /home :: Navigating(startingUrl: /activities/dialogs;l=en, urlAfterRedirects: undefined)\n// ### ###### Router Event: RoutesRecognized\n// RoutesRecognized(id: 6, url: '/home', urlAfterRedirects: '/home', state: Route(url:'', path:'') { Route(url:'home', path:'home') } )\n// RoutesRecognized {id: 6, url: \"/home\", urlAfterRedirects: \"/home\", state: RouterStateSnapshot}\n// ###### Router Event: GuardsCheckStart\n// GuardsCheckStart(id: 6, url: '/home', urlAfterRedirects: '/home', state: Route(url:'', path:'') { Route(url:'home', path:'home') } )\n// GuardsCheckStart {id: 6, url: \"/home\", urlAfterRedirects: \"/home\", state: RouterStateSnapshot}\n// logger.js:39 back button pressed during navigation session interaction promise\n// logger.js:39 cancelling current navigation activity..\n// logger.js:39 ### Router State Transition: Navigating(startingUrl: /activities/dialogs;l=en, urlAfterRedirects: undefined) -> WaitUntilLinkTriggeredNavigationInteractionCancellationEventsFinish(idle: undefined, startingUrl: /activities/dialogs;l=en, clickedLinkUrl: /home, firstCancelEventUrl: undefined, clickedLinkMatchedBackButtonUrl: false, popStateEventUrl: undefined)\n// ###### Router Event: GuardsCheckEnd\n// GuardsCheckEnd(id: 6, url: '/home', urlAfterRedirects: '/home', state: Route(url:'', path:'') { Route(url:'home', path:'home') } , shouldActivate: false)\n// GuardsCheckEnd {id: 6, url: \"/home\", urlAfterRedirects: \"/home\", state: RouterStateSnapshot, shouldActivate: false}\n// ###### Router Event: NavigationCancel\n// NavigationCancel(id: 6, url: '/home')\n// NavigationCancel {id: 6, url: \"/home\", reason: \"\"}\n// logger.js:54 WaitUntilLinkTriggeredNavigationInteractionCancellationEventsFinish.onRouterCancelled\n// logger.js:19 args NavigationCancel {id: 6, url: \"/home\", reason: \"\"}\n// logger.js:39 Ignoring router event: NavigationCancel -> /home :: WaitUntilLinkTriggeredNavigationInteractionCancellationEventsFinish(idle: undefined, startingUrl: /activities/dialogs;l=en, clickedLinkUrl: /home, firstCancelEventUrl: /home, clickedLinkMatchedBackButtonUrl: true, popStateEventUrl: undefined)\n// logger.js:28 <-- WaitUntilLinkTriggeredNavigationInteractionCancellationEventsFinish.onRouterCancelled undefined\n// logger.js:54 WaitUntilLinkTriggeredNavigationInteractionCancellationEventsFinish.onRouterEnd\n// logger.js:19 args NavigationEnd {id: -1, url: \"\", urlAfterRedirects: \"\"}\n// logger.js:54 WaitUntilLinkTriggeredNavigationInteractionCancellationEventsFinish.finaliseRouting\n// logger.js:39 WORK-AROUND: Updating browser location after pop state - see angular issue #13586\n// navigation-session.ts:129 replacing /activities/dialogs;l=en with /home\n// navigation-session.ts:131 pushing /activities/dialogs;l=en back onto the history.\n// ????? place-router.ts:281 ### Router Session Finished (was WaitUntilLinkTriggeredNavigationInteractionCancellationEventsFinish(idle: undefined, startingUrl: /activities/dialogs;l=en, clickedLinkUrl: /home, firstCancelEventUrl: /home, clickedLinkMatchedBackButtonUrl: true, popStateEventUrl: undefined))\n// logger.js:28 <-- WaitUntilLinkTriggeredNavigationInteractionCancellationEventsFinish.finaliseRouting undefined\n// logger.js:28 <-- WaitUntilLinkTriggeredNavigationInteractionCancellationEventsFinish.onRouterEnd undefined\n// ###### Router Event: NavigationStart\n// NavigationStart(id: 7, url: '/home')\n// NavigationStart {id: 7, url: \"/home\", navigationTrigger: \"popstate\", restoredState: {…}}\n// logger.js:39 ### Router State Transition: null -> PopStateNavigation(startingUrl: /activities/dialogs;l=en, poppedHistoryUrl: /home)\n// ###### Router Event: RoutesRecognized\n// RoutesRecognized(id: 7, url: '/home', urlAfterRedirects: '/home', state: Route(url:'', path:'') { Route(url:'home', path:'home') } )\n// RoutesRecognized {id: 7, url: \"/home\", urlAfterRedirects: \"/home\", state: RouterStateSnapshot}\n// ###### Router Event: GuardsCheckStart\n// GuardsCheckStart(id: 7, url: '/home', urlAfterRedirects: '/home', state: Route(url:'', path:'') { Route(url:'home', path:'home') } )\n"]}
|
|
1
|
+
{"version":3,"file":"wait-until-link-triggered-navigation-interaction-cancelation-type-determined.js","sourceRoot":"","sources":["../../../../../../../../../libs/angular-ui-powerups/src/lib/place/navigation/session/event-cleanup/wait-until-link-triggered-navigation-interaction-cancelation-type-determined.ts"],"names":[],"mappings":";AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D;;;;;;;;;GASG;AACH,MAAM,OAAO,qEAAsE,SAAQ,mBAAmB;IAQ5G,YAAY,OAA0B,EAC1B,WAAmB,EACV,cAAsB;QACzC,KAAK,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QADT,mBAAc,GAAd,cAAc,CAAQ;QARlC,eAAU,GAAG,KAAK,CAAC;QAG5B,oCAA+B,GAAG,KAAK,CAAC;QACxC,sBAAiB,GAAG,CAAC,MAAM,EAAE,aAAa,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,iCAAiC,EAAE,kBAAkB,CAAC,CAAC;IAM5I,CAAC;IAED,WAAW;IACX,eAAe,CAAC,KAAsB;QACpC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;IAED,WAAW;IACX,iBAAiB,CAAC,KAAuB;QACvC,IAAI,KAAK,CAAC,GAAG,KAAK,IAAI,CAAC,cAAc,EAAE;YACrC,IAAI,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AAuB,EAAE,OAAoB;;YAC/F,OAAO,KAAK,CAAC;QACf,CAAC;KAAA;CACF;AAGD,EAAE;AACF,uHAAuH;AACvH,4CAA4C;AAC5C,wCAAwC;AACxC,+FAA+F;AAC/F,kJAAkJ;AAClJ,6CAA6C;AAC7C,wIAAwI;AACxI,kGAAkG;AAClG,yCAAyC;AACzC,wIAAwI;AACxI,kGAAkG;AAClG,iFAAiF;AACjF,wDAAwD;AACxD,yXAAyX;AACzX,uCAAuC;AACvC,6JAA6J;AAC7J,uHAAuH;AACvH,yCAAyC;AACzC,yCAAyC;AACzC,sDAAsD;AACtD,qGAAqG;AACrG,uEAAuE;AACvE,sTAAsT;AACtT,mHAAmH;AACnH,+FAA+F;AAC/F,2EAA2E;AAC3E,mGAAmG;AACnG,iGAAiG;AACjG,0EAA0E;AAC1E,sFAAsF;AACtF,kTAAkT;AAClT,iHAAiH;AACjH,6GAA6G;AAC7G,wCAAwC;AACxC,wCAAwC;AACxC,4FAA4F;AAC5F,uIAAuI;AACvI,yCAAyC;AACzC,wIAAwI;AACxI,kGAAkG;AAClG,yCAAyC;AACzC,wIAAwI","sourcesContent":["import { NavigationCancel, NavigationEnd, NavigationError, NavigationStart } from '@angular/router';\nimport { Trace } from '@coolon/pectin';\nimport { PlaceComponent } from '../../../place-component';\nimport { UrlSnapshot } from '../../../url-snapshot';\nimport { NavigationContext } from '../navigation-context';\nimport { EventCleanUpSession } from './event-clean-up-session';\n\n/**\n * This state handles the scenario where a link navigation triggered an interaction and the user clicked back a to cancel it.\n * The routing event sequence is different depending on the link that was clicked.\n *\n * NOTE: In angular prior to 10 the sequence of routing events was different depending on the initial link that was clicked.\n * This class used have ugle if/else code to handle it and a not that it should be split into sub states.\n * During the update to angular 10 I did this (as the tests for this scenario were failings). After doing so\n * it appears that angular now behaves the same in both cases. But rather that revert the changes I've left the\n * sub-state handling in in case it ever comes back.\n */\nexport class WaitUntilLinkTriggeredNavigationInteractionCancellationTypeDetermined extends EventCleanUpSession {\n\n readonly isPopState = false;\n firstCancelEventUrl: string;\n popStateEventUrl: string;\n clickedLinkMatchedBackButtonUrl = false;\n debugPropertyKeys = ['idle', 'startingUrl', 'clickedLinkUrl', 'firstCancelEventUrl', 'clickedLinkMatchedBackButtonUrl', 'popStateEventUrl'];\n\n constructor(context: NavigationContext,\n startingUrl: string,\n readonly clickedLinkUrl: string) {\n super(context, startingUrl);\n }\n\n // @Trace()\n onRouterStarted(event: NavigationStart): void {\n this.ignore(event);\n }\n\n // @Trace()\n onRouterCancelled(event: NavigationCancel): void {\n if (event.url === this.clickedLinkUrl) {\n this.context.transitionTo(new WaitForLinkSameAsBackToPlayOut(this.context, this.startingUrl, this.clickedLinkUrl));\n } else {\n this.context.transitionTo(new WaitForLinkDifferentFromBackToPlayOut(this.context, this.startingUrl, this.clickedLinkUrl));\n }\n }\n\n async canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot> {\n return false;\n }\n}\n\nclass WaitForLinkSameAsBackToPlayOut extends EventCleanUpSession {\n readonly isPopState = false;\n popStateEventUrl: string;\n debugPropertyKeys = ['idle', 'startingUrl', 'clickedLinkUrl', 'popStateEventUrl'];\n\n constructor(context: NavigationContext,\n startingUrl: string,\n readonly clickedLinkUrl: string) {\n super(context, startingUrl);\n }\n\n // @Trace()\n onRouterEnd(event: NavigationEnd): void {\n this.ignore(event);\n }\n\n // @Trace()\n onRouterError(event: NavigationError): void {\n this.ignore(event);\n }\n\n // @Trace()\n onPopState(event: NavigationStart): void {\n this.popStateEventUrl = event.url;\n this.ignore(event);\n }\n\n // @Trace()\n onRouterCancelled(event: NavigationCancel) {\n if (this.popStateEventUrl) {\n this.finaliseRouting();\n }\n }\n\n // @Trace()\n finaliseRouting() {\n this.repairBrowserHistoryAndUrlAfterGuardCancellation(this.clickedLinkUrl, this.startingUrl);\n return this.context.finishRoutingSession();\n }\n\n\n async canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot> {\n return false;\n }\n\n}\n\n// See the note above. This class is identical to the previous but I've left it here in case angular decides to\n// route differently in this scenario going forward.\nclass WaitForLinkDifferentFromBackToPlayOut extends EventCleanUpSession {\n readonly isPopState = false;\n popStateEventUrl: string;\n debugPropertyKeys = ['idle', 'startingUrl', 'clickedLinkUrl', 'popStateEventUrl'];\n\n constructor(context: NavigationContext,\n startingUrl: string,\n readonly clickedLinkUrl: string) {\n super(context, startingUrl);\n }\n\n // @Trace()\n onRouterEnd(event: NavigationEnd): void {\n this.ignore(event);\n }\n\n // @Trace()\n onRouterError(event: NavigationError): void {\n this.ignore(event);\n }\n\n // @Trace()\n onPopState(event: NavigationStart): void {\n this.popStateEventUrl = event.url;\n this.ignore(event);\n }\n\n // @Trace()\n onRouterCancelled(event: NavigationCancel) {\n if (this.popStateEventUrl) {\n this.finaliseRouting();\n }\n }\n\n // @Trace()\n finaliseRouting() {\n this.repairBrowserHistoryAndUrlAfterGuardCancellation(this.clickedLinkUrl, this.startingUrl);\n return this.context.finishRoutingSession();\n }\n\n async canDeactivatePlace(component: PlaceComponent, currentUrl: UrlSnapshot, nextUrl: UrlSnapshot): Promise<boolean | UrlSnapshot> {\n return false;\n }\n}\n\n\n//\n// ### Router State Transition: null -> Navigating(startingUrl: /activities/dialogs;l=en, urlAfterRedirects: undefined)\n// ### ###### Router Event: NavigationStart\n// NavigationStart(id: 6, url: '/home')\n// NavigationStart {id: 6, url: \"/home\", navigationTrigger: \"imperative\", restoredState: null}\n// logger.js:39 Ignoring router event: NavigationStart -> /home :: Navigating(startingUrl: /activities/dialogs;l=en, urlAfterRedirects: undefined)\n// ### ###### Router Event: RoutesRecognized\n// RoutesRecognized(id: 6, url: '/home', urlAfterRedirects: '/home', state: Route(url:'', path:'') { Route(url:'home', path:'home') } )\n// RoutesRecognized {id: 6, url: \"/home\", urlAfterRedirects: \"/home\", state: RouterStateSnapshot}\n// ###### Router Event: GuardsCheckStart\n// GuardsCheckStart(id: 6, url: '/home', urlAfterRedirects: '/home', state: Route(url:'', path:'') { Route(url:'home', path:'home') } )\n// GuardsCheckStart {id: 6, url: \"/home\", urlAfterRedirects: \"/home\", state: RouterStateSnapshot}\n// logger.js:39 back button pressed during navigation session interaction promise\n// logger.js:39 cancelling current navigation activity..\n// logger.js:39 ### Router State Transition: Navigating(startingUrl: /activities/dialogs;l=en, urlAfterRedirects: undefined) -> WaitUntilLinkTriggeredNavigationInteractionCancellationEventsFinish(idle: undefined, startingUrl: /activities/dialogs;l=en, clickedLinkUrl: /home, firstCancelEventUrl: undefined, clickedLinkMatchedBackButtonUrl: false, popStateEventUrl: undefined)\n// ###### Router Event: GuardsCheckEnd\n// GuardsCheckEnd(id: 6, url: '/home', urlAfterRedirects: '/home', state: Route(url:'', path:'') { Route(url:'home', path:'home') } , shouldActivate: false)\n// GuardsCheckEnd {id: 6, url: \"/home\", urlAfterRedirects: \"/home\", state: RouterStateSnapshot, shouldActivate: false}\n// ###### Router Event: NavigationCancel\n// NavigationCancel(id: 6, url: '/home')\n// NavigationCancel {id: 6, url: \"/home\", reason: \"\"}\n// logger.js:54 WaitUntilLinkTriggeredNavigationInteractionCancellationEventsFinish.onRouterCancelled\n// logger.js:19 args NavigationCancel {id: 6, url: \"/home\", reason: \"\"}\n// logger.js:39 Ignoring router event: NavigationCancel -> /home :: WaitUntilLinkTriggeredNavigationInteractionCancellationEventsFinish(idle: undefined, startingUrl: /activities/dialogs;l=en, clickedLinkUrl: /home, firstCancelEventUrl: /home, clickedLinkMatchedBackButtonUrl: true, popStateEventUrl: undefined)\n// logger.js:28 <-- WaitUntilLinkTriggeredNavigationInteractionCancellationEventsFinish.onRouterCancelled undefined\n// logger.js:54 WaitUntilLinkTriggeredNavigationInteractionCancellationEventsFinish.onRouterEnd\n// logger.js:19 args NavigationEnd {id: -1, url: \"\", urlAfterRedirects: \"\"}\n// logger.js:54 WaitUntilLinkTriggeredNavigationInteractionCancellationEventsFinish.finaliseRouting\n// logger.js:39 WORK-AROUND: Updating browser location after pop state - see angular issue #13586\n// navigation-session.ts:129 replacing /activities/dialogs;l=en with /home\n// navigation-session.ts:131 pushing /activities/dialogs;l=en back onto the history.\n// ????? place-router.ts:281 ### Router Session Finished (was WaitUntilLinkTriggeredNavigationInteractionCancellationEventsFinish(idle: undefined, startingUrl: /activities/dialogs;l=en, clickedLinkUrl: /home, firstCancelEventUrl: /home, clickedLinkMatchedBackButtonUrl: true, popStateEventUrl: undefined))\n// logger.js:28 <-- WaitUntilLinkTriggeredNavigationInteractionCancellationEventsFinish.finaliseRouting undefined\n// logger.js:28 <-- WaitUntilLinkTriggeredNavigationInteractionCancellationEventsFinish.onRouterEnd undefined\n// ###### Router Event: NavigationStart\n// NavigationStart(id: 7, url: '/home')\n// NavigationStart {id: 7, url: \"/home\", navigationTrigger: \"popstate\", restoredState: {…}}\n// logger.js:39 ### Router State Transition: null -> PopStateNavigation(startingUrl: /activities/dialogs;l=en, poppedHistoryUrl: /home)\n// ###### Router Event: RoutesRecognized\n// RoutesRecognized(id: 7, url: '/home', urlAfterRedirects: '/home', state: Route(url:'', path:'') { Route(url:'home', path:'home') } )\n// RoutesRecognized {id: 7, url: \"/home\", urlAfterRedirects: \"/home\", state: RouterStateSnapshot}\n// ###### Router Event: GuardsCheckStart\n// GuardsCheckStart(id: 7, url: '/home', urlAfterRedirects: '/home', state: Route(url:'', path:'') { Route(url:'home', path:'home') } )\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"WaitUntilLinkTriggeredNavigationInteractionCancellationTypeDetermined":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"./event-clean-up-session","name":"EventCleanUpSession","line":17,"character":91},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"../navigation-context","name":"NavigationContext","line":25,"character":23},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"string"}]}],"onRouterStarted":[{"__symbolic":"method"
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"WaitUntilLinkTriggeredNavigationInteractionCancellationTypeDetermined":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"./event-clean-up-session","name":"EventCleanUpSession","line":17,"character":91},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"../navigation-context","name":"NavigationContext","line":25,"character":23},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"string"}]}],"onRouterStarted":[{"__symbolic":"method"}],"onRouterCancelled":[{"__symbolic":"method"}],"canDeactivatePlace":[{"__symbolic":"method"}]}}}}]
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import { Directive } from '@angular/core';
|
|
3
3
|
import { ActivatedRouteSnapshot } from '@angular/router';
|
|
4
|
-
import { assert, Binding, DebugContext, Dsl, Guard, lang, MutableValueModel
|
|
4
|
+
import { assert, Binding, DebugContext, Dsl, Guard, lang, MutableValueModel } from '@coolon/pectin';
|
|
5
5
|
import { Klass } from '@coolon/typescript-utilities';
|
|
6
6
|
import { Memoize } from '@typescript-plus/fast-memoize-decorator';
|
|
7
7
|
import 'reflect-metadata';
|
|
8
8
|
import { DisposableComponent } from '../components/disposable-component';
|
|
9
9
|
import { PlaceDefinition } from './place-definition';
|
|
10
|
-
import { ParameterDefinition } from './route/parameter-definition';
|
|
11
|
-
import { Visit } from './visit';
|
|
12
10
|
// RAKE: making this Symbol(...) broke things.
|
|
13
11
|
export const DEFINITION_META_DATA_KEY = 'PLACE_DEFINITION_OPTIONS';
|
|
14
12
|
// this one seems ok.
|
|
@@ -23,6 +21,7 @@ export class PlaceComponent extends DisposableComponent {
|
|
|
23
21
|
when(this._active).becomesTruthy(() => this.onPlaceReady());
|
|
24
22
|
this.childPlaces = this.placeDefinition.children.map(d => d.component);
|
|
25
23
|
}
|
|
24
|
+
// @Trace()
|
|
26
25
|
initialiseVisit(visit, notifyVisitChanged) {
|
|
27
26
|
assert.isNil(this.visitModel.value);
|
|
28
27
|
const { when } = Dsl.disposeWith(this);
|
|
@@ -43,17 +42,18 @@ export class PlaceComponent extends DisposableComponent {
|
|
|
43
42
|
isInitialised() {
|
|
44
43
|
return !!this.visitModel.value;
|
|
45
44
|
}
|
|
45
|
+
// @Trace()
|
|
46
46
|
installBinding(parameterDef) {
|
|
47
47
|
const model = this[parameterDef.propertyName];
|
|
48
48
|
DebugContext.tag(model, `${this.placeDefinition.component.name}.${parameterDef.propertyName}`);
|
|
49
49
|
const binding = this.registerDisposable(new Binding(this.visitModel, model, {
|
|
50
50
|
toRight(visit) {
|
|
51
51
|
const value = visit.getParameter(parameterDef.name);
|
|
52
|
-
console.log('push to component', { name: parameterDef.name, value, visit });
|
|
52
|
+
// console.log('push to component', { name: parameterDef.name, value, visit });
|
|
53
53
|
return value;
|
|
54
54
|
},
|
|
55
55
|
toLeft(value, currentVisit) {
|
|
56
|
-
console.log('push to route', { name: parameterDef.name, value, currentVisit });
|
|
56
|
+
// console.log('push to route', { name: parameterDef.name, value, currentVisit });
|
|
57
57
|
return currentVisit.replace(parameterDef, value);
|
|
58
58
|
}
|
|
59
59
|
}));
|
|
@@ -78,18 +78,6 @@ PlaceComponent.decorators = [
|
|
|
78
78
|
{ type: Directive }
|
|
79
79
|
];
|
|
80
80
|
PlaceComponent.ctorParameters = () => [];
|
|
81
|
-
__decorate([
|
|
82
|
-
Trace(),
|
|
83
|
-
__metadata("design:type", Function),
|
|
84
|
-
__metadata("design:paramtypes", [Visit, Function]),
|
|
85
|
-
__metadata("design:returntype", void 0)
|
|
86
|
-
], PlaceComponent.prototype, "initialiseVisit", null);
|
|
87
|
-
__decorate([
|
|
88
|
-
Trace(),
|
|
89
|
-
__metadata("design:type", Function),
|
|
90
|
-
__metadata("design:paramtypes", [ParameterDefinition]),
|
|
91
|
-
__metadata("design:returntype", void 0)
|
|
92
|
-
], PlaceComponent.prototype, "installBinding", null);
|
|
93
81
|
__decorate([
|
|
94
82
|
Memoize(),
|
|
95
83
|
__metadata("design:type", PlaceDefinition),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"place-component.js","sourceRoot":"","sources":["../../../../../../libs/angular-ui-powerups/src/lib/place/place-component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EACL,MAAM,EACN,OAAO,EAEP,YAAY,EACZ,GAAG,EACH,KAAK,EAEL,IAAI,EACJ,iBAAiB,
|
|
1
|
+
{"version":3,"file":"place-component.js","sourceRoot":"","sources":["../../../../../../libs/angular-ui-powerups/src/lib/place/place-component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EACL,MAAM,EACN,OAAO,EAEP,YAAY,EACZ,GAAG,EACH,KAAK,EAEL,IAAI,EACJ,iBAAiB,EAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AAClE,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAEzE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAIrD,8CAA8C;AAC9C,MAAM,CAAC,MAAM,wBAAwB,GAAG,0BAA0B,CAAC;AACnE,qBAAqB;AACrB,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,wBAAwB,CAAC,CAAC;AAGzE,MAAM,OAAO,cAAe,SAAQ,mBAAmB;IAWrD;QACE,KAAK,EAAE,CAAC;QAVF,eAAU,GAAG,IAAI,iBAAiB,EAAS,CAAC;QAC5C,mBAAc,GAAG,IAAI,KAAK,EAA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ular/core';\nimport { ActivatedRouteSnapshot } from '@angular/router';\nimport {\n assert,\n Binding,\n Constructable,\n DebugContext,\n Dsl,\n Guard,\n IMutableHasValue,\n lang,\n MutableValueModel, Trace\n} from '@coolon/pectin';\nimport { Klass } from '@coolon/typescript-utilities';\nimport { Memoize } from '@typescript-plus/fast-memoize-decorator';\nimport 'reflect-metadata';\nimport { DisposableComponent } from '../components/disposable-component';\nimport { InteractionContext } from '../interaction/interaction-context';\nimport { PlaceDefinition } from './place-definition';\nimport { ParameterDefinition } from './route/parameter-definition';\nimport { Visit } from './visit';\n\n// RAKE: making this Symbol(...) broke things.\nexport const DEFINITION_META_DATA_KEY = 'PLACE_DEFINITION_OPTIONS';\n// this one seems ok.\nexport const ROUTE_PARAMETER_LIST_KEY = Symbol('place:route:parameters');\n\n@Directive()\nexport class PlaceComponent extends DisposableComponent {\n\n private visitModel = new MutableValueModel<Visit>();\n private _inVisitUpdate = new Guard();\n private _active = new MutableValueModel<boolean>(false);\n\n interactionContext?: InteractionContext;\n readonly childPlaces: ReadonlyArray<Constructable<PlaceComponent>>;\n\n canDeactivate?(interactionContext: InteractionContext): boolean | Promise<boolean>;\n\n constructor() {\n super();\n const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);\n when(this._active).becomesTruthy(() => this.onPlaceReady());\n this.childPlaces = this.placeDefinition.children.map(d => d.component);\n }\n\n // @Trace()\n public initialiseVisit(visit: Visit, notifyVisitChanged: (current: Visit, previous: Visit) => void) {\n assert.isNil(this.visitModel.value);\n\n const { when } = Dsl.disposeWith(this);\n\n this.visitModel.value = visit;\n DebugContext.getOrCreate(this.visitModel).tag(`${this.placeDefinition.component.name}.visitModel`);\n this.placeDefinition.getVisitParameterDefs().forEach(parameterDef => this.installBinding(parameterDef));\n when(this.visitModel).changes((current, previous) => {\n notifyVisitChanged(current, previous);\n }, { unless: this._inVisitUpdate });\n }\n\n public updateVisit(visit: Visit) {\n assert.isTruthy(this.isInitialised());\n assert.notNil(visit);\n this._inVisitUpdate.whileTrue(() => {\n this.visitModel.value = visit;\n });\n }\n\n isInitialised() {\n return !!this.visitModel.value;\n }\n\n // @Trace()\n private installBinding<T, S>(parameterDef: ParameterDefinition<T, S>) {\n const model = this[parameterDef.propertyName] as IMutableHasValue<S>;\n DebugContext.tag(model, `${this.placeDefinition.component.name}.${parameterDef.propertyName}`);\n const binding = this.registerDisposable(new Binding(this.visitModel, model, {\n toRight(visit: Visit): S {\n const value = visit.getParameter(parameterDef.name);\n // console.log('push to component', { name: parameterDef.name, value, visit });\n return value;\n },\n toLeft(value: S, currentVisit?: Visit): Visit {\n // console.log('push to route', { name: parameterDef.name, value, currentVisit });\n return currentVisit.replace(parameterDef, value);\n }\n }));\n\n binding.writeRight();\n }\n\n @Memoize()\n get placeDefinition(): PlaceDefinition {\n return PlaceComponent.getDefinition(this.constructor as any as Constructable<PlaceComponent>);\n }\n\n get active() {\n return this._active.readonly;\n }\n\n /**\n * Called by the router when the place is ready to interact after any animations have run.\n */\n _notifyActive(active: boolean) {\n this._active.value = active;\n }\n\n onPlaceReady() {\n }\n\n}\n\nexport namespace PlaceComponent {\n\n export function isPlaceComponentConstructor(target: any): target is Constructable<PlaceComponent> {\n return lang.constructorChain(target as Constructable<any>).includes(PlaceComponent);\n }\n\n export function getRouteParameters(klass: Constructable<PlaceComponent>): ParameterDefinition<any>[] {\n return Klass.get(klass).getMetadataList(ROUTE_PARAMETER_LIST_KEY) as ParameterDefinition<any>[];\n }\n\n export function getDefinition(snapshotOrConstructor: ActivatedRouteSnapshot | Constructable<PlaceComponent>): PlaceDefinition {\n if (snapshotOrConstructor instanceof ActivatedRouteSnapshot) {\n const component = snapshotOrConstructor.component;\n if (!isPlaceComponentConstructor(component)) {\n throw new Error(`ActivatedRouteSnapshot component is not a PlaceComponent, got ${component}`);\n }\n return Reflect.getMetadata(DEFINITION_META_DATA_KEY, component)\n } else {\n return Reflect.getMetadata(DEFINITION_META_DATA_KEY, snapshotOrConstructor);\n }\n }\n\n export function injectDefinition(klass: Constructable<PlaceComponent>, definition: PlaceDefinition) {\n Reflect.defineMetadata(DEFINITION_META_DATA_KEY, definition, klass);\n }\n\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"DEFINITION_META_DATA_KEY":"PLACE_DEFINITION_OPTIONS","ROUTE_PARAMETER_LIST_KEY":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"Symbol"},"arguments":["place:route:parameters"]},"PlaceComponent":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../components/disposable-component","name":"DisposableComponent","line":28,"character":36},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":27,"character":1}}],"members":{"canDeactivate":[{"__symbolic":"method"}],"__ctor__":[{"__symbolic":"constructor"}],"initialiseVisit":[{"__symbolic":"method"
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"DEFINITION_META_DATA_KEY":"PLACE_DEFINITION_OPTIONS","ROUTE_PARAMETER_LIST_KEY":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"Symbol"},"arguments":["place:route:parameters"]},"PlaceComponent":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../components/disposable-component","name":"DisposableComponent","line":28,"character":36},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":27,"character":1}}],"members":{"canDeactivate":[{"__symbolic":"method"}],"__ctor__":[{"__symbolic":"constructor"}],"initialiseVisit":[{"__symbolic":"method"}],"updateVisit":[{"__symbolic":"method"}],"isInitialised":[{"__symbolic":"method"}],"installBinding":[{"__symbolic":"method"}],"placeDefinition":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@typescript-plus/fast-memoize-decorator","name":"Memoize","line":91,"character":3}}]}],"_notifyActive":[{"__symbolic":"method"}],"onPlaceReady":[{"__symbolic":"method"}]}}}}]
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { __awaiter
|
|
2
|
-
import { Injector } from '@angular/core';
|
|
3
|
-
import { Trace } from '@coolon/pectin';
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
4
2
|
import { Opts } from '@coolon/typescript-utilities';
|
|
5
3
|
import _ from 'lodash';
|
|
6
|
-
import { PlaceHistory } from '../place-history';
|
|
7
|
-
import { Visit } from '../visit';
|
|
8
4
|
export class ParameterDefinition {
|
|
9
5
|
constructor(propertyName, options, urlFormat) {
|
|
10
6
|
this.propertyName = propertyName;
|
|
@@ -23,6 +19,7 @@ export class ParameterDefinition {
|
|
|
23
19
|
getOptionValue(key) {
|
|
24
20
|
return this.options.getOptional(key, null);
|
|
25
21
|
}
|
|
22
|
+
// @Trace()
|
|
26
23
|
sanitise(value, visit, placeHistory, injector, isPopState) {
|
|
27
24
|
return __awaiter(this, void 0, void 0, function* () {
|
|
28
25
|
if (this.isMissingFrom(visit)) {
|
|
@@ -43,12 +40,6 @@ export class ParameterDefinition {
|
|
|
43
40
|
return !visit.hasParameter(this.name);
|
|
44
41
|
}
|
|
45
42
|
}
|
|
46
|
-
__decorate([
|
|
47
|
-
Trace(),
|
|
48
|
-
__metadata("design:type", Function),
|
|
49
|
-
__metadata("design:paramtypes", [Object, Visit, PlaceHistory, Injector, Boolean]),
|
|
50
|
-
__metadata("design:returntype", Promise)
|
|
51
|
-
], ParameterDefinition.prototype, "sanitise", null);
|
|
52
43
|
(function (ParameterDefinition) {
|
|
53
44
|
class RouteId extends ParameterDefinition {
|
|
54
45
|
constructor() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parameter-definition.js","sourceRoot":"","sources":["../../../../../../../libs/angular-ui-powerups/src/lib/place/route/parameter-definition.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"parameter-definition.js","sourceRoot":"","sources":["../../../../../../../libs/angular-ui-powerups/src/lib/place/route/parameter-definition.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,8B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AC,KAAU;YACrB,OAAO,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;QAC5C,CAAC;QAED,UAAU,CAAC,CAAM,EAAE,CAAM;YACvB,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC1B,CAAC;KAEF;IAhBY,kCAAc,iBAgB1B,CAAA;AACH,CAAC,EArDgB,mBAAmB,KAAnB,mBAAmB,QAqDnC","sourcesContent":["import { Injector } from '@angular/core';\nimport { Trace } from '@coolon/pectin';\nimport { Opts } from '@coolon/typescript-utilities';\nimport _ from 'lodash';\nimport { PlaceHistory } from '../place-history';\nimport { Visit } from '../visit';\nimport { Formatter } from './formatter';\n\nexport abstract class ParameterDefinition<T, E = T> {\n\n abstract readonly isRouteId: boolean;\n abstract readonly isArray: boolean;\n\n readonly remember: boolean;\n readonly defaultValue: T;\n private options: Opts<ParameterDefinition.Options<T>>;\n\n constructor(readonly propertyName: string, options: ParameterDefinition.Options<T>, readonly urlFormat?: Formatter<E>) {\n this.options = Opts.get(options);\n this.remember = this.options.getOptional('remember', false);\n this.defaultValue = this.options.getOptional('defaultValue', null);\n }\n\n get name() {\n return this.options.getOptional('as', this.propertyName);\n }\n\n // @Trace()\n get isRouteParameter(): boolean {\n return !!this.urlFormat;\n }\n\n abstract isEmptyValue(value: T): boolean;\n\n abstract hasChanged(a: any, b: any): boolean;\n\n protected getOptionValue<K extends keyof ParameterDefinition.Options<T>>(key: K): ParameterDefinition.Options<T>[K] {\n return this.options.getOptional(key, null);\n }\n\n // @Trace()\n async sanitise(value:T, visit: Visit, placeHistory: PlaceHistory, injector: Injector, isPopState: boolean) {\n if (this.isMissingFrom(visit)) {\n const returningFromSomewhereElse = !placeHistory.lastVisitIncluded(visit.placeDefinition);\n if (returningFromSomewhereElse) {\n const lastKnownVisit = placeHistory.getMostRecentVisitFor(visit.placeDefinition);\n if (this.remember && lastKnownVisit) {\n value = lastKnownVisit.getParameter(this.name);\n }\n return this.isEmptyValue(value) ? this.defaultValue : value;\n }\n }\n // todo: add custom sanitiser\n return value;\n }\n\n private isMissingFrom(visit: Visit) {\n return !visit.hasParameter(this.name);\n }\n}\n\nexport namespace ParameterDefinition {\n\n export interface Options<T> {\n as?: string;\n optional?: boolean;\n remember?: boolean;\n defaultValue?: T;\n // sanitiser?: Constructable<ParameterSanitiser<T>> | ParameterSanitiser.Options<T>;\n }\n\n export class RouteId<T> extends ParameterDefinition<T> {\n readonly isRouteId = true;\n readonly isArray = false;\n\n isEmptyValue(value: T): boolean {\n return _.isNil(value);\n }\n\n hasChanged(a: any, b: any): boolean {\n return a !== b;\n }\n }\n\n export class ValueParameter<T> extends ParameterDefinition<T> {\n readonly isRouteId = false;\n readonly isArray = false;\n\n isEmptyValue(value: T): boolean {\n return _.isNil(value);\n }\n\n hasChanged(a: any, b: any): boolean {\n return a !== b;\n }\n }\n\n export class ArrayParameter<T> extends ParameterDefinition<T[], T> {\n readonly isRouteId = false;\n readonly isArray = true;\n\n constructor(parameterName: string, options: Options<T[]>, urlFormat: Formatter<T>) {\n super(parameterName, options, urlFormat);\n }\n\n isEmptyValue(value: T[]): boolean {\n return _.isNil(value) || value.length < 1;\n }\n\n hasChanged(a: T[], b: T[]): boolean {\n return !_.isEqual(a, b);\n }\n\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"ParameterDefinition":{"__symbolic":"class","arity":2,"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"string"},{"__symbolic":"select","expression":{"__symbolic":"reference","name":"ParameterDefinition"},"member":"Options","arguments":[{"__symbolic":"error","message":"Could not resolve type","line":17,"character":82,"context":{"typeName":"T"}}]},{"__symbolic":"reference","module":"./formatter","name":"Formatter","line":17,"character":107,"arguments":[{"__symbolic":"error","message":"Could not resolve type","line":17,"character":117,"context":{"typeName":"E"}}]}]}],"isEmptyValue":[{"__symbolic":"method"}],"hasChanged":[{"__symbolic":"method"}],"getOptionValue":[{"__symbolic":"method"}],"sanitise":[{"__symbolic":"method"
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"ParameterDefinition":{"__symbolic":"class","arity":2,"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"string"},{"__symbolic":"select","expression":{"__symbolic":"reference","name":"ParameterDefinition"},"member":"Options","arguments":[{"__symbolic":"error","message":"Could not resolve type","line":17,"character":82,"context":{"typeName":"T"}}]},{"__symbolic":"reference","module":"./formatter","name":"Formatter","line":17,"character":107,"arguments":[{"__symbolic":"error","message":"Could not resolve type","line":17,"character":117,"context":{"typeName":"E"}}]}]}],"isEmptyValue":[{"__symbolic":"method"}],"hasChanged":[{"__symbolic":"method"}],"getOptionValue":[{"__symbolic":"method"}],"sanitise":[{"__symbolic":"method"}],"isMissingFrom":[{"__symbolic":"method"}]}}}}]
|