@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.
- package/assets/table.scss +13 -6
- package/bundles/coolon-angular-ui-powerups.umd.js +54 -31
- package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
- package/bundles/coolon-angular-ui-powerups.umd.min.js +1 -1
- package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -1
- package/coolon-angular-ui-powerups.metadata.json +1 -1
- package/esm2015/lib/components/commands/command/command.component.js +5 -1
- package/esm2015/lib/components/commands/command/command.component.js.map +1 -1
- package/esm2015/lib/components/commands/command/command.component.metadata.json +1 -1
- package/esm2015/lib/components/components.module.js +0 -3
- package/esm2015/lib/components/components.module.js.map +1 -1
- package/esm2015/lib/components/components.module.metadata.json +1 -1
- package/esm2015/lib/components/components.module.ngfactory.js.map +1 -1
- package/esm2015/lib/components/table/column-model.js +2 -1
- package/esm2015/lib/components/table/column-model.js.map +1 -1
- package/esm2015/lib/components/table/column-model.metadata.json +1 -1
- package/esm2015/lib/components/table/table-cell-renderer/table-cell-renderer.component.js.map +1 -1
- package/esm2015/lib/components/table/table-cell-renderer/table-cell-renderer.component.metadata.json +1 -1
- package/esm2015/lib/components/table/table.component.js +30 -3
- package/esm2015/lib/components/table/table.component.js.map +1 -1
- package/esm2015/lib/components/table/table.component.metadata.json +1 -1
- package/esm2015/lib/components/tree-table/decorated-tree-node.js +19 -22
- package/esm2015/lib/components/tree-table/decorated-tree-node.js.map +1 -1
- package/fesm2015/coolon-angular-ui-powerups.js +55 -30
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/components/commands/command/command.component.d.ts +2 -1
- package/lib/components/table/column-model.d.ts +1 -0
- package/lib/components/table/table.component.d.ts +20 -2
- package/package.json +1 -1
|
@@ -25,7 +25,7 @@ import { Memoize } from '@typescript-plus/fast-memoize-decorator/dist/src';
|
|
|
25
25
|
import _, { find, filter, each, isNil, isEqual } from 'lodash';
|
|
26
26
|
import { Enum } from 'typescript-string-enums';
|
|
27
27
|
import ResizeObserver from 'resize-observer-polyfill';
|
|
28
|
-
import { assert as assert$1, Mixin, Opts, lang as lang$1, Klass } from '@coolon/typescript-utilities';
|
|
28
|
+
import { assert as assert$1, Stringy, Mixin, Opts, lang as lang$1, Klass } from '@coolon/typescript-utilities';
|
|
29
29
|
import produce from 'immer';
|
|
30
30
|
import { FlexModule, GridModule } from '@angular/flex-layout';
|
|
31
31
|
import { MatDialogModule, MatDialog, MAT_DIALOG_DEFAULT_OPTIONS, MatDialogConfig } from '@angular/material/dialog';
|
|
@@ -641,6 +641,9 @@ class CommandComponent extends PopupAwareComponent {
|
|
|
641
641
|
this.activeFace = this.faces.first();
|
|
642
642
|
this.buttonStyle = chain(this.activeFace).map(f => CommandFace.getStyleOf(f));
|
|
643
643
|
this.colorModel = chain(this.activeFace).map(f => CommandFace.getColorOf(f));
|
|
644
|
+
this.iconOnly = this.faces.select(face => {
|
|
645
|
+
return _.isEmpty(CommandFace.getTextOf(face)) && !_.isEmpty(CommandFace.getIconOf(face));
|
|
646
|
+
}).count().equals(this.faces.count());
|
|
644
647
|
}
|
|
645
648
|
isActive(face) {
|
|
646
649
|
return this.activeFace.query().equals(face);
|
|
@@ -657,7 +660,7 @@ class CommandComponent extends PopupAwareComponent {
|
|
|
657
660
|
CommandComponent.decorators = [
|
|
658
661
|
{ type: Component, args: [{
|
|
659
662
|
selector: 'aup-command',
|
|
660
|
-
template: "<ng-container [ngSwitch]=\"buttonStyle.value\">\n
|
|
663
|
+
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",
|
|
661
664
|
styles: [":host{display:inline-flex;flex-direction:row;justify-content:stretch}button{flex:1}"]
|
|
662
665
|
},] }
|
|
663
666
|
];
|
|
@@ -2155,6 +2158,7 @@ class ColumnModel {
|
|
|
2155
2158
|
this._flex = false;
|
|
2156
2159
|
this._visibleModel = new DelegatingValueModel().withDefault(true);
|
|
2157
2160
|
this.installHeaderRenderer();
|
|
2161
|
+
this.dasherisedColumnId = Stringy.from(columnId).dasherize().toString();
|
|
2158
2162
|
}
|
|
2159
2163
|
installHeaderRenderer() {
|
|
2160
2164
|
this.cellHeaderRenderer(DefaultHeaderCellRendererComponent, (component, column) => {
|
|
@@ -2697,15 +2701,32 @@ AbstractTableModel = __decorate([
|
|
|
2697
2701
|
*
|
|
2698
2702
|
* Styling
|
|
2699
2703
|
* @example
|
|
2704
|
+
* // global settings
|
|
2705
|
+
* :root {
|
|
2706
|
+
* --aup-table-column-gap: 10px; // defaults to 24px
|
|
2707
|
+
* --aup-table-row-hover-background-color, rgba(0, 0, 0, 0.05)
|
|
2708
|
+
* --aup-table-row-selected-background-color: rebeccapurple; // defaults to transparent
|
|
2709
|
+
* --aup-table-first-column-padding-left: 18px // defaults to --column-gap
|
|
2710
|
+
* --aup-table-last-column-padding-right: 18px // defaults to --column-gap
|
|
2711
|
+
* }
|
|
2712
|
+
*
|
|
2713
|
+
* // per table settings.
|
|
2700
2714
|
* aup-table {
|
|
2701
2715
|
* --column-gap: 10px; // defaults to 24px
|
|
2702
2716
|
* --row-hover-background-color, rgba(0, 0, 0, 0.05)
|
|
2703
2717
|
* --row-selected-background-color: rebeccapurple; // defaults to transparent
|
|
2718
|
+
* --first-column-padding-left: 18px // defaults to --column-gap
|
|
2719
|
+
* --last-column-padding-right: 18px // defaults to --column-gap
|
|
2720
|
+
*
|
|
2721
|
+
* aup-table-header-cell-renderer,
|
|
2704
2722
|
* aup-table-cell-renderer {
|
|
2705
|
-
*
|
|
2723
|
+
* &.aup-col-my-dasherised-column-id {
|
|
2706
2724
|
* // do stuff
|
|
2707
2725
|
* }
|
|
2708
|
-
*
|
|
2726
|
+
* &.first-visible-column {
|
|
2727
|
+
* // do stuff
|
|
2728
|
+
* }
|
|
2729
|
+
* &.last-visible-column {
|
|
2709
2730
|
* // do stuff
|
|
2710
2731
|
* }
|
|
2711
2732
|
* }
|
|
@@ -2769,11 +2790,21 @@ class TableComponent extends ResizeAwareComponent {
|
|
|
2769
2790
|
var _a;
|
|
2770
2791
|
return ((_a = this.tableModel.lastVisibleColumn.query().value) === null || _a === void 0 ? void 0 : _a.columnId) === columnId;
|
|
2771
2792
|
}
|
|
2793
|
+
getColumnClasses(columnId) {
|
|
2794
|
+
const classes = [`aup-col-${this.columnsById.get(columnId).dasherisedColumnId}`];
|
|
2795
|
+
if (this.isFirstVisibleColumn(columnId)) {
|
|
2796
|
+
classes.push('first-visible-column');
|
|
2797
|
+
}
|
|
2798
|
+
if (this.isLastVisibleColumn(columnId)) {
|
|
2799
|
+
classes.push('last-visible-column');
|
|
2800
|
+
}
|
|
2801
|
+
return classes;
|
|
2802
|
+
}
|
|
2772
2803
|
}
|
|
2773
2804
|
TableComponent.decorators = [
|
|
2774
2805
|
{ type: Component, args: [{
|
|
2775
2806
|
selector: 'aup-table',
|
|
2776
|
-
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
|
|
2807
|
+
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",
|
|
2777
2808
|
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}"]
|
|
2778
2809
|
},] }
|
|
2779
2810
|
];
|
|
@@ -3095,26 +3126,26 @@ class DecoratedTreeNodeMixin {
|
|
|
3095
3126
|
this.node = node;
|
|
3096
3127
|
}
|
|
3097
3128
|
get decoratedSelf() {
|
|
3098
|
-
return this.memoize(
|
|
3129
|
+
return this.memoize('decoratedSelf', () => {
|
|
3099
3130
|
return this.parent ? this.parent.children.find(child => child.node === this.node) : DecoratedTreeNode.createRoot(this.node);
|
|
3100
3131
|
});
|
|
3101
3132
|
}
|
|
3102
3133
|
get children() {
|
|
3103
|
-
return this.memoize(
|
|
3134
|
+
return this.memoize('children', () => {
|
|
3104
3135
|
return this.node.children ? this.node.children.map(child => {
|
|
3105
3136
|
return Mixin.createProxy(child, new DecoratedTreeNodeMixin(this.decoratedSelf, child));
|
|
3106
3137
|
}) : [];
|
|
3107
3138
|
});
|
|
3108
3139
|
}
|
|
3109
3140
|
descendants() {
|
|
3110
|
-
return this.memoize(
|
|
3141
|
+
return this.memoize('descendants', () => {
|
|
3111
3142
|
const result = [];
|
|
3112
3143
|
this.visitDescendants(child => result.push(child));
|
|
3113
3144
|
return result;
|
|
3114
3145
|
});
|
|
3115
3146
|
}
|
|
3116
3147
|
selfAndDescendants() {
|
|
3117
|
-
return this.memoize(
|
|
3148
|
+
return this.memoize('selfAndDescendants', () => {
|
|
3118
3149
|
const result = [];
|
|
3119
3150
|
this.visitSelfAndDescendants(child => result.push(child));
|
|
3120
3151
|
return result;
|
|
@@ -3177,27 +3208,24 @@ class DecoratedTreeNodeMixin {
|
|
|
3177
3208
|
});
|
|
3178
3209
|
}
|
|
3179
3210
|
ancestorsAndSelf() {
|
|
3180
|
-
return this.memoize(
|
|
3211
|
+
return this.memoize('ancestorsAndSelf', () => {
|
|
3181
3212
|
return this.ancestors().concat([(this.decoratedSelf)]);
|
|
3182
3213
|
});
|
|
3183
3214
|
}
|
|
3184
3215
|
pathToParent(parent) {
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
});
|
|
3216
|
+
if (this.node === parent.node) {
|
|
3217
|
+
return [];
|
|
3218
|
+
}
|
|
3219
|
+
else if (this.parent) {
|
|
3220
|
+
const pathToParent = this.parent.pathToParent(parent);
|
|
3221
|
+
return pathToParent.concat([this.parent]);
|
|
3222
|
+
}
|
|
3223
|
+
else {
|
|
3224
|
+
throw new Error('parent is not an ancestor');
|
|
3225
|
+
}
|
|
3196
3226
|
}
|
|
3197
3227
|
pathToParentAndSelf(parent) {
|
|
3198
|
-
return this.
|
|
3199
|
-
return this.pathToParent(parent).concat([this.decoratedSelf]);
|
|
3200
|
-
});
|
|
3228
|
+
return this.pathToParent(parent).concat([this.decoratedSelf]);
|
|
3201
3229
|
}
|
|
3202
3230
|
isRoot() {
|
|
3203
3231
|
return !this.parent;
|
|
@@ -3209,18 +3237,18 @@ class DecoratedTreeNodeMixin {
|
|
|
3209
3237
|
return !this.isRoot() && this.node.children.length < 1;
|
|
3210
3238
|
}
|
|
3211
3239
|
hasChildren() {
|
|
3212
|
-
return this.node.children.length > 0;
|
|
3240
|
+
return this.node.children && this.node.children.length > 0;
|
|
3213
3241
|
}
|
|
3214
3242
|
depthFromParent(parent) {
|
|
3215
3243
|
return this.pathToParent(parent).length;
|
|
3216
3244
|
}
|
|
3217
3245
|
treeDepth() {
|
|
3218
|
-
return this.memoize(
|
|
3246
|
+
return this.memoize('treeDepth', () => {
|
|
3219
3247
|
return 1 + this.descendants().map(child => child.depthFromParent(this)).reduce((prev, current) => Math.max(prev, current));
|
|
3220
3248
|
});
|
|
3221
3249
|
}
|
|
3222
3250
|
flatten() {
|
|
3223
|
-
return this.memoize(
|
|
3251
|
+
return this.memoize('flatten', () => {
|
|
3224
3252
|
return this.flattenInto([]);
|
|
3225
3253
|
});
|
|
3226
3254
|
}
|
|
@@ -3740,12 +3768,9 @@ ComponentsModule.decorators = [
|
|
|
3740
3768
|
TreeTableComponent,
|
|
3741
3769
|
TreeInheritanceIconComponent,
|
|
3742
3770
|
TreeLabelCellRendererComponent,
|
|
3743
|
-
IconComponent,
|
|
3744
3771
|
BusyOverlayComponent,
|
|
3745
3772
|
EmptyStateComponent,
|
|
3746
3773
|
PaginatorComponent,
|
|
3747
|
-
IconComponent,
|
|
3748
|
-
IconComponent
|
|
3749
3774
|
],
|
|
3750
3775
|
imports: [
|
|
3751
3776
|
CommonModule,
|