@datorama/core 21.4.0-rc.13 → 21.4.0-rc.16
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/bundles/datorama-core.umd.js +27 -32
- package/bundles/datorama-core.umd.js.map +1 -1
- package/bundles/datorama-core.umd.min.js +2 -2
- package/bundles/datorama-core.umd.min.js.map +1 -1
- package/esm2015/lib/grid-v2/grid-filter/filter-validator.js +8 -8
- package/esm2015/lib/grid-v2/grid-filter/grid-filter.component.js +14 -10
- package/esm2015/lib/grid-v2/grid-store/grid.service.js +4 -11
- package/esm5/lib/grid-v2/grid-filter/filter-validator.js +10 -8
- package/esm5/lib/grid-v2/grid-filter/grid-filter.component.js +16 -10
- package/esm5/lib/grid-v2/grid-store/grid.service.js +4 -17
- package/fesm2015/datorama-core.js +23 -26
- package/fesm2015/datorama-core.js.map +1 -1
- package/fesm5/datorama-core.js +27 -32
- package/fesm5/datorama-core.js.map +1 -1
- package/lib/grid-v2/grid-filter/filter-validator.d.ts +4 -3
- package/lib/grid-v2/grid-store/grid.service.d.ts +0 -1
- package/package.json +1 -1
package/fesm5/datorama-core.js
CHANGED
|
@@ -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,
|
|
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,
|
|
11659
|
+
return validateDateCondition(rowValue, condition);
|
|
11660
11660
|
case DatoGridFilterTypes.Number:
|
|
11661
|
-
return validateNumberCondition(rowValue,
|
|
11661
|
+
return validateNumberCondition(rowValue, condition, filterKey);
|
|
11662
11662
|
default:
|
|
11663
|
-
return validateStringCondition(rowValue,
|
|
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 (
|
|
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);
|
|
@@ -12480,12 +12482,12 @@ var mapToValue = function (_a) {
|
|
|
12480
12482
|
var ɵ0$1 = mapToValue;
|
|
12481
12483
|
var mapToListItem = function (val) { return ({ id: val, label: isNil(val) ? "(Empty)" : ("" + val).trim(), value: val }); };
|
|
12482
12484
|
var ɵ1$1 = mapToListItem;
|
|
12483
|
-
var mapToListItemWithFormatted = function (_a) {
|
|
12485
|
+
var mapToListItemWithFormatted = function (_a, key) {
|
|
12484
12486
|
var value = _a.value, formattedValue = _a.formattedValue;
|
|
12485
12487
|
return ({
|
|
12486
|
-
id: value,
|
|
12487
|
-
label: isNil(formattedValue) ? "(Empty)" : ("" + formattedValue).trim(),
|
|
12488
|
-
value: value
|
|
12488
|
+
id: key && value ? value[key] : value,
|
|
12489
|
+
label: isNil(formattedValue) ? "(Empty)" : ("" + (key ? formattedValue[key] : formattedValue)).trim(),
|
|
12490
|
+
value: key && value ? value[key] : value
|
|
12489
12491
|
});
|
|
12490
12492
|
};
|
|
12491
12493
|
var ɵ2$1 = mapToListItemWithFormatted;
|
|
@@ -12623,16 +12625,20 @@ var DatoGridFilterComponent = /** @class */ (function () {
|
|
|
12623
12625
|
var _a;
|
|
12624
12626
|
var _this = this;
|
|
12625
12627
|
var _b = this.popover.data, gridService = _b.gridService, gridQuery = _b.gridQuery;
|
|
12626
|
-
var _c = this.colDef, filter = _c.filter,
|
|
12628
|
+
var _c = this.colDef, filter = _c.filter, 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 filtersConfig = colDef.filtersConfig;
|
|
12628
12633
|
this.pivotColumn = gridQuery.api.columns.getSecondaryPivotColumn(pivotKeys, pivotValueColumn);
|
|
12629
12634
|
if (filtersConfig.sections) {
|
|
12630
12635
|
this.filterSections = (_a = {}, _a[filtersConfig.sections] = true, _a);
|
|
12631
12636
|
}
|
|
12632
12637
|
this.keepPredefinedListOriginalOrder =
|
|
12633
12638
|
filtersConfig.keepPredefinedListOriginalOrder && !isEmpty(filtersConfig.predefinedListValues);
|
|
12634
|
-
var
|
|
12635
|
-
|
|
12639
|
+
var colFilter = filter || colDef.filter;
|
|
12640
|
+
var filterOptions = DatoGridFilterOptionsMap[colFilter];
|
|
12641
|
+
this.filterType = filterOptions ? colFilter : DatoGridFilterTypes.String;
|
|
12636
12642
|
this.listLabelType = this.filterType.toLowerCase();
|
|
12637
12643
|
this.listSortByKey = this.filterType === DatoGridFilterTypes.Number && this.colDef.valueFormatter ? 'id' : 'label';
|
|
12638
12644
|
this.gridQuery = gridQuery;
|
|
@@ -12667,9 +12673,11 @@ var DatoGridFilterComponent = /** @class */ (function () {
|
|
|
12667
12673
|
var columnValues = this.getColumnValues();
|
|
12668
12674
|
this.columnValues = columnValues.map(function (_a) {
|
|
12669
12675
|
var value = _a.value;
|
|
12670
|
-
return _this.pivotColumn && value ? value[_this.colField] : value;
|
|
12676
|
+
return !isNil(_this.pivotColumn) && value ? value[_this.colField] : value;
|
|
12677
|
+
});
|
|
12678
|
+
this.listOptions = columnValues.map(function (colValue) {
|
|
12679
|
+
return mapToListItemWithFormatted(colValue, !isNil(_this.pivotColumn) && _this.colField);
|
|
12671
12680
|
});
|
|
12672
|
-
this.listOptions = columnValues.map(mapToListItemWithFormatted);
|
|
12673
12681
|
}
|
|
12674
12682
|
}
|
|
12675
12683
|
else {
|
|
@@ -14710,27 +14718,14 @@ var GridService = /** @class */ (function () {
|
|
|
14710
14718
|
/**
|
|
14711
14719
|
* When pivoting,
|
|
14712
14720
|
* we add the field name to the column header class in order to access it through the auto generated pivot column.
|
|
14713
|
-
* @private
|
|
14714
14721
|
*/
|
|
14715
14722
|
GridService.prototype.initPivotSecondaryColsProcess = function (_a) {
|
|
14716
14723
|
var _this = this;
|
|
14717
14724
|
var gridOptions = _a.gridOptions;
|
|
14718
14725
|
gridOptions.processSecondaryColDef = function (colDef) {
|
|
14719
|
-
var
|
|
14720
|
-
if (
|
|
14721
|
-
|
|
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
|
-
}
|
|
14726
|
+
var userProvidedColDef = colDef.pivotValueColumn.getUserProvidedColDef();
|
|
14727
|
+
if (userProvidedColDef) {
|
|
14728
|
+
colDef.filter = userProvidedColDef.filter;
|
|
14734
14729
|
}
|
|
14735
14730
|
if (colDef.pivotKeys) {
|
|
14736
14731
|
colDef.pivotKeys = colDef.pivotKeys.map(function (key) {
|