@refinitiv-ui/efx-grid 6.0.149 → 6.0.150

Sign up to get free protection for your applications and to get access to all the features.
@@ -61,8 +61,8 @@ import { DragUI } from "../../tr-grid-util/es6/DragUI.js";
61
61
  * @param {ColumnDraggingPlugin~Options=} options
62
62
  * @extends {GridPlugin}
63
63
  */
64
- var ColumnDraggingPlugin = function (options) {
65
- var t = this;
64
+ let ColumnDraggingPlugin = function (options) {
65
+ let t = this;
66
66
  t._onMouseUp = t._onMouseUp.bind(t);
67
67
  t._onMouseDown = t._onMouseDown.bind(t);
68
68
 
@@ -70,7 +70,6 @@ var ColumnDraggingPlugin = function (options) {
70
70
  t._onDragStart = t._onDragStart.bind(t);
71
71
  t._onDragEnd = t._onDragEnd.bind(t);
72
72
  t._onDragPulse = t._onDragPulse.bind(t);
73
- t._onThemeLoaded = t._onThemeLoaded.bind(t);
74
73
 
75
74
  t._hosts = [];
76
75
 
@@ -231,19 +230,17 @@ ColumnDraggingPlugin.prototype.initialize = function (host, options) {
231
230
  dragBoxIcon: this._dragBoxIcon
232
231
  });
233
232
 
234
- // Share dragging styles
235
- if(DragUI.stylePromise) {
236
- DragUI.applyThemeColor(host);
237
- } else {
238
- DragUI.stylePromise = ElfUtil.getThemeColors();
239
- DragUI.stylePromise.then(this._onThemeLoaded).catch(this._onThemeLoaded);
240
- }
233
+ ElfUtil.getThemeColors().then(
234
+ ColumnDraggingPlugin._onThemeLoaded.bind(null, host)
235
+ ).catch(
236
+ ColumnDraggingPlugin._onThemeLoaded.bind(null, host)
237
+ );
241
238
  };
242
239
  /** @public
243
240
  * @param {Object=} host core grid instance
244
241
  */
245
242
  ColumnDraggingPlugin.prototype.unload = function (host) {
246
- var at = this._hosts.indexOf(host);
243
+ let at = this._hosts.indexOf(host);
247
244
  if (at < 0) {
248
245
  return;
249
246
  }
@@ -262,8 +259,10 @@ ColumnDraggingPlugin.prototype.unload = function (host) {
262
259
  };
263
260
 
264
261
  /** @private
262
+ * @function
263
+ * @param {Object} grid Core grid instance
265
264
  */
266
- ColumnDraggingPlugin.prototype._onThemeLoaded = function() {
265
+ ColumnDraggingPlugin._onThemeLoaded = function(grid) {
267
266
  if(!ColumnDraggingPlugin._styles) {
268
267
  let styles = [
269
268
  ".multi-column-drag-indicator .section.title .cover-layer .column-bound.selection-bound ", [
@@ -280,16 +279,13 @@ ColumnDraggingPlugin.prototype._onThemeLoaded = function() {
280
279
  ColumnDraggingPlugin._styles = prettifyCss(styles);
281
280
  }
282
281
 
283
- let colors = ElfUtil.getColors();
284
- this._dragUI.onThemeLoaded(colors); // TODO : onThemeLoaded should be static function like DragUI.applyThemeColor
285
- for(let i = this._hosts.length; --i >= 0;) {
286
- let host = this._hosts[i];
287
- ColumnDraggingPlugin._applyThemeColor(host);
288
- DragUI.applyThemeColor(host);
289
- }
282
+ DragUI.initStyles();
283
+ ColumnDraggingPlugin._applyThemeColor(grid);
284
+ DragUI.applyThemeColor(grid);
290
285
  };
286
+
291
287
  /** @private
292
- * @param {Object} grid core grid instance
288
+ * @param {Object} grid Core grid instance
293
289
  */
294
290
  ColumnDraggingPlugin._applyThemeColor = function(grid) {
295
291
  if(!grid || grid._columnDraggingStyles) {
@@ -307,7 +303,7 @@ ColumnDraggingPlugin._applyThemeColor = function(grid) {
307
303
  ColumnDraggingPlugin.prototype.config = function (options) {
308
304
  if (!options) { return; }
309
305
 
310
- var noColumnDragging = options["noColumnDragging"];
306
+ let noColumnDragging = options["noColumnDragging"];
311
307
  if (noColumnDragging == null && options["columnReorder"] != null) {
312
308
  noColumnDragging = !options["columnReorder"];
313
309
  }
@@ -315,7 +311,7 @@ ColumnDraggingPlugin.prototype.config = function (options) {
315
311
  this._disabled = noColumnDragging ? true : false;
316
312
  }
317
313
 
318
- var extOptions = options.columnDragging;
314
+ let extOptions = options.columnDragging;
319
315
  if (!extOptions) { return; }
320
316
 
321
317
  if (typeof extOptions["dragBoxRenderer"] === "function") {
@@ -336,15 +332,15 @@ ColumnDraggingPlugin.prototype.config = function (options) {
336
332
  * @return {!Object}
337
333
  */
338
334
  ColumnDraggingPlugin.prototype.getConfigObject = function (gridOptions) {
339
- var obj = gridOptions || {};
335
+ let obj = gridOptions || {};
340
336
 
341
337
  if(this._disabled) {
342
338
  obj.noColumnDragging = true;
343
339
  }
344
340
 
345
- var extOptions = obj.columnDragging;
341
+ let extOptions = obj.columnDragging;
346
342
  if(!extOptions) {
347
- extOptions = obj.columnDragging = {};
343
+ extOptions = obj.columnDragging = {}; // TO_DO: This is unnecessary
348
344
  }
349
345
 
350
346
  return obj;
@@ -392,9 +388,9 @@ ColumnDraggingPlugin.prototype.disableDragBox = function(disabled) {
392
388
  * @return {boolean}
393
389
  */
394
390
  ColumnDraggingPlugin.prototype._isAllowed = function(colIndex) {
395
- var host = this._clickedGrid || this._hosts[0];
391
+ let host = this._clickedGrid || this._hosts[0];
396
392
  if (host) {
397
- var stationaryIndex = host.getStationaryColumnIndex();
393
+ let stationaryIndex = host.getStationaryColumnIndex();
398
394
  if (stationaryIndex < 0) {
399
395
  return true;
400
396
  }
@@ -476,7 +472,7 @@ ColumnDraggingPlugin.prototype._onMouseDown = function (e) {
476
472
  return; // Drag timer is already start
477
473
  }
478
474
 
479
- var host = this.getRelativeGrid(e);
475
+ let host = this.getRelativeGrid(e);
480
476
  if(!host) {
481
477
  return; // Given event should be within grid element
482
478
  }
@@ -486,14 +482,14 @@ ColumnDraggingPlugin.prototype._onMouseDown = function (e) {
486
482
  return; // Only start dragging when mouse is down on the grid
487
483
  }
488
484
 
489
- var section = this._pos["section"];
485
+ let section = this._pos["section"];
490
486
  if(!section) {
491
487
  return; // The section that is not in the target section list cannot be dragged
492
488
  } else if(this._pos["sectionType"] !== "title") {
493
489
  return; // Sections other than title section cannot be dragged by default
494
490
  }
495
491
 
496
- var colIndex = this._pos["colIndex"];
492
+ let colIndex = this._pos["colIndex"];
497
493
  if(!this._isAllowed(colIndex)) {
498
494
  return; // The column cannot be dragged
499
495
  }
@@ -501,9 +497,9 @@ ColumnDraggingPlugin.prototype._onMouseDown = function (e) {
501
497
  return; // If the lock frag is on, frozen columns cannot be dragged
502
498
  }
503
499
 
504
- var rowIndex = this._pos["rowIndex"]; // rowIndex may not exist
505
- var movableBorder = this._findMoveableBorder(colIndex, rowIndex - 1, section);
506
- var movingColumns = this._getSpan(colIndex, rowIndex, section);
500
+ let rowIndex = this._pos["rowIndex"]; // rowIndex may not exist
501
+ let movableBorder = this._findMoveableBorder(colIndex, rowIndex - 1, section);
502
+ let movingColumns = this._getSpan(colIndex, rowIndex, section);
507
503
 
508
504
  this._clickedGrid = host;
509
505
  this._clickedSection = section;
@@ -597,12 +593,12 @@ ColumnDraggingPlugin.prototype._onDragStart = function (e) {
597
593
  window.addEventListener("mousemove", this._onDrag, false); // TODO: support touch operation
598
594
  window.addEventListener("mouseup", this._onDragEnd, true);
599
595
 
600
- var host = this._clickedGrid;
601
- var height = host.getHeight();
602
- var sectionBound = this._clickedSection.getBoundingClientRect();
603
- var clickedCellBound = this._clickedSection.getCell(this._startColumn, this._clickedRow).getBoundingClientRect();
596
+ let host = this._clickedGrid;
597
+ let height = host.getHeight();
598
+ let sectionBound = this._clickedSection.getBoundingClientRect();
599
+ let clickedCellBound = this._clickedSection.getCell(this._startColumn, this._clickedRow).getBoundingClientRect();
604
600
 
605
- var gridElem = host.getElement();
601
+ let gridElem = host.getElement();
606
602
  this._guideline.style.top = (clickedCellBound.top - sectionBound.top) + "px";
607
603
  this._guideline.style.height = (height - 1) + "px";
608
604
 
@@ -614,10 +610,10 @@ ColumnDraggingPlugin.prototype._onDragStart = function (e) {
614
610
  gridElem.appendChild(this._guideline);
615
611
 
616
612
  if (this._dragBoxRenderer) { // For custom drag box rendering
617
- var arg = cloneObject(e); // TODO: Check if cloning is necessary
618
- var id = this.getColumnId(this._startColumn);
619
- var index = this.getColumnIndex(id);
620
- var field = this._getField(this._startColumn);
613
+ let arg = cloneObject(e); // TODO: Check if cloning is necessary
614
+ let id = this.getColumnId(this._startColumn);
615
+ let index = this.getColumnIndex(id);
616
+ let field = this._getField(this._startColumn);
621
617
 
622
618
  arg.dragBox = this._dragBox;
623
619
  arg.columnData = {
@@ -641,7 +637,7 @@ ColumnDraggingPlugin.prototype._onDragStart = function (e) {
641
637
  } else if(this._scrollStep > 400) {
642
638
  this._scrollStep = 400;
643
639
  }
644
- var scrollbar = host.getHScrollbar();
640
+ let scrollbar = host.getHScrollbar();
645
641
  this._cacheLeft = scrollbar.getLeft() + 20;
646
642
  this._cacheWidth = scrollbar.getLeft() + scrollbar.getWidth() - 20;
647
643
 
@@ -659,7 +655,7 @@ ColumnDraggingPlugin.prototype._onDrag = function (e) {
659
655
  var host = this.getRelativeGrid(e);
660
656
  if (!host || host !== this._clickedGrid) { return; }
661
657
 
662
- var colIndex = this._pos["colIndex"];
658
+ let colIndex = this._pos["colIndex"];
663
659
  if ((colIndex >= this._leftMovableBorder) &&
664
660
  (colIndex <= this._rightMovableBorder) &&
665
661
  this._isAllowed(colIndex) &&
@@ -685,7 +681,7 @@ ColumnDraggingPlugin.prototype._onDragEnd = function (e) {
685
681
  // document.body.classList.remove("tr-move-cursor");
686
682
  this._dimCol(false);
687
683
 
688
- var pn = this._guideline.parentNode;
684
+ let pn = this._guideline.parentNode;
689
685
  if(pn) {
690
686
  pn.removeChild(this._guideline);
691
687
  }
@@ -704,11 +700,11 @@ ColumnDraggingPlugin.prototype._onDragEnd = function (e) {
704
700
  window.clearInterval(this._dragPulseId);
705
701
  this._dragPulseId = 0;
706
702
  }
707
- var destPos = this._pos;
703
+ let destPos = this._pos;
708
704
  this._pos = null;
709
705
 
710
706
  preventDefault(e);
711
- var operationCancelled = false;
707
+ let operationCancelled = false;
712
708
  if(destPos["cancel"]) {
713
709
  operationCancelled = true;
714
710
  }
@@ -728,7 +724,7 @@ ColumnDraggingPlugin.prototype._onDragEnd = function (e) {
728
724
  operationCancelled = true;
729
725
  }
730
726
 
731
- var arg = null;
727
+ let arg = null;
732
728
 
733
729
  if(!operationCancelled) {
734
730
  arg = {
@@ -786,13 +782,14 @@ ColumnDraggingPlugin.prototype._moveColumns = function (srcColIndices, destColum
786
782
  let colList = [];
787
783
  let csp = this._getPlugin("ColumnStackPlugin");
788
784
  let stackId, groupId;
785
+ let i;
789
786
  if(srcCount === 1) {
790
787
  if(csp) {
791
788
  stackId = csp.getStackId(this._startColumn);
792
789
  }
793
790
  let cgp = this._getPlugin("ColumnGroupingPlugin");
794
791
  if(cgp){
795
- var cellInfo = cgp.getCellInfo(this._startPos);
792
+ let cellInfo = cgp.getCellInfo(this._startPos);
796
793
  groupId = cellInfo["groupId"] || cellInfo["columnId"];
797
794
  }
798
795
 
@@ -801,15 +798,14 @@ ColumnDraggingPlugin.prototype._moveColumns = function (srcColIndices, destColum
801
798
  } else if(groupId) {
802
799
  cgp.moveGroup(groupId, destColumnIndex);
803
800
  } else {
804
- for(let i = this._startColumn; i <= this._endColumn; i++){
801
+ for(i = this._startColumn; i <= this._endColumn; i++){
805
802
  colList.push(i);
806
803
  }
807
804
  }
808
805
  } else {
809
806
  let stacking = {}; // Object to optimize call column stack api repeatly
810
- for (let i = 0; i < srcCount; i++) {
807
+ for (i = 0; i < srcCount; i++) {
811
808
  let srcIdx = srcColIndices[i];
812
- let srcId = this.getColumnId(srcIdx);
813
809
 
814
810
  if(csp) {
815
811
  stackId = csp.getStackId(srcIdx);
@@ -822,12 +818,13 @@ ColumnDraggingPlugin.prototype._moveColumns = function (srcColIndices, destColum
822
818
  colList.push(colId);
823
819
  }
824
820
  } else {
821
+ let srcId = this.getColumnId(srcIdx);
825
822
  colList.push(srcId); // Normal case
826
823
  }
827
824
  }
828
825
  }
829
- for(let i = this._hosts.length; --i >= 0;) {
830
- var host = this._hosts[i];
826
+ for(i = this._hosts.length; --i >= 0;) {
827
+ let host = this._hosts[i];
831
828
  host.reorderColumns(colList, destColumnIndex);
832
829
  }
833
830
  };
@@ -839,11 +836,11 @@ ColumnDraggingPlugin.prototype._onDragPulse = function() {
839
836
 
840
837
  this._dispatch("dragInterval", this._pos);
841
838
 
842
- var host = this._clickedGrid;
839
+ let host = this._clickedGrid;
843
840
  if(!host || !host.getHScrollbar().isActive()) { return; }
844
841
 
845
- var x = this._pos["x"];
846
- var scrollVal = 0;
842
+ let x = this._pos["x"];
843
+ let scrollVal = 0;
847
844
  if(x < this._cacheLeft) {
848
845
  scrollVal = -Math.floor(this._scrollStep * (0.8 + Math.random()));
849
846
 
@@ -851,8 +848,8 @@ ColumnDraggingPlugin.prototype._onDragPulse = function() {
851
848
  scrollVal = Math.floor(this._scrollStep * (0.8 + Math.random()));
852
849
  }
853
850
 
854
- var len = this._hosts ? this._hosts.length : 0;
855
- for(var i = 0; i < len; ++i) {
851
+ let len = this._hosts ? this._hosts.length : 0;
852
+ for(let i = 0; i < len; ++i) {
856
853
  this._hosts[i].scrollRight(scrollVal);
857
854
  }
858
855
  };
@@ -876,7 +873,7 @@ ColumnDraggingPlugin.prototype._clearCache = function() {
876
873
  * @return {!Object}
877
874
  */
878
875
  ColumnDraggingPlugin.prototype._getSpan = function(colIndex, row, section) {
879
- var cellSpan = section.getCellColSpan(colIndex, row);
876
+ let cellSpan = section.getCellColSpan(colIndex, row);
880
877
 
881
878
  if (cellSpan <= 0) { // The specified cell is being occupied
882
879
  colIndex += cellSpan; // Convert the given negative index to the spanning cell
@@ -895,7 +892,7 @@ ColumnDraggingPlugin.prototype._findMoveableBorder = function(col, row, section)
895
892
  if (row < 0 || (!row && row !== 0)) { // Guaranteed to get out of infinite loop by checking undefined, NaN, null
896
893
  return { "left": 0, "right": (section.getColumnCount() - 1) };
897
894
  }
898
- var span = this._getSpan(col, row, section);
895
+ let span = this._getSpan(col, row, section);
899
896
  if (span["right"] >= span["left"]) {
900
897
  return span;
901
898
  } else {
@@ -906,29 +903,29 @@ ColumnDraggingPlugin.prototype._findMoveableBorder = function(col, row, section)
906
903
  * @private
907
904
  */
908
905
  ColumnDraggingPlugin.prototype._renderGuideline = function() {
909
- var colIndex = this._pos["colIndex"];
906
+ let colIndex = this._pos["colIndex"];
910
907
  if(colIndex == null || colIndex < 0) { // undefined, null or negative number
911
908
  return;
912
909
  }
913
910
 
914
- var currentSpan = this._getSpan(colIndex, this._clickedRow, this._clickedSection);
915
- var colStart = currentSpan["left"]; // This can be different from colIndex
916
- var colEnd = currentSpan["right"];
917
- var colLeft = this._clickedGrid.getColumnLeft(colStart);
918
- var colWidth = 0;
919
- for(var i = colStart; i <= colEnd; ++i) {
911
+ let currentSpan = this._getSpan(colIndex, this._clickedRow, this._clickedSection);
912
+ let colStart = currentSpan["left"]; // This can be different from colIndex
913
+ let colEnd = currentSpan["right"];
914
+ let colLeft = this._clickedGrid.getColumnLeft(colStart);
915
+ let colWidth = 0;
916
+ for(let i = colStart; i <= colEnd; ++i) {
920
917
  colWidth += this._clickedGrid.getColumnWidth(i);
921
918
  }
922
919
 
923
- var rightHand = this._pos["x"] > colLeft + colWidth / 2;
924
- var destColumn = (rightHand) ? colEnd + 1 : colStart;
920
+ let rightHand = this._pos["x"] > colLeft + colWidth / 2;
921
+ let destColumn = (rightHand) ? colEnd + 1 : colStart;
925
922
 
926
- var csp = this._getPlugin("ColumnStackPlugin");
923
+ let csp = this._getPlugin("ColumnStackPlugin");
927
924
  if(csp){
928
- var stackId = csp.getStackId(destColumn);
925
+ let stackId = csp.getStackId(destColumn);
929
926
  if(stackId){
930
- var members = csp.getStackMemberIndices(stackId);
931
- var memberCount = members.length;
927
+ let members = csp.getStackMemberIndices(stackId);
928
+ let memberCount = members.length;
932
929
  if(members && memberCount){
933
930
  destColumn = rightHand ? members[memberCount - 1] + 1 : members[0];
934
931
  }
@@ -955,9 +952,9 @@ ColumnDraggingPlugin.prototype._renderGuideline = function() {
955
952
  * @param {boolean} inOut
956
953
  */
957
954
  ColumnDraggingPlugin.prototype._dimCol = function(inOut) {
958
- var host = this._clickedGrid;
959
- var titleCell = host.getSection("title").getColumn(this._startColumn).getCell(this._clickedRow);
960
- var titleCellEl = titleCell.getElement();
955
+ let host = this._clickedGrid;
956
+ let titleCell = host.getSection("title").getColumn(this._startColumn).getCell(this._clickedRow);
957
+ let titleCellEl = titleCell.getElement();
961
958
  if(inOut) {
962
959
  titleCellEl.classList.add("drag-indicator");
963
960
  } else {
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.149" };
3
+ window.EFX_GRID = { version: "6.0.150" };
@@ -144,7 +144,6 @@ let RowDraggingPlugin = function (options) {
144
144
  t._onDragStart = t._onDragStart.bind(t);
145
145
  t._onMouseMove = t._onMouseMove.bind(t);
146
146
  t._onDragEnd = t._onDragEnd.bind(t);
147
- t._onThemeLoaded = t._onThemeLoaded.bind(t);
148
147
 
149
148
  t._onJETDrop = t._onJETDrop.bind(t);
150
149
  t._onJETDragOver = t._onJETDragOver.bind(t);
@@ -303,15 +302,6 @@ RowDraggingPlugin.prototype._jetContentHasField = false;
303
302
  */
304
303
  RowDraggingPlugin.prototype._entryPoint = "";
305
304
 
306
- /** Applied theme color in row dragging and dragUI
307
- * @private
308
- * @param {Object} host core grid instance
309
- */
310
- let _applyStyles = function(host) {
311
- RowDraggingPlugin._applyThemeColor(host);
312
- DragUI.applyThemeColor(host);
313
- };
314
-
315
305
  /** Prevent built-in config
316
306
  * @public
317
307
  * @ignore
@@ -365,13 +355,11 @@ RowDraggingPlugin.prototype.initialize = function (host, options) {
365
355
  dragBoxIcon: this._dragBoxIcon
366
356
  });
367
357
 
368
- // Share dragging styles
369
- if(!DragUI.stylePromise) {
370
- DragUI.stylePromise = ElfUtil.getThemeColors();
371
- DragUI.stylePromise.then(this._onThemeLoaded).catch(this._onThemeLoaded);
372
- }
373
- // TODO: Create a manager to manage styles. Currently, we have to use setTimeout to wait for an element to be created before applying styles
374
- setTimeout(_applyStyles.bind(this, host), 0);
358
+ ElfUtil.getThemeColors().then(
359
+ RowDraggingPlugin._onThemeLoaded.bind(null, host)
360
+ ).catch(
361
+ RowDraggingPlugin._onThemeLoaded.bind(null, host)
362
+ );
375
363
 
376
364
  // In case of lazy loading
377
365
  // host.getAllSections("content").forEach(this._registerSection);
@@ -406,8 +394,10 @@ RowDraggingPlugin.prototype.unload = function (host) {
406
394
  };
407
395
 
408
396
  /** @private
397
+ * @function
398
+ * @param {Object} grid Core grid instance
409
399
  */
410
- RowDraggingPlugin.prototype._onThemeLoaded = function() {
400
+ RowDraggingPlugin._onThemeLoaded = function(grid) {
411
401
  if(!RowDraggingPlugin._styles) {
412
402
  let styles = [
413
403
  ":host .row-dragging .cover-layer .selection-bound", [
@@ -420,11 +410,9 @@ RowDraggingPlugin.prototype._onThemeLoaded = function() {
420
410
  RowDraggingPlugin._styles = prettifyCss(styles);
421
411
  }
422
412
 
423
- let colors = ElfUtil.getColors();
424
- this._dragUI.onThemeLoaded(colors); // TODO : onThemeLoaded should be static function like DragUI.applyThemeColor
425
- for(let i = this._hosts.length; --i >= 0;) {
426
- _applyStyles(this._hosts[i]);
427
- }
413
+ DragUI.initStyles();
414
+ RowDraggingPlugin._applyThemeColor(grid);
415
+ DragUI.applyThemeColor(grid);
428
416
  };
429
417
  /** @private
430
418
  * @param {Object} grid core grid instance
@@ -10,6 +10,8 @@ declare class DragUI {
10
10
 
11
11
  public onThemeLoaded(colors: any): void;
12
12
 
13
+ public static initStyles(colors?: any): void;
14
+
13
15
  public setContent(content: any): void;
14
16
 
15
17
  }
@@ -36,12 +36,11 @@ DragUI.prototype._dragBoxIcon = null;
36
36
  */
37
37
  DragUI.prototype._grid = null;
38
38
 
39
- /** @public
39
+ /** Apply the theme colors to the specified grid after DragUI.initStyles
40
+ * @public
40
41
  * @param {Object} grid core grid instance
41
42
  */
42
43
  DragUI.applyThemeColor = function(grid) {
43
- // This call after onThemeLoaded from extensions initialize
44
-
45
44
  if(!grid || grid._dragUIStyles) {
46
45
  return;
47
46
  }
@@ -49,19 +48,31 @@ DragUI.applyThemeColor = function(grid) {
49
48
  if(DragUI._styles) {
50
49
  grid._dragUIStyles = true; // Prevent loading the same style twice
51
50
  injectCss(DragUI._styles, grid.getElement());
52
- } else {
53
- // TODO : Handle if can not load DragUI._styles try to set new DragUI._styles
54
- // Warning: This process have to use ElfUtil.getThemeColors() that async process for Backward compatability.
55
- // When use async process, then it can be load theme multiple times.
56
-
57
51
  }
52
+ // TO_DO : Handle if can not load DragUI._styles try to set new DragUI._styles
53
+ // Warning: This process have to use ElfUtil.getThemeColors() that async process for Backward compatability.
54
+ // When use async process, then it can be load theme multiple times.
58
55
  };
59
56
 
60
- /** @public
57
+ /** Deprecated in favor of DragUI.initStyles()
58
+ * @public
61
59
  * @param {Object} colors
62
60
  */
63
61
  DragUI.prototype.onThemeLoaded = function(colors) {
62
+ DragUI.initStyles(colors);
63
+ };
64
+
65
+ /** WARNING: This method should be called after the theme has been loaded in order to initialize with the correct colors.
66
+ * @public
67
+ * @function
68
+ * @param {Object=} colors
69
+ */
70
+ DragUI.initStyles = function(colors) {
64
71
  if(!DragUI._styles) {
72
+ if(!colors) {
73
+ colors = ElfUtil.getColors();
74
+ }
75
+
65
76
  let ElfVersion = ElfUtil.getElfVersion();
66
77
  let cursor = "grabbing";
67
78
  if (ElfVersion < 3) {
package/lib/versions.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
- "tr-grid-util": "1.3.174",
2
+ "tr-grid-util": "1.3.175",
3
3
  "tr-grid-printer": "1.0.18",
4
- "@grid/column-dragging": "1.0.21",
4
+ "@grid/column-dragging": "1.0.22",
5
5
  "@grid/row-segmenting": "2.0.2",
6
6
  "@grid/statistics-row": "1.0.17",
7
7
  "@grid/zoom": "1.0.13",
@@ -23,7 +23,7 @@
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",
26
- "tr-grid-row-dragging": "1.0.38",
26
+ "tr-grid-row-dragging": "1.0.39",
27
27
  "tr-grid-row-filtering": "1.0.89",
28
28
  "tr-grid-row-grouping": "1.0.88",
29
29
  "tr-grid-row-selection": "1.0.33",
package/package.json CHANGED
@@ -69,5 +69,5 @@
69
69
  "publishConfig": {
70
70
  "access": "public"
71
71
  },
72
- "version": "6.0.149"
72
+ "version": "6.0.150"
73
73
  }