@refinitiv-ui/efx-grid 6.0.24 → 6.0.26

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. package/lib/core/dist/core.css +1 -1
  2. package/lib/core/dist/core.js +1331 -145
  3. package/lib/core/dist/core.min.js +1 -1
  4. package/lib/core/es6/grid/Core.d.ts +11 -0
  5. package/lib/core/es6/grid/Core.js +81 -10
  6. package/lib/core/es6/grid/util/ElementFrameWork.js +1 -1
  7. package/lib/core/es6/tr-grid-theme.js +1 -1
  8. package/lib/grid/index.js +1 -1
  9. package/lib/rt-grid/dist/rt-grid.js +768 -53
  10. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  11. package/lib/rt-grid/es6/ColumnDefinition.js +1 -1
  12. package/lib/rt-grid/es6/FieldDefinition.d.ts +2 -0
  13. package/lib/rt-grid/es6/FieldDefinition.js +13 -2
  14. package/lib/rt-grid/es6/Grid.d.ts +3 -1
  15. package/lib/rt-grid/es6/Grid.js +83 -39
  16. package/lib/rt-grid/es6/RowDefinition.d.ts +14 -1
  17. package/lib/rt-grid/es6/RowDefinition.js +54 -2
  18. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +3 -2
  19. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +314 -566
  20. package/lib/tr-grid-column-selection/es6/ColumnSelection.d.ts +13 -11
  21. package/lib/tr-grid-column-selection/es6/ColumnSelection.js +233 -81
  22. package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +3 -3
  23. package/lib/tr-grid-column-stack/es6/ColumnStack.js +50 -56
  24. package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +21 -9
  25. package/lib/tr-grid-range-bar/es6/RangeBar.d.ts +18 -9
  26. package/lib/tr-grid-range-bar/es6/RangeBar.js +318 -139
  27. package/lib/tr-grid-util/es6/GridPlugin.d.ts +1 -1
  28. package/lib/tr-grid-util/es6/GridPlugin.js +13 -15
  29. package/lib/tr-grid-util/es6/GroupDefinitions.d.ts +58 -0
  30. package/lib/tr-grid-util/es6/GroupDefinitions.js +538 -0
  31. package/lib/tr-grid-util/es6/Popup.js +1 -1
  32. package/lib/tr-grid-util/es6/index.d.ts +2 -0
  33. package/lib/tr-grid-util/es6/index.js +3 -0
  34. package/lib/types/es6/ColumnGrouping.d.ts +3 -2
  35. package/lib/types/es6/ColumnSelection.d.ts +13 -11
  36. package/lib/types/es6/ColumnStack.d.ts +3 -3
  37. package/lib/types/es6/Core/grid/Core.d.ts +11 -0
  38. package/lib/types/es6/RealtimeGrid/FieldDefinition.d.ts +2 -0
  39. package/lib/types/es6/RealtimeGrid/Grid.d.ts +3 -1
  40. package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +14 -1
  41. package/lib/types/es6/index.d.ts +1 -1
  42. package/lib/versions.json +6 -6
  43. package/package.json +1 -1
@@ -426,7 +426,6 @@ ColumnStackPlugin.prototype._transformStackConfig = function(stackConfig) {
426
426
  stackConfig.colRefs = [];
427
427
  var children = stackConfig.children;
428
428
  var fields = stackConfig.fields;
429
- var activeColumn = stackConfig.activeColumn;
430
429
  var field;
431
430
  if(children){
432
431
  var childLen = stackConfig.children.length;
@@ -434,18 +433,21 @@ ColumnStackPlugin.prototype._transformStackConfig = function(stackConfig) {
434
433
  var colIndex = this.getColumnIndex(children[j]);
435
434
  if(colIndex !== -1){
436
435
  field = this._getField(colIndex);
437
- stackConfig.colRefs.push(field);
436
+ if(field) {
437
+ stackConfig.colRefs.push(field);
438
+ }
438
439
  }
439
440
  }
440
441
  } else if(fields) {
441
442
  stackConfig.colRefs = fields;
442
443
  }
443
- if(activeColumn && !this._autoStacking){
444
+ var activeColumn = stackConfig.activeColumn;
445
+ if(activeColumn != null && !this._autoStacking){
444
446
  var activeColIndex = this.getColumnIndex(activeColumn);
445
447
  if(activeColIndex !== -1){
446
- field = this._getField(colIndex);
448
+ field = this._getField(activeColIndex);
447
449
  if(field){
448
- stackConfig.activeColumn;
450
+ stackConfig.activeColumn = field;
449
451
  }
450
452
  }
451
453
  }
@@ -929,6 +931,7 @@ ColumnStackPlugin.prototype.stackColumns = function(colRefs, stackId, options) {
929
931
  if(colRefs.length) {
930
932
  if(typeof colRefs[0] === "string") {
931
933
  fields = colRefs.slice();
934
+ colRefs = this.getColumnIndices(colRefs);
932
935
  } else {
933
936
  colRefs.sort(function(a, b) { return a - b; }); // Only sort in the case of column index stack
934
937
  for(i = 0; i < colRefs.length; i++){
@@ -936,7 +939,6 @@ ColumnStackPlugin.prototype.stackColumns = function(colRefs, stackId, options) {
936
939
  fields.push(field);
937
940
  }
938
941
  }
939
- colRefs = this.getColumnIndices(colRefs);
940
942
  }
941
943
 
942
944
  // Save stack fields for
@@ -954,13 +956,14 @@ ColumnStackPlugin.prototype.stackColumns = function(colRefs, stackId, options) {
954
956
  return false;
955
957
  }
956
958
 
957
- var activeIndex = options.activeColumn ? this.getColumnIndices(options.activeColumn) : colRefs[0];
958
- if (activeIndex.length){
959
- activeIndex = activeIndex[0];
960
- }
961
- if(activeIndex == null || colRefs.indexOf(activeIndex) == -1){
962
- activeIndex = colRefs[0];
959
+ var activeIndex = colRefs[0];
960
+ if(options.activeColumn != null) {
961
+ var idx = this.getColumnIndex(options.activeColumn);
962
+ if(idx > -1 && colRefs.indexOf(idx) > -1) {
963
+ activeIndex = idx;
964
+ }
963
965
  }
966
+
964
967
  // Collecting data
965
968
  var stack = {};
966
969
  stack.stackId = sid;
@@ -1486,19 +1489,17 @@ ColumnStackPlugin.prototype.getStackMemberIds = function(stackId) {
1486
1489
 
1487
1490
  /** @public
1488
1491
  * @description Get column id by column index or indices
1489
- * @param {number|Array<number>} columnIndex
1492
+ * @param {number|Array<number>} colIndices
1490
1493
  * @return {!Array.<string>} Column ids
1491
1494
  */
1492
- ColumnStackPlugin.prototype.getColumnIdsByIndex = function(columnIndex) {
1493
- var colIndices = [];
1494
- var colIds = [];
1495
- if(Array.isArray(columnIndex)){
1496
- colIndices = columnIndex;
1497
- } else {
1498
- colIndices.push(colIds);
1495
+ ColumnStackPlugin.prototype.getColumnIdsByIndex = function(colIndices) {
1496
+ if(!Array.isArray(colIndices)){
1497
+ colIndices = [colIndices];
1499
1498
  }
1499
+ var colIds = [];
1500
+ var colId;
1500
1501
  for(var i = 0; i < colIndices.length; ++i) {
1501
- var colId = this.getColumnId(colIndices[i]);
1502
+ colId = this.getColumnId(colIndices[i]);
1502
1503
  colIds.push(colId);
1503
1504
  }
1504
1505
  return colIds;
@@ -1506,39 +1507,33 @@ ColumnStackPlugin.prototype.getColumnIdsByIndex = function(columnIndex) {
1506
1507
 
1507
1508
  /** @public
1508
1509
  * @description Get column indices by column ids
1509
- * @param {string|Array<string>} columnId
1510
+ * @param {string|Array<string>} colIds
1510
1511
  * @return {!Array.<string>} Column indices
1511
1512
  */
1512
- ColumnStackPlugin.prototype.getColumnIndicesByColumnIds = function(columnId) {
1513
- var colIndices = [];
1514
- var colIds = [];
1515
- if(Array.isArray(columnId)){
1516
- colIds = columnId;
1517
- } else {
1518
- colIds.push(colIds);
1513
+ ColumnStackPlugin.prototype.getColumnIndicesByColumnIds = function(colIds) {
1514
+ if(!Array.isArray(colIds)){
1515
+ colIds = [colIds];
1519
1516
  }
1517
+ var colIndices = [];
1518
+ var colIndex;
1520
1519
  for(var i = 0; i < colIds.length; ++i) {
1521
- var colId = this.getColumnIndex(colIds[i]);
1522
- colIndices.push(colId);
1520
+ colIndex = this.getColumnIndex(colIds[i]);
1521
+ colIndices.push(colIndex);
1523
1522
  }
1524
1523
  return colIndices;
1525
1524
  };
1526
1525
 
1527
1526
  /** @public
1528
1527
  * @description Get column ids by fields
1529
- * @param {string|Array<string>} field
1528
+ * @param {string|Array<string>} fields
1530
1529
  * @return {!Array.<string>} Column indices
1531
1530
  */
1532
- ColumnStackPlugin.prototype.getColumnIdsByFields = function(field) {
1533
- var colIndices = [];
1534
- var fields = [];
1535
- if(Array.isArray(field)){
1536
- fields = field;
1537
- } else {
1538
- fields.push(field);
1531
+ ColumnStackPlugin.prototype.getColumnIdsByFields = function(fields) {
1532
+ if(!Array.isArray(fields)){
1533
+ fields = [fields];
1539
1534
  }
1540
1535
 
1541
- colIndices = this.getColumnIndices(field);
1536
+ var colIndices = this.getColumnIndices(fields);
1542
1537
 
1543
1538
  return this.getColumnIdsByIndex(colIndices);
1544
1539
  };
@@ -1550,9 +1545,9 @@ ColumnStackPlugin.prototype.getColumnIdsByFields = function(field) {
1550
1545
  */
1551
1546
  ColumnStackPlugin.prototype.addColumnToStack = function(colRef, stackId) {
1552
1547
  if(typeof colRef === "string") {
1553
- var colIndices = this.getColumnIndices([colRef]);
1554
- if(colIndices.length){
1555
- colRef = colIndices[0];
1548
+ colRef = this.getColumnIndex(colRef);
1549
+ if(colRef < 0) {
1550
+ return;
1556
1551
  }
1557
1552
  }
1558
1553
 
@@ -1570,7 +1565,7 @@ ColumnStackPlugin.prototype.addColumnToStack = function(colRef, stackId) {
1570
1565
  }
1571
1566
 
1572
1567
  // Prevent from flashing in stack mode
1573
- if(colRef !== activeIndex && stack.collapsed !== false) {
1568
+ if(stack.collapsed !== false) {
1574
1569
  this._setColumnVisibility(colRef, false);
1575
1570
  }
1576
1571
 
@@ -1585,8 +1580,6 @@ ColumnStackPlugin.prototype.addColumnToStack = function(colRef, stackId) {
1585
1580
  stack.activeColumn = stack.stackRefs[0];
1586
1581
  }
1587
1582
 
1588
- var activeIndex = this._getColumnIndex(stack.activeColumn);
1589
-
1590
1583
  // Pack stacked columns together
1591
1584
  this._moveStackedColumns(stack.stackRefs);
1592
1585
 
@@ -1599,16 +1592,16 @@ ColumnStackPlugin.prototype.addColumnToStack = function(colRef, stackId) {
1599
1592
  */
1600
1593
  ColumnStackPlugin.prototype.removeColumnFromStack = function(colRef) {
1601
1594
  if(typeof colRef === "string") {
1602
- var colIndices = this.getColumnIndices([colRef]);
1603
- if(colIndices.length){
1604
- colRef = colIndices[0];
1595
+ colRef = this.getColumnIndex(colRef);
1596
+ if(colRef < 0) {
1597
+ return;
1605
1598
  }
1606
1599
  }
1607
1600
 
1608
1601
  var stackId = this.getStackId(colRef);
1609
1602
  var stack = this._stacks[stackId];
1610
- if(!stack || colRef == -1) {
1611
- return; // Invalid column index or stackId
1603
+ if(!stack) {
1604
+ return;
1612
1605
  }
1613
1606
 
1614
1607
  var stackMembers = this.getStackMemberIndices(stackId);
@@ -1669,17 +1662,18 @@ ColumnStackPlugin.prototype.reorderStackColumns = function(colRefs, stackId) {
1669
1662
  }
1670
1663
 
1671
1664
  var newStackMembers = [];
1672
- for(var i = 0; i < len; i++ ){
1673
- var colIndex = colRefs[i];
1665
+ var i, colIndex;
1666
+ for(i = 0; i < len; i++ ){
1667
+ colIndex = colRefs[i];
1674
1668
  if(stackMemberIndices.indexOf(colIndex) !== -1){
1675
1669
  newStackMembers.push(colIndex);
1676
1670
  }
1677
1671
  }
1678
1672
  if(newStackMembers.length !== stackMemberCount){
1679
1673
  for(i = 0; i < stackMemberCount; i++ ){
1680
- var columnIndex = stackMemberIndices[i];
1681
- if(newStackMembers.indexOf(columnIndex) === -1){
1682
- newStackMembers.push(columnIndex);
1674
+ colIndex = stackMemberIndices[i];
1675
+ if(newStackMembers.indexOf(colIndex) === -1){
1676
+ newStackMembers.push(colIndex);
1683
1677
  if(newStackMembers.length === stackMemberCount){
1684
1678
  break;
1685
1679
  }
@@ -350,7 +350,7 @@ InCellEditingPlugin._primaryColor = "";
350
350
  /** @type {string}
351
351
  * @private
352
352
  */
353
- InCellEditingPlugin._styles = prettifyCss([":host .cell.editing input[type=text]", ["border-style: solid;"]]);
353
+ InCellEditingPlugin._styles = prettifyCss([":host .cell.editing input[type=text]", ["border-style: solid;"], ":host .cell.editing", ["z-index: 2;"]]);
354
354
 
355
355
  /** @private
356
356
  */
@@ -1911,11 +1911,18 @@ InCellEditingPlugin.prototype._onUpdateEditorPopup = function () {
1911
1911
  if (this._compositeGrid || this._realTimeGrid) {
1912
1912
  parentElement = grid.getElement().parentElement;
1913
1913
  }
1914
+ var rowIndex, colIndex;
1914
1915
  if (this._activeInCellCache) {
1915
1916
  var activePos = this._activePos;
1916
1917
  if (activePos) {
1918
+ rowIndex = activePos["rowIndex"];
1919
+ colIndex = activePos["colIndex"];
1917
1920
  var section = grid.getSection(activePos["sectionType"]);
1918
- var cell = section.getCell(activePos["colIndex"], activePos["rowIndex"]);
1921
+ var cell = section.getCell(colIndex, rowIndex);
1922
+ var stretchedCell = section.getStretchedCell(cell, rowIndex);
1923
+ if (stretchedCell) {
1924
+ cell = stretchedCell;
1925
+ }
1919
1926
  if (cell) {
1920
1927
  var popup = this._activeInCellCache["balloonPopup"];
1921
1928
  popup.attachTo(cell.getElement());
@@ -1925,7 +1932,7 @@ InCellEditingPlugin.prototype._onUpdateEditorPopup = function () {
1925
1932
  }
1926
1933
  } else if (this._activeRowId) {
1927
1934
  var sectionContent = grid.getSection("content");
1928
- var rowIndex = this._getRowIndex(this._activeRowId);
1935
+ rowIndex = this._getRowIndex(this._activeRowId);
1929
1936
  if (sectionContent.isRowVisible(rowIndex)) {
1930
1937
  var lastIndex = (sectionContent.getColumnCount() || 0) - 1;
1931
1938
  for (var columnIndex = 0; columnIndex <= lastIndex; columnIndex++) {
@@ -1942,7 +1949,6 @@ InCellEditingPlugin.prototype._onUpdateEditorPopup = function () {
1942
1949
  }
1943
1950
  }
1944
1951
  }
1945
- grid.focus();
1946
1952
  };
1947
1953
  /** Update editor popup position and styles
1948
1954
  * @private
@@ -1953,6 +1959,7 @@ InCellEditingPlugin.prototype._onUpdateEditorPopup = function () {
1953
1959
  InCellEditingPlugin.prototype._updateEditorPopup = function (contentEditor, cell, grid) {
1954
1960
  var popup = contentEditor["balloonPopup"];
1955
1961
  var editor = contentEditor["editor"];
1962
+ var inputElement = contentEditor["inputElement"];
1956
1963
  var popupElem = popup.getElement();
1957
1964
  var pos = grid.getRelativePosition(cell);
1958
1965
  var width = cell.getWidth();
@@ -1992,12 +1999,16 @@ InCellEditingPlugin.prototype._updateEditorPopup = function (contentEditor, cell
1992
1999
  } else {
1993
2000
  var acquiredWidth = pos["x"] + newWidth;
1994
2001
  var acquiredHeight = pos["y"] - offsetTop + newHeight;
1995
-
1996
- // Left overflow
1997
- if (pos["x"] < offsetLeft) {
1998
- newWidth = newWidth - (offsetLeft - pos["x"]);
1999
- marginLeft = marginLeft + Math.abs(pos["x"] - offsetLeft);
2002
+ var isPinned = grid.isPinnedColumn(pos["colIndex"]);
2003
+ // if column is pinned, doesn't need to calculate left overflow
2004
+ if (!isPinned) {
2005
+ // Left overflow
2006
+ if (pos["x"] < offsetLeft) {
2007
+ newWidth = newWidth - (offsetLeft - pos["x"]);
2008
+ marginLeft = marginLeft + Math.abs(pos["x"] - offsetLeft);
2009
+ }
2000
2010
  }
2011
+
2001
2012
  // Right overflow
2002
2013
  if (acquiredWidth > offsetWidth) {
2003
2014
  newWidth = newWidth - (acquiredWidth - offsetWidth);
@@ -2020,6 +2031,7 @@ InCellEditingPlugin.prototype._updateEditorPopup = function (contentEditor, cell
2020
2031
  editor.style.height = newHeight ? newHeight + "px" : "";
2021
2032
  editor.style.marginLeft = marginLeft ? marginLeft + "px" : 0;
2022
2033
  editor.style.marginTop = marginTop ? marginTop + "px" : 0;
2034
+ inputElement.focus();
2023
2035
  };
2024
2036
  export default InCellEditingPlugin;
2025
2037
  export { InCellEditingPlugin, InCellEditingPlugin as InCellEditing, InCellEditingPlugin as InCellEditingExtension };
@@ -1,22 +1,25 @@
1
1
  import {Ext} from '../../tr-grid-util/es6/Ext.js';
2
2
  import {GridPlugin} from '../../tr-grid-util/es6/GridPlugin.js';
3
- import {RangeBar} from '../../tr-grid-util/es6/RangeBar.js';
4
- import {Dom} from '../../tr-grid-util/es6/Dom.js';
5
3
  import {ElfUtil} from '../../tr-grid-util/es6/ElfUtil.js';
4
+ import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
6
5
 
7
6
  declare namespace RangeBarPlugin {
8
7
 
9
8
  type ColumnOptions = {
10
- rangeBar?: RangeBarPlugin.RangeDefinition
9
+ rangeBar?: RangeBarPlugin.RangeDefinition|null
11
10
  };
12
11
 
13
12
  type RangeDefinition = {
14
- field?: string,
15
- start?: number,
16
- end?: number,
17
- low?: string,
18
- high?: string,
19
- last?: string
13
+ field?: string|null,
14
+ start?: number|null,
15
+ end?: number|null,
16
+ low?: string|null,
17
+ high?: string|null,
18
+ last?: string|null
19
+ };
20
+
21
+ type Options = {
22
+ tooltip?: boolean|null
20
23
  };
21
24
 
22
25
  }
@@ -33,6 +36,12 @@ declare class RangeBarPlugin extends GridPlugin {
33
36
 
34
37
  public getConfigObject(out_obj?: any): any;
35
38
 
39
+ public getColumnConfigObject(colIndex: number, out_obj?: any): any;
40
+
41
+ public getValue(colRef: number|string|null, rowRef: number|string|null): any;
42
+
43
+ public getTooltipText(colRef: number|string|null, rowRef: number|string|null): string;
44
+
36
45
  }
37
46
 
38
47
  export default RangeBarPlugin;