@coolon/angular-ui-powerups 11.0.0-alpha.5 → 11.0.0-alpha.8

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 (29) hide show
  1. package/assets/table.scss +13 -6
  2. package/bundles/coolon-angular-ui-powerups.umd.js +54 -31
  3. package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
  4. package/bundles/coolon-angular-ui-powerups.umd.min.js +1 -1
  5. package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -1
  6. package/coolon-angular-ui-powerups.metadata.json +1 -1
  7. package/esm2015/lib/components/commands/command/command.component.js +5 -1
  8. package/esm2015/lib/components/commands/command/command.component.js.map +1 -1
  9. package/esm2015/lib/components/commands/command/command.component.metadata.json +1 -1
  10. package/esm2015/lib/components/components.module.js +0 -3
  11. package/esm2015/lib/components/components.module.js.map +1 -1
  12. package/esm2015/lib/components/components.module.metadata.json +1 -1
  13. package/esm2015/lib/components/components.module.ngfactory.js.map +1 -1
  14. package/esm2015/lib/components/table/column-model.js +2 -1
  15. package/esm2015/lib/components/table/column-model.js.map +1 -1
  16. package/esm2015/lib/components/table/column-model.metadata.json +1 -1
  17. package/esm2015/lib/components/table/table-cell-renderer/table-cell-renderer.component.js.map +1 -1
  18. package/esm2015/lib/components/table/table-cell-renderer/table-cell-renderer.component.metadata.json +1 -1
  19. package/esm2015/lib/components/table/table.component.js +30 -3
  20. package/esm2015/lib/components/table/table.component.js.map +1 -1
  21. package/esm2015/lib/components/table/table.component.metadata.json +1 -1
  22. package/esm2015/lib/components/tree-table/decorated-tree-node.js +19 -22
  23. package/esm2015/lib/components/tree-table/decorated-tree-node.js.map +1 -1
  24. package/fesm2015/coolon-angular-ui-powerups.js +55 -30
  25. package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
  26. package/lib/components/commands/command/command.component.d.ts +2 -1
  27. package/lib/components/table/column-model.d.ts +1 -0
  28. package/lib/components/table/table.component.d.ts +20 -2
  29. package/package.json +1 -1
package/assets/table.scss CHANGED
@@ -1,7 +1,9 @@
1
1
  aup-table {
2
- --default-column-gap: var(--column-gap, 24px); // material design table column padding
3
- --resolved-row-selected-background-color: var(--row-selected-background-color, rgba(0, 0, 255, 0.04));
4
- --resolved-row-hover-background-color: var(--row-hover-background-color, rgba(0, 0, 0, 0.05));
2
+ --resolved-column-gap: var(--column-gap, var(--aup-table-column-gap, 24px)); // material design table column padding
3
+ --resolved-row-selected-background-color: var(--row-selected-background-color, var(--aup-table-row-selected-background-color, rgba(0, 0, 255, 0.04)));
4
+ --resolved-row-hover-background-color: var(--row-hover-background-color, var(--aup-table-row-hover-background-color, rgba(0, 0, 0, 0.05)));
5
+ --resolved-first-column-padding-left: var(--first-column-padding-left, var(--aup-table-first-column-padding-left, var(--resolved-column-gap)));
6
+ --resolved-last-column-padding-right: var(--last-column-padding-right, var(--aup-table-last-column-padding-right, var(--resolved-column-gap)));
5
7
 
6
8
  &.hide-header {
7
9
  .mat-table thead {
@@ -64,9 +66,14 @@ aup-table {
64
66
  height: 100%;
65
67
  min-height: 47px; // same as mat table row height - border bottom.
66
68
 
67
- padding-left: var(--default-column-gap);
69
+ padding-left: var(--resolved-column-gap);
70
+
71
+ &.first-visible-column {
72
+ padding-left: var(--resolved-first-column-padding-left);
73
+ }
74
+
68
75
  &.last-visible-column {
69
- padding-right: var(--default-column-gap);
76
+ padding-right: var(--resolved-last-column-padding-right);
70
77
  }
71
78
  }
72
79
 
@@ -78,7 +85,7 @@ aup-table {
78
85
 
79
86
  &.padChild {
80
87
  > *:first-child {
81
- padding-left: var(--default-column-gap);
88
+ padding-left: var(--resolved-column-gap);
82
89
  flex: 1;
83
90
  }
84
91
  }
@@ -1009,6 +1009,9 @@
1009
1009
  _this.activeFace = _this.faces.first();
1010
1010
  _this.buttonStyle = chain(_this.activeFace).map(function (f) { return exports.CommandFace.getStyleOf(f); });
1011
1011
  _this.colorModel = chain(_this.activeFace).map(function (f) { return exports.CommandFace.getColorOf(f); });
1012
+ _this.iconOnly = _this.faces.select(function (face) {
1013
+ return ___default['default'].isEmpty(exports.CommandFace.getTextOf(face)) && !___default['default'].isEmpty(exports.CommandFace.getIconOf(face));
1014
+ }).count().equals(_this.faces.count());
1012
1015
  return _this;
1013
1016
  }
1014
1017
  CommandComponent.prototype.isActive = function (face) {
@@ -1027,7 +1030,7 @@
1027
1030
  CommandComponent.decorators = [
1028
1031
  { type: i0.Component, args: [{
1029
1032
  selector: 'aup-command',
1030
- template: "<ng-container [ngSwitch]=\"buttonStyle.value\">\n <ng-container *ngSwitchCase=\"CommandFace.Style.STROKED\">\n <button mat-stroked-button [pectinCommand]=\"command\" [color]=\"colorModel.value\" [class.busy]=\"command.busy.value\">\n <aup-command-face class=\"centered\" [faces]=\"faces.value\"></aup-command-face>\n </button>\n </ng-container>\n <ng-container *ngSwitchCase=\"CommandFace.Style.RAISED\">\n <button mat-raised-button [pectinCommand]=\"command\" [color]=\"colorModel.value\" [class.busy]=\"command.busy.value\">\n <aup-command-face class=\"centered\" [faces]=\"faces.value\"></aup-command-face>\n </button>\n </ng-container>\n <ng-container *ngSwitchDefault>\n <button mat-button [pectinCommand]=\"command\" [color]=\"colorModel.value\" [class.busy]=\"command.busy.value\">\n <aup-command-face class=\"centered\" [faces]=\"faces.value\"></aup-command-face>\n </button>\n </ng-container>\n</ng-container>\n",
1033
+ template: "<ng-container *ngIf=\"iconOnly.value\">\n <button mat-icon-button [pectinCommand]=\"command\" [color]=\"colorModel.value\" [class.busy]=\"command.busy.value\">\n <aup-command-face class=\"centered\" [faces]=\"faces.value\"></aup-command-face>\n </button>\n</ng-container>\n<ng-container *ngIf=\"!iconOnly.value\">\n <ng-container [ngSwitch]=\"buttonStyle.value\">\n <ng-container *ngSwitchCase=\"CommandFace.Style.STROKED\">\n <button mat-stroked-button [pectinCommand]=\"command\" [color]=\"colorModel.value\" [class.busy]=\"command.busy.value\">\n <aup-command-face class=\"centered\" [faces]=\"faces.value\"></aup-command-face>\n </button>\n </ng-container>\n <ng-container *ngSwitchCase=\"CommandFace.Style.RAISED\">\n <button mat-raised-button [pectinCommand]=\"command\" [color]=\"colorModel.value\" [class.busy]=\"command.busy.value\">\n <aup-command-face class=\"centered\" [faces]=\"faces.value\"></aup-command-face>\n </button>\n </ng-container>\n <ng-container *ngSwitchDefault>\n <button mat-button [pectinCommand]=\"command\" [color]=\"colorModel.value\" [class.busy]=\"command.busy.value\">\n <aup-command-face class=\"centered\" [faces]=\"faces.value\"></aup-command-face>\n </button>\n </ng-container>\n </ng-container>\n</ng-container>\n",
1031
1034
  styles: [":host{display:inline-flex;flex-direction:row;justify-content:stretch}button{flex:1}"]
1032
1035
  },] }
1033
1036
  ];
@@ -2707,6 +2710,7 @@
2707
2710
  this._flex = false;
2708
2711
  this._visibleModel = new pectin.DelegatingValueModel().withDefault(true);
2709
2712
  this.installHeaderRenderer();
2713
+ this.dasherisedColumnId = typescriptUtilities.Stringy.from(columnId).dasherize().toString();
2710
2714
  }
2711
2715
  ColumnModel.prototype.installHeaderRenderer = function () {
2712
2716
  this.cellHeaderRenderer(DefaultHeaderCellRendererComponent, function (component, column) {
@@ -3332,15 +3336,32 @@
3332
3336
  *
3333
3337
  * Styling
3334
3338
  * @example
3339
+ * // global settings
3340
+ * :root {
3341
+ * --aup-table-column-gap: 10px; // defaults to 24px
3342
+ * --aup-table-row-hover-background-color, rgba(0, 0, 0, 0.05)
3343
+ * --aup-table-row-selected-background-color: rebeccapurple; // defaults to transparent
3344
+ * --aup-table-first-column-padding-left: 18px // defaults to --column-gap
3345
+ * --aup-table-last-column-padding-right: 18px // defaults to --column-gap
3346
+ * }
3347
+ *
3348
+ * // per table settings.
3335
3349
  * aup-table {
3336
3350
  * --column-gap: 10px; // defaults to 24px
3337
3351
  * --row-hover-background-color, rgba(0, 0, 0, 0.05)
3338
3352
  * --row-selected-background-color: rebeccapurple; // defaults to transparent
3353
+ * --first-column-padding-left: 18px // defaults to --column-gap
3354
+ * --last-column-padding-right: 18px // defaults to --column-gap
3355
+ *
3356
+ * aup-table-header-cell-renderer,
3339
3357
  * aup-table-cell-renderer {
3340
- * &:first-column {
3358
+ * &.aup-col-my-dasherised-column-id {
3341
3359
  * // do stuff
3342
3360
  * }
3343
- * &:last-column {
3361
+ * &.first-visible-column {
3362
+ * // do stuff
3363
+ * }
3364
+ * &.last-visible-column {
3344
3365
  * // do stuff
3345
3366
  * }
3346
3367
  * }
@@ -3410,12 +3431,22 @@
3410
3431
  var _a;
3411
3432
  return ((_a = this.tableModel.lastVisibleColumn.query().value) === null || _a === void 0 ? void 0 : _a.columnId) === columnId;
3412
3433
  };
3434
+ TableComponent.prototype.getColumnClasses = function (columnId) {
3435
+ var classes = ["aup-col-" + this.columnsById.get(columnId).dasherisedColumnId];
3436
+ if (this.isFirstVisibleColumn(columnId)) {
3437
+ classes.push('first-visible-column');
3438
+ }
3439
+ if (this.isLastVisibleColumn(columnId)) {
3440
+ classes.push('last-visible-column');
3441
+ }
3442
+ return classes;
3443
+ };
3413
3444
  return TableComponent;
3414
3445
  }(ResizeAwareComponent));
3415
3446
  TableComponent.decorators = [
3416
3447
  { type: i0.Component, args: [{
3417
3448
  selector: 'aup-table',
3418
- template: "<div class=\"scroll-container\">\n <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\"\n matColumnDef=\"{{column.columnId}}\">\n <th mat-header-cell *matHeaderCellDef [class.flex]=\"column.isFlex()\" [class.hide]=\"!column.isVisible()\">\n <aup-table-header-cell-renderer [column]=\"column\"\n [attr.column-index]=\"index\"\n [attr.column-id]=\"column.columnId\"\n [class.first-visible-column]=\"isFirstVisibleColumn(column.columnId)\"\n [class.last-visible-column]=\"isLastVisibleColumn(column.columnId)\"\n ></aup-table-header-cell-renderer>\n </th>\n <td mat-cell *matCellDef=\"let row\" (click)=\"notifyCellClicked(column, row)\"\n [class.enable-cursor]=\"tableModel.isCursorEnabled(column)\"\n [class.flex]=\"column.isFlex()\"\n [class.hide]=\"!column.isVisible()\"\n >\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-visible-column]=\"isFirstVisibleColumn(column.columnId)\"\n [class.last-visible-column]=\"isLastVisibleColumn(column.columnId)\"\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()\"\n [attr.trackBy]=\"tableModel.trackBy(i, row)\"\n ></tr>\n\n </table>\n</div>\n",
3449
+ template: "<div class=\"scroll-container\">\n <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\"\n matColumnDef=\"{{column.columnId}}\">\n <th mat-header-cell *matHeaderCellDef [class.flex]=\"column.isFlex()\" [class.hide]=\"!column.isVisible()\">\n <aup-table-header-cell-renderer [column]=\"column\"\n [attr.column-index]=\"index\"\n [attr.column-id]=\"column.columnId\"\n [class]=\"getColumnClasses(column.columnId)\"\n ></aup-table-header-cell-renderer>\n </th>\n <td mat-cell *matCellDef=\"let row\" (click)=\"notifyCellClicked(column, row)\"\n [class.enable-cursor]=\"tableModel.isCursorEnabled(column)\"\n [class.flex]=\"column.isFlex()\"\n [class.hide]=\"!column.isVisible()\"\n >\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]=\"getColumnClasses(column.columnId)\"\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()\"\n [attr.trackBy]=\"tableModel.trackBy(i, row)\"\n ></tr>\n\n </table>\n</div>\n",
3419
3450
  styles: [":host{display:flex;flex-direction:column;align-items:stretch}:host table{width:100%}:host.enable-scrolling{min-height:0}:host.enable-scrolling .scroll-container{flex:1;flex-basis:0;overflow-y:scroll;display:flex;flex-direction:column;align-items:stretch}"]
3420
3451
  },] }
3421
3452
  ];
@@ -3914,7 +3945,7 @@
3914
3945
  Object.defineProperty(DecoratedTreeNodeMixin.prototype, "decoratedSelf", {
3915
3946
  get: function () {
3916
3947
  var _this = this;
3917
- return this.memoize("decoratedSelf", function () {
3948
+ return this.memoize('decoratedSelf', function () {
3918
3949
  return _this.parent ? _this.parent.children.find(function (child) { return child.node === _this.node; }) : exports.DecoratedTreeNode.createRoot(_this.node);
3919
3950
  });
3920
3951
  },
@@ -3924,7 +3955,7 @@
3924
3955
  Object.defineProperty(DecoratedTreeNodeMixin.prototype, "children", {
3925
3956
  get: function () {
3926
3957
  var _this = this;
3927
- return this.memoize("children", function () {
3958
+ return this.memoize('children', function () {
3928
3959
  return _this.node.children ? _this.node.children.map(function (child) {
3929
3960
  return typescriptUtilities.Mixin.createProxy(child, new DecoratedTreeNodeMixin(_this.decoratedSelf, child));
3930
3961
  }) : [];
@@ -3935,7 +3966,7 @@
3935
3966
  });
3936
3967
  DecoratedTreeNodeMixin.prototype.descendants = function () {
3937
3968
  var _this = this;
3938
- return this.memoize("descendants", function () {
3969
+ return this.memoize('descendants', function () {
3939
3970
  var result = [];
3940
3971
  _this.visitDescendants(function (child) { return result.push(child); });
3941
3972
  return result;
@@ -3943,7 +3974,7 @@
3943
3974
  };
3944
3975
  DecoratedTreeNodeMixin.prototype.selfAndDescendants = function () {
3945
3976
  var _this = this;
3946
- return this.memoize("selfAndDescendants", function () {
3977
+ return this.memoize('selfAndDescendants', function () {
3947
3978
  var result = [];
3948
3979
  _this.visitSelfAndDescendants(function (child) { return result.push(child); });
3949
3980
  return result;
@@ -4014,29 +4045,24 @@
4014
4045
  };
4015
4046
  DecoratedTreeNodeMixin.prototype.ancestorsAndSelf = function () {
4016
4047
  var _this = this;
4017
- return this.memoize("ancestorsAndSelf", function () {
4048
+ return this.memoize('ancestorsAndSelf', function () {
4018
4049
  return _this.ancestors().concat([(_this.decoratedSelf)]);
4019
4050
  });
4020
4051
  };
4021
4052
  DecoratedTreeNodeMixin.prototype.pathToParent = function (parent) {
4022
- var _this = this;
4023
- return this.memoize("pathToParent", function () {
4024
- if (_this.node === parent.node) {
4025
- return [];
4026
- }
4027
- else if (_this.parent) {
4028
- return _this.parent.pathToParent(parent).concat([_this.parent]);
4029
- }
4030
- else {
4031
- throw new Error('parent is not an ancestor');
4032
- }
4033
- });
4053
+ if (this.node === parent.node) {
4054
+ return [];
4055
+ }
4056
+ else if (this.parent) {
4057
+ var pathToParent = this.parent.pathToParent(parent);
4058
+ return pathToParent.concat([this.parent]);
4059
+ }
4060
+ else {
4061
+ throw new Error('parent is not an ancestor');
4062
+ }
4034
4063
  };
4035
4064
  DecoratedTreeNodeMixin.prototype.pathToParentAndSelf = function (parent) {
4036
- var _this = this;
4037
- return this.memoize("pathToParentAndSelf", function () {
4038
- return _this.pathToParent(parent).concat([_this.decoratedSelf]);
4039
- });
4065
+ return this.pathToParent(parent).concat([this.decoratedSelf]);
4040
4066
  };
4041
4067
  DecoratedTreeNodeMixin.prototype.isRoot = function () {
4042
4068
  return !this.parent;
@@ -4052,20 +4078,20 @@
4052
4078
  return !this.isRoot() && this.node.children.length < 1;
4053
4079
  };
4054
4080
  DecoratedTreeNodeMixin.prototype.hasChildren = function () {
4055
- return this.node.children.length > 0;
4081
+ return this.node.children && this.node.children.length > 0;
4056
4082
  };
4057
4083
  DecoratedTreeNodeMixin.prototype.depthFromParent = function (parent) {
4058
4084
  return this.pathToParent(parent).length;
4059
4085
  };
4060
4086
  DecoratedTreeNodeMixin.prototype.treeDepth = function () {
4061
4087
  var _this = this;
4062
- return this.memoize("treeDepth", function () {
4088
+ return this.memoize('treeDepth', function () {
4063
4089
  return 1 + _this.descendants().map(function (child) { return child.depthFromParent(_this); }).reduce(function (prev, current) { return Math.max(prev, current); });
4064
4090
  });
4065
4091
  };
4066
4092
  DecoratedTreeNodeMixin.prototype.flatten = function () {
4067
4093
  var _this = this;
4068
- return this.memoize("flatten", function () {
4094
+ return this.memoize('flatten', function () {
4069
4095
  return _this.flattenInto([]);
4070
4096
  });
4071
4097
  };
@@ -4486,12 +4512,9 @@
4486
4512
  TreeTableComponent,
4487
4513
  exports.TreeInheritanceIconComponent,
4488
4514
  TreeLabelCellRendererComponent,
4489
- exports.IconComponent,
4490
4515
  BusyOverlayComponent,
4491
4516
  EmptyStateComponent,
4492
4517
  PaginatorComponent,
4493
- exports.IconComponent,
4494
- exports.IconComponent
4495
4518
  ],
4496
4519
  imports: [
4497
4520
  i2.CommonModule,