@coolon/angular-ui-powerups 0.0.125 → 0.0.128
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/coolon-angular-ui-powerups.umd.js +3743 -3012
- package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
- package/bundles/coolon-angular-ui-powerups.umd.min.js +1 -1
- package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -1
- package/coolon-angular-ui-powerups.d.ts +17 -18
- package/coolon-angular-ui-powerups.metadata.json +1 -1
- package/esm2015/coolon-angular-ui-powerups.js +16 -17
- package/esm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/esm2015/coolon-angular-ui-powerups.metadata.json +1 -1
- package/esm2015/index.js +1 -1
- package/esm2015/index.js.map +1 -1
- package/esm2015/lib/angular-ui-powerups.module.ngfactory.js.map +1 -1
- package/esm2015/lib/interaction/abstract-interaction-context.js +104 -0
- package/esm2015/lib/interaction/abstract-interaction-context.js.map +1 -0
- package/esm2015/lib/interaction/abstract-interaction-context.metadata.json +1 -0
- package/esm2015/lib/interaction/activity-ref.js +123 -0
- package/esm2015/lib/interaction/activity-ref.js.map +1 -0
- package/esm2015/lib/interaction/activity-ref.metadata.json +1 -0
- package/esm2015/lib/interaction/activity.js +21 -1
- package/esm2015/lib/interaction/activity.js.map +1 -1
- package/esm2015/lib/interaction/activity.metadata.json +1 -1
- package/esm2015/lib/interaction/components/activity-container/activity-container.component.js +199 -230
- package/esm2015/lib/interaction/components/activity-container/activity-container.component.js.map +1 -1
- package/esm2015/lib/interaction/components/activity-container/activity-container.component.metadata.json +1 -1
- package/esm2015/lib/interaction/components/{activity-outlet → activity-container/activity-outlet}/activity-outlet.component.js +24 -31
- package/esm2015/lib/interaction/components/activity-container/activity-outlet/activity-outlet.component.js.map +1 -0
- package/esm2015/lib/interaction/components/activity-container/activity-outlet/activity-outlet.component.metadata.json +1 -0
- package/esm2015/lib/interaction/components/activity-container/activity-outlet/activity-outlet.component.ngfactory.js.map +1 -0
- package/esm2015/lib/interaction/components/activity-container/activity-outlet/activity-outlet.component.scss.shim.ngstyle.js.map +1 -0
- package/esm2015/lib/interaction/components/alert-dialog/alert-dialog.component.js +2 -3
- package/esm2015/lib/interaction/components/alert-dialog/alert-dialog.component.js.map +1 -1
- package/esm2015/lib/interaction/components/alert-dialog/alert-dialog.component.metadata.json +1 -1
- package/esm2015/lib/interaction/components/confirm-then-dialog/confirm-then-dialog.component.js +4 -11
- package/esm2015/lib/interaction/components/confirm-then-dialog/confirm-then-dialog.component.js.map +1 -1
- package/esm2015/lib/interaction/components/confirm-then-dialog/confirm-then-dialog.component.metadata.json +1 -1
- package/esm2015/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.js +2 -3
- package/esm2015/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.js.map +1 -1
- package/esm2015/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.metadata.json +1 -1
- package/esm2015/lib/interaction/components/inplace-interaction-context/in-place-interaction-context.component.js +113 -0
- package/esm2015/lib/interaction/components/inplace-interaction-context/in-place-interaction-context.component.js.map +1 -0
- package/esm2015/lib/interaction/components/inplace-interaction-context/in-place-interaction-context.component.metadata.json +1 -0
- package/esm2015/lib/interaction/components/inplace-interaction-context/in-place-interaction-context.component.ngfactory.js.map +1 -0
- package/esm2015/lib/interaction/components/inplace-interaction-context/in-place-interaction-context.component.scss.shim.ngstyle.js.map +1 -0
- package/esm2015/lib/interaction/index.js +7 -6
- package/esm2015/lib/interaction/index.js.map +1 -1
- package/esm2015/lib/interaction/index.metadata.json +1 -1
- package/esm2015/lib/interaction/interaction-context.js +12 -67
- package/esm2015/lib/interaction/interaction-context.js.map +1 -1
- package/esm2015/lib/interaction/interaction-context.metadata.json +1 -1
- package/esm2015/lib/interaction/interaction.module.js +4 -4
- package/esm2015/lib/interaction/interaction.module.js.map +1 -1
- package/esm2015/lib/interaction/interaction.module.metadata.json +1 -1
- package/esm2015/lib/interaction/interaction.module.ngfactory.js.map +1 -1
- package/esm2015/lib/interaction/route-synchronisation-adapter.js +17 -0
- package/esm2015/lib/interaction/route-synchronisation-adapter.js.map +1 -0
- package/esm2015/lib/interaction/route-synchronisation-adapter.metadata.json +1 -0
- package/esm2015/lib/interaction/services/interaction-service-routing-adapter.js +72 -0
- package/esm2015/lib/interaction/services/interaction-service-routing-adapter.js.map +1 -0
- package/esm2015/lib/interaction/services/interaction-service-routing-adapter.metadata.json +1 -0
- package/esm2015/lib/interaction/services/interaction.service.js +174 -104
- package/esm2015/lib/interaction/services/interaction.service.js.map +1 -1
- package/esm2015/lib/interaction/services/interaction.service.metadata.json +1 -1
- package/esm2015/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context-factory.js +4 -2
- package/esm2015/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context-factory.js.map +1 -1
- package/esm2015/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context-factory.metadata.json +1 -1
- package/esm2015/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context.js +79 -87
- package/esm2015/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context.js.map +1 -1
- package/esm2015/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context.metadata.json +1 -1
- package/esm2015/lib/interaction/services/modal-interaction-context.factory.js +3 -1
- package/esm2015/lib/interaction/services/modal-interaction-context.factory.js.map +1 -1
- package/esm2015/lib/place/components/abstract-place-navigation.component.js +27 -6
- package/esm2015/lib/place/components/abstract-place-navigation.component.js.map +1 -1
- package/esm2015/lib/place/components/abstract-place-navigation.component.metadata.json +1 -1
- package/esm2015/lib/place/components/list-place-nav/list-place-nav.component.js +9 -3
- package/esm2015/lib/place/components/list-place-nav/list-place-nav.component.js.map +1 -1
- package/esm2015/lib/place/components/list-place-nav/list-place-nav.component.metadata.json +1 -1
- package/esm2015/lib/place/components/place-outlet/place-outlet.component.js +98 -110
- package/esm2015/lib/place/components/place-outlet/place-outlet.component.js.map +1 -1
- package/esm2015/lib/place/components/place-outlet/place-outlet.component.metadata.json +1 -1
- package/esm2015/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.js +9 -3
- package/esm2015/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.js.map +1 -1
- package/esm2015/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.metadata.json +1 -1
- package/esm2015/lib/place/guards/place.guard.js +14 -13
- package/esm2015/lib/place/guards/place.guard.js.map +1 -1
- package/esm2015/lib/place/guards/place.guard.metadata.json +1 -1
- package/esm2015/lib/place/index.js +15 -2
- package/esm2015/lib/place/index.js.map +1 -1
- package/esm2015/lib/place/index.metadata.json +1 -1
- package/esm2015/lib/place/{guards → navigation}/place-component-deactivation-handler.js +28 -22
- package/esm2015/lib/place/navigation/place-component-deactivation-handler.js.map +1 -0
- package/esm2015/lib/place/navigation/place-component-deactivation-handler.metadata.json +1 -0
- package/esm2015/lib/place/navigation/session/abstract-pop-state-navigation.js +37 -0
- package/esm2015/lib/place/navigation/session/abstract-pop-state-navigation.js.map +1 -0
- package/esm2015/lib/place/navigation/session/abstract-pop-state-navigation.metadata.json +1 -0
- package/esm2015/lib/place/navigation/session/event-cleanup/event-clean-up-session.js +19 -0
- package/esm2015/lib/place/navigation/session/event-cleanup/event-clean-up-session.js.map +1 -0
- package/esm2015/lib/place/navigation/session/event-cleanup/event-clean-up-session.metadata.json +1 -0
- package/esm2015/lib/place/navigation/session/event-cleanup/wait-until-leaving-interaction-transition-cancelled.js +95 -0
- package/esm2015/lib/place/navigation/session/event-cleanup/wait-until-leaving-interaction-transition-cancelled.js.map +1 -0
- package/esm2015/lib/place/navigation/session/event-cleanup/wait-until-leaving-interaction-transition-cancelled.metadata.json +1 -0
- package/esm2015/lib/place/navigation/session/event-cleanup/wait-until-link-triggered-interaction-cancelation-finishes.js +132 -0
- package/esm2015/lib/place/navigation/session/event-cleanup/wait-until-link-triggered-interaction-cancelation-finishes.js.map +1 -0
- package/esm2015/lib/place/navigation/session/event-cleanup/wait-until-link-triggered-interaction-cancelation-finishes.metadata.json +1 -0
- package/esm2015/lib/place/navigation/session/event-cleanup/wait-until-popstate-during-can-deactivate-transition-finishes.js +123 -0
- package/esm2015/lib/place/navigation/session/event-cleanup/wait-until-popstate-during-can-deactivate-transition-finishes.js.map +1 -0
- package/esm2015/lib/place/navigation/session/event-cleanup/wait-until-popstate-during-can-deactivate-transition-finishes.metadata.json +1 -0
- package/esm2015/lib/place/navigation/session/interactions/navigating-during-interaction.js +62 -0
- package/esm2015/lib/place/navigation/session/interactions/navigating-during-interaction.js.map +1 -0
- package/esm2015/lib/place/navigation/session/interactions/navigating-during-interaction.metadata.json +1 -0
- package/esm2015/lib/place/navigation/session/interactions/pop-state-during-interaction-navigation.js +48 -0
- package/esm2015/lib/place/navigation/session/interactions/pop-state-during-interaction-navigation.js.map +1 -0
- package/esm2015/lib/place/navigation/session/interactions/pop-state-during-interaction-navigation.metadata.json +1 -0
- package/esm2015/lib/place/navigation/session/interactions/remove-last-interaction-from-url-navigation-session.js +104 -0
- package/esm2015/lib/place/navigation/session/interactions/remove-last-interaction-from-url-navigation-session.js.map +1 -0
- package/esm2015/lib/place/navigation/session/interactions/remove-last-interaction-from-url-navigation-session.metadata.json +1 -0
- package/esm2015/lib/place/navigation/session/interactions/synchronise-interaction-context-ids-with-route.js +141 -0
- package/esm2015/lib/place/navigation/session/interactions/synchronise-interaction-context-ids-with-route.js.map +1 -0
- package/esm2015/lib/place/navigation/session/interactions/synchronise-interaction-context-ids-with-route.metadata.json +1 -0
- package/esm2015/lib/place/navigation/session/navigating.js +54 -0
- package/esm2015/lib/place/navigation/session/navigating.js.map +1 -0
- package/esm2015/lib/place/navigation/session/navigating.metadata.json +1 -0
- package/esm2015/lib/place/navigation/session/navigation-context.js +38 -0
- package/esm2015/lib/place/navigation/session/navigation-context.js.map +1 -0
- package/esm2015/lib/place/navigation/session/navigation-context.metadata.json +1 -0
- package/esm2015/lib/place/navigation/session/navigation-session.js +326 -0
- package/esm2015/lib/place/navigation/session/navigation-session.js.map +1 -0
- package/esm2015/lib/place/navigation/session/navigation-session.metadata.json +1 -0
- package/esm2015/lib/place/navigation/session/pop-state-navigation.js +31 -0
- package/esm2015/lib/place/navigation/session/pop-state-navigation.js.map +1 -0
- package/esm2015/lib/place/navigation/session/pop-state-navigation.metadata.json +1 -0
- package/esm2015/lib/place/place-component.js +47 -22
- package/esm2015/lib/place/place-component.js.map +1 -1
- package/esm2015/lib/place/place-component.metadata.json +1 -1
- package/esm2015/lib/place/place-router.js +314 -309
- package/esm2015/lib/place/place-router.js.map +1 -1
- package/esm2015/lib/place/place-router.metadata.json +1 -1
- package/esm2015/lib/place/place.module.js.map +1 -1
- package/esm2015/lib/place/place.module.metadata.json +1 -1
- package/esm2015/lib/place/place.module.ngfactory.js.map +1 -1
- package/esm2015/lib/place/route/parameter-decorators.js +1 -0
- package/esm2015/lib/place/route/parameter-decorators.js.map +1 -1
- package/esm2015/lib/place/route/parameter-decorators.metadata.json +1 -1
- package/esm2015/lib/place/url-service.js +126 -0
- package/esm2015/lib/place/url-service.js.map +1 -0
- package/esm2015/lib/place/url-service.metadata.json +1 -0
- package/esm2015/lib/place/url-service.ngfactory.js.map +1 -0
- package/esm2015/lib/place/url-snapshot.js +15 -1
- package/esm2015/lib/place/url-snapshot.js.map +1 -1
- package/esm2015/lib/place/url-snapshot.metadata.json +1 -1
- package/esm2015/lib/place/visit.js +10 -0
- package/esm2015/lib/place/visit.js.map +1 -1
- package/esm2015/lib/place/visit.metadata.json +1 -1
- package/esm2015/public_api.js +2 -2
- package/esm2015/public_api.js.map +1 -1
- package/esm5/coolon-angular-ui-powerups.js +16 -17
- package/esm5/coolon-angular-ui-powerups.js.map +1 -1
- package/esm5/index.js +1 -1
- package/esm5/index.js.map +1 -1
- package/esm5/lib/angular-ui-powerups.module.ngfactory.js.map +1 -1
- package/esm5/lib/interaction/abstract-interaction-context.js +146 -0
- package/esm5/lib/interaction/abstract-interaction-context.js.map +1 -0
- package/esm5/lib/interaction/activity-ref.js +153 -0
- package/esm5/lib/interaction/activity-ref.js.map +1 -0
- package/esm5/lib/interaction/activity.js +29 -1
- package/esm5/lib/interaction/activity.js.map +1 -1
- package/esm5/lib/interaction/components/activity-container/activity-container.component.js +273 -265
- package/esm5/lib/interaction/components/activity-container/activity-container.component.js.map +1 -1
- package/esm5/lib/interaction/components/{activity-outlet → activity-container/activity-outlet}/activity-outlet.component.js +25 -32
- package/esm5/lib/interaction/components/activity-container/activity-outlet/activity-outlet.component.js.map +1 -0
- package/esm5/lib/interaction/components/activity-container/activity-outlet/activity-outlet.component.ngfactory.js.map +1 -0
- package/esm5/lib/interaction/components/activity-container/activity-outlet/activity-outlet.component.scss.shim.ngstyle.js.map +1 -0
- package/esm5/lib/interaction/components/alert-dialog/alert-dialog.component.js +2 -3
- package/esm5/lib/interaction/components/alert-dialog/alert-dialog.component.js.map +1 -1
- package/esm5/lib/interaction/components/confirm-then-dialog/confirm-then-dialog.component.js +4 -10
- package/esm5/lib/interaction/components/confirm-then-dialog/confirm-then-dialog.component.js.map +1 -1
- package/esm5/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.js +2 -3
- package/esm5/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.js.map +1 -1
- package/esm5/lib/interaction/components/inplace-interaction-context/in-place-interaction-context.component.js +158 -0
- package/esm5/lib/interaction/components/inplace-interaction-context/in-place-interaction-context.component.js.map +1 -0
- package/esm5/lib/interaction/components/inplace-interaction-context/in-place-interaction-context.component.ngfactory.js.map +1 -0
- package/esm5/lib/interaction/components/inplace-interaction-context/in-place-interaction-context.component.scss.shim.ngstyle.js.map +1 -0
- package/esm5/lib/interaction/index.js +7 -6
- package/esm5/lib/interaction/index.js.map +1 -1
- package/esm5/lib/interaction/interaction-context.js +12 -106
- package/esm5/lib/interaction/interaction-context.js.map +1 -1
- package/esm5/lib/interaction/interaction.module.js +4 -4
- package/esm5/lib/interaction/interaction.module.js.map +1 -1
- package/esm5/lib/interaction/interaction.module.ngfactory.js.map +1 -1
- package/esm5/lib/interaction/route-synchronisation-adapter.js +17 -0
- package/esm5/lib/interaction/route-synchronisation-adapter.js.map +1 -0
- package/esm5/lib/interaction/services/interaction-service-routing-adapter.js +98 -0
- package/esm5/lib/interaction/services/interaction-service-routing-adapter.js.map +1 -0
- package/esm5/lib/interaction/services/interaction.service.js +243 -117
- package/esm5/lib/interaction/services/interaction.service.js.map +1 -1
- package/esm5/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context-factory.js +6 -2
- package/esm5/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context-factory.js.map +1 -1
- package/esm5/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context.js +96 -107
- package/esm5/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context.js.map +1 -1
- package/esm5/lib/interaction/services/modal-interaction-context.factory.js +3 -1
- package/esm5/lib/interaction/services/modal-interaction-context.factory.js.map +1 -1
- package/esm5/lib/place/components/abstract-place-navigation.component.js +24 -6
- package/esm5/lib/place/components/abstract-place-navigation.component.js.map +1 -1
- package/esm5/lib/place/components/list-place-nav/list-place-nav.component.js +6 -3
- package/esm5/lib/place/components/list-place-nav/list-place-nav.component.js.map +1 -1
- package/esm5/lib/place/components/place-outlet/place-outlet.component.js +130 -129
- package/esm5/lib/place/components/place-outlet/place-outlet.component.js.map +1 -1
- package/esm5/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.js +6 -3
- package/esm5/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.js.map +1 -1
- package/esm5/lib/place/guards/place.guard.js +17 -13
- package/esm5/lib/place/guards/place.guard.js.map +1 -1
- package/esm5/lib/place/index.js +15 -2
- package/esm5/lib/place/index.js.map +1 -1
- package/esm5/lib/place/{guards → navigation}/place-component-deactivation-handler.js +45 -21
- package/esm5/lib/place/navigation/place-component-deactivation-handler.js.map +1 -0
- package/esm5/lib/place/navigation/session/abstract-pop-state-navigation.js +49 -0
- package/esm5/lib/place/navigation/session/abstract-pop-state-navigation.js.map +1 -0
- package/esm5/lib/place/navigation/session/event-cleanup/event-clean-up-session.js +36 -0
- package/esm5/lib/place/navigation/session/event-cleanup/event-clean-up-session.js.map +1 -0
- package/esm5/lib/place/navigation/session/event-cleanup/wait-until-leaving-interaction-transition-cancelled.js +151 -0
- package/esm5/lib/place/navigation/session/event-cleanup/wait-until-leaving-interaction-transition-cancelled.js.map +1 -0
- package/esm5/lib/place/navigation/session/event-cleanup/wait-until-link-triggered-interaction-cancelation-finishes.js +221 -0
- package/esm5/lib/place/navigation/session/event-cleanup/wait-until-link-triggered-interaction-cancelation-finishes.js.map +1 -0
- package/esm5/lib/place/navigation/session/event-cleanup/wait-until-popstate-during-can-deactivate-transition-finishes.js +186 -0
- package/esm5/lib/place/navigation/session/event-cleanup/wait-until-popstate-during-can-deactivate-transition-finishes.js.map +1 -0
- package/esm5/lib/place/navigation/session/interactions/navigating-during-interaction.js +107 -0
- package/esm5/lib/place/navigation/session/interactions/navigating-during-interaction.js.map +1 -0
- package/esm5/lib/place/navigation/session/interactions/pop-state-during-interaction-navigation.js +77 -0
- package/esm5/lib/place/navigation/session/interactions/pop-state-during-interaction-navigation.js.map +1 -0
- package/esm5/lib/place/navigation/session/interactions/remove-last-interaction-from-url-navigation-session.js +167 -0
- package/esm5/lib/place/navigation/session/interactions/remove-last-interaction-from-url-navigation-session.js.map +1 -0
- package/esm5/lib/place/navigation/session/interactions/synchronise-interaction-context-ids-with-route.js +185 -0
- package/esm5/lib/place/navigation/session/interactions/synchronise-interaction-context-ids-with-route.js.map +1 -0
- package/esm5/lib/place/navigation/session/navigating.js +75 -0
- package/esm5/lib/place/navigation/session/navigating.js.map +1 -0
- package/esm5/lib/place/navigation/session/navigation-context.js +32 -0
- package/esm5/lib/place/navigation/session/navigation-context.js.map +1 -0
- package/esm5/lib/place/navigation/session/navigation-session.js +450 -0
- package/esm5/lib/place/navigation/session/navigation-session.js.map +1 -0
- package/esm5/lib/place/navigation/session/pop-state-navigation.js +50 -0
- package/esm5/lib/place/navigation/session/pop-state-navigation.js.map +1 -0
- package/esm5/lib/place/place-component.js +66 -25
- package/esm5/lib/place/place-component.js.map +1 -1
- package/esm5/lib/place/place-router.js +414 -401
- package/esm5/lib/place/place-router.js.map +1 -1
- package/esm5/lib/place/place.module.js.map +1 -1
- package/esm5/lib/place/place.module.ngfactory.js.map +1 -1
- package/esm5/lib/place/route/parameter-decorators.js +1 -0
- package/esm5/lib/place/route/parameter-decorators.js.map +1 -1
- package/esm5/lib/place/url-service.js +176 -0
- package/esm5/lib/place/url-service.js.map +1 -0
- package/esm5/lib/place/url-service.ngfactory.js.map +1 -0
- package/esm5/lib/place/url-snapshot.js +22 -1
- package/esm5/lib/place/url-snapshot.js.map +1 -1
- package/esm5/lib/place/visit.js +14 -0
- package/esm5/lib/place/visit.js.map +1 -1
- package/esm5/public_api.js +2 -2
- package/esm5/public_api.js.map +1 -1
- package/fesm2015/coolon-angular-ui-powerups.js +2641 -2268
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +3703 -2984
- package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/interaction/abstract-interaction-context.d.ts +24 -0
- package/lib/interaction/activity-ref.d.ts +19 -0
- package/lib/interaction/activity.d.ts +5 -1
- package/lib/interaction/components/activity-container/activity-container.component.d.ts +42 -43
- package/lib/interaction/components/{activity-outlet → activity-container/activity-outlet}/activity-outlet.component.d.ts +7 -10
- package/lib/interaction/components/alert-dialog/alert-dialog.component.d.ts +2 -2
- package/lib/interaction/components/confirm-then-dialog/confirm-then-dialog.component.d.ts +2 -5
- package/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.d.ts +2 -2
- package/lib/interaction/components/inplace-interaction-context/in-place-interaction-context.component.d.ts +24 -0
- package/lib/interaction/index.d.ts +6 -5
- package/lib/interaction/interaction-context.d.ts +8 -29
- package/lib/interaction/route-synchronisation-adapter.d.ts +5 -0
- package/lib/interaction/services/interaction-service-routing-adapter.d.ts +15 -0
- package/lib/interaction/services/interaction.service.d.ts +52 -24
- package/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context-factory.d.ts +2 -1
- package/lib/interaction/services/mat-dialog-interaction/dialog-interaction-context.d.ts +15 -12
- package/lib/interaction/services/modal-interaction-context.factory.d.ts +2 -1
- package/lib/place/components/abstract-place-navigation.component.d.ts +5 -3
- package/lib/place/components/list-place-nav/list-place-nav.component.d.ts +2 -1
- package/lib/place/components/place-outlet/place-outlet.component.d.ts +9 -10
- package/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.d.ts +2 -1
- package/lib/place/guards/place.guard.d.ts +4 -3
- package/lib/place/index.d.ts +15 -2
- package/lib/place/navigation/place-component-deactivation-handler.d.ts +22 -0
- package/lib/place/navigation/session/abstract-pop-state-navigation.d.ts +9 -0
- package/lib/place/navigation/session/event-cleanup/event-clean-up-session.d.ts +4 -0
- package/lib/place/navigation/session/event-cleanup/wait-until-leaving-interaction-transition-cancelled.d.ts +27 -0
- package/lib/place/navigation/session/event-cleanup/wait-until-link-triggered-interaction-cancelation-finishes.d.ts +43 -0
- package/lib/place/navigation/session/event-cleanup/wait-until-popstate-during-can-deactivate-transition-finishes.d.ts +33 -0
- package/lib/place/navigation/session/interactions/navigating-during-interaction.d.ts +15 -0
- package/lib/place/navigation/session/interactions/pop-state-during-interaction-navigation.d.ts +17 -0
- package/lib/place/navigation/session/interactions/remove-last-interaction-from-url-navigation-session.d.ts +24 -0
- package/lib/place/navigation/session/interactions/synchronise-interaction-context-ids-with-route.d.ts +15 -0
- package/lib/place/navigation/session/navigating.d.ts +11 -0
- package/lib/place/navigation/session/navigation-context.d.ts +28 -0
- package/lib/place/navigation/session/navigation-session.d.ts +51 -0
- package/lib/place/navigation/session/pop-state-navigation.d.ts +7 -0
- package/lib/place/place-component.d.ts +6 -3
- package/lib/place/place-router.d.ts +39 -35
- package/lib/place/url-service.d.ts +30 -0
- package/lib/place/url-snapshot.d.ts +3 -1
- package/lib/place/visit.d.ts +1 -0
- package/package.json +1 -1
- package/schematics/place-routes/templates/place-routes.ts.template +4 -3
- package/esm2015/lib/interaction/abstract-activity.js +0 -13
- package/esm2015/lib/interaction/abstract-activity.js.map +0 -1
- package/esm2015/lib/interaction/abstract-activity.metadata.json +0 -1
- package/esm2015/lib/interaction/components/activity-outlet/activity-outlet-context.js +0 -21
- package/esm2015/lib/interaction/components/activity-outlet/activity-outlet-context.js.map +0 -1
- package/esm2015/lib/interaction/components/activity-outlet/activity-outlet-context.metadata.json +0 -1
- package/esm2015/lib/interaction/components/activity-outlet/activity-outlet.component.js.map +0 -1
- package/esm2015/lib/interaction/components/activity-outlet/activity-outlet.component.metadata.json +0 -1
- package/esm2015/lib/interaction/components/activity-outlet/activity-outlet.component.ngfactory.js.map +0 -1
- package/esm2015/lib/interaction/components/activity-outlet/activity-outlet.component.scss.shim.ngstyle.js.map +0 -1
- package/esm2015/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.js +0 -102
- package/esm2015/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.js.map +0 -1
- package/esm2015/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.metadata.json +0 -1
- package/esm2015/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.ngfactory.js.map +0 -1
- package/esm2015/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.scss.shim.ngstyle.js.map +0 -1
- package/esm2015/lib/interaction/interaction-context-base.js +0 -171
- package/esm2015/lib/interaction/interaction-context-base.js.map +0 -1
- package/esm2015/lib/interaction/interaction-context-base.metadata.json +0 -1
- package/esm2015/lib/place/guards/navigation-state.js +0 -1118
- package/esm2015/lib/place/guards/navigation-state.js.map +0 -1
- package/esm2015/lib/place/guards/navigation-state.metadata.json +0 -1
- package/esm2015/lib/place/guards/place-component-deactivation-handler.js.map +0 -1
- package/esm2015/lib/place/guards/place-component-deactivation-handler.metadata.json +0 -1
- package/esm5/lib/interaction/abstract-activity.js +0 -30
- package/esm5/lib/interaction/abstract-activity.js.map +0 -1
- package/esm5/lib/interaction/components/activity-outlet/activity-outlet-context.js +0 -21
- package/esm5/lib/interaction/components/activity-outlet/activity-outlet-context.js.map +0 -1
- package/esm5/lib/interaction/components/activity-outlet/activity-outlet.component.js.map +0 -1
- package/esm5/lib/interaction/components/activity-outlet/activity-outlet.component.ngfactory.js.map +0 -1
- package/esm5/lib/interaction/components/activity-outlet/activity-outlet.component.scss.shim.ngstyle.js.map +0 -1
- package/esm5/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.js +0 -119
- package/esm5/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.js.map +0 -1
- package/esm5/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.ngfactory.js.map +0 -1
- package/esm5/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.scss.shim.ngstyle.js.map +0 -1
- package/esm5/lib/interaction/interaction-context-base.js +0 -228
- package/esm5/lib/interaction/interaction-context-base.js.map +0 -1
- package/esm5/lib/place/guards/navigation-state.js +0 -1491
- package/esm5/lib/place/guards/navigation-state.js.map +0 -1
- package/esm5/lib/place/guards/place-component-deactivation-handler.js.map +0 -1
- package/lib/interaction/abstract-activity.d.ts +0 -6
- package/lib/interaction/components/activity-outlet/activity-outlet-context.d.ts +0 -7
- package/lib/interaction/components/inplace-interaction-context/inplace-interaction-context.component.d.ts +0 -17
- package/lib/interaction/interaction-context-base.d.ts +0 -29
- package/lib/place/guards/navigation-state.d.ts +0 -228
- package/lib/place/guards/place-component-deactivation-handler.d.ts +0 -15
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import * as tslib_1 from "tslib";
|
|
6
6
|
import { Component, EventEmitter, Inject, Input, Optional, Output, SkipSelf, ViewChild } from '@angular/core';
|
|
7
7
|
import { Router, RouterOutlet } from '@angular/router';
|
|
8
|
-
import { DebugContext,
|
|
8
|
+
import { DebugContext, Dsl, lang, ListModel, MutableValueModel, StoreInListModel, StoreInValueModel, UseDelegate, ValueModel } from '@coolon/pectin';
|
|
9
9
|
import * as _ from 'lodash';
|
|
10
10
|
import { DisposableComponent } from '../../../components/disposable-component';
|
|
11
11
|
import { AUP_PLACE_CONFIG } from '../../place-config';
|
|
@@ -41,23 +41,14 @@ export class PlaceOutletComponent extends DisposableComponent {
|
|
|
41
41
|
this.placeRouter = placeRouter;
|
|
42
42
|
this.placeConfig = placeConfig;
|
|
43
43
|
this.placeChanged = new EventEmitter();
|
|
44
|
-
this.
|
|
45
|
-
this._activePlaceVisitModel = new DelegatingValueModel();
|
|
46
|
-
this._inOutletActivation = new Guard();
|
|
47
|
-
this._inOutletDeactivation = new Guard();
|
|
48
|
-
this._inRouteVisitUpdate = new Guard();
|
|
44
|
+
this.outletActivated = new MutableValueModel(false);
|
|
49
45
|
this._activatedRouteModel = new MutableValueModel();
|
|
50
|
-
this.
|
|
46
|
+
this._activePlaceModel = new MutableValueModel();
|
|
51
47
|
this.initialPlaceIndex = null;
|
|
48
|
+
this._isPushingVisitToRoute = new MutableValueModel(false);
|
|
52
49
|
const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
|
|
53
50
|
this.parentOutletModel = new MutableValueModel(parentOutlet);
|
|
54
51
|
/** @type {?} */
|
|
55
|
-
const mutableValueModel = new MutableValueModel();
|
|
56
|
-
DebugContext.tag(mutableValueModel, "PlaceOutletComponent -> mutableValueModel");
|
|
57
|
-
this._activePlaceVisitModel.setDelegate(mutableValueModel);
|
|
58
|
-
DebugContext.tag(this._activePlaceVisitModel, "PlaceOutletComponent._activePlaceVisitModel");
|
|
59
|
-
this._inOutletUpdate = valueOf.any(this._inOutletDeactivation, this._inOutletActivation).areTruthy();
|
|
60
|
-
/** @type {?} */
|
|
61
52
|
const defaultPlaceAnimationOrder = chain(this.parentOutletModel)
|
|
62
53
|
.pullValueModel((/**
|
|
63
54
|
* @param {?} o
|
|
@@ -90,35 +81,31 @@ export class PlaceOutletComponent extends DisposableComponent {
|
|
|
90
81
|
}
|
|
91
82
|
return _.isNil(this.initialPlaceIndex) ? 0 : placeIndex - this.initialPlaceIndex;
|
|
92
83
|
}), { dependsOn: activatePlaceType });
|
|
93
|
-
//
|
|
94
|
-
this.
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
// we can safely ignore it during outlet changes as these always happen before the router session ends.
|
|
99
|
-
when.valueOf(this.routerVisit).changes((/**
|
|
84
|
+
// Extract our visit model from the place router.
|
|
85
|
+
this._activePlaceDefinition = chain(this._activePlaceModel).pluck('placeDefinition');
|
|
86
|
+
this.routerVisitModel = this._activePlaceDefinition.findIn(chain(placeRouter.activeVisitsByPlaceDefinition));
|
|
87
|
+
this.navigationInProgress = chain(this.placeRouter.navigationInProgress);
|
|
88
|
+
when.valueOf(this.navigationInProgress).becomesFalsey((/**
|
|
100
89
|
* @return {?}
|
|
101
90
|
*/
|
|
102
|
-
() =>
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
* @param {?} previous
|
|
91
|
+
() => {
|
|
92
|
+
this.checkStateAndInitialise();
|
|
93
|
+
}));
|
|
94
|
+
when.valueOf(this.outletActivated).becomesTruthy((/**
|
|
107
95
|
* @return {?}
|
|
108
96
|
*/
|
|
109
|
-
(
|
|
110
|
-
this.
|
|
111
|
-
})
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
chain(this._activePlace)
|
|
115
|
-
.postponeWhile(placeRouter.navigationInProgress)
|
|
97
|
+
() => {
|
|
98
|
+
this.checkStateAndInitialise();
|
|
99
|
+
}));
|
|
100
|
+
chain(this._activePlaceModel)
|
|
101
|
+
.postponeWhile(this.navigationInProgress)
|
|
116
102
|
.subscribe((/**
|
|
117
103
|
* @param {?} place
|
|
118
104
|
* @return {?}
|
|
119
105
|
*/
|
|
120
106
|
place => this.placeChanged.emit(place)));
|
|
121
107
|
}
|
|
108
|
+
// @Trace()
|
|
122
109
|
/**
|
|
123
110
|
* @return {?}
|
|
124
111
|
*/
|
|
@@ -154,93 +141,104 @@ export class PlaceOutletComponent extends DisposableComponent {
|
|
|
154
141
|
get parentOutlet() {
|
|
155
142
|
return this.parentOutletModel.value;
|
|
156
143
|
}
|
|
157
|
-
// @Trace()
|
|
158
144
|
/**
|
|
159
145
|
* @return {?}
|
|
160
146
|
*/
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
const visit = this.routerVisit.value;
|
|
164
|
-
// console.log({
|
|
165
|
-
// visit,
|
|
166
|
-
// place: visit ? visit.placeDefinition.component : null,
|
|
167
|
-
// inOutletActivation: this._inOutletActivation.value,
|
|
168
|
-
// inRoutingSession: this.placeRouter.navigationSessionActive.value
|
|
169
|
-
// });
|
|
170
|
-
if (visit) { // can be null while the place and index sync up
|
|
171
|
-
this._inRouteVisitUpdate.whileTrue((/**
|
|
172
|
-
* @return {?}
|
|
173
|
-
*/
|
|
174
|
-
() => {
|
|
175
|
-
this._activePlaceVisitModel.value = visit;
|
|
176
|
-
}));
|
|
177
|
-
}
|
|
147
|
+
get activePlaceModel() {
|
|
148
|
+
return this._activePlaceModel.readonly;
|
|
178
149
|
}
|
|
179
150
|
/**
|
|
180
|
-
* @param {?} next
|
|
181
|
-
* @param {?} previous
|
|
182
151
|
* @return {?}
|
|
183
152
|
*/
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
const activatedRoute = this._activatedRouteModel.value;
|
|
187
|
-
this.placeRouter.pushVisitChangesToRoute(activatedRoute, previous, next);
|
|
153
|
+
get activatedRouteModel() {
|
|
154
|
+
return this._activatedRouteModel.readonly;
|
|
188
155
|
}
|
|
156
|
+
// @Trace()
|
|
189
157
|
/**
|
|
158
|
+
* @param {?} routerOutlet
|
|
159
|
+
* @param {?} place
|
|
190
160
|
* @return {?}
|
|
191
161
|
*/
|
|
192
|
-
|
|
193
|
-
|
|
162
|
+
onOutletActivated(routerOutlet, place) {
|
|
163
|
+
this._activatedRouteModel.value = routerOutlet.activatedRoute;
|
|
164
|
+
this._activePlaceModel.value = place;
|
|
165
|
+
this.outletActivated.value = true;
|
|
166
|
+
this.checkStateAndInitialise();
|
|
194
167
|
}
|
|
168
|
+
// @Trace()
|
|
195
169
|
/**
|
|
196
170
|
* @return {?}
|
|
197
171
|
*/
|
|
198
|
-
|
|
199
|
-
|
|
172
|
+
onOutletDeactivated() {
|
|
173
|
+
this.outletActivated.value = false;
|
|
174
|
+
this._activePlaceModel.value = null;
|
|
175
|
+
this._activatedRouteModel.value = null;
|
|
200
176
|
}
|
|
201
177
|
// @Trace()
|
|
202
178
|
/**
|
|
203
|
-
* @
|
|
204
|
-
* @param {?} place
|
|
179
|
+
* @private
|
|
205
180
|
* @return {?}
|
|
206
181
|
*/
|
|
207
|
-
|
|
208
|
-
|
|
182
|
+
checkStateAndInitialise() {
|
|
183
|
+
/** @type {?} */
|
|
184
|
+
const routerVisit = this.routerVisitModel.value;
|
|
185
|
+
/** @type {?} */
|
|
186
|
+
const activePlace = this.activePlaceModel.value;
|
|
187
|
+
if (routerVisit && activePlace && !activePlace.isInitialised()) {
|
|
188
|
+
if (routerVisit.placeDefinition !== activePlace.placeDefinition) {
|
|
189
|
+
lang.illegalState('wrong visit!!!');
|
|
190
|
+
}
|
|
191
|
+
this.initialisePlace(routerVisit, activePlace);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
// @Trace()
|
|
195
|
+
/**
|
|
196
|
+
* @private
|
|
197
|
+
* @param {?} routerVisit
|
|
198
|
+
* @param {?} activePlace
|
|
199
|
+
* @return {?}
|
|
200
|
+
*/
|
|
201
|
+
initialisePlace(routerVisit, activePlace) {
|
|
202
|
+
/** @type {?} */
|
|
203
|
+
const visitModel = new MutableValueModel(routerVisit);
|
|
204
|
+
DebugContext.tag(visitModel, `PlaceOutletComponent[${activePlace.constructor.name})].visitModel`);
|
|
205
|
+
activePlace.initialiseVisit(routerVisit, (/**
|
|
206
|
+
* @param {?} current
|
|
207
|
+
* @param {?} previous
|
|
209
208
|
* @return {?}
|
|
210
209
|
*/
|
|
211
|
-
() => {
|
|
212
|
-
|
|
213
|
-
this._activePlace.value = place;
|
|
214
|
-
this._activatedRouteModel.value = routerOutlet.activatedRoute;
|
|
215
|
-
this._placeDefinition.value = place.placeDefinition;
|
|
216
|
-
/** @type {?} */
|
|
217
|
-
const visitModel = new MutableValueModel();
|
|
218
|
-
DebugContext.tag(visitModel, "PlaceOutletCompeont.visitModel");
|
|
219
|
-
this._activePlaceVisitModel.setDelegate(visitModel);
|
|
220
|
-
place.initialiseVisit(visitModel);
|
|
221
|
-
}
|
|
222
|
-
catch (error) {
|
|
223
|
-
console.error(error);
|
|
224
|
-
}
|
|
210
|
+
(current, previous) => {
|
|
211
|
+
this.pushVisitChangeToRoute(previous, current);
|
|
225
212
|
}));
|
|
226
213
|
if (!this.animateModel.value) {
|
|
227
214
|
// we're not animating so trigger any post animation callbacks now.
|
|
228
215
|
this.animationDone();
|
|
229
216
|
}
|
|
217
|
+
const { when, chain, valueOf } = Dsl.disposeWith(activePlace);
|
|
218
|
+
when.valueOf(this.routerVisitModel)
|
|
219
|
+
.changes((/**
|
|
220
|
+
* @param {?} visit
|
|
221
|
+
* @return {?}
|
|
222
|
+
*/
|
|
223
|
+
visit => {
|
|
224
|
+
activePlace.updateVisit(visit);
|
|
225
|
+
}), {
|
|
226
|
+
unless: valueOf.any(this._isPushingVisitToRoute, this.routerVisitModel.isNil()).areTruthy()
|
|
227
|
+
});
|
|
230
228
|
}
|
|
231
|
-
// @Trace()
|
|
232
229
|
/**
|
|
230
|
+
* @private
|
|
231
|
+
* @param {?} previous
|
|
232
|
+
* @param {?} current
|
|
233
233
|
* @return {?}
|
|
234
234
|
*/
|
|
235
|
-
|
|
236
|
-
this.
|
|
235
|
+
pushVisitChangeToRoute(previous, current) {
|
|
236
|
+
this._isPushingVisitToRoute.value = true;
|
|
237
|
+
this.placeRouter.pushVisitChangesToRoute(previous, current).finally((/**
|
|
237
238
|
* @return {?}
|
|
238
239
|
*/
|
|
239
240
|
() => {
|
|
240
|
-
this.
|
|
241
|
-
this._activatedRouteModel.value = null;
|
|
242
|
-
this._placeDefinition.value = null;
|
|
243
|
-
this._activePlaceVisitModel.setDelegate(null);
|
|
241
|
+
this._isPushingVisitToRoute.value = false;
|
|
244
242
|
}));
|
|
245
243
|
}
|
|
246
244
|
// @Trace()
|
|
@@ -248,22 +246,22 @@ export class PlaceOutletComponent extends DisposableComponent {
|
|
|
248
246
|
* @return {?}
|
|
249
247
|
*/
|
|
250
248
|
animationStarted() {
|
|
251
|
-
// console.log({ activePlace: this.
|
|
249
|
+
// console.log({ activePlace: this._activePlaceModel.value });
|
|
252
250
|
}
|
|
253
251
|
// @Trace()
|
|
254
252
|
/**
|
|
255
253
|
* @return {?}
|
|
256
254
|
*/
|
|
257
255
|
animationDone() {
|
|
258
|
-
if (this.
|
|
259
|
-
this.
|
|
256
|
+
if (this._activePlaceModel.value) {
|
|
257
|
+
this._activePlaceModel.value.onPlaceReady();
|
|
260
258
|
}
|
|
261
259
|
}
|
|
262
260
|
}
|
|
263
261
|
PlaceOutletComponent.decorators = [
|
|
264
262
|
{ type: Component, args: [{
|
|
265
263
|
selector: 'aup-place-outlet',
|
|
266
|
-
template: "<div class=\"router-outlet-container\"\n
|
|
264
|
+
template: "<ng-container *ngIf=\"animateModel.value\">\n <div class=\"router-outlet-container\"\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=\"!animateModel.value\">\n <div class=\"router-outlet-container\">\n <router-outlet #routerOutlet=\"outlet\"\n (activate)=\"onOutletActivated(routerOutlet, $event)\"\n (deactivate)=\"onOutletDeactivated()\">\n </router-outlet>\n </div>\n</ng-container>\n\n",
|
|
267
265
|
animations: [LEFT_RIGHT_PLACE_ANIMATION],
|
|
268
266
|
styles: [":host{display:flex;flex-direction:column;min-height:0;overflow-x:hidden}.router-outlet-container{flex:1;display:block;position:relative;min-height:0}router-outlet{display:none}"]
|
|
269
267
|
}] }
|
|
@@ -316,59 +314,49 @@ if (false) {
|
|
|
316
314
|
* @type {?}
|
|
317
315
|
* @private
|
|
318
316
|
*/
|
|
319
|
-
PlaceOutletComponent.prototype.
|
|
317
|
+
PlaceOutletComponent.prototype.outletActivated;
|
|
320
318
|
/**
|
|
321
319
|
* @type {?}
|
|
322
320
|
* @private
|
|
323
321
|
*/
|
|
324
|
-
PlaceOutletComponent.prototype.
|
|
325
|
-
/**
|
|
326
|
-
* @type {?}
|
|
327
|
-
* @private
|
|
328
|
-
*/
|
|
329
|
-
PlaceOutletComponent.prototype._inOutletActivation;
|
|
330
|
-
/**
|
|
331
|
-
* @type {?}
|
|
332
|
-
* @private
|
|
333
|
-
*/
|
|
334
|
-
PlaceOutletComponent.prototype._inOutletDeactivation;
|
|
322
|
+
PlaceOutletComponent.prototype._activatedRouteModel;
|
|
335
323
|
/**
|
|
336
324
|
* @type {?}
|
|
337
325
|
* @private
|
|
338
326
|
*/
|
|
339
|
-
PlaceOutletComponent.prototype.
|
|
327
|
+
PlaceOutletComponent.prototype._activePlaceModel;
|
|
340
328
|
/**
|
|
341
329
|
* @type {?}
|
|
342
330
|
* @private
|
|
343
331
|
*/
|
|
344
|
-
PlaceOutletComponent.prototype.
|
|
332
|
+
PlaceOutletComponent.prototype._activePlaceDefinition;
|
|
345
333
|
/**
|
|
346
334
|
* @type {?}
|
|
347
335
|
* @private
|
|
348
336
|
*/
|
|
349
|
-
PlaceOutletComponent.prototype.
|
|
337
|
+
PlaceOutletComponent.prototype.parentOutletModel;
|
|
338
|
+
/** @type {?} */
|
|
339
|
+
PlaceOutletComponent.prototype.placeAnimationOrder;
|
|
350
340
|
/**
|
|
351
341
|
* @type {?}
|
|
352
342
|
* @private
|
|
353
343
|
*/
|
|
354
|
-
PlaceOutletComponent.prototype.
|
|
344
|
+
PlaceOutletComponent.prototype.initialPlaceIndex;
|
|
355
345
|
/**
|
|
356
346
|
* @type {?}
|
|
357
347
|
* @private
|
|
358
348
|
*/
|
|
359
|
-
PlaceOutletComponent.prototype.
|
|
360
|
-
/** @type {?} */
|
|
361
|
-
PlaceOutletComponent.prototype.placeAnimationOrder;
|
|
349
|
+
PlaceOutletComponent.prototype.routerVisitModel;
|
|
362
350
|
/**
|
|
363
351
|
* @type {?}
|
|
364
352
|
* @private
|
|
365
353
|
*/
|
|
366
|
-
PlaceOutletComponent.prototype.
|
|
354
|
+
PlaceOutletComponent.prototype._isPushingVisitToRoute;
|
|
367
355
|
/**
|
|
368
356
|
* @type {?}
|
|
369
357
|
* @private
|
|
370
358
|
*/
|
|
371
|
-
PlaceOutletComponent.prototype.
|
|
359
|
+
PlaceOutletComponent.prototype.navigationInProgress;
|
|
372
360
|
/**
|
|
373
361
|
* @type {?}
|
|
374
362
|
* @private
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"place-outlet.component.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/place/components/place-outlet/place-outlet.component.ts"],"names":[],"mappings":";;;;;AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAU,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACtH,OAAO,EAAkB,MAAM,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAEU,YAAY,EAC3B,oBAAoB,EACpB,GAAG,EACH,KAAK,EACL,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,UAAU,EAEX,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAE/E,OAAO,EAAE,gBAAgB,EAAe,MAAM,oBAAoB,CAAC;AAEnE,OAAO,EAAE,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AvChC,KAAK;2BAGL,KAAK;6CAIL,KAAK,SAAC,0BAA0B;wCAIhC,KAAK,SAAC,qBAAqB;2BAG3B,MAAM;wBAGN,SAAS,SAAC,aAAa,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;;AAhB1C;IADU,iBAAiB,CAAC,cAAc,CAAC;;qDAC1B;AAGjB;IADU,WAAW,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;sCAC/B,UAAU;0DAAU;AAIlC;IADoC,WAAW,EAAE;sCACjB,SAAS;4EAAgC;AAIzE;IAD+B,gBAAgB,CAAC,gCAAgC,CAAC;;uEACtB;;;IAZ3D,uCACiB;;IAEjB,4CACkC;;IAGlC,8DACyE;;IAGzE,yDAC2D;;IAE3D,4CAC2D;;IAE3D,yCACwB;;;;;IAExB,4CAAwE;;;;;IACxE,sDAA4E;;;;;IAE5E,mDAAmD;;;;;IACnD,qDAAqD;;;;;IACrD,+CAAyD;;;;;IACzD,mDAAmD;;;;;IACnD,oDAAgF;;;;;IAEhF,gDAA6E;;;;;IAC7E,iDAAmE;;IACnE,mDAA6D;;;;;IAE7D,iDAAyC;;;;;IACzC,2CAA4C;;;;;IAEhC,sCAA+B;;;;;IAC/B,2CAAyC;;IACzC,2CAAuE","sourcesContent":["import { Component, EventEmitter, Inject, Input, OnInit, Optional, Output, SkipSelf, ViewChild } from '@angular/core';\nimport { ActivatedRoute, Router, RouterOutlet } from '@angular/router';\nimport {\n BooleanValueModelChain,\n Constructable, DebugContext,\n DelegatingValueModel,\n Dsl,\n Guard,\n ListModel,\n MutableValueModel,\n StoreInListModel,\n StoreInValueModel,\n UseDelegate,\n ValueModel,\n ValueModelChain\n} from '@coolon/pectin';\nimport * as _ from 'lodash';\nimport { DisposableComponent } from '../../../components/disposable-component';\nimport { PlaceComponent } from '../../place-component';\nimport { AUP_PLACE_CONFIG, PlaceConfig } from '../../place-config';\nimport { PlaceDefinition } from '../../place-definition';\nimport { PlaceRouter } from '../../place-router';\n\nimport { Visit } from '../../visit';\nimport { LEFT_RIGHT_PLACE_ANIMATION } from './route-animations';\n\n// Quick hack to avoid circular references between this and PlaceComponents.\ninterface PlaceRef {\n readonly placeDefinition: PlaceDefinition\n\n initialiseBindings(param: ValueModel<Visit>): void;\n\n onPlaceReady(): void;\n}\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() @UseDelegate({ defaultValue: true })\n animateModel: ValueModel<boolean>;\n\n // tslint:disable-next-line:no-input-rename\n @Input('placeAnimationOrderModel') @UseDelegate()\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 readonly _activePlace = new MutableValueModel<PlaceComponent>();\n private readonly _activePlaceVisitModel = new DelegatingValueModel<Visit>();\n\n private readonly _inOutletActivation = new Guard();\n private readonly _inOutletDeactivation = new Guard();\n private readonly _inOutletUpdate: BooleanValueModelChain;\n private readonly _inRouteVisitUpdate = new Guard();\n private readonly _activatedRouteModel = new MutableValueModel<ActivatedRoute>();\n\n private readonly _placeDefinition = new MutableValueModel<PlaceDefinition>();\n private parentOutletModel: MutableValueModel<PlaceOutletComponent>;\n public readonly placeAnimationOrder: ValueModelChain<number>;\n\n private initialPlaceIndex: number = null;\n private routerVisit: ValueModelChain<Visit>;\n\n constructor(private readonly router: Router,\n private readonly placeRouter: PlaceRouter,\n @Optional() @Inject(AUP_PLACE_CONFIG) readonly placeConfig: PlaceConfig,\n @SkipSelf() @Optional() parentOutlet: PlaceOutletComponent) {\n super();\n const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);\n\n this.parentOutletModel = new MutableValueModel(parentOutlet);\n const mutableValueModel = new MutableValueModel<Visit>();\n DebugContext.tag(mutableValueModel, \"PlaceOutletComponent -> mutableValueModel\");\n this._activePlaceVisitModel.setDelegate(mutableValueModel);\n DebugContext.tag(this._activePlaceVisitModel, \"PlaceOutletComponent._activePlaceVisitModel\");\n this._inOutletUpdate = valueOf.any(this._inOutletDeactivation, this._inOutletActivation).areTruthy();\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 this.placeAnimationOrder = chain(this.customPlaceAnimationOrderModel)\n .otherwise(defaultPlaceAnimationOrder)\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 // Push incoming changes into the component\n this.routerVisit = chain(this._activePlace).pluck('placeDefinition').findIn(placeRouter.activeVisitIndex);\n // Our router visit will change when our active is nullified during deactivation, which will push a null visit\n // the the deactivated component, which will nuke it's view before the animations have finished.\n // The visit will alway updated after the router session is finsised (when the new visits are registered) so\n // we can safely ignore it during outlet changes as these always happen before the router session ends.\n when.valueOf(this.routerVisit).changes(() => this.pushRouteChangesToVisit(), { unless: this._inOutletUpdate });\n\n // Handle component based changes\n when.valueOf(this._activePlaceVisitModel).changes((next, previous) => {\n this.pushVisitChangesToRoute(next, previous);\n }, {\n unless: this.placeRouter.navigationInProgress\n });\n\n chain(this._activePlace)\n .postponeWhile(placeRouter.navigationInProgress)\n .subscribe(place => this.placeChanged.emit(place));\n\n }\n\n ngOnInit() {\n }\n\n // @Trace()\n getAnimationOrder() {\n return this.placeAnimationOrder.value;\n }\n\n get animationDuration() {\n return this.placeConfig && this.placeConfig.animationDuration ? this.placeConfig.animationDuration : '500ms';\n }\n\n // @Trace()\n navigate(visit: Visit) {\n // console.log({ activatedRoute: this._activatedRouteModel.value });\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 // @Trace()\n pushRouteChangesToVisit() {\n const visit = this.routerVisit.value;\n // console.log({\n // visit,\n // place: visit ? visit.placeDefinition.component : null,\n // inOutletActivation: this._inOutletActivation.value,\n // inRoutingSession: this.placeRouter.navigationSessionActive.value\n // });\n if (visit) { // can be null while the place and index sync up\n this._inRouteVisitUpdate.whileTrue(() => {\n this._activePlaceVisitModel.value = visit;\n });\n }\n }\n\n pushVisitChangesToRoute(next: Visit, previous: Visit) {\n const activatedRoute = this._activatedRouteModel.value;\n this.placeRouter.pushVisitChangesToRoute(activatedRoute, previous, next);\n }\n\n get activePlaceModel(): ValueModel<PlaceComponent> {\n return this._activePlace.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._inOutletActivation.whileTrue(() => {\n try {\n this._activePlace.value = place;\n this._activatedRouteModel.value = routerOutlet.activatedRoute;\n this._placeDefinition.value = place.placeDefinition;\n const visitModel = new MutableValueModel<Visit>();\n DebugContext.tag(visitModel, \"PlaceOutletCompeont.visitModel\");\n this._activePlaceVisitModel.setDelegate(visitModel);\n place.initialiseVisit(visitModel);\n } catch (error) {\n console.error(error);\n }\n });\n if (!this.animateModel.value) {\n // we're not animating so trigger any post animation callbacks now.\n this.animationDone();\n }\n }\n\n // @Trace()\n onOutletDeactivated() {\n this._inOutletDeactivation.whileTrue(() => {\n this._activePlace.value = null;\n this._activatedRouteModel.value = null;\n this._placeDefinition.value = null;\n this._activePlaceVisitModel.setDelegate(null);\n });\n }\n\n // @Trace()\n animationStarted() {\n // console.log({ activePlace: this._activePlace.value });\n }\n\n // @Trace()\n animationDone() {\n if (this._activePlace.value) {\n this._activePlace.value.onPlaceReady();\n }\n }\n\n\n}\n"]}
|
|
1
|
+
{"version":3,"file":"place-outlet.component.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/place/components/place-outlet/place-outlet.component.ts"],"names":[],"mappings":";;;;;AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAU,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACtH,OAAO,EAAkB,MAAM,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAEL,YAAY,EACZ,GAAG,EACH,IAAI,EACJ,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,UAAU,EAEX,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAE/E,OAAO,EAAE,gBAAgB,EAAe,MAAM,oBAAoB,CAAC;AAEnE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGjD,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;;;;AAGhE,uBAMC;;;IALC,mCAAyC;;;;;IAEzC,6DAAmD;;;;IAEnD,kDAAqB;;AASvB,MAAM,OAAO,oBAAqB,SAAQ,mBAAmB;;;;;;;IAoC3D,YAA6B,MAAc,EACd,WAAwB,EACM,WAAwB,EAC/C,YAAkC;QACpE,KAAK,EAAE,CAAC;QAJmB,WAAM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,8DACyE;;IAGzE,yDAC2D;;IAE3D,4CAC2D;;IAE3D,yCACwB;;;;;IAGxB,+CAAuD;;;;;IACvD,oDAAgF;;;;;IAChF,iDAA6E;;;;;IAC7E,sDAA0E;;;;;IAE1E,iDAAmE;;IACnE,mDAA6D;;;;;IAE7D,iDAAyC;;;;;IACzC,gDAAiD;;;;;IACjD,sDAAuE;;;;;IACvE,oDAAuD;;;;;IAE3C,sCAA+B;;;;;IAC/B,2CAAyC;;IACzC,2CAAuE","sourcesContent":["import { Component, EventEmitter, Inject, Input, OnInit, Optional, Output, SkipSelf, ViewChild } from '@angular/core';\nimport { ActivatedRoute, Router, RouterOutlet } from '@angular/router';\nimport {\n Constructable,\n DebugContext,\n Dsl,\n lang,\n ListModel,\n MutableValueModel,\n StoreInListModel,\n StoreInValueModel,\n UseDelegate,\n ValueModel,\n ValueModelChain\n} from '@coolon/pectin';\nimport * as _ from 'lodash';\nimport { DisposableComponent } from '../../../components/disposable-component';\nimport { PlaceComponent } from '../../place-component';\nimport { AUP_PLACE_CONFIG, PlaceConfig } from '../../place-config';\nimport { PlaceDefinition } from '../../place-definition';\nimport { PlaceRouter } from '../../place-router';\n\nimport { Visit } from '../../visit';\nimport { LEFT_RIGHT_PLACE_ANIMATION } from './route-animations';\n\n// Quick hack to avoid circular references between this and PlaceComponents.\ninterface PlaceRef {\n readonly placeDefinition: PlaceDefinition\n\n initialiseBindings(param: ValueModel<Visit>): void;\n\n onPlaceReady(): void;\n}\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() @UseDelegate({ defaultValue: true })\n animateModel: ValueModel<boolean>;\n\n // tslint:disable-next-line:no-input-rename\n @Input('placeAnimationOrderModel') @UseDelegate()\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\n private outletActivated = new MutableValueModel(false);\n private readonly _activatedRouteModel = new MutableValueModel<ActivatedRoute>();\n private readonly _activePlaceModel = new MutableValueModel<PlaceComponent>();\n private readonly _activePlaceDefinition: ValueModelChain<PlaceDefinition>;\n\n private parentOutletModel: MutableValueModel<PlaceOutletComponent>;\n public readonly placeAnimationOrder: 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 constructor(private readonly router: Router,\n private readonly placeRouter: PlaceRouter,\n @Optional() @Inject(AUP_PLACE_CONFIG) readonly placeConfig: PlaceConfig,\n @SkipSelf() @Optional() parentOutlet: PlaceOutletComponent) {\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 this.placeAnimationOrder = chain(this.customPlaceAnimationOrderModel)\n .otherwise(defaultPlaceAnimationOrder)\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 // Extract our visit model from the place router.\n this._activePlaceDefinition = chain(this._activePlaceModel).pluck('placeDefinition');\n this.routerVisitModel = this._activePlaceDefinition.findIn(chain(placeRouter.activeVisitsByPlaceDefinition));\n\n this.navigationInProgress = chain(this.placeRouter.navigationInProgress);\n when.valueOf(this.navigationInProgress).becomesFalsey(() => {\n this.checkStateAndInitialise();\n });\n when.valueOf(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 }\n\n // @Trace()\n ngOnInit() {\n }\n\n // @Trace()\n getAnimationOrder() {\n return this.placeAnimationOrder.value;\n }\n\n get animationDuration() {\n return this.placeConfig && this.placeConfig.animationDuration ? this.placeConfig.animationDuration : '500ms';\n }\n\n // @Trace()\n navigate(visit: Visit) {\n // console.log({ activatedRoute: this._activatedRouteModel.value });\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.outletActivated.value = true;\n this.checkStateAndInitialise();\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 }\n }\n\n // @Trace()\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 this.pushVisitChangeToRoute(previous, current);\n });\n if (!this.animateModel.value) {\n // we're not animating so trigger any post animation callbacks now.\n this.animationDone();\n }\n const { when, chain, valueOf } = Dsl.disposeWith(activePlace);\n when.valueOf(this.routerVisitModel)\n .changes(visit => {\n activePlace.updateVisit(visit);\n }, {\n unless: valueOf.any(\n this._isPushingVisitToRoute,\n this.routerVisitModel.isNil()\n ).areTruthy()\n });\n }\n\n private pushVisitChangeToRoute(previous: Visit, current: Visit) {\n this._isPushingVisitToRoute.value = true;\n this.placeRouter.pushVisitChangesToRoute(previous, current).finally(() => {\n this._isPushingVisitToRoute.value = false;\n });\n }\n\n// @Trace()\n animationStarted() {\n // console.log({ activePlace: this._activePlaceModel.value });\n }\n\n // @Trace()\n animationDone() {\n if (this._activePlaceModel.value) {\n this._activePlaceModel.value.onPlaceReady();\n }\n }\n\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"PlaceOutletComponent":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../../../components/disposable-component","name":"DisposableComponent","line":
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"PlaceOutletComponent":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../../../components/disposable-component","name":"DisposableComponent","line":40,"character":42},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":34,"character":1},"arguments":[{"selector":"aup-place-outlet","animations":[{"__symbolic":"reference","module":"./route-animations","name":"LEFT_RIGHT_PLACE_ANIMATION","line":38,"character":15}],"template":"<ng-container *ngIf=\"animateModel.value\">\n <div class=\"router-outlet-container\"\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=\"!animateModel.value\">\n <div class=\"router-outlet-container\">\n <router-outlet #routerOutlet=\"outlet\"\n (activate)=\"onOutletActivated(routerOutlet, $event)\"\n (deactivate)=\"onOutletDeactivated()\">\n </router-outlet>\n </div>\n</ng-container>\n\n","styles":[":host{display:flex;flex-direction:column;min-height:0;overflow-x:hidden}.router-outlet-container{flex:1;display:block;position:relative;min-height:0}router-outlet{display:none}"]}]}],"members":{"animate":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":42,"character":3}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@coolon/pectin","name":"StoreInValueModel","line":42,"character":12},"arguments":["animateModel"]}]}],"animateModel":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":45,"character":3}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@coolon/pectin","name":"UseDelegate","line":45,"character":12},"arguments":[{"defaultValue":true}]}]}],"customPlaceAnimationOrderModel":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":49,"character":3},"arguments":["placeAnimationOrderModel"]},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@coolon/pectin","name":"UseDelegate","line":49,"character":38}}]}],"customPlaceAnimationOrder":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":53,"character":3},"arguments":["placeAnimationOrder"]},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@coolon/pectin","name":"StoreInListModel","line":53,"character":33},"arguments":["customPlaceAnimationOrderModel"]}]}],"placeChanged":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":56,"character":3}}]}],"routerOut":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":59,"character":3},"arguments":["routeOutlet",{"static":true}]}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[null,null,[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":78,"character":15}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":78,"character":27},"arguments":[{"__symbolic":"reference","module":"../../place-config","name":"AUP_PLACE_CONFIG","line":78,"character":34}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"SkipSelf","line":79,"character":15}},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":79,"character":27}}]],"parameters":[{"__symbolic":"reference","module":"@angular/router","name":"Router","line":76,"character":39},{"__symbolic":"reference","module":"../../place-router","name":"PlaceRouter","line":77,"character":44},{"__symbolic":"reference","module":"../../place-config","name":"PlaceConfig","line":78,"character":74},{"__symbolic":"reference","name":"PlaceOutletComponent"}]}],"ngOnInit":[{"__symbolic":"method"}],"getAnimationOrder":[{"__symbolic":"method"}],"navigate":[{"__symbolic":"method"}],"onOutletActivated":[{"__symbolic":"method"}],"onOutletDeactivated":[{"__symbolic":"method"}],"checkStateAndInitialise":[{"__symbolic":"method"}],"initialisePlace":[{"__symbolic":"method"}],"pushVisitChangeToRoute":[{"__symbolic":"method"}],"animationStarted":[{"__symbolic":"method"}],"animationDone":[{"__symbolic":"method"}]}}}}]
|
package/esm2015/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.js
CHANGED
|
@@ -3,10 +3,14 @@
|
|
|
3
3
|
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
4
4
|
*/
|
|
5
5
|
import { Component } from '@angular/core';
|
|
6
|
+
import { PlaceRouter } from '../../place-router';
|
|
6
7
|
import { AbstractPlaceNavigationComponent } from '../abstract-place-navigation.component';
|
|
7
8
|
export class TabbedPlaceNavigationComponent extends AbstractPlaceNavigationComponent {
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* @param {?} placeRouter
|
|
11
|
+
*/
|
|
12
|
+
constructor(placeRouter) {
|
|
13
|
+
super(placeRouter);
|
|
10
14
|
}
|
|
11
15
|
}
|
|
12
16
|
TabbedPlaceNavigationComponent.decorators = [
|
|
@@ -17,5 +21,7 @@ TabbedPlaceNavigationComponent.decorators = [
|
|
|
17
21
|
}] }
|
|
18
22
|
];
|
|
19
23
|
/** @nocollapse */
|
|
20
|
-
TabbedPlaceNavigationComponent.ctorParameters = () => [
|
|
24
|
+
TabbedPlaceNavigationComponent.ctorParameters = () => [
|
|
25
|
+
{ type: PlaceRouter }
|
|
26
|
+
];
|
|
21
27
|
//# sourceMappingURL=tabbed-place-navigation.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabbed-place-navigation.component.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.ts"],"names":[],"mappings":";;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,gCAAgC,EAAE,MAAM,wCAAwC,CAAC;AAO1F,MAAM,OAAO,8BAA+B,SAAQ,gCAAgC
|
|
1
|
+
{"version":3,"file":"tabbed-place-navigation.component.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.ts"],"names":[],"mappings":";;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,gCAAgC,EAAE,MAAM,wCAAwC,CAAC;AAO1F,MAAM,OAAO,8BAA+B,SAAQ,gCAAgC;;;;IAClF,YAAY,WAAuB;QACjC,KAAK,CAAC,WAAW,CAAC,CAAC;IACrB,CAAC;;;YARF,SAAS,SAAC;gBACT,QAAQ,EAAE,6BAA6B;gBACvC,mcAAuD;;aAExD;;;;YAPQ,WAAW","sourcesContent":["import { Component } from '@angular/core';\nimport { PlaceRouter } from '../../place-router';\nimport { AbstractPlaceNavigationComponent } from '../abstract-place-navigation.component';\n\n@Component({\n selector: 'aup-tabbed-place-navigation',\n templateUrl: './tabbed-place-navigation.component.html',\n styleUrls: ['./tabbed-place-navigation.component.scss']\n})\nexport class TabbedPlaceNavigationComponent extends AbstractPlaceNavigationComponent {\n constructor(placeRouter:PlaceRouter) {\n super(placeRouter);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"TabbedPlaceNavigationComponent":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../abstract-place-navigation.component","name":"AbstractPlaceNavigationComponent","line":
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"TabbedPlaceNavigationComponent":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../abstract-place-navigation.component","name":"AbstractPlaceNavigationComponent","line":9,"character":52},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":4,"character":1},"arguments":[{"selector":"aup-tabbed-place-navigation","template":"<nav mat-tab-nav-bar>\n <a mat-tab-link *ngFor=\"let placeDefinition of placeDefinitions.value\"\n [pectinCommand]=\"commandFactory.create(placeDefinition)\"\n [active]=\"isActive(placeDefinition)\"\n [matTooltip]=\"getNav(placeDefinition).tooltip()\">\n <mat-icon *ngIf=\"getNav(placeDefinition).icon()\">{{getNav(placeDefinition).icon()}}</mat-icon>\n <span>{{getNav(placeDefinition).title()}}</span>\n </a>\n</nav>\n","styles":[""]}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"../../place-router","name":"PlaceRouter","line":10,"character":26}]}]}}}}]
|
|
@@ -16,15 +16,15 @@ import { ConsolidatedParameterMap } from './consolidated-param-map';
|
|
|
16
16
|
export class PlaceGuard {
|
|
17
17
|
/**
|
|
18
18
|
* @param {?} router
|
|
19
|
-
* @param {?}
|
|
19
|
+
* @param {?} urlService
|
|
20
20
|
* @param {?} placeRouter
|
|
21
21
|
* @param {?} placeHistory
|
|
22
22
|
* @param {?} interactionService
|
|
23
23
|
* @param {?} injector
|
|
24
24
|
*/
|
|
25
|
-
constructor(router,
|
|
25
|
+
constructor(router, urlService, placeRouter, placeHistory, interactionService, injector) {
|
|
26
26
|
this.router = router;
|
|
27
|
-
this.
|
|
27
|
+
this.urlService = urlService;
|
|
28
28
|
this.placeRouter = placeRouter;
|
|
29
29
|
this.placeHistory = placeHistory;
|
|
30
30
|
this.interactionService = interactionService;
|
|
@@ -56,18 +56,18 @@ export class PlaceGuard {
|
|
|
56
56
|
/** @type {?} */
|
|
57
57
|
const parsedParams = placeDefinition.parseRouteParams(params);
|
|
58
58
|
/** @type {?} */
|
|
59
|
-
const initialVisit = this.placeRouter.
|
|
59
|
+
const initialVisit = this.placeRouter.navigationSession.getVisitFor(placeDefinition) || new Visit(placeDefinition, parsedParams);
|
|
60
60
|
/** @type {?} */
|
|
61
61
|
const sanitiser = new VisitSanitiser(activatedRoute, this.router, this.placeHistory, this.injector);
|
|
62
62
|
/** @type {?} */
|
|
63
63
|
const sanitisedVisit = yield sanitiser.sanitise(initialVisit.mergeRouteParameters(parsedParams));
|
|
64
64
|
// Save the visit with any updated parameters. We need to save it so we remember any non route parameters
|
|
65
|
-
this.placeRouter.
|
|
65
|
+
this.placeRouter.navigationSession.storeVisit(sanitisedVisit);
|
|
66
66
|
if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {
|
|
67
67
|
// Regenerate the url
|
|
68
68
|
/** @type {?} */
|
|
69
|
-
const urlSnapshot = this.
|
|
70
|
-
console.log('##### Place Guard Redirect', urlSnapshot);
|
|
69
|
+
const urlSnapshot = this.urlService.parseUrl(state.url).updateVisitSegments(sanitisedVisit);
|
|
70
|
+
// console.log('##### Place Guard Redirect', urlSnapshot);
|
|
71
71
|
return urlSnapshot;
|
|
72
72
|
}
|
|
73
73
|
else {
|
|
@@ -89,14 +89,15 @@ export class PlaceGuard {
|
|
|
89
89
|
canDeactivate(component, currentRoute, currentState, nextState) {
|
|
90
90
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
91
91
|
/** @type {?} */
|
|
92
|
-
const currentUrl = this.
|
|
92
|
+
const currentUrl = this.urlService.parseUrl(currentState.url);
|
|
93
93
|
/** @type {?} */
|
|
94
|
-
const nextUrl = this.
|
|
94
|
+
const nextUrl = this.urlService.parseUrl(nextState.url);
|
|
95
95
|
/** @type {?} */
|
|
96
|
-
const result = yield this.placeRouter.
|
|
96
|
+
const result = yield this.placeRouter.navigationSession.canDeactivatePlace(component, currentUrl, nextUrl);
|
|
97
97
|
return this.handleGuardResult(result);
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
|
+
// @Trace()
|
|
100
101
|
/**
|
|
101
102
|
* @private
|
|
102
103
|
* @param {?} result
|
|
@@ -162,8 +163,8 @@ export class PlaceGuard {
|
|
|
162
163
|
cleanInteractionState(route, state, then) {
|
|
163
164
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
164
165
|
/** @type {?} */
|
|
165
|
-
const url = this.
|
|
166
|
-
if (!this.interactionService.isActive() && url.
|
|
166
|
+
const url = this.urlService.parseUrl(state.url);
|
|
167
|
+
if (!this.interactionService.isActive() && url.hasInteractions()) {
|
|
167
168
|
// This happens if we reload the page or the url was pasted as the route should only be activated
|
|
168
169
|
// after the interaction context has become active.
|
|
169
170
|
return url.removeInteractionIds();
|
|
@@ -184,7 +185,7 @@ if (false) {
|
|
|
184
185
|
* @type {?}
|
|
185
186
|
* @private
|
|
186
187
|
*/
|
|
187
|
-
PlaceGuard.prototype.
|
|
188
|
+
PlaceGuard.prototype.urlService;
|
|
188
189
|
/**
|
|
189
190
|
* @type {?}
|
|
190
191
|
* @private
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"place.guard.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/place/guards/place.guard.ts"],"names":[],"mappings":";;;;;AAUA,OAAO,EAAE,IAAI,EAAS,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAIpD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"place.guard.js","sourceRoot":"ng://@coolon/angular-ui-powerups/","sources":["lib/place/guards/place.guard.ts"],"names":[],"mappings":";;;;;AAUA,OAAO,EAAE,IAAI,EAAS,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAIpD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;;;;AAGpE,MAAM,OAAgB,UAAU;;;;;;;;;IAG9B,YAA6B,MAAc,EACvB,UAAsB,EACb,WAAwB,EACxB,YAA0B,EAC1B,kBAAsC,EACtC,QAAkB;QALlB,WAAM,GAAN,MAAM,CAAQ;QACvB,eAAU,GAAV,UAAU,CAAY;QACb,gBAAW,GAAX,WAAW,CAAa;QACxB,iBAAY,GAAZ,YAAY,CAAc;QAC1B,uBA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;iBAAM;gBACL,OAAO,IAAI,CAAC,YAAY,CAAC,+DAA+D,cAAc,CAAC,SAAS,EAAE,CAAC,CAAC;aACrH;QACH,CAAC;KAAA;;;;;;;IAGK,YAAY,CAAC,cAAsC,EAAE,KAA0B;;;kBAC7E,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,WAAW,CAAC,cAAc,EAAE,KAAK,CAAC;YACtF,OAAO,CAAC,UAAU,YAAY,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;QAClF,CAAC;KAAA;;;;;;;;IAKK,qBAAqB,CAAC,KAA6B,EAAE,KAA0B,EAAE,IAA0C;;;kBACzH,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC;YAC/C,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,QAAQ,EAAE,IAAI,GAAG,CAAC,eAAe,EAAE,EAAE;gBAChE,iGAAiG;gBACjG,mDAAmD;gBACnD,OAAO,GAAG,CAAC,oBAAoB,EAAE,CAAC;aACnC;iBAAM;gBACL,OAAO,IAAI,EAAE,CAAC;aACf;QACH,CAAC;KAAA;CAEF;;;;;;IA9Fa,4BAA+B;;;;;IAC/B,gCAA8B;;;;;IAC9B,iCAAyC;;;;;IACzC,kCAA2C;;;;;IAC3C,wCAAuD;;;;;IACvD,8BAAmC;;;;;;IA2E/C,4DAAuD","sourcesContent":["import { Injector } from '@angular/core';\nimport {\n ActivatedRouteSnapshot,\n CanActivate,\n CanDeactivate,\n Router,\n RouterStateSnapshot,\n UrlSerializer,\n UrlTree\n} from '@angular/router';\nimport { lang, Trace } from '@coolon/pectin';\nimport { Observable } from 'rxjs';\nimport { InteractionService } from '../../interaction/services/interaction.service';\nimport { PlaceComponent } from '../place-component';\nimport { PlaceDefinition } from '../place-definition';\nimport { PlaceHistory } from '../place-history';\nimport { PlaceRouter } from '../place-router';\nimport { VisitSanitiser } from '../route/visit-sanitiser';\nimport { UrlService } from '../url-service';\nimport { UrlSnapshot } from '../url-snapshot';\nimport { Visit } from '../visit';\nimport { ConsolidatedParameterMap } from './consolidated-param-map';\n\n\nexport abstract class PlaceGuard implements CanActivate, CanDeactivate<PlaceComponent> {\n\n\n constructor(private readonly router: Router,\n private urlService: UrlService,\n private readonly placeRouter: PlaceRouter,\n private readonly placeHistory: PlaceHistory,\n private readonly interactionService: InteractionService,\n private readonly injector: Injector) {\n }\n\n // @Trace()\n async canActivate(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean | UrlTree> {\n\n // TODO: this is ugly now that I'm return UrlSnapshots and not UrlTrees. It'd be better if the functions\n // weren't nested or if I implemented a handler chain.\n return this.authorisePlaceThen(activatedRoute, state, async (placeDefinition) => {\n\n const result = await this.cleanInteractionState(activatedRoute, state, async () => {\n // Parse our route params.\n const params = new ConsolidatedParameterMap(activatedRoute.paramMap, activatedRoute.url);\n const parsedParams = placeDefinition.parseRouteParams(params);\n\n const initialVisit = this.placeRouter.navigationSession.getVisitFor(placeDefinition) || new Visit(placeDefinition, parsedParams);\n const sanitiser = new VisitSanitiser(activatedRoute, this.router, this.placeHistory, this.injector);\n const sanitisedVisit = await sanitiser.sanitise(initialVisit.mergeRouteParameters(parsedParams));\n\n // Save the visit with any updated parameters. We need to save it so we remember any non route parameters\n this.placeRouter.navigationSession.storeVisit(sanitisedVisit);\n if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {\n // Regenerate the url\n const urlSnapshot = this.urlService.parseUrl(state.url).updateVisitSegments(sanitisedVisit);\n // console.log('##### Place Guard Redirect', urlSnapshot);\n return urlSnapshot;\n } else {\n return true;\n }\n });\n return this.handleGuardResult(result);\n\n });\n }\n\n // @Trace()\n async canDeactivate(component: PlaceComponent, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState?: RouterStateSnapshot): Promise<boolean | UrlTree> {\n const currentUrl = this.urlService.parseUrl(currentState.url);\n const nextUrl = this.urlService.parseUrl(nextState.url);\n const result = await this.placeRouter.navigationSession.canDeactivatePlace(component, currentUrl, nextUrl);\n return this.handleGuardResult(result);\n }\n\n // @Trace()\n private handleGuardResult(result) {\n if (result instanceof UrlSnapshot) {\n return result.urlTree;\n } else {\n return result;\n }\n }\n\n // @Trace()\n protected async authorisePlaceThen(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot, runPlaceGuards: (placeDefinition: PlaceDefinition) => Promise<boolean | UrlTree>) {\n if (PlaceComponent.isPlaceComponentConstructor(activatedRoute.component)) {\n const placeDefinition = PlaceComponent.getDefinition(activatedRoute.component);\n const authoriseResult = placeDefinition.authenticate ? await this.isAuthorised(activatedRoute, state) : true;\n if (authoriseResult === true) {\n // we're authorised, now run the place guards.\n return runPlaceGuards(placeDefinition);\n } else {\n console.log('not authorised result', authoriseResult);\n return authoriseResult;\n }\n } else {\n return lang.illegalState(`expected component to be an instance of PlaceComponent, got ${activatedRoute.component}`);\n }\n }\n\n // @Trace()\n async isAuthorised(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean | UrlTree> {\n const authorised = this.getAuthGuard(this.injector).canActivate(activatedRoute, state);\n return (authorised instanceof Observable) ? authorised.toPromise() : authorised;\n }\n\n abstract getAuthGuard(injector: Injector): CanActivate;\n\n // @Trace()\n async cleanInteractionState(route: ActivatedRouteSnapshot, state: RouterStateSnapshot, then: () => Promise<boolean | UrlSnapshot>): Promise<boolean | UrlSnapshot> {\n const url = this.urlService.parseUrl(state.url);\n if (!this.interactionService.isActive() && url.hasInteractions()) {\n // This happens if we reload the page or the url was pasted as the route should only be activated\n // after the interaction context has become active.\n return url.removeInteractionIds();\n } else {\n return then();\n }\n }\n\n}\n"]}
|