@contrail/data-grouping 1.0.46 → 1.0.47
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.
@@ -64,11 +64,12 @@ class DataGroupGenerator {
|
|
64
64
|
}
|
65
65
|
});
|
66
66
|
const distinctValues = [...Object.values(map)];
|
67
|
+
const sortingArrayMap = new Map(sortingArray.map((value, index) => [value, index]));
|
67
68
|
const optionsMap = options
|
68
69
|
? new Map(options.map((val, index) => [val, index]))
|
69
70
|
: null;
|
70
71
|
distinctValues.sort((v1, v2) => {
|
71
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
72
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
72
73
|
if (propertyTypeOptions.isNumber) {
|
73
74
|
const num1 = parseFloat(String(v1));
|
74
75
|
const num2 = parseFloat(String(v2));
|
@@ -90,7 +91,7 @@ class DataGroupGenerator {
|
|
90
91
|
case types_1.TypePropertySortOrder.LIST_ORDER_DESCENDING:
|
91
92
|
return ((_g = optionsMap.get(rawVal2)) !== null && _g !== void 0 ? _g : 0) - ((_h = optionsMap.get(rawVal1)) !== null && _h !== void 0 ? _h : 0);
|
92
93
|
default:
|
93
|
-
return
|
94
|
+
return ((_j = sortingArrayMap.get(val1)) !== null && _j !== void 0 ? _j : -1) - ((_k = sortingArrayMap.get(val2)) !== null && _k !== void 0 ? _k : -1);
|
94
95
|
}
|
95
96
|
});
|
96
97
|
if (hasEmptyValues && displayItemsWithEmptyGroupingValues) {
|
@@ -103,19 +104,19 @@ class DataGroupGenerator {
|
|
103
104
|
return distinctValues;
|
104
105
|
}
|
105
106
|
static buildChildDataGroups(data, parentGroup, groupingProperties, leafNodeDataCount, currentDepth, groupMultiSelectInSeparateFrame = false, displayItemsWithEmptyGroupingValues = false) {
|
106
|
-
var _a, _b, _c, _d, _e
|
107
|
+
var _a, _b, _c, _d, _e;
|
107
108
|
const groupingProperty = groupingProperties[currentDepth];
|
108
109
|
const propertyTypeOptions = {
|
109
110
|
isDate: ((_a = groupingProperty === null || groupingProperty === void 0 ? void 0 : groupingProperty.propertyDefinition) === null || _a === void 0 ? void 0 : _a.propertyType) === 'date',
|
110
|
-
isNumber: !!((
|
111
|
-
((
|
111
|
+
isNumber: !!((_b = groupingProperty === null || groupingProperty === void 0 ? void 0 : groupingProperty.propertyDefinition) === null || _b === void 0 ? void 0 : _b.numberFormat) ||
|
112
|
+
((_c = groupingProperty === null || groupingProperty === void 0 ? void 0 : groupingProperty.propertyDefinition) === null || _c === void 0 ? void 0 : _c.propertyType) === 'sequence',
|
112
113
|
};
|
113
114
|
const rootIndex = groupingProperty.typeRootSlug;
|
114
115
|
const slugIndex = groupingProperty.propertyDefinition.slug;
|
115
116
|
const rootAltIndex = util_1.StringUtil.convertToCamelCase(groupingProperty.typeRootSlug);
|
116
117
|
const slugAltIndex = groupingProperty.propertyDefinition.slug;
|
117
118
|
const sort = groupingProperty.sort || types_1.TypePropertySortOrder.ASCENDING;
|
118
|
-
const options = ((
|
119
|
+
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;
|
119
120
|
let distinctValues = this.getDistinctValues(data, rootIndex, slugIndex, rootAltIndex, slugAltIndex, groupMultiSelectInSeparateFrame, { sortOrder: sort, options }, propertyTypeOptions, displayItemsWithEmptyGroupingValues);
|
120
121
|
for (let val of distinctValues) {
|
121
122
|
const groupData = data.filter((obj) => {
|
package/package.json
CHANGED