@coolon/angular-ui-powerups 14.21.0 → 14.23.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.
@@ -2893,7 +2893,7 @@ class AbstractTableComponent extends DisposableComponent {
2893
2893
  const model = this.getModel();
2894
2894
  this.columnsById = chain(model.columns).indexBy('columnId');
2895
2895
  this._dataSource$.setDelegate(model.dataSource$);
2896
- model.bindToTable(this.injector, (row) => this.identityOf(row));
2896
+ model.initialise(this.injector, (row) => this.identityOf(row));
2897
2897
  }
2898
2898
  get visibleRows$() {
2899
2899
  return this._visibleRows$.readonly;
@@ -3424,6 +3424,7 @@ class AbstractTableModel extends GarbageCollector {
3424
3424
  constructor() {
3425
3425
  super();
3426
3426
  this._dataSource$ = this.registerDisposable(new DelegatingListModel());
3427
+ this._filteredRows$ = this.registerDisposable(new DelegatingListModel());
3427
3428
  this._visibleRows$ = this.registerDisposable(new DelegatingListModel());
3428
3429
  this._columnList = this.registerDisposable(new ColumnListModel());
3429
3430
  this._editorSessions = new MutableListModel();
@@ -3456,7 +3457,7 @@ class AbstractTableModel extends GarbageCollector {
3456
3457
  * @param identityOf
3457
3458
  * @param rest
3458
3459
  */
3459
- bindToTable(injector, identityOf) {
3460
+ initialise(injector, identityOf) {
3460
3461
  // not sure if I should define these at the module level or not...
3461
3462
  const customInjector = Injector.create({
3462
3463
  providers: [
@@ -3471,6 +3472,17 @@ class AbstractTableModel extends GarbageCollector {
3471
3472
  get dataSource$() {
3472
3473
  return this._dataSource$.readonly;
3473
3474
  }
3475
+ /**
3476
+ * Gets the rows that are visible after any filters are applied. If there are
3477
+ * no filters then this will be the same as the root dataset.
3478
+ */
3479
+ get filteredRows$() {
3480
+ return this._filteredRows$.readonly;
3481
+ }
3482
+ /**
3483
+ * Gets the rows are currently visible to the user. I.e. the current page in a paged table or the
3484
+ * expanded rows in a tree table.
3485
+ */
3474
3486
  get visibleRows$() {
3475
3487
  return this._visibleRows$.readonly;
3476
3488
  }
@@ -3935,6 +3947,10 @@ class TableModel extends AbstractTableModel {
3935
3947
  this.setDataSource(sourceOfTruth);
3936
3948
  }
3937
3949
  }
3950
+ bindToTable(filteredRows$, visibleRows$) {
3951
+ this._filteredRows$.setDelegate(filteredRows$);
3952
+ this._visibleRows$.setDelegate(visibleRows$);
3953
+ }
3938
3954
  addSelectionColumn(selectionModel, showSelectionColumn) {
3939
3955
  return this._addSelectionColumn(selectionModel, showSelectionColumn);
3940
3956
  }
@@ -4254,6 +4270,7 @@ class TableComponent extends AbstractTableComponent {
4254
4270
  this._filteredRows$.setDelegate(this._dataSource$);
4255
4271
  }
4256
4272
  this.configurePaging(this.enablePaging$.value);
4273
+ this.tableModel.bindToTable(this._filteredRows$, this._visibleRows$);
4257
4274
  }
4258
4275
  getModel() {
4259
4276
  return this.tableModel;
@@ -4622,10 +4639,12 @@ class TreeTableModel extends AbstractTableModel {
4622
4639
  get isExpandedPredicate$() {
4623
4640
  return this._isExpandedPredicate$.readonly;
4624
4641
  }
4625
- useExpansionModel(expansionModel) {
4642
+ bindToTable(expansionModel, filteredRows$, visibleRows$) {
4626
4643
  this.treeExpansionModel = expansionModel;
4627
4644
  // TODO: Move all the expansion model stuff out of here and have things use the expansion model directly
4628
4645
  this._isExpandedPredicate$.setDelegate(this.treeExpansionModel.isExpandedPredicate$);
4646
+ this._filteredRows$.setDelegate(filteredRows$);
4647
+ this._visibleRows$.setDelegate(visibleRows$);
4629
4648
  }
4630
4649
  treeControlColumn(builder) {
4631
4650
  const columnId = 'tree-label';
@@ -4945,9 +4964,9 @@ class TreeTableComponent extends AbstractTableComponent {
4945
4964
  }
4946
4965
  // Todo, turn this into a plain chain model
4947
4966
  const visibleRows$ = new FlattenedTreeListModel(this._dataSource$, row => this.treeTableModel.childExtractor(row), this.expansionModel);
4948
- this.expansionModel.bindToTable(this._dataSource$, visibleRows$);
4949
- this.treeTableModel.useExpansionModel(this.expansionModel);
4950
4967
  this._visibleRows$.setDelegate(visibleRows$);
4968
+ this.expansionModel.bindToTable(this._dataSource$, visibleRows$);
4969
+ this.treeTableModel.bindToTable(this.expansionModel, visibleRows$, this._visibleRows$);
4951
4970
  }
4952
4971
  getModel() {
4953
4972
  return this.treeTableModel;