@mwater/visualization 5.1.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/GlobalFilter.d.ts +13 -0
- package/lib/GlobalFilter.js +2 -0
- 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 +7 -25
- package/lib/MWaterCompleteTableSelectComponent.js +36 -36
- package/lib/MWaterContextComponent.d.ts +19 -9
- package/lib/MWaterContextComponent.js +38 -22
- package/lib/MWaterCustomTablesetListComponent.js +9 -3
- package/lib/MWaterGlobalFiltersComponent.d.ts +6 -5
- package/lib/MWaterGlobalFiltersComponent.js +4 -4
- package/lib/MWaterLoaderComponent.d.ts +15 -3
- package/lib/MWaterLoaderComponent.js +11 -2
- 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/Axis.d.ts +20 -25
- package/lib/axes/AxisBuilder.d.ts +7 -4
- package/lib/axes/AxisBuilder.js +12 -8
- package/lib/axes/AxisComponent.d.ts +6 -9
- 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 -17
- package/lib/dashboards/DashboardComponent.js +20 -67
- package/lib/dashboards/DashboardDesign.d.ts +5 -20
- package/lib/dashboards/DashboardUpgrader.js +36 -1
- package/lib/dashboards/DashboardViewComponent.d.ts +5 -34
- package/lib/dashboards/DashboardViewComponent.js +112 -136
- 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 +209 -39
- package/lib/dashboards/ServerDashboardDataSource.d.ts +1 -2
- package/lib/dashboards/ServerDashboardDataSource.js +52 -33
- package/lib/dashboards/SettingsModalComponent.d.ts +4 -15
- package/lib/dashboards/SettingsModalComponent.js +24 -38
- 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/DatagridComponent.d.ts +2 -9
- package/lib/datagrids/DatagridDataSource.d.ts +3 -3
- package/lib/datagrids/DatagridDataSource.js +0 -14
- package/lib/datagrids/DatagridDesign.d.ts +7 -6
- package/lib/datagrids/DatagridDesignerComponent.d.ts +2 -93
- package/lib/datagrids/DatagridDesignerComponent.js +8 -6
- package/lib/datagrids/DatagridViewComponent.js +1 -1
- package/lib/datagrids/FindReplaceModalComponent.d.ts +4 -20
- package/lib/datagrids/FindReplaceModalComponent.js +27 -13
- package/lib/datagrids/ServerDatagridDataSource.d.ts +8 -7
- package/lib/datagrids/ServerDatagridDataSource.js +88 -36
- package/lib/demo.js +4 -4
- package/lib/index.css +5 -0
- package/lib/index.d.ts +2 -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 -56
- 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/layouts/grid/GridLayoutManager.d.ts +2 -1
- 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 +5 -2
- package/lib/maps/ChoroplethLayer.js +2 -1
- package/lib/maps/ClusterLayer.js +3 -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/GridLayer.js +5 -3
- package/lib/maps/GridLayerDesigner.js +0 -1
- package/lib/maps/LayerSwitcherComponent.js +1 -1
- package/lib/maps/MapComponent.d.ts +3 -11
- package/lib/maps/MapComponent.js +3 -3
- package/lib/maps/MapDesign.d.ts +2 -13
- package/lib/maps/MapFiltersDesignerComponent.d.ts +0 -4
- package/lib/maps/MapFiltersDesignerComponent.js +4 -5
- package/lib/maps/MarkersLayer.js +30 -25
- package/lib/maps/RasterMapViewComponent.d.ts +3 -13
- package/lib/maps/RasterMapViewComponent.js +3 -3
- package/lib/maps/RegionSelectComponent.d.ts +2 -1
- package/lib/maps/ServerMapDataSource.d.ts +3 -4
- 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.d.ts +1 -0
- package/lib/maps/vectorMaps.js +70 -56
- package/lib/quickfilter/QuickfilterCompiler.d.ts +1 -1
- 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 +3 -11
- package/lib/widgets/ImageWidgetComponent.d.ts +8 -27
- package/lib/widgets/MapWidget.d.ts +4 -7
- package/lib/widgets/MapWidget.js +2 -1
- package/lib/widgets/MarkdownWidget.d.ts +2 -7
- package/lib/widgets/TOCWidget.d.ts +2 -9
- 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 -74
- 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/imagemosaic/ImagePopupComponent.d.ts +2 -7
- 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 +5 -31
- package/lib/widgets/charts/layered/LayeredChartDesignerComponent.js +21 -3
- package/lib/widgets/charts/layered/LayeredChartLayerDesignerComponent.d.ts +1 -7
- 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 -105
- 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 +11 -7
- 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 -47
- package/lib/widgets/charts/pivot/PivotChartViewComponent.js +20 -60
- package/lib/widgets/charts/pivot/SegmentDesignerComponent.d.ts +55 -58
- 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 +30 -16
- package/lib/widgets/text/ExprInsertModalComponent.d.ts +2 -13
- package/lib/widgets/text/ExprUpdateModalComponent.d.ts +2 -13
- 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 +16 -2
- 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/GlobalFilter.ts +17 -0
- 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 +42 -33
- package/src/MWaterCustomTablesetListComponent.tsx +21 -3
- package/src/MWaterGlobalFiltersComponent.ts +8 -8
- package/src/MWaterLoaderComponent.ts +14 -4
- package/src/MWaterTableSelectComponent.tsx +11 -12
- package/src/{UIComponents.ts → UIComponents.tsx} +7 -15
- package/src/axes/Axis.ts +24 -25
- package/src/axes/AxisBuilder.ts +16 -13
- package/src/axes/AxisComponent.ts +3 -4
- package/src/axes/{ColorPaletteCollectionComponent.ts → ColorPaletteCollectionComponent.tsx} +87 -61
- package/src/dashboards/DashboardComponent.tsx +73 -147
- package/src/dashboards/DashboardDesign.ts +5 -25
- 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 +377 -71
- package/src/dashboards/ServerDashboardDataSource.ts +52 -33
- package/src/dashboards/SettingsModalComponent.tsx +170 -0
- package/src/dashboards/WidgetComponent.tsx +6 -12
- package/src/dashboards/WidgetDataSourcePrioritizer.ts +82 -0
- package/src/dashboards/layoutOptions.tsx +581 -0
- package/src/datagrids/DatagridDataSource.ts +6 -12
- package/src/datagrids/DatagridDesign.ts +8 -3
- package/src/datagrids/DatagridDesignerComponent.tsx +22 -18
- package/src/datagrids/DatagridViewComponent.ts +3 -3
- package/src/datagrids/ExprCellComponent.ts +0 -1
- package/src/datagrids/FindReplaceModalComponent.ts +39 -22
- package/src/datagrids/ServerDatagridDataSource.ts +107 -45
- package/src/demo.ts +4 -4
- package/src/index.css +5 -0
- package/src/index.ts +2 -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 +5 -2
- package/src/maps/ChoroplethLayer.ts +2 -1
- package/src/maps/ClusterLayer.ts +3 -1
- package/src/maps/DirectMapDataSource.ts +12 -3
- package/src/maps/EditPopupComponent.ts +2 -1
- package/src/maps/GridLayer.ts +5 -3
- package/src/maps/GridLayerDesigner.tsx +0 -1
- package/src/maps/LayerSwitcherComponent.tsx +1 -1
- package/src/maps/MapComponent.ts +3 -3
- package/src/maps/MapDesign.ts +2 -17
- package/src/maps/{MapFiltersDesignerComponent.ts → MapFiltersDesignerComponent.tsx} +25 -25
- package/src/maps/MarkersLayer.ts +38 -41
- package/src/maps/RasterMapViewComponent.ts +3 -3
- package/src/maps/ServerMapDataSource.ts +8 -8
- package/src/maps/VectorMapViewComponent.tsx +2 -2
- package/src/maps/mapSymbols.ts +2 -0
- package/src/maps/symbols/font-awesome/cloud-rain.png +0 -0
- package/src/maps/vectorMaps.tsx +88 -74
- package/src/quickfilter/QuickfilterCompiler.ts +1 -1
- 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 +32 -19
- 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 +26 -2
- package/src/ColorComponent.ts +0 -117
- package/src/dashboards/DashboardViewComponent.ts +0 -304
- package/src/dashboards/SettingsModalComponent.ts +0 -169
- 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/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,7 +1,7 @@
|
|
|
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";
|
|
4
|
+
import ModalPopupComponent from "@mwater/react-library/lib/ModalPopupComponent";
|
|
5
5
|
import { JsonQLFilter } from "../JsonQLFilter";
|
|
6
6
|
import { MapDesign } from "./MapDesign";
|
|
7
7
|
import { MapDataSource } from "./MapDataSource";
|
|
@@ -42,9 +42,7 @@ export default class RasterMapViewComponent extends React.Component<RasterMapVie
|
|
|
42
42
|
popupContents: ReactNode;
|
|
43
43
|
legendHidden: boolean;
|
|
44
44
|
}> {
|
|
45
|
-
static
|
|
46
|
-
locale: PropTypes.Requireable<string>;
|
|
47
|
-
};
|
|
45
|
+
static contextType: React.Context<string>;
|
|
48
46
|
leafletMap?: LeafletMapComponent | null;
|
|
49
47
|
constructor(props: any);
|
|
50
48
|
componentDidMount(): void;
|
|
@@ -64,15 +62,7 @@ export default class RasterMapViewComponent extends React.Component<RasterMapVie
|
|
|
64
62
|
locale: string;
|
|
65
63
|
onHide: () => void;
|
|
66
64
|
}>;
|
|
67
|
-
renderPopup(): React.CElement<
|
|
68
|
-
onClose: () => void;
|
|
69
|
-
showCloseX: boolean;
|
|
70
|
-
size: string;
|
|
71
|
-
}, React.Component<{
|
|
72
|
-
onClose: () => void;
|
|
73
|
-
showCloseX: boolean;
|
|
74
|
-
size: string;
|
|
75
|
-
}, any, any>> | null;
|
|
65
|
+
renderPopup(): React.CElement<import("@mwater/react-library/lib/ModalPopupComponent").ModalPopupComponentProps, ModalPopupComponent> | null;
|
|
76
66
|
render(): React.DetailedReactHTMLElement<{
|
|
77
67
|
style: {
|
|
78
68
|
width: number;
|
|
@@ -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,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { IdLiteralComponent } from "@mwater/expressions-ui";
|
|
2
3
|
import { DataSource, Schema } from "@mwater/expressions";
|
|
3
4
|
export interface RegionSelectComponentProps {
|
|
4
5
|
schema: Schema;
|
|
@@ -19,5 +20,5 @@ export default class RegionSelectComponent extends React.Component<RegionSelectC
|
|
|
19
20
|
regionsTable: string;
|
|
20
21
|
};
|
|
21
22
|
handleChange: (id: any) => void;
|
|
22
|
-
render(): React.
|
|
23
|
+
render(): React.CElement<import("@mwater/expressions-ui/lib/IdLiteralComponent").IdLiteralComponentProps, IdLiteralComponent>;
|
|
23
24
|
}
|
|
@@ -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";
|
|
@@ -22,7 +21,7 @@ interface ServerMapDataSourceOptions {
|
|
|
22
21
|
/** map id to use on server */
|
|
23
22
|
mapId: string;
|
|
24
23
|
/** revision to use to allow caching */
|
|
25
|
-
rev:
|
|
24
|
+
rev: number;
|
|
26
25
|
}
|
|
27
26
|
interface ServerMapLayerDataSourceOptions extends ServerMapDataSourceOptions {
|
|
28
27
|
layerView: MapLayerView;
|
|
@@ -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.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Map, LngLatBoundsLike } from "maplibre-gl";
|
|
|
2
2
|
import "maplibre-gl/dist/maplibre-gl.css";
|
|
3
3
|
import "./VectorMapViewComponent.css";
|
|
4
4
|
import React from "react";
|
|
5
|
+
export declare function setPrintingModeEnabled(val: boolean): void;
|
|
5
6
|
/** This must be called to set the appropriate key before use. If it is not set, vector maps will not function.
|
|
6
7
|
* Maps will fall back to leaflet if the key is not set or if set to ""
|
|
7
8
|
*/
|
package/lib/maps/vectorMaps.js
CHANGED
|
@@ -3,13 +3,19 @@ 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
|
-
exports.usePersistedMapBounds = exports.VectorMapLogo = exports.AttributionControl = exports.mergeBaseAndUserStyle = exports.useBaseStyle = exports.useStyleMap = exports.useHoverCursor = exports.useVectorMap = exports.areVectorMapsEnabled = exports.getMapTilerApiKey = exports.setMapTilerApiKey = void 0;
|
|
6
|
+
exports.usePersistedMapBounds = exports.VectorMapLogo = exports.AttributionControl = exports.mergeBaseAndUserStyle = exports.useBaseStyle = exports.useStyleMap = exports.useHoverCursor = exports.useVectorMap = exports.areVectorMapsEnabled = exports.getMapTilerApiKey = exports.setMapTilerApiKey = exports.setPrintingModeEnabled = void 0;
|
|
7
7
|
const maplibre_gl_1 = __importDefault(require("maplibre-gl"));
|
|
8
8
|
const react_1 = require("react");
|
|
9
9
|
const mapSymbols_1 = require("./mapSymbols");
|
|
10
10
|
require("maplibre-gl/dist/maplibre-gl.css");
|
|
11
11
|
require("./VectorMapViewComponent.css");
|
|
12
12
|
const react_2 = __importDefault(require("react"));
|
|
13
|
+
/** Set to true to enable printing by preserving the drawing buffer */
|
|
14
|
+
let printingModeEnabled = false;
|
|
15
|
+
function setPrintingModeEnabled(val) {
|
|
16
|
+
printingModeEnabled = val;
|
|
17
|
+
}
|
|
18
|
+
exports.setPrintingModeEnabled = setPrintingModeEnabled;
|
|
13
19
|
/* Hooks and functions related to displaying a vector map */
|
|
14
20
|
let mapTilerApiKey = "";
|
|
15
21
|
/** This must be called to set the appropriate key before use. If it is not set, vector maps will not function.
|
|
@@ -45,7 +51,8 @@ function useVectorMap(options) {
|
|
|
45
51
|
return;
|
|
46
52
|
}
|
|
47
53
|
const observer = new IntersectionObserver(function (entries) {
|
|
48
|
-
|
|
54
|
+
// When in printing mode, always visible as we need to render the map
|
|
55
|
+
setMapDivVisible(entries[0].isIntersecting || printingModeEnabled);
|
|
49
56
|
});
|
|
50
57
|
observer.observe(divRef);
|
|
51
58
|
return () => {
|
|
@@ -64,57 +71,64 @@ function useVectorMap(options) {
|
|
|
64
71
|
if (!mapDivVisible || !divRef) {
|
|
65
72
|
return;
|
|
66
73
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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
|
-
m
|
|
116
|
-
|
|
117
|
-
|
|
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
|
+
}
|
|
118
132
|
}, [mapReloadCount]);
|
|
119
133
|
return map;
|
|
120
134
|
}
|
|
@@ -183,13 +197,13 @@ function useBaseStyle(baseLayer) {
|
|
|
183
197
|
});
|
|
184
198
|
}
|
|
185
199
|
if (baseLayer == "cartodb_positron") {
|
|
186
|
-
loadStyle(`https://api.maptiler.com/maps/
|
|
200
|
+
loadStyle(`https://api.maptiler.com/maps/5f972163-6078-4341-982a-5c8bc4447e68/style.json?key=${mapTilerApiKey}`);
|
|
187
201
|
}
|
|
188
202
|
else if (baseLayer == "cartodb_dark_matter") {
|
|
189
|
-
loadStyle(`https://api.maptiler.com/maps/
|
|
203
|
+
loadStyle(`https://api.maptiler.com/maps/1d3e957b-c546-4791-b9de-dce203538429/style.json?key=${mapTilerApiKey}`);
|
|
190
204
|
}
|
|
191
205
|
else if (baseLayer == "bing_road") {
|
|
192
|
-
loadStyle(`https://api.maptiler.com/maps/streets/style.json?key=${mapTilerApiKey}`);
|
|
206
|
+
loadStyle(`https://api.maptiler.com/maps/streets-v2/style.json?key=${mapTilerApiKey}`);
|
|
193
207
|
}
|
|
194
208
|
else if (baseLayer == "bing_aerial") {
|
|
195
209
|
// Switched to Bing for superior aerial imagery
|
|
@@ -12,5 +12,5 @@ export default class QuickfilterCompiler {
|
|
|
12
12
|
* See README for values
|
|
13
13
|
*/
|
|
14
14
|
compile(design: Quickfilter[] | undefined, values: any[] | null, locks: QuickfilterLock[] | null | undefined): JsonQLFilter[];
|
|
15
|
-
compileToFilterExpr(expr: any, value: any, multi
|
|
15
|
+
compileToFilterExpr(expr: any, value: any, multi?: boolean): OpExpr | null;
|
|
16
16
|
}
|
|
@@ -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>>>>;
|
|
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const lodash_1 = __importDefault(require("lodash"));
|
|
7
|
-
const prop_types_1 = __importDefault(require("prop-types"));
|
|
8
7
|
const react_1 = __importDefault(require("react"));
|
|
9
8
|
const R = react_1.default.createElement;
|
|
10
9
|
const react_select_1 = __importDefault(require("react-select"));
|
|
@@ -14,6 +13,7 @@ const TextLiteralComponent_1 = __importDefault(require("./TextLiteralComponent")
|
|
|
14
13
|
const DateExprComponent_1 = __importDefault(require("./DateExprComponent"));
|
|
15
14
|
const QuickfilterCompiler_1 = __importDefault(require("./QuickfilterCompiler"));
|
|
16
15
|
const IdArrayQuickfilterComponent_1 = __importDefault(require("./IdArrayQuickfilterComponent"));
|
|
16
|
+
const contexts_1 = require("@mwater/expressions-ui/lib/contexts");
|
|
17
17
|
/** Displays quick filters and allows their value to be modified */
|
|
18
18
|
class QuickfiltersComponent extends react_1.default.Component {
|
|
19
19
|
renderQuickfilter(item, index) {
|
|
@@ -153,7 +153,7 @@ class QuickfiltersComponent extends react_1.default.Component {
|
|
|
153
153
|
exports.default = QuickfiltersComponent;
|
|
154
154
|
/** Quickfilter for an enum */
|
|
155
155
|
class EnumQuickfilterComponent extends react_1.default.Component {
|
|
156
|
-
static
|
|
156
|
+
static contextType = contexts_1.LocaleContext;
|
|
157
157
|
handleSingleChange = (val) => {
|
|
158
158
|
if (val) {
|
|
159
159
|
return this.props.onValueChange(val);
|
|
@@ -206,7 +206,7 @@ class EnumQuickfilterComponent extends react_1.default.Component {
|
|
|
206
206
|
render() {
|
|
207
207
|
const options = lodash_1.default.map(this.props.options, (opt) => ({
|
|
208
208
|
value: opt.id,
|
|
209
|
-
label: expressions_1.ExprUtils.localizeString(opt.name, this.context
|
|
209
|
+
label: expressions_1.ExprUtils.localizeString(opt.name, this.context)
|
|
210
210
|
}));
|
|
211
211
|
// Determine width, estimating about 8 px per letter with 120px padding
|
|
212
212
|
let width = lodash_1.default.max(options, (o) => o.label.length)?.label?.length;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
export interface DropdownItem {
|
|
3
|
+
label: ReactNode;
|
|
4
|
+
value: string;
|
|
5
|
+
/** If true, this item will be rendered only when "More..." is clicked. */
|
|
6
|
+
more?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface DropdownPaletteItemProps {
|
|
9
|
+
label: ReactNode;
|
|
10
|
+
items: DropdownItem[];
|
|
11
|
+
/** Called with clicked item */
|
|
12
|
+
onSelect: (value: string) => void;
|
|
13
|
+
/** should the popup be under or over? */
|
|
14
|
+
position?: "under" | "over";
|
|
15
|
+
}
|
|
16
|
+
interface DropdownPaletteItemState {
|
|
17
|
+
open: boolean;
|
|
18
|
+
moreOpen: boolean;
|
|
19
|
+
}
|
|
20
|
+
/** Palette item that allows picking from dropdown */
|
|
21
|
+
export default class DropdownPaletteItem extends React.Component<DropdownPaletteItemProps, DropdownPaletteItemState> {
|
|
22
|
+
static defaultProps: {
|
|
23
|
+
position: string;
|
|
24
|
+
};
|
|
25
|
+
constructor(props: DropdownPaletteItemProps);
|
|
26
|
+
handleMouseDown: (ev: React.MouseEvent) => void;
|
|
27
|
+
handleMoreClick: (ev: React.MouseEvent) => void;
|
|
28
|
+
renderItem(item: DropdownItem): React.JSX.Element;
|
|
29
|
+
renderItems(): React.JSX.Element;
|
|
30
|
+
render(): React.JSX.Element;
|
|
31
|
+
}
|
|
32
|
+
export {};
|