@mwater/visualization 5.4.5 → 5.6.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 (310) hide show
  1. package/lib/MWaterContextComponent.d.ts +1 -1
  2. package/lib/MWaterContextComponent.js +1 -1
  3. package/lib/MWaterGlobalFiltersComponent.d.ts +2 -2
  4. package/lib/MWaterGlobalFiltersComponent.js +11 -20
  5. package/lib/MWaterLoaderComponent.d.ts +5 -14
  6. package/lib/MWaterLoaderComponent.js +2 -11
  7. package/lib/UndoStack.d.ts +2 -1
  8. package/lib/UndoStack.js +12 -6
  9. package/lib/dashboards/DashboardComponent.js +7 -5
  10. package/lib/dashboards/DashboardDesign.d.ts +1 -1
  11. package/lib/dashboards/LayoutOptionsComponent.js +18 -11
  12. package/lib/dashboards/ServerDashboardDataSource.d.ts +10 -1
  13. package/lib/dashboards/ServerDashboardDataSource.js +29 -10
  14. package/lib/dashboards/SettingsModalComponent.js +1 -1
  15. package/lib/dashboards/layoutOptions.d.ts +5 -1
  16. package/lib/datagrids/DatagridComponent.js +23 -3
  17. package/lib/datagrids/DatagridDesignerComponent.d.ts +2 -3
  18. package/lib/datagrids/DatagridDesignerComponent.js +108 -120
  19. package/lib/datagrids/DatagridViewComponent.js +3 -2
  20. package/lib/datagrids/ExprCellComponent.d.ts +1 -0
  21. package/lib/datagrids/ExprCellComponent.js +22 -20
  22. package/lib/datagrids/OrderBysDesignerComponent.d.ts +7 -7
  23. package/lib/datagrids/OrderBysDesignerComponent.js +19 -28
  24. package/lib/index.css +45 -2
  25. package/lib/index.d.ts +5 -5
  26. package/lib/index.js +2 -3
  27. package/lib/layouts/blocks/BlocksDisplayComponent.d.ts +8 -1
  28. package/lib/layouts/blocks/BlocksDisplayComponent.js +46 -4
  29. package/lib/maps/BufferLayer.d.ts +18 -0
  30. package/lib/maps/BufferLayer.js +36 -14
  31. package/lib/maps/BufferLayerDesign.d.ts +1 -1
  32. package/lib/maps/BufferLayerDesignerComponent.js +2 -2
  33. package/lib/maps/ChoroplethLayer.d.ts +18 -0
  34. package/lib/maps/ChoroplethLayer.js +46 -25
  35. package/lib/maps/ChoroplethLayerDesign.d.ts +7 -3
  36. package/lib/maps/ChoroplethLayerDesigner.d.ts +10 -22
  37. package/lib/maps/ChoroplethLayerDesigner.js +58 -89
  38. package/lib/maps/DirectMapDataSource.js +17 -10
  39. package/lib/maps/EditHoverOver.d.ts +4 -3
  40. package/lib/maps/EditHoverOver.js +64 -35
  41. package/lib/maps/HoverContent.d.ts +10 -5
  42. package/lib/maps/HoverContent.js +7 -36
  43. package/lib/maps/Layer.d.ts +37 -0
  44. package/lib/maps/Layer.js +30 -4
  45. package/lib/maps/LeafletMapComponent.js +10 -19
  46. package/lib/maps/MWaterServerLayer.d.ts +2 -2
  47. package/lib/maps/MWaterServerLayer.js +6 -6
  48. package/lib/maps/MapComponent.js +0 -1
  49. package/lib/maps/MapLayerDataSource.d.ts +9 -0
  50. package/lib/maps/MapUtils.d.ts +19 -1
  51. package/lib/maps/MapUtils.js +80 -1
  52. package/lib/maps/MarkersLayer.d.ts +18 -0
  53. package/lib/maps/MarkersLayer.js +42 -26
  54. package/lib/maps/MarkersLayerDesign.d.ts +1 -1
  55. package/lib/maps/MarkersLayerDesignerComponent.d.ts +12 -28
  56. package/lib/maps/MarkersLayerDesignerComponent.js +81 -111
  57. package/lib/maps/RasterMapViewComponent.js +1 -1
  58. package/lib/maps/ServerMapDataSource.d.ts +9 -0
  59. package/lib/maps/ServerMapDataSource.js +29 -10
  60. package/lib/maps/VectorMapViewComponent.js +7 -15
  61. package/lib/maps/maps.d.ts +4 -2
  62. package/lib/maps/symbols/font-awesome/asterisk.png +0 -0
  63. package/lib/maps/symbols/font-awesome/ban.png +0 -0
  64. package/lib/maps/symbols/font-awesome/beer.png +0 -0
  65. package/lib/maps/symbols/font-awesome/bell.png +0 -0
  66. package/lib/maps/symbols/font-awesome/bolt.png +0 -0
  67. package/lib/maps/symbols/font-awesome/building.png +0 -0
  68. package/lib/maps/symbols/font-awesome/bullseye.png +0 -0
  69. package/lib/maps/symbols/font-awesome/bus.png +0 -0
  70. package/lib/maps/symbols/font-awesome/caret-up.png +0 -0
  71. package/lib/maps/symbols/font-awesome/certificate.png +0 -0
  72. package/lib/maps/symbols/font-awesome/check-circle.png +0 -0
  73. package/lib/maps/symbols/font-awesome/check.png +0 -0
  74. package/lib/maps/symbols/font-awesome/chevron-circle-down.png +0 -0
  75. package/lib/maps/symbols/font-awesome/chevron-circle-up.png +0 -0
  76. package/lib/maps/symbols/font-awesome/cloud-rain.png +0 -0
  77. package/lib/maps/symbols/font-awesome/cloud.png +0 -0
  78. package/lib/maps/symbols/font-awesome/comment.png +0 -0
  79. package/lib/maps/symbols/font-awesome/crosshairs.png +0 -0
  80. package/lib/maps/symbols/font-awesome/dot-circle-o.png +0 -0
  81. package/lib/maps/symbols/font-awesome/exclamation-circle.png +0 -0
  82. package/lib/maps/symbols/font-awesome/exclamation-triangle.png +0 -0
  83. package/lib/maps/symbols/font-awesome/female.png +0 -0
  84. package/lib/maps/symbols/font-awesome/file.png +0 -0
  85. package/lib/maps/symbols/font-awesome/flag.png +0 -0
  86. package/lib/maps/symbols/font-awesome/flask.png +0 -0
  87. package/lib/maps/symbols/font-awesome/h-square.png +0 -0
  88. package/lib/maps/symbols/font-awesome/home.png +0 -0
  89. package/lib/maps/symbols/font-awesome/info-circle.png +0 -0
  90. package/lib/maps/symbols/font-awesome/male.png +0 -0
  91. package/lib/maps/symbols/font-awesome/medkit.png +0 -0
  92. package/lib/maps/symbols/font-awesome/mobile.png +0 -0
  93. package/lib/maps/symbols/font-awesome/plus-circle.png +0 -0
  94. package/lib/maps/symbols/font-awesome/plus-square.png +0 -0
  95. package/lib/maps/symbols/font-awesome/plus.png +0 -0
  96. package/lib/maps/symbols/font-awesome/square.png +0 -0
  97. package/lib/maps/symbols/font-awesome/star.png +0 -0
  98. package/lib/maps/symbols/font-awesome/thumbs-down.png +0 -0
  99. package/lib/maps/symbols/font-awesome/thumbs-up.png +0 -0
  100. package/lib/maps/symbols/font-awesome/ticket.png +0 -0
  101. package/lib/maps/symbols/font-awesome/times-circle.png +0 -0
  102. package/lib/maps/symbols/font-awesome/times.png +0 -0
  103. package/lib/maps/symbols/font-awesome/tint.png +0 -0
  104. package/lib/maps/symbols/font-awesome/tree.png +0 -0
  105. package/lib/maps/symbols/font-awesome/university.png +0 -0
  106. package/lib/maps/symbols/font-awesome/usd.png +0 -0
  107. package/lib/maps/symbols/font-awesome/user.png +0 -0
  108. package/lib/maps/symbols/font-awesome/users.png +0 -0
  109. package/lib/maps/symbols/font-awesome/wheelchair.png +0 -0
  110. package/lib/maps/symbols/sdf-ize.sh +93 -0
  111. package/lib/maps/vectorMaps.d.ts +1 -0
  112. package/lib/maps/vectorMaps.js +20 -36
  113. package/lib/mwater_table_selection/FormsListComponent.d.ts +33 -0
  114. package/lib/mwater_table_selection/FormsListComponent.js +141 -0
  115. package/lib/mwater_table_selection/IndicatorsListComponent.d.ts +49 -0
  116. package/lib/mwater_table_selection/IndicatorsListComponent.js +251 -0
  117. package/lib/mwater_table_selection/IssuesListComponent.d.ts +29 -0
  118. package/lib/mwater_table_selection/IssuesListComponent.js +123 -0
  119. package/lib/mwater_table_selection/MWaterAccountingSystemListComponent.d.ts +20 -0
  120. package/lib/mwater_table_selection/MWaterAccountingSystemListComponent.js +157 -0
  121. package/lib/mwater_table_selection/MWaterAssetSystemsListComponent.d.ts +17 -0
  122. package/lib/mwater_table_selection/MWaterAssetSystemsListComponent.js +79 -0
  123. package/lib/mwater_table_selection/MWaterCalculatedDataSourcesListComponent.d.ts +18 -0
  124. package/lib/mwater_table_selection/MWaterCalculatedDataSourcesListComponent.js +80 -0
  125. package/lib/mwater_table_selection/MWaterCompleteTableSelectComponent.d.ts +63 -0
  126. package/lib/mwater_table_selection/MWaterCompleteTableSelectComponent.js +461 -0
  127. package/lib/mwater_table_selection/MWaterCustomTablesetListComponent.d.ts +17 -0
  128. package/lib/mwater_table_selection/MWaterCustomTablesetListComponent.js +94 -0
  129. package/lib/mwater_table_selection/MWaterMetricsTableListComponent.d.ts +17 -0
  130. package/lib/mwater_table_selection/MWaterMetricsTableListComponent.js +80 -0
  131. package/lib/mwater_table_selection/MWaterTableSelectComponent.d.ts +32 -0
  132. package/lib/mwater_table_selection/MWaterTableSelectComponent.js +163 -0
  133. package/lib/mwater_table_selection/MWaterWorkflowsSelectComponent.d.ts +19 -0
  134. package/lib/mwater_table_selection/MWaterWorkflowsSelectComponent.js +111 -0
  135. package/lib/quickfilter/QuickfiltersComponent.d.ts +3 -102
  136. package/lib/quickfilter/QuickfiltersComponent.js +53 -110
  137. package/lib/quickfilter/TextLiteralComponent.d.ts +23 -47
  138. package/lib/quickfilter/TextLiteralComponent.js +85 -82
  139. package/lib/widgets/MapWidget.js +4 -2
  140. package/lib/widgets/charts/Chart.d.ts +11 -0
  141. package/lib/widgets/charts/Chart.js +15 -0
  142. package/lib/widgets/charts/ChartWidgetComponent.d.ts +1 -0
  143. package/lib/widgets/charts/ChartWidgetComponent.js +27 -1
  144. package/lib/widgets/charts/layered/LayeredChartDesign.d.ts +1 -1
  145. package/lib/widgets/charts/layered/LayeredChartDesignerComponent.d.ts +1 -1
  146. package/lib/widgets/charts/layered/LayeredChartDesignerComponent.js +5 -12
  147. package/lib/widgets/charts/layered/LayeredChartLayerDesignerComponent.d.ts +43 -57
  148. package/lib/widgets/charts/layered/LayeredChartLayerDesignerComponent.js +113 -110
  149. package/lib/widgets/charts/layered/LayeredChartUtils.d.ts +2 -1
  150. package/lib/widgets/charts/layered/LayeredChartUtils.js +0 -2
  151. package/lib/widgets/charts/pivot/PivotChart.d.ts +2 -0
  152. package/lib/widgets/charts/pivot/PivotChart.js +156 -0
  153. package/lib/widgets/charts/pivot/PivotChartDesignerComponent.d.ts +5 -20
  154. package/lib/widgets/charts/pivot/PivotChartDesignerComponent.js +31 -61
  155. package/lib/widgets/charts/pivot/PivotChartLayoutBuilder.d.ts +4 -0
  156. package/lib/widgets/charts/pivot/PivotChartLayoutBuilder.js +4 -2
  157. package/lib/widgets/charts/pivot/PivotChartLayoutComponent.d.ts +5 -44
  158. package/lib/widgets/charts/pivot/PivotChartLayoutComponent.js +38 -63
  159. package/lib/widgets/charts/pivot/SegmentDesignerComponent.d.ts +7 -68
  160. package/lib/widgets/charts/pivot/SegmentDesignerComponent.js +58 -106
  161. package/lib/widgets/charts/table/TableChart.d.ts +2 -0
  162. package/lib/widgets/charts/table/TableChart.js +172 -1
  163. package/lib/widgets/charts/table/TableChartDesignerComponent.d.ts +7 -17
  164. package/lib/widgets/charts/table/TableChartDesignerComponent.js +79 -95
  165. package/lib/widgets/charts/table/TableChartViewComponent.d.ts +1 -7
  166. package/lib/widgets/charts/table/TableChartViewComponent.js +19 -27
  167. package/lib/widgets/text/ExprItemEditorComponent.d.ts +3 -8
  168. package/lib/widgets/text/ExprItemEditorComponent.js +36 -33
  169. package/lib/widgets/text/ExprUpdateModalComponent.d.ts +1 -0
  170. package/package.json +4 -10
  171. package/src/MWaterContextComponent.tsx +2 -2
  172. package/src/{MWaterGlobalFiltersComponent.ts → MWaterGlobalFiltersComponent.tsx} +32 -33
  173. package/src/{MWaterLoaderComponent.ts → MWaterLoaderComponent.tsx} +18 -19
  174. package/src/UndoStack.ts +14 -6
  175. package/src/dashboards/DashboardComponent.tsx +7 -5
  176. package/src/dashboards/DashboardDesign.ts +1 -1
  177. package/src/dashboards/LayoutOptionsComponent.tsx +22 -10
  178. package/src/dashboards/ServerDashboardDataSource.ts +36 -13
  179. package/src/dashboards/SettingsModalComponent.tsx +1 -1
  180. package/src/dashboards/layoutOptions.tsx +5 -1
  181. package/src/datagrids/DatagridComponent.tsx +31 -3
  182. package/src/datagrids/DatagridDesignerComponent.tsx +241 -229
  183. package/src/datagrids/DatagridViewComponent.tsx +3 -2
  184. package/src/datagrids/ExprCellComponent.tsx +23 -20
  185. package/src/datagrids/OrderBysDesignerComponent.tsx +61 -70
  186. package/src/index.css +45 -2
  187. package/src/index.ts +5 -11
  188. package/src/layouts/blocks/BlocksDisplayComponent.tsx +60 -5
  189. package/src/maps/BufferLayer.ts +48 -20
  190. package/src/maps/BufferLayerDesign.ts +1 -1
  191. package/src/maps/BufferLayerDesignerComponent.tsx +2 -1
  192. package/src/maps/ChoroplethLayer.ts +70 -39
  193. package/src/maps/ChoroplethLayerDesign.ts +6 -2
  194. package/src/maps/ChoroplethLayerDesigner.tsx +171 -167
  195. package/src/maps/DirectMapDataSource.ts +21 -13
  196. package/src/maps/EditHoverOver.tsx +98 -54
  197. package/src/maps/HoverContent.tsx +17 -48
  198. package/src/maps/Layer.ts +42 -4
  199. package/src/maps/LeafletMapComponent.tsx +10 -19
  200. package/src/maps/MWaterServerLayer.ts +6 -6
  201. package/src/maps/MapComponent.ts +0 -1
  202. package/src/maps/MapLayerDataSource.ts +8 -0
  203. package/src/maps/MapUtils.ts +82 -3
  204. package/src/maps/MarkersLayer.ts +54 -27
  205. package/src/maps/MarkersLayerDesign.ts +1 -1
  206. package/src/maps/MarkersLayerDesignerComponent.tsx +360 -0
  207. package/src/maps/RasterMapViewComponent.ts +1 -1
  208. package/src/maps/ServerMapDataSource.ts +35 -12
  209. package/src/maps/VectorMapViewComponent.tsx +8 -19
  210. package/src/maps/maps.ts +4 -2
  211. package/src/maps/symbols/font-awesome/asterisk.png +0 -0
  212. package/src/maps/symbols/font-awesome/ban.png +0 -0
  213. package/src/maps/symbols/font-awesome/beer.png +0 -0
  214. package/src/maps/symbols/font-awesome/bell.png +0 -0
  215. package/src/maps/symbols/font-awesome/bolt.png +0 -0
  216. package/src/maps/symbols/font-awesome/building.png +0 -0
  217. package/src/maps/symbols/font-awesome/bullseye.png +0 -0
  218. package/src/maps/symbols/font-awesome/bus.png +0 -0
  219. package/src/maps/symbols/font-awesome/caret-up.png +0 -0
  220. package/src/maps/symbols/font-awesome/certificate.png +0 -0
  221. package/src/maps/symbols/font-awesome/check-circle.png +0 -0
  222. package/src/maps/symbols/font-awesome/check.png +0 -0
  223. package/src/maps/symbols/font-awesome/chevron-circle-down.png +0 -0
  224. package/src/maps/symbols/font-awesome/chevron-circle-up.png +0 -0
  225. package/src/maps/symbols/font-awesome/cloud-rain.png +0 -0
  226. package/src/maps/symbols/font-awesome/cloud.png +0 -0
  227. package/src/maps/symbols/font-awesome/comment.png +0 -0
  228. package/src/maps/symbols/font-awesome/crosshairs.png +0 -0
  229. package/src/maps/symbols/font-awesome/dot-circle-o.png +0 -0
  230. package/src/maps/symbols/font-awesome/exclamation-circle.png +0 -0
  231. package/src/maps/symbols/font-awesome/exclamation-triangle.png +0 -0
  232. package/src/maps/symbols/font-awesome/female.png +0 -0
  233. package/src/maps/symbols/font-awesome/file.png +0 -0
  234. package/src/maps/symbols/font-awesome/flag.png +0 -0
  235. package/src/maps/symbols/font-awesome/flask.png +0 -0
  236. package/src/maps/symbols/font-awesome/h-square.png +0 -0
  237. package/src/maps/symbols/font-awesome/home.png +0 -0
  238. package/src/maps/symbols/font-awesome/info-circle.png +0 -0
  239. package/src/maps/symbols/font-awesome/male.png +0 -0
  240. package/src/maps/symbols/font-awesome/medkit.png +0 -0
  241. package/src/maps/symbols/font-awesome/mobile.png +0 -0
  242. package/src/maps/symbols/font-awesome/plus-circle.png +0 -0
  243. package/src/maps/symbols/font-awesome/plus-square.png +0 -0
  244. package/src/maps/symbols/font-awesome/plus.png +0 -0
  245. package/src/maps/symbols/font-awesome/square.png +0 -0
  246. package/src/maps/symbols/font-awesome/star.png +0 -0
  247. package/src/maps/symbols/font-awesome/thumbs-down.png +0 -0
  248. package/src/maps/symbols/font-awesome/thumbs-up.png +0 -0
  249. package/src/maps/symbols/font-awesome/ticket.png +0 -0
  250. package/src/maps/symbols/font-awesome/times-circle.png +0 -0
  251. package/src/maps/symbols/font-awesome/times.png +0 -0
  252. package/src/maps/symbols/font-awesome/tint.png +0 -0
  253. package/src/maps/symbols/font-awesome/tree.png +0 -0
  254. package/src/maps/symbols/font-awesome/university.png +0 -0
  255. package/src/maps/symbols/font-awesome/usd.png +0 -0
  256. package/src/maps/symbols/font-awesome/user.png +0 -0
  257. package/src/maps/symbols/font-awesome/users.png +0 -0
  258. package/src/maps/symbols/font-awesome/wheelchair.png +0 -0
  259. package/src/maps/symbols/sdf-ize.sh +93 -0
  260. package/src/maps/vectorMaps.tsx +20 -44
  261. package/src/mwater_table_selection/FormsListComponent.tsx +188 -0
  262. package/src/mwater_table_selection/IndicatorsListComponent.tsx +411 -0
  263. package/src/mwater_table_selection/IssuesListComponent.tsx +167 -0
  264. package/src/mwater_table_selection/MWaterAccountingSystemListComponent.tsx +225 -0
  265. package/src/{MWaterAssetSystemsListComponent.tsx → mwater_table_selection/MWaterAssetSystemsListComponent.tsx} +2 -2
  266. package/src/mwater_table_selection/MWaterCalculatedDataSourcesListComponent.tsx +111 -0
  267. package/src/mwater_table_selection/MWaterCompleteTableSelectComponent.tsx +713 -0
  268. package/src/{MWaterCustomTablesetListComponent.tsx → mwater_table_selection/MWaterCustomTablesetListComponent.tsx} +1 -1
  269. package/src/{MWaterMetricsTableListComponent.tsx → mwater_table_selection/MWaterMetricsTableListComponent.tsx} +1 -1
  270. package/src/{MWaterTableSelectComponent.tsx → mwater_table_selection/MWaterTableSelectComponent.tsx} +91 -90
  271. package/src/mwater_table_selection/MWaterWorkflowsSelectComponent.tsx +159 -0
  272. package/src/quickfilter/{QuickfiltersComponent.ts → QuickfiltersComponent.tsx} +165 -158
  273. package/src/quickfilter/TextLiteralComponent.tsx +197 -0
  274. package/src/widgets/MapWidget.tsx +9 -1
  275. package/src/widgets/charts/Chart.ts +17 -0
  276. package/src/widgets/charts/ChartWidgetComponent.tsx +36 -1
  277. package/src/widgets/charts/layered/LayeredChartDesign.ts +1 -1
  278. package/src/widgets/charts/layered/LayeredChartDesignerComponent.tsx +23 -24
  279. package/src/widgets/charts/layered/LayeredChartLayerDesignerComponent.tsx +260 -211
  280. package/src/widgets/charts/layered/LayeredChartUtils.ts +7 -7
  281. package/src/widgets/charts/pivot/PivotChart.ts +191 -0
  282. package/src/widgets/charts/pivot/PivotChartDesignerComponent.tsx +124 -129
  283. package/src/widgets/charts/pivot/PivotChartLayoutBuilder.ts +4 -2
  284. package/src/widgets/charts/pivot/PivotChartLayoutComponent.tsx +120 -149
  285. package/src/widgets/charts/pivot/SegmentDesignerComponent.tsx +178 -198
  286. package/src/widgets/charts/table/TableChart.ts +177 -1
  287. package/src/widgets/charts/table/TableChartDesignerComponent.tsx +422 -0
  288. package/src/widgets/charts/table/{TableChartViewComponent.ts → TableChartViewComponent.tsx} +65 -60
  289. package/src/widgets/text/ExprItemEditorComponent.tsx +83 -77
  290. package/src/widgets/text/ExprUpdateModalComponent.tsx +1 -0
  291. package/test/UndoStackTests.ts +52 -1
  292. package/.storybook/config.js +0 -7
  293. package/.storybook/head.html +0 -4
  294. package/.storybook/webpack.config.js +0 -15
  295. package/src/MWaterCompleteTableSelectComponent.tsx +0 -975
  296. package/src/maps/BingLayer.ts +0 -146
  297. package/src/maps/MarkersLayerDesignerComponent.ts +0 -374
  298. package/src/quickfilter/TextLiteralComponent.ts +0 -165
  299. package/src/widgets/charts/table/TableChartDesignerComponent.ts +0 -441
  300. package/stories/UpdateableComponent.js +0 -29
  301. package/stories/consoles.js +0 -202
  302. package/stories/dashboards.js +0 -217
  303. package/stories/datagridDesign.js +0 -114
  304. package/stories/datagrids.js +0 -69
  305. package/stories/dates.js +0 -80
  306. package/stories/exprcomponent.js +0 -43
  307. package/stories/index.js +0 -18
  308. package/stories/leaflet.js +0 -59
  309. package/stories/maps.js +0 -24
  310. package/stories/pivotChart.js +0 -235
@@ -20,6 +20,7 @@ import Widget from "../widgets/Widget"
20
20
  import { WidgetDataSource } from "../widgets/WidgetDataSource"
21
21
  import BlocksLayoutManager from "../layouts/blocks/BlocksLayoutManager"
22
22
  import { getTranslatableStringsFromLayoutManager } from "../dashboards/DashboardUtils"
23
+ import { getSimpleHoverOverData } from "./MapUtils"
23
24
 
24
25
  export default class MarkersLayer extends Layer<MarkersLayerDesign> {
25
26
  /** Gets the type of layer definition */
@@ -114,6 +115,9 @@ export default class MarkersLayer extends Layer<MarkersLayerDesign> {
114
115
  filter: addFilter(["==", ["geometry-type"], "Point"])
115
116
  })
116
117
  } else {
118
+ // For some reason, scales down from 20 to 14. No idea why
119
+ const iconSize = (design.markerSize || 10) / 14
120
+
117
121
  mapLayers.push({
118
122
  id: `${sourceId}:points`,
119
123
  type: "symbol",
@@ -122,11 +126,13 @@ export default class MarkersLayer extends Layer<MarkersLayerDesign> {
122
126
  layout: {
123
127
  "icon-image": design.symbol,
124
128
  "icon-allow-overlap": true,
125
- "icon-size": (design.markerSize || 10) / 14 // For some reason, scales down from 20 to 14. No idea why
129
+ "icon-size": iconSize,
126
130
  },
127
131
  paint: {
128
132
  "icon-color": color,
129
- "icon-opacity": opacity
133
+ "icon-opacity": opacity,
134
+ "icon-halo-color": compileColorToMapbox("#FFFFFFCC", design.axes.color?.excludedValues),
135
+ "icon-halo-width": iconSize * 5,
130
136
  },
131
137
  filter: addFilter(["==", ["geometry-type"], "Point"])
132
138
  })
@@ -471,33 +477,16 @@ ${design.polygonBorderColor ? "line-color: " + design.polygonBorderColor + ";" :
471
477
  ev: { data: any; event: any },
472
478
  hoverOptions: OnGridHoverOptions<MarkersLayerDesign>
473
479
  ): OnGridHoverResults {
474
- if (ev.data && ev.data.id) {
475
- const { table } = hoverOptions.design
476
- const results: OnGridHoverResults = {}
477
-
478
- // Popup
479
- if (hoverOptions.design.hoverOver) {
480
- const exprCompiler = new ExprCompiler(hoverOptions.schema)
481
-
482
- results.hoverOver = React.createElement(HoverContent, {
480
+ if (ev.data && ev.data.id && hoverOptions.design.hoverOver && hoverOptions.design.hoverOver.items.length > 0) {
481
+ const results: OnGridHoverResults = {
482
+ hoverOver: React.createElement(HoverContent, {
483
483
  key: ev.data.id,
484
484
  schema: hoverOptions.schema,
485
- dataSource: hoverOptions.dataSource,
486
- table,
485
+ mapLayerDataSource: hoverOptions.layerDataSource,
487
486
  items: hoverOptions.design.hoverOver.items,
488
- filters: [
489
- {
490
- table,
491
- jsonql: {
492
- type: "op",
493
- op: "=",
494
- exprs: [
495
- exprCompiler.compileExpr({ expr: { type: "id", table }, tableAlias: "{alias}" }),
496
- { type: "literal", value: ev.data.id }
497
- ]
498
- }
499
- }
500
- ],
487
+ design: hoverOptions.design,
488
+ data: ev.data,
489
+ filters: hoverOptions.filters,
501
490
  locale: hoverOptions.locale,
502
491
  translate: hoverOptions.translate
503
492
  })
@@ -752,6 +741,19 @@ ${design.polygonBorderColor ? "line-color: " + design.polygonBorderColor + ";" :
752
741
  })!
753
742
 
754
743
  draft.filter = exprCleaner.cleanExpr(design.filter || null, { table: draft.table })
744
+
745
+ // Clean hover over expressions
746
+ if (design.table && design.hoverOver && design.hoverOver.items) {
747
+ for (let i = 0; i < design.hoverOver.items.length; i++) {
748
+ const item = design.hoverOver.items[i]
749
+ if (item.value) {
750
+ draft.hoverOver!.items[i].value = exprCleaner.cleanExpr(item.value || null, {
751
+ table: design.table,
752
+ aggrStatuses: ["individual", "literal"]
753
+ })
754
+ }
755
+ }
756
+ }
755
757
  })
756
758
 
757
759
  return design
@@ -818,6 +820,32 @@ ${design.polygonBorderColor ? "line-color: " + design.polygonBorderColor + ";" :
818
820
  // Remove duplicates
819
821
  return _.uniq(strings)
820
822
  }
823
+
824
+ /** Gets hover over data for hover over items. This should be implemented by layers that have hover over items.
825
+ * It will be called on the server side if using a server map data source, or on the client side if using a direct
826
+ * map data source.
827
+ */
828
+ getHoverOverData(options: {
829
+ /** Design of the layer */
830
+ design: MarkersLayerDesign,
831
+ /** Data of the current item being hovered over. e.g. { id: 123 } */
832
+ data: any,
833
+ /** Filters to apply to the hover over data, not including filtering down to the current item */
834
+ filters: JsonQLFilter[],
835
+ /** Schema to use */
836
+ schema: Schema,
837
+ /** Data source to use */
838
+ dataSource: DataSource,
839
+ }): Promise<{ [key: string]: any }> {
840
+ return getSimpleHoverOverData({
841
+ id: options.data.id,
842
+ table: options.design.table,
843
+ filters: options.filters,
844
+ schema: options.schema,
845
+ dataSource: options.dataSource,
846
+ hoverOverItems: options.design.hoverOver!.items,
847
+ })
848
+ }
821
849
  }
822
850
 
823
851
  /**
@@ -961,4 +989,3 @@ export function createMarkersVectorQuery(baseQuery: JsonQLSelectQuery) {
961
989
 
962
990
  return outerquery
963
991
  }
964
-
@@ -43,7 +43,7 @@ export interface MarkersLayerDesign {
43
43
  popup: { items: LayoutBlock }
44
44
 
45
45
  /** Contains items to display when hovering over the layer */
46
- hoverOver: { items: HoverOverItem[] }
46
+ hoverOver?: { items: HoverOverItem[] }
47
47
 
48
48
  /** Customizable filtering for popup */
49
49
  popupFilterJoins: PopupFilterJoins
@@ -0,0 +1,360 @@
1
+ import _ from "lodash"
2
+ import React from "react"
3
+ import { FilterExprComponent } from "@mwater/expressions-ui"
4
+ import { DataSource, ExprUtils, OpExpr, Schema } from "@mwater/expressions"
5
+ import { ExprCompiler } from "@mwater/expressions"
6
+ import AxisComponent from "../axes/AxisComponent"
7
+ import ColorComponent from "../ColorComponent"
8
+ import { TableSelectComponent } from "@mwater/expressions-ui"
9
+ import EditPopupComponent from "./EditPopupComponent"
10
+ import ZoomLevelsComponent from "./ZoomLevelsComponent"
11
+ import MarkerSymbolSelectComponent from "./MarkerSymbolSelectComponent"
12
+ import * as PopupFilterJoinsUtils from "./PopupFilterJoinsUtils"
13
+ import * as ui from "@mwater/react-library/lib/bootstrap"
14
+ import { EditHoverOver } from "./EditHoverOver"
15
+ import { MarkersLayerDesign } from "./MarkersLayerDesign"
16
+ import { default as Rcslider } from "rc-slider"
17
+
18
+ export interface MarkersLayerDesignerComponentProps {
19
+ /** Schema to use */
20
+ schema: Schema
21
+ dataSource: DataSource
22
+ /** Design of the marker layer */
23
+ design: MarkersLayerDesign
24
+ /** Called with new design */
25
+ onDesignChange: any
26
+ filters?: any
27
+ }
28
+
29
+ // Designer for a markers layer
30
+ export default class MarkersLayerDesignerComponent extends React.Component<MarkersLayerDesignerComponentProps> {
31
+ // Apply updates to design
32
+ update(updates: any) {
33
+ return this.props.onDesignChange(_.extend({}, this.props.design, updates))
34
+ }
35
+
36
+ // Update axes with specified changes
37
+ updateAxes(changes: any) {
38
+ const axes = _.extend({}, this.props.design.axes, changes)
39
+ return this.update({ axes })
40
+ }
41
+
42
+ handleTableChange = (table: any) => {
43
+ return this.update({ table })
44
+ }
45
+ handleGeometryAxisChange = (axis: any) => {
46
+ return this.updateAxes({ geometry: axis })
47
+ }
48
+ handleColorAxisChange = (axis: any) => {
49
+ return this.updateAxes({ color: axis })
50
+ }
51
+ handleFilterChange = (expr: any) => {
52
+ return this.update({ filter: expr })
53
+ }
54
+ handleColorChange = (color: any) => {
55
+ return this.update({ color })
56
+ }
57
+ handlePolygonBorderColorChange = (polygonBorderColor: any) => {
58
+ return this.update({ polygonBorderColor })
59
+ }
60
+ handlePolygonFillOpacityChange = (polygonFillOpacity: any) => {
61
+ return this.update({ polygonFillOpacity: polygonFillOpacity / 100 })
62
+ }
63
+ handleSymbolChange = (symbol: any) => {
64
+ return this.update({ symbol })
65
+ }
66
+ handleNameChange = (e: any) => {
67
+ return this.update({ name: e.target.value })
68
+ }
69
+ handleMarkerSizeChange = (markerSize: any) => {
70
+ return this.update({ markerSize })
71
+ }
72
+ handleLineWidthChange = (lineWidth: any) => {
73
+ return this.update({ lineWidth })
74
+ }
75
+
76
+ renderTable() {
77
+ return (
78
+ <div className="mb-3">
79
+ <label className="text-muted"><i className="fa fa-database" /> {T`Data Source`}</label>
80
+ <div style={{ marginLeft: 10 }}>
81
+ <TableSelectComponent
82
+ schema={this.props.schema}
83
+ value={this.props.design.table}
84
+ onChange={this.handleTableChange}
85
+ filter={this.props.design.filter}
86
+ onFilterChange={this.handleFilterChange}
87
+ />
88
+ </div>
89
+ </div>
90
+ )
91
+ }
92
+
93
+ renderGeometryAxis() {
94
+ if (!this.props.design.table) {
95
+ return
96
+ }
97
+
98
+ const title = <span><span className="fas fa-map-marker-alt" /> {T`Location`}</span>
99
+
100
+ const filters = _.clone(this.props.filters) || []
101
+
102
+ if (this.props.design.filter != null) {
103
+ const exprCompiler = new ExprCompiler(this.props.schema)
104
+ const jsonql = exprCompiler.compileExpr({ expr: this.props.design.filter, tableAlias: "{alias}" })
105
+ if (jsonql) {
106
+ filters.push({ table: (this.props.design.filter as OpExpr).table, jsonql })
107
+ }
108
+ }
109
+
110
+ return (
111
+ <div className="mb-3">
112
+ <label className="text-muted">{title}</label>
113
+ <div style={{ marginLeft: 10 }}>
114
+ <AxisComponent
115
+ schema={this.props.schema}
116
+ dataSource={this.props.dataSource}
117
+ table={this.props.design.table}
118
+ types={["geometry"]}
119
+ aggrNeed="none"
120
+ value={this.props.design.axes.geometry}
121
+ onChange={this.handleGeometryAxisChange}
122
+ filters={filters}
123
+ />
124
+ </div>
125
+ </div>
126
+ )
127
+ }
128
+
129
+ renderColor() {
130
+ if (!this.props.design.axes.geometry) {
131
+ return
132
+ }
133
+
134
+ const filters = _.clone(this.props.filters) || []
135
+
136
+ if (this.props.design.filter != null) {
137
+ const exprCompiler = new ExprCompiler(this.props.schema)
138
+ const jsonql = exprCompiler.compileExpr({ expr: this.props.design.filter, tableAlias: "{alias}" })
139
+ if (jsonql) {
140
+ filters.push({ table: (this.props.design.filter as OpExpr).table, jsonql })
141
+ }
142
+ }
143
+
144
+ return (
145
+ <div>
146
+ {!this.props.design.axes.color ? (
147
+ <div className="mb-3">
148
+ <label className="text-muted"><span className="fas fa-tint" />{T`Color`}</label>
149
+ <div>
150
+ <ColorComponent
151
+ color={this.props.design.color}
152
+ onChange={this.handleColorChange}
153
+ />
154
+ </div>
155
+ </div>
156
+ ) : undefined}
157
+
158
+ <div className="mb-3">
159
+ <label className="text-muted"><span className="fas fa-tint" />{T`Color By Data`}</label>
160
+ <AxisComponent
161
+ schema={this.props.schema}
162
+ dataSource={this.props.dataSource}
163
+ table={this.props.design.table}
164
+ types={["text", "enum", "boolean", "date"]}
165
+ aggrNeed="none"
166
+ value={this.props.design.axes.color}
167
+ defaultColor={this.props.design.color}
168
+ showColorMap={true}
169
+ onChange={this.handleColorAxisChange}
170
+ allowExcludedValues={true}
171
+ filters={filters}
172
+ />
173
+ </div>
174
+ </div>
175
+ )
176
+ }
177
+
178
+ renderSymbol() {
179
+ if (!this.props.design.axes.geometry) {
180
+ return
181
+ }
182
+
183
+ return <MarkerSymbolSelectComponent symbol={this.props.design.symbol} onChange={this.handleSymbolChange} />
184
+ }
185
+
186
+ renderMarkerSize() {
187
+ if (!this.props.design.axes.geometry) {
188
+ return
189
+ }
190
+
191
+ return (
192
+ <div className="mb-3">
193
+ <label className="text-muted">{T`Marker Size`}</label>
194
+ <ui.Select
195
+ value={this.props.design.markerSize || 10}
196
+ options={[
197
+ { value: 5, label: T`Extra small` },
198
+ { value: 8, label: T`Small` },
199
+ { value: 10, label: T`Normal` },
200
+ { value: 13, label: T`Large` },
201
+ { value: 16, label: T`Extra large` }
202
+ ]}
203
+ onChange={this.handleMarkerSizeChange}
204
+ />
205
+ </div>
206
+ )
207
+ }
208
+
209
+ renderLineWidth() {
210
+ if (!this.props.design.axes.geometry) {
211
+ return
212
+ }
213
+
214
+ return (
215
+ <div className="mb-3">
216
+ <label className="text-muted">{T`Line Width (for shapes)`}</label>
217
+ <ui.Select
218
+ value={this.props.design.lineWidth != null ? this.props.design.lineWidth : 3}
219
+ options={[
220
+ { value: 0, label: T`None` },
221
+ { value: 1, label: T`1 pixel` },
222
+ { value: 2, label: T`2 pixels` },
223
+ { value: 3, label: T`3 pixels` },
224
+ { value: 4, label: T`4 pixels` },
225
+ { value: 5, label: T`5 pixels` },
226
+ { value: 6, label: T`6 pixels` }
227
+ ]}
228
+ onChange={this.handleLineWidthChange}
229
+ />
230
+ </div>
231
+ )
232
+ }
233
+
234
+ renderPolygonBorderColor() {
235
+ if (!this.props.design.axes.geometry) {
236
+ return
237
+ }
238
+
239
+ return (
240
+ <div className="mb-3">
241
+ <label className="text-muted">{T`Polygon border color (blank for same as fill color)`}</label>
242
+ <div>
243
+ <ColorComponent
244
+ color={this.props.design.polygonBorderColor}
245
+ onChange={this.handlePolygonBorderColorChange}
246
+ />
247
+ </div>
248
+ </div>
249
+ )
250
+ }
251
+
252
+ renderPolygonFillOpacity() {
253
+ if (!this.props.design.axes.geometry) {
254
+ return
255
+ }
256
+
257
+ const opacity = this.props.design.polygonFillOpacity != null ? this.props.design.polygonFillOpacity : 0.25
258
+
259
+ return (
260
+ <div className="mb-3">
261
+ <label className="text-muted"><span>{T`Polygon Fill Opacity: ${Math.round(opacity * 100)}%`}</span></label>
262
+ <div style={{ padding: "10px" }}>
263
+ <Rcslider
264
+ min={0}
265
+ max={100}
266
+ step={1}
267
+ tipTransitionName="rc-slider-tooltip-zoom-down"
268
+ value={opacity * 100}
269
+ onChange={this.handlePolygonFillOpacityChange}
270
+ />
271
+ </div>
272
+ </div>
273
+ )
274
+ }
275
+
276
+ renderFilter() {
277
+ // If no data, hide
278
+ if (!this.props.design.axes.geometry) {
279
+ return null
280
+ }
281
+
282
+ return (
283
+ <div className="mb-3">
284
+ <label className="text-muted"><span className="fas fa-filter" />{T`Filters`}</label>
285
+ <div style={{ marginLeft: 8 }}>
286
+ <FilterExprComponent
287
+ schema={this.props.schema}
288
+ dataSource={this.props.dataSource}
289
+ onChange={this.handleFilterChange}
290
+ table={this.props.design.table}
291
+ value={this.props.design.filter}
292
+ />
293
+ </div>
294
+ </div>
295
+ )
296
+ }
297
+
298
+ renderPopup() {
299
+ if (!this.props.design.table) {
300
+ return null
301
+ }
302
+
303
+ return (
304
+ <EditPopupComponent
305
+ design={this.props.design}
306
+ onDesignChange={this.props.onDesignChange}
307
+ schema={this.props.schema}
308
+ dataSource={this.props.dataSource}
309
+ table={this.props.design.table}
310
+ idTable={this.props.design.table}
311
+ defaultPopupFilterJoins={PopupFilterJoinsUtils.createDefaultPopupFilterJoins(this.props.design.table)}
312
+ />
313
+ )
314
+ }
315
+
316
+ renderHoverOver() {
317
+ if (!this.props.design.table) {
318
+ return null
319
+ }
320
+
321
+ return (
322
+ <EditHoverOver
323
+ design={this.props.design}
324
+ onDesignChange={this.props.onDesignChange}
325
+ schema={this.props.schema}
326
+ dataSource={this.props.dataSource}
327
+ table={this.props.design.table}
328
+ idTable={this.props.design.table}
329
+ defaultPopupFilterJoins={PopupFilterJoinsUtils.createDefaultPopupFilterJoins(this.props.design.table)}
330
+ aggrStatuses={["individual", "literal"]}
331
+ />
332
+ )
333
+ }
334
+
335
+ render() {
336
+ return (
337
+ <div>
338
+ {this.renderTable()}
339
+ {this.renderGeometryAxis()}
340
+ {this.renderColor()}
341
+ {this.renderSymbol()}
342
+ {this.renderMarkerSize()}
343
+ <ui.CollapsibleSection
344
+ label={T`Shape Options`}
345
+ labelMuted={true}
346
+ >
347
+ {this.renderLineWidth()}
348
+ {this.renderPolygonBorderColor()}
349
+ {this.renderPolygonFillOpacity()}
350
+ </ui.CollapsibleSection>
351
+ {this.renderFilter()}
352
+ {this.renderPopup()}
353
+ {this.renderHoverOver()}
354
+ {this.props.design.table ? (
355
+ <ZoomLevelsComponent design={this.props.design} onDesignChange={this.props.onDesignChange} />
356
+ ) : undefined}
357
+ </div>
358
+ )
359
+ }
360
+ }
@@ -178,7 +178,7 @@ export default class RasterMapViewComponent extends React.Component<
178
178
  filters: this.getCompiledFilters(),
179
179
  dataSource: this.props.dataSource,
180
180
  locale: this.context,
181
- translate: this.props.translate ?? (() => ""),
181
+ translate: this.props.translate ?? ((input: string) => input),
182
182
  onHide: () => this.setState({ legendHidden: true }),
183
183
  zoom: null
184
184
  })
@@ -214,12 +214,6 @@ class ServerLayerDataSource implements MapLayerDataSource {
214
214
 
215
215
  let url = `${this.options.apiUrl}maps/tiles/{z}/{x}/{y}.${extension}?` + querystring.stringify(query)
216
216
 
217
- // Add subdomains: {s} will be substituted with "a", "b" or "c" in leaflet for api.mwater.co only.
218
- // Used to speed queries
219
- if (url.match(/^https:\/\/api\.mwater\.co\//)) {
220
- url = url.replace(/^https:\/\/api\.mwater\.co\//, "https://{s}-api.mwater.co/")
221
- }
222
-
223
217
  return url
224
218
  }
225
219
 
@@ -228,12 +222,6 @@ class ServerLayerDataSource implements MapLayerDataSource {
228
222
  let where
229
223
  let url = `${this.options.apiUrl}maps/tiles/{z}/{x}/{y}.${extension}?type=${design.type}&radius=1000`
230
224
 
231
- // Add subdomains: {s} will be substituted with "a", "b" or "c" in leaflet for api.mwater.co only.
232
- // Used to speed queries
233
- if (url.match(/^https:\/\/api\.mwater\.co\//)) {
234
- url = url.replace(/^https:\/\/api\.mwater\.co\//, "https://{s}-api.mwater.co/")
235
- }
236
-
237
225
  if (this.options.client) {
238
226
  url += `&client=${this.options.client}`
239
227
  }
@@ -261,6 +249,41 @@ class ServerLayerDataSource implements MapLayerDataSource {
261
249
 
262
250
  return url
263
251
  }
252
+
253
+ /** Gets hover over data for hover over items
254
+ * @param design The design of the layer
255
+ * @param data The data of the current item being hovered over. e.g. { id: 123 }
256
+ * @param filters The filters to apply to the layer does not include filters that narrow down to a specific item
257
+ * @returns A promise that resolves to the hover over data, indexed by the id of the hover over item
258
+ */
259
+ async getHoverOverData(design: any, data: any, filters: JsonQLFilter[]): Promise<{ [key: string]: any }> {
260
+ const query = {
261
+ client: this.options.client,
262
+ share: this.options.share,
263
+ filters: compressJson(filters || []),
264
+ data: compressJson(data),
265
+ rev: this.options.rev
266
+ }
267
+
268
+ const url =
269
+ `${this.options.apiUrl}maps/${this.options.mapId}/layers/${this.options.layerView.id}/hoverdata?` +
270
+ querystring.stringify(query)
271
+
272
+ const response = await fetch(url, {
273
+ method: "GET",
274
+ headers: {
275
+ Accept: "application/json"
276
+ }
277
+ })
278
+
279
+ if (!response.ok) {
280
+ const errorText = await response.text()
281
+ console.error(errorText)
282
+ throw new Error(`Error fetching hover data: ${response.statusText}`)
283
+ }
284
+
285
+ return await response.json()
286
+ }
264
287
  }
265
288
 
266
289
  interface ServerMapLayerPopupWidgetDataSourceOptions {
@@ -1,12 +1,10 @@
1
1
  import _, { find } from "lodash"
2
2
  import { LayerSpecification, MapLayerMouseEvent } from "maplibre-gl"
3
- import { DataSource, Schema } from "@mwater/expressions"
4
3
  import React, { CSSProperties, ReactNode, useEffect, useMemo, useState } from "react"
5
4
  import { useRef } from "react"
6
5
  import { JsonQLFilter } from "../JsonQLFilter"
7
6
  import { default as LayerFactory } from "./LayerFactory"
8
- import { MapBounds, MapDesign, MapLayerView } from "./MapDesign"
9
- import { MapDataSource } from "./MapDataSource"
7
+ import { MapBounds, MapLayerView } from "./MapDesign"
10
8
  import ModalPopupComponent from "@mwater/react-library/lib/ModalPopupComponent"
11
9
  import { useStableCallback } from "@mwater/react-library/lib/useStableCallback"
12
10
  import {
@@ -76,7 +74,7 @@ export function VectorMapViewComponent(props: VectorMapViewComponentProps) {
76
74
  // Locale to use
77
75
  const locale = props.locale || props.design.locale || "en"
78
76
 
79
- // Translate function to use TODO
77
+ // Translate function to use
80
78
  const translate = props.translate || ((input: string) => input)
81
79
 
82
80
  // Last feature that mouse entered
@@ -278,18 +276,9 @@ export function VectorMapViewComponent(props: VectorMapViewComponentProps) {
278
276
  } else {
279
277
  const tileUrl = props.mapDataSource.getLayerDataSource(layerView.id).getTileUrl(design, [])
280
278
  if (tileUrl) {
281
- // Replace "{s}" with "a", "b", "c"
282
- let tiles: string[] = []
283
-
284
- if (tileUrl.includes("{s}")) {
285
- tiles = [tileUrl.replace("{s}", "a"), tileUrl.replace("{s}", "b"), tileUrl.replace("{s}", "c")]
286
- } else {
287
- tiles = [tileUrl]
288
- }
289
-
290
279
  newSources[layerView.id] = {
291
280
  type: "raster",
292
- tiles,
281
+ tiles: [tileUrl],
293
282
  tileSize: 256
294
283
  }
295
284
 
@@ -505,13 +494,13 @@ export function VectorMapViewComponent(props: VectorMapViewComponentProps) {
505
494
  }
506
495
 
507
496
  if (!props.design.autoBounds && props.design.bounds) {
508
- // If we set the new bounds, do not update map bounds
497
+ // If we set the new bounds, do not update map bounds unless they differ by more than 0.0001 degrees (roughly 10m)
509
498
  if (
510
499
  boundsRef.current == null ||
511
- props.design.bounds.n != boundsRef.current.n ||
512
- props.design.bounds.e != boundsRef.current.e ||
513
- props.design.bounds.s != boundsRef.current.s ||
514
- props.design.bounds.w != boundsRef.current.w
500
+ Math.abs(props.design.bounds.n - boundsRef.current.n) > 0.0001 ||
501
+ Math.abs(props.design.bounds.e - boundsRef.current.e) > 0.0001 ||
502
+ Math.abs(props.design.bounds.s - boundsRef.current.s) > 0.0001 ||
503
+ Math.abs(props.design.bounds.w - boundsRef.current.w) > 0.0001
515
504
  ) {
516
505
  map.fitBounds([props.design.bounds.w, props.design.bounds.s, props.design.bounds.e, props.design.bounds.n])
517
506
  boundsRef.current = props.design.bounds
package/src/maps/maps.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { JsonQLQuery } from "@mwater/jsonql"
2
2
  import { Expr } from "@mwater/expressions"
3
+ import { ReactNode } from "react"
3
4
 
4
5
  export interface LayerDefinition {
5
6
  layers: Array<{
@@ -20,15 +21,16 @@ export interface LayerDefinition {
20
21
  }
21
22
  }
22
23
 
24
+ /** Results from onGridClick that can be used to display a popup */
23
25
  export type OnGridClickResults = {
24
26
  scope?: any
25
27
  row?: { tableId: string; primaryKey: any }
26
28
  popup?: React.ReactElement<{}>
27
29
  } | null
28
30
 
31
+ /** Results from onGridHover that can be used to display a hover over */
29
32
  export type OnGridHoverResults = {
30
- scope?: any
31
- hoverOver?: React.ReactElement<{}>
33
+ hoverOver?: ReactNode
32
34
  } | null
33
35
 
34
36
  /** Item in hover over */