@refinitiv-ui/efx-grid 6.0.108 → 6.0.110
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/core/dist/core.js +63 -27
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/grid/Core.d.ts +4 -0
- package/lib/core/es6/grid/Core.js +63 -27
- package/lib/grid/index.js +1 -1
- package/lib/grid/lib/efx-grid.js +32 -10
- package/lib/rt-grid/dist/rt-grid.js +359 -149
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/ColumnDefinition.d.ts +6 -1
- package/lib/rt-grid/es6/ColumnDefinition.js +19 -0
- package/lib/rt-grid/es6/Grid.d.ts +4 -0
- package/lib/rt-grid/es6/Grid.js +147 -90
- package/lib/tr-grid-filter-input/es6/FilterInput.d.ts +2 -0
- package/lib/tr-grid-filter-input/es6/FilterInput.js +19 -0
- package/lib/tr-grid-row-filtering/es6/RowFiltering.d.ts +4 -0
- package/lib/tr-grid-row-filtering/es6/RowFiltering.js +36 -1
- package/lib/tr-grid-util/es6/CellPainter.d.ts +1 -1
- package/lib/tr-grid-util/es6/CellPainter.js +15 -65
- package/lib/tr-grid-util/es6/Color.d.ts +40 -0
- package/lib/tr-grid-util/es6/Color.js +210 -0
- package/lib/tr-grid-util/es6/Util.d.ts +1 -3
- package/lib/tr-grid-util/es6/Util.js +2 -37
- package/lib/types/es6/Core/grid/Core.d.ts +4 -0
- package/lib/types/es6/FilterInput.d.ts +2 -0
- package/lib/types/es6/RealtimeGrid/ColumnDefinition.d.ts +6 -1
- package/lib/types/es6/RealtimeGrid/Grid.d.ts +4 -0
- package/lib/types/es6/RowFiltering.d.ts +4 -0
- package/lib/versions.json +3 -3
- package/package.json +1 -1
@@ -0,0 +1,40 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
declare namespace Color {
|
4
|
+
|
5
|
+
}
|
6
|
+
|
7
|
+
declare function rgb2Hex(rgbCode: string): string;
|
8
|
+
|
9
|
+
declare function num2Hex(triplet: (number)[]|null): string;
|
10
|
+
|
11
|
+
declare function num2Rgb(triplet: (number)[]|null): string;
|
12
|
+
|
13
|
+
declare function hex2Num(hex: string): (number)[]|null;
|
14
|
+
|
15
|
+
declare function hex2Rgb(hex: string): string;
|
16
|
+
|
17
|
+
declare function getColorLuminance(color: number): number;
|
18
|
+
|
19
|
+
declare function getRelativeLuminance(triplet: (number)[]|null): number;
|
20
|
+
|
21
|
+
declare function getContrastRatio(lumin1: number, lumin2: number): number;
|
22
|
+
|
23
|
+
declare function getContrastColor(triplet: (number)[]|null): string;
|
24
|
+
|
25
|
+
declare function blendColor(baseColor: string, maxColor: string, ratio: number): (number)[]|null;
|
26
|
+
|
27
|
+
export default Color;
|
28
|
+
export {
|
29
|
+
Color,
|
30
|
+
rgb2Hex,
|
31
|
+
num2Hex,
|
32
|
+
num2Rgb,
|
33
|
+
hex2Num,
|
34
|
+
hex2Rgb,
|
35
|
+
getColorLuminance,
|
36
|
+
getRelativeLuminance,
|
37
|
+
getContrastRatio,
|
38
|
+
getContrastColor,
|
39
|
+
blendColor
|
40
|
+
};
|
@@ -0,0 +1,210 @@
|
|
1
|
+
/** @namespace */
|
2
|
+
let Color = {};
|
3
|
+
|
4
|
+
/** @private
|
5
|
+
* @constant
|
6
|
+
* @type {RegExp}
|
7
|
+
*/
|
8
|
+
const NumRegExp = /\d+/g;
|
9
|
+
|
10
|
+
/** Convert CSS rgb or rgba formats to CSS hex color string (with # prefix)
|
11
|
+
* @public
|
12
|
+
* @param {string} rgbCode RGB values without # prefix
|
13
|
+
* @return {string} RGB in hex code (with # prefix)
|
14
|
+
* @example
|
15
|
+
* rgb2Hex("rgb(255, 255, 0)"); // "#FFFF00"
|
16
|
+
* rgb2Hex("rgba(255, 255, 0, 1)"); // "#FFFF00"
|
17
|
+
* rgb2Hex("255 255.0"); // "#FFFF00"
|
18
|
+
* rgb2Hex("#FFFF00"); // "#FFFF00"
|
19
|
+
* rgb2Hex("#1a1a1a"); // "#1a1a1a"
|
20
|
+
* rgb2Hex("2552550"); // "2552550"
|
21
|
+
* rgb2Hex("invalid"); // "invalid"
|
22
|
+
* rgb2Hex(null); // ""
|
23
|
+
*/
|
24
|
+
let rgb2Hex = function (rgbCode) {
|
25
|
+
if(!rgbCode || typeof rgbCode !== "string") {
|
26
|
+
return "";
|
27
|
+
}
|
28
|
+
if(rgbCode.charAt(0) === "#") {
|
29
|
+
return rgbCode;
|
30
|
+
}
|
31
|
+
let rgb = rgbCode.match(NumRegExp);
|
32
|
+
if(!rgb || rgb.length < 3) {
|
33
|
+
return rgbCode;
|
34
|
+
}
|
35
|
+
|
36
|
+
let hex = "#";
|
37
|
+
for(let i = 0; i < 3; i++) {
|
38
|
+
let num = +rgb[i];
|
39
|
+
if(!(num >= 16)) { // Handle NaN case
|
40
|
+
hex += "0";
|
41
|
+
}
|
42
|
+
hex += (num) ? num.toString(16).toUpperCase() : "0";
|
43
|
+
}
|
44
|
+
return hex;
|
45
|
+
};
|
46
|
+
|
47
|
+
/** @public
|
48
|
+
* @function
|
49
|
+
* @param {Array.<number>} triplet
|
50
|
+
* @return {string} resultColor
|
51
|
+
*/
|
52
|
+
let num2Hex = function (triplet) {
|
53
|
+
let rgb = triplet[2] | (triplet[1] << 8) | (triplet[0] << 16);
|
54
|
+
return ("#" + (0x1000000 + rgb).toString(16).slice(1));
|
55
|
+
};
|
56
|
+
/** Note that Chrome, IE, and Firefox store color in rgb representation.
|
57
|
+
* @public
|
58
|
+
* @function
|
59
|
+
* @param {Array.<number>} triplet
|
60
|
+
* @return {string} Color string in RGB represetation (e.g. rgb(100, 44, 1))
|
61
|
+
*/
|
62
|
+
let num2Rgb = function (triplet) {
|
63
|
+
return "rgb(" + triplet[0] + ", " + triplet[1] + ", " + triplet[2] + ")";
|
64
|
+
};
|
65
|
+
/** @public
|
66
|
+
* @function
|
67
|
+
* @param {string} hex
|
68
|
+
* @return {Array.<number>} Array of size 3 which contains [red, green, blue]
|
69
|
+
*/
|
70
|
+
let hex2Num = function (hex) {
|
71
|
+
let hexInt = parseInt(hex.replace(/[^0-9A-F]/gi, ""), 16);
|
72
|
+
let r = (hexInt >> 16) & 255;
|
73
|
+
let g = (hexInt >> 8) & 255;
|
74
|
+
let b = hexInt & 255;
|
75
|
+
return [r, g, b];
|
76
|
+
};
|
77
|
+
/** @public
|
78
|
+
* @function
|
79
|
+
* @param {string} hex Color string with leading # character (e.g. #FFAA00)
|
80
|
+
* @return {string} Color string in RGB represetation (e.g. rgb(100, 44, 1))
|
81
|
+
*/
|
82
|
+
let hex2Rgb = function (hex) {
|
83
|
+
if(hex) {
|
84
|
+
let hexInt = parseInt(hex.replace(/[^0-9A-F]/gi, ""), 16);
|
85
|
+
let r = (hexInt >> 16) & 255;
|
86
|
+
let g = (hexInt >> 8) & 255;
|
87
|
+
let b = hexInt & 255;
|
88
|
+
return "rgb(" + r + ", " + g + ", " + b + ")";
|
89
|
+
}
|
90
|
+
return "";
|
91
|
+
};
|
92
|
+
|
93
|
+
/** @public
|
94
|
+
* @function
|
95
|
+
* @param {number} color A color component (e.g., R, G, or B) with value between 0 and 255 (inclusive)
|
96
|
+
* @return {number} Normalized luminance value between 0 and 1
|
97
|
+
*/
|
98
|
+
let getColorLuminance = function (color) {
|
99
|
+
if(!color || color < 0) {
|
100
|
+
return 0;
|
101
|
+
}
|
102
|
+
if(color >= 255) {
|
103
|
+
return 1;
|
104
|
+
}
|
105
|
+
let normalizedColor = color / 255;
|
106
|
+
if(normalizedColor <= 0.03928) {
|
107
|
+
return normalizedColor / 12.92;
|
108
|
+
}
|
109
|
+
return Math.pow((normalizedColor + 0.055) / 1.055, 2.4);
|
110
|
+
};
|
111
|
+
/** The relative brightness of any point in a colorspace, normalized to 0 for darkest black and 1 for lightest white (https://www.w3.org/TR/WCAG20/#relativeluminancedef)
|
112
|
+
* @public
|
113
|
+
* @function
|
114
|
+
* @param {Array.<number>} triplet
|
115
|
+
* @return {number} Normalized value between 0 and 1
|
116
|
+
*/
|
117
|
+
let getRelativeLuminance = function (triplet) {
|
118
|
+
let R = getColorLuminance(triplet[0]);
|
119
|
+
let G = getColorLuminance(triplet[1]);
|
120
|
+
let B = getColorLuminance(triplet[2]);
|
121
|
+
|
122
|
+
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
|
123
|
+
};
|
124
|
+
/** @public
|
125
|
+
* @function
|
126
|
+
* @param {number} lumin1
|
127
|
+
* @param {number} lumin2
|
128
|
+
* @return {number} Contrast ratios can range from 1 to 21 (commonly written 1:1 to 21:1).
|
129
|
+
*/
|
130
|
+
let getContrastRatio = function (lumin1, lumin2) {
|
131
|
+
if(lumin1 === lumin2) {
|
132
|
+
return 1;
|
133
|
+
}
|
134
|
+
let darker = lumin1;
|
135
|
+
let lighter = lumin2;
|
136
|
+
|
137
|
+
if(lumin1 > lumin2) {
|
138
|
+
lighter = lumin1;
|
139
|
+
darker = lumin2;
|
140
|
+
}
|
141
|
+
return (lighter + 0.05) / (darker + 0.05);
|
142
|
+
};
|
143
|
+
/** @public
|
144
|
+
* @function
|
145
|
+
* @param {Array.<number>} triplet
|
146
|
+
* @return {string} white or black color in hex code
|
147
|
+
*/
|
148
|
+
let getContrastColor = function (triplet) {
|
149
|
+
let luminance = getRelativeLuminance(triplet);
|
150
|
+
let contrastW = getContrastRatio(1, luminance);
|
151
|
+
let contrastB = getContrastRatio(0, luminance);
|
152
|
+
|
153
|
+
if (contrastB >= contrastW) { // Brighter color has more impact to human eye than the darker color
|
154
|
+
return "#000000";
|
155
|
+
}
|
156
|
+
return "#ffffff";
|
157
|
+
};
|
158
|
+
|
159
|
+
/** Blend two colors into single color with the specified ratio
|
160
|
+
* @public
|
161
|
+
* @function
|
162
|
+
* @param {string} baseColor
|
163
|
+
* @param {string} maxColor
|
164
|
+
* @param {number} ratio [0, 1]
|
165
|
+
* @return {Array.<number>} resultColor
|
166
|
+
*/
|
167
|
+
let blendColor = function (baseColor, maxColor, ratio) { // This can be optimized further
|
168
|
+
if (ratio > 1) {
|
169
|
+
ratio = 1;
|
170
|
+
} else if(ratio < 0) {
|
171
|
+
ratio = 0;
|
172
|
+
}
|
173
|
+
|
174
|
+
let baseColorTriplet = hex2Num(baseColor);
|
175
|
+
let maxColorTriplet = hex2Num(maxColor);
|
176
|
+
let blendResult = [];
|
177
|
+
for (let i = 0; i < 3; ++i) {
|
178
|
+
let gap = (maxColorTriplet[i] - baseColorTriplet[i]) * ratio;
|
179
|
+
blendResult.push(baseColorTriplet[i] + gap);
|
180
|
+
}
|
181
|
+
|
182
|
+
return blendResult;
|
183
|
+
};
|
184
|
+
|
185
|
+
|
186
|
+
Color.rgb2Hex = rgb2Hex;
|
187
|
+
Color.num2Hex = num2Hex;
|
188
|
+
Color.num2Rgb = num2Rgb;
|
189
|
+
Color.hex2Num = hex2Num;
|
190
|
+
Color.hex2Rgb = hex2Rgb;
|
191
|
+
Color.getColorLuminance = getColorLuminance;
|
192
|
+
Color.getRelativeLuminance = getRelativeLuminance;
|
193
|
+
Color.getContrastRatio = getContrastRatio;
|
194
|
+
Color.getContrastColor = getContrastColor;
|
195
|
+
Color.blendColor = blendColor;
|
196
|
+
|
197
|
+
export default Color;
|
198
|
+
export {
|
199
|
+
Color,
|
200
|
+
rgb2Hex,
|
201
|
+
num2Hex,
|
202
|
+
num2Rgb,
|
203
|
+
hex2Num,
|
204
|
+
hex2Rgb,
|
205
|
+
getColorLuminance,
|
206
|
+
getRelativeLuminance,
|
207
|
+
getContrastRatio,
|
208
|
+
getContrastColor,
|
209
|
+
blendColor
|
210
|
+
};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
import { rgb2Hex } from "./Color.js";
|
2
2
|
|
3
3
|
declare namespace Util {
|
4
4
|
|
@@ -42,8 +42,6 @@ declare function isTouchDevice(): boolean;
|
|
42
42
|
|
43
43
|
declare function nestedObjectToArray(obj: any, ary?: any[]|null): any[]|null;
|
44
44
|
|
45
|
-
declare function rgb2Hex(rgbCode: string): string;
|
46
|
-
|
47
45
|
declare function prepareTSVContent(data: any): string;
|
48
46
|
|
49
47
|
export default Util;
|
@@ -1,3 +1,5 @@
|
|
1
|
+
import { rgb2Hex } from "./Color.js";
|
2
|
+
|
1
3
|
/** @namespace */
|
2
4
|
let Util = {};
|
3
5
|
|
@@ -453,43 +455,6 @@ let nestedObjectToArray = function (obj, ary) {
|
|
453
455
|
return ary;
|
454
456
|
};
|
455
457
|
|
456
|
-
/** Convert CSS rgb or rgba formats to CSS hex color string (# prefix)
|
457
|
-
* @public
|
458
|
-
* @param {string} rgbCode
|
459
|
-
* @return {string}
|
460
|
-
* @example
|
461
|
-
* rgb2Hex("rgb(255, 255, 0)"); // "#FFFF00"
|
462
|
-
* rgb2Hex("rgba(255, 255, 0, 1)"); // "#FFFF00"
|
463
|
-
* rgb2Hex("255 255.0"); // "#FFFF00"
|
464
|
-
* rgb2Hex("#FFFF00"); // "#FFFF00"
|
465
|
-
* rgb2Hex("#1a1a1a"); // "#1a1a1a"
|
466
|
-
* rgb2Hex("2552550"); // "2552550"
|
467
|
-
* rgb2Hex("invalid"); // "invalid"
|
468
|
-
* rgb2Hex(null); // ""
|
469
|
-
*/
|
470
|
-
let rgb2Hex = function (rgbCode) {
|
471
|
-
if(!rgbCode || typeof rgbCode !== "string") {
|
472
|
-
return "";
|
473
|
-
}
|
474
|
-
if(rgbCode.charAt(0) === "#") {
|
475
|
-
return rgbCode;
|
476
|
-
}
|
477
|
-
let rgb = rgbCode.match(/\d+/g);
|
478
|
-
if(!rgb || rgb.length < 3) {
|
479
|
-
return rgbCode;
|
480
|
-
}
|
481
|
-
|
482
|
-
let hex = "#";
|
483
|
-
for(let i = 0; i < 3; i++) {
|
484
|
-
let num = +rgb[i];
|
485
|
-
if(!(num >= 16)) { // Handle NaN case
|
486
|
-
hex += "0";
|
487
|
-
}
|
488
|
-
hex += (num) ? num.toString(16).toUpperCase() : "0";
|
489
|
-
}
|
490
|
-
return hex;
|
491
|
-
};
|
492
|
-
|
493
458
|
/** transform data to tab seperated value
|
494
459
|
* @public
|
495
460
|
* @param {*} data
|
@@ -175,6 +175,10 @@ declare class Core extends ElementWrapper {
|
|
175
175
|
|
176
176
|
public setColumnStyle(colIndex: number, style: string, value: string, opt_type?: string|null): void;
|
177
177
|
|
178
|
+
public getColumnBackgroundColor(colIndex: number): string;
|
179
|
+
|
180
|
+
public setColumnBackgroundColor(colIndex: number, color?: string|null): void;
|
181
|
+
|
178
182
|
public enableColumnClass(colIndex: number, clsName: string, enabled?: boolean|null, opt_type?: string|null): boolean;
|
179
183
|
|
180
184
|
public hasColumnClass(colIndex: number, clsName: string, opt_type?: string|null): boolean;
|
@@ -50,6 +50,8 @@ declare class FilterInputPlugin extends GridPlugin {
|
|
50
50
|
|
51
51
|
public setInputValue(colIndex: number, value: any): void;
|
52
52
|
|
53
|
+
public disableColumnInput(colIndex: number, disabled?: boolean|null): void;
|
54
|
+
|
53
55
|
public refresh(delayMs?: number|null): void;
|
54
56
|
|
55
57
|
public setFilterLogic(colIndex: number, func: ((...params: any[]) => any)|null, ctx?: any): void;
|
@@ -46,7 +46,8 @@ declare namespace ColumnDefinition {
|
|
46
46
|
leftPinned?: boolean|null,
|
47
47
|
rightPinned?: boolean|null,
|
48
48
|
info?: any,
|
49
|
-
focusable?: boolean|null
|
49
|
+
focusable?: boolean|null,
|
50
|
+
backgroundColor?: string|null
|
50
51
|
};
|
51
52
|
|
52
53
|
}
|
@@ -163,6 +164,10 @@ declare class ColumnDefinition {
|
|
163
164
|
|
164
165
|
public isFocusable(): boolean;
|
165
166
|
|
167
|
+
public getBackgroundColor(): string;
|
168
|
+
|
169
|
+
public setBackgroundColor(color: string): void;
|
170
|
+
|
166
171
|
}
|
167
172
|
|
168
173
|
declare const COL_DEF: string;
|
@@ -211,6 +211,10 @@ declare class Grid extends EventDispatcher {
|
|
211
211
|
|
212
212
|
public setColumnName(colIndex: number, str: string): void;
|
213
213
|
|
214
|
+
public getColumnBackgroundColor(colRef: Grid.ColumnReference|null): string;
|
215
|
+
|
216
|
+
public setColumnBackgroundColor(colRef: Grid.ColumnReference|null, color: string): void;
|
217
|
+
|
214
218
|
public setColumnRenderer(colRef: Grid.ColumnReference|null, func?: ((...params: any[]) => any)|null): void;
|
215
219
|
|
216
220
|
public activateColumnRenderer(colRef: Grid.ColumnReference|null, id?: string|null, func?: ((...params: any[]) => any)|null): void;
|
@@ -129,6 +129,10 @@ declare class RowFilteringPlugin extends GridPlugin {
|
|
129
129
|
|
130
130
|
public enableSeparatorFiltering(enabled?: boolean|null): void;
|
131
131
|
|
132
|
+
public showColumnFilterIcon(colIndex: number, shown?: boolean|null): void;
|
133
|
+
|
134
|
+
public hideColumnFilterIcon(colIndex: number, hidden?: boolean|null): void;
|
135
|
+
|
132
136
|
}
|
133
137
|
|
134
138
|
declare function colSettings(colIndex: number, exp: RowFilteringPlugin.Expression|null, ctx?: (any|string)|null): boolean;
|
package/lib/versions.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
{
|
2
|
-
"tr-grid-util": "1.3.
|
2
|
+
"tr-grid-util": "1.3.154",
|
3
3
|
"tr-grid-printer": "1.0.18",
|
4
4
|
"@grid/column-dragging": "1.0.20",
|
5
5
|
"@grid/row-segmenting": "1.0.31",
|
@@ -17,14 +17,14 @@
|
|
17
17
|
"tr-grid-conditional-coloring": "1.0.70",
|
18
18
|
"tr-grid-content-wrap": "1.0.20",
|
19
19
|
"tr-grid-contextmenu": "1.0.41",
|
20
|
-
"tr-grid-filter-input": "0.9.
|
20
|
+
"tr-grid-filter-input": "0.9.40",
|
21
21
|
"tr-grid-heat-map": "1.0.29",
|
22
22
|
"tr-grid-in-cell-editing": "1.0.87",
|
23
23
|
"tr-grid-pagination": "1.0.24",
|
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.78",
|
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",
|
package/package.json
CHANGED