@refinitiv-ui/efx-grid 6.0.137 → 6.0.139

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.
@@ -93,6 +93,7 @@ The expression can take various forms:<br>
93
93
  * @property {boolean=} compactMode=false force compact mode in dialog
94
94
  * @property {(boolean|string)=} blankValues=false Display a "(Blanks)" item in the filter dialog to represent an empty value. If a string is passed, it will be used as the label for the blank item
95
95
  * @property {string=} dateTimeFormat="dd-MM-yy" Specifies the string format for the date time picker in the filter dialog based on date-fns format, follow https://date-fns.org/v3.6.0/docs/format.
96
+ * @property {boolean=} showOnlyFilteredItems=false If enabled, rows that are filtered out by other columns will not appear in the list, regardless of the current filter settings.
96
97
  */
97
98
 
98
99
  /** @typedef {Object} RowFilteringPlugin~FilterEntry
@@ -1134,17 +1135,31 @@ RowFilteringPlugin.prototype.getFilters = function() {
1134
1135
  * @see {@link RowFilteringPlugin.getConfigObject}
1135
1136
  */
1136
1137
  RowFilteringPlugin.prototype.getAllColumnFilters = function() {
1138
+ return this._getAllColumnFilters();
1139
+ };
1140
+ /**
1141
+ * @private
1142
+ * @param {Object=} excludedMap
1143
+ * @return {!Array.<Function>} All column filters
1144
+ */
1145
+ RowFilteringPlugin.prototype._getAllColumnFilters = function(excludedMap) {
1146
+ if(!excludedMap || typeof excludedMap !== "object") {
1147
+ excludedMap = {};
1148
+ }
1137
1149
  let filters = [];
1138
1150
  let len = this._columnFilters.length;
1139
1151
  for(let i = 0; i < len; ++i) {
1140
1152
  let cfo = this._columnFilters[i];
1141
- let jLen = cfo._filters.length;
1142
- for(let j = 0; j < jLen; ++j) {
1143
- filters.push(cfo._filters[j]);
1153
+ if(!excludedMap[cfo._field]) {
1154
+ let jLen = cfo._filters.length;
1155
+ for(let j = 0; j < jLen; ++j) {
1156
+ filters.push(cfo._filters[j]);
1157
+ }
1144
1158
  }
1145
1159
  }
1146
1160
  return filters;
1147
1161
  };
1162
+
1148
1163
  /** Deprecated in favor of getConfigObject(). Get existing filter expressions for saving and restoring.
1149
1164
  * @public
1150
1165
  * @return {Array.<RowFilteringPlugin~FilterExpression>} Return null if there is no column filter
@@ -1613,6 +1628,24 @@ let _collectUniqueValue = function(uniqueValues, formattedVal, rawVal) {
1613
1628
  uniqueValues[formattedVal] = [rawVal];
1614
1629
  }
1615
1630
  };
1631
+
1632
+ /** @private
1633
+ * @param {Object} row
1634
+ * @param {Array.<Function>} filterFuncs
1635
+ * @return {boolean}
1636
+ */
1637
+ let isFilteredOutRow = function(row, filterFuncs) {
1638
+ let len = filterFuncs.length;
1639
+ if(len) {
1640
+ for(let i = 0; i < len; i++) {
1641
+ if(!filterFuncs[i](row)) {
1642
+ return true;
1643
+ }
1644
+ }
1645
+ }
1646
+ return false;
1647
+ };
1648
+
1616
1649
  /** @private
1617
1650
  * @param {string} field A field name for getting raw value from row data
1618
1651
  * @param {!Object} dialogConfig
@@ -1636,6 +1669,10 @@ RowFilteringPlugin.prototype._getUniqueValues = function(field, dialogConfig, fo
1636
1669
  let blankAtLeastOne = false;
1637
1670
  if(!Array.isArray(userItemList)) {
1638
1671
  userItemList = null;
1672
+ let excludedMap = {};
1673
+ excludedMap[field] = true;
1674
+ let funcs = this._getAllColumnFilters(excludedMap);
1675
+ let showOnlyFilteredItems = dialogConfig.showOnlyFilteredItems;
1639
1676
  let dvs = this._getAvailableDataViews();
1640
1677
  let dts = dvs.map(this._getDataTable);
1641
1678
  let tblCount = dts.length;
@@ -1650,6 +1687,9 @@ RowFilteringPlugin.prototype._getUniqueValues = function(field, dialogConfig, fo
1650
1687
  if(this._rowTransform) {
1651
1688
  row = this._rowTransform(row);
1652
1689
  }
1690
+ if(showOnlyFilteredItems && isFilteredOutRow(row, funcs)) {
1691
+ continue;
1692
+ }
1653
1693
  let fieldVal = row[field];
1654
1694
  rawVal = fieldVal;
1655
1695
  if(rawDataAccessor) {
@@ -1879,7 +1919,8 @@ RowFilteringPlugin.prototype.openDialog = function(colIndex, runtimeDialogOption
1879
1919
  formattedDataAccessor: null,
1880
1920
  sortLogic: null,
1881
1921
  blankValues: false,
1882
- blankValuesChecked: false
1922
+ blankValuesChecked: false,
1923
+ showOnlyFilteredItems: false
1883
1924
  };
1884
1925
 
1885
1926
  let columnDialogOptions = null;
@@ -1932,7 +1973,7 @@ RowFilteringPlugin.prototype.openDialog = function(colIndex, runtimeDialogOption
1932
1973
  filterMode = "advanced";
1933
1974
  }
1934
1975
  } else if(typeof exp === "function" || typeof exp === "string" || typeof exp === "object") {
1935
- if(typeof exp === "object") {
1976
+ if(typeof exp === "object" && !dialogConfig.showOnlyFilteredItems) {
1936
1977
  for(let expKey in exp) {
1937
1978
  _pushRawValue(userInputs, expKey, exp[expKey]);
1938
1979
  }
@@ -2058,6 +2099,11 @@ RowFilteringPlugin._overrideConfig = function(config, userConfig) {
2058
2099
  config.lang = lang;
2059
2100
  }
2060
2101
 
2102
+ let showOnlyFilteredItems = userConfig["showOnlyFilteredItems"];
2103
+ if(showOnlyFilteredItems != null) {
2104
+ config.showOnlyFilteredItems = showOnlyFilteredItems;
2105
+ }
2106
+
2061
2107
  let rawDataAccessor = userConfig["rawDataAccessor"];
2062
2108
  if(typeof rawDataAccessor === "function" || rawDataAccessor === null) { // Allow null value
2063
2109
  config.rawDataAccessor = rawDataAccessor;
@@ -37,7 +37,8 @@ declare namespace RowFilteringPlugin {
37
37
  itemList?: any[]|null,
38
38
  additionalItems?: any[]|null,
39
39
  compactMode?: boolean|null,
40
- blankValues?: (boolean|string)|null
40
+ blankValues?: (boolean|string)|null,
41
+ dateTimeFormat?: string|null
41
42
  };
42
43
 
43
44
  type FilterEntry = {
@@ -4,23 +4,23 @@ import Ext from "../../tr-grid-util/es6/Ext.js";
4
4
  declare namespace ZoomPlugin {
5
5
 
6
6
  type Options = {
7
- zoomFactor?: number,
8
- step?: number,
9
- wheel?: boolean,
10
- maxFactor?: number,
11
- minFactor?: number,
12
- zoomChanged?: ((...params: any[]) => any)
7
+ zoomFactor?: number|null,
8
+ step?: number|null,
9
+ wheel?: boolean|null,
10
+ maxFactor?: number|null,
11
+ minFactor?: number|null,
12
+ zoomChanged?: ((...params: any[]) => any)|null
13
13
  };
14
14
 
15
15
  }
16
16
 
17
17
  declare class ZoomPlugin extends GridPlugin {
18
18
 
19
- constructor(options?: ZoomPlugin.Options);
19
+ constructor(options?: ZoomPlugin.Options|null);
20
20
 
21
21
  public hasMultiTableSupport(): boolean;
22
22
 
23
- public config(options?: ZoomPlugin.Options): void;
23
+ public config(options?: ZoomPlugin.Options|null): void;
24
24
 
25
25
  public getConfigObject(gridOptions?: any): any;
26
26
 
@@ -30,21 +30,21 @@ declare class ZoomPlugin extends GridPlugin {
30
30
 
31
31
  public zoomOut(): number;
32
32
 
33
- public zoomTo(factor?: number): number;
33
+ public zoomTo(factor?: number|null): number;
34
34
 
35
35
  public setStep(step: number): void;
36
36
 
37
- public zoomDefault(zoomFactor?: number): number;
37
+ public zoomDefault(zoomFactor?: number|null): number;
38
38
 
39
- public addElement(elem: Element): void;
39
+ public addElement(elem: Element|null): void;
40
40
 
41
- public removeElement(elem: Element): Element;
41
+ public removeElement(elem: Element|null): Element|null;
42
42
 
43
43
  public updateZoomedLayout(): void;
44
44
 
45
- public enableWheelToZoom(bool?: boolean): void;
45
+ public enableWheelToZoom(bool?: boolean|null): void;
46
46
 
47
- public getDefaultMouseWheelLogic(): ((...params: any[]) => any);
47
+ public getDefaultMouseWheelLogic(): ((...params: any[]) => any)|null;
48
48
 
49
49
  }
50
50
 
package/lib/versions.json CHANGED
@@ -2,9 +2,9 @@
2
2
  "tr-grid-util": "1.3.168",
3
3
  "tr-grid-printer": "1.0.18",
4
4
  "@grid/column-dragging": "1.0.21",
5
- "@grid/row-segmenting": "1.0.35",
5
+ "@grid/row-segmenting": "2.0.0",
6
6
  "@grid/statistics-row": "1.0.17",
7
- "@grid/zoom": "1.0.11",
7
+ "@grid/zoom": "1.0.13",
8
8
  "tr-grid-auto-tooltip": "1.1.9",
9
9
  "tr-grid-cell-selection": "1.0.39",
10
10
  "tr-grid-checkbox": "1.0.70",
@@ -24,14 +24,14 @@
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.38",
27
- "tr-grid-row-filtering": "1.0.87",
27
+ "tr-grid-row-filtering": "1.0.88",
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",
31
31
  "tr-grid-textformatting": "1.0.49",
32
32
  "tr-grid-titlewrap": "1.0.22",
33
33
  "@grid/formatters": "1.0.55",
34
- "@grid/column-selection-dialog": "4.0.57",
34
+ "@grid/column-selection-dialog": "4.0.59",
35
35
  "@grid/filter-dialog": "4.0.79",
36
36
  "@grid/column-format-dialog": "4.0.45"
37
37
  }
@@ -4,23 +4,23 @@ import Ext from "../../tr-grid-util/es6/Ext.js";
4
4
  declare namespace ZoomPlugin {
5
5
 
6
6
  type Options = {
7
- zoomFactor?: number,
8
- step?: number,
9
- wheel?: boolean,
10
- maxFactor?: number,
11
- minFactor?: number,
12
- zoomChanged?: ((...params: any[]) => any)
7
+ zoomFactor?: number|null,
8
+ step?: number|null,
9
+ wheel?: boolean|null,
10
+ maxFactor?: number|null,
11
+ minFactor?: number|null,
12
+ zoomChanged?: ((...params: any[]) => any)|null
13
13
  };
14
14
 
15
15
  }
16
16
 
17
17
  declare class ZoomPlugin extends GridPlugin {
18
18
 
19
- constructor(options?: ZoomPlugin.Options);
19
+ constructor(options?: ZoomPlugin.Options|null);
20
20
 
21
21
  public hasMultiTableSupport(): boolean;
22
22
 
23
- public config(options?: ZoomPlugin.Options): void;
23
+ public config(options?: ZoomPlugin.Options|null): void;
24
24
 
25
25
  public getConfigObject(gridOptions?: any): any;
26
26
 
@@ -30,21 +30,21 @@ declare class ZoomPlugin extends GridPlugin {
30
30
 
31
31
  public zoomOut(): number;
32
32
 
33
- public zoomTo(factor?: number): number;
33
+ public zoomTo(factor?: number|null): number;
34
34
 
35
35
  public setStep(step: number): void;
36
36
 
37
- public zoomDefault(zoomFactor?: number): number;
37
+ public zoomDefault(zoomFactor?: number|null): number;
38
38
 
39
- public addElement(elem: Element): void;
39
+ public addElement(elem: Element|null): void;
40
40
 
41
- public removeElement(elem: Element): Element;
41
+ public removeElement(elem: Element|null): Element|null;
42
42
 
43
43
  public updateZoomedLayout(): void;
44
44
 
45
- public enableWheelToZoom(bool?: boolean): void;
45
+ public enableWheelToZoom(bool?: boolean|null): void;
46
46
 
47
- public getDefaultMouseWheelLogic(): ((...params: any[]) => any);
47
+ public getDefaultMouseWheelLogic(): ((...params: any[]) => any)|null;
48
48
 
49
49
  }
50
50
 
@@ -24,8 +24,8 @@ import Ext from "../../tr-grid-util/es6/Ext.js";
24
24
  * @param {ZoomPlugin.Options=} options
25
25
  * @extends {GridPlugin}
26
26
  */
27
- var ZoomPlugin = function (options) {
28
- var t = this;
27
+ let ZoomPlugin = function (options) {
28
+ let t = this;
29
29
 
30
30
  t._updateZoomedLayout = t._updateZoomedLayout.bind(t);
31
31
  t._updateElementLayout = t._updateElementLayout.bind(t);
@@ -81,7 +81,7 @@ ZoomPlugin.prototype.getName = function () {
81
81
 
82
82
  /** @override */
83
83
  ZoomPlugin.prototype.initialize = function (host, options) {
84
- var t = this;
84
+ let t = this;
85
85
  if (t._hosts.indexOf(host) >= 0) {
86
86
  return;
87
87
  }
@@ -104,8 +104,8 @@ ZoomPlugin.prototype.initialize = function (host, options) {
104
104
 
105
105
  /** @override */
106
106
  ZoomPlugin.prototype.unload = function (host) {
107
- var t = this;
108
- var at = t._hosts.indexOf(host);
107
+ let t = this;
108
+ let at = t._hosts.indexOf(host);
109
109
  if (at < 0) { return; }
110
110
 
111
111
  if(t._hosts.length === 1) {
@@ -123,14 +123,14 @@ ZoomPlugin.prototype.unload = function (host) {
123
123
  ZoomPlugin.prototype.config = function (options) {
124
124
  if (!options) { return; }
125
125
 
126
- var extOptions = options["zoom"];
126
+ let extOptions = options["zoom"];
127
127
 
128
128
  if (!extOptions) {
129
129
  return;
130
130
  }
131
- var t = this;
131
+ let t = this;
132
132
 
133
- var val = extOptions["wheel"];
133
+ let val = extOptions["wheel"];
134
134
  if (val != null) {
135
135
  t._wheel = !!val;
136
136
  }
@@ -163,14 +163,16 @@ ZoomPlugin.prototype.config = function (options) {
163
163
  * @return {!Object}
164
164
  */
165
165
  ZoomPlugin.prototype.getConfigObject = function (gridOptions) {
166
- var obj = gridOptions || {};
166
+ let obj = gridOptions || {};
167
167
 
168
- var extOptions = obj.zoom;
168
+ let extOptions = obj.zoom;
169
169
  if(!extOptions) {
170
170
  extOptions = obj.zoom = {};
171
171
  }
172
172
 
173
- extOptions.wheel = this._wheel;
173
+ if(!this._wheel) {
174
+ extOptions.wheel = false;
175
+ }
174
176
 
175
177
  if (this._step !== 0.25) {
176
178
  extOptions.step = this._step;
@@ -201,7 +203,7 @@ ZoomPlugin.prototype.getZoomFactor = function () {
201
203
  * @return {number} zoomFactor
202
204
  */
203
205
  ZoomPlugin.prototype.zoomIn = function () {
204
- var t = this;
206
+ let t = this;
205
207
  t.zoomTo(t._zoomFactor + t._step);
206
208
  return t._zoomFactor;
207
209
  };
@@ -210,7 +212,7 @@ ZoomPlugin.prototype.zoomIn = function () {
210
212
  * @return {number} zoomFactor
211
213
  */
212
214
  ZoomPlugin.prototype.zoomOut = function () {
213
- var t = this;
215
+ let t = this;
214
216
  t.zoomTo(t._zoomFactor - t._step);
215
217
  return t._zoomFactor;
216
218
  };
@@ -220,7 +222,7 @@ ZoomPlugin.prototype.zoomOut = function () {
220
222
  * @return {number} factor
221
223
  */
222
224
  ZoomPlugin.prototype.zoomTo = function (factor) {
223
- var t = this;
225
+ let t = this;
224
226
 
225
227
  if (!factor) { // 0, NaN, undefined, empty string, and null
226
228
  factor = 1;
@@ -239,11 +241,11 @@ ZoomPlugin.prototype.zoomTo = function (factor) {
239
241
  return factor;
240
242
  }
241
243
 
242
- var prevZoomFactor = t._zoomFactor;
244
+ let prevZoomFactor = t._zoomFactor;
243
245
  t._zoomFactor = factor;
244
246
 
245
247
  // TODO: Refactor the logic, so that the zoom styles are applied directly to the parent element, eliminating margin-right styling
246
- var i;
248
+ let i;
247
249
  for (i = t._elems.length; --i >= 0;) {
248
250
  t._applyZoom(t._elems[i]);
249
251
  }
@@ -264,7 +266,7 @@ ZoomPlugin.prototype.zoomTo = function (factor) {
264
266
  * @param {number} step
265
267
  */
266
268
  ZoomPlugin.prototype.setStep = function (step) {
267
- var s = step;
269
+ let s = step;
268
270
  if (s != null) {
269
271
  if (typeof s !== "number") {
270
272
  s = parseFloat(s);
@@ -285,7 +287,7 @@ ZoomPlugin.prototype.zoomDefault = ZoomPlugin.prototype.zoomTo;
285
287
  * @param {Element} elem
286
288
  */
287
289
  ZoomPlugin.prototype.addElement = function (elem) {
288
- var t = this;
290
+ let t = this;
289
291
  if (elem && t._elems.indexOf(elem) < 0) {
290
292
  t._applyZoom(elem);
291
293
  t._elems.push(elem);
@@ -298,8 +300,8 @@ ZoomPlugin.prototype.addElement = function (elem) {
298
300
  * @returns {Element}
299
301
  */
300
302
  ZoomPlugin.prototype.removeElement = function (elem) {
301
- var t = this;
302
- var at = t._elems.indexOf(elem);
303
+ let t = this;
304
+ let at = t._elems.indexOf(elem);
303
305
  if (at >= 0) {
304
306
  t._elems.splice(at, 1);
305
307
  t._clearZoomStyles(elem);
@@ -317,11 +319,11 @@ ZoomPlugin.prototype.updateZoomedLayout = function() {
317
319
  * @param {Element|tr.Grid} obj
318
320
  */
319
321
  ZoomPlugin.prototype._applyZoom = function (obj) {
320
- if (!obj) { return; }
321
-
322
- var t = this;
323
-
324
- var elem = (obj instanceof Object) ? /** @type{Element} */(obj.getElement()) : /** @type{Element} */(obj);
322
+ let t = this;
323
+ let elem = (obj && obj.getElement) ? obj.getElement() : obj;
324
+ if(!elem) {
325
+ return;
326
+ }
325
327
 
326
328
  // This type of css scale is most compatable options
327
329
  // alternative css can be more promising but not the most copatable (like: zoom)
@@ -343,7 +345,7 @@ ZoomPlugin.prototype._applyZoom = function (obj) {
343
345
  * @param {Element} elem
344
346
  */
345
347
  ZoomPlugin.prototype._updateElementLayout = function (elem) {
346
- var domStyle = /** @type{CSSStyleDeclaration} */(elem.style);
348
+ let domStyle = /** @type{CSSStyleDeclaration} */(elem.style);
347
349
  if(this._zoomFactor !== 1) {
348
350
  // After scaling there is empty space between elem and it's parent
349
351
  // So it needs to correct the transformation shift of an inline-element
@@ -356,7 +358,7 @@ ZoomPlugin.prototype._updateElementLayout = function (elem) {
356
358
  /** @private
357
359
  */
358
360
  ZoomPlugin.prototype._updateZoomedLayout = function() {
359
- var i, elem;
361
+ let i, elem;
360
362
  for(i = this._elems.length; --i >= 0;) {
361
363
  elem = this._elems[i];
362
364
  this._updateElementLayout(elem);
@@ -371,7 +373,7 @@ ZoomPlugin.prototype._updateZoomedLayout = function() {
371
373
  * @param {Element} elem
372
374
  */
373
375
  ZoomPlugin.prototype._clearZoomStyles = function (elem) {
374
- var domStyle = /** @type{CSSStyleDeclaration} */(elem.style);
376
+ let domStyle = /** @type{CSSStyleDeclaration} */(elem.style);
375
377
  domStyle["transform"] = "";
376
378
  domStyle["transformOrigin"] = "";
377
379
  domStyle["marginRight"] = "";
@@ -382,11 +384,11 @@ ZoomPlugin.prototype._clearZoomStyles = function (elem) {
382
384
  * @param {boolean=} bool
383
385
  */
384
386
  ZoomPlugin.prototype.enableWheelToZoom = function (bool) {
385
- var t = this;
387
+ let t = this;
386
388
  bool = !!bool; // Force boolean
387
389
  if (t._wheel !== bool) {
388
390
  t._wheel = bool;
389
- for (var i = t._hosts.length; --i >= 0;) {
391
+ for (let i = t._hosts.length; --i >= 0;) {
390
392
  if (bool) {
391
393
  t._hosts[i].listen("wheel", t._onWheel);
392
394
  } else {
@@ -402,7 +404,7 @@ ZoomPlugin.prototype.enableWheelToZoom = function (bool) {
402
404
  ZoomPlugin.prototype._onWheel = function (e) {
403
405
  if (!e.ctrlKey || e.shiftKey || e.altKey) { return; } // Only handle Ctrl+wheel
404
406
 
405
- var delta = e["deltaY"]; // Provided by WheelEvent >> https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent
407
+ let delta = e["deltaY"]; // Provided by WheelEvent >> https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent
406
408
  if (!delta) { return; }
407
409
 
408
410
  e.preventDefault(); // Disable browser default zoom behaviour
@@ -420,6 +422,16 @@ ZoomPlugin.prototype.getDefaultMouseWheelLogic = function () {
420
422
  return this._onWheel;
421
423
  };
422
424
 
425
+ /** @public
426
+ * @ignore
427
+ * @return {!Object}
428
+ */
429
+ ZoomPlugin.prototype._getEventHandlers = function() {
430
+ return {
431
+ "wheel": this._onWheel
432
+ };
433
+ };
434
+
423
435
 
424
436
 
425
437
  export default ZoomPlugin;
package/package.json CHANGED
@@ -69,5 +69,5 @@
69
69
  "publishConfig": {
70
70
  "access": "public"
71
71
  },
72
- "version": "6.0.137"
72
+ "version": "6.0.139"
73
73
  }