@refinitiv-ui/efx-grid 6.0.70 → 6.0.72
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/core/dist/core.js +10 -3
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/grid/Core.js +2 -2
- package/lib/core/es6/grid/VirtualizedLayoutGrid.js +8 -1
- package/lib/filter-dialog/lib/filter-dialog.js +101 -64
- package/lib/grid/index.js +1 -1
- package/lib/tr-grid-column-stack/es6/ColumnStack.js +7 -1
- package/lib/tr-grid-filter-input/es6/FilterInput.js +25 -16
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.d.ts +3 -2
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +65 -18
- package/lib/tr-grid-row-filtering/es6/RowFiltering.d.ts +1 -3
- package/lib/tr-grid-row-filtering/es6/RowFiltering.js +78 -4
- package/lib/tr-grid-titlewrap/es6/TitleWrap.d.ts +2 -2
- package/lib/tr-grid-titlewrap/es6/TitleWrap.js +1 -1
- package/lib/tr-grid-util/es6/FilterBuilder.d.ts +3 -1
- package/lib/tr-grid-util/es6/FilterBuilder.js +26 -2
- package/lib/types/es6/InCellEditing.d.ts +3 -2
- package/lib/types/es6/RowFiltering.d.ts +1 -3
- package/lib/types/es6/TitleWrap.d.ts +2 -2
- package/lib/versions.json +8 -8
- package/package.json +1 -1
@@ -2,7 +2,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
2
2
|
|
3
3
|
import { Ext } from "../../tr-grid-util/es6/Ext.js";
|
4
4
|
import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
|
5
|
-
import { FilterBuilder } from "../../tr-grid-util/es6/FilterBuilder.js";
|
5
|
+
import { FilterBuilder, stringToDateObject } from "../../tr-grid-util/es6/FilterBuilder.js";
|
6
6
|
import { FilterOperators } from "../../tr-grid-util/es6/FilterOperators.js";
|
7
7
|
import { ElfUtil } from "../../tr-grid-util/es6/ElfUtil.js";
|
8
8
|
import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
|
@@ -24,6 +24,14 @@ import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
|
|
24
24
|
* },
|
25
25
|
*/
|
26
26
|
|
27
|
+
/** @event RowFilteringPlugin#dialogCommitted
|
28
|
+
* @description Fired after a user clicks done button from the filter dialog or changes sort order.
|
29
|
+
* @property {number} colIndex
|
30
|
+
* @property {Object=} value When filter is changed, the change will be passed through this property
|
31
|
+
* @property {number=} sortOrder When sort order is changed, the change will be passed through this property
|
32
|
+
* @property {string=} fieldDataType
|
33
|
+
*/
|
34
|
+
|
27
35
|
/** @event RowFilteringPlugin#iconCreated
|
28
36
|
* @description iconCreated event is dispatched when a new column filter icon is created.
|
29
37
|
* @property {Element} icon Filter icon element
|
@@ -435,6 +443,7 @@ RowFilteringPlugin.prototype.config = function (options) {
|
|
435
443
|
|
436
444
|
this.addListener(rowFiltering, "click");
|
437
445
|
this.addListener(rowFiltering, "beforeDialogOpened");
|
446
|
+
this.addListener(rowFiltering, "dialogCommitted");
|
438
447
|
this.addListener(rowFiltering, "iconCreated");
|
439
448
|
this.addListener(rowFiltering, "filterChanged");
|
440
449
|
this.addListener(rowFiltering, "refreshed");
|
@@ -1633,6 +1642,7 @@ RowFilteringPlugin.prototype._getDataTable = function (dv) {
|
|
1633
1642
|
return dt;
|
1634
1643
|
};
|
1635
1644
|
/** @public
|
1645
|
+
* @ignore
|
1636
1646
|
* @param {string} field A field name for getting raw value from row data
|
1637
1647
|
* @param {Function=} formatter A formatter that takes row data, retrieves data, and modified the data for display.
|
1638
1648
|
* @param {string=} fmtField A field name to be used instead of formatter for getting formatted value
|
@@ -1777,6 +1787,47 @@ RowFilteringPlugin._getFilteredValue = function (rowData, filters) {
|
|
1777
1787
|
|
1778
1788
|
return true;
|
1779
1789
|
};
|
1790
|
+
/** @private
|
1791
|
+
* @function
|
1792
|
+
* @param {Array} exp
|
1793
|
+
* @param {string} field
|
1794
|
+
* @param {Function} formatter
|
1795
|
+
* @returns {Array}
|
1796
|
+
*/
|
1797
|
+
|
1798
|
+
|
1799
|
+
RowFilteringPlugin._formatArrayExpression = function (exp, field, formatter) {
|
1800
|
+
if (Array.isArray(exp)) {
|
1801
|
+
var ary = exp.slice(); // Clone to avoid modifying original data
|
1802
|
+
|
1803
|
+
var formattedVal = ary[1];
|
1804
|
+
var val = stringToDateObject(formattedVal);
|
1805
|
+
|
1806
|
+
if (val !== formattedVal) {
|
1807
|
+
ary.rawValue = val;
|
1808
|
+
ary.formattedValue = formattedVal;
|
1809
|
+
}
|
1810
|
+
|
1811
|
+
if (field && formatter && typeof val !== "string") {
|
1812
|
+
if (val != null) {
|
1813
|
+
var dummyRow = {};
|
1814
|
+
dummyRow[field] = val;
|
1815
|
+
formattedVal = formatter(dummyRow);
|
1816
|
+
|
1817
|
+
if (formattedVal) {
|
1818
|
+
ary.rawValue = val;
|
1819
|
+
ary.formattedValue = formattedVal;
|
1820
|
+
val = formattedVal;
|
1821
|
+
}
|
1822
|
+
}
|
1823
|
+
}
|
1824
|
+
|
1825
|
+
ary[1] = val;
|
1826
|
+
return ary;
|
1827
|
+
}
|
1828
|
+
|
1829
|
+
return null;
|
1830
|
+
};
|
1780
1831
|
/** @public
|
1781
1832
|
* @param {number} colIndex
|
1782
1833
|
* @param {RowFilteringPlugin~FilterDialogOptions=} runtimeDialogOptions
|
@@ -1929,6 +1980,8 @@ RowFilteringPlugin.prototype.openDialog = function (colIndex, runtimeDialogOptio
|
|
1929
1980
|
var formattedDataAccessor = cfo._formattedDataAccessor = dialogConfig.formattedDataAccessor || null;
|
1930
1981
|
var sortLogic = dialogConfig.sortLogic || null; // Populate data for filter dialog based on existing states
|
1931
1982
|
|
1983
|
+
var formatter = this._getFormatter(colIndex);
|
1984
|
+
|
1932
1985
|
var condition2D = null;
|
1933
1986
|
var filterMode = ""; // default
|
1934
1987
|
|
@@ -1938,8 +1991,10 @@ RowFilteringPlugin.prototype.openDialog = function (colIndex, runtimeDialogOptio
|
|
1938
1991
|
if (exp) {
|
1939
1992
|
if (Array.isArray(exp)) {
|
1940
1993
|
if (exp.length) {
|
1941
|
-
condition2D = Array.isArray(exp[0]) ? exp : [exp]; // Guaranteed condition2D to be a 2D array
|
1994
|
+
condition2D = Array.isArray(exp[0]) ? exp.slice() : [exp]; // Guaranteed condition2D to be a 2D array
|
1942
1995
|
|
1996
|
+
condition2D[0] = RowFilteringPlugin._formatArrayExpression(condition2D[0], field, formatter);
|
1997
|
+
condition2D[1] = RowFilteringPlugin._formatArrayExpression(condition2D[1], field, formatter);
|
1943
1998
|
filterMode = "advanced";
|
1944
1999
|
}
|
1945
2000
|
} else if (typeof exp === "function" || typeof exp === "string" || _typeof(exp) === "object") {
|
@@ -1950,7 +2005,7 @@ RowFilteringPlugin.prototype.openDialog = function (colIndex, runtimeDialogOptio
|
|
1950
2005
|
}
|
1951
2006
|
|
1952
2007
|
var selectedItems = {};
|
1953
|
-
var uniqueValues = cfo.uniqueValues = this.getUniqueValues(field,
|
2008
|
+
var uniqueValues = cfo.uniqueValues = this.getUniqueValues(field, formatter, "", rawDataAccessor, formattedDataAccessor, filterFuncs, selectedItems);
|
1954
2009
|
var keys = Object.keys(uniqueValues);
|
1955
2010
|
|
1956
2011
|
if (sortLogic) {
|
@@ -1968,7 +2023,26 @@ RowFilteringPlugin.prototype.openDialog = function (colIndex, runtimeDialogOptio
|
|
1968
2023
|
nodes: [],
|
1969
2024
|
checked: selectedItems[formattedVal] ? true : false
|
1970
2025
|
};
|
1971
|
-
}); //
|
2026
|
+
}); // Adding inputs from conditions to uniqueValues for mapping back from the dialog
|
2027
|
+
|
2028
|
+
if (condition2D) {
|
2029
|
+
var cond = condition2D[0];
|
2030
|
+
|
2031
|
+
if (cond && cond.formattedValue) {
|
2032
|
+
if (!uniqueValues[cond.formattedValue]) {
|
2033
|
+
uniqueValues[cond.formattedValue] = [cond.rawValue];
|
2034
|
+
}
|
2035
|
+
}
|
2036
|
+
|
2037
|
+
cond = condition2D[1];
|
2038
|
+
|
2039
|
+
if (cond && cond.formattedValue) {
|
2040
|
+
if (!uniqueValues[cond.formattedValue]) {
|
2041
|
+
uniqueValues[cond.formattedValue] = [cond.rawValue];
|
2042
|
+
}
|
2043
|
+
}
|
2044
|
+
} // Initialize dialog
|
2045
|
+
|
1972
2046
|
|
1973
2047
|
if (this._filterDialog.init) {
|
1974
2048
|
// TODO: support initiailization in v1
|
@@ -15,9 +15,9 @@ declare class TitleWrapPlugin extends GridPlugin {
|
|
15
15
|
|
16
16
|
public getConfigObject(gridOptions?: any): any;
|
17
17
|
|
18
|
-
public _adjustRowHeightRefByHost(host: any, sectionRef: any, from?: number, to?: number): boolean;
|
18
|
+
public _adjustRowHeightRefByHost(host: any, sectionRef: any, from?: number|null, to?: number|null): boolean;
|
19
19
|
|
20
|
-
public adjustRowHeight(sectionRef: any, from?: number, to?: number): boolean;
|
20
|
+
public adjustRowHeight(sectionRef: any, from?: number|null, to?: number|null): boolean;
|
21
21
|
|
22
22
|
public adjustRowHeightAt(sectionRef: any, rowIndex: number): boolean;
|
23
23
|
|
@@ -155,7 +155,7 @@ TitleWrapPlugin.prototype.getConfigObject = function (gridOptions) {
|
|
155
155
|
|
156
156
|
TitleWrapPlugin.prototype._requestRecalculation = function () {
|
157
157
|
if (!this._timerId) {
|
158
|
-
this._timerId = setTimeout(this._onRecalculation,
|
158
|
+
this._timerId = setTimeout(this._onRecalculation, 50);
|
159
159
|
}
|
160
160
|
};
|
161
161
|
/** @private */
|
@@ -46,7 +46,9 @@ declare class FilterBuilder {
|
|
46
46
|
|
47
47
|
}
|
48
48
|
|
49
|
+
declare function stringToDateObject(str: any): any;
|
50
|
+
|
49
51
|
declare function buildFilterFromObjectMap(obj: any, field: string, rawDataAccessor?: ((...params: any[]) => any)|null): ((...params: any[]) => any)|null;
|
50
52
|
|
51
53
|
export default FilterBuilder;
|
52
|
-
export { FilterBuilder, buildFilterFromObjectMap };
|
54
|
+
export { FilterBuilder, buildFilterFromObjectMap, stringToDateObject };
|
@@ -44,8 +44,9 @@ var convertToNumber = function(val) {
|
|
44
44
|
}
|
45
45
|
if(val) {
|
46
46
|
// WARNING: spaces (" ") and newline ("\n") characters could be parsed as 0
|
47
|
+
// Date object will have value of Date.getTime(). True value will be converted to 1
|
47
48
|
// TODO: Check if we need to use parseFloat instead of Number
|
48
|
-
return Number(val); // Could return NaN.
|
49
|
+
return Number(val); // Could return NaN.
|
49
50
|
}
|
50
51
|
if(val === false) {
|
51
52
|
return 0;
|
@@ -53,6 +54,28 @@ var convertToNumber = function(val) {
|
|
53
54
|
return NaN; // null, NaN, undefined, empty string
|
54
55
|
};
|
55
56
|
/** @private
|
57
|
+
* @type {RegExp}
|
58
|
+
*/
|
59
|
+
var _dateStringRule = /^\w{3} \w{3}/;
|
60
|
+
/** Convert default string natively generated from a Date object to a Date object. For instance, string "Sun Sep 09 2001 08:46:40 GMT+0700 (Indochina Time)" can be converted, while string "2001-09-09" cannot be converted.
|
61
|
+
* @public
|
62
|
+
* @function
|
63
|
+
* @param {*} str
|
64
|
+
* @return {*} Return Date object for successful conversion, otherwise the same input string
|
65
|
+
*/
|
66
|
+
var stringToDateObject = function(str) {
|
67
|
+
if(typeof str === "string") {
|
68
|
+
var dateObj = new Date(str);
|
69
|
+
var t = dateObj.getTime();
|
70
|
+
if(t === t) {
|
71
|
+
if(_dateStringRule.test(str)) {
|
72
|
+
return dateObj;
|
73
|
+
}
|
74
|
+
}
|
75
|
+
}
|
76
|
+
return str; // Return the user input for unsuccessful conversion
|
77
|
+
};
|
78
|
+
/** @private
|
56
79
|
* @function
|
57
80
|
* @param {*} val
|
58
81
|
* @return {string}
|
@@ -441,6 +464,7 @@ FilterBuilder.prototype.buildFilter = function() {
|
|
441
464
|
var value = cond.origValue;
|
442
465
|
|
443
466
|
if(opType === "number") {
|
467
|
+
value = stringToDateObject(value);
|
444
468
|
value = convertToNumber(value);
|
445
469
|
} else if(opType === "date") {
|
446
470
|
var dateObj = null;
|
@@ -554,4 +578,4 @@ FilterBuilder.prototype.parse = function(condition, field, formatter, formattedF
|
|
554
578
|
};
|
555
579
|
|
556
580
|
export default FilterBuilder;
|
557
|
-
export { FilterBuilder, buildFilterFromObjectMap };
|
581
|
+
export { FilterBuilder, buildFilterFromObjectMap, stringToDateObject };
|
@@ -18,7 +18,7 @@ declare namespace InCellEditingPlugin {
|
|
18
18
|
popupElement?: Element|null,
|
19
19
|
doubleClick?: boolean|null,
|
20
20
|
tabToMove?: boolean|null,
|
21
|
-
contentSource?:
|
21
|
+
contentSource?: string|null,
|
22
22
|
inlineStyling?: boolean|null,
|
23
23
|
disablingScroll?: boolean|null,
|
24
24
|
uiBlocking?: boolean|null,
|
@@ -30,7 +30,8 @@ declare namespace InCellEditingPlugin {
|
|
30
30
|
beforeRowCommit?: ((...params: any[]) => any)|null,
|
31
31
|
rowEditorClosed?: ((...params: any[]) => any)|null,
|
32
32
|
autoSuggest?: Element|null,
|
33
|
-
closingOnScroll?: boolean|null
|
33
|
+
closingOnScroll?: boolean|null,
|
34
|
+
autoHiding?: boolean|null
|
34
35
|
};
|
35
36
|
|
36
37
|
type Cache = {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import {Ext} from "../../tr-grid-util/es6/Ext.js";
|
2
2
|
import {GridPlugin} from "../../tr-grid-util/es6/GridPlugin.js";
|
3
|
-
import {FilterBuilder} from "../../tr-grid-util/es6/FilterBuilder.js";
|
3
|
+
import {FilterBuilder, stringToDateObject} from "../../tr-grid-util/es6/FilterBuilder.js";
|
4
4
|
import {FilterOperators} from "../../tr-grid-util/es6/FilterOperators.js";
|
5
5
|
import {ElfUtil} from "../../tr-grid-util/es6/ElfUtil.js";
|
6
6
|
import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
|
@@ -113,8 +113,6 @@ declare class RowFilteringPlugin extends GridPlugin {
|
|
113
113
|
|
114
114
|
public getColumnFilterStates(): any[];
|
115
115
|
|
116
|
-
public getUniqueValues(field: string, formatter?: ((...params: any[]) => any)|null, fmtField?: string|null, rawDataAccessor?: ((...params: any[]) => any)|null, formattedDataAccessor?: ((...params: any[]) => any)|null, filterFuncs?: ((...params: any[]) => any)|null, selectedItems?: any): any;
|
117
|
-
|
118
116
|
public openDialog(colIndex: number, runtimeDialogOptions?: RowFilteringPlugin.FilterDialogOptions|null): void;
|
119
117
|
|
120
118
|
public enableEmptySegmentFiltering(enabled?: boolean|null): void;
|
@@ -15,9 +15,9 @@ declare class TitleWrapPlugin extends GridPlugin {
|
|
15
15
|
|
16
16
|
public getConfigObject(gridOptions?: any): any;
|
17
17
|
|
18
|
-
public _adjustRowHeightRefByHost(host: any, sectionRef: any, from?: number, to?: number): boolean;
|
18
|
+
public _adjustRowHeightRefByHost(host: any, sectionRef: any, from?: number|null, to?: number|null): boolean;
|
19
19
|
|
20
|
-
public adjustRowHeight(sectionRef: any, from?: number, to?: number): boolean;
|
20
|
+
public adjustRowHeight(sectionRef: any, from?: number|null, to?: number|null): boolean;
|
21
21
|
|
22
22
|
public adjustRowHeightAt(sectionRef: any, rowIndex: number): boolean;
|
23
23
|
|
package/lib/versions.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
{
|
2
|
-
"tr-grid-util": "1.3.
|
2
|
+
"tr-grid-util": "1.3.134",
|
3
3
|
"tr-grid-printer": "1.0.17",
|
4
4
|
"@grid/column-dragging": "1.0.14",
|
5
5
|
"@grid/row-segmenting": "1.0.29",
|
@@ -13,25 +13,25 @@
|
|
13
13
|
"tr-grid-column-grouping": "1.0.57",
|
14
14
|
"tr-grid-column-resizing": "1.0.28",
|
15
15
|
"tr-grid-column-selection": "1.0.31",
|
16
|
-
"tr-grid-column-stack": "1.0.
|
16
|
+
"tr-grid-column-stack": "1.0.73",
|
17
17
|
"tr-grid-conditional-coloring": "1.0.66",
|
18
18
|
"tr-grid-content-wrap": "1.0.20",
|
19
19
|
"tr-grid-contextmenu": "1.0.40",
|
20
|
-
"tr-grid-filter-input": "0.9.
|
20
|
+
"tr-grid-filter-input": "0.9.36",
|
21
21
|
"tr-grid-heat-map": "1.0.29",
|
22
|
-
"tr-grid-in-cell-editing": "1.0.
|
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
|
-
"tr-grid-row-dragging": "1.0.
|
27
|
-
"tr-grid-row-filtering": "1.0.
|
26
|
+
"tr-grid-row-dragging": "1.0.31",
|
27
|
+
"tr-grid-row-filtering": "1.0.64",
|
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
|
-
"tr-grid-titlewrap": "1.0.
|
32
|
+
"tr-grid-titlewrap": "1.0.20",
|
33
33
|
"@grid/formatters": "1.0.50",
|
34
34
|
"@grid/column-selection-dialog": "4.0.54",
|
35
|
-
"@grid/filter-dialog": "4.0.
|
35
|
+
"@grid/filter-dialog": "4.0.60",
|
36
36
|
"@grid/column-format-dialog": "4.0.44"
|
37
37
|
}
|
package/package.json
CHANGED