@coolon/angular-ui-powerups 14.20.0 → 14.22.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;
@@ -3421,7 +3421,7 @@ class RowClass {
3421
3421
  }
3422
3422
  }
3423
3423
  class AbstractTableModel extends GarbageCollector {
3424
- constructor(source$) {
3424
+ constructor() {
3425
3425
  super();
3426
3426
  this._dataSource$ = this.registerDisposable(new DelegatingListModel());
3427
3427
  this._visibleRows$ = this.registerDisposable(new DelegatingListModel());
@@ -3431,7 +3431,6 @@ class AbstractTableModel extends GarbageCollector {
3431
3431
  this.rowClickListeners = new EventListenerList();
3432
3432
  this._createForm = (row) => new DirtyTrackingForm();
3433
3433
  const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
3434
- this._dataSource$.setDelegate(source$);
3435
3434
  this._rowsBeingEdited$ = new MutableListModel([], {
3436
3435
  identifiedWith: row => this.identityOf(row)
3437
3436
  });
@@ -3448,13 +3447,16 @@ class AbstractTableModel extends GarbageCollector {
3448
3447
  this.rowSelectionDisabledOnAllColumns$ = chain(this._columnList).select(column => column.isRowSelectionEnabled()).count().equals(0);
3449
3448
  this.dataSourceEmpty$ = chain(this.dataSource$).isEmpty();
3450
3449
  }
3450
+ setDataSource(dataSource$) {
3451
+ this._dataSource$.setDelegate(dataSource$);
3452
+ }
3451
3453
  /**
3452
3454
  * Todo: make this force one table at a time
3453
3455
  * @param injector
3454
3456
  * @param identityOf
3455
3457
  * @param rest
3456
3458
  */
3457
- bindToTable(injector, identityOf) {
3459
+ initialise(injector, identityOf) {
3458
3460
  // not sure if I should define these at the module level or not...
3459
3461
  const customInjector = Injector.create({
3460
3462
  providers: [
@@ -3924,11 +3926,14 @@ TrackExternal.oneTimeBinding(TableFilterModel);
3924
3926
  * });
3925
3927
  */
3926
3928
  class TableModel extends AbstractTableModel {
3927
- constructor(source$, builder) {
3928
- super(source$);
3929
- if (isFunction$1(builder)) {
3929
+ constructor(sourceOfTruth, builder) {
3930
+ super();
3931
+ if (builder) {
3930
3932
  builder(this);
3931
3933
  }
3934
+ if (sourceOfTruth) {
3935
+ this.setDataSource(sourceOfTruth);
3936
+ }
3932
3937
  }
3933
3938
  addSelectionColumn(selectionModel, showSelectionColumn) {
3934
3939
  return this._addSelectionColumn(selectionModel, showSelectionColumn);
@@ -4606,20 +4611,22 @@ class TreeLabelColumnModel extends ColumnModel {
4606
4611
  //
4607
4612
  class TreeTableModel extends AbstractTableModel {
4608
4613
  constructor(source$, childAccessor, builder) {
4609
- super(source$);
4614
+ super();
4610
4615
  this._isExpandedPredicate$ = this.registerDisposable(new DelegatingValueModel());
4611
4616
  if (builder)
4612
4617
  builder(this);
4613
4618
  this.childExtractor = isFunction(childAccessor) ? childAccessor : row => row[childAccessor];
4614
4619
  this.addRowClass('aup-node-collapsed', row => this.isCollapsed(row));
4620
+ this.setDataSource(source$);
4615
4621
  }
4616
4622
  get isExpandedPredicate$() {
4617
4623
  return this._isExpandedPredicate$.readonly;
4618
4624
  }
4619
- useExpansionModel(expansionModel) {
4625
+ bindToTable(expansionModel, visibleRows$) {
4620
4626
  this.treeExpansionModel = expansionModel;
4621
4627
  // TODO: Move all the expansion model stuff out of here and have things use the expansion model directly
4622
4628
  this._isExpandedPredicate$.setDelegate(this.treeExpansionModel.isExpandedPredicate$);
4629
+ this._visibleRows$.setDelegate(visibleRows$);
4623
4630
  }
4624
4631
  treeControlColumn(builder) {
4625
4632
  const columnId = 'tree-label';
@@ -4940,7 +4947,7 @@ class TreeTableComponent extends AbstractTableComponent {
4940
4947
  // Todo, turn this into a plain chain model
4941
4948
  const visibleRows$ = new FlattenedTreeListModel(this._dataSource$, row => this.treeTableModel.childExtractor(row), this.expansionModel);
4942
4949
  this.expansionModel.bindToTable(this._dataSource$, visibleRows$);
4943
- this.treeTableModel.useExpansionModel(this.expansionModel);
4950
+ this.treeTableModel.bindToTable(this.expansionModel, visibleRows$);
4944
4951
  this._visibleRows$.setDelegate(visibleRows$);
4945
4952
  }
4946
4953
  getModel() {