@contrail/data-grouping 1.0.52 → 1.0.53-alpha.0
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.
|
@@ -8,6 +8,7 @@ export declare class DataGroupGenerator {
|
|
|
8
8
|
isDate: boolean;
|
|
9
9
|
isNumber: boolean;
|
|
10
10
|
}, displayItemsWithEmptyGroupingValues?: boolean, displayOptionFrameWithNoData?: boolean): any[];
|
|
11
|
+
static applyGroupingValueFilter(distinctValues: Array<any>, groupingProperty: DataGroupingProperty, groupMultiSelectInSeparateFrame: boolean): Array<any>;
|
|
11
12
|
static buildChildDataGroups(data: any, parentGroup: DataGroup, groupingProperties: Array<DataGroupingProperty>, leafNodeDataCount: any, currentDepth: any, groupMultiSelectInSeparateFrame?: boolean, displayItemsWithEmptyGroupingValues?: boolean, displayOptionFrameWithNoData?: boolean): void;
|
|
12
13
|
static buildDataGroupStructure(data: Array<any>, groupingProperties: Array<DataGroupingProperty>, leafNodeDataCount: number, groupMultiSelectInSeparateFrame?: boolean, displayItemsWithEmptyGroupingValues?: boolean, displayOptionFrameWithNoData?: boolean): DataGroupStructure;
|
|
13
14
|
static createPartitionedGroupsFromData(parentGroup: DataGroup, data: Array<any>, leafNodeDataCount: number): Array<DataGroup>;
|
|
@@ -111,6 +111,24 @@ class DataGroupGenerator {
|
|
|
111
111
|
}
|
|
112
112
|
return distinctValues;
|
|
113
113
|
}
|
|
114
|
+
static applyGroupingValueFilter(distinctValues, groupingProperty, groupMultiSelectInSeparateFrame) {
|
|
115
|
+
var _a;
|
|
116
|
+
const rule = groupingProperty === null || groupingProperty === void 0 ? void 0 : groupingProperty.valueFilter;
|
|
117
|
+
if (!rule ||
|
|
118
|
+
!rule.values ||
|
|
119
|
+
rule.values.length === 0 ||
|
|
120
|
+
groupMultiSelectInSeparateFrame ||
|
|
121
|
+
((_a = groupingProperty === null || groupingProperty === void 0 ? void 0 : groupingProperty.propertyDefinition) === null || _a === void 0 ? void 0 : _a.propertyType) !== types_1.PropertyType.MultiSelect) {
|
|
122
|
+
return distinctValues;
|
|
123
|
+
}
|
|
124
|
+
const ruleValues = new Set(rule.values);
|
|
125
|
+
return distinctValues.filter((value) => {
|
|
126
|
+
if (value === '(empty)') {
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
129
|
+
return rule.mode === 'exclude' ? !ruleValues.has(value) : ruleValues.has(value);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
114
132
|
static buildChildDataGroups(data, parentGroup, groupingProperties, leafNodeDataCount, currentDepth, groupMultiSelectInSeparateFrame = false, displayItemsWithEmptyGroupingValues = false, displayOptionFrameWithNoData = false) {
|
|
115
133
|
var _a, _b, _c, _d, _e;
|
|
116
134
|
const groupingProperty = groupingProperties[currentDepth];
|
|
@@ -128,6 +146,7 @@ class DataGroupGenerator {
|
|
|
128
146
|
const sort = groupingProperty.sort || types_1.TypePropertySortOrder.ASCENDING;
|
|
129
147
|
const options = ((_e = (_d = groupingProperty.propertyDefinition) === null || _d === void 0 ? void 0 : _d.options) === null || _e === void 0 ? void 0 : _e.map((x) => x.value)) || null;
|
|
130
148
|
let distinctValues = this.getDistinctValues(data, rootIndex, slugIndex, rootAltIndex, slugAltIndex, groupMultiSelectInSeparateFrame, { sortOrder: sort, options }, propertyTypeOptions, displayItemsWithEmptyGroupingValues, displayOptionFrameWithNoData);
|
|
149
|
+
distinctValues = this.applyGroupingValueFilter(distinctValues, groupingProperty, groupMultiSelectInSeparateFrame);
|
|
131
150
|
for (let val of distinctValues) {
|
|
132
151
|
const groupData = data.filter((obj) => {
|
|
133
152
|
const objVal = util_1.ObjectUtil.getBySlugs(obj, rootIndex, slugIndex) || util_1.ObjectUtil.getBySlugs(obj, rootAltIndex, slugAltIndex);
|
package/lib/interfaces.d.ts
CHANGED
package/package.json
CHANGED