@refinitiv-ui/efx-grid 6.0.57 → 6.0.58

Sign up to get free protection for your applications and to get access to all the features.
@@ -613,6 +613,14 @@ Grid.prototype.dispose = function() {
613
613
  this._grid.dispose();
614
614
  this._connector.reset();
615
615
 
616
+ if(!this._sharedDataSource) { // make sure that it is the final grid, and that it will be dispose data
617
+ if(this._dt) {
618
+ this._dt.dispose();
619
+ }
620
+ if(this._dv) {
621
+ this._dv.dispose();
622
+ }
623
+ }
616
624
  this._mainGrid = this._dt = this._dv = null;
617
625
 
618
626
  if(this._subs) {
@@ -10,7 +10,7 @@ declare namespace TextFormattingPlugin {
10
10
  formatType?: string|null,
11
11
  type?: string|null,
12
12
  field?: string|null,
13
- decimalPlaces?: number|null,
13
+ decimalPlaces?: (number|boolean)|null,
14
14
  precisionEnabled?: boolean|null,
15
15
  plusSign?: boolean|null,
16
16
  separator?: boolean|null,
@@ -9,9 +9,9 @@ import { DateTime } from '../../tr-grid-util/es6/DateTime.js';
9
9
  * @description Fired only when a user click OK from the format dialog, that is generated from this extension
10
10
  * @type {Object}
11
11
  * @property {number} colIndex
12
- * @property {string} formatType Available options are: number, scaled, percent, date, time and datetime
12
+ * @property {string} formatType Available options are: number, scaled, percent, and datetime
13
13
  * @property {string} field Field defined in the column
14
- * @property {number=} decimalPlaces=2
14
+ * @property {(number|boolean)=} decimalPlaces=2
15
15
  * @property {boolean=} plusSign
16
16
  * @property {boolean=} separator
17
17
  * @property {boolean=} percentSign
@@ -26,7 +26,7 @@ import { DateTime } from '../../tr-grid-util/es6/DateTime.js';
26
26
  * @property {string=} formatType Available options are: number, scaled, percent, and datetime
27
27
  * @property {string=} type Alias to formatType
28
28
  * @property {string=} field Field is required but can be defined in the column definition object
29
- * @property {number=} decimalPlaces=2
29
+ * @property {(number|boolean)=} decimalPlaces=2
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
@@ -34,8 +34,8 @@ import { DateTime } from '../../tr-grid-util/es6/DateTime.js';
34
34
  * @property {string=} scalingUnit Value can be million or billion
35
35
  * @property {boolean=} multiplyBy100=false
36
36
  * @property {boolean=} mutiplyBy100=false Alias of multiplyBy100
37
- * @property {string=} dateTimeFormat
38
- * @property {boolean=} useUTCTime
37
+ * @property {string=} dateTimeFormat="MM/DD/YYYY"
38
+ * @property {boolean=} useUTCTime=true
39
39
  * @property {boolean=} autoTextFormatting=true If disabled, the extension's automatic formatting will not be triggered, including `formatLogic`
40
40
  * @property {Function=} formatLogic=null If specified all default formatting will be prevented and replaced by the given function. This should be used when the column has custom rendering. The function must retrieve, format, and insert the data with the provided arguments (i.e., TextFormattingPlugin~FormatLogicArguments).
41
41
  */
@@ -306,6 +306,30 @@ TextFormattingPlugin.prototype._setColumnFormat = function (colIndex, userObj) {
306
306
  var ff = new FieldFormatter(fo); // FieldFormatter will be used for rendering
307
307
  var nf = null;
308
308
  if (fot == "number" || fot == "scaled" || fot == "percent") {
309
+ var precision = fo["decimalPlaces"];
310
+ var precisionEnabled = fo["precisionEnabled"];
311
+ if (typeof precision == "number") {
312
+ colData["precision"] = precision;
313
+ if (precisionEnabled == null) {
314
+ precisionEnabled = true;
315
+ }
316
+ } else if (precision == true) {
317
+ colData["precision"] = null;
318
+ precision = 2;
319
+ precisionEnabled = true;
320
+ } else if (precision === false) {
321
+ colData["precision"] = null;
322
+ precision = 0;
323
+ precisionEnabled = false;
324
+ } else {
325
+ colData["precision"] = null;
326
+ precision = 2;
327
+ if (precisionEnabled == null) {
328
+ precisionEnabled = true;
329
+ }
330
+ }
331
+ fo["decimalPlaces"] = precision;
332
+ fo["precisionEnabled"] = precisionEnabled;
309
333
  nf = new NumberFormatter(fo);
310
334
  ff.setNumberFormatter(nf.format);
311
335
  }
@@ -341,6 +365,12 @@ TextFormattingPlugin.prototype.getColumnFormatOptions = function (colIndex, opti
341
365
  }
342
366
  if (numberFormatter) {
343
367
  numberFormatter.getOptions(options);
368
+ var precision = colData["precision"];
369
+ if (precision != null) {
370
+ options["decimalPlaces"] = precision;
371
+ } else {
372
+ delete options["decimalPlaces"];
373
+ }
344
374
  }
345
375
  }
346
376
  return options;
@@ -6,6 +6,8 @@ declare class TrackLayout {
6
6
 
7
7
  public hitTest(val: number): number;
8
8
 
9
+ public dispose(): void;
10
+
9
11
  public isAtDefaultSize(opt_index?: number|null): boolean;
10
12
 
11
13
  public isHomogeneous(): boolean;
package/lib/versions.json CHANGED
@@ -28,7 +28,7 @@
28
28
  "tr-grid-row-grouping": "1.0.81",
29
29
  "tr-grid-row-selection": "1.0.23",
30
30
  "tr-grid-rowcoloring": "1.0.23",
31
- "tr-grid-textformatting": "1.0.45",
31
+ "tr-grid-textformatting": "1.0.46",
32
32
  "tr-grid-titlewrap": "1.0.19",
33
33
  "@grid/formatters": "1.0.50",
34
34
  "@grid/column-selection-dialog": "4.0.52",
package/package.json CHANGED
@@ -66,5 +66,5 @@
66
66
  "publishConfig": {
67
67
  "access": "public"
68
68
  },
69
- "version": "6.0.57"
69
+ "version": "6.0.58"
70
70
  }