@refinitiv-ui/efx-grid 6.0.38 → 6.0.39

Sign up to get free protection for your applications and to get access to all the features.
@@ -554,7 +554,7 @@ Core.prototype._batches = null;
554
554
  * @return {string}
555
555
  */
556
556
  Core.getVersion = function () {
557
- return "5.1.52";
557
+ return "5.1.55";
558
558
  };
559
559
  /** {@link ElementWrapper#dispose}
560
560
  * @override
@@ -2933,7 +2933,7 @@ Core.prototype.freezeColumn = function (frozenColIndex, numRightColumn) {
2933
2933
  }
2934
2934
  if(numRightColumn != null) {
2935
2935
  rightPinnedCount = numRightColumn > 0 ? numRightColumn : 0;
2936
- if (this._pinnedLeftColumnCount !== rightPinnedCount) {
2936
+ if (this._pinnedRightColumnCount !== rightPinnedCount) {
2937
2937
  dirty = true;
2938
2938
  this._pinnedRightColumnCount = rightPinnedCount; // This variable is used for caching
2939
2939
  }
@@ -3939,7 +3939,7 @@ Core.prototype.getHorizontalLayout = function () {
3939
3939
  * @ignore
3940
3940
  * @param {number} colIndex
3941
3941
  * @param {boolean} bool
3942
- * @param {number} flag Default is 0
3942
+ * @param {number} flag
3943
3943
  * @return {boolean}
3944
3944
  */
3945
3945
  Core.prototype.setColumnVisibility = function (colIndex, bool, flag) {
@@ -3959,6 +3959,16 @@ Core.prototype.setColumnVisibility = function (colIndex, bool, flag) {
3959
3959
  }
3960
3960
  return false;
3961
3961
  };
3962
+ /** Get visibility state for the specified flag. This is for internal use only
3963
+ * @public
3964
+ * @ignore
3965
+ * @param {number} colIndex
3966
+ * @param {number=} flag
3967
+ * @return {boolean}
3968
+ */
3969
+ Core.prototype.getColumnVisibility = function (colIndex, flag) {
3970
+ return this._layoutX.getLaneVisibilityBit(colIndex, flag);
3971
+ };
3962
3972
 
3963
3973
  /** @public
3964
3974
  * @param {number} size
@@ -12,6 +12,7 @@ declare namespace SortableTitlePlugin {
12
12
 
13
13
  type InitialSort = {
14
14
  colIndex: number,
15
+ field: string,
15
16
  sortOrder?: SortableTitlePlugin.SortOrder|null,
16
17
  order?: SortableTitlePlugin.SortOrder|null
17
18
  };
@@ -19,6 +20,8 @@ declare namespace SortableTitlePlugin {
19
20
  type ColumnOptions = {
20
21
  sortable?: boolean|null,
21
22
  sortBy?: string|null,
23
+ sort?: string|null,
24
+ sortOrder?: string|null,
22
25
  sortLogic?: DataTable.SortLogic|null,
23
26
  sortingLogic?: DataTable.SortLogic|null,
24
27
  sorter?: DataTable.SortLogic|null,
@@ -82,6 +82,7 @@ Ext.inherits(SortableTitlePlugin, EventDispatcher);
82
82
  /** The sorting object which will be used for initialSort config.
83
83
  * @typedef {Object} SortableTitlePlugin~InitialSort
84
84
  * @property {number} colIndex Index of the column
85
+ * @property {string} field field of the column
85
86
  * @property {SortableTitlePlugin~SortOrder=} sortOrder=null Set to "d" for descending order and "a" for ascending order
86
87
  * @property {SortableTitlePlugin~SortOrder=} order Alias of sortOrder
87
88
  */
@@ -91,6 +92,8 @@ SortableTitlePlugin.InitialSort;
91
92
  * @typedef {Object} SortableTitlePlugin~ColumnOptions
92
93
  * @property {boolean=} sortable=false If enable, the column can be sorted by user click
93
94
  * @property {string=} sortBy Field to be used for sorting. If defined, user can click at the header section to sort the column
95
+ * @property {string=} sort="" Deprecated Alias to `sortOrder`
96
+ * @property {string=} sortOrder="" The column can be sorted in ascending and descending order by specifying the order "a", "d". This option will sort the column when it is initialized or inserted at runtime.
94
97
  * @property {DataTable.SortLogic=} sortLogic=null Custom compare function for sorting
95
98
  * @property {DataTable.SortLogic=} sortingLogic Alias to `sortLogic`
96
99
  * @property {DataTable.SortLogic=} sorter Alias to `sortLogic`
@@ -295,7 +298,7 @@ SortableTitlePlugin.prototype.afterInit = function () {
295
298
  // Set logic to the data source, since the data source not available during the initialization
296
299
  t.setSortLogics(t._sortLogic);
297
300
 
298
- var userInput = t._initialSort;
301
+ var userInput = t._initialSort; // This will be passed from the user when they want to start with initialize sort
299
302
  if (userInput != null) {
300
303
  if(Array.isArray(userInput)) {
301
304
  if(t._maxCount === 1) { // TODO: max count could be part of sortColumns method
@@ -444,14 +447,32 @@ SortableTitlePlugin.prototype.getConfigObject = function (gridOptions) {
444
447
 
445
448
  if (!host) return obj;
446
449
 
447
- var len = host.getColumnCount();
448
- var col, opt, field;
449
- for(var i = 0; i < len; ++i) {
450
+ var sortedColumns = this.getSortedColumns();
451
+ var col, i, len;
452
+ // Multiple column sorting cannot retain the sort order in the column option.
453
+ if(this._maxCount === 1 && sortedColumns != null) {
454
+ // assign sorting state to each columns
455
+ len = sortedColumns.length;
456
+ for (i = 0; i < len; i++) {
457
+ var sortedColumn = sortedColumns[i];
458
+ var colIndex = sortedColumn["colIndex"];
459
+ col = columns[colIndex];
460
+ if (!col) {
461
+ col = columns[colIndex] = {};
462
+ }
463
+ col["sortOrder"] = sortedColumn["sortOrder"];
464
+ }
465
+ }
466
+
467
+ len = host.getColumnCount();
468
+ var opt, field;
469
+ for(i = 0; i < len; ++i) {
450
470
  col = columns[i];
451
471
  if (!col) {
452
472
  col = columns[i] = {};
453
473
  }
454
474
 
475
+ // TODO: We should get the state from the core, instead of getting the sort options.
455
476
  opt = this._getSortOptions(i);
456
477
 
457
478
  if (!opt) { continue; }
@@ -465,7 +486,7 @@ SortableTitlePlugin.prototype.getConfigObject = function (gridOptions) {
465
486
  }
466
487
  field = opt["field"];
467
488
  if (field) {
468
- if(col["field"] !== field) {
489
+ if(col["field"] != null && col["field"] !== field) { // Core does not have field properties, so when you try to call getConfigObject in Core, it will return sortBy too.
469
490
  col["sortBy"] = field;
470
491
  } // else The default value is an empty sortBy, which refers to the same column field by default.
471
492
 
@@ -481,7 +502,7 @@ SortableTitlePlugin.prototype.getConfigObject = function (gridOptions) {
481
502
  extOptions = obj["sorting"] = {};
482
503
  }
483
504
 
484
- var val = this.getSortedColumns();
505
+ var val = sortedColumns;
485
506
  if(val != null) {
486
507
  extOptions["initialSort"] = val;
487
508
  }
@@ -988,7 +1009,14 @@ SortableTitlePlugin.prototype.disableTwoStateSorting = function (disabled) {
988
1009
  * @param {boolean=} bool=true, if set to false it will be unfreeze indicator
989
1010
  */
990
1011
  SortableTitlePlugin.prototype.freezeIndicator = function (bool) {
1012
+ var prevState = this._frozenIndicator;
991
1013
  this._frozenIndicator = bool !== false;
1014
+ if(prevState && !this._frozenIndicator) { // from frozen to unfrozen, update the ui
1015
+ for (var i = this._hosts.length; --i >= 0;) {
1016
+ this._updateSortableIndicator(i);
1017
+ }
1018
+ }
1019
+
992
1020
  };
993
1021
  /** @public
994
1022
  * @param {boolean=} disabled
@@ -1064,7 +1092,7 @@ SortableTitlePlugin.prototype._initialSortByColumnField = function (options) {
1064
1092
  var colCount = columns ? columns.length : 0;
1065
1093
  for (var i = 0; i < colCount; i++) {
1066
1094
  var column = columns[i];
1067
- var sortOrder = column["defaultSort"] || column["sort"]; // composite and rt grid option for default sort order
1095
+ var sortOrder = column["defaultSort"]; // composite and rt grid option for default sort order
1068
1096
  if (sortOrder) {
1069
1097
  // TODO: Support multi-column sorting
1070
1098
  return {
@@ -1494,6 +1522,12 @@ SortableTitlePlugin.prototype._onColumnAdded = function (e) {
1494
1522
  } else {
1495
1523
  t.disableColumnSorting(colIndex, true);
1496
1524
  }
1525
+
1526
+ var sortOrder = column["sortOrder"] || column["sort"];
1527
+ if(sortOrder != null) {
1528
+ t.clearSortState(); // clear previous sorting state
1529
+ t.sortColumn(colIndex, sortOrder);
1530
+ }
1497
1531
  };
1498
1532
 
1499
1533
  /** @private
@@ -60,7 +60,9 @@ declare class TrackLayout {
60
60
 
61
61
  public showLane(index: number, opt_val?: boolean|null): boolean;
62
62
 
63
- public hideLane(index: number, opt_hidden?: boolean|null, opt_bitIndex?: number|null): boolean;
63
+ public hideLane(index: number, hidden?: boolean|null, bitIndex?: number|null): boolean;
64
+
65
+ public getLaneVisibilityBit(index: number, bitIndex?: number|null): boolean;
64
66
 
65
67
  public show(opt_shown?: boolean|null): void;
66
68
 
@@ -477,18 +477,18 @@ TrackLayout.prototype.showLane = function (index, opt_val) {
477
477
  };
478
478
  /** @public
479
479
  * @param {number} index
480
- * @param {boolean=} opt_hidden
481
- * @param {number=} opt_bitIndex
480
+ * @param {boolean=} hidden
481
+ * @param {number=} bitIndex
482
482
  * @return {boolean}
483
483
  */
484
- TrackLayout.prototype.hideLane = function (index, opt_hidden, opt_bitIndex) {
484
+ TrackLayout.prototype.hideLane = function (index, hidden, bitIndex) {
485
485
  if (index < 0 || index >= this._laneCount) { return false; }
486
486
 
487
487
  var col = this._newColumn(index);
488
488
  var prevVis = !col.invisibility;
489
489
 
490
- var bit = (opt_bitIndex != null) ? this._bits[opt_bitIndex] : 1;
491
- if(opt_hidden !== false) {
490
+ var bit = (bitIndex != null) ? this._bits[bitIndex] : 1;
491
+ if(hidden !== false) {
492
492
  col.invisibility |= bit; // Add invisibility bit
493
493
  } else {
494
494
  col.invisibility &= ~bit; // Remove invisibility bit
@@ -499,6 +499,24 @@ TrackLayout.prototype.hideLane = function (index, opt_hidden, opt_bitIndex) {
499
499
  }
500
500
  return false;
501
501
  };
502
+ /** Return true if the lane does not exist nor is not hidden. Return false only if the lane is hidden by the specified bit
503
+ * @public
504
+ * @param {number} index
505
+ * @param {number=} bitIndex
506
+ * @return {boolean}
507
+ */
508
+ TrackLayout.prototype.getLaneVisibilityBit = function (index, bitIndex) {
509
+ if (index >= 0 && index < this._laneCount) {
510
+ var col = this._cols[index];
511
+ if(col) {
512
+ var bit = (bitIndex != null) ? this._bits[bitIndex] : 1;
513
+ if(col.invisibility & bit) {
514
+ return false;
515
+ }
516
+ }
517
+ }
518
+ return true;
519
+ };
502
520
  /** @public
503
521
  * @param {boolean=} opt_shown
504
522
  */
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.38" };
3
+ window.EFX_GRID = { version: "6.0.39" };
@@ -15803,10 +15803,11 @@ ColumnDefinition.prototype.getConfigObject = function(colOptions) {
15803
15803
  obj["minWidth"] = value;
15804
15804
  }
15805
15805
 
15806
- value = core.isColumnVisible(colIndex);
15807
15806
  // If "hidden" property already available from core/extensions, don't override this property
15808
- if(!value && obj["hidden"] == null) {
15809
- obj["hidden"] = true;
15807
+ if(obj["hidden"] == null) {
15808
+ if(!core.getColumnVisibility(colIndex, 0)) {
15809
+ obj["hidden"] = true;
15810
+ }
15810
15811
  }
15811
15812
 
15812
15813
  value = core.getColumnAlignment(colIndex);
@@ -19313,18 +19314,18 @@ TrackLayout.prototype.showLane = function (index, opt_val) {
19313
19314
  };
19314
19315
  /** @public
19315
19316
  * @param {number} index
19316
- * @param {boolean=} opt_hidden
19317
- * @param {number=} opt_bitIndex
19317
+ * @param {boolean=} hidden
19318
+ * @param {number=} bitIndex
19318
19319
  * @return {boolean}
19319
19320
  */
19320
- TrackLayout.prototype.hideLane = function (index, opt_hidden, opt_bitIndex) {
19321
+ TrackLayout.prototype.hideLane = function (index, hidden, bitIndex) {
19321
19322
  if (index < 0 || index >= this._laneCount) { return false; }
19322
19323
 
19323
19324
  var col = this._newColumn(index);
19324
19325
  var prevVis = !col.invisibility;
19325
19326
 
19326
- var bit = (opt_bitIndex != null) ? this._bits[opt_bitIndex] : 1;
19327
- if(opt_hidden !== false) {
19327
+ var bit = (bitIndex != null) ? this._bits[bitIndex] : 1;
19328
+ if(hidden !== false) {
19328
19329
  col.invisibility |= bit; // Add invisibility bit
19329
19330
  } else {
19330
19331
  col.invisibility &= ~bit; // Remove invisibility bit
@@ -19335,6 +19336,24 @@ TrackLayout.prototype.hideLane = function (index, opt_hidden, opt_bitIndex) {
19335
19336
  }
19336
19337
  return false;
19337
19338
  };
19339
+ /** Return true if the lane does not exist nor is not hidden. Return false only if the lane is hidden by the specified bit
19340
+ * @public
19341
+ * @param {number} index
19342
+ * @param {number=} bitIndex
19343
+ * @return {boolean}
19344
+ */
19345
+ TrackLayout.prototype.getLaneVisibilityBit = function (index, bitIndex) {
19346
+ if (index >= 0 && index < this._laneCount) {
19347
+ var col = this._cols[index];
19348
+ if(col) {
19349
+ var bit = (bitIndex != null) ? this._bits[bitIndex] : 1;
19350
+ if(col.invisibility & bit) {
19351
+ return false;
19352
+ }
19353
+ }
19354
+ }
19355
+ return true;
19356
+ };
19338
19357
  /** @public
19339
19358
  * @param {boolean=} opt_shown
19340
19359
  */
@@ -35578,7 +35597,8 @@ var Core = function (opt_initializer) {
35578
35597
  "rowPositionChanged",
35579
35598
  "beforeColumnBoundUpdate",
35580
35599
  "beforeBatchOperation",
35581
- "afterBatchOperation"
35600
+ "afterBatchOperation",
35601
+ "pinningChanged"
35582
35602
  );
35583
35603
 
35584
35604
  // For debugging in advanced optimization mode
@@ -35927,7 +35947,7 @@ Core.prototype._batches = null;
35927
35947
  * @return {string}
35928
35948
  */
35929
35949
  Core.getVersion = function () {
35930
- return "5.1.51";
35950
+ return "5.1.53";
35931
35951
  };
35932
35952
  /** {@link ElementWrapper#dispose}
35933
35953
  * @override
@@ -38288,10 +38308,14 @@ Core.prototype.freezeColumn = function (frozenColIndex, numRightColumn) {
38288
38308
  var colCount = this.getColumnCount();
38289
38309
  var leftPinnedCount = 0;
38290
38310
  var rightPinnedCount = 0;
38311
+ var dirty = false;
38291
38312
  if (frozenColIndex || frozenColIndex === 0) {
38292
38313
  this._hScrollbarEnabled = true;
38293
38314
  leftPinnedCount = (frozenColIndex >= 0) ? frozenColIndex + 1 : 0;
38294
- this._pinnedLeftColumnCount = leftPinnedCount; // This variable is used for caching
38315
+ if (this._pinnedLeftColumnCount !== leftPinnedCount) {
38316
+ dirty = true;
38317
+ this._pinnedLeftColumnCount = leftPinnedCount; // This variable is used for caching
38318
+ }
38295
38319
 
38296
38320
  for (i = 0; i < colCount; ++i) {
38297
38321
  colDef = this._getColumnDef(i);
@@ -38302,7 +38326,10 @@ Core.prototype.freezeColumn = function (frozenColIndex, numRightColumn) {
38302
38326
  }
38303
38327
  if(numRightColumn != null) {
38304
38328
  rightPinnedCount = numRightColumn > 0 ? numRightColumn : 0;
38305
- this._pinnedRightColumnCount = rightPinnedCount; // This variable is used for caching
38329
+ if (this._pinnedLeftColumnCount !== rightPinnedCount) {
38330
+ dirty = true;
38331
+ this._pinnedRightColumnCount = rightPinnedCount; // This variable is used for caching
38332
+ }
38306
38333
 
38307
38334
  for (i = colCount; --i >= 0;) {
38308
38335
  colDef = this._getColumnDef(i);
@@ -38313,6 +38340,12 @@ Core.prototype.freezeColumn = function (frozenColIndex, numRightColumn) {
38313
38340
  this._onColumnCountChanged(); // Activate horizontal scrollbar and column virtualization
38314
38341
  this._updateScrollbarWidth(true, true);
38315
38342
  this._updateColumnSeparators();
38343
+
38344
+ if (dirty) {
38345
+ if (!this._isEventDispatching("pinningChanged")) {
38346
+ this._dispatch("pinningChanged", {});
38347
+ }
38348
+ }
38316
38349
  };
38317
38350
 
38318
38351
  /** @private
@@ -39299,7 +39332,7 @@ Core.prototype.getHorizontalLayout = function () {
39299
39332
  * @ignore
39300
39333
  * @param {number} colIndex
39301
39334
  * @param {boolean} bool
39302
- * @param {number} flag Default is 0
39335
+ * @param {number} flag
39303
39336
  * @return {boolean}
39304
39337
  */
39305
39338
  Core.prototype.setColumnVisibility = function (colIndex, bool, flag) {
@@ -39319,6 +39352,16 @@ Core.prototype.setColumnVisibility = function (colIndex, bool, flag) {
39319
39352
  }
39320
39353
  return false;
39321
39354
  };
39355
+ /** Get visibility state for the specified flag. This is for internal use only
39356
+ * @public
39357
+ * @ignore
39358
+ * @param {number} colIndex
39359
+ * @param {number=} flag
39360
+ * @return {boolean}
39361
+ */
39362
+ Core.prototype.getColumnVisibility = function (colIndex, flag) {
39363
+ return this._layoutX.getLaneVisibilityBit(colIndex, flag);
39364
+ };
39322
39365
 
39323
39366
  /** @public
39324
39367
  * @param {number} size