@coolon/angular-ui-powerups 12.0.0-alpha.1 → 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 +20 -23
- package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
- package/coolon-angular-ui-powerups.metadata.json +1 -1
- package/esm2015/lib/place/exports.js +1 -1
- package/esm2015/lib/place/exports.js.map +1 -1
- package/esm2015/lib/place/exports.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.map +1 -1
- package/esm2015/lib/place/place-definition.js +1 -1
- package/esm2015/lib/place/place-definition.js.map +1 -1
- package/esm2015/lib/place/place-definition.metadata.json +1 -1
- package/esm2015/lib/place/route/parameter-decorators.js +19 -12
- package/esm2015/lib/place/route/parameter-decorators.js.map +1 -1
- package/esm2015/lib/place/route/parameter-decorators.metadata.json +1 -1
- package/esm2015/lib/place/route/{parameter-definition.class.js → parameter-definition.js} +1 -1
- package/esm2015/lib/place/route/parameter-definition.js.map +1 -0
- package/esm2015/lib/place/route/parameter-snapshot.js.map +1 -1
- package/esm2015/lib/place/visit.js.map +1 -1
- package/fesm2015/coolon-angular-ui-powerups.js +22 -25
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/place/exports.d.ts +1 -1
- package/lib/place/place-component.d.ts +1 -1
- package/lib/place/place-definition.d.ts +1 -1
- package/lib/place/route/parameter-snapshot.d.ts +1 -1
- package/lib/place/visit.d.ts +1 -1
- package/package.json +2 -2
- package/schematics/activity/templates/component/__name@dasherize__.component.html.template +5 -1
- package/schematics/activity/templates/component/__name@dasherize__.component.scss.template +0 -1
- package/schematics/activity/templates/component/__name@dasherize__.component.ts.template +7 -0
- package/esm2015/lib/place/route/parameter-definition.class.js.map +0 -1
- /package/esm2015/lib/place/route/{parameter-definition.class.metadata.json → parameter-definition.metadata.json} +0 -0
- /package/lib/place/route/{parameter-definition.class.d.ts → parameter-definition.d.ts} +0 -0
|
@@ -40,7 +40,7 @@ export * from "./navigation/session/interactions/synchronise-interaction-context
|
|
|
40
40
|
export * from "./route/formatter";
|
|
41
41
|
export * from "./route/json-types";
|
|
42
42
|
export * from "./route/parameter-decorators";
|
|
43
|
-
export * from "./route/parameter-definition
|
|
43
|
+
export * from "./route/parameter-definition";
|
|
44
44
|
export * from "./route/parameter-sanitiser";
|
|
45
45
|
export * from "./route/parameter-snapshot";
|
|
46
46
|
export * from "./route/visit-sanitiser";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../../../../../../libs/angular-ui-powerups/src/lib/place/exports.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,kDAAkD,CAAC;AACjE,cAAc,sDAAsD,CAAC;AACrE,cAAc,oEAAoE,CAAC;AACnF,cAAc,kDAAkD,CAAC;AACjE,cAAc,4CAA4C,CAAC;AAC3D,cAAc,oEAAoE,CAAC;AACnF,cAAc,wEAAwE,CAAC;AACvF,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,sBAAsB,CAAC;AACrC,cAAc,mDAAmD,CAAC;AAClE,cAAc,oDAAoD,CAAC;AACnE,cAAc,iCAAiC,CAAC;AAChD,cAAc,yCAAyC,CAAC;AACxD,cAAc,yCAAyC,CAAC;AACxD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,2DAA2D,CAAC;AAC1E,cAAc,wFAAwF,CAAC;AACvG,cAAc,iHAAiH,CAAC;AAChI,cAAc,kGAAkG,CAAC;AACjH,cAAc,iEAAiE,CAAC;AAChF,cAAc,2EAA2E,CAAC;AAC1F,cAAc,uFAAuF,CAAC;AACtG,cAAc,kFAAkF,CAAC;AACjG,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,
|
|
1
|
+
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../../../../../../libs/angular-ui-powerups/src/lib/place/exports.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,kDAAkD,CAAC;AACjE,cAAc,sDAAsD,CAAC;AACrE,cAAc,oEAAoE,CAAC;AACnF,cAAc,kDAAkD,CAAC;AACjE,cAAc,4CAA4C,CAAC;AAC3D,cAAc,oEAAoE,CAAC;AACnF,cAAc,wEAAwE,CAAC;AACvF,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,sBAAsB,CAAC;AACrC,cAAc,mDAAmD,CAAC;AAClE,cAAc,oDAAoD,CAAC;AACnE,cAAc,iCAAiC,CAAC;AAChD,cAAc,yCAAyC,CAAC;AACxD,cAAc,yCAAyC,CAAC;AACxD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,2DAA2D,CAAC;AAC1E,cAAc,wFAAwF,CAAC;AACvG,cAAc,iHAAiH,CAAC;AAChI,cAAc,kGAAkG,CAAC;AACjH,cAAc,iEAAiE,CAAC;AAChF,cAAc,2EAA2E,CAAC;AAC1F,cAAc,uFAAuF,CAAC;AACtG,cAAc,kFAAkF,CAAC;AACjG,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC","sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from \"./nav-item\";\nexport * from \"./place-access-guard\";\nexport * from \"./place-component\";\nexport * from \"./place-config\";\nexport * from \"./place-definition\";\nexport * from \"./place-history\";\nexport * from \"./place-router\";\nexport * from \"./place.decorator\";\nexport * from \"./place.module\";\nexport * from \"./url-service\";\nexport * from \"./url-snapshot\";\nexport * from \"./visit\";\nexport * from \"./components/abstract-place-navigation.component\";\nexport * from \"./components/list-place-nav/list-place-nav.component\";\nexport * from \"./components/not-authorised-notice/not-authorised-notice.component\";\nexport * from \"./components/place-outlet/place-outlet.component\";\nexport * from \"./components/place-outlet/route-animations\";\nexport * from \"./components/side-place-navigation/side-place-navigation.component\";\nexport * from \"./components/tabbed-place-navigation/tabbed-place-navigation.component\";\nexport * from \"./guards/consolidated-param-map\";\nexport * from \"./guards/noop-auth-guard.service\";\nexport * from \"./guards/place.guard\";\nexport * from \"./navigation/place-component-deactivation-handler\";\nexport * from \"./navigation/session/abstract-pop-state-navigation\";\nexport * from \"./navigation/session/navigating\";\nexport * from \"./navigation/session/navigation-context\";\nexport * from \"./navigation/session/navigation-session\";\nexport * from \"./navigation/session/pop-state-navigation\";\nexport * from \"./navigation/session/event-cleanup/event-clean-up-session\";\nexport * from \"./navigation/session/event-cleanup/wait-until-leaving-interaction-transition-cancelled\";\nexport * from \"./navigation/session/event-cleanup/wait-until-link-triggered-navigation-interaction-cancelation-type-determined\";\nexport * from \"./navigation/session/event-cleanup/wait-until-popstate-during-can-deactivate-transition-finishes\";\nexport * from \"./navigation/session/interactions/navigating-during-interaction\";\nexport * from \"./navigation/session/interactions/pop-state-during-interaction-navigation\";\nexport * from \"./navigation/session/interactions/remove-last-interaction-from-url-navigation-session\";\nexport * from \"./navigation/session/interactions/synchronise-interaction-context-ids-with-route\";\nexport * from \"./route/formatter\";\nexport * from \"./route/json-types\";\nexport * from \"./route/parameter-decorators\";\nexport * from \"./route/parameter-definition\";\nexport * from \"./route/parameter-sanitiser\";\nexport * from \"./route/parameter-snapshot\";\nexport * from \"./route/visit-sanitiser\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{},"exports":[{"from":"./nav-item"},{"from":"./place-access-guard"},{"from":"./place-component"},{"from":"./place-config"},{"from":"./place-definition"},{"from":"./place-history"},{"from":"./place-router"},{"from":"./place.decorator"},{"from":"./place.module"},{"from":"./url-service"},{"from":"./url-snapshot"},{"from":"./visit"},{"from":"./components/abstract-place-navigation.component"},{"from":"./components/list-place-nav/list-place-nav.component"},{"from":"./components/not-authorised-notice/not-authorised-notice.component"},{"from":"./components/place-outlet/place-outlet.component"},{"from":"./components/place-outlet/route-animations"},{"from":"./components/side-place-navigation/side-place-navigation.component"},{"from":"./components/tabbed-place-navigation/tabbed-place-navigation.component"},{"from":"./guards/consolidated-param-map"},{"from":"./guards/noop-auth-guard.service"},{"from":"./guards/place.guard"},{"from":"./navigation/place-component-deactivation-handler"},{"from":"./navigation/session/abstract-pop-state-navigation"},{"from":"./navigation/session/navigating"},{"from":"./navigation/session/navigation-context"},{"from":"./navigation/session/navigation-session"},{"from":"./navigation/session/pop-state-navigation"},{"from":"./navigation/session/event-cleanup/event-clean-up-session"},{"from":"./navigation/session/event-cleanup/wait-until-leaving-interaction-transition-cancelled"},{"from":"./navigation/session/event-cleanup/wait-until-link-triggered-navigation-interaction-cancelation-type-determined"},{"from":"./navigation/session/event-cleanup/wait-until-popstate-during-can-deactivate-transition-finishes"},{"from":"./navigation/session/interactions/navigating-during-interaction"},{"from":"./navigation/session/interactions/pop-state-during-interaction-navigation"},{"from":"./navigation/session/interactions/remove-last-interaction-from-url-navigation-session"},{"from":"./navigation/session/interactions/synchronise-interaction-context-ids-with-route"},{"from":"./route/formatter"},{"from":"./route/json-types"},{"from":"./route/parameter-decorators"},{"from":"./route/parameter-definition
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{},"exports":[{"from":"./nav-item"},{"from":"./place-access-guard"},{"from":"./place-component"},{"from":"./place-config"},{"from":"./place-definition"},{"from":"./place-history"},{"from":"./place-router"},{"from":"./place.decorator"},{"from":"./place.module"},{"from":"./url-service"},{"from":"./url-snapshot"},{"from":"./visit"},{"from":"./components/abstract-place-navigation.component"},{"from":"./components/list-place-nav/list-place-nav.component"},{"from":"./components/not-authorised-notice/not-authorised-notice.component"},{"from":"./components/place-outlet/place-outlet.component"},{"from":"./components/place-outlet/route-animations"},{"from":"./components/side-place-navigation/side-place-navigation.component"},{"from":"./components/tabbed-place-navigation/tabbed-place-navigation.component"},{"from":"./guards/consolidated-param-map"},{"from":"./guards/noop-auth-guard.service"},{"from":"./guards/place.guard"},{"from":"./navigation/place-component-deactivation-handler"},{"from":"./navigation/session/abstract-pop-state-navigation"},{"from":"./navigation/session/navigating"},{"from":"./navigation/session/navigation-context"},{"from":"./navigation/session/navigation-session"},{"from":"./navigation/session/pop-state-navigation"},{"from":"./navigation/session/event-cleanup/event-clean-up-session"},{"from":"./navigation/session/event-cleanup/wait-until-leaving-interaction-transition-cancelled"},{"from":"./navigation/session/event-cleanup/wait-until-link-triggered-navigation-interaction-cancelation-type-determined"},{"from":"./navigation/session/event-cleanup/wait-until-popstate-during-can-deactivate-transition-finishes"},{"from":"./navigation/session/interactions/navigating-during-interaction"},{"from":"./navigation/session/interactions/pop-state-during-interaction-navigation"},{"from":"./navigation/session/interactions/remove-last-interaction-from-url-navigation-session"},{"from":"./navigation/session/interactions/synchronise-interaction-context-ids-with-route"},{"from":"./route/formatter"},{"from":"./route/json-types"},{"from":"./route/parameter-decorators"},{"from":"./route/parameter-definition"},{"from":"./route/parameter-sanitiser"},{"from":"./route/parameter-snapshot"},{"from":"./route/visit-sanitiser"}]}]
|
|
@@ -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,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAIvC,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,qBAAq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,WAAW;IACX,iBAAiB,CAAC,KAAuB;QACvC,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACzB,IAAI,CAAC,eAAe,EAAE,CAAC;SACxB;IACH,CAAC;IAED,WAAW;IACX,eAAe;QACb,IAAI,CAAC,gDAAgD,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAC7F,OAAO,IAAI,CAAC,OAAO,CAAC,oBAAoB,EAAE,CAAC;IAC7C,CAAC;IAEK,kBAAkB,CAAC,SAAyB,EAAE,UAAuB,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
|
+
{"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,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,8BAA8B,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC;SACpH;aAAM;YACL,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,qCAAqC,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC;SAC3H;IACH,CAAC;IAEK,kBAAkB,CAAC,SAAyB,EAAE,UAAuB,EAAE,OAAoB;;YAC/F,OAAO,KAAK,CAAC;QACf,CAAC;KAAA;C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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 +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,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,EAAE,CAAC;QAC7B,YAAO,GAAG,IAAI,iBAAiB,CAAU,KAAK,CAAC,CAAC;QAStD,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACzF,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;QAC5D,IAAI,CAAC,WAAW,GAAG,IAAI,CA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,0CAA2B,8BAE1C,CAAA;IAED,SAAgB,kBAAkB,CAAC,KAAoC;QACrE,OAAO,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,eAAe,CAAC,wBAAwB,CAA+B,CAAC;IAClG,CAAC;IAFe,iCAAkB,qBAEjC,CAAA;IAED,SAAgB,aAAa,CAAC,qBAA6E;QACzG,IAAI,qBAAqB,YAAY,sBAAsB,EAAE;YAC3D,MAAM,SAAS,GAAG,qBAAqB,CAAC,SAAS,CAAC;YAClD,IAAI,CAAC,2BAA2B,CAAC,SAAS,CAAC,EAAE;gBAC3C,MAAM,IAAI,KAAK,CAAC,iEAAiE,SAAS,EAAE,CAAC,CAAC;aAC/F;YACD,OAAO,OAAO,CAAC,WAAW,CAAC,wBAAwB,EAAE,SAAS,CAAC,CAAA;SAChE;aAAM;YACL,OAAO,OAAO,CAAC,WAAW,CAAC,wBAAwB,EAAE,qBAAqB,CAAC,CAAC;SAC7E;IACH,CAAC;IAVe,4BAAa,gBAU5B,CAAA;IAED,SAAgB,gBAAgB,CAAC,KAAoC,EAAE,UAA2B;QAChG,OAAO,CAAC,cAAc,CAAC,wBAAwB,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;IACtE,CAAC;IAFe,+BAAgB,mBAE/B,CAAA;AAEH,CAAC,EA1BgB,cAAc,KAAd,cAAc,QA0B9B","sourcesContent":["import { Directive } from '@angular/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\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
|
|
1
|
+
{"version":3,"file":"place-component.js","sourceRo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gB,kBAAkB,CAAC,KAAoC;QACrE,OAAO,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,eAAe,CAAC,wBAAwB,CAA+B,CAAC;IAClG,CAAC;IAFe,iCAAkB,qBAEjC,CAAA;IAED,SAAgB,aAAa,CAAC,qBAA6E;QACzG,IAAI,qBAAqB,YAAY,sBAAsB,EAAE;YAC3D,MAAM,SAAS,GAAG,qBAAqB,CAAC,SAAS,CAAC;YAClD,IAAI,CAAC,2BAA2B,CAAC,SAAS,CAAC,EAAE;gBAC3C,MAAM,IAAI,KAAK,CAAC,iEAAiE,SAAS,EAAE,CAAC,CAAC;aAC/F;YACD,OAAO,OAAO,CAAC,WAAW,CAAC,wBAAwB,EAAE,SAAS,CAAC,CAAA;SAChE;aAAM;YACL,OAAO,OAAO,CAAC,WAAW,CAAC,wBAAwB,EAAE,qBAAqB,CAAC,CAAC;SAC7E;IACH,CAAC;IAVe,4BAAa,gBAU5B,CAAA;IAED,SAAgB,gBAAgB,CAAC,KAAoC,EAAE,UAA2B;QAChG,OAAO,CAAC,cAAc,CAAC,wBAAwB,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;IACtE,CAAC;IAFe,+BAAgB,mBAE/B,CAAA;AAEH,CAAC,EA1BgB,cAAc,KAAd,cAAc,QA0B9B","sourcesContent":["import { Directive } from '@angular/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"]}
|
|
@@ -3,7 +3,7 @@ import { assert } from '@coolon/pectin';
|
|
|
3
3
|
import { Opts } from '@coolon/typescript-utilities';
|
|
4
4
|
import { Memoize } from '@typescript-plus/fast-memoize-decorator/dist/src';
|
|
5
5
|
import _ from 'lodash';
|
|
6
|
-
import { ParameterDefinition } from './route/parameter-definition
|
|
6
|
+
import { ParameterDefinition } from './route/parameter-definition';
|
|
7
7
|
export class PlaceDefinition {
|
|
8
8
|
constructor(component, path, authenticate, role, data, routeParameters, children) {
|
|
9
9
|
this.component = component;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"place-definition.js","sourceRoot":"","sources":["../../../../../../libs/angular-ui-powerups/src/lib/place/place-definition.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAwB,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,kDAAkD,CAAC;AAC3E,OAAO,CAAC,MAAM,QAAQ,CAAC;AAEvB,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAGzE,MAAM,OAAO,eAAe;IAE1B,YAAqB,SAAwC,EACxC,IAAY,EACZ,YAAqB,EACrB,IAAS,EACT,IAA4B,EAC5B,eAA2C,EAC3C,QAA2B;QAN3B,cAAS,GAAT,SAAS,CAA+B;QACxC,SAAI,GAAJ,IAAI,CAAQ;QACZ,iBAAY,GAAZ,YAAY,CAAS;QACrB,SAAI,GAAJ,IAAI,CAAK;QACT,SAAI,GAAJ,IAAI,CAAwB;QAC5B,oBAAe,GAAf,eAAe,CAA4B;QAC3C,aAAQ,GAAR,QAAQ,CAAmB;IAChD,CAAC;IAED,UAAU;QACR,OAAO,CAAC,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC;IACzC,CAAC;IAGD,sBAAsB;QACpB,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACrD,CAAC;IAGD,qBAAqB,CAAC,cAAc,GAAG,KAAK;QAC1C,OAAO,IAAI,CAAC,qBAAqB,CAAC,EAAE,cAAc,EAAE,sBAAsB,EAAE,IAAI,EAAE,CAAC,CAAC;IACtF,CAAC;IAGD,qBAAqB,CAAC,OAA0C;QAC9D,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC/B,W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E,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;iBAC5D;qBAAM;oBACL,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;oBACnC,IAAI,GAAG,CAAC,SAAS,EAAE,EAAE,8DAA8D;wBACjF,6EAA6E;wBAC7E,wFAAwF;wBACxF,0EAA0E;wBAC1E,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;4BACrB,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;yBAC/C;qBACF;yBAAM;wBACL,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;qBAC/C;iBACF;aACF;QACH,CAAC,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;CAEF;AAjHC;IADC,OAAO,EAAE;;;oCACgB,mBAAmB;6DAE5C;AAGD;IADC,OAAO,EAAE;;;;4DAGT;AAGD;IADC,OAAO,EAAE;;;;4DAYT","sourcesContent":["import { ParamMap } from '@angular/router';\nimport { assert, Constructable, Trace } from '@coolon/pectin';\nimport { Opts } from '@coolon/typescript-utilities';\nimport { Memoize } from '@typescript-plus/fast-memoize-decorator/dist/src';\nimport _ from 'lodash';\nimport { PlaceComponent } from './place-component';\nimport { ParameterDefinition } from './route/parameter-definition.class';\nimport { Visit } from './visit';\n\nexport class PlaceDefinition {\n\n constructor(readonly component: Constructable<PlaceComponent>,\n readonly path: string,\n readonly authenticate: boolean,\n readonly role: any,\n readonly data: { [key: string]: any },\n readonly routeParameters: ParameterDefinition<any>[],\n readonly children: PlaceDefinition[]) {\n }\n\n hasRouteId() {\n return !!this.getRouteIdParameterDef();\n }\n\n @Memoize()\n getRouteIdParameterDef(): ParameterDefinition<any> {\n return this.routeParameters.find(p => p.isRouteId);\n }\n\n @Memoize()\n getRouteParameterDefs(includeRouteId = false): ParameterDefinition<any>[] {\n return this.getVisitParameterDefs({ includeRouteId, includeRouteParameters: true });\n }\n\n @Memoize()\n getVisitParameterDefs(include?: PlaceDefinition.ParameterOptions): ParameterDefinition<any>[] {\n const opts = Opts.get(include);\n // includes\n const includeRouteId = !include || opts.getOptional('includeRouteId', false);\n const includeRouteParameters = !include || opts.getOptional('includeRouteParameters', false);\n const includeNonRouteParameters = !include || opts.getOptional('includeNonRouteParameters', false);\n return this.routeParameters.filter(p => {\n return (includeRouteId && p.isRouteId)\n || (includeRouteParameters && p.isRouteParameter && !p.isRouteId) // route id is included in the line above\n || (includeNonRouteParameters && !p.isRouteParameter);\n });\n }\n\n getPlaceData<T>(key: string, defaultValue?: T): T {\n return this.data ?\n _.isNil(this.data[key]) ? defaultValue : this.data[key] :\n defaultValue;\n }\n\n searchPlaceData<T>(keys: string[], defaultValue?: T): T {\n if (this.data) {\n const found = keys.find(key => !_.isNil(this.data[key]));\n return found ? this.data[found] : defaultValue;\n } else {\n return defaultValue;\n }\n }\n\n getRouteIdFrom(visit: Visit) {\n const routeIdParameterDef = this.getRouteIdParameterDef();\n return routeIdParameterDef ? visit.getParameter(routeIdParameterDef.name) : null;\n }\n\n getFormattedRouteId(visit: Visit): any {\n // Note: RouteIds are always present in the url and are just empty strings when not defined. This is\n // mandated by the fact that redirects from <path> to <path>/:id always include the id parameter as\n // an empty string.\n return visit.hasRouteId() ? this.getRouteIdParameterDef().urlFormat.format(visit.getRouteId()) : \"\";\n }\n\n // @Trace()\n getFormattedRouteParameters(visit: Visit, includeRouteId = false): { [p: string]: string } {\n const result: { [p: string]: string } = {};\n this.getVisitParameterDefs({\n includeRouteId, includeRouteParameters: true\n }).forEach(def => {\n const value = visit.getParameter(def.name);\n if (!def.isEmptyValue(value)) {\n if (def.isArray) {\n assert.isArray(value);\n result[def.name] = value.map(v => def.urlFormat.format(v));\n } else {\n assert.isFalsey(Array.isArray(value));\n result[def.name] = def.urlFormat.format(value);\n }\n }\n });\n return result;\n }\n\n getNonRouteParameters(visit: Visit): { [p: string]: string } {\n const result: { [p: string]: string } = {};\n this.getVisitParameterDefs({ includeNonRouteParameters: true }).forEach(def => {\n const value = visit.getParameter(def.name);\n if (!def.isEmptyValue(value)) {\n result[def.name] = value;\n }\n });\n return result;\n }\n\n // @Trace()\n parseRouteParams(params: ParamMap): { [p: string]: any } {\n const result: { [p: string]: any } = {};\n this.getVisitParameterDefs({\n includeRouteId: true,\n includeRouteParameters: true,\n includeNonRouteParameters: false\n }).forEach(def => {\n // params will return null for non existent names\n if (params.has(def.name)) {\n if (def.isArray) {\n // const values = params.getAll(def.name); // TODO: EEEK getAll is returning [\"1,2,3,4\"] when we gave it [\"1\",\"2\",\"3\",\"4\"].\n const values = params.get(def.name).split(',').map(s => s.trim());\n result[def.name] = values.map(v => def.urlFormat.parse(v));\n } else {\n const value = params.get(def.name);\n if (def.isRouteId) { // TODO: Move this to parameter def so it's a strategy pattern\n // because our id routes redirect if the id isn't present we always have a id\n // parameter in our params. This will bugger our remember and defaultvalue sanitisation\n // as it'll see that the id is present (event thought its a blank string).\n if (!_.isEmpty(value)) {\n result[def.name] = def.urlFormat.parse(value);\n }\n } else {\n result[def.name] = def.urlFormat.parse(value);\n }\n }\n }\n });\n return result;\n }\n\n}\n\nexport namespace PlaceDefinition {\n export interface ParameterOptions {\n includeRouteId?: boolean;\n includeRouteParameters?: boolean;\n includeNonRouteParameters?: boolean;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"place-definition.js","sourceRoot":"","sources":["../../../../../../libs/angular-ui-powerups/src/lib/place/place-definition.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAwB,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,kDAAkD,CAAC;AAC3E,OAAO,CAAC,MA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CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;yBAC/C;qBACF;yBAAM;wBACL,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;qBAC/C;iBACF;aACF;QACH,CAAC,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;CAEF;AAjHC;IADC,OAAO,EAAE;;;oCACgB,mBAAmB;6DAE5C;AAGD;IADC,OAAO,EAAE;;;;4DAGT;AAGD;IADC,OAAO,EAAE;;;;4DAYT","sourcesContent":["import { ParamMap } from '@angular/router';\nimport { assert, Constructable, Trace } from '@coolon/pectin';\nimport { Opts } from '@coolon/typescript-utilities';\nimport { Memoize } from '@typescript-plus/fast-memoize-decorator/dist/src';\nimport _ from 'lodash';\nimport { PlaceComponent } from './place-component';\nimport { ParameterDefinition } from './route/parameter-definition';\nimport { Visit } from './visit';\n\nexport class PlaceDefinition {\n\n constructor(readonly component: Constructable<PlaceComponent>,\n readonly path: string,\n readonly authenticate: boolean,\n readonly role: any,\n readonly data: { [key: string]: any },\n readonly routeParameters: ParameterDefinition<any>[],\n readonly children: PlaceDefinition[]) {\n }\n\n hasRouteId() {\n return !!this.getRouteIdParameterDef();\n }\n\n @Memoize()\n getRouteIdParameterDef(): ParameterDefinition<any> {\n return this.routeParameters.find(p => p.isRouteId);\n }\n\n @Memoize()\n getRouteParameterDefs(includeRouteId = false): ParameterDefinition<any>[] {\n return this.getVisitParameterDefs({ includeRouteId, includeRouteParameters: true });\n }\n\n @Memoize()\n getVisitParameterDefs(include?: PlaceDefinition.ParameterOptions): ParameterDefinition<any>[] {\n const opts = Opts.get(include);\n // includes\n const includeRouteId = !include || opts.getOptional('includeRouteId', false);\n const includeRouteParameters = !include || opts.getOptional('includeRouteParameters', false);\n const includeNonRouteParameters = !include || opts.getOptional('includeNonRouteParameters', false);\n return this.routeParameters.filter(p => {\n return (includeRouteId && p.isRouteId)\n || (includeRouteParameters && p.isRouteParameter && !p.isRouteId) // route id is included in the line above\n || (includeNonRouteParameters && !p.isRouteParameter);\n });\n }\n\n getPlaceData<T>(key: string, defaultValue?: T): T {\n return this.data ?\n _.isNil(this.data[key]) ? defaultValue : this.data[key] :\n defaultValue;\n }\n\n searchPlaceData<T>(keys: string[], defaultValue?: T): T {\n if (this.data) {\n const found = keys.find(key => !_.isNil(this.data[key]));\n return found ? this.data[found] : defaultValue;\n } else {\n return defaultValue;\n }\n }\n\n getRouteIdFrom(visit: Visit) {\n const routeIdParameterDef = this.getRouteIdParameterDef();\n return routeIdParameterDef ? visit.getParameter(routeIdParameterDef.name) : null;\n }\n\n getFormattedRouteId(visit: Visit): any {\n // Note: RouteIds are always present in the url and are just empty strings when not defined. This is\n // mandated by the fact that redirects from <path> to <path>/:id always include the id parameter as\n // an empty string.\n return visit.hasRouteId() ? this.getRouteIdParameterDef().urlFormat.format(visit.getRouteId()) : \"\";\n }\n\n // @Trace()\n getFormattedRouteParameters(visit: Visit, includeRouteId = false): { [p: string]: string } {\n const result: { [p: string]: string } = {};\n this.getVisitParameterDefs({\n includeRouteId, includeRouteParameters: true\n }).forEach(def => {\n const value = visit.getParameter(def.name);\n if (!def.isEmptyValue(value)) {\n if (def.isArray) {\n assert.isArray(value);\n result[def.name] = value.map(v => def.urlFormat.format(v));\n } else {\n assert.isFalsey(Array.isArray(value));\n result[def.name] = def.urlFormat.format(value);\n }\n }\n });\n return result;\n }\n\n getNonRouteParameters(visit: Visit): { [p: string]: string } {\n const result: { [p: string]: string } = {};\n this.getVisitParameterDefs({ includeNonRouteParameters: true }).forEach(def => {\n const value = visit.getParameter(def.name);\n if (!def.isEmptyValue(value)) {\n result[def.name] = value;\n }\n });\n return result;\n }\n\n // @Trace()\n parseRouteParams(params: ParamMap): { [p: string]: any } {\n const result: { [p: string]: any } = {};\n this.getVisitParameterDefs({\n includeRouteId: true,\n includeRouteParameters: true,\n includeNonRouteParameters: false\n }).forEach(def => {\n // params will return null for non existent names\n if (params.has(def.name)) {\n if (def.isArray) {\n // const values = params.getAll(def.name); // TODO: EEEK getAll is returning [\"1,2,3,4\"] when we gave it [\"1\",\"2\",\"3\",\"4\"].\n const values = params.get(def.name).split(',').map(s => s.trim());\n result[def.name] = values.map(v => def.urlFormat.parse(v));\n } else {\n const value = params.get(def.name);\n if (def.isRouteId) { // TODO: Move this to parameter def so it's a strategy pattern\n // because our id routes redirect if the id isn't present we always have a id\n // parameter in our params. This will bugger our remember and defaultvalue sanitisation\n // as it'll see that the id is present (event thought its a blank string).\n if (!_.isEmpty(value)) {\n result[def.name] = def.urlFormat.parse(value);\n }\n } else {\n result[def.name] = def.urlFormat.parse(value);\n }\n }\n }\n });\n return result;\n }\n\n}\n\nexport namespace PlaceDefinition {\n export interface ParameterOptions {\n includeRouteId?: boolean;\n includeRouteParameters?: boolean;\n includeNonRouteParameters?: boolean;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"PlaceDefinition":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@coolon/pectin","name":"Constructable","line":11,"character":34,"arguments":[{"__symbolic":"reference","module":"./place-component","name":"PlaceComponent","line":11,"character":48}]},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"boolean"},{"__symbolic":"reference","name":"any"},{"__symbolic":"error","message":"Expression form not supported","line":15,"character":29},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","module":"./route/parameter-definition
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"PlaceDefinition":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@coolon/pectin","name":"Constructable","line":11,"character":34,"arguments":[{"__symbolic":"reference","module":"./place-component","name":"PlaceComponent","line":11,"character":48}]},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"boolean"},{"__symbolic":"reference","name":"any"},{"__symbolic":"error","message":"Expression form not supported","line":15,"character":29},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","module":"./route/parameter-definition","name":"ParameterDefinition","line":16,"character":40,"arguments":[{"__symbolic":"reference","name":"any"}]}]},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"PlaceDefinition"}]}]}],"hasRouteId":[{"__symbolic":"method"}],"getRouteIdParameterDef":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@typescript-plus/fast-memoize-decorator/dist/src","name":"Memoize","line":24,"character":3}}]}],"getRouteParameterDefs":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@typescript-plus/fast-memoize-decorator/dist/src","name":"Memoize","line":29,"character":3}}]}],"getVisitParameterDefs":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@typescript-plus/fast-memoize-decorator/dist/src","name":"Memoize","line":34,"character":3}}]}],"getPlaceData":[{"__symbolic":"method"}],"searchPlaceData":[{"__symbolic":"method"}],"getRouteIdFrom":[{"__symbolic":"method"}],"getFormattedRouteId":[{"__symbolic":"method"}],"getFormattedRouteParameters":[{"__symbolic":"method"}],"getNonRouteParameters":[{"__symbolic":"method"}],"parseRouteParams":[{"__symbolic":"method"}]}}}}]
|
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
import { Binding, DebugContext, Functions, MutableListModel, MutableValueModel } from '@coolon/pectin';
|
|
2
2
|
import { Klass, Opts } from '@coolon/typescript-utilities';
|
|
3
3
|
import { ROUTE_PARAMETER_LIST_KEY } from '../place-component';
|
|
4
|
-
import { ParameterDefinition } from './parameter-definition
|
|
5
|
-
function installMechanics(prototype, propertyKey,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
import { ParameterDefinition } from './parameter-definition';
|
|
5
|
+
function installMechanics(prototype, propertyKey, backingModelFactory, tagPrefix, isEmpty) {
|
|
6
|
+
function getMechanics(instance, propertyName) {
|
|
7
|
+
const key = `__mechanics_${propertyName.toString()}`;
|
|
8
|
+
if (!instance[key]) {
|
|
9
|
+
instance[key] = {
|
|
10
|
+
backingModel: backingModelFactory(),
|
|
11
|
+
binding: null
|
|
12
|
+
};
|
|
13
|
+
const tag = `${tagPrefix}(${prototype.constructor.name}.${propertyKey.toString()})`;
|
|
14
|
+
DebugContext.getOrCreate(instance[key].backingModel).tag(tag);
|
|
15
|
+
}
|
|
16
|
+
return instance[key];
|
|
17
|
+
}
|
|
12
18
|
Object.defineProperty(prototype, propertyKey, {
|
|
13
19
|
get: function () {
|
|
14
|
-
return
|
|
20
|
+
return getMechanics(this, propertyKey).backingModel;
|
|
15
21
|
},
|
|
16
22
|
set: function (userModel) {
|
|
23
|
+
const mechanics = getMechanics(this, propertyKey);
|
|
17
24
|
// This handles the scenario where we want to push an existing value model (such as a form model)
|
|
18
25
|
// to and from the route.
|
|
19
26
|
if (mechanics.binding) {
|
|
@@ -42,7 +49,7 @@ export function RouteId(type, options) {
|
|
|
42
49
|
return (prototype, propertyKey) => {
|
|
43
50
|
const param = new ParameterDefinition.RouteId(propertyKey.toString(), options, type);
|
|
44
51
|
Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
|
|
45
|
-
installMechanics(prototype, propertyKey, new MutableValueModel(), '@RouteId', m => m.query().isNil());
|
|
52
|
+
installMechanics(prototype, propertyKey, () => new MutableValueModel(), '@RouteId', m => m.query().isNil());
|
|
46
53
|
};
|
|
47
54
|
}
|
|
48
55
|
export function VisitParameter(options) {
|
|
@@ -50,7 +57,7 @@ export function VisitParameter(options) {
|
|
|
50
57
|
return (prototype, propertyKey) => {
|
|
51
58
|
const param = new ParameterDefinition.ValueParameter(propertyKey.toString(), options, opts.getOptional('storeInUrl', null));
|
|
52
59
|
Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
|
|
53
|
-
installMechanics(prototype, propertyKey, new MutableValueModel(), '@VisitParameter', m => m.query().isNil());
|
|
60
|
+
installMechanics(prototype, propertyKey, () => new MutableValueModel(), '@VisitParameter', m => m.query().isNil());
|
|
54
61
|
};
|
|
55
62
|
}
|
|
56
63
|
export function VisitParameterList(options) {
|
|
@@ -58,7 +65,7 @@ export function VisitParameterList(options) {
|
|
|
58
65
|
return (prototype, propertyKey) => {
|
|
59
66
|
const param = new ParameterDefinition.ArrayParameter(propertyKey.toString(), options, opts.getOptional('storeInUrl', null));
|
|
60
67
|
Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
|
|
61
|
-
installMechanics(prototype, propertyKey, new MutableListModel(), '@VisitParameterList', m => m.query().isEmpty());
|
|
68
|
+
installMechanics(prototype, propertyKey, () => new MutableListModel(), '@VisitParameterList', m => m.query().isEmpty());
|
|
62
69
|
};
|
|
63
70
|
}
|
|
64
71
|
//# sourceMappingURL=parameter-decorators.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parameter-decorators.js","sourceRoot":"","sources":["../../../../../../../libs/angular-ui-powerups/src/lib/place/route/parameter-decorators.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,YAAY,EACZ,SAAS,EAGT,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAE9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"parameter-decorators.js","sourceRoot":"","sources":["../../../../../../../libs/angular-ui-powerups/src/lib/place/route/parameter-decorators.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,YAAY,EACZ,SAAS,EAGT,gBAAgB,EAChB,iB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AAE;QACzD,MAAM,KAAK,GAAG,IAAI,mBAAmB,CAAC,cAAc,CAAC,WAAW,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC;QAC5H,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,oBAAoB,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;QAC3E,gBAAgB,CAAC,SAAS,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,iBAAiB,EAAK,EAAE,iBAAiB,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC;IACxH,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAI,OAAsC;IAC1E,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC/B,OAAO,CAAC,SAAiB,EAAE,WAA4B,EAAE,EAAE;QACzD,MAAM,KAAK,GAAG,IAAI,mBAAmB,CAAC,cAAc,CAAC,WAAW,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC;QAC5H,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,oBAAoB,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;QAC3E,gBAAgB,CAAC,SAAS,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,gBAAgB,EAAK,EAAE,qBAAqB,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;IAC7H,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {\n Binding,\n DebugContext,\n Functions,\n HasValue,\n Logger,\n MutableListModel,\n MutableValueModel\n} from '@coolon/pectin';\nimport { Klass, Opts } from '@coolon/typescript-utilities';\nimport { ROUTE_PARAMETER_LIST_KEY } from '../place-component';\nimport { Formatter } from './formatter';\nimport { ParameterDefinition } from './parameter-definition';\n\n\nexport interface RouteIdOptions<T> {\n as?: string;\n optional?: boolean;\n remember?: boolean;\n defaultValue?: T;\n // sanitiser?: Constructable<ParameterSanitiser<T>> | ParameterSanitiser<T>;\n}\n\nexport interface RouteParameterOptions<T> {\n as?: string;\n optional?: boolean;\n remember?: boolean;\n defaultValue?: T;\n storeInUrl?: Formatter<T>\n // sanitiser?: Constructable<ParameterSanitiser<T>> | ParameterSanitiser<T>;\n}\n\nexport interface RouteListParameterOptions<T> {\n as?: string;\n optional?: boolean;\n remember?: boolean;\n defaultValue?: T[];\n storeInUrl?: Formatter<T>\n // sanitiser?: Constructable<ParameterSanitiser<T[]>> | ParameterSanitiser<T[]>;\n}\n\n\nfunction installMechanics<M extends HasValue<any>>(prototype: Object, propertyKey: string | symbol, backingModelFactory: () => M, tagPrefix: string, isEmpty: (mode: M) => boolean) {\n function getMechanics(instance: M, propertyName: string | symbol) {\n const key = `__mechanics_${propertyName.toString()}`;\n if (!instance[key]) {\n instance[key] = {\n backingModel: backingModelFactory(),\n binding: null as Binding<any, any>\n };\n const tag = `${tagPrefix}(${prototype.constructor.name}.${propertyKey.toString()})`;\n DebugContext.getOrCreate(instance[key].backingModel).tag(tag);\n }\n return instance[key];\n }\n Object.defineProperty(prototype, propertyKey, {\n get: function() {\n return getMechanics(this, propertyKey).backingModel;\n },\n set: function(userModel: M) {\n const mechanics = getMechanics(this, propertyKey);\n // This handles the scenario where we want to push an existing value model (such as a form model)\n // to and from the route.\n if (mechanics.binding) {\n mechanics.binding.dispose();\n }\n if (userModel) {\n mechanics.binding = new Binding(mechanics.backingModel, userModel, {\n toLeft: Functions.identity,\n toRight: Functions.identity\n });\n if (isEmpty(userModel)) {\n // console.log(`Push visit to model for ${tag}`, {value: mechanics.backingModel.value});\n mechanics.binding.writeRight(); // push the visit into the user model;\n } else {\n if (!isEmpty(mechanics.backingModel)) {\n console.warn('Assigning a visit model with an existing value to a visit parameter with an existing value. Visit parameter will be overridden');\n }\n mechanics.binding.writeLeft(); // push the user model into the visit\n }\n }\n }\n });\n}\n\nexport function RouteId<T extends string | number>(type: Formatter<T>, options?: RouteIdOptions<T>): PropertyDecorator {\n return (prototype: Object, propertyKey: string | symbol) => {\n const param = new ParameterDefinition.RouteId(propertyKey.toString(), options, type);\n Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);\n installMechanics(prototype, propertyKey, () => new MutableValueModel<T>(), '@RouteId', m => m.query().isNil());\n };\n}\n\nexport function VisitParameter<T>(options?: RouteParameterOptions<T>): PropertyDecorator {\n const opts = Opts.get(options);\n return (prototype: Object, propertyKey: string | symbol) => {\n const param = new ParameterDefinition.ValueParameter(propertyKey.toString(), options, opts.getOptional('storeInUrl', null));\n Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);\n installMechanics(prototype, propertyKey, () => new MutableValueModel<T>(), '@VisitParameter', m => m.query().isNil());\n };\n}\n\nexport function VisitParameterList<E>(options?: RouteListParameterOptions<E>): PropertyDecorator {\n const opts = Opts.get(options);\n return (prototype: Object, propertyKey: string | symbol) => {\n const param = new ParameterDefinition.ArrayParameter(propertyKey.toString(), options, opts.getOptional('storeInUrl', null));\n Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);\n installMechanics(prototype, propertyKey, () => new MutableListModel<E>(), '@VisitParameterList', m => m.query().isEmpty());\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"RouteIdOptions":{"__symbolic":"interface"},"RouteParameterOptions":{"__symbolic":"interface"},"RouteListParameterOptions":{"__symbolic":"interface"},"RouteId":{"__symbolic":"function","parameters":["type","options"],"value":{"__symbolic":"error","message":"Lambda not supported","line":
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"RouteIdOptions":{"__symbolic":"interface"},"RouteParameterOptions":{"__symbolic":"interface"},"RouteListParameterOptions":{"__symbolic":"interface"},"RouteId":{"__symbolic":"function","parameters":["type","options"],"value":{"__symbolic":"error","message":"Lambda not supported","line":86,"character":9}},"VisitParameter":{"__symbolic":"function"},"VisitParameterList":{"__symbolic":"function"}}}]
|
|
@@ -0,0 +1 @@
|
|
|
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,8BAA8B,CAAC;AACpD,OAAO,CAAC,MAAM,QAAQ,CAAC;AAKvB,MAAM,OAAgB,mBAAmB;IASvC,YAAqB,YAAoB,EAAE,OAAuC,EAAW,SAAwB;QAAhG,iBAAY,GAAZ,YAAY,CAAQ;QAAoD,cAAS,GAAT,SAAS,CAAe;QACnH,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACjC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QAC5D,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;IACrE,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IAC3D,CAAC;IAED,WAAW;IACX,IAAI,gBAAgB;QAClB,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAMS,cAAc,CAAiD,GAAM;QAC7E,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAC7C,CAAC;IAED,WAAW;IACL,QAAQ,CAAC,KAAO,EAAE,KAAY,EAAE,YAA0B,EAAE,QAAkB,E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;QACxB,CAAC;QAED,UAAU,CAAC,CAAM,EAAE,CAAM;YACvB,OAAO,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC;KACF;IAXY,kCAAc,iBAW1B,CAAA;IAED,MAAa,cAAkB,SAAQ,mBAA2B;QAIhE,YAAY,aAAqB,EAAE,OAAqB,EAAE,SAAuB;YAC/E,KAAK,CAAC,aAAa,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;YAJlC,cAAS,GAAG,KAAK,CAAC;YAClB,YAAO,GAAG,IAAI,CAAC;QAIxB,CAAC;QAED,YAAY,CAAC,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
|
-
{"version":3,"file":"parameter-snapshot.js","sourceRoot":"","sources":["../../../../../../../libs/angular-ui-powerups/src/lib/place/route/parameter-snapshot.ts"],"names":[],"mappings":"","sourcesContent":["import { ParameterDefinition } from './parameter-definition
|
|
1
|
+
{"version":3,"file":"parameter-snapshot.js","sourceRoot":"","sources":["../../../../../../../libs/angular-ui-powerups/src/lib/place/route/parameter-snapshot.ts"],"names":[],"mappings":"","sourcesContent":["import { ParameterDefinition } from './parameter-definition';\n\nexport interface ParameterSnapshot<T> {\n definition: ParameterDefinition<T, any>\n readonly value: T;\n isMissing(): boolean;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visit.js","sourceRoot":"","sources":["../../../../../../libs/angular-ui-powerups/src/lib/place/visit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAS5B,MAAM,OAAO,KAAK;IAEhB,YAAqB,eAAgC,EAAmB,kBAA0B,EAAE;QAA/E,oBAAe,GAAf,eAAe,CAAiB;QAAmB,oBAAe,GAAf,eAAe,CAAa;IACpG,CAAC;IAED,WAAW;IACX,UAAU;QACR,OAAO,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IACnD,CAAC;IAED,WAAW;IACX,UAAU;QACR,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;IACrC,CAAC;IAED;;;;;OAKG;IACH,YAAY,CAAC,aAAqB;QAChC,OAAO,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;IAC7C,CAAC;IAED,WAAW;IACX,YAAY,CAAC,aAAqB;QAChC,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;IACnE,CAAC;IAED,OAAO,CAAI,SAAsC,EAAE,KAAQ;QACzD,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC,e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QACF,OAAO,CAAC,SAAS,IAAI,CAAC,mBAAmB,CAAC;IAC5C,CAAC;IAED,cAAc,CAAC,KAAY;QACzB,MAAM,sBAAsB,GAAG,CAAC,CAAC,OAAO,CACtC,IAAI,CAAC,eAAe,CAAC,qBAAqB,CAAC,IAAI,CAAC,EAChD,IAAI,CAAC,eAAe,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAClD,CAAC;QACF,OAAO,CAAC,sBAAsB,IAAI,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;IACtE,CAAC;IAED,aAAa;QACX,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACjG,CAAC;CAEF","sourcesContent":["import * as _ from 'lodash';\nimport { PlaceDefinition } from './place-definition';\nimport { ParameterDefinition } from './route/parameter-definition
|
|
1
|
+
{"version":3,"file":"visit.js","sourceRoot":"","sources":["../../../../../../libs/angular-ui-powerups/src/lib/place/visit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAS5B,MAAM,OAAO,KAAK;IAEhB,YAAqB,eAAgC,EAAmB,kBAA0B,EAAE;QAA/E,oBAAe,GAAf,eAAe,CAAiB;QAAmB,oBAAe,GAAf,eAAe,CAAa;IACpG,CAAC;IAED,WAAW;IACX,UAAU;QACR,OAAO,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IACnD,CAAC;IAED,WAAW;IACX,UAAU;QACR,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;IACrC,CAAC;IAED;;;;;OAKG;IACH,YAAY,CAAC,aAAqB;QAChC,OAAO,IAAI,CAAC,eAAe,CAAC,aAA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S,GAAG,KAAK,CAAC,eAAe,KAAK,IAAI,CAAC,eAAe,CAAC;QACjE,MAAM,mBAAmB,GAAG,CAAC,CAAC,OAAO,CACnC,IAAI,CAAC,eAAe,CAAC,2BAA2B,CAAC,IAAI,EAAE,IAAI,CAAC,EAC5D,IAAI,CAAC,eAAe,CAAC,2BAA2B,CAAC,KAAK,EAAE,IAAI,CAAC,CAC9D,CAAC;QACF,OAAO,CAAC,SAAS,IAAI,CAAC,mBAAmB,CAAC;IAC5C,CAAC;IAED,cAAc,CAAC,KAAY;QACzB,MAAM,sBAAsB,GAAG,CAAC,CAAC,OAAO,CACtC,IAAI,CAAC,eAAe,CAAC,qBAAqB,CAAC,IAAI,CAAC,EAChD,IAAI,CAAC,eAAe,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAClD,CAAC;QACF,OAAO,CAAC,sBAAsB,IAAI,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;IACtE,CAAC;IAED,aAAa;QACX,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACjG,CAAC;CAEF","sourcesContent":["import * as _ from 'lodash';\nimport { PlaceDefinition } from './place-definition';\nimport { ParameterDefinition } from './route/parameter-definition';\n\ninterface Params {\n [p: string]: any\n}\n\n\nexport class Visit {\n\n constructor(readonly placeDefinition: PlaceDefinition, private readonly visitParameters: Params = {}) {\n }\n\n // @Trace()\n getRouteId(): any {\n return this.placeDefinition.getRouteIdFrom(this);\n }\n\n // @Trace()\n hasRouteId(): boolean {\n return !_.isNil(this.getRouteId());\n }\n\n /**\n * Returns the value of the place parameter with the specified name. The parameter\n * name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the\n * same as the the ValueModel property name.\n * @param parameterName the field name of the property model or the `as` option if specified.\n */\n getParameter(parameterName: string): any {\n return this.visitParameters[parameterName];\n }\n\n // @Trace()\n hasParameter(parameterName: string) {\n return Object.keys(this.visitParameters).includes(parameterName);\n }\n\n replace<S>(parameter: ParameterDefinition<any, S>, value: S): Visit {\n return new Visit(this.placeDefinition, { ...this.visitParameters, [parameter.name]: value });\n }\n\n mergeRouteParameters<S>(routeParams: { [p: string]: any }): Visit {\n // todo: whitelist parameters.\n const routeParameterKeys = Object.keys(routeParams);\n const params = {};\n this.placeDefinition.getVisitParameterDefs().forEach(def => {\n if (def.isRouteId || def.isRouteParameter) {\n if (routeParameterKeys.includes(def.name)) {\n params[def.name] = routeParams[def.name];\n }\n } else {\n // copy non route params as is, but only if they already exist otherwise we'll inject nil values and break the\n // defaults and remember sanitisation process.\n const value = this.getParameter(def.name);\n if (this.hasParameter(def.name)) {\n params[def.name] = value;\n }\n }\n });\n return new Visit(this.placeDefinition, params);\n }\n\n hasRoutingChangedFrom(other: Visit): boolean {\n const samePlace = other.placeDefinition === this.placeDefinition;\n const sameRouteParameters = _.isEqual(\n this.placeDefinition.getFormattedRouteParameters(this, true),\n this.placeDefinition.getFormattedRouteParameters(other, true)\n );\n return !samePlace || !sameRouteParameters;\n }\n\n hasChangedFrom(other: Visit) {\n const sameNonRouteParameters = _.isEqual(\n this.placeDefinition.getNonRouteParameters(this),\n this.placeDefinition.getNonRouteParameters(other)\n );\n return !sameNonRouteParameters || this.hasRoutingChangedFrom(other);\n }\n\n toDebugString() {\n return Object.keys(this.visitParameters).map(k => `${k}=${this.visitParameters[k]}`).join(',');\n }\n\n}\n"]}
|
|
@@ -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,
|
|
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,
|
|
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';
|
|
@@ -6127,9 +6127,11 @@ class WaitUntilLinkTriggeredNavigationInteractionCancellationTypeDetermined exte
|
|
|
6127
6127
|
this.clickedLinkMatchedBackButtonUrl = false;
|
|
6128
6128
|
this.debugPropertyKeys = ['idle', 'startingUrl', 'clickedLinkUrl', 'firstCancelEventUrl', 'clickedLinkMatchedBackButtonUrl', 'popStateEventUrl'];
|
|
6129
6129
|
}
|
|
6130
|
+
// @Trace()
|
|
6130
6131
|
onRouterStarted(event) {
|
|
6131
6132
|
this.ignore(event);
|
|
6132
6133
|
}
|
|
6134
|
+
// @Trace()
|
|
6133
6135
|
onRouterCancelled(event) {
|
|
6134
6136
|
if (event.url === this.clickedLinkUrl) {
|
|
6135
6137
|
this.context.transitionTo(new WaitForLinkSameAsBackToPlayOut(this.context, this.startingUrl, this.clickedLinkUrl));
|
|
@@ -6144,18 +6146,6 @@ class WaitUntilLinkTriggeredNavigationInteractionCancellationTypeDetermined exte
|
|
|
6144
6146
|
});
|
|
6145
6147
|
}
|
|
6146
6148
|
}
|
|
6147
|
-
__decorate([
|
|
6148
|
-
Trace(),
|
|
6149
|
-
__metadata("design:type", Function),
|
|
6150
|
-
__metadata("design:paramtypes", [NavigationStart]),
|
|
6151
|
-
__metadata("design:returntype", void 0)
|
|
6152
|
-
], WaitUntilLinkTriggeredNavigationInteractionCancellationTypeDetermined.prototype, "onRouterStarted", null);
|
|
6153
|
-
__decorate([
|
|
6154
|
-
Trace(),
|
|
6155
|
-
__metadata("design:type", Function),
|
|
6156
|
-
__metadata("design:paramtypes", [NavigationCancel]),
|
|
6157
|
-
__metadata("design:returntype", void 0)
|
|
6158
|
-
], WaitUntilLinkTriggeredNavigationInteractionCancellationTypeDetermined.prototype, "onRouterCancelled", null);
|
|
6159
6149
|
class WaitForLinkSameAsBackToPlayOut extends EventCleanUpSession {
|
|
6160
6150
|
constructor(context, startingUrl, clickedLinkUrl) {
|
|
6161
6151
|
super(context, startingUrl);
|
|
@@ -7996,18 +7986,25 @@ var Formatter;
|
|
|
7996
7986
|
Formatter.BOOLEAN = new BooleanType();
|
|
7997
7987
|
})(Formatter || (Formatter = {}));
|
|
7998
7988
|
|
|
7999
|
-
function installMechanics(prototype, propertyKey,
|
|
8000
|
-
|
|
8001
|
-
|
|
8002
|
-
|
|
8003
|
-
|
|
8004
|
-
|
|
8005
|
-
|
|
7989
|
+
function installMechanics(prototype, propertyKey, backingModelFactory, tagPrefix, isEmpty) {
|
|
7990
|
+
function getMechanics(instance, propertyName) {
|
|
7991
|
+
const key = `__mechanics_${propertyName.toString()}`;
|
|
7992
|
+
if (!instance[key]) {
|
|
7993
|
+
instance[key] = {
|
|
7994
|
+
backingModel: backingModelFactory(),
|
|
7995
|
+
binding: null
|
|
7996
|
+
};
|
|
7997
|
+
const tag = `${tagPrefix}(${prototype.constructor.name}.${propertyKey.toString()})`;
|
|
7998
|
+
DebugContext.getOrCreate(instance[key].backingModel).tag(tag);
|
|
7999
|
+
}
|
|
8000
|
+
return instance[key];
|
|
8001
|
+
}
|
|
8006
8002
|
Object.defineProperty(prototype, propertyKey, {
|
|
8007
8003
|
get: function () {
|
|
8008
|
-
return
|
|
8004
|
+
return getMechanics(this, propertyKey).backingModel;
|
|
8009
8005
|
},
|
|
8010
8006
|
set: function (userModel) {
|
|
8007
|
+
const mechanics = getMechanics(this, propertyKey);
|
|
8011
8008
|
// This handles the scenario where we want to push an existing value model (such as a form model)
|
|
8012
8009
|
// to and from the route.
|
|
8013
8010
|
if (mechanics.binding) {
|
|
@@ -8036,7 +8033,7 @@ function RouteId(type, options) {
|
|
|
8036
8033
|
return (prototype, propertyKey) => {
|
|
8037
8034
|
const param = new ParameterDefinition.RouteId(propertyKey.toString(), options, type);
|
|
8038
8035
|
Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
|
|
8039
|
-
installMechanics(prototype, propertyKey, new MutableValueModel(), '@RouteId', m => m.query().isNil());
|
|
8036
|
+
installMechanics(prototype, propertyKey, () => new MutableValueModel(), '@RouteId', m => m.query().isNil());
|
|
8040
8037
|
};
|
|
8041
8038
|
}
|
|
8042
8039
|
function VisitParameter(options) {
|
|
@@ -8044,7 +8041,7 @@ function VisitParameter(options) {
|
|
|
8044
8041
|
return (prototype, propertyKey) => {
|
|
8045
8042
|
const param = new ParameterDefinition.ValueParameter(propertyKey.toString(), options, opts.getOptional('storeInUrl', null));
|
|
8046
8043
|
Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
|
|
8047
|
-
installMechanics(prototype, propertyKey, new MutableValueModel(), '@VisitParameter', m => m.query().isNil());
|
|
8044
|
+
installMechanics(prototype, propertyKey, () => new MutableValueModel(), '@VisitParameter', m => m.query().isNil());
|
|
8048
8045
|
};
|
|
8049
8046
|
}
|
|
8050
8047
|
function VisitParameterList(options) {
|
|
@@ -8052,7 +8049,7 @@ function VisitParameterList(options) {
|
|
|
8052
8049
|
return (prototype, propertyKey) => {
|
|
8053
8050
|
const param = new ParameterDefinition.ArrayParameter(propertyKey.toString(), options, opts.getOptional('storeInUrl', null));
|
|
8054
8051
|
Klass.get(prototype).addToOwnMetadataList(ROUTE_PARAMETER_LIST_KEY, param);
|
|
8055
|
-
installMechanics(prototype, propertyKey, new MutableListModel(), '@VisitParameterList', m => m.query().isEmpty());
|
|
8052
|
+
installMechanics(prototype, propertyKey, () => new MutableListModel(), '@VisitParameterList', m => m.query().isEmpty());
|
|
8056
8053
|
};
|
|
8057
8054
|
}
|
|
8058
8055
|
|