@mwater/visualization 5.5.0 → 5.6.1

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 (275) hide show
  1. package/lib/ColorComponent.js +2 -2
  2. package/lib/MWaterContextComponent.d.ts +1 -1
  3. package/lib/MWaterGlobalFiltersComponent.d.ts +2 -2
  4. package/lib/MWaterGlobalFiltersComponent.js +11 -20
  5. package/lib/MWaterLoaderComponent.d.ts +4 -13
  6. package/lib/MWaterLoaderComponent.js +2 -11
  7. package/lib/TranslationsTabComponent.d.ts +34 -0
  8. package/lib/TranslationsTabComponent.js +256 -0
  9. package/lib/UndoStack.d.ts +2 -1
  10. package/lib/UndoStack.js +12 -6
  11. package/lib/dashboards/DashboardComponent.js +6 -5
  12. package/lib/dashboards/DashboardDesign.d.ts +1 -1
  13. package/lib/dashboards/ServerDashboardDataSource.d.ts +0 -1
  14. package/lib/dashboards/ServerDashboardDataSource.js +0 -25
  15. package/lib/dashboards/SettingsModalComponent.js +9 -233
  16. package/lib/datagrids/DatagridComponent.js +27 -2
  17. package/lib/datagrids/DatagridDesignerComponent.d.ts +2 -3
  18. package/lib/datagrids/DatagridDesignerComponent.js +108 -120
  19. package/lib/datagrids/DatagridViewComponent.js +33 -6
  20. package/lib/datagrids/OrderBysDesignerComponent.d.ts +7 -7
  21. package/lib/datagrids/OrderBysDesignerComponent.js +19 -28
  22. package/lib/index.css +45 -2
  23. package/lib/index.d.ts +5 -5
  24. package/lib/index.js +2 -3
  25. package/lib/layouts/blocks/BlocksDisplayComponent.d.ts +8 -1
  26. package/lib/layouts/blocks/BlocksDisplayComponent.js +46 -4
  27. package/lib/maps/BufferLayer.d.ts +0 -13
  28. package/lib/maps/BufferLayer.js +24 -237
  29. package/lib/maps/BufferLayerDesign.d.ts +1 -1
  30. package/lib/maps/BufferLayerDesignerComponent.d.ts +1 -1
  31. package/lib/maps/BufferLayerDesignerComponent.js +2 -7
  32. package/lib/maps/ChoroplethLayer.d.ts +1 -16
  33. package/lib/maps/ChoroplethLayer.js +25 -358
  34. package/lib/maps/ChoroplethLayerDesign.d.ts +5 -2
  35. package/lib/maps/ChoroplethLayerDesigner.d.ts +10 -32
  36. package/lib/maps/ChoroplethLayerDesigner.js +58 -89
  37. package/lib/maps/ClusterLayer.d.ts +0 -9
  38. package/lib/maps/ClusterLayer.js +0 -250
  39. package/lib/maps/DirectMapDataSource.js +1 -48
  40. package/lib/maps/EditHoverOver.d.ts +4 -3
  41. package/lib/maps/EditHoverOver.js +3 -3
  42. package/lib/maps/GridLayer.d.ts +0 -15
  43. package/lib/maps/GridLayer.js +0 -212
  44. package/lib/maps/HoverContent.js +1 -1
  45. package/lib/maps/Layer.d.ts +1 -26
  46. package/lib/maps/Layer.js +0 -13
  47. package/lib/maps/LeafletMapComponent.js +10 -19
  48. package/lib/maps/MapComponent.d.ts +19 -35
  49. package/lib/maps/MapComponent.js +135 -77
  50. package/lib/maps/MapControlComponent.d.ts +4 -5
  51. package/lib/maps/MapControlComponent.js +5 -12
  52. package/lib/maps/MapDesign.d.ts +8 -0
  53. package/lib/maps/MapDesignerComponent.d.ts +2 -0
  54. package/lib/maps/MapDesignerComponent.js +7 -2
  55. package/lib/maps/MapLayerDataSource.d.ts +0 -4
  56. package/lib/maps/MapLayerViewDesignerComponent.d.ts +3 -1
  57. package/lib/maps/MapLayerViewDesignerComponent.js +5 -1
  58. package/lib/maps/MapLayersDesignerComponent.d.ts +2 -0
  59. package/lib/maps/MapLayersDesignerComponent.js +2 -1
  60. package/lib/maps/MapTranslationsTab.d.ts +15 -0
  61. package/lib/maps/MapTranslationsTab.js +47 -0
  62. package/lib/maps/MapUtils.d.ts +11 -0
  63. package/lib/maps/MapUtils.js +57 -1
  64. package/lib/maps/MapViewComponent.d.ts +1 -1
  65. package/lib/maps/MapViewComponent.js +1 -8
  66. package/lib/maps/MarkersLayer.d.ts +1 -14
  67. package/lib/maps/MarkersLayer.js +89 -254
  68. package/lib/maps/MarkersLayerDesign.d.ts +5 -1
  69. package/lib/maps/MarkersLayerDesignerComponent.d.ts +32 -57
  70. package/lib/maps/MarkersLayerDesignerComponent.js +158 -134
  71. package/lib/maps/ServerMapDataSource.d.ts +0 -1
  72. package/lib/maps/ServerMapDataSource.js +0 -25
  73. package/lib/maps/SwitchableTileUrlLayer.d.ts +0 -2
  74. package/lib/maps/SwitchableTileUrlLayer.js +0 -9
  75. package/lib/maps/TileUrlLayer.d.ts +0 -1
  76. package/lib/maps/TileUrlLayer.js +0 -5
  77. package/lib/maps/VectorMapViewComponent.js +13 -10
  78. package/lib/maps/symbols/font-awesome/asterisk.png +0 -0
  79. package/lib/maps/symbols/font-awesome/ban.png +0 -0
  80. package/lib/maps/symbols/font-awesome/beer.png +0 -0
  81. package/lib/maps/symbols/font-awesome/bell.png +0 -0
  82. package/lib/maps/symbols/font-awesome/bolt.png +0 -0
  83. package/lib/maps/symbols/font-awesome/building.png +0 -0
  84. package/lib/maps/symbols/font-awesome/bullseye.png +0 -0
  85. package/lib/maps/symbols/font-awesome/bus.png +0 -0
  86. package/lib/maps/symbols/font-awesome/caret-up.png +0 -0
  87. package/lib/maps/symbols/font-awesome/certificate.png +0 -0
  88. package/lib/maps/symbols/font-awesome/check-circle.png +0 -0
  89. package/lib/maps/symbols/font-awesome/check.png +0 -0
  90. package/lib/maps/symbols/font-awesome/chevron-circle-down.png +0 -0
  91. package/lib/maps/symbols/font-awesome/chevron-circle-up.png +0 -0
  92. package/lib/maps/symbols/font-awesome/cloud-rain.png +0 -0
  93. package/lib/maps/symbols/font-awesome/cloud.png +0 -0
  94. package/lib/maps/symbols/font-awesome/comment.png +0 -0
  95. package/lib/maps/symbols/font-awesome/crosshairs.png +0 -0
  96. package/lib/maps/symbols/font-awesome/dot-circle-o.png +0 -0
  97. package/lib/maps/symbols/font-awesome/exclamation-circle.png +0 -0
  98. package/lib/maps/symbols/font-awesome/exclamation-triangle.png +0 -0
  99. package/lib/maps/symbols/font-awesome/female.png +0 -0
  100. package/lib/maps/symbols/font-awesome/file.png +0 -0
  101. package/lib/maps/symbols/font-awesome/flag.png +0 -0
  102. package/lib/maps/symbols/font-awesome/flask.png +0 -0
  103. package/lib/maps/symbols/font-awesome/h-square.png +0 -0
  104. package/lib/maps/symbols/font-awesome/home.png +0 -0
  105. package/lib/maps/symbols/font-awesome/info-circle.png +0 -0
  106. package/lib/maps/symbols/font-awesome/male.png +0 -0
  107. package/lib/maps/symbols/font-awesome/medkit.png +0 -0
  108. package/lib/maps/symbols/font-awesome/mobile.png +0 -0
  109. package/lib/maps/symbols/font-awesome/plus-circle.png +0 -0
  110. package/lib/maps/symbols/font-awesome/plus-square.png +0 -0
  111. package/lib/maps/symbols/font-awesome/plus.png +0 -0
  112. package/lib/maps/symbols/font-awesome/square.png +0 -0
  113. package/lib/maps/symbols/font-awesome/star.png +0 -0
  114. package/lib/maps/symbols/font-awesome/thumbs-down.png +0 -0
  115. package/lib/maps/symbols/font-awesome/thumbs-up.png +0 -0
  116. package/lib/maps/symbols/font-awesome/ticket.png +0 -0
  117. package/lib/maps/symbols/font-awesome/times-circle.png +0 -0
  118. package/lib/maps/symbols/font-awesome/times.png +0 -0
  119. package/lib/maps/symbols/font-awesome/tint.png +0 -0
  120. package/lib/maps/symbols/font-awesome/tree.png +0 -0
  121. package/lib/maps/symbols/font-awesome/university.png +0 -0
  122. package/lib/maps/symbols/font-awesome/usd.png +0 -0
  123. package/lib/maps/symbols/font-awesome/user.png +0 -0
  124. package/lib/maps/symbols/font-awesome/users.png +0 -0
  125. package/lib/maps/symbols/font-awesome/wheelchair.png +0 -0
  126. package/lib/maps/symbols/sdf-ize.sh +93 -0
  127. package/lib/maps/vectorMaps.d.ts +6 -6
  128. package/lib/maps/vectorMaps.js +33 -45
  129. package/lib/mwater_table_selection/IndicatorsListComponent.d.ts +4 -2
  130. package/lib/mwater_table_selection/IndicatorsListComponent.js +103 -34
  131. package/lib/mwater_table_selection/MWaterCalculatedDataSourcesListComponent.d.ts +18 -0
  132. package/lib/mwater_table_selection/MWaterCalculatedDataSourcesListComponent.js +80 -0
  133. package/lib/mwater_table_selection/MWaterCompleteTableSelectComponent.d.ts +26 -0
  134. package/lib/mwater_table_selection/MWaterCompleteTableSelectComponent.js +237 -51
  135. package/lib/mwater_table_selection/MWaterTableSelectComponent.d.ts +2 -2
  136. package/lib/mwater_table_selection/MWaterTableSelectComponent.js +9 -4
  137. package/lib/mwater_table_selection/MWaterWorkflowsSelectComponent.d.ts +19 -0
  138. package/lib/mwater_table_selection/MWaterWorkflowsSelectComponent.js +111 -0
  139. package/lib/quickfilter/QuickfiltersComponent.d.ts +3 -102
  140. package/lib/quickfilter/QuickfiltersComponent.js +53 -110
  141. package/lib/quickfilter/TextLiteralComponent.d.ts +23 -47
  142. package/lib/quickfilter/TextLiteralComponent.js +85 -82
  143. package/lib/widgets/MapWidget.js +6 -3
  144. package/lib/widgets/text/ExprItemEditorComponent.d.ts +3 -8
  145. package/lib/widgets/text/ExprItemEditorComponent.js +36 -33
  146. package/lib/widgets/text/ExprUpdateModalComponent.d.ts +1 -0
  147. package/package.json +3 -4
  148. package/src/ColorComponent.tsx +2 -2
  149. package/src/MWaterContextComponent.tsx +1 -1
  150. package/src/{MWaterGlobalFiltersComponent.ts → MWaterGlobalFiltersComponent.tsx} +32 -33
  151. package/src/{MWaterLoaderComponent.ts → MWaterLoaderComponent.tsx} +17 -18
  152. package/src/TranslationsTabComponent.tsx +429 -0
  153. package/src/UndoStack.ts +14 -6
  154. package/src/dashboards/DashboardComponent.tsx +6 -5
  155. package/src/dashboards/DashboardDesign.ts +1 -1
  156. package/src/dashboards/ServerDashboardDataSource.ts +0 -31
  157. package/src/dashboards/SettingsModalComponent.tsx +27 -383
  158. package/src/datagrids/DatagridComponent.tsx +36 -2
  159. package/src/datagrids/DatagridDesignerComponent.tsx +241 -229
  160. package/src/datagrids/DatagridViewComponent.tsx +44 -7
  161. package/src/datagrids/OrderBysDesignerComponent.tsx +61 -70
  162. package/src/index.css +45 -2
  163. package/src/index.ts +5 -11
  164. package/src/layouts/blocks/BlocksDisplayComponent.tsx +60 -5
  165. package/src/maps/BufferLayer.ts +30 -263
  166. package/src/maps/BufferLayerDesign.ts +1 -1
  167. package/src/maps/BufferLayerDesignerComponent.tsx +2 -7
  168. package/src/maps/ChoroplethLayer.ts +30 -394
  169. package/src/maps/ChoroplethLayerDesign.ts +5 -2
  170. package/src/maps/ChoroplethLayerDesigner.tsx +169 -165
  171. package/src/maps/ClusterLayer.ts +0 -274
  172. package/src/maps/DirectMapDataSource.ts +2 -61
  173. package/src/maps/EditHoverOver.tsx +9 -5
  174. package/src/maps/GridLayer.ts +0 -224
  175. package/src/maps/HoverContent.tsx +1 -1
  176. package/src/maps/Layer.ts +1 -35
  177. package/src/maps/LeafletMapComponent.tsx +10 -19
  178. package/src/maps/MapComponent.tsx +448 -0
  179. package/src/maps/MapControlComponent.tsx +41 -0
  180. package/src/maps/MapDesign.ts +6 -0
  181. package/src/maps/MapDesignerComponent.tsx +18 -1
  182. package/src/maps/MapLayerDataSource.ts +0 -5
  183. package/src/maps/MapLayerViewDesignerComponent.ts +9 -2
  184. package/src/maps/MapLayersDesignerComponent.ts +4 -1
  185. package/src/maps/MapTranslationsTab.tsx +53 -0
  186. package/src/maps/MapUtils.ts +61 -1
  187. package/src/maps/MapViewComponent.tsx +2 -8
  188. package/src/maps/MarkersLayer.ts +101 -275
  189. package/src/maps/MarkersLayerDesign.ts +7 -1
  190. package/src/maps/MarkersLayerDesignerComponent.tsx +436 -0
  191. package/src/maps/ServerMapDataSource.ts +0 -31
  192. package/src/maps/SwitchableTileUrlLayer.tsx +0 -11
  193. package/src/maps/TileUrlLayer.tsx +0 -6
  194. package/src/maps/VectorMapViewComponent.tsx +15 -15
  195. package/src/maps/symbols/font-awesome/asterisk.png +0 -0
  196. package/src/maps/symbols/font-awesome/ban.png +0 -0
  197. package/src/maps/symbols/font-awesome/beer.png +0 -0
  198. package/src/maps/symbols/font-awesome/bell.png +0 -0
  199. package/src/maps/symbols/font-awesome/bolt.png +0 -0
  200. package/src/maps/symbols/font-awesome/building.png +0 -0
  201. package/src/maps/symbols/font-awesome/bullseye.png +0 -0
  202. package/src/maps/symbols/font-awesome/bus.png +0 -0
  203. package/src/maps/symbols/font-awesome/caret-up.png +0 -0
  204. package/src/maps/symbols/font-awesome/certificate.png +0 -0
  205. package/src/maps/symbols/font-awesome/check-circle.png +0 -0
  206. package/src/maps/symbols/font-awesome/check.png +0 -0
  207. package/src/maps/symbols/font-awesome/chevron-circle-down.png +0 -0
  208. package/src/maps/symbols/font-awesome/chevron-circle-up.png +0 -0
  209. package/src/maps/symbols/font-awesome/cloud-rain.png +0 -0
  210. package/src/maps/symbols/font-awesome/cloud.png +0 -0
  211. package/src/maps/symbols/font-awesome/comment.png +0 -0
  212. package/src/maps/symbols/font-awesome/crosshairs.png +0 -0
  213. package/src/maps/symbols/font-awesome/dot-circle-o.png +0 -0
  214. package/src/maps/symbols/font-awesome/exclamation-circle.png +0 -0
  215. package/src/maps/symbols/font-awesome/exclamation-triangle.png +0 -0
  216. package/src/maps/symbols/font-awesome/female.png +0 -0
  217. package/src/maps/symbols/font-awesome/file.png +0 -0
  218. package/src/maps/symbols/font-awesome/flag.png +0 -0
  219. package/src/maps/symbols/font-awesome/flask.png +0 -0
  220. package/src/maps/symbols/font-awesome/h-square.png +0 -0
  221. package/src/maps/symbols/font-awesome/home.png +0 -0
  222. package/src/maps/symbols/font-awesome/info-circle.png +0 -0
  223. package/src/maps/symbols/font-awesome/male.png +0 -0
  224. package/src/maps/symbols/font-awesome/medkit.png +0 -0
  225. package/src/maps/symbols/font-awesome/mobile.png +0 -0
  226. package/src/maps/symbols/font-awesome/plus-circle.png +0 -0
  227. package/src/maps/symbols/font-awesome/plus-square.png +0 -0
  228. package/src/maps/symbols/font-awesome/plus.png +0 -0
  229. package/src/maps/symbols/font-awesome/square.png +0 -0
  230. package/src/maps/symbols/font-awesome/star.png +0 -0
  231. package/src/maps/symbols/font-awesome/thumbs-down.png +0 -0
  232. package/src/maps/symbols/font-awesome/thumbs-up.png +0 -0
  233. package/src/maps/symbols/font-awesome/ticket.png +0 -0
  234. package/src/maps/symbols/font-awesome/times-circle.png +0 -0
  235. package/src/maps/symbols/font-awesome/times.png +0 -0
  236. package/src/maps/symbols/font-awesome/tint.png +0 -0
  237. package/src/maps/symbols/font-awesome/tree.png +0 -0
  238. package/src/maps/symbols/font-awesome/university.png +0 -0
  239. package/src/maps/symbols/font-awesome/usd.png +0 -0
  240. package/src/maps/symbols/font-awesome/user.png +0 -0
  241. package/src/maps/symbols/font-awesome/users.png +0 -0
  242. package/src/maps/symbols/font-awesome/wheelchair.png +0 -0
  243. package/src/maps/symbols/sdf-ize.sh +93 -0
  244. package/src/maps/vectorMaps.tsx +32 -53
  245. package/src/mwater_table_selection/IndicatorsListComponent.tsx +165 -37
  246. package/src/mwater_table_selection/MWaterCalculatedDataSourcesListComponent.tsx +111 -0
  247. package/src/mwater_table_selection/MWaterCompleteTableSelectComponent.tsx +373 -37
  248. package/src/mwater_table_selection/MWaterTableSelectComponent.tsx +12 -8
  249. package/src/mwater_table_selection/MWaterWorkflowsSelectComponent.tsx +159 -0
  250. package/src/quickfilter/{QuickfiltersComponent.ts → QuickfiltersComponent.tsx} +165 -158
  251. package/src/quickfilter/TextLiteralComponent.tsx +197 -0
  252. package/src/widgets/MapWidget.tsx +11 -1
  253. package/src/widgets/text/ExprItemEditorComponent.tsx +83 -77
  254. package/src/widgets/text/ExprUpdateModalComponent.tsx +1 -0
  255. package/test/UndoStackTests.ts +52 -1
  256. package/.storybook/config.js +0 -7
  257. package/.storybook/head.html +0 -3
  258. package/.storybook/webpack.config.js +0 -15
  259. package/src/maps/BingLayer.ts +0 -146
  260. package/src/maps/MapComponent.ts +0 -312
  261. package/src/maps/MapControlComponent.ts +0 -46
  262. package/src/maps/MarkersLayerDesignerComponent.ts +0 -374
  263. package/src/maps/RasterMapViewComponent.ts +0 -345
  264. package/src/quickfilter/TextLiteralComponent.ts +0 -165
  265. package/stories/UpdateableComponent.js +0 -29
  266. package/stories/consoles.js +0 -202
  267. package/stories/dashboards.js +0 -217
  268. package/stories/datagridDesign.js +0 -114
  269. package/stories/datagrids.js +0 -69
  270. package/stories/dates.js +0 -80
  271. package/stories/exprcomponent.js +0 -43
  272. package/stories/index.js +0 -18
  273. package/stories/leaflet.js +0 -59
  274. package/stories/maps.js +0 -24
  275. package/stories/pivotChart.js +0 -235
@@ -219,218 +219,6 @@ class GridLayer extends Layer_1.default {
219
219
  };
220
220
  return query;
221
221
  }
222
- /** Gets the layer definition as JsonQL + CSS in format:
223
- * {
224
- * layers: array of { id: layer id, jsonql: jsonql that includes "the_webmercator_geom" as a column }
225
- * css: carto css
226
- * interactivity: (optional) { layer: id of layer, fields: array of field names }
227
- * }
228
- * arguments:
229
- * design: design of layer
230
- * schema: schema to use
231
- * filters: array of filters to apply
232
- */
233
- getJsonQLCss(design, schema, filters) {
234
- // Create design
235
- const layerDef = {
236
- layers: [{ id: "layer0", jsonql: this.createMapnikJsonQL(design, schema, filters) }],
237
- css: this.createCss(design, schema, filters),
238
- interactivity: {
239
- layer: "layer0",
240
- fields: ["id", "name"]
241
- }
242
- };
243
- return layerDef;
244
- }
245
- createMapnikJsonQL(design, schema, filters) {
246
- const axisBuilder = new AxisBuilder_1.default({ schema });
247
- const exprCompiler = new expressions_1.ExprCompiler(schema);
248
- /* Compile to a query like this:
249
- select mwater_hex_make(grid.q, grid.r, !pixel_width!*SIZE) as the_geom_webmercator, data.color as color from
250
- mwater_hex_grid(!bbox!, !pixel_width!*SIZE) as grid
251
- left outer join
252
- (select qr.q as q, qr.r as r, COLOREXPR as color from TABLE as innerquery
253
- inner join mwater_hex_xy_to_qr(st_xmin(innerquery.LOCATIONEXPR), st_ymin(innerquery.LOCATIONEXPR), !pixel_width!*10) as qr
254
- on true
255
- where innerquery.LOCATIONEXPR && ST_Expand(!bbox!, SIZE)
256
- group by 1, 2) as data
257
- on data.q = grid.q and data.r = grid.r
258
- */
259
- const compiledGeometryExpr = exprCompiler.compileExpr({ expr: design.geometryExpr, tableAlias: "innerquery" });
260
- const colorExpr = axisBuilder.compileAxis({ axis: design.colorAxis, tableAlias: "innerquery" });
261
- let compiledSizeExpr;
262
- if (design.shape == "hex") {
263
- // Hex needs distance from center to points
264
- compiledSizeExpr =
265
- design.sizeUnits == "pixels"
266
- ? { type: "op", op: "*", exprs: [{ type: "token", token: "!pixel_width!" }, design.size / 1.73205] }
267
- : { type: "literal", value: design.size / 1.73205 };
268
- }
269
- else if (design.shape == "square") {
270
- // Square needs distance from center to center
271
- compiledSizeExpr =
272
- design.sizeUnits == "pixels"
273
- ? { type: "op", op: "*", exprs: [{ type: "token", token: "!pixel_width!" }, design.size] }
274
- : { type: "literal", value: design.size };
275
- }
276
- else {
277
- throw new Error("Unknown shape");
278
- }
279
- // Create inner query
280
- const innerQuery = {
281
- type: "query",
282
- selects: [
283
- { type: "select", expr: { type: "field", tableAlias: "qr", column: "q" }, alias: "q" },
284
- { type: "select", expr: { type: "field", tableAlias: "qr", column: "r" }, alias: "r" },
285
- { type: "select", expr: colorExpr, alias: "color" }
286
- ],
287
- from: {
288
- type: "join",
289
- kind: "inner",
290
- left: { type: "table", table: design.table, alias: "innerquery" },
291
- right: {
292
- type: "subexpr",
293
- expr: {
294
- type: "op",
295
- op: `mwater_${design.shape}_xy_to_qr`,
296
- exprs: [
297
- { type: "op", op: "ST_XMin", exprs: [compiledGeometryExpr] },
298
- { type: "op", op: "ST_YMin", exprs: [compiledGeometryExpr] },
299
- compiledSizeExpr
300
- ]
301
- },
302
- alias: "qr"
303
- },
304
- on: { type: "literal", value: true }
305
- },
306
- groupBy: [1, 2]
307
- };
308
- // Filter by bounding box
309
- let whereClauses = [
310
- {
311
- type: "op",
312
- op: "&&",
313
- exprs: [
314
- compiledGeometryExpr,
315
- { type: "op", op: "ST_Expand", exprs: [{ type: "token", token: "!bbox!" }, compiledSizeExpr] }
316
- ]
317
- }
318
- ];
319
- // Then add filters
320
- if (design.filter) {
321
- whereClauses.push(exprCompiler.compileExpr({ expr: design.filter, tableAlias: "innerquery" }));
322
- }
323
- // Then add extra filters passed in, if relevant
324
- const relevantFilters = lodash_1.default.where(filters, { table: design.table });
325
- for (let filter of relevantFilters) {
326
- whereClauses.push((0, expressions_1.injectTableAlias)(filter.jsonql, "innerquery"));
327
- }
328
- whereClauses = lodash_1.default.compact(whereClauses);
329
- if (whereClauses.length > 0) {
330
- innerQuery.where = { type: "op", op: "and", exprs: whereClauses };
331
- }
332
- // Now create outer query
333
- const query = {
334
- type: "query",
335
- selects: [
336
- {
337
- type: "select",
338
- expr: {
339
- type: "op",
340
- op: `mwater_${design.shape}_make`,
341
- exprs: [
342
- { type: "field", tableAlias: "grid", column: "q" },
343
- { type: "field", tableAlias: "grid", column: "r" },
344
- compiledSizeExpr
345
- ]
346
- },
347
- alias: "the_geom_webmercator"
348
- },
349
- { type: "select", expr: { type: "field", tableAlias: "data", column: "color" }, alias: "color" }
350
- ],
351
- from: {
352
- type: "join",
353
- kind: "left",
354
- left: {
355
- type: "subexpr",
356
- expr: {
357
- type: "op",
358
- op: `mwater_${design.shape}_grid`,
359
- exprs: [{ type: "token", token: "!bbox!" }, compiledSizeExpr]
360
- },
361
- alias: "grid"
362
- },
363
- right: { type: "subquery", query: innerQuery, alias: "data" },
364
- // on data.q = grid.q and data.r = grid.r
365
- on: {
366
- type: "op",
367
- op: "and",
368
- exprs: [
369
- {
370
- type: "op",
371
- op: "=",
372
- exprs: [
373
- { type: "field", tableAlias: "data", column: "q" },
374
- { type: "field", tableAlias: "grid", column: "q" }
375
- ]
376
- },
377
- {
378
- type: "op",
379
- op: "=",
380
- exprs: [
381
- { type: "field", tableAlias: "data", column: "r" },
382
- { type: "field", tableAlias: "grid", column: "r" }
383
- ]
384
- }
385
- ]
386
- }
387
- }
388
- };
389
- return query;
390
- }
391
- createCss(design, schema, filters) {
392
- let css = `
393
- #layer0 {
394
- polygon-opacity: ` +
395
- design.fillOpacity +
396
- `;
397
- ` +
398
- (design.borderStyle == "color"
399
- ? `line-opacity: ` + (1 - (1 - design.fillOpacity) / 2) + `; `
400
- : `line-width: 0;`) +
401
- `
402
- polygon-fill: transparent;
403
- }
404
- \
405
- `;
406
- if (!design.colorAxis) {
407
- throw new Error("Color axis not set");
408
- }
409
- // If color axes, add color conditions
410
- if (design.colorAxis.colorMap) {
411
- for (let item of design.colorAxis.colorMap) {
412
- // If invisible
413
- if (design.colorAxis.excludedValues && lodash_1.default.any(design.colorAxis.excludedValues, (ev) => ev === item.value)) {
414
- css += `#layer0 [color=${JSON.stringify(item.value)}] {
415
- line-color: transparent;
416
- line-opacity: 0;
417
- polygon-opacity: 0;
418
- polygon-fill: transparent;
419
- }\n`;
420
- }
421
- else {
422
- css +=
423
- `#layer0 [color=${JSON.stringify(item.value)}] {
424
- ` +
425
- (design.borderStyle == "color" ? `line-color: ${item.color};` : "") +
426
- `
427
- polygon-fill: ${item.color};
428
- }\n`;
429
- }
430
- }
431
- }
432
- return css;
433
- }
434
222
  // TODO
435
223
  // /**
436
224
  // * Called when the interactivity grid is clicked.
@@ -53,7 +53,7 @@ const HoverContent = (props) => {
53
53
  if (error) {
54
54
  return react_1.default.createElement("div", { className: "text-danger" }, error);
55
55
  }
56
- return (react_1.default.createElement("div", { className: "_mviz-map-hover-content" }, props.items.map((item) => {
56
+ return (react_1.default.createElement("div", { className: "mwater-visualization-map-hover-content" }, props.items.map((item) => {
57
57
  let value = values[item.id];
58
58
  if (value != null && item.value) {
59
59
  // Get expression type
@@ -5,22 +5,6 @@ import { ReactNode } from "react";
5
5
  import { JsonQLQuery } from "@mwater/jsonql";
6
6
  import { LayerSpecification } from "maplibre-gl";
7
7
  import { MapLayerDataSource } from "./MapLayerDataSource";
8
- export interface JsonQLCssLayerDefinition {
9
- layers: Array<{
10
- /** Layer id */
11
- id: string;
12
- /** jsonql that includes "the_webmercator_geom" as a column */
13
- jsonql: JsonQLQuery;
14
- }>;
15
- /** carto css */
16
- css: string;
17
- interactivity?: {
18
- /** id of layer */
19
- layer: string;
20
- /** array of field names */
21
- fields: string[];
22
- };
23
- }
24
8
  export interface OnGridClickOptions<LayerDesign> {
25
9
  /** design of layer */
26
10
  design: LayerDesign;
@@ -91,16 +75,7 @@ export interface VectorTileCTE {
91
75
  /** Defines a layer for a map which has all the logic for rendering the specific data to be viewed */
92
76
  export default class Layer<LayerDesign> {
93
77
  /** Gets the type of layer definition */
94
- getLayerDefinitionType(): "JsonQLCss" | "TileUrl" | "VectorTile";
95
- /** Gets the layer definition as JsonQL + CSS for type "JsonQLCss"
96
- arguments:
97
- design: design of layer
98
- schema: schema to use
99
- filters: array of filters to apply. Each is { table: table id, jsonql: jsonql condition with {alias} for tableAlias. Use injectAlias to put in table alias
100
- */
101
- getJsonQLCss(design: LayerDesign, schema: Schema, filters: JsonQLFilter[]): JsonQLCssLayerDefinition;
102
- /** Gets the utf grid url for definition type "TileUrl" */
103
- getUtfGridUrl(design: LayerDesign, filters: JsonQLFilter[]): string | null;
78
+ getLayerDefinitionType(): "TileUrl" | "VectorTile";
104
79
  /** Gets the layer definition for "VectorTile" type
105
80
  * @param sourceId id of the source. Should be prefixed to sublayers with a colon (prefix:id)
106
81
  * @param opacity opacity of the layer, which MapBox does not allow to be implemented for a whole layer (https://github.com/mapbox/mapbox-gl-js/issues/4090)
package/lib/maps/Layer.js CHANGED
@@ -11,19 +11,6 @@ const bbox_1 = __importDefault(require("@turf/bbox"));
11
11
  class Layer {
12
12
  /** Gets the type of layer definition */
13
13
  getLayerDefinitionType() {
14
- return "JsonQLCss";
15
- }
16
- /** Gets the layer definition as JsonQL + CSS for type "JsonQLCss"
17
- arguments:
18
- design: design of layer
19
- schema: schema to use
20
- filters: array of filters to apply. Each is { table: table id, jsonql: jsonql condition with {alias} for tableAlias. Use injectAlias to put in table alias
21
- */
22
- getJsonQLCss(design, schema, filters) {
23
- throw new Error("Not implemented");
24
- }
25
- /** Gets the utf grid url for definition type "TileUrl" */
26
- getUtfGridUrl(design, filters) {
27
14
  throw new Error("Not implemented");
28
15
  }
29
16
  /** Gets the layer definition for "VectorTile" type
@@ -32,7 +32,6 @@ const react_1 = __importStar(require("react"));
32
32
  const react_dom_1 = __importDefault(require("react-dom"));
33
33
  const LeafletLoading_1 = __importDefault(require("./LeafletLoading"));
34
34
  const leaflet_1 = __importDefault(require("leaflet"));
35
- let BingLayer = require("./BingLayer");
36
35
  let UtfGridLayer = require("./UtfGridLayer");
37
36
  const R = react_1.default.createElement;
38
37
  const marker_icon_2x_png_1 = __importDefault(require("./marker-icon-2x.png"));
@@ -266,34 +265,26 @@ class LeafletMapComponent extends react_1.Component {
266
265
  }
267
266
  switch (this.props.baseLayerId) {
268
267
  case "bing_road":
269
- this.baseLayer = new BingLayer("Ao26dWY2IC8PjorsJKFaoR85EPXCnCohrJdisCWXIULAXFo0JAXquGauppTMQbyU", {
270
- type: "Road"
268
+ this.baseLayer = leaflet_1.default.tileLayer('https://tiles.stadiamaps.com/tiles/osm_bright/{z}/{x}/{y}{r}.png?api_key=835a418e-91f9-4eb8-9856-0883c3656c9d', {
269
+ maxZoom: 20,
270
+ attribution: '&copy; <a href="https://stadiamaps.com/" target="_blank">Stadia Maps</a> &copy; <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a> &copy; <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>',
271
271
  });
272
272
  break;
273
- // @baseLayer = L.tileLayer('https://{s}.api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', {
274
- // attribution: '© <a href="https://www.mapbox.com/about/maps/">Mapbox</a> © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback/" target="_blank">Improve this map</a></strong>',
275
- // tileSize: 512,
276
- // maxZoom: 21,
277
- // maxNativeZoom: 19,
278
- // subdomains: ["a", "b"],
279
- // zoomOffset: -1,
280
- // id: 'mapbox/streets-v11',
281
- // accessToken: 'pk.eyJ1IjoiZ3Jhc3NpY2siLCJhIjoiY2ozMzU1N3ZoMDA3ZDJxbzh0aTRtOTRoeSJ9.fFWBZ88vbdezyhfw-I-fag'
282
- // })
283
273
  case "bing_aerial":
284
- this.baseLayer = new BingLayer("Ao26dWY2IC8PjorsJKFaoR85EPXCnCohrJdisCWXIULAXFo0JAXquGauppTMQbyU", {
285
- type: "AerialWithLabels"
274
+ this.baseLayer = leaflet_1.default.tileLayer('https://tiles.stadiamaps.com/tiles/alidade_satellite/{z}/{x}/{y}.jpg?api_key=835a418e-91f9-4eb8-9856-0883c3656c9d', {
275
+ maxZoom: 20,
276
+ attribution: '&copy; CNES, Distribution Airbus DS, &copy; Airbus DS, &copy; PlanetObserver (Contains Copernicus Data) | &copy; <a href="https://stadiamaps.com/" target="_blank">Stadia Maps</a> &copy; <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a> &copy; <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>',
286
277
  });
287
278
  break;
288
279
  case "cartodb_positron":
289
- this.baseLayer = leaflet_1.default.tileLayer("https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png", {
290
- attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="https://cartodb.com/attributions">CartoDB</a>',
280
+ this.baseLayer = leaflet_1.default.tileLayer("https://tiles.stadiamaps.com/tiles/alidade_smooth/{z}/{x}/{y}{r}.png?api_key=835a418e-91f9-4eb8-9856-0883c3656c9d", {
281
+ attribution: '&copy; <a href="https://stadiamaps.com/" target="_blank">Stadia Maps</a>, &copy; <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a> &copy; <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>',
291
282
  maxZoom: 21
292
283
  });
293
284
  break;
294
285
  case "cartodb_dark_matter":
295
- this.baseLayer = leaflet_1.default.tileLayer("https://cartodb-basemaps-{s}.global.ssl.fastly.net/dark_all/{z}/{x}/{y}.png", {
296
- attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="https://cartodb.com/attributions">CartoDB</a>',
286
+ this.baseLayer = leaflet_1.default.tileLayer("https://tiles.stadiamaps.com/tiles/alidade_smooth_dark/{z}/{x}/{y}{r}.png?api_key=835a418e-91f9-4eb8-9856-0883c3656c9d", {
287
+ attribution: '&copy; <a href="https://stadiamaps.com/" target="_blank">Stadia Maps</a>, &copy; <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a> &copy; <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>',
297
288
  maxZoom: 21
298
289
  });
299
290
  break;
@@ -1,10 +1,9 @@
1
1
  import React, { ReactNode } from "react";
2
- import AutoSizeComponent from "@mwater/react-library/lib/AutoSizeComponent";
3
2
  import UndoStack from "../UndoStack";
4
3
  import { DataSource, Schema } from "@mwater/expressions";
5
4
  import { MapDataSource } from "./MapDataSource";
6
5
  import { MapDesign } from "./MapDesign";
7
- import { JsonQLFilter } from "../JsonQLFilter";
6
+ import { JsonQLFilter } from "..";
8
7
  export interface MapComponentProps {
9
8
  schema: Schema;
10
9
  dataSource: DataSource;
@@ -27,6 +26,8 @@ export interface MapComponentProps {
27
26
  quickfiltersValues?: any[];
28
27
  /** True to hide title bar and related controls */
29
28
  hideTitleBar?: boolean;
29
+ /** Locale to prefer if available */
30
+ preferredLocale?: string;
30
31
  }
31
32
  interface MapComponentState {
32
33
  undoStack: UndoStack;
@@ -36,55 +37,38 @@ interface MapComponentState {
36
37
  quickfiltersValues: any[] | null;
37
38
  /** True to hide quickfilters */
38
39
  hideQuickfilters: boolean;
40
+ /** Locale to use for display. Ignored if in edit mode */
41
+ locale: string;
42
+ /** Locale being previewed while in edit mode. Non-null when previewing a translation. */
43
+ previewLocale: string | null;
39
44
  }
40
45
  /** Map with designer on right */
41
46
  export default class MapComponent extends React.Component<MapComponentProps, MapComponentState> {
42
- static contextType: React.Context<string>;
43
47
  constructor(props: MapComponentProps);
44
48
  componentDidUpdate(prevProps: MapComponentProps): void;
45
49
  handleUndo: () => void;
46
50
  handleRedo: () => void;
47
51
  handleShowQuickfilters: () => void;
48
52
  handleZoomLockClick: () => void;
49
- renderActionLinks(): React.DetailedReactHTMLElement<React.HTMLAttributes<HTMLElement>, HTMLElement>;
50
- renderHeader(): React.DetailedReactHTMLElement<{
51
- style: {
52
- padding: number;
53
- borderBottom: string;
54
- gridArea: "header";
55
- };
56
- }, HTMLElement>;
53
+ /** Handle locale selection from dropdown */
54
+ handleLocaleSelect: (locale: string) => void;
55
+ /** Render the language selector dropdown */
56
+ renderLanguageDropdown(): React.JSX.Element;
57
+ renderActionLinks(): React.JSX.Element;
58
+ renderHeader(): React.JSX.Element;
57
59
  handleDesignChange: (design: any) => void;
58
60
  getDesign(): MapDesign;
59
61
  handleToggleDesignPanel: () => void;
60
62
  getQuickfilterValues: () => any[];
61
- renderView(): React.CElement<import("@mwater/react-library/lib/AutoSizeComponent").AutoSizeComponentProps, AutoSizeComponent>;
63
+ renderView(): React.JSX.Element;
62
64
  getCompiledFilters(): {
63
65
  table: string;
64
66
  jsonql: import("@mwater/jsonql").JsonQLExpr;
65
67
  }[];
66
- renderQuickfilter(): React.DetailedReactHTMLElement<{
67
- style: {
68
- gridArea: "quickfilters";
69
- borderBottom: string;
70
- };
71
- }, HTMLElement>;
72
- renderDesigner(): React.DetailedReactHTMLElement<{
73
- style: {
74
- gridArea: "designer";
75
- borderLeft: string;
76
- overflowY: "scroll";
77
- };
78
- }, HTMLElement>;
79
- render(): React.DetailedReactHTMLElement<{
80
- style: {
81
- width: string;
82
- height: string;
83
- display: "grid";
84
- gridTemplateColumns: string;
85
- gridTemplateRows: string;
86
- gridTemplateAreas: "\"header designer\" \"quickfilters designer\" \"view designer\"";
87
- };
88
- }, HTMLElement>;
68
+ renderQuickfilter(): React.JSX.Element;
69
+ /** Translate function to use for display based on current locale */
70
+ translate: (input: string) => string;
71
+ renderDesigner(): React.JSX.Element;
72
+ render(): React.JSX.Element;
89
73
  }
90
74
  export {};