@neo4j-ndl/react-charts 2.1.21 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/lib/LICENSES.txt +0 -295
  2. package/lib/NOTICE.txt +1383 -1392
  3. package/lib/{esm/charts/index.js → cjs/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/defineProperty.js} +13 -5
  4. package/lib/cjs/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectSpread2.js +46 -0
  5. package/lib/{esm/charts/tests/ChartWrapperWithTooltipFormatter.js → cjs/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectWithoutProperties.js} +12 -13
  6. package/lib/{esm/index.js → cjs/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectWithoutPropertiesLoose.js} +13 -2
  7. package/lib/cjs/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/toPrimitive.js +35 -0
  8. package/lib/{esm/charts/utils/chart-types.js → cjs/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/toPropertyKey.js} +10 -2
  9. package/lib/cjs/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/typeof.js +37 -0
  10. package/lib/cjs/_virtual/_rolldown/runtime.js +44 -0
  11. package/lib/cjs/charts/Chart.js +121 -111
  12. package/lib/cjs/charts/Chart.js.map +1 -1
  13. package/lib/cjs/charts/ChartContainer.js +67 -62
  14. package/lib/cjs/charts/ChartContainer.js.map +1 -1
  15. package/lib/cjs/charts/ChartEmpty.js +45 -30
  16. package/lib/cjs/charts/ChartEmpty.js.map +1 -1
  17. package/lib/cjs/charts/ChartRender.js +112 -87
  18. package/lib/cjs/charts/ChartRender.js.map +1 -1
  19. package/lib/cjs/charts/ChartTooltip.js +111 -65
  20. package/lib/cjs/charts/ChartTooltip.js.map +1 -1
  21. package/lib/cjs/charts/Legend.js +81 -69
  22. package/lib/cjs/charts/Legend.js.map +1 -1
  23. package/lib/cjs/charts/LegendItem.js +83 -62
  24. package/lib/cjs/charts/LegendItem.js.map +1 -1
  25. package/lib/cjs/charts/LegendLayout.js +330 -348
  26. package/lib/cjs/charts/LegendLayout.js.map +1 -1
  27. package/lib/cjs/charts/hooks/use-chart-instance.js +115 -122
  28. package/lib/cjs/charts/hooks/use-chart-instance.js.map +1 -1
  29. package/lib/cjs/charts/hooks/use-chart-option.js +79 -80
  30. package/lib/cjs/charts/hooks/use-chart-option.js.map +1 -1
  31. package/lib/cjs/charts/hooks/use-chart-refs.js +47 -44
  32. package/lib/cjs/charts/hooks/use-chart-refs.js.map +1 -1
  33. package/lib/cjs/charts/hooks/use-chart-zoom.js +102 -127
  34. package/lib/cjs/charts/hooks/use-chart-zoom.js.map +1 -1
  35. package/lib/cjs/charts/hooks/use-legend-interactions.js +127 -132
  36. package/lib/cjs/charts/hooks/use-legend-interactions.js.map +1 -1
  37. package/lib/cjs/charts/hooks/use-legend-series.js +143 -174
  38. package/lib/cjs/charts/hooks/use-legend-series.js.map +1 -1
  39. package/lib/cjs/charts/hooks/use-legend-visibility.js +66 -85
  40. package/lib/cjs/charts/hooks/use-legend-visibility.js.map +1 -1
  41. package/lib/cjs/charts/index.js +31 -40
  42. package/lib/cjs/charts/index.js.map +1 -1
  43. package/lib/cjs/charts/themes/ndl-echarts-theme.js +136 -168
  44. package/lib/cjs/charts/themes/ndl-echarts-theme.js.map +1 -1
  45. package/lib/cjs/charts/utils/aria-description.js +150 -214
  46. package/lib/cjs/charts/utils/aria-description.js.map +1 -1
  47. package/lib/cjs/charts/utils/build-chart-option.js +166 -174
  48. package/lib/cjs/charts/utils/build-chart-option.js.map +1 -1
  49. package/lib/cjs/charts/utils/chart-tooltip-formatter.js +156 -172
  50. package/lib/cjs/charts/utils/chart-tooltip-formatter.js.map +1 -1
  51. package/lib/cjs/charts/utils/chart-types.js +25 -20
  52. package/lib/cjs/charts/utils/chart-types.js.map +1 -1
  53. package/lib/cjs/charts/utils/defaults.js +69 -67
  54. package/lib/cjs/charts/utils/defaults.js.map +1 -1
  55. package/lib/cjs/charts/utils/format-utils.js +55 -66
  56. package/lib/cjs/charts/utils/format-utils.js.map +1 -1
  57. package/lib/cjs/charts/utils/legend-layout.js +54 -53
  58. package/lib/cjs/charts/utils/legend-layout.js.map +1 -1
  59. package/lib/cjs/charts/utils/legend-utils.js +82 -121
  60. package/lib/cjs/charts/utils/legend-utils.js.map +1 -1
  61. package/lib/cjs/charts/utils/scatter-tooltip-points.js +191 -266
  62. package/lib/cjs/charts/utils/scatter-tooltip-points.js.map +1 -1
  63. package/lib/cjs/charts/utils/threshold.js +89 -102
  64. package/lib/cjs/charts/utils/threshold.js.map +1 -1
  65. package/lib/cjs/charts/utils/user-option-utils.js +419 -347
  66. package/lib/cjs/charts/utils/user-option-utils.js.map +1 -1
  67. package/lib/cjs/index.js +31 -35
  68. package/lib/cjs/index.js.map +1 -1
  69. package/lib/esm/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/defineProperty.mjs +11 -0
  70. package/lib/esm/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectSpread2.mjs +24 -0
  71. package/lib/esm/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectWithoutProperties.mjs +12 -0
  72. package/lib/esm/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectWithoutPropertiesLoose.mjs +11 -0
  73. package/lib/esm/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/toPrimitive.mjs +13 -0
  74. package/lib/esm/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/toPropertyKey.mjs +8 -0
  75. package/lib/esm/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/typeof.mjs +10 -0
  76. package/lib/esm/charts/Chart.mjs +123 -0
  77. package/lib/esm/charts/Chart.mjs.map +1 -0
  78. package/lib/esm/charts/ChartContainer.mjs +71 -0
  79. package/lib/esm/charts/ChartContainer.mjs.map +1 -0
  80. package/lib/esm/charts/ChartEmpty.mjs +46 -0
  81. package/lib/esm/charts/ChartEmpty.mjs.map +1 -0
  82. package/lib/esm/charts/ChartRender.mjs +113 -0
  83. package/lib/esm/charts/ChartRender.mjs.map +1 -0
  84. package/lib/esm/charts/ChartTooltip.mjs +109 -0
  85. package/lib/esm/charts/ChartTooltip.mjs.map +1 -0
  86. package/lib/esm/charts/Legend.mjs +82 -0
  87. package/lib/esm/charts/Legend.mjs.map +1 -0
  88. package/lib/esm/charts/LegendItem.mjs +82 -0
  89. package/lib/esm/charts/LegendItem.mjs.map +1 -0
  90. package/lib/esm/charts/LegendLayout.mjs +337 -0
  91. package/lib/esm/charts/LegendLayout.mjs.map +1 -0
  92. package/lib/esm/charts/hooks/use-chart-instance.mjs +119 -0
  93. package/lib/esm/charts/hooks/use-chart-instance.mjs.map +1 -0
  94. package/lib/esm/charts/hooks/use-chart-option.mjs +79 -0
  95. package/lib/esm/charts/hooks/use-chart-option.mjs.map +1 -0
  96. package/lib/esm/charts/hooks/use-chart-refs.mjs +49 -0
  97. package/lib/esm/charts/hooks/use-chart-refs.mjs.map +1 -0
  98. package/lib/esm/charts/hooks/use-chart-zoom.mjs +102 -0
  99. package/lib/esm/charts/hooks/use-chart-zoom.mjs.map +1 -0
  100. package/lib/esm/charts/hooks/use-legend-interactions.mjs +138 -0
  101. package/lib/esm/charts/hooks/use-legend-interactions.mjs.map +1 -0
  102. package/lib/esm/charts/hooks/use-legend-series.mjs +151 -0
  103. package/lib/esm/charts/hooks/use-legend-series.mjs.map +1 -0
  104. package/lib/esm/charts/hooks/use-legend-visibility.mjs +67 -0
  105. package/lib/esm/charts/hooks/use-legend-visibility.mjs.map +1 -0
  106. package/lib/esm/charts/index.mjs +27 -0
  107. package/lib/esm/charts/index.mjs.map +1 -0
  108. package/lib/esm/charts/themes/ndl-echarts-theme.mjs +139 -0
  109. package/lib/esm/charts/themes/ndl-echarts-theme.mjs.map +1 -0
  110. package/lib/esm/charts/utils/aria-description.mjs +162 -0
  111. package/lib/esm/charts/utils/aria-description.mjs.map +1 -0
  112. package/lib/esm/charts/utils/build-chart-option.mjs +184 -0
  113. package/lib/esm/charts/utils/build-chart-option.mjs.map +1 -0
  114. package/lib/esm/charts/utils/chart-tooltip-formatter.mjs +159 -0
  115. package/lib/esm/charts/utils/chart-tooltip-formatter.mjs.map +1 -0
  116. package/lib/esm/charts/utils/chart-types.mjs +24 -0
  117. package/lib/esm/charts/utils/chart-types.mjs.map +1 -0
  118. package/lib/esm/charts/utils/defaults.mjs +73 -0
  119. package/lib/esm/charts/utils/defaults.mjs.map +1 -0
  120. package/lib/esm/charts/utils/format-utils.mjs +61 -0
  121. package/lib/esm/charts/utils/format-utils.mjs.map +1 -0
  122. package/lib/esm/charts/utils/legend-layout.mjs +57 -0
  123. package/lib/esm/charts/utils/legend-layout.mjs.map +1 -0
  124. package/lib/esm/charts/utils/legend-utils.mjs +90 -0
  125. package/lib/esm/charts/utils/legend-utils.mjs.map +1 -0
  126. package/lib/esm/charts/utils/scatter-tooltip-points.mjs +215 -0
  127. package/lib/esm/charts/utils/scatter-tooltip-points.mjs.map +1 -0
  128. package/lib/esm/charts/utils/threshold.mjs +92 -0
  129. package/lib/esm/charts/utils/threshold.mjs.map +1 -0
  130. package/lib/esm/charts/utils/user-option-utils.mjs +445 -0
  131. package/lib/esm/charts/utils/user-option-utils.mjs.map +1 -0
  132. package/lib/esm/index.mjs +27 -0
  133. package/lib/esm/index.mjs.map +1 -0
  134. package/package.json +12 -16
  135. package/skills/ndl-react-charts/SKILL.md +2 -2
  136. package/lib/cjs/charts/tests/ChartWrapperWithTooltipFormatter.js +0 -38
  137. package/lib/cjs/charts/tests/ChartWrapperWithTooltipFormatter.js.map +0 -1
  138. package/lib/cjs/charts/tests/ChartZoomHarness.js +0 -113
  139. package/lib/cjs/charts/tests/ChartZoomHarness.js.map +0 -1
  140. package/lib/cjs/charts/tests/HorizontalBarWithVerticalSlider.js +0 -78
  141. package/lib/cjs/charts/tests/HorizontalBarWithVerticalSlider.js.map +0 -1
  142. package/lib/cjs/charts/tests/PieChartWithRerender.js +0 -46
  143. package/lib/cjs/charts/tests/PieChartWithRerender.js.map +0 -1
  144. package/lib/cjs/charts/tests/chart-test-utils.js +0 -527
  145. package/lib/cjs/charts/tests/chart-test-utils.js.map +0 -1
  146. package/lib/esm/charts/Chart.js +0 -114
  147. package/lib/esm/charts/Chart.js.map +0 -1
  148. package/lib/esm/charts/ChartContainer.js +0 -67
  149. package/lib/esm/charts/ChartContainer.js.map +0 -1
  150. package/lib/esm/charts/ChartEmpty.js +0 -33
  151. package/lib/esm/charts/ChartEmpty.js.map +0 -1
  152. package/lib/esm/charts/ChartRender.js +0 -89
  153. package/lib/esm/charts/ChartRender.js.map +0 -1
  154. package/lib/esm/charts/ChartTooltip.js +0 -64
  155. package/lib/esm/charts/ChartTooltip.js.map +0 -1
  156. package/lib/esm/charts/Legend.js +0 -71
  157. package/lib/esm/charts/Legend.js.map +0 -1
  158. package/lib/esm/charts/LegendItem.js +0 -61
  159. package/lib/esm/charts/LegendItem.js.map +0 -1
  160. package/lib/esm/charts/LegendLayout.js +0 -323
  161. package/lib/esm/charts/LegendLayout.js.map +0 -1
  162. package/lib/esm/charts/hooks/use-chart-instance.js +0 -128
  163. package/lib/esm/charts/hooks/use-chart-instance.js.map +0 -1
  164. package/lib/esm/charts/hooks/use-chart-option.js +0 -82
  165. package/lib/esm/charts/hooks/use-chart-option.js.map +0 -1
  166. package/lib/esm/charts/hooks/use-chart-refs.js +0 -48
  167. package/lib/esm/charts/hooks/use-chart-refs.js.map +0 -1
  168. package/lib/esm/charts/hooks/use-chart-zoom.js +0 -129
  169. package/lib/esm/charts/hooks/use-chart-zoom.js.map +0 -1
  170. package/lib/esm/charts/hooks/use-legend-interactions.js +0 -145
  171. package/lib/esm/charts/hooks/use-legend-interactions.js.map +0 -1
  172. package/lib/esm/charts/hooks/use-legend-series.js +0 -184
  173. package/lib/esm/charts/hooks/use-legend-series.js.map +0 -1
  174. package/lib/esm/charts/hooks/use-legend-visibility.js +0 -87
  175. package/lib/esm/charts/hooks/use-legend-visibility.js.map +0 -1
  176. package/lib/esm/charts/index.js.map +0 -1
  177. package/lib/esm/charts/tests/ChartWrapperWithTooltipFormatter.js.map +0 -1
  178. package/lib/esm/charts/tests/ChartZoomHarness.js +0 -109
  179. package/lib/esm/charts/tests/ChartZoomHarness.js.map +0 -1
  180. package/lib/esm/charts/tests/HorizontalBarWithVerticalSlider.js +0 -74
  181. package/lib/esm/charts/tests/HorizontalBarWithVerticalSlider.js.map +0 -1
  182. package/lib/esm/charts/tests/PieChartWithRerender.js +0 -43
  183. package/lib/esm/charts/tests/PieChartWithRerender.js.map +0 -1
  184. package/lib/esm/charts/tests/chart-test-utils.js +0 -500
  185. package/lib/esm/charts/tests/chart-test-utils.js.map +0 -1
  186. package/lib/esm/charts/themes/ndl-echarts-theme.js +0 -172
  187. package/lib/esm/charts/themes/ndl-echarts-theme.js.map +0 -1
  188. package/lib/esm/charts/utils/aria-description.js +0 -228
  189. package/lib/esm/charts/utils/aria-description.js.map +0 -1
  190. package/lib/esm/charts/utils/build-chart-option.js +0 -193
  191. package/lib/esm/charts/utils/build-chart-option.js.map +0 -1
  192. package/lib/esm/charts/utils/chart-tooltip-formatter.js +0 -177
  193. package/lib/esm/charts/utils/chart-tooltip-formatter.js.map +0 -1
  194. package/lib/esm/charts/utils/chart-types.js.map +0 -1
  195. package/lib/esm/charts/utils/defaults.js +0 -73
  196. package/lib/esm/charts/utils/defaults.js.map +0 -1
  197. package/lib/esm/charts/utils/format-utils.js +0 -74
  198. package/lib/esm/charts/utils/format-utils.js.map +0 -1
  199. package/lib/esm/charts/utils/legend-layout.js +0 -59
  200. package/lib/esm/charts/utils/legend-layout.js.map +0 -1
  201. package/lib/esm/charts/utils/legend-utils.js +0 -131
  202. package/lib/esm/charts/utils/legend-utils.js.map +0 -1
  203. package/lib/esm/charts/utils/scatter-tooltip-points.js +0 -291
  204. package/lib/esm/charts/utils/scatter-tooltip-points.js.map +0 -1
  205. package/lib/esm/charts/utils/threshold.js +0 -106
  206. package/lib/esm/charts/utils/threshold.js.map +0 -1
  207. package/lib/esm/charts/utils/user-option-utils.js +0 -374
  208. package/lib/esm/charts/utils/user-option-utils.js.map +0 -1
  209. package/lib/esm/index.js.map +0 -1
@@ -1,80 +1,82 @@
1
1
  "use strict";
2
+ Object.defineProperties(exports, {
3
+ __esModule: { value: true },
4
+ [Symbol.toStringTag]: { value: "Module" }
5
+ });
6
+ // src/charts/utils/defaults.ts
2
7
  /*!
3
- *
4
- * Copyright (c) "Neo4j"
5
- * Neo4j Sweden AB [http://neo4j.com]
6
- *
7
- * This file is part of Neo4j.
8
- *
9
- * Neo4j is free software: you can redistribute it and/or modify
10
- * it under the terms of the GNU General Public License as published by
11
- * the Free Software Foundation, either version 3 of the License, or
12
- * (at your option) any later version.
13
- *
14
- * This program is distributed in the hope that it will be useful,
15
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
- * GNU General Public License for more details.
18
- *
19
- * You should have received a copy of the GNU General Public License
20
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
21
- */
22
- Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.tooltipMaxWidth = exports.tooltipExtraCssText = exports.needleOwnedComponents = exports.defaultThresholdLineSeriesOption = exports.defaultChartSettings = void 0;
24
- const defaultThresholdLineSeriesOption = {
25
- condition: 'greater',
26
- };
27
- exports.defaultThresholdLineSeriesOption = defaultThresholdLineSeriesOption;
8
+ *
9
+ * Copyright (c) "Neo4j"
10
+ * Neo4j Sweden AB [http://neo4j.com]
11
+ *
12
+ * This file is part of Neo4j.
13
+ *
14
+ * Neo4j is free software: you can redistribute it and/or modify
15
+ * it under the terms of the GNU General Public License as published by
16
+ * the Free Software Foundation, either version 3 of the License, or
17
+ * (at your option) any later version.
18
+ *
19
+ * This program is distributed in the hope that it will be useful,
20
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
21
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
+ * GNU General Public License for more details.
23
+ *
24
+ * You should have received a copy of the GNU General Public License
25
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
26
+ */
27
+ const defaultThresholdLineSeriesOption = { condition: "greater" };
28
28
  const tooltipMaxWidth = 400;
29
- exports.tooltipMaxWidth = tooltipMaxWidth;
30
29
  /**
31
- * ECharts writes `white-space: nowrap` inline on the tooltip container, so a
32
- * long series name or category label stretches the tooltip across the chart
33
- * until the max width and normal wrapping override it. `overflow-wrap` is
34
- * needed on top of that: the tooltip rows are flex items, and only `anywhere`
35
- * lets their min-content size drop below the longest word.
36
- */
30
+ * ECharts writes `white-space: nowrap` inline on the tooltip container, so a
31
+ * long series name or category label stretches the tooltip across the chart
32
+ * until the max width and normal wrapping override it. `overflow-wrap` is
33
+ * needed on top of that: the tooltip rows are flex items, and only `anywhere`
34
+ * lets their min-content size drop below the longest word.
35
+ */
37
36
  const tooltipExtraCssText = [
38
- 'box-shadow: none',
39
- 'background-color: transparent',
40
- `max-width: ${tooltipMaxWidth}px`,
41
- 'white-space: normal',
42
- 'overflow-wrap: anywhere',
43
- ].join('; ');
44
- exports.tooltipExtraCssText = tooltipExtraCssText;
37
+ "box-shadow: none",
38
+ "background-color: transparent",
39
+ `max-width: 400px`,
40
+ "white-space: normal",
41
+ "overflow-wrap: anywhere"
42
+ ].join("; ");
45
43
  /**
46
- * ECharts component main types that `buildChartOption` always writes in full,
47
- * so replacing them gives the same "drop what disappeared" behavior as
48
- * `notMerge`. Every entry has to be a registered component main type, which is
49
- * only asserted by ECharts in development builds.
50
- *
51
- * `toolbox` is deliberately absent: it has to keep its view instance across
52
- * updates, see `defaultChartSettings`.
53
- */
44
+ * ECharts component main types that `buildChartOption` always writes in full,
45
+ * so replacing them gives the same "drop what disappeared" behavior as
46
+ * `notMerge`. Every entry has to be a registered component main type, which is
47
+ * only asserted by ECharts in development builds.
48
+ *
49
+ * `toolbox` is deliberately absent: it has to keep its view instance across
50
+ * updates, see `defaultChartSettings`.
51
+ */
54
52
  const needleOwnedComponents = [
55
- 'dataZoom',
56
- 'dataset',
57
- 'grid',
58
- 'legend',
59
- 'series',
60
- 'tooltip',
61
- 'xAxis',
62
- 'yAxis',
53
+ "dataZoom",
54
+ "dataset",
55
+ "grid",
56
+ "legend",
57
+ "series",
58
+ "tooltip",
59
+ "xAxis",
60
+ "yAxis"
63
61
  ];
64
- exports.needleOwnedComponents = needleOwnedComponents;
65
62
  /**
66
- * `notMerge` rebuilds every component view on each `setOption`. That makes
67
- * ECharts mount a fresh toolbox brush controller while the previous one stays
68
- * attached to the renderer, because `ToolboxView.dispose` iterates its feature
69
- * map with `zrUtil.each` and so never disposes anything. Every leftover
70
- * controller then re-applies the same drag, each time against an axis the
71
- * previous one already zoomed, which shrinks the selected range.
72
- */
63
+ * `notMerge` rebuilds every component view on each `setOption`. That makes
64
+ * ECharts mount a fresh toolbox brush controller while the previous one stays
65
+ * attached to the renderer, because `ToolboxView.dispose` iterates its feature
66
+ * map with `zrUtil.each` and so never disposes anything. Every leftover
67
+ * controller then re-applies the same drag, each time against an axis the
68
+ * previous one already zoomed, which shrinks the selected range.
69
+ */
73
70
  const defaultChartSettings = {
74
- lazyUpdate: false,
75
- notMerge: false,
76
- replaceMerge: needleOwnedComponents,
77
- silent: false,
71
+ lazyUpdate: false,
72
+ notMerge: false,
73
+ replaceMerge: needleOwnedComponents,
74
+ silent: false
78
75
  };
79
76
  exports.defaultChartSettings = defaultChartSettings;
77
+ exports.defaultThresholdLineSeriesOption = defaultThresholdLineSeriesOption;
78
+ exports.needleOwnedComponents = needleOwnedComponents;
79
+ exports.tooltipExtraCssText = tooltipExtraCssText;
80
+ exports.tooltipMaxWidth = tooltipMaxWidth;
81
+
80
82
  //# sourceMappingURL=defaults.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../../../src/charts/utils/defaults.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAIH,MAAM,gCAAgC,GAElC;IACF,SAAS,EAAE,SAAS;CACrB,CAAC;AAwDA,4EAAgC;AAtDlC,MAAM,eAAe,GAAG,GAAG,CAAC;AAyD1B,0CAAe;AAvDjB;;;;;;GAMG;AACH,MAAM,mBAAmB,GAAG;IAC1B,kBAAkB;IAClB,+BAA+B;IAC/B,cAAc,eAAe,IAAI;IACjC,qBAAqB;IACrB,yBAAyB;CAC1B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAyCX,kDAAmB;AAvCrB;;;;;;;;GAQG;AACH,MAAM,qBAAqB,GAAG;IAC5B,UAAU;IACV,SAAS;IACT,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,OAAO;IACP,OAAO;CACR,CAAC;AAoBA,sDAAqB;AAlBvB;;;;;;;GAOG;AACH,MAAM,oBAAoB,GAAwC;IAChE,UAAU,EAAE,KAAK;IACjB,QAAQ,EAAE,KAAK;IACf,YAAY,EAAE,qBAAqB;IACnC,MAAM,EAAE,KAAK;CACd,CAAC;AAGA,oDAAoB","sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport type { ChartProps, Condition } from './chart-types';\n\nconst defaultThresholdLineSeriesOption: {\n condition: Condition;\n} = {\n condition: 'greater',\n};\n\nconst tooltipMaxWidth = 400;\n\n/**\n * ECharts writes `white-space: nowrap` inline on the tooltip container, so a\n * long series name or category label stretches the tooltip across the chart\n * until the max width and normal wrapping override it. `overflow-wrap` is\n * needed on top of that: the tooltip rows are flex items, and only `anywhere`\n * lets their min-content size drop below the longest word.\n */\nconst tooltipExtraCssText = [\n 'box-shadow: none',\n 'background-color: transparent',\n `max-width: ${tooltipMaxWidth}px`,\n 'white-space: normal',\n 'overflow-wrap: anywhere',\n].join('; ');\n\n/**\n * ECharts component main types that `buildChartOption` always writes in full,\n * so replacing them gives the same \"drop what disappeared\" behavior as\n * `notMerge`. Every entry has to be a registered component main type, which is\n * only asserted by ECharts in development builds.\n *\n * `toolbox` is deliberately absent: it has to keep its view instance across\n * updates, see `defaultChartSettings`.\n */\nconst needleOwnedComponents = [\n 'dataZoom',\n 'dataset',\n 'grid',\n 'legend',\n 'series',\n 'tooltip',\n 'xAxis',\n 'yAxis',\n];\n\n/**\n * `notMerge` rebuilds every component view on each `setOption`. That makes\n * ECharts mount a fresh toolbox brush controller while the previous one stays\n * attached to the renderer, because `ToolboxView.dispose` iterates its feature\n * map with `zrUtil.each` and so never disposes anything. Every leftover\n * controller then re-applies the same drag, each time against an axis the\n * previous one already zoomed, which shrinks the selected range.\n */\nconst defaultChartSettings: NonNullable<ChartProps['settings']> = {\n lazyUpdate: false,\n notMerge: false,\n replaceMerge: needleOwnedComponents,\n silent: false,\n};\n\nexport {\n defaultChartSettings,\n defaultThresholdLineSeriesOption,\n needleOwnedComponents,\n tooltipExtraCssText,\n tooltipMaxWidth,\n};\n"]}
1
+ {"version":3,"file":"defaults.js","names":[],"sources":["../../../../src/charts/utils/defaults.ts"],"sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport type { ChartProps, Condition } from './chart-types';\n\nconst defaultThresholdLineSeriesOption: {\n condition: Condition;\n} = {\n condition: 'greater',\n};\n\nconst tooltipMaxWidth = 400;\n\n/**\n * ECharts writes `white-space: nowrap` inline on the tooltip container, so a\n * long series name or category label stretches the tooltip across the chart\n * until the max width and normal wrapping override it. `overflow-wrap` is\n * needed on top of that: the tooltip rows are flex items, and only `anywhere`\n * lets their min-content size drop below the longest word.\n */\nconst tooltipExtraCssText = [\n 'box-shadow: none',\n 'background-color: transparent',\n `max-width: ${tooltipMaxWidth}px`,\n 'white-space: normal',\n 'overflow-wrap: anywhere',\n].join('; ');\n\n/**\n * ECharts component main types that `buildChartOption` always writes in full,\n * so replacing them gives the same \"drop what disappeared\" behavior as\n * `notMerge`. Every entry has to be a registered component main type, which is\n * only asserted by ECharts in development builds.\n *\n * `toolbox` is deliberately absent: it has to keep its view instance across\n * updates, see `defaultChartSettings`.\n */\nconst needleOwnedComponents = [\n 'dataZoom',\n 'dataset',\n 'grid',\n 'legend',\n 'series',\n 'tooltip',\n 'xAxis',\n 'yAxis',\n];\n\n/**\n * `notMerge` rebuilds every component view on each `setOption`. That makes\n * ECharts mount a fresh toolbox brush controller while the previous one stays\n * attached to the renderer, because `ToolboxView.dispose` iterates its feature\n * map with `zrUtil.each` and so never disposes anything. Every leftover\n * controller then re-applies the same drag, each time against an axis the\n * previous one already zoomed, which shrinks the selected range.\n */\nconst defaultChartSettings: NonNullable<ChartProps['settings']> = {\n lazyUpdate: false,\n notMerge: false,\n replaceMerge: needleOwnedComponents,\n silent: false,\n};\n\nexport {\n defaultChartSettings,\n defaultThresholdLineSeriesOption,\n needleOwnedComponents,\n tooltipExtraCssText,\n tooltipMaxWidth,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAM,mCAEF,EACF,WAAW,UACb;AAEA,MAAM,kBAAkB;;;;;;;;AASxB,MAAM,sBAAsB;CAC1B;CACA;CACA;CACA;CACA;AACF,CAAC,CAAC,KAAK,IAAI;;;;;;;;;;AAWX,MAAM,wBAAwB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;;;;;;;;AAUA,MAAM,uBAA4D;CAChE,YAAY;CACZ,UAAU;CACV,cAAc;CACd,QAAQ;AACV"}
@@ -1,81 +1,70 @@
1
1
  "use strict";
2
+ Object.defineProperties(exports, {
3
+ __esModule: { value: true },
4
+ [Symbol.toStringTag]: { value: "Module" }
5
+ });
6
+ let echarts = require("echarts");
7
+ // src/charts/utils/format-utils.ts
2
8
  /*!
3
- *
4
- * Copyright (c) "Neo4j"
5
- * Neo4j Sweden AB [http://neo4j.com]
6
- *
7
- * This file is part of Neo4j.
8
- *
9
- * Neo4j is free software: you can redistribute it and/or modify
10
- * it under the terms of the GNU General Public License as published by
11
- * the Free Software Foundation, either version 3 of the License, or
12
- * (at your option) any later version.
13
- *
14
- * This program is distributed in the hope that it will be useful,
15
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
- * GNU General Public License for more details.
18
- *
19
- * You should have received a copy of the GNU General Public License
20
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
21
- */
22
- Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.formatTooltipValue = exports.formatTimeAxisDate = exports.formatNumberEnUS = exports.extractValueFromTooltipSeries = exports.capitalizeFirstLetter = void 0;
24
- const echarts_1 = require("echarts");
9
+ *
10
+ * Copyright (c) "Neo4j"
11
+ * Neo4j Sweden AB [http://neo4j.com]
12
+ *
13
+ * This file is part of Neo4j.
14
+ *
15
+ * Neo4j is free software: you can redistribute it and/or modify
16
+ * it under the terms of the GNU General Public License as published by
17
+ * the Free Software Foundation, either version 3 of the License, or
18
+ * (at your option) any later version.
19
+ *
20
+ * This program is distributed in the hope that it will be useful,
21
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ * GNU General Public License for more details.
24
+ *
25
+ * You should have received a copy of the GNU General Public License
26
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
27
+ */
25
28
  const capitalizeFirstLetter = (str) => {
26
- if (!str) {
27
- return str;
28
- }
29
- return str.charAt(0).toUpperCase() + str.substring(1);
29
+ if (!str) return str;
30
+ return str.charAt(0).toUpperCase() + str.substring(1);
30
31
  };
31
- exports.capitalizeFirstLetter = capitalizeFirstLetter;
32
- const enUSNumberFormatter = new Intl.NumberFormat('en-US');
32
+ const enUSNumberFormatter = new Intl.NumberFormat("en-US");
33
33
  /**
34
- * Formats finite number values with en-US separators and returns all other
35
- * values unchanged.
36
- */
34
+ * Formats finite number values with en-US separators and returns all other
35
+ * values unchanged.
36
+ */
37
37
  const formatNumberEnUS = (value) => {
38
- if (typeof value === 'number') {
39
- return Number.isFinite(value) ? enUSNumberFormatter.format(value) : value;
40
- }
41
- return value;
38
+ if (typeof value === "number") return Number.isFinite(value) ? enUSNumberFormatter.format(value) : value;
39
+ return value;
42
40
  };
43
- exports.formatNumberEnUS = formatNumberEnUS;
44
41
  /**
45
- * Formats a date the way ECharts labels a time axis, so tooltips match it.
46
- */
47
- const formatTimeAxisDate = (date) => echarts_1.time.format(date, '{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}', false);
48
- exports.formatTimeAxisDate = formatTimeAxisDate;
42
+ * Formats a date the way ECharts labels a time axis, so tooltips match it.
43
+ */
44
+ const formatTimeAxisDate = (date) => echarts.time.format(date, "{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}", false);
49
45
  /**
50
- * Default tooltip formatting. Numbers get en-US separators and dates use
51
- * `formatTimeAxisDate`. Other values are returned unchanged.
52
- */
46
+ * Default tooltip formatting. Numbers get en-US separators and dates use
47
+ * `formatTimeAxisDate`. Other values are returned unchanged.
48
+ */
53
49
  const formatTooltipValue = (value) => {
54
- if (value instanceof Date) {
55
- return formatTimeAxisDate(value);
56
- }
57
- return formatNumberEnUS(value);
50
+ if (value instanceof Date) return formatTimeAxisDate(value);
51
+ return formatNumberEnUS(value);
58
52
  };
59
- exports.formatTooltipValue = formatTooltipValue;
60
53
  /**
61
- * Extract the tooltip value from the series depending on the axisDim and encode properties
62
- * If the value is a single value, return it as it is
63
- * If the encode property does not exist fallback to 1
64
- */
65
- const extractValueFromTooltipSeries = (value, encode,
66
- // We currently only support x and y axes
67
- axisDim = 'x') => {
68
- var _a, _b;
69
- if (!Array.isArray(value)) {
70
- return value;
71
- }
72
- // The axisDim is the axis that the tooltip was triggered on,
73
- // if it was triggered on the x axis the value should be read from the y axis and vice versa
74
- const encodeValueToRead = axisDim === 'x' ? encode === null || encode === void 0 ? void 0 : encode.y : ((_a = encode === null || encode === void 0 ? void 0 : encode.x) !== null && _a !== void 0 ? _a : 1);
75
- const seriesValueIdx = Array.isArray(encodeValueToRead)
76
- ? encodeValueToRead[0]
77
- : encodeValueToRead;
78
- return (_b = value[seriesValueIdx]) !== null && _b !== void 0 ? _b : value;
54
+ * Extract the tooltip value from the series depending on the axisDim and encode properties
55
+ * If the value is a single value, return it as it is
56
+ * If the encode property does not exist fallback to 1
57
+ */
58
+ const extractValueFromTooltipSeries = (value, encode, axisDim = "x") => {
59
+ var _encode$x, _value$seriesValueIdx;
60
+ if (!Array.isArray(value)) return value;
61
+ const encodeValueToRead = axisDim === "x" ? encode === null || encode === void 0 ? void 0 : encode.y : (_encode$x = encode === null || encode === void 0 ? void 0 : encode.x) !== null && _encode$x !== void 0 ? _encode$x : 1;
62
+ return (_value$seriesValueIdx = value[Array.isArray(encodeValueToRead) ? encodeValueToRead[0] : encodeValueToRead]) !== null && _value$seriesValueIdx !== void 0 ? _value$seriesValueIdx : value;
79
63
  };
64
+ exports.capitalizeFirstLetter = capitalizeFirstLetter;
80
65
  exports.extractValueFromTooltipSeries = extractValueFromTooltipSeries;
66
+ exports.formatNumberEnUS = formatNumberEnUS;
67
+ exports.formatTimeAxisDate = formatTimeAxisDate;
68
+ exports.formatTooltipValue = formatTooltipValue;
69
+
81
70
  //# sourceMappingURL=format-utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"format-utils.js","sourceRoot":"","sources":["../../../../src/charts/utils/format-utils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAEH,qCAA+B;AAE/B,MAAM,qBAAqB,GAAG,CAAC,GAAW,EAAE,EAAE;IAC5C,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,GAAG,CAAC;IACb,CAAC;IACD,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AACxD,CAAC,CAAC;AAmEA,sDAAqB;AAjEvB,MAAM,mBAAmB,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;AAE3D;;;GAGG;AACH,MAAM,gBAAgB,GAAG,CAAI,KAAQ,EAAc,EAAE;IACnD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAC5E,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAuDA,4CAAgB;AArDlB;;GAEG;AACH,MAAM,kBAAkB,GAAG,CAAC,IAAU,EAAE,EAAE,CACxC,cAAI,CAAC,MAAM,CAAC,IAAI,EAAE,iCAAiC,EAAE,KAAK,CAAC,CAAC;AAkD5D,gDAAkB;AAhDpB;;;GAGG;AACH,MAAM,kBAAkB,GAAG,CAAI,KAAQ,EAAc,EAAE;IACrD,IAAI,KAAK,YAAY,IAAI,EAAE,CAAC;QAC1B,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;IAED,OAAO,gBAAgB,CAAC,KAAK,CAAC,CAAC;AACjC,CAAC,CAAC;AAuCA,gDAAkB;AArCpB;;;;GAIG;AACH,MAAM,6BAA6B,GAAG,CACpC,KAA4C,EAC5C,MAMC;AACD,yCAAyC;AACzC,UAAqD,GAAG,EACxD,EAAE;;IACF,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,6DAA6D;IAC7D,4FAA4F;IAC5F,MAAM,iBAAiB,GAAG,OAAO,KAAK,GAAG,CAAC,CAAC,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,CAAC,CAAC,CAAC,CAAC,CAAC,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,CAAC,mCAAI,CAAC,CAAC,CAAC;IAEzE,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC;QACrD,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC;QACtB,CAAC,CAAC,iBAAiB,CAAC;IAEtB,OAAO,MAAA,KAAK,CAAC,cAAc,CAAC,mCAAI,KAAK,CAAC;AACxC,CAAC,CAAC;AAIA,sEAA6B","sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { time } from 'echarts';\n\nconst capitalizeFirstLetter = (str: string) => {\n if (!str) {\n return str;\n }\n return str.charAt(0).toUpperCase() + str.substring(1);\n};\n\nconst enUSNumberFormatter = new Intl.NumberFormat('en-US');\n\n/**\n * Formats finite number values with en-US separators and returns all other\n * values unchanged.\n */\nconst formatNumberEnUS = <T>(value: T): string | T => {\n if (typeof value === 'number') {\n return Number.isFinite(value) ? enUSNumberFormatter.format(value) : value;\n }\n\n return value;\n};\n\n/**\n * Formats a date the way ECharts labels a time axis, so tooltips match it.\n */\nconst formatTimeAxisDate = (date: Date) =>\n time.format(date, '{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}', false);\n\n/**\n * Default tooltip formatting. Numbers get en-US separators and dates use\n * `formatTimeAxisDate`. Other values are returned unchanged.\n */\nconst formatTooltipValue = <T>(value: T): string | T => {\n if (value instanceof Date) {\n return formatTimeAxisDate(value);\n }\n\n return formatNumberEnUS(value);\n};\n\n/**\n * Extract the tooltip value from the series depending on the axisDim and encode properties\n * If the value is a single value, return it as it is\n * If the encode property does not exist fallback to 1\n */\nconst extractValueFromTooltipSeries = (\n value: string | number | (number | string)[],\n encode: {\n // E-Charts uses encode.x and encode.y - https://echarts.apache.org/en/option.html#series-line.encode\n // oxlint-disable-next-line id-length\n x: number | number[];\n // oxlint-disable-next-line id-length\n y: number | number[];\n },\n // We currently only support x and y axes\n axisDim: 'x' | 'y' | 'angle' | 'radius' | 'single' = 'x',\n) => {\n if (!Array.isArray(value)) {\n return value;\n }\n\n // The axisDim is the axis that the tooltip was triggered on,\n // if it was triggered on the x axis the value should be read from the y axis and vice versa\n const encodeValueToRead = axisDim === 'x' ? encode?.y : (encode?.x ?? 1);\n\n const seriesValueIdx = Array.isArray(encodeValueToRead)\n ? encodeValueToRead[0]\n : encodeValueToRead;\n\n return value[seriesValueIdx] ?? value;\n};\n\nexport {\n capitalizeFirstLetter,\n extractValueFromTooltipSeries,\n formatNumberEnUS,\n formatTimeAxisDate,\n formatTooltipValue,\n};\n"]}
1
+ {"version":3,"file":"format-utils.js","names":["time"],"sources":["../../../../src/charts/utils/format-utils.ts"],"sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { time } from 'echarts';\n\nconst capitalizeFirstLetter = (str: string) => {\n if (!str) {\n return str;\n }\n return str.charAt(0).toUpperCase() + str.substring(1);\n};\n\nconst enUSNumberFormatter = new Intl.NumberFormat('en-US');\n\n/**\n * Formats finite number values with en-US separators and returns all other\n * values unchanged.\n */\nconst formatNumberEnUS = <T>(value: T): string | T => {\n if (typeof value === 'number') {\n return Number.isFinite(value) ? enUSNumberFormatter.format(value) : value;\n }\n\n return value;\n};\n\n/**\n * Formats a date the way ECharts labels a time axis, so tooltips match it.\n */\nconst formatTimeAxisDate = (date: Date) =>\n time.format(date, '{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}', false);\n\n/**\n * Default tooltip formatting. Numbers get en-US separators and dates use\n * `formatTimeAxisDate`. Other values are returned unchanged.\n */\nconst formatTooltipValue = <T>(value: T): string | T => {\n if (value instanceof Date) {\n return formatTimeAxisDate(value);\n }\n\n return formatNumberEnUS(value);\n};\n\n/**\n * Extract the tooltip value from the series depending on the axisDim and encode properties\n * If the value is a single value, return it as it is\n * If the encode property does not exist fallback to 1\n */\nconst extractValueFromTooltipSeries = (\n value: string | number | (number | string)[],\n encode: {\n // E-Charts uses encode.x and encode.y - https://echarts.apache.org/en/option.html#series-line.encode\n // oxlint-disable-next-line id-length\n x: number | number[];\n // oxlint-disable-next-line id-length\n y: number | number[];\n },\n // We currently only support x and y axes\n axisDim: 'x' | 'y' | 'angle' | 'radius' | 'single' = 'x',\n) => {\n if (!Array.isArray(value)) {\n return value;\n }\n\n // The axisDim is the axis that the tooltip was triggered on,\n // if it was triggered on the x axis the value should be read from the y axis and vice versa\n const encodeValueToRead = axisDim === 'x' ? encode?.y : (encode?.x ?? 1);\n\n const seriesValueIdx = Array.isArray(encodeValueToRead)\n ? encodeValueToRead[0]\n : encodeValueToRead;\n\n return value[seriesValueIdx] ?? value;\n};\n\nexport {\n capitalizeFirstLetter,\n extractValueFromTooltipSeries,\n formatNumberEnUS,\n formatTimeAxisDate,\n formatTooltipValue,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAM,yBAAyB,QAAgB;CAC7C,IAAI,CAAC,KACH,OAAO;CAET,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,IAAI,UAAU,CAAC;AACtD;AAEA,MAAM,sBAAsB,IAAI,KAAK,aAAa,OAAO;;;;;AAMzD,MAAM,oBAAuB,UAAyB;CACpD,IAAI,OAAO,UAAU,UACnB,OAAO,OAAO,SAAS,KAAK,IAAI,oBAAoB,OAAO,KAAK,IAAI;CAGtE,OAAO;AACT;;;;AAKA,MAAM,sBAAsB,SAC1BA,QAAAA,KAAK,OAAO,MAAM,mCAAmC,KAAK;;;;;AAM5D,MAAM,sBAAyB,UAAyB;CACtD,IAAI,iBAAiB,MACnB,OAAO,mBAAmB,KAAK;CAGjC,OAAO,iBAAiB,KAAK;AAC/B;;;;;;AAOA,MAAM,iCACJ,OACA,QAQA,UAAqD,QAClD;;CACH,IAAI,CAAC,MAAM,QAAQ,KAAK,GACtB,OAAO;CAKT,MAAM,oBAAoB,YAAY,MAAA,WAAA,QAAA,WAAA,KAAA,IAAA,KAAA,IAAM,OAAQ,KAAA,YAAA,WAAA,QAAA,WAAA,KAAA,IAAA,KAAA,IAAK,OAAQ,OAAA,QAAA,cAAA,KAAA,IAAA,YAAK;CAMtE,QAAA,wBAAO,MAJgB,MAAM,QAAQ,iBAAiB,IAClD,kBAAkB,KAClB,wBAAA,QAAA,0BAAA,KAAA,IAAA,wBAE4B;AAClC"}
@@ -1,65 +1,66 @@
1
1
  "use strict";
2
+ Object.defineProperties(exports, {
3
+ __esModule: { value: true },
4
+ [Symbol.toStringTag]: { value: "Module" }
5
+ });
6
+ // src/charts/utils/legend-layout.ts
2
7
  /*!
3
- *
4
- * Copyright (c) "Neo4j"
5
- * Neo4j Sweden AB [http://neo4j.com]
6
- *
7
- * This file is part of Neo4j.
8
- *
9
- * Neo4j is free software: you can redistribute it and/or modify
10
- * it under the terms of the GNU General Public License as published by
11
- * the Free Software Foundation, either version 3 of the License, or
12
- * (at your option) any later version.
13
- *
14
- * This program is distributed in the hope that it will be useful,
15
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
- * GNU General Public License for more details.
18
- *
19
- * You should have received a copy of the GNU General Public License
20
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
21
- */
22
- Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.getCollapsedVisibleItemCount = exports.getItemCountThatFitsRow = exports.getComputedElementWidth = exports.COLLAPSED_LEGEND_MAX_HEIGHT = exports.COLLAPSED_LEGEND_ROWS = void 0;
24
- exports.COLLAPSED_LEGEND_ROWS = 2;
25
- exports.COLLAPSED_LEGEND_MAX_HEIGHT = 64;
8
+ *
9
+ * Copyright (c) "Neo4j"
10
+ * Neo4j Sweden AB [http://neo4j.com]
11
+ *
12
+ * This file is part of Neo4j.
13
+ *
14
+ * Neo4j is free software: you can redistribute it and/or modify
15
+ * it under the terms of the GNU General Public License as published by
16
+ * the Free Software Foundation, either version 3 of the License, or
17
+ * (at your option) any later version.
18
+ *
19
+ * This program is distributed in the hope that it will be useful,
20
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
21
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
+ * GNU General Public License for more details.
23
+ *
24
+ * You should have received a copy of the GNU General Public License
25
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
26
+ */
27
+ const COLLAPSED_LEGEND_ROWS = 2;
28
+ const COLLAPSED_LEGEND_MAX_HEIGHT = 64;
26
29
  /**
27
- * Get the computed element width, including both paddings and margins
28
- */
30
+ * Get the computed element width, including both paddings and margins
31
+ */
29
32
  const getComputedElementWidth = (element) => {
30
- const elementRect = element.getBoundingClientRect();
31
- const elementComputedStyle = window.getComputedStyle(element);
32
- const elementMarginLeft = parseFloat(elementComputedStyle.marginLeft);
33
- const elementMarginRight = parseFloat(elementComputedStyle.marginRight);
34
- return elementRect.width + elementMarginLeft + elementMarginRight;
33
+ const elementRect = element.getBoundingClientRect();
34
+ const elementComputedStyle = window.getComputedStyle(element);
35
+ const elementMarginLeft = parseFloat(elementComputedStyle.marginLeft);
36
+ const elementMarginRight = parseFloat(elementComputedStyle.marginRight);
37
+ return elementRect.width + elementMarginLeft + elementMarginRight;
35
38
  };
36
- exports.getComputedElementWidth = getComputedElementWidth;
37
39
  const getItemCountThatFitsRow = (itemWidths, availableWidth, { keepOversizedFirstItem = true } = {}) => {
38
- let rowWidth = 0;
39
- let count = 0;
40
- for (const itemWidth of itemWidths) {
41
- if (count === 0 && itemWidth > availableWidth) {
42
- return keepOversizedFirstItem ? 1 : 0;
43
- }
44
- if (rowWidth + itemWidth > availableWidth) {
45
- return count;
46
- }
47
- rowWidth += itemWidth;
48
- count += 1;
49
- }
50
- return count;
40
+ let rowWidth = 0;
41
+ let count = 0;
42
+ for (const itemWidth of itemWidths) {
43
+ if (count === 0 && itemWidth > availableWidth) return keepOversizedFirstItem ? 1 : 0;
44
+ if (rowWidth + itemWidth > availableWidth) return count;
45
+ rowWidth += itemWidth;
46
+ count += 1;
47
+ }
48
+ return count;
51
49
  };
52
- exports.getItemCountThatFitsRow = getItemCountThatFitsRow;
53
50
  /**
54
- * Calculates how many legend items fit in the two-row collapsed layout.
55
- *
56
- * The second row reserves space for the "View more" action so that control
57
- * remains visible at the end of the collapsed legend.
58
- */
51
+ * Calculates how many legend items fit in the two-row collapsed layout.
52
+ *
53
+ * The second row reserves space for the "View more" action so that control
54
+ * remains visible at the end of the collapsed legend.
55
+ */
59
56
  const getCollapsedVisibleItemCount = (itemWidths, availableRowWidth, viewMoreButtonWidth) => {
60
- const firstRowItemCount = (0, exports.getItemCountThatFitsRow)(itemWidths, availableRowWidth);
61
- const secondRowItemCount = (0, exports.getItemCountThatFitsRow)(itemWidths.slice(firstRowItemCount), availableRowWidth - viewMoreButtonWidth, { keepOversizedFirstItem: false });
62
- return firstRowItemCount + secondRowItemCount;
57
+ const firstRowItemCount = getItemCountThatFitsRow(itemWidths, availableRowWidth);
58
+ return firstRowItemCount + getItemCountThatFitsRow(itemWidths.slice(firstRowItemCount), availableRowWidth - viewMoreButtonWidth, { keepOversizedFirstItem: false });
63
59
  };
60
+ exports.COLLAPSED_LEGEND_MAX_HEIGHT = COLLAPSED_LEGEND_MAX_HEIGHT;
61
+ exports.COLLAPSED_LEGEND_ROWS = COLLAPSED_LEGEND_ROWS;
64
62
  exports.getCollapsedVisibleItemCount = getCollapsedVisibleItemCount;
63
+ exports.getComputedElementWidth = getComputedElementWidth;
64
+ exports.getItemCountThatFitsRow = getItemCountThatFitsRow;
65
+
65
66
  //# sourceMappingURL=legend-layout.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"legend-layout.js","sourceRoot":"","sources":["../../../../src/charts/utils/legend-layout.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAEU,QAAA,qBAAqB,GAAG,CAAC,CAAC;AAC1B,QAAA,2BAA2B,GAAG,EAAE,CAAC;AAE9C;;GAEG;AACI,MAAM,uBAAuB,GAAG,CAAC,OAAgB,EAAE,EAAE;IAC1D,MAAM,WAAW,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;IACpD,MAAM,oBAAoB,GAAG,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAC9D,MAAM,iBAAiB,GAAG,UAAU,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC;IACtE,MAAM,kBAAkB,GAAG,UAAU,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC;IAExE,OAAO,WAAW,CAAC,KAAK,GAAG,iBAAiB,GAAG,kBAAkB,CAAC;AACpE,CAAC,CAAC;AAPW,QAAA,uBAAuB,2BAOlC;AAEK,MAAM,uBAAuB,GAAG,CACrC,UAAoB,EACpB,cAAsB,EACtB,EAAE,sBAAsB,GAAG,IAAI,EAAE,GAAG,EAAE,EACtC,EAAE;IACF,IAAI,QAAQ,GAAG,CAAC,CAAC;IACjB,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,IAAI,KAAK,KAAK,CAAC,IAAI,SAAS,GAAG,cAAc,EAAE,CAAC;YAC9C,OAAO,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACxC,CAAC;QAED,IAAI,QAAQ,GAAG,SAAS,GAAG,cAAc,EAAE,CAAC;YAC1C,OAAO,KAAK,CAAC;QACf,CAAC;QAED,QAAQ,IAAI,SAAS,CAAC;QACtB,KAAK,IAAI,CAAC,CAAC;IACb,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAtBW,QAAA,uBAAuB,2BAsBlC;AAEF;;;;;GAKG;AACI,MAAM,4BAA4B,GAAG,CAC1C,UAAoB,EACpB,iBAAyB,EACzB,mBAA2B,EAC3B,EAAE;IACF,MAAM,iBAAiB,GAAG,IAAA,+BAAuB,EAC/C,UAAU,EACV,iBAAiB,CAClB,CAAC;IACF,MAAM,kBAAkB,GAAG,IAAA,+BAAuB,EAChD,UAAU,CAAC,KAAK,CAAC,iBAAiB,CAAC,EACnC,iBAAiB,GAAG,mBAAmB,EACvC,EAAE,sBAAsB,EAAE,KAAK,EAAE,CAClC,CAAC;IAEF,OAAO,iBAAiB,GAAG,kBAAkB,CAAC;AAChD,CAAC,CAAC;AAhBW,QAAA,4BAA4B,gCAgBvC","sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nexport const COLLAPSED_LEGEND_ROWS = 2;\nexport const COLLAPSED_LEGEND_MAX_HEIGHT = 64;\n\n/**\n * Get the computed element width, including both paddings and margins\n */\nexport const getComputedElementWidth = (element: Element) => {\n const elementRect = element.getBoundingClientRect();\n const elementComputedStyle = window.getComputedStyle(element);\n const elementMarginLeft = parseFloat(elementComputedStyle.marginLeft);\n const elementMarginRight = parseFloat(elementComputedStyle.marginRight);\n\n return elementRect.width + elementMarginLeft + elementMarginRight;\n};\n\nexport const getItemCountThatFitsRow = (\n itemWidths: number[],\n availableWidth: number,\n { keepOversizedFirstItem = true } = {},\n) => {\n let rowWidth = 0;\n let count = 0;\n\n for (const itemWidth of itemWidths) {\n if (count === 0 && itemWidth > availableWidth) {\n return keepOversizedFirstItem ? 1 : 0;\n }\n\n if (rowWidth + itemWidth > availableWidth) {\n return count;\n }\n\n rowWidth += itemWidth;\n count += 1;\n }\n\n return count;\n};\n\n/**\n * Calculates how many legend items fit in the two-row collapsed layout.\n *\n * The second row reserves space for the \"View more\" action so that control\n * remains visible at the end of the collapsed legend.\n */\nexport const getCollapsedVisibleItemCount = (\n itemWidths: number[],\n availableRowWidth: number,\n viewMoreButtonWidth: number,\n) => {\n const firstRowItemCount = getItemCountThatFitsRow(\n itemWidths,\n availableRowWidth,\n );\n const secondRowItemCount = getItemCountThatFitsRow(\n itemWidths.slice(firstRowItemCount),\n availableRowWidth - viewMoreButtonWidth,\n { keepOversizedFirstItem: false },\n );\n\n return firstRowItemCount + secondRowItemCount;\n};\n"]}
1
+ {"version":3,"file":"legend-layout.js","names":[],"sources":["../../../../src/charts/utils/legend-layout.ts"],"sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nexport const COLLAPSED_LEGEND_ROWS = 2;\nexport const COLLAPSED_LEGEND_MAX_HEIGHT = 64;\n\n/**\n * Get the computed element width, including both paddings and margins\n */\nexport const getComputedElementWidth = (element: Element) => {\n const elementRect = element.getBoundingClientRect();\n const elementComputedStyle = window.getComputedStyle(element);\n const elementMarginLeft = parseFloat(elementComputedStyle.marginLeft);\n const elementMarginRight = parseFloat(elementComputedStyle.marginRight);\n\n return elementRect.width + elementMarginLeft + elementMarginRight;\n};\n\nexport const getItemCountThatFitsRow = (\n itemWidths: number[],\n availableWidth: number,\n { keepOversizedFirstItem = true } = {},\n) => {\n let rowWidth = 0;\n let count = 0;\n\n for (const itemWidth of itemWidths) {\n if (count === 0 && itemWidth > availableWidth) {\n return keepOversizedFirstItem ? 1 : 0;\n }\n\n if (rowWidth + itemWidth > availableWidth) {\n return count;\n }\n\n rowWidth += itemWidth;\n count += 1;\n }\n\n return count;\n};\n\n/**\n * Calculates how many legend items fit in the two-row collapsed layout.\n *\n * The second row reserves space for the \"View more\" action so that control\n * remains visible at the end of the collapsed legend.\n */\nexport const getCollapsedVisibleItemCount = (\n itemWidths: number[],\n availableRowWidth: number,\n viewMoreButtonWidth: number,\n) => {\n const firstRowItemCount = getItemCountThatFitsRow(\n itemWidths,\n availableRowWidth,\n );\n const secondRowItemCount = getItemCountThatFitsRow(\n itemWidths.slice(firstRowItemCount),\n availableRowWidth - viewMoreButtonWidth,\n { keepOversizedFirstItem: false },\n );\n\n return firstRowItemCount + secondRowItemCount;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,wBAAwB;AACrC,MAAa,8BAA8B;;;;AAK3C,MAAa,2BAA2B,YAAqB;CAC3D,MAAM,cAAc,QAAQ,sBAAsB;CAClD,MAAM,uBAAuB,OAAO,iBAAiB,OAAO;CAC5D,MAAM,oBAAoB,WAAW,qBAAqB,UAAU;CACpE,MAAM,qBAAqB,WAAW,qBAAqB,WAAW;CAEtE,OAAO,YAAY,QAAQ,oBAAoB;AACjD;AAEA,MAAa,2BACX,YACA,gBACA,EAAE,yBAAyB,SAAS,CAAC,MAClC;CACH,IAAI,WAAW;CACf,IAAI,QAAQ;CAEZ,KAAK,MAAM,aAAa,YAAY;EAClC,IAAI,UAAU,KAAK,YAAY,gBAC7B,OAAO,yBAAyB,IAAI;EAGtC,IAAI,WAAW,YAAY,gBACzB,OAAO;EAGT,YAAY;EACZ,SAAS;CACX;CAEA,OAAO;AACT;;;;;;;AAQA,MAAa,gCACX,YACA,mBACA,wBACG;CACH,MAAM,oBAAoB,wBACxB,YACA,iBACF;CAOA,OAAO,oBANoB,wBACzB,WAAW,MAAM,iBAAiB,GAClC,oBAAoB,qBACpB,EAAE,wBAAwB,MAAM,CAGU;AAC9C"}