@contrail/data-grouping 1.0.8 → 1.0.9
Sign up to get free protection for your applications and to get access to all the features.
@@ -2,5 +2,5 @@ import { DataGroup, DataGroupStructure, DataGroupingProperty } from "../interfac
|
|
2
2
|
export declare class DataGroupGenerator {
|
3
3
|
static buildChildDataGroups(data: any, parentGroup: DataGroup, groupingProperties: any, leafNodeDataCount: any, currentDepth: any): void;
|
4
4
|
static buildDataGroupStructure(data: Array<any>, groupingProperties: Array<DataGroupingProperty>, leafNodeDataCount: number, currentDepth?: number): DataGroupStructure;
|
5
|
-
static
|
5
|
+
static createPartitionedGroupsFromData(parentGroup: DataGroup, data: Array<any>, leafNodeDataCount: number): Array<DataGroup>;
|
6
6
|
}
|
@@ -2,6 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.DataGroupGenerator = void 0;
|
4
4
|
const util_1 = require("@contrail/util");
|
5
|
+
const types_1 = require("@contrail/types");
|
5
6
|
class DataGroupGenerator {
|
6
7
|
static buildChildDataGroups(data, parentGroup, groupingProperties, leafNodeDataCount, currentDepth) {
|
7
8
|
const groupingProperty = groupingProperties[currentDepth];
|
@@ -20,9 +21,10 @@ class DataGroupGenerator {
|
|
20
21
|
name: ''
|
21
22
|
};
|
22
23
|
group.properties[groupingProperty.property.slug] = val;
|
23
|
-
|
24
|
+
const label = new types_1.PropertyValueFormatter().formatValueForProperty(val, groupingProperty);
|
25
|
+
group.name = label;
|
24
26
|
if (currentDepth === groupingProperties.length - 1) {
|
25
|
-
group.subGroups = this.
|
27
|
+
group.subGroups = this.createPartitionedGroupsFromData(group, groupData, leafNodeDataCount);
|
26
28
|
}
|
27
29
|
else if (currentDepth < groupingProperties.length - 1) {
|
28
30
|
this.buildChildDataGroups(groupData, group, groupingProperties, leafNodeDataCount, currentDepth + 1);
|
@@ -44,7 +46,7 @@ class DataGroupGenerator {
|
|
44
46
|
this.buildChildDataGroups(data, structure.rootGroup, groupingProperties, leafNodeDataCount, 0);
|
45
47
|
return structure;
|
46
48
|
}
|
47
|
-
static
|
49
|
+
static createPartitionedGroupsFromData(parentGroup, data, leafNodeDataCount) {
|
48
50
|
const dataLength = data.length;
|
49
51
|
const frameCount = Math.ceil(dataLength / leafNodeDataCount);
|
50
52
|
const groups = [];
|
package/package.json
CHANGED