@contrail/data-grouping 1.0.16 → 1.0.18

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,6 +2,6 @@ import { DataGroup, DataGroupStructure, DataGroupingProperty } from "../interfac
2
2
  export declare class DataGroupGenerator {
3
3
  static getDistinctValues(data: any, index: any): any[];
4
4
  static buildChildDataGroups(data: any, parentGroup: DataGroup, groupingProperties: Array<DataGroupingProperty>, leafNodeDataCount: any, currentDepth: any): void;
5
- static buildDataGroupStructure(data: Array<any>, groupingProperties: Array<DataGroupingProperty>, leafNodeDataCount: number, currentDepth?: number): DataGroupStructure;
5
+ static buildDataGroupStructure(data: Array<any>, groupingProperties: Array<DataGroupingProperty>, leafNodeDataCount: number): DataGroupStructure;
6
6
  static createPartitionedGroupsFromData(parentGroup: DataGroup, data: Array<any>, leafNodeDataCount: number): Array<DataGroup>;
7
7
  }
@@ -39,6 +39,10 @@ class DataGroupGenerator {
39
39
  propertyValues: {},
40
40
  name: ''
41
41
  };
42
+ if (groupData.length > 0) {
43
+ const details = groupData[0];
44
+ group.propertyValues = Object.assign({}, details);
45
+ }
42
46
  group.propertyValues[groupingProperty.property.slug] = val;
43
47
  const label = new types_1.PropertyValueFormatter().formatValueForProperty(val, groupingProperty.property);
44
48
  group.name = label;
@@ -51,7 +55,7 @@ class DataGroupGenerator {
51
55
  parentGroup.subGroups.push(group);
52
56
  }
53
57
  }
54
- static buildDataGroupStructure(data, groupingProperties, leafNodeDataCount, currentDepth = 0) {
58
+ static buildDataGroupStructure(data, groupingProperties, leafNodeDataCount) {
55
59
  const structure = {
56
60
  rootGroup: {
57
61
  subGroups: [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/data-grouping",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "description": "Utilities and interfaces for grouping data into hierarchial data structures based on properties.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",