@coolon/angular-ui-powerups 16.1.0-aplpha.39 → 16.1.0-aplpha.41
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/esm2022/lib/components/components.module.mjs +8 -5
- package/esm2022/lib/components/resize-aware.component.mjs +61 -24
- package/esm2022/lib/components/tables/column/column-manager.mjs +3 -8
- package/esm2022/lib/components/tables/renderer/table-body/table-body.component.mjs +6 -6
- package/fesm2022/coolon-angular-ui-powerups.mjs +72 -37
- package/fesm2022/coolon-angular-ui-powerups.mjs.map +1 -1
- package/lib/components/components.module.d.ts +1 -1
- package/lib/components/resize-aware.component.d.ts +24 -5
- package/lib/components/tables/renderer/table-body/table-body.component.d.ts +4 -4
- package/package.json +1 -1
|
@@ -17,7 +17,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
|
17
17
|
import * as i3$2 from '@angular/cdk/portal';
|
|
18
18
|
import { ComponentPortal, TemplatePortal, PortalModule } from '@angular/cdk/portal';
|
|
19
19
|
import * as i1$2 from '@angular/cdk/scrolling';
|
|
20
|
-
import { CdkScrollableModule } from '@angular/cdk/scrolling';
|
|
20
|
+
import { CdkScrollableModule, ScrollingModule } from '@angular/cdk/scrolling';
|
|
21
21
|
import * as i7 from '@angular/material/autocomplete';
|
|
22
22
|
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
23
23
|
import * as i2 from '@angular/material/button';
|
|
@@ -3455,25 +3455,14 @@ class Bounds extends Dimension {
|
|
|
3455
3455
|
})(Bounds || (Bounds = {}));
|
|
3456
3456
|
|
|
3457
3457
|
class ResizeAwareComponent extends DisposableComponent {
|
|
3458
|
-
elementRef;
|
|
3459
|
-
ngZone;
|
|
3460
|
-
|
|
3461
|
-
constructor(elementRef, ngZone) {
|
|
3462
|
-
super();
|
|
3463
|
-
this.elementRef = elementRef;
|
|
3464
|
-
this.ngZone = ngZone;
|
|
3465
|
-
}
|
|
3458
|
+
elementRef = this.inject(ElementRef);
|
|
3459
|
+
ngZone = this.inject(NgZone);
|
|
3460
|
+
boundsTracker = new ResizeAwareComponent.ResizeTracker(this.elementRef, this.ngZone);
|
|
3466
3461
|
ngAfterViewInit() {
|
|
3467
|
-
|
|
3468
|
-
const ro = new ResizeObserver((entries, observer) => {
|
|
3469
|
-
this.ngZone.run(() => this._updateBounds());
|
|
3470
|
-
});
|
|
3471
|
-
ro.observe(element);
|
|
3472
|
-
this.onDispose(() => ro.disconnect());
|
|
3473
|
-
setTimeout(() => this._updateBounds());
|
|
3462
|
+
this.boundsTracker.notifyViewReady();
|
|
3474
3463
|
}
|
|
3475
3464
|
get bounds$() {
|
|
3476
|
-
return this.
|
|
3465
|
+
return this.boundsTracker.bounds$;
|
|
3477
3466
|
}
|
|
3478
3467
|
get nativeElement() {
|
|
3479
3468
|
return this.elementRef.nativeElement;
|
|
@@ -3483,17 +3472,65 @@ class ResizeAwareComponent extends DisposableComponent {
|
|
|
3483
3472
|
return this.bounds.relativePositionOf(point);
|
|
3484
3473
|
}
|
|
3485
3474
|
get bounds() {
|
|
3486
|
-
return this.
|
|
3487
|
-
}
|
|
3488
|
-
_updateBounds() {
|
|
3489
|
-
this._bounds$.value = Bounds.ofElement(this.nativeElement);
|
|
3475
|
+
return this.bounds$.value;
|
|
3490
3476
|
}
|
|
3491
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: ResizeAwareComponent, deps:
|
|
3477
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: ResizeAwareComponent, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
3492
3478
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.9", type: ResizeAwareComponent, usesInheritance: true, ngImport: i0 });
|
|
3493
3479
|
}
|
|
3494
3480
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: ResizeAwareComponent, decorators: [{
|
|
3495
3481
|
type: Directive
|
|
3496
|
-
}]
|
|
3482
|
+
}] });
|
|
3483
|
+
(function (ResizeAwareComponent) {
|
|
3484
|
+
class ResizeTracker extends GarbageCollector {
|
|
3485
|
+
elementRef;
|
|
3486
|
+
ngZone;
|
|
3487
|
+
_bounds$ = new MutableValueModel(new Bounds(0, 0, 0, 0));
|
|
3488
|
+
width$;
|
|
3489
|
+
height$;
|
|
3490
|
+
top$;
|
|
3491
|
+
left$;
|
|
3492
|
+
bottom$;
|
|
3493
|
+
right$;
|
|
3494
|
+
constructor(elementRef, ngZone) {
|
|
3495
|
+
super();
|
|
3496
|
+
this.elementRef = elementRef;
|
|
3497
|
+
this.ngZone = ngZone;
|
|
3498
|
+
const { chain } = Dsl.disposeWith(this);
|
|
3499
|
+
this.width$ = chain(this.bounds$).pluck("width");
|
|
3500
|
+
this.height$ = chain(this.bounds$).pluck("height");
|
|
3501
|
+
this.top$ = chain(this.bounds$).pluck("top");
|
|
3502
|
+
this.left$ = chain(this.bounds$).pluck("left");
|
|
3503
|
+
this.bottom$ = chain.numericValue(this.top$).add(this.height$);
|
|
3504
|
+
this.right$ = chain.numericValue(this.left$).add(this.width$);
|
|
3505
|
+
}
|
|
3506
|
+
notifyViewReady() {
|
|
3507
|
+
const element = this.elementRef.nativeElement;
|
|
3508
|
+
const ro = new ResizeObserver((entries, observer) => {
|
|
3509
|
+
this.ngZone.run(() => this._updateBounds());
|
|
3510
|
+
});
|
|
3511
|
+
ro.observe(element);
|
|
3512
|
+
this.onDispose(() => ro.disconnect());
|
|
3513
|
+
setTimeout(() => this._updateBounds());
|
|
3514
|
+
}
|
|
3515
|
+
get bounds$() {
|
|
3516
|
+
return this._bounds$.readonly$;
|
|
3517
|
+
}
|
|
3518
|
+
get nativeElement() {
|
|
3519
|
+
return this.elementRef.nativeElement;
|
|
3520
|
+
}
|
|
3521
|
+
// TODO: Make this handle body scroll
|
|
3522
|
+
relativePositionOf(point) {
|
|
3523
|
+
return this.bounds.relativePositionOf(point);
|
|
3524
|
+
}
|
|
3525
|
+
get bounds() {
|
|
3526
|
+
return this._bounds$.value;
|
|
3527
|
+
}
|
|
3528
|
+
_updateBounds() {
|
|
3529
|
+
this._bounds$.value = Bounds.ofElement(this.nativeElement);
|
|
3530
|
+
}
|
|
3531
|
+
}
|
|
3532
|
+
ResizeAwareComponent.ResizeTracker = ResizeTracker;
|
|
3533
|
+
})(ResizeAwareComponent || (ResizeAwareComponent = {}));
|
|
3497
3534
|
|
|
3498
3535
|
var ColumnOrderManager;
|
|
3499
3536
|
(function (ColumnOrderManager) {
|
|
@@ -3543,7 +3580,6 @@ class ColumnManager extends GarbageCollector {
|
|
|
3543
3580
|
const target = this._columnRefs$.query().findMatching(it => it.column === column);
|
|
3544
3581
|
const position = this.computePosition(newPosition);
|
|
3545
3582
|
this._columnRefs$.replace(target, { with: new ColumnRef(target.column, position) });
|
|
3546
|
-
console.log(this._columnRefs$.value.map(r => [r.column.columnId, r.position]));
|
|
3547
3583
|
}
|
|
3548
3584
|
getColumn(id) {
|
|
3549
3585
|
return this._columnsById$.get(id);
|
|
@@ -3571,17 +3607,13 @@ class ColumnManager extends GarbageCollector {
|
|
|
3571
3607
|
const index = q.findIndex(ref => ref.column === col);
|
|
3572
3608
|
const beforeCol = q.value[index];
|
|
3573
3609
|
const afterCol = index - 1 >= 0 ? q.value[index - 1] : undefined;
|
|
3574
|
-
return afterCol
|
|
3575
|
-
generateKeyBetween(afterCol.position, beforeCol.position) :
|
|
3576
|
-
generateKeyBetween(null, beforeCol.position);
|
|
3610
|
+
return generateKeyBetween(afterCol?.position, beforeCol.position);
|
|
3577
3611
|
},
|
|
3578
3612
|
after(col) {
|
|
3579
3613
|
const index = q.findIndex(ref => ref.column === col);
|
|
3580
3614
|
const afterCol = q.value[index];
|
|
3581
3615
|
const beforeCol = index + 1 < q.length ? q.value[index + 1] : undefined;
|
|
3582
|
-
return beforeCol
|
|
3583
|
-
generateKeyBetween(afterCol.position, beforeCol.position) :
|
|
3584
|
-
generateKeyBetween(afterCol.position, null);
|
|
3616
|
+
return generateKeyBetween(afterCol.position, beforeCol?.position);
|
|
3585
3617
|
},
|
|
3586
3618
|
first() {
|
|
3587
3619
|
return generateKeyBetween(null, q.first()?.position);
|
|
@@ -4305,8 +4337,8 @@ class TableBodyComponent extends ResizeAwareComponent {
|
|
|
4305
4337
|
headerHeight$ = new MutableValueModel(29);
|
|
4306
4338
|
rowHeight$ = new MutableValueModel(40);
|
|
4307
4339
|
baseCssClass = "aup-table-component";
|
|
4308
|
-
constructor(
|
|
4309
|
-
super(
|
|
4340
|
+
constructor() {
|
|
4341
|
+
super();
|
|
4310
4342
|
const { chain, when } = Dsl.disposeWith(this);
|
|
4311
4343
|
const actualHeaderHeight$ = chain(this.showHeader$).map(show => {
|
|
4312
4344
|
return show ? this.headerHeight$.value : 0;
|
|
@@ -4355,7 +4387,7 @@ class TableBodyComponent extends ResizeAwareComponent {
|
|
|
4355
4387
|
}
|
|
4356
4388
|
return classes;
|
|
4357
4389
|
}
|
|
4358
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: TableBodyComponent, deps: [
|
|
4390
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: TableBodyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4359
4391
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.9", type: TableBodyComponent, selector: "aup-table-body", inputs: { data$: "data$", tableModel: "tableModel", showHeader$: "showHeader$", showHeader: "showHeader", trackBy: "trackBy", enableScrolling: "enableScrolling" }, outputs: { visibleRowCount: "visibleRowCount" }, host: { properties: { "class.enable-scrolling": "this.enableScrolling", "class": "this.baseCssClass", "class.hide-header": "this.hideHeader" } }, usesInheritance: true, ngImport: i0, template: "<div class=\"scroll-container\">\n <table mat-table [dataSource]=\"data$.value\" [trackBy]=\"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 [column]=\"column\"\n [attr.column-index]=\"index\"\n [attr.column-id]=\"column.columnId\"\n [class]=\"getColumnClasses(column.columnId)\"\n ></aup-table-header-cell>\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 [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>\n </td>\n </ng-container>\n\n <tr mat-header-row *matHeaderRowDef=\"columnIds$.value; sticky: true\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: columnIds$.value; let i = index\"\n [ngClass]=\"tableModel.getRowClasses(row)\"\n [class.enable-hover]=\"tableModel.isHoverEnabled()\"\n [attr.aup-row-id]=\"trackBy(i, row)\"\n ></tr>\n\n </table>\n</div>\n\n", 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:auto;display:flex;flex-direction:column;align-items:stretch}\n"], dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: i2$6.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i2$6.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i2$6.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i2$6.MatColumnDef, selector: "[matColumnDef]", inputs: ["sticky", "matColumnDef"] }, { kind: "directive", type: i2$6.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i2$6.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i2$6.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i2$6.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i2$6.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i2$6.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "component", type: TableCellComponent, selector: "aup-table-cell", inputs: ["row", "column", "editSession", "tableModel"] }, { kind: "component", type: TableHeaderCellComponent, selector: "aup-table-header-cell", inputs: ["column"] }] });
|
|
4360
4392
|
}
|
|
4361
4393
|
__decorate([
|
|
@@ -4377,7 +4409,7 @@ __decorate([
|
|
|
4377
4409
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: TableBodyComponent, decorators: [{
|
|
4378
4410
|
type: Component,
|
|
4379
4411
|
args: [{ selector: "aup-table-body", template: "<div class=\"scroll-container\">\n <table mat-table [dataSource]=\"data$.value\" [trackBy]=\"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 [column]=\"column\"\n [attr.column-index]=\"index\"\n [attr.column-id]=\"column.columnId\"\n [class]=\"getColumnClasses(column.columnId)\"\n ></aup-table-header-cell>\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 [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>\n </td>\n </ng-container>\n\n <tr mat-header-row *matHeaderRowDef=\"columnIds$.value; sticky: true\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: columnIds$.value; let i = index\"\n [ngClass]=\"tableModel.getRowClasses(row)\"\n [class.enable-hover]=\"tableModel.isHoverEnabled()\"\n [attr.aup-row-id]=\"trackBy(i, row)\"\n ></tr>\n\n </table>\n</div>\n\n", 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:auto;display:flex;flex-direction:column;align-items:stretch}\n"] }]
|
|
4380
|
-
}], ctorParameters: function () { return [
|
|
4412
|
+
}], ctorParameters: function () { return []; }, propDecorators: { data$: [{
|
|
4381
4413
|
type: Input
|
|
4382
4414
|
}], tableModel: [{
|
|
4383
4415
|
type: Input
|
|
@@ -5741,7 +5773,8 @@ class ComponentsModule {
|
|
|
5741
5773
|
MatMenuModule,
|
|
5742
5774
|
MatDividerModule,
|
|
5743
5775
|
MatProgressSpinnerModule,
|
|
5744
|
-
MatProgressBarModule
|
|
5776
|
+
MatProgressBarModule,
|
|
5777
|
+
ScrollingModule], exports: [NumberInputComponent,
|
|
5745
5778
|
StringInputComponent,
|
|
5746
5779
|
TextInputComponent,
|
|
5747
5780
|
PasswordInputComponent,
|
|
@@ -5803,7 +5836,8 @@ class ComponentsModule {
|
|
|
5803
5836
|
MatMenuModule,
|
|
5804
5837
|
MatDividerModule,
|
|
5805
5838
|
MatProgressSpinnerModule,
|
|
5806
|
-
MatProgressBarModule
|
|
5839
|
+
MatProgressBarModule,
|
|
5840
|
+
ScrollingModule] });
|
|
5807
5841
|
}
|
|
5808
5842
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: ComponentsModule, decorators: [{
|
|
5809
5843
|
type: NgModule,
|
|
@@ -5828,7 +5862,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImpor
|
|
|
5828
5862
|
MatMenuModule,
|
|
5829
5863
|
MatDividerModule,
|
|
5830
5864
|
MatProgressSpinnerModule,
|
|
5831
|
-
MatProgressBarModule
|
|
5865
|
+
MatProgressBarModule,
|
|
5866
|
+
ScrollingModule
|
|
5832
5867
|
],
|
|
5833
5868
|
declarations: [
|
|
5834
5869
|
AbstractInputComponent,
|