@mwater/visualization 5.5.0 → 5.6.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/MWaterContextComponent.d.ts +1 -1
- package/lib/MWaterGlobalFiltersComponent.d.ts +2 -2
- package/lib/MWaterGlobalFiltersComponent.js +11 -20
- package/lib/MWaterLoaderComponent.d.ts +4 -13
- package/lib/MWaterLoaderComponent.js +2 -11
- package/lib/UndoStack.d.ts +2 -1
- package/lib/UndoStack.js +12 -6
- package/lib/dashboards/DashboardComponent.js +5 -4
- package/lib/dashboards/DashboardDesign.d.ts +1 -1
- package/lib/dashboards/ServerDashboardDataSource.js +0 -10
- package/lib/dashboards/SettingsModalComponent.js +1 -1
- package/lib/datagrids/DatagridComponent.js +22 -2
- package/lib/datagrids/DatagridDesignerComponent.d.ts +2 -3
- package/lib/datagrids/DatagridDesignerComponent.js +108 -120
- package/lib/datagrids/DatagridViewComponent.js +3 -2
- package/lib/datagrids/OrderBysDesignerComponent.d.ts +7 -7
- package/lib/datagrids/OrderBysDesignerComponent.js +19 -28
- package/lib/index.css +45 -2
- package/lib/index.d.ts +5 -5
- package/lib/index.js +2 -3
- package/lib/layouts/blocks/BlocksDisplayComponent.d.ts +8 -1
- package/lib/layouts/blocks/BlocksDisplayComponent.js +46 -4
- package/lib/maps/BufferLayer.js +12 -0
- package/lib/maps/BufferLayerDesign.d.ts +1 -1
- package/lib/maps/BufferLayerDesignerComponent.js +2 -2
- package/lib/maps/ChoroplethLayer.js +12 -0
- package/lib/maps/ChoroplethLayerDesign.d.ts +5 -2
- package/lib/maps/ChoroplethLayerDesigner.d.ts +10 -32
- package/lib/maps/ChoroplethLayerDesigner.js +58 -89
- package/lib/maps/DirectMapDataSource.js +0 -10
- package/lib/maps/EditHoverOver.d.ts +4 -3
- package/lib/maps/EditHoverOver.js +3 -3
- package/lib/maps/HoverContent.js +1 -1
- package/lib/maps/LeafletMapComponent.js +10 -19
- package/lib/maps/MapComponent.js +0 -1
- package/lib/maps/MapUtils.js +10 -1
- package/lib/maps/MarkersLayer.js +18 -2
- package/lib/maps/MarkersLayerDesign.d.ts +1 -1
- package/lib/maps/MarkersLayerDesignerComponent.d.ts +12 -41
- package/lib/maps/MarkersLayerDesignerComponent.js +81 -111
- package/lib/maps/ServerMapDataSource.js +0 -10
- package/lib/maps/VectorMapViewComponent.js +1 -9
- package/lib/maps/symbols/font-awesome/asterisk.png +0 -0
- package/lib/maps/symbols/font-awesome/ban.png +0 -0
- package/lib/maps/symbols/font-awesome/beer.png +0 -0
- package/lib/maps/symbols/font-awesome/bell.png +0 -0
- package/lib/maps/symbols/font-awesome/bolt.png +0 -0
- package/lib/maps/symbols/font-awesome/building.png +0 -0
- package/lib/maps/symbols/font-awesome/bullseye.png +0 -0
- package/lib/maps/symbols/font-awesome/bus.png +0 -0
- package/lib/maps/symbols/font-awesome/caret-up.png +0 -0
- package/lib/maps/symbols/font-awesome/certificate.png +0 -0
- package/lib/maps/symbols/font-awesome/check-circle.png +0 -0
- package/lib/maps/symbols/font-awesome/check.png +0 -0
- package/lib/maps/symbols/font-awesome/chevron-circle-down.png +0 -0
- package/lib/maps/symbols/font-awesome/chevron-circle-up.png +0 -0
- package/lib/maps/symbols/font-awesome/cloud-rain.png +0 -0
- package/lib/maps/symbols/font-awesome/cloud.png +0 -0
- package/lib/maps/symbols/font-awesome/comment.png +0 -0
- package/lib/maps/symbols/font-awesome/crosshairs.png +0 -0
- package/lib/maps/symbols/font-awesome/dot-circle-o.png +0 -0
- package/lib/maps/symbols/font-awesome/exclamation-circle.png +0 -0
- package/lib/maps/symbols/font-awesome/exclamation-triangle.png +0 -0
- package/lib/maps/symbols/font-awesome/female.png +0 -0
- package/lib/maps/symbols/font-awesome/file.png +0 -0
- package/lib/maps/symbols/font-awesome/flag.png +0 -0
- package/lib/maps/symbols/font-awesome/flask.png +0 -0
- package/lib/maps/symbols/font-awesome/h-square.png +0 -0
- package/lib/maps/symbols/font-awesome/home.png +0 -0
- package/lib/maps/symbols/font-awesome/info-circle.png +0 -0
- package/lib/maps/symbols/font-awesome/male.png +0 -0
- package/lib/maps/symbols/font-awesome/medkit.png +0 -0
- package/lib/maps/symbols/font-awesome/mobile.png +0 -0
- package/lib/maps/symbols/font-awesome/plus-circle.png +0 -0
- package/lib/maps/symbols/font-awesome/plus-square.png +0 -0
- package/lib/maps/symbols/font-awesome/plus.png +0 -0
- package/lib/maps/symbols/font-awesome/square.png +0 -0
- package/lib/maps/symbols/font-awesome/star.png +0 -0
- package/lib/maps/symbols/font-awesome/thumbs-down.png +0 -0
- package/lib/maps/symbols/font-awesome/thumbs-up.png +0 -0
- package/lib/maps/symbols/font-awesome/ticket.png +0 -0
- package/lib/maps/symbols/font-awesome/times-circle.png +0 -0
- package/lib/maps/symbols/font-awesome/times.png +0 -0
- package/lib/maps/symbols/font-awesome/tint.png +0 -0
- package/lib/maps/symbols/font-awesome/tree.png +0 -0
- package/lib/maps/symbols/font-awesome/university.png +0 -0
- package/lib/maps/symbols/font-awesome/usd.png +0 -0
- package/lib/maps/symbols/font-awesome/user.png +0 -0
- package/lib/maps/symbols/font-awesome/users.png +0 -0
- package/lib/maps/symbols/font-awesome/wheelchair.png +0 -0
- package/lib/maps/symbols/sdf-ize.sh +93 -0
- package/lib/maps/vectorMaps.d.ts +1 -0
- package/lib/maps/vectorMaps.js +20 -36
- package/lib/mwater_table_selection/IndicatorsListComponent.d.ts +4 -2
- package/lib/mwater_table_selection/IndicatorsListComponent.js +103 -34
- package/lib/mwater_table_selection/MWaterCalculatedDataSourcesListComponent.d.ts +18 -0
- package/lib/mwater_table_selection/MWaterCalculatedDataSourcesListComponent.js +80 -0
- package/lib/mwater_table_selection/MWaterCompleteTableSelectComponent.d.ts +26 -0
- package/lib/mwater_table_selection/MWaterCompleteTableSelectComponent.js +237 -51
- package/lib/mwater_table_selection/MWaterTableSelectComponent.d.ts +2 -2
- package/lib/mwater_table_selection/MWaterTableSelectComponent.js +9 -4
- package/lib/mwater_table_selection/MWaterWorkflowsSelectComponent.d.ts +19 -0
- package/lib/mwater_table_selection/MWaterWorkflowsSelectComponent.js +111 -0
- package/lib/quickfilter/QuickfiltersComponent.d.ts +3 -102
- package/lib/quickfilter/QuickfiltersComponent.js +53 -110
- package/lib/quickfilter/TextLiteralComponent.d.ts +23 -47
- package/lib/quickfilter/TextLiteralComponent.js +85 -82
- package/lib/widgets/MapWidget.js +4 -2
- package/lib/widgets/text/ExprItemEditorComponent.d.ts +3 -8
- package/lib/widgets/text/ExprItemEditorComponent.js +36 -33
- package/lib/widgets/text/ExprUpdateModalComponent.d.ts +1 -0
- package/package.json +2 -3
- package/src/MWaterContextComponent.tsx +1 -1
- package/src/{MWaterGlobalFiltersComponent.ts → MWaterGlobalFiltersComponent.tsx} +32 -33
- package/src/{MWaterLoaderComponent.ts → MWaterLoaderComponent.tsx} +17 -18
- package/src/UndoStack.ts +14 -6
- package/src/dashboards/DashboardComponent.tsx +5 -4
- package/src/dashboards/DashboardDesign.ts +1 -1
- package/src/dashboards/ServerDashboardDataSource.ts +0 -12
- package/src/dashboards/SettingsModalComponent.tsx +1 -1
- package/src/datagrids/DatagridComponent.tsx +30 -2
- package/src/datagrids/DatagridDesignerComponent.tsx +241 -229
- package/src/datagrids/DatagridViewComponent.tsx +3 -2
- package/src/datagrids/OrderBysDesignerComponent.tsx +61 -70
- package/src/index.css +45 -2
- package/src/index.ts +5 -11
- package/src/layouts/blocks/BlocksDisplayComponent.tsx +60 -5
- package/src/maps/BufferLayer.ts +14 -1
- package/src/maps/BufferLayerDesign.ts +1 -1
- package/src/maps/BufferLayerDesignerComponent.tsx +2 -1
- package/src/maps/ChoroplethLayer.ts +20 -7
- package/src/maps/ChoroplethLayerDesign.ts +5 -2
- package/src/maps/ChoroplethLayerDesigner.tsx +169 -165
- package/src/maps/DirectMapDataSource.ts +0 -12
- package/src/maps/EditHoverOver.tsx +9 -5
- package/src/maps/HoverContent.tsx +1 -1
- package/src/maps/LeafletMapComponent.tsx +10 -19
- package/src/maps/MapComponent.ts +0 -1
- package/src/maps/MapUtils.ts +13 -1
- package/src/maps/MarkersLayer.ts +22 -5
- package/src/maps/MarkersLayerDesign.ts +1 -1
- package/src/maps/MarkersLayerDesignerComponent.tsx +360 -0
- package/src/maps/ServerMapDataSource.ts +0 -12
- package/src/maps/VectorMapViewComponent.tsx +2 -13
- package/src/maps/symbols/font-awesome/asterisk.png +0 -0
- package/src/maps/symbols/font-awesome/ban.png +0 -0
- package/src/maps/symbols/font-awesome/beer.png +0 -0
- package/src/maps/symbols/font-awesome/bell.png +0 -0
- package/src/maps/symbols/font-awesome/bolt.png +0 -0
- package/src/maps/symbols/font-awesome/building.png +0 -0
- package/src/maps/symbols/font-awesome/bullseye.png +0 -0
- package/src/maps/symbols/font-awesome/bus.png +0 -0
- package/src/maps/symbols/font-awesome/caret-up.png +0 -0
- package/src/maps/symbols/font-awesome/certificate.png +0 -0
- package/src/maps/symbols/font-awesome/check-circle.png +0 -0
- package/src/maps/symbols/font-awesome/check.png +0 -0
- package/src/maps/symbols/font-awesome/chevron-circle-down.png +0 -0
- package/src/maps/symbols/font-awesome/chevron-circle-up.png +0 -0
- package/src/maps/symbols/font-awesome/cloud-rain.png +0 -0
- package/src/maps/symbols/font-awesome/cloud.png +0 -0
- package/src/maps/symbols/font-awesome/comment.png +0 -0
- package/src/maps/symbols/font-awesome/crosshairs.png +0 -0
- package/src/maps/symbols/font-awesome/dot-circle-o.png +0 -0
- package/src/maps/symbols/font-awesome/exclamation-circle.png +0 -0
- package/src/maps/symbols/font-awesome/exclamation-triangle.png +0 -0
- package/src/maps/symbols/font-awesome/female.png +0 -0
- package/src/maps/symbols/font-awesome/file.png +0 -0
- package/src/maps/symbols/font-awesome/flag.png +0 -0
- package/src/maps/symbols/font-awesome/flask.png +0 -0
- package/src/maps/symbols/font-awesome/h-square.png +0 -0
- package/src/maps/symbols/font-awesome/home.png +0 -0
- package/src/maps/symbols/font-awesome/info-circle.png +0 -0
- package/src/maps/symbols/font-awesome/male.png +0 -0
- package/src/maps/symbols/font-awesome/medkit.png +0 -0
- package/src/maps/symbols/font-awesome/mobile.png +0 -0
- package/src/maps/symbols/font-awesome/plus-circle.png +0 -0
- package/src/maps/symbols/font-awesome/plus-square.png +0 -0
- package/src/maps/symbols/font-awesome/plus.png +0 -0
- package/src/maps/symbols/font-awesome/square.png +0 -0
- package/src/maps/symbols/font-awesome/star.png +0 -0
- package/src/maps/symbols/font-awesome/thumbs-down.png +0 -0
- package/src/maps/symbols/font-awesome/thumbs-up.png +0 -0
- package/src/maps/symbols/font-awesome/ticket.png +0 -0
- package/src/maps/symbols/font-awesome/times-circle.png +0 -0
- package/src/maps/symbols/font-awesome/times.png +0 -0
- package/src/maps/symbols/font-awesome/tint.png +0 -0
- package/src/maps/symbols/font-awesome/tree.png +0 -0
- package/src/maps/symbols/font-awesome/university.png +0 -0
- package/src/maps/symbols/font-awesome/usd.png +0 -0
- package/src/maps/symbols/font-awesome/user.png +0 -0
- package/src/maps/symbols/font-awesome/users.png +0 -0
- package/src/maps/symbols/font-awesome/wheelchair.png +0 -0
- package/src/maps/symbols/sdf-ize.sh +93 -0
- package/src/maps/vectorMaps.tsx +20 -44
- package/src/mwater_table_selection/IndicatorsListComponent.tsx +165 -37
- package/src/mwater_table_selection/MWaterCalculatedDataSourcesListComponent.tsx +111 -0
- package/src/mwater_table_selection/MWaterCompleteTableSelectComponent.tsx +373 -37
- package/src/mwater_table_selection/MWaterTableSelectComponent.tsx +12 -8
- package/src/mwater_table_selection/MWaterWorkflowsSelectComponent.tsx +159 -0
- package/src/quickfilter/{QuickfiltersComponent.ts → QuickfiltersComponent.tsx} +165 -158
- package/src/quickfilter/TextLiteralComponent.tsx +197 -0
- package/src/widgets/MapWidget.tsx +9 -1
- package/src/widgets/text/ExprItemEditorComponent.tsx +83 -77
- package/src/widgets/text/ExprUpdateModalComponent.tsx +1 -0
- package/test/UndoStackTests.ts +52 -1
- package/.storybook/config.js +0 -7
- package/.storybook/head.html +0 -3
- package/.storybook/webpack.config.js +0 -15
- package/src/maps/BingLayer.ts +0 -146
- package/src/maps/MarkersLayerDesignerComponent.ts +0 -374
- package/src/quickfilter/TextLiteralComponent.ts +0 -165
- package/stories/UpdateableComponent.js +0 -29
- package/stories/consoles.js +0 -202
- package/stories/dashboards.js +0 -217
- package/stories/datagridDesign.js +0 -114
- package/stories/datagrids.js +0 -69
- package/stories/dates.js +0 -80
- package/stories/exprcomponent.js +0 -43
- package/stories/index.js +0 -18
- package/stories/leaflet.js +0 -59
- package/stories/maps.js +0 -24
- package/stories/pivotChart.js +0 -235
package/src/maps/MarkersLayer.ts
CHANGED
|
@@ -115,6 +115,9 @@ export default class MarkersLayer extends Layer<MarkersLayerDesign> {
|
|
|
115
115
|
filter: addFilter(["==", ["geometry-type"], "Point"])
|
|
116
116
|
})
|
|
117
117
|
} else {
|
|
118
|
+
// For some reason, scales down from 20 to 14. No idea why
|
|
119
|
+
const iconSize = (design.markerSize || 10) / 14
|
|
120
|
+
|
|
118
121
|
mapLayers.push({
|
|
119
122
|
id: `${sourceId}:points`,
|
|
120
123
|
type: "symbol",
|
|
@@ -123,11 +126,13 @@ export default class MarkersLayer extends Layer<MarkersLayerDesign> {
|
|
|
123
126
|
layout: {
|
|
124
127
|
"icon-image": design.symbol,
|
|
125
128
|
"icon-allow-overlap": true,
|
|
126
|
-
"icon-size":
|
|
129
|
+
"icon-size": iconSize,
|
|
127
130
|
},
|
|
128
131
|
paint: {
|
|
129
132
|
"icon-color": color,
|
|
130
|
-
"icon-opacity": opacity
|
|
133
|
+
"icon-opacity": opacity,
|
|
134
|
+
"icon-halo-color": compileColorToMapbox("#FFFFFFCC", design.axes.color?.excludedValues),
|
|
135
|
+
"icon-halo-width": iconSize * 5,
|
|
131
136
|
},
|
|
132
137
|
filter: addFilter(["==", ["geometry-type"], "Point"])
|
|
133
138
|
})
|
|
@@ -736,6 +741,19 @@ ${design.polygonBorderColor ? "line-color: " + design.polygonBorderColor + ";" :
|
|
|
736
741
|
})!
|
|
737
742
|
|
|
738
743
|
draft.filter = exprCleaner.cleanExpr(design.filter || null, { table: draft.table })
|
|
744
|
+
|
|
745
|
+
// Clean hover over expressions
|
|
746
|
+
if (design.table && design.hoverOver && design.hoverOver.items) {
|
|
747
|
+
for (let i = 0; i < design.hoverOver.items.length; i++) {
|
|
748
|
+
const item = design.hoverOver.items[i]
|
|
749
|
+
if (item.value) {
|
|
750
|
+
draft.hoverOver!.items[i].value = exprCleaner.cleanExpr(item.value || null, {
|
|
751
|
+
table: design.table,
|
|
752
|
+
aggrStatuses: ["individual", "literal"]
|
|
753
|
+
})
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
}
|
|
739
757
|
})
|
|
740
758
|
|
|
741
759
|
return design
|
|
@@ -804,7 +822,7 @@ ${design.polygonBorderColor ? "line-color: " + design.polygonBorderColor + ";" :
|
|
|
804
822
|
}
|
|
805
823
|
|
|
806
824
|
/** Gets hover over data for hover over items. This should be implemented by layers that have hover over items.
|
|
807
|
-
* It will be called on the server side if using a server map data source, or on the client side if using a direct
|
|
825
|
+
* It will be called on the server side if using a server map data source, or on the client side if using a direct
|
|
808
826
|
* map data source.
|
|
809
827
|
*/
|
|
810
828
|
getHoverOverData(options: {
|
|
@@ -825,7 +843,7 @@ ${design.polygonBorderColor ? "line-color: " + design.polygonBorderColor + ";" :
|
|
|
825
843
|
filters: options.filters,
|
|
826
844
|
schema: options.schema,
|
|
827
845
|
dataSource: options.dataSource,
|
|
828
|
-
hoverOverItems: options.design.hoverOver
|
|
846
|
+
hoverOverItems: options.design.hoverOver!.items,
|
|
829
847
|
})
|
|
830
848
|
}
|
|
831
849
|
}
|
|
@@ -971,4 +989,3 @@ export function createMarkersVectorQuery(baseQuery: JsonQLSelectQuery) {
|
|
|
971
989
|
|
|
972
990
|
return outerquery
|
|
973
991
|
}
|
|
974
|
-
|
|
@@ -43,7 +43,7 @@ export interface MarkersLayerDesign {
|
|
|
43
43
|
popup: { items: LayoutBlock }
|
|
44
44
|
|
|
45
45
|
/** Contains items to display when hovering over the layer */
|
|
46
|
-
hoverOver
|
|
46
|
+
hoverOver?: { items: HoverOverItem[] }
|
|
47
47
|
|
|
48
48
|
/** Customizable filtering for popup */
|
|
49
49
|
popupFilterJoins: PopupFilterJoins
|
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
import _ from "lodash"
|
|
2
|
+
import React from "react"
|
|
3
|
+
import { FilterExprComponent } from "@mwater/expressions-ui"
|
|
4
|
+
import { DataSource, ExprUtils, OpExpr, Schema } from "@mwater/expressions"
|
|
5
|
+
import { ExprCompiler } from "@mwater/expressions"
|
|
6
|
+
import AxisComponent from "../axes/AxisComponent"
|
|
7
|
+
import ColorComponent from "../ColorComponent"
|
|
8
|
+
import { TableSelectComponent } from "@mwater/expressions-ui"
|
|
9
|
+
import EditPopupComponent from "./EditPopupComponent"
|
|
10
|
+
import ZoomLevelsComponent from "./ZoomLevelsComponent"
|
|
11
|
+
import MarkerSymbolSelectComponent from "./MarkerSymbolSelectComponent"
|
|
12
|
+
import * as PopupFilterJoinsUtils from "./PopupFilterJoinsUtils"
|
|
13
|
+
import * as ui from "@mwater/react-library/lib/bootstrap"
|
|
14
|
+
import { EditHoverOver } from "./EditHoverOver"
|
|
15
|
+
import { MarkersLayerDesign } from "./MarkersLayerDesign"
|
|
16
|
+
import { default as Rcslider } from "rc-slider"
|
|
17
|
+
|
|
18
|
+
export interface MarkersLayerDesignerComponentProps {
|
|
19
|
+
/** Schema to use */
|
|
20
|
+
schema: Schema
|
|
21
|
+
dataSource: DataSource
|
|
22
|
+
/** Design of the marker layer */
|
|
23
|
+
design: MarkersLayerDesign
|
|
24
|
+
/** Called with new design */
|
|
25
|
+
onDesignChange: any
|
|
26
|
+
filters?: any
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Designer for a markers layer
|
|
30
|
+
export default class MarkersLayerDesignerComponent extends React.Component<MarkersLayerDesignerComponentProps> {
|
|
31
|
+
// Apply updates to design
|
|
32
|
+
update(updates: any) {
|
|
33
|
+
return this.props.onDesignChange(_.extend({}, this.props.design, updates))
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Update axes with specified changes
|
|
37
|
+
updateAxes(changes: any) {
|
|
38
|
+
const axes = _.extend({}, this.props.design.axes, changes)
|
|
39
|
+
return this.update({ axes })
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
handleTableChange = (table: any) => {
|
|
43
|
+
return this.update({ table })
|
|
44
|
+
}
|
|
45
|
+
handleGeometryAxisChange = (axis: any) => {
|
|
46
|
+
return this.updateAxes({ geometry: axis })
|
|
47
|
+
}
|
|
48
|
+
handleColorAxisChange = (axis: any) => {
|
|
49
|
+
return this.updateAxes({ color: axis })
|
|
50
|
+
}
|
|
51
|
+
handleFilterChange = (expr: any) => {
|
|
52
|
+
return this.update({ filter: expr })
|
|
53
|
+
}
|
|
54
|
+
handleColorChange = (color: any) => {
|
|
55
|
+
return this.update({ color })
|
|
56
|
+
}
|
|
57
|
+
handlePolygonBorderColorChange = (polygonBorderColor: any) => {
|
|
58
|
+
return this.update({ polygonBorderColor })
|
|
59
|
+
}
|
|
60
|
+
handlePolygonFillOpacityChange = (polygonFillOpacity: any) => {
|
|
61
|
+
return this.update({ polygonFillOpacity: polygonFillOpacity / 100 })
|
|
62
|
+
}
|
|
63
|
+
handleSymbolChange = (symbol: any) => {
|
|
64
|
+
return this.update({ symbol })
|
|
65
|
+
}
|
|
66
|
+
handleNameChange = (e: any) => {
|
|
67
|
+
return this.update({ name: e.target.value })
|
|
68
|
+
}
|
|
69
|
+
handleMarkerSizeChange = (markerSize: any) => {
|
|
70
|
+
return this.update({ markerSize })
|
|
71
|
+
}
|
|
72
|
+
handleLineWidthChange = (lineWidth: any) => {
|
|
73
|
+
return this.update({ lineWidth })
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
renderTable() {
|
|
77
|
+
return (
|
|
78
|
+
<div className="mb-3">
|
|
79
|
+
<label className="text-muted"><i className="fa fa-database" /> {T`Data Source`}</label>
|
|
80
|
+
<div style={{ marginLeft: 10 }}>
|
|
81
|
+
<TableSelectComponent
|
|
82
|
+
schema={this.props.schema}
|
|
83
|
+
value={this.props.design.table}
|
|
84
|
+
onChange={this.handleTableChange}
|
|
85
|
+
filter={this.props.design.filter}
|
|
86
|
+
onFilterChange={this.handleFilterChange}
|
|
87
|
+
/>
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
renderGeometryAxis() {
|
|
94
|
+
if (!this.props.design.table) {
|
|
95
|
+
return
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const title = <span><span className="fas fa-map-marker-alt" /> {T`Location`}</span>
|
|
99
|
+
|
|
100
|
+
const filters = _.clone(this.props.filters) || []
|
|
101
|
+
|
|
102
|
+
if (this.props.design.filter != null) {
|
|
103
|
+
const exprCompiler = new ExprCompiler(this.props.schema)
|
|
104
|
+
const jsonql = exprCompiler.compileExpr({ expr: this.props.design.filter, tableAlias: "{alias}" })
|
|
105
|
+
if (jsonql) {
|
|
106
|
+
filters.push({ table: (this.props.design.filter as OpExpr).table, jsonql })
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return (
|
|
111
|
+
<div className="mb-3">
|
|
112
|
+
<label className="text-muted">{title}</label>
|
|
113
|
+
<div style={{ marginLeft: 10 }}>
|
|
114
|
+
<AxisComponent
|
|
115
|
+
schema={this.props.schema}
|
|
116
|
+
dataSource={this.props.dataSource}
|
|
117
|
+
table={this.props.design.table}
|
|
118
|
+
types={["geometry"]}
|
|
119
|
+
aggrNeed="none"
|
|
120
|
+
value={this.props.design.axes.geometry}
|
|
121
|
+
onChange={this.handleGeometryAxisChange}
|
|
122
|
+
filters={filters}
|
|
123
|
+
/>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
renderColor() {
|
|
130
|
+
if (!this.props.design.axes.geometry) {
|
|
131
|
+
return
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const filters = _.clone(this.props.filters) || []
|
|
135
|
+
|
|
136
|
+
if (this.props.design.filter != null) {
|
|
137
|
+
const exprCompiler = new ExprCompiler(this.props.schema)
|
|
138
|
+
const jsonql = exprCompiler.compileExpr({ expr: this.props.design.filter, tableAlias: "{alias}" })
|
|
139
|
+
if (jsonql) {
|
|
140
|
+
filters.push({ table: (this.props.design.filter as OpExpr).table, jsonql })
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return (
|
|
145
|
+
<div>
|
|
146
|
+
{!this.props.design.axes.color ? (
|
|
147
|
+
<div className="mb-3">
|
|
148
|
+
<label className="text-muted"><span className="fas fa-tint" />{T`Color`}</label>
|
|
149
|
+
<div>
|
|
150
|
+
<ColorComponent
|
|
151
|
+
color={this.props.design.color}
|
|
152
|
+
onChange={this.handleColorChange}
|
|
153
|
+
/>
|
|
154
|
+
</div>
|
|
155
|
+
</div>
|
|
156
|
+
) : undefined}
|
|
157
|
+
|
|
158
|
+
<div className="mb-3">
|
|
159
|
+
<label className="text-muted"><span className="fas fa-tint" />{T`Color By Data`}</label>
|
|
160
|
+
<AxisComponent
|
|
161
|
+
schema={this.props.schema}
|
|
162
|
+
dataSource={this.props.dataSource}
|
|
163
|
+
table={this.props.design.table}
|
|
164
|
+
types={["text", "enum", "boolean", "date"]}
|
|
165
|
+
aggrNeed="none"
|
|
166
|
+
value={this.props.design.axes.color}
|
|
167
|
+
defaultColor={this.props.design.color}
|
|
168
|
+
showColorMap={true}
|
|
169
|
+
onChange={this.handleColorAxisChange}
|
|
170
|
+
allowExcludedValues={true}
|
|
171
|
+
filters={filters}
|
|
172
|
+
/>
|
|
173
|
+
</div>
|
|
174
|
+
</div>
|
|
175
|
+
)
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
renderSymbol() {
|
|
179
|
+
if (!this.props.design.axes.geometry) {
|
|
180
|
+
return
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return <MarkerSymbolSelectComponent symbol={this.props.design.symbol} onChange={this.handleSymbolChange} />
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
renderMarkerSize() {
|
|
187
|
+
if (!this.props.design.axes.geometry) {
|
|
188
|
+
return
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return (
|
|
192
|
+
<div className="mb-3">
|
|
193
|
+
<label className="text-muted">{T`Marker Size`}</label>
|
|
194
|
+
<ui.Select
|
|
195
|
+
value={this.props.design.markerSize || 10}
|
|
196
|
+
options={[
|
|
197
|
+
{ value: 5, label: T`Extra small` },
|
|
198
|
+
{ value: 8, label: T`Small` },
|
|
199
|
+
{ value: 10, label: T`Normal` },
|
|
200
|
+
{ value: 13, label: T`Large` },
|
|
201
|
+
{ value: 16, label: T`Extra large` }
|
|
202
|
+
]}
|
|
203
|
+
onChange={this.handleMarkerSizeChange}
|
|
204
|
+
/>
|
|
205
|
+
</div>
|
|
206
|
+
)
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
renderLineWidth() {
|
|
210
|
+
if (!this.props.design.axes.geometry) {
|
|
211
|
+
return
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return (
|
|
215
|
+
<div className="mb-3">
|
|
216
|
+
<label className="text-muted">{T`Line Width (for shapes)`}</label>
|
|
217
|
+
<ui.Select
|
|
218
|
+
value={this.props.design.lineWidth != null ? this.props.design.lineWidth : 3}
|
|
219
|
+
options={[
|
|
220
|
+
{ value: 0, label: T`None` },
|
|
221
|
+
{ value: 1, label: T`1 pixel` },
|
|
222
|
+
{ value: 2, label: T`2 pixels` },
|
|
223
|
+
{ value: 3, label: T`3 pixels` },
|
|
224
|
+
{ value: 4, label: T`4 pixels` },
|
|
225
|
+
{ value: 5, label: T`5 pixels` },
|
|
226
|
+
{ value: 6, label: T`6 pixels` }
|
|
227
|
+
]}
|
|
228
|
+
onChange={this.handleLineWidthChange}
|
|
229
|
+
/>
|
|
230
|
+
</div>
|
|
231
|
+
)
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
renderPolygonBorderColor() {
|
|
235
|
+
if (!this.props.design.axes.geometry) {
|
|
236
|
+
return
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
return (
|
|
240
|
+
<div className="mb-3">
|
|
241
|
+
<label className="text-muted">{T`Polygon border color (blank for same as fill color)`}</label>
|
|
242
|
+
<div>
|
|
243
|
+
<ColorComponent
|
|
244
|
+
color={this.props.design.polygonBorderColor}
|
|
245
|
+
onChange={this.handlePolygonBorderColorChange}
|
|
246
|
+
/>
|
|
247
|
+
</div>
|
|
248
|
+
</div>
|
|
249
|
+
)
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
renderPolygonFillOpacity() {
|
|
253
|
+
if (!this.props.design.axes.geometry) {
|
|
254
|
+
return
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
const opacity = this.props.design.polygonFillOpacity != null ? this.props.design.polygonFillOpacity : 0.25
|
|
258
|
+
|
|
259
|
+
return (
|
|
260
|
+
<div className="mb-3">
|
|
261
|
+
<label className="text-muted"><span>{T`Polygon Fill Opacity: ${Math.round(opacity * 100)}%`}</span></label>
|
|
262
|
+
<div style={{ padding: "10px" }}>
|
|
263
|
+
<Rcslider
|
|
264
|
+
min={0}
|
|
265
|
+
max={100}
|
|
266
|
+
step={1}
|
|
267
|
+
tipTransitionName="rc-slider-tooltip-zoom-down"
|
|
268
|
+
value={opacity * 100}
|
|
269
|
+
onChange={this.handlePolygonFillOpacityChange}
|
|
270
|
+
/>
|
|
271
|
+
</div>
|
|
272
|
+
</div>
|
|
273
|
+
)
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
renderFilter() {
|
|
277
|
+
// If no data, hide
|
|
278
|
+
if (!this.props.design.axes.geometry) {
|
|
279
|
+
return null
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
return (
|
|
283
|
+
<div className="mb-3">
|
|
284
|
+
<label className="text-muted"><span className="fas fa-filter" />{T`Filters`}</label>
|
|
285
|
+
<div style={{ marginLeft: 8 }}>
|
|
286
|
+
<FilterExprComponent
|
|
287
|
+
schema={this.props.schema}
|
|
288
|
+
dataSource={this.props.dataSource}
|
|
289
|
+
onChange={this.handleFilterChange}
|
|
290
|
+
table={this.props.design.table}
|
|
291
|
+
value={this.props.design.filter}
|
|
292
|
+
/>
|
|
293
|
+
</div>
|
|
294
|
+
</div>
|
|
295
|
+
)
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
renderPopup() {
|
|
299
|
+
if (!this.props.design.table) {
|
|
300
|
+
return null
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
return (
|
|
304
|
+
<EditPopupComponent
|
|
305
|
+
design={this.props.design}
|
|
306
|
+
onDesignChange={this.props.onDesignChange}
|
|
307
|
+
schema={this.props.schema}
|
|
308
|
+
dataSource={this.props.dataSource}
|
|
309
|
+
table={this.props.design.table}
|
|
310
|
+
idTable={this.props.design.table}
|
|
311
|
+
defaultPopupFilterJoins={PopupFilterJoinsUtils.createDefaultPopupFilterJoins(this.props.design.table)}
|
|
312
|
+
/>
|
|
313
|
+
)
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
renderHoverOver() {
|
|
317
|
+
if (!this.props.design.table) {
|
|
318
|
+
return null
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
return (
|
|
322
|
+
<EditHoverOver
|
|
323
|
+
design={this.props.design}
|
|
324
|
+
onDesignChange={this.props.onDesignChange}
|
|
325
|
+
schema={this.props.schema}
|
|
326
|
+
dataSource={this.props.dataSource}
|
|
327
|
+
table={this.props.design.table}
|
|
328
|
+
idTable={this.props.design.table}
|
|
329
|
+
defaultPopupFilterJoins={PopupFilterJoinsUtils.createDefaultPopupFilterJoins(this.props.design.table)}
|
|
330
|
+
aggrStatuses={["individual", "literal"]}
|
|
331
|
+
/>
|
|
332
|
+
)
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
render() {
|
|
336
|
+
return (
|
|
337
|
+
<div>
|
|
338
|
+
{this.renderTable()}
|
|
339
|
+
{this.renderGeometryAxis()}
|
|
340
|
+
{this.renderColor()}
|
|
341
|
+
{this.renderSymbol()}
|
|
342
|
+
{this.renderMarkerSize()}
|
|
343
|
+
<ui.CollapsibleSection
|
|
344
|
+
label={T`Shape Options`}
|
|
345
|
+
labelMuted={true}
|
|
346
|
+
>
|
|
347
|
+
{this.renderLineWidth()}
|
|
348
|
+
{this.renderPolygonBorderColor()}
|
|
349
|
+
{this.renderPolygonFillOpacity()}
|
|
350
|
+
</ui.CollapsibleSection>
|
|
351
|
+
{this.renderFilter()}
|
|
352
|
+
{this.renderPopup()}
|
|
353
|
+
{this.renderHoverOver()}
|
|
354
|
+
{this.props.design.table ? (
|
|
355
|
+
<ZoomLevelsComponent design={this.props.design} onDesignChange={this.props.onDesignChange} />
|
|
356
|
+
) : undefined}
|
|
357
|
+
</div>
|
|
358
|
+
)
|
|
359
|
+
}
|
|
360
|
+
}
|
|
@@ -214,12 +214,6 @@ class ServerLayerDataSource implements MapLayerDataSource {
|
|
|
214
214
|
|
|
215
215
|
let url = `${this.options.apiUrl}maps/tiles/{z}/{x}/{y}.${extension}?` + querystring.stringify(query)
|
|
216
216
|
|
|
217
|
-
// Add subdomains: {s} will be substituted with "a", "b" or "c" in leaflet for api.mwater.co only.
|
|
218
|
-
// Used to speed queries
|
|
219
|
-
if (url.match(/^https:\/\/api\.mwater\.co\//)) {
|
|
220
|
-
url = url.replace(/^https:\/\/api\.mwater\.co\//, "https://{s}-api.mwater.co/")
|
|
221
|
-
}
|
|
222
|
-
|
|
223
217
|
return url
|
|
224
218
|
}
|
|
225
219
|
|
|
@@ -228,12 +222,6 @@ class ServerLayerDataSource implements MapLayerDataSource {
|
|
|
228
222
|
let where
|
|
229
223
|
let url = `${this.options.apiUrl}maps/tiles/{z}/{x}/{y}.${extension}?type=${design.type}&radius=1000`
|
|
230
224
|
|
|
231
|
-
// Add subdomains: {s} will be substituted with "a", "b" or "c" in leaflet for api.mwater.co only.
|
|
232
|
-
// Used to speed queries
|
|
233
|
-
if (url.match(/^https:\/\/api\.mwater\.co\//)) {
|
|
234
|
-
url = url.replace(/^https:\/\/api\.mwater\.co\//, "https://{s}-api.mwater.co/")
|
|
235
|
-
}
|
|
236
|
-
|
|
237
225
|
if (this.options.client) {
|
|
238
226
|
url += `&client=${this.options.client}`
|
|
239
227
|
}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import _, { find } from "lodash"
|
|
2
2
|
import { LayerSpecification, MapLayerMouseEvent } from "maplibre-gl"
|
|
3
|
-
import { DataSource, Schema } from "@mwater/expressions"
|
|
4
3
|
import React, { CSSProperties, ReactNode, useEffect, useMemo, useState } from "react"
|
|
5
4
|
import { useRef } from "react"
|
|
6
5
|
import { JsonQLFilter } from "../JsonQLFilter"
|
|
7
6
|
import { default as LayerFactory } from "./LayerFactory"
|
|
8
|
-
import { MapBounds,
|
|
9
|
-
import { MapDataSource } from "./MapDataSource"
|
|
7
|
+
import { MapBounds, MapLayerView } from "./MapDesign"
|
|
10
8
|
import ModalPopupComponent from "@mwater/react-library/lib/ModalPopupComponent"
|
|
11
9
|
import { useStableCallback } from "@mwater/react-library/lib/useStableCallback"
|
|
12
10
|
import {
|
|
@@ -278,18 +276,9 @@ export function VectorMapViewComponent(props: VectorMapViewComponentProps) {
|
|
|
278
276
|
} else {
|
|
279
277
|
const tileUrl = props.mapDataSource.getLayerDataSource(layerView.id).getTileUrl(design, [])
|
|
280
278
|
if (tileUrl) {
|
|
281
|
-
// Replace "{s}" with "a", "b", "c"
|
|
282
|
-
let tiles: string[] = []
|
|
283
|
-
|
|
284
|
-
if (tileUrl.includes("{s}")) {
|
|
285
|
-
tiles = [tileUrl.replace("{s}", "a"), tileUrl.replace("{s}", "b"), tileUrl.replace("{s}", "c")]
|
|
286
|
-
} else {
|
|
287
|
-
tiles = [tileUrl]
|
|
288
|
-
}
|
|
289
|
-
|
|
290
279
|
newSources[layerView.id] = {
|
|
291
280
|
type: "raster",
|
|
292
|
-
tiles,
|
|
281
|
+
tiles: [tileUrl],
|
|
293
282
|
tileSize: 256
|
|
294
283
|
}
|
|
295
284
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|