@datorama/core 21.4.0-rc.2 → 21.4.0-rc.5
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/bundle.scss +8 -1
- package/bundles/datorama-core.umd.js +55 -15
- package/bundles/datorama-core.umd.js.map +1 -1
- package/bundles/datorama-core.umd.min.js +40 -40
- 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-filter/filter-validator.js +3 -3
- package/esm2015/lib/grid-v2/grid-filter/grid-filter.component.js +7 -3
- package/esm2015/lib/grid-v2/grid-filter/grid-filter.types.js +1 -1
- package/esm2015/lib/grid-v2/grid-store/grid.query.js +31 -9
- package/esm2015/lib/grid-v2/grid-store/grid.service.js +17 -3
- package/esm5/lib/grid-v2/grid-controller/grid-controller.component.js +2 -2
- package/esm5/lib/grid-v2/grid-filter/filter-validator.js +3 -3
- package/esm5/lib/grid-v2/grid-filter/grid-filter.component.js +8 -3
- package/esm5/lib/grid-v2/grid-filter/grid-filter.types.js +1 -1
- package/esm5/lib/grid-v2/grid-store/grid.query.js +31 -9
- package/esm5/lib/grid-v2/grid-store/grid.service.js +17 -3
- package/fesm2015/datorama-core.js +54 -15
- package/fesm2015/datorama-core.js.map +1 -1
- package/fesm5/datorama-core.js +55 -15
- package/fesm5/datorama-core.js.map +1 -1
- package/lib/grid-v2/grid-controller/grid-controller.component.d.ts +2 -2
- package/lib/grid-v2/grid-filter/grid-filter.types.d.ts +6 -1
- package/lib/grid-v2/grid-store/grid.query.d.ts +2 -1
- package/package.json +1 -1
|
@@ -10081,14 +10081,24 @@ let GridQuery = class GridQuery extends Query {
|
|
|
10081
10081
|
return settings;
|
|
10082
10082
|
}
|
|
10083
10083
|
getSort() {
|
|
10084
|
-
|
|
10085
|
-
|
|
10086
|
-
|
|
10087
|
-
|
|
10088
|
-
|
|
10089
|
-
|
|
10090
|
-
|
|
10091
|
-
|
|
10084
|
+
if (this.gridRef.gridOptions.pivotMode) {
|
|
10085
|
+
const { sort, colId } = this.api.grid.getSortModel().pop() || {};
|
|
10086
|
+
const column = this.api.columns.getColumn(colId);
|
|
10087
|
+
const secondaryColumns = this.api.columns.getSecondaryColumns();
|
|
10088
|
+
const pivotedColumn = secondaryColumns && secondaryColumns.find(col => col.getColId() === colId);
|
|
10089
|
+
if (pivotedColumn) {
|
|
10090
|
+
const uniquePivotParents = uniq(secondaryColumns.map(column => column.getParent()));
|
|
10091
|
+
const secondaryColumn = secondaryColumns.find(col => col.getColId() === pivotedColumn.getColId());
|
|
10092
|
+
const pivotColIndex = uniquePivotParents.indexOf(secondaryColumn.getParent());
|
|
10093
|
+
return { colId: getColField(pivotedColumn.getColDef()), sort, pivotColIndex };
|
|
10094
|
+
}
|
|
10095
|
+
else if (column) {
|
|
10096
|
+
return { colId: getColField(column.getColDef()), sort };
|
|
10097
|
+
}
|
|
10098
|
+
}
|
|
10099
|
+
else {
|
|
10100
|
+
return this.api.grid.getSortModel().pop();
|
|
10101
|
+
}
|
|
10092
10102
|
}
|
|
10093
10103
|
selectSort() {
|
|
10094
10104
|
return this.select(state => state.settings.sort);
|
|
@@ -10112,6 +10122,17 @@ let GridQuery = class GridQuery extends Query {
|
|
|
10112
10122
|
selectFilter() {
|
|
10113
10123
|
return this.select(state => state.settings.filter);
|
|
10114
10124
|
}
|
|
10125
|
+
filterChanged() {
|
|
10126
|
+
return this.selectFilter().pipe(map$1(filter => {
|
|
10127
|
+
return Object.keys(filter).reduce((filters, key) => {
|
|
10128
|
+
if (filter[key]) {
|
|
10129
|
+
const { conditional, pivotFieldsMap } = filter[key];
|
|
10130
|
+
filters.push({ column: key, filter: conditional, pivotFieldsMap });
|
|
10131
|
+
}
|
|
10132
|
+
return filters;
|
|
10133
|
+
}, []);
|
|
10134
|
+
}));
|
|
10135
|
+
}
|
|
10115
10136
|
getSearchTerm() {
|
|
10116
10137
|
return this.getValue().settings.searchTerm;
|
|
10117
10138
|
}
|
|
@@ -10261,7 +10282,7 @@ var OperatorTypes;
|
|
|
10261
10282
|
|
|
10262
10283
|
function validateStringCondition(rowValue, { condition, value: filterValue }) {
|
|
10263
10284
|
const filterTextLowerCase = filterValue ? filterValue.toLowerCase() : '';
|
|
10264
|
-
const valueLowerCase = rowValue ? rowValue
|
|
10285
|
+
const valueLowerCase = rowValue ? `${rowValue}`.toLowerCase() : '';
|
|
10265
10286
|
switch (condition) {
|
|
10266
10287
|
case DatoFilterConditions.EQUALS:
|
|
10267
10288
|
return valueLowerCase === filterTextLowerCase;
|
|
@@ -10347,7 +10368,7 @@ function validateFilter({ row, api }, activeFilters) {
|
|
|
10347
10368
|
const currentRowPivotKeys = row.parent.childrenMapped && getRowPivotKeys(row.parent.childrenMapped);
|
|
10348
10369
|
const rowValue = api.getValue(filter, row);
|
|
10349
10370
|
/** If value is under a pivoted column but doesn't match the filter pivot */
|
|
10350
|
-
if (pivotKeys && !isArrayValuesEqual(pivotKeys, currentRowPivotKeys)) {
|
|
10371
|
+
if (pivotKeys && pivotKeys.length > 0 && !isArrayValuesEqual(pivotKeys, currentRowPivotKeys)) {
|
|
10351
10372
|
return true;
|
|
10352
10373
|
}
|
|
10353
10374
|
if (conditional) {
|
|
@@ -11313,7 +11334,10 @@ let DatoGridFilterComponent = class DatoGridFilterComponent {
|
|
|
11313
11334
|
const filter = {};
|
|
11314
11335
|
filter.pivotKeys = this.pivotKeys;
|
|
11315
11336
|
if (this.pivotColumn) {
|
|
11316
|
-
filter.
|
|
11337
|
+
filter.pivotFieldsMap = this.getPivotFields(this.pivotColumn.getParent()).reduce((fieldMap, field, index) => {
|
|
11338
|
+
fieldMap[field] = this.pivotKeys[index];
|
|
11339
|
+
return fieldMap;
|
|
11340
|
+
}, {});
|
|
11317
11341
|
}
|
|
11318
11342
|
if (this.filterSections.Conditional) {
|
|
11319
11343
|
this.setConditionalFilter(filter, conditional);
|
|
@@ -11626,10 +11650,11 @@ let DatoGridFilterComponent = class DatoGridFilterComponent {
|
|
|
11626
11650
|
*/
|
|
11627
11651
|
getPivotFields(parent, fields = []) {
|
|
11628
11652
|
const grandParent = parent.getParent();
|
|
11653
|
+
const headerClass = parent.getOriginalColumnGroup().getColGroupDef().headerClass;
|
|
11629
11654
|
if (grandParent) {
|
|
11630
11655
|
this.getPivotFields(grandParent, fields);
|
|
11631
11656
|
}
|
|
11632
|
-
fields.push(
|
|
11657
|
+
headerClass && fields.push(headerClass[0]);
|
|
11633
11658
|
return fields;
|
|
11634
11659
|
}
|
|
11635
11660
|
};
|
|
@@ -13074,7 +13099,7 @@ let GridService = class GridService {
|
|
|
13074
13099
|
*/
|
|
13075
13100
|
initPivotSecondaryColsProcess({ gridOptions }) {
|
|
13076
13101
|
gridOptions.processSecondaryColDef = colDef => {
|
|
13077
|
-
const api = colDef.headerComponentParams.gridQuery.api;
|
|
13102
|
+
const api = colDef.headerComponentParams && colDef.headerComponentParams.gridQuery.api;
|
|
13078
13103
|
if (api) {
|
|
13079
13104
|
const valueColumns = colDef.headerComponentParams.gridQuery.api.columns.getValueColumns();
|
|
13080
13105
|
const originalColDef = valueColumns
|
|
@@ -13091,8 +13116,22 @@ let GridService = class GridService {
|
|
|
13091
13116
|
gridOptions.processSecondaryColGroupDef = (colGroupDef) => {
|
|
13092
13117
|
if (colGroupDef.headerName) {
|
|
13093
13118
|
const { field, value } = JSON.parse(colGroupDef.headerName);
|
|
13094
|
-
colGroupDef.headerClass = field;
|
|
13119
|
+
colGroupDef.headerClass = [field];
|
|
13095
13120
|
colGroupDef.headerName = value;
|
|
13121
|
+
if (colGroupDef.children && colGroupDef.children.length > 1) {
|
|
13122
|
+
colGroupDef.headerClass.push('group-pivot-cell');
|
|
13123
|
+
}
|
|
13124
|
+
}
|
|
13125
|
+
else if (colGroupDef.children) {
|
|
13126
|
+
const [colChild] = colGroupDef.children;
|
|
13127
|
+
const pivotTotalColumnIds = colChild && colChild.pivotTotalColumnIds;
|
|
13128
|
+
if (pivotTotalColumnIds && pivotTotalColumnIds.length > 0) {
|
|
13129
|
+
colGroupDef.headerClass = ['total-pivot-cell'];
|
|
13130
|
+
colGroupDef.headerName = 'Total';
|
|
13131
|
+
}
|
|
13132
|
+
}
|
|
13133
|
+
else {
|
|
13134
|
+
colGroupDef.headerClass = ['empty-pivot-header'];
|
|
13096
13135
|
}
|
|
13097
13136
|
if (colGroupDef.pivotKeys) {
|
|
13098
13137
|
colGroupDef.pivotKeys = colGroupDef.pivotKeys.map(key => JSON.parse(key).value);
|
|
@@ -13596,7 +13635,7 @@ let DatoGridControllerComponent = class DatoGridControllerComponent {
|
|
|
13596
13635
|
this.gridService.setRows(data);
|
|
13597
13636
|
}
|
|
13598
13637
|
onFilterChanged() {
|
|
13599
|
-
return this.gridQuery.
|
|
13638
|
+
return this.gridQuery.filterChanged();
|
|
13600
13639
|
}
|
|
13601
13640
|
onSortChanged() {
|
|
13602
13641
|
return this.gridQuery.selectSort();
|