@coolon/angular-ui-powerups 12.4.1 → 12.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/bundles/coolon-angular-ui-powerups-cypress.umd.js +14 -34
  2. package/bundles/coolon-angular-ui-powerups-cypress.umd.js.map +1 -1
  3. package/bundles/coolon-angular-ui-powerups.umd.js +102 -104
  4. package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
  5. package/coolon-angular-ui-powerups.metadata.json +1 -1
  6. package/cypress/coolon-angular-ui-powerups-cypress.metadata.json +1 -1
  7. package/esm2015/cypress/component-builder.js +3 -3
  8. package/esm2015/cypress/component-builder.js.map +1 -1
  9. package/esm2015/cypress/component-builder.metadata.json +1 -1
  10. package/esm2015/cypress/components/aup-abstract-table.js +3 -3
  11. package/esm2015/cypress/components/aup-abstract-table.js.map +1 -1
  12. package/esm2015/cypress/components/aup-abstract-table.metadata.json +1 -1
  13. package/esm2015/cypress/components/aup-command.js +2 -2
  14. package/esm2015/cypress/components/aup-command.js.map +1 -1
  15. package/esm2015/cypress/components/aup-command.metadata.json +1 -1
  16. package/esm2015/cypress/components/aup-tree-table.js +1 -1
  17. package/esm2015/cypress/components/aup-tree-table.js.map +1 -1
  18. package/esm2015/cypress/components/aup-tree-table.metadata.json +1 -1
  19. package/esm2015/cypress/page-element.js +3 -3
  20. package/esm2015/cypress/page-element.js.map +1 -1
  21. package/esm2015/cypress/page-element.metadata.json +1 -1
  22. package/esm2015/cypress/page.js +3 -3
  23. package/esm2015/cypress/page.js.map +1 -1
  24. package/esm2015/cypress/page.metadata.json +1 -1
  25. package/esm2015/lib/components/cards/card-container/card-container.component.js +4 -4
  26. package/esm2015/lib/components/cards/card-container/card-container.component.js.map +1 -1
  27. package/esm2015/lib/components/cards/card-container/card-container.component.metadata.json +1 -1
  28. package/esm2015/lib/components/commands/command/command.component.js +2 -2
  29. package/esm2015/lib/components/commands/command/command.component.js.map +1 -1
  30. package/esm2015/lib/components/commands/command/command.component.metadata.json +1 -1
  31. package/esm2015/lib/components/commands/command-face.js +8 -8
  32. package/esm2015/lib/components/commands/command-face.js.map +1 -1
  33. package/esm2015/lib/components/forms/autocomplete-input/autocomplete-input.component.js +3 -3
  34. package/esm2015/lib/components/forms/autocomplete-input/autocomplete-input.component.js.map +1 -1
  35. package/esm2015/lib/components/forms/autocomplete-input/autocomplete-input.component.metadata.json +1 -1
  36. package/esm2015/lib/components/tables/abstract-table-model.js +3 -3
  37. package/esm2015/lib/components/tables/abstract-table-model.js.map +1 -1
  38. package/esm2015/lib/components/tables/abstract-table-model.metadata.json +1 -1
  39. package/esm2015/lib/components/tables/column-list-model.js +2 -2
  40. package/esm2015/lib/components/tables/column-list-model.js.map +1 -1
  41. package/esm2015/lib/components/tables/column-list-model.metadata.json +1 -1
  42. package/esm2015/lib/components/tables/table/column-model.js +12 -12
  43. package/esm2015/lib/components/tables/table/column-model.js.map +1 -1
  44. package/esm2015/lib/components/tables/table/column-model.metadata.json +1 -1
  45. package/esm2015/lib/components/tables/table/default-cell-renderer/default-cell-renderer.component.js.map +1 -1
  46. package/esm2015/lib/components/tables/tree-table/decorated-tree-node.js +3 -3
  47. package/esm2015/lib/components/tables/tree-table/decorated-tree-node.js.map +1 -1
  48. package/esm2015/lib/components/tables/tree-table/tree-label-column-model.js +2 -2
  49. package/esm2015/lib/components/tables/tree-table/tree-label-column-model.js.map +1 -1
  50. package/esm2015/lib/components/tables/tree-table/tree-label-column-model.metadata.json +1 -1
  51. package/esm2015/lib/components/tables/tree-table/tree-table-model.js +2 -2
  52. package/esm2015/lib/components/tables/tree-table/tree-table-model.js.map +1 -1
  53. package/esm2015/lib/components/tables/tree-table/tree-table-model.metadata.json +1 -1
  54. package/esm2015/lib/components/text/markdown/markdown.component.js +3 -3
  55. package/esm2015/lib/components/text/markdown/markdown.component.js.map +1 -1
  56. package/esm2015/lib/components/text/markdown/markdown.component.metadata.json +1 -1
  57. package/esm2015/lib/directives/highlight.pipe.js +2 -2
  58. package/esm2015/lib/directives/highlight.pipe.js.map +1 -1
  59. package/esm2015/lib/directives/highlight.pipe.metadata.json +1 -1
  60. package/esm2015/lib/interaction/abstract-interaction-context.js.map +1 -1
  61. package/esm2015/lib/interaction/alert.js +3 -3
  62. package/esm2015/lib/interaction/alert.js.map +1 -1
  63. package/esm2015/lib/interaction/components/abstract-dialog.component.js +2 -2
  64. package/esm2015/lib/interaction/components/abstract-dialog.component.js.map +1 -1
  65. package/esm2015/lib/interaction/components/activity-body/activity-body.component.js.map +1 -1
  66. package/esm2015/lib/interaction/components/activity-container/activity-container.component.js +2 -2
  67. package/esm2015/lib/interaction/components/activity-container/activity-container.component.js.map +1 -1
  68. package/esm2015/lib/interaction/components/activity-container/activity-container.component.metadata.json +1 -1
  69. package/esm2015/lib/interaction/components/activity-title/activity-title.component.js +2 -2
  70. package/esm2015/lib/interaction/components/activity-title/activity-title.component.js.map +1 -1
  71. package/esm2015/lib/interaction/components/activity-title/activity-title.component.metadata.json +1 -1
  72. package/esm2015/lib/interaction/components/editors/inline-string-editor/inline-string-editor.component.js +2 -2
  73. package/esm2015/lib/interaction/components/editors/inline-string-editor/inline-string-editor.component.js.map +1 -1
  74. package/esm2015/lib/interaction/components/editors/inline-string-editor/inline-string-editor.component.metadata.json +1 -1
  75. package/esm2015/lib/interaction/components/inplace-interaction-context/in-place-interaction-context.component.js.map +1 -1
  76. package/esm2015/lib/interaction/components/input-activities/input-activity.js +2 -2
  77. package/esm2015/lib/interaction/components/input-activities/input-activity.js.map +1 -1
  78. package/esm2015/lib/interaction/components/input-activities/input-activity.metadata.json +1 -1
  79. package/esm2015/lib/interaction/directives/interaction-context-trigger-for.directive.js +2 -2
  80. package/esm2015/lib/interaction/directives/interaction-context-trigger-for.directive.js.map +1 -1
  81. package/esm2015/lib/interaction/directives/interaction-context-trigger-for.directive.metadata.json +1 -1
  82. package/esm2015/lib/place/components/abstract-place-navigation.component.js +1 -1
  83. package/esm2015/lib/place/components/abstract-place-navigation.component.js.map +1 -1
  84. package/esm2015/lib/place/components/abstract-place-navigation.component.metadata.json +1 -1
  85. package/esm2015/lib/place/components/place-outlet/place-outlet.component.js +3 -3
  86. package/esm2015/lib/place/components/place-outlet/place-outlet.component.js.map +1 -1
  87. package/esm2015/lib/place/components/place-outlet/place-outlet.component.metadata.json +1 -1
  88. package/esm2015/lib/place/guards/consolidated-param-map.js +3 -3
  89. package/esm2015/lib/place/guards/consolidated-param-map.js.map +1 -1
  90. package/esm2015/lib/place/guards/consolidated-param-map.metadata.json +1 -1
  91. package/esm2015/lib/place/navigation/place-component-deactivation-handler.js +2 -2
  92. package/esm2015/lib/place/navigation/place-component-deactivation-handler.js.map +1 -1
  93. package/esm2015/lib/place/navigation/place-component-deactivation-handler.metadata.json +1 -1
  94. package/esm2015/lib/place/navigation/session/interactions/synchronise-interaction-context-ids-with-route.js +2 -2
  95. package/esm2015/lib/place/navigation/session/interactions/synchronise-interaction-context-ids-with-route.js.map +1 -1
  96. package/esm2015/lib/place/navigation/session/interactions/synchronise-interaction-context-ids-with-route.metadata.json +1 -1
  97. package/esm2015/lib/place/place-component.js +3 -3
  98. package/esm2015/lib/place/place-component.js.map +1 -1
  99. package/esm2015/lib/place/place-component.metadata.json +1 -1
  100. package/esm2015/lib/place/place-definition.js +5 -5
  101. package/esm2015/lib/place/place-definition.js.map +1 -1
  102. package/esm2015/lib/place/place-definition.metadata.json +1 -1
  103. package/esm2015/lib/place/place-history.js +8 -8
  104. package/esm2015/lib/place/place-history.js.map +1 -1
  105. package/esm2015/lib/place/place-history.metadata.json +1 -1
  106. package/esm2015/lib/place/place.decorator.js +2 -2
  107. package/esm2015/lib/place/place.decorator.js.map +1 -1
  108. package/esm2015/lib/place/place.decorator.metadata.json +1 -1
  109. package/esm2015/lib/place/route/formatter.js +3 -3
  110. package/esm2015/lib/place/route/formatter.js.map +1 -1
  111. package/esm2015/lib/place/route/parameter-definition.js +8 -8
  112. package/esm2015/lib/place/route/parameter-definition.js.map +1 -1
  113. package/esm2015/lib/place/route/parameter-definition.metadata.json +1 -1
  114. package/esm2015/lib/place/url-snapshot.js +3 -3
  115. package/esm2015/lib/place/url-snapshot.js.map +1 -1
  116. package/esm2015/lib/place/url-snapshot.metadata.json +1 -1
  117. package/esm2015/lib/place/visit.js +5 -5
  118. package/esm2015/lib/place/visit.js.map +1 -1
  119. package/esm2015/lib/place/visit.metadata.json +1 -1
  120. package/fesm2015/coolon-angular-ui-powerups-cypress.js +10 -10
  121. package/fesm2015/coolon-angular-ui-powerups-cypress.js.map +1 -1
  122. package/fesm2015/coolon-angular-ui-powerups.js +76 -77
  123. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  124. package/package.json +10 -9
  125. package/schematics/place-routes/place-class-scanner.js +5 -5
  126. package/schematics/place-routes/place-class-scanner.js.map +1 -1
  127. package/schematics/place-routes/place-def.js +5 -5
  128. package/schematics/place-routes/place-def.js.map +1 -1
  129. package/schematics/utils/import-def.js +4 -4
  130. package/schematics/utils/import-def.js.map +1 -1
  131. package/schematics/utils/method-scanner.js +6 -6
  132. package/schematics/utils/method-scanner.js.map +1 -1
  133. package/schematics/utils/path-helper.js +4 -4
  134. package/schematics/utils/path-helper.js.map +1 -1
  135. package/schematics/utils/source-file-scanner.js +5 -5
  136. package/schematics/utils/source-file-scanner.js.map +1 -1
  137. package/schematics/utils/source-file-utilities.js +2 -2
  138. package/schematics/utils/source-file-utilities.js.map +1 -1
@@ -3,7 +3,7 @@ import { ComponentPortal } from '@angular/cdk/portal';
3
3
  import { ChangeDetectorRef, Component, EventEmitter, HostBinding, Inject, InjectionToken, Input, Optional, Output, SkipSelf, ViewChild } from '@angular/core';
4
4
  import { Router, RouterOutlet } from '@angular/router';
5
5
  import { DebugContext, Dsl, lang, ListModel, MutableValueModel, StoreInListModel, StoreInValueModel, TrackExternal, ValueModel } from '@coolon/pectin';
6
- import * as _ from 'lodash';
6
+ import { isNil } from 'lodash-es';
7
7
  import { DisposableComponent } from '../../../components/disposable-component';
8
8
  import { AUP_PLACE_CONFIG } from '../../place-config';
9
9
  import { PlaceRouter } from '../../place-router';
@@ -39,11 +39,11 @@ export class PlaceOutletComponent extends DisposableComponent {
39
39
  let placeIndex = 0;
40
40
  if (activatePlaceType.value) {
41
41
  placeIndex = placesInOrder.indexOf(activatePlaceType.value);
42
- if (_.isNil(this.initialPlaceIndex)) {
42
+ if (isNil(this.initialPlaceIndex)) {
43
43
  this.initialPlaceIndex = placeIndex;
44
44
  }
45
45
  }
46
- return _.isNil(this.initialPlaceIndex) ? 0 : placeIndex - this.initialPlaceIndex;
46
+ return isNil(this.initialPlaceIndex) ? 0 : placeIndex - this.initialPlaceIndex;
47
47
  }, { dependsOn: activatePlaceType });
48
48
  this.animationSupported = this.placesInAnimationOrder.count().isGreaterThan(0);
49
49
  this.animationEnabled = valueOf.all(this.animateModel, this.animationSupported).areTruthy();
@@ -1 +1 @@
1
- {"version":3,"file":"place-outlet.component.js","sourceRoot":"","sources":["../../../../../../../../libs/angular-ui-powerups/src/lib/place/components/place-outlet/place-outlet.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,YAAY,EAAE,WAAW,EACzB,MAAM,EACN,cAAc,EACd,KAAK,EAEL,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,SAAS,EACV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAkB,MAAM,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAGL,YAAY,EACZ,GAAG,EACH,IAAI,EACJ,SAAS,EAET,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,UAAU,EAEX,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAG/E,OAAO,EAAE,gB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AAC,gBAAgB;4CACnC,QAAQ,YAAI,MAAM,SAAC,uCAAuC;YACrB,oBAAoB,uBAAzD,QAAQ,YAAI,QAAQ;YAnGjC,iBAAiB;;;sBAmDhB,KAAK;2BAGL,KAAK;6CAIL,KAAK,SAAC,0BAA0B;wCAIhC,KAAK,SAAC,qBAAqB;2BAG3B,MAAM;wBAGN,SAAS,SAAC,aAAa,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;2BAyGzC,WAAW,SAAC,kBAAkB;;AAzH/B;IADU,iBAAiB,CAAC,cAAc,CAAC;;qDAC1B;AAGjB;IADU,aAAa,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;8BACjC,UAAU;0DAAU;AAIlC;IADoC,aAAa,EAAE;8BACnB,SAAS;4EAAgC;AAIzE;IAD+B,gBAAgB,CAAC,gCAAgC,CAAC;;uEACtB","sourcesContent":["import { ComponentPortal } from '@angular/cdk/portal';\nimport {\n ChangeDetectorRef,\n Component,\n EventEmitter, HostBinding,\n Inject,\n InjectionToken,\n Input,\n OnInit,\n Optional,\n Output,\n SkipSelf,\n ViewChild\n} from '@angular/core';\nimport { ActivatedRoute, Router, RouterOutlet } from '@angular/router';\nimport {\n BooleanValueModelChain,\n Constructable,\n DebugContext,\n Dsl,\n lang,\n ListModel,\n ListModelChain,\n MutableValueModel,\n StoreInListModel,\n StoreInValueModel,\n TrackExternal,\n ValueModel,\n ValueModelChain\n} from '@coolon/pectin';\nimport * as _ from 'lodash';\nimport { DisposableComponent } from '../../../components/disposable-component';\nimport { PlaceComponent } from '../../place-component';\n\nimport { AUP_PLACE_CONFIG, PlaceConfig } from '../../place-config';\nimport { PlaceDefinition } from '../../place-definition';\nimport { PlaceRouter } from '../../place-router';\nimport { Visit } from '../../visit';\n\nimport { NotAuthorisedNoticeComponent } from '../not-authorised-notice/not-authorised-notice.component';\nimport { LEFT_RIGHT_PLACE_ANIMATION } from './route-animations';\n\n\nexport const AUP_UNAUTHORISED_PLACE_NOTICE_COMPONENT = new InjectionToken<Constructable<any>>('AUP_UNAUTHORISED_PLACE_COMPONENT');\n\n@Component({\n selector: 'aup-place-outlet',\n templateUrl: './place-outlet.component.html',\n styleUrls: ['./place-outlet.component.scss'],\n animations: [LEFT_RIGHT_PLACE_ANIMATION]\n})\nexport class PlaceOutletComponent extends DisposableComponent implements OnInit {\n\n @Input() @StoreInValueModel('animateModel')\n animate: boolean;\n\n @Input() @TrackExternal({ defaultValue: true })\n animateModel: ValueModel<boolean>;\n\n // tslint:disable-next-line:no-input-rename\n @Input('placeAnimationOrderModel') @TrackExternal()\n customPlaceAnimationOrderModel: ListModel<Constructable<PlaceComponent>>;\n\n // tslint:disable-next-line:no-input-rename\n @Input('placeAnimationOrder') @StoreInListModel('customPlaceAnimationOrderModel')\n customPlaceAnimationOrder: Constructable<PlaceComponent>[];\n\n @Output()\n readonly placeChanged = new EventEmitter<PlaceComponent>();\n\n @ViewChild('routeOutlet', { static: true })\n routerOut: RouterOutlet;\n\n private onAnimationFinishedJob: () => void;\n\n\n private outletActivated = new MutableValueModel(false);\n private readonly _activatedRouteModel = new MutableValueModel<ActivatedRoute>();\n private readonly _activePlaceModel = new MutableValueModel<PlaceComponent>();\n\n readonly _activePlaceDefinition: ValueModelChain<PlaceDefinition>;\n\n private parentOutletModel: MutableValueModel<PlaceOutletComponent>;\n public readonly activePlaceAnimationPosition: ValueModelChain<number>;\n\n private initialPlaceIndex: number = null;\n private routerVisitModel: ValueModelChain<Visit>;\n private _isPushingVisitToRoute = new MutableValueModel<boolean>(false);\n private navigationInProgress: ValueModelChain<boolean>;\n\n private isVeryFirstLoad = true;\n private placesInAnimationOrder: ListModelChain<Constructable<PlaceComponent>>;\n private animationSupported: BooleanValueModelChain;\n readonly animationEnabled: BooleanValueModelChain;\n readonly authorised: ValueModelChain<boolean>;\n readonly notAuthorisedNoticePortal: ComponentPortal<any>;\n\n constructor(private readonly router: Router,\n private readonly placeRouter: PlaceRouter,\n @Optional() @Inject(AUP_PLACE_CONFIG) readonly placeConfig: PlaceConfig,\n @Optional() @Inject(AUP_UNAUTHORISED_PLACE_NOTICE_COMPONENT) unauthorisedPlaceNotice: Constructable<any>,\n @SkipSelf() @Optional() parentOutlet: PlaceOutletComponent,\n private readonly cdr: ChangeDetectorRef) {\n super();\n const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);\n\n this.parentOutletModel = new MutableValueModel(parentOutlet);\n\n const defaultPlaceAnimationOrder = chain(this.parentOutletModel)\n .pullValueModel(o => o.activePlaceModel)\n .pluck('placeDefinition')\n .pluckList('children')\n .pluck('component');\n\n const activatePlaceType = chain(this.activePlaceModel).map(p => p.constructor as Constructable<PlaceComponent>);\n\n this.placesInAnimationOrder = chain(this.customPlaceAnimationOrderModel)\n .otherwise(defaultPlaceAnimationOrder);\n\n this.activePlaceAnimationPosition = this.placesInAnimationOrder\n .reduce((placesInOrder) => {\n let placeIndex = 0;\n if (activatePlaceType.value) {\n placeIndex = placesInOrder.indexOf(activatePlaceType.value);\n if (_.isNil(this.initialPlaceIndex)) {\n this.initialPlaceIndex = placeIndex;\n }\n }\n return _.isNil(this.initialPlaceIndex) ? 0 : placeIndex - this.initialPlaceIndex;\n }, { dependsOn: activatePlaceType });\n\n this.animationSupported = this.placesInAnimationOrder.count().isGreaterThan(0);\n this.animationEnabled = valueOf.all(\n this.animateModel,\n this.animationSupported\n ).areTruthy();\n\n // Extract our visit model from the place router.\n this._activePlaceDefinition = chain(this._activePlaceModel).pluck('placeDefinition');\n this.routerVisitModel = chain(placeRouter.state).map(state => state.getVisitFor(this._activePlaceDefinition.value), { dependsOn: this._activePlaceDefinition });\n\n this.navigationInProgress = chain(this.placeRouter.navigationInProgress);\n\n when(this.navigationInProgress).becomesFalsey(() => {\n this.checkStateAndInitialise();\n });\n when(this.outletActivated).becomesTruthy(() => {\n this.checkStateAndInitialise();\n });\n\n chain(this._activePlaceModel)\n .postponeWhile(this.navigationInProgress)\n .subscribe(place => this.placeChanged.emit(place));\n\n this.authorised = chain(placeRouter.accessGuard).map(guard => guard.isAuthorised(this._activePlaceDefinition.value), {\n dependsOn: this._activePlaceDefinition,\n postponeWhile: chain(this._activePlaceDefinition).isNil()\n }).otherwise(true); // if we don't have a place def yet we need to show the outlet so we get one injected.\n\n this.notAuthorisedNoticePortal = new ComponentPortal(unauthorisedPlaceNotice ?? NotAuthorisedNoticeComponent);\n }\n\n // @Trace()\n ngOnInit() {\n }\n\n // @Trace()\n getAnimationOrder() {\n return this.activePlaceAnimationPosition.value;\n }\n\n get animationDuration() {\n return this.placeConfig && this.placeConfig.animationDuration ? this.placeConfig.animationDuration : '500ms';\n }\n\n @HostBinding(\"class.authorised\")\n get isAuthorised() {\n return this.authorised.value;\n }\n\n // @Trace()\n navigate(visit: Visit) {\n // const place = this.placesInAnimationOrder.query().findMatching(p => visit.placeDefinition.component === p);\n // if (!place) {\n // lang.illegalState()\n // }\n this.placeRouter.navigate(visit, {\n relativeTo: this.parentOutlet ? this.parentOutlet.activatedRouteModel.value : null\n });\n }\n\n get parentOutlet(): PlaceOutletComponent {\n return this.parentOutletModel.value;\n }\n\n\n get activePlaceModel(): ValueModel<PlaceComponent> {\n return this._activePlaceModel.readonly;\n }\n\n get activatedRouteModel(): ValueModel<ActivatedRoute> {\n return this._activatedRouteModel.readonly;\n }\n\n // @Trace()\n onOutletActivated(routerOutlet: RouterOutlet, place: PlaceComponent) {\n this._activatedRouteModel.value = routerOutlet.activatedRoute;\n this._activePlaceModel.value = place;\n this.validateAnimationState(place);\n this.outletActivated.value = true;\n this.checkStateAndInitialise();\n }\n\n private validateAnimationState(place: PlaceComponent) {\n if (this.animateModel.value) {\n if (this.placesInAnimationOrder.length < 1) {\n console.error('PlaceOutlet.animate === true but placeAnimationOrder has not been set. Animation is disabled.');\n } else {\n if (!this.placesInAnimationOrder.query().includes(place.placeDefinition.component)) {\n console.error(`PlaceOutlet.animate === true but placeAnimationOrder doesn't contain ${place.placeDefinition.component.name}.`);\n }\n }\n }\n }\n\n // @Trace()\n onOutletDeactivated() {\n this.outletActivated.value = false;\n this._activePlaceModel.value = null;\n this._activatedRouteModel.value = null;\n }\n\n // @Trace()\n private checkStateAndInitialise() {\n const routerVisit = this.routerVisitModel.value;\n const activePlace = this.activePlaceModel.value;\n if (routerVisit && activePlace && !activePlace.isInitialised()) {\n if (routerVisit.placeDefinition !== activePlace.placeDefinition) {\n lang.illegalState('wrong visit!!!');\n }\n this.initialisePlace(routerVisit, activePlace);\n this.cdr.detectChanges()\n }\n }\n\n private initialisePlace(routerVisit: Visit, activePlace: PlaceComponent) {\n const visitModel = new MutableValueModel<Visit>(routerVisit);\n DebugContext.tag(visitModel, `PlaceOutletComponent[${activePlace.constructor.name})].visitModel`);\n activePlace.initialiseVisit(routerVisit, (current, previous) => {\n console.log(\"initialiseVisitCallback\", { routerVisitModel: this.routerVisitModel.value })\n this.pushVisitChangeToRoute(previous, current);\n });\n const finishPlaceLoad = () => {\n this._activePlaceModel.value._notifyActive(true);\n };\n if (!this.animationEnabled.value || this.isVeryFirstLoad) {\n // if animation is disabled or this is the very first load then\n // we won't get our animation done callback so we finish the\n // process here and now.\n this.isVeryFirstLoad = false;\n finishPlaceLoad();\n } else {\n this.onAnimationFinishedJob = finishPlaceLoad;\n }\n const { when, chain, valueOf } = Dsl.disposeWith(activePlace);\n when(this.routerVisitModel)\n .changes(visit => {\n console.log(\"routerVisitModel.change\", { routerVisitModel: this.routerVisitModel.value })\n this.pushVisitChangeToComponent(activePlace, visit);\n }, {\n unless: valueOf.any(\n this._isPushingVisitToRoute,\n this.routerVisitModel.isNil()\n ).areTruthy()\n });\n }\n\n private pushVisitChangeToComponent(activePlace: PlaceComponent, visit: Visit) {\n activePlace.updateVisit(visit);\n }\n\n private async pushVisitChangeToRoute(previous: Visit, current: Visit) {\n try {\n this._isPushingVisitToRoute.value = true;\n await this.placeRouter.pushVisitChangesToRoute(previous, current);\n } finally {\n this._isPushingVisitToRoute.value = false;\n }\n // sanitisers may have adjusted other values in the visit to we check and write it back.\n const routerVisit = this.routerVisitModel.value; // this is occasionally null... need to investigate if that's a normal state or not.\n if (routerVisit && current.hasRoutingChangedFrom(routerVisit)) {\n this.pushVisitChangeToComponent(this.activePlaceModel.value, routerVisit)\n }\n }\n\n// @Trace()\n animationStarted() {\n // console.log({ activePlace: this._activePlaceModel.value });\n }\n\n // @Trace()\n animationDone() {\n if (this.onAnimationFinishedJob) {\n this.onAnimationFinishedJob();\n this.onAnimationFinishedJob = undefined;\n }\n }\n\n}\n"]}
1
+ {"version":3,"file":"place-outlet.component.js","sourceRoot":"","sources":["../../../../../../../../libs/angular-ui-powerups/src/lib/place/components/place-outlet/place-outlet.component.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,YAAY,EAAE,WAAW,EACzB,MAAM,EACN,cAAc,EACd,KAAK,EAEL,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,SAAS,EACV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAkB,MAAM,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAGL,YAAY,EACZ,GAAG,EACH,IAAI,EACJ,SAAS,EAET,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,UAAU,EAEX,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAG/E,OAAO,EAAE,gBAAgB,EAAe,MAAM,oBAAoB,CAAC;AAEnE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGjD,OAAO,EAAE,4BAA4B,EAAE,MAAM,0DAA0D,CAAC;AACxG,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAGhE,MAAM,CAAC,MAAM,uCAAuC,GAAG,IAAI,cAAc,CAAqB,kCAAkC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GzC,WAAW,SAAC,kBAAkB;;AAzH/B;IADU,iBAAiB,CAAC,cAAc,CAAC;;qDAC1B;AAGjB;IADU,aAAa,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;8BACjC,UAAU;0DAAU;AAIlC;IADoC,aAAa,EAAE;8BACnB,SAAS;4EAAgC;AAIzE;IAD+B,gBAAgB,CAAC,gCAAgC,CAAC;;uEACtB","sourcesContent":["import { ComponentPortal } from '@angular/cdk/portal';\nimport {\n ChangeDetectorRef,\n Component,\n EventEmitter, HostBinding,\n Inject,\n InjectionToken,\n Input,\n OnInit,\n Optional,\n Output,\n SkipSelf,\n ViewChild\n} from '@angular/core';\nimport { ActivatedRoute, Router, RouterOutlet } from '@angular/router';\nimport {\n BooleanValueModelChain,\n Constructable,\n DebugContext,\n Dsl,\n lang,\n ListModel,\n ListModelChain,\n MutableValueModel,\n StoreInListModel,\n StoreInValueModel,\n TrackExternal,\n ValueModel,\n ValueModelChain\n} from '@coolon/pectin';\n\nimport { isNil } from 'lodash-es';\nimport { DisposableComponent } from '../../../components/disposable-component';\nimport { PlaceComponent } from '../../place-component';\n\nimport { AUP_PLACE_CONFIG, PlaceConfig } from '../../place-config';\nimport { PlaceDefinition } from '../../place-definition';\nimport { PlaceRouter } from '../../place-router';\nimport { Visit } from '../../visit';\n\nimport { NotAuthorisedNoticeComponent } from '../not-authorised-notice/not-authorised-notice.component';\nimport { LEFT_RIGHT_PLACE_ANIMATION } from './route-animations';\n\n\nexport const AUP_UNAUTHORISED_PLACE_NOTICE_COMPONENT = new InjectionToken<Constructable<any>>('AUP_UNAUTHORISED_PLACE_COMPONENT');\n\n@Component({\n selector: 'aup-place-outlet',\n templateUrl: './place-outlet.component.html',\n styleUrls: ['./place-outlet.component.scss'],\n animations: [LEFT_RIGHT_PLACE_ANIMATION]\n})\nexport class PlaceOutletComponent extends DisposableComponent implements OnInit {\n\n @Input() @StoreInValueModel('animateModel')\n animate: boolean;\n\n @Input() @TrackExternal({ defaultValue: true })\n animateModel: ValueModel<boolean>;\n\n // tslint:disable-next-line:no-input-rename\n @Input('placeAnimationOrderModel') @TrackExternal()\n customPlaceAnimationOrderModel: ListModel<Constructable<PlaceComponent>>;\n\n // tslint:disable-next-line:no-input-rename\n @Input('placeAnimationOrder') @StoreInListModel('customPlaceAnimationOrderModel')\n customPlaceAnimationOrder: Constructable<PlaceComponent>[];\n\n @Output()\n readonly placeChanged = new EventEmitter<PlaceComponent>();\n\n @ViewChild('routeOutlet', { static: true })\n routerOut: RouterOutlet;\n\n private onAnimationFinishedJob: () => void;\n\n\n private outletActivated = new MutableValueModel(false);\n private readonly _activatedRouteModel = new MutableValueModel<ActivatedRoute>();\n private readonly _activePlaceModel = new MutableValueModel<PlaceComponent>();\n\n readonly _activePlaceDefinition: ValueModelChain<PlaceDefinition>;\n\n private parentOutletModel: MutableValueModel<PlaceOutletComponent>;\n public readonly activePlaceAnimationPosition: ValueModelChain<number>;\n\n private initialPlaceIndex: number = null;\n private routerVisitModel: ValueModelChain<Visit>;\n private _isPushingVisitToRoute = new MutableValueModel<boolean>(false);\n private navigationInProgress: ValueModelChain<boolean>;\n\n private isVeryFirstLoad = true;\n private placesInAnimationOrder: ListModelChain<Constructable<PlaceComponent>>;\n private animationSupported: BooleanValueModelChain;\n readonly animationEnabled: BooleanValueModelChain;\n readonly authorised: ValueModelChain<boolean>;\n readonly notAuthorisedNoticePortal: ComponentPortal<any>;\n\n constructor(private readonly router: Router,\n private readonly placeRouter: PlaceRouter,\n @Optional() @Inject(AUP_PLACE_CONFIG) readonly placeConfig: PlaceConfig,\n @Optional() @Inject(AUP_UNAUTHORISED_PLACE_NOTICE_COMPONENT) unauthorisedPlaceNotice: Constructable<any>,\n @SkipSelf() @Optional() parentOutlet: PlaceOutletComponent,\n private readonly cdr: ChangeDetectorRef) {\n super();\n const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);\n\n this.parentOutletModel = new MutableValueModel(parentOutlet);\n\n const defaultPlaceAnimationOrder = chain(this.parentOutletModel)\n .pullValueModel(o => o.activePlaceModel)\n .pluck('placeDefinition')\n .pluckList('children')\n .pluck('component');\n\n const activatePlaceType = chain(this.activePlaceModel).map(p => p.constructor as Constructable<PlaceComponent>);\n\n this.placesInAnimationOrder = chain(this.customPlaceAnimationOrderModel)\n .otherwise(defaultPlaceAnimationOrder);\n\n this.activePlaceAnimationPosition = this.placesInAnimationOrder\n .reduce((placesInOrder) => {\n let placeIndex = 0;\n if (activatePlaceType.value) {\n placeIndex = placesInOrder.indexOf(activatePlaceType.value);\n if (isNil(this.initialPlaceIndex)) {\n this.initialPlaceIndex = placeIndex;\n }\n }\n return isNil(this.initialPlaceIndex) ? 0 : placeIndex - this.initialPlaceIndex;\n }, { dependsOn: activatePlaceType });\n\n this.animationSupported = this.placesInAnimationOrder.count().isGreaterThan(0);\n this.animationEnabled = valueOf.all(\n this.animateModel,\n this.animationSupported\n ).areTruthy();\n\n // Extract our visit model from the place router.\n this._activePlaceDefinition = chain(this._activePlaceModel).pluck('placeDefinition');\n this.routerVisitModel = chain(placeRouter.state).map(state => state.getVisitFor(this._activePlaceDefinition.value), { dependsOn: this._activePlaceDefinition });\n\n this.navigationInProgress = chain(this.placeRouter.navigationInProgress);\n\n when(this.navigationInProgress).becomesFalsey(() => {\n this.checkStateAndInitialise();\n });\n when(this.outletActivated).becomesTruthy(() => {\n this.checkStateAndInitialise();\n });\n\n chain(this._activePlaceModel)\n .postponeWhile(this.navigationInProgress)\n .subscribe(place => this.placeChanged.emit(place));\n\n this.authorised = chain(placeRouter.accessGuard).map(guard => guard.isAuthorised(this._activePlaceDefinition.value), {\n dependsOn: this._activePlaceDefinition,\n postponeWhile: chain(this._activePlaceDefinition).isNil()\n }).otherwise(true); // if we don't have a place def yet we need to show the outlet so we get one injected.\n\n this.notAuthorisedNoticePortal = new ComponentPortal(unauthorisedPlaceNotice ?? NotAuthorisedNoticeComponent);\n }\n\n // @Trace()\n ngOnInit() {\n }\n\n // @Trace()\n getAnimationOrder() {\n return this.activePlaceAnimationPosition.value;\n }\n\n get animationDuration() {\n return this.placeConfig && this.placeConfig.animationDuration ? this.placeConfig.animationDuration : '500ms';\n }\n\n @HostBinding(\"class.authorised\")\n get isAuthorised() {\n return this.authorised.value;\n }\n\n // @Trace()\n navigate(visit: Visit) {\n // const place = this.placesInAnimationOrder.query().findMatching(p => visit.placeDefinition.component === p);\n // if (!place) {\n // lang.illegalState()\n // }\n this.placeRouter.navigate(visit, {\n relativeTo: this.parentOutlet ? this.parentOutlet.activatedRouteModel.value : null\n });\n }\n\n get parentOutlet(): PlaceOutletComponent {\n return this.parentOutletModel.value;\n }\n\n\n get activePlaceModel(): ValueModel<PlaceComponent> {\n return this._activePlaceModel.readonly;\n }\n\n get activatedRouteModel(): ValueModel<ActivatedRoute> {\n return this._activatedRouteModel.readonly;\n }\n\n // @Trace()\n onOutletActivated(routerOutlet: RouterOutlet, place: PlaceComponent) {\n this._activatedRouteModel.value = routerOutlet.activatedRoute;\n this._activePlaceModel.value = place;\n this.validateAnimationState(place);\n this.outletActivated.value = true;\n this.checkStateAndInitialise();\n }\n\n private validateAnimationState(place: PlaceComponent) {\n if (this.animateModel.value) {\n if (this.placesInAnimationOrder.length < 1) {\n console.error('PlaceOutlet.animate === true but placeAnimationOrder has not been set. Animation is disabled.');\n } else {\n if (!this.placesInAnimationOrder.query().includes(place.placeDefinition.component)) {\n console.error(`PlaceOutlet.animate === true but placeAnimationOrder doesn't contain ${place.placeDefinition.component.name}.`);\n }\n }\n }\n }\n\n // @Trace()\n onOutletDeactivated() {\n this.outletActivated.value = false;\n this._activePlaceModel.value = null;\n this._activatedRouteModel.value = null;\n }\n\n // @Trace()\n private checkStateAndInitialise() {\n const routerVisit = this.routerVisitModel.value;\n const activePlace = this.activePlaceModel.value;\n if (routerVisit && activePlace && !activePlace.isInitialised()) {\n if (routerVisit.placeDefinition !== activePlace.placeDefinition) {\n lang.illegalState('wrong visit!!!');\n }\n this.initialisePlace(routerVisit, activePlace);\n this.cdr.detectChanges()\n }\n }\n\n private initialisePlace(routerVisit: Visit, activePlace: PlaceComponent) {\n const visitModel = new MutableValueModel<Visit>(routerVisit);\n DebugContext.tag(visitModel, `PlaceOutletComponent[${activePlace.constructor.name})].visitModel`);\n activePlace.initialiseVisit(routerVisit, (current, previous) => {\n console.log(\"initialiseVisitCallback\", { routerVisitModel: this.routerVisitModel.value })\n this.pushVisitChangeToRoute(previous, current);\n });\n const finishPlaceLoad = () => {\n this._activePlaceModel.value._notifyActive(true);\n };\n if (!this.animationEnabled.value || this.isVeryFirstLoad) {\n // if animation is disabled or this is the very first load then\n // we won't get our animation done callback so we finish the\n // process here and now.\n this.isVeryFirstLoad = false;\n finishPlaceLoad();\n } else {\n this.onAnimationFinishedJob = finishPlaceLoad;\n }\n const { when, chain, valueOf } = Dsl.disposeWith(activePlace);\n when(this.routerVisitModel)\n .changes(visit => {\n console.log(\"routerVisitModel.change\", { routerVisitModel: this.routerVisitModel.value })\n this.pushVisitChangeToComponent(activePlace, visit);\n }, {\n unless: valueOf.any(\n this._isPushingVisitToRoute,\n this.routerVisitModel.isNil()\n ).areTruthy()\n });\n }\n\n private pushVisitChangeToComponent(activePlace: PlaceComponent, visit: Visit) {\n activePlace.updateVisit(visit);\n }\n\n private async pushVisitChangeToRoute(previous: Visit, current: Visit) {\n try {\n this._isPushingVisitToRoute.value = true;\n await this.placeRouter.pushVisitChangesToRoute(previous, current);\n } finally {\n this._isPushingVisitToRoute.value = false;\n }\n // sanitisers may have adjusted other values in the visit to we check and write it back.\n const routerVisit = this.routerVisitModel.value; // this is occasionally null... need to investigate if that's a normal state or not.\n if (routerVisit && current.hasRoutingChangedFrom(routerVisit)) {\n this.pushVisitChangeToComponent(this.activePlaceModel.value, routerVisit)\n }\n }\n\n// @Trace()\n animationStarted() {\n // console.log({ activePlace: this._activePlaceModel.value });\n }\n\n // @Trace()\n animationDone() {\n if (this.onAnimationFinishedJob) {\n this.onAnimationFinishedJob();\n this.onAnimationFinishedJob = undefined;\n }\n }\n\n}\n"]}
@@ -1 +1 @@
1
- [{"__symbolic":"module","version":4,"metadata":{"AUP_UNAUTHORISED_PLACE_NOTICE_COMPONENT":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":43,"character":59},"arguments":["AUP_UNAUTHORISED_PLACE_COMPONENT"]},"PlaceOutletComponent":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../../../components/disposable-component","name":"DisposableComponent","line":51,"character":42},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":45,"character":1},"arguments":[{"selector":"aup-place-outlet","animations":[{"__symbolic":"reference","module":"./route-animations","name":"LEFT_RIGHT_PLACE_ANIMATION","line":49,"character":15}],"template":"<ng-container *ngIf=\"animationEnabled.value\">\n <div class=\"router-outlet-container\"\n cdkScrollable\n [@routeAnimations]=\"{value: getAnimationOrder(), params:{duration: animationDuration}}\"\n (@routeAnimations.start)=\"animationStarted()\"\n (@routeAnimations.done)=\"animationDone()\"\n >\n <router-outlet #routerOutlet=\"outlet\"\n (activate)=\"onOutletActivated(routerOutlet, $event)\"\n (deactivate)=\"onOutletDeactivated()\">\n </router-outlet>\n </div>\n</ng-container>\n\n<ng-container *ngIf=\"!animationEnabled.value\">\n <div class=\"router-outlet-container\"\n cdkScrollable>\n <router-outlet #routerOutlet=\"outlet\"\n (activate)=\"onOutletActivated(routerOutlet, $event)\"\n (deactivate)=\"onOutletDeactivated()\">\n </router-outlet>\n </div>\n</ng-container>\n\n<div class=\"not-authorised-component-container\" *ngIf=\"!authorised.value\">\n <ng-template [cdkPortalOutlet]=\"notAuthorisedNoticePortal\"></ng-template>\n</div>\n","styles":[":host{display:flex;flex-direction:column;min-height:0}:host:not(.authorised) .router-outlet-container{display:none}.router-outlet-container{flex:1;display:block;position:relative;min-height:0;overflow-x:hidden;overflow-y:auto}router-outlet{display:none}.not-authorised-component-container{flex:1;display:grid;grid-template-columns:1fr;grid-template-rows:1fr}\n"]}]}],"members":{"animate":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":53,"character":3}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@coolon/pectin","name":"StoreInValueModel","line":53,"character":12},"arguments":["animateModel"]}]}],"animateModel":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":56,"character":3}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@coolon/pectin","name":"TrackExternal","line":56,"character":12},"arguments":[{"defaultValue":true}]}]}],"customPlaceAnimationOrderModel":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":60,"character":3},"arguments":["placeAnimationOrderModel"]},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@coolon/pectin","name":"TrackExternal","line":60,"character":38}}]}],"customPlaceAnimationOrder":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":64,"character":3},"arguments":["placeAnimationOrder"]},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@coolon/pectin","name":"StoreInListModel","line":64,"character":33},"arguments":["customPlaceAnimationOrderModel"]}]}],"placeChanged":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":67,"character":3}}]}],"routerOut":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":70,"character":3},"arguments":["routeOutlet",{"static":true}]}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":99,"character":15}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":99,"character":27},"arguments":[{"__symbolic":"reference","module":"../../place-config","name":"AUP_PLACE_CONFIG","line":99,"character":34}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":100,"character":15}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":100,"character":27},"arguments":[{"__symbolic":"reference","name":"AUP_UNAUTHORISED_PLACE_NOTICE_COMPONENT"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"SkipSelf","line":101,"character":15}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":101,"character":27}}],null],"parameters":[{"__symbolic":"reference","module":"@angular/router","name":"Router","line":97,"character":39},{"__symbolic":"reference","module":"../../place-router","name":"PlaceRouter","line":98,"character":44},{"__symbolic":"reference","module":"../../place-config","name":"PlaceConfig","line":99,"character":74},{"__symbolic":"reference","module":"@coolon/pectin","name":"Constructable","line":100,"character":100,"arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","name":"PlaceOutletComponent"},{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectorRef","line":102,"character":36}]}],"ngOnInit":[{"__symbolic":"method"}],"getAnimationOrder":[{"__symbolic":"method"}],"isAuthorised":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostBinding","line":175,"character":3},"arguments":["class.authorised"]}]}],"navigate":[{"__symbolic":"method"}],"onOutletActivated":[{"__symbolic":"method"}],"validateAnimationState":[{"__symbolic":"method"}],"onOutletDeactivated":[{"__symbolic":"method"}],"checkStateAndInitialise":[{"__symbolic":"method"}],"initialisePlace":[{"__symbolic":"method"}],"pushVisitChangeToComponent":[{"__symbolic":"method"}],"pushVisitChangeToRoute":[{"__symbolic":"method"}],"animationStarted":[{"__symbolic":"method"}],"animationDone":[{"__symbolic":"method"}]}}}}]
1
+ [{"__symbolic":"module","version":4,"metadata":{"AUP_UNAUTHORISED_PLACE_NOTICE_COMPONENT":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":44,"character":59},"arguments":["AUP_UNAUTHORISED_PLACE_COMPONENT"]},"PlaceOutletComponent":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../../../components/disposable-component","name":"DisposableComponent","line":52,"character":42},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":46,"character":1},"arguments":[{"selector":"aup-place-outlet","animations":[{"__symbolic":"reference","module":"./route-animations","name":"LEFT_RIGHT_PLACE_ANIMATION","line":50,"character":15}],"template":"<ng-container *ngIf=\"animationEnabled.value\">\n <div class=\"router-outlet-container\"\n cdkScrollable\n [@routeAnimations]=\"{value: getAnimationOrder(), params:{duration: animationDuration}}\"\n (@routeAnimations.start)=\"animationStarted()\"\n (@routeAnimations.done)=\"animationDone()\"\n >\n <router-outlet #routerOutlet=\"outlet\"\n (activate)=\"onOutletActivated(routerOutlet, $event)\"\n (deactivate)=\"onOutletDeactivated()\">\n </router-outlet>\n </div>\n</ng-container>\n\n<ng-container *ngIf=\"!animationEnabled.value\">\n <div class=\"router-outlet-container\"\n cdkScrollable>\n <router-outlet #routerOutlet=\"outlet\"\n (activate)=\"onOutletActivated(routerOutlet, $event)\"\n (deactivate)=\"onOutletDeactivated()\">\n </router-outlet>\n </div>\n</ng-container>\n\n<div class=\"not-authorised-component-container\" *ngIf=\"!authorised.value\">\n <ng-template [cdkPortalOutlet]=\"notAuthorisedNoticePortal\"></ng-template>\n</div>\n","styles":[":host{display:flex;flex-direction:column;min-height:0}:host:not(.authorised) .router-outlet-container{display:none}.router-outlet-container{flex:1;display:block;position:relative;min-height:0;overflow-x:hidden;overflow-y:auto}router-outlet{display:none}.not-authorised-component-container{flex:1;display:grid;grid-template-columns:1fr;grid-template-rows:1fr}\n"]}]}],"members":{"animate":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":54,"character":3}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@coolon/pectin","name":"StoreInValueModel","line":54,"character":12},"arguments":["animateModel"]}]}],"animateModel":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":57,"character":3}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@coolon/pectin","name":"TrackExternal","line":57,"character":12},"arguments":[{"defaultValue":true}]}]}],"customPlaceAnimationOrderModel":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":61,"character":3},"arguments":["placeAnimationOrderModel"]},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@coolon/pectin","name":"TrackExternal","line":61,"character":38}}]}],"customPlaceAnimationOrder":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":65,"character":3},"arguments":["placeAnimationOrder"]},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@coolon/pectin","name":"StoreInListModel","line":65,"character":33},"arguments":["customPlaceAnimationOrderModel"]}]}],"placeChanged":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":68,"character":3}}]}],"routerOut":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":71,"character":3},"arguments":["routeOutlet",{"static":true}]}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":100,"character":15}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":100,"character":27},"arguments":[{"__symbolic":"reference","module":"../../place-config","name":"AUP_PLACE_CONFIG","line":100,"character":34}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":101,"character":15}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":101,"character":27},"arguments":[{"__symbolic":"reference","name":"AUP_UNAUTHORISED_PLACE_NOTICE_COMPONENT"}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"SkipSelf","line":102,"character":15}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":102,"character":27}}],null],"parameters":[{"__symbolic":"reference","module":"@angular/router","name":"Router","line":98,"character":39},{"__symbolic":"reference","module":"../../place-router","name":"PlaceRouter","line":99,"character":44},{"__symbolic":"reference","module":"../../place-config","name":"PlaceConfig","line":100,"character":74},{"__symbolic":"reference","module":"@coolon/pectin","name":"Constructable","line":101,"character":100,"arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","name":"PlaceOutletComponent"},{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectorRef","line":103,"character":36}]}],"ngOnInit":[{"__symbolic":"method"}],"getAnimationOrder":[{"__symbolic":"method"}],"isAuthorised":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostBinding","line":176,"character":3},"arguments":["class.authorised"]}]}],"navigate":[{"__symbolic":"method"}],"onOutletActivated":[{"__symbolic":"method"}],"validateAnimationState":[{"__symbolic":"method"}],"onOutletDeactivated":[{"__symbolic":"method"}],"checkStateAndInitialise":[{"__symbolic":"method"}],"initialisePlace":[{"__symbolic":"method"}],"pushVisitChangeToComponent":[{"__symbolic":"method"}],"pushVisitChangeToRoute":[{"__symbolic":"method"}],"animationStarted":[{"__symbolic":"method"}],"animationDone":[{"__symbolic":"method"}]}}}}]
@@ -1,6 +1,6 @@
1
1
  import { __decorate, __metadata } from "tslib";
2
- import { Memoize } from '@typescript-plus/fast-memoize-decorator/dist/src';
3
- import * as _ from 'lodash';
2
+ import { Memoize } from '@typescript-plus/fast-memoize-decorator';
3
+ import { uniq } from 'lodash-es';
4
4
  /**
5
5
  * This a work around for the fact that an activated route with multiple segments doesn't
6
6
  * include the segment params in the paramMap as well as each segment returns an empty
@@ -27,7 +27,7 @@ export class ConsolidatedParameterMap {
27
27
  return !!this.paramMaps.find(m => m.has(name));
28
28
  }
29
29
  get keys() {
30
- return _.uniq(this.paramMaps.reduce((result, params) => result.concat(params.keys), []));
30
+ return uniq(this.paramMaps.reduce((result, params) => result.concat(params.keys), []));
31
31
  }
32
32
  }
33
33
  __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"consolidated-param-map.js","sourceRoot":"","sources":["../../../../../../../libs/angular-ui-powerups/src/lib/place/guards/consolidated-param-map.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,kDAAkD,CAAC;AAC3E,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B;;;;GAIG;AACH,MAAM,OAAO,wBAAwB;IAInC,YAAY,WAAyB,EAAE,QAAmB;QAFzC,cAAS,GAAe,EAAE,CAAC;QAG1C,oGAAoG;QACpG,MAAM,aAAa,GAAG,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,eAAe,CAAC,CAAC,CAAC,UAAU,CAAC,CAAe,CAAC;QACpG,IAAI,CAAC,SAAS,GAAG,aAAa;aAC3B,MAAM,CAAC,QAAQ,CAAC;aAChB,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,4CAA4C;IACnE,CAAC;IAED,GAAG,CAAC,IAAY;QACd,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;QACvD,OAAO,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAED,MAAM,CAAC,IAAY;QACjB,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;QACvD,OAAO,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED,GAAG,CAAC,IAAY;QACd,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IACjD,CAAC;IAGD,IAAI,IAAI;QACN,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IAC3F,CAAC;CACF;AAHC;IADC,OAAO,EAAE;;;oDAGT;AAGH,MAAM,eAAe;IACnB,YAA6B,MAA+B;QAA/B,WAAM,GAAN,MAAM,CAAyB;IAC5D,CAAC;IAED,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAED,MAAM,CAAC,IAAY;QACjB,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC7B,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAChD,CAAC;IAED,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAED,IAAI,IAAI;QACN,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;CAEF","sourcesContent":["import { ParamMap, UrlSegment } from '@angular/router';\nimport { Memoize } from '@typescript-plus/fast-memoize-decorator/dist/src';\nimport * as _ from 'lodash';\n\n/**\n * This a work around for the fact that an activated route with multiple segments doesn't\n * include the segment params in the paramMap as well as each segment returns an empty\n * param map even when `parameter`s has content.\n */\nexport class ConsolidatedParameterMap implements ParamMap {\n\n private readonly paramMaps: ParamMap[] = [];\n\n constructor(urlSegments: UrlSegment[], paramMap?: ParamMap) {\n // TODO: can we get all our params from teh url segments? If so we can drop the paramMap altogether.\n const segmentParams = (urlSegments || []).map(s => new ParamMapAdapter(s.parameters)) as ParamMap[];\n this.paramMaps = segmentParams\n .concat(paramMap)\n .filter(m => !!m); // the activated route param map can be null\n }\n\n get(name: string): string | null {\n const paramMap = this.paramMaps.find(m => m.has(name));\n return paramMap.get(name);\n }\n\n getAll(name: string): string[] {\n const paramMap = this.paramMaps.find(m => m.has(name));\n return paramMap.getAll(name);\n }\n\n has(name: string): boolean {\n return !!this.paramMaps.find(m => m.has(name));\n }\n\n @Memoize()\n get keys(): string[] {\n return _.uniq(this.paramMaps.reduce((result, params) => result.concat(params.keys), []));\n }\n}\n\nclass ParamMapAdapter implements ParamMap {\n constructor(private readonly params: { [p: string]: string }) {\n }\n\n get(name: string): string | null {\n return this.params[name];\n }\n\n getAll(name: string): string[] {\n const value = this.get(name);\n return Array.isArray(value) ? value : [value];\n }\n\n has(name: string): boolean {\n return this.keys.includes(name);\n }\n\n get keys(): string[] {\n return Object.keys(this.params);\n }\n\n}\n"]}
1
+ {"version":3,"file":"consolidated-param-map.js","sourceRoot":"","sources":["../../../../../../../libs/angular-ui-powerups/src/lib/place/guards/consolidated-param-map.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AAElE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;;;GAIG;AACH,MAAM,OAAO,wBAAwB;IAInC,YAAY,WAAyB,EAAE,QAAmB;QAFzC,cAAS,GAAe,EAAE,CAAC;QAG1C,oGAAoG;QACpG,MAAM,aAAa,GAAG,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,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AAC,CAAC;IAC3B,CAAC;IAED,MAAM,CAAC,IAAY;QACjB,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC7B,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAChD,CAAC;IAED,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAED,IAAI,IAAI;QACN,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;CAEF","sourcesContent":["import { ParamMap, UrlSegment } from '@angular/router';\nimport { Memoize } from '@typescript-plus/fast-memoize-decorator';\n\nimport { uniq } from 'lodash-es';\n\n/**\n * This a work around for the fact that an activated route with multiple segments doesn't\n * include the segment params in the paramMap as well as each segment returns an empty\n * param map even when `parameter`s has content.\n */\nexport class ConsolidatedParameterMap implements ParamMap {\n\n private readonly paramMaps: ParamMap[] = [];\n\n constructor(urlSegments: UrlSegment[], paramMap?: ParamMap) {\n // TODO: can we get all our params from teh url segments? If so we can drop the paramMap altogether.\n const segmentParams = (urlSegments || []).map(s => new ParamMapAdapter(s.parameters)) as ParamMap[];\n this.paramMaps = segmentParams\n .concat(paramMap)\n .filter(m => !!m); // the activated route param map can be null\n }\n\n get(name: string): string | null {\n const paramMap = this.paramMaps.find(m => m.has(name));\n return paramMap.get(name);\n }\n\n getAll(name: string): string[] {\n const paramMap = this.paramMaps.find(m => m.has(name));\n return paramMap.getAll(name);\n }\n\n has(name: string): boolean {\n return !!this.paramMaps.find(m => m.has(name));\n }\n\n @Memoize()\n get keys(): string[] {\n return uniq(this.paramMaps.reduce((result, params) => result.concat(params.keys), []));\n }\n}\n\nclass ParamMapAdapter implements ParamMap {\n constructor(private readonly params: { [p: string]: string }) {\n }\n\n get(name: string): string | null {\n return this.params[name];\n }\n\n getAll(name: string): string[] {\n const value = this.get(name);\n return Array.isArray(value) ? value : [value];\n }\n\n has(name: string): boolean {\n return this.keys.includes(name);\n }\n\n get keys(): string[] {\n return Object.keys(this.params);\n }\n\n}\n"]}
@@ -1 +1 @@
1
- [{"__symbolic":"module","version":4,"metadata":{"ConsolidatedParameterMap":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","module":"@angular/router","name":"UrlSegment","line":13,"character":27}]},{"__symbolic":"reference","module":"@angular/router","name":"ParamMap","line":13,"character":52}]}],"get":[{"__symbolic":"method"}],"getAll":[{"__symbolic":"method"}],"has":[{"__symbolic":"method"}],"keys":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@typescript-plus/fast-memoize-decorator/dist/src","name":"Memoize","line":35,"character":3}}]}]}}}}]
1
+ [{"__symbolic":"module","version":4,"metadata":{"ConsolidatedParameterMap":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","module":"@angular/router","name":"UrlSegment","line":14,"character":27}]},{"__symbolic":"reference","module":"@angular/router","name":"ParamMap","line":14,"character":52}]}],"get":[{"__symbolic":"method"}],"getAll":[{"__symbolic":"method"}],"has":[{"__symbolic":"method"}],"keys":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@typescript-plus/fast-memoize-decorator","name":"Memoize","line":36,"character":3}}]}]}}}}]
@@ -1,6 +1,6 @@
1
1
  import { __awaiter } from "tslib";
2
2
  import { assert } from '@coolon/pectin';
3
- import * as _ from 'lodash';
3
+ import { isEqual } from 'lodash-es';
4
4
  /**
5
5
  * This class handles the logic around canDeactivate for a given router state transition. It's core responsibilities are:
6
6
  * 1. Ensure we only ask the component to deactivate once on a given navigation cycle (since visit sanitisation can result in multiple round trips to through the router.)
@@ -46,7 +46,7 @@ export class PlaceComponentDeactivationHandler {
46
46
  if (this.isPrimaryComponent && this.routerInteractionAdapter.isModalActive()) {
47
47
  const routeIds = this.urlService.getActiveInteractionIdsFromUrl(nextState.url);
48
48
  const currentIds = this.routerInteractionAdapter.getActiveInteractionContextIds();
49
- if (!_.isEqual(currentIds, routeIds)) { // why am I checking this????
49
+ if (!isEqual(currentIds, routeIds)) { // why am I checking this????
50
50
  yield this.routerInteractionAdapter.cancelCurrentModalInteraction();
51
51
  return false;
52
52
  }
@@ -1 +1 @@
1
- {"version":3,"file":"place-component-deactivation-handler.js","sourceRoot":"","sources":["../../../../../../../libs/angular-ui-powerups/src/lib/place/navigation/place-component-deactivation-handler.ts"],"names":[],"mappings":";AAAA,OAAO,EAAS,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAM5B;;;;;;GAMG;AACH,MAAM,OAAO,iCAAiC;IAI5C,YAAqB,SAAyB,EAAW,iBAAoC,EAAW,kBAA2B;QAA9G,cAAS,GAAT,SAAS,CAAgB;QAAW,sBAAiB,GAAjB,iBAAiB,CAAmB;QAAW,uBAAkB,GAAlB,kBAAkB,CAAS;QACjI,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC3B,CAAC;IAED,IAAI,wBAAwB;QAC1B,OAAO,IAAI,CAAC,iBAAiB,CAAC,yBAAyB,CAAC;IAC1D,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC;IAC3C,CAAC;IAED,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC;IACxC,CAAC;IAED,WAAW;IACL,aAAa,CAAC,UAAuB,EAAE,SAAsB;;YACjE,2EAA2E;YAC3E,oFAAoF;YACpF,sBAAsB;YACtB,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE;gBAC9B,wFAAwF;gBACxF,IAAI,CAAC,o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wB,CAAC,sBAAsB,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;oBACpF,OAAO,CAAC,IAAI,CAAC,6EAA6E,CAAC,CAAC;oBAC5F,OAAO,KAAK,CAAC;iBACd;gBAED,OAAO,QAAQ,CAAC;aACjB;iBAAM;gBACL,mDAAmD;gBACnD,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,yBAAyB,CAAC,IAAI,CAAC,iBAAiB,CAAC,+BAA+B,EAAE,SAAS,CAAC,CAAC;aAC1H;QACH,CAAC;KAAA;IAES,wBAAwB,CAAC,SAAsB;QACvD,qFAAqF;QACrF,gFAAgF;QAChF,0CAA0C;QAC1C,OAAO,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;IACnE,CAAC;CACF","sourcesContent":["import { Trace, assert } from '@coolon/pectin';\nimport * as _ from 'lodash';\nimport { PlaceComponent } from '../place-component';\nimport { PlaceDefinition } from '../place-definition';\nimport { UrlSnapshot } from '../url-snapshot';\nimport { NavigationSession } from './session/navigation-session';\n\n/**\n * This class handles the logic around canDeactivate for a given router state transition. It's core responsibilities are:\n * 1. Ensure we only ask the component to deactivate once on a given navigation cycle (since visit sanitisation can result in multiple round trips to through the router.)\n * 2. Ensure only the primary place component is asked when there are nested places. The primary component is the one at the top\n * of the routing change tree.\n * 3. Automatically handle standard interaction scenarios on the components behalf.\n */\nexport class PlaceComponentDeactivationHandler {\n\n private canDeactivatePromise: Promise<boolean | UrlSnapshot>;\n\n constructor(readonly component: PlaceComponent, readonly navigationSession: NavigationSession, readonly isPrimaryComponent: boolean) {\n assert.notNil(component);\n }\n\n get routerInteractionAdapter() {\n return this.navigationSession.interactionServiceAdapter;\n }\n\n get urlService() {\n return this.navigationSession.urlService;\n }\n\n get placeDefinition():PlaceDefinition {\n return this.component.placeDefinition;\n }\n\n // @Trace()\n async canDeactivate(currentUrl: UrlSnapshot, nextState: UrlSnapshot): Promise<boolean | UrlSnapshot> {\n // We'll get called multiple times if there's any parameter sanitisation so\n // we always return true if we accepted promise from a previous cycle of the current\n // navigation session.\n if (!this.canDeactivatePromise) {\n // console.log(`creating deactivate promise for -> ${this.component.constructor.name}`);\n this.canDeactivatePromise = this.canDeactivateComponent(currentUrl, nextState);\n }\n return this.canDeactivatePromise;\n }\n\n\n // @Trace()\n protected async canDeactivateComponent(currentUrl: UrlSnapshot, nextState: UrlSnapshot): Promise<UrlSnapshot | boolean> {\n // Automatically cancel any active activities if the navigation session was triggered by the back button.\n // If we handled more than just the pop state then it leads to the UI ignoring clicks and just cancelling things which is deeply disconcerting.\n if (this.navigationSession.isPopState) {\n\n if (this.isPrimaryComponent && this.routerInteractionAdapter.isModalActive()) {\n const routeIds = this.urlService.getActiveInteractionIdsFromUrl(nextState.url);\n const currentIds = this.routerInteractionAdapter.getActiveInteractionContextIds();\n if (!_.isEqual(currentIds, routeIds)) { // why am I checking this????\n await this.routerInteractionAdapter.cancelCurrentModalInteraction();\n return false;\n }\n } else {\n // check if the component has an in place interaction\n if (this.routerInteractionAdapter.isComponentInteracting(this.component)) {\n await this.routerInteractionAdapter.cancelComponentInteraction(this.component);\n return false;\n }\n }\n }\n\n // No interaction in progress, so ask the component .\n // This may start an interaction, hence checking the interaction context before now. I.e. if the place pops up the dialog, and\n // the user clicks back again, we'll re-enter here and go bang when the component tries to open another dialog.\n if (this.isGoingToADifferentPlace(nextState)) {\n const canLeave = await this.component._canLeavePlace(this.navigationSession.canDeactivateInteractionContext);\n // The component has an active interaction but no deactivation hook. Rather than guessing what to do\n // we'll just cancel the navigation and print a warning.\n if (canLeave && this.routerInteractionAdapter.isComponentInteracting(this.component)) {\n console.warn('Route changed while component has active interaction, cancelling navigation');\n return false;\n }\n\n return canLeave;\n } else {\n // either an interaction or visit parameter change.\n return await this.component._canChangeRouteParameters(this.navigationSession.canDeactivateInteractionContext, nextState);\n }\n }\n\n protected isGoingToADifferentPlace(nextState: UrlSnapshot) {\n // Because places with a route-id cover two route segments we get asked to deactivate\n // if the route id is added or removed. So if our path is still present the url\n // then we shouldn't deactivate the place.\n return !nextState.includesPathOf(this.component.placeDefinition);\n }\n}\n"]}
1
+ {"version":3,"file":"place-component-deactivation-handler.js","sourceRoot":"","sources":["../../../../../../../libs/angular-ui-powerups/src/lib/place/navigation/place-component-deactivation-handler.ts"],"names":[],"mappings":";AAAA,OAAO,EAAS,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC;;;;;;GAMG;AACH,MAAM,OAAO,iCAAiC;IAI5C,YAAqB,SAAyB,EAAW,iBAAoC,EAAW,kBAA2B;QAA9G,cAAS,GAAT,SAAS,CAAgB;QAAW,sBAAiB,GAAjB,iBAAiB,CAAmB;QAAW,uBAAkB,GAAlB,kBAAkB,CAAS;QACjI,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC3B,CAAC;IAED,IAAI,wBAAwB;QAC1B,OAAO,IAAI,CAAC,iBAAiB,CAAC,yBAAyB,CAAC;IAC1D,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC;IAC3C,CAAC;IAED,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC;IACxC,CAAC;IAED,WAAW;IACL,aAAa,CAAC,UAAuB,EAAE,SAAsB;;YACjE,2EAA2E;YAC3E,oFAAoF;YACpF,sBAAsB;YACtB,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE;gBAC9B,wFAAwF;gBACxF,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC,sBAAsB,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;aAChF;YACD,OAAO,IAAI,CAAC,oBAAoB,CAAC;QACnC,CAAC;KAAA;IAGD,WAAW;IACK,sBAAsB,CAAC,UAAuB,EAAE,SAAsB;;YACpF,yGAAyG;YACzG,+IAA+I;YAC/I,IAAI,IAAI,CA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C,IAAI,CAAC,iBAAiB,CAAC,+BAA+B,EAAE,SAAS,CAAC,CAAC;aAC1H;QACH,CAAC;KAAA;IAES,wBAAwB,CAAC,SAAsB;QACvD,qFAAqF;QACrF,gFAAgF;QAChF,0CAA0C;QAC1C,OAAO,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;IACnE,CAAC;CACF","sourcesContent":["import { Trace, assert } from '@coolon/pectin';\n\nimport { isEqual } from 'lodash-es';\nimport { PlaceComponent } from '../place-component';\nimport { PlaceDefinition } from '../place-definition';\nimport { UrlSnapshot } from '../url-snapshot';\nimport { NavigationSession } from './session/navigation-session';\n\n/**\n * This class handles the logic around canDeactivate for a given router state transition. It's core responsibilities are:\n * 1. Ensure we only ask the component to deactivate once on a given navigation cycle (since visit sanitisation can result in multiple round trips to through the router.)\n * 2. Ensure only the primary place component is asked when there are nested places. The primary component is the one at the top\n * of the routing change tree.\n * 3. Automatically handle standard interaction scenarios on the components behalf.\n */\nexport class PlaceComponentDeactivationHandler {\n\n private canDeactivatePromise: Promise<boolean | UrlSnapshot>;\n\n constructor(readonly component: PlaceComponent, readonly navigationSession: NavigationSession, readonly isPrimaryComponent: boolean) {\n assert.notNil(component);\n }\n\n get routerInteractionAdapter() {\n return this.navigationSession.interactionServiceAdapter;\n }\n\n get urlService() {\n return this.navigationSession.urlService;\n }\n\n get placeDefinition():PlaceDefinition {\n return this.component.placeDefinition;\n }\n\n // @Trace()\n async canDeactivate(currentUrl: UrlSnapshot, nextState: UrlSnapshot): Promise<boolean | UrlSnapshot> {\n // We'll get called multiple times if there's any parameter sanitisation so\n // we always return true if we accepted promise from a previous cycle of the current\n // navigation session.\n if (!this.canDeactivatePromise) {\n // console.log(`creating deactivate promise for -> ${this.component.constructor.name}`);\n this.canDeactivatePromise = this.canDeactivateComponent(currentUrl, nextState);\n }\n return this.canDeactivatePromise;\n }\n\n\n // @Trace()\n protected async canDeactivateComponent(currentUrl: UrlSnapshot, nextState: UrlSnapshot): Promise<UrlSnapshot | boolean> {\n // Automatically cancel any active activities if the navigation session was triggered by the back button.\n // If we handled more than just the pop state then it leads to the UI ignoring clicks and just cancelling things which is deeply disconcerting.\n if (this.navigationSession.isPopState) {\n\n if (this.isPrimaryComponent && this.routerInteractionAdapter.isModalActive()) {\n const routeIds = this.urlService.getActiveInteractionIdsFromUrl(nextState.url);\n const currentIds = this.routerInteractionAdapter.getActiveInteractionContextIds();\n if (!isEqual(currentIds, routeIds)) { // why am I checking this????\n await this.routerInteractionAdapter.cancelCurrentModalInteraction();\n return false;\n }\n } else {\n // check if the component has an in place interaction\n if (this.routerInteractionAdapter.isComponentInteracting(this.component)) {\n await this.routerInteractionAdapter.cancelComponentInteraction(this.component);\n return false;\n }\n }\n }\n\n // No interaction in progress, so ask the component .\n // This may start an interaction, hence checking the interaction context before now. I.e. if the place pops up the dialog, and\n // the user clicks back again, we'll re-enter here and go bang when the component tries to open another dialog.\n if (this.isGoingToADifferentPlace(nextState)) {\n const canLeave = await this.component._canLeavePlace(this.navigationSession.canDeactivateInteractionContext);\n // The component has an active interaction but no deactivation hook. Rather than guessing what to do\n // we'll just cancel the navigation and print a warning.\n if (canLeave && this.routerInteractionAdapter.isComponentInteracting(this.component)) {\n console.warn('Route changed while component has active interaction, cancelling navigation');\n return false;\n }\n\n return canLeave;\n } else {\n // either an interaction or visit parameter change.\n return await this.component._canChangeRouteParameters(this.navigationSession.canDeactivateInteractionContext, nextState);\n }\n }\n\n protected isGoingToADifferentPlace(nextState: UrlSnapshot) {\n // Because places with a route-id cover two route segments we get asked to deactivate\n // if the route id is added or removed. So if our path is still present the url\n // then we shouldn't deactivate the place.\n return !nextState.includesPathOf(this.component.placeDefinition);\n }\n}\n"]}
@@ -1 +1 @@
1
- [{"__symbolic":"module","version":4,"metadata":{"PlaceComponentDeactivationHandler":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"../place-component","name":"PlaceComponent","line":18,"character":34},{"__symbolic":"reference","module":"./session/navigation-session","name":"NavigationSession","line":18,"character":78},{"__symbolic":"reference","name":"boolean"}]}],"canDeactivate":[{"__symbolic":"method"}],"canDeactivateComponent":[{"__symbolic":"method"}],"isGoingToADifferentPlace":[{"__symbolic":"method"}]}}}}]
1
+ [{"__symbolic":"module","version":4,"metadata":{"PlaceComponentDeactivationHandler":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"../place-component","name":"PlaceComponent","line":19,"character":34},{"__symbolic":"reference","module":"./session/navigation-session","name":"NavigationSession","line":19,"character":78},{"__symbolic":"reference","name":"boolean"}]}],"canDeactivate":[{"__symbolic":"method"}],"canDeactivateComponent":[{"__symbolic":"method"}],"isGoingToADifferentPlace":[{"__symbolic":"method"}]}}}}]
@@ -1,5 +1,5 @@
1
1
  import { lang } from '@coolon/typescript-utilities';
2
- import _ from 'lodash';
2
+ import { isEqual } from 'lodash-es';
3
3
  import { NavigationSession } from '../navigation-session';
4
4
  import { RemoveLastInteractionFromUrlNavigationSession } from './remove-last-interaction-from-url-navigation-session';
5
5
  export class SynchroniseInteractionContextIdsWithRoute extends NavigationSession {
@@ -27,7 +27,7 @@ export class SynchroniseInteractionContextIdsWithRoute extends NavigationSession
27
27
  const currentIds = this.interactionServiceAdapter.getActiveInteractionContextIds();
28
28
  const previousIds = this.urlService.getCurrentLocationUrlSnapshot().getInteractionIds();
29
29
  // console.log(`---> synchroniseInteractionIds`, { is: currentIds.join(','), was: previousIds.join(',') });
30
- if (_.isEqual(currentIds, previousIds)) {
30
+ if (isEqual(currentIds, previousIds)) {
31
31
  // console.log('### Activity context ids were the same, skipping');
32
32
  this.context.finishRoutingSession();
33
33
  }
@@ -1 +1 @@
1
- {"version":3,"file":"synchronise-interaction-context-ids-with-route.js","sourceRoot":"","sources":["../../../../../../../../../libs/angular-ui-powerups/src/lib/place/navigation/session/interactions/synchronise-interaction-context-ids-with-route.ts"],"names":[],"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OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;gBACnC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;aACxB;SACF;aAAM;YACL,6EAA6E;YAC7E,kFAAkF;YAClF,uBAAuB;YACvB,2GAA2G;YAC3G,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,WAAW,EAAE,EAAE,UAAU,EAAE,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC,CAAC;SACvF;IACH,CAAC;IAED,yCAAyC,CAAC,MAAc;QACtD,IAAI,CAAC,kBAAkB,EAAE,CAAC;IAC5B,CAAC;CAEF","sourcesContent":["import { NavigationCancel, NavigationEnd } from '@angular/router';\nimport { lang } from '@coolon/typescript-utilities';\nimport _ from 'lodash';\nimport { NavigationContext } from '../navigation-context';\nimport { NavigationSession } from '../navigation-session';\nimport { RemoveLastInteractionFromUrlNavigationSession } from './remove-last-interaction-from-url-navigation-session';\n\nexport class SynchroniseInteractionContextIdsWithRoute extends NavigationSession {\n\n readonly isPopState = false;\n\n constructor(context: NavigationContext, startingUrl: string, readonly wasTriggeredByPopState: boolean) {\n super(context, startingUrl);\n }\n\n notifyActive() {\n // TODO: Do I still need this??\n setTimeout(() => {\n this.syncInteractionIdsWithRouter();\n });\n }\n\n // @Trace()\n onRouterEnd(event: NavigationEnd): void {\n this.context.finishRoutingSession();\n }\n\n // @Trace()\n onRouterCancelled(event: NavigationCancel): void {\n this.context.finishRoutingSession();\n }\n\n // @Trace()\n syncInteractionIdsWithRouter(): void {\n const currentIds = this.interactionServiceAdapter.getActiveInteractionContextIds();\n const previousIds = this.urlService.getCurrentLocationUrlSnapshot().getInteractionIds();\n // console.log(`---> synchroniseInteractionIds`, { is: currentIds.join(','), was: previousIds.join(',') });\n if (_.isEqual(currentIds, previousIds)) {\n // console.log('### Activity context ids were the same, skipping');\n this.context.finishRoutingSession();\n } else {\n if (currentIds.length > previousIds.length) {\n const isFirstActivity = currentIds.length > previousIds.length && previousIds.length < 1;\n this.addActivityContextToRoute(currentIds, isFirstActivity);\n } else {\n this.removeActivityContextFromRoute(currentIds);\n }\n }\n }\n\n // @Trace()\n addActivityContextToRoute(activeInteractionContextIds: string[], isFirst: boolean): void {\n const urlSnapshot = this.urlService.getCurrentRouterSnapshot().updateInteractionIds(activeInteractionContextIds);\n this.context.navigateByUrl(urlSnapshot, {\n replaceUrl: !isFirst\n }).then(result => {\n if (!this.urlService.getCurrentLocationUrlSnapshot().hasInteractionIds(activeInteractionContextIds)) {\n lang.illegalState(`Expected url to be ${urlSnapshot.url} but was ${this.urlService.getCurrentLocationUrl()}`);\n // this.urlService.resetBrowserLocation(urlSnapshot.url, {replaceCurrent: !isFirst})\n }\n });\n }\n\n\n // @Trace()\n removeActivityContextFromRoute(activeInteractionContextId: string[]): void {\n const urlSnapshot = this.urlService.getCurrentRouterSnapshot().updateInteractionIds(activeInteractionContextId);\n const isRemovingLastActivity = activeInteractionContextId.length < 1;\n if (isRemovingLastActivity) {\n if (this.wasTriggeredByPopState) {\n // console.log('removal was triggered by pop state, nothing to do.');\n // noop. Our url will be back to the non interaction version now so we dont' need to do anything.\n } else {\n // now we just pop our interaction id's from the browser history.\n // console.log(`Removal of the last activity wasn't triggered by pop state so we have to trigger one to clean the history`);\n const session = new RemoveLastInteractionFromUrlNavigationSession(this.context, this.urlService.getCurrentRouterUrl());\n this.context.transitionTo(session);\n this.urlService.back();\n }\n } else {\n // we've removed an interaction, but we still have remaining activities so we\n // update the url in place if it wasn't a pop state. If it was a pop state we need\n // to push it back up.\n // this.urlService.resetBrowserLocation(urlSnapshot.url, { replaceCurrent: !this.wasTriggeredByPopState });\n this.context.navigateByUrl(urlSnapshot, { replaceUrl: !this.wasTriggeredByPopState });\n }\n }\n\n handleCanDeactivateCancelledEventScenario(newUrl: string): void {\n lang.methodNotSupported();\n }\n\n}\n"]}
1
+ {"version":3,"file":"synchronise-interaction-context-ids-with-route.js","sourceRoot":"","sources":["../../../../../../../../../libs/angular-ui-powerups/src/lib/place/nav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BAAmB,EAAE,CAAC,CAAC;gBACvH,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;gBACnC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;aACxB;SACF;aAAM;YACL,6EAA6E;YAC7E,kFAAkF;YAClF,uBAAuB;YACvB,2GAA2G;YAC3G,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,WAAW,EAAE,EAAE,UAAU,EAAE,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC,CAAC;SACvF;IACH,CAAC;IAED,yCAAyC,CAAC,MAAc;QACtD,IAAI,CAAC,kBAAkB,EAAE,CAAC;IAC5B,CAAC;CAEF","sourcesContent":["import { NavigationCancel, NavigationEnd } from '@angular/router';\nimport { lang } from '@coolon/typescript-utilities';\n\nimport { isEqual } from 'lodash-es';\nimport { NavigationContext } from '../navigation-context';\nimport { NavigationSession } from '../navigation-session';\nimport { RemoveLastInteractionFromUrlNavigationSession } from './remove-last-interaction-from-url-navigation-session';\n\nexport class SynchroniseInteractionContextIdsWithRoute extends NavigationSession {\n\n readonly isPopState = false;\n\n constructor(context: NavigationContext, startingUrl: string, readonly wasTriggeredByPopState: boolean) {\n super(context, startingUrl);\n }\n\n notifyActive() {\n // TODO: Do I still need this??\n setTimeout(() => {\n this.syncInteractionIdsWithRouter();\n });\n }\n\n // @Trace()\n onRouterEnd(event: NavigationEnd): void {\n this.context.finishRoutingSession();\n }\n\n // @Trace()\n onRouterCancelled(event: NavigationCancel): void {\n this.context.finishRoutingSession();\n }\n\n // @Trace()\n syncInteractionIdsWithRouter(): void {\n const currentIds = this.interactionServiceAdapter.getActiveInteractionContextIds();\n const previousIds = this.urlService.getCurrentLocationUrlSnapshot().getInteractionIds();\n // console.log(`---> synchroniseInteractionIds`, { is: currentIds.join(','), was: previousIds.join(',') });\n if (isEqual(currentIds, previousIds)) {\n // console.log('### Activity context ids were the same, skipping');\n this.context.finishRoutingSession();\n } else {\n if (currentIds.length > previousIds.length) {\n const isFirstActivity = currentIds.length > previousIds.length && previousIds.length < 1;\n this.addActivityContextToRoute(currentIds, isFirstActivity);\n } else {\n this.removeActivityContextFromRoute(currentIds);\n }\n }\n }\n\n // @Trace()\n addActivityContextToRoute(activeInteractionContextIds: string[], isFirst: boolean): void {\n const urlSnapshot = this.urlService.getCurrentRouterSnapshot().updateInteractionIds(activeInteractionContextIds);\n this.context.navigateByUrl(urlSnapshot, {\n replaceUrl: !isFirst\n }).then(result => {\n if (!this.urlService.getCurrentLocationUrlSnapshot().hasInteractionIds(activeInteractionContextIds)) {\n lang.illegalState(`Expected url to be ${urlSnapshot.url} but was ${this.urlService.getCurrentLocationUrl()}`);\n // this.urlService.resetBrowserLocation(urlSnapshot.url, {replaceCurrent: !isFirst})\n }\n });\n }\n\n\n // @Trace()\n removeActivityContextFromRoute(activeInteractionContextId: string[]): void {\n const urlSnapshot = this.urlService.getCurrentRouterSnapshot().updateInteractionIds(activeInteractionContextId);\n const isRemovingLastActivity = activeInteractionContextId.length < 1;\n if (isRemovingLastActivity) {\n if (this.wasTriggeredByPopState) {\n // console.log('removal was triggered by pop state, nothing to do.');\n // noop. Our url will be back to the non interaction version now so we dont' need to do anything.\n } else {\n // now we just pop our interaction id's from the browser history.\n // console.log(`Removal of the last activity wasn't triggered by pop state so we have to trigger one to clean the history`);\n const session = new RemoveLastInteractionFromUrlNavigationSession(this.context, this.urlService.getCurrentRouterUrl());\n this.context.transitionTo(session);\n this.urlService.back();\n }\n } else {\n // we've removed an interaction, but we still have remaining activities so we\n // update the url in place if it wasn't a pop state. If it was a pop state we need\n // to push it back up.\n // this.urlService.resetBrowserLocation(urlSnapshot.url, { replaceCurrent: !this.wasTriggeredByPopState });\n this.context.navigateByUrl(urlSnapshot, { replaceUrl: !this.wasTriggeredByPopState });\n }\n }\n\n handleCanDeactivateCancelledEventScenario(newUrl: string): void {\n lang.methodNotSupported();\n }\n\n}\n"]}
@@ -1 +1 @@
1
- [{"__symbolic":"module","version":4,"metadata":{"SynchroniseInteractionContextIdsWithRoute":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../navigation-session","name":"NavigationSession","line":7,"character":63},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"../navigation-context","name":"NavigationContext","line":11,"character":23},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"boolean"}]}],"notifyActive":[{"__symbolic":"method"}],"onRouterEnd":[{"__symbolic":"method"}],"onRouterCancelled":[{"__symbolic":"method"}],"syncInteractionIdsWithRouter":[{"__symbolic":"method"}],"addActivityContextToRoute":[{"__symbolic":"method"}],"removeActivityContextFromRoute":[{"__symbolic":"method"}],"handleCanDeactivateCancelledEventScenario":[{"__symbolic":"method"}]}}}}]
1
+ [{"__symbolic":"module","version":4,"metadata":{"SynchroniseInteractionContextIdsWithRoute":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../navigation-session","name":"NavigationSession","line":8,"character":63},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"../navigation-context","name":"NavigationContext","line":12,"character":23},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"boolean"}]}],"notifyActive":[{"__symbolic":"method"}],"onRouterEnd":[{"__symbolic":"method"}],"onRouterCancelled":[{"__symbolic":"method"}],"syncInteractionIdsWithRouter":[{"__symbolic":"method"}],"addActivityContextToRoute":[{"__symbolic":"method"}],"removeActivityContextFromRoute":[{"__symbolic":"method"}],"handleCanDeactivateCancelledEventScenario":[{"__symbolic":"method"}]}}}}]
@@ -5,10 +5,10 @@ import { assert, Binding, DebugContext, Dsl, Guard, lang, MutableValueModel } fr
5
5
  import { Klass } from '@coolon/typescript-utilities';
6
6
  import { Memoize } from '@typescript-plus/fast-memoize-decorator';
7
7
  import 'reflect-metadata';
8
+ import { isNil } from 'lodash-es';
8
9
  import { DisposableComponent } from '../components/disposable-component';
9
10
  import { PlaceDefinition } from './place-definition';
10
11
  import { ParameterDefinition } from './route/parameter-definition';
11
- import * as _ from 'lodash';
12
12
  // RAKE: making this Symbol(...) broke things.
13
13
  export const DEFINITION_META_DATA_KEY = 'PLACE_DEFINITION_OPTIONS';
14
14
  // this one seems ok.
@@ -89,8 +89,8 @@ export class PlaceComponent extends DisposableComponent {
89
89
  // Now we need to initialise the binding direction. If we have a value in the Url then we should always push
90
90
  // that to the view. If we don't and the view already has a value (e.g. a selection model has already initialised in the
91
91
  // component constructor) then we should push that to the route.
92
- const isInVisit = !_.isNil(initialVisit.getParameterValue(parameterDef));
93
- const isInModel = !_.isNil(model.value);
92
+ const isInVisit = !isNil(initialVisit.getParameterValue(parameterDef));
93
+ const isInModel = !isNil(model.value);
94
94
  if (!isInVisit && isInModel) {
95
95
  binding.writeLeft(); // push it to the route
96
96
  }
@@ -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,EAElB,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;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAGnE,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,8CAA8C;AAC9C,MAAM,CAAC,MAAM,wBAAwB,GAAG,0BAA0B,CAAC;AACnE,qBAAqB;AACrB,MAAM,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C;IAFe,+BAAgB,mBAE/B,CAAA;AASH,CAAC,EAjCgB,cAAc,KAAd,cAAc,QAiC9B","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 ValueModel\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 { UrlSnapshot } from './url-snapshot';\nimport { Visit } from './visit';\nimport * as _ from 'lodash';\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\nclass ParameterChangeInterceptor<T> {\n constructor(parameterDef: ParameterDefinition<T>, model: ValueModel<T>, callback: PlaceComponent.InterceptCallback<T>, options: PlaceComponent.InterceptOptions) {\n }\n\n async canProceed(nextState: Visit, interactionContext: InteractionContext) {\n return true;\n }\n}\n\n@Directive()\nexport class PlaceComponent extends DisposableComponent {\n\n private readonly _placeReadyCallbacks: Function[] = [];\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 private readonly _parameterChangeInterceptors: ParameterChangeInterceptor<any>[] = [];\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._notifyPlaceReady());\n this.childPlaces = this.placeDefinition.children.map(d => d.component);\n }\n\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\n // we track if the any of the bindings updated the route. If so we remember it and update the\n // route in one go at the end.\n this.placeDefinition\n .getVisitParameterDefs()\n .forEach(parameterDef => this.installAndInitialiseBinding(visit, parameterDef));\n\n when(this.visitModel).changes((current, previous) => {\n notifyVisitChanged(current, previous);\n }, { unless: this._inVisitUpdate });\n\n // TODO: this needs to do a replace url option so that the new url isn't put in the history.... for\n // now we're not doing it as it's a fair bit of effort and will only affect people if they're\n // cutting and pasting urls to each other.\n // // the binding process can update the visit (e.g. if a selection model has already selected during\n // // component construction) and there was no value specified in the route\n // if (visit.hasRoutingChangedFrom(this.visitModel.value)) {\n // notifyVisitChanged(this.visitModel.value, visit)\n // }\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 /**\n * Initialised the component bindings. If any binding has an initial model value (e.g. a selection model\n * initialised during the constructor) and the route has nothing, then the visit will be udpated and this\n * method will return ture to nofiy the the visit has changed.\n */\n private installAndInitialiseBinding<T, S>(initialVisit: Visit, parameterDef: ParameterDefinition<T, S>) {\n const model = this[parameterDef.propertyName] as IMutableHasValue<T>;\n DebugContext.tag(model, `${this.placeDefinition.component.name}.${parameterDef.propertyName}`);\n const binding = this.registerDisposable(new Binding(this.visitModel, model, {\n toRight(visit: Visit): T {\n const value = visit.getParameterValue(parameterDef);\n // console.log('push to component', { name: parameterDef.name, value, visit });\n return value;\n },\n toLeft(value: T, currentVisit?: Visit): Visit {\n // console.log('push to route', { name: parameterDef.name, value, currentVisit });\n return currentVisit.replace(parameterDef, value);\n }\n }));\n\n // Now we need to initialise the binding direction. If we have a value in the Url then we should always push\n // that to the view. If we don't and the view already has a value (e.g. a selection model has already initialised in the\n // component constructor) then we should push that to the route.\n const isInVisit = !_.isNil(initialVisit.getParameterValue(parameterDef));\n const isInModel = !_.isNil(model.value);\n if (!isInVisit && isInModel) {\n binding.writeLeft(); // push it to the route\n } else {\n binding.writeRight(); // push it to the model\n }\n }\n\n @Memoize()\n get placeDefinition(): PlaceDefinition {\n const definition = PlaceComponent.getDefinition(this.constructor as any as Constructable<PlaceComponent>);\n if (!definition) {\n lang.illegalState(`${this.constructor.name} extends PlaceComponent but doesn't have @Place({..}) decorator.`)\n }\n return definition;\n }\n\n get active() {\n return this._active.readonly;\n }\n\n /**\n * Called by the router to see if this component can deactivate. This isn't called for route parameter changes.\n * @param interactionContext\n */\n async _canLeavePlace(interactionContext: InteractionContext): Promise<boolean> {\n return this.canDeactivate ? this.canDeactivate(interactionContext) : true;\n }\n\n /**\n * Called by the router to see if this component can deactivate. This isn't called for route parameter changes.\n * @param interactionContext\n * @param nextState\n */\n async _canChangeRouteParameters(interactionContext: InteractionContext, nextState: UrlSnapshot): Promise<boolean> {\n if (this._parameterChangeInterceptors.length > 0) {\n const visit = nextState.createVisitFor(this.placeDefinition);\n for (let i = 0; i < this._parameterChangeInterceptors.length; i++) {\n const interceptor = this._parameterChangeInterceptors[i];\n const keepGoing = await interceptor.canProceed(visit, interactionContext);\n if (!keepGoing) {\n return false;\n }\n }\n }\n return true;\n }\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 /**\n * Called by the router when the place is ready to interact after any animations have run.\n */\n _notifyPlaceReady() {\n if (this.onPlaceReady.length === 1) {\n this._placeReadyCallbacks.forEach(callback => callback());\n } else {\n console.warn('Overriding PlaceComponent.onPlaceReady has been deprecated. Use PlaceComponent.onPlaceReady(() => {... do stuff...}) instead.');\n this.onPlaceReady(undefined);\n }\n }\n\n onPlaceReady(callback: () => void) {\n this._placeReadyCallbacks.push(callback);\n }\n\n interceptVisitParameterChange<T>(model: ValueModel<T>, callback: PlaceComponent.InterceptCallback<T>, options?: PlaceComponent.InterceptOptions) {\n const parameterDef = ParameterDefinition.get(model);\n this._parameterChangeInterceptors.push(new ParameterChangeInterceptor(parameterDef, model, callback, options));\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 export type InterceptCallback<T> = (is: T, was: T, interactionContext: InteractionContext) => boolean | Promise<boolean>;\n\n export interface InterceptOptions {\n initialValue: 'evaluationUnlessNil' | 'evaluate'\n }\n\n\n}\n"]}
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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B,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,CAAC;SACjE;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;AASH,CAAC,EAjCgB,cAAc,KAAd,cAAc,QAiC9B","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 ValueModel\n} from '@coolon/pectin';\nimport { Klass } from '@coolon/typescript-utilities';\nimport { Memoize } from '@typescript-plus/fast-memoize-decorator';\nimport 'reflect-metadata';\nimport { isNil } from 'lodash-es';\nimport { DisposableComponent } from '../components/disposable-component';\nimport { InteractionContext } from '../interaction/interaction-context';\nimport { PlaceDefinition } from './place-definition';\nimport { ParameterDefinition } from './route/parameter-definition';\nimport { UrlSnapshot } from './url-snapshot';\nimport { Visit } from './visit';\n\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\nclass ParameterChangeInterceptor<T> {\n constructor(parameterDef: ParameterDefinition<T>, model: ValueModel<T>, callback: PlaceComponent.InterceptCallback<T>, options: PlaceComponent.InterceptOptions) {\n }\n\n async canProceed(nextState: Visit, interactionContext: InteractionContext) {\n return true;\n }\n}\n\n@Directive()\nexport class PlaceComponent extends DisposableComponent {\n\n private readonly _placeReadyCallbacks: Function[] = [];\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 private readonly _parameterChangeInterceptors: ParameterChangeInterceptor<any>[] = [];\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._notifyPlaceReady());\n this.childPlaces = this.placeDefinition.children.map(d => d.component);\n }\n\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\n // we track if the any of the bindings updated the route. If so we remember it and update the\n // route in one go at the end.\n this.placeDefinition\n .getVisitParameterDefs()\n .forEach(parameterDef => this.installAndInitialiseBinding(visit, parameterDef));\n\n when(this.visitModel).changes((current, previous) => {\n notifyVisitChanged(current, previous);\n }, { unless: this._inVisitUpdate });\n\n // TODO: this needs to do a replace url option so that the new url isn't put in the history.... for\n // now we're not doing it as it's a fair bit of effort and will only affect people if they're\n // cutting and pasting urls to each other.\n // // the binding process can update the visit (e.g. if a selection model has already selected during\n // // component construction) and there was no value specified in the route\n // if (visit.hasRoutingChangedFrom(this.visitModel.value)) {\n // notifyVisitChanged(this.visitModel.value, visit)\n // }\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 /**\n * Initialised the component bindings. If any binding has an initial model value (e.g. a selection model\n * initialised during the constructor) and the route has nothing, then the visit will be udpated and this\n * method will return ture to nofiy the the visit has changed.\n */\n private installAndInitialiseBinding<T, S>(initialVisit: Visit, parameterDef: ParameterDefinition<T, S>) {\n const model = this[parameterDef.propertyName] as IMutableHasValue<T>;\n DebugContext.tag(model, `${this.placeDefinition.component.name}.${parameterDef.propertyName}`);\n const binding = this.registerDisposable(new Binding(this.visitModel, model, {\n toRight(visit: Visit): T {\n const value = visit.getParameterValue(parameterDef);\n // console.log('push to component', { name: parameterDef.name, value, visit });\n return value;\n },\n toLeft(value: T, currentVisit?: Visit): Visit {\n // console.log('push to route', { name: parameterDef.name, value, currentVisit });\n return currentVisit.replace(parameterDef, value);\n }\n }));\n\n // Now we need to initialise the binding direction. If we have a value in the Url then we should always push\n // that to the view. If we don't and the view already has a value (e.g. a selection model has already initialised in the\n // component constructor) then we should push that to the route.\n const isInVisit = !isNil(initialVisit.getParameterValue(parameterDef));\n const isInModel = !isNil(model.value);\n if (!isInVisit && isInModel) {\n binding.writeLeft(); // push it to the route\n } else {\n binding.writeRight(); // push it to the model\n }\n }\n\n @Memoize()\n get placeDefinition(): PlaceDefinition {\n const definition = PlaceComponent.getDefinition(this.constructor as any as Constructable<PlaceComponent>);\n if (!definition) {\n lang.illegalState(`${this.constructor.name} extends PlaceComponent but doesn't have @Place({..}) decorator.`)\n }\n return definition;\n }\n\n get active() {\n return this._active.readonly;\n }\n\n /**\n * Called by the router to see if this component can deactivate. This isn't called for route parameter changes.\n * @param interactionContext\n */\n async _canLeavePlace(interactionContext: InteractionContext): Promise<boolean> {\n return this.canDeactivate ? this.canDeactivate(interactionContext) : true;\n }\n\n /**\n * Called by the router to see if this component can deactivate. This isn't called for route parameter changes.\n * @param interactionContext\n * @param nextState\n */\n async _canChangeRouteParameters(interactionContext: InteractionContext, nextState: UrlSnapshot): Promise<boolean> {\n if (this._parameterChangeInterceptors.length > 0) {\n const visit = nextState.createVisitFor(this.placeDefinition);\n for (let i = 0; i < this._parameterChangeInterceptors.length; i++) {\n const interceptor = this._parameterChangeInterceptors[i];\n const keepGoing = await interceptor.canProceed(visit, interactionContext);\n if (!keepGoing) {\n return false;\n }\n }\n }\n return true;\n }\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 /**\n * Called by the router when the place is ready to interact after any animations have run.\n */\n _notifyPlaceReady() {\n if (this.onPlaceReady.length === 1) {\n this._placeReadyCallbacks.forEach(callback => callback());\n } else {\n console.warn('Overriding PlaceComponent.onPlaceReady has been deprecated. Use PlaceComponent.onPlaceReady(() => {... do stuff...}) instead.');\n this.onPlaceReady(undefined);\n }\n }\n\n onPlaceReady(callback: () => void) {\n this._placeReadyCallbacks.push(callback);\n }\n\n interceptVisitParameterChange<T>(model: ValueModel<T>, callback: PlaceComponent.InterceptCallback<T>, options?: PlaceComponent.InterceptOptions) {\n const parameterDef = ParameterDefinition.get(model);\n this._parameterChangeInterceptors.push(new ParameterChangeInterceptor(parameterDef, model, callback, options));\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 export type InterceptCallback<T> = (is: T, was: T, interactionContext: InteractionContext) => boolean | Promise<boolean>;\n\n export interface InterceptOptions {\n initialValue: 'evaluationUnlessNil' | 'evaluate'\n }\n\n\n}\n"]}
@@ -1 +1 @@
1
- [{"__symbolic":"module","version":4,"metadata":{"DEFINITION_META_DATA_KEY":"PLACE_DEFINITION_OPTIONS","ROUTE_PARAMETER_LIST_KEY":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"Symbol"},"arguments":["place:route:parameters"]},"PlaceComponent":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../components/disposable-component","name":"DisposableComponent","line":41,"character":36},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":40,"character":1}}],"members":{"canDeactivate":[{"__symbolic":"method"}],"__ctor__":[{"__symbolic":"constructor"}],"initialiseVisit":[{"__symbolic":"method"}],"updateVisit":[{"__symbolic":"method"}],"isInitialised":[{"__symbolic":"method"}],"installAndInitialiseBinding":[{"__symbolic":"method"}],"placeDefinition":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@typescript-plus/fast-memoize-decorator","name":"Memoize","line":134,"character":3}}]}],"_canLeavePlace":[{"__symbolic":"method"}],"_canChangeRouteParameters":[{"__symbolic":"method"}],"_notifyActive":[{"__symbolic":"method"}],"_notifyPlaceReady":[{"__symbolic":"method"}],"onPlaceReady":[{"__symbolic":"method"}],"interceptVisitParameterChange":[{"__symbolic":"method"}]}}}}]
1
+ [{"__symbolic":"module","version":4,"metadata":{"DEFINITION_META_DATA_KEY":"PLACE_DEFINITION_OPTIONS","ROUTE_PARAMETER_LIST_KEY":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"Symbol"},"arguments":["place:route:parameters"]},"PlaceComponent":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../components/disposable-component","name":"DisposableComponent","line":42,"character":36},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":41,"character":1}}],"members":{"canDeactivate":[{"__symbolic":"method"}],"__ctor__":[{"__symbolic":"constructor"}],"initialiseVisit":[{"__symbolic":"method"}],"updateVisit":[{"__symbolic":"method"}],"isInitialised":[{"__symbolic":"method"}],"installAndInitialiseBinding":[{"__symbolic":"method"}],"placeDefinition":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@typescript-plus/fast-memoize-decorator","name":"Memoize","line":135,"character":3}}]}],"_canLeavePlace":[{"__symbolic":"method"}],"_canChangeRouteParameters":[{"__symbolic":"method"}],"_notifyActive":[{"__symbolic":"method"}],"_notifyPlaceReady":[{"__symbolic":"method"}],"onPlaceReady":[{"__symbolic":"method"}],"interceptVisitParameterChange":[{"__symbolic":"method"}]}}}}]
@@ -1,8 +1,8 @@
1
1
  import { __decorate, __metadata } from "tslib";
2
2
  import { assert } from '@coolon/pectin';
3
3
  import { Opts } from '@coolon/typescript-utilities';
4
- import { Memoize } from '@typescript-plus/fast-memoize-decorator/dist/src';
5
- import _ from 'lodash';
4
+ import { Memoize } from '@typescript-plus/fast-memoize-decorator';
5
+ import { isEmpty, isNil } from 'lodash-es';
6
6
  import { ParameterDefinition } from './route/parameter-definition';
7
7
  export class PlaceDefinition {
8
8
  constructor(component, path, authenticate, role, data, routeParameters, children) {
@@ -37,12 +37,12 @@ export class PlaceDefinition {
37
37
  }
38
38
  getPlaceData(key, defaultValue) {
39
39
  return this.data ?
40
- _.isNil(this.data[key]) ? defaultValue : this.data[key] :
40
+ isNil(this.data[key]) ? defaultValue : this.data[key] :
41
41
  defaultValue;
42
42
  }
43
43
  searchPlaceData(keys, defaultValue) {
44
44
  if (this.data) {
45
- const found = keys.find(key => !_.isNil(this.data[key]));
45
+ const found = keys.find(key => !isNil(this.data[key]));
46
46
  return found ? this.data[found] : defaultValue;
47
47
  }
48
48
  else {
@@ -110,7 +110,7 @@ export class PlaceDefinition {
110
110
  // because our id routes redirect if the id isn't present we always have a id
111
111
  // parameter in our params. This will bugger our remember and defaultvalue sanitisation
112
112
  // as it'll see that the id is present (event thought its a blank string).
113
- if (!_.isEmpty(value)) {
113
+ if (!isEmpty(value)) {
114
114
  result[def.name] = def.urlFormat.parse(value);
115
115
  }
116
116
  }
@@ -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,8BAA8B,CAAC;AAGnE,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,CA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AM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;oBAClE,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,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';\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.getParameterValue(routeIdParameterDef) : 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.getParameterValue(def);\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.getParameterValue(def);\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-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C,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;oBACnC,IAAI,GAAG,CAAC,SAAS,EAAE,EAAE,8DAA8D;wBACjF,6EAA6E;wBAC7E,wFAAwF;wBACxF,0EAA0E;wBAC1E,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;4BACnB,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';\n\nimport { isEmpty, isNil } from 'lodash-es';\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.getParameterValue(routeIdParameterDef) : 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.getParameterValue(def);\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.getParameterValue(def);\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","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
+ [{"__symbolic":"module","version":4,"metadata":{"PlaceDefinition":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@coolon/pectin","name":"Constructable","line":12,"character":34,"arguments":[{"__symbolic":"reference","module":"./place-component","name":"PlaceComponent","line":12,"character":48}]},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"boolean"},{"__symbolic":"reference","name":"any"},{"__symbolic":"error","message":"Expression form not supported","line":16,"character":29},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","module":"./route/parameter-definition","name":"ParameterDefinition","line":17,"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","name":"Memoize","line":25,"character":3}}]}],"getRouteParameterDefs":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@typescript-plus/fast-memoize-decorator","name":"Memoize","line":30,"character":3}}]}],"getVisitParameterDefs":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@typescript-plus/fast-memoize-decorator","name":"Memoize","line":35,"character":3}}]}],"getPlaceData":[{"__symbolic":"method"}],"searchPlaceData":[{"__symbolic":"method"}],"getRouteIdFrom":[{"__symbolic":"method"}],"getFormattedRouteId":[{"__symbolic":"method"}],"getFormattedRouteParameters":[{"__symbolic":"method"}],"getNonRouteParameters":[{"__symbolic":"method"}],"parseRouteParams":[{"__symbolic":"method"}]}}}}]