@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.
@@ -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
@@ -3432,7 +3421,7 @@ class RowClass {
3432
3421
  }
3433
3422
  }
3434
3423
  class AbstractTableModel extends GarbageCollector {
3435
- constructor() {
3424
+ constructor(source$) {
3436
3425
  super();
3437
3426
  this._dataSource$ = this.registerDisposable(new DelegatingListModel());
3438
3427
  this._visibleRows$ = this.registerDisposable(new DelegatingListModel());
@@ -3442,6 +3431,7 @@ class AbstractTableModel extends GarbageCollector {
3442
3431
  this.rowClickListeners = new EventListenerList();
3443
3432
  this._createForm = (row) => new DirtyTrackingForm();
3444
3433
  const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
3434
+ this._dataSource$.setDelegate(source$);
3445
3435
  this._rowsBeingEdited$ = new MutableListModel([], {
3446
3436
  identifiedWith: row => this.identityOf(row)
3447
3437
  });
@@ -3456,6 +3446,7 @@ class AbstractTableModel extends GarbageCollector {
3456
3446
  this.firstVisibleColumn$ = chain(this._columnList).first();
3457
3447
  this.lastVisibleColumn$ = chain(this._columnList).last();
3458
3448
  this.rowSelectionDisabledOnAllColumns$ = chain(this._columnList).select(column => column.isRowSelectionEnabled()).count().equals(0);
3449
+ this.dataSourceEmpty$ = chain(this.dataSource$).isEmpty();
3459
3450
  }
3460
3451
  /**
3461
3452
  * Todo: make this force one table at a time
@@ -3475,6 +3466,9 @@ class AbstractTableModel extends GarbageCollector {
3475
3466
  this.columns.value.forEach(c => c.initialise(customInjector));
3476
3467
  this.identityOf = identityOf;
3477
3468
  }
3469
+ get dataSource$() {
3470
+ return this._dataSource$.readonly;
3471
+ }
3478
3472
  get visibleRows$() {
3479
3473
  return this._visibleRows$.readonly;
3480
3474
  }
@@ -3930,8 +3924,8 @@ TrackExternal.oneTimeBinding(TableFilterModel);
3930
3924
  * });
3931
3925
  */
3932
3926
  class TableModel extends AbstractTableModel {
3933
- constructor(builder) {
3934
- super();
3927
+ constructor(source$, builder) {
3928
+ super(source$);
3935
3929
  if (isFunction$1(builder)) {
3936
3930
  builder(this);
3937
3931
  }
@@ -4247,12 +4241,12 @@ class TableComponent extends AbstractTableComponent {
4247
4241
  ngOnInit() {
4248
4242
  super.ngOnInit();
4249
4243
  if (this.filterModel) {
4250
- this.registerDisposable(this.filterModel.bindToTable(this._sourceData$, this.getModel().textSearchPredicate$));
4244
+ this.registerDisposable(this.filterModel.bindToTable(this._dataSource$, this.getModel().textSearchPredicate$));
4251
4245
  this.highlightText$.setDelegate(this.filterModel.highlightText$);
4252
4246
  this._filteredRows$.setDelegate(this.filterModel.filteredRows$);
4253
4247
  }
4254
4248
  else {
4255
- this._filteredRows$.setDelegate(this._sourceData$);
4249
+ this._filteredRows$.setDelegate(this._dataSource$);
4256
4250
  }
4257
4251
  this.configurePaging(this.enablePaging$.value);
4258
4252
  }
@@ -4611,8 +4605,8 @@ class TreeLabelColumnModel extends ColumnModel {
4611
4605
  // - Add a predicate to check default expansion (i.e. has children of a certain type)
4612
4606
  //
4613
4607
  class TreeTableModel extends AbstractTableModel {
4614
- constructor(childAccessor, builder) {
4615
- super();
4608
+ constructor(source$, childAccessor, builder) {
4609
+ super(source$);
4616
4610
  this._isExpandedPredicate$ = this.registerDisposable(new DelegatingValueModel());
4617
4611
  if (builder)
4618
4612
  builder(this);
@@ -4944,8 +4938,8 @@ class TreeTableComponent extends AbstractTableComponent {
4944
4938
  this.expansionModel = new TreeExpansionModel({ disposedWith: this });
4945
4939
  }
4946
4940
  // 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$);
4941
+ const visibleRows$ = new FlattenedTreeListModel(this._dataSource$, row => this.treeTableModel.childExtractor(row), this.expansionModel);
4942
+ this.expansionModel.bindToTable(this._dataSource$, visibleRows$);
4949
4943
  this.treeTableModel.useExpansionModel(this.expansionModel);
4950
4944
  this._visibleRows$.setDelegate(visibleRows$);
4951
4945
  }