@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
package/fesm5/datorama-core.js
CHANGED
|
@@ -11366,14 +11366,24 @@ var GridQuery = /** @class */ (function (_super) {
|
|
|
11366
11366
|
return settings;
|
|
11367
11367
|
};
|
|
11368
11368
|
GridQuery.prototype.getSort = function () {
|
|
11369
|
-
|
|
11370
|
-
|
|
11371
|
-
|
|
11372
|
-
|
|
11373
|
-
|
|
11374
|
-
|
|
11375
|
-
|
|
11376
|
-
|
|
11369
|
+
if (this.gridRef.gridOptions.pivotMode) {
|
|
11370
|
+
var _a = this.api.grid.getSortModel().pop() || {}, sort = _a.sort, colId_1 = _a.colId;
|
|
11371
|
+
var column = this.api.columns.getColumn(colId_1);
|
|
11372
|
+
var secondaryColumns = this.api.columns.getSecondaryColumns();
|
|
11373
|
+
var pivotedColumn_1 = secondaryColumns && secondaryColumns.find(function (col) { return col.getColId() === colId_1; });
|
|
11374
|
+
if (pivotedColumn_1) {
|
|
11375
|
+
var uniquePivotParents = uniq(secondaryColumns.map(function (column) { return column.getParent(); }));
|
|
11376
|
+
var secondaryColumn = secondaryColumns.find(function (col) { return col.getColId() === pivotedColumn_1.getColId(); });
|
|
11377
|
+
var pivotColIndex = uniquePivotParents.indexOf(secondaryColumn.getParent());
|
|
11378
|
+
return { colId: getColField(pivotedColumn_1.getColDef()), sort: sort, pivotColIndex: pivotColIndex };
|
|
11379
|
+
}
|
|
11380
|
+
else if (column) {
|
|
11381
|
+
return { colId: getColField(column.getColDef()), sort: sort };
|
|
11382
|
+
}
|
|
11383
|
+
}
|
|
11384
|
+
else {
|
|
11385
|
+
return this.api.grid.getSortModel().pop();
|
|
11386
|
+
}
|
|
11377
11387
|
};
|
|
11378
11388
|
GridQuery.prototype.selectSort = function () {
|
|
11379
11389
|
return this.select(function (state) { return state.settings.sort; });
|
|
@@ -11397,6 +11407,17 @@ var GridQuery = /** @class */ (function (_super) {
|
|
|
11397
11407
|
GridQuery.prototype.selectFilter = function () {
|
|
11398
11408
|
return this.select(function (state) { return state.settings.filter; });
|
|
11399
11409
|
};
|
|
11410
|
+
GridQuery.prototype.filterChanged = function () {
|
|
11411
|
+
return this.selectFilter().pipe(map$1(function (filter) {
|
|
11412
|
+
return Object.keys(filter).reduce(function (filters, key) {
|
|
11413
|
+
if (filter[key]) {
|
|
11414
|
+
var _a = filter[key], conditional = _a.conditional, pivotFieldsMap = _a.pivotFieldsMap;
|
|
11415
|
+
filters.push({ column: key, filter: conditional, pivotFieldsMap: pivotFieldsMap });
|
|
11416
|
+
}
|
|
11417
|
+
return filters;
|
|
11418
|
+
}, []);
|
|
11419
|
+
}));
|
|
11420
|
+
};
|
|
11400
11421
|
GridQuery.prototype.getSearchTerm = function () {
|
|
11401
11422
|
return this.getValue().settings.searchTerm;
|
|
11402
11423
|
};
|
|
@@ -11549,7 +11570,7 @@ var OperatorTypes;
|
|
|
11549
11570
|
function validateStringCondition(rowValue, _a) {
|
|
11550
11571
|
var condition = _a.condition, filterValue = _a.value;
|
|
11551
11572
|
var filterTextLowerCase = filterValue ? filterValue.toLowerCase() : '';
|
|
11552
|
-
var valueLowerCase = rowValue ? rowValue.toLowerCase() : '';
|
|
11573
|
+
var valueLowerCase = rowValue ? ("" + rowValue).toLowerCase() : '';
|
|
11553
11574
|
switch (condition) {
|
|
11554
11575
|
case DatoFilterConditions.EQUALS:
|
|
11555
11576
|
return valueLowerCase === filterTextLowerCase;
|
|
@@ -11640,7 +11661,7 @@ function validateFilter(_a, activeFilters) {
|
|
|
11640
11661
|
var currentRowPivotKeys = row.parent.childrenMapped && getRowPivotKeys(row.parent.childrenMapped);
|
|
11641
11662
|
var rowValue = api.getValue(filter, row);
|
|
11642
11663
|
/** If value is under a pivoted column but doesn't match the filter pivot */
|
|
11643
|
-
if (pivotKeys && !isArrayValuesEqual(pivotKeys, currentRowPivotKeys)) {
|
|
11664
|
+
if (pivotKeys && pivotKeys.length > 0 && !isArrayValuesEqual(pivotKeys, currentRowPivotKeys)) {
|
|
11644
11665
|
return { value: true };
|
|
11645
11666
|
}
|
|
11646
11667
|
if (conditional) {
|
|
@@ -12731,11 +12752,15 @@ var DatoGridFilterComponent = /** @class */ (function () {
|
|
|
12731
12752
|
return this.columnValues.filter(function (value) { return !includedSet.has(value); });
|
|
12732
12753
|
};
|
|
12733
12754
|
DatoGridFilterComponent.prototype.buildFilter = function () {
|
|
12755
|
+
var _this = this;
|
|
12734
12756
|
var _a = this.filterForm.value, byValue = _a.byValue, conditional = _a.conditional;
|
|
12735
12757
|
var filter = {};
|
|
12736
12758
|
filter.pivotKeys = this.pivotKeys;
|
|
12737
12759
|
if (this.pivotColumn) {
|
|
12738
|
-
filter.
|
|
12760
|
+
filter.pivotFieldsMap = this.getPivotFields(this.pivotColumn.getParent()).reduce(function (fieldMap, field, index) {
|
|
12761
|
+
fieldMap[field] = _this.pivotKeys[index];
|
|
12762
|
+
return fieldMap;
|
|
12763
|
+
}, {});
|
|
12739
12764
|
}
|
|
12740
12765
|
if (this.filterSections.Conditional) {
|
|
12741
12766
|
this.setConditionalFilter(filter, conditional);
|
|
@@ -13071,10 +13096,11 @@ var DatoGridFilterComponent = /** @class */ (function () {
|
|
|
13071
13096
|
DatoGridFilterComponent.prototype.getPivotFields = function (parent, fields) {
|
|
13072
13097
|
if (fields === void 0) { fields = []; }
|
|
13073
13098
|
var grandParent = parent.getParent();
|
|
13099
|
+
var headerClass = parent.getOriginalColumnGroup().getColGroupDef().headerClass;
|
|
13074
13100
|
if (grandParent) {
|
|
13075
13101
|
this.getPivotFields(grandParent, fields);
|
|
13076
13102
|
}
|
|
13077
|
-
fields.push(
|
|
13103
|
+
headerClass && fields.push(headerClass[0]);
|
|
13078
13104
|
return fields;
|
|
13079
13105
|
};
|
|
13080
13106
|
DatoGridFilterComponent.ctorParameters = function () { return [
|
|
@@ -14651,7 +14677,7 @@ var GridService = /** @class */ (function () {
|
|
|
14651
14677
|
GridService.prototype.initPivotSecondaryColsProcess = function (_a) {
|
|
14652
14678
|
var gridOptions = _a.gridOptions;
|
|
14653
14679
|
gridOptions.processSecondaryColDef = function (colDef) {
|
|
14654
|
-
var api = colDef.headerComponentParams.gridQuery.api;
|
|
14680
|
+
var api = colDef.headerComponentParams && colDef.headerComponentParams.gridQuery.api;
|
|
14655
14681
|
if (api) {
|
|
14656
14682
|
var valueColumns = colDef.headerComponentParams.gridQuery.api.columns.getValueColumns();
|
|
14657
14683
|
var originalColDef = valueColumns
|
|
@@ -14674,8 +14700,22 @@ var GridService = /** @class */ (function () {
|
|
|
14674
14700
|
gridOptions.processSecondaryColGroupDef = function (colGroupDef) {
|
|
14675
14701
|
if (colGroupDef.headerName) {
|
|
14676
14702
|
var _a = JSON.parse(colGroupDef.headerName), field = _a.field, value = _a.value;
|
|
14677
|
-
colGroupDef.headerClass = field;
|
|
14703
|
+
colGroupDef.headerClass = [field];
|
|
14678
14704
|
colGroupDef.headerName = value;
|
|
14705
|
+
if (colGroupDef.children && colGroupDef.children.length > 1) {
|
|
14706
|
+
colGroupDef.headerClass.push('group-pivot-cell');
|
|
14707
|
+
}
|
|
14708
|
+
}
|
|
14709
|
+
else if (colGroupDef.children) {
|
|
14710
|
+
var _b = __read(colGroupDef.children, 1), colChild = _b[0];
|
|
14711
|
+
var pivotTotalColumnIds = colChild && colChild.pivotTotalColumnIds;
|
|
14712
|
+
if (pivotTotalColumnIds && pivotTotalColumnIds.length > 0) {
|
|
14713
|
+
colGroupDef.headerClass = ['total-pivot-cell'];
|
|
14714
|
+
colGroupDef.headerName = 'Total';
|
|
14715
|
+
}
|
|
14716
|
+
}
|
|
14717
|
+
else {
|
|
14718
|
+
colGroupDef.headerClass = ['empty-pivot-header'];
|
|
14679
14719
|
}
|
|
14680
14720
|
if (colGroupDef.pivotKeys) {
|
|
14681
14721
|
colGroupDef.pivotKeys = colGroupDef.pivotKeys.map(function (key) { return JSON.parse(key).value; });
|
|
@@ -15219,7 +15259,7 @@ var DatoGridControllerComponent = /** @class */ (function () {
|
|
|
15219
15259
|
this.gridService.setRows(data);
|
|
15220
15260
|
};
|
|
15221
15261
|
DatoGridControllerComponent.prototype.onFilterChanged = function () {
|
|
15222
|
-
return this.gridQuery.
|
|
15262
|
+
return this.gridQuery.filterChanged();
|
|
15223
15263
|
};
|
|
15224
15264
|
DatoGridControllerComponent.prototype.onSortChanged = function () {
|
|
15225
15265
|
return this.gridQuery.selectSort();
|