@mwater/visualization 5.4.5 → 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/MWaterContextComponent.js +1 -1
- package/lib/MWaterGlobalFiltersComponent.d.ts +2 -2
- package/lib/MWaterGlobalFiltersComponent.js +11 -20
- package/lib/MWaterLoaderComponent.d.ts +5 -14
- package/lib/MWaterLoaderComponent.js +2 -11
- package/lib/UndoStack.d.ts +2 -1
- package/lib/UndoStack.js +12 -6
- package/lib/dashboards/DashboardComponent.js +7 -5
- package/lib/dashboards/DashboardDesign.d.ts +1 -1
- package/lib/dashboards/LayoutOptionsComponent.js +18 -11
- package/lib/dashboards/ServerDashboardDataSource.d.ts +10 -1
- package/lib/dashboards/ServerDashboardDataSource.js +29 -10
- package/lib/dashboards/SettingsModalComponent.js +1 -1
- package/lib/dashboards/layoutOptions.d.ts +5 -1
- package/lib/datagrids/DatagridComponent.js +23 -3
- 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/ExprCellComponent.d.ts +1 -0
- package/lib/datagrids/ExprCellComponent.js +22 -20
- package/lib/datagrids/OrderBysDesignerComponent.d.ts +7 -7
- package/lib/datagrids/OrderBysDesignerComponent.js +19 -28
- package/lib/index.css +45 -2
- package/lib/index.d.ts +5 -5
- package/lib/index.js +2 -3
- package/lib/layouts/blocks/BlocksDisplayComponent.d.ts +8 -1
- package/lib/layouts/blocks/BlocksDisplayComponent.js +46 -4
- package/lib/maps/BufferLayer.d.ts +18 -0
- package/lib/maps/BufferLayer.js +36 -14
- package/lib/maps/BufferLayerDesign.d.ts +1 -1
- package/lib/maps/BufferLayerDesignerComponent.js +2 -2
- package/lib/maps/ChoroplethLayer.d.ts +18 -0
- package/lib/maps/ChoroplethLayer.js +46 -25
- package/lib/maps/ChoroplethLayerDesign.d.ts +7 -3
- package/lib/maps/ChoroplethLayerDesigner.d.ts +10 -22
- package/lib/maps/ChoroplethLayerDesigner.js +58 -89
- package/lib/maps/DirectMapDataSource.js +17 -10
- package/lib/maps/EditHoverOver.d.ts +4 -3
- package/lib/maps/EditHoverOver.js +64 -35
- package/lib/maps/HoverContent.d.ts +10 -5
- package/lib/maps/HoverContent.js +7 -36
- package/lib/maps/Layer.d.ts +37 -0
- package/lib/maps/Layer.js +30 -4
- package/lib/maps/LeafletMapComponent.js +10 -19
- package/lib/maps/MWaterServerLayer.d.ts +2 -2
- package/lib/maps/MWaterServerLayer.js +6 -6
- package/lib/maps/MapComponent.js +0 -1
- package/lib/maps/MapLayerDataSource.d.ts +9 -0
- package/lib/maps/MapUtils.d.ts +19 -1
- package/lib/maps/MapUtils.js +80 -1
- package/lib/maps/MarkersLayer.d.ts +18 -0
- package/lib/maps/MarkersLayer.js +42 -26
- package/lib/maps/MarkersLayerDesign.d.ts +1 -1
- package/lib/maps/MarkersLayerDesignerComponent.d.ts +12 -28
- package/lib/maps/MarkersLayerDesignerComponent.js +81 -111
- package/lib/maps/RasterMapViewComponent.js +1 -1
- package/lib/maps/ServerMapDataSource.d.ts +9 -0
- package/lib/maps/ServerMapDataSource.js +29 -10
- package/lib/maps/VectorMapViewComponent.js +7 -15
- package/lib/maps/maps.d.ts +4 -2
- 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/FormsListComponent.d.ts +33 -0
- package/lib/mwater_table_selection/FormsListComponent.js +141 -0
- package/lib/mwater_table_selection/IndicatorsListComponent.d.ts +49 -0
- package/lib/mwater_table_selection/IndicatorsListComponent.js +251 -0
- package/lib/mwater_table_selection/IssuesListComponent.d.ts +29 -0
- package/lib/mwater_table_selection/IssuesListComponent.js +123 -0
- package/lib/mwater_table_selection/MWaterAccountingSystemListComponent.d.ts +20 -0
- package/lib/mwater_table_selection/MWaterAccountingSystemListComponent.js +157 -0
- package/lib/mwater_table_selection/MWaterAssetSystemsListComponent.d.ts +17 -0
- package/lib/mwater_table_selection/MWaterAssetSystemsListComponent.js +79 -0
- 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 +63 -0
- package/lib/mwater_table_selection/MWaterCompleteTableSelectComponent.js +461 -0
- package/lib/mwater_table_selection/MWaterCustomTablesetListComponent.d.ts +17 -0
- package/lib/mwater_table_selection/MWaterCustomTablesetListComponent.js +94 -0
- package/lib/mwater_table_selection/MWaterMetricsTableListComponent.d.ts +17 -0
- package/lib/mwater_table_selection/MWaterMetricsTableListComponent.js +80 -0
- package/lib/mwater_table_selection/MWaterTableSelectComponent.d.ts +32 -0
- package/lib/mwater_table_selection/MWaterTableSelectComponent.js +163 -0
- 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/charts/Chart.d.ts +11 -0
- package/lib/widgets/charts/Chart.js +15 -0
- package/lib/widgets/charts/ChartWidgetComponent.d.ts +1 -0
- package/lib/widgets/charts/ChartWidgetComponent.js +27 -1
- package/lib/widgets/charts/layered/LayeredChartDesign.d.ts +1 -1
- package/lib/widgets/charts/layered/LayeredChartDesignerComponent.d.ts +1 -1
- package/lib/widgets/charts/layered/LayeredChartDesignerComponent.js +5 -12
- package/lib/widgets/charts/layered/LayeredChartLayerDesignerComponent.d.ts +43 -57
- package/lib/widgets/charts/layered/LayeredChartLayerDesignerComponent.js +113 -110
- package/lib/widgets/charts/layered/LayeredChartUtils.d.ts +2 -1
- package/lib/widgets/charts/layered/LayeredChartUtils.js +0 -2
- package/lib/widgets/charts/pivot/PivotChart.d.ts +2 -0
- package/lib/widgets/charts/pivot/PivotChart.js +156 -0
- package/lib/widgets/charts/pivot/PivotChartDesignerComponent.d.ts +5 -20
- package/lib/widgets/charts/pivot/PivotChartDesignerComponent.js +31 -61
- package/lib/widgets/charts/pivot/PivotChartLayoutBuilder.d.ts +4 -0
- package/lib/widgets/charts/pivot/PivotChartLayoutBuilder.js +4 -2
- package/lib/widgets/charts/pivot/PivotChartLayoutComponent.d.ts +5 -44
- package/lib/widgets/charts/pivot/PivotChartLayoutComponent.js +38 -63
- package/lib/widgets/charts/pivot/SegmentDesignerComponent.d.ts +7 -68
- package/lib/widgets/charts/pivot/SegmentDesignerComponent.js +58 -106
- package/lib/widgets/charts/table/TableChart.d.ts +2 -0
- package/lib/widgets/charts/table/TableChart.js +172 -1
- package/lib/widgets/charts/table/TableChartDesignerComponent.d.ts +7 -17
- package/lib/widgets/charts/table/TableChartDesignerComponent.js +79 -95
- package/lib/widgets/charts/table/TableChartViewComponent.d.ts +1 -7
- package/lib/widgets/charts/table/TableChartViewComponent.js +19 -27
- 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 +4 -10
- package/src/MWaterContextComponent.tsx +2 -2
- package/src/{MWaterGlobalFiltersComponent.ts → MWaterGlobalFiltersComponent.tsx} +32 -33
- package/src/{MWaterLoaderComponent.ts → MWaterLoaderComponent.tsx} +18 -19
- package/src/UndoStack.ts +14 -6
- package/src/dashboards/DashboardComponent.tsx +7 -5
- package/src/dashboards/DashboardDesign.ts +1 -1
- package/src/dashboards/LayoutOptionsComponent.tsx +22 -10
- package/src/dashboards/ServerDashboardDataSource.ts +36 -13
- package/src/dashboards/SettingsModalComponent.tsx +1 -1
- package/src/dashboards/layoutOptions.tsx +5 -1
- package/src/datagrids/DatagridComponent.tsx +31 -3
- package/src/datagrids/DatagridDesignerComponent.tsx +241 -229
- package/src/datagrids/DatagridViewComponent.tsx +3 -2
- package/src/datagrids/ExprCellComponent.tsx +23 -20
- 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 +48 -20
- package/src/maps/BufferLayerDesign.ts +1 -1
- package/src/maps/BufferLayerDesignerComponent.tsx +2 -1
- package/src/maps/ChoroplethLayer.ts +70 -39
- package/src/maps/ChoroplethLayerDesign.ts +6 -2
- package/src/maps/ChoroplethLayerDesigner.tsx +171 -167
- package/src/maps/DirectMapDataSource.ts +21 -13
- package/src/maps/EditHoverOver.tsx +98 -54
- package/src/maps/HoverContent.tsx +17 -48
- package/src/maps/Layer.ts +42 -4
- package/src/maps/LeafletMapComponent.tsx +10 -19
- package/src/maps/MWaterServerLayer.ts +6 -6
- package/src/maps/MapComponent.ts +0 -1
- package/src/maps/MapLayerDataSource.ts +8 -0
- package/src/maps/MapUtils.ts +82 -3
- package/src/maps/MarkersLayer.ts +54 -27
- package/src/maps/MarkersLayerDesign.ts +1 -1
- package/src/maps/MarkersLayerDesignerComponent.tsx +360 -0
- package/src/maps/RasterMapViewComponent.ts +1 -1
- package/src/maps/ServerMapDataSource.ts +35 -12
- package/src/maps/VectorMapViewComponent.tsx +8 -19
- package/src/maps/maps.ts +4 -2
- 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/FormsListComponent.tsx +188 -0
- package/src/mwater_table_selection/IndicatorsListComponent.tsx +411 -0
- package/src/mwater_table_selection/IssuesListComponent.tsx +167 -0
- package/src/mwater_table_selection/MWaterAccountingSystemListComponent.tsx +225 -0
- package/src/{MWaterAssetSystemsListComponent.tsx → mwater_table_selection/MWaterAssetSystemsListComponent.tsx} +2 -2
- package/src/mwater_table_selection/MWaterCalculatedDataSourcesListComponent.tsx +111 -0
- package/src/mwater_table_selection/MWaterCompleteTableSelectComponent.tsx +713 -0
- package/src/{MWaterCustomTablesetListComponent.tsx → mwater_table_selection/MWaterCustomTablesetListComponent.tsx} +1 -1
- package/src/{MWaterMetricsTableListComponent.tsx → mwater_table_selection/MWaterMetricsTableListComponent.tsx} +1 -1
- package/src/{MWaterTableSelectComponent.tsx → mwater_table_selection/MWaterTableSelectComponent.tsx} +91 -90
- 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/charts/Chart.ts +17 -0
- package/src/widgets/charts/ChartWidgetComponent.tsx +36 -1
- package/src/widgets/charts/layered/LayeredChartDesign.ts +1 -1
- package/src/widgets/charts/layered/LayeredChartDesignerComponent.tsx +23 -24
- package/src/widgets/charts/layered/LayeredChartLayerDesignerComponent.tsx +260 -211
- package/src/widgets/charts/layered/LayeredChartUtils.ts +7 -7
- package/src/widgets/charts/pivot/PivotChart.ts +191 -0
- package/src/widgets/charts/pivot/PivotChartDesignerComponent.tsx +124 -129
- package/src/widgets/charts/pivot/PivotChartLayoutBuilder.ts +4 -2
- package/src/widgets/charts/pivot/PivotChartLayoutComponent.tsx +120 -149
- package/src/widgets/charts/pivot/SegmentDesignerComponent.tsx +178 -198
- package/src/widgets/charts/table/TableChart.ts +177 -1
- package/src/widgets/charts/table/TableChartDesignerComponent.tsx +422 -0
- package/src/widgets/charts/table/{TableChartViewComponent.ts → TableChartViewComponent.tsx} +65 -60
- 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 -4
- package/.storybook/webpack.config.js +0 -15
- package/src/MWaterCompleteTableSelectComponent.tsx +0 -975
- package/src/maps/BingLayer.ts +0 -146
- package/src/maps/MarkersLayerDesignerComponent.ts +0 -374
- package/src/quickfilter/TextLiteralComponent.ts +0 -165
- package/src/widgets/charts/table/TableChartDesignerComponent.ts +0 -441
- 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/BingLayer.ts
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (c) 2011-2014, Pavel Shramov, Bruno Bergot
|
|
3
|
-
All rights reserved.
|
|
4
|
-
|
|
5
|
-
Redistribution and use in source and binary forms, with or without modification, are
|
|
6
|
-
permitted provided that the following conditions are met:
|
|
7
|
-
|
|
8
|
-
1. Redistributions of source code must retain the above copyright notice, this list of
|
|
9
|
-
conditions and the following disclaimer.
|
|
10
|
-
|
|
11
|
-
2. Redistributions in binary form must reproduce the above copyright notice, this list
|
|
12
|
-
of conditions and the following disclaimer in the documentation and/or other materials
|
|
13
|
-
provided with the distribution.
|
|
14
|
-
|
|
15
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
|
16
|
-
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
17
|
-
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
18
|
-
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
19
|
-
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
20
|
-
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
21
|
-
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
|
22
|
-
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
23
|
-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
import L from "leaflet"
|
|
27
|
-
|
|
28
|
-
module.exports = L.TileLayer.extend({
|
|
29
|
-
options: {
|
|
30
|
-
subdomains: [0, 1, 2, 3],
|
|
31
|
-
type: "Aerial",
|
|
32
|
-
attribution: "Bing",
|
|
33
|
-
culture: "",
|
|
34
|
-
maxZoom: 21,
|
|
35
|
-
maxNativeZoom: 19
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
initialize: function (key: any, options: any) {
|
|
39
|
-
L.Util.setOptions(this, options)
|
|
40
|
-
|
|
41
|
-
this._key = key
|
|
42
|
-
this._url = null
|
|
43
|
-
this.meta = {}
|
|
44
|
-
this.loadMetadata()
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
tile2quad: function (x: any, y: any, z: any) {
|
|
48
|
-
var quad = ""
|
|
49
|
-
for (var i = z; i > 0; i--) {
|
|
50
|
-
var digit = 0
|
|
51
|
-
var mask = 1 << (i - 1)
|
|
52
|
-
if ((x & mask) !== 0) digit += 1
|
|
53
|
-
if ((y & mask) !== 0) digit += 2
|
|
54
|
-
quad = quad + digit
|
|
55
|
-
}
|
|
56
|
-
return quad
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
getTileUrl: function (p: any, z: any) {
|
|
60
|
-
var zoom = this._getZoomForUrl()
|
|
61
|
-
var subdomains = this.options.subdomains,
|
|
62
|
-
s = this.options.subdomains[Math.abs((p.x + p.y) % subdomains.length)]
|
|
63
|
-
return this._url
|
|
64
|
-
.replace("{subdomain}", s)
|
|
65
|
-
.replace("{quadkey}", this.tile2quad(p.x, p.y, zoom))
|
|
66
|
-
.replace("{culture}", this.options.culture)
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
loadMetadata: function () {
|
|
70
|
-
var _this = this
|
|
71
|
-
var url = `https://dev.virtualearth.net/REST/v1/Imagery/Metadata/${this.options.type}?include=ImageryProviders&key=${this._key}&UriScheme=https`
|
|
72
|
-
|
|
73
|
-
fetch(url)
|
|
74
|
-
.then(response => response.json())
|
|
75
|
-
.then(meta => {
|
|
76
|
-
_this.meta = meta
|
|
77
|
-
if (meta.errorDetails) {
|
|
78
|
-
return
|
|
79
|
-
}
|
|
80
|
-
_this.initMetadata()
|
|
81
|
-
})
|
|
82
|
-
.catch(error => console.error('Error loading Bing Maps metadata:', error))
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
initMetadata: function () {
|
|
86
|
-
var r = this.meta.resourceSets[0].resources[0]
|
|
87
|
-
if (!r) {
|
|
88
|
-
console.error("Error loading Bing Maps metadata")
|
|
89
|
-
return
|
|
90
|
-
}
|
|
91
|
-
this.options.subdomains = r.imageUrlSubdomains
|
|
92
|
-
this._url = r.imageUrl
|
|
93
|
-
this._providers = []
|
|
94
|
-
if (r.imageryProviders) {
|
|
95
|
-
for (var i = 0; i < r.imageryProviders.length; i++) {
|
|
96
|
-
var p = r.imageryProviders[i]
|
|
97
|
-
for (var j = 0; j < p.coverageAreas.length; j++) {
|
|
98
|
-
var c = p.coverageAreas[j]
|
|
99
|
-
var coverage: any = { zoomMin: c.zoomMin, zoomMax: c.zoomMax, active: false }
|
|
100
|
-
var bounds = new L.LatLngBounds(
|
|
101
|
-
new L.LatLng(c.bbox[0] + 0.01, c.bbox[1] + 0.01),
|
|
102
|
-
new L.LatLng(c.bbox[2] - 0.01, c.bbox[3] - 0.01)
|
|
103
|
-
)
|
|
104
|
-
coverage.bounds = bounds
|
|
105
|
-
coverage.attrib = p.attribution
|
|
106
|
-
this._providers.push(coverage)
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
this._update()
|
|
111
|
-
},
|
|
112
|
-
|
|
113
|
-
_update: function () {
|
|
114
|
-
if (this._url === null || !this._map) return
|
|
115
|
-
this._update_attribution()
|
|
116
|
-
;(L.TileLayer.prototype as any)._update.apply(this, [])
|
|
117
|
-
},
|
|
118
|
-
|
|
119
|
-
_update_attribution: function () {
|
|
120
|
-
var bounds = this._map.getBounds()
|
|
121
|
-
var zoom = this._map.getZoom()
|
|
122
|
-
for (var i = 0; i < this._providers.length; i++) {
|
|
123
|
-
var p = this._providers[i]
|
|
124
|
-
if (zoom <= p.zoomMax && zoom >= p.zoomMin && bounds.intersects(p.bounds)) {
|
|
125
|
-
if (!p.active && this._map.attributionControl) this._map.attributionControl.addAttribution(p.attrib)
|
|
126
|
-
p.active = true
|
|
127
|
-
} else {
|
|
128
|
-
if (p.active && this._map.attributionControl) this._map.attributionControl.removeAttribution(p.attrib)
|
|
129
|
-
p.active = false
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
|
|
134
|
-
onRemove: function (map: any) {
|
|
135
|
-
if (this._providers) {
|
|
136
|
-
for (var i = 0; i < this._providers.length; i++) {
|
|
137
|
-
var p = this._providers[i]
|
|
138
|
-
if (p.active && this._map.attributionControl) {
|
|
139
|
-
this._map.attributionControl.removeAttribution(p.attrib)
|
|
140
|
-
p.active = false
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
L.TileLayer.prototype.onRemove.apply(this, [map])
|
|
145
|
-
}
|
|
146
|
-
})
|
|
@@ -1,374 +0,0 @@
|
|
|
1
|
-
import _ from "lodash"
|
|
2
|
-
import React from "react"
|
|
3
|
-
const R = React.createElement
|
|
4
|
-
import { FilterExprComponent } from "@mwater/expressions-ui"
|
|
5
|
-
import { DataSource, ExprUtils, OpExpr, Schema } from "@mwater/expressions"
|
|
6
|
-
import { ExprCompiler } from "@mwater/expressions"
|
|
7
|
-
import AxisComponent from "./../axes/AxisComponent"
|
|
8
|
-
import ColorComponent from "../ColorComponent"
|
|
9
|
-
import { TableSelectComponent } from "@mwater/expressions-ui"
|
|
10
|
-
import EditPopupComponent from "./EditPopupComponent"
|
|
11
|
-
import ZoomLevelsComponent from "./ZoomLevelsComponent"
|
|
12
|
-
import MarkerSymbolSelectComponent from "./MarkerSymbolSelectComponent"
|
|
13
|
-
import * as PopupFilterJoinsUtils from "./PopupFilterJoinsUtils"
|
|
14
|
-
import * as ui from "@mwater/react-library/lib/bootstrap"
|
|
15
|
-
import EditHoverOver from "./EditHoverOver"
|
|
16
|
-
import { MarkersLayerDesign } from "./MarkersLayerDesign"
|
|
17
|
-
import { default as Rcslider } from "rc-slider"
|
|
18
|
-
|
|
19
|
-
export interface MarkersLayerDesignerComponentProps {
|
|
20
|
-
/** Schema to use */
|
|
21
|
-
schema: Schema
|
|
22
|
-
dataSource: DataSource
|
|
23
|
-
/** Design of the marker layer */
|
|
24
|
-
design: MarkersLayerDesign
|
|
25
|
-
/** Called with new design */
|
|
26
|
-
onDesignChange: any
|
|
27
|
-
filters?: any
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Designer for a markers layer
|
|
31
|
-
export default class MarkersLayerDesignerComponent extends React.Component<MarkersLayerDesignerComponentProps> {
|
|
32
|
-
// Apply updates to design
|
|
33
|
-
update(updates: any) {
|
|
34
|
-
return this.props.onDesignChange(_.extend({}, this.props.design, updates))
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// Update axes with specified changes
|
|
38
|
-
updateAxes(changes: any) {
|
|
39
|
-
const axes = _.extend({}, this.props.design.axes, changes)
|
|
40
|
-
return this.update({ axes })
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
handleTableChange = (table: any) => {
|
|
44
|
-
return this.update({ table })
|
|
45
|
-
}
|
|
46
|
-
handleGeometryAxisChange = (axis: any) => {
|
|
47
|
-
return this.updateAxes({ geometry: axis })
|
|
48
|
-
}
|
|
49
|
-
handleColorAxisChange = (axis: any) => {
|
|
50
|
-
return this.updateAxes({ color: axis })
|
|
51
|
-
}
|
|
52
|
-
handleFilterChange = (expr: any) => {
|
|
53
|
-
return this.update({ filter: expr })
|
|
54
|
-
}
|
|
55
|
-
handleColorChange = (color: any) => {
|
|
56
|
-
return this.update({ color })
|
|
57
|
-
}
|
|
58
|
-
handlePolygonBorderColorChange = (polygonBorderColor: any) => {
|
|
59
|
-
return this.update({ polygonBorderColor })
|
|
60
|
-
}
|
|
61
|
-
handlePolygonFillOpacityChange = (polygonFillOpacity: any) => {
|
|
62
|
-
return this.update({ polygonFillOpacity: polygonFillOpacity / 100 })
|
|
63
|
-
}
|
|
64
|
-
handleSymbolChange = (symbol: any) => {
|
|
65
|
-
return this.update({ symbol })
|
|
66
|
-
}
|
|
67
|
-
handleNameChange = (e: any) => {
|
|
68
|
-
return this.update({ name: e.target.value })
|
|
69
|
-
}
|
|
70
|
-
handleMarkerSizeChange = (markerSize: any) => {
|
|
71
|
-
return this.update({ markerSize })
|
|
72
|
-
}
|
|
73
|
-
handleLineWidthChange = (lineWidth: any) => {
|
|
74
|
-
return this.update({ lineWidth })
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
renderTable() {
|
|
78
|
-
return R(
|
|
79
|
-
"div",
|
|
80
|
-
{ className: "mb-3" },
|
|
81
|
-
R("label", { className: "text-muted" }, R("i", { className: "fa fa-database" }), " ", T`Data Source`),
|
|
82
|
-
R(
|
|
83
|
-
"div",
|
|
84
|
-
{ style: { marginLeft: 10 } },
|
|
85
|
-
R(TableSelectComponent, {
|
|
86
|
-
schema: this.props.schema,
|
|
87
|
-
value: this.props.design.table,
|
|
88
|
-
onChange: this.handleTableChange,
|
|
89
|
-
filter: this.props.design.filter,
|
|
90
|
-
onFilterChange: this.handleFilterChange
|
|
91
|
-
})
|
|
92
|
-
)
|
|
93
|
-
)
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
renderGeometryAxis() {
|
|
97
|
-
if (!this.props.design.table) {
|
|
98
|
-
return
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const title = R("span", null, R("span", { className: "fas fa-map-marker-alt" }), " ", T`Location`)
|
|
102
|
-
|
|
103
|
-
const filters = _.clone(this.props.filters) || []
|
|
104
|
-
|
|
105
|
-
if (this.props.design.filter != null) {
|
|
106
|
-
const exprCompiler = new ExprCompiler(this.props.schema)
|
|
107
|
-
const jsonql = exprCompiler.compileExpr({ expr: this.props.design.filter, tableAlias: "{alias}" })
|
|
108
|
-
if (jsonql) {
|
|
109
|
-
filters.push({ table: (this.props.design.filter as OpExpr).table, jsonql })
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
return R(
|
|
114
|
-
"div",
|
|
115
|
-
{ className: "mb-3" },
|
|
116
|
-
R("label", { className: "text-muted" }, title),
|
|
117
|
-
R(
|
|
118
|
-
"div",
|
|
119
|
-
{ style: { marginLeft: 10 } },
|
|
120
|
-
R(AxisComponent, {
|
|
121
|
-
schema: this.props.schema,
|
|
122
|
-
dataSource: this.props.dataSource,
|
|
123
|
-
table: this.props.design.table,
|
|
124
|
-
types: ["geometry"],
|
|
125
|
-
aggrNeed: "none",
|
|
126
|
-
value: this.props.design.axes.geometry,
|
|
127
|
-
onChange: this.handleGeometryAxisChange,
|
|
128
|
-
filters
|
|
129
|
-
})
|
|
130
|
-
)
|
|
131
|
-
)
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
renderColor() {
|
|
135
|
-
if (!this.props.design.axes.geometry) {
|
|
136
|
-
return
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
const filters = _.clone(this.props.filters) || []
|
|
140
|
-
|
|
141
|
-
if (this.props.design.filter != null) {
|
|
142
|
-
const exprCompiler = new ExprCompiler(this.props.schema)
|
|
143
|
-
const jsonql = exprCompiler.compileExpr({ expr: this.props.design.filter, tableAlias: "{alias}" })
|
|
144
|
-
if (jsonql) {
|
|
145
|
-
filters.push({ table: (this.props.design.filter as OpExpr).table, jsonql })
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
return R(
|
|
150
|
-
"div",
|
|
151
|
-
null,
|
|
152
|
-
!this.props.design.axes.color
|
|
153
|
-
? R(
|
|
154
|
-
"div",
|
|
155
|
-
{ className: "mb-3" },
|
|
156
|
-
R("label", { className: "text-muted" }, R("span", { className: "fas fa-tint" }), T`Color`),
|
|
157
|
-
|
|
158
|
-
R(
|
|
159
|
-
"div",
|
|
160
|
-
null,
|
|
161
|
-
R(ColorComponent, {
|
|
162
|
-
color: this.props.design.color,
|
|
163
|
-
onChange: this.handleColorChange
|
|
164
|
-
})
|
|
165
|
-
)
|
|
166
|
-
)
|
|
167
|
-
: undefined,
|
|
168
|
-
|
|
169
|
-
R(
|
|
170
|
-
"div",
|
|
171
|
-
{ className: "mb-3" },
|
|
172
|
-
R("label", { className: "text-muted" }, R("span", { className: "fas fa-tint" }), T`Color By Data`),
|
|
173
|
-
|
|
174
|
-
R(AxisComponent, {
|
|
175
|
-
schema: this.props.schema,
|
|
176
|
-
dataSource: this.props.dataSource,
|
|
177
|
-
table: this.props.design.table,
|
|
178
|
-
types: ["text", "enum", "boolean", "date"],
|
|
179
|
-
aggrNeed: "none",
|
|
180
|
-
value: this.props.design.axes.color,
|
|
181
|
-
defaultColor: this.props.design.color,
|
|
182
|
-
showColorMap: true,
|
|
183
|
-
onChange: this.handleColorAxisChange,
|
|
184
|
-
allowExcludedValues: true,
|
|
185
|
-
filters
|
|
186
|
-
})
|
|
187
|
-
)
|
|
188
|
-
)
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
renderSymbol() {
|
|
192
|
-
if (!this.props.design.axes.geometry) {
|
|
193
|
-
return
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
return R(MarkerSymbolSelectComponent, { symbol: this.props.design.symbol, onChange: this.handleSymbolChange })
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
renderMarkerSize() {
|
|
200
|
-
if (!this.props.design.axes.geometry) {
|
|
201
|
-
return
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
return R(
|
|
205
|
-
"div",
|
|
206
|
-
{ className: "mb-3" },
|
|
207
|
-
R("label", { className: "text-muted" }, T`Marker Size`),
|
|
208
|
-
R(ui.Select, {
|
|
209
|
-
value: this.props.design.markerSize || 10,
|
|
210
|
-
options: [
|
|
211
|
-
{ value: 5, label: T`Extra small` },
|
|
212
|
-
{ value: 8, label: T`Small` },
|
|
213
|
-
{ value: 10, label: T`Normal` },
|
|
214
|
-
{ value: 13, label: T`Large` },
|
|
215
|
-
{ value: 16, label: T`Extra large` }
|
|
216
|
-
],
|
|
217
|
-
onChange: this.handleMarkerSizeChange
|
|
218
|
-
})
|
|
219
|
-
)
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
renderLineWidth() {
|
|
223
|
-
if (!this.props.design.axes.geometry) {
|
|
224
|
-
return
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
return R(
|
|
228
|
-
"div",
|
|
229
|
-
{ className: "mb-3" },
|
|
230
|
-
R("label", { className: "text-muted" }, T`Line Width (for shapes)`),
|
|
231
|
-
R(ui.Select, {
|
|
232
|
-
value: this.props.design.lineWidth != null ? this.props.design.lineWidth : 3,
|
|
233
|
-
options: [
|
|
234
|
-
{ value: 0, label: T`None` },
|
|
235
|
-
{ value: 1, label: T`1 pixel` },
|
|
236
|
-
{ value: 2, label: T`2 pixels` },
|
|
237
|
-
{ value: 3, label: T`3 pixels` },
|
|
238
|
-
{ value: 4, label: T`4 pixels` },
|
|
239
|
-
{ value: 5, label: T`5 pixels` },
|
|
240
|
-
{ value: 6, label: T`6 pixels` }
|
|
241
|
-
],
|
|
242
|
-
onChange: this.handleLineWidthChange
|
|
243
|
-
})
|
|
244
|
-
)
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
renderPolygonBorderColor() {
|
|
248
|
-
if (!this.props.design.axes.geometry) {
|
|
249
|
-
return
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
return R(
|
|
253
|
-
"div",
|
|
254
|
-
{ className: "mb-3" },
|
|
255
|
-
R("label", { className: "text-muted" }, T`Polygon border color (blank for same as fill color)`),
|
|
256
|
-
R(
|
|
257
|
-
"div",
|
|
258
|
-
null,
|
|
259
|
-
R(ColorComponent, {
|
|
260
|
-
color: this.props.design.polygonBorderColor,
|
|
261
|
-
onChange: this.handlePolygonBorderColorChange
|
|
262
|
-
})
|
|
263
|
-
)
|
|
264
|
-
)
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
renderPolygonFillOpacity() {
|
|
268
|
-
if (!this.props.design.axes.geometry) {
|
|
269
|
-
return
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
const opacity = this.props.design.polygonFillOpacity != null ? this.props.design.polygonFillOpacity : 0.25
|
|
273
|
-
|
|
274
|
-
return R(
|
|
275
|
-
"div",
|
|
276
|
-
{ className: "mb-3"},
|
|
277
|
-
R("label", { className: "text-muted" }, R("span", null, T`Polygon Fill Opacity: ${Math.round(opacity * 100)}%`)),
|
|
278
|
-
R(
|
|
279
|
-
"div",
|
|
280
|
-
{ style: { padding: "10px" } },
|
|
281
|
-
React.createElement(Rcslider, {
|
|
282
|
-
min: 0,
|
|
283
|
-
max: 100,
|
|
284
|
-
step: 1,
|
|
285
|
-
tipTransitionName: "rc-slider-tooltip-zoom-down",
|
|
286
|
-
value: opacity * 100,
|
|
287
|
-
onChange: this.handlePolygonFillOpacityChange
|
|
288
|
-
})
|
|
289
|
-
)
|
|
290
|
-
)
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
renderFilter() {
|
|
294
|
-
// If no data, hide
|
|
295
|
-
if (!this.props.design.axes.geometry) {
|
|
296
|
-
return null
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
return R(
|
|
300
|
-
"div",
|
|
301
|
-
{ className: "mb-3" },
|
|
302
|
-
R("label", { className: "text-muted" }, R("span", { className: "fas fa-filter" }), T`Filters`),
|
|
303
|
-
R(
|
|
304
|
-
"div",
|
|
305
|
-
{ style: { marginLeft: 8 } },
|
|
306
|
-
R(FilterExprComponent, {
|
|
307
|
-
schema: this.props.schema,
|
|
308
|
-
dataSource: this.props.dataSource,
|
|
309
|
-
onChange: this.handleFilterChange,
|
|
310
|
-
table: this.props.design.table,
|
|
311
|
-
value: this.props.design.filter
|
|
312
|
-
})
|
|
313
|
-
)
|
|
314
|
-
)
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
renderPopup() {
|
|
318
|
-
if (!this.props.design.table) {
|
|
319
|
-
return null
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
return R(EditPopupComponent, {
|
|
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
|
-
})
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
renderHoverOver() {
|
|
334
|
-
if (!this.props.design.table) {
|
|
335
|
-
return null
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
return R(EditHoverOver, {
|
|
339
|
-
design: this.props.design,
|
|
340
|
-
onDesignChange: this.props.onDesignChange,
|
|
341
|
-
schema: this.props.schema,
|
|
342
|
-
dataSource: this.props.dataSource,
|
|
343
|
-
table: this.props.design.table,
|
|
344
|
-
idTable: this.props.design.table,
|
|
345
|
-
defaultPopupFilterJoins: PopupFilterJoinsUtils.createDefaultPopupFilterJoins(this.props.design.table)
|
|
346
|
-
})
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
render() {
|
|
350
|
-
return R(
|
|
351
|
-
"div",
|
|
352
|
-
null,
|
|
353
|
-
this.renderTable(),
|
|
354
|
-
this.renderGeometryAxis(),
|
|
355
|
-
this.renderColor(),
|
|
356
|
-
this.renderSymbol(),
|
|
357
|
-
this.renderMarkerSize(),
|
|
358
|
-
R(ui.CollapsibleSection, {
|
|
359
|
-
label: T`Shape Options`,
|
|
360
|
-
labelMuted: true
|
|
361
|
-
}, [
|
|
362
|
-
this.renderLineWidth(),
|
|
363
|
-
this.renderPolygonBorderColor(),
|
|
364
|
-
this.renderPolygonFillOpacity(),
|
|
365
|
-
]),
|
|
366
|
-
this.renderFilter(),
|
|
367
|
-
this.renderPopup(),
|
|
368
|
-
this.renderHoverOver(),
|
|
369
|
-
this.props.design.table
|
|
370
|
-
? R(ZoomLevelsComponent, { design: this.props.design, onDesignChange: this.props.onDesignChange })
|
|
371
|
-
: undefined
|
|
372
|
-
)
|
|
373
|
-
}
|
|
374
|
-
}
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import _ from "lodash"
|
|
2
|
-
import React from "react"
|
|
3
|
-
const R = React.createElement
|
|
4
|
-
import { default as AsyncReactSelect } from "react-select/async"
|
|
5
|
-
import { ExprCompiler, Schema } from "@mwater/expressions"
|
|
6
|
-
import { ExprUtils } from "@mwater/expressions"
|
|
7
|
-
import { JsonQLFilter } from "../JsonQLFilter"
|
|
8
|
-
import { QuickfiltersDataSource } from "./QuickfiltersDataSource"
|
|
9
|
-
|
|
10
|
-
export interface TextLiteralComponentProps {
|
|
11
|
-
value?: any
|
|
12
|
-
onChange?: any
|
|
13
|
-
schema: Schema
|
|
14
|
-
/** See QuickfiltersDataSource */
|
|
15
|
-
quickfiltersDataSource: QuickfiltersDataSource
|
|
16
|
-
expr: any
|
|
17
|
-
index: number
|
|
18
|
-
/** true to display multiple values */
|
|
19
|
-
multi?: boolean
|
|
20
|
-
|
|
21
|
-
/** Filters to add to restrict quick filter data to */
|
|
22
|
-
filters?: JsonQLFilter[]
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/** Displays a combo box that allows selecting single or multiple text values from an expression
|
|
26
|
-
* The expression can be type `text` or `text[]`
|
|
27
|
-
*/
|
|
28
|
-
export default class TextLiteralComponent extends React.Component<TextLiteralComponentProps> {
|
|
29
|
-
handleSingleChange = (val: any) => {
|
|
30
|
-
const value = val ? val.value || null : null // Blank is null
|
|
31
|
-
return this.props.onChange(value)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
handleMultipleChange = (val: any) => {
|
|
35
|
-
const value = val ? _.pluck(val, "value") : []
|
|
36
|
-
|
|
37
|
-
if (value.length > 0) {
|
|
38
|
-
return this.props.onChange(value)
|
|
39
|
-
} else {
|
|
40
|
-
return this.props.onChange(null)
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
getOptions = (input: any, cb: any) => {
|
|
45
|
-
// Determine type of expression
|
|
46
|
-
const filters = (this.props.filters || []).slice()
|
|
47
|
-
|
|
48
|
-
const exprUtils = new ExprUtils(this.props.schema)
|
|
49
|
-
const exprType = exprUtils.getExprType(this.props.expr)
|
|
50
|
-
|
|
51
|
-
// Create query to get matches
|
|
52
|
-
const exprCompiler = new ExprCompiler(this.props.schema)
|
|
53
|
-
|
|
54
|
-
if(!this.props.expr.table) {
|
|
55
|
-
return
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// Add filter for input (simple if just text)
|
|
59
|
-
if (exprType === "text") {
|
|
60
|
-
if (input) {
|
|
61
|
-
filters.push({
|
|
62
|
-
table: this.props.expr.table,
|
|
63
|
-
jsonql: {
|
|
64
|
-
type: "op",
|
|
65
|
-
op: "~*",
|
|
66
|
-
exprs: [
|
|
67
|
-
exprCompiler.compileExpr({ expr: this.props.expr, tableAlias: "{alias}" }),
|
|
68
|
-
escapeRegex(input) // Don't use _.escapeRegExp as adds weird backslashes that postgres doesn't like
|
|
69
|
-
]
|
|
70
|
-
}
|
|
71
|
-
})
|
|
72
|
-
}
|
|
73
|
-
} else if (exprType === "text[]") {
|
|
74
|
-
// Special filter for text[]
|
|
75
|
-
if (input) {
|
|
76
|
-
filters.push({
|
|
77
|
-
table: "values",
|
|
78
|
-
jsonql: {
|
|
79
|
-
type: "op",
|
|
80
|
-
op: "~*",
|
|
81
|
-
exprs: [
|
|
82
|
-
{ type: "field", tableAlias: "{alias}", column: "value" },
|
|
83
|
-
"^" + escapeRegex(input) // Don't use _.escapeRegExp as adds weird backslashes that postgres doesn't like
|
|
84
|
-
]
|
|
85
|
-
}
|
|
86
|
-
})
|
|
87
|
-
}
|
|
88
|
-
} else {
|
|
89
|
-
return
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// Execute query
|
|
93
|
-
this.props.quickfiltersDataSource.getValues(
|
|
94
|
-
this.props.index,
|
|
95
|
-
this.props.expr,
|
|
96
|
-
filters,
|
|
97
|
-
null,
|
|
98
|
-
250,
|
|
99
|
-
(err: any, values: any) => {
|
|
100
|
-
if (err) {
|
|
101
|
-
return
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// Filter null and blank
|
|
105
|
-
values = _.filter(values, (value) => value)
|
|
106
|
-
|
|
107
|
-
return cb(
|
|
108
|
-
_.map(values, (value) => ({
|
|
109
|
-
value,
|
|
110
|
-
label: value
|
|
111
|
-
}))
|
|
112
|
-
)
|
|
113
|
-
}
|
|
114
|
-
)
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
renderSingle() {
|
|
118
|
-
const currentValue = this.props.value ? { value: this.props.value, label: this.props.value } : null
|
|
119
|
-
|
|
120
|
-
return R(AsyncReactSelect, {
|
|
121
|
-
key: JSON.stringify(this.props.filters), // Include to force a change when filters change
|
|
122
|
-
placeholder: T`All`,
|
|
123
|
-
value: currentValue,
|
|
124
|
-
loadOptions: this.getOptions,
|
|
125
|
-
onChange: this.props.onChange ? this.handleSingleChange : undefined,
|
|
126
|
-
isClearable: true,
|
|
127
|
-
defaultOptions: true,
|
|
128
|
-
isDisabled: this.props.onChange == null,
|
|
129
|
-
noOptionsMessage: () => T`Type to search`,
|
|
130
|
-
styles: {
|
|
131
|
-
// Keep menu above fixed data table headers
|
|
132
|
-
menu: (style) => _.extend({}, style, { zIndex: 2000 })
|
|
133
|
-
}
|
|
134
|
-
})
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
renderMultiple() {
|
|
138
|
-
const currentValue = this.props.value ? _.map(this.props.value, (v) => ({ value: v, label: v })) : null
|
|
139
|
-
|
|
140
|
-
return R(AsyncReactSelect, {
|
|
141
|
-
placeholder: T`All`,
|
|
142
|
-
value: currentValue,
|
|
143
|
-
key: JSON.stringify(this.props.filters), // Include to force a change when filters change
|
|
144
|
-
isMulti: true,
|
|
145
|
-
loadOptions: this.getOptions,
|
|
146
|
-
defaultOptions: true,
|
|
147
|
-
onChange: this.props.onChange ? this.handleMultipleChange : undefined,
|
|
148
|
-
isClearable: true,
|
|
149
|
-
isDisabled: this.props.onChange == null,
|
|
150
|
-
noOptionsMessage: () => T`Type to search`,
|
|
151
|
-
styles: {
|
|
152
|
-
// Keep menu above fixed data table headers
|
|
153
|
-
menu: (style) => _.extend({}, style, { zIndex: 2000 })
|
|
154
|
-
}
|
|
155
|
-
})
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
render() {
|
|
159
|
-
return R("div", { style: { width: "100%" } }, this.props.multi ? this.renderMultiple() : this.renderSingle())
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
function escapeRegex(s: any) {
|
|
164
|
-
return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&")
|
|
165
|
-
}
|