@refinitiv-ui/efx-grid 6.0.1 → 6.0.2
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-selection-dialog/lib/column-selection-dialog.js +80 -18
- 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 +12961 -10749
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/data/DataView.d.ts +22 -7
- package/lib/core/es6/data/DataView.js +176 -49
- 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 +393 -155
- 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 +314 -27
- 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/filter-dialog.js +8 -6
- package/lib/grid/lib/efx-grid.d.ts +14 -7
- package/lib/grid/lib/efx-grid.js +113 -114
- package/lib/grid/themes/base.less +4 -2
- 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/row-segmenting/es6/RowSegmenting.d.ts +1 -0
- package/lib/row-segmenting/es6/RowSegmenting.js +40 -11
- package/lib/rt-grid/dist/rt-grid.js +10290 -7864
- 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 +241 -74
- 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 +2 -0
- package/lib/tr-grid-checkbox/es6/Checkbox.js +29 -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 +1 -0
- 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-row-dragging/es6/RowDragging.js +102 -12
- 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 +5 -1
- package/lib/tr-grid-row-selection/es6/RowSelection.js +188 -7
- 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/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 +2 -2
- 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 +66 -12
- 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/types/es6/CellSelection.d.ts +1 -1
- package/lib/types/es6/Checkbox.d.ts +2 -0
- 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 +22 -7
- 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/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/RowFiltering.d.ts +2 -0
- package/lib/types/es6/RowSegmenting.d.ts +1 -0
- package/lib/types/es6/RowSelection.d.ts +5 -1
- package/lib/types/es6/Zoom.d.ts +2 -1
- package/lib/types/es6/index.d.ts +2 -0
- package/lib/versions.json +17 -17
- package/lib/zoom/es6/Zoom.d.ts +2 -1
- package/lib/zoom/es6/Zoom.js +11 -4
- package/package.json +7 -7
@@ -3,6 +3,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
3
3
|
import { Ext } from "../../tr-grid-util/es6/Ext.js";
|
4
4
|
import { Dom } from "../../tr-grid-util/es6/Dom.js";
|
5
5
|
import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
|
6
|
+
import { ElfUtil } from "../../tr-grid-util/es6/ElfUtil.js";
|
7
|
+
import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
|
6
8
|
/** @event ColumnSelectionPlugin#selectionChanged
|
7
9
|
* @description Fired when selection is changed by mouse down or key press. A change by JavaScript APIs will not trigger this event.
|
8
10
|
*/
|
@@ -12,6 +14,8 @@ import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
|
|
12
14
|
* @property {boolean=} singleSelection=false If enabled, user can have one selection at any moment
|
13
15
|
* @property {boolean=} clickToggle=false If enabled, click at the already selected column will deselect it
|
14
16
|
* @property {Function=} selectionChanged=null selectionChanged event handler
|
17
|
+
* @property {Function=} menuClicked=null Event Handler when user clicks on menu icon.
|
18
|
+
* @property {string=} menuPosition="outside" show icon in column grid that have style outside and non-outside
|
15
19
|
*/
|
16
20
|
|
17
21
|
/** @typedef {Object} ColumnSelectionPlugin~ColumnOptions
|
@@ -31,6 +35,9 @@ var ColumnSelectionPlugin = function ColumnSelectionPlugin(options) {
|
|
31
35
|
t._onKeyDown = t._onKeyDown.bind(t);
|
32
36
|
t._onColumnRemoved = t._onColumnRemoved.bind(t);
|
33
37
|
t._onReselection = t._onReselection.bind(t);
|
38
|
+
t._onThemeLoaded = t._onThemeLoaded.bind(t);
|
39
|
+
t._onColumnPositionChanged = t._onColumnPositionChanged.bind(t);
|
40
|
+
t._updateMenuIcon = t._updateMenuIcon.bind(t);
|
34
41
|
t._hosts = [];
|
35
42
|
|
36
43
|
if (options) {
|
@@ -81,7 +88,27 @@ ColumnSelectionPlugin.prototype._timerId = 0;
|
|
81
88
|
* @private
|
82
89
|
*/
|
83
90
|
|
91
|
+
ColumnSelectionPlugin.prototype._timerMenuId = 0;
|
92
|
+
/** @type {number}
|
93
|
+
* @private
|
94
|
+
*/
|
95
|
+
|
84
96
|
ColumnSelectionPlugin.prototype._pendingSelection = -1;
|
97
|
+
/** @type {Function}
|
98
|
+
* @private
|
99
|
+
*/
|
100
|
+
|
101
|
+
ColumnSelectionPlugin.prototype._onMenuClicked = null;
|
102
|
+
/** @type {Object}
|
103
|
+
* @private
|
104
|
+
*/
|
105
|
+
|
106
|
+
ColumnSelectionPlugin.prototype._menuButton = null;
|
107
|
+
/** @type {string}
|
108
|
+
* @private
|
109
|
+
*/
|
110
|
+
|
111
|
+
ColumnSelectionPlugin.prototype._menuPosition = "outside";
|
85
112
|
/** @public
|
86
113
|
* @return {string}
|
87
114
|
*/
|
@@ -115,7 +142,51 @@ ColumnSelectionPlugin.prototype.initialize = function (host, options) {
|
|
115
142
|
host.listen("mousedown", this._onMouseDown);
|
116
143
|
host.listen("keydown", this._onKeyDown);
|
117
144
|
host.listen("columnRemoved", this._onColumnRemoved);
|
145
|
+
host.listen("columnPositionChanged", this._onColumnPositionChanged);
|
118
146
|
this.config(options);
|
147
|
+
|
148
|
+
if (this._onMenuClicked) {
|
149
|
+
// use styles menu icon only when want to use icon menu
|
150
|
+
if (ColumnSelectionPlugin._stylePromise) {
|
151
|
+
ColumnSelectionPlugin._applyThemeColor(host);
|
152
|
+
} else {
|
153
|
+
ColumnSelectionPlugin._stylePromise = ElfUtil.getThemeColors();
|
154
|
+
|
155
|
+
ColumnSelectionPlugin._stylePromise.then(this._onThemeLoaded);
|
156
|
+
}
|
157
|
+
}
|
158
|
+
};
|
159
|
+
/** @private
|
160
|
+
* @param {Object} colors
|
161
|
+
*/
|
162
|
+
|
163
|
+
|
164
|
+
ColumnSelectionPlugin.prototype._onThemeLoaded = function (colors) {
|
165
|
+
if (!ColumnSelectionPlugin._styles) {
|
166
|
+
var styles = [".column-selection-menu", ["position: absolute;", "background-color: var(--grid-column-menu-icon-bgcolor);", "color: var(--grid-column-menu-icon-color);", "z-index: 1;", "cursor: pointer;", "text-align: center;", "width: 16px;", "height: 16px;", "padding: 6px;"], ".column-selection-menu:hover", ["background-color: var(--grid-column-menu-icon-hover-bgcolor);"], ".column-selection-menu-inside", ["padding: 4px;" // if not outside icon, move to inside
|
167
|
+
]];
|
168
|
+
ColumnSelectionPlugin._styles = prettifyCss(styles);
|
169
|
+
}
|
170
|
+
|
171
|
+
for (var i = this._hosts.length; --i >= 0;) {
|
172
|
+
ColumnSelectionPlugin._applyThemeColor(this._hosts[i]);
|
173
|
+
}
|
174
|
+
};
|
175
|
+
/** @private
|
176
|
+
* @param {Object} grid core grid instance
|
177
|
+
*/
|
178
|
+
|
179
|
+
|
180
|
+
ColumnSelectionPlugin._applyThemeColor = function (grid) {
|
181
|
+
if (!grid || grid._columnSelectionStyles) {
|
182
|
+
return;
|
183
|
+
}
|
184
|
+
|
185
|
+
if (ColumnSelectionPlugin._styles) {
|
186
|
+
grid._columnSelectionStyles = true; // Prevent loading the same style twice
|
187
|
+
|
188
|
+
injectCss(ColumnSelectionPlugin._styles, grid.getParent());
|
189
|
+
}
|
119
190
|
};
|
120
191
|
/** @public
|
121
192
|
* @param {Object=} host core grid object
|
@@ -133,6 +204,7 @@ ColumnSelectionPlugin.prototype.unload = function (host) {
|
|
133
204
|
host.unlisten("mousedown", this._onMouseDown);
|
134
205
|
host.unlisten("keydown", this._onKeyDown);
|
135
206
|
host.unlisten("columnRemoved", this._onColumnRemoved);
|
207
|
+
host.unlisten("columnPositionChanged", this._onColumnPositionChanged);
|
136
208
|
|
137
209
|
this._hosts.splice(at, 1);
|
138
210
|
|
@@ -140,6 +212,7 @@ ColumnSelectionPlugin.prototype.unload = function (host) {
|
|
140
212
|
if (this._timerId) {
|
141
213
|
clearTimeout(this._timerId);
|
142
214
|
this._timerId = 0;
|
215
|
+
this._timerMenuId = 0;
|
143
216
|
}
|
144
217
|
}
|
145
218
|
|
@@ -171,6 +244,18 @@ ColumnSelectionPlugin.prototype.config = function (options) {
|
|
171
244
|
this._clickToggleMode = true;
|
172
245
|
}
|
173
246
|
|
247
|
+
val = pluginOptions["menuClicked"];
|
248
|
+
|
249
|
+
if (val) {
|
250
|
+
this._onMenuClicked = val;
|
251
|
+
}
|
252
|
+
|
253
|
+
val = pluginOptions["menuPosition"];
|
254
|
+
|
255
|
+
if (val) {
|
256
|
+
this._menuPosition = val;
|
257
|
+
}
|
258
|
+
|
174
259
|
this.addListener(pluginOptions, "selectionChanged");
|
175
260
|
}
|
176
261
|
} else if (pluginOptions != null) {
|
@@ -378,9 +463,11 @@ ColumnSelectionPlugin.prototype.setSelectedColumn = function (colIndex, opt_sele
|
|
378
463
|
var len = this._hosts.length;
|
379
464
|
|
380
465
|
for (var i = 0; i < len; ++i) {
|
381
|
-
this._hosts[i].
|
466
|
+
this._hosts[i].selectColumn(colIndex, selection);
|
382
467
|
}
|
383
468
|
|
469
|
+
this._updateMenuIcon();
|
470
|
+
|
384
471
|
return true;
|
385
472
|
};
|
386
473
|
/** Select the specified column on an active grid, and clear all other column selections
|
@@ -428,6 +515,127 @@ ColumnSelectionPlugin.prototype.selectRange = function (anchorIndex, len, opt_gr
|
|
428
515
|
ColumnSelectionPlugin.prototype.selectAllColumns = function () {
|
429
516
|
this.selectRange(0, this.getColumnCount());
|
430
517
|
};
|
518
|
+
/** @private
|
519
|
+
* @param {Object} e
|
520
|
+
*/
|
521
|
+
|
522
|
+
|
523
|
+
ColumnSelectionPlugin.prototype._onColumnPositionChanged = function (e) {
|
524
|
+
if (this._timerMenuId) {
|
525
|
+
return;
|
526
|
+
}
|
527
|
+
|
528
|
+
if (e.sender && e.sender === this._activeGrid) {
|
529
|
+
this._clearMenuIcon(); // Clear icon before re-renderer
|
530
|
+
|
531
|
+
|
532
|
+
this._timerMenuId = setTimeout(this._updateMenuIcon, 800);
|
533
|
+
}
|
534
|
+
};
|
535
|
+
/** @private
|
536
|
+
* @return {boolean} return true if icon added
|
537
|
+
*/
|
538
|
+
|
539
|
+
|
540
|
+
ColumnSelectionPlugin.prototype._updateMenuIcon = function () {
|
541
|
+
this._timerMenuId = 0;
|
542
|
+
|
543
|
+
if (!this._onMenuClicked) {
|
544
|
+
// When not set to onMenuClicked, the icon is not displayed
|
545
|
+
return false;
|
546
|
+
}
|
547
|
+
|
548
|
+
var startColIndex = this.getFirstSelectedColumn();
|
549
|
+
var host = this._activeGrid;
|
550
|
+
|
551
|
+
if (startColIndex < 0 || !host) {
|
552
|
+
this._clearMenuIcon();
|
553
|
+
|
554
|
+
return false;
|
555
|
+
}
|
556
|
+
|
557
|
+
var parentEl = host.getParent().parentNode;
|
558
|
+
var endColIndex = this.getLastSelectedColumn();
|
559
|
+
var rectPos = host.getColumnRect(startColIndex, endColIndex);
|
560
|
+
|
561
|
+
if (rectPos.width <= 0 || rectPos.left > rectPos.gridWidth) {
|
562
|
+
// hide icon when selection left or right not show.
|
563
|
+
this._clearMenuIcon();
|
564
|
+
|
565
|
+
return false;
|
566
|
+
}
|
567
|
+
|
568
|
+
if (!this._menuButton) {
|
569
|
+
this._menuButton = document.createElement("div");
|
570
|
+
|
571
|
+
this._menuButton.classList.add("column-selection-menu");
|
572
|
+
|
573
|
+
if (this._menuPosition !== "outside") {
|
574
|
+
this._menuButton.classList.add("column-selection-menu-inside"); // currently not support runtime change
|
575
|
+
|
576
|
+
}
|
577
|
+
|
578
|
+
var coralItem = document.createElement("ef-icon");
|
579
|
+
coralItem.icon = "most-detail";
|
580
|
+
|
581
|
+
this._menuButton.appendChild(coralItem);
|
582
|
+
|
583
|
+
this._menuButton.addEventListener("click", this._onMenuClicked);
|
584
|
+
}
|
585
|
+
|
586
|
+
parentEl.appendChild(this._menuButton);
|
587
|
+
var c;
|
588
|
+
var iconSize = 28; // calculate actual view when have pinned right
|
589
|
+
|
590
|
+
var pinnedLeftCount = rectPos.leftPinnedIndex;
|
591
|
+
var pinnedLeftSize = 0;
|
592
|
+
|
593
|
+
for (c = 0; c <= pinnedLeftCount; c++) {
|
594
|
+
// include index 0 from leftPinnedIndex
|
595
|
+
pinnedLeftSize = pinnedLeftSize + host.getColumnWidth(c);
|
596
|
+
}
|
597
|
+
|
598
|
+
var rightPx = rectPos.left + rectPos.width;
|
599
|
+
var leftOffset = rightPx;
|
600
|
+
var topOffset = rectPos.top;
|
601
|
+
|
602
|
+
if (this._menuPosition !== "outside") {
|
603
|
+
iconSize = 24; // edit size icon and re-calculate
|
604
|
+
|
605
|
+
this._menuButton.classList.add("column-selection-menu-inside");
|
606
|
+
|
607
|
+
var actualView = rightPx + iconSize;
|
608
|
+
var endRightPosition = rectPos.scrollViewSize + pinnedLeftSize; // rectPos.scrollViewSize doesn't including pinned left size
|
609
|
+
|
610
|
+
if (actualView >= endRightPosition) {
|
611
|
+
// case swap top right to left side column, when can't add menu in right side (overflow right)
|
612
|
+
leftOffset = rectPos.left - iconSize;
|
613
|
+
|
614
|
+
if (leftOffset < 0) {
|
615
|
+
// only case select all row in inside mode
|
616
|
+
leftOffset = rectPos.gridWidth - iconSize;
|
617
|
+
}
|
618
|
+
}
|
619
|
+
} else {
|
620
|
+
// TODO : support in another mode currently have "outside" and "inside"
|
621
|
+
if (rightPx >= rectPos.gridWidth) {
|
622
|
+
leftOffset = rectPos.gridWidth; // Menu move to the right size if inside mode when overflow grid
|
623
|
+
}
|
624
|
+
}
|
625
|
+
|
626
|
+
this._menuButton.style.left = leftOffset + "px"; // Menu icon position in top right
|
627
|
+
|
628
|
+
this._menuButton.style.top = topOffset + "px";
|
629
|
+
return true;
|
630
|
+
};
|
631
|
+
/** @private */
|
632
|
+
|
633
|
+
|
634
|
+
ColumnSelectionPlugin.prototype._clearMenuIcon = function () {
|
635
|
+
if (this._menuButton && this._menuButton.parentNode) {
|
636
|
+
this._menuButton.parentNode.removeChild(this._menuButton);
|
637
|
+
}
|
638
|
+
};
|
431
639
|
/** @public */
|
432
640
|
|
433
641
|
|
@@ -438,13 +646,15 @@ ColumnSelectionPlugin.prototype.clearAllSelections = function () {
|
|
438
646
|
for (var c = this.getColumnCount(); --c >= 0;) {
|
439
647
|
if (this.isSelectedColumn(c)) {
|
440
648
|
for (var i = 0; i < tableCount; ++i) {
|
441
|
-
this._hosts[i].
|
649
|
+
this._hosts[i].selectColumn(c, false);
|
442
650
|
}
|
443
651
|
}
|
444
652
|
}
|
445
653
|
|
446
654
|
this._hasSelection = false;
|
447
655
|
this._activeGrid = this._hosts[0] || null; // Maintain selectability even if there is no selection
|
656
|
+
|
657
|
+
this._clearMenuIcon();
|
448
658
|
}
|
449
659
|
};
|
450
660
|
/** Alias to clearAllSelections() method
|
@@ -492,7 +702,7 @@ ColumnSelectionPlugin.prototype.deselectAll = ColumnSelectionPlugin.prototype.cl
|
|
492
702
|
|
493
703
|
ColumnSelectionPlugin.prototype.isSelectedColumn = function (colIndex) {
|
494
704
|
if (this._activeGrid) {
|
495
|
-
return this._activeGrid.
|
705
|
+
return this._activeGrid.isSelectedColumn(colIndex);
|
496
706
|
}
|
497
707
|
|
498
708
|
return false;
|
@@ -670,7 +880,13 @@ ColumnSelectionPlugin.prototype._onColumnRemoved = function (e) {
|
|
670
880
|
this._hasSelection = false;
|
671
881
|
|
672
882
|
if (this._pendingSelection < 0) {
|
673
|
-
|
883
|
+
var colIndex = e.colIndex;
|
884
|
+
|
885
|
+
if (colIndex >= this.getColumnCount()) {
|
886
|
+
colIndex = this.getColumnCount() - 1;
|
887
|
+
}
|
888
|
+
|
889
|
+
this._pendingSelection = colIndex;
|
674
890
|
}
|
675
891
|
|
676
892
|
this._timerId = setTimeout(this._onReselection, 10);
|
@@ -688,6 +904,12 @@ ColumnSelectionPlugin.prototype._onReselection = function (e) {
|
|
688
904
|
this._timerId = 0;
|
689
905
|
this.setSelectedColumn(this._pendingSelection, true);
|
690
906
|
this._pendingSelection = -1;
|
907
|
+
|
908
|
+
if (!this._activeGrid) {
|
909
|
+
this._activeGrid = this._hosts[0];
|
910
|
+
}
|
911
|
+
|
912
|
+
this._activeGrid.focus();
|
691
913
|
};
|
692
914
|
/** @private
|
693
915
|
* @param {KeyboardEvent} e
|
@@ -779,6 +779,9 @@ ColumnStackPlugin.prototype.stackColumns = function(colIndices, stackId, options
|
|
779
779
|
* @return {boolean} true if the stack has been modified
|
780
780
|
*/
|
781
781
|
ColumnStackPlugin.prototype.setStack = function(colRefs) {
|
782
|
+
if(!this._initializedGrid) {
|
783
|
+
return false;
|
784
|
+
}
|
782
785
|
colRefs = this.getColumnIndices(colRefs);
|
783
786
|
if(colRefs.length <= 1) { // When the array is empty or contains only one element, all stacking is removed
|
784
787
|
return this.removeAllStacks();
|
@@ -363,6 +363,7 @@ ConditionalColoringPlugin.prototype.setColumnColoring = function (colIndex, colu
|
|
363
363
|
if(colorOptions.condColoring) {
|
364
364
|
painter.setConditions(colorOptions.condColoring.conditions);
|
365
365
|
} else if(colorOptions.colorText) {
|
366
|
+
painter.resetColoring(); //Clear conditions before add new color
|
366
367
|
painter.addColorTextWithTheme(colorOptions.colorText.field);
|
367
368
|
}
|
368
369
|
|
@@ -16,11 +16,13 @@ declare namespace FilterInputPlugin {
|
|
16
16
|
disabled?: boolean,
|
17
17
|
placeholder?: string,
|
18
18
|
type?: string,
|
19
|
-
entries?: any[]
|
19
|
+
entries?: any[],
|
20
|
+
trigger?: string
|
20
21
|
};
|
21
22
|
|
22
23
|
type Options = {
|
23
|
-
inputCreated?: ((...params: any[]) => any)
|
24
|
+
inputCreated?: ((...params: any[]) => any),
|
25
|
+
trigger?: string
|
24
26
|
};
|
25
27
|
|
26
28
|
}
|
@@ -16,11 +16,13 @@ import { CoralItems } from '../../tr-grid-util/es6/CoralItems.js';
|
|
16
16
|
* @property {string=} placeholder="" Placeholder text inside the input
|
17
17
|
* @property {string=} type="text" Type of UI. Available types are "number", "select", "dropdown", "date"
|
18
18
|
* @property {Array=} entries Entries of dropdown filters when type is "select"
|
19
|
+
* @property {string=} trigger="keyup" Available types of trigger are `false | ""` (no trigger) , `"keyup"` (default) , `"enter"` (on enter key *only available for text type)
|
19
20
|
*/
|
20
21
|
|
21
22
|
/** @typedef {Object} FilterInputPlugin~Options
|
22
23
|
* @description FilterInputPlugin options available in main grid configuration under `filterInput` property
|
23
24
|
* @property {Function=} inputCreated=null Handler executed after filter input is created
|
25
|
+
* @property {string=} trigger="keyup" Available types of trigger are `false | ""` (no trigger) , `"keyup"` (default) , `"enter"` (on enter key *only available for text type)
|
24
26
|
*/
|
25
27
|
|
26
28
|
/** @callback {Function} FilterInputPlugin~FilterLogic
|
@@ -102,6 +104,11 @@ FilterInputPlugin.prototype._uiTimer = 0;
|
|
102
104
|
*/
|
103
105
|
|
104
106
|
FilterInputPlugin.prototype._freezeInputValue = false;
|
107
|
+
/** @type {string|boolean}
|
108
|
+
* @private
|
109
|
+
*/
|
110
|
+
|
111
|
+
FilterInputPlugin.prototype._inputTrigger = "keyup";
|
105
112
|
/** @public
|
106
113
|
* @return {string}
|
107
114
|
*/
|
@@ -204,7 +211,15 @@ FilterInputPlugin.prototype.config = function (options) {
|
|
204
211
|
|
205
212
|
this._gridConfig = options; // For loading dependency
|
206
213
|
|
207
|
-
|
214
|
+
var filterInputOptions = options["filterInput"];
|
215
|
+
this.addListener(filterInputOptions, "inputCreated");
|
216
|
+
|
217
|
+
if (filterInputOptions) {
|
218
|
+
if (filterInputOptions["trigger"] != null) {
|
219
|
+
this._inputTrigger = filterInputOptions["trigger"];
|
220
|
+
}
|
221
|
+
}
|
222
|
+
|
208
223
|
var columns = options["columns"];
|
209
224
|
var len = columns ? columns.length : 0;
|
210
225
|
|
@@ -259,6 +274,10 @@ FilterInputPlugin.prototype.getConfigObject = function (out_obj) {
|
|
259
274
|
if (opt.entries != null) {
|
260
275
|
filterInput.entries = opt.entries;
|
261
276
|
}
|
277
|
+
|
278
|
+
if (opt.trigger != null) {
|
279
|
+
filterInput.trigger = opt.trigger;
|
280
|
+
}
|
262
281
|
}
|
263
282
|
|
264
283
|
return obj;
|
@@ -384,7 +403,7 @@ FilterInputPlugin.prototype._onDateChanged = function (e) {
|
|
384
403
|
if (host) {
|
385
404
|
var pos = host.getRelativePosition(e);
|
386
405
|
var colIndex = pos.colIndex;
|
387
|
-
var dateObj = ElfDate.getDate(e.detail); // TODO: Date object should be used for filtering instead of string
|
406
|
+
var dateObj = ElfDate.getDate(e.detail) || e.target.value; // TODO: Date object should be used for filtering instead of string
|
388
407
|
|
389
408
|
var dateStr = dateObj ? dateObj.toDateString().substr(4) : "";
|
390
409
|
this.filterColumn(colIndex, dateStr);
|
@@ -456,6 +475,7 @@ FilterInputPlugin._uiMap = {
|
|
456
475
|
|
457
476
|
FilterInputPlugin.prototype._createFilterUI = function (colOpt) {
|
458
477
|
var elemType = colOpt.type;
|
478
|
+
var elemTrigger = colOpt.trigger != null ? colOpt.trigger : this._inputTrigger;
|
459
479
|
var uiTag = FilterInputPlugin._uiMap[elemType] || "input";
|
460
480
|
|
461
481
|
if (uiTag == "ef-input") {
|
@@ -485,32 +505,69 @@ FilterInputPlugin.prototype._createFilterUI = function (colOpt) {
|
|
485
505
|
switch (uiTag) {
|
486
506
|
case "ef-input":
|
487
507
|
elem.setAttribute("type", "number");
|
488
|
-
|
508
|
+
|
509
|
+
if (elemTrigger != false && elemTrigger != "") {
|
510
|
+
elem.addEventListener("value-changed", this._onInputChanged, false);
|
511
|
+
}
|
512
|
+
|
489
513
|
break;
|
490
514
|
|
491
515
|
case "ef-number-field":
|
492
|
-
|
516
|
+
if (elemTrigger != false && elemTrigger != "") {
|
517
|
+
elem.addEventListener("value-changed", this._onInputChanged, false);
|
518
|
+
}
|
519
|
+
|
493
520
|
break;
|
494
521
|
|
495
522
|
case "ef-select":
|
496
523
|
elem.data = CoralItems.create(colOpt.entries);
|
497
|
-
elem.addEventListener("value-changed", this._onInputChanged, false);
|
498
524
|
elem.addEventListener("opened-changed", this._onOpenedChanged, false);
|
525
|
+
|
526
|
+
if (elemTrigger != false && elemTrigger != "") {
|
527
|
+
elem.addEventListener("value-changed", this._onInputChanged, false);
|
528
|
+
}
|
529
|
+
|
499
530
|
break;
|
500
531
|
|
501
532
|
case "ef-datetime-picker":
|
502
|
-
|
533
|
+
if (elemTrigger != false && elemTrigger != "") {
|
534
|
+
elem.addEventListener("value-changed", this._onDateChanged, false);
|
535
|
+
}
|
536
|
+
|
503
537
|
break;
|
504
538
|
|
505
539
|
case "ef-search-field":
|
506
|
-
|
507
|
-
|
540
|
+
if (elemTrigger != false && elemTrigger != "") {
|
541
|
+
if (elemTrigger == "enter") {
|
542
|
+
var plugin = this;
|
543
|
+
elem.addEventListener("keyup", function (e) {
|
544
|
+
if (e.key == "Enter") {
|
545
|
+
plugin._onInputChanged(e);
|
546
|
+
}
|
547
|
+
}, false);
|
548
|
+
} else {
|
549
|
+
elem.addEventListener("value-changed", this._onInputChanged, false);
|
550
|
+
}
|
551
|
+
}
|
552
|
+
|
508
553
|
break;
|
509
554
|
|
510
555
|
default:
|
511
556
|
elem.setAttribute("type", "search");
|
512
|
-
|
513
|
-
|
557
|
+
|
558
|
+
if (elemTrigger != false && elemTrigger != "") {
|
559
|
+
if (elemTrigger == "enter") {
|
560
|
+
var fip = this;
|
561
|
+
elem.addEventListener("keyup", function (e) {
|
562
|
+
if (e.key == "Enter") {
|
563
|
+
fip._onInputChanged(e);
|
564
|
+
}
|
565
|
+
}, false);
|
566
|
+
} else {
|
567
|
+
elem.addEventListener("keyup", this._onInputChanged, false);
|
568
|
+
}
|
569
|
+
}
|
570
|
+
|
514
571
|
break;
|
515
572
|
}
|
516
573
|
|
@@ -594,6 +651,12 @@ FilterInputPlugin.prototype._retrieveColumnOption = function (colIndex, colDef)
|
|
594
651
|
});
|
595
652
|
option["entries"] = entries;
|
596
653
|
}
|
654
|
+
|
655
|
+
var trigger = filterOption["trigger"];
|
656
|
+
|
657
|
+
if (typeof trigger == "string" || trigger == false) {
|
658
|
+
option["trigger"] = trigger;
|
659
|
+
}
|
597
660
|
} else {
|
598
661
|
option["disabled"] = true;
|
599
662
|
}
|