@refinitiv-ui/efx-grid 6.0.134 → 6.0.136

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,6 +9,8 @@ declare class DataConnector extends EventDispatcher {
9
9
 
10
10
  constructor();
11
11
 
12
+ public dispose(): void;
13
+
12
14
  public getAllRics(): (string)[]|null;
13
15
 
14
16
  public hasRic(): boolean;
@@ -11,8 +11,8 @@ import RowDefinition from "./RowDefinition.js"; // eslint-disable-line
11
11
  */
12
12
  let DataConnector = function () {
13
13
  let t = this;
14
- t._commitRicsChanges = t._commitRicsChanges.bind(this);
15
- t._commitFieldsChanges = t._commitFieldsChanges.bind(this);
14
+ t._commitRicsChanges = t._commitRicsChanges.bind(t);
15
+ t._commitFieldsChanges = t._commitFieldsChanges.bind(t);
16
16
  t._fieldChangedConflator = new Conflator(0, t._commitFieldsChanges);
17
17
  t._ricChangedConflator = new Conflator(0, t._commitRicsChanges);
18
18
  t._fields = new ReferenceCounter();
@@ -21,8 +21,6 @@ let DataConnector = function () {
21
21
  };
22
22
  Ext.inherits(DataConnector, EventDispatcher);
23
23
 
24
-
25
- //#region Private Members
26
24
  /** @type {Conflator}
27
25
  * @private
28
26
  */
@@ -43,7 +41,16 @@ DataConnector.prototype._rics = null;
43
41
  * @private
44
42
  */
45
43
  DataConnector.prototype._fields = null;
46
- //#endregion Private Members
44
+
45
+ /** @public
46
+ */
47
+ DataConnector.prototype.dispose = function () {
48
+ this.removeAllEventListeners();
49
+
50
+ this._rowDefMap = this._fields = this._rics = null;
51
+ this._fieldChangedConflator.reset();
52
+ this._ricChangedConflator.reset();
53
+ };
47
54
 
48
55
  /** Get all ric with no duplication
49
56
  * @public
@@ -632,7 +632,9 @@ Grid.prototype.dispose = function() {
632
632
  this.removeAllRows(); // Some conflators are reset
633
633
  this._sorter.dispose();
634
634
  this._grid.dispose();
635
- this._connector.reset();
635
+ this._snapshot.dispose();
636
+ this._connector.dispose();
637
+ this._connector = null;
636
638
 
637
639
  if(!this._sharedDataSource) { // Make sure that this is the final grid, and its data is disposed
638
640
  if(this._subs) {
@@ -1643,7 +1645,7 @@ Grid.prototype.replaceColumn = function (columnOption, colRef) {
1643
1645
  * @param {Object} response
1644
1646
  */
1645
1647
  Grid.prototype._onFieldLoadedSuccess = function (field, colDef, response) {
1646
- if (response && response.id) {
1648
+ if(this._connector && response && response.id) {
1647
1649
  let fieldDef = response;
1648
1650
  if (colDef && colDef.getField() === field) {
1649
1651
  if (colDef.isDefaultName() && fieldDef.name) {
@@ -1668,12 +1670,14 @@ Grid.prototype._onFieldLoadedError = function (err) {
1668
1670
  * @param {string} referrer
1669
1671
  */
1670
1672
  Grid.prototype._onFieldLoaded = function (field, referrer) {
1671
- // For time series, we need to wait until the field is loadedm, then we can insert a child from the field data.
1672
- if(FieldDefinition.isTimeSeries(field)) {
1673
- let colDef = this.getColumnDefinitionById(referrer); // The 'referrer' is a column ID that was just added
1674
- this._populateTimeSeriesChildren(colDef);
1673
+ if(this._connector) {
1674
+ // For time series, we need to wait until the field is loadedm, then we can insert a child from the field data.
1675
+ if(FieldDefinition.isTimeSeries(field)) {
1676
+ let colDef = this.getColumnDefinitionById(referrer); // The 'referrer' is a column ID that was just added
1677
+ this._populateTimeSeriesChildren(colDef);
1678
+ }
1679
+ this._connector.addFields(field, referrer);
1675
1680
  }
1676
- this._connector.addFields(field, referrer);
1677
1681
  };
1678
1682
 
1679
1683
  /**
@@ -2694,6 +2698,7 @@ Grid.prototype.removeAllRows = function() {
2694
2698
 
2695
2699
  this._dc.clearAllData();
2696
2700
  this._dt.clearAllData();
2701
+ this._dt.setClassificationSource(this._dc);
2697
2702
  this._clearDataUpdates();
2698
2703
 
2699
2704
  rowDefs.forEach(RowDefinition.dispose); // Each individual subscription is unsubscribed along with disposed rowDef
@@ -8,7 +8,7 @@ declare class SnapshotFiller extends EventDispatcher {
8
8
 
9
9
  constructor();
10
10
 
11
- public static readonly _mockAdc: any;
11
+ public dispose(rtk: any): void;
12
12
 
13
13
  public setRTK(rtk: any): void;
14
14
 
@@ -20,7 +20,11 @@ let SnapshotFiller = function () {
20
20
  };
21
21
  Ext.inherits(SnapshotFiller, EventDispatcher);
22
22
 
23
- //#region Private Members
23
+ /** @private
24
+ * @type {Object}
25
+ */
26
+ SnapshotFiller._mockAdc = null;
27
+
24
28
  /** @type {number}
25
29
  * @private
26
30
  */
@@ -41,23 +45,27 @@ SnapshotFiller.prototype._rtk;
41
45
  * @private
42
46
  */
43
47
  SnapshotFiller.prototype._adcOptions = null;
44
- //#endregion Private Members
48
+
45
49
 
46
50
  /** @public
47
51
  * @param {*} rtk RTK instance
48
52
  */
49
- SnapshotFiller.prototype.setRTK = function (rtk) {
50
- this._rtk = rtk;
53
+ SnapshotFiller.prototype.dispose = function () {
54
+ this.removeAllEventListeners();
55
+ if(this._timerId) {
56
+ clearTimeout(this._timerId);
57
+ this._timerId = 0;
58
+ }
59
+ this._rics = this._fields = this._rtk = this._adcOptions = null;
51
60
  };
52
61
 
53
- /**
54
- * @public
55
- * @type {Object}
62
+ /** @public
63
+ * @param {*} rtk RTK instance
56
64
  */
57
- SnapshotFiller._mockAdc = null;
58
-
59
- /**
60
- * @public
65
+ SnapshotFiller.prototype.setRTK = function (rtk) {
66
+ this._rtk = rtk;
67
+ };
68
+ /** @public
61
69
  * @param {string} str
62
70
  * @param {*} value
63
71
  */
@@ -68,8 +76,7 @@ SnapshotFiller.setMockAdc = function(str, value) {
68
76
  SnapshotFiller._mockAdc[str] = value;
69
77
  };
70
78
 
71
- /**
72
- * @public
79
+ /** @public
73
80
  * @param {string} str
74
81
  * @return {*}
75
82
  */
@@ -80,8 +87,7 @@ SnapshotFiller.getMockAdc = function(str) {
80
87
  return SnapshotFiller._mockAdc[str];
81
88
  };
82
89
 
83
- /**
84
- * @public
90
+ /** @public
85
91
  */
86
92
  SnapshotFiller.clearMockAdc = function() {
87
93
  SnapshotFiller._mockAdc = null;
@@ -84,10 +84,12 @@ declare class InCellEditingPlugin extends GridPlugin {
84
84
 
85
85
  public disableDblClick(opt_disabled?: boolean|null): void;
86
86
 
87
- public showStarterText(bool?: boolean|null): void;
87
+ public showStarterText(shown?: boolean|null): void;
88
88
 
89
89
  public _requestUpdateStarterText(): void;
90
90
 
91
+ public updateStarterText(shown?: boolean|null): void;
92
+
91
93
  public isEditing(): boolean;
92
94
 
93
95
  public getTextBox(columnIndex?: number|null, grid?: any): Element|null;
@@ -417,8 +417,7 @@ InCellEditingPlugin._styles = prettifyCss([
417
417
  ],
418
418
  ":host .starter-text", [
419
419
  "padding: var(--grid-cell-padding,0 8px 0 8px);",
420
- "pointer-events: none;",
421
- "line-height: 28px" // WARNING: hardcode, it can be calculate with row height
420
+ "pointer-events: none;"
422
421
  ]
423
422
  ]);
424
423
 
@@ -1113,14 +1112,13 @@ InCellEditingPlugin.prototype._onGridKeyDown = function (e) {
1113
1112
  };
1114
1113
 
1115
1114
  /**
1116
- * @description Show starter text when the grid is no ric
1115
+ * @description Show starter text when the grid has no ric
1117
1116
  * @public
1118
- * @param {boolean=} bool
1117
+ * @param {boolean=} shown
1119
1118
  */
1120
- InCellEditingPlugin.prototype.showStarterText = function (bool) {
1121
- this._requestUpdateStarterText();
1119
+ InCellEditingPlugin.prototype.showStarterText = function (shown) {
1120
+ this.updateStarterText(shown !== false);
1122
1121
  };
1123
-
1124
1122
  /**
1125
1123
  * @description Request to show starter text
1126
1124
  * @public
@@ -1132,25 +1130,26 @@ InCellEditingPlugin.prototype._requestUpdateStarterText = function () {
1132
1130
  if(this._updateStarterTextConflator.conflate()){
1133
1131
  return;
1134
1132
  }
1135
- this._updateStaterText();
1133
+ this.updateStarterText();
1136
1134
  };
1137
1135
 
1138
1136
  /**
1139
- * @private
1140
- * @param {boolean=} force
1137
+ * @public
1138
+ * @description Updates the starter text to either show or hide it.
1139
+ * @param {boolean=} shown Forces the display of the starter text if "true", if "false" it hides the starter text. If not given as a parameter, it automates updating the display of the starter text
1141
1140
  */
1142
- InCellEditingPlugin.prototype._updateStaterText = function (force) {
1141
+ InCellEditingPlugin.prototype.updateStarterText = function (shown) {
1143
1142
  if(!this._realTimeGrid || !this._starterText) {
1144
1143
  return;
1145
1144
  }
1146
1145
  // TODO: handled grid have ric but no one rows.
1147
1146
  let popup;
1148
1147
  if(!this._starterTextPopup) {
1149
- popup = this._starterTextPopup = this._createStaterTextElement();
1148
+ popup = this._starterTextPopup = this._createStarterTextElement();
1150
1149
  } else {
1151
1150
  popup = this._starterTextPopup;
1152
1151
  }
1153
- if(force === false || this._realTimeGrid.hasRic()) {
1152
+ if(shown === false || this._realTimeGrid.hasRic()) {
1154
1153
  popup.hide();
1155
1154
  return;
1156
1155
  }
@@ -1177,8 +1176,9 @@ InCellEditingPlugin.prototype._updateStaterText = function (force) {
1177
1176
  let popupElem = popup.getElement();
1178
1177
  popupElem.style.top = pos.y + "px";
1179
1178
  popupElem.style.left = pos.x + "px";
1179
+ popupElem.style.lineHeight = editableCell.getHeight() + "px";
1180
1180
  }
1181
- popup.show(force, grid.getParent());
1181
+ popup.show(shown, grid.getParent());
1182
1182
  };
1183
1183
 
1184
1184
  /** @private
@@ -1188,10 +1188,14 @@ InCellEditingPlugin.prototype._getFirstEditableColumnIndex = function () {
1188
1188
  if(this._readonly) {
1189
1189
  return -1;
1190
1190
  }
1191
+ let grid = this._hosts[0];
1192
+ if(!grid) {
1193
+ return -1;
1194
+ }
1191
1195
  let colCount = this.getColumnCount();
1192
1196
  let editableCol = -1;
1193
1197
  for (let i = 0; i < colCount; i++) {
1194
- if(this.isColumnEditable(i)) { // this._editableContent already check in this method
1198
+ if(grid.isColumnVisible(i) && this.isColumnEditable(i)) { // this._editableContent already check in this method
1195
1199
  editableCol = i;
1196
1200
  break;
1197
1201
  }
@@ -1202,7 +1206,7 @@ InCellEditingPlugin.prototype._getFirstEditableColumnIndex = function () {
1202
1206
  /** @private
1203
1207
  * @return {Object}
1204
1208
  */
1205
- InCellEditingPlugin.prototype._createStaterTextElement = function () {
1209
+ InCellEditingPlugin.prototype._createStarterTextElement = function () {
1206
1210
  let container = document.createElement("div");
1207
1211
  container.textContent = this._starterText;
1208
1212
  container.className = "starter-text";
@@ -1392,9 +1396,9 @@ InCellEditingPlugin.prototype.isColumnEditable = function (colIndex) {
1392
1396
  InCellEditingPlugin.prototype.enableReadonly = function (enabled) {
1393
1397
  this._readonly = enabled !== false;
1394
1398
  if(this._readonly) {
1395
- this._updateStaterText(false);
1399
+ this.updateStarterText(false);
1396
1400
  } else {
1397
- this._updateStaterText();
1401
+ this.updateStarterText();
1398
1402
  }
1399
1403
  };
1400
1404
  /**
@@ -1642,7 +1646,7 @@ InCellEditingPlugin.prototype._openEditor = function (e, host, arg) {
1642
1646
 
1643
1647
  // Dispatch an event for user to setup stuff
1644
1648
  t._dispatch("editorOpened", arg); // User may modify the editor
1645
- t._updateStaterText(false); // Currently Starter text open doesn't have the ric, it needs to be forcefully hide
1649
+ t.updateStarterText(false); // Currently Starter text open doesn't have the ric, it needs to be forcefully hide
1646
1650
 
1647
1651
  inputElement.focus();
1648
1652
  if(typeof inputElement.select === "function") {
@@ -143,10 +143,10 @@ RowPainter._styles = prettifyCss([
143
143
  "font-family: Arial;"
144
144
  ],
145
145
  ".tr-grid .expander.closed", [
146
- "transform: translate(0px, -1px) rotate(-90deg);"
146
+ "transform: rotate(-90deg);"
147
147
  ],
148
148
  ".tr-grid .cell.closed .expander", [
149
- "transform: translate(0px, -1px) rotate(-90deg);"
149
+ "transform: rotate(-90deg);"
150
150
  ],
151
151
  ".tr-grid .tr-lg .cell.folder.content-header", [ // Used for header row in contentAsHeader mode, espectially with solar theme
152
152
  "background-color: inherit;"
@@ -84,10 +84,12 @@ declare class InCellEditingPlugin extends GridPlugin {
84
84
 
85
85
  public disableDblClick(opt_disabled?: boolean|null): void;
86
86
 
87
- public showStarterText(bool?: boolean|null): void;
87
+ public showStarterText(shown?: boolean|null): void;
88
88
 
89
89
  public _requestUpdateStarterText(): void;
90
90
 
91
+ public updateStarterText(shown?: boolean|null): void;
92
+
91
93
  public isEditing(): boolean;
92
94
 
93
95
  public getTextBox(columnIndex?: number|null, grid?: any): Element|null;
@@ -9,6 +9,8 @@ declare class DataConnector extends EventDispatcher {
9
9
 
10
10
  constructor();
11
11
 
12
+ public dispose(): void;
13
+
12
14
  public getAllRics(): (string)[]|null;
13
15
 
14
16
  public hasRic(): boolean;
@@ -8,7 +8,7 @@ declare class SnapshotFiller extends EventDispatcher {
8
8
 
9
9
  constructor();
10
10
 
11
- public static readonly _mockAdc: any;
11
+ public dispose(rtk: any): void;
12
12
 
13
13
  public setRTK(rtk: any): void;
14
14
 
package/lib/versions.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "tr-grid-util": "1.3.167",
2
+ "tr-grid-util": "1.3.168",
3
3
  "tr-grid-printer": "1.0.18",
4
4
  "@grid/column-dragging": "1.0.21",
5
5
  "@grid/row-segmenting": "1.0.35",
@@ -19,7 +19,7 @@
19
19
  "tr-grid-contextmenu": "1.0.44",
20
20
  "tr-grid-filter-input": "0.9.43",
21
21
  "tr-grid-heat-map": "1.0.30",
22
- "tr-grid-in-cell-editing": "1.0.90",
22
+ "tr-grid-in-cell-editing": "1.0.93",
23
23
  "tr-grid-pagination": "1.0.24",
24
24
  "tr-grid-percent-bar": "1.0.24",
25
25
  "tr-grid-range-bar": "2.0.9",
package/package.json CHANGED
@@ -69,5 +69,5 @@
69
69
  "publishConfig": {
70
70
  "access": "public"
71
71
  },
72
- "version": "6.0.134"
72
+ "version": "6.0.136"
73
73
  }