@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
@@ -39,51 +39,54 @@ export default class ExprCellComponent extends React.Component<ExprCellComponent
39
39
  return <a href={url} key={id} target="_blank" style={{ paddingLeft: 5, paddingRight: 5 }}>{T`Image`}</a>
40
40
  }
41
41
 
42
- render() {
43
- let node
44
- const exprUtils = new ExprUtils(this.props.schema)
42
+ renderCellContent() {
45
43
  let { value } = this.props
46
44
 
45
+ const exprUtils = new ExprUtils(this.props.schema)
46
+
47
47
  if (value == null || !this.props.expr) {
48
- node = null
48
+ return null
49
49
  } else {
50
50
  // Parse if should be JSON
51
51
  if (["image", "imagelist", "geometry", "text[]"].includes(this.props.exprType) && _.isString(value)) {
52
- value = JSON.parse(value)
52
+ try {
53
+ value = JSON.parse(value)
54
+ } catch (e) {
55
+ console.error("Error parsing JSON", e)
56
+ return "???"
57
+ }
53
58
  }
54
59
 
55
60
  // Format if possible
56
61
  if (canFormatType(this.props.exprType)) {
57
- node = formatValue(this.props.exprType, value, this.props.format)
62
+ return formatValue(this.props.exprType, value, this.props.format)
58
63
  } else {
59
64
  // Convert to node based on type
60
65
  switch (this.props.exprType) {
61
66
  case "text":
62
- node = <Linkify properties={{ target: "_blank" }}>{value}</Linkify>
63
- break
67
+ return <Linkify properties={{ target: "_blank" }}>{value}</Linkify>
64
68
  case "boolean":
65
69
  case "enum":
66
70
  case "enumset":
67
71
  case "text[]":
68
- node = exprUtils.stringifyExprLiteral(this.props.expr, value, this.props.locale)
69
- break
72
+ return exprUtils.stringifyExprLiteral(this.props.expr, value, this.props.locale)
70
73
  case "date":
71
- node = moment(value, "YYYY-MM-DD").format("ll")
72
- break
74
+ return moment(value, "YYYY-MM-DD").format("ll")
73
75
  case "datetime":
74
- node = moment(value, moment.ISO_8601).format("lll")
75
- break
76
+ return moment(value, moment.ISO_8601).format("lll")
76
77
  case "image":
77
- node = this.renderImage(value.id)
78
- break
78
+ return this.renderImage(value.id)
79
79
  case "imagelist":
80
- node = _.map(value, (v: any) => this.renderImage(v.id))
81
- break
80
+ return _.map(value, (v: any) => this.renderImage(v.id))
82
81
  default:
83
- node = "" + value
82
+ return "" + value
84
83
  }
85
84
  }
86
85
  }
86
+ }
87
+
88
+ render() {
89
+ const content = this.renderCellContent()
87
90
 
88
91
  return (
89
92
  <div
@@ -101,7 +104,7 @@ export default class ExprCellComponent extends React.Component<ExprCellComponent
101
104
  onClick={this.props.onClick}
102
105
  onDoubleClick={this.props.onDoubleClick}
103
106
  >
104
- {node}
107
+ {content}
105
108
  </div>
106
109
  )
107
110
  }
@@ -1,11 +1,9 @@
1
- import PropTypes from "prop-types"
2
1
  import _ from "lodash"
3
2
  import React from "react"
4
- const R = React.createElement
5
-
6
- import { DataSource, ExprUtils, Schema } from "@mwater/expressions"
3
+ import { DataSource, Schema } from "@mwater/expressions"
7
4
  import { ExprComponent } from "@mwater/expressions-ui"
8
- import { Checkbox } from "@mwater/react-library/lib/bootstrap"
5
+ import { Toggle } from "@mwater/react-library/lib/bootstrap"
6
+ import { DatagridDesignOrderBy } from "./DatagridDesign"
9
7
 
10
8
  export interface OrderBysDesignerComponentProps {
11
9
  /** schema to use */
@@ -13,10 +11,9 @@ export interface OrderBysDesignerComponentProps {
13
11
  /** dataSource to use */
14
12
  dataSource: DataSource
15
13
  table: string
16
- /** Columns list See README.md of this folder */
17
- orderBys: any
14
+ orderBys: DatagridDesignOrderBy[]
18
15
  /** Called when columns changes */
19
- onChange: any
16
+ onChange: (orderBys: DatagridDesignOrderBy[]) => void
20
17
  }
21
18
 
22
19
  // Edits an orderBys which is a list of expressions and directions. See README.md
@@ -42,40 +39,38 @@ export default class OrderBysDesignerComponent extends React.Component<OrderBysD
42
39
  }
43
40
 
44
41
  render() {
45
- return R(
46
- "div",
47
- null,
48
- _.map(this.props.orderBys, (orderBy, index) => {
49
- return R(OrderByDesignerComponent, {
50
- key: index,
51
- schema: this.props.schema,
52
- table: this.props.table,
53
- dataSource: this.props.dataSource,
54
- orderBy,
55
- onChange: this.handleChange.bind(null, index),
56
- onRemove: this.handleRemove.bind(null, index)
57
- })
58
- }),
42
+ return (
43
+ <div>
44
+ {_.map(this.props.orderBys, (orderBy, index) => {
45
+ return <OrderByDesignerComponent
46
+ key={index}
47
+ schema={this.props.schema}
48
+ table={this.props.table}
49
+ dataSource={this.props.dataSource}
50
+ orderBy={orderBy}
51
+ onChange={this.handleChange.bind(null, index)}
52
+ onRemove={this.handleRemove.bind(null, index)}
53
+ />
54
+ })}
59
55
 
60
- R(
61
- "button",
62
- {
63
- key: "add",
64
- type: "button",
65
- className: "btn btn-link",
66
- onClick: this.handleAdd
67
- },
68
- R("span", { className: "fas fa-plus" }),
69
- " " + T`Add Ordering`
70
- )
56
+ <button
57
+ key="add"
58
+ type="button"
59
+ className="btn btn-link"
60
+ onClick={this.handleAdd}
61
+ >
62
+ <span className="fas fa-plus" />
63
+ {" " + T`Add Ordering`}
64
+ </button>
65
+ </div>
71
66
  )
72
67
  }
73
68
  }
74
69
 
75
70
  interface OrderByDesignerComponentProps {
76
- orderBy: any
77
- onChange: any
78
- onRemove: any
71
+ orderBy: DatagridDesignOrderBy
72
+ onChange: (orderBy: DatagridDesignOrderBy) => void
73
+ onRemove: () => void
79
74
  schema: Schema
80
75
  dataSource: DataSource
81
76
  table?: string
@@ -86,43 +81,39 @@ class OrderByDesignerComponent extends React.Component<OrderByDesignerComponentP
86
81
  return this.props.onChange(_.extend({}, this.props.orderBy, { expr }))
87
82
  }
88
83
 
89
- handleDirectionChange = (value: any) => {
90
- return this.props.onChange(_.extend({}, this.props.orderBy, { direction: value ? "desc" : "asc" }))
84
+ handleDirectionChange = (direction: string) => {
85
+ return this.props.onChange(_.extend({}, this.props.orderBy, { direction }))
91
86
  }
92
87
 
93
88
  render() {
94
- return R(
95
- "div",
96
- { className: "row" },
97
- R(
98
- "div",
99
- { className: "col-7" },
100
- R(ExprComponent, {
101
- schema: this.props.schema,
102
- dataSource: this.props.dataSource,
103
- table: this.props.table,
104
- types: ["text", "number", "boolean", "date", "datetime"],
105
- aggrStatuses: ["individual", "literal", "aggregate"],
106
- value: this.props.orderBy.expr,
107
- onChange: this.handleExprChange
108
- })
109
- ),
110
- R(
111
- "div",
112
- { className: "col-3" },
113
- <Checkbox inline value={this.props.orderBy.direction === "desc"} onChange={this.handleDirectionChange}>
114
- {T`Reverse`}
115
- </Checkbox>
116
- ),
117
- R(
118
- "div",
119
- { className: "col-1" },
120
- R(
121
- "button",
122
- { className: "btn btn-sm btn-link", type: "button", onClick: this.props.onRemove },
123
- R("span", { className: "fas fa-times" })
124
- )
125
- )
89
+ return (
90
+ <div style={{ display: "flex", alignItems: "center", gap: "8px", marginBottom: "8px" }}>
91
+ <div style={{ flex: 1 }}>
92
+ <ExprComponent
93
+ schema={this.props.schema}
94
+ dataSource={this.props.dataSource}
95
+ table={this.props.table}
96
+ types={["text", "number", "boolean", "date", "datetime"]}
97
+ aggrStatuses={["individual", "literal", "aggregate"]}
98
+ value={this.props.orderBy.expr}
99
+ onChange={this.handleExprChange}
100
+ />
101
+ </div>
102
+ <div style={{ display: "flex", alignItems: "center", gap: "8px" }}>
103
+ <Toggle
104
+ size="xs"
105
+ value={this.props.orderBy.direction}
106
+ onChange={this.handleDirectionChange}
107
+ options={[
108
+ { value: "asc", label: T`Ascending` },
109
+ { value: "desc", label: T`Descending` }
110
+ ]}
111
+ />
112
+ <button className="btn btn-sm btn-link" type="button" onClick={this.props.onRemove}>
113
+ <span className="fas fa-times" />
114
+ </button>
115
+ </div>
116
+ </div>
126
117
  )
127
118
  }
128
119
  }
package/src/index.css CHANGED
@@ -55,6 +55,12 @@ Lato, Lora, Inter, Merriweather, Roboto
55
55
  }
56
56
  }
57
57
 
58
+ @media only screen and (max-width: 800px) {
59
+ .hide-800px {
60
+ display: none;
61
+ }
62
+ }
63
+
58
64
  /* Dashed thresholds */
59
65
  .bb-grid line {
60
66
  stroke-dasharray: 3;
@@ -133,6 +139,20 @@ Lato, Lora, Inter, Merriweather, Roboto
133
139
  visibility: visible;
134
140
  }
135
141
 
142
+ /* Use these to make a grandchild that displays only when parent is hovered */
143
+ .hover-display-parent > * > .hover-display-grandchild {
144
+ visibility: hidden;
145
+ }
146
+
147
+ .hover-display-parent:hover > * > .hover-display-grandchild {
148
+ visibility: visible;
149
+ }
150
+
151
+ /* Use these to set a faint background on hover */
152
+ .hover-grey:hover {
153
+ background-color: #f8f8f8;
154
+ }
155
+
136
156
  .bb-title {
137
157
  font: 14px sans-serif;
138
158
  font-weight: bold;
@@ -342,6 +362,29 @@ Lato, Lora, Inter, Merriweather, Roboto
342
362
  background-color: #363b3e;
343
363
  padding: 5px;
344
364
  padding-top: 6px;
365
+ transform: translateX(-100%);
366
+ animation: slideIn 0.3s ease-in-out;
367
+ }
368
+
369
+ @keyframes slideIn {
370
+ from {
371
+ transform: translateX(-100%);
372
+ }
373
+ to {
374
+ transform: translateX(0);
375
+ }
376
+ }
377
+
378
+ .mwater-visualization-palette-container {
379
+ position: absolute;
380
+ top: 0;
381
+ left: 0;
382
+ height: 100%;
383
+ z-index: 1000;
384
+ }
385
+
386
+ .mwater-visualization-palette-container:not(.hidden) .mwater-visualization-palette {
387
+ transform: translateX(0);
345
388
  }
346
389
 
347
390
  .mwater-visualization-palette-item {
@@ -543,11 +586,11 @@ Lato, Lora, Inter, Merriweather, Roboto
543
586
  background-color: rgba(0, 0, 0, 0.075);
544
587
  }
545
588
 
546
- ._mviz-move:hover {
589
+ .mwater-visualization-cursor-hover:hover {
547
590
  cursor: move;
548
591
  }
549
592
 
550
- ._mviz-map-hover-content {
593
+ .mwater-visualization-map-hover-content {
551
594
  display: grid;
552
595
  grid-template-columns: 1fr 2fr;
553
596
  grid-auto-rows: min-content;
package/src/index.ts CHANGED
@@ -1,10 +1,5 @@
1
- export {
2
- default as LeafletMapComponent,
3
- MapBounds,
4
- TileLayer,
5
- GeoJsonLayer,
6
- MapLayer
7
- } from "./maps/LeafletMapComponent"
1
+ export { default as LeafletMapComponent } from "./maps/LeafletMapComponent"
2
+ export type { MapBounds, TileLayer, GeoJsonLayer, MapLayer } from "./maps/LeafletMapComponent"
8
3
 
9
4
  export { default as DateRangeComponent } from "./DateRangeComponent"
10
5
 
@@ -18,7 +13,7 @@ export { default as DashboardComponent } from "./dashboards/DashboardComponent"
18
13
  export { default as DashboardDataSource } from "./dashboards/DashboardDataSource"
19
14
  export { default as DirectDashboardDataSource } from "./dashboards/DirectDashboardDataSource"
20
15
  export * from "./dashboards/DashboardDesign"
21
- export { MapDesign, MapLayerView } from "./maps/MapDesign"
16
+ export type { MapDesign, MapLayerView } from "./maps/MapDesign"
22
17
 
23
18
  export { default as compressJson } from "./compressJson"
24
19
 
@@ -32,7 +27,7 @@ export { default as Widget } from "./widgets/Widget"
32
27
  export { default as DatagridUtils } from "./datagrids/DatagridUtils"
33
28
 
34
29
  export * from "./maps/MapViewComponent"
35
- export { MapScope } from "./maps/MapUtils"
30
+ export type { MapScope } from "./maps/MapUtils"
36
31
 
37
32
  export { languages } from "./languages"
38
33
 
@@ -41,7 +36,7 @@ export { default as MWaterContextComponent } from "./MWaterContextComponent"
41
36
 
42
37
  export { default as mWaterLoader } from "./mWaterLoader"
43
38
 
44
- export { WidgetDataSource } from "./widgets/WidgetDataSource"
39
+ export type { WidgetDataSource } from "./widgets/WidgetDataSource"
45
40
  export { default as DirectWidgetDataSource } from "./widgets/DirectWidgetDataSource"
46
41
 
47
42
  import "leaflet/dist/leaflet.css"
@@ -55,7 +50,6 @@ export { setMapTilerApiKey } from "./maps/vectorMaps"
55
50
 
56
51
  export { default as UndoStack } from "./UndoStack"
57
52
  export { default as DashboardViewComponent } from "./dashboards/DashboardViewComponent"
58
- export let BingLayer = require("./maps/BingLayer")
59
53
  export let UtfGridLayer = require("./maps/UtfGridLayer")
60
54
  export { default as LayerFactory } from "./maps/LayerFactory"
61
55
  export { default as MapDesignerComponent } from "./maps/MapDesignerComponent"
@@ -38,11 +38,39 @@ export interface BlocksDisplayComponentProps {
38
38
  cantPasteMessage?: string
39
39
  }
40
40
 
41
+ interface BlocksDisplayComponentState {
42
+ isPaletteVisible: boolean
43
+ isManuallyHidden: boolean
44
+ }
45
+
41
46
  /**
42
47
  Renders the complete layout of the blocks and also optionally a palette to the left
43
48
  that can be used to drag new items into the layout. Palette is only displayed if onItemsChange is not null
44
49
  */
45
- class BlocksDisplayComponent extends React.Component<BlocksDisplayComponentProps> {
50
+ class BlocksDisplayComponent extends React.Component<BlocksDisplayComponentProps, BlocksDisplayComponentState> {
51
+ state: BlocksDisplayComponentState = {
52
+ isPaletteVisible: false,
53
+ isManuallyHidden: false
54
+ }
55
+
56
+ componentDidUpdate(prevProps: BlocksDisplayComponentProps) {
57
+ // If editing state changes (onItemsChange becomes available/unavailable)
58
+ if (prevProps.onItemsChange !== this.props.onItemsChange) {
59
+ if (this.props.onItemsChange && !this.state.isManuallyHidden) {
60
+ this.setState({ isPaletteVisible: true })
61
+ } else if (!this.props.onItemsChange) {
62
+ this.setState({ isPaletteVisible: false, isManuallyHidden: false })
63
+ }
64
+ }
65
+ }
66
+
67
+ handlePaletteToggle = () => {
68
+ this.setState(prevState => ({
69
+ isPaletteVisible: !prevState.isPaletteVisible,
70
+ isManuallyHidden: !prevState.isManuallyHidden
71
+ }))
72
+ }
73
+
46
74
  handleBlockDrop = (sourceBlock: LayoutBlock, targetBlock: LayoutBlock, side: "top" | "left" | "right" | "bottom") => {
47
75
  // Remove source from items
48
76
  let items = blockUtils.removeBlock(this.props.items, sourceBlock)!
@@ -219,8 +247,32 @@ class BlocksDisplayComponent extends React.Component<BlocksDisplayComponentProps
219
247
 
220
248
  renderPalette() {
221
249
  return (
222
- <div key="palette" style={{ width: 141, height: "100%", position: "absolute", top: 0, left: 0 }}>
250
+ <div key="palette" style={{
251
+ width: 141,
252
+ height: "100%",
253
+ position: "absolute",
254
+ top: 0,
255
+ left: 0,
256
+ transition: "transform 0.3s ease-in-out",
257
+ transform: this.state.isPaletteVisible ? "translateX(0)" : "translateX(-100%)"
258
+ }}>
223
259
  <div className="mwater-visualization-palette" style={{ height: "100%" }}>
260
+ <div
261
+ style={{
262
+ position: "absolute",
263
+ right: -14,
264
+ top: 0,
265
+ background: "#363b3e",
266
+ color: "white",
267
+ padding: "5px 3px 5px 5px",
268
+ cursor: "pointer",
269
+ borderRadius: "0 3px 3px 0",
270
+ zIndex: 1001
271
+ }}
272
+ onClick={this.handlePaletteToggle}
273
+ >
274
+ <i className={`fa fa-chevron-${this.state.isPaletteVisible ? 'left' : 'right'}`} />
275
+ </div>
224
276
  <PaletteItemComponent
225
277
  createItem={this.createBlockItem({ type: "widget", widgetType: "Text", design: { style: "title" } })}
226
278
  title={<i className="fa fa-font" />}
@@ -345,16 +397,19 @@ class BlocksDisplayComponent extends React.Component<BlocksDisplayComponentProps
345
397
  style={{ width: "100%", height: "100%", overflow: "hidden", position: "relative" }}
346
398
  layoutOptions={layoutOptions}
347
399
  >
348
- {this.renderPalette()}
400
+ <div className="mwater-visualization-palette-container">
401
+ {this.renderPalette()}
402
+ </div>
349
403
  <div
350
404
  style={{
351
405
  position: "absolute",
352
- left: 141,
406
+ left: this.state.isPaletteVisible ? 141 : 0,
353
407
  top: 0,
354
408
  bottom: 0,
355
409
  right: 0,
356
410
  overflowX: "auto",
357
- overflowY: "scroll"
411
+ overflowY: "scroll",
412
+ transition: "left 0.3s ease-in-out"
358
413
  }}
359
414
  className={`mwater-visualization-block-parent-outer mwater-visualization-block-editing`}
360
415
  >
@@ -18,6 +18,7 @@ import { getDefaultLayoutOptions } from "../dashboards/layoutOptions"
18
18
  import Widget from "../widgets/Widget"
19
19
  import BlocksLayoutManager from "../layouts/blocks/BlocksLayoutManager"
20
20
  import { getTranslatableStringsFromLayoutManager } from "../dashboards/DashboardUtils"
21
+ import { getSimpleHoverOverData } from "./MapUtils"
21
22
 
22
23
  /** Layer which draws a buffer around geometries (i.e. a radius circle around points) */
23
24
  export default class BufferLayer extends Layer<BufferLayerDesign> {
@@ -696,29 +697,16 @@ marker-fill: ` +
696
697
  ev: { data: any; event: any },
697
698
  hoverOptions: OnGridHoverOptions<BufferLayerDesign>
698
699
  ): OnGridHoverResults {
699
- if (ev.data && ev.data.id) {
700
- const { table } = hoverOptions.design
701
- const results: OnGridHoverResults = {}
702
-
703
- // Popup
704
- if (hoverOptions.design.hoverOver) {
705
- // Create filter using popupFilterJoins
706
- const popupFilterJoins =
707
- hoverOptions.design.popupFilterJoins || PopupFilterJoinsUtils.createDefaultPopupFilterJoins(table)
708
- const popupFilters = PopupFilterJoinsUtils.createPopupFilters(
709
- popupFilterJoins,
710
- hoverOptions.schema,
711
- table,
712
- ev.data.id
713
- )
714
-
715
- results.hoverOver = React.createElement(HoverContent, {
700
+ if (ev.data && ev.data.id && hoverOptions.design.hoverOver && hoverOptions.design.hoverOver.items.length > 0) {
701
+ const results: OnGridHoverResults = {
702
+ hoverOver: React.createElement(HoverContent, {
716
703
  key: ev.data.id,
717
704
  schema: hoverOptions.schema,
718
- dataSource: hoverOptions.dataSource,
719
- table,
705
+ data: ev.data,
706
+ mapLayerDataSource: hoverOptions.layerDataSource,
707
+ design: hoverOptions.design,
720
708
  items: hoverOptions.design.hoverOver.items,
721
- filters: popupFilters,
709
+ filters: hoverOptions.filters,
722
710
  locale: hoverOptions.locale,
723
711
  translate: hoverOptions.translate
724
712
  })
@@ -881,6 +869,19 @@ marker-fill: ` +
881
869
  })
882
870
 
883
871
  draft.filter = exprCleaner.cleanExpr(design.filter || null, { table: design.table })
872
+
873
+ // Clean hover over expressions
874
+ if (design.table && design.hoverOver && design.hoverOver.items) {
875
+ for (let i = 0; i < design.hoverOver.items.length; i++) {
876
+ const item = design.hoverOver.items[i]
877
+ if (item.value) {
878
+ draft.hoverOver!.items[i].value = exprCleaner.cleanExpr(item.value || null, {
879
+ table: design.table,
880
+ aggrStatuses: ["individual", "literal"]
881
+ })
882
+ }
883
+ }
884
+ }
884
885
  })
885
886
 
886
887
  return design
@@ -950,4 +951,31 @@ marker-fill: ` +
950
951
  // Remove duplicates
951
952
  return _.uniq(strings)
952
953
  }
954
+
955
+
956
+ /** Gets hover over data for hover over items. This should be implemented by layers that have hover over items.
957
+ * It will be called on the server side if using a server map data source, or on the client side if using a direct
958
+ * map data source.
959
+ */
960
+ getHoverOverData(options: {
961
+ /** Design of the layer */
962
+ design: BufferLayerDesign,
963
+ /** Data of the current item being hovered over. e.g. { id: 123 } */
964
+ data: any,
965
+ /** Filters to apply to the hover over data, not including filtering down to the current item */
966
+ filters: JsonQLFilter[],
967
+ /** Schema to use */
968
+ schema: Schema,
969
+ /** Data source to use */
970
+ dataSource: DataSource,
971
+ }): Promise<{ [key: string]: any }> {
972
+ return getSimpleHoverOverData({
973
+ id: options.data.id,
974
+ table: options.design.table,
975
+ filters: options.filters,
976
+ schema: options.schema,
977
+ dataSource: options.dataSource,
978
+ hoverOverItems: options.design.hoverOver!.items,
979
+ })
980
+ }
953
981
  }
@@ -47,7 +47,7 @@ export interface BufferLayerDesign {
47
47
  popup: { items: LayoutBlock }
48
48
 
49
49
  /** Contains items: which is HoverOverItem[] */
50
- hoverOver: { items: HoverOverItem[] }
50
+ hoverOver?: { items: HoverOverItem[] }
51
51
 
52
52
  /** Customizable filtering for popup. See PopupFilterJoins.md */
53
53
  popupFilterJoins: PopupFilterJoins
@@ -15,7 +15,7 @@ import { Checkbox } from "@mwater/react-library/lib/bootstrap"
15
15
  import { BufferLayerDesign } from "./BufferLayerDesign"
16
16
  import { JsonQLFilter } from "../JsonQLFilter"
17
17
  import { areVectorMapsEnabled } from "./vectorMaps"
18
- import EditHoverOver from "./EditHoverOver"
18
+ import { EditHoverOver } from "./EditHoverOver"
19
19
 
20
20
  export interface BufferLayerDesignerComponentProps {
21
21
  /** Schema to use */
@@ -281,6 +281,7 @@ export default class BufferLayerDesignerComponent extends React.Component<Buffer
281
281
  table={this.props.design.table}
282
282
  idTable={this.props.design.table}
283
283
  defaultPopupFilterJoins={PopupFilterJoinsUtils.createDefaultPopupFilterJoins(this.props.design.table)}
284
+ aggrStatuses={["individual", "literal"]}
284
285
  />
285
286
  )
286
287
  }