@refinitiv-ui/efx-grid 6.0.111 → 6.0.113
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/core/dist/core.js +14 -5
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/grid/Core.js +13 -5
- package/lib/core/es6/grid/components/Cell.js +1 -0
- package/lib/filter-dialog/lib/checkbox-list.d.ts +13 -0
- package/lib/filter-dialog/lib/checkbox-list.js +74 -40
- package/lib/filter-dialog/lib/filter-dialog.d.ts +5 -0
- package/lib/filter-dialog/lib/filter-dialog.js +57 -46
- package/lib/grid/index.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +20 -10
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/Grid.js +5 -5
- package/lib/tr-grid-contextmenu/es6/ContextMenu.d.ts +1 -1
- package/lib/tr-grid-contextmenu/es6/ContextMenu.js +34 -34
- package/lib/tr-grid-contextmenu/es6/MenuEventAPI.js +7 -7
- package/lib/tr-grid-contextmenu/es6/MenuItem.js +13 -13
- package/lib/tr-grid-contextmenu/es6/PopupMenu.js +33 -33
- package/lib/tr-grid-row-filtering/es6/RowFiltering.d.ts +8 -0
- package/lib/tr-grid-row-filtering/es6/RowFiltering.js +101 -12
- package/lib/tr-grid-util/es6/CellPainter.js +6 -0
- package/lib/types/es6/ContextMenu.d.ts +1 -1
- package/lib/types/es6/RowFiltering.d.ts +8 -0
- package/lib/versions.json +4 -4
- package/package.json +2 -1
@@ -86,12 +86,21 @@ The expression can take various forms:<br>
|
|
86
86
|
* @property {Function=} rawDataAccessor In case you have custom data type for the specified field, data getter is needed to retrieve raw value for filtering
|
87
87
|
* @property {Function=} formattedDataAccessor This function will be called on each raw data, allowing formatting data to be displayed on the filter item list
|
88
88
|
* @property {Function=} sortLogic This function for sorting filter item list in the dialog. The comparison will perform on raw values, and not formatted values
|
89
|
+
* @property {Function=} groupCriteria This function for specify group of items to show group as headers.
|
90
|
+
* @property {Function=} groupSortLogic This function for sorting of group header, used with `groupCriteria` to show as group.
|
89
91
|
* @property {Array=} itemList Item list to be shown in the dialog. If this is not specified, the list will be collected from existing data on the grid
|
90
92
|
* @property {Array=} additionalItems Additional items to be put on the itemList
|
91
93
|
* @property {boolean=} compactMode=false force compact mode in dialog
|
92
94
|
* @property {(boolean|string)=} blankValues 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
|
93
95
|
*/
|
94
96
|
|
97
|
+
/** @typedef {Object} RowFilteringPlugin~FilterEntry
|
98
|
+
* @description item object to rendered element-item
|
99
|
+
* @property {string=} type=null Available types are "header" and "divider". If null, it will be shown as a normal item.
|
100
|
+
* @property {string} label="" Text of each item. If the type is "header", it will be shown as a header. If the type is "divider", it will not be shown.
|
101
|
+
* @property {boolean} checked=false Set to true to check the checkbox item in the filter dialog basic item.
|
102
|
+
*/
|
103
|
+
|
95
104
|
/** @typedef {Object} RowFilteringPlugin~Options
|
96
105
|
* @description The options can be specified by `rowFiltering` property of the main grid's options
|
97
106
|
* @property {boolean=} emptySegmentFiltering=false If enabled, the filter will automatically hide empty segment when all of its member are filtered out. If there is no active filter, any empty segment will not be hidden. Collapsed segment does not count as having a filter. A segment with no child is treated the same way as an empty segment.
|
@@ -153,13 +162,20 @@ const BlankValues = {
|
|
153
162
|
* @function
|
154
163
|
* @param {Array} ary
|
155
164
|
* @param {string} str
|
165
|
+
* @param {*=} orignalValue
|
156
166
|
* @returns {boolean} Returns true if there is any change
|
157
167
|
*/
|
158
|
-
let _pushRawValue = function(ary, str) {
|
168
|
+
let _pushRawValue = function(ary, str, orignalValue) {
|
159
169
|
if(str) {
|
160
170
|
if(!BlankValues[str]) {
|
161
171
|
let dateObj = stringToDateObject(str);
|
162
172
|
if(dateObj !== str) {
|
173
|
+
if(orignalValue && typeof orignalValue === "number") {
|
174
|
+
let originalDate = new Date(orignalValue);
|
175
|
+
if(originalDate.getTime()) {
|
176
|
+
dateObj = originalDate;
|
177
|
+
}
|
178
|
+
}
|
163
179
|
ary.push(dateObj);
|
164
180
|
} else {
|
165
181
|
try {
|
@@ -1881,7 +1897,7 @@ RowFilteringPlugin.prototype.openDialog = function(colIndex, runtimeDialogOption
|
|
1881
1897
|
} else if(typeof exp === "function" || typeof exp === "string" || typeof exp === "object") {
|
1882
1898
|
if(typeof exp === "object") {
|
1883
1899
|
for(let expKey in exp) {
|
1884
|
-
_pushRawValue(userInputs, expKey);
|
1900
|
+
_pushRawValue(userInputs, expKey, exp[expKey]);
|
1885
1901
|
}
|
1886
1902
|
}
|
1887
1903
|
}
|
@@ -1922,13 +1938,10 @@ RowFilteringPlugin.prototype.openDialog = function(colIndex, runtimeDialogOption
|
|
1922
1938
|
});
|
1923
1939
|
}
|
1924
1940
|
|
1925
|
-
let items =
|
1926
|
-
|
1927
|
-
|
1928
|
-
|
1929
|
-
nodes: [],
|
1930
|
-
checked: selectedItems[formattedVal] ? true : false
|
1931
|
-
};
|
1941
|
+
let items = this._toListScheme({
|
1942
|
+
dialogConfig: dialogConfig,
|
1943
|
+
keys: keys,
|
1944
|
+
selectedItems: selectedItems
|
1932
1945
|
});
|
1933
1946
|
|
1934
1947
|
// Adding inputs from conditions to uniqueValues for mapping back from the dialog
|
@@ -1946,7 +1959,6 @@ RowFilteringPlugin.prototype.openDialog = function(colIndex, runtimeDialogOption
|
|
1946
1959
|
}
|
1947
1960
|
}
|
1948
1961
|
}
|
1949
|
-
|
1950
1962
|
// Initialize dialog
|
1951
1963
|
if(this._filterDialog.init) { // TODO: support initiailization in v1
|
1952
1964
|
this._filterDialog.init(dialogConfig);
|
@@ -2016,6 +2028,16 @@ RowFilteringPlugin._overrideConfig = function(config, userConfig) {
|
|
2016
2028
|
config.sortLogic = sortLogic;
|
2017
2029
|
}
|
2018
2030
|
|
2031
|
+
let groupCriteria = userConfig["groupCriteria"];
|
2032
|
+
if(typeof groupCriteria === "function" || groupCriteria === null) { // Allow null value
|
2033
|
+
config.groupCriteria = groupCriteria;
|
2034
|
+
}
|
2035
|
+
|
2036
|
+
let groupSortLogic = userConfig["groupSortLogic"];
|
2037
|
+
if(typeof groupSortLogic === "function" || groupSortLogic === null) { // Allow null value
|
2038
|
+
config.groupSortLogic = groupSortLogic;
|
2039
|
+
}
|
2040
|
+
|
2019
2041
|
let itemList = userConfig["itemList"];
|
2020
2042
|
if(itemList != null) {
|
2021
2043
|
config.itemList = itemList;
|
@@ -2034,6 +2056,72 @@ RowFilteringPlugin._overrideConfig = function(config, userConfig) {
|
|
2034
2056
|
}
|
2035
2057
|
}
|
2036
2058
|
};
|
2059
|
+
|
2060
|
+
/** @private
|
2061
|
+
* @param {Object} listObj
|
2062
|
+
* @return {Array<Object>}
|
2063
|
+
*/
|
2064
|
+
RowFilteringPlugin.prototype._toListScheme = function(listObj) {
|
2065
|
+
let dialogConfig = listObj.dialogConfig;
|
2066
|
+
let keys = listObj.keys;
|
2067
|
+
let selectedItems = listObj.selectedItems;
|
2068
|
+
|
2069
|
+
let groupCriteria = dialogConfig.groupCriteria;
|
2070
|
+
let items = keys;
|
2071
|
+
let groupMap = {};
|
2072
|
+
if(groupCriteria) {
|
2073
|
+
for (let idx = 0; idx < items.length; idx++) {
|
2074
|
+
let formattedVal = items[idx];
|
2075
|
+
let item = {
|
2076
|
+
id: idx,
|
2077
|
+
label: formattedVal,
|
2078
|
+
title: formattedVal, // Backward compatibility
|
2079
|
+
nodes: [],
|
2080
|
+
checked: selectedItems[formattedVal] ? true : false,
|
2081
|
+
group: groupCriteria(formattedVal) || null // no group will be null map
|
2082
|
+
};
|
2083
|
+
if(!groupMap[item.group]) {
|
2084
|
+
groupMap[item.group] = [];
|
2085
|
+
}
|
2086
|
+
groupMap[item.group].push(item);
|
2087
|
+
}
|
2088
|
+
let groupOrdered = Object.keys(groupMap);
|
2089
|
+
let groupSortLogic = dialogConfig.groupSortLogic;
|
2090
|
+
if(groupSortLogic) {
|
2091
|
+
groupOrdered = groupOrdered.sort(groupSortLogic);
|
2092
|
+
}
|
2093
|
+
let sortedGroupItems = [];
|
2094
|
+
for (let i = 0; i < groupOrdered.length; i++) {
|
2095
|
+
let groupName = groupOrdered[i];
|
2096
|
+
let groupAry = groupMap[groupName];
|
2097
|
+
let validGroup = groupName != "null" ? true : false;
|
2098
|
+
if(validGroup) {
|
2099
|
+
sortedGroupItems.push({
|
2100
|
+
type: "header",
|
2101
|
+
label: groupName
|
2102
|
+
});
|
2103
|
+
}
|
2104
|
+
sortedGroupItems = sortedGroupItems.concat(groupAry);
|
2105
|
+
if(validGroup) {
|
2106
|
+
sortedGroupItems.push({
|
2107
|
+
type: "divider"
|
2108
|
+
});
|
2109
|
+
}
|
2110
|
+
}
|
2111
|
+
items = sortedGroupItems;
|
2112
|
+
} else {
|
2113
|
+
items = keys.map(function(formattedVal, idx) {
|
2114
|
+
return {
|
2115
|
+
id: idx,
|
2116
|
+
label: formattedVal,
|
2117
|
+
title: formattedVal, // Backward compatibility
|
2118
|
+
nodes: [],
|
2119
|
+
checked: selectedItems[formattedVal] ? true : false
|
2120
|
+
};
|
2121
|
+
});
|
2122
|
+
}
|
2123
|
+
return items;
|
2124
|
+
};
|
2037
2125
|
/** @private
|
2038
2126
|
* @param {number} colIndex
|
2039
2127
|
* @return {Function}
|
@@ -2144,7 +2232,7 @@ RowFilteringPlugin.prototype._onDialogFilterChanged = function(e) {
|
|
2144
2232
|
let selectedItems = {};
|
2145
2233
|
let atLeastOne = false;
|
2146
2234
|
for(let i = 0; i < selCount; ++i) {
|
2147
|
-
let formattedVal = selAry[i].title; // title is defined by the multi-select element
|
2235
|
+
let formattedVal = selAry[i].label || selAry[i].title; // title is defined by the multi-select element
|
2148
2236
|
// let selIdx = selAry[i].index; // index cannot be used due to filtering
|
2149
2237
|
if(selAry[i].value === BLANKS) {
|
2150
2238
|
if(!ctx) {
|
@@ -2163,7 +2251,8 @@ RowFilteringPlugin.prototype._onDialogFilterChanged = function(e) {
|
|
2163
2251
|
|
2164
2252
|
let jLen = rawVals.length;
|
2165
2253
|
for(let j = 0; j < jLen; ++j) {
|
2166
|
-
|
2254
|
+
let rawVal = rawVals[j];
|
2255
|
+
itemMap[rawVal] = (rawVal instanceof Date) ? rawVal.getTime() : rawVal;
|
2167
2256
|
}
|
2168
2257
|
}
|
2169
2258
|
if(atLeastOne) {
|
@@ -758,6 +758,12 @@ CellPainter.prototype._getStyles = function(rowData, min, max) {
|
|
758
758
|
* @return {Array.<number>} resultColor
|
759
759
|
*/
|
760
760
|
CellPainter.blendColor = blendColor; // For backward compatability
|
761
|
+
/** @private
|
762
|
+
* @function
|
763
|
+
* @param {Array.<number>} triplet
|
764
|
+
* @return {string} resultColor
|
765
|
+
*/
|
766
|
+
CellPainter.blackAndWhite = getContrastColor; // For backward compatability
|
761
767
|
/** @public
|
762
768
|
* @function
|
763
769
|
* @param {string} rgbCode
|
@@ -3,7 +3,7 @@ import Ext from "../../tr-grid-util/es6/Ext.js";
|
|
3
3
|
import MenuEventAPI from "./MenuEventAPI.js";
|
4
4
|
import PopupMenu from "./PopupMenu.js";
|
5
5
|
import { prettifyCss } from "../../tr-grid-util/es6/Util.js";
|
6
|
-
import
|
6
|
+
import { rgb2Hex, num2Hex, hex2Num, blendColor, getContrastColor } from "../../tr-grid-util/es6/Color.js";
|
7
7
|
|
8
8
|
declare namespace ContextMenuPlugin {
|
9
9
|
|
@@ -32,12 +32,20 @@ declare namespace RowFilteringPlugin {
|
|
32
32
|
rawDataAccessor?: ((...params: any[]) => any)|null,
|
33
33
|
formattedDataAccessor?: ((...params: any[]) => any)|null,
|
34
34
|
sortLogic?: ((...params: any[]) => any)|null,
|
35
|
+
groupCriteria?: ((...params: any[]) => any)|null,
|
36
|
+
groupSortLogic?: ((...params: any[]) => any)|null,
|
35
37
|
itemList?: any[]|null,
|
36
38
|
additionalItems?: any[]|null,
|
37
39
|
compactMode?: boolean|null,
|
38
40
|
blankValues?: (boolean|string)|null
|
39
41
|
};
|
40
42
|
|
43
|
+
type FilterEntry = {
|
44
|
+
type?: string|null,
|
45
|
+
label: string,
|
46
|
+
checked: boolean
|
47
|
+
};
|
48
|
+
|
41
49
|
type Options = {
|
42
50
|
emptySegmentFiltering?: boolean|null,
|
43
51
|
separatorFiltering?: boolean|null,
|
package/lib/versions.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
{
|
2
|
-
"tr-grid-util": "1.3.
|
2
|
+
"tr-grid-util": "1.3.155",
|
3
3
|
"tr-grid-printer": "1.0.18",
|
4
4
|
"@grid/column-dragging": "1.0.20",
|
5
5
|
"@grid/row-segmenting": "1.0.31",
|
@@ -16,7 +16,7 @@
|
|
16
16
|
"tr-grid-column-stack": "1.0.75",
|
17
17
|
"tr-grid-conditional-coloring": "1.0.70",
|
18
18
|
"tr-grid-content-wrap": "1.0.20",
|
19
|
-
"tr-grid-contextmenu": "1.0.
|
19
|
+
"tr-grid-contextmenu": "1.0.42",
|
20
20
|
"tr-grid-filter-input": "0.9.41",
|
21
21
|
"tr-grid-heat-map": "1.0.29",
|
22
22
|
"tr-grid-in-cell-editing": "1.0.87",
|
@@ -24,7 +24,7 @@
|
|
24
24
|
"tr-grid-percent-bar": "1.0.24",
|
25
25
|
"tr-grid-range-bar": "2.0.8",
|
26
26
|
"tr-grid-row-dragging": "1.0.35",
|
27
|
-
"tr-grid-row-filtering": "1.0.
|
27
|
+
"tr-grid-row-filtering": "1.0.80",
|
28
28
|
"tr-grid-row-grouping": "1.0.88",
|
29
29
|
"tr-grid-row-selection": "1.0.30",
|
30
30
|
"tr-grid-rowcoloring": "1.0.25",
|
@@ -32,6 +32,6 @@
|
|
32
32
|
"tr-grid-titlewrap": "1.0.22",
|
33
33
|
"@grid/formatters": "1.0.55",
|
34
34
|
"@grid/column-selection-dialog": "4.0.57",
|
35
|
-
"@grid/filter-dialog": "4.0.
|
35
|
+
"@grid/filter-dialog": "4.0.66",
|
36
36
|
"@grid/column-format-dialog": "4.0.45"
|
37
37
|
}
|
package/package.json
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
"description": "Grid Components Library",
|
4
4
|
"author": "Refinitiv",
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
6
|
+
"type": "module",
|
6
7
|
"main": "./lib/grid/index.js",
|
7
8
|
"module": "./lib/grid/index.js",
|
8
9
|
"types": "./lib/types/index.d.ts",
|
@@ -68,5 +69,5 @@
|
|
68
69
|
"publishConfig": {
|
69
70
|
"access": "public"
|
70
71
|
},
|
71
|
-
"version": "6.0.
|
72
|
+
"version": "6.0.113"
|
72
73
|
}
|