@datorama/core 22.6.2 → 22.7.1
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/bundles/datorama-core.umd.js +38 -41
- package/bundles/datorama-core.umd.js.map +1 -1
- package/bundles/datorama-core.umd.min.js +3 -3
- package/bundles/datorama-core.umd.min.js.map +1 -1
- package/datorama-core.metadata.json +1 -1
- package/esm2015/lib/grid-v2/grid-controller/grid-controller.component.js +2 -2
- package/esm2015/lib/grid-v2/grid-store/grid.query.js +19 -19
- package/esm2015/lib/grid-v2/grid-store/grid.service.js +19 -22
- package/esm2015/lib/version.js +2 -2
- package/esm5/lib/grid-v2/grid-controller/grid-controller.component.js +2 -2
- package/esm5/lib/grid-v2/grid-store/grid.query.js +19 -19
- package/esm5/lib/grid-v2/grid-store/grid.service.js +19 -22
- package/esm5/lib/version.js +2 -2
- package/fesm2015/datorama-core.js +38 -41
- package/fesm2015/datorama-core.js.map +1 -1
- package/fesm5/datorama-core.js +38 -41
- package/fesm5/datorama-core.js.map +1 -1
- package/lib/grid-v2/grid-store/grid.query.d.ts +1 -0
- package/package.json +1 -1
|
@@ -10112,26 +10112,26 @@ let GridQuery = class GridQuery extends Query {
|
|
|
10112
10112
|
return settings;
|
|
10113
10113
|
}
|
|
10114
10114
|
getSort() {
|
|
10115
|
-
|
|
10116
|
-
|
|
10117
|
-
|
|
10118
|
-
|
|
10119
|
-
|
|
10120
|
-
|
|
10121
|
-
|
|
10122
|
-
|
|
10123
|
-
|
|
10124
|
-
|
|
10125
|
-
|
|
10126
|
-
|
|
10127
|
-
|
|
10128
|
-
|
|
10129
|
-
|
|
10130
|
-
|
|
10131
|
-
|
|
10115
|
+
return this.api.grid.getSortModel().pop();
|
|
10116
|
+
}
|
|
10117
|
+
getExternalSort() {
|
|
10118
|
+
const { sort, colId } = this.getSort() || {};
|
|
10119
|
+
const column = this.api.columns.getColumn(colId);
|
|
10120
|
+
const allColumns = this.api.columns.getAllGridColumns();
|
|
10121
|
+
if (column) {
|
|
10122
|
+
return { colId, sort, field: getColField(column.getColDef()), sortIndex: allColumns.indexOf(column) };
|
|
10123
|
+
}
|
|
10124
|
+
else {
|
|
10125
|
+
const secondaryColumn = this.getSecondaryColumn(colId);
|
|
10126
|
+
if (secondaryColumn) {
|
|
10127
|
+
return {
|
|
10128
|
+
colId,
|
|
10129
|
+
sort,
|
|
10130
|
+
field: getColField(secondaryColumn.getColDef()),
|
|
10131
|
+
sortIndex: allColumns.indexOf(secondaryColumn)
|
|
10132
|
+
};
|
|
10132
10133
|
}
|
|
10133
10134
|
}
|
|
10134
|
-
return this.api.grid.getSortModel().pop();
|
|
10135
10135
|
}
|
|
10136
10136
|
selectSort() {
|
|
10137
10137
|
return this.select(state => state.settings.sort);
|
|
@@ -12722,37 +12722,34 @@ let GridService = class GridService {
|
|
|
12722
12722
|
}
|
|
12723
12723
|
setGridSort(gridSort) {
|
|
12724
12724
|
if (this.api && gridSort) {
|
|
12725
|
-
const { sort, sortIndex
|
|
12725
|
+
const { colId, sort, sortIndex } = gridSort;
|
|
12726
|
+
let sortToApply = gridSort;
|
|
12726
12727
|
if (!isNil(sortIndex)) {
|
|
12727
12728
|
const gridColumns = this.api.columns.getAllGridColumns();
|
|
12728
12729
|
if (gridColumns) {
|
|
12729
|
-
const
|
|
12730
|
-
const
|
|
12731
|
-
|
|
12732
|
-
|
|
12733
|
-
|
|
12734
|
-
|
|
12735
|
-
|
|
12736
|
-
|
|
12737
|
-
const sortToApply = { colId: columnById.getColId(), sort };
|
|
12738
|
-
this.updateSettings({ sort: sortToApply });
|
|
12739
|
-
this.api.grid.setSortModel([sortToApply]);
|
|
12730
|
+
const valueColumns = this.api.columns.getValueColumns();
|
|
12731
|
+
const valueColumn = valueColumns.find((col) => col.getColId() === colId);
|
|
12732
|
+
const isPivotColId = colId.startsWith('pivot');
|
|
12733
|
+
if (isPivotColId || valueColumn) {
|
|
12734
|
+
/** Column is pivot value column, sort by index */
|
|
12735
|
+
const columnByIndex = gridColumns[sortIndex];
|
|
12736
|
+
if (columnByIndex) {
|
|
12737
|
+
sortToApply = { colId: columnByIndex.getColId(), sort };
|
|
12740
12738
|
}
|
|
12741
12739
|
}
|
|
12742
12740
|
else {
|
|
12743
|
-
|
|
12744
|
-
|
|
12745
|
-
|
|
12746
|
-
|
|
12747
|
-
|
|
12741
|
+
/** Sort by column id */
|
|
12742
|
+
const columnById = gridColumns.find((col) => {
|
|
12743
|
+
return (col.getColDef().showRowGroup || col.getColId()) === colId;
|
|
12744
|
+
});
|
|
12745
|
+
if (columnById) {
|
|
12746
|
+
sortToApply = { colId: columnById.getColId(), sort };
|
|
12748
12747
|
}
|
|
12749
12748
|
}
|
|
12750
12749
|
}
|
|
12751
12750
|
}
|
|
12752
|
-
|
|
12753
|
-
|
|
12754
|
-
this.api.grid.setSortModel([gridSort]);
|
|
12755
|
-
}
|
|
12751
|
+
this.updateSettings({ sort: sortToApply });
|
|
12752
|
+
this.api.grid.setSortModel([sortToApply]);
|
|
12756
12753
|
}
|
|
12757
12754
|
}
|
|
12758
12755
|
updateFilter(column, filter) {
|
|
@@ -13821,7 +13818,7 @@ let DatoGridControllerComponent = class DatoGridControllerComponent {
|
|
|
13821
13818
|
const data = this.getGridData();
|
|
13822
13819
|
this.onGridChange.emit({
|
|
13823
13820
|
filter: this.gridQuery.getExternalFilter(),
|
|
13824
|
-
sort: this.gridQuery.
|
|
13821
|
+
sort: this.gridQuery.getExternalSort(),
|
|
13825
13822
|
type,
|
|
13826
13823
|
data
|
|
13827
13824
|
});
|
|
@@ -22694,7 +22691,7 @@ function fixNgLeaks() {
|
|
|
22694
22691
|
};
|
|
22695
22692
|
}
|
|
22696
22693
|
|
|
22697
|
-
window.coreVersion = '22.
|
|
22694
|
+
window.coreVersion = '22.7.1';
|
|
22698
22695
|
|
|
22699
22696
|
/**
|
|
22700
22697
|
* @license
|