@refinitiv-ui/efx-grid 6.0.151 → 6.0.153

Sign up to get free protection for your applications and to get access to all the features.
package/lib/grid/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  import {Grid} from "./lib/efx-grid.js";
2
2
  export {Grid}
3
- window.EFX_GRID = { version: "6.0.151" };
3
+ window.EFX_GRID = { version: "6.0.153" };
@@ -61,7 +61,8 @@ declare namespace RowFilteringPlugin {
61
61
  filterChanged?: ((...params: any[]) => any)|null,
62
62
  beforeDialogOpened?: ((...params: any[]) => any)|null,
63
63
  dialogCommitted?: ((...params: any[]) => any)|null,
64
- refreshed?: ((...params: any[]) => any)|null
64
+ refreshed?: ((...params: any[]) => any)|null,
65
+ activeIconState?: boolean|null
65
66
  };
66
67
 
67
68
  }
@@ -120,6 +121,10 @@ declare class RowFilteringPlugin extends GridPlugin {
120
121
 
121
122
  public getColumnFilterIcons(colIndex: number): (Element)[]|null;
122
123
 
124
+ public setColumnFilterIconState(colIndex: number, active: boolean): void;
125
+
126
+ public getColumnFilterIconState(colIndex: number): boolean;
127
+
123
128
  public updateAllColumnIcons(): void;
124
129
 
125
130
  public addDataView(dv: any): void;
@@ -118,6 +118,7 @@ The expression can take various forms:<br>
118
118
  * @property {Function=} beforeDialogOpened=null Event handler dispatched before dialog opening.
119
119
  * @property {Function=} dialogCommitted=null Event handler dispatched whenever the new settings from dialog are applied.
120
120
  * @property {Function=} refreshed=null Event handler dispatched after new filter is applied to grid's data view.
121
+ * @property {boolean=} activeIconState=true If disabled, filter icon won't be automatically changed its state when filter in a column is changed.
121
122
  */
122
123
 
123
124
  /** @private
@@ -336,12 +337,15 @@ RowFilteringPlugin._filterBuilder = null;
336
337
  * @private
337
338
  */
338
339
  RowFilteringPlugin._dialogTagName; // intentionally left undefined
339
-
340
340
  /** Array of DataView objects
341
341
  * @type {!Array.<Object>}
342
342
  * @private
343
343
  */
344
344
  RowFilteringPlugin.prototype._dvs;
345
+ /** @type {boolean}
346
+ * @private
347
+ */
348
+ RowFilteringPlugin.prototype._activeIconState = true;
345
349
 
346
350
 
347
351
  /** @public
@@ -552,6 +556,9 @@ RowFilteringPlugin.prototype.config = function (options) {
552
556
  if(rowFiltering["dialogOptions"]){
553
557
  this._dialogOptions = rowFiltering["dialogOptions"];
554
558
  }
559
+ if(rowFiltering["activeIconState"] != null){
560
+ this._activeIconState = !!rowFiltering["activeIconState"];
561
+ }
555
562
  if(rowFiltering["clicked"]) {
556
563
  rowFiltering["click"] = rowFiltering["clicked"];
557
564
  }
@@ -635,6 +642,10 @@ RowFilteringPlugin.prototype.getConfigObject = function (gridOptions) {
635
642
  extOptions.dialogOptions = this._dialogOptions; // TODO: dialogOptions should not contain any function
636
643
  dirty = true;
637
644
  }
645
+ if(!this._activeIconState) {
646
+ extOptions.activeIconState = false;
647
+ dirty = true;
648
+ }
638
649
  // TODO: get emptySegmentFiltering setting from DataView
639
650
  // TODO: get separatorFiltering setting from DataView
640
651
  if(dirty) {
@@ -1211,26 +1222,74 @@ RowFilteringPlugin.prototype.setFilterExpressions = function(filterExps) {
1211
1222
  RowFilteringPlugin.prototype.hasColumnFilter = function() {
1212
1223
  return (this._columnFilters.length > 0);
1213
1224
  };
1214
- /** @public
1225
+
1226
+ /** @private
1215
1227
  * @param {number} colIndex
1216
- * @return {Array.<Element>} icons
1228
+ * @return {Array.<Element>} Bottom cells from title section of all grids
1217
1229
  */
1218
- RowFilteringPlugin.prototype.getColumnFilterIcons = function(colIndex) {
1219
- let icons = [];
1230
+ RowFilteringPlugin.prototype._getBottomTitleCells = function(colIndex) {
1231
+ var cells = [];
1220
1232
  for(let i = this._hosts.length; --i >= 0;) {
1221
1233
  let host = this._hosts[i];
1222
1234
  let tsect = host.getSection("title");
1223
- if(!tsect) {
1224
- continue;
1235
+ if(tsect) {
1236
+ let rowCount = tsect.getRowCount();
1237
+ let cell = tsect.getCell(colIndex, rowCount - 1, true); // Get bottom cell
1238
+ if(cell) {
1239
+ cells.push(cell);
1240
+ }
1225
1241
  }
1226
- let rCount = tsect.getRowCount();
1227
- let cell = tsect.getCell(colIndex, rCount - 1, true); // Get bottom cell
1228
- if(cell && cell._filterIcon) {
1242
+ }
1243
+ return cells;
1244
+ };
1245
+ /** @public
1246
+ * @param {number} colIndex
1247
+ * @return {Array.<Element>} icons
1248
+ */
1249
+ RowFilteringPlugin.prototype.getColumnFilterIcons = function(colIndex) {
1250
+ let icons = [];
1251
+ let cells = this._getBottomTitleCells(colIndex);
1252
+ let len = cells.length;
1253
+ for(let i = 0; i < len; ++i) {
1254
+ let cell = cells[i];
1255
+ if(cell._filterIcon) {
1229
1256
  icons.push(cell._filterIcon);
1230
1257
  }
1231
1258
  }
1232
1259
  return icons;
1233
1260
  };
1261
+ /** Change specified filter icon state regardless of existing filter in the column. This method does NOT change the visibility of the icon.
1262
+ * @public
1263
+ * @param {number} colIndex
1264
+ * @param {boolean} active
1265
+ */
1266
+ RowFilteringPlugin.prototype.setColumnFilterIconState = function(colIndex, active) {
1267
+ let cells = this._getBottomTitleCells(colIndex);
1268
+ let len = cells.length;
1269
+ for(let i = 0; i < len; ++i) {
1270
+ let cell = cells[i];
1271
+ if(cell._filterIcon) {
1272
+ cell.enableClass("active-filter", active);
1273
+ }
1274
+ }
1275
+ };
1276
+ /** @public
1277
+ * @param {number} colIndex
1278
+ * @returns {boolean} active
1279
+ */
1280
+ RowFilteringPlugin.prototype.getColumnFilterIconState = function(colIndex) {
1281
+ let cells = this._getBottomTitleCells(colIndex);
1282
+ let len = cells.length;
1283
+ for(let i = 0; i < len; ++i) {
1284
+ let cell = cells[i];
1285
+ if(cell._filterIcon) {
1286
+ if(cell.hasClass("active-filter")) {
1287
+ return true;
1288
+ }
1289
+ }
1290
+ }
1291
+ return false;
1292
+ };
1234
1293
  /** @public */
1235
1294
  RowFilteringPlugin.prototype.updateAllColumnIcons = function() {
1236
1295
  if(this._uiTimerId) {
@@ -1451,16 +1510,20 @@ RowFilteringPlugin.prototype._updateColumnIcon = function(colIndex) {
1451
1510
  cell.insertFloatingIcon(filterIcon, 10);
1452
1511
  cell._filterIcon = filterIcon;
1453
1512
  }
1454
- if(hasFilter){
1455
- cell.enableClass("active-filter", true);
1456
- }else{
1457
- cell.enableClass("active-filter", false);
1513
+ if(this._activeIconState) {
1514
+ if(hasFilter){
1515
+ cell.enableClass("active-filter", true);
1516
+ }else{
1517
+ cell.enableClass("active-filter", false);
1518
+ }
1458
1519
  }
1459
1520
  } else {
1460
1521
  if(cell._filterIcon) {
1461
1522
  cell.removeFloatingIcon(cell._filterIcon);
1462
1523
  cell._filterIcon = null;
1463
- cell.enableClass("active-filter", false);
1524
+ if(this._activeIconState) {
1525
+ cell.enableClass("active-filter", false);
1526
+ }
1464
1527
  }
1465
1528
  }
1466
1529
  }
@@ -61,7 +61,8 @@ declare namespace RowFilteringPlugin {
61
61
  filterChanged?: ((...params: any[]) => any)|null,
62
62
  beforeDialogOpened?: ((...params: any[]) => any)|null,
63
63
  dialogCommitted?: ((...params: any[]) => any)|null,
64
- refreshed?: ((...params: any[]) => any)|null
64
+ refreshed?: ((...params: any[]) => any)|null,
65
+ activeIconState?: boolean|null
65
66
  };
66
67
 
67
68
  }
@@ -120,6 +121,10 @@ declare class RowFilteringPlugin extends GridPlugin {
120
121
 
121
122
  public getColumnFilterIcons(colIndex: number): (Element)[]|null;
122
123
 
124
+ public setColumnFilterIconState(colIndex: number, active: boolean): void;
125
+
126
+ public getColumnFilterIconState(colIndex: number): boolean;
127
+
123
128
  public updateAllColumnIcons(): void;
124
129
 
125
130
  public addDataView(dv: any): void;
package/lib/versions.json CHANGED
@@ -24,7 +24,7 @@
24
24
  "tr-grid-percent-bar": "1.0.24",
25
25
  "tr-grid-range-bar": "2.0.9",
26
26
  "tr-grid-row-dragging": "1.0.39",
27
- "tr-grid-row-filtering": "1.0.89",
27
+ "tr-grid-row-filtering": "1.0.90",
28
28
  "tr-grid-row-grouping": "1.0.88",
29
29
  "tr-grid-row-selection": "1.0.33",
30
30
  "tr-grid-rowcoloring": "1.0.26",
package/package.json CHANGED
@@ -69,5 +69,5 @@
69
69
  "publishConfig": {
70
70
  "access": "public"
71
71
  },
72
- "version": "6.0.151"
72
+ "version": "6.0.153"
73
73
  }