@datorama/core 21.4.0-rc.4 → 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 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;
@@ -11606,6 +11606,17 @@
11606
11606
  GridQuery.prototype.selectFilter = function () {
11607
11607
  return this.select(function (state) { return state.settings.filter; });
11608
11608
  };
11609
+ GridQuery.prototype.filterChanged = function () {
11610
+ return this.selectFilter().pipe(operators.map(function (filter) {
11611
+ return Object.keys(filter).reduce(function (filters, key) {
11612
+ if (filter[key]) {
11613
+ var _a = filter[key], conditional = _a.conditional, pivotFieldsMap = _a.pivotFieldsMap;
11614
+ filters.push({ column: key, filter: conditional, pivotFieldsMap: pivotFieldsMap });
11615
+ }
11616
+ return filters;
11617
+ }, []);
11618
+ }));
11619
+ };
11609
11620
  GridQuery.prototype.getSearchTerm = function () {
11610
11621
  return this.getValue().settings.searchTerm;
11611
11622
  };
@@ -11758,7 +11769,7 @@
11758
11769
  function validateStringCondition(rowValue, _a) {
11759
11770
  var condition = _a.condition, filterValue = _a.value;
11760
11771
  var filterTextLowerCase = filterValue ? filterValue.toLowerCase() : '';
11761
- var valueLowerCase = rowValue ? rowValue.toLowerCase() : '';
11772
+ var valueLowerCase = rowValue ? ("" + rowValue).toLowerCase() : '';
11762
11773
  switch (condition) {
11763
11774
  case exports.DatoFilterConditions.EQUALS:
11764
11775
  return valueLowerCase === filterTextLowerCase;
@@ -11849,7 +11860,7 @@
11849
11860
  var currentRowPivotKeys = row.parent.childrenMapped && getRowPivotKeys(row.parent.childrenMapped);
11850
11861
  var rowValue = api.getValue(filter, row);
11851
11862
  /** If value is under a pivoted column but doesn't match the filter pivot */
11852
- if (pivotKeys && !isArrayValuesEqual(pivotKeys, currentRowPivotKeys)) {
11863
+ if (pivotKeys && pivotKeys.length > 0 && !isArrayValuesEqual(pivotKeys, currentRowPivotKeys)) {
11853
11864
  return { value: true };
11854
11865
  }
11855
11866
  if (conditional) {
@@ -12940,11 +12951,15 @@
12940
12951
  return this.columnValues.filter(function (value) { return !includedSet.has(value); });
12941
12952
  };
12942
12953
  DatoGridFilterComponent.prototype.buildFilter = function () {
12954
+ var _this = this;
12943
12955
  var _a = this.filterForm.value, byValue = _a.byValue, conditional = _a.conditional;
12944
12956
  var filter = {};
12945
12957
  filter.pivotKeys = this.pivotKeys;
12946
12958
  if (this.pivotColumn) {
12947
- filter.pivotFields = this.getPivotFields(this.pivotColumn.getParent());
12959
+ filter.pivotFieldsMap = this.getPivotFields(this.pivotColumn.getParent()).reduce(function (fieldMap, field, index) {
12960
+ fieldMap[field] = _this.pivotKeys[index];
12961
+ return fieldMap;
12962
+ }, {});
12948
12963
  }
12949
12964
  if (this.filterSections.Conditional) {
12950
12965
  this.setConditionalFilter(filter, conditional);
@@ -13280,10 +13295,11 @@
13280
13295
  DatoGridFilterComponent.prototype.getPivotFields = function (parent, fields) {
13281
13296
  if (fields === void 0) { fields = []; }
13282
13297
  var grandParent = parent.getParent();
13298
+ var headerClass = parent.getOriginalColumnGroup().getColGroupDef().headerClass;
13283
13299
  if (grandParent) {
13284
13300
  this.getPivotFields(grandParent, fields);
13285
13301
  }
13286
- fields.push(parent.getOriginalColumnGroup().getColGroupDef().headerClass);
13302
+ headerClass && fields.push(headerClass[0]);
13287
13303
  return fields;
13288
13304
  };
13289
13305
  DatoGridFilterComponent.ctorParameters = function () { return [
@@ -14883,8 +14899,22 @@
14883
14899
  gridOptions.processSecondaryColGroupDef = function (colGroupDef) {
14884
14900
  if (colGroupDef.headerName) {
14885
14901
  var _a = JSON.parse(colGroupDef.headerName), field = _a.field, value = _a.value;
14886
- colGroupDef.headerClass = field;
14902
+ colGroupDef.headerClass = [field];
14887
14903
  colGroupDef.headerName = value;
14904
+ if (colGroupDef.children && colGroupDef.children.length > 1) {
14905
+ colGroupDef.headerClass.push('group-pivot-cell');
14906
+ }
14907
+ }
14908
+ else if (colGroupDef.children) {
14909
+ var _b = __read(colGroupDef.children, 1), colChild = _b[0];
14910
+ var pivotTotalColumnIds = colChild && colChild.pivotTotalColumnIds;
14911
+ if (pivotTotalColumnIds && pivotTotalColumnIds.length > 0) {
14912
+ colGroupDef.headerClass = ['total-pivot-cell'];
14913
+ colGroupDef.headerName = 'Total';
14914
+ }
14915
+ }
14916
+ else {
14917
+ colGroupDef.headerClass = ['empty-pivot-header'];
14888
14918
  }
14889
14919
  if (colGroupDef.pivotKeys) {
14890
14920
  colGroupDef.pivotKeys = colGroupDef.pivotKeys.map(function (key) { return JSON.parse(key).value; });
@@ -15428,7 +15458,7 @@
15428
15458
  this.gridService.setRows(data);
15429
15459
  };
15430
15460
  DatoGridControllerComponent.prototype.onFilterChanged = function () {
15431
- return this.gridQuery.selectFilter();
15461
+ return this.gridQuery.filterChanged();
15432
15462
  };
15433
15463
  DatoGridControllerComponent.prototype.onSortChanged = function () {
15434
15464
  return this.gridQuery.selectSort();