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
@@ -19,170 +19,202 @@ import { Prop, StyleProp, ClassProp } from "./Prop";
19
19
  export interface HoverSyncConfig extends PureContainerConfig {}
20
20
 
21
21
  export class HoverSync extends PureContainerBase<HoverSyncConfig, Instance> {
22
- constructor(config?: HoverSyncConfig) {
23
- super(config);
24
- }
25
- initInstance(context: any, instance: any) {
26
- let channels: any = {};
27
- instance.hoverSync = {
28
- report: (channel: string, hoverId: any, active: boolean) => {
29
- let ch = channels[channel];
30
- if (!ch) return;
31
- let state = active && hoverId != null;
32
- if (ch.state !== state && (ch.state === hoverId || active)) {
33
- ch.state = state;
34
- ch.subscribers.notify(state);
35
- }
36
- },
37
- subscribe: (channel: string, callback: (state: any) => void) => {
38
- let ch = channels[channel];
39
- if (!ch)
40
- ch = channels[channel] = {
41
- subscribers: new SubscriberList(),
42
- state: false,
43
- };
44
- return ch.subscribers.subscribe(callback);
45
- },
46
- };
47
- }
48
-
49
- explore(context: any, instance: any) {
50
- context.push("hoverSync", instance.hoverSync);
51
- super.explore(context, instance);
52
- }
53
-
54
- exploreCleanup(context: any, instance: any) {
55
- context.pop("hoverSync");
56
- }
22
+ constructor(config?: HoverSyncConfig) {
23
+ super(config);
24
+ }
25
+ initInstance(context: any, instance: any) {
26
+ let channels: any = {};
27
+ instance.hoverSync = {
28
+ report: (channel: string, hoverId: any, active: boolean) => {
29
+ let ch = channels[channel];
30
+ if (!ch) return;
31
+ let state = active && hoverId != null ? hoverId : false;
32
+ if (ch.state !== state && (ch.state === hoverId || active)) {
33
+ ch.state = state;
34
+ ch.subscribers.notify(state);
35
+ }
36
+ },
37
+ subscribe: (channel: string, callback: (state: any) => void) => {
38
+ let ch = channels[channel];
39
+ if (!ch)
40
+ ch = channels[channel] = {
41
+ subscribers: new SubscriberList(),
42
+ state: false,
43
+ };
44
+ return ch.subscribers.subscribe(callback);
45
+ },
46
+ };
47
+ }
48
+
49
+ explore(context: any, instance: any) {
50
+ context.push("hoverSync", instance.hoverSync);
51
+ super.explore(context, instance);
52
+ }
53
+
54
+ exploreCleanup(context: any, instance: any) {
55
+ context.pop("hoverSync");
56
+ }
57
57
  }
58
58
 
59
59
  interface HoverSyncChildProps {
60
- hoverSync: any;
61
- hoverChannel: string;
62
- hoverId: any;
63
- render: (props: any) => any;
60
+ hoverSync: any;
61
+ hoverChannel: string;
62
+ hoverId: any;
63
+ render: (props: any) => any;
64
64
  }
65
65
 
66
66
  interface HoverSyncChildState {
67
- hover: boolean;
67
+ hover: boolean;
68
68
  }
69
69
 
70
- class HoverSyncChild extends VDOM.Component<HoverSyncChildProps, HoverSyncChildState> {
71
- declare unsubscribe: any;
72
-
73
- constructor(props: HoverSyncChildProps) {
74
- super(props);
75
- this.state = { hover: false };
76
- this.onMouseMove = this.onMouseMove.bind(this);
77
- this.onMouseLeave = this.onMouseLeave.bind(this);
78
- }
79
-
80
- onMouseMove() {
81
- this.props.hoverSync.report(this.props.hoverChannel, this.props.hoverId, true);
82
- }
83
-
84
- onMouseLeave() {
85
- this.props.hoverSync.report(this.props.hoverChannel, this.props.hoverId, false);
86
- }
87
-
88
- componentWillUnmount() {
89
- this.unsubscribe();
90
- }
91
-
92
- componentDidMount() {
93
- this.unsubscribe = this.props.hoverSync.subscribe(this.props.hoverChannel, (hoverId: any) => {
94
- let hover = hoverId === this.props.hoverId;
95
- if (hover !== this.state.hover) this.setState({ hover });
96
- });
97
- }
98
-
99
- render() {
100
- return this.props.render({
101
- hover: this.state.hover,
102
- onMouseLeave: this.onMouseLeave,
103
- onMouseMove: this.onMouseMove,
104
- key: "child",
105
- });
106
- }
70
+ class HoverSyncChild extends VDOM.Component<
71
+ HoverSyncChildProps,
72
+ HoverSyncChildState
73
+ > {
74
+ declare unsubscribe: any;
75
+
76
+ constructor(props: HoverSyncChildProps) {
77
+ super(props);
78
+ this.state = { hover: false };
79
+ this.onMouseMove = this.onMouseMove.bind(this);
80
+ this.onMouseLeave = this.onMouseLeave.bind(this);
81
+ }
82
+
83
+ onMouseMove() {
84
+ this.props.hoverSync.report(
85
+ this.props.hoverChannel,
86
+ this.props.hoverId,
87
+ true,
88
+ );
89
+ }
90
+
91
+ onMouseLeave() {
92
+ this.props.hoverSync.report(
93
+ this.props.hoverChannel,
94
+ this.props.hoverId,
95
+ false,
96
+ );
97
+ }
98
+
99
+ componentWillUnmount() {
100
+ this.unsubscribe();
101
+ }
102
+
103
+ componentDidMount() {
104
+ this.unsubscribe = this.props.hoverSync.subscribe(
105
+ this.props.hoverChannel,
106
+ (hoverId: any) => {
107
+ let hover = hoverId === this.props.hoverId;
108
+ if (hover !== this.state.hover) this.setState({ hover });
109
+ },
110
+ );
111
+ }
112
+
113
+ render() {
114
+ return this.props.render({
115
+ hover: this.state.hover,
116
+ onMouseLeave: this.onMouseLeave,
117
+ onMouseMove: this.onMouseMove,
118
+ key: "child",
119
+ });
120
+ }
107
121
  }
108
122
 
109
123
  export function withHoverSync(
110
- key: string | number,
111
- hoverSync: any,
112
- hoverChannel: string | undefined,
113
- hoverId: any,
114
- render: (props: any) => any,
124
+ key: string | number,
125
+ hoverSync: any,
126
+ hoverChannel: string | undefined,
127
+ hoverId: any,
128
+ render: (props: any) => any,
115
129
  ) {
116
- if (!hoverSync || !hoverChannel || hoverId == null)
117
- return render({ key, hover: false, onMouseLeave: dummyCallback, onMouseMove: dummyCallback });
118
- return (
119
- <HoverSyncChild key={key} hoverSync={hoverSync} hoverChannel={hoverChannel} hoverId={hoverId} render={render} />
120
- );
130
+ if (!hoverSync || !hoverChannel || hoverId == null)
131
+ return render({
132
+ key,
133
+ hover: false,
134
+ onMouseLeave: dummyCallback,
135
+ onMouseMove: dummyCallback,
136
+ });
137
+ return (
138
+ <HoverSyncChild
139
+ key={key}
140
+ hoverSync={hoverSync}
141
+ hoverChannel={hoverChannel}
142
+ hoverId={hoverId}
143
+ render={render}
144
+ />
145
+ );
121
146
  }
122
147
 
123
148
  export interface HoverSyncElementConfig extends StyledContainerConfig {
124
- hoverChannel?: string;
125
- hoverId?: Prop<any>;
126
- hoverClass?: ClassProp;
127
- hoverStyle?: StyleProp;
149
+ hoverChannel?: string;
150
+ hoverId?: Prop<any>;
151
+ hoverClass?: ClassProp;
152
+ hoverStyle?: StyleProp;
128
153
  }
129
154
 
130
- export class HoverSyncElement extends StyledContainerBase<HoverSyncElementConfig, Instance> {
131
- declare hoverChannel: string;
132
- declare hoverId?: Prop<any>;
133
- declare hoverClass?: ClassProp;
134
- declare hoverStyle?: StyleProp;
135
-
136
- constructor(config?: HoverSyncElementConfig) {
137
- super(config);
138
- }
139
-
140
- declareData(...args: any[]) {
141
- super.declareData(...args, {
142
- hoverId: undefined,
143
- hoverClass: { structured: true },
144
- hoverStyle: { structured: true },
145
- });
146
- }
147
-
148
- prepareData(context: any, instance: any) {
149
- instance.hoverSync = context.hoverSync;
150
- instance.inSvg = !!context.inSvg;
151
- let { data } = instance;
152
- data.hoverStyle = parseStyle(data.hoverStyle);
153
- super.prepareData(context, instance);
154
- }
155
-
156
- render(context: any, instance: any, key: string) {
157
- let { data, inSvg } = instance;
158
- let { CSS } = this;
159
- let children = this.renderChildren(context, instance);
160
- let eventHandlers = instance.getJsxEventProps();
161
- return withHoverSync(
162
- key,
163
- instance.hoverSync,
164
- this.hoverChannel,
165
- data.hoverId,
166
- ({ hover, onMouseMove, onMouseLeave, key }: any) => {
167
- let style = {
168
- ...data.style,
169
- ...(hover && data.hoverStyle),
170
- };
171
- return VDOM.createElement(
172
- inSvg ? "g" : "div",
173
- {
174
- key,
175
- className: CSS.expand(data.classNames, CSS.state({ hover }), hover && data.hoverClass),
176
- style,
177
- ...eventHandlers,
178
- onMouseLeave,
179
- onMouseMove,
180
- },
181
- children,
182
- );
183
- },
184
- );
185
- }
155
+ export class HoverSyncElement extends StyledContainerBase<
156
+ HoverSyncElementConfig,
157
+ Instance
158
+ > {
159
+ declare hoverChannel: string;
160
+ declare hoverId?: Prop<any>;
161
+ declare hoverClass?: ClassProp;
162
+ declare hoverStyle?: StyleProp;
163
+
164
+ constructor(config?: HoverSyncElementConfig) {
165
+ super(config);
166
+ }
167
+
168
+ declareData(...args: any[]) {
169
+ super.declareData(...args, {
170
+ hoverId: undefined,
171
+ hoverClass: { structured: true },
172
+ hoverStyle: { structured: true },
173
+ });
174
+ }
175
+
176
+ prepareData(context: any, instance: any) {
177
+ instance.hoverSync = context.hoverSync;
178
+ instance.inSvg = !!context.inSvg;
179
+ let { data } = instance;
180
+ data.hoverStyle = parseStyle(data.hoverStyle);
181
+ super.prepareData(context, instance);
182
+ }
183
+
184
+ render(context: any, instance: any, key: string) {
185
+ let { data, inSvg } = instance;
186
+ let { CSS } = this;
187
+ let children = this.renderChildren(context, instance);
188
+ let eventHandlers = instance.getJsxEventProps();
189
+ return withHoverSync(
190
+ key,
191
+ instance.hoverSync,
192
+ this.hoverChannel,
193
+ data.hoverId,
194
+ ({ hover, onMouseMove, onMouseLeave, key }: any) => {
195
+ let style = {
196
+ ...data.style,
197
+ ...(hover && data.hoverStyle),
198
+ };
199
+ return VDOM.createElement(
200
+ inSvg ? "g" : "div",
201
+ {
202
+ key,
203
+ className: CSS.expand(
204
+ data.classNames,
205
+ CSS.state({ hover }),
206
+ hover && data.hoverClass,
207
+ ),
208
+ style,
209
+ ...eventHandlers,
210
+ onMouseLeave,
211
+ onMouseMove,
212
+ },
213
+ children,
214
+ );
215
+ },
216
+ );
217
+ }
186
218
  }
187
219
 
188
220
  HoverSyncElement.prototype.baseClass = "hoversyncelement";
package/src/ui/Prop.ts CHANGED
@@ -116,7 +116,7 @@ export type StyleProp = Prop<string | React.CSSProperties> | StructuredProp;
116
116
  export type NumberProp = Prop<number>;
117
117
  export type BooleanProp = Prop<boolean>;
118
118
  export type ClassProp = Prop<string> | StructuredProp;
119
- export type RecordsProp = Prop<DataRecord[]>;
119
+ export type RecordsProp<T = any> = Prop<T[]>;
120
120
  export type SortersProp = Prop<Sorter[]>;
121
121
  export type UnknownProp = Prop<unknown>;
122
122
  export type ModProp = StringProp | StructuredProp;
package/src/ui/Text.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { Widget, WidgetConfig } from './Widget';
2
- import { StringProp } from './Prop';
1
+ import { Widget, WidgetConfig } from "./Widget";
2
+ import { NumberProp, StringProp } from "./Prop";
3
3
 
4
4
  export interface TextConfig extends WidgetConfig {
5
5
  /** The value to be rendered as text. */
6
- value?: StringProp;
6
+ value?: StringProp | NumberProp;
7
7
 
8
8
  /** Template string for the text value. */
9
9
  tpl?: string;
@@ -30,20 +30,23 @@ export class Text extends Widget<TextConfig> {
30
30
  this.value = {
31
31
  tpl: this.tpl,
32
32
  expr: this.expr,
33
- bind: this.bind
33
+ bind: this.bind,
34
34
  };
35
35
  super.init();
36
36
  }
37
37
 
38
38
  declareData(...args: any[]) {
39
- super.declareData({
40
- value: undefined
41
- }, ...args);
39
+ super.declareData(
40
+ {
41
+ value: undefined,
42
+ },
43
+ ...args,
44
+ );
42
45
  }
43
46
 
44
47
  render(context: any, { data }: any, key: string) {
45
- return data.value != null ? data.value : '';
48
+ return data.value != null ? data.value : "";
46
49
  }
47
50
  }
48
51
 
49
- Widget.alias('text', Text)
52
+ Widget.alias("text", Text);
@@ -0,0 +1,42 @@
1
+ import assert from "assert";
2
+ import { Store } from "../../data";
3
+ import { GroupAdapter, GroupingConfig } from "./GroupAdapter";
4
+
5
+ function collectKeys(
6
+ obj: any,
7
+ path = "",
8
+ result: Record<string, boolean> = {},
9
+ seen = new WeakSet(),
10
+ ): Record<string, boolean> {
11
+ if (!obj || typeof obj !== "object" || seen.has(obj)) return result;
12
+ seen.add(obj);
13
+ for (const key of Object.keys(obj)) {
14
+ const fullPath = path ? `${path}.${key}` : key;
15
+ result[fullPath] = true;
16
+ collectKeys(obj[key], fullPath, result, seen);
17
+ }
18
+ return result;
19
+ }
20
+
21
+ describe("GroupAdapter", () => {
22
+ it("should not mutate grouping config during groupBy", () => {
23
+ const groupingConfig: GroupingConfig[] = [
24
+ {
25
+ key: { city: { bind: "$record.city" } },
26
+ aggregates: {
27
+ count: { type: "count", value: 1 },
28
+ },
29
+ },
30
+ ];
31
+
32
+ const keysBefore = collectKeys(groupingConfig);
33
+
34
+ const adapter = new GroupAdapter();
35
+ adapter.groupBy(groupingConfig);
36
+
37
+ const keysAfter = collectKeys(groupingConfig);
38
+ const newKeys = Object.keys(keysAfter).filter((k) => !keysBefore[k]);
39
+
40
+ assert.deepStrictEqual(newKeys, [], `Grouping config was mutated. New keys: ${newKeys.join(", ")}`);
41
+ });
42
+ });
@@ -180,39 +180,50 @@ export class GroupAdapter<T = any> extends ArrayAdapter<T> {
180
180
  if (!groupings) {
181
181
  this.groupings = null;
182
182
  } else if (isArray(groupings)) {
183
- this.groupings = groupings as unknown as ResolvedGrouping[];
184
- this.groupings.forEach((g) => {
183
+ // Clone groupings to avoid mutating the original config
184
+ this.groupings = groupings.map((g) => {
185
185
  const groupSorters: Sorter[] = [];
186
186
  const key: Record<string, Prop<any>> = {};
187
+ const resolvedKey: Record<string, { value: Prop<any>; direction: SortDirection }> = {};
187
188
 
188
189
  for (const name in g.key) {
189
190
  const keyConfig = g.key[name];
190
191
  if (!keyConfig || typeof keyConfig !== "object" || !("value" in keyConfig)) {
191
- g.key[name] = { value: keyConfig as Prop<any>, direction: "ASC" };
192
+ resolvedKey[name] = { value: keyConfig as Prop<any>, direction: "ASC" };
193
+ } else {
194
+ resolvedKey[name] = keyConfig as { value: Prop<any>; direction: SortDirection };
192
195
  }
193
196
 
194
- const resolvedKey = g.key[name] as { value: Prop<any>; direction: SortDirection };
195
- key[name] = resolvedKey.value;
197
+ key[name] = resolvedKey[name].value;
196
198
  groupSorters.push({
197
199
  field: name,
198
- direction: resolvedKey.direction,
200
+ direction: resolvedKey[name].direction,
199
201
  });
200
202
  }
201
203
 
202
- g.grouper = new Grouper(
204
+ const grouper = new Grouper(
203
205
  key,
204
206
  { ...this.aggregates, ...g.aggregates },
205
207
  (r: DataAdapterRecord<T>) => r.store.getData(),
206
208
  g.text,
207
209
  );
208
210
 
209
- if (g.comparer == null && groupSorters.length > 0) {
210
- g.comparer = getComparer(
211
- groupSorters,
212
- (x: any) => x.key,
213
- this.sortOptions ? Culture.getComparer(this.sortOptions) : undefined,
214
- );
215
- }
211
+ const comparer =
212
+ g.comparer ??
213
+ (groupSorters.length > 0
214
+ ? getComparer(
215
+ groupSorters,
216
+ (x: any) => x.key,
217
+ this.sortOptions ? Culture.getComparer(this.sortOptions) : undefined,
218
+ )
219
+ : null);
220
+
221
+ return {
222
+ ...g,
223
+ key: resolvedKey,
224
+ grouper,
225
+ comparer,
226
+ } as ResolvedGrouping;
216
227
  });
217
228
  } else {
218
229
  throw new Error("Invalid grouping provided.");
@@ -88,7 +88,7 @@ export class History {
88
88
  ): boolean {
89
89
  url = Url.resolve(url);
90
90
 
91
- if (!window.history.pushState || reload) {
91
+ if (!window.history.pushState || reload || !this.store) {
92
92
  window.location[replace ? "replace" : "assign"](url);
93
93
  return true;
94
94
  }
package/src/ui/index.scss CHANGED
@@ -1,2 +1,2 @@
1
1
 
2
- @import 'layout/index';
2
+ @use 'layout/index';
@@ -1,10 +1,8 @@
1
+ @use "../../util/scss/besm.scss" as *;
1
2
 
2
3
  @use "sass:map";
3
4
 
4
- @mixin cx-labelsleftlayout(
5
- $name: 'labelsleftlayout',
6
- $besm: $cx-besm
7
- ) {
5
+ @mixin cx-labelsleftlayout($name: "labelsleftlayout", $besm: $cx-besm) {
8
6
  $block: map.get($besm, block);
9
7
  $element: map.get($besm, element);
10
8
  $state: map.get($besm, state);
@@ -42,6 +40,6 @@
42
40
  }
43
41
  }
44
42
 
45
- @if (cx-should-include('cx/ui/LabelsLeftLayout')) {
46
- @include cx-labelsleftlayout();
47
- }
43
+ @if (cx-should-include("cx/ui/LabelsLeftLayout")) {
44
+ @include cx-labelsleftlayout();
45
+ }
@@ -1,9 +1,7 @@
1
1
  @use "sass:map";
2
+ @use "../../util/scss/besm.scss" as *;
2
3
 
3
- @mixin cx-labelstoplayout(
4
- $name: 'labelstoplayout',
5
- $besm: $cx-besm
6
- ) {
4
+ @mixin cx-labelstoplayout($name: "labelstoplayout", $besm: $cx-besm) {
7
5
  $block: map.get($besm, block);
8
6
  $element: map.get($besm, element);
9
7
  $state: map.get($besm, state);
@@ -60,6 +58,6 @@
60
58
  }
61
59
  }
62
60
 
63
- @if (cx-should-include('cx/ui/LabelsTopLayout')) {
61
+ @if (cx-should-include("cx/ui/LabelsTopLayout")) {
64
62
  @include cx-labelstoplayout();
65
- }
63
+ }
@@ -1,3 +1,2 @@
1
-
2
- @import "LabelsLeftLayout";
3
- @import "LabelsTopLayout";
1
+ @use "LabelsLeftLayout";
2
+ @use "LabelsTopLayout";
File without changes
@@ -1,2 +1 @@
1
-
2
- @import "layout/variables";
1
+ @forward "layout/variables";
@@ -1,3 +1,5 @@
1
+ @use "./scss/index.scss" as *;
2
+
1
3
  .cx-text-left.cx-text-left {
2
4
  text-align: left;
3
5
  }
@@ -6,6 +8,6 @@
6
8
  text-align: right;
7
9
  }
8
10
 
9
- .cx-text-center.cx-text-center {
11
+ .cx-text-center.cx-text-center {
10
12
  text-align: center;
11
- }
13
+ }
@@ -0,0 +1 @@
1
+ @forward "./scss/maps.scss";
@@ -0,0 +1,15 @@
1
+ //
2
+ // BESM
3
+ //
4
+ // B - block - top level HTML element
5
+ // E - element - part of the component (block)
6
+ // S - state - indicator of the component state which affects the appearance
7
+ // M - mod - user supplied instruction which overrides default appearance
8
+ //
9
+
10
+ $cx-besm: (
11
+ block: "cxb-",
12
+ element: "cxe-",
13
+ state: "cxs-",
14
+ mod: "cxm-",
15
+ ) !default;