@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
|
@@ -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
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// TODO: This file was created by bulk-decaffeinate.
|
|
2
|
-
// Sanity-check the conversion and remove this comment.
|
|
3
|
-
let UpdateableComponent;
|
|
4
|
-
import _ from 'lodash';
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
// Convenience wrapper that allows updating state
|
|
8
|
-
export default UpdateableComponent = class UpdateableComponent extends React.Component {
|
|
9
|
-
constructor(props) {
|
|
10
|
-
super(props);
|
|
11
|
-
this.state = _.clone(this.props || {});
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// Creates update function
|
|
15
|
-
update = name => {
|
|
16
|
-
return value => {
|
|
17
|
-
const upt = {};
|
|
18
|
-
upt[name] = value;
|
|
19
|
-
this.setState(upt);
|
|
20
|
-
return console.log(JSON.stringify(upt, null, 2));
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
// action("update")(upt)
|
|
24
|
-
|
|
25
|
-
render() {
|
|
26
|
-
return this.props.children(this.state, this.update);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
|