@refinitiv-ui/efx-grid 6.0.31 → 6.0.32
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/core/dist/core.js +291 -116
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/grid/Core.js +53 -28
- package/lib/core/es6/grid/ILayoutGrid.js +3 -3
- package/lib/core/es6/grid/LayoutGrid.js +67 -23
- package/lib/core/es6/grid/VirtualizedLayoutGrid.js +92 -55
- package/lib/core/es6/grid/util/SelectionList.d.ts +6 -2
- package/lib/core/es6/grid/util/SelectionList.js +76 -7
- package/lib/grid/index.js +1 -1
- package/lib/statistics-row/es6/StatisticsRow.d.ts +25 -25
- package/lib/statistics-row/es6/StatisticsRow.js +9 -4
- package/lib/tr-grid-column-selection/es6/ColumnSelection.d.ts +2 -0
- package/lib/tr-grid-column-selection/es6/ColumnSelection.js +14 -0
- package/lib/tr-grid-row-dragging/es6/RowDragging.d.ts +23 -1
- package/lib/tr-grid-row-dragging/es6/RowDragging.js +339 -40
- package/lib/versions.json +3 -3
- package/package.json +1 -1
@@ -4,42 +4,42 @@ import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
|
|
4
4
|
declare namespace StatisticsRowPlugin {
|
5
5
|
|
6
6
|
type Options = {
|
7
|
-
rows?: any[],
|
8
|
-
invalidText?: string,
|
9
|
-
noColoring?: boolean,
|
10
|
-
noFormatting?: boolean,
|
11
|
-
postCalculation?: ((...params: any[]) => any),
|
12
|
-
postRendering?: ((...params: any[]) => any)
|
7
|
+
rows?: any[]|null,
|
8
|
+
invalidText?: string|null,
|
9
|
+
noColoring?: boolean|null,
|
10
|
+
noFormatting?: boolean|null,
|
11
|
+
postCalculation?: ((...params: any[]) => any)|null,
|
12
|
+
postRendering?: ((...params: any[]) => any)|null
|
13
13
|
};
|
14
14
|
|
15
15
|
type ColumnOptions = {
|
16
|
-
statistics?: (boolean|string)
|
16
|
+
statistics?: (boolean|string)|null
|
17
17
|
};
|
18
18
|
|
19
19
|
type RowOptions = {
|
20
|
-
placement?: string,
|
21
|
-
statistic?: string,
|
22
|
-
label?: string,
|
23
|
-
id?: string
|
20
|
+
placement?: string|null,
|
21
|
+
statistic?: string|null,
|
22
|
+
label?: string|null,
|
23
|
+
id?: string|null
|
24
24
|
};
|
25
25
|
|
26
|
-
type RowReference = string|number;
|
26
|
+
type RowReference = string|number|null;
|
27
27
|
|
28
28
|
type Stats = {
|
29
|
-
field?: string,
|
30
|
-
label?: boolean,
|
31
|
-
count?: number,
|
32
|
-
sum?: number,
|
33
|
-
average?: number,
|
34
|
-
min?: number,
|
35
|
-
max?: number
|
29
|
+
field?: string|null,
|
30
|
+
label?: boolean|null,
|
31
|
+
count?: number|null,
|
32
|
+
sum?: number|null,
|
33
|
+
average?: number|null,
|
34
|
+
min?: number|null,
|
35
|
+
max?: number|null
|
36
36
|
};
|
37
37
|
|
38
38
|
}
|
39
39
|
|
40
40
|
declare class StatisticsRowPlugin extends GridPlugin {
|
41
41
|
|
42
|
-
constructor(options?: StatisticsRowPlugin.Options);
|
42
|
+
constructor(options?: StatisticsRowPlugin.Options|null);
|
43
43
|
|
44
44
|
public getName(): string;
|
45
45
|
|
@@ -51,15 +51,15 @@ declare class StatisticsRowPlugin extends GridPlugin {
|
|
51
51
|
|
52
52
|
public getConfigObject(gridOptions?: any): any;
|
53
53
|
|
54
|
-
public setStatisticsRows(rows: (StatisticsRowPlugin.RowOptions)[]): void;
|
54
|
+
public setStatisticsRows(rows: (StatisticsRowPlugin.RowOptions)[]|null): void;
|
55
55
|
|
56
|
-
public getStatisticsRows(): (StatisticsRowPlugin.RowOptions)[];
|
56
|
+
public getStatisticsRows(): (StatisticsRowPlugin.RowOptions)[]|null;
|
57
57
|
|
58
|
-
public setStatisticsRow(rowRef: StatisticsRowPlugin.RowReference, options: StatisticsRowPlugin.RowOptions): boolean;
|
58
|
+
public setStatisticsRow(rowRef: StatisticsRowPlugin.RowReference|null, options: StatisticsRowPlugin.RowOptions|null): boolean;
|
59
59
|
|
60
|
-
public addStatisticsRow(options: StatisticsRowPlugin.RowOptions): void;
|
60
|
+
public addStatisticsRow(options: StatisticsRowPlugin.RowOptions|null): void;
|
61
61
|
|
62
|
-
public removeStatisticsRow(rowRef: StatisticsRowPlugin.RowReference): void;
|
62
|
+
public removeStatisticsRow(rowRef: StatisticsRowPlugin.RowReference|null): void;
|
63
63
|
|
64
64
|
}
|
65
65
|
|
@@ -734,13 +734,13 @@ StatisticsRowPlugin.prototype._renderStatistics = function (colIndex, stats, act
|
|
734
734
|
|
735
735
|
var r, rowCount;
|
736
736
|
if(this._headerSect) {
|
737
|
-
rowCount = this.
|
737
|
+
rowCount = this._headerRows.length;
|
738
738
|
for(r = 0; r < rowCount; ++r) {
|
739
739
|
this._headerRows[r].cell = this._headerSect.getCell(colIndex, r);
|
740
740
|
}
|
741
741
|
}
|
742
742
|
if(this._footerSect) {
|
743
|
-
rowCount = this.
|
743
|
+
rowCount = this._footerRows.length;
|
744
744
|
for(r = 0; r < rowCount; ++r) {
|
745
745
|
this._footerRows[r].cell = this._footerSect.getCell(colIndex, r);
|
746
746
|
}
|
@@ -752,6 +752,11 @@ StatisticsRowPlugin.prototype._renderStatistics = function (colIndex, stats, act
|
|
752
752
|
var row = rows[r];
|
753
753
|
var txt = null;
|
754
754
|
|
755
|
+
var cell = row.cell;
|
756
|
+
if(cell == null) {
|
757
|
+
continue;
|
758
|
+
}
|
759
|
+
|
755
760
|
var statistic = row.statistic;
|
756
761
|
if(stats.label) {
|
757
762
|
txt = row.label;
|
@@ -770,12 +775,12 @@ StatisticsRowPlugin.prototype._renderStatistics = function (colIndex, stats, act
|
|
770
775
|
if(this._ccExt && !this._noColoring) {
|
771
776
|
var rowData = row.cachedData;
|
772
777
|
rowData[stats.field] = num;
|
773
|
-
this._ccExt.applyColor(colIndex,
|
778
|
+
this._ccExt.applyColor(colIndex, cell, rowData, actualUpdate);
|
774
779
|
}
|
775
780
|
}
|
776
781
|
}
|
777
782
|
|
778
|
-
|
783
|
+
cell.setContent(txt);
|
779
784
|
row.cell = null;
|
780
785
|
}
|
781
786
|
};
|
@@ -1333,6 +1333,20 @@ ColumnSelectionPlugin.prototype._dispatchSelectionChanged = function (e, colInde
|
|
1333
1333
|
"event": e
|
1334
1334
|
});
|
1335
1335
|
};
|
1336
|
+
/** @public
|
1337
|
+
*/
|
1338
|
+
|
1339
|
+
|
1340
|
+
ColumnSelectionPlugin.prototype.dispatchSelectionChanged = function () {
|
1341
|
+
var selectedCols = this.getSelectedColumns();
|
1342
|
+
var colIndex = selectedCols.length ? selectedCols[0] : -1;
|
1343
|
+
|
1344
|
+
this._dispatch("selectionChanged", {
|
1345
|
+
"selectedCols": selectedCols,
|
1346
|
+
"colIndex": colIndex,
|
1347
|
+
"grid": this._activeGrid
|
1348
|
+
});
|
1349
|
+
};
|
1336
1350
|
|
1337
1351
|
export default ColumnSelectionPlugin;
|
1338
1352
|
export { ColumnSelectionPlugin, ColumnSelectionPlugin as ColumnSelection, ColumnSelectionPlugin as ColumnSelectionExtension };
|
@@ -39,7 +39,7 @@ declare class RowDraggingPlugin extends GridPlugin {
|
|
39
39
|
|
40
40
|
public getConfigObject(out_obj?: any): any;
|
41
41
|
|
42
|
-
public startDrag(startRef
|
42
|
+
public startDrag(startRef?: any): void;
|
43
43
|
|
44
44
|
public stopDrag(): void;
|
45
45
|
|
@@ -53,6 +53,28 @@ declare class RowDraggingPlugin extends GridPlugin {
|
|
53
53
|
|
54
54
|
public disableUIs(disabled?: boolean|null): void;
|
55
55
|
|
56
|
+
public allowDrag(allowed?: boolean|null): void;
|
57
|
+
|
58
|
+
public allowDrop(allowed?: boolean|null): void;
|
59
|
+
|
60
|
+
public setDragContent(content: any): void;
|
61
|
+
|
62
|
+
public getDragBox(): Element|null;
|
63
|
+
|
64
|
+
public getDragSource(): string;
|
65
|
+
|
66
|
+
public isDragging(): boolean;
|
67
|
+
|
68
|
+
public disableDragging(disabled?: boolean|null): void;
|
69
|
+
|
70
|
+
public enableJETDragAndDrop(enabled?: boolean|null): void;
|
71
|
+
|
72
|
+
public getJETDragContent(): any;
|
73
|
+
|
74
|
+
public setJETDragContent(content: any): void;
|
75
|
+
|
76
|
+
public setJETDragContent(content: any): void;
|
77
|
+
|
56
78
|
}
|
57
79
|
|
58
80
|
export default RowDraggingPlugin;
|
@@ -75,6 +75,10 @@ var RowDraggingPlugin = function (options) {
|
|
75
75
|
t._onDragEnd = t._onDragEnd.bind(t);
|
76
76
|
t._onThemeLoaded = t._onThemeLoaded.bind(t);
|
77
77
|
|
78
|
+
t._onJETDrop = t._onJETDrop.bind(t);
|
79
|
+
t._onJETDragOver = t._onJETDragOver.bind(t);
|
80
|
+
t._delayStart = t._delayStart.bind(t);
|
81
|
+
|
78
82
|
t._hosts = [];
|
79
83
|
|
80
84
|
t._guideline = document.createElement("div"); // Test IE mouse event, guildline close mouse event
|
@@ -198,6 +202,30 @@ RowDraggingPlugin.prototype._autoScroll = true;
|
|
198
202
|
* @private
|
199
203
|
*/
|
200
204
|
RowDraggingPlugin.prototype._dragUI = null;
|
205
|
+
/** @type {number}
|
206
|
+
* @private
|
207
|
+
*/
|
208
|
+
RowDraggingPlugin.prototype._timerId = -1;
|
209
|
+
/** @type {boolean}
|
210
|
+
* @private
|
211
|
+
*/
|
212
|
+
RowDraggingPlugin.prototype._jetDnD = false;
|
213
|
+
/** @type {Object}
|
214
|
+
* @private
|
215
|
+
*/
|
216
|
+
RowDraggingPlugin.prototype._jetDragContent = null;
|
217
|
+
/** @type {boolean}
|
218
|
+
* @private
|
219
|
+
*/
|
220
|
+
RowDraggingPlugin.prototype._jetContentHasRic = false;
|
221
|
+
/** @type {boolean}
|
222
|
+
* @private
|
223
|
+
*/
|
224
|
+
RowDraggingPlugin.prototype._jetContentHasField = false;
|
225
|
+
/** @type {string}
|
226
|
+
* @private
|
227
|
+
*/
|
228
|
+
RowDraggingPlugin.prototype._entryPoint = "";
|
201
229
|
|
202
230
|
/** @private Applied theme color in row dragging and dragUI
|
203
231
|
* @param {Object} host core grid instance
|
@@ -337,7 +365,11 @@ RowDraggingPlugin.prototype.config = function (options) {
|
|
337
365
|
|
338
366
|
if (typeof extOptions["dragBoxRenderer"] === "function") {
|
339
367
|
this._dragBoxRenderer = extOptions["dragBoxRenderer"];
|
340
|
-
|
368
|
+
var className = "drag-box";
|
369
|
+
if (ElfUtil.getElfVersion() < 3) {
|
370
|
+
className = "tr-dragbox content-dragging"; // Keep backward compatibility
|
371
|
+
}
|
372
|
+
this._dragBox.className = className;
|
341
373
|
} else {
|
342
374
|
this._dragBox.className = "drag-box-disabled"; // set disable drag-box
|
343
375
|
}
|
@@ -389,38 +421,10 @@ RowDraggingPlugin.prototype.getConfigObject = function (out_obj) {
|
|
389
421
|
};
|
390
422
|
|
391
423
|
/** @public
|
392
|
-
* @param {
|
393
|
-
* @param {boolean=} opt_suppressEvent
|
424
|
+
* @param {*=} startRef
|
394
425
|
*/
|
395
426
|
RowDraggingPlugin.prototype.startDrag = function (startRef) {
|
396
|
-
|
397
|
-
if (this._disabled) {
|
398
|
-
return;
|
399
|
-
}
|
400
|
-
|
401
|
-
var pos;
|
402
|
-
if (startRef) {
|
403
|
-
if (startRef.type === "dragstart") {
|
404
|
-
if(startRef["preventDefault"]) {
|
405
|
-
Dom.preventDefault(startRef);
|
406
|
-
}
|
407
|
-
var host = this.getRelativeGrid(startRef);
|
408
|
-
if (host) {
|
409
|
-
pos = host.getRelativePosition(this._dragTarget);
|
410
|
-
}
|
411
|
-
} else {
|
412
|
-
pos = this._hitTest(startRef);
|
413
|
-
}
|
414
|
-
} else {
|
415
|
-
var target = this._dragTarget || this._hosts[0].getSection("content").getCell(0, 0);
|
416
|
-
pos = this._hitTest(target);
|
417
|
-
}
|
418
|
-
|
419
|
-
if (_isInContentSection(pos)) {
|
420
|
-
this._clearCache();
|
421
|
-
this._pos = pos;
|
422
|
-
this._onDragStart(startRef);
|
423
|
-
}
|
427
|
+
this._startDrag(false, startRef); // Start without delay start
|
424
428
|
};
|
425
429
|
/** @public */
|
426
430
|
RowDraggingPlugin.prototype.stopDrag = function () {
|
@@ -469,6 +473,114 @@ RowDraggingPlugin.prototype.disableUIs = function (disabled) {
|
|
469
473
|
this._uiDisabled = disabled !== false;
|
470
474
|
};
|
471
475
|
|
476
|
+
/** @public
|
477
|
+
* @param {boolean=} allowed
|
478
|
+
*/
|
479
|
+
RowDraggingPlugin.prototype.allowDrag = function (allowed) {
|
480
|
+
if(this._pos) {// WARNING: Please note that this method is intent to be used by client, and not for internal use
|
481
|
+
this._pos["invalidTarget"] = (allowed === false);
|
482
|
+
}
|
483
|
+
};
|
484
|
+
|
485
|
+
/** @public
|
486
|
+
* @function
|
487
|
+
* @param {boolean=} allowed
|
488
|
+
*/
|
489
|
+
RowDraggingPlugin.prototype.allowDrop = RowDraggingPlugin.prototype.allowDrag;
|
490
|
+
|
491
|
+
/** @public
|
492
|
+
* @param {*} content Element, Node, string, number, or everything else.
|
493
|
+
*/
|
494
|
+
RowDraggingPlugin.prototype.setDragContent = function (content) {
|
495
|
+
this._dragUI.setContent(content);
|
496
|
+
};
|
497
|
+
|
498
|
+
/** @public
|
499
|
+
* @return {Element}
|
500
|
+
*/
|
501
|
+
RowDraggingPlugin.prototype.getDragBox = function () {
|
502
|
+
return this._dragBox;
|
503
|
+
};
|
504
|
+
|
505
|
+
/** @public
|
506
|
+
* @return {string}
|
507
|
+
*/
|
508
|
+
RowDraggingPlugin.prototype.getDragSource = function () {
|
509
|
+
return this._entryPoint;
|
510
|
+
};
|
511
|
+
|
512
|
+
/** @public
|
513
|
+
* @return {boolean}
|
514
|
+
*/
|
515
|
+
RowDraggingPlugin.prototype.isDragging = function () {
|
516
|
+
return this._dragging;
|
517
|
+
};
|
518
|
+
|
519
|
+
/** @public
|
520
|
+
* @param {boolean=} disabled
|
521
|
+
*/
|
522
|
+
RowDraggingPlugin.prototype.disableDragging = function (disabled) {
|
523
|
+
this._disabled = disabled !== false;
|
524
|
+
};
|
525
|
+
|
526
|
+
/** @public
|
527
|
+
* @param {boolean=} enabled
|
528
|
+
*/
|
529
|
+
RowDraggingPlugin.prototype.enableJETDragAndDrop = function (enabled) {
|
530
|
+
var val = enabled !== false;
|
531
|
+
if(this._jetDnD === val) { return; }
|
532
|
+
|
533
|
+
this._jetDnD = val;
|
534
|
+
|
535
|
+
var jet = window["JET"];
|
536
|
+
if (jet) {
|
537
|
+
//If ContainerDescription is undefined, that means JET is not initalized. Mostlikely the app
|
538
|
+
//is running the local development mode without container. Disable dnd in this case
|
539
|
+
if (jet["ContainerDescription"] && (jet["ContainerDescription"]["name"] !== "EikonNowContainer")) {
|
540
|
+
if (this._jetDnD) {
|
541
|
+
jet["onDrop"](this._onJETDrop);
|
542
|
+
jet["onDragOver"](this._onJETDragOver);
|
543
|
+
jet["onDragLeave"](this.stopDrag);
|
544
|
+
} else {
|
545
|
+
jet["onDrop"](null);
|
546
|
+
jet["onDragOver"](null);
|
547
|
+
jet["onDragLeave"](null);
|
548
|
+
}
|
549
|
+
} else {
|
550
|
+
this._jetDnD = false;
|
551
|
+
}
|
552
|
+
}
|
553
|
+
};
|
554
|
+
|
555
|
+
/** @public
|
556
|
+
* @return {Object}
|
557
|
+
*/
|
558
|
+
RowDraggingPlugin.prototype.getJETDragContent = function () {
|
559
|
+
return this._jetDragContent;
|
560
|
+
};
|
561
|
+
|
562
|
+
/** @public
|
563
|
+
* @param {Object} content
|
564
|
+
*/
|
565
|
+
RowDraggingPlugin.prototype.setJETDragContent = function (content) {
|
566
|
+
this._jetDragContent = content;
|
567
|
+
|
568
|
+
var tr = window["tr"];
|
569
|
+
var grid = (tr) ? tr["grid"] : null;
|
570
|
+
var JetDragContent = (grid) ? grid["JetDragContent"] : null;
|
571
|
+
if (content && JetDragContent) {
|
572
|
+
var jetDragContentMgr = new JetDragContent(content);
|
573
|
+
var rics = jetDragContentMgr["getRicsToDrop"]();
|
574
|
+
var fields = jetDragContentMgr["getFieldsToDrop"]();
|
575
|
+
|
576
|
+
this._jetContentHasRic = (rics && rics.length > 0) ? true : false;
|
577
|
+
this._jetContentHasField = (fields && fields.length > 0) ? true : false;
|
578
|
+
} else {
|
579
|
+
this._jetContentHasRic = false;
|
580
|
+
this._jetContentHasField = false;
|
581
|
+
}
|
582
|
+
};
|
583
|
+
|
472
584
|
/** @private
|
473
585
|
* @param {*} e
|
474
586
|
* @return {!Object}
|
@@ -503,25 +615,41 @@ RowDraggingPlugin.prototype._onMouseDown = function (e) {
|
|
503
615
|
this._touchMode = true;
|
504
616
|
}
|
505
617
|
this._dragTarget = /** @type{Element} */(e.target);
|
618
|
+
this._setEntryPoint("grid");
|
506
619
|
};
|
507
620
|
/** @private
|
508
621
|
* @param {*=} e
|
622
|
+
* @param {boolean=} fromJET
|
509
623
|
*/
|
510
|
-
RowDraggingPlugin.prototype._onDragStart = function (e) {
|
624
|
+
RowDraggingPlugin.prototype._onDragStart = function (e, fromJET) {
|
511
625
|
if (this._dragging) { return; }
|
512
626
|
if (!this._pos) { return; }
|
513
627
|
|
514
|
-
this.
|
515
|
-
|
516
|
-
|
628
|
+
this._listenAbortActions(false); // Unlisen abort action
|
629
|
+
|
630
|
+
var useJetDragStart = false;
|
631
|
+
var jet = window["JET"];
|
632
|
+
if (fromJET) {
|
633
|
+
useJetDragStart = true;
|
634
|
+
} else {
|
635
|
+
this._dispatch("dragStart", /** @type{!Object} */(this._pos));
|
636
|
+
if(this._isDragCancelled()) {
|
637
|
+
return; // User does not allow this drag to happen
|
638
|
+
}
|
639
|
+
if (jet && this._jetDnD && this._jetDragContent) {
|
640
|
+
useJetDragStart = true;
|
641
|
+
jet["dragStart"](this._jetDragContent);
|
642
|
+
}
|
517
643
|
}
|
518
644
|
|
519
645
|
this._dragging = true;
|
520
646
|
// Event listeners
|
521
647
|
document.body.classList.add("tr-dragging"); // Prevent text selection
|
522
648
|
|
523
|
-
|
524
|
-
|
649
|
+
if (!useJetDragStart) { // WARNING: JET wrongly intercepts all mouse events without app's consent
|
650
|
+
window.addEventListener("mousemove", this._onMouseMove, false);
|
651
|
+
window.addEventListener("touchmove", this._onMouseMove, false);
|
652
|
+
}
|
525
653
|
window.addEventListener("mouseup", this._onDragEnd, false);
|
526
654
|
window.addEventListener("touchend", this._onDragEnd, false);
|
527
655
|
window.addEventListener("touchcancel", this._onDragEnd, false);
|
@@ -601,12 +729,20 @@ RowDraggingPlugin.prototype._onMouseMove = function (e) {
|
|
601
729
|
|
602
730
|
this._pos = this._hitTest(e); // A new object is created
|
603
731
|
|
604
|
-
|
732
|
+
var dropable = true;
|
733
|
+
if(this._entryPoint === 'JET' && !this._jetContentHasRic) {
|
734
|
+
dropable = false;
|
735
|
+
}
|
736
|
+
|
737
|
+
if(dropable) {
|
738
|
+
this._updateGuidePosition(e);
|
739
|
+
}
|
740
|
+
|
605
741
|
this._pos.dragBox = this._dragBox; // assign dragBox for user determine valid target
|
606
742
|
|
607
743
|
// Dispatch drag event to let user determine valid drop target using allowDrag (allowDrop) method
|
608
744
|
this._dispatch("drag", this._pos);
|
609
|
-
if(!this._uiDisabled) {
|
745
|
+
if(!this._uiDisabled && dropable) {
|
610
746
|
e.dragBoxIcon = this._pos.dragBoxIcon; // access event object instread of element for prevent element persistence
|
611
747
|
var drop = this._dragUI.renderDragBox(e, this._startingGrid);
|
612
748
|
if(!drop) { // can not be drop or not allow to drop or insertion
|
@@ -655,7 +791,7 @@ RowDraggingPlugin.prototype._onDragEnd = function (e) {
|
|
655
791
|
// WARNING: dropTarget is not correct for element in a shadow root
|
656
792
|
destPos["dropTarget"] = e ? e.target : null;
|
657
793
|
|
658
|
-
if (this._dataTransfer && _isInContentSection(this._pos)) {
|
794
|
+
if (!this._jetDnD && this._dataTransfer && _isInContentSection(this._pos)) {
|
659
795
|
var destGrid = destPos["grid"] || srcGrid;
|
660
796
|
var destRowIndex = destPos["rowIndex"];
|
661
797
|
|
@@ -668,10 +804,26 @@ RowDraggingPlugin.prototype._onDragEnd = function (e) {
|
|
668
804
|
|
669
805
|
this._moveRows(srcRowIndices, destRowIndex, srcGrid, destGrid, destPos);
|
670
806
|
}
|
807
|
+
|
808
|
+
// Extend event property
|
809
|
+
var cellElement = destPos["cellElement"];
|
810
|
+
var isRight = 0;
|
811
|
+
|
812
|
+
if (e && cellElement) {
|
813
|
+
var rect = cellElement.getBoundingClientRect();
|
814
|
+
var offsetX = (e["clientX"] - rect["left"]) / destPos["zoomFactor"];
|
815
|
+
isRight = Math.round(offsetX / cellElement.offsetWidth);
|
816
|
+
}
|
817
|
+
|
818
|
+
destPos["colIndex"] += isRight;
|
819
|
+
destPos["currentPosition"] = destPos; // To support JET requirement
|
820
|
+
destPos["data"] = this._jetDragContent;
|
821
|
+
destPos["dropTarget"] = e.target;
|
671
822
|
}
|
672
823
|
|
673
824
|
this._dispatch("dragEnd", destPos || {}); // Always fire drag end for client to clean up its resource
|
674
825
|
this._clearCache();
|
826
|
+
this._jetDragContent = null;
|
675
827
|
};
|
676
828
|
/** @private
|
677
829
|
* @param {Array.<number>|string} srcRowRef
|
@@ -840,6 +992,153 @@ RowDraggingPlugin.prototype._onDragPulse = function () {
|
|
840
992
|
}
|
841
993
|
};
|
842
994
|
|
995
|
+
/** @public
|
996
|
+
* @param {Object} content
|
997
|
+
*/
|
998
|
+
RowDraggingPlugin.prototype.setJETDragContent = function (content) {
|
999
|
+
this._jetDragContent = content;
|
1000
|
+
|
1001
|
+
var t = window["tr"];
|
1002
|
+
var g = (t) ? t["grid"] : null;
|
1003
|
+
var jdc = (g) ? g["JetDragContent"] : null;
|
1004
|
+
if (content && jdc) {
|
1005
|
+
var jetDragContentMgr = new jdc(content);
|
1006
|
+
var rics = jetDragContentMgr["getRicsToDrop"]();
|
1007
|
+
var fields = jetDragContentMgr["getFieldsToDrop"]();
|
1008
|
+
|
1009
|
+
this._jetContentHasRic = (rics && rics.length > 0) ? true : false;
|
1010
|
+
this._jetContentHasField = (fields && fields.length > 0) ? true : false;
|
1011
|
+
} else {
|
1012
|
+
this._jetContentHasRic = false;
|
1013
|
+
this._jetContentHasField = false;
|
1014
|
+
}
|
1015
|
+
};
|
1016
|
+
/** @private
|
1017
|
+
* @param {string} str
|
1018
|
+
*/
|
1019
|
+
RowDraggingPlugin.prototype._setEntryPoint = function (str) {
|
1020
|
+
this._entryPoint = str;
|
1021
|
+
this.setDragContent(null); // Clear original content
|
1022
|
+
};
|
1023
|
+
|
1024
|
+
/** @private
|
1025
|
+
* @param {Object} e
|
1026
|
+
*/
|
1027
|
+
RowDraggingPlugin.prototype._onMouseOut = function (e) {
|
1028
|
+
e = e ? e : window.event;
|
1029
|
+
var from = e.relatedTarget || e.toElement;
|
1030
|
+
if (!from || from.nodeName == "HTML") {
|
1031
|
+
// window.console.warn("Left window");
|
1032
|
+
|
1033
|
+
/*
|
1034
|
+
* TRGRID-1493
|
1035
|
+
* The DragStart is delayed using a timer (_timerId created by _delayStart )
|
1036
|
+
* The mouse may left the window before the drag start
|
1037
|
+
* In this case we should force the stopDrag to stop the drag on the source
|
1038
|
+
* Because the mouse up will not be handled by the source
|
1039
|
+
*/
|
1040
|
+
|
1041
|
+
// cancel the timer - _onDragStart will not be called by the timer
|
1042
|
+
if(this._timerId >= 0) {
|
1043
|
+
clearTimeout(this._timerId);
|
1044
|
+
this._timerId = -1;
|
1045
|
+
}
|
1046
|
+
|
1047
|
+
this._onDragStart();
|
1048
|
+
this.stopDrag();
|
1049
|
+
}
|
1050
|
+
};
|
1051
|
+
|
1052
|
+
/** @private
|
1053
|
+
* @param {Object} e
|
1054
|
+
*/
|
1055
|
+
RowDraggingPlugin.prototype._delayStart = function (e) {
|
1056
|
+
this._startingGrid.unlisten("mousemove", this._delayStart);
|
1057
|
+
|
1058
|
+
if (this._timerId < 0) {
|
1059
|
+
this._timerId = window.setTimeout(this._onDragStart, 200);
|
1060
|
+
}
|
1061
|
+
if (this._jetDnD) {
|
1062
|
+
document.addEventListener("mouseout", this._onMouseOut, false);
|
1063
|
+
}
|
1064
|
+
};
|
1065
|
+
/** @private
|
1066
|
+
* @param {boolean=} bool
|
1067
|
+
*/
|
1068
|
+
RowDraggingPlugin.prototype._listenAbortActions = function (bool) {
|
1069
|
+
if (bool !== false) {
|
1070
|
+
window.addEventListener("mouseup", this._clearCache, false);
|
1071
|
+
} else {
|
1072
|
+
window.removeEventListener("mouseup", this._clearCache, false);
|
1073
|
+
}
|
1074
|
+
};
|
1075
|
+
/** @private
|
1076
|
+
* @param {boolean=} delayStart
|
1077
|
+
* @param {*=} startRef
|
1078
|
+
* @param {boolean=} fromJET
|
1079
|
+
*/
|
1080
|
+
RowDraggingPlugin.prototype._startDrag = function (delayStart, startRef, fromJET) {
|
1081
|
+
if (this._dragging || this._hosts.length <= 0) { return; }
|
1082
|
+
if (this._disabled) { return; }
|
1083
|
+
|
1084
|
+
var pos;
|
1085
|
+
if (startRef) {
|
1086
|
+
if (startRef.type === "dragstart") {
|
1087
|
+
if (startRef["preventDefault"]) {
|
1088
|
+
Dom.preventDefault(startRef);
|
1089
|
+
}
|
1090
|
+
var host = this.getRelativeGrid(startRef);
|
1091
|
+
if (host) {
|
1092
|
+
pos = host.getRelativePosition(this._dragTarget);
|
1093
|
+
}
|
1094
|
+
} else {
|
1095
|
+
pos = this._hitTest(startRef);
|
1096
|
+
}
|
1097
|
+
} else {
|
1098
|
+
var target = this._dragTarget || this._hosts[0].getSection("content").getCell(0, 0);
|
1099
|
+
pos = this._hitTest(target);
|
1100
|
+
}
|
1101
|
+
|
1102
|
+
if (_isInContentSection(pos)) {
|
1103
|
+
this._clearCache();
|
1104
|
+
this._pos = pos;
|
1105
|
+
this._startingGrid = pos["grid"];
|
1106
|
+
|
1107
|
+
if (delayStart) {
|
1108
|
+
this._startingGrid.listen("mousemove", this._delayStart);
|
1109
|
+
this._listenAbortActions();
|
1110
|
+
} else { // Start immediately
|
1111
|
+
this._onDragStart(startRef, fromJET);
|
1112
|
+
}
|
1113
|
+
}
|
1114
|
+
};
|
1115
|
+
/** @private
|
1116
|
+
* @param {Object} clientPos
|
1117
|
+
*/
|
1118
|
+
RowDraggingPlugin.prototype._onJETDragOver = function (clientPos) {
|
1119
|
+
if (!clientPos) { return; }
|
1120
|
+
|
1121
|
+
if (!this._dragging) {
|
1122
|
+
if (!clientPos["dropData"]) { return; }
|
1123
|
+
this._setEntryPoint("JET");
|
1124
|
+
this.setJETDragContent(clientPos["dropData"]); // WARNING: We have no way to distinguish between dropData from grid and other apps
|
1125
|
+
this._startDrag(false, clientPos["e"], true); // Event is suppressed
|
1126
|
+
} else {
|
1127
|
+
this._onDrag(clientPos["e"]);
|
1128
|
+
}
|
1129
|
+
};
|
1130
|
+
/** @private
|
1131
|
+
* @param {Object} jetObj
|
1132
|
+
*/
|
1133
|
+
RowDraggingPlugin.prototype._onJETDrop = function (jetObj) {
|
1134
|
+
if (!this._dragging) { return; }
|
1135
|
+
|
1136
|
+
if (!this._jetDragContent) {
|
1137
|
+
this._jetDragContent = jetObj; // To maintain original client signature
|
1138
|
+
}
|
1139
|
+
this._onDragEnd(jetObj["mouse"]["srcEvent"]);
|
1140
|
+
};
|
1141
|
+
|
843
1142
|
|
844
1143
|
|
845
1144
|
export default RowDraggingPlugin;
|
package/lib/versions.json
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
"tr-grid-util": "1.3.92",
|
3
3
|
"@grid/column-dragging": "1.0.11",
|
4
4
|
"@grid/row-segmenting": "1.0.23",
|
5
|
-
"@grid/statistics-row": "1.0.
|
5
|
+
"@grid/statistics-row": "1.0.14",
|
6
6
|
"@grid/zoom": "1.0.11",
|
7
7
|
"tr-grid-auto-tooltip": "1.1.5",
|
8
8
|
"tr-grid-cell-selection": "1.0.32",
|
@@ -11,7 +11,7 @@
|
|
11
11
|
"tr-grid-column-formatting": "0.9.34",
|
12
12
|
"tr-grid-column-grouping": "1.0.46",
|
13
13
|
"tr-grid-column-resizing": "1.0.28",
|
14
|
-
"tr-grid-column-selection": "1.0.
|
14
|
+
"tr-grid-column-selection": "1.0.27",
|
15
15
|
"tr-grid-column-stack": "1.0.54",
|
16
16
|
"tr-grid-conditional-coloring": "1.0.58",
|
17
17
|
"tr-grid-content-wrap": "1.0.20",
|
@@ -23,7 +23,7 @@
|
|
23
23
|
"tr-grid-percent-bar": "1.0.22",
|
24
24
|
"tr-grid-printer": "1.0.16",
|
25
25
|
"tr-grid-range-bar": "2.0.3",
|
26
|
-
"tr-grid-row-dragging": "1.0.
|
26
|
+
"tr-grid-row-dragging": "1.0.25",
|
27
27
|
"tr-grid-row-filtering": "1.0.55",
|
28
28
|
"tr-grid-row-grouping": "1.0.80",
|
29
29
|
"tr-grid-row-selection": "1.0.22",
|
package/package.json
CHANGED