@coolon/angular-ui-powerups 3.9.0 → 3.10.1

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 (91) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/assets/table.scss +18 -0
  3. package/bundles/coolon-angular-ui-powerups.umd.js +1210 -507
  4. package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
  5. package/bundles/coolon-angular-ui-powerups.umd.min.js +1 -1
  6. package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -1
  7. package/coolon-angular-ui-powerups.metadata.json +1 -1
  8. package/esm2015/lib/angular-ui-powerups.module.ngfactory.js.map +1 -1
  9. package/esm2015/lib/components/components.module.js +13 -5
  10. package/esm2015/lib/components/components.module.js.map +1 -1
  11. package/esm2015/lib/components/components.module.metadata.json +1 -1
  12. package/esm2015/lib/components/components.module.ngfactory.js.map +1 -1
  13. package/esm2015/lib/components/exports.js +11 -0
  14. package/esm2015/lib/components/exports.js.map +1 -1
  15. package/esm2015/lib/components/exports.metadata.json +1 -1
  16. package/esm2015/lib/components/table/abstract-table-model.js +173 -0
  17. package/esm2015/lib/components/table/abstract-table-model.js.map +1 -0
  18. package/esm2015/lib/components/table/abstract-table-model.metadata.json +1 -0
  19. package/esm2015/lib/components/table/column-model.js +6 -3
  20. package/esm2015/lib/components/table/column-model.js.map +1 -1
  21. package/esm2015/lib/components/table/column-model.metadata.json +1 -1
  22. package/esm2015/lib/components/table/table-model.js +7 -171
  23. package/esm2015/lib/components/table/table-model.js.map +1 -1
  24. package/esm2015/lib/components/table/table-model.metadata.json +1 -1
  25. package/esm2015/lib/components/table/table.component.js +3 -3
  26. package/esm2015/lib/components/table/table.component.js.map +1 -1
  27. package/esm2015/lib/components/table/table.component.metadata.json +1 -1
  28. package/esm2015/lib/components/tree-table/decorated-tree-node.js +169 -0
  29. package/esm2015/lib/components/tree-table/decorated-tree-node.js.map +1 -0
  30. package/esm2015/lib/components/tree-table/decorated-tree-node.metadata.json +1 -0
  31. package/esm2015/lib/components/tree-table/tree-expansion-model.js +48 -0
  32. package/esm2015/lib/components/tree-table/tree-expansion-model.js.map +1 -0
  33. package/esm2015/lib/components/tree-table/tree-expansion-model.metadata.json +1 -0
  34. package/esm2015/lib/components/tree-table/tree-inheritance-icon/tree-inheritance-icon.component.js +68 -0
  35. package/esm2015/lib/components/tree-table/tree-inheritance-icon/tree-inheritance-icon.component.js.map +1 -0
  36. package/esm2015/lib/components/tree-table/tree-inheritance-icon/tree-inheritance-icon.component.metadata.json +1 -0
  37. package/esm2015/lib/components/tree-table/tree-inheritance-icon/tree-inheritance-icon.component.ngfactory.js.map +1 -0
  38. package/esm2015/lib/components/tree-table/tree-inheritance-icon/tree-inheritance-icon.component.scss.shim.ngstyle.js.map +1 -0
  39. package/esm2015/lib/components/tree-table/tree-label-cell-renderer/tree-label-cell-renderer.component.js +71 -0
  40. package/esm2015/lib/components/tree-table/tree-label-cell-renderer/tree-label-cell-renderer.component.js.map +1 -0
  41. package/esm2015/lib/components/tree-table/tree-label-cell-renderer/tree-label-cell-renderer.component.metadata.json +1 -0
  42. package/esm2015/lib/components/tree-table/tree-label-cell-renderer/tree-label-cell-renderer.component.ngfactory.js.map +1 -0
  43. package/esm2015/lib/components/tree-table/tree-label-cell-renderer/tree-label-cell-renderer.component.scss.shim.ngstyle.js.map +1 -0
  44. package/esm2015/lib/components/tree-table/tree-label-column-model.js +33 -0
  45. package/esm2015/lib/components/tree-table/tree-label-column-model.js.map +1 -0
  46. package/esm2015/lib/components/tree-table/tree-label-column-model.metadata.json +1 -0
  47. package/esm2015/lib/components/tree-table/tree-node.js +2 -0
  48. package/esm2015/lib/components/tree-table/tree-node.js.map +1 -0
  49. package/esm2015/lib/components/tree-table/tree-node.metadata.json +1 -0
  50. package/esm2015/lib/components/tree-table/tree-table-component.js +63 -0
  51. package/esm2015/lib/components/tree-table/tree-table-component.js.map +1 -0
  52. package/esm2015/lib/components/tree-table/tree-table-component.metadata.json +1 -0
  53. package/esm2015/lib/components/tree-table/tree-table-component.ngfactory.js.map +1 -0
  54. package/esm2015/lib/components/tree-table/tree-table-model.js +108 -0
  55. package/esm2015/lib/components/tree-table/tree-table-model.js.map +1 -0
  56. package/esm2015/lib/components/tree-table/tree-table-model.metadata.json +1 -0
  57. package/esm2015/lib/components/tree-table/tree-table.component.scss.ngstyle.js.map +1 -0
  58. package/esm2015/lib/components/tree-table/tree-to-list-model.js +25 -0
  59. package/esm2015/lib/components/tree-table/tree-to-list-model.js.map +1 -0
  60. package/esm2015/lib/components/tree-table/tree-to-list-model.metadata.json +1 -0
  61. package/esm2015/lib/components/tree-table/visitable.class.js +26 -0
  62. package/esm2015/lib/components/tree-table/visitable.class.js.map +1 -0
  63. package/esm2015/lib/components/tree-table/visitable.class.metadata.json +1 -0
  64. package/esm2015/lib/interaction/interaction.module.ngfactory.js.map +1 -1
  65. package/esm2015/lib/place/place.module.ngfactory.js.map +1 -1
  66. package/esm2015/lib/place/route/visit-sanitiser.js +1 -1
  67. package/esm2015/lib/place/route/visit-sanitiser.js.map +1 -1
  68. package/fesm2015/coolon-angular-ui-powerups.js +966 -373
  69. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  70. package/lib/components/exports.d.ts +11 -0
  71. package/lib/components/table/abstract-table-model.d.ts +61 -0
  72. package/lib/components/table/column-model.d.ts +11 -12
  73. package/lib/components/table/table-model.d.ts +4 -59
  74. package/lib/components/table/table.component.d.ts +2 -2
  75. package/lib/components/tree-table/decorated-tree-node.d.ts +43 -0
  76. package/lib/components/tree-table/tree-expansion-model.d.ts +18 -0
  77. package/lib/components/tree-table/tree-inheritance-icon/tree-inheritance-icon.component.d.ts +28 -0
  78. package/lib/components/tree-table/tree-label-cell-renderer/tree-label-cell-renderer.component.d.ts +25 -0
  79. package/lib/components/tree-table/tree-label-column-model.d.ts +20 -0
  80. package/lib/components/tree-table/tree-node.d.ts +3 -0
  81. package/lib/components/tree-table/tree-table-component.d.ts +7 -0
  82. package/lib/components/tree-table/tree-table-model.d.ts +33 -0
  83. package/lib/components/tree-table/tree-to-list-model.d.ts +12 -0
  84. package/lib/components/tree-table/visitable.class.d.ts +22 -0
  85. package/package.json +1 -1
  86. package/schematics/place-routes/place-builder.js +1 -1
  87. package/schematics/place-routes/place-builder.js.map +1 -1
  88. package/schematics/utils/build-context.js +0 -2
  89. package/schematics/utils/build-context.js.map +1 -1
  90. package/schematics/utils/schematic-tree-file-system.js +6 -2
  91. package/schematics/utils/schematic-tree-file-system.js.map +1 -1
@@ -713,10 +713,6 @@
713
713
  __metadata("design:type", pectin.Command)
714
714
  ], CardContainerComponent.prototype, "addCardCommand", void 0);
715
715
 
716
- (function (TrackBy) {
717
- TrackBy.byIndex = function (data, index) { return index; };
718
- })(exports.TrackBy || (exports.TrackBy = {}));
719
-
720
716
  (function (CommandFace) {
721
717
  var Position;
722
718
  (function (Position) {
@@ -857,6 +853,80 @@
857
853
  CommandFace.Adapter = Adapter;
858
854
  })(exports.CommandFace || (exports.CommandFace = {}));
859
855
 
856
+ /**
857
+ * Custom CSS:
858
+ * @example
859
+ * root: { // globally
860
+ * --aup-command-face-icon-gap: 8px;
861
+ * }
862
+ * aup-command-face { // per instance
863
+ * --icon-gap: 4px;
864
+ * }
865
+ */
866
+ var CommandFaceComponent = /** @class */ (function (_super) {
867
+ __extends(CommandFaceComponent, _super);
868
+ function CommandFaceComponent() {
869
+ var _this = _super.call(this) || this;
870
+ _this.facesModel = new pectin.MutableListModel();
871
+ _this.ignoreIcon = false;
872
+ _this.ignoreText = false;
873
+ _this.includeMissingIconInLayout = false;
874
+ 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;
875
+ _this.faceAdapters = chain(_this.facesModel).map(function (face) { return new exports.CommandFace.Adapter(face); });
876
+ var activeFace = _this.faceAdapters.first();
877
+ _this.activeIcon = activeFace.pluck("icon");
878
+ _this.activeColor = activeFace.pluck("color");
879
+ return _this;
880
+ }
881
+ Object.defineProperty(CommandFaceComponent.prototype, "requiresMissingIconInLayout", {
882
+ get: function () {
883
+ return this.includeMissingIconInLayout && !this.activeIcon.value;
884
+ },
885
+ enumerable: false,
886
+ configurable: true
887
+ });
888
+ CommandFaceComponent.prototype.ngOnInit = function () {
889
+ };
890
+ CommandFaceComponent.prototype.shouldIncludeIcon = function (face) {
891
+ return (!this.ignoreIcon && face.icon) || this.includeMissingIconInLayout;
892
+ };
893
+ CommandFaceComponent.prototype.hasIconStart = function (face) {
894
+ return this.shouldIncludeIcon(face) && (!face.iconPosition || face.iconPosition === exports.CommandFace.Position.START);
895
+ };
896
+ CommandFaceComponent.prototype.hasIconEnd = function (face) {
897
+ return this.shouldIncludeIcon(face) && face.iconPosition === exports.CommandFace.Position.END;
898
+ };
899
+ Object.defineProperty(CommandFaceComponent.prototype, "color", {
900
+ get: function () {
901
+ return this.activeColor.value;
902
+ },
903
+ enumerable: false,
904
+ configurable: true
905
+ });
906
+ return CommandFaceComponent;
907
+ }(DisposableComponent));
908
+ CommandFaceComponent.decorators = [
909
+ { type: i0.Component, args: [{
910
+ selector: 'aup-command-face',
911
+ template: "<div class=\"face-container\" *ngFor=\"let face of faceAdapters.value\">\n <aup-icon *ngIf=\"hasIconStart(face)\" [icon]=\"face.icon\"></aup-icon>\n <span *ngIf=\"face.text\">{{face.text}}</span>\n <aup-icon *ngIf=\"hasIconEnd(face)\" [icon]=\"face.icon\"></aup-icon>\n</div>\n",
912
+ encapsulation: i0.ViewEncapsulation.None,
913
+ styles: ["aup-command-face{--icon-gap:var(--aup-command-face-icon-gap);display:-ms-inline-grid;display:inline-grid}aup-command-face>.face-container{-ms-grid-column:1;-ms-grid-row:1;align-items:center;display:inline-flex;flex-direction:row;grid-column:1;grid-row:1}aup-command-face>.face-container:not(:first-child){visibility:hidden}aup-command-face>.face-container *+*{margin-left:var(--icon-gap)}aup-command-face.hide-icon aup-icon{visibility:hidden}aup-command-face.centered{justify-items:center}"]
914
+ },] }
915
+ ];
916
+ CommandFaceComponent.ctorParameters = function () { return []; };
917
+ CommandFaceComponent.propDecorators = {
918
+ _rawFaces: [{ type: i0.Input, args: ['faces',] }],
919
+ ignoreIcon: [{ type: i0.Input }],
920
+ ignoreText: [{ type: i0.Input }],
921
+ includeMissingIconInLayout: [{ type: i0.Input }],
922
+ requiresMissingIconInLayout: [{ type: i0.HostBinding, args: ['class.hide-icon',] }],
923
+ color: [{ type: i0.HostBinding, args: ['attr.color',] }]
924
+ };
925
+ __decorate([
926
+ pectin.StoreInListModel('facesModel'),
927
+ __metadata("design:type", Array)
928
+ ], CommandFaceComponent.prototype, "_rawFaces", void 0);
929
+
860
930
  var PopupAwareComponent = /** @class */ (function (_super) {
861
931
  __extends(PopupAwareComponent, _super);
862
932
  function PopupAwareComponent(element, parent) {
@@ -963,6 +1033,150 @@
963
1033
  __metadata("design:type", Object)
964
1034
  ], CommandComponent.prototype, "busyFace", void 0);
965
1035
 
1036
+ /**
1037
+ *
1038
+ */
1039
+ var FlexComponent = /** @class */ (function (_super) {
1040
+ __extends(FlexComponent, _super);
1041
+ function FlexComponent() {
1042
+ return _super.call(this) || this;
1043
+ }
1044
+ FlexComponent.prototype.ngOnInit = function () {
1045
+ };
1046
+ return FlexComponent;
1047
+ }(DisposableComponent));
1048
+ FlexComponent.decorators = [
1049
+ { type: i0.Component, args: [{
1050
+ selector: 'aup-flex',
1051
+ template: ""
1052
+ },] }
1053
+ ];
1054
+ FlexComponent.ctorParameters = function () { return []; };
1055
+
1056
+ /**
1057
+ *
1058
+ */
1059
+ var AbstractPopupMenuComponent = /** @class */ (function (_super) {
1060
+ __extends(AbstractPopupMenuComponent, _super);
1061
+ function AbstractPopupMenuComponent(element, parent) {
1062
+ var _this = _super.call(this, element, parent) || this;
1063
+ _this._unorderedChildren = new pectin.MutableListModel();
1064
+ _this.faceModelDelegate = new pectin.DelegatingValueModel();
1065
+ _this.xPosition = 'after';
1066
+ _this.yPosition = 'below';
1067
+ var _c = pectin.Dsl.disposeWith(_this), chain = _c.chain, valueOf = _c.valueOf, before = _c.before, when = _c.when, after = _c.after, observe = _c.observe, switchOn = _c.switchOn;
1068
+ // group.faceListModel = chain(this.faceModel).mapToList(face => [face]);
1069
+ _this.faceAdapterModel = chain(_this.faceModelDelegate).map(function (f) { return new exports.CommandFace.Adapter(f); });
1070
+ _this.children = chain(_this._unorderedChildren).sortBy('componentIndex');
1071
+ return _this;
1072
+ }
1073
+ AbstractPopupMenuComponent.prototype.ngAfterContentChecked = function () {
1074
+ // force the list to re-order as the child indicies may have changed.
1075
+ this._unorderedChildren.value = __spread(this._unorderedChildren.value);
1076
+ };
1077
+ Object.defineProperty(AbstractPopupMenuComponent.prototype, "faceAdapter", {
1078
+ get: function () {
1079
+ var _a, _b;
1080
+ if (!this.faceAdapterModel) {
1081
+ console.error("Somehow faceAdapterModel is nil -- set a break point here and let me know what's going on");
1082
+ }
1083
+ return (_b = (_a = this.faceAdapterModel) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : new exports.CommandFace.Adapter(undefined);
1084
+ },
1085
+ enumerable: false,
1086
+ configurable: true
1087
+ });
1088
+ AbstractPopupMenuComponent.prototype.isRoot = function () {
1089
+ return !this.parent;
1090
+ };
1091
+ // @Trace()
1092
+ AbstractPopupMenuComponent.prototype.register = function (component) {
1093
+ var _this = this;
1094
+ this._unorderedChildren.push(component);
1095
+ return pectin.Disposable.disposableThatRuns(function () {
1096
+ _this._unorderedChildren.remove(component);
1097
+ });
1098
+ };
1099
+ AbstractPopupMenuComponent.prototype.onCommandFired = function () {
1100
+ this.triggers.forEach(function (trigger) {
1101
+ if (trigger.menuOpen) {
1102
+ trigger.closeMenu();
1103
+ }
1104
+ });
1105
+ };
1106
+ AbstractPopupMenuComponent.prototype.getFace = function () {
1107
+ return this.faceAdapter.face;
1108
+ };
1109
+ return AbstractPopupMenuComponent;
1110
+ }(PopupAwareComponent));
1111
+ AbstractPopupMenuComponent.decorators = [
1112
+ { type: i0.Component, args: [{
1113
+ selector: 'aup-abstract-popup-menu',
1114
+ template: ''
1115
+ },] }
1116
+ ];
1117
+ AbstractPopupMenuComponent.ctorParameters = function () { return [
1118
+ { type: i0.ElementRef },
1119
+ { type: undefined, decorators: [{ type: i0.Inject, args: [POPUP_CONTAINER,] }] }
1120
+ ]; };
1121
+ AbstractPopupMenuComponent.propDecorators = {
1122
+ xPosition: [{ type: i0.Input }],
1123
+ yPosition: [{ type: i0.Input }],
1124
+ triggers: [{ type: i0.ViewChildren, args: [menu.MatMenuTrigger,] }]
1125
+ };
1126
+
1127
+ /**
1128
+ *
1129
+ */
1130
+ var MoreMenuComponent = /** @class */ (function (_super) {
1131
+ __extends(MoreMenuComponent, _super);
1132
+ function MoreMenuComponent(element, parent) {
1133
+ var _this = _super.call(this, element, parent) || this;
1134
+ _this.tooltipModel = new pectin.MutableValueModel();
1135
+ 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;
1136
+ _this.faceModelDelegate.setDelegate(chain(_this.tooltipModel).map(function (tooltip) {
1137
+ return {
1138
+ icon: function () { return 'mat:more_vert'; },
1139
+ tooltip: function () {
1140
+ return tooltip;
1141
+ }
1142
+ };
1143
+ }, { allowNil: true }));
1144
+ return _this;
1145
+ }
1146
+ Object.defineProperty(MoreMenuComponent.prototype, "face", {
1147
+ get: function () {
1148
+ return this.faceModelDelegate.value;
1149
+ },
1150
+ enumerable: false,
1151
+ configurable: true
1152
+ });
1153
+ return MoreMenuComponent;
1154
+ }(AbstractPopupMenuComponent));
1155
+ MoreMenuComponent.decorators = [
1156
+ { type: i0.Component, args: [{
1157
+ selector: 'aup-more-menu',
1158
+ 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",
1159
+ providers: [
1160
+ { provide: POPUP_CONTAINER, useExisting: MoreMenuComponent }
1161
+ ]
1162
+ },] }
1163
+ ];
1164
+ MoreMenuComponent.ctorParameters = function () { return [
1165
+ { type: i0.ElementRef },
1166
+ { type: undefined, decorators: [{ type: i0.Inject, args: [POPUP_CONTAINER,] }, { type: i0.Optional }, { type: i0.SkipSelf }] }
1167
+ ]; };
1168
+ MoreMenuComponent.propDecorators = {
1169
+ tooltip: [{ type: i0.Input }]
1170
+ };
1171
+ __decorate([
1172
+ pectin.StoreInValueModel('tooltipModel'),
1173
+ __metadata("design:type", String)
1174
+ ], MoreMenuComponent.prototype, "tooltip", void 0);
1175
+
1176
+ (function (TrackBy) {
1177
+ TrackBy.byIndex = function (data, index) { return index; };
1178
+ })(exports.TrackBy || (exports.TrackBy = {}));
1179
+
966
1180
  exports.CommandContainer = /** @class */ (function (_super) {
967
1181
  __extends(CommandContainer, _super);
968
1182
  function CommandContainer(parent) {
@@ -1064,94 +1278,23 @@
1064
1278
  isHorizontalContainer: [{ type: i0.HostBinding, args: ['class.horizontal-container',] }]
1065
1279
  };
1066
1280
 
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();
1076
- _this.xPosition = 'after';
1077
- _this.yPosition = 'below';
1078
- var _c = pectin.Dsl.disposeWith(_this), chain = _c.chain, valueOf = _c.valueOf, before = _c.before, when = _c.when, after = _c.after, observe = _c.observe, switchOn = _c.switchOn;
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');
1082
- return _this;
1083
- }
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
- var _a, _b;
1091
- if (!this.faceAdapterModel) {
1092
- console.error("Somehow faceAdapterModel is nil -- set a break point here and let me know what's going on");
1093
- }
1094
- return (_b = (_a = this.faceAdapterModel) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : new exports.CommandFace.Adapter(undefined);
1095
- },
1096
- enumerable: false,
1097
- configurable: true
1098
- });
1099
- AbstractPopupMenuComponent.prototype.isRoot = function () {
1100
- return !this.parent;
1101
- };
1102
- // @Trace()
1103
- AbstractPopupMenuComponent.prototype.register = function (component) {
1104
- var _this = this;
1105
- this._unorderedChildren.push(component);
1106
- return pectin.Disposable.disposableThatRuns(function () {
1107
- _this._unorderedChildren.remove(component);
1108
- });
1109
- };
1110
- AbstractPopupMenuComponent.prototype.onCommandFired = function () {
1111
- this.triggers.forEach(function (trigger) {
1112
- if (trigger.menuOpen) {
1113
- trigger.closeMenu();
1114
- }
1115
- });
1116
- };
1117
- AbstractPopupMenuComponent.prototype.getFace = function () {
1118
- return this.faceAdapter.face;
1119
- };
1120
- return AbstractPopupMenuComponent;
1121
- }(PopupAwareComponent));
1122
- AbstractPopupMenuComponent.decorators = [
1123
- { type: i0.Component, args: [{
1124
- selector: 'aup-abstract-popup-menu',
1125
- template: ''
1126
- },] }
1127
- ];
1128
- AbstractPopupMenuComponent.ctorParameters = function () { return [
1129
- { type: i0.ElementRef },
1130
- { type: undefined, decorators: [{ type: i0.Inject, args: [POPUP_CONTAINER,] }] }
1131
- ]; };
1132
- AbstractPopupMenuComponent.propDecorators = {
1133
- xPosition: [{ type: i0.Input }],
1134
- yPosition: [{ type: i0.Input }],
1135
- triggers: [{ type: i0.ViewChildren, args: [menu.MatMenuTrigger,] }]
1136
- };
1137
-
1138
- var PopupMenuRendererComponent = /** @class */ (function (_super) {
1139
- __extends(PopupMenuRendererComponent, _super);
1140
- function PopupMenuRendererComponent() {
1141
- var _this = _super.call(this) || this;
1142
- _this._childList = new pectin.DelegatingListModel();
1143
- _this.commandFired = new i0.EventEmitter();
1144
- _this.TrackBy = exports.TrackBy;
1145
- 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;
1146
- // this.children = chain(this.groupViewDataModel).pluckList('children');
1147
- // this.hasMixedIcons = chain(this.groupViewDataModel).pluck('hasMixedIcons');
1148
- var faces = chain(_this._childList).map(function (child) {
1149
- return child.getFace();
1150
- }).rejectNil();
1151
- var icons = faces.select(function (face) { return !!exports.CommandFace.getIconOf(face); });
1152
- var iconCount = icons.count();
1153
- var totalFaces = faces.count();
1154
- _this.hasMixedIcons = valueOf.all(iconCount.isGreaterThan(0), totalFaces.doesNotEqual(iconCount)).areTruthy();
1281
+ var PopupMenuRendererComponent = /** @class */ (function (_super) {
1282
+ __extends(PopupMenuRendererComponent, _super);
1283
+ function PopupMenuRendererComponent() {
1284
+ var _this = _super.call(this) || this;
1285
+ _this._childList = new pectin.DelegatingListModel();
1286
+ _this.commandFired = new i0.EventEmitter();
1287
+ _this.TrackBy = exports.TrackBy;
1288
+ 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;
1289
+ // this.children = chain(this.groupViewDataModel).pluckList('children');
1290
+ // this.hasMixedIcons = chain(this.groupViewDataModel).pluck('hasMixedIcons');
1291
+ var faces = chain(_this._childList).map(function (child) {
1292
+ return child.getFace();
1293
+ }).rejectNil();
1294
+ var icons = faces.select(function (face) { return !!exports.CommandFace.getIconOf(face); });
1295
+ var iconCount = icons.count();
1296
+ var totalFaces = faces.count();
1297
+ _this.hasMixedIcons = valueOf.all(iconCount.isGreaterThan(0), totalFaces.doesNotEqual(iconCount)).areTruthy();
1155
1298
  return _this;
1156
1299
  }
1157
1300
  Object.defineProperty(PopupMenuRendererComponent.prototype, "parent", {
@@ -1227,149 +1370,6 @@
1227
1370
  triggers: [{ type: i0.ViewChildren, args: [menu.MatMenuTrigger,] }]
1228
1371
  };
1229
1372
 
1230
- /**
1231
- * Custom CSS:
1232
- * @example
1233
- * root: { // globally
1234
- * --aup-command-face-icon-gap: 8px;
1235
- * }
1236
- * aup-command-face { // per instance
1237
- * --icon-gap: 4px;
1238
- * }
1239
- */
1240
- var CommandFaceComponent = /** @class */ (function (_super) {
1241
- __extends(CommandFaceComponent, _super);
1242
- function CommandFaceComponent() {
1243
- var _this = _super.call(this) || this;
1244
- _this.facesModel = new pectin.MutableListModel();
1245
- _this.ignoreIcon = false;
1246
- _this.ignoreText = false;
1247
- _this.includeMissingIconInLayout = false;
1248
- 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;
1249
- _this.faceAdapters = chain(_this.facesModel).map(function (face) { return new exports.CommandFace.Adapter(face); });
1250
- var activeFace = _this.faceAdapters.first();
1251
- _this.activeIcon = activeFace.pluck("icon");
1252
- _this.activeColor = activeFace.pluck("color");
1253
- return _this;
1254
- }
1255
- Object.defineProperty(CommandFaceComponent.prototype, "requiresMissingIconInLayout", {
1256
- get: function () {
1257
- return this.includeMissingIconInLayout && !this.activeIcon.value;
1258
- },
1259
- enumerable: false,
1260
- configurable: true
1261
- });
1262
- CommandFaceComponent.prototype.ngOnInit = function () {
1263
- };
1264
- CommandFaceComponent.prototype.shouldIncludeIcon = function (face) {
1265
- return (!this.ignoreIcon && face.icon) || this.includeMissingIconInLayout;
1266
- };
1267
- CommandFaceComponent.prototype.hasIconStart = function (face) {
1268
- return this.shouldIncludeIcon(face) && (!face.iconPosition || face.iconPosition === exports.CommandFace.Position.START);
1269
- };
1270
- CommandFaceComponent.prototype.hasIconEnd = function (face) {
1271
- return this.shouldIncludeIcon(face) && face.iconPosition === exports.CommandFace.Position.END;
1272
- };
1273
- Object.defineProperty(CommandFaceComponent.prototype, "color", {
1274
- get: function () {
1275
- return this.activeColor.value;
1276
- },
1277
- enumerable: false,
1278
- configurable: true
1279
- });
1280
- return CommandFaceComponent;
1281
- }(DisposableComponent));
1282
- CommandFaceComponent.decorators = [
1283
- { type: i0.Component, args: [{
1284
- selector: 'aup-command-face',
1285
- template: "<div class=\"face-container\" *ngFor=\"let face of faceAdapters.value\">\n <aup-icon *ngIf=\"hasIconStart(face)\" [icon]=\"face.icon\"></aup-icon>\n <span *ngIf=\"face.text\">{{face.text}}</span>\n <aup-icon *ngIf=\"hasIconEnd(face)\" [icon]=\"face.icon\"></aup-icon>\n</div>\n",
1286
- encapsulation: i0.ViewEncapsulation.None,
1287
- styles: ["aup-command-face{--icon-gap:var(--aup-command-face-icon-gap);display:-ms-inline-grid;display:inline-grid}aup-command-face>.face-container{-ms-grid-column:1;-ms-grid-row:1;align-items:center;display:inline-flex;flex-direction:row;grid-column:1;grid-row:1}aup-command-face>.face-container:not(:first-child){visibility:hidden}aup-command-face>.face-container *+*{margin-left:var(--icon-gap)}aup-command-face.hide-icon aup-icon{visibility:hidden}aup-command-face.centered{justify-items:center}"]
1288
- },] }
1289
- ];
1290
- CommandFaceComponent.ctorParameters = function () { return []; };
1291
- CommandFaceComponent.propDecorators = {
1292
- _rawFaces: [{ type: i0.Input, args: ['faces',] }],
1293
- ignoreIcon: [{ type: i0.Input }],
1294
- ignoreText: [{ type: i0.Input }],
1295
- includeMissingIconInLayout: [{ type: i0.Input }],
1296
- requiresMissingIconInLayout: [{ type: i0.HostBinding, args: ['class.hide-icon',] }],
1297
- color: [{ type: i0.HostBinding, args: ['attr.color',] }]
1298
- };
1299
- __decorate([
1300
- pectin.StoreInListModel('facesModel'),
1301
- __metadata("design:type", Array)
1302
- ], CommandFaceComponent.prototype, "_rawFaces", void 0);
1303
-
1304
- /**
1305
- *
1306
- */
1307
- var FlexComponent = /** @class */ (function (_super) {
1308
- __extends(FlexComponent, _super);
1309
- function FlexComponent() {
1310
- return _super.call(this) || this;
1311
- }
1312
- FlexComponent.prototype.ngOnInit = function () {
1313
- };
1314
- return FlexComponent;
1315
- }(DisposableComponent));
1316
- FlexComponent.decorators = [
1317
- { type: i0.Component, args: [{
1318
- selector: 'aup-flex',
1319
- template: ""
1320
- },] }
1321
- ];
1322
- FlexComponent.ctorParameters = function () { return []; };
1323
-
1324
- /**
1325
- *
1326
- */
1327
- var MoreMenuComponent = /** @class */ (function (_super) {
1328
- __extends(MoreMenuComponent, _super);
1329
- function MoreMenuComponent(element, parent) {
1330
- var _this = _super.call(this, element, parent) || this;
1331
- _this.tooltipModel = new pectin.MutableValueModel();
1332
- 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;
1333
- _this.faceModelDelegate.setDelegate(chain(_this.tooltipModel).map(function (tooltip) {
1334
- return {
1335
- icon: function () { return 'mat:more_vert'; },
1336
- tooltip: function () {
1337
- return tooltip;
1338
- }
1339
- };
1340
- }, { allowNil: true }));
1341
- return _this;
1342
- }
1343
- Object.defineProperty(MoreMenuComponent.prototype, "face", {
1344
- get: function () {
1345
- return this.faceModelDelegate.value;
1346
- },
1347
- enumerable: false,
1348
- configurable: true
1349
- });
1350
- return MoreMenuComponent;
1351
- }(AbstractPopupMenuComponent));
1352
- MoreMenuComponent.decorators = [
1353
- { type: i0.Component, args: [{
1354
- selector: 'aup-more-menu',
1355
- 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",
1356
- providers: [
1357
- { provide: POPUP_CONTAINER, useExisting: MoreMenuComponent }
1358
- ]
1359
- },] }
1360
- ];
1361
- MoreMenuComponent.ctorParameters = function () { return [
1362
- { type: i0.ElementRef },
1363
- { type: undefined, decorators: [{ type: i0.Inject, args: [POPUP_CONTAINER,] }, { type: i0.Optional }, { type: i0.SkipSelf }] }
1364
- ]; };
1365
- MoreMenuComponent.propDecorators = {
1366
- tooltip: [{ type: i0.Input }]
1367
- };
1368
- __decorate([
1369
- pectin.StoreInValueModel('tooltipModel'),
1370
- __metadata("design:type", String)
1371
- ], MoreMenuComponent.prototype, "tooltip", void 0);
1372
-
1373
1373
  /**
1374
1374
  *
1375
1375
  */
@@ -2538,14 +2538,17 @@
2538
2538
  var ɵ0 = noop;
2539
2539
  var CELL_RENDERER_COMPONENT_ROW_CACHE = Symbol("aup-cell-renderer:row-data-cache");
2540
2540
  var ColumnModel = /** @class */ (function () {
2541
- function ColumnModel(columnId, defaults) {
2541
+ function ColumnModel(columnId, textPropertiesProvider) {
2542
2542
  this.columnId = columnId;
2543
- this.defaults = defaults;
2543
+ this.textPropertiesProvider = textPropertiesProvider;
2544
2544
  this._selectRowOnClick = undefined;
2545
+ this.installHeaderRenderer();
2546
+ }
2547
+ ColumnModel.prototype.installHeaderRenderer = function () {
2545
2548
  this.cellHeaderRenderer(DefaultHeaderCellRendererComponent, function (component, column) {
2546
2549
  component.headerText = column.getHeaderText();
2547
2550
  });
2548
- }
2551
+ };
2549
2552
  ColumnModel.prototype.getHeaderText = function () {
2550
2553
  var _a;
2551
2554
  return ((_a = this.getColumnTextProperties()) === null || _a === void 0 ? void 0 : _a.headerText()) || this.getDefaultHeaderText();
@@ -2554,7 +2557,7 @@
2554
2557
  return this.columnId;
2555
2558
  };
2556
2559
  ColumnModel.prototype.getColumnTextProperties = function () {
2557
- return this._columnTextProperties || this.defaults.getColumnTextProperties(this);
2560
+ return this._columnTextProperties || this.textPropertiesProvider();
2558
2561
  };
2559
2562
  ColumnModel.prototype.textProperties = function (columnTextProperties) {
2560
2563
  this._columnTextProperties = columnTextProperties;
@@ -2892,7 +2895,6 @@
2892
2895
  return EditSession;
2893
2896
  }(pectin.GarbageCollector));
2894
2897
 
2895
- var TableModel_1;
2896
2898
  // export type StringPropertiesOf<T> = { [K in keyof T]: T[K] extends string ? K : never }[keyof T];
2897
2899
  // export type NumberPropertiesOf<T> = { [K in keyof T]: T[K] extends number ? K : never }[keyof T];
2898
2900
  var RowClass = /** @class */ (function () {
@@ -2902,148 +2904,85 @@
2902
2904
  }
2903
2905
  return RowClass;
2904
2906
  }());
2905
- /**
2906
- * Example:
2907
- * @example
2908
- * const model = TableModel.fromList(heroList, table => {
2909
- * table.pluck("firstName");
2910
- * table.pluck("lastName");
2911
- * table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
2912
- * });
2913
- *
2914
- * Editable tables
2915
- * @example
2916
- * const saveCommand = UnaryCommand.create((form: Form<Hero>) => {
2917
- * if (form.validate()) {
2918
- * // normal form save stuff
2919
- * return true; // finish editing
2920
- * }
2921
- * return false; // continue editiing
2922
- * }
2923
- * const colorsNames: ListModel<string> = ...;
2924
- * const model = TableModel.fromList(heroList, table => {
2925
- * table.pluck("firstName").cellEditor(StringInputComponent); <-- interface CellEditor { valueModel: DirtyTrackingForm.ValueModel<string> | ValueModel<string>; }
2926
- * table.pluck("lastName").cellEditor(StringInputComponent, {
2927
- * validators: [Validator.present("We need a last name")]
2928
- * });
2929
- * table.pluck("age").cellEditor(NumberInputComponent);
2930
- * table.pluck("favoriteColor").cellEditor(SelectInputComponent, {
2931
- * initialiseComponent(component: SelectInputComponent) {
2932
- * selectInput.optionsModel = colorsNames; // <- initialise our component
2933
- * }
2934
- * });
2935
- * table.addEditControls(saveCommand); // <- required to enable editing
2936
- * });
2937
- *
2938
- * Selection models
2939
- * @example
2940
- * const model = TableModel.fromList(heroList, table => {
2941
- * table.addSelectionColumn(selectionModel); // <- can be single or multiple selection model
2942
- * table.pluck("firstName");
2943
- * table.pluck("lastName");
2944
- * });
2945
- *
2946
- * Custom cell renderers and editors
2947
- * @example
2948
- * const model = TableModel.fromList(heroList, table => {
2949
- * table.pluck("favoriteColor")
2950
- * .cellHeaderRenderer(CellHeaderRendererComponent, (component, column) => {
2951
- * // configure your component with what ever you need.
2952
- * });
2953
- * .cellRenderer(CellRendererComponent) // <-- interface CellEditor { value: string; }
2954
- * .cellEditor(CellEditorComponent.); // <-- interface CellEditor { valueModel: DirtyTrackingForm.ValueModel<string> | ValueModel<string>; }
2955
- * table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
2956
- * });
2957
- *
2958
- * I18n
2959
- * @example
2960
- * [table.yml]
2961
- * table:
2962
- * columns(ColumnTextProperties[]):
2963
- * firstName:
2964
- * headerText: "First Name"
2965
- * fullName:
2966
- * headerText: "Full Name"
2967
- *
2968
- * const model = TableModel.fromList(heroList, table => {
2969
- * table.pluck("favoriteColor").cellRenderer(...).cellEditor(...);
2970
- * table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
2971
- *
2972
- * table.columnTextProperties(I18n.table.columns); // <- configures all columns
2973
- * });
2974
- */
2975
- exports.TableModel = TableModel_1 = /** @class */ (function () {
2976
- function TableModel(sourceOfTruth) {
2977
- var _this = this;
2978
- this.sourceOfTruth = sourceOfTruth;
2979
- this._garbage = new pectin.GarbageCollector();
2980
- this._columns = new pectin.MutableListModel();
2981
- this._editorSessions = new pectin.MutableListModel();
2982
- this.rowClassNamePredicates = [];
2983
- this.rowClickListeners = new pectin.EventListenerList();
2984
- this._createForm = function (row) { return new pectin.DirtyTrackingForm(); };
2985
- this.trackBy = function (index, item) {
2907
+ exports.AbstractTableModel = /** @class */ (function (_super) {
2908
+ __extends(AbstractTableModel, _super);
2909
+ function AbstractTableModel(sourceOfTruth) {
2910
+ var _this = _super.call(this) || this;
2911
+ _this.sourceOfTruth = sourceOfTruth;
2912
+ _this._columns = new pectin.MutableListModel();
2913
+ _this._editorSessions = new pectin.MutableListModel();
2914
+ _this.rowClassNamePredicates = [];
2915
+ _this.rowClickListeners = new pectin.EventListenerList();
2916
+ _this._createForm = function (row) { return new pectin.DirtyTrackingForm(); };
2917
+ _this.trackBy = function (index, item) {
2986
2918
  return _this.identityOf ? _this.identityOf(item) : index;
2987
2919
  };
2988
- this.identityOf = sourceOfTruth.identityOf;
2989
- var _b = pectin.Dsl.disposeWith(this._garbage), chain = _b.chain, valueOf = _b.valueOf, before = _b.before, when = _b.when, after = _b.after, observe = _b.observe, switchOn = _b.switchOn;
2990
- this._columnsById = chain(this._columns).indexBy('columnId');
2991
- this._rowsBeingEdited = new pectin.MutableListModel([], {
2992
- identifiedWith: this.identityOf
2920
+ _this.identityOf = sourceOfTruth.identityOf;
2921
+ var _b = pectin.Dsl.disposeWith(_this), chain = _b.chain, valueOf = _b.valueOf, before = _b.before, when = _b.when, after = _b.after, observe = _b.observe, switchOn = _b.switchOn;
2922
+ _this._columnsById = chain(_this._columns).indexBy('columnId');
2923
+ _this._rowsBeingEdited = new pectin.MutableListModel([], {
2924
+ identifiedWith: _this.identityOf
2993
2925
  });
2994
- this._editorSessionByRowId = chain(this._editorSessions).indexBy('rowId');
2995
- this.editing = chain(this._editorSessions).count().isGreaterThan(0);
2996
- this.dataSource = chain(this.sourceOfTruth).replaceAll(this.rowsBeingEdited);
2997
- this.firstEditableColumn = chain(this.columns).select(function (c) { return c.hasEditorPortal(); }).first();
2998
- this.hasColumnsWithRowSelectionExplicitlyEnabled = chain(this._columns).findIndex(function (column) { return column.isRowSelectionExplicitlyEnabled(); }).isGreaterThanOrEqualTo(0);
2926
+ _this._editorSessionByRowId = chain(_this._editorSessions).indexBy('rowId');
2927
+ _this.editing = chain(_this._editorSessions).count().isGreaterThan(0);
2928
+ _this.dataSource = chain(_this.sourceOfTruth).replaceAll(_this.rowsBeingEdited);
2929
+ _this.firstEditableColumn = chain(_this.columns).select(function (c) { return c.hasEditorPortal(); }).first();
2930
+ _this.hasColumnsWithRowSelectionExplicitlyEnabled = chain(_this._columns).findIndex(function (column) { return column.isRowSelectionExplicitlyEnabled(); }).isGreaterThanOrEqualTo(0);
2931
+ return _this;
2999
2932
  }
3000
- TableModel.fromList = function (sourceOfTruth, builder) {
3001
- var model = new TableModel_1(sourceOfTruth);
3002
- builder(model);
3003
- return model;
3004
- };
3005
- Object.defineProperty(TableModel.prototype, "rowsBeingEdited", {
2933
+ Object.defineProperty(AbstractTableModel.prototype, "rowsBeingEdited", {
3006
2934
  get: function () {
3007
2935
  return this._rowsBeingEdited.readonly;
3008
2936
  },
3009
2937
  enumerable: false,
3010
2938
  configurable: true
3011
2939
  });
3012
- Object.defineProperty(TableModel.prototype, "columns", {
2940
+ Object.defineProperty(AbstractTableModel.prototype, "columns", {
3013
2941
  get: function () {
3014
2942
  return this._columns.readonly;
3015
2943
  },
3016
2944
  enumerable: false,
3017
2945
  configurable: true
3018
2946
  });
3019
- TableModel.prototype.pluck = function (property, options) {
3020
- return this.addColumn(new PropertyColumnModel((options === null || options === void 0 ? void 0 : options.columnId) || property.toString(), property, this));
2947
+ AbstractTableModel.prototype.pluck = function (property, options) {
2948
+ var _this = this;
2949
+ var columnId = (options === null || options === void 0 ? void 0 : options.columnId) || property.toString();
2950
+ return this.addColumn(new PropertyColumnModel(columnId, property, function () { return _this.getColumnTextProperties(columnId); }));
3021
2951
  };
3022
- TableModel.prototype.pluckList = function (property, options) {
3023
- return this.addColumn(new ListPropertyColumnModel((options === null || options === void 0 ? void 0 : options.columnId) || property.toString(), property, this));
2952
+ AbstractTableModel.prototype.pluckList = function (property, options) {
2953
+ var _this = this;
2954
+ var columnId = (options === null || options === void 0 ? void 0 : options.columnId) || property.toString();
2955
+ return this.addColumn(new ListPropertyColumnModel(columnId, property, function () { return _this.getColumnTextProperties(columnId); }));
3024
2956
  };
3025
- TableModel.prototype.addSelectionColumn = function (selectionModel) {
2957
+ AbstractTableModel.prototype._addSelectionColumn = function (selectionModel) {
2958
+ var _this = this;
3026
2959
  pectin.assert.isNil(this.selectionColumnModel);
3027
- this.selectionColumnModel = new SelectionColumnModel('selection', this, selectionModel);
2960
+ var columnId = 'selection-column';
2961
+ this.selectionColumnModel = new SelectionColumnModel(columnId, function () { return _this.getColumnTextProperties(columnId); }, selectionModel);
3028
2962
  return this.addColumn(this.selectionColumnModel);
3029
2963
  };
3030
- TableModel.prototype.addEditControls = function (saveCommand) {
2964
+ AbstractTableModel.prototype.addEditControls = function (saveCommand) {
2965
+ var _this = this;
3031
2966
  this.saveCommand = saveCommand;
3032
- return this.addColumn(new EditorControlColumnModel('editControls', saveCommand, this));
2967
+ var columnId = 'editControls';
2968
+ return this.addColumn(new EditorControlColumnModel(columnId, saveCommand, function () { return _this.getColumnTextProperties(columnId); }));
3033
2969
  };
3034
- TableModel.prototype.addCustomColumn = function (columnId, dataAccessor) {
3035
- return this.addColumn(new CustomValueColumnModel(columnId, this, dataAccessor));
2970
+ AbstractTableModel.prototype.addCustomColumn = function (columnId, dataAccessor) {
2971
+ var _this = this;
2972
+ return this.addColumn(new CustomValueColumnModel(columnId, function () { return _this.getColumnTextProperties(columnId); }, dataAccessor));
3036
2973
  };
3037
- TableModel.prototype.addComponentColumn = function (columnId, component, onComponentInitOrOptions) {
3038
- return this.addColumn(new CustomValueColumnModel(columnId, this, function (row) { return row; })).cellRenderer(component, onComponentInitOrOptions);
2974
+ AbstractTableModel.prototype.addComponentColumn = function (columnId, component, onComponentInitOrOptions) {
2975
+ var _this = this;
2976
+ return this.addColumn(new CustomValueColumnModel(columnId, function () { return _this.getColumnTextProperties(columnId); }, function (row) { return row; })).cellRenderer(component, onComponentInitOrOptions);
3039
2977
  };
3040
- TableModel.prototype.addTemplateColumn = function (columnId) {
3041
- return this.addColumn(new CustomTemplateColumnModel(columnId, this));
2978
+ AbstractTableModel.prototype.addTemplateColumn = function (columnId) {
2979
+ var _this = this;
2980
+ return this.addColumn(new CustomTemplateColumnModel(columnId, function () { return _this.getColumnTextProperties(columnId); }));
3042
2981
  };
3043
- TableModel.prototype.addRowClass = function (className, predicate) {
2982
+ AbstractTableModel.prototype.addRowClass = function (className, predicate) {
3044
2983
  this.rowClassNamePredicates.push(new RowClass(className, predicate));
3045
2984
  };
3046
- TableModel.prototype.getRowClasses = function (row) {
2985
+ AbstractTableModel.prototype.getRowClasses = function (row) {
3047
2986
  var classNames = [];
3048
2987
  this.rowClassNamePredicates.forEach(function (i) {
3049
2988
  if (i.matches(row)) {
@@ -3052,11 +2991,11 @@
3052
2991
  });
3053
2992
  return classNames;
3054
2993
  };
3055
- TableModel.prototype.useFormFactory = function (factory) {
2994
+ AbstractTableModel.prototype.useFormFactory = function (factory) {
3056
2995
  this._createForm = factory;
3057
2996
  return this;
3058
2997
  };
3059
- TableModel.prototype.addColumn = function (column) {
2998
+ AbstractTableModel.prototype.addColumn = function (column) {
3060
2999
  if (this._columnsById.get(column.columnId)) {
3061
3000
  pectin.lang.illegalState("Column with id=" + column.columnId + " already exists");
3062
3001
  }
@@ -3065,16 +3004,24 @@
3065
3004
  }
3066
3005
  return column;
3067
3006
  };
3007
+ Object.defineProperty(AbstractTableModel.prototype, "selectionModel", {
3008
+ get: function () {
3009
+ var _a;
3010
+ return (_a = this.selectionColumnModel) === null || _a === void 0 ? void 0 : _a.selectionModel;
3011
+ },
3012
+ enumerable: false,
3013
+ configurable: true
3014
+ });
3068
3015
  // removeColumn(column: ColumnModel<Row>) {
3069
3016
  //
3070
3017
  // }
3071
- TableModel.prototype.columnTextProperties = function (columnTextProperties) {
3018
+ AbstractTableModel.prototype.columnTextProperties = function (columnTextProperties) {
3072
3019
  this._columnTextPropertiesLookup = columnTextProperties;
3073
3020
  };
3074
- TableModel.prototype.getColumnTextProperties = function (column) {
3075
- return this._columnTextPropertiesLookup ? this._columnTextPropertiesLookup[column.columnId] : undefined;
3021
+ AbstractTableModel.prototype.getColumnTextProperties = function (columnId) {
3022
+ return this._columnTextPropertiesLookup ? this._columnTextPropertiesLookup[columnId] : undefined;
3076
3023
  };
3077
- TableModel.prototype.startEditSession = function (row) {
3024
+ AbstractTableModel.prototype.startEditSession = function (row) {
3078
3025
  var _this = this;
3079
3026
  var rowId = this.identityOf(row);
3080
3027
  if (this._rowsBeingEdited.query().indexOf(row) > -1) {
@@ -3094,10 +3041,10 @@
3094
3041
  return editSession_1;
3095
3042
  }
3096
3043
  };
3097
- TableModel.prototype.getEditSessionFor = function (row) {
3044
+ AbstractTableModel.prototype.getEditSessionFor = function (row) {
3098
3045
  return this._editorSessionByRowId.get(this.identityOf(row));
3099
3046
  };
3100
- TableModel.prototype.cancelAllEditorSessions = function () {
3047
+ AbstractTableModel.prototype.cancelAllEditorSessions = function () {
3101
3048
  var _this = this;
3102
3049
  this._editorSessions.runInTransaction(function (draft) {
3103
3050
  _this._rowsBeingEdited.runInTransaction(function () {
@@ -3105,47 +3052,41 @@
3105
3052
  });
3106
3053
  });
3107
3054
  };
3108
- TableModel.prototype.isRowSelectionEnabledFor = function (column) {
3055
+ AbstractTableModel.prototype.isRowSelectionEnabledFor = function (column) {
3109
3056
  var _a;
3110
3057
  return this.selectionColumnModel && ((_a = column.isRowSelectionEnabled()) !== null && _a !== void 0 ? _a : this.isRowSelectionEnabledByDefault());
3111
3058
  };
3112
- TableModel.prototype.isRowSelectionEnabledByDefault = function () {
3059
+ AbstractTableModel.prototype.isRowSelectionEnabledByDefault = function () {
3113
3060
  return this.selectionColumnModel && this.selectionColumnModel.isRowSelectionEnabledByDefault();
3114
3061
  };
3115
- TableModel.prototype.isRowSelectionEnabled = function () {
3062
+ AbstractTableModel.prototype.isRowSelectionEnabled = function () {
3116
3063
  return this.hasColumnsWithRowSelectionExplicitlyEnabled.value || this.isRowSelectionEnabledByDefault();
3117
3064
  };
3118
- TableModel.prototype.isHoverEnabled = function () {
3065
+ AbstractTableModel.prototype.isHoverEnabled = function () {
3119
3066
  return this.isRowSelectionEnabled() || this.rowClickListeners.listenerCount > 0;
3120
3067
  };
3121
- TableModel.prototype.isCursorEnabled = function (column) {
3122
- // console.log({
3123
- // column: column.columnId,
3124
- // rowSelectionEnabled: this.isRowSelectionEnabledFor(column),
3125
- // hasRowListeners: this.rowClickListeners.listenerCount > 0
3126
- // });
3068
+ AbstractTableModel.prototype.isCursorEnabled = function (column) {
3127
3069
  return this.isRowSelectionEnabledFor(column) || this.rowClickListeners.listenerCount > 0;
3128
3070
  };
3129
- TableModel.prototype.selectRow = function (row) {
3071
+ AbstractTableModel.prototype.selectRow = function (row) {
3130
3072
  var _a;
3131
3073
  (_a = this.selectionColumnModel) === null || _a === void 0 ? void 0 : _a.selectRow(row);
3132
3074
  };
3133
- TableModel.prototype.onRowClicked = function (callback) {
3075
+ AbstractTableModel.prototype.onRowClicked = function (callback) {
3134
3076
  return this.rowClickListeners.add(callback);
3135
3077
  };
3136
- // @Trace()
3137
- TableModel.prototype._notifyCellClicked = function (columnModel, row) {
3078
+ AbstractTableModel.prototype._notifyCellClicked = function (columnModel, row) {
3138
3079
  if (this.isRowSelectionEnabledFor(columnModel)) {
3139
3080
  this.selectRow(row);
3140
3081
  }
3141
3082
  this.rowClickListeners.fire(function (l) { return l(row); });
3142
3083
  };
3143
- return TableModel;
3144
- }());
3145
- exports.TableModel = TableModel_1 = __decorate([
3084
+ return AbstractTableModel;
3085
+ }(pectin.GarbageCollector));
3086
+ exports.AbstractTableModel = __decorate([
3146
3087
  pectin.TrackExternal.Strategy(new pectin.TrackExternal.OneTimeBinding()),
3147
3088
  __metadata("design:paramtypes", [pectin.ListModel])
3148
- ], exports.TableModel);
3089
+ ], exports.AbstractTableModel);
3149
3090
 
3150
3091
  /**
3151
3092
  * Create your model:
@@ -3203,7 +3144,7 @@
3203
3144
  { type: i0.Component, args: [{
3204
3145
  selector: 'aup-table',
3205
3146
  template: "<table mat-table [dataSource]=\"tableModel.dataSource.value\" [trackBy]=\"tableModel.trackBy\">\n\n <ng-container *ngFor=\"let column of columns.value; index as index; first as first; last as last\" matColumnDef=\"{{column.columnId}}\">\n <th mat-header-cell *matHeaderCellDef>\n <aup-table-header-cell-renderer [column]=\"column\"\n [attr.column-index]=\"index\"\n [attr.column-id]=\"column.columnId\"\n [class.first-column]=\"first\"\n [class.last-column]=\"last\"\n ></aup-table-header-cell-renderer>\n </th>\n <td mat-cell *matCellDef=\"let row\" (click)=\"notifyCellClicked(column, row)\" [class.enable-cursor]=\"tableModel.isCursorEnabled(column)\">\n <aup-table-cell-renderer [column]=\"column\"\n [row]=\"row\"\n [tableModel]=\"tableModel\"\n [editSession]=\"tableModel.getEditSessionFor(row)\"\n [attr.column-index]=\"index\"\n [attr.column-id]=\"column.columnId\"\n [class.first-column]=\"first\"\n [class.last-column]=\"last\"\n ></aup-table-cell-renderer>\n </td>\n </ng-container>\n\n <tr mat-header-row *matHeaderRowDef=\"columnIds.value\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: columnIds.value; let i = index\"\n [ngClass]=\"tableModel.getRowClasses(row)\" [class.enable-hover]=\"tableModel.isHoverEnabled()\" [attr.trackBy]=\"tableModel.trackBy(i, row)\"\n ></tr>\n\n</table>\n",
3206
- styles: [":host{align-items:stretch;display:flex;flex-direction:column}:host table{flex:1;width:100%}"]
3147
+ styles: [":host{align-items:stretch;display:flex;flex-direction:column}:host table{flex:1;width:100%}.mat-column-selection-column{width:1px!important}"]
3207
3148
  },] }
3208
3149
  ];
3209
3150
  TableComponent.ctorParameters = function () { return []; };
@@ -3212,7 +3153,7 @@
3212
3153
  };
3213
3154
  __decorate([
3214
3155
  pectin.TrackExternal(),
3215
- __metadata("design:type", exports.TableModel)
3156
+ __metadata("design:type", exports.AbstractTableModel)
3216
3157
  ], TableComponent.prototype, "tableModel", void 0);
3217
3158
 
3218
3159
  var ColumnTemplateDirective = /** @class */ (function () {
@@ -3257,155 +3198,817 @@
3257
3198
  _this.editRowCommand = pectin.Command.create(function () {
3258
3199
  _this.tableModel.startEditSession(_this.row);
3259
3200
  });
3260
- return _this;
3261
- }
3262
- TableCellRendererComponent.prototype.ngOnInit = function () {
3263
- var _b = pectin.Dsl.disposeWith(this), chain = _b.chain, valueOf = _b.valueOf, before = _b.before, when = _b.when, after = _b.after, observe = _b.observe, switchOn = _b.switchOn;
3264
- this.firstEditableColumn = chain(this.tableModel.firstEditableColumn).equals(this.column); // this would break if the column changed.
3265
- this.column.attachCell(this);
3201
+ return _this;
3202
+ }
3203
+ TableCellRendererComponent.prototype.ngOnInit = function () {
3204
+ var _b = pectin.Dsl.disposeWith(this), chain = _b.chain, valueOf = _b.valueOf, before = _b.before, when = _b.when, after = _b.after, observe = _b.observe, switchOn = _b.switchOn;
3205
+ this.firstEditableColumn = chain(this.tableModel.firstEditableColumn).equals(this.column); // this would break if the column changed.
3206
+ this.column.attachCell(this);
3207
+ };
3208
+ TableCellRendererComponent.prototype.hasActiveEditor = function () {
3209
+ return !!this.editSession && !!this.column.hasEditorPortal();
3210
+ };
3211
+ TableCellRendererComponent.prototype.initialiseRenderer = function (instance) {
3212
+ this.column.onRendererAttached(this, instance);
3213
+ };
3214
+ TableCellRendererComponent.prototype.initialiseEditor = function (instance) {
3215
+ var _this = this;
3216
+ this.column.onEditorAttached(this, instance);
3217
+ if (this.firstEditableColumn.value) {
3218
+ // @see https://github.com/angular/components/issues/12070
3219
+ setTimeout(function () { return _this.tryAndFocusEditor(instance); });
3220
+ }
3221
+ };
3222
+ TableCellRendererComponent.prototype.tryAndFocusEditor = function (editor) {
3223
+ var _a;
3224
+ if (editor.requestFocus) {
3225
+ editor.requestFocus();
3226
+ }
3227
+ else {
3228
+ var model = (editor['valueModel'] || editor['listModel']);
3229
+ (_a = model === null || model === void 0 ? void 0 : model.focusContext) === null || _a === void 0 ? void 0 : _a.requestFocus();
3230
+ }
3231
+ };
3232
+ // @Trace()
3233
+ TableCellRendererComponent.prototype.ngOnChanges = function (changes) {
3234
+ this.column.updatePortalContent(this);
3235
+ };
3236
+ TableCellRendererComponent.prototype.getRendererPortal = function () {
3237
+ return this[CELL_RENDERER_PORTAL];
3238
+ };
3239
+ TableCellRendererComponent.prototype.getEditorPortal = function () {
3240
+ return this[CELL_EDITOR_PORTAL];
3241
+ };
3242
+ TableCellRendererComponent.prototype.getRowData = function () {
3243
+ return {
3244
+ row: this.row,
3245
+ editSession: this.editSession,
3246
+ editRowCommand: this.editRowCommand
3247
+ };
3248
+ };
3249
+ return TableCellRendererComponent;
3250
+ }(DisposableComponent));
3251
+ TableCellRendererComponent.decorators = [
3252
+ { type: i0.Component, args: [{
3253
+ selector: 'aup-table-cell-renderer',
3254
+ template: "<ng-container *ngIf=\"!hasActiveEditor()\" [cdkPortalOutlet]=\"getRendererPortal()\" (attached)=\"initialiseRenderer($event.instance)\"></ng-container>\n<ng-container *ngIf=\"hasActiveEditor()\" [cdkPortalOutlet]=\"getEditorPortal()\" (attached)=\"initialiseEditor($event.instance)\"></ng-container>\n",
3255
+ styles: [""]
3256
+ },] }
3257
+ ];
3258
+ TableCellRendererComponent.ctorParameters = function () { return []; };
3259
+ TableCellRendererComponent.propDecorators = {
3260
+ row: [{ type: i0.Input }],
3261
+ column: [{ type: i0.Input }],
3262
+ editSession: [{ type: i0.Input }],
3263
+ tableModel: [{ type: i0.Input }],
3264
+ defaultClassNames: [{ type: i0.HostBinding, args: ['class',] }],
3265
+ fillCell: [{ type: i0.HostBinding, args: ['class.fillCell',] }],
3266
+ padChild: [{ type: i0.HostBinding, args: ['class.padChild',] }]
3267
+ };
3268
+
3269
+ var TableHeaderCellRendererComponent = /** @class */ (function () {
3270
+ function TableHeaderCellRendererComponent() {
3271
+ this.defaultClassNames = 'aup-header-cell-renderer';
3272
+ }
3273
+ TableHeaderCellRendererComponent.prototype.ngOnInit = function () {
3274
+ this.column.attachHeaderCell(this);
3275
+ };
3276
+ // @Trace()
3277
+ TableHeaderCellRendererComponent.prototype.initialiseHeader = function (instance) {
3278
+ this.column.onHeaderAttached(this, instance);
3279
+ };
3280
+ TableHeaderCellRendererComponent.prototype.getPortal = function () {
3281
+ return this[HEADER_CELL_RENDERER_PORTAL];
3282
+ };
3283
+ return TableHeaderCellRendererComponent;
3284
+ }());
3285
+ TableHeaderCellRendererComponent.decorators = [
3286
+ { type: i0.Component, args: [{
3287
+ selector: 'aup-table-header-cell-renderer',
3288
+ template: "<ng-container [cdkPortalOutlet]=\"getPortal()\" (attached)=\"initialiseHeader($event.instance)\"></ng-container>\n",
3289
+ styles: [":host{align-items:stretch;display:flex;flex-direction:column;height:100%;justify-content:center}"]
3290
+ },] }
3291
+ ];
3292
+ TableHeaderCellRendererComponent.ctorParameters = function () { return []; };
3293
+ TableHeaderCellRendererComponent.propDecorators = {
3294
+ column: [{ type: i0.Input }],
3295
+ defaultClassNames: [{ type: i0.HostBinding, args: ['class',] }]
3296
+ };
3297
+
3298
+ var MenuItemData = /** @class */ (function () {
3299
+ function MenuItemData(factory, face) {
3300
+ this.factory = factory;
3301
+ this.face = face;
3302
+ }
3303
+ return MenuItemData;
3304
+ }());
3305
+ /**
3306
+ *
3307
+ */
3308
+ var TableRowMenuComponent = /** @class */ (function (_super) {
3309
+ __extends(TableRowMenuComponent, _super);
3310
+ function TableRowMenuComponent() {
3311
+ var _this = _super.call(this) || this;
3312
+ _this.actions = [];
3313
+ _this.moreActions = [];
3314
+ return _this;
3315
+ }
3316
+ TableRowMenuComponent.prototype.registerAction = function (commandFactory, properties) {
3317
+ this.actions.push(new MenuItemData(commandFactory, properties));
3318
+ };
3319
+ TableRowMenuComponent.prototype.registerMoreAction = function (commandFactory, properties) {
3320
+ this.moreActions.push(new MenuItemData(commandFactory, properties));
3321
+ };
3322
+ TableRowMenuComponent.prototype.ngOnInit = function () {
3323
+ };
3324
+ TableRowMenuComponent.prototype.createMoreMenuCommand = function (item, value) {
3325
+ var _this = this;
3326
+ var when = pectin.Dsl.disposeWith(this).when;
3327
+ var command = item.factory.create(value);
3328
+ when(command.busy).becomesFalsey(function () {
3329
+ _this.closeMoreMenu();
3330
+ });
3331
+ return command;
3332
+ };
3333
+ TableRowMenuComponent.prototype.closeMoreMenu = function () {
3334
+ this.menu.closeMenu();
3335
+ };
3336
+ return TableRowMenuComponent;
3337
+ }(DisposableComponent));
3338
+ TableRowMenuComponent.decorators = [
3339
+ { type: i0.Component, args: [{
3340
+ selector: 'aup-table-row-menu',
3341
+ template: "\n <aup-tool-bar>\n <aup-command *ngFor=\"let action of actions\" [command]=\"action.factory.create(value)\"\n [face]=\"action.face\"></aup-command>\n </aup-tool-bar>\n <ng-container *ngIf=\"moreActions.length > 0\">\n <aup-more-menu>\n <aup-command *ngFor=\"let action of moreActions\" [command]=\"action.factory.create(value)\"\n [face]=\"action.face\"></aup-command>\n </aup-more-menu>\n </ng-container>\n ",
3342
+ styles: [":host {\n display: inline-flex;\n flex-direction: row;\n align-items: center;\n }"]
3343
+ },] }
3344
+ ];
3345
+ TableRowMenuComponent.ctorParameters = function () { return []; };
3346
+ TableRowMenuComponent.propDecorators = {
3347
+ value: [{ type: i0.Input }],
3348
+ menu: [{ type: i0.ViewChild, args: [menu.MatMenuTrigger,] }]
3349
+ };
3350
+
3351
+ var SVG_HEIGHT = 60;
3352
+ exports.TreeInheritanceIconComponent = /** @class */ (function () {
3353
+ function TreeInheritanceIconComponent() {
3354
+ this.pixelWidth = 24;
3355
+ this.pixelHeight = 48;
3356
+ }
3357
+ Object.defineProperty(TreeInheritanceIconComponent.prototype, "heightOffset", {
3358
+ get: function () {
3359
+ return SVG_HEIGHT - this.pixelHeight;
3360
+ },
3361
+ enumerable: false,
3362
+ configurable: true
3363
+ });
3364
+ Object.defineProperty(TreeInheritanceIconComponent.prototype, "viewBox", {
3365
+ get: function () {
3366
+ return 0 + " " + this.heightOffset + " " + this.pixelWidth + " " + (this.pixelHeight - this.heightOffset);
3367
+ },
3368
+ enumerable: false,
3369
+ configurable: true
3370
+ });
3371
+ TreeInheritanceIconComponent.prototype.hasHead = function () {
3372
+ return TreeInheritanceIconComponent.HAS_HEAD.includes(this.type);
3373
+ };
3374
+ TreeInheritanceIconComponent.prototype.hasTerminal = function () {
3375
+ return TreeInheritanceIconComponent.HAS_TERMINAL.includes(this.type);
3376
+ };
3377
+ TreeInheritanceIconComponent.prototype.hasLeadIn = function () {
3378
+ return TreeInheritanceIconComponent.HAS_LEAD_IN.includes(this.type);
3379
+ };
3380
+ TreeInheritanceIconComponent.prototype.hasTail = function () {
3381
+ return TreeInheritanceIconComponent.HAS_TAIL.includes(this.type);
3382
+ };
3383
+ return TreeInheritanceIconComponent;
3384
+ }());
3385
+ exports.TreeInheritanceIconComponent.decorators = [
3386
+ { type: i0.Component, args: [{
3387
+ selector: 'aup-tree-inheritance-icon',
3388
+ template: "<svg xmlns=\"http://www.w3.org/2000/svg\" [attr.width]=\"pixelWidth\" [attr.height]=\"pixelHeight\" [attr.viewBox]=\"viewBox\">\n <g fill=\"none\" fill-rule=\"evenodd\">\n <rect *ngIf=\"hasHead()\" width=\"1\" height=\"32.5\" x=\"11.5\" fill=\"currentColor\"/>\n <rect *ngIf=\"hasTail()\" width=\"1\" height=\"32.5\" x=\"11.5\" y=\"31.5\" fill=\"currentColor\"/>\n\n <rect *ngIf=\"hasLeadIn()\" width=\"12\" height=\"1\" y=\"31.5\" fill=\"currentColor\"/>\n <rect *ngIf=\"hasTerminal()\" width=\"12\" height=\"1\" x=\"12\" y=\"31.5\" fill=\"currentColor\"/>\n </g>\n</svg>\n",
3389
+ styles: [":host{color:inherit;position:relative}svg{color:var(--line-color);display:block}"]
3390
+ },] }
3391
+ ];
3392
+ exports.TreeInheritanceIconComponent.ctorParameters = function () { return []; };
3393
+ exports.TreeInheritanceIconComponent.propDecorators = {
3394
+ type: [{ type: i0.Input }, { type: i0.HostBinding, args: ["class",] }],
3395
+ pixelWidth: [{ type: i0.Input }],
3396
+ pixelHeight: [{ type: i0.Input }]
3397
+ };
3398
+ (function (TreeInheritanceIconComponent) {
3399
+ TreeInheritanceIconComponent.Type = typescriptStringEnums.Enum({
3400
+ ICON_BLANK: 'blank',
3401
+ ICON_PARENT: 'parent',
3402
+ ICON_INHERITED_TERMINAL: 'inherited_terminal',
3403
+ ICON_INHERITED_THROUGH_TERMINAL: 'inherited_through_terminal',
3404
+ ICON_THROUGH: 'through' // |
3405
+ });
3406
+ TreeInheritanceIconComponent.HAS_LEAD_IN = [
3407
+ TreeInheritanceIconComponent.Type.ICON_PARENT
3408
+ ];
3409
+ TreeInheritanceIconComponent.HAS_TERMINAL = [
3410
+ TreeInheritanceIconComponent.Type.ICON_INHERITED_TERMINAL,
3411
+ TreeInheritanceIconComponent.Type.ICON_INHERITED_THROUGH_TERMINAL,
3412
+ TreeInheritanceIconComponent.Type.ICON_PARENT
3413
+ ];
3414
+ TreeInheritanceIconComponent.HAS_HEAD = [
3415
+ TreeInheritanceIconComponent.Type.ICON_THROUGH,
3416
+ TreeInheritanceIconComponent.Type.ICON_INHERITED_TERMINAL,
3417
+ TreeInheritanceIconComponent.Type.ICON_INHERITED_THROUGH_TERMINAL
3418
+ ];
3419
+ TreeInheritanceIconComponent.HAS_TAIL = [
3420
+ TreeInheritanceIconComponent.Type.ICON_PARENT,
3421
+ TreeInheritanceIconComponent.Type.ICON_THROUGH,
3422
+ TreeInheritanceIconComponent.Type.ICON_INHERITED_THROUGH_TERMINAL
3423
+ ];
3424
+ })(exports.TreeInheritanceIconComponent || (exports.TreeInheritanceIconComponent = {}));
3425
+
3426
+ var TreeLabelCellRendererComponent = /** @class */ (function (_super) {
3427
+ __extends(TreeLabelCellRendererComponent, _super);
3428
+ function TreeLabelCellRendererComponent() {
3429
+ var _this = _super.call(this) || this;
3430
+ _this.iconTypes = [];
3431
+ _this.nodeModel = new pectin.MutableValueModel();
3432
+ var chain = pectin.Dsl.disposeWith(_this).chain;
3433
+ _this.iconList = chain(_this.nodeModel).mapToList(function (node) {
3434
+ var icons = node.ancestors().slice(1).map(function (ancestor) {
3435
+ return ancestor.isLastChild() ? exports.TreeInheritanceIconComponent.Type.ICON_BLANK : exports.TreeInheritanceIconComponent.Type.ICON_THROUGH;
3436
+ });
3437
+ if (!node.isRoot()) {
3438
+ icons.push(node.isLastChild() ? exports.TreeInheritanceIconComponent.Type.ICON_INHERITED_TERMINAL : exports.TreeInheritanceIconComponent.Type.ICON_INHERITED_THROUGH_TERMINAL);
3439
+ }
3440
+ return icons;
3441
+ });
3442
+ return _this;
3443
+ }
3444
+ TreeLabelCellRendererComponent.prototype.ngOnInit = function () {
3445
+ var _this = this;
3446
+ var chain = pectin.Dsl.disposeWith(this).chain;
3447
+ this.canExpand = chain(this.nodeModel).map(function (node) {
3448
+ return node.hasChildren() && _this.expansionModel.isCollapsed(node);
3449
+ }, { dependsOn: this.expansionModel.isExpandedPredicate });
3450
+ this.canCollapse = chain(this.nodeModel).map(function (node) {
3451
+ return node.hasChildren() && !_this.expansionModel.isCollapsed(node);
3452
+ }, { dependsOn: this.expansionModel.isExpandedPredicate });
3453
+ this.iconModel = chain(this.nodeModel).map(function (node) {
3454
+ return _this.node.isLeaf() ? undefined : _this.iconFactory(node, _this.expansionModel.isExpanded(_this.node));
3455
+ }, { dependsOn: this.expansionModel.isExpandedPredicate });
3456
+ };
3457
+ Object.defineProperty(TreeLabelCellRendererComponent.prototype, "isRoot", {
3458
+ get: function () {
3459
+ return this.node.isRoot();
3460
+ },
3461
+ enumerable: false,
3462
+ configurable: true
3463
+ });
3464
+ Object.defineProperty(TreeLabelCellRendererComponent.prototype, "isLeaf", {
3465
+ get: function () {
3466
+ return this.node.isLeaf();
3467
+ },
3468
+ enumerable: false,
3469
+ configurable: true
3470
+ });
3471
+ Object.defineProperty(TreeLabelCellRendererComponent.prototype, "node", {
3472
+ get: function () {
3473
+ return this.nodeModel.value;
3474
+ },
3475
+ enumerable: false,
3476
+ configurable: true
3477
+ });
3478
+ // @Trace()
3479
+ TreeLabelCellRendererComponent.prototype.expandOrCollapse = function (node) {
3480
+ this.expansionModel.isCollapsed(node) ? this.expansionModel.expand(node) : this.expansionModel.collapse(node);
3481
+ };
3482
+ return TreeLabelCellRendererComponent;
3483
+ }(DisposableComponent));
3484
+ TreeLabelCellRendererComponent.decorators = [
3485
+ { type: i0.Component, args: [{
3486
+ selector: 'aup-tree-label-cell-renderer',
3487
+ template: "<div class=\"tree-icons\">\n <aup-tree-inheritance-icon *ngFor=\"let iconClass of iconList.value\" [type]=\"iconClass\"></aup-tree-inheritance-icon>\n <aup-icon *ngIf=\"iconModel.value\"\n [icon]=\"iconModel.value\"\n [class.clickable]=\"canExpand.value || canCollapse.value\"\n (click)=\"expandOrCollapse(node)\" ></aup-icon>\n</div>\n<div class=\"label\">{{label}}</div>\n",
3488
+ styles: [":host{--line-color:#ddd;--node-color:#999;align-items:stretch;display:inline-flex;flex-direction:row}:host div.label{align-items:center;display:flex;flex-direction:row;padding-left:6px;white-space:nowrap}:host div.tree-icons{-ms-grid-rows:1fr;align-items:stretch;display:-ms-grid;display:grid;grid-auto-columns:auto;grid-auto-flow:column;grid-template-rows:1fr;justify-content:stretch}:host div.tree-icons aup-icon{-ms-grid-row-align:center;align-self:center;color:var(--node-color)}:host div.tree-icons aup-icon.clickable{cursor:pointer}:host div.tree-icons aup-icon,:host div.tree-icons aup-tree-inheritance-icon{margin-left:4px}"]
3489
+ },] }
3490
+ ];
3491
+ TreeLabelCellRendererComponent.ctorParameters = function () { return []; };
3492
+ TreeLabelCellRendererComponent.propDecorators = {
3493
+ value: [{ type: i0.Input }],
3494
+ label: [{ type: i0.Input }],
3495
+ iconFactory: [{ type: i0.Input }],
3496
+ expansionModel: [{ type: i0.Input }],
3497
+ isRoot: [{ type: i0.HostBinding, args: ['class.root',] }],
3498
+ isLeaf: [{ type: i0.HostBinding, args: ['class.leaf',] }]
3499
+ };
3500
+ __decorate([
3501
+ pectin.StoreInValueModel('nodeModel'),
3502
+ __metadata("design:type", Object)
3503
+ ], TreeLabelCellRendererComponent.prototype, "value", void 0);
3504
+
3505
+ var TreeExpansionModel = /** @class */ (function () {
3506
+ function TreeExpansionModel(identityOf) {
3507
+ this.identityOf = identityOf;
3508
+ this.collapsedIds = new Set();
3509
+ this._isExpandedPredicate = new pectin.MutableValueModel(function () { return true; });
3510
+ this.updatePredicate();
3511
+ }
3512
+ Object.defineProperty(TreeExpansionModel.prototype, "isExpandedPredicate", {
3513
+ get: function () {
3514
+ return this._isExpandedPredicate.readonly;
3515
+ },
3516
+ enumerable: false,
3517
+ configurable: true
3518
+ });
3519
+ // @Trace()
3520
+ TreeExpansionModel.prototype.expand = function (node) {
3521
+ if (this.isCollapsed(node)) {
3522
+ this.collapsedIds.delete(this.identityOf(node.node));
3523
+ this.updatePredicate();
3524
+ }
3525
+ };
3526
+ // @Trace()
3527
+ TreeExpansionModel.prototype.collapse = function (node) {
3528
+ if (!this.isCollapsed(node)) {
3529
+ this.collapsedIds.add(this.identityOf(node.node));
3530
+ this.updatePredicate();
3531
+ }
3532
+ };
3533
+ TreeExpansionModel.prototype.canExpand = function (node) {
3534
+ return node.hasChildren() && this.isCollapsed(node);
3535
+ };
3536
+ TreeExpansionModel.prototype.canCollapse = function (node) {
3537
+ return node.hasChildren() && !this.isCollapsed(node);
3538
+ };
3539
+ TreeExpansionModel.prototype.isCollapsed = function (node) {
3540
+ return this.collapsedIds.has(this.identityOf(node.node));
3541
+ };
3542
+ TreeExpansionModel.prototype.isExpanded = function (node) {
3543
+ return !this.isCollapsed(node);
3544
+ };
3545
+ TreeExpansionModel.prototype.ensureAncestorsAndSelfVisible = function (node) {
3546
+ var _this = this;
3547
+ node.ancestors()
3548
+ .map(function (a) { return _this.identityOf(node.node); })
3549
+ .forEach(function (id) { return _this.collapsedIds.delete(id); });
3550
+ this.updatePredicate();
3551
+ };
3552
+ TreeExpansionModel.prototype.updatePredicate = function () {
3553
+ var _this = this;
3554
+ this._isExpandedPredicate.value = function (node) { return !_this.collapsedIds.has(_this.identityOf(node.node)); };
3555
+ };
3556
+ return TreeExpansionModel;
3557
+ }());
3558
+
3559
+ var TreeLabelColumnModel = /** @class */ (function (_super) {
3560
+ __extends(TreeLabelColumnModel, _super);
3561
+ function TreeLabelColumnModel(columnId, textPropertiesProvider, expansionModel) {
3562
+ var _this = _super.call(this, columnId, textPropertiesProvider) || this;
3563
+ _this.expansionModel = expansionModel;
3564
+ _this.iconFactory = function (node, expanded) { return expanded ? 'mat:folder_open' : 'mat:folder'; };
3565
+ _this.cellRenderer(TreeLabelCellRendererComponent);
3566
+ return _this;
3567
+ }
3568
+ TreeLabelColumnModel.prototype.pluck = function (property) {
3569
+ this.labelProperty = property;
3570
+ };
3571
+ TreeLabelColumnModel.prototype.addIcon = function (factory) {
3572
+ this.iconFactory = factory;
3573
+ };
3574
+ TreeLabelColumnModel.prototype.cellRenderer = function (componentType) {
3575
+ var _this = this;
3576
+ this.configureCellRenderer(new ComponentCellRendererPortalRef(componentType, function (component, rowData, firstTime) {
3577
+ if (firstTime) {
3578
+ component.expansionModel = _this.expansionModel;
3579
+ }
3580
+ component.value = rowData.row;
3581
+ component.label = ___default['default'].isNil(_this.labelProperty) ? undefined : rowData.row[_this.labelProperty];
3582
+ component.iconFactory = _this.iconFactory;
3583
+ }));
3584
+ return this;
3585
+ };
3586
+ TreeLabelColumnModel.prototype.selectRowOnClick = function (selectOnRowClick) {
3587
+ return _super.prototype.selectRowOnClick.call(this, selectOnRowClick);
3588
+ };
3589
+ return TreeLabelColumnModel;
3590
+ }(ColumnModel));
3591
+
3592
+ exports.SelfAndDescendantsVisitor = /** @class */ (function () {
3593
+ function SelfAndDescendantsVisitor() {
3594
+ }
3595
+ SelfAndDescendantsVisitor.prototype.visit = function (it) {
3596
+ this.onVisit(it);
3597
+ if (this.shouldVisitChildrenOf(it)) {
3598
+ it.visitChildren(this);
3599
+ }
3600
+ };
3601
+ SelfAndDescendantsVisitor.prototype.shouldVisitChildrenOf = function (it) {
3602
+ return true;
3603
+ };
3604
+ return SelfAndDescendantsVisitor;
3605
+ }());
3606
+ (function (SelfAndDescendantsVisitor) {
3607
+ var Each = /** @class */ (function (_super) {
3608
+ __extends(Each, _super);
3609
+ function Each(callback) {
3610
+ var _this = _super.call(this) || this;
3611
+ _this.callback = callback;
3612
+ return _this;
3613
+ }
3614
+ Each.prototype.onVisit = function (it) {
3615
+ this.callback(it);
3616
+ };
3617
+ return Each;
3618
+ }(SelfAndDescendantsVisitor));
3619
+ SelfAndDescendantsVisitor.Each = Each;
3620
+ })(exports.SelfAndDescendantsVisitor || (exports.SelfAndDescendantsVisitor = {}));
3621
+
3622
+ var DecoratedTreeNodeMixin = /** @class */ (function () {
3623
+ function DecoratedTreeNodeMixin(parent, node) {
3624
+ this.parent = parent;
3625
+ this.node = node;
3626
+ }
3627
+ Object.defineProperty(DecoratedTreeNodeMixin.prototype, "decoratedSelf", {
3628
+ get: function () {
3629
+ var _this = this;
3630
+ return this.memoize("decoratedSelf", function () {
3631
+ return _this.parent ? _this.parent.children.find(function (child) { return child.node === _this.node; }) : exports.DecoratedTreeNode.createRoot(_this.node);
3632
+ });
3633
+ },
3634
+ enumerable: false,
3635
+ configurable: true
3636
+ });
3637
+ Object.defineProperty(DecoratedTreeNodeMixin.prototype, "children", {
3638
+ get: function () {
3639
+ var _this = this;
3640
+ return this.memoize("children", function () {
3641
+ return _this.node.children ? _this.node.children.map(function (child) {
3642
+ return typescriptUtilities.Mixin.createProxy(child, new DecoratedTreeNodeMixin(_this.decoratedSelf, child));
3643
+ }) : [];
3644
+ });
3645
+ },
3646
+ enumerable: false,
3647
+ configurable: true
3648
+ });
3649
+ DecoratedTreeNodeMixin.prototype.descendants = function () {
3650
+ var _this = this;
3651
+ return this.memoize("descendants", function () {
3652
+ var result = [];
3653
+ _this.visitDescendants(function (child) { return result.push(child); });
3654
+ return result;
3655
+ });
3656
+ };
3657
+ DecoratedTreeNodeMixin.prototype.selfAndDescendants = function () {
3658
+ var _this = this;
3659
+ return this.memoize("selfAndDescendants", function () {
3660
+ var result = [];
3661
+ _this.visitSelfAndDescendants(function (child) { return result.push(child); });
3662
+ return result;
3663
+ });
3664
+ };
3665
+ DecoratedTreeNodeMixin.prototype.siblingsBefore = function () {
3666
+ var _this = this;
3667
+ return this.memoize('siblingsBefore', function () {
3668
+ if (_this.parent) {
3669
+ return _this.parent.children.slice(0, _this.myIndex());
3670
+ }
3671
+ else {
3672
+ return [];
3673
+ }
3674
+ });
3675
+ };
3676
+ DecoratedTreeNodeMixin.prototype.siblingsAfter = function () {
3677
+ var _this = this;
3678
+ return this.memoize('siblingsAfter', function () {
3679
+ if (_this.parent) {
3680
+ return _this.parent.children.slice(1 + _this.myIndex());
3681
+ }
3682
+ else {
3683
+ return [];
3684
+ }
3685
+ });
3686
+ };
3687
+ DecoratedTreeNodeMixin.prototype.siblings = function () {
3688
+ var _this = this;
3689
+ return this.memoize('siblings', function () { return [].concat(_this.siblingsBefore(), _this.siblingsAfter()); });
3690
+ };
3691
+ DecoratedTreeNodeMixin.prototype.isFirstChild = function () {
3692
+ var _this = this;
3693
+ return this.memoize('isFirstChild', function () { return _this.parent ? _this.myIndex() === 0 : false; });
3694
+ };
3695
+ DecoratedTreeNodeMixin.prototype.myIndex = function () {
3696
+ var _this = this;
3697
+ return this.memoize('myIndex', function () {
3698
+ var myIndex = _this.parent.children.findIndex(function (child) { return child.node === _this.node; });
3699
+ pectin.assert.isTruthy(myIndex >= 0, 'illegal state, expected index to be >= 0');
3700
+ return myIndex;
3701
+ });
3702
+ };
3703
+ DecoratedTreeNodeMixin.prototype.isLastChild = function () {
3704
+ var _this = this;
3705
+ return this.memoize('isLastChild', function () {
3706
+ return _this.parent ? _this.myIndex() === _this.parent.children.length - 1 : false;
3707
+ });
3708
+ };
3709
+ DecoratedTreeNodeMixin.prototype.hasSiblings = function () {
3710
+ return this.parent ? this.node.children.length > 1 : false;
3711
+ };
3712
+ DecoratedTreeNodeMixin.prototype.find = function (predicate) {
3713
+ return _.find(this.descendants(), predicate);
3714
+ };
3715
+ DecoratedTreeNodeMixin.prototype.select = function (predicate) {
3716
+ return _.filter(this.descendants(), predicate);
3717
+ };
3718
+ DecoratedTreeNodeMixin.prototype.flattenInto = function (array) {
3719
+ this.visitSelfAndDescendants(function (child) { return array.push(child); });
3720
+ return array;
3721
+ };
3722
+ DecoratedTreeNodeMixin.prototype.ancestors = function () {
3723
+ var _this = this;
3724
+ return this.memoize('ancestors', function () {
3725
+ return _this.parent ? _this.parent.ancestors().concat([_this.parent]) : [];
3726
+ });
3727
+ };
3728
+ DecoratedTreeNodeMixin.prototype.ancestorsAndSelf = function () {
3729
+ var _this = this;
3730
+ return this.memoize("ancestorsAndSelf", function () {
3731
+ return _this.ancestors().concat([(_this.decoratedSelf)]);
3732
+ });
3733
+ };
3734
+ DecoratedTreeNodeMixin.prototype.pathToParent = function (parent) {
3735
+ var _this = this;
3736
+ return this.memoize("pathToParent", function () {
3737
+ if (_this.node === parent.node) {
3738
+ return [];
3739
+ }
3740
+ else if (_this.parent) {
3741
+ return _this.parent.pathToParent(parent).concat([_this.parent]);
3742
+ }
3743
+ else {
3744
+ throw new Error('parent is not an ancestor');
3745
+ }
3746
+ });
3747
+ };
3748
+ DecoratedTreeNodeMixin.prototype.pathToParentAndSelf = function (parent) {
3749
+ var _this = this;
3750
+ return this.memoize("pathToParentAndSelf", function () {
3751
+ return _this.pathToParent(parent).concat([_this.decoratedSelf]);
3752
+ });
3266
3753
  };
3267
- TableCellRendererComponent.prototype.hasActiveEditor = function () {
3268
- return !!this.editSession && !!this.column.hasEditorPortal();
3754
+ DecoratedTreeNodeMixin.prototype.isRoot = function () {
3755
+ return !this.parent;
3269
3756
  };
3270
- TableCellRendererComponent.prototype.initialiseRenderer = function (instance) {
3271
- this.column.onRendererAttached(this, instance);
3757
+ Object.defineProperty(DecoratedTreeNodeMixin.prototype, "depth", {
3758
+ get: function () {
3759
+ return this.isRoot() ? 0 : this.parent.depth + 1;
3760
+ },
3761
+ enumerable: false,
3762
+ configurable: true
3763
+ });
3764
+ DecoratedTreeNodeMixin.prototype.isLeaf = function () {
3765
+ return !this.isRoot() && this.node.children.length < 1;
3272
3766
  };
3273
- TableCellRendererComponent.prototype.initialiseEditor = function (instance) {
3274
- var _this = this;
3275
- this.column.onEditorAttached(this, instance);
3276
- if (this.firstEditableColumn.value) {
3277
- // @see https://github.com/angular/components/issues/12070
3278
- setTimeout(function () { return _this.tryAndFocusEditor(instance); });
3279
- }
3767
+ DecoratedTreeNodeMixin.prototype.hasChildren = function () {
3768
+ return this.node.children.length > 0;
3280
3769
  };
3281
- TableCellRendererComponent.prototype.tryAndFocusEditor = function (editor) {
3282
- var _a;
3283
- if (editor.requestFocus) {
3284
- editor.requestFocus();
3285
- }
3286
- else {
3287
- var model = (editor['valueModel'] || editor['listModel']);
3288
- (_a = model === null || model === void 0 ? void 0 : model.focusContext) === null || _a === void 0 ? void 0 : _a.requestFocus();
3289
- }
3770
+ DecoratedTreeNodeMixin.prototype.depthFromParent = function (parent) {
3771
+ return this.pathToParent(parent).length;
3290
3772
  };
3291
- // @Trace()
3292
- TableCellRendererComponent.prototype.ngOnChanges = function (changes) {
3293
- this.column.updatePortalContent(this);
3773
+ DecoratedTreeNodeMixin.prototype.treeDepth = function () {
3774
+ var _this = this;
3775
+ return this.memoize("treeDepth", function () {
3776
+ return 1 + _this.descendants().map(function (child) { return child.depthFromParent(_this); }).reduce(function (prev, current) { return Math.max(prev, current); });
3777
+ });
3294
3778
  };
3295
- TableCellRendererComponent.prototype.getRendererPortal = function () {
3296
- return this[CELL_RENDERER_PORTAL];
3779
+ DecoratedTreeNodeMixin.prototype.flatten = function () {
3780
+ var _this = this;
3781
+ return this.memoize("flatten", function () {
3782
+ return _this.flattenInto([]);
3783
+ });
3297
3784
  };
3298
- TableCellRendererComponent.prototype.getEditorPortal = function () {
3299
- return this[CELL_EDITOR_PORTAL];
3785
+ DecoratedTreeNodeMixin.prototype.visit = function (visitor) {
3786
+ visitor.visit(this);
3787
+ return visitor;
3300
3788
  };
3301
- TableCellRendererComponent.prototype.getRowData = function () {
3302
- return {
3303
- row: this.row,
3304
- editSession: this.editSession,
3305
- editRowCommand: this.editRowCommand
3306
- };
3789
+ DecoratedTreeNodeMixin.prototype.visitChildren = function (visitor) {
3790
+ _.each(this.children, function (child) { return child.visit(visitor); });
3791
+ return visitor;
3307
3792
  };
3308
- return TableCellRendererComponent;
3309
- }(DisposableComponent));
3310
- TableCellRendererComponent.decorators = [
3311
- { type: i0.Component, args: [{
3312
- selector: 'aup-table-cell-renderer',
3313
- template: "<ng-container *ngIf=\"!hasActiveEditor()\" [cdkPortalOutlet]=\"getRendererPortal()\" (attached)=\"initialiseRenderer($event.instance)\"></ng-container>\n<ng-container *ngIf=\"hasActiveEditor()\" [cdkPortalOutlet]=\"getEditorPortal()\" (attached)=\"initialiseEditor($event.instance)\"></ng-container>\n",
3314
- styles: [""]
3315
- },] }
3316
- ];
3317
- TableCellRendererComponent.ctorParameters = function () { return []; };
3318
- TableCellRendererComponent.propDecorators = {
3319
- row: [{ type: i0.Input }],
3320
- column: [{ type: i0.Input }],
3321
- editSession: [{ type: i0.Input }],
3322
- tableModel: [{ type: i0.Input }],
3323
- defaultClassNames: [{ type: i0.HostBinding, args: ['class',] }],
3324
- fillCell: [{ type: i0.HostBinding, args: ['class.fillCell',] }],
3325
- padChild: [{ type: i0.HostBinding, args: ['class.padChild',] }]
3326
- };
3327
-
3328
- var TableHeaderCellRendererComponent = /** @class */ (function () {
3329
- function TableHeaderCellRendererComponent() {
3330
- this.defaultClassNames = 'aup-header-cell-renderer';
3331
- }
3332
- TableHeaderCellRendererComponent.prototype.ngOnInit = function () {
3333
- this.column.attachHeaderCell(this);
3793
+ DecoratedTreeNodeMixin.prototype.visitSelfAndDescendants = function (callback) {
3794
+ this.visit(new exports.SelfAndDescendantsVisitor.Each(callback));
3334
3795
  };
3335
- // @Trace()
3336
- TableHeaderCellRendererComponent.prototype.initialiseHeader = function (instance) {
3337
- this.column.onHeaderAttached(this, instance);
3796
+ DecoratedTreeNodeMixin.prototype.visitDescendants = function (callback) {
3797
+ this.visitChildren(new exports.SelfAndDescendantsVisitor.Each(callback));
3338
3798
  };
3339
- TableHeaderCellRendererComponent.prototype.getPortal = function () {
3340
- return this[HEADER_CELL_RENDERER_PORTAL];
3799
+ DecoratedTreeNodeMixin.prototype.memoize = function (property, factory) {
3800
+ var key = "__" + property;
3801
+ if (_.isNil(this[key])) {
3802
+ this[key] = factory();
3803
+ }
3804
+ return this[key];
3341
3805
  };
3342
- return TableHeaderCellRendererComponent;
3806
+ return DecoratedTreeNodeMixin;
3343
3807
  }());
3344
- TableHeaderCellRendererComponent.decorators = [
3345
- { type: i0.Component, args: [{
3346
- selector: 'aup-table-header-cell-renderer',
3347
- template: "<ng-container [cdkPortalOutlet]=\"getPortal()\" (attached)=\"initialiseHeader($event.instance)\"></ng-container>\n",
3348
- styles: [":host{align-items:stretch;display:flex;flex-direction:column;height:100%;justify-content:center}"]
3349
- },] }
3350
- ];
3351
- TableHeaderCellRendererComponent.ctorParameters = function () { return []; };
3352
- TableHeaderCellRendererComponent.propDecorators = {
3353
- column: [{ type: i0.Input }],
3354
- defaultClassNames: [{ type: i0.HostBinding, args: ['class',] }]
3355
- };
3356
-
3357
- var MenuItemData = /** @class */ (function () {
3358
- function MenuItemData(factory, face) {
3359
- this.factory = factory;
3360
- this.face = face;
3808
+ (function (DecoratedTreeNode) {
3809
+ function createRoot(node) {
3810
+ return typescriptUtilities.Mixin.createProxy(node, new DecoratedTreeNodeMixin(undefined, node));
3811
+ }
3812
+ DecoratedTreeNode.createRoot = createRoot;
3813
+ })(exports.DecoratedTreeNode || (exports.DecoratedTreeNode = {}));
3814
+
3815
+ var TreeToListModel = /** @class */ (function (_super) {
3816
+ __extends(TreeToListModel, _super);
3817
+ function TreeToListModel(source, expansionModel) {
3818
+ var _this = _super.call(this, source) || this;
3819
+ _this.source = source;
3820
+ _this.expansionModel = expansionModel;
3821
+ _this.trackSource(_this.expansionModel.isExpandedPredicate);
3822
+ return _this;
3361
3823
  }
3362
- return MenuItemData;
3363
- }());
3364
- /**
3365
- *
3366
- */
3367
- var TableRowMenuComponent = /** @class */ (function (_super) {
3368
- __extends(TableRowMenuComponent, _super);
3369
- function TableRowMenuComponent() {
3370
- var _this = _super.call(this) || this;
3371
- _this.actions = [];
3372
- _this.moreActions = [];
3824
+ TreeToListModel.prototype.getIdentityOf = function (item) {
3825
+ return this.source.identityOf(item.node);
3826
+ };
3827
+ TreeToListModel.prototype.compute = function (values) {
3828
+ var _this = this;
3829
+ var result = [];
3830
+ values.forEach(function (value) { return _this.addNodeAndVisibleChildren(exports.DecoratedTreeNode.createRoot(value), result); });
3831
+ return result;
3832
+ };
3833
+ TreeToListModel.prototype.addNodeAndVisibleChildren = function (node, result) {
3834
+ var _this = this;
3835
+ result.push(node);
3836
+ if (node.hasChildren() && !this.expansionModel.isCollapsed(node)) {
3837
+ node.children.forEach(function (child) { return _this.addNodeAndVisibleChildren(child, result); });
3838
+ }
3839
+ };
3840
+ return TreeToListModel;
3841
+ }(pectin.ComputedListModel));
3842
+
3843
+ // TODO:
3844
+ // Selection Models:
3845
+ // - as simple navigation tree
3846
+ // - as editable grid (selecte all, even hidden etc?)
3847
+ // - fixing selection on underlying model changes.
3848
+ // - rendering selection: row highlighting, checkboxes (in the tree renderer or in separate column), both.
3849
+ // Expansion Models:
3850
+ // - Add ability to auto show to depth
3851
+ // - Add a predicate to check default expansion (i.e. has children of a certain type)
3852
+ //
3853
+ var TreeTableModel = /** @class */ (function (_super) {
3854
+ __extends(TreeTableModel, _super);
3855
+ function TreeTableModel(source, treeExpansionModel) {
3856
+ var _this = _super.call(this, source) || this;
3857
+ _this.treeExpansionModel = treeExpansionModel;
3373
3858
  return _this;
3374
3859
  }
3375
- TableRowMenuComponent.prototype.registerAction = function (commandFactory, properties) {
3376
- this.actions.push(new MenuItemData(commandFactory, properties));
3860
+ TreeTableModel.fromRoot = function (sourceOfTruth, builder) {
3861
+ var garbage = new pectin.GarbageCollector();
3862
+ var _a = pectin.Dsl.disposeWith(garbage), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
3863
+ var children = chain(sourceOfTruth).mapToList(function (root) { return [root]; });
3864
+ var model = this.fromList(children, builder);
3865
+ model.registerDisposable(garbage);
3866
+ return model;
3377
3867
  };
3378
- TableRowMenuComponent.prototype.registerMoreAction = function (commandFactory, properties) {
3379
- this.moreActions.push(new MenuItemData(commandFactory, properties));
3868
+ TreeTableModel.fromChildrenOf = function (sourceOfTruth, builder) {
3869
+ var garbage = new pectin.GarbageCollector();
3870
+ var _a = pectin.Dsl.disposeWith(garbage), chain = _a.chain, valueOf = _a.valueOf, before = _a.before, when = _a.when, after = _a.after, observe = _a.observe, switchOn = _a.switchOn;
3871
+ var children = chain(sourceOfTruth).mapToList(function (root) { return root.children; }); // for some reason pluck list can't see 'children'
3872
+ var model = this.fromList(children, builder);
3873
+ model.registerDisposable(garbage);
3874
+ return model;
3380
3875
  };
3381
- TableRowMenuComponent.prototype.ngOnInit = function () {
3876
+ TreeTableModel.fromList = function (sourceOfTruth, builder) {
3877
+ var treeExpansionModel = new TreeExpansionModel(sourceOfTruth.identityOf);
3878
+ var nodes = new TreeToListModel(sourceOfTruth, treeExpansionModel);
3879
+ var model = new TreeTableModel(nodes, treeExpansionModel);
3880
+ model.registerDisposable(nodes);
3881
+ if (builder)
3882
+ builder(model);
3883
+ return model;
3382
3884
  };
3383
- TableRowMenuComponent.prototype.createMoreMenuCommand = function (item, value) {
3885
+ TreeTableModel.prototype.treeControlColumn = function (builder) {
3384
3886
  var _this = this;
3385
- var when = pectin.Dsl.disposeWith(this).when;
3386
- var command = item.factory.create(value);
3387
- when(command.busy).becomesFalsey(function () {
3388
- _this.closeMoreMenu();
3389
- });
3390
- return command;
3887
+ var columnId = 'tree-label';
3888
+ var column = new TreeLabelColumnModel(columnId, function () { return _this.getColumnTextProperties(columnId); }, this.treeExpansionModel);
3889
+ builder(column);
3890
+ this.addColumn(column);
3391
3891
  };
3392
- TableRowMenuComponent.prototype.closeMoreMenu = function () {
3393
- this.menu.closeMenu();
3892
+ TreeTableModel.prototype.expand = function (node) {
3893
+ this.treeExpansionModel.expand(node);
3394
3894
  };
3395
- return TableRowMenuComponent;
3895
+ TreeTableModel.prototype.collapse = function (node) {
3896
+ this.treeExpansionModel.expand(node);
3897
+ };
3898
+ TreeTableModel.prototype.isCollapsed = function (node) {
3899
+ return this.treeExpansionModel.isCollapsed(node);
3900
+ };
3901
+ TreeTableModel.prototype.ensureAncestorsAndSelfVisible = function (node) {
3902
+ this.treeExpansionModel.ensureAncestorsAndSelfVisible(node);
3903
+ };
3904
+ return TreeTableModel;
3905
+ }(exports.AbstractTableModel));
3906
+ var FlattenStrategy = /** @class */ (function (_super) {
3907
+ __extends(FlattenStrategy, _super);
3908
+ function FlattenStrategy(collapsedIds) {
3909
+ var _this = _super.call(this) || this;
3910
+ _this.collapsedIds = collapsedIds;
3911
+ _this._areas = [];
3912
+ _this._collapsed = new Set(collapsedIds);
3913
+ return _this;
3914
+ }
3915
+ FlattenStrategy.prototype.onVisit = function (it) {
3916
+ this._areas.push(it);
3917
+ };
3918
+ FlattenStrategy.prototype.shouldVisitChildrenOf = function (it) {
3919
+ return !this._collapsed.has(it);
3920
+ };
3921
+ Object.defineProperty(FlattenStrategy.prototype, "flattenedAreas", {
3922
+ get: function () {
3923
+ return this._areas;
3924
+ },
3925
+ enumerable: false,
3926
+ configurable: true
3927
+ });
3928
+ return FlattenStrategy;
3929
+ }(exports.SelfAndDescendantsVisitor));
3930
+ // class DecoratorCache {
3931
+ //
3932
+ // private map = new Map<number, T>();
3933
+ //
3934
+ // get(area:T): T {
3935
+ //
3936
+ // if (!area) return null;
3937
+ //
3938
+ // let decoratedArea = this.map.get(area.id);
3939
+ // if (!decoratedArea) {
3940
+ // decoratedArea = TreeModel.AreaDecorator.decorate(area);
3941
+ // this.map.set(area.id, decoratedArea);
3942
+ // }
3943
+ // return decoratedArea;
3944
+ // }
3945
+ //
3946
+ // clear() {
3947
+ // this.map.clear();
3948
+ // }
3949
+ //
3950
+ //
3951
+ // }
3952
+
3953
+ //
3954
+ // const template = `
3955
+ // <table-component list-model="zoneTreeController.visibleAreas"
3956
+ // selection-model="zoneTreeController.selectionModel"
3957
+ // selection-command="zoneTreeController.selectionCommand"
3958
+ // hover-model="zoneTreeController.decoratedHoverModel"
3959
+ // no-hover="zoneTreeController.noHover"
3960
+ // no-lines="true" no-scroll>
3961
+ //
3962
+ // <row-attr name="parent-id" value="{{item.parent.id}}"></row-attr>
3963
+ // <row-attr name="area-id" value="{{item.id}}"></row-attr>
3964
+ // <row-attr name="area-name" value="{{item.name}}"></row-attr>
3965
+ // <row-attr name="area-depth" value="{{item.depthFromZone()}}"></row-attr>
3966
+ // <row-attr name="collapsed" value="{{zoneTreeController.isCollapsed(item)}}"></row-attr>
3967
+ //
3968
+ // <column class="area" ng-class="{root: item.isZone(), parent: item.isGroup()}" class="allow-squish">
3969
+ // <!--<label>Rooms in {{zoneTreeController.zoneModel.value.name}}</label>-->
3970
+ // <label>Rooms</label>
3971
+ // <div layout="row" layout-align="start center">
3972
+ // <tree-icons tree-item="item"></tree-icons>
3973
+ // <area-icon area="item"></area-icon>
3974
+ // <span ng-if="item.isZone()">Zone ({{item.name}})</span>
3975
+ // <span ng-if="!item.isZone()">{{item.name}}</span>
3976
+ // </div>
3977
+ // </column>
3978
+ // <column class="expand-collapse" ng-class="{collapsed: zoneTreeController.isCollapsed(item)}">
3979
+ // <md-button class="md-icon-button"
3980
+ // ng-if="zoneTreeController.canCollapse(item)"
3981
+ // ng-click="zoneTreeController.toggleCollapse(item)">
3982
+ // <md-icon>keyboard_arrow_up</md-icon>
3983
+ // </md-button>
3984
+ // </column>
3985
+ //
3986
+ // </table-component>
3987
+ // `;
3988
+ var TreeTableComponent = /** @class */ (function (_super) {
3989
+ __extends(TreeTableComponent, _super);
3990
+ function TreeTableComponent() {
3991
+ return _super.call(this) || this;
3992
+ }
3993
+ return TreeTableComponent;
3396
3994
  }(DisposableComponent));
3397
- TableRowMenuComponent.decorators = [
3995
+ TreeTableComponent.decorators = [
3398
3996
  { type: i0.Component, args: [{
3399
- selector: 'aup-table-row-menu',
3400
- template: "\n <aup-tool-bar>\n <aup-command *ngFor=\"let action of actions\" [command]=\"action.factory.create(value)\"\n [face]=\"action.face\"></aup-command>\n </aup-tool-bar>\n <ng-container *ngIf=\"moreActions.length > 0\">\n <aup-more-menu>\n <aup-command *ngFor=\"let action of moreActions\" [command]=\"action.factory.create(value)\"\n [face]=\"action.face\"></aup-command>\n </aup-more-menu>\n </ng-container>\n ",
3401
- styles: [":host {\n display: inline-flex;\n flex-direction: row;\n align-items: center;\n }"]
3997
+ selector: "aup-tree-table",
3998
+ template: "<aup-table [tableModel]=\"treeTableModel\"></aup-table>\n",
3999
+ encapsulation: i0.ViewEncapsulation.None // allow us to target nested table styles
4000
+ ,
4001
+ styles: ["td.mat-cell{border-bottom-width:0!important;border-top-width:0!important}td.mat-column-tree-label{width:1px}aup-table-cell-renderer[column-id=tree-label]{padding-left:8px!important}aup-tree-label-cell-renderer{flex:1}"]
3402
4002
  },] }
3403
4003
  ];
3404
- TableRowMenuComponent.ctorParameters = function () { return []; };
3405
- TableRowMenuComponent.propDecorators = {
3406
- value: [{ type: i0.Input }],
3407
- menu: [{ type: i0.ViewChild, args: [menu.MatMenuTrigger,] }]
4004
+ TreeTableComponent.ctorParameters = function () { return []; };
4005
+ TreeTableComponent.propDecorators = {
4006
+ treeTableModel: [{ type: i0.Input }]
3408
4007
  };
4008
+ __decorate([
4009
+ pectin.TrackExternal(),
4010
+ __metadata("design:type", TreeTableModel)
4011
+ ], TreeTableComponent.prototype, "treeTableModel", void 0);
3409
4012
 
3410
4013
  var VerticalFocusContainerComponent = /** @class */ (function (_super) {
3411
4014
  __extends(VerticalFocusContainerComponent, _super);
@@ -3521,7 +4124,11 @@
3521
4124
  SeparatorComponent,
3522
4125
  FlexComponent,
3523
4126
  AbstractPopupMenuComponent,
3524
- PopupMenuRendererComponent
4127
+ PopupMenuRendererComponent,
4128
+ TreeTableComponent,
4129
+ exports.TreeInheritanceIconComponent,
4130
+ TreeLabelCellRendererComponent,
4131
+ exports.IconComponent
3525
4132
  ],
3526
4133
  imports: [
3527
4134
  i2.CommonModule,
@@ -3574,7 +4181,8 @@
3574
4181
  CommandFaceComponent,
3575
4182
  MoreMenuComponent,
3576
4183
  SeparatorComponent,
3577
- FlexComponent
4184
+ FlexComponent,
4185
+ TreeTableComponent
3578
4186
  ],
3579
4187
  providers: [
3580
4188
  FocusBindingFactory
@@ -4929,6 +5537,93 @@
4929
5537
  { type: i0.NgZone }
4930
5538
  ]; };
4931
5539
 
5540
+ /**
5541
+ * Example:
5542
+ * @example
5543
+ * const model = TableModel.fromList(heroList, table => {
5544
+ * table.pluck("firstName");
5545
+ * table.pluck("lastName");
5546
+ * table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
5547
+ * });
5548
+ *
5549
+ * Editable tables
5550
+ * @example
5551
+ * const saveCommand = UnaryCommand.create((form: Form<Hero>) => {
5552
+ * if (form.validate()) {
5553
+ * // normal form save stuff
5554
+ * return true; // finish editing
5555
+ * }
5556
+ * return false; // continue editiing
5557
+ * }
5558
+ * const colorsNames: ListModel<string> = ...;
5559
+ * const model = TableModel.fromList(heroList, table => {
5560
+ * table.pluck("firstName").cellEditor(StringInputComponent); <-- interface CellEditor { valueModel: DirtyTrackingForm.ValueModel<string> | ValueModel<string>; }
5561
+ * table.pluck("lastName").cellEditor(StringInputComponent, {
5562
+ * validators: [Validator.present("We need a last name")]
5563
+ * });
5564
+ * table.pluck("age").cellEditor(NumberInputComponent);
5565
+ * table.pluck("favoriteColor").cellEditor(SelectInputComponent, {
5566
+ * initialiseComponent(component: SelectInputComponent) {
5567
+ * selectInput.optionsModel = colorsNames; // <- initialise our component
5568
+ * }
5569
+ * });
5570
+ * table.addEditControls(saveCommand); // <- required to enable editing
5571
+ * });
5572
+ *
5573
+ * Selection models
5574
+ * @example
5575
+ * const model = TableModel.fromList(heroList, table => {
5576
+ * table.addSelectionColumn(selectionModel); // <- can be single or multiple selection model
5577
+ * table.pluck("firstName");
5578
+ * table.pluck("lastName");
5579
+ * });
5580
+ *
5581
+ * Custom cell renderers and editors
5582
+ * @example
5583
+ * const model = TableModel.fromList(heroList, table => {
5584
+ * table.pluck("favoriteColor")
5585
+ * .cellHeaderRenderer(CellHeaderRendererComponent, (component, column) => {
5586
+ * // configure your component with what ever you need.
5587
+ * });
5588
+ * .cellRenderer(CellRendererComponent) // <-- interface CellEditor { value: string; }
5589
+ * .cellEditor(CellEditorComponent.); // <-- interface CellEditor { valueModel: DirtyTrackingForm.ValueModel<string> | ValueModel<string>; }
5590
+ * table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
5591
+ * });
5592
+ *
5593
+ * I18n
5594
+ * @example
5595
+ * [table.yml]
5596
+ * table:
5597
+ * columns(ColumnTextProperties[]):
5598
+ * firstName:
5599
+ * headerText: "First Name"
5600
+ * fullName:
5601
+ * headerText: "Full Name"
5602
+ *
5603
+ * const model = TableModel.fromList(heroList, table => {
5604
+ * table.pluck("favoriteColor").cellRenderer(...).cellEditor(...);
5605
+ * table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
5606
+ *
5607
+ * table.columnTextProperties(I18n.table.columns); // <- configures all columns
5608
+ * });
5609
+ */
5610
+ var TableModel = /** @class */ (function (_super) {
5611
+ __extends(TableModel, _super);
5612
+ function TableModel() {
5613
+ return _super !== null && _super.apply(this, arguments) || this;
5614
+ }
5615
+ TableModel.fromList = function (sourceOfTruth, builder) {
5616
+ var model = new TableModel(sourceOfTruth);
5617
+ if (builder)
5618
+ builder(model);
5619
+ return model;
5620
+ };
5621
+ TableModel.prototype.addSelectionColumn = function (selectionModel) {
5622
+ return this._addSelectionColumn(selectionModel);
5623
+ };
5624
+ return TableModel;
5625
+ }(exports.AbstractTableModel));
5626
+
4932
5627
  /**
4933
5628
  * @file Automatically generated by barrelsby.
4934
5629
  */
@@ -7775,7 +8470,7 @@
7775
8470
  return [4 /*yield*/, routeIdDef.sanitise(routeId, visit, this.placeHistory, this.injector, this.navigationSession.isPopState)];
7776
8471
  case 1:
7777
8472
  sanitisedValue = _a.sent();
7778
- console.log({ routeId: routeId, sanitisedValue: sanitisedValue });
8473
+ // console.log({routeId, sanitisedValue});
7779
8474
  // ###------- EARLY EXIT --------###
7780
8475
  if (routeIdDef.hasChanged(routeId, sanitisedValue)) {
7781
8476
  // if the route id has changed we redirect immediately as other
@@ -8130,6 +8825,7 @@
8130
8825
  exports.EditorControlColumnModel = EditorControlColumnModel;
8131
8826
  exports.EmptyStateComponent = EmptyStateComponent;
8132
8827
  exports.EventCleanUpSession = EventCleanUpSession;
8828
+ exports.FlattenStrategy = FlattenStrategy;
8133
8829
  exports.FlexComponent = FlexComponent;
8134
8830
  exports.FocusBinding = FocusBinding;
8135
8831
  exports.FocusBindingDirective = FocusBindingDirective;
@@ -8196,10 +8892,17 @@
8196
8892
  exports.TableCellRendererComponent = TableCellRendererComponent;
8197
8893
  exports.TableComponent = TableComponent;
8198
8894
  exports.TableHeaderCellRendererComponent = TableHeaderCellRendererComponent;
8895
+ exports.TableModel = TableModel;
8199
8896
  exports.TableRowMenuComponent = TableRowMenuComponent;
8200
8897
  exports.TemplateCellRendererPortalRef = TemplateCellRendererPortalRef;
8201
8898
  exports.TextInputComponent = TextInputComponent;
8202
8899
  exports.ToolBarComponent = ToolBarComponent;
8900
+ exports.TreeExpansionModel = TreeExpansionModel;
8901
+ exports.TreeLabelCellRendererComponent = TreeLabelCellRendererComponent;
8902
+ exports.TreeLabelColumnModel = TreeLabelColumnModel;
8903
+ exports.TreeTableComponent = TreeTableComponent;
8904
+ exports.TreeTableModel = TreeTableModel;
8905
+ exports.TreeToListModel = TreeToListModel;
8203
8906
  exports.UrlService = UrlService;
8204
8907
  exports.VerticalFocusContainerComponent = VerticalFocusContainerComponent;
8205
8908
  exports.Visit = Visit;