@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.
- package/esm2020/lib/components/tables/abstract-table-model.mjs +8 -1
- package/esm2020/lib/components/tables/abstract-table.component.mjs +9 -20
- package/esm2020/lib/components/tables/table/table-model.mjs +6 -4
- package/esm2020/lib/components/tables/table/table.component.mjs +3 -3
- package/esm2020/lib/components/tables/tree-table/tree-table-component.mjs +3 -3
- package/esm2020/lib/components/tables/tree-table/tree-table-model.mjs +3 -2
- package/fesm2015/coolon-angular-ui-powerups.mjs +25 -25
- package/fesm2015/coolon-angular-ui-powerups.mjs.map +1 -1
- package/fesm2020/coolon-angular-ui-powerups.mjs +25 -25
- package/fesm2020/coolon-angular-ui-powerups.mjs.map +1 -1
- package/lib/components/tables/abstract-table-model.d.ts +3 -0
- package/lib/components/tables/abstract-table.component.d.ts +2 -3
- package/lib/components/tables/table/table-model.d.ts +2 -2
- package/lib/components/tables/tree-table/tree-table-model.d.ts +2 -2
- package/package.json +2 -2
|
@@ -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.
|
|
2906
|
-
when(chain(this.
|
|
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.
|
|
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: {
|
|
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: {
|
|
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
|
|
@@ -3723,6 +3712,10 @@ class AbstractTableModel extends GarbageCollector {
|
|
|
3723
3712
|
this.firstVisibleColumn$ = chain(this._columnList).first();
|
|
3724
3713
|
this.lastVisibleColumn$ = chain(this._columnList).last();
|
|
3725
3714
|
this.rowSelectionDisabledOnAllColumns$ = chain(this._columnList).select(column => column.isRowSelectionEnabled()).count().equals(0);
|
|
3715
|
+
this.dataSourceEmpty$ = chain(this.dataSource$).isEmpty();
|
|
3716
|
+
}
|
|
3717
|
+
setDataSource(dataSource$) {
|
|
3718
|
+
this._dataSource$.setDelegate(dataSource$);
|
|
3726
3719
|
}
|
|
3727
3720
|
/**
|
|
3728
3721
|
* Todo: make this force one table at a time
|
|
@@ -3742,6 +3735,9 @@ class AbstractTableModel extends GarbageCollector {
|
|
|
3742
3735
|
this.columns.value.forEach(c => c.initialise(customInjector));
|
|
3743
3736
|
this.identityOf = identityOf;
|
|
3744
3737
|
}
|
|
3738
|
+
get dataSource$() {
|
|
3739
|
+
return this._dataSource$.readonly;
|
|
3740
|
+
}
|
|
3745
3741
|
get visibleRows$() {
|
|
3746
3742
|
return this._visibleRows$.readonly;
|
|
3747
3743
|
}
|
|
@@ -3966,11 +3962,14 @@ TrackExternal.oneTimeBinding(AbstractTableModel);
|
|
|
3966
3962
|
* });
|
|
3967
3963
|
*/
|
|
3968
3964
|
class TableModel extends AbstractTableModel {
|
|
3969
|
-
constructor(builder) {
|
|
3965
|
+
constructor(sourceOfTruth, builder) {
|
|
3970
3966
|
super();
|
|
3971
|
-
if (
|
|
3967
|
+
if (builder) {
|
|
3972
3968
|
builder(this);
|
|
3973
3969
|
}
|
|
3970
|
+
if (sourceOfTruth) {
|
|
3971
|
+
this.setDataSource(sourceOfTruth);
|
|
3972
|
+
}
|
|
3974
3973
|
}
|
|
3975
3974
|
addSelectionColumn(selectionModel, showSelectionColumn) {
|
|
3976
3975
|
return this._addSelectionColumn(selectionModel, showSelectionColumn);
|
|
@@ -4285,12 +4284,12 @@ class TableComponent extends AbstractTableComponent {
|
|
|
4285
4284
|
ngOnInit() {
|
|
4286
4285
|
super.ngOnInit();
|
|
4287
4286
|
if (this.filterModel) {
|
|
4288
|
-
this.registerDisposable(this.filterModel.bindToTable(this.
|
|
4287
|
+
this.registerDisposable(this.filterModel.bindToTable(this._dataSource$, this.getModel().textSearchPredicate$));
|
|
4289
4288
|
this.highlightText$.setDelegate(this.filterModel.highlightText$);
|
|
4290
4289
|
this._filteredRows$.setDelegate(this.filterModel.filteredRows$);
|
|
4291
4290
|
}
|
|
4292
4291
|
else {
|
|
4293
|
-
this._filteredRows$.setDelegate(this.
|
|
4292
|
+
this._filteredRows$.setDelegate(this._dataSource$);
|
|
4294
4293
|
}
|
|
4295
4294
|
this.configurePaging(this.enablePaging$.value);
|
|
4296
4295
|
}
|
|
@@ -4825,13 +4824,14 @@ class TreeLabelColumnModel extends ColumnModel {
|
|
|
4825
4824
|
// - Add a predicate to check default expansion (i.e. has children of a certain type)
|
|
4826
4825
|
//
|
|
4827
4826
|
class TreeTableModel extends AbstractTableModel {
|
|
4828
|
-
constructor(childAccessor, builder) {
|
|
4827
|
+
constructor(source$, childAccessor, builder) {
|
|
4829
4828
|
super();
|
|
4830
4829
|
this._isExpandedPredicate$ = this.registerDisposable(new DelegatingValueModel());
|
|
4831
4830
|
if (builder)
|
|
4832
4831
|
builder(this);
|
|
4833
4832
|
this.childExtractor = isFunction(childAccessor) ? childAccessor : row => row[childAccessor];
|
|
4834
4833
|
this.addRowClass('aup-node-collapsed', row => this.isCollapsed(row));
|
|
4834
|
+
this.setDataSource(source$);
|
|
4835
4835
|
}
|
|
4836
4836
|
get isExpandedPredicate$() {
|
|
4837
4837
|
return this._isExpandedPredicate$.readonly;
|
|
@@ -4983,8 +4983,8 @@ class TreeTableComponent extends AbstractTableComponent {
|
|
|
4983
4983
|
this.expansionModel = new TreeExpansionModel({ disposedWith: this });
|
|
4984
4984
|
}
|
|
4985
4985
|
// Todo, turn this into a plain chain model
|
|
4986
|
-
const visibleRows$ = new FlattenedTreeListModel(this.
|
|
4987
|
-
this.expansionModel.bindToTable(this.
|
|
4986
|
+
const visibleRows$ = new FlattenedTreeListModel(this._dataSource$, row => this.treeTableModel.childExtractor(row), this.expansionModel);
|
|
4987
|
+
this.expansionModel.bindToTable(this._dataSource$, visibleRows$);
|
|
4988
4988
|
this.treeTableModel.useExpansionModel(this.expansionModel);
|
|
4989
4989
|
this._visibleRows$.setDelegate(visibleRows$);
|
|
4990
4990
|
}
|