cx 26.2.1 → 26.2.3

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 (324) hide show
  1. package/build/charts/Chart.d.ts.map +1 -1
  2. package/build/charts/Chart.js +5 -4
  3. package/build/charts/ColumnBarBase.d.ts +3 -3
  4. package/build/charts/ColumnBarBase.d.ts.map +1 -1
  5. package/build/charts/ColumnBarBase.js +1 -1
  6. package/build/charts/Legend.d.ts.map +1 -1
  7. package/build/charts/Legend.js +11 -4
  8. package/build/charts/Marker.d.ts +3 -3
  9. package/build/charts/Marker.d.ts.map +1 -1
  10. package/build/charts/MarkerLine.d.ts +7 -7
  11. package/build/charts/MarkerLine.d.ts.map +1 -1
  12. package/build/charts/MarkerLine.js +14 -10
  13. package/build/charts/PieChart.d.ts +4 -4
  14. package/build/charts/PieChart.d.ts.map +1 -1
  15. package/build/charts/PieChart.js +36 -14
  16. package/build/charts/PieLabel.d.ts.map +1 -1
  17. package/build/charts/PieLabel.js +2 -1
  18. package/build/charts/RangeMarker.d.ts +3 -3
  19. package/build/charts/RangeMarker.d.ts.map +1 -1
  20. package/build/charts/RangeMarker.js +1 -1
  21. package/build/charts/axis/TimeAxis.d.ts +3 -3
  22. package/build/charts/axis/TimeAxis.d.ts.map +1 -1
  23. package/build/charts/axis/TimeAxis.js +70 -21
  24. package/build/charts/helpers/ValueAtFinder.d.ts +1 -1
  25. package/build/charts/helpers/ValueAtFinder.d.ts.map +1 -1
  26. package/build/charts/helpers/ValueAtFinder.js +5 -2
  27. package/build/data/StructuredSelector.js +3 -4
  28. package/build/data/createAccessorModelProxy.d.ts +6 -11
  29. package/build/data/createAccessorModelProxy.d.ts.map +1 -1
  30. package/build/data/createAccessorModelProxy.js +1 -3
  31. package/build/svg/Ellipse.d.ts +5 -4
  32. package/build/svg/Ellipse.d.ts.map +1 -1
  33. package/build/svg/Ellipse.js +9 -6
  34. package/build/svg/Line.d.ts +1 -0
  35. package/build/svg/Line.d.ts.map +1 -1
  36. package/build/svg/Line.js +4 -1
  37. package/build/svg/Text.d.ts +12 -6
  38. package/build/svg/Text.d.ts.map +1 -1
  39. package/build/svg/Text.js +12 -4
  40. package/build/ui/Controller.d.ts +2 -0
  41. package/build/ui/Controller.d.ts.map +1 -1
  42. package/build/ui/Controller.js +3 -0
  43. package/build/ui/HoverSync.d.ts.map +1 -1
  44. package/build/ui/HoverSync.js +7 -2
  45. package/build/ui/Prop.d.ts +1 -1
  46. package/build/ui/Prop.d.ts.map +1 -1
  47. package/build/ui/Text.d.ts +3 -3
  48. package/build/ui/Text.d.ts.map +1 -1
  49. package/build/ui/Text.js +5 -5
  50. package/build/ui/adapter/GroupAdapter.d.ts.map +1 -1
  51. package/build/ui/adapter/GroupAdapter.js +20 -10
  52. package/build/ui/app/History.js +1 -1
  53. package/build/widgets/List.d.ts.map +1 -1
  54. package/build/widgets/List.js +6 -7
  55. package/build/widgets/drag-drop/DropZone.d.ts +3 -3
  56. package/build/widgets/drag-drop/DropZone.d.ts.map +1 -1
  57. package/build/widgets/form/Calendar.d.ts.map +1 -1
  58. package/build/widgets/form/Calendar.js +30 -11
  59. package/build/widgets/form/ColorField.d.ts.map +1 -1
  60. package/build/widgets/form/ColorField.js +16 -7
  61. package/build/widgets/form/DateTimeField.d.ts.map +1 -1
  62. package/build/widgets/form/DateTimeField.js +23 -10
  63. package/build/widgets/form/Field.d.ts +2 -0
  64. package/build/widgets/form/Field.d.ts.map +1 -1
  65. package/build/widgets/form/Field.js +11 -5
  66. package/build/widgets/form/LookupField.d.ts +1 -1
  67. package/build/widgets/form/LookupField.d.ts.map +1 -1
  68. package/build/widgets/form/LookupField.js +6 -6
  69. package/build/widgets/form/MonthField.d.ts.map +1 -1
  70. package/build/widgets/form/MonthField.js +15 -7
  71. package/build/widgets/form/MonthPicker.d.ts +1 -2
  72. package/build/widgets/form/MonthPicker.d.ts.map +1 -1
  73. package/build/widgets/form/MonthPicker.js +84 -41
  74. package/build/widgets/form/NumberField.d.ts +2 -0
  75. package/build/widgets/form/NumberField.d.ts.map +1 -1
  76. package/build/widgets/form/NumberField.js +45 -15
  77. package/build/widgets/form/TextField.d.ts +1 -9
  78. package/build/widgets/form/TextField.d.ts.map +1 -1
  79. package/build/widgets/form/TextField.js +1 -1
  80. package/build/widgets/grid/Grid.d.ts +2 -2
  81. package/build/widgets/grid/Grid.d.ts.map +1 -1
  82. package/build/widgets/grid/Grid.js +9 -4
  83. package/build/widgets/grid/Pagination.d.ts.map +1 -1
  84. package/build/widgets/grid/Pagination.js +4 -4
  85. package/build/widgets/grid/TreeNode.d.ts.map +1 -1
  86. package/build/widgets/grid/TreeNode.js +10 -2
  87. package/build/widgets/icons/folder.d.ts.map +1 -1
  88. package/build/widgets/icons/folder.js +1 -0
  89. package/build/widgets/icons/forward.d.ts.map +1 -1
  90. package/build/widgets/icons/forward.js +4 -3
  91. package/build/widgets/icons/loading.d.ts.map +1 -1
  92. package/build/widgets/icons/loading.js +6 -5
  93. package/build/widgets/icons/square.d.ts.map +1 -1
  94. package/build/widgets/icons/square.js +3 -3
  95. package/build/widgets/index.d.ts +3 -1
  96. package/build/widgets/index.d.ts.map +1 -1
  97. package/build/widgets/index.js +3 -1
  98. package/build/widgets/overlay/ContextMenu.d.ts.map +1 -1
  99. package/build/widgets/overlay/ContextMenu.js +2 -0
  100. package/build/widgets/overlay/Dropdown.d.ts +2 -1
  101. package/build/widgets/overlay/Dropdown.d.ts.map +1 -1
  102. package/build/widgets/overlay/Dropdown.js +75 -20
  103. package/build/widgets/overlay/MsgBox.d.ts +1 -0
  104. package/build/widgets/overlay/MsgBox.d.ts.map +1 -1
  105. package/build/widgets/overlay/MsgBox.js +2 -2
  106. package/build/widgets/overlay/Overlay.d.ts +32 -2
  107. package/build/widgets/overlay/Overlay.d.ts.map +1 -1
  108. package/build/widgets/overlay/Overlay.js +47 -16
  109. package/build/widgets/overlay/Toast.d.ts +1 -1
  110. package/build/widgets/overlay/Toast.d.ts.map +1 -1
  111. package/build/widgets/overlay/Toast.js +4 -1
  112. package/build/widgets/overlay/Tooltip.d.ts +6 -0
  113. package/build/widgets/overlay/Tooltip.d.ts.map +1 -1
  114. package/build/widgets/overlay/Tooltip.js +24 -9
  115. package/build/widgets/overlay/Window.d.ts.map +1 -1
  116. package/build/widgets/overlay/Window.js +24 -9
  117. package/dist/charts.css +325 -272
  118. package/dist/charts.js +11 -5
  119. package/dist/data.js +2 -2
  120. package/dist/manifest.js +892 -880
  121. package/dist/svg.css +14 -8
  122. package/dist/svg.js +9 -1
  123. package/dist/ui.js +29 -16
  124. package/dist/widgets.css +997 -294
  125. package/dist/widgets.js +317 -121
  126. package/package.json +1 -1
  127. package/src/charts/Bar.scss +13 -10
  128. package/src/charts/BarGraph.scss +31 -29
  129. package/src/charts/BubbleGraph.scss +11 -8
  130. package/src/charts/Chart.ts +5 -3
  131. package/src/charts/Column.scss +13 -10
  132. package/src/charts/ColumnBarBase.tsx +255 -230
  133. package/src/charts/ColumnGraph.scss +13 -11
  134. package/src/charts/Gridlines.scss +10 -8
  135. package/src/charts/Legend.scss +57 -50
  136. package/src/charts/Legend.tsx +257 -213
  137. package/src/charts/LegendEntry.scss +35 -29
  138. package/src/charts/LineGraph.scss +28 -25
  139. package/src/charts/Marker.scss +12 -10
  140. package/src/charts/Marker.tsx +3 -2
  141. package/src/charts/MarkerLine.scss +11 -8
  142. package/src/charts/MarkerLine.tsx +196 -177
  143. package/src/charts/PieChart.scss +12 -9
  144. package/src/charts/PieChart.tsx +717 -591
  145. package/src/charts/PieLabel.tsx +99 -81
  146. package/src/charts/Range.scss +11 -8
  147. package/src/charts/RangeMarker.tsx +204 -187
  148. package/src/charts/ScatterGraph.scss +12 -9
  149. package/src/charts/axis/Axis.scss +6 -5
  150. package/src/charts/axis/CategoryAxis.scss +10 -8
  151. package/src/charts/axis/NumericAxis.scss +9 -6
  152. package/src/charts/axis/TimeAxis.scss +9 -6
  153. package/src/charts/axis/TimeAxis.tsx +753 -637
  154. package/src/charts/axis/index.scss +4 -5
  155. package/src/charts/axis/variables.scss +4 -2
  156. package/src/charts/helpers/ValueAtFinder.ts +19 -5
  157. package/src/charts/index.scss +16 -19
  158. package/src/charts/maps.scss +0 -0
  159. package/src/charts/palette.scss +11 -31
  160. package/src/charts/palette.variables.scss +23 -0
  161. package/src/charts/variables.scss +35 -3
  162. package/src/data/StructuredSelector.ts +2 -2
  163. package/src/data/createAccessorModelProxy.ts +66 -74
  164. package/src/index.scss +5 -6
  165. package/src/maps.scss +5 -0
  166. package/src/svg/Ellipse.tsx +62 -55
  167. package/src/svg/Line.tsx +57 -42
  168. package/src/svg/Svg.scss +6 -6
  169. package/src/svg/Text.scss +19 -0
  170. package/src/svg/Text.tsx +172 -116
  171. package/src/svg/index.scss +3 -2
  172. package/src/svg/maps.scss +0 -0
  173. package/src/svg/variables.scss +0 -0
  174. package/src/ui/Container.spec.ts +59 -0
  175. package/src/ui/Controller.spec.tsx +30 -0
  176. package/src/ui/Controller.ts +5 -0
  177. package/src/ui/HoverSync.tsx +179 -147
  178. package/src/ui/Prop.ts +1 -1
  179. package/src/ui/Text.ts +12 -9
  180. package/src/ui/adapter/GroupAdapter.spec.ts +42 -0
  181. package/src/ui/adapter/GroupAdapter.ts +25 -14
  182. package/src/ui/app/History.ts +1 -1
  183. package/src/ui/index.scss +1 -1
  184. package/src/ui/layout/LabelsLeftLayout.scss +5 -7
  185. package/src/ui/layout/LabelsTopLayout.scss +4 -6
  186. package/src/ui/layout/index.scss +2 -3
  187. package/src/ui/maps.scss +0 -0
  188. package/src/ui/variables.scss +1 -2
  189. package/src/util/index.scss +4 -2
  190. package/src/util/maps.scss +1 -0
  191. package/src/util/scss/besm.scss +15 -0
  192. package/src/util/scss/calc.scss +103 -11
  193. package/src/util/scss/defaults.scss +24 -0
  194. package/src/util/scss/elements.scss +78 -0
  195. package/src/util/scss/global.scss +15 -0
  196. package/src/util/scss/include.scss +17 -9
  197. package/src/util/scss/index.scss +1 -9
  198. package/src/util/scss/maps.scss +2 -0
  199. package/src/util/scss/pad-size.scss +9 -0
  200. package/src/util/scss/padding.scss +6 -0
  201. package/src/util/scss/screen-size.scss +5 -0
  202. package/src/util/scss/variables.scss +6 -0
  203. package/src/util/variables.scss +1 -0
  204. package/src/variables.scss +5 -217
  205. package/src/widgets/Button.maps.scss +103 -0
  206. package/src/widgets/Button.scss +33 -9
  207. package/src/widgets/Button.variables.scss +8 -104
  208. package/src/widgets/CxCredit.scss +2 -0
  209. package/src/widgets/FlexBox.scss +16 -11
  210. package/src/widgets/Heading.scss +6 -0
  211. package/src/widgets/HighlightedSearchText.scss +8 -1
  212. package/src/widgets/Icon.scss +6 -0
  213. package/src/widgets/List.scss +7 -0
  214. package/src/widgets/List.tsx +6 -7
  215. package/src/widgets/ProgressBar.scss +9 -0
  216. package/src/widgets/Resizer.scss +9 -7
  217. package/src/widgets/Section.scss +53 -56
  218. package/src/widgets/animations.scss +4 -2
  219. package/src/widgets/box.scss +47 -0
  220. package/src/widgets/drag-drop/DragClone.scss +12 -4
  221. package/src/widgets/drag-drop/DragHandle.scss +12 -6
  222. package/src/widgets/drag-drop/DragSource.scss +12 -6
  223. package/src/widgets/drag-drop/DropZone.scss +9 -0
  224. package/src/widgets/drag-drop/DropZone.tsx +3 -3
  225. package/src/widgets/drag-drop/index.scss +4 -4
  226. package/src/widgets/drag-drop/maps.scss +7 -0
  227. package/src/widgets/drag-drop/variables.scss +8 -5
  228. package/src/widgets/form/Calendar.maps.scss +54 -0
  229. package/src/widgets/form/Calendar.scss +49 -11
  230. package/src/widgets/form/Calendar.tsx +755 -653
  231. package/src/widgets/form/Calendar.variables.scss +3 -46
  232. package/src/widgets/form/Checkbox.maps.scss +34 -0
  233. package/src/widgets/form/Checkbox.scss +14 -3
  234. package/src/widgets/form/Checkbox.variables.scss +4 -36
  235. package/src/widgets/form/ColorField.scss +21 -2
  236. package/src/widgets/form/ColorField.tsx +485 -431
  237. package/src/widgets/form/ColorPicker.maps.scss +21 -0
  238. package/src/widgets/form/ColorPicker.scss +26 -9
  239. package/src/widgets/form/ColorPicker.variables.scss +3 -16
  240. package/src/widgets/form/DateTimeField.scss +54 -21
  241. package/src/widgets/form/DateTimeField.tsx +697 -615
  242. package/src/widgets/form/DateTimePicker.scss +14 -4
  243. package/src/widgets/form/Field.maps.scss +122 -0
  244. package/src/widgets/form/Field.scss +54 -18
  245. package/src/widgets/form/Field.tsx +611 -504
  246. package/src/widgets/form/Field.variables.scss +46 -0
  247. package/src/widgets/form/HelpText.scss +8 -5
  248. package/src/widgets/form/Label.scss +10 -3
  249. package/src/widgets/form/LookupField.maps.scss +26 -0
  250. package/src/widgets/form/LookupField.scss +54 -24
  251. package/src/widgets/form/LookupField.tsx +25 -21
  252. package/src/widgets/form/MonthField.scss +48 -26
  253. package/src/widgets/form/MonthField.tsx +645 -567
  254. package/src/widgets/form/MonthPicker.maps.scss +50 -0
  255. package/src/widgets/form/MonthPicker.scss +44 -35
  256. package/src/widgets/form/MonthPicker.tsx +954 -724
  257. package/src/widgets/form/MonthPicker.variables.scss +24 -0
  258. package/src/widgets/form/NumberField.scss +19 -2
  259. package/src/widgets/form/NumberField.tsx +576 -466
  260. package/src/widgets/form/Radio.maps.scss +36 -0
  261. package/src/widgets/form/Radio.scss +12 -2
  262. package/src/widgets/form/Radio.variables.scss +3 -42
  263. package/src/widgets/form/Select.scss +25 -9
  264. package/src/widgets/form/Slider.scss +23 -14
  265. package/src/widgets/form/Switch.scss +18 -8
  266. package/src/widgets/form/TextArea.scss +14 -1
  267. package/src/widgets/form/TextField.scss +24 -3
  268. package/src/widgets/form/TextField.tsx +9 -21
  269. package/src/widgets/form/UploadButton.scss +14 -6
  270. package/src/widgets/form/ValidationError.scss +10 -6
  271. package/src/widgets/form/Wheel.scss +14 -4
  272. package/src/widgets/form/index.scss +22 -24
  273. package/src/widgets/form/maps.scss +81 -0
  274. package/src/widgets/form/variables.scss +111 -355
  275. package/src/widgets/grid/Grid.scss +19 -2
  276. package/src/widgets/grid/Grid.spec.ts +42 -0
  277. package/src/widgets/grid/Grid.tsx +15 -7
  278. package/src/widgets/grid/Pagination.scss +11 -2
  279. package/src/widgets/grid/Pagination.tsx +110 -102
  280. package/src/widgets/grid/TreeNode.scss +25 -8
  281. package/src/widgets/grid/TreeNode.tsx +127 -116
  282. package/src/widgets/grid/index.scss +3 -4
  283. package/src/widgets/grid/maps.scss +110 -0
  284. package/src/widgets/grid/variables.scss +48 -137
  285. package/src/widgets/icons/folder.tsx +1 -2
  286. package/src/widgets/icons/forward.tsx +23 -20
  287. package/src/widgets/icons/loading.tsx +22 -19
  288. package/src/widgets/icons/square.tsx +20 -17
  289. package/src/widgets/index.scss +16 -16
  290. package/src/widgets/index.ts +63 -58
  291. package/src/widgets/lists.scss +42 -0
  292. package/src/widgets/maps.scss +139 -0
  293. package/src/widgets/nav/Link.scss +14 -1
  294. package/src/widgets/nav/Menu.scss +13 -7
  295. package/src/widgets/nav/Menu.variables.scss +1 -12
  296. package/src/widgets/nav/MenuItem.scss +21 -6
  297. package/src/widgets/nav/Scroller.scss +11 -2
  298. package/src/widgets/nav/Tab.maps.scss +78 -0
  299. package/src/widgets/nav/Tab.scss +12 -6
  300. package/src/widgets/nav/Tab.variables.scss +7 -76
  301. package/src/widgets/nav/cover.scss +6 -4
  302. package/src/widgets/nav/index.scss +6 -6
  303. package/src/widgets/nav/maps.scss +32 -0
  304. package/src/widgets/nav/variables.scss +4 -11
  305. package/src/widgets/overlay/ContextMenu.ts +3 -0
  306. package/src/widgets/overlay/Dropdown.scss +47 -16
  307. package/src/widgets/overlay/Dropdown.tsx +851 -676
  308. package/src/widgets/overlay/MsgBox.tsx +125 -111
  309. package/src/widgets/overlay/Overlay.scss +60 -40
  310. package/src/widgets/overlay/Overlay.tsx +948 -800
  311. package/src/widgets/overlay/Toast.scss +42 -34
  312. package/src/widgets/overlay/Toast.ts +11 -1
  313. package/src/widgets/overlay/Tooltip.scss +27 -96
  314. package/src/widgets/overlay/Tooltip.tsx +376 -309
  315. package/src/widgets/overlay/Window.maps.scss +51 -0
  316. package/src/widgets/overlay/Window.scss +17 -17
  317. package/src/widgets/overlay/Window.tsx +291 -236
  318. package/src/widgets/overlay/Window.variables.scss +2 -43
  319. package/src/widgets/overlay/index.d.ts +11 -11
  320. package/src/widgets/overlay/index.scss +6 -15
  321. package/src/widgets/overlay/maps.scss +44 -0
  322. package/src/widgets/overlay/variables.scss +11 -42
  323. package/src/widgets/variables.scss +33 -117
  324. package/src/global.scss +0 -14
@@ -1,104 +1,122 @@
1
1
  /** @jsxImportSource react */
2
2
 
3
3
  import { VDOM } from "../ui/Widget";
4
- import { BoundedObject, BoundedObjectConfig, BoundedObjectInstance } from "../svg/BoundedObject";
4
+ import {
5
+ BoundedObject,
6
+ BoundedObjectConfig,
7
+ BoundedObjectInstance,
8
+ } from "../svg/BoundedObject";
5
9
  import { Rect } from "../svg/util/Rect";
6
10
  import { parseStyle } from "../util/parseStyle";
7
11
  import { RenderingContext } from "../ui/RenderingContext";
8
12
  import { NumberProp, StringProp, StyleProp } from "../ui/Prop";
9
13
 
10
14
  export interface PieLabelConfig extends BoundedObjectConfig {
11
- /** Distance from the pie center. Default is `100`. */
12
- distance?: NumberProp;
15
+ /** Distance from the pie center. Default is `100`. */
16
+ distance?: NumberProp;
13
17
 
14
- /** Style for the connecting line. */
15
- lineStyle?: StyleProp;
18
+ /** Style for the connecting line. */
19
+ lineStyle?: StyleProp;
16
20
 
17
- /** Stroke color for the connecting line. */
18
- lineStroke?: StringProp;
21
+ /** Stroke color for the connecting line. */
22
+ lineStroke?: StringProp;
19
23
 
20
- /** CSS class for the connecting line. */
21
- lineClass?: StringProp;
24
+ /** CSS class for the connecting line. */
25
+ lineClass?: StringProp;
22
26
 
23
- /** Color index for the connecting line. */
24
- lineColorIndex?: NumberProp;
27
+ /** Color index for the connecting line. */
28
+ lineColorIndex?: NumberProp;
25
29
  }
26
30
 
27
31
  export interface PieLabelInstance extends BoundedObjectInstance {
28
- originalBounds: Rect;
29
- actualBounds: Rect;
30
- parentRect: Rect;
32
+ originalBounds: Rect;
33
+ actualBounds: Rect;
34
+ parentRect: Rect;
31
35
  }
32
36
 
33
37
  export class PieLabel extends BoundedObject {
34
- declare baseClass: string;
35
- declare distance: number;
36
- declare lineStyle: any;
37
-
38
- constructor(config: PieLabelConfig) {
39
- super(config);
40
- }
41
-
42
- init(): void {
43
- this.lineStyle = parseStyle(this.lineStyle);
44
- super.init();
45
- }
46
-
47
- declareData(...args: any[]): void {
48
- super.declareData(...args, {
49
- distance: undefined,
50
- lineStyle: { structured: true },
51
- lineStroke: undefined,
52
- lineClass: { structured: true },
53
- lineColorIndex: undefined,
54
- });
55
- }
56
-
57
- calculateBounds(context: RenderingContext, instance: PieLabelInstance): Rect {
58
- var { data } = instance;
59
- var bounds = Rect.add(Rect.add(Rect.multiply(instance.parentRect, data.anchors), data.offset), data.margin);
60
- instance.originalBounds = bounds;
61
- instance.actualBounds = context.placePieLabel(bounds, data.distance);
62
- return new Rect({ t: 0, r: bounds.width(), b: bounds.height(), l: 0 });
63
- }
64
-
65
- prepare(context: RenderingContext, instance: PieLabelInstance): void {
66
- super.prepare(context, instance);
67
- if (!context.registerPieLabel)
68
- throw new Error("PieLabel components are allowed only within PieLabelsContainer components.");
69
- let right = instance.parentRect.r > instance.parentRect.l;
70
- context.push("textDirection", right ? "right" : "left");
71
- context.registerPieLabel(instance);
72
- }
73
-
74
- prepareCleanup(context: RenderingContext, instance: PieLabelInstance): void {
75
- context.pop("textDirection");
76
- }
77
-
78
- render(context: RenderingContext, instance: PieLabelInstance, key: string): React.ReactNode {
79
- let { originalBounds, actualBounds, data } = instance;
80
-
81
- return (
82
- <g key={key} className={data.classNames}>
83
- <line
84
- className={this.CSS.element(
85
- this.baseClass,
86
- "line",
87
- data.lineColorIndex != null && "color-" + data.lineColorIndex,
88
- )}
89
- x1={actualBounds.l < originalBounds.l ? actualBounds.r : actualBounds.l}
90
- y1={(actualBounds.t + actualBounds.b) / 2}
91
- x2={(originalBounds.l + originalBounds.r) / 2}
92
- y2={(originalBounds.t + originalBounds.b) / 2}
93
- stroke={data.lineStroke}
94
- style={data.lineStyle}
95
- />
96
- <g transform={`translate(${instance.actualBounds.l} ${instance.actualBounds.t})`}>
97
- {this.renderChildren(context, instance)}
98
- </g>
99
- </g>
38
+ declare baseClass: string;
39
+ declare distance: number;
40
+ declare lineStyle: any;
41
+
42
+ constructor(config: PieLabelConfig) {
43
+ super(config);
44
+ }
45
+
46
+ init(): void {
47
+ this.lineStyle = parseStyle(this.lineStyle);
48
+ super.init();
49
+ }
50
+
51
+ declareData(...args: any[]): void {
52
+ super.declareData(...args, {
53
+ distance: undefined,
54
+ lineStyle: { structured: true },
55
+ lineStroke: undefined,
56
+ lineClass: { structured: true },
57
+ lineColorIndex: undefined,
58
+ });
59
+ }
60
+
61
+ calculateBounds(context: RenderingContext, instance: PieLabelInstance): Rect {
62
+ var { data } = instance;
63
+ var bounds = Rect.add(
64
+ Rect.add(Rect.multiply(instance.parentRect, data.anchors), data.offset),
65
+ data.margin,
66
+ );
67
+ instance.originalBounds = bounds;
68
+ instance.actualBounds = context.placePieLabel(bounds, data.distance);
69
+ return new Rect({ t: 0, r: bounds.width(), b: bounds.height(), l: 0 });
70
+ }
71
+
72
+ prepare(context: RenderingContext, instance: PieLabelInstance): void {
73
+ super.prepare(context, instance);
74
+ if (!context.registerPieLabel)
75
+ throw new Error(
76
+ "PieLabel components are allowed only within PieLabelsContainer components.",
100
77
  );
101
- }
78
+ let right = instance.parentRect.r > instance.parentRect.l;
79
+ context.push("textDirection", right ? "right" : "left");
80
+ context.registerPieLabel(instance);
81
+ }
82
+
83
+ prepareCleanup(context: RenderingContext, instance: PieLabelInstance): void {
84
+ context.pop("textDirection");
85
+ super.prepareCleanup(context, instance);
86
+ }
87
+
88
+ render(
89
+ context: RenderingContext,
90
+ instance: PieLabelInstance,
91
+ key: string,
92
+ ): React.ReactNode {
93
+ let { originalBounds, actualBounds, data } = instance;
94
+
95
+ return (
96
+ <g key={key} className={data.classNames}>
97
+ <line
98
+ className={this.CSS.element(
99
+ this.baseClass,
100
+ "line",
101
+ data.lineColorIndex != null && "color-" + data.lineColorIndex,
102
+ )}
103
+ x1={
104
+ actualBounds.l < originalBounds.l ? actualBounds.r : actualBounds.l
105
+ }
106
+ y1={(actualBounds.t + actualBounds.b) / 2}
107
+ x2={(originalBounds.l + originalBounds.r) / 2}
108
+ y2={(originalBounds.t + originalBounds.b) / 2}
109
+ stroke={data.lineStroke}
110
+ style={data.lineStyle}
111
+ />
112
+ <g
113
+ transform={`translate(${instance.actualBounds.l} ${instance.actualBounds.t})`}
114
+ >
115
+ {this.renderChildren(context, instance)}
116
+ </g>
117
+ </g>
118
+ );
119
+ }
102
120
  }
103
121
 
104
122
  PieLabel.prototype.distance = 100;
@@ -1,20 +1,23 @@
1
1
  @use "sass:map";
2
+ @use "sass:math";
3
+ @use "../util/scss/besm.scss" as *;
4
+ @use "../util/scss/include.scss" as *;
5
+ @use "../util/scss/add-rules.scss" as *;
6
+ @use "../util/scss/clockwise.scss" as *;
7
+ @use "./variables" as *;
2
8
 
3
- @mixin cx-range(
4
- $name: 'range',
5
- $besm: $cx-besm
6
- ) {
9
+ @mixin cx-range($name: "range", $besm: $cx-besm) {
7
10
  $block: map.get($besm, block);
8
11
  $element: map.get($besm, element);
9
12
  $state: map.get($besm, state);
10
13
 
11
14
  .#{$element}#{$name}-rect {
12
15
  stroke-width: 0;
13
- fill-opacity: 0.3;
14
- fill: lightgray;
16
+ fill-opacity: $cx-default-chart-range-opacity;
17
+ fill: $cx-default-chart-range-fill-color;
15
18
  }
16
19
  }
17
20
 
18
- @if (cx-should-include('cx/charts/Range')) {
21
+ @if (cx-should-include("cx/charts/Range")) {
19
22
  @include cx-range();
20
- }
23
+ }
@@ -1,221 +1,238 @@
1
1
  /** @jsxImportSource react */
2
2
 
3
- import { BoundedObject, BoundedObjectConfig, BoundedObjectInstance } from "../svg/BoundedObject";
3
+ import {
4
+ BoundedObject,
5
+ BoundedObjectConfig,
6
+ BoundedObjectInstance,
7
+ } from "../svg/BoundedObject";
4
8
  import { Rect } from "../svg/util/Rect";
5
9
  import { Widget, VDOM } from "../ui/Widget";
6
10
  import { parseStyle } from "../util/parseStyle";
7
11
  import { RenderingContext } from "../ui/RenderingContext";
8
- import { NumberProp, BooleanProp, StringProp, StyleProp } from "../ui/Prop";
12
+ import {
13
+ NumberProp,
14
+ BooleanProp,
15
+ StringProp,
16
+ StyleProp,
17
+ Prop,
18
+ } from "../ui/Prop";
9
19
  import type { ChartRenderingContext } from "./Chart";
10
20
 
11
21
  export interface RangeMarkerConfig extends BoundedObjectConfig {
12
- /** The `x` value binding or expression. */
13
- x?: NumberProp;
22
+ /** The `x` value binding or expression. */
23
+ x?: Prop<number | string | null>;
14
24
 
15
- /** The `y` value binding or expression. */
16
- y?: NumberProp;
25
+ /** The `y` value binding or expression. */
26
+ y?: Prop<number | string | null>;
17
27
 
18
- /** The shape of marker, Could be `min`, `max`, `line`. Default to `line`. */
19
- shape?: StringProp;
28
+ /** The shape of marker, Could be `min`, `max`, `line`. Default to `line`. */
29
+ shape?: StringProp;
20
30
 
21
- /** Switch to vertical mode. */
22
- vertical?: BooleanProp;
31
+ /** Switch to vertical mode. */
32
+ vertical?: BooleanProp;
23
33
 
24
- /** Size of the range marker. */
25
- size?: NumberProp;
34
+ /** Size of the range marker. */
35
+ size?: NumberProp;
26
36
 
27
- /** The laneOffset property adjusts the positioning of lane elements, enhancing their alignment and readability. */
28
- laneOffset?: NumberProp;
37
+ /** The laneOffset property adjusts the positioning of lane elements, enhancing their alignment and readability. */
38
+ laneOffset?: NumberProp;
29
39
 
30
- /** Style object applied to the range marker. */
31
- lineStyle?: StyleProp;
40
+ /** Style object applied to the range marker. */
41
+ lineStyle?: StyleProp;
32
42
 
33
- /** Class object applied to the range marker. */
34
- lineClass?: StringProp;
43
+ /** Class object applied to the range marker. */
44
+ lineClass?: StringProp;
35
45
 
36
- /** Size of vertical or horizontal caps. */
37
- capSize?: NumberProp;
46
+ /** Size of vertical or horizontal caps. */
47
+ capSize?: NumberProp;
38
48
 
39
- /** Inflate the range marker. */
40
- inflate?: NumberProp;
49
+ /** Inflate the range marker. */
50
+ inflate?: NumberProp;
41
51
 
42
- /** Set to `true` to allow the range marker to affect axis bounds. */
43
- affectsAxes?: boolean;
52
+ /** Set to `true` to allow the range marker to affect axis bounds. */
53
+ affectsAxes?: boolean;
44
54
 
45
- /**
46
- * Name of the horizontal axis. The value should match one of the horizontal axes set
47
- * in the `axes` configuration of the parent `Chart` component. Default value is `x`.
48
- */
49
- xAxis?: string;
55
+ /**
56
+ * Name of the horizontal axis. The value should match one of the horizontal axes set
57
+ * in the `axes` configuration of the parent `Chart` component. Default value is `x`.
58
+ */
59
+ xAxis?: string;
50
60
 
51
- /**
52
- * Name of the vertical axis. The value should match one of the vertical axes set
53
- * in the `axes` configuration if the parent `Chart` component. Default value is `y`.
54
- */
55
- yAxis?: string;
61
+ /**
62
+ * Name of the vertical axis. The value should match one of the vertical axes set
63
+ * in the `axes` configuration if the parent `Chart` component. Default value is `y`.
64
+ */
65
+ yAxis?: string;
56
66
  }
57
67
 
58
68
  export interface RangeMarkerInstance extends BoundedObjectInstance {
59
- axes: Record<string, any>;
60
- xAxis: any;
61
- yAxis: any;
69
+ axes: Record<string, any>;
70
+ xAxis: any;
71
+ yAxis: any;
62
72
  }
63
73
 
64
74
  export class RangeMarker extends BoundedObject {
65
- declare baseClass: string;
66
- declare xAxis: string;
67
- declare yAxis: string;
68
- declare shape: string;
69
- declare vertical: boolean;
70
- declare size: number;
71
- declare laneOffset: number;
72
- declare capSize: number;
73
- declare inflate: number;
74
- declare affectsAxes: boolean;
75
- declare lineStyle: any;
76
-
77
- constructor(config: RangeMarkerConfig) {
78
- super(config);
79
- }
80
-
81
- declareData(...args: any[]): void {
82
- super.declareData(...args, {
83
- x: undefined,
84
- y: undefined,
85
- shape: undefined,
86
- vertical: undefined,
87
- size: undefined,
88
- laneOffset: undefined,
89
- lineStyle: { structured: true },
90
- lineClass: { structured: true },
91
- capSize: undefined,
92
- inflate: undefined,
93
- });
94
- }
95
-
96
- init(): void {
97
- this.lineStyle = parseStyle(this.lineStyle);
98
- super.init();
99
- }
100
-
101
- prepareData(context: RenderingContext, instance: RangeMarkerInstance): void {
102
- instance.axes = context.axes;
103
- instance.xAxis = context.axes[this.xAxis];
104
- instance.yAxis = context.axes[this.yAxis];
105
- super.prepareData(context, instance);
106
- }
107
-
108
- explore(context: RenderingContext, instance: RangeMarkerInstance): void {
109
- let { data, xAxis, yAxis } = instance;
110
-
111
- if (this.affectsAxes) {
112
- if (xAxis && data.x != null) xAxis.acknowledge(data.x, 0, 0);
113
- if (yAxis && data.y != null) yAxis.acknowledge(data.y, 0, 0);
75
+ declare baseClass: string;
76
+ declare xAxis: string;
77
+ declare yAxis: string;
78
+ declare shape: string;
79
+ declare vertical: boolean;
80
+ declare size: number;
81
+ declare laneOffset: number;
82
+ declare capSize: number;
83
+ declare inflate: number;
84
+ declare affectsAxes: boolean;
85
+ declare lineStyle: any;
86
+
87
+ constructor(config: RangeMarkerConfig) {
88
+ super(config);
89
+ }
90
+
91
+ declareData(...args: any[]): void {
92
+ super.declareData(...args, {
93
+ x: undefined,
94
+ y: undefined,
95
+ shape: undefined,
96
+ vertical: undefined,
97
+ size: undefined,
98
+ laneOffset: undefined,
99
+ lineStyle: { structured: true },
100
+ lineClass: { structured: true },
101
+ capSize: undefined,
102
+ inflate: undefined,
103
+ });
104
+ }
105
+
106
+ init(): void {
107
+ this.lineStyle = parseStyle(this.lineStyle);
108
+ super.init();
109
+ }
110
+
111
+ prepareData(context: RenderingContext, instance: RangeMarkerInstance): void {
112
+ instance.axes = context.axes;
113
+ instance.xAxis = context.axes[this.xAxis];
114
+ instance.yAxis = context.axes[this.yAxis];
115
+ super.prepareData(context, instance);
116
+ }
117
+
118
+ explore(context: RenderingContext, instance: RangeMarkerInstance): void {
119
+ let { data, xAxis, yAxis } = instance;
120
+
121
+ if (this.affectsAxes) {
122
+ if (xAxis && data.x != null) xAxis.acknowledge(data.x, 0, 0);
123
+ if (yAxis && data.y != null) yAxis.acknowledge(data.y, 0, 0);
124
+ }
125
+
126
+ super.explore(context, instance);
127
+ }
128
+
129
+ calculateBounds(
130
+ context: RenderingContext,
131
+ instance: RangeMarkerInstance,
132
+ ): Rect {
133
+ let { data, xAxis, yAxis } = instance;
134
+
135
+ let l: number, r: number, t: number, b: number;
136
+
137
+ if (data.x == null || data.y == null) {
138
+ return super.calculateBounds(context, instance);
139
+ }
140
+
141
+ if (!this.vertical) {
142
+ l = xAxis.map(data.x, data.laneOffset - data.size / 2) - data.inflate;
143
+ r = xAxis.map(data.x, data.laneOffset + data.size / 2) + data.inflate;
144
+ t = b = yAxis.map(data.y);
145
+ if (data.shape == "max") {
146
+ b += data.capSize;
147
+ } else if (data.shape == "min") {
148
+ t -= data.capSize;
114
149
  }
115
-
116
- super.explore(context, instance);
117
- }
118
-
119
- calculateBounds(context: RenderingContext, instance: RangeMarkerInstance): Rect {
120
- let { data, xAxis, yAxis } = instance;
121
-
122
- let l: number, r: number, t: number, b: number;
123
-
124
- if (data.x == null || data.y == null) {
125
- return super.calculateBounds(context, instance);
150
+ } else {
151
+ l = r = xAxis.map(data.x);
152
+ t = yAxis.map(data.y, data.laneOffset - data.size / 2) + data.inflate;
153
+ b = yAxis.map(data.y, data.laneOffset + data.size / 2) - data.inflate;
154
+ if (data.shape == "max") {
155
+ l -= data.capSize;
156
+ } else if (data.shape == "min") {
157
+ r += data.capSize;
126
158
  }
127
-
128
- if (!this.vertical) {
129
- l = xAxis.map(data.x, data.laneOffset - data.size / 2) - data.inflate;
130
- r = xAxis.map(data.x, data.laneOffset + data.size / 2) + data.inflate;
131
- t = b = yAxis.map(data.y);
132
- if (data.shape == "max") {
133
- b += data.capSize;
134
- } else if (data.shape == "min") {
135
- t -= data.capSize;
136
- }
137
- } else {
138
- l = r = xAxis.map(data.x);
139
- t = yAxis.map(data.y, data.laneOffset - data.size / 2) + data.inflate;
140
- b = yAxis.map(data.y, data.laneOffset + data.size / 2) - data.inflate;
141
- if (data.shape == "max") {
142
- l -= data.capSize;
143
- } else if (data.shape == "min") {
144
- r += data.capSize;
145
- }
159
+ }
160
+
161
+ return new Rect({
162
+ l,
163
+ r,
164
+ t,
165
+ b,
166
+ });
167
+ }
168
+
169
+ prepare(context: RenderingContext, instance: RangeMarkerInstance): void {
170
+ super.prepare(context, instance);
171
+ }
172
+
173
+ render(
174
+ context: RenderingContext,
175
+ instance: RangeMarkerInstance,
176
+ key: string,
177
+ ): React.ReactNode {
178
+ var { data } = instance;
179
+ let { CSS, baseClass } = this;
180
+ let { bounds, shape } = data;
181
+
182
+ let path = "";
183
+ if (this.vertical) {
184
+ switch (shape) {
185
+ default:
186
+ case "line":
187
+ path += `M ${bounds.r} ${bounds.t} `;
188
+ path += `L ${bounds.r} ${bounds.b}`;
189
+ break;
190
+ case "max":
191
+ path += `M ${bounds.l} ${bounds.t} `;
192
+ path += `L ${bounds.r} ${bounds.t}`;
193
+ path += `L ${bounds.r} ${bounds.b}`;
194
+ path += `L ${bounds.l} ${bounds.b}`;
195
+ break;
196
+ case "min":
197
+ path += `M ${bounds.r} ${bounds.t} `;
198
+ path += `L ${bounds.l} ${bounds.t}`;
199
+ path += `L ${bounds.l} ${bounds.b}`;
200
+ path += `L ${bounds.r} ${bounds.b}`;
201
+ break;
146
202
  }
147
-
148
- return new Rect({
149
- l,
150
- r,
151
- t,
152
- b,
153
- });
154
- }
155
-
156
- prepare(context: RenderingContext, instance: RangeMarkerInstance): void {
157
- super.prepare(context, instance);
158
- }
159
-
160
- render(context: RenderingContext, instance: RangeMarkerInstance, key: string): React.ReactNode {
161
- var { data } = instance;
162
- let { CSS, baseClass } = this;
163
- let { bounds, shape } = data;
164
-
165
- let path = "";
166
- if (this.vertical) {
167
- switch (shape) {
168
- default:
169
- case "line":
170
- path += `M ${bounds.r} ${bounds.t} `;
171
- path += `L ${bounds.r} ${bounds.b}`;
172
- break;
173
- case "max":
174
- path += `M ${bounds.l} ${bounds.t} `;
175
- path += `L ${bounds.r} ${bounds.t}`;
176
- path += `L ${bounds.r} ${bounds.b}`;
177
- path += `L ${bounds.l} ${bounds.b}`;
178
- break;
179
- case "min":
180
- path += `M ${bounds.r} ${bounds.t} `;
181
- path += `L ${bounds.l} ${bounds.t}`;
182
- path += `L ${bounds.l} ${bounds.b}`;
183
- path += `L ${bounds.r} ${bounds.b}`;
184
- break;
185
- }
186
- } else {
187
- switch (shape) {
188
- default:
189
- case "line":
190
- path += `M ${bounds.r} ${bounds.t} `;
191
- path += `L ${bounds.l} ${bounds.t}`;
192
- break;
193
- case "max":
194
- path += `M ${bounds.l} ${bounds.b} `;
195
- path += `L ${bounds.l} ${bounds.t}`;
196
- path += `L ${bounds.r} ${bounds.t}`;
197
- path += `L ${bounds.r} ${bounds.b}`;
198
- break;
199
- case "min":
200
- path += `M ${bounds.l} ${bounds.t} `;
201
- path += `L ${bounds.l} ${bounds.b}`;
202
- path += `L ${bounds.r} ${bounds.b}`;
203
- path += `L ${bounds.r} ${bounds.t}`;
204
- break;
205
- }
203
+ } else {
204
+ switch (shape) {
205
+ default:
206
+ case "line":
207
+ path += `M ${bounds.r} ${bounds.t} `;
208
+ path += `L ${bounds.l} ${bounds.t}`;
209
+ break;
210
+ case "max":
211
+ path += `M ${bounds.l} ${bounds.b} `;
212
+ path += `L ${bounds.l} ${bounds.t}`;
213
+ path += `L ${bounds.r} ${bounds.t}`;
214
+ path += `L ${bounds.r} ${bounds.b}`;
215
+ break;
216
+ case "min":
217
+ path += `M ${bounds.l} ${bounds.t} `;
218
+ path += `L ${bounds.l} ${bounds.b}`;
219
+ path += `L ${bounds.r} ${bounds.b}`;
220
+ path += `L ${bounds.r} ${bounds.t}`;
221
+ break;
206
222
  }
207
-
208
- return (
209
- <g key={key} className={data.classNames} style={data.style}>
210
- <path
211
- d={path}
212
- className={CSS.expand(CSS.element(baseClass, "path"), data.lineClass)}
213
- style={data.lineStyle}
214
- />
215
- {this.renderChildren(context, instance)}
216
- </g>
217
- );
218
- }
223
+ }
224
+
225
+ return (
226
+ <g key={key} className={data.classNames} style={data.style}>
227
+ <path
228
+ d={path}
229
+ className={CSS.expand(CSS.element(baseClass, "path"), data.lineClass)}
230
+ style={data.lineStyle}
231
+ />
232
+ {this.renderChildren(context, instance)}
233
+ </g>
234
+ );
235
+ }
219
236
  }
220
237
 
221
238
  RangeMarker.prototype.baseClass = "rangemarker";