@refinitiv-ui/efx-grid 6.0.2 → 6.0.3
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/column-format-dialog/lib/column-format-dialog.d.ts +13 -1
- package/lib/column-selection-dialog/lib/column-selection-dialog.d.ts +15 -2
- package/lib/column-selection-dialog/lib/column-selection-dialog.js +146 -5
- package/lib/core/dist/core.js +65 -27
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/data/DataTable.js +32 -10
- package/lib/core/es6/data/DataView.d.ts +0 -6
- package/lib/core/es6/data/DataView.js +0 -4
- package/lib/core/es6/data/Segment.d.ts +2 -0
- package/lib/core/es6/data/Segment.js +7 -0
- package/lib/core/es6/data/WrappedView.js +6 -6
- package/lib/core/es6/grid/Core.js +15 -7
- package/lib/core/es6/grid/VirtualizedLayoutGrid.js +5 -0
- package/lib/filter-dialog/lib/checkbox-list.d.ts +13 -1
- package/lib/filter-dialog/lib/filter-dialog.d.ts +13 -1
- package/lib/filter-dialog/lib/filter-dialog.js +16 -3
- package/lib/grid/lib/efx-grid.d.ts +22 -10
- package/lib/grid/lib/efx-grid.js +8 -8
- package/lib/grid/themes/base.less +1 -1
- package/lib/grid/themes/halo/dark/efx-grid.js +1 -1
- package/lib/grid/themes/halo/dark/es5/all-elements.js +1 -1
- package/lib/grid/themes/halo/light/efx-grid.js +1 -1
- package/lib/grid/themes/halo/light/es5/all-elements.js +1 -1
- package/lib/grid/themes/solar/charcoal/efx-grid.js +1 -1
- package/lib/grid/themes/solar/charcoal/es5/all-elements.js +1 -1
- package/lib/grid/themes/solar/pearl/efx-grid.js +1 -1
- package/lib/grid/themes/solar/pearl/es5/all-elements.js +1 -1
- package/lib/row-segmenting/es6/RowSegmenting.js +4 -2
- package/lib/rt-grid/dist/rt-grid.js +3 -1
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/Grid.js +3 -1
- package/lib/tr-grid-checkbox/es6/Checkbox.d.ts +2 -1
- package/lib/tr-grid-checkbox/es6/Checkbox.js +13 -1
- package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +5 -1
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.d.ts +1 -1
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +13 -1
- package/lib/tr-grid-row-dragging/es6/RowDragging.d.ts +1 -3
- package/lib/tr-grid-row-dragging/es6/RowDragging.js +65 -60
- package/lib/tr-grid-row-selection/es6/RowSelection.d.ts +8 -8
- package/lib/tr-grid-row-selection/es6/RowSelection.js +32 -22
- package/lib/tr-grid-util/es6/ExpanderIcon.js +2 -2
- package/lib/tr-grid-util/es6/MultiTableManager.d.ts +8 -0
- package/lib/tr-grid-util/es6/MultiTableManager.js +164 -57
- package/lib/tr-grid-util/es6/RowPainter.js +16 -8
- package/lib/tr-grid-util/es6/jsx.d.ts +223 -0
- package/lib/types/es6/Checkbox.d.ts +2 -1
- package/lib/types/es6/Core/data/DataView.d.ts +0 -6
- package/lib/types/es6/Core/data/Segment.d.ts +2 -0
- package/lib/types/es6/InCellEditing.d.ts +1 -1
- package/lib/types/es6/RowDragging.d.ts +1 -3
- package/lib/types/es6/RowSelection.d.ts +8 -8
- package/lib/types/es6/index.d.ts +1 -0
- package/lib/versions.json +10 -10
- package/package.json +1 -1
package/lib/rt-grid/es6/Grid.js
CHANGED
@@ -304,8 +304,11 @@ var Grid = function(placeholder, config) {
|
|
304
304
|
t._dv.listen("pageIndexChanged", t._dispatch.bind(t, "pageIndexChanged"));
|
305
305
|
t._dv.listen("pageCountChanged", t._dispatch.bind(t, "pageCountChanged")); // TODO: When implementing filtered row, it may need to implement the conflator
|
306
306
|
}
|
307
|
+
t._grid.setDataSource(t._dv); // Avoid triggering sorting
|
308
|
+
|
307
309
|
if(t._stp) {
|
308
310
|
this._sharedSorter = true;
|
311
|
+
t._stp.listen("preDataSorting", t._onPreDataSorting);
|
309
312
|
t._grid.loadPlugin(t._stp); // The plugin instance is shared and don't need to be reconfigured.
|
310
313
|
} else { // Create built-in plugin
|
311
314
|
t._stp = new SortableTitlePlugin({
|
@@ -332,7 +335,6 @@ var Grid = function(placeholder, config) {
|
|
332
335
|
t._grid.enableRowHighlighting(true);
|
333
336
|
|
334
337
|
t._addGridSections();
|
335
|
-
t._grid.setDataSource(t._dv);
|
336
338
|
t._grid.setParent(t._topNode);
|
337
339
|
|
338
340
|
t._snapshot = new SnapshotFiller();
|
@@ -12,7 +12,8 @@ declare namespace CheckboxPlugin {
|
|
12
12
|
checkboxCreated?: ((...params: any[]) => any),
|
13
13
|
checkboxBinding?: ((...params: any[]) => any),
|
14
14
|
clicked?: ((...params: any[]) => any),
|
15
|
-
width?: number
|
15
|
+
width?: number,
|
16
|
+
topCheckboxHandler?: boolean
|
16
17
|
};
|
17
18
|
|
18
19
|
type ColumnOptions = {
|
@@ -12,6 +12,7 @@ import {injectCss, prettifyCss, extendObject} from "../../tr-grid-util/es6/Util.
|
|
12
12
|
* @property {Function=} checkboxBinding=null Function handler for checkboxBinding event
|
13
13
|
* @property {Function=} clicked=null Function handler for checkbox clicked event
|
14
14
|
* @property {number=} width=34 Width for checkbox column
|
15
|
+
* @property {boolean=} topCheckboxHandler=true If disabled, when clicked on header row checkbox it will not perform default behavior
|
15
16
|
*/
|
16
17
|
|
17
18
|
/** @typedef {Object} CheckboxPlugin~ColumnOptions
|
@@ -103,6 +104,10 @@ CheckboxPlugin.prototype._disablingField = "CHECK_BOX_DISABLED";
|
|
103
104
|
* @private
|
104
105
|
*/
|
105
106
|
CheckboxPlugin.prototype._autoRowSelection = false;
|
107
|
+
/** @type {boolean}
|
108
|
+
* @private
|
109
|
+
*/
|
110
|
+
CheckboxPlugin.prototype._topCheckboxHandler = true;
|
106
111
|
/** @type {Function}
|
107
112
|
* @private
|
108
113
|
*/
|
@@ -348,6 +353,10 @@ CheckboxPlugin.prototype.config = function (options) {
|
|
348
353
|
if(val) {
|
349
354
|
this._width = val;
|
350
355
|
}
|
356
|
+
val = chkboxOpt["topCheckboxHandler"];
|
357
|
+
if(val != null) {
|
358
|
+
this._topCheckboxHandler = val ? true : false;
|
359
|
+
}
|
351
360
|
|
352
361
|
this.addListener(chkboxOpt, "checkboxCreated");
|
353
362
|
this.addListener(chkboxOpt, "clicked");
|
@@ -695,7 +704,7 @@ CheckboxPlugin.prototype.setAllCheckStates = function (checked) {
|
|
695
704
|
* @see {@link CheckboxPlugin#checkAll}
|
696
705
|
*/
|
697
706
|
CheckboxPlugin.prototype.selectAllPages = function (checked) {
|
698
|
-
var state =
|
707
|
+
var state = checked != null ? checked : true;
|
699
708
|
var host = this._hosts[0];
|
700
709
|
var dv = host ? host.getDataSource() : null;
|
701
710
|
|
@@ -982,6 +991,9 @@ CheckboxPlugin.prototype._getAllCheckboxes = function (sectionSettings, ary) {
|
|
982
991
|
* @param {string} state
|
983
992
|
*/
|
984
993
|
CheckboxPlugin.prototype._setDescendantCheckState = function (sectionSettings, state) {
|
994
|
+
if(!this._topCheckboxHandler){
|
995
|
+
return;
|
996
|
+
}
|
985
997
|
var children = sectionSettings.getChildren();
|
986
998
|
if (children) {
|
987
999
|
for (var i = 0; i < children.length; ++i) {
|
@@ -704,10 +704,14 @@ ConditionalColoringPlugin.prototype.applyColor = function (colIndex, cell, rowDa
|
|
704
704
|
* @param {Object} e
|
705
705
|
*/
|
706
706
|
ConditionalColoringPlugin.prototype._onSectionBinding = function (e) {
|
707
|
+
var dataRows = /** @type{Array.<Object>} */(e["dataRows"]);
|
708
|
+
if(!dataRows) {
|
709
|
+
return; // dataRows could be empty in case of no column is presented
|
710
|
+
}
|
711
|
+
|
707
712
|
var c, r, cell, painter, changedCols, rowDef, rid, changedRow, changedRows;
|
708
713
|
var dataRow, insertedId, colData, blinking, bgBlinking, cachedValues, updatePrev;
|
709
714
|
var section = e["section"];
|
710
|
-
var dataRows = /** @type{Array.<Object>} */(e["dataRows"]);
|
711
715
|
var colCount = section.getColumnCount();
|
712
716
|
var fromR = /** @type{number} */(e["fromRowIndex"]);
|
713
717
|
var toR = /** @type{number} */(e["toRowIndex"]);
|
@@ -3,7 +3,7 @@ import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
|
|
3
3
|
import { Dom } from "../../tr-grid-util/es6/Dom.js";
|
4
4
|
import { Popup } from "../../tr-grid-util/es6/Popup.js";
|
5
5
|
import { ElfUtil } from "../../tr-grid-util/es6/ElfUtil.js";
|
6
|
-
import { isTouchDevice } from "../../tr-grid-util/es6/Util.js";
|
6
|
+
import { isTouchDevice, injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
|
7
7
|
import { ElfDate } from "../../tr-grid-util/es6/ElfDate.js";
|
8
8
|
import { CoralItems } from "../../tr-grid-util/es6/CoralItems.js";
|
9
9
|
|
@@ -3,7 +3,7 @@ import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
|
|
3
3
|
import { Dom } from "../../tr-grid-util/es6/Dom.js";
|
4
4
|
import { Popup } from "../../tr-grid-util/es6/Popup.js";
|
5
5
|
import { ElfUtil } from "../../tr-grid-util/es6/ElfUtil.js";
|
6
|
-
import { isTouchDevice } from "../../tr-grid-util/es6/Util.js";
|
6
|
+
import { isTouchDevice, injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
|
7
7
|
import { ElfDate } from "../../tr-grid-util/es6/ElfDate.js";
|
8
8
|
import { CoralItems } from "../../tr-grid-util/es6/CoralItems.js";
|
9
9
|
/** @typedef {Object} InCellEditingPlugin~Options
|
@@ -337,6 +337,11 @@ InCellEditingPlugin.prototype._elfVersion = 0;
|
|
337
337
|
*/
|
338
338
|
|
339
339
|
InCellEditingPlugin._primaryColor = "";
|
340
|
+
/** @type {string}
|
341
|
+
* @private
|
342
|
+
*/
|
343
|
+
|
344
|
+
InCellEditingPlugin._styles = prettifyCss([":host .cell.editing input[type=text]", ["border-style: solid;"]]);
|
340
345
|
/** @private
|
341
346
|
* @param {Object} colors
|
342
347
|
*/
|
@@ -532,6 +537,13 @@ InCellEditingPlugin.prototype.initialize = function (host, options) {
|
|
532
537
|
InCellEditingPlugin._uiElementTypesMap["number"] = "ef-input";
|
533
538
|
}
|
534
539
|
|
540
|
+
if (ElfUtil.isHaloTheme()) {
|
541
|
+
if (!host._inCellEditingStyles) {
|
542
|
+
host._inCellEditingStyles = true;
|
543
|
+
injectCss(InCellEditingPlugin._styles, host.getElement());
|
544
|
+
}
|
545
|
+
}
|
546
|
+
|
535
547
|
this.config(options);
|
536
548
|
|
537
549
|
if (!InCellEditingPlugin._primaryColor) {
|
@@ -25,8 +25,6 @@ declare class RowDraggingPlugin extends GridPlugin {
|
|
25
25
|
|
26
26
|
constructor(options?: RowDraggingPlugin.Options);
|
27
27
|
|
28
|
-
public beforeProcessOption(optionName: string, optionValue: any): any;
|
29
|
-
|
30
28
|
public hasMultiTableSupport(): boolean;
|
31
29
|
|
32
30
|
public getName(): string;
|
@@ -45,7 +43,7 @@ declare class RowDraggingPlugin extends GridPlugin {
|
|
45
43
|
|
46
44
|
public cancelDrag(): void;
|
47
45
|
|
48
|
-
public getGuideline(): Element;
|
46
|
+
public getGuideline(): Element|null;
|
49
47
|
|
50
48
|
}
|
51
49
|
|
@@ -44,6 +44,15 @@ import Dom from "../../tr-grid-util/es6/Dom.js";
|
|
44
44
|
* @type {Object}
|
45
45
|
*/
|
46
46
|
|
47
|
+
|
48
|
+
/** @private
|
49
|
+
* @param {Object} pos
|
50
|
+
* @return {boolean}
|
51
|
+
*/
|
52
|
+
var _isInContentSection = function (pos) {
|
53
|
+
return (pos && pos["sectionType"] === "content") ? true : false;
|
54
|
+
};
|
55
|
+
|
47
56
|
/** @constructor
|
48
57
|
* @param {RowDraggingPlugin.Options=} options
|
49
58
|
* @extends {GridPlugin}
|
@@ -58,7 +67,6 @@ var RowDraggingPlugin = function (options) {
|
|
58
67
|
t._onMouseDown = t._onMouseDown.bind(t);
|
59
68
|
|
60
69
|
t._onDragPulse = t._onDragPulse.bind(t);
|
61
|
-
t._onContentScrolled = t._onContentScrolled.bind(t);
|
62
70
|
|
63
71
|
t._onDragStart = t._onDragStart.bind(t);
|
64
72
|
t._onMouseMove = t._onMouseMove.bind(t);
|
@@ -181,6 +189,7 @@ RowDraggingPlugin.prototype._autoScroll = true;
|
|
181
189
|
|
182
190
|
/** Prevent built-in config
|
183
191
|
* @public
|
192
|
+
* @ignore
|
184
193
|
* @param {string} optionName
|
185
194
|
* @param {*} optionValue
|
186
195
|
* @return {*}
|
@@ -222,7 +231,7 @@ RowDraggingPlugin.prototype.initialize = function (host, options) {
|
|
222
231
|
host.setAttribute("draggable", "true");
|
223
232
|
host.listen("dragstart", this.startDrag);
|
224
233
|
}
|
225
|
-
|
234
|
+
|
226
235
|
host.listen("mousedown", this._onMouseDown);
|
227
236
|
host.listen("touchstart", this._onMouseDown);
|
228
237
|
|
@@ -245,7 +254,6 @@ RowDraggingPlugin.prototype.unload = function (host) {
|
|
245
254
|
|
246
255
|
// host.removeAttribute("draggable");
|
247
256
|
host.unlisten("dragstart", this.startDrag);
|
248
|
-
// host.unlisten("mouseover", this._onContentScrolled);
|
249
257
|
host.unlisten("mousedown", this._onMouseDown);
|
250
258
|
host.unlisten("touchstart", this._onMouseDown);
|
251
259
|
|
@@ -288,6 +296,12 @@ RowDraggingPlugin.prototype._onThemeLoaded = function(colors) {
|
|
288
296
|
"padding: 0 7px 0 7px;",
|
289
297
|
"box-shadow: 0 0 8px var(--grid-dragbox-bordercolor);"
|
290
298
|
],
|
299
|
+
".drag-box-disabled", [
|
300
|
+
"width: 100px;",
|
301
|
+
"left: 0;",
|
302
|
+
"top: 0;",
|
303
|
+
"position: absolute;"
|
304
|
+
],
|
291
305
|
".drag-box-icon", [
|
292
306
|
"top: -4px;",
|
293
307
|
"left: 12px;",
|
@@ -364,6 +378,8 @@ RowDraggingPlugin.prototype.config = function (options) {
|
|
364
378
|
|
365
379
|
if (typeof extOptions["dragBoxRenderer"] === "function") {
|
366
380
|
this._dragBoxRenderer = extOptions["dragBoxRenderer"];
|
381
|
+
} else {
|
382
|
+
this._dragBox.className = "drag-box-disabled"; // set disable drag-box
|
367
383
|
}
|
368
384
|
|
369
385
|
this._dragBoxEnabled = !!extOptions["dragBox"];
|
@@ -437,7 +453,7 @@ RowDraggingPlugin.prototype.startDrag = function (startRef) {
|
|
437
453
|
pos = this._hitTest(target);
|
438
454
|
}
|
439
455
|
|
440
|
-
if (pos
|
456
|
+
if (_isInContentSection(pos)) {
|
441
457
|
this._clearCache();
|
442
458
|
this._pos = pos;
|
443
459
|
this._onDragStart(startRef);
|
@@ -559,8 +575,6 @@ RowDraggingPlugin.prototype._onDragStart = function (e) {
|
|
559
575
|
// then set cursor move will have an effect
|
560
576
|
grid.getElement().style.cursor = "grabbing";
|
561
577
|
|
562
|
-
// Initialize guideline
|
563
|
-
this._updateGuideParent(); // Insert guideline to the document
|
564
578
|
this._updateGuidePosition();
|
565
579
|
|
566
580
|
if (this._autoScroll) {
|
@@ -597,7 +611,6 @@ RowDraggingPlugin.prototype._onMouseMove = function (e) {
|
|
597
611
|
|
598
612
|
this._pos = this._hitTest(e); // A new object is created
|
599
613
|
|
600
|
-
this._updateGuideParent();
|
601
614
|
this._updateGuidePosition(e);
|
602
615
|
this._renderDragBox(e);
|
603
616
|
|
@@ -645,7 +658,7 @@ RowDraggingPlugin.prototype._onDragEnd = function (e) {
|
|
645
658
|
destPos["dropTarget"] = e ? e.target : null;
|
646
659
|
|
647
660
|
if (!this.disabled) {
|
648
|
-
if (this._dataTransfer && this.
|
661
|
+
if (this._dataTransfer && _isInContentSection(this._pos)) {
|
649
662
|
var destGrid = destPos["grid"] || srcGrid;
|
650
663
|
var destRowIndex = destPos["rowIndex"];
|
651
664
|
|
@@ -674,11 +687,6 @@ RowDraggingPlugin.prototype._onDragEnd = function (e) {
|
|
674
687
|
*/
|
675
688
|
RowDraggingPlugin.prototype._moveRows = function (srcRowRef, destRowIndex, srcGrid, destGrid, evtArg) {
|
676
689
|
var destDv = destGrid.getDataSource();
|
677
|
-
var destRowId = destDv.getRowId(destRowIndex);
|
678
|
-
|
679
|
-
if(!destRowId) {
|
680
|
-
return 0;
|
681
|
-
}
|
682
690
|
|
683
691
|
var srcRowIndices = null;
|
684
692
|
var srcDv = srcGrid.getDataSource();
|
@@ -695,10 +703,16 @@ RowDraggingPlugin.prototype._moveRows = function (srcRowRef, destRowIndex, srcGr
|
|
695
703
|
return 0;
|
696
704
|
}
|
697
705
|
|
706
|
+
|
698
707
|
var movedRowIds = null;
|
699
|
-
|
708
|
+
var destRowId = destDv.getRowId(destRowIndex);
|
709
|
+
if(srcGrid === destGrid) { // TODO: Support wrap mode
|
700
710
|
movedRowIds = srcDv.moveRow(srcRowIndices, destRowIndex) || [];
|
701
711
|
} else {
|
712
|
+
// TODO: Check if we support moving to last row for multi table
|
713
|
+
// if(!destRowId) {
|
714
|
+
// return 0;
|
715
|
+
// }
|
702
716
|
movedRowIds = [];
|
703
717
|
evtArg["destGrid"] = destGrid;
|
704
718
|
|
@@ -732,7 +746,7 @@ RowDraggingPlugin.prototype._moveRows = function (srcRowRef, destRowIndex, srcGr
|
|
732
746
|
if(movedRowIds.length) {
|
733
747
|
evtArg["originRowId"] = movedRowIds[0];
|
734
748
|
evtArg["originRowIds"] = movedRowIds;
|
735
|
-
evtArg["destinationRowId"] = destRowId;
|
749
|
+
evtArg["destinationRowId"] = destRowId; // Return empty string for the last row
|
736
750
|
|
737
751
|
this._dispatch("dataMoved", evtArg);
|
738
752
|
}
|
@@ -741,47 +755,51 @@ RowDraggingPlugin.prototype._moveRows = function (srcRowRef, destRowIndex, srcGr
|
|
741
755
|
/** @private
|
742
756
|
* @return {boolean}
|
743
757
|
*/
|
744
|
-
RowDraggingPlugin.prototype._isInContentSection = function () {
|
745
|
-
return (this._pos["sectionType"] === "content");
|
746
|
-
};
|
747
|
-
/** @private
|
748
|
-
* @return {boolean}
|
749
|
-
*/
|
750
|
-
RowDraggingPlugin.prototype._hasValidTarget = function () {
|
751
|
-
return (this._pos && this._pos["invalidTarget"]) ? false : true;
|
752
|
-
};
|
753
|
-
/** @private
|
754
|
-
* @return {boolean}
|
755
|
-
*/
|
756
758
|
RowDraggingPlugin.prototype._isDragCancelled = function () {
|
757
759
|
return (this._pos && this._pos["cancel"]) ? true : false;
|
758
760
|
};
|
759
761
|
|
760
|
-
/** @private */
|
761
|
-
RowDraggingPlugin.prototype._updateGuideParent = function () {
|
762
|
-
if (this._disabled) return;
|
763
|
-
|
764
|
-
if (this._isInContentSection()) {
|
765
|
-
var grid = this._pos["grid"] || null;
|
766
|
-
var pn = this._pos["section"].getColumnHost(); // This is to hide out of view guideline
|
767
|
-
if (pn !== this._guideline.parentNode) {
|
768
|
-
this._guideline.style.width = grid.getWidth() + "px";
|
769
|
-
pn.appendChild(this._guideline);
|
770
|
-
}
|
771
|
-
}
|
772
|
-
};
|
773
|
-
|
774
762
|
/** @private
|
775
|
-
* @param {Event} e
|
763
|
+
* @param {Event=} e
|
776
764
|
*/
|
777
765
|
RowDraggingPlugin.prototype._updateGuidePosition = function (e) {
|
778
|
-
|
766
|
+
var pos = this._pos;
|
767
|
+
if (this._disabled || !pos || pos["invalidTarget"]) {
|
768
|
+
return;
|
769
|
+
}
|
779
770
|
|
780
|
-
if (
|
781
|
-
|
782
|
-
|
783
|
-
|
771
|
+
if (_isInContentSection(pos)) {
|
772
|
+
var guideline = this._guideline;
|
773
|
+
// var grid = pos["grid"];
|
774
|
+
var section = pos["section"];
|
775
|
+
var pn = section.getColumnHost(); // This is to hide out of view guideline
|
776
|
+
if (pn !== guideline.parentNode) {
|
777
|
+
guideline.style.width = section.getWidth() + "px";
|
778
|
+
pn.appendChild(guideline);
|
784
779
|
}
|
780
|
+
|
781
|
+
var cellElement = pos["cellElement"];
|
782
|
+
var relativePos = Dom.getRelativePosition(cellElement, pn);
|
783
|
+
var cellTop = relativePos["y"];
|
784
|
+
var rowIndex = pos["rowIndex"];
|
785
|
+
var offsetY = 0;
|
786
|
+
|
787
|
+
if(rowIndex) {
|
788
|
+
offsetY = -1; // Make guideline stay on top of the target cell
|
789
|
+
if(e) { // MouseEvent or TouchEvent
|
790
|
+
var lastRow = section.getRowCount() - 1;
|
791
|
+
if(rowIndex >= lastRow) { // bottommost row
|
792
|
+
var rowHeight = section.getRowHeight(lastRow);
|
793
|
+
relativePos = Dom.getRelativePosition(e, cellElement);
|
794
|
+
if(relativePos["y"] >= (rowHeight / 2) | 0) {
|
795
|
+
offsetY = rowHeight - 3; // TODO: Use actual guideline height for the offset
|
796
|
+
++pos["rowIndex"];
|
797
|
+
}
|
798
|
+
}
|
799
|
+
}
|
800
|
+
} // else { Topmost row
|
801
|
+
|
802
|
+
guideline.style.top = (cellTop + offsetY) + "px";
|
785
803
|
}
|
786
804
|
};
|
787
805
|
|
@@ -864,19 +882,6 @@ RowDraggingPlugin.prototype._onDragPulse = function () {
|
|
864
882
|
primaryHost.scrollDown(scrollVal);
|
865
883
|
}
|
866
884
|
};
|
867
|
-
/** @private
|
868
|
-
* @param {Event=} e
|
869
|
-
*/
|
870
|
-
RowDraggingPlugin.prototype._onContentScrolled = function (e) {
|
871
|
-
if (this._scrollingZone && this._dragging && this._pos["hit"]) {
|
872
|
-
var grid = this._pos["grid"];
|
873
|
-
if (grid.getElement() === e.currentTarget) {
|
874
|
-
this._pos = this._hitTest(e);
|
875
|
-
this._dispatch("drag", this._pos);
|
876
|
-
this._updateGuidePosition();
|
877
|
-
}
|
878
|
-
}
|
879
|
-
};
|
880
885
|
|
881
886
|
|
882
887
|
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import { Ext } from
|
2
|
-
import { EventDispatcher } from
|
3
|
-
import { GridPlugin } from
|
4
|
-
import { isMac as isMacFn } from
|
1
|
+
import { Ext } from "../../tr-grid-util/es6/Ext.js";
|
2
|
+
import { EventDispatcher } from "../../tr-grid-util/es6/EventDispatcher.js";
|
3
|
+
import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
|
4
|
+
import { isMac as isMacFn } from "../../tr-grid-util/es6/Util.js";
|
5
5
|
import { isIE, prepareTSVContent } from "../../tr-grid-util/es6/Util.js";
|
6
6
|
import { ElfUtil } from "../../tr-grid-util/es6/ElfUtil.js";
|
7
7
|
import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
|
@@ -46,13 +46,13 @@ declare class RowSelectionPlugin extends GridPlugin {
|
|
46
46
|
|
47
47
|
public getRowAnchor(sectRef?: any): number;
|
48
48
|
|
49
|
-
public getFirstSelectedIndex(sectRef?: any): number|null;
|
49
|
+
public getFirstSelectedIndex(sectRef?: any): number|null|null;
|
50
50
|
|
51
|
-
public getLastSelectedIndex(sectRef?: any): number|null;
|
51
|
+
public getLastSelectedIndex(sectRef?: any): number|null|null;
|
52
52
|
|
53
|
-
public getSelectedRows(sectRef?: any): (number)[];
|
53
|
+
public getSelectedRows(sectRef?: any): (number)[]|null;
|
54
54
|
|
55
|
-
public getSelectedRowIds(sectRef?: any): (string)[];
|
55
|
+
public getSelectedRowIds(sectRef?: any): (string)[]|null;
|
56
56
|
|
57
57
|
public getSelectedRowCount(sectRef?: any): number;
|
58
58
|
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import { Ext } from
|
2
|
-
import { EventDispatcher } from
|
3
|
-
import { GridPlugin } from
|
4
|
-
import { isMac as isMacFn } from
|
1
|
+
import { Ext } from "../../tr-grid-util/es6/Ext.js";
|
2
|
+
import { EventDispatcher } from "../../tr-grid-util/es6/EventDispatcher.js";
|
3
|
+
import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
|
4
|
+
import { isMac as isMacFn } from "../../tr-grid-util/es6/Util.js";
|
5
5
|
import { isIE, prepareTSVContent } from "../../tr-grid-util/es6/Util.js";
|
6
6
|
import { ElfUtil } from "../../tr-grid-util/es6/ElfUtil.js";
|
7
7
|
import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
|
@@ -393,7 +393,7 @@ RowSelectionPlugin.prototype.getFirstSelectedIndex = function (sectRef) {
|
|
393
393
|
var count = rows.length;
|
394
394
|
var dataRow;
|
395
395
|
for (var rowIndex = 0; rowIndex < count; rowIndex++) {
|
396
|
-
dataRow = this.
|
396
|
+
dataRow = this._rowGetter(rows[rowIndex]);
|
397
397
|
if (dataRow && dataRow[this._selectionField]) {
|
398
398
|
return rowIndex;
|
399
399
|
}
|
@@ -421,7 +421,7 @@ RowSelectionPlugin.prototype.getLastSelectedIndex = function (sectRef) {
|
|
421
421
|
var count = rows.length;
|
422
422
|
var dataRow;
|
423
423
|
for (var rowIndex = count - 1; rowIndex >= 0; rowIndex--) {
|
424
|
-
dataRow = this.
|
424
|
+
dataRow = this._rowGetter(rows[rowIndex]);
|
425
425
|
if (dataRow && dataRow[this._selectionField]) {
|
426
426
|
return rowIndex;
|
427
427
|
}
|
@@ -451,7 +451,7 @@ RowSelectionPlugin.prototype.getSelectedRows = function (sectRef) {
|
|
451
451
|
var selectedRows = [];
|
452
452
|
var dataRow;
|
453
453
|
for (var rowIndex = 0; rowIndex < count; rowIndex++) {
|
454
|
-
dataRow = this.
|
454
|
+
dataRow = this._rowGetter(rows[rowIndex]);
|
455
455
|
if (dataRow && dataRow[this._selectionField]) {
|
456
456
|
selectedRows.push(rowIndex);
|
457
457
|
}
|
@@ -643,8 +643,8 @@ RowSelectionPlugin.prototype._onMouseDown = function (e) {
|
|
643
643
|
if (!ctx["hit"] || ctx["sectionType"] !== "content") { return; }
|
644
644
|
if (e.button === 2) { // Right click at the selected column should override clicking row to select;
|
645
645
|
var csp = this._getPlugin("ColumnSelectionPlugin");
|
646
|
-
if (csp && csp[
|
647
|
-
if (csp[
|
646
|
+
if (csp && csp["isEnabled"]()) {
|
647
|
+
if (csp["isSelectedColumn"](ctx["colIndex"])) {
|
648
648
|
return;
|
649
649
|
}
|
650
650
|
}
|
@@ -740,7 +740,7 @@ RowSelectionPlugin.prototype._onMouseMove = function (e) {
|
|
740
740
|
*/
|
741
741
|
RowSelectionPlugin.prototype._setPendingClickIndex = function (rowIndex, host) {
|
742
742
|
this._pendingClickIndex = rowIndex;
|
743
|
-
host && host.listen(
|
743
|
+
host && host.listen("mousemove", this._onMouseMove);
|
744
744
|
};
|
745
745
|
|
746
746
|
/** To clear _pendingClickIndex
|
@@ -749,7 +749,7 @@ RowSelectionPlugin.prototype._setPendingClickIndex = function (rowIndex, host) {
|
|
749
749
|
*/
|
750
750
|
RowSelectionPlugin.prototype._clearPendingClickIndex = function (host) {
|
751
751
|
this._pendingClickIndex = -1;
|
752
|
-
host && host.unlisten(
|
752
|
+
host && host.unlisten("mousemove", this._onMouseMove);
|
753
753
|
};
|
754
754
|
|
755
755
|
|
@@ -853,15 +853,25 @@ RowSelectionPlugin.prototype._onCopy = function (e) {
|
|
853
853
|
*/
|
854
854
|
RowSelectionPlugin.prototype._onPostSectionDataBinding = function (e) {
|
855
855
|
if (!this._basedOnContent
|
856
|
-
||
|
856
|
+
|| "content" !== e.sectionType
|
857
857
|
|| !this._activeGrid) {
|
858
858
|
return;
|
859
859
|
}
|
860
|
-
var
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
860
|
+
var section = e.section;
|
861
|
+
var dv = e.dataSource;
|
862
|
+
|
863
|
+
var field = this._selectionField;
|
864
|
+
section.clearSelectedRows();
|
865
|
+
|
866
|
+
var fromR = section.getFirstIndexInView();
|
867
|
+
var toR = section.getLastIndexInView();
|
868
|
+
for (var r = fromR; r < toR; ++r) {
|
869
|
+
var dataRow = this._rowGetter(dv.getRowDataAt(r));
|
870
|
+
if(dataRow) {
|
871
|
+
if(dataRow[field]) {
|
872
|
+
section.setSelectedRow(r, true);
|
873
|
+
}
|
874
|
+
}
|
865
875
|
}
|
866
876
|
this._updateMenuIcon();
|
867
877
|
};
|
@@ -956,7 +966,7 @@ RowSelectionPlugin.prototype._clearSelectedRows = function (preserveAnchor) { //
|
|
956
966
|
var dataRow, firstIndex;
|
957
967
|
var len = rows.length;
|
958
968
|
for (i = 0; i < len; i++) {
|
959
|
-
dataRow = this.
|
969
|
+
dataRow = this._rowGetter(rows[i]);
|
960
970
|
if (dataRow && dataRow[this._selectionField]) {
|
961
971
|
valueList.push(false);
|
962
972
|
ridList.push(rids[i]);
|
@@ -1024,8 +1034,8 @@ RowSelectionPlugin.prototype._selectByKey = function (direction, e, pageKey) {
|
|
1024
1034
|
}
|
1025
1035
|
if (next < 0) {
|
1026
1036
|
var csp = this._getPlugin("ColumnSelectionPlugin");
|
1027
|
-
if (!shiftKey && csp && csp[
|
1028
|
-
csp[
|
1037
|
+
if (!shiftKey && csp && csp["isEnabled"]()) {
|
1038
|
+
csp["selectSingleColumn"](null, this._activeGrid);
|
1029
1039
|
|
1030
1040
|
this.clearAllSelections();
|
1031
1041
|
return;
|
@@ -1353,8 +1363,8 @@ RowSelectionPlugin.prototype._dispatchBeforeSelection = function (e, ctx) {
|
|
1353
1363
|
RowSelectionPlugin.prototype._dispatchSelectionChanged = function (e, rowIndex, section) {
|
1354
1364
|
if (this._activeGrid) {
|
1355
1365
|
var csp = this._getPlugin("ColumnSelectionPlugin");
|
1356
|
-
if (csp && csp[
|
1357
|
-
csp[
|
1366
|
+
if (csp && csp["isEnabled"]()) {
|
1367
|
+
csp["clearSelection"]();
|
1358
1368
|
}
|
1359
1369
|
var cep = this._getPlugin("CellEditingPlugin");
|
1360
1370
|
if (cep) {
|
@@ -39,10 +39,10 @@ ExpanderIcon._iconName = ""; // static variable
|
|
39
39
|
* @private
|
40
40
|
*/
|
41
41
|
ExpanderIcon._styles = prettifyCss([
|
42
|
-
".tr-grid
|
42
|
+
".tr-grid.expander-disabled .expander", [
|
43
43
|
"cursor: default;"
|
44
44
|
],
|
45
|
-
".tr-grid
|
45
|
+
".tr-grid.folder-disabled .cell.folder", [
|
46
46
|
"cursor: default;"
|
47
47
|
],
|
48
48
|
".tr-grid .expander", [
|
@@ -18,6 +18,8 @@ declare class MultiTableManager {
|
|
18
18
|
|
19
19
|
public setTableCount(num: number): void;
|
20
20
|
|
21
|
+
public wrapTable(rowCount: number): void;
|
22
|
+
|
21
23
|
public getTable(at?: number): Element|null;
|
22
24
|
|
23
25
|
public insertRow(rowOption?: any, at?: number): void;
|
@@ -26,6 +28,12 @@ declare class MultiTableManager {
|
|
26
28
|
|
27
29
|
public getRowCount(): number;
|
28
30
|
|
31
|
+
public insertColumn(columnOption: any, idx?: number): void;
|
32
|
+
|
33
|
+
public removeColumn(colRef: any): void;
|
34
|
+
|
35
|
+
public getColumnCount(): number;
|
36
|
+
|
29
37
|
}
|
30
38
|
|
31
39
|
export default MultiTableManager;
|