@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.
- package/lib/ColorComponent.js +2 -2
- package/lib/MWaterContextComponent.d.ts +1 -1
- package/lib/MWaterGlobalFiltersComponent.d.ts +2 -2
- package/lib/MWaterGlobalFiltersComponent.js +11 -20
- package/lib/MWaterLoaderComponent.d.ts +4 -13
- package/lib/MWaterLoaderComponent.js +2 -11
- package/lib/TranslationsTabComponent.d.ts +34 -0
- package/lib/TranslationsTabComponent.js +256 -0
- package/lib/UndoStack.d.ts +2 -1
- package/lib/UndoStack.js +12 -6
- package/lib/dashboards/DashboardComponent.js +6 -5
- package/lib/dashboards/DashboardDesign.d.ts +1 -1
- package/lib/dashboards/ServerDashboardDataSource.d.ts +0 -1
- package/lib/dashboards/ServerDashboardDataSource.js +0 -25
- package/lib/dashboards/SettingsModalComponent.js +9 -233
- package/lib/datagrids/DatagridComponent.js +27 -2
- package/lib/datagrids/DatagridDesignerComponent.d.ts +2 -3
- package/lib/datagrids/DatagridDesignerComponent.js +108 -120
- package/lib/datagrids/DatagridViewComponent.js +33 -6
- package/lib/datagrids/OrderBysDesignerComponent.d.ts +7 -7
- package/lib/datagrids/OrderBysDesignerComponent.js +19 -28
- package/lib/index.css +45 -2
- package/lib/index.d.ts +5 -5
- package/lib/index.js +2 -3
- package/lib/layouts/blocks/BlocksDisplayComponent.d.ts +8 -1
- package/lib/layouts/blocks/BlocksDisplayComponent.js +46 -4
- package/lib/maps/BufferLayer.d.ts +0 -13
- package/lib/maps/BufferLayer.js +24 -237
- package/lib/maps/BufferLayerDesign.d.ts +1 -1
- package/lib/maps/BufferLayerDesignerComponent.d.ts +1 -1
- package/lib/maps/BufferLayerDesignerComponent.js +2 -7
- package/lib/maps/ChoroplethLayer.d.ts +1 -16
- package/lib/maps/ChoroplethLayer.js +25 -358
- package/lib/maps/ChoroplethLayerDesign.d.ts +5 -2
- package/lib/maps/ChoroplethLayerDesigner.d.ts +10 -32
- package/lib/maps/ChoroplethLayerDesigner.js +58 -89
- package/lib/maps/ClusterLayer.d.ts +0 -9
- package/lib/maps/ClusterLayer.js +0 -250
- package/lib/maps/DirectMapDataSource.js +1 -48
- package/lib/maps/EditHoverOver.d.ts +4 -3
- package/lib/maps/EditHoverOver.js +3 -3
- package/lib/maps/GridLayer.d.ts +0 -15
- package/lib/maps/GridLayer.js +0 -212
- package/lib/maps/HoverContent.js +1 -1
- package/lib/maps/Layer.d.ts +1 -26
- package/lib/maps/Layer.js +0 -13
- package/lib/maps/LeafletMapComponent.js +10 -19
- package/lib/maps/MapComponent.d.ts +19 -35
- package/lib/maps/MapComponent.js +135 -77
- package/lib/maps/MapControlComponent.d.ts +4 -5
- package/lib/maps/MapControlComponent.js +5 -12
- package/lib/maps/MapDesign.d.ts +8 -0
- package/lib/maps/MapDesignerComponent.d.ts +2 -0
- package/lib/maps/MapDesignerComponent.js +7 -2
- package/lib/maps/MapLayerDataSource.d.ts +0 -4
- package/lib/maps/MapLayerViewDesignerComponent.d.ts +3 -1
- package/lib/maps/MapLayerViewDesignerComponent.js +5 -1
- package/lib/maps/MapLayersDesignerComponent.d.ts +2 -0
- package/lib/maps/MapLayersDesignerComponent.js +2 -1
- package/lib/maps/MapTranslationsTab.d.ts +15 -0
- package/lib/maps/MapTranslationsTab.js +47 -0
- package/lib/maps/MapUtils.d.ts +11 -0
- package/lib/maps/MapUtils.js +57 -1
- package/lib/maps/MapViewComponent.d.ts +1 -1
- package/lib/maps/MapViewComponent.js +1 -8
- package/lib/maps/MarkersLayer.d.ts +1 -14
- package/lib/maps/MarkersLayer.js +89 -254
- package/lib/maps/MarkersLayerDesign.d.ts +5 -1
- package/lib/maps/MarkersLayerDesignerComponent.d.ts +32 -57
- package/lib/maps/MarkersLayerDesignerComponent.js +158 -134
- package/lib/maps/ServerMapDataSource.d.ts +0 -1
- package/lib/maps/ServerMapDataSource.js +0 -25
- package/lib/maps/SwitchableTileUrlLayer.d.ts +0 -2
- package/lib/maps/SwitchableTileUrlLayer.js +0 -9
- package/lib/maps/TileUrlLayer.d.ts +0 -1
- package/lib/maps/TileUrlLayer.js +0 -5
- package/lib/maps/VectorMapViewComponent.js +13 -10
- package/lib/maps/symbols/font-awesome/asterisk.png +0 -0
- package/lib/maps/symbols/font-awesome/ban.png +0 -0
- package/lib/maps/symbols/font-awesome/beer.png +0 -0
- package/lib/maps/symbols/font-awesome/bell.png +0 -0
- package/lib/maps/symbols/font-awesome/bolt.png +0 -0
- package/lib/maps/symbols/font-awesome/building.png +0 -0
- package/lib/maps/symbols/font-awesome/bullseye.png +0 -0
- package/lib/maps/symbols/font-awesome/bus.png +0 -0
- package/lib/maps/symbols/font-awesome/caret-up.png +0 -0
- package/lib/maps/symbols/font-awesome/certificate.png +0 -0
- package/lib/maps/symbols/font-awesome/check-circle.png +0 -0
- package/lib/maps/symbols/font-awesome/check.png +0 -0
- package/lib/maps/symbols/font-awesome/chevron-circle-down.png +0 -0
- package/lib/maps/symbols/font-awesome/chevron-circle-up.png +0 -0
- package/lib/maps/symbols/font-awesome/cloud-rain.png +0 -0
- package/lib/maps/symbols/font-awesome/cloud.png +0 -0
- package/lib/maps/symbols/font-awesome/comment.png +0 -0
- package/lib/maps/symbols/font-awesome/crosshairs.png +0 -0
- package/lib/maps/symbols/font-awesome/dot-circle-o.png +0 -0
- package/lib/maps/symbols/font-awesome/exclamation-circle.png +0 -0
- package/lib/maps/symbols/font-awesome/exclamation-triangle.png +0 -0
- package/lib/maps/symbols/font-awesome/female.png +0 -0
- package/lib/maps/symbols/font-awesome/file.png +0 -0
- package/lib/maps/symbols/font-awesome/flag.png +0 -0
- package/lib/maps/symbols/font-awesome/flask.png +0 -0
- package/lib/maps/symbols/font-awesome/h-square.png +0 -0
- package/lib/maps/symbols/font-awesome/home.png +0 -0
- package/lib/maps/symbols/font-awesome/info-circle.png +0 -0
- package/lib/maps/symbols/font-awesome/male.png +0 -0
- package/lib/maps/symbols/font-awesome/medkit.png +0 -0
- package/lib/maps/symbols/font-awesome/mobile.png +0 -0
- package/lib/maps/symbols/font-awesome/plus-circle.png +0 -0
- package/lib/maps/symbols/font-awesome/plus-square.png +0 -0
- package/lib/maps/symbols/font-awesome/plus.png +0 -0
- package/lib/maps/symbols/font-awesome/square.png +0 -0
- package/lib/maps/symbols/font-awesome/star.png +0 -0
- package/lib/maps/symbols/font-awesome/thumbs-down.png +0 -0
- package/lib/maps/symbols/font-awesome/thumbs-up.png +0 -0
- package/lib/maps/symbols/font-awesome/ticket.png +0 -0
- package/lib/maps/symbols/font-awesome/times-circle.png +0 -0
- package/lib/maps/symbols/font-awesome/times.png +0 -0
- package/lib/maps/symbols/font-awesome/tint.png +0 -0
- package/lib/maps/symbols/font-awesome/tree.png +0 -0
- package/lib/maps/symbols/font-awesome/university.png +0 -0
- package/lib/maps/symbols/font-awesome/usd.png +0 -0
- package/lib/maps/symbols/font-awesome/user.png +0 -0
- package/lib/maps/symbols/font-awesome/users.png +0 -0
- package/lib/maps/symbols/font-awesome/wheelchair.png +0 -0
- package/lib/maps/symbols/sdf-ize.sh +93 -0
- package/lib/maps/vectorMaps.d.ts +6 -6
- package/lib/maps/vectorMaps.js +33 -45
- package/lib/mwater_table_selection/IndicatorsListComponent.d.ts +4 -2
- package/lib/mwater_table_selection/IndicatorsListComponent.js +103 -34
- package/lib/mwater_table_selection/MWaterCalculatedDataSourcesListComponent.d.ts +18 -0
- package/lib/mwater_table_selection/MWaterCalculatedDataSourcesListComponent.js +80 -0
- package/lib/mwater_table_selection/MWaterCompleteTableSelectComponent.d.ts +26 -0
- package/lib/mwater_table_selection/MWaterCompleteTableSelectComponent.js +237 -51
- package/lib/mwater_table_selection/MWaterTableSelectComponent.d.ts +2 -2
- package/lib/mwater_table_selection/MWaterTableSelectComponent.js +9 -4
- package/lib/mwater_table_selection/MWaterWorkflowsSelectComponent.d.ts +19 -0
- package/lib/mwater_table_selection/MWaterWorkflowsSelectComponent.js +111 -0
- package/lib/quickfilter/QuickfiltersComponent.d.ts +3 -102
- package/lib/quickfilter/QuickfiltersComponent.js +53 -110
- package/lib/quickfilter/TextLiteralComponent.d.ts +23 -47
- package/lib/quickfilter/TextLiteralComponent.js +85 -82
- package/lib/widgets/MapWidget.js +6 -3
- package/lib/widgets/text/ExprItemEditorComponent.d.ts +3 -8
- package/lib/widgets/text/ExprItemEditorComponent.js +36 -33
- package/lib/widgets/text/ExprUpdateModalComponent.d.ts +1 -0
- package/package.json +3 -4
- package/src/ColorComponent.tsx +2 -2
- package/src/MWaterContextComponent.tsx +1 -1
- package/src/{MWaterGlobalFiltersComponent.ts → MWaterGlobalFiltersComponent.tsx} +32 -33
- package/src/{MWaterLoaderComponent.ts → MWaterLoaderComponent.tsx} +17 -18
- package/src/TranslationsTabComponent.tsx +429 -0
- package/src/UndoStack.ts +14 -6
- package/src/dashboards/DashboardComponent.tsx +6 -5
- package/src/dashboards/DashboardDesign.ts +1 -1
- package/src/dashboards/ServerDashboardDataSource.ts +0 -31
- package/src/dashboards/SettingsModalComponent.tsx +27 -383
- package/src/datagrids/DatagridComponent.tsx +36 -2
- package/src/datagrids/DatagridDesignerComponent.tsx +241 -229
- package/src/datagrids/DatagridViewComponent.tsx +44 -7
- package/src/datagrids/OrderBysDesignerComponent.tsx +61 -70
- package/src/index.css +45 -2
- package/src/index.ts +5 -11
- package/src/layouts/blocks/BlocksDisplayComponent.tsx +60 -5
- package/src/maps/BufferLayer.ts +30 -263
- package/src/maps/BufferLayerDesign.ts +1 -1
- package/src/maps/BufferLayerDesignerComponent.tsx +2 -7
- package/src/maps/ChoroplethLayer.ts +30 -394
- package/src/maps/ChoroplethLayerDesign.ts +5 -2
- package/src/maps/ChoroplethLayerDesigner.tsx +169 -165
- package/src/maps/ClusterLayer.ts +0 -274
- package/src/maps/DirectMapDataSource.ts +2 -61
- package/src/maps/EditHoverOver.tsx +9 -5
- package/src/maps/GridLayer.ts +0 -224
- package/src/maps/HoverContent.tsx +1 -1
- package/src/maps/Layer.ts +1 -35
- package/src/maps/LeafletMapComponent.tsx +10 -19
- package/src/maps/MapComponent.tsx +448 -0
- package/src/maps/MapControlComponent.tsx +41 -0
- package/src/maps/MapDesign.ts +6 -0
- package/src/maps/MapDesignerComponent.tsx +18 -1
- package/src/maps/MapLayerDataSource.ts +0 -5
- package/src/maps/MapLayerViewDesignerComponent.ts +9 -2
- package/src/maps/MapLayersDesignerComponent.ts +4 -1
- package/src/maps/MapTranslationsTab.tsx +53 -0
- package/src/maps/MapUtils.ts +61 -1
- package/src/maps/MapViewComponent.tsx +2 -8
- package/src/maps/MarkersLayer.ts +101 -275
- package/src/maps/MarkersLayerDesign.ts +7 -1
- package/src/maps/MarkersLayerDesignerComponent.tsx +436 -0
- package/src/maps/ServerMapDataSource.ts +0 -31
- package/src/maps/SwitchableTileUrlLayer.tsx +0 -11
- package/src/maps/TileUrlLayer.tsx +0 -6
- package/src/maps/VectorMapViewComponent.tsx +15 -15
- package/src/maps/symbols/font-awesome/asterisk.png +0 -0
- package/src/maps/symbols/font-awesome/ban.png +0 -0
- package/src/maps/symbols/font-awesome/beer.png +0 -0
- package/src/maps/symbols/font-awesome/bell.png +0 -0
- package/src/maps/symbols/font-awesome/bolt.png +0 -0
- package/src/maps/symbols/font-awesome/building.png +0 -0
- package/src/maps/symbols/font-awesome/bullseye.png +0 -0
- package/src/maps/symbols/font-awesome/bus.png +0 -0
- package/src/maps/symbols/font-awesome/caret-up.png +0 -0
- package/src/maps/symbols/font-awesome/certificate.png +0 -0
- package/src/maps/symbols/font-awesome/check-circle.png +0 -0
- package/src/maps/symbols/font-awesome/check.png +0 -0
- package/src/maps/symbols/font-awesome/chevron-circle-down.png +0 -0
- package/src/maps/symbols/font-awesome/chevron-circle-up.png +0 -0
- package/src/maps/symbols/font-awesome/cloud-rain.png +0 -0
- package/src/maps/symbols/font-awesome/cloud.png +0 -0
- package/src/maps/symbols/font-awesome/comment.png +0 -0
- package/src/maps/symbols/font-awesome/crosshairs.png +0 -0
- package/src/maps/symbols/font-awesome/dot-circle-o.png +0 -0
- package/src/maps/symbols/font-awesome/exclamation-circle.png +0 -0
- package/src/maps/symbols/font-awesome/exclamation-triangle.png +0 -0
- package/src/maps/symbols/font-awesome/female.png +0 -0
- package/src/maps/symbols/font-awesome/file.png +0 -0
- package/src/maps/symbols/font-awesome/flag.png +0 -0
- package/src/maps/symbols/font-awesome/flask.png +0 -0
- package/src/maps/symbols/font-awesome/h-square.png +0 -0
- package/src/maps/symbols/font-awesome/home.png +0 -0
- package/src/maps/symbols/font-awesome/info-circle.png +0 -0
- package/src/maps/symbols/font-awesome/male.png +0 -0
- package/src/maps/symbols/font-awesome/medkit.png +0 -0
- package/src/maps/symbols/font-awesome/mobile.png +0 -0
- package/src/maps/symbols/font-awesome/plus-circle.png +0 -0
- package/src/maps/symbols/font-awesome/plus-square.png +0 -0
- package/src/maps/symbols/font-awesome/plus.png +0 -0
- package/src/maps/symbols/font-awesome/square.png +0 -0
- package/src/maps/symbols/font-awesome/star.png +0 -0
- package/src/maps/symbols/font-awesome/thumbs-down.png +0 -0
- package/src/maps/symbols/font-awesome/thumbs-up.png +0 -0
- package/src/maps/symbols/font-awesome/ticket.png +0 -0
- package/src/maps/symbols/font-awesome/times-circle.png +0 -0
- package/src/maps/symbols/font-awesome/times.png +0 -0
- package/src/maps/symbols/font-awesome/tint.png +0 -0
- package/src/maps/symbols/font-awesome/tree.png +0 -0
- package/src/maps/symbols/font-awesome/university.png +0 -0
- package/src/maps/symbols/font-awesome/usd.png +0 -0
- package/src/maps/symbols/font-awesome/user.png +0 -0
- package/src/maps/symbols/font-awesome/users.png +0 -0
- package/src/maps/symbols/font-awesome/wheelchair.png +0 -0
- package/src/maps/symbols/sdf-ize.sh +93 -0
- package/src/maps/vectorMaps.tsx +32 -53
- package/src/mwater_table_selection/IndicatorsListComponent.tsx +165 -37
- package/src/mwater_table_selection/MWaterCalculatedDataSourcesListComponent.tsx +111 -0
- package/src/mwater_table_selection/MWaterCompleteTableSelectComponent.tsx +373 -37
- package/src/mwater_table_selection/MWaterTableSelectComponent.tsx +12 -8
- package/src/mwater_table_selection/MWaterWorkflowsSelectComponent.tsx +159 -0
- package/src/quickfilter/{QuickfiltersComponent.ts → QuickfiltersComponent.tsx} +165 -158
- package/src/quickfilter/TextLiteralComponent.tsx +197 -0
- package/src/widgets/MapWidget.tsx +11 -1
- package/src/widgets/text/ExprItemEditorComponent.tsx +83 -77
- package/src/widgets/text/ExprUpdateModalComponent.tsx +1 -0
- package/test/UndoStackTests.ts +52 -1
- package/.storybook/config.js +0 -7
- package/.storybook/head.html +0 -3
- package/.storybook/webpack.config.js +0 -15
- package/src/maps/BingLayer.ts +0 -146
- package/src/maps/MapComponent.ts +0 -312
- package/src/maps/MapControlComponent.ts +0 -46
- package/src/maps/MarkersLayerDesignerComponent.ts +0 -374
- package/src/maps/RasterMapViewComponent.ts +0 -345
- package/src/quickfilter/TextLiteralComponent.ts +0 -165
- package/stories/UpdateableComponent.js +0 -29
- package/stories/consoles.js +0 -202
- package/stories/dashboards.js +0 -217
- package/stories/datagridDesign.js +0 -114
- package/stories/datagrids.js +0 -69
- package/stories/dates.js +0 -80
- package/stories/exprcomponent.js +0 -43
- package/stories/index.js +0 -18
- package/stories/leaflet.js +0 -59
- package/stories/maps.js +0 -24
- package/stories/pivotChart.js +0 -235
package/lib/maps/GridLayer.js
CHANGED
|
@@ -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.
|
package/lib/maps/HoverContent.js
CHANGED
|
@@ -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: "
|
|
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
|
package/lib/maps/Layer.d.ts
CHANGED
|
@@ -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(): "
|
|
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 =
|
|
270
|
-
|
|
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: '© <a href="https://stadiamaps.com/" target="_blank">Stadia Maps</a> © <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a> © <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 =
|
|
285
|
-
|
|
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: '© CNES, Distribution Airbus DS, © Airbus DS, © PlanetObserver (Contains Copernicus Data) | © <a href="https://stadiamaps.com/" target="_blank">Stadia Maps</a> © <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a> © <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://
|
|
290
|
-
attribution: '© <a href="
|
|
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: '© <a href="https://stadiamaps.com/" target="_blank">Stadia Maps</a>, © <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a> © <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://
|
|
296
|
-
attribution: '© <a href="
|
|
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: '© <a href="https://stadiamaps.com/" target="_blank">Stadia Maps</a>, © <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a> © <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 "
|
|
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
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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.
|
|
63
|
+
renderView(): React.JSX.Element;
|
|
62
64
|
getCompiledFilters(): {
|
|
63
65
|
table: string;
|
|
64
66
|
jsonql: import("@mwater/jsonql").JsonQLExpr;
|
|
65
67
|
}[];
|
|
66
|
-
renderQuickfilter(): React.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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 {};
|