@eeacms/volto-eea-map 4.1.0 → 5.0.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/CHANGELOG.md +53 -0
- package/package.json +5 -2
- package/src/Arcgis/Editor/Editor.jsx +130 -0
- package/src/Arcgis/Editor/EditorContext.jsx +2 -0
- package/src/Arcgis/Editor/Fold/Fold.jsx +56 -0
- package/src/Arcgis/Editor/Panels/Panel.jsx +8 -0
- package/src/Arcgis/Editor/Panels/SettingsGeneralPanel.jsx +217 -0
- package/src/Arcgis/Editor/Panels/SettingsLayersPanel.jsx +216 -0
- package/src/Arcgis/Editor/Panels/StructureBaseLayerPanel.jsx +60 -0
- package/src/Arcgis/Editor/Panels/StructureLayersPanel.jsx +394 -0
- package/src/Arcgis/Editor/Panels/StructureWidgetsPanel.jsx +181 -0
- package/src/Arcgis/Editor/Panels/index.js +6 -0
- package/src/Arcgis/Editor/SidebarGroup.jsx +62 -0
- package/src/Arcgis/Layer/Layer.jsx +247 -0
- package/src/Arcgis/Map/Map.jsx +287 -0
- package/src/Arcgis/Map/MapBuilder.jsx +111 -0
- package/src/Arcgis/Map/MapContext.jsx +3 -0
- package/src/Arcgis/Widget/Widget.jsx +170 -0
- package/src/Arcgis/helpers.js +140 -0
- package/src/Blocks/EmbedEEAMap/Edit.jsx +40 -0
- package/src/Blocks/EmbedEEAMap/View.jsx +122 -0
- package/src/Blocks/EmbedEEAMap/helpers.js +12 -0
- package/src/Blocks/EmbedEEAMap/schema.js +126 -0
- package/src/{components → Toolbar}/Share.jsx +1 -1
- package/src/{components/ExtraViews.jsx → Toolbar/Toolbar.jsx} +14 -16
- package/src/{components/visualization → Views}/VisualizationView.jsx +8 -9
- package/src/Widgets/ArcgisColorPickerWidget.jsx +95 -0
- package/src/Widgets/ArcgisRendererWidget/ArcgisRendererWidget.jsx +106 -0
- package/src/Widgets/ArcgisRendererWidget/RendererEditor/ClassBreaks.jsx +8 -0
- package/src/Widgets/ArcgisRendererWidget/RendererEditor/Dictionary.jsx +8 -0
- package/src/Widgets/ArcgisRendererWidget/RendererEditor/DotDensity.jsx +8 -0
- package/src/Widgets/ArcgisRendererWidget/RendererEditor/Heatmap.jsx +8 -0
- package/src/Widgets/ArcgisRendererWidget/RendererEditor/PieChart.jsx +8 -0
- package/src/Widgets/ArcgisRendererWidget/RendererEditor/Simple.jsx +109 -0
- package/src/Widgets/ArcgisRendererWidget/RendererEditor/UniqueValue.jsx +8 -0
- package/src/Widgets/ArcgisRendererWidget/RendererEditor/_Editor.jsx +29 -0
- package/src/Widgets/ArcgisRendererWidget/RendererEditor/_EditorModal.jsx +88 -0
- package/src/Widgets/ArcgisRendererWidget/RendererEditor/_defaults.js +30 -0
- package/src/Widgets/ArcgisSliderWidget.jsx +79 -0
- package/src/Widgets/ArcgisViewpointWidget.jsx +112 -0
- package/src/{components/visualization → Widgets}/VisualizationViewWidget.jsx +11 -10
- package/src/Widgets/VisualizationWidget.jsx +200 -0
- package/src/arcgis.js +48 -0
- package/src/constants.js +225 -7
- package/src/hocs/withArcgis.jsx +27 -0
- package/src/hooks/useChangedProps.jsx +24 -0
- package/src/hooks/useClass.jsx +17 -0
- package/src/hooks/useCopyToClipboard.jsx +25 -0
- package/src/index.js +16 -16
- package/src/jsoneditor.js +72 -0
- package/src/styles/editor.less +446 -0
- package/src/styles/map.less +3 -0
- package/src/components/Blocks/EmbedEEAMap/Edit.jsx +0 -161
- package/src/components/Blocks/EmbedEEAMap/Schema.js +0 -161
- package/src/components/Blocks/EmbedEEAMap/View.jsx +0 -79
- package/src/components/Blocks/EmbedEEAMap/helpers.js +0 -45
- package/src/components/LegendView.jsx +0 -150
- package/src/components/Webmap.jsx +0 -371
- package/src/components/index.js +0 -6
- package/src/components/visualization/VisualizationEditorWidget.jsx +0 -122
- package/src/components/visualization/panelsSchema.js +0 -229
- package/src/components/widgets/DataQueryWidget.jsx +0 -51
- package/src/components/widgets/LayerSelectWidget.jsx +0 -463
- package/src/components/widgets/LayersPanelWidget.jsx +0 -59
- package/src/components/widgets/SimpleColorPickerWidget.jsx +0 -121
- package/src/hocs/index.js +0 -3
- package/src/hocs/withDeviceSize.jsx +0 -45
- package/src/less/global.less +0 -253
- package/src/less/variables.less +0 -5
- package/src/utils.js +0 -151
- /package/src/{components → Toolbar}/FigureNote.jsx +0 -0
- /package/src/{components → Toolbar}/MoreInfoLink.jsx +0 -0
- /package/src/{components → Toolbar}/Sources.jsx +0 -0
|
@@ -1,463 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Icon } from '@plone/volto/components';
|
|
3
|
-
import { Input, Select, Button, Grid, Checkbox } from 'semantic-ui-react';
|
|
4
|
-
|
|
5
|
-
import { flattenToAppURL } from '@plone/volto/helpers';
|
|
6
|
-
import RichTextWidget from '@plone/volto-slate/widgets/RichTextWidget';
|
|
7
|
-
|
|
8
|
-
import { connect } from 'react-redux';
|
|
9
|
-
import { compose } from 'redux';
|
|
10
|
-
|
|
11
|
-
import { getContent } from '@plone/volto/actions';
|
|
12
|
-
|
|
13
|
-
import checkSVG from '@plone/volto/icons/check.svg';
|
|
14
|
-
import closeSVG from '@plone/volto/icons/clear.svg';
|
|
15
|
-
import aheadSVG from '@plone/volto/icons/ahead.svg';
|
|
16
|
-
import resetSVG from '@plone/volto/icons/reset.svg';
|
|
17
|
-
|
|
18
|
-
import { fetchArcGISData } from '../../utils';
|
|
19
|
-
|
|
20
|
-
import loadable from '@loadable/component';
|
|
21
|
-
|
|
22
|
-
const QueryBuilder = loadable(() => import('react-querybuilder'), {
|
|
23
|
-
resolveComponent: (components) => components.QueryBuilder,
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const LayerSelectWidget = (props) => {
|
|
27
|
-
const { onChange, id, data_query } = props;
|
|
28
|
-
|
|
29
|
-
const value = React.useMemo(() => props.value || {}, [props.value]);
|
|
30
|
-
|
|
31
|
-
const {
|
|
32
|
-
available_layers,
|
|
33
|
-
map_data,
|
|
34
|
-
map_service_url,
|
|
35
|
-
layer,
|
|
36
|
-
fields = [],
|
|
37
|
-
query = '',
|
|
38
|
-
description = '',
|
|
39
|
-
hide = false,
|
|
40
|
-
} = value;
|
|
41
|
-
|
|
42
|
-
const [mapData, setMapData] = React.useState(map_data);
|
|
43
|
-
const [checkColor, setCheckColor] = React.useState('');
|
|
44
|
-
const [serviceUrlError, setServiceUrlError] = React.useState('');
|
|
45
|
-
const [serviceUrl, setServiceUrl] = React.useState(map_service_url);
|
|
46
|
-
const [selectedLayer, setSelectedLayer] = React.useState(layer);
|
|
47
|
-
|
|
48
|
-
const [availableLayers, setAvailableLayers] =
|
|
49
|
-
React.useState(available_layers);
|
|
50
|
-
|
|
51
|
-
const [builtQuery, setBuiltQuery] = React.useState(query);
|
|
52
|
-
|
|
53
|
-
const handleServiceUrlCheck = async () => {
|
|
54
|
-
// fetch url, save it, populate layers options
|
|
55
|
-
try {
|
|
56
|
-
let mapData = await fetchArcGISData(serviceUrl);
|
|
57
|
-
setCheckColor('green');
|
|
58
|
-
setMapData(mapData);
|
|
59
|
-
setServiceUrlError('');
|
|
60
|
-
if (mapData.layers && mapData.layers.length > 0) {
|
|
61
|
-
const mappedLayers = mapData.layers
|
|
62
|
-
.filter(
|
|
63
|
-
(layer) => layer && layer.type && layer.type !== 'Group Layer',
|
|
64
|
-
)
|
|
65
|
-
.map((layer, i) => {
|
|
66
|
-
return {
|
|
67
|
-
key: layer.id,
|
|
68
|
-
value: layer,
|
|
69
|
-
text: `${layer.name} (${layer.type})`,
|
|
70
|
-
};
|
|
71
|
-
});
|
|
72
|
-
setAvailableLayers(mappedLayers);
|
|
73
|
-
}
|
|
74
|
-
onChange(id, {
|
|
75
|
-
...value,
|
|
76
|
-
layer: selectedLayer,
|
|
77
|
-
map_service_url: serviceUrl,
|
|
78
|
-
available_layers: availableLayers,
|
|
79
|
-
map_data: mapData,
|
|
80
|
-
description,
|
|
81
|
-
hide,
|
|
82
|
-
});
|
|
83
|
-
} catch (e) {
|
|
84
|
-
setCheckColor('youtube');
|
|
85
|
-
setServiceUrlError({ error: e.message, status: e.status });
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
React.useEffect(() => {
|
|
90
|
-
import(
|
|
91
|
-
/* webpackChunkName: "react-querybuilder-css" */ 'react-querybuilder/dist/query-builder.css'
|
|
92
|
-
);
|
|
93
|
-
props.getContent('', null, id);
|
|
94
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
95
|
-
}, []);
|
|
96
|
-
|
|
97
|
-
React.useEffect(() => {
|
|
98
|
-
if (query && !builtQuery) {
|
|
99
|
-
setBuiltQuery(query);
|
|
100
|
-
}
|
|
101
|
-
}, [query, builtQuery]);
|
|
102
|
-
|
|
103
|
-
React.useEffect(() => {
|
|
104
|
-
//detect existing queries in block content. If it exists. Apply matching queries to layer on fresh layer load
|
|
105
|
-
if (
|
|
106
|
-
map_service_url &&
|
|
107
|
-
layer &&
|
|
108
|
-
!query &&
|
|
109
|
-
data_query &&
|
|
110
|
-
data_query.length > 0
|
|
111
|
-
) {
|
|
112
|
-
let autoQuery = {
|
|
113
|
-
combinator: 'or',
|
|
114
|
-
rules: [],
|
|
115
|
-
};
|
|
116
|
-
data_query.forEach((param, i) => {
|
|
117
|
-
if (
|
|
118
|
-
fields &&
|
|
119
|
-
fields.length > 0 &&
|
|
120
|
-
fields.filter(
|
|
121
|
-
(field, j) => field.name === param.alias || field.name === param.i,
|
|
122
|
-
).length > 0
|
|
123
|
-
) {
|
|
124
|
-
autoQuery.rules = [
|
|
125
|
-
...autoQuery.rules,
|
|
126
|
-
{ field: param.alias || param.i, operator: '=', value: param.v[0] },
|
|
127
|
-
];
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
if (autoQuery.rules.length > 0) {
|
|
131
|
-
onChange(id, {
|
|
132
|
-
...value,
|
|
133
|
-
query: autoQuery,
|
|
134
|
-
});
|
|
135
|
-
setBuiltQuery(autoQuery);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
139
|
-
}, [map_service_url, layer, query, data_query, fields]);
|
|
140
|
-
|
|
141
|
-
const handleLayerFetch = async (service_url, id) => {
|
|
142
|
-
try {
|
|
143
|
-
let fullLayer = await fetchArcGISData(`${service_url}/${id}`);
|
|
144
|
-
return fullLayer;
|
|
145
|
-
} catch (e) {}
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
const handleSelectLayer = async (layer) => {
|
|
149
|
-
const fullLayer = await handleLayerFetch(serviceUrl, layer.id);
|
|
150
|
-
setSelectedLayer(layer);
|
|
151
|
-
onChange(id, {
|
|
152
|
-
...value,
|
|
153
|
-
layer,
|
|
154
|
-
fullLayer,
|
|
155
|
-
fields: fullLayer.fields,
|
|
156
|
-
map_service_url: serviceUrl,
|
|
157
|
-
available_layers: availableLayers,
|
|
158
|
-
map_data: mapData,
|
|
159
|
-
query: '',
|
|
160
|
-
});
|
|
161
|
-
setBuiltQuery('');
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
const handleQueryLayer = () => {
|
|
165
|
-
if (builtQuery) {
|
|
166
|
-
onChange(id, {
|
|
167
|
-
...value,
|
|
168
|
-
query: builtQuery,
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
const handleChangeDescription = (val) => {
|
|
174
|
-
if (val) {
|
|
175
|
-
onChange(id, {
|
|
176
|
-
...value,
|
|
177
|
-
description: val,
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
const handleOpacityChange = (val) => {
|
|
183
|
-
onChange(id, {
|
|
184
|
-
...value,
|
|
185
|
-
opacity: val,
|
|
186
|
-
});
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
const handleChangeServiceUrl = (value) => {
|
|
190
|
-
setServiceUrlError('');
|
|
191
|
-
setCheckColor('');
|
|
192
|
-
setAvailableLayers('');
|
|
193
|
-
setBuiltQuery('');
|
|
194
|
-
setSelectedLayer('');
|
|
195
|
-
setMapData('');
|
|
196
|
-
|
|
197
|
-
setServiceUrl(value);
|
|
198
|
-
};
|
|
199
|
-
|
|
200
|
-
const handleMinScaleChange = (minScaleOverride) => {
|
|
201
|
-
onChange(id, {
|
|
202
|
-
...value,
|
|
203
|
-
minScaleOverride,
|
|
204
|
-
});
|
|
205
|
-
};
|
|
206
|
-
|
|
207
|
-
const handleMaxScaleChange = (maxScaleOverride) => {
|
|
208
|
-
onChange(id, {
|
|
209
|
-
...value,
|
|
210
|
-
maxScaleOverride,
|
|
211
|
-
});
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
const handleReset = () => {
|
|
215
|
-
setServiceUrlError('');
|
|
216
|
-
setServiceUrl(map_service_url);
|
|
217
|
-
setCheckColor('');
|
|
218
|
-
setAvailableLayers(available_layers);
|
|
219
|
-
setBuiltQuery('');
|
|
220
|
-
setSelectedLayer(layer);
|
|
221
|
-
setMapData(map_data);
|
|
222
|
-
};
|
|
223
|
-
|
|
224
|
-
const handleHideInLegend = (v) => {
|
|
225
|
-
onChange(id, {
|
|
226
|
-
...value,
|
|
227
|
-
hide: v,
|
|
228
|
-
});
|
|
229
|
-
};
|
|
230
|
-
|
|
231
|
-
return (
|
|
232
|
-
<div
|
|
233
|
-
style={{
|
|
234
|
-
padding: '0 5px',
|
|
235
|
-
}}
|
|
236
|
-
>
|
|
237
|
-
<Grid>
|
|
238
|
-
<div className="spaced-row">
|
|
239
|
-
<Grid.Row stretched>
|
|
240
|
-
<h5 style={{ padding: '0', margin: '15px 0px 5px 0px' }}>
|
|
241
|
-
Service URL
|
|
242
|
-
</h5>
|
|
243
|
-
</Grid.Row>
|
|
244
|
-
|
|
245
|
-
<Grid.Row>
|
|
246
|
-
<Input
|
|
247
|
-
type="text"
|
|
248
|
-
onChange={(e, { value }) => handleChangeServiceUrl(value)}
|
|
249
|
-
style={{ width: '100%' }}
|
|
250
|
-
error={serviceUrlError}
|
|
251
|
-
value={serviceUrl}
|
|
252
|
-
></Input>
|
|
253
|
-
|
|
254
|
-
<span style={{ fontSize: '12px', color: 'darkred' }}>
|
|
255
|
-
{serviceUrlError.error}
|
|
256
|
-
</span>
|
|
257
|
-
</Grid.Row>
|
|
258
|
-
{serviceUrl && (
|
|
259
|
-
<Grid.Row style={{ display: 'flex' }}>
|
|
260
|
-
{serviceUrl !== map_service_url && (
|
|
261
|
-
<Button
|
|
262
|
-
size="small"
|
|
263
|
-
compact
|
|
264
|
-
className="layer-reset-button"
|
|
265
|
-
onClick={handleReset}
|
|
266
|
-
>
|
|
267
|
-
<Icon name={resetSVG} title="Reset" size="20px" />
|
|
268
|
-
</Button>
|
|
269
|
-
)}
|
|
270
|
-
<Button
|
|
271
|
-
size="small"
|
|
272
|
-
color={checkColor}
|
|
273
|
-
compact
|
|
274
|
-
className="layer-check-button"
|
|
275
|
-
onClick={handleServiceUrlCheck}
|
|
276
|
-
>
|
|
277
|
-
<Icon
|
|
278
|
-
name={serviceUrlError ? closeSVG : checkSVG}
|
|
279
|
-
title="Submit"
|
|
280
|
-
size="20px"
|
|
281
|
-
/>
|
|
282
|
-
</Button>
|
|
283
|
-
</Grid.Row>
|
|
284
|
-
)}
|
|
285
|
-
</div>
|
|
286
|
-
{mapData && mapData.mapName && (
|
|
287
|
-
<div className="spaced-row">
|
|
288
|
-
<Grid.Row>
|
|
289
|
-
<h5 style={{ padding: '0', margin: '15px 0px 5px 0px' }}>
|
|
290
|
-
Map name:
|
|
291
|
-
</h5>
|
|
292
|
-
<p>{mapData.mapName}</p>
|
|
293
|
-
</Grid.Row>
|
|
294
|
-
</div>
|
|
295
|
-
)}
|
|
296
|
-
{availableLayers && availableLayers.length > 0 && (
|
|
297
|
-
<div className="spaced-row">
|
|
298
|
-
<Grid.Row>
|
|
299
|
-
<h5 style={{ padding: '0', margin: '15px 0px 5px 0px' }}>
|
|
300
|
-
Layer
|
|
301
|
-
</h5>
|
|
302
|
-
</Grid.Row>
|
|
303
|
-
<Grid.Row>
|
|
304
|
-
<Select
|
|
305
|
-
onChange={(e, { value }) => handleSelectLayer(value)}
|
|
306
|
-
options={availableLayers}
|
|
307
|
-
style={{ width: '100%' }}
|
|
308
|
-
placeholder="Select layer"
|
|
309
|
-
value={selectedLayer}
|
|
310
|
-
/>
|
|
311
|
-
</Grid.Row>
|
|
312
|
-
</div>
|
|
313
|
-
)}
|
|
314
|
-
{availableLayers && availableLayers.length > 0 && selectedLayer && (
|
|
315
|
-
<div className="spaced-row">
|
|
316
|
-
<Grid.Row stretched>
|
|
317
|
-
<h5>Opacity:</h5>
|
|
318
|
-
<input
|
|
319
|
-
className="map-number-input"
|
|
320
|
-
type="number"
|
|
321
|
-
min={0}
|
|
322
|
-
max={1}
|
|
323
|
-
step={0.1}
|
|
324
|
-
value={value?.opacity ? value?.opacity : 1}
|
|
325
|
-
onChange={(e) => handleOpacityChange(e.target.value)}
|
|
326
|
-
/>
|
|
327
|
-
<input
|
|
328
|
-
className="map-range-input"
|
|
329
|
-
type="range"
|
|
330
|
-
min={0}
|
|
331
|
-
max={1}
|
|
332
|
-
step={0.1}
|
|
333
|
-
value={value?.opacity ? value?.opacity : 1}
|
|
334
|
-
onChange={(e) => handleOpacityChange(e.target.value)}
|
|
335
|
-
/>
|
|
336
|
-
</Grid.Row>
|
|
337
|
-
<Grid.Row stretched>
|
|
338
|
-
<h5 style={{ padding: '0', margin: '15px 0px 5px 0px' }}>
|
|
339
|
-
Min scale:
|
|
340
|
-
</h5>
|
|
341
|
-
<input
|
|
342
|
-
className="map-number-input"
|
|
343
|
-
type="number"
|
|
344
|
-
min={0}
|
|
345
|
-
step={1}
|
|
346
|
-
value={
|
|
347
|
-
value?.minScaleOverride
|
|
348
|
-
? value?.minScaleOverride
|
|
349
|
-
: value?.layer?.minScale
|
|
350
|
-
}
|
|
351
|
-
onChange={(e) => handleMinScaleChange(e.target.value)}
|
|
352
|
-
/>
|
|
353
|
-
</Grid.Row>
|
|
354
|
-
<Grid.Row stretched>
|
|
355
|
-
<h5 style={{ padding: '0', margin: '15px 0px 5px 0px' }}>
|
|
356
|
-
Max scale:
|
|
357
|
-
</h5>
|
|
358
|
-
<input
|
|
359
|
-
className="map-number-input"
|
|
360
|
-
type="number"
|
|
361
|
-
min={0}
|
|
362
|
-
step={1}
|
|
363
|
-
value={
|
|
364
|
-
value?.maxScaleOverride
|
|
365
|
-
? value?.maxScaleOverride
|
|
366
|
-
: value?.layer?.maxScale
|
|
367
|
-
}
|
|
368
|
-
onChange={(e) => handleMaxScaleChange(e.target.value)}
|
|
369
|
-
/>
|
|
370
|
-
</Grid.Row>
|
|
371
|
-
<Grid.Row stretched>
|
|
372
|
-
<h5 style={{ padding: '0', margin: '15px 0px 5px 0px' }}>
|
|
373
|
-
Description
|
|
374
|
-
</h5>
|
|
375
|
-
</Grid.Row>
|
|
376
|
-
<Grid.Row stretched>
|
|
377
|
-
<div className="map-layer-description-field">
|
|
378
|
-
<RichTextWidget
|
|
379
|
-
title="description"
|
|
380
|
-
onChange={(name, value) => {
|
|
381
|
-
handleChangeDescription(value);
|
|
382
|
-
}}
|
|
383
|
-
value={value.description}
|
|
384
|
-
placeholder="Set Description"
|
|
385
|
-
/>
|
|
386
|
-
</div>
|
|
387
|
-
</Grid.Row>
|
|
388
|
-
<Grid.Row stretched>
|
|
389
|
-
<h5>Hide in legend:</h5>{' '}
|
|
390
|
-
<Checkbox
|
|
391
|
-
label="Layer will be hidden in legend"
|
|
392
|
-
checked={hide}
|
|
393
|
-
onChange={(e, { checked }) => handleHideInLegend(checked)}
|
|
394
|
-
/>
|
|
395
|
-
</Grid.Row>
|
|
396
|
-
</div>
|
|
397
|
-
)}
|
|
398
|
-
{availableLayers && fields && fields.length > 0 && (
|
|
399
|
-
<div className="spaced-row">
|
|
400
|
-
<h5 style={{ padding: '0', margin: '15px 0px 5px 0px' }}>
|
|
401
|
-
Query Layer
|
|
402
|
-
</h5>
|
|
403
|
-
<Grid.Row>
|
|
404
|
-
<QueryBuilder
|
|
405
|
-
fields={fields.map((fi, i) => {
|
|
406
|
-
return { name: fi.name, label: fi.name };
|
|
407
|
-
})}
|
|
408
|
-
query={builtQuery}
|
|
409
|
-
onQueryChange={(q) => setBuiltQuery(q)}
|
|
410
|
-
enableDragAndDrop={false}
|
|
411
|
-
/>
|
|
412
|
-
</Grid.Row>
|
|
413
|
-
{builtQuery && (
|
|
414
|
-
<Grid.Row style={{ display: 'flex' }}>
|
|
415
|
-
<Button
|
|
416
|
-
type="submit"
|
|
417
|
-
size="tiny"
|
|
418
|
-
compact
|
|
419
|
-
className="layer-submit-button "
|
|
420
|
-
color={'green'}
|
|
421
|
-
onClick={handleQueryLayer}
|
|
422
|
-
>
|
|
423
|
-
<Icon name={aheadSVG} title="Check Url" size="20px" />
|
|
424
|
-
</Button>
|
|
425
|
-
</Grid.Row>
|
|
426
|
-
)}
|
|
427
|
-
<Grid.Row>
|
|
428
|
-
<p
|
|
429
|
-
style={{
|
|
430
|
-
fontSize: '13px',
|
|
431
|
-
fontWeight: 'bold',
|
|
432
|
-
color: 'darkgray',
|
|
433
|
-
}}
|
|
434
|
-
>
|
|
435
|
-
Available Fields:
|
|
436
|
-
</p>
|
|
437
|
-
</Grid.Row>
|
|
438
|
-
{fields.map((field, id) => (
|
|
439
|
-
<p style={{ fontSize: '12px', padding: '0 5px' }}>
|
|
440
|
-
<strong>{field.alias}</strong> ({field.type})
|
|
441
|
-
</p>
|
|
442
|
-
))}
|
|
443
|
-
</div>
|
|
444
|
-
)}
|
|
445
|
-
</Grid>
|
|
446
|
-
</div>
|
|
447
|
-
);
|
|
448
|
-
};
|
|
449
|
-
|
|
450
|
-
export default compose(
|
|
451
|
-
connect(
|
|
452
|
-
(state) => {
|
|
453
|
-
const pathname = flattenToAppURL(state.content.data['@id']);
|
|
454
|
-
return {
|
|
455
|
-
content: state.content.data,
|
|
456
|
-
data_query: state.connected_data_parameters.byContextPath[pathname],
|
|
457
|
-
};
|
|
458
|
-
},
|
|
459
|
-
{
|
|
460
|
-
getContent,
|
|
461
|
-
},
|
|
462
|
-
),
|
|
463
|
-
)(LayerSelectWidget);
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Button } from 'semantic-ui-react';
|
|
3
|
-
import LayerSelectWidget from './LayerSelectWidget';
|
|
4
|
-
|
|
5
|
-
const LayersPanelWidget = ({ data, onChange, block }) => {
|
|
6
|
-
const map_layers = React.useMemo(
|
|
7
|
-
() => data.map_layers || [],
|
|
8
|
-
[data.map_layers],
|
|
9
|
-
);
|
|
10
|
-
|
|
11
|
-
React.useEffect(() => {
|
|
12
|
-
if (!data.map_layers) {
|
|
13
|
-
onChange('map_data', {
|
|
14
|
-
...data,
|
|
15
|
-
map_layers: [
|
|
16
|
-
{
|
|
17
|
-
map_service_url: '',
|
|
18
|
-
layer: '',
|
|
19
|
-
available_layers: [],
|
|
20
|
-
map_data: {},
|
|
21
|
-
},
|
|
22
|
-
],
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
}, [data, block, onChange]);
|
|
26
|
-
|
|
27
|
-
const handleAddLayer = () => {
|
|
28
|
-
onChange('map_data', {
|
|
29
|
-
...data,
|
|
30
|
-
map_layers: [
|
|
31
|
-
...data.map_layers,
|
|
32
|
-
{ map_service_url: '', layer: '', available_layers: [], map_data: {} },
|
|
33
|
-
],
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<div>
|
|
39
|
-
{map_layers &&
|
|
40
|
-
map_layers.length > 0 &&
|
|
41
|
-
map_layers.map((layer, i) => (
|
|
42
|
-
<LayerSelectWidget
|
|
43
|
-
key={i}
|
|
44
|
-
index={i}
|
|
45
|
-
layer={layer}
|
|
46
|
-
onChange={onChange}
|
|
47
|
-
block={block}
|
|
48
|
-
data={data}
|
|
49
|
-
/>
|
|
50
|
-
))}
|
|
51
|
-
|
|
52
|
-
<Button size="tiny" onClick={handleAddLayer}>
|
|
53
|
-
Add Layer
|
|
54
|
-
</Button>
|
|
55
|
-
</div>
|
|
56
|
-
);
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export default LayersPanelWidget;
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { FormFieldWrapper, Icon } from '@plone/volto/components';
|
|
3
|
-
import { Button } from 'semantic-ui-react';
|
|
4
|
-
import loadable from '@loadable/component';
|
|
5
|
-
import clearSVG from '@plone/volto/icons/clear.svg';
|
|
6
|
-
import checkSVG from '@plone/volto/icons/check.svg';
|
|
7
|
-
|
|
8
|
-
const ReactColor = loadable.lib(() => import('react-color'));
|
|
9
|
-
|
|
10
|
-
const SimpleColorPickerWidget = (props) => {
|
|
11
|
-
const { id, value, onChange, available_colors } = props;
|
|
12
|
-
const [showPicker, setShowPicker] = React.useState(false);
|
|
13
|
-
|
|
14
|
-
const [color, setColor] = React.useState(value);
|
|
15
|
-
|
|
16
|
-
const handleChangeColor = (valColor) => {
|
|
17
|
-
setColor(valColor);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const handleConfirmColor = () => {
|
|
21
|
-
onChange(id, color);
|
|
22
|
-
setShowPicker(false);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const handleAbortColor = () => {
|
|
26
|
-
setColor(value);
|
|
27
|
-
setShowPicker(false);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
return (
|
|
31
|
-
<FormFieldWrapper
|
|
32
|
-
{...props}
|
|
33
|
-
draggable={false}
|
|
34
|
-
className="simple-color-picker-widget"
|
|
35
|
-
>
|
|
36
|
-
<div style={{ position: 'relative' }}>
|
|
37
|
-
<Button.Group fluid>
|
|
38
|
-
<Button
|
|
39
|
-
color={value?.hex ? value?.hex : 'black'}
|
|
40
|
-
style={{ backgroundColor: value?.hex ? value?.hex : 'black' }}
|
|
41
|
-
onClick={() => setShowPicker(true)}
|
|
42
|
-
size="small"
|
|
43
|
-
fluid
|
|
44
|
-
title="Pick color"
|
|
45
|
-
>
|
|
46
|
-
{''}
|
|
47
|
-
</Button>
|
|
48
|
-
<Button
|
|
49
|
-
compact
|
|
50
|
-
style={{ paddingLeft: '8px', paddingRight: '0px' }}
|
|
51
|
-
onClick={() => onChange(id, null)}
|
|
52
|
-
>
|
|
53
|
-
<Icon name={clearSVG} size="18px" color="red" />
|
|
54
|
-
</Button>
|
|
55
|
-
{showPicker ? (
|
|
56
|
-
<div
|
|
57
|
-
style={{
|
|
58
|
-
position: 'absolute',
|
|
59
|
-
top: '0',
|
|
60
|
-
zIndex: '77',
|
|
61
|
-
background: 'lightgrey',
|
|
62
|
-
display: 'flex',
|
|
63
|
-
flexDirection: 'column',
|
|
64
|
-
padding: '5px',
|
|
65
|
-
borderRadius: '2px',
|
|
66
|
-
}}
|
|
67
|
-
>
|
|
68
|
-
<ReactColor>
|
|
69
|
-
{({ SketchPicker }) => {
|
|
70
|
-
return (
|
|
71
|
-
<SketchPicker
|
|
72
|
-
width="180px"
|
|
73
|
-
colors={available_colors}
|
|
74
|
-
color={
|
|
75
|
-
color?.rgb
|
|
76
|
-
? color.rgb
|
|
77
|
-
: {
|
|
78
|
-
r: 0,
|
|
79
|
-
g: 0,
|
|
80
|
-
b: 0,
|
|
81
|
-
a: 1,
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
onChangeComplete={(value) => {
|
|
85
|
-
handleChangeColor(value);
|
|
86
|
-
}}
|
|
87
|
-
></SketchPicker>
|
|
88
|
-
);
|
|
89
|
-
}}
|
|
90
|
-
</ReactColor>
|
|
91
|
-
<Button.Group>
|
|
92
|
-
<Button
|
|
93
|
-
size="tiny"
|
|
94
|
-
compact
|
|
95
|
-
title="Reset color"
|
|
96
|
-
style={{ paddingLeft: '8px', paddingRight: '0px' }}
|
|
97
|
-
onClick={() => handleAbortColor()}
|
|
98
|
-
>
|
|
99
|
-
<Icon name={clearSVG} size="18px" />
|
|
100
|
-
</Button>
|
|
101
|
-
<Button
|
|
102
|
-
onClick={() => handleConfirmColor()}
|
|
103
|
-
color="green"
|
|
104
|
-
compact
|
|
105
|
-
size="tiny"
|
|
106
|
-
title="Confirm color"
|
|
107
|
-
>
|
|
108
|
-
<Icon name={checkSVG} size="18px" />
|
|
109
|
-
</Button>
|
|
110
|
-
</Button.Group>
|
|
111
|
-
</div>
|
|
112
|
-
) : (
|
|
113
|
-
''
|
|
114
|
-
)}
|
|
115
|
-
</Button.Group>
|
|
116
|
-
</div>
|
|
117
|
-
</FormFieldWrapper>
|
|
118
|
-
);
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
export default SimpleColorPickerWidget;
|
package/src/hocs/index.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
export default function withDeviceSize(WrappedComponent) {
|
|
4
|
-
return (props) => {
|
|
5
|
-
const [device, setDevice] = React.useState(null);
|
|
6
|
-
|
|
7
|
-
const updateScreenSize = () => {
|
|
8
|
-
if (__CLIENT__) {
|
|
9
|
-
const screenWidth =
|
|
10
|
-
window.innerWidth ||
|
|
11
|
-
document.documentElement.clientWidth ||
|
|
12
|
-
document.body.clientWidth ||
|
|
13
|
-
0;
|
|
14
|
-
|
|
15
|
-
setDevice(getDeviceConfig(screenWidth));
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const getDeviceConfig = (width) => {
|
|
20
|
-
// semantic ui breakpoints
|
|
21
|
-
if (width < 320) {
|
|
22
|
-
return 'mobile';
|
|
23
|
-
} else if (width >= 320 && width < 768) {
|
|
24
|
-
return 'tablet';
|
|
25
|
-
} else if (width >= 768 && width < 992) {
|
|
26
|
-
return 'computer';
|
|
27
|
-
} else if (width >= 992 && width < 1280) {
|
|
28
|
-
return 'large';
|
|
29
|
-
} else if (width >= 1280) {
|
|
30
|
-
return 'widescreen';
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
React.useEffect(() => {
|
|
35
|
-
updateScreenSize();
|
|
36
|
-
window.addEventListener('resize', updateScreenSize);
|
|
37
|
-
return () => {
|
|
38
|
-
window.removeEventListener('resize', updateScreenSize);
|
|
39
|
-
};
|
|
40
|
-
/* eslint-disable-next-line */
|
|
41
|
-
}, []);
|
|
42
|
-
|
|
43
|
-
return <WrappedComponent {...props} device={device} />;
|
|
44
|
-
};
|
|
45
|
-
}
|