@sapui5/sap.zen.crosstab 1.84.33 → 1.84.50
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/package.json +1 -1
- package/src/{main/uilib/sap → sap}/zen/crosstab/.library +14 -13
- package/src/sap/zen/crosstab/BaseArea.js +933 -0
- package/src/sap/zen/crosstab/CellStyleHandler.js +109 -0
- package/src/sap/zen/crosstab/ColResizer.js +261 -0
- package/src/sap/zen/crosstab/ColumnHeaderArea.js +61 -0
- package/src/sap/zen/crosstab/Crosstab.js +1351 -0
- package/src/sap/zen/crosstab/CrosstabCellApi.js +141 -0
- package/src/sap/zen/crosstab/CrosstabContextMenu.js +96 -0
- package/src/sap/zen/crosstab/CrosstabHeaderInfo.js +699 -0
- package/src/sap/zen/crosstab/CrosstabRenderer.js +258 -0
- package/src/sap/zen/crosstab/CrosstabTestProxy.js +64 -0
- package/src/sap/zen/crosstab/DataArea.js +76 -0
- package/src/sap/zen/crosstab/DataCell.js +187 -0
- package/src/sap/zen/crosstab/DataCellRenderer.js +70 -0
- package/src/sap/zen/crosstab/DimensionHeaderArea.js +34 -0
- package/src/sap/zen/crosstab/EventHandler.js +664 -0
- package/src/sap/zen/crosstab/HeaderCell.js +357 -0
- package/src/sap/zen/crosstab/HeaderCellRenderer.js +333 -0
- package/src/sap/zen/crosstab/HeaderResizer.js +142 -0
- package/src/sap/zen/crosstab/IDataCell.js +34 -0
- package/src/sap/zen/crosstab/IHeaderCell.js +30 -0
- package/src/sap/zen/crosstab/PropertyBag.js +220 -0
- package/src/sap/zen/crosstab/RowHeaderArea.js +78 -0
- package/src/sap/zen/crosstab/SelectionHandler.js +892 -0
- package/src/sap/zen/crosstab/TextConstants.js +22 -0
- package/src/sap/zen/crosstab/TouchHandler.js +413 -0
- package/src/sap/zen/crosstab/datahandler/JsonDataHandler.js +777 -0
- package/src/sap/zen/crosstab/dragdrop/DragDropAreaRenderer.js +446 -0
- package/src/sap/zen/crosstab/dragdrop/DragDropHandler.js +674 -0
- package/src/sap/zen/crosstab/dragdrop/DragDropHoverManager.js +474 -0
- package/src/sap/zen/crosstab/dragdrop/DragDropUtils.js +579 -0
- package/src/sap/zen/crosstab/dragdrop/MemberDragDropHandler.js +1156 -0
- package/src/sap/zen/crosstab/keyboard/CrosstabKeyboardNavHandler.js +585 -0
- package/src/sap/zen/crosstab/library.js +49 -0
- package/src/sap/zen/crosstab/paging/CellMerger.js +266 -0
- package/src/sap/zen/crosstab/paging/Page.js +331 -0
- package/src/sap/zen/crosstab/paging/PageManager.js +396 -0
- package/src/sap/zen/crosstab/paging/PagingConstants.js +19 -0
- package/src/sap/zen/crosstab/paging/RequestHandler.js +103 -0
- package/src/sap/zen/crosstab/paging/RequestStack.js +112 -0
- package/src/sap/zen/crosstab/rendering/CrossRequestManager.js +468 -0
- package/src/sap/zen/crosstab/rendering/DataModel.js +260 -0
- package/src/sap/zen/crosstab/rendering/DomElementProvider.js +24 -0
- package/src/sap/zen/crosstab/rendering/HeaderScrollManager.js +93 -0
- package/src/sap/zen/crosstab/rendering/PixelScrollManager.js +189 -0
- package/src/sap/zen/crosstab/rendering/RenderEngine.js +2694 -0
- package/src/sap/zen/crosstab/rendering/RenderingConstants.js +60 -0
- package/src/sap/zen/crosstab/rendering/ScrollManager.js +614 -0
- package/src/sap/zen/crosstab/rendering/ScrollbarRenderer.js +560 -0
- package/src/{main/uilib/sap → sap}/zen/crosstab/themes/base/Chart.less +0 -4
- package/src/{main/uilib/sap → sap}/zen/crosstab/themes/base/InfoFeeding.less +120 -120
- package/src/{main/uilib/sap → sap}/zen/crosstab/themes/sap_hcb/InfoFeeding.less +85 -85
- package/src/sap/zen/crosstab/utils/Measuring.js +236 -0
- package/src/sap/zen/crosstab/utils/Utils.js +485 -0
- package/ui5.yaml +4 -2
- package/src/main/uilib/sap/zen/crosstab/BaseArea.js +0 -1013
- package/src/main/uilib/sap/zen/crosstab/CellStyleHandler.js +0 -111
- package/src/main/uilib/sap/zen/crosstab/ColResizer.js +0 -264
- package/src/main/uilib/sap/zen/crosstab/ColumnHeaderArea.js +0 -52
- package/src/main/uilib/sap/zen/crosstab/Crosstab.js +0 -1662
- package/src/main/uilib/sap/zen/crosstab/CrosstabCellApi.js +0 -142
- package/src/main/uilib/sap/zen/crosstab/CrosstabContextMenu.js +0 -96
- package/src/main/uilib/sap/zen/crosstab/CrosstabHeaderInfo.js +0 -698
- package/src/main/uilib/sap/zen/crosstab/CrosstabRenderer.js +0 -274
- package/src/main/uilib/sap/zen/crosstab/CrosstabTestProxy.js +0 -59
- package/src/main/uilib/sap/zen/crosstab/DataArea.js +0 -74
- package/src/main/uilib/sap/zen/crosstab/DataCell.js +0 -196
- package/src/main/uilib/sap/zen/crosstab/DataCellRenderer.js +0 -71
- package/src/main/uilib/sap/zen/crosstab/DimensionHeaderArea.js +0 -25
- package/src/main/uilib/sap/zen/crosstab/EventHandler.js +0 -651
- package/src/main/uilib/sap/zen/crosstab/HeaderCell.js +0 -329
- package/src/main/uilib/sap/zen/crosstab/HeaderCellRenderer.js +0 -374
- package/src/main/uilib/sap/zen/crosstab/HeaderResizer.js +0 -131
- package/src/main/uilib/sap/zen/crosstab/IDataCell.js +0 -21
- package/src/main/uilib/sap/zen/crosstab/IHeaderCell.js +0 -21
- package/src/main/uilib/sap/zen/crosstab/PropertyBag.js +0 -209
- package/src/main/uilib/sap/zen/crosstab/RowHeaderArea.js +0 -71
- package/src/main/uilib/sap/zen/crosstab/SelectionHandler.js +0 -911
- package/src/main/uilib/sap/zen/crosstab/TextConstants.js +0 -9
- package/src/main/uilib/sap/zen/crosstab/TouchHandler.js +0 -438
- package/src/main/uilib/sap/zen/crosstab/datahandler/JsonDataHandler.js +0 -760
- package/src/main/uilib/sap/zen/crosstab/dragdrop/DragDropAreaRenderer.js +0 -436
- package/src/main/uilib/sap/zen/crosstab/dragdrop/DragDropHandler.js +0 -682
- package/src/main/uilib/sap/zen/crosstab/dragdrop/DragDropHoverManager.js +0 -467
- package/src/main/uilib/sap/zen/crosstab/dragdrop/DragDropUtils.js +0 -580
- package/src/main/uilib/sap/zen/crosstab/dragdrop/MemberDragDropHandler.js +0 -1154
- package/src/main/uilib/sap/zen/crosstab/keyboard/CrosstabKeyboardNavHandler.js +0 -635
- package/src/main/uilib/sap/zen/crosstab/library.js +0 -38
- package/src/main/uilib/sap/zen/crosstab/nonphx/logic.js +0 -11
- package/src/main/uilib/sap/zen/crosstab/paging/CellMerger.js +0 -284
- package/src/main/uilib/sap/zen/crosstab/paging/Page.js +0 -357
- package/src/main/uilib/sap/zen/crosstab/paging/PageManager.js +0 -437
- package/src/main/uilib/sap/zen/crosstab/paging/PagingConstants.js +0 -7
- package/src/main/uilib/sap/zen/crosstab/paging/RequestHandler.js +0 -97
- package/src/main/uilib/sap/zen/crosstab/paging/RequestStack.js +0 -108
- package/src/main/uilib/sap/zen/crosstab/rendering/CrossRequestManager.js +0 -462
- package/src/main/uilib/sap/zen/crosstab/rendering/DataModel.js +0 -250
- package/src/main/uilib/sap/zen/crosstab/rendering/DomElementProvider.js +0 -13
- package/src/main/uilib/sap/zen/crosstab/rendering/HeaderScrollManager.js +0 -97
- package/src/main/uilib/sap/zen/crosstab/rendering/PixelScrollManager.js +0 -180
- package/src/main/uilib/sap/zen/crosstab/rendering/RenderEngine.js +0 -2757
- package/src/main/uilib/sap/zen/crosstab/rendering/RenderingConstants.js +0 -56
- package/src/main/uilib/sap/zen/crosstab/rendering/ScrollManager.js +0 -638
- package/src/main/uilib/sap/zen/crosstab/rendering/ScrollbarRenderer.js +0 -542
- package/src/main/uilib/sap/zen/crosstab/utils/Measuring.js +0 -225
- package/src/main/uilib/sap/zen/crosstab/utils/Utils.js +0 -480
- /package/src/{main/uilib/sap → sap}/zen/crosstab/themes/base/ChartTypeSwitch.less +0 -0
- /package/src/{main/uilib/sap → sap}/zen/crosstab/themes/base/Crosstab.less +0 -0
- /package/src/{main/uilib/sap → sap}/zen/crosstab/themes/base/FilterBar.less +0 -0
- /package/src/{main/uilib/sap → sap}/zen/crosstab/themes/base/FilterPanel.less +0 -0
- /package/src/{main/uilib/sap → sap}/zen/crosstab/themes/base/Footerbar.less +0 -0
- /package/src/{main/uilib/sap → sap}/zen/crosstab/themes/base/InfoChart.less +0 -0
- /package/src/{main/uilib/sap → sap}/zen/crosstab/themes/base/NavigationPanel.less +0 -0
- /package/src/{main/uilib/sap → sap}/zen/crosstab/themes/base/chartconfig.less +0 -0
- /package/src/{main/uilib/sap → sap}/zen/crosstab/themes/base/img/CornerTornEffect.png +0 -0
- /package/src/{main/uilib/sap → sap}/zen/crosstab/themes/base/img/HTornEffect.png +0 -0
- /package/src/{main/uilib/sap → sap}/zen/crosstab/themes/base/img/HTornEffectData.png +0 -0
- /package/src/{main/uilib/sap → sap}/zen/crosstab/themes/base/img/HTornEffectHeader.png +0 -0
- /package/src/{main/uilib/sap → sap}/zen/crosstab/themes/base/img/VTornEffect.png +0 -0
- /package/src/{main/uilib/sap → sap}/zen/crosstab/themes/base/img/loading.gif +0 -0
- /package/src/{main/uilib/sap → sap}/zen/crosstab/themes/base/img/loading_comp.gif +0 -0
- /package/src/{main/uilib/sap → sap}/zen/crosstab/themes/base/library.source.less +0 -0
- /package/src/{main/uilib/sap → sap}/zen/crosstab/themes/base/zen.less +0 -0
- /package/src/{main/uilib/sap → sap}/zen/crosstab/themes/sap_belize/library.source.less +0 -0
- /package/src/{main/uilib/sap → sap}/zen/crosstab/themes/sap_belize_hcb/library.source.less +0 -0
- /package/src/{main/uilib/sap → sap}/zen/crosstab/themes/sap_belize_hcw/library.source.less +0 -0
- /package/src/{main/uilib/sap → sap}/zen/crosstab/themes/sap_belize_plus/library.source.less +0 -0
- /package/src/{main/uilib/sap → sap}/zen/crosstab/themes/sap_bluecrystal/library.source.less +0 -0
- /package/src/{main/uilib/sap → sap}/zen/crosstab/themes/sap_fiori_3/library.source.less +0 -0
- /package/src/{main/uilib/sap → sap}/zen/crosstab/themes/sap_fiori_3_dark/library.source.less +0 -0
- /package/src/{main/uilib/sap → sap}/zen/crosstab/themes/sap_fiori_3_hcb/library.source.less +0 -0
- /package/src/{main/uilib/sap → sap}/zen/crosstab/themes/sap_fiori_3_hcw/library.source.less +0 -0
- /package/src/{main/uilib/sap → sap}/zen/crosstab/themes/sap_hcb/Chart.less +0 -0
- /package/src/{main/uilib/sap → sap}/zen/crosstab/themes/sap_hcb/ChartTypeSwitch.less +0 -0
- /package/src/{main/uilib/sap → sap}/zen/crosstab/themes/sap_hcb/library.source.less +0 -0
|
@@ -1,1154 +0,0 @@
|
|
|
1
|
-
jQuery.sap.declare("sap.zen.crosstab.dragdrop.MemberDragDropHandler");
|
|
2
|
-
jQuery.sap.require("sap.zen.crosstab.dragdrop.DragDropUtils");
|
|
3
|
-
jQuery.sap.require("sap.zen.crosstab.dragdrop.DragDropAreaRenderer");
|
|
4
|
-
jQuery.sap.require("sap.zen.crosstab.dragdrop.DragDropHoverManager");
|
|
5
|
-
jQuery.sap.require("sap.zen.crosstab.TextConstants");
|
|
6
|
-
jQuery.sap.require("sap.zen.crosstab.utils.Utils");
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
sap.zen.crosstab.dragdrop.MemberDragDropHandler = function (oCrosstab, oDragDropCommands, oDragDropUtils, oDragDropAreaRenderer, oDragDropHoverManager) {
|
|
10
|
-
"use strict";
|
|
11
|
-
|
|
12
|
-
var that = this;
|
|
13
|
-
var oValidRowHeaderRect;
|
|
14
|
-
var oValidColHeaderRect;
|
|
15
|
-
var oPivotCell;
|
|
16
|
-
var bIsRepeatTexts;
|
|
17
|
-
|
|
18
|
-
var oMemberDropAreaAboveInfo = {"sIdSuffix" : "member_droparea_above", "sCssClassName" : "sapzencrosstab-rowAboveCellMemberDropArea"};
|
|
19
|
-
var oMemberDropAreaBelowInfo = {"sIdSuffix" : "member_droparea_below", "sCssClassName" : "sapzencrosstab-rowBelowCellMemberDropArea"};
|
|
20
|
-
var oMemberDropAreaBeforeInfo = {"sIdSuffix" : "member_droparea_before", "sCssClassName" : "sapzencrosstab-columnBeforeCellMemberDropArea"};
|
|
21
|
-
var oMemberDropAreaAfterInfo = {"sIdSuffix" : "member_droparea_after", "sCssClassName" : "sapzencrosstab-columnAfterCellMemberDropArea"};
|
|
22
|
-
|
|
23
|
-
this.init = function(p_oPivotCell) {
|
|
24
|
-
bIsRepeatTexts = oCrosstab.getPropertyBag().isRepeatTexts();
|
|
25
|
-
oPivotCell = p_oPivotCell;
|
|
26
|
-
oValidRowHeaderRect = oDragDropUtils.getBoundingClientRect(oCrosstab.getRowHeaderAreaDiv()[0]);
|
|
27
|
-
oValidColHeaderRect = oDragDropUtils.getBoundingClientRect(oCrosstab.getColHeaderAreaDiv()[0]);
|
|
28
|
-
this.removeRowHeaderDropAreas();
|
|
29
|
-
this.enableMemberDragDrop();
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
this.removeRowHeaderDropAreas = function() {
|
|
33
|
-
var oJqRenderSizeDiv;
|
|
34
|
-
if (!oCrosstab.getPropertyBag().isPixelScrolling()) {
|
|
35
|
-
oJqRenderSizeDiv = oCrosstab.getRenderSizeDiv();
|
|
36
|
-
oJqRenderSizeDiv.find(".sapzencrosstab-rowAboveCellMemberDropArea").remove();
|
|
37
|
-
oJqRenderSizeDiv.find(".sapzencrosstab-rowBelowCellMemberDropArea").remove();
|
|
38
|
-
oJqRenderSizeDiv.find(".sapzencrosstab-columnBeforeCellMemberDropArea").remove();
|
|
39
|
-
oJqRenderSizeDiv.find(".sapzencrosstab-columnAfterCellMemberDropArea").remove();
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
this.getMemberCellHtml = function(oCell) {
|
|
44
|
-
var oJqCell;
|
|
45
|
-
var oJqCellLayoutDiv;
|
|
46
|
-
var iWidth;
|
|
47
|
-
var sHtml;
|
|
48
|
-
|
|
49
|
-
oJqCell = $(document.getElementById(oCell.getId()));
|
|
50
|
-
oJqCellLayoutDiv = $(document.getElementById(oCell.getId() + "_cellLayoutDiv"));
|
|
51
|
-
iWidth = oJqCellLayoutDiv.outerWidth();
|
|
52
|
-
|
|
53
|
-
sHtml = "<td class=\"" + oJqCell.attr("class") + " sapzencrosstab-DragHeaderCell" + "\">";
|
|
54
|
-
sHtml += "<div style=\"width: " + iWidth + "px\">" + oCell.getText() + "</div></td>";
|
|
55
|
-
|
|
56
|
-
return sHtml;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
this.createMemberCellDragObject = function(oAnchorCell, aDragCells) {
|
|
60
|
-
var sHtml;
|
|
61
|
-
var sAxisName;
|
|
62
|
-
var sCssClassName;
|
|
63
|
-
var oCell;
|
|
64
|
-
var iHeight;
|
|
65
|
-
var i;
|
|
66
|
-
var iLength;
|
|
67
|
-
var oJqHelper;
|
|
68
|
-
|
|
69
|
-
if (oAnchorCell.getArea().isRowHeaderArea()) {
|
|
70
|
-
sCssClassName = "sapzencrosstab-RowHeaderArea";
|
|
71
|
-
} else if (oAnchorCell.getArea().isColHeaderArea()) {
|
|
72
|
-
sCssClassName = "sapzencrosstab-ColumnHeaderArea";
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
sHtml = "<table style=\"z-index: 9999;border-collapse: collapse\" class=\"" + sCssClassName + "\"><tbody>";
|
|
76
|
-
|
|
77
|
-
iLength = aDragCells.length;
|
|
78
|
-
|
|
79
|
-
sHtml += oDragDropUtils.getDeleteDragGhostCellRowHtml(iLength);
|
|
80
|
-
|
|
81
|
-
if (oAnchorCell.getArea().isRowHeaderArea()) {
|
|
82
|
-
oCell = aDragCells[0];
|
|
83
|
-
iHeight = $(document.getElementById(oCell.getId())).outerHeight();
|
|
84
|
-
sHtml += "<tr style=\"height: " + iHeight + "px\">";
|
|
85
|
-
|
|
86
|
-
for (i = 0; i < iLength; i++) {
|
|
87
|
-
oCell = aDragCells[i];
|
|
88
|
-
sHtml += this.getMemberCellHtml(oCell);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
sHtml += "</tr>";
|
|
92
|
-
} else if (oAnchorCell.getArea().isColHeaderArea()) {
|
|
93
|
-
for (i = 0; i < iLength; i++) {
|
|
94
|
-
oCell = aDragCells[i];
|
|
95
|
-
|
|
96
|
-
iHeight = $(document.getElementById(oCell.getId())).outerHeight();
|
|
97
|
-
sHtml += "<tr style=\"height: " + iHeight + "px\">";
|
|
98
|
-
sHtml += this.getMemberCellHtml(oCell);
|
|
99
|
-
|
|
100
|
-
sHtml += "</tr>";
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
sHtml += "</tbody></table>";
|
|
104
|
-
|
|
105
|
-
oJqHelper = $(sHtml);
|
|
106
|
-
|
|
107
|
-
oCrosstab.setDragAction(true);
|
|
108
|
-
return oJqHelper;
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
this.restrictDropIndexLimitsForHierarchyMember = function(oCell, oDropIndexLimits, sAxisName) {
|
|
112
|
-
var oRowHeaderArea = oCrosstab.getRowHeaderArea();
|
|
113
|
-
var oColHeaderArea = oCrosstab.getColumnHeaderArea();
|
|
114
|
-
var iRow;
|
|
115
|
-
var iCol;
|
|
116
|
-
var oTempCell;
|
|
117
|
-
var iFirstIndex = -1;
|
|
118
|
-
var iLastIndex = -1;
|
|
119
|
-
var oLastIndexCell = null;
|
|
120
|
-
var oFirstIndexCell = null;
|
|
121
|
-
|
|
122
|
-
if (oCell.getAlignment() === "TOP" || oCell.getAlignment === "DEFAULT") {
|
|
123
|
-
if (sAxisName === "ROWS") {
|
|
124
|
-
for (iRow = oDropIndexLimits.iMinIndex; iRow <= oDropIndexLimits.iMaxIndex; iRow++) {
|
|
125
|
-
oTempCell = oRowHeaderArea.getCellWithRowSpan(iRow, oCell.getCol(), true);
|
|
126
|
-
if (oTempCell && oTempCell.getLevel() === oCell.getLevel() && oTempCell.getParentMemberId() === oCell.getParentMemberId()) {
|
|
127
|
-
if (iFirstIndex < 0) {
|
|
128
|
-
iFirstIndex = iRow;
|
|
129
|
-
} else {
|
|
130
|
-
oLastIndexCell = oTempCell;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
if (iFirstIndex > -1) {
|
|
135
|
-
oDropIndexLimits.iMinIndex = iFirstIndex;
|
|
136
|
-
}
|
|
137
|
-
if (oLastIndexCell) {
|
|
138
|
-
oDropIndexLimits.iMaxIndex = oLastIndexCell.getRow() + oLastIndexCell.getRowSpan() - 1;
|
|
139
|
-
}
|
|
140
|
-
} else if (sAxisName === "COLS") {
|
|
141
|
-
for (iCol = oDropIndexLimits.iMinIndex; iCol <= oDropIndexLimits.iMaxIndex; iCol++) {
|
|
142
|
-
oTempCell = oColHeaderArea.getCellWithColSpan(oCell.getRow(), iCol, true);
|
|
143
|
-
if (oTempCell && oTempCell.getLevel() === oCell.getLevel() && oTempCell.getParentMemberId() === oCell.getParentMemberId()) {
|
|
144
|
-
if (iFirstIndex < 0) {
|
|
145
|
-
iFirstIndex = iCol;
|
|
146
|
-
} else {
|
|
147
|
-
oLastIndexCell = oTempCell;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
if (iFirstIndex > -1) {
|
|
152
|
-
oDropIndexLimits.iMinIndex = iFirstIndex;
|
|
153
|
-
}
|
|
154
|
-
if (oLastIndexCell) {
|
|
155
|
-
oDropIndexLimits.iMaxIndex = oLastIndexCell.getCol() + oLastIndexCell.getColSpan() - 1;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
} else {
|
|
159
|
-
if (sAxisName === "ROWS") {
|
|
160
|
-
for (iRow = oDropIndexLimits.iMaxIndex; iRow >= oDropIndexLimits.iMinIndex; iRow--) {
|
|
161
|
-
oTempCell = oRowHeaderArea.getCellWithRowSpan(iRow, oCell.getCol(), true);
|
|
162
|
-
if (oTempCell && oTempCell.getLevel() === oCell.getLevel() && oTempCell.getParentMemberId() === oCell.getParentMemberId()) {
|
|
163
|
-
if (iLastIndex < 0) {
|
|
164
|
-
iLastIndex = iRow;
|
|
165
|
-
} else {
|
|
166
|
-
oFirstIndexCell = oTempCell;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
if (oFirstIndexCell) {
|
|
171
|
-
oDropIndexLimits.iMinIndex = oFirstIndexCell.getRow();
|
|
172
|
-
}
|
|
173
|
-
if (iLastIndex > -1) {
|
|
174
|
-
oDropIndexLimits.iMaxIndex = iLastIndex;
|
|
175
|
-
}
|
|
176
|
-
} else if (sAxisName === "COLS") {
|
|
177
|
-
for (iCol = oDropIndexLimits.iMaxIndex; iCol >= oDropIndexLimits.iMinIndex; iCol--) {
|
|
178
|
-
oTempCell = oColHeaderArea.getCellWithColSpan(oCell.getRow(), iCol, true);
|
|
179
|
-
if (oTempCell && oTempCell.getLevel() === oCell.getLevel() && oTempCell.getParentMemberId() === oCell.getParentMemberId()) {
|
|
180
|
-
if (iLastIndex < 0) {
|
|
181
|
-
iLastIndex = iCol;
|
|
182
|
-
} else {
|
|
183
|
-
oFirstIndexCell = oTempCell;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
if (oFirstIndexCell) {
|
|
188
|
-
oDropIndexLimits.iMinIndex = oFirstIndexCell.getCol();
|
|
189
|
-
}
|
|
190
|
-
if (iLastIndex > -1) {
|
|
191
|
-
oDropIndexLimits.iMaxIndex = iLastIndex;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
return oDropIndexLimits;
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
this.filterResultCellsFromDropIndexLimits = function(oDropIndexLimits, oCell, sAxisName) {
|
|
199
|
-
var oTempCell;
|
|
200
|
-
var oRowHeaderArea = oCrosstab.getRowHeaderArea();
|
|
201
|
-
var oColHeaderArea = oCrosstab.getColumnHeaderArea();
|
|
202
|
-
var iRow;
|
|
203
|
-
var iCol;
|
|
204
|
-
|
|
205
|
-
if (sAxisName === "ROWS") {
|
|
206
|
-
iRow = oDropIndexLimits.iMinIndex;
|
|
207
|
-
oTempCell = oRowHeaderArea.getCellWithRowSpan(iRow, oCell.getCol());
|
|
208
|
-
if (!oTempCell) {
|
|
209
|
-
oTempCell = oRowHeaderArea.getCellWithColSpan(iRow, oCell.getCol());
|
|
210
|
-
}
|
|
211
|
-
while (oTempCell && oTempCell.isResult() && iRow < oDropIndexLimits.iMaxIndex) {
|
|
212
|
-
oDropIndexLimits.iMinIndex = oTempCell.getRow() + oTempCell.getRowSpan();
|
|
213
|
-
iRow++;
|
|
214
|
-
oTempCell = oRowHeaderArea.getCellWithColSpan(iRow, oCell.getCol());
|
|
215
|
-
}
|
|
216
|
-
iRow = oDropIndexLimits.iMaxIndex;
|
|
217
|
-
oTempCell = oRowHeaderArea.getCellWithRowSpan(iRow, oCell.getCol());
|
|
218
|
-
if (!oTempCell) {
|
|
219
|
-
oTempCell = oRowHeaderArea.getCellWithColSpan(iRow, oCell.getCol());
|
|
220
|
-
}
|
|
221
|
-
while (oTempCell && oTempCell.isResult() && iRow > oDropIndexLimits.iMinIndex) {
|
|
222
|
-
oDropIndexLimits.iMaxIndex = oTempCell.getRow() - 1;
|
|
223
|
-
iRow--;
|
|
224
|
-
oTempCell = oRowHeaderArea.getCellWithColSpan(iRow, oCell.getCol());
|
|
225
|
-
}
|
|
226
|
-
} else if (sAxisName === "COLS") {
|
|
227
|
-
iCol = oDropIndexLimits.iMinIndex;
|
|
228
|
-
oTempCell = oColHeaderArea.getCellWithColSpan(oCell.getRow(), iCol);
|
|
229
|
-
if (!oTempCell) {
|
|
230
|
-
oTempCell = oColHeaderArea.getCellWithRowSpan(iRow, oCell.getCol());
|
|
231
|
-
}
|
|
232
|
-
while (oTempCell && oTempCell.isResult() && iCol < oDropIndexLimits.iMaxIndex) {
|
|
233
|
-
oDropIndexLimits.iMinIndex = oTempCell.getCol() + oTempCell.getColSpan();
|
|
234
|
-
iCol++;
|
|
235
|
-
oTempCell = oColHeaderArea.getCellWithRowSpan(oCell.getRow(), iCol);
|
|
236
|
-
}
|
|
237
|
-
iCol = oDropIndexLimits.iMaxIndex;
|
|
238
|
-
oTempCell = oColHeaderArea.getCellWithColSpan(oCell.getRow(), iCol);
|
|
239
|
-
if (!oTempCell) {
|
|
240
|
-
oTempCell = oColHeaderArea.getCellWithRowSpan(iRow, oCell.getCol());
|
|
241
|
-
}
|
|
242
|
-
while (oTempCell && oTempCell.isResult() && iRow > oDropIndexLimits.iMinIndex) {
|
|
243
|
-
oDropIndexLimits.iMaxIndex = oTempCell.getCol() - 1;
|
|
244
|
-
iCol--;
|
|
245
|
-
oTempCell = oColHeaderArea.getCellWithRowSpan(oCell.getRow(), iCol);
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
return oDropIndexLimits;
|
|
249
|
-
};
|
|
250
|
-
|
|
251
|
-
this.determineDropIndexLimitsFromPeerCell = function(oPeerCell, sAxisName) {
|
|
252
|
-
var i = 0;
|
|
253
|
-
var iBeginIndex;
|
|
254
|
-
var iEndIndex;
|
|
255
|
-
var oArea;
|
|
256
|
-
var oCell;
|
|
257
|
-
var oDropIndexLimits = {};
|
|
258
|
-
|
|
259
|
-
oDropIndexLimits.iMinIndex = -1;
|
|
260
|
-
oDropIndexLimits.iMaxIndex = -1;
|
|
261
|
-
if (bIsRepeatTexts && oPeerCell.getMergeKey() && oPeerCell.getMergeKey().length > 0) {
|
|
262
|
-
if (sAxisName === "COLS") {
|
|
263
|
-
oArea = oCrosstab.getColHeaderArea();
|
|
264
|
-
iBeginIndex = oArea.getRenderStartCol();
|
|
265
|
-
iEndIndex = iBeginIndex + oArea.getRenderColCnt();
|
|
266
|
-
for (i = iBeginIndex; (i < iEndIndex) && (oDropIndexLimits.iMaxIndex === -1); i++) {
|
|
267
|
-
oCell = oArea.getCell(oPeerCell.getRow(), i);
|
|
268
|
-
if (oCell.getMergeKey() === oPeerCell.getMergeKey() && oDropIndexLimits.iMinIndex === -1) {
|
|
269
|
-
oDropIndexLimits.iMinIndex = i;
|
|
270
|
-
}
|
|
271
|
-
if (oCell.getMergeKey() !== oPeerCell.getMergeKey() && oDropIndexLimits.iMinIndex > -1) {
|
|
272
|
-
oDropIndexLimits.iMaxIndex = i - 1;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
} else {
|
|
276
|
-
oArea = oCrosstab.getRowHeaderArea();
|
|
277
|
-
iBeginIndex = oArea.getRenderStartRow();
|
|
278
|
-
iEndIndex = iBeginIndex + oArea.getRenderRowCnt();
|
|
279
|
-
for (i = iBeginIndex; (i < iEndIndex) && (oDropIndexLimits.iMaxIndex === -1); i++) {
|
|
280
|
-
oCell = oArea.getCell(i, oPeerCell.getCol());
|
|
281
|
-
if (oCell.getMergeKey() === oPeerCell.getMergeKey() && oDropIndexLimits.iMinIndex === -1) {
|
|
282
|
-
oDropIndexLimits.iMinIndex = i;
|
|
283
|
-
}
|
|
284
|
-
if (oCell.getMergeKey() !== oPeerCell.getMergeKey() && oDropIndexLimits.iMinIndex > -1) {
|
|
285
|
-
oDropIndexLimits.iMaxIndex = i - 1;
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
if (oDropIndexLimits.iMaxIndex === -1) {
|
|
290
|
-
oDropIndexLimits.iMaxIndex = iEndIndex;
|
|
291
|
-
}
|
|
292
|
-
} else {
|
|
293
|
-
if (sAxisName === "COLS") {
|
|
294
|
-
oDropIndexLimits.iMinIndex = oPeerCell.getCol();
|
|
295
|
-
oDropIndexLimits.iMaxIndex = oPeerCell.getCol() + oPeerCell.getColSpan() - 1;
|
|
296
|
-
} else {
|
|
297
|
-
oDropIndexLimits.iMinIndex = oPeerCell.getRow();
|
|
298
|
-
oDropIndexLimits.iMaxIndex = oPeerCell.getRow() + oPeerCell.getRowSpan() - 1;
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
return oDropIndexLimits;
|
|
303
|
-
};
|
|
304
|
-
|
|
305
|
-
this.findDropIndexLimits = function(oCell, oDimInfo) {
|
|
306
|
-
var oDropIndexLimits = {};
|
|
307
|
-
var iIndex;
|
|
308
|
-
var oPeerCell;
|
|
309
|
-
|
|
310
|
-
iIndex = oCrosstab.getHeaderInfo().findStartIndexOfPreviousDimension(oDimInfo.sDimensionName, oDimInfo.sAxisName);
|
|
311
|
-
if (oDimInfo.sAxisName === "ROWS") {
|
|
312
|
-
if (!oCrosstab.getHeaderInfo().isFirstDimensionOnAxis(oDimInfo)) {
|
|
313
|
-
oPeerCell = oCrosstab.getRowHeaderArea().getCellWithRowSpan(oCell.getRow(), iIndex);
|
|
314
|
-
oDropIndexLimits = this.determineDropIndexLimitsFromPeerCell(oPeerCell, oDimInfo.sAxisName);
|
|
315
|
-
} else {
|
|
316
|
-
oDropIndexLimits.iMinIndex = oCrosstab.getRowHeaderArea().getRenderStartRow();
|
|
317
|
-
oDropIndexLimits.iMaxIndex = oDropIndexLimits.iMinIndex + oCrosstab.getRowHeaderArea().getRenderRowCnt() - 1;
|
|
318
|
-
}
|
|
319
|
-
} else if (oDimInfo.sAxisName === "COLS") {
|
|
320
|
-
if (!oCrosstab.getHeaderInfo().isFirstDimensionOnAxis(oDimInfo)) {
|
|
321
|
-
oPeerCell = oCrosstab.getColumnHeaderArea().getCellWithColSpan(iIndex, oCell.getCol());
|
|
322
|
-
oDropIndexLimits = this.determineDropIndexLimitsFromPeerCell(oPeerCell, oDimInfo.sAxisName);
|
|
323
|
-
} else {
|
|
324
|
-
oDropIndexLimits.iMinIndex = oCrosstab.getColumnHeaderArea().getRenderStartCol();
|
|
325
|
-
oDropIndexLimits.iMaxIndex = oDropIndexLimits.iMinIndex + oCrosstab.getColumnHeaderArea().getRenderColCnt() - 1;
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
oDropIndexLimits = this.filterResultCellsFromDropIndexLimits(oDropIndexLimits, oCell, oDimInfo.sAxisName);
|
|
330
|
-
|
|
331
|
-
if (oCell.getLevel() > -1) {
|
|
332
|
-
oDropIndexLimits = this.restrictDropIndexLimitsForHierarchyMember(oCell, oDropIndexLimits, oDimInfo.sAxisName);
|
|
333
|
-
}
|
|
334
|
-
return oDropIndexLimits;
|
|
335
|
-
};
|
|
336
|
-
|
|
337
|
-
this.findPreviousPeerCell = function(oCell, sAxisName, oIndexLimits) {
|
|
338
|
-
var oRowHeaderArea = oCrosstab.getRowHeaderArea();
|
|
339
|
-
var oColHeaderArea = oCrosstab.getColumnHeaderArea();
|
|
340
|
-
var oTempCell;
|
|
341
|
-
var iRow;
|
|
342
|
-
var iCol;
|
|
343
|
-
var oPeerCell = null;
|
|
344
|
-
|
|
345
|
-
if (oCell.getAlignment() === "TOP" || oCell.getAlignment === "DEFAULT") {
|
|
346
|
-
if (sAxisName === "ROWS") {
|
|
347
|
-
for (iRow = oCell.getRow(); iRow >= oIndexLimits.iMinIndex && !oPeerCell; iRow--) {
|
|
348
|
-
oTempCell = oRowHeaderArea.getCellWithRowSpan(iRow, oCell.getCol(), true);
|
|
349
|
-
if (oTempCell && oTempCell.getId() !== oCell.getId() && oTempCell.getLevel() === oCell.getLevel()) {
|
|
350
|
-
oPeerCell = oTempCell;
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
} else if (sAxisName === "COLS") {
|
|
354
|
-
for (iCol = oCell.getCol(); iCol >= oIndexLimits.iMinIndex && !oPeerCell; iCol--) {
|
|
355
|
-
oTempCell = oColHeaderArea.getCellWithColSpan(oCell.getRow(), iCol, true);
|
|
356
|
-
if (oTempCell && oTempCell.getId() !== oCell.getId() && oTempCell.getLevel() === oCell.getLevel()) {
|
|
357
|
-
oPeerCell = oTempCell;
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
} else {
|
|
362
|
-
if (sAxisName === "ROWS") {
|
|
363
|
-
for (iRow = oCell.getRow(); iRow <= oIndexLimits.iMaxIndex && !oPeerCell; iRow++) {
|
|
364
|
-
oTempCell = oRowHeaderArea.getCellWithRowSpan(iRow, oCell.getCol(), true);
|
|
365
|
-
if (oTempCell && oTempCell.getId() !== oCell.getId() && oTempCell.getLevel() === oCell.getLevel()) {
|
|
366
|
-
oPeerCell = oTempCell;
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
} else if (sAxisName === "COLS") {
|
|
370
|
-
for (iCol = oCell.getCol(); iCol <= oIndexLimits.iMaxIndex && !oPeerCell; iCol++) {
|
|
371
|
-
oTempCell = oColHeaderArea.getCellWithColSpan(oCell.getRow(), iCol, true);
|
|
372
|
-
if (oTempCell && oTempCell.getId() !== oCell.getId() && oTempCell.getLevel() === oCell.getLevel()) {
|
|
373
|
-
oPeerCell = oTempCell;
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
if (oPeerCell) {
|
|
380
|
-
if (oPeerCell.getParentMemberId() !== oCell.getParentMemberId()) {
|
|
381
|
-
oPeerCell = null;
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
return oPeerCell;
|
|
386
|
-
};
|
|
387
|
-
|
|
388
|
-
function memberCellDraggableHelper(e) {
|
|
389
|
-
var oCell;
|
|
390
|
-
var oDragCell;
|
|
391
|
-
var oHeaderInfo;
|
|
392
|
-
var aDragCells;
|
|
393
|
-
var oJqHelper;
|
|
394
|
-
var oPayload;
|
|
395
|
-
var oDimInfo;
|
|
396
|
-
var oCoordinates;
|
|
397
|
-
var i;
|
|
398
|
-
var oDropIndexLimits;
|
|
399
|
-
|
|
400
|
-
oHeaderInfo = oCrosstab.getHeaderInfo();
|
|
401
|
-
oDragCell = oDragDropHoverManager.getCellFromJqCell(this);
|
|
402
|
-
oCell = oDragDropUtils.getEffectiveCell(oDragCell);
|
|
403
|
-
if (oCell) {
|
|
404
|
-
oDragDropUtils.setCurrentJqDragCell($(document.getElementById(oCell.getId())));
|
|
405
|
-
if (bIsRepeatTexts) {
|
|
406
|
-
aDragCells = oDragDropUtils.getAllMemberCellsInRowOrCol(oCell);
|
|
407
|
-
} else {
|
|
408
|
-
aDragCells = oHeaderInfo.getMemberCellsForSameDimension(oCell);
|
|
409
|
-
}
|
|
410
|
-
oDragDropUtils.saveRevertCellPosInfo(oDragCell, aDragCells);
|
|
411
|
-
oJqHelper = that.createMemberCellDragObject(oCell, aDragCells);
|
|
412
|
-
oDragDropUtils.setCursorAt(oDragCell, oJqHelper);
|
|
413
|
-
|
|
414
|
-
oDimInfo = oHeaderInfo.getDimensionInfoForMemberCell(oCell);
|
|
415
|
-
oPayload = sap.zen.Dispatcher.instance.createDragDropPayload(oCrosstab.getId());
|
|
416
|
-
oPayload.oDragDropInfo = oDragDropUtils.buildDimensionDragDropInfo(oDimInfo);
|
|
417
|
-
|
|
418
|
-
// DropIndexLimits
|
|
419
|
-
oDropIndexLimits = that.findDropIndexLimits(oCell, oDimInfo);
|
|
420
|
-
oPayload.oDragDropInfo.oDropIndexLimits = oDropIndexLimits;
|
|
421
|
-
|
|
422
|
-
// Hierarchy information
|
|
423
|
-
if (oCell.getLevel() > -1) {
|
|
424
|
-
oPayload.oDragDropInfo.bIsHierarchyMember = true;
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
oPayload.oDragDropInfo.bIsMemberDrag = true;
|
|
428
|
-
oCoordinates = oCrosstab.getUtils().translateCellCoordinatesForBackend(oCell);
|
|
429
|
-
if (oCoordinates) {
|
|
430
|
-
oPayload.oDragDropInfo.iMemberRow = oCoordinates.row;
|
|
431
|
-
oPayload.oDragDropInfo.iMemberCol = oCoordinates.col;
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
sap.zen.Dispatcher.instance.setDragDropPayload(oPayload);
|
|
435
|
-
}
|
|
436
|
-
return oJqHelper;
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
this.checkBasicMemberDropAccept = function(oPayload, sDropAxisName) {
|
|
440
|
-
if (!oPayload) {
|
|
441
|
-
return false;
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
if (oPayload.oDragDropInfo.sAxisName !== sDropAxisName) {
|
|
445
|
-
return false;
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
if (oDragDropUtils.isDragFromOtherCrosstab(oPayload)) {
|
|
449
|
-
return false;
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
if (oDragDropUtils.isInterComponentDrag(oPayload)) {
|
|
453
|
-
return false;
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
if (!oPayload.oDragDropInfo.bIsMemberDrag) {
|
|
457
|
-
return false;
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
return true;
|
|
461
|
-
};
|
|
462
|
-
|
|
463
|
-
this.returnFromMemberCellAcceptCheck = function(oCell, bAccept) {
|
|
464
|
-
oCell.setRevertDrop(!bAccept);
|
|
465
|
-
sap.zen.Dispatcher.instance.setDropAccepted(oCell.getId(), bAccept);
|
|
466
|
-
return bAccept;
|
|
467
|
-
};
|
|
468
|
-
|
|
469
|
-
this.checkDropLimitsAgainstCells = function(oDragCell, oDropCell, oDropIndexLimits, sAxisName) {
|
|
470
|
-
var bAccept;
|
|
471
|
-
var iIndex;
|
|
472
|
-
|
|
473
|
-
if (oDropIndexLimits.iMinIndex === -1 && oDropIndexLimits.iMaxIndex === -1) {
|
|
474
|
-
return true;
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
if (oDropIndexLimits.iMinIndex === oDropIndexLimits.iMaxIndex) {
|
|
478
|
-
return false;
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
bAccept = true;
|
|
482
|
-
|
|
483
|
-
if (sAxisName === "ROWS") {
|
|
484
|
-
if (oDragCell.getRow() === oDropCell.getRow()) {
|
|
485
|
-
bAccept = false;
|
|
486
|
-
} else {
|
|
487
|
-
if (oDragCell.getCol() > 0) {
|
|
488
|
-
iIndex = oDropCell.getRow() + oDropCell.getRowSpan() - 1;
|
|
489
|
-
bAccept = oDropIndexLimits.iMinIndex <= iIndex && oDropIndexLimits.iMaxIndex >= iIndex;
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
} else if (sAxisName === "COLS") {
|
|
493
|
-
if (oDragCell.getCol() === oDropCell.getCol()) {
|
|
494
|
-
bAccept = false;
|
|
495
|
-
} else {
|
|
496
|
-
if (oDragCell.getRow() > 0) {
|
|
497
|
-
iIndex = oDropCell.getCol() + oDropCell.getColSpan() - 1;
|
|
498
|
-
bAccept = oDropIndexLimits.iMinIndex <= iIndex && oDropIndexLimits.iMaxIndex >= iIndex;
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
} else {
|
|
502
|
-
bAccept = false;
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
return bAccept;
|
|
506
|
-
};
|
|
507
|
-
|
|
508
|
-
this.checkMatchingHierarchyLevels = function(oDragCell, oDropCell) {
|
|
509
|
-
if (oDropCell.getLevel() > -1 && oDragCell.getLevel() > -1) {
|
|
510
|
-
// Hierarchy node/leaf must have same level and same parent
|
|
511
|
-
return (oDropCell.getLevel() === oDragCell.getLevel() && oDropCell.getParentMemberId() === oDragCell.getParentMemberId());
|
|
512
|
-
}
|
|
513
|
-
return true;
|
|
514
|
-
};
|
|
515
|
-
|
|
516
|
-
function checkMemberCellDropAccept(oDraggable) {
|
|
517
|
-
var oDropCell;
|
|
518
|
-
var oDragCell;
|
|
519
|
-
var oPayload;
|
|
520
|
-
var oDropIndexLimits;
|
|
521
|
-
var bAccept;
|
|
522
|
-
var oDragDropInfo;
|
|
523
|
-
var oDropDimensionInfo;
|
|
524
|
-
|
|
525
|
-
if (!oCrosstab.isDragAction() || oCrosstab.isBlocked()) {
|
|
526
|
-
return false;
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
oPayload = sap.zen.Dispatcher.instance.getDragDropPayload();
|
|
530
|
-
oDragDropInfo = oPayload.oDragDropInfo;
|
|
531
|
-
oDropCell = oDragDropHoverManager.getCellFromJqCell($(this));
|
|
532
|
-
oDropCell = oDragDropUtils.getEffectiveCell(oDropCell);
|
|
533
|
-
oDropDimensionInfo = oCrosstab.getHeaderInfo().getDimensionInfoForMemberCell(oDropCell);
|
|
534
|
-
|
|
535
|
-
if (!that.checkBasicMemberDropAccept(oPayload, oDropDimensionInfo.sAxisName)) {
|
|
536
|
-
return that.returnFromMemberCellAcceptCheck(oDropCell, false);
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
oDropIndexLimits = oPayload.oDragDropInfo.oDropIndexLimits;
|
|
540
|
-
oDragCell = oDragDropHoverManager.getCellFromJqCell(oDraggable);
|
|
541
|
-
oDragCell = oDragDropUtils.getEffectiveCell(oDragCell);
|
|
542
|
-
|
|
543
|
-
bAccept = that.checkDropLimitsAgainstCells(oDragCell, oDropCell, oDropIndexLimits, oDragDropInfo.sAxisName);
|
|
544
|
-
if (!bAccept) {
|
|
545
|
-
return that.returnFromMemberCellAcceptCheck(oDropCell, false);
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
bAccept = that.checkMatchingHierarchyLevels(oDragCell, oDropCell);
|
|
549
|
-
if (!bAccept) {
|
|
550
|
-
return that.returnFromMemberCellAcceptCheck(oDropCell, false);
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
return that.returnFromMemberCellAcceptCheck(oDropCell, true);
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
this.returnFromMemberAreaAcceptCheck = function(oJqArea, bAccept) {
|
|
557
|
-
oJqArea.data("xtabrevertdrop", !bAccept);
|
|
558
|
-
sap.zen.Dispatcher.instance.setDropAccepted(oJqArea.attr("id"), bAccept);
|
|
559
|
-
return bAccept;
|
|
560
|
-
};
|
|
561
|
-
|
|
562
|
-
this.checkDropAreaDropLimits = function(oDragCell, oDropCell, oDropIndexLimits, sAxisName, bIsBeginArea) {
|
|
563
|
-
var oAreaIndexLimits;
|
|
564
|
-
var bAccept;
|
|
565
|
-
|
|
566
|
-
if (oDropIndexLimits.iMinIndex !== oDropIndexLimits.iMaxIndex && !bIsBeginArea) {
|
|
567
|
-
// Bottom of a result cell should not be active drop area if result cell
|
|
568
|
-
// is last cell in the allowed index block, since results cannot be reordered
|
|
569
|
-
if (oDropCell.isResult()) {
|
|
570
|
-
if (sAxisName === "ROWS") {
|
|
571
|
-
if (oDropCell.getRow() + oDropCell.getRowSpan() - 1 === oDropIndexLimits.iMaxIndex) {
|
|
572
|
-
return false;
|
|
573
|
-
}
|
|
574
|
-
} else if (sAxisName === "COLS") {
|
|
575
|
-
if (oDropCell.getCol() + oDropCell.getColSpan() - 1 === oDropIndexLimits.iMaxIndex) {
|
|
576
|
-
return false;
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
// adjust the limits for area logic: allow one further up for min index to get the droparea of the next cell
|
|
581
|
-
// so stuff can be shoved ahead of the top cell in the allowed block
|
|
582
|
-
oAreaIndexLimits = {"iMinIndex" : Math.max(0, oDropIndexLimits.iMinIndex - 1), "iMaxIndex" : oDropIndexLimits.iMaxIndex};
|
|
583
|
-
} else {
|
|
584
|
-
oAreaIndexLimits = oDropIndexLimits;
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
bAccept = this.checkDropLimitsAgainstCells(oDragCell, oDropCell, oAreaIndexLimits, sAxisName);
|
|
588
|
-
|
|
589
|
-
return bAccept;
|
|
590
|
-
};
|
|
591
|
-
|
|
592
|
-
this.getDropCellFromAnchorCell = function(oAnchorCell, oDragCell, sAxisName, bIsBeginArea) {
|
|
593
|
-
var oDropCell = null;
|
|
594
|
-
var i;
|
|
595
|
-
|
|
596
|
-
// Can only move within row in col header or within col in row header!
|
|
597
|
-
if (sAxisName === "ROWS") {
|
|
598
|
-
oDropCell = oCrosstab.getRowHeaderArea().getCellWithColSpan(oAnchorCell.getRow(), oDragCell.getCol(), true);
|
|
599
|
-
if (!oDropCell) {
|
|
600
|
-
oDropCell = oCrosstab.getRowHeaderArea().getCellWithRowSpan(oAnchorCell.getRow(), oDragCell.getCol(), true);
|
|
601
|
-
}
|
|
602
|
-
if (oDropCell && !bIsBeginArea) {
|
|
603
|
-
if ((oAnchorCell.getRow() + oAnchorCell.getRowSpan()) !== (oDropCell.getRow() + oDropCell.getRowSpan())) {
|
|
604
|
-
oDropCell = null;
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
} else if (sAxisName === "COLS") {
|
|
608
|
-
oDropCell = oCrosstab.getColumnHeaderArea().getCellWithRowSpan(oDragCell.getRow(), oAnchorCell.getCol(), true);
|
|
609
|
-
if (!oDropCell) {
|
|
610
|
-
oDropCell = oCrosstab.getColumnHeaderArea().getCellWithColSpan(oDragCell.getRow(), oAnchorCell.getCol(), true);
|
|
611
|
-
}
|
|
612
|
-
if (oDropCell && !bIsBeginArea) {
|
|
613
|
-
if ((oAnchorCell.getCol() + oAnchorCell.getColSpan()) !== (oDropCell.getCol() + oDropCell.getColSpan())) {
|
|
614
|
-
oDropCell = null;
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
return oDropCell;
|
|
619
|
-
};
|
|
620
|
-
|
|
621
|
-
this.checkAreaMoveOnPreviousCell = function(oDragCell, oDropCell, oAnchorCell, sAxisName, bIsBeginArea) {
|
|
622
|
-
if (sAxisName === "ROWS") {
|
|
623
|
-
if (oDropCell.getRow() === oDragCell.getRow() || (oAnchorCell.getRow() + oAnchorCell.getRowSpan()) === oDragCell.getRow()) {
|
|
624
|
-
if (!bIsBeginArea) {
|
|
625
|
-
return false;
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
} else if (sAxisName === "COLS") {
|
|
629
|
-
if (oDropCell.getCol() === oDragCell.getCol() || (oAnchorCell.getCol() + oAnchorCell.getColSpan()) === oDragCell.getCol()) {
|
|
630
|
-
if (!bIsBeginArea) {
|
|
631
|
-
return false;
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
return true;
|
|
636
|
-
};
|
|
637
|
-
|
|
638
|
-
this.isDropCellOneBelowOrBeforeBlock = function(oDropCell, oDropIndexLimits, sAxisName) {
|
|
639
|
-
var iIndex;
|
|
640
|
-
if (sAxisName === "ROWS") {
|
|
641
|
-
iIndex = oDropCell.getRow() + oDropCell.getRowSpan() - 1;
|
|
642
|
-
} else if (sAxisName === "COLS") {
|
|
643
|
-
iIndex = oDropCell.getCol() + oDropCell.getColSpan() - 1;
|
|
644
|
-
}
|
|
645
|
-
return (Math.max(0, iIndex) === Math.max(0, (oDropIndexLimits.iMinIndex - 1)));
|
|
646
|
-
};
|
|
647
|
-
|
|
648
|
-
this.getNextCell = function(oCell, sAxisName) {
|
|
649
|
-
var oFollowingCell;
|
|
650
|
-
|
|
651
|
-
if (sAxisName === "ROWS") {
|
|
652
|
-
oFollowingCell = oCrosstab.getRowHeaderArea().getCellWithRowSpan(oCell.getRow() + oCell.getRowSpan(), oCell.getCol());
|
|
653
|
-
} else if (sAxisName === "COLS") {
|
|
654
|
-
oFollowingCell = oCrosstab.getColumnHeaderArea().getCellWithColSpan(oCell.getRow(), oCell.getCol() + oCell.getColSpan());
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
return oFollowingCell;
|
|
658
|
-
};
|
|
659
|
-
|
|
660
|
-
this.checkAreaMoveOnPreviousHierarchyPeerOrBeginOfFollowing = function(oDragCell, oDropCell, oDropIndexLimits, sAxisName, bIsBeginArea) {
|
|
661
|
-
var oPrevPeerCell;
|
|
662
|
-
var oParentCell;
|
|
663
|
-
var oFollowingCell;
|
|
664
|
-
var oCheckLevelDropCell = oDropCell;
|
|
665
|
-
|
|
666
|
-
if (oDragCell.getLevel() > -1 && oDropCell.getLevel() > -1) {
|
|
667
|
-
// for hierarchies, check it is not previous peer with same level and same parent
|
|
668
|
-
oPrevPeerCell = this.findPreviousPeerCell(oDragCell, sAxisName, oDropIndexLimits);
|
|
669
|
-
if (oPrevPeerCell) {
|
|
670
|
-
if (oDropCell.getId() === oPrevPeerCell.getId()) {
|
|
671
|
-
return false;
|
|
672
|
-
}
|
|
673
|
-
if ((sAxisName === "ROWS" && (oDropCell.getRow() + oDropCell.getRowSpan() - 1) === (oPrevPeerCell.getRow() - 1)) ||
|
|
674
|
-
(sAxisName === "COLS" && (oDropCell.getCol() + oDropCell.getColSpan() - 1) === (oPrevPeerCell.getCol() - 1))) {
|
|
675
|
-
if (oDragCell.getLevel() !== oDropCell.getLevel() && bIsBeginArea) {
|
|
676
|
-
return false;
|
|
677
|
-
}
|
|
678
|
-
} else {
|
|
679
|
-
if (!this.isDropCellOneBelowOrBeforeBlock(oDropCell, oDropIndexLimits, sAxisName)) {
|
|
680
|
-
if (!this.checkMatchingHierarchyLevels(oDragCell, oDropCell)) {
|
|
681
|
-
return false;
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
} else {
|
|
686
|
-
if (!this.isDropCellOneBelowOrBeforeBlock(oDropCell, oDropIndexLimits, sAxisName)) {
|
|
687
|
-
if (!bIsBeginArea && oDropCell.getLevel() !== oDragCell.getLevel()) {
|
|
688
|
-
oFollowingCell = this.getNextCell(oDropCell, sAxisName);
|
|
689
|
-
if (oFollowingCell) {
|
|
690
|
-
oPrevPeerCell = this.findPreviousPeerCell(oFollowingCell, sAxisName, oDropIndexLimits);
|
|
691
|
-
if (oPrevPeerCell && oPrevPeerCell.getId() === oDragCell.getId()) {
|
|
692
|
-
return false;
|
|
693
|
-
}
|
|
694
|
-
oCheckLevelDropCell = oFollowingCell;
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
if (!this.checkMatchingHierarchyLevels(oDragCell, oCheckLevelDropCell)) {
|
|
698
|
-
return false;
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
return true;
|
|
704
|
-
};
|
|
705
|
-
|
|
706
|
-
function checkMemberDropAreaAccept(oDraggable) {
|
|
707
|
-
var oPayload;
|
|
708
|
-
var oJqArea;
|
|
709
|
-
var oDropCell;
|
|
710
|
-
var oDragCell;
|
|
711
|
-
var sAreaType;
|
|
712
|
-
var sDropAxisName;
|
|
713
|
-
var sDragAxisName;
|
|
714
|
-
var bAccept;
|
|
715
|
-
var bIsBeginArea;
|
|
716
|
-
var oDropIndexLimits;
|
|
717
|
-
var oDragDropInfo;
|
|
718
|
-
var oAnchorCell;
|
|
719
|
-
|
|
720
|
-
if (!oCrosstab.isDragAction() || oCrosstab.isBlocked()) {
|
|
721
|
-
return false;
|
|
722
|
-
}
|
|
723
|
-
|
|
724
|
-
oPayload = sap.zen.Dispatcher.instance.getDragDropPayload();
|
|
725
|
-
oJqArea = $(this);
|
|
726
|
-
|
|
727
|
-
// Basic area data
|
|
728
|
-
sAreaType = oDragDropUtils.getDropAreaTypeFromDropAreaId(oJqArea.attr("id"));
|
|
729
|
-
sDropAxisName = (sAreaType === "droparea_above" || sAreaType === "droparea_below") ? "ROWS" : "COLS";
|
|
730
|
-
bIsBeginArea = (sAreaType === "droparea_above" || sAreaType === "droparea_before");
|
|
731
|
-
|
|
732
|
-
// Basic check
|
|
733
|
-
if (!that.checkBasicMemberDropAccept(oPayload, sDropAxisName)) {
|
|
734
|
-
return that.returnFromMemberAreaAcceptCheck(oJqArea, false);
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
// DragCell
|
|
738
|
-
oDragCell = oDragDropUtils.getCrosstabHeaderCellFromDraggable(oDraggable);
|
|
739
|
-
oDragCell = oDragDropUtils.getEffectiveCell(oDragCell);
|
|
740
|
-
sDragAxisName = oDragCell.getArea().isRowHeaderArea() ? "ROWS" : "COLS";
|
|
741
|
-
|
|
742
|
-
if (sDragAxisName !== sDropAxisName) {
|
|
743
|
-
return that.returnFromMemberAreaAcceptCheck(oJqArea, false);
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
// AnchorCell and DropCell
|
|
747
|
-
oAnchorCell = sap.ui.getCore().getControl(oJqArea.data("xtabcellid"));
|
|
748
|
-
oDropCell = that.getDropCellFromAnchorCell(oAnchorCell, oDragCell, sDragAxisName, bIsBeginArea);
|
|
749
|
-
oDropCell = oDragDropUtils.getEffectiveCell(oDropCell);
|
|
750
|
-
|
|
751
|
-
if (!oDropCell || (oDropCell && (oDropCell.getId() === oDragCell.getId()))) {
|
|
752
|
-
return that.returnFromMemberAreaAcceptCheck(oJqArea, false);
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
// Check against DropIndexLimits
|
|
756
|
-
oDragDropInfo = oPayload.oDragDropInfo;
|
|
757
|
-
oDropIndexLimits = oDragDropInfo.oDropIndexLimits;
|
|
758
|
-
|
|
759
|
-
bAccept = that.checkDropAreaDropLimits(oDragCell, oDropCell, oDropIndexLimits, sDragAxisName, bIsBeginArea);
|
|
760
|
-
if (!bAccept) {
|
|
761
|
-
return that.returnFromMemberAreaAcceptCheck(oJqArea, false);
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
// Check for move above/before next cell
|
|
765
|
-
|
|
766
|
-
// Do not allow a cell to be dropped on a direct predecessor area except if this area is a begin area.
|
|
767
|
-
// If it is not a begin area that belongs to the block, the previous checks will already have failed,
|
|
768
|
-
// so the order of the checks here in this function are important!
|
|
769
|
-
bAccept = that.checkAreaMoveOnPreviousCell(oDragCell, oDropCell, oAnchorCell, sDragAxisName, bIsBeginArea);
|
|
770
|
-
if (!bAccept) {
|
|
771
|
-
return that.returnFromMemberAreaAcceptCheck(oJqArea, false);
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
// check for Hierarchy stuff: no move on logically previous peer in hierarchy, but move before a same level cell allowed if stuff expanded
|
|
775
|
-
bAccept = that.checkAreaMoveOnPreviousHierarchyPeerOrBeginOfFollowing(oDragCell, oDropCell, oDropIndexLimits, sDragAxisName, bIsBeginArea);
|
|
776
|
-
if (!bAccept) {
|
|
777
|
-
return that.returnFromMemberAreaAcceptCheck(oJqArea, false);
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
return that.returnFromMemberAreaAcceptCheck(oJqArea, true);
|
|
781
|
-
}
|
|
782
|
-
|
|
783
|
-
this.getCommonDropCommand = function(oCoordinates, sCommand) {
|
|
784
|
-
var oDragDropInfo;
|
|
785
|
-
var iNewIndex;
|
|
786
|
-
|
|
787
|
-
oDragDropInfo = sap.zen.Dispatcher.instance.getDragDropPayload().oDragDropInfo;
|
|
788
|
-
|
|
789
|
-
if (oDragDropInfo.sAxisName === "ROWS") {
|
|
790
|
-
iNewIndex = oCoordinates.row;
|
|
791
|
-
} else if (oDragDropInfo.sAxisName === "COLS") {
|
|
792
|
-
iNewIndex = oCoordinates.col;
|
|
793
|
-
}
|
|
794
|
-
|
|
795
|
-
sCommand = sCommand.replace("__AXIS__", oDragDropInfo.sAxisName);
|
|
796
|
-
sCommand = sCommand.replace("__ROW__", oDragDropInfo.iMemberRow);
|
|
797
|
-
sCommand = sCommand.replace("__COL__", oDragDropInfo.iMemberCol);
|
|
798
|
-
sCommand = sCommand.replace("__NEW_INDEX__", iNewIndex);
|
|
799
|
-
|
|
800
|
-
return sCommand;
|
|
801
|
-
};
|
|
802
|
-
|
|
803
|
-
function handleDropOnMemberCell(e, ui) {
|
|
804
|
-
var oDropCell;
|
|
805
|
-
var oCoordinates;
|
|
806
|
-
var sCommand;
|
|
807
|
-
|
|
808
|
-
if (oDragDropUtils.checkDropAllowedOnCrosstabElement(e)) {
|
|
809
|
-
oDropCell = oDragDropHoverManager.getCellFromJqCell($(this));
|
|
810
|
-
oDropCell = oDragDropUtils.getEffectiveCell(oDropCell);
|
|
811
|
-
oCoordinates = oCrosstab.getUtils().translateCellCoordinatesForBackend(oDropCell);
|
|
812
|
-
|
|
813
|
-
sCommand = that.getCommonDropCommand(oCoordinates, oDragDropCommands.swapmemberscommand);
|
|
814
|
-
oCrosstab.getUtils().executeCommandAction(sCommand);
|
|
815
|
-
|
|
816
|
-
oDragDropUtils.resetDragDrop();
|
|
817
|
-
} else if (!oDragDropUtils.checkMouseInRenderSizeDiv(e)) {
|
|
818
|
-
// mouse not in render size div, but we get a drop event.
|
|
819
|
-
// this is a cell with rowspan/colspan that is cut off by the render size div
|
|
820
|
-
// but is logically there. We need to handle that kind of drop as unhandled drop
|
|
821
|
-
sap.zen.Dispatcher.instance.onUnhandledDrop(e, ui);
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
|
|
825
|
-
function handleDropAreaDrop(e, ui) {
|
|
826
|
-
var oAnchorCell;
|
|
827
|
-
var oDragCell;
|
|
828
|
-
var oDropCell;
|
|
829
|
-
var oCoordinates;
|
|
830
|
-
var sAreaType;
|
|
831
|
-
var oDragDropInfo;
|
|
832
|
-
var oDropIndexLimits;
|
|
833
|
-
var sAxisName;
|
|
834
|
-
var sCommand;
|
|
835
|
-
var bBefore = false;
|
|
836
|
-
|
|
837
|
-
if (oDragDropUtils.checkDropAllowedOnCrosstabElement(e)) {
|
|
838
|
-
oDragDropInfo = sap.zen.Dispatcher.instance.getDragDropPayload().oDragDropInfo;
|
|
839
|
-
oDropIndexLimits = oDragDropInfo.oDropIndexLimits;
|
|
840
|
-
sAxisName = oDragDropInfo.sAxisName;
|
|
841
|
-
|
|
842
|
-
oAnchorCell = sap.ui.getCore().getControl($(this).data("xtabcellid"));
|
|
843
|
-
oDragCell = oDragDropUtils.getCrosstabHeaderCellFromDraggable($(ui.draggable));
|
|
844
|
-
oDragCell = oDragDropUtils.getEffectiveCell(oDragCell);
|
|
845
|
-
|
|
846
|
-
sAreaType = oDragDropUtils.getDropAreaTypeFromDropAreaId($(this).attr("id"));
|
|
847
|
-
if (sAreaType === "droparea_above" || sAreaType === "droparea_before") {
|
|
848
|
-
bBefore = true;
|
|
849
|
-
}
|
|
850
|
-
|
|
851
|
-
oDropCell = that.getDropCellFromAnchorCell(oAnchorCell, oDragCell, sAxisName, bBefore);
|
|
852
|
-
oDropCell = oDragDropUtils.getEffectiveCell(oDropCell);
|
|
853
|
-
|
|
854
|
-
if (that.isDropCellOneBelowOrBeforeBlock(oDropCell, oDropIndexLimits, sAxisName)) {
|
|
855
|
-
bBefore = true;
|
|
856
|
-
if (sAxisName === "ROWS") {
|
|
857
|
-
oDropCell = oCrosstab.getRowHeaderArea().getCellWithRowSpan(oDropIndexLimits.iMinIndex, oDropCell.getCol());
|
|
858
|
-
} else if (sAxisName === "COLS") {
|
|
859
|
-
oDropCell = oCrosstab.getColumnHeaderArea().getCellWithColSpan(oDropCell.getRow(), oDropIndexLimits.iMinIndex);
|
|
860
|
-
}
|
|
861
|
-
}
|
|
862
|
-
|
|
863
|
-
if (oDragCell.getLevel() !== oDropCell.getLevel()) {
|
|
864
|
-
// this can only happen if D&D was allowed of a DragCell that moves in front of a same-level hierarchy by hitting the after/below area of some expanded stuff of a previous cell
|
|
865
|
-
// In that case, take the next cell as the actual drop cell and make it a "before" drop for that cell
|
|
866
|
-
oDropCell = that.getNextCell(oDropCell, sAxisName);
|
|
867
|
-
bBefore = true;
|
|
868
|
-
}
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
oCoordinates = oCrosstab.getUtils().translateCellCoordinatesForBackend(oDropCell);
|
|
873
|
-
sCommand = that.getCommonDropCommand(oCoordinates, oDragDropCommands.insertmembercommand);
|
|
874
|
-
sCommand = sCommand.replace("__INSERT_BEFORE__", bBefore);
|
|
875
|
-
oCrosstab.getUtils().executeCommandAction(sCommand);
|
|
876
|
-
|
|
877
|
-
oDragDropUtils.resetDragDrop();
|
|
878
|
-
} else if (!oDragDropUtils.checkMouseInRenderSizeDiv(e)) {
|
|
879
|
-
// mouse not in render size div, but we get a drop event.
|
|
880
|
-
// this is a cell with rowspan/colspan that is cut off by the render size div
|
|
881
|
-
// but is logically there. We need to handle that kind of drop as unhandled drop
|
|
882
|
-
sap.zen.Dispatcher.instance.onUnhandledDrop(e, ui);
|
|
883
|
-
}
|
|
884
|
-
}
|
|
885
|
-
|
|
886
|
-
this.getLeftOfBeginCellInRowHeader = function(oRowHeaderArea, oCell) {
|
|
887
|
-
var iStartCol;
|
|
888
|
-
var iRow;
|
|
889
|
-
var iCol;
|
|
890
|
-
var oTempCell = oCell;
|
|
891
|
-
var oRect;
|
|
892
|
-
|
|
893
|
-
iStartCol = oCell.getCol();
|
|
894
|
-
iCol = iStartCol;
|
|
895
|
-
|
|
896
|
-
// look one line down to get the left alignment right according to spans!
|
|
897
|
-
iRow = oCell.getRow();
|
|
898
|
-
if (iRow < oRowHeaderArea.getRenderStartRow() + oRowHeaderArea.getRenderRowCnt() - 1) {
|
|
899
|
-
iRow++;
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
while (oTempCell && iCol >= 0) {
|
|
903
|
-
oTempCell = oRowHeaderArea.getCellWithColSpan(iRow, iCol);
|
|
904
|
-
if (oTempCell) {
|
|
905
|
-
oCell = oTempCell;
|
|
906
|
-
iCol = oTempCell.getCol() - 1;
|
|
907
|
-
}
|
|
908
|
-
}
|
|
909
|
-
|
|
910
|
-
oRect = oDragDropUtils.getBoundingClientRect(document.getElementById(oCell.getId()));
|
|
911
|
-
return oRect.begin;
|
|
912
|
-
};
|
|
913
|
-
|
|
914
|
-
this.getTopOfBeginCellInColHeader = function(oColHeaderArea, oCell) {
|
|
915
|
-
var iStartRow;
|
|
916
|
-
var iRow;
|
|
917
|
-
var iCol;
|
|
918
|
-
var oTempCell = oCell;
|
|
919
|
-
var oRect;
|
|
920
|
-
|
|
921
|
-
iStartRow = oCell.getRow();
|
|
922
|
-
iRow = iStartRow;
|
|
923
|
-
|
|
924
|
-
// look one cell to the right to get the left alignment right according to spans!
|
|
925
|
-
iCol = oCell.getCol();
|
|
926
|
-
if (iCol < oColHeaderArea.getRenderStartCol() + oColHeaderArea.getRenderColCnt() - 1) {
|
|
927
|
-
iCol++;
|
|
928
|
-
}
|
|
929
|
-
|
|
930
|
-
while (oTempCell && iRow >= 0) {
|
|
931
|
-
oTempCell = oColHeaderArea.getCellWithRowSpan(iRow, iCol);
|
|
932
|
-
if (oTempCell) {
|
|
933
|
-
oCell = oTempCell;
|
|
934
|
-
iRow = oTempCell.getRow() - 1;
|
|
935
|
-
}
|
|
936
|
-
}
|
|
937
|
-
|
|
938
|
-
oRect = oDragDropUtils.getBoundingClientRect(document.getElementById(oCell.getId()));
|
|
939
|
-
return oRect.top;
|
|
940
|
-
};
|
|
941
|
-
|
|
942
|
-
this.isRowContainsResultCell = function(oRowHeaderArea, iRow) {
|
|
943
|
-
var i = 0;
|
|
944
|
-
var oCell = null;
|
|
945
|
-
|
|
946
|
-
for (i = 0; i < oRowHeaderArea.getColCnt(); i++) {
|
|
947
|
-
oCell = oRowHeaderArea.getCellWithColSpan(iRow, i);
|
|
948
|
-
if (oCell && oCell.isResult()) {
|
|
949
|
-
return true;
|
|
950
|
-
}
|
|
951
|
-
}
|
|
952
|
-
return false;
|
|
953
|
-
};
|
|
954
|
-
|
|
955
|
-
this.isColContainsResultCell = function(oColHeaderArea, iCol) {
|
|
956
|
-
var i = 0;
|
|
957
|
-
var oCell = null;
|
|
958
|
-
|
|
959
|
-
for (i = 0; i < oColHeaderArea.getRowCnt(); i++) {
|
|
960
|
-
oCell = oColHeaderArea.getCellWithRowSpan(i, iCol);
|
|
961
|
-
if (oCell && oCell.isResult()) {
|
|
962
|
-
return true;
|
|
963
|
-
}
|
|
964
|
-
}
|
|
965
|
-
return false;
|
|
966
|
-
}
|
|
967
|
-
|
|
968
|
-
this.enableRowHeaderCellsAndAreas = function() {
|
|
969
|
-
var iCol = 0;
|
|
970
|
-
var iRow = 0;
|
|
971
|
-
var iStartRow = 0;
|
|
972
|
-
var iEndRow = 0;
|
|
973
|
-
var oRowHeaderArea;
|
|
974
|
-
var oCell;
|
|
975
|
-
var oRect;
|
|
976
|
-
var oJqArea;
|
|
977
|
-
var oJqCell;
|
|
978
|
-
var iFinestRowSpanCol;
|
|
979
|
-
var bOnlyDraggable = false;
|
|
980
|
-
var oDimInfo = null;
|
|
981
|
-
var bRowContainsResultCell = false;
|
|
982
|
-
var bIsResult = false;
|
|
983
|
-
|
|
984
|
-
oRowHeaderArea = oCrosstab.getRowHeaderArea();
|
|
985
|
-
if (!oCrosstab.hasRowHeaderArea() || (oRowHeaderArea && oRowHeaderArea.getRenderRowCnt() < 2)) {
|
|
986
|
-
bOnlyDraggable = true;
|
|
987
|
-
}
|
|
988
|
-
|
|
989
|
-
if (oPivotCell) {
|
|
990
|
-
iFinestRowSpanCol = oPivotCell.getTableCol() + oPivotCell.getColSpan() - 1;
|
|
991
|
-
if (!oPivotCell.isSplitPivotCell() && oPivotCell.sScalingAxis === "ROWS") {
|
|
992
|
-
iFinestRowSpanCol--;
|
|
993
|
-
}
|
|
994
|
-
} else {
|
|
995
|
-
iFinestRowSpanCol = 0;
|
|
996
|
-
}
|
|
997
|
-
|
|
998
|
-
iStartRow = oRowHeaderArea.getRenderStartRow();
|
|
999
|
-
iEndRow = iStartRow + oRowHeaderArea.getRenderRowCnt() - 1;
|
|
1000
|
-
|
|
1001
|
-
for (iRow = iStartRow; iRow <= iEndRow; iRow++) {
|
|
1002
|
-
if (bIsRepeatTexts) {
|
|
1003
|
-
bRowContainsResultCell = this.isRowContainsResultCell(oRowHeaderArea, iRow);
|
|
1004
|
-
}
|
|
1005
|
-
for (iCol = 0; iCol <= iFinestRowSpanCol; iCol++) {
|
|
1006
|
-
oCell = oRowHeaderArea.getCellWithColSpan(iRow, iCol);
|
|
1007
|
-
if (!oCell && iRow === iStartRow) {
|
|
1008
|
-
// first cell might have a rowspan > 1 and start "before" visible area
|
|
1009
|
-
oCell = oRowHeaderArea.getCellWithRowSpan(iRow, iCol);
|
|
1010
|
-
}
|
|
1011
|
-
if (oCell) {
|
|
1012
|
-
if (bOnlyDraggable) {
|
|
1013
|
-
// only one row. Check if that is a valid dimension member to drag at all
|
|
1014
|
-
oDimInfo = oCrosstab.getHeaderInfo().getDimensionInfoByCol(oCell.getTableCol());
|
|
1015
|
-
if (!oDimInfo) {
|
|
1016
|
-
return;
|
|
1017
|
-
}
|
|
1018
|
-
}
|
|
1019
|
-
oJqCell = $(document.getElementById(oCell.getId()));
|
|
1020
|
-
oRect = oDragDropUtils.getBoundingClientRect(oJqCell[0]);
|
|
1021
|
-
if (iCol === iFinestRowSpanCol && !bOnlyDraggable) {
|
|
1022
|
-
if (iRow === iStartRow && oRect.top >= oValidRowHeaderRect.top) {
|
|
1023
|
-
oMemberDropAreaAboveInfo.iEnd = 0; // oRect.end
|
|
1024
|
-
oJqArea = oDragDropAreaRenderer.createAboveDropArea(oCell, oMemberDropAreaAboveInfo);
|
|
1025
|
-
oDragDropUtils.makeDropAreaDroppable(oJqArea, "sapzencrosstab-rowAboveCellMemberDropArea", checkMemberDropAreaAccept, handleDropAreaDrop);
|
|
1026
|
-
}
|
|
1027
|
-
if (oRect.bottom <= oValidRowHeaderRect.bottom) {
|
|
1028
|
-
oMemberDropAreaBelowInfo.iEnd = 0; // oRect.end
|
|
1029
|
-
oMemberDropAreaBelowInfo.iBegin = this.getLeftOfBeginCellInRowHeader(oRowHeaderArea, oCell);
|
|
1030
|
-
oJqArea = oDragDropAreaRenderer.createBelowDropArea(oCell, oMemberDropAreaBelowInfo);
|
|
1031
|
-
oDragDropUtils.makeDropAreaDroppable(oJqArea, "sapzencrosstab-rowBelowCellMemberDropArea", checkMemberDropAreaAccept, handleDropAreaDrop);
|
|
1032
|
-
}
|
|
1033
|
-
}
|
|
1034
|
-
if (bIsRepeatTexts) {
|
|
1035
|
-
bIsResult = bRowContainsResultCell;
|
|
1036
|
-
} else {
|
|
1037
|
-
bIsResult = oCell.isResult();
|
|
1038
|
-
}
|
|
1039
|
-
if (!bIsResult && oRect.top < oValidRowHeaderRect.bottom) {
|
|
1040
|
-
oDragDropUtils.makeCellDraggable(oJqCell, memberCellDraggableHelper);
|
|
1041
|
-
if (!bOnlyDraggable) {
|
|
1042
|
-
oDragDropUtils.makeCellDroppable(oJqCell, checkMemberCellDropAccept, handleDropOnMemberCell);
|
|
1043
|
-
}
|
|
1044
|
-
}
|
|
1045
|
-
}
|
|
1046
|
-
}
|
|
1047
|
-
}
|
|
1048
|
-
};
|
|
1049
|
-
|
|
1050
|
-
this.enableColHeaderCellsAndAreas = function() {
|
|
1051
|
-
var iCol = 0;
|
|
1052
|
-
var iRow = 0;
|
|
1053
|
-
var iStartCol = 0;
|
|
1054
|
-
var oColHeaderArea;
|
|
1055
|
-
var oCell;
|
|
1056
|
-
var oRect;
|
|
1057
|
-
var oJqArea;
|
|
1058
|
-
var iEndCol = 0;
|
|
1059
|
-
var oJqCell;
|
|
1060
|
-
var iFinestColSpanRow;
|
|
1061
|
-
var bOnlyDraggable = false;
|
|
1062
|
-
var oDimInfo = null;
|
|
1063
|
-
var bColContainsResultCell = false;
|
|
1064
|
-
var bIsResult = false;
|
|
1065
|
-
var oResultLookUp = {};
|
|
1066
|
-
|
|
1067
|
-
oColHeaderArea = oCrosstab.getColumnHeaderArea();
|
|
1068
|
-
if (!oCrosstab.hasColHeaderArea() || (oColHeaderArea && oColHeaderArea.getRenderColCnt() < 2)) {
|
|
1069
|
-
bOnlyDraggable = true;
|
|
1070
|
-
}
|
|
1071
|
-
|
|
1072
|
-
if (oPivotCell) {
|
|
1073
|
-
iFinestColSpanRow = oPivotCell.getTableRow() + oPivotCell.getRowSpan() - 1;
|
|
1074
|
-
if (!oPivotCell.isSplitPivotCell() && oPivotCell.sScalingAxis === "COLS") {
|
|
1075
|
-
iFinestColSpanRow--;
|
|
1076
|
-
}
|
|
1077
|
-
} else {
|
|
1078
|
-
iFinestColSpanRow = 0;
|
|
1079
|
-
}
|
|
1080
|
-
|
|
1081
|
-
iStartCol = oColHeaderArea.getRenderStartCol();
|
|
1082
|
-
iEndCol = iStartCol + oColHeaderArea.getRenderColCnt() - 1;
|
|
1083
|
-
|
|
1084
|
-
for (iRow = 0; iRow <= iFinestColSpanRow; iRow++) {
|
|
1085
|
-
for (iCol = iStartCol; iCol <= iEndCol; iCol++) {
|
|
1086
|
-
if (bIsRepeatTexts) {
|
|
1087
|
-
if (typeof oResultLookUp[iCol] != "undefined") {
|
|
1088
|
-
bColContainsResultCell = oResultLookUp[iCol];
|
|
1089
|
-
} else {
|
|
1090
|
-
bColContainsResultCell = this.isColContainsResultCell(oColHeaderArea, iCol);
|
|
1091
|
-
oResultLookUp[iCol] = bColContainsResultCell;
|
|
1092
|
-
}
|
|
1093
|
-
}
|
|
1094
|
-
oCell = oColHeaderArea.getCellWithRowSpan(iRow, iCol);
|
|
1095
|
-
if (!oCell && iCol === iStartCol) {
|
|
1096
|
-
// first cell might have a colspan > 1 and start "before" visible area
|
|
1097
|
-
oCell = oColHeaderArea.getCellWithColSpan(iRow, iCol);
|
|
1098
|
-
}
|
|
1099
|
-
if (oCell) {
|
|
1100
|
-
if (bOnlyDraggable) {
|
|
1101
|
-
// only one column. Check if that is a valid dimension member to drag at all
|
|
1102
|
-
oDimInfo = oCrosstab.getHeaderInfo().getDimensionInfoByRow(oCell.getTableRow());
|
|
1103
|
-
if (!oDimInfo) {
|
|
1104
|
-
return;
|
|
1105
|
-
}
|
|
1106
|
-
}
|
|
1107
|
-
oJqCell = $(document.getElementById(oCell.getId()));
|
|
1108
|
-
oRect = oDragDropUtils.getBoundingClientRect(oJqCell[0]);
|
|
1109
|
-
if (iRow === iFinestColSpanRow && !bOnlyDraggable) {
|
|
1110
|
-
if (iCol === iStartCol && oRect.begin >= oValidColHeaderRect.begin) {
|
|
1111
|
-
oMemberDropAreaBeforeInfo.iBottom = 0; //oRect.bottom;
|
|
1112
|
-
oJqArea = oDragDropAreaRenderer.createBeforeDropArea(oCell, oMemberDropAreaBeforeInfo);
|
|
1113
|
-
oDragDropUtils.makeDropAreaDroppable(oJqArea, "sapzencrosstab-columnBeforeCellMemberDropArea", checkMemberDropAreaAccept, handleDropAreaDrop);
|
|
1114
|
-
}
|
|
1115
|
-
if (oRect.end <= oValidColHeaderRect.end) {
|
|
1116
|
-
oMemberDropAreaAfterInfo.iBottom = 0; //oRect.bottom;
|
|
1117
|
-
oMemberDropAreaAfterInfo.iTop = this.getTopOfBeginCellInColHeader(oColHeaderArea, oCell);
|
|
1118
|
-
oJqArea = oDragDropAreaRenderer.createAfterDropArea(oCell, oMemberDropAreaAfterInfo);
|
|
1119
|
-
oDragDropUtils.makeDropAreaDroppable(oJqArea, "sapzencrosstab-columnAfterCellMemberDropArea", checkMemberDropAreaAccept, handleDropAreaDrop);
|
|
1120
|
-
}
|
|
1121
|
-
}
|
|
1122
|
-
if (bIsRepeatTexts) {
|
|
1123
|
-
bIsResult = bColContainsResultCell;
|
|
1124
|
-
} else {
|
|
1125
|
-
bIsResult = oCell.isResult();
|
|
1126
|
-
}
|
|
1127
|
-
if (!bIsResult && oRect.begin < oValidColHeaderRect.end) {
|
|
1128
|
-
oDragDropUtils.makeCellDraggable(oJqCell, memberCellDraggableHelper);
|
|
1129
|
-
if (!bOnlyDraggable) {
|
|
1130
|
-
oDragDropUtils.makeCellDroppable(oJqCell, checkMemberCellDropAccept, handleDropOnMemberCell);
|
|
1131
|
-
}
|
|
1132
|
-
}
|
|
1133
|
-
}
|
|
1134
|
-
}
|
|
1135
|
-
}
|
|
1136
|
-
};
|
|
1137
|
-
|
|
1138
|
-
this.enableMemberDragDrop = function() {
|
|
1139
|
-
this.enableRowHeaderCellsAndAreas();
|
|
1140
|
-
this.enableColHeaderCellsAndAreas();
|
|
1141
|
-
};
|
|
1142
|
-
|
|
1143
|
-
this.removeMember = function(e, ui, oDragDropInfo) {
|
|
1144
|
-
if (oDragDropInfo.bIsMemberDrag && oDragDropInfo.iMemberRow > -1 && oDragDropInfo.iMemberCol > -1 && !oDragDropInfo.bIsHierarchyMember) {
|
|
1145
|
-
var sCommand = oDragDropCommands.removemembercommand.replace("__AXIS__", oDragDropInfo.sAxisName);
|
|
1146
|
-
sCommand = sCommand.replace("__ROW__", oDragDropInfo.iMemberRow);
|
|
1147
|
-
sCommand = sCommand.replace("__COL__", oDragDropInfo.iMemberCol);
|
|
1148
|
-
oCrosstab.getUtils().executeCommandAction(sCommand);
|
|
1149
|
-
} else {
|
|
1150
|
-
sap.zen.Dispatcher.instance.setDragDropCanceled(true);
|
|
1151
|
-
}
|
|
1152
|
-
};
|
|
1153
|
-
|
|
1154
|
-
};
|