@refinitiv-ui/efx-grid 6.0.0 → 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 +226 -23
- package/lib/column-selection-dialog/themes/halo/dark/column-selection-dialog.js +1 -1
- package/lib/column-selection-dialog/themes/halo/dark/es5/all-elements.js +1 -1
- package/lib/column-selection-dialog/themes/halo/light/column-selection-dialog.js +1 -1
- package/lib/column-selection-dialog/themes/halo/light/es5/all-elements.js +1 -1
- package/lib/core/dist/core.css +1 -1
- package/lib/core/dist/core.js +10158 -7908
- 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 +16 -7
- package/lib/core/es6/data/DataView.js +172 -49
- 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.d.ts +289 -0
- package/lib/core/es6/data/WrappedView.js +1319 -0
- package/lib/core/es6/grid/Core.d.ts +13 -0
- package/lib/core/es6/grid/Core.js +406 -160
- package/lib/core/es6/grid/ILayoutGrid.d.ts +8 -0
- package/lib/core/es6/grid/ILayoutGrid.js +45 -2
- package/lib/core/es6/grid/LayoutGrid.d.ts +10 -1
- package/lib/core/es6/grid/LayoutGrid.js +257 -82
- package/lib/core/es6/grid/VirtualizedLayoutGrid.d.ts +10 -1
- package/lib/core/es6/grid/VirtualizedLayoutGrid.js +316 -24
- package/lib/core/es6/grid/components/Column.js +8 -2
- package/lib/core/es6/grid/components/HScrollbar.d.ts +4 -0
- package/lib/core/es6/grid/components/HScrollbar.js +20 -4
- package/lib/core/es6/grid/util/TrackLayout.d.ts +1 -1
- package/lib/core/es6/grid/util/TrackLayout.js +2 -3
- package/lib/core/es6/tr-grid-theme.js +1 -1
- 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 +24 -9
- package/lib/grid/lib/efx-grid.d.ts +27 -8
- package/lib/grid/lib/efx-grid.js +114 -115
- package/lib/grid/themes/base.less +5 -3
- 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/efx-grid.less +69 -32
- 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/index.d.ts +56 -56
- package/lib/index.js +56 -56
- package/lib/row-segmenting/es6/RowSegmenting.d.ts +1 -0
- package/lib/row-segmenting/es6/RowSegmenting.js +43 -12
- package/lib/rt-grid/dist/rt-grid.js +10293 -7865
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/ColumnDefinition.d.ts +4 -1
- package/lib/rt-grid/es6/ColumnDefinition.js +3 -0
- package/lib/rt-grid/es6/Grid.d.ts +14 -7
- package/lib/rt-grid/es6/Grid.js +244 -75
- package/lib/rt-grid/es6/RowDefinition.d.ts +4 -1
- package/lib/rt-grid/es6/RowDefinition.js +52 -2
- package/lib/tr-grid-cell-selection/es6/CellSelection.d.ts +1 -1
- package/lib/tr-grid-cell-selection/es6/CellSelection.js +53 -40
- package/lib/tr-grid-checkbox/es6/Checkbox.d.ts +4 -1
- package/lib/tr-grid-checkbox/es6/Checkbox.js +41 -14
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +1 -0
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +10 -0
- package/lib/tr-grid-column-selection/es6/ColumnSelection.d.ts +5 -1
- package/lib/tr-grid-column-selection/es6/ColumnSelection.js +226 -4
- package/lib/tr-grid-column-stack/es6/ColumnStack.js +3 -0
- package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +6 -1
- package/lib/tr-grid-filter-input/es6/FilterInput.d.ts +4 -2
- package/lib/tr-grid-filter-input/es6/FilterInput.js +73 -10
- 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 +165 -70
- package/lib/tr-grid-row-filtering/es6/RowFiltering.d.ts +2 -0
- package/lib/tr-grid-row-filtering/es6/RowFiltering.js +88 -33
- package/lib/tr-grid-row-grouping/es6/RowGrouping.js +41 -31
- package/lib/tr-grid-row-selection/es6/RowSelection.d.ts +13 -9
- package/lib/tr-grid-row-selection/es6/RowSelection.js +220 -29
- package/lib/tr-grid-rowcoloring/es6/RowColoring.d.ts +2 -0
- package/lib/tr-grid-rowcoloring/es6/RowColoring.js +36 -0
- package/lib/tr-grid-util/es6/CellPainter.d.ts +8 -8
- package/lib/tr-grid-util/es6/Conflator.d.ts +2 -2
- package/lib/tr-grid-util/es6/CoralItems.d.ts +1 -1
- package/lib/tr-grid-util/es6/DateTime.d.ts +4 -4
- package/lib/tr-grid-util/es6/Delay.d.ts +1 -1
- package/lib/tr-grid-util/es6/Dom.d.ts +4 -4
- package/lib/tr-grid-util/es6/ElementWrapper.d.ts +1 -1
- package/lib/tr-grid-util/es6/ElfDate.d.ts +3 -3
- package/lib/tr-grid-util/es6/ElfUtil.d.ts +4 -4
- package/lib/tr-grid-util/es6/EventDispatcher.d.ts +1 -1
- package/lib/tr-grid-util/es6/ExpanderIcon.js +2 -2
- package/lib/tr-grid-util/es6/FieldFormatter.d.ts +1 -1
- package/lib/tr-grid-util/es6/FilterBuilder.d.ts +5 -5
- package/lib/tr-grid-util/es6/GridPlugin.d.ts +3 -3
- package/lib/tr-grid-util/es6/MouseDownTrait.d.ts +1 -1
- package/lib/tr-grid-util/es6/MultiTableManager.d.ts +10 -2
- package/lib/tr-grid-util/es6/MultiTableManager.js +164 -57
- package/lib/tr-grid-util/es6/PercentBar.d.ts +1 -1
- package/lib/tr-grid-util/es6/Perf.d.ts +4 -4
- package/lib/tr-grid-util/es6/Popup.d.ts +2 -2
- package/lib/tr-grid-util/es6/RequestQueue.d.ts +1 -1
- package/lib/tr-grid-util/es6/RowPainter.d.ts +3 -0
- package/lib/tr-grid-util/es6/RowPainter.js +82 -20
- package/lib/tr-grid-util/es6/SubTable.d.ts +9 -9
- package/lib/tr-grid-util/es6/Table.d.ts +13 -13
- package/lib/tr-grid-util/es6/TextHighlighter.d.ts +3 -3
- package/lib/tr-grid-util/es6/TickCodes.d.ts +2 -2
- package/lib/tr-grid-util/es6/TouchProxy.d.ts +1 -1
- package/lib/tr-grid-util/es6/Util.d.ts +6 -6
- package/lib/tr-grid-util/es6/formula/Engine.d.ts +5 -5
- package/lib/tr-grid-util/es6/formula/Formula.d.ts +3 -3
- package/lib/tr-grid-util/es6/formula/RealtimeService.d.ts +1 -1
- package/lib/tr-grid-util/es6/jet/CollectionDict.d.ts +2 -2
- package/lib/tr-grid-util/es6/jet/DataGenerator.d.ts +4 -4
- package/lib/tr-grid-util/es6/jet/MockArchive.d.ts +1 -1
- package/lib/tr-grid-util/es6/jet/MockJET.d.ts +4 -4
- package/lib/tr-grid-util/es6/jet/MockQuotes.d.ts +11 -11
- package/lib/tr-grid-util/es6/jet/MockQuotes2.d.ts +7 -7
- package/lib/tr-grid-util/es6/jet/MockRTK.d.ts +1 -1
- package/lib/tr-grid-util/es6/jet/mockDataAPI.d.ts +1 -1
- package/lib/tr-grid-util/es6/jsx.d.ts +223 -0
- package/lib/types/es6/CellSelection.d.ts +1 -1
- package/lib/types/es6/Checkbox.d.ts +4 -1
- package/lib/types/es6/ColumnGrouping.d.ts +1 -0
- package/lib/types/es6/ColumnSelection.d.ts +5 -1
- package/lib/types/es6/Core/data/DataView.d.ts +16 -7
- package/lib/types/es6/Core/data/Segment.d.ts +2 -0
- package/lib/types/es6/Core/data/WrappedView.d.ts +289 -0
- package/lib/types/es6/Core/grid/Core.d.ts +13 -0
- package/lib/types/es6/Core/grid/ILayoutGrid.d.ts +8 -0
- package/lib/types/es6/Core/grid/LayoutGrid.d.ts +10 -1
- package/lib/types/es6/Core/grid/VirtualizedLayoutGrid.d.ts +10 -1
- package/lib/types/es6/Core/grid/components/HScrollbar.d.ts +4 -0
- package/lib/types/es6/Core/grid/util/TrackLayout.d.ts +1 -1
- package/lib/types/es6/FilterInput.d.ts +4 -2
- package/lib/types/es6/InCellEditing.d.ts +1 -1
- package/lib/types/es6/RealtimeGrid/ColumnDefinition.d.ts +4 -1
- package/lib/types/es6/RealtimeGrid/Grid.d.ts +15 -8
- package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +4 -1
- package/lib/types/es6/RowColoring.d.ts +2 -0
- package/lib/types/es6/RowDragging.d.ts +1 -3
- package/lib/types/es6/RowFiltering.d.ts +2 -0
- package/lib/types/es6/RowSegmenting.d.ts +1 -0
- package/lib/types/es6/RowSelection.d.ts +13 -9
- package/lib/types/es6/Zoom.d.ts +2 -1
- package/lib/types/es6/index.d.ts +3 -0
- package/lib/versions.json +19 -19
- package/lib/zoom/es6/Zoom.d.ts +2 -1
- package/lib/zoom/es6/Zoom.js +11 -4
- package/package.json +9 -2
@@ -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);
|
@@ -67,9 +75,15 @@ var RowDraggingPlugin = function (options) {
|
|
67
75
|
|
68
76
|
t._hosts = [];
|
69
77
|
|
70
|
-
t._guideline = document.createElement("
|
78
|
+
t._guideline = document.createElement("div"); // Test IE mouse event, guildline close mouse event
|
71
79
|
t._guideline.className = "tr-row-guideline";
|
72
80
|
|
81
|
+
t._dragBox = document.createElement("div");
|
82
|
+
t._dragBox.className = "drag-box";
|
83
|
+
|
84
|
+
t._dragBoxIcon = document.createElement("ef-icon");
|
85
|
+
t._dragBoxIcon.className = "drag-box-icon";
|
86
|
+
|
73
87
|
t.config({ "rowDragging": options });
|
74
88
|
};
|
75
89
|
Ext.inherits(RowDraggingPlugin, GridPlugin);
|
@@ -87,6 +101,14 @@ RowDraggingPlugin._stylePromise = null; // Static variable
|
|
87
101
|
* @private
|
88
102
|
*/
|
89
103
|
RowDraggingPlugin.prototype._guideline = null;
|
104
|
+
/** @type {Element}
|
105
|
+
* @private
|
106
|
+
*/
|
107
|
+
RowDraggingPlugin.prototype._dragBox = null;
|
108
|
+
/** @type {Element}
|
109
|
+
* @private
|
110
|
+
*/
|
111
|
+
RowDraggingPlugin.prototype._dragBoxIcon = null;
|
90
112
|
/** For disabled UI
|
91
113
|
* @type {boolean}
|
92
114
|
* @private
|
@@ -167,6 +189,7 @@ RowDraggingPlugin.prototype._autoScroll = true;
|
|
167
189
|
|
168
190
|
/** Prevent built-in config
|
169
191
|
* @public
|
192
|
+
* @ignore
|
170
193
|
* @param {string} optionName
|
171
194
|
* @param {*} optionValue
|
172
195
|
* @return {*}
|
@@ -208,7 +231,7 @@ RowDraggingPlugin.prototype.initialize = function (host, options) {
|
|
208
231
|
host.setAttribute("draggable", "true");
|
209
232
|
host.listen("dragstart", this.startDrag);
|
210
233
|
}
|
211
|
-
|
234
|
+
|
212
235
|
host.listen("mousedown", this._onMouseDown);
|
213
236
|
host.listen("touchstart", this._onMouseDown);
|
214
237
|
|
@@ -231,7 +254,6 @@ RowDraggingPlugin.prototype.unload = function (host) {
|
|
231
254
|
|
232
255
|
// host.removeAttribute("draggable");
|
233
256
|
host.unlisten("dragstart", this.startDrag);
|
234
|
-
// host.unlisten("mouseover", this._onContentScrolled);
|
235
257
|
host.unlisten("mousedown", this._onMouseDown);
|
236
258
|
host.unlisten("touchstart", this._onMouseDown);
|
237
259
|
|
@@ -257,6 +279,51 @@ RowDraggingPlugin.prototype._onThemeLoaded = function(colors) {
|
|
257
279
|
"text-align: center;",
|
258
280
|
"border-top-width: 3px;",
|
259
281
|
"border-top-style: solid;"
|
282
|
+
],
|
283
|
+
".drag-box", [
|
284
|
+
"position: absolute;",
|
285
|
+
"left: 0;",
|
286
|
+
"top: 0;",
|
287
|
+
"pointer-events: none;",
|
288
|
+
"background-color: var(--grid-dragbox-bgcolor);",
|
289
|
+
"border: solid 1px var(--grid-title-sort-icon-color);",
|
290
|
+
"width: 134px;",
|
291
|
+
"height: 29px;",
|
292
|
+
"line-height: 29px;",
|
293
|
+
"white-space: nowrap;",
|
294
|
+
"overflow-x: clip;",
|
295
|
+
"text-overflow: ellipsis;",
|
296
|
+
"padding: 0 7px 0 7px;",
|
297
|
+
"box-shadow: 0 0 8px var(--grid-dragbox-bordercolor);"
|
298
|
+
],
|
299
|
+
".drag-box-disabled", [
|
300
|
+
"width: 100px;",
|
301
|
+
"left: 0;",
|
302
|
+
"top: 0;",
|
303
|
+
"position: absolute;"
|
304
|
+
],
|
305
|
+
".drag-box-icon", [
|
306
|
+
"top: -4px;",
|
307
|
+
"left: 12px;",
|
308
|
+
"padding: 2px;",
|
309
|
+
"border-radius: 100%;",
|
310
|
+
"font-size: 11px;",
|
311
|
+
"position: absolute;"
|
312
|
+
],
|
313
|
+
".drag-box-icon[icon='void']", [
|
314
|
+
"background-color:var(--grid-void-icon-bgcolor);",
|
315
|
+
"color:var(--grid-void-icon-color);"
|
316
|
+
],
|
317
|
+
".drag-box-icon[icon='add']", [
|
318
|
+
"background-color:var(--grid-insertion-icon-bgcolor);",
|
319
|
+
"color:var(--grid-insertion-icon-color);"
|
320
|
+
],
|
321
|
+
":host", [
|
322
|
+
"--grid-dragbox-bgcolor: #ffffff;", // If the value cannot be found, default to halo-light
|
323
|
+
"--grid-insertion-icon-bgcolor: #39c46e;",
|
324
|
+
"--grid-insertion-icon-color: #1A1A1A;",
|
325
|
+
"--grid-void-icon-bgcolor: #F5475B;",
|
326
|
+
"--grid-void-icon-color: #FFFFFF;"
|
260
327
|
]
|
261
328
|
];
|
262
329
|
var guidelineColor = "#ff9933";
|
@@ -268,8 +335,7 @@ RowDraggingPlugin.prototype._onThemeLoaded = function(colors) {
|
|
268
335
|
|
269
336
|
styles.push(".tr-row-guideline", [
|
270
337
|
"border-top-color: " + guidelineColor,
|
271
|
-
"color: " + guidelineColor
|
272
|
-
"background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0.1));"
|
338
|
+
"color: " + guidelineColor
|
273
339
|
]);
|
274
340
|
|
275
341
|
if(ElfVersion < 3) { // Backward compatability
|
@@ -312,6 +378,8 @@ RowDraggingPlugin.prototype.config = function (options) {
|
|
312
378
|
|
313
379
|
if (typeof extOptions["dragBoxRenderer"] === "function") {
|
314
380
|
this._dragBoxRenderer = extOptions["dragBoxRenderer"];
|
381
|
+
} else {
|
382
|
+
this._dragBox.className = "drag-box-disabled"; // set disable drag-box
|
315
383
|
}
|
316
384
|
|
317
385
|
this._dragBoxEnabled = !!extOptions["dragBox"];
|
@@ -385,7 +453,7 @@ RowDraggingPlugin.prototype.startDrag = function (startRef) {
|
|
385
453
|
pos = this._hitTest(target);
|
386
454
|
}
|
387
455
|
|
388
|
-
if (pos
|
456
|
+
if (_isInContentSection(pos)) {
|
389
457
|
this._clearCache();
|
390
458
|
this._pos = pos;
|
391
459
|
this._onDragStart(startRef);
|
@@ -491,7 +559,7 @@ RowDraggingPlugin.prototype._onDragStart = function (e) {
|
|
491
559
|
|
492
560
|
if (this._dragBoxRenderer) { // For custom drag box rendering
|
493
561
|
var arg = cloneObject(e); // TODO: Check if cloning is necessary
|
494
|
-
arg.dragBox = this.
|
562
|
+
arg.dragBox = this._dragBox;
|
495
563
|
arg.dataRow = this._getRowData(dv.getRowDataAt(rowIndex));
|
496
564
|
|
497
565
|
if (this._legacyRowReorder) {
|
@@ -505,11 +573,8 @@ RowDraggingPlugin.prototype._onDragStart = function (e) {
|
|
505
573
|
// TODO: Just update curser will not gonna work since cell is pointer-events: none;
|
506
574
|
// we should do something to overwrite pointer-events first
|
507
575
|
// then set cursor move will have an effect
|
508
|
-
grid.getElement().style.cursor = "
|
576
|
+
grid.getElement().style.cursor = "grabbing";
|
509
577
|
|
510
|
-
// Initialize guideline
|
511
|
-
this._guideline.style.lineHeight = this._guideline.style.height = "";
|
512
|
-
this._updateGuideParent(); // Insert guideline to the document
|
513
578
|
this._updateGuidePosition();
|
514
579
|
|
515
580
|
if (this._autoScroll) {
|
@@ -546,12 +611,13 @@ RowDraggingPlugin.prototype._onMouseMove = function (e) {
|
|
546
611
|
|
547
612
|
this._pos = this._hitTest(e); // A new object is created
|
548
613
|
|
549
|
-
this.
|
614
|
+
this._updateGuidePosition(e);
|
615
|
+
this._renderDragBox(e);
|
616
|
+
|
617
|
+
this._pos.dragBox = this._dragBox; // assign dragBox for user determine valid target
|
550
618
|
|
551
619
|
// Dispatch drag event to let user determine valid drop target using allowDrag (allowDrop) method
|
552
620
|
this._dispatch("drag", this._pos);
|
553
|
-
|
554
|
-
this._updateGuidePosition(e);
|
555
621
|
};
|
556
622
|
/** @private
|
557
623
|
* @param {Object} e
|
@@ -564,6 +630,7 @@ RowDraggingPlugin.prototype._onDragEnd = function (e) {
|
|
564
630
|
Dom.preventDefault(e);
|
565
631
|
}
|
566
632
|
Dom.removeParent(this._guideline);
|
633
|
+
Dom.removeParent(this._dragBox);
|
567
634
|
|
568
635
|
document.body.classList.remove("tr-dragging");
|
569
636
|
|
@@ -591,7 +658,7 @@ RowDraggingPlugin.prototype._onDragEnd = function (e) {
|
|
591
658
|
destPos["dropTarget"] = e ? e.target : null;
|
592
659
|
|
593
660
|
if (!this.disabled) {
|
594
|
-
if (this._dataTransfer && this.
|
661
|
+
if (this._dataTransfer && _isInContentSection(this._pos)) {
|
595
662
|
var destGrid = destPos["grid"] || srcGrid;
|
596
663
|
var destRowIndex = destPos["rowIndex"];
|
597
664
|
|
@@ -620,11 +687,6 @@ RowDraggingPlugin.prototype._onDragEnd = function (e) {
|
|
620
687
|
*/
|
621
688
|
RowDraggingPlugin.prototype._moveRows = function (srcRowRef, destRowIndex, srcGrid, destGrid, evtArg) {
|
622
689
|
var destDv = destGrid.getDataSource();
|
623
|
-
var destRowId = destDv.getRowId(destRowIndex);
|
624
|
-
|
625
|
-
if(!destRowId) {
|
626
|
-
return 0;
|
627
|
-
}
|
628
690
|
|
629
691
|
var srcRowIndices = null;
|
630
692
|
var srcDv = srcGrid.getDataSource();
|
@@ -641,10 +703,16 @@ RowDraggingPlugin.prototype._moveRows = function (srcRowRef, destRowIndex, srcGr
|
|
641
703
|
return 0;
|
642
704
|
}
|
643
705
|
|
706
|
+
|
644
707
|
var movedRowIds = null;
|
645
|
-
|
708
|
+
var destRowId = destDv.getRowId(destRowIndex);
|
709
|
+
if(srcGrid === destGrid) { // TODO: Support wrap mode
|
646
710
|
movedRowIds = srcDv.moveRow(srcRowIndices, destRowIndex) || [];
|
647
711
|
} else {
|
712
|
+
// TODO: Check if we support moving to last row for multi table
|
713
|
+
// if(!destRowId) {
|
714
|
+
// return 0;
|
715
|
+
// }
|
648
716
|
movedRowIds = [];
|
649
717
|
evtArg["destGrid"] = destGrid;
|
650
718
|
|
@@ -678,7 +746,7 @@ RowDraggingPlugin.prototype._moveRows = function (srcRowRef, destRowIndex, srcGr
|
|
678
746
|
if(movedRowIds.length) {
|
679
747
|
evtArg["originRowId"] = movedRowIds[0];
|
680
748
|
evtArg["originRowIds"] = movedRowIds;
|
681
|
-
evtArg["destinationRowId"] = destRowId;
|
749
|
+
evtArg["destinationRowId"] = destRowId; // Return empty string for the last row
|
682
750
|
|
683
751
|
this._dispatch("dataMoved", evtArg);
|
684
752
|
}
|
@@ -687,52 +755,92 @@ RowDraggingPlugin.prototype._moveRows = function (srcRowRef, destRowIndex, srcGr
|
|
687
755
|
/** @private
|
688
756
|
* @return {boolean}
|
689
757
|
*/
|
690
|
-
RowDraggingPlugin.prototype._isInContentSection = function () {
|
691
|
-
return (this._pos["sectionType"] === "content");
|
692
|
-
};
|
693
|
-
/** @private
|
694
|
-
* @return {boolean}
|
695
|
-
*/
|
696
|
-
RowDraggingPlugin.prototype._hasValidTarget = function () {
|
697
|
-
return (this._pos && this._pos["invalidTarget"]) ? false : true;
|
698
|
-
};
|
699
|
-
/** @private
|
700
|
-
* @return {boolean}
|
701
|
-
*/
|
702
758
|
RowDraggingPlugin.prototype._isDragCancelled = function () {
|
703
759
|
return (this._pos && this._pos["cancel"]) ? true : false;
|
704
760
|
};
|
705
761
|
|
706
|
-
/** @private
|
707
|
-
|
708
|
-
|
762
|
+
/** @private
|
763
|
+
* @param {Event=} e
|
764
|
+
*/
|
765
|
+
RowDraggingPlugin.prototype._updateGuidePosition = function (e) {
|
766
|
+
var pos = this._pos;
|
767
|
+
if (this._disabled || !pos || pos["invalidTarget"]) {
|
768
|
+
return;
|
769
|
+
}
|
709
770
|
|
710
|
-
if (
|
711
|
-
var
|
712
|
-
var
|
713
|
-
|
714
|
-
|
715
|
-
|
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);
|
716
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";
|
717
803
|
}
|
718
804
|
};
|
719
805
|
|
720
806
|
/** @private
|
721
|
-
* @param {Event} e
|
807
|
+
* @param {!Element|Event|MouseEvent} e
|
722
808
|
*/
|
723
|
-
RowDraggingPlugin.prototype.
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
}
|
809
|
+
RowDraggingPlugin.prototype._renderDragBox = function (e) {
|
810
|
+
|
811
|
+
if(this._disabled) {
|
812
|
+
return;
|
813
|
+
}
|
814
|
+
|
815
|
+
var gridElem = this._startingGrid.getElement();
|
816
|
+
var gridParent = this._startingGrid.getParent().parentNode;
|
817
|
+
var pn = this._dragBox.parentNode;
|
818
|
+
if(!pn) {
|
819
|
+
gridParent.appendChild(this._dragBox);
|
735
820
|
}
|
821
|
+
|
822
|
+
Dom.removeParent(this._dragBoxIcon);
|
823
|
+
|
824
|
+
var dragBoxIcon = this._dragBox.dragBoxIcon;
|
825
|
+
this._dragBoxIcon.style.visibility = "visible";
|
826
|
+
if(dragBoxIcon === "insertion") {
|
827
|
+
this.cancelDrag();
|
828
|
+
this._dragBoxIcon.icon = "add";
|
829
|
+
this._dragBox.appendChild(this._dragBoxIcon);
|
830
|
+
} else if (dragBoxIcon === "not-allowed" || dragBoxIcon === "no-drop" || dragBoxIcon === "void" ) {
|
831
|
+
this.cancelDrag();
|
832
|
+
this._dragBoxIcon.icon = "void";
|
833
|
+
this._dragBox.appendChild(this._dragBoxIcon);
|
834
|
+
}
|
835
|
+
|
836
|
+
var gridRect = gridElem.getBoundingClientRect();
|
837
|
+
|
838
|
+
var x = e.clientX - gridRect.left;
|
839
|
+
var y = e.pageY - gridRect.top;
|
840
|
+
|
841
|
+
// space for mouse cursor
|
842
|
+
this._dragBox.style.left = x - 5 + "px";
|
843
|
+
this._dragBox.style.top = y + 8 + "px";
|
736
844
|
};
|
737
845
|
/** @private */
|
738
846
|
RowDraggingPlugin.prototype._clearCache = function () {
|
@@ -774,19 +882,6 @@ RowDraggingPlugin.prototype._onDragPulse = function () {
|
|
774
882
|
primaryHost.scrollDown(scrollVal);
|
775
883
|
}
|
776
884
|
};
|
777
|
-
/** @private
|
778
|
-
* @param {Event=} e
|
779
|
-
*/
|
780
|
-
RowDraggingPlugin.prototype._onContentScrolled = function (e) {
|
781
|
-
if (this._scrollingZone && this._dragging && this._pos["hit"]) {
|
782
|
-
var grid = this._pos["grid"];
|
783
|
-
if (grid.getElement() === e.currentTarget) {
|
784
|
-
this._pos = this._hitTest(e);
|
785
|
-
this._dispatch("drag", this._pos);
|
786
|
-
this._updateGuidePosition();
|
787
|
-
}
|
788
|
-
}
|
789
|
-
};
|
790
885
|
|
791
886
|
|
792
887
|
|
@@ -2,6 +2,7 @@ import {Ext} from '../../tr-grid-util/es6/Ext.js';
|
|
2
2
|
import {GridPlugin} from '../../tr-grid-util/es6/GridPlugin.js';
|
3
3
|
import {FilterBuilder} from '../../tr-grid-util/es6/FilterBuilder.js';
|
4
4
|
import {ElfUtil} from '../../tr-grid-util/es6/ElfUtil.js';
|
5
|
+
import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
|
5
6
|
|
6
7
|
declare namespace RowFilteringPlugin {
|
7
8
|
|
@@ -32,6 +33,7 @@ declare namespace RowFilteringPlugin {
|
|
32
33
|
|
33
34
|
type Options = {
|
34
35
|
disabledUI?: boolean,
|
36
|
+
iconActivation?: string,
|
35
37
|
click?: ((...params: any[]) => any),
|
36
38
|
clicked?: ((...params: any[]) => any),
|
37
39
|
iconCreated?: ((...params: any[]) => any),
|
@@ -4,6 +4,7 @@ import { Ext } from '../../tr-grid-util/es6/Ext.js';
|
|
4
4
|
import { GridPlugin } from '../../tr-grid-util/es6/GridPlugin.js';
|
5
5
|
import { FilterBuilder } from '../../tr-grid-util/es6/FilterBuilder.js';
|
6
6
|
import { ElfUtil } from '../../tr-grid-util/es6/ElfUtil.js';
|
7
|
+
import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
|
7
8
|
/** @event RowFilteringPlugin#click
|
8
9
|
* @description click event is dispatched when a user clicks the column filter icon.
|
9
10
|
*/
|
@@ -71,6 +72,7 @@ The expression can take various forms:<br>
|
|
71
72
|
/** @typedef {Object} RowFilteringPlugin~Options
|
72
73
|
* @description The options can be specified by `rowFiltering` property of the main grid's options
|
73
74
|
* @property {boolean=} disabledUI=false If enabled, filter icon will not be created/shown.
|
75
|
+
* @property {string=} iconActivation=onActiveFilter Filter icon redering behavior, can be set to `always`,`onHover`,`onActiveFilter`,or `none`
|
74
76
|
* @property {Function=} click=null Event handler dispatched when a user clicks the column filter icon.
|
75
77
|
* @property {Function=} clicked=null Alias to `click` event handler
|
76
78
|
* @property {Function=} iconCreated=null Event handler dispatched when a new column filter icon is created.
|
@@ -134,11 +136,6 @@ RowFilteringPlugin.prototype._nameMap; // Mapping name to filter function for re
|
|
134
136
|
*/
|
135
137
|
|
136
138
|
RowFilteringPlugin.prototype._disabled = false;
|
137
|
-
/** @type {boolean}
|
138
|
-
* @private
|
139
|
-
*/
|
140
|
-
|
141
|
-
RowFilteringPlugin.prototype._disabledUI = false;
|
142
139
|
/** @type {Object.<string, boolean>}
|
143
140
|
* @private
|
144
141
|
*/
|
@@ -165,6 +162,11 @@ RowFilteringPlugin.prototype._columnFilters;
|
|
165
162
|
*/
|
166
163
|
|
167
164
|
RowFilteringPlugin.prototype._activeColFilters = null;
|
165
|
+
/** @type {string}
|
166
|
+
* @private
|
167
|
+
*/
|
168
|
+
|
169
|
+
RowFilteringPlugin.prototype._iconActivation = "onActiveFilter";
|
168
170
|
/** @type {number}
|
169
171
|
* @private
|
170
172
|
*/
|
@@ -231,6 +233,15 @@ RowFilteringPlugin.prototype.initialize = function (host, options) {
|
|
231
233
|
|
232
234
|
this._hosts.push(host);
|
233
235
|
|
236
|
+
if (!RowFilteringPlugin._styles) {
|
237
|
+
RowFilteringPlugin._styles = prettifyCss([".hovering-filter-icon .cell:not(.active-filter):hover .floating-panel .title-filter-icon", ["display: flex;"], ".hovering-filter-icon .cell:not(.active-filter) .floating-panel .title-filter-icon", ["display: none;"], ".floating-panel", ["position:relative;"], ".floating-panel .title-filter-icon", ["color: var(--grid-title-filter-icon-color,inherit);"], ".floating-panel .title-filter-icon:hover", ["color: var(--grid-title-filter-icon-hover-color,inherit);"], ".hovering-filter-icon .tiny-col .cell:hover, .tr-grid .tiny-col .cell.active-filter", ["padding-left:0px;"], ".tiny-col .cell .floating-panel .title-filter-icon:before", ["content: '.';", "position: absolute;", "margin-left: auto;", "margin-right: auto;", "left: 0;", "right: 0;", "top: -10px;", "font-size: 10px;", "font-family: monospace;", "color: var(--grid-title-dot-icon,inherit);", "text-align:center;"]]);
|
238
|
+
}
|
239
|
+
|
240
|
+
if (!host._rowFilteringStyles) {
|
241
|
+
host._rowFilteringStyles = true;
|
242
|
+
injectCss(RowFilteringPlugin._styles, host.getElement());
|
243
|
+
}
|
244
|
+
|
234
245
|
host.unloadPlugin("ColumnFilterPlugin");
|
235
246
|
host.listen("preSectionRender", this._onPreSectionRender);
|
236
247
|
host.listen("postDataSourceChanged", this._requestFilterRefresh); // TODO: Check if this is necessary
|
@@ -275,7 +286,17 @@ RowFilteringPlugin.prototype.config = function (options) {
|
|
275
286
|
|
276
287
|
if (rowFiltering) {
|
277
288
|
if (rowFiltering["disabledUI"] || rowFiltering["uiDisabled"]) {
|
278
|
-
this.
|
289
|
+
this._iconActivation = "none";
|
290
|
+
}
|
291
|
+
|
292
|
+
if (rowFiltering["iconActivation"]) {
|
293
|
+
this._iconActivation = rowFiltering["iconActivation"];
|
294
|
+
|
295
|
+
if (this._iconActivation === "onHover") {
|
296
|
+
this._hosts[0].enableClass("hovering-filter-icon", true);
|
297
|
+
} else {
|
298
|
+
this._hosts[0].enableClass("hovering-filter-icon", false);
|
299
|
+
}
|
279
300
|
}
|
280
301
|
|
281
302
|
if (rowFiltering["clicked"]) {
|
@@ -302,6 +323,8 @@ RowFilteringPlugin.prototype.config = function (options) {
|
|
302
323
|
|
303
324
|
this._setColumnOptions(i, column);
|
304
325
|
}
|
326
|
+
|
327
|
+
this.updateAllColumnIcons(); //Create icon at first time
|
305
328
|
};
|
306
329
|
/** @public
|
307
330
|
* @param {Object=} gridOptions
|
@@ -352,7 +375,7 @@ RowFilteringPlugin.prototype.getConfigObject = function (gridOptions) {
|
|
352
375
|
extOptions = obj.rowFiltering = {};
|
353
376
|
}
|
354
377
|
|
355
|
-
extOptions.
|
378
|
+
extOptions.iconActivation = this._iconActivation;
|
356
379
|
return obj;
|
357
380
|
};
|
358
381
|
/** All filter logics in DataView will be temporarily removed until re-enabling. This is useful when trying to insert an item at the specified index. After re-enabling, both logics and icons will be restored.
|
@@ -604,12 +627,12 @@ RowFilteringPlugin.prototype.setColumnFilter = function (colIndex, exp, ctx) {
|
|
604
627
|
|
605
628
|
|
606
629
|
RowFilteringPlugin.prototype._setColumnOptions = function (colIndex, columnOptions) {
|
607
|
-
var fieldDataType = columnOptions["fieldDataType"]; // TODO: This should not be set here
|
630
|
+
var fieldDataType = columnOptions["fieldDataType"] || columnOptions["dataType"]; // TODO: This should not be set here, should retreive data type from Composite/Realtime Grid
|
608
631
|
|
609
632
|
if (fieldDataType) {
|
610
633
|
var colOptions = this._newExtColumnOptions(colIndex);
|
611
634
|
|
612
|
-
colOptions.fieldDataType = fieldDataType; // TODO: This should not be set here
|
635
|
+
colOptions.fieldDataType = fieldDataType; // TODO: This should not be set here, should retreive data type from Composite/Realtime Grid
|
613
636
|
}
|
614
637
|
|
615
638
|
var exp = columnOptions["filter"];
|
@@ -1143,7 +1166,7 @@ RowFilteringPlugin.prototype._requestFilterRefresh = function () {
|
|
1143
1166
|
|
1144
1167
|
|
1145
1168
|
RowFilteringPlugin.prototype._setTimerForUpdatingIcons = function () {
|
1146
|
-
if (this.
|
1169
|
+
if (this._iconActivation === "none") {
|
1147
1170
|
return;
|
1148
1171
|
}
|
1149
1172
|
|
@@ -1216,10 +1239,6 @@ RowFilteringPlugin.prototype.refresh = function () {
|
|
1216
1239
|
|
1217
1240
|
|
1218
1241
|
RowFilteringPlugin.prototype._updateColumnIcon = function (colIndex) {
|
1219
|
-
if (this._disabledUI) {
|
1220
|
-
return;
|
1221
|
-
}
|
1222
|
-
|
1223
1242
|
var cfo = this._getColumnFilterOption(colIndex);
|
1224
1243
|
|
1225
1244
|
var hasFilter = cfo ? cfo._filters.length : 0;
|
@@ -1244,9 +1263,11 @@ RowFilteringPlugin.prototype._updateColumnIcon = function (colIndex) {
|
|
1244
1263
|
cell["updatePadding"]();
|
1245
1264
|
}
|
1246
1265
|
|
1247
|
-
|
1266
|
+
var onActiveFilter = this._iconActivation !== "always" && this._iconActivation !== "onHover";
|
1267
|
+
var noFilterIcon = this._disabled || this._iconActivation === "none" || onActiveFilter && !hasFilter;
|
1268
|
+
|
1269
|
+
if (!noFilterIcon) {
|
1248
1270
|
if (!cell._filterIcon) {
|
1249
|
-
cell.addClass("filtering");
|
1250
1271
|
var filterIcon;
|
1251
1272
|
|
1252
1273
|
if (ElfUtil.hasComponent("ef-icon") >= 3) {
|
@@ -1257,6 +1278,8 @@ RowFilteringPlugin.prototype._updateColumnIcon = function (colIndex) {
|
|
1257
1278
|
filterIcon.className = "filter-symbol icon-filter ef-icon";
|
1258
1279
|
}
|
1259
1280
|
|
1281
|
+
filterIcon.classList.add("title-filter-icon"); // Icon reference
|
1282
|
+
|
1260
1283
|
filterIcon.addEventListener("click", this._onIconClick, false);
|
1261
1284
|
|
1262
1285
|
this._dispatch("iconCreated", {
|
@@ -1268,11 +1291,17 @@ RowFilteringPlugin.prototype._updateColumnIcon = function (colIndex) {
|
|
1268
1291
|
cell.insertFloatingIcon(filterIcon, 10);
|
1269
1292
|
cell._filterIcon = filterIcon;
|
1270
1293
|
}
|
1294
|
+
|
1295
|
+
if (hasFilter || this._iconActivation == "always") {
|
1296
|
+
cell.enableClass("active-filter", true);
|
1297
|
+
} else {
|
1298
|
+
cell.enableClass("active-filter", false);
|
1299
|
+
}
|
1271
1300
|
} else {
|
1272
1301
|
if (cell._filterIcon) {
|
1273
1302
|
cell.removeFloatingIcon(cell._filterIcon);
|
1274
1303
|
cell._filterIcon = null;
|
1275
|
-
cell.
|
1304
|
+
cell.enableClass("active-filter", false);
|
1276
1305
|
}
|
1277
1306
|
}
|
1278
1307
|
}
|
@@ -1614,38 +1643,64 @@ RowFilteringPlugin.prototype.openDialog = function (colIndex, options) {
|
|
1614
1643
|
nodes: [],
|
1615
1644
|
checked: selectedItems[formattedVal] ? true : false
|
1616
1645
|
};
|
1617
|
-
});
|
1646
|
+
}); //Setting up default default column options
|
1618
1647
|
|
1619
|
-
var colOptions = this.
|
1648
|
+
var colOptions = this._newExtColumnOptions(colIndex);
|
1620
1649
|
|
1621
1650
|
var fdt = "";
|
1651
|
+
var sui = true;
|
1652
|
+
var fui = true;
|
1653
|
+
var lang = "";
|
1622
1654
|
|
1623
|
-
if (colOptions
|
1624
|
-
|
1625
|
-
|
1655
|
+
if (colOptions) {
|
1656
|
+
if (colOptions.fieldDataType != null) {
|
1657
|
+
fdt = colOptions.fieldDataType; // TODO: Retrieve data type from Composite/Realtime Grid instead
|
1658
|
+
}
|
1659
|
+
|
1660
|
+
if (colOptions.sortUI != null) {
|
1661
|
+
sui = colOptions.sortUI;
|
1662
|
+
}
|
1663
|
+
|
1664
|
+
if (colOptions.filterUI != null) {
|
1665
|
+
fui = colOptions.filterUI;
|
1666
|
+
}
|
1667
|
+
|
1668
|
+
if (colOptions.lang != null) {
|
1669
|
+
lang = colOptions.lang;
|
1670
|
+
}
|
1626
1671
|
}
|
1627
1672
|
|
1628
1673
|
var dialogConfig = {
|
1629
|
-
sortUI:
|
1630
|
-
filterUI:
|
1631
|
-
fieldDataType: fdt
|
1674
|
+
sortUI: sui,
|
1675
|
+
filterUI: fui,
|
1676
|
+
fieldDataType: fdt,
|
1677
|
+
lang: lang
|
1632
1678
|
};
|
1633
1679
|
|
1634
1680
|
if (options && _typeof(options) === "object") {
|
1635
|
-
|
1636
|
-
|
1681
|
+
var fieldDataType = options["fieldDataType"];
|
1682
|
+
var sortUI = options["sortUI"];
|
1683
|
+
var filterUI = options["filterUI"];
|
1684
|
+
var optionLang = options["lang"];
|
1685
|
+
|
1686
|
+
if (sortUI === false) {
|
1687
|
+
dialogConfig.sortUI = sortUI;
|
1688
|
+
colOptions.sortUI = sortUI;
|
1637
1689
|
}
|
1638
1690
|
|
1639
|
-
if (
|
1640
|
-
dialogConfig.filterUI =
|
1691
|
+
if (filterUI === false) {
|
1692
|
+
dialogConfig.filterUI = filterUI;
|
1693
|
+
colOptions.filterUI = filterUI;
|
1641
1694
|
}
|
1642
1695
|
|
1643
|
-
if (
|
1644
|
-
dialogConfig.fieldDataType =
|
1696
|
+
if (fieldDataType != null) {
|
1697
|
+
dialogConfig.fieldDataType = fieldDataType;
|
1698
|
+
colOptions.fieldDataType = fieldDataType;
|
1645
1699
|
}
|
1646
1700
|
|
1647
|
-
if (
|
1648
|
-
dialogConfig.lang =
|
1701
|
+
if (optionLang != null) {
|
1702
|
+
dialogConfig.lang = optionLang;
|
1703
|
+
colOptions.lang = optionLang;
|
1649
1704
|
}
|
1650
1705
|
}
|
1651
1706
|
|