@datorama/core 21.4.0-rc.12 → 21.4.0-rc.15

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.
@@ -12480,12 +12480,12 @@ var mapToValue = function (_a) {
12480
12480
  var ɵ0$1 = mapToValue;
12481
12481
  var mapToListItem = function (val) { return ({ id: val, label: isNil(val) ? "(Empty)" : ("" + val).trim(), value: val }); };
12482
12482
  var ɵ1$1 = mapToListItem;
12483
- var mapToListItemWithFormatted = function (_a) {
12483
+ var mapToListItemWithFormatted = function (_a, key) {
12484
12484
  var value = _a.value, formattedValue = _a.formattedValue;
12485
12485
  return ({
12486
- id: value,
12487
- label: isNil(formattedValue) ? "(Empty)" : ("" + formattedValue).trim(),
12488
- value: value
12486
+ id: key && value ? value[key] : value,
12487
+ label: isNil(formattedValue) ? "(Empty)" : ("" + (key ? formattedValue[key] : formattedValue)).trim(),
12488
+ value: key && value ? value[key] : value
12489
12489
  });
12490
12490
  };
12491
12491
  var ɵ2$1 = mapToListItemWithFormatted;
@@ -12624,15 +12624,18 @@ var DatoGridFilterComponent = /** @class */ (function () {
12624
12624
  var _this = this;
12625
12625
  var _b = this.popover.data, gridService = _b.gridService, gridQuery = _b.gridQuery;
12626
12626
  var _c = this.colDef, filter = _c.filter, _d = _c.filtersConfig, filtersConfig = _d === void 0 ? {} : _d, pivotValueColumn = _c.pivotValueColumn, pivotKeys = _c.pivotKeys;
12627
+ var colDefs = gridQuery.api.columns.getAllColumns().map(function (column) { return column.getColDef(); });
12627
12628
  this.colField = getColField(this.colDef);
12629
+ var colDef = colDefs.find(function (colDef) { return colDef.field === _this.colField; });
12628
12630
  this.pivotColumn = gridQuery.api.columns.getSecondaryPivotColumn(pivotKeys, pivotValueColumn);
12629
12631
  if (filtersConfig.sections) {
12630
12632
  this.filterSections = (_a = {}, _a[filtersConfig.sections] = true, _a);
12631
12633
  }
12632
12634
  this.keepPredefinedListOriginalOrder =
12633
12635
  filtersConfig.keepPredefinedListOriginalOrder && !isEmpty(filtersConfig.predefinedListValues);
12634
- var filterOptions = DatoGridFilterOptionsMap[filter];
12635
- this.filterType = filterOptions ? filter : DatoGridFilterTypes.String;
12636
+ var colFilter = filter || colDef.filter;
12637
+ var filterOptions = DatoGridFilterOptionsMap[colFilter];
12638
+ this.filterType = filterOptions ? colFilter : DatoGridFilterTypes.String;
12636
12639
  this.listLabelType = this.filterType.toLowerCase();
12637
12640
  this.listSortByKey = this.filterType === DatoGridFilterTypes.Number && this.colDef.valueFormatter ? 'id' : 'label';
12638
12641
  this.gridQuery = gridQuery;
@@ -12667,9 +12670,11 @@ var DatoGridFilterComponent = /** @class */ (function () {
12667
12670
  var columnValues = this.getColumnValues();
12668
12671
  this.columnValues = columnValues.map(function (_a) {
12669
12672
  var value = _a.value;
12670
- return _this.pivotColumn ? value[_this.colField] : value;
12673
+ return !isNil(_this.pivotColumn) && value ? value[_this.colField] : value;
12674
+ });
12675
+ this.listOptions = columnValues.map(function (colValue) {
12676
+ return mapToListItemWithFormatted(colValue, !isNil(_this.pivotColumn) && _this.colField);
12671
12677
  });
12672
- this.listOptions = columnValues.map(mapToListItemWithFormatted);
12673
12678
  }
12674
12679
  }
12675
12680
  else {
@@ -14710,27 +14715,14 @@ var GridService = /** @class */ (function () {
14710
14715
  /**
14711
14716
  * When pivoting,
14712
14717
  * we add the field name to the column header class in order to access it through the auto generated pivot column.
14713
- * @private
14714
14718
  */
14715
14719
  GridService.prototype.initPivotSecondaryColsProcess = function (_a) {
14716
14720
  var _this = this;
14717
14721
  var gridOptions = _a.gridOptions;
14718
14722
  gridOptions.processSecondaryColDef = function (colDef) {
14719
- var api = colDef.headerComponentParams && colDef.headerComponentParams.gridQuery.api;
14720
- if (api) {
14721
- var valueColumns = colDef.headerComponentParams.gridQuery.api.columns.getValueColumns();
14722
- var originalColDef = valueColumns
14723
- .map(function (_a) {
14724
- var userProvidedColDef = _a.userProvidedColDef;
14725
- return userProvidedColDef;
14726
- })
14727
- .find(function (_a) {
14728
- var colId = _a.colId;
14729
- return colId === colDef.pivotValueColumn.getColId();
14730
- });
14731
- if (originalColDef) {
14732
- colDef.filter = originalColDef.filter;
14733
- }
14723
+ var userProvidedColDef = colDef.pivotValueColumn.getUserProvidedColDef();
14724
+ if (userProvidedColDef) {
14725
+ colDef.filter = userProvidedColDef.filter;
14734
14726
  }
14735
14727
  if (colDef.pivotKeys) {
14736
14728
  colDef.pivotKeys = colDef.pivotKeys.map(function (key) {