@eeacms/volto-eea-map 0.1.8 → 0.1.9
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/CHANGELOG.md +8 -0
- package/package.json +2 -1
- package/src/components/Blocks/EEAMap/components/Webmap.jsx +2 -2
- package/src/components/Blocks/EEAMap/components/widgets/LayerSelectWidget.jsx +34 -12
- package/src/components/Blocks/EEAMap/components/widgets/MapEditorWidget.jsx +0 -1
- package/src/components/Blocks/EEAMap/styles/map.css +50 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,8 +4,16 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
6
|
|
|
7
|
+
#### [0.1.9](https://github.com/eea/volto-eea-map/compare/0.1.8...0.1.9)
|
|
8
|
+
|
|
9
|
+
- pinpoint query builder [`6184b0e`](https://github.com/eea/volto-eea-map/commit/6184b0e1dcee48e7d34bf56bc1c878438d07f987)
|
|
10
|
+
- build query widget [`7a9d74a`](https://github.com/eea/volto-eea-map/commit/7a9d74a6fdac32a8b424c5ca97edd42df436cbe2)
|
|
11
|
+
|
|
7
12
|
#### [0.1.8](https://github.com/eea/volto-eea-map/compare/0.1.7...0.1.8)
|
|
8
13
|
|
|
14
|
+
> 11 August 2022
|
|
15
|
+
|
|
16
|
+
- Integration & new block for Map Visualization content-type [`#8`](https://github.com/eea/volto-eea-map/pull/8)
|
|
9
17
|
- remove title on map edit widget [`1d00707`](https://github.com/eea/volto-eea-map/commit/1d0070716a743ea7f26c5f877b723492319fcecd)
|
|
10
18
|
- update query by stored value [`c0f6ddd`](https://github.com/eea/volto-eea-map/commit/c0f6dddadaaf28de5b9914214acf735a166fae88)
|
|
11
19
|
- stylelint [`511845a`](https://github.com/eea/volto-eea-map/commit/511845a319137dfe4e1c0c9846ee5ccb7656b32b)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eeacms/volto-eea-map",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "@eeacms/volto-eea-map: Volto add-on",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"author": "European Environment Agency: IDM2 A-Team",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"@eeacms/volto-embed": "^2.0.1",
|
|
25
25
|
"@plone/scripts": "*",
|
|
26
26
|
"esri-loader": "3.5.0",
|
|
27
|
+
"react-querybuilder": "4.2.3",
|
|
27
28
|
"volto-slate": "*"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { withDeviceSize } from '@eeacms/volto-eea-map/hocs';
|
|
4
4
|
import { loadModules } from 'esri-loader';
|
|
5
|
+
import { formatQuery } from 'react-querybuilder';
|
|
5
6
|
|
|
6
7
|
const MODULES = [
|
|
7
8
|
'esri/Map',
|
|
@@ -91,7 +92,6 @@ const Webmap = (props) => {
|
|
|
91
92
|
.filter(({ map_service_url, layer }) => map_service_url && layer)
|
|
92
93
|
.map(({ map_service_url, layer, query = '' }) => {
|
|
93
94
|
const url = `${map_service_url}/${layer}`;
|
|
94
|
-
|
|
95
95
|
let mapLayer;
|
|
96
96
|
switch (layer.type) {
|
|
97
97
|
case 'Raster Layer':
|
|
@@ -102,7 +102,7 @@ const Webmap = (props) => {
|
|
|
102
102
|
case 'Feature Layer':
|
|
103
103
|
mapLayer = new FeatureLayer({
|
|
104
104
|
url,
|
|
105
|
-
definitionExpression: query,
|
|
105
|
+
definitionExpression: query ? formatQuery(query, 'sql') : '',
|
|
106
106
|
});
|
|
107
107
|
break;
|
|
108
108
|
case 'Group Layer':
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Icon } from '@plone/volto/components';
|
|
3
3
|
import { Input, Select, Button, Grid } from 'semantic-ui-react';
|
|
4
|
+
import { QueryBuilder } from 'react-querybuilder';
|
|
5
|
+
import 'react-querybuilder/dist/query-builder.css';
|
|
6
|
+
// import {
|
|
7
|
+
// bootstrapControlClassnames,
|
|
8
|
+
// bootstrapControlElements,
|
|
9
|
+
// } from 'react-querybuilder/bootstrap';
|
|
4
10
|
|
|
5
11
|
import checkSVG from '@plone/volto/icons/check.svg';
|
|
6
12
|
import closeSVG from '@plone/volto/icons/clear.svg';
|
|
@@ -31,7 +37,9 @@ const LayerSelectWidget = (props) => {
|
|
|
31
37
|
const [availableLayers, setAvailableLayers] = React.useState(
|
|
32
38
|
available_layers,
|
|
33
39
|
);
|
|
34
|
-
const [layerQuery, setLayerQuery] = React.useState(query);
|
|
40
|
+
//const [layerQuery, setLayerQuery] = React.useState(query);
|
|
41
|
+
|
|
42
|
+
const [builtQuery, setBuiltQuery] = React.useState(query);
|
|
35
43
|
|
|
36
44
|
const handleServiceUrlCheck = async () => {
|
|
37
45
|
// fetch url, save it, populate layers options
|
|
@@ -79,14 +87,16 @@ const LayerSelectWidget = (props) => {
|
|
|
79
87
|
map_data: mapData,
|
|
80
88
|
query: '',
|
|
81
89
|
});
|
|
82
|
-
|
|
90
|
+
setBuiltQuery('');
|
|
83
91
|
};
|
|
84
92
|
|
|
85
93
|
const handleQueryLayer = () => {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
94
|
+
if (builtQuery) {
|
|
95
|
+
onChange(id, {
|
|
96
|
+
...value,
|
|
97
|
+
query: builtQuery,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
90
100
|
};
|
|
91
101
|
|
|
92
102
|
const handleChangeServiceUrl = (value) => {
|
|
@@ -94,7 +104,7 @@ const LayerSelectWidget = (props) => {
|
|
|
94
104
|
setCheckColor('');
|
|
95
105
|
setServiceUrl(value);
|
|
96
106
|
setAvailableLayers('');
|
|
97
|
-
|
|
107
|
+
setBuiltQuery('');
|
|
98
108
|
setSelectedLayer('');
|
|
99
109
|
};
|
|
100
110
|
|
|
@@ -103,7 +113,7 @@ const LayerSelectWidget = (props) => {
|
|
|
103
113
|
setServiceUrl(map_service_url);
|
|
104
114
|
setCheckColor('');
|
|
105
115
|
setAvailableLayers(available_layers);
|
|
106
|
-
|
|
116
|
+
setBuiltQuery('');
|
|
107
117
|
setSelectedLayer(layer);
|
|
108
118
|
};
|
|
109
119
|
|
|
@@ -179,14 +189,26 @@ const LayerSelectWidget = (props) => {
|
|
|
179
189
|
Query Layer
|
|
180
190
|
</h5>
|
|
181
191
|
<Grid.Row stretched>
|
|
182
|
-
<Input
|
|
192
|
+
{/* <Input
|
|
183
193
|
type="text"
|
|
184
194
|
style={{ width: '100%' }}
|
|
185
195
|
onChange={(e, { value }) => setLayerQuery(value)}
|
|
186
196
|
value={layerQuery}
|
|
187
|
-
></Input>
|
|
197
|
+
></Input> */}
|
|
198
|
+
</Grid.Row>
|
|
199
|
+
<Grid.Row>
|
|
200
|
+
<QueryBuilder
|
|
201
|
+
fields={fields.map((fi, i) => {
|
|
202
|
+
return { name: fi.name, label: fi.name };
|
|
203
|
+
})}
|
|
204
|
+
query={builtQuery}
|
|
205
|
+
onQueryChange={(q) => setBuiltQuery(q)}
|
|
206
|
+
enableDragAndDrop={false}
|
|
207
|
+
//controlElements={bootstrapControlElements}
|
|
208
|
+
//controlClassnames={bootstrapControlClassnames}
|
|
209
|
+
/>
|
|
188
210
|
</Grid.Row>
|
|
189
|
-
{
|
|
211
|
+
{builtQuery && (
|
|
190
212
|
<Grid.Row>
|
|
191
213
|
<Button
|
|
192
214
|
type="submit"
|
|
@@ -213,7 +235,7 @@ const LayerSelectWidget = (props) => {
|
|
|
213
235
|
</Grid.Row>
|
|
214
236
|
{fields.map((field, id) => (
|
|
215
237
|
<p style={{ fontSize: '12px', padding: '0 5px' }}>
|
|
216
|
-
{field.alias}
|
|
238
|
+
<strong>{field.alias}</strong> ({field.type})
|
|
217
239
|
</p>
|
|
218
240
|
))}
|
|
219
241
|
</>
|
|
@@ -53,6 +53,56 @@
|
|
|
53
53
|
animation: fadeDown 0.2s ease-in;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
.ruleGroup {
|
|
57
|
+
border: 1px solid lightgray !important;
|
|
58
|
+
margin: 10px 0;
|
|
59
|
+
background-color: transparent !important;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.ruleGroup-addRule {
|
|
63
|
+
padding: 7px 10px !important;
|
|
64
|
+
background-color: darkgray !important;
|
|
65
|
+
border-radius: 5px;
|
|
66
|
+
color: white;
|
|
67
|
+
cursor: pointer;
|
|
68
|
+
font-size: 12px;
|
|
69
|
+
font-weight: bold;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.ruleGroup-addGroup {
|
|
73
|
+
padding: 7px 10px !important;
|
|
74
|
+
background-color: darkgray !important;
|
|
75
|
+
border-radius: 5px;
|
|
76
|
+
color: white;
|
|
77
|
+
cursor: pointer;
|
|
78
|
+
font-size: 12px;
|
|
79
|
+
font-weight: bold;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.ruleGroup-combinators {
|
|
83
|
+
padding: 0.3em 0 !important;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.rule-operators {
|
|
87
|
+
padding: 0.3em 0 !important;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.rule-value {
|
|
91
|
+
padding: 0.3em 0 !important;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.rule-fields {
|
|
95
|
+
padding: 0.3em 0 !important;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.rule-remove {
|
|
99
|
+
padding: 1px 6px !important;
|
|
100
|
+
border: 2px solid #d02144 !important;
|
|
101
|
+
border-radius: 50px;
|
|
102
|
+
color: #d02144;
|
|
103
|
+
cursor: pointer;
|
|
104
|
+
}
|
|
105
|
+
|
|
56
106
|
@keyframes fadeDown {
|
|
57
107
|
from {
|
|
58
108
|
opacity: 0;
|