@cloudtower/eagle 4100.0.18 → 4100.0.19

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 (266) hide show
  1. package/dist/cjs/core/AccordionCard/index.js +1 -1
  2. package/dist/cjs/core/Alert/alert.style.js +2 -2
  3. package/dist/cjs/core/Antd5Tree/Antd5Tree.style.js +1 -1
  4. package/dist/cjs/core/Avatar/index.js +1 -1
  5. package/dist/cjs/core/Banner/banner.style.js +4 -4
  6. package/dist/cjs/core/BasicCTError/BasicCTError.style.js +1 -1
  7. package/dist/cjs/core/BlankState/style.js +1 -1
  8. package/dist/cjs/core/Breadcrumb/index.js +1 -1
  9. package/dist/cjs/core/Button/index.js +1 -1
  10. package/dist/cjs/core/ButtonGroup/index.js +2 -2
  11. package/dist/cjs/core/Card/CardBody.js +1 -1
  12. package/dist/cjs/core/Card/CardTitle.js +1 -1
  13. package/dist/cjs/core/Card/CardWrapper.js +2 -2
  14. package/dist/cjs/core/Cascader/cascader.style.js +11 -11
  15. package/dist/cjs/core/Checkbox/checkbox.style.js +1 -1
  16. package/dist/cjs/core/DetailCard/index.js +1 -1
  17. package/dist/cjs/core/DonutChart/index.js +2 -2
  18. package/dist/cjs/core/DropdownMenu/index.js +1 -1
  19. package/dist/cjs/core/ExpandableList/ExpandIcon.js +1 -1
  20. package/dist/cjs/core/ExpandableList/ExpandableContainer.js +1 -1
  21. package/dist/cjs/core/ExpandableList/ExpandableItem.js +2 -2
  22. package/dist/cjs/core/ExpandableList/RoundOrder.js +1 -1
  23. package/dist/cjs/core/FailedLoad/index.js +1 -1
  24. package/dist/cjs/core/FormItem/index.js +1 -1
  25. package/dist/cjs/core/Icon/index.js +1 -1
  26. package/dist/cjs/core/ImmersiveDialog/styles.js +14 -14
  27. package/dist/cjs/core/Input/index.js +1 -1
  28. package/dist/cjs/core/InputGroup/index.js +1 -1
  29. package/dist/cjs/core/InputInteger/index.js +1 -1
  30. package/dist/cjs/core/InputNumber/index.js +1 -1
  31. package/dist/cjs/core/InputPassword/index.js +1 -1
  32. package/dist/cjs/core/InputTagItem/index.js +1 -1
  33. package/dist/cjs/core/LegacySelect/select.style.js +1 -1
  34. package/dist/cjs/core/Legend/index.js +5 -5
  35. package/dist/cjs/core/LineChart/AreaHighlightLayer.js +122 -0
  36. package/dist/cjs/core/LineChart/ForecastLineLayer.js +134 -0
  37. package/dist/cjs/core/LineChart/LineChartActions.js +2 -2
  38. package/dist/cjs/core/LineChart/RenderChart.js +274 -20
  39. package/dist/cjs/core/LineChart/ThresholdIntersectionLayer.js +144 -0
  40. package/dist/cjs/core/LineChart/TooltipFormatter.js +44 -39
  41. package/dist/cjs/core/LineChart/areaHighlightUtils.js +89 -0
  42. package/dist/cjs/core/LineChart/index.js +20 -2
  43. package/dist/cjs/core/LineChart/lineChartDisplayUtils.js +32 -0
  44. package/dist/cjs/core/LineChart/lineSegments.js +90 -0
  45. package/dist/cjs/core/LineChart/styled.js +21 -9
  46. package/dist/cjs/core/LineChart/utils.js +93 -4
  47. package/dist/cjs/core/Link/index.js +1 -1
  48. package/dist/cjs/core/Loading/style.js +4 -4
  49. package/dist/cjs/core/LocalUpload/LocalUpload.style.js +2 -2
  50. package/dist/cjs/core/LogView/LogView.style.js +5 -5
  51. package/dist/cjs/core/MediumDialog/MediumDialog.js +1 -1
  52. package/dist/cjs/core/Metric/styled.js +8 -8
  53. package/dist/cjs/core/Nav/index.js +1 -1
  54. package/dist/cjs/core/Nav/style.js +2 -2
  55. package/dist/cjs/core/Overflow/index.js +2 -2
  56. package/dist/cjs/core/Pagination/index.js +2 -2
  57. package/dist/cjs/core/Progress/components.js +2 -2
  58. package/dist/cjs/core/Progress/index.js +2 -2
  59. package/dist/cjs/core/Progress/progress.style.js +4 -4
  60. package/dist/cjs/core/Progress/progress.widgets.js +2 -2
  61. package/dist/cjs/core/Radio/index.js +3 -3
  62. package/dist/cjs/core/SearchInput/SearchInput.style.js +5 -5
  63. package/dist/cjs/core/SegmentControl/index.js +4 -4
  64. package/dist/cjs/core/Select/select.style.js +4 -4
  65. package/dist/cjs/core/Select/select.widgets.js +3 -3
  66. package/dist/cjs/core/SimplePagination/index.js +2 -2
  67. package/dist/cjs/core/Skeleton/Content.js +1 -1
  68. package/dist/cjs/core/SmallDialog/SmallDialog.style.js +7 -7
  69. package/dist/cjs/core/StatusCapsule/index.js +2 -2
  70. package/dist/cjs/core/StepProgress/index.js +1 -1
  71. package/dist/cjs/core/Steps/style.js +5 -5
  72. package/dist/cjs/core/Styled/index.js +40 -40
  73. package/dist/cjs/core/Switch/index.js +2 -2
  74. package/dist/cjs/core/Tab/Tab.js +1 -1
  75. package/dist/cjs/core/Tab/Tab.style.js +4 -4
  76. package/dist/cjs/core/Table/TableSkeleton.js +1 -1
  77. package/dist/cjs/core/Table/TableWidget.js +1 -1
  78. package/dist/cjs/core/Table/index.js +3 -3
  79. package/dist/cjs/core/TableForm/Columns/FormItem.js +1 -1
  80. package/dist/cjs/core/TableForm/style.js +7 -7
  81. package/dist/cjs/core/Tag/SplitTag.js +1 -1
  82. package/dist/cjs/core/Tag/style.js +5 -5
  83. package/dist/cjs/core/Time/index.js +1 -1
  84. package/dist/cjs/core/TimeZoneSelect/index.js +7 -7
  85. package/dist/cjs/core/Timeline/Timeline.style.js +5 -5
  86. package/dist/cjs/core/Token/index.js +4 -4
  87. package/dist/cjs/core/Token/style.js +1 -1
  88. package/dist/cjs/core/Tooltip/EllipsisTooltipContent.js +1 -1
  89. package/dist/cjs/core/Tooltip/index.js +1 -1
  90. package/dist/cjs/core/Truncate/index.js +1 -1
  91. package/dist/cjs/core/Typo/index.js +58 -58
  92. package/dist/cjs/core/WizardDialog/styles.js +4 -4
  93. package/dist/cjs/coreX/BarChart/index.js +1 -1
  94. package/dist/cjs/coreX/BatchOperation/index.js +2 -2
  95. package/dist/cjs/coreX/ChartWithTooltip/index.js +6 -6
  96. package/dist/cjs/coreX/CheckPointList/checkpointlist.style.js +3 -3
  97. package/dist/cjs/coreX/CircleLoading/index.js +1 -1
  98. package/dist/cjs/coreX/CronCalendar/index.js +4 -4
  99. package/dist/cjs/coreX/CronPlan/index.js +4 -4
  100. package/dist/cjs/coreX/DateRangePicker/DateRangePicker.style.js +12 -12
  101. package/dist/cjs/coreX/DateRangePicker/RelativeTime.js +9 -6
  102. package/dist/cjs/coreX/DateRangePicker/common.js +104 -5
  103. package/dist/cjs/coreX/DateRangePicker/index.js +107 -47
  104. package/dist/cjs/coreX/Dialogs/DeleteDialog/DeleteDialog.js +2 -2
  105. package/dist/cjs/coreX/Dialogs/RejectDialog/RejectDialog.js +6 -6
  106. package/dist/cjs/coreX/GoBackButton/index.js +1 -1
  107. package/dist/cjs/coreX/I18nNameTag/index.js +1 -1
  108. package/dist/cjs/coreX/InfoRowList/InfoRow.js +1 -1
  109. package/dist/cjs/coreX/InfoRowList/InfoRowList.js +4 -4
  110. package/dist/cjs/coreX/KubeConfigModal/KubeConfigModal.style.js +8 -8
  111. package/dist/cjs/coreX/NamesTooltip/index.js +3 -3
  112. package/dist/cjs/coreX/OverflowTooltip/index.js +4 -4
  113. package/dist/cjs/coreX/Sider/index.js +3 -3
  114. package/dist/cjs/coreX/SummaryTable/index.js +5 -5
  115. package/dist/cjs/coreX/SwitchWithText/index.js +1 -1
  116. package/dist/cjs/coreX/TabMenu/index.js +2 -2
  117. package/dist/cjs/coreX/UnderlineTootip/index.js +1 -1
  118. package/dist/cjs/coreX/UnitWithChart/index.js +3 -3
  119. package/dist/cjs/index.js +13 -0
  120. package/dist/cjs/stats1.html +1 -1
  121. package/dist/components.css +4504 -4480
  122. package/dist/esm/core/AccordionCard/index.js +1 -1
  123. package/dist/esm/core/Alert/alert.style.js +2 -2
  124. package/dist/esm/core/Antd5Tree/Antd5Tree.style.js +1 -1
  125. package/dist/esm/core/Avatar/index.js +1 -1
  126. package/dist/esm/core/Banner/banner.style.js +4 -4
  127. package/dist/esm/core/BasicCTError/BasicCTError.style.js +1 -1
  128. package/dist/esm/core/BlankState/style.js +1 -1
  129. package/dist/esm/core/Breadcrumb/index.js +1 -1
  130. package/dist/esm/core/Button/index.js +1 -1
  131. package/dist/esm/core/ButtonGroup/index.js +2 -2
  132. package/dist/esm/core/Card/CardBody.js +1 -1
  133. package/dist/esm/core/Card/CardTitle.js +1 -1
  134. package/dist/esm/core/Card/CardWrapper.js +2 -2
  135. package/dist/esm/core/Cascader/cascader.style.js +11 -11
  136. package/dist/esm/core/Checkbox/checkbox.style.js +1 -1
  137. package/dist/esm/core/DetailCard/index.js +1 -1
  138. package/dist/esm/core/DonutChart/index.js +2 -2
  139. package/dist/esm/core/DropdownMenu/index.js +1 -1
  140. package/dist/esm/core/ExpandableList/ExpandIcon.js +1 -1
  141. package/dist/esm/core/ExpandableList/ExpandableContainer.js +1 -1
  142. package/dist/esm/core/ExpandableList/ExpandableItem.js +2 -2
  143. package/dist/esm/core/ExpandableList/RoundOrder.js +1 -1
  144. package/dist/esm/core/FailedLoad/index.js +1 -1
  145. package/dist/esm/core/FormItem/index.js +1 -1
  146. package/dist/esm/core/Icon/index.js +1 -1
  147. package/dist/esm/core/ImmersiveDialog/styles.js +14 -14
  148. package/dist/esm/core/Input/index.js +1 -1
  149. package/dist/esm/core/InputGroup/index.js +1 -1
  150. package/dist/esm/core/InputInteger/index.js +1 -1
  151. package/dist/esm/core/InputNumber/index.js +1 -1
  152. package/dist/esm/core/InputPassword/index.js +1 -1
  153. package/dist/esm/core/InputTagItem/index.js +1 -1
  154. package/dist/esm/core/LegacySelect/select.style.js +1 -1
  155. package/dist/esm/core/Legend/index.js +5 -5
  156. package/dist/esm/core/LineChart/AreaHighlightLayer.js +115 -0
  157. package/dist/esm/core/LineChart/ForecastLineLayer.js +124 -0
  158. package/dist/esm/core/LineChart/LineChartActions.js +2 -2
  159. package/dist/esm/core/LineChart/RenderChart.js +276 -23
  160. package/dist/esm/core/LineChart/ThresholdIntersectionLayer.js +134 -0
  161. package/dist/esm/core/LineChart/TooltipFormatter.js +41 -39
  162. package/dist/esm/core/LineChart/areaHighlightUtils.js +87 -0
  163. package/dist/esm/core/LineChart/index.js +21 -3
  164. package/dist/esm/core/LineChart/lineChartDisplayUtils.js +26 -0
  165. package/dist/esm/core/LineChart/lineSegments.js +87 -0
  166. package/dist/esm/core/LineChart/styled.js +20 -10
  167. package/dist/esm/core/LineChart/utils.js +91 -5
  168. package/dist/esm/core/Link/index.js +1 -1
  169. package/dist/esm/core/Loading/style.js +4 -4
  170. package/dist/esm/core/LocalUpload/LocalUpload.style.js +2 -2
  171. package/dist/esm/core/LogView/LogView.style.js +5 -5
  172. package/dist/esm/core/MediumDialog/MediumDialog.js +1 -1
  173. package/dist/esm/core/Metric/styled.js +8 -8
  174. package/dist/esm/core/Nav/index.js +1 -1
  175. package/dist/esm/core/Nav/style.js +2 -2
  176. package/dist/esm/core/Overflow/index.js +2 -2
  177. package/dist/esm/core/Pagination/index.js +2 -2
  178. package/dist/esm/core/Progress/components.js +2 -2
  179. package/dist/esm/core/Progress/index.js +2 -2
  180. package/dist/esm/core/Progress/progress.style.js +4 -4
  181. package/dist/esm/core/Progress/progress.widgets.js +2 -2
  182. package/dist/esm/core/Radio/index.js +3 -3
  183. package/dist/esm/core/SearchInput/SearchInput.style.js +5 -5
  184. package/dist/esm/core/SegmentControl/index.js +4 -4
  185. package/dist/esm/core/Select/select.style.js +4 -4
  186. package/dist/esm/core/Select/select.widgets.js +3 -3
  187. package/dist/esm/core/SimplePagination/index.js +2 -2
  188. package/dist/esm/core/Skeleton/Content.js +1 -1
  189. package/dist/esm/core/SmallDialog/SmallDialog.style.js +7 -7
  190. package/dist/esm/core/StatusCapsule/index.js +2 -2
  191. package/dist/esm/core/StepProgress/index.js +1 -1
  192. package/dist/esm/core/Steps/style.js +5 -5
  193. package/dist/esm/core/Styled/index.js +40 -40
  194. package/dist/esm/core/Switch/index.js +2 -2
  195. package/dist/esm/core/Tab/Tab.js +1 -1
  196. package/dist/esm/core/Tab/Tab.style.js +4 -4
  197. package/dist/esm/core/Table/TableSkeleton.js +1 -1
  198. package/dist/esm/core/Table/TableWidget.js +1 -1
  199. package/dist/esm/core/Table/index.js +3 -3
  200. package/dist/esm/core/TableForm/Columns/FormItem.js +1 -1
  201. package/dist/esm/core/TableForm/style.js +7 -7
  202. package/dist/esm/core/Tag/SplitTag.js +1 -1
  203. package/dist/esm/core/Tag/style.js +5 -5
  204. package/dist/esm/core/Time/index.js +1 -1
  205. package/dist/esm/core/TimeZoneSelect/index.js +7 -7
  206. package/dist/esm/core/Timeline/Timeline.style.js +5 -5
  207. package/dist/esm/core/Token/index.js +4 -4
  208. package/dist/esm/core/Token/style.js +1 -1
  209. package/dist/esm/core/Tooltip/EllipsisTooltipContent.js +1 -1
  210. package/dist/esm/core/Tooltip/index.js +1 -1
  211. package/dist/esm/core/Truncate/index.js +1 -1
  212. package/dist/esm/core/Typo/index.js +58 -58
  213. package/dist/esm/core/WizardDialog/styles.js +4 -4
  214. package/dist/esm/coreX/BarChart/index.js +1 -1
  215. package/dist/esm/coreX/BatchOperation/index.js +2 -2
  216. package/dist/esm/coreX/ChartWithTooltip/index.js +6 -6
  217. package/dist/esm/coreX/CheckPointList/checkpointlist.style.js +3 -3
  218. package/dist/esm/coreX/CircleLoading/index.js +1 -1
  219. package/dist/esm/coreX/CronCalendar/index.js +4 -4
  220. package/dist/esm/coreX/CronPlan/index.js +4 -4
  221. package/dist/esm/coreX/DateRangePicker/DateRangePicker.style.js +12 -12
  222. package/dist/esm/coreX/DateRangePicker/RelativeTime.js +10 -7
  223. package/dist/esm/coreX/DateRangePicker/common.js +99 -6
  224. package/dist/esm/coreX/DateRangePicker/index.js +108 -48
  225. package/dist/esm/coreX/Dialogs/DeleteDialog/DeleteDialog.js +2 -2
  226. package/dist/esm/coreX/Dialogs/RejectDialog/RejectDialog.js +6 -6
  227. package/dist/esm/coreX/GoBackButton/index.js +1 -1
  228. package/dist/esm/coreX/I18nNameTag/index.js +1 -1
  229. package/dist/esm/coreX/InfoRowList/InfoRow.js +1 -1
  230. package/dist/esm/coreX/InfoRowList/InfoRowList.js +4 -4
  231. package/dist/esm/coreX/KubeConfigModal/KubeConfigModal.style.js +8 -8
  232. package/dist/esm/coreX/NamesTooltip/index.js +3 -3
  233. package/dist/esm/coreX/OverflowTooltip/index.js +4 -4
  234. package/dist/esm/coreX/Sider/index.js +3 -3
  235. package/dist/esm/coreX/SummaryTable/index.js +5 -5
  236. package/dist/esm/coreX/SwitchWithText/index.js +1 -1
  237. package/dist/esm/coreX/TabMenu/index.js +2 -2
  238. package/dist/esm/coreX/UnderlineTootip/index.js +1 -1
  239. package/dist/esm/coreX/UnitWithChart/index.js +3 -3
  240. package/dist/esm/index.js +4 -1
  241. package/dist/esm/stats1.html +1 -1
  242. package/dist/linaria.merged.scss +5086 -5060
  243. package/dist/src/core/LineChart/AreaHighlightLayer.d.ts +31 -0
  244. package/dist/src/core/LineChart/ForecastLineLayer.d.ts +24 -0
  245. package/dist/src/core/LineChart/RenderChart.d.ts +5 -1
  246. package/dist/src/core/LineChart/ThresholdIntersectionLayer.d.ts +19 -0
  247. package/dist/src/core/LineChart/TooltipFormatter.d.ts +10 -0
  248. package/dist/src/core/LineChart/__test__/AreaHighlightLayer.test.d.ts +1 -0
  249. package/dist/src/core/LineChart/__test__/ForecastLineLayer.test.d.ts +1 -0
  250. package/dist/src/core/LineChart/__test__/utils.test.d.ts +1 -0
  251. package/dist/src/core/LineChart/areaHighlightUtils.d.ts +6 -0
  252. package/dist/src/core/LineChart/lineChartDisplayUtils.d.ts +7 -0
  253. package/dist/src/core/LineChart/lineSegments.d.ts +16 -0
  254. package/dist/src/core/LineChart/styled.d.ts +2 -0
  255. package/dist/src/core/LineChart/type.d.ts +94 -8
  256. package/dist/src/core/LineChart/utils.d.ts +31 -4
  257. package/dist/src/coreX/DateRangePicker/__tests__/AbsoluteDate.test.d.ts +1 -0
  258. package/dist/src/coreX/DateRangePicker/__tests__/DateRangePicker.test.d.ts +1 -0
  259. package/dist/src/coreX/DateRangePicker/__tests__/RelativeTime.test.d.ts +1 -0
  260. package/dist/src/coreX/DateRangePicker/__tests__/common.test.d.ts +1 -0
  261. package/dist/src/coreX/DateRangePicker/common.d.ts +12 -3
  262. package/dist/src/coreX/DateRangePicker/dateRangePicker.type.d.ts +5 -1
  263. package/dist/stories/docs/core/LineChart.stories.d.ts +4 -0
  264. package/dist/stories/docs/coreX/DateRangePicker.stories.d.ts +1 -0
  265. package/dist/style.css +4515 -4491
  266. package/package.json +3 -3
@@ -0,0 +1,134 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var lineChartDisplayUtils = require('./lineChartDisplayUtils.js');
6
+ var lineSegments = require('./lineSegments.js');
7
+ var _ = require('lodash');
8
+ var React = require('react');
9
+
10
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
11
+
12
+ var ___default = /*#__PURE__*/_interopDefault(_);
13
+ var React__default = /*#__PURE__*/_interopDefault(React);
14
+
15
+ const DEFAULT_FORECAST_LINE_STROKE_DASHARRAY = "4 4";
16
+ const ForecastLineLayer = ({
17
+ forecastStartTimestamp,
18
+ stacked = false,
19
+ hovering,
20
+ streams,
21
+ deselected,
22
+ offset,
23
+ xAxisMap,
24
+ yAxisMap
25
+ }) => {
26
+ var _a, _b, _c, _d, _e, _f;
27
+ const clipPathId = React__default.default.useMemo(() => {
28
+ return ___default.default.uniqueId("line-chart-forecast-");
29
+ }, []);
30
+ const xScale = (_a = Object.values(xAxisMap || {})[0]) == null ? void 0 : _a.scale;
31
+ const yScale = (_b = Object.values(yAxisMap || {})[0]) == null ? void 0 : _b.scale;
32
+ const offsetLeft = (_c = offset == null ? void 0 : offset.left) != null ? _c : 0;
33
+ const offsetTop = (_d = offset == null ? void 0 : offset.top) != null ? _d : 0;
34
+ const offsetWidth = (_e = offset == null ? void 0 : offset.width) != null ? _e : 0;
35
+ const offsetHeight = (_f = offset == null ? void 0 : offset.height) != null ? _f : 0;
36
+ const lines = React__default.default.useMemo(() => {
37
+ if (!Number.isFinite(forecastStartTimestamp) || typeof xScale !== "function" || typeof yScale !== "function" || !offsetWidth || !offsetHeight) {
38
+ return [];
39
+ }
40
+ const pointMaps = streams.map(
41
+ (stream) => new Map(stream.points.map((point) => [point.t, point]))
42
+ );
43
+ const timestamps = stacked ? Array.from(
44
+ new Set(
45
+ streams.flatMap(
46
+ (stream) => stream.points.map((point) => point.t).filter(lineChartDisplayUtils.isFiniteNumber)
47
+ )
48
+ )
49
+ ).sort((a, b) => a - b) : [];
50
+ return streams.flatMap((stream, streamIndex) => {
51
+ if (deselected.includes(stream.legend.id)) {
52
+ return [];
53
+ }
54
+ const points = stacked ? timestamps.map((timestamp) => {
55
+ const currentPoint = pointMaps[streamIndex].get(timestamp);
56
+ if (!lineChartDisplayUtils.isFiniteNumber(currentPoint == null ? void 0 : currentPoint.v)) {
57
+ return { t: timestamp, x: xScale(timestamp), y: void 0 };
58
+ }
59
+ const stackedValue = streams.reduce((sum, item, index) => {
60
+ var _a2;
61
+ if (index > streamIndex || deselected.includes(item.legend.id)) {
62
+ return sum;
63
+ }
64
+ const value = (_a2 = pointMaps[index].get(timestamp)) == null ? void 0 : _a2.v;
65
+ return sum + (lineChartDisplayUtils.isFiniteNumber(value) ? value : 0);
66
+ }, 0);
67
+ return {
68
+ t: timestamp,
69
+ x: xScale(timestamp),
70
+ y: yScale(stackedValue)
71
+ };
72
+ }) : stream.points.map((point) => ({
73
+ t: point.t,
74
+ x: lineChartDisplayUtils.isFiniteNumber(point.t) ? xScale(point.t) : void 0,
75
+ y: lineChartDisplayUtils.isFiniteNumber(point.v) ? yScale(point.v) : void 0
76
+ }));
77
+ const segments = lineSegments.getLineChartLineSegments(points, forecastStartTimestamp);
78
+ return segments.map((segment, segmentIndex) => ({
79
+ dashed: segment.dashed,
80
+ key: `${stream.legend.id}-${segmentIndex}-${segment.points[0].t}`,
81
+ legendId: stream.legend.id,
82
+ path: lineSegments.getLineChartLinePath(segment.points),
83
+ stroke: lineChartDisplayUtils.getLineChartStreamStroke(stream)
84
+ }));
85
+ });
86
+ }, [
87
+ forecastStartTimestamp,
88
+ offsetHeight,
89
+ offsetWidth,
90
+ deselected,
91
+ stacked,
92
+ streams,
93
+ xScale,
94
+ yScale
95
+ ]);
96
+ if (!lines.length || !offsetWidth || !offsetHeight) {
97
+ return null;
98
+ }
99
+ return /* @__PURE__ */ React__default.default.createElement(
100
+ "g",
101
+ {
102
+ className: "line-chart-forecast-lines",
103
+ "data-testid": "line-chart-forecast-lines",
104
+ style: { pointerEvents: "none" }
105
+ },
106
+ /* @__PURE__ */ React__default.default.createElement("defs", null, /* @__PURE__ */ React__default.default.createElement("clipPath", { id: clipPathId }, /* @__PURE__ */ React__default.default.createElement(
107
+ "rect",
108
+ {
109
+ x: offsetLeft,
110
+ y: offsetTop,
111
+ width: offsetWidth,
112
+ height: offsetHeight
113
+ }
114
+ ))),
115
+ /* @__PURE__ */ React__default.default.createElement("g", { clipPath: `url(#${clipPathId})` }, lines.map((line) => {
116
+ return /* @__PURE__ */ React__default.default.createElement(
117
+ "path",
118
+ {
119
+ key: line.key,
120
+ className: "line-chart-forecast-line",
121
+ d: line.path,
122
+ fill: "none",
123
+ opacity: hovering.includes(line.legendId) ? 0.3 : 1,
124
+ stroke: line.stroke,
125
+ strokeDasharray: line.dashed ? DEFAULT_FORECAST_LINE_STROKE_DASHARRAY : void 0
126
+ }
127
+ );
128
+ }))
129
+ );
130
+ };
131
+ var ForecastLineLayer$1 = ForecastLineLayer;
132
+
133
+ exports.DEFAULT_FORECAST_LINE_STROKE_DASHARRAY = DEFAULT_FORECAST_LINE_STROKE_DASHARRAY;
134
+ exports.default = ForecastLineLayer$1;
@@ -27,8 +27,8 @@ var __spreadValues = (a, b) => {
27
27
  }
28
28
  return a;
29
29
  };
30
- const actionStyle = "E_4100_0_18_a9y3flr";
31
- const actionStyleLabel = "E_4100_0_18_a1njc627";
30
+ const actionStyle = "E_4100_0_19_a9y3flr";
31
+ const actionStyleLabel = "E_4100_0_19_a1njc627";
32
32
  const LineChartActions = props => {
33
33
  const {
34
34
  label,
@@ -6,22 +6,31 @@ var styled = require('./styled.js');
6
6
  var TooltipFormatter = require('./TooltipFormatter.js');
7
7
  var type = require('./type.js');
8
8
  var utils = require('./utils.js');
9
+ var areaHighlightUtils = require('./areaHighlightUtils.js');
10
+ var lineChartDisplayUtils = require('./lineChartDisplayUtils.js');
9
11
  var useParrotTranslation = require('../../hooks/useParrotTranslation.js');
10
12
  var antd = require('antd');
11
13
  var cs = require('classnames');
12
14
  var dayjs = require('dayjs');
15
+ var _ = require('lodash');
13
16
  var React = require('react');
14
17
  var recharts = require('recharts');
18
+ var AreaHighlightLayer = require('./AreaHighlightLayer.js');
19
+ var ForecastLineLayer = require('./ForecastLineLayer.js');
15
20
  var LineChartToolBar = require('./LineChartToolBar.js');
21
+ var ThresholdIntersectionLayer = require('./ThresholdIntersectionLayer.js');
16
22
  var chart = require('../../store/chart.js');
17
23
 
18
24
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
19
25
 
20
26
  var cs__default = /*#__PURE__*/_interopDefault(cs);
21
27
  var dayjs__default = /*#__PURE__*/_interopDefault(dayjs);
28
+ var ___default = /*#__PURE__*/_interopDefault(_);
22
29
  var React__default = /*#__PURE__*/_interopDefault(React);
23
30
 
24
31
  var __defProp = Object.defineProperty;
32
+ var __defProps = Object.defineProperties;
33
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
25
34
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
26
35
  var __hasOwnProp = Object.prototype.hasOwnProperty;
27
36
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
@@ -37,7 +46,11 @@ var __spreadValues = (a, b) => {
37
46
  }
38
47
  return a;
39
48
  };
49
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
50
+ const DEFAULT_THRESHOLD_LINE_STROKE = "#ff4d4f";
51
+ const DEFAULT_THRESHOLD_LINE_DASHARRAY = "4 4";
40
52
  const RenderChart = (props) => {
53
+ var _a;
41
54
  const {
42
55
  metricName,
43
56
  showLegend,
@@ -48,8 +61,11 @@ const RenderChart = (props) => {
48
61
  type: type$1,
49
62
  mode = "legend",
50
63
  dropdownProps,
51
- onLabelsChange,
52
64
  metric,
65
+ areaHighlightRanges,
66
+ forecastStartTimestamp,
67
+ thresholdLineProps,
68
+ renderThresholdTooltip,
53
69
  yAxisProps,
54
70
  xAxisProps,
55
71
  actionsProps,
@@ -65,6 +81,7 @@ const RenderChart = (props) => {
65
81
  const [hovering, setHovering] = React.useState([]);
66
82
  const [hoveringSelf, setHoveringSelf] = React.useState([]);
67
83
  const [tempDeselected, setTempDeselected] = React.useState([]);
84
+ const [hoveredThresholdIntersection, setHoveredThresholdIntersection] = React.useState(null);
68
85
  const streams = React.useMemo(() => metric.sample_streams, [metric]);
69
86
  const legends = React.useMemo(() => {
70
87
  return metric.sample_streams.map((stream) => stream.legend);
@@ -73,21 +90,119 @@ const RenderChart = (props) => {
73
90
  () => utils.convertLineChartDataStruct(streams.map((stream) => stream.points)),
74
91
  [streams]
75
92
  );
76
- const yDomain = utils.getYAxisDomain(areaChartData, type$1, metric.unit);
77
- const xDomain = utils.getLineChartXAxisDomain(dateRange, dateRange[1].valueOf());
93
+ const xDomainStart = dateRange[0].valueOf();
94
+ const xDomainEnd = dateRange[1].valueOf();
95
+ const xDomain = React.useMemo(
96
+ () => [xDomainStart, xDomainEnd],
97
+ [xDomainStart, xDomainEnd]
98
+ );
99
+ const thresholdValue = thresholdLineProps == null ? void 0 : thresholdLineProps.value;
100
+ const thresholdExtraValues = React.useMemo(() => {
101
+ if (___default.default.isNumber(thresholdValue)) {
102
+ return [thresholdValue];
103
+ }
104
+ return [];
105
+ }, [thresholdValue]);
106
+ const yDomain = (_a = yAxisProps == null ? void 0 : yAxisProps.domain) != null ? _a : utils.getYAxisDomain(areaChartData, type$1, metric.unit, thresholdExtraValues);
107
+ const yTicks = lineChartDisplayUtils.getLineChartDefaultYAxisTicks(yDomain);
78
108
  const xTicks = utils.lineChartXaxisCal(xDomain[1], dateRange, width);
109
+ const normalizedAreaHighlightRanges = React.useMemo(() => {
110
+ return utils.getLineChartAreaHighlightRanges(areaHighlightRanges, xDomain);
111
+ }, [areaHighlightRanges, xDomain]);
112
+ const thresholdIntersectionLabelProps = thresholdLineProps == null ? void 0 : thresholdLineProps.intersectionLabelProps;
113
+ const hasForecastStartTimestamp = Number.isFinite(forecastStartTimestamp);
114
+ const areaHighlightOverlays = React.useMemo(() => {
115
+ if (type$1 !== type.ILineChartGraphType.Area) {
116
+ return [];
117
+ }
118
+ return normalizedAreaHighlightRanges.flatMap((range, rangeIndex) => {
119
+ return streams.flatMap((stream, streamIndex) => {
120
+ var _a2;
121
+ if (range.legendId && stream.legend.id !== range.legendId) {
122
+ return [];
123
+ }
124
+ const data = areaHighlightUtils.getLineChartAreaHighlightRuns(stream.points, range);
125
+ if (!data.length) {
126
+ return [];
127
+ }
128
+ return [
129
+ {
130
+ key: `${stream.legend.id}-${range.start}-${range.end}-${rangeIndex}-${streamIndex}`,
131
+ data,
132
+ fill: range.fill,
133
+ fillOpacity: (_a2 = range.fillOpacity) != null ? _a2 : 0.18,
134
+ legendId: stream.legend.id,
135
+ stroke: lineChartDisplayUtils.getLineChartStreamStroke(stream)
136
+ }
137
+ ];
138
+ });
139
+ });
140
+ }, [normalizedAreaHighlightRanges, streams, type$1]);
141
+ const formatIntersectionValue = React.useCallback(
142
+ (streamIndex, value, timestamp) => {
143
+ var _a2, _b, _c;
144
+ if (!tooltipProps.format) {
145
+ return utils.lineChartYaxisTickFormatter(value, metric.unit);
146
+ }
147
+ const payload = {
148
+ color: (_a2 = legends[streamIndex]) == null ? void 0 : _a2.color,
149
+ dataKey: `v${streamIndex}`,
150
+ fill: (_b = legends[streamIndex]) == null ? void 0 : _b.fill,
151
+ name: `v${streamIndex}`,
152
+ payload: {
153
+ [`v${streamIndex}`]: value,
154
+ t: timestamp,
155
+ v: value
156
+ },
157
+ stroke: (_c = legends[streamIndex]) == null ? void 0 : _c.color,
158
+ value
159
+ };
160
+ return tooltipProps.format(payload);
161
+ },
162
+ [legends, metric.unit, tooltipProps]
163
+ );
164
+ const thresholdIntersections = React.useMemo(() => {
165
+ if (!___default.default.isNumber(thresholdValue)) {
166
+ return [];
167
+ }
168
+ const formattedThresholdValue = utils.lineChartYaxisTickFormatter(
169
+ thresholdValue,
170
+ metric.unit
171
+ );
172
+ return utils.getLineChartThresholdIntersections(
173
+ streams,
174
+ thresholdValue,
175
+ xDomain
176
+ ).map((intersection) => {
177
+ return __spreadProps(__spreadValues({}, intersection), {
178
+ formattedThresholdValue,
179
+ formattedValue: formatIntersectionValue(
180
+ intersection.streamIndex,
181
+ intersection.value,
182
+ intersection.timestamp
183
+ ),
184
+ thresholdValue
185
+ });
186
+ });
187
+ }, [formatIntersectionValue, metric.unit, streams, thresholdValue, xDomain]);
188
+ const visibleThresholdIntersections = React.useMemo(() => {
189
+ return thresholdIntersections.filter((intersection) => {
190
+ return !deselected.includes(intersection.legend.id);
191
+ });
192
+ }, [deselected, thresholdIntersections]);
79
193
  const onLegendClick = React.useCallback(
80
194
  (id) => {
195
+ setHoveredThresholdIntersection(null);
81
196
  setDeselected((prev) => {
82
- var _a;
197
+ var _a2;
83
198
  const currentDeselected = tempDeselected.length ? tempDeselected : prev;
84
199
  if (currentDeselected.length === 0) {
85
200
  return streams.map((stream) => stream.legend.id).filter((legendId) => legendId !== id);
86
201
  }
87
202
  if (currentDeselected.length === streams.length - 1) {
88
- const highlightedId = (_a = streams.find(
203
+ const highlightedId = (_a2 = streams.find(
89
204
  (stream) => !currentDeselected.includes(stream.legend.id)
90
- )) == null ? void 0 : _a.legend.id;
205
+ )) == null ? void 0 : _a2.legend.id;
91
206
  if (id === highlightedId) {
92
207
  return [];
93
208
  } else {
@@ -162,6 +277,7 @@ const RenderChart = (props) => {
162
277
  [deselected, streams, tempDeselected]
163
278
  );
164
279
  const hidePointer = React.useCallback(() => {
280
+ setHoveredThresholdIntersection(null);
165
281
  dispatch({
166
282
  type: chart.ChartActions.SET_POINTER,
167
283
  payload: { visible: false, uuid: syncId }
@@ -169,10 +285,14 @@ const RenderChart = (props) => {
169
285
  }, [dispatch, syncId]);
170
286
  const handleMouseMove = React.useCallback(
171
287
  (e) => {
172
- var _a;
288
+ var _a2;
173
289
  if (e.isTooltipActive) {
174
290
  const { chartX, activePayload } = e;
175
- if (!((_a = activePayload == null ? void 0 : activePayload[0]) == null ? void 0 : _a.payload)) {
291
+ const activeMetricPayload = (_a2 = utils.getLineChartMetricPayloadMatches(
292
+ activePayload,
293
+ legends
294
+ )[0]) == null ? void 0 : _a2.payload;
295
+ if (!(activeMetricPayload == null ? void 0 : activeMetricPayload.payload)) {
176
296
  return;
177
297
  }
178
298
  dispatch({
@@ -181,19 +301,73 @@ const RenderChart = (props) => {
181
301
  uuid: syncId,
182
302
  visible: true,
183
303
  left: chartX,
184
- text: dayjs__default.default(Number(activePayload[0].payload.t)).format(
304
+ text: dayjs__default.default(Number(activeMetricPayload.payload.t)).format(
185
305
  "MM/DD HH:mm:ss"
186
306
  ),
187
- value: activePayload[0].payload.v
307
+ value: activeMetricPayload.payload.v
188
308
  }
189
309
  });
190
310
  }
191
311
  },
192
- [dispatch, syncId]
312
+ [dispatch, legends, syncId]
193
313
  );
314
+ const handleThresholdIntersectionEnter = React.useCallback(
315
+ (info, left, top) => {
316
+ setHoveredThresholdIntersection({
317
+ info,
318
+ left,
319
+ top
320
+ });
321
+ },
322
+ []
323
+ );
324
+ const thresholdTooltipContent = React.useMemo(() => {
325
+ if (!hoveredThresholdIntersection) {
326
+ return null;
327
+ }
328
+ const renderer = thresholdLineProps == null ? void 0 : thresholdLineProps.renderTooltip;
329
+ if (renderer) {
330
+ return renderer(hoveredThresholdIntersection.info);
331
+ }
332
+ if (renderThresholdTooltip) {
333
+ return renderThresholdTooltip(
334
+ lineChartDisplayUtils.getLineChartLegacyThresholdTooltipInfo(
335
+ hoveredThresholdIntersection.info
336
+ )
337
+ );
338
+ }
339
+ const showHoveredThresholdIntersectionLabel = ThresholdIntersectionLayer.isThresholdIntersectionLabelVisible(
340
+ thresholdIntersectionLabelProps,
341
+ hoveredThresholdIntersection.info
342
+ );
343
+ if (showHoveredThresholdIntersectionLabel) {
344
+ return null;
345
+ }
346
+ return /* @__PURE__ */ React__default.default.createElement(
347
+ TooltipFormatter.LineChartTooltipContent,
348
+ {
349
+ title: dayjs__default.default(hoveredThresholdIntersection.info.timestamp).format(
350
+ "MM/DD HH:mm:ss"
351
+ ),
352
+ items: [
353
+ {
354
+ id: hoveredThresholdIntersection.info.legend.id,
355
+ color: hoveredThresholdIntersection.info.legend.color,
356
+ label: hoveredThresholdIntersection.info.legend.name,
357
+ value: hoveredThresholdIntersection.info.formattedValue
358
+ }
359
+ ]
360
+ }
361
+ );
362
+ }, [
363
+ thresholdIntersectionLabelProps,
364
+ hoveredThresholdIntersection,
365
+ renderThresholdTooltip,
366
+ thresholdLineProps == null ? void 0 : thresholdLineProps.renderTooltip
367
+ ]);
194
368
  if (!(streams == null ? void 0 : streams.length) || streams.every((stream) => {
195
- var _a;
196
- return !((_a = stream.points) == null ? void 0 : _a.length);
369
+ var _a2;
370
+ return !((_a2 = stream.points) == null ? void 0 : _a2.length);
197
371
  })) {
198
372
  return /* @__PURE__ */ React__default.default.createElement("div", { className: styled.MetricLegendTabStyle }, /* @__PURE__ */ React__default.default.createElement("div", { className: "name-toolbar" }, /* @__PURE__ */ React__default.default.createElement(
199
373
  LineChartLegend.default,
@@ -231,11 +405,21 @@ const RenderChart = (props) => {
231
405
  dropdownProps,
232
406
  onLegendHover
233
407
  }
234
- ), /* @__PURE__ */ React__default.default.createElement(recharts.ResponsiveContainer, { height }, /* @__PURE__ */ React__default.default.createElement(
408
+ ), /* @__PURE__ */ React__default.default.createElement(styled.ChartContentWrapper, { style: { height } }, /* @__PURE__ */ React__default.default.createElement(recharts.ResponsiveContainer, { height: "100%" }, /* @__PURE__ */ React__default.default.createElement(
235
409
  recharts.AreaChart,
236
410
  {
237
411
  style: { backgroundColor: "white" },
238
- margin: showLegend ? { top: 10, left: -20, right: 0, bottom: 0 } : { top: 20, left: -20, right: 0, bottom: 5 },
412
+ margin: showLegend ? {
413
+ top: 0,
414
+ left: 0,
415
+ right: 0,
416
+ bottom: 0
417
+ } : {
418
+ top: 0,
419
+ left: 0,
420
+ right: 0,
421
+ bottom: 5
422
+ },
239
423
  data: areaChartData,
240
424
  syncId,
241
425
  onMouseLeave: hidePointer,
@@ -269,16 +453,32 @@ const RenderChart = (props) => {
269
453
  dy: 16,
270
454
  fontSize: 12
271
455
  },
272
- ticks: [yDomain[1] / 2, yDomain[1]],
456
+ ticks: yTicks,
273
457
  tickFormatter: (tick) => utils.lineChartYaxisTickFormatter(tick, metric.unit)
274
458
  }, yAxisProps)
275
459
  ),
460
+ ___default.default.isNumber(thresholdValue) && /* @__PURE__ */ React__default.default.createElement(
461
+ recharts.ReferenceLine,
462
+ {
463
+ "data-testid": "line-chart-threshold-line",
464
+ className: cs__default.default(
465
+ "line-chart-threshold-line",
466
+ thresholdLineProps == null ? void 0 : thresholdLineProps.className
467
+ ),
468
+ style: thresholdLineProps == null ? void 0 : thresholdLineProps.style,
469
+ y: thresholdValue,
470
+ stroke: (thresholdLineProps == null ? void 0 : thresholdLineProps.stroke) || DEFAULT_THRESHOLD_LINE_STROKE,
471
+ strokeDasharray: (thresholdLineProps == null ? void 0 : thresholdLineProps.strokeDasharray) || DEFAULT_THRESHOLD_LINE_DASHARRAY,
472
+ ifOverflow: "discard",
473
+ isFront: true
474
+ }
475
+ ),
276
476
  /* @__PURE__ */ React__default.default.createElement(
277
477
  recharts.Tooltip,
278
478
  __spreadValues({
279
479
  wrapperStyle: { left: 20 },
280
480
  content: tooltipProps.format && /* @__PURE__ */ React__default.default.createElement(
281
- TooltipFormatter,
481
+ TooltipFormatter.default,
282
482
  {
283
483
  deselected,
284
484
  legends,
@@ -297,19 +497,73 @@ const RenderChart = (props) => {
297
497
  key: index,
298
498
  dataKey: `v${index}`,
299
499
  stackId: type$1 === type.ILineChartGraphType.Stack ? "stack" : void 0,
300
- stroke: item.legend.stroke ? `${item.legend.color}1A` : item.legend.color,
500
+ stroke: hasForecastStartTimestamp ? "none" : lineChartDisplayUtils.getLineChartStreamStroke(item),
301
501
  fill: item.legend.fill,
302
502
  isAnimationActive: false,
303
503
  activeDot: {
304
504
  stroke: item.legend.color,
305
505
  r: 4,
306
506
  strokeWidth: 2,
307
- fill: "white"
507
+ fill: "white",
508
+ strokeOpacity: 1,
509
+ fillOpacity: 1
308
510
  },
309
511
  opacity: hovering.includes(item.legend.id) ? 0.3 : 1
310
512
  }
311
513
  );
312
- })
514
+ }),
515
+ areaHighlightOverlays.map((overlay) => {
516
+ if (deselected.includes(overlay.legendId)) {
517
+ return null;
518
+ }
519
+ return /* @__PURE__ */ React__default.default.createElement(
520
+ recharts.Customized,
521
+ {
522
+ key: overlay.key,
523
+ component: AreaHighlightLayer,
524
+ overlay,
525
+ hovering,
526
+ forecastStartTimestamp
527
+ }
528
+ );
529
+ }),
530
+ hasForecastStartTimestamp && /* @__PURE__ */ React__default.default.createElement(
531
+ recharts.Customized,
532
+ {
533
+ key: "line-chart-forecast-lines",
534
+ component: ForecastLineLayer.default,
535
+ forecastStartTimestamp,
536
+ stacked: type$1 === type.ILineChartGraphType.Stack,
537
+ hovering,
538
+ streams,
539
+ deselected
540
+ }
541
+ ),
542
+ visibleThresholdIntersections.map((intersection, index) => /* @__PURE__ */ React__default.default.createElement(
543
+ recharts.Customized,
544
+ {
545
+ key: `${intersection.legend.id}-${intersection.timestamp}-${index}`,
546
+ component: ThresholdIntersectionLayer.default,
547
+ intersection,
548
+ index,
549
+ hovering,
550
+ intersectionLabelProps: thresholdIntersectionLabelProps,
551
+ thresholdStroke: thresholdLineProps == null ? void 0 : thresholdLineProps.stroke,
552
+ onMouseEnter: handleThresholdIntersectionEnter,
553
+ onMouseLeave: () => setHoveredThresholdIntersection(null)
554
+ }
555
+ ))
556
+ )), hoveredThresholdIntersection && thresholdTooltipContent && /* @__PURE__ */ React__default.default.createElement(
557
+ styled.ThresholdTooltipOverlay,
558
+ {
559
+ "data-testid": "line-chart-threshold-tooltip",
560
+ role: "tooltip",
561
+ style: {
562
+ left: hoveredThresholdIntersection.left,
563
+ top: hoveredThresholdIntersection.top
564
+ }
565
+ },
566
+ thresholdTooltipContent
313
567
  )));
314
568
  };
315
569
  var RenderChart$1 = RenderChart;