@mwater/visualization 5.2.0 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +8 -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 +379 -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/lib/maps/BingLayer.js
CHANGED
|
@@ -67,34 +67,24 @@ module.exports = leaflet_1.default.TileLayer.extend({
|
|
|
67
67
|
},
|
|
68
68
|
loadMetadata: function () {
|
|
69
69
|
var _this = this;
|
|
70
|
-
var
|
|
71
|
-
|
|
70
|
+
var url = `https://dev.virtualearth.net/REST/v1/Imagery/Metadata/${this.options.type}?include=ImageryProviders&key=${this._key}&UriScheme=https`;
|
|
71
|
+
fetch(url)
|
|
72
|
+
.then(response => response.json())
|
|
73
|
+
.then(meta => {
|
|
72
74
|
_this.meta = meta;
|
|
73
|
-
window[cbid] = undefined;
|
|
74
|
-
var e = document.getElementById(cbid);
|
|
75
|
-
e.parentNode.removeChild(e);
|
|
76
75
|
if (meta.errorDetails) {
|
|
77
76
|
return;
|
|
78
77
|
}
|
|
79
78
|
_this.initMetadata();
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
"//dev.virtualearth.net/REST/v1/Imagery/Metadata/" +
|
|
83
|
-
this.options.type +
|
|
84
|
-
"?include=ImageryProviders&jsonp=" +
|
|
85
|
-
cbid +
|
|
86
|
-
"&key=" +
|
|
87
|
-
this._key +
|
|
88
|
-
"&UriScheme=" +
|
|
89
|
-
document.location.protocol.slice(0, -1);
|
|
90
|
-
var script = document.createElement("script");
|
|
91
|
-
script.type = "text/javascript";
|
|
92
|
-
script.src = url;
|
|
93
|
-
script.id = cbid;
|
|
94
|
-
document.getElementsByTagName("head")[0].appendChild(script);
|
|
79
|
+
})
|
|
80
|
+
.catch(error => console.error('Error loading Bing Maps metadata:', error));
|
|
95
81
|
},
|
|
96
82
|
initMetadata: function () {
|
|
97
83
|
var r = this.meta.resourceSets[0].resources[0];
|
|
84
|
+
if (!r) {
|
|
85
|
+
console.error("Error loading Bing Maps metadata");
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
98
88
|
this.options.subdomains = r.imageUrlSubdomains;
|
|
99
89
|
this._url = r.imageUrl;
|
|
100
90
|
this._providers = [];
|
package/lib/maps/BufferLayer.js
CHANGED
|
@@ -36,6 +36,7 @@ const mapboxUtils_1 = require("./mapboxUtils");
|
|
|
36
36
|
const LayerLegendComponent_1 = __importDefault(require("./LayerLegendComponent"));
|
|
37
37
|
const PopupFilterJoinsUtils = __importStar(require("./PopupFilterJoinsUtils"));
|
|
38
38
|
const HoverContent_1 = __importDefault(require("./HoverContent"));
|
|
39
|
+
const layoutOptions_1 = require("../dashboards/layoutOptions");
|
|
39
40
|
/*
|
|
40
41
|
Layer which draws a buffer around geometries (i.e. a radius circle around points)
|
|
41
42
|
|
|
@@ -610,7 +611,7 @@ marker-fill: ` +
|
|
|
610
611
|
const WidgetFactory = require("../widgets/WidgetFactory").default;
|
|
611
612
|
results.popup = new BlocksLayoutManager().renderLayout({
|
|
612
613
|
items: clickOptions.design.popup.items,
|
|
613
|
-
|
|
614
|
+
layoutOptions: (0, layoutOptions_1.getDefaultLayoutOptions)("default"),
|
|
614
615
|
renderWidget: (options) => {
|
|
615
616
|
const widget = WidgetFactory.createWidget(options.type);
|
|
616
617
|
const filters = clickOptions.filters.concat(popupFilters);
|
|
@@ -36,6 +36,7 @@ const mapboxUtils_1 = require("./mapboxUtils");
|
|
|
36
36
|
const LayerLegendComponent_1 = __importDefault(require("./LayerLegendComponent"));
|
|
37
37
|
const PopupFilterJoinsUtils = __importStar(require("./PopupFilterJoinsUtils"));
|
|
38
38
|
const HoverContent_1 = __importDefault(require("./HoverContent"));
|
|
39
|
+
const layoutOptions_1 = require("../dashboards/layoutOptions");
|
|
39
40
|
class ChoroplethLayer extends Layer_1.default {
|
|
40
41
|
/** Gets the type of layer definition */
|
|
41
42
|
getLayerDefinitionType() {
|
|
@@ -1213,7 +1214,7 @@ class ChoroplethLayer extends Layer_1.default {
|
|
|
1213
1214
|
const WidgetFactory = require("../widgets/WidgetFactory").default;
|
|
1214
1215
|
results.popup = new BlocksLayoutManager().renderLayout({
|
|
1215
1216
|
items: clickOptions.design.popup.items,
|
|
1216
|
-
|
|
1217
|
+
layoutOptions: (0, layoutOptions_1.getDefaultLayoutOptions)("default"),
|
|
1217
1218
|
renderWidget: (options) => {
|
|
1218
1219
|
const widget = WidgetFactory.createWidget(options.type);
|
|
1219
1220
|
// Create filters for single row
|
|
@@ -4,7 +4,7 @@ import { MapDesign } from "./MapDesign";
|
|
|
4
4
|
import { MapDataSource } from "./MapDataSource";
|
|
5
5
|
import { VectorTileCTE, VectorTileSourceLayer } from "./Layer";
|
|
6
6
|
import { MapLayerDataSource } from "./MapLayerDataSource";
|
|
7
|
-
interface DirectMapDataSourceOptions {
|
|
7
|
+
export interface DirectMapDataSourceOptions {
|
|
8
8
|
/** schema to use */
|
|
9
9
|
schema: Schema;
|
|
10
10
|
/** general data source */
|
|
@@ -15,6 +15,8 @@ interface DirectMapDataSourceOptions {
|
|
|
15
15
|
apiUrl: string;
|
|
16
16
|
/** client id to use for talking to mWater server */
|
|
17
17
|
client?: string;
|
|
18
|
+
/** Origin to which server time is recorded e.g. maps:232434... */
|
|
19
|
+
origin?: string;
|
|
18
20
|
}
|
|
19
21
|
export default class DirectMapDataSource implements MapDataSource {
|
|
20
22
|
options: DirectMapDataSourceOptions;
|
|
@@ -49,6 +51,8 @@ export interface VectorTileDirectTokenRequest {
|
|
|
49
51
|
minZoom?: number;
|
|
50
52
|
/** Enforced maximum zoom level */
|
|
51
53
|
maxZoom?: number;
|
|
54
|
+
/** Origin to which server time is recorded */
|
|
55
|
+
origin?: string;
|
|
52
56
|
}
|
|
53
57
|
/**
|
|
54
58
|
* React hook to get a direct URL for a vector tile source.
|
|
@@ -65,4 +69,3 @@ export declare function useDirectVectorTileUrl(options: {
|
|
|
65
69
|
/** Request to make for tiles */
|
|
66
70
|
directTokenRequest: VectorTileDirectTokenRequest;
|
|
67
71
|
}): string | null;
|
|
68
|
-
export {};
|
|
@@ -152,7 +152,8 @@ class DirectLayerDataSource {
|
|
|
152
152
|
maxZoom: vectorTile.maxZoom,
|
|
153
153
|
createdAfter: createdAfter,
|
|
154
154
|
// 12 hours
|
|
155
|
-
expiresAfter: new Date(Date.now() + 1000 * 3600 * 12).toISOString()
|
|
155
|
+
expiresAfter: new Date(Date.now() + 1000 * 3600 * 12).toISOString(),
|
|
156
|
+
origin: this.options.origin
|
|
156
157
|
};
|
|
157
158
|
const { url, expires } = await getVectorTileFromDirectRequest({
|
|
158
159
|
apiUrl: this.options.apiUrl,
|
|
@@ -11,6 +11,7 @@ const BlocksLayoutManager_1 = __importDefault(require("../layouts/blocks/BlocksL
|
|
|
11
11
|
const WidgetFactory_1 = __importDefault(require("../widgets/WidgetFactory"));
|
|
12
12
|
const DirectWidgetDataSource_1 = __importDefault(require("../widgets/DirectWidgetDataSource"));
|
|
13
13
|
const PopupFilterJoinsEditComponent_1 = __importDefault(require("./PopupFilterJoinsEditComponent"));
|
|
14
|
+
const layoutOptions_1 = require("../dashboards/layoutOptions");
|
|
14
15
|
// Modal for editing design of popup
|
|
15
16
|
class EditPopupComponent extends react_1.default.Component {
|
|
16
17
|
constructor(props) {
|
|
@@ -44,7 +45,7 @@ class EditPopupComponent extends react_1.default.Component {
|
|
|
44
45
|
: undefined, this.state.editing
|
|
45
46
|
? R(ModalWindowComponent_1.default, { isOpen: true, onRequestClose: () => this.setState({ editing: false }) }, new BlocksLayoutManager_1.default().renderLayout({
|
|
46
47
|
items: this.props.design.popup?.items,
|
|
47
|
-
|
|
48
|
+
layoutOptions: (0, layoutOptions_1.getDefaultLayoutOptions)("default"),
|
|
48
49
|
onItemsChange: this.handleItemsChange,
|
|
49
50
|
disableMaps: true,
|
|
50
51
|
renderWidget: (options) => {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import PropTypes from "prop-types";
|
|
2
1
|
import React, { ReactNode } from "react";
|
|
3
2
|
import AutoSizeComponent from "@mwater/react-library/lib/AutoSizeComponent";
|
|
4
3
|
import UndoStack from "../UndoStack";
|
|
@@ -40,9 +39,7 @@ interface MapComponentState {
|
|
|
40
39
|
}
|
|
41
40
|
/** Map with designer on right */
|
|
42
41
|
export default class MapComponent extends React.Component<MapComponentProps, MapComponentState> {
|
|
43
|
-
static
|
|
44
|
-
locale: PropTypes.Requireable<string>;
|
|
45
|
-
};
|
|
42
|
+
static contextType: React.Context<string>;
|
|
46
43
|
constructor(props: MapComponentProps);
|
|
47
44
|
componentDidUpdate(prevProps: MapComponentProps): void;
|
|
48
45
|
handleUndo: () => void;
|
package/lib/maps/MapComponent.js
CHANGED
|
@@ -3,7 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const prop_types_1 = __importDefault(require("prop-types"));
|
|
7
6
|
const lodash_1 = __importDefault(require("lodash"));
|
|
8
7
|
const react_1 = __importDefault(require("react"));
|
|
9
8
|
const R = react_1.default.createElement;
|
|
@@ -16,9 +15,10 @@ const PopoverHelpComponent_1 = __importDefault(require("@mwater/react-library/li
|
|
|
16
15
|
const QuickfilterCompiler_1 = __importDefault(require("../quickfilter/QuickfilterCompiler"));
|
|
17
16
|
const QuickfiltersComponent_1 = __importDefault(require("../quickfilter/QuickfiltersComponent"));
|
|
18
17
|
const MapUtils_1 = require("./MapUtils");
|
|
18
|
+
const contexts_1 = require("@mwater/expressions-ui/lib/contexts");
|
|
19
19
|
/** Map with designer on right */
|
|
20
20
|
class MapComponent extends react_1.default.Component {
|
|
21
|
-
static
|
|
21
|
+
static contextType = contexts_1.LocaleContext;
|
|
22
22
|
constructor(props) {
|
|
23
23
|
super(props);
|
|
24
24
|
this.state = {
|
|
@@ -125,7 +125,7 @@ class MapComponent extends react_1.default.Component {
|
|
|
125
125
|
zoomLocked: this.state.zoomLocked,
|
|
126
126
|
onRowClick: this.props.onRowClick,
|
|
127
127
|
extraFilters: filters,
|
|
128
|
-
locale: this.context
|
|
128
|
+
locale: this.context,
|
|
129
129
|
width: size.width,
|
|
130
130
|
height: size.height
|
|
131
131
|
});
|
package/lib/maps/MarkersLayer.js
CHANGED
|
@@ -37,6 +37,7 @@ const mapboxUtils_1 = require("./mapboxUtils");
|
|
|
37
37
|
const LayerLegendComponent_1 = __importDefault(require("./LayerLegendComponent"));
|
|
38
38
|
const PopupFilterJoinsUtils = __importStar(require("./PopupFilterJoinsUtils"));
|
|
39
39
|
const HoverContent_1 = __importDefault(require("./HoverContent"));
|
|
40
|
+
const layoutOptions_1 = require("../dashboards/layoutOptions");
|
|
40
41
|
class MarkersLayer extends Layer_1.default {
|
|
41
42
|
/** Gets the type of layer definition */
|
|
42
43
|
getLayerDefinitionType() {
|
|
@@ -71,11 +72,7 @@ class MarkersLayer extends Layer_1.default {
|
|
|
71
72
|
"fill-color": color,
|
|
72
73
|
"fill-opacity": (design.polygonFillOpacity ?? 0.25) * opacity
|
|
73
74
|
},
|
|
74
|
-
filter: addFilter([
|
|
75
|
-
"any",
|
|
76
|
-
["==", ["geometry-type"], "Polygon"],
|
|
77
|
-
["==", ["geometry-type"], "MultiPolygon"]
|
|
78
|
-
])
|
|
75
|
+
filter: addFilter(["any", ["==", ["geometry-type"], "Polygon"], ["==", ["geometry-type"], "MultiPolygon"]])
|
|
79
76
|
});
|
|
80
77
|
// Add polygon outlines and lines
|
|
81
78
|
mapLayers.push({
|
|
@@ -88,11 +85,7 @@ class MarkersLayer extends Layer_1.default {
|
|
|
88
85
|
"line-width": design.lineWidth != null ? design.lineWidth : 3,
|
|
89
86
|
"line-opacity": opacity
|
|
90
87
|
},
|
|
91
|
-
filter: addFilter([
|
|
92
|
-
"any",
|
|
93
|
-
["==", ["geometry-type"], "Polygon"],
|
|
94
|
-
["==", ["geometry-type"], "MultiPolygon"]
|
|
95
|
-
])
|
|
88
|
+
filter: addFilter(["any", ["==", ["geometry-type"], "Polygon"], ["==", ["geometry-type"], "MultiPolygon"]])
|
|
96
89
|
});
|
|
97
90
|
// Add lines
|
|
98
91
|
mapLayers.push({
|
|
@@ -105,11 +98,7 @@ class MarkersLayer extends Layer_1.default {
|
|
|
105
98
|
"line-width": design.lineWidth != null ? design.lineWidth : 3,
|
|
106
99
|
"line-opacity": opacity
|
|
107
100
|
},
|
|
108
|
-
filter: addFilter([
|
|
109
|
-
"any",
|
|
110
|
-
["==", ["geometry-type"], "LineString"],
|
|
111
|
-
["==", ["geometry-type"], "MultiLineString"]
|
|
112
|
-
])
|
|
101
|
+
filter: addFilter(["any", ["==", ["geometry-type"], "LineString"], ["==", ["geometry-type"], "MultiLineString"]])
|
|
113
102
|
});
|
|
114
103
|
if (!design.symbol) {
|
|
115
104
|
mapLayers.push({
|
|
@@ -165,7 +154,7 @@ class MarkersLayer extends Layer_1.default {
|
|
|
165
154
|
const exprCompiler = new expressions_1.ExprCompiler(schema);
|
|
166
155
|
// Compile geometry axis
|
|
167
156
|
const geometryExpr = axisBuilder.compileAxis({ axis: design.axes.geometry, tableAlias: "basequery" });
|
|
168
|
-
// Select _id, location
|
|
157
|
+
// Select _id, location
|
|
169
158
|
const basequery = {
|
|
170
159
|
type: "query",
|
|
171
160
|
selects: [
|
|
@@ -174,7 +163,7 @@ class MarkersLayer extends Layer_1.default {
|
|
|
174
163
|
expr: { type: "field", tableAlias: "basequery", column: schema.getTable(design.table).primaryKey },
|
|
175
164
|
alias: "id"
|
|
176
165
|
},
|
|
177
|
-
{ type: "select", expr: geometryExpr, alias: "the_geom_webmercator" }
|
|
166
|
+
{ type: "select", expr: geometryExpr, alias: "the_geom_webmercator" } // geometry as the_geom_webmercator
|
|
178
167
|
],
|
|
179
168
|
from: exprCompiler.compileTable(design.table, "basequery")
|
|
180
169
|
};
|
|
@@ -440,7 +429,7 @@ line-width: ` +
|
|
|
440
429
|
JSON.stringify(item.value) +
|
|
441
430
|
"][geometry_type='ST_Polygon'],#layer0[color=" +
|
|
442
431
|
JSON.stringify(item.value) +
|
|
443
|
-
`][geometry_type='ST_MultiPolygon'] {
|
|
432
|
+
`][geometry_type='ST_MultiPolygon'] {
|
|
444
433
|
polygon-fill: ` +
|
|
445
434
|
item.color +
|
|
446
435
|
`;\
|
|
@@ -459,15 +448,25 @@ ${design.polygonBorderColor ? "line-color: " + design.polygonBorderColor + ";" :
|
|
|
459
448
|
const results = {};
|
|
460
449
|
// Popup
|
|
461
450
|
if (hoverOptions.design.hoverOver) {
|
|
462
|
-
|
|
463
|
-
const popupFilterJoins = hoverOptions.design.popupFilterJoins || PopupFilterJoinsUtils.createDefaultPopupFilterJoins(table);
|
|
464
|
-
const popupFilters = PopupFilterJoinsUtils.createPopupFilters(popupFilterJoins, hoverOptions.schema, table, ev.data.id);
|
|
451
|
+
const exprCompiler = new expressions_1.ExprCompiler(hoverOptions.schema);
|
|
465
452
|
results.hoverOver = react_1.default.createElement(HoverContent_1.default, {
|
|
466
453
|
key: ev.data.id,
|
|
467
454
|
schema: hoverOptions.schema,
|
|
468
455
|
dataSource: hoverOptions.dataSource,
|
|
469
456
|
design: hoverOptions.design,
|
|
470
|
-
filters:
|
|
457
|
+
filters: [
|
|
458
|
+
{
|
|
459
|
+
table,
|
|
460
|
+
jsonql: {
|
|
461
|
+
type: "op",
|
|
462
|
+
op: "=",
|
|
463
|
+
exprs: [
|
|
464
|
+
exprCompiler.compileExpr({ expr: { type: "id", table }, tableAlias: "{alias}" }),
|
|
465
|
+
{ type: "literal", value: ev.data.id }
|
|
466
|
+
]
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
]
|
|
471
470
|
});
|
|
472
471
|
}
|
|
473
472
|
return results;
|
|
@@ -543,7 +542,7 @@ ${design.polygonBorderColor ? "line-color: " + design.polygonBorderColor + ";" :
|
|
|
543
542
|
const WidgetFactory = require("../widgets/WidgetFactory").default;
|
|
544
543
|
results.popup = new BlocksLayoutManager().renderLayout({
|
|
545
544
|
items: clickOptions.design.popup.items,
|
|
546
|
-
|
|
545
|
+
layoutOptions: (0, layoutOptions_1.getDefaultLayoutOptions)("default"),
|
|
547
546
|
renderWidget: (options) => {
|
|
548
547
|
const widget = WidgetFactory.createWidget(options.type);
|
|
549
548
|
const filters = clickOptions.filters.concat(popupFilters);
|
|
@@ -806,7 +805,13 @@ function createMarkersVectorQuery(baseQuery) {
|
|
|
806
805
|
}
|
|
807
806
|
});
|
|
808
807
|
// Bubble up selects that are not cluster or geometry to the outer query
|
|
809
|
-
const innerSelects = baseQuery.selects
|
|
808
|
+
const innerSelects = baseQuery.selects
|
|
809
|
+
.filter(select => select.alias !== "the_geom_webmercator")
|
|
810
|
+
.map(select => ({
|
|
811
|
+
type: "select",
|
|
812
|
+
expr: { type: "field", tableAlias: "innerquery", column: select.alias },
|
|
813
|
+
alias: select.alias
|
|
814
|
+
}));
|
|
810
815
|
// Create outer query which takes where r <= 3 to limit # of points in a cluster
|
|
811
816
|
// Wrap geometry in ST_Force2D to avoid https://trac.osgeo.org/postgis/ticket/4690 (https://github.com/mWater/mwater-server/issues/495)
|
|
812
817
|
const outerquery = {
|
|
@@ -828,7 +833,7 @@ function createMarkersVectorQuery(baseQuery) {
|
|
|
828
833
|
]
|
|
829
834
|
},
|
|
830
835
|
alias: "the_geom_webmercator"
|
|
831
|
-
}
|
|
836
|
+
} // innerquery.the_geom_webmercator as the_geom_webmercator
|
|
832
837
|
],
|
|
833
838
|
from: { type: "subquery", query: innerquery, alias: "innerquery" },
|
|
834
839
|
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 React, { ReactNode } from "react";
|
|
3
2
|
import LeafletMapComponent from "./LeafletMapComponent";
|
|
4
3
|
import { Schema, DataSource } from "@mwater/expressions";
|
|
@@ -43,9 +42,7 @@ export default class RasterMapViewComponent extends React.Component<RasterMapVie
|
|
|
43
42
|
popupContents: ReactNode;
|
|
44
43
|
legendHidden: boolean;
|
|
45
44
|
}> {
|
|
46
|
-
static
|
|
47
|
-
locale: PropTypes.Requireable<string>;
|
|
48
|
-
};
|
|
45
|
+
static contextType: React.Context<string>;
|
|
49
46
|
leafletMap?: LeafletMapComponent | null;
|
|
50
47
|
constructor(props: any);
|
|
51
48
|
componentDidMount(): void;
|
|
@@ -26,7 +26,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
const prop_types_1 = __importDefault(require("prop-types"));
|
|
30
29
|
const lodash_1 = __importDefault(require("lodash"));
|
|
31
30
|
const react_1 = __importDefault(require("react"));
|
|
32
31
|
const R = react_1.default.createElement;
|
|
@@ -36,9 +35,10 @@ const ModalPopupComponent_1 = __importDefault(require("@mwater/react-library/lib
|
|
|
36
35
|
const MapUtils = __importStar(require("./MapUtils"));
|
|
37
36
|
const LayerSwitcherComponent_1 = require("./LayerSwitcherComponent");
|
|
38
37
|
const LegendComponent_1 = __importDefault(require("./LegendComponent"));
|
|
38
|
+
const contexts_1 = require("@mwater/expressions-ui/lib/contexts");
|
|
39
39
|
/** Component that displays just the map, using raster tile technology */
|
|
40
40
|
class RasterMapViewComponent extends react_1.default.Component {
|
|
41
|
-
static
|
|
41
|
+
static contextType = contexts_1.LocaleContext;
|
|
42
42
|
leafletMap;
|
|
43
43
|
constructor(props) {
|
|
44
44
|
super(props);
|
|
@@ -154,7 +154,7 @@ class RasterMapViewComponent extends react_1.default.Component {
|
|
|
154
154
|
layerViews: this.props.design.layerViews,
|
|
155
155
|
filters: this.getCompiledFilters(),
|
|
156
156
|
dataSource: this.props.dataSource,
|
|
157
|
-
locale: this.context
|
|
157
|
+
locale: this.context,
|
|
158
158
|
onHide: () => this.setState({ legendHidden: true }),
|
|
159
159
|
zoom: null
|
|
160
160
|
});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="jquery" />
|
|
2
1
|
import { DataSource, Expr, Schema } from "@mwater/expressions";
|
|
3
2
|
import { JsonQLFilter } from "../JsonQLFilter";
|
|
4
3
|
import { MapDesign, MapLayerView } from "./MapDesign";
|
|
@@ -66,7 +65,7 @@ interface ServerMapLayerPopupWidgetDataSourceOptions {
|
|
|
66
65
|
/** map id to use on server */
|
|
67
66
|
mapId: string;
|
|
68
67
|
/** revision to use to allow caching */
|
|
69
|
-
rev:
|
|
68
|
+
rev: number;
|
|
70
69
|
/** Layer id to use */
|
|
71
70
|
layerId: string;
|
|
72
71
|
/** Popup widget id to use */
|
|
@@ -75,7 +74,7 @@ interface ServerMapLayerPopupWidgetDataSourceOptions {
|
|
|
75
74
|
declare class ServerMapLayerPopupWidgetDataSource implements WidgetDataSource {
|
|
76
75
|
options: ServerMapLayerPopupWidgetDataSourceOptions;
|
|
77
76
|
constructor(options: ServerMapLayerPopupWidgetDataSourceOptions);
|
|
78
|
-
getData(design: any, filters: JsonQLFilter[], callback: (error: any, data?: any) => void):
|
|
77
|
+
getData(design: any, filters: JsonQLFilter[], callback: (error: any, data?: any) => void): void;
|
|
79
78
|
getImageUrl(imageId: string, height?: number): string;
|
|
80
79
|
}
|
|
81
80
|
declare class ServerQuickfilterDataSource implements QuickfiltersDataSource {
|
|
@@ -208,11 +208,11 @@ class ServerMapLayerPopupWidgetDataSource {
|
|
|
208
208
|
const url = this.options.apiUrl +
|
|
209
209
|
`maps/${this.options.mapId}/layers/${this.options.layerId}/widgets/${this.options.popupWidgetId}/data?` +
|
|
210
210
|
querystring_1.default.stringify(query);
|
|
211
|
-
|
|
212
|
-
|
|
211
|
+
jquery_1.default.getJSON(url, (data) => {
|
|
212
|
+
callback(null, data);
|
|
213
213
|
}).fail((xhr) => {
|
|
214
214
|
console.log(xhr.responseText);
|
|
215
|
-
|
|
215
|
+
callback(new Error(xhr.responseText));
|
|
216
216
|
});
|
|
217
217
|
}
|
|
218
218
|
// Get the url to download an image (by id from an image or imagelist column)
|
|
@@ -263,11 +263,11 @@ class ServerQuickfilterDataSource {
|
|
|
263
263
|
headers
|
|
264
264
|
})
|
|
265
265
|
.done((data) => {
|
|
266
|
-
|
|
266
|
+
callback(null, data);
|
|
267
267
|
})
|
|
268
268
|
.fail((xhr) => {
|
|
269
269
|
console.log(xhr.responseText);
|
|
270
|
-
|
|
270
|
+
callback(new Error(xhr.responseText));
|
|
271
271
|
});
|
|
272
272
|
}
|
|
273
273
|
}
|
|
@@ -391,7 +391,7 @@ function VectorMapViewComponent(props) {
|
|
|
391
391
|
props.mapDataSource.getBounds(props.design, getCompiledFilters(), (error, bounds) => {
|
|
392
392
|
setBusy(b => b - 1);
|
|
393
393
|
if (bounds) {
|
|
394
|
-
map.fitBounds([bounds.w, bounds.s, bounds.e, bounds.n], { padding:
|
|
394
|
+
map.fitBounds([bounds.w, bounds.s, bounds.e, bounds.n], { padding: 30, duration: 2500 });
|
|
395
395
|
// Also record if editable as part of bounds
|
|
396
396
|
setBounds(bounds);
|
|
397
397
|
}
|
|
@@ -420,6 +420,7 @@ function VectorMapViewComponent(props) {
|
|
|
420
420
|
props.design.bounds.s != boundsRef.current.s ||
|
|
421
421
|
props.design.bounds.w != boundsRef.current.w) {
|
|
422
422
|
map.fitBounds([props.design.bounds.w, props.design.bounds.s, props.design.bounds.e, props.design.bounds.n]);
|
|
423
|
+
boundsRef.current = props.design.bounds;
|
|
423
424
|
}
|
|
424
425
|
}
|
|
425
426
|
}, [map, props.design.autoBounds, props.design.bounds]);
|
package/lib/maps/mapSymbols.js
CHANGED
|
@@ -51,6 +51,7 @@ const chevron_circle_down_png_1 = __importDefault(require("./symbols/font-awesom
|
|
|
51
51
|
const medkit_png_1 = __importDefault(require("./symbols/font-awesome/medkit.png"));
|
|
52
52
|
const cloud_png_1 = __importDefault(require("./symbols/font-awesome/cloud.png"));
|
|
53
53
|
const beer_png_1 = __importDefault(require("./symbols/font-awesome/beer.png"));
|
|
54
|
+
const cloud_rain_png_1 = __importDefault(require("./symbols/font-awesome/cloud-rain.png"));
|
|
54
55
|
/** Symbols used on the map */
|
|
55
56
|
exports.mapSymbols = [
|
|
56
57
|
{
|
|
@@ -163,5 +164,6 @@ exports.mapSymbols = [
|
|
|
163
164
|
},
|
|
164
165
|
{ url: medkit_png_1.default, value: "font-awesome/medkit", label: "Medkit" },
|
|
165
166
|
{ url: cloud_png_1.default, value: "font-awesome/cloud", label: "Cloud" },
|
|
167
|
+
{ url: cloud_rain_png_1.default, value: "font-awesome/cloud-rain", label: "Cloud Rain" },
|
|
166
168
|
{ url: beer_png_1.default, value: "font-awesome/beer", label: "Cup" }
|
|
167
169
|
];
|
|
Binary file
|
package/lib/maps/vectorMaps.js
CHANGED
|
@@ -71,58 +71,64 @@ function useVectorMap(options) {
|
|
|
71
71
|
if (!mapDivVisible || !divRef) {
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
[
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
m.
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
74
|
+
try {
|
|
75
|
+
const m = new maplibre_gl_1.default.Map({
|
|
76
|
+
container: divRef,
|
|
77
|
+
bounds: bounds,
|
|
78
|
+
scrollZoom: scrollZoom === false ? false : true,
|
|
79
|
+
dragPan: dragPan === false ? false : true,
|
|
80
|
+
touchZoomRotate: touchZoomRotate === false ? false : true,
|
|
81
|
+
attributionControl: false,
|
|
82
|
+
boxZoom: false,
|
|
83
|
+
style: {
|
|
84
|
+
version: 8,
|
|
85
|
+
layers: [],
|
|
86
|
+
sources: {}
|
|
87
|
+
},
|
|
88
|
+
// Prevent scrolling outside of world bounds
|
|
89
|
+
maxBounds: [
|
|
90
|
+
[-179.9, -85],
|
|
91
|
+
[179.9, 85] // Northeast coordinates
|
|
92
|
+
],
|
|
93
|
+
preserveDrawingBuffer: printingModeEnabled
|
|
94
|
+
});
|
|
95
|
+
setHasWebGLContext(true);
|
|
96
|
+
// Add listener for losing context
|
|
97
|
+
m.on("webglcontextlost", () => {
|
|
98
|
+
console.warn("Lost WebGL context");
|
|
99
|
+
setHasWebGLContext(false);
|
|
100
|
+
});
|
|
101
|
+
// Add zoom controls to the map.
|
|
102
|
+
m.addControl(new maplibre_gl_1.default.NavigationControl({}), "top-left");
|
|
103
|
+
// Add scale control
|
|
104
|
+
const scale = new maplibre_gl_1.default.ScaleControl({
|
|
105
|
+
unit: "metric"
|
|
106
|
+
});
|
|
107
|
+
m.addControl(scale);
|
|
108
|
+
// Speed up wheel scrolling
|
|
109
|
+
m.scrollZoom.setWheelZoomRate(1 / 250);
|
|
110
|
+
// Dynamically load symbols
|
|
111
|
+
m.on("styleimagemissing", function (ev) {
|
|
112
|
+
// Check if known
|
|
113
|
+
const mapSymbol = mapSymbols_1.mapSymbols.find((s) => s.value == ev.id);
|
|
114
|
+
if (mapSymbol) {
|
|
115
|
+
m.loadImage(mapSymbol.url, (err, image) => {
|
|
116
|
+
if (image && !m.hasImage(mapSymbol.value)) {
|
|
117
|
+
m.addImage(mapSymbol.value, image, { sdf: true });
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
setMap(m);
|
|
123
|
+
return () => {
|
|
124
|
+
m.remove();
|
|
125
|
+
setHasWebGLContext(false);
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
catch (e) {
|
|
129
|
+
console.error("Error loading map", e);
|
|
130
|
+
alert(T `Error loading map. Please check that your browser and drivers are updated.`);
|
|
131
|
+
}
|
|
126
132
|
}, [mapReloadCount]);
|
|
127
133
|
return map;
|
|
128
134
|
}
|
|
@@ -191,13 +197,13 @@ function useBaseStyle(baseLayer) {
|
|
|
191
197
|
});
|
|
192
198
|
}
|
|
193
199
|
if (baseLayer == "cartodb_positron") {
|
|
194
|
-
loadStyle(`https://api.maptiler.com/maps/
|
|
200
|
+
loadStyle(`https://api.maptiler.com/maps/5f972163-6078-4341-982a-5c8bc4447e68/style.json?key=${mapTilerApiKey}`);
|
|
195
201
|
}
|
|
196
202
|
else if (baseLayer == "cartodb_dark_matter") {
|
|
197
|
-
loadStyle(`https://api.maptiler.com/maps/
|
|
203
|
+
loadStyle(`https://api.maptiler.com/maps/1d3e957b-c546-4791-b9de-dce203538429/style.json?key=${mapTilerApiKey}`);
|
|
198
204
|
}
|
|
199
205
|
else if (baseLayer == "bing_road") {
|
|
200
|
-
loadStyle(`https://api.maptiler.com/maps/streets/style.json?key=${mapTilerApiKey}`);
|
|
206
|
+
loadStyle(`https://api.maptiler.com/maps/streets-v2/style.json?key=${mapTilerApiKey}`);
|
|
201
207
|
}
|
|
202
208
|
else if (baseLayer == "bing_aerial") {
|
|
203
209
|
// Switched to Bing for superior aerial imagery
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import PropTypes from "prop-types";
|
|
2
1
|
import React from "react";
|
|
3
2
|
import { DataSource, LocalizedString, Schema } from "@mwater/expressions";
|
|
4
3
|
import IdArrayQuickfilterComponent from "./IdArrayQuickfilterComponent";
|
|
@@ -52,9 +51,7 @@ interface EnumQuickfilterComponentProps {
|
|
|
52
51
|
}
|
|
53
52
|
/** Quickfilter for an enum */
|
|
54
53
|
declare class EnumQuickfilterComponent extends React.Component<EnumQuickfilterComponentProps> {
|
|
55
|
-
static
|
|
56
|
-
locale: PropTypes.Requireable<string>;
|
|
57
|
-
};
|
|
54
|
+
static contextType: React.Context<string>;
|
|
58
55
|
handleSingleChange: (val: any) => any;
|
|
59
56
|
handleMultiChange: (val: any) => any;
|
|
60
57
|
renderSingleSelect(options: any[]): React.FunctionComponentElement<Omit<import("react-select/dist/declarations/src/Select").PublicBaseSelectProps<unknown, boolean, import("react-select").GroupBase<unknown>>, "value" | "onChange" | "inputValue" | "menuIsOpen" | "onInputChange" | "onMenuOpen" | "onMenuClose"> & Partial<import("react-select/dist/declarations/src/Select").PublicBaseSelectProps<unknown, boolean, import("react-select").GroupBase<unknown>>> & import("react-select/dist/declarations/src/useStateManager").StateManagerAdditionalProps<unknown> & React.RefAttributes<import("react-select/dist/declarations/src/Select").default<unknown, boolean, import("react-select").GroupBase<unknown>>>>;
|