@contrail/data-grouping 1.0.17 → 1.0.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.
@@ -31,7 +31,6 @@ class DataGroupGenerator {
|
|
31
31
|
const groupingProperty = groupingProperties[currentDepth];
|
32
32
|
const index = groupingProperty.scope + "." + groupingProperty.property.slug;
|
33
33
|
const distinctValues = this.getDistinctValues(data, index);
|
34
|
-
console.log("distinctValues: ", distinctValues);
|
35
34
|
for (let val of distinctValues) {
|
36
35
|
const groupData = data.filter(obj => util_1.ObjectUtil.getByPath(obj, index) === val);
|
37
36
|
const group = {
|
@@ -40,13 +39,11 @@ class DataGroupGenerator {
|
|
40
39
|
propertyValues: {},
|
41
40
|
name: ''
|
42
41
|
};
|
43
|
-
if (
|
44
|
-
const details = groupData[0]
|
42
|
+
if (groupData.length > 0) {
|
43
|
+
const details = groupData[0];
|
45
44
|
group.propertyValues = Object.assign({}, details);
|
46
45
|
}
|
47
|
-
|
48
|
-
group.propertyValues[groupingProperty.property.slug] = val;
|
49
|
-
}
|
46
|
+
group.propertyValues[groupingProperty.property.slug] = val;
|
50
47
|
const label = new types_1.PropertyValueFormatter().formatValueForProperty(val, groupingProperty.property);
|
51
48
|
group.name = label;
|
52
49
|
if (currentDepth === groupingProperties.length - 1) {
|
package/lib/interfaces.d.ts
CHANGED
package/package.json
CHANGED