@refinitiv-ui/efx-grid 6.0.116 → 6.0.118
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/core/dist/core.js +214 -42
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/grid/Core.js +9 -2
- package/lib/grid/index.js +1 -1
- package/lib/grid/themes/halo/dark/efx-grid.js +1 -1
- package/lib/grid/themes/halo/dark/es5/all-elements.js +1 -1
- package/lib/grid/themes/halo/light/efx-grid.js +1 -1
- package/lib/grid/themes/halo/light/es5/all-elements.js +1 -1
- package/lib/grid/themes/solar/charcoal/efx-grid.js +1 -1
- package/lib/grid/themes/solar/charcoal/es5/all-elements.js +1 -1
- package/lib/grid/themes/solar/pearl/efx-grid.js +1 -1
- package/lib/grid/themes/solar/pearl/es5/all-elements.js +1 -1
- package/lib/row-segmenting/es6/RowSegmenting.js +74 -29
- package/lib/rt-grid/dist/rt-grid.js +324 -141
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/ColumnDefinition.js +5 -2
- package/lib/rt-grid/es6/DataConnector.d.ts +2 -0
- package/lib/rt-grid/es6/DataConnector.js +8 -0
- package/lib/rt-grid/es6/Grid.d.ts +4 -0
- package/lib/rt-grid/es6/Grid.js +39 -1
- package/lib/rt-grid/es6/ReferenceCounter.d.ts +2 -0
- package/lib/rt-grid/es6/ReferenceCounter.js +10 -0
- package/lib/rt-grid/es6/RowDefinition.js +28 -34
- package/lib/tr-grid-auto-tooltip/es6/AutoTooltip.d.ts +1 -0
- package/lib/tr-grid-auto-tooltip/es6/AutoTooltip.js +200 -26
- package/lib/tr-grid-contextmenu/es6/ContextMenu.js +11 -0
- package/lib/tr-grid-contextmenu/es6/MenuEventAPI.d.ts +1 -1
- package/lib/tr-grid-contextmenu/es6/MenuEventAPI.js +13 -8
- package/lib/tr-grid-contextmenu/es6/MenuItem.d.ts +3 -1
- package/lib/tr-grid-contextmenu/es6/MenuItem.js +75 -35
- package/lib/tr-grid-contextmenu/es6/PopupMenu.d.ts +5 -1
- package/lib/tr-grid-contextmenu/es6/PopupMenu.js +70 -59
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.d.ts +3 -0
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +115 -28
- package/lib/tr-grid-util/es6/GroupDefinitions.js +1 -1
- package/lib/types/es6/InCellEditing.d.ts +3 -0
- package/lib/types/es6/MenuEventAPI.d.ts +1 -1
- package/lib/types/es6/MenuItem.d.ts +3 -1
- package/lib/types/es6/PopupMenu.d.ts +5 -1
- package/lib/types/es6/RealtimeGrid/DataConnector.d.ts +2 -0
- package/lib/types/es6/RealtimeGrid/Grid.d.ts +4 -0
- package/lib/types/es6/RealtimeGrid/ReferenceCounter.d.ts +2 -0
- package/lib/versions.json +5 -5
- package/package.json +2 -2
@@ -2352,7 +2352,209 @@ let translation = {
|
|
2352
2352
|
|
2353
2353
|
/* harmony default export */ var locale_translation = (translation);
|
2354
2354
|
|
2355
|
+
// CONCATENATED MODULE: ./node_modules/tr-grid-util/es6/Color.js
|
2356
|
+
/** @namespace */
|
2357
|
+
let Color = {};
|
2358
|
+
|
2359
|
+
/** @private
|
2360
|
+
* @constant
|
2361
|
+
* @type {RegExp}
|
2362
|
+
*/
|
2363
|
+
const NumRegExp = /\d+/g;
|
2364
|
+
|
2365
|
+
/** Convert CSS rgb or rgba formats to CSS hex color string (with # prefix)
|
2366
|
+
* @public
|
2367
|
+
* @param {string} rgbCode RGB values without # prefix
|
2368
|
+
* @return {string} RGB in hex code (with # prefix)
|
2369
|
+
* @example
|
2370
|
+
* rgb2Hex("rgb(255, 255, 0)"); // "#FFFF00"
|
2371
|
+
* rgb2Hex("rgba(255, 255, 0, 1)"); // "#FFFF00"
|
2372
|
+
* rgb2Hex("255 255.0"); // "#FFFF00"
|
2373
|
+
* rgb2Hex("#FFFF00"); // "#FFFF00"
|
2374
|
+
* rgb2Hex("#1a1a1a"); // "#1a1a1a"
|
2375
|
+
* rgb2Hex("2552550"); // "2552550"
|
2376
|
+
* rgb2Hex("invalid"); // "invalid"
|
2377
|
+
* rgb2Hex(null); // ""
|
2378
|
+
*/
|
2379
|
+
let rgb2Hex = function (rgbCode) {
|
2380
|
+
if(!rgbCode || typeof rgbCode !== "string") {
|
2381
|
+
return "";
|
2382
|
+
}
|
2383
|
+
if(rgbCode.charAt(0) === "#") {
|
2384
|
+
return rgbCode;
|
2385
|
+
}
|
2386
|
+
let rgb = rgbCode.match(NumRegExp);
|
2387
|
+
if(!rgb || rgb.length < 3) {
|
2388
|
+
return rgbCode;
|
2389
|
+
}
|
2390
|
+
|
2391
|
+
let hex = "#";
|
2392
|
+
for(let i = 0; i < 3; i++) {
|
2393
|
+
let num = +rgb[i];
|
2394
|
+
if(!(num >= 16)) { // Handle NaN case
|
2395
|
+
hex += "0";
|
2396
|
+
}
|
2397
|
+
hex += (num) ? num.toString(16).toUpperCase() : "0";
|
2398
|
+
}
|
2399
|
+
return hex;
|
2400
|
+
};
|
2401
|
+
|
2402
|
+
/** @public
|
2403
|
+
* @function
|
2404
|
+
* @param {Array.<number>} triplet
|
2405
|
+
* @return {string} resultColor
|
2406
|
+
*/
|
2407
|
+
let num2Hex = function (triplet) {
|
2408
|
+
let rgb = triplet[2] | (triplet[1] << 8) | (triplet[0] << 16);
|
2409
|
+
return ("#" + (0x1000000 + rgb).toString(16).slice(1));
|
2410
|
+
};
|
2411
|
+
/** Note that Chrome, IE, and Firefox store color in rgb representation.
|
2412
|
+
* @public
|
2413
|
+
* @function
|
2414
|
+
* @param {Array.<number>} triplet
|
2415
|
+
* @return {string} Color string in RGB represetation (e.g. rgb(100, 44, 1))
|
2416
|
+
*/
|
2417
|
+
let num2Rgb = function (triplet) {
|
2418
|
+
return "rgb(" + triplet[0] + ", " + triplet[1] + ", " + triplet[2] + ")";
|
2419
|
+
};
|
2420
|
+
/** @public
|
2421
|
+
* @function
|
2422
|
+
* @param {string} hex
|
2423
|
+
* @return {Array.<number>} Array of size 3 which contains [red, green, blue]
|
2424
|
+
*/
|
2425
|
+
let hex2Num = function (hex) {
|
2426
|
+
let hexInt = parseInt(hex.replace(/[^0-9A-F]/gi, ""), 16);
|
2427
|
+
let r = (hexInt >> 16) & 255;
|
2428
|
+
let g = (hexInt >> 8) & 255;
|
2429
|
+
let b = hexInt & 255;
|
2430
|
+
return [r, g, b];
|
2431
|
+
};
|
2432
|
+
/** @public
|
2433
|
+
* @function
|
2434
|
+
* @param {string} hex Color string with leading # character (e.g. #FFAA00)
|
2435
|
+
* @return {string} Color string in RGB represetation (e.g. rgb(100, 44, 1))
|
2436
|
+
*/
|
2437
|
+
let hex2Rgb = function (hex) {
|
2438
|
+
if(hex) {
|
2439
|
+
let hexInt = parseInt(hex.replace(/[^0-9A-F]/gi, ""), 16);
|
2440
|
+
let r = (hexInt >> 16) & 255;
|
2441
|
+
let g = (hexInt >> 8) & 255;
|
2442
|
+
let b = hexInt & 255;
|
2443
|
+
return "rgb(" + r + ", " + g + ", " + b + ")";
|
2444
|
+
}
|
2445
|
+
return "";
|
2446
|
+
};
|
2447
|
+
|
2448
|
+
/** @public
|
2449
|
+
* @function
|
2450
|
+
* @param {number} color A color component (e.g., R, G, or B) with value between 0 and 255 (inclusive)
|
2451
|
+
* @return {number} Normalized luminance value between 0 and 1
|
2452
|
+
*/
|
2453
|
+
let getColorLuminance = function (color) {
|
2454
|
+
if(!color || color < 0) {
|
2455
|
+
return 0;
|
2456
|
+
}
|
2457
|
+
if(color >= 255) {
|
2458
|
+
return 1;
|
2459
|
+
}
|
2460
|
+
let normalizedColor = color / 255;
|
2461
|
+
if(normalizedColor <= 0.03928) {
|
2462
|
+
return normalizedColor / 12.92;
|
2463
|
+
}
|
2464
|
+
return Math.pow((normalizedColor + 0.055) / 1.055, 2.4);
|
2465
|
+
};
|
2466
|
+
/** 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)
|
2467
|
+
* @public
|
2468
|
+
* @function
|
2469
|
+
* @param {Array.<number>} triplet
|
2470
|
+
* @return {number} Normalized value between 0 and 1
|
2471
|
+
*/
|
2472
|
+
let getRelativeLuminance = function (triplet) {
|
2473
|
+
let R = getColorLuminance(triplet[0]);
|
2474
|
+
let G = getColorLuminance(triplet[1]);
|
2475
|
+
let B = getColorLuminance(triplet[2]);
|
2476
|
+
|
2477
|
+
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
|
2478
|
+
};
|
2479
|
+
/** @public
|
2480
|
+
* @function
|
2481
|
+
* @param {number} lumin1
|
2482
|
+
* @param {number} lumin2
|
2483
|
+
* @return {number} Contrast ratios can range from 1 to 21 (commonly written 1:1 to 21:1).
|
2484
|
+
*/
|
2485
|
+
let getContrastRatio = function (lumin1, lumin2) {
|
2486
|
+
if(lumin1 === lumin2) {
|
2487
|
+
return 1;
|
2488
|
+
}
|
2489
|
+
let darker = lumin1;
|
2490
|
+
let lighter = lumin2;
|
2491
|
+
|
2492
|
+
if(lumin1 > lumin2) {
|
2493
|
+
lighter = lumin1;
|
2494
|
+
darker = lumin2;
|
2495
|
+
}
|
2496
|
+
return (lighter + 0.05) / (darker + 0.05);
|
2497
|
+
};
|
2498
|
+
/** @public
|
2499
|
+
* @function
|
2500
|
+
* @param {Array.<number>} triplet
|
2501
|
+
* @return {string} white or black color in hex code
|
2502
|
+
*/
|
2503
|
+
let getContrastColor = function (triplet) {
|
2504
|
+
let luminance = getRelativeLuminance(triplet);
|
2505
|
+
let contrastW = getContrastRatio(1, luminance);
|
2506
|
+
let contrastB = getContrastRatio(0, luminance);
|
2507
|
+
|
2508
|
+
if (contrastB >= contrastW) { // Brighter color has more impact to human eye than the darker color
|
2509
|
+
return "#000000";
|
2510
|
+
}
|
2511
|
+
return "#ffffff";
|
2512
|
+
};
|
2513
|
+
|
2514
|
+
/** Blend two colors into single color with the specified ratio
|
2515
|
+
* @public
|
2516
|
+
* @function
|
2517
|
+
* @param {string} baseColor
|
2518
|
+
* @param {string} maxColor
|
2519
|
+
* @param {number} ratio [0, 1]
|
2520
|
+
* @return {Array.<number>} resultColor
|
2521
|
+
*/
|
2522
|
+
let blendColor = function (baseColor, maxColor, ratio) { // This can be optimized further
|
2523
|
+
if (ratio > 1) {
|
2524
|
+
ratio = 1;
|
2525
|
+
} else if(ratio < 0) {
|
2526
|
+
ratio = 0;
|
2527
|
+
}
|
2528
|
+
|
2529
|
+
let baseColorTriplet = hex2Num(baseColor);
|
2530
|
+
let maxColorTriplet = hex2Num(maxColor);
|
2531
|
+
let blendResult = [];
|
2532
|
+
for (let i = 0; i < 3; ++i) {
|
2533
|
+
let gap = (maxColorTriplet[i] - baseColorTriplet[i]) * ratio;
|
2534
|
+
blendResult.push(baseColorTriplet[i] + gap);
|
2535
|
+
}
|
2536
|
+
|
2537
|
+
return blendResult;
|
2538
|
+
};
|
2539
|
+
|
2540
|
+
|
2541
|
+
Color.rgb2Hex = rgb2Hex;
|
2542
|
+
Color.num2Hex = num2Hex;
|
2543
|
+
Color.num2Rgb = num2Rgb;
|
2544
|
+
Color.hex2Num = hex2Num;
|
2545
|
+
Color.hex2Rgb = hex2Rgb;
|
2546
|
+
Color.getColorLuminance = getColorLuminance;
|
2547
|
+
Color.getRelativeLuminance = getRelativeLuminance;
|
2548
|
+
Color.getContrastRatio = getContrastRatio;
|
2549
|
+
Color.getContrastColor = getContrastColor;
|
2550
|
+
Color.blendColor = blendColor;
|
2551
|
+
|
2552
|
+
/* harmony default export */ var es6_Color = (Color);
|
2553
|
+
|
2554
|
+
|
2355
2555
|
// CONCATENATED MODULE: ./node_modules/tr-grid-util/es6/Util.js
|
2556
|
+
|
2557
|
+
|
2356
2558
|
/** @namespace */
|
2357
2559
|
let Util = {};
|
2358
2560
|
|
@@ -2808,43 +3010,6 @@ let nestedObjectToArray = function (obj, ary) {
|
|
2808
3010
|
return ary;
|
2809
3011
|
};
|
2810
3012
|
|
2811
|
-
/** Convert CSS rgb or rgba formats to CSS hex color string (# prefix)
|
2812
|
-
* @public
|
2813
|
-
* @param {string} rgbCode
|
2814
|
-
* @return {string}
|
2815
|
-
* @example
|
2816
|
-
* rgb2Hex("rgb(255, 255, 0)"); // "#FFFF00"
|
2817
|
-
* rgb2Hex("rgba(255, 255, 0, 1)"); // "#FFFF00"
|
2818
|
-
* rgb2Hex("255 255.0"); // "#FFFF00"
|
2819
|
-
* rgb2Hex("#FFFF00"); // "#FFFF00"
|
2820
|
-
* rgb2Hex("#1a1a1a"); // "#1a1a1a"
|
2821
|
-
* rgb2Hex("2552550"); // "2552550"
|
2822
|
-
* rgb2Hex("invalid"); // "invalid"
|
2823
|
-
* rgb2Hex(null); // ""
|
2824
|
-
*/
|
2825
|
-
let rgb2Hex = function (rgbCode) {
|
2826
|
-
if(!rgbCode || typeof rgbCode !== "string") {
|
2827
|
-
return "";
|
2828
|
-
}
|
2829
|
-
if(rgbCode.charAt(0) === "#") {
|
2830
|
-
return rgbCode;
|
2831
|
-
}
|
2832
|
-
let rgb = rgbCode.match(/\d+/g);
|
2833
|
-
if(!rgb || rgb.length < 3) {
|
2834
|
-
return rgbCode;
|
2835
|
-
}
|
2836
|
-
|
2837
|
-
let hex = "#";
|
2838
|
-
for(let i = 0; i < 3; i++) {
|
2839
|
-
let num = +rgb[i];
|
2840
|
-
if(!(num >= 16)) { // Handle NaN case
|
2841
|
-
hex += "0";
|
2842
|
-
}
|
2843
|
-
hex += (num) ? num.toString(16).toUpperCase() : "0";
|
2844
|
-
}
|
2845
|
-
return hex;
|
2846
|
-
};
|
2847
|
-
|
2848
3013
|
/** transform data to tab seperated value
|
2849
3014
|
* @public
|
2850
3015
|
* @param {*} data
|
@@ -12771,7 +12936,7 @@ DataTable._proto = DataTable.prototype;
|
|
12771
12936
|
* @property {Array.<string>=} fields=null Field that corresponds to the given static values
|
12772
12937
|
* @property {boolean=} asChain=false The given ric will be treated as a chain
|
12773
12938
|
* @property {string=} chainRic="" RIC to be used for chain request (overiding ric property)
|
12774
|
-
* @property {boolean=} collapsed
|
12939
|
+
* @property {boolean=} collapsed Chain is collapsed by default. Segment is expanded by default.
|
12775
12940
|
* @property {(string|null)=} label=null
|
12776
12941
|
* @property {boolean=} hidden=true When this row is hidden
|
12777
12942
|
* @property {boolean=} realTime=true Realtime row, able to request for JET/RTK
|
@@ -12898,7 +13063,7 @@ RowDefinition.prototype._subId = "";
|
|
12898
13063
|
/** @type {boolean|null}
|
12899
13064
|
* @private
|
12900
13065
|
*/
|
12901
|
-
RowDefinition.prototype.
|
13066
|
+
RowDefinition.prototype._collapsed = null;
|
12902
13067
|
/** @type {boolean}
|
12903
13068
|
* @private
|
12904
13069
|
*/
|
@@ -13030,17 +13195,15 @@ RowDefinition.prototype.initialize = function(rowOptions) {
|
|
13030
13195
|
this._realTime = val;
|
13031
13196
|
}
|
13032
13197
|
|
13033
|
-
val = rowOptions["collapsed"];
|
13034
|
-
let collapsed = extractedOptions["collapsed"];
|
13035
|
-
if(val != null || !collapsed){
|
13036
|
-
this._expanded = !collapsed;
|
13037
|
-
}
|
13038
|
-
|
13039
13198
|
val = rowOptions["asSegment"];
|
13040
13199
|
if(val != null) {
|
13041
13200
|
this._asSegment = val ? true : false;
|
13042
13201
|
}
|
13043
13202
|
|
13203
|
+
if(this._isChain) {
|
13204
|
+
this._collapsed = extractedOptions["collapsed"]; // Temporary state
|
13205
|
+
}
|
13206
|
+
|
13044
13207
|
val = rowOptions["keepModel"];
|
13045
13208
|
if(val) {
|
13046
13209
|
this._userModel = rowOptions;
|
@@ -13162,12 +13325,11 @@ RowDefinition.prototype.setContent = function(userInput, extractedOptions) {
|
|
13162
13325
|
this.resetUpdates(); // Remove all previous data updates because a new content is just entered
|
13163
13326
|
|
13164
13327
|
this._userInput = userInput;
|
13328
|
+
let collapsed = extractedOptions["collapsed"];
|
13165
13329
|
if(realtimeRow) {
|
13166
|
-
let expanded = !extractedOptions["collapsed"];
|
13167
13330
|
let chainRic = extractedOptions["chainRic"];
|
13168
13331
|
if(asChain === true){
|
13169
|
-
this._ric =
|
13170
|
-
this._expanded = expanded; // Only chain can be expanded by 0#
|
13332
|
+
this._ric = collapsed === true ? userInput : userInput.replace("0#", "");
|
13171
13333
|
} else {
|
13172
13334
|
this._ric = userInput;
|
13173
13335
|
}
|
@@ -13194,15 +13356,12 @@ RowDefinition.prototype.setContent = function(userInput, extractedOptions) {
|
|
13194
13356
|
if(this._isChain) {
|
13195
13357
|
dv.setSegmentSeparator(this._rowId, true);
|
13196
13358
|
}
|
13197
|
-
|
13198
|
-
|
13199
|
-
|
13200
|
-
}
|
13201
|
-
} else {
|
13202
|
-
if (!this._expanded) {
|
13203
|
-
this.collapseChain();
|
13204
|
-
}
|
13359
|
+
|
13360
|
+
if(collapsed !== this.isChainCollapsed()) {
|
13361
|
+
dv.collapseSegment(this._rowId, collapsed);
|
13205
13362
|
}
|
13363
|
+
this._collapsed = null;
|
13364
|
+
|
13206
13365
|
_stallSorting(dv, false, stalledSorting);
|
13207
13366
|
if(segmentId) { // If data id is changed and the row is a child of a segment, then segment child data id must be updated
|
13208
13367
|
dv.addSegmentChild(segmentId, this._rowId, this._dataId);
|
@@ -13278,9 +13437,9 @@ RowDefinition.prototype.getConfigObject = function(rowOptions) {
|
|
13278
13437
|
obj["asChain"] = val;
|
13279
13438
|
}
|
13280
13439
|
|
13281
|
-
val = this.
|
13440
|
+
val = this._collapsed;
|
13282
13441
|
if(val != null) {
|
13283
|
-
obj["collapsed"] =
|
13442
|
+
obj["collapsed"] = val;
|
13284
13443
|
}
|
13285
13444
|
|
13286
13445
|
// check row hidden
|
@@ -13788,8 +13947,9 @@ RowDefinition.prototype.registerToView = function(view, rowId) {
|
|
13788
13947
|
if(isSegment) {
|
13789
13948
|
view.setSegmentSeparator(newRowId);
|
13790
13949
|
_stallSorting(view, false, stalledSorting);
|
13791
|
-
if(
|
13792
|
-
view.collapseSegment(newRowId);
|
13950
|
+
if(this._collapsed != null) {
|
13951
|
+
view.collapseSegment(newRowId, this._collapsed);
|
13952
|
+
this._collapsed = null;
|
13793
13953
|
}
|
13794
13954
|
} else if(!this._parent && parentRowId) { // Constituent cannot be added to another segment
|
13795
13955
|
view.addSegmentChild(parentRowId, newRowId, this._dataId);
|
@@ -13907,23 +14067,22 @@ RowDefinition.prototype._toRealTimeRow = function() {
|
|
13907
14067
|
if(!this._ric) { // Empty row
|
13908
14068
|
return;
|
13909
14069
|
}
|
13910
|
-
if(this.isRowHeader()) {
|
13911
|
-
return;
|
14070
|
+
if(this.isRowHeader() || !this._parent) {
|
14071
|
+
return; // If the row is already a normal row or row header, it cannot be converted
|
13912
14072
|
}
|
13913
14073
|
|
13914
|
-
this.
|
14074
|
+
this._realTime = true;
|
14075
|
+
this._dc.setRowData(this._dataId, null); // Remove existing data. WARNING: Trigger data update immediately
|
13915
14076
|
this._dataId = this._rowId + this._ric; // JET/RTK will generate data id to be rowId (given from this rowDef) + ric;
|
13916
14077
|
|
13917
14078
|
this._autoGenerated = false;
|
13918
14079
|
this._parent = null;
|
13919
14080
|
this._depthLevel = 0;
|
13920
14081
|
|
13921
|
-
|
13922
|
-
if(this._staticValues) {
|
14082
|
+
this.subscribeForUpdates();
|
14083
|
+
if(this._staticValues) { // Add static value to the new allocated row
|
13923
14084
|
this.setRowData(this._staticValues);
|
13924
14085
|
}
|
13925
|
-
|
13926
|
-
this.subscribeForUpdates();
|
13927
14086
|
};
|
13928
14087
|
|
13929
14088
|
/** @public
|
@@ -13957,7 +14116,7 @@ RowDefinition.prototype.unlinkChain = function() {
|
|
13957
14116
|
view.setSegmentSeparator(rid, false);
|
13958
14117
|
}
|
13959
14118
|
|
13960
|
-
this._isChain =
|
14119
|
+
this._isChain = false;
|
13961
14120
|
this._chainRic = "";
|
13962
14121
|
this._userInput = this._ric;
|
13963
14122
|
this._children = null;
|
@@ -13970,7 +14129,6 @@ RowDefinition.prototype.unlinkChain = function() {
|
|
13970
14129
|
*/
|
13971
14130
|
RowDefinition.prototype.collapseChain = function() {
|
13972
14131
|
if(this._isChain && this._view) {
|
13973
|
-
this._expanded = false;
|
13974
14132
|
return this._view.collapseSegment(this._rowId, true);
|
13975
14133
|
}
|
13976
14134
|
return false;
|
@@ -13986,7 +14144,6 @@ RowDefinition.prototype.collapseChain = function() {
|
|
13986
14144
|
*/
|
13987
14145
|
RowDefinition.prototype.expandChain = function() {
|
13988
14146
|
if(this._isChain && this._view) {
|
13989
|
-
this._expanded = true;
|
13990
14147
|
return this._view.collapseSegment(this._rowId, false);
|
13991
14148
|
}
|
13992
14149
|
return false;
|
@@ -13999,7 +14156,7 @@ RowDefinition.prototype.expandChain = function() {
|
|
13999
14156
|
* @return {boolean} Returns true if there is a change in view
|
14000
14157
|
*/
|
14001
14158
|
RowDefinition.prototype.toggleChain = function() {
|
14002
|
-
if(this.
|
14159
|
+
if(this.isChainExpanded()) {
|
14003
14160
|
return this.collapseChain();
|
14004
14161
|
} else {
|
14005
14162
|
return this.expandChain();
|
@@ -14180,6 +14337,8 @@ RowDefinition.extractRowOptions = function(rowOptions) {
|
|
14180
14337
|
asChain = true;
|
14181
14338
|
}
|
14182
14339
|
expanded = true;
|
14340
|
+
} else if(asChain) {
|
14341
|
+
expanded = false;
|
14183
14342
|
}
|
14184
14343
|
|
14185
14344
|
let extractedOptions = {};
|
@@ -15143,9 +15302,12 @@ ColumnDefinition.prototype.initialize = function(columnOption) {
|
|
15143
15302
|
|
15144
15303
|
this._setField(field, columnOption); // Perform some field manipulation
|
15145
15304
|
|
15146
|
-
val = columnOption["name"]
|
15305
|
+
val = columnOption["name"];
|
15306
|
+
if(val == null) {
|
15307
|
+
val = columnOption["title"]; // For backward compatability
|
15308
|
+
}
|
15147
15309
|
if(val != null) { // Name can be empty string
|
15148
|
-
this._name = val;
|
15310
|
+
this._name = (typeof val === "string") ? val : (val + "");
|
15149
15311
|
this._defaultName = false;
|
15150
15312
|
}
|
15151
15313
|
|
@@ -18384,6 +18546,7 @@ Cell.prototype.initialize = function () {
|
|
18384
18546
|
this._aligner = document.createElement("button");
|
18385
18547
|
}
|
18386
18548
|
this._aligner.className = "valigner";
|
18549
|
+
this._aligner.role = "gridcell";
|
18387
18550
|
if(this._frontIcon) {
|
18388
18551
|
this._element.appendChild(this._frontIcon.getElement());
|
18389
18552
|
}
|
@@ -35747,6 +35910,7 @@ let _createHiddenInput = function () {
|
|
35747
35910
|
styleObj.position = "absolute";
|
35748
35911
|
styleObj.width = styleObj.height = styleObj.padding = styleObj.border = "0";
|
35749
35912
|
hiddenInput.value = "0";
|
35913
|
+
hiddenInput.role = "grid";
|
35750
35914
|
return hiddenInput;
|
35751
35915
|
};
|
35752
35916
|
/** @private
|
@@ -36293,7 +36457,7 @@ Core.prototype._hasPendingRowChange = false;
|
|
36293
36457
|
* @return {string}
|
36294
36458
|
*/
|
36295
36459
|
Core.getVersion = function () {
|
36296
|
-
return "5.1.
|
36460
|
+
return "5.1.117";
|
36297
36461
|
};
|
36298
36462
|
/** {@link ElementWrapper#dispose}
|
36299
36463
|
* @override
|
@@ -39364,21 +39528,21 @@ Core.prototype.getYScrollVal = function (sectionRef, rowIndex, topOfView) {
|
|
39364
39528
|
else if (rowIndex >= rowCount) { rowIndex = rowCount - 1; }
|
39365
39529
|
|
39366
39530
|
let viewInfo = this.getVerticalViewInfo();
|
39367
|
-
let
|
39531
|
+
let firstFullRow = viewInfo.firstFullRow; // TODO: Make it work in zooming mode
|
39368
39532
|
|
39369
39533
|
let scrollIndex = -1;
|
39370
39534
|
if (topOfView) {
|
39371
39535
|
scrollIndex = rowIndex;
|
39372
39536
|
} else {
|
39373
|
-
if(rowIndex <
|
39537
|
+
if(rowIndex < firstFullRow) { // Scroll up
|
39374
39538
|
scrollIndex = rowIndex - 3; // Have some spaces at the top for more appealing visual
|
39375
39539
|
if(scrollIndex < 0) {
|
39376
39540
|
scrollIndex = 0;
|
39377
39541
|
}
|
39378
39542
|
} else { // Scroll down
|
39379
|
-
let
|
39380
|
-
if (rowIndex >
|
39381
|
-
let viewIndexSize =
|
39543
|
+
let lastFullRow = viewInfo.lastFullRow;
|
39544
|
+
if (rowIndex > lastFullRow) {
|
39545
|
+
let viewIndexSize = lastFullRow - firstFullRow;
|
39382
39546
|
scrollIndex = rowIndex - viewIndexSize + 3;
|
39383
39547
|
if(scrollIndex < 0) {
|
39384
39548
|
scrollIndex = 0;
|
@@ -41100,13 +41264,20 @@ Core.prototype.getColumnIndex = function (colRef) {
|
|
41100
41264
|
return colRef;
|
41101
41265
|
} else if(colRef) {
|
41102
41266
|
let str = colRef;
|
41267
|
+
let indexByField = -1;
|
41103
41268
|
let colCount = this.getColumnCount();
|
41104
41269
|
for(let c = 0; c < colCount; ++c) {
|
41105
41270
|
let colDef = this._getColumnDef(c);
|
41106
|
-
if(str === colDef["id"]
|
41271
|
+
if(str === colDef["id"]){
|
41107
41272
|
return c;
|
41108
41273
|
}
|
41274
|
+
if(str === colDef["field"]) { // In case colId and field are the same, use colId first and field as a fallback
|
41275
|
+
if(indexByField < 0) {
|
41276
|
+
indexByField = c;
|
41277
|
+
}
|
41278
|
+
}
|
41109
41279
|
}
|
41280
|
+
return indexByField;
|
41110
41281
|
}
|
41111
41282
|
return -1;
|
41112
41283
|
};
|
@@ -41909,6 +42080,16 @@ ReferenceCounter.prototype.getAllReferences = function() {
|
|
41909
42080
|
return Object.keys(this._counter);
|
41910
42081
|
};
|
41911
42082
|
|
42083
|
+
/** @public
|
42084
|
+
* @return {boolean}
|
42085
|
+
*/
|
42086
|
+
ReferenceCounter.prototype.hasReference = function() {
|
42087
|
+
for (const key in this._counter) {
|
42088
|
+
return true;
|
42089
|
+
}
|
42090
|
+
return false;
|
42091
|
+
};
|
42092
|
+
|
41912
42093
|
/** @public
|
41913
42094
|
* @return {!Array.<string>}
|
41914
42095
|
*/
|
@@ -42165,6 +42346,14 @@ DataConnector.prototype.getAllRics = function () {
|
|
42165
42346
|
return this._rics.getAllReferences();
|
42166
42347
|
};
|
42167
42348
|
|
42349
|
+
/**
|
42350
|
+
* @public
|
42351
|
+
* @returns {boolean}
|
42352
|
+
*/
|
42353
|
+
DataConnector.prototype.hasRic = function () {
|
42354
|
+
return this._rics.hasReference();
|
42355
|
+
};
|
42356
|
+
|
42168
42357
|
/** @public
|
42169
42358
|
* @returns {Array.<RowDefinition>}
|
42170
42359
|
*/
|
@@ -45170,6 +45359,12 @@ Grid.prototype._focusingArgs = null;
|
|
45170
45359
|
* @private
|
45171
45360
|
*/
|
45172
45361
|
Grid.prototype._scrolledRow = -1;
|
45362
|
+
/** @type {boolean}
|
45363
|
+
* @private
|
45364
|
+
*/
|
45365
|
+
Grid.prototype._unlinking = false;
|
45366
|
+
|
45367
|
+
|
45173
45368
|
/** @public
|
45174
45369
|
*/
|
45175
45370
|
Grid.prototype.dispose = function() {
|
@@ -47340,7 +47535,9 @@ Grid.prototype.unlinkChain = function(rowRef) {
|
|
47340
47535
|
return;
|
47341
47536
|
}
|
47342
47537
|
|
47538
|
+
this._unlinking = true;
|
47343
47539
|
rowDef.unlinkChain();
|
47540
|
+
this._unlinking = false;
|
47344
47541
|
};
|
47345
47542
|
|
47346
47543
|
/** Alias to setRic
|
@@ -47646,6 +47843,14 @@ Grid.prototype.setRicData = function(ric, values) {
|
|
47646
47843
|
Grid.prototype.getAllRics = function() {
|
47647
47844
|
return this._connector.getAllRics();
|
47648
47845
|
};
|
47846
|
+
|
47847
|
+
/** Returns true if there is at least 1 RIC in the grid. This method includes RICs not in the row.
|
47848
|
+
* @public
|
47849
|
+
* @return {boolean}
|
47850
|
+
*/
|
47851
|
+
Grid.prototype.hasRic = function() {
|
47852
|
+
return this._connector.hasRic();
|
47853
|
+
};
|
47649
47854
|
/** A shorthand to set row data based on index of the specified row. It is better to keep rowDefinition object for updating data directly as row index can be changed by sorting and filtering.
|
47650
47855
|
* @public
|
47651
47856
|
* @param {Grid~RowReference} rowRef
|
@@ -48029,6 +48234,28 @@ Grid.prototype.getSortOrder = function() {
|
|
48029
48234
|
Grid.prototype.clearSort = function() {
|
48030
48235
|
this._stp.clearSortState(); // WARNING: No event is dispatched
|
48031
48236
|
};
|
48237
|
+
/** Get sorting states from sorting columns
|
48238
|
+
* @public
|
48239
|
+
* @return {!Array.<Object>} Array of sorting states ordered by priority. If there is no sorting column, an empty array is returned
|
48240
|
+
*/
|
48241
|
+
Grid.prototype.getSortingStates = function () { // This method is mainly for backward compatability
|
48242
|
+
let ary = [];
|
48243
|
+
let states = this._stp.getSortingStates();
|
48244
|
+
let stateCount = states.length;
|
48245
|
+
|
48246
|
+
for (let i = 0; i < stateCount; i++) {
|
48247
|
+
let state = states[i];
|
48248
|
+
let colIndex = this._stp.getSortedColumnIndex(i);
|
48249
|
+
|
48250
|
+
ary.push({
|
48251
|
+
"colId": this.getColumnId(colIndex),
|
48252
|
+
"colIndex": colIndex,
|
48253
|
+
"order": state["sortOrder"]
|
48254
|
+
});
|
48255
|
+
}
|
48256
|
+
|
48257
|
+
return ary;
|
48258
|
+
};
|
48032
48259
|
|
48033
48260
|
/**
|
48034
48261
|
* @private
|
@@ -48048,7 +48275,7 @@ Grid.prototype._onQuote2PostUpdate = function (e) {
|
|
48048
48275
|
*/
|
48049
48276
|
Grid.prototype._onDataChanged = function(e) {
|
48050
48277
|
let rowData = e["rowData"]; // Use rowData to retrieve corresponding subscription object
|
48051
|
-
if (!rowData) {
|
48278
|
+
if (!rowData || this._unlinking) {
|
48052
48279
|
return; // This must be a global change
|
48053
48280
|
}
|
48054
48281
|
let rowDef = rowData[ROW_DEF];
|
@@ -53076,17 +53303,17 @@ CellPainter.prototype._getStyles = function(rowData, min, max) {
|
|
53076
53303
|
if(this._coloringType === CellPainter.ColoringTypes.HEATMAP) {
|
53077
53304
|
let blendedColor;
|
53078
53305
|
if(ret > 0) {
|
53079
|
-
blendedColor =
|
53306
|
+
blendedColor = blendColor(curCond["baseColor"], curCond["upColor"], ret);
|
53080
53307
|
} else {
|
53081
|
-
blendedColor =
|
53308
|
+
blendedColor = blendColor(curCond["baseColor"], curCond["downColor"], -ret);
|
53082
53309
|
}
|
53083
53310
|
|
53084
53311
|
if(curCond["textMode"]) {
|
53085
|
-
CellPainter._colorObj["color"] =
|
53312
|
+
CellPainter._colorObj["color"] = num2Hex(blendedColor);
|
53086
53313
|
return CellPainter._colorObj;
|
53087
53314
|
} else {
|
53088
|
-
CellPainter._bgObj["backgroundColor"] =
|
53089
|
-
CellPainter._bgObj["color"] =
|
53315
|
+
CellPainter._bgObj["backgroundColor"] = num2Hex(blendedColor);
|
53316
|
+
CellPainter._bgObj["color"] = getContrastColor(blendedColor);
|
53090
53317
|
|
53091
53318
|
return CellPainter._bgObj;
|
53092
53319
|
}
|
@@ -53118,94 +53345,50 @@ CellPainter.prototype._getStyles = function(rowData, min, max) {
|
|
53118
53345
|
};
|
53119
53346
|
|
53120
53347
|
/** @public
|
53348
|
+
* @function
|
53121
53349
|
* @param {string} baseColor
|
53122
53350
|
* @param {string} maxColor
|
53123
53351
|
* @param {number} ratio [0, 1]
|
53124
53352
|
* @return {Array.<number>} resultColor
|
53125
53353
|
*/
|
53126
|
-
CellPainter.blendColor =
|
53127
|
-
if (ratio > 1) {
|
53128
|
-
ratio = 1;
|
53129
|
-
} else if(ratio < 0) {
|
53130
|
-
ratio = 0;
|
53131
|
-
}
|
53132
|
-
|
53133
|
-
let baseColorTriplet = CellPainter.hex2Num(baseColor);
|
53134
|
-
let maxColorTriplet = CellPainter.hex2Num(maxColor);
|
53135
|
-
let blendResult = [];
|
53136
|
-
for (let i = 0; i < 3; ++i) {
|
53137
|
-
let gap = (maxColorTriplet[i] - baseColorTriplet[i]) * ratio;
|
53138
|
-
blendResult.push(baseColorTriplet[i] + gap);
|
53139
|
-
}
|
53140
|
-
|
53141
|
-
return blendResult;
|
53142
|
-
};
|
53143
|
-
|
53354
|
+
CellPainter.blendColor = blendColor; // For backward compatability
|
53144
53355
|
/** @private
|
53356
|
+
* @function
|
53145
53357
|
* @param {Array.<number>} triplet
|
53146
53358
|
* @return {string} resultColor
|
53147
53359
|
*/
|
53148
|
-
CellPainter.blackAndWhite =
|
53149
|
-
let brightness = Math.sqrt(triplet[0] * triplet[0] * 0.241 + triplet[1] * triplet[1] * 0.691 + triplet[2] * triplet[2] * 0.068);
|
53150
|
-
|
53151
|
-
if (brightness >= 135) { // Brighter color has more impact to human eye than the darker color
|
53152
|
-
return '#000000';
|
53153
|
-
}
|
53154
|
-
return '#FFFFFF';
|
53155
|
-
};
|
53156
|
-
|
53360
|
+
CellPainter.blackAndWhite = getContrastColor; // For backward compatability
|
53157
53361
|
/** @public
|
53158
53362
|
* @function
|
53159
53363
|
* @param {string} rgbCode
|
53160
53364
|
* @return {string} resultColor E.g. "#10FF0D"
|
53161
53365
|
*/
|
53162
53366
|
CellPainter.rgb2Hex = rgb2Hex; // For backward compatability
|
53163
|
-
|
53164
53367
|
/** @public
|
53165
53368
|
* @function
|
53166
53369
|
* @param {Array.<number>} triplet
|
53167
53370
|
* @return {string} resultColor
|
53168
53371
|
*/
|
53169
|
-
CellPainter.num2Hex =
|
53170
|
-
let rgb = triplet[2] | (triplet[1] << 8) | (triplet[0] << 16);
|
53171
|
-
return ('#' + (0x1000000 + rgb).toString(16).slice(1));
|
53172
|
-
};
|
53372
|
+
CellPainter.num2Hex = num2Hex; // For backward compatability
|
53173
53373
|
/** Note that Chrome, IE, and Firefox store color in rgb representation.
|
53174
53374
|
* @public
|
53175
53375
|
* @function
|
53176
53376
|
* @param {Array.<number>} triplet
|
53177
53377
|
* @return {string} Color string in RGB represetation (e.g. rgb(100, 44, 1))
|
53178
53378
|
*/
|
53179
|
-
CellPainter.num2Rgb =
|
53180
|
-
return 'rgb(' + triplet[0] + ', ' + triplet[1] + ', ' + triplet[2] + ')';
|
53181
|
-
};
|
53379
|
+
CellPainter.num2Rgb = num2Rgb; // For backward compatability
|
53182
53380
|
/** @public
|
53183
53381
|
* @function
|
53184
53382
|
* @param {string} hex
|
53185
53383
|
* @return {Array.<number>} array of size 3 which contains [red, green, blue]
|
53186
53384
|
*/
|
53187
|
-
CellPainter.hex2Num =
|
53188
|
-
let hexInt = parseInt(hex.replace(/[^0-9A-F]/gi, ''), 16);
|
53189
|
-
let r = (hexInt >> 16) & 255;
|
53190
|
-
let g = (hexInt >> 8) & 255;
|
53191
|
-
let b = hexInt & 255;
|
53192
|
-
return [r, g, b];
|
53193
|
-
};
|
53385
|
+
CellPainter.hex2Num = hex2Num; // For backward compatability
|
53194
53386
|
/** @public
|
53195
53387
|
* @function
|
53196
53388
|
* @param {string} hex Color string with leading # character (e.g. #FFAA00)
|
53197
53389
|
* @return {string} Color string in RGB represetation (e.g. rgb(100, 44, 1))
|
53198
53390
|
*/
|
53199
|
-
CellPainter.hex2Rgb =
|
53200
|
-
if(hex) {
|
53201
|
-
let hexInt = parseInt(hex.replace(/[^0-9A-F]/gi, ''), 16);
|
53202
|
-
let r = (hexInt >> 16) & 255;
|
53203
|
-
let g = (hexInt >> 8) & 255;
|
53204
|
-
let b = hexInt & 255;
|
53205
|
-
return 'rgb(' + r + ', ' + g + ', ' + b + ')';
|
53206
|
-
}
|
53207
|
-
return '';
|
53208
|
-
};
|
53391
|
+
CellPainter.hex2Rgb = hex2Rgb; // For backward compatability
|
53209
53392
|
|
53210
53393
|
/** Deprecated. Colors should be changed according to user's settings by CellPainter#loadThemeColors
|
53211
53394
|
* @private
|
@@ -53341,11 +53524,11 @@ CellPainter._clearBlinkTimer = function(scp, opt_restoreColor) {
|
|
53341
53524
|
CellPainter.getOppositeColor = function (hexCode) {
|
53342
53525
|
if(typeof hexCode === "string") {
|
53343
53526
|
if(hexCode.charAt(0) === "#") {
|
53344
|
-
let triplet =
|
53345
|
-
return
|
53527
|
+
let triplet = hex2Num(hexCode);
|
53528
|
+
return getContrastColor(triplet);
|
53346
53529
|
}
|
53347
53530
|
} else if(Array.isArray(hexCode)) {
|
53348
|
-
return
|
53531
|
+
return getContrastColor(hexCode);
|
53349
53532
|
}
|
53350
53533
|
return "";
|
53351
53534
|
};
|