@refinitiv-ui/efx-grid 6.0.3 → 6.0.4
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-dragging/es6/ColumnDragging.d.ts +49 -0
- package/lib/column-dragging/es6/ColumnDragging.js +764 -0
- package/lib/column-dragging/es6/index.d.ts +1 -0
- package/lib/column-dragging/es6/index.js +1 -0
- package/lib/core/dist/core.css +1 -1
- package/lib/core/dist/core.js +389 -1070
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/data/ColumnStats.d.ts +2 -2
- package/lib/core/es6/data/DataCache.d.ts +4 -4
- package/lib/core/es6/data/DataTable.d.ts +5 -5
- package/lib/core/es6/data/DataTable.js +1 -1
- package/lib/core/es6/data/DataView.d.ts +12 -12
- package/lib/core/es6/data/SegmentCollection.d.ts +3 -3
- package/lib/core/es6/data/WrappedView.d.ts +13 -13
- package/lib/core/es6/grid/Core.d.ts +29 -27
- package/lib/core/es6/grid/Core.js +26 -4
- package/lib/core/es6/grid/ILayoutGrid.d.ts +15 -15
- package/lib/core/es6/grid/LayoutGrid.js +54 -26
- package/lib/core/es6/grid/VirtualizedLayoutGrid.js +66 -0
- package/lib/core/es6/grid/components/Cell.d.ts +4 -4
- package/lib/core/es6/grid/components/CellFloatingPanel.d.ts +1 -1
- package/lib/core/es6/grid/components/CellSpans.d.ts +8 -8
- package/lib/core/es6/grid/components/Column.d.ts +1 -1
- package/lib/core/es6/grid/components/ElementWrapper.d.ts +6 -6
- package/lib/core/es6/grid/components/Scrollbar.d.ts +1 -1
- package/lib/core/es6/grid/components/StretchedCells.js +2 -2
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.d.ts +14 -6
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +147 -81
- package/lib/core/es6/grid/util/Conflator.d.ts +2 -2
- package/lib/core/es6/grid/util/ElementFrameWork.d.ts +3 -3
- package/lib/core/es6/grid/util/HttpRequest.d.ts +2 -2
- package/lib/core/es6/grid/util/PercentBarRenderer.d.ts +1 -1
- package/lib/core/es6/grid/util/RangeBar.d.ts +1 -1
- package/lib/core/es6/grid/util/SectionSettings.d.ts +5 -5
- package/lib/core/es6/grid/util/SectionSettings.js +5 -0
- package/lib/core/es6/grid/util/SelectionList.d.ts +2 -2
- package/lib/core/es6/grid/util/TrackLayout.d.ts +7 -3
- package/lib/core/es6/grid/util/TrackLayout.js +27 -0
- package/lib/core/es6/grid/util/util.d.ts +2 -2
- package/lib/core/es6/index.d.ts +1 -5
- package/lib/core/es6/index.js +1 -7
- package/lib/core/es6/tr-grid-theme.js +1 -1
- package/lib/filter-dialog/lib/filter-dialog.d.ts +1 -0
- package/lib/filter-dialog/lib/filter-dialog.js +73 -26
- package/lib/filter-dialog/themes/base-checkbox.less +8 -1
- package/lib/filter-dialog/themes/base.less +69 -1
- package/lib/filter-dialog/themes/elemental/dark/checkbox-list.js +1 -1
- package/lib/filter-dialog/themes/elemental/dark/es5/all-elements.js +2 -2
- package/lib/filter-dialog/themes/elemental/dark/filter-dialog.js +1 -1
- package/lib/filter-dialog/themes/elemental/light/checkbox-list.js +1 -1
- package/lib/filter-dialog/themes/elemental/light/es5/all-elements.js +2 -2
- package/lib/filter-dialog/themes/elemental/light/filter-dialog.js +1 -1
- package/lib/filter-dialog/themes/halo/dark/checkbox-list.js +1 -1
- package/lib/filter-dialog/themes/halo/dark/es5/all-elements.js +2 -2
- package/lib/filter-dialog/themes/halo/dark/filter-dialog.js +1 -1
- package/lib/filter-dialog/themes/halo/light/checkbox-list.js +1 -1
- package/lib/filter-dialog/themes/halo/light/es5/all-elements.js +2 -2
- package/lib/filter-dialog/themes/halo/light/filter-dialog.js +1 -1
- package/lib/filter-dialog/themes/solar/charcoal/checkbox-list.js +1 -1
- package/lib/filter-dialog/themes/solar/charcoal/es5/all-elements.js +2 -2
- package/lib/filter-dialog/themes/solar/charcoal/filter-dialog.js +1 -1
- package/lib/filter-dialog/themes/solar/pearl/checkbox-list.js +1 -1
- package/lib/filter-dialog/themes/solar/pearl/es5/all-elements.js +2 -2
- package/lib/filter-dialog/themes/solar/pearl/filter-dialog.js +1 -1
- package/lib/grid/lib/efx-grid.d.ts +8 -5
- package/lib/grid/lib/efx-grid.js +10 -4
- 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 +33 -39
- 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/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/row-segmenting/es6/RowSegmenting.d.ts +7 -2
- package/lib/row-segmenting/es6/RowSegmenting.js +94 -9
- package/lib/rt-grid/dist/rt-grid.js +567 -1171
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/ColumnDefinition.d.ts +5 -3
- package/lib/rt-grid/es6/ColumnDefinition.js +17 -108
- package/lib/rt-grid/es6/DataConnector.d.ts +3 -3
- package/lib/rt-grid/es6/Grid.d.ts +17 -9
- package/lib/rt-grid/es6/Grid.js +201 -101
- package/lib/rt-grid/es6/RowDefSorter.d.ts +19 -0
- package/lib/rt-grid/es6/RowDefSorter.js +137 -0
- package/lib/rt-grid/es6/RowDefinition.d.ts +9 -7
- package/lib/rt-grid/es6/RowDefinition.js +6 -0
- package/lib/rt-grid/es6/SnapshotFiller.d.ts +3 -1
- package/lib/rt-grid/es6/SnapshotFiller.js +23 -0
- package/lib/tr-grid-checkbox/es6/Checkbox.d.ts +2 -2
- package/lib/tr-grid-checkbox/es6/Checkbox.js +38 -20
- package/lib/tr-grid-column-selection/es6/ColumnSelection.js +46 -9
- package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +8 -4
- package/lib/tr-grid-column-stack/es6/ColumnStack.js +240 -125
- package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.d.ts +1 -1
- package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +18 -12
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.d.ts +7 -4
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +93 -2
- package/lib/tr-grid-printer/es6/CellWriter.d.ts +3 -3
- package/lib/tr-grid-printer/es6/GridPrinter.d.ts +1 -1
- package/lib/tr-grid-printer/es6/GridPrinter.js +26 -13
- package/lib/tr-grid-printer/es6/PrintTrait.d.ts +2 -2
- package/lib/tr-grid-printer/es6/SectionWriter.d.ts +3 -3
- package/lib/tr-grid-row-dragging/es6/RowDragging.d.ts +2 -1
- package/lib/tr-grid-row-dragging/es6/RowDragging.js +29 -143
- package/lib/tr-grid-row-grouping/es6/RowGrouping.d.ts +7 -2
- package/lib/tr-grid-row-grouping/es6/RowGrouping.js +97 -7
- package/lib/tr-grid-row-selection/es6/RowSelection.js +10 -0
- package/lib/tr-grid-textformatting/es6/TextFormatting.d.ts +1 -1
- package/lib/tr-grid-textformatting/es6/TextFormatting.js +12 -0
- package/lib/tr-grid-util/es6/DragUI.d.ts +16 -0
- package/lib/tr-grid-util/es6/DragUI.js +214 -0
- package/lib/tr-grid-util/es6/ElementObserver.d.ts +2 -0
- package/lib/tr-grid-util/es6/ElementObserver.js +28 -1
- package/lib/tr-grid-util/es6/ElfUtil.js +1 -1
- package/lib/tr-grid-util/es6/FieldFormatter.js +7 -5
- package/lib/tr-grid-util/es6/GridPlugin.js +8 -4
- package/lib/tr-grid-util/es6/NumberFormatter.d.ts +2 -0
- package/lib/tr-grid-util/es6/NumberFormatter.js +64 -19
- package/lib/tr-grid-util/es6/RowPainter.js +41 -11
- package/lib/tr-grid-util/es6/formula/Formula.js +9 -1
- package/lib/types/es6/Checkbox.d.ts +2 -2
- package/lib/types/es6/ColumnStack.d.ts +8 -4
- package/lib/types/es6/CompositeGrid/ColumnSelectionPlugin.d.ts +3 -2
- package/lib/types/es6/CompositeGrid/ColumnWidthAdjustingPlugin.d.ts +2 -1
- package/lib/types/es6/CompositeGrid/CompositeGrid.d.ts +20 -18
- package/lib/types/es6/CompositeGrid/DragAndDropTitlePlugin.d.ts +2 -1
- package/lib/types/es6/CompositeGrid/DraggableContentPlugin.d.ts +3 -2
- package/lib/types/es6/CompositeGrid/Plugin.d.ts +28 -0
- package/lib/types/es6/CompositeGrid/ResizableTitlePlugin.d.ts +2 -1
- package/lib/types/es6/CompositeGrid/RowSelectionPlugin.d.ts +5 -4
- package/lib/types/es6/CompositeGrid/TreeIndentingPlugin.d.ts +2 -1
- package/lib/types/es6/CompositeGrid/index.d.ts +9 -9
- package/lib/types/es6/ConditionalColoring.d.ts +1 -1
- package/lib/types/es6/Core/data/ColumnStats.d.ts +2 -2
- package/lib/types/es6/Core/data/DataCache.d.ts +4 -4
- package/lib/types/es6/Core/data/DataTable.d.ts +5 -5
- package/lib/types/es6/Core/data/DataView.d.ts +12 -12
- package/lib/types/es6/Core/data/SegmentCollection.d.ts +3 -3
- package/lib/types/es6/Core/data/WrappedView.d.ts +13 -13
- package/lib/types/es6/Core/grid/Core.d.ts +29 -27
- package/lib/types/es6/Core/grid/ILayoutGrid.d.ts +15 -15
- package/lib/types/es6/Core/grid/components/Cell.d.ts +4 -4
- package/lib/types/es6/Core/grid/components/CellFloatingPanel.d.ts +1 -1
- package/lib/types/es6/Core/grid/components/CellSpans.d.ts +8 -8
- package/lib/types/es6/Core/grid/components/Column.d.ts +1 -1
- package/lib/types/es6/Core/grid/components/ElementWrapper.d.ts +6 -6
- package/lib/types/es6/Core/grid/components/Scrollbar.d.ts +1 -1
- package/lib/types/es6/Core/grid/plugins/SortableTitlePlugin.d.ts +14 -6
- package/lib/types/es6/Core/grid/util/Conflator.d.ts +2 -2
- package/lib/types/es6/Core/grid/util/ElementFrameWork.d.ts +3 -3
- package/lib/types/es6/Core/grid/util/HttpRequest.d.ts +2 -2
- package/lib/types/es6/Core/grid/util/PercentBarRenderer.d.ts +1 -1
- package/lib/types/es6/Core/grid/util/RangeBar.d.ts +1 -1
- package/lib/types/es6/Core/grid/util/SectionSettings.d.ts +5 -5
- package/lib/types/es6/Core/grid/util/SelectionList.d.ts +2 -2
- package/lib/types/es6/Core/grid/util/TrackLayout.d.ts +7 -3
- package/lib/types/es6/Core/grid/util/util.d.ts +2 -2
- package/lib/types/es6/Core/index.d.ts +1 -5
- package/lib/types/es6/ExtensionOptions.d.ts +2 -0
- package/lib/types/es6/InCellEditing.d.ts +7 -4
- package/lib/types/es6/RealtimeGrid/ColumnDefinition.d.ts +5 -3
- package/lib/types/es6/RealtimeGrid/DataConnector.d.ts +3 -3
- package/lib/types/es6/RealtimeGrid/Grid.d.ts +17 -9
- package/lib/types/es6/RealtimeGrid/RowDefSorter.d.ts +19 -0
- package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +9 -7
- package/lib/types/es6/RealtimeGrid/SnapshotFiller.d.ts +3 -1
- package/lib/types/es6/RowDragging.d.ts +2 -1
- package/lib/types/es6/RowGrouping.d.ts +7 -2
- package/lib/types/es6/RowSegmenting.d.ts +7 -2
- package/lib/types/es6/TextFormatting.d.ts +1 -1
- package/lib/versions.json +14 -13
- package/package.json +1 -1
- package/lib/core/es6/grid/plugins/DragAndDropTitlePlugin.d.ts +0 -24
- package/lib/core/es6/grid/plugins/DragAndDropTitlePlugin.js +0 -615
- package/lib/core/es6/grid/plugins/Plugin.d.ts +0 -28
- package/lib/core/es6/grid/plugins/Plugin.js +0 -272
- package/lib/types/es6/Core/grid/plugins/DragAndDropTitlePlugin.d.ts +0 -24
- package/lib/types/es6/Core/grid/plugins/Plugin.d.ts +0 -28
@@ -27,6 +27,7 @@ import { CoralItems } from "../../tr-grid-util/es6/CoralItems.js";
|
|
27
27
|
* @property {Function=} beforeRowCommit=null Handler before all editor in row commit
|
28
28
|
* @property {Function=} rowEditorClosed=null Handler after all editors closed
|
29
29
|
* @property {boolean=} uiBlocking=false append transparent overlay to block ui interaction
|
30
|
+
* @property {Element=} autoSuggest=null Element of ef-autosuggest for handled with input cell
|
30
31
|
*/
|
31
32
|
|
32
33
|
/** @typedef {Object} InCellEditingPlugin~Cache
|
@@ -66,6 +67,7 @@ import { CoralItems } from "../../tr-grid-util/es6/CoralItems.js";
|
|
66
67
|
* @property {number} rowIndex
|
67
68
|
* @property {string} field
|
68
69
|
* @property {Element} inputElement
|
70
|
+
* @property {Element} autoSuggest
|
69
71
|
* @example
|
70
72
|
* var cep = new InCellEditingPlugin();
|
71
73
|
* cep.listen("editorOpened", function(e) {
|
@@ -157,6 +159,8 @@ var InCellEditingPlugin = function InCellEditingPlugin(options) {
|
|
157
159
|
t._createTitleEditor = t._createTitleEditor.bind(t);
|
158
160
|
t._onColumnAdded = t._onColumnAdded.bind(t);
|
159
161
|
t._onValueChanged = t._onValueChanged.bind(t);
|
162
|
+
t._onAutoSuggestItemSelected = t._onAutoSuggestItemSelected.bind(t);
|
163
|
+
t._onAutoSuggestTapStart = t._onAutoSuggestTapStart.bind(t);
|
160
164
|
t._hosts = [];
|
161
165
|
|
162
166
|
if (options) {
|
@@ -316,6 +320,11 @@ InCellEditingPlugin.prototype._disablingScroll = false;
|
|
316
320
|
*/
|
317
321
|
|
318
322
|
InCellEditingPlugin.prototype._uiBlocking = false;
|
323
|
+
/** @type {Element}
|
324
|
+
* @private
|
325
|
+
*/
|
326
|
+
|
327
|
+
InCellEditingPlugin.prototype._autoSuggest = null;
|
319
328
|
/** @type {string}
|
320
329
|
* @private
|
321
330
|
*/
|
@@ -385,6 +394,13 @@ InCellEditingPlugin.prototype._createInputElement = function (tag) {
|
|
385
394
|
elem.setAttribute("type", "text");
|
386
395
|
}
|
387
396
|
|
397
|
+
if (this._autoSuggest) {
|
398
|
+
this._autoSuggest.addEventListener("tapstart", t._onAutoSuggestTapStart); // TODO: remove this function after elf fixed item-select doesn't fire click events
|
399
|
+
|
400
|
+
|
401
|
+
this._autoSuggest.addEventListener("item-select", t._onAutoSuggestItemSelected);
|
402
|
+
}
|
403
|
+
|
388
404
|
elem.addEventListener("keydown", t._onTextKeyDown, false);
|
389
405
|
elem.addEventListener("keyup", t._onTextKeyUp, false);
|
390
406
|
elem.addEventListener("mousedown", t._stopPropagation, false);
|
@@ -623,6 +639,10 @@ InCellEditingPlugin.prototype.config = function (options) {
|
|
623
639
|
|
624
640
|
if (pluginOption["uiBlocking"]) {
|
625
641
|
t._uiBlocking = true;
|
642
|
+
}
|
643
|
+
|
644
|
+
if (pluginOption["autoSuggest"]) {
|
645
|
+
t._autoSuggest = pluginOption["autoSuggest"];
|
626
646
|
} // event callback
|
627
647
|
|
628
648
|
|
@@ -1205,6 +1225,18 @@ InCellEditingPlugin.prototype._openEditor = function (e, host, arg) {
|
|
1205
1225
|
|
1206
1226
|
if (t._disablingScroll) {
|
1207
1227
|
t._freezeScrolling(host, true);
|
1228
|
+
}
|
1229
|
+
|
1230
|
+
arg["autoSuggest"] = t._autoSuggest;
|
1231
|
+
|
1232
|
+
if (t._autoSuggest) {
|
1233
|
+
if (t._autoSuggest.parentNode !== host.getElement()) {
|
1234
|
+
// if we appendChild all time when open editor, events won't work
|
1235
|
+
host.getElement().appendChild(t._autoSuggest);
|
1236
|
+
}
|
1237
|
+
|
1238
|
+
t._autoSuggest.attach = inputElement;
|
1239
|
+
t._autoSuggest.positionTarget = inputElement; // for re-position of autosuggest
|
1208
1240
|
} // Dispatch an event for user to setup stuff
|
1209
1241
|
|
1210
1242
|
|
@@ -1508,6 +1540,42 @@ InCellEditingPlugin.prototype._onPopupHide = function (e) {
|
|
1508
1540
|
this.closeRowEditor(false);
|
1509
1541
|
};
|
1510
1542
|
/** @private
|
1543
|
+
* @param {Object} event
|
1544
|
+
*/
|
1545
|
+
|
1546
|
+
|
1547
|
+
InCellEditingPlugin.prototype._onAutoSuggestTapStart = function (event) {
|
1548
|
+
// TODO: Remove this function and use _onAutoSuggestItemSelected instead of this function
|
1549
|
+
// This WORKAROUND by use "tapstart" event instead of "item-select" event in ef-autosugest
|
1550
|
+
var target = event.target;
|
1551
|
+
|
1552
|
+
if (target.value) {
|
1553
|
+
this.setText(target.value);
|
1554
|
+
|
1555
|
+
this._commitText(true);
|
1556
|
+
}
|
1557
|
+
};
|
1558
|
+
/** @private
|
1559
|
+
* @param {Object} event
|
1560
|
+
*/
|
1561
|
+
|
1562
|
+
|
1563
|
+
InCellEditingPlugin.prototype._onAutoSuggestItemSelected = function (event) {
|
1564
|
+
// TODO: Replace This function instead of _onAutoSuggestTapStart when elf fixed item-select.
|
1565
|
+
// Currently, we use tapstart instead of item-select, so it's not support other method of item-select
|
1566
|
+
// Currently, this function doesn't execute until item-select event fired from auto-suggest
|
1567
|
+
var method = event.detail.method;
|
1568
|
+
var value = event.detail.target.value;
|
1569
|
+
|
1570
|
+
if (method === 'enter' || method === 'click') {
|
1571
|
+
if (value) {
|
1572
|
+
this.setText(value);
|
1573
|
+
|
1574
|
+
this._commitText(true);
|
1575
|
+
}
|
1576
|
+
}
|
1577
|
+
};
|
1578
|
+
/** @private
|
1511
1579
|
* @param {Object} e
|
1512
1580
|
*/
|
1513
1581
|
|
@@ -1540,6 +1608,12 @@ InCellEditingPlugin.prototype._onTextKeyDown = function (e) {
|
|
1540
1608
|
|
1541
1609
|
|
1542
1610
|
if (e.keyCode === 9) {
|
1611
|
+
// For check press tab key when user tab on auto suggest list
|
1612
|
+
// When user tab on auto suggest, the focus should be in input and data doesn't commit
|
1613
|
+
if (this._autoSuggest && this._autoSuggest.suggestions.length > 0) {
|
1614
|
+
this._activeInCellCache.inputElement.focus();
|
1615
|
+
}
|
1616
|
+
|
1543
1617
|
e.preventDefault(); // stop losing focus
|
1544
1618
|
}
|
1545
1619
|
};
|
@@ -1570,9 +1644,17 @@ InCellEditingPlugin.prototype._onTextKeyUp = function (e) {
|
|
1570
1644
|
var cellInfo = this._activePos;
|
1571
1645
|
|
1572
1646
|
if (this._initialText !== text) {
|
1573
|
-
this._commitText(true);
|
1574
|
-
|
1575
1647
|
e.preventDefault(); // TODO: Check if this is needed
|
1648
|
+
// Clear auto suggest and doesn't commit when user tab on auto suggest item
|
1649
|
+
|
1650
|
+
if (this._autoSuggest && this._autoSuggest.suggestions.length > 0) {
|
1651
|
+
this._activeInCellCache.inputElement.focus();
|
1652
|
+
|
1653
|
+
this._autoSuggest.suggestions = [];
|
1654
|
+
return; // when use tabToMove with auto suggest, it shouldn't be effect when doesn't commit text
|
1655
|
+
} else {
|
1656
|
+
this._commitText(true);
|
1657
|
+
}
|
1576
1658
|
} else {
|
1577
1659
|
this._commitText(false);
|
1578
1660
|
}
|
@@ -1958,6 +2040,15 @@ InCellEditingPlugin.prototype.getBalloonPopup = function () {
|
|
1958
2040
|
// we should receive column index to return balloonPopup in specific column
|
1959
2041
|
return this._activeInCellCache ? this._activeInCellCache["balloonPopup"] : null;
|
1960
2042
|
};
|
2043
|
+
/** Get ef-autosuggest
|
2044
|
+
* @public
|
2045
|
+
* @return {Element}
|
2046
|
+
*/
|
2047
|
+
|
2048
|
+
|
2049
|
+
InCellEditingPlugin.prototype.getAutoSuggest = function () {
|
2050
|
+
return this._autoSuggest;
|
2051
|
+
};
|
1961
2052
|
/**
|
1962
2053
|
* @public
|
1963
2054
|
* @param {boolean=} disabled
|
@@ -6,15 +6,15 @@ declare class CellWriter extends ElementWrapper {
|
|
6
6
|
|
7
7
|
constructor();
|
8
8
|
|
9
|
-
public getContent(): Node|null;
|
9
|
+
public getContent(): Node|null|null;
|
10
10
|
|
11
|
-
public setContent(content: any, opt_tooltip?: boolean): Element;
|
11
|
+
public setContent(content: any, opt_tooltip?: boolean): Element|null;
|
12
12
|
|
13
13
|
public setTooltip(str: string): void;
|
14
14
|
|
15
15
|
public setTextContent(str: string): void;
|
16
16
|
|
17
|
-
public addContent(n: any): Element;
|
17
|
+
public addContent(n: any): Element|null;
|
18
18
|
|
19
19
|
public setStyle(str: string, val: any): void;
|
20
20
|
|
@@ -17,7 +17,7 @@ declare namespace GridPrinter {
|
|
17
17
|
|
18
18
|
function getPreFlightInfo(grid: any, options?: any): any;
|
19
19
|
|
20
|
-
function createPrintElement(grid: any, options?: any): Element;
|
20
|
+
function createPrintElement(grid: any, options?: any): Element|null;
|
21
21
|
|
22
22
|
function print(grid: any): void;
|
23
23
|
|
@@ -113,6 +113,27 @@ var _setColumnAlignment = function (tbl, colIndex, alignment) {
|
|
113
113
|
}
|
114
114
|
};
|
115
115
|
|
116
|
+
/** @private
|
117
|
+
* @param {*} grid grid element, currently supports atlas-blotter, ef-grid, tr.CompositeGrid, rt.Grid and Core
|
118
|
+
* @return {Object} core grid
|
119
|
+
*/
|
120
|
+
var _getCoreGrid = function (grid) {
|
121
|
+
var core = null;
|
122
|
+
try {
|
123
|
+
if (grid.api) { // ef-grid or atlas-blotter
|
124
|
+
core = grid.api.getCoreGrid();
|
125
|
+
} else if (grid.getCoreGrid) { // tr.CompositeGrid or rt.Grid
|
126
|
+
core = grid.getCoreGrid();
|
127
|
+
} else if (grid.getPlugin) { // coreGrid
|
128
|
+
core = grid;
|
129
|
+
}
|
130
|
+
// TODO: support react/angular wrapper
|
131
|
+
} catch (err) {
|
132
|
+
console.log("Cannot print the given object");
|
133
|
+
}
|
134
|
+
return core;
|
135
|
+
};
|
136
|
+
|
116
137
|
/** @namespaces
|
117
138
|
*/
|
118
139
|
var GridPrinter = {};
|
@@ -331,13 +352,15 @@ GridPrinter.getPreFlightInfo = function (grid, options) {
|
|
331
352
|
};
|
332
353
|
|
333
354
|
/** @public
|
334
|
-
* @param {tr.Grid
|
355
|
+
* @param {*} grid grid element, currently supports atlas-blotter, ef-grid, tr.CompositeGrid, rt.Grid and Core
|
335
356
|
* @param {Object=} options
|
336
357
|
* @return {Element}
|
337
358
|
*/
|
338
359
|
GridPrinter.createPrintElement = function (grid, options) {
|
339
360
|
if (!grid) {
|
340
361
|
grid = GridPrinter._grid;
|
362
|
+
} else {
|
363
|
+
grid = _getCoreGrid(grid);
|
341
364
|
}
|
342
365
|
|
343
366
|
if (!grid) {
|
@@ -624,23 +647,13 @@ GridPrinter._applyCss = function () {
|
|
624
647
|
};
|
625
648
|
|
626
649
|
/** @public
|
627
|
-
* @param {tr.Grid
|
650
|
+
* @param {*} grid grid element, currently supports atlas-blotter, ef-grid, tr.CompositeGrid, rt.Grid and Core
|
628
651
|
*/
|
629
652
|
GridPrinter.print = function (grid) {
|
630
653
|
var core = null;
|
631
654
|
if (grid) {
|
632
655
|
GridPrinter._applyCss();
|
633
|
-
|
634
|
-
if (grid.api) { // ef-grid or atlas-blotter
|
635
|
-
core = grid.api.getCoreGrid();
|
636
|
-
} else if (grid.getCoreGrid) { // tr.CompositeGrid or rt.Grid
|
637
|
-
core = grid.getCoreGrid();
|
638
|
-
} else if (grid instanceof tr.Grid) {
|
639
|
-
core = grid;
|
640
|
-
}
|
641
|
-
} catch (err) {
|
642
|
-
console.log("Cannot print the given object");
|
643
|
-
}
|
656
|
+
core = _getCoreGrid(grid);
|
644
657
|
}
|
645
658
|
|
646
659
|
if (core) {
|
@@ -29,9 +29,9 @@ declare class PrintTrait {
|
|
29
29
|
|
30
30
|
public fixPaperSize(enabled: boolean): void;
|
31
31
|
|
32
|
-
public getDocumentElement(): Element|null;
|
32
|
+
public getDocumentElement(): Element|null|null;
|
33
33
|
|
34
|
-
public getBodyElement(): Element|null;
|
34
|
+
public getBodyElement(): Element|null|null;
|
35
35
|
|
36
36
|
}
|
37
37
|
|
@@ -21,9 +21,9 @@ declare class SectionWriter extends ElementWrapper {
|
|
21
21
|
|
22
22
|
public setRowCount(val: number): void;
|
23
23
|
|
24
|
-
public getCell(colIndex: number, rowIndex: number): CellWriter;
|
24
|
+
public getCell(colIndex: number, rowIndex: number): CellWriter|null;
|
25
25
|
|
26
|
-
public getCellContent(colIndex: number, rowIndex: number): Element|Node|NodeList;
|
26
|
+
public getCellContent(colIndex: number, rowIndex: number): Element|Node|NodeList|null;
|
27
27
|
|
28
28
|
public setCellContent(colIndex: number, rowIndex: number, data: string|Element|any|any): void;
|
29
29
|
|
@@ -47,7 +47,7 @@ declare class SectionWriter extends ElementWrapper {
|
|
47
47
|
|
48
48
|
public isColumnActive(colIndex: number): boolean;
|
49
49
|
|
50
|
-
public getCellElement(colIndex: number, rowIndex: number): Element;
|
50
|
+
public getCellElement(colIndex: number, rowIndex: number): Element|null;
|
51
51
|
|
52
52
|
}
|
53
53
|
|
@@ -1,8 +1,9 @@
|
|
1
1
|
import { Ext } from "../../tr-grid-util/es6/Ext.js";
|
2
|
-
import { cloneObject
|
2
|
+
import { cloneObject } from "../../tr-grid-util/es6/Util.js";
|
3
3
|
import { ElfUtil } from "../../tr-grid-util/es6/ElfUtil.js";
|
4
4
|
import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
|
5
5
|
import Dom from "../../tr-grid-util/es6/Dom.js";
|
6
|
+
import { DragUI } from "../../tr-grid-util/es6/DragUI.js";
|
6
7
|
|
7
8
|
declare namespace RowDraggingPlugin {
|
8
9
|
|
@@ -1,8 +1,9 @@
|
|
1
1
|
import { Ext } from "../../tr-grid-util/es6/Ext.js";
|
2
|
-
import { cloneObject
|
2
|
+
import { cloneObject } from "../../tr-grid-util/es6/Util.js";
|
3
3
|
import { ElfUtil } from "../../tr-grid-util/es6/ElfUtil.js";
|
4
4
|
import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
|
5
5
|
import Dom from "../../tr-grid-util/es6/Dom.js";
|
6
|
+
import { DragUI } from "../../tr-grid-util/es6/DragUI.js";
|
6
7
|
|
7
8
|
/** @typedef {Object} RowDraggingPlugin~Options
|
8
9
|
* @description Available options describing `rowDragging` object specified in grid's option
|
@@ -79,7 +80,7 @@ var RowDraggingPlugin = function (options) {
|
|
79
80
|
t._guideline.className = "tr-row-guideline";
|
80
81
|
|
81
82
|
t._dragBox = document.createElement("div");
|
82
|
-
t._dragBox.className = "drag-box";
|
83
|
+
t._dragBox.className = "drag-box-disabled";
|
83
84
|
|
84
85
|
t._dragBoxIcon = document.createElement("ef-icon");
|
85
86
|
t._dragBoxIcon.className = "drag-box-icon";
|
@@ -185,7 +186,10 @@ RowDraggingPlugin.prototype._dataTransfer = true;
|
|
185
186
|
* @private
|
186
187
|
*/
|
187
188
|
RowDraggingPlugin.prototype._autoScroll = true;
|
188
|
-
|
189
|
+
/** @type {Object}
|
190
|
+
* @private
|
191
|
+
*/
|
192
|
+
RowDraggingPlugin.prototype._dragUI = null;
|
189
193
|
|
190
194
|
/** Prevent built-in config
|
191
195
|
* @public
|
@@ -235,11 +239,17 @@ RowDraggingPlugin.prototype.initialize = function (host, options) {
|
|
235
239
|
host.listen("mousedown", this._onMouseDown);
|
236
240
|
host.listen("touchstart", this._onMouseDown);
|
237
241
|
|
238
|
-
|
239
|
-
|
242
|
+
this._dragUI = new DragUI({
|
243
|
+
dragBox: this._dragBox,
|
244
|
+
dragBoxIcon: this._dragBoxIcon
|
245
|
+
});
|
246
|
+
|
247
|
+
// Share dragging styles
|
248
|
+
if(DragUI.stylePromise) {
|
249
|
+
DragUI.applyThemeColor(host);
|
240
250
|
} else {
|
241
|
-
|
242
|
-
|
251
|
+
DragUI.stylePromise = ElfUtil.getThemeColors();
|
252
|
+
DragUI.stylePromise.then(this._onThemeLoaded);
|
243
253
|
}
|
244
254
|
|
245
255
|
// In case of lazy loading
|
@@ -268,100 +278,9 @@ RowDraggingPlugin.prototype.unload = function (host) {
|
|
268
278
|
* @param {Object} colors
|
269
279
|
*/
|
270
280
|
RowDraggingPlugin.prototype._onThemeLoaded = function(colors) {
|
271
|
-
|
272
|
-
var styles = [ // Main Styles without theme
|
273
|
-
".tr-row-guideline", [
|
274
|
-
"position: absolute;",
|
275
|
-
"left: 0;",
|
276
|
-
"top: 0;",
|
277
|
-
"pointer-events: none;",
|
278
|
-
"z-index: 1;",
|
279
|
-
"text-align: center;",
|
280
|
-
"border-top-width: 3px;",
|
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;"
|
327
|
-
]
|
328
|
-
];
|
329
|
-
var guidelineColor = "#ff9933";
|
330
|
-
var ElfVersion = ElfUtil.getElfVersion();
|
331
|
-
if(colors.primary) {
|
332
|
-
guidelineColor = colors.primary;
|
333
|
-
}
|
334
|
-
guidelineColor += ";";
|
335
|
-
|
336
|
-
styles.push(".tr-row-guideline", [
|
337
|
-
"border-top-color: " + guidelineColor,
|
338
|
-
"color: " + guidelineColor
|
339
|
-
]);
|
340
|
-
|
341
|
-
if(ElfVersion < 3) { // Backward compatability
|
342
|
-
styles.push(".pearl .tr-row-guideline, *[theme=pearl] .tr-row-guideline", [
|
343
|
-
"border-top-color: #ee7600;",
|
344
|
-
"color: #ee7600;",
|
345
|
-
"background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.1));"
|
346
|
-
]);
|
347
|
-
}
|
348
|
-
RowDraggingPlugin._styles = prettifyCss(styles);
|
349
|
-
}
|
350
|
-
|
281
|
+
this._dragUI.onThemeLoaded(colors); // TODO : onThemeLoaded should be static function like DragUI.applyThemeColor
|
351
282
|
for(var i = this._hosts.length; --i >= 0;) {
|
352
|
-
|
353
|
-
}
|
354
|
-
};
|
355
|
-
/** @private
|
356
|
-
* @param {Object} grid core grid instance
|
357
|
-
*/
|
358
|
-
RowDraggingPlugin._applyThemeColor = function(grid) {
|
359
|
-
if(!grid || grid._rowDraggingStyles) {
|
360
|
-
return;
|
361
|
-
}
|
362
|
-
if(RowDraggingPlugin._styles) {
|
363
|
-
grid._rowDraggingStyles = true; // Prevent loading the same style twice
|
364
|
-
injectCss(RowDraggingPlugin._styles, grid.getElement());
|
283
|
+
DragUI.applyThemeColor(this._hosts[i]);
|
365
284
|
}
|
366
285
|
};
|
367
286
|
|
@@ -378,6 +297,7 @@ RowDraggingPlugin.prototype.config = function (options) {
|
|
378
297
|
|
379
298
|
if (typeof extOptions["dragBoxRenderer"] === "function") {
|
380
299
|
this._dragBoxRenderer = extOptions["dragBoxRenderer"];
|
300
|
+
this._dragBox.className = "drag-box"; // set disable drag-box
|
381
301
|
} else {
|
382
302
|
this._dragBox.className = "drag-box-disabled"; // set disable drag-box
|
383
303
|
}
|
@@ -573,7 +493,7 @@ RowDraggingPlugin.prototype._onDragStart = function (e) {
|
|
573
493
|
// TODO: Just update curser will not gonna work since cell is pointer-events: none;
|
574
494
|
// we should do something to overwrite pointer-events first
|
575
495
|
// then set cursor move will have an effect
|
576
|
-
grid.getElement().
|
496
|
+
grid.getElement().classList.add("mouse-dragging");
|
577
497
|
|
578
498
|
this._updateGuidePosition();
|
579
499
|
|
@@ -612,12 +532,17 @@ RowDraggingPlugin.prototype._onMouseMove = function (e) {
|
|
612
532
|
this._pos = this._hitTest(e); // A new object is created
|
613
533
|
|
614
534
|
this._updateGuidePosition(e);
|
615
|
-
this._renderDragBox(e);
|
616
|
-
|
617
535
|
this._pos.dragBox = this._dragBox; // assign dragBox for user determine valid target
|
618
536
|
|
619
537
|
// Dispatch drag event to let user determine valid drop target using allowDrag (allowDrop) method
|
620
538
|
this._dispatch("drag", this._pos);
|
539
|
+
if(!this._disabled) {
|
540
|
+
e.dragBoxIcon = this._pos.dragBoxIcon; // access event object instread of element for prevent element persistence
|
541
|
+
var drop = this._dragUI.renderDragBox(e, this._startingGrid);
|
542
|
+
if(!drop) { // can not be drop or not allow to drop or insertion
|
543
|
+
this.cancelDrag();
|
544
|
+
}
|
545
|
+
}
|
621
546
|
};
|
622
547
|
/** @private
|
623
548
|
* @param {Object} e
|
@@ -649,7 +574,7 @@ RowDraggingPlugin.prototype._onDragEnd = function (e) {
|
|
649
574
|
}
|
650
575
|
|
651
576
|
var srcGrid = this._startingGrid || this._hosts[0];
|
652
|
-
srcGrid.getElement().
|
577
|
+
srcGrid.getElement().classList.remove("mouse-dragging");
|
653
578
|
|
654
579
|
var destPos = this._pos; // This can be null
|
655
580
|
if(!this._isDragCancelled()) {
|
@@ -803,45 +728,6 @@ RowDraggingPlugin.prototype._updateGuidePosition = function (e) {
|
|
803
728
|
}
|
804
729
|
};
|
805
730
|
|
806
|
-
/** @private
|
807
|
-
* @param {!Element|Event|MouseEvent} e
|
808
|
-
*/
|
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);
|
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";
|
844
|
-
};
|
845
731
|
/** @private */
|
846
732
|
RowDraggingPlugin.prototype._clearCache = function () {
|
847
733
|
if (this._dragPulseId) {
|
@@ -3,6 +3,7 @@ import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
|
|
3
3
|
import { ExpanderIcon } from "../../tr-grid-util/es6/ExpanderIcon.js";
|
4
4
|
import { ElfUtil } from "../../tr-grid-util/es6/ElfUtil.js";
|
5
5
|
import { RowPainter } from "../../tr-grid-util/es6/RowPainter.js";
|
6
|
+
import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
|
6
7
|
|
7
8
|
declare namespace RowGroupingPlugin {
|
8
9
|
|
@@ -26,6 +27,8 @@ declare namespace RowGroupingPlugin {
|
|
26
27
|
autoGroupSorting?: boolean,
|
27
28
|
indentSize?: (boolean|number|(number)[]),
|
28
29
|
colorTag?: boolean,
|
30
|
+
predefinedColors?: any,
|
31
|
+
groupColors?: any,
|
29
32
|
clicked?: ((...params: any[]) => any),
|
30
33
|
groupAdded?: ((...params: any[]) => any),
|
31
34
|
beforeGroupAdded?: ((...params: any[]) => any),
|
@@ -75,10 +78,12 @@ declare class RowGroupingPlugin extends GridPlugin {
|
|
75
78
|
|
76
79
|
public setGroupSortingLogic(sortFunction: RowGroupingPlugin.GroupSortLogic): void;
|
77
80
|
|
78
|
-
public getGroupSortingLogic(): ((...params: any[]) => any);
|
81
|
+
public getGroupSortingLogic(): ((...params: any[]) => any)|null;
|
79
82
|
|
80
83
|
public setPredefinedGroups(predefinedGroups: any[]|(any[])[]): void;
|
81
84
|
|
85
|
+
public setPredefinedColors(predefinedColors: any): void;
|
86
|
+
|
82
87
|
public sortGroups(): void;
|
83
88
|
|
84
89
|
public updateHeaders(): void;
|
@@ -93,7 +98,7 @@ declare class RowGroupingPlugin extends GridPlugin {
|
|
93
98
|
|
94
99
|
public disableClicking(opt_disabled?: boolean): void;
|
95
100
|
|
96
|
-
public getGroupingStates(): (RowGroupingPlugin.GroupingState)[];
|
101
|
+
public getGroupingStates(): (RowGroupingPlugin.GroupingState)[]|null;
|
97
102
|
|
98
103
|
public setGroupingStates(states: (RowGroupingPlugin.GroupingState)[]|string): void;
|
99
104
|
|