@contrail/data-grouping 1.0.44 → 1.0.46
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.
@@ -10,7 +10,7 @@ class DataGroupGenerator {
|
|
10
10
|
const map = new Map();
|
11
11
|
const sortingArray = [];
|
12
12
|
let hasEmptyValues = false;
|
13
|
-
data.forEach(obj => {
|
13
|
+
data.forEach((obj) => {
|
14
14
|
if (!obj) {
|
15
15
|
return;
|
16
16
|
}
|
@@ -40,7 +40,7 @@ class DataGroupGenerator {
|
|
40
40
|
return;
|
41
41
|
}
|
42
42
|
}
|
43
|
-
if (propertyTypeOptions.isDate && value
|
43
|
+
if (propertyTypeOptions.isDate && value) {
|
44
44
|
const date = new Date(value);
|
45
45
|
value = date.toISOString().split('T')[0];
|
46
46
|
key = value;
|
@@ -49,7 +49,7 @@ class DataGroupGenerator {
|
|
49
49
|
key = value.id || value.name || value;
|
50
50
|
}
|
51
51
|
if (Array.isArray(value) && !groupMultiSelectInSeparateFrame) {
|
52
|
-
value.forEach(arrayValue => {
|
52
|
+
value.forEach((arrayValue) => {
|
53
53
|
map[arrayValue] = arrayValue;
|
54
54
|
if (!sortingArray.includes(arrayValue)) {
|
55
55
|
sortingArray.push(arrayValue);
|
@@ -103,22 +103,22 @@ class DataGroupGenerator {
|
|
103
103
|
return distinctValues;
|
104
104
|
}
|
105
105
|
static buildChildDataGroups(data, parentGroup, groupingProperties, leafNodeDataCount, currentDepth, groupMultiSelectInSeparateFrame = false, displayItemsWithEmptyGroupingValues = false) {
|
106
|
-
var _a, _b, _c, _d, _e;
|
106
|
+
var _a, _b, _c, _d, _e, _f;
|
107
107
|
const groupingProperty = groupingProperties[currentDepth];
|
108
108
|
const propertyTypeOptions = {
|
109
109
|
isDate: ((_a = groupingProperty === null || groupingProperty === void 0 ? void 0 : groupingProperty.propertyDefinition) === null || _a === void 0 ? void 0 : _a.propertyType) === 'date',
|
110
|
-
isNumber: !!((_b = groupingProperty === null || groupingProperty === void 0 ? void 0 : groupingProperty.propertyDefinition) === null || _b === void 0 ? void 0 : _b.numberFormat) ||
|
111
|
-
((
|
110
|
+
isNumber: !!((_c = (_b = groupingProperty === null || groupingProperty === void 0 ? void 0 : groupingProperty.propertyDefinition) === null || _b === void 0 ? void 0 : _b.numberFormat) === null || _c === void 0 ? void 0 : _c.format) ||
|
111
|
+
((_d = groupingProperty === null || groupingProperty === void 0 ? void 0 : groupingProperty.propertyDefinition) === null || _d === void 0 ? void 0 : _d.propertyType) === 'sequence',
|
112
112
|
};
|
113
113
|
const rootIndex = groupingProperty.typeRootSlug;
|
114
114
|
const slugIndex = groupingProperty.propertyDefinition.slug;
|
115
115
|
const rootAltIndex = util_1.StringUtil.convertToCamelCase(groupingProperty.typeRootSlug);
|
116
116
|
const slugAltIndex = groupingProperty.propertyDefinition.slug;
|
117
117
|
const sort = groupingProperty.sort || types_1.TypePropertySortOrder.ASCENDING;
|
118
|
-
const options = ((
|
118
|
+
const options = ((_f = (_e = groupingProperty.propertyDefinition) === null || _e === void 0 ? void 0 : _e.options) === null || _f === void 0 ? void 0 : _f.map((x) => x.value)) || null;
|
119
119
|
let distinctValues = this.getDistinctValues(data, rootIndex, slugIndex, rootAltIndex, slugAltIndex, groupMultiSelectInSeparateFrame, { sortOrder: sort, options }, propertyTypeOptions, displayItemsWithEmptyGroupingValues);
|
120
120
|
for (let val of distinctValues) {
|
121
|
-
const groupData = data.filter(obj => {
|
121
|
+
const groupData = data.filter((obj) => {
|
122
122
|
const objVal = util_1.ObjectUtil.getBySlugs(obj, rootIndex, slugIndex) || util_1.ObjectUtil.getBySlugs(obj, rootAltIndex, slugAltIndex);
|
123
123
|
if (val === '(empty)') {
|
124
124
|
return !objVal;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@contrail/data-grouping",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.46",
|
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",
|
@@ -39,6 +39,6 @@
|
|
39
39
|
},
|
40
40
|
"dependencies": {
|
41
41
|
"@contrail/documents": "^1.0.38",
|
42
|
-
"@contrail/types": "^3.0.
|
42
|
+
"@contrail/types": "^3.0.95"
|
43
43
|
}
|
44
44
|
}
|