@refinitiv-ui/efx-grid 6.0.92 → 6.0.93
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.
- package/lib/filter-dialog/lib/filter-dialog.js +1 -0
- package/lib/grid/index.js +1 -1
- package/lib/tr-grid-checkbox/es6/Checkbox.js +268 -268
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +1 -2
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +36 -36
- package/lib/tr-grid-column-stack/es6/ColumnStack.js +279 -279
- package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +227 -207
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +11 -11
- package/lib/tr-grid-row-dragging/es6/RowDragging.d.ts +1 -2
- package/lib/tr-grid-row-dragging/es6/RowDragging.js +120 -121
- package/lib/tr-grid-util/es6/CellPainter.js +2 -13
- package/lib/tr-grid-util/es6/DateTime.js +2 -2
- package/lib/tr-grid-util/es6/Delay.d.ts +3 -3
- package/lib/tr-grid-util/es6/Delay.js +13 -2
- package/lib/tr-grid-util/es6/FilterBuilder.js +1 -2
- package/lib/tr-grid-util/es6/GridPlugin.js +0 -1
- package/lib/tr-grid-util/es6/MultiTableManager.js +4 -13
- package/lib/tr-grid-util/es6/NumberFormatter.js +1 -1
- package/lib/tr-grid-util/es6/TextHighlighter.js +3 -3
- package/lib/types/es6/RowDragging.d.ts +1 -2
- package/lib/versions.json +10 -10
- package/package.json +1 -1
@@ -1,10 +1,9 @@
|
|
1
1
|
import { Ext } from "../../tr-grid-util/es6/Ext.js";
|
2
|
-
import { cloneObject } from "../../tr-grid-util/es6/Util.js";
|
3
2
|
import { ElfUtil } from "../../tr-grid-util/es6/ElfUtil.js";
|
4
3
|
import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
|
5
4
|
import Dom from "../../tr-grid-util/es6/Dom.js";
|
6
5
|
import { DragUI } from "../../tr-grid-util/es6/DragUI.js";
|
7
|
-
import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
|
6
|
+
import { cloneObject, injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
|
8
7
|
|
9
8
|
/** @typedef {Object} RowDraggingPlugin~Options
|
10
9
|
* @description Available options describing `rowDragging` object specified in grid's option
|
@@ -65,8 +64,8 @@ import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
|
|
65
64
|
* @property {number} destRowType row type of the drop area. This will be empty string for the end of grid
|
66
65
|
* @example
|
67
66
|
* beforeDataMoved: function(e) {
|
68
|
-
*
|
69
|
-
*
|
67
|
+
* let srcRowType = e.srcRowTypes[0];
|
68
|
+
* let destRowType = e.destRowType;
|
70
69
|
* if(srcRowType === "GROUP_MEMBER" && destRowType === "CONTENT") {
|
71
70
|
* e.cancel = true; // Prevent a group member row from moving outside of its own group
|
72
71
|
* }
|
@@ -78,7 +77,7 @@ import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
|
|
78
77
|
* @param {Object} pos
|
79
78
|
* @return {boolean}
|
80
79
|
*/
|
81
|
-
|
80
|
+
let _isInContentSection = function (pos) {
|
82
81
|
return (pos && pos["sectionType"] === "content") ? true : false;
|
83
82
|
};
|
84
83
|
|
@@ -86,7 +85,7 @@ var _isInContentSection = function (pos) {
|
|
86
85
|
* @param {string} rowType
|
87
86
|
* @return {boolean}
|
88
87
|
*/
|
89
|
-
|
88
|
+
let _isNormalRowType = function (rowType) {
|
90
89
|
if(rowType) {
|
91
90
|
if(rowType === "CONTENT") {
|
92
91
|
return true;
|
@@ -107,8 +106,8 @@ var _isNormalRowType = function (rowType) {
|
|
107
106
|
* @param {RowDraggingPlugin.Options=} options
|
108
107
|
* @extends {GridPlugin}
|
109
108
|
*/
|
110
|
-
|
111
|
-
|
109
|
+
let RowDraggingPlugin = function (options) {
|
110
|
+
let t = this;
|
112
111
|
|
113
112
|
t.startDrag = t.startDrag.bind(t);
|
114
113
|
t.stopDrag = t.stopDrag.bind(t);
|
@@ -283,7 +282,7 @@ RowDraggingPlugin.prototype._entryPoint = "";
|
|
283
282
|
* @private
|
284
283
|
* @param {Object} host core grid instance
|
285
284
|
*/
|
286
|
-
|
285
|
+
let _applyStyles = function(host) {
|
287
286
|
RowDraggingPlugin._applyThemeColor(host);
|
288
287
|
DragUI.applyThemeColor(host);
|
289
288
|
};
|
@@ -356,7 +355,7 @@ RowDraggingPlugin.prototype.initialize = function (host, options) {
|
|
356
355
|
* @param {Object} host core grid instance
|
357
356
|
*/
|
358
357
|
RowDraggingPlugin.prototype.unload = function (host) {
|
359
|
-
|
358
|
+
let at = this._hosts.indexOf(host);
|
360
359
|
if (at < 0) { return; }
|
361
360
|
|
362
361
|
// host.removeAttribute("draggable");
|
@@ -375,7 +374,7 @@ RowDraggingPlugin.prototype.unload = function (host) {
|
|
375
374
|
*/
|
376
375
|
RowDraggingPlugin.prototype._onThemeLoaded = function() {
|
377
376
|
if(!RowDraggingPlugin._styles) {
|
378
|
-
|
377
|
+
let styles = [
|
379
378
|
":host .row-dragging .cover-layer .selection-bound", [
|
380
379
|
"border: var(--grid-drag-indicator)"
|
381
380
|
],
|
@@ -386,9 +385,9 @@ RowDraggingPlugin.prototype._onThemeLoaded = function() {
|
|
386
385
|
RowDraggingPlugin._styles = prettifyCss(styles);
|
387
386
|
}
|
388
387
|
|
389
|
-
|
388
|
+
let colors = ElfUtil.getColors();
|
390
389
|
this._dragUI.onThemeLoaded(colors); // TODO : onThemeLoaded should be static function like DragUI.applyThemeColor
|
391
|
-
for(
|
390
|
+
for(let i = this._hosts.length; --i >= 0;) {
|
392
391
|
_applyStyles(this._hosts[i]);
|
393
392
|
}
|
394
393
|
};
|
@@ -411,14 +410,14 @@ RowDraggingPlugin._applyThemeColor = function(grid) {
|
|
411
410
|
RowDraggingPlugin.prototype.config = function (options) {
|
412
411
|
if (!options) { return; }
|
413
412
|
|
414
|
-
|
413
|
+
let extOptions = options["rowDragging"] || this._legacyRowReorder;
|
415
414
|
if (!extOptions) {
|
416
415
|
return;
|
417
416
|
}
|
418
417
|
|
419
418
|
if (typeof extOptions["dragBoxRenderer"] === "function") {
|
420
419
|
this._dragBoxRenderer = extOptions["dragBoxRenderer"];
|
421
|
-
|
420
|
+
let className = "drag-box";
|
422
421
|
if (ElfUtil.getElfVersion() < 3) {
|
423
422
|
className = "tr-dragbox content-dragging"; // Keep backward compatibility
|
424
423
|
}
|
@@ -429,7 +428,7 @@ RowDraggingPlugin.prototype.config = function (options) {
|
|
429
428
|
|
430
429
|
this._dragBoxEnabled = !!extOptions["dragBox"];
|
431
430
|
|
432
|
-
|
431
|
+
let val = extOptions["mouseInput"];
|
433
432
|
if (val != null) {
|
434
433
|
this._mouseInput = !!val;
|
435
434
|
}
|
@@ -459,9 +458,9 @@ RowDraggingPlugin.prototype.config = function (options) {
|
|
459
458
|
* @returns {!Object}
|
460
459
|
*/
|
461
460
|
RowDraggingPlugin.prototype.getConfigObject = function (out_obj) {
|
462
|
-
|
461
|
+
let obj = out_obj || {};
|
463
462
|
|
464
|
-
|
463
|
+
let extOptions = obj.rowDragging;
|
465
464
|
if(!extOptions) {
|
466
465
|
extOptions = obj.rowDragging = {};
|
467
466
|
}
|
@@ -486,8 +485,8 @@ RowDraggingPlugin.prototype.dragStart = function (rowIndex, mouseEvt) {
|
|
486
485
|
mouseEvt = {};
|
487
486
|
}
|
488
487
|
mouseEvt["type"] = "dragstart";
|
489
|
-
|
490
|
-
|
488
|
+
let core = this._hosts[0];
|
489
|
+
let cell = core ? core.getCell("content", 0, rowIndex) : null;
|
491
490
|
mouseEvt.target = cell ? cell.getElement() : null;
|
492
491
|
this._onMouseDown(mouseEvt);
|
493
492
|
this.startDrag(mouseEvt);
|
@@ -506,9 +505,9 @@ RowDraggingPlugin.prototype.dragMove = function (rowIndex, mouseEvt) {
|
|
506
505
|
}
|
507
506
|
mouseEvt["type"] = "mousemove";
|
508
507
|
mouseEvt["which"] = 1; // Simulation of mouse down and move
|
509
|
-
|
510
|
-
|
511
|
-
|
508
|
+
let core = this._hosts[0];
|
509
|
+
let cell = core ? core.getCell("content", 0, rowIndex) : null;
|
510
|
+
let cellRelativePosition = core.getRelativePosition(cell); // get relative position of cell only when dragging for calculate dragBox
|
512
511
|
|
513
512
|
mouseEvt.clientX = cellRelativePosition.x;
|
514
513
|
mouseEvt.pageY = cellRelativePosition.y;
|
@@ -531,8 +530,8 @@ RowDraggingPlugin.prototype.dragEnd = function (rowIndex, mouseEvt) {
|
|
531
530
|
mouseEvt = {};
|
532
531
|
}
|
533
532
|
mouseEvt["type"] = "mouseup";
|
534
|
-
|
535
|
-
|
533
|
+
let core = this._hosts[0];
|
534
|
+
let cell = core ? core.getCell("content", 0, rowIndex) : null;
|
536
535
|
mouseEvt.target = cell ? cell.getElement() : null;
|
537
536
|
mouseEvt.stopPropagation = function() {};
|
538
537
|
mouseEvt.preventDefault = function() {};
|
@@ -646,12 +645,12 @@ RowDraggingPlugin.prototype.disableDragging = function (disabled) {
|
|
646
645
|
* @param {boolean=} enabled
|
647
646
|
*/
|
648
647
|
RowDraggingPlugin.prototype.enableJETDragAndDrop = function (enabled) {
|
649
|
-
|
648
|
+
let val = enabled !== false;
|
650
649
|
if(this._jetDnD === val) { return; }
|
651
650
|
|
652
651
|
this._jetDnD = val;
|
653
652
|
|
654
|
-
|
653
|
+
let jet = window["JET"];
|
655
654
|
if (jet) {
|
656
655
|
//If ContainerDescription is undefined, that means JET is not initalized. Mostlikely the app
|
657
656
|
//is running the local development mode without container. Disable dnd in this case
|
@@ -684,13 +683,13 @@ RowDraggingPlugin.prototype.getJETDragContent = function () {
|
|
684
683
|
RowDraggingPlugin.prototype.setJETDragContent = function (content) {
|
685
684
|
this._jetDragContent = content;
|
686
685
|
|
687
|
-
|
688
|
-
|
689
|
-
|
686
|
+
let tr = window["tr"];
|
687
|
+
let grid = (tr) ? tr["grid"] : null;
|
688
|
+
let JetDragContent = (grid) ? grid["JetDragContent"] : null;
|
690
689
|
if (content && JetDragContent) {
|
691
|
-
|
692
|
-
|
693
|
-
|
690
|
+
let jetDragContentMgr = new JetDragContent(content);
|
691
|
+
let rics = jetDragContentMgr["getRicsToDrop"]();
|
692
|
+
let fields = jetDragContentMgr["getFieldsToDrop"]();
|
694
693
|
|
695
694
|
this._jetContentHasRic = (rics && rics.length > 0) ? true : false;
|
696
695
|
this._jetContentHasField = (fields && fields.length > 0) ? true : false;
|
@@ -705,12 +704,12 @@ RowDraggingPlugin.prototype.setJETDragContent = function (content) {
|
|
705
704
|
* @return {!Object}
|
706
705
|
*/
|
707
706
|
RowDraggingPlugin.prototype._hitTest = function (e) {
|
708
|
-
|
707
|
+
let host = this.getRelativeGrid(e);
|
709
708
|
if (host) {
|
710
|
-
|
709
|
+
let pos;
|
711
710
|
if (e.changedTouches) {
|
712
711
|
// https://stackoverflow.com/questions/3918842/how-to-find-out-the-actual-event-target-of-touchmove-javascript-event
|
713
|
-
|
712
|
+
let touchPos = e.changedTouches[0];
|
714
713
|
pos = host.getRelativePosition(
|
715
714
|
document.elementFromPoint(
|
716
715
|
touchPos.clientX, touchPos.clientY
|
@@ -746,8 +745,8 @@ RowDraggingPlugin.prototype._onDragStart = function (e, fromJET) {
|
|
746
745
|
|
747
746
|
this._listenAbortActions(false); // Unlisen abort action
|
748
747
|
|
749
|
-
|
750
|
-
|
748
|
+
let useJetDragStart = false;
|
749
|
+
let jet = window["JET"];
|
751
750
|
if (fromJET) {
|
752
751
|
useJetDragStart = true;
|
753
752
|
} else {
|
@@ -774,8 +773,8 @@ RowDraggingPlugin.prototype._onDragStart = function (e, fromJET) {
|
|
774
773
|
window.addEventListener("touchcancel", this._onDragEnd, false);
|
775
774
|
|
776
775
|
if (this._touchMode) {
|
777
|
-
for (
|
778
|
-
|
776
|
+
for (let i = this._hosts.length; --i >= 0;) {
|
777
|
+
let host = this._hosts[i];
|
779
778
|
host.getVScrollbar().disableTouchInput();
|
780
779
|
host.getHScrollbar().disableTouchInput();
|
781
780
|
}
|
@@ -783,20 +782,20 @@ RowDraggingPlugin.prototype._onDragStart = function (e, fromJET) {
|
|
783
782
|
|
784
783
|
// Update UI, grid cursor and guideline
|
785
784
|
if (!this._uiDisabled) { //disabledUI
|
786
|
-
|
785
|
+
let grid = this._pos["grid"] || null;
|
787
786
|
if (!grid) return;
|
788
787
|
|
789
788
|
if (this._dataTransfer) {
|
790
|
-
|
791
|
-
|
789
|
+
let rowIndex = this._pos["rowIndex"];
|
790
|
+
let dv = grid.getDataSource();
|
792
791
|
this._startingRid = dv.getRowId(rowIndex);
|
793
792
|
this._startingGrid = grid;
|
794
|
-
|
795
|
-
|
793
|
+
let api = this.getGridApi();
|
794
|
+
let rowType = api.getRowType(rowIndex);
|
796
795
|
this._startingRowType = rowType;
|
797
796
|
|
798
797
|
if (this._dragBoxRenderer) { // For custom drag box rendering
|
799
|
-
|
798
|
+
let arg = cloneObject(e); // TODO: Check if cloning is necessary
|
800
799
|
arg.dragBox = this._dragBox;
|
801
800
|
arg.dataRow = this._getRowData(dv.getRowDataAt(rowIndex));
|
802
801
|
|
@@ -811,14 +810,14 @@ RowDraggingPlugin.prototype._onDragStart = function (e, fromJET) {
|
|
811
810
|
// TODO: Just update curser will not gonna work since cell is pointer-events: none;
|
812
811
|
// we should do something to overwrite pointer-events first
|
813
812
|
// then set cursor move will have an effect
|
814
|
-
|
813
|
+
let gridElem = grid.getElement();
|
815
814
|
gridElem.classList.add("mouse-dragging");
|
816
815
|
gridElem.classList.add("row-dragging");
|
817
816
|
|
818
817
|
this._updateGuidePosition();
|
819
818
|
|
820
819
|
if (this._autoScroll) {
|
821
|
-
|
820
|
+
let scrollbar = grid.getVScrollbar();
|
822
821
|
this._topBound = scrollbar.getTop() + 50;
|
823
822
|
this._btmBound = scrollbar.getTop() + scrollbar.getHeight() - 50;
|
824
823
|
|
@@ -857,7 +856,7 @@ RowDraggingPlugin.prototype._onMouseMove = function (e) {
|
|
857
856
|
this._pos.dragBoxIcon = "void";
|
858
857
|
}
|
859
858
|
|
860
|
-
|
859
|
+
let dropable = true;
|
861
860
|
if(this._entryPoint === 'JET' && !this._jetContentHasRic) {
|
862
861
|
dropable = false;
|
863
862
|
}
|
@@ -869,7 +868,7 @@ RowDraggingPlugin.prototype._onMouseMove = function (e) {
|
|
869
868
|
this._dispatch("drag", this._pos);
|
870
869
|
if(!this._uiDisabled && dropable) {
|
871
870
|
e.dragBoxIcon = this._pos.dragBoxIcon; // access event object instread of element for prevent element persistence
|
872
|
-
|
871
|
+
let drop = this._dragUI.renderDragBox(e, this._startingGrid);
|
873
872
|
if(!drop) { // can not be drop or not allow to drop or insertion
|
874
873
|
this.cancelDrag();
|
875
874
|
}
|
@@ -897,31 +896,31 @@ RowDraggingPlugin.prototype._onDragEnd = function (e) {
|
|
897
896
|
window.removeEventListener("touchcancel", this._onDragEnd, false);
|
898
897
|
|
899
898
|
if (this._touchMode) {
|
900
|
-
for (
|
901
|
-
|
899
|
+
for (let i = this._hosts.length; --i >= 0;) {
|
900
|
+
let host = this._hosts[i];
|
902
901
|
host.getVScrollbar().disableTouchInput(false);
|
903
902
|
host.getHScrollbar().disableTouchInput(false);
|
904
903
|
}
|
905
904
|
}
|
906
905
|
|
907
|
-
|
906
|
+
let srcGrid = this._startingGrid || this._hosts[0];
|
908
907
|
|
909
|
-
|
908
|
+
let srcGridElem = srcGrid.getElement();
|
910
909
|
srcGridElem.classList.remove("mouse-dragging");
|
911
910
|
srcGridElem.classList.remove("row-dragging");
|
912
911
|
|
913
|
-
|
912
|
+
let destPos = this._pos; // This can be null
|
914
913
|
if(!this._isDragCancelled()) {
|
915
914
|
destPos["srcGrid"] = srcGrid; // destPos is always valid at this point
|
916
915
|
// WARNING: dropTarget is not correct for element in a shadow root
|
917
916
|
destPos["dropTarget"] = e ? e.target : null;
|
918
917
|
|
919
918
|
if (!this._jetDnD && this._dataTransfer && _isInContentSection(this._pos)) {
|
920
|
-
|
921
|
-
|
919
|
+
let destGrid = destPos["grid"] || srcGrid;
|
920
|
+
let destRowIndex = destPos["rowIndex"];
|
922
921
|
|
923
|
-
|
924
|
-
|
922
|
+
let rowSelection = srcGrid.getPlugin("RowSelectionPlugin");
|
923
|
+
let srcRowIndices = rowSelection && rowSelection.getSelectedRows();
|
925
924
|
if (!srcRowIndices || !srcRowIndices.length) {
|
926
925
|
// case no row selection or it disabled
|
927
926
|
srcRowIndices = this._startingRid; // Str Type
|
@@ -931,12 +930,12 @@ RowDraggingPlugin.prototype._onDragEnd = function (e) {
|
|
931
930
|
}
|
932
931
|
|
933
932
|
// Extend event property
|
934
|
-
|
935
|
-
|
933
|
+
let cellElement = destPos["cellElement"];
|
934
|
+
let isRight = 0;
|
936
935
|
|
937
936
|
if (e && cellElement) {
|
938
|
-
|
939
|
-
|
937
|
+
let rect = cellElement.getBoundingClientRect();
|
938
|
+
let offsetX = (e["clientX"] - rect["left"]) / destPos["zoomFactor"];
|
940
939
|
isRight = Math.round(offsetX / cellElement.offsetWidth);
|
941
940
|
}
|
942
941
|
|
@@ -959,11 +958,11 @@ RowDraggingPlugin.prototype._onDragEnd = function (e) {
|
|
959
958
|
* @return {number}
|
960
959
|
*/
|
961
960
|
RowDraggingPlugin.prototype._moveRows = function (srcRowRef, destRowIndex, srcGrid, destGrid, evtArg) {
|
962
|
-
|
963
|
-
|
964
|
-
|
961
|
+
let srcRowIndices = null;
|
962
|
+
let srcDv = srcGrid.getDataSource();
|
963
|
+
let destDv = destGrid.getDataSource();
|
965
964
|
if(typeof srcRowRef === "string") {
|
966
|
-
|
965
|
+
let srcRowIndex = srcDv.getRowIndex(this._startingRid);
|
967
966
|
if(srcRowIndex >= 0) {
|
968
967
|
srcRowIndices = [srcRowIndex];
|
969
968
|
}
|
@@ -976,18 +975,18 @@ RowDraggingPlugin.prototype._moveRows = function (srcRowRef, destRowIndex, srcGr
|
|
976
975
|
}
|
977
976
|
|
978
977
|
// Available row types are ["CONTENT", "CHAIN", "CONSTITUENT", "GROUP_HEADER", "SUBGROUP_HEADER", "GROUP_MEMBER"]
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
978
|
+
let i, len;
|
979
|
+
let srcCount = srcRowIndices.length;
|
980
|
+
let srcRowIds = new Array(srcCount);
|
981
|
+
let srcRowTypes = [];
|
982
|
+
let conRowType = "";
|
983
|
+
let api = this.getGridApi();
|
985
984
|
if(api && !api.getRowType) {
|
986
985
|
api = null;
|
987
986
|
}
|
988
987
|
for(i = 0; i < srcCount; ++i) {
|
989
|
-
|
990
|
-
|
988
|
+
let srcIndex = srcRowIndices[i];
|
989
|
+
let rowType = api ? api.getRowType(srcIndex) : "CONTENT";
|
991
990
|
srcRowIds[i] = srcDv.getRowId(srcIndex);
|
992
991
|
srcRowTypes[i] = rowType;
|
993
992
|
if(conRowType) {
|
@@ -1001,9 +1000,9 @@ RowDraggingPlugin.prototype._moveRows = function (srcRowRef, destRowIndex, srcGr
|
|
1001
1000
|
if(!conRowType) {
|
1002
1001
|
conRowType = "CONTENT";
|
1003
1002
|
}
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1003
|
+
let destRowType = api ? api.getRowType(destRowIndex) : ""; // TODO: this has to be get from destGrid
|
1004
|
+
let destRowId = destDv.getRowId(destRowIndex);
|
1005
|
+
let parentRowId, childRowIds;
|
1007
1006
|
|
1008
1007
|
if(this.hasListener("beforeDataMoved")) {
|
1009
1008
|
evtArg["srcRowIndices"] = srcRowIndices;
|
@@ -1019,8 +1018,8 @@ RowDraggingPlugin.prototype._moveRows = function (srcRowRef, destRowIndex, srcGr
|
|
1019
1018
|
}
|
1020
1019
|
}
|
1021
1020
|
|
1022
|
-
|
1023
|
-
|
1021
|
+
let rsp = srcGrid.getPlugin("RowSegmentingPlugin");
|
1022
|
+
let movedRowIds = null;
|
1024
1023
|
if(srcGrid === destGrid) { // TODO: Support wrap mode
|
1025
1024
|
if(conRowType === "MIXED") {
|
1026
1025
|
movedRowIds = srcDv.moveRow(srcRowIds, destRowId);
|
@@ -1048,15 +1047,15 @@ RowDraggingPlugin.prototype._moveRows = function (srcRowRef, destRowIndex, srcGr
|
|
1048
1047
|
}
|
1049
1048
|
} else if(conRowType === "GROUP_MEMBER") {
|
1050
1049
|
if(srcCount === 1) {
|
1051
|
-
|
1050
|
+
let srcRowId = srcRowIds[0];
|
1052
1051
|
parentRowId = rsp.getSegmentParentRowId(srcRowId);
|
1053
1052
|
childRowIds = rsp.getSegmentChildIds(parentRowId);
|
1054
|
-
|
1055
|
-
|
1053
|
+
let childCount = childRowIds ? childRowIds.length : 0;
|
1054
|
+
let endOfSegment = srcDv.getRowIndex(parentRowId) + childCount + 1;
|
1056
1055
|
if(destRowIndex === endOfSegment) {
|
1057
1056
|
movedRowIds = srcDv.moveRow(srcRowIds, destRowId);
|
1058
1057
|
} else if(destRowType === "GROUP_MEMBER") {
|
1059
|
-
|
1058
|
+
let destParentRowId = rsp.getSegmentParentRowId(destRowId);
|
1060
1059
|
if(parentRowId === destParentRowId) {
|
1061
1060
|
movedRowIds = srcDv.moveRow(srcRowIds, destRowId);
|
1062
1061
|
} else { // Moving row between two segments
|
@@ -1079,9 +1078,9 @@ RowDraggingPlugin.prototype._moveRows = function (srcRowRef, destRowIndex, srcGr
|
|
1079
1078
|
movedRowIds = srcRowIds;
|
1080
1079
|
evtArg["destGrid"] = destGrid;
|
1081
1080
|
|
1082
|
-
|
1081
|
+
let originalRows = [];
|
1083
1082
|
for(i = 0; i < srcCount; ++i) {
|
1084
|
-
|
1083
|
+
let rowData = srcDv.getRowData(rowId);
|
1085
1084
|
if(rowData) {
|
1086
1085
|
originalRows.push(rowData);
|
1087
1086
|
}
|
@@ -1091,7 +1090,7 @@ RowDraggingPlugin.prototype._moveRows = function (srcRowRef, destRowIndex, srcGr
|
|
1091
1090
|
srcDv.removeRows(srcRowIndices);
|
1092
1091
|
if(this._realTimeGrid) {
|
1093
1092
|
for(i = 0; i < len; ++i) {
|
1094
|
-
|
1093
|
+
let rowDef = originalRows[i]["ROW_DEF"];
|
1095
1094
|
rowDef.registerToView(destDv, destRowId);
|
1096
1095
|
}
|
1097
1096
|
} else {
|
@@ -1102,7 +1101,7 @@ RowDraggingPlugin.prototype._moveRows = function (srcRowRef, destRowIndex, srcGr
|
|
1102
1101
|
}
|
1103
1102
|
}
|
1104
1103
|
|
1105
|
-
|
1104
|
+
let moveCount = movedRowIds ? movedRowIds.length : 0;
|
1106
1105
|
if(moveCount) {
|
1107
1106
|
evtArg["originRowId"] = movedRowIds[0];
|
1108
1107
|
evtArg["originRowIds"] = movedRowIds;
|
@@ -1123,7 +1122,7 @@ RowDraggingPlugin.prototype._isDragCancelled = function () {
|
|
1123
1122
|
* @param {Event=} e
|
1124
1123
|
*/
|
1125
1124
|
RowDraggingPlugin.prototype._updateGuidePosition = function (e) {
|
1126
|
-
|
1125
|
+
let pos = this._pos;
|
1127
1126
|
if (this._uiDisabled || !pos || pos["invalidTarget"]) {
|
1128
1127
|
return;
|
1129
1128
|
}
|
@@ -1133,27 +1132,27 @@ RowDraggingPlugin.prototype._updateGuidePosition = function (e) {
|
|
1133
1132
|
}
|
1134
1133
|
|
1135
1134
|
if (_isInContentSection(pos)) {
|
1136
|
-
|
1137
|
-
//
|
1138
|
-
|
1139
|
-
|
1135
|
+
let guideline = this._guideline;
|
1136
|
+
// let grid = pos["grid"];
|
1137
|
+
let section = pos["section"];
|
1138
|
+
let pn = section.getColumnHost(); // This is to hide out of view guideline
|
1140
1139
|
if (pn !== guideline.parentNode) {
|
1141
1140
|
guideline.style.width = section.getWidth() + "px";
|
1142
1141
|
pn.appendChild(guideline);
|
1143
1142
|
}
|
1144
1143
|
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1144
|
+
let cellElement = pos["cellElement"];
|
1145
|
+
let relativePos = Dom.getRelativePosition(cellElement, pn);
|
1146
|
+
let cellTop = relativePos["y"];
|
1147
|
+
let rowIndex = pos["rowIndex"];
|
1148
|
+
let offsetY = 0;
|
1150
1149
|
|
1151
1150
|
if(rowIndex) {
|
1152
1151
|
offsetY = -1; // Make guideline stay on top of the target cell
|
1153
1152
|
if(e) { // MouseEvent or TouchEvent
|
1154
|
-
|
1153
|
+
let lastRow = section.getRowCount() - 1;
|
1155
1154
|
if(rowIndex >= lastRow) { // bottommost row
|
1156
|
-
|
1155
|
+
let rowHeight = section.getRowHeight(lastRow);
|
1157
1156
|
relativePos = Dom.getRelativePosition(e, cellElement);
|
1158
1157
|
if(relativePos["y"] >= (rowHeight / 2) | 0) {
|
1159
1158
|
offsetY = rowHeight - 3; // TODO: Use actual guideline height for the offset
|
@@ -1174,7 +1173,7 @@ RowDraggingPlugin.prototype._updateGuidePosition = function (e) {
|
|
1174
1173
|
*/
|
1175
1174
|
RowDraggingPlugin.prototype._shouldPreventDrop = function (destRowRef) {
|
1176
1175
|
|
1177
|
-
|
1176
|
+
let api = this.getGridApi();
|
1178
1177
|
if(!api) { // It should not move the row if api doesn't initialize
|
1179
1178
|
return false;
|
1180
1179
|
}
|
@@ -1183,16 +1182,16 @@ RowDraggingPlugin.prototype._shouldPreventDrop = function (destRowRef) {
|
|
1183
1182
|
return true;
|
1184
1183
|
}
|
1185
1184
|
|
1186
|
-
|
1187
|
-
|
1185
|
+
let grid = this._pos["grid"];
|
1186
|
+
let rsp = grid.getPlugin("RowSegmentingPlugin");
|
1188
1187
|
if(!rsp) { // If row segment extension is not used, row drag and drop will not be protected by default.
|
1189
1188
|
return false;
|
1190
1189
|
}
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1190
|
+
let destParentId = rsp.getSegmentParentRowId(destRowRef);
|
1191
|
+
let startingParentId = rsp.getSegmentParentRowId(this._startingRid);
|
1192
|
+
let destParentType;
|
1194
1193
|
if(this._startingRowType === "GROUP_MEMBER") {
|
1195
|
-
|
1194
|
+
let startingParentType = api.getRowType(startingParentId);
|
1196
1195
|
if(startingParentType === "SUBGROUP_HEADER") {
|
1197
1196
|
destParentType = api.getRowType(destParentId);
|
1198
1197
|
|
@@ -1217,7 +1216,7 @@ RowDraggingPlugin.prototype._shouldPreventDrop = function (destRowRef) {
|
|
1217
1216
|
}
|
1218
1217
|
}
|
1219
1218
|
|
1220
|
-
|
1219
|
+
let destRowType = api.getRowType(destRowRef);
|
1221
1220
|
if(destRowType === "CONSTITUENT" || destRowType === "SUBGROUP_HEADER") { // Do not allow dropping this type when starting with any row types
|
1222
1221
|
return true;
|
1223
1222
|
}
|
@@ -1253,19 +1252,19 @@ RowDraggingPlugin.prototype._onDragPulse = function () {
|
|
1253
1252
|
this._dispatch("dragInterval", this._pos);
|
1254
1253
|
|
1255
1254
|
// Manage vertical scrollbar
|
1256
|
-
|
1255
|
+
let primaryHost = this._pos["grid"] || this._startingGrid;
|
1257
1256
|
if (!primaryHost || !primaryHost.getVScrollbar().isActive()) {
|
1258
1257
|
return;
|
1259
1258
|
}
|
1260
1259
|
|
1261
|
-
|
1260
|
+
let y = this._pos["y"];
|
1262
1261
|
if (y == null) { return; }
|
1263
1262
|
|
1264
1263
|
if (y >= this._topBound && y <= this._btmBound) {
|
1265
1264
|
this._scrollingZone = false;
|
1266
1265
|
} else {
|
1267
1266
|
this._scrollingZone = true;
|
1268
|
-
|
1267
|
+
let scrollVal = (this._scrollStep * (0.8 + Math.random())) | 0;
|
1269
1268
|
|
1270
1269
|
if (y < this._topBound) {
|
1271
1270
|
scrollVal = -scrollVal;
|
@@ -1280,13 +1279,13 @@ RowDraggingPlugin.prototype._onDragPulse = function () {
|
|
1280
1279
|
RowDraggingPlugin.prototype.setJETDragContent = function (content) {
|
1281
1280
|
this._jetDragContent = content;
|
1282
1281
|
|
1283
|
-
|
1284
|
-
|
1285
|
-
|
1282
|
+
let t = window["tr"];
|
1283
|
+
let g = (t) ? t["grid"] : null;
|
1284
|
+
let jdc = (g) ? g["JetDragContent"] : null;
|
1286
1285
|
if (content && jdc) {
|
1287
|
-
|
1288
|
-
|
1289
|
-
|
1286
|
+
let jetDragContentMgr = new jdc(content);
|
1287
|
+
let rics = jetDragContentMgr["getRicsToDrop"]();
|
1288
|
+
let fields = jetDragContentMgr["getFieldsToDrop"]();
|
1290
1289
|
|
1291
1290
|
this._jetContentHasRic = (rics && rics.length > 0) ? true : false;
|
1292
1291
|
this._jetContentHasField = (fields && fields.length > 0) ? true : false;
|
@@ -1308,7 +1307,7 @@ RowDraggingPlugin.prototype._setEntryPoint = function (str) {
|
|
1308
1307
|
*/
|
1309
1308
|
RowDraggingPlugin.prototype._onMouseOut = function (e) {
|
1310
1309
|
e = e ? e : window.event;
|
1311
|
-
|
1310
|
+
let from = e.relatedTarget || e.toElement;
|
1312
1311
|
if (!from || from.nodeName == "HTML") {
|
1313
1312
|
// window.console.warn("Left window");
|
1314
1313
|
|
@@ -1363,13 +1362,13 @@ RowDraggingPlugin.prototype._startDrag = function (delayStart, startRef, fromJET
|
|
1363
1362
|
if (this._dragging || this._hosts.length <= 0) { return; }
|
1364
1363
|
if (this._disabled) { return; }
|
1365
1364
|
|
1366
|
-
|
1365
|
+
let pos;
|
1367
1366
|
if (startRef) {
|
1368
1367
|
if (startRef.type === "dragstart") {
|
1369
1368
|
if (startRef["preventDefault"]) {
|
1370
1369
|
Dom.preventDefault(startRef);
|
1371
1370
|
}
|
1372
|
-
|
1371
|
+
let host = this.getRelativeGrid(startRef);
|
1373
1372
|
if (host) {
|
1374
1373
|
pos = host.getRelativePosition(this._dragTarget);
|
1375
1374
|
}
|
@@ -1377,7 +1376,7 @@ RowDraggingPlugin.prototype._startDrag = function (delayStart, startRef, fromJET
|
|
1377
1376
|
pos = this._hitTest(startRef);
|
1378
1377
|
}
|
1379
1378
|
} else {
|
1380
|
-
|
1379
|
+
let target = this._dragTarget || this._hosts[0].getSection("content").getCell(0, 0);
|
1381
1380
|
pos = this._hitTest(target);
|
1382
1381
|
}
|
1383
1382
|
|
@@ -568,11 +568,7 @@ CellPainter._colorTextCondition = function(field, rowData) {
|
|
568
568
|
* @return {undefined|number}
|
569
569
|
*/
|
570
570
|
CellPainter._tickColorTextCondition = function(field, rowData) {
|
571
|
-
|
572
|
-
if(code) {
|
573
|
-
return code;
|
574
|
-
}
|
575
|
-
return; // eslint-disable-line
|
571
|
+
return TickCodes[rowData[field]];
|
576
572
|
};
|
577
573
|
/** @private
|
578
574
|
* @this {Object}
|
@@ -613,11 +609,7 @@ CellPainter._heatMapCondition = function(rowData, min, max) {
|
|
613
609
|
* @return {undefined|number}
|
614
610
|
*/
|
615
611
|
CellPainter._tickBlinkCondition = function(newValue) {
|
616
|
-
|
617
|
-
if(code) {
|
618
|
-
return code;
|
619
|
-
}
|
620
|
-
return; // eslint-disable-line
|
612
|
+
return TickCodes[newValue];
|
621
613
|
};
|
622
614
|
/** @private
|
623
615
|
* @function
|
@@ -946,7 +938,6 @@ CellPainter._setUpDownColors = function(scp, upColor, downColor, levelColor, wit
|
|
946
938
|
if(withContrast) {
|
947
939
|
scp["contrastUpColor"] = CellPainter.getOppositeColor(upColor);
|
948
940
|
}
|
949
|
-
//scp["rgbUp"] = CellPainter.hex2Rgb(upColor);
|
950
941
|
}
|
951
942
|
|
952
943
|
scp["downColor"] = downColor;
|
@@ -954,7 +945,6 @@ CellPainter._setUpDownColors = function(scp, upColor, downColor, levelColor, wit
|
|
954
945
|
if(withContrast) {
|
955
946
|
scp["contrastDownColor"] = CellPainter.getOppositeColor(downColor);
|
956
947
|
}
|
957
|
-
//scp["rgbDown"] = CellPainter.hex2Rgb(downColor);
|
958
948
|
}
|
959
949
|
|
960
950
|
scp["levelColor"] = levelColor;
|
@@ -962,7 +952,6 @@ CellPainter._setUpDownColors = function(scp, upColor, downColor, levelColor, wit
|
|
962
952
|
if(withContrast) {
|
963
953
|
scp["contrastLevelColor"] = CellPainter.getOppositeColor(levelColor);
|
964
954
|
}
|
965
|
-
//scp["rgbLevel"] = CellPainter.hex2Rgb(levelColor);
|
966
955
|
}
|
967
956
|
};
|
968
957
|
/** @private
|