@refinitiv-ui/efx-grid 6.0.84 → 6.0.86

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. package/lib/core/dist/core.js +241 -153
  2. package/lib/core/dist/core.min.js +1 -1
  3. package/lib/core/es6/data/DataView.d.ts +4 -0
  4. package/lib/core/es6/data/DataView.js +23 -0
  5. package/lib/core/es6/grid/Core.d.ts +0 -4
  6. package/lib/core/es6/grid/Core.js +34 -22
  7. package/lib/core/es6/grid/plugins/SortableTitlePlugin.d.ts +13 -3
  8. package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +184 -131
  9. package/lib/grid/index.js +1 -1
  10. package/lib/rt-grid/dist/rt-grid.js +275 -159
  11. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  12. package/lib/rt-grid/es6/ColumnDefinition.js +1 -2
  13. package/lib/rt-grid/es6/Grid.js +7 -7
  14. package/lib/tr-grid-checkbox/es6/Checkbox.d.ts +2 -0
  15. package/lib/tr-grid-checkbox/es6/Checkbox.js +38 -0
  16. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +3 -4
  17. package/lib/tr-grid-filter-input/es6/FilterInput.js +32 -3
  18. package/lib/tr-grid-row-filtering/es6/RowFiltering.d.ts +4 -1
  19. package/lib/tr-grid-row-filtering/es6/RowFiltering.js +3 -0
  20. package/lib/tr-grid-textformatting/es6/TextFormatting.js +13 -2
  21. package/lib/tr-grid-util/es6/Dom.d.ts +1 -1
  22. package/lib/tr-grid-util/es6/Dom.js +1 -1
  23. package/lib/tr-grid-util/es6/ExpressionParser.js +1 -1
  24. package/lib/tr-grid-util/es6/FieldFormatter.js +4 -2
  25. package/lib/tr-grid-util/es6/FilterBuilder.d.ts +1 -1
  26. package/lib/tr-grid-util/es6/FilterBuilder.js +1 -1
  27. package/lib/tr-grid-util/es6/NumberFormatter.js +2 -2
  28. package/lib/tr-grid-util/es6/PercentBar.d.ts +1 -1
  29. package/lib/tr-grid-util/es6/PercentBar.js +1 -1
  30. package/lib/tr-grid-util/es6/RangeBar.d.ts +1 -1
  31. package/lib/tr-grid-util/es6/RangeBar.js +8 -7
  32. package/lib/tr-grid-util/es6/TextHighlighter.d.ts +0 -2
  33. package/lib/tr-grid-util/es6/TextHighlighter.js +1 -6
  34. package/lib/tr-grid-util/es6/formula/Formula.js +1 -1
  35. package/lib/tr-grid-util/es6/formula/VariableToken.js +1 -1
  36. package/lib/tr-grid-util/es6/formula/functions/Excel.d.ts +1 -1
  37. package/lib/tr-grid-util/es6/formula/functions/Excel.js +1 -1
  38. package/lib/tr-grid-util/es6/index.js +1 -1
  39. package/lib/tr-grid-util/es6/jet/DataGenerator.d.ts +1 -1
  40. package/lib/tr-grid-util/es6/jet/DataGenerator.js +1 -1
  41. package/lib/types/es6/Core/data/DataView.d.ts +4 -0
  42. package/lib/types/es6/Core/grid/Core.d.ts +0 -4
  43. package/lib/types/es6/Core/grid/plugins/SortableTitlePlugin.d.ts +13 -3
  44. package/lib/types/es6/RowFiltering.d.ts +4 -1
  45. package/lib/versions.json +6 -6
  46. package/package.json +1 -1
@@ -218,10 +218,14 @@ declare class DataView extends EventDispatcher {
218
218
 
219
219
  public getExpansionParents(from?: number|null, to?: number|null): (string)[]|null;
220
220
 
221
+ public getExpansionParentByRowId(rid: string): string;
222
+
221
223
  public isRowExpansion(rid: string): boolean;
222
224
 
223
225
  public hasRowExpansion(rid: string): boolean;
224
226
 
227
+ public getRowExpansionCount(rowId: string): number;
228
+
225
229
  public getRowExpansionId(rid: string, idx?: number|null): string;
226
230
 
227
231
  public getRowExpansionIndex(rid: string): number;
@@ -2094,6 +2094,17 @@ DataView.prototype.getExpansionParents = function (from, to) {
2094
2094
  return parentMapping;
2095
2095
  };
2096
2096
 
2097
+ /**
2098
+ * @public
2099
+ * @param {string} rid
2100
+ * @return {string} parent row id
2101
+ */
2102
+ DataView.prototype.getExpansionParentByRowId = function(rid) {
2103
+ if(this._expansionChildren) {
2104
+ return this._expansionChildren[rid] || "";
2105
+ }
2106
+ return "";
2107
+ };
2097
2108
  /** Check if the specified row is itself a row expansion.
2098
2109
  * @public
2099
2110
  * @param {string} rid rowId
@@ -2116,6 +2127,18 @@ DataView.prototype.hasRowExpansion = function(rid) {
2116
2127
  }
2117
2128
  return false;
2118
2129
  };
2130
+ /**
2131
+ * @public
2132
+ * @param {string} rowId
2133
+ * @return {number}
2134
+ */
2135
+ DataView.prototype.getRowExpansionCount = function(rowId) {
2136
+ if(this._expansionMap) {
2137
+ return this._expansionMap[rowId] || 0;
2138
+ }
2139
+ return 0;
2140
+ };
2141
+
2119
2142
  /** Get row Id of the row expansion by providing the row Id of the row with row expansion (not row expansion itself). This is NOT recommended for normal usage, since the row expansion contains no data in the DataView
2120
2143
  * @public
2121
2144
  * @param {string} rid rowId
@@ -227,10 +227,6 @@ declare class Core extends ElementWrapper {
227
227
 
228
228
  public getColumnData(colIndex: number): any;
229
229
 
230
- public setColumnData(colIndex: number, userData: any): any;
231
-
232
- public newColumnData(colIndex: number): any;
233
-
234
230
  public setAlwaysRenderColumn(colIndex: number, alwaysRender?: boolean|null): void;
235
231
 
236
232
  public getFitContentWidth(): boolean;
@@ -574,7 +574,7 @@ Core.prototype._hasPendingRowChange = false;
574
574
  * @return {string}
575
575
  */
576
576
  Core.getVersion = function () {
577
- return "5.1.87";
577
+ return "5.1.90";
578
578
  };
579
579
  /** {@link ElementWrapper#dispose}
580
580
  * @override
@@ -2689,27 +2689,30 @@ Core.prototype.preserveGridSize = function (preserve) {
2689
2689
  };
2690
2690
  /** @public
2691
2691
  * @param {number} colIndex
2692
- * @return {Object} userData
2692
+ * @return {!Object} Column data object
2693
2693
  */
2694
2694
  Core.prototype.getColumnData = function (colIndex) {
2695
- return this._getColumnDef(colIndex)["columnData"] || null;
2695
+ return this._getColumnDef(colIndex)["columnData"];
2696
2696
  };
2697
2697
  /** @public
2698
+ * @deprecated
2699
+ * @ignore
2698
2700
  * @param {number} colIndex
2699
2701
  * @param {Object} userData
2700
2702
  * @return {Object}
2701
2703
  */
2702
- Core.prototype.setColumnData = function (colIndex, userData) { // TODO: Deprecate this method
2703
- this._getColumnDef(colIndex)["columnData"] = userData;
2704
+ Core.prototype.setColumnData = function (colIndex, userData) {
2705
+ this._getColumnDef(colIndex)["columnData"] = userData || {};
2704
2706
  return userData;
2705
2707
  };
2706
2708
  /** @public
2709
+ * @function
2710
+ * @deprecated
2711
+ * @ignore
2707
2712
  * @param {number} colIndex
2708
2713
  * @return {!Object}
2709
2714
  */
2710
- Core.prototype.newColumnData = function (colIndex) {
2711
- return this.getColumnData(colIndex) || {};
2712
- };
2715
+ Core.prototype.newColumnData = Core.prototype.getColumnData;
2713
2716
  /** @public
2714
2717
  * @param {number} colIndex
2715
2718
  * @param {boolean=} alwaysRender
@@ -2723,10 +2726,7 @@ Core.prototype.setAlwaysRenderColumn = function(colIndex, alwaysRender) {
2723
2726
  */
2724
2727
  Core.prototype._isAlwaysRenderColumn = function (colIndex) {
2725
2728
  var colData = this.getColumnData(colIndex);
2726
- if(colData) {
2727
- return colData["alwaysRender"] === true;
2728
- }
2729
- return false;
2729
+ return colData["alwaysRender"] === true;
2730
2730
  };
2731
2731
 
2732
2732
  /** @public
@@ -4881,25 +4881,35 @@ Core.prototype._dispatchRowExpansionBinding = function (e) {
4881
4881
 
4882
4882
  var fromR = /** @type{number} */(e["fromRowIndex"]);
4883
4883
  var toR = /** @type{number} */(e["toRowIndex"]);
4884
- var parents = dataView.getExpansionParents(fromR, toR);
4885
4884
  var rids = dataView.getVisibleRowIds(true);
4886
4885
  var section = /** @type{ILayoutGrid} */(e["section"]);
4887
4886
 
4888
4887
  e["rowData"] = null;
4889
4888
  e["cell"] = null;
4890
- for (var r = fromR; r < toR; ++r) {
4891
- var parentRid = parents[r];
4889
+ var lastRowIndexChanged = false;
4890
+ for (var r = toR - 1; r >= fromR; --r) {
4891
+ var rowId = dataView.getRowId(r);
4892
+ if(!lastRowIndexChanged) {
4893
+ var reCount = dataView.getRowExpansionCount(rowId);
4894
+ if(reCount > 0){
4895
+ r = r + reCount + 1; // include parent row
4896
+ lastRowIndexChanged = true;
4897
+ continue;
4898
+ }
4899
+ }
4900
+
4892
4901
  var ctxRow = section.getContextRow(r);
4893
- if(parentRid) { // Previous row is the row with expansion
4894
- e["originalRowData"] = dataView.getRowData(parentRid);
4895
- e["originalRowId"] = parentRid;
4902
+ var parentId = dataView.getExpansionParentByRowId(rowId);
4903
+ if(parentId) { // dispatch to render row expansion
4904
+ e["originalRowData"] = dataView.getRowData(parentId);
4905
+ e["originalRowId"] = parentId;
4896
4906
  e["rowExpansion"] = ctxRow["rowExpansion"] = true;
4897
- } else if(ctxRow["rowExpansion"]) {
4907
+ } else if(ctxRow["rowExpansion"] ){ // dispose cases
4898
4908
  e["originalRowData"] = null;
4899
4909
  e["originalRowId"] = null;
4900
4910
  e["rowExpansion"] = ctxRow["rowExpansion"] = false;
4901
- } else {
4902
- continue; // There is no need to dispatch the event for normal row
4911
+ } else { // normal row no need to dispatch
4912
+ continue;
4903
4913
  }
4904
4914
  e["rowId"] = rids[r];
4905
4915
  e["rowIndex"] = r;
@@ -5182,7 +5192,9 @@ Core.prototype._getColumnDef = function (colIndex) {
5182
5192
  }
5183
5193
  return def;
5184
5194
  }
5185
- return {};
5195
+ return {
5196
+ "columnData": {}
5197
+ };
5186
5198
  };
5187
5199
  /** Retrieve 1 or 2 level of nested object definition
5188
5200
  * @private
@@ -18,6 +18,14 @@ declare namespace SortableTitlePlugin {
18
18
  order?: SortableTitlePlugin.SortOrder|null
19
19
  };
20
20
 
21
+ type SortingDefinition = {
22
+ colIndex?: number|null,
23
+ colId?: string|null,
24
+ field?: string|null,
25
+ sortOrder?: SortableTitlePlugin.SortOrder|null,
26
+ order?: SortableTitlePlugin.SortOrder|null
27
+ };
28
+
21
29
  type ColumnOptions = {
22
30
  sortable?: boolean|null,
23
31
  sortBy?: string|null,
@@ -30,7 +38,7 @@ declare namespace SortableTitlePlugin {
30
38
  };
31
39
 
32
40
  type Options = {
33
- initialSort?: (SortableTitlePlugin.InitialSort|(SortableTitlePlugin.InitialSort)[])|null,
41
+ initialSort?: (SortableTitlePlugin.InitialSort|(SortableTitlePlugin.SortingDefinition)[])|null,
34
42
  multicolumn?: (boolean|number)|null,
35
43
  multiColumn?: (boolean|number)|null,
36
44
  threeStatesSorting?: boolean|null,
@@ -79,7 +87,7 @@ declare class SortableTitlePlugin extends EventDispatcher {
79
87
 
80
88
  public getSortedColumnIndex(priority?: number|null): number;
81
89
 
82
- public getSortPriority(colIndex: number): number;
90
+ public getSortPriority(colIndex: number, colRef?: string|null): number;
83
91
 
84
92
  public isColumnSorted(colIndex: number): boolean;
85
93
 
@@ -89,7 +97,7 @@ declare class SortableTitlePlugin extends EventDispatcher {
89
97
 
90
98
  public sortColumn(colRef: number|string|null, sortOrder?: string|null, opt_arg?: any): void;
91
99
 
92
- public sortColumns(sortOptions: (SortableTitlePlugin.InitialSort)[]|null, opt_arg?: any): void;
100
+ public sortColumns(sortOptions: (SortableTitlePlugin.SortingDefinition)[]|null, opt_arg?: any): void;
93
101
 
94
102
  public clearSortState(opt_arg?: any): void;
95
103
 
@@ -113,6 +121,8 @@ declare class SortableTitlePlugin extends EventDispatcher {
113
121
 
114
122
  public getColumnSortingFields(): (string)[];
115
123
 
124
+ public setFirstSortOrder(colIdentifier: string|number|(string|number)[]|null, sortOrder?: string|null): void;
125
+
116
126
  public disableTwoStateSorting(disabled?: boolean|null): void;
117
127
 
118
128
  public freezeIndicator(bool?: boolean|null): void;