@datorama/core 21.4.0-rc.14 → 21.4.0-rc.17

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.
@@ -11603,9 +11603,9 @@ function validateStringCondition(rowValue, _a) {
11603
11603
  return !isEmpty(valueLowerCase);
11604
11604
  }
11605
11605
  }
11606
- function validateNumberCondition(unparsedRowValue, _a) {
11606
+ function validateNumberCondition(unparsedRowValue, _a, filterKey) {
11607
11607
  var condition = _a.condition, value = _a.value, rangeEnd = _a.rangeEnd;
11608
- var rowValue = !!unparsedRowValue ? parseFloat(unparsedRowValue) : null;
11608
+ var rowValue = !!unparsedRowValue ? parseFloat(unparsedRowValue[filterKey] || unparsedRowValue) : null;
11609
11609
  var filterValue = parseFloat(value);
11610
11610
  switch (condition) {
11611
11611
  case DatoFilterConditions.EQUALS:
@@ -11653,14 +11653,14 @@ function validateDateCondition(rowValue, _a) {
11653
11653
  }
11654
11654
  }
11655
11655
  function validateCondition(_a) {
11656
- var rowValue = _a.rowValue, filter = _a.filter, type = _a.type;
11656
+ var rowValue = _a.rowValue, condition = _a.condition, type = _a.type, filterKey = _a.filterKey;
11657
11657
  switch (type) {
11658
11658
  case DatoGridFilterTypes.Date:
11659
- return validateDateCondition(rowValue, filter);
11659
+ return validateDateCondition(rowValue, condition);
11660
11660
  case DatoGridFilterTypes.Number:
11661
- return validateNumberCondition(rowValue, filter);
11661
+ return validateNumberCondition(rowValue, condition, filterKey);
11662
11662
  default:
11663
- return validateStringCondition(rowValue, filter);
11663
+ return validateStringCondition(rowValue, condition);
11664
11664
  }
11665
11665
  }
11666
11666
  function validateFilter(_a, activeFilters) {
@@ -11680,7 +11680,9 @@ function validateFilter(_a, activeFilters) {
11680
11680
  if (conditional) {
11681
11681
  var operator = conditional.operator, conditions = conditional.conditions, type_1 = conditional.type;
11682
11682
  var conditionsRelation = operator === OperatorTypes.AND ? 'every' : 'some';
11683
- filterPasses = conditions[conditionsRelation](function (filter) { return validateCondition({ rowValue: rowValue, filter: filter, type: type_1 }); });
11683
+ filterPasses = conditions[conditionsRelation](function (condition) {
11684
+ return validateCondition({ rowValue: rowValue, condition: condition, type: type_1, filterKey: filter });
11685
+ });
11684
11686
  }
11685
11687
  if (filterPasses && byValue) {
11686
11688
  var includesValue = byValue.values.includes(rowValue);
@@ -12624,15 +12626,18 @@ var DatoGridFilterComponent = /** @class */ (function () {
12624
12626
  var _this = this;
12625
12627
  var _b = this.popover.data, gridService = _b.gridService, gridQuery = _b.gridQuery;
12626
12628
  var _c = this.colDef, filter = _c.filter, _d = _c.filtersConfig, filtersConfig = _d === void 0 ? {} : _d, pivotValueColumn = _c.pivotValueColumn, pivotKeys = _c.pivotKeys;
12629
+ var colDefs = gridQuery.api.columns.getAllColumns().map(function (column) { return column.getColDef(); });
12627
12630
  this.colField = getColField(this.colDef);
12631
+ var colDef = colDefs.find(function (colDef) { return colDef.field === _this.colField; });
12632
+ var colFilter = filter || colDef.filter;
12633
+ var filterOptions = DatoGridFilterOptionsMap[colFilter];
12628
12634
  this.pivotColumn = gridQuery.api.columns.getSecondaryPivotColumn(pivotKeys, pivotValueColumn);
12629
12635
  if (filtersConfig.sections) {
12630
12636
  this.filterSections = (_a = {}, _a[filtersConfig.sections] = true, _a);
12631
12637
  }
12632
12638
  this.keepPredefinedListOriginalOrder =
12633
12639
  filtersConfig.keepPredefinedListOriginalOrder && !isEmpty(filtersConfig.predefinedListValues);
12634
- var filterOptions = DatoGridFilterOptionsMap[filter];
12635
- this.filterType = filterOptions ? filter : DatoGridFilterTypes.String;
12640
+ this.filterType = filterOptions ? colFilter : DatoGridFilterTypes.String;
12636
12641
  this.listLabelType = this.filterType.toLowerCase();
12637
12642
  this.listSortByKey = this.filterType === DatoGridFilterTypes.Number && this.colDef.valueFormatter ? 'id' : 'label';
12638
12643
  this.gridQuery = gridQuery;
@@ -14712,27 +14717,14 @@ var GridService = /** @class */ (function () {
14712
14717
  /**
14713
14718
  * When pivoting,
14714
14719
  * we add the field name to the column header class in order to access it through the auto generated pivot column.
14715
- * @private
14716
14720
  */
14717
14721
  GridService.prototype.initPivotSecondaryColsProcess = function (_a) {
14718
14722
  var _this = this;
14719
14723
  var gridOptions = _a.gridOptions;
14720
14724
  gridOptions.processSecondaryColDef = function (colDef) {
14721
- var api = colDef.headerComponentParams && colDef.headerComponentParams.gridQuery.api;
14722
- if (api) {
14723
- var valueColumns = colDef.headerComponentParams.gridQuery.api.columns.getValueColumns();
14724
- var originalColDef = valueColumns
14725
- .map(function (_a) {
14726
- var userProvidedColDef = _a.userProvidedColDef;
14727
- return userProvidedColDef;
14728
- })
14729
- .find(function (_a) {
14730
- var colId = _a.colId;
14731
- return colId === colDef.pivotValueColumn.getColId();
14732
- });
14733
- if (originalColDef) {
14734
- colDef.filter = originalColDef.filter;
14735
- }
14725
+ var userProvidedColDef = colDef.pivotValueColumn.getUserProvidedColDef();
14726
+ if (userProvidedColDef) {
14727
+ colDef.filter = userProvidedColDef.filter;
14736
14728
  }
14737
14729
  if (colDef.pivotKeys) {
14738
14730
  colDef.pivotKeys = colDef.pivotKeys.map(function (key) {