@refinitiv-ui/efx-grid 6.0.85 → 6.0.86

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. package/lib/core/dist/core.js +43 -10
  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.js +20 -10
  6. package/lib/grid/index.js +1 -1
  7. package/lib/tr-grid-checkbox/es6/Checkbox.d.ts +2 -0
  8. package/lib/tr-grid-checkbox/es6/Checkbox.js +38 -0
  9. package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +3 -4
  10. package/lib/tr-grid-filter-input/es6/FilterInput.js +1 -1
  11. package/lib/tr-grid-util/es6/Dom.d.ts +1 -1
  12. package/lib/tr-grid-util/es6/Dom.js +1 -1
  13. package/lib/tr-grid-util/es6/ExpressionParser.js +1 -1
  14. package/lib/tr-grid-util/es6/FilterBuilder.d.ts +1 -1
  15. package/lib/tr-grid-util/es6/FilterBuilder.js +1 -1
  16. package/lib/tr-grid-util/es6/PercentBar.d.ts +1 -1
  17. package/lib/tr-grid-util/es6/PercentBar.js +1 -1
  18. package/lib/tr-grid-util/es6/RangeBar.d.ts +1 -1
  19. package/lib/tr-grid-util/es6/RangeBar.js +8 -7
  20. package/lib/tr-grid-util/es6/TextHighlighter.d.ts +0 -2
  21. package/lib/tr-grid-util/es6/TextHighlighter.js +1 -6
  22. package/lib/tr-grid-util/es6/formula/Formula.js +1 -1
  23. package/lib/tr-grid-util/es6/formula/VariableToken.js +1 -1
  24. package/lib/tr-grid-util/es6/formula/functions/Excel.d.ts +1 -1
  25. package/lib/tr-grid-util/es6/formula/functions/Excel.js +1 -1
  26. package/lib/tr-grid-util/es6/index.js +1 -1
  27. package/lib/tr-grid-util/es6/jet/DataGenerator.d.ts +1 -1
  28. package/lib/tr-grid-util/es6/jet/DataGenerator.js +1 -1
  29. package/lib/types/es6/Core/data/DataView.d.ts +4 -0
  30. package/lib/versions.json +4 -4
  31. 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
@@ -574,7 +574,7 @@ Core.prototype._hasPendingRowChange = false;
574
574
  * @return {string}
575
575
  */
576
576
  Core.getVersion = function () {
577
- return "5.1.89";
577
+ return "5.1.90";
578
578
  };
579
579
  /** {@link ElementWrapper#dispose}
580
580
  * @override
@@ -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;
package/lib/grid/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  import {Grid} from "./lib/efx-grid.js";
2
2
  export {Grid}
3
- window.EFX_GRID = { version: "6.0.85" };
3
+ window.EFX_GRID = { version: "6.0.86" };
@@ -76,5 +76,7 @@ declare class CheckboxPlugin extends GridPlugin {
76
76
 
77
77
  declare function val(gridOptions?: any): any;
78
78
 
79
+ declare function newState(sectionRef: any, rowIndex: number, context?: any): void;
80
+
79
81
  export default CheckboxPlugin;
80
82
  export { CheckboxPlugin, CheckboxPlugin as Checkbox, CheckboxPlugin as CheckboxExtension };
@@ -1425,6 +1425,44 @@ CheckboxPlugin.prototype._onCheckboxChanged = function (e, toggling) {
1425
1425
 
1426
1426
  e.stopPropagation();
1427
1427
  };
1428
+
1429
+ /** @public
1430
+ * @description Check/Uncheck a specified row by a simulated mouse click input. This is for testing purpose.
1431
+ * @ignore
1432
+ * @param {Object} sectionRef Grid SectionReference object
1433
+ * @param {number} rowIndex
1434
+ * @param {Object=} context
1435
+ */
1436
+ CheckboxPlugin.prototype.toggleCheckByMouse = function(sectionRef, rowIndex, context) {
1437
+ var eventObj = context || {};
1438
+ eventObj.sectionType = sectionRef;
1439
+ eventObj = this._mockMouseEvent(this._displayColumn, rowIndex, eventObj);
1440
+
1441
+ var checkbox = this.getCheckbox(sectionRef, rowIndex);
1442
+ if(!checkbox) {
1443
+ return;
1444
+ }
1445
+ var curState = CheckboxPlugin._getCheckState(checkbox);
1446
+ CheckboxPlugin._setBooleanProp(checkbox, "checked", curState !== "checked");
1447
+ eventObj.currentTarget = eventObj.target = checkbox;
1448
+
1449
+ this._onCheckboxMousedown(eventObj);
1450
+ this._onCheckboxClicked(eventObj);
1451
+ };
1452
+ /** @public
1453
+ * @description Supply an keyboard input. This is for testing purpose.
1454
+ * @ignore
1455
+ * @param {string} keyName
1456
+ * @param {number} rowIndex
1457
+ * @param {Object} context
1458
+ */
1459
+ CheckboxPlugin.prototype.supplyKey = function(keyName, rowIndex, context) {
1460
+ var checkbox = this.getCheckbox("content", rowIndex);
1461
+ var eventObj = this._mockKeyboardEvent(keyName, context);
1462
+ eventObj.currentTarget = eventObj.target = checkbox;
1463
+ this._onCheckboxKeydown(eventObj);
1464
+ };
1465
+
1428
1466
  /** @private
1429
1467
  * @param {Event} e
1430
1468
  */
@@ -161,9 +161,7 @@ ColumnGroupingPlugin._toGroupDefinition = function (obj, groupId) {
161
161
  */
162
162
  ColumnGroupingPlugin._cloneObject = function (obj) {
163
163
  var newObj = cloneObject(obj);
164
- if (Array.isArray(newObj.children)) {
165
- newObj.children = newObj.children;
166
- } else {
164
+ if (!Array.isArray(newObj.children)) {
167
165
  newObj.children = [];
168
166
  }
169
167
  return newObj;
@@ -548,7 +546,8 @@ ColumnGroupingPlugin.prototype._evaluateGroupStructure = function () {
548
546
  this._maxDepth = maxDepth + 1; // Column header depth = maximum group depth + 1
549
547
  };
550
548
 
551
- /** @private Add pinning state to group definition for further verification.
549
+ /** Add pinning state to group definition for further verification.
550
+ * @private
552
551
  * @param {Object} groupDef
553
552
  * @param {string} side
554
553
  */
@@ -748,7 +748,7 @@ FilterInputPlugin.prototype.updateUI = function (colIndex, text) {
748
748
  };
749
749
  /** @private
750
750
  * @param {number} colIndex
751
- * @param {string} text
751
+ * @param {string|number} text
752
752
  * @param {Object=} textMap
753
753
  * @return {Object} Column option
754
754
  */
@@ -6,7 +6,7 @@ declare namespace Dom {
6
6
 
7
7
  function div(className?: string|null): Element;
8
8
 
9
- function text(textContent?: string|null, className?: string|null): Element;
9
+ function text(textContent?: (string|number)|null, className?: string|null): Element;
10
10
 
11
11
  function appendChild(parentElem: Element|null, children: Node|any[]|null): Element|null;
12
12
 
@@ -27,7 +27,7 @@ Dom.div = function(className) {
27
27
  /** Shorthand for creating a span element with textContent
28
28
  * @public
29
29
  * @function
30
- * @param {string=} textContent
30
+ * @param {(string|number)=} textContent
31
31
  * @param {string=} className
32
32
  * @return {!Element}
33
33
  */
@@ -42,7 +42,7 @@ var OperatorFunctions = {
42
42
  "!": function(lhs, rhs){ return !lhs; },
43
43
  "!!": function(lhs, rhs){ return !!lhs; }
44
44
  };
45
- /** @type {Object.<string, Function>}
45
+ /** @type {Object.<string, number>}
46
46
  * @private
47
47
  * @const
48
48
  */
@@ -32,7 +32,7 @@ declare class FilterBuilder {
32
32
 
33
33
  public setDataAccessors(rawDataAccessor?: ((...params: any[]) => any)|null, formattedDataAccessor?: ((...params: any[]) => any)|null): void;
34
34
 
35
- public addCondition(oper: string, value: string|number|Date|null, connector?: string|null, useUTCTime?: boolean|null): boolean;
35
+ public addCondition(oper: string, value: string|number|boolean|Date|null, connector?: string|null, useUTCTime?: boolean|null): boolean;
36
36
 
37
37
  public addConditions(conditions: FilterBuilder.Conditions|null): number;
38
38
 
@@ -375,7 +375,7 @@ FilterBuilder.prototype.setDataAccessors = function(rawDataAccessor, formattedDa
375
375
  };
376
376
  /** @public
377
377
  * @param {string} oper Operator id (e.g., "GT", "CONT", "EQ")
378
- * @param {string|number|Date} value If date type operator is specified, this should be accompanied with useUTCTime flag to indicate whether local or UTC time to be used.
378
+ * @param {string|number|boolean|Date} value If date type operator is specified, this should be accompanied with useUTCTime flag to indicate whether local or UTC time to be used.
379
379
  * @param {string=} connector Possible values are "OR" and "AND"
380
380
  * @param {boolean=} useUTCTime If the value is not specified, the default setting will be used
381
381
  * @return {boolean} Return true, if the new condition is added
@@ -37,7 +37,7 @@ declare class PercentBar {
37
37
 
38
38
  public hideZeroValue(hidden?: boolean|null): boolean;
39
39
 
40
- public setText(txt: string): void;
40
+ public setText(txt: string|number|null): void;
41
41
 
42
42
  public hideText(hidden?: boolean|null): boolean;
43
43
 
@@ -318,7 +318,7 @@ PercentBar.prototype.hideZeroValue = function (hidden) {
318
318
  };
319
319
 
320
320
  /** @public
321
- * @param {string} txt
321
+ * @param {string|number} txt
322
322
  */
323
323
  PercentBar.prototype.setText = function (txt) {
324
324
  if(!this._invalid) {
@@ -23,7 +23,7 @@ declare class RangeBar {
23
23
 
24
24
  public setPercent(percent?: number|null): void;
25
25
 
26
- public isPercentNaN(): boolean;
26
+ public isValid(): boolean;
27
27
 
28
28
  public isInvalid(): boolean;
29
29
 
@@ -137,7 +137,7 @@ RangeBar.prototype.setStyles = function(obj) {
137
137
  }
138
138
  }
139
139
 
140
- if(!this.isPercentNaN()) {
140
+ if(!this.isValid()) {
141
141
  this._elem.style.backgroundColor = this._styles["trackColor"];
142
142
  }
143
143
  if(this._styles["fontColor"] != null) {
@@ -185,7 +185,7 @@ RangeBar.prototype.getPercent = function() {
185
185
  RangeBar.prototype.setPercent = function(percent) {
186
186
  percent = RangeBar._limitPercent(percent);
187
187
  if(this._percent !== percent) {
188
- if(this._percent === this._percent || percent === percent) { // Prevent unnecessary update by checking NaN
188
+ if(this.isValid() || percent === percent) { // Prevent unnecessary update by checking NaN
189
189
  this._percent = percent;
190
190
  this._updateUI();
191
191
  }
@@ -226,20 +226,21 @@ RangeBar._limitPercent = function(percent) {
226
226
  /** @public
227
227
  * @return {boolean}
228
228
  */
229
- RangeBar.prototype.isPercentNaN = function() {
229
+ RangeBar.prototype.isValid = function() {
230
230
  return this._percent === this._percent;
231
231
  };
232
232
 
233
- /** Alias to {@link RangeBar#isPercentNaN}
234
- * @public
233
+ /** @public
235
234
  * @function
236
235
  * @return {boolean}
237
236
  */
238
- RangeBar.prototype.isInvalid = RangeBar.prototype.isPercentNaN;
237
+ RangeBar.prototype.isInvalid = function() {
238
+ return !this.isValid();
239
+ };
239
240
 
240
241
  /** @private */
241
242
  RangeBar.prototype._updateUI = function() {
242
- if(this.isPercentNaN()) {
243
+ if(this.isValid()) {
243
244
  var percent = ((this._percent * 10000) | 0) / 10000; // rounding number
244
245
  this._slider.style.left = "calc(" +
245
246
  (percent * 100) +
@@ -6,8 +6,6 @@ declare namespace TextHighlighter {
6
6
 
7
7
  const spaces: RegExp|null;
8
8
 
9
- const spaceTrimer: RegExp|null;
10
-
11
9
  const defaultTag: string;
12
10
 
13
11
  }
@@ -12,11 +12,6 @@ TextHighlighter.invalidChars = /[^\w-_ .]+/g;
12
12
  * @public
13
13
  */
14
14
  TextHighlighter.spaces = /\s+/;
15
- /** /^\s+|\s+$/g
16
- * @type {RegExp}
17
- * @public
18
- */
19
- TextHighlighter.spaceTrimer = /^\s+|\s+$/g;
20
15
  /** Default is &lt;mark> tag
21
16
  * @type {string}
22
17
  * @public
@@ -256,7 +251,7 @@ TextHighlighter.buildRule = function(txt, caseSensitive) {
256
251
 
257
252
  if(txt) {
258
253
  txt = txt.replace(TextHighlighter.invalidChars, " ");
259
- txt = txt.replace(TextHighlighter.spaceTrimer, "");
254
+ txt = txt.trim();
260
255
  }
261
256
  if(!txt) {
262
257
  return null;
@@ -613,7 +613,7 @@ Formula.prototype._parse = function(exp) {
613
613
  if(exp.charAt(0) === "=") { // Remove the first equal sign
614
614
  exp = exp.substr(1);
615
615
  }
616
- exp = exp.replace(/^\s+|\s+$/gm, ""); // Trim white spaces -- equivalent to String.trim(), which is not support in IE8
616
+ exp = exp.trim();
617
617
  exp = exp.replace(/<>/g, "!=");
618
618
  exp = exp.replace(/‛|‘|’/g, "'"); // Left and right single quote will be converted to simple single quote
619
619
  exp = exp.replace(/‟|“|”/g, '"'); // Left and right double quote will be converted to simple double quote
@@ -4,7 +4,7 @@
4
4
  * @param {number=} index
5
5
  */
6
6
  var VariableToken = function(str, index) {
7
- str = str.replace(/^\s+|\s+$/gm, ""); // Trim white spaces -- equivalent to String.trim(), which is not support in IE8
7
+ str = str.trim();
8
8
 
9
9
  if(this._inputConverter[str]) {
10
10
  str = this._inputConverter[str];
@@ -5,4 +5,4 @@ declare namespace Excel {
5
5
  }
6
6
 
7
7
  export default Excel;
8
- export { Excel }; ("Excel", Excel);
8
+ export { Excel };
@@ -18,4 +18,4 @@ Excel["REFERENCEDATA"] = function(/* ... args*/) {};
18
18
  Excel["SETCOLUMNCOLOR"] = function(/* ... args*/) {};
19
19
 
20
20
  export default Excel;
21
- export { Excel }; ("Excel", Excel);
21
+ export { Excel };
@@ -50,7 +50,7 @@ tr.Conflator = Conflator;
50
50
  tr.Perf = Perf;
51
51
  tr.NumberFormatter = NumberFormatter;
52
52
  tr.FieldFormatter = FieldFormatter;
53
- tr.DateTime = tr.DateTime;
53
+ tr.DateTime = DateTime;
54
54
  tr.FilterBuilder = FilterBuilder;
55
55
  tr.FilterOperators = FilterOperators;
56
56
  tr.PercentBar = PercentBar;
@@ -102,7 +102,7 @@ declare function randDate(min?: (number|any)|null, max?: (number|any)|null, seed
102
102
 
103
103
  declare function randString(min?: number|null, max?: number|null, seed?: number|null): string;
104
104
 
105
- declare function toRecords(data2D: (any[])[]|null, fields?: (string)[]|null): (any)[]|null;
105
+ declare function toRecords(data2D: (any[])[]|null, fields?: (string|number)[]|null): (any)[]|null;
106
106
 
107
107
  declare function getSeed(): number;
108
108
 
@@ -277,7 +277,7 @@ var randString = function(min, max, seed) {
277
277
  /** Convert 2D Array to Array of records
278
278
  * @public
279
279
  * @param {Array.<Array>} data2D Array of values
280
- * @param {Array.<string>=} fields Keys to be mapped on the output records.
280
+ * @param {Array.<string|number>=} fields Keys to be mapped on the output records.
281
281
  * @return {Array.<Object>} records
282
282
  */
283
283
  var toRecords = function(data2D, fields) {
@@ -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;
package/lib/versions.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "tr-grid-util": "1.3.137",
2
+ "tr-grid-util": "1.3.139",
3
3
  "tr-grid-printer": "1.0.17",
4
4
  "@grid/column-dragging": "1.0.16",
5
5
  "@grid/row-segmenting": "1.0.30",
@@ -7,17 +7,17 @@
7
7
  "@grid/zoom": "1.0.11",
8
8
  "tr-grid-auto-tooltip": "1.1.6",
9
9
  "tr-grid-cell-selection": "1.0.35",
10
- "tr-grid-checkbox": "1.0.64",
10
+ "tr-grid-checkbox": "1.0.65",
11
11
  "tr-grid-column-fitter": "1.0.40",
12
12
  "tr-grid-column-formatting": "0.9.35",
13
- "tr-grid-column-grouping": "1.0.57",
13
+ "tr-grid-column-grouping": "1.0.58",
14
14
  "tr-grid-column-resizing": "1.0.28",
15
15
  "tr-grid-column-selection": "1.0.33",
16
16
  "tr-grid-column-stack": "1.0.74",
17
17
  "tr-grid-conditional-coloring": "1.0.69",
18
18
  "tr-grid-content-wrap": "1.0.20",
19
19
  "tr-grid-contextmenu": "1.0.41",
20
- "tr-grid-filter-input": "0.9.38",
20
+ "tr-grid-filter-input": "0.9.39",
21
21
  "tr-grid-heat-map": "1.0.29",
22
22
  "tr-grid-in-cell-editing": "1.0.81",
23
23
  "tr-grid-pagination": "1.0.24",
package/package.json CHANGED
@@ -66,5 +66,5 @@
66
66
  "publishConfig": {
67
67
  "access": "public"
68
68
  },
69
- "version": "6.0.85"
69
+ "version": "6.0.86"
70
70
  }