@coolon/angular-ui-powerups 13.5.3 → 13.6.0
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/esm2020/lib/angular-ui-powerups.module.mjs +8 -4
- package/esm2020/lib/components/components.module.mjs +6 -3
- package/esm2020/lib/components/exports.mjs +2 -1
- package/esm2020/lib/components/tables/abstract-table-model.mjs +10 -5
- package/esm2020/lib/components/tables/abstract-table.component.mjs +14 -60
- package/esm2020/lib/components/tables/paginator/paginator.component.mjs +2 -2
- package/esm2020/lib/components/tables/renderer/table-body/table-body.component.mjs +112 -0
- package/esm2020/lib/components/tables/table/table-model.mjs +20 -1
- package/esm2020/lib/components/tables/table/table.component.mjs +29 -16
- package/esm2020/lib/components/tables/tree-table/tree-table-component.mjs +9 -12
- package/fesm2015/coolon-angular-ui-powerups.mjs +424 -326
- package/fesm2015/coolon-angular-ui-powerups.mjs.map +1 -1
- package/fesm2020/coolon-angular-ui-powerups.mjs +464 -366
- package/fesm2020/coolon-angular-ui-powerups.mjs.map +1 -1
- package/lib/angular-ui-powerups.module.d.ts +4 -3
- package/lib/components/components.module.d.ts +23 -22
- package/lib/components/exports.d.ts +1 -0
- package/lib/components/tables/abstract-table-model.d.ts +5 -3
- package/lib/components/tables/abstract-table.component.d.ts +7 -13
- package/lib/components/tables/renderer/table-body/table-body.component.d.ts +35 -0
- package/lib/components/tables/table/table-model.d.ts +6 -1
- package/lib/components/tables/table/table.component.d.ts +7 -5
- package/lib/components/tables/tree-table/tree-table-component.d.ts +2 -2
- package/package.json +2 -2
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ObserversModule } from '@angular/cdk/observers';
|
|
1
2
|
import * as i4 from '@angular/common';
|
|
2
3
|
import { DOCUMENT, CommonModule } from '@angular/common';
|
|
3
4
|
import * as i0 from '@angular/core';
|
|
@@ -40,7 +41,7 @@ import { MatTooltipModule } from '@angular/material/tooltip';
|
|
|
40
41
|
import * as i1$5 from '@fortawesome/angular-fontawesome';
|
|
41
42
|
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
|
|
42
43
|
import * as i1$7 from '@coolon/pectin';
|
|
43
|
-
import { GarbageCollector, DelegatingValueModel, assert, UnaryCommand, lang, Dsl, Logger, TrackExternal, ValueModel, StoreInValueModel, Command, MutableListModel, StoreInListModel, Disposable, DelegatingListModel, MutableValueModel, FocusManager, EventListenerList, Form, Guard, Binding, DebugContext, ListModel, Functions, MultipleSelectionModel, AbstractComputedListModel, DelegatingSelectionModel, DirtyTrackingForm,
|
|
44
|
+
import { GarbageCollector, DelegatingValueModel, assert, UnaryCommand, lang, Dsl, Logger, TrackExternal, ValueModel, StoreInValueModel, Command, MutableListModel, StoreInListModel, Disposable, DelegatingListModel, MutableValueModel, FocusManager, EventListenerList, Form, Guard, Binding, DebugContext, ListModel, Functions, MultipleSelectionModel, AbstractComputedListModel, DelegatingSelectionModel, DirtyTrackingForm, TransactionObserver, PagedListModel, PageController, Trace, ComputedListModel, Deferred } from '@coolon/pectin';
|
|
44
45
|
import { __decorate, __param, __metadata, __awaiter } from 'tslib';
|
|
45
46
|
import * as _ from 'lodash';
|
|
46
47
|
import { isEmpty, isString, isFunction, isNil, isInteger, isEqual, uniq, first, findLast, isObject, isNumber, isNaN as isNaN$1 } from 'lodash';
|
|
@@ -50,9 +51,10 @@ import { lang as lang$1, assert as assert$1, Stringy, Klass, Opts } from '@coolo
|
|
|
50
51
|
import { Memoize } from '@typescript-plus/fast-memoize-decorator';
|
|
51
52
|
import { Enum } from 'typescript-string-enums';
|
|
52
53
|
import * as i3 from '@angular/material/core';
|
|
53
|
-
import
|
|
54
|
+
import { isNil as isNil$1, isEmpty as isEmpty$1 } from 'lodash-es';
|
|
54
55
|
import escapeStringRegexp from 'escape-string-regexp';
|
|
55
56
|
import produce from 'immer';
|
|
57
|
+
import ResizeObserver from 'resize-observer-polyfill';
|
|
56
58
|
import { fas } from '@fortawesome/free-solid-svg-icons';
|
|
57
59
|
import * as i6$1 from '@angular/cdk/a11y';
|
|
58
60
|
import { A11yModule } from '@angular/cdk/a11y';
|
|
@@ -62,7 +64,6 @@ import * as i1$e from '@angular/material/dialog';
|
|
|
62
64
|
import { MatDialogModule, MAT_DIALOG_DEFAULT_OPTIONS } from '@angular/material/dialog';
|
|
63
65
|
import * as i1$c from '@angular/router';
|
|
64
66
|
import { UrlSegment, NavigationStart, NavigationEnd, NavigationError, NavigationCancel, RouterModule, ActivatedRouteSnapshot } from '@angular/router';
|
|
65
|
-
import { isEmpty as isEmpty$1 } from 'lodash-es';
|
|
66
67
|
import * as i1$d from '@angular/cdk/overlay';
|
|
67
68
|
import * as i2$5 from '@angular/material/list';
|
|
68
69
|
import { MatListModule } from '@angular/material/list';
|
|
@@ -2368,90 +2369,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImpor
|
|
|
2368
2369
|
args: [SwitchCaseOption]
|
|
2369
2370
|
}] } });
|
|
2370
2371
|
|
|
2371
|
-
class Dimension {
|
|
2372
|
-
constructor(width, height) {
|
|
2373
|
-
this.width = width;
|
|
2374
|
-
this.height = height;
|
|
2375
|
-
}
|
|
2376
|
-
}
|
|
2377
|
-
|
|
2378
|
-
class Point {
|
|
2379
|
-
constructor(x, y) {
|
|
2380
|
-
this.x = x;
|
|
2381
|
-
this.y = y;
|
|
2382
|
-
}
|
|
2383
|
-
static from(data) {
|
|
2384
|
-
return new Point(data.x, data.y);
|
|
2385
|
-
}
|
|
2386
|
-
translate(x, y) {
|
|
2387
|
-
return new Point(this.x + x, this.y + y);
|
|
2388
|
-
}
|
|
2389
|
-
}
|
|
2390
|
-
|
|
2391
|
-
class Bounds extends Dimension {
|
|
2392
|
-
constructor(top, left, width, height) {
|
|
2393
|
-
super(width, height);
|
|
2394
|
-
this.top = top;
|
|
2395
|
-
this.left = left;
|
|
2396
|
-
this.width = width;
|
|
2397
|
-
this.height = height;
|
|
2398
|
-
}
|
|
2399
|
-
relativePositionOf(point) {
|
|
2400
|
-
if (point instanceof MouseEvent) {
|
|
2401
|
-
return new Point(point.clientX - this.left, point.clientY - this.top);
|
|
2402
|
-
}
|
|
2403
|
-
else {
|
|
2404
|
-
return new Point(point.x - this.left, point.y - this.top);
|
|
2405
|
-
}
|
|
2406
|
-
}
|
|
2407
|
-
}
|
|
2408
|
-
(function (Bounds) {
|
|
2409
|
-
function ofElement(element) {
|
|
2410
|
-
const rect = element.getBoundingClientRect();
|
|
2411
|
-
return new Bounds(rect.top, rect.left, rect.width, rect.height);
|
|
2412
|
-
}
|
|
2413
|
-
Bounds.ofElement = ofElement;
|
|
2414
|
-
})(Bounds || (Bounds = {}));
|
|
2415
|
-
|
|
2416
|
-
class ResizeAwareComponent extends DisposableComponent {
|
|
2417
|
-
constructor(elementRef, ngZone) {
|
|
2418
|
-
super();
|
|
2419
|
-
this.elementRef = elementRef;
|
|
2420
|
-
this.ngZone = ngZone;
|
|
2421
|
-
this._boundsModel = new MutableValueModel(new Bounds(0, 0, 0, 0));
|
|
2422
|
-
}
|
|
2423
|
-
ngAfterViewInit() {
|
|
2424
|
-
const element = this.elementRef.nativeElement;
|
|
2425
|
-
const ro = new ResizeObserver((entries, observer) => {
|
|
2426
|
-
this.ngZone.run(() => this._updateBounds());
|
|
2427
|
-
});
|
|
2428
|
-
ro.observe(element);
|
|
2429
|
-
this.onDispose(() => ro.disconnect());
|
|
2430
|
-
setTimeout(() => this._updateBounds());
|
|
2431
|
-
}
|
|
2432
|
-
get boundsModel() {
|
|
2433
|
-
return this._boundsModel.readonly;
|
|
2434
|
-
}
|
|
2435
|
-
get nativeElement() {
|
|
2436
|
-
return this.elementRef.nativeElement;
|
|
2437
|
-
}
|
|
2438
|
-
// TODO: Make this handle body scroll
|
|
2439
|
-
relativePositionOf(point) {
|
|
2440
|
-
return this.bounds.relativePositionOf(point);
|
|
2441
|
-
}
|
|
2442
|
-
get bounds() {
|
|
2443
|
-
return this._boundsModel.value;
|
|
2444
|
-
}
|
|
2445
|
-
_updateBounds() {
|
|
2446
|
-
this._boundsModel.value = Bounds.ofElement(this.nativeElement);
|
|
2447
|
-
}
|
|
2448
|
-
}
|
|
2449
|
-
ResizeAwareComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: ResizeAwareComponent, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2450
|
-
ResizeAwareComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.3", type: ResizeAwareComponent, usesInheritance: true, ngImport: i0 });
|
|
2451
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: ResizeAwareComponent, decorators: [{
|
|
2452
|
-
type: Directive
|
|
2453
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }]; } });
|
|
2454
|
-
|
|
2455
2372
|
const HEADER_CELL_RENDERER_PORTAL = Symbol('aup-cell-header-renderer-component-ref');
|
|
2456
2373
|
const CELL_RENDERER_PORTAL = Symbol('aup-cell-renderer-component-ref');
|
|
2457
2374
|
const CELL_EDITOR_PORTAL = Symbol('aup-cell-editor-component-ref');
|
|
@@ -2854,9 +2771,9 @@ class CustomTemplateColumnModel extends ColumnModel {
|
|
|
2854
2771
|
* }
|
|
2855
2772
|
* }
|
|
2856
2773
|
*/
|
|
2857
|
-
class AbstractTableComponent extends
|
|
2858
|
-
constructor(
|
|
2859
|
-
super(
|
|
2774
|
+
class AbstractTableComponent extends DisposableComponent {
|
|
2775
|
+
constructor(injector) {
|
|
2776
|
+
super();
|
|
2860
2777
|
this.injector = injector;
|
|
2861
2778
|
/**
|
|
2862
2779
|
* Set to true to enable scrolling. Once enabled the table will have 0 implicit height. You will either
|
|
@@ -2869,33 +2786,14 @@ class AbstractTableComponent extends ResizeAwareComponent {
|
|
|
2869
2786
|
this.rowHeight = new MutableValueModel(48);
|
|
2870
2787
|
this.baseCssClass = 'aup-table-component';
|
|
2871
2788
|
const { chain, when } = Dsl.disposeWith(this);
|
|
2872
|
-
const actualHeaderHeight = chain(this.showHeaderModel).map(show => {
|
|
2873
|
-
return show ? this.headerHeight.value : 0;
|
|
2874
|
-
}, { dependsOn: this.headerHeight });
|
|
2875
|
-
this.visibleRowCount = chain(this.boundsModel).map(bounds => {
|
|
2876
|
-
// TODO: this doesn't take into account any css styling adjustments etc. Will investigate if it's an issue.
|
|
2877
|
-
const rawRowCount = (bounds.height - actualHeaderHeight.value) / this.rowHeight.value;
|
|
2878
|
-
return rawRowCount < 1 ? 0 : Math.floor(rawRowCount);
|
|
2879
|
-
}, {
|
|
2880
|
-
dependsOn: [actualHeaderHeight, this.rowHeight],
|
|
2881
|
-
postponeWhile: chain(this.boundsModel).pluckNumeric('height').isLessThan(1)
|
|
2882
|
-
});
|
|
2883
|
-
}
|
|
2884
|
-
get hideHeader() {
|
|
2885
|
-
return !this.showHeader;
|
|
2886
|
-
}
|
|
2887
|
-
getModel() {
|
|
2888
|
-
return lang$1.abstractMethod(this.constructor);
|
|
2889
2789
|
}
|
|
2890
2790
|
ngOnInit() {
|
|
2891
2791
|
const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
|
|
2892
2792
|
this.getModel().initialise(this.injector);
|
|
2893
|
-
this.
|
|
2894
|
-
this.columnIds = chain(this.columns).pluck('columnId');
|
|
2895
|
-
this.columnsById = chain(this.columns).indexBy('columnId');
|
|
2793
|
+
this.columnsById = chain(this.getModel().columns).indexBy('columnId');
|
|
2896
2794
|
}
|
|
2897
|
-
|
|
2898
|
-
return
|
|
2795
|
+
getModel() {
|
|
2796
|
+
return lang$1.abstractMethod(this.constructor);
|
|
2899
2797
|
}
|
|
2900
2798
|
registerColumnTemplate(columnId, templateRef, viewContainer, fillCell, padChild) {
|
|
2901
2799
|
const column = this.columnsById.get(columnId);
|
|
@@ -2903,38 +2801,15 @@ class AbstractTableComponent extends ResizeAwareComponent {
|
|
|
2903
2801
|
column.setTemplate(templateRef, viewContainer, fillCell, padChild);
|
|
2904
2802
|
}
|
|
2905
2803
|
}
|
|
2906
|
-
notifyCellClicked(columnModel, row) {
|
|
2907
|
-
this.getModel()._notifyCellClicked(columnModel, row);
|
|
2908
|
-
}
|
|
2909
|
-
// @Trace()
|
|
2910
|
-
isFirstVisibleColumn(columnId) {
|
|
2911
|
-
var _a;
|
|
2912
|
-
return ((_a = this.getModel().firstVisibleColumn$.query().value) === null || _a === void 0 ? void 0 : _a.columnId) === columnId;
|
|
2913
|
-
}
|
|
2914
|
-
// @Trace()
|
|
2915
|
-
isLastVisibleColumn(columnId) {
|
|
2916
|
-
var _a;
|
|
2917
|
-
return ((_a = this.getModel().lastVisibleColumn$.query().value) === null || _a === void 0 ? void 0 : _a.columnId) === columnId;
|
|
2918
|
-
}
|
|
2919
|
-
getColumnClasses(columnId) {
|
|
2920
|
-
const classes = [`aup-col-${this.columnsById.get(columnId).dasherisedColumnId}`];
|
|
2921
|
-
if (this.isFirstVisibleColumn(columnId)) {
|
|
2922
|
-
classes.push('first-visible-column');
|
|
2923
|
-
}
|
|
2924
|
-
if (this.isLastVisibleColumn(columnId)) {
|
|
2925
|
-
classes.push('last-visible-column');
|
|
2926
|
-
}
|
|
2927
|
-
return classes;
|
|
2928
|
-
}
|
|
2929
2804
|
}
|
|
2930
|
-
AbstractTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: AbstractTableComponent, deps: [{ token: i0.
|
|
2931
|
-
AbstractTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.3", type: AbstractTableComponent, selector: "aup-abstract-table", inputs: {
|
|
2805
|
+
AbstractTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: AbstractTableComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
|
|
2806
|
+
AbstractTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.3", type: AbstractTableComponent, selector: "aup-abstract-table", inputs: { showHeader$: "showHeader$", showHeader: "showHeader", enableScrolling: "enableScrolling" }, host: { properties: { "class": "this.baseCssClass" } }, usesInheritance: true, ngImport: i0, template: '', isInline: true });
|
|
2932
2807
|
__decorate([
|
|
2933
2808
|
TrackExternal({ defaultValue: true }),
|
|
2934
2809
|
__metadata("design:type", ValueModel)
|
|
2935
|
-
], AbstractTableComponent.prototype, "
|
|
2810
|
+
], AbstractTableComponent.prototype, "showHeader$", void 0);
|
|
2936
2811
|
__decorate([
|
|
2937
|
-
StoreInValueModel(
|
|
2812
|
+
StoreInValueModel("showHeader$"),
|
|
2938
2813
|
__metadata("design:type", Boolean)
|
|
2939
2814
|
], AbstractTableComponent.prototype, "showHeader", void 0);
|
|
2940
2815
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: AbstractTableComponent, decorators: [{
|
|
@@ -2943,21 +2818,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImpor
|
|
|
2943
2818
|
selector: 'aup-abstract-table',
|
|
2944
2819
|
template: ''
|
|
2945
2820
|
}]
|
|
2946
|
-
}], ctorParameters: function () { return [{ type: i0.
|
|
2821
|
+
}], ctorParameters: function () { return [{ type: i0.Injector }]; }, propDecorators: { showHeader$: [{
|
|
2947
2822
|
type: Input
|
|
2948
2823
|
}], showHeader: [{
|
|
2949
2824
|
type: Input
|
|
2950
2825
|
}], enableScrolling: [{
|
|
2951
2826
|
type: Input
|
|
2952
|
-
}, {
|
|
2953
|
-
type: HostBinding,
|
|
2954
|
-
args: ['class.enable-scrolling']
|
|
2955
2827
|
}], baseCssClass: [{
|
|
2956
2828
|
type: HostBinding,
|
|
2957
2829
|
args: ['class']
|
|
2958
|
-
}], hideHeader: [{
|
|
2959
|
-
type: HostBinding,
|
|
2960
|
-
args: ['class.hide-header']
|
|
2961
2830
|
}] } });
|
|
2962
2831
|
|
|
2963
2832
|
class ColumnTemplateDirective {
|
|
@@ -3599,7 +3468,8 @@ class RowClass {
|
|
|
3599
3468
|
class AbstractTableModel extends GarbageCollector {
|
|
3600
3469
|
constructor() {
|
|
3601
3470
|
super();
|
|
3602
|
-
this.
|
|
3471
|
+
this._rawDataSource = this.registerDisposable(new DelegatingListModel());
|
|
3472
|
+
this._visibleRows$ = this.registerDisposable(new DelegatingListModel());
|
|
3603
3473
|
this._columnList = this.registerDisposable(new ColumnListModel());
|
|
3604
3474
|
this._editorSessions = new MutableListModel();
|
|
3605
3475
|
this.rowClassNamePredicates = [];
|
|
@@ -3624,11 +3494,12 @@ class AbstractTableModel extends GarbageCollector {
|
|
|
3624
3494
|
allowNil: true,
|
|
3625
3495
|
dependsOn: this.columns
|
|
3626
3496
|
});
|
|
3627
|
-
this.
|
|
3497
|
+
this._filteredRows$ = chain(this._rawDataSource)
|
|
3628
3498
|
.reduceToList(items => this._textSearchPredicate$.value(items), {
|
|
3629
3499
|
dependsOn: this._textSearchPredicate$
|
|
3630
3500
|
})
|
|
3631
3501
|
.replaceAll(this.rowsBeingEdited$);
|
|
3502
|
+
this._visibleRows$.setDelegate(this._filteredRows$);
|
|
3632
3503
|
this.firstEditableColumn$ = chain(this.columns).select(c => c.hasEditorPortal()).first();
|
|
3633
3504
|
this.firstVisibleColumn$ = chain(this._columnList).first();
|
|
3634
3505
|
this.lastVisibleColumn$ = chain(this._columnList).last();
|
|
@@ -3652,15 +3523,18 @@ class AbstractTableModel extends GarbageCollector {
|
|
|
3652
3523
|
});
|
|
3653
3524
|
this.columns.value.forEach(c => c.initialise(customInjector));
|
|
3654
3525
|
}
|
|
3526
|
+
get visibleRows$() {
|
|
3527
|
+
return this._visibleRows$.readonly;
|
|
3528
|
+
}
|
|
3655
3529
|
setDataSource(sourceOfTruth) {
|
|
3656
|
-
this.
|
|
3530
|
+
this._rawDataSource.setDelegate(sourceOfTruth);
|
|
3657
3531
|
}
|
|
3658
3532
|
setTextSearch(searchText$, throttleDelayMilliseconds = 100) {
|
|
3659
3533
|
const { chain } = Dsl.disposeWith(this);
|
|
3660
3534
|
this._searchText$.setDelegate(chain(searchText$).throttle(throttleDelayMilliseconds));
|
|
3661
3535
|
}
|
|
3662
3536
|
identityOf(row) {
|
|
3663
|
-
return this.
|
|
3537
|
+
return this._rawDataSource.identityOf(row);
|
|
3664
3538
|
}
|
|
3665
3539
|
get rowsBeingEdited$() {
|
|
3666
3540
|
return this._rowsBeingEdited$.readonly;
|
|
@@ -3753,53 +3627,382 @@ class AbstractTableModel extends GarbageCollector {
|
|
|
3753
3627
|
this._rowsBeingEdited$.remove(editSession.liveRowValue$.value);
|
|
3754
3628
|
this._editorSessions.remove(editSession);
|
|
3755
3629
|
});
|
|
3756
|
-
return editSession;
|
|
3630
|
+
return editSession;
|
|
3631
|
+
}
|
|
3632
|
+
getEditSessionFor(row) {
|
|
3633
|
+
return this._editorSessionByRowId.get(this.identityOf(row));
|
|
3634
|
+
}
|
|
3635
|
+
cancelAllEditorSessions() {
|
|
3636
|
+
this._editorSessions.runInTransaction((draft) => {
|
|
3637
|
+
this._rowsBeingEdited$.runInTransaction(() => {
|
|
3638
|
+
draft.value.forEach(session => session.dispose());
|
|
3639
|
+
});
|
|
3640
|
+
});
|
|
3641
|
+
}
|
|
3642
|
+
isRowSelectionEnabledFor(column) {
|
|
3643
|
+
return this.isRowSelectionEnabled() && column.isRowSelectionEnabled();
|
|
3644
|
+
}
|
|
3645
|
+
isRowSelectionEnabled() {
|
|
3646
|
+
return this.hasUserSelectionModel() && !this.rowSelectionDisabledOnAllColumns$.value;
|
|
3647
|
+
}
|
|
3648
|
+
hasUserSelectionModel() {
|
|
3649
|
+
var _a;
|
|
3650
|
+
return !!((_a = this.selectionColumnModel) === null || _a === void 0 ? void 0 : _a.selectionModel.getDelegate());
|
|
3651
|
+
}
|
|
3652
|
+
getSelectionModel() {
|
|
3653
|
+
var _a;
|
|
3654
|
+
return (_a = this.selectionColumnModel) === null || _a === void 0 ? void 0 : _a.selectionModel;
|
|
3655
|
+
}
|
|
3656
|
+
isHoverEnabled() {
|
|
3657
|
+
return this.isRowSelectionEnabled() || this.rowClickListeners.listenerCount > 0;
|
|
3658
|
+
}
|
|
3659
|
+
isCursorEnabled(column) {
|
|
3660
|
+
return this.isRowSelectionEnabledFor(column) || this.rowClickListeners.listenerCount > 0;
|
|
3661
|
+
}
|
|
3662
|
+
selectRow(row) {
|
|
3663
|
+
var _a;
|
|
3664
|
+
(_a = this.selectionColumnModel) === null || _a === void 0 ? void 0 : _a.selectRow(row);
|
|
3665
|
+
}
|
|
3666
|
+
onRowClicked(callback) {
|
|
3667
|
+
return this.rowClickListeners.add(callback);
|
|
3668
|
+
}
|
|
3669
|
+
_notifyCellClicked(columnModel, row) {
|
|
3670
|
+
if (this.isRowSelectionEnabledFor(columnModel)) {
|
|
3671
|
+
this.selectRow(row);
|
|
3672
|
+
}
|
|
3673
|
+
this.rowClickListeners.fire(l => l(row));
|
|
3674
|
+
}
|
|
3675
|
+
}
|
|
3676
|
+
TrackExternal.oneTimeBinding(AbstractTableModel);
|
|
3677
|
+
|
|
3678
|
+
/**
|
|
3679
|
+
* Example:
|
|
3680
|
+
* @example
|
|
3681
|
+
* const model = new TableModel(heroList, table => {
|
|
3682
|
+
* table.pluck("firstName");
|
|
3683
|
+
* table.pluck("lastName");
|
|
3684
|
+
* table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
|
|
3685
|
+
* });
|
|
3686
|
+
*
|
|
3687
|
+
* Editable tables
|
|
3688
|
+
* @example
|
|
3689
|
+
* const saveCommand = UnaryCommand.create((form: Form<Hero>) => {
|
|
3690
|
+
* if (form.validate()) {
|
|
3691
|
+
* // normal form save stuff
|
|
3692
|
+
* return true; // finish editing
|
|
3693
|
+
* }
|
|
3694
|
+
* return false; // continue editiing
|
|
3695
|
+
* }
|
|
3696
|
+
* const colorsNames: ListModel<string> = ...;
|
|
3697
|
+
* const model = TableModel.fromList(heroList, table => {
|
|
3698
|
+
* table.pluck("firstName").cellEditor(StringInputComponent); <-- interface CellEditor { valueModel: DirtyTrackingForm.ValueModel<string> | ValueModel<string>; }
|
|
3699
|
+
* table.pluck("lastName").cellEditor(StringInputComponent, {
|
|
3700
|
+
* validators: [Validator.present("We need a last name")]
|
|
3701
|
+
* });
|
|
3702
|
+
* table.pluck("age").cellEditor(NumberInputComponent);
|
|
3703
|
+
* table.pluck("favoriteColor").cellEditor(SelectInputComponent, {
|
|
3704
|
+
* initialiseComponent(component: SelectInputComponent) {
|
|
3705
|
+
* selectInput.optionsModel = colorsNames; // <- initialise our component
|
|
3706
|
+
* }
|
|
3707
|
+
* });
|
|
3708
|
+
* table.addEditControls(saveCommand); // <- required to enable editing
|
|
3709
|
+
* });
|
|
3710
|
+
*
|
|
3711
|
+
* Selection models
|
|
3712
|
+
* @example
|
|
3713
|
+
* const model = new TableModel(heroList, table => {
|
|
3714
|
+
* table.addSelectionColumn(selectionModel); // <- can be single or multiple selection model
|
|
3715
|
+
* table.pluck("firstName");
|
|
3716
|
+
* table.pluck("lastName");
|
|
3717
|
+
* });
|
|
3718
|
+
*
|
|
3719
|
+
* Custom cell renderers and editors
|
|
3720
|
+
* @example
|
|
3721
|
+
* const model = new TableModel(heroList, table => {
|
|
3722
|
+
* table.pluck("favoriteColor")
|
|
3723
|
+
* .cellHeaderRenderer(CellHeaderRendererComponent, (component, column) => {
|
|
3724
|
+
* // configure your component with what ever you need.
|
|
3725
|
+
* });
|
|
3726
|
+
* .cellRenderer(CellRendererComponent) // <-- interface CellEditor { value: string; }
|
|
3727
|
+
* .cellEditor(CellEditorComponent.); // <-- interface CellEditor { valueModel: DirtyTrackingForm.ValueModel<string> | ValueModel<string>; }
|
|
3728
|
+
* table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
|
|
3729
|
+
* });
|
|
3730
|
+
*
|
|
3731
|
+
* Template columns
|
|
3732
|
+
* @example
|
|
3733
|
+
* const model = new TableModel(heroList, table => {
|
|
3734
|
+
* table.addSelectionColumn(selectionModel); // <- can be single or multiple selection model
|
|
3735
|
+
* table.addTemplateColumn("myTemplate");
|
|
3736
|
+
* });
|
|
3737
|
+
*
|
|
3738
|
+
* <div *aupColumnTemplate="let hero; columnId: 'myTemplate'">{{hero.age}}</div>
|
|
3739
|
+
*
|
|
3740
|
+
* I18n
|
|
3741
|
+
* @example
|
|
3742
|
+
* [table.yml]
|
|
3743
|
+
* table:
|
|
3744
|
+
* columns(ColumnTextProperties[]):
|
|
3745
|
+
* firstName:
|
|
3746
|
+
* headerText: "First Name"
|
|
3747
|
+
* fullName:
|
|
3748
|
+
* headerText: "Full Name"
|
|
3749
|
+
*
|
|
3750
|
+
* const model = new TableModel(heroList, table => {
|
|
3751
|
+
* table.pluck("favoriteColor").cellRenderer(...).cellEditor(...);
|
|
3752
|
+
* table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
|
|
3753
|
+
*
|
|
3754
|
+
* table.columnTextProperties(I18n.table.columns); // <- configures all columns
|
|
3755
|
+
* });
|
|
3756
|
+
*/
|
|
3757
|
+
class TableModel extends AbstractTableModel {
|
|
3758
|
+
constructor(sourceOfTruth, builder) {
|
|
3759
|
+
super();
|
|
3760
|
+
this._pageSize = new MutableValueModel();
|
|
3761
|
+
if (builder) {
|
|
3762
|
+
builder(this);
|
|
3763
|
+
}
|
|
3764
|
+
this.setDataSource(sourceOfTruth);
|
|
3765
|
+
const txo = new TransactionObserver({ verbose: true }).onEvent(e => console.log(e.name, e.payload));
|
|
3766
|
+
txo.observe("this.visibleRows$", this.visibleRows$);
|
|
3767
|
+
}
|
|
3768
|
+
get pageController() {
|
|
3769
|
+
return this._pageController;
|
|
3770
|
+
}
|
|
3771
|
+
enablePaging() {
|
|
3772
|
+
if (isNil$1(this.pageController)) {
|
|
3773
|
+
const pagedListModel = this.registerDisposable(PagedListModel.wrap(this._visibleRows$.getDelegate()));
|
|
3774
|
+
this._visibleRows$.setDelegate(pagedListModel);
|
|
3775
|
+
this._pageController = pagedListModel.pageController;
|
|
3776
|
+
this._pageController.setPageSize(this._pageSize);
|
|
3777
|
+
}
|
|
3778
|
+
}
|
|
3779
|
+
addSelectionColumn(selectionModel, showSelectionColumn) {
|
|
3780
|
+
return this._addSelectionColumn(selectionModel, showSelectionColumn);
|
|
3781
|
+
}
|
|
3782
|
+
updatePageSize(count) {
|
|
3783
|
+
this._pageSize.value = count;
|
|
3784
|
+
}
|
|
3785
|
+
}
|
|
3786
|
+
|
|
3787
|
+
class Dimension {
|
|
3788
|
+
constructor(width, height) {
|
|
3789
|
+
this.width = width;
|
|
3790
|
+
this.height = height;
|
|
3791
|
+
}
|
|
3792
|
+
}
|
|
3793
|
+
|
|
3794
|
+
class Point {
|
|
3795
|
+
constructor(x, y) {
|
|
3796
|
+
this.x = x;
|
|
3797
|
+
this.y = y;
|
|
3798
|
+
}
|
|
3799
|
+
static from(data) {
|
|
3800
|
+
return new Point(data.x, data.y);
|
|
3801
|
+
}
|
|
3802
|
+
translate(x, y) {
|
|
3803
|
+
return new Point(this.x + x, this.y + y);
|
|
3804
|
+
}
|
|
3805
|
+
}
|
|
3806
|
+
|
|
3807
|
+
class Bounds extends Dimension {
|
|
3808
|
+
constructor(top, left, width, height) {
|
|
3809
|
+
super(width, height);
|
|
3810
|
+
this.top = top;
|
|
3811
|
+
this.left = left;
|
|
3812
|
+
this.width = width;
|
|
3813
|
+
this.height = height;
|
|
3814
|
+
}
|
|
3815
|
+
relativePositionOf(point) {
|
|
3816
|
+
if (point instanceof MouseEvent) {
|
|
3817
|
+
return new Point(point.clientX - this.left, point.clientY - this.top);
|
|
3818
|
+
}
|
|
3819
|
+
else {
|
|
3820
|
+
return new Point(point.x - this.left, point.y - this.top);
|
|
3821
|
+
}
|
|
3822
|
+
}
|
|
3823
|
+
}
|
|
3824
|
+
(function (Bounds) {
|
|
3825
|
+
function ofElement(element) {
|
|
3826
|
+
const rect = element.getBoundingClientRect();
|
|
3827
|
+
return new Bounds(rect.top, rect.left, rect.width, rect.height);
|
|
3828
|
+
}
|
|
3829
|
+
Bounds.ofElement = ofElement;
|
|
3830
|
+
})(Bounds || (Bounds = {}));
|
|
3831
|
+
|
|
3832
|
+
class ResizeAwareComponent extends DisposableComponent {
|
|
3833
|
+
constructor(elementRef, ngZone) {
|
|
3834
|
+
super();
|
|
3835
|
+
this.elementRef = elementRef;
|
|
3836
|
+
this.ngZone = ngZone;
|
|
3837
|
+
this._boundsModel = new MutableValueModel(new Bounds(0, 0, 0, 0));
|
|
3838
|
+
}
|
|
3839
|
+
ngAfterViewInit() {
|
|
3840
|
+
const element = this.elementRef.nativeElement;
|
|
3841
|
+
const ro = new ResizeObserver((entries, observer) => {
|
|
3842
|
+
this.ngZone.run(() => this._updateBounds());
|
|
3843
|
+
});
|
|
3844
|
+
ro.observe(element);
|
|
3845
|
+
this.onDispose(() => ro.disconnect());
|
|
3846
|
+
setTimeout(() => this._updateBounds());
|
|
3847
|
+
}
|
|
3848
|
+
get boundsModel() {
|
|
3849
|
+
return this._boundsModel.readonly;
|
|
3850
|
+
}
|
|
3851
|
+
get nativeElement() {
|
|
3852
|
+
return this.elementRef.nativeElement;
|
|
3853
|
+
}
|
|
3854
|
+
// TODO: Make this handle body scroll
|
|
3855
|
+
relativePositionOf(point) {
|
|
3856
|
+
return this.bounds.relativePositionOf(point);
|
|
3857
|
+
}
|
|
3858
|
+
get bounds() {
|
|
3859
|
+
return this._boundsModel.value;
|
|
3860
|
+
}
|
|
3861
|
+
_updateBounds() {
|
|
3862
|
+
this._boundsModel.value = Bounds.ofElement(this.nativeElement);
|
|
3863
|
+
}
|
|
3864
|
+
}
|
|
3865
|
+
ResizeAwareComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: ResizeAwareComponent, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
|
|
3866
|
+
ResizeAwareComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.3", type: ResizeAwareComponent, usesInheritance: true, ngImport: i0 });
|
|
3867
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: ResizeAwareComponent, decorators: [{
|
|
3868
|
+
type: Directive
|
|
3869
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }]; } });
|
|
3870
|
+
|
|
3871
|
+
class TableBodyComponent extends ResizeAwareComponent {
|
|
3872
|
+
constructor(elementRef, ngZone) {
|
|
3873
|
+
super(elementRef, ngZone);
|
|
3874
|
+
this.visibleRowCount = new EventEmitter();
|
|
3875
|
+
/**
|
|
3876
|
+
* Set to true to enable scrolling. Once enabled the table will have 0 implicit height. You will either
|
|
3877
|
+
* need to set it explicitly e.g. height: 400px; or by using flex or grid layout to make it fill it's
|
|
3878
|
+
* containment area.
|
|
3879
|
+
*/
|
|
3880
|
+
this.enableScrolling = false;
|
|
3881
|
+
// TODO: support user defined header and row heights via css vars.
|
|
3882
|
+
this.headerHeight = new MutableValueModel(56);
|
|
3883
|
+
this.rowHeight = new MutableValueModel(48);
|
|
3884
|
+
this.baseCssClass = "aup-table-component";
|
|
3885
|
+
const { chain, when } = Dsl.disposeWith(this);
|
|
3886
|
+
const actualHeaderHeight = chain(this.showHeader$).map(show => {
|
|
3887
|
+
return show ? this.headerHeight.value : 0;
|
|
3888
|
+
}, { dependsOn: this.headerHeight });
|
|
3889
|
+
this._visibleRowCount = chain(this.boundsModel).map(bounds => {
|
|
3890
|
+
// TODO: this doesn't take into account any css styling adjustments etc. Will investigate if it's an issue.
|
|
3891
|
+
const rawRowCount = (bounds.height - actualHeaderHeight.value) / this.rowHeight.value;
|
|
3892
|
+
return rawRowCount < 1 ? 0 : Math.floor(rawRowCount);
|
|
3893
|
+
}, {
|
|
3894
|
+
dependsOn: [actualHeaderHeight, this.rowHeight],
|
|
3895
|
+
postponeWhile: chain(this.boundsModel).pluckNumeric("height").isLessThan(1)
|
|
3896
|
+
});
|
|
3897
|
+
when(this._visibleRowCount).changes(visibleRows => {
|
|
3898
|
+
this.visibleRowCount.emit(visibleRows);
|
|
3899
|
+
}, { initialValue: "triggerChangeUnlessNil" });
|
|
3757
3900
|
}
|
|
3758
|
-
|
|
3759
|
-
return this.
|
|
3901
|
+
get hideHeader() {
|
|
3902
|
+
return !this.showHeader;
|
|
3760
3903
|
}
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
});
|
|
3904
|
+
ngOnInit() {
|
|
3905
|
+
const { chain } = Dsl.disposeWith(this);
|
|
3906
|
+
this.columns = chain(this.tableModel.columns);
|
|
3907
|
+
this.columnIds = chain(this.columns).pluck("columnId");
|
|
3908
|
+
this.columnsById = chain(this.columns).indexBy('columnId');
|
|
3767
3909
|
}
|
|
3768
|
-
|
|
3769
|
-
return this.
|
|
3910
|
+
isEditing(row) {
|
|
3911
|
+
return !!this.tableModel.getEditSessionFor(row);
|
|
3770
3912
|
}
|
|
3771
|
-
|
|
3772
|
-
|
|
3913
|
+
notifyCellClicked(columnModel, row) {
|
|
3914
|
+
this.tableModel._notifyCellClicked(columnModel, row);
|
|
3773
3915
|
}
|
|
3774
|
-
|
|
3916
|
+
// @Trace()
|
|
3917
|
+
isFirstVisibleColumn(columnId) {
|
|
3775
3918
|
var _a;
|
|
3776
|
-
return
|
|
3919
|
+
return ((_a = this.tableModel.firstVisibleColumn$.query().value) === null || _a === void 0 ? void 0 : _a.columnId) === columnId;
|
|
3777
3920
|
}
|
|
3778
|
-
|
|
3921
|
+
// @Trace()
|
|
3922
|
+
isLastVisibleColumn(columnId) {
|
|
3779
3923
|
var _a;
|
|
3780
|
-
return (_a = this.
|
|
3924
|
+
return ((_a = this.tableModel.lastVisibleColumn$.query().value) === null || _a === void 0 ? void 0 : _a.columnId) === columnId;
|
|
3781
3925
|
}
|
|
3782
|
-
|
|
3783
|
-
|
|
3926
|
+
getColumnClasses(columnId) {
|
|
3927
|
+
const classes = [`aup-col-${this.columnsById.get(columnId).dasherisedColumnId}`];
|
|
3928
|
+
if (this.isFirstVisibleColumn(columnId)) {
|
|
3929
|
+
classes.push("first-visible-column");
|
|
3930
|
+
}
|
|
3931
|
+
if (this.isLastVisibleColumn(columnId)) {
|
|
3932
|
+
classes.push("last-visible-column");
|
|
3933
|
+
}
|
|
3934
|
+
return classes;
|
|
3784
3935
|
}
|
|
3785
|
-
|
|
3786
|
-
|
|
3936
|
+
}
|
|
3937
|
+
TableBodyComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: TableBodyComponent, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
|
|
3938
|
+
TableBodyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.3", type: TableBodyComponent, selector: "aup-table-body", inputs: { tableModel: "tableModel", showHeader$: "showHeader$", showHeader: "showHeader", 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]=\"tableModel.visibleRows$.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 [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\"></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.aup-row-id]=\"tableModel.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"], components: [{ type: i1$b.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { type: TableHeaderCellComponent, selector: "aup-table-header-cell", inputs: ["column"] }, { type: TableCellComponent, selector: "aup-table-cell", inputs: ["row", "column", "editSession", "tableModel"] }, { type: i1$b.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { type: i1$b.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }], directives: [{ type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1$b.MatColumnDef, selector: "[matColumnDef]", inputs: ["sticky", "matColumnDef"] }, { type: i1$b.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { type: i1$b.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { type: i1$b.MatCellDef, selector: "[matCellDef]" }, { type: i1$b.MatCell, selector: "mat-cell, td[mat-cell]" }, { type: i1$b.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { type: i1$b.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
3939
|
+
__decorate([
|
|
3940
|
+
TrackExternal(),
|
|
3941
|
+
__metadata("design:type", AbstractTableModel)
|
|
3942
|
+
], TableBodyComponent.prototype, "tableModel", void 0);
|
|
3943
|
+
__decorate([
|
|
3944
|
+
TrackExternal({ defaultValue: true }),
|
|
3945
|
+
__metadata("design:type", ValueModel)
|
|
3946
|
+
], TableBodyComponent.prototype, "showHeader$", void 0);
|
|
3947
|
+
__decorate([
|
|
3948
|
+
StoreInValueModel("showHeader$"),
|
|
3949
|
+
__metadata("design:type", Boolean)
|
|
3950
|
+
], TableBodyComponent.prototype, "showHeader", void 0);
|
|
3951
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: TableBodyComponent, decorators: [{
|
|
3952
|
+
type: Component,
|
|
3953
|
+
args: [{ selector: "aup-table-body", template: "<div class=\"scroll-container\">\n <table mat-table [dataSource]=\"tableModel.visibleRows$.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 [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\"></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.aup-row-id]=\"tableModel.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"] }]
|
|
3954
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { tableModel: [{
|
|
3955
|
+
type: Input
|
|
3956
|
+
}], showHeader$: [{
|
|
3957
|
+
type: Input
|
|
3958
|
+
}], showHeader: [{
|
|
3959
|
+
type: Input
|
|
3960
|
+
}], visibleRowCount: [{
|
|
3961
|
+
type: Output
|
|
3962
|
+
}], enableScrolling: [{
|
|
3963
|
+
type: Input
|
|
3964
|
+
}, {
|
|
3965
|
+
type: HostBinding,
|
|
3966
|
+
args: ["class.enable-scrolling"]
|
|
3967
|
+
}], baseCssClass: [{
|
|
3968
|
+
type: HostBinding,
|
|
3969
|
+
args: ["class"]
|
|
3970
|
+
}], hideHeader: [{
|
|
3971
|
+
type: HostBinding,
|
|
3972
|
+
args: ["class.hide-header"]
|
|
3973
|
+
}] } });
|
|
3974
|
+
|
|
3975
|
+
class PaginatorComponent extends DisposableComponent {
|
|
3976
|
+
constructor() {
|
|
3977
|
+
super();
|
|
3787
3978
|
}
|
|
3788
|
-
|
|
3789
|
-
var _a;
|
|
3790
|
-
(_a = this.selectionColumnModel) === null || _a === void 0 ? void 0 : _a.selectRow(row);
|
|
3979
|
+
ngOnInit() {
|
|
3791
3980
|
}
|
|
3792
|
-
|
|
3793
|
-
return this.
|
|
3981
|
+
get totalPages() {
|
|
3982
|
+
return this.pageController.totalPages.value;
|
|
3794
3983
|
}
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
this.
|
|
3984
|
+
get pageNumber() {
|
|
3985
|
+
return this.pageController.pageNumber.value;
|
|
3986
|
+
}
|
|
3987
|
+
get previousCommand() {
|
|
3988
|
+
return this.pageController.previousCommand;
|
|
3989
|
+
}
|
|
3990
|
+
get nextCommand() {
|
|
3991
|
+
return this.pageController.nextCommand;
|
|
3800
3992
|
}
|
|
3801
3993
|
}
|
|
3802
|
-
|
|
3994
|
+
PaginatorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: PaginatorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3995
|
+
PaginatorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.3", type: PaginatorComponent, selector: "aup-paginator", inputs: { pageController: "pageController" }, usesInheritance: true, ngImport: i0, template: "<p>Page {{pageNumber}} of {{totalPages}}</p>\n<button mat-icon-button [pectinCommand]=\"previousCommand\"><aup-icon icon=\"mat:keyboard_arrow_left\"></aup-icon></button>\n<button mat-icon-button [pectinCommand]=\"nextCommand\"><aup-icon icon=\"mat:keyboard_arrow_right\"></aup-icon></button>\n\n", styles: [":host{display:flex;flex-direction:row;justify-content:flex-end;align-items:center;font-size:12px;padding:0 8px;color:#0009}:host p{color:inherit;margin:0 8px 0 0}:host button.md-button.md-icon-button{padding:0;margin:0;width:30px;height:30px}\n"], components: [{ type: i1.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: IconComponent, selector: "aup-icon", inputs: ["icon"] }], directives: [{ type: CommandDirective, selector: "[pectinCommand]", inputs: ["pectinCommand", "commandParameter"] }] });
|
|
3996
|
+
__decorate([
|
|
3997
|
+
TrackExternal(),
|
|
3998
|
+
__metadata("design:type", PageController)
|
|
3999
|
+
], PaginatorComponent.prototype, "pageController", void 0);
|
|
4000
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: PaginatorComponent, decorators: [{
|
|
4001
|
+
type: Component,
|
|
4002
|
+
args: [{ selector: 'aup-paginator', template: "<p>Page {{pageNumber}} of {{totalPages}}</p>\n<button mat-icon-button [pectinCommand]=\"previousCommand\"><aup-icon icon=\"mat:keyboard_arrow_left\"></aup-icon></button>\n<button mat-icon-button [pectinCommand]=\"nextCommand\"><aup-icon icon=\"mat:keyboard_arrow_right\"></aup-icon></button>\n\n", styles: [":host{display:flex;flex-direction:row;justify-content:flex-end;align-items:center;font-size:12px;padding:0 8px;color:#0009}:host p{color:inherit;margin:0 8px 0 0}:host button.md-button.md-icon-button{padding:0;margin:0;width:30px;height:30px}\n"] }]
|
|
4003
|
+
}], ctorParameters: function () { return []; }, propDecorators: { pageController: [{
|
|
4004
|
+
type: Input
|
|
4005
|
+
}] } });
|
|
3803
4006
|
|
|
3804
4007
|
/**
|
|
3805
4008
|
* Create your model:
|
|
@@ -3862,29 +4065,43 @@ TrackExternal.oneTimeBinding(AbstractTableModel);
|
|
|
3862
4065
|
* }
|
|
3863
4066
|
*/
|
|
3864
4067
|
class TableComponent extends AbstractTableComponent {
|
|
3865
|
-
constructor(
|
|
3866
|
-
super(
|
|
4068
|
+
constructor() {
|
|
4069
|
+
super(...arguments);
|
|
4070
|
+
this._footerContentAdded = false;
|
|
3867
4071
|
}
|
|
3868
4072
|
getModel() {
|
|
3869
4073
|
return this.tableModel;
|
|
3870
4074
|
}
|
|
4075
|
+
footerContentChanged($event) {
|
|
4076
|
+
console.log($event);
|
|
4077
|
+
this._footerContentAdded = true;
|
|
4078
|
+
}
|
|
4079
|
+
updatePageSize(count) {
|
|
4080
|
+
this.tableModel.updatePageSize(count);
|
|
4081
|
+
}
|
|
3871
4082
|
}
|
|
3872
|
-
TableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: TableComponent, deps:
|
|
4083
|
+
TableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: TableComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
3873
4084
|
TableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.3", type: TableComponent, selector: "aup-table", inputs: { tableModel: "tableModel" }, providers: [
|
|
3874
4085
|
{ provide: AbstractTableComponent, useExisting: TableComponent }
|
|
3875
|
-
], usesInheritance: true, ngImport: i0, template: "<
|
|
4086
|
+
], usesInheritance: true, ngImport: i0, template: "<aup-table-body [tableModel]=\"tableModel\"\n [showHeader$]=\"showHeader$\"\n [enableScrolling]=\"enableScrolling\"\n (visibleRowCount)=\"updatePageSize($event)\"\n></aup-table-body>\n<section class=\"table-footer\">\n <div class=\"footer-content\"><ng-content select=\"[footer]\"></ng-content></div>\n <aup-paginator *ngIf=\"tableModel.pageController\" [pageController]=\"tableModel.pageController\"></aup-paginator>\n</section>\n", styles: [":host{display:flex;flex-direction:column;align-items:stretch}aup-table-body{flex:1}.table-footer{display:flex;flex-direction:row;align-items:center}.table-footer .footer-content{flex:1}\n"], components: [{ type: TableBodyComponent, selector: "aup-table-body", inputs: ["tableModel", "showHeader$", "showHeader", "enableScrolling"], outputs: ["visibleRowCount"] }, { type: PaginatorComponent, selector: "aup-paginator", inputs: ["pageController"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
3876
4087
|
__decorate([
|
|
3877
4088
|
TrackExternal(),
|
|
3878
|
-
__metadata("design:type",
|
|
4089
|
+
__metadata("design:type", TableModel)
|
|
3879
4090
|
], TableComponent.prototype, "tableModel", void 0);
|
|
4091
|
+
__decorate([
|
|
4092
|
+
Trace(),
|
|
4093
|
+
__metadata("design:type", Function),
|
|
4094
|
+
__metadata("design:paramtypes", [Number]),
|
|
4095
|
+
__metadata("design:returntype", void 0)
|
|
4096
|
+
], TableComponent.prototype, "updatePageSize", null);
|
|
3880
4097
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: TableComponent, decorators: [{
|
|
3881
4098
|
type: Component,
|
|
3882
4099
|
args: [{ selector: 'aup-table', providers: [
|
|
3883
4100
|
{ provide: AbstractTableComponent, useExisting: TableComponent }
|
|
3884
|
-
], template: "<
|
|
3885
|
-
}],
|
|
4101
|
+
], template: "<aup-table-body [tableModel]=\"tableModel\"\n [showHeader$]=\"showHeader$\"\n [enableScrolling]=\"enableScrolling\"\n (visibleRowCount)=\"updatePageSize($event)\"\n></aup-table-body>\n<section class=\"table-footer\">\n <div class=\"footer-content\"><ng-content select=\"[footer]\"></ng-content></div>\n <aup-paginator *ngIf=\"tableModel.pageController\" [pageController]=\"tableModel.pageController\"></aup-paginator>\n</section>\n", styles: [":host{display:flex;flex-direction:column;align-items:stretch}aup-table-body{flex:1}.table-footer{display:flex;flex-direction:row;align-items:center}.table-footer .footer-content{flex:1}\n"] }]
|
|
4102
|
+
}], propDecorators: { tableModel: [{
|
|
3886
4103
|
type: Input
|
|
3887
|
-
}] } });
|
|
4104
|
+
}], updatePageSize: [] } });
|
|
3888
4105
|
|
|
3889
4106
|
const SVG_HEIGHT = 60;
|
|
3890
4107
|
class TreeInheritanceIconComponent {
|
|
@@ -4462,17 +4679,17 @@ class TreeTableModel extends AbstractTableModel {
|
|
|
4462
4679
|
* }
|
|
4463
4680
|
*/
|
|
4464
4681
|
class TreeTableComponent extends AbstractTableComponent {
|
|
4465
|
-
constructor(
|
|
4466
|
-
super(
|
|
4682
|
+
constructor(injector) {
|
|
4683
|
+
super(injector);
|
|
4467
4684
|
}
|
|
4468
4685
|
getModel() {
|
|
4469
4686
|
return this.treeTableModel;
|
|
4470
4687
|
}
|
|
4471
4688
|
}
|
|
4472
|
-
TreeTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: TreeTableComponent, deps: [{ token: i0.
|
|
4689
|
+
TreeTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: TreeTableComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
|
|
4473
4690
|
TreeTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.3", type: TreeTableComponent, selector: "aup-tree-table", inputs: { treeTableModel: "treeTableModel" }, providers: [
|
|
4474
4691
|
{ provide: AbstractTableComponent, useExisting: TreeTableComponent }
|
|
4475
|
-
], usesInheritance: true, ngImport: i0, template: "<
|
|
4692
|
+
], usesInheritance: true, ngImport: i0, template: "<aup-table-body [tableModel]=\"treeTableModel\"\n [showHeader$]=\"showHeader$\"\n [enableScrolling]=\"enableScrolling\"\n></aup-table-body>\n", styles: [":host{display:flex;flex-direction:column;align-items:stretch}:host::ng-deep td.mat-cell{border-top-width:0!important;border-bottom-width:0!important}:host::ng-deep td.mat-column-tree-label,:host::ng-deep td.mat-column-tree-label{width:1px}:host::ng-deep aup-table-cell-renderer[column-id=tree-label]{padding-left:8px!important}:host::ng-deep aup-tree-label-cell-renderer{flex:1}\n"], components: [{ type: TableBodyComponent, selector: "aup-table-body", inputs: ["tableModel", "showHeader$", "showHeader", "enableScrolling"], outputs: ["visibleRowCount"] }] });
|
|
4476
4693
|
__decorate([
|
|
4477
4694
|
TrackExternal(),
|
|
4478
4695
|
__metadata("design:type", TreeTableModel)
|
|
@@ -4481,8 +4698,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImpor
|
|
|
4481
4698
|
type: Component,
|
|
4482
4699
|
args: [{ selector: 'aup-tree-table', providers: [
|
|
4483
4700
|
{ provide: AbstractTableComponent, useExisting: TreeTableComponent }
|
|
4484
|
-
], template: "<
|
|
4485
|
-
}], ctorParameters: function () { return [{ type: i0.
|
|
4701
|
+
], template: "<aup-table-body [tableModel]=\"treeTableModel\"\n [showHeader$]=\"showHeader$\"\n [enableScrolling]=\"enableScrolling\"\n></aup-table-body>\n", styles: [":host{display:flex;flex-direction:column;align-items:stretch}:host::ng-deep td.mat-cell{border-top-width:0!important;border-bottom-width:0!important}:host::ng-deep td.mat-column-tree-label,:host::ng-deep td.mat-column-tree-label{width:1px}:host::ng-deep aup-table-cell-renderer[column-id=tree-label]{padding-left:8px!important}:host::ng-deep aup-tree-label-cell-renderer{flex:1}\n"] }]
|
|
4702
|
+
}], ctorParameters: function () { return [{ type: i0.Injector }]; }, propDecorators: { treeTableModel: [{
|
|
4486
4703
|
type: Input
|
|
4487
4704
|
}] } });
|
|
4488
4705
|
|
|
@@ -4559,38 +4776,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImpor
|
|
|
4559
4776
|
args: ['keyup.arrowUp', ['$event']]
|
|
4560
4777
|
}] } });
|
|
4561
4778
|
|
|
4562
|
-
class PaginatorComponent extends DisposableComponent {
|
|
4563
|
-
constructor() {
|
|
4564
|
-
super();
|
|
4565
|
-
}
|
|
4566
|
-
ngOnInit() {
|
|
4567
|
-
}
|
|
4568
|
-
get totalPages() {
|
|
4569
|
-
return this.pageController.totalPages.value;
|
|
4570
|
-
}
|
|
4571
|
-
get pageNumber() {
|
|
4572
|
-
return this.pageController.pageNumber.value;
|
|
4573
|
-
}
|
|
4574
|
-
get previousCommand() {
|
|
4575
|
-
return this.pageController.previousCommand;
|
|
4576
|
-
}
|
|
4577
|
-
get nextCommand() {
|
|
4578
|
-
return this.pageController.nextCommand;
|
|
4579
|
-
}
|
|
4580
|
-
}
|
|
4581
|
-
PaginatorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: PaginatorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4582
|
-
PaginatorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.3", type: PaginatorComponent, selector: "aup-paginator", inputs: { pageController: "pageController" }, usesInheritance: true, ngImport: i0, template: "<p>Page {{pageNumber}} of {{totalPages}}</p>\n<button mat-icon-button [pectinCommand]=\"previousCommand\"><aup-icon icon=\"mat:keyboard_arrow_left\"></aup-icon></button>\n<button mat-icon-button [pectinCommand]=\"nextCommand\"><aup-icon icon=\"mat:keyboard_arrow_right\"></aup-icon></button>\n\n", styles: [":host{display:flex;flex-direction:row;justify-content:flex-end;align-items:center;font-size:12px;padding:0 8px;color:#0009}:host p{color:inherit;margin-right:8px}:host button.md-button.md-icon-button{padding:0;margin:0;width:30px;height:30px}\n"], components: [{ type: i1.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: IconComponent, selector: "aup-icon", inputs: ["icon"] }], directives: [{ type: CommandDirective, selector: "[pectinCommand]", inputs: ["pectinCommand", "commandParameter"] }] });
|
|
4583
|
-
__decorate([
|
|
4584
|
-
TrackExternal(),
|
|
4585
|
-
__metadata("design:type", PageController)
|
|
4586
|
-
], PaginatorComponent.prototype, "pageController", void 0);
|
|
4587
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: PaginatorComponent, decorators: [{
|
|
4588
|
-
type: Component,
|
|
4589
|
-
args: [{ selector: 'aup-paginator', template: "<p>Page {{pageNumber}} of {{totalPages}}</p>\n<button mat-icon-button [pectinCommand]=\"previousCommand\"><aup-icon icon=\"mat:keyboard_arrow_left\"></aup-icon></button>\n<button mat-icon-button [pectinCommand]=\"nextCommand\"><aup-icon icon=\"mat:keyboard_arrow_right\"></aup-icon></button>\n\n", styles: [":host{display:flex;flex-direction:row;justify-content:flex-end;align-items:center;font-size:12px;padding:0 8px;color:#0009}:host p{color:inherit;margin-right:8px}:host button.md-button.md-icon-button{padding:0;margin:0;width:30px;height:30px}\n"] }]
|
|
4590
|
-
}], ctorParameters: function () { return []; }, propDecorators: { pageController: [{
|
|
4591
|
-
type: Input
|
|
4592
|
-
}] } });
|
|
4593
|
-
|
|
4594
4779
|
class LabelledValueComponent extends DisposableComponent {
|
|
4595
4780
|
constructor() {
|
|
4596
4781
|
super();
|
|
@@ -4738,7 +4923,8 @@ ComponentsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", versio
|
|
|
4738
4923
|
CardStackComponent,
|
|
4739
4924
|
LabelledValueComponent,
|
|
4740
4925
|
LoadingContainerComponent,
|
|
4741
|
-
MarkdownComponent
|
|
4926
|
+
MarkdownComponent,
|
|
4927
|
+
TableBodyComponent], imports: [CommonModule,
|
|
4742
4928
|
BrowserAnimationsModule,
|
|
4743
4929
|
FormsModule,
|
|
4744
4930
|
MatInputModule,
|
|
@@ -4901,7 +5087,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImpor
|
|
|
4901
5087
|
CardStackComponent,
|
|
4902
5088
|
LabelledValueComponent,
|
|
4903
5089
|
LoadingContainerComponent,
|
|
4904
|
-
MarkdownComponent
|
|
5090
|
+
MarkdownComponent,
|
|
5091
|
+
TableBodyComponent
|
|
4905
5092
|
],
|
|
4906
5093
|
exports: [
|
|
4907
5094
|
NumberInputComponent,
|
|
@@ -8237,98 +8424,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImpor
|
|
|
8237
8424
|
}]
|
|
8238
8425
|
}] });
|
|
8239
8426
|
|
|
8240
|
-
/**
|
|
8241
|
-
* Example:
|
|
8242
|
-
* @example
|
|
8243
|
-
* const model = new TableModel(heroList, table => {
|
|
8244
|
-
* table.pluck("firstName");
|
|
8245
|
-
* table.pluck("lastName");
|
|
8246
|
-
* table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
|
|
8247
|
-
* });
|
|
8248
|
-
*
|
|
8249
|
-
* Editable tables
|
|
8250
|
-
* @example
|
|
8251
|
-
* const saveCommand = UnaryCommand.create((form: Form<Hero>) => {
|
|
8252
|
-
* if (form.validate()) {
|
|
8253
|
-
* // normal form save stuff
|
|
8254
|
-
* return true; // finish editing
|
|
8255
|
-
* }
|
|
8256
|
-
* return false; // continue editiing
|
|
8257
|
-
* }
|
|
8258
|
-
* const colorsNames: ListModel<string> = ...;
|
|
8259
|
-
* const model = TableModel.fromList(heroList, table => {
|
|
8260
|
-
* table.pluck("firstName").cellEditor(StringInputComponent); <-- interface CellEditor { valueModel: DirtyTrackingForm.ValueModel<string> | ValueModel<string>; }
|
|
8261
|
-
* table.pluck("lastName").cellEditor(StringInputComponent, {
|
|
8262
|
-
* validators: [Validator.present("We need a last name")]
|
|
8263
|
-
* });
|
|
8264
|
-
* table.pluck("age").cellEditor(NumberInputComponent);
|
|
8265
|
-
* table.pluck("favoriteColor").cellEditor(SelectInputComponent, {
|
|
8266
|
-
* initialiseComponent(component: SelectInputComponent) {
|
|
8267
|
-
* selectInput.optionsModel = colorsNames; // <- initialise our component
|
|
8268
|
-
* }
|
|
8269
|
-
* });
|
|
8270
|
-
* table.addEditControls(saveCommand); // <- required to enable editing
|
|
8271
|
-
* });
|
|
8272
|
-
*
|
|
8273
|
-
* Selection models
|
|
8274
|
-
* @example
|
|
8275
|
-
* const model = new TableModel(heroList, table => {
|
|
8276
|
-
* table.addSelectionColumn(selectionModel); // <- can be single or multiple selection model
|
|
8277
|
-
* table.pluck("firstName");
|
|
8278
|
-
* table.pluck("lastName");
|
|
8279
|
-
* });
|
|
8280
|
-
*
|
|
8281
|
-
* Custom cell renderers and editors
|
|
8282
|
-
* @example
|
|
8283
|
-
* const model = new TableModel(heroList, table => {
|
|
8284
|
-
* table.pluck("favoriteColor")
|
|
8285
|
-
* .cellHeaderRenderer(CellHeaderRendererComponent, (component, column) => {
|
|
8286
|
-
* // configure your component with what ever you need.
|
|
8287
|
-
* });
|
|
8288
|
-
* .cellRenderer(CellRendererComponent) // <-- interface CellEditor { value: string; }
|
|
8289
|
-
* .cellEditor(CellEditorComponent.); // <-- interface CellEditor { valueModel: DirtyTrackingForm.ValueModel<string> | ValueModel<string>; }
|
|
8290
|
-
* table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
|
|
8291
|
-
* });
|
|
8292
|
-
*
|
|
8293
|
-
* Template columns
|
|
8294
|
-
* @example
|
|
8295
|
-
* const model = new TableModel(heroList, table => {
|
|
8296
|
-
* table.addSelectionColumn(selectionModel); // <- can be single or multiple selection model
|
|
8297
|
-
* table.addTemplateColumn("myTemplate");
|
|
8298
|
-
* });
|
|
8299
|
-
*
|
|
8300
|
-
* <div *aupColumnTemplate="let hero; columnId: 'myTemplate'">{{hero.age}}</div>
|
|
8301
|
-
*
|
|
8302
|
-
* I18n
|
|
8303
|
-
* @example
|
|
8304
|
-
* [table.yml]
|
|
8305
|
-
* table:
|
|
8306
|
-
* columns(ColumnTextProperties[]):
|
|
8307
|
-
* firstName:
|
|
8308
|
-
* headerText: "First Name"
|
|
8309
|
-
* fullName:
|
|
8310
|
-
* headerText: "Full Name"
|
|
8311
|
-
*
|
|
8312
|
-
* const model = new TableModel(heroList, table => {
|
|
8313
|
-
* table.pluck("favoriteColor").cellRenderer(...).cellEditor(...);
|
|
8314
|
-
* table.addCustomColumn("fullName", hero => `${hero.firstName} ${hero.lastName}`);
|
|
8315
|
-
*
|
|
8316
|
-
* table.columnTextProperties(I18n.table.columns); // <- configures all columns
|
|
8317
|
-
* });
|
|
8318
|
-
*/
|
|
8319
|
-
class TableModel extends AbstractTableModel {
|
|
8320
|
-
constructor(sourceOfTruth, builder) {
|
|
8321
|
-
super();
|
|
8322
|
-
if (builder) {
|
|
8323
|
-
builder(this);
|
|
8324
|
-
}
|
|
8325
|
-
this.setDataSource(sourceOfTruth);
|
|
8326
|
-
}
|
|
8327
|
-
addSelectionColumn(selectionModel, showSelectionColumn) {
|
|
8328
|
-
return this._addSelectionColumn(selectionModel, showSelectionColumn);
|
|
8329
|
-
}
|
|
8330
|
-
}
|
|
8331
|
-
|
|
8332
8427
|
/**
|
|
8333
8428
|
* @file Automatically generated by barrelsby.
|
|
8334
8429
|
*/
|
|
@@ -9751,7 +9846,8 @@ AngularUiPowerupsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0",
|
|
|
9751
9846
|
DirectivesModule,
|
|
9752
9847
|
ComponentsModule,
|
|
9753
9848
|
PlaceModule,
|
|
9754
|
-
InteractionModule
|
|
9849
|
+
InteractionModule,
|
|
9850
|
+
ObserversModule], exports: [InteractionModule,
|
|
9755
9851
|
PlaceModule,
|
|
9756
9852
|
DirectivesModule,
|
|
9757
9853
|
ComponentsModule,
|
|
@@ -9768,7 +9864,8 @@ AngularUiPowerupsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0",
|
|
|
9768
9864
|
DirectivesModule,
|
|
9769
9865
|
ComponentsModule,
|
|
9770
9866
|
PlaceModule,
|
|
9771
|
-
InteractionModule
|
|
9867
|
+
InteractionModule,
|
|
9868
|
+
ObserversModule
|
|
9772
9869
|
], InteractionModule,
|
|
9773
9870
|
PlaceModule,
|
|
9774
9871
|
DirectivesModule,
|
|
@@ -9788,7 +9885,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImpor
|
|
|
9788
9885
|
DirectivesModule,
|
|
9789
9886
|
ComponentsModule,
|
|
9790
9887
|
PlaceModule,
|
|
9791
|
-
InteractionModule
|
|
9888
|
+
InteractionModule,
|
|
9889
|
+
ObserversModule
|
|
9792
9890
|
],
|
|
9793
9891
|
exports: [
|
|
9794
9892
|
InteractionModule,
|
|
@@ -10284,5 +10382,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImpor
|
|
|
10284
10382
|
* Generated bundle index. Do not edit.
|
|
10285
10383
|
*/
|
|
10286
10384
|
|
|
10287
|
-
export { ACTIVITY_DATA, ALERT_CONFIG, AUP_PLACE_CONFIG, AUP_UNAUTHORISED_PLACE_NOTICE_COMPONENT, AbstractActivityTriggerComponent, AbstractCardContainerComponent, AbstractConfirmDialogComponent, AbstractDialogComponent, AbstractInputComponent, AbstractInteractionContext, AbstractListInputComponent, AbstractPlaceNavigationComponent, AbstractPopStateNavigation, AbstractPopupMenuComponent, AbstractTableComponent, AbstractTableModel, AbstractValueInputComponent, Activity, ActivityActionsComponent, ActivityBodyComponent, ActivityContainerComponent, ActivityOutletComponent, ActivityRef, ActivityTitleComponent, AddCardActivityComponent, AddItemInteractionContextComponent, Alert, AlertDialogComponent, AngularUiPowerupsModule, AutocompleteInputComponent, Bounds, BusyOverlayComponent, CELL_EDITOR_PORTAL, CELL_RENDERER_PORTAL, CardContainerComponent, CardStackComponent, CellEditorPortalRef, CellHeaderPortalRef, CellPortalRef, CellRendererPortalRef, CheckboxInputComponent, ColumnListModel, ColumnModel, ColumnTemplateDirective, ColumnTextSearchFormatter, CommandComponent, CommandContainer, CommandDirective, CommandFace, CommandFaceComponent, ComponentCellRendererPortalRef, ComponentsModule, ConfirmThenDialogComponent, ConfirmThenExecuteDialogComponent, ConfirmationDialogComponent, ConsolidatedParameterMap, CustomTemplateColumnModel, CustomValueColumnModel, DEFINITION_META_DATA_KEY, DIALOG_INTERACTION_SERVICE_DEFAULTS, DecoratedTreeNode, DefaultCellRendererComponent, DefaultHeaderCellRendererComponent, DialogInteractionContext, DialogInteractionContextFactory, Dimension, DirectivesModule, DisposableComponent, EditRowControls, EditSession, EditorControlColumnModel, EmptyStateComponent, EnableCellTextSearch, EventCleanUpSession, FlattenedTreeListModel, FlexComponent, FocusBinding, FocusBindingDirective, FocusBindingFactory, FocusContainerComponent, FocusableComponent, Formatter, HEADER_CELL_RENDERER_PORTAL, HighlightPipe, HighlightTextModelDirective, HorizontalAlignment, IconComponent, InPlaceInteractionContextComponent, InlineActivityTriggerComponent, InlineEditorModel, InlineStringEditorComponent, InputActivity, InteractionContextTriggerFor, InteractionModule, InteractionService, InteractionServiceRoutingAdapter, Keys, LEFT_RIGHT_PLACE_ANIMATION, LabelledValueComponent, ListPlaceNavComponent, ListPropertyColumnModel, LoadingContainerComponent, MarkdownComponent, MarkdownService, ModalActivityTriggerComponent, ModalInteractionContextFactory, MoreMenuComponent, MultipleSelectInputComponent, Navigating, NavigatingDuringInteraction, NavigationContext, NavigationSession, NoopAuthGuard, NoopComponent, NotAuthorisedNoticeComponent, NumberInputComponent, POPUP_CONTAINER, PORTAL_EDITOR_COMPONENT, PORTAL_RENDERER_COMPONENT, PaginatorComponent, ParameterDefinition, PasswordInputComponent, Place, PlaceAccessGuard, PlaceComponent, PlaceComponentDeactivationHandler, PlaceDefinition, PlaceGuard, PlaceHistory, PlaceModule, PlaceOutletComponent, PlaceRouter, Point, PopStateDuringInteractionNavigation, PopStateNavigation, PopupActivityTriggerComponent, PopupAwareComponent, PopupInteractionContextComponent, PopupMenuComponent, PopupMenuRendererComponent, PropertyColumnModel, ROUTE_PARAMETER_LIST_KEY, RemoveLastInteractionFromUrlNavigationSession, ResizeAwareComponent, RouteId, ScrollContainerComponent, SectionHeaderComponent, SelectInputActivity, SelectInputComponent, SelectionCellComponent, SelectionColumnModel, SelectionHeaderCellComponent, SeparatorComponent, SidePlaceNavigationComponent, StringInputActivity, StringInputComponent, SwitchCaseComponent, SwitchCaseDefaultDirective, SwitchCaseOption, SwitchCaseWhenDirective, SynchroniseInteractionContextIdsWithRoute, TabbedPlaceNavigationComponent, TableCellComponent, TableComponent, TableHeaderCellComponent, TableModel, TableRowMenuComponent, TemplateCellRendererPortalRef, TextInputComponent, ToolBarComponent, TrackBy, TreeExpansionModel, TreeInheritanceIconComponent, TreeLabelCellRendererComponent, TreeLabelColumnModel, TreeTableComponent, TreeTableModel, UrlService, UrlSnapshot, VerticalFocusContainerComponent, VisibilityService, Visit, VisitParameter, VisitParameterList, VisitSanitiser, WaitUntilLeavingInteractionTransitionCancelled, WaitUntilLinkTriggeredNavigationInteractionCancellationTypeDetermined, WaitUntilPopStateDuringCanDeactivateInteractionFinishes, leftRightPlaceAnimation, markdownPillExtension, slideDownOnEnterAnimation, slideRightOnEnterAnimation, treeNodeDecorator };
|
|
10385
|
+
export { ACTIVITY_DATA, ALERT_CONFIG, AUP_PLACE_CONFIG, AUP_UNAUTHORISED_PLACE_NOTICE_COMPONENT, AbstractActivityTriggerComponent, AbstractCardContainerComponent, AbstractConfirmDialogComponent, AbstractDialogComponent, AbstractInputComponent, AbstractInteractionContext, AbstractListInputComponent, AbstractPlaceNavigationComponent, AbstractPopStateNavigation, AbstractPopupMenuComponent, AbstractTableComponent, AbstractTableModel, AbstractValueInputComponent, Activity, ActivityActionsComponent, ActivityBodyComponent, ActivityContainerComponent, ActivityOutletComponent, ActivityRef, ActivityTitleComponent, AddCardActivityComponent, AddItemInteractionContextComponent, Alert, AlertDialogComponent, AngularUiPowerupsModule, AutocompleteInputComponent, Bounds, BusyOverlayComponent, CELL_EDITOR_PORTAL, CELL_RENDERER_PORTAL, CardContainerComponent, CardStackComponent, CellEditorPortalRef, CellHeaderPortalRef, CellPortalRef, CellRendererPortalRef, CheckboxInputComponent, ColumnListModel, ColumnModel, ColumnTemplateDirective, ColumnTextSearchFormatter, CommandComponent, CommandContainer, CommandDirective, CommandFace, CommandFaceComponent, ComponentCellRendererPortalRef, ComponentsModule, ConfirmThenDialogComponent, ConfirmThenExecuteDialogComponent, ConfirmationDialogComponent, ConsolidatedParameterMap, CustomTemplateColumnModel, CustomValueColumnModel, DEFINITION_META_DATA_KEY, DIALOG_INTERACTION_SERVICE_DEFAULTS, DecoratedTreeNode, DefaultCellRendererComponent, DefaultHeaderCellRendererComponent, DialogInteractionContext, DialogInteractionContextFactory, Dimension, DirectivesModule, DisposableComponent, EditRowControls, EditSession, EditorControlColumnModel, EmptyStateComponent, EnableCellTextSearch, EventCleanUpSession, FlattenedTreeListModel, FlexComponent, FocusBinding, FocusBindingDirective, FocusBindingFactory, FocusContainerComponent, FocusableComponent, Formatter, HEADER_CELL_RENDERER_PORTAL, HighlightPipe, HighlightTextModelDirective, HorizontalAlignment, IconComponent, InPlaceInteractionContextComponent, InlineActivityTriggerComponent, InlineEditorModel, InlineStringEditorComponent, InputActivity, InteractionContextTriggerFor, InteractionModule, InteractionService, InteractionServiceRoutingAdapter, Keys, LEFT_RIGHT_PLACE_ANIMATION, LabelledValueComponent, ListPlaceNavComponent, ListPropertyColumnModel, LoadingContainerComponent, MarkdownComponent, MarkdownService, ModalActivityTriggerComponent, ModalInteractionContextFactory, MoreMenuComponent, MultipleSelectInputComponent, Navigating, NavigatingDuringInteraction, NavigationContext, NavigationSession, NoopAuthGuard, NoopComponent, NotAuthorisedNoticeComponent, NumberInputComponent, POPUP_CONTAINER, PORTAL_EDITOR_COMPONENT, PORTAL_RENDERER_COMPONENT, PaginatorComponent, ParameterDefinition, PasswordInputComponent, Place, PlaceAccessGuard, PlaceComponent, PlaceComponentDeactivationHandler, PlaceDefinition, PlaceGuard, PlaceHistory, PlaceModule, PlaceOutletComponent, PlaceRouter, Point, PopStateDuringInteractionNavigation, PopStateNavigation, PopupActivityTriggerComponent, PopupAwareComponent, PopupInteractionContextComponent, PopupMenuComponent, PopupMenuRendererComponent, PropertyColumnModel, ROUTE_PARAMETER_LIST_KEY, RemoveLastInteractionFromUrlNavigationSession, ResizeAwareComponent, RouteId, ScrollContainerComponent, SectionHeaderComponent, SelectInputActivity, SelectInputComponent, SelectionCellComponent, SelectionColumnModel, SelectionHeaderCellComponent, SeparatorComponent, SidePlaceNavigationComponent, StringInputActivity, StringInputComponent, SwitchCaseComponent, SwitchCaseDefaultDirective, SwitchCaseOption, SwitchCaseWhenDirective, SynchroniseInteractionContextIdsWithRoute, TabbedPlaceNavigationComponent, TableBodyComponent, TableCellComponent, TableComponent, TableHeaderCellComponent, TableModel, TableRowMenuComponent, TemplateCellRendererPortalRef, TextInputComponent, ToolBarComponent, TrackBy, TreeExpansionModel, TreeInheritanceIconComponent, TreeLabelCellRendererComponent, TreeLabelColumnModel, TreeTableComponent, TreeTableModel, UrlService, UrlSnapshot, VerticalFocusContainerComponent, VisibilityService, Visit, VisitParameter, VisitParameterList, VisitSanitiser, WaitUntilLeavingInteractionTransitionCancelled, WaitUntilLinkTriggeredNavigationInteractionCancellationTypeDetermined, WaitUntilPopStateDuringCanDeactivateInteractionFinishes, leftRightPlaceAnimation, markdownPillExtension, slideDownOnEnterAnimation, slideRightOnEnterAnimation, treeNodeDecorator };
|
|
10288
10386
|
//# sourceMappingURL=coolon-angular-ui-powerups.mjs.map
|