@refinitiv-ui/efx-grid 6.0.73 → 6.0.74
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.
- package/lib/grid/index.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +36 -31
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/Grid.js +34 -29
- package/lib/tr-grid-cell-selection/es6/CellSelection.d.ts +2 -0
- package/lib/tr-grid-cell-selection/es6/CellSelection.js +19 -0
- package/lib/tr-grid-range-bar/es6/RangeBar.js +20 -3
- package/lib/versions.json +2 -2
- package/package.json +1 -1
    
        package/lib/rt-grid/es6/Grid.js
    CHANGED
    
    | @@ -2466,6 +2466,32 @@ Grid.prototype.updateDataSet = function(records, rowIdentifier) { | |
| 2466 2466 | 
             
            				}
         | 
| 2467 2467 | 
             
            			}
         | 
| 2468 2468 | 
             
            		}
         | 
| 2469 | 
            +
             | 
| 2470 | 
            +
            		var idMap = {};
         | 
| 2471 | 
            +
            		var newDataMap = {};
         | 
| 2472 | 
            +
            		for (i = recordCount - 1; i >= 0; i--) {
         | 
| 2473 | 
            +
            			record = records[i];
         | 
| 2474 | 
            +
            			id = record[rowIdentifier];
         | 
| 2475 | 
            +
            			rowDef = oldDataMap[id];
         | 
| 2476 | 
            +
            			newDataMap[id] = record; // Assign a new data map to compare to the previous data
         | 
| 2477 | 
            +
            			record[fieldSorting] = i;
         | 
| 2478 | 
            +
            			if(idMap[id]) { // Prevent assign data in duplicate row
         | 
| 2479 | 
            +
            				continue;
         | 
| 2480 | 
            +
            			}
         | 
| 2481 | 
            +
            			idMap[id] = true;
         | 
| 2482 | 
            +
            			if (!rowDef) {
         | 
| 2483 | 
            +
            				this.insertRow({ values: record}); // Insert last position
         | 
| 2484 | 
            +
            			} else {
         | 
| 2485 | 
            +
            				rowDef.setRowData(record);
         | 
| 2486 | 
            +
            			}
         | 
| 2487 | 
            +
            		}
         | 
| 2488 | 
            +
            		// Check Remove previous data
         | 
| 2489 | 
            +
            		for (var rowIdentifierName in oldDataMap) {
         | 
| 2490 | 
            +
            			if (oldDataMap[rowIdentifierName] && !newDataMap[rowIdentifierName]) {
         | 
| 2491 | 
            +
            				this.removeRow(oldDataMap[rowIdentifierName]); // Slow
         | 
| 2492 | 
            +
            			}
         | 
| 2493 | 
            +
            		}
         | 
| 2494 | 
            +
            		this._dt.sortOnce(ROW_DEF, "a", compareNumber, fieldSorting);
         | 
| 2469 2495 | 
             
            	} else {
         | 
| 2470 2496 | 
             
            		for (i = 0; i < rowDefCount; i++) {
         | 
| 2471 2497 | 
             
            			record = records[i];
         | 
| @@ -2475,38 +2501,17 @@ Grid.prototype.updateDataSet = function(records, rowIdentifier) { | |
| 2475 2501 | 
             
            				this.removeRow(rowDefs[i]); // Need to use rowRef, can't use index in view
         | 
| 2476 2502 | 
             
            			}
         | 
| 2477 2503 | 
             
            		}
         | 
| 2478 | 
            -
            	}
         | 
| 2479 2504 |  | 
| 2480 | 
            -
             | 
| 2481 | 
            -
             | 
| 2482 | 
            -
             | 
| 2483 | 
            -
             | 
| 2484 | 
            -
             | 
| 2485 | 
            -
             | 
| 2486 | 
            -
             | 
| 2487 | 
            -
             | 
| 2488 | 
            -
            		record[fieldSorting] = i;
         | 
| 2489 | 
            -
            		if(idMap[id]) { // Prevent assign data in duplicate row
         | 
| 2490 | 
            -
            			continue;
         | 
| 2491 | 
            -
            		}
         | 
| 2492 | 
            -
            		idMap[id] = true;
         | 
| 2493 | 
            -
            		if (!rowDef) {
         | 
| 2494 | 
            -
            			this.insertRow({ values: record}); // Insert last position
         | 
| 2495 | 
            -
            		} else {
         | 
| 2496 | 
            -
            			rowDef.setRowData(record);
         | 
| 2497 | 
            -
            		}
         | 
| 2498 | 
            -
            	}
         | 
| 2499 | 
            -
             | 
| 2500 | 
            -
            	// Check Remove previous data
         | 
| 2501 | 
            -
            	for (var rowIdentifierName in oldDataMap) {
         | 
| 2502 | 
            -
            		if (oldDataMap[rowIdentifierName] && !newDataMap[rowIdentifierName]) {
         | 
| 2503 | 
            -
            			this.removeRow(oldDataMap[rowIdentifierName]); // Slow
         | 
| 2505 | 
            +
            		for (i = 0; i < recordCount; i++) { // It will be sort by index when insert / update
         | 
| 2506 | 
            +
            			record = records[i];
         | 
| 2507 | 
            +
            			rowDef = oldDataMap[i];
         | 
| 2508 | 
            +
            			if (!rowDef) {
         | 
| 2509 | 
            +
            				this.insertRow({ values: record}); // Insert last position
         | 
| 2510 | 
            +
            			} else {
         | 
| 2511 | 
            +
            				rowDef.setRowData(record);
         | 
| 2512 | 
            +
            			}
         | 
| 2504 2513 | 
             
            		}
         | 
| 2505 2514 | 
             
            	}
         | 
| 2506 | 
            -
             | 
| 2507 | 
            -
            	if(rowIdentifier) {
         | 
| 2508 | 
            -
            		this._dt.sortOnce(ROW_DEF, "a", compareNumber, fieldSorting);
         | 
| 2509 | 
            -
            	}
         | 
| 2510 2515 | 
             
            };
         | 
| 2511 2516 | 
             
            /** @private
         | 
| 2512 2517 | 
             
            * @param {Array|Object} item
         | 
| @@ -3,6 +3,8 @@ import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js"; | |
| 3 3 | 
             
            import { MouseDownTrait } from "../../tr-grid-util/es6/MouseDownTrait.js";
         | 
| 4 4 | 
             
            import { EventDispatcher } from "../../tr-grid-util/es6/EventDispatcher.js";
         | 
| 5 5 | 
             
            import { isIE, cloneObject, prepareTSVContent } from "../../tr-grid-util/es6/Util.js";
         | 
| 6 | 
            +
            import { ElfUtil } from "../../tr-grid-util/es6/ElfUtil.js";
         | 
| 7 | 
            +
            import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
         | 
| 6 8 |  | 
| 7 9 | 
             
            declare namespace CellSelectionPlugin {
         | 
| 8 10 |  | 
| @@ -3,6 +3,8 @@ import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js"; | |
| 3 3 | 
             
            import { MouseDownTrait } from "../../tr-grid-util/es6/MouseDownTrait.js";
         | 
| 4 4 | 
             
            import { EventDispatcher } from "../../tr-grid-util/es6/EventDispatcher.js";
         | 
| 5 5 | 
             
            import { isIE, cloneObject, prepareTSVContent } from "../../tr-grid-util/es6/Util.js";
         | 
| 6 | 
            +
            import { ElfUtil } from "../../tr-grid-util/es6/ElfUtil.js";
         | 
| 7 | 
            +
            import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
         | 
| 6 8 |  | 
| 7 9 | 
             
            /** @typedef {Object} CellSelectionPlugin~Options
         | 
| 8 10 | 
             
            * @description The options can be specified by `cellSelection` property of the main grid's options
         | 
| @@ -65,6 +67,22 @@ var CellSelectionPlugin = function CellSelectionPlugin(options) { | |
| 65 67 | 
             
            };
         | 
| 66 68 | 
             
            Ext.inherits(CellSelectionPlugin, GridPlugin);
         | 
| 67 69 |  | 
| 70 | 
            +
            /** @type {string}
         | 
| 71 | 
            +
            * @private
         | 
| 72 | 
            +
            */
         | 
| 73 | 
            +
            CellSelectionPlugin._styles = prettifyCss([":host .tr-grid .cell.selection", ["background-image: none;", "background-color: var(--grid-selection-bgcolor);"]]);
         | 
| 74 | 
            +
             | 
| 75 | 
            +
            /** @private
         | 
| 76 | 
            +
            * @param {Object} grid core grid instance
         | 
| 77 | 
            +
            */
         | 
| 78 | 
            +
            CellSelectionPlugin._applyStyles = function (grid) {
         | 
| 79 | 
            +
              if (!grid || grid._cellSelectionStyles || !ElfUtil.isHaloTheme()) {
         | 
| 80 | 
            +
                return;
         | 
| 81 | 
            +
              }
         | 
| 82 | 
            +
              grid._cellSelectionStyles = true; // Prevent loading the same style twice
         | 
| 83 | 
            +
              injectCss(CellSelectionPlugin._styles, grid.getElement());
         | 
| 84 | 
            +
            };
         | 
| 85 | 
            +
             | 
| 68 86 | 
             
            /** @type {Range}
         | 
| 69 87 | 
             
            * @private
         | 
| 70 88 | 
             
            */
         | 
| @@ -254,6 +272,7 @@ CellSelectionPlugin.prototype.initialize = function (host, options) { | |
| 254 272 | 
             
              if (this._hosts.length === 1) {
         | 
| 255 273 | 
             
                this.config(options);
         | 
| 256 274 | 
             
              }
         | 
| 275 | 
            +
              CellSelectionPlugin._applyStyles(host);
         | 
| 257 276 | 
             
            };
         | 
| 258 277 |  | 
| 259 278 | 
             
            /** Prevent memory leak, when we leave witout unlisten.
         | 
| @@ -494,9 +494,17 @@ RangeBarPlugin.prototype._onPostSectionBinding = function (e) { | |
| 494 494 | 
             
                    cell.setTooltip(textTooltip); // WARNING: this may be confuse with auto-tooltip extension
         | 
| 495 495 | 
             
                  }
         | 
| 496 496 |  | 
| 497 | 
            +
                  var span;
         | 
| 498 | 
            +
                  if (high == null && low == null && last == null) {
         | 
| 499 | 
            +
                    // Empty case
         | 
| 500 | 
            +
                    span = document.createElement("span");
         | 
| 501 | 
            +
                    span.textContent = "";
         | 
| 502 | 
            +
                    cell.setContent(span);
         | 
| 503 | 
            +
                    continue;
         | 
| 504 | 
            +
                  }
         | 
| 497 505 | 
             
                  if (high == null || low == null || high < low) {
         | 
| 498 | 
            -
                    //  | 
| 499 | 
            -
                     | 
| 506 | 
            +
                    // Empty low or high case
         | 
| 507 | 
            +
                    span = document.createElement("span");
         | 
| 500 508 | 
             
                    span.textContent = "N/A";
         | 
| 501 509 | 
             
                    cell.setContent(span);
         | 
| 502 510 | 
             
                    continue;
         | 
| @@ -545,8 +553,17 @@ RangeBarPlugin.prototype._onPostSectionBinding = function (e) { | |
| 545 553 | 
             
                      var highNormalize = _normalizeValue(low, high, last);
         | 
| 546 554 | 
             
                      rangeBar.range = [highNormalize, lastNormalize];
         | 
| 547 555 | 
             
                    }
         | 
| 548 | 
            -
                     | 
| 556 | 
            +
                    if (low === high) {
         | 
| 557 | 
            +
                      // low equal high case (avoid normalize to infinity)
         | 
| 558 | 
            +
                      rangeBar.range = [-100, 100];
         | 
| 559 | 
            +
                      lastNormalize = last < low ? -100 : 100; // topValue will be left or right
         | 
| 560 | 
            +
                    }
         | 
| 549 561 |  | 
| 562 | 
            +
                    if (last == null) {
         | 
| 563 | 
            +
                      // only last is empty (low and high should have value)
         | 
| 564 | 
            +
                      rangeBar.range = [];
         | 
| 565 | 
            +
                      lastNormalize = null;
         | 
| 566 | 
            +
                    }
         | 
| 550 567 | 
             
                    rangeBar.topValue = lastNormalize;
         | 
| 551 568 | 
             
                    if (this.valueLabel) {
         | 
| 552 569 | 
             
                      rangeBar.topLabel = last;
         | 
    
        package/lib/versions.json
    CHANGED
    
    | @@ -6,7 +6,7 @@ | |
| 6 6 | 
             
            	"@grid/statistics-row": "1.0.15",
         | 
| 7 7 | 
             
            	"@grid/zoom": "1.0.11",
         | 
| 8 8 | 
             
            	"tr-grid-auto-tooltip": "1.1.6",
         | 
| 9 | 
            -
            	"tr-grid-cell-selection": "1.0. | 
| 9 | 
            +
            	"tr-grid-cell-selection": "1.0.34",
         | 
| 10 10 | 
             
            	"tr-grid-checkbox": "1.0.60",
         | 
| 11 11 | 
             
            	"tr-grid-column-fitter": "1.0.39",
         | 
| 12 12 | 
             
            	"tr-grid-column-formatting": "0.9.35",
         | 
| @@ -22,7 +22,7 @@ | |
| 22 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 | 
            -
            	"tr-grid-range-bar": "2.0. | 
| 25 | 
            +
            	"tr-grid-range-bar": "2.0.6",
         | 
| 26 26 | 
             
            	"tr-grid-row-dragging": "1.0.31",
         | 
| 27 27 | 
             
            	"tr-grid-row-filtering": "1.0.65",
         | 
| 28 28 | 
             
            	"tr-grid-row-grouping": "1.0.82",
         | 
    
        package/package.json
    CHANGED