@mwater/visualization 5.2.0 → 5.3.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.d.ts +10 -11
- package/lib/ColorComponent.js +78 -29
- package/lib/ColorSchemeFactory.d.ts +13 -2
- package/lib/ColorSchemeFactory.js +7 -5
- package/lib/CustomColorsContext.d.ts +6 -0
- package/lib/CustomColorsContext.js +6 -0
- package/lib/FiltersDesignerComponent.d.ts +1 -4
- package/lib/FiltersDesignerComponent.js +2 -3
- package/lib/LocaleContextInjector.d.ts +5 -11
- package/lib/LocaleContextInjector.js +4 -12
- package/lib/MWaterAddRelatedFormComponent.js +3 -3
- package/lib/MWaterAddRelatedIndicatorComponent.d.ts +1 -4
- package/lib/MWaterAddRelatedIndicatorComponent.js +6 -6
- package/lib/MWaterCompleteTableSelectComponent.d.ts +5 -16
- package/lib/MWaterCompleteTableSelectComponent.js +36 -36
- package/lib/MWaterContextComponent.d.ts +4 -6
- package/lib/MWaterContextComponent.js +4 -13
- package/lib/MWaterLoaderComponent.d.ts +5 -3
- package/lib/MWaterLoaderComponent.js +2 -1
- package/lib/MWaterTableSelectComponent.d.ts +1 -4
- package/lib/MWaterTableSelectComponent.js +10 -12
- package/lib/UIComponents.d.ts +2 -2
- package/lib/UIComponents.js +4 -12
- package/lib/axes/AxisBuilder.d.ts +7 -4
- package/lib/axes/AxisBuilder.js +3 -1
- package/lib/axes/AxisComponent.d.ts +2 -5
- package/lib/axes/AxisComponent.js +1 -2
- package/lib/axes/ColorPaletteCollectionComponent.d.ts +5 -12
- package/lib/axes/ColorPaletteCollectionComponent.js +67 -36
- package/lib/dashboards/DashboardComponent.d.ts +4 -12
- package/lib/dashboards/DashboardComponent.js +18 -38
- package/lib/dashboards/DashboardDesign.d.ts +3 -3
- package/lib/dashboards/DashboardUpgrader.js +36 -1
- package/lib/dashboards/DashboardViewComponent.d.ts +5 -34
- package/lib/dashboards/DashboardViewComponent.js +109 -132
- package/lib/dashboards/FontStyleEditor.d.ts +8 -0
- package/lib/dashboards/FontStyleEditor.js +130 -0
- package/lib/dashboards/LayoutOptionsComponent.d.ts +0 -1
- package/lib/dashboards/LayoutOptionsComponent.js +211 -42
- package/lib/dashboards/ServerDashboardDataSource.d.ts +1 -2
- package/lib/dashboards/ServerDashboardDataSource.js +52 -33
- package/lib/dashboards/WidgetComponent.d.ts +3 -3
- package/lib/dashboards/WidgetComponent.js +3 -6
- package/lib/dashboards/WidgetDataSourcePrioritizer.d.ts +20 -0
- package/lib/dashboards/WidgetDataSourcePrioritizer.js +72 -0
- package/lib/dashboards/layoutOptions.d.ts +83 -0
- package/lib/dashboards/layoutOptions.js +436 -10
- package/lib/datagrids/DatagridDesign.d.ts +7 -6
- package/lib/datagrids/ServerDatagridDataSource.d.ts +7 -6
- package/lib/datagrids/ServerDatagridDataSource.js +87 -33
- package/lib/demo.js +3 -3
- package/lib/index.css +5 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +0 -1
- package/lib/layouts/LayoutManager.d.ts +33 -29
- package/lib/layouts/LayoutManager.js +2 -8
- package/lib/layouts/blocks/BlocksDisplayComponent.d.ts +26 -57
- package/lib/layouts/blocks/BlocksDisplayComponent.js +122 -205
- package/lib/layouts/blocks/BlocksLayoutManager.d.ts +6 -22
- package/lib/layouts/blocks/BlocksLayoutManager.js +5 -14
- package/lib/layouts/blocks/HorizontalBlockComponent.d.ts +5 -4
- package/lib/layouts/blocks/HorizontalBlockComponent.js +5 -5
- package/lib/mWaterLoader.d.ts +2 -0
- package/lib/mWaterLoader.js +2 -1
- package/lib/maps/AddLayerComponent.d.ts +6 -8
- package/lib/maps/AddLayerComponent.js +6 -6
- package/lib/maps/BingLayer.js +10 -20
- package/lib/maps/BufferLayer.js +2 -1
- package/lib/maps/ChoroplethLayer.js +2 -1
- package/lib/maps/DirectMapDataSource.d.ts +5 -2
- package/lib/maps/DirectMapDataSource.js +2 -1
- package/lib/maps/EditPopupComponent.js +2 -1
- package/lib/maps/MapComponent.d.ts +1 -4
- package/lib/maps/MapComponent.js +3 -3
- package/lib/maps/MarkersLayer.js +30 -25
- package/lib/maps/RasterMapViewComponent.d.ts +1 -4
- package/lib/maps/RasterMapViewComponent.js +3 -3
- package/lib/maps/ServerMapDataSource.d.ts +2 -3
- package/lib/maps/ServerMapDataSource.js +5 -5
- package/lib/maps/VectorMapViewComponent.js +2 -1
- package/lib/maps/mapSymbols.js +2 -0
- package/lib/maps/symbols/font-awesome/cloud-rain.png +0 -0
- package/lib/maps/vectorMaps.js +61 -55
- package/lib/quickfilter/QuickfiltersComponent.d.ts +1 -4
- package/lib/quickfilter/QuickfiltersComponent.js +3 -3
- package/lib/richtext/DropdownPaletteItem.d.ts +32 -0
- package/lib/richtext/DropdownPaletteItem.js +82 -0
- package/lib/richtext/FontColorPaletteItem.d.ts +1 -5
- package/lib/richtext/FontColorPaletteItem.js +32 -27
- package/lib/richtext/ItemsHtmlConverter.js +12 -3
- package/lib/richtext/RichTextComponent.d.ts +26 -52
- package/lib/richtext/RichTextComponent.js +166 -128
- package/lib/valueFormatter.js +6 -1
- package/lib/wellknown.d.ts +5 -0
- package/lib/wellknown.js +288 -0
- package/lib/widgets/DropdownWidgetComponent.d.ts +8 -25
- package/lib/widgets/DropdownWidgetComponent.js +48 -25
- package/lib/widgets/IFrameWidgetComponent.d.ts +1 -2
- package/lib/widgets/ImageWidgetComponent.d.ts +2 -3
- package/lib/widgets/MapWidget.d.ts +2 -0
- package/lib/widgets/MapWidget.js +2 -1
- package/lib/widgets/TOCWidget.js +2 -1
- package/lib/widgets/Widget.d.ts +2 -0
- package/lib/widgets/WidgetDataSource.d.ts +3 -1
- package/lib/widgets/charts/Chart.d.ts +0 -1
- package/lib/widgets/charts/ChartViewComponent.d.ts +4 -0
- package/lib/widgets/charts/ChartViewComponent.js +11 -3
- package/lib/widgets/charts/ChartWidget.d.ts +1 -62
- package/lib/widgets/charts/ChartWidget.js +4 -183
- package/lib/widgets/charts/ChartWidgetComponent.d.ts +51 -0
- package/lib/widgets/charts/ChartWidgetComponent.js +167 -0
- package/lib/widgets/charts/calendar/CalendarChartViewComponent.d.ts +1 -4
- package/lib/widgets/charts/calendar/CalendarChartViewComponent.js +4 -4
- package/lib/widgets/charts/layered/LayeredChart.d.ts +5 -10
- package/lib/widgets/charts/layered/LayeredChart.js +6 -7
- package/lib/widgets/charts/layered/LayeredChartCompiler.d.ts +4 -2
- package/lib/widgets/charts/layered/LayeredChartCompiler.js +46 -32
- package/lib/widgets/charts/layered/LayeredChartDesign.d.ts +4 -0
- package/lib/widgets/charts/layered/LayeredChartDesignerComponent.d.ts +3 -0
- package/lib/widgets/charts/layered/LayeredChartDesignerComponent.js +21 -3
- package/lib/widgets/charts/layered/LayeredChartLayerDesignerComponent.d.ts +1 -2
- package/lib/widgets/charts/layered/LayeredChartLayerDesignerComponent.js +2 -1
- package/lib/widgets/charts/layered/LayeredChartViewComponent.d.ts +1 -4
- package/lib/widgets/charts/layered/LayeredChartViewComponent.js +89 -38
- package/lib/widgets/charts/pivot/IntersectionDesignerComponent.d.ts +5 -112
- package/lib/widgets/charts/pivot/IntersectionDesignerComponent.js +122 -166
- package/lib/widgets/charts/pivot/PivotChart.d.ts +6 -0
- package/lib/widgets/charts/pivot/PivotChart.js +47 -17
- package/lib/widgets/charts/pivot/PivotChartDesign.d.ts +11 -0
- package/lib/widgets/charts/pivot/PivotChartDesignerComponent.d.ts +1 -1
- package/lib/widgets/charts/pivot/PivotChartDesignerComponent.js +1 -1
- package/lib/widgets/charts/pivot/PivotChartLayoutBuilder.d.ts +2 -2
- package/lib/widgets/charts/pivot/PivotChartLayoutBuilder.js +20 -36
- package/lib/widgets/charts/pivot/PivotChartLayoutComponent.js +0 -1
- package/lib/widgets/charts/pivot/PivotChartQueryBuilder.d.ts +23 -2
- package/lib/widgets/charts/pivot/PivotChartQueryBuilder.js +215 -181
- package/lib/widgets/charts/pivot/PivotChartUtils.d.ts +2 -2
- package/lib/widgets/charts/pivot/PivotChartViewComponent.d.ts +9 -28
- package/lib/widgets/charts/pivot/PivotChartViewComponent.js +20 -60
- package/lib/widgets/charts/table/TableChart.js +8 -4
- package/lib/widgets/charts/table/TableChartDesignerComponent.js +3 -3
- package/lib/widgets/charts/table/TableChartViewComponent.js +11 -11
- package/lib/widgets/text/TextComponent.d.ts +5 -12
- package/lib/widgets/text/TextComponent.js +19 -39
- package/lib/widgets/text/TextWidget.d.ts +2 -1
- package/lib/widgets/text/TextWidget.js +5 -1
- package/lib/widgets/text/TextWidgetComponent.d.ts +15 -3
- package/lib/widgets/text/TextWidgetComponent.js +76 -19
- package/lib/widgets/text/TextWidgetDesign.d.ts +13 -1
- package/lib/widgets/text/TextWidgetDesign.js +6 -0
- package/package.json +4 -4
- package/src/ColorComponent.tsx +177 -0
- package/src/ColorSchemeFactory.ts +12 -6
- package/src/CustomColorsContext.tsx +9 -0
- package/src/FiltersDesignerComponent.ts +3 -4
- package/src/LocaleContextInjector.tsx +14 -13
- package/src/MWaterAddRelatedFormComponent.ts +3 -3
- package/src/MWaterAddRelatedIndicatorComponent.ts +6 -6
- package/src/MWaterCompleteTableSelectComponent.tsx +36 -36
- package/src/MWaterContextComponent.tsx +8 -17
- package/src/MWaterLoaderComponent.ts +6 -3
- package/src/MWaterTableSelectComponent.tsx +11 -12
- package/src/{UIComponents.ts → UIComponents.tsx} +7 -15
- package/src/axes/AxisBuilder.ts +7 -5
- package/src/axes/AxisComponent.ts +3 -4
- package/src/axes/{ColorPaletteCollectionComponent.ts → ColorPaletteCollectionComponent.tsx} +87 -61
- package/src/dashboards/DashboardComponent.tsx +71 -107
- package/src/dashboards/DashboardDesign.ts +3 -3
- package/src/dashboards/DashboardUpgrader.ts +41 -1
- package/src/dashboards/DashboardViewComponent.tsx +313 -0
- package/src/dashboards/FontStyleEditor.tsx +166 -0
- package/src/dashboards/LayoutOptionsComponent.tsx +380 -75
- package/src/dashboards/ServerDashboardDataSource.ts +52 -33
- package/src/dashboards/WidgetComponent.tsx +6 -12
- package/src/dashboards/WidgetDataSourcePrioritizer.ts +82 -0
- package/src/dashboards/layoutOptions.tsx +581 -0
- package/src/datagrids/DatagridDesign.ts +8 -3
- package/src/datagrids/ServerDatagridDataSource.ts +106 -43
- package/src/demo.ts +3 -3
- package/src/index.css +5 -0
- package/src/index.ts +1 -1
- package/src/layouts/LayoutManager.ts +44 -42
- package/src/layouts/blocks/BlocksDisplayComponent.tsx +498 -0
- package/src/layouts/blocks/BlocksLayoutManager.ts +6 -15
- package/src/layouts/blocks/HorizontalBlockComponent.ts +9 -8
- package/src/mWaterLoader.ts +4 -1
- package/src/maps/AddLayerComponent.ts +9 -9
- package/src/maps/BingLayer.ts +16 -26
- package/src/maps/BufferLayer.ts +2 -1
- package/src/maps/ChoroplethLayer.ts +2 -1
- package/src/maps/DirectMapDataSource.ts +12 -3
- package/src/maps/EditPopupComponent.ts +2 -1
- package/src/maps/MapComponent.ts +3 -3
- package/src/maps/MarkersLayer.ts +38 -41
- package/src/maps/RasterMapViewComponent.ts +3 -3
- package/src/maps/ServerMapDataSource.ts +7 -7
- package/src/maps/VectorMapViewComponent.tsx +2 -1
- package/src/maps/mapSymbols.ts +2 -0
- package/src/maps/symbols/font-awesome/cloud-rain.png +0 -0
- package/src/maps/vectorMaps.tsx +79 -74
- package/src/quickfilter/QuickfiltersComponent.ts +3 -3
- package/src/richtext/DropdownPaletteItem.tsx +144 -0
- package/src/richtext/FontColorPaletteItem.tsx +160 -0
- package/src/richtext/ItemsHtmlConverter.ts +15 -5
- package/src/richtext/RichTextComponent.tsx +274 -232
- package/src/valueFormatter.ts +5 -1
- package/src/wellknown.ts +286 -0
- package/src/widgets/DropdownWidgetComponent.tsx +75 -0
- package/src/widgets/MapWidget.ts +5 -2
- package/src/widgets/TOCWidget.ts +2 -1
- package/src/widgets/Widget.ts +3 -0
- package/src/widgets/WidgetDataSource.ts +3 -1
- package/src/widgets/charts/Chart.ts +1 -1
- package/src/widgets/charts/ChartViewComponent.ts +16 -3
- package/src/widgets/charts/ChartWidget.ts +3 -275
- package/src/widgets/charts/ChartWidgetComponent.tsx +281 -0
- package/src/widgets/charts/calendar/CalendarChartViewComponent.tsx +4 -4
- package/src/widgets/charts/layered/LayeredChart.ts +4 -6
- package/src/widgets/charts/layered/LayeredChartCompiler.ts +80 -63
- package/src/widgets/charts/layered/LayeredChartDesign.ts +7 -1
- package/src/widgets/charts/layered/LayeredChartDesignerComponent.tsx +43 -10
- package/src/widgets/charts/layered/LayeredChartLayerDesignerComponent.tsx +6 -6
- package/src/widgets/charts/layered/LayeredChartViewComponent.ts +140 -88
- package/src/widgets/charts/pivot/IntersectionDesignerComponent.tsx +305 -221
- package/src/widgets/charts/pivot/PivotChart.ts +56 -18
- package/src/widgets/charts/pivot/PivotChartDesign.ts +12 -0
- package/src/widgets/charts/pivot/PivotChartDesignerComponent.tsx +4 -3
- package/src/widgets/charts/pivot/PivotChartLayoutBuilder.ts +39 -76
- package/src/widgets/charts/pivot/PivotChartLayoutComponent.tsx +0 -1
- package/src/widgets/charts/pivot/PivotChartQueryBuilder.ts +230 -189
- package/src/widgets/charts/pivot/PivotChartUtils.ts +4 -4
- package/src/widgets/charts/pivot/{PivotChartViewComponent.ts → PivotChartViewComponent.tsx} +86 -89
- package/src/widgets/charts/table/TableChart.ts +8 -4
- package/src/widgets/charts/table/TableChartDesignerComponent.ts +4 -4
- package/src/widgets/charts/table/TableChartViewComponent.ts +13 -14
- package/src/widgets/text/TextComponent.tsx +47 -49
- package/src/widgets/text/TextWidget.ts +8 -3
- package/src/widgets/text/TextWidgetComponent.tsx +249 -0
- package/src/widgets/text/TextWidgetDesign.ts +22 -1
- package/src/ColorComponent.ts +0 -117
- package/src/dashboards/DashboardViewComponent.ts +0 -303
- package/src/dashboards/layoutOptions.ts +0 -40
- package/src/layout-styles.css +0 -263
- package/src/layouts/blocks/BlocksDisplayComponent.ts +0 -461
- package/src/layouts/grid/GridLayoutComponent.ts +0 -67
- package/src/layouts/grid/GridLayoutManager.ts +0 -185
- package/src/layouts/grid/LegoLayoutEngine.ts +0 -142
- package/src/layouts/grid/PaletteItemComponent.ts +0 -28
- package/src/layouts/grid/README.md +0 -14
- package/src/layouts/grid/WidgetContainerComponent.ts +0 -420
- package/src/richtext/FontColorPaletteItem.ts +0 -172
- package/src/richtext/FontSizePaletteItem.ts +0 -110
- package/src/widgets/DropdownWidgetComponent.ts +0 -78
- package/src/widgets/text/TextWidgetComponent.ts +0 -120
package/src/maps/BingLayer.ts
CHANGED
|
@@ -68,36 +68,26 @@ module.exports = L.TileLayer.extend({
|
|
|
68
68
|
|
|
69
69
|
loadMetadata: function () {
|
|
70
70
|
var _this = this
|
|
71
|
-
var
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
document.location.protocol +
|
|
84
|
-
"//dev.virtualearth.net/REST/v1/Imagery/Metadata/" +
|
|
85
|
-
this.options.type +
|
|
86
|
-
"?include=ImageryProviders&jsonp=" +
|
|
87
|
-
cbid +
|
|
88
|
-
"&key=" +
|
|
89
|
-
this._key +
|
|
90
|
-
"&UriScheme=" +
|
|
91
|
-
document.location.protocol.slice(0, -1)
|
|
92
|
-
var script = document.createElement("script")
|
|
93
|
-
script.type = "text/javascript"
|
|
94
|
-
script.src = url
|
|
95
|
-
script.id = cbid
|
|
96
|
-
document.getElementsByTagName("head")[0].appendChild(script)
|
|
71
|
+
var url = `https://dev.virtualearth.net/REST/v1/Imagery/Metadata/${this.options.type}?include=ImageryProviders&key=${this._key}&UriScheme=https`
|
|
72
|
+
|
|
73
|
+
fetch(url)
|
|
74
|
+
.then(response => response.json())
|
|
75
|
+
.then(meta => {
|
|
76
|
+
_this.meta = meta
|
|
77
|
+
if (meta.errorDetails) {
|
|
78
|
+
return
|
|
79
|
+
}
|
|
80
|
+
_this.initMetadata()
|
|
81
|
+
})
|
|
82
|
+
.catch(error => console.error('Error loading Bing Maps metadata:', error))
|
|
97
83
|
},
|
|
98
84
|
|
|
99
85
|
initMetadata: function () {
|
|
100
86
|
var r = this.meta.resourceSets[0].resources[0]
|
|
87
|
+
if (!r) {
|
|
88
|
+
console.error("Error loading Bing Maps metadata")
|
|
89
|
+
return
|
|
90
|
+
}
|
|
101
91
|
this.options.subdomains = r.imageUrlSubdomains
|
|
102
92
|
this._url = r.imageUrl
|
|
103
93
|
this._providers = []
|
package/src/maps/BufferLayer.ts
CHANGED
|
@@ -15,6 +15,7 @@ import LayerLegendComponent from "./LayerLegendComponent"
|
|
|
15
15
|
import * as PopupFilterJoinsUtils from "./PopupFilterJoinsUtils"
|
|
16
16
|
import { LayerSpecification } from "maplibre-gl"
|
|
17
17
|
import HoverContent from "./HoverContent"
|
|
18
|
+
import { getDefaultLayoutOptions } from "../dashboards/layoutOptions"
|
|
18
19
|
|
|
19
20
|
/*
|
|
20
21
|
Layer which draws a buffer around geometries (i.e. a radius circle around points)
|
|
@@ -659,7 +660,7 @@ marker-fill: ` +
|
|
|
659
660
|
|
|
660
661
|
results.popup = new BlocksLayoutManager().renderLayout({
|
|
661
662
|
items: clickOptions.design.popup.items,
|
|
662
|
-
|
|
663
|
+
layoutOptions: getDefaultLayoutOptions("default"),
|
|
663
664
|
renderWidget: (options: any) => {
|
|
664
665
|
const widget = WidgetFactory.createWidget(options.type)
|
|
665
666
|
|
|
@@ -25,6 +25,7 @@ import LayerLegendComponent from "./LayerLegendComponent"
|
|
|
25
25
|
import * as PopupFilterJoinsUtils from "./PopupFilterJoinsUtils"
|
|
26
26
|
import { LayerSpecification } from "maplibre-gl"
|
|
27
27
|
import HoverContent from "./HoverContent"
|
|
28
|
+
import { getDefaultLayoutOptions } from "../dashboards/layoutOptions"
|
|
28
29
|
|
|
29
30
|
export default class ChoroplethLayer extends Layer<ChoroplethLayerDesign> {
|
|
30
31
|
/** Gets the type of layer definition */
|
|
@@ -1333,7 +1334,7 @@ export default class ChoroplethLayer extends Layer<ChoroplethLayerDesign> {
|
|
|
1333
1334
|
|
|
1334
1335
|
results.popup = new BlocksLayoutManager().renderLayout({
|
|
1335
1336
|
items: clickOptions.design.popup.items,
|
|
1336
|
-
|
|
1337
|
+
layoutOptions: getDefaultLayoutOptions("default"),
|
|
1337
1338
|
renderWidget: (options: any) => {
|
|
1338
1339
|
const widget = WidgetFactory.createWidget(options.type)
|
|
1339
1340
|
|
|
@@ -17,8 +17,7 @@ import * as QuickfilterUtils from "../quickfilter/QuickfilterUtils"
|
|
|
17
17
|
import { useState, useEffect } from 'react'
|
|
18
18
|
import { useStableCallback } from "@mwater/react-library/lib/useStableCallback"
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
interface DirectMapDataSourceOptions {
|
|
20
|
+
export interface DirectMapDataSourceOptions {
|
|
22
21
|
/** schema to use */
|
|
23
22
|
schema: Schema
|
|
24
23
|
|
|
@@ -33,6 +32,9 @@ interface DirectMapDataSourceOptions {
|
|
|
33
32
|
|
|
34
33
|
/** client id to use for talking to mWater server */
|
|
35
34
|
client?: string
|
|
35
|
+
|
|
36
|
+
/** Origin to which server time is recorded e.g. maps:232434... */
|
|
37
|
+
origin?: string
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
export default class DirectMapDataSource implements MapDataSource {
|
|
@@ -97,6 +99,9 @@ interface DirectLayerDataSourceOptions {
|
|
|
97
99
|
|
|
98
100
|
/** client id to use for talking to mWater server */
|
|
99
101
|
client?: string
|
|
102
|
+
|
|
103
|
+
/** Origin to which server time is recorded e.g. maps:232434... */
|
|
104
|
+
origin?: string
|
|
100
105
|
}
|
|
101
106
|
|
|
102
107
|
/** Interface for a request made to get a token for vector tiles.
|
|
@@ -122,6 +127,9 @@ export interface VectorTileDirectTokenRequest {
|
|
|
122
127
|
|
|
123
128
|
/** Enforced maximum zoom level */
|
|
124
129
|
maxZoom?: number
|
|
130
|
+
|
|
131
|
+
/** Origin to which server time is recorded */
|
|
132
|
+
origin?: string
|
|
125
133
|
}
|
|
126
134
|
|
|
127
135
|
/**
|
|
@@ -243,7 +251,8 @@ class DirectLayerDataSource implements MapLayerDataSource {
|
|
|
243
251
|
maxZoom: vectorTile.maxZoom,
|
|
244
252
|
createdAfter: createdAfter,
|
|
245
253
|
// 12 hours
|
|
246
|
-
expiresAfter: new Date(Date.now() + 1000 * 3600 * 12).toISOString()
|
|
254
|
+
expiresAfter: new Date(Date.now() + 1000 * 3600 * 12).toISOString(),
|
|
255
|
+
origin: this.options.origin
|
|
247
256
|
}
|
|
248
257
|
|
|
249
258
|
const { url, expires } = await getVectorTileFromDirectRequest({
|
|
@@ -8,6 +8,7 @@ import WidgetFactory from "../widgets/WidgetFactory"
|
|
|
8
8
|
import DirectWidgetDataSource from "../widgets/DirectWidgetDataSource"
|
|
9
9
|
import PopupFilterJoinsEditComponent from "./PopupFilterJoinsEditComponent"
|
|
10
10
|
import { DataSource, Schema } from "@mwater/expressions"
|
|
11
|
+
import { getDefaultLayoutOptions } from "../dashboards/layoutOptions"
|
|
11
12
|
|
|
12
13
|
export interface EditPopupComponentProps {
|
|
13
14
|
/** Schema to use */
|
|
@@ -87,7 +88,7 @@ export default class EditPopupComponent extends React.Component<EditPopupCompone
|
|
|
87
88
|
{ isOpen: true, onRequestClose: () => this.setState({ editing: false }) },
|
|
88
89
|
new BlocksLayoutManager().renderLayout({
|
|
89
90
|
items: this.props.design.popup?.items,
|
|
90
|
-
|
|
91
|
+
layoutOptions: getDefaultLayoutOptions("default"),
|
|
91
92
|
onItemsChange: this.handleItemsChange,
|
|
92
93
|
disableMaps: true,
|
|
93
94
|
renderWidget: (options: any) => {
|
package/src/maps/MapComponent.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import PropTypes from "prop-types"
|
|
2
1
|
import _ from "lodash"
|
|
3
2
|
import React, { ReactNode } from "react"
|
|
4
3
|
const R = React.createElement
|
|
@@ -16,6 +15,7 @@ import { JsonQLFilter } from "../JsonQLFilter"
|
|
|
16
15
|
import QuickfilterCompiler from "../quickfilter/QuickfilterCompiler"
|
|
17
16
|
import QuickfiltersComponent from "../quickfilter/QuickfiltersComponent"
|
|
18
17
|
import { getCompiledFilters, getFilterableTables } from "./MapUtils"
|
|
18
|
+
import { LocaleContext } from "@mwater/expressions-ui/lib/contexts"
|
|
19
19
|
|
|
20
20
|
export interface MapComponentProps {
|
|
21
21
|
schema: Schema
|
|
@@ -64,7 +64,7 @@ interface MapComponentState {
|
|
|
64
64
|
|
|
65
65
|
/** Map with designer on right */
|
|
66
66
|
export default class MapComponent extends React.Component<MapComponentProps, MapComponentState> {
|
|
67
|
-
static
|
|
67
|
+
static contextType = LocaleContext
|
|
68
68
|
|
|
69
69
|
constructor(props: MapComponentProps) {
|
|
70
70
|
super(props)
|
|
@@ -232,7 +232,7 @@ export default class MapComponent extends React.Component<MapComponentProps, Map
|
|
|
232
232
|
zoomLocked: this.state.zoomLocked,
|
|
233
233
|
onRowClick: this.props.onRowClick,
|
|
234
234
|
extraFilters: filters,
|
|
235
|
-
locale: this.context
|
|
235
|
+
locale: this.context,
|
|
236
236
|
width: size.width!,
|
|
237
237
|
height: size.height!
|
|
238
238
|
})
|
package/src/maps/MarkersLayer.ts
CHANGED
|
@@ -15,6 +15,7 @@ import LayerLegendComponent from "./LayerLegendComponent"
|
|
|
15
15
|
import * as PopupFilterJoinsUtils from "./PopupFilterJoinsUtils"
|
|
16
16
|
import { ExpressionSpecification, FilterSpecification, LayerSpecification } from "maplibre-gl"
|
|
17
17
|
import HoverContent from "./HoverContent"
|
|
18
|
+
import { getDefaultLayoutOptions } from "../dashboards/layoutOptions"
|
|
18
19
|
|
|
19
20
|
export default class MarkersLayer extends Layer<MarkersLayerDesign> {
|
|
20
21
|
/** Gets the type of layer definition */
|
|
@@ -61,11 +62,7 @@ export default class MarkersLayer extends Layer<MarkersLayerDesign> {
|
|
|
61
62
|
"fill-color": color,
|
|
62
63
|
"fill-opacity": (design.polygonFillOpacity ?? 0.25) * opacity
|
|
63
64
|
},
|
|
64
|
-
filter: addFilter([
|
|
65
|
-
"any",
|
|
66
|
-
["==", ["geometry-type"], "Polygon"],
|
|
67
|
-
["==", ["geometry-type"], "MultiPolygon"]
|
|
68
|
-
])
|
|
65
|
+
filter: addFilter(["any", ["==", ["geometry-type"], "Polygon"], ["==", ["geometry-type"], "MultiPolygon"]])
|
|
69
66
|
})
|
|
70
67
|
|
|
71
68
|
// Add polygon outlines and lines
|
|
@@ -79,11 +76,7 @@ export default class MarkersLayer extends Layer<MarkersLayerDesign> {
|
|
|
79
76
|
"line-width": design.lineWidth != null ? design.lineWidth : 3,
|
|
80
77
|
"line-opacity": opacity
|
|
81
78
|
},
|
|
82
|
-
filter: addFilter([
|
|
83
|
-
"any",
|
|
84
|
-
["==", ["geometry-type"], "Polygon"],
|
|
85
|
-
["==", ["geometry-type"], "MultiPolygon"]
|
|
86
|
-
])
|
|
79
|
+
filter: addFilter(["any", ["==", ["geometry-type"], "Polygon"], ["==", ["geometry-type"], "MultiPolygon"]])
|
|
87
80
|
})
|
|
88
81
|
|
|
89
82
|
// Add lines
|
|
@@ -97,11 +90,7 @@ export default class MarkersLayer extends Layer<MarkersLayerDesign> {
|
|
|
97
90
|
"line-width": design.lineWidth != null ? design.lineWidth : 3,
|
|
98
91
|
"line-opacity": opacity
|
|
99
92
|
},
|
|
100
|
-
filter: addFilter([
|
|
101
|
-
"any",
|
|
102
|
-
["==", ["geometry-type"], "LineString"],
|
|
103
|
-
["==", ["geometry-type"], "MultiLineString"]
|
|
104
|
-
])
|
|
93
|
+
filter: addFilter(["any", ["==", ["geometry-type"], "LineString"], ["==", ["geometry-type"], "MultiLineString"]])
|
|
105
94
|
})
|
|
106
95
|
|
|
107
96
|
if (!design.symbol) {
|
|
@@ -161,7 +150,7 @@ export default class MarkersLayer extends Layer<MarkersLayerDesign> {
|
|
|
161
150
|
// Compile geometry axis
|
|
162
151
|
const geometryExpr = axisBuilder.compileAxis({ axis: design.axes.geometry, tableAlias: "basequery" })
|
|
163
152
|
|
|
164
|
-
// Select _id, location
|
|
153
|
+
// Select _id, location
|
|
165
154
|
const basequery: JsonQLSelectQuery = {
|
|
166
155
|
type: "query",
|
|
167
156
|
selects: [
|
|
@@ -170,7 +159,7 @@ export default class MarkersLayer extends Layer<MarkersLayerDesign> {
|
|
|
170
159
|
expr: { type: "field", tableAlias: "basequery", column: schema.getTable(design.table)!.primaryKey },
|
|
171
160
|
alias: "id"
|
|
172
161
|
}, // main primary key as id
|
|
173
|
-
{ type: "select", expr: geometryExpr, alias: "the_geom_webmercator" }
|
|
162
|
+
{ type: "select", expr: geometryExpr, alias: "the_geom_webmercator" } // geometry as the_geom_webmercator
|
|
174
163
|
],
|
|
175
164
|
from: exprCompiler.compileTable(design.table, "basequery")
|
|
176
165
|
}
|
|
@@ -459,7 +448,7 @@ line-width: ` +
|
|
|
459
448
|
JSON.stringify(item.value) +
|
|
460
449
|
"][geometry_type='ST_Polygon'],#layer0[color=" +
|
|
461
450
|
JSON.stringify(item.value) +
|
|
462
|
-
`][geometry_type='ST_MultiPolygon'] {
|
|
451
|
+
`][geometry_type='ST_MultiPolygon'] {
|
|
463
452
|
polygon-fill: ` +
|
|
464
453
|
item.color +
|
|
465
454
|
`;\
|
|
@@ -484,22 +473,26 @@ ${design.polygonBorderColor ? "line-color: " + design.polygonBorderColor + ";" :
|
|
|
484
473
|
|
|
485
474
|
// Popup
|
|
486
475
|
if (hoverOptions.design.hoverOver) {
|
|
487
|
-
|
|
488
|
-
const popupFilterJoins =
|
|
489
|
-
hoverOptions.design.popupFilterJoins || PopupFilterJoinsUtils.createDefaultPopupFilterJoins(table)
|
|
490
|
-
const popupFilters = PopupFilterJoinsUtils.createPopupFilters(
|
|
491
|
-
popupFilterJoins,
|
|
492
|
-
hoverOptions.schema,
|
|
493
|
-
table,
|
|
494
|
-
ev.data.id
|
|
495
|
-
)
|
|
476
|
+
const exprCompiler = new ExprCompiler(hoverOptions.schema)
|
|
496
477
|
|
|
497
478
|
results.hoverOver = React.createElement(HoverContent, {
|
|
498
479
|
key: ev.data.id,
|
|
499
480
|
schema: hoverOptions.schema,
|
|
500
481
|
dataSource: hoverOptions.dataSource,
|
|
501
482
|
design: hoverOptions.design,
|
|
502
|
-
filters:
|
|
483
|
+
filters: [
|
|
484
|
+
{
|
|
485
|
+
table,
|
|
486
|
+
jsonql: {
|
|
487
|
+
type: "op",
|
|
488
|
+
op: "=",
|
|
489
|
+
exprs: [
|
|
490
|
+
exprCompiler.compileExpr({ expr: { type: "id", table }, tableAlias: "{alias}" }),
|
|
491
|
+
{ type: "literal", value: ev.data.id }
|
|
492
|
+
]
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
]
|
|
503
496
|
})
|
|
504
497
|
}
|
|
505
498
|
|
|
@@ -586,7 +579,7 @@ ${design.polygonBorderColor ? "line-color: " + design.polygonBorderColor + ";" :
|
|
|
586
579
|
|
|
587
580
|
results.popup = new BlocksLayoutManager().renderLayout({
|
|
588
581
|
items: clickOptions.design.popup.items,
|
|
589
|
-
|
|
582
|
+
layoutOptions: getDefaultLayoutOptions("default"),
|
|
590
583
|
renderWidget: (options: any) => {
|
|
591
584
|
const widget = WidgetFactory.createWidget(options.type)
|
|
592
585
|
|
|
@@ -803,17 +796,17 @@ ${design.polygonBorderColor ? "line-color: " + design.polygonBorderColor + ";" :
|
|
|
803
796
|
}
|
|
804
797
|
|
|
805
798
|
/**
|
|
806
|
-
* Takes a base query that has any number of selects and where conditions. It must have a geometry
|
|
807
|
-
* field called the_geom_webmercator. It then adds a select that is a row_number() over a partition by the rounded
|
|
808
|
-
* ST_XMin and ST_YMin of the geometry divided by the scale of the tile. This creates clusters of markers
|
|
799
|
+
* Takes a base query that has any number of selects and where conditions. It must have a geometry
|
|
800
|
+
* field called the_geom_webmercator. It then adds a select that is a row_number() over a partition by the rounded
|
|
801
|
+
* ST_XMin and ST_YMin of the geometry divided by the scale of the tile. This creates clusters of markers
|
|
809
802
|
* that are within the same grid square of the size of the scale. The row_number() is aliased as "r".
|
|
810
|
-
*
|
|
803
|
+
*
|
|
811
804
|
* It then adds a where clause that clips the geometry to the envelope of the tile plus a margin.
|
|
812
|
-
*
|
|
813
|
-
* The outer query then selects all non-geometry and non-cluster fields and wraps the geometry in
|
|
814
|
-
* ST_AsMVTGeom to prepare it for display. It also limits the clusters to a maximum of 3 markers per
|
|
805
|
+
*
|
|
806
|
+
* The outer query then selects all non-geometry and non-cluster fields and wraps the geometry in
|
|
807
|
+
* ST_AsMVTGeom to prepare it for display. It also limits the clusters to a maximum of 3 markers per
|
|
815
808
|
* small area to limit tile sizes
|
|
816
|
-
*
|
|
809
|
+
*
|
|
817
810
|
* @param baseQuery query to build from
|
|
818
811
|
* @returns query ready for sending to server
|
|
819
812
|
*/
|
|
@@ -906,9 +899,13 @@ export function createMarkersVectorQuery(baseQuery: JsonQLSelectQuery) {
|
|
|
906
899
|
})
|
|
907
900
|
|
|
908
901
|
// Bubble up selects that are not cluster or geometry to the outer query
|
|
909
|
-
const innerSelects: JsonQLSelect[] = baseQuery.selects
|
|
910
|
-
select => select.alias !== "the_geom_webmercator"
|
|
911
|
-
|
|
902
|
+
const innerSelects: JsonQLSelect[] = baseQuery.selects
|
|
903
|
+
.filter(select => select.alias !== "the_geom_webmercator")
|
|
904
|
+
.map(select => ({
|
|
905
|
+
type: "select",
|
|
906
|
+
expr: { type: "field", tableAlias: "innerquery", column: select.alias },
|
|
907
|
+
alias: select.alias
|
|
908
|
+
}))
|
|
912
909
|
|
|
913
910
|
// Create outer query which takes where r <= 3 to limit # of points in a cluster
|
|
914
911
|
// Wrap geometry in ST_Force2D to avoid https://trac.osgeo.org/postgis/ticket/4690 (https://github.com/mWater/mwater-server/issues/495)
|
|
@@ -931,7 +928,7 @@ export function createMarkersVectorQuery(baseQuery: JsonQLSelectQuery) {
|
|
|
931
928
|
]
|
|
932
929
|
},
|
|
933
930
|
alias: "the_geom_webmercator"
|
|
934
|
-
}
|
|
931
|
+
} // innerquery.the_geom_webmercator as the_geom_webmercator
|
|
935
932
|
],
|
|
936
933
|
from: { type: "subquery", query: innerquery, alias: "innerquery" },
|
|
937
934
|
where: { type: "op", op: "<=", exprs: [{ type: "field", tableAlias: "innerquery", column: "r" }, 3] }
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import PropTypes from "prop-types"
|
|
2
1
|
import _ from "lodash"
|
|
3
2
|
import React, { ReactNode } from "react"
|
|
4
3
|
const R = React.createElement
|
|
@@ -13,6 +12,7 @@ import { JsonQLFilter } from "../JsonQLFilter"
|
|
|
13
12
|
import { MapDesign } from "./MapDesign"
|
|
14
13
|
import { MapDataSource } from "./MapDataSource"
|
|
15
14
|
import { MapScope } from "./MapUtils"
|
|
15
|
+
import { LocaleContext } from "@mwater/expressions-ui/lib/contexts"
|
|
16
16
|
|
|
17
17
|
export interface RasterMapViewComponentProps {
|
|
18
18
|
schema: Schema
|
|
@@ -67,7 +67,7 @@ export default class RasterMapViewComponent extends React.Component<
|
|
|
67
67
|
legendHidden: boolean
|
|
68
68
|
}
|
|
69
69
|
> {
|
|
70
|
-
static
|
|
70
|
+
static contextType = LocaleContext
|
|
71
71
|
|
|
72
72
|
leafletMap?: LeafletMapComponent | null
|
|
73
73
|
|
|
@@ -215,7 +215,7 @@ export default class RasterMapViewComponent extends React.Component<
|
|
|
215
215
|
layerViews: this.props.design.layerViews,
|
|
216
216
|
filters: this.getCompiledFilters(),
|
|
217
217
|
dataSource: this.props.dataSource,
|
|
218
|
-
locale: this.context
|
|
218
|
+
locale: this.context,
|
|
219
219
|
onHide: () => this.setState({ legendHidden: true }),
|
|
220
220
|
zoom: null
|
|
221
221
|
})
|
|
@@ -277,7 +277,7 @@ interface ServerMapLayerPopupWidgetDataSourceOptions {
|
|
|
277
277
|
mapId: string
|
|
278
278
|
|
|
279
279
|
/** revision to use to allow caching */
|
|
280
|
-
rev:
|
|
280
|
+
rev: number
|
|
281
281
|
|
|
282
282
|
/** Layer id to use */
|
|
283
283
|
layerId: string
|
|
@@ -304,7 +304,7 @@ class ServerMapLayerPopupWidgetDataSource implements WidgetDataSource {
|
|
|
304
304
|
// Get the data that the widget needs. The widget should implement getData method (see above) to get the actual data on the server
|
|
305
305
|
// filters: array of filters to apply. Each is { table: table id, jsonql: jsonql condition with {alias} for tableAlias. Use injectAlias to correct
|
|
306
306
|
// callback: (error, data)
|
|
307
|
-
getData(design: any, filters: JsonQLFilter[], callback: (error: any, data?: any) => void) {
|
|
307
|
+
getData(design: any, filters: JsonQLFilter[], callback: (error: any, data?: any) => void): void {
|
|
308
308
|
const query = {
|
|
309
309
|
client: this.options.client,
|
|
310
310
|
share: this.options.share,
|
|
@@ -317,11 +317,11 @@ class ServerMapLayerPopupWidgetDataSource implements WidgetDataSource {
|
|
|
317
317
|
`maps/${this.options.mapId}/layers/${this.options.layerId}/widgets/${this.options.popupWidgetId}/data?` +
|
|
318
318
|
querystring.stringify(query)
|
|
319
319
|
|
|
320
|
-
|
|
321
|
-
|
|
320
|
+
$.getJSON(url, (data: any) => {
|
|
321
|
+
callback(null, data)
|
|
322
322
|
}).fail((xhr: any) => {
|
|
323
323
|
console.log(xhr.responseText)
|
|
324
|
-
|
|
324
|
+
callback(new Error(xhr.responseText))
|
|
325
325
|
})
|
|
326
326
|
}
|
|
327
327
|
|
|
@@ -388,11 +388,11 @@ class ServerQuickfilterDataSource implements QuickfiltersDataSource {
|
|
|
388
388
|
headers
|
|
389
389
|
})
|
|
390
390
|
.done((data: any) => {
|
|
391
|
-
|
|
391
|
+
callback(null, data)
|
|
392
392
|
})
|
|
393
393
|
.fail((xhr: any) => {
|
|
394
394
|
console.log(xhr.responseText)
|
|
395
|
-
|
|
395
|
+
callback(new Error(xhr.responseText))
|
|
396
396
|
})
|
|
397
397
|
}
|
|
398
398
|
}
|
|
@@ -505,7 +505,7 @@ export function VectorMapViewComponent(props: {
|
|
|
505
505
|
setBusy(b => b - 1)
|
|
506
506
|
|
|
507
507
|
if (bounds) {
|
|
508
|
-
map!.fitBounds([bounds.w, bounds.s, bounds.e, bounds.n], { padding:
|
|
508
|
+
map!.fitBounds([bounds.w, bounds.s, bounds.e, bounds.n], { padding: 30, duration: 2500 })
|
|
509
509
|
|
|
510
510
|
// Also record if editable as part of bounds
|
|
511
511
|
setBounds(bounds)
|
|
@@ -541,6 +541,7 @@ export function VectorMapViewComponent(props: {
|
|
|
541
541
|
props.design.bounds.w != boundsRef.current.w
|
|
542
542
|
) {
|
|
543
543
|
map.fitBounds([props.design.bounds.w, props.design.bounds.s, props.design.bounds.e, props.design.bounds.n])
|
|
544
|
+
boundsRef.current = props.design.bounds
|
|
544
545
|
}
|
|
545
546
|
}
|
|
546
547
|
}, [map, props.design.autoBounds, props.design.bounds])
|
package/src/maps/mapSymbols.ts
CHANGED
|
@@ -45,6 +45,7 @@ import chevron_circle_down from "./symbols/font-awesome/chevron-circle-down.png"
|
|
|
45
45
|
import medkit from "./symbols/font-awesome/medkit.png"
|
|
46
46
|
import cloud from "./symbols/font-awesome/cloud.png"
|
|
47
47
|
import beer from "./symbols/font-awesome/beer.png"
|
|
48
|
+
import cloud_rain from "./symbols/font-awesome/cloud-rain.png"
|
|
48
49
|
|
|
49
50
|
/** Symbols used on the map */
|
|
50
51
|
export const mapSymbols: { value: string; label: string; url: string }[] = [
|
|
@@ -158,5 +159,6 @@ export const mapSymbols: { value: string; label: string; url: string }[] = [
|
|
|
158
159
|
},
|
|
159
160
|
{ url: medkit, value: "font-awesome/medkit", label: "Medkit" },
|
|
160
161
|
{ url: cloud, value: "font-awesome/cloud", label: "Cloud" },
|
|
162
|
+
{ url: cloud_rain, value: "font-awesome/cloud-rain", label: "Cloud Rain" },
|
|
161
163
|
{ url: beer, value: "font-awesome/beer", label: "Cup" }
|
|
162
164
|
]
|
|
Binary file
|