@refinitiv-ui/efx-grid 6.0.72 → 6.0.73

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 (29) hide show
  1. package/lib/column-selection-dialog/lib/column-selection-dialog.js +9 -7
  2. package/lib/column-selection-dialog/themes/base.less +4 -8
  3. package/lib/column-selection-dialog/themes/elemental/dark/column-selection-dialog.js +1 -1
  4. package/lib/column-selection-dialog/themes/elemental/dark/es5/all-elements.js +1 -1
  5. package/lib/column-selection-dialog/themes/elemental/light/column-selection-dialog.js +1 -1
  6. package/lib/column-selection-dialog/themes/elemental/light/es5/all-elements.js +1 -1
  7. package/lib/column-selection-dialog/themes/halo/column-selection-dialog.less +3 -0
  8. package/lib/column-selection-dialog/themes/halo/dark/column-selection-dialog.js +1 -1
  9. package/lib/column-selection-dialog/themes/halo/dark/es5/all-elements.js +1 -1
  10. package/lib/column-selection-dialog/themes/halo/light/column-selection-dialog.js +1 -1
  11. package/lib/column-selection-dialog/themes/halo/light/es5/all-elements.js +1 -1
  12. package/lib/column-selection-dialog/themes/solar/charcoal/column-selection-dialog.js +1 -1
  13. package/lib/column-selection-dialog/themes/solar/charcoal/es5/all-elements.js +1 -1
  14. package/lib/column-selection-dialog/themes/solar/column-selection-dialog.less +5 -1
  15. package/lib/column-selection-dialog/themes/solar/pearl/column-selection-dialog.js +1 -1
  16. package/lib/column-selection-dialog/themes/solar/pearl/es5/all-elements.js +1 -1
  17. package/lib/grid/index.js +1 -1
  18. package/lib/rt-grid/dist/rt-grid.js +33 -14
  19. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  20. package/lib/rt-grid/es6/Grid.d.ts +1 -1
  21. package/lib/rt-grid/es6/Grid.js +24 -12
  22. package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +27 -24
  23. package/lib/tr-grid-filter-input/es6/FilterInput.d.ts +2 -0
  24. package/lib/tr-grid-filter-input/es6/FilterInput.js +33 -0
  25. package/lib/tr-grid-row-filtering/es6/RowFiltering.js +35 -11
  26. package/lib/types/es6/FilterInput.d.ts +2 -0
  27. package/lib/types/es6/RealtimeGrid/Grid.d.ts +1 -1
  28. package/lib/versions.json +4 -4
  29. package/package.json +1 -1
@@ -188,7 +188,7 @@ declare class Grid extends EventDispatcher {
188
188
 
189
189
  public addStaticDataRows(dataRows: any[]|null, fields?: (string)[]|null): void;
190
190
 
191
- public updateDataSet(records: (any)[]|null, rowIdentifier: string): void;
191
+ public updateDataSet(records: (any)[]|null, rowIdentifier?: string|null): void;
192
192
 
193
193
  public removeRow(rowRef: Grid.RowReference|null): RowDefinition|null;
194
194
 
@@ -2402,7 +2402,7 @@ Grid.prototype.addStaticDataRows = function(dataRows, fields) {
2402
2402
  /** Insert, update, remove and reorder data based on the given array of records
2403
2403
  * @public
2404
2404
  * @param {Array.<Object>} records Array of records for insert, remove, update, reorder in one operation
2405
- * @param {string} rowIdentifier Check difference data with the row identifier map property for operate record.
2405
+ * @param {string=} rowIdentifier Check difference data with the row identifier map property for operate record.
2406
2406
  * @example
2407
2407
  * // Grid data set will be updated to 3 records. All rows in the grid will be cleared and new rows will be inserted
2408
2408
  * grid.updateDataSet([
@@ -2454,14 +2454,25 @@ Grid.prototype.updateDataSet = function(records, rowIdentifier) {
2454
2454
  var rowDef, id, record, i;
2455
2455
  var rowDefs = this.getAllRowDefinitions(); // Include the filter/hidden rows
2456
2456
  var rowDefCount = rowDefs.length;
2457
- for (i = 0; i < rowDefCount; i++) {
2458
- rowDef = rowDefs[i];
2459
- if(rowDef) {
2460
- id = rowDef.getRowData()[rowIdentifier];
2461
- if(id || id === 0) {
2462
- oldDataMap[id] = rowDef;
2463
- } else { // Any existing rowDef without row identifier should be removed
2464
- this.removeRow(rowDef); // Slow
2457
+ if(rowIdentifier) {
2458
+ for (i = 0; i < rowDefCount; i++) {
2459
+ rowDef = rowDefs[i];
2460
+ if(rowDef) {
2461
+ id = rowDef.getRowData()[rowIdentifier];
2462
+ if(id || id === 0) {
2463
+ oldDataMap[id] = rowDef;
2464
+ } else { // Any existing rowDef without row identifier should be removed
2465
+ this.removeRow(rowDef); // Slow
2466
+ }
2467
+ }
2468
+ }
2469
+ } else {
2470
+ for (i = 0; i < rowDefCount; i++) {
2471
+ record = records[i];
2472
+ if(record) {
2473
+ oldDataMap[i] = rowDefs[i]; // Use index instead of rowIdentifier
2474
+ } else {
2475
+ this.removeRow(rowDefs[i]); // Need to use rowRef, can't use index in view
2465
2476
  }
2466
2477
  }
2467
2478
  }
@@ -2471,7 +2482,7 @@ Grid.prototype.updateDataSet = function(records, rowIdentifier) {
2471
2482
  var newDataMap = {};
2472
2483
  for (i = recordCount - 1; i >= 0; i--) {
2473
2484
  record = records[i];
2474
- id = record[rowIdentifier];
2485
+ id = rowIdentifier ? record[rowIdentifier] : i;
2475
2486
  rowDef = oldDataMap[id];
2476
2487
  newDataMap[id] = record; // Assign a new data map to compare to the previous data
2477
2488
  record[fieldSorting] = i;
@@ -2493,8 +2504,9 @@ Grid.prototype.updateDataSet = function(records, rowIdentifier) {
2493
2504
  }
2494
2505
  }
2495
2506
 
2496
- // Sorting
2497
- this._dt.sortOnce(ROW_DEF, "a", compareNumber, fieldSorting);
2507
+ if(rowIdentifier) {
2508
+ this._dt.sortOnce(ROW_DEF, "a", compareNumber, fieldSorting);
2509
+ }
2498
2510
  };
2499
2511
  /** @private
2500
2512
  * @param {Array|Object} item
@@ -1156,8 +1156,8 @@ ConditionalColoringPlugin.prototype._onSectionBinding = function (e) {
1156
1156
  return; // dataRows could be empty in case of no column is presented
1157
1157
  }
1158
1158
 
1159
- var c, r, cell, painter, changedCols, rowDef, rid, changedRow, changedRows, allowBlinking, insertedRow;
1160
- var dataRow, insertedId, colData, blinking, bgBlinking, cachedValues, updatePrev;
1159
+ var c, r, cell, painter, changedCols, rowDef, rid, changedRow, changedRows;
1160
+ var dataRow, insertedId, colData, cachedValues, updatePrev;
1161
1161
  var section = e["section"];
1162
1162
  var colCount = section.getColumnCount();
1163
1163
  var fromR = /** @type{number} */(e["fromRowIndex"]);
@@ -1182,27 +1182,28 @@ ConditionalColoringPlugin.prototype._onSectionBinding = function (e) {
1182
1182
  if (!dataRow) continue; // prevent from null value access when using with RowGroupingExtension
1183
1183
 
1184
1184
  changedCols = null;
1185
+ var allowBlinking = false;
1186
+ var insertedRow = null;
1185
1187
  if (blinkingEnabled) {
1186
1188
  if (this._realTimeGrid) {
1187
1189
  // TODO: check rid from e.rids
1188
1190
  rowDef = /** @type{RowDefinition} */(dataRow["ROW_DEF"]);
1189
- rid = rowDef ? rowDef.getRowId() : "";
1190
- insertedRow = insertedId[rid];
1191
- allowBlinking = !insertedRow || this._insertionBlinking;
1192
- if (rid && allowBlinking) {
1191
+ if(rowDef){
1192
+ rid = rowDef.getRowId();
1193
1193
  changedCols = rowDef.getUpdates();
1194
1194
  }
1195
1195
  } else { // composite grid
1196
1196
  changedRow = changedRows[r];
1197
1197
  if (changedRow) {
1198
1198
  rid = changedRow.rid;
1199
- insertedRow = insertedId[rid];
1200
- allowBlinking = !insertedRow || this._insertionBlinking;
1201
- if (allowBlinking) {
1202
- changedCols = changedRow.changed;
1203
- }
1199
+ changedCols = changedRow.changed;
1204
1200
  }
1205
1201
  }
1202
+ insertedRow = rid ? insertedId[rid] : null;
1203
+ allowBlinking = !insertedRow || this._insertionBlinking;
1204
+ if (!allowBlinking) {
1205
+ changedCols = null;
1206
+ }
1206
1207
  }
1207
1208
 
1208
1209
  if (!rid) {
@@ -1225,24 +1226,26 @@ ConditionalColoringPlugin.prototype._onSectionBinding = function (e) {
1225
1226
  painter = this.getColumnPainter(c);
1226
1227
  if (painter) {
1227
1228
  colData = this._getColumnData(c);
1228
- bgBlinking = false;
1229
- blinking = false;
1230
- if (colData["blinking"] && actualUpdate && allowBlinking) { // blinking
1229
+ var bgBlinking = false;
1230
+ if (colData["blinking"] && actualUpdate) {
1231
+ var blinking = false;
1231
1232
  var field = colData["blinkingField"] || this._getField(c);
1232
1233
  var newValue = dataRow[field];
1233
- if (prevDataRow) {
1234
- var prevValue = prevDataRow[field];
1235
- if (prevValue != null) {
1236
- if (changedCols && changedCols[field]) {
1234
+ if(allowBlinking){
1235
+ if (prevDataRow) {
1236
+ var prevValue = prevDataRow[field];
1237
+ if (prevValue != null) {
1238
+ if (changedCols && changedCols[field]) {
1239
+ blinking = true;
1240
+ bgBlinking = painter.blinkCell(cell, newValue, prevValue, dataRow, dataRow);
1241
+ }
1242
+ }
1243
+ } else {
1244
+ if(prevRowCount && insertedRow){
1237
1245
  blinking = true;
1238
- bgBlinking = painter.blinkCell(cell, newValue, prevValue, dataRow, dataRow);
1246
+ bgBlinking = painter.blinkCell(cell, newValue, newValue, dataRow, dataRow);
1239
1247
  }
1240
1248
  }
1241
- } else {
1242
- if(prevRowCount && insertedRow){
1243
- blinking = true;
1244
- bgBlinking = painter.blinkCell(cell, newValue, newValue, dataRow, dataRow);
1245
- }
1246
1249
  }
1247
1250
 
1248
1251
  if (!blinking) {
@@ -48,6 +48,8 @@ declare class FilterInputPlugin extends GridPlugin {
48
48
 
49
49
  public removeColumnFilter(colIndex?: (null|number)|null): void;
50
50
 
51
+ public setInputValue(colIndex: number, value: any): void;
52
+
51
53
  public refresh(delayMs?: number|null): void;
52
54
 
53
55
  public setFilterLogic(colIndex: number, func: ((...params: any[]) => any)|null, ctx?: any): void;
@@ -837,11 +837,44 @@ FilterInputPlugin.prototype.removeColumnFilters = function (colIndex) {
837
837
 
838
838
 
839
839
  FilterInputPlugin.prototype.removeColumnFilter = FilterInputPlugin.prototype.removeColumnFilters;
840
+ /** @public
841
+ * @param {number} colIndex
842
+ * @param {*} value
843
+ */
844
+
845
+ FilterInputPlugin.prototype.setInputValue = function (colIndex, value) {
846
+ var inputElem = this.getColumnInput(colIndex);
847
+
848
+ if (!inputElem) {
849
+ return;
850
+ }
851
+
852
+ var colOpt = this._getExtColumnOption(colIndex);
853
+
854
+ var type = colOpt.type ? colOpt.type.toLowerCase() : "";
855
+
856
+ if (type == "date") {
857
+ var dateObj = ElfDate.from(value);
858
+ value = dateObj ? dateObj.toDateString().substr(4) : "";
859
+ }
860
+
861
+ if (type == "multiselect") {
862
+ inputElem.values = value;
863
+
864
+ var textMap = FilterInputPlugin._createMapObject(value);
865
+
866
+ this.filterColumn(colIndex, "", textMap);
867
+ } else {
868
+ inputElem.value = value;
869
+ this.filterColumn(colIndex, value);
870
+ }
871
+ };
840
872
  /** Force filtering for every column
841
873
  * @public
842
874
  * @param {number=} delayMs=0 Set delay in millisecond to avoid repeatedly filtering
843
875
  */
844
876
 
877
+
845
878
  FilterInputPlugin.prototype.refresh = function (delayMs) {
846
879
  if (delayMs) {
847
880
  if (!this._refreshTimer) {
@@ -209,7 +209,7 @@ RowFilteringPlugin.prototype._uiTimerId = 0;
209
209
  * @private
210
210
  */
211
211
 
212
- RowFilteringPlugin.prototype._dvTimerId = 0;
212
+ RowFilteringPlugin.prototype._filterTimerId = 0;
213
213
  /** @type {Function}
214
214
  * @private
215
215
  */
@@ -315,6 +315,16 @@ RowFilteringPlugin.prototype.unload = function (host) {
315
315
  host.unlisten("columnRemoved", this._onColumnRemoved);
316
316
 
317
317
  if (!this._hosts.length) {
318
+ if (this._uiTimerId) {
319
+ clearTimeout(this._uiTimerId);
320
+ this._uiTimerId = 0;
321
+ }
322
+
323
+ if (this._filterTimerId) {
324
+ clearTimeout(this._filterTimerId);
325
+ this._filterTimerId = 0;
326
+ }
327
+
318
328
  this._hasPendingFilter = false;
319
329
 
320
330
  if (this._filterDialog) {
@@ -688,6 +698,18 @@ RowFilteringPlugin.prototype._parseFilter = function (exp, colIndex, ctx) {
688
698
 
689
699
 
690
700
  RowFilteringPlugin.prototype.addColumnFilter = function (colIndex, exp, ctx) {
701
+ if (colIndex < 0 || colIndex >= this.getColumnCount()) {
702
+ return false;
703
+ }
704
+
705
+ var cfo = this._getColumnFilterOption(colIndex);
706
+
707
+ if (cfo) {
708
+ if (cfo._expressions[0] === exp) {
709
+ return false; // The same expression is getting added on the same column twice
710
+ }
711
+ }
712
+
691
713
  var func = null;
692
714
 
693
715
  if (typeof exp === "function") {
@@ -706,10 +728,6 @@ RowFilteringPlugin.prototype.addColumnFilter = function (colIndex, exp, ctx) {
706
728
  return false;
707
729
  }
708
730
 
709
- if (colIndex < 0 || colIndex >= this.getColumnCount()) {
710
- return false;
711
- }
712
-
713
731
  var colSettings = this._getUserColumnSettings(colIndex);
714
732
 
715
733
  colSettings.expression = exp; // WARNING: Only the last expression are saved (previous one is overwritten)
@@ -728,8 +746,7 @@ RowFilteringPlugin.prototype.addColumnFilter = function (colIndex, exp, ctx) {
728
746
  ctx["field"] = field;
729
747
  }
730
748
 
731
- var cfo = this._initColumnFilterOption(colIndex);
732
-
749
+ cfo = this._initColumnFilterOption(colIndex);
733
750
  cfo._field = field; // TODO: Handle fieldDataType
734
751
 
735
752
  cfo._filters.push(func);
@@ -811,6 +828,7 @@ RowFilteringPlugin.prototype._getColumnExpression = function (colIndex) {
811
828
  * @private
812
829
  * @param {number} colIndex
813
830
  * @param {RowFilteringPlugin~ColumnOptions} userObj
831
+ * @returns {boolean} Returns true if there is an active filter in the column options
814
832
  * @example
815
833
  * var colDef1 = {
816
834
  * "field": "PCTCHNG",
@@ -861,6 +879,8 @@ RowFilteringPlugin.prototype._setColumnOptions = function (colIndex, userObj) {
861
879
  if (iconActivation == "always" || iconActivation == "onHover") {
862
880
  this._updateColumnIcon(colIndex);
863
881
  }
882
+
883
+ return exp != null;
864
884
  };
865
885
  /** @private
866
886
  * @param {number} colIndex
@@ -1374,8 +1394,8 @@ RowFilteringPlugin.prototype._filterLogic = function (rid, rowData) {
1374
1394
 
1375
1395
 
1376
1396
  RowFilteringPlugin.prototype._requestFilterRefresh = function () {
1377
- if (!this._dvTimerId) {
1378
- this._dvTimerId = setTimeout(this.refresh, 10);
1397
+ if (!this._filterTimerId) {
1398
+ this._filterTimerId = setTimeout(this.refresh, 10);
1379
1399
  }
1380
1400
  };
1381
1401
  /** @private */
@@ -1398,7 +1418,7 @@ RowFilteringPlugin.prototype._setTimerForUpdatingIcons = function () {
1398
1418
 
1399
1419
 
1400
1420
  RowFilteringPlugin.prototype.refresh = function () {
1401
- this._dvTimerId = 0;
1421
+ this._filterTimerId = 0;
1402
1422
  this._activeColFilters = this._columnFilters; //check cstp
1403
1423
 
1404
1424
  var cstkp = this._getPlugin("ColumnStackPlugin");
@@ -2292,7 +2312,11 @@ RowFilteringPlugin.prototype._onDialogSortChanged = function (e) {
2292
2312
 
2293
2313
  RowFilteringPlugin.prototype._onColumnAdded = function (e) {
2294
2314
  if (e["context"]) {
2295
- this._setColumnOptions(e["colIndex"], e["context"]);
2315
+ var hasFilter = this._setColumnOptions(e["colIndex"], e["context"]);
2316
+
2317
+ if (hasFilter) {
2318
+ this._applyPendingFilter();
2319
+ }
2296
2320
  }
2297
2321
  };
2298
2322
  /** @private
@@ -48,6 +48,8 @@ declare class FilterInputPlugin extends GridPlugin {
48
48
 
49
49
  public removeColumnFilter(colIndex?: (null|number)|null): void;
50
50
 
51
+ public setInputValue(colIndex: number, value: any): void;
52
+
51
53
  public refresh(delayMs?: number|null): void;
52
54
 
53
55
  public setFilterLogic(colIndex: number, func: ((...params: any[]) => any)|null, ctx?: any): void;
@@ -190,7 +190,7 @@ declare class Grid extends EventDispatcher {
190
190
 
191
191
  public addStaticDataRows(dataRows: any[]|null, fields?: (string)[]|null): void;
192
192
 
193
- public updateDataSet(records: (any)[]|null, rowIdentifier: string): void;
193
+ public updateDataSet(records: (any)[]|null, rowIdentifier?: string|null): void;
194
194
 
195
195
  public removeRow(rowRef: Grid.RowReference|null): RowDefinition|null;
196
196
 
package/lib/versions.json CHANGED
@@ -14,24 +14,24 @@
14
14
  "tr-grid-column-resizing": "1.0.28",
15
15
  "tr-grid-column-selection": "1.0.31",
16
16
  "tr-grid-column-stack": "1.0.73",
17
- "tr-grid-conditional-coloring": "1.0.66",
17
+ "tr-grid-conditional-coloring": "1.0.67",
18
18
  "tr-grid-content-wrap": "1.0.20",
19
19
  "tr-grid-contextmenu": "1.0.40",
20
- "tr-grid-filter-input": "0.9.36",
20
+ "tr-grid-filter-input": "0.9.37",
21
21
  "tr-grid-heat-map": "1.0.29",
22
22
  "tr-grid-in-cell-editing": "1.0.81",
23
23
  "tr-grid-pagination": "1.0.24",
24
24
  "tr-grid-percent-bar": "1.0.22",
25
25
  "tr-grid-range-bar": "2.0.5",
26
26
  "tr-grid-row-dragging": "1.0.31",
27
- "tr-grid-row-filtering": "1.0.64",
27
+ "tr-grid-row-filtering": "1.0.65",
28
28
  "tr-grid-row-grouping": "1.0.82",
29
29
  "tr-grid-row-selection": "1.0.25",
30
30
  "tr-grid-rowcoloring": "1.0.25",
31
31
  "tr-grid-textformatting": "1.0.46",
32
32
  "tr-grid-titlewrap": "1.0.20",
33
33
  "@grid/formatters": "1.0.50",
34
- "@grid/column-selection-dialog": "4.0.54",
34
+ "@grid/column-selection-dialog": "4.0.55",
35
35
  "@grid/filter-dialog": "4.0.60",
36
36
  "@grid/column-format-dialog": "4.0.44"
37
37
  }
package/package.json CHANGED
@@ -66,5 +66,5 @@
66
66
  "publishConfig": {
67
67
  "access": "public"
68
68
  },
69
- "version": "6.0.72"
69
+ "version": "6.0.73"
70
70
  }