@mwater/visualization 5.0.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 (860) hide show
  1. package/.prettierrc +11 -0
  2. package/.storybook/config.js +7 -0
  3. package/.storybook/head.html +4 -0
  4. package/.storybook/webpack.config.js +15 -0
  5. package/.vscode/launch.json +40 -0
  6. package/LICENSE +21 -0
  7. package/README.md +19 -0
  8. package/build-demo.ts +54 -0
  9. package/lib/CheckboxComponent.d.ts +15 -0
  10. package/lib/CheckboxComponent.js +25 -0
  11. package/lib/ColorComponent.d.ts +24 -0
  12. package/lib/ColorComponent.js +77 -0
  13. package/lib/ColorSchemeFactory.d.ts +8 -0
  14. package/lib/ColorSchemeFactory.js +164 -0
  15. package/lib/CsvBuilder.d.ts +5 -0
  16. package/lib/CsvBuilder.js +63 -0
  17. package/lib/DateRangeComponent.d.ts +81 -0
  18. package/lib/DateRangeComponent.js +190 -0
  19. package/lib/FiltersDesignerComponent.d.ts +25 -0
  20. package/lib/FiltersDesignerComponent.js +38 -0
  21. package/lib/ImplicitFilterBuilder.d.ts +8 -0
  22. package/lib/ImplicitFilterBuilder.js +114 -0
  23. package/lib/JsonQLFilter.d.ts +7 -0
  24. package/lib/JsonQLFilter.js +2 -0
  25. package/lib/LocaleContextInjector.d.ts +14 -0
  26. package/lib/LocaleContextInjector.js +20 -0
  27. package/lib/MWaterAddRelatedFormComponent.d.ts +25 -0
  28. package/lib/MWaterAddRelatedFormComponent.js +155 -0
  29. package/lib/MWaterAddRelatedIndicatorComponent.d.ts +31 -0
  30. package/lib/MWaterAddRelatedIndicatorComponent.js +129 -0
  31. package/lib/MWaterAssetSystemsListComponent.d.ts +17 -0
  32. package/lib/MWaterAssetSystemsListComponent.js +78 -0
  33. package/lib/MWaterCompleteTableSelectComponent.d.ts +224 -0
  34. package/lib/MWaterCompleteTableSelectComponent.js +680 -0
  35. package/lib/MWaterContextComponent.d.ts +31 -0
  36. package/lib/MWaterContextComponent.js +111 -0
  37. package/lib/MWaterCustomTablesetListComponent.d.ts +17 -0
  38. package/lib/MWaterCustomTablesetListComponent.js +87 -0
  39. package/lib/MWaterGlobalFiltersComponent.d.ts +16 -0
  40. package/lib/MWaterGlobalFiltersComponent.js +103 -0
  41. package/lib/MWaterLoaderComponent.d.ts +42 -0
  42. package/lib/MWaterLoaderComponent.js +77 -0
  43. package/lib/MWaterMetricsTableListComponent.d.ts +17 -0
  44. package/lib/MWaterMetricsTableListComponent.js +79 -0
  45. package/lib/MWaterResponsesFilterComponent.d.ts +42 -0
  46. package/lib/MWaterResponsesFilterComponent.js +145 -0
  47. package/lib/MWaterTableSelectComponent.d.ts +36 -0
  48. package/lib/MWaterTableSelectComponent.js +206 -0
  49. package/lib/MenuItemComponent.d.ts +0 -0
  50. package/lib/MenuItemComponent.js +3 -0
  51. package/lib/PopoverComponent.d.ts +15 -0
  52. package/lib/PopoverComponent.js +49 -0
  53. package/lib/RadioButtonComponent.d.ts +16 -0
  54. package/lib/RadioButtonComponent.js +25 -0
  55. package/lib/TableSelectComponent.d.ts +21 -0
  56. package/lib/TableSelectComponent.js +68 -0
  57. package/lib/UIComponents.d.ts +85 -0
  58. package/lib/UIComponents.js +195 -0
  59. package/lib/UndoStack.d.ts +11 -0
  60. package/lib/UndoStack.js +51 -0
  61. package/lib/VerticalLayoutComponent.d.ts +21 -0
  62. package/lib/VerticalLayoutComponent.js +76 -0
  63. package/lib/WidgetScope.d.ts +13 -0
  64. package/lib/WidgetScope.js +2 -0
  65. package/lib/axes/Axis.d.ts +81 -0
  66. package/lib/axes/Axis.js +2 -0
  67. package/lib/axes/AxisBuilder.d.ts +66 -0
  68. package/lib/axes/AxisBuilder.js +1202 -0
  69. package/lib/axes/AxisColorEditorComponent.d.ts +39 -0
  70. package/lib/axes/AxisColorEditorComponent.js +133 -0
  71. package/lib/axes/AxisComponent.d.ts +65 -0
  72. package/lib/axes/AxisComponent.js +359 -0
  73. package/lib/axes/BinsComponent.d.ts +21 -0
  74. package/lib/axes/BinsComponent.js +96 -0
  75. package/lib/axes/CategoryMapComponent.d.ts +41 -0
  76. package/lib/axes/CategoryMapComponent.js +175 -0
  77. package/lib/axes/ColorPaletteCollectionComponent.d.ts +17 -0
  78. package/lib/axes/ColorPaletteCollectionComponent.js +130 -0
  79. package/lib/axes/RangesComponent.d.ts +35 -0
  80. package/lib/axes/RangesComponent.js +119 -0
  81. package/lib/componenttest.d.ts +1 -0
  82. package/lib/componenttest.js +47 -0
  83. package/lib/compressJson.d.ts +4 -0
  84. package/lib/compressJson.js +19 -0
  85. package/lib/dashboards/DashboardComponent.d.ts +115 -0
  86. package/lib/dashboards/DashboardComponent.js +297 -0
  87. package/lib/dashboards/DashboardDataSource.d.ts +9 -0
  88. package/lib/dashboards/DashboardDataSource.js +14 -0
  89. package/lib/dashboards/DashboardDesign.d.ts +45 -0
  90. package/lib/dashboards/DashboardDesign.js +2 -0
  91. package/lib/dashboards/DashboardUpgrader.d.ts +4 -0
  92. package/lib/dashboards/DashboardUpgrader.js +95 -0
  93. package/lib/dashboards/DashboardUtils.d.ts +7 -0
  94. package/lib/dashboards/DashboardUtils.js +69 -0
  95. package/lib/dashboards/DashboardViewComponent.d.ts +71 -0
  96. package/lib/dashboards/DashboardViewComponent.js +235 -0
  97. package/lib/dashboards/DirectDashboardDataSource.d.ts +31 -0
  98. package/lib/dashboards/DirectDashboardDataSource.js +62 -0
  99. package/lib/dashboards/LayoutOptionsComponent.d.ts +11 -0
  100. package/lib/dashboards/LayoutOptionsComponent.js +119 -0
  101. package/lib/dashboards/README.md +13 -0
  102. package/lib/dashboards/ServerDashboardDataSource.d.ts +96 -0
  103. package/lib/dashboards/ServerDashboardDataSource.js +383 -0
  104. package/lib/dashboards/SettingsModalComponent.d.ts +33 -0
  105. package/lib/dashboards/SettingsModalComponent.js +122 -0
  106. package/lib/dashboards/WidgetComponent.d.ts +53 -0
  107. package/lib/dashboards/WidgetComponent.js +66 -0
  108. package/lib/dashboards/layoutOptions.d.ts +19 -0
  109. package/lib/dashboards/layoutOptions.js +19 -0
  110. package/lib/datagrids/DatagridComponent.d.ts +122 -0
  111. package/lib/datagrids/DatagridComponent.js +285 -0
  112. package/lib/datagrids/DatagridDataSource.d.ts +9 -0
  113. package/lib/datagrids/DatagridDataSource.js +13 -0
  114. package/lib/datagrids/DatagridDesign.d.ts +75 -0
  115. package/lib/datagrids/DatagridDesign.js +2 -0
  116. package/lib/datagrids/DatagridDesignerComponent.d.ts +114 -0
  117. package/lib/datagrids/DatagridDesignerComponent.js +389 -0
  118. package/lib/datagrids/DatagridQueryBuilder.d.ts +68 -0
  119. package/lib/datagrids/DatagridQueryBuilder.js +540 -0
  120. package/lib/datagrids/DatagridUtils.d.ts +8 -0
  121. package/lib/datagrids/DatagridUtils.js +91 -0
  122. package/lib/datagrids/DatagridViewComponent.d.ts +86 -0
  123. package/lib/datagrids/DatagridViewComponent.js +321 -0
  124. package/lib/datagrids/DirectDatagridDataSource.d.ts +20 -0
  125. package/lib/datagrids/DirectDatagridDataSource.js +62 -0
  126. package/lib/datagrids/EditExprCellComponent.d.ts +77 -0
  127. package/lib/datagrids/EditExprCellComponent.js +212 -0
  128. package/lib/datagrids/ExprCellComponent.d.ts +34 -0
  129. package/lib/datagrids/ExprCellComponent.js +81 -0
  130. package/lib/datagrids/FindReplaceModalComponent.d.ts +52 -0
  131. package/lib/datagrids/FindReplaceModalComponent.js +248 -0
  132. package/lib/datagrids/LabeledExprGenerator.d.ts +40 -0
  133. package/lib/datagrids/LabeledExprGenerator.js +252 -0
  134. package/lib/datagrids/OrderBysDesignerComponent.d.ts +22 -0
  135. package/lib/datagrids/OrderBysDesignerComponent.js +67 -0
  136. package/lib/datagrids/README.md +3 -0
  137. package/lib/datagrids/ServerDatagridDataSource.d.ts +40 -0
  138. package/lib/datagrids/ServerDatagridDataSource.js +79 -0
  139. package/lib/demo.d.ts +1 -0
  140. package/lib/demo.js +4006 -0
  141. package/lib/demoBlocks.d.ts +1 -0
  142. package/lib/demoBlocks.js +112 -0
  143. package/lib/index.css +550 -0
  144. package/lib/index.d.ts +69 -0
  145. package/lib/index.js +156 -0
  146. package/lib/injectTableAlias.d.ts +2 -0
  147. package/lib/injectTableAlias.js +30 -0
  148. package/lib/languages.d.ts +9 -0
  149. package/lib/languages.js +926 -0
  150. package/lib/layout-styles.css +263 -0
  151. package/lib/layouts/DecoratedBlockComponent.d.ts +44 -0
  152. package/lib/layouts/DecoratedBlockComponent.js +96 -0
  153. package/lib/layouts/DragSourceComponent.d.ts +2 -0
  154. package/lib/layouts/DragSourceComponent.js +26 -0
  155. package/lib/layouts/LayoutManager.d.ts +50 -0
  156. package/lib/layouts/LayoutManager.js +41 -0
  157. package/lib/layouts/blocks/BlocksDisplayComponent.d.ts +75 -0
  158. package/lib/layouts/blocks/BlocksDisplayComponent.js +336 -0
  159. package/lib/layouts/blocks/BlocksLayoutManager.d.ts +36 -0
  160. package/lib/layouts/blocks/BlocksLayoutManager.js +74 -0
  161. package/lib/layouts/blocks/ClipboardPaletteItemComponent.d.ts +9 -0
  162. package/lib/layouts/blocks/ClipboardPaletteItemComponent.js +59 -0
  163. package/lib/layouts/blocks/DraggableBlockComponent.d.ts +2 -0
  164. package/lib/layouts/blocks/DraggableBlockComponent.js +163 -0
  165. package/lib/layouts/blocks/HorizontalBlockComponent.d.ts +31 -0
  166. package/lib/layouts/blocks/HorizontalBlockComponent.js +191 -0
  167. package/lib/layouts/blocks/PaletteItemComponent.d.ts +14 -0
  168. package/lib/layouts/blocks/PaletteItemComponent.js +15 -0
  169. package/lib/layouts/blocks/README.md +11 -0
  170. package/lib/layouts/blocks/blockUtils.d.ts +22 -0
  171. package/lib/layouts/blocks/blockUtils.js +155 -0
  172. package/lib/layouts/decorated-block.css +100 -0
  173. package/lib/layouts/grid/GridLayoutComponent.d.ts +23 -0
  174. package/lib/layouts/grid/GridLayoutComponent.js +49 -0
  175. package/lib/layouts/grid/GridLayoutManager.d.ts +29 -0
  176. package/lib/layouts/grid/GridLayoutManager.js +141 -0
  177. package/lib/layouts/grid/LegoLayoutEngine.d.ts +33 -0
  178. package/lib/layouts/grid/LegoLayoutEngine.js +129 -0
  179. package/lib/layouts/grid/PaletteItemComponent.d.ts +14 -0
  180. package/lib/layouts/grid/PaletteItemComponent.js +15 -0
  181. package/lib/layouts/grid/README.md +14 -0
  182. package/lib/layouts/grid/WidgetContainerComponent.d.ts +9 -0
  183. package/lib/layouts/grid/WidgetContainerComponent.js +333 -0
  184. package/lib/mWaterLoader.d.ts +26 -0
  185. package/lib/mWaterLoader.js +55 -0
  186. package/lib/mapdemo.d.ts +0 -0
  187. package/lib/mapdemo.js +115 -0
  188. package/lib/maps/AddLayerComponent.d.ts +22 -0
  189. package/lib/maps/AddLayerComponent.js +85 -0
  190. package/lib/maps/AdminScopeAndDetailLevelComponent.d.ts +19 -0
  191. package/lib/maps/AdminScopeAndDetailLevelComponent.js +59 -0
  192. package/lib/maps/BaseLayerDesignerComponent.d.ts +28 -0
  193. package/lib/maps/BaseLayerDesignerComponent.js +57 -0
  194. package/lib/maps/BingLayer.d.ts +1 -0
  195. package/lib/maps/BingLayer.js +151 -0
  196. package/lib/maps/BufferLayer.d.ts +51 -0
  197. package/lib/maps/BufferLayer.js +816 -0
  198. package/lib/maps/BufferLayerDesign.d.ts +37 -0
  199. package/lib/maps/BufferLayerDesign.js +2 -0
  200. package/lib/maps/BufferLayerDesignerComponent.d.ts +49 -0
  201. package/lib/maps/BufferLayerDesignerComponent.js +217 -0
  202. package/lib/maps/ChoroplethLayer.d.ts +74 -0
  203. package/lib/maps/ChoroplethLayer.js +1515 -0
  204. package/lib/maps/ChoroplethLayerDesign.d.ts +56 -0
  205. package/lib/maps/ChoroplethLayerDesign.js +2 -0
  206. package/lib/maps/ChoroplethLayerDesigner.d.ts +53 -0
  207. package/lib/maps/ChoroplethLayerDesigner.js +382 -0
  208. package/lib/maps/ClusterLayer.d.ts +38 -0
  209. package/lib/maps/ClusterLayer.js +746 -0
  210. package/lib/maps/ClusterLayerDesign.d.ts +22 -0
  211. package/lib/maps/ClusterLayerDesign.js +2 -0
  212. package/lib/maps/ClusterLayerDesignerComponent.d.ts +37 -0
  213. package/lib/maps/ClusterLayerDesignerComponent.js +110 -0
  214. package/lib/maps/DetailLevelSelectComponent.d.ts +122 -0
  215. package/lib/maps/DetailLevelSelectComponent.js +91 -0
  216. package/lib/maps/DirectMapDataSource.d.ts +68 -0
  217. package/lib/maps/DirectMapDataSource.js +265 -0
  218. package/lib/maps/EditHoverOver.d.ts +18 -0
  219. package/lib/maps/EditHoverOver.js +88 -0
  220. package/lib/maps/EditPopupComponent.d.ts +26 -0
  221. package/lib/maps/EditPopupComponent.js +75 -0
  222. package/lib/maps/Grid Functions.sql +167 -0
  223. package/lib/maps/GridLayer.d.ts +48 -0
  224. package/lib/maps/GridLayer.js +684 -0
  225. package/lib/maps/GridLayerDesign.d.ts +35 -0
  226. package/lib/maps/GridLayerDesign.js +2 -0
  227. package/lib/maps/GridLayerDesigner.d.ts +38 -0
  228. package/lib/maps/GridLayerDesigner.js +229 -0
  229. package/lib/maps/HoverContent.d.ts +13 -0
  230. package/lib/maps/HoverContent.js +92 -0
  231. package/lib/maps/HtmlUrlLegend.d.ts +16 -0
  232. package/lib/maps/HtmlUrlLegend.js +38 -0
  233. package/lib/maps/Layer.d.ts +164 -0
  234. package/lib/maps/Layer.js +193 -0
  235. package/lib/maps/LayerFactory.d.ts +5 -0
  236. package/lib/maps/LayerFactory.js +47 -0
  237. package/lib/maps/LayerLegendComponent.d.ts +23 -0
  238. package/lib/maps/LayerLegendComponent.js +68 -0
  239. package/lib/maps/LayerSwitcherComponent.d.ts +7 -0
  240. package/lib/maps/LayerSwitcherComponent.js +97 -0
  241. package/lib/maps/LeafletLoading.css +24 -0
  242. package/lib/maps/LeafletLoading.d.ts +42 -0
  243. package/lib/maps/LeafletLoading.js +318 -0
  244. package/lib/maps/LeafletMapComponent.d.ts +141 -0
  245. package/lib/maps/LeafletMapComponent.js +438 -0
  246. package/lib/maps/LegendComponent.d.ts +14 -0
  247. package/lib/maps/LegendComponent.js +74 -0
  248. package/lib/maps/LegendGroup.d.ts +24 -0
  249. package/lib/maps/LegendGroup.js +86 -0
  250. package/lib/maps/MWaterServerLayer.d.ts +40 -0
  251. package/lib/maps/MWaterServerLayer.js +101 -0
  252. package/lib/maps/MapBoundsCalculator.d.ts +16 -0
  253. package/lib/maps/MapBoundsCalculator.js +85 -0
  254. package/lib/maps/MapComponent.d.ts +98 -0
  255. package/lib/maps/MapComponent.js +186 -0
  256. package/lib/maps/MapControlComponent.d.ts +17 -0
  257. package/lib/maps/MapControlComponent.js +25 -0
  258. package/lib/maps/MapDataSource.d.ts +18 -0
  259. package/lib/maps/MapDataSource.js +2 -0
  260. package/lib/maps/MapDesign.d.ts +77 -0
  261. package/lib/maps/MapDesign.js +2 -0
  262. package/lib/maps/MapDesignerComponent.d.ts +39 -0
  263. package/lib/maps/MapDesignerComponent.js +215 -0
  264. package/lib/maps/MapFiltersDesignerComponent.d.ts +21 -0
  265. package/lib/maps/MapFiltersDesignerComponent.js +70 -0
  266. package/lib/maps/MapLayerDataSource.d.ts +22 -0
  267. package/lib/maps/MapLayerDataSource.js +2 -0
  268. package/lib/maps/MapLayerViewDesignerComponent.d.ts +87 -0
  269. package/lib/maps/MapLayerViewDesignerComponent.js +151 -0
  270. package/lib/maps/MapLayersDesignerComponent.d.ts +32 -0
  271. package/lib/maps/MapLayersDesignerComponent.js +98 -0
  272. package/lib/maps/MapUtils.d.ts +21 -0
  273. package/lib/maps/MapUtils.js +119 -0
  274. package/lib/maps/MapViewComponent.d.ts +38 -0
  275. package/lib/maps/MapViewComponent.js +20 -0
  276. package/lib/maps/Maptiler-logo.png +0 -0
  277. package/lib/maps/MarkerSymbolSelectComponent.d.ts +10 -0
  278. package/lib/maps/MarkerSymbolSelectComponent.js +28 -0
  279. package/lib/maps/MarkersLayer.d.ts +66 -0
  280. package/lib/maps/MarkersLayer.js +838 -0
  281. package/lib/maps/MarkersLayerDesign.d.ts +44 -0
  282. package/lib/maps/MarkersLayerDesign.js +2 -0
  283. package/lib/maps/MarkersLayerDesignerComponent.d.ts +56 -0
  284. package/lib/maps/MarkersLayerDesignerComponent.js +269 -0
  285. package/lib/maps/PopupFilterJoinsEditComponent.d.ts +30 -0
  286. package/lib/maps/PopupFilterJoinsEditComponent.js +75 -0
  287. package/lib/maps/PopupFilterJoinsUtils.d.ts +15 -0
  288. package/lib/maps/PopupFilterJoinsUtils.js +91 -0
  289. package/lib/maps/RasterMapViewComponent.d.ts +108 -0
  290. package/lib/maps/RasterMapViewComponent.js +283 -0
  291. package/lib/maps/RegionSelectComponent.d.ts +55 -0
  292. package/lib/maps/RegionSelectComponent.js +61 -0
  293. package/lib/maps/ScopeAndDetailLevelComponent.d.ts +21 -0
  294. package/lib/maps/ScopeAndDetailLevelComponent.js +76 -0
  295. package/lib/maps/ServerMapDataSource.d.ts +86 -0
  296. package/lib/maps/ServerMapDataSource.js +273 -0
  297. package/lib/maps/SwitchableTileUrlLayer.d.ts +53 -0
  298. package/lib/maps/SwitchableTileUrlLayer.js +69 -0
  299. package/lib/maps/SwitchableTileUrlLayerDesigner.d.ts +14 -0
  300. package/lib/maps/SwitchableTileUrlLayerDesigner.js +26 -0
  301. package/lib/maps/TileUrlLayer.d.ts +40 -0
  302. package/lib/maps/TileUrlLayer.js +96 -0
  303. package/lib/maps/UtfGridLayer.d.ts +1 -0
  304. package/lib/maps/UtfGridLayer.js +216 -0
  305. package/lib/maps/VectorMapViewComponent.css +21 -0
  306. package/lib/maps/VectorMapViewComponent.d.ts +44 -0
  307. package/lib/maps/VectorMapViewComponent.js +565 -0
  308. package/lib/maps/ZoomLevelsComponent.d.ts +15 -0
  309. package/lib/maps/ZoomLevelsComponent.js +37 -0
  310. package/lib/maps/mapSymbols.d.ts +6 -0
  311. package/lib/maps/mapSymbols.js +167 -0
  312. package/lib/maps/mapboxUtils.d.ts +6 -0
  313. package/lib/maps/mapboxUtils.js +60 -0
  314. package/lib/maps/maps.d.ts +36 -0
  315. package/lib/maps/maps.js +2 -0
  316. package/lib/maps/marker-icon-2x.png +0 -0
  317. package/lib/maps/marker-icon.png +0 -0
  318. package/lib/maps/marker-shadow.png +0 -0
  319. package/lib/maps/symbols/font-awesome/asterisk.png +0 -0
  320. package/lib/maps/symbols/font-awesome/ban.png +0 -0
  321. package/lib/maps/symbols/font-awesome/beer.png +0 -0
  322. package/lib/maps/symbols/font-awesome/bell.png +0 -0
  323. package/lib/maps/symbols/font-awesome/bolt.png +0 -0
  324. package/lib/maps/symbols/font-awesome/building.png +0 -0
  325. package/lib/maps/symbols/font-awesome/bullseye.png +0 -0
  326. package/lib/maps/symbols/font-awesome/bus.png +0 -0
  327. package/lib/maps/symbols/font-awesome/caret-up.png +0 -0
  328. package/lib/maps/symbols/font-awesome/certificate.png +0 -0
  329. package/lib/maps/symbols/font-awesome/check-circle.png +0 -0
  330. package/lib/maps/symbols/font-awesome/check.png +0 -0
  331. package/lib/maps/symbols/font-awesome/chevron-circle-down.png +0 -0
  332. package/lib/maps/symbols/font-awesome/chevron-circle-up.png +0 -0
  333. package/lib/maps/symbols/font-awesome/cloud.png +0 -0
  334. package/lib/maps/symbols/font-awesome/comment.png +0 -0
  335. package/lib/maps/symbols/font-awesome/crosshairs.png +0 -0
  336. package/lib/maps/symbols/font-awesome/dot-circle-o.png +0 -0
  337. package/lib/maps/symbols/font-awesome/exclamation-circle.png +0 -0
  338. package/lib/maps/symbols/font-awesome/exclamation-triangle.png +0 -0
  339. package/lib/maps/symbols/font-awesome/female.png +0 -0
  340. package/lib/maps/symbols/font-awesome/file.png +0 -0
  341. package/lib/maps/symbols/font-awesome/flag.png +0 -0
  342. package/lib/maps/symbols/font-awesome/flask.png +0 -0
  343. package/lib/maps/symbols/font-awesome/h-square.png +0 -0
  344. package/lib/maps/symbols/font-awesome/home.png +0 -0
  345. package/lib/maps/symbols/font-awesome/info-circle.png +0 -0
  346. package/lib/maps/symbols/font-awesome/male.png +0 -0
  347. package/lib/maps/symbols/font-awesome/medkit.png +0 -0
  348. package/lib/maps/symbols/font-awesome/mobile.png +0 -0
  349. package/lib/maps/symbols/font-awesome/plus-circle.png +0 -0
  350. package/lib/maps/symbols/font-awesome/plus-square.png +0 -0
  351. package/lib/maps/symbols/font-awesome/plus.png +0 -0
  352. package/lib/maps/symbols/font-awesome/square.png +0 -0
  353. package/lib/maps/symbols/font-awesome/star.png +0 -0
  354. package/lib/maps/symbols/font-awesome/thumbs-down.png +0 -0
  355. package/lib/maps/symbols/font-awesome/thumbs-up.png +0 -0
  356. package/lib/maps/symbols/font-awesome/ticket.png +0 -0
  357. package/lib/maps/symbols/font-awesome/times-circle.png +0 -0
  358. package/lib/maps/symbols/font-awesome/times.png +0 -0
  359. package/lib/maps/symbols/font-awesome/tint.png +0 -0
  360. package/lib/maps/symbols/font-awesome/tree.png +0 -0
  361. package/lib/maps/symbols/font-awesome/university.png +0 -0
  362. package/lib/maps/symbols/font-awesome/usd.png +0 -0
  363. package/lib/maps/symbols/font-awesome/user.png +0 -0
  364. package/lib/maps/symbols/font-awesome/users.png +0 -0
  365. package/lib/maps/symbols/font-awesome/wheelchair.png +0 -0
  366. package/lib/maps/vectorMaps.d.ts +42 -0
  367. package/lib/maps/vectorMaps.js +331 -0
  368. package/lib/memoizedDebounce.d.ts +6 -0
  369. package/lib/memoizedDebounce.js +21 -0
  370. package/lib/quickfilter/DateExprComponent.d.ts +81 -0
  371. package/lib/quickfilter/DateExprComponent.js +197 -0
  372. package/lib/quickfilter/IdArrayQuickfilterComponent.d.ts +24 -0
  373. package/lib/quickfilter/IdArrayQuickfilterComponent.js +30 -0
  374. package/lib/quickfilter/Quickfilter.d.ts +21 -0
  375. package/lib/quickfilter/Quickfilter.js +2 -0
  376. package/lib/quickfilter/QuickfilterCompiler.d.ts +16 -0
  377. package/lib/quickfilter/QuickfilterCompiler.js +167 -0
  378. package/lib/quickfilter/QuickfilterUtils.d.ts +7 -0
  379. package/lib/quickfilter/QuickfilterUtils.js +106 -0
  380. package/lib/quickfilter/QuickfiltersComponent.d.ts +293 -0
  381. package/lib/quickfilter/QuickfiltersComponent.js +257 -0
  382. package/lib/quickfilter/QuickfiltersDataSource.d.ts +7 -0
  383. package/lib/quickfilter/QuickfiltersDataSource.js +2 -0
  384. package/lib/quickfilter/QuickfiltersDesignComponent.d.ts +46 -0
  385. package/lib/quickfilter/QuickfiltersDesignComponent.js +176 -0
  386. package/lib/quickfilter/README.md +8 -0
  387. package/lib/quickfilter/TextLiteralComponent.d.ts +216 -0
  388. package/lib/quickfilter/TextLiteralComponent.js +128 -0
  389. package/lib/richtext/ExprItemsHtmlConverter.d.ts +39 -0
  390. package/lib/richtext/ExprItemsHtmlConverter.js +118 -0
  391. package/lib/richtext/FontColorPaletteItem.d.ts +23 -0
  392. package/lib/richtext/FontColorPaletteItem.js +84 -0
  393. package/lib/richtext/FontSizePaletteItem.d.ts +29 -0
  394. package/lib/richtext/FontSizePaletteItem.js +70 -0
  395. package/lib/richtext/ItemsHtmlConverter.d.ts +31 -0
  396. package/lib/richtext/ItemsHtmlConverter.js +209 -0
  397. package/lib/richtext/README.md +3 -0
  398. package/lib/richtext/RichTextComponent.d.ts +84 -0
  399. package/lib/richtext/RichTextComponent.js +255 -0
  400. package/lib/valueFormatter.d.ts +16 -0
  401. package/lib/valueFormatter.js +93 -0
  402. package/lib/widgets/DirectWidgetDataSource.d.ts +43 -0
  403. package/lib/widgets/DirectWidgetDataSource.js +39 -0
  404. package/lib/widgets/DropdownWidgetComponent.d.ts +31 -0
  405. package/lib/widgets/DropdownWidgetComponent.js +41 -0
  406. package/lib/widgets/IFrameWidget.d.ts +16 -0
  407. package/lib/widgets/IFrameWidget.js +38 -0
  408. package/lib/widgets/IFrameWidgetComponent.d.ts +33 -0
  409. package/lib/widgets/IFrameWidgetComponent.js +101 -0
  410. package/lib/widgets/ImageUploaderComponent.d.ts +29 -0
  411. package/lib/widgets/ImageUploaderComponent.js +91 -0
  412. package/lib/widgets/ImageWidget.d.ts +49 -0
  413. package/lib/widgets/ImageWidget.js +112 -0
  414. package/lib/widgets/ImageWidgetComponent.d.ts +125 -0
  415. package/lib/widgets/ImageWidgetComponent.js +368 -0
  416. package/lib/widgets/ImagelistCarouselComponent.d.ts +29 -0
  417. package/lib/widgets/ImagelistCarouselComponent.js +64 -0
  418. package/lib/widgets/MapWidget.d.ts +55 -0
  419. package/lib/widgets/MapWidget.js +167 -0
  420. package/lib/widgets/MarkdownWidget.d.ts +53 -0
  421. package/lib/widgets/MarkdownWidget.js +134 -0
  422. package/lib/widgets/TOCWidget.d.ts +39 -0
  423. package/lib/widgets/TOCWidget.js +254 -0
  424. package/lib/widgets/Widget.d.ts +61 -0
  425. package/lib/widgets/Widget.js +33 -0
  426. package/lib/widgets/WidgetDataSource.d.ts +20 -0
  427. package/lib/widgets/WidgetDataSource.js +2 -0
  428. package/lib/widgets/WidgetFactory.d.ts +4 -0
  429. package/lib/widgets/WidgetFactory.js +40 -0
  430. package/lib/widgets/WidgetScoper.d.ts +9 -0
  431. package/lib/widgets/WidgetScoper.js +49 -0
  432. package/lib/widgets/WidgetScopesViewComponent.d.ts +26 -0
  433. package/lib/widgets/WidgetScopesViewComponent.js +36 -0
  434. package/lib/widgets/charts/Chart.d.ts +57 -0
  435. package/lib/widgets/charts/Chart.js +83 -0
  436. package/lib/widgets/charts/ChartViewComponent.d.ts +72 -0
  437. package/lib/widgets/charts/ChartViewComponent.js +120 -0
  438. package/lib/widgets/charts/ChartWidget.d.ts +87 -0
  439. package/lib/widgets/charts/ChartWidget.js +248 -0
  440. package/lib/widgets/charts/calendar/CalendarChart.d.ts +39 -0
  441. package/lib/widgets/charts/calendar/CalendarChart.js +175 -0
  442. package/lib/widgets/charts/calendar/CalendarChartDesignerComponent.d.ts +35 -0
  443. package/lib/widgets/charts/calendar/CalendarChartDesignerComponent.js +142 -0
  444. package/lib/widgets/charts/calendar/CalendarChartViewComponent.d.ts +56 -0
  445. package/lib/widgets/charts/calendar/CalendarChartViewComponent.js +263 -0
  446. package/lib/widgets/charts/imagemosaic/ImageMosaicChart.d.ts +21 -0
  447. package/lib/widgets/charts/imagemosaic/ImageMosaicChart.js +183 -0
  448. package/lib/widgets/charts/imagemosaic/ImageMosaicChartDesignerComponent.d.ts +28 -0
  449. package/lib/widgets/charts/imagemosaic/ImageMosaicChartDesignerComponent.js +105 -0
  450. package/lib/widgets/charts/imagemosaic/ImageMosaicChartViewComponent.d.ts +31 -0
  451. package/lib/widgets/charts/imagemosaic/ImageMosaicChartViewComponent.js +87 -0
  452. package/lib/widgets/charts/imagemosaic/ImagePopupComponent.d.ts +20 -0
  453. package/lib/widgets/charts/imagemosaic/ImagePopupComponent.js +38 -0
  454. package/lib/widgets/charts/layered/LayeredChart.d.ts +28 -0
  455. package/lib/widgets/charts/layered/LayeredChart.js +324 -0
  456. package/lib/widgets/charts/layered/LayeredChartCompiler.d.ts +113 -0
  457. package/lib/widgets/charts/layered/LayeredChartCompiler.js +1092 -0
  458. package/lib/widgets/charts/layered/LayeredChartDesign.d.ts +76 -0
  459. package/lib/widgets/charts/layered/LayeredChartDesign.js +2 -0
  460. package/lib/widgets/charts/layered/LayeredChartDesignerComponent.d.ts +80 -0
  461. package/lib/widgets/charts/layered/LayeredChartDesignerComponent.js +317 -0
  462. package/lib/widgets/charts/layered/LayeredChartLayerDesignerComponent.d.ts +72 -0
  463. package/lib/widgets/charts/layered/LayeredChartLayerDesignerComponent.js +329 -0
  464. package/lib/widgets/charts/layered/LayeredChartSvgFileSaver.d.ts +5 -0
  465. package/lib/widgets/charts/layered/LayeredChartSvgFileSaver.js +138 -0
  466. package/lib/widgets/charts/layered/LayeredChartUtils.d.ts +1 -0
  467. package/lib/widgets/charts/layered/LayeredChartUtils.js +25 -0
  468. package/lib/widgets/charts/layered/LayeredChartViewComponent.d.ts +44 -0
  469. package/lib/widgets/charts/layered/LayeredChartViewComponent.js +406 -0
  470. package/lib/widgets/charts/pivot/IntersectionDesignerComponent.d.ts +115 -0
  471. package/lib/widgets/charts/pivot/IntersectionDesignerComponent.js +235 -0
  472. package/lib/widgets/charts/pivot/PivotChart.d.ts +36 -0
  473. package/lib/widgets/charts/pivot/PivotChart.js +343 -0
  474. package/lib/widgets/charts/pivot/PivotChartDesign.d.ts +88 -0
  475. package/lib/widgets/charts/pivot/PivotChartDesign.js +2 -0
  476. package/lib/widgets/charts/pivot/PivotChartDesignerComponent.d.ts +37 -0
  477. package/lib/widgets/charts/pivot/PivotChartDesignerComponent.js +159 -0
  478. package/lib/widgets/charts/pivot/PivotChartLayout.d.ts +73 -0
  479. package/lib/widgets/charts/pivot/PivotChartLayout.js +2 -0
  480. package/lib/widgets/charts/pivot/PivotChartLayoutBuilder.d.ts +37 -0
  481. package/lib/widgets/charts/pivot/PivotChartLayoutBuilder.js +676 -0
  482. package/lib/widgets/charts/pivot/PivotChartLayoutComponent.d.ts +74 -0
  483. package/lib/widgets/charts/pivot/PivotChartLayoutComponent.js +333 -0
  484. package/lib/widgets/charts/pivot/PivotChartQueryBuilder.d.ts +31 -0
  485. package/lib/widgets/charts/pivot/PivotChartQueryBuilder.js +263 -0
  486. package/lib/widgets/charts/pivot/PivotChartUtils.d.ts +12 -0
  487. package/lib/widgets/charts/pivot/PivotChartUtils.js +195 -0
  488. package/lib/widgets/charts/pivot/PivotChartViewComponent.d.ts +84 -0
  489. package/lib/widgets/charts/pivot/PivotChartViewComponent.js +205 -0
  490. package/lib/widgets/charts/pivot/README.md +30 -0
  491. package/lib/widgets/charts/pivot/SegmentDesignerComponent.d.ts +96 -0
  492. package/lib/widgets/charts/pivot/SegmentDesignerComponent.js +216 -0
  493. package/lib/widgets/charts/table/OrderingsComponent.d.ts +15 -0
  494. package/lib/widgets/charts/table/OrderingsComponent.js +66 -0
  495. package/lib/widgets/charts/table/TableChart.d.ts +57 -0
  496. package/lib/widgets/charts/table/TableChart.js +310 -0
  497. package/lib/widgets/charts/table/TableChartDesignerComponent.d.ts +48 -0
  498. package/lib/widgets/charts/table/TableChartDesignerComponent.js +291 -0
  499. package/lib/widgets/charts/table/TableChartViewComponent.d.ts +28 -0
  500. package/lib/widgets/charts/table/TableChartViewComponent.js +206 -0
  501. package/lib/widgets/text/ExprInsertModalComponent.d.ts +35 -0
  502. package/lib/widgets/text/ExprInsertModalComponent.js +51 -0
  503. package/lib/widgets/text/ExprItemEditorComponent.d.ts +34 -0
  504. package/lib/widgets/text/ExprItemEditorComponent.js +92 -0
  505. package/lib/widgets/text/ExprUpdateModalComponent.d.ts +33 -0
  506. package/lib/widgets/text/ExprUpdateModalComponent.js +47 -0
  507. package/lib/widgets/text/README.md +2 -0
  508. package/lib/widgets/text/TextComponent.d.ts +48 -0
  509. package/lib/widgets/text/TextComponent.js +109 -0
  510. package/lib/widgets/text/TextWidget.d.ts +29 -0
  511. package/lib/widgets/text/TextWidget.js +243 -0
  512. package/lib/widgets/text/TextWidgetComponent.d.ts +33 -0
  513. package/lib/widgets/text/TextWidgetComponent.js +88 -0
  514. package/lib/widgets/text/TextWidgetDesign.d.ts +6 -0
  515. package/lib/widgets/text/TextWidgetDesign.js +2 -0
  516. package/mocha.html +10 -0
  517. package/package.json +113 -0
  518. package/server.js +10 -0
  519. package/src/CheckboxComponent.ts +33 -0
  520. package/src/ColorComponent.ts +117 -0
  521. package/src/ColorSchemeFactory.ts +144 -0
  522. package/src/CsvBuilder.ts +65 -0
  523. package/src/DateRangeComponent.ts +279 -0
  524. package/src/FiltersDesignerComponent.ts +55 -0
  525. package/src/ImplicitFilterBuilder.ts +135 -0
  526. package/src/JsonQLFilter.ts +8 -0
  527. package/src/LocaleContextInjector.tsx +17 -0
  528. package/src/MWaterAddRelatedFormComponent.ts +213 -0
  529. package/src/MWaterAddRelatedIndicatorComponent.ts +205 -0
  530. package/src/MWaterAssetSystemsListComponent.tsx +114 -0
  531. package/src/MWaterCompleteTableSelectComponent.tsx +984 -0
  532. package/src/MWaterContextComponent.ts +144 -0
  533. package/src/MWaterCustomTablesetListComponent.tsx +141 -0
  534. package/src/MWaterGlobalFiltersComponent.ts +117 -0
  535. package/src/MWaterLoaderComponent.ts +118 -0
  536. package/src/MWaterMetricsTableListComponent.tsx +120 -0
  537. package/src/MWaterResponsesFilterComponent.ts +194 -0
  538. package/src/MWaterTableSelectComponent.ts +316 -0
  539. package/src/MenuItemComponent.ts +2 -0
  540. package/src/PopoverComponent.ts +59 -0
  541. package/src/RadioButtonComponent.ts +34 -0
  542. package/src/TableSelectComponent.ts +60 -0
  543. package/src/UIComponents.ts +289 -0
  544. package/src/UndoStack.ts +59 -0
  545. package/src/VerticalLayoutComponent.ts +108 -0
  546. package/src/WidgetScope.ts +17 -0
  547. package/src/axes/Axis.ts +89 -0
  548. package/src/axes/AxisBuilder.ts +1325 -0
  549. package/src/axes/AxisColorEditorComponent.ts +210 -0
  550. package/src/axes/AxisComponent.ts +449 -0
  551. package/src/axes/BinsComponent.tsx +169 -0
  552. package/src/axes/CategoryMapComponent.ts +278 -0
  553. package/src/axes/ColorPaletteCollectionComponent.ts +163 -0
  554. package/src/axes/RangesComponent.ts +234 -0
  555. package/src/color-mixer.d.ts +1 -0
  556. package/src/componenttest.ts +64 -0
  557. package/src/compressJson.ts +13 -0
  558. package/src/dashboards/DashboardComponent.ts +468 -0
  559. package/src/dashboards/DashboardDataSource.ts +15 -0
  560. package/src/dashboards/DashboardDesign.ts +57 -0
  561. package/src/dashboards/DashboardUpgrader.ts +103 -0
  562. package/src/dashboards/DashboardUtils.ts +82 -0
  563. package/src/dashboards/DashboardViewComponent.ts +304 -0
  564. package/src/dashboards/DirectDashboardDataSource.ts +69 -0
  565. package/src/dashboards/LayoutOptionsComponent.tsx +227 -0
  566. package/src/dashboards/README.md +13 -0
  567. package/src/dashboards/ServerDashboardDataSource.ts +520 -0
  568. package/src/dashboards/SettingsModalComponent.ts +169 -0
  569. package/src/dashboards/WidgetComponent.tsx +131 -0
  570. package/src/dashboards/layoutOptions.ts +40 -0
  571. package/src/datagrids/DatagridComponent.ts +430 -0
  572. package/src/datagrids/DatagridDataSource.ts +21 -0
  573. package/src/datagrids/DatagridDesign.ts +94 -0
  574. package/src/datagrids/DatagridDesignerComponent.tsx +585 -0
  575. package/src/datagrids/DatagridQueryBuilder.ts +722 -0
  576. package/src/datagrids/DatagridUtils.ts +74 -0
  577. package/src/datagrids/DatagridViewComponent.ts +460 -0
  578. package/src/datagrids/DirectDatagridDataSource.ts +57 -0
  579. package/src/datagrids/EditExprCellComponent.tsx +305 -0
  580. package/src/datagrids/ExprCellComponent.ts +104 -0
  581. package/src/datagrids/FindReplaceModalComponent.ts +354 -0
  582. package/src/datagrids/LabeledExprGenerator.ts +302 -0
  583. package/src/datagrids/OrderBysDesignerComponent.tsx +128 -0
  584. package/src/datagrids/README.md +3 -0
  585. package/src/datagrids/ServerDatagridDataSource.ts +119 -0
  586. package/src/datagrids/react-linkify.d.ts +1 -0
  587. package/src/demo.ts +4148 -0
  588. package/src/demoBlocks.ts +130 -0
  589. package/src/globals.d.ts +2 -0
  590. package/src/index.css +550 -0
  591. package/src/index.ts +112 -0
  592. package/src/injectTableAlias.ts +31 -0
  593. package/src/languages.ts +931 -0
  594. package/src/layout-styles.css +263 -0
  595. package/src/layouts/DecoratedBlockComponent.ts +167 -0
  596. package/src/layouts/DragSourceComponent.ts +35 -0
  597. package/src/layouts/LayoutManager.ts +86 -0
  598. package/src/layouts/blocks/BlocksDisplayComponent.ts +461 -0
  599. package/src/layouts/blocks/BlocksLayoutManager.ts +78 -0
  600. package/src/layouts/blocks/ClipboardPaletteItemComponent.ts +89 -0
  601. package/src/layouts/blocks/DraggableBlockComponent.ts +219 -0
  602. package/src/layouts/blocks/HorizontalBlockComponent.ts +288 -0
  603. package/src/layouts/blocks/PaletteItemComponent.ts +27 -0
  604. package/src/layouts/blocks/README.md +11 -0
  605. package/src/layouts/blocks/blockUtils.ts +207 -0
  606. package/src/layouts/decorated-block.css +100 -0
  607. package/src/layouts/grid/GridLayoutComponent.ts +67 -0
  608. package/src/layouts/grid/GridLayoutManager.ts +185 -0
  609. package/src/layouts/grid/LegoLayoutEngine.ts +142 -0
  610. package/src/layouts/grid/PaletteItemComponent.ts +28 -0
  611. package/src/layouts/grid/README.md +14 -0
  612. package/src/layouts/grid/WidgetContainerComponent.ts +420 -0
  613. package/src/mWaterLoader.ts +82 -0
  614. package/src/mapdemo.ts +127 -0
  615. package/src/maps/AddLayerComponent.ts +125 -0
  616. package/src/maps/AdminScopeAndDetailLevelComponent.ts +90 -0
  617. package/src/maps/BaseLayerDesignerComponent.ts +104 -0
  618. package/src/maps/BingLayer.ts +156 -0
  619. package/src/maps/BufferLayer.ts +927 -0
  620. package/src/maps/BufferLayerDesign.ts +48 -0
  621. package/src/maps/BufferLayerDesignerComponent.ts +311 -0
  622. package/src/maps/ChoroplethLayer.ts +1712 -0
  623. package/src/maps/ChoroplethLayerDesign.ts +73 -0
  624. package/src/maps/ChoroplethLayerDesigner.tsx +558 -0
  625. package/src/maps/ClusterLayer.ts +836 -0
  626. package/src/maps/ClusterLayerDesign.ts +29 -0
  627. package/src/maps/ClusterLayerDesignerComponent.ts +190 -0
  628. package/src/maps/DetailLevelSelectComponent.ts +119 -0
  629. package/src/maps/DirectMapDataSource.ts +386 -0
  630. package/src/maps/EditHoverOver.tsx +151 -0
  631. package/src/maps/EditPopupComponent.ts +121 -0
  632. package/src/maps/Grid Functions.sql +167 -0
  633. package/src/maps/GridLayer.ts +776 -0
  634. package/src/maps/GridLayerDesign.ts +53 -0
  635. package/src/maps/GridLayerDesigner.tsx +332 -0
  636. package/src/maps/HoverContent.tsx +96 -0
  637. package/src/maps/HtmlUrlLegend.tsx +44 -0
  638. package/src/maps/Layer.ts +338 -0
  639. package/src/maps/LayerFactory.ts +51 -0
  640. package/src/maps/LayerLegendComponent.ts +88 -0
  641. package/src/maps/LayerSwitcherComponent.tsx +91 -0
  642. package/src/maps/LeafletLoading.css +24 -0
  643. package/src/maps/LeafletLoading.ts +355 -0
  644. package/src/maps/LeafletMapComponent.tsx +587 -0
  645. package/src/maps/LegendComponent.tsx +101 -0
  646. package/src/maps/LegendGroup.ts +120 -0
  647. package/src/maps/MWaterServerLayer.ts +116 -0
  648. package/src/maps/MapBoundsCalculator.ts +88 -0
  649. package/src/maps/MapComponent.ts +312 -0
  650. package/src/maps/MapControlComponent.ts +46 -0
  651. package/src/maps/MapDataSource.ts +20 -0
  652. package/src/maps/MapDesign.ts +103 -0
  653. package/src/maps/MapDesignerComponent.ts +356 -0
  654. package/src/maps/MapFiltersDesignerComponent.ts +95 -0
  655. package/src/maps/MapLayerDataSource.ts +27 -0
  656. package/src/maps/MapLayerViewDesignerComponent.ts +243 -0
  657. package/src/maps/MapLayersDesignerComponent.ts +144 -0
  658. package/src/maps/MapUtils.ts +148 -0
  659. package/src/maps/MapViewComponent.tsx +62 -0
  660. package/src/maps/Maptiler-logo.png +0 -0
  661. package/src/maps/MarkerSymbolSelectComponent.ts +41 -0
  662. package/src/maps/MarkersLayer.ts +941 -0
  663. package/src/maps/MarkersLayerDesign.ts +56 -0
  664. package/src/maps/MarkersLayerDesignerComponent.ts +374 -0
  665. package/src/maps/PopupFilterJoinsEditComponent.ts +114 -0
  666. package/src/maps/PopupFilterJoinsUtils.ts +99 -0
  667. package/src/maps/RasterMapViewComponent.ts +382 -0
  668. package/src/maps/RegionSelectComponent.ts +80 -0
  669. package/src/maps/ScopeAndDetailLevelComponent.ts +82 -0
  670. package/src/maps/ServerMapDataSource.ts +399 -0
  671. package/src/maps/SwitchableTileUrlLayer.tsx +130 -0
  672. package/src/maps/SwitchableTileUrlLayerDesigner.tsx +60 -0
  673. package/src/maps/TileUrlLayer.tsx +142 -0
  674. package/src/maps/UtfGridLayer.ts +286 -0
  675. package/src/maps/VectorMapViewComponent.css +21 -0
  676. package/src/maps/VectorMapViewComponent.tsx +743 -0
  677. package/src/maps/ZoomLevelsComponent.ts +72 -0
  678. package/src/maps/mapSymbols.ts +162 -0
  679. package/src/maps/mapboxUtils.ts +61 -0
  680. package/src/maps/maps.ts +38 -0
  681. package/src/maps/marker-icon-2x.png +0 -0
  682. package/src/maps/marker-icon.png +0 -0
  683. package/src/maps/marker-shadow.png +0 -0
  684. package/src/maps/png.d.ts +1 -0
  685. package/src/maps/symbols/font-awesome/asterisk.png +0 -0
  686. package/src/maps/symbols/font-awesome/ban.png +0 -0
  687. package/src/maps/symbols/font-awesome/beer.png +0 -0
  688. package/src/maps/symbols/font-awesome/bell.png +0 -0
  689. package/src/maps/symbols/font-awesome/bolt.png +0 -0
  690. package/src/maps/symbols/font-awesome/building.png +0 -0
  691. package/src/maps/symbols/font-awesome/bullseye.png +0 -0
  692. package/src/maps/symbols/font-awesome/bus.png +0 -0
  693. package/src/maps/symbols/font-awesome/caret-up.png +0 -0
  694. package/src/maps/symbols/font-awesome/certificate.png +0 -0
  695. package/src/maps/symbols/font-awesome/check-circle.png +0 -0
  696. package/src/maps/symbols/font-awesome/check.png +0 -0
  697. package/src/maps/symbols/font-awesome/chevron-circle-down.png +0 -0
  698. package/src/maps/symbols/font-awesome/chevron-circle-up.png +0 -0
  699. package/src/maps/symbols/font-awesome/cloud.png +0 -0
  700. package/src/maps/symbols/font-awesome/comment.png +0 -0
  701. package/src/maps/symbols/font-awesome/crosshairs.png +0 -0
  702. package/src/maps/symbols/font-awesome/dot-circle-o.png +0 -0
  703. package/src/maps/symbols/font-awesome/exclamation-circle.png +0 -0
  704. package/src/maps/symbols/font-awesome/exclamation-triangle.png +0 -0
  705. package/src/maps/symbols/font-awesome/female.png +0 -0
  706. package/src/maps/symbols/font-awesome/file.png +0 -0
  707. package/src/maps/symbols/font-awesome/flag.png +0 -0
  708. package/src/maps/symbols/font-awesome/flask.png +0 -0
  709. package/src/maps/symbols/font-awesome/h-square.png +0 -0
  710. package/src/maps/symbols/font-awesome/home.png +0 -0
  711. package/src/maps/symbols/font-awesome/info-circle.png +0 -0
  712. package/src/maps/symbols/font-awesome/male.png +0 -0
  713. package/src/maps/symbols/font-awesome/medkit.png +0 -0
  714. package/src/maps/symbols/font-awesome/mobile.png +0 -0
  715. package/src/maps/symbols/font-awesome/plus-circle.png +0 -0
  716. package/src/maps/symbols/font-awesome/plus-square.png +0 -0
  717. package/src/maps/symbols/font-awesome/plus.png +0 -0
  718. package/src/maps/symbols/font-awesome/square.png +0 -0
  719. package/src/maps/symbols/font-awesome/star.png +0 -0
  720. package/src/maps/symbols/font-awesome/thumbs-down.png +0 -0
  721. package/src/maps/symbols/font-awesome/thumbs-up.png +0 -0
  722. package/src/maps/symbols/font-awesome/ticket.png +0 -0
  723. package/src/maps/symbols/font-awesome/times-circle.png +0 -0
  724. package/src/maps/symbols/font-awesome/times.png +0 -0
  725. package/src/maps/symbols/font-awesome/tint.png +0 -0
  726. package/src/maps/symbols/font-awesome/tree.png +0 -0
  727. package/src/maps/symbols/font-awesome/university.png +0 -0
  728. package/src/maps/symbols/font-awesome/usd.png +0 -0
  729. package/src/maps/symbols/font-awesome/user.png +0 -0
  730. package/src/maps/symbols/font-awesome/users.png +0 -0
  731. package/src/maps/symbols/font-awesome/wheelchair.png +0 -0
  732. package/src/maps/vectorMaps.tsx +410 -0
  733. package/src/memoizedDebounce.tsx +32 -0
  734. package/src/quickfilter/DateExprComponent.ts +284 -0
  735. package/src/quickfilter/IdArrayQuickfilterComponent.ts +58 -0
  736. package/src/quickfilter/Quickfilter.ts +29 -0
  737. package/src/quickfilter/QuickfilterCompiler.ts +167 -0
  738. package/src/quickfilter/QuickfilterUtils.ts +123 -0
  739. package/src/quickfilter/QuickfiltersComponent.ts +416 -0
  740. package/src/quickfilter/QuickfiltersDataSource.ts +15 -0
  741. package/src/quickfilter/QuickfiltersDesignComponent.tsx +257 -0
  742. package/src/quickfilter/README.md +8 -0
  743. package/src/quickfilter/TextLiteralComponent.ts +161 -0
  744. package/src/quickfilter/react-onclickout.d.ts +1 -0
  745. package/src/richtext/ExprItemsHtmlConverter.ts +144 -0
  746. package/src/richtext/FontColorPaletteItem.ts +172 -0
  747. package/src/richtext/FontSizePaletteItem.ts +110 -0
  748. package/src/richtext/ItemsHtmlConverter.ts +246 -0
  749. package/src/richtext/README.md +3 -0
  750. package/src/richtext/RichTextComponent.tsx +390 -0
  751. package/src/richtext/react-float-affixed.d.ts +1 -0
  752. package/src/update-object.d.ts +1 -0
  753. package/src/valueFormatter.ts +110 -0
  754. package/src/widgets/DirectWidgetDataSource.ts +67 -0
  755. package/src/widgets/DropdownWidgetComponent.ts +78 -0
  756. package/src/widgets/IFrameWidget.ts +36 -0
  757. package/src/widgets/IFrameWidgetComponent.ts +116 -0
  758. package/src/widgets/ImageUploaderComponent.tsx +143 -0
  759. package/src/widgets/ImageWidget.ts +147 -0
  760. package/src/widgets/ImageWidgetComponent.ts +546 -0
  761. package/src/widgets/ImagelistCarouselComponent.ts +109 -0
  762. package/src/widgets/MapWidget.ts +219 -0
  763. package/src/widgets/MarkdownWidget.ts +201 -0
  764. package/src/widgets/TOCWidget.ts +326 -0
  765. package/src/widgets/Widget.ts +83 -0
  766. package/src/widgets/WidgetDataSource.ts +23 -0
  767. package/src/widgets/WidgetFactory.ts +37 -0
  768. package/src/widgets/WidgetScoper.ts +51 -0
  769. package/src/widgets/WidgetScopesViewComponent.ts +54 -0
  770. package/src/widgets/charts/Chart.ts +140 -0
  771. package/src/widgets/charts/ChartViewComponent.ts +209 -0
  772. package/src/widgets/charts/ChartWidget.ts +345 -0
  773. package/src/widgets/charts/calendar/CalendarChart.ts +227 -0
  774. package/src/widgets/charts/calendar/CalendarChartDesignerComponent.ts +187 -0
  775. package/src/widgets/charts/calendar/CalendarChartViewComponent.tsx +320 -0
  776. package/src/widgets/charts/calendar/d3-tip.d.ts +1 -0
  777. package/src/widgets/charts/imagemosaic/ImageMosaicChart.ts +213 -0
  778. package/src/widgets/charts/imagemosaic/ImageMosaicChartDesignerComponent.ts +121 -0
  779. package/src/widgets/charts/imagemosaic/ImageMosaicChartViewComponent.ts +117 -0
  780. package/src/widgets/charts/imagemosaic/ImagePopupComponent.ts +51 -0
  781. package/src/widgets/charts/imagemosaic/react-lazy-load-image-component.d.ts +1 -0
  782. package/src/widgets/charts/layered/LayeredChart.ts +361 -0
  783. package/src/widgets/charts/layered/LayeredChartCompiler.ts +1299 -0
  784. package/src/widgets/charts/layered/LayeredChartDesign.ts +106 -0
  785. package/src/widgets/charts/layered/LayeredChartDesignerComponent.tsx +523 -0
  786. package/src/widgets/charts/layered/LayeredChartLayerDesignerComponent.tsx +448 -0
  787. package/src/widgets/charts/layered/LayeredChartSvgFileSaver.ts +146 -0
  788. package/src/widgets/charts/layered/LayeredChartUtils.ts +24 -0
  789. package/src/widgets/charts/layered/LayeredChartViewComponent.ts +486 -0
  790. package/src/widgets/charts/layered/save-svg-as-png.d.ts +1 -0
  791. package/src/widgets/charts/pivot/IntersectionDesignerComponent.tsx +338 -0
  792. package/src/widgets/charts/pivot/PivotChart.ts +377 -0
  793. package/src/widgets/charts/pivot/PivotChartDesign.ts +115 -0
  794. package/src/widgets/charts/pivot/PivotChartDesignerComponent.tsx +240 -0
  795. package/src/widgets/charts/pivot/PivotChartLayout.ts +99 -0
  796. package/src/widgets/charts/pivot/PivotChartLayoutBuilder.ts +779 -0
  797. package/src/widgets/charts/pivot/PivotChartLayoutComponent.tsx +504 -0
  798. package/src/widgets/charts/pivot/PivotChartQueryBuilder.ts +273 -0
  799. package/src/widgets/charts/pivot/PivotChartUtils.ts +219 -0
  800. package/src/widgets/charts/pivot/PivotChartViewComponent.ts +276 -0
  801. package/src/widgets/charts/pivot/README.md +30 -0
  802. package/src/widgets/charts/pivot/SegmentDesignerComponent.tsx +353 -0
  803. package/src/widgets/charts/table/OrderingsComponent.tsx +119 -0
  804. package/src/widgets/charts/table/TableChart.ts +420 -0
  805. package/src/widgets/charts/table/TableChartDesignerComponent.ts +441 -0
  806. package/src/widgets/charts/table/TableChartViewComponent.ts +327 -0
  807. package/src/widgets/text/ExprInsertModalComponent.ts +77 -0
  808. package/src/widgets/text/ExprItemEditorComponent.tsx +164 -0
  809. package/src/widgets/text/ExprUpdateModalComponent.ts +70 -0
  810. package/src/widgets/text/README.md +2 -0
  811. package/src/widgets/text/TextComponent.tsx +151 -0
  812. package/src/widgets/text/TextWidget.ts +265 -0
  813. package/src/widgets/text/TextWidgetComponent.ts +120 -0
  814. package/src/widgets/text/TextWidgetDesign.ts +7 -0
  815. package/stories/UpdateableComponent.js +29 -0
  816. package/stories/consoles.js +202 -0
  817. package/stories/dashboards.js +217 -0
  818. package/stories/datagridDesign.js +114 -0
  819. package/stories/datagrids.js +69 -0
  820. package/stories/dates.js +80 -0
  821. package/stories/exprcomponent.js +43 -0
  822. package/stories/index.js +18 -0
  823. package/stories/leaflet.js +59 -0
  824. package/stories/maps.js +24 -0
  825. package/stories/pivotChart.js +235 -0
  826. package/test/AxisBuilderTests.ts +931 -0
  827. package/test/ChartWidgetTests.ts +85 -0
  828. package/test/ColorSchemeFactoryTests.ts +29 -0
  829. package/test/CsvBuilderTests.ts +22 -0
  830. package/test/DashboardUpgraderTests.ts +170 -0
  831. package/test/ImplicitFilterBuilderTests.ts +161 -0
  832. package/test/LayeredChartCompilerTests.ts +1067 -0
  833. package/test/LayeredChartTests.ts +88 -0
  834. package/test/LegoLayoutEngineTests.ts +69 -0
  835. package/test/MWaterGlobalFiltersComponentTests.ts +130 -0
  836. package/test/MWaterResponsesFilterComponentTests.ts +164 -0
  837. package/test/QuickfilterCompilerTests.ts +167 -0
  838. package/test/TestComponent.ts +49 -0
  839. package/test/UndoStackTests.ts +73 -0
  840. package/test/WidgetScoperTests.ts +35 -0
  841. package/test/blockUtilsTests.ts +290 -0
  842. package/test/canonical-json.d.ts +1 -0
  843. package/test/dashboards/DashboardUtilsTests.ts +131 -0
  844. package/test/datagrids/DatagridQueryBuilderTests.ts +445 -0
  845. package/test/datagrids/DatagridUtilsTests.ts +54 -0
  846. package/test/datagrids/LabeledExprGeneratorTests.ts +121 -0
  847. package/test/fixtures.ts +263 -0
  848. package/test/index.ts +2 -0
  849. package/test/maps/MapUtilsTests.ts +168 -0
  850. package/test/maps/PopupFilterJoinsUtilsTests.ts +105 -0
  851. package/test/richtext/ItemsHtmlConverterTests.ts +41 -0
  852. package/test/test_index.ts +4 -0
  853. package/test/widgets/TextWidgetTests.ts +42 -0
  854. package/test/widgets/charts/pivot/PivotChartLayoutBuilderTests.ts +817 -0
  855. package/test/widgets/charts/pivot/PivotChartQueryBuilderTests.ts +359 -0
  856. package/test/widgets/charts/pivot/PivotChartTests.ts +64 -0
  857. package/test/widgets/charts/pivot/PivotChartUtilsTests.ts +184 -0
  858. package/test/widgets/charts/table/TableChartTests.ts +253 -0
  859. package/tsconfig.build.json +26 -0
  860. package/types/utm.d.ts +10 -0
package/src/demo.ts ADDED
@@ -0,0 +1,4148 @@
1
+ import React from "react"
2
+ import ReactDOM from "react-dom"
3
+ const R = React.createElement
4
+ import querystring from "querystring"
5
+ import $ from "jquery"
6
+ import { Expr, Schema } from "@mwater/expressions"
7
+ import { DataSource } from "@mwater/expressions"
8
+ import * as visualization from "./index"
9
+
10
+ // CalendarChartViewComponent = require './widgets/charts/CalendarChartViewComponent'
11
+
12
+ import MWaterLoaderComponent from "./MWaterLoaderComponent"
13
+
14
+ import MWaterDataSource from "@mwater/expressions/lib/MWaterDataSource"
15
+ import AutoSizeComponent from "@mwater/react-library/lib/AutoSizeComponent"
16
+ import DirectDatagridDataSource from "./datagrids/DirectDatagridDataSource"
17
+ import DirectDashboardDataSource from "./dashboards/DirectDashboardDataSource"
18
+ import { default as DirectMapDataSource } from "./maps/DirectMapDataSource"
19
+ import { default as ServerMapDataSource } from "./maps/ServerMapDataSource"
20
+ import LeafletMapComponent from "./maps/LeafletMapComponent"
21
+ import { default as ServerDashboardDataSource } from "./dashboards/ServerDashboardDataSource"
22
+ import RichTextComponent from "./richtext/RichTextComponent"
23
+ import ItemsHtmlConverter from "./richtext/ItemsHtmlConverter"
24
+ import { DragDropContextProvider } from "react-dnd"
25
+ import { default as HTML5Backend } from "react-dnd-html5-backend"
26
+ import { defaultT } from 'ez-localize'
27
+ import { setMapTilerApiKey } from "./maps/vectorMaps"
28
+
29
+ import "./index"
30
+
31
+ // Setup localizer
32
+ global.T = defaultT
33
+
34
+ // Set demo key
35
+ setMapTilerApiKey("cNNyJl2nwIIKEUYSeXYc")
36
+
37
+ $(function () {
38
+ const sample = R(
39
+ DragDropContextProvider,
40
+ { backend: HTML5Backend },
41
+ R(
42
+ "div",
43
+ { className: "container-fluid", style: { height: "100%", paddingLeft: 0, paddingRight: 0 } },
44
+ R("style", null, "html, body, #main { height: 100% }"),
45
+ R(MWaterDirectMapPane, { apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1) })
46
+ // R(RichTextPane)
47
+ // R(MWaterMapPane, {apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1)})
48
+ // R(TestPane, apiUrl: "https://api.mwater.co/v3/")
49
+ // R(MWaterDashboardPane, apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1), dashboardId: "a855eb0587d845d3ac27aed03c463976", share: "817c76088c7649ec8cc0b8193e547a09")
50
+ // R(MWaterDashboardPane, {apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1), dashboardId: "f99f206ddd4442a981761b8342c58058"})
51
+ // R(MWaterDashboardPane, {apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1), dashboardId: "38d803820a7a4bf5a1d5ef19cf8c64f3"})
52
+ // R(MWaterDirectDashboardPane, { apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1) })
53
+ //R(MWaterDirectDashboardPane, { apiUrl: "http://localhost:1234/v3/", client: window.location.hash.substr(1) })
54
+ //R(MWaterDatagridPane, { apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1) })
55
+ // R(MWaterDirectMapPane, { apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1) })
56
+ )
57
+ )
58
+ // R(MWaterDatagridPane, apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1))
59
+ // R(MWaterDatagridDesignerPane, apiUrl: "http://localhost:1234/v3/", client: window.location.hash.substr(1))
60
+ // R(MWaterDatagridPane, apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1))
61
+ // R(MWaterDirectMapPane, apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1))
62
+ // R(MWaterDirectMapPane, apiUrl: "http://localhost:1234/v3/", client: window.location.hash.substr(1))
63
+ // R(WaterOrgDashboardPane, apiUrl: "http://localhost:1235/mwater/")
64
+ // R(BlocksDesignerComponent, renderBlock: [])
65
+ // R(MWaterMapPane, apiUrl: "http://localhost:1234/v3/", client: window.location.hash.substr(1))
66
+ // R(MWaterMapPane, apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1))
67
+ // R(DashboardPane, apiUrl: "https://api.mwater.co/v3/")
68
+ // R(FloatingWindowComponent, initialBounds: { x: 100, y: 100, width: 400, height: 600 })
69
+ // R(DashboardPane, apiUrl: "http://localhost:1234/v3/")
70
+ // R(MWaterDirectDashboardPane, apiUrl: "https://api.mwater.co/v3/", client: window.location.hash.substr(1))
71
+ // R LeafletMapComponent, baseLayerId: "bing_road", width: "100%", height: 400, layers: [
72
+ // {
73
+ // geometry: { type: "Point", coordinates: [-73.5, 45.5]}
74
+ // onClick: => alert("clicked!")
75
+ // }
76
+ // ]
77
+ return ReactDOM.render(sample, document.getElementById("main"))
78
+ })
79
+
80
+ class RichTextPane extends React.Component {
81
+ constructor(props: any) {
82
+ super(props)
83
+
84
+ this.state = {
85
+ items: null
86
+ }
87
+ }
88
+
89
+ handleInsert = (ev: any) => {
90
+ ev.preventDefault()
91
+ return this.editor.pasteHTML("x")
92
+ }
93
+
94
+ renderExtraButtons() {
95
+ return R(
96
+ "div",
97
+ { key: "x", className: "mwater-visualization-text-palette-item", onMouseDown: this.handleInsert },
98
+ "x"
99
+ )
100
+ }
101
+
102
+ render() {
103
+ return R(
104
+ "div",
105
+ { style: { paddingTop: 100 } },
106
+ R(RichTextComponent, {
107
+ ref: (c: any) => {
108
+ return (this.editor = c)
109
+ },
110
+ items: this.state.items,
111
+ onItemsChange: (items: any) => this.setState({ items }),
112
+ itemsHtmlConverter: new ItemsHtmlConverter(),
113
+ extraPaletteButtons: this.renderExtraButtons()
114
+ })
115
+ )
116
+ }
117
+ }
118
+
119
+ class MWaterDashboardPane extends React.Component {
120
+ constructor(props: any) {
121
+ super(props)
122
+
123
+ this.state = {
124
+ design: null,
125
+ extraTables: []
126
+ }
127
+ }
128
+
129
+ componentWillMount() {
130
+ // Load dashboard
131
+ const url =
132
+ this.props.apiUrl +
133
+ `dashboards/${this.props.dashboardId}?` +
134
+ querystring.stringify({ client: this.props.client, share: this.props.share })
135
+ return $.getJSON(url, (dashboard) => {
136
+ return this.setState({ design: dashboard.design, extraTables: dashboard.extraTables })
137
+ })
138
+ }
139
+
140
+ handleDesignChange = (design: any) => {}
141
+ // @setState(design: design, extraTables: )
142
+ // console.log JSON.stringify(design, null, 2)
143
+
144
+ render() {
145
+ if (!this.state.design) {
146
+ return R("div", null, "Loading...")
147
+ }
148
+
149
+ return React.createElement(
150
+ MWaterLoaderComponent,
151
+ {
152
+ apiUrl: this.props.apiUrl,
153
+ client: this.props.client,
154
+ user: this.props.user,
155
+ share: this.props.share,
156
+ onExtraTablesChange: (extraTables: any) => this.setState({ extraTables }),
157
+ extraTables: this.state.extraTables,
158
+ errorFormatter: (err: any, defaultError: any) => {
159
+ if (!err.form) {
160
+ return defaultError
161
+ }
162
+ return `This dashboard depends on the survey ${err.form.name} which cannot be loaded. \
163
+ Perhaps the administrator of the survey has not shared it with you? \
164
+ The survey was created by ${err.form.created_by}`
165
+ }
166
+ },
167
+ (error: any, config: any) => {
168
+ if (error) {
169
+ return R("div", { className: "alert alert-danger" }, error)
170
+ }
171
+
172
+ const dashboardDataSource = new ServerDashboardDataSource({
173
+ apiUrl: this.props.apiUrl,
174
+ client: this.props.client,
175
+ share: this.props.share,
176
+ dashboardId: this.props.dashboardId,
177
+ dataSource: config.dataSource
178
+ })
179
+ // dashboardDataSource = new DirectDashboardDataSource(@props.apiUrl, @props.client, @state.design, config.schema, config.dataSource)
180
+
181
+ return R(
182
+ "div",
183
+ { style: { height: "100%" } },
184
+ React.createElement(visualization.DashboardComponent, {
185
+ schema: config.schema,
186
+ dataSource: config.dataSource,
187
+ dashboardDataSource,
188
+ design: this.state.design,
189
+ onDesignChange: this.handleDesignChange,
190
+ titleElem: "Sample"
191
+ })
192
+ )
193
+ }
194
+ )
195
+ }
196
+ }
197
+
198
+ class MWaterDirectDashboardPane extends React.Component {
199
+ constructor(props: any) {
200
+ super(props)
201
+
202
+ this.state = {
203
+ // design: { items: {}, layout: "grid" } # dashboardDesign
204
+ // design: { items: { id: "root", type: "root", blocks: [] }, layout: "blocks" } # dashboardDesign
205
+ design: window.localStorage.getItem("MWaterDirectDashboardPane.design")
206
+ ? JSON.parse(window.localStorage.getItem("MWaterDirectDashboardPane.design")!)
207
+ : mapAndChartDashboard,
208
+ // design: imageWidgetDashboardDesign
209
+ // design: dashboardDesign
210
+ extraTables: window.localStorage.getItem("MWaterDirectDashboardPane.extraTables")
211
+ ? JSON.parse(window.localStorage.getItem("MWaterDirectDashboardPane.extraTables")!)
212
+ : []
213
+ }
214
+ }
215
+
216
+ handleDesignChange = (design: any) => {
217
+ this.setState({ design })
218
+ // console.log JSON.stringify(design, null, 2)
219
+ return window.localStorage.setItem("MWaterDirectDashboardPane.design", JSON.stringify(design))
220
+ }
221
+
222
+ handleExtraTablesChange = (extraTables: any) => {
223
+ this.setState({ extraTables })
224
+ return window.localStorage.setItem("MWaterDirectDashboardPane.extraTables", JSON.stringify(extraTables))
225
+ }
226
+
227
+ render() {
228
+ return React.createElement(
229
+ MWaterLoaderComponent,
230
+ {
231
+ apiUrl: this.props.apiUrl,
232
+ client: this.props.client,
233
+ user: this.props.user,
234
+ onExtraTablesChange: this.handleExtraTablesChange,
235
+ extraTables: this.state.extraTables
236
+ },
237
+ (error: any, config: any) => {
238
+ if (error) {
239
+ alert("Error: " + error.message)
240
+ return null
241
+ }
242
+
243
+ const dashboardDataSource = new DirectDashboardDataSource({
244
+ apiUrl: this.props.apiUrl,
245
+ client: this.props.client,
246
+ schema: config.schema,
247
+ dataSource: config.dataSource
248
+ })
249
+
250
+ return R(
251
+ "div",
252
+ { style: { height: "100%" } },
253
+ React.createElement(visualization.DashboardComponent, {
254
+ schema: config.schema,
255
+ dataSource: config.dataSource,
256
+ dashboardDataSource,
257
+ design: this.state.design,
258
+ onDesignChange: this.handleDesignChange,
259
+ titleElem: "Sample",
260
+ // quickfilterLocks: [{ expr: { type: "field", table: "entities.water_point", column: "type" }, value: "Protected dug well" }]
261
+ namedStrings: { branding: "mWater" },
262
+ onRowClick: (table: any, rowId: any) => alert(`Row clicked: ${table} ${rowId}`)
263
+ })
264
+ )
265
+ }
266
+ )
267
+ }
268
+ }
269
+
270
+ // mapId = "fb92ca9ca9a04bfd8dc156b5ac71380d"
271
+ const mapId = "dec4923f684d4482922805556a013741"
272
+ const share = "testshareid"
273
+
274
+ class MWaterMapPane extends React.Component<any> {
275
+ constructor(props: any) {
276
+ super(props)
277
+
278
+ this.state = {
279
+ design: null,
280
+ extraTables: []
281
+ }
282
+ }
283
+
284
+ componentWillMount() {
285
+ // Load map
286
+ const url = this.props.apiUrl + `maps/${mapId}?` + querystring.stringify({ client: this.props.client })
287
+ $.getJSON(url, (map) => {
288
+ this.setState({ design: map.design, extraTables: map.extra_tables })
289
+ })
290
+ }
291
+
292
+ handleDesignChange = (design: any) => {
293
+ this.setState({ design })
294
+ // return console.log(JSON.stringify(design, null, 2))
295
+ }
296
+
297
+ render() {
298
+ if (!this.state.design) {
299
+ return R("div", null, "Loading...")
300
+ }
301
+
302
+ return React.createElement(
303
+ MWaterLoaderComponent,
304
+ {
305
+ apiUrl: this.props.apiUrl,
306
+ client: this.props.client,
307
+ user: this.props.user,
308
+ extraTables: ['responses:c08ef89fb9b642498e7db74674e84b55'],
309
+ onExtraTablesChange: (extraTables: any) => this.setState({ extraTables })
310
+ },
311
+ (error: any, config: any) => {
312
+ // Create map url source
313
+
314
+ // mapDataSource = new DirectMapDataSource({ apiUrl: @props.apiUrl, client: @props.client, schema: config.schema, mapDesign: @state.design })
315
+ const mapDataSource = new ServerMapDataSource({
316
+ apiUrl: this.props.apiUrl,
317
+ client: this.props.client,
318
+ mapId,
319
+ design: this.state.design
320
+ })
321
+
322
+ return R(
323
+ "div",
324
+ { style: { height: "100%" } },
325
+ React.createElement(visualization.MapComponent, {
326
+ schema: config.schema,
327
+ dataSource: config.dataSource,
328
+ design: this.state.design,
329
+ mapDataSource,
330
+ onDesignChange: this.handleDesignChange,
331
+ onRowClick: (tableId: any, rowId: any) => alert(`${tableId}:${rowId}`),
332
+ titleElem: "Sample"
333
+ })
334
+ )
335
+ }
336
+ )
337
+ }
338
+ }
339
+
340
+ class MWaterDirectMapPane extends React.Component {
341
+ constructor(props: any) {
342
+ super(props)
343
+
344
+ this.state = {
345
+ design: window.localStorage.getItem("MWaterDirectMapPane.design")
346
+ ? JSON.parse(window.localStorage.getItem("MWaterDirectMapPane.design"))
347
+ : doubleClickMap,
348
+ extraTables: window.localStorage.getItem("MWaterDirectMapPane.extraTables")
349
+ ? JSON.parse(window.localStorage.getItem("MWaterDirectMapPane.extraTables"))
350
+ : []
351
+ }
352
+ }
353
+
354
+ handleDesignChange = (design: any) => {
355
+ this.setState({ design })
356
+ // console.log JSON.stringify(design, null, 2)
357
+ return window.localStorage.setItem("MWaterDirectMapPane.design", JSON.stringify(design))
358
+ }
359
+
360
+ handleExtraTablesChange = (extraTables: any) => {
361
+ this.setState({ extraTables })
362
+ return window.localStorage.setItem("MWaterDirectMapPane.extraTables", JSON.stringify(extraTables))
363
+ }
364
+
365
+ render() {
366
+ return React.createElement(
367
+ MWaterLoaderComponent,
368
+ {
369
+ apiUrl: this.props.apiUrl,
370
+ client: this.props.client,
371
+ user: this.props.user,
372
+ extraTables: this.state.extraTables,
373
+ onExtraTablesChange: this.handleExtraTablesChange
374
+ },
375
+ (error: any, config: any) => {
376
+ // Create map url source
377
+ const mapDataSource = new DirectMapDataSource({
378
+ apiUrl: this.props.apiUrl,
379
+ client: this.props.client,
380
+ schema: config.schema,
381
+ dataSource: config.dataSource,
382
+ design: this.state.design
383
+ })
384
+
385
+ return R(
386
+ "div",
387
+ { style: { height: "100%" } },
388
+ React.createElement(visualization.MapComponent, {
389
+ schema: config.schema,
390
+ dataSource: config.dataSource,
391
+ design: this.state.design,
392
+ mapDataSource,
393
+ onDesignChange: this.handleDesignChange,
394
+ onRowClick: (tableId: any, rowId: any) => console.log(`Click ${tableId}:${rowId}`),
395
+ titleElem: "Sample",
396
+ enableQuickfilters: true,
397
+ })
398
+ )
399
+ }
400
+ )
401
+ }
402
+ }
403
+
404
+ class MWaterDatagridPane extends React.Component {
405
+ constructor(props: any) {
406
+ super(props)
407
+
408
+ this.state = {
409
+ design: datagridDesign,
410
+ extraTables: [] // "responses:3aee880e079a417ea51d388d95217edf"]
411
+ }
412
+ }
413
+
414
+ handleDesignChange = (design: any) => {
415
+ this.setState({ design })
416
+ return console.log(JSON.stringify(design, null, 2))
417
+ }
418
+
419
+ render() {
420
+ return R(
421
+ MWaterLoaderComponent,
422
+ {
423
+ apiUrl: this.props.apiUrl,
424
+ client: this.props.client,
425
+ user: this.props.user,
426
+ onExtraTablesChange: (extraTables: any) => this.setState({ extraTables }),
427
+ extraTables: this.state.extraTables
428
+ },
429
+ (error: any, config: any) => {
430
+ const datagridDataSource = new DirectDatagridDataSource({
431
+ schema: config.schema,
432
+ dataSource: config.dataSource
433
+ })
434
+
435
+ return R(
436
+ "div",
437
+ { style: { height: "100%" } },
438
+ R(visualization.DatagridComponent, {
439
+ schema: config.schema,
440
+ dataSource: config.dataSource,
441
+ datagridDataSource,
442
+ design: this.state.design,
443
+ onDesignChange: this.handleDesignChange,
444
+ titleElem: "Sample",
445
+ onRowDoubleClick: function () {
446
+ return console.log(arguments)
447
+ }.bind(this),
448
+ canEditExpr: (tableId: string, rowId: any, expr: Expr) => { return Promise.resolve(true) },
449
+ updateExprValues: (tableId: string, rowUpdates: any[]) => {
450
+ console.log(rowUpdates)
451
+ return new Promise<void>((resolve) => {
452
+ setTimeout(() => {
453
+ resolve()
454
+ }, 1000)
455
+ })
456
+ }
457
+ })
458
+ )
459
+ }
460
+ )
461
+ }
462
+ }
463
+
464
+ class WaterOrgDashboardPane extends React.Component {
465
+ constructor(props: any) {
466
+ super(props)
467
+
468
+ this.state = {
469
+ design: { items: { id: "root", type: "root", blocks: [] }, layout: "blocks" }
470
+ }
471
+ }
472
+
473
+ componentWillMount() {
474
+ const url = this.props.apiUrl + "jsonql/schema"
475
+ return $.getJSON(url, (schemaJson) => {
476
+ const schema = new Schema(schemaJson)
477
+ const dataSource = new MWaterDataSource(this.props.apiUrl, null, { serverCaching: false, localCaching: true })
478
+
479
+ return this.setState({ schema, dataSource })
480
+ }).fail((xhr) => {
481
+ console.log(xhr.responseText)
482
+ throw new Error("Cannot connect")
483
+ })
484
+ }
485
+
486
+ handleDesignChange = (design: any) => {
487
+ this.setState({ design })
488
+ return console.log(JSON.stringify(design, null, 2))
489
+ }
490
+
491
+ render() {
492
+ if (!this.state.schema) {
493
+ return R("div", null, "Loading...")
494
+ }
495
+
496
+ const dashboardDataSource = new DirectDashboardDataSource({
497
+ apiUrl: this.props.apiUrl,
498
+ schema: this.state.schema,
499
+ dataSource: this.state.dataSource
500
+ })
501
+
502
+ return R(
503
+ "div",
504
+ { style: { height: "100%" } },
505
+ React.createElement(visualization.DashboardComponent, {
506
+ schema: this.state.schema,
507
+ dataSource: this.state.dataSource,
508
+ dashboardDataSource,
509
+ design: this.state.design,
510
+ onDesignChange: this.handleDesignChange,
511
+ titleElem: "Sample"
512
+ })
513
+ )
514
+ }
515
+ }
516
+
517
+ // class MapPane extends React.Component
518
+ // constructor: (props) ->
519
+ // super
520
+
521
+ // @state = {
522
+ // schema: null
523
+ // dataSource: null
524
+ // design: mapDesign
525
+ // layerFactory: null
526
+ // }
527
+
528
+ // componentDidMount: ->
529
+ // $.getJSON @props.apiUrl + "jsonql/schema", (schemaJson) =>
530
+ // schema = new Schema(schemaJson)
531
+ // dataSource = new MWaterDataSource(@props.apiUrl, @props.client, { serverCaching: false, localCaching: true })
532
+
533
+ // layerFactory = new LayerFactory({
534
+ // schema: schema
535
+ // dataSource: dataSource
536
+ // apiUrl: @props.apiUrl
537
+ // client: @props.client
538
+ // newLayers: [
539
+ // { name: "Functional Status", type: "MWaterServer", design: { type: "functional_status", table: "entities.water_point" } }
540
+ // { name: "Custom Layer", type: "Markers", design: {} }
541
+ // ]
542
+ // onMarkerClick: (table, id) => alert("#{table}:#{id}")
543
+ // })
544
+
545
+ // @setState(schema: schema, dataSource: dataSource, layerFactory: layerFactory)
546
+
547
+ // handleDesignChange: (design) =>
548
+ // @setState(design: design)
549
+ // console.log JSON.stringify(design, null, 2)
550
+
551
+ // render: ->
552
+ // React.createElement(visualization.MapComponent, {
553
+ // layerFactory: @
554
+ // schema: PropTypes.object.isRequired
555
+ // dataSource: PropTypes.object.isRequired # Data source to use
556
+
557
+ // design: PropTypes.object.isRequired
558
+ // onDesignChange: PropTypes.func # Null/undefined for readonly
559
+ // })
560
+
561
+ var datagridDesign = {
562
+ table: "entities.water_point",
563
+ columns: [
564
+ {
565
+ id: "5859b3fc-64f0-42c1-a035-9dffbfd13132",
566
+ type: "expr",
567
+ width: 150,
568
+ expr: {
569
+ type: "field",
570
+ table: "entities.water_point",
571
+ column: "code"
572
+ }
573
+ },
574
+ {
575
+ id: "a2c21f4f-2f15-4d11-b2cc-eba8c85e0bbb",
576
+ type: "expr",
577
+ width: 150,
578
+ expr: {
579
+ type: "field",
580
+ table: "entities.water_point",
581
+ column: "desc"
582
+ }
583
+ },
584
+ {
585
+ id: "4162d2d4-c8d0-4e13-8075-7e42f44e57c2",
586
+ type: "expr",
587
+ width: 150,
588
+ expr: {
589
+ type: "field",
590
+ table: "entities.water_point",
591
+ column: "location"
592
+ }
593
+ },
594
+ {
595
+ id: "d5bb43c5-5666-43d9-aef5-3b20fe0d8eee",
596
+ type: "expr",
597
+ width: 150,
598
+ expr: {
599
+ type: "field",
600
+ table: "entities.water_point",
601
+ column: "location_accuracy"
602
+ }
603
+ },
604
+ {
605
+ id: "220f48a7-565f-4374-b42d-eed32a799421",
606
+ type: "expr",
607
+ width: 150,
608
+ expr: {
609
+ type: "field",
610
+ table: "entities.water_point",
611
+ column: "location_altitude"
612
+ }
613
+ },
614
+ {
615
+ id: "dcab1083-a60f-4def-bd7d-de4c9dff4945",
616
+ type: "expr",
617
+ width: 150,
618
+ expr: {
619
+ type: "field",
620
+ table: "entities.water_point",
621
+ column: "name"
622
+ }
623
+ },
624
+ {
625
+ id: "34671083-a60f-4def-bd7d-de4c9dff4945",
626
+ type: "expr",
627
+ width: 150,
628
+ expr: {
629
+ type: "field",
630
+ table: "entities.water_point",
631
+ column: "type"
632
+ }
633
+ },
634
+ {
635
+ id: "3e53e5f9-149d-4a69-8e90-a18a19efc843",
636
+ type: "expr",
637
+ width: 150,
638
+ expr: {
639
+ type: "field",
640
+ table: "entities.water_point",
641
+ column: "photos"
642
+ }
643
+ },
644
+ {
645
+ id: "aea0a8fd-1470-46ea-93e8-939b0797b0f6",
646
+ type: "expr",
647
+ width: 150,
648
+ expr: {
649
+ type: "field",
650
+ table: "entities.water_point",
651
+ column: "_created_by"
652
+ }
653
+ },
654
+ {
655
+ id: "918804c5-769e-4e4a-aacf-762d4474eb61",
656
+ type: "expr",
657
+ width: 150,
658
+ expr: {
659
+ type: "field",
660
+ table: "entities.water_point",
661
+ column: "_created_on"
662
+ }
663
+ }
664
+ ],
665
+ quickfilters: [
666
+ {
667
+ table: "entities.water_point",
668
+ expr: {
669
+ type: "field",
670
+ table: "entities.water_point",
671
+ column: "type"
672
+ },
673
+ label: null
674
+ }
675
+ ]
676
+ }
677
+
678
+ // mapDesign = {
679
+ // "baseLayer": "bing_road",
680
+ // "layerViews": [
681
+ // # { name: "Functional Status", type: "MWaterServer", design: { type: "functional_status", table: "entities.water_point" }, visible: true }
682
+ // # {
683
+ // # id: "4ed3415c-30c1-45fe-8984-dbffb9dd42d1"
684
+ // # name: "Choropleth"
685
+ // # type: "AdminIndicatorChoropleth"
686
+ // # design: {
687
+ // # scope: 'eb3e12a2-de1e-49a9-8afd-966eb55d47eb'
688
+ // # table: "entities.water_point"
689
+ // # adminRegionExpr: { type: "scalar", table: "entities.water_point", joins: ['admin_region'], expr: { type: "id", table: "admin_regions" } }
690
+ // # detailLevel: 1
691
+ // # condition: {
692
+ // # type: "op"
693
+ // # op: "="
694
+ // # table: "entities.water_point"
695
+ // # exprs: [
696
+ // # { type: "field", table: "entities.water_point", column: "type" }
697
+ // # { type: "literal", valueType: "enum", value: "Protected dug well" }
698
+ // # ]
699
+ // # }
700
+ // # }
701
+ // # visible: true
702
+ // # }
703
+ // # {
704
+ // # "id": "afbf76a3-29b8-4a11-882c-42aa21a3ca7a",
705
+ // # "name": "Untitled Layer",
706
+ // # "desc": "",
707
+ // # "type": "AdminChoropleth",
708
+ // # "visible": true,
709
+ // # "opacity": 1,
710
+ // # "design": {
711
+ // # "adminRegionExpr": {
712
+ // # "type": "scalar",
713
+ // # "table": "entities.water_point",
714
+ // # "joins": [
715
+ // # "admin_region"
716
+ // # ],
717
+ // # "expr": {
718
+ // # "type": "id",
719
+ // # "table": "admin_regions"
720
+ // # }
721
+ // # },
722
+ // # "axes": {
723
+ // # "color": {
724
+ // # "expr": {
725
+ // # "type": "op",
726
+ // # "op": "percent where",
727
+ // # "table": "entities.water_point",
728
+ // # "exprs": []
729
+ // # },
730
+ // # "xform": {
731
+ // # "type": "bin",
732
+ // # "numBins": 6,
733
+ // # "min": 0,
734
+ // # "max": 100
735
+ // # },
736
+ // # "colorMap": [
737
+ // # {
738
+ // # "value": 1,
739
+ // # "color": "#f8e71c"
740
+ // # },
741
+ // # {
742
+ // # "value": 2,
743
+ // # "color": "#7ed321"
744
+ // # },
745
+ // # {
746
+ // # "value": 3,
747
+ // # "color": "#f5a623"
748
+ // # },
749
+ // # {
750
+ // # "value": 4,
751
+ // # "color": "#d0021b"
752
+ // # },
753
+ // # {
754
+ // # "value": 5,
755
+ // # "color": "#4725f0"
756
+ // # }
757
+ // # ]
758
+ // # }
759
+ // # },
760
+ // # "opacity": 1,
761
+ // # "nameLabels": true,
762
+ // # "filter": null,
763
+ // # "scope": "eb3e12a2-de1e-49a9-8afd-966eb55d47eb",
764
+ // # "detailLevel": 1,
765
+ // # "table": "entities.water_point",
766
+ // # "color": "#9b9b9b"
767
+ // # }
768
+ // # }
769
+ // ]
770
+ // filters: {}
771
+ // bounds: {
772
+ // "w": 23.1591796875,
773
+ // "n": 4.214943141390651,
774
+ // "e": 44.2529296875,
775
+ // "s": -18.583775688370928
776
+ // }
777
+ // }
778
+
779
+ const mapDesign = {
780
+ baseLayer: "cartodb_positron",
781
+ layerViews: [
782
+ // {
783
+ // "id": "afbf76a3-29b8-4a11-882c-42aa21a3ca7a",
784
+ // "name": "Untitled Layer",
785
+ // "desc": "",
786
+ // "type": "AdminChoropleth",
787
+ // "visible": true,
788
+ // "opacity": 1,
789
+ // "design": {
790
+ // "adminRegionExpr": {
791
+ // "type": "scalar",
792
+ // "table": "entities.water_point",
793
+ // "joins": [
794
+ // "admin_region"
795
+ // ],
796
+ // "expr": {
797
+ // "type": "id",
798
+ // "table": "admin_regions"
799
+ // }
800
+ // },
801
+ // "axes": {
802
+ // "color": {
803
+ // "expr": {
804
+ // "type": "op",
805
+ // "op": "percent where",
806
+ // "table": "entities.water_point",
807
+ // "exprs": [
808
+ // {
809
+ // "type": "op",
810
+ // "table": "entities.water_point",
811
+ // "op": "= any",
812
+ // "exprs": [
813
+ // {
814
+ // "type": "field",
815
+ // "table": "entities.water_point",
816
+ // "column": "type"
817
+ // },
818
+ // {
819
+ // "type": "literal",
820
+ // "valueType": "enumset",
821
+ // "value": [
822
+ // "Protected dug well"
823
+ // ]
824
+ // }
825
+ // ]
826
+ // }
827
+ // ]
828
+ // },
829
+ // "xform": {
830
+ // "type": "bin",
831
+ // "numBins": 6,
832
+ // "min": 0,
833
+ // "max": 100
834
+ // },
835
+ // "colorMap": [
836
+ // {
837
+ // "value": 0,
838
+ // "color": "#c1cce6"
839
+ // },
840
+ // {
841
+ // "value": 1,
842
+ // "color": "#99abd6"
843
+ // },
844
+ // {
845
+ // "value": 2,
846
+ // "color": "#748dc8"
847
+ // },
848
+ // {
849
+ // "value": 3,
850
+ // "color": "#4c6db8"
851
+ // },
852
+ // {
853
+ // "value": 4,
854
+ // "color": "#3c5796"
855
+ // },
856
+ // {
857
+ // "value": 5,
858
+ // "color": "#2d4171"
859
+ // },
860
+ // {
861
+ // "value": 6,
862
+ // "color": "#1d2a49"
863
+ // },
864
+ // {
865
+ // "value": 7,
866
+ // "color": "#0f1524"
867
+ // }
868
+ // ]
869
+ // }
870
+ // },
871
+ // "opacity": 1,
872
+ // "nameLabels": true,
873
+ // "filter": null,
874
+ // "scope": "eb3e12a2-de1e-49a9-8afd-966eb55d47eb",
875
+ // "detailLevel": 1,
876
+ // "table": "entities.water_point",
877
+ // "color": "#9b9b9b",
878
+ // "fillOpacity": 0.75,
879
+ // "displayNames": true
880
+ // }
881
+ // },
882
+ {
883
+ id: "0c6525a2-1300-48db-b793-ba7806827f3c",
884
+ name: "Untitled Layer",
885
+ desc: "",
886
+ type: "Markers",
887
+ visible: false,
888
+ opacity: 1,
889
+ design: {
890
+ axes: {
891
+ geometry: {
892
+ expr: {
893
+ type: "field",
894
+ table: "entities.water_point",
895
+ column: "location"
896
+ }
897
+ },
898
+ color: {
899
+ expr: {
900
+ type: "field",
901
+ table: "entities.water_point",
902
+ column: "drilling_method_other"
903
+ },
904
+ colorMap: [
905
+ {
906
+ value: null,
907
+ color: "#d49097"
908
+ },
909
+ {
910
+ value: "a pied",
911
+ color: "#ba4f5a"
912
+ },
913
+ {
914
+ value: "testing other",
915
+ color: "#81323a"
916
+ },
917
+ {
918
+ value: "A pied",
919
+ color: "#3e181c"
920
+ }
921
+ ],
922
+ drawOrder: [null, "a pied", "testing other", "A pied"]
923
+ }
924
+ },
925
+ color: "#0088FF",
926
+ filter: null,
927
+ table: "entities.water_point",
928
+ popup: {
929
+ items: {
930
+ id: "root",
931
+ type: "root",
932
+ blocks: [
933
+ {
934
+ id: "f5dcf519-0287-4f65-ab44-abdd609b704b",
935
+ type: "horizontal",
936
+ blocks: [
937
+ {
938
+ id: "e50f7026-44f2-44fd-9c19-a2c412d6cf10",
939
+ type: "vertical",
940
+ blocks: [
941
+ {
942
+ type: "widget",
943
+ widgetType: "Text",
944
+ design: {
945
+ style: "title",
946
+ items: [
947
+ {
948
+ type: "expr",
949
+ id: "1af0f88c-db39-46bb-ad5a-4777a7d0357d",
950
+ expr: {
951
+ type: "field",
952
+ table: "entities.water_point",
953
+ column: "name"
954
+ }
955
+ }
956
+ ]
957
+ },
958
+ id: "b2becac4-db3c-48b8-92db-9f1d2da0df97"
959
+ },
960
+ {
961
+ type: "widget",
962
+ widgetType: "Text",
963
+ design: {
964
+ items: [
965
+ "Description: ",
966
+ {
967
+ type: "expr",
968
+ id: "d3813f6f-a8c6-4783-80ca-70a18e8fa630",
969
+ expr: {
970
+ type: "field",
971
+ table: "entities.water_point",
972
+ column: "desc"
973
+ }
974
+ },
975
+ {
976
+ type: "element",
977
+ tag: "div",
978
+ items: [
979
+ "Type: ",
980
+ {
981
+ type: "expr",
982
+ id: "7c74bf50-d649-4e25-a80b-27504d029f4c",
983
+ expr: {
984
+ type: "field",
985
+ table: "entities.water_point",
986
+ column: "type"
987
+ }
988
+ },
989
+ {
990
+ type: "element",
991
+ tag: "br",
992
+ items: []
993
+ }
994
+ ]
995
+ }
996
+ ]
997
+ },
998
+ id: "47e4be90-cfad-4145-8afd-3adfb2ac2882"
999
+ }
1000
+ ]
1001
+ },
1002
+ {
1003
+ type: "widget",
1004
+ widgetType: "Image",
1005
+ design: {},
1006
+ id: "858fb20f-5f5f-48cf-8fe3-a4f3639b7684"
1007
+ }
1008
+ ]
1009
+ }
1010
+ ]
1011
+ }
1012
+ }
1013
+ }
1014
+ },
1015
+ {
1016
+ id: "cc3771af-ce10-48ee-b48a-e698513fa8bf",
1017
+ name: "Untitled Layer",
1018
+ desc: "",
1019
+ type: "Buffer",
1020
+ visible: false,
1021
+ opacity: 1,
1022
+ design: {
1023
+ axes: {
1024
+ geometry: {
1025
+ expr: {
1026
+ type: "field",
1027
+ table: "entities.water_point",
1028
+ column: "location"
1029
+ }
1030
+ },
1031
+ color: {
1032
+ expr: {
1033
+ type: "field",
1034
+ table: "entities.water_point",
1035
+ column: "drilling_method"
1036
+ },
1037
+ colorMap: [
1038
+ {
1039
+ value: "manual",
1040
+ color: "#d49097"
1041
+ },
1042
+ {
1043
+ value: "mechanical",
1044
+ color: "#a9424c"
1045
+ },
1046
+ {
1047
+ value: "other",
1048
+ color: "#542126"
1049
+ }
1050
+ ],
1051
+ drawOrder: ["manual", "mechanical", "other"]
1052
+ }
1053
+ },
1054
+ radius: 100000,
1055
+ fillOpacity: 0.5,
1056
+ filter: null,
1057
+ table: "entities.water_point",
1058
+ color: "#6244f8"
1059
+ }
1060
+ }
1061
+ ],
1062
+ filters: {},
1063
+ bounds: {
1064
+ // "w": 10.590820312499998,
1065
+ // "n": 15.241789855961722,
1066
+ // "e": 41.4404296875,
1067
+ // "s": -27.33273513685913
1068
+ w: 10.590820312499998,
1069
+ n: 15.241789855961722,
1070
+ e: 41.4404296875,
1071
+ s: -27.33273513685913
1072
+ }
1073
+ }
1074
+
1075
+ // bounds: { w: -40, n: 25, e: 40, s: -25 }
1076
+ // mapDesign = {
1077
+ // "baseLayer": "bing_road",
1078
+ // "layerViews": [
1079
+ // {
1080
+ // id: "4ed3415c-30c1-45fe-8984-dbffb9dd42d1"
1081
+ // name: "Buffer"
1082
+ // type: "Buffer"
1083
+ // design: {
1084
+ // table: "entities.water_point"
1085
+ // opacity: 0.5
1086
+ // radius: 1000
1087
+ // "axes": {
1088
+ // "geometry": {
1089
+ // "expr": {
1090
+ // "type": "field",
1091
+ // "table": "entities.water_point",
1092
+ // "column": "location"
1093
+ // },
1094
+ // "xform": null
1095
+ // }
1096
+ // "color": {
1097
+ // "expr": {
1098
+ // "type": "field",
1099
+ // "table": "entities.water_point",
1100
+ // "column": "type"
1101
+ // },
1102
+ // "xform": null,
1103
+ // "colorMap": [
1104
+ // {
1105
+ // "value": "Protected dug well",
1106
+ // "color": "#d0021b"
1107
+ // },
1108
+ // {
1109
+ // "value": "Piped into dwelling",
1110
+ // "color": "#7ed321"
1111
+ // },
1112
+ // {
1113
+ // "value": "Borehole or tubewell",
1114
+ // "color": "#f8e71c"
1115
+ // }
1116
+ // ]
1117
+ // }
1118
+ // },
1119
+ // color: "#9b9b9b"
1120
+ // filter: null
1121
+ // }
1122
+ // visible: true
1123
+ // }
1124
+ // { id: "old_func_status", name: "Functional Status", type: "MWaterServer", design: { type: "functional_status", table: "entities.water_point" }, visible: true }
1125
+ // ]
1126
+ // filters: {}
1127
+ // bounds: {
1128
+ // "w": 32.75848388671875,
1129
+ // "n": -2.217997457638444,
1130
+ // "e": 33.4808349609375,
1131
+ // "s": -2.9375549775994263
1132
+ // }
1133
+ // }
1134
+
1135
+ const imageWidgetDashboardDesign = {
1136
+ items: {
1137
+ "3f8ffda5-79c4-423d-95f3-152b94bba6d4": {
1138
+ layout: {
1139
+ x: 0,
1140
+ y: 0,
1141
+ w: 9,
1142
+ h: 7
1143
+ },
1144
+ widget: {
1145
+ type: "Image",
1146
+ design: {
1147
+ uid: "cfce4760503a422d88da67ef55b1e82b",
1148
+ imageUrl: null,
1149
+ expr: null
1150
+ // "imageURL": "https://img0.etsystatic.com/108/0/6281042/il_570xN.916411774_dslp.jpg"
1151
+ }
1152
+ }
1153
+ }
1154
+ }
1155
+ }
1156
+
1157
+ let oldDashboardDesign = {
1158
+ items: {
1159
+ "c83b1d83-bc2b-4c87-a7fc-2e4bcd7694d8": {
1160
+ layout: {
1161
+ x: 0,
1162
+ y: 0,
1163
+ w: 8,
1164
+ h: 8
1165
+ },
1166
+ widget: {
1167
+ type: "Map",
1168
+ design: {
1169
+ baseLayer: "bing_road",
1170
+ layerViews: [
1171
+ {
1172
+ id: "53c9d731-dbe6-4987-b0ef-434a944b26b5",
1173
+ name: "Water points",
1174
+ desc: "",
1175
+ type: "Markers",
1176
+ visible: true,
1177
+ opacity: 1,
1178
+ design: {
1179
+ axes: {
1180
+ geometry: {
1181
+ expr: {
1182
+ type: "field",
1183
+ table: "entities.water_point",
1184
+ column: "location"
1185
+ }
1186
+ },
1187
+ color: {
1188
+ expr: {
1189
+ type: "field",
1190
+ table: "entities.water_point",
1191
+ column: "drilling_method_other"
1192
+ },
1193
+ colorMap: [
1194
+ {
1195
+ value: null,
1196
+ color: "#d49097"
1197
+ },
1198
+ {
1199
+ value: "a pied",
1200
+ color: "#ba4f5a"
1201
+ },
1202
+ {
1203
+ value: "testing other",
1204
+ color: "#81323a"
1205
+ },
1206
+ {
1207
+ value: "A pied",
1208
+ color: "#3e181c"
1209
+ }
1210
+ ],
1211
+ drawOrder: [null, "a pied", "testing other", "A pied"]
1212
+ }
1213
+ },
1214
+ color: "#0088FF",
1215
+ filter: null,
1216
+ table: "entities.water_point",
1217
+ symbol: "font-awesome/star"
1218
+ }
1219
+ },
1220
+ {
1221
+ id: "53c9d731-dbe6-4987-b0ef-434a944b26a5",
1222
+ name: "Schools",
1223
+ desc: "",
1224
+ type: "Markers",
1225
+ visible: true,
1226
+ opacity: 1,
1227
+ design: {
1228
+ axes: {
1229
+ geometry: {
1230
+ expr: {
1231
+ type: "field",
1232
+ table: "entities.school",
1233
+ column: "location"
1234
+ }
1235
+ }
1236
+ },
1237
+ color: "#5e354c",
1238
+ filter: null,
1239
+ table: "entities.school",
1240
+ symbol: "font-awesome/h-square"
1241
+ }
1242
+ },
1243
+ {
1244
+ id: "656b346f-c4ee-41e7-b6bc-2c7361403d62",
1245
+ name: "Affected Area",
1246
+ desc: "",
1247
+ type: "Buffer",
1248
+ visible: true,
1249
+ opacity: 1,
1250
+ design: {
1251
+ axes: {
1252
+ geometry: {
1253
+ expr: {
1254
+ type: "field",
1255
+ table: "entities.water_system",
1256
+ column: "location"
1257
+ }
1258
+ },
1259
+ color: {
1260
+ expr: {
1261
+ type: "scalar",
1262
+ table: "entities.water_system",
1263
+ joins: ["!entities.water_point.water_system"],
1264
+ expr: {
1265
+ type: "op",
1266
+ op: "count",
1267
+ table: "entities.water_point",
1268
+ exprs: []
1269
+ }
1270
+ },
1271
+ xform: {
1272
+ type: "bin",
1273
+ numBins: 6,
1274
+ min: 1,
1275
+ max: 3000
1276
+ },
1277
+ colorMap: [
1278
+ {
1279
+ value: 0,
1280
+ color: "#9c9ede"
1281
+ },
1282
+ {
1283
+ value: 1,
1284
+ color: "#7375b5"
1285
+ },
1286
+ {
1287
+ value: 2,
1288
+ color: "#4a5584"
1289
+ },
1290
+ {
1291
+ value: 3,
1292
+ color: "#cedb9c"
1293
+ },
1294
+ {
1295
+ value: 4,
1296
+ color: "#b5cf6b"
1297
+ },
1298
+ {
1299
+ value: 5,
1300
+ color: "#8ca252"
1301
+ },
1302
+ {
1303
+ value: 6,
1304
+ color: "#637939"
1305
+ },
1306
+ {
1307
+ value: 7,
1308
+ color: "#e7cb94"
1309
+ }
1310
+ ],
1311
+ drawOrder: [7, 2, 5, 6, 1, 0, 3, 4]
1312
+ }
1313
+ },
1314
+ radius: 500000,
1315
+ fillOpacity: 0.5,
1316
+ filter: null,
1317
+ table: "entities.water_system",
1318
+ color: "#25250e"
1319
+ }
1320
+ },
1321
+ {
1322
+ id: "1ae794c7-77e5-41c5-beba-54734221a7ba",
1323
+ name: "Water surfaces",
1324
+ desc: "",
1325
+ type: "AdminChoropleth",
1326
+ visible: true,
1327
+ opacity: 1,
1328
+ design: {
1329
+ color: "#8f5c5c",
1330
+ adminRegionExpr: {
1331
+ type: "scalar",
1332
+ table: "entities.surface_water",
1333
+ joins: ["admin_region"],
1334
+ expr: {
1335
+ type: "id",
1336
+ table: "admin_regions"
1337
+ }
1338
+ },
1339
+ axes: {
1340
+ color: {
1341
+ expr: {
1342
+ type: "op",
1343
+ op: "count",
1344
+ table: "entities.surface_water",
1345
+ exprs: []
1346
+ },
1347
+ xform: {
1348
+ type: "bin",
1349
+ numBins: 6,
1350
+ min: 0,
1351
+ max: 1000
1352
+ },
1353
+ colorMap: [
1354
+ {
1355
+ value: 0,
1356
+ color: "#c1e6e6"
1357
+ },
1358
+ {
1359
+ value: 1,
1360
+ color: "#99d6d6"
1361
+ },
1362
+ {
1363
+ value: 2,
1364
+ color: "#74c8c8"
1365
+ },
1366
+ {
1367
+ value: 3,
1368
+ color: "#4cb8b8"
1369
+ },
1370
+ {
1371
+ value: 4,
1372
+ color: "#3c9696"
1373
+ },
1374
+ {
1375
+ value: 5,
1376
+ color: "#2d7171"
1377
+ },
1378
+ {
1379
+ value: 6,
1380
+ color: "#1d4949"
1381
+ },
1382
+ {
1383
+ value: 7,
1384
+ color: "#0f2424"
1385
+ }
1386
+ ]
1387
+ }
1388
+ },
1389
+ fillOpacity: 0.75,
1390
+ displayNames: true,
1391
+ filter: null,
1392
+ scope: null,
1393
+ detailLevel: 0,
1394
+ table: "entities.surface_water"
1395
+ }
1396
+ }
1397
+ ],
1398
+ filters: {},
1399
+ bounds: {
1400
+ w: -69.9609375,
1401
+ n: 57.136239319177434,
1402
+ e: 69.9609375,
1403
+ s: -57.13623931917743
1404
+ }
1405
+ }
1406
+ }
1407
+ }
1408
+ // "4ed3415c-30c1-45fe-8984-dbffb9dd42d1": {
1409
+ // "layout": {
1410
+ // "x": 0,
1411
+ // "y": 0,
1412
+ // "w": 8,
1413
+ // "h": 8
1414
+ // },
1415
+ // "widget": {
1416
+ // "type": "LayeredChart",
1417
+ // "design": {
1418
+ // "xAxisLabelText": "",
1419
+ // "yAxisLabelText": "",
1420
+ // "version": 2,
1421
+ // "layers": [
1422
+ // {
1423
+ // "axes": {
1424
+ // "color": {
1425
+ // "expr": {
1426
+ // "type": "scalar",
1427
+ // "table": "entities.water_point",
1428
+ // "joins": [
1429
+ // "!indicator_values:c0adc9f1c9be4271af9d722b7e50b4c9.Water point"
1430
+ // ],
1431
+ // "expr": {
1432
+ // "type": "field",
1433
+ // "table": "indicator_values:c0adc9f1c9be4271af9d722b7e50b4c9",
1434
+ // "column": "Functionality"
1435
+ // },
1436
+ // "aggr": "last"
1437
+ // },
1438
+ // "xform": null
1439
+ // },
1440
+ // "y": {
1441
+ // "expr": {
1442
+ // "type": "id",
1443
+ // "table": "entities.water_point"
1444
+ // },
1445
+ // "aggr": "count",
1446
+ // "xform": null
1447
+ // }
1448
+ // },
1449
+ // "filter": {
1450
+ // "type": "op",
1451
+ // "table": "entities.water_point",
1452
+ // "op": "= any",
1453
+ // "exprs": [
1454
+ // {
1455
+ // "type": "scalar",
1456
+ // "table": "entities.water_point",
1457
+ // "joins": [
1458
+ // "!indicator_values:c0adc9f1c9be4271af9d722b7e50b4c9.Water point"
1459
+ // ],
1460
+ // "expr": {
1461
+ // "type": "field",
1462
+ // "table": "indicator_values:c0adc9f1c9be4271af9d722b7e50b4c9",
1463
+ // "column": "Functionality"
1464
+ // },
1465
+ // "aggr": "last"
1466
+ // },
1467
+ // {
1468
+ // "type": "literal",
1469
+ // "valueType": "enumset",
1470
+ // "value": []
1471
+ // }
1472
+ // ]
1473
+ // },
1474
+ // "table": "entities.water_point"
1475
+ // }
1476
+ // ],
1477
+ // "type": "donut"
1478
+ // }
1479
+ // }
1480
+ // },
1481
+ // "1219bae7-b616-4c53-8423-a6495ecf26f9": {
1482
+ // "layout": {
1483
+ // "x": 16,
1484
+ // "y": 0,
1485
+ // "w": 8,
1486
+ // "h": 8
1487
+ // },
1488
+ // "widget": {
1489
+ // "type": "ImageMosaicChart",
1490
+ // "design": {
1491
+ // "version": 1,
1492
+ // "imageAxis": {
1493
+ // "expr": {
1494
+ // "type": "field",
1495
+ // "table": "entities.community",
1496
+ // "column": "photos"
1497
+ // }
1498
+ // },
1499
+ // "filter": null,
1500
+ // "table": "entities.community",
1501
+ // "titleText": "gfhfdg hdfgh dfh"
1502
+ // }
1503
+ // }
1504
+ // },
1505
+ // "c84506e8-727d-4515-9579-fd66220ebdea": {
1506
+ // "layout": {
1507
+ // "x": 8,
1508
+ // "y": 0,
1509
+ // "w": 8,
1510
+ // "h": 8
1511
+ // },
1512
+ // "widget": {
1513
+ // "type": "TableChart",
1514
+ // "design": {
1515
+ // "version": 1,
1516
+ // "columns": [
1517
+ // {
1518
+ // "textAxis": {
1519
+ // "expr": {
1520
+ // "type": "op",
1521
+ // "op": "count",
1522
+ // "table": "entities.water_point",
1523
+ // "exprs": []
1524
+ // }
1525
+ // },
1526
+ // "headerText": "# Water points"
1527
+ // },
1528
+ // {
1529
+ // "textAxis": {
1530
+ // "expr": {
1531
+ // "type": "op",
1532
+ // "table": "entities.water_point",
1533
+ // "op": "percent where",
1534
+ // "exprs": [
1535
+ // {
1536
+ // "type": "op",
1537
+ // "table": "entities.water_point",
1538
+ // "op": "= any",
1539
+ // "exprs": [
1540
+ // {
1541
+ // "type": "field",
1542
+ // "table": "entities.water_point",
1543
+ // "column": "type"
1544
+ // },
1545
+ // {
1546
+ // "type": "literal",
1547
+ // "valueType": "enumset",
1548
+ // "value": [
1549
+ // "Protected dug well",
1550
+ // "Unprotected dug well"
1551
+ // ]
1552
+ // }
1553
+ // ]
1554
+ // }
1555
+ // ]
1556
+ // }
1557
+ // },
1558
+ // "headerText": "% Dug Wells"
1559
+ // },
1560
+ // {
1561
+ // "textAxis": {
1562
+ // "expr": {
1563
+ // "type": "scalar",
1564
+ // "table": "entities.water_point",
1565
+ // "joins": [
1566
+ // "admin_region"
1567
+ // ],
1568
+ // "expr": {
1569
+ // "type": "field",
1570
+ // "table": "admin_regions",
1571
+ // "column": "country"
1572
+ // }
1573
+ // }
1574
+ // },
1575
+ // "headerText": "Country"
1576
+ // }
1577
+ // ],
1578
+ // "orderings": [
1579
+ // {
1580
+ // "axis": {
1581
+ // "expr": {
1582
+ // "type": "op",
1583
+ // "op": "count",
1584
+ // "table": "entities.water_point",
1585
+ // "exprs": []
1586
+ // }
1587
+ // },
1588
+ // "direction": "desc"
1589
+ // }
1590
+ // ],
1591
+ // "table": "entities.water_point"
1592
+ // }
1593
+ // }
1594
+ // }
1595
+ }
1596
+ }
1597
+ // "d41a2dd2-85bd-46d8-af9a-a650af4c0047": {
1598
+ // "layout": {
1599
+ // "x": 16,
1600
+ // "y": 0,
1601
+ // "w": 8,
1602
+ // "h": 6
1603
+ // },
1604
+ // "widget": {
1605
+ // "type": "TableChart",
1606
+ // "design": {
1607
+ // "version": 1,
1608
+ // "columns": [
1609
+ // {
1610
+ // "textAxis": {
1611
+ // "expr": {
1612
+ // "type": "scalar",
1613
+ // "table": "entities.water_point",
1614
+ // "joins": [],
1615
+ // "expr": {
1616
+ // "type": "field",
1617
+ // "table": "entities.water_point",
1618
+ // "column": "type"
1619
+ // }
1620
+ // },
1621
+ // "headerText": "This is a reallyyyyyyyyyy long title "
1622
+ // }
1623
+ // },
1624
+ // {
1625
+ // "textAxis": {
1626
+ // "expr": {
1627
+ // "type": "scalar",
1628
+ // "table": "entities.water_point",
1629
+ // "joins": [],
1630
+ // "expr": {
1631
+ // "type": "count",
1632
+ // "table": "entities.water_point"
1633
+ // }
1634
+ // },
1635
+ // "aggr": "count",
1636
+ // "headerText": "This is a reallyyyyyyyyyy long title "
1637
+ // }
1638
+ // },
1639
+ // {
1640
+ // "textAxis": {
1641
+ // "expr": {
1642
+ // "type": "field",
1643
+ // "table": "entities.water_point",
1644
+ // "column": "desc"
1645
+ // }
1646
+ // },
1647
+ // "headerText": "This is a reallyyyyyyyyyy long title "
1648
+ // }
1649
+ // ],
1650
+ // "orderings": [],
1651
+ // "table": "entities.water_point",
1652
+ // "titleText": "TEST",
1653
+ // "filter": {
1654
+ // "type": "op",
1655
+ // "table": "entities.water_point",
1656
+ // "op": "=",
1657
+ // "exprs": [
1658
+ // {
1659
+ // "type": "field",
1660
+ // "table": "entities.water_point",
1661
+ // "column": "code"
1662
+ // },
1663
+ // {
1664
+ // "type": "literal",
1665
+ // "valueType": "text",
1666
+ // "value": "10007"
1667
+ // }
1668
+ // ]
1669
+ // }
1670
+ // }
1671
+ // }
1672
+ // },
1673
+ // "d2ea9c20-bcd3-46f6-8f78-ccb795d1a91a": {
1674
+ // "layout": {
1675
+ // "x": 0,
1676
+ // "y": 0,
1677
+ // "w": 8,
1678
+ // "h": 8
1679
+ // },
1680
+ // "widget": {
1681
+ // "type": "Map",
1682
+ // "design": {
1683
+ // "baseLayer": "bing_road",
1684
+ // "layerViews": [
1685
+ // {
1686
+ // "id": "827187bf-a5fd-4d07-b34b-1e213407f96d",
1687
+ // "name": "Custom Layer",
1688
+ // "desc": "",
1689
+ // "type": "Markers",
1690
+ // "design": {
1691
+ // "sublayers": [
1692
+ // {
1693
+ // "axes": {
1694
+ // "geometry": {
1695
+ // "expr": {
1696
+ // "type": "field",
1697
+ // "table": "entities.water_point",
1698
+ // "column": "location"
1699
+ // },
1700
+ // "xform": null
1701
+ // },
1702
+ // "color": {
1703
+ // "expr": {
1704
+ // "type": "field",
1705
+ // "table": "entities.water_point",
1706
+ // "column": "type"
1707
+ // },
1708
+ // "xform": null,
1709
+ // "colorMap": [
1710
+ // {
1711
+ // "value": "Protected dug well",
1712
+ // "color": "#d0021b"
1713
+ // },
1714
+ // {
1715
+ // "value": "Piped into dwelling",
1716
+ // "color": "#4a90e2"
1717
+ // }
1718
+ // ]
1719
+ // }
1720
+ // },
1721
+ // "color": "#0088FF",
1722
+ // "filter": null,
1723
+ // "table": "entities.water_point",
1724
+ // "symbol": "font-awesome/star"
1725
+ // }
1726
+ // ]
1727
+ // },
1728
+ // "visible": true,
1729
+ // "opacity": 1
1730
+ // }
1731
+ // ],
1732
+ // "filters": {},
1733
+ // "bounds": {
1734
+ // "w": -103.7548828125,
1735
+ // "n": 23.160563309048314,
1736
+ // "e": -92.4169921875,
1737
+ // "s": 12.382928338487408
1738
+ // }
1739
+ // }
1740
+ // }
1741
+ // },
1742
+ // "9ef85e17-73aa-4b5f-8363-95f9a2e24193": {
1743
+ // "layout": {
1744
+ // "x": 8,
1745
+ // "y": 0,
1746
+ // "w": 8,
1747
+ // "h": 8
1748
+ // },
1749
+ // "widget": {
1750
+ // "type": "LayeredChart",
1751
+ // "design": {
1752
+ // "version": 1,
1753
+ // "layers": [
1754
+ // {
1755
+ // "axes": {
1756
+ // "x": {
1757
+ // "expr": {
1758
+ // "type": "field",
1759
+ // "table": "entities.water_point",
1760
+ // "column": "type"
1761
+ // },
1762
+ // "xform": null
1763
+ // },
1764
+ // "y": {
1765
+ // "expr": {
1766
+ // "type": "id",
1767
+ // "table": "entities.water_point"
1768
+ // },
1769
+ // "aggr": "count",
1770
+ // "xform": null
1771
+ // }
1772
+ // },
1773
+ // "filter": null,
1774
+ // "table": "entities.water_point"
1775
+ // }
1776
+ // ],
1777
+ // "type": "bar"
1778
+ // }
1779
+ // }
1780
+ // }
1781
+ // }
1782
+ // }
1783
+
1784
+ // {
1785
+ // "items": {
1786
+ // "df5aa9d4-20fb-4735-9178-ba7cc543fa27": {
1787
+ // "layout": {
1788
+ // "x": 0,
1789
+ // "y": 0,
1790
+ // "w": 8,
1791
+ // "h": 8
1792
+ // },
1793
+ // "widget": {
1794
+ // "type": "LayeredChart",
1795
+ // "design": {
1796
+ // "version": 1,
1797
+ // "layers": [
1798
+ // {
1799
+ // "axes": {
1800
+ // "x": {
1801
+ // "expr": {
1802
+ // "type": "field",
1803
+ // "table": "responses:e24f0a0ec11643cab3c21c07de2f6889",
1804
+ // "column": "data:fd43a6faa6764490ab82eae19d71af71:value"
1805
+ // },
1806
+ // "xform": {
1807
+ // "type": "bin",
1808
+ // "numBins": 6
1809
+ // }
1810
+ // },
1811
+ // "y": {
1812
+ // "expr": {
1813
+ // "type": "id",
1814
+ // "table": "responses:e24f0a0ec11643cab3c21c07de2f6889"
1815
+ // },
1816
+ // "aggr": "count",
1817
+ // "xform": null
1818
+ // }
1819
+ // },
1820
+ // "filter": null,
1821
+ // "table": "responses:e24f0a0ec11643cab3c21c07de2f6889"
1822
+ // }
1823
+ // ],
1824
+ // "type": "bar"
1825
+ // }
1826
+ // }
1827
+ // }
1828
+ // }
1829
+ // }
1830
+
1831
+ // "items": {
1832
+ // "0f55a8aa-afff-4511-870d-63dd604c1525": {
1833
+ // "layout": {
1834
+ // "x": 0,
1835
+ // "y": 0,
1836
+ // "w": 8,
1837
+ // "h": 8
1838
+ // },
1839
+ // "widget": {
1840
+ // "type": "Map",
1841
+ // "design": {
1842
+ // "baseLayer": "bing_road",
1843
+ // "layerViews": [
1844
+ // {
1845
+ // "id": "7002dace-6b00-44f6-98fb-d136817ac6c1",
1846
+ // "name": "Custom Layer",
1847
+ // "desc": "",
1848
+ // "type": "Markers",
1849
+ // "design": {
1850
+ // "sublayers": [
1851
+ // {
1852
+ // "axes": {
1853
+ // "geometry": {
1854
+ // "expr": {
1855
+ // "type": "field",
1856
+ // "table": "entities.community",
1857
+ // "column": "location"
1858
+ // },
1859
+ // "xform": null
1860
+ // }
1861
+ // },
1862
+ // "color": "#0088FF",
1863
+ // "filter": null,
1864
+ // "table": "entities.community",
1865
+ // "symbol": "font-awesome/times"
1866
+ // }
1867
+ // ]
1868
+ // },
1869
+ // "visible": true,
1870
+ // "opacity": 1
1871
+ // }
1872
+ // ],
1873
+ // "filters": {},
1874
+ // "bounds": {
1875
+ // "w": -52.91015625,
1876
+ // "n": 46.6795944656402,
1877
+ // "e": 52.91015625,
1878
+ // "s": -46.679594465640186
1879
+ // }
1880
+ // }
1881
+ // }
1882
+ // }
1883
+ // }
1884
+ // }
1885
+
1886
+ // "items": {
1887
+ // "c78d1987-a14e-4cab-b772-4a56136e2641": {
1888
+ // "layout": {
1889
+ // "x": 0,
1890
+ // "y": 0,
1891
+ // "w": 8,
1892
+ // "h": 8
1893
+ // },
1894
+ // "widget": {
1895
+ // "type": "CalendarChart",
1896
+ // "design": {
1897
+ // "version": 1,
1898
+ // "dateAxis": {
1899
+ // "expr": {
1900
+ // "type": "field",
1901
+ // "table": "entities.water_point",
1902
+ // "column": "_created_on"
1903
+ // },
1904
+ // "xform": {
1905
+ // "type": "date"
1906
+ // }
1907
+ // },
1908
+ // "valueAxis": {
1909
+ // "expr": {
1910
+ // "type": "id",
1911
+ // "table": "entities.water_point"
1912
+ // },
1913
+ // "aggr": "count",
1914
+ // "xform": null
1915
+ // },
1916
+ // "filter": null,
1917
+ // "table": "entities.water_point"
1918
+ // }
1919
+ // }
1920
+ // }
1921
+ // }
1922
+ // }
1923
+
1924
+ oldDashboardDesign = {
1925
+ items: {
1926
+ "e08ef8a3-34db-467d-ac78-f0f273d49f25": {
1927
+ layout: {
1928
+ x: 0,
1929
+ y: 0,
1930
+ w: 8,
1931
+ h: 8
1932
+ },
1933
+ widget: {
1934
+ type: "Markdown",
1935
+ design: {
1936
+ markdown:
1937
+ "# Header 1\n## Header 2\n### Header 3\nText Text Text More Text\nLorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
1938
+ }
1939
+ }
1940
+ },
1941
+ "9d8df869-8869-4191-aa18-b58142f9c961": {
1942
+ layout: {
1943
+ x: 8,
1944
+ y: 0,
1945
+ w: 10,
1946
+ h: 8
1947
+ },
1948
+ widget: {
1949
+ type: "LayeredChart",
1950
+ design: {
1951
+ version: 1,
1952
+ layers: [
1953
+ {
1954
+ axes: {
1955
+ color: {
1956
+ expr: {
1957
+ type: "scalar",
1958
+ table: "entities.water_point",
1959
+ joins: [],
1960
+ expr: {
1961
+ type: "field",
1962
+ table: "entities.water_point",
1963
+ column: "type"
1964
+ }
1965
+ },
1966
+ xform: null
1967
+ },
1968
+ y: {
1969
+ expr: {
1970
+ type: "scalar",
1971
+ table: "entities.water_point",
1972
+ expr: {
1973
+ type: "count",
1974
+ table: "entities.water_point"
1975
+ },
1976
+ joins: []
1977
+ },
1978
+ aggr: "count",
1979
+ xform: null
1980
+ }
1981
+ },
1982
+ filter: null,
1983
+ table: "entities.water_point"
1984
+ }
1985
+ ],
1986
+ type: "donut"
1987
+ }
1988
+ }
1989
+ },
1990
+ "409d7b5b-e1d9-4e18-bd45-afdead7fe18f": {
1991
+ layout: {
1992
+ x: 0,
1993
+ y: 8,
1994
+ w: 18,
1995
+ h: 8
1996
+ },
1997
+ widget: {
1998
+ type: "LayeredChart",
1999
+ design: {
2000
+ version: 1,
2001
+ layers: [
2002
+ {
2003
+ axes: {
2004
+ x: {
2005
+ expr: {
2006
+ type: "scalar",
2007
+ table: "entities.news_item",
2008
+ joins: [],
2009
+ expr: {
2010
+ type: "field",
2011
+ table: "entities.news_item",
2012
+ column: "post_country"
2013
+ }
2014
+ },
2015
+ xform: null
2016
+ },
2017
+ y: {
2018
+ expr: {
2019
+ type: "scalar",
2020
+ table: "entities.news_item",
2021
+ expr: {
2022
+ type: "count",
2023
+ table: "entities.news_item"
2024
+ },
2025
+ joins: []
2026
+ },
2027
+ aggr: "count",
2028
+ xform: null
2029
+ }
2030
+ },
2031
+ filter: null,
2032
+ table: "entities.news_item"
2033
+ }
2034
+ ],
2035
+ type: "bar",
2036
+ titleText: "Some Title"
2037
+ }
2038
+ }
2039
+ },
2040
+ "d41a2dd2-85bd-46d8-af9a-a650af4c0047": {
2041
+ layout: {
2042
+ x: 0,
2043
+ y: 16,
2044
+ w: 8,
2045
+ h: 8
2046
+ },
2047
+ widget: {
2048
+ type: "TableChart",
2049
+ design: {
2050
+ version: 1,
2051
+ columns: [
2052
+ {
2053
+ textAxis: {
2054
+ expr: {
2055
+ type: "scalar",
2056
+ table: "entities.water_point",
2057
+ joins: [],
2058
+ expr: {
2059
+ type: "field",
2060
+ table: "entities.water_point",
2061
+ column: "type"
2062
+ }
2063
+ }
2064
+ }
2065
+ },
2066
+ {
2067
+ textAxis: {
2068
+ expr: {
2069
+ type: "scalar",
2070
+ table: "entities.water_point",
2071
+ joins: [],
2072
+ expr: {
2073
+ type: "count",
2074
+ table: "entities.water_point"
2075
+ }
2076
+ },
2077
+ aggr: "count"
2078
+ }
2079
+ }
2080
+ ],
2081
+ orderings: [],
2082
+ table: "entities.water_point",
2083
+ titleText: "TEST"
2084
+ }
2085
+ }
2086
+ }
2087
+ }
2088
+ }
2089
+ // "items": {
2090
+ // "b854aa65-7644-4b67-b0a4-d2344e7eb43a": {
2091
+ // "layout": {
2092
+ // "x": 0,
2093
+ // "y": 0,
2094
+ // "w": 8,
2095
+ // "h": 8
2096
+ // },
2097
+ // "widget": {
2098
+ // "type": "LayeredChart",
2099
+ // design: {"version":1,"type":"line","layers":[{"axes":{"x":{"expr":{"type":"scalar","table":"entities.water_point","joins":[],"expr":{"type":"field","table":"entities.water_point","column":"_created_on"}},"xform":{"type":"date"}},"y":{"expr":{"type":"scalar","table":"entities.water_point","joins":[],"expr":{"type":"count","table":"entities.water_point"}},"xform":null,"aggr":"count"}},"filter":null,"table":"entities.water_point","cumulative":true}]}
2100
+ // }
2101
+ // }
2102
+ // }
2103
+ // }
2104
+
2105
+ // "items": {
2106
+ // "b854aa65-7644-4b67-b0a4-d2344e7eb43a": {
2107
+ // "layout": {
2108
+ // "x": 0,
2109
+ // "y": 0,
2110
+ // "w": 8,
2111
+ // "h": 8
2112
+ // },
2113
+ // "widget": {
2114
+ // "type": "LayeredChart",
2115
+ // "design": {
2116
+ // "type": "donut",
2117
+ // "layers": [
2118
+ // {
2119
+ // "axes": {
2120
+ // "y": {
2121
+ // "expr": {
2122
+ // "type": "scalar",
2123
+ // "table": "entities.water_point",
2124
+ // "joins": [],
2125
+ // "expr": {
2126
+ // "type": "count",
2127
+ // "table": "entities.water_point"
2128
+ // }
2129
+ // },
2130
+ // "aggr": "count"
2131
+ // },
2132
+ // "color": {
2133
+ // "expr": {
2134
+ // "type": "scalar",
2135
+ // "table": "entities.water_point",
2136
+ // "joins": [
2137
+ // "source_notes"
2138
+ // ],
2139
+ // "aggr": "last",
2140
+ // "expr": {
2141
+ // "type": "field",
2142
+ // "table": "source_notes",
2143
+ // "column": "status"
2144
+ // }
2145
+ // }
2146
+ // }
2147
+ // },
2148
+ // "filter": null,
2149
+ // "table": "entities.water_point"
2150
+ // }
2151
+ // ],
2152
+ // "version": 1,
2153
+ // "titleText": "Functional Status of Water Points"
2154
+ // }
2155
+ // }
2156
+ // },
2157
+ // "cd96f28e-3757-42b2-a00a-0fced38c92d5": {
2158
+ // "layout": {
2159
+ // "x": 8,
2160
+ // "y": 0,
2161
+ // "w": 8,
2162
+ // "h": 8
2163
+ // },
2164
+ // "widget": {
2165
+ // "type": "LayeredChart",
2166
+ // "design": {
2167
+ // "version": 1,
2168
+ // "type": "bar",
2169
+ // "layers": [
2170
+ // {
2171
+ // "axes": {
2172
+ // "x": {
2173
+ // "expr": {
2174
+ // "type": "field",
2175
+ // "table": "entities.water_point",
2176
+ // "column": "type"
2177
+ // }
2178
+ // },
2179
+ // "y": {
2180
+ // "expr": {
2181
+ // "type": "scalar",
2182
+ // "table": "entities.water_point",
2183
+ // "joins": [],
2184
+ // "expr": {
2185
+ // "type": "count",
2186
+ // "table": "entities.water_point"
2187
+ // }
2188
+ // },
2189
+ // "aggr": "count"
2190
+ // }
2191
+ // },
2192
+ // "filter": null,
2193
+ // "table": "entities.water_point"
2194
+ // }
2195
+ // ],
2196
+ // "transpose": true,
2197
+ // "titleText": "Water Points by Type"
2198
+ // }
2199
+ // }
2200
+ // },
2201
+ // "3f4a1842-9c14-49fe-9e5d-4c19ae6ba6ec": {
2202
+ // "layout": {
2203
+ // "x": 0,
2204
+ // "y": 8,
2205
+ // "w": 11,
2206
+ // "h": 7
2207
+ // },
2208
+ // "widget": {
2209
+ // "type": "Map",
2210
+ // "design": {
2211
+ // "baseLayer": "bing_road",
2212
+ // "layerViews": [],
2213
+ // "filters": {},
2214
+ // "bounds": {
2215
+ // "w": 28.487548828125,
2216
+ // "n": -0.06591795420830737,
2217
+ // "e": 37.44140625,
2218
+ // "s": -5.5941182188847876
2219
+ // }
2220
+ // }
2221
+ // }
2222
+ // },
2223
+ // "353760a5-8976-418d-95cd-0d11ba4aa308": {
2224
+ // "layout": {
2225
+ // "x": 11,
2226
+ // "y": 8,
2227
+ // "w": 8,
2228
+ // "h": 8
2229
+ // },
2230
+ // "widget": {
2231
+ // "type": "Markdown",
2232
+ // "design": {
2233
+ // "markdown": "### Sample Dashboard\n\nText widgets can be freely mixed with maps, charts and tables. Charts are connected with each other so that clicking on a bar or slice will filter other views.\n"
2234
+ // }
2235
+ // }
2236
+ // }
2237
+ // }
2238
+ // }# class TestPane extends React.Component
2239
+ // constructor: (props) ->
2240
+ // super
2241
+
2242
+ // @state = { }
2243
+
2244
+ // componentDidMount: ->
2245
+ // $.getJSON @props.apiUrl + "jsonql/schema", (schemaJson) =>
2246
+ // @setState()
2247
+ // visualization_mwater.setup {
2248
+ // apiUrl: @props.apiUrl
2249
+ // client: @props.client
2250
+ // onMarkerClick: (table, id) => alert("#{table}:#{id}")
2251
+ // newLayers: [
2252
+ // { name: "Functional Status", type: "MWaterServer", design: { type: "functional_status", table: "entities.water_point" } }
2253
+ // { name: "Custom Layer", type: "Markers", design: {} }
2254
+ // ]
2255
+ // onFormTableSelect: (id) -> alert(id)
2256
+ // }, (err, results) =>
2257
+ // if err
2258
+ // throw err
2259
+
2260
+ // chart = new LayeredChart(schema: results.schema, dataSource: results.dataSource)
2261
+ // design = chart.cleanDesign({})
2262
+
2263
+ // @setState(schema: results.schema, widgetFactory: results.widgetFactory, dataSource: results.dataSource, layerFactory: results.layerFactory, design: design)
2264
+
2265
+ // handleDesignChange: (design) =>
2266
+ // chart = new LayeredChart(schema: @state.schema, dataSource: @state.dataSource)
2267
+ // @setState(design: chart.cleanDesign(design))
2268
+ // console.log JSON.stringify(design, null, 2)
2269
+
2270
+ // render: ->
2271
+ // if not @state.widgetFactory
2272
+ // return R 'div', null, "Loading..."
2273
+
2274
+ // React.createElement(LayeredChartDesignerComponent,
2275
+ // design: @state.design
2276
+ // schema: @state.schema
2277
+ // dataSource: @state.dataSource
2278
+ // onDesignChange: @handleDesignChange
2279
+ // )
2280
+
2281
+ const rosterDatagridDesign = {
2282
+ table: "responses:3aee880e079a417ea51d388d95217edf",
2283
+ subtables: [{ id: "r1", joins: ["data:cb4661bb948c4c188f6b94bc7bb3ce1f"] }],
2284
+ columns: [
2285
+ {
2286
+ id: "5fa704cf-f08b-4ff0-9b33-3814238a021a",
2287
+ type: "expr",
2288
+ width: 150,
2289
+ expr: {
2290
+ type: "field",
2291
+ table: "responses:3aee880e079a417ea51d388d95217edf",
2292
+ column: "deployment"
2293
+ }
2294
+ },
2295
+ {
2296
+ id: "7e90248c-aa7e-4c90-b08a-7be61ac849d1",
2297
+ type: "expr",
2298
+ width: 150,
2299
+ expr: {
2300
+ type: "field",
2301
+ table: "responses:3aee880e079a417ea51d388d95217edf",
2302
+ column: "user"
2303
+ }
2304
+ },
2305
+ {
2306
+ id: "5882d5b6-ee8c-44a0-abc2-a1782d9d1593",
2307
+ type: "expr",
2308
+ width: 150,
2309
+ expr: {
2310
+ type: "field",
2311
+ table: "responses:3aee880e079a417ea51d388d95217edf",
2312
+ column: "status"
2313
+ }
2314
+ },
2315
+ {
2316
+ id: "1efa41fa-f173-467b-92ab-144d0899cf1b",
2317
+ type: "expr",
2318
+ width: 150,
2319
+ expr: {
2320
+ type: "field",
2321
+ table: "responses:3aee880e079a417ea51d388d95217edf",
2322
+ column: "code"
2323
+ }
2324
+ },
2325
+ {
2326
+ id: "39cadddf-0ec7-401f-ade0-39bc726dbc5b",
2327
+ type: "expr",
2328
+ width: 150,
2329
+ expr: {
2330
+ type: "field",
2331
+ table: "responses:3aee880e079a417ea51d388d95217edf",
2332
+ column: "submittedOn"
2333
+ }
2334
+ },
2335
+ {
2336
+ id: "efc513f6-94b2-4399-a98f-3fbec3a0d502",
2337
+ type: "expr",
2338
+ width: 150,
2339
+ expr: {
2340
+ type: "field",
2341
+ table: "responses:3aee880e079a417ea51d388d95217edf",
2342
+ column: "data:ec3613ba32184bf6bd69911055efad71:value"
2343
+ }
2344
+ },
2345
+ {
2346
+ id: "79520f3e-71fd-4907-8dc6-6b25741a7277",
2347
+ type: "expr",
2348
+ width: 150,
2349
+ expr: {
2350
+ type: "field",
2351
+ table: "responses:3aee880e079a417ea51d388d95217edf",
2352
+ column: "data:4a276bc577254a63943cf77f86f86382:value"
2353
+ }
2354
+ },
2355
+ {
2356
+ id: "roster1",
2357
+ type: "expr",
2358
+ width: 200,
2359
+ subtable: "r1",
2360
+ expr: {
2361
+ type: "field",
2362
+ table: "responses:3aee880e079a417ea51d388d95217edf:roster:cb4661bb948c4c188f6b94bc7bb3ce1f",
2363
+ column: "data:37c99596f2e14feaa313431a91e3e620:value"
2364
+ }
2365
+ }
2366
+ ]
2367
+ }
2368
+
2369
+ // class DashboardPane extends React.Component
2370
+ // constructor: (props) ->
2371
+ // super
2372
+
2373
+ // @state = {
2374
+ // schema: null
2375
+ // dataSource: null
2376
+ // design: dashboardDesign
2377
+ // }
2378
+
2379
+ // componentDidMount: ->
2380
+ // $.getJSON @props.apiUrl + "jsonql/schema", (schemaJson) =>
2381
+ // schema = new Schema(schemaJson)
2382
+ // dataSource = new MWaterDataSource(@props.apiUrl, @props.client, { serverCaching: false, localCaching: true })
2383
+
2384
+ // layerFactory = new LayerFactory({
2385
+ // schema: schema
2386
+ // dataSource: dataSource
2387
+ // apiUrl: @props.apiUrl
2388
+ // client: @props.client
2389
+ // newLayers: [
2390
+ // { name: "Functional Status", type: "MWaterServer", design: { type: "functional_status", table: "entities.water_point" } }
2391
+ // { name: "Custom Layer", type: "Markers", design: {} }
2392
+ // ]
2393
+ // onMarkerClick: (table, id) => alert("#{table}:#{id}")
2394
+ // })
2395
+
2396
+ // widgetFactory = new WidgetFactory(schema: schema, dataSource: dataSource, layerFactory: layerFactory)
2397
+
2398
+ // @setState(schema: schema, dataSource: dataSource, layerFactory: layerFactory, widgetFactory: widgetFactory)
2399
+
2400
+ // handleDesignChange: (design) =>
2401
+ // @setState(design: design)
2402
+ // console.log JSON.stringify(design, null, 2)
2403
+
2404
+ // render: ->
2405
+ // if not @state.widgetFactory
2406
+ // return R 'div', null, "Loading..."
2407
+
2408
+ // return R 'div', style: { height: "100%" },
2409
+ // React.createElement(visualization.DashboardComponent, {
2410
+ // design: @state.design
2411
+ // widgetFactory: @state.widgetFactory
2412
+ // onDesignChange: @handleDesignChange
2413
+ // titleElem: "Sample"
2414
+ // printScaling: false
2415
+ // })
2416
+
2417
+ const bufferMap = {
2418
+ baseLayer: "cartodb_positron",
2419
+ layerViews: [
2420
+ {
2421
+ id: "6991fe14-03eb-4cf1-a4f5-6e3ebe581482",
2422
+ name: "Untitled Layer",
2423
+ desc: "",
2424
+ type: "Buffer",
2425
+ visible: true,
2426
+ opacity: 1,
2427
+ design: {
2428
+ axes: {
2429
+ geometry: {
2430
+ expr: {
2431
+ type: "field",
2432
+ table: "entities.water_point",
2433
+ column: "location"
2434
+ }
2435
+ },
2436
+ color: {
2437
+ expr: {
2438
+ type: "scalar",
2439
+ table: "entities.water_point",
2440
+ joins: ["!indicator_values:c0adc9f1c9be4271af9d722b7e50b4c9.Water point"],
2441
+ expr: {
2442
+ type: "op",
2443
+ op: "last",
2444
+ table: "indicator_values:c0adc9f1c9be4271af9d722b7e50b4c9",
2445
+ exprs: [
2446
+ {
2447
+ type: "field",
2448
+ table: "indicator_values:c0adc9f1c9be4271af9d722b7e50b4c9",
2449
+ column: "Functionality"
2450
+ }
2451
+ ]
2452
+ }
2453
+ },
2454
+ colorMap: [
2455
+ {
2456
+ value: "Partially functional",
2457
+ color: "#ff7f0e"
2458
+ },
2459
+ {
2460
+ value: "Functional",
2461
+ color: "#7ed321"
2462
+ },
2463
+ {
2464
+ value: "Not functional",
2465
+ color: "#d0021b"
2466
+ },
2467
+ {
2468
+ value: null,
2469
+ color: "#9b9b9b"
2470
+ },
2471
+ {
2472
+ value: "No longer exists",
2473
+ color: "#000000"
2474
+ }
2475
+ ],
2476
+ drawOrder: ["Functional", "Partially functional", "Not functional", "No longer exists", null]
2477
+ }
2478
+ },
2479
+ radius: 1000,
2480
+ fillOpacity: 0.5,
2481
+ filter: null,
2482
+ table: "entities.water_point",
2483
+ color: "#9b9b9b"
2484
+ }
2485
+ }
2486
+ ],
2487
+ filters: {},
2488
+ bounds: {
2489
+ w: 32.01690673828125,
2490
+ n: -1.9606767908079445,
2491
+ e: 33.86260986328125,
2492
+ s: -3.424320686307251
2493
+ }
2494
+ }
2495
+
2496
+ const adminRegionMap = {
2497
+ baseLayer: "cartodb_positron",
2498
+ layerViews: [
2499
+ {
2500
+ id: "f17cae2c-6357-432f-aaff-c3f98cbc374e",
2501
+ name: "Untitled Layer",
2502
+ desc: "",
2503
+ type: "AdminChoropleth",
2504
+ visible: true,
2505
+ opacity: 1,
2506
+ design: {
2507
+ color: "#FFFFFF",
2508
+ adminRegionExpr: {
2509
+ type: "field",
2510
+ table: "entities.water_point",
2511
+ column: "admin_region"
2512
+ },
2513
+ axes: {
2514
+ color: {
2515
+ expr: {
2516
+ type: "op",
2517
+ op: "percent where",
2518
+ table: "entities.water_point",
2519
+ exprs: [
2520
+ {
2521
+ type: "op",
2522
+ table: "entities.water_point",
2523
+ op: "= any",
2524
+ exprs: [
2525
+ {
2526
+ type: "field",
2527
+ table: "entities.water_point",
2528
+ column: "type"
2529
+ },
2530
+ {
2531
+ type: "literal",
2532
+ valueType: "enumset",
2533
+ value: ["Protected dug well", "Unprotected dug well"]
2534
+ }
2535
+ ]
2536
+ },
2537
+ null
2538
+ ]
2539
+ },
2540
+ xform: {
2541
+ type: "bin",
2542
+ numBins: 6,
2543
+ min: 0,
2544
+ max: 100
2545
+ },
2546
+ colorMap: [
2547
+ {
2548
+ value: 0,
2549
+ color: "#c1cce6"
2550
+ },
2551
+ {
2552
+ value: 1,
2553
+ color: "#9daed8"
2554
+ },
2555
+ {
2556
+ value: 2,
2557
+ color: "#7c93cb"
2558
+ },
2559
+ {
2560
+ value: 3,
2561
+ color: "#5b79be"
2562
+ },
2563
+ {
2564
+ value: 4,
2565
+ color: "#4361a8"
2566
+ },
2567
+ {
2568
+ value: 5,
2569
+ color: "#344c83"
2570
+ },
2571
+ {
2572
+ value: 6,
2573
+ color: "#273962"
2574
+ },
2575
+ {
2576
+ value: 7,
2577
+ color: "#1a2642"
2578
+ },
2579
+ {
2580
+ value: null,
2581
+ color: "#0d1321"
2582
+ }
2583
+ ],
2584
+ drawOrder: [0, 1, 2, 3, 4, 5, 6, 7, null]
2585
+ }
2586
+ },
2587
+ fillOpacity: 0.75,
2588
+ displayNames: true,
2589
+ filter: null,
2590
+ scope: "eb3e12a2-de1e-49a9-8afd-966eb55d47eb",
2591
+ detailLevel: 2,
2592
+ table: "entities.water_point"
2593
+ }
2594
+ }
2595
+ ],
2596
+ filters: {},
2597
+ bounds: {
2598
+ w: 27.916259765625,
2599
+ n: -0.7470491450051796,
2600
+ e: 42.681884765625,
2601
+ s: -12.37219737335794
2602
+ }
2603
+ }
2604
+
2605
+ const wholeWorldFuncMap = {
2606
+ baseLayer: "cartodb_positron",
2607
+ layerViews: [
2608
+ {
2609
+ id: "83530ec5-6c08-477c-8c1e-e5ee0077f14f",
2610
+ desc: "",
2611
+ name: "% Functional",
2612
+ type: "AdminChoropleth",
2613
+ design: {
2614
+ axes: {
2615
+ color: {
2616
+ expr: {
2617
+ op: "percent where",
2618
+ type: "op",
2619
+ exprs: [
2620
+ {
2621
+ op: "= any",
2622
+ type: "op",
2623
+ exprs: [
2624
+ {
2625
+ expr: {
2626
+ op: "last",
2627
+ type: "op",
2628
+ exprs: [
2629
+ {
2630
+ type: "field",
2631
+ table: "indicator_values:c0adc9f1c9be4271af9d722b7e50b4c9",
2632
+ column: "Functionality"
2633
+ }
2634
+ ],
2635
+ table: "indicator_values:c0adc9f1c9be4271af9d722b7e50b4c9"
2636
+ },
2637
+ type: "scalar",
2638
+ joins: ["!indicator_values:c0adc9f1c9be4271af9d722b7e50b4c9.Water point"],
2639
+ table: "entities.water_point"
2640
+ },
2641
+ {
2642
+ type: "literal",
2643
+ value: ["Functional"],
2644
+ valueType: "enumset"
2645
+ }
2646
+ ],
2647
+ table: "entities.water_point"
2648
+ },
2649
+ {
2650
+ op: "is not null",
2651
+ type: "op",
2652
+ exprs: [
2653
+ {
2654
+ expr: {
2655
+ op: "last",
2656
+ type: "op",
2657
+ exprs: [
2658
+ {
2659
+ type: "field",
2660
+ table: "indicator_values:c0adc9f1c9be4271af9d722b7e50b4c9",
2661
+ column: "Functionality"
2662
+ }
2663
+ ],
2664
+ table: "indicator_values:c0adc9f1c9be4271af9d722b7e50b4c9"
2665
+ },
2666
+ type: "scalar",
2667
+ joins: ["!indicator_values:c0adc9f1c9be4271af9d722b7e50b4c9.Water point"],
2668
+ table: "entities.water_point"
2669
+ }
2670
+ ],
2671
+ table: "entities.water_point"
2672
+ }
2673
+ ],
2674
+ table: "entities.water_point"
2675
+ },
2676
+ xform: {
2677
+ max: 100,
2678
+ min: 0,
2679
+ type: "bin",
2680
+ numBins: 6
2681
+ },
2682
+ colorMap: [
2683
+ {
2684
+ color: "#c8e6c1",
2685
+ value: 0
2686
+ },
2687
+ {
2688
+ color: "#a4d699",
2689
+ value: 1
2690
+ },
2691
+ {
2692
+ color: "#84c874",
2693
+ value: 2
2694
+ },
2695
+ {
2696
+ color: "#60b84c",
2697
+ value: 3
2698
+ },
2699
+ {
2700
+ color: "#4c963c",
2701
+ value: 4
2702
+ },
2703
+ {
2704
+ color: "#3a712d",
2705
+ value: 5
2706
+ },
2707
+ {
2708
+ color: "#25491d",
2709
+ value: 6
2710
+ },
2711
+ {
2712
+ color: "#13240f",
2713
+ value: 7
2714
+ }
2715
+ ],
2716
+ drawOrder: [0, 1, 2, 3, 4, 5, 6, 7]
2717
+ }
2718
+ },
2719
+ color: "#FFFFFF",
2720
+ scope: null,
2721
+ table: "entities.water_point",
2722
+ filter: null,
2723
+ detailLevel: 0,
2724
+ fillOpacity: 0.75,
2725
+ displayNames: true,
2726
+ adminRegionExpr: {
2727
+ type: "field",
2728
+ table: "entities.water_point",
2729
+ column: "admin_region"
2730
+ },
2731
+ scopeLevel: null
2732
+ },
2733
+ opacity: 1,
2734
+ visible: true
2735
+ }
2736
+ ],
2737
+ filters: {},
2738
+ bounds: {
2739
+ w: -21.181640624999996,
2740
+ n: 35.60371874069731,
2741
+ e: 69.43359375,
2742
+ s: -33.7243396617476
2743
+ }
2744
+ }
2745
+
2746
+ const design = {
2747
+ items: {
2748
+ id: "root",
2749
+ type: "root",
2750
+ blocks: [
2751
+ {
2752
+ type: "widget",
2753
+ widgetType: "Text",
2754
+ design: {
2755
+ style: "title",
2756
+ items: ["The Water Situation"]
2757
+ },
2758
+ id: "2fb6f7f9-212f-4488-abb6-9662eacc879f"
2759
+ },
2760
+ {
2761
+ type: "widget",
2762
+ widgetType: "Text",
2763
+ design: {
2764
+ items: [
2765
+ "We have ",
2766
+ {
2767
+ type: "expr",
2768
+ id: "b0e56d85-7999-4dfa-84ac-a4f6b4878f53",
2769
+ expr: {
2770
+ type: "op",
2771
+ op: "count",
2772
+ table: "entities.water_point",
2773
+ exprs: []
2774
+ }
2775
+ },
2776
+ " water points in mWater. Of these, ",
2777
+ {
2778
+ type: "expr",
2779
+ id: "9accfd63-7ae9-4e8e-a784-dfc259977d4c",
2780
+ expr: {
2781
+ type: "op",
2782
+ table: "entities.water_point",
2783
+ op: "count where",
2784
+ exprs: [
2785
+ {
2786
+ type: "op",
2787
+ table: "entities.water_point",
2788
+ op: "= any",
2789
+ exprs: [
2790
+ {
2791
+ type: "field",
2792
+ table: "entities.water_point",
2793
+ column: "type"
2794
+ },
2795
+ {
2796
+ type: "literal",
2797
+ valueType: "enumset",
2798
+ value: ["Protected dug well", "Unprotected dug well"]
2799
+ }
2800
+ ]
2801
+ }
2802
+ ]
2803
+ }
2804
+ },
2805
+ " are dug wells!"
2806
+ ]
2807
+ },
2808
+ id: "09c8981b-3869-410d-bd90-4a5a012314a8"
2809
+ },
2810
+ {
2811
+ id: "9bec34a2-f0e5-4a0b-88e8-3406521408bf",
2812
+ type: "horizontal",
2813
+ blocks: [
2814
+ {
2815
+ type: "widget",
2816
+ aspectRatio: 1.4,
2817
+ widgetType: "TableChart",
2818
+ design: {
2819
+ version: 1,
2820
+ columns: [
2821
+ {
2822
+ textAxis: {
2823
+ expr: {
2824
+ type: "field",
2825
+ table: "entities.water_point",
2826
+ column: "name"
2827
+ }
2828
+ }
2829
+ },
2830
+ {
2831
+ textAxis: {
2832
+ expr: {
2833
+ type: "field",
2834
+ table: "entities.water_point",
2835
+ column: "type"
2836
+ }
2837
+ }
2838
+ }
2839
+ ],
2840
+ orderings: [],
2841
+ table: "entities.water_point",
2842
+ titleText:
2843
+ "This is a really long title This is a really long title This is a really long title This is a really long title "
2844
+ },
2845
+ id: "ca85906f-c6cd-4729-a52f-984c28d625a8"
2846
+ },
2847
+ {
2848
+ type: "widget",
2849
+ aspectRatio: 1.4,
2850
+ widgetType: "Map",
2851
+ design: {
2852
+ baseLayer: "cartodb_positron",
2853
+ layerViews: [
2854
+ {
2855
+ id: "471776be-5c67-4d0d-a0fd-d406cc60c44c",
2856
+ name: "Untitled Layer",
2857
+ desc: "",
2858
+ type: "AdminChoropleth",
2859
+ visible: false,
2860
+ opacity: 1,
2861
+ design: {
2862
+ color: "#FFFFFF",
2863
+ adminRegionExpr: {
2864
+ type: "field",
2865
+ table: "entities.water_point",
2866
+ column: "admin_region"
2867
+ },
2868
+ axes: {
2869
+ color: {
2870
+ expr: {
2871
+ type: "op",
2872
+ table: "entities.water_point",
2873
+ op: "percent where",
2874
+ exprs: [
2875
+ {
2876
+ type: "op",
2877
+ table: "entities.water_point",
2878
+ op: "= any",
2879
+ exprs: [
2880
+ {
2881
+ type: "field",
2882
+ table: "entities.water_point",
2883
+ column: "type"
2884
+ },
2885
+ {
2886
+ type: "literal",
2887
+ valueType: "enumset",
2888
+ value: ["Protected dug well", "Unprotected dug well"]
2889
+ }
2890
+ ]
2891
+ },
2892
+ null
2893
+ ]
2894
+ },
2895
+ xform: {
2896
+ type: "bin",
2897
+ numBins: 6,
2898
+ min: 0,
2899
+ max: 100
2900
+ },
2901
+ colorMap: [
2902
+ {
2903
+ value: 0,
2904
+ color: "#c1cce6"
2905
+ },
2906
+ {
2907
+ value: 1,
2908
+ color: "#99abd6"
2909
+ },
2910
+ {
2911
+ value: 2,
2912
+ color: "#748dc8"
2913
+ },
2914
+ {
2915
+ value: 3,
2916
+ color: "#4c6db8"
2917
+ },
2918
+ {
2919
+ value: 4,
2920
+ color: "#3c5796"
2921
+ },
2922
+ {
2923
+ value: 5,
2924
+ color: "#2d4171"
2925
+ },
2926
+ {
2927
+ value: 6,
2928
+ color: "#1d2a49"
2929
+ },
2930
+ {
2931
+ value: 7,
2932
+ color: "#0f1524"
2933
+ }
2934
+ ],
2935
+ drawOrder: [0, 1, 2, 3, 4, 5, 6, 7]
2936
+ }
2937
+ },
2938
+ fillOpacity: 0.75,
2939
+ displayNames: true,
2940
+ filter: null,
2941
+ scope: "eb3e12a2-de1e-49a9-8afd-966eb55d47eb",
2942
+ detailLevel: 1,
2943
+ table: "entities.water_point"
2944
+ }
2945
+ },
2946
+ {
2947
+ id: "fc9a4641-8319-471d-9e80-c2c3a6b11e34",
2948
+ name: "Untitled Layer",
2949
+ desc: "",
2950
+ type: "Markers",
2951
+ visible: false,
2952
+ opacity: 1,
2953
+ design: {
2954
+ axes: {
2955
+ geometry: {
2956
+ expr: {
2957
+ type: "field",
2958
+ table: "entities.water_point",
2959
+ column: "location"
2960
+ }
2961
+ },
2962
+ color: {
2963
+ expr: {
2964
+ type: "field",
2965
+ table: "entities.water_point",
2966
+ column: "drilling_method_other"
2967
+ },
2968
+ colorMap: [
2969
+ {
2970
+ value: "A pied",
2971
+ color: "#1f77b4"
2972
+ },
2973
+ {
2974
+ value: "a pied",
2975
+ color: "#aec7e8"
2976
+ },
2977
+ {
2978
+ value: "testing other",
2979
+ color: "#ff7f0e"
2980
+ },
2981
+ {
2982
+ value: null,
2983
+ color: "#ffbb78"
2984
+ }
2985
+ ],
2986
+ drawOrder: ["A pied", "a pied", "testing other", null]
2987
+ }
2988
+ },
2989
+ color: "#0088FF",
2990
+ filter: null,
2991
+ table: "entities.water_point"
2992
+ }
2993
+ },
2994
+ {
2995
+ id: "c8fe521e-1577-4b4c-98a9-c2c5aba964e5",
2996
+ name: "Untitled Layer",
2997
+ desc: "",
2998
+ type: "Buffer",
2999
+ visible: true,
3000
+ opacity: 1,
3001
+ design: {
3002
+ axes: {
3003
+ geometry: {
3004
+ expr: {
3005
+ type: "field",
3006
+ table: "entities.water_point",
3007
+ column: "location"
3008
+ }
3009
+ },
3010
+ color: {
3011
+ expr: {
3012
+ type: "field",
3013
+ table: "entities.water_point",
3014
+ column: "_created_on"
3015
+ },
3016
+ xform: {
3017
+ type: "month"
3018
+ },
3019
+ colorMap: [
3020
+ {
3021
+ value: "01",
3022
+ color: "#1f77b4"
3023
+ },
3024
+ {
3025
+ value: "02",
3026
+ color: "#ff7f0e"
3027
+ },
3028
+ {
3029
+ value: "03",
3030
+ color: "#2ca02c"
3031
+ },
3032
+ {
3033
+ value: "04",
3034
+ color: "#d62728"
3035
+ },
3036
+ {
3037
+ value: "05",
3038
+ color: "#9467bd"
3039
+ },
3040
+ {
3041
+ value: "06",
3042
+ color: "#8c564b"
3043
+ },
3044
+ {
3045
+ value: "07",
3046
+ color: "#e377c2"
3047
+ },
3048
+ {
3049
+ value: "08",
3050
+ color: "#7f7f7f"
3051
+ },
3052
+ {
3053
+ value: "09",
3054
+ color: "#bcbd22"
3055
+ },
3056
+ {
3057
+ value: "10",
3058
+ color: "#17becf"
3059
+ },
3060
+ {
3061
+ value: "11",
3062
+ color: "#1f77b4"
3063
+ },
3064
+ {
3065
+ value: "12",
3066
+ color: "#ff7f0e"
3067
+ }
3068
+ ],
3069
+ drawOrder: ["03", "01", "04", "12", "05", "06", "07", "08", "09", "10", "11", "02"]
3070
+ }
3071
+ },
3072
+ radius: 50000,
3073
+ fillOpacity: 0.5,
3074
+ filter: null,
3075
+ table: "entities.water_point"
3076
+ }
3077
+ }
3078
+ ],
3079
+ filters: {},
3080
+ bounds: {
3081
+ w: 28.63037109375,
3082
+ n: -1.625758360412755,
3083
+ e: 41.06689453125,
3084
+ s: -10.336536087082974
3085
+ }
3086
+ },
3087
+ id: "a4148cd8-457f-4424-b464-c427f1b630de"
3088
+ },
3089
+ {
3090
+ type: "widget",
3091
+ aspectRatio: 1.4,
3092
+ widgetType: "LayeredChart",
3093
+ design: {
3094
+ version: 2,
3095
+ layers: [
3096
+ {
3097
+ axes: {
3098
+ x: {
3099
+ expr: {
3100
+ type: "field",
3101
+ table: "entities.water_point",
3102
+ column: "_created_on"
3103
+ },
3104
+ xform: {
3105
+ type: "yearmonth"
3106
+ }
3107
+ },
3108
+ y: {
3109
+ expr: {
3110
+ type: "op",
3111
+ op: "count",
3112
+ table: "entities.water_point",
3113
+ exprs: []
3114
+ },
3115
+ xform: null
3116
+ }
3117
+ },
3118
+ filter: {
3119
+ type: "op",
3120
+ table: "entities.water_point",
3121
+ op: "thisyear",
3122
+ exprs: [
3123
+ {
3124
+ type: "field",
3125
+ table: "entities.water_point",
3126
+ column: "_created_on"
3127
+ }
3128
+ ]
3129
+ },
3130
+ table: "entities.water_point",
3131
+ cumulative: false
3132
+ }
3133
+ ],
3134
+ type: "bar",
3135
+ titleText: "Water points added by month 2016"
3136
+ },
3137
+ id: "906863e8-3b03-4b6c-b70f-f4cd4adc002b"
3138
+ }
3139
+ ]
3140
+ }
3141
+ ]
3142
+ },
3143
+ layout: "blocks",
3144
+ style: "greybg"
3145
+ }
3146
+
3147
+ const autoBoundsMap = {
3148
+ baseLayer: "cartodb_positron",
3149
+ layerViews: [
3150
+ {
3151
+ id: "6991fe14-03eb-4cf1-a4f5-6e3ebe581482",
3152
+ name: "Untitled Layer",
3153
+ desc: "",
3154
+ type: "Buffer",
3155
+ visible: true,
3156
+ opacity: 1,
3157
+ design: {
3158
+ axes: {
3159
+ geometry: {
3160
+ expr: {
3161
+ type: "field",
3162
+ table: "entities.water_point",
3163
+ column: "location"
3164
+ }
3165
+ },
3166
+ color: {
3167
+ expr: {
3168
+ type: "scalar",
3169
+ table: "entities.water_point",
3170
+ joins: ["!indicator_values:c0adc9f1c9be4271af9d722b7e50b4c9.Water point"],
3171
+ expr: {
3172
+ type: "op",
3173
+ op: "last",
3174
+ table: "indicator_values:c0adc9f1c9be4271af9d722b7e50b4c9",
3175
+ exprs: [
3176
+ {
3177
+ type: "field",
3178
+ table: "indicator_values:c0adc9f1c9be4271af9d722b7e50b4c9",
3179
+ column: "Functionality"
3180
+ }
3181
+ ]
3182
+ }
3183
+ },
3184
+ colorMap: [
3185
+ {
3186
+ value: "Partially functional",
3187
+ color: "#ff7f0e"
3188
+ },
3189
+ {
3190
+ value: "Functional",
3191
+ color: "#7ed321"
3192
+ },
3193
+ {
3194
+ value: "Not functional",
3195
+ color: "#d0021b"
3196
+ },
3197
+ {
3198
+ value: null,
3199
+ color: "#9b9b9b"
3200
+ },
3201
+ {
3202
+ value: "No longer exists",
3203
+ color: "#000000"
3204
+ }
3205
+ ],
3206
+ drawOrder: ["Functional", "Partially functional", "Not functional", "No longer exists", null]
3207
+ }
3208
+ },
3209
+ radius: 1000,
3210
+ fillOpacity: 0.5,
3211
+ filter: null,
3212
+ table: "entities.water_point",
3213
+ color: "#9b9b9b"
3214
+ }
3215
+ }
3216
+ ],
3217
+ filters: {
3218
+ "entities.water_point": {
3219
+ type: "op",
3220
+ table: "entities.water_point",
3221
+ op: "within",
3222
+ exprs: [
3223
+ {
3224
+ type: "field",
3225
+ table: "entities.water_point",
3226
+ column: "admin_region"
3227
+ },
3228
+ {
3229
+ type: "literal",
3230
+ valueType: "id",
3231
+ idTable: "admin_regions",
3232
+ value: "316f16a2-89e1-46b4-8a4b-561478997000"
3233
+ }
3234
+ ]
3235
+ }
3236
+ },
3237
+ bounds: {
3238
+ w: 32.01690673828125,
3239
+ n: -1.9606767908079445,
3240
+ e: 33.86260986328125,
3241
+ s: -3.424320686307251
3242
+ },
3243
+ autoBounds: true
3244
+ }
3245
+
3246
+ const testMedium = {
3247
+ items: {
3248
+ id: "root",
3249
+ type: "root",
3250
+ blocks: [
3251
+ {
3252
+ type: "widget",
3253
+ widgetType: "Text",
3254
+ design: {
3255
+ style: "title",
3256
+ items: ["The Water Situation"]
3257
+ },
3258
+ id: "2fb6f7f9-212f-4488-abb6-9662eacc879f"
3259
+ },
3260
+ {
3261
+ id: "bf69f1c3-aa74-4f53-b3d1-878a5cc2c71f",
3262
+ type: "horizontal",
3263
+ blocks: [
3264
+ {
3265
+ type: "widget",
3266
+ widgetType: "Text",
3267
+ design: {
3268
+ items: [
3269
+ {
3270
+ type: "element",
3271
+ tag: "h1",
3272
+ items: ["How it is"]
3273
+ },
3274
+ "The new Sustainable Development Goal target for safely managed drinking water raises the bar from simply providing access to a water source to proving that the water is safe to drink and is being managed to prevent contamination. ",
3275
+ {
3276
+ type: "element",
3277
+ tag: "h2",
3278
+ items: ["What's new"]
3279
+ },
3280
+ {
3281
+ type: "element",
3282
+ tag: "div",
3283
+ items: [
3284
+ "The water quality crisis is a significant new challenge, with studies indicating that up to 2 billion people drink contaminated water every day. Recent evidence from nationally representative surveys by UNICEF indicates that water stored in households is at the greatest risk and over 80% of samples tested contain fecal bacteria. "
3285
+ ]
3286
+ },
3287
+ {
3288
+ type: "element",
3289
+ tag: "div",
3290
+ items: [
3291
+ "Improving water safety means more than just testing; local water managers must be empowered to identify and control risks, monitor operations, and respond quickly to changing conditions such as drought or contamination events."
3292
+ ]
3293
+ }
3294
+ ]
3295
+ },
3296
+ id: "09c8981b-3869-410d-bd90-4a5a012314a8"
3297
+ },
3298
+ {
3299
+ type: "spacer",
3300
+ aspectRatio: 1.4,
3301
+ id: "ba931d1d-3e29-47d5-b264-04ca5e0f10da"
3302
+ }
3303
+ ],
3304
+ weights: [1.6406417112299465, 0.3593582887700535]
3305
+ },
3306
+ {
3307
+ id: "d640a32c-2ed6-4a3e-b746-07dcc2c0b1cc",
3308
+ type: "horizontal",
3309
+ blocks: [
3310
+ {
3311
+ type: "widget",
3312
+ widgetType: "Text",
3313
+ design: {
3314
+ items: [
3315
+ {
3316
+ type: "element",
3317
+ tag: "span",
3318
+ items: [
3319
+ "Managing digital data and implementing mobile data collection, and how they are now scaling globally. The Water Trust and the Millennium Water Alliance will also talk about the real world issues faced every day in the process of using mWater: planning a digital M&E strategy, training staff to move from paper to mobiles, im"
3320
+ ]
3321
+ }
3322
+ ]
3323
+ },
3324
+ id: "8eabe8c1-e23b-4d89-8179-a5ec84f9d538"
3325
+ },
3326
+ {
3327
+ type: "widget",
3328
+ aspectRatio: 1.4,
3329
+ widgetType: "Image",
3330
+ design: {
3331
+ imageUrl: "https://cdn-images-1.medium.com/max/600/1*7o1w_pkB_jHoKSUeYotY1Q.jpeg",
3332
+ uid: null,
3333
+ expr: null,
3334
+ caption: "Some serious stuff here"
3335
+ },
3336
+ id: "2412f938-7b5e-4ab4-984d-5e04beca5956"
3337
+ }
3338
+ ],
3339
+ weights: [1.1358288770053475, 0.8641711229946524]
3340
+ }
3341
+ ]
3342
+ },
3343
+ layout: "blocks",
3344
+ style: "default"
3345
+ }
3346
+
3347
+ const badColorsMap = {
3348
+ baseLayer: "cartodb_positron",
3349
+ layerViews: [
3350
+ {
3351
+ id: "f17c9aca-f418-4718-a349-0aecc708fdc4",
3352
+ name: "Untitled Layer",
3353
+ desc: "",
3354
+ type: "AdminChoropleth",
3355
+ visible: true,
3356
+ opacity: 1,
3357
+ design: {
3358
+ color: "#FFFFFF",
3359
+ adminRegionExpr: {
3360
+ type: "field",
3361
+ table: "entities.water_point",
3362
+ column: "admin_region"
3363
+ },
3364
+ axes: {
3365
+ color: {
3366
+ expr: {
3367
+ type: "op",
3368
+ op: "percent where",
3369
+ table: "entities.water_point",
3370
+ exprs: [
3371
+ {
3372
+ type: "op",
3373
+ table: "entities.water_point",
3374
+ op: "= any",
3375
+ exprs: [
3376
+ {
3377
+ type: "field",
3378
+ table: "entities.water_point",
3379
+ column: "type"
3380
+ },
3381
+ {
3382
+ type: "literal",
3383
+ valueType: "enumset",
3384
+ value: ["Protected dug well", "Unprotected dug well"]
3385
+ }
3386
+ ]
3387
+ },
3388
+ null
3389
+ ]
3390
+ },
3391
+ xform: {
3392
+ type: "bin",
3393
+ numBins: 6,
3394
+ min: 0,
3395
+ max: 100
3396
+ },
3397
+ colorMap: [
3398
+ {
3399
+ value: 0,
3400
+ color: "#9e0142"
3401
+ },
3402
+ {
3403
+ value: 1,
3404
+ color: "#e1524a"
3405
+ },
3406
+ {
3407
+ value: 2,
3408
+ color: "#fba35e"
3409
+ },
3410
+ {
3411
+ value: 3,
3412
+ color: "#fee89a"
3413
+ },
3414
+ {
3415
+ value: 4,
3416
+ color: "#ebf7a6"
3417
+ },
3418
+ {
3419
+ value: 5,
3420
+ color: "#a0d9a3"
3421
+ },
3422
+ {
3423
+ value: 6,
3424
+ color: "#4ba0b1"
3425
+ },
3426
+ {
3427
+ value: 7,
3428
+ color: "#5e4fa2"
3429
+ },
3430
+ {
3431
+ value: null,
3432
+ color: "#aaaaaa"
3433
+ }
3434
+ ],
3435
+ drawOrder: [0, 1, 2, 3, 4, 5, 6, 7, null]
3436
+ }
3437
+ },
3438
+ fillOpacity: 0.75,
3439
+ displayNames: true,
3440
+ filter: null,
3441
+ table: "entities.water_point",
3442
+ scope: "eb3e12a2-de1e-49a9-8afd-966eb55d47eb",
3443
+ scopeLevel: 0,
3444
+ detailLevel: 1
3445
+ }
3446
+ }
3447
+ ],
3448
+ filters: {
3449
+ "entities.water_point": null
3450
+ },
3451
+ bounds: {
3452
+ w: 24.873046874999996,
3453
+ n: 3.469557303061473,
3454
+ e: 45.6591796875,
3455
+ s: -19.16592425362801
3456
+ },
3457
+ autoBounds: false
3458
+ }
3459
+
3460
+ const badColorsMap2 = {
3461
+ baseLayer: "cartodb_positron",
3462
+ layerViews: [
3463
+ {
3464
+ id: "8e22dc94-049a-4b20-85dc-70429328eb68",
3465
+ name: "Untitled Layer",
3466
+ desc: "",
3467
+ type: "Markers",
3468
+ visible: true,
3469
+ opacity: 1,
3470
+ design: {
3471
+ axes: {
3472
+ geometry: {
3473
+ expr: {
3474
+ type: "field",
3475
+ table: "entities.water_point",
3476
+ column: "location"
3477
+ }
3478
+ },
3479
+ color: {
3480
+ expr: {
3481
+ type: "field",
3482
+ table: "entities.water_point",
3483
+ column: "type"
3484
+ },
3485
+ colorMap: [
3486
+ {
3487
+ value: "Protected dug well",
3488
+ color: "#377eb8"
3489
+ },
3490
+ {
3491
+ value: "Unprotected dug well",
3492
+ color: "#4daf4a"
3493
+ },
3494
+ {
3495
+ value: "Borehole or tubewell",
3496
+ color: "#984ea3"
3497
+ },
3498
+ {
3499
+ value: "Protected spring",
3500
+ color: "#ff7f00"
3501
+ },
3502
+ {
3503
+ value: "Unprotected spring",
3504
+ color: "#ffff33"
3505
+ },
3506
+ {
3507
+ value: "Rainwater",
3508
+ color: "#a65628"
3509
+ },
3510
+ {
3511
+ value: "Surface water",
3512
+ color: "#f781bf"
3513
+ },
3514
+ {
3515
+ value: "Piped into dwelling",
3516
+ color: "#999999"
3517
+ },
3518
+ {
3519
+ value: "Piped into yard/plot",
3520
+ color: "#e41a1c"
3521
+ },
3522
+ {
3523
+ value: "Piped into public tap or basin",
3524
+ color: "#377eb8"
3525
+ },
3526
+ {
3527
+ value: "Bottled water",
3528
+ color: "#4daf4a"
3529
+ },
3530
+ {
3531
+ value: "Tanker truck",
3532
+ color: "#984ea3"
3533
+ },
3534
+ {
3535
+ value: "Cart with small tank/drum",
3536
+ color: "#ff7f00"
3537
+ },
3538
+ {
3539
+ value: "other",
3540
+ color: "#ffff33"
3541
+ },
3542
+ {
3543
+ value: null,
3544
+ color: "#aaaaaa"
3545
+ }
3546
+ ],
3547
+ drawOrder: [
3548
+ "Protected dug well",
3549
+ "Unprotected dug well",
3550
+ "Borehole or tubewell",
3551
+ "Protected spring",
3552
+ "Unprotected spring",
3553
+ "Rainwater",
3554
+ "Surface water",
3555
+ "Piped into dwelling",
3556
+ "Piped into yard/plot",
3557
+ "Piped into public tap or basin",
3558
+ "Bottled water",
3559
+ "Tanker truck",
3560
+ "Cart with small tank/drum",
3561
+ "other",
3562
+ null
3563
+ ]
3564
+ }
3565
+ },
3566
+ color: "#0088FF",
3567
+ filter: {
3568
+ type: "op",
3569
+ table: "entities.water_point",
3570
+ op: "within",
3571
+ exprs: [
3572
+ {
3573
+ type: "field",
3574
+ table: "entities.water_point",
3575
+ column: "admin_region"
3576
+ },
3577
+ {
3578
+ type: "literal",
3579
+ valueType: "id",
3580
+ idTable: "admin_regions",
3581
+ value: "316f16a2-89e1-46b4-8a4b-561478997000"
3582
+ }
3583
+ ]
3584
+ },
3585
+ table: "entities.water_point",
3586
+ popup: {
3587
+ items: {
3588
+ id: "root",
3589
+ type: "root",
3590
+ blocks: [
3591
+ {
3592
+ type: "widget",
3593
+ widgetType: "Text",
3594
+ design: {
3595
+ style: "title",
3596
+ items: [
3597
+ {
3598
+ type: "expr",
3599
+ id: "ac490926-5a04-4b01-8679-54375970c8d8",
3600
+ expr: {
3601
+ type: "field",
3602
+ table: "entities.water_point",
3603
+ column: "name"
3604
+ },
3605
+ includeLabel: false
3606
+ }
3607
+ ]
3608
+ },
3609
+ id: "5c4264d1-183c-4c03-b8a7-1d6ba2466ad7"
3610
+ }
3611
+ ]
3612
+ }
3613
+ }
3614
+ }
3615
+ }
3616
+ ],
3617
+ filters: {
3618
+ "entities.water_point": null
3619
+ },
3620
+ bounds: {
3621
+ n: -1.71348600000001,
3622
+ e: 33.775625,
3623
+ s: -3.4254440000000197,
3624
+ w: 32.045458
3625
+ },
3626
+ autoBounds: true
3627
+ }
3628
+
3629
+ const pageBreakProblem = {
3630
+ items: {
3631
+ id: "root",
3632
+ type: "root",
3633
+ blocks: [
3634
+ {
3635
+ type: "widget",
3636
+ widgetType: "Text",
3637
+ design: {
3638
+ style: "title",
3639
+ items: ["The Water Situation"]
3640
+ },
3641
+ id: "2fb6f7f9-212f-4488-abb6-9662eacc879f"
3642
+ },
3643
+ {
3644
+ id: "bf69f1c3-aa74-4f53-b3d1-878a5cc2c71f",
3645
+ type: "horizontal",
3646
+ blocks: [
3647
+ {
3648
+ type: "widget",
3649
+ widgetType: "Text",
3650
+ design: {
3651
+ items: [
3652
+ {
3653
+ type: "element",
3654
+ tag: "h1",
3655
+ items: ["How it is"]
3656
+ },
3657
+ "The new Sustainable Development Goal target for safely managed drinking water raises the bar from simply providing access to a water source to proving that the water is safe to drink and is being managed to prevent contamination. ",
3658
+ {
3659
+ type: "element",
3660
+ tag: "h2",
3661
+ items: ["What's new"]
3662
+ },
3663
+ {
3664
+ type: "element",
3665
+ tag: "div",
3666
+ items: [
3667
+ "The water quality crisis is a significant new challenge, with studies indicating that up to 2 billion people drink contaminated water every day. Recent evidence from nationally representative surveys by UNICEF indicates that water stored in households is at the greatest risk and over 80% of samples tested contain fecal bacteria. "
3668
+ ]
3669
+ },
3670
+ {
3671
+ type: "element",
3672
+ tag: "div",
3673
+ items: [
3674
+ "Improving water safety means more than just testing; local water managers must be empowered to identify and control risks, monitor operations, and respond quickly to changing conditions such as drought or contamination events."
3675
+ ]
3676
+ }
3677
+ ]
3678
+ },
3679
+ id: "09c8981b-3869-410d-bd90-4a5a012314a8"
3680
+ },
3681
+ {
3682
+ type: "spacer",
3683
+ aspectRatio: 1.4,
3684
+ id: "ba931d1d-3e29-47d5-b264-04ca5e0f10da"
3685
+ }
3686
+ ],
3687
+ weights: [1.6406417112299465, 0.3593582887700535]
3688
+ },
3689
+ {
3690
+ type: "widget",
3691
+ widgetType: "Text",
3692
+ design: {
3693
+ items: [
3694
+ {
3695
+ type: "element",
3696
+ tag: "span",
3697
+ items: [
3698
+ "Managing digital data and implementing mobile data collection, and how they are now scaling globally. The Water Trust and the Millennium Water Alliance will also talk about the real world issues faced every day in the process of using mWater: planning a digital M&E strategy, training staff to move from paper to mobiles, im"
3699
+ ]
3700
+ }
3701
+ ]
3702
+ },
3703
+ id: "8eabe8c1-e23b-4d89-8179-a5ec84f9d538"
3704
+ },
3705
+ {
3706
+ type: "widget",
3707
+ aspectRatio: 1.4,
3708
+ widgetType: "Image",
3709
+ design: {
3710
+ imageUrl: "https://cdn-images-1.medium.com/max/600/1*7o1w_pkB_jHoKSUeYotY1Q.jpeg",
3711
+ uid: null,
3712
+ expr: null,
3713
+ caption: "Some serious stuff here"
3714
+ },
3715
+ id: "2412f938-7b5e-4ab4-984d-5e04beca5956"
3716
+ },
3717
+ {
3718
+ type: "widget",
3719
+ aspectRatio: 1.4,
3720
+ widgetType: "LayeredChart",
3721
+ design: {
3722
+ version: 2,
3723
+ layers: [
3724
+ {
3725
+ axes: {
3726
+ x: {
3727
+ expr: {
3728
+ type: "field",
3729
+ table: "entities.water_point",
3730
+ column: "type"
3731
+ }
3732
+ },
3733
+ y: {
3734
+ expr: {
3735
+ type: "op",
3736
+ op: "count",
3737
+ table: "entities.water_point",
3738
+ exprs: []
3739
+ }
3740
+ }
3741
+ },
3742
+ filter: null,
3743
+ table: "entities.water_point"
3744
+ }
3745
+ ],
3746
+ type: "bar"
3747
+ },
3748
+ id: "e77cd4f4-27b5-4c47-b5de-2c776093e467"
3749
+ },
3750
+ {
3751
+ type: "widget",
3752
+ aspectRatio: 1.4,
3753
+ widgetType: "Map",
3754
+ design: {
3755
+ baseLayer: "bing_road",
3756
+ layerViews: [],
3757
+ filters: {},
3758
+ bounds: {
3759
+ w: -40,
3760
+ n: 25,
3761
+ e: 40,
3762
+ s: -25
3763
+ }
3764
+ },
3765
+ id: "e5c308ec-4874-4fab-bd9c-c9bc253ef60e"
3766
+ }
3767
+ ]
3768
+ },
3769
+ layout: "blocks",
3770
+ style: "default"
3771
+ }
3772
+
3773
+ const simpleBarChart = {
3774
+ items: {
3775
+ id: "root",
3776
+ type: "root",
3777
+ blocks: [
3778
+ {
3779
+ type: "widget",
3780
+ aspectRatio: 1.4,
3781
+ widgetType: "LayeredChart",
3782
+ design: {
3783
+ version: 2,
3784
+ layers: [
3785
+ {
3786
+ axes: {
3787
+ x: {
3788
+ expr: {
3789
+ type: "field",
3790
+ table: "entities.water_point",
3791
+ column: "type"
3792
+ }
3793
+ },
3794
+ y: {
3795
+ expr: {
3796
+ type: "op",
3797
+ op: "count",
3798
+ table: "entities.water_point",
3799
+ exprs: []
3800
+ }
3801
+ }
3802
+ },
3803
+ filter: null,
3804
+ table: "entities.water_point"
3805
+ }
3806
+ ],
3807
+ type: "bar",
3808
+ transpose: true
3809
+ },
3810
+ id: "f375fe0a-04ff-454e-8269-fbbafa7e3f8d"
3811
+ }
3812
+ ]
3813
+ },
3814
+ layout: "blocks",
3815
+ style: "greybg"
3816
+ }
3817
+
3818
+ const simplePieChart = {
3819
+ items: {
3820
+ id: "root",
3821
+ type: "root",
3822
+ blocks: [
3823
+ {
3824
+ type: "widget",
3825
+ aspectRatio: 1.4,
3826
+ widgetType: "LayeredChart",
3827
+ design: {
3828
+ version: 2,
3829
+ layers: [
3830
+ {
3831
+ axes: {
3832
+ y: {
3833
+ expr: {
3834
+ type: "op",
3835
+ op: "count",
3836
+ table: "entities.water_point",
3837
+ exprs: []
3838
+ }
3839
+ },
3840
+ color: {
3841
+ expr: {
3842
+ type: "field",
3843
+ table: "entities.water_point",
3844
+ column: "type"
3845
+ },
3846
+ colorMap: [
3847
+ {
3848
+ value: "Protected dug well",
3849
+ color: "#377eb8"
3850
+ },
3851
+ {
3852
+ value: "Unprotected dug well",
3853
+ color: "#4daf4a"
3854
+ },
3855
+ {
3856
+ value: "Borehole or tubewell",
3857
+ color: "#984ea3"
3858
+ },
3859
+ {
3860
+ value: "Protected spring",
3861
+ color: "#ff7f00"
3862
+ },
3863
+ {
3864
+ value: "Unprotected spring",
3865
+ color: "#ffff33"
3866
+ },
3867
+ {
3868
+ value: "Rainwater",
3869
+ color: "#a65628"
3870
+ },
3871
+ {
3872
+ value: "Surface water",
3873
+ color: "#f781bf"
3874
+ },
3875
+ {
3876
+ value: "Piped into dwelling",
3877
+ color: "#999999"
3878
+ },
3879
+ {
3880
+ value: "Piped into yard/plot",
3881
+ color: "#e41a1c"
3882
+ },
3883
+ {
3884
+ value: "Piped into public tap or basin",
3885
+ color: "#377eb8"
3886
+ },
3887
+ {
3888
+ value: "Bottled water",
3889
+ color: "#4daf4a"
3890
+ },
3891
+ {
3892
+ value: "Tanker truck",
3893
+ color: "#984ea3"
3894
+ },
3895
+ {
3896
+ value: "Cart with small tank/drum",
3897
+ color: "#ff7f00"
3898
+ },
3899
+ {
3900
+ value: "other",
3901
+ color: "#ffff33"
3902
+ },
3903
+ {
3904
+ value: null,
3905
+ color: "#aaaaaa"
3906
+ }
3907
+ ],
3908
+ drawOrder: [
3909
+ "Protected dug well",
3910
+ "Unprotected dug well",
3911
+ "Borehole or tubewell",
3912
+ "Protected spring",
3913
+ "Unprotected spring",
3914
+ "Rainwater",
3915
+ "Surface water",
3916
+ "Piped into dwelling",
3917
+ "Piped into yard/plot",
3918
+ "Piped into public tap or basin",
3919
+ "Bottled water",
3920
+ "Tanker truck",
3921
+ "Cart with small tank/drum",
3922
+ "other",
3923
+ null
3924
+ ],
3925
+ excludedValues: []
3926
+ }
3927
+ },
3928
+ filter: null,
3929
+ table: "entities.water_point"
3930
+ }
3931
+ ],
3932
+ type: "pie",
3933
+ transpose: true
3934
+ },
3935
+ id: "f375fe0a-04ff-454e-8269-fbbafa7e3f8d"
3936
+ }
3937
+ ]
3938
+ },
3939
+ layout: "blocks",
3940
+ style: "greybg",
3941
+ quickfilters: [
3942
+ {
3943
+ expr: {
3944
+ type: "field",
3945
+ table: "entities.water_point",
3946
+ column: "type"
3947
+ },
3948
+ label: null
3949
+ }
3950
+ ]
3951
+ }
3952
+
3953
+ var mapAndChartDashboard = {
3954
+ items: {
3955
+ id: "root",
3956
+ type: "root",
3957
+ blocks: [
3958
+ {
3959
+ id: "0a38cdac-aae2-4e2a-9f6c-020b3ce2745f",
3960
+ type: "horizontal",
3961
+ blocks: [
3962
+ {
3963
+ type: "widget",
3964
+ aspectRatio: 1.4,
3965
+ widgetType: "Map",
3966
+ design: {
3967
+ baseLayer: "bing_road",
3968
+ layerViews: [],
3969
+ filters: {},
3970
+ bounds: {
3971
+ w: -40,
3972
+ n: 25,
3973
+ e: 40,
3974
+ s: -25
3975
+ }
3976
+ },
3977
+ id: "0a9afebf-516c-4538-9592-bb5806edb2c9"
3978
+ },
3979
+ {
3980
+ type: "widget",
3981
+ aspectRatio: 1.4,
3982
+ widgetType: "LayeredChart",
3983
+ design: {
3984
+ version: 2,
3985
+ layers: [
3986
+ {
3987
+ axes: {
3988
+ y: {
3989
+ expr: {
3990
+ type: "op",
3991
+ op: "count",
3992
+ table: "entities.water_point",
3993
+ exprs: []
3994
+ }
3995
+ },
3996
+ color: {
3997
+ expr: {
3998
+ type: "field",
3999
+ table: "entities.water_point",
4000
+ column: "type"
4001
+ },
4002
+ colorMap: [
4003
+ {
4004
+ value: "Protected dug well",
4005
+ color: "#377eb8"
4006
+ },
4007
+ {
4008
+ value: "Unprotected dug well",
4009
+ color: "#4daf4a"
4010
+ },
4011
+ {
4012
+ value: "Borehole or tubewell",
4013
+ color: "#984ea3"
4014
+ },
4015
+ {
4016
+ value: "Protected spring",
4017
+ color: "#ff7f00"
4018
+ },
4019
+ {
4020
+ value: "Unprotected spring",
4021
+ color: "#ffff33"
4022
+ },
4023
+ {
4024
+ value: "Rainwater",
4025
+ color: "#a65628"
4026
+ },
4027
+ {
4028
+ value: "Surface water",
4029
+ color: "#f781bf"
4030
+ },
4031
+ {
4032
+ value: "Piped into dwelling",
4033
+ color: "#999999"
4034
+ },
4035
+ {
4036
+ value: "Piped into yard/plot",
4037
+ color: "#e41a1c"
4038
+ },
4039
+ {
4040
+ value: "Piped into public tap or basin",
4041
+ color: "#377eb8"
4042
+ },
4043
+ {
4044
+ value: "Bottled water",
4045
+ color: "#4daf4a"
4046
+ },
4047
+ {
4048
+ value: "Tanker truck",
4049
+ color: "#984ea3"
4050
+ },
4051
+ {
4052
+ value: "Cart with small tank/drum",
4053
+ color: "#ff7f00"
4054
+ },
4055
+ {
4056
+ value: "other",
4057
+ color: "#ffff33"
4058
+ },
4059
+ {
4060
+ value: null,
4061
+ color: "#aaaaaa"
4062
+ }
4063
+ ],
4064
+ drawOrder: [
4065
+ "Protected dug well",
4066
+ "Unprotected dug well",
4067
+ "Borehole or tubewell",
4068
+ "Protected spring",
4069
+ "Unprotected spring",
4070
+ "Rainwater",
4071
+ "Surface water",
4072
+ "Piped into dwelling",
4073
+ "Piped into yard/plot",
4074
+ "Piped into public tap or basin",
4075
+ "Bottled water",
4076
+ "Tanker truck",
4077
+ "Cart with small tank/drum",
4078
+ "other",
4079
+ null
4080
+ ],
4081
+ excludedValues: []
4082
+ }
4083
+ },
4084
+ filter: null,
4085
+ table: "entities.water_point"
4086
+ }
4087
+ ],
4088
+ type: "pie",
4089
+ transpose: true
4090
+ },
4091
+ id: "f375fe0a-04ff-454e-8269-fbbafa7e3f8d"
4092
+ }
4093
+ ]
4094
+ }
4095
+ ]
4096
+ },
4097
+ layout: "blocks",
4098
+ style: "greybg",
4099
+ quickfilters: [
4100
+ {
4101
+ expr: {
4102
+ type: "field",
4103
+ table: "entities.water_point",
4104
+ column: "type"
4105
+ },
4106
+ label: null
4107
+ }
4108
+ ]
4109
+ }
4110
+
4111
+ var doubleClickMap = {
4112
+ baseLayer: "cartodb_positron",
4113
+ layerViews: [
4114
+ {
4115
+ id: "82fbf0ef-b3b3-4506-b87e-6d727e593cbd",
4116
+ name: "Untitled Layer",
4117
+ desc: "",
4118
+ type: "Cluster",
4119
+ visible: true,
4120
+ opacity: 1,
4121
+ design: {
4122
+ textColor: "white",
4123
+ fillColor: "#337ab7",
4124
+ axes: {
4125
+ geometry: {
4126
+ expr: {
4127
+ type: "field",
4128
+ table: "entities.water_point",
4129
+ column: "location"
4130
+ }
4131
+ }
4132
+ },
4133
+ filter: null,
4134
+ table: "entities.water_point"
4135
+ }
4136
+ }
4137
+ ],
4138
+ filters: {
4139
+ "entities.water_point": null
4140
+ },
4141
+ bounds: {
4142
+ n: -1.71348600000001,
4143
+ e: 33.775625,
4144
+ s: -3.4254440000000197,
4145
+ w: 32.045458
4146
+ },
4147
+ autoBounds: true
4148
+ }