@coolon/angular-ui-powerups 14.22.0 → 14.24.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/components/tables/abstract-table-model.mjs +20 -3
- package/esm2020/lib/components/tables/column/selection-column-model.mjs +4 -5
- package/esm2020/lib/components/tables/table/table-model.mjs +5 -1
- package/esm2020/lib/components/tables/table/table.component.mjs +2 -1
- package/esm2020/lib/components/tables/tree-table/tree-table-component.mjs +3 -3
- package/esm2020/lib/components/tables/tree-table/tree-table-model.mjs +3 -2
- package/fesm2015/coolon-angular-ui-powerups.mjs +30 -8
- package/fesm2015/coolon-angular-ui-powerups.mjs.map +1 -1
- package/fesm2020/coolon-angular-ui-powerups.mjs +30 -8
- package/fesm2020/coolon-angular-ui-powerups.mjs.map +1 -1
- package/lib/components/tables/abstract-table-model.d.ts +14 -0
- package/lib/components/tables/column/selection-column-model.d.ts +3 -3
- package/lib/components/tables/table/table-model.d.ts +1 -0
- package/lib/components/tables/tree-table/tree-table-model.d.ts +1 -1
- package/package.json +2 -2
|
@@ -39,7 +39,7 @@ import { MatTableModule } from '@angular/material/table';
|
|
|
39
39
|
import * as i4 from '@angular/material/tooltip';
|
|
40
40
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
41
41
|
import * as i1$3 from '@coolon/pectin';
|
|
42
|
-
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, HasDelegate, MultipleSelectionModel, SelectionModel, AbstractComputedListModel,
|
|
42
|
+
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, HasDelegate, MultipleSelectionModel, SelectionModel, AbstractComputedListModel, DirtyTrackingForm, DelegatingSelectionModel, PageController, PagedListModel, ComputedListModel, Deferred } from '@coolon/pectin';
|
|
43
43
|
import { __decorate, __param, __metadata } from 'tslib';
|
|
44
44
|
import * as i1 from '@angular/platform-browser';
|
|
45
45
|
import escapeStringRegexp from 'escape-string-regexp';
|
|
@@ -3367,9 +3367,9 @@ class PropertyColumnModel extends ColumnModel {
|
|
|
3367
3367
|
class SelectionColumnModel extends ColumnModel {
|
|
3368
3368
|
constructor(columnId, defaults, selectionModel) {
|
|
3369
3369
|
super(columnId, defaults);
|
|
3370
|
+
this.selectionModel = selectionModel;
|
|
3370
3371
|
this._enableHeaderControls = true;
|
|
3371
3372
|
this._color = "accent";
|
|
3372
|
-
this.selectionModel = DelegatingSelectionModel.createDelegate();
|
|
3373
3373
|
const { chain } = Dsl.disposeWith(this);
|
|
3374
3374
|
this._selectRowOnClick(false);
|
|
3375
3375
|
this.cellHeaderRenderer(SelectionHeaderCellComponent, (component) => {
|
|
@@ -3382,11 +3382,10 @@ class SelectionColumnModel extends ColumnModel {
|
|
|
3382
3382
|
component.selectionModel = this.selectionModel;
|
|
3383
3383
|
component.color = this._color;
|
|
3384
3384
|
}));
|
|
3385
|
-
this.setSelectionModel(selectionModel);
|
|
3386
3385
|
this.setMasterVisibility(this.selectionModel.enabled$);
|
|
3387
3386
|
this.setDefaultVisibility(chain(this.selectionModel.mode$).equals(SelectionModel.Mode.MULTIPLE));
|
|
3388
3387
|
}
|
|
3389
|
-
|
|
3388
|
+
useSelectionModel(selectionModel) {
|
|
3390
3389
|
this.selectionModel.setDelegate(selectionModel);
|
|
3391
3390
|
}
|
|
3392
3391
|
getDefaultHeaderText() {
|
|
@@ -3424,12 +3423,14 @@ class AbstractTableModel extends GarbageCollector {
|
|
|
3424
3423
|
constructor() {
|
|
3425
3424
|
super();
|
|
3426
3425
|
this._dataSource$ = this.registerDisposable(new DelegatingListModel());
|
|
3426
|
+
this._filteredRows$ = this.registerDisposable(new DelegatingListModel());
|
|
3427
3427
|
this._visibleRows$ = this.registerDisposable(new DelegatingListModel());
|
|
3428
3428
|
this._columnList = this.registerDisposable(new ColumnListModel());
|
|
3429
3429
|
this._editorSessions = new MutableListModel();
|
|
3430
3430
|
this.rowClassNamePredicates = [];
|
|
3431
3431
|
this.rowClickListeners = new EventListenerList();
|
|
3432
3432
|
this._createForm = (row) => new DirtyTrackingForm();
|
|
3433
|
+
this.delegatingSelectionModel = DelegatingSelectionModel.createDelegate();
|
|
3433
3434
|
const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
|
|
3434
3435
|
this._rowsBeingEdited$ = new MutableListModel([], {
|
|
3435
3436
|
identifiedWith: row => this.identityOf(row)
|
|
@@ -3446,6 +3447,9 @@ class AbstractTableModel extends GarbageCollector {
|
|
|
3446
3447
|
this.lastVisibleColumn$ = chain(this._columnList).last();
|
|
3447
3448
|
this.rowSelectionDisabledOnAllColumns$ = chain(this._columnList).select(column => column.isRowSelectionEnabled()).count().equals(0);
|
|
3448
3449
|
this.dataSourceEmpty$ = chain(this.dataSource$).isEmpty();
|
|
3450
|
+
this.selectedItems$ = this.delegatingSelectionModel.selectedItems$;
|
|
3451
|
+
this.leadSelection$ = this.delegatingSelectionModel.leadSelection$;
|
|
3452
|
+
this.hasSelection$ = chain(this.selectedItems$).isNotEmpty();
|
|
3449
3453
|
}
|
|
3450
3454
|
setDataSource(dataSource$) {
|
|
3451
3455
|
this._dataSource$.setDelegate(dataSource$);
|
|
@@ -3471,6 +3475,17 @@ class AbstractTableModel extends GarbageCollector {
|
|
|
3471
3475
|
get dataSource$() {
|
|
3472
3476
|
return this._dataSource$.readonly;
|
|
3473
3477
|
}
|
|
3478
|
+
/**
|
|
3479
|
+
* Gets the rows that are visible after any filters are applied. If there are
|
|
3480
|
+
* no filters then this will be the same as the root dataset.
|
|
3481
|
+
*/
|
|
3482
|
+
get filteredRows$() {
|
|
3483
|
+
return this._filteredRows$.readonly;
|
|
3484
|
+
}
|
|
3485
|
+
/**
|
|
3486
|
+
* Gets the rows are currently visible to the user. I.e. the current page in a paged table or the
|
|
3487
|
+
* expanded rows in a tree table.
|
|
3488
|
+
*/
|
|
3474
3489
|
get visibleRows$() {
|
|
3475
3490
|
return this._visibleRows$.readonly;
|
|
3476
3491
|
}
|
|
@@ -3524,7 +3539,8 @@ class AbstractTableModel extends GarbageCollector {
|
|
|
3524
3539
|
_addSelectionColumn(selectionModel, visible) {
|
|
3525
3540
|
assert.isNil(this.selectionColumnModel);
|
|
3526
3541
|
const columnId = "selection-column";
|
|
3527
|
-
this.selectionColumnModel = new SelectionColumnModel(columnId, () => this.getColumnTextProperties(columnId),
|
|
3542
|
+
this.selectionColumnModel = new SelectionColumnModel(columnId, () => this.getColumnTextProperties(columnId), this.delegatingSelectionModel);
|
|
3543
|
+
this.selectionColumnModel.useSelectionModel(selectionModel);
|
|
3528
3544
|
this.addRowClass("aup-row-selected", row => this.selectionColumnModel.isSelected(row));
|
|
3529
3545
|
const selectionColumnModel = this.addColumn(this.selectionColumnModel, 0);
|
|
3530
3546
|
if (!isNil$1(visible)) {
|
|
@@ -3935,6 +3951,10 @@ class TableModel extends AbstractTableModel {
|
|
|
3935
3951
|
this.setDataSource(sourceOfTruth);
|
|
3936
3952
|
}
|
|
3937
3953
|
}
|
|
3954
|
+
bindToTable(filteredRows$, visibleRows$) {
|
|
3955
|
+
this._filteredRows$.setDelegate(filteredRows$);
|
|
3956
|
+
this._visibleRows$.setDelegate(visibleRows$);
|
|
3957
|
+
}
|
|
3938
3958
|
addSelectionColumn(selectionModel, showSelectionColumn) {
|
|
3939
3959
|
return this._addSelectionColumn(selectionModel, showSelectionColumn);
|
|
3940
3960
|
}
|
|
@@ -4254,6 +4274,7 @@ class TableComponent extends AbstractTableComponent {
|
|
|
4254
4274
|
this._filteredRows$.setDelegate(this._dataSource$);
|
|
4255
4275
|
}
|
|
4256
4276
|
this.configurePaging(this.enablePaging$.value);
|
|
4277
|
+
this.tableModel.bindToTable(this._filteredRows$, this._visibleRows$);
|
|
4257
4278
|
}
|
|
4258
4279
|
getModel() {
|
|
4259
4280
|
return this.tableModel;
|
|
@@ -4622,10 +4643,11 @@ class TreeTableModel extends AbstractTableModel {
|
|
|
4622
4643
|
get isExpandedPredicate$() {
|
|
4623
4644
|
return this._isExpandedPredicate$.readonly;
|
|
4624
4645
|
}
|
|
4625
|
-
bindToTable(expansionModel, visibleRows$) {
|
|
4646
|
+
bindToTable(expansionModel, filteredRows$, visibleRows$) {
|
|
4626
4647
|
this.treeExpansionModel = expansionModel;
|
|
4627
4648
|
// TODO: Move all the expansion model stuff out of here and have things use the expansion model directly
|
|
4628
4649
|
this._isExpandedPredicate$.setDelegate(this.treeExpansionModel.isExpandedPredicate$);
|
|
4650
|
+
this._filteredRows$.setDelegate(filteredRows$);
|
|
4629
4651
|
this._visibleRows$.setDelegate(visibleRows$);
|
|
4630
4652
|
}
|
|
4631
4653
|
treeControlColumn(builder) {
|
|
@@ -4946,9 +4968,9 @@ class TreeTableComponent extends AbstractTableComponent {
|
|
|
4946
4968
|
}
|
|
4947
4969
|
// Todo, turn this into a plain chain model
|
|
4948
4970
|
const visibleRows$ = new FlattenedTreeListModel(this._dataSource$, row => this.treeTableModel.childExtractor(row), this.expansionModel);
|
|
4949
|
-
this.expansionModel.bindToTable(this._dataSource$, visibleRows$);
|
|
4950
|
-
this.treeTableModel.bindToTable(this.expansionModel, visibleRows$);
|
|
4951
4971
|
this._visibleRows$.setDelegate(visibleRows$);
|
|
4972
|
+
this.expansionModel.bindToTable(this._dataSource$, visibleRows$);
|
|
4973
|
+
this.treeTableModel.bindToTable(this.expansionModel, visibleRows$, this._visibleRows$);
|
|
4952
4974
|
}
|
|
4953
4975
|
getModel() {
|
|
4954
4976
|
return this.treeTableModel;
|