@mwater/visualization 5.5.0 → 5.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ColorComponent.js +2 -2
- 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/TranslationsTabComponent.d.ts +34 -0
- package/lib/TranslationsTabComponent.js +256 -0
- package/lib/UndoStack.d.ts +2 -1
- package/lib/UndoStack.js +12 -6
- package/lib/dashboards/DashboardComponent.js +6 -5
- package/lib/dashboards/DashboardDesign.d.ts +1 -1
- package/lib/dashboards/ServerDashboardDataSource.d.ts +0 -1
- package/lib/dashboards/ServerDashboardDataSource.js +0 -25
- package/lib/dashboards/SettingsModalComponent.js +9 -233
- package/lib/datagrids/DatagridComponent.js +27 -2
- package/lib/datagrids/DatagridDesignerComponent.d.ts +2 -3
- package/lib/datagrids/DatagridDesignerComponent.js +108 -120
- package/lib/datagrids/DatagridViewComponent.js +33 -6
- 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 +0 -13
- package/lib/maps/BufferLayer.js +24 -237
- package/lib/maps/BufferLayerDesign.d.ts +1 -1
- package/lib/maps/BufferLayerDesignerComponent.d.ts +1 -1
- package/lib/maps/BufferLayerDesignerComponent.js +2 -7
- package/lib/maps/ChoroplethLayer.d.ts +1 -16
- package/lib/maps/ChoroplethLayer.js +25 -358
- 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/ClusterLayer.d.ts +0 -9
- package/lib/maps/ClusterLayer.js +0 -250
- package/lib/maps/DirectMapDataSource.js +1 -48
- package/lib/maps/EditHoverOver.d.ts +4 -3
- package/lib/maps/EditHoverOver.js +3 -3
- package/lib/maps/GridLayer.d.ts +0 -15
- package/lib/maps/GridLayer.js +0 -212
- package/lib/maps/HoverContent.js +1 -1
- package/lib/maps/Layer.d.ts +1 -26
- package/lib/maps/Layer.js +0 -13
- package/lib/maps/LeafletMapComponent.js +10 -19
- package/lib/maps/MapComponent.d.ts +19 -35
- package/lib/maps/MapComponent.js +135 -77
- package/lib/maps/MapControlComponent.d.ts +4 -5
- package/lib/maps/MapControlComponent.js +5 -12
- package/lib/maps/MapDesign.d.ts +8 -0
- package/lib/maps/MapDesignerComponent.d.ts +2 -0
- package/lib/maps/MapDesignerComponent.js +7 -2
- package/lib/maps/MapLayerDataSource.d.ts +0 -4
- package/lib/maps/MapLayerViewDesignerComponent.d.ts +3 -1
- package/lib/maps/MapLayerViewDesignerComponent.js +5 -1
- package/lib/maps/MapLayersDesignerComponent.d.ts +2 -0
- package/lib/maps/MapLayersDesignerComponent.js +2 -1
- package/lib/maps/MapTranslationsTab.d.ts +15 -0
- package/lib/maps/MapTranslationsTab.js +47 -0
- package/lib/maps/MapUtils.d.ts +11 -0
- package/lib/maps/MapUtils.js +57 -1
- package/lib/maps/MapViewComponent.d.ts +1 -1
- package/lib/maps/MapViewComponent.js +1 -8
- package/lib/maps/MarkersLayer.d.ts +1 -14
- package/lib/maps/MarkersLayer.js +89 -254
- package/lib/maps/MarkersLayerDesign.d.ts +5 -1
- package/lib/maps/MarkersLayerDesignerComponent.d.ts +32 -57
- package/lib/maps/MarkersLayerDesignerComponent.js +158 -134
- package/lib/maps/ServerMapDataSource.d.ts +0 -1
- package/lib/maps/ServerMapDataSource.js +0 -25
- package/lib/maps/SwitchableTileUrlLayer.d.ts +0 -2
- package/lib/maps/SwitchableTileUrlLayer.js +0 -9
- package/lib/maps/TileUrlLayer.d.ts +0 -1
- package/lib/maps/TileUrlLayer.js +0 -5
- package/lib/maps/VectorMapViewComponent.js +13 -10
- 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 +6 -6
- package/lib/maps/vectorMaps.js +33 -45
- 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 +6 -3
- 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 +3 -4
- package/src/ColorComponent.tsx +2 -2
- package/src/MWaterContextComponent.tsx +1 -1
- package/src/{MWaterGlobalFiltersComponent.ts → MWaterGlobalFiltersComponent.tsx} +32 -33
- package/src/{MWaterLoaderComponent.ts → MWaterLoaderComponent.tsx} +17 -18
- package/src/TranslationsTabComponent.tsx +429 -0
- package/src/UndoStack.ts +14 -6
- package/src/dashboards/DashboardComponent.tsx +6 -5
- package/src/dashboards/DashboardDesign.ts +1 -1
- package/src/dashboards/ServerDashboardDataSource.ts +0 -31
- package/src/dashboards/SettingsModalComponent.tsx +27 -383
- package/src/datagrids/DatagridComponent.tsx +36 -2
- package/src/datagrids/DatagridDesignerComponent.tsx +241 -229
- package/src/datagrids/DatagridViewComponent.tsx +44 -7
- 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 +30 -263
- package/src/maps/BufferLayerDesign.ts +1 -1
- package/src/maps/BufferLayerDesignerComponent.tsx +2 -7
- package/src/maps/ChoroplethLayer.ts +30 -394
- package/src/maps/ChoroplethLayerDesign.ts +5 -2
- package/src/maps/ChoroplethLayerDesigner.tsx +169 -165
- package/src/maps/ClusterLayer.ts +0 -274
- package/src/maps/DirectMapDataSource.ts +2 -61
- package/src/maps/EditHoverOver.tsx +9 -5
- package/src/maps/GridLayer.ts +0 -224
- package/src/maps/HoverContent.tsx +1 -1
- package/src/maps/Layer.ts +1 -35
- package/src/maps/LeafletMapComponent.tsx +10 -19
- package/src/maps/MapComponent.tsx +448 -0
- package/src/maps/MapControlComponent.tsx +41 -0
- package/src/maps/MapDesign.ts +6 -0
- package/src/maps/MapDesignerComponent.tsx +18 -1
- package/src/maps/MapLayerDataSource.ts +0 -5
- package/src/maps/MapLayerViewDesignerComponent.ts +9 -2
- package/src/maps/MapLayersDesignerComponent.ts +4 -1
- package/src/maps/MapTranslationsTab.tsx +53 -0
- package/src/maps/MapUtils.ts +61 -1
- package/src/maps/MapViewComponent.tsx +2 -8
- package/src/maps/MarkersLayer.ts +101 -275
- package/src/maps/MarkersLayerDesign.ts +7 -1
- package/src/maps/MarkersLayerDesignerComponent.tsx +436 -0
- package/src/maps/ServerMapDataSource.ts +0 -31
- package/src/maps/SwitchableTileUrlLayer.tsx +0 -11
- package/src/maps/TileUrlLayer.tsx +0 -6
- package/src/maps/VectorMapViewComponent.tsx +15 -15
- 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 +32 -53
- 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 +11 -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/MapComponent.ts +0 -312
- package/src/maps/MapControlComponent.ts +0 -46
- package/src/maps/MarkersLayerDesignerComponent.ts +0 -374
- package/src/maps/RasterMapViewComponent.ts +0 -345
- 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/MapComponent.ts
DELETED
|
@@ -1,312 +0,0 @@
|
|
|
1
|
-
import _ from "lodash"
|
|
2
|
-
import React, { ReactNode } from "react"
|
|
3
|
-
const R = React.createElement
|
|
4
|
-
|
|
5
|
-
import { MapViewComponent } from "./MapViewComponent"
|
|
6
|
-
import MapDesignerComponent from "./MapDesignerComponent"
|
|
7
|
-
import MapControlComponent from "./MapControlComponent"
|
|
8
|
-
import AutoSizeComponent from "@mwater/react-library/lib/AutoSizeComponent"
|
|
9
|
-
import UndoStack from "../UndoStack"
|
|
10
|
-
import PopoverHelpComponent from "@mwater/react-library/lib/PopoverHelpComponent"
|
|
11
|
-
import { DataSource, Schema } from "@mwater/expressions"
|
|
12
|
-
import { MapDataSource } from "./MapDataSource"
|
|
13
|
-
import { MapDesign } from "./MapDesign"
|
|
14
|
-
import { JsonQLFilter } from "../JsonQLFilter"
|
|
15
|
-
import QuickfilterCompiler from "../quickfilter/QuickfilterCompiler"
|
|
16
|
-
import QuickfiltersComponent from "../quickfilter/QuickfiltersComponent"
|
|
17
|
-
import { getCompiledFilters, getFilterableTables } from "./MapUtils"
|
|
18
|
-
import { LocaleContext } from "@mwater/expressions-ui"
|
|
19
|
-
|
|
20
|
-
export interface MapComponentProps {
|
|
21
|
-
schema: Schema
|
|
22
|
-
dataSource: DataSource
|
|
23
|
-
mapDataSource: MapDataSource
|
|
24
|
-
|
|
25
|
-
design: MapDesign
|
|
26
|
-
onDesignChange?: (design: MapDesign) => void
|
|
27
|
-
|
|
28
|
-
/** Called with (tableId, rowId) when item is clicked */
|
|
29
|
-
onRowClick?: (tableId: string, rowId: any) => void
|
|
30
|
-
|
|
31
|
-
/** Extra filters to apply to view */
|
|
32
|
-
extraFilters?: JsonQLFilter[]
|
|
33
|
-
|
|
34
|
-
/** Extra element to include in title at left */
|
|
35
|
-
titleElem?: ReactNode
|
|
36
|
-
|
|
37
|
-
/** Extra elements to add to right */
|
|
38
|
-
extraTitleButtonsElem?: ReactNode
|
|
39
|
-
|
|
40
|
-
/** True to enable quickfilters */
|
|
41
|
-
enableQuickfilters?: boolean
|
|
42
|
-
|
|
43
|
-
/** Locked quickfilter values. See README in quickfilters */
|
|
44
|
-
quickfilterLocks?: any[]
|
|
45
|
-
|
|
46
|
-
/** Initial quickfilter values */
|
|
47
|
-
quickfiltersValues?: any[]
|
|
48
|
-
|
|
49
|
-
/** True to hide title bar and related controls */
|
|
50
|
-
hideTitleBar?: boolean
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
interface MapComponentState {
|
|
54
|
-
undoStack: UndoStack
|
|
55
|
-
transientDesign: MapDesign
|
|
56
|
-
zoomLocked: boolean
|
|
57
|
-
|
|
58
|
-
/** Values of quickfilters */
|
|
59
|
-
quickfiltersValues: any[] | null
|
|
60
|
-
|
|
61
|
-
/** True to hide quickfilters */
|
|
62
|
-
hideQuickfilters: boolean
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/** Map with designer on right */
|
|
66
|
-
export default class MapComponent extends React.Component<MapComponentProps, MapComponentState> {
|
|
67
|
-
static contextType = LocaleContext
|
|
68
|
-
|
|
69
|
-
constructor(props: MapComponentProps) {
|
|
70
|
-
super(props)
|
|
71
|
-
this.state = {
|
|
72
|
-
undoStack: new UndoStack().push(props.design),
|
|
73
|
-
transientDesign: props.design, // Temporary design for read-only maps
|
|
74
|
-
zoomLocked: true,
|
|
75
|
-
quickfiltersValues: props.quickfiltersValues ?? null,
|
|
76
|
-
hideQuickfilters: false
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
componentDidUpdate(prevProps: MapComponentProps) {
|
|
81
|
-
// If design changes, save on stack and update transient design
|
|
82
|
-
if (!_.isEqual(prevProps.design, this.props.design)) {
|
|
83
|
-
// Save on stack
|
|
84
|
-
this.setState({ undoStack: this.state.undoStack.push(this.props.design) })
|
|
85
|
-
|
|
86
|
-
// Update transient design
|
|
87
|
-
this.setState({ transientDesign: this.props.design })
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
handleUndo = () => {
|
|
92
|
-
const undoStack = this.state.undoStack.undo()
|
|
93
|
-
|
|
94
|
-
// We need to use callback as state is applied later
|
|
95
|
-
return this.setState({ undoStack }, () => this.props.onDesignChange!(undoStack.getValue()))
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
handleRedo = () => {
|
|
99
|
-
const undoStack = this.state.undoStack.redo()
|
|
100
|
-
|
|
101
|
-
// We need to use callback as state is applied later
|
|
102
|
-
return this.setState({ undoStack }, () => this.props.onDesignChange!(undoStack.getValue()))
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
handleShowQuickfilters = () => {
|
|
106
|
-
return this.setState({ hideQuickfilters: false })
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
handleZoomLockClick = () => {
|
|
110
|
-
return this.setState({ zoomLocked: !this.state.zoomLocked })
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
renderActionLinks() {
|
|
114
|
-
return R(
|
|
115
|
-
"div",
|
|
116
|
-
null,
|
|
117
|
-
this.props.onDesignChange != null
|
|
118
|
-
? [
|
|
119
|
-
R(
|
|
120
|
-
"a",
|
|
121
|
-
{ key: "lock", className: "btn btn-link btn-sm", onClick: this.handleZoomLockClick },
|
|
122
|
-
R("span", {
|
|
123
|
-
className: `fa ${this.state.zoomLocked ? "fa-lock red" : "fa-unlock green"}`,
|
|
124
|
-
style: { marginRight: 5 }
|
|
125
|
-
}),
|
|
126
|
-
R(PopoverHelpComponent, { placement: "bottom" }, T`Changes to zoom level wont be saved in locked mode`)
|
|
127
|
-
),
|
|
128
|
-
R(
|
|
129
|
-
"a",
|
|
130
|
-
{
|
|
131
|
-
key: "undo",
|
|
132
|
-
className: `btn btn-link btn-sm ${!this.state.undoStack.canUndo() ? "disabled" : ""}`,
|
|
133
|
-
onClick: this.handleUndo
|
|
134
|
-
},
|
|
135
|
-
R("span", { className: "fas fa-caret-left" }),
|
|
136
|
-
R("span", { className: "hide-600px" }, " ", T`Undo`)
|
|
137
|
-
),
|
|
138
|
-
" ",
|
|
139
|
-
R(
|
|
140
|
-
"a",
|
|
141
|
-
{
|
|
142
|
-
key: "redo",
|
|
143
|
-
className: `btn btn-link btn-sm ${!this.state.undoStack.canRedo() ? "disabled" : ""}`,
|
|
144
|
-
onClick: this.handleRedo
|
|
145
|
-
},
|
|
146
|
-
R("span", { className: "fas fa-caret-right" }),
|
|
147
|
-
R("span", { className: "hide-600px" }, " ", T`Redo`)
|
|
148
|
-
)
|
|
149
|
-
]
|
|
150
|
-
: undefined,
|
|
151
|
-
this.state.hideQuickfilters && this.props.design.quickfilters && this.props.design.quickfilters.length > 0
|
|
152
|
-
? R(
|
|
153
|
-
"a",
|
|
154
|
-
{ key: "showQuickfilters", className: "btn btn-link btn-sm", onClick: this.handleShowQuickfilters },
|
|
155
|
-
R("span", { className: "fa fa-filter" }),
|
|
156
|
-
R("span", { className: "hide-600px" }, " ", T`Show Quickfilters`)
|
|
157
|
-
)
|
|
158
|
-
: undefined,
|
|
159
|
-
this.props.extraTitleButtonsElem,
|
|
160
|
-
R("a", { key: "toggleDesign", className: "btn btn-link btn-sm", onClick: this.handleToggleDesignPanel, alt: T`Toggle design panel` },
|
|
161
|
-
this.getDesign().hideDesignPanel ?
|
|
162
|
-
R("span", { className: "fas fa-angle-double-left" })
|
|
163
|
-
: R("span", { className: "fas fa-angle-double-right" }))
|
|
164
|
-
)
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
renderHeader() {
|
|
168
|
-
return R(
|
|
169
|
-
"div",
|
|
170
|
-
{
|
|
171
|
-
style: {
|
|
172
|
-
padding: 4,
|
|
173
|
-
borderBottom: "solid 1px #e8e8e8",
|
|
174
|
-
gridArea: "header"
|
|
175
|
-
}
|
|
176
|
-
},
|
|
177
|
-
R("div", { style: { float: "right" } }, this.renderActionLinks()),
|
|
178
|
-
this.props.titleElem
|
|
179
|
-
)
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
handleDesignChange = (design: any) => {
|
|
183
|
-
if (this.props.onDesignChange) {
|
|
184
|
-
return this.props.onDesignChange(design)
|
|
185
|
-
} else {
|
|
186
|
-
return this.setState({ transientDesign: design })
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
getDesign() {
|
|
191
|
-
if (this.props.onDesignChange) {
|
|
192
|
-
return this.props.design
|
|
193
|
-
} else {
|
|
194
|
-
return this.state.transientDesign || this.props.design
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
handleToggleDesignPanel = () => {
|
|
199
|
-
this.handleDesignChange({ ...this.getDesign(), hideDesignPanel: !this.getDesign().hideDesignPanel })
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
// Get the values of the quick filters
|
|
203
|
-
getQuickfilterValues = () => {
|
|
204
|
-
return this.state.quickfiltersValues || []
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
renderView() {
|
|
208
|
-
let filters = this.props.extraFilters || []
|
|
209
|
-
|
|
210
|
-
// Compile quickfilters
|
|
211
|
-
filters = filters.concat(
|
|
212
|
-
new QuickfilterCompiler(this.props.schema).compile(
|
|
213
|
-
this.props.design.quickfilters || [],
|
|
214
|
-
this.state.quickfiltersValues,
|
|
215
|
-
this.props.quickfilterLocks
|
|
216
|
-
)
|
|
217
|
-
)
|
|
218
|
-
|
|
219
|
-
return React.createElement(
|
|
220
|
-
AutoSizeComponent,
|
|
221
|
-
{ injectWidth: true, injectHeight: true },
|
|
222
|
-
(size: {
|
|
223
|
-
width?: number;
|
|
224
|
-
height?: number;
|
|
225
|
-
}) => {
|
|
226
|
-
return React.createElement(MapViewComponent, {
|
|
227
|
-
mapDataSource: this.props.mapDataSource,
|
|
228
|
-
schema: this.props.schema,
|
|
229
|
-
dataSource: this.props.dataSource,
|
|
230
|
-
design: this.getDesign(),
|
|
231
|
-
onDesignChange: this.handleDesignChange,
|
|
232
|
-
zoomLocked: this.state.zoomLocked,
|
|
233
|
-
onRowClick: this.props.onRowClick,
|
|
234
|
-
extraFilters: filters,
|
|
235
|
-
locale: this.context,
|
|
236
|
-
width: size.width!,
|
|
237
|
-
height: size.height!
|
|
238
|
-
})
|
|
239
|
-
}
|
|
240
|
-
)
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
// Get filters from props filters combined with maps filters
|
|
244
|
-
getCompiledFilters() {
|
|
245
|
-
let compiledFilters = getCompiledFilters(
|
|
246
|
-
this.props.design,
|
|
247
|
-
this.props.schema,
|
|
248
|
-
getFilterableTables(this.props.design, this.props.schema)
|
|
249
|
-
)
|
|
250
|
-
compiledFilters = compiledFilters.concat(this.props.extraFilters || [])
|
|
251
|
-
return compiledFilters
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
renderQuickfilter() {
|
|
255
|
-
return R("div", { style: { gridArea: "quickfilters", borderBottom: "solid 1px #e8e8e8" } },
|
|
256
|
-
R(QuickfiltersComponent, {
|
|
257
|
-
design: this.props.design.quickfilters || [],
|
|
258
|
-
schema: this.props.schema,
|
|
259
|
-
dataSource: this.props.dataSource,
|
|
260
|
-
quickfiltersDataSource: this.props.mapDataSource.getQuickfiltersDataSource(),
|
|
261
|
-
values: this.state.quickfiltersValues || undefined,
|
|
262
|
-
onValuesChange: (values: any) => this.setState({ quickfiltersValues: values }),
|
|
263
|
-
locks: this.props.quickfilterLocks,
|
|
264
|
-
filters: this.getCompiledFilters(),
|
|
265
|
-
hideTopBorder: this.props.hideTitleBar,
|
|
266
|
-
onHide: () => this.setState({ hideQuickfilters: true })
|
|
267
|
-
})
|
|
268
|
-
)
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
renderDesigner() {
|
|
272
|
-
return R("div", { style: { gridArea: "designer", borderLeft: "solid 2px #e8e8e8", overflowY: 'scroll' } },
|
|
273
|
-
this.props.onDesignChange ?
|
|
274
|
-
React.createElement(MapDesignerComponent, {
|
|
275
|
-
schema: this.props.schema,
|
|
276
|
-
dataSource: this.props.dataSource,
|
|
277
|
-
design: this.getDesign(),
|
|
278
|
-
onDesignChange: this.handleDesignChange,
|
|
279
|
-
enableQuickfilters: this.props.enableQuickfilters
|
|
280
|
-
})
|
|
281
|
-
:
|
|
282
|
-
React.createElement(MapControlComponent, {
|
|
283
|
-
schema: this.props.schema,
|
|
284
|
-
dataSource: this.props.dataSource,
|
|
285
|
-
design: this.getDesign(),
|
|
286
|
-
onDesignChange: this.handleDesignChange
|
|
287
|
-
})
|
|
288
|
-
)
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
render() {
|
|
292
|
-
const designerVisible = !this.getDesign().hideDesignPanel
|
|
293
|
-
console.log("designerVisible", designerVisible)
|
|
294
|
-
return R(
|
|
295
|
-
"div",
|
|
296
|
-
{
|
|
297
|
-
style: {
|
|
298
|
-
width: "100%",
|
|
299
|
-
height: "100%",
|
|
300
|
-
display: "grid",
|
|
301
|
-
gridTemplateColumns: designerVisible ? "70% 30%" : "100%",
|
|
302
|
-
gridTemplateRows: "auto auto 1fr",
|
|
303
|
-
gridTemplateAreas: `"header designer" "quickfilters designer" "view designer"`
|
|
304
|
-
}
|
|
305
|
-
},
|
|
306
|
-
this.props.hideTitleBar != true ? this.renderHeader() : null,
|
|
307
|
-
this.state.hideQuickfilters ? null : this.renderQuickfilter(),
|
|
308
|
-
R("div", { style: { width: "100%", height: "100%", gridArea: "view", overflow: "hidden" } }, this.renderView()),
|
|
309
|
-
designerVisible ? this.renderDesigner() : null
|
|
310
|
-
)
|
|
311
|
-
}
|
|
312
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import PropTypes from "prop-types"
|
|
2
|
-
import React from "react"
|
|
3
|
-
const R = React.createElement
|
|
4
|
-
|
|
5
|
-
import MapLayersDesignerComponent from "./MapLayersDesignerComponent"
|
|
6
|
-
import BaseLayerDesignerComponent from "./BaseLayerDesignerComponent"
|
|
7
|
-
import { DataSource, Schema } from "@mwater/expressions"
|
|
8
|
-
|
|
9
|
-
export interface MapControlComponentProps {
|
|
10
|
-
/** Schema to use */
|
|
11
|
-
schema: Schema
|
|
12
|
-
dataSource: DataSource
|
|
13
|
-
/** See Map Design.md */
|
|
14
|
-
design: any
|
|
15
|
-
onDesignChange: any
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// Allows controlling readonly map
|
|
19
|
-
export default class MapControlComponent extends React.Component<MapControlComponentProps> {
|
|
20
|
-
render() {
|
|
21
|
-
return R(
|
|
22
|
-
"div",
|
|
23
|
-
{ style: { padding: 5 } },
|
|
24
|
-
R(MapLayersDesignerComponent, {
|
|
25
|
-
schema: this.props.schema,
|
|
26
|
-
dataSource: this.props.dataSource,
|
|
27
|
-
design: this.props.design,
|
|
28
|
-
onDesignChange: this.props.onDesignChange,
|
|
29
|
-
allowEditingLayers: false
|
|
30
|
-
}),
|
|
31
|
-
|
|
32
|
-
R("br"),
|
|
33
|
-
|
|
34
|
-
R(
|
|
35
|
-
"div",
|
|
36
|
-
{ className: "mb-3" },
|
|
37
|
-
R("label", { className: "text-muted" }, T`Map Style`),
|
|
38
|
-
|
|
39
|
-
R(BaseLayerDesignerComponent, {
|
|
40
|
-
design: this.props.design,
|
|
41
|
-
onDesignChange: this.props.onDesignChange
|
|
42
|
-
})
|
|
43
|
-
)
|
|
44
|
-
)
|
|
45
|
-
}
|
|
46
|
-
}
|