@contrail/data-grouping 1.0.35 → 1.0.36
Sign up to get free protection for your applications and to get access to all the features.
@@ -9,7 +9,7 @@ class DataGroupGenerator {
|
|
9
9
|
const options = (sort === null || sort === void 0 ? void 0 : sort.options) || null;
|
10
10
|
const map = new Map();
|
11
11
|
const sortingArray = [];
|
12
|
-
data.forEach(obj => {
|
12
|
+
data.forEach((obj) => {
|
13
13
|
if (!obj) {
|
14
14
|
return;
|
15
15
|
}
|
@@ -34,7 +34,7 @@ class DataGroupGenerator {
|
|
34
34
|
key = value.id || value.name || value;
|
35
35
|
}
|
36
36
|
if (Array.isArray(value) && !groupMultiSelectInSeparateFrame) {
|
37
|
-
value.forEach(arrayValue => {
|
37
|
+
value.forEach((arrayValue) => {
|
38
38
|
map[arrayValue] = arrayValue;
|
39
39
|
if (!sortingArray.includes(arrayValue)) {
|
40
40
|
sortingArray.push(arrayValue);
|
@@ -68,18 +68,18 @@ class DataGroupGenerator {
|
|
68
68
|
return distinctValues;
|
69
69
|
}
|
70
70
|
static buildChildDataGroups(data, parentGroup, groupingProperties, leafNodeDataCount, currentDepth, groupMultiSelectInSeparateFrame = false) {
|
71
|
-
var _a, _b;
|
71
|
+
var _a, _b, _c;
|
72
72
|
const groupingProperty = groupingProperties[currentDepth];
|
73
|
-
const isDateProperty = groupingProperty.propertyDefinition.propertyType === 'date';
|
73
|
+
const isDateProperty = ((_a = groupingProperty === null || groupingProperty === void 0 ? void 0 : groupingProperty.propertyDefinition) === null || _a === void 0 ? void 0 : _a.propertyType) === 'date';
|
74
74
|
const rootIndex = groupingProperty.typeRootSlug;
|
75
75
|
const slugIndex = groupingProperty.propertyDefinition.slug;
|
76
76
|
const rootAltIndex = util_1.StringUtil.convertToCamelCase(groupingProperty.typeRootSlug);
|
77
77
|
const slugAltIndex = groupingProperty.propertyDefinition.slug;
|
78
78
|
const sort = groupingProperty.sort || 'asc';
|
79
|
-
const options = ((
|
79
|
+
const options = ((_c = (_b = groupingProperty.propertyDefinition) === null || _b === void 0 ? void 0 : _b.options) === null || _c === void 0 ? void 0 : _c.map((x) => x.value)) || null;
|
80
80
|
let distinctValues = this.getDistinctValues(data, rootIndex, slugIndex, rootAltIndex, slugAltIndex, groupMultiSelectInSeparateFrame, { sortKey: sort, options }, isDateProperty);
|
81
81
|
for (let val of distinctValues) {
|
82
|
-
const groupData = data.filter(obj => {
|
82
|
+
const groupData = data.filter((obj) => {
|
83
83
|
const objVal = util_1.ObjectUtil.getBySlugs(obj, rootIndex, slugIndex) || util_1.ObjectUtil.getBySlugs(obj, rootAltIndex, slugAltIndex);
|
84
84
|
if (isDateProperty) {
|
85
85
|
const objDate = new Date(objVal).toISOString().split('T')[0];
|
package/package.json
CHANGED