@sapui5/sap.gantt 1.126.0 → 1.127.1
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 +1 -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 +1 -1
- 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 +1 -1
- 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 +2 -2
- package/src/sap/gantt/messagebundle.properties +8 -2
- package/src/sap/gantt/misc/AxisOrdinal.js +1 -1
- 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 +1 -1
- package/src/sap/gantt/overlays/Overlay.js +1 -1
- package/src/sap/gantt/polyfills/lib.js +6 -0
- package/src/sap/gantt/polyfills/time.js +6 -0
- package/src/sap/gantt/polyfills/timeUtils/day.js +6 -0
- package/src/sap/gantt/polyfills/timeUtils/dayCount.js +6 -0
- package/src/sap/gantt/polyfills/timeUtils/days.js +6 -0
- package/src/sap/gantt/polyfills/timeUtils/interval.js +6 -0
- package/src/sap/gantt/polyfills/timeUtils/millisecond.js +6 -0
- package/src/sap/gantt/polyfills/timeUtils/monday.js +6 -0
- package/src/sap/gantt/polyfills/timeUtils/saturday.js +6 -0
- package/src/sap/gantt/polyfills/timeUtils/weeks.js +6 -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 +1 -1
- 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 +1 -1
- 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 +4 -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 +2 -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 +7 -1
- 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 -2
- 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 +1 -1
- package/src/sap/gantt/simple/GanttChartWithTable.js +28 -4
- package/src/sap/gantt/simple/GanttDragDropExtension.js +10 -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 +311 -197
- package/src/sap/gantt/simple/GanttRowAction.js +1 -1
- package/src/sap/gantt/simple/GanttRowSettings.js +1 -1
- package/src/sap/gantt/simple/GanttScrollExtension.js +1 -1
- package/src/sap/gantt/simple/GanttSearchSidePanel.js +7 -1
- package/src/sap/gantt/simple/GanttUtils.js +6 -3
- package/src/sap/gantt/simple/GanttZoomExtension.js +4 -4
- package/src/sap/gantt/simple/InnerGanttChart.js +1 -1
- package/src/sap/gantt/simple/InnerGanttChartRenderer.js +2 -0
- 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/RenderUtils.js +1 -1
- package/src/sap/gantt/simple/SelectionModel.js +14 -0
- 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 +1 -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 +1 -1
- package/src/sap/gantt/skipTime/DiscontinuousProvider.js +8 -2
- package/src/sap/gantt/skipTime/SkipInterval.js +1 -1
- package/src/sap/gantt/skipTime/SkipPattern.js +1 -1
- package/src/sap/gantt/skipTime/WeekPattern.js +1 -1
- package/src/sap/gantt/skipTime/WeeklyDiscontinuousProvider.js +6 -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
|
@@ -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
|
}
|
|
@@ -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
|
|
|
@@ -239,8 +239,11 @@ sap.ui.define([
|
|
|
239
239
|
var sElm = document.querySelector(selector);
|
|
240
240
|
if (sElm) {
|
|
241
241
|
const oElement = Element.getElementById(sElm.id);
|
|
242
|
-
if (
|
|
243
|
-
|
|
242
|
+
if (oElement) {
|
|
243
|
+
const oElmPart = Utility.parseUid(oElement.getShapeUid());
|
|
244
|
+
if (oElmPart.shapeId === sShapeId && oElmPart.rowId === oPart.rowId) {
|
|
245
|
+
return oElement;
|
|
246
|
+
}
|
|
244
247
|
}
|
|
245
248
|
}
|
|
246
249
|
};
|
|
@@ -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
|
}
|
|
@@ -641,6 +641,8 @@ sap.ui.define([
|
|
|
641
641
|
oFakeRlsInstance.bindObject({path: sBindingPath, model: oRelationshipsBindingInfo.model});
|
|
642
642
|
if (GanttUtils.relationexist(oGantt,oFakeRlsInstance)){
|
|
643
643
|
GanttUtils.setLmarker(oGantt,oFakeRlsInstance,false);
|
|
644
|
+
} else {
|
|
645
|
+
oFakeRlsInstance.destroy();
|
|
644
646
|
}
|
|
645
647
|
}
|
|
646
648
|
};
|
|
@@ -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.1
|
|
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);
|
|
@@ -0,0 +1,151 @@
|
|
|
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
|
+
], function() {
|
|
9
|
+
"use strict";
|
|
10
|
+
/**
|
|
11
|
+
* @private
|
|
12
|
+
* Provides helper methods for print configurations.
|
|
13
|
+
* @author SAP SE
|
|
14
|
+
* @version 1.127.1
|
|
15
|
+
* @alias sap.gantt.simple.PrintUtils
|
|
16
|
+
* @since 1.127
|
|
17
|
+
*/
|
|
18
|
+
var PrintUtils = {
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* List of paper configurations.
|
|
22
|
+
* @returns {object} Paper configurations.
|
|
23
|
+
* @private
|
|
24
|
+
*/
|
|
25
|
+
_getPaperConfiguarations: function() {
|
|
26
|
+
return {
|
|
27
|
+
"A5": {
|
|
28
|
+
width: this._mmToPx(148),
|
|
29
|
+
height: this._mmToPx(210)
|
|
30
|
+
},
|
|
31
|
+
"A4": {
|
|
32
|
+
width: this._mmToPx(210),
|
|
33
|
+
height: this._mmToPx(297)
|
|
34
|
+
},
|
|
35
|
+
"A3": {
|
|
36
|
+
width: this._mmToPx(297),
|
|
37
|
+
height: this._mmToPx(420)
|
|
38
|
+
},
|
|
39
|
+
"A2": {
|
|
40
|
+
width: this._mmToPx(420),
|
|
41
|
+
height: this._mmToPx(594)
|
|
42
|
+
},
|
|
43
|
+
"A1": {
|
|
44
|
+
width: this._mmToPx(594),
|
|
45
|
+
height: this._mmToPx(841)
|
|
46
|
+
},
|
|
47
|
+
"A0": {
|
|
48
|
+
width: this._mmToPx(841),
|
|
49
|
+
height: this._mmToPx(1189)
|
|
50
|
+
},
|
|
51
|
+
"Letter": {
|
|
52
|
+
width: this._inToPx(8.5),
|
|
53
|
+
height: this._inToPx(11)
|
|
54
|
+
},
|
|
55
|
+
"Legal": {
|
|
56
|
+
width: this._inToPx(8.5),
|
|
57
|
+
height: this._inToPx(14)
|
|
58
|
+
},
|
|
59
|
+
"Tabloid": {
|
|
60
|
+
width: this._inToPx(11),
|
|
61
|
+
height: this._inToPx(17)
|
|
62
|
+
},
|
|
63
|
+
"Custom": {
|
|
64
|
+
width: undefined,
|
|
65
|
+
height: undefined
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @param {number} mm - value in milimeter to be converted into pixel.
|
|
72
|
+
* @returns {number} - value in pixel.
|
|
73
|
+
* @private
|
|
74
|
+
*/
|
|
75
|
+
_mmToPx: function (mm) {
|
|
76
|
+
return mm * 3.78;
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* @param {Number} iIn - value in inches to be converted into pixel.
|
|
81
|
+
* @returns {number} - value in pixel.
|
|
82
|
+
* @private
|
|
83
|
+
*/
|
|
84
|
+
_inToPx: function(iIn) {
|
|
85
|
+
return iIn / 0.01042;
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* @param {number} fPx - value in pixel to be converted into milimeter.
|
|
90
|
+
* @returns {number} - value in milimeter.
|
|
91
|
+
* @private
|
|
92
|
+
*/
|
|
93
|
+
_pxToMm: function(fPx) {
|
|
94
|
+
// 1 millimeter = 3.78 pixel
|
|
95
|
+
return fPx / 3.78;
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* @param {number} fPx - value in pixel to be converted into inches.
|
|
100
|
+
* @returns {number} - value in inches.
|
|
101
|
+
* @private
|
|
102
|
+
*/
|
|
103
|
+
_pxToIn: function(fPx) {
|
|
104
|
+
// 1 inch = pixel 0.01042 pixel
|
|
105
|
+
return fPx * 0.01042;
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Converts given value to a pixel based on unit.
|
|
110
|
+
* @param {number} value - The value to be converted.
|
|
111
|
+
* @param {string} unit - The unit of the value.
|
|
112
|
+
* @returns {number} - The converted value in pixels.
|
|
113
|
+
* @private
|
|
114
|
+
*/
|
|
115
|
+
_convertUnitToPx: function(value, unit) {
|
|
116
|
+
switch (unit) {
|
|
117
|
+
case "mm":
|
|
118
|
+
return value * 3.78;
|
|
119
|
+
case "cm":
|
|
120
|
+
return value * 3.78 * 10;
|
|
121
|
+
case "in":
|
|
122
|
+
return value / 0.01042;
|
|
123
|
+
default:
|
|
124
|
+
return undefined;
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* converts pixel value to given unit.
|
|
130
|
+
* @param {number} fPx - The value to be converted.
|
|
131
|
+
* @param {string} unit - The unit to which the value is to be converted.
|
|
132
|
+
* @returns {number} - The converted value in given unit.
|
|
133
|
+
* @private
|
|
134
|
+
*/
|
|
135
|
+
_convertPxToUnit: function (fPx,unit) {
|
|
136
|
+
switch (unit) {
|
|
137
|
+
case "mm":
|
|
138
|
+
return this._pxToMm(fPx);
|
|
139
|
+
case "cm":
|
|
140
|
+
return this._pxToMm(fPx) / 10;
|
|
141
|
+
case "in":
|
|
142
|
+
return this._pxToIn(fPx);
|
|
143
|
+
default:
|
|
144
|
+
return undefined;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
return PrintUtils;
|
|
150
|
+
|
|
151
|
+
}, /* bExport= */ true);
|