@contrail/data-grouping 1.0.35 → 1.0.36

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.
@@ -9,7 +9,7 @@ class DataGroupGenerator {
9
9
  const options = (sort === null || sort === void 0 ? void 0 : sort.options) || null;
10
10
  const map = new Map();
11
11
  const sortingArray = [];
12
- data.forEach(obj => {
12
+ data.forEach((obj) => {
13
13
  if (!obj) {
14
14
  return;
15
15
  }
@@ -34,7 +34,7 @@ class DataGroupGenerator {
34
34
  key = value.id || value.name || value;
35
35
  }
36
36
  if (Array.isArray(value) && !groupMultiSelectInSeparateFrame) {
37
- value.forEach(arrayValue => {
37
+ value.forEach((arrayValue) => {
38
38
  map[arrayValue] = arrayValue;
39
39
  if (!sortingArray.includes(arrayValue)) {
40
40
  sortingArray.push(arrayValue);
@@ -68,18 +68,18 @@ class DataGroupGenerator {
68
68
  return distinctValues;
69
69
  }
70
70
  static buildChildDataGroups(data, parentGroup, groupingProperties, leafNodeDataCount, currentDepth, groupMultiSelectInSeparateFrame = false) {
71
- var _a, _b;
71
+ var _a, _b, _c;
72
72
  const groupingProperty = groupingProperties[currentDepth];
73
- const isDateProperty = groupingProperty.propertyDefinition.propertyType === 'date';
73
+ const isDateProperty = ((_a = groupingProperty === null || groupingProperty === void 0 ? void 0 : groupingProperty.propertyDefinition) === null || _a === void 0 ? void 0 : _a.propertyType) === 'date';
74
74
  const rootIndex = groupingProperty.typeRootSlug;
75
75
  const slugIndex = groupingProperty.propertyDefinition.slug;
76
76
  const rootAltIndex = util_1.StringUtil.convertToCamelCase(groupingProperty.typeRootSlug);
77
77
  const slugAltIndex = groupingProperty.propertyDefinition.slug;
78
78
  const sort = groupingProperty.sort || 'asc';
79
- const options = ((_b = (_a = groupingProperty.propertyDefinition) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.map(x => x.value)) || null;
79
+ const options = ((_c = (_b = groupingProperty.propertyDefinition) === null || _b === void 0 ? void 0 : _b.options) === null || _c === void 0 ? void 0 : _c.map((x) => x.value)) || null;
80
80
  let distinctValues = this.getDistinctValues(data, rootIndex, slugIndex, rootAltIndex, slugAltIndex, groupMultiSelectInSeparateFrame, { sortKey: sort, options }, isDateProperty);
81
81
  for (let val of distinctValues) {
82
- const groupData = data.filter(obj => {
82
+ const groupData = data.filter((obj) => {
83
83
  const objVal = util_1.ObjectUtil.getBySlugs(obj, rootIndex, slugIndex) || util_1.ObjectUtil.getBySlugs(obj, rootAltIndex, slugAltIndex);
84
84
  if (isDateProperty) {
85
85
  const objDate = new Date(objVal).toISOString().split('T')[0];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/data-grouping",
3
- "version": "1.0.35",
3
+ "version": "1.0.36",
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",