@coolon/angular-ui-powerups 3.7.0-alpha.0 → 3.7.0-alpha.10

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 (134) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/bundles/coolon-angular-ui-powerups.umd.js +423 -667
  3. package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
  4. package/bundles/coolon-angular-ui-powerups.umd.min.js +1 -1
  5. package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -1
  6. package/coolon-angular-ui-powerups.metadata.json +1 -1
  7. package/esm2015/lib/angular-ui-powerups.module.ngfactory.js.map +1 -1
  8. package/esm2015/lib/components/commands/command/command.component.js +15 -12
  9. package/esm2015/lib/components/commands/command/command.component.js.map +1 -1
  10. package/esm2015/lib/components/commands/command/command.component.metadata.json +1 -1
  11. package/esm2015/lib/components/commands/flex.component.js +2 -9
  12. package/esm2015/lib/components/commands/flex.component.js.map +1 -1
  13. package/esm2015/lib/components/commands/flex.component.metadata.json +1 -1
  14. package/esm2015/lib/components/commands/group/command-container.js +21 -0
  15. package/esm2015/lib/components/commands/group/command-container.js.map +1 -0
  16. package/esm2015/lib/components/commands/group/command-container.metadata.json +1 -0
  17. package/esm2015/lib/components/commands/group/popup-aware.component.js +26 -0
  18. package/esm2015/lib/components/commands/group/popup-aware.component.js.map +1 -0
  19. package/esm2015/lib/components/commands/group/popup-aware.component.metadata.json +1 -0
  20. package/esm2015/lib/components/commands/group/popup-container.js +3 -0
  21. package/esm2015/lib/components/commands/group/popup-container.js.map +1 -0
  22. package/esm2015/lib/components/commands/group/popup-container.metadata.json +1 -0
  23. package/esm2015/lib/components/commands/group/popup-menu/abstract-popup-menu.component.js +65 -0
  24. package/esm2015/lib/components/commands/group/popup-menu/abstract-popup-menu.component.js.map +1 -0
  25. package/esm2015/lib/components/commands/group/popup-menu/abstract-popup-menu.component.metadata.json +1 -0
  26. package/esm2015/lib/components/commands/group/popup-menu/abstract-popup-menu.component.ngfactory.js.map +1 -0
  27. package/esm2015/lib/components/commands/group/popup-menu/more-menu.component.js +47 -0
  28. package/esm2015/lib/components/commands/group/popup-menu/more-menu.component.js.map +1 -0
  29. package/esm2015/lib/components/commands/group/popup-menu/more-menu.component.metadata.json +1 -0
  30. package/esm2015/lib/components/commands/group/popup-menu/more-menu.component.ngfactory.js.map +1 -0
  31. package/esm2015/lib/components/commands/group/popup-menu/popup-menu-renderer/popup-menu-renderer.component.js +90 -0
  32. package/esm2015/lib/components/commands/group/popup-menu/popup-menu-renderer/popup-menu-renderer.component.js.map +1 -0
  33. package/esm2015/lib/components/commands/group/popup-menu/popup-menu-renderer/popup-menu-renderer.component.metadata.json +1 -0
  34. package/esm2015/lib/components/commands/group/popup-menu/popup-menu-renderer/popup-menu-renderer.component.ngfactory.js.map +1 -0
  35. package/esm2015/lib/components/commands/group/popup-menu/popup-menu.component.js +42 -0
  36. package/esm2015/lib/components/commands/group/popup-menu/popup-menu.component.js.map +1 -0
  37. package/esm2015/lib/components/commands/group/popup-menu/popup-menu.component.metadata.json +1 -0
  38. package/esm2015/lib/components/commands/group/popup-menu/popup-menu.component.ngfactory.js.map +1 -0
  39. package/esm2015/lib/components/commands/group/tool-bar/tool-bar.component.js +12 -15
  40. package/esm2015/lib/components/commands/group/tool-bar/tool-bar.component.js.map +1 -1
  41. package/esm2015/lib/components/commands/group/tool-bar/tool-bar.component.metadata.json +1 -1
  42. package/esm2015/lib/components/commands/group/tool-bar/tool-bar.component.scss.ngstyle.js.map +1 -0
  43. package/esm2015/lib/components/commands/separator.component.js +25 -14
  44. package/esm2015/lib/components/commands/separator.component.js.map +1 -1
  45. package/esm2015/lib/components/commands/separator.component.metadata.json +1 -1
  46. package/esm2015/lib/components/components.module.js +6 -9
  47. package/esm2015/lib/components/components.module.js.map +1 -1
  48. package/esm2015/lib/components/components.module.metadata.json +1 -1
  49. package/esm2015/lib/components/components.module.ngfactory.js.map +1 -1
  50. package/esm2015/lib/components/exports.js +7 -8
  51. package/esm2015/lib/components/exports.js.map +1 -1
  52. package/esm2015/lib/components/exports.metadata.json +1 -1
  53. package/esm2015/lib/interaction/interaction.module.ngfactory.js.map +1 -1
  54. package/esm2015/lib/place/components/place-outlet/place-outlet.component.js +12 -1
  55. package/esm2015/lib/place/components/place-outlet/place-outlet.component.js.map +1 -1
  56. package/esm2015/lib/place/components/place-outlet/place-outlet.component.metadata.json +1 -1
  57. package/esm2015/lib/place/guards/place.guard.js +31 -41
  58. package/esm2015/lib/place/guards/place.guard.js.map +1 -1
  59. package/esm2015/lib/place/guards/place.guard.metadata.json +1 -1
  60. package/esm2015/lib/place/place-auth-service.js.map +1 -1
  61. package/esm2015/lib/place/place-auth-service.metadata.json +1 -1
  62. package/esm2015/lib/place/place.module.ngfactory.js.map +1 -1
  63. package/fesm2015/coolon-angular-ui-powerups.js +361 -562
  64. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  65. package/lib/components/commands/command/command.component.d.ts +7 -6
  66. package/lib/components/commands/flex.component.d.ts +1 -3
  67. package/lib/components/commands/group/command-container.d.ts +16 -0
  68. package/lib/components/commands/group/popup-aware.component.d.ts +12 -0
  69. package/lib/components/commands/group/popup-container.d.ts +6 -0
  70. package/lib/components/commands/group/popup-menu/abstract-popup-menu.component.d.ts +25 -0
  71. package/lib/components/commands/group/popup-menu/more-menu.component.d.ts +12 -0
  72. package/lib/components/commands/group/popup-menu/popup-menu-renderer/popup-menu-renderer.component.d.ts +33 -0
  73. package/lib/components/commands/group/popup-menu/popup-menu.component.d.ts +13 -0
  74. package/lib/components/commands/group/tool-bar/tool-bar.component.d.ts +4 -5
  75. package/lib/components/commands/separator.component.d.ts +8 -7
  76. package/lib/components/exports.d.ts +7 -8
  77. package/lib/place/components/place-outlet/place-outlet.component.d.ts +3 -1
  78. package/lib/place/guards/place.guard.d.ts +2 -1
  79. package/lib/place/place-auth-service.d.ts +4 -4
  80. package/package.json +2 -2
  81. package/schematics/place-routes/index.d.ts +1 -1
  82. package/schematics/place-routes/index.js +9 -14
  83. package/schematics/place-routes/index.js.map +1 -1
  84. package/schematics/place-routes/place-builder.d.ts +3 -5
  85. package/schematics/place-routes/place-builder.js +4 -23
  86. package/schematics/place-routes/place-builder.js.map +1 -1
  87. package/schematics/place-routes/place-class-scanner.d.ts +3 -2
  88. package/schematics/place-routes/place-class-scanner.js.map +1 -1
  89. package/schematics/place-routes/place-def.d.ts +3 -2
  90. package/schematics/place-routes/place-def.js.map +1 -1
  91. package/schematics/utils/build-context.js +1 -1
  92. package/schematics/utils/build-context.js.map +1 -1
  93. package/schematics/utils/schematic-tree-file-system.d.ts +3 -2
  94. package/schematics/utils/schematic-tree-file-system.js +11 -2
  95. package/schematics/utils/schematic-tree-file-system.js.map +1 -1
  96. package/esm2015/lib/components/commands/group/command-group/command-group.component.js +0 -43
  97. package/esm2015/lib/components/commands/group/command-group/command-group.component.js.map +0 -1
  98. package/esm2015/lib/components/commands/group/command-group/command-group.component.metadata.json +0 -1
  99. package/esm2015/lib/components/commands/group/command-group/command-group.component.ngfactory.js.map +0 -1
  100. package/esm2015/lib/components/commands/group/command-group-menu-renderer/command-group-menu-renderer.component.js +0 -46
  101. package/esm2015/lib/components/commands/group/command-group-menu-renderer/command-group-menu-renderer.component.js.map +0 -1
  102. package/esm2015/lib/components/commands/group/command-group-menu-renderer/command-group-menu-renderer.component.metadata.json +0 -1
  103. package/esm2015/lib/components/commands/group/command-group-menu-renderer/command-group-menu-renderer.component.ngfactory.js.map +0 -1
  104. package/esm2015/lib/components/commands/group/command-group-renderer/command-group-renderer.component.js +0 -39
  105. package/esm2015/lib/components/commands/group/command-group-renderer/command-group-renderer.component.js.map +0 -1
  106. package/esm2015/lib/components/commands/group/command-group-renderer/command-group-renderer.component.metadata.json +0 -1
  107. package/esm2015/lib/components/commands/group/command-group-renderer/command-group-renderer.component.ngfactory.js.map +0 -1
  108. package/esm2015/lib/components/commands/group/command-group-renderer/command-group-renderer.component.scss.shim.ngstyle.js.map +0 -1
  109. package/esm2015/lib/components/commands/group/command-group.js +0 -103
  110. package/esm2015/lib/components/commands/group/command-group.js.map +0 -1
  111. package/esm2015/lib/components/commands/group/command-group.metadata.json +0 -1
  112. package/esm2015/lib/components/commands/group/more-menu.component.js +0 -53
  113. package/esm2015/lib/components/commands/group/more-menu.component.js.map +0 -1
  114. package/esm2015/lib/components/commands/group/more-menu.component.metadata.json +0 -1
  115. package/esm2015/lib/components/commands/group/more-menu.component.ngfactory.js.map +0 -1
  116. package/esm2015/lib/components/commands/group/popup-menu.component.js +0 -52
  117. package/esm2015/lib/components/commands/group/popup-menu.component.js.map +0 -1
  118. package/esm2015/lib/components/commands/group/popup-menu.component.metadata.json +0 -1
  119. package/esm2015/lib/components/commands/group/popup-menu.component.ngfactory.js.map +0 -1
  120. package/esm2015/lib/components/commands/group/registration.js +0 -58
  121. package/esm2015/lib/components/commands/group/registration.js.map +0 -1
  122. package/esm2015/lib/components/commands/group/registration.metadata.json +0 -1
  123. package/esm2015/lib/components/commands/group/tool-bar/tool-bar.component.scss.shim.ngstyle.js.map +0 -1
  124. package/esm2015/lib/components/commands/group/view-data.js +0 -113
  125. package/esm2015/lib/components/commands/group/view-data.js.map +0 -1
  126. package/esm2015/lib/components/commands/group/view-data.metadata.json +0 -1
  127. package/lib/components/commands/group/command-group/command-group.component.d.ts +0 -12
  128. package/lib/components/commands/group/command-group-menu-renderer/command-group-menu-renderer.component.d.ts +0 -21
  129. package/lib/components/commands/group/command-group-renderer/command-group-renderer.component.d.ts +0 -13
  130. package/lib/components/commands/group/command-group.d.ts +0 -42
  131. package/lib/components/commands/group/more-menu.component.d.ts +0 -14
  132. package/lib/components/commands/group/popup-menu.component.d.ts +0 -17
  133. package/lib/components/commands/group/registration.d.ts +0 -32
  134. package/lib/components/commands/group/view-data.d.ts +0 -41
@@ -1,5 +1,5 @@
1
1
  import { DOCUMENT, CommonModule, Location } from '@angular/common';
2
- import { Directive, ElementRef, Inject, Host, Optional, Input, HostListener, NgZone, ɵɵdefineInjectable, ɵɵinject, Injectable, NgModule, Component, ContentChild, EventEmitter, SkipSelf, ViewChild, Output, ViewChildren, HostBinding, ViewEncapsulation, Self, TemplateRef, ChangeDetectorRef, ContentChildren, ViewContainerRef, InjectionToken, Injector, ComponentFactoryResolver, INJECTOR } from '@angular/core';
2
+ import { Directive, ElementRef, Inject, Host, Optional, Input, HostListener, NgZone, ɵɵdefineInjectable, ɵɵinject, Injectable, NgModule, Component, ContentChild, InjectionToken, ViewEncapsulation, HostBinding, ViewChildren, SkipSelf, EventEmitter, ViewChild, Output, Self, TemplateRef, ChangeDetectorRef, ContentChildren, ViewContainerRef, Injector, ComponentFactoryResolver, INJECTOR } from '@angular/core';
3
3
  import { FormsModule } from '@angular/forms';
4
4
  import { MatFormFieldModule } from '@angular/material/form-field';
5
5
  import { MatInputModule } from '@angular/material/input';
@@ -18,7 +18,7 @@ import { MatTableModule } from '@angular/material/table';
18
18
  import { MatTooltipModule } from '@angular/material/tooltip';
19
19
  import { FontAwesomeModule, FaIconLibrary } from '@fortawesome/angular-fontawesome';
20
20
  import { fas } from '@fortawesome/free-solid-svg-icons';
21
- import { GarbageCollector, DelegatingValueModel, assert, UnaryCommand, lang, Dsl, Logger, TrackExternal, Command, MutableValueModel, StoreInValueModel, ValueModel, MutableListModel, ListModel, StoreInListModel, FocusManager, EventListenerList, Form, Guard, Binding, DebugContext, MultipleSelectionModel, DirtyTrackingForm, DelegatingCommand, Deferred, Trace, Functions } from '@coolon/pectin';
21
+ import { GarbageCollector, DelegatingValueModel, assert, UnaryCommand, lang, Dsl, Logger, TrackExternal, Command, ValueModel, StoreInValueModel, MutableListModel, Disposable, DelegatingListModel, StoreInListModel, MutableValueModel, FocusManager, EventListenerList, Form, Guard, Binding, DebugContext, ListModel, MultipleSelectionModel, DirtyTrackingForm, DelegatingCommand, Deferred, Trace, Functions } from '@coolon/pectin';
22
22
  import { __decorate, __metadata, __awaiter } from 'tslib';
23
23
  import { Memoize } from '@typescript-plus/fast-memoize-decorator/dist/src';
24
24
  import _, { isNil, isEqual } from 'lodash';
@@ -27,7 +27,7 @@ import { assert as assert$1, Opts, lang as lang$1, Klass } from '@coolon/typescr
27
27
  import produce from 'immer';
28
28
  import { FlexModule, GridModule } from '@angular/flex-layout';
29
29
  import { MatDialogModule, MatDialog, MAT_DIALOG_DEFAULT_OPTIONS, MatDialogConfig } from '@angular/material/dialog';
30
- import { RouterModule, ActivatedRouteSnapshot, NavigationStart, NavigationCancel, UrlSegment, Router, UrlSerializer, NavigationEnd, NavigationError, RouterOutlet, RouterStateSnapshot } from '@angular/router';
30
+ import { RouterModule, ActivatedRouteSnapshot, NavigationStart, NavigationCancel, UrlSegment, Router, UrlSerializer, NavigationEnd, NavigationError, RouterOutlet } from '@angular/router';
31
31
  import { Overlay, CdkScrollable } from '@angular/cdk/overlay';
32
32
  import ResizeObserver from 'resize-observer-polyfill';
33
33
  import { MatListModule } from '@angular/material/list';
@@ -511,379 +511,363 @@ var TrackBy;
511
511
  TrackBy.byIndex = (data, index) => index;
512
512
  })(TrackBy || (TrackBy = {}));
513
513
 
514
- class ViewData {
515
- }
516
- (function (ViewData) {
517
- class FaceData extends ViewData {
518
- constructor(faces) {
519
- super();
520
- this.faces = faces;
521
- assert.notNil(faces);
522
- }
523
- get activeFaceAdapter() {
524
- return new CommandFace.Adapter(this.faces.length > 0 ? this.faces[0] : undefined);
514
+ class PopupAwareComponent extends DisposableComponent {
515
+ constructor(element, parent) {
516
+ super();
517
+ this.element = element;
518
+ this.parent = parent;
519
+ if (parent) {
520
+ this.registerDisposable(this.parent.register(this));
525
521
  }
526
522
  }
527
- __decorate([
528
- Memoize(),
529
- __metadata("design:type", CommandFace.Adapter),
530
- __metadata("design:paramtypes", [])
531
- ], FaceData.prototype, "activeFaceAdapter", null);
532
- ViewData.FaceData = FaceData;
533
- class GroupData extends FaceData {
534
- constructor(faces, xPosition, yPosition, children) {
535
- super(faces);
536
- this.xPosition = xPosition;
537
- this.yPosition = yPosition;
538
- this.children = children;
539
- }
540
- get hasMixedIcons() {
541
- const hasFaces = this.children.filter(c => ViewData.hasFace(c));
542
- const iconCount = hasFaces.filter(c => !!c.activeFaceAdapter.icon).length;
543
- return iconCount > 0 && hasFaces.length !== iconCount;
544
- }
523
+ get componentIndex() {
524
+ return this.computeComponentIndex();
545
525
  }
546
- __decorate([
547
- Memoize(),
548
- __metadata("design:type", Boolean),
549
- __metadata("design:paramtypes", [])
550
- ], GroupData.prototype, "hasMixedIcons", null);
551
- ViewData.GroupData = GroupData;
552
- class CommandData extends FaceData {
553
- constructor(command, faces) {
554
- super(faces);
555
- this.command = command;
526
+ computeComponentIndex() {
527
+ let node = this.element.nativeElement;
528
+ let index = 0;
529
+ while ((node = node.previousElementSibling)) {
530
+ index++;
556
531
  }
532
+ return index;
557
533
  }
558
- ViewData.CommandData = CommandData;
559
- class SeparatorData extends ViewData {
560
- }
561
- ViewData.SeparatorData = SeparatorData;
562
- class FlexData extends ViewData {
563
- }
564
- ViewData.FlexData = FlexData;
565
- function as(type, viewData) {
566
- return viewData instanceof type ? viewData : lang.illegalState(`expected instance of ${type.name}, got ${viewData.constructor.name}`);
567
- }
568
- ViewData.as = as;
569
- function getCommand(data) {
570
- return as(CommandData, data).command;
571
- }
572
- ViewData.getCommand = getCommand;
573
- function getTooltip(data) {
574
- return as(FaceData, data).activeFaceAdapter.tooltip;
575
- }
576
- ViewData.getTooltip = getTooltip;
577
- function getStyle(data) {
578
- return as(FaceData, data).activeFaceAdapter.style;
579
- }
580
- ViewData.getStyle = getStyle;
581
- function getColor(data) {
582
- return as(FaceData, data).activeFaceAdapter.color;
583
- }
584
- ViewData.getColor = getColor;
585
- function hasText(data) {
586
- return !!as(FaceData, data).activeFaceAdapter.text;
587
- }
588
- ViewData.hasText = hasText;
589
- function getFaces(data) {
590
- return as(FaceData, data).faces;
591
- }
592
- ViewData.getFaces = getFaces;
593
- function asGroup(viewData) {
594
- return as(GroupData, viewData);
595
- }
596
- ViewData.asGroup = asGroup;
597
- function hasMixedIcons(data) {
598
- return as(GroupData, data).hasMixedIcons;
599
- }
600
- ViewData.hasMixedIcons = hasMixedIcons;
601
- function isGroup(data) {
602
- return data instanceof GroupData;
603
- }
604
- ViewData.isGroup = isGroup;
605
- function hasFace(data) {
606
- return data instanceof FaceData;
534
+ getFace() {
535
+ return undefined;
607
536
  }
608
- ViewData.hasFace = hasFace;
609
- function isCommand(data) {
610
- return data instanceof CommandData;
537
+ }
538
+
539
+ const POPUP_CONTAINER = new InjectionToken('popup-component');
540
+
541
+ /**
542
+ *
543
+ */
544
+ class CommandComponent extends PopupAwareComponent {
545
+ constructor(element, parent) {
546
+ super(element, parent);
547
+ this.CommandFace = CommandFace;
548
+ const { chain, switchOn } = Dsl.disposeWith(this);
549
+ this.faces = chain(this.command.busy).mapToList(busy => {
550
+ return busy ?
551
+ [this.busyFaceModel.value, this.faceModel.value] :
552
+ [this.faceModel.value, this.busyFaceModel.value];
553
+ }, { allowNil: true, dependsOn: [this.faceModel, this.busyFaceModel] })
554
+ .rejectNil();
555
+ this.activeFace = this.faces.first();
556
+ this.buttonStyle = chain(this.activeFace).map(f => CommandFace.getStyleOf(f));
557
+ this.colorModel = chain(this.activeFace).map(f => CommandFace.getColorOf(f));
611
558
  }
612
- ViewData.isCommand = isCommand;
613
- function isSeparator(data) {
614
- return data instanceof SeparatorData;
559
+ isActive(face) {
560
+ return this.activeFace.query().equals(face);
615
561
  }
616
- ViewData.isSeparator = isSeparator;
617
- function isFlex(data) {
618
- return data instanceof FlexData;
562
+ ngOnInit() {
619
563
  }
620
- ViewData.isFlex = isFlex;
621
- })(ViewData || (ViewData = {}));
622
-
623
- class CommandGroupMenuRendererComponent extends DisposableComponent {
624
- constructor(parent) {
625
- super();
626
- this.parent = parent;
627
- this.groupViewDataModel = new MutableValueModel();
628
- this.commandFired = new EventEmitter();
629
- this.ViewData = ViewData;
630
- this.TrackBy = TrackBy;
631
- const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
632
- this.children = chain(this.groupViewDataModel).pluckList('children');
633
- this.hasMixedIcons = chain(this.groupViewDataModel).pluck('hasMixedIcons');
564
+ ngAfterViewInit() {
565
+ // console.log(this.element.nativeElement.previousSibling)
634
566
  }
635
- getCommand(data) {
636
- const command = ViewData.getCommand(data);
637
- const { when } = Dsl.disposeWith(this);
638
- when(command.busy).becomesFalsey(() => this.commandFired.emit());
639
- return command;
567
+ getFace() {
568
+ return this.face;
640
569
  }
641
570
  }
642
- CommandGroupMenuRendererComponent.decorators = [
571
+ CommandComponent.decorators = [
643
572
  { type: Component, args: [{
644
- selector: 'aup-command-group-menu',
645
- template: "<mat-menu #menu [xPosition]=\"groupViewData.xPosition\" [yPosition]=\"groupViewData.yPosition\">\n <ng-container *ngFor=\"let data of children.value; trackBy: TrackBy.byIndex\" >\n <button *ngIf=\"ViewData.isCommand(data)\"\n [pectinCommand]=\"getCommand(data)\"\n [matTooltip]=\"ViewData.getTooltip(data)\"\n mat-menu-item>\n <aup-command-face [faces]=\"ViewData.getFaces(data)\"\n [includeMissingIconInLayout]=\"hasMixedIcons.value\"></aup-command-face>\n </button>\n\n <ng-container *ngIf=\"ViewData.isGroup(data)\">\n <button mat-menu-item\n #trigger=\"matMenuTrigger\"\n [matMenuTriggerFor]=\"innerPanel.menuComponent\"\n >\n <aup-command-face [faces]=\"ViewData.getFaces(data)\"\n [includeMissingIconInLayout]=\"hasMixedIcons.value\"></aup-command-face>\n </button>\n <aup-command-group-menu #innerPanel\n [groupViewData]=\"ViewData.asGroup(data)\"\n (commandFired)=\"trigger.closeMenu()\"></aup-command-group-menu>\n </ng-container>\n\n <mat-divider *ngIf=\"ViewData.isSeparator(data)\"></mat-divider>\n\n </ng-container>\n</mat-menu>\n"
573
+ selector: 'aup-command',
574
+ template: "<ng-container [ngSwitch]=\"buttonStyle.value\">\n <ng-container *ngSwitchCase=\"CommandFace.Style.STROKED\">\n <button mat-stroked-button [pectinCommand]=\"command\" [color]=\"colorModel.value\" [class.busy]=\"command.busy.value\">\n <aup-command-face class=\"centered\" [faces]=\"faces.value\"></aup-command-face>\n </button>\n </ng-container>\n <ng-container *ngSwitchCase=\"CommandFace.Style.RAISED\">\n <button mat-raised-button [pectinCommand]=\"command\" [color]=\"colorModel.value\" [class.busy]=\"command.busy.value\">\n <aup-command-face class=\"centered\" [faces]=\"faces.value\"></aup-command-face>\n </button>\n </ng-container>\n <ng-container *ngSwitchDefault>\n <button mat-button [pectinCommand]=\"command\" [color]=\"colorModel.value\" [class.busy]=\"command.busy.value\">\n <aup-command-face class=\"centered\" [faces]=\"faces.value\"></aup-command-face>\n </button>\n </ng-container>\n</ng-container>\n",
575
+ styles: [":host{display:inline-flex;flex-direction:row;justify-content:stretch}button{flex:1}"]
646
576
  },] }
647
577
  ];
648
- CommandGroupMenuRendererComponent.ctorParameters = () => [
649
- { type: CommandGroupMenuRendererComponent, decorators: [{ type: Optional }, { type: SkipSelf }] }
578
+ CommandComponent.ctorParameters = () => [
579
+ { type: ElementRef },
580
+ { type: undefined, decorators: [{ type: Inject, args: [POPUP_CONTAINER,] }, { type: Optional }] }
650
581
  ];
651
- CommandGroupMenuRendererComponent.propDecorators = {
652
- menuComponent: [{ type: ViewChild, args: ['menu', { static: true },] }],
653
- groupViewData: [{ type: Input }],
654
- commandFired: [{ type: Output }],
655
- triggers: [{ type: ViewChildren, args: [MatMenuTrigger,] }]
582
+ CommandComponent.propDecorators = {
583
+ command: [{ type: Input }],
584
+ faceModel: [{ type: Input }],
585
+ face: [{ type: Input }],
586
+ busyFaceModel: [{ type: Input }],
587
+ busyFace: [{ type: Input }]
656
588
  };
657
589
  __decorate([
658
- StoreInValueModel('groupViewDataModel'),
659
- __metadata("design:type", ViewData.GroupData)
660
- ], CommandGroupMenuRendererComponent.prototype, "groupViewData", void 0);
661
-
662
- class CommandGroupRendererComponent extends DisposableComponent {
663
- constructor() {
664
- super();
665
- this.renderRootNode = true;
666
- this.ViewData = ViewData;
667
- this.TrackBy = TrackBy;
668
- const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
669
- this.childViewDataModels = chain(this.groupViewDataModel)
670
- .pluckList('children');
671
- }
672
- }
673
- CommandGroupRendererComponent.decorators = [
674
- { type: Component, args: [{
675
- selector: 'aup-command-group-renderer',
676
- template: "<ng-template #groupTemplate let-group>\n\n <ng-container *ngIf=\"ViewData.hasText(group)\" [ngSwitch]=\"ViewData.getStyle(group)\">\n <ng-container *ngSwitchCase=\"'stroked'\">\n <button #trigger=\"matMenuTrigger\"\n [matMenuTriggerFor]=\"subMenu.menuComponent\"\n [matTooltip]=\"ViewData.getTooltip(group)\"\n [color]=\"ViewData.getColor(group)\"\n mat-stroked-button>\n <aup-command-face [faces]=\"ViewData.getFaces(group)\"></aup-command-face>\n </button>\n <aup-command-group-menu #subMenu [groupViewData]=\"group\" (commandFired)=\"trigger.closeMenu()\"></aup-command-group-menu>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'raised'\">\n <button #trigger=\"matMenuTrigger\"\n [matMenuTriggerFor]=\"subMenu.menuComponent\"\n\n [matTooltip]=\"ViewData.getTooltip(group)\"\n [color]=\"ViewData.getColor(group)\"\n mat-raised-button>\n <aup-command-face [faces]=\"ViewData.getFaces(group)\"></aup-command-face>\n </button>\n <aup-command-group-menu #subMenu [groupViewData]=\"group\" (commandFired)=\"trigger.closeMenu()\"></aup-command-group-menu>\n </ng-container>\n\n <ng-container *ngSwitchDefault>\n <button #trigger=\"matMenuTrigger\"\n [matMenuTriggerFor]=\"subMenu.menuComponent\"\n [matTooltip]=\"ViewData.getTooltip(group)\"\n [color]=\"ViewData.getColor(group)\"\n mat-button>\n <aup-command-face [faces]=\"ViewData.getFaces(group)\"></aup-command-face>\n </button>\n <aup-command-group-menu #subMenu [groupViewData]=\"group\" (commandFired)=\"trigger.closeMenu()\"></aup-command-group-menu>\n </ng-container>\n\n </ng-container>\n\n <ng-container *ngIf=\"!ViewData.hasText(group)\">\n <button #trigger=\"matMenuTrigger\"\n mat-icon-button\n [matMenuTriggerFor]=\"subMenu.menuComponent\"\n\n [matTooltip]=\"ViewData.getTooltip(group)\"\n [color]=\"ViewData.getColor(group)\"\n >\n <aup-command-face [faces]=\"ViewData.getFaces(group)\"></aup-command-face>\n </button>\n <aup-command-group-menu #subMenu [groupViewData]=\"group\" (commandFired)=\"trigger.closeMenu()\"></aup-command-group-menu>\n </ng-container>\n\n</ng-template>\n\n\n<ng-template #commandTemplate let-data>\n\n <ng-container *ngIf=\"ViewData.hasText(data)\" [ngSwitch]=\"ViewData.getStyle(data)\">\n <button *ngSwitchCase=\"'raised'\"\n [pectinCommand]=\"ViewData.getCommand(data)\"\n [matTooltip]=\"ViewData.getTooltip(data)\"\n [color]=\"ViewData.getColor(data)\"\n mat-raised-button>\n <aup-command-face [faces]=\"ViewData.getFaces(data)\"></aup-command-face>\n </button>\n <button *ngSwitchCase=\"'stroked'\"\n [pectinCommand]=\"ViewData.getCommand(data)\"\n [matTooltip]=\"ViewData.getTooltip(data)\"\n [color]=\"ViewData.getColor(data)\"\n mat-stroked-button>\n <aup-command-face [faces]=\"ViewData.getFaces(data)\"></aup-command-face>\n </button>\n <button *ngSwitchDefault\n [pectinCommand]=\"ViewData.getCommand(data)\"\n [matTooltip]=\"ViewData.getTooltip(data)\"\n [color]=\"ViewData.getColor(data)\"\n mat-button>\n <aup-command-face [faces]=\"ViewData.getFaces(data)\"></aup-command-face>\n </button>\n </ng-container>\n\n <button *ngIf=\"!ViewData.hasText(data)\"\n [pectinCommand]=\"ViewData.getCommand(data)\"\n [matTooltip]=\"ViewData.getTooltip(data)\"\n [color]=\"ViewData.getColor(data)\"\n mat-icon-button>\n <aup-command-face [faces]=\"ViewData.getFaces(data)\"></aup-command-face>\n </button>\n\n</ng-template>\n\n\n<ng-template *ngIf=\"renderRootNode\"\n [ngTemplateOutlet]=\"groupTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: groupViewDataModel.value }\">\n</ng-template>\n\n<ng-container *ngIf=\"!renderRootNode\">\n <ng-container *ngFor=\"let data of this.childViewDataModels.value; trackBy: TrackBy.byIndex\">\n <ng-template *ngIf=\"ViewData.isGroup(data)\"\n [ngTemplateOutlet]=\"groupTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: data }\">\n </ng-template>\n <ng-template *ngIf=\"ViewData.isCommand(data)\"\n [ngTemplateOutlet]=\"commandTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: data }\">\n </ng-template>\n\n <mat-divider *ngIf=\"ViewData.isSeparator(data)\" [vertical]=\"true\"></mat-divider>\n </ng-container>\n\n</ng-container>\n",
677
- styles: [":host{align-items:center;display:inline-flex;flex-direction:row}:host:not(.render-root) mat-divider{-ms-grid-row-align:stretch;align-self:stretch;margin:4px 0}:host:not(.render-root)>*+*{margin-left:8px}:host span.flex{flex:1}"]
678
- },] }
679
- ];
680
- CommandGroupRendererComponent.ctorParameters = () => [];
681
- CommandGroupRendererComponent.propDecorators = {
682
- groupViewDataModel: [{ type: Input }],
683
- groupViewData: [{ type: Input }],
684
- renderRootNode: [{ type: Input }, { type: HostBinding, args: ['class.render-root',] }]
685
- };
590
+ TrackExternal(),
591
+ __metadata("design:type", Command)
592
+ ], CommandComponent.prototype, "command", void 0);
593
+ __decorate([
594
+ TrackExternal(),
595
+ __metadata("design:type", ValueModel)
596
+ ], CommandComponent.prototype, "faceModel", void 0);
597
+ __decorate([
598
+ StoreInValueModel('faceModel'),
599
+ __metadata("design:type", Object)
600
+ ], CommandComponent.prototype, "face", void 0);
686
601
  __decorate([
687
602
  TrackExternal(),
688
603
  __metadata("design:type", ValueModel)
689
- ], CommandGroupRendererComponent.prototype, "groupViewDataModel", void 0);
604
+ ], CommandComponent.prototype, "busyFaceModel", void 0);
690
605
  __decorate([
691
- StoreInValueModel('groupViewDataModel'),
692
- __metadata("design:type", ViewData.GroupData)
693
- ], CommandGroupRendererComponent.prototype, "groupViewData", void 0);
606
+ StoreInValueModel('busyFaceModel'),
607
+ __metadata("design:type", Object)
608
+ ], CommandComponent.prototype, "busyFace", void 0);
694
609
 
695
- class Registration extends GarbageCollector {
696
- }
697
- (function (Registration) {
698
- class FaceRegistration extends Registration {
699
- constructor(faceListModel) {
700
- super();
701
- this.faceListModel = faceListModel;
702
- }
703
- }
704
- Registration.FaceRegistration = FaceRegistration;
705
- class CommandRegistration extends FaceRegistration {
706
- constructor(command, faceListModel) {
707
- super(faceListModel);
708
- this.command = command;
709
- }
710
- toTemplate() {
711
- return new ViewData.CommandData(this.command, this.faceListModel.value);
712
- }
713
- }
714
- Registration.CommandRegistration = CommandRegistration;
715
- class GroupRegistration extends FaceRegistration {
716
- constructor(faceModel, group) {
717
- super(faceModel);
718
- this.group = group;
719
- }
720
- toTemplate() {
721
- return new ViewData.GroupData(this.faceListModel.value, this.group.xPosition, this.group.yPosition, this.group.registrations.value.map(r => r.toTemplate()));
722
- }
610
+ class CommandContainer extends GarbageCollector {
611
+ constructor(parent) {
612
+ super();
613
+ this.parent = parent;
723
614
  }
724
- Registration.GroupRegistration = GroupRegistration;
725
- class SeparatorRegistration extends Registration {
726
- constructor() {
727
- super(...arguments);
728
- this.template = new ViewData.SeparatorData();
729
- }
730
- toTemplate() {
731
- return this.template;
732
- }
615
+ get depth() {
616
+ return this.hasParent() ? this.parent.depth + 1 : 0;
733
617
  }
734
- Registration.SeparatorRegistration = SeparatorRegistration;
735
- class FlexRegistration extends Registration {
736
- constructor() {
737
- super(...arguments);
738
- this.template = new ViewData.FlexData();
739
- }
740
- toTemplate() {
741
- return this.template;
742
- }
618
+ hasParent() {
619
+ return !!this.parent;
743
620
  }
744
- Registration.FlexRegistration = FlexRegistration;
745
- function hasFace(entry) {
746
- return entry instanceof CommandRegistration || entry instanceof GroupRegistration;
621
+ get orientation() {
622
+ return CommandContainer.Orientation.VERTICAL;
747
623
  }
748
- Registration.hasFace = hasFace;
749
- })(Registration || (Registration = {}));
624
+ }
625
+ (function (CommandContainer) {
626
+ CommandContainer.Orientation = Enum({ HORIZONTAL: 'horizontal', VERTICAL: 'vertical' });
627
+ })(CommandContainer || (CommandContainer = {}));
750
628
 
751
- class CommandGroup extends GarbageCollector {
752
- constructor(parent) {
629
+ /**
630
+ *
631
+ */
632
+ class ToolBarComponent extends CommandContainer {
633
+ constructor() {
753
634
  super();
754
- this.parent = parent;
755
- this._rootTemplate = new MutableValueModel();
756
- this._registrations = new MutableListModel();
757
- const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
758
- this.childTemplates = chain(this._rootTemplate).pluckList('children');
759
- this.initialised = chain(this._rootTemplate).isNotNil();
760
635
  }
761
- initialise() {
762
- this.rebuildTemplates();
636
+ get orientation() {
637
+ return CommandContainer.Orientation.HORIZONTAL;
763
638
  }
764
- get rootTemplate() {
765
- return this._rootTemplate.readonly;
766
- }
767
- get registrations() {
768
- return this._registrations.readonly;
639
+ // @Trace()
640
+ ngOnInit() {
769
641
  }
770
- notifyChanged() {
771
- if (this.parent) {
772
- this.parent.notifyChanged();
773
- }
774
- else {
775
- this.rebuildTemplates();
776
- }
642
+ // @Trace()
643
+ ngAfterContentInit() {
644
+ // this.group.initialise();
777
645
  }
778
- notifyChildFaceChanged(is, was) {
779
- this.notifyChanged();
646
+ // @Trace()
647
+ ngAfterViewInit() {
780
648
  }
781
- rebuildTemplates() {
782
- this._rootTemplate.value = new ViewData.GroupData(this.faceListModel.value, this.xPosition, this.yPosition, this.registrations.value.map(r => r.toTemplate()));
649
+ }
650
+ ToolBarComponent.decorators = [
651
+ { type: Component, args: [{
652
+ selector: 'aup-tool-bar',
653
+ template: '<div class="toolbar-content"><ng-content></ng-content></div>',
654
+ encapsulation: ViewEncapsulation.None,
655
+ styles: [":host{display:inline-block}.toolbar-content{align-items:center;display:inline-flex;flex-direction:row}.toolbar-content>aup-separator{-ms-grid-row-align:stretch;align-self:stretch;margin:4px 0 4px 8px}.toolbar-content>aup-flex{flex:1}.toolbar-content>*+*{margin-left:8px}"]
656
+ },] }
657
+ ];
658
+ ToolBarComponent.ctorParameters = () => [];
659
+
660
+ /**
661
+ *
662
+ */
663
+ class SeparatorComponent extends PopupAwareComponent {
664
+ constructor(element, popupContainer, containerParent) {
665
+ super(element, popupContainer);
666
+ this.containerParent = containerParent;
783
667
  }
784
- get depth() {
785
- return this.isRoot() ? 0 : this.parent.depth + 1;
668
+ isHorizontalContainer() {
669
+ return this.containerParent instanceof ToolBarComponent && this.containerParent.orientation === CommandContainer.Orientation.HORIZONTAL;
786
670
  }
787
- isRoot() {
788
- return false;
671
+ ngOnInit() {
789
672
  }
790
- registerCommand(command, faceListModel) {
791
- return this.register(new Registration.CommandRegistration(command, faceListModel));
673
+ }
674
+ SeparatorComponent.decorators = [
675
+ { type: Component, args: [{
676
+ selector: 'aup-separator',
677
+ template: `
678
+ <mat-divider [vertical]="!isHorizontalContainer()"></mat-divider>`,
679
+ styles: [`:host {
680
+ }`,
681
+ `:host(.horizontal-container) {
682
+ display: inline-flex;
683
+ flex-direction: row;
684
+ align-items: stretch;
685
+ }`]
686
+ },] }
687
+ ];
688
+ SeparatorComponent.ctorParameters = () => [
689
+ { type: ElementRef },
690
+ { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [POPUP_CONTAINER,] }] },
691
+ { type: CommandContainer, decorators: [{ type: Optional }] }
692
+ ];
693
+ SeparatorComponent.propDecorators = {
694
+ isHorizontalContainer: [{ type: HostBinding, args: ['class.horizontal-container',] }]
695
+ };
696
+
697
+ /**
698
+ *
699
+ */
700
+ class AbstractPopupMenuComponent extends PopupAwareComponent {
701
+ constructor(element, parent) {
702
+ super(element, parent);
703
+ this._unorderedChildren = new MutableListModel();
704
+ this.faceModelDelegate = new DelegatingValueModel();
705
+ this.xPosition = 'after';
706
+ this.yPosition = 'below';
707
+ const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
708
+ // group.faceListModel = chain(this.faceModel).mapToList(face => [face]);
709
+ this.faceAdapterModel = chain(this.faceModelDelegate).map(f => new CommandFace.Adapter(f));
710
+ this.children = chain(this._unorderedChildren).sortBy('componentIndex');
792
711
  }
793
- registerGroup(group, faceModel) {
794
- return this.register(new Registration.GroupRegistration(faceModel, group));
712
+ ngAfterContentChecked() {
713
+ // force the list to re-order as the child indicies may have changed.
714
+ this._unorderedChildren.value = [...this._unorderedChildren.value];
795
715
  }
796
- registerFlex(component) {
797
- return this.register(new Registration.FlexRegistration());
716
+ get faceAdapter() {
717
+ return this.faceAdapterModel.value;
798
718
  }
799
- registerSeparator(component) {
800
- return this.register(new Registration.SeparatorRegistration());
719
+ isRoot() {
720
+ return !this.parent;
801
721
  }
802
- register(registration) {
803
- this._registrations.push(registration);
804
- if (registration instanceof Registration.FaceRegistration) {
805
- const { when } = Dsl.disposeWith(registration);
806
- when(registration.faceListModel).changes((is, was) => {
807
- this.notifyChildFaceChanged(is, was);
808
- }, { asLongAs: this.initialised });
809
- }
810
- registration.onDispose(() => this._registrations.remove(registration));
811
- return registration;
722
+ // @Trace()
723
+ register(component) {
724
+ this._unorderedChildren.push(component);
725
+ return Disposable.disposableThatRuns(() => {
726
+ this._unorderedChildren.remove(component);
727
+ });
812
728
  }
813
- }
814
- (function (CommandGroup) {
815
- class Root extends CommandGroup {
816
- constructor() {
817
- super();
818
- }
819
- isRoot() {
820
- return true;
821
- }
729
+ onCommandFired() {
730
+ this.triggers.forEach(trigger => {
731
+ if (trigger.menuOpen) {
732
+ trigger.closeMenu();
733
+ }
734
+ });
822
735
  }
823
- __decorate([
824
- TrackExternal(),
825
- __metadata("design:type", ListModel)
826
- ], Root.prototype, "faceListModel", void 0);
827
- __decorate([
828
- TrackExternal({ defaultValue: 'after' }),
829
- __metadata("design:type", ValueModel)
830
- ], Root.prototype, "xPositionModel", void 0);
831
- __decorate([
832
- StoreInValueModel('xPositionModel'),
833
- __metadata("design:type", String)
834
- ], Root.prototype, "xPosition", void 0);
835
- __decorate([
836
- TrackExternal({ defaultValue: 'below' }),
837
- __metadata("design:type", ValueModel)
838
- ], Root.prototype, "yPositionModel", void 0);
839
- __decorate([
840
- StoreInValueModel('yPositionModel'),
841
- __metadata("design:type", String)
842
- ], Root.prototype, "yPosition", void 0);
843
- CommandGroup.Root = Root;
844
- function factory() {
845
- return new Root();
736
+ getFace() {
737
+ return this.faceAdapter.face;
846
738
  }
847
- CommandGroup.factory = factory;
848
- })(CommandGroup || (CommandGroup = {}));
739
+ }
740
+ AbstractPopupMenuComponent.decorators = [
741
+ { type: Component, args: [{
742
+ selector: 'aup-abstract-popup-menu',
743
+ template: ''
744
+ },] }
745
+ ];
746
+ AbstractPopupMenuComponent.ctorParameters = () => [
747
+ { type: ElementRef },
748
+ { type: undefined, decorators: [{ type: Inject, args: [POPUP_CONTAINER,] }] }
749
+ ];
750
+ AbstractPopupMenuComponent.propDecorators = {
751
+ xPosition: [{ type: Input }],
752
+ yPosition: [{ type: Input }],
753
+ triggers: [{ type: ViewChildren, args: [MatMenuTrigger,] }]
754
+ };
849
755
 
850
- class CommandGroupComponent extends CommandGroup {
851
- constructor(parent) {
852
- super(parent);
853
- this.parent = parent;
854
- this.xPosition = 'after';
855
- this.yPosition = 'below';
756
+ /**
757
+ *
758
+ */
759
+ class PopupMenuComponent extends AbstractPopupMenuComponent {
760
+ constructor(element, parent) {
761
+ super(element, parent);
856
762
  const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
857
- this.faceListModel = chain(this.faceModel).mapToList(v => [v]);
858
- this.parent.registerGroup(this, this.faceListModel);
763
+ // group.faceListModel = chain(this.faceModel).mapToList(face => [face]);
859
764
  }
860
765
  }
861
- CommandGroupComponent.decorators = [
766
+ PopupMenuComponent.decorators = [
862
767
  { type: Component, args: [{
863
- selector: 'aup-command-group',
864
- template: '',
768
+ selector: 'aup-popup-menu',
769
+ template: "<div class=\"content\" style=\"display: none\">\n <ng-content></ng-content>\n</div>\n<ng-container *ngIf=\"isRoot()\">\n <ng-container *ngIf=\"faceAdapter.text\" [ngSwitch]=\"faceAdapter.style\">\n <ng-container *ngSwitchCase=\"'stroked'\">\n <button matMenuTrigger\n [matMenuTriggerFor]=\"subMenu.menuComponent\"\n [matTooltip]=\"faceAdapter.tooltip\"\n [color]=\"faceAdapter.color\"\n mat-stroked-button>\n <aup-command-face [faces]=\"[face]\"></aup-command-face>\n </button>\n <aup-popup-menu-renderer #subMenu\n [parent]=\"this\"\n (commandFired)=\"onCommandFired()\"></aup-popup-menu-renderer>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'raised'\">\n <button matMenuTrigger\n [matMenuTriggerFor]=\"subMenu.menuComponent\"\n [matTooltip]=\"faceAdapter.tooltip\"\n [color]=\"faceAdapter.color\"\n mat-raised-button>\n <aup-command-face [faces]=\"[face]\"></aup-command-face>\n </button>\n <aup-popup-menu-renderer #subMenu\n [parent]=\"this\"\n (commandFired)=\"onCommandFired()\"></aup-popup-menu-renderer>\n </ng-container>\n\n <ng-container *ngSwitchDefault>\n <button matMenuTrigger\n [matMenuTriggerFor]=\"subMenu.menuComponent\"\n [matTooltip]=\"faceAdapter.tooltip\"\n [color]=\"faceAdapter.color\"\n mat-button>\n <aup-command-face [faces]=\"[face]\"></aup-command-face>\n </button>\n <aup-popup-menu-renderer #subMenu [parent]=\"this\" (commandFired)=\"onCommandFired()\"></aup-popup-menu-renderer>\n </ng-container>\n\n </ng-container>\n\n <ng-container *ngIf=\"!faceAdapter.text\">\n <button matMenuTrigger\n mat-icon-button\n [matMenuTriggerFor]=\"subMenu.menuComponent\"\n [matTooltip]=\"faceAdapter.tooltip\"\n [color]=\"faceAdapter.color\"\n >\n <aup-command-face [faces]=\"[face]\"></aup-command-face>\n </button>\n <aup-popup-menu-renderer #subMenu\n [parent]=\"this\"\n (commandFired)=\"onCommandFired()\"></aup-popup-menu-renderer>\n </ng-container>\n</ng-container>\n",
865
770
  providers: [
866
- { provide: CommandGroup, useExisting: CommandGroupComponent }
771
+ { provide: POPUP_CONTAINER, useExisting: PopupMenuComponent }
867
772
  ]
868
773
  },] }
869
774
  ];
870
- CommandGroupComponent.ctorParameters = () => [
871
- { type: CommandGroup, decorators: [{ type: SkipSelf }] }
775
+ PopupMenuComponent.ctorParameters = () => [
776
+ { type: ElementRef },
777
+ { type: undefined, decorators: [{ type: Inject, args: [POPUP_CONTAINER,] }, { type: Optional }, { type: SkipSelf }] }
872
778
  ];
873
- CommandGroupComponent.propDecorators = {
779
+ PopupMenuComponent.propDecorators = {
874
780
  faceModel: [{ type: Input }],
875
- face: [{ type: Input }],
876
- xPosition: [{ type: Input }],
877
- yPosition: [{ type: Input }]
781
+ face: [{ type: Input }]
878
782
  };
879
783
  __decorate([
880
- TrackExternal(),
784
+ TrackExternal({ delegateTo: 'faceModelDelegate' }),
881
785
  __metadata("design:type", ValueModel)
882
- ], CommandGroupComponent.prototype, "faceModel", void 0);
786
+ ], PopupMenuComponent.prototype, "faceModel", void 0);
883
787
  __decorate([
884
788
  StoreInValueModel('faceModel'),
885
789
  __metadata("design:type", Object)
886
- ], CommandGroupComponent.prototype, "face", void 0);
790
+ ], PopupMenuComponent.prototype, "face", void 0);
791
+
792
+ class PopupMenuRendererComponent extends DisposableComponent {
793
+ constructor() {
794
+ super();
795
+ this._childList = new DelegatingListModel();
796
+ this.commandFired = new EventEmitter();
797
+ this.TrackBy = TrackBy;
798
+ const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
799
+ // this.children = chain(this.groupViewDataModel).pluckList('children');
800
+ // this.hasMixedIcons = chain(this.groupViewDataModel).pluck('hasMixedIcons');
801
+ const faces = chain(this._childList).map(child => {
802
+ return child.getFace();
803
+ }).rejectNil();
804
+ const icons = faces.select(face => !!CommandFace.getIconOf(face));
805
+ const iconCount = icons.count();
806
+ const totalFaces = faces.count();
807
+ this.hasMixedIcons = valueOf.all(iconCount.isGreaterThan(0), totalFaces.doesNotEqual(iconCount)).areTruthy();
808
+ }
809
+ get parent() {
810
+ return this._parentComponent;
811
+ }
812
+ set parent(comp) {
813
+ this._parentComponent = comp;
814
+ this._childList.setDelegate(comp.children);
815
+ }
816
+ get children() {
817
+ return this.parent.children.value;
818
+ }
819
+ executeCommand(data) {
820
+ if (this.isCommand(data)) {
821
+ data.command.execute().finally(() => {
822
+ this.commandFired.emit();
823
+ });
824
+ }
825
+ }
826
+ isEnabled(data) {
827
+ return true; //ViewData.getCommand(data).enabled.value;
828
+ }
829
+ // @Trace()
830
+ onCommandFired() {
831
+ this.commandFired.emit();
832
+ this.triggers.forEach(trigger => {
833
+ if (trigger.menuOpen) {
834
+ trigger.closeMenu();
835
+ }
836
+ });
837
+ }
838
+ isCommand(child) {
839
+ return child instanceof CommandComponent;
840
+ }
841
+ isPopupMenu(child) {
842
+ return child instanceof AbstractPopupMenuComponent;
843
+ }
844
+ isSeparator(child) {
845
+ return child instanceof SeparatorComponent;
846
+ }
847
+ getTooltip(child) {
848
+ return this.isCommand(child) ? CommandFace.getTooltipOf(child.face) : undefined;
849
+ }
850
+ getFaces(child) {
851
+ return this.isCommand(child) ?
852
+ child.faces.value :
853
+ this.isPopupMenu(child) ?
854
+ [child.faceAdapter.face] :
855
+ undefined;
856
+ }
857
+ }
858
+ PopupMenuRendererComponent.decorators = [
859
+ { type: Component, args: [{
860
+ selector: 'aup-popup-menu-renderer',
861
+ template: "<mat-menu #menu [xPosition]=\"parent.xPosition\" [yPosition]=\"parent.yPosition\">\n <ng-template matMenuContent>\n <ng-container *ngFor=\"let child of children; trackBy: TrackBy.byIndex\" >\n <button *ngIf=\"isCommand(child)\"\n (click)=\"executeCommand(child)\"\n [disabled]=\"!isEnabled(child)\"\n [matTooltip]=\"getTooltip(child)\"\n mat-menu-item>\n <aup-command-face [faces]=\"getFaces(child)\"\n [includeMissingIconInLayout]=\"hasMixedIcons.value\"></aup-command-face>\n </button>\n\n <ng-container *ngIf=\"isPopupMenu(child)\">\n <button mat-menu-item\n matMenuTrigger\n [matMenuTriggerFor]=\"innerPanel.menuComponent\"\n >\n <aup-command-face [faces]=\"getFaces(child)\"\n [includeMissingIconInLayout]=\"hasMixedIcons.value\"></aup-command-face>\n </button>\n <aup-popup-menu-renderer #innerPanel\n [parent]=\"child\"\n (commandFired)=\"onCommandFired()\"></aup-popup-menu-renderer>\n </ng-container>\n\n <mat-divider *ngIf=\"isSeparator(child)\"></mat-divider>\n\n </ng-container>\n\n </ng-template>\n</mat-menu>\n"
862
+ },] }
863
+ ];
864
+ PopupMenuRendererComponent.ctorParameters = () => [];
865
+ PopupMenuRendererComponent.propDecorators = {
866
+ parent: [{ type: Input }],
867
+ menuComponent: [{ type: ViewChild, args: ['menu', { static: true },] }],
868
+ commandFired: [{ type: Output }],
869
+ triggers: [{ type: ViewChildren, args: [MatMenuTrigger,] }]
870
+ };
887
871
 
888
872
  /**
889
873
  * Custom CSS:
@@ -948,82 +932,12 @@ __decorate([
948
932
  __metadata("design:type", Array)
949
933
  ], CommandFaceComponent.prototype, "_rawFaces", void 0);
950
934
 
951
- /**
952
- *
953
- */
954
- class CommandComponent extends DisposableComponent {
955
- constructor(parent) {
956
- super();
957
- this.parent = parent;
958
- this.CommandFace = CommandFace;
959
- const { chain, switchOn } = Dsl.disposeWith(this);
960
- this.faces = chain(this.command.busy).mapToList(busy => {
961
- return busy ?
962
- [this.busyFaceModel.value, this.faceModel.value] :
963
- [this.faceModel.value, this.busyFaceModel.value];
964
- }, { allowNil: true, dependsOn: [this.faceModel, this.busyFaceModel] })
965
- .rejectNil();
966
- this.activeFace = this.faces.first();
967
- this.buttonStyle = chain(this.activeFace).map(f => CommandFace.getStyleOf(f));
968
- this.colorModel = chain(this.activeFace).map(f => CommandFace.getColorOf(f));
969
- if (parent) {
970
- this.registerDisposable(this.parent.registerCommand(this.command, this.faces));
971
- }
972
- }
973
- isActive(face) {
974
- return this.activeFace.query().equals(face);
975
- }
976
- ngOnInit() {
977
- }
978
- }
979
- CommandComponent.decorators = [
980
- { type: Component, args: [{
981
- selector: 'aup-command',
982
- template: "<ng-container *ngIf=\"!parent\">\n <ng-container [ngSwitch]=\"buttonStyle.value\">\n <ng-container *ngSwitchCase=\"CommandFace.Style.STROKED\">\n <button mat-stroked-button [pectinCommand]=\"command\" [color]=\"colorModel.value\" [class.busy]=\"command.busy.value\">\n <aup-command-face class=\"centered\" [faces]=\"faces.value\"></aup-command-face>\n </button>\n </ng-container>\n <ng-container *ngSwitchCase=\"CommandFace.Style.RAISED\">\n <button mat-raised-button [pectinCommand]=\"command\" [color]=\"colorModel.value\" [class.busy]=\"command.busy.value\">\n <aup-command-face class=\"centered\" [faces]=\"faces.value\"></aup-command-face>\n </button>\n </ng-container>\n <ng-container *ngSwitchDefault>\n <button mat-button [pectinCommand]=\"command\" [color]=\"colorModel.value\" [class.busy]=\"command.busy.value\">\n <aup-command-face class=\"centered\" [faces]=\"faces.value\"></aup-command-face>\n </button>\n </ng-container>\n </ng-container>\n</ng-container>\n",
983
- styles: [":host{display:inline-flex;flex-direction:row;justify-content:stretch}button{flex:1}"]
984
- },] }
985
- ];
986
- CommandComponent.ctorParameters = () => [
987
- { type: CommandGroup, decorators: [{ type: Optional }] }
988
- ];
989
- CommandComponent.propDecorators = {
990
- command: [{ type: Input }],
991
- faceModel: [{ type: Input }],
992
- face: [{ type: Input }],
993
- busyFaceModel: [{ type: Input }],
994
- busyFace: [{ type: Input }]
995
- };
996
- __decorate([
997
- TrackExternal(),
998
- __metadata("design:type", Command)
999
- ], CommandComponent.prototype, "command", void 0);
1000
- __decorate([
1001
- TrackExternal(),
1002
- __metadata("design:type", ValueModel)
1003
- ], CommandComponent.prototype, "faceModel", void 0);
1004
- __decorate([
1005
- StoreInValueModel('faceModel'),
1006
- __metadata("design:type", Object)
1007
- ], CommandComponent.prototype, "face", void 0);
1008
- __decorate([
1009
- TrackExternal(),
1010
- __metadata("design:type", ValueModel)
1011
- ], CommandComponent.prototype, "busyFaceModel", void 0);
1012
- __decorate([
1013
- StoreInValueModel('busyFaceModel'),
1014
- __metadata("design:type", Object)
1015
- ], CommandComponent.prototype, "busyFace", void 0);
1016
-
1017
935
  /**
1018
936
  *
1019
937
  */
1020
938
  class FlexComponent extends DisposableComponent {
1021
- constructor(parent) {
939
+ constructor() {
1022
940
  super();
1023
- this.parent = parent;
1024
- if (parent) {
1025
- parent.registerFlex(this);
1026
- }
1027
941
  }
1028
942
  ngOnInit() {
1029
943
  }
@@ -1034,48 +948,41 @@ FlexComponent.decorators = [
1034
948
  template: ``
1035
949
  },] }
1036
950
  ];
1037
- FlexComponent.ctorParameters = () => [
1038
- { type: CommandGroup }
1039
- ];
951
+ FlexComponent.ctorParameters = () => [];
1040
952
 
1041
- const ɵ0 = CommandGroup.factory;
1042
953
  /**
1043
954
  *
1044
955
  */
1045
- class MoreMenuComponent extends DisposableComponent {
1046
- constructor(group) {
1047
- super();
1048
- this.group = group;
956
+ class MoreMenuComponent extends AbstractPopupMenuComponent {
957
+ constructor(element, parent) {
958
+ super(element, parent);
1049
959
  this.tooltipModel = new MutableValueModel();
1050
960
  const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
1051
- group.xPosition = 'before'; // this should be the default unless overridden by the user.
1052
- group.faceListModel = chain(this.tooltipModel).mapToList(tooltip => {
1053
- return [
1054
- {
1055
- icon: () => 'mat:more_vert',
1056
- tooltip() {
1057
- return tooltip;
1058
- }
961
+ this.faceModelDelegate.setDelegate(chain(this.tooltipModel).map(tooltip => {
962
+ return {
963
+ icon: () => 'mat:more_vert',
964
+ tooltip() {
965
+ return tooltip;
1059
966
  }
1060
- ];
1061
- }, { allowNil: true });
967
+ };
968
+ }, { allowNil: true }));
1062
969
  }
1063
- ngOnInit() {
1064
- }
1065
- // @Trace()
1066
- ngAfterContentInit() {
1067
- this.group.initialise();
970
+ get face() {
971
+ return this.faceModelDelegate.value;
1068
972
  }
1069
973
  }
1070
974
  MoreMenuComponent.decorators = [
1071
975
  { type: Component, args: [{
1072
976
  selector: 'aup-more-menu',
1073
- template: '<aup-command-group-renderer [renderRootNode]="true" [groupViewDataModel]="group.rootTemplate"></aup-command-group-renderer>',
1074
- providers: [{ provide: CommandGroup, useFactory: ɵ0 }]
977
+ template: "<div class=\"content\" style=\"display: none\">\n <ng-content></ng-content>\n</div>\n<ng-container *ngIf=\"isRoot()\">\n <ng-container *ngIf=\"faceAdapter.text\" [ngSwitch]=\"faceAdapter.style\">\n <ng-container *ngSwitchCase=\"'stroked'\">\n <button matMenuTrigger\n [matMenuTriggerFor]=\"subMenu.menuComponent\"\n [matTooltip]=\"faceAdapter.tooltip\"\n [color]=\"faceAdapter.color\"\n mat-stroked-button>\n <aup-command-face [faces]=\"[face]\"></aup-command-face>\n </button>\n <aup-popup-menu-renderer #subMenu\n [parent]=\"this\"\n (commandFired)=\"onCommandFired()\"></aup-popup-menu-renderer>\n </ng-container>\n\n <ng-container *ngSwitchCase=\"'raised'\">\n <button matMenuTrigger\n [matMenuTriggerFor]=\"subMenu.menuComponent\"\n [matTooltip]=\"faceAdapter.tooltip\"\n [color]=\"faceAdapter.color\"\n mat-raised-button>\n <aup-command-face [faces]=\"[face]\"></aup-command-face>\n </button>\n <aup-popup-menu-renderer #subMenu\n [parent]=\"this\"\n (commandFired)=\"onCommandFired()\"></aup-popup-menu-renderer>\n </ng-container>\n\n <ng-container *ngSwitchDefault>\n <button matMenuTrigger\n [matMenuTriggerFor]=\"subMenu.menuComponent\"\n [matTooltip]=\"faceAdapter.tooltip\"\n [color]=\"faceAdapter.color\"\n mat-button>\n <aup-command-face [faces]=\"[face]\"></aup-command-face>\n </button>\n <aup-popup-menu-renderer #subMenu [parent]=\"this\" (commandFired)=\"onCommandFired()\"></aup-popup-menu-renderer>\n </ng-container>\n\n </ng-container>\n\n <ng-container *ngIf=\"!faceAdapter.text\">\n <button matMenuTrigger\n mat-icon-button\n [matMenuTriggerFor]=\"subMenu.menuComponent\"\n [matTooltip]=\"faceAdapter.tooltip\"\n [color]=\"faceAdapter.color\"\n >\n <aup-command-face [faces]=\"[face]\"></aup-command-face>\n </button>\n <aup-popup-menu-renderer #subMenu\n [parent]=\"this\"\n (commandFired)=\"onCommandFired()\"></aup-popup-menu-renderer>\n </ng-container>\n</ng-container>\n",
978
+ providers: [
979
+ { provide: POPUP_CONTAINER, useExisting: MoreMenuComponent }
980
+ ]
1075
981
  },] }
1076
982
  ];
1077
983
  MoreMenuComponent.ctorParameters = () => [
1078
- { type: CommandGroup }
984
+ { type: ElementRef },
985
+ { type: undefined, decorators: [{ type: Inject, args: [POPUP_CONTAINER,] }, { type: Optional }, { type: SkipSelf }] }
1079
986
  ];
1080
987
  MoreMenuComponent.propDecorators = {
1081
988
  tooltip: [{ type: Input }]
@@ -1085,111 +992,6 @@ __decorate([
1085
992
  __metadata("design:type", String)
1086
993
  ], MoreMenuComponent.prototype, "tooltip", void 0);
1087
994
 
1088
- const ɵ0$1 = CommandGroup.factory;
1089
- /**
1090
- *
1091
- */
1092
- class PopupMenuComponent extends DisposableComponent {
1093
- constructor(group) {
1094
- super();
1095
- this.group = group;
1096
- const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
1097
- group.faceListModel = chain(this.faceModel).mapToList(face => [face]);
1098
- }
1099
- // @Trace()
1100
- ngOnInit() {
1101
- }
1102
- // @Trace()
1103
- ngAfterContentInit() {
1104
- this.group.initialise();
1105
- }
1106
- // @Trace()
1107
- ngAfterViewInit() {
1108
- }
1109
- }
1110
- PopupMenuComponent.decorators = [
1111
- { type: Component, args: [{
1112
- selector: 'aup-popup-menu',
1113
- template: '<aup-command-group-renderer [renderRootNode]="true" [groupViewDataModel]="group.rootTemplate"></aup-command-group-renderer>',
1114
- providers: [{ provide: CommandGroup, useFactory: ɵ0$1 }]
1115
- },] }
1116
- ];
1117
- PopupMenuComponent.ctorParameters = () => [
1118
- { type: CommandGroup }
1119
- ];
1120
- PopupMenuComponent.propDecorators = {
1121
- faceModel: [{ type: Input }],
1122
- face: [{ type: Input }]
1123
- };
1124
- __decorate([
1125
- TrackExternal(),
1126
- __metadata("design:type", ValueModel)
1127
- ], PopupMenuComponent.prototype, "faceModel", void 0);
1128
- __decorate([
1129
- StoreInValueModel('faceModel'),
1130
- __metadata("design:type", Object)
1131
- ], PopupMenuComponent.prototype, "face", void 0);
1132
-
1133
- /**
1134
- *
1135
- */
1136
- class SeparatorComponent extends DisposableComponent {
1137
- constructor(parent) {
1138
- super();
1139
- this.parent = parent;
1140
- if (parent) {
1141
- parent.registerSeparator(this);
1142
- }
1143
- }
1144
- isVertical() {
1145
- return this === null || this === void 0 ? void 0 : this.parent.isRoot();
1146
- }
1147
- ngOnInit() {
1148
- }
1149
- }
1150
- SeparatorComponent.decorators = [
1151
- { type: Component, args: [{
1152
- selector: 'aup-separator',
1153
- template: `
1154
- <mat-divider [vertical]="isVertical()"></mat-divider>`
1155
- },] }
1156
- ];
1157
- SeparatorComponent.ctorParameters = () => [
1158
- { type: CommandGroup, decorators: [{ type: Optional }] }
1159
- ];
1160
-
1161
- const ɵ0$2 = CommandGroup.factory;
1162
- /**
1163
- *
1164
- */
1165
- class ToolBarComponent extends DisposableComponent {
1166
- constructor(group) {
1167
- super();
1168
- this.group = group;
1169
- }
1170
- // @Trace()
1171
- ngOnInit() {
1172
- }
1173
- // @Trace()
1174
- ngAfterContentInit() {
1175
- this.group.initialise();
1176
- }
1177
- // @Trace()
1178
- ngAfterViewInit() {
1179
- }
1180
- }
1181
- ToolBarComponent.decorators = [
1182
- { type: Component, args: [{
1183
- selector: 'aup-tool-bar',
1184
- template: '<aup-command-group-renderer [renderRootNode]="false" [groupViewDataModel]="group.rootTemplate"></aup-command-group-renderer>',
1185
- providers: [{ provide: CommandGroup, useFactory: ɵ0$2 }],
1186
- styles: [":host{align-items:center;display:inline-flex;flex-direction:row}:host mat-divider{-ms-grid-row-align:stretch;align-self:stretch;margin:4px 0}:host span.flex{flex:1}:host>*+*{margin-left:8px}"]
1187
- },] }
1188
- ];
1189
- ToolBarComponent.ctorParameters = () => [
1190
- { type: CommandGroup }
1191
- ];
1192
-
1193
995
  class FocusContainerComponent extends DisposableComponent {
1194
996
  constructor(focusManager) {
1195
997
  super();
@@ -2197,7 +1999,7 @@ SelectHeaderCellRendererComponent.ctorParameters = () => [];
2197
1999
 
2198
2000
  const noop = () => {
2199
2001
  };
2200
- const ɵ0$3 = noop;
2002
+ const ɵ0 = noop;
2201
2003
  const CELL_RENDERER_COMPONENT_ROW_CACHE = Symbol("aup-cell-renderer:row-data-cache");
2202
2004
  class ColumnModel {
2203
2005
  constructor(columnId, defaults) {
@@ -3087,13 +2889,12 @@ ComponentsModule.decorators = [
3087
2889
  ToolBarComponent,
3088
2890
  CommandComponent,
3089
2891
  PopupMenuComponent,
3090
- CommandGroupComponent,
3091
2892
  CommandFaceComponent,
3092
2893
  MoreMenuComponent,
3093
2894
  SeparatorComponent,
3094
2895
  FlexComponent,
3095
- CommandGroupMenuRendererComponent,
3096
- CommandGroupRendererComponent
2896
+ AbstractPopupMenuComponent,
2897
+ PopupMenuRendererComponent
3097
2898
  ],
3098
2899
  imports: [
3099
2900
  CommonModule,
@@ -3140,7 +2941,6 @@ ComponentsModule.decorators = [
3140
2941
  IconComponent,
3141
2942
  SectionHeaderComponent,
3142
2943
  TableRowMenuComponent,
3143
- CommandGroupComponent,
3144
2944
  ToolBarComponent,
3145
2945
  CommandComponent,
3146
2946
  PopupMenuComponent,
@@ -6156,10 +5956,11 @@ function leftRightPlaceAnimation(duration) {
6156
5956
  const LEFT_RIGHT_PLACE_ANIMATION = leftRightPlaceAnimation('0.3s');
6157
5957
 
6158
5958
  class PlaceOutletComponent extends DisposableComponent {
6159
- constructor(router, placeRouter, placeConfig, parentOutlet) {
5959
+ constructor(router, placeRouter, placeAuthService, placeConfig, parentOutlet) {
6160
5960
  super();
6161
5961
  this.router = router;
6162
5962
  this.placeRouter = placeRouter;
5963
+ this.placeAuthService = placeAuthService;
6163
5964
  this.placeConfig = placeConfig;
6164
5965
  this.placeChanged = new EventEmitter();
6165
5966
  this.outletActivated = new MutableValueModel(false);
@@ -6204,6 +6005,13 @@ class PlaceOutletComponent extends DisposableComponent {
6204
6005
  chain(this._activePlaceModel)
6205
6006
  .postponeWhile(this.navigationInProgress)
6206
6007
  .subscribe(place => this.placeChanged.emit(place));
6008
+ when(placeAuthService.authoriserModel).changes(isAuthorised => {
6009
+ const activePlace = this._activePlaceModel.value;
6010
+ if (activePlace && !isAuthorised(activePlace.placeDefinition)) {
6011
+ const visitOrPlace = placeAuthService.handleNotAuthorised(this._activatedRouteModel.value.snapshot, this.router.routerState.snapshot);
6012
+ this.placeRouter.navigate(visitOrPlace instanceof Visit ? visitOrPlace : new Visit(PlaceComponent.getDefinition(visitOrPlace)));
6013
+ }
6014
+ });
6207
6015
  }
6208
6016
  // @Trace()
6209
6017
  ngOnInit() {
@@ -6325,6 +6133,7 @@ PlaceOutletComponent.decorators = [
6325
6133
  PlaceOutletComponent.ctorParameters = () => [
6326
6134
  { type: Router },
6327
6135
  { type: PlaceRouter },
6136
+ { type: undefined, decorators: [{ type: Inject, args: [PLACE_AUTH_SERVICE,] }] },
6328
6137
  { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [AUP_PLACE_CONFIG,] }] },
6329
6138
  { type: PlaceOutletComponent, decorators: [{ type: SkipSelf }, { type: Optional }] }
6330
6139
  ];
@@ -6903,17 +6712,28 @@ class PlaceGuard {
6903
6712
  this.interactionService = interactionService;
6904
6713
  this.injector = injector;
6905
6714
  }
6715
+ // @Trace()
6906
6716
  canActivate(activatedRoute, state) {
6907
6717
  return __awaiter(this, void 0, void 0, function* () {
6908
6718
  if (PlaceComponent.isPlaceComponentConstructor(activatedRoute.component)) {
6909
6719
  const placeDefinition = PlaceComponent.getDefinition(activatedRoute.component);
6910
- const needsAuth = placeDefinition.authenticate;
6911
- const proceed = !needsAuth || (yield this.placeAuthService.isAuthenticated());
6912
- if (!proceed) {
6913
- return this.handleGuardResult(this.placeAuthService.handleNotAuthenticated(activatedRoute, state));
6914
- }
6915
- if (!this.placeAuthService.isAuthorised(placeDefinition)) {
6916
- return this.handleGuardResult(this.placeAuthService.handleNotAuthorisation(activatedRoute, state));
6720
+ if (placeDefinition.authenticate) {
6721
+ if (!(yield this.placeAuthService.isAuthenticated())) {
6722
+ const redirectLocation = this.placeAuthService.handleNotAuthenticated(activatedRoute, state);
6723
+ const nextPlaceDef = this.getPlaceDefinition(redirectLocation);
6724
+ if (nextPlaceDef.authenticate) {
6725
+ lang.illegalState(`handleNotAuthenticated hook returned place ${nextPlaceDef.component.name} that requires authentication.`);
6726
+ }
6727
+ return this.createUrlTree(redirectLocation);
6728
+ }
6729
+ if (!this.placeAuthService.isAuthorised(placeDefinition)) {
6730
+ const redirectLocation = this.placeAuthService.handleNotAuthorised(activatedRoute, state);
6731
+ const nextPlaceDef = this.getPlaceDefinition(redirectLocation);
6732
+ if (!this.placeAuthService.isAuthorised(nextPlaceDef)) {
6733
+ lang.illegalState(`handleNotAuthorised hook returned place ${nextPlaceDef.component.name} that is not authorised for the current user.`);
6734
+ }
6735
+ return this.createUrlTree(redirectLocation);
6736
+ }
6917
6737
  }
6918
6738
  const result = yield this.cleanInteractionState(activatedRoute, state, () => __awaiter(this, void 0, void 0, function* () {
6919
6739
  // Parse our route params.
@@ -6942,6 +6762,7 @@ class PlaceGuard {
6942
6762
  }
6943
6763
  });
6944
6764
  }
6765
+ // @Trace()
6945
6766
  canDeactivate(component, currentRoute, currentState, nextState) {
6946
6767
  return __awaiter(this, void 0, void 0, function* () {
6947
6768
  const currentUrl = this.urlService.parseUrl(currentState.url);
@@ -6950,13 +6771,14 @@ class PlaceGuard {
6950
6771
  return result instanceof UrlSnapshot ? result.urlTree : result;
6951
6772
  });
6952
6773
  }
6953
- handleGuardResult(result) {
6954
- if (result instanceof UrlSnapshot) {
6955
- return result.urlTree;
6956
- }
6957
- else {
6958
- return this.urlService.createUrlSnapshot(result).urlTree;
6959
- }
6774
+ getPlaceDefinition(result) {
6775
+ return result instanceof Visit ?
6776
+ result.placeDefinition :
6777
+ PlaceComponent.getDefinition(result);
6778
+ }
6779
+ createUrlTree(result) {
6780
+ const visit = result instanceof Visit ? result : new Visit(PlaceComponent.getDefinition(result), {});
6781
+ return this.urlService.createUrlSnapshot(visit).urlTree;
6960
6782
  }
6961
6783
  // protected async ensureAuthenticatedThen(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot, next: (placeDefinition: PlaceDefinition) => Promise<boolean | UrlTree>): Promise<boolean | UrlTree> {
6962
6784
  // const authoriseResult = placeDefinition.authenticate ? await this.isAuthorised(activatedRoute, state) : true;
@@ -6979,6 +6801,7 @@ class PlaceGuard {
6979
6801
  // return (authorised instanceof Observable) ? authorised.toPromise() : authorised;
6980
6802
  // }
6981
6803
  // abstract getAuthGuard(injector: Injector): CanActivate;
6804
+ // @Trace()
6982
6805
  cleanInteractionState(route, state, next) {
6983
6806
  return __awaiter(this, void 0, void 0, function* () {
6984
6807
  const url = this.urlService.parseUrl(state.url);
@@ -7006,30 +6829,6 @@ PlaceGuard.ctorParameters = () => [
7006
6829
  { type: InteractionService },
7007
6830
  { type: Injector }
7008
6831
  ];
7009
- __decorate([
7010
- Trace(),
7011
- __metadata("design:type", Function),
7012
- __metadata("design:paramtypes", [ActivatedRouteSnapshot, RouterStateSnapshot]),
7013
- __metadata("design:returntype", Promise)
7014
- ], PlaceGuard.prototype, "canActivate", null);
7015
- __decorate([
7016
- Trace(),
7017
- __metadata("design:type", Function),
7018
- __metadata("design:paramtypes", [PlaceComponent, ActivatedRouteSnapshot, RouterStateSnapshot, RouterStateSnapshot]),
7019
- __metadata("design:returntype", Promise)
7020
- ], PlaceGuard.prototype, "canDeactivate", null);
7021
- __decorate([
7022
- Trace(),
7023
- __metadata("design:type", Function),
7024
- __metadata("design:paramtypes", [Object]),
7025
- __metadata("design:returntype", void 0)
7026
- ], PlaceGuard.prototype, "handleGuardResult", null);
7027
- __decorate([
7028
- Trace(),
7029
- __metadata("design:type", Function),
7030
- __metadata("design:paramtypes", [ActivatedRouteSnapshot, RouterStateSnapshot, Function]),
7031
- __metadata("design:returntype", Promise)
7032
- ], PlaceGuard.prototype, "cleanInteractionState", null);
7033
6832
 
7034
6833
  var Formatter;
7035
6834
  (function (Formatter) {
@@ -7131,5 +6930,5 @@ function VisitParameterList(options) {
7131
6930
  * Generated bundle index. Do not edit.
7132
6931
  */
7133
6932
 
7134
- export { ACTIVITY_DATA, AUP_PLACE_CONFIG, AbstractInputActivity, AbstractInputComponent, AbstractInteractionContext, AbstractListInputComponent, AbstractPlaceNavigationComponent, AbstractPopStateNavigation, AbstractValueInputComponent, Activity, ActivityActionsComponent, ActivityContainerComponent, ActivityOutletComponent, ActivityRef, AddItemInteractionContextComponent, AlertDialogComponent, AngularUiPowerupsModule, AutocompleteInputComponent, Bounds, BusyOverlayComponent, CELL_EDITOR_PORTAL, CELL_RENDERER_PORTAL, CardContainerComponent, CellEditorPortalRef, CellHeaderPortalRef, CellPortalRef, CellRendererPortalRef, CheckboxInputComponent, ColumnModel, ColumnTemplateDirective, CommandComponent, CommandDirective, CommandFace, CommandFaceComponent, CommandGroup, CommandGroupComponent, CommandGroupMenuRendererComponent, CommandGroupRendererComponent, ComponentCellRendererPortalRef, ComponentsModule, ConfirmThenDialogComponent, ConfirmationDialogComponent, ConsolidatedParameterMap, CustomTemplateColumnModel, CustomValueColumnModel, DEFINITION_META_DATA_KEY, DIALOG_INTERACTION_SERVICE_DEFAULTS, DefaultCellRendererComponent, DefaultHeaderCellRendererComponent, DialogInteractionContext, DialogInteractionContextFactory, Dimension, DirectivesModule, DisposableComponent, EditRowControls, EditSession, EditorControlColumnModel, EmptyStateComponent, EventCleanUpSession, FlexComponent, FocusBinding, FocusBindingDirective, FocusBindingFactory, FocusContainerComponent, FocusableComponent, Formatter, HEADER_CELL_RENDERER_PORTAL, IconComponent, InPlaceInteractionContextComponent, InteractionContextTriggerFor, InteractionModule, InteractionService, InteractionServiceRoutingAdapter, LEFT_RIGHT_PLACE_ANIMATION, ListPlaceNavComponent, ListPropertyColumnModel, ModalInteractionContextFactory, MoreMenuComponent, MultipleSelectInputComponent, Navigating, NavigatingDuringInteraction, NavigationContext, NavigationSession, NoopAuthGuard, NoopComponent, NumberInputComponent, PLACE_AUTH_SERVICE, PORTAL_EDITOR_COMPONENT, PORTAL_RENDERER_COMPONENT, ParameterDefinition, PasswordInputComponent, Place, PlaceComponent, PlaceComponentDeactivationHandler, PlaceDefinition, PlaceGuard, PlaceHistory, PlaceModule, PlaceOutletComponent, PlaceRouter, Point, PopStateDuringInteractionNavigation, PopStateNavigation, PopupInteractionContextComponent, PopupMenuComponent, PropertyColumnModel, ROUTE_PARAMETER_LIST_KEY, Registration, RemoveLastInteractionFromUrlNavigationSession, ResizeAwareComponent, RouteId, ScrollContainerComponent, SectionHeaderComponent, SelectCellRendererComponent, SelectHeaderCellRendererComponent, SelectInputActivity, SelectInputComponent, SelectionColumnModel, SeparatorComponent, SidePlaceNavigationComponent, StringInputActivity, StringInputComponent, SwitchCaseComponent, SwitchCaseDefaultDirective, SwitchCaseOption, SwitchCaseWhenDirective, SynchroniseInteractionContextIdsWithRoute, TabbedPlaceNavigationComponent, TableCellRendererComponent, TableComponent, TableHeaderCellRendererComponent, TableModel, TableRowMenuComponent, TemplateCellRendererPortalRef, TextInputComponent, ToolBarComponent, TrackBy, UrlService, UrlSnapshot, VerticalFocusContainerComponent, ViewData, Visit, VisitParameter, VisitParameterList, VisitSanitiser, WaitUntilLeavingInteractionTransitionCancelled, WaitUntilLinkTriggeredNavigationInteractionCancellationTypeDetermined, WaitUntilPopStateDuringCanDeactivateInteractionFinishes, leftRightPlaceAnimation, slideDownOnEnterAnimation, slideRightOnEnterAnimation, ɵ0 };
6933
+ export { ACTIVITY_DATA, AUP_PLACE_CONFIG, AbstractInputActivity, AbstractInputComponent, AbstractInteractionContext, AbstractListInputComponent, AbstractPlaceNavigationComponent, AbstractPopStateNavigation, AbstractPopupMenuComponent, AbstractValueInputComponent, Activity, ActivityActionsComponent, ActivityContainerComponent, ActivityOutletComponent, ActivityRef, AddItemInteractionContextComponent, AlertDialogComponent, AngularUiPowerupsModule, AutocompleteInputComponent, Bounds, BusyOverlayComponent, CELL_EDITOR_PORTAL, CELL_RENDERER_PORTAL, CardContainerComponent, CellEditorPortalRef, CellHeaderPortalRef, CellPortalRef, CellRendererPortalRef, CheckboxInputComponent, ColumnModel, ColumnTemplateDirective, CommandComponent, CommandContainer, CommandDirective, CommandFace, CommandFaceComponent, ComponentCellRendererPortalRef, ComponentsModule, ConfirmThenDialogComponent, ConfirmationDialogComponent, ConsolidatedParameterMap, CustomTemplateColumnModel, CustomValueColumnModel, DEFINITION_META_DATA_KEY, DIALOG_INTERACTION_SERVICE_DEFAULTS, DefaultCellRendererComponent, DefaultHeaderCellRendererComponent, DialogInteractionContext, DialogInteractionContextFactory, Dimension, DirectivesModule, DisposableComponent, EditRowControls, EditSession, EditorControlColumnModel, EmptyStateComponent, EventCleanUpSession, FlexComponent, FocusBinding, FocusBindingDirective, FocusBindingFactory, FocusContainerComponent, FocusableComponent, Formatter, HEADER_CELL_RENDERER_PORTAL, IconComponent, InPlaceInteractionContextComponent, InteractionContextTriggerFor, InteractionModule, InteractionService, InteractionServiceRoutingAdapter, LEFT_RIGHT_PLACE_ANIMATION, ListPlaceNavComponent, ListPropertyColumnModel, ModalInteractionContextFactory, MoreMenuComponent, MultipleSelectInputComponent, Navigating, NavigatingDuringInteraction, NavigationContext, NavigationSession, NoopAuthGuard, NoopComponent, NumberInputComponent, PLACE_AUTH_SERVICE, POPUP_CONTAINER, PORTAL_EDITOR_COMPONENT, PORTAL_RENDERER_COMPONENT, ParameterDefinition, PasswordInputComponent, Place, PlaceComponent, PlaceComponentDeactivationHandler, PlaceDefinition, PlaceGuard, PlaceHistory, PlaceModule, PlaceOutletComponent, PlaceRouter, Point, PopStateDuringInteractionNavigation, PopStateNavigation, PopupAwareComponent, PopupInteractionContextComponent, PopupMenuComponent, PopupMenuRendererComponent, PropertyColumnModel, ROUTE_PARAMETER_LIST_KEY, RemoveLastInteractionFromUrlNavigationSession, ResizeAwareComponent, RouteId, ScrollContainerComponent, SectionHeaderComponent, SelectCellRendererComponent, SelectHeaderCellRendererComponent, SelectInputActivity, SelectInputComponent, SelectionColumnModel, SeparatorComponent, SidePlaceNavigationComponent, StringInputActivity, StringInputComponent, SwitchCaseComponent, SwitchCaseDefaultDirective, SwitchCaseOption, SwitchCaseWhenDirective, SynchroniseInteractionContextIdsWithRoute, TabbedPlaceNavigationComponent, TableCellRendererComponent, TableComponent, TableHeaderCellRendererComponent, TableModel, TableRowMenuComponent, TemplateCellRendererPortalRef, TextInputComponent, ToolBarComponent, TrackBy, UrlService, UrlSnapshot, VerticalFocusContainerComponent, Visit, VisitParameter, VisitParameterList, VisitSanitiser, WaitUntilLeavingInteractionTransitionCancelled, WaitUntilLinkTriggeredNavigationInteractionCancellationTypeDetermined, WaitUntilPopStateDuringCanDeactivateInteractionFinishes, leftRightPlaceAnimation, slideDownOnEnterAnimation, slideRightOnEnterAnimation, ɵ0 };
7135
6934
  //# sourceMappingURL=coolon-angular-ui-powerups.js.map