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

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);
@@ -12627,14 +12629,14 @@ var DatoGridFilterComponent = /** @class */ (function () {
12627
12629
  var colDefs = gridQuery.api.columns.getAllColumns().map(function (column) { return column.getColDef(); });
12628
12630
  this.colField = getColField(this.colDef);
12629
12631
  var colDef = colDefs.find(function (colDef) { return colDef.field === _this.colField; });
12632
+ var colFilter = filter || colDef.filter;
12633
+ var filterOptions = DatoGridFilterOptionsMap[colFilter];
12630
12634
  this.pivotColumn = gridQuery.api.columns.getSecondaryPivotColumn(pivotKeys, pivotValueColumn);
12631
12635
  if (filtersConfig.sections) {
12632
12636
  this.filterSections = (_a = {}, _a[filtersConfig.sections] = true, _a);
12633
12637
  }
12634
12638
  this.keepPredefinedListOriginalOrder =
12635
12639
  filtersConfig.keepPredefinedListOriginalOrder && !isEmpty(filtersConfig.predefinedListValues);
12636
- var colFilter = filter || colDef.filter;
12637
- var filterOptions = DatoGridFilterOptionsMap[colFilter];
12638
12640
  this.filterType = filterOptions ? colFilter : DatoGridFilterTypes.String;
12639
12641
  this.listLabelType = this.filterType.toLowerCase();
12640
12642
  this.listSortByKey = this.filterType === DatoGridFilterTypes.Number && this.colDef.valueFormatter ? 'id' : 'label';
@@ -14720,7 +14722,7 @@ var GridService = /** @class */ (function () {
14720
14722
  var _this = this;
14721
14723
  var gridOptions = _a.gridOptions;
14722
14724
  gridOptions.processSecondaryColDef = function (colDef) {
14723
- var userProvidedColDef = colDef.pivotValueColumn.getUserProvidedColDef();
14725
+ var userProvidedColDef = colDef.pivotValueColumn && colDef.pivotValueColumn.getUserProvidedColDef();
14724
14726
  if (userProvidedColDef) {
14725
14727
  colDef.filter = userProvidedColDef.filter;
14726
14728
  }