@refinitiv-ui/efx-grid 6.0.29 → 6.0.31

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. package/lib/core/dist/core.js +20 -2
  2. package/lib/core/dist/core.min.js +1 -1
  3. package/lib/core/es6/grid/Core.js +1 -1
  4. package/lib/core/es6/grid/components/Scrollbar.js +19 -1
  5. package/lib/filter-dialog/lib/filter-dialog.js +11 -8
  6. package/lib/filter-dialog/themes/base.less +7 -3
  7. package/lib/filter-dialog/themes/elemental/dark/es5/all-elements.js +1 -1
  8. package/lib/filter-dialog/themes/elemental/dark/filter-dialog.js +1 -1
  9. package/lib/filter-dialog/themes/elemental/light/es5/all-elements.js +1 -1
  10. package/lib/filter-dialog/themes/elemental/light/filter-dialog.js +1 -1
  11. package/lib/filter-dialog/themes/halo/dark/es5/all-elements.js +1 -1
  12. package/lib/filter-dialog/themes/halo/dark/filter-dialog.js +1 -1
  13. package/lib/filter-dialog/themes/halo/light/es5/all-elements.js +1 -1
  14. package/lib/filter-dialog/themes/halo/light/filter-dialog.js +1 -1
  15. package/lib/filter-dialog/themes/solar/charcoal/es5/all-elements.js +1 -1
  16. package/lib/filter-dialog/themes/solar/charcoal/filter-dialog.js +1 -1
  17. package/lib/filter-dialog/themes/solar/pearl/es5/all-elements.js +1 -1
  18. package/lib/filter-dialog/themes/solar/pearl/filter-dialog.js +1 -1
  19. package/lib/grid/index.js +1 -1
  20. package/lib/rt-grid/dist/rt-grid.js +142 -26
  21. package/lib/rt-grid/dist/rt-grid.min.js +1 -1
  22. package/lib/rt-grid/es6/ColumnDefinition.d.ts +2 -0
  23. package/lib/rt-grid/es6/ColumnDefinition.js +6 -0
  24. package/lib/rt-grid/es6/FieldDefinition.d.ts +4 -0
  25. package/lib/rt-grid/es6/FieldDefinition.js +27 -1
  26. package/lib/rt-grid/es6/Grid.d.ts +1 -0
  27. package/lib/rt-grid/es6/Grid.js +14 -0
  28. package/lib/rt-grid/es6/RowDefinition.d.ts +1 -1
  29. package/lib/rt-grid/es6/RowDefinition.js +7 -7
  30. package/lib/rt-grid/es6/SnapshotFiller.js +3 -0
  31. package/lib/tr-grid-column-stack/es6/ColumnStack.js +4 -0
  32. package/lib/tr-grid-content-wrap/es6/ContentWrap.d.ts +4 -4
  33. package/lib/tr-grid-content-wrap/es6/ContentWrap.js +116 -70
  34. package/lib/tr-grid-util/es6/DragUI.d.ts +2 -0
  35. package/lib/tr-grid-util/es6/DragUI.js +39 -9
  36. package/lib/tr-grid-util/es6/Popup.d.ts +3 -1
  37. package/lib/tr-grid-util/es6/Popup.js +57 -23
  38. package/lib/tr-grid-util/es6/jet/mockDataAPI.js +29 -1
  39. package/lib/types/es6/ConditionalColoring.d.ts +30 -23
  40. package/lib/types/es6/ContentWrap.d.ts +4 -4
  41. package/lib/types/es6/ExtensionOptions.d.ts +2 -0
  42. package/lib/types/es6/RealtimeGrid/ColumnDefinition.d.ts +2 -0
  43. package/lib/types/es6/RealtimeGrid/FieldDefinition.d.ts +4 -0
  44. package/lib/types/es6/RealtimeGrid/Grid.d.ts +1 -0
  45. package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +1 -1
  46. package/lib/versions.json +4 -4
  47. package/package.json +1 -1
@@ -91,6 +91,8 @@ declare class ColumnDefinition {
91
91
 
92
92
  public isTimeSeries(): boolean;
93
93
 
94
+ public isTimeSeriesChild(): boolean;
95
+
94
96
  public isFormulaField(): boolean;
95
97
 
96
98
  public static isFormulaField(field: string): boolean;
@@ -590,6 +590,12 @@ ColumnDefinition.prototype.isTimeSeries = function() {
590
590
  /** @public
591
591
  * @return {boolean}
592
592
  */
593
+ ColumnDefinition.prototype.isTimeSeriesChild = function() {
594
+ return FieldDefinition.isTimeSeriesChild(this.getField());
595
+ };
596
+ /** @public
597
+ * @return {boolean}
598
+ */
593
599
  ColumnDefinition.prototype.isFormulaField = function() {
594
600
  return this._formula ? true : false;
595
601
  };
@@ -20,12 +20,16 @@ declare namespace FieldDefinition {
20
20
 
21
21
  function setFieldCaching(caching: boolean): void;
22
22
 
23
+ function disableTimeSeriesExpansion(disabled: boolean): void;
24
+
23
25
  function isFormula(field: string): boolean;
24
26
 
25
27
  function isAdc(field: string): boolean;
26
28
 
27
29
  function isRealTimeField(field: string): boolean;
28
30
 
31
+ function isTimeSeriesChild(field: string): boolean;
32
+
29
33
  function isTimeSeries(field: string): boolean;
30
34
 
31
35
  }
@@ -182,6 +182,11 @@ FieldDefinition._lang = 'en';
182
182
  * @private
183
183
  */
184
184
  FieldDefinition._caching = false;
185
+ /**
186
+ * @type {boolean}
187
+ * @private
188
+ */
189
+ FieldDefinition._timeSeriesExpansion = true;
185
190
 
186
191
  /**
187
192
  * @type {Object.<string, boolean>}
@@ -269,6 +274,14 @@ FieldDefinition.setFieldCaching = function (caching) {
269
274
  FieldDefinition._caching = caching;
270
275
  };
271
276
 
277
+ /** @public
278
+ * @function
279
+ * @param {boolean} disabled=true if disable it, time series will not be expand
280
+ */
281
+ FieldDefinition.disableTimeSeriesExpansion = function(disabled) {
282
+ FieldDefinition._timeSeriesExpansion = disabled != false ? false : true;
283
+ };
284
+
272
285
  /** @public
273
286
  * @param {string} field
274
287
  * @return {boolean}
@@ -301,7 +314,7 @@ FieldDefinition.isRealTimeField = function(field) {
301
314
  return false;
302
315
  }
303
316
 
304
- if(FieldDefinition.getFieldProperty(field, "timeSeriesChild")) {
317
+ if(FieldDefinition.isTimeSeriesChild(field)) {
305
318
  return false;
306
319
  }
307
320
 
@@ -312,6 +325,14 @@ FieldDefinition.isRealTimeField = function(field) {
312
325
  return FieldDefinition.getFieldProperty(field, "IsRealtimeField") !== false;
313
326
  };
314
327
 
328
+ /** @public
329
+ * @param {string} field
330
+ * @return {boolean}
331
+ */
332
+ FieldDefinition.isTimeSeriesChild = function(field) {
333
+ return FieldDefinition.getFieldProperty(field, "timeSeriesChild") ? true : false;
334
+ };
335
+
315
336
  /** @public
316
337
  * @param {string} field
317
338
  * @return {boolean}=true if field is time series field
@@ -321,6 +342,11 @@ FieldDefinition.isTimeSeries = function (field) {
321
342
  return false;
322
343
  }
323
344
 
345
+ // If we disable time series expansion, the grid won't have a time series field.
346
+ if(!FieldDefinition._timeSeriesExpansion) {
347
+ return false;
348
+ }
349
+
324
350
  // We can check time series using a cache to avoid duplicating checks in regular expressions.
325
351
  var timeSeriesField = FieldDefinition.getFieldProperty(field, "timeSeries");
326
352
  if (timeSeriesField != null) {
@@ -81,6 +81,7 @@ declare namespace Grid {
81
81
  formulaEngine?: boolean|null,
82
82
  adcPollingInterval?: number|null,
83
83
  fieldCaching?: boolean|null,
84
+ timeSeriesExpansion?: boolean|null,
84
85
  childDataField?: string|null,
85
86
  topSection?: boolean|null
86
87
  };
@@ -84,6 +84,7 @@ import { ElementWrapper } from "../../core/es6/grid/components/ElementWrapper.js
84
84
  * @property {boolean=} formulaEngine=false If enabled, field with leading equal sign will be treated as a formula and rows will be filled with the calculated values.
85
85
  * @property {number=} adcPollingInterval=0 Length of polling interval for refreshing ADC data in milliseconds. The default value (0) means no polling.
86
86
  * @property {boolean=} fieldCaching=false If enabled, field definition will be caching internal mechanism
87
+ * @property {boolean=} timeSeriesExpansion=true If disabled, the time series field will be treated as a normal field and not expanded.
87
88
  * @property {string=} childDataField=CHILD_VALUES The given field will be used to store children's static data, such as row color assignment.
88
89
  * @property {boolean=} topSection=true If disabled, title section will not be rendered
89
90
  */
@@ -530,6 +531,11 @@ Grid.prototype._pollingEnabled = true;
530
531
  * @private
531
532
  */
532
533
  Grid.prototype._fieldCaching = false;
534
+ /** @type {boolean}
535
+ * @private
536
+ */
537
+ Grid.prototype._timeSeriesExpansion = true;
538
+
533
539
  /** @type {string}
534
540
  * @private
535
541
  */
@@ -790,6 +796,11 @@ Grid.prototype.initialize = function(gridOption) {
790
796
  FieldDefinition.setFieldCaching(t._fieldCaching);
791
797
  }
792
798
 
799
+ if(gridOption["timeSeriesExpansion"] != null) {
800
+ t._timeSeriesExpansion = gridOption["timeSeriesExpansion"];
801
+ FieldDefinition.disableTimeSeriesExpansion(!t._timeSeriesExpansion);
802
+ }
803
+
793
804
  if (gridOption["icons"] && gridOption["icons"]["rowGrouping"] && gridOption["icons"]["rowGrouping"]["expander"]) {
794
805
  StyleLoader.chainIcon = gridOption["icons"]["rowGrouping"]["expander"];
795
806
  }
@@ -1112,6 +1123,9 @@ Grid.prototype.getConfigObject = function (gridOptions) {
1112
1123
  if(this._fieldCaching) {
1113
1124
  obj["fieldCaching"] = this._fieldCaching;
1114
1125
  }
1126
+ if(this._timeSeriesExpansion != true) {
1127
+ obj["timeSeriesExpansion"] = this._timeSeriesExpansion;
1128
+ }
1115
1129
 
1116
1130
  if(this._childDataField) {
1117
1131
  obj["childDataField"] = this._childDataField;
@@ -136,7 +136,7 @@ declare class RowDefinition {
136
136
 
137
137
  declare const ROW_DEF: string;
138
138
 
139
- declare const ROW_TYPES: RowDefinition.RowTypes|null;
139
+ declare const ROW_TYPES: RowDefinition.RowTypes;
140
140
 
141
141
  declare function rowData(userInput: string): boolean;
142
142
 
@@ -17,12 +17,12 @@ import { DataTable } from "../../core/es6/data/DataTable.js";
17
17
  */
18
18
 
19
19
  /** @typedef {Object} RowDefinition~RowTypes
20
- * @property {string} CONTENT="CONTENT"
21
- * @property {string} CHAIN="CHAIN"
22
- * @property {string} CONSTITUENT="CONSTITUENT"
23
- * @property {string} GROUP_HEADER="GROUP_HEADER"
24
- * @property {string} SUBGROUP_HEADER="SUBGROUP_HEADER"
25
- * @property {string} GROUP_MEMBER="GROUP_MEMBER"
20
+ * @property {string} CONTENT="CONTENT" Regular row
21
+ * @property {string} CHAIN="CHAIN" Chain RIC row
22
+ * @property {string} CONSTITUENT="CONSTITUENT" Constituent row
23
+ * @property {string} GROUP_HEADER="GROUP_HEADER" Row of segment separator at the very top
24
+ * @property {string} SUBGROUP_HEADER="SUBGROUP_HEADER" Row of nested segment separator
25
+ * @property {string} GROUP_MEMBER="GROUP_MEMBER" Child row displayed under segment separator
26
26
  */
27
27
 
28
28
  /** @type {string}
@@ -31,7 +31,7 @@ import { DataTable } from "../../core/es6/data/DataTable.js";
31
31
  */
32
32
  var ROW_DEF = "ROW_DEF";
33
33
 
34
- /** @type {RowDefinition~RowTypes}
34
+ /** @type {!RowDefinition~RowTypes}
35
35
  * @public
36
36
  * @const
37
37
  */
@@ -381,6 +381,9 @@ SnapshotFiller.prototype._onRTKSuccess = function (fields, serverResult) {
381
381
  var dataRow = data2D[i];
382
382
  ric = dataRow[0];
383
383
 
384
+ if (ricMap[ric]) {
385
+ continue; // we interested only first row of ric
386
+ }
384
387
  var snapData = ricMap[ric] = {};
385
388
 
386
389
  // loop for create rowData for update
@@ -1311,6 +1311,10 @@ ColumnStackPlugin.prototype._onColumnRemoved = function (e) {
1311
1311
  } else {
1312
1312
  stackOpt.activeColumn = stackOpt.stackRefs[0];
1313
1313
  }
1314
+
1315
+ // TODO: Add a proper way to set visibility to activeColumn when activeColumn is changed
1316
+ var activeColIndex = this._getColumnIndex(stackOpt.activeColumn);
1317
+ this._setColumnVisibility(activeColIndex, true);
1314
1318
  this._updateUI();
1315
1319
  }
1316
1320
  }
@@ -4,11 +4,11 @@ import { GridPlugin } from '../../tr-grid-util/es6/GridPlugin.js';
4
4
  declare namespace ContentWrapPlugin {
5
5
 
6
6
  type Options = {
7
- evenRowHeight?: boolean
7
+ evenRowHeight?: boolean|null
8
8
  };
9
9
 
10
10
  type ColumnOptions = {
11
- contentWrap?: boolean
11
+ contentWrap?: boolean|null
12
12
  };
13
13
 
14
14
  }
@@ -29,11 +29,11 @@ declare class ContentWrapPlugin extends GridPlugin {
29
29
 
30
30
  public getConfigObject(gridOptions?: any): any;
31
31
 
32
- public adjustRowHeight(sectionRef: any, from?: number, to?: number): boolean;
32
+ public adjustRowHeight(sectionRef: any, from?: number|null, to?: number|null): boolean;
33
33
 
34
34
  public adjustRowHeightAt(sectionRef: any, rowIndex: number): boolean;
35
35
 
36
- public enableContentWrapping(colIndex: number, bool?: boolean): void;
36
+ public enableContentWrapping(colIndex: number, bool?: boolean|null): void;
37
37
 
38
38
  public isWrappingContent(colIndex: number): boolean;
39
39
 
@@ -17,7 +17,7 @@ import { GridPlugin } from '../../tr-grid-util/es6/GridPlugin.js';
17
17
  var ContentWrapPlugin = function ContentWrapPlugin() {
18
18
  this._onColumnAdded = this._onColumnAdded.bind(this);
19
19
  this._onRecalculation = this._onRecalculation.bind(this);
20
- this._setReCalculationTimer = this._setReCalculationTimer.bind(this);
20
+ this._requestRecalculation = this._requestRecalculation.bind(this);
21
21
  this._hosts = [];
22
22
  };
23
23
 
@@ -77,10 +77,10 @@ ContentWrapPlugin.prototype.initialize = function (host, options) {
77
77
 
78
78
  this._hosts.push(host);
79
79
 
80
- window.addEventListener("load", this._setReCalculationTimer); // Since CSS can impact font, we need adjust accordingly
80
+ window.addEventListener("load", this._requestRecalculation); // Since CSS can impact font, we need adjust accordingly
81
81
 
82
- host.listen("widthChanged", this._setReCalculationTimer);
83
- host.listen("postSectionDataBinding", this._setReCalculationTimer); // In case of lazy loading
82
+ host.listen("widthChanged", this._requestRecalculation);
83
+ host.listen("postSectionDataBinding", this._requestRecalculation); // In case of lazy loading
84
84
 
85
85
  this.config(options);
86
86
  host.listen("columnAdded", this._onColumnAdded);
@@ -99,11 +99,13 @@ ContentWrapPlugin.prototype.unload = function (host) {
99
99
 
100
100
  this._hosts.splice(at, 1);
101
101
 
102
- window.removeEventListener("load", this._setReCalculationTimer);
103
- host.unlisten("widthChanged", this._setReCalculationTimer);
104
- host.unlisten("postSectionDataBinding", this._setReCalculationTimer);
102
+ window.removeEventListener("load", this._requestRecalculation);
103
+ host.unlisten("widthChanged", this._requestRecalculation);
104
+ host.unlisten("postSectionDataBinding", this._requestRecalculation);
105
105
  host.unlisten("columnAdded", this._onColumnAdded);
106
106
 
107
+ this._dispose();
108
+
107
109
  this._clearTimer();
108
110
  };
109
111
  /** @public
@@ -182,7 +184,7 @@ ContentWrapPlugin.prototype.getConfigObject = function (gridOptions) {
182
184
 
183
185
 
184
186
  ContentWrapPlugin.prototype.adjustRowHeight = function (sectionRef, from, to) {
185
- if (this._adjusting || this._hosts.length === 0) {
187
+ if (this._adjusting || !this._hosts.length) {
186
188
  return false; // Quite if grid has not been registered or in the process of adjusting row height
187
189
  }
188
190
 
@@ -198,17 +200,30 @@ ContentWrapPlugin.prototype.adjustRowHeight = function (sectionRef, from, to) {
198
200
  return false;
199
201
  }
200
202
 
203
+ var sectionElem = section.getElement();
204
+
205
+ if (!sectionElem || !sectionElem.offsetParent) {
206
+ return false;
207
+ }
208
+
201
209
  this._adjusting = true; // Prevent infinite loop
202
210
 
203
211
  var dirtyRows = []; // Collect dirty rows
204
212
 
205
- var results = this._calculateRowHeight(section, from, to, dirtyRows); // Setting row height for multiple rows can cause performance issue
213
+ var maxHeight = NaN;
214
+ var heights = null;
206
215
 
216
+ if (this._evenRowHeight) {
217
+ maxHeight = this._calcMaxRowHeight(section, dirtyRows, from, to);
218
+ } else {
219
+ heights = this._calcRowHeights(section, dirtyRows, from, to);
220
+ } // Setting row height for multiple rows can cause performance issue
207
221
 
208
- var rowCount = dirtyRows.length;
222
+
223
+ var dirtyCount = dirtyRows.length;
209
224
  var prevFState = false;
210
225
 
211
- if (rowCount > this._freezingThreshold) {
226
+ if (dirtyCount > this._freezingThreshold) {
212
227
  if (section.getFrozenLayout) {
213
228
  prevFState = section.getFrozenLayout();
214
229
  section.setFrozenLayout(true);
@@ -219,29 +234,25 @@ ContentWrapPlugin.prototype.adjustRowHeight = function (sectionRef, from, to) {
219
234
  var r, rowIndex;
220
235
 
221
236
  if (this._evenRowHeight) {
222
- var max = results["max"];
223
-
224
- for (r = 0; r < rowCount; ++r) {
237
+ for (r = 0; r < dirtyCount; ++r) {
225
238
  rowIndex = dirtyRows[r];
226
- section.setRowHeight(rowIndex, max);
239
+ section.setRowHeight(rowIndex, maxHeight);
227
240
  }
228
241
  } else {
229
- var heights = results["heights"];
230
-
231
- for (r = 0; r < rowCount; ++r) {
242
+ for (r = 0; r < dirtyCount; ++r) {
232
243
  rowIndex = dirtyRows[r];
233
244
  section.setRowHeight(rowIndex, heights[rowIndex]);
234
245
  }
235
246
  }
236
247
 
237
- if (rowCount > this._freezingThreshold) {
248
+ if (dirtyCount > this._freezingThreshold) {
238
249
  if (section.setFrozenLayout) {
239
250
  section.setFrozenLayout(prevFState);
240
251
  }
241
252
  }
242
253
 
243
254
  this._adjusting = false;
244
- return rowCount ? true : false;
255
+ return dirtyCount ? true : false;
245
256
  };
246
257
  /** @public
247
258
  * @param {Object} sectionRef core grid SectionReference object
@@ -300,8 +311,8 @@ ContentWrapPlugin.prototype._setColumnContentWrapping = function (colIndex, colu
300
311
  /** @private */
301
312
 
302
313
 
303
- ContentWrapPlugin.prototype._setReCalculationTimer = function () {
304
- if (!this._recalTimer) {
314
+ ContentWrapPlugin.prototype._requestRecalculation = function () {
315
+ if (!this._recalTimer && !this._adjusting) {
305
316
  this._recalTimer = setTimeout(this._onRecalculation, 100);
306
317
  }
307
318
  };
@@ -328,7 +339,7 @@ ContentWrapPlugin.prototype._clearTimer = function () {
328
339
 
329
340
 
330
341
  ContentWrapPlugin.prototype._getSteppingHeight = function (height) {
331
- return Math.floor(height + 1) + 12; // Add top and bottom padding
342
+ return Math.ceil(height) + 14; // Add top and bottom padding
332
343
  };
333
344
  /** @private
334
345
  * @param {Object} section ILayoutGrid
@@ -343,25 +354,31 @@ ContentWrapPlugin.prototype._calculateRowHeightAt = function (section, rowIndex)
343
354
  var colCount = section.getColumnCount();
344
355
 
345
356
  for (var c = 0; c < colCount; ++c) {
346
- if (this.isWrappingContent(c)) {
347
- var cell = section.getCell(c, rowIndex, false); // TODO: Handle cell spanning
357
+ if (!this.isWrappingContent(c)) {
358
+ continue;
359
+ }
348
360
 
349
- if (cell && cell.isVisible()) {
350
- var cellContent = cell.getContent();
361
+ var cell = section.getCell(c, rowIndex, false); // TODO: Handle cell spanning
351
362
 
352
- if (cellContent) {
353
- if (!cellContent.offsetParent) {
354
- // Cell content is not in the document, so the height cannot be calculated
355
- return NaN;
356
- }
363
+ if (!cell || !cell.isVisible()) {
364
+ continue;
365
+ }
357
366
 
358
- var contentHeight = this._getSteppingHeight(cellContent.offsetHeight);
367
+ var cellContent = cell.getContent();
359
368
 
360
- if (contentHeight > maxHeight) {
361
- maxHeight = contentHeight;
362
- }
363
- }
364
- }
369
+ if (!cellContent) {
370
+ continue;
371
+ }
372
+
373
+ if (!cellContent.offsetParent) {
374
+ // Cell content is not in the document, so the height cannot be calculated
375
+ continue;
376
+ }
377
+
378
+ var contentHeight = this._getSteppingHeight(cellContent.offsetHeight);
379
+
380
+ if (contentHeight > maxHeight) {
381
+ maxHeight = contentHeight;
365
382
  }
366
383
  }
367
384
 
@@ -369,61 +386,90 @@ ContentWrapPlugin.prototype._calculateRowHeightAt = function (section, rowIndex)
369
386
  };
370
387
  /** @private
371
388
  * @param {Object} section ILayoutGrid
389
+ * @param {!Array.<number>} dirtyRows
372
390
  * @param {number=} from
373
391
  * @param {number=} to
374
- * @param {Array.<number>=} opt_dirtyRows
375
- * @return {!Object}
392
+ * @return {number}
376
393
  */
377
394
 
378
395
 
379
- ContentWrapPlugin.prototype._calculateRowHeight = function (section, from, to, opt_dirtyRows) {
380
- if (!from || from < 0) {
396
+ ContentWrapPlugin.prototype._calcMaxRowHeight = function (section, dirtyRows, from, to) {
397
+ if (from == null) {
398
+ from = section.getFirstIndexInView();
399
+ } else if (!from || from < 0) {
381
400
  from = 0;
382
401
  }
383
402
 
384
- var rowCount = section.getRowCount();
403
+ if (to == null) {
404
+ to = section.getLastIndexInView() + 1;
405
+ } else {
406
+ var rowCount = section.getRowCount();
385
407
 
386
- if (!to || to > rowCount) {
387
- to = rowCount;
408
+ if (!to || to > rowCount) {
409
+ to = rowCount;
410
+ }
388
411
  }
389
412
 
390
- var r, h;
391
- var results = {};
413
+ var r;
414
+ var max = 0;
392
415
 
393
- if (this._evenRowHeight) {
394
- var max = 0;
395
-
396
- for (r = from; r < to; ++r) {
397
- h = this._calculateRowHeightAt(section, r);
416
+ for (r = from; r < to; ++r) {
417
+ var h = this._calculateRowHeightAt(section, r);
398
418
 
399
- if (max < h) {
400
- max = h;
401
- }
419
+ if (max < h) {
420
+ max = h;
402
421
  }
422
+ }
403
423
 
404
- results["max"] = max;
405
-
424
+ if (max) {
406
425
  for (r = from; r < to; ++r) {
407
- if (max && opt_dirtyRows && max !== section.getRowHeight(r)) {
408
- opt_dirtyRows.push(r);
426
+ if (max !== section.getRowHeight(r)) {
427
+ dirtyRows.push(r);
409
428
  }
410
429
  }
411
- } else {
412
- var heights = new Array(to);
430
+ }
413
431
 
414
- for (r = from; r < to; ++r) {
415
- h = this._calculateRowHeightAt(section, r);
416
- heights[r] = h;
432
+ return max;
433
+ };
434
+ /** @private
435
+ * @param {Object} section ILayoutGrid
436
+ * @param {!Array.<number>} dirtyRows
437
+ * @param {number=} from
438
+ * @param {number=} to
439
+ * @return {!Array.<number>}
440
+ */
417
441
 
418
- if (h && opt_dirtyRows && h !== section.getRowHeight(r)) {
419
- opt_dirtyRows.push(r);
420
- }
442
+
443
+ ContentWrapPlugin.prototype._calcRowHeights = function (section, dirtyRows, from, to) {
444
+ if (from == null) {
445
+ from = section.getFirstIndexInView();
446
+ } else if (!from || from < 0) {
447
+ from = 0;
448
+ }
449
+
450
+ if (to == null) {
451
+ to = section.getLastIndexInView() + 1;
452
+ } else {
453
+ var rowCount = section.getRowCount();
454
+
455
+ if (!to || to > rowCount) {
456
+ to = rowCount;
421
457
  }
458
+ }
459
+
460
+ var heights = new Array(to);
422
461
 
423
- results["heights"] = heights;
462
+ for (var r = from; r < to; ++r) {
463
+ var h = this._calculateRowHeightAt(section, r);
464
+
465
+ heights[r] = h;
466
+
467
+ if (h && h !== section.getRowHeight(r)) {
468
+ dirtyRows.push(r);
469
+ }
424
470
  }
425
471
 
426
- return results;
472
+ return heights;
427
473
  };
428
474
  /** @private
429
475
  * @param {number} colIndex
@@ -434,7 +480,7 @@ ContentWrapPlugin.prototype._calculateRowHeight = function (section, from, to, o
434
480
  ContentWrapPlugin.prototype._wrapContent = function (colIndex, bool) {
435
481
  this._hosts[0].enableColumnClass(colIndex, "wrap", bool, "content");
436
482
 
437
- this._setReCalculationTimer();
483
+ this._requestRecalculation();
438
484
  };
439
485
  /** @public
440
486
  * @param {number} colIndex
@@ -10,6 +10,8 @@ declare class DragUI {
10
10
 
11
11
  public onThemeLoaded(colors: any): void;
12
12
 
13
+ public setContent(content: any): void;
14
+
13
15
  }
14
16
 
15
17
  export default DragUI;
@@ -9,7 +9,9 @@ import ElfUtil from "./ElfUtil.js";
9
9
  var DragUI = function(options) {
10
10
  this._dragBox = options.dragBox;
11
11
  this._dragBoxIcon = options.dragBoxIcon;
12
-
12
+ this._dragBoxContent = document.createElement("div");
13
+ this._dragBoxContent.className = "drag-box-content";
14
+ this._dragBox.appendChild(this._dragBoxContent);
13
15
  };
14
16
 
15
17
  /** @type {string}
@@ -60,6 +62,10 @@ DragUI.applyThemeColor = function(grid) {
60
62
  */
61
63
  DragUI.prototype.onThemeLoaded = function(colors) {
62
64
  if(!DragUI._styles) {
65
+ var cursor = "grabbing";
66
+ if (ElfUtil.getElfVersion() < 3) {
67
+ cursor = "move";
68
+ }
63
69
  var styles = [ // Main Styles without theme
64
70
  ".tr-row-guideline", [ // Backward compatability of row dragging
65
71
  "position: absolute;",
@@ -104,6 +110,10 @@ DragUI.prototype.onThemeLoaded = function(colors) {
104
110
  "top: 0;",
105
111
  "position: absolute;"
106
112
  ],
113
+ ".drag-box-content", [
114
+ "overflow-x: clip;",
115
+ "text-overflow: ellipsis;"
116
+ ],
107
117
  ".drag-box-icon", [
108
118
  "top: -4px;",
109
119
  "left: 12px;",
@@ -128,7 +138,7 @@ DragUI.prototype.onThemeLoaded = function(colors) {
128
138
  "--grid-void-icon-color: #FFFFFF;"
129
139
  ],
130
140
  ".mouse-dragging .cell:hover", [ // for change mouse cursor when hover header while dragging
131
- "cursor: grabbing !important;"
141
+ "cursor: " + cursor + " !important;"
132
142
  ],
133
143
  ".tr-grid .column .cell.drag-indicator", [ // --grid-drag-indicator defualt is "none"
134
144
  "border-top: var(--grid-drag-indicator) !important;",
@@ -175,27 +185,31 @@ DragUI.prototype.renderDragBox = function (e, grid) {
175
185
  }
176
186
 
177
187
  var gridElem = grid.getElement();
188
+ var dragBoxHost = gridElem;
178
189
  var gridParent = grid.getParent().parentNode;
179
- var pn = this._dragBox.parentNode;
180
- if(!pn) {
181
- gridParent.appendChild(this._dragBox);
190
+ if (gridParent.nodeType === 11) {
191
+ dragBoxHost = gridParent;
182
192
  }
183
193
 
184
- var iconParent = this._dragBoxIcon.parentNode;
194
+ var parent = this._dragBox.parentNode;
195
+ if(!parent) {
196
+ dragBoxHost.appendChild(this._dragBox);
197
+ }
185
198
 
186
- var dragBoxIcon = e.dragBoxIcon || this._dragBox.dragBoxIcon;
199
+ var dragBoxIcon = e.dragBoxIcon || this._dragBox.dragBoxIcon; // The user-supplied icon
187
200
  this._dragBoxIcon.style.visibility = "visible";
201
+ parent = this._dragBoxIcon.parentNode;
188
202
  var drop = true;
189
203
  if(dragBoxIcon === "insertion") {
190
204
  drop = false;
191
205
  this._dragBoxIcon.icon = "add";
192
- if(!iconParent) {
206
+ if(!parent) {
193
207
  this._dragBox.appendChild(this._dragBoxIcon);
194
208
  }
195
209
  } else if (dragBoxIcon === "not-allowed" || dragBoxIcon === "no-drop" || dragBoxIcon === "void" ) {
196
210
  drop = false;
197
211
  this._dragBoxIcon.icon = "void";
198
- if(!iconParent) {
212
+ if(!parent) {
199
213
  this._dragBox.appendChild(this._dragBoxIcon);
200
214
  }
201
215
  } else {
@@ -213,5 +227,21 @@ DragUI.prototype.renderDragBox = function (e, grid) {
213
227
  return drop;
214
228
  };
215
229
 
230
+ /** @public
231
+ * @param {*} content Element, Node, string, number, or everything else.
232
+ */
233
+ DragUI.prototype.setContent = function(content) {
234
+ if (content && content["getElement"]) {
235
+ content = content["getElement"]();
236
+ }
237
+
238
+ var dragBoxContent = this._dragBoxContent;
239
+ var currentContent = dragBoxContent._content;
240
+ if (content !== currentContent) {
241
+ dragBoxContent._content = content;
242
+ Dom.setContent(dragBoxContent, content);
243
+ }
244
+ };
245
+
216
246
  export default DragUI;
217
247
  export {DragUI};