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