@gridsuite/commons-ui 0.31.0 → 0.32.0

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.
Files changed (65) hide show
  1. package/lib/components/AuthenticationRouter/AuthenticationRouter.js +7 -22
  2. package/lib/components/AuthenticationRouter/index.js +0 -4
  3. package/lib/components/CardErrorBoundary/card-error-boundary.js +13 -39
  4. package/lib/components/CardErrorBoundary/index.js +0 -4
  5. package/lib/components/ElementSearchDialog/element-search-dialog.js +18 -29
  6. package/lib/components/ElementSearchDialog/equipment-item.js +12 -22
  7. package/lib/components/ElementSearchDialog/index.js +0 -5
  8. package/lib/components/ElementSearchDialog/tag-renderer.js +8 -13
  9. package/lib/components/FlatParameters/FlatParameters.js +312 -0
  10. package/lib/components/FlatParameters/index.js +8 -0
  11. package/lib/components/Login/Login.js +2 -17
  12. package/lib/components/Login/Logout.js +2 -17
  13. package/lib/components/Login/index.js +0 -4
  14. package/lib/components/MuiVirtualizedTable/ColumnHeader.js +18 -32
  15. package/lib/components/MuiVirtualizedTable/KeyedColumnsRowIndexer.js +104 -153
  16. package/lib/components/MuiVirtualizedTable/MuiVirtualizedTable.js +63 -189
  17. package/lib/components/MuiVirtualizedTable/index.js +0 -5
  18. package/lib/components/OverflowableText/index.js +0 -4
  19. package/lib/components/OverflowableText/overflowable-text.js +15 -25
  20. package/lib/components/ReportViewer/index.js +0 -4
  21. package/lib/components/ReportViewer/log-report-item.js +11 -22
  22. package/lib/components/ReportViewer/log-report.js +0 -17
  23. package/lib/components/ReportViewer/log-table.js +7 -28
  24. package/lib/components/ReportViewer/report-item.js +9 -22
  25. package/lib/components/ReportViewer/report-tree-view-context.js +1 -4
  26. package/lib/components/ReportViewer/report-viewer.js +18 -47
  27. package/lib/components/ReportViewerDialog/index.js +0 -4
  28. package/lib/components/ReportViewerDialog/report-viewer-dialog.js +6 -25
  29. package/lib/components/SignInCallbackHandler/SignInCallbackHandler.js +2 -6
  30. package/lib/components/SignInCallbackHandler/index.js +0 -4
  31. package/lib/components/SilentRenewCallbackHandler/SilentRenewCallbackHandler.js +2 -6
  32. package/lib/components/SilentRenewCallbackHandler/index.js +0 -4
  33. package/lib/components/SnackbarProvider/SnackbarProvider.js +6 -10
  34. package/lib/components/SnackbarProvider/index.js +0 -4
  35. package/lib/components/TopBar/TopBar.js +38 -101
  36. package/lib/components/TopBar/index.js +0 -4
  37. package/lib/components/TreeViewFinder/TreeViewFinder.js +73 -84
  38. package/lib/components/TreeViewFinder/index.js +0 -4
  39. package/lib/components/translations/card-error-boundary-en.js +1 -1
  40. package/lib/components/translations/card-error-boundary-fr.js +1 -1
  41. package/lib/components/translations/element-search-en.js +1 -1
  42. package/lib/components/translations/element-search-fr.js +1 -1
  43. package/lib/components/translations/equipment-search-en.js +1 -1
  44. package/lib/components/translations/equipment-search-fr.js +2 -2
  45. package/lib/components/translations/login-en.js +1 -1
  46. package/lib/components/translations/login-fr.js +1 -1
  47. package/lib/components/translations/report-viewer-en.js +1 -1
  48. package/lib/components/translations/report-viewer-fr.js +1 -1
  49. package/lib/components/translations/table-en.js +1 -1
  50. package/lib/components/translations/table-fr.js +1 -1
  51. package/lib/components/translations/top-bar-en.js +1 -1
  52. package/lib/components/translations/top-bar-fr.js +2 -2
  53. package/lib/components/translations/treeview-finder-en.js +1 -1
  54. package/lib/components/translations/treeview-finder-fr.js +1 -1
  55. package/lib/hooks/useImportExportParams.js +126 -168
  56. package/lib/hooks/useIntlRef.js +1 -3
  57. package/lib/hooks/useSnackMessage.js +5 -18
  58. package/lib/index.js +5 -76
  59. package/lib/utils/AuthService.js +14 -49
  60. package/lib/utils/ElementType.js +5 -15
  61. package/lib/utils/EquipmentType.js +3 -7
  62. package/lib/utils/UserManagerMock.js +8 -23
  63. package/lib/utils/actions.js +1 -14
  64. package/lib/utils/algos.js +13 -7
  65. package/package.json +5 -2
@@ -2,27 +2,27 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports.noOpHelper = exports.getHelper = exports.forTesting = exports.collectibleHelper = exports.KeyedColumnsRowIndexer = exports.CHANGE_WAYS = void 0;
5
-
6
5
  var _algos = require("../../utils/algos");
7
-
8
6
  function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
9
-
10
7
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
11
-
12
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
13
-
14
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
15
-
8
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
9
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
16
10
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
17
-
18
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
19
-
11
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
12
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
13
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /**
14
+ * Copyright (c) 2022, RTE (http://www.rte-france.com)
15
+ * This Source Code Form is subject to the terms of the Mozilla Public
16
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
17
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
18
+ */
20
19
  var CHANGE_WAYS = {
21
20
  SIMPLE: 'Simple',
22
21
  TAIL: 'Tail',
23
22
  AMEND: 'Amend',
24
23
  REMOVE: 'Remove'
25
24
  };
25
+
26
26
  /* This is not real code commented
27
27
  const someTypicalColumns = [
28
28
  { label: 'strings column', dataKey: 'key1' },
@@ -39,7 +39,6 @@ const someTypicalColumns = [
39
39
  },
40
40
  ];
41
41
  */
42
-
43
42
  exports.CHANGE_WAYS = CHANGE_WAYS;
44
43
  var noOpHelper = Object.freeze({
45
44
  debugName: 'noOp',
@@ -66,7 +65,6 @@ var numericHelper = Object.freeze({
66
65
  if (colStat.imin === null || colStat.imin > value) {
67
66
  colStat.imin = value;
68
67
  }
69
-
70
68
  if (colStat.imax === null || colStat.imax < value) {
71
69
  colStat.imax = value;
72
70
  }
@@ -86,7 +84,11 @@ var collectibleHelper = Object.freeze({
86
84
  },
87
85
  updateStat: function updateStat(colStat, cellValue, isForKeep) {
88
86
  var m = isForKeep ? colStat.kept : colStat.seen;
89
- if (!m[cellValue]) m[cellValue] = 1;else m[cellValue] += 1;
87
+ if (!m[cellValue]) {
88
+ m[cellValue] = 1;
89
+ } else {
90
+ m[cellValue] += 1;
91
+ }
90
92
  },
91
93
  accepts: function accepts(value, userParams, outerParams) {
92
94
  return !userParams || userParams.some(function (v) {
@@ -95,7 +97,6 @@ var collectibleHelper = Object.freeze({
95
97
  }
96
98
  });
97
99
  exports.collectibleHelper = collectibleHelper;
98
-
99
100
  var getHelper = function getHelper(column) {
100
101
  if (column === null || column === void 0 ? void 0 : column.numeric) {
101
102
  return numericHelper;
@@ -105,108 +106,98 @@ var getHelper = function getHelper(column) {
105
106
  return noOpHelper;
106
107
  }
107
108
  };
109
+
108
110
  /**
109
111
  * A rows indexer for MuiVirtualizedTable to delegate to an instance of it
110
112
  * for filtering, grouping and multi-column sorting via
111
113
  * a view index to model index array.
112
114
  */
113
-
114
-
115
115
  exports.getHelper = getHelper;
116
-
117
116
  var KeyedColumnsRowIndexer = /*#__PURE__*/function () {
118
117
  function KeyedColumnsRowIndexer(isThreeState, singleColumnByDefault, delegatorCallback, versionSetter) {
119
118
  var _this = this;
120
-
121
119
  if (isThreeState === void 0) {
122
120
  isThreeState = true;
123
121
  }
124
-
125
122
  if (singleColumnByDefault === void 0) {
126
123
  singleColumnByDefault = false;
127
124
  }
128
-
129
125
  if (delegatorCallback === void 0) {
130
126
  delegatorCallback = null;
131
127
  }
132
-
133
128
  if (versionSetter === void 0) {
134
129
  versionSetter = null;
135
130
  }
136
-
137
131
  _defineProperty(this, "hasVersionSetter", function () {
138
132
  return !!_this._versionSetter;
139
133
  });
140
-
141
134
  _defineProperty(this, "getVersion", function () {
142
135
  return _this.version;
143
136
  });
144
-
145
137
  _defineProperty(this, "_bumpVersion", function (isFilter) {
146
138
  if (isFilter === void 0) {
147
139
  isFilter = false;
148
140
  }
149
-
150
141
  _this.version += 1;
151
-
152
142
  if (isFilter) {
153
143
  _this.filterVersion = _this.version;
154
144
  }
155
-
156
145
  if (_this.delegatorCallback) {
157
146
  _this.indirectionStatus = 'to sort';
158
-
159
147
  _this.delegatorCallback(_this, function (updated_ok) {
160
148
  _this.indirectionStatus = updated_ok ? 'done' : 'no_luck';
161
149
  });
162
150
  }
163
-
164
151
  if (_this._versionSetter) {
165
152
  _this._versionSetter(_this.version);
166
153
  }
167
154
  });
168
-
169
155
  _defineProperty(this, "updatePreferences", function (preferences) {
170
156
  if (preferences.isThreeState === _this.isThreeState && preferences.singleColumnByDefault === _this.singleColumnByDefault) {
171
157
  return false;
172
158
  }
173
-
174
159
  if (preferences.isThreeState !== _this.isThreeState) {
175
160
  _this.isThreeState = preferences.isThreeState;
176
161
  }
177
-
178
162
  if (preferences.singleColumnByDefault !== _this.singleColumnByDefault) {
179
163
  _this.singleColumnByDefault = preferences.singleColumnByDefault;
180
164
  }
181
-
182
165
  _this._bumpVersion();
183
166
  });
184
-
167
+ // Does not mutate any internal
168
+ // returns
169
+ // { rowAndOrigIndex : [[row, originalRowIndex],...],
170
+ // colsStats : {
171
+ // colKey1 : {
172
+ // seen : Map(value : count),
173
+ // kept : Map(value : count)
174
+ // },
175
+ // colKey2 : {
176
+ // imin : number,
177
+ // imax : number,
178
+ // }, colKeyN, ...
179
+ // }
180
+ // }
185
181
  _defineProperty(this, "preFilterRowMapping", function (columns, rows, rowFilter) {
186
- if (!(rows === null || rows === void 0 ? void 0 : rows.length) || !(columns === null || columns === void 0 ? void 0 : columns.length)) return null;
182
+ if (!(rows === null || rows === void 0 ? void 0 : rows.length) || !(columns === null || columns === void 0 ? void 0 : columns.length)) {
183
+ return null;
184
+ }
187
185
  var ri = [];
188
186
  var cs = {};
189
-
190
187
  for (var _iterator = _createForOfIteratorHelperLoose(columns), _step; !(_step = _iterator()).done;) {
191
188
  var _col2 = _step.value;
192
-
193
189
  var _helper2 = getHelper(_col2);
194
-
195
190
  var colStat = _helper2.initStat();
196
-
197
191
  if (colStat) {
198
192
  cs[_col2.dataKey] = colStat;
199
193
  }
200
194
  }
201
-
202
195
  for (var rowIdx = 0; rowIdx < rows.length; rowIdx++) {
203
196
  var row = rows[rowIdx];
204
197
  var acceptsRow = true;
205
198
  var acceptedOnRow = {};
206
-
207
199
  for (var colIdx = 0; colIdx < columns.length; colIdx++) {
208
200
  var _this$byColFilter;
209
-
210
201
  var col = columns[colIdx];
211
202
  var helper = getHelper(col);
212
203
  var colKey = col.dataKey;
@@ -214,56 +205,48 @@ var KeyedColumnsRowIndexer = /*#__PURE__*/function () {
214
205
  helper.updateStat(cs[colKey], cellValue, false);
215
206
  var colFilterParams = (_this$byColFilter = _this.byColFilter) === null || _this$byColFilter === void 0 ? void 0 : _this$byColFilter[colKey];
216
207
  var acceptsCell = true;
217
-
218
208
  if (colFilterParams) {
219
209
  var up = colFilterParams.userParams;
220
210
  var op = colFilterParams.outerParams;
221
-
222
211
  if (!helper.accepts(cellValue, up, op)) {
223
212
  acceptsCell = false;
224
213
  }
225
214
  }
226
-
227
215
  if (helper.maintainsStats && acceptsCell) {
228
216
  acceptedOnRow[colIdx] = cellValue;
229
217
  }
230
-
231
218
  acceptsRow &= acceptsCell;
232
219
  }
233
-
234
220
  if (acceptsRow && rowFilter) {
235
221
  acceptsRow = rowFilter(row);
236
222
  }
237
-
238
223
  if (acceptsRow && _this.byRowFilter) {
239
224
  acceptsRow = _this.byRowFilter(row);
240
225
  }
241
-
242
226
  if (acceptsRow) {
243
227
  for (var _i = 0, _Object$entries = Object.entries(acceptedOnRow); _i < _Object$entries.length; _i++) {
244
228
  var _Object$entries$_i = _Object$entries[_i],
245
- idx = _Object$entries$_i[0],
246
- value = _Object$entries$_i[1];
229
+ idx = _Object$entries$_i[0],
230
+ value = _Object$entries$_i[1];
247
231
  var _col = columns[idx];
248
-
249
232
  var _helper = getHelper(_col);
250
-
251
233
  _helper.updateStat(cs[_col.dataKey], value, true);
252
234
  }
253
-
254
235
  ri.push([row, rowIdx]);
255
236
  }
256
237
  }
257
-
258
238
  return {
259
239
  rowAndOrigIndex: ri,
260
240
  colsStats: cs,
261
241
  rowsCount: rows.length
262
242
  };
263
243
  });
264
-
244
+ // Does not mutate any internal
245
+ // returns an array of indexes in rows given to preFilter
265
246
  _defineProperty(this, "makeGroupAndSortIndirector", function (preFilteredRowPairs, columns) {
266
- if (!preFilteredRowPairs) return null;
247
+ if (!preFilteredRowPairs) {
248
+ return null;
249
+ }
267
250
  var codedColumns = !_this.sortingState ? null : codedColumnsFromKeyAndDirection(_this.sortingState, columns);
268
251
  var groupingColumnsCount = _this.groupingCount;
269
252
  var indexedArray = groupAndSort(preFilteredRowPairs, codedColumns, groupingColumnsCount, columns);
@@ -271,32 +254,29 @@ var KeyedColumnsRowIndexer = /*#__PURE__*/function () {
271
254
  return k[1];
272
255
  });
273
256
  });
274
-
275
257
  _defineProperty(this, "getSortingAsKeyAndCodedRank", function () {
276
- if (!_this.sortingState) return [];
258
+ if (!_this.sortingState) {
259
+ return [];
260
+ }
277
261
  return _this.sortingState.map(function (kd, i) {
278
262
  var sign = giveDirSignFor(kd[1]);
279
263
  var codedRank = sign * (i + 1);
280
264
  return [kd[0], codedRank];
281
265
  });
282
266
  });
283
-
267
+ // returns true if really changed (and calls versionSetter if needed)
284
268
  _defineProperty(this, "updateSortingFromUser", function (colKey, change_way) {
285
269
  var keyAndDirections = _this.sortingState;
286
-
287
270
  if (change_way === CHANGE_WAYS.REMOVE) {
288
271
  if (!keyAndDirections) {
289
272
  return false;
290
273
  }
291
-
292
274
  var would = keyAndDirections.filter(function (p) {
293
275
  return p[0] !== colKey;
294
276
  });
295
-
296
277
  if (would.length === keyAndDirections.length) {
297
278
  return false;
298
279
  }
299
-
300
280
  _this.sortingState = would.length ? would : null;
301
281
  } else if (!keyAndDirections) {
302
282
  _this.sortingState = [[colKey, canonicalForSign(1)]];
@@ -307,7 +287,6 @@ var KeyedColumnsRowIndexer = /*#__PURE__*/function () {
307
287
  });
308
288
  var wasFuzzyDir = wasAtIdx < 0 ? 0 : keyAndDirections[wasAtIdx][1];
309
289
  var wasSignDir = giveDirSignFor(wasFuzzyDir);
310
-
311
290
  if (change_way === CHANGE_WAYS.SIMPLE) {
312
291
  if (wasSignDir < 0 && _this.isThreeState) {
313
292
  if (_this.sortingState.length === 1) {
@@ -321,10 +300,8 @@ var KeyedColumnsRowIndexer = /*#__PURE__*/function () {
321
300
  } else {
322
301
  _this.sortingState.splice(wasAtIdx, 1);
323
302
  }
324
-
325
303
  var nextSign = wasSignDir ? -wasSignDir : 1;
326
304
  var nextKD = [colKey, canonicalForSign(nextSign)];
327
-
328
305
  _this.sortingState.unshift(nextKD);
329
306
  }
330
307
  } else if (change_way === CHANGE_WAYS.TAIL) {
@@ -349,152 +326,125 @@ var KeyedColumnsRowIndexer = /*#__PURE__*/function () {
349
326
  _this.sortingState[wasAtIdx][1] = canonicalForSign(-wasSignDir);
350
327
  } else {
351
328
  _this.lastUsedRank = wasAtIdx + 1;
352
-
353
329
  _this.sortingState.splice(wasAtIdx, 1);
354
330
  }
355
331
  }
356
332
  }
357
-
358
333
  _this._bumpVersion();
359
-
360
334
  return true;
361
335
  });
362
-
363
336
  _defineProperty(this, "codedRankByColumnIndex", function (columns) {
364
337
  return codedColumnsFromKeyAndDirection(_this.sortingState, columns);
365
338
  });
366
-
367
339
  _defineProperty(this, "columnSortingSignedRank", function (colKey) {
368
340
  var _this$sortingState;
369
-
370
- if (!(_this === null || _this === void 0 ? void 0 : (_this$sortingState = _this.sortingState) === null || _this$sortingState === void 0 ? void 0 : _this$sortingState.length)) return 0;
371
-
341
+ if (!(_this === null || _this === void 0 ? void 0 : (_this$sortingState = _this.sortingState) === null || _this$sortingState === void 0 ? void 0 : _this$sortingState.length)) {
342
+ return 0;
343
+ }
372
344
  var idx = _this.sortingState.findIndex(function (kd) {
373
345
  return kd[0] === colKey;
374
346
  });
375
-
376
- if (idx < 0) return 0;
347
+ if (idx < 0) {
348
+ return 0;
349
+ }
377
350
  var colSorting = _this.sortingState[idx];
378
351
  return giveDirSignFor(colSorting[1]) * (idx + 1);
379
352
  });
380
-
381
353
  _defineProperty(this, "highestCodedColumn", function (columns) {
382
354
  var _this$sortingState2;
383
-
384
- if (!(_this === null || _this === void 0 ? void 0 : (_this$sortingState2 = _this.sortingState) === null || _this$sortingState2 === void 0 ? void 0 : _this$sortingState2.length)) return 0;
355
+ if (!(_this === null || _this === void 0 ? void 0 : (_this$sortingState2 = _this.sortingState) === null || _this$sortingState2 === void 0 ? void 0 : _this$sortingState2.length)) {
356
+ return 0;
357
+ }
385
358
  var colSorting = _this.sortingState[0];
386
359
  var colKey = colSorting[0];
387
360
  var idx = columns.findIndex(function (col) {
388
361
  return col.dataKey === colKey;
389
362
  });
390
- if (idx < 0) return 0;
363
+ if (idx < 0) {
364
+ return 0;
365
+ }
391
366
  return giveDirSignFor(colSorting[1]) * (idx + 1);
392
367
  });
393
-
394
368
  _defineProperty(this, "_getColFilterParams", function (colKey, isForUser) {
395
369
  if (!colKey || !_this.byColFilter) {
396
370
  return undefined;
397
371
  }
398
-
399
372
  var colFilter = _this.byColFilter[colKey];
400
-
401
373
  if (!colFilter) {
402
374
  return undefined;
403
375
  }
404
-
405
376
  return colFilter[isForUser ? 'userParams' : 'outerParams'];
406
377
  });
407
-
408
378
  _defineProperty(this, "_setColFilterParams", function (colKey, params, isForUser) {
409
379
  if (!colKey) {
410
380
  if (params) {
411
381
  throw new Error('column key has to be defined');
412
382
  }
413
-
414
383
  return false;
415
384
  }
416
-
417
385
  var fieldName = isForUser ? 'userParams' : 'outerParams';
418
-
419
386
  if (params) {
420
387
  if (!_this.byColFilter) {
421
388
  _this.byColFilter = {};
422
389
  }
423
-
424
390
  var colFilter = _this.byColFilter[colKey];
425
-
426
391
  if (!colFilter) {
427
392
  colFilter = {};
428
393
  _this.byColFilter[colKey] = colFilter;
429
394
  } else if (colFilter[fieldName] === params) {
430
395
  return false;
431
396
  }
432
-
433
397
  colFilter[fieldName] = params;
434
398
  } else {
435
399
  var _this$byColFilter$col;
436
-
437
400
  if (!_this.byColFilter) {
438
401
  return false;
439
402
  }
440
-
441
403
  var otherFieldName = !isForUser ? 'userParams' : 'outerParams';
442
-
443
404
  if ((_this$byColFilter$col = _this.byColFilter[colKey]) === null || _this$byColFilter$col === void 0 ? void 0 : _this$byColFilter$col[otherFieldName]) {
444
405
  delete _this.byColFilter[colKey][fieldName];
445
406
  } else {
446
407
  delete _this.byColFilter[colKey];
447
408
  }
448
409
  }
449
-
450
410
  if (isForUser) {
451
411
  _this._bumpVersion(true);
452
412
  }
453
-
454
413
  return true;
455
414
  });
456
-
457
415
  _defineProperty(this, "getColFilterOuterParams", function (colKey) {
458
416
  return _this._getColFilterParams(colKey, false);
459
417
  });
460
-
461
418
  _defineProperty(this, "setColFilterOuterParams", function (colKey, outerParams) {
462
419
  return _this._setColFilterParams(colKey, outerParams, false);
463
420
  });
464
-
465
421
  _defineProperty(this, "getColFilterUserParams", function (colKey) {
466
422
  return _this._getColFilterParams(colKey, true);
467
423
  });
468
-
469
424
  _defineProperty(this, "setColFilterUserParams", function (colKey, params) {
470
425
  return _this._setColFilterParams(colKey, params, true);
471
426
  });
472
-
473
427
  _defineProperty(this, "getUserFiltering", function () {
474
428
  var ret = {};
475
-
476
429
  if (_this.byColFilter) {
477
430
  Object.entries(_this.byColFilter).forEach(function (_ref) {
478
431
  var k = _ref[0],
479
- v = _ref[1];
480
- if (!v.userParams) return;
432
+ v = _ref[1];
433
+ if (!v.userParams) {
434
+ return;
435
+ }
481
436
  ret[k] = [].concat(v.userParams);
482
437
  });
483
438
  }
484
-
485
439
  return ret;
486
440
  });
487
-
488
441
  _defineProperty(this, "updateRowFiltering", function (rowFilterFunc) {
489
442
  if (typeof rowFilterFunc !== 'function') {
490
443
  throw new Error('row filter should be a function');
491
444
  }
492
-
493
445
  _this.byRowFilter = rowFilterFunc;
494
-
495
446
  _this._bumpVersion();
496
447
  });
497
-
498
448
  this._versionSetter = versionSetter;
499
449
  this.version = 0;
500
450
  this.filterVersion = 0;
@@ -506,81 +456,96 @@ var KeyedColumnsRowIndexer = /*#__PURE__*/function () {
506
456
  this.sortingState = null;
507
457
  this.groupingCount = 0;
508
458
  this.byColFilter = null; // common
509
-
510
459
  this.byRowFilter = null;
511
460
  }
512
-
513
461
  _createClass(KeyedColumnsRowIndexer, null, [{
514
462
  key: "CHANGE_WAYS",
515
463
  get: function get() {
516
464
  return CHANGE_WAYS;
517
465
  }
518
466
  }]);
519
-
520
467
  return KeyedColumnsRowIndexer;
521
468
  }();
522
-
523
469
  exports.KeyedColumnsRowIndexer = KeyedColumnsRowIndexer;
524
-
525
470
  var giveDirSignFor = function giveDirSignFor(fuzzySign) {
526
- if (fuzzySign < 0) return -1;
527
- if (fuzzySign > 0) return 1;
528
- if (fuzzySign === 'asc') return 1;
529
- if (fuzzySign === 'desc') return -1;
471
+ if (fuzzySign < 0) {
472
+ return -1;
473
+ }
474
+ if (fuzzySign > 0) {
475
+ return 1;
476
+ }
477
+ if (fuzzySign === 'asc') {
478
+ return 1;
479
+ }
480
+ if (fuzzySign === 'desc') {
481
+ return -1;
482
+ }
530
483
  return 0;
531
484
  };
532
-
533
485
  var canonicalForSign = function canonicalForSign(dirSign) {
534
- if (dirSign > 0) return 'asc';
535
- if (dirSign < 0) return 'desc';
486
+ if (dirSign > 0) {
487
+ return 'asc';
488
+ }
489
+ if (dirSign < 0) {
490
+ return 'desc';
491
+ }
536
492
  return undefined;
537
493
  };
538
-
539
494
  var codedColumnsFromKeyAndDirection = function codedColumnsFromKeyAndDirection(keyAndDirections, columns) {
540
- if (!keyAndDirections) return null;
495
+ if (!keyAndDirections) {
496
+ return null;
497
+ }
541
498
  var ret = [];
542
499
  var columIndexByKey = {};
543
-
544
500
  for (var colIdx = 0; colIdx < columns.length; colIdx++) {
545
501
  var col = columns[colIdx];
546
502
  var colKey = col.dataKey;
547
503
  columIndexByKey[colKey] = colIdx;
548
504
  }
549
-
550
505
  for (var _iterator2 = _createForOfIteratorHelperLoose(keyAndDirections), _step2; !(_step2 = _iterator2()).done;) {
551
506
  var knd = _step2.value;
552
507
  var _colKey = knd[0];
553
508
  var dir = knd[1];
554
509
  var _colIdx = columIndexByKey[_colKey];
555
- if (_colIdx === undefined) continue;
510
+ if (_colIdx === undefined) {
511
+ continue;
512
+ }
556
513
  var sign = giveDirSignFor(dir);
557
514
  ret.push((_colIdx + 1) * sign);
558
515
  }
559
-
560
516
  return ret;
561
517
  };
562
-
563
518
  var compareValue = function compareValue(a, b, isNumeric, undefSign) {
564
519
  if (undefSign === void 0) {
565
520
  undefSign = -1;
566
521
  }
567
-
568
- if (a === undefined && b === undefined) return 0;else if (a === undefined) return undefSign;else if (b === undefined) return -undefSign;
569
-
522
+ if (a === undefined && b === undefined) {
523
+ return 0;
524
+ } else {
525
+ if (a === undefined) {
526
+ return undefSign;
527
+ } else {
528
+ if (b === undefined) {
529
+ return -undefSign;
530
+ }
531
+ }
532
+ }
570
533
  if (!isNumeric) {
571
534
  return ('' + a).localeCompare(b);
572
535
  } else {
573
- if (isNaN(a)) return isNaN(b) ? 0 : 1;
574
- if (isNaN(b)) return -1;
536
+ if (isNaN(a)) {
537
+ return isNaN(b) ? 0 : 1;
538
+ }
539
+ if (isNaN(b)) {
540
+ return -1;
541
+ }
575
542
  return Math.sign(Number(a) - Number(b));
576
543
  }
577
544
  };
578
-
579
545
  var makeCompositeComparatorFromCodedColumns = function makeCompositeComparatorFromCodedColumns(codedColumns, columns, rowExtractor) {
580
546
  return function (row_a_i, row_b_i) {
581
547
  var row_a = rowExtractor(row_a_i);
582
548
  var row_b = rowExtractor(row_b_i);
583
-
584
549
  for (var _iterator3 = _createForOfIteratorHelperLoose(codedColumns), _step3; !(_step3 = _iterator3()).done;) {
585
550
  var cc = _step3.value;
586
551
  var i = Math.abs(cc) - 1;
@@ -588,16 +553,13 @@ var makeCompositeComparatorFromCodedColumns = function makeCompositeComparatorFr
588
553
  var col = columns[i];
589
554
  var key = col.dataKey;
590
555
  var sgn = compareValue(row_a[key], row_b[key], col.numeric);
591
-
592
556
  if (sgn) {
593
557
  return mul * sgn;
594
558
  }
595
559
  }
596
-
597
560
  return 0;
598
561
  };
599
562
  };
600
-
601
563
  var groupRows = function groupRows(groupingColumnsCount, columns, indexedArray) {
602
564
  var groupingComparator = makeCompositeComparatorFromCodedColumns(Array(groupingColumnsCount).map(function (x, i) {
603
565
  return i + 1;
@@ -609,36 +571,30 @@ var groupRows = function groupRows(groupingColumnsCount, columns, indexedArray)
609
571
  var prevSlice = null;
610
572
  var inBuildGroup = [];
611
573
  groups.push(inBuildGroup);
612
-
613
574
  for (var _iterator4 = _createForOfIteratorHelperLoose(indexedArray), _step4; !(_step4 = _iterator4()).done;) {
614
575
  var p = _step4.value;
615
576
  var nextSlice = p[0].slice(0, groupingColumnsCount);
616
-
617
577
  if (prevSlice === null || !(0, _algos.equalsArray)(prevSlice, nextSlice)) {
618
578
  inBuildGroup = [];
619
579
  groups.push(inBuildGroup);
620
580
  }
621
-
622
581
  inBuildGroup.push(p);
623
582
  prevSlice = nextSlice;
624
583
  }
625
-
626
584
  return groups;
627
585
  };
628
-
629
586
  var groupAndSort = function groupAndSort(preFilteredRowPairs, codedColumns, groupingColumnsCount, columns) {
630
587
  var nothingToDo = !codedColumns && !groupingColumnsCount;
631
588
  var indexedArray = preFilteredRowPairs.rowAndOrigIndex;
632
589
  var noOutFiltered = preFilteredRowPairs.rowsCount === indexedArray.length;
633
-
634
590
  if (nothingToDo && noOutFiltered) {
635
591
  return null;
636
592
  } else if (!nothingToDo) {
637
593
  // make a copy for not losing base order
638
594
  indexedArray = [].concat(indexedArray);
639
595
  }
640
-
641
- if (nothingToDo) {// just nothing
596
+ if (nothingToDo) {
597
+ // just nothing
642
598
  } else if (!groupingColumnsCount) {
643
599
  var sortingComparator = makeCompositeComparatorFromCodedColumns(codedColumns, columns, function (ar) {
644
600
  return ar[0];
@@ -654,20 +610,15 @@ var groupAndSort = function groupAndSort(preFilteredRowPairs, codedColumns, grou
654
610
  return ar[0];
655
611
  });
656
612
  indexedArray = [];
657
-
658
613
  for (var _iterator5 = _createForOfIteratorHelperLoose(groups), _step5; !(_step5 = _iterator5()).done;) {
659
614
  var _indexedArray;
660
-
661
615
  var group = _step5.value;
662
616
  group.sort(intraGroupSortingComparator);
663
-
664
617
  (_indexedArray = indexedArray).push.apply(_indexedArray, group);
665
618
  }
666
619
  }
667
-
668
620
  return indexedArray;
669
621
  };
670
-
671
622
  var forTesting = {
672
623
  codedColumnsFromKeyAndDirection: codedColumnsFromKeyAndDirection,
673
624
  makeCompositeComparatorFromCodedColumns: makeCompositeComparatorFromCodedColumns