@sapui5/sap.gantt 1.125.0 → 1.127.0
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/gantt/.library +6 -1
- package/src/sap/gantt/AdhocLine.js +1 -1
- package/src/sap/gantt/GanttChart.js +1 -1
- package/src/sap/gantt/GanttChartBase.js +1 -1
- package/src/sap/gantt/GanttChartContainer.js +1 -1
- package/src/sap/gantt/GanttChartWithTable.js +1 -1
- package/src/sap/gantt/axistime/AxisTimeStrategyBase.js +58 -8
- package/src/sap/gantt/axistime/FullScreenStrategy.js +1 -1
- package/src/sap/gantt/axistime/FullScreenTimeLineOptions.js +7 -1
- package/src/sap/gantt/axistime/ProportionTimeLineOptions.js +7 -1
- package/src/sap/gantt/axistime/ProportionZoomStrategy.js +1 -1
- package/src/sap/gantt/axistime/StepwiseTimeLineOptions.js +7 -1
- package/src/sap/gantt/axistime/StepwiseZoomStrategy.js +10 -4
- package/src/sap/gantt/changeHandlers/simple/AdhocLine.js +1 -1
- package/src/sap/gantt/changeHandlers/simple/DeltaLine.js +1 -1
- package/src/sap/gantt/changeHandlers/simple/GanttChartContainer.js +1 -1
- package/src/sap/gantt/changeHandlers/simple/GanttChartWithTable.js +1 -1
- package/src/sap/gantt/config/BirdEyeGroup.js +1 -1
- package/src/sap/gantt/config/ChartScheme.js +1 -1
- package/src/sap/gantt/config/ColumnAttribute.js +1 -1
- package/src/sap/gantt/config/ContainerLayout.js +1 -1
- package/src/sap/gantt/config/ExpandChart.js +1 -1
- package/src/sap/gantt/config/ExpandChartGroup.js +1 -1
- package/src/sap/gantt/config/GanttChartLayout.js +1 -1
- package/src/sap/gantt/config/Hierarchy.js +1 -1
- package/src/sap/gantt/config/HierarchyColumn.js +1 -1
- package/src/sap/gantt/config/LayoutGroup.js +1 -1
- package/src/sap/gantt/config/Locale.js +1 -1
- package/src/sap/gantt/config/Mode.js +1 -1
- package/src/sap/gantt/config/ModeGroup.js +1 -1
- package/src/sap/gantt/config/ObjectType.js +1 -1
- package/src/sap/gantt/config/SettingGroup.js +1 -1
- package/src/sap/gantt/config/SettingItem.js +1 -1
- package/src/sap/gantt/config/Shape.js +1 -1
- package/src/sap/gantt/config/TimeAxis.js +1 -1
- package/src/sap/gantt/config/TimeHorizon.js +1 -1
- package/src/sap/gantt/config/TimeZoomGroup.js +1 -1
- package/src/sap/gantt/config/ToolbarGroup.js +1 -1
- package/src/sap/gantt/config/ToolbarScheme.js +1 -1
- package/src/sap/gantt/control/Cell.js +1 -1
- package/src/sap/gantt/def/DefBase.js +1 -1
- package/src/sap/gantt/def/SvgDefs.js +1 -1
- package/src/sap/gantt/def/cal/Calendar.js +1 -1
- package/src/sap/gantt/def/cal/CalendarDefs.js +1 -1
- package/src/sap/gantt/def/cal/TimeInterval.js +1 -1
- package/src/sap/gantt/def/filter/MorphologyFilter.js +1 -1
- package/src/sap/gantt/def/gradient/LinearGradient.js +1 -1
- package/src/sap/gantt/def/gradient/RadialGradient.js +1 -1
- package/src/sap/gantt/def/gradient/Stop.js +1 -1
- package/src/sap/gantt/def/pattern/BackSlashPattern.js +1 -1
- package/src/sap/gantt/def/pattern/PatternBase.js +1 -1
- package/src/sap/gantt/def/pattern/SlashPattern.js +1 -1
- package/src/sap/gantt/drawer/AdhocLine.js +1 -1
- package/src/sap/gantt/drawer/Drawer.js +1 -1
- package/src/sap/gantt/drawer/Legend.js +6 -0
- package/src/sap/gantt/drawer/VerticalLine.js +1 -1
- package/src/sap/gantt/eventHandler/AutoScrollHandler.js +1 -1
- package/src/sap/gantt/eventHandler/BirdEyeHandler.js +7 -1
- package/src/sap/gantt/eventHandler/MouseWheelHandler.js +1 -1
- package/src/sap/gantt/eventHandler/ShapeHoverHandler.js +1 -1
- package/src/sap/gantt/eventHandler/ShapeResizeHandler.js +1 -1
- package/src/sap/gantt/eventHandler/TimePeriodZoomHandler.js +1 -1
- package/src/sap/gantt/eventHandler/TimePopoverHandler.js +1 -1
- package/src/sap/gantt/flexibility/simple/AdhocLine.flexibility.js +7 -1
- package/src/sap/gantt/flexibility/simple/DeltaLine.flexibility.js +7 -1
- package/src/sap/gantt/flexibility/simple/GanttChartWithTable.flexibility.js +7 -1
- package/src/sap/gantt/flexibility/simple/GanttTableColumn.flexibility.js +6 -7
- package/src/sap/gantt/layouts/SidePanel.js +1 -1
- package/src/sap/gantt/legend/DimensionLegend.js +1 -1
- package/src/sap/gantt/legend/LegendBase.js +1 -1
- package/src/sap/gantt/legend/LegendContainer.js +1 -1
- package/src/sap/gantt/legend/ListLegend.js +1 -1
- package/src/sap/gantt/library.js +13 -3
- package/src/sap/gantt/messagebundle.properties +8 -2
- package/src/sap/gantt/messagebundle_sh.properties +30 -30
- package/src/sap/gantt/misc/AxisOrdinal.js +1 -1
- package/src/sap/gantt/misc/AxisTime.js +80 -22
- package/src/sap/gantt/misc/Format.js +2 -2
- package/src/sap/gantt/misc/Memoizer.js +1 -1
- package/src/sap/gantt/misc/RelativeTimeFormatter.js +1 -1
- package/src/sap/gantt/misc/ShapeManager.js +1 -1
- package/src/sap/gantt/misc/Utility.js +11 -0
- package/src/sap/gantt/overlays/GanttRowOverlay.js +80 -16
- package/src/sap/gantt/overlays/Overlay.js +1 -1
- package/src/sap/gantt/polyfills/lib.js +7 -1
- package/src/sap/gantt/polyfills/time.js +13 -7
- package/src/sap/gantt/polyfills/timeUtils/day.js +13 -0
- package/src/sap/gantt/polyfills/{time-utils → timeUtils}/dayCount.js +7 -1
- package/src/sap/gantt/polyfills/timeUtils/days.js +13 -0
- package/src/sap/gantt/polyfills/{time-utils → timeUtils}/interval.js +6 -0
- package/src/sap/gantt/polyfills/{time-utils → timeUtils}/millisecond.js +6 -0
- package/src/sap/gantt/polyfills/timeUtils/monday.js +13 -0
- package/src/sap/gantt/polyfills/timeUtils/saturday.js +13 -0
- package/src/sap/gantt/polyfills/timeUtils/weeks.js +13 -0
- package/src/sap/gantt/shape/Circle.js +1 -1
- package/src/sap/gantt/shape/ClipPath.js +1 -1
- package/src/sap/gantt/shape/Definitions.js +1 -1
- package/src/sap/gantt/shape/Group.js +1 -1
- package/src/sap/gantt/shape/Image.js +1 -1
- package/src/sap/gantt/shape/Line.js +1 -1
- package/src/sap/gantt/shape/Path.js +1 -1
- package/src/sap/gantt/shape/Polygon.js +1 -1
- package/src/sap/gantt/shape/Polyline.js +1 -1
- package/src/sap/gantt/shape/Rectangle.js +1 -1
- package/src/sap/gantt/shape/ResizeShadowShape.js +1 -1
- package/src/sap/gantt/shape/SelectedShape.js +1 -1
- package/src/sap/gantt/shape/Shape.js +1 -1
- package/src/sap/gantt/shape/Text.js +1 -1
- package/src/sap/gantt/shape/cal/Calendar.js +1 -1
- package/src/sap/gantt/shape/ext/Chevron.js +1 -1
- package/src/sap/gantt/shape/ext/Cursor.js +1 -1
- package/src/sap/gantt/shape/ext/Diamond.js +1 -1
- package/src/sap/gantt/shape/ext/Iconfont.js +1 -1
- package/src/sap/gantt/shape/ext/Pentangle.js +1 -1
- package/src/sap/gantt/shape/ext/TextRepeat.js +1 -1
- package/src/sap/gantt/shape/ext/Triangle.js +1 -1
- package/src/sap/gantt/shape/ext/rls/Relationship.js +1 -1
- package/src/sap/gantt/shape/ext/rls/SelectedRelationship.js +2 -2
- package/src/sap/gantt/shape/ext/ubc/UbcBorderPath.js +1 -1
- package/src/sap/gantt/shape/ext/ubc/UbcOverCapacityZonePolygon.js +1 -1
- package/src/sap/gantt/shape/ext/ubc/UbcPolygon.js +1 -1
- package/src/sap/gantt/shape/ext/ubc/UbcShortageCapacityPolygon.js +1 -1
- package/src/sap/gantt/shape/ext/ubc/UbcTooltipRectangle.js +1 -1
- package/src/sap/gantt/shape/ext/ubc/UbcUnderCapacityZonePolygon.js +1 -1
- package/src/sap/gantt/shape/ext/ubc/UbcUsedPolygon.js +1 -1
- package/src/sap/gantt/shape/ext/ubc/UtilizationBarChart.js +1 -1
- package/src/sap/gantt/shape/ext/ulc/UlcBorderPath.js +1 -1
- package/src/sap/gantt/shape/ext/ulc/UlcClipPath.js +1 -1
- package/src/sap/gantt/shape/ext/ulc/UlcClipingPath.js +1 -1
- package/src/sap/gantt/shape/ext/ulc/UlcDimension.js +1 -1
- package/src/sap/gantt/shape/ext/ulc/UlcMiddleLine.js +1 -1
- package/src/sap/gantt/shape/ext/ulc/UlcOverCapacityZoneRectangle.js +1 -1
- package/src/sap/gantt/shape/ext/ulc/UlcOverClipRectangle.js +1 -1
- package/src/sap/gantt/shape/ext/ulc/UlcRectangle.js +1 -1
- package/src/sap/gantt/shape/ext/ulc/UlcTooltipRectangle.js +1 -1
- package/src/sap/gantt/shape/ext/ulc/UlcUnderClipRectangle.js +1 -1
- package/src/sap/gantt/shape/ext/ulc/UtilizationLineChart.js +1 -1
- package/src/sap/gantt/simple/AdhocDiamond.js +1 -1
- package/src/sap/gantt/simple/AdhocLine.js +1 -1
- package/src/sap/gantt/simple/AggregationUtils.js +11 -58
- package/src/sap/gantt/simple/BaseCalendar.js +1 -1
- package/src/sap/gantt/simple/BaseChevron.js +1 -1
- package/src/sap/gantt/simple/BaseConditionalShape.js +1 -1
- package/src/sap/gantt/simple/BaseCursor.js +7 -7
- package/src/sap/gantt/simple/BaseDeltaRectangle.js +7 -4
- package/src/sap/gantt/simple/BaseDiamond.js +1 -1
- package/src/sap/gantt/simple/BaseGroup.js +1 -1
- package/src/sap/gantt/simple/BaseImage.js +1 -1
- package/src/sap/gantt/simple/BaseLine.js +1 -1
- package/src/sap/gantt/simple/BasePath.js +1 -1
- package/src/sap/gantt/simple/BasePseudoShape.js +1 -1
- package/src/sap/gantt/simple/BaseRectangle.js +5 -2
- package/src/sap/gantt/simple/BaseShape.js +7 -5
- package/src/sap/gantt/simple/BaseText.js +1 -1
- package/src/sap/gantt/simple/BaseTriangle.js +7 -1
- package/src/sap/gantt/simple/ContainerToolbar.js +19 -4
- package/src/sap/gantt/simple/ContainerToolbarPlaceholder.js +1 -1
- package/src/sap/gantt/simple/CoordinateUtils.js +1 -1
- package/src/sap/gantt/simple/CustomVariantHandler.js +8 -2
- package/src/sap/gantt/simple/DeltaLine.js +1 -1
- package/src/sap/gantt/simple/ExpandModel.js +2 -4
- package/src/sap/gantt/simple/FindAndSelectUtils.js +6 -0
- package/src/sap/gantt/simple/FullScreenUtil.js +7 -1
- package/src/sap/gantt/simple/GanttAdaptationData.js +8 -2
- package/src/sap/gantt/simple/GanttChartContainer.js +8 -2
- package/src/sap/gantt/simple/GanttChartWithTable.js +63 -5
- package/src/sap/gantt/simple/GanttDragDropExtension.js +17 -5
- package/src/sap/gantt/simple/GanttExtension.js +1 -1
- package/src/sap/gantt/simple/GanttHeader.js +1 -1
- package/src/sap/gantt/simple/GanttPointerExtension.js +1 -1
- package/src/sap/gantt/simple/GanttPopoverExtension.js +2 -2
- package/src/sap/gantt/simple/GanttPrinting.js +313 -198
- package/src/sap/gantt/simple/GanttRowAction.js +1 -1
- package/src/sap/gantt/simple/GanttRowSettings.js +30 -1
- package/src/sap/gantt/simple/GanttScrollExtension.js +20 -5
- package/src/sap/gantt/simple/GanttSearchSidePanel.js +7 -1
- package/src/sap/gantt/simple/GanttUtils.js +86 -1
- package/src/sap/gantt/simple/GanttZoomExtension.js +4 -4
- package/src/sap/gantt/simple/InnerGanttChart.js +1 -1
- package/src/sap/gantt/simple/LegendContainer.js +1 -1
- package/src/sap/gantt/simple/LegendShapeGroup.js +1 -1
- package/src/sap/gantt/simple/MultiActivityGroup.js +1 -1
- package/src/sap/gantt/simple/MultiActivityRowSettings.js +1 -1
- package/src/sap/gantt/simple/PrintConfig.js +314 -0
- package/src/sap/gantt/simple/PrintDialogTemplate.js +38 -0
- package/src/sap/gantt/simple/PrintUtils.js +151 -0
- package/src/sap/gantt/simple/Relationship.js +1 -1
- package/src/sap/gantt/simple/ShapeScheme.js +1 -1
- package/src/sap/gantt/simple/StockChart.js +1 -1
- package/src/sap/gantt/simple/StockChartDimension.js +1 -1
- package/src/sap/gantt/simple/StockChartPeriod.js +1 -1
- package/src/sap/gantt/simple/UtilizationBarChart.js +1 -1
- package/src/sap/gantt/simple/UtilizationChart.js +4 -1
- package/src/sap/gantt/simple/UtilizationDimension.js +1 -1
- package/src/sap/gantt/simple/UtilizationLineChart.js +1 -1
- package/src/sap/gantt/simple/UtilizationPeriod.js +1 -1
- package/src/sap/gantt/simple/shapes/Shape.js +6 -6
- package/src/sap/gantt/simple/shapes/Task.js +1 -1
- package/src/sap/gantt/skipTime/DayInterval.js +63 -0
- package/src/sap/gantt/skipTime/DiscontinuousProvider.js +54 -0
- package/src/sap/gantt/skipTime/SkipInterval.js +76 -0
- package/src/sap/gantt/skipTime/SkipPattern.js +64 -0
- package/src/sap/gantt/skipTime/WeekPattern.js +118 -0
- package/src/sap/gantt/skipTime/WeeklyDiscontinuousProvider.js +84 -0
- package/src/sap/gantt/themes/sap_hcb/base_Gantt.less +899 -0
- package/src/sap/gantt/themes/sap_hcb/base_GanttPrinting.less +101 -0
- package/src/sap/gantt/themes/sap_hcb/base_GanttSyncedControl.less +96 -0
- package/src/sap/gantt/themes/sap_hcb/library.source.less +15 -1
- package/src/sap/gantt/thirdparty/d3fc-discontinuous-scale.js +1129 -0
- package/src/sap/gantt/thirdparty/d3fc-rebind.js +103 -0
- package/src/sap/gantt/thirdparty/licenses/d3fc-MIT-LICENSE.txt +21 -0
- package/src/sap/gantt/utils/GanttChartConfigurationUtils.js +6 -0
- package/src/sap/gantt/utils/GanttCustomisationUtils.js +7 -1
- package/src/sap/gantt/utils/GanttFlexibilityUtils.js +7 -1
- package/src/sap/gantt/polyfills/time-utils/day.js +0 -7
- package/src/sap/gantt/polyfills/time-utils/days.js +0 -7
- package/src/sap/gantt/polyfills/time-utils/monday.js +0 -7
- package/src/sap/gantt/polyfills/time-utils/saturday.js +0 -7
- package/src/sap/gantt/polyfills/time-utils/weeks.js +0 -7
|
@@ -27,7 +27,7 @@ sap.ui.define([
|
|
|
27
27
|
* @extends sap.ui.table.RowSettings
|
|
28
28
|
*
|
|
29
29
|
* @author SAP SE
|
|
30
|
-
* @version 1.
|
|
30
|
+
* @version 1.127.0
|
|
31
31
|
*
|
|
32
32
|
* @constructor
|
|
33
33
|
* @public
|
|
@@ -286,5 +286,34 @@ sap.ui.define([
|
|
|
286
286
|
return this;
|
|
287
287
|
};
|
|
288
288
|
|
|
289
|
+
GanttRowSettings.prototype._onRowExpandToggle = function(oExpandInfo) {
|
|
290
|
+
if (!oExpandInfo) {
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
if (this._oRowExpandInfo && (this._oRowExpandInfo.expanded === oExpandInfo.expanded && this._oRowExpandInfo.pseudoShapeExpand === oExpandInfo.pseudoShapeExpand)) {
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
this._oRowExpandInfo = oExpandInfo;
|
|
299
|
+
|
|
300
|
+
if (this._isExpanded()) {
|
|
301
|
+
this._handleEvent(new jQuery.Event("RowExpanded"));
|
|
302
|
+
} else {
|
|
303
|
+
this._handleEvent(new jQuery.Event("RowCollapsed"));
|
|
304
|
+
}
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
GanttRowSettings.prototype._isExpanded = function() {
|
|
308
|
+
return this._oRowExpandInfo && (this._oRowExpandInfo.expanded && !this._oRowExpandInfo.pseudoShapeExpand);
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
GanttRowSettings.prototype.clone = function () {
|
|
312
|
+
var oClone = TableRowSettings.prototype.clone.call(this);
|
|
313
|
+
oClone._oRowExpandInfo = this._oRowExpandInfo;
|
|
314
|
+
|
|
315
|
+
return oClone;
|
|
316
|
+
};
|
|
317
|
+
|
|
289
318
|
return GanttRowSettings;
|
|
290
319
|
});
|
|
@@ -44,7 +44,7 @@ sap.ui.define([
|
|
|
44
44
|
var sScrollEvent = "scroll" + sNamespace;
|
|
45
45
|
var HorizontalScrollingHelper = {
|
|
46
46
|
onHSBScroll: function(oEvent) {
|
|
47
|
-
if (this.getHorizontalLazyLoadingEnabled()){
|
|
47
|
+
if (this.getHorizontalLazyLoadingEnabled() || this._isLazyLoadingEnabledForSyncedChart()) {
|
|
48
48
|
if (this._iScrollTimer !== null) {
|
|
49
49
|
clearTimeout(this._iScrollTimer);
|
|
50
50
|
}
|
|
@@ -467,11 +467,11 @@ sap.ui.define([
|
|
|
467
467
|
// usually the visible horizon or zoom rate changed
|
|
468
468
|
this.updateGanttScrollWidth();
|
|
469
469
|
}
|
|
470
|
-
|
|
470
|
+
var oGantt = this.getGantt();
|
|
471
471
|
if (!bToolbarSettingsItemChanged && sReasonCode !== "initialRender" && this.mOffsetWidth && this.doesSvgScrollWithinBuffer() && !this.getGantt().getSyncedControl().getRowsHeightChanged()) {
|
|
472
472
|
this._scrollTableToVisibleHorizon(true);
|
|
473
473
|
this.scrollGanttChartToVisibleHorizon();
|
|
474
|
-
|
|
474
|
+
oGantt.getSyncedControl().scrollContentIfNecessary();
|
|
475
475
|
return false;
|
|
476
476
|
}
|
|
477
477
|
|
|
@@ -482,10 +482,25 @@ sap.ui.define([
|
|
|
482
482
|
this.updateSvgOffsetWidth();
|
|
483
483
|
|
|
484
484
|
if ((sReasonCode !== "initialRender" || (sReasonCode === "initialRender" && bToolbarSettingsItemChanged)) && fnRedrawGanttChart) {
|
|
485
|
-
fnRedrawGanttChart.apply(
|
|
485
|
+
fnRedrawGanttChart.apply(oGantt);
|
|
486
486
|
// It has to be called after fnRedrawGanttChart because of svg width is set over there.
|
|
487
487
|
this.scrollGanttChartToVisibleHorizon();
|
|
488
|
-
|
|
488
|
+
oGantt.getSyncedControl().scrollContentIfNecessary();
|
|
489
|
+
}
|
|
490
|
+
if (oGantt._minTime && oGantt._minEndTime) {
|
|
491
|
+
var iMinTime = oGantt._minTime.getTime();
|
|
492
|
+
var iMinEndTime = oGantt._minEndTime.getTime();
|
|
493
|
+
delete oGantt._minTime;
|
|
494
|
+
delete oGantt._minEndTime;
|
|
495
|
+
var oVisibleHorizon = oGantt.getAxisTimeStrategy().getVisibleHorizon();
|
|
496
|
+
var iVisibleHorizonStartTime = Format.abapTimestampToDate(oVisibleHorizon.getStartTime()).getTime();
|
|
497
|
+
var iVisibleHorizonEndTime = Format.abapTimestampToDate(oVisibleHorizon.getEndTime()).getTime();
|
|
498
|
+
if ((iMinEndTime <= iVisibleHorizonStartTime) || (iMinTime >= iVisibleHorizonEndTime)) {
|
|
499
|
+
var nVisibleWidth = oGantt.getVisibleWidth();
|
|
500
|
+
var timeRangePerPixel = (iVisibleHorizonEndTime - iVisibleHorizonStartTime) / nVisibleWidth;
|
|
501
|
+
var oMinTime = new Date(iMinTime - timeRangePerPixel * 5); // buffer of 5px before the start time, similar to bird eye
|
|
502
|
+
oGantt.jumpToPosition(oMinTime);
|
|
503
|
+
}
|
|
489
504
|
}
|
|
490
505
|
|
|
491
506
|
return true;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* SAP UI development toolkit for HTML5 (SAPUI5)
|
|
3
|
+
|
|
4
|
+
(c) Copyright 2009-2015 SAP SE. All rights reserved
|
|
5
|
+
|
|
6
|
+
*/
|
|
1
7
|
sap.ui.define([
|
|
2
8
|
"sap/ui/core/Control",
|
|
3
9
|
"sap/ui/core/Core",
|
|
@@ -384,4 +390,4 @@ sap.ui.define([
|
|
|
384
390
|
};
|
|
385
391
|
|
|
386
392
|
return GanttSearchSidePanel;
|
|
387
|
-
});
|
|
393
|
+
});
|
|
@@ -96,7 +96,7 @@ sap.ui.define([
|
|
|
96
96
|
nTimeX = oShape.getXByTime(vTime);
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
if (!
|
|
99
|
+
if (!Utility.isNumeric(nTimeX)) {
|
|
100
100
|
Log.warning("couldn't convert timestamp to x with value: " + vTime);
|
|
101
101
|
}
|
|
102
102
|
|
|
@@ -1335,6 +1335,91 @@ sap.ui.define([
|
|
|
1335
1335
|
return sText ? sText.length : 0;
|
|
1336
1336
|
}
|
|
1337
1337
|
return (nCount >= 0 && nCount <= sText.length) ? nCount : 0;
|
|
1338
|
+
},
|
|
1339
|
+
|
|
1340
|
+
/**
|
|
1341
|
+
* Calculates the selected shape with minimum start time among all the gantt charts in gantt container
|
|
1342
|
+
* @param {object} oGanttContainer Gantt chart container control
|
|
1343
|
+
* @private
|
|
1344
|
+
*/
|
|
1345
|
+
_calculateSelectedShapeMinTime: function(oGanttContainer) {
|
|
1346
|
+
var that = this;
|
|
1347
|
+
var _getShapeWithTime = function(oShape, oGantt) {
|
|
1348
|
+
if (!oShape || oShape.isA("sap.gantt.simple.Relationship")) {
|
|
1349
|
+
return;
|
|
1350
|
+
}
|
|
1351
|
+
if (oShape.isA("sap.gantt.simple.BaseConditionalShape")) {
|
|
1352
|
+
oShape = oShape._getActiveShapeElement();
|
|
1353
|
+
}
|
|
1354
|
+
if (oShape.getTime() || oShape.getEndTime()) {
|
|
1355
|
+
that._oFoundShape = oShape;
|
|
1356
|
+
} else if (oShape instanceof sap.gantt.simple.BaseGroup) {
|
|
1357
|
+
if (oGantt.getSelectOnlyGraphicalShape()) {
|
|
1358
|
+
oShape._eachChildOfGroup(oShape, function (labelGroup, nonLabelGroup) {
|
|
1359
|
+
nonLabelGroup.forEach(function(oChild) {
|
|
1360
|
+
if (!that._oFoundShape) {
|
|
1361
|
+
_getShapeWithTime(oChild, oGantt);
|
|
1362
|
+
}
|
|
1363
|
+
});
|
|
1364
|
+
});
|
|
1365
|
+
} else {
|
|
1366
|
+
oShape._eachChildOfGroup(oShape, function (oChild) {
|
|
1367
|
+
if (!that._oFoundShape) {
|
|
1368
|
+
_getShapeWithTime(oChild, oGantt);
|
|
1369
|
+
}
|
|
1370
|
+
});
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
};
|
|
1374
|
+
|
|
1375
|
+
var oMinGantt, oOverallMinTime, oOverallMinEndTime;
|
|
1376
|
+
var bSync = oGanttContainer.getEnableTimeScrollSync();
|
|
1377
|
+
var aGanttCharts = oGanttContainer.getGanttCharts();
|
|
1378
|
+
var oGanttChart = aGanttCharts[0];
|
|
1379
|
+
if (oGanttChart) {
|
|
1380
|
+
oOverallMinTime = Format.abapTimestampToDate(oGanttChart.getAxisTimeStrategy().getTotalHorizon().getEndTime());
|
|
1381
|
+
}
|
|
1382
|
+
aGanttCharts.forEach(function (oGantt) {
|
|
1383
|
+
var oMinTime = Format.abapTimestampToDate(oGantt.getAxisTimeStrategy().getTotalHorizon().getEndTime()), oMinEndTime;
|
|
1384
|
+
var aSelectedShapeUid = oGantt.getSelectedShapeUid();
|
|
1385
|
+
if (aSelectedShapeUid && aSelectedShapeUid.length > 0) {
|
|
1386
|
+
var aShapes = this.getShapesWithUid(oGantt.sId, aSelectedShapeUid);
|
|
1387
|
+
var oVisibleHorizon = oGantt.getAxisTimeStrategy().getVisibleHorizon();
|
|
1388
|
+
var iVisibleHorizonStartTime = Format.abapTimestampToDate(oVisibleHorizon.getStartTime()).getTime();
|
|
1389
|
+
var iVisibleHorizonEndTime = Format.abapTimestampToDate(oVisibleHorizon.getEndTime()).getTime();
|
|
1390
|
+
aShapes.forEach(function(oShape) {
|
|
1391
|
+
this._oFoundShape = null;
|
|
1392
|
+
_getShapeWithTime(oShape, oGantt);
|
|
1393
|
+
if (this._oFoundShape) {
|
|
1394
|
+
var oStartTime = this._oFoundShape.getTime() ? this._oFoundShape.getTime() : this._oFoundShape.getEndTime();
|
|
1395
|
+
var oEndTime = this._oFoundShape.getEndTime() ? this._oFoundShape.getEndTime() : this._oFoundShape.getTime();
|
|
1396
|
+
var iStartTime = oStartTime.getTime();
|
|
1397
|
+
var iEndTime = oEndTime.getTime();
|
|
1398
|
+
var bShapeInVisibleHorizon = (iStartTime >= iVisibleHorizonStartTime && iStartTime < iVisibleHorizonEndTime) || (iEndTime > iVisibleHorizonStartTime && iEndTime <= iVisibleHorizonEndTime) || (iStartTime < iVisibleHorizonStartTime && iEndTime > iVisibleHorizonEndTime);
|
|
1399
|
+
if (bShapeInVisibleHorizon) {
|
|
1400
|
+
if (bSync) {
|
|
1401
|
+
if (iStartTime < oOverallMinTime.getTime()) {
|
|
1402
|
+
oOverallMinTime = oStartTime;
|
|
1403
|
+
oOverallMinEndTime = oEndTime;
|
|
1404
|
+
oMinGantt = oGantt;
|
|
1405
|
+
}
|
|
1406
|
+
} else if (iStartTime < oMinTime.getTime()) {
|
|
1407
|
+
oMinTime = oStartTime;
|
|
1408
|
+
oMinEndTime = oEndTime;
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
}
|
|
1412
|
+
}.bind(this));
|
|
1413
|
+
}
|
|
1414
|
+
if (!bSync && oMinEndTime) {
|
|
1415
|
+
oGantt._minTime = oMinTime;
|
|
1416
|
+
oGantt._minEndTime = oMinEndTime;
|
|
1417
|
+
}
|
|
1418
|
+
}.bind(this));
|
|
1419
|
+
if (bSync && oMinGantt) {
|
|
1420
|
+
oMinGantt._minTime = oOverallMinTime;
|
|
1421
|
+
oMinGantt._minEndTime = oOverallMinEndTime;
|
|
1422
|
+
}
|
|
1338
1423
|
}
|
|
1339
1424
|
};
|
|
1340
1425
|
|
|
@@ -77,7 +77,7 @@ sap.ui.define([
|
|
|
77
77
|
oGanttDom = mDom.gantt,
|
|
78
78
|
oHeaderSvg = mDom.headerSvg;
|
|
79
79
|
var fnBindEventToDom = function(sEventName, oDom) {
|
|
80
|
-
jQuery(oDom).
|
|
80
|
+
jQuery(oDom).on(sEventName, GanttZoomHelper.dispatch.bind(oGantt));
|
|
81
81
|
};
|
|
82
82
|
|
|
83
83
|
// before binding events, first clear all to prevent duplicate event registered
|
|
@@ -159,9 +159,9 @@ sap.ui.define([
|
|
|
159
159
|
oGanttSvg = mDom.ganttSvg,
|
|
160
160
|
oGanttDom = mDom.gantt,
|
|
161
161
|
oHeaderSvg = mDom.headerSvg;
|
|
162
|
-
jQuery(oGanttSvg).
|
|
163
|
-
jQuery(oHeaderSvg).
|
|
164
|
-
jQuery(oGanttDom).
|
|
162
|
+
jQuery(oGanttSvg).off(sNameSpace);
|
|
163
|
+
jQuery(oHeaderSvg).off(sNameSpace);
|
|
164
|
+
jQuery(oGanttDom).off(sNameSpace);
|
|
165
165
|
jQuery(document).off(sNameSpace);
|
|
166
166
|
|
|
167
167
|
}
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* SAP UI development toolkit for HTML5 (SAPUI5)
|
|
3
|
+
|
|
4
|
+
(c) Copyright 2009-2015 SAP SE. All rights reserved
|
|
5
|
+
|
|
6
|
+
*/
|
|
7
|
+
sap.ui.define(['sap/ui/base/Object',
|
|
8
|
+
"../simple/PrintUtils"
|
|
9
|
+
], function(BaseObject,PrintUtils) {
|
|
10
|
+
'use strict';
|
|
11
|
+
/**
|
|
12
|
+
* Creates and initializes a print configuration class.
|
|
13
|
+
* @class PrintConfig is a class that holds the configuration for the print page.
|
|
14
|
+
* @extends sap.ui.base.Object
|
|
15
|
+
* If the configuration is incorrect, errors with the following codes are shown.
|
|
16
|
+
* TYPE_ERROR - If the type of the property is not as expected.
|
|
17
|
+
* RANGE_ERROR - If the value of the property is not in the expected range or not in the list specified
|
|
18
|
+
* REQUIRED_ERROR - If the required property is missing.
|
|
19
|
+
*
|
|
20
|
+
* @param {object} printConfiguartionObject - The print configurationobject can have keys as pageConfig, textConfig, marginConfig, durationConfig, exportConfig and with values as defined in below structure.
|
|
21
|
+
* pageConfig - The page configuration object with the following given keys.
|
|
22
|
+
* paperSize: : Possible values are "A0" | "A1" | "A2" | "A3" | "A4" | "A5" | "Letter" | "Legal" | "Tabloid" | "Custom". Select one of the provided values as the paper size of the print page. Default value is "A4".
|
|
23
|
+
* unit": Possible values are "mm" | "cm" | "in". Select one of the provided values as the unit for paper and margin measurements. Default value is "mm" for all paper size except "Letter", "Legal", "Tabloid" where default value is "in".
|
|
24
|
+
* paperHeight: It must be a number, and it must be the unit specified within the page configuration. It is considered only when paper size is "Custom". If paper size is not provided, then the default value is height of the "A4" paper size.
|
|
25
|
+
* paperWidth: It must be a number, and it must be the unit specified within the page configuration. It is considered only when the paper size is "Custom". If paper size is not provided, then "A4" is the default width.
|
|
26
|
+
* portrait: It must be a boolean value as it is the orientation of the page. Default value is true.
|
|
27
|
+
* showPageNumber: It must be a boolean value. It decides if the page number is to be displayed. Default value is false. Not applicable in single page API.
|
|
28
|
+
* textConfig - The text configuration with the following given keys.
|
|
29
|
+
* showHeaderText: It must be a boolean value. It is a flag to decide whether to show the header text or not in the print page. Default value is false.
|
|
30
|
+
* showFooterText: It must be a boolean value. It is a flag to decide whether to show the footer text or not in the print page. Default value is false.
|
|
31
|
+
* headerText: It must be a string value to display header text in the print page. Default value is empty string.
|
|
32
|
+
* footerText: It must be a string value to display footer text in the print page. Default value is empty string.
|
|
33
|
+
* marginConfig - The margin configuration object with the following given keys.
|
|
34
|
+
* marginType: Possible values are "custom" | "none" | "default". Select one of the provided values for the margin type of the print page. Default value is "default".
|
|
35
|
+
* marginLeft: It must be a number and it must be in the unit specified within the page configuration. It is considered only when margin type is set as "custom". When the margin type is "default", the default value is "5mm". If "none" is maintained, then the value is "0".
|
|
36
|
+
* marginBottom: It must be a number and it must be in the unit specified within the page configuration. It is considered only when margin type is set as "custom". When the margin type is "default", the default value is "5mm". If "none" is maintained, then the value is "0".
|
|
37
|
+
* marginRight: It must be a number and it must be in the unit specified within the page configuration. It is considered only when margin type is set as "custom". When the margin type is "default", the default value is "5mm". If "none" is maintained, then the value is "0".
|
|
38
|
+
* marginTop: It must be a number and it must be in the unit specified within the page configuration. It is considered only when margin type is set as "custom". When the margin type is "default", the default value is "5mm". If "none" is maintained, then the value is "0".
|
|
39
|
+
* marginLocked: It must be a boolean value. If set to true, it signifies all four margins get synced on the same value. If the value is provided by the application, the margin top is considered for all four margins. Default value is false and considered only when the margin type is "custom".
|
|
40
|
+
* durationConfig - The duration configuration object with following given keys.
|
|
41
|
+
* duration: Possible values are "all" | "week" | "month" | "custom". Select the date duration of the print page. Default value is "all".
|
|
42
|
+
* If the provided value is "all", then the total horizon is set as duration. Values provided in "startDate" and "endDate" are ignored.
|
|
43
|
+
* If the provided value is "week", then the next week is set as duration. Values provided in "startDate" and "endDate" are ignored.
|
|
44
|
+
* If the provided value is "month", then the next month is set as duration. Values provided in "startDate" and "endDate" are ignored.
|
|
45
|
+
* If the provided value is "custom", then the value provided in "startDate" and "endDate" is set as duration.
|
|
46
|
+
* startDate: This is a UI5 date object. It is the start date of a print page. It is considered only when the "duration" is set as "custom".
|
|
47
|
+
* endDate: This is a UI5 date object. It is the end date of a print page. It is considered only when the "duration" is set as "custom".
|
|
48
|
+
* exportConfig - The export configuration object with the following given keys.
|
|
49
|
+
* exportAsJPEG: It must be a boolean value. It is a flag to decide whether to export the pdf as a JPEG or not. Default value is true, which means that the exported PDF has content in a JPEG image format. This is not applicable for single page API.
|
|
50
|
+
* exportRange: It must be a string value such as, '0,1". It is the range of the export. This is not applicable for a single page API and when "exportAll" is set to true.
|
|
51
|
+
* exportAll: It must be a boolean value. It is a flag to decide whether to export all the pages or not. Default value is true. This is not applicable for a single page API.
|
|
52
|
+
* compressionQuality: It must be a number between the range of 1 to 100. The quality of the compression is applicable only when "exportAsJPEG" is set to true. Default value is 75. This is not applicable for a single page API.
|
|
53
|
+
* scale: It must be a number between the range of 50 to 100. This is to scale the export up or down. Default value is 100. This is not applicable for a single page API.
|
|
54
|
+
* multiplePage: It must be a boolean value. It is a flag to decide whether if the export is multiple page. This is not applicable for a single page API.
|
|
55
|
+
* @return Instance of PrintConfiguration class.
|
|
56
|
+
* @constructor
|
|
57
|
+
* @public
|
|
58
|
+
* @since 1.127
|
|
59
|
+
* @alias sap.gantt.simple.PrintConfig
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
var PrintConfig = BaseObject.extend('sap.gantt.simple.PrintConfig', {
|
|
63
|
+
constructor: function(printConfiguartionObject) {
|
|
64
|
+
this._setPageConfig(printConfiguartionObject.pageConfig);
|
|
65
|
+
this._setTextConfig(printConfiguartionObject.textConfig);
|
|
66
|
+
this._setMarginConfig(printConfiguartionObject.marginConfig);
|
|
67
|
+
this._setDurationConfig(printConfiguartionObject.durationConfig);
|
|
68
|
+
this._setExportConfig(printConfiguartionObject.exportConfig);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Error class for PrintConfig.
|
|
74
|
+
* PrintConfigError is a class that extends Error class and holds the error code and details.
|
|
75
|
+
* @param {string} code - The error code.
|
|
76
|
+
* @param {string} details - The error details.
|
|
77
|
+
* @private
|
|
78
|
+
*/
|
|
79
|
+
class PrintConfigError extends Error{
|
|
80
|
+
static typeError(details){
|
|
81
|
+
return new PrintConfigError(`TYPE_ERROR`,details);
|
|
82
|
+
}
|
|
83
|
+
static rangeError(details){
|
|
84
|
+
return new PrintConfigError(`RANGE_ERROR`,details);
|
|
85
|
+
}
|
|
86
|
+
static requiredError(details){
|
|
87
|
+
return new PrintConfigError(`REQUIRED_ERROR`,details);
|
|
88
|
+
}
|
|
89
|
+
constructor(code,details){
|
|
90
|
+
super(details);
|
|
91
|
+
this.code = code;
|
|
92
|
+
this.details = details;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Gets the page configuration.
|
|
97
|
+
* @returns {object} - The page configuration.
|
|
98
|
+
* @private
|
|
99
|
+
*/
|
|
100
|
+
PrintConfig.prototype._getPageConfig = function() {
|
|
101
|
+
return this.pageConfig || {};
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Sets the page configuration.
|
|
105
|
+
* @param {object} pageConfig - The page configuration.
|
|
106
|
+
* @private
|
|
107
|
+
*/
|
|
108
|
+
PrintConfig.prototype._setPageConfig = function(pageConfig) {
|
|
109
|
+
if (pageConfig && typeof pageConfig !== 'object') {
|
|
110
|
+
throw PrintConfigError.typeError('pageConfig must be an object');
|
|
111
|
+
} else if (pageConfig && Object.keys(pageConfig).length > 0){
|
|
112
|
+
if (pageConfig.hasOwnProperty('portrait') && typeof pageConfig['portrait'] !== 'boolean') {
|
|
113
|
+
throw PrintConfigError.typeError('Portrait must be a boolean');
|
|
114
|
+
} else if (pageConfig.hasOwnProperty('showPageNumber') && typeof pageConfig['showPageNumber'] !== 'boolean') {
|
|
115
|
+
throw PrintConfigError.typeError('showPageNumber must be a boolean');
|
|
116
|
+
} else if (pageConfig.hasOwnProperty('unit') && !['mm', 'cm', 'in'].includes(pageConfig['unit'])) {
|
|
117
|
+
throw PrintConfigError.rangeError('Unit must be selected from the possible values of mm, cm or in');
|
|
118
|
+
} else if (pageConfig.hasOwnProperty('paperSize')){
|
|
119
|
+
if (!['A0', 'A1', 'A2', 'A3', 'A4', 'A5', 'Letter', 'Legal', 'Tabloid', 'Custom'].includes(pageConfig['paperSize'])) {
|
|
120
|
+
throw PrintConfigError.rangeError('paperSize must be selected from one of the possible values A0, A1, A2, A3, A4, A5, Letter, Legal, Tabloid, or Custom');
|
|
121
|
+
} else if (['Letter', 'Legal', 'Tabloid'].includes(pageConfig['paperSize'])){
|
|
122
|
+
pageConfig['unit'] = pageConfig['unit'] || "in";
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
pageConfig['unit'] = pageConfig['unit'] || 'mm';
|
|
126
|
+
if (pageConfig.hasOwnProperty('paperSize') && pageConfig['paperSize'] === 'Custom'){
|
|
127
|
+
if (!pageConfig.hasOwnProperty('paperWidth') || !pageConfig.hasOwnProperty('paperHeight')){
|
|
128
|
+
throw PrintConfigError.requiredError('paperWidth and paperHeight must be provided for custom paperSize');
|
|
129
|
+
}
|
|
130
|
+
if (typeof pageConfig['paperHeight'] !== 'number'){
|
|
131
|
+
throw PrintConfigError.typeError('paperHeight must be a number');
|
|
132
|
+
}
|
|
133
|
+
if (typeof pageConfig['paperWidth'] !== 'number'){
|
|
134
|
+
throw PrintConfigError.typeError('paperWidth must be a number');
|
|
135
|
+
}
|
|
136
|
+
} else {
|
|
137
|
+
pageConfig['paperSize'] = pageConfig['paperSize'] || 'A4';
|
|
138
|
+
pageConfig['paperWidth'] = PrintUtils._convertPxToUnit(PrintUtils._getPaperConfiguarations()[pageConfig['paperSize']]['width'],pageConfig['unit']);
|
|
139
|
+
pageConfig['paperHeight'] = PrintUtils._convertPxToUnit(PrintUtils._getPaperConfiguarations()[pageConfig['paperSize']]['height'],pageConfig['unit']);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
this.pageConfig = pageConfig;
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* Gets the text configuration.
|
|
146
|
+
* @returns {object} - The text configuration.
|
|
147
|
+
* @private
|
|
148
|
+
*/
|
|
149
|
+
PrintConfig.prototype._getTextConfig = function() {
|
|
150
|
+
return this.textConfig || {};
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* Sets the text configuration
|
|
154
|
+
* @param {object} textConfig - The text configuration.
|
|
155
|
+
* @private
|
|
156
|
+
*/
|
|
157
|
+
PrintConfig.prototype._setTextConfig = function(textConfig) {
|
|
158
|
+
if (textConfig && typeof textConfig !== 'object') {
|
|
159
|
+
throw PrintConfigError.typeError('textConfig must be an object');
|
|
160
|
+
} else if (textConfig && Object.keys(textConfig).length > 0){
|
|
161
|
+
const requiredProperties = ['showHeaderText', 'showFooterText', 'headerText', 'footerText'];
|
|
162
|
+
for (var prop of requiredProperties) {
|
|
163
|
+
if (['showHeaderText', 'showFooterText'].includes(prop) && typeof textConfig[prop] !== 'boolean') {
|
|
164
|
+
throw PrintConfigError.typeError(`${prop} must be a boolean`);
|
|
165
|
+
} else if (['headerText', 'footerText'].includes(prop) && typeof textConfig[prop] !== 'string') {
|
|
166
|
+
throw PrintConfigError.typeError(`${prop} must be a string`);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
this.textConfig = textConfig;
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* Gets the margin configuration.
|
|
174
|
+
* @returns {object} - The margin configuration.
|
|
175
|
+
* @private
|
|
176
|
+
*/
|
|
177
|
+
PrintConfig.prototype._getMarginConfig = function() {
|
|
178
|
+
return this.marginConfig || {};
|
|
179
|
+
};
|
|
180
|
+
/**
|
|
181
|
+
* Sets the margin configuration.
|
|
182
|
+
* @param {object} marginConfig - The margin configuration.
|
|
183
|
+
* @private
|
|
184
|
+
*/
|
|
185
|
+
PrintConfig.prototype._setMarginConfig = function (marginConfig) {
|
|
186
|
+
if (marginConfig && typeof marginConfig !== 'object') {
|
|
187
|
+
throw PrintConfigError.typeError('marginConfig must be an object');
|
|
188
|
+
} else if (marginConfig && Object.keys(marginConfig).length > 0){
|
|
189
|
+
const requiredProperties = ['marginLeft', 'marginBottom', 'marginRight', 'marginTop'];
|
|
190
|
+
var paperUnit = this._getPageConfig().unit;
|
|
191
|
+
var marginDefaultValue = PrintUtils._convertPxToUnit(PrintUtils._mmToPx(5),paperUnit);
|
|
192
|
+
|
|
193
|
+
switch (marginConfig.marginType) {
|
|
194
|
+
case 'default':
|
|
195
|
+
this.marginConfig = {
|
|
196
|
+
marginLeft: marginDefaultValue,
|
|
197
|
+
marginBottom: marginDefaultValue,
|
|
198
|
+
marginRight: marginDefaultValue,
|
|
199
|
+
marginTop: marginDefaultValue,
|
|
200
|
+
marginLocked: marginConfig.hasOwnProperty('marginLocked') ? marginConfig['marginLocked'] : false,
|
|
201
|
+
marginType: 'default'
|
|
202
|
+
};
|
|
203
|
+
break;
|
|
204
|
+
case 'none':
|
|
205
|
+
this.marginConfig = { marginLeft: 0, marginBottom: 0, marginRight: 0, marginTop: 0, marginType: 'none', marginLocked: marginConfig.hasOwnProperty('marginLocked') ? marginConfig['marginLocked'] : false};
|
|
206
|
+
break;
|
|
207
|
+
case 'custom':
|
|
208
|
+
var paperWidth = this._getPageConfig().paperWidth, paperHeight = this._getPageConfig().paperHeight;
|
|
209
|
+
for (var prop of requiredProperties) {
|
|
210
|
+
if (marginConfig.hasOwnProperty(prop)){
|
|
211
|
+
if (typeof marginConfig[prop] !== 'number') {
|
|
212
|
+
throw PrintConfigError.typeError(`${prop} must be a number`);
|
|
213
|
+
}
|
|
214
|
+
if (['marginLeft', 'marginRight'].includes(prop) && marginConfig[prop] > (paperWidth / 3)) {
|
|
215
|
+
throw PrintConfigError.rangeError(prop + ' must not be more than ' + paperWidth / 3 + ' ' + paperUnit);
|
|
216
|
+
}
|
|
217
|
+
if (['marginBottom', 'marginTop'].includes(prop) && marginConfig[prop] > (paperHeight / 3)) {
|
|
218
|
+
throw PrintConfigError.rangeError(prop + ' must not be more than ' + paperHeight / 3 + ' ' + paperUnit);
|
|
219
|
+
}
|
|
220
|
+
} else {
|
|
221
|
+
marginConfig[prop] = marginDefaultValue;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
if (marginConfig.hasOwnProperty('marginLocked') ){
|
|
225
|
+
if (typeof marginConfig['marginLocked'] !== 'boolean'){
|
|
226
|
+
throw PrintConfigError.typeError('marginLocked must be a boolean value.');
|
|
227
|
+
}
|
|
228
|
+
if (marginConfig['marginLocked']){
|
|
229
|
+
marginConfig['marginLeft'] = marginConfig['marginTop'];
|
|
230
|
+
marginConfig['marginRight'] = marginConfig['marginTop'];
|
|
231
|
+
marginConfig['marginBottom'] = marginConfig['marginTop'];
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
this.marginConfig = marginConfig;
|
|
235
|
+
break;
|
|
236
|
+
default:
|
|
237
|
+
throw PrintConfigError.rangeError("marginType must be either 'custom', 'none', or 'default'.");
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Gets the duration configuration.
|
|
244
|
+
* @returns {object} - The duration configuration.
|
|
245
|
+
* @private
|
|
246
|
+
*/
|
|
247
|
+
PrintConfig.prototype._getDurationConfig = function() {
|
|
248
|
+
return this.durationConfig || {};
|
|
249
|
+
};
|
|
250
|
+
/**
|
|
251
|
+
* Sets the duration configuration.
|
|
252
|
+
* @param {object} durationConfig - The duration configuration.
|
|
253
|
+
* @private
|
|
254
|
+
*/
|
|
255
|
+
PrintConfig.prototype._setDurationConfig = function(durationConfig) {
|
|
256
|
+
if (durationConfig && typeof durationConfig !== 'object') {
|
|
257
|
+
throw PrintConfigError.typeError('durationConfig must be an object');
|
|
258
|
+
} else if (durationConfig && Object.keys(durationConfig).length > 0){
|
|
259
|
+
if (!durationConfig.hasOwnProperty('duration')) {
|
|
260
|
+
throw PrintConfigError.requiredError(`Required property is missing for durationConfig: duration`);
|
|
261
|
+
}
|
|
262
|
+
if (!['all', 'week', 'month', 'custom'].includes(durationConfig['duration'])) {
|
|
263
|
+
throw PrintConfigError.rangeError(`Date duration must be selected from the possible values of: 'all', 'week', 'month', 'custom'`);
|
|
264
|
+
}
|
|
265
|
+
if (durationConfig['duration'] == 'custom'){
|
|
266
|
+
if (!durationConfig.hasOwnProperty('startDate') || !durationConfig.hasOwnProperty('endDate')){
|
|
267
|
+
throw PrintConfigError.requiredError(`startDate and endDate must be provided for custom duration`);
|
|
268
|
+
} else if (!(durationConfig['startDate'] instanceof Date) || !(durationConfig['endDate'] instanceof Date)){
|
|
269
|
+
throw PrintConfigError.typeError(`startDate and endDate must be a UI5 date object`);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
this.durationConfig = durationConfig;
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
/**
|
|
276
|
+
* Gets the export configuration.
|
|
277
|
+
* @returns {object} - The export configuration.
|
|
278
|
+
* @private
|
|
279
|
+
*/
|
|
280
|
+
PrintConfig.prototype._getExportConfig = function() {
|
|
281
|
+
return this.exportConfig || {};
|
|
282
|
+
};
|
|
283
|
+
/**
|
|
284
|
+
* Sets the export configuration.
|
|
285
|
+
* @param {object} exportConfig - The export configuration.
|
|
286
|
+
* @private
|
|
287
|
+
*/
|
|
288
|
+
PrintConfig.prototype._setExportConfig = function(exportConfig) {
|
|
289
|
+
if (exportConfig && typeof exportConfig !== 'object') {
|
|
290
|
+
throw PrintConfigError.typeError('exportConfig must be an object');
|
|
291
|
+
} else if (exportConfig && Object.keys(exportConfig).length > 0){
|
|
292
|
+
const requiredProperties = ['exportAsJPEG', 'exportRange', 'exportAll', 'compressionQuality', 'scale', 'multiplePage'];
|
|
293
|
+
for (var prop of requiredProperties) {
|
|
294
|
+
if (exportConfig.hasOwnProperty(prop)){
|
|
295
|
+
if (['exportAsJPEG', 'exportAll', 'multiplePage'].includes(prop) && typeof exportConfig[prop] !== 'boolean') {
|
|
296
|
+
throw PrintConfigError.typeError(`${prop} must be a boolean`);
|
|
297
|
+
} else if (['compressionQuality', 'scale'].includes(prop) && typeof exportConfig[prop] !== 'number') {
|
|
298
|
+
throw PrintConfigError.typeError(`${prop} must be a number`);
|
|
299
|
+
} else if (prop === 'exportRange' && typeof exportConfig[prop] !== 'string') {
|
|
300
|
+
throw PrintConfigError.typeError(`exportRange must be string`);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
if (exportConfig.hasOwnProperty('scale') && (exportConfig['scale'] < 50 || exportConfig['scale'] > 200)){
|
|
305
|
+
throw PrintConfigError.rangeError('scale must be in the range of 50 to 200');
|
|
306
|
+
}
|
|
307
|
+
if (exportConfig.hasOwnProperty('compressionQuality') && (exportConfig['compressionQuality'] < 1 || exportConfig['compressionQuality'] > 100)){
|
|
308
|
+
throw PrintConfigError.rangeError('compressionQuality must be in the range of 1 to 100');
|
|
309
|
+
}
|
|
310
|
+
this.exportConfig = exportConfig;
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
return PrintConfig;
|
|
314
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* SAP UI development toolkit for HTML5 (SAPUI5)
|
|
3
|
+
|
|
4
|
+
(c) Copyright 2009-2015 SAP SE. All rights reserved
|
|
5
|
+
|
|
6
|
+
*/
|
|
7
|
+
sap.ui.define([
|
|
8
|
+
'sap/ui/base/ManagedObject'
|
|
9
|
+
], function (ManagedObject) {
|
|
10
|
+
"use strict";
|
|
11
|
+
/**
|
|
12
|
+
* Creates and initializes a new print dialog template class.
|
|
13
|
+
*
|
|
14
|
+
* @param {string} [sId] ID of the new control, it is generated automatically if no ID is provided.
|
|
15
|
+
* @param {object} [mSettings] Initial settings for the new control
|
|
16
|
+
*
|
|
17
|
+
* @class
|
|
18
|
+
* Enables the user to define print dialog footer buttons.
|
|
19
|
+
* Print dialog template offers an option to provide custom buttons for the print dialog footer.
|
|
20
|
+
* @extends sap.ui.base.ManagedObject
|
|
21
|
+
*
|
|
22
|
+
* @author SAP SE
|
|
23
|
+
* @version 1.127.0
|
|
24
|
+
*
|
|
25
|
+
* @constructor
|
|
26
|
+
* @public
|
|
27
|
+
* @since 1.127
|
|
28
|
+
* @alias sap.gantt.simple.PrintDialogTemplate
|
|
29
|
+
*/
|
|
30
|
+
var PrintDialogTemplate = ManagedObject.extend("sap.gantt.simple.PrintDialogTemplate", {
|
|
31
|
+
metadata: {
|
|
32
|
+
aggregations: {
|
|
33
|
+
footerButtons: { type: "sap.m.Button", multiple: true }
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return PrintDialogTemplate;
|
|
38
|
+
}, true);
|