@datorama/core 21.4.0-rc.5 → 21.4.0-rc.6
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 +32 -20
- package/bundles/datorama-core.umd.js.map +1 -1
- package/bundles/datorama-core.umd.min.js +29 -29
- package/bundles/datorama-core.umd.min.js.map +1 -1
- package/datorama-core.metadata.json +1 -1
- package/esm2015/lib/grid-v2/grid-filter/filter-validator.js +5 -12
- package/esm2015/lib/grid-v2/grid-store/grid.service.js +20 -10
- package/esm2015/lib/grid-v2/grid-store/grid.store.types.js +1 -1
- package/esm2015/lib/grid-v2/grid-store/util.js +11 -1
- package/esm5/lib/grid-v2/grid-filter/filter-validator.js +5 -12
- package/esm5/lib/grid-v2/grid-store/grid.service.js +21 -11
- package/esm5/lib/grid-v2/grid-store/grid.store.types.js +1 -1
- package/esm5/lib/grid-v2/grid-store/util.js +11 -1
- package/fesm2015/datorama-core.js +31 -19
- package/fesm2015/datorama-core.js.map +1 -1
- package/fesm5/datorama-core.js +32 -20
- package/fesm5/datorama-core.js.map +1 -1
- package/lib/grid-v2/grid-store/grid.store.types.d.ts +4 -0
- package/lib/grid-v2/grid-store/util.d.ts +2 -0
- package/package.json +1 -1
|
@@ -10010,6 +10010,16 @@ function getColField(colDef) {
|
|
|
10010
10010
|
const { field, showRowGroup, pivotValueColumn } = colDef;
|
|
10011
10011
|
return pivotValueColumn ? pivotValueColumn.getColId() : field || showRowGroup;
|
|
10012
10012
|
}
|
|
10013
|
+
function tryParsePivotValue(str) {
|
|
10014
|
+
let value;
|
|
10015
|
+
try {
|
|
10016
|
+
value = JSON.parse(str);
|
|
10017
|
+
}
|
|
10018
|
+
catch (e) {
|
|
10019
|
+
console.error(`Can't parse ${str} from JSON`);
|
|
10020
|
+
}
|
|
10021
|
+
return value;
|
|
10022
|
+
}
|
|
10013
10023
|
|
|
10014
10024
|
let GridQuery = class GridQuery extends Query {
|
|
10015
10025
|
constructor(store) {
|
|
@@ -10392,17 +10402,9 @@ function validateFilter({ row, api }, activeFilters) {
|
|
|
10392
10402
|
*/
|
|
10393
10403
|
function getRowPivotKeys(childrenMapped, keys = []) {
|
|
10394
10404
|
const key = Object.keys(childrenMapped)[0];
|
|
10395
|
-
|
|
10396
|
-
|
|
10397
|
-
|
|
10398
|
-
}
|
|
10399
|
-
catch (e) {
|
|
10400
|
-
console.error(`Can't parse ${key} from JSON`);
|
|
10401
|
-
}
|
|
10402
|
-
finally {
|
|
10403
|
-
if (parsedKey) {
|
|
10404
|
-
keys = getRowPivotKeys(childrenMapped[key], [...keys, parsedKey.value]);
|
|
10405
|
-
}
|
|
10405
|
+
const parsedKey = tryParsePivotValue(key);
|
|
10406
|
+
if (parsedKey) {
|
|
10407
|
+
keys = getRowPivotKeys(childrenMapped[key], [...keys, parsedKey.value]);
|
|
10406
10408
|
}
|
|
10407
10409
|
return keys;
|
|
10408
10410
|
}
|
|
@@ -13110,16 +13112,22 @@ let GridService = class GridService {
|
|
|
13110
13112
|
}
|
|
13111
13113
|
}
|
|
13112
13114
|
if (colDef.pivotKeys) {
|
|
13113
|
-
colDef.pivotKeys = colDef.pivotKeys.map(key =>
|
|
13115
|
+
colDef.pivotKeys = colDef.pivotKeys.map(key => {
|
|
13116
|
+
const parsedKey = tryParsePivotValue(key);
|
|
13117
|
+
return (parsedKey && parsedKey.value) || '';
|
|
13118
|
+
});
|
|
13114
13119
|
}
|
|
13115
13120
|
};
|
|
13116
13121
|
gridOptions.processSecondaryColGroupDef = (colGroupDef) => {
|
|
13117
13122
|
if (colGroupDef.headerName) {
|
|
13118
|
-
const
|
|
13119
|
-
|
|
13120
|
-
|
|
13121
|
-
|
|
13122
|
-
colGroupDef.
|
|
13123
|
+
const parsedValue = tryParsePivotValue(colGroupDef.headerName);
|
|
13124
|
+
if (parsedValue) {
|
|
13125
|
+
const { field, value } = parsedValue;
|
|
13126
|
+
colGroupDef.headerClass = [field];
|
|
13127
|
+
colGroupDef.headerName = value;
|
|
13128
|
+
if (colGroupDef.children && colGroupDef.children.length > 1) {
|
|
13129
|
+
colGroupDef.headerClass.push('group-pivot-cell');
|
|
13130
|
+
}
|
|
13123
13131
|
}
|
|
13124
13132
|
}
|
|
13125
13133
|
else if (colGroupDef.children) {
|
|
@@ -13134,7 +13142,10 @@ let GridService = class GridService {
|
|
|
13134
13142
|
colGroupDef.headerClass = ['empty-pivot-header'];
|
|
13135
13143
|
}
|
|
13136
13144
|
if (colGroupDef.pivotKeys) {
|
|
13137
|
-
colGroupDef.pivotKeys = colGroupDef.pivotKeys.map(key =>
|
|
13145
|
+
colGroupDef.pivotKeys = colGroupDef.pivotKeys.map(key => {
|
|
13146
|
+
const parsedKey = tryParsePivotValue(key);
|
|
13147
|
+
return (parsedKey && parsedKey.value) || '';
|
|
13148
|
+
});
|
|
13138
13149
|
}
|
|
13139
13150
|
};
|
|
13140
13151
|
}
|
|
@@ -13144,7 +13155,8 @@ let GridService = class GridService {
|
|
|
13144
13155
|
const mappedValues = Object.assign({}, currentValue);
|
|
13145
13156
|
for (const col of pivotColumns) {
|
|
13146
13157
|
const field = col.getColDef().field;
|
|
13147
|
-
|
|
13158
|
+
const pivotValue = { field, value: currentValue[field] };
|
|
13159
|
+
mappedValues[field] = JSON.stringify(pivotValue);
|
|
13148
13160
|
}
|
|
13149
13161
|
return mappedValues;
|
|
13150
13162
|
});
|