@refinitiv-ui/efx-grid 6.0.84 → 6.0.85

Sign up to get free protection for your applications and to get access to all the features.
@@ -1001,8 +1001,7 @@ ColumnDefinition.prototype._setField = function(field, columnOption) {
1001
1001
  if(!field) {
1002
1002
  field = "";
1003
1003
  }
1004
- // Trim white spaces -- equivalent to String.trim(), which is not support in IE8
1005
- field = field.replace(/^\s+|\s+$/gm, "");
1004
+ field = field.trim();
1006
1005
 
1007
1006
  var formulaStr = columnOption ? columnOption["formula"] : "";
1008
1007
  if(this._fnEngine) {
@@ -65,10 +65,10 @@ import { ElementWrapper } from "../../core/es6/grid/components/ElementWrapper.js
65
65
  * @property {boolean=} columnVirtualization=false If enabled, all columns will be rendered. This will greatly impact grid's performance if the column set is huge.
66
66
  * @property {(number|null|boolean)=} topFreezingCount=null If number >= 0 will fix number of frozen title section, If false = disabled scrollbar, if null then title section will freeze auto when new section added, this option will not work with scrollbar option.
67
67
  * @property {(number|null)=} bottomFreezingCount=null If number >= 0 will fix nuber of frozen footer section, if null then footer section will freeze auto when new section added, this option will not work with scrollbar option.
68
- * @property {boolean=} borders=true Lines around grid element
69
- * @property {boolean=} gridlines=true Horizontal and Vertical lines for ONLY content sections
70
- * @property {boolean=} verticalLines=true Vertical lines for all sections
71
- * @property {boolean=} contentVerticalLines=true Vertical lines for all content section
68
+ * @property {boolean=} borders=false Lines around grid element
69
+ * @property {boolean=} gridlines Horizontal and Vertical lines for ONLY content sections
70
+ * @property {boolean=} verticalLines=false Vertical lines for all sections
71
+ * @property {boolean=} contentVerticalLines=false Vertical lines for all content section
72
72
  * @property {boolean=} horizontalLines=true Horizontal lines for all sections
73
73
  * @property {*=} RTK=null rtk toolkit instance
74
74
  * @property {Grid~ADCOptions=} ADC=null ADC requesting level config object from adc team
@@ -1778,7 +1778,7 @@ Grid.prototype.restoreColumns = function(columns, byId) {
1778
1778
  }
1779
1779
  }
1780
1780
  if (!found) {
1781
- removingFields.push(previousColumns[i].field);
1781
+ removingFields.push(i);
1782
1782
  }
1783
1783
  }
1784
1784
 
@@ -1794,7 +1794,7 @@ Grid.prototype.restoreColumns = function(columns, byId) {
1794
1794
  for (j = 0; j < keepingLen; j++) { // loop only keeping column
1795
1795
  if(compareLogic(columns[i], keepingColumns[j])) {
1796
1796
  found = true;
1797
- var colIndex = this.getColumnIndex(columns[i].field); // We cannot use 'i' (colIndex) in this case, as it will sort the columns. Instead, we need to obtain a new column index from the field.
1797
+ var colIndex = this.getColumnIndex(columns[i].id || columns[i].field); // We cannot use 'i' (colIndex) in this case, as it will sort the columns. Instead, we need to obtain a new column index from the field.
1798
1798
  columnOrdering.push(this.getColumnId(colIndex));
1799
1799
  break;
1800
1800
  }
@@ -3090,8 +3090,8 @@ Grid.prototype._getRowId = function(rowRef) {
3090
3090
  */
3091
3091
  Grid.prototype.getColumnIndex = function(colRef) {
3092
3092
  if(colRef) {
3093
- var colCount = this.getColumnCount();
3094
3093
  if(colRef instanceof ColumnDefinition) {
3094
+ var colCount = this.getColumnCount();
3095
3095
  for(var i = 0; i < colCount; ++i) {
3096
3096
  var colDef = this.getColumnDefinition(i);
3097
3097
  if(colDef === colRef) {
@@ -852,10 +852,11 @@ FilterInputPlugin.prototype.setInputValue = function (colIndex, value) {
852
852
  var colOpt = this._getExtColumnOption(colIndex);
853
853
 
854
854
  var type = colOpt.type ? colOpt.type.toLowerCase() : "";
855
+ var dateValue;
855
856
 
856
857
  if (type == "date") {
857
858
  var dateObj = ElfDate.from(value);
858
- value = dateObj ? dateObj.toDateString().substr(4) : "";
859
+ dateValue = dateObj ? dateObj.toDateString().substr(4) : "";
859
860
  }
860
861
 
861
862
  if (type == "multiselect") {
@@ -866,9 +867,37 @@ FilterInputPlugin.prototype.setInputValue = function (colIndex, value) {
866
867
  this.filterColumn(colIndex, "", textMap);
867
868
  } else {
868
869
  inputElem.value = value;
869
- this.filterColumn(colIndex, value);
870
+ this.filterColumn(colIndex, type == "date" ? dateValue : value);
870
871
  }
871
872
  };
873
+ /** @public
874
+ * @ignore
875
+ * @param {number} colIndex
876
+ * @return {Object}
877
+ */
878
+
879
+
880
+ FilterInputPlugin.prototype.getColumnFilter = function (colIndex) {
881
+ var proc = this._filterProc;
882
+
883
+ if (proc) {
884
+ return proc.getColumnFilterState(colIndex);
885
+ }
886
+
887
+ return null;
888
+ };
889
+ /** @public
890
+ * @ignore
891
+ * @param {number} colIndex
892
+ * @return {Function}
893
+ */
894
+
895
+
896
+ FilterInputPlugin.prototype.getFilterLogic = function (colIndex) {
897
+ var option = this._getExtColumnOption(colIndex);
898
+
899
+ return option._comparingLogic;
900
+ };
872
901
  /** Force filtering for every column
873
902
  * @public
874
903
  * @param {number=} delayMs=0 Set delay in millisecond to avoid repeatedly filtering
@@ -45,7 +45,10 @@ declare namespace RowFilteringPlugin {
45
45
  click?: ((...params: any[]) => any)|null,
46
46
  clicked?: ((...params: any[]) => any)|null,
47
47
  iconCreated?: ((...params: any[]) => any)|null,
48
- filterChanged?: ((...params: any[]) => any)|null
48
+ filterChanged?: ((...params: any[]) => any)|null,
49
+ beforeDialogOpened?: ((...params: any[]) => any)|null,
50
+ dialogCommitted?: ((...params: any[]) => any)|null,
51
+ refreshed?: ((...params: any[]) => any)|null
49
52
  };
50
53
 
51
54
  }
@@ -102,6 +102,9 @@ The expression can take various forms:<br>
102
102
  * @property {Function=} clicked=null Alias to `click` event handler
103
103
  * @property {Function=} iconCreated=null Event handler dispatched when a new column filter icon is created.
104
104
  * @property {Function=} filterChanged=null Event handler dispatched whenever global or column filter is changed by either adding or removing.
105
+ * @property {Function=} beforeDialogOpened=null Event handler dispatched before dialog opening.
106
+ * @property {Function=} dialogCommitted=null Event handler dispatched whenever the new settings from dialog are applied.
107
+ * @property {Function=} refreshed=null Event handler dispatched after new filter is applied to grid's data view.
105
108
  */
106
109
 
107
110
  /** @private
@@ -30,8 +30,8 @@ import { DateTime } from '../../tr-grid-util/es6/DateTime.js';
30
30
  * @property {boolean=} precisionEnabled=true If disabled, number of decimal will remain as original.
31
31
  * @property {boolean=} plusSign=false
32
32
  * @property {boolean=} separator=false Thousands separators
33
- * @property {boolean=} percentSign=false
34
- * @property {string=} scalingUnit Value can be million or billion
33
+ * @property {boolean=} percentSign=false If the formatType is percent and the value of percentSign is not specified, the percentSign is set to true by default
34
+ * @property {string=} scalingUnit=million Value can be million or billion
35
35
  * @property {boolean=} multiplyBy100=false
36
36
  * @property {boolean=} mutiplyBy100=false Alias of multiplyBy100
37
37
  * @property {string=} dateTimeFormat="MM/DD/YYYY"
@@ -328,6 +328,14 @@ TextFormattingPlugin.prototype._setColumnFormat = function (colIndex, userObj) {
328
328
  }
329
329
  fo["decimalPlaces"] = precision;
330
330
  fo["precisionEnabled"] = precisionEnabled;
331
+ if (fot === "percent") {
332
+ var percentSign = fo["percentSign"];
333
+ if (percentSign == null) {
334
+ fo["percentSign"] = true;
335
+ } else {
336
+ colData["percentSign"] = percentSign;
337
+ }
338
+ }
331
339
  nf = new NumberFormatter(fo);
332
340
  ff.setNumberFormatter(nf.format);
333
341
  }
@@ -369,6 +377,9 @@ TextFormattingPlugin.prototype.getColumnFormatOptions = function (colIndex, opti
369
377
  } else {
370
378
  delete options["decimalPlaces"];
371
379
  }
380
+ if (options["formatType"] === "percent" && colData["percentSign"] != null) {
381
+ options["percentSign"] = colData["percentSign"];
382
+ }
372
383
  }
373
384
  }
374
385
  return options;
@@ -27,6 +27,8 @@ const DATE_TIME_TYPE = {
27
27
  "TIME-DATE": true
28
28
  };
29
29
 
30
+ const DEFAULT_DATE_TIME_FORMAT = "MM/DD/YYYY";
31
+
30
32
  /* eslint-enaable */
31
33
 
32
34
  /** @public
@@ -189,7 +191,7 @@ FieldFormatter.prototype.getOptions = function(options) { // serialize
189
191
  options["field"] = this._field;
190
192
  options["formatType"] = this._userFormatType ? this._userFormatType : this._formatType; // WARNING: Beware of case sensitivity
191
193
  if(toDateTimeType(options["formatType"]) == DATE_TIME){
192
- if(this._dateTimeFormat !== "") {
194
+ if(this._dateTimeFormat && this._dateTimeFormat !== DEFAULT_DATE_TIME_FORMAT) {
193
195
  options["dateTimeFormat"] = this._dateTimeFormat;
194
196
  }
195
197
  if(this._timeZone !== "GMT") {
@@ -391,7 +393,7 @@ FieldFormatter.prototype._formatDateTime = function(val, rowData) {
391
393
  }
392
394
  val = new Date(sec * 1000); // Convert real-time raw data (second) to millisecond
393
395
  }
394
- return this._df(val, this._dateTimeFormat || "MM/DD/YYYY", this._timeZone);
396
+ return this._df(val, this._dateTimeFormat || DEFAULT_DATE_TIME_FORMAT, this._timeZone);
395
397
  };
396
398
  /** @private
397
399
  * @param {number|string|Date} val
@@ -161,7 +161,7 @@ NumberFormatter.prototype.init = function(options) { // deserialize
161
161
  if(val != null && val !== "") {
162
162
  this._percentSignEnabled = val ? true : false;
163
163
  } else {
164
- this._percentSignEnabled = true;
164
+ this._percentSignEnabled = false;
165
165
  }
166
166
 
167
167
  val = options["multiplyBy100"];
@@ -267,7 +267,7 @@ NumberFormatter.prototype.getOptions = function(options) { // serialize
267
267
  }
268
268
 
269
269
  if(formatType === "percent") {
270
- if(this._percentSignEnabled !== true) {
270
+ if(this._percentSignEnabled !== false) {
271
271
  options["percentSign"] = this._percentSignEnabled;
272
272
  }
273
273
  if(this._multiplyBy100Enabled !== false) {
@@ -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;
@@ -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;
@@ -45,7 +45,10 @@ declare namespace RowFilteringPlugin {
45
45
  click?: ((...params: any[]) => any)|null,
46
46
  clicked?: ((...params: any[]) => any)|null,
47
47
  iconCreated?: ((...params: any[]) => any)|null,
48
- filterChanged?: ((...params: any[]) => any)|null
48
+ filterChanged?: ((...params: any[]) => any)|null,
49
+ beforeDialogOpened?: ((...params: any[]) => any)|null,
50
+ dialogCommitted?: ((...params: any[]) => any)|null,
51
+ refreshed?: ((...params: any[]) => any)|null
49
52
  };
50
53
 
51
54
  }
package/lib/versions.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "tr-grid-util": "1.3.136",
2
+ "tr-grid-util": "1.3.137",
3
3
  "tr-grid-printer": "1.0.17",
4
4
  "@grid/column-dragging": "1.0.16",
5
5
  "@grid/row-segmenting": "1.0.30",
@@ -17,18 +17,18 @@
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.37",
20
+ "tr-grid-filter-input": "0.9.38",
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",
24
24
  "tr-grid-percent-bar": "1.0.22",
25
25
  "tr-grid-range-bar": "2.0.6",
26
26
  "tr-grid-row-dragging": "1.0.31",
27
- "tr-grid-row-filtering": "1.0.67",
27
+ "tr-grid-row-filtering": "1.0.68",
28
28
  "tr-grid-row-grouping": "1.0.86",
29
29
  "tr-grid-row-selection": "1.0.27",
30
30
  "tr-grid-rowcoloring": "1.0.25",
31
- "tr-grid-textformatting": "1.0.47",
31
+ "tr-grid-textformatting": "1.0.48",
32
32
  "tr-grid-titlewrap": "1.0.21",
33
33
  "@grid/formatters": "1.0.51",
34
34
  "@grid/column-selection-dialog": "4.0.56",
package/package.json CHANGED
@@ -66,5 +66,5 @@
66
66
  "publishConfig": {
67
67
  "access": "public"
68
68
  },
69
- "version": "6.0.84"
69
+ "version": "6.0.85"
70
70
  }