@coolon/angular-ui-powerups 14.19.1 → 14.21.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.
@@ -2868,6 +2868,7 @@ class AbstractTableComponent extends DisposableComponent {
2868
2868
  this.rowHeight = new MutableValueModel(48);
2869
2869
  this._visibleRows$ = this.registerDisposable(new DelegatingListModel());
2870
2870
  this.highlightText$ = this.registerDisposable(new DelegatingValueModel());
2871
+ this._dataSource$ = this.registerDisposable(new DelegatingListModel());
2871
2872
  this.baseCssClass = 'aup-table-component';
2872
2873
  this.trackBy = (index, item) => {
2873
2874
  return this.identityOf ? this.identityOf(item) : index;
@@ -2875,8 +2876,8 @@ class AbstractTableComponent extends DisposableComponent {
2875
2876
  const { chain, when } = Dsl.disposeWith(this);
2876
2877
  // this.rows$ = chain(this.dataSource$)
2877
2878
  // .
2878
- this._visibleRows$.setDelegate(this._sourceData$);
2879
- when(chain(this._sourceData$).first()).becomesTruthy(it => {
2879
+ this._visibleRows$.setDelegate(this._dataSource$);
2880
+ when(chain(this._dataSource$).first()).becomesTruthy(it => {
2880
2881
  if (it === this.identityOf(it)) {
2881
2882
  console.warn("Table model identity function is using reference equality. This can cause lots of table re-rendering", {
2882
2883
  row: it
@@ -2885,12 +2886,13 @@ class AbstractTableComponent extends DisposableComponent {
2885
2886
  }, { once: true });
2886
2887
  }
2887
2888
  identityOf(row) {
2888
- return this._sourceData$.identityOf(row);
2889
+ return this._dataSource$.identityOf(row);
2889
2890
  }
2890
2891
  ngOnInit() {
2891
2892
  const { chain } = Dsl.disposeWith(this);
2892
2893
  const model = this.getModel();
2893
2894
  this.columnsById = chain(model.columns).indexBy('columnId');
2895
+ this._dataSource$.setDelegate(model.dataSource$);
2894
2896
  model.bindToTable(this.injector, (row) => this.identityOf(row));
2895
2897
  }
2896
2898
  get visibleRows$() {
@@ -2907,15 +2909,7 @@ class AbstractTableComponent extends DisposableComponent {
2907
2909
  }
2908
2910
  }
2909
2911
  AbstractTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: AbstractTableComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
2910
- AbstractTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.2", type: AbstractTableComponent, selector: "aup-abstract-table", inputs: { _sourceData$: ["data$", "_sourceData$"], data: "data", showHeader$: "showHeader$", showHeader: "showHeader", enableScrolling: "enableScrolling" }, host: { properties: { "class": "this.baseCssClass" } }, usesInheritance: true, ngImport: i0, template: '', isInline: true });
2911
- __decorate([
2912
- TrackExternal(),
2913
- __metadata("design:type", ListModel)
2914
- ], AbstractTableComponent.prototype, "_sourceData$", void 0);
2915
- __decorate([
2916
- StoreInListModel("_sourceData$"),
2917
- __metadata("design:type", Array)
2918
- ], AbstractTableComponent.prototype, "data", void 0);
2912
+ AbstractTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.2", 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 });
2919
2913
  __decorate([
2920
2914
  TrackExternal({ defaultValue: true }),
2921
2915
  __metadata("design:type", ValueModel)
@@ -2930,12 +2924,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImpor
2930
2924
  selector: 'aup-abstract-table',
2931
2925
  template: ''
2932
2926
  }]
2933
- }], ctorParameters: function () { return [{ type: i0.Injector }]; }, propDecorators: { _sourceData$: [{
2934
- type: Input,
2935
- args: ["data$"]
2936
- }], data: [{
2937
- type: Input
2938
- }], showHeader$: [{
2927
+ }], ctorParameters: function () { return [{ type: i0.Injector }]; }, propDecorators: { showHeader$: [{
2939
2928
  type: Input
2940
2929
  }], showHeader: [{
2941
2930
  type: Input
@@ -3456,6 +3445,10 @@ class AbstractTableModel extends GarbageCollector {
3456
3445
  this.firstVisibleColumn$ = chain(this._columnList).first();
3457
3446
  this.lastVisibleColumn$ = chain(this._columnList).last();
3458
3447
  this.rowSelectionDisabledOnAllColumns$ = chain(this._columnList).select(column => column.isRowSelectionEnabled()).count().equals(0);
3448
+ this.dataSourceEmpty$ = chain(this.dataSource$).isEmpty();
3449
+ }
3450
+ setDataSource(dataSource$) {
3451
+ this._dataSource$.setDelegate(dataSource$);
3459
3452
  }
3460
3453
  /**
3461
3454
  * Todo: make this force one table at a time
@@ -3475,6 +3468,9 @@ class AbstractTableModel extends GarbageCollector {
3475
3468
  this.columns.value.forEach(c => c.initialise(customInjector));
3476
3469
  this.identityOf = identityOf;
3477
3470
  }
3471
+ get dataSource$() {
3472
+ return this._dataSource$.readonly;
3473
+ }
3478
3474
  get visibleRows$() {
3479
3475
  return this._visibleRows$.readonly;
3480
3476
  }
@@ -3930,11 +3926,14 @@ TrackExternal.oneTimeBinding(TableFilterModel);
3930
3926
  * });
3931
3927
  */
3932
3928
  class TableModel extends AbstractTableModel {
3933
- constructor(builder) {
3929
+ constructor(sourceOfTruth, builder) {
3934
3930
  super();
3935
- if (isFunction$1(builder)) {
3931
+ if (builder) {
3936
3932
  builder(this);
3937
3933
  }
3934
+ if (sourceOfTruth) {
3935
+ this.setDataSource(sourceOfTruth);
3936
+ }
3938
3937
  }
3939
3938
  addSelectionColumn(selectionModel, showSelectionColumn) {
3940
3939
  return this._addSelectionColumn(selectionModel, showSelectionColumn);
@@ -4247,12 +4246,12 @@ class TableComponent extends AbstractTableComponent {
4247
4246
  ngOnInit() {
4248
4247
  super.ngOnInit();
4249
4248
  if (this.filterModel) {
4250
- this.registerDisposable(this.filterModel.bindToTable(this._sourceData$, this.getModel().textSearchPredicate$));
4249
+ this.registerDisposable(this.filterModel.bindToTable(this._dataSource$, this.getModel().textSearchPredicate$));
4251
4250
  this.highlightText$.setDelegate(this.filterModel.highlightText$);
4252
4251
  this._filteredRows$.setDelegate(this.filterModel.filteredRows$);
4253
4252
  }
4254
4253
  else {
4255
- this._filteredRows$.setDelegate(this._sourceData$);
4254
+ this._filteredRows$.setDelegate(this._dataSource$);
4256
4255
  }
4257
4256
  this.configurePaging(this.enablePaging$.value);
4258
4257
  }
@@ -4611,13 +4610,14 @@ class TreeLabelColumnModel extends ColumnModel {
4611
4610
  // - Add a predicate to check default expansion (i.e. has children of a certain type)
4612
4611
  //
4613
4612
  class TreeTableModel extends AbstractTableModel {
4614
- constructor(childAccessor, builder) {
4613
+ constructor(source$, childAccessor, builder) {
4615
4614
  super();
4616
4615
  this._isExpandedPredicate$ = this.registerDisposable(new DelegatingValueModel());
4617
4616
  if (builder)
4618
4617
  builder(this);
4619
4618
  this.childExtractor = isFunction(childAccessor) ? childAccessor : row => row[childAccessor];
4620
4619
  this.addRowClass('aup-node-collapsed', row => this.isCollapsed(row));
4620
+ this.setDataSource(source$);
4621
4621
  }
4622
4622
  get isExpandedPredicate$() {
4623
4623
  return this._isExpandedPredicate$.readonly;
@@ -4944,8 +4944,8 @@ class TreeTableComponent extends AbstractTableComponent {
4944
4944
  this.expansionModel = new TreeExpansionModel({ disposedWith: this });
4945
4945
  }
4946
4946
  // Todo, turn this into a plain chain model
4947
- const visibleRows$ = new FlattenedTreeListModel(this._sourceData$, row => this.treeTableModel.childExtractor(row), this.expansionModel);
4948
- this.expansionModel.bindToTable(this._sourceData$, visibleRows$);
4947
+ const visibleRows$ = new FlattenedTreeListModel(this._dataSource$, row => this.treeTableModel.childExtractor(row), this.expansionModel);
4948
+ this.expansionModel.bindToTable(this._dataSource$, visibleRows$);
4949
4949
  this.treeTableModel.useExpansionModel(this.expansionModel);
4950
4950
  this._visibleRows$.setDelegate(visibleRows$);
4951
4951
  }