@reltio/components 1.4.2067 → 1.4.2069

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.
@@ -68,7 +68,7 @@ var validateRowSpanData = function (rowSpanData) {
68
68
  return (0, ramda_1.pipe)((0, ramda_1.omit)([TOTAL_ROW_SPAN_KEY]), ramda_1.keys, (0, ramda_1.sortBy)(ramda_1.identity), (0, ramda_1.groupBy)(getSiblingSubRowsKeyBySubRowKey), ramda_1.toPairs, (0, ramda_1.reduce)(validateParentRowSpan, rowSpanData))(rowSpanData);
69
69
  };
70
70
  exports.validateRowSpanData = validateRowSpanData;
71
- var calcRowSpansForNestedKeys = (0, ramda_1.pipe)((0, ramda_1.reduce)(addNestedKey, {}), validateRowSpanData);
71
+ var calcRowSpansForNestedKeys = (0, ramda_1.pipe)((0, ramda_1.sortBy)(ramda_1.identity), (0, ramda_1.reduce)(addNestedKey, {}), validateRowSpanData);
72
72
  exports.calcRowSpansForNestedKeys = calcRowSpansForNestedKeys;
73
73
  var chainWithIndex = (0, ramda_1.addIndex)(ramda_1.chain);
74
74
  var flattenNestedColumnValues = function (values, indexPath) {
@@ -153,8 +153,8 @@ describe('nested table api', function () {
153
153
  expect((0, nestedHelpers_1.calcRowSpansForNestedKeys)(nestedKeys)).toEqual(rowSpansData);
154
154
  });
155
155
  it('should build correct rowSpansData for more complex nested keys', function () {
156
- var nestedKeys = JSON.parse("[\n \"a.0\", \"a.0.b.0\", \"a.0.c.0\", \"a.0.b.0.d.0\",\n \"a.0.b.0.d.1\",\n \"a.0.b.1\", \n \"a.1\", \"a.1.b.0\", \"a.1.c.0\", \"a.1.b.0.d.0\",\n \"a.1.b.1\", \n \"a.1.b.2\", \"a.1.b.2.d.0\",\n \"a.1.b.2.d.1\"\n ]");
157
- var rowSpansData = JSON.parse("{\n \"a.0\": 3, \"a.0.b.0\": 2, \"a.0.c.0\": 3, \"a.0.b.0.d.0\": 1,\n \"a.0.b.0.d.1\": 1,\n \"a.0.b.1\": 1, \n \"a.1\": 4, \"a.1.b.0\": 1, \"a.1.c.0\": 4, \"a.1.b.0.d.0\": 1,\n \"a.1.b.1\": 1, \n \"a.1.b.2\": 2, \"a.1.b.2.d.0\": 1,\n \"a.1.b.2.d.1\": 1,\n \"".concat(nestedHelpers_1.TOTAL_ROW_SPAN_KEY, "\": 7\n }"));
156
+ var nestedKeys = JSON.parse("[\n \"a.0\", \"a.0.b.0\", \"a.0.c.0\", \"a.0.b.0.d.0\",\n \"a.0.b.0.d.1\",\n \"a.0.b.1\", \n \"a.1\", \"a.1.b.0\", \"a.1.c.0\", \"a.1.b.0.d.0\",\n \"a.1.b.1\", \n \"a.1.b.2\", \"a.1.b.2.d.0\",\n \"a.1.b.2.d.1\"\n ]");
157
+ var rowSpansData = JSON.parse("{\n \"a.0\": 3, \"a.0.b.0\": 2, \"a.0.c.0\": 3, \"a.0.b.0.d.0\": 1,\n \"a.0.b.0.d.1\": 1,\n \"a.0.b.1\": 1, \n \"a.1\": 4, \"a.1.b.0\": 1, \"a.1.c.0\": 4, \"a.1.b.0.d.0\": 1,\n \"a.1.b.1\": 1, \n \"a.1.b.2\": 2, \"a.1.b.2.d.0\": 1,\n \"a.1.b.2.d.1\": 1,\n \"".concat(nestedHelpers_1.TOTAL_ROW_SPAN_KEY, "\": 7\n }"));
158
158
  expect((0, nestedHelpers_1.calcRowSpansForNestedKeys)(nestedKeys)).toEqual(rowSpansData);
159
159
  });
160
160
  it('should build correct rowSpansData for very complex nested keys', function () {
@@ -162,5 +162,40 @@ describe('nested table api', function () {
162
162
  var rowSpansData = JSON.parse("{\n \"a.0\": 8, \"a.0.b.0\": 5, \"a.0.c.0\": 8, \"a.0.b.0.d.0\": 4, \"a.0.b.0.d.0.e.0.f.0\": 1, \"a.0.b.0.d.0.e.0\": 1,\n \"a.0.b.0.d.0.e.1.f.0\": 1, \"a.0.b.0.d.0.e.1\": 3,\n \"a.0.b.0.d.0.e.1.f.1\": 1,\n \"a.0.b.0.d.0.e.1.f.2\": 1,\n \"a.0.b.0.d.1\": 1,\n \"a.0.b.1\": 3, \"a.0.b.1.d.0\": 3, \"a.0.b.1.d.0.e.0\": 1,\n \"a.0.b.1.d.0.e.1\": 1,\n \"a.0.b.1.d.0.e.2\": 1,\n \"a.1\": 5, \"a.1.b.0\": 1, \"a.1.c.0\": 5, \"a.1.b.0.d.0\": 1, \"a.1.b.0.d.0.e.0\": 1,\n \"a.1.b.1\": 1, \n \"a.1.b.2\": 3, \"a.1.b.2.d.0\": 2, \"a.1.b.2.d.0.e.0\": 1,\n \"a.1.b.2.d.0.e.1\": 1,\n \"a.1.b.2.d.1\": 1,\n \"".concat(nestedHelpers_1.TOTAL_ROW_SPAN_KEY, "\": 13\n }"));
163
163
  expect((0, nestedHelpers_1.calcRowSpansForNestedKeys)(nestedKeys)).toEqual(rowSpansData);
164
164
  });
165
+ it('should return same result for unsorted and sorted nested keys', function () {
166
+ var unsortedNestedKeys = [
167
+ 'root.0',
168
+ 'root.1',
169
+ 'root.0.attr.0.Nested Level 1.11.Nested Level 2.0',
170
+ 'root.0.attr.0.Nested Level 1.2.Nested Level 2.0',
171
+ 'root.0.attr.0.Nested Level 1.0.Nested Level 2.0',
172
+ 'root.0.attr.0.Nested Level 1.0.Nested Level 2.1',
173
+ 'root.0.attr.0.Nested Level 1.1.Nested Level 2.0',
174
+ 'root.1.attr.0.Nested Level 1.0.Nested Level 2.0',
175
+ 'root.0.attr.0.Nested Level 1.11',
176
+ 'root.0.attr.0.Nested Level 1.2',
177
+ 'root.0.attr.0.Nested Level 1.0',
178
+ 'root.0.attr.0.Nested Level 1.1',
179
+ 'root.1.attr.0.Nested Level 1.0'
180
+ ];
181
+ var sortedNestedKeysRight = [
182
+ 'root.0',
183
+ 'root.1',
184
+ 'root.0.attr.0.Nested Level 1.0',
185
+ 'root.0.attr.0.Nested Level 1.1',
186
+ 'root.0.attr.0.Nested Level 1.2',
187
+ 'root.0.attr.0.Nested Level 1.11',
188
+ 'root.1.attr.0.Nested Level 1.0',
189
+ 'root.0.attr.0.Nested Level 1.0.Nested Level 2.0',
190
+ 'root.0.attr.0.Nested Level 1.0.Nested Level 2.1',
191
+ 'root.0.attr.0.Nested Level 1.1.Nested Level 2.0',
192
+ 'root.0.attr.0.Nested Level 1.2.Nested Level 2.0',
193
+ 'root.0.attr.0.Nested Level 1.11.Nested Level 2.0',
194
+ 'root.1.attr.0.Nested Level 1.0.Nested Level 2.0'
195
+ ];
196
+ var rowSpansWrongRight = JSON.parse("{\n \"root.0\": 5, \"root.0.attr.0\": 5, \"root.0.attr.0.Nested Level 1.0\": 2, \"root.0.attr.0.Nested Level 1.0.Nested Level 2.0\": 1,\n \"root.0.attr.0.Nested Level 1.0.Nested Level 2.1\": 1,\n \"root.0.attr.0.Nested Level 1.1\": 1, \"root.0.attr.0.Nested Level 1.1.Nested Level 2.0\": 1,\n \"root.0.attr.0.Nested Level 1.2\": 1, \"root.0.attr.0.Nested Level 1.2.Nested Level 2.0\": 1,\n \"root.0.attr.0.Nested Level 1.11\": 1, \"root.0.attr.0.Nested Level 1.11.Nested Level 2.0\": 1,\n \"root.1\": 1, \"root.1.attr.0\": 1, \"root.1.attr.0.Nested Level 1.0\": 1, \"root.1.attr.0.Nested Level 1.0.Nested Level 2.0\": 1,\n \n \"".concat(nestedHelpers_1.TOTAL_ROW_SPAN_KEY, "\": 6\n }"));
197
+ expect((0, nestedHelpers_1.calcRowSpansForNestedKeys)(sortedNestedKeysRight)).toEqual(rowSpansWrongRight);
198
+ expect((0, nestedHelpers_1.calcRowSpansForNestedKeys)(unsortedNestedKeys)).toEqual(rowSpansWrongRight);
199
+ });
165
200
  });
166
201
  });
@@ -61,7 +61,7 @@ var validateParentRowSpan = function (rowSpanData, _a) {
61
61
  var validateRowSpanData = function (rowSpanData) {
62
62
  return pipe(omit([TOTAL_ROW_SPAN_KEY]), keys, sortBy(identity), groupBy(getSiblingSubRowsKeyBySubRowKey), toPairs, reduce(validateParentRowSpan, rowSpanData))(rowSpanData);
63
63
  };
64
- var calcRowSpansForNestedKeys = pipe(reduce(addNestedKey, {}), validateRowSpanData);
64
+ var calcRowSpansForNestedKeys = pipe(sortBy(identity), reduce(addNestedKey, {}), validateRowSpanData);
65
65
  var chainWithIndex = addIndex(chain);
66
66
  var flattenNestedColumnValues = function (values, indexPath) {
67
67
  if (indexPath === void 0) { indexPath = []; }
@@ -151,8 +151,8 @@ describe('nested table api', function () {
151
151
  expect(calcRowSpansForNestedKeys(nestedKeys)).toEqual(rowSpansData);
152
152
  });
153
153
  it('should build correct rowSpansData for more complex nested keys', function () {
154
- var nestedKeys = JSON.parse("[\n \"a.0\", \"a.0.b.0\", \"a.0.c.0\", \"a.0.b.0.d.0\",\n \"a.0.b.0.d.1\",\n \"a.0.b.1\", \n \"a.1\", \"a.1.b.0\", \"a.1.c.0\", \"a.1.b.0.d.0\",\n \"a.1.b.1\", \n \"a.1.b.2\", \"a.1.b.2.d.0\",\n \"a.1.b.2.d.1\"\n ]");
155
- var rowSpansData = JSON.parse("{\n \"a.0\": 3, \"a.0.b.0\": 2, \"a.0.c.0\": 3, \"a.0.b.0.d.0\": 1,\n \"a.0.b.0.d.1\": 1,\n \"a.0.b.1\": 1, \n \"a.1\": 4, \"a.1.b.0\": 1, \"a.1.c.0\": 4, \"a.1.b.0.d.0\": 1,\n \"a.1.b.1\": 1, \n \"a.1.b.2\": 2, \"a.1.b.2.d.0\": 1,\n \"a.1.b.2.d.1\": 1,\n \"".concat(TOTAL_ROW_SPAN_KEY, "\": 7\n }"));
154
+ var nestedKeys = JSON.parse("[\n \"a.0\", \"a.0.b.0\", \"a.0.c.0\", \"a.0.b.0.d.0\",\n \"a.0.b.0.d.1\",\n \"a.0.b.1\", \n \"a.1\", \"a.1.b.0\", \"a.1.c.0\", \"a.1.b.0.d.0\",\n \"a.1.b.1\", \n \"a.1.b.2\", \"a.1.b.2.d.0\",\n \"a.1.b.2.d.1\"\n ]");
155
+ var rowSpansData = JSON.parse("{\n \"a.0\": 3, \"a.0.b.0\": 2, \"a.0.c.0\": 3, \"a.0.b.0.d.0\": 1,\n \"a.0.b.0.d.1\": 1,\n \"a.0.b.1\": 1, \n \"a.1\": 4, \"a.1.b.0\": 1, \"a.1.c.0\": 4, \"a.1.b.0.d.0\": 1,\n \"a.1.b.1\": 1, \n \"a.1.b.2\": 2, \"a.1.b.2.d.0\": 1,\n \"a.1.b.2.d.1\": 1,\n \"".concat(TOTAL_ROW_SPAN_KEY, "\": 7\n }"));
156
156
  expect(calcRowSpansForNestedKeys(nestedKeys)).toEqual(rowSpansData);
157
157
  });
158
158
  it('should build correct rowSpansData for very complex nested keys', function () {
@@ -160,5 +160,40 @@ describe('nested table api', function () {
160
160
  var rowSpansData = JSON.parse("{\n \"a.0\": 8, \"a.0.b.0\": 5, \"a.0.c.0\": 8, \"a.0.b.0.d.0\": 4, \"a.0.b.0.d.0.e.0.f.0\": 1, \"a.0.b.0.d.0.e.0\": 1,\n \"a.0.b.0.d.0.e.1.f.0\": 1, \"a.0.b.0.d.0.e.1\": 3,\n \"a.0.b.0.d.0.e.1.f.1\": 1,\n \"a.0.b.0.d.0.e.1.f.2\": 1,\n \"a.0.b.0.d.1\": 1,\n \"a.0.b.1\": 3, \"a.0.b.1.d.0\": 3, \"a.0.b.1.d.0.e.0\": 1,\n \"a.0.b.1.d.0.e.1\": 1,\n \"a.0.b.1.d.0.e.2\": 1,\n \"a.1\": 5, \"a.1.b.0\": 1, \"a.1.c.0\": 5, \"a.1.b.0.d.0\": 1, \"a.1.b.0.d.0.e.0\": 1,\n \"a.1.b.1\": 1, \n \"a.1.b.2\": 3, \"a.1.b.2.d.0\": 2, \"a.1.b.2.d.0.e.0\": 1,\n \"a.1.b.2.d.0.e.1\": 1,\n \"a.1.b.2.d.1\": 1,\n \"".concat(TOTAL_ROW_SPAN_KEY, "\": 13\n }"));
161
161
  expect(calcRowSpansForNestedKeys(nestedKeys)).toEqual(rowSpansData);
162
162
  });
163
+ it('should return same result for unsorted and sorted nested keys', function () {
164
+ var unsortedNestedKeys = [
165
+ 'root.0',
166
+ 'root.1',
167
+ 'root.0.attr.0.Nested Level 1.11.Nested Level 2.0',
168
+ 'root.0.attr.0.Nested Level 1.2.Nested Level 2.0',
169
+ 'root.0.attr.0.Nested Level 1.0.Nested Level 2.0',
170
+ 'root.0.attr.0.Nested Level 1.0.Nested Level 2.1',
171
+ 'root.0.attr.0.Nested Level 1.1.Nested Level 2.0',
172
+ 'root.1.attr.0.Nested Level 1.0.Nested Level 2.0',
173
+ 'root.0.attr.0.Nested Level 1.11',
174
+ 'root.0.attr.0.Nested Level 1.2',
175
+ 'root.0.attr.0.Nested Level 1.0',
176
+ 'root.0.attr.0.Nested Level 1.1',
177
+ 'root.1.attr.0.Nested Level 1.0'
178
+ ];
179
+ var sortedNestedKeysRight = [
180
+ 'root.0',
181
+ 'root.1',
182
+ 'root.0.attr.0.Nested Level 1.0',
183
+ 'root.0.attr.0.Nested Level 1.1',
184
+ 'root.0.attr.0.Nested Level 1.2',
185
+ 'root.0.attr.0.Nested Level 1.11',
186
+ 'root.1.attr.0.Nested Level 1.0',
187
+ 'root.0.attr.0.Nested Level 1.0.Nested Level 2.0',
188
+ 'root.0.attr.0.Nested Level 1.0.Nested Level 2.1',
189
+ 'root.0.attr.0.Nested Level 1.1.Nested Level 2.0',
190
+ 'root.0.attr.0.Nested Level 1.2.Nested Level 2.0',
191
+ 'root.0.attr.0.Nested Level 1.11.Nested Level 2.0',
192
+ 'root.1.attr.0.Nested Level 1.0.Nested Level 2.0'
193
+ ];
194
+ var rowSpansWrongRight = JSON.parse("{\n \"root.0\": 5, \"root.0.attr.0\": 5, \"root.0.attr.0.Nested Level 1.0\": 2, \"root.0.attr.0.Nested Level 1.0.Nested Level 2.0\": 1,\n \"root.0.attr.0.Nested Level 1.0.Nested Level 2.1\": 1,\n \"root.0.attr.0.Nested Level 1.1\": 1, \"root.0.attr.0.Nested Level 1.1.Nested Level 2.0\": 1,\n \"root.0.attr.0.Nested Level 1.2\": 1, \"root.0.attr.0.Nested Level 1.2.Nested Level 2.0\": 1,\n \"root.0.attr.0.Nested Level 1.11\": 1, \"root.0.attr.0.Nested Level 1.11.Nested Level 2.0\": 1,\n \"root.1\": 1, \"root.1.attr.0\": 1, \"root.1.attr.0.Nested Level 1.0\": 1, \"root.1.attr.0.Nested Level 1.0.Nested Level 2.0\": 1,\n \n \"".concat(TOTAL_ROW_SPAN_KEY, "\": 6\n }"));
195
+ expect(calcRowSpansForNestedKeys(sortedNestedKeysRight)).toEqual(rowSpansWrongRight);
196
+ expect(calcRowSpansForNestedKeys(unsortedNestedKeys)).toEqual(rowSpansWrongRight);
197
+ });
163
198
  });
164
199
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reltio/components",
3
- "version": "1.4.2067",
3
+ "version": "1.4.2069",
4
4
  "license": "SEE LICENSE IN LICENSE FILE",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./index.js",
@@ -11,7 +11,7 @@
11
11
  "@fluentui/react-context-selector": "^9.1.26",
12
12
  "@googlemaps/markerclusterer": "^2.5.3",
13
13
  "@react-sigma/core": "3.4.0",
14
- "@reltio/mdm-sdk": "^1.4.1916",
14
+ "@reltio/mdm-sdk": "^1.4.1917",
15
15
  "@vis.gl/react-google-maps": "^1.3.0",
16
16
  "d3-cloud": "^1.2.5",
17
17
  "d3-geo": "^2.0.1",