@sapui5/sap.suite.ui.commons 1.136.11 → 1.136.13
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/sap/suite/ui/commons/.library +1 -1
- package/src/sap/suite/ui/commons/AriaProperties.js +1 -1
- package/src/sap/suite/ui/commons/CalculationBuilder.js +1 -1
- package/src/sap/suite/ui/commons/CalculationBuilderExpression.js +1 -1
- package/src/sap/suite/ui/commons/CalculationBuilderFunction.js +1 -1
- package/src/sap/suite/ui/commons/CalculationBuilderGroup.js +1 -1
- package/src/sap/suite/ui/commons/CalculationBuilderItem.js +1 -1
- package/src/sap/suite/ui/commons/CalculationBuilderValidationResult.js +1 -1
- package/src/sap/suite/ui/commons/CalculationBuilderVariable.js +1 -1
- package/src/sap/suite/ui/commons/CloudFilePicker.js +1 -1
- package/src/sap/suite/ui/commons/MicroProcessFlow.js +1 -1
- package/src/sap/suite/ui/commons/MicroProcessFlowItem.js +1 -1
- package/src/sap/suite/ui/commons/TimelineRenderManager.js +8 -4
- package/src/sap/suite/ui/commons/flexibility/changeHandler/PropertyChangeMapper.js +1 -1
- package/src/sap/suite/ui/commons/imageeditor/CropCustomShapeHistoryItem.js +1 -1
- package/src/sap/suite/ui/commons/imageeditor/CropEllipseHistoryItem.js +1 -1
- package/src/sap/suite/ui/commons/imageeditor/CropRectangleHistoryItem.js +1 -1
- package/src/sap/suite/ui/commons/imageeditor/CustomSizeItem.js +1 -1
- package/src/sap/suite/ui/commons/imageeditor/FilterHistoryItem.js +1 -1
- package/src/sap/suite/ui/commons/imageeditor/FlipHistoryItem.js +1 -1
- package/src/sap/suite/ui/commons/imageeditor/HistoryItem.js +1 -1
- package/src/sap/suite/ui/commons/imageeditor/ImageEditor.js +1 -1
- package/src/sap/suite/ui/commons/imageeditor/ImageEditorContainer.js +1 -1
- package/src/sap/suite/ui/commons/imageeditor/ImageEditorResponsiveContainer.js +1 -1
- package/src/sap/suite/ui/commons/imageeditor/ResizeHistoryItem.js +1 -1
- package/src/sap/suite/ui/commons/imageeditor/RotateHistoryItem.js +1 -1
- package/src/sap/suite/ui/commons/library.js +100 -3
- package/src/sap/suite/ui/commons/messagebundle.properties +73 -12
- package/src/sap/suite/ui/commons/messagebundle_ar.properties +1 -1
- package/src/sap/suite/ui/commons/messagebundle_en_US_saprigi.properties +39 -5
- package/src/sap/suite/ui/commons/messagebundle_fr_CA.properties +1 -1
- package/src/sap/suite/ui/commons/messagebundle_hu.properties +1 -1
- package/src/sap/suite/ui/commons/messagebundle_id.properties +2 -2
- package/src/sap/suite/ui/commons/messagebundle_it.properties +1 -1
- package/src/sap/suite/ui/commons/messagebundle_pt.properties +1 -1
- package/src/sap/suite/ui/commons/messagebundle_ru.properties +1 -1
- package/src/sap/suite/ui/commons/networkgraph/ElementBase.js +19 -1
- package/src/sap/suite/ui/commons/networkgraph/Graph.js +590 -48
- package/src/sap/suite/ui/commons/networkgraph/GraphMap.js +25 -3
- package/src/sap/suite/ui/commons/networkgraph/GraphRenderer.js +19 -8
- package/src/sap/suite/ui/commons/networkgraph/KeyboardNavigator.js +367 -12
- package/src/sap/suite/ui/commons/networkgraph/Line.js +814 -22
- package/src/sap/suite/ui/commons/networkgraph/Node.js +573 -79
- package/src/sap/suite/ui/commons/networkgraph/Tooltip.js +4 -0
- package/src/sap/suite/ui/commons/networkgraph/Utils.js +249 -10
- package/src/sap/suite/ui/commons/networkgraph/layout/NoopLayout.js +77 -7
- package/src/sap/suite/ui/commons/networkgraph/util/ConnectionPathUtils.js +1174 -0
- package/src/sap/suite/ui/commons/networkgraph/util/CreateConnectionPopover.js +374 -0
- package/src/sap/suite/ui/commons/networkgraph/util/DependencyLayoutHelper.js +1017 -0
- package/src/sap/suite/ui/commons/networkgraph/util/DragDropManager.js +721 -0
- package/src/sap/suite/ui/commons/networkgraph/util/PortManager.js +582 -0
- package/src/sap/suite/ui/commons/statusindicator/Circle.js +1 -1
- package/src/sap/suite/ui/commons/statusindicator/CustomShape.js +1 -1
- package/src/sap/suite/ui/commons/statusindicator/DiscreteThreshold.js +1 -1
- package/src/sap/suite/ui/commons/statusindicator/FillingOption.js +1 -1
- package/src/sap/suite/ui/commons/statusindicator/LibraryShape.js +1 -1
- package/src/sap/suite/ui/commons/statusindicator/Path.js +1 -1
- package/src/sap/suite/ui/commons/statusindicator/PropertyThreshold.js +1 -1
- package/src/sap/suite/ui/commons/statusindicator/Rectangle.js +1 -1
- package/src/sap/suite/ui/commons/statusindicator/Shape.js +1 -1
- package/src/sap/suite/ui/commons/statusindicator/ShapeGroup.js +1 -1
- package/src/sap/suite/ui/commons/statusindicator/SimpleShape.js +1 -1
- package/src/sap/suite/ui/commons/statusindicator/StatusIndicator.js +1 -1
- package/src/sap/suite/ui/commons/taccount/TAccount.js +1 -1
- package/src/sap/suite/ui/commons/taccount/TAccountGroup.js +1 -1
- package/src/sap/suite/ui/commons/taccount/TAccountItem.js +1 -1
- package/src/sap/suite/ui/commons/taccount/TAccountItemProperty.js +1 -1
- package/src/sap/suite/ui/commons/taccount/TAccountPanel.js +1 -1
- package/src/sap/suite/ui/commons/themes/base/NetworkGraph.less +26 -13
- package/src/sap/suite/ui/commons/themes/base/NetworkGroup.less +4 -0
- package/src/sap/suite/ui/commons/themes/base/NetworkLine.less +58 -13
- package/src/sap/suite/ui/commons/themes/base/NetworkNode.less +251 -47
- package/src/sap/suite/ui/commons/themes/base/SemanticColorMixins.less +55 -0
|
@@ -98,6 +98,9 @@ sap.ui.define([
|
|
|
98
98
|
beforeOpen: function () {
|
|
99
99
|
this._fnCreate();
|
|
100
100
|
this._oPopover.setInitialFocus(Element.getElementById(this.getId() + "-detailsSection"));
|
|
101
|
+
if (this._oOpener && this._oElement && this._oElement._setActionButtonFocus) {
|
|
102
|
+
this._oElement._setActionButtonFocus(this._oOpener, false);
|
|
103
|
+
}
|
|
101
104
|
}.bind(this),
|
|
102
105
|
contentWidth: "350px"
|
|
103
106
|
}).addStyleClass("sapSuiteUiCommonsNetworkTooltip");
|
|
@@ -158,6 +161,7 @@ sap.ui.define([
|
|
|
158
161
|
|
|
159
162
|
this._fnCreate = this._createDetail;
|
|
160
163
|
this._oElement = mArguments.item;
|
|
164
|
+
this._oOpener = oOpener;
|
|
161
165
|
this._oPopover.openBy(oOpener);
|
|
162
166
|
};
|
|
163
167
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
sap.ui.define([], function () {
|
|
8
|
+
sap.ui.define(["sap/base/Log"], function (Log) {
|
|
9
9
|
"use strict";
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -24,6 +24,8 @@ sap.ui.define([], function () {
|
|
|
24
24
|
'BACKGROUND-COLOR': 'backgroundSemanticColor',
|
|
25
25
|
BORDER: 'borderSemanticColor',
|
|
26
26
|
'BORDER-COLOR': 'borderSemanticColor',
|
|
27
|
+
OUTLINE: 'outlineSemanticColor',
|
|
28
|
+
'OUTLINE-COLOR': 'outlineSemanticColor',
|
|
27
29
|
TEXT: 'textSemanticColor',
|
|
28
30
|
FILL: 'fillSemanticColor',
|
|
29
31
|
STROKE: 'strokeSemanticColor',
|
|
@@ -73,15 +75,252 @@ sap.ui.define([], function () {
|
|
|
73
75
|
* @returns {function} throttled function.
|
|
74
76
|
*/
|
|
75
77
|
Utils.throttle = (mainFunction, delay) => {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
78
|
+
return (...args) => {
|
|
79
|
+
if (timeFlag === null) {
|
|
80
|
+
mainFunction(...args);
|
|
81
|
+
timeFlag = setTimeout(() => {
|
|
82
|
+
timeFlag = null;
|
|
83
|
+
}, delay);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Helper function to convert CSS outline to border for drag image elements.
|
|
90
|
+
* This is needed because some browsers don't capture outline in drag images.
|
|
91
|
+
*
|
|
92
|
+
* @param {HTMLElement} oElement - The DOM element to apply border to
|
|
93
|
+
* @param {CSSStyleDeclaration} oComputedStyle - The computed style of the element
|
|
94
|
+
* @param {string} [sBorderProperty="border"] - The CSS border property to set ("border", "borderBottom", etc.)
|
|
95
|
+
* @private
|
|
96
|
+
*/
|
|
97
|
+
var _applyOutlineAsBorder = function (oElement, oComputedStyle, sBorderProperty) {
|
|
98
|
+
var sOutlineWidth = oComputedStyle.outlineWidth;
|
|
99
|
+
if (sOutlineWidth && sOutlineWidth !== "0px") {
|
|
100
|
+
var sBorderValue = sOutlineWidth + " " + oComputedStyle.outlineStyle + " " + oComputedStyle.outlineColor;
|
|
101
|
+
oElement.style[sBorderProperty || "border"] = sBorderValue;
|
|
102
|
+
oElement.style.outline = "none";
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Clones the inner div element and applies basic styles for drag image.
|
|
108
|
+
*
|
|
109
|
+
* @param {HTMLElement} oInnerDiv - Inner div element to clone
|
|
110
|
+
* @returns {HTMLElement} The cloned and styled node
|
|
111
|
+
* @private
|
|
112
|
+
*/
|
|
113
|
+
var _cloneAndStyleNode = function (oInnerDiv) {
|
|
114
|
+
var oClonedNode = oInnerDiv.cloneNode(true);
|
|
115
|
+
var oComputedStyle = window.getComputedStyle(oInnerDiv);
|
|
116
|
+
|
|
117
|
+
// Apply computed styles to ensure the clone looks identical
|
|
118
|
+
oClonedNode.style.width = oComputedStyle.width;
|
|
119
|
+
oClonedNode.style.height = oComputedStyle.height;
|
|
120
|
+
oClonedNode.style.position = "absolute";
|
|
121
|
+
oClonedNode.style.top = "-9999px";
|
|
122
|
+
oClonedNode.style.left = "-9999px";
|
|
123
|
+
oClonedNode.style.pointerEvents = "none";
|
|
124
|
+
|
|
125
|
+
// Convert outline to border for the drag image
|
|
126
|
+
_applyOutlineAsBorder(oClonedNode, oComputedStyle);
|
|
127
|
+
|
|
128
|
+
// Retain border-radius for rounded corners
|
|
129
|
+
var sBorderRadius = oComputedStyle.borderRadius;
|
|
130
|
+
if (sBorderRadius && sBorderRadius !== "0px") {
|
|
131
|
+
oClonedNode.style.borderRadius = sBorderRadius;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Retain background color
|
|
135
|
+
var sBackgroundColor = oComputedStyle.backgroundColor;
|
|
136
|
+
if (sBackgroundColor) {
|
|
137
|
+
oClonedNode.style.backgroundColor = sBackgroundColor;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return oClonedNode;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Processes header element styling in the cloned node.
|
|
145
|
+
*
|
|
146
|
+
* @param {HTMLElement} oClonedNode - The cloned node to process
|
|
147
|
+
* @param {HTMLElement} oInnerDiv - Original inner div element
|
|
148
|
+
* @private
|
|
149
|
+
*/
|
|
150
|
+
var _processHeaderElement = function (oClonedNode, oInnerDiv) {
|
|
151
|
+
var oOriginalHeader = oInnerDiv.querySelector(".sapSuiteUiCommonsNetworkGraphDivHeader");
|
|
152
|
+
if (!oOriginalHeader) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
var oHeaderComputedStyle = window.getComputedStyle(oOriginalHeader);
|
|
157
|
+
var oHeaderElement = oClonedNode.querySelector(".sapSuiteUiCommonsNetworkGraphDivHeader");
|
|
158
|
+
|
|
159
|
+
if (!oHeaderElement) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// Retain header background color
|
|
164
|
+
if (oHeaderComputedStyle.backgroundColor) {
|
|
165
|
+
oHeaderElement.style.backgroundColor = oHeaderComputedStyle.backgroundColor;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Convert header outline to border
|
|
169
|
+
_applyOutlineAsBorder(oHeaderElement, oHeaderComputedStyle, "borderBottom");
|
|
170
|
+
|
|
171
|
+
// Process separate header color wrapper if it exists (skip if combined class)
|
|
172
|
+
if (!oHeaderElement.classList.contains("sapSuiteUiCommonsNetworkGraphDivHeaderColor")) {
|
|
173
|
+
var oOriginalHeaderColor = oInnerDiv.querySelector(".sapSuiteUiCommonsNetworkGraphDivHeaderColor");
|
|
174
|
+
if (oOriginalHeaderColor) {
|
|
175
|
+
var oHeaderColorComputedStyle = window.getComputedStyle(oOriginalHeaderColor);
|
|
176
|
+
var oHeaderColorElement = oHeaderElement.querySelector(".sapSuiteUiCommonsNetworkGraphDivHeaderColor");
|
|
177
|
+
|
|
178
|
+
if (oHeaderColorElement) {
|
|
179
|
+
// Retain border
|
|
180
|
+
if (oHeaderColorComputedStyle.border && oHeaderColorComputedStyle.border !== "0px none rgb(0, 0, 0)") {
|
|
181
|
+
oHeaderColorElement.style.border = oHeaderColorComputedStyle.border;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// Retain border-radius
|
|
185
|
+
if (oHeaderColorComputedStyle.borderRadius && oHeaderColorComputedStyle.borderRadius !== "0px") {
|
|
186
|
+
oHeaderColorElement.style.borderRadius = oHeaderColorComputedStyle.borderRadius;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// Retain background color
|
|
190
|
+
if (oHeaderColorComputedStyle.backgroundColor) {
|
|
191
|
+
oHeaderColorElement.style.backgroundColor = oHeaderColorComputedStyle.backgroundColor;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// Retain color
|
|
195
|
+
if (oHeaderColorComputedStyle.color) {
|
|
196
|
+
oHeaderColorElement.style.color = oHeaderColorComputedStyle.color;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Creates a custom drag image for the node that includes borders, border-radius, and background colors.
|
|
205
|
+
* This is necessary because the default browser drag image doesn't capture CSS outline properties for few browsers e.g. Chrome.
|
|
206
|
+
*
|
|
207
|
+
* @param {sap.suite.ui.commons.networkgraph.Node} oNode - The node being dragged
|
|
208
|
+
* @param {Event} oBrowserEvent - The native browser drag event
|
|
209
|
+
* @returns {HTMLElement|null} The cloned node attached to DOM, or null if creation failed. Caller is responsible for cleanup.
|
|
210
|
+
*/
|
|
211
|
+
Utils.createCustomDragImage = function (oNode, oBrowserEvent) {
|
|
212
|
+
if (!oNode || !oBrowserEvent || !oBrowserEvent.dataTransfer) {
|
|
213
|
+
return null;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// Get the graph instance to check the ghost image mode
|
|
217
|
+
var oGraph = oNode.getParent();
|
|
218
|
+
if (!oGraph) {
|
|
219
|
+
return null;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
try {
|
|
223
|
+
var oDomRef = oNode.getDomRef();
|
|
224
|
+
if (!oDomRef) {
|
|
225
|
+
return null;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
var oInnerDiv = oDomRef.querySelector(".sapSuiteUiCommonsNetworkGraphDivInner");
|
|
229
|
+
if (!oInnerDiv) {
|
|
230
|
+
return null;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// Clone and apply basic styles
|
|
234
|
+
var oClonedNode = _cloneAndStyleNode(oInnerDiv);
|
|
235
|
+
|
|
236
|
+
// Process header element styling
|
|
237
|
+
_processHeaderElement(oClonedNode, oInnerDiv);
|
|
238
|
+
|
|
239
|
+
// Attach to DOM temporarily
|
|
240
|
+
document.body.appendChild(oClonedNode);
|
|
241
|
+
|
|
242
|
+
// Set drag image with correct offset
|
|
243
|
+
var oRect = oInnerDiv.getBoundingClientRect();
|
|
244
|
+
var iOffsetX = oBrowserEvent.clientX - oRect.left;
|
|
245
|
+
var iOffsetY = oBrowserEvent.clientY - oRect.top;
|
|
246
|
+
oBrowserEvent.dataTransfer.setDragImage(oClonedNode, iOffsetX, iOffsetY);
|
|
247
|
+
|
|
248
|
+
// Return the cloned node for cleanup by caller
|
|
249
|
+
return oClonedNode;
|
|
250
|
+
} catch (oError) {
|
|
251
|
+
Log.warning("Utils: Failed to create custom drag image", oError);
|
|
252
|
+
return null;
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Retains the scroll position of the graph after DOM operations.
|
|
258
|
+
* This method ensures that the viewport remains stable after operations like
|
|
259
|
+
* drag-drop, connection creation, or other DOM manipulations.
|
|
260
|
+
*
|
|
261
|
+
* @param {sap.suite.ui.commons.networkgraph.Graph} oGraph - The graph control
|
|
262
|
+
* @param {number} scrollLeft - The horizontal scroll position to maintain
|
|
263
|
+
* @param {number} scrollTop - The vertical scroll position to maintain
|
|
264
|
+
*/
|
|
265
|
+
Utils.retainScrollPosition = function (oGraph, scrollLeft, scrollTop) {
|
|
266
|
+
if (!oGraph || !oGraph.$scroller || !oGraph.$scroller[0]) {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
const scrollerElement = oGraph.$scroller[0];
|
|
271
|
+
|
|
272
|
+
// Use requestAnimationFrame for better performance and timing
|
|
273
|
+
requestAnimationFrame(() => {
|
|
274
|
+
try {
|
|
275
|
+
scrollerElement.scrollLeft = scrollLeft;
|
|
276
|
+
scrollerElement.scrollTop = scrollTop;
|
|
277
|
+
|
|
278
|
+
// Fallback verification - ensure the scroll position was actually set
|
|
279
|
+
if (Math.abs(scrollerElement.scrollLeft - scrollLeft) > 1 ||
|
|
280
|
+
Math.abs(scrollerElement.scrollTop - scrollTop) > 1) {
|
|
281
|
+
|
|
282
|
+
// If the scroll position wasn't set correctly, try again after DOM updates
|
|
283
|
+
setTimeout(() => {
|
|
284
|
+
scrollerElement.scrollLeft = scrollLeft;
|
|
285
|
+
scrollerElement.scrollTop = scrollTop;
|
|
286
|
+
}, 10);
|
|
287
|
+
}
|
|
288
|
+
} catch (error) {
|
|
289
|
+
Log.error("retainScrollPosition: Error setting scroll position - " + error.message, "sap.suite.ui.commons.networkgraph.Utils");
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Preserves the scroll position of the graph by scheduling restoration after DOM updates.
|
|
296
|
+
* This is a convenience wrapper that handles the setTimeout + restoration logic.
|
|
297
|
+
*
|
|
298
|
+
* @param {sap.suite.ui.commons.networkgraph.Graph} oGraph - The graph control
|
|
299
|
+
* @param {number} scrollLeft - The horizontal scroll position to restore
|
|
300
|
+
* @param {number} scrollTop - The vertical scroll position to restore
|
|
301
|
+
* @param {number} [iDelay=0] - Delay in milliseconds before restoring scroll position
|
|
302
|
+
* @public
|
|
303
|
+
*/
|
|
304
|
+
Utils.preserveScrollPosition = function (oGraph, scrollLeft, scrollTop, iDelay) {
|
|
305
|
+
if (!oGraph || !oGraph.$scroller || !oGraph.$scroller[0]) {
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
const delay = typeof iDelay === "number" ? iDelay : 0;
|
|
310
|
+
|
|
311
|
+
// Schedule restoration after DOM updates
|
|
312
|
+
setTimeout(() => {
|
|
313
|
+
Utils.retainScrollPosition(oGraph, scrollLeft, scrollTop);
|
|
314
|
+
}, delay);
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
// RTL swap map for connection types: mirrors Left↔Right side labels.
|
|
318
|
+
Utils.mRTLSwap = {
|
|
319
|
+
"LeftToLeft": "RightToRight",
|
|
320
|
+
"LeftToRight": "RightToLeft",
|
|
321
|
+
"RightToLeft": "LeftToRight",
|
|
322
|
+
"RightToRight": "LeftToLeft"
|
|
323
|
+
};
|
|
85
324
|
|
|
86
325
|
return Utils;
|
|
87
326
|
}, true);
|
|
@@ -8,11 +8,14 @@
|
|
|
8
8
|
sap.ui.define([
|
|
9
9
|
"sap/suite/ui/commons/library",
|
|
10
10
|
"./LayoutAlgorithm",
|
|
11
|
-
"./LayoutTask"
|
|
12
|
-
|
|
11
|
+
"./LayoutTask",
|
|
12
|
+
"../util/ConnectionPathUtils",
|
|
13
|
+
"../util/DependencyLayoutHelper"
|
|
14
|
+
], function (library, LayoutAlgorithm, LayoutTask, ConnectionPathUtils, DependencyLayoutHelper) {
|
|
13
15
|
"use strict";
|
|
14
16
|
|
|
15
|
-
var
|
|
17
|
+
var oLayoutRenderType = library.networkgraph.LayoutRenderType,
|
|
18
|
+
oComponentArrangement = library.networkgraph.ComponentArrangement;
|
|
16
19
|
|
|
17
20
|
/**
|
|
18
21
|
* Constructor for a new NoopLayout.
|
|
@@ -30,22 +33,45 @@ sap.ui.define([
|
|
|
30
33
|
*/
|
|
31
34
|
var NoopLayout = LayoutAlgorithm.extend("sap.suite.ui.commons.networkgraph.layout.NoopLayout", {
|
|
32
35
|
metadata: {
|
|
33
|
-
library: "sap.suite.ui.commons"
|
|
36
|
+
library: "sap.suite.ui.commons",
|
|
37
|
+
properties: {
|
|
38
|
+
/**
|
|
39
|
+
* Enables advanced line routing algorithm that creates orthogonal bends along the pathfinding process for line creation.
|
|
40
|
+
*
|
|
41
|
+
* @public
|
|
42
|
+
*/
|
|
43
|
+
enableOptimizedLineAlgorithm: { type: "boolean", group: "Behavior", defaultValue: false },
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Defines how separate connected components should be arranged in the graph.
|
|
47
|
+
* Components can be arranged either horizontally (side-by-side) or vertically (stacked).
|
|
48
|
+
*
|
|
49
|
+
* @since 1.136.19
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
componentArrangement: { type: "sap.suite.ui.commons.networkgraph.ComponentArrangement", group: "Behavior", defaultValue: oComponentArrangement.Horizontal }
|
|
53
|
+
}
|
|
34
54
|
}
|
|
35
55
|
});
|
|
36
56
|
|
|
57
|
+
const GRID_SIZE = 54; // Size of each grid cell
|
|
58
|
+
const MIN_EDGE_LENGTH = 44; // Minimum length of an edge to avoid too short lines
|
|
59
|
+
|
|
37
60
|
/**
|
|
38
61
|
* Specifies the type of layout algorithm that defines the visual features and layout of the network graph.
|
|
39
62
|
*
|
|
40
|
-
* @returns {sap.suite.ui.commons.networkgraph.LayoutRenderType}
|
|
63
|
+
* @returns {sap.suite.ui.commons.networkgraph.LayoutRenderType} The layout render type.
|
|
41
64
|
* @public
|
|
42
65
|
*/
|
|
43
66
|
NoopLayout.prototype.getLayoutRenderType = function () {
|
|
44
|
-
return
|
|
67
|
+
return oLayoutRenderType.LayeredWithGroups;
|
|
45
68
|
};
|
|
46
69
|
|
|
47
70
|
/**
|
|
48
71
|
* Executes the layout algorithm.
|
|
72
|
+
* Automatically calculates initial positions for unpositioned nodes using DependencyLayoutHelper,
|
|
73
|
+
* then normalizes line coordinates.
|
|
74
|
+
*
|
|
49
75
|
* @returns {sap.suite.ui.commons.networkgraph.layout.LayoutTask} Task to get the layout calculated.
|
|
50
76
|
* @public
|
|
51
77
|
*/
|
|
@@ -63,11 +89,55 @@ sap.ui.define([
|
|
|
63
89
|
return;
|
|
64
90
|
}
|
|
65
91
|
|
|
66
|
-
|
|
92
|
+
// Check if positioning should be calculated
|
|
93
|
+
// Note: DependencyLayoutHelper only repositions nodes without valid coordinates
|
|
94
|
+
if (this._shouldCalculatePositions(oGraph)) {
|
|
95
|
+
DependencyLayoutHelper.calculatePositions(oGraph, {
|
|
96
|
+
componentArrangement: this.getComponentArrangement()
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
// Reset flag after calculation
|
|
100
|
+
if (oGraph._bTriggerLayoutCalculation) {
|
|
101
|
+
oGraph._bTriggerLayoutCalculation = false;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (this.getEnableOptimizedLineAlgorithm()) {
|
|
106
|
+
// Use the ConnectionPathUtils utility to normalize lines
|
|
107
|
+
ConnectionPathUtils.normalizeLines(oGraph, {
|
|
108
|
+
gridSize: GRID_SIZE,
|
|
109
|
+
minEdgeLength: MIN_EDGE_LENGTH
|
|
110
|
+
});
|
|
111
|
+
} else {
|
|
112
|
+
this._normalizeLines();
|
|
113
|
+
}
|
|
67
114
|
|
|
68
115
|
fnResolve();
|
|
69
116
|
}.bind(this));
|
|
70
117
|
};
|
|
71
118
|
|
|
119
|
+
/**
|
|
120
|
+
* Determines if initial positions should be calculated.
|
|
121
|
+
* Only returns true if there are unpositioned nodes or if explicitly triggered.
|
|
122
|
+
*
|
|
123
|
+
* @param {sap.suite.ui.commons.networkgraph.Graph} oGraph - The graph instance
|
|
124
|
+
* @returns {boolean} True if positions should be calculated
|
|
125
|
+
* @private
|
|
126
|
+
*/
|
|
127
|
+
NoopLayout.prototype._shouldCalculatePositions = function (oGraph) {
|
|
128
|
+
// Check if explicit trigger flag is set
|
|
129
|
+
// Even when triggered, DependencyLayoutHelper only affects unpositioned nodes
|
|
130
|
+
if (oGraph._bTriggerLayoutCalculation) {
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Auto-detect unpositioned nodes (coordinates 0,0 or undefined)
|
|
135
|
+
return oGraph.getNodes().some(function (oNode) {
|
|
136
|
+
var fX = oNode.getX();
|
|
137
|
+
var fY = oNode.getY();
|
|
138
|
+
return (fX === 0 || fX === undefined) && (fY === 0 || fY === undefined);
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
|
|
72
142
|
return NoopLayout;
|
|
73
143
|
});
|