@coolon/angular-ui-powerups 14.19.1 → 14.20.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.
@@ -2895,6 +2895,7 @@ class AbstractTableComponent extends DisposableComponent {
2895
2895
  this.rowHeight = new MutableValueModel(48);
2896
2896
  this._visibleRows$ = this.registerDisposable(new DelegatingListModel());
2897
2897
  this.highlightText$ = this.registerDisposable(new DelegatingValueModel());
2898
+ this._dataSource$ = this.registerDisposable(new DelegatingListModel());
2898
2899
  this.baseCssClass = 'aup-table-component';
2899
2900
  this.trackBy = (index, item) => {
2900
2901
  return this.identityOf ? this.identityOf(item) : index;
@@ -2902,8 +2903,8 @@ class AbstractTableComponent extends DisposableComponent {
2902
2903
  const { chain, when } = Dsl.disposeWith(this);
2903
2904
  // this.rows$ = chain(this.dataSource$)
2904
2905
  // .
2905
- this._visibleRows$.setDelegate(this._sourceData$);
2906
- when(chain(this._sourceData$).first()).becomesTruthy(it => {
2906
+ this._visibleRows$.setDelegate(this._dataSource$);
2907
+ when(chain(this._dataSource$).first()).becomesTruthy(it => {
2907
2908
  if (it === this.identityOf(it)) {
2908
2909
  console.warn("Table model identity function is using reference equality. This can cause lots of table re-rendering", {
2909
2910
  row: it
@@ -2912,12 +2913,13 @@ class AbstractTableComponent extends DisposableComponent {
2912
2913
  }, { once: true });
2913
2914
  }
2914
2915
  identityOf(row) {
2915
- return this._sourceData$.identityOf(row);
2916
+ return this._dataSource$.identityOf(row);
2916
2917
  }
2917
2918
  ngOnInit() {
2918
2919
  const { chain } = Dsl.disposeWith(this);
2919
2920
  const model = this.getModel();
2920
2921
  this.columnsById = chain(model.columns).indexBy('columnId');
2922
+ this._dataSource$.setDelegate(model.dataSource$);
2921
2923
  model.bindToTable(this.injector, (row) => this.identityOf(row));
2922
2924
  }
2923
2925
  get visibleRows$() {
@@ -2934,15 +2936,7 @@ class AbstractTableComponent extends DisposableComponent {
2934
2936
  }
2935
2937
  }
2936
2938
  AbstractTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: AbstractTableComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
2937
- 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 });
2938
- __decorate([
2939
- TrackExternal(),
2940
- __metadata("design:type", ListModel)
2941
- ], AbstractTableComponent.prototype, "_sourceData$", void 0);
2942
- __decorate([
2943
- StoreInListModel("_sourceData$"),
2944
- __metadata("design:type", Array)
2945
- ], AbstractTableComponent.prototype, "data", void 0);
2939
+ 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 });
2946
2940
  __decorate([
2947
2941
  TrackExternal({ defaultValue: true }),
2948
2942
  __metadata("design:type", ValueModel)
@@ -2957,12 +2951,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImpor
2957
2951
  selector: 'aup-abstract-table',
2958
2952
  template: ''
2959
2953
  }]
2960
- }], ctorParameters: function () { return [{ type: i0.Injector }]; }, propDecorators: { _sourceData$: [{
2961
- type: Input,
2962
- args: ["data$"]
2963
- }], data: [{
2964
- type: Input
2965
- }], showHeader$: [{
2954
+ }], ctorParameters: function () { return [{ type: i0.Injector }]; }, propDecorators: { showHeader$: [{
2966
2955
  type: Input
2967
2956
  }], showHeader: [{
2968
2957
  type: Input
@@ -3699,7 +3688,7 @@ class RowClass {
3699
3688
  }
3700
3689
  }
3701
3690
  class AbstractTableModel extends GarbageCollector {
3702
- constructor() {
3691
+ constructor(source$) {
3703
3692
  super();
3704
3693
  this._dataSource$ = this.registerDisposable(new DelegatingListModel());
3705
3694
  this._visibleRows$ = this.registerDisposable(new DelegatingListModel());
@@ -3709,6 +3698,7 @@ class AbstractTableModel extends GarbageCollector {
3709
3698
  this.rowClickListeners = new EventListenerList();
3710
3699
  this._createForm = (row) => new DirtyTrackingForm();
3711
3700
  const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
3701
+ this._dataSource$.setDelegate(source$);
3712
3702
  this._rowsBeingEdited$ = new MutableListModel([], {
3713
3703
  identifiedWith: row => this.identityOf(row)
3714
3704
  });
@@ -3723,6 +3713,7 @@ class AbstractTableModel extends GarbageCollector {
3723
3713
  this.firstVisibleColumn$ = chain(this._columnList).first();
3724
3714
  this.lastVisibleColumn$ = chain(this._columnList).last();
3725
3715
  this.rowSelectionDisabledOnAllColumns$ = chain(this._columnList).select(column => column.isRowSelectionEnabled()).count().equals(0);
3716
+ this.dataSourceEmpty$ = chain(this.dataSource$).isEmpty();
3726
3717
  }
3727
3718
  /**
3728
3719
  * Todo: make this force one table at a time
@@ -3742,6 +3733,9 @@ class AbstractTableModel extends GarbageCollector {
3742
3733
  this.columns.value.forEach(c => c.initialise(customInjector));
3743
3734
  this.identityOf = identityOf;
3744
3735
  }
3736
+ get dataSource$() {
3737
+ return this._dataSource$.readonly;
3738
+ }
3745
3739
  get visibleRows$() {
3746
3740
  return this._visibleRows$.readonly;
3747
3741
  }
@@ -3966,8 +3960,8 @@ TrackExternal.oneTimeBinding(AbstractTableModel);
3966
3960
  * });
3967
3961
  */
3968
3962
  class TableModel extends AbstractTableModel {
3969
- constructor(builder) {
3970
- super();
3963
+ constructor(source$, builder) {
3964
+ super(source$);
3971
3965
  if (isFunction$1(builder)) {
3972
3966
  builder(this);
3973
3967
  }
@@ -4285,12 +4279,12 @@ class TableComponent extends AbstractTableComponent {
4285
4279
  ngOnInit() {
4286
4280
  super.ngOnInit();
4287
4281
  if (this.filterModel) {
4288
- this.registerDisposable(this.filterModel.bindToTable(this._sourceData$, this.getModel().textSearchPredicate$));
4282
+ this.registerDisposable(this.filterModel.bindToTable(this._dataSource$, this.getModel().textSearchPredicate$));
4289
4283
  this.highlightText$.setDelegate(this.filterModel.highlightText$);
4290
4284
  this._filteredRows$.setDelegate(this.filterModel.filteredRows$);
4291
4285
  }
4292
4286
  else {
4293
- this._filteredRows$.setDelegate(this._sourceData$);
4287
+ this._filteredRows$.setDelegate(this._dataSource$);
4294
4288
  }
4295
4289
  this.configurePaging(this.enablePaging$.value);
4296
4290
  }
@@ -4825,8 +4819,8 @@ class TreeLabelColumnModel extends ColumnModel {
4825
4819
  // - Add a predicate to check default expansion (i.e. has children of a certain type)
4826
4820
  //
4827
4821
  class TreeTableModel extends AbstractTableModel {
4828
- constructor(childAccessor, builder) {
4829
- super();
4822
+ constructor(source$, childAccessor, builder) {
4823
+ super(source$);
4830
4824
  this._isExpandedPredicate$ = this.registerDisposable(new DelegatingValueModel());
4831
4825
  if (builder)
4832
4826
  builder(this);
@@ -4983,8 +4977,8 @@ class TreeTableComponent extends AbstractTableComponent {
4983
4977
  this.expansionModel = new TreeExpansionModel({ disposedWith: this });
4984
4978
  }
4985
4979
  // Todo, turn this into a plain chain model
4986
- const visibleRows$ = new FlattenedTreeListModel(this._sourceData$, row => this.treeTableModel.childExtractor(row), this.expansionModel);
4987
- this.expansionModel.bindToTable(this._sourceData$, visibleRows$);
4980
+ const visibleRows$ = new FlattenedTreeListModel(this._dataSource$, row => this.treeTableModel.childExtractor(row), this.expansionModel);
4981
+ this.expansionModel.bindToTable(this._dataSource$, visibleRows$);
4988
4982
  this.treeTableModel.useExpansionModel(this.expansionModel);
4989
4983
  this._visibleRows$.setDelegate(visibleRows$);
4990
4984
  }