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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/CHANGELOG.md +0 -57
  2. package/bundles/coolon-angular-ui-powerups.umd.js +667 -423
  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 +12 -15
  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 +9 -2
  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-group/command-group.component.js +43 -0
  15. package/esm2015/lib/components/commands/group/command-group/command-group.component.js.map +1 -0
  16. package/esm2015/lib/components/commands/group/command-group/command-group.component.metadata.json +1 -0
  17. package/esm2015/lib/components/commands/group/command-group/command-group.component.ngfactory.js.map +1 -0
  18. package/esm2015/lib/components/commands/group/command-group-menu-renderer/command-group-menu-renderer.component.js +46 -0
  19. package/esm2015/lib/components/commands/group/command-group-menu-renderer/command-group-menu-renderer.component.js.map +1 -0
  20. package/esm2015/lib/components/commands/group/command-group-menu-renderer/command-group-menu-renderer.component.metadata.json +1 -0
  21. package/esm2015/lib/components/commands/group/command-group-menu-renderer/command-group-menu-renderer.component.ngfactory.js.map +1 -0
  22. package/esm2015/lib/components/commands/group/command-group-renderer/command-group-renderer.component.js +39 -0
  23. package/esm2015/lib/components/commands/group/command-group-renderer/command-group-renderer.component.js.map +1 -0
  24. package/esm2015/lib/components/commands/group/command-group-renderer/command-group-renderer.component.metadata.json +1 -0
  25. package/esm2015/lib/components/commands/group/command-group-renderer/command-group-renderer.component.ngfactory.js.map +1 -0
  26. package/esm2015/lib/components/commands/group/command-group-renderer/command-group-renderer.component.scss.shim.ngstyle.js.map +1 -0
  27. package/esm2015/lib/components/commands/group/command-group.js +103 -0
  28. package/esm2015/lib/components/commands/group/command-group.js.map +1 -0
  29. package/esm2015/lib/components/commands/group/command-group.metadata.json +1 -0
  30. package/esm2015/lib/components/commands/group/more-menu.component.js +53 -0
  31. package/esm2015/lib/components/commands/group/more-menu.component.js.map +1 -0
  32. package/esm2015/lib/components/commands/group/more-menu.component.metadata.json +1 -0
  33. package/esm2015/lib/components/commands/group/more-menu.component.ngfactory.js.map +1 -0
  34. package/esm2015/lib/components/commands/group/popup-menu.component.js +52 -0
  35. package/esm2015/lib/components/commands/group/popup-menu.component.js.map +1 -0
  36. package/esm2015/lib/components/commands/group/popup-menu.component.metadata.json +1 -0
  37. package/esm2015/lib/components/commands/group/popup-menu.component.ngfactory.js.map +1 -0
  38. package/esm2015/lib/components/commands/group/registration.js +58 -0
  39. package/esm2015/lib/components/commands/group/registration.js.map +1 -0
  40. package/esm2015/lib/components/commands/group/registration.metadata.json +1 -0
  41. package/esm2015/lib/components/commands/group/tool-bar/tool-bar.component.js +15 -12
  42. package/esm2015/lib/components/commands/group/tool-bar/tool-bar.component.js.map +1 -1
  43. package/esm2015/lib/components/commands/group/tool-bar/tool-bar.component.metadata.json +1 -1
  44. package/esm2015/lib/components/commands/group/tool-bar/tool-bar.component.scss.shim.ngstyle.js.map +1 -0
  45. package/esm2015/lib/components/commands/group/view-data.js +113 -0
  46. package/esm2015/lib/components/commands/group/view-data.js.map +1 -0
  47. package/esm2015/lib/components/commands/group/view-data.metadata.json +1 -0
  48. package/esm2015/lib/components/commands/separator.component.js +14 -25
  49. package/esm2015/lib/components/commands/separator.component.js.map +1 -1
  50. package/esm2015/lib/components/commands/separator.component.metadata.json +1 -1
  51. package/esm2015/lib/components/components.module.js +9 -6
  52. package/esm2015/lib/components/components.module.js.map +1 -1
  53. package/esm2015/lib/components/components.module.metadata.json +1 -1
  54. package/esm2015/lib/components/components.module.ngfactory.js.map +1 -1
  55. package/esm2015/lib/components/exports.js +8 -7
  56. package/esm2015/lib/components/exports.js.map +1 -1
  57. package/esm2015/lib/components/exports.metadata.json +1 -1
  58. package/esm2015/lib/interaction/interaction.module.ngfactory.js.map +1 -1
  59. package/esm2015/lib/place/components/place-outlet/place-outlet.component.js +1 -12
  60. package/esm2015/lib/place/components/place-outlet/place-outlet.component.js.map +1 -1
  61. package/esm2015/lib/place/components/place-outlet/place-outlet.component.metadata.json +1 -1
  62. package/esm2015/lib/place/guards/place.guard.js +41 -31
  63. package/esm2015/lib/place/guards/place.guard.js.map +1 -1
  64. package/esm2015/lib/place/guards/place.guard.metadata.json +1 -1
  65. package/esm2015/lib/place/place-auth-service.js.map +1 -1
  66. package/esm2015/lib/place/place-auth-service.metadata.json +1 -1
  67. package/esm2015/lib/place/place.module.ngfactory.js.map +1 -1
  68. package/fesm2015/coolon-angular-ui-powerups.js +562 -361
  69. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  70. package/lib/components/commands/command/command.component.d.ts +6 -7
  71. package/lib/components/commands/flex.component.d.ts +3 -1
  72. package/lib/components/commands/group/command-group/command-group.component.d.ts +12 -0
  73. package/lib/components/commands/group/command-group-menu-renderer/command-group-menu-renderer.component.d.ts +21 -0
  74. package/lib/components/commands/group/command-group-renderer/command-group-renderer.component.d.ts +13 -0
  75. package/lib/components/commands/group/command-group.d.ts +42 -0
  76. package/lib/components/commands/group/more-menu.component.d.ts +14 -0
  77. package/lib/components/commands/group/popup-menu.component.d.ts +17 -0
  78. package/lib/components/commands/group/registration.d.ts +32 -0
  79. package/lib/components/commands/group/tool-bar/tool-bar.component.d.ts +5 -4
  80. package/lib/components/commands/group/view-data.d.ts +41 -0
  81. package/lib/components/commands/separator.component.d.ts +7 -8
  82. package/lib/components/exports.d.ts +8 -7
  83. package/lib/place/components/place-outlet/place-outlet.component.d.ts +1 -3
  84. package/lib/place/guards/place.guard.d.ts +1 -2
  85. package/lib/place/place-auth-service.d.ts +4 -4
  86. package/package.json +1 -1
  87. package/esm2015/lib/components/commands/group/command-container.js +0 -21
  88. package/esm2015/lib/components/commands/group/command-container.js.map +0 -1
  89. package/esm2015/lib/components/commands/group/command-container.metadata.json +0 -1
  90. package/esm2015/lib/components/commands/group/popup-aware.component.js +0 -26
  91. package/esm2015/lib/components/commands/group/popup-aware.component.js.map +0 -1
  92. package/esm2015/lib/components/commands/group/popup-aware.component.metadata.json +0 -1
  93. package/esm2015/lib/components/commands/group/popup-container.js +0 -3
  94. package/esm2015/lib/components/commands/group/popup-container.js.map +0 -1
  95. package/esm2015/lib/components/commands/group/popup-container.metadata.json +0 -1
  96. package/esm2015/lib/components/commands/group/popup-menu/abstract-popup-menu.component.js +0 -65
  97. package/esm2015/lib/components/commands/group/popup-menu/abstract-popup-menu.component.js.map +0 -1
  98. package/esm2015/lib/components/commands/group/popup-menu/abstract-popup-menu.component.metadata.json +0 -1
  99. package/esm2015/lib/components/commands/group/popup-menu/abstract-popup-menu.component.ngfactory.js.map +0 -1
  100. package/esm2015/lib/components/commands/group/popup-menu/more-menu.component.js +0 -47
  101. package/esm2015/lib/components/commands/group/popup-menu/more-menu.component.js.map +0 -1
  102. package/esm2015/lib/components/commands/group/popup-menu/more-menu.component.metadata.json +0 -1
  103. package/esm2015/lib/components/commands/group/popup-menu/more-menu.component.ngfactory.js.map +0 -1
  104. package/esm2015/lib/components/commands/group/popup-menu/popup-menu-renderer/popup-menu-renderer.component.js +0 -90
  105. package/esm2015/lib/components/commands/group/popup-menu/popup-menu-renderer/popup-menu-renderer.component.js.map +0 -1
  106. package/esm2015/lib/components/commands/group/popup-menu/popup-menu-renderer/popup-menu-renderer.component.metadata.json +0 -1
  107. package/esm2015/lib/components/commands/group/popup-menu/popup-menu-renderer/popup-menu-renderer.component.ngfactory.js.map +0 -1
  108. package/esm2015/lib/components/commands/group/popup-menu/popup-menu.component.js +0 -42
  109. package/esm2015/lib/components/commands/group/popup-menu/popup-menu.component.js.map +0 -1
  110. package/esm2015/lib/components/commands/group/popup-menu/popup-menu.component.metadata.json +0 -1
  111. package/esm2015/lib/components/commands/group/popup-menu/popup-menu.component.ngfactory.js.map +0 -1
  112. package/esm2015/lib/components/commands/group/tool-bar/tool-bar.component.scss.ngstyle.js.map +0 -1
  113. package/lib/components/commands/group/command-container.d.ts +0 -16
  114. package/lib/components/commands/group/popup-aware.component.d.ts +0 -12
  115. package/lib/components/commands/group/popup-container.d.ts +0 -6
  116. package/lib/components/commands/group/popup-menu/abstract-popup-menu.component.d.ts +0 -25
  117. package/lib/components/commands/group/popup-menu/more-menu.component.d.ts +0 -12
  118. package/lib/components/commands/group/popup-menu/popup-menu-renderer/popup-menu-renderer.component.d.ts +0 -33
  119. package/lib/components/commands/group/popup-menu/popup-menu.component.d.ts +0 -13
@@ -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, InjectionToken, ViewEncapsulation, HostBinding, ViewChildren, SkipSelf, EventEmitter, ViewChild, Output, Self, TemplateRef, ChangeDetectorRef, ContentChildren, ViewContainerRef, Injector, ComponentFactoryResolver, INJECTOR } from '@angular/core';
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';
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, ValueModel, StoreInValueModel, MutableListModel, Disposable, DelegatingListModel, StoreInListModel, MutableValueModel, FocusManager, EventListenerList, Form, Guard, Binding, DebugContext, ListModel, MultipleSelectionModel, DirtyTrackingForm, DelegatingCommand, Deferred, Trace, Functions } from '@coolon/pectin';
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';
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 } from '@angular/router';
30
+ import { RouterModule, ActivatedRouteSnapshot, NavigationStart, NavigationCancel, UrlSegment, Router, UrlSerializer, NavigationEnd, NavigationError, RouterOutlet, RouterStateSnapshot } 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,363 +511,379 @@ var TrackBy;
511
511
  TrackBy.byIndex = (data, index) => index;
512
512
  })(TrackBy || (TrackBy = {}));
513
513
 
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));
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);
521
525
  }
522
526
  }
523
- get componentIndex() {
524
- return this.computeComponentIndex();
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
+ }
525
545
  }
526
- computeComponentIndex() {
527
- let node = this.element.nativeElement;
528
- let index = 0;
529
- while ((node = node.previousElementSibling)) {
530
- index++;
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;
531
556
  }
532
- return index;
533
557
  }
534
- getFace() {
535
- return undefined;
558
+ ViewData.CommandData = CommandData;
559
+ class SeparatorData extends ViewData {
536
560
  }
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));
561
+ ViewData.SeparatorData = SeparatorData;
562
+ class FlexData extends ViewData {
558
563
  }
559
- isActive(face) {
560
- return this.activeFace.query().equals(face);
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}`);
561
567
  }
562
- ngOnInit() {
568
+ ViewData.as = as;
569
+ function getCommand(data) {
570
+ return as(CommandData, data).command;
563
571
  }
564
- ngAfterViewInit() {
565
- // console.log(this.element.nativeElement.previousSibling)
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);
566
595
  }
567
- getFace() {
568
- return this.face;
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;
607
+ }
608
+ ViewData.hasFace = hasFace;
609
+ function isCommand(data) {
610
+ return data instanceof CommandData;
611
+ }
612
+ ViewData.isCommand = isCommand;
613
+ function isSeparator(data) {
614
+ return data instanceof SeparatorData;
615
+ }
616
+ ViewData.isSeparator = isSeparator;
617
+ function isFlex(data) {
618
+ return data instanceof FlexData;
619
+ }
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');
634
+ }
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;
569
640
  }
570
641
  }
571
- CommandComponent.decorators = [
642
+ CommandGroupMenuRendererComponent.decorators = [
572
643
  { type: Component, args: [{
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}"]
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"
576
646
  },] }
577
647
  ];
578
- CommandComponent.ctorParameters = () => [
579
- { type: ElementRef },
580
- { type: undefined, decorators: [{ type: Inject, args: [POPUP_CONTAINER,] }, { type: Optional }] }
648
+ CommandGroupMenuRendererComponent.ctorParameters = () => [
649
+ { type: CommandGroupMenuRendererComponent, decorators: [{ type: Optional }, { type: SkipSelf }] }
581
650
  ];
582
- CommandComponent.propDecorators = {
583
- command: [{ type: Input }],
584
- faceModel: [{ type: Input }],
585
- face: [{ type: Input }],
586
- busyFaceModel: [{ type: Input }],
587
- busyFace: [{ type: Input }]
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,] }]
588
656
  };
589
657
  __decorate([
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);
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
+ };
601
686
  __decorate([
602
687
  TrackExternal(),
603
688
  __metadata("design:type", ValueModel)
604
- ], CommandComponent.prototype, "busyFaceModel", void 0);
689
+ ], CommandGroupRendererComponent.prototype, "groupViewDataModel", void 0);
605
690
  __decorate([
606
- StoreInValueModel('busyFaceModel'),
607
- __metadata("design:type", Object)
608
- ], CommandComponent.prototype, "busyFace", void 0);
691
+ StoreInValueModel('groupViewDataModel'),
692
+ __metadata("design:type", ViewData.GroupData)
693
+ ], CommandGroupRendererComponent.prototype, "groupViewData", void 0);
609
694
 
610
- class CommandContainer extends GarbageCollector {
611
- constructor(parent) {
612
- super();
613
- this.parent = parent;
695
+ class Registration extends GarbageCollector {
696
+ }
697
+ (function (Registration) {
698
+ class FaceRegistration extends Registration {
699
+ constructor(faceListModel) {
700
+ super();
701
+ this.faceListModel = faceListModel;
702
+ }
614
703
  }
615
- get depth() {
616
- return this.hasParent() ? this.parent.depth + 1 : 0;
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
+ }
617
713
  }
618
- hasParent() {
619
- return !!this.parent;
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
+ }
620
723
  }
621
- get orientation() {
622
- return CommandContainer.Orientation.VERTICAL;
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
+ }
623
733
  }
624
- }
625
- (function (CommandContainer) {
626
- CommandContainer.Orientation = Enum({ HORIZONTAL: 'horizontal', VERTICAL: 'vertical' });
627
- })(CommandContainer || (CommandContainer = {}));
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
+ }
743
+ }
744
+ Registration.FlexRegistration = FlexRegistration;
745
+ function hasFace(entry) {
746
+ return entry instanceof CommandRegistration || entry instanceof GroupRegistration;
747
+ }
748
+ Registration.hasFace = hasFace;
749
+ })(Registration || (Registration = {}));
628
750
 
629
- /**
630
- *
631
- */
632
- class ToolBarComponent extends CommandContainer {
633
- constructor() {
751
+ class CommandGroup extends GarbageCollector {
752
+ constructor(parent) {
634
753
  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();
635
760
  }
636
- get orientation() {
637
- return CommandContainer.Orientation.HORIZONTAL;
761
+ initialise() {
762
+ this.rebuildTemplates();
638
763
  }
639
- // @Trace()
640
- ngOnInit() {
764
+ get rootTemplate() {
765
+ return this._rootTemplate.readonly;
641
766
  }
642
- // @Trace()
643
- ngAfterContentInit() {
644
- // this.group.initialise();
645
- }
646
- // @Trace()
647
- ngAfterViewInit() {
767
+ get registrations() {
768
+ return this._registrations.readonly;
648
769
  }
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;
770
+ notifyChanged() {
771
+ if (this.parent) {
772
+ this.parent.notifyChanged();
773
+ }
774
+ else {
775
+ this.rebuildTemplates();
776
+ }
667
777
  }
668
- isHorizontalContainer() {
669
- return this.containerParent instanceof ToolBarComponent && this.containerParent.orientation === CommandContainer.Orientation.HORIZONTAL;
778
+ notifyChildFaceChanged(is, was) {
779
+ this.notifyChanged();
670
780
  }
671
- ngOnInit() {
781
+ rebuildTemplates() {
782
+ this._rootTemplate.value = new ViewData.GroupData(this.faceListModel.value, this.xPosition, this.yPosition, this.registrations.value.map(r => r.toTemplate()));
672
783
  }
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');
784
+ get depth() {
785
+ return this.isRoot() ? 0 : this.parent.depth + 1;
711
786
  }
712
- ngAfterContentChecked() {
713
- // force the list to re-order as the child indicies may have changed.
714
- this._unorderedChildren.value = [...this._unorderedChildren.value];
787
+ isRoot() {
788
+ return false;
715
789
  }
716
- get faceAdapter() {
717
- return this.faceAdapterModel.value;
790
+ registerCommand(command, faceListModel) {
791
+ return this.register(new Registration.CommandRegistration(command, faceListModel));
718
792
  }
719
- isRoot() {
720
- return !this.parent;
793
+ registerGroup(group, faceModel) {
794
+ return this.register(new Registration.GroupRegistration(faceModel, group));
721
795
  }
722
- // @Trace()
723
- register(component) {
724
- this._unorderedChildren.push(component);
725
- return Disposable.disposableThatRuns(() => {
726
- this._unorderedChildren.remove(component);
727
- });
796
+ registerFlex(component) {
797
+ return this.register(new Registration.FlexRegistration());
728
798
  }
729
- onCommandFired() {
730
- this.triggers.forEach(trigger => {
731
- if (trigger.menuOpen) {
732
- trigger.closeMenu();
733
- }
734
- });
799
+ registerSeparator(component) {
800
+ return this.register(new Registration.SeparatorRegistration());
735
801
  }
736
- getFace() {
737
- return this.faceAdapter.face;
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;
738
812
  }
739
813
  }
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
- };
814
+ (function (CommandGroup) {
815
+ class Root extends CommandGroup {
816
+ constructor() {
817
+ super();
818
+ }
819
+ isRoot() {
820
+ return true;
821
+ }
822
+ }
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();
846
+ }
847
+ CommandGroup.factory = factory;
848
+ })(CommandGroup || (CommandGroup = {}));
755
849
 
756
- /**
757
- *
758
- */
759
- class PopupMenuComponent extends AbstractPopupMenuComponent {
760
- constructor(element, parent) {
761
- super(element, parent);
850
+ class CommandGroupComponent extends CommandGroup {
851
+ constructor(parent) {
852
+ super(parent);
853
+ this.parent = parent;
854
+ this.xPosition = 'after';
855
+ this.yPosition = 'below';
762
856
  const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
763
- // group.faceListModel = chain(this.faceModel).mapToList(face => [face]);
857
+ this.faceListModel = chain(this.faceModel).mapToList(v => [v]);
858
+ this.parent.registerGroup(this, this.faceListModel);
764
859
  }
765
860
  }
766
- PopupMenuComponent.decorators = [
861
+ CommandGroupComponent.decorators = [
767
862
  { type: Component, args: [{
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",
863
+ selector: 'aup-command-group',
864
+ template: '',
770
865
  providers: [
771
- { provide: POPUP_CONTAINER, useExisting: PopupMenuComponent }
866
+ { provide: CommandGroup, useExisting: CommandGroupComponent }
772
867
  ]
773
868
  },] }
774
869
  ];
775
- PopupMenuComponent.ctorParameters = () => [
776
- { type: ElementRef },
777
- { type: undefined, decorators: [{ type: Inject, args: [POPUP_CONTAINER,] }, { type: Optional }, { type: SkipSelf }] }
870
+ CommandGroupComponent.ctorParameters = () => [
871
+ { type: CommandGroup, decorators: [{ type: SkipSelf }] }
778
872
  ];
779
- PopupMenuComponent.propDecorators = {
873
+ CommandGroupComponent.propDecorators = {
780
874
  faceModel: [{ type: Input }],
781
- face: [{ type: Input }]
875
+ face: [{ type: Input }],
876
+ xPosition: [{ type: Input }],
877
+ yPosition: [{ type: Input }]
782
878
  };
783
879
  __decorate([
784
- TrackExternal({ delegateTo: 'faceModelDelegate' }),
880
+ TrackExternal(),
785
881
  __metadata("design:type", ValueModel)
786
- ], PopupMenuComponent.prototype, "faceModel", void 0);
882
+ ], CommandGroupComponent.prototype, "faceModel", void 0);
787
883
  __decorate([
788
884
  StoreInValueModel('faceModel'),
789
885
  __metadata("design:type", Object)
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
- };
886
+ ], CommandGroupComponent.prototype, "face", void 0);
871
887
 
872
888
  /**
873
889
  * Custom CSS:
@@ -932,12 +948,82 @@ __decorate([
932
948
  __metadata("design:type", Array)
933
949
  ], CommandFaceComponent.prototype, "_rawFaces", void 0);
934
950
 
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
+
935
1017
  /**
936
1018
  *
937
1019
  */
938
1020
  class FlexComponent extends DisposableComponent {
939
- constructor() {
1021
+ constructor(parent) {
940
1022
  super();
1023
+ this.parent = parent;
1024
+ if (parent) {
1025
+ parent.registerFlex(this);
1026
+ }
941
1027
  }
942
1028
  ngOnInit() {
943
1029
  }
@@ -948,41 +1034,48 @@ FlexComponent.decorators = [
948
1034
  template: ``
949
1035
  },] }
950
1036
  ];
951
- FlexComponent.ctorParameters = () => [];
1037
+ FlexComponent.ctorParameters = () => [
1038
+ { type: CommandGroup }
1039
+ ];
952
1040
 
1041
+ const ɵ0 = CommandGroup.factory;
953
1042
  /**
954
1043
  *
955
1044
  */
956
- class MoreMenuComponent extends AbstractPopupMenuComponent {
957
- constructor(element, parent) {
958
- super(element, parent);
1045
+ class MoreMenuComponent extends DisposableComponent {
1046
+ constructor(group) {
1047
+ super();
1048
+ this.group = group;
959
1049
  this.tooltipModel = new MutableValueModel();
960
1050
  const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
961
- this.faceModelDelegate.setDelegate(chain(this.tooltipModel).map(tooltip => {
962
- return {
963
- icon: () => 'mat:more_vert',
964
- tooltip() {
965
- return tooltip;
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
+ }
966
1059
  }
967
- };
968
- }, { allowNil: true }));
1060
+ ];
1061
+ }, { allowNil: true });
969
1062
  }
970
- get face() {
971
- return this.faceModelDelegate.value;
1063
+ ngOnInit() {
1064
+ }
1065
+ // @Trace()
1066
+ ngAfterContentInit() {
1067
+ this.group.initialise();
972
1068
  }
973
1069
  }
974
1070
  MoreMenuComponent.decorators = [
975
1071
  { type: Component, args: [{
976
1072
  selector: 'aup-more-menu',
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
- ]
1073
+ template: '<aup-command-group-renderer [renderRootNode]="true" [groupViewDataModel]="group.rootTemplate"></aup-command-group-renderer>',
1074
+ providers: [{ provide: CommandGroup, useFactory: ɵ0 }]
981
1075
  },] }
982
1076
  ];
983
1077
  MoreMenuComponent.ctorParameters = () => [
984
- { type: ElementRef },
985
- { type: undefined, decorators: [{ type: Inject, args: [POPUP_CONTAINER,] }, { type: Optional }, { type: SkipSelf }] }
1078
+ { type: CommandGroup }
986
1079
  ];
987
1080
  MoreMenuComponent.propDecorators = {
988
1081
  tooltip: [{ type: Input }]
@@ -992,6 +1085,111 @@ __decorate([
992
1085
  __metadata("design:type", String)
993
1086
  ], MoreMenuComponent.prototype, "tooltip", void 0);
994
1087
 
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
+
995
1193
  class FocusContainerComponent extends DisposableComponent {
996
1194
  constructor(focusManager) {
997
1195
  super();
@@ -1999,7 +2197,7 @@ SelectHeaderCellRendererComponent.ctorParameters = () => [];
1999
2197
 
2000
2198
  const noop = () => {
2001
2199
  };
2002
- const ɵ0 = noop;
2200
+ const ɵ0$3 = noop;
2003
2201
  const CELL_RENDERER_COMPONENT_ROW_CACHE = Symbol("aup-cell-renderer:row-data-cache");
2004
2202
  class ColumnModel {
2005
2203
  constructor(columnId, defaults) {
@@ -2889,12 +3087,13 @@ ComponentsModule.decorators = [
2889
3087
  ToolBarComponent,
2890
3088
  CommandComponent,
2891
3089
  PopupMenuComponent,
3090
+ CommandGroupComponent,
2892
3091
  CommandFaceComponent,
2893
3092
  MoreMenuComponent,
2894
3093
  SeparatorComponent,
2895
3094
  FlexComponent,
2896
- AbstractPopupMenuComponent,
2897
- PopupMenuRendererComponent
3095
+ CommandGroupMenuRendererComponent,
3096
+ CommandGroupRendererComponent
2898
3097
  ],
2899
3098
  imports: [
2900
3099
  CommonModule,
@@ -2941,6 +3140,7 @@ ComponentsModule.decorators = [
2941
3140
  IconComponent,
2942
3141
  SectionHeaderComponent,
2943
3142
  TableRowMenuComponent,
3143
+ CommandGroupComponent,
2944
3144
  ToolBarComponent,
2945
3145
  CommandComponent,
2946
3146
  PopupMenuComponent,
@@ -5956,11 +6156,10 @@ function leftRightPlaceAnimation(duration) {
5956
6156
  const LEFT_RIGHT_PLACE_ANIMATION = leftRightPlaceAnimation('0.3s');
5957
6157
 
5958
6158
  class PlaceOutletComponent extends DisposableComponent {
5959
- constructor(router, placeRouter, placeAuthService, placeConfig, parentOutlet) {
6159
+ constructor(router, placeRouter, placeConfig, parentOutlet) {
5960
6160
  super();
5961
6161
  this.router = router;
5962
6162
  this.placeRouter = placeRouter;
5963
- this.placeAuthService = placeAuthService;
5964
6163
  this.placeConfig = placeConfig;
5965
6164
  this.placeChanged = new EventEmitter();
5966
6165
  this.outletActivated = new MutableValueModel(false);
@@ -6005,13 +6204,6 @@ class PlaceOutletComponent extends DisposableComponent {
6005
6204
  chain(this._activePlaceModel)
6006
6205
  .postponeWhile(this.navigationInProgress)
6007
6206
  .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
- });
6015
6207
  }
6016
6208
  // @Trace()
6017
6209
  ngOnInit() {
@@ -6133,7 +6325,6 @@ PlaceOutletComponent.decorators = [
6133
6325
  PlaceOutletComponent.ctorParameters = () => [
6134
6326
  { type: Router },
6135
6327
  { type: PlaceRouter },
6136
- { type: undefined, decorators: [{ type: Inject, args: [PLACE_AUTH_SERVICE,] }] },
6137
6328
  { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [AUP_PLACE_CONFIG,] }] },
6138
6329
  { type: PlaceOutletComponent, decorators: [{ type: SkipSelf }, { type: Optional }] }
6139
6330
  ];
@@ -6712,28 +6903,17 @@ class PlaceGuard {
6712
6903
  this.interactionService = interactionService;
6713
6904
  this.injector = injector;
6714
6905
  }
6715
- // @Trace()
6716
6906
  canActivate(activatedRoute, state) {
6717
6907
  return __awaiter(this, void 0, void 0, function* () {
6718
6908
  if (PlaceComponent.isPlaceComponentConstructor(activatedRoute.component)) {
6719
6909
  const placeDefinition = PlaceComponent.getDefinition(activatedRoute.component);
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
- }
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.handleNotAuthorised(activatedRoute, state));
6737
6917
  }
6738
6918
  const result = yield this.cleanInteractionState(activatedRoute, state, () => __awaiter(this, void 0, void 0, function* () {
6739
6919
  // Parse our route params.
@@ -6762,7 +6942,6 @@ class PlaceGuard {
6762
6942
  }
6763
6943
  });
6764
6944
  }
6765
- // @Trace()
6766
6945
  canDeactivate(component, currentRoute, currentState, nextState) {
6767
6946
  return __awaiter(this, void 0, void 0, function* () {
6768
6947
  const currentUrl = this.urlService.parseUrl(currentState.url);
@@ -6771,14 +6950,13 @@ class PlaceGuard {
6771
6950
  return result instanceof UrlSnapshot ? result.urlTree : result;
6772
6951
  });
6773
6952
  }
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;
6953
+ handleGuardResult(result) {
6954
+ if (result instanceof UrlSnapshot) {
6955
+ return result.urlTree;
6956
+ }
6957
+ else {
6958
+ return this.urlService.createUrlSnapshot(result).urlTree;
6959
+ }
6782
6960
  }
6783
6961
  // protected async ensureAuthenticatedThen(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot, next: (placeDefinition: PlaceDefinition) => Promise<boolean | UrlTree>): Promise<boolean | UrlTree> {
6784
6962
  // const authoriseResult = placeDefinition.authenticate ? await this.isAuthorised(activatedRoute, state) : true;
@@ -6801,7 +6979,6 @@ class PlaceGuard {
6801
6979
  // return (authorised instanceof Observable) ? authorised.toPromise() : authorised;
6802
6980
  // }
6803
6981
  // abstract getAuthGuard(injector: Injector): CanActivate;
6804
- // @Trace()
6805
6982
  cleanInteractionState(route, state, next) {
6806
6983
  return __awaiter(this, void 0, void 0, function* () {
6807
6984
  const url = this.urlService.parseUrl(state.url);
@@ -6829,6 +7006,30 @@ PlaceGuard.ctorParameters = () => [
6829
7006
  { type: InteractionService },
6830
7007
  { type: Injector }
6831
7008
  ];
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);
6832
7033
 
6833
7034
  var Formatter;
6834
7035
  (function (Formatter) {
@@ -6930,5 +7131,5 @@ function VisitParameterList(options) {
6930
7131
  * Generated bundle index. Do not edit.
6931
7132
  */
6932
7133
 
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 };
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 };
6934
7135
  //# sourceMappingURL=coolon-angular-ui-powerups.js.map