@refinitiv-ui/efx-grid 6.0.91 → 6.0.92
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 +1 -1
- package/lib/column-dragging/es6/ColumnDragging.js +144 -34
- package/lib/core/dist/core.js +2410 -2621
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/data/ColumnStats.js +14 -14
- package/lib/core/es6/data/DataCache.js +118 -118
- package/lib/core/es6/data/DataTable.d.ts +3 -1
- package/lib/core/es6/data/DataTable.js +208 -190
- package/lib/core/es6/data/DataView.d.ts +1 -1
- package/lib/core/es6/data/DataView.js +291 -291
- package/lib/core/es6/data/Segment.js +79 -79
- package/lib/core/es6/data/SegmentCollection.js +81 -81
- package/lib/core/es6/data/WrappedView.js +41 -41
- package/lib/core/es6/grid/Core.js +635 -635
- package/lib/core/es6/grid/ILayoutGrid.js +1 -1
- package/lib/core/es6/grid/LayoutGrid.js +183 -183
- package/lib/core/es6/grid/VirtualizedLayoutGrid.js +91 -91
- package/lib/core/es6/grid/components/Cell.js +29 -29
- package/lib/core/es6/grid/components/CellFloatingPanel.js +11 -11
- package/lib/core/es6/grid/components/CellSpan.js +7 -7
- package/lib/core/es6/grid/components/CellSpans.js +36 -34
- package/lib/core/es6/grid/components/Column.js +40 -40
- package/lib/core/es6/grid/components/ElementWrapper.js +17 -17
- package/lib/core/es6/grid/components/HScrollbar.js +31 -31
- package/lib/core/es6/grid/components/Scrollbar.js +77 -77
- package/lib/core/es6/grid/components/StretchedCells.js +49 -49
- package/lib/core/es6/grid/components/VScrollbar.js +11 -11
- package/lib/core/es6/grid/components/VirtualItems.js +3 -3
- package/lib/core/es6/grid/event/EventDispatcher.js +9 -9
- package/lib/core/es6/grid/event/EventListeners.js +4 -4
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +186 -186
- package/lib/core/es6/grid/util/Conflator.js +4 -4
- package/lib/core/es6/grid/util/Reverter.js +1 -1
- package/lib/core/es6/grid/util/SectionSettings.js +20 -20
- package/lib/core/es6/grid/util/SelectionList.js +23 -23
- package/lib/core/es6/grid/util/TrackLayout.js +74 -74
- package/lib/core/es6/grid/util/Virtualizer.js +15 -15
- package/lib/core/es6/grid/util/util.js +20 -20
- package/lib/core/es6/index.d.ts +0 -2
- package/lib/core/es6/index.js +0 -3
- package/lib/grid/index.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +193 -70
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/Grid.js +46 -30
- package/lib/rt-grid/es6/RowDefinition.d.ts +2 -1
- package/lib/rt-grid/es6/RowDefinition.js +74 -16
- package/lib/tr-grid-cell-selection/es6/CellSelection.js +56 -1
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.d.ts +3 -1
- package/lib/tr-grid-column-grouping/es6/ColumnGrouping.js +29 -1
- package/lib/tr-grid-util/es6/CellPainter.js +94 -93
- package/lib/tr-grid-util/es6/Conflator.js +4 -4
- package/lib/tr-grid-util/es6/CoralItems.js +6 -6
- package/lib/tr-grid-util/es6/DateTime.js +39 -39
- package/lib/tr-grid-util/es6/Deferred.js +5 -5
- package/lib/tr-grid-util/es6/Delay.js +1 -1
- package/lib/tr-grid-util/es6/Dom.js +26 -26
- package/lib/tr-grid-util/es6/DragUI.js +17 -17
- package/lib/tr-grid-util/es6/ElementObserver.js +12 -12
- package/lib/tr-grid-util/es6/ElementWrapper.js +2 -2
- package/lib/tr-grid-util/es6/ElfDate.js +4 -4
- package/lib/tr-grid-util/es6/ElfUtil.js +37 -37
- package/lib/tr-grid-util/es6/EventDispatcher.js +12 -12
- package/lib/tr-grid-util/es6/ExpanderIcon.js +6 -6
- package/lib/tr-grid-util/es6/ExpressionParser.js +43 -43
- package/lib/tr-grid-util/es6/Ext.js +6 -6
- package/lib/tr-grid-util/es6/FieldFormatter.js +17 -17
- package/lib/tr-grid-util/es6/FilterBuilder.js +57 -57
- package/lib/tr-grid-util/es6/FilterOperators.d.ts +12 -1
- package/lib/tr-grid-util/es6/FilterOperators.js +13 -2
- package/lib/tr-grid-util/es6/GridPlugin.js +86 -86
- package/lib/tr-grid-util/es6/GroupDefinitions.js +90 -90
- package/lib/tr-grid-util/es6/Icon.js +4 -4
- package/lib/tr-grid-util/es6/MouseDownTrait.js +6 -6
- package/lib/tr-grid-util/es6/MultiTableManager.js +68 -68
- package/lib/tr-grid-util/es6/NumberFormatter.js +22 -22
- package/lib/tr-grid-util/es6/PercentBar.js +17 -17
- package/lib/tr-grid-util/es6/Perf.js +5 -5
- package/lib/tr-grid-util/es6/Popup.js +42 -42
- package/lib/tr-grid-util/es6/RangeBar.js +5 -5
- package/lib/tr-grid-util/es6/RequestQueue.js +5 -5
- package/lib/tr-grid-util/es6/RowPainter.js +23 -23
- package/lib/tr-grid-util/es6/SubTable.js +94 -94
- package/lib/tr-grid-util/es6/Table.js +51 -51
- package/lib/tr-grid-util/es6/TextHighlighter.js +49 -49
- package/lib/tr-grid-util/es6/TickCodes.js +2 -2
- package/lib/tr-grid-util/es6/Timer.js +2 -2
- package/lib/tr-grid-util/es6/TouchProxy.js +7 -7
- package/lib/tr-grid-util/es6/Util.js +50 -50
- package/lib/tr-grid-util/es6/formula/ADCService.js +2 -2
- package/lib/tr-grid-util/es6/formula/ADCSubscription.js +19 -19
- package/lib/tr-grid-util/es6/formula/AdFinService.js +2 -2
- package/lib/tr-grid-util/es6/formula/AdFinSubscription.js +19 -19
- package/lib/tr-grid-util/es6/formula/Engine.js +56 -56
- package/lib/tr-grid-util/es6/formula/Formula.js +62 -62
- package/lib/tr-grid-util/es6/formula/IntervalSubscription.js +3 -3
- package/lib/tr-grid-util/es6/formula/Realtime.js +15 -15
- package/lib/tr-grid-util/es6/formula/RealtimeService.js +15 -15
- package/lib/tr-grid-util/es6/formula/TSIService.js +2 -2
- package/lib/tr-grid-util/es6/formula/TSISubscription.js +104 -104
- package/lib/tr-grid-util/es6/formula/VariableToken.js +20 -20
- package/lib/tr-grid-util/es6/formula/functions/AdFin.js +10 -10
- package/lib/tr-grid-util/es6/formula/functions/Excel.js +1 -1
- package/lib/tr-grid-util/es6/formula/functions/Info.js +2 -2
- package/lib/tr-grid-util/es6/formula/functions/Internal.js +5 -5
- package/lib/tr-grid-util/es6/formula/functions/Logic.js +5 -5
- package/lib/tr-grid-util/es6/formula/functions/Math.js +46 -46
- package/lib/tr-grid-util/es6/formula/functions/Statistics.js +27 -27
- package/lib/tr-grid-util/es6/formula/functions/Text.js +19 -19
- package/lib/tr-grid-util/es6/index.js +1 -1
- package/lib/tr-grid-util/es6/jet/Adc.js +36 -36
- package/lib/tr-grid-util/es6/jet/CollectionDict.js +11 -11
- package/lib/tr-grid-util/es6/jet/DataGenerator.js +95 -95
- package/lib/tr-grid-util/es6/jet/DataSet.js +1 -1
- package/lib/tr-grid-util/es6/jet/MockArchive.js +5 -5
- package/lib/tr-grid-util/es6/jet/MockJET.js +1 -1
- package/lib/tr-grid-util/es6/jet/MockQuotes.js +13 -13
- package/lib/tr-grid-util/es6/jet/MockQuotes2.js +100 -100
- package/lib/tr-grid-util/es6/jet/MockRTK.js +4 -4
- package/lib/tr-grid-util/es6/jet/MockUtil.js +2 -2
- package/lib/tr-grid-util/es6/jet/index.js +1 -1
- package/lib/tr-grid-util/es6/jet/mockDataAPI.js +15 -15
- package/lib/tr-grid-util/es6/locale/translation-de.js +1 -1
- package/lib/tr-grid-util/es6/locale/translation-en.js +1 -1
- package/lib/tr-grid-util/es6/locale/translation-ja.js +1 -1
- package/lib/tr-grid-util/es6/locale/translation-zh-hant.js +1 -1
- package/lib/tr-grid-util/es6/locale/translation-zh.js +1 -1
- package/lib/tr-grid-util/es6/locale/translation.js +1 -1
- package/lib/types/es6/ColumnDragging.d.ts +1 -1
- package/lib/types/es6/ColumnGrouping.d.ts +3 -1
- package/lib/types/es6/Core/data/DataTable.d.ts +4 -0
- package/lib/types/es6/Core/data/DataView.d.ts +2 -0
- package/lib/types/es6/Core/data/SegmentCollection.d.ts +2 -0
- package/lib/types/es6/Core/index.d.ts +0 -2
- package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +2 -1
- package/lib/versions.json +4 -4
- package/package.json +1 -1
- package/lib/core/es6/grid/util/ElementFrameWork.d.ts +0 -18
- package/lib/core/es6/grid/util/ElementFrameWork.js +0 -227
- package/lib/core/es6/grid/util/HttpRequest.d.ts +0 -53
- package/lib/core/es6/grid/util/HttpRequest.js +0 -371
- package/lib/core/es6/grid/util/PercentBar.d.ts +0 -43
- package/lib/core/es6/grid/util/PercentBar.js +0 -390
- package/lib/core/es6/grid/util/PercentBarRenderer.d.ts +0 -41
- package/lib/core/es6/grid/util/PercentBarRenderer.js +0 -316
- package/lib/core/es6/grid/util/RangeBar.d.ts +0 -25
- package/lib/core/es6/grid/util/RangeBar.js +0 -255
- package/lib/types/es6/Core/grid/util/ElementFrameWork.d.ts +0 -18
- package/lib/types/es6/Core/grid/util/HttpRequest.d.ts +0 -53
- package/lib/types/es6/Core/grid/util/PercentBar.d.ts +0 -43
- package/lib/types/es6/Core/grid/util/PercentBarRenderer.d.ts +0 -41
- package/lib/types/es6/Core/grid/util/RangeBar.d.ts +0 -25
|
@@ -59,7 +59,7 @@ import VirtualizedLayoutGrid from "./VirtualizedLayoutGrid.js";
|
|
|
59
59
|
* @param {number} b
|
|
60
60
|
* @return {number}
|
|
61
61
|
*/
|
|
62
|
-
|
|
62
|
+
let ascNumberSorter = function (a, b) {
|
|
63
63
|
return a - b;
|
|
64
64
|
};
|
|
65
65
|
|
|
@@ -67,7 +67,7 @@ var ascNumberSorter = function (a, b) {
|
|
|
67
67
|
* @param {Element=} opt_initializer this can be either element id (string) or DOM element.
|
|
68
68
|
* @extends {ElementWrapper}
|
|
69
69
|
*/
|
|
70
|
-
|
|
70
|
+
let Core = function (opt_initializer) {
|
|
71
71
|
if (!Core._sectionType) { // Initialize static variables
|
|
72
72
|
Core._sectionType = {};
|
|
73
73
|
Core._sectionType["title"] = true;
|
|
@@ -76,7 +76,7 @@ var Core = function (opt_initializer) {
|
|
|
76
76
|
Core._sectionType["footer"] = true;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
let _t = this;
|
|
80
80
|
|
|
81
81
|
// Initialize method binding
|
|
82
82
|
_t.getColumnId = _t.getColumnId.bind(_t);
|
|
@@ -112,7 +112,7 @@ var Core = function (opt_initializer) {
|
|
|
112
112
|
|
|
113
113
|
// Text nodes are unintentionally getting in the tag.
|
|
114
114
|
if(opt_initializer) { // Any node other than element node is not allowed within the tag.
|
|
115
|
-
for(
|
|
115
|
+
for(let i = opt_initializer.childNodes.length; --i >= 0;) {
|
|
116
116
|
if(!Util.isElement(opt_initializer.childNodes[i])) {
|
|
117
117
|
opt_initializer.removeChild(opt_initializer.childNodes[i]);
|
|
118
118
|
}
|
|
@@ -221,14 +221,14 @@ var Core = function (opt_initializer) {
|
|
|
221
221
|
);
|
|
222
222
|
|
|
223
223
|
// For debugging in advanced optimization mode
|
|
224
|
-
|
|
224
|
+
let map = Core["map"];
|
|
225
225
|
if(!map) {
|
|
226
226
|
map = {};
|
|
227
227
|
Core["map"] = map;
|
|
228
228
|
}
|
|
229
|
-
|
|
229
|
+
let elem = _t._element;
|
|
230
230
|
elem["_control"] = _t;
|
|
231
|
-
|
|
231
|
+
let id = elem.id || elem.name;
|
|
232
232
|
if(!id || map[id]) {
|
|
233
233
|
id = "_grid" + Core._runningGridId;
|
|
234
234
|
}
|
|
@@ -237,7 +237,7 @@ var Core = function (opt_initializer) {
|
|
|
237
237
|
Core._runningGridId++;
|
|
238
238
|
|
|
239
239
|
// init hiddenInput for retrieve copy and cut event
|
|
240
|
-
|
|
240
|
+
let hiddenInput = document.createElement("input");
|
|
241
241
|
hiddenInput.style.position = "absolute";
|
|
242
242
|
hiddenInput.style.width = "0";
|
|
243
243
|
hiddenInput.style.height = "0";
|
|
@@ -574,14 +574,14 @@ Core.prototype._hasPendingRowChange = false;
|
|
|
574
574
|
* @return {string}
|
|
575
575
|
*/
|
|
576
576
|
Core.getVersion = function () {
|
|
577
|
-
return "5.1.
|
|
577
|
+
return "5.1.97";
|
|
578
578
|
};
|
|
579
579
|
/** {@link ElementWrapper#dispose}
|
|
580
580
|
* @override
|
|
581
581
|
*/
|
|
582
582
|
Core.prototype.dispose = function () {
|
|
583
|
-
|
|
584
|
-
|
|
583
|
+
let internalId = this["_id"];
|
|
584
|
+
let map = Core["map"];
|
|
585
585
|
if (map[internalId]) {
|
|
586
586
|
map[internalId] = null;
|
|
587
587
|
} else {
|
|
@@ -598,12 +598,12 @@ Core.prototype.dispose = function () {
|
|
|
598
598
|
this.unlistenAll();
|
|
599
599
|
window.removeEventListener("resize", this._onWindowResize, false);
|
|
600
600
|
|
|
601
|
-
for (
|
|
602
|
-
|
|
601
|
+
for (let i = this._columnDefs.length; --i >= 0; ) {
|
|
602
|
+
let colDef = this._getColumnDef(i);
|
|
603
603
|
colDef["renderingHandler"] = colDef["dataBindingHandler"] = null;
|
|
604
604
|
}
|
|
605
|
-
for (
|
|
606
|
-
|
|
605
|
+
for (let key in this._plugins) {
|
|
606
|
+
let plugin = this._plugins[key];
|
|
607
607
|
if (plugin["unload"]) {
|
|
608
608
|
plugin["unload"](this);
|
|
609
609
|
}
|
|
@@ -611,7 +611,7 @@ Core.prototype.dispose = function () {
|
|
|
611
611
|
|
|
612
612
|
// Clear all Elements
|
|
613
613
|
this.removeAllSections(); // Remove all Sections and LayoutGrids
|
|
614
|
-
|
|
614
|
+
let mainScrolbar = this._vscrollbar._mainScrollbar;
|
|
615
615
|
if(mainScrolbar) {
|
|
616
616
|
mainScrolbar.unlisten("scroll", this._onSyncVScroll);
|
|
617
617
|
this._vscrollbar._mainScrollbar = null;
|
|
@@ -634,7 +634,7 @@ Core.prototype.dispose = function () {
|
|
|
634
634
|
|
|
635
635
|
|
|
636
636
|
// Clean Top node
|
|
637
|
-
|
|
637
|
+
let elem = this._element;
|
|
638
638
|
if (elem !== null) {
|
|
639
639
|
if (elem["_control"]) {
|
|
640
640
|
delete elem["_control"];
|
|
@@ -670,7 +670,7 @@ Core.prototype.insertBefore = function (obj) {
|
|
|
670
670
|
};
|
|
671
671
|
/** @private */
|
|
672
672
|
Core.prototype._onParentChange = function () {
|
|
673
|
-
|
|
673
|
+
let newParent = this.getParent() || this.getElement();
|
|
674
674
|
if(!this._vscrollbar._mainScrollbar) { // HACK
|
|
675
675
|
this._vscrollbar.setParent(newParent);
|
|
676
676
|
}
|
|
@@ -684,20 +684,20 @@ Core.prototype._onParentChange = function () {
|
|
|
684
684
|
* @return {!Object}
|
|
685
685
|
*/
|
|
686
686
|
Core.prototype.getConfigObject = function (gridOptions) {
|
|
687
|
-
|
|
687
|
+
let obj = gridOptions || {};
|
|
688
688
|
|
|
689
|
-
|
|
689
|
+
let columnCount = this.getColumnCount();
|
|
690
690
|
if (!obj["columns"]) {
|
|
691
691
|
obj["columns"] = [];
|
|
692
692
|
}
|
|
693
693
|
|
|
694
|
-
for (
|
|
695
|
-
|
|
694
|
+
for (let colIndex = 0; colIndex < columnCount; colIndex++) {
|
|
695
|
+
let column = obj["columns"][colIndex];
|
|
696
696
|
if (!column) {
|
|
697
697
|
column = obj["columns"][colIndex] = {};
|
|
698
698
|
}
|
|
699
699
|
|
|
700
|
-
|
|
700
|
+
let columnDef = this._getColumnDef(colIndex);
|
|
701
701
|
if(columnDef["userId"]) {
|
|
702
702
|
column["id"] = columnDef["userId"];
|
|
703
703
|
}
|
|
@@ -735,13 +735,13 @@ Core.prototype.getConfigObject = function (gridOptions) {
|
|
|
735
735
|
obj["stepScroll"] = (this._rowScrollingStep === 1) ? true : this._rowScrollingStep;
|
|
736
736
|
}
|
|
737
737
|
|
|
738
|
-
|
|
738
|
+
let val = this._vscrollbar.getAutoHide();
|
|
739
739
|
if(val !== true) {
|
|
740
740
|
// TODO: check this._hscrollbar and this._vscrollbar can be difference config
|
|
741
741
|
obj["autoHideScrollbar"] = val; // this._hscrollbar has the same settings
|
|
742
742
|
}
|
|
743
743
|
|
|
744
|
-
|
|
744
|
+
let wheelSpeed = this._vscrollbar.getMouseWheelSpeed();
|
|
745
745
|
if(wheelSpeed) {
|
|
746
746
|
obj["linearWheelScrolling"] = wheelSpeed;
|
|
747
747
|
}
|
|
@@ -768,13 +768,13 @@ Core.prototype.getConfigObject = function (gridOptions) {
|
|
|
768
768
|
obj["contentRightPadding"] = this._reservedSpace;
|
|
769
769
|
}
|
|
770
770
|
|
|
771
|
-
|
|
771
|
+
let conflationRate = this.getDataConflationRate();
|
|
772
772
|
if (conflationRate) {
|
|
773
773
|
obj["dataConflationRate"] = conflationRate;
|
|
774
774
|
}
|
|
775
775
|
|
|
776
|
-
for(
|
|
777
|
-
|
|
776
|
+
for(let key in this._plugins) {
|
|
777
|
+
let pluginInstance = this._plugins[key];
|
|
778
778
|
if(typeof pluginInstance["getConfigObject"] === "function") {
|
|
779
779
|
pluginInstance["getConfigObject"](obj);
|
|
780
780
|
}
|
|
@@ -793,9 +793,9 @@ Core.prototype.fillParentWidth = function(pct) {
|
|
|
793
793
|
// uses getBoundingClientRect() instead of clientWidth to prevents
|
|
794
794
|
// fraction error occured on Chrome (Windows 10) which make clientWidth
|
|
795
795
|
// exceeds expected value by 1px and will cause incorrect scrollbar active frag
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
796
|
+
let el = this._element;
|
|
797
|
+
let px = (el.getBoundingClientRect().width | 0) - el.clientLeft;
|
|
798
|
+
let changes = this._layoutX.setTrackSize(px - this._reservedSpace);
|
|
799
799
|
return changes !== null;
|
|
800
800
|
};
|
|
801
801
|
/** {@link ElementWrapper#show}
|
|
@@ -824,7 +824,7 @@ Core.prototype.getSectionCount = function() {
|
|
|
824
824
|
/** @private */
|
|
825
825
|
Core.prototype._updateFrozenTopSections = function () {
|
|
826
826
|
if (!this._fixFrozenTopSections) {
|
|
827
|
-
|
|
827
|
+
let topCount = this._getTopSectionCount();
|
|
828
828
|
this._freezeTopSectionAt(topCount - 1);
|
|
829
829
|
}
|
|
830
830
|
};
|
|
@@ -832,7 +832,7 @@ Core.prototype._updateFrozenTopSections = function () {
|
|
|
832
832
|
/** @private */
|
|
833
833
|
Core.prototype._updateFrozenBottomSections = function () {
|
|
834
834
|
if (!this._fixFrozenBottomSection) {
|
|
835
|
-
|
|
835
|
+
let bottomCount = this._getBottomSectionCount();
|
|
836
836
|
this._setFrozenFooter(bottomCount);
|
|
837
837
|
}
|
|
838
838
|
};
|
|
@@ -841,11 +841,11 @@ Core.prototype._updateFrozenBottomSections = function () {
|
|
|
841
841
|
* @return {number}
|
|
842
842
|
*/
|
|
843
843
|
Core.prototype._getTopSectionCount = function () {
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
for (
|
|
848
|
-
|
|
844
|
+
let sectionSettings = this._settings;
|
|
845
|
+
let length = sectionSettings.length;
|
|
846
|
+
let count = 0;
|
|
847
|
+
for (let i = 0; i < length; i++) {
|
|
848
|
+
let type = sectionSettings[i].getType();
|
|
849
849
|
if (type === "header" || type === "title") {
|
|
850
850
|
count++;
|
|
851
851
|
} else {
|
|
@@ -859,11 +859,11 @@ Core.prototype._getTopSectionCount = function () {
|
|
|
859
859
|
* @return {number}
|
|
860
860
|
*/
|
|
861
861
|
Core.prototype._getBottomSectionCount = function () {
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
for (
|
|
866
|
-
|
|
862
|
+
let sectionSettings = this._settings;
|
|
863
|
+
let length = sectionSettings.length;
|
|
864
|
+
let count = 0;
|
|
865
|
+
for (let i = length - 1; i >= 0; i--) {
|
|
866
|
+
let type = sectionSettings[i].getType();
|
|
867
867
|
if (type === "footer") {
|
|
868
868
|
count++;
|
|
869
869
|
} else {
|
|
@@ -889,19 +889,19 @@ Core.prototype.addSection = function (opt_type, opt_sectionName) {
|
|
|
889
889
|
* @fires Core#sectionAdded
|
|
890
890
|
*/
|
|
891
891
|
Core.prototype.addSectionAt = function (at, opt_type, opt_sectionName) {
|
|
892
|
-
|
|
892
|
+
let sectionCount = this._settings.length;
|
|
893
893
|
if (at < 0) { at = 0; }
|
|
894
894
|
if (at > sectionCount) { at = sectionCount; }
|
|
895
895
|
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
896
|
+
let sectType = this._toSectionType(opt_type);
|
|
897
|
+
let isBottomPadding = (opt_sectionName === "bottomPadding");
|
|
898
|
+
let sectionSettings = this._newSection(
|
|
899
899
|
isBottomPadding ? "footer" : sectType, // Always use footer as a setup for bottom padding section
|
|
900
900
|
opt_sectionName
|
|
901
901
|
);
|
|
902
902
|
if(!sectionSettings){ return null; }
|
|
903
903
|
|
|
904
|
-
|
|
904
|
+
let section = sectionSettings.getSection();
|
|
905
905
|
if(isBottomPadding) {
|
|
906
906
|
sectionSettings.setAutoSyncRowCount(false); // Important
|
|
907
907
|
this._bottomPaddingSect = section;
|
|
@@ -932,13 +932,13 @@ Core.prototype.addSectionAt = function (at, opt_type, opt_sectionName) {
|
|
|
932
932
|
this._onSectionCountChanged(true);
|
|
933
933
|
|
|
934
934
|
if(this._colVirtualizer.isEnabled()) {
|
|
935
|
-
|
|
936
|
-
|
|
935
|
+
let activations = this._getColActivationList();
|
|
936
|
+
let colCount = this.getColumnCount();
|
|
937
937
|
sectionSettings.activateColumns(activations, 0, colCount - 1);
|
|
938
938
|
}
|
|
939
939
|
|
|
940
940
|
if (this._hasListener("sectionAdded")) {
|
|
941
|
-
|
|
941
|
+
let e = sectionSettings.extendEventArg();
|
|
942
942
|
this._dispatch("sectionAdded", e);
|
|
943
943
|
}
|
|
944
944
|
|
|
@@ -949,7 +949,7 @@ Core.prototype.addSectionAt = function (at, opt_type, opt_sectionName) {
|
|
|
949
949
|
* @return {ILayoutGrid}
|
|
950
950
|
*/
|
|
951
951
|
Core.prototype.removeSection = function(sectionRef) {
|
|
952
|
-
|
|
952
|
+
let section = this.getSection(sectionRef);
|
|
953
953
|
if(section !== null) {
|
|
954
954
|
return this.removeSectionAt(section.getIndex());
|
|
955
955
|
}
|
|
@@ -960,12 +960,12 @@ Core.prototype.removeSection = function(sectionRef) {
|
|
|
960
960
|
* @return {ILayoutGrid}
|
|
961
961
|
*/
|
|
962
962
|
Core.prototype.removeSectionAt = function (at) {
|
|
963
|
-
|
|
963
|
+
let sectionCount = this._settings.length;
|
|
964
964
|
if (at >= 0 && at < sectionCount) {
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
965
|
+
let sectionSettings = this._settings[at];
|
|
966
|
+
let removedIndex = sectionSettings.getIndex();
|
|
967
|
+
let section = sectionSettings.getSection();
|
|
968
|
+
let sectionType = sectionSettings.getType();
|
|
969
969
|
|
|
970
970
|
section.setRowCount(0); // Row count changed
|
|
971
971
|
this._settings.splice(at, 1);
|
|
@@ -994,9 +994,9 @@ Core.prototype.removeLastSection = function() {
|
|
|
994
994
|
};
|
|
995
995
|
/** @public */
|
|
996
996
|
Core.prototype.removeAllSections = function () {
|
|
997
|
-
|
|
998
|
-
for (
|
|
999
|
-
|
|
997
|
+
let len = this._settings.length;
|
|
998
|
+
for (let i = 0; i < len; ++i) {
|
|
999
|
+
let sectionSettings = this._settings[i];
|
|
1000
1000
|
sectionSettings.dispose();
|
|
1001
1001
|
}
|
|
1002
1002
|
this._bottomPaddingSect = null;
|
|
@@ -1009,7 +1009,7 @@ Core.prototype.removeAllSections = function () {
|
|
|
1009
1009
|
* @param {boolean|number} paddingSize=6 Add special section at the bottom. If falsy value is specified, the section is removed.
|
|
1010
1010
|
*/
|
|
1011
1011
|
Core.prototype.setBottomPaddingSection = function (paddingSize) {
|
|
1012
|
-
|
|
1012
|
+
let sect = this._bottomPaddingSect;
|
|
1013
1013
|
if(paddingSize) {
|
|
1014
1014
|
if(typeof paddingSize === "number") {
|
|
1015
1015
|
this._bottomPadding = paddingSize;
|
|
@@ -1032,16 +1032,16 @@ Core.prototype.setBottomPaddingSection = function (paddingSize) {
|
|
|
1032
1032
|
* @return {boolean} Returns true if there is any change
|
|
1033
1033
|
*/
|
|
1034
1034
|
Core.prototype._updatePaddingBottomSect = function () {
|
|
1035
|
-
|
|
1035
|
+
let bps = this._bottomPaddingSect;
|
|
1036
1036
|
if(bps) { // Always move bottom padding sect to the last
|
|
1037
|
-
|
|
1038
|
-
|
|
1037
|
+
let sectCount = this._settings.length;
|
|
1038
|
+
let last = sectCount - 1;
|
|
1039
1039
|
if(last > 0) {
|
|
1040
|
-
|
|
1040
|
+
let lastSettings = this._settings[last];
|
|
1041
1041
|
if(lastSettings.getSection() !== bps) {
|
|
1042
|
-
|
|
1043
|
-
for(
|
|
1044
|
-
|
|
1042
|
+
let bpss = null;
|
|
1043
|
+
for(let i = last; --i >= 0;) {
|
|
1044
|
+
let settings = this._settings[i];
|
|
1045
1045
|
if(settings.getSection() === bps) {
|
|
1046
1046
|
bpss = settings;
|
|
1047
1047
|
break;
|
|
@@ -1058,7 +1058,7 @@ Core.prototype._updatePaddingBottomSect = function () {
|
|
|
1058
1058
|
this._bottomPaddingSect = null; // The settings and section must have been removed
|
|
1059
1059
|
}
|
|
1060
1060
|
} else {
|
|
1061
|
-
|
|
1061
|
+
let prevSettings = this._settings[last - 1];
|
|
1062
1062
|
if(prevSettings) {
|
|
1063
1063
|
// Blend styling with previous one
|
|
1064
1064
|
lastSettings.setType(prevSettings.getType() === "footer" ? "footer" : "content");
|
|
@@ -1074,15 +1074,15 @@ Core.prototype._updatePaddingBottomSect = function () {
|
|
|
1074
1074
|
* @param {number} dest INCLUSIVE
|
|
1075
1075
|
*/
|
|
1076
1076
|
Core.prototype.moveSection = function (from, dest) {
|
|
1077
|
-
|
|
1077
|
+
let sectionCount = this.getSectionCount();
|
|
1078
1078
|
if (from < 0) { from = 0; }
|
|
1079
1079
|
else if (from >= sectionCount) { return; }
|
|
1080
1080
|
if (dest < 0) { dest = 0; }
|
|
1081
1081
|
else if (dest >= sectionCount) { dest = sectionCount - 1; }
|
|
1082
1082
|
if (from === dest) { return; }
|
|
1083
1083
|
|
|
1084
|
-
|
|
1085
|
-
|
|
1084
|
+
let fromSettings = this._settings[from];
|
|
1085
|
+
let destSettings = this._settings[dest];
|
|
1086
1086
|
Util.moveArrayItem(this._settings, from, dest);
|
|
1087
1087
|
|
|
1088
1088
|
if (destSettings) {
|
|
@@ -1104,7 +1104,7 @@ Core.prototype.moveSection = function (from, dest) {
|
|
|
1104
1104
|
* @return {ILayoutGrid}
|
|
1105
1105
|
*/
|
|
1106
1106
|
Core.prototype.getSection = function (sectionRef) {
|
|
1107
|
-
|
|
1107
|
+
let settings = this.getSectionSettings(sectionRef);
|
|
1108
1108
|
return (settings !== null) ? settings.getSection() : null;
|
|
1109
1109
|
|
|
1110
1110
|
};
|
|
@@ -1117,14 +1117,14 @@ Core.prototype.getSectionSettings = function (sectionRef) {
|
|
|
1117
1117
|
if(Core._sectionType[/** @type{string} */(sectionRef)]) {
|
|
1118
1118
|
return this._getNextSection(1, null, /** @type{string} */(sectionRef));
|
|
1119
1119
|
}
|
|
1120
|
-
for(
|
|
1120
|
+
for(let i = this._settings.length; --i >= 0;) {
|
|
1121
1121
|
if(this._settings[i].getId() === sectionRef) {
|
|
1122
1122
|
return this._settings[i];
|
|
1123
1123
|
}
|
|
1124
1124
|
}
|
|
1125
1125
|
} else {
|
|
1126
1126
|
if(sectionRef != null) {
|
|
1127
|
-
|
|
1127
|
+
let num = -1;
|
|
1128
1128
|
if(sectionRef.getIndex != null) {
|
|
1129
1129
|
num = /** @type{number} */(sectionRef.getIndex());
|
|
1130
1130
|
} else if(Util.isNumber(sectionRef)) {
|
|
@@ -1145,9 +1145,9 @@ Core.prototype.getSectionSettings = function (sectionRef) {
|
|
|
1145
1145
|
Core.prototype.getAllSections = function (opt_type) {
|
|
1146
1146
|
if(opt_type == null) { return this._getAllSections(); }
|
|
1147
1147
|
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
for (
|
|
1148
|
+
let list = this.getAllSectionSettings(opt_type);
|
|
1149
|
+
let ary = /** @type{!Array.<ILayoutGrid>} */(list);
|
|
1150
|
+
for (let i = ary.length; --i >= 0; ) {
|
|
1151
1151
|
ary[i] = list[i].getSection();
|
|
1152
1152
|
}
|
|
1153
1153
|
return ary;
|
|
@@ -1161,11 +1161,11 @@ Core.prototype.getAllSectionSettings = function (opt_type) {
|
|
|
1161
1161
|
return this._settings; // WARNING: Return internal private member
|
|
1162
1162
|
}
|
|
1163
1163
|
|
|
1164
|
-
|
|
1165
|
-
|
|
1164
|
+
let len = this._settings.length;
|
|
1165
|
+
let ary = [];
|
|
1166
1166
|
opt_type = this._toSectionType(opt_type);
|
|
1167
|
-
for (
|
|
1168
|
-
|
|
1167
|
+
for (let i = 0; i < len; ++i) {
|
|
1168
|
+
let sectionSettings = this._settings[i];
|
|
1169
1169
|
if(opt_type === sectionSettings.getType()) {
|
|
1170
1170
|
ary.push(sectionSettings);
|
|
1171
1171
|
}
|
|
@@ -1183,13 +1183,13 @@ Core.prototype.getSectionIndex = function(identifier) {
|
|
|
1183
1183
|
}
|
|
1184
1184
|
|
|
1185
1185
|
if(identifier instanceof MouseEvent) {
|
|
1186
|
-
|
|
1187
|
-
|
|
1186
|
+
let mPos = Util.getRelativePosition(/** @type{MouseEvent} */(identifier), this._element);
|
|
1187
|
+
let obj = {};
|
|
1188
1188
|
this._hitTestY(mPos["y"], obj); // TODO: This will not work with zoom feature
|
|
1189
1189
|
return obj["sectionIndex"];
|
|
1190
1190
|
}
|
|
1191
1191
|
|
|
1192
|
-
|
|
1192
|
+
let section = this.getSection(/** @type{string} */(identifier));
|
|
1193
1193
|
if(section == null) { return -1; }
|
|
1194
1194
|
|
|
1195
1195
|
return section.getIndex();
|
|
@@ -1199,9 +1199,9 @@ Core.prototype.getSectionIndex = function(identifier) {
|
|
|
1199
1199
|
* @return {number} Return zero, if identifier does not exist
|
|
1200
1200
|
*/
|
|
1201
1201
|
Core.prototype.getSectionTop = function (sectionRef) {
|
|
1202
|
-
|
|
1202
|
+
let section = this.getSection(sectionRef);
|
|
1203
1203
|
if (section == null) { return 0; }
|
|
1204
|
-
|
|
1204
|
+
let top = this._layoutY.getLaneStart(section.getRowOffset());
|
|
1205
1205
|
|
|
1206
1206
|
if (this._startVScrollbarIndex >= 0 && section.getIndex() >= this._startVScrollbarIndex) {
|
|
1207
1207
|
top -= this._vscrollbar.getScrollTop();
|
|
@@ -1217,7 +1217,7 @@ Core.prototype.getSectionTop = function (sectionRef) {
|
|
|
1217
1217
|
*/
|
|
1218
1218
|
Core.prototype.getPreviousSection = function (identifier, opt_type) {
|
|
1219
1219
|
if(identifier == null) { identifier = this._settings.length; }
|
|
1220
|
-
|
|
1220
|
+
let s = this._getNextSection(-1, identifier, opt_type);
|
|
1221
1221
|
return (s !== null) ? s.getSection() : null;
|
|
1222
1222
|
};
|
|
1223
1223
|
/** @public
|
|
@@ -1227,7 +1227,7 @@ Core.prototype.getPreviousSection = function (identifier, opt_type) {
|
|
|
1227
1227
|
* @return {ILayoutGrid}
|
|
1228
1228
|
*/
|
|
1229
1229
|
Core.prototype.getNextSection = function (identifier, opt_type) {
|
|
1230
|
-
|
|
1230
|
+
let s = this._getNextSection(1, identifier, opt_type);
|
|
1231
1231
|
return (s !== null) ? s.getSection() : null;
|
|
1232
1232
|
};
|
|
1233
1233
|
/** @public
|
|
@@ -1245,7 +1245,7 @@ Core.prototype.getLastSection = function () {
|
|
|
1245
1245
|
* @return {ElementWrapper}
|
|
1246
1246
|
*/
|
|
1247
1247
|
Core.prototype.getCell = function (sectionRef, colIndex, rowIndex, opt_includeSpan) {
|
|
1248
|
-
|
|
1248
|
+
let s = this.getSection(sectionRef);
|
|
1249
1249
|
return (s) ? s.getCell(colIndex, rowIndex, opt_includeSpan) : null;
|
|
1250
1250
|
};
|
|
1251
1251
|
/** Get information about the cell, inclusing column index, row index, and section that the cell resides
|
|
@@ -1257,16 +1257,16 @@ Core.prototype.getCell = function (sectionRef, colIndex, rowIndex, opt_includeSp
|
|
|
1257
1257
|
* core.getCellInfo({"colIndex": 0, "rowIndex": 0}); // Get cell information about the top left cell in the content section
|
|
1258
1258
|
* core.getCellInfo(document.createElement("some_element"); // Get cell information for cell that contains the element with id "some_element"
|
|
1259
1259
|
* core.getCellInfo(mouseEventArg); // Get cell information from the given MouseEvent argument (this is the same as getRelativePosition() method)
|
|
1260
|
-
*
|
|
1260
|
+
* let cellInfo = core.getCellInfo({"colIndex": 1, "rowIndex": 1});
|
|
1261
1261
|
* cellInfo.colIndex = cellInfo.colIndex + 1; // Get next cell to the right
|
|
1262
1262
|
* core.getCellInfo(cellInfo);
|
|
1263
1263
|
*/
|
|
1264
1264
|
Core.prototype.getCellInfo = function (cellRef) {
|
|
1265
1265
|
if(!cellRef) { return null; }
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1266
|
+
let colIndex = /** @type{number} */(cellRef["colIndex"]);
|
|
1267
|
+
let rowIndex = /** @type{number} */(cellRef["rowIndex"]);
|
|
1268
|
+
let sectionName = /** @type{string} */(cellRef["sectionName"]);
|
|
1269
|
+
let mouseInfo = null;
|
|
1270
1270
|
if(colIndex == null || rowIndex == null) { // Core.MouseInfo Non Mouse Info
|
|
1271
1271
|
mouseInfo = this.getRelativePosition(/** @type{ElementWrapper|Element} */(cellRef));
|
|
1272
1272
|
if(!mouseInfo["hit"]) {
|
|
@@ -1276,10 +1276,10 @@ Core.prototype.getCellInfo = function (cellRef) {
|
|
|
1276
1276
|
if(!sectionName) {
|
|
1277
1277
|
sectionName = "content";
|
|
1278
1278
|
}
|
|
1279
|
-
|
|
1279
|
+
let ss = this.getSectionSettings(sectionName);
|
|
1280
1280
|
if(ss) {
|
|
1281
|
-
|
|
1282
|
-
|
|
1281
|
+
let s = ss.getSection();
|
|
1282
|
+
let cell = s.getCell(colIndex, rowIndex);
|
|
1283
1283
|
if(cell) {
|
|
1284
1284
|
mouseInfo = {};
|
|
1285
1285
|
mouseInfo["colIndex"] = colIndex;
|
|
@@ -1314,11 +1314,11 @@ Core.prototype.getPrevCellInRow = function (cellRef, step) {
|
|
|
1314
1314
|
* @return {Core.MouseInfo}
|
|
1315
1315
|
*/
|
|
1316
1316
|
Core.prototype._getNextCellInRow = function (cellRef, step) {
|
|
1317
|
-
|
|
1317
|
+
let mouseInfo = this.getCellInfo(cellRef);
|
|
1318
1318
|
if(mouseInfo) {
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1319
|
+
let colIndex = /** @type{number} */(mouseInfo["colIndex"]) + step;
|
|
1320
|
+
let rowIndex = /** @type{number} */(mouseInfo["rowIndex"]);
|
|
1321
|
+
let section = /** @type{ILayoutGrid} */(mouseInfo["section"]);
|
|
1322
1322
|
|
|
1323
1323
|
mouseInfo["colIndex"] = colIndex;
|
|
1324
1324
|
mouseInfo["cell"] = section.getCell(colIndex, rowIndex);
|
|
@@ -1331,13 +1331,13 @@ Core.prototype._getNextCellInRow = function (cellRef, step) {
|
|
|
1331
1331
|
* @return {Core.MouseInfo} Information about the next cell from left to right and top to bottom. Returns null if the given parameter is invalid
|
|
1332
1332
|
*/
|
|
1333
1333
|
Core.prototype.getNextCell = function (cellRef) {
|
|
1334
|
-
|
|
1334
|
+
let mouseInfo = this.getNextCellInRow(cellRef);
|
|
1335
1335
|
if(mouseInfo) {
|
|
1336
|
-
|
|
1336
|
+
let cell = /** @type{Core.Cell} */(mouseInfo["cell"]);
|
|
1337
1337
|
if(!cell) { // End of the row
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1338
|
+
let section = /** @type{ILayoutGrid} */(mouseInfo["section"]);
|
|
1339
|
+
let colIndex = mouseInfo["colIndex"] = 0;
|
|
1340
|
+
let rowIndex = /** @type{number} */(mouseInfo["rowIndex"]);
|
|
1341
1341
|
|
|
1342
1342
|
mouseInfo["rowIndex"] = ++rowIndex;
|
|
1343
1343
|
mouseInfo["cell"] = section.getCell(colIndex, rowIndex);
|
|
@@ -1351,13 +1351,13 @@ Core.prototype.getNextCell = function (cellRef) {
|
|
|
1351
1351
|
* @return {Core.MouseInfo} Information about the previous cell in the row. Returns null if the given parameter is invalid
|
|
1352
1352
|
*/
|
|
1353
1353
|
Core.prototype.getPrevCell = function (cellRef) {
|
|
1354
|
-
|
|
1354
|
+
let mouseInfo = this.getPrevCellInRow(cellRef);
|
|
1355
1355
|
if(mouseInfo) {
|
|
1356
|
-
|
|
1356
|
+
let cell = /** @type{Core.Cell} */(mouseInfo["cell"]);
|
|
1357
1357
|
if(!cell) { // End of the row
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1358
|
+
let section = /** @type{ILayoutGrid} */(mouseInfo["section"]);
|
|
1359
|
+
let colIndex = mouseInfo["colIndex"] = section.getColumnCount() - 1;
|
|
1360
|
+
let rowIndex = /** @type{number} */(mouseInfo["rowIndex"]);
|
|
1361
1361
|
|
|
1362
1362
|
mouseInfo["rowIndex"] = --rowIndex;
|
|
1363
1363
|
mouseInfo["cell"] = section.getCell(colIndex, rowIndex);
|
|
@@ -1385,11 +1385,11 @@ Core.prototype.getColumnCount = function () {
|
|
|
1385
1385
|
* @fires Core#afterContentBinding
|
|
1386
1386
|
*/
|
|
1387
1387
|
Core.prototype.setColumnCount = function(num) {
|
|
1388
|
-
|
|
1388
|
+
let colCount = this._layoutX.getLaneCount();
|
|
1389
1389
|
if(num >= colCount) {
|
|
1390
1390
|
this._layoutX.setLaneCount(num);
|
|
1391
|
-
for (
|
|
1392
|
-
|
|
1391
|
+
for (let i = this._settings.length; --i >= 0; ) {
|
|
1392
|
+
let section = this._settings[i].getSection();
|
|
1393
1393
|
section.setColumnCount(num); // Column may not be added to the document due to virtualization
|
|
1394
1394
|
}
|
|
1395
1395
|
|
|
@@ -1414,12 +1414,12 @@ Core.prototype.setColumnCount = function(num) {
|
|
|
1414
1414
|
* @fires Core#afterContentBinding
|
|
1415
1415
|
*/
|
|
1416
1416
|
Core.prototype.insertColumn = function (index, jsonObj) {
|
|
1417
|
-
|
|
1417
|
+
let prevCount = this.getColumnCount();
|
|
1418
1418
|
if (!(index < prevCount)) { index = prevCount; }
|
|
1419
1419
|
|
|
1420
1420
|
this._layoutX.insertLane(index);
|
|
1421
|
-
for (
|
|
1422
|
-
|
|
1421
|
+
for (let i = this._settings.length; --i >= 0; ) {
|
|
1422
|
+
let section = this._settings[i].getSection();
|
|
1423
1423
|
section.insertColumn(index);
|
|
1424
1424
|
}
|
|
1425
1425
|
|
|
@@ -1437,11 +1437,11 @@ Core.prototype.insertColumn = function (index, jsonObj) {
|
|
|
1437
1437
|
* @param {(number|Core.ColumnOptions|Array.<Core.ColumnOptions>)=} cols Column definition object or column count
|
|
1438
1438
|
*/
|
|
1439
1439
|
Core.prototype.insertColumns = function (at, cols) {
|
|
1440
|
-
|
|
1440
|
+
let prevCount = this.getColumnCount();
|
|
1441
1441
|
if (!(at < prevCount)) { at = prevCount; }
|
|
1442
1442
|
|
|
1443
|
-
|
|
1444
|
-
|
|
1443
|
+
let count = 0;
|
|
1444
|
+
let colDefs;
|
|
1445
1445
|
if (Array.isArray(cols)) {
|
|
1446
1446
|
count = cols.length;
|
|
1447
1447
|
if(count === 1) {
|
|
@@ -1462,18 +1462,18 @@ Core.prototype.insertColumns = function (at, cols) {
|
|
|
1462
1462
|
}
|
|
1463
1463
|
if (count <= 0) { return; }
|
|
1464
1464
|
|
|
1465
|
-
|
|
1466
|
-
|
|
1465
|
+
let prevState = this.freezeLayout();
|
|
1466
|
+
let args = [at, 0].concat(new Array(count));
|
|
1467
1467
|
Array.prototype.splice.apply(this._columnDefs, args);
|
|
1468
1468
|
|
|
1469
|
-
for (
|
|
1470
|
-
|
|
1469
|
+
for (let i = 0; i < count; i++) {
|
|
1470
|
+
let index = at + i;
|
|
1471
1471
|
this._layoutX.insertLane(index);
|
|
1472
|
-
for (
|
|
1473
|
-
|
|
1472
|
+
for (let s = this._settings.length; --s >= 0; ) {
|
|
1473
|
+
let section = this._settings[s].getSection();
|
|
1474
1474
|
section.insertColumn(index);
|
|
1475
1475
|
}
|
|
1476
|
-
|
|
1476
|
+
let colDef = colDefs && colDefs[i];
|
|
1477
1477
|
this._deserializeColumn(index, colDef);
|
|
1478
1478
|
}
|
|
1479
1479
|
|
|
@@ -1490,24 +1490,24 @@ Core.prototype.insertColumns = function (at, cols) {
|
|
|
1490
1490
|
* @fires Core#columnRemoved
|
|
1491
1491
|
*/
|
|
1492
1492
|
Core.prototype.removeColumnAt = function (index) {
|
|
1493
|
-
|
|
1493
|
+
let colCount = this.getColumnCount();
|
|
1494
1494
|
if(index < 0 || index >= colCount) { return null; }
|
|
1495
1495
|
|
|
1496
|
-
|
|
1496
|
+
let vEnd = -1;
|
|
1497
1497
|
if(this._colVirtualizer.isVirtualizable()) {
|
|
1498
1498
|
vEnd = this._colVirtualizer.getLastIndexInView();
|
|
1499
1499
|
}
|
|
1500
1500
|
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
for (
|
|
1501
|
+
let layoutSettings = this._layoutX.removeLaneAt(index);
|
|
1502
|
+
let sectionCount = this._settings.length;
|
|
1503
|
+
for (let i = 0; i < sectionCount; ++i) {
|
|
1504
1504
|
this._settings[i].getSection().removeColumnAt(index);
|
|
1505
1505
|
}
|
|
1506
1506
|
|
|
1507
|
-
|
|
1508
|
-
|
|
1507
|
+
let leftPinnedCount = this._pinnedLeftColumnCount;
|
|
1508
|
+
let rightPinnedCount = this._pinnedRightColumnCount;
|
|
1509
1509
|
|
|
1510
|
-
|
|
1510
|
+
let colDef = this._columnDefs.splice(index, 1)[0]; // width and styles
|
|
1511
1511
|
|
|
1512
1512
|
this._onColumnCountChanged();
|
|
1513
1513
|
// TODO: Column count changed may cause scroll pane to changed, and thus _updateScrollbarWidth should be included in the event handler
|
|
@@ -1524,7 +1524,7 @@ Core.prototype.removeColumnAt = function (index) {
|
|
|
1524
1524
|
colDef["layout"] = layoutSettings;
|
|
1525
1525
|
|
|
1526
1526
|
if (this._hasListener("columnRemoved")) {
|
|
1527
|
-
|
|
1527
|
+
let e = {};
|
|
1528
1528
|
e["atTheMiddle"] = true;
|
|
1529
1529
|
e["colIndex"] = index;
|
|
1530
1530
|
e["columns"] = "deprecated";
|
|
@@ -1557,8 +1557,8 @@ Core.prototype.removeAllColumns = function () {
|
|
|
1557
1557
|
* @return {number}
|
|
1558
1558
|
*/
|
|
1559
1559
|
Core.prototype.getStationaryColumnIndex = function () {
|
|
1560
|
-
|
|
1561
|
-
for (
|
|
1560
|
+
let colCount = this.getColumnCount();
|
|
1561
|
+
for (let i = colCount - 1; i >= 0; i--) {
|
|
1562
1562
|
if (this._getColumnDef(i)["stationary"]) {
|
|
1563
1563
|
return i;
|
|
1564
1564
|
}
|
|
@@ -1581,14 +1581,14 @@ Core.prototype.isColumnMoveAllowed = function (fromColIndex, toColIndex) {
|
|
|
1581
1581
|
return false;
|
|
1582
1582
|
}
|
|
1583
1583
|
|
|
1584
|
-
|
|
1584
|
+
let stationaryIndex = this.getStationaryColumnIndex();
|
|
1585
1585
|
|
|
1586
1586
|
if (stationaryIndex > -1) {
|
|
1587
1587
|
if (toColIndex <= stationaryIndex) {
|
|
1588
1588
|
return false;
|
|
1589
1589
|
}
|
|
1590
1590
|
|
|
1591
|
-
for (
|
|
1591
|
+
for (let i = 0; i < fromColIndex.length; i++) {
|
|
1592
1592
|
if (fromColIndex[i] <= stationaryIndex) {
|
|
1593
1593
|
return false;
|
|
1594
1594
|
}
|
|
@@ -1604,7 +1604,7 @@ Core.prototype.isColumnMoveAllowed = function (fromColIndex, toColIndex) {
|
|
|
1604
1604
|
* @return {boolean} Return true if the column moving is movable, and false otherwise
|
|
1605
1605
|
*/
|
|
1606
1606
|
Core.prototype.isColumnMovable = function (colIndex) {
|
|
1607
|
-
|
|
1607
|
+
let stationaryIndex = this.getStationaryColumnIndex();
|
|
1608
1608
|
|
|
1609
1609
|
if (stationaryIndex > -1) {
|
|
1610
1610
|
if (colIndex <= stationaryIndex) {
|
|
@@ -1630,12 +1630,12 @@ Core.prototype.moveColumn = function (fromCol, destCol) {
|
|
|
1630
1630
|
}
|
|
1631
1631
|
|
|
1632
1632
|
// Validate user inputs
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1633
|
+
let i;
|
|
1634
|
+
let len = fromCol.length;
|
|
1635
|
+
let colIndices = [];
|
|
1636
|
+
let colIndex = 0;
|
|
1637
|
+
let colCount = this.getColumnCount();
|
|
1638
|
+
let dict = {};
|
|
1639
1639
|
for(i = 0; i < len; ++i) {
|
|
1640
1640
|
colIndex = fromCol[i];
|
|
1641
1641
|
if(colIndex >= 0 && colIndex < colCount) { // Filter out invalid index
|
|
@@ -1666,7 +1666,7 @@ Core.prototype.moveColumn = function (fromCol, destCol) {
|
|
|
1666
1666
|
colIndices.sort(ascNumberSorter);
|
|
1667
1667
|
if(dict[destCol]) { // Destination falls in the same place as source columns
|
|
1668
1668
|
// Check if source columns are in continuous sequence
|
|
1669
|
-
|
|
1669
|
+
let continuousSequence = true;
|
|
1670
1670
|
colIndex = colIndices[0];
|
|
1671
1671
|
for(i = 1; i < len; ++i) {
|
|
1672
1672
|
if(++colIndex !== colIndices[i]) {
|
|
@@ -1678,11 +1678,11 @@ Core.prototype.moveColumn = function (fromCol, destCol) {
|
|
|
1678
1678
|
return false; // No moving operation is required
|
|
1679
1679
|
}
|
|
1680
1680
|
}
|
|
1681
|
-
|
|
1681
|
+
let prevState = this.freezeLayout(true);
|
|
1682
1682
|
|
|
1683
1683
|
// Start moving multiple items
|
|
1684
|
-
|
|
1685
|
-
|
|
1684
|
+
let rhsCount = 0;
|
|
1685
|
+
let srcIndex, destIndex;
|
|
1686
1686
|
// Perform move operation on the right hand side
|
|
1687
1687
|
for(i = 0; i < len; ++i) {
|
|
1688
1688
|
srcIndex = colIndices[i];
|
|
@@ -1693,7 +1693,7 @@ Core.prototype.moveColumn = function (fromCol, destCol) {
|
|
|
1693
1693
|
}
|
|
1694
1694
|
}
|
|
1695
1695
|
// Perform move operation on the left hand side
|
|
1696
|
-
|
|
1696
|
+
let lhsCount = len - rhsCount;
|
|
1697
1697
|
destIndex = rhsCount ? destCol - 1 : destCol;
|
|
1698
1698
|
for(i = 0; i < lhsCount; ++i) {
|
|
1699
1699
|
srcIndex = colIndices[i] - i;
|
|
@@ -1710,7 +1710,7 @@ Core.prototype.moveColumn = function (fromCol, destCol) {
|
|
|
1710
1710
|
* @fires Core#columnMoved
|
|
1711
1711
|
*/
|
|
1712
1712
|
Core.prototype._moveColumn = function (fromCol, destCol) {
|
|
1713
|
-
|
|
1713
|
+
let colCount = this.getColumnCount();
|
|
1714
1714
|
if (fromCol < 0) { fromCol = 0; }
|
|
1715
1715
|
else if (fromCol >= colCount) { fromCol = colCount - 1; }
|
|
1716
1716
|
if (destCol < 0) { destCol = 0; }
|
|
@@ -1721,24 +1721,24 @@ Core.prototype._moveColumn = function (fromCol, destCol) {
|
|
|
1721
1721
|
return false;
|
|
1722
1722
|
}
|
|
1723
1723
|
|
|
1724
|
-
|
|
1724
|
+
let vEnd = -1;
|
|
1725
1725
|
if(this._colVirtualizer.isVirtualizable()) {
|
|
1726
1726
|
vEnd = this._colVirtualizer.getLastIndexInView();
|
|
1727
1727
|
}
|
|
1728
1728
|
|
|
1729
|
-
|
|
1729
|
+
let colId = this.getColumnId(fromCol);
|
|
1730
1730
|
this._layoutX.moveLane(fromCol, destCol);
|
|
1731
|
-
|
|
1732
|
-
for (
|
|
1733
|
-
|
|
1734
|
-
|
|
1731
|
+
let sectionCount = this._settings.length;
|
|
1732
|
+
for (let i = 0; i < sectionCount; ++i) {
|
|
1733
|
+
let sectionSettings = this._settings[i];
|
|
1734
|
+
let section = sectionSettings.getSection();
|
|
1735
1735
|
section.moveColumn(fromCol, destCol);
|
|
1736
1736
|
}
|
|
1737
1737
|
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
//
|
|
1738
|
+
let colDef = this._columnDefs[fromCol];
|
|
1739
|
+
let leftPinnedCount = this._countPinnedLeftColumns();
|
|
1740
|
+
let rightPinnedCount = this._countPinnedRightColumns();
|
|
1741
|
+
// let minColumn = (fromCol < destCol) ? fromCol : destCol;
|
|
1742
1742
|
Util.moveArrayItem(this._columnDefs, fromCol, destCol);
|
|
1743
1743
|
|
|
1744
1744
|
if(this._hScrollbarEnabled) {
|
|
@@ -1779,7 +1779,7 @@ Core.prototype._moveColumn = function (fromCol, destCol) {
|
|
|
1779
1779
|
// this._syncLayoutToColumns(minColumn, this.getColumnCount());
|
|
1780
1780
|
|
|
1781
1781
|
if (this._hasListener("columnMoved")) {
|
|
1782
|
-
|
|
1782
|
+
let e = {};
|
|
1783
1783
|
e["fromColIndex"] = fromCol;
|
|
1784
1784
|
e["toColIndex"] = destCol;
|
|
1785
1785
|
e["colId"] = colId; // TODO: Id may not needed
|
|
@@ -1814,12 +1814,12 @@ Core.prototype._moveColumn = function (fromCol, destCol) {
|
|
|
1814
1814
|
* grid.moveColumnById("sourceColumnId", ""); // move to the last position
|
|
1815
1815
|
*/
|
|
1816
1816
|
Core.prototype.moveColumnById = function (srcCol, destCol) {
|
|
1817
|
-
|
|
1818
|
-
|
|
1817
|
+
let colCount = this.getColumnCount();
|
|
1818
|
+
let srcIndex = this.getColumnIndex(srcCol);
|
|
1819
1819
|
if(srcIndex < 0 || srcIndex >= colCount) {
|
|
1820
1820
|
return false;
|
|
1821
1821
|
}
|
|
1822
|
-
|
|
1822
|
+
let destIndex = destCol != null ? this.getColumnIndex(destCol) : -1;
|
|
1823
1823
|
if(destIndex < 0) {
|
|
1824
1824
|
destIndex = colCount;
|
|
1825
1825
|
}
|
|
@@ -1846,7 +1846,7 @@ Core.prototype._moveColumnByIndex = function (srcIndex, destIndex) {
|
|
|
1846
1846
|
* @return {boolean} Return true if there is any change, and false otherwise
|
|
1847
1847
|
*/
|
|
1848
1848
|
Core.prototype.reorderColumns = function (colRefs, destCol) {
|
|
1849
|
-
|
|
1849
|
+
let destId = "";
|
|
1850
1850
|
if(typeof destCol === "number") {
|
|
1851
1851
|
destId = this.getColumnId(destCol);
|
|
1852
1852
|
} else if(destCol) {
|
|
@@ -1855,17 +1855,17 @@ Core.prototype.reorderColumns = function (colRefs, destCol) {
|
|
|
1855
1855
|
|
|
1856
1856
|
this.startBatch("move");
|
|
1857
1857
|
|
|
1858
|
-
|
|
1858
|
+
let dirty = 0;
|
|
1859
1859
|
if(Array.isArray(colRefs)) {
|
|
1860
|
-
|
|
1860
|
+
let srcLen = colRefs.length;
|
|
1861
1861
|
if(srcLen > 1) {
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1862
|
+
let colIds = this.getColumnIds();
|
|
1863
|
+
let colCount = colIds.length;
|
|
1864
|
+
let srcIds = [];
|
|
1865
|
+
let invalidDest = false;
|
|
1866
|
+
let i, srcId, srcIdx;
|
|
1867
1867
|
for(i = 0; i < srcLen; ++i) {
|
|
1868
|
-
|
|
1868
|
+
let colRef = colRefs[i];
|
|
1869
1869
|
if(typeof colRef === "number") {
|
|
1870
1870
|
srcIdx = colRef;
|
|
1871
1871
|
srcId = colIds[colRef] || "";
|
|
@@ -1881,7 +1881,7 @@ Core.prototype.reorderColumns = function (colRefs, destCol) {
|
|
|
1881
1881
|
}
|
|
1882
1882
|
}
|
|
1883
1883
|
|
|
1884
|
-
|
|
1884
|
+
let destIdx;
|
|
1885
1885
|
srcLen = srcIds.length;
|
|
1886
1886
|
if(invalidDest) { // Find the next valid destination where it is not contained in the source columns
|
|
1887
1887
|
destIdx = this.getColumnIndex(destId);
|
|
@@ -1942,8 +1942,8 @@ Core.prototype.updateColumnLayout = function () {
|
|
|
1942
1942
|
Core.prototype._deserializeColumn = function (index, jsonObj) {
|
|
1943
1943
|
if (!jsonObj) { return; }
|
|
1944
1944
|
|
|
1945
|
-
|
|
1946
|
-
|
|
1945
|
+
let layout = jsonObj["layout"] || jsonObj;
|
|
1946
|
+
let val = jsonObj["width"];
|
|
1947
1947
|
if (val != null) { layout["size"] = val; }
|
|
1948
1948
|
val = jsonObj["scalable"];
|
|
1949
1949
|
if (val != null) { layout["scalable"] = val; }
|
|
@@ -1955,29 +1955,29 @@ Core.prototype._deserializeColumn = function (index, jsonObj) {
|
|
|
1955
1955
|
|
|
1956
1956
|
this._layoutX.deserializeLane(index, layout);
|
|
1957
1957
|
|
|
1958
|
-
|
|
1959
|
-
|
|
1958
|
+
let name;
|
|
1959
|
+
let styles = jsonObj["styles"];
|
|
1960
1960
|
for (name in styles) {
|
|
1961
1961
|
this.setColumnStyle(index, name, styles[name]);
|
|
1962
1962
|
}
|
|
1963
|
-
|
|
1963
|
+
let classes = jsonObj["classes"];
|
|
1964
1964
|
for (name in classes) {
|
|
1965
1965
|
this.enableColumnClass(index, name, classes[name]);
|
|
1966
1966
|
}
|
|
1967
1967
|
// TODO: Load specific styles for each column type (e.g. "content", "title", "header")
|
|
1968
1968
|
|
|
1969
|
-
|
|
1970
|
-
|
|
1969
|
+
let colDef = this._getColumnDef(index);
|
|
1970
|
+
let colId = jsonObj["id"];
|
|
1971
1971
|
if(colId && typeof colId === "string") {
|
|
1972
1972
|
colDef["id"] = colId; // WARNING: We do not guarantee uniqueness of user id
|
|
1973
1973
|
colDef["userId"] = colId;
|
|
1974
1974
|
}
|
|
1975
|
-
|
|
1975
|
+
let field = jsonObj["field"];
|
|
1976
1976
|
if(field && typeof field === "string") {
|
|
1977
1977
|
colDef["field"] = field;
|
|
1978
1978
|
}
|
|
1979
1979
|
|
|
1980
|
-
|
|
1980
|
+
let value = jsonObj["dataColumnName"]; // Deprecated
|
|
1981
1981
|
if (value != null) {
|
|
1982
1982
|
colDef["dataColumnName"] = value;
|
|
1983
1983
|
}
|
|
@@ -2003,12 +2003,12 @@ Core.prototype._deserializeColumn = function (index, jsonObj) {
|
|
|
2003
2003
|
this.setColumnData(index, value);
|
|
2004
2004
|
}
|
|
2005
2005
|
|
|
2006
|
-
|
|
2006
|
+
let formatter = jsonObj["formatter"] || jsonObj["binding"]; // support both composite and real-time grid
|
|
2007
2007
|
if(Array.isArray(formatter)) {
|
|
2008
2008
|
formatter = formatter[0]; // Support only one formatter in the array
|
|
2009
2009
|
}
|
|
2010
2010
|
if(formatter && typeof formatter !== "function") {
|
|
2011
|
-
|
|
2011
|
+
let formatterInitializer = formatter["init"];
|
|
2012
2012
|
if(typeof formatterInitializer === "function") {
|
|
2013
2013
|
formatterInitializer(jsonObj, this); // Pass on userJson object and core grid instance
|
|
2014
2014
|
}
|
|
@@ -2037,7 +2037,7 @@ Core.prototype.addRow = function (opt_num) {
|
|
|
2037
2037
|
this.setColumnCount(1); // WARNING: Auto column adding
|
|
2038
2038
|
}
|
|
2039
2039
|
|
|
2040
|
-
|
|
2040
|
+
let section = this.getLastSection();
|
|
2041
2041
|
if (section == null) {
|
|
2042
2042
|
section = this.addSection(); // WARNING: Auto section adding
|
|
2043
2043
|
}
|
|
@@ -2051,7 +2051,7 @@ Core.prototype.addRow = function (opt_num) {
|
|
|
2051
2051
|
* @param {number=} opt_num Default is one row
|
|
2052
2052
|
*/
|
|
2053
2053
|
Core.prototype.removeRow = function (opt_num) {
|
|
2054
|
-
|
|
2054
|
+
let section = this.getLastSection();
|
|
2055
2055
|
if (section == null) { return; }
|
|
2056
2056
|
|
|
2057
2057
|
if (opt_num == null) { opt_num = 1; }
|
|
@@ -2069,7 +2069,7 @@ Core.prototype.getRowCount = function () {
|
|
|
2069
2069
|
* @param {number} num
|
|
2070
2070
|
*/
|
|
2071
2071
|
Core.prototype.setSectionRowCount = function(sectionRef, num) {
|
|
2072
|
-
|
|
2072
|
+
let section = this.getSection(sectionRef);
|
|
2073
2073
|
if (section == null) { return; }
|
|
2074
2074
|
section.setRowCount(num);
|
|
2075
2075
|
};
|
|
@@ -2090,8 +2090,8 @@ Core.prototype.getRelativeIndex = Util._deprecatedFunction;
|
|
|
2090
2090
|
* @public
|
|
2091
2091
|
*/
|
|
2092
2092
|
Core.prototype.removeAllRows = function() {
|
|
2093
|
-
|
|
2094
|
-
for(
|
|
2093
|
+
let len = this._settings.length;
|
|
2094
|
+
for(let i = 0; i < len; ++i) {
|
|
2095
2095
|
this._settings[i].getSection().setRowCount(0);
|
|
2096
2096
|
this._sectionStarts[i] = 0;
|
|
2097
2097
|
}
|
|
@@ -2113,11 +2113,11 @@ Core.prototype.getDefaultRowHeight = function () {
|
|
|
2113
2113
|
Core.prototype.setDefaultRowHeight = function (val, opt_includeTitle) {
|
|
2114
2114
|
if (this._layoutY.setDefaultLaneSize(val)) {
|
|
2115
2115
|
this._rowHeightSync = false;
|
|
2116
|
-
|
|
2116
|
+
let defaultHeight = this._layoutY.getDefaultLaneSize();
|
|
2117
2117
|
this._rowHeightException = (opt_includeTitle) ? "" : "title";
|
|
2118
|
-
|
|
2119
|
-
for (
|
|
2120
|
-
|
|
2118
|
+
let sectCount = this._settings.length;
|
|
2119
|
+
for (let i = 0; i < sectCount; ++i) {
|
|
2120
|
+
let sectionSettings = this._settings[i];
|
|
2121
2121
|
if (
|
|
2122
2122
|
sectionSettings.getType() !== this._rowHeightException &&
|
|
2123
2123
|
sectionSettings.getId() !== "bottomPadding"
|
|
@@ -2168,7 +2168,7 @@ Core.prototype.setDataSource = function (dataSource) {
|
|
|
2168
2168
|
}
|
|
2169
2169
|
}
|
|
2170
2170
|
|
|
2171
|
-
|
|
2171
|
+
let e = {};
|
|
2172
2172
|
e["prevDataSource"] = this._dataSource;
|
|
2173
2173
|
this._dataSource = dataSource || null;
|
|
2174
2174
|
e["dataSource"] = this._dataSource;
|
|
@@ -2176,8 +2176,8 @@ Core.prototype.setDataSource = function (dataSource) {
|
|
|
2176
2176
|
this._dispatch("dataSourceChanged", e);
|
|
2177
2177
|
|
|
2178
2178
|
if (this._autoSetDataSource) {
|
|
2179
|
-
|
|
2180
|
-
for (
|
|
2179
|
+
let len = this._settings.length;
|
|
2180
|
+
for (let i = 0; i < len; ++i) {
|
|
2181
2181
|
this._settings[i].setDataSource(dataSource);
|
|
2182
2182
|
}
|
|
2183
2183
|
}
|
|
@@ -2210,7 +2210,7 @@ Core.prototype.getColumnRenderEvent = Util._deprecatedFunction;
|
|
|
2210
2210
|
*/
|
|
2211
2211
|
Core.prototype.getColumnDataBindingEvent = function(c) {
|
|
2212
2212
|
console.log("getColumnDataBindingEvent() is deprecated. Use setColumnDataBindingHandler() instead");
|
|
2213
|
-
|
|
2213
|
+
let t = this;
|
|
2214
2214
|
return {
|
|
2215
2215
|
"listen": function(f) {
|
|
2216
2216
|
t.setColumnDataBindingHandler(c, f);
|
|
@@ -2235,7 +2235,7 @@ Core.prototype.setColumnStyle = function (colIndex, style, value, opt_type) {
|
|
|
2235
2235
|
console.log("WARNING: the first parameter for setColumnStyle must be column index");
|
|
2236
2236
|
}
|
|
2237
2237
|
|
|
2238
|
-
|
|
2238
|
+
let styles;
|
|
2239
2239
|
if (opt_type == null) {
|
|
2240
2240
|
styles = this._getNestedColumnDef(colIndex, "styles");
|
|
2241
2241
|
} else {
|
|
@@ -2244,10 +2244,10 @@ Core.prototype.setColumnStyle = function (colIndex, style, value, opt_type) {
|
|
|
2244
2244
|
}
|
|
2245
2245
|
styles[style] = value;
|
|
2246
2246
|
|
|
2247
|
-
for (
|
|
2248
|
-
|
|
2247
|
+
for (let i = this._settings.length; --i >= 0; ) {
|
|
2248
|
+
let sectionSettings = this._settings[i];
|
|
2249
2249
|
if (opt_type == null || opt_type === sectionSettings.getType()) {
|
|
2250
|
-
|
|
2250
|
+
let section = sectionSettings.getSection();
|
|
2251
2251
|
section.setColumnStyle(colIndex, style, value);
|
|
2252
2252
|
}
|
|
2253
2253
|
}
|
|
@@ -2265,7 +2265,7 @@ Core.prototype.enableColumnClass = function (colIndex, clsName, enabled, opt_typ
|
|
|
2265
2265
|
colIndex = 0;
|
|
2266
2266
|
}
|
|
2267
2267
|
|
|
2268
|
-
|
|
2268
|
+
let classes;
|
|
2269
2269
|
if (opt_type == null) {
|
|
2270
2270
|
classes = this._getNestedColumnDef(colIndex, "classes");
|
|
2271
2271
|
} else {
|
|
@@ -2273,7 +2273,7 @@ Core.prototype.enableColumnClass = function (colIndex, clsName, enabled, opt_typ
|
|
|
2273
2273
|
classes = this._getNestedColumnDef(colIndex, opt_type, "classes");
|
|
2274
2274
|
}
|
|
2275
2275
|
|
|
2276
|
-
|
|
2276
|
+
let dirty = false;
|
|
2277
2277
|
enabled = (enabled !== false);
|
|
2278
2278
|
if (enabled) {
|
|
2279
2279
|
if(!classes[clsName]) {
|
|
@@ -2285,8 +2285,8 @@ Core.prototype.enableColumnClass = function (colIndex, clsName, enabled, opt_typ
|
|
|
2285
2285
|
}
|
|
2286
2286
|
|
|
2287
2287
|
if(dirty) {
|
|
2288
|
-
for (
|
|
2289
|
-
|
|
2288
|
+
for (let i = this._settings.length; --i >= 0; ) {
|
|
2289
|
+
let sectionSettings = this._settings[i];
|
|
2290
2290
|
if (opt_type == null || opt_type === sectionSettings.getType()) {
|
|
2291
2291
|
sectionSettings.getSection().enableColumnClass(colIndex, clsName, enabled);
|
|
2292
2292
|
}
|
|
@@ -2301,7 +2301,7 @@ Core.prototype.enableColumnClass = function (colIndex, clsName, enabled, opt_typ
|
|
|
2301
2301
|
* @return {boolean}
|
|
2302
2302
|
*/
|
|
2303
2303
|
Core.prototype.hasColumnClass = function (colIndex, clsName, opt_type) {
|
|
2304
|
-
|
|
2304
|
+
let classes;
|
|
2305
2305
|
if (opt_type == null) {
|
|
2306
2306
|
classes = this._getNestedColumnDef(colIndex, "classes");
|
|
2307
2307
|
} else {
|
|
@@ -2316,9 +2316,9 @@ Core.prototype.hasColumnClass = function (colIndex, clsName, opt_type) {
|
|
|
2316
2316
|
* @param {string=} alignment Available options are "center"|"right"|"left"|"c"|"r"|"l". Use empty string (falsy value) to reset back to default aliganment.
|
|
2317
2317
|
*/
|
|
2318
2318
|
Core.prototype.setColumnAlignment = function(colIndex, alignment) {
|
|
2319
|
-
|
|
2319
|
+
let ch = alignment ? alignment.charAt(0).toLowerCase() : "";
|
|
2320
2320
|
|
|
2321
|
-
|
|
2321
|
+
let dirty = 0;
|
|
2322
2322
|
dirty |= this.enableColumnClass(colIndex, "tr-align-left", ch === "l");
|
|
2323
2323
|
dirty |= this.enableColumnClass(colIndex, "tr-align-right", ch === "r");
|
|
2324
2324
|
dirty |= this.enableColumnClass(colIndex, "tr-align-center", ch === "c");
|
|
@@ -2351,13 +2351,13 @@ Core.prototype.getColumnAlignment = function(colIndex) {
|
|
|
2351
2351
|
* @return {number}
|
|
2352
2352
|
*/
|
|
2353
2353
|
Core.prototype.getColumnLeft = function (colIndex) {
|
|
2354
|
-
|
|
2354
|
+
let colDef = this._columnDefs[colIndex];
|
|
2355
2355
|
if(colDef && colDef["rightPinned"]) {
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
for(
|
|
2356
|
+
let gridWidth = this.getElement().clientWidth;
|
|
2357
|
+
let contentWidth = this._layoutX.getTrackSize();
|
|
2358
|
+
let colLeft = contentWidth < gridWidth ? contentWidth : gridWidth;
|
|
2359
|
+
let lastIndex = this.getColumnCount() - 1;
|
|
2360
|
+
for(let i = lastIndex; i >= colIndex; --i) {
|
|
2361
2361
|
colLeft -= this._layoutX.getLaneSize(i);
|
|
2362
2362
|
}
|
|
2363
2363
|
return colLeft;
|
|
@@ -2398,17 +2398,17 @@ Core.prototype._calculateColumnWidths = function (indices, widths) {
|
|
|
2398
2398
|
return widths;
|
|
2399
2399
|
}
|
|
2400
2400
|
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2401
|
+
let i, newWidth = 0, settingCols = {};
|
|
2402
|
+
let len = indices.length;
|
|
2403
|
+
let calWidths = new Array(len);
|
|
2404
2404
|
for (i = 0; i < len; i++) {
|
|
2405
2405
|
settingCols[indices[i]] = true;
|
|
2406
2406
|
calWidths[i] = widths[i];
|
|
2407
2407
|
newWidth += widths[i];
|
|
2408
2408
|
}
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2409
|
+
let fixedSize = 0, scalableCount = 0;
|
|
2410
|
+
let colCount = this.getColumnCount();
|
|
2411
|
+
let layoutX = this._layoutX;
|
|
2412
2412
|
|
|
2413
2413
|
for(i = 0; i < colCount; i++) {
|
|
2414
2414
|
if (settingCols[i]) { continue; }
|
|
@@ -2421,8 +2421,8 @@ Core.prototype._calculateColumnWidths = function (indices, widths) {
|
|
|
2421
2421
|
}
|
|
2422
2422
|
}
|
|
2423
2423
|
}
|
|
2424
|
-
|
|
2425
|
-
|
|
2424
|
+
let gridSize = this.getContentWidth();
|
|
2425
|
+
let excess = newWidth + fixedSize - gridSize;
|
|
2426
2426
|
|
|
2427
2427
|
if (scalableCount < 1 || excess > 0) {
|
|
2428
2428
|
layoutX.resetLaneToDefaultSize();
|
|
@@ -2459,8 +2459,8 @@ Core.prototype._calculateColumnWidths = function (indices, widths) {
|
|
|
2459
2459
|
* core.setColumnWidth(1, 100, true); // The second column will have a percentage width where 100 is the weight comparing with other percentage column
|
|
2460
2460
|
*/
|
|
2461
2461
|
Core.prototype.setColumnWidth = function (colIndex, px, opt_scalable) {
|
|
2462
|
-
|
|
2463
|
-
|
|
2462
|
+
let calWidths = this._calculateColumnWidths([colIndex], [px]);
|
|
2463
|
+
let dirty = this._setColumnWidth(colIndex, calWidths[0], opt_scalable);
|
|
2464
2464
|
if (dirty) {
|
|
2465
2465
|
this._syncLayoutToColumns(colIndex, colIndex + 1);
|
|
2466
2466
|
}
|
|
@@ -2477,18 +2477,18 @@ Core.prototype.setColumnWidth = function (colIndex, px, opt_scalable) {
|
|
|
2477
2477
|
* core.setColumnWidths([1, 200, 1, 150], [true, false, true]); // The first column make column scale, seconds make column pixel, third make column scale and four make column pixel
|
|
2478
2478
|
*/
|
|
2479
2479
|
Core.prototype.setColumnWidths = function (columnWidths, opt_proportion) {
|
|
2480
|
-
|
|
2481
|
-
|
|
2480
|
+
let dirty = 0;
|
|
2481
|
+
let indices = [], widths = [], propotions = [], i;
|
|
2482
2482
|
for(i = columnWidths.length; --i >= 0;) {
|
|
2483
|
-
|
|
2483
|
+
let px = columnWidths[i];
|
|
2484
2484
|
if(px != null) {
|
|
2485
2485
|
indices.push(i);
|
|
2486
2486
|
widths.push(px);
|
|
2487
2487
|
}
|
|
2488
|
-
|
|
2488
|
+
let proportionMode = Array.isArray(opt_proportion) ? opt_proportion[i] : opt_proportion;
|
|
2489
2489
|
propotions.push(proportionMode);
|
|
2490
2490
|
}
|
|
2491
|
-
|
|
2491
|
+
let calWidths = this._calculateColumnWidths(indices, widths);
|
|
2492
2492
|
for(i = 0; i < calWidths.length; i++) {
|
|
2493
2493
|
dirty |= this._setColumnWidth(indices[i], calWidths[i], propotions[i] );
|
|
2494
2494
|
}
|
|
@@ -2517,7 +2517,7 @@ Core.prototype.isColumnVisible = function (colIndex) {
|
|
|
2517
2517
|
* @see {@link Core#showAllColumns}
|
|
2518
2518
|
*/
|
|
2519
2519
|
Core.prototype.hideColumn = function (colIndex, hidden) {
|
|
2520
|
-
|
|
2520
|
+
let visibility = hidden === false;
|
|
2521
2521
|
this.setColumnVisibility(colIndex, visibility, 0);
|
|
2522
2522
|
};
|
|
2523
2523
|
/** Hide multiple columns at once, improving the performance. Note that the hidden columns continue to exist and occupy the index. So there is no index shifted after this function call.
|
|
@@ -2530,12 +2530,12 @@ Core.prototype.hideColumn = function (colIndex, hidden) {
|
|
|
2530
2530
|
* @see {@link Core#showAllColumns}
|
|
2531
2531
|
*/
|
|
2532
2532
|
Core.prototype.hideColumns = function (colIndices, hidden) {
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2533
|
+
let len = Array.isArray(colIndices) ? colIndices.length : 0;
|
|
2534
|
+
let changeIndices = [];
|
|
2535
|
+
let colCount = this.getColumnCount();
|
|
2536
2536
|
hidden = hidden !== false;
|
|
2537
|
-
for (
|
|
2538
|
-
|
|
2537
|
+
for (let i = 0; i < len; ++i) {
|
|
2538
|
+
let colIndex = colIndices[i];
|
|
2539
2539
|
if (colIndex >= 0 && colIndex < colCount) {
|
|
2540
2540
|
if (this._layoutX.hideLane(colIndex, hidden, 0)) {
|
|
2541
2541
|
changeIndices.push(colIndex);
|
|
@@ -2547,7 +2547,7 @@ Core.prototype.hideColumns = function (colIndices, hidden) {
|
|
|
2547
2547
|
this.requestRowRefresh();
|
|
2548
2548
|
|
|
2549
2549
|
if (this._hasListener("columnVisibilityChanged")) {
|
|
2550
|
-
|
|
2550
|
+
let e = {};
|
|
2551
2551
|
e["colIndices"] = changeIndices;
|
|
2552
2552
|
e["hidden"] = hidden;
|
|
2553
2553
|
this._dispatch("columnVisibilityChanged", e);
|
|
@@ -2561,9 +2561,9 @@ Core.prototype.hideColumns = function (colIndices, hidden) {
|
|
|
2561
2561
|
* @see {@link Core#hideColumns}
|
|
2562
2562
|
*/
|
|
2563
2563
|
Core.prototype.showAllColumns = function () {
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
for (
|
|
2564
|
+
let changeIndices = [];
|
|
2565
|
+
let colCount = this.getColumnCount();
|
|
2566
|
+
for (let c = 0; c < colCount; ++c) {
|
|
2567
2567
|
if (this._layoutX.hideLane(c, false, 0)) {
|
|
2568
2568
|
changeIndices.push(c);
|
|
2569
2569
|
}
|
|
@@ -2573,7 +2573,7 @@ Core.prototype.showAllColumns = function () {
|
|
|
2573
2573
|
this.requestRowRefresh();
|
|
2574
2574
|
|
|
2575
2575
|
if (this._hasListener("columnVisibilityChanged")) {
|
|
2576
|
-
|
|
2576
|
+
let e = {};
|
|
2577
2577
|
e["colIndices"] = changeIndices;
|
|
2578
2578
|
e["hidden"] = false;
|
|
2579
2579
|
this._dispatch("columnVisibilityChanged", e);
|
|
@@ -2604,11 +2604,11 @@ Core.prototype.setMinimumColumnWidth = function (colIndex, width) {
|
|
|
2604
2604
|
* @return {boolean} True if there is any change
|
|
2605
2605
|
*/
|
|
2606
2606
|
Core.prototype.setMinimumColumnWidths = function (minWidths, proportion) {
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
for (
|
|
2611
|
-
|
|
2607
|
+
let dirty = 0;
|
|
2608
|
+
let first = NaN;
|
|
2609
|
+
let last = NaN;
|
|
2610
|
+
for (let c = minWidths.length; --c >= 0; ) {
|
|
2611
|
+
let minWidth = minWidths[c];
|
|
2612
2612
|
if (minWidth != null) {
|
|
2613
2613
|
if(!last) { last = c; }
|
|
2614
2614
|
first = c;
|
|
@@ -2634,7 +2634,7 @@ Core.prototype.getColumnScalability = function (colIndex) {
|
|
|
2634
2634
|
* @fires Core#widthChanged
|
|
2635
2635
|
*/
|
|
2636
2636
|
Core.prototype.setColumnScalability = function (val, opt_scalable) {
|
|
2637
|
-
|
|
2637
|
+
let dirty = false;
|
|
2638
2638
|
if (Util.isNumber(val)) {
|
|
2639
2639
|
opt_scalable = (opt_scalable !== false);
|
|
2640
2640
|
dirty = this._layoutX.setLaneScalability(/** @type{number} */(val), opt_scalable);
|
|
@@ -2656,7 +2656,7 @@ Core.prototype.setDefaultColumnScalable = function (scalable) {
|
|
|
2656
2656
|
* @return {boolean}
|
|
2657
2657
|
*/
|
|
2658
2658
|
Core.prototype.resetColumnWidths = function () {
|
|
2659
|
-
|
|
2659
|
+
let dirty = this._layoutX.resetLaneToDefaultSize();
|
|
2660
2660
|
if (dirty) {
|
|
2661
2661
|
this._syncLayoutToColumns(0, this.getColumnCount());
|
|
2662
2662
|
}
|
|
@@ -2725,7 +2725,7 @@ Core.prototype.setAlwaysRenderColumn = function(colIndex, alwaysRender) {
|
|
|
2725
2725
|
* @return {!boolean}
|
|
2726
2726
|
*/
|
|
2727
2727
|
Core.prototype._isAlwaysRenderColumn = function (colIndex) {
|
|
2728
|
-
|
|
2728
|
+
let colData = this.getColumnData(colIndex);
|
|
2729
2729
|
return colData["alwaysRender"] === true;
|
|
2730
2730
|
};
|
|
2731
2731
|
|
|
@@ -2754,10 +2754,10 @@ Core.prototype.setFitContentWidth = function (bool) {
|
|
|
2754
2754
|
* core.loadPlugin(new InCellEditingExtension());
|
|
2755
2755
|
*/
|
|
2756
2756
|
Core.prototype.loadPlugin = function (pluginRef, opt_options) {
|
|
2757
|
-
|
|
2757
|
+
let pluginInstance = null;
|
|
2758
2758
|
if (typeof pluginRef === "string") {
|
|
2759
|
-
|
|
2760
|
-
|
|
2759
|
+
let trNamespace = window["tr"];
|
|
2760
|
+
let gridNamespace = trNamespace ? trNamespace["grid"] : null;
|
|
2761
2761
|
if(!gridNamespace) {
|
|
2762
2762
|
return null;
|
|
2763
2763
|
}
|
|
@@ -2776,12 +2776,12 @@ Core.prototype.loadPlugin = function (pluginRef, opt_options) {
|
|
|
2776
2776
|
return null;
|
|
2777
2777
|
}
|
|
2778
2778
|
|
|
2779
|
-
|
|
2779
|
+
let pluginName = pluginInstance["getName"]();
|
|
2780
2780
|
if(!pluginName) {
|
|
2781
2781
|
return null;
|
|
2782
2782
|
}
|
|
2783
2783
|
|
|
2784
|
-
|
|
2784
|
+
let prevInstance = this._plugins[pluginName];
|
|
2785
2785
|
if (prevInstance) {
|
|
2786
2786
|
if(prevInstance === pluginInstance) {
|
|
2787
2787
|
return prevInstance; // The same instance is loaded twice
|
|
@@ -2802,9 +2802,9 @@ Core.prototype.loadPlugin = function (pluginRef, opt_options) {
|
|
|
2802
2802
|
* @return {*|null}
|
|
2803
2803
|
*/
|
|
2804
2804
|
Core.prototype.unloadPlugin = function (pluginRef) {
|
|
2805
|
-
|
|
2805
|
+
let pluginInstance;
|
|
2806
2806
|
if (pluginRef) {
|
|
2807
|
-
|
|
2807
|
+
let pluginName = "";
|
|
2808
2808
|
if (typeof pluginRef === "string") {
|
|
2809
2809
|
pluginName = pluginRef;
|
|
2810
2810
|
} else if (pluginRef["getName"]) {
|
|
@@ -2833,7 +2833,7 @@ Core.prototype.unloadPlugin = function (pluginRef) {
|
|
|
2833
2833
|
* @return {*|null} plugin Return null if the specified plugin has not been loaded
|
|
2834
2834
|
*/
|
|
2835
2835
|
Core.prototype.getPlugin = function (pluginName) {
|
|
2836
|
-
|
|
2836
|
+
let p = this._plugins[pluginName];
|
|
2837
2837
|
if (!p) {
|
|
2838
2838
|
p = this._plugins[pluginName + "Plugin"];
|
|
2839
2839
|
}
|
|
@@ -2844,8 +2844,8 @@ Core.prototype.getPlugin = function (pluginName) {
|
|
|
2844
2844
|
* @return {!Array}
|
|
2845
2845
|
*/
|
|
2846
2846
|
Core.prototype.getPlugins = function () {
|
|
2847
|
-
|
|
2848
|
-
for (
|
|
2847
|
+
let list = [];
|
|
2848
|
+
for (let key in this._plugins) {
|
|
2849
2849
|
list.push(this._plugins[key]);
|
|
2850
2850
|
}
|
|
2851
2851
|
return list;
|
|
@@ -2855,8 +2855,8 @@ Core.prototype.getPlugins = function () {
|
|
|
2855
2855
|
* @return {!Array.<string>}
|
|
2856
2856
|
*/
|
|
2857
2857
|
Core.prototype.getPluginList = function () {
|
|
2858
|
-
|
|
2859
|
-
for (
|
|
2858
|
+
let list = [];
|
|
2859
|
+
for (let key in this._plugins) {
|
|
2860
2860
|
list.push(key);
|
|
2861
2861
|
}
|
|
2862
2862
|
return list;
|
|
@@ -2887,7 +2887,7 @@ Core.prototype.resetSectionFreezing = function () {
|
|
|
2887
2887
|
*/
|
|
2888
2888
|
Core.prototype._freezeTopSectionAt = function (opt_frozenSection) {
|
|
2889
2889
|
if (typeof opt_frozenSection == "number") {
|
|
2890
|
-
|
|
2890
|
+
let newIndex = opt_frozenSection + 1;
|
|
2891
2891
|
if (newIndex === this._startVScrollbarIndex) return; // same position then do nothing
|
|
2892
2892
|
this._startVScrollbarIndex = newIndex;
|
|
2893
2893
|
} else {
|
|
@@ -2941,11 +2941,11 @@ Core.prototype.getFooterCount = function () {
|
|
|
2941
2941
|
* core.freezeColumn(0, 2); // Grid's horizontal scrollbar will affect only the middle part
|
|
2942
2942
|
*/
|
|
2943
2943
|
Core.prototype.freezeColumn = function (frozenColIndex, numRightColumn) {
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2944
|
+
let i, colDef;
|
|
2945
|
+
let colCount = this.getColumnCount();
|
|
2946
|
+
let leftPinnedCount = 0;
|
|
2947
|
+
let rightPinnedCount = 0;
|
|
2948
|
+
let dirty = false;
|
|
2949
2949
|
if (frozenColIndex || frozenColIndex === 0) {
|
|
2950
2950
|
this._hScrollbarEnabled = true;
|
|
2951
2951
|
leftPinnedCount = (frozenColIndex >= 0) ? frozenColIndex + 1 : 0;
|
|
@@ -2989,10 +2989,10 @@ Core.prototype.freezeColumn = function (frozenColIndex, numRightColumn) {
|
|
|
2989
2989
|
* @return {number} Array of number of left pinned column count and right pinned column count
|
|
2990
2990
|
*/
|
|
2991
2991
|
Core.prototype._countPinnedLeftColumns = function () {
|
|
2992
|
-
|
|
2992
|
+
let leftPinnedCount = 0;
|
|
2993
2993
|
if(this._hScrollbarEnabled) {
|
|
2994
|
-
for (
|
|
2995
|
-
|
|
2994
|
+
for (let i = this._columnDefs.length; --i >= 0;) {
|
|
2995
|
+
let colDef = this._columnDefs[i];
|
|
2996
2996
|
if(colDef) {
|
|
2997
2997
|
if(colDef["leftPinned"]) {
|
|
2998
2998
|
leftPinnedCount = i + 1; // Use the first right most pinned column
|
|
@@ -3008,12 +3008,12 @@ Core.prototype._countPinnedLeftColumns = function () {
|
|
|
3008
3008
|
* @return {number} numRightColumn Number of columns on the right side to be fixed/pinned on the right side
|
|
3009
3009
|
*/
|
|
3010
3010
|
Core.prototype._countPinnedRightColumns = function () {
|
|
3011
|
-
|
|
3011
|
+
let rightPinnedCount = 0;
|
|
3012
3012
|
if(this._hScrollbarEnabled) {
|
|
3013
|
-
|
|
3014
|
-
|
|
3013
|
+
let colCount = this._columnDefs.length;
|
|
3014
|
+
let i;
|
|
3015
3015
|
for(i = 0; i < colCount; ++i) {
|
|
3016
|
-
|
|
3016
|
+
let colDef = this._columnDefs[i];
|
|
3017
3017
|
if(colDef && colDef["rightPinned"]) {
|
|
3018
3018
|
break;
|
|
3019
3019
|
}
|
|
@@ -3100,11 +3100,11 @@ Core.prototype.updateScrollbars = function(updateHeight, updateWidth) {
|
|
|
3100
3100
|
*/
|
|
3101
3101
|
Core.prototype.freezeLayout = function (opt_bool) {
|
|
3102
3102
|
opt_bool = opt_bool !== false;
|
|
3103
|
-
|
|
3103
|
+
let prevState = this._frozenLayout;
|
|
3104
3104
|
if (prevState !== opt_bool) {
|
|
3105
3105
|
this._frozenLayout = opt_bool;
|
|
3106
3106
|
|
|
3107
|
-
|
|
3107
|
+
let stp = this.getPlugin("SortableTitlePlugin");
|
|
3108
3108
|
if(this._frozenLayout) {
|
|
3109
3109
|
if(stp) {
|
|
3110
3110
|
stp.freezeIndicator(true);
|
|
@@ -3122,8 +3122,8 @@ Core.prototype.freezeLayout = function (opt_bool) {
|
|
|
3122
3122
|
}
|
|
3123
3123
|
|
|
3124
3124
|
this._rowHeightSync = false;
|
|
3125
|
-
|
|
3126
|
-
|
|
3125
|
+
let s, section;
|
|
3126
|
+
let sectionCount = this._settings.length;
|
|
3127
3127
|
for (s = 0; s < sectionCount; s++) {
|
|
3128
3128
|
section = this._settings[s].getSection();
|
|
3129
3129
|
section.setFrozenLayout(this._frozenLayout);
|
|
@@ -3135,7 +3135,7 @@ Core.prototype.freezeLayout = function (opt_bool) {
|
|
|
3135
3135
|
this._disableEvent("widthChanged", false);
|
|
3136
3136
|
this._dispatch("widthChanged", {});
|
|
3137
3137
|
|
|
3138
|
-
|
|
3138
|
+
let viewChanged = this._syncRowHeights();
|
|
3139
3139
|
if(!viewChanged) { // Always update virtualizer
|
|
3140
3140
|
this._rowVirtualizer.update(true); // Force section activation
|
|
3141
3141
|
}
|
|
@@ -3220,8 +3220,8 @@ Core.prototype.toggleContentVerticalLines = function(forcedVal) {
|
|
|
3220
3220
|
* @return {Array.<string>}
|
|
3221
3221
|
*/
|
|
3222
3222
|
Core.prototype.getDataColumnMap = function () {
|
|
3223
|
-
|
|
3224
|
-
for (
|
|
3223
|
+
let dataMap = [];
|
|
3224
|
+
for (let i = this.getColumnCount(); --i >= 0; ) {
|
|
3225
3225
|
dataMap[i] = this.getDataColumnName(i);
|
|
3226
3226
|
}
|
|
3227
3227
|
return dataMap;
|
|
@@ -3231,7 +3231,7 @@ Core.prototype.getDataColumnMap = function () {
|
|
|
3231
3231
|
* @param {Array.<string>=} opt_dataMap index in the array will be matched with the display column
|
|
3232
3232
|
*/
|
|
3233
3233
|
Core.prototype.setDataColumnMap = function (opt_dataMap) {
|
|
3234
|
-
|
|
3234
|
+
let i, colDef;
|
|
3235
3235
|
if (opt_dataMap) {
|
|
3236
3236
|
for (i = opt_dataMap.length; --i >= 0; ) {
|
|
3237
3237
|
colDef = this._getColumnDef(i);
|
|
@@ -3251,8 +3251,8 @@ Core.prototype.setDataColumnMap = function (opt_dataMap) {
|
|
|
3251
3251
|
* @return {string}
|
|
3252
3252
|
*/
|
|
3253
3253
|
Core.prototype.getDataColumnName = function (colIndex) {
|
|
3254
|
-
|
|
3255
|
-
|
|
3254
|
+
let colDef = this._getColumnDef(colIndex);
|
|
3255
|
+
let dataColumnName = colDef["dataColumnName"];
|
|
3256
3256
|
return dataColumnName || "";
|
|
3257
3257
|
};
|
|
3258
3258
|
/** @public
|
|
@@ -3319,8 +3319,8 @@ Core.prototype.enableRowHighlighting = function (opt_enabled) {
|
|
|
3319
3319
|
|
|
3320
3320
|
if (this._rowHighlighting !== opt_enabled) {
|
|
3321
3321
|
this._rowHighlighting = opt_enabled;
|
|
3322
|
-
|
|
3323
|
-
for (
|
|
3322
|
+
let contentSections = this.getAllSections("content");
|
|
3323
|
+
for (let i = contentSections.length; --i >= 0; ) {
|
|
3324
3324
|
contentSections[i].enableRowHighlighting(this._rowHighlighting);
|
|
3325
3325
|
}
|
|
3326
3326
|
}
|
|
@@ -3332,9 +3332,9 @@ Core.prototype.enableRowHighlighting = function (opt_enabled) {
|
|
|
3332
3332
|
* @return {Element}
|
|
3333
3333
|
*/
|
|
3334
3334
|
Core.prototype._getTarget = function (obj) {
|
|
3335
|
-
|
|
3335
|
+
let targetEl = /** @type{Element} */(obj["target"]);
|
|
3336
3336
|
if(targetEl) { // The Given object is an Event object
|
|
3337
|
-
|
|
3337
|
+
let path = null;
|
|
3338
3338
|
if(!this._element.contains(targetEl)) {
|
|
3339
3339
|
if(obj["composedPath"]) { // Handle the case where grid is used in the Shadow Dom
|
|
3340
3340
|
path = /** @type{Array.<Element>} */(obj["composedPath"]());
|
|
@@ -3367,8 +3367,8 @@ Core.prototype.getRelativePosition = function (obj, context) {
|
|
|
3367
3367
|
return {};
|
|
3368
3368
|
}
|
|
3369
3369
|
|
|
3370
|
-
|
|
3371
|
-
|
|
3370
|
+
let ret_obj = context || {};
|
|
3371
|
+
let targetEl = this._getTarget(obj);
|
|
3372
3372
|
|
|
3373
3373
|
// Calculate object's x and y coordinates that are relative to the top left of this grid
|
|
3374
3374
|
if(obj["target"]) { // The Given object is an Event object
|
|
@@ -3390,18 +3390,18 @@ Core.prototype.getRelativePosition = function (obj, context) {
|
|
|
3390
3390
|
ret_obj["zoomFactor"] = this._zoomFactor;
|
|
3391
3391
|
|
|
3392
3392
|
// Find cell element
|
|
3393
|
-
|
|
3393
|
+
let cellElement = Util.closestElement(targetEl, "cell");
|
|
3394
3394
|
if(!cellElement) {
|
|
3395
3395
|
return ret_obj;
|
|
3396
3396
|
}
|
|
3397
3397
|
ret_obj["cellElement"] = cellElement;
|
|
3398
3398
|
|
|
3399
3399
|
// Find column element
|
|
3400
|
-
|
|
3400
|
+
let colElement = Util.closestElement(cellElement, "column");
|
|
3401
3401
|
ret_obj["columnElement"] = colElement;
|
|
3402
3402
|
|
|
3403
3403
|
// Find section element
|
|
3404
|
-
|
|
3404
|
+
let sectionElement = null;
|
|
3405
3405
|
if (colElement) {
|
|
3406
3406
|
// Column element may not be in the document (the column could be hidden)
|
|
3407
3407
|
sectionElement = Util.closestElement(colElement, "tr-lg");
|
|
@@ -3415,15 +3415,15 @@ Core.prototype.getRelativePosition = function (obj, context) {
|
|
|
3415
3415
|
}
|
|
3416
3416
|
ret_obj["sectionName"] = sectionElement["id"] || Util.closestElement(sectionElement, "tr-vlg")["id"];
|
|
3417
3417
|
|
|
3418
|
-
|
|
3418
|
+
let sectionSettings = this.getSectionSettings(ret_obj["sectionName"]);
|
|
3419
3419
|
if (!sectionSettings) {
|
|
3420
3420
|
return ret_obj; // Cannot find a section from the given id
|
|
3421
3421
|
}
|
|
3422
3422
|
sectionSettings.extendEventArg(ret_obj);
|
|
3423
3423
|
|
|
3424
3424
|
// Find column index
|
|
3425
|
-
|
|
3426
|
-
|
|
3425
|
+
let section = sectionSettings.getSection();
|
|
3426
|
+
let colIndex = section.getColumnIndex(colElement || cellElement);
|
|
3427
3427
|
if (colIndex < 0) {
|
|
3428
3428
|
return ret_obj; // The given columnElement does not resolve in any column index
|
|
3429
3429
|
}
|
|
@@ -3487,7 +3487,7 @@ Core.prototype.scrollToColumn = function (colIndex, leftOfView) {
|
|
|
3487
3487
|
return false;
|
|
3488
3488
|
}
|
|
3489
3489
|
|
|
3490
|
-
|
|
3490
|
+
let colCount = this._layoutX.getLaneCount();
|
|
3491
3491
|
if (colIndex <= 0) {
|
|
3492
3492
|
colIndex = 0;
|
|
3493
3493
|
} else if (colIndex >= colCount) {
|
|
@@ -3497,26 +3497,26 @@ Core.prototype.scrollToColumn = function (colIndex, leftOfView) {
|
|
|
3497
3497
|
return false;
|
|
3498
3498
|
}
|
|
3499
3499
|
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3500
|
+
let widthOffset = this._hScrollbarEnabled ? this._layoutX.getLaneStart(this._pinnedLeftColumnCount) : 0;
|
|
3501
|
+
let scrollLeft = this._hscrollbar.getScrollLeft();
|
|
3502
|
+
let viewLeft = scrollLeft + widthOffset;
|
|
3503
|
+
let viewWidth = this._hscrollbar.getWidth();
|
|
3504
|
+
let viewTopIndex = this._layoutX.hitTest(viewLeft);
|
|
3505
|
+
let laneLeft = this._layoutX.getLaneStart(colIndex);
|
|
3506
|
+
let laneSize = this._layoutX.getLaneSize(colIndex);
|
|
3507
3507
|
|
|
3508
3508
|
if (leftOfView || laneSize >= viewWidth || colIndex <= viewTopIndex) {
|
|
3509
|
-
|
|
3509
|
+
let toLeftOfView = laneLeft - widthOffset;
|
|
3510
3510
|
if(scrollLeft !== toLeftOfView) {
|
|
3511
3511
|
this._hscrollbar.setScrollLeft(toLeftOfView);
|
|
3512
3512
|
return true;
|
|
3513
3513
|
}
|
|
3514
3514
|
} else {
|
|
3515
|
-
|
|
3516
|
-
|
|
3515
|
+
let viewRight = viewLeft + viewWidth;
|
|
3516
|
+
let viewRightIndex = this._layoutX.hitTest(viewRight - 0.1);
|
|
3517
3517
|
if (colIndex >= viewRightIndex) {
|
|
3518
|
-
|
|
3519
|
-
|
|
3518
|
+
let laneRight = laneLeft + laneSize;
|
|
3519
|
+
let toEndOfView = scrollLeft + laneRight - viewRight; // Fit end of column into the view
|
|
3520
3520
|
|
|
3521
3521
|
this._hscrollbar.setScrollLeft(toEndOfView);
|
|
3522
3522
|
return true;
|
|
@@ -3567,13 +3567,13 @@ Core.prototype.getYScrollVal = function (sectionRef, rowIndex, topOfView) {
|
|
|
3567
3567
|
if(!this._updateScrollbar(this._vscrollbar)) {
|
|
3568
3568
|
return null;
|
|
3569
3569
|
}
|
|
3570
|
-
|
|
3570
|
+
let section = null;
|
|
3571
3571
|
if(sectionRef) {
|
|
3572
3572
|
section = this.getSection(sectionRef);
|
|
3573
3573
|
}
|
|
3574
3574
|
|
|
3575
|
-
|
|
3576
|
-
|
|
3575
|
+
let rowCount = this._layoutY.getLaneCount();
|
|
3576
|
+
let rowIndexOffset = (section) ? section.getRowOffset() : this._sectionStarts[this._startVScrollbarIndex];
|
|
3577
3577
|
|
|
3578
3578
|
if(rowIndexOffset) {
|
|
3579
3579
|
rowIndex += rowIndexOffset;
|
|
@@ -3581,12 +3581,12 @@ Core.prototype.getYScrollVal = function (sectionRef, rowIndex, topOfView) {
|
|
|
3581
3581
|
if (rowIndex <= 0) { rowIndex = 0; }
|
|
3582
3582
|
else if (rowIndex >= rowCount) { rowIndex = rowCount - 1; }
|
|
3583
3583
|
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3584
|
+
let heightOffset = this._layoutY.getLaneStart(rowIndexOffset);
|
|
3585
|
+
let scrollTop = this._vscrollbar.getScrollTop();
|
|
3586
|
+
let viewTop = scrollTop + heightOffset;
|
|
3587
|
+
let viewTopIndex = section ? section.getFirstIndexInView() : this._layoutY.hitTest(viewTop); // TODO: Make it work in zooming mode
|
|
3588
3588
|
|
|
3589
|
-
|
|
3589
|
+
let scrollIndex = -1;
|
|
3590
3590
|
if (topOfView) {
|
|
3591
3591
|
scrollIndex = rowIndex;
|
|
3592
3592
|
} else {
|
|
@@ -3596,11 +3596,11 @@ Core.prototype.getYScrollVal = function (sectionRef, rowIndex, topOfView) {
|
|
|
3596
3596
|
scrollIndex = 0;
|
|
3597
3597
|
}
|
|
3598
3598
|
} else { // Scroll down
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3599
|
+
let viewHeight = this._vscrollbar.getHeight();
|
|
3600
|
+
let viewBottom = viewTop + viewHeight;
|
|
3601
|
+
let viewBottomIndex = section ? section.getLastIndexInView() : this._layoutY.hitTest(viewBottom - 0.1);
|
|
3602
3602
|
if (rowIndex >= viewBottomIndex) {
|
|
3603
|
-
|
|
3603
|
+
let viewIndexSize = viewBottomIndex - viewTopIndex;
|
|
3604
3604
|
scrollIndex = rowIndex - viewIndexSize + 3;
|
|
3605
3605
|
if(scrollIndex < 0) {
|
|
3606
3606
|
scrollIndex = 0;
|
|
@@ -3618,7 +3618,7 @@ Core.prototype.getYScrollVal = function (sectionRef, rowIndex, topOfView) {
|
|
|
3618
3618
|
* @param {boolean=} topOfView=false. If true, Make to specified row at the top of the view.
|
|
3619
3619
|
*/
|
|
3620
3620
|
Core.prototype.scrollToRow = function (sectionRef, rowIndex, topOfView) {
|
|
3621
|
-
|
|
3621
|
+
let scrollVal = this.getYScrollVal(sectionRef, rowIndex, topOfView);
|
|
3622
3622
|
if(scrollVal !== null) {
|
|
3623
3623
|
this._vscrollbar.setScrollTop(scrollVal);
|
|
3624
3624
|
}
|
|
@@ -3631,29 +3631,29 @@ Core.prototype.getVScrollView = function () {
|
|
|
3631
3631
|
return null;
|
|
3632
3632
|
}
|
|
3633
3633
|
|
|
3634
|
-
|
|
3634
|
+
let rowCount = this._layoutY.getLaneCount();
|
|
3635
3635
|
if (rowCount === 0) { return null; }
|
|
3636
3636
|
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3637
|
+
let rowIndexOffset = this._sectionStarts[this._startVScrollbarIndex];
|
|
3638
|
+
let heightOffset = this._layoutY.getLaneStart(rowIndexOffset);
|
|
3639
|
+
let viewTop = this._vscrollbar.getScrollTop() + heightOffset;
|
|
3640
|
+
let viewHeight = this._vscrollbar.getHeight();
|
|
3641
|
+
let viewBottom = viewTop + viewHeight;
|
|
3642
|
+
let topRowIndex = this._layoutY.hitTest(viewTop);
|
|
3643
|
+
let bottomRowIndex = this._layoutY.hitTest(viewBottom - 0.1);
|
|
3644
3644
|
|
|
3645
|
-
|
|
3646
|
-
|
|
3645
|
+
let laneTop = this._layoutY.getLaneStart(topRowIndex);
|
|
3646
|
+
let laneBottom = this._layoutY.getLaneEnd(bottomRowIndex);
|
|
3647
3647
|
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3648
|
+
let prevAnchor = viewTop - viewHeight;
|
|
3649
|
+
let prevPage = (prevAnchor <= heightOffset) ? rowIndexOffset : this._layoutY.hitTest(prevAnchor) + 1;
|
|
3650
|
+
let nextAnchor = viewBottom + viewHeight;
|
|
3651
|
+
let trackSize = this._layoutY.getTrackSize();
|
|
3652
|
+
let nextPage = (nextAnchor >= trackSize) ? rowCount - 1 : this._layoutY.hitTest(nextAnchor - 0.1) - 1;
|
|
3653
3653
|
|
|
3654
3654
|
topRowIndex -= rowIndexOffset;
|
|
3655
3655
|
bottomRowIndex -= rowIndexOffset;
|
|
3656
|
-
|
|
3656
|
+
let obj = {};
|
|
3657
3657
|
obj["viewTop"] = viewTop - heightOffset;
|
|
3658
3658
|
obj["viewBottom"] = viewBottom - heightOffset;
|
|
3659
3659
|
obj["topRowIndex"] = topRowIndex;
|
|
@@ -3756,9 +3756,9 @@ Core.prototype.isRowVirtualizationEnabled = function () {
|
|
|
3756
3756
|
Core.prototype.enableColumnVirtualization = function (opt_enabled) {
|
|
3757
3757
|
this._colVirtualizer.enable(opt_enabled);
|
|
3758
3758
|
|
|
3759
|
-
|
|
3760
|
-
for (
|
|
3761
|
-
|
|
3759
|
+
let colVir = this._colVirtualizer.isEnabled();
|
|
3760
|
+
for (let i = this._settings.length; --i >= 0; ) {
|
|
3761
|
+
let sectionSettings = this._settings[i];
|
|
3762
3762
|
sectionSettings.enableColumnVirtualization(colVir);
|
|
3763
3763
|
}
|
|
3764
3764
|
};
|
|
@@ -3795,7 +3795,7 @@ Core.prototype.synchronizeVScrollbar = function (subGrid) {
|
|
|
3795
3795
|
subGrid.unlisten("mousemove", subGrid._onMouseMove);
|
|
3796
3796
|
subGrid.listen("mousemove", this._onMouseMove);
|
|
3797
3797
|
|
|
3798
|
-
|
|
3798
|
+
let vscrollbar = subGrid.getVScrollbar();
|
|
3799
3799
|
vscrollbar._mainScrollbar = this._vscrollbar; // HACK
|
|
3800
3800
|
|
|
3801
3801
|
vscrollbar.setStyle("visibility", "hidden");
|
|
@@ -3815,7 +3815,7 @@ Core.prototype.synchronizeHScrollbar = function (subGrid) {
|
|
|
3815
3815
|
subGrid.unlisten("mousemove", subGrid._onMouseMove);
|
|
3816
3816
|
subGrid.listen("mousemove", this._onMouseMove);
|
|
3817
3817
|
|
|
3818
|
-
|
|
3818
|
+
let hscrollbar = subGrid.getHScrollbar();
|
|
3819
3819
|
hscrollbar._mainScrollbar = this._hscrollbar; // HACK
|
|
3820
3820
|
|
|
3821
3821
|
hscrollbar.setStyle("visibility", "hidden");
|
|
@@ -3841,7 +3841,7 @@ Core.prototype.synchronizeHScrollbar = function (subGrid) {
|
|
|
3841
3841
|
* @fires Core#afterContentBinding
|
|
3842
3842
|
*/
|
|
3843
3843
|
Core.prototype.updateRowData = function (sectionRef, fromRowIndex, lastRowIndex, userParam) {
|
|
3844
|
-
|
|
3844
|
+
let ss = this.getSectionSettings(sectionRef || "content");
|
|
3845
3845
|
if (ss) {
|
|
3846
3846
|
ss.updateRowData(fromRowIndex, lastRowIndex, userParam);
|
|
3847
3847
|
}
|
|
@@ -3850,8 +3850,8 @@ Core.prototype.updateRowData = function (sectionRef, fromRowIndex, lastRowIndex,
|
|
|
3850
3850
|
* @public
|
|
3851
3851
|
*/
|
|
3852
3852
|
Core.prototype.rerender = function () {
|
|
3853
|
-
|
|
3854
|
-
for (
|
|
3853
|
+
let sectionCount = this._settings.length;
|
|
3854
|
+
for (let s = 0; s < sectionCount; s++) { // for each section
|
|
3855
3855
|
this._settings[s].rerender();
|
|
3856
3856
|
}
|
|
3857
3857
|
};
|
|
@@ -3882,7 +3882,7 @@ Core.prototype.deactivateRendering = function(disabled) {
|
|
|
3882
3882
|
if (disabled == this._noBinding) return;
|
|
3883
3883
|
|
|
3884
3884
|
this._noBinding = disabled;
|
|
3885
|
-
|
|
3885
|
+
let contentSection = this.getSectionSettings("content");
|
|
3886
3886
|
if (!contentSection) return;
|
|
3887
3887
|
|
|
3888
3888
|
contentSection.disableDataBinding(disabled);
|
|
@@ -3912,10 +3912,10 @@ Core.prototype.disableLazyRendering = function(opt_bool) {
|
|
|
3912
3912
|
* @return {*} Returns undefined if not success
|
|
3913
3913
|
*/
|
|
3914
3914
|
Core.prototype.getData = function (sectionRef, colRef, rowRef) {
|
|
3915
|
-
|
|
3915
|
+
let sectionSettings = this.getSectionSettings(sectionRef);
|
|
3916
3916
|
if (!sectionSettings) { return null; }
|
|
3917
3917
|
|
|
3918
|
-
|
|
3918
|
+
let colName = this._toDataColumnName(colRef);
|
|
3919
3919
|
|
|
3920
3920
|
return sectionSettings.getData(colName, rowRef);
|
|
3921
3921
|
};
|
|
@@ -3927,9 +3927,9 @@ Core.prototype.getData = function (sectionRef, colRef, rowRef) {
|
|
|
3927
3927
|
* @return {boolean} True for successful data setting
|
|
3928
3928
|
*/
|
|
3929
3929
|
Core.prototype.setData = function (sectionRef, colRef, rowRef, data) {
|
|
3930
|
-
|
|
3930
|
+
let sectionSettings = this.getSectionSettings(sectionRef);
|
|
3931
3931
|
if (sectionSettings && sectionSettings.isDataBindable()) {
|
|
3932
|
-
|
|
3932
|
+
let colName = this._toDataColumnName(colRef);
|
|
3933
3933
|
return sectionSettings.setData(colName, rowRef, data);
|
|
3934
3934
|
}
|
|
3935
3935
|
return false;
|
|
@@ -3941,7 +3941,7 @@ Core.prototype.setData = function (sectionRef, colRef, rowRef, data) {
|
|
|
3941
3941
|
* @return {boolean} True for successful data setting
|
|
3942
3942
|
*/
|
|
3943
3943
|
Core.prototype.removeRowData = function (sectionRef, rowRef) {
|
|
3944
|
-
|
|
3944
|
+
let sectionSettings = this.getSectionSettings(sectionRef);
|
|
3945
3945
|
if (sectionSettings && sectionSettings.isDataBindable()) {
|
|
3946
3946
|
return sectionSettings.removeRowData(rowRef);
|
|
3947
3947
|
}
|
|
@@ -3953,8 +3953,8 @@ Core.prototype.setHidingMethod = function (method) {
|
|
|
3953
3953
|
if(!method) { method = ""; }
|
|
3954
3954
|
if(this._hidingMethod !== method) {
|
|
3955
3955
|
this._hidingMethod = method;
|
|
3956
|
-
|
|
3957
|
-
for(
|
|
3956
|
+
let sections = this.getAllSections();
|
|
3957
|
+
for(let i = sections.length; --i >= 0;) {
|
|
3958
3958
|
sections[i].setHidingMethod(method);
|
|
3959
3959
|
}
|
|
3960
3960
|
}
|
|
@@ -3982,7 +3982,7 @@ Core.prototype.setColumnVisibility = function (colIndex, bool, flag) {
|
|
|
3982
3982
|
this.requestRowRefresh();
|
|
3983
3983
|
}
|
|
3984
3984
|
if (this._hasListener("columnVisibilityChanged")) {
|
|
3985
|
-
|
|
3985
|
+
let e = {};
|
|
3986
3986
|
e["colIndex"] = colIndex;
|
|
3987
3987
|
e["hidden"] = !bool;
|
|
3988
3988
|
this._dispatch("columnVisibilityChanged", e);
|
|
@@ -4009,7 +4009,7 @@ Core.prototype.getColumnVisibility = function (colIndex, flag) {
|
|
|
4009
4009
|
Core.prototype.reserveRightSpace = function (size) {
|
|
4010
4010
|
if(this._reservedSpace !== size) {
|
|
4011
4011
|
this._reservedSpace = size;
|
|
4012
|
-
for(
|
|
4012
|
+
for(let i = this._settings.length; --i >= 0;) {
|
|
4013
4013
|
this._settings[i].getSection().reserveRightSpace(size);
|
|
4014
4014
|
}
|
|
4015
4015
|
this._onColumnCountChanged(); // Activate horizontal scrollbar and column virtualization
|
|
@@ -4036,11 +4036,11 @@ Core.prototype.getHiddenInput = function () {
|
|
|
4036
4036
|
* @see {@link http://help.dottoro.com/ljqmdirr.php}
|
|
4037
4037
|
*/
|
|
4038
4038
|
Core.prototype.focus = function () {
|
|
4039
|
-
|
|
4040
|
-
|
|
4039
|
+
let elem = this._hiddenInput;
|
|
4040
|
+
let activeElem = document.activeElement;
|
|
4041
4041
|
if(elem && elem !== activeElem) {
|
|
4042
|
-
|
|
4043
|
-
|
|
4042
|
+
let x = window.pageXOffset;
|
|
4043
|
+
let y = window.pageYOffset;
|
|
4044
4044
|
if(elem["setActive"]) { // Non-standard IE specific method
|
|
4045
4045
|
try { // MON-909
|
|
4046
4046
|
elem["setActive"]();
|
|
@@ -4121,7 +4121,7 @@ Core.prototype.hasHiddenRow = function () {
|
|
|
4121
4121
|
* @param {Array=} columns
|
|
4122
4122
|
*/
|
|
4123
4123
|
Core.prototype.initSimpleTable = function (columns) {
|
|
4124
|
-
|
|
4124
|
+
let colCount = 0;
|
|
4125
4125
|
if(!columns && !this.getColumnCount()) {
|
|
4126
4126
|
columns = ["Default"]; // Row cannot be added unless there is at least 1 column
|
|
4127
4127
|
}
|
|
@@ -4132,20 +4132,20 @@ Core.prototype.initSimpleTable = function (columns) {
|
|
|
4132
4132
|
this.setDataColumnMap(columns);
|
|
4133
4133
|
}
|
|
4134
4134
|
|
|
4135
|
-
|
|
4135
|
+
let titleSect = this.addSection("title");
|
|
4136
4136
|
titleSect.addRow(1);
|
|
4137
4137
|
|
|
4138
4138
|
if(!this._renderingHandler) { // Render title if there is no default rendering
|
|
4139
|
-
for(
|
|
4139
|
+
for(let c = 0; c < colCount; ++c) {
|
|
4140
4140
|
titleSect.setCellContent(c, 0, columns[c]);
|
|
4141
4141
|
}
|
|
4142
4142
|
}
|
|
4143
4143
|
|
|
4144
4144
|
this.addSection("content");
|
|
4145
|
-
|
|
4145
|
+
let titleSectionSetting = this.getSectionSettings("title");
|
|
4146
4146
|
titleSectionSetting.disableDataBinding();
|
|
4147
4147
|
|
|
4148
|
-
|
|
4148
|
+
let contentSectionSetting = this.getSectionSettings("content");
|
|
4149
4149
|
contentSectionSetting.setAutoSyncRowCount(true);
|
|
4150
4150
|
contentSectionSetting.setParent(titleSectionSetting);
|
|
4151
4151
|
|
|
@@ -4165,7 +4165,7 @@ Core._defaultDataBinding = function(e) {
|
|
|
4165
4165
|
* @param {boolean=} selected
|
|
4166
4166
|
*/
|
|
4167
4167
|
Core.prototype.selectColumn = function (colIndex, selected) {
|
|
4168
|
-
for (
|
|
4168
|
+
for (let i = this._settings.length; --i >= 0; ) {
|
|
4169
4169
|
this._settings[i].getSection().selectColumn(colIndex, selected);
|
|
4170
4170
|
}
|
|
4171
4171
|
this._updateColumnBounds();
|
|
@@ -4175,7 +4175,7 @@ Core.prototype.selectColumn = function (colIndex, selected) {
|
|
|
4175
4175
|
* @return {boolean}
|
|
4176
4176
|
*/
|
|
4177
4177
|
Core.prototype.isSelectedColumn = function (colIndex) {
|
|
4178
|
-
|
|
4178
|
+
let first = this._settings[0] || null;
|
|
4179
4179
|
if(first) {
|
|
4180
4180
|
return first.getSection().isSelectedColumn(colIndex);
|
|
4181
4181
|
}
|
|
@@ -4189,17 +4189,17 @@ Core.prototype._updateColumnBounds = function () {
|
|
|
4189
4189
|
return;
|
|
4190
4190
|
}
|
|
4191
4191
|
|
|
4192
|
-
|
|
4192
|
+
let sectCount = this._settings.length;
|
|
4193
4193
|
if(!sectCount) {
|
|
4194
4194
|
return;
|
|
4195
4195
|
}
|
|
4196
4196
|
|
|
4197
4197
|
// Collecting column selection and selection ranges
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4198
|
+
let selRanges = [];
|
|
4199
|
+
let pair = null;
|
|
4200
|
+
let colCount = this.getColumnCount();
|
|
4201
|
+
let selIndices = [];
|
|
4202
|
+
let i;
|
|
4203
4203
|
for(i = 0; i < colCount; i++) {
|
|
4204
4204
|
if(this.isSelectedColumn(i)) {
|
|
4205
4205
|
selIndices.push(i);
|
|
@@ -4218,22 +4218,22 @@ Core.prototype._updateColumnBounds = function () {
|
|
|
4218
4218
|
pair = null;
|
|
4219
4219
|
}
|
|
4220
4220
|
|
|
4221
|
-
|
|
4221
|
+
let arg = {
|
|
4222
4222
|
"selectedColumns": selIndices,
|
|
4223
4223
|
"selectionRanges": selRanges
|
|
4224
4224
|
};
|
|
4225
4225
|
this._dispatch("beforeColumnBoundUpdate", arg);
|
|
4226
4226
|
|
|
4227
4227
|
// Calculate position from ranges
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4228
|
+
let rangeCount = selRanges.length;
|
|
4229
|
+
let posAry = [];
|
|
4230
|
+
let noBorderAry = [];
|
|
4231
|
+
let topSectionSettings = this._settings[0];
|
|
4232
|
+
let section = topSectionSettings.getSection();
|
|
4233
4233
|
for(i = 0; i < rangeCount; ++i) {
|
|
4234
4234
|
pair = selRanges[i];
|
|
4235
|
-
|
|
4236
|
-
|
|
4235
|
+
let positions = [0, 0];
|
|
4236
|
+
let noBorders = [false, false];
|
|
4237
4237
|
section.calculateColumnBounds(pair[0], pair[1], positions, noBorders);
|
|
4238
4238
|
if(positions[0] < positions[1]) {
|
|
4239
4239
|
posAry.push(positions);
|
|
@@ -4242,8 +4242,8 @@ Core.prototype._updateColumnBounds = function () {
|
|
|
4242
4242
|
}
|
|
4243
4243
|
|
|
4244
4244
|
// Render column bounds
|
|
4245
|
-
|
|
4246
|
-
|
|
4245
|
+
let topPx = 0;
|
|
4246
|
+
let topBoundIdx = -1;
|
|
4247
4247
|
if(arg["topBoundRowIndex"] != null) {
|
|
4248
4248
|
topBoundIdx = +arg["topBoundRowIndex"];
|
|
4249
4249
|
}
|
|
@@ -4259,13 +4259,13 @@ Core.prototype._updateColumnBounds = function () {
|
|
|
4259
4259
|
/* @private
|
|
4260
4260
|
*/
|
|
4261
4261
|
Core.prototype._updateColumnSeparators = function() {
|
|
4262
|
-
|
|
4262
|
+
let sectCount = this._settings.length;
|
|
4263
4263
|
if(!sectCount) {
|
|
4264
4264
|
return;
|
|
4265
4265
|
}
|
|
4266
4266
|
|
|
4267
|
-
for(
|
|
4268
|
-
|
|
4267
|
+
for(let i = 0; i < sectCount; i++) {
|
|
4268
|
+
let section = this._settings[i].getSection();
|
|
4269
4269
|
if (section) {
|
|
4270
4270
|
section.updateColumnSeparators();
|
|
4271
4271
|
}
|
|
@@ -4278,23 +4278,23 @@ Core.prototype._updateColumnSeparators = function() {
|
|
|
4278
4278
|
* @return {Object}
|
|
4279
4279
|
*/
|
|
4280
4280
|
Core.prototype.getColumnRect = function (startColIndex, endColIndex) {
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4281
|
+
let gridWidth = this.getElement().clientWidth;
|
|
4282
|
+
let scrollViewSize = gridWidth;
|
|
4283
|
+
let hscrollbar = this._hscrollbar;
|
|
4284
4284
|
if (hscrollbar.isActive()) {
|
|
4285
4285
|
scrollViewSize = hscrollbar.getTrackSize();
|
|
4286
4286
|
}
|
|
4287
4287
|
|
|
4288
|
-
|
|
4289
|
-
|
|
4288
|
+
let left = 0;
|
|
4289
|
+
let width = 0;
|
|
4290
4290
|
if (this._settings.length) {
|
|
4291
|
-
|
|
4292
|
-
|
|
4291
|
+
let section = this._settings[0].getSection();
|
|
4292
|
+
let positions = [0, 0];
|
|
4293
4293
|
section.calculateColumnBounds(startColIndex, endColIndex, positions, []);
|
|
4294
4294
|
left = positions[0];
|
|
4295
4295
|
width = positions[1] - left;
|
|
4296
4296
|
}
|
|
4297
|
-
|
|
4297
|
+
let rect = {
|
|
4298
4298
|
top: 0, // TODO: Support column grouping
|
|
4299
4299
|
left: left,
|
|
4300
4300
|
width: width,
|
|
@@ -4313,27 +4313,27 @@ Core.prototype.getColumnRect = function (startColIndex, endColIndex) {
|
|
|
4313
4313
|
* @return {Object}
|
|
4314
4314
|
*/
|
|
4315
4315
|
Core.prototype.getRowRect = function (startRowIndex, endRowIndex) {
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4316
|
+
let contentWidth = this._layoutX.getTrackSize();
|
|
4317
|
+
let gridElem = this.getElement();
|
|
4318
|
+
let gridWidth = gridElem.clientWidth;
|
|
4319
4319
|
contentWidth = contentWidth < gridWidth ? contentWidth : gridWidth;
|
|
4320
4320
|
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4321
|
+
let section = this.getSection("content");
|
|
4322
|
+
let rowOffset = section ? section.getRowOffset() : 1;
|
|
4323
|
+
let layoutY = this._layoutY;
|
|
4324
|
+
let sectionOffsetPx = layoutY.getLaneStart(rowOffset);
|
|
4325
4325
|
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4326
|
+
let scrollTop = 0;
|
|
4327
|
+
let scrollViewSize = section.getHeight();
|
|
4328
|
+
let vscrollbar = this._vscrollbar;
|
|
4329
4329
|
if (vscrollbar.isActive()) {
|
|
4330
4330
|
scrollTop = vscrollbar.getScrollTop();
|
|
4331
4331
|
scrollViewSize = vscrollbar.getTrackSize();
|
|
4332
4332
|
}
|
|
4333
|
-
|
|
4333
|
+
let scrollViewBottom = scrollViewSize + sectionOffsetPx;
|
|
4334
4334
|
|
|
4335
|
-
|
|
4336
|
-
|
|
4335
|
+
let topPx = layoutY.getLaneStart(startRowIndex + rowOffset) - scrollTop;
|
|
4336
|
+
let bottomPx = layoutY.getLaneEnd(endRowIndex + rowOffset) - scrollTop;
|
|
4337
4337
|
if (topPx < sectionOffsetPx) {
|
|
4338
4338
|
topPx = sectionOffsetPx;
|
|
4339
4339
|
} else if (topPx > scrollViewBottom) {
|
|
@@ -4349,7 +4349,7 @@ Core.prototype.getRowRect = function (startRowIndex, endRowIndex) {
|
|
|
4349
4349
|
topPx -= sectionOffsetPx;
|
|
4350
4350
|
bottomPx -= sectionOffsetPx;
|
|
4351
4351
|
|
|
4352
|
-
|
|
4352
|
+
let rect = {
|
|
4353
4353
|
top: topPx,
|
|
4354
4354
|
left: 0,
|
|
4355
4355
|
width: contentWidth,
|
|
@@ -4368,15 +4368,15 @@ Core.prototype.normalizeConfig = function (configObj) {
|
|
|
4368
4368
|
if(!configObj) {
|
|
4369
4369
|
configObj = {};
|
|
4370
4370
|
}
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4371
|
+
let columns = configObj["columns"];
|
|
4372
|
+
let colCount = columns ? columns.length : 0;
|
|
4373
|
+
let i, column;
|
|
4374
4374
|
|
|
4375
|
-
|
|
4375
|
+
let freezingIndex = configObj["columnFreezing"];
|
|
4376
4376
|
if(freezingIndex == null) {
|
|
4377
4377
|
freezingIndex = configObj["freezeColumn"];
|
|
4378
4378
|
}
|
|
4379
|
-
|
|
4379
|
+
let pinnedRightColumns = configObj["pinnedRightColumns"] || configObj["frozenRightColumns"];
|
|
4380
4380
|
if (pinnedRightColumns) {
|
|
4381
4381
|
delete configObj["pinnedRightColumns"];
|
|
4382
4382
|
delete configObj["frozenRightColumns"];
|
|
@@ -4421,7 +4421,7 @@ Core.prototype.setColumnGrouping = function (groupDefs) {
|
|
|
4421
4421
|
*/
|
|
4422
4422
|
Core.prototype.getColumnGroupParentId = function (colRef) {
|
|
4423
4423
|
if(this._groupDefs) {
|
|
4424
|
-
|
|
4424
|
+
let colId = (typeof colRef === "number") ? this.getColumnId(colRef) : colRef;
|
|
4425
4425
|
return this._groupDefs.getParentId(colId);
|
|
4426
4426
|
}
|
|
4427
4427
|
return "";
|
|
@@ -4433,7 +4433,7 @@ Core.prototype.getColumnGroupParentId = function (colRef) {
|
|
|
4433
4433
|
*/
|
|
4434
4434
|
Core.prototype.getColumnGroupChildIds = function (groupId) {
|
|
4435
4435
|
if(this._groupDefs) {
|
|
4436
|
-
|
|
4436
|
+
let ary = this._groupDefs.getLeafDescendants(groupId);
|
|
4437
4437
|
if(ary && ary.length > 0) {
|
|
4438
4438
|
return ary;
|
|
4439
4439
|
}
|
|
@@ -4451,16 +4451,16 @@ Core.prototype.getColumnGroupChildIds = function (groupId) {
|
|
|
4451
4451
|
* core.getValidColumnList(["c1","c2","c5"],{ "c2":true, "c5":true }); // Get list of valid columns from specific mapping
|
|
4452
4452
|
*/
|
|
4453
4453
|
Core.prototype.getValidColumnList = function (colIds, columnMap) {
|
|
4454
|
-
|
|
4454
|
+
let colList = [];
|
|
4455
4455
|
if(!colIds){
|
|
4456
4456
|
return colList;
|
|
4457
4457
|
}
|
|
4458
4458
|
if(!columnMap){
|
|
4459
4459
|
columnMap = this.createColumnMap(colIds);
|
|
4460
4460
|
}
|
|
4461
|
-
|
|
4462
|
-
for(
|
|
4463
|
-
|
|
4461
|
+
let colCount = this.getColumnCount();
|
|
4462
|
+
for(let c = 0; c < colCount; ++c) {
|
|
4463
|
+
let id = this._getColumnDef(c)["id"];
|
|
4464
4464
|
if(columnMap[id] != null){
|
|
4465
4465
|
colList.push({"index": c, "id": id});
|
|
4466
4466
|
}
|
|
@@ -4477,10 +4477,10 @@ Core.prototype.createColumnMap = function (colRefs) {
|
|
|
4477
4477
|
if(!colRefs){
|
|
4478
4478
|
colRefs = this.getColumnIds();
|
|
4479
4479
|
}
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
for(
|
|
4483
|
-
|
|
4480
|
+
let mappingObj = {};
|
|
4481
|
+
let count = colRefs.length;
|
|
4482
|
+
for(let i = 0; i < count; i++){
|
|
4483
|
+
let colId = colRefs[i];
|
|
4484
4484
|
if(typeof colId === "number"){
|
|
4485
4485
|
colId = this.getColumnId(colId);
|
|
4486
4486
|
}
|
|
@@ -4539,7 +4539,7 @@ Core.prototype.stopBatch = function (batchType) {
|
|
|
4539
4539
|
* @param {!Object} eventArg
|
|
4540
4540
|
*/
|
|
4541
4541
|
Core.prototype._dispatchColumnEvent = function (type, eventArg) {
|
|
4542
|
-
|
|
4542
|
+
let batches = this._batches;
|
|
4543
4543
|
if(batches){
|
|
4544
4544
|
eventArg["batches"] = batches;
|
|
4545
4545
|
}
|
|
@@ -4568,9 +4568,9 @@ Core.prototype._dispatchRowPositionChanged = function () {
|
|
|
4568
4568
|
* @return {!Array.<ILayoutGrid>}
|
|
4569
4569
|
*/
|
|
4570
4570
|
Core.prototype._getAllSections = function () {
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
for (
|
|
4571
|
+
let sections = [];
|
|
4572
|
+
let sectionCount = this._settings.length;
|
|
4573
|
+
for (let i = 0; i < sectionCount; i++) {
|
|
4574
4574
|
sections.push(this._settings[i].getSection());
|
|
4575
4575
|
}
|
|
4576
4576
|
return sections;
|
|
@@ -4582,13 +4582,13 @@ Core.prototype._getAllSections = function () {
|
|
|
4582
4582
|
* @return {SectionSettings}
|
|
4583
4583
|
*/
|
|
4584
4584
|
Core.prototype._getNextSection = function (increment, identifier, opt_type) {
|
|
4585
|
-
|
|
4585
|
+
let nextAt = this.getSectionIndex(identifier) + increment;
|
|
4586
4586
|
if(opt_type == null) { return this.getSectionSettings(nextAt); }
|
|
4587
4587
|
|
|
4588
4588
|
opt_type = this._toSectionType(opt_type);
|
|
4589
|
-
|
|
4589
|
+
let count = this._settings.length;
|
|
4590
4590
|
while (nextAt >= 0 && nextAt < count) {
|
|
4591
|
-
|
|
4591
|
+
let sectionSettings = this._settings[nextAt];
|
|
4592
4592
|
if (opt_type === sectionSettings.getType()) {
|
|
4593
4593
|
return /**@type{SectionSettings}*/(sectionSettings);
|
|
4594
4594
|
}
|
|
@@ -4605,7 +4605,7 @@ Core.prototype._toSectionType = function (val) {
|
|
|
4605
4605
|
if(Core._sectionType[/** @type{string} */(val)]) { return /** @type{string} */(val); }
|
|
4606
4606
|
|
|
4607
4607
|
if (Util.isString(val)) {
|
|
4608
|
-
|
|
4608
|
+
let lowerCaseStr = val.charAt(0).toLowerCase();
|
|
4609
4609
|
switch (lowerCaseStr) {
|
|
4610
4610
|
case "t": return "title";
|
|
4611
4611
|
case "h": return "header";
|
|
@@ -4624,7 +4624,7 @@ Core.prototype._toSectionType = function (val) {
|
|
|
4624
4624
|
*/
|
|
4625
4625
|
Core.prototype._newSection = function (opt_type, sectionName) {
|
|
4626
4626
|
if(sectionName) {
|
|
4627
|
-
for(
|
|
4627
|
+
for(let i = this._settings.length; --i >= 0;) {
|
|
4628
4628
|
if (this._settings[i].getId() === sectionName) { // check if section name isn't already used
|
|
4629
4629
|
return null;
|
|
4630
4630
|
}
|
|
@@ -4632,20 +4632,20 @@ Core.prototype._newSection = function (opt_type, sectionName) {
|
|
|
4632
4632
|
}
|
|
4633
4633
|
|
|
4634
4634
|
opt_type = this._toSectionType(opt_type);
|
|
4635
|
-
|
|
4635
|
+
let sectionOpt = {
|
|
4636
4636
|
"horizontalScrollbar": this._hscrollbar
|
|
4637
4637
|
};
|
|
4638
|
-
|
|
4638
|
+
let section = (opt_type === "content") ? new VirtualizedLayoutGrid(sectionOpt) : new LayoutGrid(sectionOpt);
|
|
4639
4639
|
section._setContext(this);
|
|
4640
4640
|
|
|
4641
|
-
|
|
4641
|
+
let sectionSettings = new SectionSettings(section);
|
|
4642
4642
|
sectionSettings.setId(sectionName);
|
|
4643
4643
|
sectionSettings.setType(opt_type);
|
|
4644
4644
|
|
|
4645
4645
|
sectionSettings.listen("dataChanged", this._onSectionDataChanged);
|
|
4646
4646
|
sectionSettings.listen("rowAvailable", this._onRowAvailable);
|
|
4647
4647
|
|
|
4648
|
-
|
|
4648
|
+
let rowHighlighting = (opt_type === "content") ? this._rowHighlighting : false;
|
|
4649
4649
|
section.enableRowHighlighting(rowHighlighting);
|
|
4650
4650
|
section.enableShading(false); // No alternate shading
|
|
4651
4651
|
section.setHidingMethod(this._hidingMethod);
|
|
@@ -4669,12 +4669,12 @@ Core.prototype._newSection = function (opt_type, sectionName) {
|
|
|
4669
4669
|
* @param {ILayoutGrid} section
|
|
4670
4670
|
*/
|
|
4671
4671
|
Core.prototype._putToLast = function(section) {
|
|
4672
|
-
|
|
4672
|
+
let sectionCount = this._settings.length;
|
|
4673
4673
|
if (sectionCount === 0) {
|
|
4674
4674
|
section.setParent(this._element, true);
|
|
4675
4675
|
} else {
|
|
4676
|
-
|
|
4677
|
-
|
|
4676
|
+
let lastGrid = this.getLastSection();
|
|
4677
|
+
let nextSibling = lastGrid.getElement().nextSibling;
|
|
4678
4678
|
if (nextSibling !== null) {
|
|
4679
4679
|
section.insertBefore(nextSibling);
|
|
4680
4680
|
} else {
|
|
@@ -4688,19 +4688,19 @@ Core.prototype._putToLast = function(section) {
|
|
|
4688
4688
|
* @param {string} sectionType
|
|
4689
4689
|
*/
|
|
4690
4690
|
Core.prototype._syncStyleToSectionColumns = function (section, sectionType) {
|
|
4691
|
-
|
|
4692
|
-
for (
|
|
4693
|
-
|
|
4694
|
-
|
|
4691
|
+
let name;
|
|
4692
|
+
for (let i = this._columnDefs.length; --i >= 0; ) {
|
|
4693
|
+
let colDef = this._getColumnDef(i);
|
|
4694
|
+
let styles = colDef["styles"];
|
|
4695
4695
|
for (name in styles) {
|
|
4696
4696
|
section.setColumnStyle(i, name, styles[name]);
|
|
4697
4697
|
}
|
|
4698
|
-
|
|
4698
|
+
let classes = colDef["classes"];
|
|
4699
4699
|
for (name in classes) {
|
|
4700
4700
|
section.enableColumnClass(i, name, true);
|
|
4701
4701
|
}
|
|
4702
4702
|
|
|
4703
|
-
|
|
4703
|
+
let sectionDef = colDef[sectionType];
|
|
4704
4704
|
if(sectionDef) {
|
|
4705
4705
|
styles = sectionDef["styles"];
|
|
4706
4706
|
for (name in styles) {
|
|
@@ -4717,8 +4717,8 @@ Core.prototype._syncStyleToSectionColumns = function (section, sectionType) {
|
|
|
4717
4717
|
* @return {boolean}
|
|
4718
4718
|
*/
|
|
4719
4719
|
Core.prototype._syncRowHeights = function () {
|
|
4720
|
-
|
|
4721
|
-
for (
|
|
4720
|
+
let sectionCount = this._settings.length;
|
|
4721
|
+
for (let s = 0; s < sectionCount; ++s) {
|
|
4722
4722
|
this._syncSectionRowHeights(this._settings[s].getSection());
|
|
4723
4723
|
}
|
|
4724
4724
|
if (!this._frozenLayout) {
|
|
@@ -4743,25 +4743,25 @@ Core.prototype._syncSectionRowHeights = function (section) {
|
|
|
4743
4743
|
* @return {boolean} True if there is any changed
|
|
4744
4744
|
*/
|
|
4745
4745
|
Core.prototype._setColumnWidth = function (colIndex, px, opt_scalable) {
|
|
4746
|
-
|
|
4747
|
-
|
|
4746
|
+
let dirty = false;
|
|
4747
|
+
let layoutX = this._layoutX;
|
|
4748
4748
|
if(opt_scalable != null) {
|
|
4749
4749
|
dirty = layoutX.setLaneScalability(colIndex, opt_scalable ? true : false);
|
|
4750
4750
|
} else {
|
|
4751
|
-
|
|
4751
|
+
let scalable = layoutX.getLaneScalability(colIndex);
|
|
4752
4752
|
if(this._preserveProportion) {
|
|
4753
4753
|
if(scalable) {
|
|
4754
4754
|
//calculate the proportion
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
for (
|
|
4755
|
+
let colCount = this.getColumnCount();
|
|
4756
|
+
let totalWeight = 0, totalWidth = 0;
|
|
4757
|
+
for (let j = 0; j < colCount; ++j) {
|
|
4758
4758
|
if(!layoutX.getLaneScalability(j)) { continue; }
|
|
4759
|
-
|
|
4760
|
-
|
|
4759
|
+
let colWidth = layoutX.getLaneSize(j);
|
|
4760
|
+
let colWeight = layoutX.getCustomLaneSize(j);
|
|
4761
4761
|
totalWeight += colWeight;
|
|
4762
4762
|
totalWidth += colWidth;
|
|
4763
4763
|
}
|
|
4764
|
-
|
|
4764
|
+
let oldWeight = layoutX.getCustomLaneSize(colIndex);
|
|
4765
4765
|
px = ((px * totalWeight) - (px * oldWeight)) / (totalWidth - px);
|
|
4766
4766
|
if(!px || px < 0) {
|
|
4767
4767
|
px = totalWeight; // In case of new width exceeds total available width, set new weight as total weight
|
|
@@ -4782,7 +4782,7 @@ Core.prototype._setColumnWidth = function (colIndex, px, opt_scalable) {
|
|
|
4782
4782
|
* @param {*=} ctx
|
|
4783
4783
|
*/
|
|
4784
4784
|
Core.prototype._dispatchColumnAddedEvent = function (at, count, atTheMiddle, ctx) {
|
|
4785
|
-
|
|
4785
|
+
let e = {};
|
|
4786
4786
|
if (this._hasListener("columnAdded")) {
|
|
4787
4787
|
e["atTheMiddle"] = atTheMiddle;
|
|
4788
4788
|
if(count === 1) {
|
|
@@ -4790,8 +4790,8 @@ Core.prototype._dispatchColumnAddedEvent = function (at, count, atTheMiddle, ctx
|
|
|
4790
4790
|
e["context"] = ctx;
|
|
4791
4791
|
this._dispatchColumnEvent("columnAdded", e);
|
|
4792
4792
|
} else {
|
|
4793
|
-
|
|
4794
|
-
for (
|
|
4793
|
+
let ary = Array.isArray(ctx) ? ctx : [];
|
|
4794
|
+
for (let i = 0; i < count; ++i) {
|
|
4795
4795
|
e["colIndex"] = at + i;
|
|
4796
4796
|
e["context"] = ary[i];
|
|
4797
4797
|
this._dispatchColumnEvent("columnAdded", e);
|
|
@@ -4827,7 +4827,7 @@ Core.prototype._dispatchColumnRenderEvent = function (e, fromC, toC, fromS, toS,
|
|
|
4827
4827
|
e["fromColIndex"] = fromC;
|
|
4828
4828
|
e["toColIndex"] = toC;
|
|
4829
4829
|
|
|
4830
|
-
|
|
4830
|
+
let s;
|
|
4831
4831
|
if (this._hasListener("preSectionRender")) {
|
|
4832
4832
|
for (s = fromS; s < toS; ++s) {
|
|
4833
4833
|
this._settings[s].extendRenderEventArg(e, fromR, toR);
|
|
@@ -4836,20 +4836,20 @@ Core.prototype._dispatchColumnRenderEvent = function (e, fromC, toC, fromS, toS,
|
|
|
4836
4836
|
}
|
|
4837
4837
|
|
|
4838
4838
|
// Dispatch column render event
|
|
4839
|
-
for (
|
|
4840
|
-
|
|
4839
|
+
for (let c = fromC; c < toC; ++c) { // For each column
|
|
4840
|
+
let handler = this.getColumnRenderingHandler(c) || this._renderingHandler;
|
|
4841
4841
|
if (handler) {
|
|
4842
4842
|
e["colIndex"] = c;
|
|
4843
4843
|
e["dataColumnName"] = this.getDataColumnName(c);
|
|
4844
4844
|
|
|
4845
4845
|
for (s = fromS; s < toS; ++s) { // For each section
|
|
4846
|
-
|
|
4846
|
+
let sectionSettings = this._settings[s];
|
|
4847
4847
|
sectionSettings.extendRenderEventArg(e, fromR, toR);
|
|
4848
4848
|
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
for (
|
|
4849
|
+
let section = sectionSettings.getSection();
|
|
4850
|
+
let startR = e["fromRowIndex"];
|
|
4851
|
+
let destR = e["toRowIndex"];
|
|
4852
|
+
for (let r = startR; r < destR; ++r) { // For each row
|
|
4853
4853
|
e["rowIndex"] = r;
|
|
4854
4854
|
e["cell"] = section["getCell"](c, r, false); // Accessing cell by using bracket allows extenal object to mock Section
|
|
4855
4855
|
handler(e);
|
|
@@ -4880,23 +4880,23 @@ Core.prototype._dispatchRowExpansionBinding = function (e) {
|
|
|
4880
4880
|
return;
|
|
4881
4881
|
}
|
|
4882
4882
|
|
|
4883
|
-
|
|
4883
|
+
let dataView = /** @type{DataView} */(e["dataSource"]);
|
|
4884
4884
|
if (!dataView || !dataView.getDataSource()) {
|
|
4885
4885
|
return;
|
|
4886
4886
|
}
|
|
4887
4887
|
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4888
|
+
let fromR = /** @type{number} */(e["fromRowIndex"]);
|
|
4889
|
+
let toR = /** @type{number} */(e["toRowIndex"]);
|
|
4890
|
+
let rids = dataView.getVisibleRowIds(true);
|
|
4891
|
+
let section = /** @type{ILayoutGrid} */(e["section"]);
|
|
4892
4892
|
|
|
4893
4893
|
e["rowData"] = null;
|
|
4894
4894
|
e["cell"] = null;
|
|
4895
|
-
|
|
4896
|
-
for (
|
|
4897
|
-
|
|
4895
|
+
let lastRowIndexChanged = false;
|
|
4896
|
+
for (let r = toR - 1; r >= fromR; --r) {
|
|
4897
|
+
let rowId = dataView.getRowId(r);
|
|
4898
4898
|
if(!lastRowIndexChanged) {
|
|
4899
|
-
|
|
4899
|
+
let reCount = dataView.getRowExpansionCount(rowId);
|
|
4900
4900
|
if(reCount > 0){
|
|
4901
4901
|
r = r + reCount + 1; // include parent row
|
|
4902
4902
|
lastRowIndexChanged = true;
|
|
@@ -4904,8 +4904,8 @@ Core.prototype._dispatchRowExpansionBinding = function (e) {
|
|
|
4904
4904
|
}
|
|
4905
4905
|
}
|
|
4906
4906
|
|
|
4907
|
-
|
|
4908
|
-
|
|
4907
|
+
let ctxRow = section.getContextRow(r);
|
|
4908
|
+
let parentId = dataView.getExpansionParentByRowId(rowId);
|
|
4909
4909
|
if(parentId) { // dispatch to render row expansion
|
|
4910
4910
|
e["originalRowData"] = dataView.getRowData(parentId);
|
|
4911
4911
|
e["originalRowId"] = parentId;
|
|
@@ -4930,28 +4930,28 @@ Core.prototype._dispatchRowExpansionBinding = function (e) {
|
|
|
4930
4930
|
* @param {number} num
|
|
4931
4931
|
*/
|
|
4932
4932
|
Core.prototype._removeColumn = function (num) { // TODO: change the logic to use removeColumnAt
|
|
4933
|
-
|
|
4933
|
+
let colCount = this._layoutX.getLaneCount();
|
|
4934
4934
|
if (num > colCount) { num = colCount; }
|
|
4935
4935
|
if (num <= 0) { return; }
|
|
4936
4936
|
|
|
4937
|
-
|
|
4937
|
+
let newCount = colCount - num;
|
|
4938
4938
|
this._layoutX.setLaneCount(newCount);
|
|
4939
4939
|
|
|
4940
|
-
for (
|
|
4941
|
-
|
|
4940
|
+
for (let s = this._settings.length; --s >= 0; ) {
|
|
4941
|
+
let section = this._settings[s].getSection();
|
|
4942
4942
|
section.setColumnCount(newCount);
|
|
4943
4943
|
}
|
|
4944
4944
|
|
|
4945
|
-
|
|
4945
|
+
let removedCols = this._columnDefs.slice(newCount); // Shallow cloning
|
|
4946
4946
|
this._columnDefs.length = newCount;
|
|
4947
4947
|
|
|
4948
4948
|
this._onColumnCountChanged();
|
|
4949
4949
|
this._syncLayoutToColumns(newCount, 0, true); // Virtualizer's view bound will not be affected from column
|
|
4950
4950
|
|
|
4951
4951
|
if (this._hasListener("columnRemoved")) {
|
|
4952
|
-
|
|
4953
|
-
for (
|
|
4954
|
-
|
|
4952
|
+
let e = {};
|
|
4953
|
+
for (let c = colCount; --c >= newCount; ) {
|
|
4954
|
+
let colDef = removedCols[c - newCount];
|
|
4955
4955
|
e["colIndex"] = c;
|
|
4956
4956
|
e["columnData"] = colDef ? colDef["columnData"] : null;
|
|
4957
4957
|
this._dispatchColumnEvent("columnRemoved", e);
|
|
@@ -4967,18 +4967,18 @@ Core.prototype._removeColumn = function (num) { // TODO: change the logic to us
|
|
|
4967
4967
|
Core.prototype._onSectionDataChanged = function (e) {
|
|
4968
4968
|
if(this._dispatchingDataChanged) { return; } // Prevent infinite loop
|
|
4969
4969
|
|
|
4970
|
-
|
|
4970
|
+
let colCount = this._layoutX.getLaneCount();
|
|
4971
4971
|
this._dispatchingDataChanged = colCount ? true : false;
|
|
4972
4972
|
if(!colCount) {
|
|
4973
4973
|
return;
|
|
4974
4974
|
}
|
|
4975
4975
|
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4976
|
+
let fromR = /** @type{number} */(e["fromRowIndex"]);
|
|
4977
|
+
let toR = /** @type{number} */(e["toRowIndex"]);
|
|
4978
|
+
let section = /** @type{ILayoutGrid} */(e["section"]);
|
|
4979
|
+
let dataView = /** @type{DataView} */(e["dataSource"]);
|
|
4980
|
+
let hasDataView = (dataView && dataView.getDataSource()) ? 1 : 0;
|
|
4981
|
+
let rids, rowDataCollection;
|
|
4982
4982
|
|
|
4983
4983
|
section._startBindingSession(true);
|
|
4984
4984
|
|
|
@@ -4988,24 +4988,24 @@ Core.prototype._onSectionDataChanged = function (e) {
|
|
|
4988
4988
|
e["dataRows"] = rowDataCollection;
|
|
4989
4989
|
}
|
|
4990
4990
|
|
|
4991
|
-
|
|
4991
|
+
let isContentSection = e["sectionType"] === "content";
|
|
4992
4992
|
if(isContentSection){
|
|
4993
4993
|
this._dispatch("beforeContentBinding", e);
|
|
4994
4994
|
}
|
|
4995
4995
|
this._dispatch("preSectionDataBinding", e);
|
|
4996
4996
|
|
|
4997
|
-
|
|
4998
|
-
for (
|
|
4997
|
+
let dataMap = this.getDataColumnMap();
|
|
4998
|
+
for (let c = 0; c < colCount; ++c) {
|
|
4999
4999
|
if(section["isColumnActive"](c) && (this.isColumnVisible(c) || this._isAlwaysRenderColumn(c))) {
|
|
5000
|
-
|
|
5000
|
+
let handler = this.getColumnDataBindingHandler(c) || this._dataBindingHandler;
|
|
5001
5001
|
if (handler) {
|
|
5002
|
-
|
|
5002
|
+
let cid = dataMap[c];
|
|
5003
5003
|
e["dataColumnName"] = cid;
|
|
5004
5004
|
e["colIndex"] = c;
|
|
5005
5005
|
|
|
5006
|
-
for (
|
|
5006
|
+
for (let r = fromR; r < toR; ++r) {
|
|
5007
5007
|
if(hasDataView) {
|
|
5008
|
-
|
|
5008
|
+
let rowData = rowDataCollection[r];
|
|
5009
5009
|
|
|
5010
5010
|
e["rowData"] = rowData;
|
|
5011
5011
|
e["rowId"] = rids[r];
|
|
@@ -5063,7 +5063,7 @@ Core.prototype._onVScroll = function (e) {
|
|
|
5063
5063
|
* @param {Object} e
|
|
5064
5064
|
*/
|
|
5065
5065
|
Core.prototype._onHScroll = function (e) {
|
|
5066
|
-
|
|
5066
|
+
let scrollVal = this._hscrollbar.getScrollLeft();
|
|
5067
5067
|
this._colVirtualizer.setViewOffset(scrollVal); // Trigger virtualization event
|
|
5068
5068
|
this._updateColumnBounds();
|
|
5069
5069
|
this._dispatchColumnPositionChanged();
|
|
@@ -5090,14 +5090,14 @@ Core.prototype._onVScrollDisabled = function () {
|
|
|
5090
5090
|
* @param {Object} e
|
|
5091
5091
|
*/
|
|
5092
5092
|
Core.prototype._onRowInViewChanged = function (e) { // Triggered from virtualizer
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
for (
|
|
5099
|
-
|
|
5100
|
-
|
|
5093
|
+
let fi = e["firstIndex"];
|
|
5094
|
+
let ei = e["lastIndex"] + 1; // End index
|
|
5095
|
+
let sectionCount = this._settings.length;
|
|
5096
|
+
let updateRange = [0, 0];
|
|
5097
|
+
|
|
5098
|
+
for (let s = 0; s < sectionCount; ++s) { // For each section
|
|
5099
|
+
let sectionSettings = this._settings[s];
|
|
5100
|
+
let section = sectionSettings.getSection();
|
|
5101
5101
|
if(section && !section.getFrozenLayout()) { // Section may have been disposed or frozen
|
|
5102
5102
|
section.activateRows(fi, ei, updateRange);
|
|
5103
5103
|
this.updateRowData(sectionSettings,
|
|
@@ -5114,18 +5114,18 @@ Core.prototype._onColInViewChanged = function (e) {
|
|
|
5114
5114
|
if(!this.getColumnCount()) {
|
|
5115
5115
|
return; // No column for activation and no cell to be rendered
|
|
5116
5116
|
}
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
-
|
|
5120
|
-
|
|
5117
|
+
let pfi = e["prevFirstIndex"];
|
|
5118
|
+
let pli = e["prevLastIndex"]; // INCLUSIVE
|
|
5119
|
+
let fi = e["firstIndex"];
|
|
5120
|
+
let li = e["lastIndex"]; // INCLUSIVE
|
|
5121
5121
|
|
|
5122
|
-
|
|
5123
|
-
|
|
5122
|
+
let first = pfi < fi ? pfi : fi;
|
|
5123
|
+
let last = pli > li ? pli : li; // INCLUSIVE
|
|
5124
5124
|
|
|
5125
5125
|
this._activateColumns(fi, li, first, last);
|
|
5126
|
-
|
|
5127
|
-
for (
|
|
5128
|
-
|
|
5126
|
+
let sectionCount = this.getSectionCount();
|
|
5127
|
+
for (let s = 0; s < sectionCount; ++s) { // For each section
|
|
5128
|
+
let sectionSettings = this._settings[s];
|
|
5129
5129
|
this.updateRowData(sectionSettings); // It will be render all rows in view
|
|
5130
5130
|
}
|
|
5131
5131
|
};
|
|
@@ -5144,10 +5144,10 @@ Core.prototype._activateColumns = function(fi, li, first, last) {
|
|
|
5144
5144
|
last = this.getColumnCount() - 1;
|
|
5145
5145
|
}
|
|
5146
5146
|
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
for(
|
|
5150
|
-
|
|
5147
|
+
let activations = this._getColActivationList(fi, li, first, last);
|
|
5148
|
+
let sectionCount = this.getSectionCount();
|
|
5149
|
+
for(let s = sectionCount; --s >= 0;) {
|
|
5150
|
+
let sectionSettings = this._settings[s];
|
|
5151
5151
|
sectionSettings.activateColumns(activations, first, last);
|
|
5152
5152
|
}
|
|
5153
5153
|
};
|
|
@@ -5161,7 +5161,7 @@ Core.prototype._activateColumns = function(fi, li, first, last) {
|
|
|
5161
5161
|
Core.prototype._getColActivationList = function (fi, li, first, last) {
|
|
5162
5162
|
if (first == null) { first = 0; }
|
|
5163
5163
|
|
|
5164
|
-
|
|
5164
|
+
let colCount = this.getColumnCount();
|
|
5165
5165
|
if (last == null) { last = colCount - 1; }
|
|
5166
5166
|
|
|
5167
5167
|
if (fi == null) {
|
|
@@ -5172,10 +5172,10 @@ Core.prototype._getColActivationList = function (fi, li, first, last) {
|
|
|
5172
5172
|
li = this._colVirtualizer.getLastIndexInView();
|
|
5173
5173
|
}
|
|
5174
5174
|
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
for (
|
|
5175
|
+
let leftPinnedIndex = this.getHScrollStartIndex();
|
|
5176
|
+
let rightPinnedIndex = this.getFirstPinnedRightIndex();
|
|
5177
|
+
let activations = new Array(last + 1);
|
|
5178
|
+
for (let c = first; c <= last; ++c) {
|
|
5179
5179
|
activations[c] = (c < leftPinnedIndex) ||
|
|
5180
5180
|
(c >= fi && c <= li) ||
|
|
5181
5181
|
(c >= rightPinnedIndex);
|
|
@@ -5189,7 +5189,7 @@ Core.prototype._getColActivationList = function (fi, li, first, last) {
|
|
|
5189
5189
|
*/
|
|
5190
5190
|
Core.prototype._getColumnDef = function (colIndex) {
|
|
5191
5191
|
if (colIndex >= 0) {
|
|
5192
|
-
|
|
5192
|
+
let def = this._columnDefs[colIndex];
|
|
5193
5193
|
if (!def) {
|
|
5194
5194
|
def = this._columnDefs[colIndex] = {
|
|
5195
5195
|
"id": "" + Core._runningColumnId++, // Unique identifier
|
|
@@ -5210,9 +5210,9 @@ Core.prototype._getColumnDef = function (colIndex) {
|
|
|
5210
5210
|
* @return {!Object}
|
|
5211
5211
|
*/
|
|
5212
5212
|
Core.prototype._getNestedColumnDef = function (colIndex, firstLvl, secondLvl) {
|
|
5213
|
-
|
|
5213
|
+
let def = this._getColumnDef(colIndex);
|
|
5214
5214
|
if(firstLvl) {
|
|
5215
|
-
|
|
5215
|
+
let parentDef = def;
|
|
5216
5216
|
def = parentDef[firstLvl];
|
|
5217
5217
|
if(!def) {
|
|
5218
5218
|
def = parentDef[firstLvl] = {};
|
|
@@ -5250,9 +5250,9 @@ Core.prototype._getColumnId = Core.prototype.getColumnId;
|
|
|
5250
5250
|
* @return {!Array.<string>} Return all column ids from existing column
|
|
5251
5251
|
*/
|
|
5252
5252
|
Core.prototype.getColumnIds = function () {
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
for(
|
|
5253
|
+
let colCount = this.getColumnCount();
|
|
5254
|
+
let ary = new Array(colCount);
|
|
5255
|
+
for(let c = 0; c < colCount; ++c) {
|
|
5256
5256
|
ary[c] = this._getColumnDef(c)["id"] || "";
|
|
5257
5257
|
}
|
|
5258
5258
|
return ary;
|
|
@@ -5279,9 +5279,9 @@ Core.prototype.getColumnField = function (colIndex) {
|
|
|
5279
5279
|
* @return {!Array.<string>} Return all column fields from existing columns
|
|
5280
5280
|
*/
|
|
5281
5281
|
Core.prototype.getColumnFields = function () {
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
for(
|
|
5282
|
+
let colCount = this.getColumnCount();
|
|
5283
|
+
let ary = new Array(colCount);
|
|
5284
|
+
for(let c = 0; c < colCount; ++c) {
|
|
5285
5285
|
ary[c] = this._getColumnDef(c)["field"] || "";
|
|
5286
5286
|
}
|
|
5287
5287
|
return ary;
|
|
@@ -5296,10 +5296,10 @@ Core.prototype.getColumnIndex = function (colRef) {
|
|
|
5296
5296
|
if(typeof colRef === "number") {
|
|
5297
5297
|
return colRef;
|
|
5298
5298
|
} else if(colRef) {
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
for(
|
|
5302
|
-
|
|
5299
|
+
let str = colRef;
|
|
5300
|
+
let colCount = this.getColumnCount();
|
|
5301
|
+
for(let c = 0; c < colCount; ++c) {
|
|
5302
|
+
let colDef = this._getColumnDef(c);
|
|
5303
5303
|
if(str === colDef["id"] || str === colDef["field"]) {
|
|
5304
5304
|
return c;
|
|
5305
5305
|
}
|
|
@@ -5313,13 +5313,13 @@ Core.prototype.getColumnIndex = function (colRef) {
|
|
|
5313
5313
|
* @return {!Array.<number>} Return negative value if there is no match
|
|
5314
5314
|
*/
|
|
5315
5315
|
Core.prototype.getColumnIndices = function (colRefs) {
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
5316
|
+
let ary = [];
|
|
5317
|
+
let colCount = this.getColumnCount();
|
|
5318
|
+
let inputAry = Array.isArray(colRefs) ? colRefs : [colRefs];
|
|
5319
|
+
let len = inputAry.length;
|
|
5320
5320
|
// Verify user input
|
|
5321
|
-
for(
|
|
5322
|
-
|
|
5321
|
+
for(let i = 0; i < len; ++i) {
|
|
5322
|
+
let colIndex = this.getColumnIndex(inputAry[i]);
|
|
5323
5323
|
if(colIndex >= 0 && colIndex < colCount) {
|
|
5324
5324
|
ary.push(colIndex); // WARNING: We have not check for duplication
|
|
5325
5325
|
}
|
|
@@ -5332,11 +5332,11 @@ Core.prototype.getColumnIndices = function (colRefs) {
|
|
|
5332
5332
|
* @return {!Object.<string, number>}
|
|
5333
5333
|
*/
|
|
5334
5334
|
Core.prototype.getColumnIndexMap = function () {
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
for(
|
|
5339
|
-
|
|
5335
|
+
let colCount = this.getColumnCount();
|
|
5336
|
+
let obj = {};
|
|
5337
|
+
let str = "";
|
|
5338
|
+
for(let c = 0; c < colCount; ++c) {
|
|
5339
|
+
let colDef = this._getColumnDef(c);
|
|
5340
5340
|
|
|
5341
5341
|
str = colDef["field"];
|
|
5342
5342
|
if(str) {
|
|
@@ -5365,11 +5365,11 @@ Core.prototype._onMouseMove = function () {
|
|
|
5365
5365
|
/** @private */
|
|
5366
5366
|
Core.prototype._onGridClicked = function () {
|
|
5367
5367
|
// research for dragging
|
|
5368
|
-
|
|
5368
|
+
let selection = window.getSelection();
|
|
5369
5369
|
if(selection.toString()){
|
|
5370
5370
|
return;
|
|
5371
5371
|
}
|
|
5372
|
-
|
|
5372
|
+
let activeElem = document.activeElement;
|
|
5373
5373
|
if(!this._element.contains(activeElem)){
|
|
5374
5374
|
this.focus();
|
|
5375
5375
|
}
|
|
@@ -5381,13 +5381,13 @@ Core.prototype._onGridClicked = function () {
|
|
|
5381
5381
|
Core.prototype._onRowHightlighted = function (e) {
|
|
5382
5382
|
if (!this._hasListener("rowHighlighted")) { return; }
|
|
5383
5383
|
|
|
5384
|
-
|
|
5385
|
-
|
|
5384
|
+
let section = e["sender"];
|
|
5385
|
+
let settings = this.getSectionSettings(section.getId());
|
|
5386
5386
|
if (settings == null) { return; }
|
|
5387
5387
|
|
|
5388
5388
|
settings.extendEventArg(e);
|
|
5389
5389
|
|
|
5390
|
-
|
|
5390
|
+
let dataSource = settings.getDataSource();
|
|
5391
5391
|
if (dataSource !== null) {
|
|
5392
5392
|
e["rowId"] = dataSource.getRowId(/** @type{number} */(e["rowIndex"]));
|
|
5393
5393
|
e["dataRow"] = dataSource.getRowData(e["rowId"]);
|
|
@@ -5401,12 +5401,12 @@ Core.prototype._onRowCountChanged = function (e) {
|
|
|
5401
5401
|
if(this._disposed) {
|
|
5402
5402
|
return; // There is no need to do anything after grid is disposed
|
|
5403
5403
|
}
|
|
5404
|
-
|
|
5405
|
-
|
|
5406
|
-
|
|
5407
|
-
|
|
5408
|
-
|
|
5409
|
-
|
|
5404
|
+
let section = /** @type {ILayoutGrid} */(e["sender"]);
|
|
5405
|
+
let prevRowCount = e["prevCount"];
|
|
5406
|
+
let newRowCount = e["rowCount"];
|
|
5407
|
+
let sectionIndex = section.getIndex();
|
|
5408
|
+
let offset = this._updateSectionIndices(sectionIndex);
|
|
5409
|
+
let i = 0;
|
|
5410
5410
|
|
|
5411
5411
|
if(prevRowCount > newRowCount) { // case row removed
|
|
5412
5412
|
this._layoutY.removeLaneAt(offset, prevRowCount - newRowCount);
|
|
@@ -5414,8 +5414,8 @@ Core.prototype._onRowCountChanged = function (e) {
|
|
|
5414
5414
|
this._syncSectionRowHeights(section);
|
|
5415
5415
|
}
|
|
5416
5416
|
} else { // case row added
|
|
5417
|
-
|
|
5418
|
-
|
|
5417
|
+
let defaultHeight = this._layoutY.getDefaultLaneSize();
|
|
5418
|
+
let customHeight = section.getDefaultRowHeight();
|
|
5419
5419
|
|
|
5420
5420
|
this._layoutY.insertLane(offset + prevRowCount, newRowCount - prevRowCount);
|
|
5421
5421
|
if (customHeight !== defaultHeight) {
|
|
@@ -5425,10 +5425,10 @@ Core.prototype._onRowCountChanged = function (e) {
|
|
|
5425
5425
|
}
|
|
5426
5426
|
}
|
|
5427
5427
|
|
|
5428
|
-
|
|
5429
|
-
|
|
5430
|
-
|
|
5431
|
-
|
|
5428
|
+
let noBinding = e["noBinding"];
|
|
5429
|
+
let paneChanged = (sectionIndex <= this._startVScrollbarIndex) || (sectionIndex >= this._getFooterStartIndex());
|
|
5430
|
+
let forceUpdate = this._frozenFooterCount > 0 ? true : false; // Prevent from footer section flashing
|
|
5431
|
+
let viewChanged = this._updateScrollbarHeight(paneChanged, forceUpdate, noBinding); // Virtualization is triggered
|
|
5432
5432
|
if(noBinding){
|
|
5433
5433
|
this._hasPendingRowChange = true;
|
|
5434
5434
|
}
|
|
@@ -5464,25 +5464,25 @@ Core.prototype._onRowHeightChanged = function (e) {
|
|
|
5464
5464
|
return;
|
|
5465
5465
|
}
|
|
5466
5466
|
|
|
5467
|
-
|
|
5467
|
+
let evts = this._rowHeightConflator.popAllData();
|
|
5468
5468
|
|
|
5469
|
-
|
|
5470
|
-
|
|
5469
|
+
let len = evts.length;
|
|
5470
|
+
let minSectionIndex = NaN;
|
|
5471
5471
|
|
|
5472
5472
|
// TODO: Set row height one by one is not good
|
|
5473
|
-
for(
|
|
5474
|
-
|
|
5475
|
-
|
|
5473
|
+
for(let j = 0; j < len; ++j) {
|
|
5474
|
+
let evt = evts[j];
|
|
5475
|
+
let section = /** @type {ILayoutGrid} */(evt["section"]);
|
|
5476
5476
|
if(!this._containsSection(section)) {
|
|
5477
5477
|
continue; // The section is no longer contained in this grid
|
|
5478
5478
|
}
|
|
5479
5479
|
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5480
|
+
let sectIndex = section.getIndex();
|
|
5481
|
+
let relIndex = evt["rowIndex"];
|
|
5482
|
+
let rowIndex = this.getRowIndex(sectIndex, relIndex);
|
|
5483
5483
|
|
|
5484
|
-
|
|
5485
|
-
for (
|
|
5484
|
+
let changeLength = evt["changeLength"];
|
|
5485
|
+
for (let i = 0; i < changeLength; ++i) {
|
|
5486
5486
|
if(this._layoutY.setLaneSize(rowIndex + i, section.getRowHeight(relIndex + i))) {
|
|
5487
5487
|
if(!(sectIndex >= minSectionIndex)) {
|
|
5488
5488
|
minSectionIndex = sectIndex;
|
|
@@ -5512,7 +5512,7 @@ Core.prototype._onRowHeightChanged = function (e) {
|
|
|
5512
5512
|
* @returns {boolean}
|
|
5513
5513
|
*/
|
|
5514
5514
|
Core.prototype._containsSection = function (s) {
|
|
5515
|
-
for(
|
|
5515
|
+
for(let i = this._settings.length; --i >= 0;) {
|
|
5516
5516
|
if(this._settings[i].getSection() === s) {
|
|
5517
5517
|
return true;
|
|
5518
5518
|
}
|
|
@@ -5527,7 +5527,7 @@ Core.prototype._onRowAvailable = function (e) {
|
|
|
5527
5527
|
if(this._hasPendingRowChange){
|
|
5528
5528
|
return;
|
|
5529
5529
|
}
|
|
5530
|
-
|
|
5530
|
+
let sectionIndex = /** @type{number} */(e["sectionIndex"]);
|
|
5531
5531
|
this._dispatchColumnRenderEvent(e,
|
|
5532
5532
|
0, this.getColumnCount(),
|
|
5533
5533
|
sectionIndex, sectionIndex + 1,
|
|
@@ -5541,7 +5541,7 @@ Core.prototype._onSectionCountChanged = function (opt_suppressLayout) {
|
|
|
5541
5541
|
if(this._frozenLayout) { return; }
|
|
5542
5542
|
|
|
5543
5543
|
if (this._tempFrozenSectionRef) {
|
|
5544
|
-
|
|
5544
|
+
let startVScrollbarSection = this.getNextSection(this._tempFrozenSectionRef);
|
|
5545
5545
|
if (startVScrollbarSection !== null) {
|
|
5546
5546
|
this._startVScrollbarIndex = startVScrollbarSection.getIndex();
|
|
5547
5547
|
this._tempFrozenSectionRef = "";
|
|
@@ -5568,8 +5568,8 @@ Core.prototype._onColumnCountChanged = function () {
|
|
|
5568
5568
|
if(this._frozenLayout || this._disposed) { return; }
|
|
5569
5569
|
|
|
5570
5570
|
// TODO: Optimize these methods during initialization
|
|
5571
|
-
|
|
5572
|
-
|
|
5571
|
+
let pinnedLeft = this._countPinnedLeftColumns();
|
|
5572
|
+
let pinnedRight = this._countPinnedRightColumns();
|
|
5573
5573
|
|
|
5574
5574
|
this._updateColumnBounds();
|
|
5575
5575
|
this._updateColumnSeparators();
|
|
@@ -5639,12 +5639,12 @@ Core.prototype._getSectionSize = function (startIndex, count) {
|
|
|
5639
5639
|
if(count == null) {
|
|
5640
5640
|
count = this.getSectionCount() - startIndex;
|
|
5641
5641
|
}
|
|
5642
|
-
|
|
5642
|
+
let startPos = this._layoutY.getLaneStart(
|
|
5643
5643
|
this._sectionStarts[startIndex]
|
|
5644
5644
|
);
|
|
5645
5645
|
|
|
5646
|
-
|
|
5647
|
-
|
|
5646
|
+
let endIndex = startIndex + count;
|
|
5647
|
+
let endPos = count > 0 ? this._layoutY.getLaneStart(
|
|
5648
5648
|
this._sectionStarts[endIndex]
|
|
5649
5649
|
) : 0;
|
|
5650
5650
|
return endPos - startPos;
|
|
@@ -5661,9 +5661,9 @@ Core.prototype._updateScrollbarHeight = function (paneChanged, contentChanged, n
|
|
|
5661
5661
|
return false;
|
|
5662
5662
|
}
|
|
5663
5663
|
|
|
5664
|
-
|
|
5665
|
-
|
|
5666
|
-
|
|
5664
|
+
let forceUpdateLayout = contentChanged;
|
|
5665
|
+
let recalculation = paneChanged && this._startVScrollbarIndex >= 0;
|
|
5666
|
+
let hasRowHeightChanged = this._rowHeightConflator.isConflating();
|
|
5667
5667
|
if(hasRowHeightChanged) {
|
|
5668
5668
|
this._rowHeightConflator._needScrollbarUpdate = true;
|
|
5669
5669
|
|
|
@@ -5674,13 +5674,13 @@ Core.prototype._updateScrollbarHeight = function (paneChanged, contentChanged, n
|
|
|
5674
5674
|
|
|
5675
5675
|
if (recalculation && !hasRowHeightChanged) {
|
|
5676
5676
|
// Scroll Frame
|
|
5677
|
-
|
|
5677
|
+
let gridElem = this.getElement();
|
|
5678
5678
|
if(!gridElem) {
|
|
5679
5679
|
return false;
|
|
5680
5680
|
}
|
|
5681
5681
|
|
|
5682
|
-
|
|
5683
|
-
|
|
5682
|
+
let gridParent = this.getParent();
|
|
5683
|
+
let scrollFrame = this._vscrollbar.getParent();
|
|
5684
5684
|
if(scrollFrame) {
|
|
5685
5685
|
if(scrollFrame !== gridParent) { // If vscrollbar is attached to an external element
|
|
5686
5686
|
// Assume that there is always a horizontal scrollbar host underneath
|
|
@@ -5693,8 +5693,8 @@ Core.prototype._updateScrollbarHeight = function (paneChanged, contentChanged, n
|
|
|
5693
5693
|
this._vscrollbar.setParent(scrollFrame);
|
|
5694
5694
|
}
|
|
5695
5695
|
|
|
5696
|
-
|
|
5697
|
-
|
|
5696
|
+
let sectionStart = this._getVScrollStart();
|
|
5697
|
+
let footerSize = this._getFooterSize();
|
|
5698
5698
|
|
|
5699
5699
|
if(scrollFrame !== gridElem) {
|
|
5700
5700
|
sectionStart += gridElem.clientTop;
|
|
@@ -5702,7 +5702,7 @@ Core.prototype._updateScrollbarHeight = function (paneChanged, contentChanged, n
|
|
|
5702
5702
|
|
|
5703
5703
|
// Scroll Track and Pane
|
|
5704
5704
|
this._vscrollbar.resetPaneSize(); // scrollFrame could have a dynamic height that rely on pane's content.
|
|
5705
|
-
|
|
5705
|
+
let containerHeight = scrollFrame.clientHeight - (sectionStart + footerSize) * this._zoomFactor;
|
|
5706
5706
|
|
|
5707
5707
|
// Pane size needs to be bigger when zooming out to keep the same view size
|
|
5708
5708
|
this._vscrollbar.setTop(sectionStart * this._zoomFactor);
|
|
@@ -5711,8 +5711,8 @@ Core.prototype._updateScrollbarHeight = function (paneChanged, contentChanged, n
|
|
|
5711
5711
|
// This calculation is for finding a appropriate dynamic buffer size
|
|
5712
5712
|
// because in the large content number, buffer need to be bigger.
|
|
5713
5713
|
// TODO: move buffer calculation to virtualizer
|
|
5714
|
-
|
|
5715
|
-
|
|
5714
|
+
let defaultSize = this._layoutY.getDefaultLaneSize();
|
|
5715
|
+
let viewSize = defaultSize * 12; // Display at least 12 rows
|
|
5716
5716
|
|
|
5717
5717
|
if (containerHeight > viewSize) {
|
|
5718
5718
|
viewSize = (Math.ceil(containerHeight / defaultSize) + 4) * defaultSize;
|
|
@@ -5726,7 +5726,7 @@ Core.prototype._updateScrollbarHeight = function (paneChanged, contentChanged, n
|
|
|
5726
5726
|
this._rowVirtualizer.validateVirtualization(); // Content height may be changed
|
|
5727
5727
|
}
|
|
5728
5728
|
|
|
5729
|
-
|
|
5729
|
+
let viewChanged = false;
|
|
5730
5730
|
if(!noBinding) {
|
|
5731
5731
|
viewChanged = this._rowVirtualizer.update(); // May fire onRowInViewChanged
|
|
5732
5732
|
}
|
|
@@ -5746,27 +5746,27 @@ Core.prototype._updateScrollbarWidth = function (paneChanged, contentChanged) {
|
|
|
5746
5746
|
|
|
5747
5747
|
if (paneChanged && this._hScrollbarEnabled) {
|
|
5748
5748
|
// Scroll Frame
|
|
5749
|
-
|
|
5750
|
-
|
|
5749
|
+
let gridElem = this.getElement();
|
|
5750
|
+
let scrollFrame = this._hscrollbar.getParent();
|
|
5751
5751
|
if (!scrollFrame) {
|
|
5752
5752
|
scrollFrame = this.getParent() || gridElem;
|
|
5753
5753
|
this._hscrollbar.setParent(scrollFrame);
|
|
5754
5754
|
}
|
|
5755
5755
|
|
|
5756
5756
|
// Frozen Area
|
|
5757
|
-
|
|
5757
|
+
let leftFrozenArea = this._layoutX.getLaneStart(this._pinnedLeftColumnCount);
|
|
5758
5758
|
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
|
|
5759
|
+
let colCount = this._layoutX.getLaneCount();
|
|
5760
|
+
let rightFrozenArea = 0;
|
|
5761
|
+
let rightPinnedCount = this._countPinnedRightColumns(); // TODO: Check if we need to do a recount here
|
|
5762
5762
|
if (rightPinnedCount) {
|
|
5763
5763
|
rightFrozenArea = this._layoutX.getLaneStart(colCount) -
|
|
5764
5764
|
this._layoutX.getLaneStart(colCount - rightPinnedCount);
|
|
5765
5765
|
}
|
|
5766
5766
|
|
|
5767
5767
|
// Scroll Track and Pane
|
|
5768
|
-
|
|
5769
|
-
|
|
5768
|
+
let gridClientWidth = (scrollFrame !== gridElem) ? gridElem.clientLeft : 0;
|
|
5769
|
+
let containerWidth = scrollFrame.clientWidth -
|
|
5770
5770
|
(leftFrozenArea + gridClientWidth + rightFrozenArea) * this._zoomFactor;
|
|
5771
5771
|
|
|
5772
5772
|
if (rightPinnedCount > 0) {
|
|
@@ -5777,8 +5777,8 @@ Core.prototype._updateScrollbarWidth = function (paneChanged, contentChanged) {
|
|
|
5777
5777
|
this._hscrollbar.setLeft((leftFrozenArea + gridClientWidth) * this._zoomFactor);
|
|
5778
5778
|
this._hscrollbar.setTrackSize(containerWidth, containerWidth / this._zoomFactor);
|
|
5779
5779
|
|
|
5780
|
-
|
|
5781
|
-
|
|
5780
|
+
let defaultSize = this._layoutX.getDefaultLaneSize();
|
|
5781
|
+
let viewSize = defaultSize * 4; // Display at least 4 column
|
|
5782
5782
|
if (containerWidth > viewSize) {
|
|
5783
5783
|
viewSize = containerWidth;
|
|
5784
5784
|
}
|
|
@@ -5800,18 +5800,18 @@ Core.prototype._updateScrollbarWidth = function (paneChanged, contentChanged) {
|
|
|
5800
5800
|
* @return {boolean}
|
|
5801
5801
|
*/
|
|
5802
5802
|
Core.prototype._hitTestY = function (relativeY, returnedObj) {
|
|
5803
|
-
|
|
5803
|
+
let sectionSettings;
|
|
5804
5804
|
if (returnedObj["sectionSettings"]) {
|
|
5805
5805
|
sectionSettings = returnedObj["sectionSettings"];
|
|
5806
5806
|
} else {
|
|
5807
|
-
|
|
5807
|
+
let rowIndex;
|
|
5808
5808
|
if (returnedObj["rowIndex"] == 'number') {
|
|
5809
5809
|
rowIndex = returnedObj['rowIndex'];
|
|
5810
5810
|
} else {
|
|
5811
5811
|
rowIndex = this._layoutY.hitTest(relativeY);
|
|
5812
5812
|
}
|
|
5813
|
-
|
|
5814
|
-
|
|
5813
|
+
let validRowIndex = (rowIndex >= 0) ? rowIndex : ~rowIndex; // TODO: Check if this is necessary
|
|
5814
|
+
let sectionIndex = Util.upperBound(this._sectionStarts, validRowIndex) - 1;
|
|
5815
5815
|
returnedObj["sectionIndex"] = sectionIndex;
|
|
5816
5816
|
sectionSettings = this._settings[sectionIndex];
|
|
5817
5817
|
if(!sectionSettings) { // Cannot find SectionSettings
|
|
@@ -5820,7 +5820,7 @@ Core.prototype._hitTestY = function (relativeY, returnedObj) {
|
|
|
5820
5820
|
sectionSettings.extendEventArg(returnedObj);
|
|
5821
5821
|
}
|
|
5822
5822
|
|
|
5823
|
-
|
|
5823
|
+
let section = sectionSettings.getSection();
|
|
5824
5824
|
if(returnedObj["colIndex"] != null && returnedObj["cellElement"]) {
|
|
5825
5825
|
returnedObj["rowIndex"] = section.getCellIndex(returnedObj["colIndex"], returnedObj["cellElement"]);
|
|
5826
5826
|
} else {
|
|
@@ -5838,26 +5838,26 @@ Core.prototype._hitTestY = function (relativeY, returnedObj) {
|
|
|
5838
5838
|
*/
|
|
5839
5839
|
Core.prototype._syncLayoutToColumns = function (from, to, opt_forceDispatching) {
|
|
5840
5840
|
if (this._frozenLayout) { return; }
|
|
5841
|
-
|
|
5842
|
-
|
|
5841
|
+
let colCount = this._layoutX.getLaneCount();
|
|
5842
|
+
let forceUpdate = this.fillParentWidth(100); // Resize all columns if there is a scaling column
|
|
5843
5843
|
if (forceUpdate || (from == null) || (to == null)) {
|
|
5844
5844
|
from = 0;
|
|
5845
5845
|
to = colCount;
|
|
5846
5846
|
forceUpdate = true;
|
|
5847
5847
|
}
|
|
5848
5848
|
|
|
5849
|
-
|
|
5849
|
+
let sectCount = this._settings.length;
|
|
5850
5850
|
if (sectCount <= 0) { return; }
|
|
5851
5851
|
|
|
5852
|
-
|
|
5852
|
+
let dirty = false;
|
|
5853
5853
|
if(from < to) {
|
|
5854
|
-
for (
|
|
5854
|
+
for (let i = 0; i < sectCount; ++i) {
|
|
5855
5855
|
dirty = this._syncLayoutToSectionColumns(this._settings[i].getSection(), from, to) || dirty;
|
|
5856
5856
|
}
|
|
5857
5857
|
}
|
|
5858
5858
|
|
|
5859
5859
|
// TODO: Check if "to" should be greater than or equal to first pinnied right index
|
|
5860
|
-
|
|
5860
|
+
let paneChanged = forceUpdate || (from < this.getHScrollStartIndex()) || (to > this.getFirstPinnedRightIndex());
|
|
5861
5861
|
this._updateScrollbarWidth(paneChanged, true /* contentChanged */);
|
|
5862
5862
|
this._updateColumnBounds();
|
|
5863
5863
|
this._updateColumnSeparators();
|
|
@@ -5881,8 +5881,8 @@ Core.prototype._syncLayoutToSectionColumns = function (section, opt_from, opt_to
|
|
|
5881
5881
|
if (opt_from == null) { opt_from = 0; }
|
|
5882
5882
|
if (opt_to == null) { opt_to = this._layoutX.getLaneCount(); }
|
|
5883
5883
|
|
|
5884
|
-
|
|
5885
|
-
for (
|
|
5884
|
+
let dirty = 0;
|
|
5885
|
+
for (let i = opt_from; i < opt_to; ++i) {
|
|
5886
5886
|
dirty |= section._setColumnWidth(i, this._layoutX.getLaneSize(i));
|
|
5887
5887
|
}
|
|
5888
5888
|
if(dirty && !this._frozenLayout) {
|
|
@@ -5915,14 +5915,14 @@ Core.prototype._updateSectionIndices = function (from) {
|
|
|
5915
5915
|
if (from < 0) { from = 0; }
|
|
5916
5916
|
|
|
5917
5917
|
// Adjust Index offsets for hittest
|
|
5918
|
-
|
|
5919
|
-
|
|
5918
|
+
let sectionCount = this._settings.length;
|
|
5919
|
+
let first = this._settings[0] || null;
|
|
5920
5920
|
if (first !== this._firstSettings) {
|
|
5921
5921
|
if (this._firstSettings) { this._firstSettings.getSection().removeClass("first"); }
|
|
5922
5922
|
this._firstSettings = first;
|
|
5923
5923
|
if (this._firstSettings) { this._firstSettings.getSection().addClass("first"); }
|
|
5924
5924
|
}
|
|
5925
|
-
|
|
5925
|
+
let last = this._settings[sectionCount - 1] || null;
|
|
5926
5926
|
if (last !== this._lastSettings) {
|
|
5927
5927
|
if (this._lastSettings) { this._lastSettings.getSection().removeClass("last"); }
|
|
5928
5928
|
this._lastSettings = last;
|
|
@@ -5931,8 +5931,8 @@ Core.prototype._updateSectionIndices = function (from) {
|
|
|
5931
5931
|
|
|
5932
5932
|
this._sectionStarts.length = sectionCount + 1;
|
|
5933
5933
|
this._sectionStarts[0] = 0;
|
|
5934
|
-
for (
|
|
5935
|
-
|
|
5934
|
+
for (let i = from; i < sectionCount; ++i) {
|
|
5935
|
+
let section = this._settings[i].getSection();
|
|
5936
5936
|
section.setIndex(i);
|
|
5937
5937
|
section.setRowOffset(this._sectionStarts[i]);
|
|
5938
5938
|
this._sectionStarts[i + 1] = this._sectionStarts[i] + section.getRowCount();
|
|
@@ -5943,7 +5943,7 @@ Core.prototype._updateSectionIndices = function (from) {
|
|
|
5943
5943
|
|
|
5944
5944
|
/** @private */
|
|
5945
5945
|
Core.prototype._updateLayout = function () {
|
|
5946
|
-
|
|
5946
|
+
let element = this.getElement();
|
|
5947
5947
|
if(this._disposed || !element.offsetParent) { return; }
|
|
5948
5948
|
|
|
5949
5949
|
this._syncLayoutToColumns(); // Update only if need
|
|
@@ -5951,9 +5951,9 @@ Core.prototype._updateLayout = function () {
|
|
|
5951
5951
|
this._updateScrollbarHeight(true, true);
|
|
5952
5952
|
this._updateScrollbarWidth(true, true); // WARNING this may be redundant with _syncLayoutToColumns
|
|
5953
5953
|
|
|
5954
|
-
|
|
5955
|
-
for (
|
|
5956
|
-
|
|
5954
|
+
let sectionCount = this.getSectionCount();
|
|
5955
|
+
for (let s = 0; s < sectionCount; ++s) {
|
|
5956
|
+
let section = this._settings[s].getSection();
|
|
5957
5957
|
section.updateLayout(); // Notify section about forced recalculation of the layout
|
|
5958
5958
|
}
|
|
5959
5959
|
this._updateColumnSeparators();
|