@datorama/core 21.4.0-rc.3 → 21.4.0-rc.6
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 +65 -23
- package/bundles/datorama-core.umd.js.map +1 -1
- package/bundles/datorama-core.umd.min.js +49 -49
- 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 +7 -14
- 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 +12 -1
- package/esm2015/lib/grid-v2/grid-store/grid.service.js +33 -9
- package/esm2015/lib/grid-v2/grid-store/grid.store.types.js +1 -1
- package/esm2015/lib/grid-v2/grid-store/util.js +11 -1
- package/esm5/lib/grid-v2/grid-controller/grid-controller.component.js +2 -2
- package/esm5/lib/grid-v2/grid-filter/filter-validator.js +7 -14
- 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 +12 -1
- package/esm5/lib/grid-v2/grid-store/grid.service.js +33 -9
- package/esm5/lib/grid-v2/grid-store/grid.store.types.js +1 -1
- package/esm5/lib/grid-v2/grid-store/util.js +11 -1
- package/fesm2015/datorama-core.js +64 -23
- package/fesm2015/datorama-core.js.map +1 -1
- package/fesm5/datorama-core.js +65 -23
- 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/lib/grid-v2/grid-store/grid.store.types.d.ts +4 -0
- package/lib/grid-v2/grid-store/util.d.ts +2 -0
- package/package.json +1 -1
package/bundle.scss
CHANGED
|
@@ -14386,7 +14386,6 @@ dato-grid-v2 ag-grid-angular.pivot-mode .ag-header-row .ag-header-group-cell .ag
|
|
|
14386
14386
|
|
|
14387
14387
|
dato-grid-v2 ag-grid-angular.pivot-mode .ag-header-row .ag-header-group-cell .ag-header-group-cell-label {
|
|
14388
14388
|
align-items: center;
|
|
14389
|
-
justify-content: center;
|
|
14390
14389
|
}
|
|
14391
14390
|
|
|
14392
14391
|
dato-grid-v2 ag-grid-angular.pivot-mode .ag-header-row .ag-header-group-cell .ag-header-group-cell-label span {
|
|
@@ -14402,6 +14401,14 @@ dato-grid-v2 ag-grid-angular.pivot-mode .ag-header-row .ag-header-group-cell.ag-
|
|
|
14402
14401
|
border-right: 1px solid themify(primary-200);
|
|
14403
14402
|
}
|
|
14404
14403
|
|
|
14404
|
+
dato-grid-v2 ag-grid-angular.pivot-mode .ag-header-row .ag-header-group-cell.ag-header-group-cell-with-group.empty-pivot-header {
|
|
14405
|
+
display: none;
|
|
14406
|
+
}
|
|
14407
|
+
|
|
14408
|
+
dato-grid-v2 ag-grid-angular.pivot-mode .ag-header-row .ag-header-group-cell.ag-header-group-cell-with-group.group-pivot-cell .ag-header-group-cell-label {
|
|
14409
|
+
justify-content: center;
|
|
14410
|
+
}
|
|
14411
|
+
|
|
14405
14412
|
.ag-dnd-ghost {
|
|
14406
14413
|
box-shadow: 0 0 10px -1px themify(primary-700, 0.3);
|
|
14407
14414
|
background-color: themify(primary-100) !important;
|
|
@@ -11466,6 +11466,16 @@
|
|
|
11466
11466
|
var field = colDef.field, showRowGroup = colDef.showRowGroup, pivotValueColumn = colDef.pivotValueColumn;
|
|
11467
11467
|
return pivotValueColumn ? pivotValueColumn.getColId() : field || showRowGroup;
|
|
11468
11468
|
}
|
|
11469
|
+
function tryParsePivotValue(str) {
|
|
11470
|
+
var value;
|
|
11471
|
+
try {
|
|
11472
|
+
value = JSON.parse(str);
|
|
11473
|
+
}
|
|
11474
|
+
catch (e) {
|
|
11475
|
+
console.error("Can't parse " + str + " from JSON");
|
|
11476
|
+
}
|
|
11477
|
+
return value;
|
|
11478
|
+
}
|
|
11469
11479
|
|
|
11470
11480
|
var GridQuery = /** @class */ (function (_super) {
|
|
11471
11481
|
__extends(GridQuery, _super);
|
|
@@ -11606,6 +11616,17 @@
|
|
|
11606
11616
|
GridQuery.prototype.selectFilter = function () {
|
|
11607
11617
|
return this.select(function (state) { return state.settings.filter; });
|
|
11608
11618
|
};
|
|
11619
|
+
GridQuery.prototype.filterChanged = function () {
|
|
11620
|
+
return this.selectFilter().pipe(operators.map(function (filter) {
|
|
11621
|
+
return Object.keys(filter).reduce(function (filters, key) {
|
|
11622
|
+
if (filter[key]) {
|
|
11623
|
+
var _a = filter[key], conditional = _a.conditional, pivotFieldsMap = _a.pivotFieldsMap;
|
|
11624
|
+
filters.push({ column: key, filter: conditional, pivotFieldsMap: pivotFieldsMap });
|
|
11625
|
+
}
|
|
11626
|
+
return filters;
|
|
11627
|
+
}, []);
|
|
11628
|
+
}));
|
|
11629
|
+
};
|
|
11609
11630
|
GridQuery.prototype.getSearchTerm = function () {
|
|
11610
11631
|
return this.getValue().settings.searchTerm;
|
|
11611
11632
|
};
|
|
@@ -11758,7 +11779,7 @@
|
|
|
11758
11779
|
function validateStringCondition(rowValue, _a) {
|
|
11759
11780
|
var condition = _a.condition, filterValue = _a.value;
|
|
11760
11781
|
var filterTextLowerCase = filterValue ? filterValue.toLowerCase() : '';
|
|
11761
|
-
var valueLowerCase = rowValue ? rowValue.toLowerCase() : '';
|
|
11782
|
+
var valueLowerCase = rowValue ? ("" + rowValue).toLowerCase() : '';
|
|
11762
11783
|
switch (condition) {
|
|
11763
11784
|
case exports.DatoFilterConditions.EQUALS:
|
|
11764
11785
|
return valueLowerCase === filterTextLowerCase;
|
|
@@ -11849,7 +11870,7 @@
|
|
|
11849
11870
|
var currentRowPivotKeys = row.parent.childrenMapped && getRowPivotKeys(row.parent.childrenMapped);
|
|
11850
11871
|
var rowValue = api.getValue(filter, row);
|
|
11851
11872
|
/** If value is under a pivoted column but doesn't match the filter pivot */
|
|
11852
|
-
if (pivotKeys && !isArrayValuesEqual(pivotKeys, currentRowPivotKeys)) {
|
|
11873
|
+
if (pivotKeys && pivotKeys.length > 0 && !isArrayValuesEqual(pivotKeys, currentRowPivotKeys)) {
|
|
11853
11874
|
return { value: true };
|
|
11854
11875
|
}
|
|
11855
11876
|
if (conditional) {
|
|
@@ -11889,17 +11910,9 @@
|
|
|
11889
11910
|
function getRowPivotKeys(childrenMapped, keys) {
|
|
11890
11911
|
if (keys === void 0) { keys = []; }
|
|
11891
11912
|
var key = Object.keys(childrenMapped)[0];
|
|
11892
|
-
var parsedKey;
|
|
11893
|
-
|
|
11894
|
-
|
|
11895
|
-
}
|
|
11896
|
-
catch (e) {
|
|
11897
|
-
console.error("Can't parse " + key + " from JSON");
|
|
11898
|
-
}
|
|
11899
|
-
finally {
|
|
11900
|
-
if (parsedKey) {
|
|
11901
|
-
keys = getRowPivotKeys(childrenMapped[key], __spread(keys, [parsedKey.value]));
|
|
11902
|
-
}
|
|
11913
|
+
var parsedKey = tryParsePivotValue(key);
|
|
11914
|
+
if (parsedKey) {
|
|
11915
|
+
keys = getRowPivotKeys(childrenMapped[key], __spread(keys, [parsedKey.value]));
|
|
11903
11916
|
}
|
|
11904
11917
|
return keys;
|
|
11905
11918
|
}
|
|
@@ -12940,11 +12953,15 @@
|
|
|
12940
12953
|
return this.columnValues.filter(function (value) { return !includedSet.has(value); });
|
|
12941
12954
|
};
|
|
12942
12955
|
DatoGridFilterComponent.prototype.buildFilter = function () {
|
|
12956
|
+
var _this = this;
|
|
12943
12957
|
var _a = this.filterForm.value, byValue = _a.byValue, conditional = _a.conditional;
|
|
12944
12958
|
var filter = {};
|
|
12945
12959
|
filter.pivotKeys = this.pivotKeys;
|
|
12946
12960
|
if (this.pivotColumn) {
|
|
12947
|
-
filter.
|
|
12961
|
+
filter.pivotFieldsMap = this.getPivotFields(this.pivotColumn.getParent()).reduce(function (fieldMap, field, index) {
|
|
12962
|
+
fieldMap[field] = _this.pivotKeys[index];
|
|
12963
|
+
return fieldMap;
|
|
12964
|
+
}, {});
|
|
12948
12965
|
}
|
|
12949
12966
|
if (this.filterSections.Conditional) {
|
|
12950
12967
|
this.setConditionalFilter(filter, conditional);
|
|
@@ -13280,10 +13297,11 @@
|
|
|
13280
13297
|
DatoGridFilterComponent.prototype.getPivotFields = function (parent, fields) {
|
|
13281
13298
|
if (fields === void 0) { fields = []; }
|
|
13282
13299
|
var grandParent = parent.getParent();
|
|
13300
|
+
var headerClass = parent.getOriginalColumnGroup().getColGroupDef().headerClass;
|
|
13283
13301
|
if (grandParent) {
|
|
13284
13302
|
this.getPivotFields(grandParent, fields);
|
|
13285
13303
|
}
|
|
13286
|
-
fields.push(
|
|
13304
|
+
headerClass && fields.push(headerClass[0]);
|
|
13287
13305
|
return fields;
|
|
13288
13306
|
};
|
|
13289
13307
|
DatoGridFilterComponent.ctorParameters = function () { return [
|
|
@@ -14860,7 +14878,7 @@
|
|
|
14860
14878
|
GridService.prototype.initPivotSecondaryColsProcess = function (_a) {
|
|
14861
14879
|
var gridOptions = _a.gridOptions;
|
|
14862
14880
|
gridOptions.processSecondaryColDef = function (colDef) {
|
|
14863
|
-
var api = colDef.headerComponentParams.gridQuery.api;
|
|
14881
|
+
var api = colDef.headerComponentParams && colDef.headerComponentParams.gridQuery.api;
|
|
14864
14882
|
if (api) {
|
|
14865
14883
|
var valueColumns = colDef.headerComponentParams.gridQuery.api.columns.getValueColumns();
|
|
14866
14884
|
var originalColDef = valueColumns
|
|
@@ -14877,17 +14895,40 @@
|
|
|
14877
14895
|
}
|
|
14878
14896
|
}
|
|
14879
14897
|
if (colDef.pivotKeys) {
|
|
14880
|
-
colDef.pivotKeys = colDef.pivotKeys.map(function (key) {
|
|
14898
|
+
colDef.pivotKeys = colDef.pivotKeys.map(function (key) {
|
|
14899
|
+
var parsedKey = tryParsePivotValue(key);
|
|
14900
|
+
return (parsedKey && parsedKey.value) || '';
|
|
14901
|
+
});
|
|
14881
14902
|
}
|
|
14882
14903
|
};
|
|
14883
14904
|
gridOptions.processSecondaryColGroupDef = function (colGroupDef) {
|
|
14884
14905
|
if (colGroupDef.headerName) {
|
|
14885
|
-
var
|
|
14886
|
-
|
|
14887
|
-
|
|
14906
|
+
var parsedValue = tryParsePivotValue(colGroupDef.headerName);
|
|
14907
|
+
if (parsedValue) {
|
|
14908
|
+
var field = parsedValue.field, value = parsedValue.value;
|
|
14909
|
+
colGroupDef.headerClass = [field];
|
|
14910
|
+
colGroupDef.headerName = value;
|
|
14911
|
+
if (colGroupDef.children && colGroupDef.children.length > 1) {
|
|
14912
|
+
colGroupDef.headerClass.push('group-pivot-cell');
|
|
14913
|
+
}
|
|
14914
|
+
}
|
|
14915
|
+
}
|
|
14916
|
+
else if (colGroupDef.children) {
|
|
14917
|
+
var _a = __read(colGroupDef.children, 1), colChild = _a[0];
|
|
14918
|
+
var pivotTotalColumnIds = colChild && colChild.pivotTotalColumnIds;
|
|
14919
|
+
if (pivotTotalColumnIds && pivotTotalColumnIds.length > 0) {
|
|
14920
|
+
colGroupDef.headerClass = ['total-pivot-cell'];
|
|
14921
|
+
colGroupDef.headerName = 'Total';
|
|
14922
|
+
}
|
|
14923
|
+
}
|
|
14924
|
+
else {
|
|
14925
|
+
colGroupDef.headerClass = ['empty-pivot-header'];
|
|
14888
14926
|
}
|
|
14889
14927
|
if (colGroupDef.pivotKeys) {
|
|
14890
|
-
colGroupDef.pivotKeys = colGroupDef.pivotKeys.map(function (key) {
|
|
14928
|
+
colGroupDef.pivotKeys = colGroupDef.pivotKeys.map(function (key) {
|
|
14929
|
+
var parsedKey = tryParsePivotValue(key);
|
|
14930
|
+
return (parsedKey && parsedKey.value) || '';
|
|
14931
|
+
});
|
|
14891
14932
|
}
|
|
14892
14933
|
};
|
|
14893
14934
|
};
|
|
@@ -14900,7 +14941,8 @@
|
|
|
14900
14941
|
for (var pivotColumns_1 = __values(pivotColumns), pivotColumns_1_1 = pivotColumns_1.next(); !pivotColumns_1_1.done; pivotColumns_1_1 = pivotColumns_1.next()) {
|
|
14901
14942
|
var col = pivotColumns_1_1.value;
|
|
14902
14943
|
var field = col.getColDef().field;
|
|
14903
|
-
|
|
14944
|
+
var pivotValue = { field: field, value: currentValue[field] };
|
|
14945
|
+
mappedValues[field] = JSON.stringify(pivotValue);
|
|
14904
14946
|
}
|
|
14905
14947
|
}
|
|
14906
14948
|
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
@@ -15428,7 +15470,7 @@
|
|
|
15428
15470
|
this.gridService.setRows(data);
|
|
15429
15471
|
};
|
|
15430
15472
|
DatoGridControllerComponent.prototype.onFilterChanged = function () {
|
|
15431
|
-
return this.gridQuery.
|
|
15473
|
+
return this.gridQuery.filterChanged();
|
|
15432
15474
|
};
|
|
15433
15475
|
DatoGridControllerComponent.prototype.onSortChanged = function () {
|
|
15434
15476
|
return this.gridQuery.selectSort();
|