@datorama/core 22.6.3 → 22.7.2
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 +40 -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 +21 -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 +21 -22
- package/esm5/lib/version.js +2 -2
- package/fesm2015/datorama-core.js +40 -41
- package/fesm2015/datorama-core.js.map +1 -1
- package/fesm5/datorama-core.js +40 -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);
|
|
@@ -12721,38 +12721,37 @@ let GridService = class GridService {
|
|
|
12721
12721
|
}
|
|
12722
12722
|
}
|
|
12723
12723
|
setGridSort(gridSort) {
|
|
12724
|
-
if (this.api &&
|
|
12725
|
-
const { sort, sortIndex
|
|
12724
|
+
if (gridSort && this.api && this.api.grid.getDisplayedRowCount() > 0) {
|
|
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
|
-
|
|
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
|
+
const pivotValueColumn = columnByIndex && columnByIndex.getColDef().pivotValueColumn;
|
|
12737
|
+
const pivotValueColumnId = pivotValueColumn && pivotValueColumn.getColId();
|
|
12738
|
+
if (pivotValueColumnId === colId) {
|
|
12739
|
+
sortToApply = { colId: columnByIndex.getColId(), sort };
|
|
12740
|
+
}
|
|
12741
|
+
}
|
|
12742
|
+
else {
|
|
12743
|
+
/** Sort by column id */
|
|
12733
12744
|
const columnById = gridColumns.find((col) => {
|
|
12734
12745
|
return (col.getColDef().showRowGroup || col.getColId()) === colId;
|
|
12735
12746
|
});
|
|
12736
12747
|
if (columnById) {
|
|
12737
|
-
|
|
12738
|
-
this.updateSettings({ sort: sortToApply });
|
|
12739
|
-
this.api.grid.setSortModel([sortToApply]);
|
|
12740
|
-
}
|
|
12741
|
-
}
|
|
12742
|
-
else {
|
|
12743
|
-
const columnByIndex = gridColumns[sortIndex];
|
|
12744
|
-
if (columnByIndex) {
|
|
12745
|
-
const sortToApply = { colId: columnByIndex.getColId(), sort };
|
|
12746
|
-
this.updateSettings({ sort: sortToApply });
|
|
12747
|
-
this.api.grid.setSortModel([sortToApply]);
|
|
12748
|
+
sortToApply = { colId: columnById.getColId(), sort };
|
|
12748
12749
|
}
|
|
12749
12750
|
}
|
|
12750
12751
|
}
|
|
12751
12752
|
}
|
|
12752
|
-
|
|
12753
|
-
|
|
12754
|
-
this.api.grid.setSortModel([gridSort]);
|
|
12755
|
-
}
|
|
12753
|
+
this.updateSettings({ sort: sortToApply });
|
|
12754
|
+
this.api.grid.setSortModel([sortToApply]);
|
|
12756
12755
|
}
|
|
12757
12756
|
}
|
|
12758
12757
|
updateFilter(column, filter) {
|
|
@@ -13821,7 +13820,7 @@ let DatoGridControllerComponent = class DatoGridControllerComponent {
|
|
|
13821
13820
|
const data = this.getGridData();
|
|
13822
13821
|
this.onGridChange.emit({
|
|
13823
13822
|
filter: this.gridQuery.getExternalFilter(),
|
|
13824
|
-
sort: this.gridQuery.
|
|
13823
|
+
sort: this.gridQuery.getExternalSort(),
|
|
13825
13824
|
type,
|
|
13826
13825
|
data
|
|
13827
13826
|
});
|
|
@@ -22694,7 +22693,7 @@ function fixNgLeaks() {
|
|
|
22694
22693
|
};
|
|
22695
22694
|
}
|
|
22696
22695
|
|
|
22697
|
-
window.coreVersion = '22.
|
|
22696
|
+
window.coreVersion = '22.7.2';
|
|
22698
22697
|
|
|
22699
22698
|
/**
|
|
22700
22699
|
* @license
|