@coolon/angular-ui-powerups 3.7.0-alpha.1 → 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 +64 -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
@@ -857,457 +857,371 @@
857
857
  CommandFace.Adapter = Adapter;
858
858
  })(exports.CommandFace || (exports.CommandFace = {}));
859
859
 
860
- exports.ViewData = /** @class */ (function () {
861
- function ViewData() {
862
- }
863
- return ViewData;
864
- }());
865
- (function (ViewData) {
866
- var FaceData = /** @class */ (function (_super) {
867
- __extends(FaceData, _super);
868
- function FaceData(faces) {
869
- var _this = _super.call(this) || this;
870
- _this.faces = faces;
871
- pectin.assert.notNil(faces);
872
- return _this;
873
- }
874
- Object.defineProperty(FaceData.prototype, "activeFaceAdapter", {
875
- get: function () {
876
- return new exports.CommandFace.Adapter(this.faces.length > 0 ? this.faces[0] : undefined);
877
- },
878
- enumerable: false,
879
- configurable: true
880
- });
881
- return FaceData;
882
- }(ViewData));
883
- __decorate([
884
- src.Memoize(),
885
- __metadata("design:type", exports.CommandFace.Adapter),
886
- __metadata("design:paramtypes", [])
887
- ], FaceData.prototype, "activeFaceAdapter", null);
888
- ViewData.FaceData = FaceData;
889
- var GroupData = /** @class */ (function (_super) {
890
- __extends(GroupData, _super);
891
- function GroupData(faces, xPosition, yPosition, children) {
892
- var _this = _super.call(this, faces) || this;
893
- _this.xPosition = xPosition;
894
- _this.yPosition = yPosition;
895
- _this.children = children;
896
- return _this;
897
- }
898
- Object.defineProperty(GroupData.prototype, "hasMixedIcons", {
899
- get: function () {
900
- var hasFaces = this.children.filter(function (c) { return ViewData.hasFace(c); });
901
- var iconCount = hasFaces.filter(function (c) { return !!c.activeFaceAdapter.icon; }).length;
902
- return iconCount > 0 && hasFaces.length !== iconCount;
903
- },
904
- enumerable: false,
905
- configurable: true
906
- });
907
- return GroupData;
908
- }(FaceData));
909
- __decorate([
910
- src.Memoize(),
911
- __metadata("design:type", Boolean),
912
- __metadata("design:paramtypes", [])
913
- ], GroupData.prototype, "hasMixedIcons", null);
914
- ViewData.GroupData = GroupData;
915
- var CommandData = /** @class */ (function (_super) {
916
- __extends(CommandData, _super);
917
- function CommandData(command, faces) {
918
- var _this = _super.call(this, faces) || this;
919
- _this.command = command;
920
- return _this;
921
- }
922
- return CommandData;
923
- }(FaceData));
924
- ViewData.CommandData = CommandData;
925
- var SeparatorData = /** @class */ (function (_super) {
926
- __extends(SeparatorData, _super);
927
- function SeparatorData() {
928
- return _super !== null && _super.apply(this, arguments) || this;
929
- }
930
- return SeparatorData;
931
- }(ViewData));
932
- ViewData.SeparatorData = SeparatorData;
933
- var FlexData = /** @class */ (function (_super) {
934
- __extends(FlexData, _super);
935
- function FlexData() {
936
- return _super !== null && _super.apply(this, arguments) || this;
937
- }
938
- return FlexData;
939
- }(ViewData));
940
- ViewData.FlexData = FlexData;
941
- function as(type, viewData) {
942
- return viewData instanceof type ? viewData : pectin.lang.illegalState("expected instance of " + type.name + ", got " + viewData.constructor.name);
943
- }
944
- ViewData.as = as;
945
- function getCommand(data) {
946
- return as(CommandData, data).command;
947
- }
948
- ViewData.getCommand = getCommand;
949
- function getTooltip(data) {
950
- return as(FaceData, data).activeFaceAdapter.tooltip;
951
- }
952
- ViewData.getTooltip = getTooltip;
953
- function getStyle(data) {
954
- return as(FaceData, data).activeFaceAdapter.style;
955
- }
956
- ViewData.getStyle = getStyle;
957
- function getColor(data) {
958
- return as(FaceData, data).activeFaceAdapter.color;
959
- }
960
- ViewData.getColor = getColor;
961
- function hasText(data) {
962
- return !!as(FaceData, data).activeFaceAdapter.text;
963
- }
964
- ViewData.hasText = hasText;
965
- function getFaces(data) {
966
- return as(FaceData, data).faces;
967
- }
968
- ViewData.getFaces = getFaces;
969
- function asGroup(viewData) {
970
- return as(GroupData, viewData);
971
- }
972
- ViewData.asGroup = asGroup;
973
- function hasMixedIcons(data) {
974
- return as(GroupData, data).hasMixedIcons;
975
- }
976
- ViewData.hasMixedIcons = hasMixedIcons;
977
- function isGroup(data) {
978
- return data instanceof GroupData;
979
- }
980
- ViewData.isGroup = isGroup;
981
- function hasFace(data) {
982
- return data instanceof FaceData;
983
- }
984
- ViewData.hasFace = hasFace;
985
- function isCommand(data) {
986
- return data instanceof CommandData;
987
- }
988
- ViewData.isCommand = isCommand;
989
- function isSeparator(data) {
990
- return data instanceof SeparatorData;
991
- }
992
- ViewData.isSeparator = isSeparator;
993
- function isFlex(data) {
994
- return data instanceof FlexData;
995
- }
996
- ViewData.isFlex = isFlex;
997
- })(exports.ViewData || (exports.ViewData = {}));
998
-
999
- var CommandGroupMenuRendererComponent = /** @class */ (function (_super) {
1000
- __extends(CommandGroupMenuRendererComponent, _super);
1001
- function CommandGroupMenuRendererComponent(parent) {
860
+ var PopupAwareComponent = /** @class */ (function (_super) {
861
+ __extends(PopupAwareComponent, _super);
862
+ function PopupAwareComponent(element, parent) {
1002
863
  var _this = _super.call(this) || this;
864
+ _this.element = element;
1003
865
  _this.parent = parent;
1004
- _this.groupViewDataModel = new pectin.MutableValueModel();
1005
- _this.commandFired = new i0.EventEmitter();
1006
- _this.ViewData = exports.ViewData;
1007
- _this.TrackBy = exports.TrackBy;
1008
- var _a = pectin.Dsl.disposeWith(_this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
1009
- _this.children = chain(_this.groupViewDataModel).pluckList('children');
1010
- _this.hasMixedIcons = chain(_this.groupViewDataModel).pluck('hasMixedIcons');
866
+ if (parent) {
867
+ _this.registerDisposable(_this.parent.register(_this));
868
+ }
1011
869
  return _this;
1012
870
  }
1013
- CommandGroupMenuRendererComponent.prototype.getCommand = function (data) {
1014
- var _this = this;
1015
- var command = exports.ViewData.getCommand(data);
1016
- var when = pectin.Dsl.disposeWith(this).when;
1017
- when(command.busy).becomesFalsey(function () { return _this.commandFired.emit(); });
1018
- return command;
871
+ Object.defineProperty(PopupAwareComponent.prototype, "componentIndex", {
872
+ get: function () {
873
+ return this.computeComponentIndex();
874
+ },
875
+ enumerable: false,
876
+ configurable: true
877
+ });
878
+ PopupAwareComponent.prototype.computeComponentIndex = function () {
879
+ var node = this.element.nativeElement;
880
+ var index = 0;
881
+ while ((node = node.previousElementSibling)) {
882
+ index++;
883
+ }
884
+ return index;
885
+ };
886
+ PopupAwareComponent.prototype.getFace = function () {
887
+ return undefined;
1019
888
  };
1020
- return CommandGroupMenuRendererComponent;
889
+ return PopupAwareComponent;
1021
890
  }(DisposableComponent));
1022
- CommandGroupMenuRendererComponent.decorators = [
1023
- { type: i0.Component, args: [{
1024
- selector: 'aup-command-group-menu',
1025
- 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"
1026
- },] }
1027
- ];
1028
- CommandGroupMenuRendererComponent.ctorParameters = function () { return [
1029
- { type: CommandGroupMenuRendererComponent, decorators: [{ type: i0.Optional }, { type: i0.SkipSelf }] }
1030
- ]; };
1031
- CommandGroupMenuRendererComponent.propDecorators = {
1032
- menuComponent: [{ type: i0.ViewChild, args: ['menu', { static: true },] }],
1033
- groupViewData: [{ type: i0.Input }],
1034
- commandFired: [{ type: i0.Output }],
1035
- triggers: [{ type: i0.ViewChildren, args: [menu.MatMenuTrigger,] }]
1036
- };
1037
- __decorate([
1038
- pectin.StoreInValueModel('groupViewDataModel'),
1039
- __metadata("design:type", exports.ViewData.GroupData)
1040
- ], CommandGroupMenuRendererComponent.prototype, "groupViewData", void 0);
1041
891
 
1042
- var CommandGroupRendererComponent = /** @class */ (function (_super) {
1043
- __extends(CommandGroupRendererComponent, _super);
1044
- function CommandGroupRendererComponent() {
1045
- var _this = _super.call(this) || this;
1046
- _this.renderRootNode = true;
1047
- _this.ViewData = exports.ViewData;
1048
- _this.TrackBy = exports.TrackBy;
1049
- var _a = pectin.Dsl.disposeWith(_this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
1050
- _this.childViewDataModels = chain(_this.groupViewDataModel)
1051
- .pluckList('children');
892
+ var POPUP_CONTAINER = new i0.InjectionToken('popup-component');
893
+
894
+ /**
895
+ *
896
+ */
897
+ var CommandComponent = /** @class */ (function (_super) {
898
+ __extends(CommandComponent, _super);
899
+ function CommandComponent(element, parent) {
900
+ var _this = _super.call(this, element, parent) || this;
901
+ _this.CommandFace = exports.CommandFace;
902
+ var _a = pectin.Dsl.disposeWith(_this), chain = _a.chain, switchOn = _a.switchOn;
903
+ _this.faces = chain(_this.command.busy).mapToList(function (busy) {
904
+ return busy ?
905
+ [_this.busyFaceModel.value, _this.faceModel.value] :
906
+ [_this.faceModel.value, _this.busyFaceModel.value];
907
+ }, { allowNil: true, dependsOn: [_this.faceModel, _this.busyFaceModel] })
908
+ .rejectNil();
909
+ _this.activeFace = _this.faces.first();
910
+ _this.buttonStyle = chain(_this.activeFace).map(function (f) { return exports.CommandFace.getStyleOf(f); });
911
+ _this.colorModel = chain(_this.activeFace).map(function (f) { return exports.CommandFace.getColorOf(f); });
1052
912
  return _this;
1053
913
  }
1054
- return CommandGroupRendererComponent;
1055
- }(DisposableComponent));
1056
- CommandGroupRendererComponent.decorators = [
914
+ CommandComponent.prototype.isActive = function (face) {
915
+ return this.activeFace.query().equals(face);
916
+ };
917
+ CommandComponent.prototype.ngOnInit = function () {
918
+ };
919
+ CommandComponent.prototype.ngAfterViewInit = function () {
920
+ // console.log(this.element.nativeElement.previousSibling)
921
+ };
922
+ CommandComponent.prototype.getFace = function () {
923
+ return this.face;
924
+ };
925
+ return CommandComponent;
926
+ }(PopupAwareComponent));
927
+ CommandComponent.decorators = [
1057
928
  { type: i0.Component, args: [{
1058
- selector: 'aup-command-group-renderer',
1059
- 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",
1060
- 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}"]
929
+ selector: 'aup-command',
930
+ 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",
931
+ styles: [":host{display:inline-flex;flex-direction:row;justify-content:stretch}button{flex:1}"]
1061
932
  },] }
1062
933
  ];
1063
- CommandGroupRendererComponent.ctorParameters = function () { return []; };
1064
- CommandGroupRendererComponent.propDecorators = {
1065
- groupViewDataModel: [{ type: i0.Input }],
1066
- groupViewData: [{ type: i0.Input }],
1067
- renderRootNode: [{ type: i0.Input }, { type: i0.HostBinding, args: ['class.render-root',] }]
934
+ CommandComponent.ctorParameters = function () { return [
935
+ { type: i0.ElementRef },
936
+ { type: undefined, decorators: [{ type: i0.Inject, args: [POPUP_CONTAINER,] }, { type: i0.Optional }] }
937
+ ]; };
938
+ CommandComponent.propDecorators = {
939
+ command: [{ type: i0.Input }],
940
+ faceModel: [{ type: i0.Input }],
941
+ face: [{ type: i0.Input }],
942
+ busyFaceModel: [{ type: i0.Input }],
943
+ busyFace: [{ type: i0.Input }]
1068
944
  };
945
+ __decorate([
946
+ pectin.TrackExternal(),
947
+ __metadata("design:type", pectin.Command)
948
+ ], CommandComponent.prototype, "command", void 0);
1069
949
  __decorate([
1070
950
  pectin.TrackExternal(),
1071
951
  __metadata("design:type", pectin.ValueModel)
1072
- ], CommandGroupRendererComponent.prototype, "groupViewDataModel", void 0);
952
+ ], CommandComponent.prototype, "faceModel", void 0);
953
+ __decorate([
954
+ pectin.StoreInValueModel('faceModel'),
955
+ __metadata("design:type", Object)
956
+ ], CommandComponent.prototype, "face", void 0);
957
+ __decorate([
958
+ pectin.TrackExternal(),
959
+ __metadata("design:type", pectin.ValueModel)
960
+ ], CommandComponent.prototype, "busyFaceModel", void 0);
1073
961
  __decorate([
1074
- pectin.StoreInValueModel('groupViewDataModel'),
1075
- __metadata("design:type", exports.ViewData.GroupData)
1076
- ], CommandGroupRendererComponent.prototype, "groupViewData", void 0);
962
+ pectin.StoreInValueModel('busyFaceModel'),
963
+ __metadata("design:type", Object)
964
+ ], CommandComponent.prototype, "busyFace", void 0);
1077
965
 
1078
- exports.Registration = /** @class */ (function (_super) {
1079
- __extends(Registration, _super);
1080
- function Registration() {
1081
- return _super !== null && _super.apply(this, arguments) || this;
1082
- }
1083
- return Registration;
1084
- }(pectin.GarbageCollector));
1085
- (function (Registration) {
1086
- var FaceRegistration = /** @class */ (function (_super) {
1087
- __extends(FaceRegistration, _super);
1088
- function FaceRegistration(faceListModel) {
1089
- var _this = _super.call(this) || this;
1090
- _this.faceListModel = faceListModel;
1091
- return _this;
1092
- }
1093
- return FaceRegistration;
1094
- }(Registration));
1095
- Registration.FaceRegistration = FaceRegistration;
1096
- var CommandRegistration = /** @class */ (function (_super) {
1097
- __extends(CommandRegistration, _super);
1098
- function CommandRegistration(command, faceListModel) {
1099
- var _this = _super.call(this, faceListModel) || this;
1100
- _this.command = command;
1101
- return _this;
1102
- }
1103
- CommandRegistration.prototype.toTemplate = function () {
1104
- return new exports.ViewData.CommandData(this.command, this.faceListModel.value);
1105
- };
1106
- return CommandRegistration;
1107
- }(FaceRegistration));
1108
- Registration.CommandRegistration = CommandRegistration;
1109
- var GroupRegistration = /** @class */ (function (_super) {
1110
- __extends(GroupRegistration, _super);
1111
- function GroupRegistration(faceModel, group) {
1112
- var _this = _super.call(this, faceModel) || this;
1113
- _this.group = group;
1114
- return _this;
1115
- }
1116
- GroupRegistration.prototype.toTemplate = function () {
1117
- return new exports.ViewData.GroupData(this.faceListModel.value, this.group.xPosition, this.group.yPosition, this.group.registrations.value.map(function (r) { return r.toTemplate(); }));
1118
- };
1119
- return GroupRegistration;
1120
- }(FaceRegistration));
1121
- Registration.GroupRegistration = GroupRegistration;
1122
- var SeparatorRegistration = /** @class */ (function (_super) {
1123
- __extends(SeparatorRegistration, _super);
1124
- function SeparatorRegistration() {
1125
- var _this = _super.apply(this, __spread(arguments)) || this;
1126
- _this.template = new exports.ViewData.SeparatorData();
1127
- return _this;
1128
- }
1129
- SeparatorRegistration.prototype.toTemplate = function () {
1130
- return this.template;
1131
- };
1132
- return SeparatorRegistration;
1133
- }(Registration));
1134
- Registration.SeparatorRegistration = SeparatorRegistration;
1135
- var FlexRegistration = /** @class */ (function (_super) {
1136
- __extends(FlexRegistration, _super);
1137
- function FlexRegistration() {
1138
- var _this = _super.apply(this, __spread(arguments)) || this;
1139
- _this.template = new exports.ViewData.FlexData();
1140
- return _this;
1141
- }
1142
- FlexRegistration.prototype.toTemplate = function () {
1143
- return this.template;
1144
- };
1145
- return FlexRegistration;
1146
- }(Registration));
1147
- Registration.FlexRegistration = FlexRegistration;
1148
- function hasFace(entry) {
1149
- return entry instanceof CommandRegistration || entry instanceof GroupRegistration;
1150
- }
1151
- Registration.hasFace = hasFace;
1152
- })(exports.Registration || (exports.Registration = {}));
1153
-
1154
- exports.CommandGroup = /** @class */ (function (_super) {
1155
- __extends(CommandGroup, _super);
1156
- function CommandGroup(parent) {
966
+ exports.CommandContainer = /** @class */ (function (_super) {
967
+ __extends(CommandContainer, _super);
968
+ function CommandContainer(parent) {
1157
969
  var _this = _super.call(this) || this;
1158
970
  _this.parent = parent;
1159
- _this._rootTemplate = new pectin.MutableValueModel();
1160
- _this._registrations = new pectin.MutableListModel();
1161
- var _a = pectin.Dsl.disposeWith(_this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
1162
- _this.childTemplates = chain(_this._rootTemplate).pluckList('children');
1163
- _this.initialised = chain(_this._rootTemplate).isNotNil();
1164
971
  return _this;
1165
972
  }
1166
- CommandGroup.prototype.initialise = function () {
1167
- this.rebuildTemplates();
1168
- };
1169
- Object.defineProperty(CommandGroup.prototype, "rootTemplate", {
973
+ Object.defineProperty(CommandContainer.prototype, "depth", {
1170
974
  get: function () {
1171
- return this._rootTemplate.readonly;
975
+ return this.hasParent() ? this.parent.depth + 1 : 0;
1172
976
  },
1173
977
  enumerable: false,
1174
978
  configurable: true
1175
979
  });
1176
- Object.defineProperty(CommandGroup.prototype, "registrations", {
980
+ CommandContainer.prototype.hasParent = function () {
981
+ return !!this.parent;
982
+ };
983
+ Object.defineProperty(CommandContainer.prototype, "orientation", {
1177
984
  get: function () {
1178
- return this._registrations.readonly;
985
+ return CommandContainer.Orientation.VERTICAL;
1179
986
  },
1180
987
  enumerable: false,
1181
988
  configurable: true
1182
989
  });
1183
- CommandGroup.prototype.notifyChanged = function () {
1184
- if (this.parent) {
1185
- this.parent.notifyChanged();
1186
- }
1187
- else {
1188
- this.rebuildTemplates();
1189
- }
1190
- };
1191
- CommandGroup.prototype.notifyChildFaceChanged = function (is, was) {
1192
- this.notifyChanged();
1193
- };
1194
- CommandGroup.prototype.rebuildTemplates = function () {
1195
- this._rootTemplate.value = new exports.ViewData.GroupData(this.faceListModel.value, this.xPosition, this.yPosition, this.registrations.value.map(function (r) { return r.toTemplate(); }));
1196
- };
1197
- Object.defineProperty(CommandGroup.prototype, "depth", {
990
+ return CommandContainer;
991
+ }(pectin.GarbageCollector));
992
+ (function (CommandContainer) {
993
+ CommandContainer.Orientation = typescriptStringEnums.Enum({ HORIZONTAL: 'horizontal', VERTICAL: 'vertical' });
994
+ })(exports.CommandContainer || (exports.CommandContainer = {}));
995
+
996
+ /**
997
+ *
998
+ */
999
+ var ToolBarComponent = /** @class */ (function (_super) {
1000
+ __extends(ToolBarComponent, _super);
1001
+ function ToolBarComponent() {
1002
+ return _super.call(this) || this;
1003
+ }
1004
+ Object.defineProperty(ToolBarComponent.prototype, "orientation", {
1198
1005
  get: function () {
1199
- return this.isRoot() ? 0 : this.parent.depth + 1;
1006
+ return exports.CommandContainer.Orientation.HORIZONTAL;
1200
1007
  },
1201
1008
  enumerable: false,
1202
1009
  configurable: true
1203
1010
  });
1204
- CommandGroup.prototype.isRoot = function () {
1205
- return false;
1206
- };
1207
- CommandGroup.prototype.registerCommand = function (command, faceListModel) {
1208
- return this.register(new exports.Registration.CommandRegistration(command, faceListModel));
1011
+ // @Trace()
1012
+ ToolBarComponent.prototype.ngOnInit = function () {
1209
1013
  };
1210
- CommandGroup.prototype.registerGroup = function (group, faceModel) {
1211
- return this.register(new exports.Registration.GroupRegistration(faceModel, group));
1014
+ // @Trace()
1015
+ ToolBarComponent.prototype.ngAfterContentInit = function () {
1016
+ // this.group.initialise();
1212
1017
  };
1213
- CommandGroup.prototype.registerFlex = function (component) {
1214
- return this.register(new exports.Registration.FlexRegistration());
1018
+ // @Trace()
1019
+ ToolBarComponent.prototype.ngAfterViewInit = function () {
1215
1020
  };
1216
- CommandGroup.prototype.registerSeparator = function (component) {
1217
- return this.register(new exports.Registration.SeparatorRegistration());
1021
+ return ToolBarComponent;
1022
+ }(exports.CommandContainer));
1023
+ ToolBarComponent.decorators = [
1024
+ { type: i0.Component, args: [{
1025
+ selector: 'aup-tool-bar',
1026
+ template: '<div class="toolbar-content"><ng-content></ng-content></div>',
1027
+ encapsulation: i0.ViewEncapsulation.None,
1028
+ 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}"]
1029
+ },] }
1030
+ ];
1031
+ ToolBarComponent.ctorParameters = function () { return []; };
1032
+
1033
+ /**
1034
+ *
1035
+ */
1036
+ var SeparatorComponent = /** @class */ (function (_super) {
1037
+ __extends(SeparatorComponent, _super);
1038
+ function SeparatorComponent(element, popupContainer, containerParent) {
1039
+ var _this = _super.call(this, element, popupContainer) || this;
1040
+ _this.containerParent = containerParent;
1041
+ return _this;
1042
+ }
1043
+ SeparatorComponent.prototype.isHorizontalContainer = function () {
1044
+ return this.containerParent instanceof ToolBarComponent && this.containerParent.orientation === exports.CommandContainer.Orientation.HORIZONTAL;
1218
1045
  };
1219
- CommandGroup.prototype.register = function (registration) {
1220
- var _this = this;
1221
- this._registrations.push(registration);
1222
- if (registration instanceof exports.Registration.FaceRegistration) {
1223
- var when = pectin.Dsl.disposeWith(registration).when;
1224
- when(registration.faceListModel).changes(function (is, was) {
1225
- _this.notifyChildFaceChanged(is, was);
1226
- }, { asLongAs: this.initialised });
1227
- }
1228
- registration.onDispose(function () { return _this._registrations.remove(registration); });
1229
- return registration;
1046
+ SeparatorComponent.prototype.ngOnInit = function () {
1230
1047
  };
1231
- return CommandGroup;
1232
- }(pectin.GarbageCollector));
1233
- (function (CommandGroup) {
1234
- var Root = /** @class */ (function (_super) {
1235
- __extends(Root, _super);
1236
- function Root() {
1237
- return _super.call(this) || this;
1238
- }
1239
- Root.prototype.isRoot = function () {
1240
- return true;
1241
- };
1242
- return Root;
1243
- }(CommandGroup));
1244
- __decorate([
1245
- pectin.TrackExternal(),
1246
- __metadata("design:type", pectin.ListModel)
1247
- ], Root.prototype, "faceListModel", void 0);
1248
- __decorate([
1249
- pectin.TrackExternal({ defaultValue: 'after' }),
1250
- __metadata("design:type", pectin.ValueModel)
1251
- ], Root.prototype, "xPositionModel", void 0);
1252
- __decorate([
1253
- pectin.StoreInValueModel('xPositionModel'),
1254
- __metadata("design:type", String)
1255
- ], Root.prototype, "xPosition", void 0);
1256
- __decorate([
1257
- pectin.TrackExternal({ defaultValue: 'below' }),
1258
- __metadata("design:type", pectin.ValueModel)
1259
- ], Root.prototype, "yPositionModel", void 0);
1260
- __decorate([
1261
- pectin.StoreInValueModel('yPositionModel'),
1262
- __metadata("design:type", String)
1263
- ], Root.prototype, "yPosition", void 0);
1264
- CommandGroup.Root = Root;
1265
- function factory() {
1266
- return new Root();
1267
- }
1268
- CommandGroup.factory = factory;
1269
- })(exports.CommandGroup || (exports.CommandGroup = {}));
1270
-
1271
- var CommandGroupComponent = /** @class */ (function (_super) {
1272
- __extends(CommandGroupComponent, _super);
1273
- function CommandGroupComponent(parent) {
1274
- var _this = _super.call(this, parent) || this;
1275
- _this.parent = parent;
1048
+ return SeparatorComponent;
1049
+ }(PopupAwareComponent));
1050
+ SeparatorComponent.decorators = [
1051
+ { type: i0.Component, args: [{
1052
+ selector: 'aup-separator',
1053
+ template: "\n <mat-divider [vertical]=\"!isHorizontalContainer()\"></mat-divider>",
1054
+ styles: [":host {\n }",
1055
+ ":host(.horizontal-container) {\n display: inline-flex;\n flex-direction: row;\n align-items: stretch;\n }"]
1056
+ },] }
1057
+ ];
1058
+ SeparatorComponent.ctorParameters = function () { return [
1059
+ { type: i0.ElementRef },
1060
+ { type: undefined, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [POPUP_CONTAINER,] }] },
1061
+ { type: exports.CommandContainer, decorators: [{ type: i0.Optional }] }
1062
+ ]; };
1063
+ SeparatorComponent.propDecorators = {
1064
+ isHorizontalContainer: [{ type: i0.HostBinding, args: ['class.horizontal-container',] }]
1065
+ };
1066
+
1067
+ /**
1068
+ *
1069
+ */
1070
+ var AbstractPopupMenuComponent = /** @class */ (function (_super) {
1071
+ __extends(AbstractPopupMenuComponent, _super);
1072
+ function AbstractPopupMenuComponent(element, parent) {
1073
+ var _this = _super.call(this, element, parent) || this;
1074
+ _this._unorderedChildren = new pectin.MutableListModel();
1075
+ _this.faceModelDelegate = new pectin.DelegatingValueModel();
1276
1076
  _this.xPosition = 'after';
1277
1077
  _this.yPosition = 'below';
1278
1078
  var _a = pectin.Dsl.disposeWith(_this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
1279
- _this.faceListModel = chain(_this.faceModel).mapToList(function (v) { return [v]; });
1280
- _this.parent.registerGroup(_this, _this.faceListModel);
1079
+ // group.faceListModel = chain(this.faceModel).mapToList(face => [face]);
1080
+ _this.faceAdapterModel = chain(_this.faceModelDelegate).map(function (f) { return new exports.CommandFace.Adapter(f); });
1081
+ _this.children = chain(_this._unorderedChildren).sortBy('componentIndex');
1281
1082
  return _this;
1282
1083
  }
1283
- return CommandGroupComponent;
1284
- }(exports.CommandGroup));
1285
- CommandGroupComponent.decorators = [
1084
+ AbstractPopupMenuComponent.prototype.ngAfterContentChecked = function () {
1085
+ // force the list to re-order as the child indicies may have changed.
1086
+ this._unorderedChildren.value = __spread(this._unorderedChildren.value);
1087
+ };
1088
+ Object.defineProperty(AbstractPopupMenuComponent.prototype, "faceAdapter", {
1089
+ get: function () {
1090
+ return this.faceAdapterModel.value;
1091
+ },
1092
+ enumerable: false,
1093
+ configurable: true
1094
+ });
1095
+ AbstractPopupMenuComponent.prototype.isRoot = function () {
1096
+ return !this.parent;
1097
+ };
1098
+ // @Trace()
1099
+ AbstractPopupMenuComponent.prototype.register = function (component) {
1100
+ var _this = this;
1101
+ this._unorderedChildren.push(component);
1102
+ return pectin.Disposable.disposableThatRuns(function () {
1103
+ _this._unorderedChildren.remove(component);
1104
+ });
1105
+ };
1106
+ AbstractPopupMenuComponent.prototype.onCommandFired = function () {
1107
+ this.triggers.forEach(function (trigger) {
1108
+ if (trigger.menuOpen) {
1109
+ trigger.closeMenu();
1110
+ }
1111
+ });
1112
+ };
1113
+ AbstractPopupMenuComponent.prototype.getFace = function () {
1114
+ return this.faceAdapter.face;
1115
+ };
1116
+ return AbstractPopupMenuComponent;
1117
+ }(PopupAwareComponent));
1118
+ AbstractPopupMenuComponent.decorators = [
1286
1119
  { type: i0.Component, args: [{
1287
- selector: 'aup-command-group',
1288
- template: '',
1289
- providers: [
1290
- { provide: exports.CommandGroup, useExisting: CommandGroupComponent }
1291
- ]
1120
+ selector: 'aup-abstract-popup-menu',
1121
+ template: ''
1292
1122
  },] }
1293
1123
  ];
1294
- CommandGroupComponent.ctorParameters = function () { return [
1295
- { type: exports.CommandGroup, decorators: [{ type: i0.SkipSelf }] }
1124
+ AbstractPopupMenuComponent.ctorParameters = function () { return [
1125
+ { type: i0.ElementRef },
1126
+ { type: undefined, decorators: [{ type: i0.Inject, args: [POPUP_CONTAINER,] }] }
1296
1127
  ]; };
1297
- CommandGroupComponent.propDecorators = {
1298
- faceModel: [{ type: i0.Input }],
1299
- face: [{ type: i0.Input }],
1128
+ AbstractPopupMenuComponent.propDecorators = {
1300
1129
  xPosition: [{ type: i0.Input }],
1301
- yPosition: [{ type: i0.Input }]
1130
+ yPosition: [{ type: i0.Input }],
1131
+ triggers: [{ type: i0.ViewChildren, args: [menu.MatMenuTrigger,] }]
1132
+ };
1133
+
1134
+ var PopupMenuRendererComponent = /** @class */ (function (_super) {
1135
+ __extends(PopupMenuRendererComponent, _super);
1136
+ function PopupMenuRendererComponent() {
1137
+ var _this = _super.call(this) || this;
1138
+ _this._childList = new pectin.DelegatingListModel();
1139
+ _this.commandFired = new i0.EventEmitter();
1140
+ _this.TrackBy = exports.TrackBy;
1141
+ var _a = pectin.Dsl.disposeWith(_this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
1142
+ // this.children = chain(this.groupViewDataModel).pluckList('children');
1143
+ // this.hasMixedIcons = chain(this.groupViewDataModel).pluck('hasMixedIcons');
1144
+ var faces = chain(_this._childList).map(function (child) {
1145
+ return child.getFace();
1146
+ }).rejectNil();
1147
+ var icons = faces.select(function (face) { return !!exports.CommandFace.getIconOf(face); });
1148
+ var iconCount = icons.count();
1149
+ var totalFaces = faces.count();
1150
+ _this.hasMixedIcons = valueOf.all(iconCount.isGreaterThan(0), totalFaces.doesNotEqual(iconCount)).areTruthy();
1151
+ return _this;
1152
+ }
1153
+ Object.defineProperty(PopupMenuRendererComponent.prototype, "parent", {
1154
+ get: function () {
1155
+ return this._parentComponent;
1156
+ },
1157
+ set: function (comp) {
1158
+ this._parentComponent = comp;
1159
+ this._childList.setDelegate(comp.children);
1160
+ },
1161
+ enumerable: false,
1162
+ configurable: true
1163
+ });
1164
+ Object.defineProperty(PopupMenuRendererComponent.prototype, "children", {
1165
+ get: function () {
1166
+ return this.parent.children.value;
1167
+ },
1168
+ enumerable: false,
1169
+ configurable: true
1170
+ });
1171
+ PopupMenuRendererComponent.prototype.executeCommand = function (data) {
1172
+ var _this = this;
1173
+ if (this.isCommand(data)) {
1174
+ data.command.execute().finally(function () {
1175
+ _this.commandFired.emit();
1176
+ });
1177
+ }
1178
+ };
1179
+ PopupMenuRendererComponent.prototype.isEnabled = function (data) {
1180
+ return true; //ViewData.getCommand(data).enabled.value;
1181
+ };
1182
+ // @Trace()
1183
+ PopupMenuRendererComponent.prototype.onCommandFired = function () {
1184
+ this.commandFired.emit();
1185
+ this.triggers.forEach(function (trigger) {
1186
+ if (trigger.menuOpen) {
1187
+ trigger.closeMenu();
1188
+ }
1189
+ });
1190
+ };
1191
+ PopupMenuRendererComponent.prototype.isCommand = function (child) {
1192
+ return child instanceof CommandComponent;
1193
+ };
1194
+ PopupMenuRendererComponent.prototype.isPopupMenu = function (child) {
1195
+ return child instanceof AbstractPopupMenuComponent;
1196
+ };
1197
+ PopupMenuRendererComponent.prototype.isSeparator = function (child) {
1198
+ return child instanceof SeparatorComponent;
1199
+ };
1200
+ PopupMenuRendererComponent.prototype.getTooltip = function (child) {
1201
+ return this.isCommand(child) ? exports.CommandFace.getTooltipOf(child.face) : undefined;
1202
+ };
1203
+ PopupMenuRendererComponent.prototype.getFaces = function (child) {
1204
+ return this.isCommand(child) ?
1205
+ child.faces.value :
1206
+ this.isPopupMenu(child) ?
1207
+ [child.faceAdapter.face] :
1208
+ undefined;
1209
+ };
1210
+ return PopupMenuRendererComponent;
1211
+ }(DisposableComponent));
1212
+ PopupMenuRendererComponent.decorators = [
1213
+ { type: i0.Component, args: [{
1214
+ selector: 'aup-popup-menu-renderer',
1215
+ 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"
1216
+ },] }
1217
+ ];
1218
+ PopupMenuRendererComponent.ctorParameters = function () { return []; };
1219
+ PopupMenuRendererComponent.propDecorators = {
1220
+ parent: [{ type: i0.Input }],
1221
+ menuComponent: [{ type: i0.ViewChild, args: ['menu', { static: true },] }],
1222
+ commandFired: [{ type: i0.Output }],
1223
+ triggers: [{ type: i0.ViewChildren, args: [menu.MatMenuTrigger,] }]
1302
1224
  };
1303
- __decorate([
1304
- pectin.TrackExternal(),
1305
- __metadata("design:type", pectin.ValueModel)
1306
- ], CommandGroupComponent.prototype, "faceModel", void 0);
1307
- __decorate([
1308
- pectin.StoreInValueModel('faceModel'),
1309
- __metadata("design:type", Object)
1310
- ], CommandGroupComponent.prototype, "face", void 0);
1311
1225
 
1312
1226
  /**
1313
1227
  * Custom CSS:
@@ -1383,87 +1297,13 @@
1383
1297
  __metadata("design:type", Array)
1384
1298
  ], CommandFaceComponent.prototype, "_rawFaces", void 0);
1385
1299
 
1386
- /**
1387
- *
1388
- */
1389
- var CommandComponent = /** @class */ (function (_super) {
1390
- __extends(CommandComponent, _super);
1391
- function CommandComponent(parent) {
1392
- var _this = _super.call(this) || this;
1393
- _this.parent = parent;
1394
- _this.CommandFace = exports.CommandFace;
1395
- var _a = pectin.Dsl.disposeWith(_this), chain = _a.chain, switchOn = _a.switchOn;
1396
- _this.faces = chain(_this.command.busy).mapToList(function (busy) {
1397
- return busy ?
1398
- [_this.busyFaceModel.value, _this.faceModel.value] :
1399
- [_this.faceModel.value, _this.busyFaceModel.value];
1400
- }, { allowNil: true, dependsOn: [_this.faceModel, _this.busyFaceModel] })
1401
- .rejectNil();
1402
- _this.activeFace = _this.faces.first();
1403
- _this.buttonStyle = chain(_this.activeFace).map(function (f) { return exports.CommandFace.getStyleOf(f); });
1404
- _this.colorModel = chain(_this.activeFace).map(function (f) { return exports.CommandFace.getColorOf(f); });
1405
- if (parent) {
1406
- _this.registerDisposable(_this.parent.registerCommand(_this.command, _this.faces));
1407
- }
1408
- return _this;
1409
- }
1410
- CommandComponent.prototype.isActive = function (face) {
1411
- return this.activeFace.query().equals(face);
1412
- };
1413
- CommandComponent.prototype.ngOnInit = function () {
1414
- };
1415
- return CommandComponent;
1416
- }(DisposableComponent));
1417
- CommandComponent.decorators = [
1418
- { type: i0.Component, args: [{
1419
- selector: 'aup-command',
1420
- 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",
1421
- styles: [":host{display:inline-flex;flex-direction:row;justify-content:stretch}button{flex:1}"]
1422
- },] }
1423
- ];
1424
- CommandComponent.ctorParameters = function () { return [
1425
- { type: exports.CommandGroup, decorators: [{ type: i0.Optional }] }
1426
- ]; };
1427
- CommandComponent.propDecorators = {
1428
- command: [{ type: i0.Input }],
1429
- faceModel: [{ type: i0.Input }],
1430
- face: [{ type: i0.Input }],
1431
- busyFaceModel: [{ type: i0.Input }],
1432
- busyFace: [{ type: i0.Input }]
1433
- };
1434
- __decorate([
1435
- pectin.TrackExternal(),
1436
- __metadata("design:type", pectin.Command)
1437
- ], CommandComponent.prototype, "command", void 0);
1438
- __decorate([
1439
- pectin.TrackExternal(),
1440
- __metadata("design:type", pectin.ValueModel)
1441
- ], CommandComponent.prototype, "faceModel", void 0);
1442
- __decorate([
1443
- pectin.StoreInValueModel('faceModel'),
1444
- __metadata("design:type", Object)
1445
- ], CommandComponent.prototype, "face", void 0);
1446
- __decorate([
1447
- pectin.TrackExternal(),
1448
- __metadata("design:type", pectin.ValueModel)
1449
- ], CommandComponent.prototype, "busyFaceModel", void 0);
1450
- __decorate([
1451
- pectin.StoreInValueModel('busyFaceModel'),
1452
- __metadata("design:type", Object)
1453
- ], CommandComponent.prototype, "busyFace", void 0);
1454
-
1455
1300
  /**
1456
1301
  *
1457
1302
  */
1458
1303
  var FlexComponent = /** @class */ (function (_super) {
1459
1304
  __extends(FlexComponent, _super);
1460
- function FlexComponent(parent) {
1461
- var _this = _super.call(this) || this;
1462
- _this.parent = parent;
1463
- if (parent) {
1464
- parent.registerFlex(_this);
1465
- }
1466
- return _this;
1305
+ function FlexComponent() {
1306
+ return _super.call(this) || this;
1467
1307
  }
1468
1308
  FlexComponent.prototype.ngOnInit = function () {
1469
1309
  };
@@ -1475,51 +1315,48 @@
1475
1315
  template: ""
1476
1316
  },] }
1477
1317
  ];
1478
- FlexComponent.ctorParameters = function () { return [
1479
- { type: exports.CommandGroup }
1480
- ]; };
1318
+ FlexComponent.ctorParameters = function () { return []; };
1481
1319
 
1482
- var ɵ0 = exports.CommandGroup.factory;
1483
1320
  /**
1484
1321
  *
1485
1322
  */
1486
1323
  var MoreMenuComponent = /** @class */ (function (_super) {
1487
1324
  __extends(MoreMenuComponent, _super);
1488
- function MoreMenuComponent(group) {
1489
- var _this = _super.call(this) || this;
1490
- _this.group = group;
1325
+ function MoreMenuComponent(element, parent) {
1326
+ var _this = _super.call(this, element, parent) || this;
1491
1327
  _this.tooltipModel = new pectin.MutableValueModel();
1492
1328
  var _a = pectin.Dsl.disposeWith(_this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
1493
- group.xPosition = 'before'; // this should be the default unless overridden by the user.
1494
- group.faceListModel = chain(_this.tooltipModel).mapToList(function (tooltip) {
1495
- return [
1496
- {
1497
- icon: function () { return 'mat:more_vert'; },
1498
- tooltip: function () {
1499
- return tooltip;
1500
- }
1329
+ _this.faceModelDelegate.setDelegate(chain(_this.tooltipModel).map(function (tooltip) {
1330
+ return {
1331
+ icon: function () { return 'mat:more_vert'; },
1332
+ tooltip: function () {
1333
+ return tooltip;
1501
1334
  }
1502
- ];
1503
- }, { allowNil: true });
1335
+ };
1336
+ }, { allowNil: true }));
1504
1337
  return _this;
1505
1338
  }
1506
- MoreMenuComponent.prototype.ngOnInit = function () {
1507
- };
1508
- // @Trace()
1509
- MoreMenuComponent.prototype.ngAfterContentInit = function () {
1510
- this.group.initialise();
1511
- };
1339
+ Object.defineProperty(MoreMenuComponent.prototype, "face", {
1340
+ get: function () {
1341
+ return this.faceModelDelegate.value;
1342
+ },
1343
+ enumerable: false,
1344
+ configurable: true
1345
+ });
1512
1346
  return MoreMenuComponent;
1513
- }(DisposableComponent));
1347
+ }(AbstractPopupMenuComponent));
1514
1348
  MoreMenuComponent.decorators = [
1515
1349
  { type: i0.Component, args: [{
1516
1350
  selector: 'aup-more-menu',
1517
- template: '<aup-command-group-renderer [renderRootNode]="true" [groupViewDataModel]="group.rootTemplate"></aup-command-group-renderer>',
1518
- providers: [{ provide: exports.CommandGroup, useFactory: ɵ0 }]
1351
+ 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",
1352
+ providers: [
1353
+ { provide: POPUP_CONTAINER, useExisting: MoreMenuComponent }
1354
+ ]
1519
1355
  },] }
1520
1356
  ];
1521
1357
  MoreMenuComponent.ctorParameters = function () { return [
1522
- { type: exports.CommandGroup }
1358
+ { type: i0.ElementRef },
1359
+ { type: undefined, decorators: [{ type: i0.Inject, args: [POPUP_CONTAINER,] }, { type: i0.Optional }, { type: i0.SkipSelf }] }
1523
1360
  ]; };
1524
1361
  MoreMenuComponent.propDecorators = {
1525
1362
  tooltip: [{ type: i0.Input }]
@@ -1529,47 +1366,38 @@
1529
1366
  __metadata("design:type", String)
1530
1367
  ], MoreMenuComponent.prototype, "tooltip", void 0);
1531
1368
 
1532
- var ɵ0$1 = exports.CommandGroup.factory;
1533
1369
  /**
1534
1370
  *
1535
1371
  */
1536
1372
  var PopupMenuComponent = /** @class */ (function (_super) {
1537
1373
  __extends(PopupMenuComponent, _super);
1538
- function PopupMenuComponent(group) {
1539
- var _this = _super.call(this) || this;
1540
- _this.group = group;
1374
+ function PopupMenuComponent(element, parent) {
1375
+ var _this = _super.call(this, element, parent) || this;
1541
1376
  var _a = pectin.Dsl.disposeWith(_this), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
1542
- group.faceListModel = chain(_this.faceModel).mapToList(function (face) { return [face]; });
1543
1377
  return _this;
1378
+ // group.faceListModel = chain(this.faceModel).mapToList(face => [face]);
1544
1379
  }
1545
- // @Trace()
1546
- PopupMenuComponent.prototype.ngOnInit = function () {
1547
- };
1548
- // @Trace()
1549
- PopupMenuComponent.prototype.ngAfterContentInit = function () {
1550
- this.group.initialise();
1551
- };
1552
- // @Trace()
1553
- PopupMenuComponent.prototype.ngAfterViewInit = function () {
1554
- };
1555
1380
  return PopupMenuComponent;
1556
- }(DisposableComponent));
1381
+ }(AbstractPopupMenuComponent));
1557
1382
  PopupMenuComponent.decorators = [
1558
1383
  { type: i0.Component, args: [{
1559
1384
  selector: 'aup-popup-menu',
1560
- template: '<aup-command-group-renderer [renderRootNode]="true" [groupViewDataModel]="group.rootTemplate"></aup-command-group-renderer>',
1561
- providers: [{ provide: exports.CommandGroup, useFactory: ɵ0$1 }]
1385
+ 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",
1386
+ providers: [
1387
+ { provide: POPUP_CONTAINER, useExisting: PopupMenuComponent }
1388
+ ]
1562
1389
  },] }
1563
1390
  ];
1564
1391
  PopupMenuComponent.ctorParameters = function () { return [
1565
- { type: exports.CommandGroup }
1392
+ { type: i0.ElementRef },
1393
+ { type: undefined, decorators: [{ type: i0.Inject, args: [POPUP_CONTAINER,] }, { type: i0.Optional }, { type: i0.SkipSelf }] }
1566
1394
  ]; };
1567
1395
  PopupMenuComponent.propDecorators = {
1568
1396
  faceModel: [{ type: i0.Input }],
1569
1397
  face: [{ type: i0.Input }]
1570
1398
  };
1571
1399
  __decorate([
1572
- pectin.TrackExternal(),
1400
+ pectin.TrackExternal({ delegateTo: 'faceModelDelegate' }),
1573
1401
  __metadata("design:type", pectin.ValueModel)
1574
1402
  ], PopupMenuComponent.prototype, "faceModel", void 0);
1575
1403
  __decorate([
@@ -1577,71 +1405,6 @@
1577
1405
  __metadata("design:type", Object)
1578
1406
  ], PopupMenuComponent.prototype, "face", void 0);
1579
1407
 
1580
- /**
1581
- *
1582
- */
1583
- var SeparatorComponent = /** @class */ (function (_super) {
1584
- __extends(SeparatorComponent, _super);
1585
- function SeparatorComponent(parent) {
1586
- var _this = _super.call(this) || this;
1587
- _this.parent = parent;
1588
- if (parent) {
1589
- parent.registerSeparator(_this);
1590
- }
1591
- return _this;
1592
- }
1593
- SeparatorComponent.prototype.isVertical = function () {
1594
- return this === null || this === void 0 ? void 0 : this.parent.isRoot();
1595
- };
1596
- SeparatorComponent.prototype.ngOnInit = function () {
1597
- };
1598
- return SeparatorComponent;
1599
- }(DisposableComponent));
1600
- SeparatorComponent.decorators = [
1601
- { type: i0.Component, args: [{
1602
- selector: 'aup-separator',
1603
- template: "\n <mat-divider [vertical]=\"isVertical()\"></mat-divider>"
1604
- },] }
1605
- ];
1606
- SeparatorComponent.ctorParameters = function () { return [
1607
- { type: exports.CommandGroup, decorators: [{ type: i0.Optional }] }
1608
- ]; };
1609
-
1610
- var ɵ0$2 = exports.CommandGroup.factory;
1611
- /**
1612
- *
1613
- */
1614
- var ToolBarComponent = /** @class */ (function (_super) {
1615
- __extends(ToolBarComponent, _super);
1616
- function ToolBarComponent(group) {
1617
- var _this = _super.call(this) || this;
1618
- _this.group = group;
1619
- return _this;
1620
- }
1621
- // @Trace()
1622
- ToolBarComponent.prototype.ngOnInit = function () {
1623
- };
1624
- // @Trace()
1625
- ToolBarComponent.prototype.ngAfterContentInit = function () {
1626
- this.group.initialise();
1627
- };
1628
- // @Trace()
1629
- ToolBarComponent.prototype.ngAfterViewInit = function () {
1630
- };
1631
- return ToolBarComponent;
1632
- }(DisposableComponent));
1633
- ToolBarComponent.decorators = [
1634
- { type: i0.Component, args: [{
1635
- selector: 'aup-tool-bar',
1636
- template: '<aup-command-group-renderer [renderRootNode]="false" [groupViewDataModel]="group.rootTemplate"></aup-command-group-renderer>',
1637
- providers: [{ provide: exports.CommandGroup, useFactory: ɵ0$2 }],
1638
- 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}"]
1639
- },] }
1640
- ];
1641
- ToolBarComponent.ctorParameters = function () { return [
1642
- { type: exports.CommandGroup }
1643
- ]; };
1644
-
1645
1408
  var FocusContainerComponent = /** @class */ (function (_super) {
1646
1409
  __extends(FocusContainerComponent, _super);
1647
1410
  function FocusContainerComponent(focusManager) {
@@ -2768,7 +2531,7 @@
2768
2531
 
2769
2532
  var noop = function () {
2770
2533
  };
2771
- var ɵ0$3 = noop;
2534
+ var ɵ0 = noop;
2772
2535
  var CELL_RENDERER_COMPONENT_ROW_CACHE = Symbol("aup-cell-renderer:row-data-cache");
2773
2536
  var ColumnModel = /** @class */ (function () {
2774
2537
  function ColumnModel(columnId, defaults) {
@@ -3722,13 +3485,12 @@
3722
3485
  ToolBarComponent,
3723
3486
  CommandComponent,
3724
3487
  PopupMenuComponent,
3725
- CommandGroupComponent,
3726
3488
  CommandFaceComponent,
3727
3489
  MoreMenuComponent,
3728
3490
  SeparatorComponent,
3729
3491
  FlexComponent,
3730
- CommandGroupMenuRendererComponent,
3731
- CommandGroupRendererComponent
3492
+ AbstractPopupMenuComponent,
3493
+ PopupMenuRendererComponent
3732
3494
  ],
3733
3495
  imports: [
3734
3496
  i2.CommonModule,
@@ -3775,7 +3537,6 @@
3775
3537
  exports.IconComponent,
3776
3538
  SectionHeaderComponent,
3777
3539
  TableRowMenuComponent,
3778
- CommandGroupComponent,
3779
3540
  ToolBarComponent,
3780
3541
  CommandComponent,
3781
3542
  PopupMenuComponent,
@@ -7136,10 +6897,11 @@
7136
6897
 
7137
6898
  var PlaceOutletComponent = /** @class */ (function (_super) {
7138
6899
  __extends(PlaceOutletComponent, _super);
7139
- function PlaceOutletComponent(router, placeRouter, placeConfig, parentOutlet) {
6900
+ function PlaceOutletComponent(router, placeRouter, placeAuthService, placeConfig, parentOutlet) {
7140
6901
  var _this = _super.call(this) || this;
7141
6902
  _this.router = router;
7142
6903
  _this.placeRouter = placeRouter;
6904
+ _this.placeAuthService = placeAuthService;
7143
6905
  _this.placeConfig = placeConfig;
7144
6906
  _this.placeChanged = new i0.EventEmitter();
7145
6907
  _this.outletActivated = new pectin.MutableValueModel(false);
@@ -7184,6 +6946,13 @@
7184
6946
  chain(_this._activePlaceModel)
7185
6947
  .postponeWhile(_this.navigationInProgress)
7186
6948
  .subscribe(function (place) { return _this.placeChanged.emit(place); });
6949
+ when(placeAuthService.authoriserModel).changes(function (isAuthorised) {
6950
+ var activePlace = _this._activePlaceModel.value;
6951
+ if (activePlace && !isAuthorised(activePlace.placeDefinition)) {
6952
+ var visitOrPlace = placeAuthService.handleNotAuthorised(_this._activatedRouteModel.value.snapshot, _this.router.routerState.snapshot);
6953
+ _this.placeRouter.navigate(visitOrPlace instanceof Visit ? visitOrPlace : new Visit(exports.PlaceComponent.getDefinition(visitOrPlace)));
6954
+ }
6955
+ });
7187
6956
  return _this;
7188
6957
  }
7189
6958
  // @Trace()
@@ -7325,6 +7094,7 @@
7325
7094
  PlaceOutletComponent.ctorParameters = function () { return [
7326
7095
  { type: i1$1.Router },
7327
7096
  { type: PlaceRouter },
7097
+ { type: undefined, decorators: [{ type: i0.Inject, args: [PLACE_AUTH_SERVICE,] }] },
7328
7098
  { type: undefined, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [AUP_PLACE_CONFIG,] }] },
7329
7099
  { type: PlaceOutletComponent, decorators: [{ type: i0.SkipSelf }, { type: i0.Optional }] }
7330
7100
  ]; };
@@ -7954,65 +7724,72 @@
7954
7724
  this.interactionService = interactionService;
7955
7725
  this.injector = injector;
7956
7726
  }
7727
+ // @Trace()
7957
7728
  PlaceGuard.prototype.canActivate = function (activatedRoute, state) {
7958
7729
  return __awaiter(this, void 0, void 0, function () {
7959
- var placeDefinition_1, needsAuth, proceed, _a, result;
7730
+ var placeDefinition_1, redirectLocation, nextPlaceDef, redirectLocation, nextPlaceDef, result;
7960
7731
  var _this = this;
7961
- return __generator(this, function (_b) {
7962
- switch (_b.label) {
7732
+ return __generator(this, function (_a) {
7733
+ switch (_a.label) {
7963
7734
  case 0:
7964
7735
  if (!exports.PlaceComponent.isPlaceComponentConstructor(activatedRoute.component)) return [3 /*break*/, 4];
7965
7736
  placeDefinition_1 = exports.PlaceComponent.getDefinition(activatedRoute.component);
7966
- needsAuth = placeDefinition_1.authenticate;
7967
- _a = !needsAuth;
7968
- if (_a) return [3 /*break*/, 2];
7737
+ if (!placeDefinition_1.authenticate) return [3 /*break*/, 2];
7969
7738
  return [4 /*yield*/, this.placeAuthService.isAuthenticated()];
7970
7739
  case 1:
7971
- _a = (_b.sent());
7972
- _b.label = 2;
7973
- case 2:
7974
- proceed = _a;
7975
- if (!proceed) {
7976
- return [2 /*return*/, this.handleGuardResult(this.placeAuthService.handleNotAuthenticated(activatedRoute, state))];
7740
+ if (!(_a.sent())) {
7741
+ redirectLocation = this.placeAuthService.handleNotAuthenticated(activatedRoute, state);
7742
+ nextPlaceDef = this.getPlaceDefinition(redirectLocation);
7743
+ if (nextPlaceDef.authenticate) {
7744
+ pectin.lang.illegalState("handleNotAuthenticated hook returned place " + nextPlaceDef.component.name + " that requires authentication.");
7745
+ }
7746
+ return [2 /*return*/, this.createUrlTree(redirectLocation)];
7977
7747
  }
7978
7748
  if (!this.placeAuthService.isAuthorised(placeDefinition_1)) {
7979
- return [2 /*return*/, this.handleGuardResult(this.placeAuthService.handleNotAuthorised(activatedRoute, state))];
7749
+ redirectLocation = this.placeAuthService.handleNotAuthorised(activatedRoute, state);
7750
+ nextPlaceDef = this.getPlaceDefinition(redirectLocation);
7751
+ if (!this.placeAuthService.isAuthorised(nextPlaceDef)) {
7752
+ pectin.lang.illegalState("handleNotAuthorised hook returned place " + nextPlaceDef.component.name + " that is not authorised for the current user.");
7753
+ }
7754
+ return [2 /*return*/, this.createUrlTree(redirectLocation)];
7980
7755
  }
7981
- return [4 /*yield*/, this.cleanInteractionState(activatedRoute, state, function () { return __awaiter(_this, void 0, void 0, function () {
7982
- var params, parsedParams, navigationSession, initialVisit, sanitiser, sanitisedVisit, urlSnapshot;
7983
- return __generator(this, function (_a) {
7984
- switch (_a.label) {
7985
- case 0:
7986
- params = new ConsolidatedParameterMap(activatedRoute.paramMap, activatedRoute.url);
7987
- parsedParams = placeDefinition_1.parseRouteParams(params);
7988
- navigationSession = this.placeRouter.navigationSession;
7989
- initialVisit = navigationSession.getVisitFor(placeDefinition_1) || new Visit(placeDefinition_1, parsedParams);
7990
- sanitiser = new VisitSanitiser(navigationSession, activatedRoute, this.router, this.placeHistory, this.injector);
7991
- return [4 /*yield*/, sanitiser.sanitise(initialVisit.mergeRouteParameters(parsedParams))];
7992
- case 1:
7993
- sanitisedVisit = _a.sent();
7994
- // Save the visit with any updated parameters. We need to save it so we remember any non route parameters
7995
- navigationSession.storeVisit(sanitisedVisit);
7996
- if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {
7997
- urlSnapshot = this.urlService.parseUrl(state.url).updateVisitSegments(sanitisedVisit);
7998
- // console.log('##### Place Guard Redirect', urlSnapshot);
7999
- return [2 /*return*/, urlSnapshot];
8000
- }
8001
- else {
8002
- return [2 /*return*/, true];
8003
- }
8004
- return [2 /*return*/];
8005
- }
8006
- });
8007
- }); })];
7756
+ _a.label = 2;
7757
+ case 2: return [4 /*yield*/, this.cleanInteractionState(activatedRoute, state, function () { return __awaiter(_this, void 0, void 0, function () {
7758
+ var params, parsedParams, navigationSession, initialVisit, sanitiser, sanitisedVisit, urlSnapshot;
7759
+ return __generator(this, function (_a) {
7760
+ switch (_a.label) {
7761
+ case 0:
7762
+ params = new ConsolidatedParameterMap(activatedRoute.paramMap, activatedRoute.url);
7763
+ parsedParams = placeDefinition_1.parseRouteParams(params);
7764
+ navigationSession = this.placeRouter.navigationSession;
7765
+ initialVisit = navigationSession.getVisitFor(placeDefinition_1) || new Visit(placeDefinition_1, parsedParams);
7766
+ sanitiser = new VisitSanitiser(navigationSession, activatedRoute, this.router, this.placeHistory, this.injector);
7767
+ return [4 /*yield*/, sanitiser.sanitise(initialVisit.mergeRouteParameters(parsedParams))];
7768
+ case 1:
7769
+ sanitisedVisit = _a.sent();
7770
+ // Save the visit with any updated parameters. We need to save it so we remember any non route parameters
7771
+ navigationSession.storeVisit(sanitisedVisit);
7772
+ if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {
7773
+ urlSnapshot = this.urlService.parseUrl(state.url).updateVisitSegments(sanitisedVisit);
7774
+ // console.log('##### Place Guard Redirect', urlSnapshot);
7775
+ return [2 /*return*/, urlSnapshot];
7776
+ }
7777
+ else {
7778
+ return [2 /*return*/, true];
7779
+ }
7780
+ return [2 /*return*/];
7781
+ }
7782
+ });
7783
+ }); })];
8008
7784
  case 3:
8009
- result = _b.sent();
7785
+ result = _a.sent();
8010
7786
  return [2 /*return*/, result instanceof exports.UrlSnapshot ? result.urlTree : result];
8011
7787
  case 4: return [2 /*return*/, pectin.lang.illegalState("expected component to be an instance of PlaceComponent, got " + activatedRoute.component)];
8012
7788
  }
8013
7789
  });
8014
7790
  });
8015
7791
  };
7792
+ // @Trace()
8016
7793
  PlaceGuard.prototype.canDeactivate = function (component, currentRoute, currentState, nextState) {
8017
7794
  return __awaiter(this, void 0, void 0, function () {
8018
7795
  var currentUrl, nextUrl, result;
@@ -8029,13 +7806,14 @@
8029
7806
  });
8030
7807
  });
8031
7808
  };
8032
- PlaceGuard.prototype.handleGuardResult = function (result) {
8033
- if (result instanceof exports.UrlSnapshot) {
8034
- return result.urlTree;
8035
- }
8036
- else {
8037
- return this.urlService.createUrlSnapshot(result).urlTree;
8038
- }
7809
+ PlaceGuard.prototype.getPlaceDefinition = function (result) {
7810
+ return result instanceof Visit ?
7811
+ result.placeDefinition :
7812
+ exports.PlaceComponent.getDefinition(result);
7813
+ };
7814
+ PlaceGuard.prototype.createUrlTree = function (result) {
7815
+ var visit = result instanceof Visit ? result : new Visit(exports.PlaceComponent.getDefinition(result), {});
7816
+ return this.urlService.createUrlSnapshot(visit).urlTree;
8039
7817
  };
8040
7818
  // protected async ensureAuthenticatedThen(activatedRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot, next: (placeDefinition: PlaceDefinition) => Promise<boolean | UrlTree>): Promise<boolean | UrlTree> {
8041
7819
  // const authoriseResult = placeDefinition.authenticate ? await this.isAuthorised(activatedRoute, state) : true;
@@ -8058,6 +7836,7 @@
8058
7836
  // return (authorised instanceof Observable) ? authorised.toPromise() : authorised;
8059
7837
  // }
8060
7838
  // abstract getAuthGuard(injector: Injector): CanActivate;
7839
+ // @Trace()
8061
7840
  PlaceGuard.prototype.cleanInteractionState = function (route, state, next) {
8062
7841
  return __awaiter(this, void 0, void 0, function () {
8063
7842
  var url;
@@ -8090,30 +7869,6 @@
8090
7869
  { type: exports.InteractionService },
8091
7870
  { type: i0.Injector }
8092
7871
  ]; };
8093
- __decorate([
8094
- pectin.Trace(),
8095
- __metadata("design:type", Function),
8096
- __metadata("design:paramtypes", [i1$1.ActivatedRouteSnapshot, i1$1.RouterStateSnapshot]),
8097
- __metadata("design:returntype", Promise)
8098
- ], PlaceGuard.prototype, "canActivate", null);
8099
- __decorate([
8100
- pectin.Trace(),
8101
- __metadata("design:type", Function),
8102
- __metadata("design:paramtypes", [exports.PlaceComponent, i1$1.ActivatedRouteSnapshot, i1$1.RouterStateSnapshot, i1$1.RouterStateSnapshot]),
8103
- __metadata("design:returntype", Promise)
8104
- ], PlaceGuard.prototype, "canDeactivate", null);
8105
- __decorate([
8106
- pectin.Trace(),
8107
- __metadata("design:type", Function),
8108
- __metadata("design:paramtypes", [Object]),
8109
- __metadata("design:returntype", void 0)
8110
- ], PlaceGuard.prototype, "handleGuardResult", null);
8111
- __decorate([
8112
- pectin.Trace(),
8113
- __metadata("design:type", Function),
8114
- __metadata("design:paramtypes", [i1$1.ActivatedRouteSnapshot, i1$1.RouterStateSnapshot, Function]),
8115
- __metadata("design:returntype", Promise)
8116
- ], PlaceGuard.prototype, "cleanInteractionState", null);
8117
7872
 
8118
7873
  (function (Formatter) {
8119
7874
  var StringType = /** @class */ (function () {
@@ -8231,6 +7986,7 @@
8231
7986
  exports.AbstractListInputComponent = AbstractListInputComponent;
8232
7987
  exports.AbstractPlaceNavigationComponent = AbstractPlaceNavigationComponent;
8233
7988
  exports.AbstractPopStateNavigation = AbstractPopStateNavigation;
7989
+ exports.AbstractPopupMenuComponent = AbstractPopupMenuComponent;
8234
7990
  exports.AbstractValueInputComponent = AbstractValueInputComponent;
8235
7991
  exports.Activity = Activity;
8236
7992
  exports.ActivityActionsComponent = ActivityActionsComponent;
@@ -8255,9 +8011,6 @@
8255
8011
  exports.CommandComponent = CommandComponent;
8256
8012
  exports.CommandDirective = CommandDirective;
8257
8013
  exports.CommandFaceComponent = CommandFaceComponent;
8258
- exports.CommandGroupComponent = CommandGroupComponent;
8259
- exports.CommandGroupMenuRendererComponent = CommandGroupMenuRendererComponent;
8260
- exports.CommandGroupRendererComponent = CommandGroupRendererComponent;
8261
8014
  exports.ComponentCellRendererPortalRef = ComponentCellRendererPortalRef;
8262
8015
  exports.ComponentsModule = ComponentsModule;
8263
8016
  exports.ConfirmThenDialogComponent = ConfirmThenDialogComponent;
@@ -8303,6 +8056,7 @@
8303
8056
  exports.NoopComponent = NoopComponent;
8304
8057
  exports.NumberInputComponent = NumberInputComponent;
8305
8058
  exports.PLACE_AUTH_SERVICE = PLACE_AUTH_SERVICE;
8059
+ exports.POPUP_CONTAINER = POPUP_CONTAINER;
8306
8060
  exports.PORTAL_EDITOR_COMPONENT = PORTAL_EDITOR_COMPONENT;
8307
8061
  exports.PORTAL_RENDERER_COMPONENT = PORTAL_RENDERER_COMPONENT;
8308
8062
  exports.PasswordInputComponent = PasswordInputComponent;
@@ -8316,8 +8070,10 @@
8316
8070
  exports.Point = Point;
8317
8071
  exports.PopStateDuringInteractionNavigation = PopStateDuringInteractionNavigation;
8318
8072
  exports.PopStateNavigation = PopStateNavigation;
8073
+ exports.PopupAwareComponent = PopupAwareComponent;
8319
8074
  exports.PopupInteractionContextComponent = PopupInteractionContextComponent;
8320
8075
  exports.PopupMenuComponent = PopupMenuComponent;
8076
+ exports.PopupMenuRendererComponent = PopupMenuRendererComponent;
8321
8077
  exports.PropertyColumnModel = PropertyColumnModel;
8322
8078
  exports.ROUTE_PARAMETER_LIST_KEY = ROUTE_PARAMETER_LIST_KEY;
8323
8079
  exports.RemoveLastInteractionFromUrlNavigationSession = RemoveLastInteractionFromUrlNavigationSession;