@reltio/components 1.4.2066 → 1.4.2068

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.
@@ -67,13 +67,33 @@ var buildRowValues = function (rowValue) {
67
67
  return (0, ramda_1.assoc)(id, getCellValues(nestedPath, rowValue[id]), acc);
68
68
  }, {});
69
69
  };
70
- var applyValuesCountConstraint = function (maxValuesCount) {
71
- return (0, ramda_1.unless)(function () { return maxValuesCount === Infinity; }, (0, ramda_1.map)((0, ramda_1.pipe)((0, ramda_1.reject)(function (_a) {
70
+ var areNestedValuesExceedingLimit = function (maxValuesCount) {
71
+ return function (_a) {
72
72
  var indexPath = _a.indexPath;
73
73
  return indexPath && indexPath.some(function (index) { return index > maxValuesCount - 1; });
74
- }), (0, ramda_1.map)((0, ramda_1.pipe)(function (data) { return (__assign(__assign({}, data), { allValues: data.values })); }, (0, ramda_1.evolve)({
74
+ };
75
+ };
76
+ var getAllRowHiddenValues = function (rowValues, maxValuesCount) {
77
+ if (maxValuesCount === void 0) { maxValuesCount = Infinity; }
78
+ return rowValues.reduce(function (hiddenValues, _a) {
79
+ var _b = _a.values, values = _b === void 0 ? [] : _b, indexPath = _a.indexPath;
80
+ var newHiddenValues = areNestedValuesExceedingLimit(maxValuesCount)({ indexPath: indexPath })
81
+ ? values
82
+ : values.slice(maxValuesCount);
83
+ return hiddenValues.concat(newHiddenValues);
84
+ }, []);
85
+ };
86
+ var adjustFirstWithHiddenValues = function (maxValuesCount) {
87
+ if (maxValuesCount === void 0) { maxValuesCount = Infinity; }
88
+ return function (rowValues) {
89
+ var hiddenValues = getAllRowHiddenValues(rowValues, maxValuesCount);
90
+ return (0, ramda_1.adjust)(0, (0, ramda_1.assoc)('allRowHiddenValues', hiddenValues), rowValues);
91
+ };
92
+ };
93
+ var applyValuesCountConstraint = function (maxValuesCount) {
94
+ return (0, ramda_1.unless)(function () { return maxValuesCount === Infinity; }, (0, ramda_1.map)((0, ramda_1.pipe)(adjustFirstWithHiddenValues(maxValuesCount), (0, ramda_1.reject)(areNestedValuesExceedingLimit(maxValuesCount)), (0, ramda_1.map)((0, ramda_1.evolve)({
75
95
  values: (0, ramda_1.slice)(0, maxValuesCount)
76
- }))))));
96
+ })))));
77
97
  };
78
98
  var defaultGetIdFromRowValue = function (_, rowIndex) { return rowIndex; };
79
99
  var getTableRowsData = function (rowValues, columnsData, renderRowCell, getRowCellHeight, getRowMaxValuesCount, getIdFromRowValue) {
@@ -249,10 +249,51 @@ describe('dataHelpers', function () {
249
249
  expect((0, dataHelpers_1.getTableRowsData)(rowValues, columnsData, renderRowCell, null, getRowMaxValuesCount)).toEqual([
250
250
  {
251
251
  data: {
252
- 'n1.a': [{ allValues: [1, 2], values: [1], indexPath: [0], nestedKey: 'n1.0', rowSpan: 1 }],
253
- 'n1.n2.b': [{ allValues: [], values: [], indexPath: [0], nestedKey: 'n1.0', rowSpan: 1 }],
254
- c: [{ allValues: [7, 8, 9, 10], values: [7], rowSpan: 1 }],
255
- 'n1.d': [{ allValues: [], values: [], rowSpan: 1 }]
252
+ 'n1.a': [
253
+ {
254
+ allRowHiddenValues: [2, 3],
255
+ values: [1],
256
+ indexPath: [0],
257
+ nestedKey: 'n1.0',
258
+ rowSpan: 1
259
+ }
260
+ ],
261
+ 'n1.n2.b': [
262
+ { values: [], allRowHiddenValues: [4, 5, 6], indexPath: [0], nestedKey: 'n1.0', rowSpan: 1 }
263
+ ],
264
+ c: [{ allRowHiddenValues: [8, 9, 10], values: [7], rowSpan: 1 }],
265
+ 'n1.d': [{ values: [], allRowHiddenValues: [], rowSpan: 1 }]
266
+ },
267
+ id: 0
268
+ }
269
+ ]);
270
+ expect(getRowMaxValuesCount).toHaveBeenCalledWith(0);
271
+ });
272
+ it('should apply allRowHiddenValues correctly if maxValuesCount more than 1', function () {
273
+ var rowValues = [
274
+ {
275
+ 'n1.n2.a': [[[1, 2]], [[3, 4, 5]]]
276
+ }
277
+ ];
278
+ var columnsData = [{ id: 'n1.n2.a', nestedPath: ['n1', 'n2', 'a'], label: 'columnA' }];
279
+ var renderRowCell = function (_a) {
280
+ var cell = _a.cell;
281
+ return cell.values;
282
+ };
283
+ var getRowMaxValuesCount = jest.fn(function () { return 2; });
284
+ expect((0, dataHelpers_1.getTableRowsData)(rowValues, columnsData, renderRowCell, null, getRowMaxValuesCount)).toEqual([
285
+ {
286
+ data: {
287
+ 'n1.n2.a': [
288
+ {
289
+ values: [1, 2],
290
+ allRowHiddenValues: [5],
291
+ indexPath: [0, 0],
292
+ nestedKey: 'n1.0.n2.0',
293
+ rowSpan: 1
294
+ },
295
+ { values: [3, 4], indexPath: [1, 0], nestedKey: 'n1.1.n2.0', rowSpan: 1 }
296
+ ]
256
297
  },
257
298
  id: 0
258
299
  }
@@ -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
  });
@@ -9,7 +9,7 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- import { add, always, assoc, chain, evolve, isEmpty, isNil, map, mapObjIndexed, max, pipe, pluck, propEq, propOr, reduce, reject, slice, uniq, unless, values } from 'ramda';
12
+ import { add, adjust, always, assoc, chain, evolve, isEmpty, isNil, map, mapObjIndexed, max, pipe, pluck, propEq, propOr, reduce, reject, slice, uniq, unless, values } from 'ramda';
13
13
  import { wrapInArrayIfNeeded } from '@reltio/mdm-sdk';
14
14
  import { DefaultCellValueRenderer } from '../../DefaultCellValueRenderer';
15
15
  import { calcRowSpansForNestedKeys, flattenNestedColumnValues, getNestedKeyForNestedColumnCell, TOTAL_ROW_SPAN_KEY } from './nestedHelpers';
@@ -64,13 +64,33 @@ var buildRowValues = function (rowValue) {
64
64
  return assoc(id, getCellValues(nestedPath, rowValue[id]), acc);
65
65
  }, {});
66
66
  };
67
- var applyValuesCountConstraint = function (maxValuesCount) {
68
- return unless(function () { return maxValuesCount === Infinity; }, map(pipe(reject(function (_a) {
67
+ var areNestedValuesExceedingLimit = function (maxValuesCount) {
68
+ return function (_a) {
69
69
  var indexPath = _a.indexPath;
70
70
  return indexPath && indexPath.some(function (index) { return index > maxValuesCount - 1; });
71
- }), map(pipe(function (data) { return (__assign(__assign({}, data), { allValues: data.values })); }, evolve({
71
+ };
72
+ };
73
+ var getAllRowHiddenValues = function (rowValues, maxValuesCount) {
74
+ if (maxValuesCount === void 0) { maxValuesCount = Infinity; }
75
+ return rowValues.reduce(function (hiddenValues, _a) {
76
+ var _b = _a.values, values = _b === void 0 ? [] : _b, indexPath = _a.indexPath;
77
+ var newHiddenValues = areNestedValuesExceedingLimit(maxValuesCount)({ indexPath: indexPath })
78
+ ? values
79
+ : values.slice(maxValuesCount);
80
+ return hiddenValues.concat(newHiddenValues);
81
+ }, []);
82
+ };
83
+ var adjustFirstWithHiddenValues = function (maxValuesCount) {
84
+ if (maxValuesCount === void 0) { maxValuesCount = Infinity; }
85
+ return function (rowValues) {
86
+ var hiddenValues = getAllRowHiddenValues(rowValues, maxValuesCount);
87
+ return adjust(0, assoc('allRowHiddenValues', hiddenValues), rowValues);
88
+ };
89
+ };
90
+ var applyValuesCountConstraint = function (maxValuesCount) {
91
+ return unless(function () { return maxValuesCount === Infinity; }, map(pipe(adjustFirstWithHiddenValues(maxValuesCount), reject(areNestedValuesExceedingLimit(maxValuesCount)), map(evolve({
72
92
  values: slice(0, maxValuesCount)
73
- }))))));
93
+ })))));
74
94
  };
75
95
  var defaultGetIdFromRowValue = function (_, rowIndex) { return rowIndex; };
76
96
  var getTableRowsData = function (rowValues, columnsData, renderRowCell, getRowCellHeight, getRowMaxValuesCount, getIdFromRowValue) {
@@ -244,10 +244,51 @@ describe('dataHelpers', function () {
244
244
  expect(getTableRowsData(rowValues, columnsData, renderRowCell, null, getRowMaxValuesCount)).toEqual([
245
245
  {
246
246
  data: {
247
- 'n1.a': [{ allValues: [1, 2], values: [1], indexPath: [0], nestedKey: 'n1.0', rowSpan: 1 }],
248
- 'n1.n2.b': [{ allValues: [], values: [], indexPath: [0], nestedKey: 'n1.0', rowSpan: 1 }],
249
- c: [{ allValues: [7, 8, 9, 10], values: [7], rowSpan: 1 }],
250
- 'n1.d': [{ allValues: [], values: [], rowSpan: 1 }]
247
+ 'n1.a': [
248
+ {
249
+ allRowHiddenValues: [2, 3],
250
+ values: [1],
251
+ indexPath: [0],
252
+ nestedKey: 'n1.0',
253
+ rowSpan: 1
254
+ }
255
+ ],
256
+ 'n1.n2.b': [
257
+ { values: [], allRowHiddenValues: [4, 5, 6], indexPath: [0], nestedKey: 'n1.0', rowSpan: 1 }
258
+ ],
259
+ c: [{ allRowHiddenValues: [8, 9, 10], values: [7], rowSpan: 1 }],
260
+ 'n1.d': [{ values: [], allRowHiddenValues: [], rowSpan: 1 }]
261
+ },
262
+ id: 0
263
+ }
264
+ ]);
265
+ expect(getRowMaxValuesCount).toHaveBeenCalledWith(0);
266
+ });
267
+ it('should apply allRowHiddenValues correctly if maxValuesCount more than 1', function () {
268
+ var rowValues = [
269
+ {
270
+ 'n1.n2.a': [[[1, 2]], [[3, 4, 5]]]
271
+ }
272
+ ];
273
+ var columnsData = [{ id: 'n1.n2.a', nestedPath: ['n1', 'n2', 'a'], label: 'columnA' }];
274
+ var renderRowCell = function (_a) {
275
+ var cell = _a.cell;
276
+ return cell.values;
277
+ };
278
+ var getRowMaxValuesCount = jest.fn(function () { return 2; });
279
+ expect(getTableRowsData(rowValues, columnsData, renderRowCell, null, getRowMaxValuesCount)).toEqual([
280
+ {
281
+ data: {
282
+ 'n1.n2.a': [
283
+ {
284
+ values: [1, 2],
285
+ allRowHiddenValues: [5],
286
+ indexPath: [0, 0],
287
+ nestedKey: 'n1.0.n2.0',
288
+ rowSpan: 1
289
+ },
290
+ { values: [3, 4], indexPath: [1, 0], nestedKey: 'n1.1.n2.0', rowSpan: 1 }
291
+ ]
251
292
  },
252
293
  id: 0
253
294
  }
@@ -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.2066",
3
+ "version": "1.4.2068",
4
4
  "license": "SEE LICENSE IN LICENSE FILE",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./index.js",