@coolon/angular-ui-powerups 12.4.0-alpha.62 → 12.4.0-alpha.64
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 +22 -19
- package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
- package/coolon-angular-ui-powerups.metadata.json +1 -1
- package/esm2015/lib/components/commands/group/popup-menu/abstract-popup-menu.component.js +1 -1
- package/esm2015/lib/components/commands/group/popup-menu/abstract-popup-menu.component.js.map +1 -1
- package/esm2015/lib/components/commands/group/popup-menu/popup-menu-renderer/popup-menu-renderer.component.js +1 -1
- package/esm2015/lib/components/commands/group/popup-menu/popup-menu-renderer/popup-menu-renderer.component.js.map +1 -1
- package/esm2015/lib/components/tables/abstract-table-model.js +1 -1
- package/esm2015/lib/components/tables/abstract-table-model.js.map +1 -1
- package/esm2015/lib/components/tables/table/column-model.js +5 -4
- package/esm2015/lib/components/tables/table/column-model.js.map +1 -1
- package/esm2015/lib/components/tables/table/column-model.metadata.json +1 -1
- package/esm2015/lib/directives/command.directive.js +1 -1
- package/esm2015/lib/directives/command.directive.js.map +1 -1
- package/esm2015/lib/interaction/activity.js +1 -1
- package/esm2015/lib/interaction/activity.js.map +1 -1
- package/esm2015/lib/interaction/components/activity-container/activity-container.component.js +1 -1
- package/esm2015/lib/interaction/components/activity-container/activity-container.component.js.map +1 -1
- package/esm2015/lib/interaction/services/interaction.service.js +1 -1
- package/esm2015/lib/interaction/services/interaction.service.js.map +1 -1
- package/esm2015/lib/place/components/abstract-place-navigation.component.js +1 -1
- package/esm2015/lib/place/components/abstract-place-navigation.component.js.map +1 -1
- package/esm2015/lib/place/place-router.js +1 -1
- package/esm2015/lib/place/place-router.js.map +1 -1
- package/fesm2015/coolon-angular-ui-powerups.js +13 -12
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/components/tables/table/column-model.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interaction.service.js","sourceRoot":"","sources":["../../../../../../../libs/angular-ui-powerups/src/lib/interaction/services/interaction.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAEL,oBAAoB,EAEpB,GAAG,EACH,gBAAgB,EAEhB,gBAAgB,EAIjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAItD,OAAO,EAAE,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AAEzF,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;;;AAErF,IAAI,mBAAmB,GAAG,CAAC,CAAC;AAK5B,MAAM,OAAO,kBAAkB;IAmB7B,YAAqB,8BAA8D;QAA9D,mCAA8B,GAA9B,8BAA8B,CAAgC;QAjBlE,YAAO,GAAG,IAAI,gBAAgB,EAAE,CAAC;QAGlD,sFAAsF;QACtF,uFAAuF;QACvF,wEAAwE;QACvD,0BAAqB,GAAG,IAAI,oBAAoB,EAAW,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAY9F,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAEjG,IAAI,CAAC,4BAA4B,GAAG,IAAI,kBAAkB,CAAC,eAAe,EAAE,CAAC;QAC7E,IAAI,CAAC,wBAAwB,GAAG,IAAI,kBAAkB,CAAC,eAAe,EAAE,CAAC;QACzE,IAAI,CAAC,0BAA0B,GAAG,IAAI,kBAAkB,CAAC,eAAe,EAAE,CAAC;QAE3E,IAAI,CAAC,wBAAwB,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,CACnD,IAAI,CAAC,4BAA4B,CAAC,MAAM,EACxC,IAAI,CAAC,wBAA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,CAAC;QACrD,CAAC;QAED,WAAW;QACX,cAAc,CAAC,OAA2B;YACxC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YACrC,kBAAkB;YAClB,8GAA8G;YAC9G,wFAAwF;YACxF,yGAAyG;YACzG,2EAA2E;YAC3E,iGAAiG;YACjG,iFAAiF;YACjF,OAAO,IAAI,CAAC,sBAAsB,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,mCAAmC,EAAE,CAAC;QACpH,CAAC;KACF;IA7BY,6BAAU,aA6BtB,CAAA;AAEH,CAAC,EA5FgB,kBAAkB,KAAlB,kBAAkB,QA4FlC","sourcesContent":["import { Injectable } from '@angular/core';\nimport {\n BooleanValueModelChain,\n DelegatingValueModel,\n Disposable,\n Dsl,\n GarbageCollector, ListModel,\n ListModelChain,\n MutableListModel,\n MutableValueModel, Trace,\n ValueModel,\n ValueModelChain\n} from '@coolon/pectin';\nimport { assert } from '@coolon/typescript-utilities';\nimport { PlaceRouter } from '../../place/place-router';\nimport { InPlaceInteractionContextComponent } from '../components/inplace-interaction-context/in-place-interaction-context.component';\nimport { InteractionContext } from '../interaction-context';\nimport { InteractionServiceRoutingAdapter } from './interaction-service-routing-adapter';\n\nimport { ModalInteractionContextFactory } from './modal-interaction-context.factory';\n\nlet inplaceMonitorCount = 0;\n\n@Injectable({\n providedIn: 'root'\n})\nexport class InteractionService {\n\n private readonly garbage = new GarbageCollector();\n readonly active: BooleanValueModelChain;\n\n // private readonly _activeModalContext = new MutableValueModel<InteractionContext>();\n // private readonly _activeInlineContext = new MutableValueModel<InteractionContext>();\n // private readonly _activeContext: ValueModelChain<InteractionContext>;\n private readonly _navigationInProgress = new DelegatingValueModel<boolean>().withDefault(false);\n\n private placeRouter: PlaceRouter;\n private exclusiveInteractionRegistry: InteractionService.ContextRegistry;\n private modalInteractionRegistry: InteractionService.ContextRegistry;\n private inPlaceInteractionRegistry: InteractionService.ContextRegistry;\n private activeModalContext: ValueModelChain<InteractionContext>;\n\n readonly activeInteractionContextIds: ListModelChain<string>;\n readonly inModalInteraction: BooleanValueModelChain;\n\n constructor(readonly modelInteractionContextFactory: ModalInteractionContextFactory) {\n const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this.garbage);\n\n this.exclusiveInteractionRegistry = new InteractionService.ContextRegistry();\n this.modalInteractionRegistry = new InteractionService.ContextRegistry();\n this.inPlaceInteractionRegistry = new InteractionService.ContextRegistry();\n\n this.modalInteractionRegistry.disableWhen(valueOf.any(\n this.exclusiveInteractionRegistry.active,\n this.modalInteractionRegistry.active\n ).areTruthy());\n\n this.inPlaceInteractionRegistry.disableWhen(valueOf.any(\n this.exclusiveInteractionRegistry.active,\n this.modalInteractionRegistry.active,\n this.inPlaceInteractionRegistry.active\n ).areTruthy());\n\n this.active = valueOf.any(\n this.inPlaceInteractionRegistry.active,\n this.modalInteractionRegistry.active\n ).areTruthy();\n\n\n // TODO: chain.concat(listOrValueModels) would be nice.\n this.activeInteractionContextIds = chain(this.inPlaceInteractionRegistry.interactionContextIds)\n .concat(this.modalInteractionRegistry.interactionContextIds);\n\n this.activeModalContext = chain(this.modalInteractionRegistry.interactionContexts).first();\n this.inModalInteraction = chain(this.activeModalContext).isNotNil();\n\n }\n\n isActive(): boolean {\n return this.active.value;\n }\n\n /**\n * @deprecated use #createModalInteractionContextDisposedWith instead.\n * @param disposable\n */\n createModalInteractionContextFor(disposable: Disposable.Collector): InteractionContext {\n return this.createModalInteractionContextDisposedWith(disposable);\n }\n\n /**\n * Creates a new model interaction context that will be disposed along with the component.\n * @param disposable\n */\n createModalInteractionContextDisposedWith(disposable: Disposable.Collector): InteractionContext {\n // TODO: look at making the registry the factory..\n return this.modelInteractionContextFactory.createInteractionContext('modal', new InteractionService.ApiAdapter(this.placeRouter, this.modalInteractionRegistry));\n }\n\n registerInplaceInteractionContext(interactionContext: InPlaceInteractionContextComponent<any, any, any>) {\n // TODO: look at making the registry the factory..\n // Todo: check for double registration.\n // Todo: allow multiple inplace interactions..\n interactionContext.initialise(`ip${++inplaceMonitorCount}`, new InteractionService.ApiAdapter(this.placeRouter, this.inPlaceInteractionRegistry));\n }\n\n\n /**\n * Creates an interaction context that will prevent any other contexts from starting an\n * activity until it is disposed. This is intended for use by the router for passing\n * to PlaceComponent.canDeactivate(interactionContext). This ensures components don't\n * try and interact in a way that we can't track and synchronise with the browser back\n * button.\n */\n registerPlaceRouter(router: PlaceRouter): InteractionServiceRoutingAdapter {\n assert.isFalsey(this.placeRouter);\n this.placeRouter = router;\n this._navigationInProgress.setDelegate(this.placeRouter.navigationInProgress);\n const self = this;\n return new InteractionServiceRoutingAdapter(\n this.activeInteractionContextIds,\n this.activeModalContext,\n () => {\n return self.modelInteractionContextFactory.createInteractionContext('exclusive', new InteractionService.ApiAdapter(this.placeRouter, this.exclusiveInteractionRegistry));\n });\n }\n\n}\n\nexport namespace InteractionService {\n\n export interface Api {\n\n /**\n * Notifies the interaction service that a particular interactionContext has become active. The interaction\n * services will then push changes to the router to track state. If the router is idle, the promise will\n * resolve when the routing has finished updating. Otherwise it will return immediately.\n * @param interactionContext\n */\n notifyActive(interactionContext: InteractionContext): Promise<unknown>;\n\n /**\n * Notifies the interaction service that a particular interactionContext has become idle. The interaction\n * services will then push changes to the router to track state. If the router is idle, the promise will\n * resolve when the routing has finished updating. Otherwise it will return immediately.\n * @param interactionContext\n */\n notifyFinished(interactionContext: InteractionContext): Promise<unknown>;\n }\n\n /**\n * Provides a mechanism for the service to keep track of what the API adapters are doing to\n * ensure the rules are followed, i.e. modal or in-place interaction aren't started while\n * an exclusive routing interaction is active.\n */\n export class ContextRegistry extends GarbageCollector {\n\n private _interactions = new MutableListModel<InteractionContext>();\n private _disabledDelegate = new DelegatingValueModel<boolean>().withDefault(false);\n readonly active: BooleanValueModelChain;\n readonly interactionContextIds: ListModelChain<string>;\n\n constructor() {\n super();\n const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);\n this.active = chain(this._interactions).isNotEmpty();\n this.interactionContextIds = chain(this._interactions).pluck(\"identifier\");\n }\n\n get interactionContexts():ListModel<InteractionContext> {\n return this._interactions.readonly;\n }\n\n start(context: InteractionContext) {\n this._interactions.push(context);\n }\n\n finish(context: InteractionContext) {\n this._interactions.remove(context);\n }\n\n isActive() {\n return this.active.value;\n }\n\n disableWhen(disabled: ValueModel<boolean>) {\n this._disabledDelegate.setDelegate(disabled);\n }\n }\n\n export class ApiAdapter implements Api {\n\n constructor(private readonly placeRouter: PlaceRouter, private readonly contextRegistry: ContextRegistry) {\n }\n\n // @Trace()\n notifyActive(context: InteractionContext): Promise<any> {\n assert.isTruthy(context.identifier);\n this.contextRegistry.start(context);\n return this.isNavigationInProgress() ? Promise.resolve() : this.placeRouter.syncInteractionContextIdsWithRouter();\n }\n\n // @Trace()\n private isNavigationInProgress() {\n return this.placeRouter.navigationInProgress.value;\n }\n\n // @Trace()\n notifyFinished(context: InteractionContext): Promise<any> {\n this.contextRegistry.finish(context);\n // :: Important ::\n // This method will be traversed by both the place router (during can canDeactivate guards) and user land code\n // (both when routing is idle and while it is active in PlaceComponent.canDeactivate()).\n // The result of pushInteractionIdsToRoute will not start until after the current route finishes, and the\n // current route won't finish until after this promise returns... Deadlock.\n // So in order to keep this logic out of the activities we perform the check here and ensure that\n // any interactions with the context while routing is active returns immediately.\n return this.isNavigationInProgress() ? Promise.resolve() : this.placeRouter.syncInteractionContextIdsWithRouter();\n }\n }\n\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interaction.service.js","sourceRoot":"","sources":["../../../../../../../libs/angular-ui-powerups/src/lib/interaction/services/interaction.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAEL,oBAAoB,EAEpB,GAAG,EACH,gBAAgB,EAEhB,gBAAgB,EAIjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,MA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AAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,mCAAmC,EAAE,CAAC;QACpH,CAAC;KACF;IA7BY,6BAAU,aA6BtB,CAAA;AAEH,CAAC,EA5FgB,kBAAkB,KAAlB,kBAAkB,QA4FlC","sourcesContent":["import { Injectable } from '@angular/core';\nimport {\n BooleanValueModelChain,\n DelegatingValueModel,\n Disposable,\n Dsl,\n GarbageCollector, ListModel,\n ListModelChain,\n MutableListModel,\n MutableValueModel, Trace,\n ValueModel,\n ValueModelChain\n} from '@coolon/pectin';\nimport { assert } from '@coolon/typescript-utilities';\nimport { PlaceRouter } from '../../place/place-router';\nimport { InPlaceInteractionContextComponent } from '../components/inplace-interaction-context/in-place-interaction-context.component';\nimport { InteractionContext } from '../interaction-context';\nimport { InteractionServiceRoutingAdapter } from './interaction-service-routing-adapter';\n\nimport { ModalInteractionContextFactory } from './modal-interaction-context.factory';\n\nlet inplaceMonitorCount = 0;\n\n@Injectable({\n providedIn: 'root'\n})\nexport class InteractionService {\n\n private readonly garbage = new GarbageCollector();\n readonly active: BooleanValueModelChain;\n\n // private readonly _activeModalContext = new MutableValueModel<InteractionContext>();\n // private readonly _activeInlineContext = new MutableValueModel<InteractionContext>();\n // private readonly _activeContext: ValueModelChain<InteractionContext>;\n private readonly _navigationInProgress = new DelegatingValueModel<boolean>().withDefault(false);\n\n private placeRouter: PlaceRouter;\n private exclusiveInteractionRegistry: InteractionService.ContextRegistry;\n private modalInteractionRegistry: InteractionService.ContextRegistry;\n private inPlaceInteractionRegistry: InteractionService.ContextRegistry;\n private activeModalContext: ValueModelChain<InteractionContext>;\n\n readonly activeInteractionContextIds: ListModelChain<string>;\n readonly inModalInteraction: BooleanValueModelChain;\n\n constructor(readonly modelInteractionContextFactory: ModalInteractionContextFactory) {\n const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this.garbage);\n\n this.exclusiveInteractionRegistry = new InteractionService.ContextRegistry();\n this.modalInteractionRegistry = new InteractionService.ContextRegistry();\n this.inPlaceInteractionRegistry = new InteractionService.ContextRegistry();\n\n this.modalInteractionRegistry.disableWhen(valueOf.any(\n this.exclusiveInteractionRegistry.active,\n this.modalInteractionRegistry.active\n ).areTruthy());\n\n this.inPlaceInteractionRegistry.disableWhen(valueOf.any(\n this.exclusiveInteractionRegistry.active,\n this.modalInteractionRegistry.active,\n this.inPlaceInteractionRegistry.active\n ).areTruthy());\n\n this.active = valueOf.any(\n this.inPlaceInteractionRegistry.active,\n this.modalInteractionRegistry.active\n ).areTruthy();\n\n\n // TODO: chain.concat(listOrValueModels) would be nice.\n this.activeInteractionContextIds = chain(this.inPlaceInteractionRegistry.interactionContextIds)\n .concat(this.modalInteractionRegistry.interactionContextIds);\n\n this.activeModalContext = chain(this.modalInteractionRegistry.interactionContexts).first();\n this.inModalInteraction = chain(this.activeModalContext).isNotNil();\n\n }\n\n isActive(): boolean {\n return this.active.value;\n }\n\n /**\n * @deprecated use #createModalInteractionContextDisposedWith instead.\n * @param disposable\n */\n createModalInteractionContextFor(disposable: Disposable.Collector): InteractionContext {\n return this.createModalInteractionContextDisposedWith(disposable);\n }\n\n /**\n * Creates a new model interaction context that will be disposed along with the component.\n * @param disposable\n */\n createModalInteractionContextDisposedWith(disposable: Disposable.Collector): InteractionContext {\n // TODO: look at making the registry the factory..\n return this.modelInteractionContextFactory.createInteractionContext('modal', new InteractionService.ApiAdapter(this.placeRouter, this.modalInteractionRegistry));\n }\n\n registerInplaceInteractionContext(interactionContext: InPlaceInteractionContextComponent<any, any, any>) {\n // TODO: look at making the registry the factory..\n // Todo: check for double registration.\n // Todo: allow multiple inplace interactions..\n interactionContext.initialise(`ip${++inplaceMonitorCount}`, new InteractionService.ApiAdapter(this.placeRouter, this.inPlaceInteractionRegistry));\n }\n\n\n /**\n * Creates an interaction context that will prevent any other contexts from starting an\n * activity until it is disposed. This is intended for use by the router for passing\n * to PlaceComponent.canDeactivate(interactionContext). This ensures components don't\n * try and interact in a way that we can't track and synchronise with the browser back\n * button.\n */\n registerPlaceRouter(router: PlaceRouter): InteractionServiceRoutingAdapter {\n assert.isFalsey(this.placeRouter);\n this.placeRouter = router;\n this._navigationInProgress.setDelegate(this.placeRouter.navigationInProgress);\n const self = this;\n return new InteractionServiceRoutingAdapter(\n this.activeInteractionContextIds,\n this.activeModalContext,\n () => {\n return self.modelInteractionContextFactory.createInteractionContext('exclusive', new InteractionService.ApiAdapter(this.placeRouter, this.exclusiveInteractionRegistry));\n });\n }\n\n}\n\nexport namespace InteractionService {\n\n export interface Api {\n\n /**\n * Notifies the interaction service that a particular interactionContext has become active. The interaction\n * services will then push changes to the router to track state. If the router is idle, the promise will\n * resolve when the routing has finished updating. Otherwise it will return immediately.\n * @param interactionContext\n */\n notifyActive(interactionContext: InteractionContext): Promise<unknown>;\n\n /**\n * Notifies the interaction service that a particular interactionContext has become idle. The interaction\n * services will then push changes to the router to track state. If the router is idle, the promise will\n * resolve when the routing has finished updating. Otherwise it will return immediately.\n * @param interactionContext\n */\n notifyFinished(interactionContext: InteractionContext): Promise<unknown>;\n }\n\n /**\n * Provides a mechanism for the service to keep track of what the API adapters are doing to\n * ensure the rules are followed, i.e. modal or in-place interaction aren't started while\n * an exclusive routing interaction is active.\n */\n export class ContextRegistry extends GarbageCollector {\n\n private _interactions = new MutableListModel<InteractionContext>();\n private _disabledDelegate = this.registerDisposable(new DelegatingValueModel<boolean>().withDefault(false));\n readonly active: BooleanValueModelChain;\n readonly interactionContextIds: ListModelChain<string>;\n\n constructor() {\n super();\n const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);\n this.active = chain(this._interactions).isNotEmpty();\n this.interactionContextIds = chain(this._interactions).pluck(\"identifier\");\n }\n\n get interactionContexts():ListModel<InteractionContext> {\n return this._interactions.readonly;\n }\n\n start(context: InteractionContext) {\n this._interactions.push(context);\n }\n\n finish(context: InteractionContext) {\n this._interactions.remove(context);\n }\n\n isActive() {\n return this.active.value;\n }\n\n disableWhen(disabled: ValueModel<boolean>) {\n this._disabledDelegate.setDelegate(disabled);\n }\n }\n\n export class ApiAdapter implements Api {\n\n constructor(private readonly placeRouter: PlaceRouter, private readonly contextRegistry: ContextRegistry) {\n }\n\n // @Trace()\n notifyActive(context: InteractionContext): Promise<any> {\n assert.isTruthy(context.identifier);\n this.contextRegistry.start(context);\n return this.isNavigationInProgress() ? Promise.resolve() : this.placeRouter.syncInteractionContextIdsWithRouter();\n }\n\n // @Trace()\n private isNavigationInProgress() {\n return this.placeRouter.navigationInProgress.value;\n }\n\n // @Trace()\n notifyFinished(context: InteractionContext): Promise<any> {\n this.contextRegistry.finish(context);\n // :: Important ::\n // This method will be traversed by both the place router (during can canDeactivate guards) and user land code\n // (both when routing is idle and while it is active in PlaceComponent.canDeactivate()).\n // The result of pushInteractionIdsToRoute will not start until after the current route finishes, and the\n // current route won't finish until after this promise returns... Deadlock.\n // So in order to keep this logic out of the activities we perform the check here and ensure that\n // any interactions with the context while routing is active returns immediately.\n return this.isNavigationInProgress() ? Promise.resolve() : this.placeRouter.syncInteractionContextIdsWithRouter();\n }\n }\n\n}\n"]}
|
|
@@ -13,7 +13,7 @@ export class AbstractPlaceNavigationComponent extends DisposableComponent {
|
|
|
13
13
|
constructor(placeRouter) {
|
|
14
14
|
super();
|
|
15
15
|
this.placeRouter = placeRouter;
|
|
16
|
-
this._activePlaceComponent = new DelegatingValueModel();
|
|
16
|
+
this._activePlaceComponent = this.registerDisposable(new DelegatingValueModel());
|
|
17
17
|
this.trackByPlaceDef = (data) => data.place;
|
|
18
18
|
const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
|
|
19
19
|
this.placeDefinitions = chain(this.placesModel)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstract-place-navigation.component.js","sourceRoot":"","sources":["../../../../../../../libs/angular-ui-powerups/src/lib/place/components/abstract-place-navigation.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAU,MAAM,eAAe,CAAC;AACzD,OAAO,EACL,OAAO,EAEP,oBAAoB,EACpB,GAAG,EACH,SAAS,EAET,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EAEb,UAAU,EAEX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,kDAAkD,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAG5E,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAU7E,MAAM,OAAO,gCAAiC,SAAQ,mBAAmB;IAwBvE,YAAqB,WAAwB;QAC3C,KAAK,EAAE,CAAC;QADW,gBAAW,GAAX,WAAW,CAAa;QALpC,0BAAqB,GAAG,IAAI,oBAAoB,EAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"abstract-place-navigation.component.js","sourceRoot":"","sources":["../../../../../../../libs/angular-ui-powerups/src/lib/place/components/abstract-place-navigation.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAU,MAAM,eAAe,CAAC;AACzD,OAAO,EACL,OAAO,EAEP,oBAAoB,EACpB,GAAG,EACH,SAAS,EAET,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EAEb,UAAU,EAEX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,kDAAkD,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAA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E,OAAO,CAAC,CAAC;YACvF,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,YAAY,EAAE,IAAI,CAAC;YACzG,IAAI,EAAE,GAAG,EAAE,CAAC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,SAAS,EAAE,IAAI,CAAC;SAC9F,CAAC;IACJ,CAAC;IAED,QAAQ;IACR,CAAC;;;YA5EF,SAAS,SAAC;gBACT,QAAQ,EAAE,EAAE;aACb;;;YAXQ,WAAW;;;qBAcjB,KAAK;0BAGL,KAAK;0BAIL,KAAK;+BAGL,KAAK;;AATN;IADU,gBAAgB,CAAC,aAAa,CAAC;;gEACD;AAGxC;IADU,aAAa,EAAE;8BACZ,SAAS;qEAAgC;AAItD;IADU,iBAAiB,CAAC,kBAAkB,CAAC;8BAClC,oBAAoB;qEAAC;AAGlC;IADU,aAAa,EAAE;8BACP,UAAU;0EAAuB;AAkDnD;IADC,OAAO,EAAE;;qCACkB,eAAe;;yEAO1C","sourcesContent":["import { Component, Input, OnInit } from '@angular/core';\nimport {\n Command,\n Constructable,\n DelegatingValueModel,\n Dsl,\n ListModel,\n ListModelChain,\n StoreInListModel,\n StoreInValueModel,\n TrackExternal,\n TransactionObserver,\n ValueModel,\n ValueModelChain\n} from '@coolon/pectin';\nimport { Memoize } from '@typescript-plus/fast-memoize-decorator/dist/src';\nimport { CommandFace } from '../../components/commands/command-face';\nimport { DisposableComponent } from '../../components/disposable-component';\nimport { TrackBy } from '../../components/track-by';\nimport { NavItem } from '../nav-item';\nimport { PlaceComponent } from '../place-component';\nimport { PlaceDefinition } from '../place-definition';\nimport { PlaceRouter } from '../place-router';\nimport { Visit } from '../visit';\nimport { PlaceOutletComponent } from './place-outlet/place-outlet.component';\n\ninterface MenuItem {\n active: boolean;\n place: PlaceDefinition\n}\n\n@Component({\n template: ''\n})\nexport class AbstractPlaceNavigationComponent extends DisposableComponent implements OnInit {\n\n @Input() @StoreInListModel('placesModel')\n places: Constructable<PlaceComponent>[];\n\n @Input() @TrackExternal()\n placesModel: ListModel<Constructable<PlaceComponent>>;\n\n\n @Input() @StoreInValueModel('placeOutletModel')\n placeOutlet: PlaceOutletComponent;\n\n @Input() @TrackExternal()\n placeOutletModel: ValueModel<PlaceOutletComponent>;\n\n private readonly placeDefinitions: ListModelChain<PlaceDefinition>;\n readonly menuItems: ListModelChain<MenuItem>;\n\n readonly commandFactory: Command.Factory<PlaceDefinition, void>;\n readonly _activePlaceComponent = this.registerDisposable(new DelegatingValueModel<PlaceComponent>());\n private activePlaceDefinition: ValueModelChain<PlaceDefinition>;\n\n readonly trackByPlaceDef = (data:MenuItem) => data.place;\n\n constructor(readonly placeRouter: PlaceRouter) {\n super();\n const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);\n this.placeDefinitions = chain(this.placesModel)\n .map(c => PlaceComponent.getDefinition(c))\n .select(d => {\n const guard = placeRouter.accessGuard.value;\n const state = placeRouter.state.value;\n return guard.isAuthorised(d) || state.isPlaceActive(d);\n }, { dependsOn: [placeRouter.accessGuard, placeRouter.state] });\n\n this.commandFactory = Command.createFactory((placeDefinition: PlaceDefinition) => {\n this.placeOutlet.navigate(new Visit(placeDefinition));\n });\n\n when(this.placeOutletModel).changes(outlet => this.handlePlaceOutLetChanged(outlet), {initialValue: \"triggerChange\"});\n this.activePlaceDefinition = chain(this._activePlaceComponent).pluck('placeDefinition');\n\n this.menuItems = chain(this.placeDefinitions).map(d => {\n return {\n place: d,\n active: this.activePlaceDefinition.value === d\n };\n }, {\n dependsOn: this.activePlaceDefinition\n });\n\n // const txo = new TransactionObserver({ verbose: true }).onEvent(e => console.log(e.name, e.payload));\n // txo.observe('this.placesModel', this.placesModel);\n // txo.observe('this.placeDefinitions', this.placeDefinitions);\n // txo.observe('this.activePlaceDefinition', this.activePlaceDefinition);\n // txo.observe('this.menuItems', this.menuItems);\n }\n\n protected handlePlaceOutLetChanged(outlet: PlaceOutletComponent) {\n this._activePlaceComponent.setDelegate(outlet ? outlet.activePlaceModel : null)\n }\n\n @Memoize()\n getNavigationFace(placeDef: PlaceDefinition): CommandFace {\n const navItem = placeDef.getPlaceData('nav') as NavItem;\n return {\n text: () => navItem ? navItem.title() : placeDef.searchPlaceData(['navTitle', 'title']),\n tooltip: () => navItem && navItem.tooltip ? navItem.tooltip() : placeDef.getPlaceData('navTooltip', null),\n icon: () => navItem && navItem.icon ? navItem.icon() : placeDef.getPlaceData('navIcon', null)\n };\n }\n\n ngOnInit() {\n }\n\n}\n"]}
|
|
@@ -37,7 +37,7 @@ export class PlaceRouter extends GarbageCollector {
|
|
|
37
37
|
* An observable model containing the authoriser function. This allows places to react to changes
|
|
38
38
|
* in permissions when any underlying auth logic changes, e.g. a role being removed from a user.
|
|
39
39
|
*/
|
|
40
|
-
this._accessGuard = new DelegatingValueModel().withDefault(new PlaceAccessGuard.NoAuth());
|
|
40
|
+
this._accessGuard = this.registerDisposable(new DelegatingValueModel().withDefault(new PlaceAccessGuard.NoAuth()));
|
|
41
41
|
if (window['Cypress']) {
|
|
42
42
|
window['aup.PlaceRouter'] = this;
|
|
43
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"place-router.js","sourceRoot":"","sources":["../../../../../../libs/angular-ui-powerups/src/lib/place/place-router.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAGL,gBAAgB,EAChB,aAAa,EACb,eAAe,EAEf,eAAe,EACf,MAAM,EAEP,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,MAAM,EACN,OAAO,EACP,YAAY,EACZ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ivatedRoute,\n ActivatedRouteSnapshot,\n NavigationCancel,\n NavigationEnd,\n NavigationError,\n NavigationExtras,\n NavigationStart,\n Router,\n RouterStateSnapshot\n} from '@angular/router';\nimport {\n assert,\n Binding,\n DebugContext,\n DelegatingValueModel,\n Dsl,\n GarbageCollector,\n lang,\n ListModel,\n MutableListModel,\n MutableValueModel,\n ValueModel,\n ValueModelChain\n} from '@coolon/pectin';\nimport { InteractionServiceRoutingAdapter } from '../interaction/services/interaction-service-routing-adapter';\nimport { InteractionService } from '../interaction/services/interaction.service';\nimport { NavigatingDuringInteraction } from './navigation/session/interactions/navigating-during-interaction';\nimport { PopStateDuringInteractionNavigation } from './navigation/session/interactions/pop-state-during-interaction-navigation';\nimport { SynchroniseInteractionContextIdsWithRoute } from './navigation/session/interactions/synchronise-interaction-context-ids-with-route';\nimport { Navigating } from './navigation/session/navigating';\nimport { NavigationContext } from './navigation/session/navigation-context';\nimport { NavigationSession } from './navigation/session/navigation-session';\nimport { PopStateNavigation } from './navigation/session/pop-state-navigation';\nimport { PlaceAccessGuard } from './place-access-guard';\nimport { PlaceDefinition } from './place-definition';\nimport { PlaceHistory } from './place-history';\nimport { UrlService } from './url-service';\nimport { UrlSnapshot } from './url-snapshot';\nimport { Visit } from './visit';\n\nfunction asArray<T>(item: T | T[]):T[] {\n return Array.isArray(item) ? item : [item];\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class PlaceRouter extends GarbageCollector {\n\n readonly navigationSessionModel = new MutableValueModel<NavigationSession>();\n readonly navigationInProgress: ValueModelChain<boolean>;\n readonly navigationSessionName: ValueModelChain<string>; // used by tests\n\n private readonly navigationContext: NavigationContext.Impl;\n\n private readonly _activeVisits = new MutableListModel<Visit>();\n private readonly routerInteractionAdapter: InteractionServiceRoutingAdapter;\n private sessionFinishedJobs: (() => void)[] = [];\n\n public readonly state: ValueModel<PlaceRouter.State>;\n\n /**\n * An observable model containing the authoriser function. This allows places to react to changes\n * in permissions when any underlying auth logic changes, e.g. a role being removed from a user.\n */\n private readonly _accessGuard = new DelegatingValueModel<PlaceAccessGuard>().withDefault(new PlaceAccessGuard.NoAuth());\n private redirections: PlaceRouter.Redirections;\n\n constructor(private readonly angularRouter: Router,\n private readonly angularLocation: Location,\n private readonly interactionService: InteractionService,\n private readonly urlService: UrlService,\n private readonly placeHistory: PlaceHistory) {\n super();\n\n if (window['Cypress']) {\n window['aup.PlaceRouter'] = this;\n }\n\n this.routerInteractionAdapter = interactionService.registerPlaceRouter(this);\n\n // TODO: Make this an interface and use 'this' instead.\n this.navigationContext = new NavigationContext.Impl(\n this.urlService,\n this.routerInteractionAdapter,\n (urlSnapshot: UrlSnapshot, options: { replaceUrl: boolean }) => {\n return this.navigateByUrl(urlSnapshot, options);\n },\n state => {\n this.transitionTo(state);\n },\n visits => {\n this.routingSessionFinished(visits);\n });\n\n const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);\n this.navigationInProgress = chain(this.navigationSessionModel).isNotNil();\n\n const idleStateName = chain(this.interactionService.active).map(active => active ? 'IdleDuringInteraction' : 'Idle');\n this.navigationSessionName = chain(this.navigationSessionModel)\n .pluck('name')\n .otherwise(idleStateName);\n\n DebugContext.tag(this._activeVisits, 'PlaceRouter.activeVisits');\n this.state = chain(this._activeVisits).reduce(visits => new PlaceRouter.State(visits));\n\n // TODO: make setup the callbacks in during module initiation to make this testable.\n angularRouter.events.subscribe(event => {\n // Routing event sequence\n // ======================\n // NavigationStart -> .... -> NavigationCancel --> redirect, go around again in the same session\n // NavigationStart -> .... -> NavigationEnd --> navigation complete, end session.\n // NavigationStart -> .... -> NavigationError --> navigation aborted, end session.\n // =======================\n if (event instanceof NavigationStart) {\n // console.log(`---> NavigationStart[${event.id}]: ${event.url} (${event.navigationTrigger})`);\n if (event.navigationTrigger === 'popstate') {\n this.onPopState(event);\n } else {\n this.onRouterStarted(event);\n }\n // console.log(`<--- NavigationStart[${event.id}]: ${event.url} (${event.navigationTrigger})`);\n }\n if (event instanceof NavigationEnd) {\n // console.log(`---> NavigationEnd[${event.id}]: ${event.url}`);\n this.onRouterEnd(event);\n // console.log(`<--- NavigationEnd[${event.id}]: ${event.url}`);\n }\n if (event instanceof NavigationError) {\n // console.log(`---> NavigationError[${event.id}]: ${event.url}`);\n this.onRouterError(event);\n // console.log(`<--- NavigationError[${event.id}]: ${event.url}`);\n }\n if (event instanceof NavigationCancel) {\n // console.log(`---> NavigationCancel[${event.id}]: ${event.url}`);\n this.onRouterCancelled(event);\n // console.log(`<--- NavigationCancel[${event.id}]: ${event.url}`);\n }\n });\n\n // The router needs to know about url changes and in some cases they are the only way the router can know if\n // the back button was clicked.\n angularLocation.onUrlChange(url => this.onUrlChanged(url));\n\n }\n\n get accessGuard(): ValueModel<PlaceAccessGuard> {\n return this._accessGuard.readonly;\n }\n\n // @Trace()\n configureAuth(accessGrant: ValueModel<PlaceAccessGuard>, redirections: PlaceRouter.Redirections) {\n // We need a shitty mutable model until setDelegate is clever enough to work with readonly models.\n const hackyMutableModel = new MutableValueModel<PlaceAccessGuard>();\n const binding = new Binding(hackyMutableModel, accessGrant, {\n toRight(leftValue: PlaceAccessGuard) {\n return lang.illegalState('hackyMutableModel is read only');\n },\n toLeft: (rightValue: PlaceAccessGuard) => rightValue\n });\n binding.writeLeft();\n this._accessGuard.setDelegate(hackyMutableModel);\n this.redirections = redirections;\n }\n\n getAuthenticationFailureRedirect(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Visit {\n return this.redirections.onAuthenticationFailure(activatedRoute, state);\n }\n\n get navigationSession() {\n return this.navigationSessionModel.value;\n }\n\n get currentSession() {\n return this.navigationSessionModel.value;\n }\n\n isNavigating(): boolean {\n return this.navigationInProgress.value;\n }\n\n waitUntilIdle(): Promise<this> {\n const { when } = Dsl.disposeWith(this);\n return new Promise<this>(resolve => {\n when(this.navigationInProgress).becomesFalsey(() => resolve(this), {\n initialValue: 'evaluate',\n once: true\n });\n });\n }\n\n // @Trace()\n onPopState(event: NavigationStart) {\n assert.isTruthy(event.navigationTrigger === 'popstate');\n if (this.currentSession) {\n this.currentSession.onPopState(event);\n } else {\n const poppedHistoryUrl = event.url;\n const currentRouterUrl = this.urlService.getCurrentRouterUrl();\n const session = this.interactionService.isActive() ?\n new PopStateDuringInteractionNavigation(this.navigationContext, currentRouterUrl, poppedHistoryUrl) :\n new PopStateNavigation(this.navigationContext, currentRouterUrl, poppedHistoryUrl);\n this.transitionTo(session);\n }\n }\n\n // @Trace()\n onRouterStarted(event: NavigationStart) {\n assert.isFalsey(event.navigationTrigger === 'popstate');\n const inInteraction = this.interactionService.isActive();\n if (this.currentSession) {\n this.currentSession.onRouterStarted(event);\n } else {\n this.transitionTo(this.createNavigationSession(this.urlService.getCurrentRouterUrl()));\n }\n }\n\n // @Trace()\n onUrlChanged(newUrl: string) {\n // the back button can trigger a url change without a navigation session in progress so we\n // console.log(`---> Url Changed ${newUrl}`);\n if (this.currentSession) {\n this.currentSession.onUrlChange(newUrl);\n } else {\n console.log('FYI: url changed without a navigation session in progress');\n }\n // console.log(`<--- Url Changed`);\n }\n\n // @Trace()\n onRouterCancelled(event: NavigationCancel) {\n this.currentSession.onRouterCancelled(event);\n }\n\n // @Trace()\n onRouterError(event: NavigationError) {\n this.currentSession.onRouterError(event);\n }\n\n // @Trace()\n onRouterEnd(event: NavigationEnd) {\n this.currentSession.onRouterEnd(event);\n }\n\n navigate(visit: Visit | Visit[], options?: { relativeTo: ActivatedRoute }) {\n const commands = asArray(visit).reduce((result, v) => {\n return [...result, v.placeDefinition.path, ...this.createRouteParameters(v)];\n }, []);\n return this.doNavigation(visit, async router => {\n await this.angularRouter.navigate(commands, {\n relativeTo: options ? options.relativeTo : null\n });\n });\n }\n\n // @Trace()\n async doNavigation(visit: Visit| Visit[], runNavigationCommands: (router: Router) => any) {\n if (this.navigationInProgress.value) {\n lang.illegalState('Navigation already in progress');\n }\n const navigation = this.createNavigationSession(this.urlService.getCurrentRouterUrl());\n asArray(visit).forEach(v => navigation.storeVisit(v));\n this.transitionTo(navigation);\n try {\n await runNavigationCommands(this.angularRouter);\n } finally {\n // Check if the router has finished (in the case where no router change required) and we're still in a\n // transient state and finish of the transition.\n if (!this.angularRouter.getCurrentNavigation() && this.currentSession) {\n this.currentSession.onRouterEnd(new NavigationEnd(-1, '', ''));\n }\n }\n }\n\n navigateByUrl(urlSnapshot: UrlSnapshot, navigationExtras?: NavigationExtras): Promise<boolean> {\n console.log(`### navigationByUrl -> ${urlSnapshot.urlTree.toString()}`);\n return this.angularRouter.navigateByUrl(urlSnapshot.urlTree, navigationExtras);\n }\n\n get activeVisits(): ListModel<Visit> {\n return this._activeVisits.readonly;\n }\n\n // @Trace()\n async pushVisitChangesToRoute(previous: Visit, next: Visit): Promise<void> {\n this.placeHistory.updateVisit(next);\n\n // FIXME: no route id -> route id duplicates route parameters\n if (next.hasRoutingChangedFrom(previous)) {\n return this.doNavigation(next, router => {\n const urlSnapshot = this.urlService.parseUrl(this.angularRouter.routerState.snapshot.url).updateVisitSegments(next);\n // console.log('### Push Changes to route Redirect', { commands: urlSnapshot.url });\n return this.navigateByUrl(urlSnapshot);\n });\n }\n }\n\n\n private createNavigationSession(currentRouterUrl: string): NavigationSession {\n const inInteraction = this.interactionService.isActive();\n return inInteraction ?\n new NavigatingDuringInteraction(this.navigationContext, currentRouterUrl) :\n new Navigating(this.navigationContext, currentRouterUrl);\n }\n\n // @Trace()\n protected transitionTo(next: NavigationSession) {\n const previous = this.navigationSessionModel.value;\n if (!previous) {\n this.placeHistory.notifyNavigationStarted();\n }\n assert.isTruthy(next !== previous);\n // Logger.get(this).info(`### Router State Transition: ${previous ? previous.toString() : 'null'} -> ${next.toString()}`);\n this.navigationSessionModel.value = next;\n if (!!previous) {\n previous.dispose();\n }\n next.notifyActive();\n }\n\n // @Trace()\n private routingSessionFinished(visits: Visit[]) {\n if (visits && visits.length > 0) {\n assert.isTruthy(this.navigationInProgress.value);\n this.placeHistory.notifyNavigationFinished(visits);\n // We update the active visits before we finish the session so the\n // place outlets can ignore the incoming changes until things are\n // settled. TODO: can we removed the event'ness here and just do a push?\n this._activeVisits.value = visits;\n }\n const session = this.currentSession;\n session.dispose();\n this.navigationSessionModel.value = null;\n // console.log(`### Router Session Finished (was ${session.toString()})`);\n this.sessionFinishedJobs.forEach(job => job());\n this.sessionFinishedJobs = [];\n }\n\n private runAfterRoutingSessionFinishes(func: () => void) {\n assert.isTruthy(this.navigationInProgress);\n this.sessionFinishedJobs.push(func);\n }\n\n\n /**\n * Sync's the current interaction state with the URL. We need to push something in the URL in order\n * to be able to capture the back button on the first page. If we don't then the back click will exit\n * the app directly and we don't get to ask.\n */\n // @Trace()\n syncInteractionContextIdsWithRouter(): Promise<void> {\n if (this.navigationSession) {\n // console.log(`Navigation active -> ${this.navigationSession.toString()}, sync delayed until finished.`);\n const session = this.navigationSession;\n return new Promise<void>((resolve, reject) => {\n this.runAfterRoutingSessionFinishes(() => {\n this.runAfterRoutingSessionFinishes(resolve);\n const syncSession = new SynchroniseInteractionContextIdsWithRoute(this.navigationContext, this.urlService.getCurrentRouterUrl(), false);\n this.transitionTo(syncSession);\n });\n });\n } else {\n return new Promise<void>(((resolve, reject) => {\n // console.log(`No navigation in progress, starting synchronisation job`);\n this.runAfterRoutingSessionFinishes(resolve);\n const session = new SynchroniseInteractionContextIdsWithRoute(this.navigationContext, this.urlService.getCurrentRouterUrl(), false);\n this.transitionTo(session);\n }));\n\n }\n }\n\n\n private createRouteParameters(visit: Visit) {\n const def = visit.placeDefinition;\n return visit.hasRouteId() ?\n [def.getFormattedRouteId(visit), def.getFormattedRouteParameters(visit)] :\n [def.getFormattedRouteParameters(visit)];\n }\n\n}\n\nexport namespace PlaceRouter {\n\n export interface Redirections {\n onAuthenticationFailure(activatedRoute?: ActivatedRouteSnapshot, state?: RouterStateSnapshot): Visit;\n }\n\n export class State {\n constructor(private readonly activeVisits: Visit[]) {\n }\n\n isPlaceActive(placeDefinition: PlaceDefinition): boolean {\n return !!this.getVisitFor(placeDefinition);\n }\n\n getVisitFor(placeDefinition: PlaceDefinition): Visit {\n return this.activeVisits.find(v => v.placeDefinition === placeDefinition);\n }\n }\n\n}\n"]}
|
|
1
|
+
{"version":3,"file":"place-router.js","sourceRoot":"","sources":["../../../../../../libs/angular-ui-powerups/src/lib/place/place-router.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAGL,gBAAgB,EAChB,aAAa,EACb,eAAe,EAEf,eAAe,EACf,MAAM,EAEP,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,MAAM,EACN,OAAO,EACP,YAAY,EACZ,oBAAoB,EACpB,GAAG,EACH,gBAAgB,EAChB,IAAI,EAEJ,gBAAgB,EAChB,iBAAiB,EAGlB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AACjF,OAAO,EAAE,2BAA2B,EAAE,MAAM,iEAAiE,CAAC;AAC9G,OAAO,EAAE,mCAAmC,EAAE,MAAM,2EAA2E,CAAC;AAChI,OAAO,EAAE,yCAAyC,EAAE,MAAM,kFAAkF,CAAC;AAC7I,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAE5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;;;;;;;AAI3C,SAAS,OAAO,CAAI,IAAa;IAC/B,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAC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M1B,MAAa,KAAK;QAChB,YAA6B,YAAqB;YAArB,iBAAY,GAAZ,YAAY,CAAS;QAClD,CAAC;QAED,aAAa,CAAC,eAAgC;YAC5C,OAAO,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;QAC7C,CAAC;QAED,WAAW,CAAC,eAAgC;YAC1C,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,eAAe,KAAK,eAAe,CAAC,CAAC;QAC5E,CAAC;KACF;IAXY,iBAAK,QAWjB,CAAA;AAEH,CAAC,EAnBgB,WAAW,KAAX,WAAW,QAmB3B","sourcesContent":["import { Location } from '@angular/common';\nimport { Injectable } from '@angular/core';\nimport {\n ActivatedRoute,\n ActivatedRouteSnapshot,\n NavigationCancel,\n NavigationEnd,\n NavigationError,\n NavigationExtras,\n NavigationStart,\n Router,\n RouterStateSnapshot\n} from '@angular/router';\nimport {\n assert,\n Binding,\n DebugContext,\n DelegatingValueModel,\n Dsl,\n GarbageCollector,\n lang,\n ListModel,\n MutableListModel,\n MutableValueModel,\n ValueModel,\n ValueModelChain\n} from '@coolon/pectin';\nimport { InteractionServiceRoutingAdapter } from '../interaction/services/interaction-service-routing-adapter';\nimport { InteractionService } from '../interaction/services/interaction.service';\nimport { NavigatingDuringInteraction } from './navigation/session/interactions/navigating-during-interaction';\nimport { PopStateDuringInteractionNavigation } from './navigation/session/interactions/pop-state-during-interaction-navigation';\nimport { SynchroniseInteractionContextIdsWithRoute } from './navigation/session/interactions/synchronise-interaction-context-ids-with-route';\nimport { Navigating } from './navigation/session/navigating';\nimport { NavigationContext } from './navigation/session/navigation-context';\nimport { NavigationSession } from './navigation/session/navigation-session';\nimport { PopStateNavigation } from './navigation/session/pop-state-navigation';\nimport { PlaceAccessGuard } from './place-access-guard';\nimport { PlaceDefinition } from './place-definition';\nimport { PlaceHistory } from './place-history';\nimport { UrlService } from './url-service';\nimport { UrlSnapshot } from './url-snapshot';\nimport { Visit } from './visit';\n\nfunction asArray<T>(item: T | T[]):T[] {\n return Array.isArray(item) ? item : [item];\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class PlaceRouter extends GarbageCollector {\n\n readonly navigationSessionModel = new MutableValueModel<NavigationSession>();\n readonly navigationInProgress: ValueModelChain<boolean>;\n readonly navigationSessionName: ValueModelChain<string>; // used by tests\n\n private readonly navigationContext: NavigationContext.Impl;\n\n private readonly _activeVisits = new MutableListModel<Visit>();\n private readonly routerInteractionAdapter: InteractionServiceRoutingAdapter;\n private sessionFinishedJobs: (() => void)[] = [];\n\n public readonly state: ValueModel<PlaceRouter.State>;\n\n /**\n * An observable model containing the authoriser function. This allows places to react to changes\n * in permissions when any underlying auth logic changes, e.g. a role being removed from a user.\n */\n private readonly _accessGuard = this.registerDisposable(new DelegatingValueModel<PlaceAccessGuard>().withDefault(new PlaceAccessGuard.NoAuth()));\n private redirections: PlaceRouter.Redirections;\n\n constructor(private readonly angularRouter: Router,\n private readonly angularLocation: Location,\n private readonly interactionService: InteractionService,\n private readonly urlService: UrlService,\n private readonly placeHistory: PlaceHistory) {\n super();\n\n if (window['Cypress']) {\n window['aup.PlaceRouter'] = this;\n }\n\n this.routerInteractionAdapter = interactionService.registerPlaceRouter(this);\n\n // TODO: Make this an interface and use 'this' instead.\n this.navigationContext = new NavigationContext.Impl(\n this.urlService,\n this.routerInteractionAdapter,\n (urlSnapshot: UrlSnapshot, options: { replaceUrl: boolean }) => {\n return this.navigateByUrl(urlSnapshot, options);\n },\n state => {\n this.transitionTo(state);\n },\n visits => {\n this.routingSessionFinished(visits);\n });\n\n const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);\n this.navigationInProgress = chain(this.navigationSessionModel).isNotNil();\n\n const idleStateName = chain(this.interactionService.active).map(active => active ? 'IdleDuringInteraction' : 'Idle');\n this.navigationSessionName = chain(this.navigationSessionModel)\n .pluck('name')\n .otherwise(idleStateName);\n\n DebugContext.tag(this._activeVisits, 'PlaceRouter.activeVisits');\n this.state = chain(this._activeVisits).reduce(visits => new PlaceRouter.State(visits));\n\n // TODO: make setup the callbacks in during module initiation to make this testable.\n angularRouter.events.subscribe(event => {\n // Routing event sequence\n // ======================\n // NavigationStart -> .... -> NavigationCancel --> redirect, go around again in the same session\n // NavigationStart -> .... -> NavigationEnd --> navigation complete, end session.\n // NavigationStart -> .... -> NavigationError --> navigation aborted, end session.\n // =======================\n if (event instanceof NavigationStart) {\n // console.log(`---> NavigationStart[${event.id}]: ${event.url} (${event.navigationTrigger})`);\n if (event.navigationTrigger === 'popstate') {\n this.onPopState(event);\n } else {\n this.onRouterStarted(event);\n }\n // console.log(`<--- NavigationStart[${event.id}]: ${event.url} (${event.navigationTrigger})`);\n }\n if (event instanceof NavigationEnd) {\n // console.log(`---> NavigationEnd[${event.id}]: ${event.url}`);\n this.onRouterEnd(event);\n // console.log(`<--- NavigationEnd[${event.id}]: ${event.url}`);\n }\n if (event instanceof NavigationError) {\n // console.log(`---> NavigationError[${event.id}]: ${event.url}`);\n this.onRouterError(event);\n // console.log(`<--- NavigationError[${event.id}]: ${event.url}`);\n }\n if (event instanceof NavigationCancel) {\n // console.log(`---> NavigationCancel[${event.id}]: ${event.url}`);\n this.onRouterCancelled(event);\n // console.log(`<--- NavigationCancel[${event.id}]: ${event.url}`);\n }\n });\n\n // The router needs to know about url changes and in some cases they are the only way the router can know if\n // the back button was clicked.\n angularLocation.onUrlChange(url => this.onUrlChanged(url));\n\n }\n\n get accessGuard(): ValueModel<PlaceAccessGuard> {\n return this._accessGuard.readonly;\n }\n\n // @Trace()\n configureAuth(accessGrant: ValueModel<PlaceAccessGuard>, redirections: PlaceRouter.Redirections) {\n // We need a shitty mutable model until setDelegate is clever enough to work with readonly models.\n const hackyMutableModel = new MutableValueModel<PlaceAccessGuard>();\n const binding = new Binding(hackyMutableModel, accessGrant, {\n toRight(leftValue: PlaceAccessGuard) {\n return lang.illegalState('hackyMutableModel is read only');\n },\n toLeft: (rightValue: PlaceAccessGuard) => rightValue\n });\n binding.writeLeft();\n this._accessGuard.setDelegate(hackyMutableModel);\n this.redirections = redirections;\n }\n\n getAuthenticationFailureRedirect(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Visit {\n return this.redirections.onAuthenticationFailure(activatedRoute, state);\n }\n\n get navigationSession() {\n return this.navigationSessionModel.value;\n }\n\n get currentSession() {\n return this.navigationSessionModel.value;\n }\n\n isNavigating(): boolean {\n return this.navigationInProgress.value;\n }\n\n waitUntilIdle(): Promise<this> {\n const { when } = Dsl.disposeWith(this);\n return new Promise<this>(resolve => {\n when(this.navigationInProgress).becomesFalsey(() => resolve(this), {\n initialValue: 'evaluate',\n once: true\n });\n });\n }\n\n // @Trace()\n onPopState(event: NavigationStart) {\n assert.isTruthy(event.navigationTrigger === 'popstate');\n if (this.currentSession) {\n this.currentSession.onPopState(event);\n } else {\n const poppedHistoryUrl = event.url;\n const currentRouterUrl = this.urlService.getCurrentRouterUrl();\n const session = this.interactionService.isActive() ?\n new PopStateDuringInteractionNavigation(this.navigationContext, currentRouterUrl, poppedHistoryUrl) :\n new PopStateNavigation(this.navigationContext, currentRouterUrl, poppedHistoryUrl);\n this.transitionTo(session);\n }\n }\n\n // @Trace()\n onRouterStarted(event: NavigationStart) {\n assert.isFalsey(event.navigationTrigger === 'popstate');\n const inInteraction = this.interactionService.isActive();\n if (this.currentSession) {\n this.currentSession.onRouterStarted(event);\n } else {\n this.transitionTo(this.createNavigationSession(this.urlService.getCurrentRouterUrl()));\n }\n }\n\n // @Trace()\n onUrlChanged(newUrl: string) {\n // the back button can trigger a url change without a navigation session in progress so we\n // console.log(`---> Url Changed ${newUrl}`);\n if (this.currentSession) {\n this.currentSession.onUrlChange(newUrl);\n } else {\n console.log('FYI: url changed without a navigation session in progress');\n }\n // console.log(`<--- Url Changed`);\n }\n\n // @Trace()\n onRouterCancelled(event: NavigationCancel) {\n this.currentSession.onRouterCancelled(event);\n }\n\n // @Trace()\n onRouterError(event: NavigationError) {\n this.currentSession.onRouterError(event);\n }\n\n // @Trace()\n onRouterEnd(event: NavigationEnd) {\n this.currentSession.onRouterEnd(event);\n }\n\n navigate(visit: Visit | Visit[], options?: { relativeTo: ActivatedRoute }) {\n const commands = asArray(visit).reduce((result, v) => {\n return [...result, v.placeDefinition.path, ...this.createRouteParameters(v)];\n }, []);\n return this.doNavigation(visit, async router => {\n await this.angularRouter.navigate(commands, {\n relativeTo: options ? options.relativeTo : null\n });\n });\n }\n\n // @Trace()\n async doNavigation(visit: Visit| Visit[], runNavigationCommands: (router: Router) => any) {\n if (this.navigationInProgress.value) {\n lang.illegalState('Navigation already in progress');\n }\n const navigation = this.createNavigationSession(this.urlService.getCurrentRouterUrl());\n asArray(visit).forEach(v => navigation.storeVisit(v));\n this.transitionTo(navigation);\n try {\n await runNavigationCommands(this.angularRouter);\n } finally {\n // Check if the router has finished (in the case where no router change required) and we're still in a\n // transient state and finish of the transition.\n if (!this.angularRouter.getCurrentNavigation() && this.currentSession) {\n this.currentSession.onRouterEnd(new NavigationEnd(-1, '', ''));\n }\n }\n }\n\n navigateByUrl(urlSnapshot: UrlSnapshot, navigationExtras?: NavigationExtras): Promise<boolean> {\n console.log(`### navigationByUrl -> ${urlSnapshot.urlTree.toString()}`);\n return this.angularRouter.navigateByUrl(urlSnapshot.urlTree, navigationExtras);\n }\n\n get activeVisits(): ListModel<Visit> {\n return this._activeVisits.readonly;\n }\n\n // @Trace()\n async pushVisitChangesToRoute(previous: Visit, next: Visit): Promise<void> {\n this.placeHistory.updateVisit(next);\n\n // FIXME: no route id -> route id duplicates route parameters\n if (next.hasRoutingChangedFrom(previous)) {\n return this.doNavigation(next, router => {\n const urlSnapshot = this.urlService.parseUrl(this.angularRouter.routerState.snapshot.url).updateVisitSegments(next);\n // console.log('### Push Changes to route Redirect', { commands: urlSnapshot.url });\n return this.navigateByUrl(urlSnapshot);\n });\n }\n }\n\n\n private createNavigationSession(currentRouterUrl: string): NavigationSession {\n const inInteraction = this.interactionService.isActive();\n return inInteraction ?\n new NavigatingDuringInteraction(this.navigationContext, currentRouterUrl) :\n new Navigating(this.navigationContext, currentRouterUrl);\n }\n\n // @Trace()\n protected transitionTo(next: NavigationSession) {\n const previous = this.navigationSessionModel.value;\n if (!previous) {\n this.placeHistory.notifyNavigationStarted();\n }\n assert.isTruthy(next !== previous);\n // Logger.get(this).info(`### Router State Transition: ${previous ? previous.toString() : 'null'} -> ${next.toString()}`);\n this.navigationSessionModel.value = next;\n if (!!previous) {\n previous.dispose();\n }\n next.notifyActive();\n }\n\n // @Trace()\n private routingSessionFinished(visits: Visit[]) {\n if (visits && visits.length > 0) {\n assert.isTruthy(this.navigationInProgress.value);\n this.placeHistory.notifyNavigationFinished(visits);\n // We update the active visits before we finish the session so the\n // place outlets can ignore the incoming changes until things are\n // settled. TODO: can we removed the event'ness here and just do a push?\n this._activeVisits.value = visits;\n }\n const session = this.currentSession;\n session.dispose();\n this.navigationSessionModel.value = null;\n // console.log(`### Router Session Finished (was ${session.toString()})`);\n this.sessionFinishedJobs.forEach(job => job());\n this.sessionFinishedJobs = [];\n }\n\n private runAfterRoutingSessionFinishes(func: () => void) {\n assert.isTruthy(this.navigationInProgress);\n this.sessionFinishedJobs.push(func);\n }\n\n\n /**\n * Sync's the current interaction state with the URL. We need to push something in the URL in order\n * to be able to capture the back button on the first page. If we don't then the back click will exit\n * the app directly and we don't get to ask.\n */\n // @Trace()\n syncInteractionContextIdsWithRouter(): Promise<void> {\n if (this.navigationSession) {\n // console.log(`Navigation active -> ${this.navigationSession.toString()}, sync delayed until finished.`);\n const session = this.navigationSession;\n return new Promise<void>((resolve, reject) => {\n this.runAfterRoutingSessionFinishes(() => {\n this.runAfterRoutingSessionFinishes(resolve);\n const syncSession = new SynchroniseInteractionContextIdsWithRoute(this.navigationContext, this.urlService.getCurrentRouterUrl(), false);\n this.transitionTo(syncSession);\n });\n });\n } else {\n return new Promise<void>(((resolve, reject) => {\n // console.log(`No navigation in progress, starting synchronisation job`);\n this.runAfterRoutingSessionFinishes(resolve);\n const session = new SynchroniseInteractionContextIdsWithRoute(this.navigationContext, this.urlService.getCurrentRouterUrl(), false);\n this.transitionTo(session);\n }));\n\n }\n }\n\n\n private createRouteParameters(visit: Visit) {\n const def = visit.placeDefinition;\n return visit.hasRouteId() ?\n [def.getFormattedRouteId(visit), def.getFormattedRouteParameters(visit)] :\n [def.getFormattedRouteParameters(visit)];\n }\n\n}\n\nexport namespace PlaceRouter {\n\n export interface Redirections {\n onAuthenticationFailure(activatedRoute?: ActivatedRouteSnapshot, state?: RouterStateSnapshot): Visit;\n }\n\n export class State {\n constructor(private readonly activeVisits: Visit[]) {\n }\n\n isPlaceActive(placeDefinition: PlaceDefinition): boolean {\n return !!this.getVisitFor(placeDefinition);\n }\n\n getVisitFor(placeDefinition: PlaceDefinition): Visit {\n return this.activeVisits.find(v => v.placeDefinition === placeDefinition);\n }\n }\n\n}\n"]}
|
|
@@ -49,7 +49,7 @@ class CommandDirective extends GarbageCollector {
|
|
|
49
49
|
constructor(elementRef, matButton, matMenuItem) {
|
|
50
50
|
super();
|
|
51
51
|
this.elementRef = elementRef;
|
|
52
|
-
this._commandEnabled = new DelegatingValueModel().withDefault(false);
|
|
52
|
+
this._commandEnabled = this.registerDisposable(new DelegatingValueModel().withDefault(false));
|
|
53
53
|
this._commandParameterProvided = false;
|
|
54
54
|
// Material buttons and menu items don't respond to the disabled binding so we
|
|
55
55
|
// need to inject them from our host element and handle them manually.
|
|
@@ -943,7 +943,7 @@ class AbstractPopupMenuComponent extends PopupAwareComponent {
|
|
|
943
943
|
constructor(element, parent) {
|
|
944
944
|
super(element, parent);
|
|
945
945
|
this._unorderedChildren = new MutableListModel();
|
|
946
|
-
this.faceModelDelegate = new DelegatingValueModel();
|
|
946
|
+
this.faceModelDelegate = this.registerDisposable(new DelegatingValueModel());
|
|
947
947
|
this.xPosition = 'after';
|
|
948
948
|
this.yPosition = 'below';
|
|
949
949
|
const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
|
|
@@ -1198,7 +1198,7 @@ __decorate([
|
|
|
1198
1198
|
class PopupMenuRendererComponent extends DisposableComponent {
|
|
1199
1199
|
constructor() {
|
|
1200
1200
|
super();
|
|
1201
|
-
this._childList = new DelegatingListModel();
|
|
1201
|
+
this._childList = this.registerDisposable(new DelegatingListModel());
|
|
1202
1202
|
this.commandFired = new EventEmitter();
|
|
1203
1203
|
this.TrackBy = TrackBy;
|
|
1204
1204
|
const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
|
|
@@ -2457,14 +2457,15 @@ const noop = () => {
|
|
|
2457
2457
|
};
|
|
2458
2458
|
const ɵ0 = noop;
|
|
2459
2459
|
const CELL_RENDERER_COMPONENT_ROW_CACHE = Symbol('aup-cell-renderer:row-data-cache');
|
|
2460
|
-
class ColumnModel {
|
|
2460
|
+
class ColumnModel extends GarbageCollector {
|
|
2461
2461
|
constructor(columnId, textPropertiesProvider) {
|
|
2462
|
+
super();
|
|
2462
2463
|
this.columnId = columnId;
|
|
2463
2464
|
this.textPropertiesProvider = textPropertiesProvider;
|
|
2464
2465
|
this._enableRowSelection = true;
|
|
2465
2466
|
this._flex = false;
|
|
2466
|
-
this._defaultVisibility = new DelegatingValueModel().withDefault(true);
|
|
2467
|
-
this._visible = new DelegatingValueModel().withDefault(this._defaultVisibility);
|
|
2467
|
+
this._defaultVisibility = this.registerDisposable(new DelegatingValueModel().withDefault(true));
|
|
2468
|
+
this._visible = this.registerDisposable(new DelegatingValueModel().withDefault(this._defaultVisibility));
|
|
2468
2469
|
this.installHeaderRenderer();
|
|
2469
2470
|
this.dasherisedColumnId = Stringy.from(columnId).dasherize().toString();
|
|
2470
2471
|
}
|
|
@@ -3022,7 +3023,7 @@ class RowClass {
|
|
|
3022
3023
|
class AbstractTableModel extends GarbageCollector {
|
|
3023
3024
|
constructor() {
|
|
3024
3025
|
super();
|
|
3025
|
-
this._dataSource = new DelegatingListModel();
|
|
3026
|
+
this._dataSource = this.registerDisposable(new DelegatingListModel());
|
|
3026
3027
|
this._columnList = this.registerDisposable(new ColumnListModel());
|
|
3027
3028
|
this._editorSessions = new MutableListModel();
|
|
3028
3029
|
this.rowClassNamePredicates = [];
|
|
@@ -4383,7 +4384,7 @@ const ACTIVITY_DATA = new InjectionToken('InteractionActivityData');
|
|
|
4383
4384
|
class Activity extends DisposableComponent {
|
|
4384
4385
|
constructor() {
|
|
4385
4386
|
super();
|
|
4386
|
-
this._busyModel = new DelegatingValueModel().withDefault(false);
|
|
4387
|
+
this._busyModel = this.registerDisposable(new DelegatingValueModel().withDefault(false));
|
|
4387
4388
|
this._focusedModel = this.registerDisposable(new DelegatingValueModel());
|
|
4388
4389
|
this.class = 'aup-activity';
|
|
4389
4390
|
}
|
|
@@ -4720,7 +4721,7 @@ class ActivityContainerComponent extends AbstractInteractionContext {
|
|
|
4720
4721
|
this.activityRefs = [];
|
|
4721
4722
|
this.garbage = new GarbageCollector();
|
|
4722
4723
|
this.inAnimation = new MutableValueModel(false);
|
|
4723
|
-
this.busy = new DelegatingValueModel().withDefault(false);
|
|
4724
|
+
this.busy = this.registerDisposable(new DelegatingValueModel().withDefault(false));
|
|
4724
4725
|
this.registerDisposable(this.busy);
|
|
4725
4726
|
}
|
|
4726
4727
|
ngOnInit() {
|
|
@@ -5143,7 +5144,7 @@ InteractionService.ctorParameters = () => [
|
|
|
5143
5144
|
constructor() {
|
|
5144
5145
|
super();
|
|
5145
5146
|
this._interactions = new MutableListModel();
|
|
5146
|
-
this._disabledDelegate = new DelegatingValueModel().withDefault(false);
|
|
5147
|
+
this._disabledDelegate = this.registerDisposable(new DelegatingValueModel().withDefault(false));
|
|
5147
5148
|
const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
|
|
5148
5149
|
this.active = chain(this._interactions).isNotEmpty();
|
|
5149
5150
|
this.interactionContextIds = chain(this._interactions).pluck("identifier");
|
|
@@ -7796,7 +7797,7 @@ class PlaceRouter extends GarbageCollector {
|
|
|
7796
7797
|
* An observable model containing the authoriser function. This allows places to react to changes
|
|
7797
7798
|
* in permissions when any underlying auth logic changes, e.g. a role being removed from a user.
|
|
7798
7799
|
*/
|
|
7799
|
-
this._accessGuard = new DelegatingValueModel().withDefault(new PlaceAccessGuard.NoAuth());
|
|
7800
|
+
this._accessGuard = this.registerDisposable(new DelegatingValueModel().withDefault(new PlaceAccessGuard.NoAuth()));
|
|
7800
7801
|
if (window['Cypress']) {
|
|
7801
7802
|
window['aup.PlaceRouter'] = this;
|
|
7802
7803
|
}
|
|
@@ -8375,7 +8376,7 @@ class AbstractPlaceNavigationComponent extends DisposableComponent {
|
|
|
8375
8376
|
constructor(placeRouter) {
|
|
8376
8377
|
super();
|
|
8377
8378
|
this.placeRouter = placeRouter;
|
|
8378
|
-
this._activePlaceComponent = new DelegatingValueModel();
|
|
8379
|
+
this._activePlaceComponent = this.registerDisposable(new DelegatingValueModel());
|
|
8379
8380
|
this.trackByPlaceDef = (data) => data.place;
|
|
8380
8381
|
const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
|
|
8381
8382
|
this.placeDefinitions = chain(this.placesModel)
|