mdt-charts 1.29.0 → 1.29.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.
Files changed (257) hide show
  1. package/lib/config/config.d.ts +167 -177
  2. package/lib/designer/designerConfig.d.ts +59 -62
  3. package/lib/engine/block/block.d.ts +16 -22
  4. package/lib/engine/block/block.js +51 -51
  5. package/lib/engine/block/blockHelper.d.ts +6 -6
  6. package/lib/engine/block/blockHelper.js +16 -16
  7. package/lib/engine/block/blockHtml.d.ts +8 -8
  8. package/lib/engine/block/blockHtml.js +15 -15
  9. package/lib/engine/block/blockSvg.d.ts +20 -20
  10. package/lib/engine/block/blockSvg.js +66 -65
  11. package/lib/engine/block/defs/LinearGradientDef.d.ts +2 -2
  12. package/lib/engine/block/defs/LinearGradientDef.js +27 -27
  13. package/lib/engine/block/defs/hatchPattern.d.ts +4 -4
  14. package/lib/engine/block/defs/hatchPattern.js +9 -9
  15. package/lib/engine/colorReader/colorReader.d.ts +5 -5
  16. package/lib/engine/colorReader/colorReader.js +18 -18
  17. package/lib/engine/contentManager/contentManager.d.ts +7 -6
  18. package/lib/engine/contentManager/contentManager.js +15 -15
  19. package/lib/engine/contentManager/contentManagerFactory.d.ts +7 -7
  20. package/lib/engine/contentManager/contentManagerFactory.js +12 -12
  21. package/lib/engine/elementHighlighter/elementHighlighter.d.ts +22 -70
  22. package/lib/engine/elementHighlighter/elementHighlighter.js +181 -230
  23. package/lib/engine/elementHighlighter/selectHighlighter.d.ts +4 -29
  24. package/lib/engine/elementHighlighter/selectHighlighter.js +87 -189
  25. package/lib/engine/engine.d.ts +17 -17
  26. package/lib/engine/engine.js +62 -87
  27. package/lib/engine/features/aggregator/aggregator.d.ts +17 -24
  28. package/lib/engine/features/aggregator/aggregator.js +102 -113
  29. package/lib/engine/features/axis/axis.d.ts +9 -22
  30. package/lib/engine/features/axis/axis.js +150 -159
  31. package/lib/engine/features/axis/axisDomHelper.d.ts +2 -7
  32. package/lib/engine/features/axis/axisDomHelper.js +20 -19
  33. package/lib/engine/features/axis/axisHelper.d.ts +5 -9
  34. package/lib/engine/features/axis/axisHelper.js +33 -28
  35. package/lib/engine/features/axis/axisLabelDomHelper.d.ts +11 -26
  36. package/lib/engine/features/axis/axisLabelDomHelper.js +152 -156
  37. package/lib/engine/features/axis/axisLabelsEventManager.d.ts +2 -2
  38. package/lib/engine/features/axis/axisLabelsEventManager.js +32 -32
  39. package/lib/engine/features/embeddedLabels/embeddedLabels.d.ts +16 -51
  40. package/lib/engine/features/embeddedLabels/embeddedLabels.js +134 -234
  41. package/lib/engine/features/embeddedLabels/embeddedLabelsDomHelper.d.ts +2 -13
  42. package/lib/engine/features/embeddedLabels/embeddedLabelsDomHelper.js +23 -20
  43. package/lib/engine/features/embeddedLabels/embeddedLabelsHelper.d.ts +15 -32
  44. package/lib/engine/features/embeddedLabels/embeddedLabelsHelper.js +63 -56
  45. package/lib/engine/features/gridLine/gidLineHelper.d.ts +7 -13
  46. package/lib/engine/features/gridLine/gidLineHelper.js +49 -42
  47. package/lib/engine/features/gridLine/gridLine.d.ts +5 -19
  48. package/lib/engine/features/gridLine/gridLine.js +36 -35
  49. package/lib/engine/features/legend/legend.d.ts +28 -38
  50. package/lib/engine/features/legend/legend.js +92 -118
  51. package/lib/engine/features/legend/legendDomHelper.d.ts +6 -13
  52. package/lib/engine/features/legend/legendDomHelper.js +62 -63
  53. package/lib/engine/features/legend/legendEventsManager.d.ts +8 -13
  54. package/lib/engine/features/legend/legendEventsManager.js +47 -48
  55. package/lib/engine/features/legend/legendHelper.d.ts +14 -39
  56. package/lib/engine/features/legend/legendHelper.js +92 -98
  57. package/lib/engine/features/legend/legendHelperService.d.ts +6 -13
  58. package/lib/engine/features/legend/legendHelperService.js +25 -24
  59. package/lib/engine/features/legend/legendMarkerCreator.d.ts +9 -18
  60. package/lib/engine/features/legend/legendMarkerCreator.js +76 -79
  61. package/lib/engine/features/legend/legendWidthCalculator.d.ts +7 -7
  62. package/lib/engine/features/legend/legendWidthCalculator.js +122 -126
  63. package/lib/engine/features/markDots/markDot.d.ts +15 -42
  64. package/lib/engine/features/markDots/markDot.js +70 -101
  65. package/lib/engine/features/markDots/markDotsHelper.d.ts +1 -8
  66. package/lib/engine/features/markDots/markDotsHelper.js +12 -13
  67. package/lib/engine/features/recordOverflowAlert/recordOverflowAlertCore.d.ts +5 -23
  68. package/lib/engine/features/recordOverflowAlert/recordOverflowAlertCore.js +34 -42
  69. package/lib/engine/features/scale/scale.d.ts +12 -17
  70. package/lib/engine/features/scale/scale.js +69 -76
  71. package/lib/engine/features/tipBox/tipBox.d.ts +5 -9
  72. package/lib/engine/features/tipBox/tipBox.js +24 -24
  73. package/lib/engine/features/tipBox/tipBoxHelper.d.ts +9 -16
  74. package/lib/engine/features/tipBox/tipBoxHelper.js +45 -60
  75. package/lib/engine/features/title/title.d.ts +6 -6
  76. package/lib/engine/features/title/title.js +35 -34
  77. package/lib/engine/features/tolltip/newTooltip/newTooltip.d.ts +11 -15
  78. package/lib/engine/features/tolltip/newTooltip/newTooltip.js +21 -21
  79. package/lib/engine/features/tolltip/newTooltip/newTooltipService.d.ts +8 -13
  80. package/lib/engine/features/tolltip/newTooltip/newTooltipService.js +23 -26
  81. package/lib/engine/features/tolltip/tooltip.d.ts +11 -17
  82. package/lib/engine/features/tolltip/tooltip.js +142 -296
  83. package/lib/engine/features/tolltip/tooltipComponentsManager.d.ts +10 -21
  84. package/lib/engine/features/tolltip/tooltipComponentsManager.js +114 -113
  85. package/lib/engine/features/tolltip/tooltipDomHelper.d.ts +21 -43
  86. package/lib/engine/features/tolltip/tooltipDomHelper.js +120 -144
  87. package/lib/engine/features/tolltip/tooltipHelper.d.ts +9 -39
  88. package/lib/engine/features/tolltip/tooltipHelper.js +91 -114
  89. package/lib/engine/features/valueLabels/valueLabels.d.ts +38 -58
  90. package/lib/engine/features/valueLabels/valueLabels.js +169 -205
  91. package/lib/engine/features/valueLabels/valueLabelsHelper.d.ts +1 -7
  92. package/lib/engine/features/valueLabels/valueLabelsHelper.js +18 -23
  93. package/lib/engine/features/valueLabelsCollision/valueLabelsCollision.d.ts +15 -18
  94. package/lib/engine/features/valueLabelsCollision/valueLabelsCollision.js +47 -46
  95. package/lib/engine/features/valueLabelsCollision/valueLabelsCollisionHelper.d.ts +3 -6
  96. package/lib/engine/features/valueLabelsCollision/valueLabelsCollisionHelper.js +45 -49
  97. package/lib/engine/filterManager/filterEventManager.d.ts +30 -37
  98. package/lib/engine/filterManager/filterEventManager.js +131 -174
  99. package/lib/engine/helpers/domHelper.d.ts +20 -45
  100. package/lib/engine/helpers/domHelper.js +61 -62
  101. package/lib/engine/helpers/fontResizer/fontResizer.d.ts +10 -10
  102. package/lib/engine/helpers/fontResizer/fontResizer.js +16 -21
  103. package/lib/engine/helpers/fontResizer/fontResizerService.d.ts +1 -1
  104. package/lib/engine/helpers/fontResizer/fontResizerService.js +10 -9
  105. package/lib/engine/helpers/helper.d.ts +27 -27
  106. package/lib/engine/helpers/helper.js +92 -91
  107. package/lib/engine/helpers/namesHelper.d.ts +3 -3
  108. package/lib/engine/helpers/namesHelper.js +6 -6
  109. package/lib/engine/helpers/pipeline/Pipeline.d.ts +5 -5
  110. package/lib/engine/helpers/pipeline/Pipeline.js +33 -33
  111. package/lib/engine/polarNotation/donut/DonutHelper.d.ts +11 -25
  112. package/lib/engine/polarNotation/donut/DonutHelper.js +70 -71
  113. package/lib/engine/polarNotation/donut/donut.d.ts +23 -38
  114. package/lib/engine/polarNotation/donut/donut.js +99 -109
  115. package/lib/engine/polarNotation/polarManager.d.ts +6 -6
  116. package/lib/engine/polarNotation/polarManager.js +47 -67
  117. package/lib/engine/transitionManager.d.ts +14 -13
  118. package/lib/engine/transitionManager.js +49 -48
  119. package/lib/engine/twoDimensionalNotation/area/area.d.ts +28 -44
  120. package/lib/engine/twoDimensionalNotation/area/area.js +238 -272
  121. package/lib/engine/twoDimensionalNotation/area/areaGenerator.d.ts +5 -13
  122. package/lib/engine/twoDimensionalNotation/area/areaGenerator.js +13 -13
  123. package/lib/engine/twoDimensionalNotation/area/areaHelper.d.ts +4 -4
  124. package/lib/engine/twoDimensionalNotation/area/areaHelper.js +41 -57
  125. package/lib/engine/twoDimensionalNotation/bar/bar.d.ts +29 -54
  126. package/lib/engine/twoDimensionalNotation/bar/bar.js +224 -362
  127. package/lib/engine/twoDimensionalNotation/bar/barHelper.d.ts +32 -71
  128. package/lib/engine/twoDimensionalNotation/bar/barHelper.js +126 -162
  129. package/lib/engine/twoDimensionalNotation/bar/stackedData/dataStacker.d.ts +6 -6
  130. package/lib/engine/twoDimensionalNotation/bar/stackedData/dataStacker.js +24 -24
  131. package/lib/engine/twoDimensionalNotation/bar/stackedData/dataStackerService.d.ts +2 -2
  132. package/lib/engine/twoDimensionalNotation/bar/stackedData/dataStackerService.js +17 -16
  133. package/lib/engine/twoDimensionalNotation/dot/dotChart.d.ts +23 -23
  134. package/lib/engine/twoDimensionalNotation/dot/dotChart.js +114 -135
  135. package/lib/engine/twoDimensionalNotation/line/line.d.ts +16 -37
  136. package/lib/engine/twoDimensionalNotation/line/line.js +132 -162
  137. package/lib/engine/twoDimensionalNotation/line/lineBuilder.d.ts +11 -14
  138. package/lib/engine/twoDimensionalNotation/line/lineBuilder.js +48 -47
  139. package/lib/engine/twoDimensionalNotation/line/lineGenerator.d.ts +4 -4
  140. package/lib/engine/twoDimensionalNotation/line/lineGenerator.js +8 -8
  141. package/lib/engine/twoDimensionalNotation/line/lineHelper.d.ts +6 -12
  142. package/lib/engine/twoDimensionalNotation/line/lineHelper.js +60 -76
  143. package/lib/engine/twoDimensionalNotation/lineLike/generatorFactory/lineLikeGeneratorFactory.d.ts +6 -6
  144. package/lib/engine/twoDimensionalNotation/lineLike/generatorMiddleware/lineLikeGeneratorCurveMiddleware.d.ts +5 -5
  145. package/lib/engine/twoDimensionalNotation/lineLike/generatorMiddleware/lineLikeGeneratorCurveMiddleware.js +17 -16
  146. package/lib/engine/twoDimensionalNotation/lineLike/generatorMiddleware/lineLikeGeneratorDefineMiddleware.d.ts +10 -11
  147. package/lib/engine/twoDimensionalNotation/lineLike/generatorMiddleware/lineLikeGeneratorDefineMiddleware.js +7 -9
  148. package/lib/engine/twoDimensionalNotation/lineLike/generatorMiddleware/lineLikeGeneratorMiddleware.d.ts +1 -3
  149. package/lib/engine/twoDimensionalNotation/twoDimensionalManager.d.ts +10 -10
  150. package/lib/engine/twoDimensionalNotation/twoDimensionalManager.js +138 -253
  151. package/lib/engine/valueFormatter.d.ts +3 -3
  152. package/lib/engine/valueFormatter.js +6 -6
  153. package/lib/main.d.ts +79 -82
  154. package/lib/main.js +84 -79
  155. package/lib/model/EventEmitter.d.ts +8 -8
  156. package/lib/model/EventEmitter.js +24 -24
  157. package/lib/model/chartStyleModel/chartStyleModel.d.ts +5 -5
  158. package/lib/model/chartStyleModel/chartStyleModel.js +25 -27
  159. package/lib/model/chartStyleModel/colorRange.d.ts +3 -3
  160. package/lib/model/chartStyleModel/colorRange.js +24 -19
  161. package/lib/model/chartStyleModel/twoDimensionalChartStyleModel.d.ts +12 -22
  162. package/lib/model/chartStyleModel/twoDimensionalChartStyleModel.js +60 -69
  163. package/lib/model/configsValidator/configValidator.d.ts +1 -1
  164. package/lib/model/configsValidator/configValidator.js +4 -4
  165. package/lib/model/dataManagerModel/dataManagerModel.d.ts +26 -36
  166. package/lib/model/dataManagerModel/dataManagerModel.js +128 -179
  167. package/lib/model/dataManagerModel/dataManagerModelService.d.ts +2 -2
  168. package/lib/model/dataManagerModel/dataManagerModelService.js +26 -25
  169. package/lib/model/featuresModel/axisModel.d.ts +18 -69
  170. package/lib/model/featuresModel/axisModel.js +169 -224
  171. package/lib/model/featuresModel/axisModelService.d.ts +6 -10
  172. package/lib/model/featuresModel/axisModelService.js +27 -27
  173. package/lib/model/featuresModel/legendModel/legendCanvasModel.d.ts +11 -16
  174. package/lib/model/featuresModel/legendModel/legendCanvasModel.js +59 -55
  175. package/lib/model/featuresModel/legendModel/legendModel.d.ts +3 -7
  176. package/lib/model/featuresModel/legendModel/legendModel.js +41 -59
  177. package/lib/model/featuresModel/legendModel/polarMarginCalculator.d.ts +3 -8
  178. package/lib/model/featuresModel/legendModel/polarMarginCalculator.js +20 -18
  179. package/lib/model/featuresModel/legendModel/twoDimLegendModel.d.ts +4 -8
  180. package/lib/model/featuresModel/legendModel/twoDimLegendModel.js +27 -40
  181. package/lib/model/featuresModel/otherComponents.d.ts +4 -7
  182. package/lib/model/featuresModel/otherComponents.js +9 -9
  183. package/lib/model/featuresModel/recordOverflowModel/recordOverflowModel.d.ts +4 -0
  184. package/lib/model/featuresModel/recordOverflowModel/recordOverflowModel.js +33 -0
  185. package/lib/model/featuresModel/scaleModel/scaleAxisRecalcer.d.ts +6 -6
  186. package/lib/model/featuresModel/scaleModel/scaleAxisRecalcer.js +23 -27
  187. package/lib/model/featuresModel/scaleModel/scaleDomainService.d.ts +5 -19
  188. package/lib/model/featuresModel/scaleModel/scaleDomainService.js +55 -44
  189. package/lib/model/featuresModel/scaleModel/scaleModel.d.ts +10 -10
  190. package/lib/model/featuresModel/scaleModel/scaleModel.js +50 -61
  191. package/lib/model/featuresModel/scaleModel/scaleModelServices.js +22 -15
  192. package/lib/model/featuresModel/titleModel.d.ts +1 -1
  193. package/lib/model/featuresModel/titleModel.js +14 -14
  194. package/lib/model/featuresModel/tooltipModel.d.ts +1 -1
  195. package/lib/model/featuresModel/tooltipModel.js +5 -5
  196. package/lib/model/featuresModel/valueLabelsModel/valueLabelsModel.d.ts +11 -23
  197. package/lib/model/featuresModel/valueLabelsModel/valueLabelsModel.js +51 -53
  198. package/lib/model/helpers/modelHelper.d.ts +7 -7
  199. package/lib/model/helpers/modelHelper.js +42 -38
  200. package/lib/model/helpers/twoDimensionalModelHelper.d.ts +9 -37
  201. package/lib/model/helpers/twoDimensionalModelHelper.js +125 -147
  202. package/lib/model/helpers/unitsFromConfigReader.js +4 -4
  203. package/lib/model/helpers/unitsReader.d.ts +2 -2
  204. package/lib/model/helpers/unitsReader.js +13 -11
  205. package/lib/model/margin/marginModel.d.ts +7 -7
  206. package/lib/model/margin/marginModel.js +20 -23
  207. package/lib/model/margin/twoDim/twoDimMarginModel.d.ts +13 -13
  208. package/lib/model/margin/twoDim/twoDimMarginModel.js +113 -184
  209. package/lib/model/model.d.ts +284 -315
  210. package/lib/model/model.js +4 -4
  211. package/lib/model/modelBuilder.d.ts +18 -27
  212. package/lib/model/modelBuilder.js +79 -85
  213. package/lib/model/modelInstance/canvasModel/canvasModel.d.ts +17 -17
  214. package/lib/model/modelInstance/canvasModel/canvasModel.js +43 -42
  215. package/lib/model/modelInstance/canvasModel/canvasSizesModel/canvasMarginModel.d.ts +7 -7
  216. package/lib/model/modelInstance/canvasModel/canvasSizesModel/canvasSizeModel.d.ts +2 -2
  217. package/lib/model/modelInstance/canvasModel/canvasSizesModel/marginModelService.d.ts +6 -6
  218. package/lib/model/modelInstance/canvasModel/canvasSizesModel/marginModelService.js +24 -24
  219. package/lib/model/modelInstance/canvasModel/legendCanvasModel.d.ts +4 -4
  220. package/lib/model/modelInstance/canvasModel/legendCanvasModel.js +11 -11
  221. package/lib/model/modelInstance/canvasModel/titleCanvas.d.ts +4 -4
  222. package/lib/model/modelInstance/canvasModel/titleCanvas.js +9 -9
  223. package/lib/model/modelInstance/chartBlockVersion/chartBlockVersion.d.ts +3 -3
  224. package/lib/model/modelInstance/chartBlockVersion/chartBlockVersion.js +6 -6
  225. package/lib/model/modelInstance/configReader.d.ts +23 -32
  226. package/lib/model/modelInstance/configReader.js +94 -125
  227. package/lib/model/modelInstance/dataModel/dataModel.d.ts +10 -10
  228. package/lib/model/modelInstance/dataModel/dataModel.js +25 -25
  229. package/lib/model/modelInstance/dataModel/dataRepository.d.ts +14 -14
  230. package/lib/model/modelInstance/dataModel/dataRepository.js +42 -42
  231. package/lib/model/modelInstance/modelInstance.d.ts +6 -11
  232. package/lib/model/modelInstance/modelInstance.js +16 -16
  233. package/lib/model/modelInstance/titleConfigReader.d.ts +8 -8
  234. package/lib/model/modelInstance/titleConfigReader.js +30 -37
  235. package/lib/model/notations/polar/donut/donutAggregatorService.d.ts +6 -9
  236. package/lib/model/notations/polar/donut/donutAggregatorService.js +37 -40
  237. package/lib/model/notations/polar/donut/donutModel.d.ts +5 -9
  238. package/lib/model/notations/polar/donut/donutModel.js +28 -28
  239. package/lib/model/notations/polar/donut/donutThicknessService.d.ts +3 -3
  240. package/lib/model/notations/polar/donut/donutThicknessService.js +15 -13
  241. package/lib/model/notations/polar/polarModel.d.ts +7 -18
  242. package/lib/model/notations/polar/polarModel.js +72 -79
  243. package/lib/model/notations/twoDimensional/styles.d.ts +7 -44
  244. package/lib/model/notations/twoDimensional/styles.js +125 -234
  245. package/lib/model/notations/twoDimensionalModel.d.ts +13 -23
  246. package/lib/model/notations/twoDimensionalModel.js +170 -330
  247. package/lib/optionsServices/publicOptionsService.d.ts +1 -1
  248. package/lib/optionsServices/publicOptionsService.js +4 -4
  249. package/lib/optionsServices/validators/sizeValidator.d.ts +2 -2
  250. package/lib/optionsServices/validators/sizeValidator.js +11 -10
  251. package/lib/style/charts-main.css +151 -150
  252. package/lib/style/charts-main.less +151 -150
  253. package/package.json +1 -1
  254. package/lib/engine/polarNotation/extenders/polarRecordOverflowAlert.d.ts +0 -15
  255. package/lib/engine/polarNotation/extenders/polarRecordOverflowAlert.js +0 -40
  256. package/lib/engine/twoDimensionalNotation/extenders/twoDimRecordOverflowAlert.d.ts +0 -15
  257. package/lib/engine/twoDimensionalNotation/extenders/twoDimRecordOverflowAlert.js +0 -32
@@ -3,337 +3,177 @@ import { TwoDimensionalChartStyleModel } from "../chartStyleModel/twoDimensional
3
3
  import { AxisModel } from "../featuresModel/axisModel";
4
4
  import { ScaleAxisRecalcer } from "../featuresModel/scaleModel/scaleAxisRecalcer";
5
5
  import { ScaleModel } from "../featuresModel/scaleModel/scaleModel";
6
- import {
7
- calculateBarIndexes,
8
- getAreaViewOptions,
9
- getBarViewOptions,
10
- getLegendMarkerOptions,
11
- LINE_CHART_DEFAULT_WIDTH,
12
- parseDashStyles,
13
- parseShape
14
- } from "./twoDimensional/styles";
15
- import {
16
- calculateValueLabelAlignment,
17
- ValueLabelCoordinateCalculator
18
- } from "../../model/featuresModel/valueLabelsModel/valueLabelsModel";
6
+ import { calculateBarIndexes, getAreaViewOptions, getBarViewOptions, getLegendMarkerOptions, LINE_CHART_DEFAULT_WIDTH, parseDashStyles, parseShape } from "./twoDimensional/styles";
7
+ import { calculateValueLabelAlignment, ValueLabelCoordinateCalculator } from "../../model/featuresModel/valueLabelsModel/valueLabelsModel";
19
8
  import { TwoDimensionalModelHelper } from "../helpers/twoDimensionalModelHelper";
20
9
  import { TitleConfigReader } from "../modelInstance/titleConfigReader";
10
+ import { createRecordOverflowModel } from "../featuresModel/recordOverflowModel/recordOverflowModel";
21
11
  export class TwoDimensionalModel {
22
- static getOptions(configReader, designerConfig, modelInstance) {
23
- const options = configReader.options;
24
- const canvasModel = modelInstance.canvasModel;
25
- const scaleModel = new ScaleModel(options, canvasModel);
26
- const scaleMarginRecalcer = new ScaleAxisRecalcer(() =>
27
- scaleModel.getScaleLinear(modelInstance.dataModel.repository.getScopedRows(), configReader)
28
- );
29
- scaleMarginRecalcer.recalculateMargin(canvasModel, options.orientation, options.axis.key);
30
- const scaleValueInfo = scaleMarginRecalcer.getScaleValue();
31
- let secondaryScaleValueInfo;
32
- if (configReader.containsSecondaryAxis()) {
33
- const secondaryScaleMarginRecalcer = new ScaleAxisRecalcer(() =>
34
- scaleModel.getScaleSecondaryLinear(modelInstance.dataModel.repository.getScopedRows(), configReader)
35
- );
36
- secondaryScaleMarginRecalcer.recalculateMargin(canvasModel, options.orientation, options.axis.key);
37
- secondaryScaleValueInfo = secondaryScaleMarginRecalcer.getScaleValue();
38
- }
39
- const keyAxis = AxisModel.getKeyAxis(
40
- options,
41
- modelInstance.dataModel.repository.getScopedFullSource(),
42
- designerConfig.canvas.axisLabel,
43
- canvasModel,
44
- designerConfig.elementsOptions.tooltip,
45
- () => scaleValueInfo.scaleFn(0)
46
- );
47
- const charts = this.getChartsModel(
48
- options.charts,
49
- configReader,
50
- options.orientation,
51
- designerConfig,
52
- modelInstance.dataModel.repository,
53
- keyAxis.orient,
54
- canvasModel,
55
- options.data.keyField.name,
56
- modelInstance
57
- );
58
- const titleConfig = TitleConfigReader.create(options.title, modelInstance);
59
- return {
60
- legend: canvasModel.legendCanvas.getModel(),
61
- title: {
62
- textContent: titleConfig.getTextContent(),
63
- fontSize: titleConfig.getFontSize()
64
- },
65
- selectable: !!options.selectable,
66
- orient: options.orientation,
67
- scale: Object.assign(
68
- {
69
- key: scaleModel.getScaleKey(modelInstance.dataModel.getAllowableKeys()),
70
- value: scaleValueInfo.scale
71
- },
72
- configReader.containsSecondaryAxis() && {
73
- valueSecondary: secondaryScaleValueInfo.scale
74
- }
75
- ),
76
- axis: Object.assign(
77
- {
78
- key: keyAxis,
79
- value: AxisModel.getMainValueAxis(
80
- configReader.calculateDefaultAxisLabelFormatter(),
81
- options.orientation,
82
- options.axis.value.position,
83
- options.axis.value,
84
- designerConfig.canvas.axisLabel,
85
- canvasModel,
86
- scaleValueInfo.scale
87
- )
88
- },
89
- configReader.containsSecondaryAxis() && {
90
- valueSecondary: AxisModel.getSecondaryValueAxis(
91
- configReader.calculateDefaultAxisLabelFormatter(),
92
- options.orientation,
93
- options.axis.value.position,
94
- options.axis.valueSecondary,
95
- designerConfig.canvas.axisLabel,
96
- canvasModel,
97
- secondaryScaleValueInfo.scale
98
- )
99
- }
100
- ),
101
- type: options.type,
102
- data: Object.assign({}, options.data),
103
- charts,
104
- additionalElements: this.getAdditionalElements(options),
105
- tooltip: options.tooltip,
106
- chartSettings: this.getChartsSettings(designerConfig.canvas.chartOptions, options.orientation),
107
- valueLabels: TwoDimensionalModelHelper.getValueLabels(
108
- options.valueLabels,
109
- canvasModel,
110
- options.orientation,
111
- configReader.getValueLabelsStyleModel()
112
- ),
113
- defs: {
114
- gradients: TwoDimensionalModelHelper.getGradientDefs(
115
- charts,
116
- keyAxis.orient,
117
- options.orientation,
118
- modelInstance.version.getVersionNumber()
119
- )
120
- }
121
- };
122
- }
123
- static getChartsEmbeddedLabelsFlag(charts, chartOrientation) {
124
- // Если НЕ найден хотя бы один чарт, который сегментированный или хотя бы один НЕ бар чарт, то лейблы можно прятать
125
- return (
126
- charts.findIndex((chart) => chart.isSegmented || chart.type !== "bar") === -1 &&
127
- chartOrientation === "horizontal" &&
128
- charts.length === this.findChartsWithEmbeddedKeyLabels(charts).length
129
- );
130
- }
131
- /**
132
- * Сортирует список чартов в порядке: area - bar - line.
133
- * Используется для того, чтобы при рендере графики с наибольшей площадью (area) не перекрывали графики с меньшей площадью (bar, line).
134
- * @param charts Чарты из конфига
135
- */
136
- static sortCharts(charts) {
137
- const chartOrder = ["area", "bar", "line", "dot"];
138
- charts.sort((chart1, chart2) => chartOrder.indexOf(chart1.type) - chartOrder.indexOf(chart2.type));
139
- }
140
- static getChartsSettings(chartOptions, chartOrientation) {
141
- var _a;
142
- return {
143
- bar: Object.assign({}, chartOptions.bar),
144
- lineLike: {
145
- shape: parseShape(
146
- chartOrientation,
147
- (_a = chartOptions.line) === null || _a === void 0 ? void 0 : _a.shape
148
- )
149
- }
150
- };
151
- }
152
- static getChartsModel(
153
- charts,
154
- configReader,
155
- chartOrientation,
156
- designerConfig,
157
- dataModelRep,
158
- keyAxisOrient,
159
- canvasModel,
160
- keyFieldName,
161
- modelInstance
162
- ) {
163
- const styleModel = new TwoDimensionalChartStyleModel(charts, designerConfig.chartStyle);
164
- const chartsModel = [];
165
- charts.forEach((chart, index) => {
166
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
167
- const style = styleModel.getChartStyle(chart, index);
168
- const valueLabelsCoordinateCalculator = new ValueLabelCoordinateCalculator(
169
- (_b = (_a = chart.valueLabels) === null || _a === void 0 ? void 0 : _a.position) === null ||
170
- _b === void 0
171
- ? void 0
172
- : _b.mode,
173
- keyAxisOrient,
174
- canvasModel.getMargin()
175
- );
176
- const valueLabelsAlignment = calculateValueLabelAlignment(
177
- keyAxisOrient,
178
- (_d = (_c = chart.valueLabels) === null || _c === void 0 ? void 0 : _c.position) === null ||
179
- _d === void 0
180
- ? void 0
181
- : _d.mode,
182
- (_e = chart.valueLabels) === null || _e === void 0 ? void 0 : _e.rotation
183
- );
184
- chartsModel.push({
185
- type: chart.type,
186
- isSegmented: chart.isSegmented,
187
- data: Object.assign({}, chart.data),
188
- tooltip: { show: true },
189
- cssClasses: ChartStyleModelService.getCssClasses(index),
190
- style,
191
- embeddedLabels: this.getEmbeddedLabelType(chart, chartOrientation),
192
- markersOptions: {
193
- show: ({ row, valueFieldName }) =>
194
- TwoDimensionalModelHelper.shouldMarkerShow(
195
- chart,
196
- dataModelRep.getRawRows(),
197
- valueFieldName,
198
- row,
199
- keyFieldName
200
- ),
201
- styles: {
202
- highlighted: {
203
- size: {
204
- radius:
205
- (_h =
206
- (_g =
207
- (_f = designerConfig.canvas.markers) === null || _f === void 0
208
- ? void 0
209
- : _f.highlighted) === null || _g === void 0
210
- ? void 0
211
- : _g.radius) !== null && _h !== void 0
212
- ? _h
213
- : 4,
214
- borderSize: "3.5px"
215
- }
216
- },
217
- normal: {
218
- size: {
219
- radius:
220
- (_l =
221
- (_k =
222
- (_j = designerConfig.canvas.markers) === null || _j === void 0
223
- ? void 0
224
- : _j.normal) === null || _k === void 0
225
- ? void 0
226
- : _k.radius) !== null && _l !== void 0
227
- ? _l
228
- : 3,
229
- borderSize: `${
230
- (_p =
231
- (_o =
232
- (_m = designerConfig.canvas.markers) === null || _m === void 0
233
- ? void 0
234
- : _m.normal) === null || _o === void 0
235
- ? void 0
236
- : _o.borderSize) !== null && _p !== void 0
237
- ? _p
238
- : 2
239
- }px`
240
- }
241
- }
242
- }
243
- },
244
- lineLikeViewOptions: {
245
- dashedStyles: parseDashStyles((_q = chart.lineStyles) === null || _q === void 0 ? void 0 : _q.dash),
246
- strokeWidth:
247
- (_s = (_r = chart.lineStyles) === null || _r === void 0 ? void 0 : _r.width) !== null &&
248
- _s !== void 0
249
- ? _s
250
- : LINE_CHART_DEFAULT_WIDTH,
251
- renderForKey: (dataRow, valueFieldName) =>
252
- dataRow[valueFieldName] !== null && dataRow[valueFieldName] !== undefined
253
- },
254
- barViewOptions: getBarViewOptions(chart, keyAxisOrient, calculateBarIndexes(charts, chart, index)),
255
- legend: getLegendMarkerOptions(chart),
256
- index,
257
- valueLabels: {
258
- show:
259
- (_u = (_t = chart.valueLabels) === null || _t === void 0 ? void 0 : _t.on) !== null &&
260
- _u !== void 0
261
- ? _u
262
- : false,
263
- handleX: (scaledValue) => valueLabelsCoordinateCalculator.getValueLabelX(scaledValue),
264
- handleY: (scaledValue) => valueLabelsCoordinateCalculator.getValueLabelY(scaledValue),
265
- handleScaledValue: (dataRow, datumField) => {
266
- var _a, _b, _c, _d;
267
- if (
268
- !((_b = (_a = chart.valueLabels) === null || _a === void 0 ? void 0 : _a.position) ===
269
- null || _b === void 0
270
- ? void 0
271
- : _b.mode) ||
272
- ((_d = (_c = chart.valueLabels) === null || _c === void 0 ? void 0 : _c.position) ===
273
- null || _d === void 0
274
- ? void 0
275
- : _d.mode) === "after"
276
- )
277
- return dataRow[datumField];
278
- if (chart.isSegmented) return dataRow[datumField] - (dataRow[datumField] - dataRow["0"]) / 2;
279
- else return dataRow[datumField] / 2;
280
- },
281
- textAnchor: valueLabelsAlignment.textAnchor,
282
- dominantBaseline: valueLabelsAlignment.dominantBaseline,
283
- format: configReader.getValueLabelFormatterForChart(index),
284
- rotation: (_v = chart.valueLabels) === null || _v === void 0 ? void 0 : _v.rotation,
285
- handleElement: (_w = chart.valueLabels) === null || _w === void 0 ? void 0 : _w.handleElement
286
- },
287
- areaViewOptions: getAreaViewOptions(chart, index, style, modelInstance.version.getVersionNumber()),
288
- dotViewOptions: {
289
- shape: {
290
- type: "line",
291
- handleEndCoordinate: (v) => v + 2,
292
- handleStartCoordinate: (v) => v - 2,
293
- width:
294
- (_z =
295
- (_y = (_x = chart.dotLikeStyles) === null || _x === void 0 ? void 0 : _x.shape) ===
296
- null || _y === void 0
297
- ? void 0
298
- : _y.width) !== null && _z !== void 0
299
- ? _z
300
- : LINE_CHART_DEFAULT_WIDTH
301
- }
302
- }
303
- });
304
- });
305
- return chartsModel;
306
- }
307
- static findChartsWithEmbeddedKeyLabels(charts) {
308
- const chartsWithEmbeddedLabels = [];
309
- charts.forEach((chart) => {
310
- if (chart.type === "bar" && chart.embeddedLabels === "key") chartsWithEmbeddedLabels.push(chart);
311
- });
312
- return chartsWithEmbeddedLabels;
313
- }
314
- static getEmbeddedLabelType(currentChart, chartOrientation) {
315
- if (chartOrientation === "horizontal" && currentChart.type === "bar") return currentChart.embeddedLabels;
316
- return "none";
317
- }
318
- static getAdditionalElements(options) {
319
- var _a, _b;
320
- const { flag, styles } = options.additionalElements.gridLine;
321
- return {
322
- gridLine: {
323
- flag,
324
- styles: {
325
- dash: {
326
- on:
327
- (_b =
328
- (_a = styles === null || styles === void 0 ? void 0 : styles.dash) === null ||
329
- _a === void 0
330
- ? void 0
331
- : _a.on) !== null && _b !== void 0
332
- ? _b
333
- : false
334
- }
335
- }
336
- }
337
- };
338
- }
12
+ static getOptions(configReader, designerConfig, modelInstance) {
13
+ const options = configReader.options;
14
+ const canvasModel = modelInstance.canvasModel;
15
+ const scaleModel = new ScaleModel(options, canvasModel);
16
+ const scaleMarginRecalcer = new ScaleAxisRecalcer(() => scaleModel.getScaleLinear(modelInstance.dataModel.repository.getScopedRows(), configReader));
17
+ scaleMarginRecalcer.recalculateMargin(canvasModel, options.orientation, options.axis.key);
18
+ const scaleValueInfo = scaleMarginRecalcer.getScaleValue();
19
+ let secondaryScaleValueInfo;
20
+ if (configReader.containsSecondaryAxis()) {
21
+ const secondaryScaleMarginRecalcer = new ScaleAxisRecalcer(() => scaleModel.getScaleSecondaryLinear(modelInstance.dataModel.repository.getScopedRows(), configReader));
22
+ secondaryScaleMarginRecalcer.recalculateMargin(canvasModel, options.orientation, options.axis.key);
23
+ secondaryScaleValueInfo = secondaryScaleMarginRecalcer.getScaleValue();
24
+ }
25
+ const keyAxis = AxisModel.getKeyAxis(options, modelInstance.dataModel.repository.getScopedFullSource(), designerConfig.canvas.axisLabel, canvasModel, designerConfig.elementsOptions.tooltip, () => scaleValueInfo.scaleFn(0));
26
+ const charts = this.getChartsModel(options.charts, configReader, options.orientation, designerConfig, modelInstance.dataModel.repository, keyAxis.orient, canvasModel, options.data.keyField.name, modelInstance);
27
+ const titleConfig = TitleConfigReader.create(options.title, modelInstance);
28
+ const isHorizontal = options.orientation === "horizontal";
29
+ return {
30
+ legend: canvasModel.legendCanvas.getModel(),
31
+ title: {
32
+ textContent: titleConfig.getTextContent(),
33
+ fontSize: titleConfig.getFontSize()
34
+ },
35
+ selectable: !!options.selectable,
36
+ orient: options.orientation,
37
+ scale: Object.assign({ key: scaleModel.getScaleKey(modelInstance.dataModel.getAllowableKeys()), value: scaleValueInfo.scale }, (configReader.containsSecondaryAxis() && { valueSecondary: secondaryScaleValueInfo.scale })),
38
+ axis: Object.assign({ key: keyAxis, value: AxisModel.getMainValueAxis(configReader.calculateDefaultAxisLabelFormatter(), options.orientation, options.axis.value.position, options.axis.value, designerConfig.canvas.axisLabel, canvasModel, scaleValueInfo.scale) }, (configReader.containsSecondaryAxis() && {
39
+ valueSecondary: AxisModel.getSecondaryValueAxis(configReader.calculateDefaultAxisLabelFormatter(), options.orientation, options.axis.value.position, options.axis.valueSecondary, designerConfig.canvas.axisLabel, canvasModel, secondaryScaleValueInfo.scale)
40
+ })),
41
+ type: options.type,
42
+ data: Object.assign({}, options.data),
43
+ charts,
44
+ additionalElements: this.getAdditionalElements(options),
45
+ tooltip: options.tooltip,
46
+ chartSettings: this.getChartsSettings(designerConfig.canvas.chartOptions, options.orientation),
47
+ valueLabels: TwoDimensionalModelHelper.getValueLabels(options.valueLabels, canvasModel, options.orientation, configReader.getValueLabelsStyleModel()),
48
+ defs: {
49
+ gradients: TwoDimensionalModelHelper.getGradientDefs(charts, keyAxis.orient, options.orientation, modelInstance.version.getVersionNumber())
50
+ },
51
+ recordOverflowAlert: createRecordOverflowModel(modelInstance.dataModel.getScope().hidedRecordsAmount, {
52
+ one: isHorizontal ? "строка" : "столбец",
53
+ twoToFour: isHorizontal ? "строки" : "столбца",
54
+ tenToTwenty: isHorizontal ? "строк" : "столбцов",
55
+ other: isHorizontal ? "строк" : "столбцов"
56
+ }, options.recordOverflowAlert)
57
+ };
58
+ }
59
+ static getChartsEmbeddedLabelsFlag(charts, chartOrientation) {
60
+ // Если НЕ найден хотя бы один чарт, который сегментированный или хотя бы один НЕ бар чарт, то лейблы можно прятать
61
+ return (charts.findIndex((chart) => chart.isSegmented || chart.type !== "bar") === -1 &&
62
+ chartOrientation === "horizontal" &&
63
+ charts.length === this.findChartsWithEmbeddedKeyLabels(charts).length);
64
+ }
65
+ /**
66
+ * Сортирует список чартов в порядке: area - bar - line.
67
+ * Используется для того, чтобы при рендере графики с наибольшей площадью (area) не перекрывали графики с меньшей площадью (bar, line).
68
+ * @param charts Чарты из конфига
69
+ */
70
+ static sortCharts(charts) {
71
+ const chartOrder = ["area", "bar", "line", "dot"];
72
+ charts.sort((chart1, chart2) => chartOrder.indexOf(chart1.type) - chartOrder.indexOf(chart2.type));
73
+ }
74
+ static getChartsSettings(chartOptions, chartOrientation) {
75
+ var _a;
76
+ return {
77
+ bar: Object.assign({}, chartOptions.bar),
78
+ lineLike: { shape: parseShape(chartOrientation, (_a = chartOptions.line) === null || _a === void 0 ? void 0 : _a.shape) }
79
+ };
80
+ }
81
+ static getChartsModel(charts, configReader, chartOrientation, designerConfig, dataModelRep, keyAxisOrient, canvasModel, keyFieldName, modelInstance) {
82
+ const styleModel = new TwoDimensionalChartStyleModel(charts, designerConfig.chartStyle);
83
+ const chartsModel = [];
84
+ charts.forEach((chart, index) => {
85
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
86
+ const style = styleModel.getChartStyle(chart, index);
87
+ const valueLabelsCoordinateCalculator = new ValueLabelCoordinateCalculator((_b = (_a = chart.valueLabels) === null || _a === void 0 ? void 0 : _a.position) === null || _b === void 0 ? void 0 : _b.mode, keyAxisOrient, canvasModel.getMargin());
88
+ const valueLabelsAlignment = calculateValueLabelAlignment(keyAxisOrient, (_d = (_c = chart.valueLabels) === null || _c === void 0 ? void 0 : _c.position) === null || _d === void 0 ? void 0 : _d.mode, (_e = chart.valueLabels) === null || _e === void 0 ? void 0 : _e.rotation);
89
+ chartsModel.push({
90
+ type: chart.type,
91
+ isSegmented: chart.isSegmented,
92
+ data: Object.assign({}, chart.data),
93
+ tooltip: { show: true },
94
+ cssClasses: ChartStyleModelService.getCssClasses(index),
95
+ style,
96
+ embeddedLabels: this.getEmbeddedLabelType(chart, chartOrientation),
97
+ markersOptions: {
98
+ show: ({ row, valueFieldName }) => TwoDimensionalModelHelper.shouldMarkerShow(chart, dataModelRep.getRawRows(), valueFieldName, row, keyFieldName),
99
+ styles: {
100
+ highlighted: {
101
+ size: {
102
+ radius: (_h = (_g = (_f = designerConfig.canvas.markers) === null || _f === void 0 ? void 0 : _f.highlighted) === null || _g === void 0 ? void 0 : _g.radius) !== null && _h !== void 0 ? _h : 4,
103
+ borderSize: "3.5px"
104
+ }
105
+ },
106
+ normal: {
107
+ size: {
108
+ radius: (_l = (_k = (_j = designerConfig.canvas.markers) === null || _j === void 0 ? void 0 : _j.normal) === null || _k === void 0 ? void 0 : _k.radius) !== null && _l !== void 0 ? _l : 3,
109
+ borderSize: `${(_p = (_o = (_m = designerConfig.canvas.markers) === null || _m === void 0 ? void 0 : _m.normal) === null || _o === void 0 ? void 0 : _o.borderSize) !== null && _p !== void 0 ? _p : 2}px`
110
+ }
111
+ }
112
+ }
113
+ },
114
+ lineLikeViewOptions: {
115
+ dashedStyles: parseDashStyles((_q = chart.lineStyles) === null || _q === void 0 ? void 0 : _q.dash),
116
+ strokeWidth: (_s = (_r = chart.lineStyles) === null || _r === void 0 ? void 0 : _r.width) !== null && _s !== void 0 ? _s : LINE_CHART_DEFAULT_WIDTH,
117
+ renderForKey: (dataRow, valueFieldName) => dataRow[valueFieldName] !== null && dataRow[valueFieldName] !== undefined
118
+ },
119
+ barViewOptions: getBarViewOptions(chart, keyAxisOrient, calculateBarIndexes(charts, chart, index)),
120
+ legend: getLegendMarkerOptions(chart),
121
+ index,
122
+ valueLabels: {
123
+ show: (_u = (_t = chart.valueLabels) === null || _t === void 0 ? void 0 : _t.on) !== null && _u !== void 0 ? _u : false,
124
+ handleX: (scaledValue) => valueLabelsCoordinateCalculator.getValueLabelX(scaledValue),
125
+ handleY: (scaledValue) => valueLabelsCoordinateCalculator.getValueLabelY(scaledValue),
126
+ handleScaledValue: (dataRow, datumField) => {
127
+ var _a, _b, _c, _d;
128
+ if (!((_b = (_a = chart.valueLabels) === null || _a === void 0 ? void 0 : _a.position) === null || _b === void 0 ? void 0 : _b.mode) || ((_d = (_c = chart.valueLabels) === null || _c === void 0 ? void 0 : _c.position) === null || _d === void 0 ? void 0 : _d.mode) === "after")
129
+ return dataRow[datumField];
130
+ if (chart.isSegmented)
131
+ return dataRow[datumField] - (dataRow[datumField] - dataRow["0"]) / 2;
132
+ else
133
+ return dataRow[datumField] / 2;
134
+ },
135
+ textAnchor: valueLabelsAlignment.textAnchor,
136
+ dominantBaseline: valueLabelsAlignment.dominantBaseline,
137
+ format: configReader.getValueLabelFormatterForChart(index),
138
+ rotation: (_v = chart.valueLabels) === null || _v === void 0 ? void 0 : _v.rotation,
139
+ handleElement: (_w = chart.valueLabels) === null || _w === void 0 ? void 0 : _w.handleElement
140
+ },
141
+ areaViewOptions: getAreaViewOptions(chart, index, style, modelInstance.version.getVersionNumber()),
142
+ dotViewOptions: {
143
+ shape: {
144
+ type: "line",
145
+ handleEndCoordinate: (v) => v + 2,
146
+ handleStartCoordinate: (v) => v - 2,
147
+ width: (_z = (_y = (_x = chart.dotLikeStyles) === null || _x === void 0 ? void 0 : _x.shape) === null || _y === void 0 ? void 0 : _y.width) !== null && _z !== void 0 ? _z : LINE_CHART_DEFAULT_WIDTH
148
+ }
149
+ }
150
+ });
151
+ });
152
+ return chartsModel;
153
+ }
154
+ static findChartsWithEmbeddedKeyLabels(charts) {
155
+ const chartsWithEmbeddedLabels = [];
156
+ charts.forEach((chart) => {
157
+ if (chart.type === "bar" && chart.embeddedLabels === "key")
158
+ chartsWithEmbeddedLabels.push(chart);
159
+ });
160
+ return chartsWithEmbeddedLabels;
161
+ }
162
+ static getEmbeddedLabelType(currentChart, chartOrientation) {
163
+ if (chartOrientation === "horizontal" && currentChart.type === "bar")
164
+ return currentChart.embeddedLabels;
165
+ return "none";
166
+ }
167
+ static getAdditionalElements(options) {
168
+ var _a, _b;
169
+ const { flag, styles } = options.additionalElements.gridLine;
170
+ return {
171
+ gridLine: {
172
+ flag,
173
+ styles: {
174
+ dash: { on: (_b = (_a = styles === null || styles === void 0 ? void 0 : styles.dash) === null || _a === void 0 ? void 0 : _a.on) !== null && _b !== void 0 ? _b : false }
175
+ }
176
+ }
177
+ };
178
+ }
339
179
  }
@@ -1,6 +1,6 @@
1
1
  import { Size } from "../config/config";
2
2
  declare class PublicOptionsServiceClass {
3
- validateSize(size: Partial<Size>): boolean;
3
+ validateSize(size: Partial<Size>): boolean;
4
4
  }
5
5
  export declare const PublicOptionsService: PublicOptionsServiceClass;
6
6
  export {};
@@ -1,8 +1,8 @@
1
1
  import { SizeValidator } from "./validators/sizeValidator";
2
2
  class PublicOptionsServiceClass {
3
- validateSize(size) {
4
- const validator = new SizeValidator();
5
- return validator.validate(size);
6
- }
3
+ validateSize(size) {
4
+ const validator = new SizeValidator();
5
+ return validator.validate(size);
6
+ }
7
7
  }
8
8
  export const PublicOptionsService = new PublicOptionsServiceClass();
@@ -1,5 +1,5 @@
1
1
  import { Size } from "../../config/config";
2
2
  export declare class SizeValidator {
3
- validate(size: Partial<Size>): boolean;
4
- private validateSide;
3
+ validate(size: Partial<Size>): boolean;
4
+ private validateSide;
5
5
  }
@@ -1,12 +1,13 @@
1
1
  export class SizeValidator {
2
- validate(size) {
3
- return this.validateSide(size.height) && this.validateSide(size.width);
4
- }
5
- validateSide(side) {
6
- if (side == null) return true;
7
- if (typeof side !== "number" || side <= 0) {
8
- return false;
9
- }
10
- return true;
11
- }
2
+ validate(size) {
3
+ return this.validateSide(size.height) && this.validateSide(size.width);
4
+ }
5
+ validateSide(side) {
6
+ if (side == null)
7
+ return true;
8
+ if (typeof side !== "number" || side <= 0) {
9
+ return false;
10
+ }
11
+ return true;
12
+ }
12
13
  }